From 0453a5fb3ded8851011cbe65db747b2118555f43 Mon Sep 17 00:00:00 2001 From: Damian Schneider Date: Sun, 10 Mar 2024 16:54:25 +0100 Subject: [PATCH] added interrupt detach to cfg.cpp --- wled00/cfg.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index 905566bf2..e59a342c5 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -235,6 +235,9 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { if (!hw_btn_ins.isNull()) { for (uint8_t b = 0; b < WLED_MAX_BUTTONS; b++) { // deallocate existing button pins pinManager.deallocatePin(btnPin[b], PinOwner::Button); // does nothing if trying to deallocate a pin with PinOwner != Button + #ifdef SOC_TOUCH_VERSION_2 // ESP32 S2 and S3 have a fucntion to check touch state, detach any previous assignments + touchDetachInterrupt(btnPin[b]); + #endif } uint8_t s = 0; for (JsonObject btn : hw_btn_ins) { @@ -260,9 +263,8 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { touchAttachInterrupt(btnPin[s], touchButtonISR, touchThreshold<<4); //threshold on Touch V2 is much higher (1500 is a value given by Espressif example) } #endif - else - #endif + #endif { if (disablePullUp) { pinMode(btnPin[s], INPUT);