refactor: key handling (#4849)

This commit is contained in:
philmoz
2024-05-27 18:33:53 +10:00
committed by GitHub
parent b8a0038c68
commit e807ccbebf
101 changed files with 380 additions and 578 deletions
+5 -41
View File
@@ -40,27 +40,13 @@ void menuStatisticsView(event_t event)
switch (event) {
case EVT_KEY_FIRST(KEY_UP):
#if defined(KEYS_GPIO_REG_PAGEDN)
case EVT_KEY_BREAK(KEY_PAGEDN):
#elif defined(NAVIGATION_X7)
case EVT_KEY_BREAK(KEY_PAGE):
#endif
chainMenu(menuStatisticsDebug);
break;
case EVT_KEY_FIRST(KEY_DOWN):
#if defined(KEYS_GPIO_REG_PAGEUP)
case EVT_KEY_BREAK(KEY_PAGEUP):
killEvents(event);
chainMenu(menuStatisticsDebug2);
#elif defined(NAVIGATION_X7)
case EVT_KEY_LONG(KEY_PAGE):
killEvents(event);
chainMenu(menuStatisticsDebug2);
#else
chainMenu(menuStatisticsDebug);
#endif
break;
case EVT_KEY_LONG(KEY_ENTER):
@@ -69,7 +55,7 @@ void menuStatisticsView(event_t event)
sessionTimer = 0;
break;
case EVT_KEY_FIRST(KEY_EXIT):
case EVT_KEY_BREAK(KEY_EXIT):
chainMenu(menuMainView);
break;
}
@@ -128,10 +114,9 @@ void menuStatisticsDebug(event_t event)
g_eeGeneral.globalTimer = 0;
sessionTimer = 0;
storageDirty(EE_GENERAL);
killEvents(event);
break;
case EVT_KEY_FIRST(KEY_ENTER):
case EVT_KEY_BREAK(KEY_ENTER):
#if defined(LUA)
maxLuaInterval = 0;
maxLuaDuration = 0;
@@ -140,30 +125,18 @@ void menuStatisticsDebug(event_t event)
break;
case EVT_KEY_FIRST(KEY_UP):
#if defined(KEYS_GPIO_REG_PAGEDN)
case EVT_KEY_BREAK(KEY_PAGEDN):
disableVBatBridge();
chainMenu(menuStatisticsDebug2);
break;
#elif defined(NAVIGATION_X7)
case EVT_KEY_BREAK(KEY_PAGE):
disableVBatBridge();
chainMenu(menuStatisticsDebug2);
break;
#endif
case EVT_KEY_FIRST(KEY_DOWN):
#if defined(KEYS_GPIO_REG_PAGEUP)
case EVT_KEY_BREAK(KEY_PAGEUP):
#elif defined(NAVIGATION_X7)
case EVT_KEY_LONG(KEY_PAGE):
#endif
killEvents(event);
disableVBatBridge();
chainMenu(menuStatisticsView);
break;
case EVT_KEY_FIRST(KEY_EXIT):
case EVT_KEY_BREAK(KEY_EXIT):
disableVBatBridge();
chainMenu(menuMainView);
break;
@@ -221,30 +194,21 @@ void menuStatisticsDebug2(event_t event)
title(STR_MENUDEBUG);
switch(event) {
// case EVT_KEY_FIRST(KEY_ENTER):
// case EVT_KEY_BREAK(KEY_ENTER):
// telemetryErrors = 0;
// break;
case EVT_KEY_FIRST(KEY_UP):
#if defined(KEYS_GPIO_REG_PAGEDN)
case EVT_KEY_BREAK(KEY_PAGEDN):
#elif defined(NAVIGATION_X7)
case EVT_KEY_BREAK(KEY_PAGE):
#endif
chainMenu(menuStatisticsView);
return;
case EVT_KEY_FIRST(KEY_DOWN):
#if defined(KEYS_GPIO_REG_PAGEUP)
case EVT_KEY_BREAK(KEY_PAGEUP):
#elif defined(NAVIGATION_X7)
case EVT_KEY_LONG(KEY_PAGE):
#endif
killEvents(event);
chainMenu(menuStatisticsDebug);
break;
case EVT_KEY_FIRST(KEY_EXIT):
case EVT_KEY_BREAK(KEY_EXIT):
chainMenu(menuMainView);
break;
}