File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -405,22 +405,20 @@ void Wippersnapper_AnalogIO::update() {
405405 // This should allow a more wifi blip tolerant threshold for the both ends of the range.
406406 float CURRENT_HYSTERISIS;
407407 if (pinValRaw < maxDecimalValue / 3 ) {
408- CURRENT_HYSTERISIS = DEFAULT_HYSTERISIS;
408+ CURRENT_HYSTERISIS = maxDecimalValue * DEFAULT_HYSTERISIS;
409409 } else if (pinValRaw < (maxDecimalValue / 3 ) * 2 ) {
410- CURRENT_HYSTERISIS = DEFAULT_HYSTERISIS * 2 ;
410+ CURRENT_HYSTERISIS = maxDecimalValue * DEFAULT_HYSTERISIS * 2 ;
411411 } else {
412- CURRENT_HYSTERISIS = DEFAULT_HYSTERISIS * 4 ;
412+ CURRENT_HYSTERISIS = maxDecimalValue * DEFAULT_HYSTERISIS * 4 ;
413413 }
414414
415415
416416
417417 // get the threshold values for previous pin value
418418 uint16_t _pinValThreshHi =
419- _analog_input_pins[i].prvPinVal +
420- (_analog_input_pins[i].prvPinVal * CURRENT_HYSTERISIS);
419+ _analog_input_pins[i].prvPinVal + CURRENT_HYSTERISIS);
421420 uint16_t _pinValThreshLow =
422- _analog_input_pins[i].prvPinVal -
423- (_analog_input_pins[i].prvPinVal * CURRENT_HYSTERISIS);
421+ _analog_input_pins[i].prvPinVal - CURRENT_HYSTERISIS);
424422
425423 if (_analog_input_pins[i].prvPeriod == 0 || pinValRaw > _pinValThreshHi || pinValRaw < _pinValThreshLow) {
426424 // Perform voltage conversion if we need to
You can’t perform that action at this time.
0 commit comments