mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
* MomentaryButton: added support for analog button (with threshold)
* RAK: support for PIN_USER_BTN_ANA
This commit is contained in:
parent
b8223e9d07
commit
74722c24b8
5 changed files with 39 additions and 3 deletions
|
|
@ -354,6 +354,9 @@ void UITask::begin(DisplayDriver* display, SensorManager* sensors, NodePrefs* no
|
|||
#if defined(PIN_USER_BTN)
|
||||
user_btn.begin();
|
||||
#endif
|
||||
#if defined(PIN_USER_BTN_ANA)
|
||||
analog_btn.begin();
|
||||
#endif
|
||||
|
||||
_node_prefs = node_prefs;
|
||||
if (_display != NULL) {
|
||||
|
|
@ -508,6 +511,14 @@ void UITask::loop() {
|
|||
c = handleLongPress(KEY_RIGHT);
|
||||
}
|
||||
#endif
|
||||
#if defined(PIN_USER_BTN_ANA)
|
||||
ev = analog_btn.check();
|
||||
if (ev == BUTTON_EVENT_CLICK) {
|
||||
c = checkDisplayOn(KEY_SELECT);
|
||||
} else if (ev == BUTTON_EVENT_LONG_PRESS) {
|
||||
c = handleLongPress(KEY_ENTER);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (c != 0 && curr) {
|
||||
curr->handleInput(c);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue