mirror of
https://github.com/wled/WLED.git
synced 2025-07-13 13:56:35 +00:00
set buttonBriDirection as local static
This commit is contained in:
parent
6276c2f1f5
commit
bdd4d9f3ff
@ -13,6 +13,7 @@
|
|||||||
#define WLED_LONG_BRI_STEPS 16 // how long to wait before increasing/decreasing brightness on long press
|
#define WLED_LONG_BRI_STEPS 16 // how long to wait before increasing/decreasing brightness on long press
|
||||||
|
|
||||||
static const char _mqtt_topic_button[] PROGMEM = "%s/button/%d"; // optimize flash usage
|
static const char _mqtt_topic_button[] PROGMEM = "%s/button/%d"; // optimize flash usage
|
||||||
|
static bool buttonBriDirection = false; // true: increase brightness, false: decrease brightness
|
||||||
|
|
||||||
void shortPressAction(uint8_t b)
|
void shortPressAction(uint8_t b)
|
||||||
{
|
{
|
||||||
@ -41,7 +42,6 @@ void longPressAction(uint8_t b)
|
|||||||
switch (b) {
|
switch (b) {
|
||||||
case 0: setRandomColor(col); colorUpdated(CALL_MODE_BUTTON); break;
|
case 0: setRandomColor(col); colorUpdated(CALL_MODE_BUTTON); break;
|
||||||
case 1:
|
case 1:
|
||||||
// increase bri on true, decrease on false
|
|
||||||
if(buttonBriDirection) {
|
if(buttonBriDirection) {
|
||||||
if (bri == 255) break; // avoid unnecessary updates to brightness
|
if (bri == 255) break; // avoid unnecessary updates to brightness
|
||||||
if (bri >= 255 - WLED_LONG_BRI_STEPS) bri = 255;
|
if (bri >= 255 - WLED_LONG_BRI_STEPS) bri = 255;
|
||||||
|
@ -594,7 +594,6 @@ WLED_GLOBAL bool buttonPressedBefore[WLED_MAX_BUTTONS] _INIT({false});
|
|||||||
WLED_GLOBAL bool buttonLongPressed[WLED_MAX_BUTTONS] _INIT({false});
|
WLED_GLOBAL bool buttonLongPressed[WLED_MAX_BUTTONS] _INIT({false});
|
||||||
WLED_GLOBAL unsigned long buttonPressedTime[WLED_MAX_BUTTONS] _INIT({0});
|
WLED_GLOBAL unsigned long buttonPressedTime[WLED_MAX_BUTTONS] _INIT({0});
|
||||||
WLED_GLOBAL unsigned long buttonWaitTime[WLED_MAX_BUTTONS] _INIT({0});
|
WLED_GLOBAL unsigned long buttonWaitTime[WLED_MAX_BUTTONS] _INIT({0});
|
||||||
WLED_GLOBAL bool buttonBriDirection _INIT(false);
|
|
||||||
WLED_GLOBAL bool disablePullUp _INIT(false);
|
WLED_GLOBAL bool disablePullUp _INIT(false);
|
||||||
WLED_GLOBAL byte touchThreshold _INIT(TOUCH_THRESHOLD);
|
WLED_GLOBAL byte touchThreshold _INIT(TOUCH_THRESHOLD);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user