Skip to content

Commit d529afa

Browse files
committed
WIP: update logging
1 parent 50cfba4 commit d529afa

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

src/components/analogIO/Wippersnapper_AnalogIO.cpp

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -378,16 +378,18 @@ void Wippersnapper_AnalogIO::update() {
378378
WS_DEBUG_PRINT(F("Diff: "));
379379
WS_DEBUG_PRINTLN((long)millis() - _analog_input_pins[i].prvPeriod);
380380

381-
if (_analog_input_pins[i].prvPeriod == 0L) {
382-
// last time was a clean event, passed hyteresis or 300ms had elapsed
383-
WS_DEBUG_PRINTLN("prvPeriod is 0, last time was a clean event, "
384-
"passed hyteresis or 500ms had elapsed");
385-
} else {
386-
// We're waiting 300ms before posting, to avoid a flood of events
387-
WS_DEBUG_PRINTLN(
388-
"prvPeriod is not 0, probably waiting 300ms before posting, "
389-
"to avoid a flood of events");
390-
}
381+
// if (_analog_input_pins[i].prvPeriod == 0L) {
382+
// // last time was a clean event, passed hyteresis or 300ms had elapsed
383+
// WS_DEBUG_PRINTLN("prvPeriod is 0, last time was a clean event, "
384+
// "passed hyteresis or 500ms had elapsed");
385+
// } else {
386+
// // We're waiting 300ms before posting, to avoid a flood of events
387+
// WS_DEBUG_PRINTLN(
388+
// "prvPeriod is not 0, probably waiting 300ms before posting, "
389+
// "to avoid a flood of events");
390+
// }
391+
392+
391393
// note: on-change requires ADC DEFAULT_HYSTERISIS to check against prv
392394
// pin value
393395
uint16_t pinValRaw = getPinValue(_analog_input_pins[i].pinName);
@@ -401,14 +403,14 @@ void Wippersnapper_AnalogIO::update() {
401403
WS_DEBUG_PRINT(F("\tCurrentLogValue: "));
402404
WS_DEBUG_PRINT(currentLogValue);
403405
WS_DEBUG_PRINT(F("\tLastLogValue: "));
404-
WS_DEBUG_PRINTLN(lastLogValue);
406+
WS_DEBUG_PRINT(lastLogValue);
405407
bool passed_hysterisys = false;
406408
// Check if the logarithmic change exceeds the threshold
407409
if (abs(currentLogValue - lastLogValue) > DEFAULT_HYSTERISIS) {
408410
passed_hysterisys = true;
409-
WS_DEBUG_PRINTLN(F("ADC passed hysteresis"));
411+
WS_DEBUG_PRINTLN(F("\tADC passed hysteresis"));
410412
} else {
411-
WS_DEBUG_PRINTLN(F("ADC did not pass hysteresis"));
413+
WS_DEBUG_PRINTLN(F("\tADC did not pass hysteresis"));
412414
}
413415

414416
// old technique
@@ -419,15 +421,15 @@ void Wippersnapper_AnalogIO::update() {
419421
_analog_input_pins[i].prvPinVal -
420422
(_analog_input_pins[i].prvPinVal * DEFAULT_HYSTERISIS);
421423
WS_DEBUG_PRINT(F("PinValThreshHi: "));
422-
WS_DEBUG_PRINTLN(_pinValThreshHi);
424+
WS_DEBUG_PRINT(_pinValThreshHi);
423425
WS_DEBUG_PRINT(F("PinValThreshLow: "));
424-
WS_DEBUG_PRINTLN(_pinValThreshLow);
426+
WS_DEBUG_PRINT(_pinValThreshLow);
425427

426428
if (pinValRaw > _pinValThreshHi || pinValRaw < _pinValThreshLow) {
427429
// passed_hysterisys = true;
428-
WS_DEBUG_PRINTLN(F("ADC passed OLD hysteresis"));
430+
WS_DEBUG_PRINTLN(F("\tADC passed OLD hysteresis"));
429431
} else {
430-
WS_DEBUG_PRINTLN(F("ADC did not pass OLD hysteresis"));
432+
WS_DEBUG_PRINTLN(F("\tADC did not pass OLD hysteresis"));
431433
}
432434

433435
if (_analog_input_pins[i].readMode ==

0 commit comments

Comments
 (0)