Skip to content

Commit

Permalink
removed detachinterrupt from pin manager, added it to set.cpp instead
Browse files Browse the repository at this point in the history
  • Loading branch information
DedeHai committed Apr 7, 2024
1 parent 0637c1c commit d3a97f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 0 additions & 5 deletions wled00/pin_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ bool PinManagerClass::deallocatePin(byte gpio, PinOwner tag)
return false;
}

#ifdef SOC_TOUCH_VERSION_2 // ESP32 S2 and S3 have a fucntion to check touch state, detach any previous assignments
if (digitalPinToTouchChannel(gpio) >= 0) //if touch capable pin
touchDetachInterrupt(gpio);
#endif

byte by = gpio >> 3;
byte bi = gpio - 8*by;
bitWrite(pinAlloc[by], bi, false);
Expand Down
6 changes: 5 additions & 1 deletion wled00/set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
for (uint8_t s=0; s<WLED_MAX_BUTTONS; s++) {
if (btnPin[s]>=0 && pinManager.isPinAllocated(btnPin[s], PinOwner::Button)) {
pinManager.deallocatePin(btnPin[s], PinOwner::Button);
#ifdef SOC_TOUCH_VERSION_2 // ESP32 S2 and S3 have a function to check touch state, detach interrupt
if (digitalPinToTouchChannel(btnPin[i]) >= 0) // if touch capable pin
touchDetachInterrupt(btnPin[i]); // if not assigned previously, this will do nothing
#endif
}
}

Expand Down Expand Up @@ -270,7 +274,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
#endif
}
else
#endif
#endif
{
if (disablePullUp) {
pinMode(btnPin[i], INPUT);
Expand Down

0 comments on commit d3a97f1

Please sign in to comment.