fix: only set pinMode of Prog button pin when pin is >= 0 and isr function is defined

otherwise it is useless anyway and causes warnings.
This commit is contained in:
Ing-Dom 2024-07-17 22:22:58 +02:00
parent e69f63611a
commit 12fb67cc63

View File

@ -286,10 +286,10 @@ template <class P, class B> class KnxFacade : private SaveRestore
pinMode(ledPin(), OUTPUT); pinMode(ledPin(), OUTPUT);
progLedOff(); progLedOff();
pinMode(buttonPin(), INPUT_PULLUP);
if (_progButtonISRFuncPtr && _buttonPin >= 0) if (_progButtonISRFuncPtr && _buttonPin >= 0)
{ {
pinMode(buttonPin(), INPUT_PULLUP);
// Workaround for https://github.com/arduino/ArduinoCore-samd/issues/587 // Workaround for https://github.com/arduino/ArduinoCore-samd/issues/587
#if (ARDUINO_API_VERSION >= 10200) #if (ARDUINO_API_VERSION >= 10200)
attachInterrupt(_buttonPin, _progButtonISRFuncPtr, (PinStatus)CHANGE); attachInterrupt(_buttonPin, _progButtonISRFuncPtr, (PinStatus)CHANGE);