Sfoglia il codice sorgente

Test with AnalogDigitTransition min lowered to 3

Slider0007 2 anni fa
parent
commit
f8dd986e4f

+ 4 - 4
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))     // 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.
@@ -237,10 +237,10 @@ int ClassFlowCNNGeneral::PointerEvalAnalogToDigitNew(float number, float numeral
     // No zero crossing has taken place.
     // Only eval_predecessors used because numeral_preceder could be wrong here.
     // numeral_preceder<=0.1 & eval_predecessors=9 corresponds to analogue was reset because of previous analogue that are not yet at 0.
-    if ((eval_predecessors>=6 && (numeral_preceder>analogDigitalTransitionStart || numeral_preceder<=0.2) && roundedUp))
+    if ((eval_predecessors >= 3 && (numeral_preceder >= analogDigitalTransitionStart) && roundedUp))
     {
         result =  ((result_before_decimal_point+10) - 1) % 10;
-        LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalAnalogToDigitNew - Nulldurchgang noch nicht stattgefunden = " + std::to_string(result) +
+        LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalAnalogToDigitNew - No correction = " + std::to_string(result) +
                                     " number: " + std::to_string(number) + 
                                     " numeral_preceder = " + std::to_string(numeral_preceder) + 
                                     " eerg after comma = " +  std::to_string(result_after_decimal_point));