mirror of
https://github.com/wled/WLED.git
synced 2025-07-19 08:46:34 +00:00
Add button type: Touch (switch) #3537
This commit is contained in:
parent
b5a8f3156c
commit
6a793536dd
@ -97,6 +97,7 @@ bool isButtonPressed(uint8_t i)
|
|||||||
if (digitalRead(pin) == HIGH) return true;
|
if (digitalRead(pin) == HIGH) return true;
|
||||||
break;
|
break;
|
||||||
case BTN_TYPE_TOUCH:
|
case BTN_TYPE_TOUCH:
|
||||||
|
case BTN_TYPE_TOUCH_SWITCH:
|
||||||
#if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C3)
|
#if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||||
if (touchRead(pin) <= touchThreshold) return true;
|
if (touchRead(pin) <= touchThreshold) return true;
|
||||||
#endif
|
#endif
|
||||||
@ -252,7 +253,7 @@ void handleButton()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// button is not momentary, but switch. This is only suitable on pins whose on-boot state does not matter (NOT gpio0)
|
// button is not momentary, but switch. This is only suitable on pins whose on-boot state does not matter (NOT gpio0)
|
||||||
if (buttonType[b] == BTN_TYPE_SWITCH || buttonType[b] == BTN_TYPE_PIR_SENSOR) {
|
if (buttonType[b] == BTN_TYPE_SWITCH || buttonType[b] == BTN_TYPE_TOUCH_SWITCH || buttonType[b] == BTN_TYPE_PIR_SENSOR) {
|
||||||
handleSwitch(b);
|
handleSwitch(b);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -285,6 +285,7 @@
|
|||||||
#define BTN_TYPE_TOUCH 6
|
#define BTN_TYPE_TOUCH 6
|
||||||
#define BTN_TYPE_ANALOG 7
|
#define BTN_TYPE_ANALOG 7
|
||||||
#define BTN_TYPE_ANALOG_INVERTED 8
|
#define BTN_TYPE_ANALOG_INVERTED 8
|
||||||
|
#define BTN_TYPE_TOUCH_SWITCH 9
|
||||||
|
|
||||||
//Ethernet board types
|
//Ethernet board types
|
||||||
#define WLED_NUM_ETH_TYPES 11
|
#define WLED_NUM_ETH_TYPES 11
|
||||||
|
@ -512,6 +512,7 @@ Length: <input type="number" name="XC${i}" id="xc${i}" class="l" min="1" max="65
|
|||||||
c += `<option value="6" ${t==6?"selected":""}>Touch</option>`;
|
c += `<option value="6" ${t==6?"selected":""}>Touch</option>`;
|
||||||
c += `<option value="7" ${t==7?"selected":""}>Analog</option>`;
|
c += `<option value="7" ${t==7?"selected":""}>Analog</option>`;
|
||||||
c += `<option value="8" ${t==8?"selected":""}>Analog inverted</option>`;
|
c += `<option value="8" ${t==8?"selected":""}>Analog inverted</option>`;
|
||||||
|
c += `<option value="9" ${t==9?"selected":""}>Touch (switch)</option>`;
|
||||||
c += `</select>`;
|
c += `</select>`;
|
||||||
c += `<span style="cursor: pointer;" onclick="off('${bt}')"> ✕</span><br>`;
|
c += `<span style="cursor: pointer;" onclick="off('${bt}')"> ✕</span><br>`;
|
||||||
gId("btns").innerHTML = c;
|
gId("btns").innerHTML = c;
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user