sforkowany z mirror/meshtastic-firmware
fix long-press handling on alternate button
rodzic
0767c8be03
commit
d4e95e95a6
13
src/main.cpp
13
src/main.cpp
|
@ -179,7 +179,7 @@ class ButtonThread : public OSThread
|
||||||
#ifdef BUTTON_PIN_ALT
|
#ifdef BUTTON_PIN_ALT
|
||||||
userButtonAlt = OneButton(BUTTON_PIN_ALT, true, true);
|
userButtonAlt = OneButton(BUTTON_PIN_ALT, true, true);
|
||||||
userButtonAlt.attachClick(userButtonPressed);
|
userButtonAlt.attachClick(userButtonPressed);
|
||||||
userButton.attachDuringLongPress(userButtonPressedLong);
|
userButtonAlt.attachDuringLongPress(userButtonPressedLong);
|
||||||
wakeOnIrq(BUTTON_PIN_ALT, FALLING);
|
wakeOnIrq(BUTTON_PIN_ALT, FALLING);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -196,9 +196,10 @@ class ButtonThread : public OSThread
|
||||||
#endif
|
#endif
|
||||||
#ifdef BUTTON_PIN_ALT
|
#ifdef BUTTON_PIN_ALT
|
||||||
userButtonAlt.tick();
|
userButtonAlt.tick();
|
||||||
canSleep &= userButton.isIdle();
|
canSleep &= userButtonAlt.isIdle();
|
||||||
#endif
|
#endif
|
||||||
// if(!canSleep) DEBUG_MSG("Supressing sleep!\n");
|
// if (!canSleep) DEBUG_MSG("Supressing sleep!\n");
|
||||||
|
//else DEBUG_MSG("sleep ok\n");
|
||||||
|
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
@ -209,7 +210,11 @@ class ButtonThread : public OSThread
|
||||||
// DEBUG_MSG("press!\n");
|
// DEBUG_MSG("press!\n");
|
||||||
powerFSM.trigger(EVENT_PRESS);
|
powerFSM.trigger(EVENT_PRESS);
|
||||||
}
|
}
|
||||||
static void userButtonPressedLong() { screen->adjustBrightness(); }
|
static void userButtonPressedLong()
|
||||||
|
{
|
||||||
|
DEBUG_MSG("Long press!\n");
|
||||||
|
screen->adjustBrightness();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static Periodic *ledPeriodic;
|
static Periodic *ledPeriodic;
|
||||||
|
|
Ładowanie…
Reference in New Issue