mirror of
https://github.com/wled/WLED.git
synced 2025-04-25 07:17:18 +00:00
bugfixes
-added minimum threshold, had some crashes when setting threshold to zero before -moved interrupt detach to GPIO deallocation where it belongs -added check for touchbutton before detaching interrupt -moved thochThreshold readout up so it gets updated before passing it to the system call
This commit is contained in:
parent
0453a5fb3d
commit
0637c1c9d4
@ -235,9 +235,6 @@ 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,7 +257,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
||||
#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 if ((buttonType[s] == BTN_TYPE_TOUCH || buttonType[s] == BTN_TYPE_TOUCH_SWITCH))
|
||||
{
|
||||
touchAttachInterrupt(btnPin[s], touchButtonISR, touchThreshold<<4); //threshold on Touch V2 is much higher (1500 is a value given by Espressif example)
|
||||
touchAttachInterrupt(btnPin[s], touchButtonISR, 256 + (touchThreshold << 4)); // threshold on Touch V2 is much higher (1500 is a value given by Espressif example, I measured changes of over 5000)
|
||||
}
|
||||
#endif
|
||||
else
|
||||
|
@ -32,6 +32,11 @@ 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);
|
||||
|
@ -236,6 +236,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
||||
rlyMde = (bool)request->hasArg(F("RM"));
|
||||
|
||||
disablePullUp = (bool)request->hasArg(F("IP"));
|
||||
touchThreshold = request->arg(F("TT")).toInt();
|
||||
for (uint8_t i=0; i<WLED_MAX_BUTTONS; i++) {
|
||||
char bt[4] = "BT"; bt[2] = (i<10?48:55)+i; bt[3] = 0; // button pin (use A,B,C,... if WLED_MAX_BUTTONS>10)
|
||||
char be[4] = "BE"; be[2] = (i<10?48:55)+i; be[3] = 0; // button type (use A,B,C,... if WLED_MAX_BUTTONS>10)
|
||||
@ -264,7 +265,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
||||
#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)
|
||||
touchAttachInterrupt(btnPin[i], touchButtonISR, 256 + (touchThreshold << 4)); // threshold on Touch V2 is much higher (1500 is a value given by Espressif example, I measured changes of over 5000)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -286,7 +287,6 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
||||
buttonType[i] = BTN_TYPE_NONE;
|
||||
}
|
||||
}
|
||||
touchThreshold = request->arg(F("TT")).toInt();
|
||||
|
||||
briS = request->arg(F("CA")).toInt();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user