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) - - - - - - - - - - Set on "false" to ensure, that only positive changes are accepted (typically for counter) - - @@ -467,6 +452,21 @@ textarea { + + + + + + + + + + Set on "false" to ensure, that only positive changes are accepted (typically for counter) + + @@ -1775,6 +1775,7 @@ function UpdateInputIndividual() ReadParameter(param, "PostProcessing", "MaxRateType", true, NUNBERSAkt) ReadParameter(param, "PostProcessing", "ExtendedResolution", true, NUNBERSAkt) ReadParameter(param, "PostProcessing", "IgnoreLeadingNaN", true, NUNBERSAkt) + ReadParameter(param, "PostProcessing", "AllowNegativeRates", true, NUNBERSAkt) } var sel = document.getElementById("Numbers_value1"); @@ -1785,6 +1786,7 @@ function UpdateInputIndividual() WriteParameter(param, category, "PostProcessing", "MaxRateType", true, NUNBERSAkt); WriteParameter(param, category, "PostProcessing", "ExtendedResolution", true, NUNBERSAkt); WriteParameter(param, category, "PostProcessing", "IgnoreLeadingNaN", true, NUNBERSAkt); + WriteParameter(param, category, "PostProcessing", "AllowNegativeRates", true, NUNBERSAkt); } function UpdateInput() { @@ -1820,7 +1822,7 @@ function UpdateInput() { WriteParameter(param, category, "PostProcessing", "PreValueUse", true); WriteParameter(param, category, "PostProcessing", "PreValueAgeStartup", true); - WriteParameter(param, category, "PostProcessing", "AllowNegativeRates", true); +// WriteParameter(param, category, "PostProcessing", "AllowNegativeRates", true); WriteParameter(param, category, "PostProcessing", "ErrorMessage", true); WriteParameter(param, category, "PostProcessing", "CheckDigitIncreaseConsistency", true); @@ -1943,7 +1945,7 @@ function ReadParameterAll() ReadParameter(param, "PostProcessing", "PreValueUse", true); ReadParameter(param, "PostProcessing", "PreValueAgeStartup", true); - ReadParameter(param, "PostProcessing", "AllowNegativeRates", true); +// ReadParameter(param, "PostProcessing", "AllowNegativeRates", true); ReadParameter(param, "PostProcessing", "ErrorMessage", true); ReadParameter(param, "PostProcessing", "CheckDigitIncreaseConsistency", true); diff --git a/sd-card/html/readconfigparam.js b/sd-card/html/readconfigparam.js index 596b9ed2..b92b2611 100644 --- a/sd-card/html/readconfigparam.js +++ b/sd-card/html/readconfigparam.js @@ -162,7 +162,7 @@ function ParseConfig() { ParamAddValue(param, catname, "AnalogDigitalTransitionStart", 1, true); ParamAddValue(param, catname, "PreValueUse"); ParamAddValue(param, catname, "PreValueAgeStartup"); - ParamAddValue(param, catname, "AllowNegativeRates"); + ParamAddValue(param, catname, "AllowNegativeRates", 1, true); ParamAddValue(param, catname, "MaxRateValue", 1, true); ParamAddValue(param, catname, "MaxRateType", 1, true); ParamAddValue(param, catname, "ExtendedResolution", 1, true);