From 4c37c21699248e8add1c504dbb4c0dd0b0bf049c Mon Sep 17 00:00:00 2001 From: Dom Date: Mon, 20 Feb 2023 14:21:11 +0100 Subject: [PATCH] make the Prog Button handling in the knx stack deativateable by pin value <0 (#231) --- src/knx_facade.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/knx_facade.h b/src/knx_facade.h index 9d12182..05f67ba 100644 --- a/src/knx_facade.h +++ b/src/knx_facade.h @@ -59,7 +59,7 @@ #define KNX_LED LED_BUILTIN #endif #ifndef KNX_BUTTON - #define KNX_BUTTON 0 + #define KNX_BUTTON -1 #endif typedef const uint8_t* (*RestoreCallback)(const uint8_t* buffer); @@ -185,12 +185,12 @@ template class KnxFacade : private SaveRestore } - uint32_t buttonPin() + int32_t buttonPin() { return _buttonPin; } - void buttonPin(uint32_t value) + void buttonPin(int32_t value) { _buttonPin = value; } @@ -267,7 +267,7 @@ template class KnxFacade : private SaveRestore progLedOff(); pinMode(buttonPin(), INPUT_PULLUP); - if (_progButtonISRFuncPtr) + if (_progButtonISRFuncPtr && _buttonPin >= 0) { // Workaround for https://github.com/arduino/ArduinoCore-samd/issues/587 #if (ARDUINO_API_VERSION >= 10200) @@ -413,7 +413,7 @@ template class KnxFacade : private SaveRestore ProgLedOffCallback _progLedOffCallback = 0; uint32_t _ledPinActiveOn = LOW; uint32_t _ledPin = KNX_LED; - uint32_t _buttonPin = KNX_BUTTON; + int32_t _buttonPin = KNX_BUTTON; SaveCallback _saveCallback = 0; RestoreCallback _restoreCallback = 0; volatile bool _toggleProgMode = false;