From cb4e6a0a30edffbdf5a00b36e09bd5fe332e5bb8 Mon Sep 17 00:00:00 2001 From: jomjol <30766535+jomjol@users.noreply.github.com> Date: Sat, 14 Jan 2023 13:28:58 +0100 Subject: [PATCH] Initial Implementation (#1834) --- .../ClassFlowPostProcessing.cpp | 33 +++++++++++++++++ .../ClassFlowPostProcessing.h | 2 ++ sd-card/html/edit_config_param.html | 36 ++++++++++--------- sd-card/html/readconfigparam.js | 2 +- 4 files changed, 55 insertions(+), 18 deletions(-) diff --git a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp index 11db8e01..b8e34eed 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp @@ -393,6 +393,36 @@ void ClassFlowPostProcessing::handleAnalogDigitalTransitionStart(string _decsep, } } +void ClassFlowPostProcessing::handleAllowNegativeRate(string _decsep, string _value) +{ + string _digit, _decpos; + int _pospunkt = _decsep.find_first_of("."); +// ESP_LOGD(TAG, "Name: %s, Pospunkt: %d", _decsep.c_str(), _pospunkt); + if (_pospunkt > -1) + _digit = _decsep.substr(0, _pospunkt); + else + _digit = "default"; + + for (int j = 0; j < NUMBERS.size(); ++j) + { + bool _rt = false; + + if (toUpper(_value) == "TRUE") + _rt = true; + + if (_digit == "default") // Set to default first (if nothing else is set) + { + NUMBERS[j]->AllowNegativeRates = _rt; + } + + if (NUMBERS[j]->name == _digit) + { + NUMBERS[j]->AllowNegativeRates = _rt; + } + } +} + + void ClassFlowPostProcessing::handleMaxRateType(string _decsep, string _value) { @@ -521,9 +551,12 @@ bool ClassFlowPostProcessing::ReadParameter(FILE* pfile, string& aktparamgraph) } if ((toUpper(_param) == "ALLOWNEGATIVERATES") && (splitted.size() > 1)) { + handleAllowNegativeRate(splitted[0], splitted[1]); +/* Updated to allow individual Settings if (toUpper(splitted[1]) == "TRUE") for (_n = 0; _n < NUMBERS.size(); ++_n) NUMBERS[_n]->AllowNegativeRates = true; +*/ } if ((toUpper(_param) == "ERRORMESSAGE") && (splitted.size() > 1)) { diff --git a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h index 75c04e19..b2fbc4b8 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h +++ b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h @@ -43,6 +43,8 @@ protected: void handleDecimalExtendedResolution(string _decsep, string _value); void handleMaxRateType(string _decsep, string _value); void handleAnalogDigitalTransitionStart(string _decsep, string _value); + void handleAllowNegativeRate(string _decsep, string _value); + std::string GetStringReadouts(general); void WriteDataLog(int _index); diff --git a/sd-card/html/edit_config_param.html b/sd-card/html/edit_config_param.html index cf7c1e43..b7be46c8 100644 --- a/sd-card/html/edit_config_param.html +++ b/sd-card/html/edit_config_param.html @@ -410,21 +410,6 @@ textarea { Time (in minutes), how long a previous read value is valid after reboot (default = 720 min) -