mirror of
https://github.com/wled/WLED.git
synced 2025-07-19 08:46:34 +00:00
added touch interrupt activation to set.cpp for S2/S3
This commit is contained in:
parent
5c09ee29db
commit
509675fe66
@ -252,15 +252,24 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
||||
btnPin[i] = -1;
|
||||
pinManager.deallocatePin(hw_btn_pin,PinOwner::Button);
|
||||
}
|
||||
else if ((buttonType[i] == BTN_TYPE_TOUCH || buttonType[i] == BTN_TYPE_TOUCH_SWITCH) && digitalPinToTouchChannel(btnPin[i]) < 0)
|
||||
else if ((buttonType[i] == BTN_TYPE_TOUCH || buttonType[i] == BTN_TYPE_TOUCH_SWITCH))
|
||||
{
|
||||
// not a touch pin
|
||||
DEBUG_PRINTF_P(PSTR("PIN ALLOC error: GPIO%d for touch button #%d is not an touch pin!\n"), btnPin[i], i);
|
||||
btnPin[i] = -1;
|
||||
pinManager.deallocatePin(hw_btn_pin,PinOwner::Button);
|
||||
if (digitalPinToTouchChannel(btnPin[i]) < 0)
|
||||
{
|
||||
// not a touch pin
|
||||
DEBUG_PRINTF_P(PSTR("PIN ALLOC error: GPIO%d for touch button #%d is not an touch pin!\n"), btnPin[i], i);
|
||||
btnPin[i] = -1;
|
||||
pinManager.deallocatePin(hw_btn_pin,PinOwner::Button);
|
||||
}
|
||||
#ifdef SOC_TOUCH_VERSION_2 // ESP32 S2 and S3 have a fucntion to check touch state but need to attach an interrupt to do so
|
||||
else
|
||||
{
|
||||
touchAttachInterrupt(btnPin[i], 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[i], INPUT);
|
||||
|
Loading…
x
Reference in New Issue
Block a user