Initial Implementation (#1834)

This commit is contained in:
jomjol
2023-01-14 13:28:58 +01:00
committed by GitHub
parent fd2d4408bf
commit cb4e6a0a30
4 changed files with 55 additions and 18 deletions

View File

@@ -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) 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)) if ((toUpper(_param) == "ALLOWNEGATIVERATES") && (splitted.size() > 1))
{ {
handleAllowNegativeRate(splitted[0], splitted[1]);
/* Updated to allow individual Settings
if (toUpper(splitted[1]) == "TRUE") if (toUpper(splitted[1]) == "TRUE")
for (_n = 0; _n < NUMBERS.size(); ++_n) for (_n = 0; _n < NUMBERS.size(); ++_n)
NUMBERS[_n]->AllowNegativeRates = true; NUMBERS[_n]->AllowNegativeRates = true;
*/
} }
if ((toUpper(_param) == "ERRORMESSAGE") && (splitted.size() > 1)) if ((toUpper(_param) == "ERRORMESSAGE") && (splitted.size() > 1))
{ {

View File

@@ -43,6 +43,8 @@ protected:
void handleDecimalExtendedResolution(string _decsep, string _value); void handleDecimalExtendedResolution(string _decsep, string _value);
void handleMaxRateType(string _decsep, string _value); void handleMaxRateType(string _decsep, string _value);
void handleAnalogDigitalTransitionStart(string _decsep, string _value); void handleAnalogDigitalTransitionStart(string _decsep, string _value);
void handleAllowNegativeRate(string _decsep, string _value);
std::string GetStringReadouts(general); std::string GetStringReadouts(general);
void WriteDataLog(int _index); void WriteDataLog(int _index);

View File

@@ -410,21 +410,6 @@ textarea {
Time (in minutes), how long a previous read value is valid after reboot (default = 720 min) Time (in minutes), how long a previous read value is valid after reboot (default = 720 min)
</td> </td>
</tr> </tr>
<tr>
<td class="indent1">
<input type="checkbox" id="PostProcessing_AllowNegativeRates_enabled" value="1" onclick = 'InvertEnableItem("PostProcessing", "AllowNegativeRates")' unchecked >
<label for=PostProcessing_AllowNegativeRates_enabled><class id="PostProcessing_AllowNegativeRates_text" style="color:black;">AllowNegativeRates</class></label>
</td>
<td>
<select id="PostProcessing_AllowNegativeRates_value1">
<option value="true" selected>true</option>
<option value="false" >false</option>
</select>
</td>
<td style="font-size: 80%;">
Set on "false" to ensure, that only positive changes are accepted (typically for counter)
</td>
</tr>
<tr class="expert" id="ex12"> <tr class="expert" id="ex12">
<td class="indent1"> <td class="indent1">
<input type="checkbox" id="PostProcessing_ErrorMessage_enabled" value="1" onclick = 'InvertEnableItem("PostProcessing", "ErrorMessage")' unchecked > <input type="checkbox" id="PostProcessing_ErrorMessage_enabled" value="1" onclick = 'InvertEnableItem("PostProcessing", "ErrorMessage")' unchecked >
@@ -467,6 +452,21 @@ textarea {
</select></b> </select></b>
</td> </td>
</tr> </tr>
<tr>
<td class="indent1">
<input type="checkbox" id="PostProcessing_AllowNegativeRates_enabled" value="1" onclick = 'InvertEnableItem("PostProcessing", "AllowNegativeRates")' unchecked >
<label for=PostProcessing_AllowNegativeRates_enabled><class id="PostProcessing_AllowNegativeRates_text" style="color:black;">AllowNegativeRates</class></label>
</td>
<td>
<select id="PostProcessing_AllowNegativeRates_value1">
<option value="true" selected>true</option>
<option value="false" >false</option>
</select>
</td>
<td style="font-size: 80%;">
Set on "false" to ensure, that only positive changes are accepted (typically for counter)
</td>
</tr>
<tr> <tr>
<td class="indent1"> <td class="indent1">
<input type="checkbox" id="PostProcessing_DecimalShift_enabled" value="1" onclick = 'InvertEnableItem("PostProcessing", "DecimalShift")' unchecked > <input type="checkbox" id="PostProcessing_DecimalShift_enabled" value="1" onclick = 'InvertEnableItem("PostProcessing", "DecimalShift")' unchecked >
@@ -1775,6 +1775,7 @@ function UpdateInputIndividual()
ReadParameter(param, "PostProcessing", "MaxRateType", true, NUNBERSAkt) ReadParameter(param, "PostProcessing", "MaxRateType", true, NUNBERSAkt)
ReadParameter(param, "PostProcessing", "ExtendedResolution", true, NUNBERSAkt) ReadParameter(param, "PostProcessing", "ExtendedResolution", true, NUNBERSAkt)
ReadParameter(param, "PostProcessing", "IgnoreLeadingNaN", true, NUNBERSAkt) ReadParameter(param, "PostProcessing", "IgnoreLeadingNaN", true, NUNBERSAkt)
ReadParameter(param, "PostProcessing", "AllowNegativeRates", true, NUNBERSAkt)
} }
var sel = document.getElementById("Numbers_value1"); var sel = document.getElementById("Numbers_value1");
@@ -1785,6 +1786,7 @@ function UpdateInputIndividual()
WriteParameter(param, category, "PostProcessing", "MaxRateType", true, NUNBERSAkt); WriteParameter(param, category, "PostProcessing", "MaxRateType", true, NUNBERSAkt);
WriteParameter(param, category, "PostProcessing", "ExtendedResolution", true, NUNBERSAkt); WriteParameter(param, category, "PostProcessing", "ExtendedResolution", true, NUNBERSAkt);
WriteParameter(param, category, "PostProcessing", "IgnoreLeadingNaN", true, NUNBERSAkt); WriteParameter(param, category, "PostProcessing", "IgnoreLeadingNaN", true, NUNBERSAkt);
WriteParameter(param, category, "PostProcessing", "AllowNegativeRates", true, NUNBERSAkt);
} }
function UpdateInput() { function UpdateInput() {
@@ -1820,7 +1822,7 @@ function UpdateInput() {
WriteParameter(param, category, "PostProcessing", "PreValueUse", true); WriteParameter(param, category, "PostProcessing", "PreValueUse", true);
WriteParameter(param, category, "PostProcessing", "PreValueAgeStartup", 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", "ErrorMessage", true);
WriteParameter(param, category, "PostProcessing", "CheckDigitIncreaseConsistency", true); WriteParameter(param, category, "PostProcessing", "CheckDigitIncreaseConsistency", true);
@@ -1943,7 +1945,7 @@ function ReadParameterAll()
ReadParameter(param, "PostProcessing", "PreValueUse", true); ReadParameter(param, "PostProcessing", "PreValueUse", true);
ReadParameter(param, "PostProcessing", "PreValueAgeStartup", true); ReadParameter(param, "PostProcessing", "PreValueAgeStartup", true);
ReadParameter(param, "PostProcessing", "AllowNegativeRates", true); // ReadParameter(param, "PostProcessing", "AllowNegativeRates", true);
ReadParameter(param, "PostProcessing", "ErrorMessage", true); ReadParameter(param, "PostProcessing", "ErrorMessage", true);
ReadParameter(param, "PostProcessing", "CheckDigitIncreaseConsistency", true); ReadParameter(param, "PostProcessing", "CheckDigitIncreaseConsistency", true);

View File

@@ -162,7 +162,7 @@ function ParseConfig() {
ParamAddValue(param, catname, "AnalogDigitalTransitionStart", 1, true); ParamAddValue(param, catname, "AnalogDigitalTransitionStart", 1, true);
ParamAddValue(param, catname, "PreValueUse"); ParamAddValue(param, catname, "PreValueUse");
ParamAddValue(param, catname, "PreValueAgeStartup"); ParamAddValue(param, catname, "PreValueAgeStartup");
ParamAddValue(param, catname, "AllowNegativeRates"); ParamAddValue(param, catname, "AllowNegativeRates", 1, true);
ParamAddValue(param, catname, "MaxRateValue", 1, true); ParamAddValue(param, catname, "MaxRateValue", 1, true);
ParamAddValue(param, catname, "MaxRateType", 1, true); ParamAddValue(param, catname, "MaxRateType", 1, true);
ParamAddValue(param, catname, "ExtendedResolution", 1, true); ParamAddValue(param, catname, "ExtendedResolution", 1, true);