Allow trigger gpio and input gpio to be the same pin.

This will provide the expected funtionality for the reset trigger when the button is pressed for more than 10 seconds.
Also allows the same pin to be used as an actuator/relay trigger if pressed for less than 10 seconds.
This commit is contained in:
h2zero authored and Florian committed 2021-07-09 21:52:40 -05:00
1 parent 45a0184320
commit 5e11690b69
3 files changed
+23 -4

No files matched your search

+4
View File
@@ -969,6 +969,9 @@ void saveConfigCallback() {
# ifdef TRIGGER_GPIO
void checkButton() { // code from tzapu/wifimanager examples
# if defined(INPUT_GPIO) && defined(ZsensorGPIOInput) && INPUT_GPIO == TRIGGER_GPIO
MeasureGPIOInput();
# else
// check for button press
if (digitalRead(TRIGGER_GPIO) == LOW) {
// poor mans debounce/press-hold, code not ideal for production
@@ -984,6 +987,7 @@ void checkButton() { // code from tzapu/wifimanager examples
}
}
}
# endif
}
# else
void checkButton() {}