added interrupt detach to cfg.cpp

pull/3798/head
Damian Schneider 2024-03-10 16:54:25 +01:00
rodzic 509675fe66
commit 0453a5fb3d
1 zmienionych plików z 4 dodań i 2 usunięć

Wyświetl plik

@ -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);