Skip to content

Commit 7bb9f4a

Browse files
committed
Show logging less often
1 parent 5443618 commit 7bb9f4a

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

src/components/digitalIO/Wippersnapper_DigitalGPIO.cpp

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,23 @@ void Wippersnapper_DigitalGPIO::deinitDigitalPin(
190190
/********************************************************************/
191191
int Wippersnapper_DigitalGPIO::digitalReadSvc(int pinName) {
192192
// Service using arduino `digitalRead`
193-
WS_DEBUG_PRINT("\tDioPinRead: ");
194-
WS_DEBUG_PRINT(pinName);
195193
int pinVal = digitalRead(pinName);
196-
WS_DEBUG_PRINT("=");
197-
WS_DEBUG_PRINT(pinVal);
194+
//how do i check the digital IO pull up state for one of the _digital_input_pins, because I'm experiencing issues that resemble the situation where the initially set pull up value is no longer in effect
195+
// For ESP32
196+
// #if defined(ESP32)
197+
// #include "driver/gpio.h"
198+
// #include "esp_err.h"
199+
// #include "esp_log.h"
200+
// #include "esp_system.h"
201+
// #include "esp32-hal-log.h"
202+
// #include "esp32-hal-gpio.h"
203+
// gpio_pull_mode_t pull_mode;
204+
// // can't find in idf, but merged issue https://github.com/espressif/esp-idf/issues/12176
205+
// esp_err_t result = gpio_get_pull_mode((gpio_num_t)pinName, &pull_mode);
206+
// if (result == ESP_OK) {
207+
// return (pull_mode == GPIO_PULLUP_ONLY);
208+
// }
209+
// #endif
198210
return pinVal;
199211
}
200212

@@ -288,6 +300,12 @@ void Wippersnapper_DigitalGPIO::processDigitalInputs() {
288300
} else if (_digital_input_pins[i].period == 0L) {
289301
// read pin
290302
int pinVal = digitalReadSvc(_digital_input_pins[i].pinName);
303+
if (_digital_input_pins[i].prvPeriod - curTime > 500) {
304+
WS_DEBUG_PRINT("D");
305+
WS_DEBUG_PRINT(_digital_input_pins[i].pinName);
306+
WS_DEBUG_PRINT(" is ");
307+
WS_DEBUG_PRINT(pinVal);
308+
}
291309
// only send on-change, but we don't know initial state of feed (prvPinVal at boot)
292310
if (_digital_input_pins[i].prvPeriod <= 0 || pinVal != _digital_input_pins[i].prvPinVal) {
293311
WS_DEBUG_PRINT("Executing state-based event on D");
@@ -328,10 +346,10 @@ void Wippersnapper_DigitalGPIO::processDigitalInputs() {
328346

329347
// reset the digital pin
330348
_digital_input_pins[i].prvPeriod = curTime;
331-
} else {
332-
WS_DEBUG_PRINT("Dio: No change on ");
333-
WS_DEBUG_PRINT(_digital_input_pins[i].pinName);
334-
WS_DEBUG_PRINTLN(", skipping...");
349+
// } else {
350+
// WS_DEBUG_PRINT("Dio: No change on ");
351+
// WS_DEBUG_PRINT(_digital_input_pins[i].pinName);
352+
// WS_DEBUG_PRINTLN(", skipping...");
335353
}
336354
}
337355
}

0 commit comments

Comments
 (0)