From b551eadf8a8ad3d0a127a2719dd17e2f72614002 Mon Sep 17 00:00:00 2001 From: Slider0007 Date: Mon, 12 Feb 2024 00:32:24 +0100 Subject: [PATCH] PointerEvalAnalogToDigitNew-TEST --- .../components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp b/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp index 28ddf19d..202a18f0 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp @@ -217,8 +217,8 @@ int ClassFlowCNNGeneral::PointerEvalAnalogToDigitNew(float number, float numeral bool roundedUp = false; // Within the digital inequalities - if ( (result_after_decimal_point >= (10-Digital_Uncertainty * 10) && ((int)numeral_preceder == eval_predecessors)) // Band around the digit --> Round off, as digit reaches inaccuracy in the frame - || (eval_predecessors <= 4 && result_after_decimal_point>=6) ) { // or digit runs after (analogue =0..4, digit >=6) + if ((result_after_decimal_point >= (10-Digital_Uncertainty * 10) && ((int)numeral_preceder == eval_predecessors)) // Band around the digit --> Round off, as digit reaches inaccuracy in the frame + || (eval_predecessors <= 4 && result_after_decimal_point>=6)) { // or digit runs after (analogue =0..4, digit >=6) result = (int) (round(number) + 10) % 10; roundedUp = true; // before/ after decimal point, because we adjust the number based on the uncertainty. @@ -228,7 +228,8 @@ int ClassFlowCNNGeneral::PointerEvalAnalogToDigitNew(float number, float numeral " number: " + std::to_string(number) + " numeral_preceder: " + std::to_string(numeral_preceder) + " erg before comma: " + std::to_string(result_before_decimal_point) + " erg after comma: " + std::to_string(result_after_decimal_point)); - } else { + } + else { result = (int) ((int) trunc(number) + 10) % 10; LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalAnalogToDigitNew - NO digital Uncertainty - Result = " + std::to_string(result) + " number: " + std::to_string(number) + " numeral_preceder = " + std::to_string(numeral_preceder));