chore(bw): simplify navigation code (#5269)
This commit is contained in:
@@ -237,6 +237,7 @@ void editName(coord_t x, coord_t y, char* name, uint8_t size, event_t event,
|
||||
#else
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
#endif
|
||||
killEvents(event);
|
||||
|
||||
#if !defined(NAVIGATION_XLITE)
|
||||
if (v == ' ') {
|
||||
|
||||
@@ -47,6 +47,7 @@ void abortPopMenu()
|
||||
|
||||
void chainMenu(MenuHandlerFunc newMenu)
|
||||
{
|
||||
killAllEvents();
|
||||
menuHandlers[menuLevel] = newMenu;
|
||||
menuEvent = EVT_ENTRY;
|
||||
// TODO ? AUDIO_KEY_PRESS();
|
||||
@@ -55,7 +56,7 @@ void chainMenu(MenuHandlerFunc newMenu)
|
||||
|
||||
void pushMenu(MenuHandlerFunc newMenu)
|
||||
{
|
||||
killEvents(KEY_ENTER); // TODO: Check if needed.
|
||||
killAllEvents();
|
||||
|
||||
if (menuLevel == 0) {
|
||||
if (newMenu == menuRadioSetup)
|
||||
|
||||
@@ -260,6 +260,7 @@ void menuModelExposAll(event_t event)
|
||||
s_copyTgtOfs = 0;
|
||||
break;
|
||||
case EVT_KEY_LONG(KEY_EXIT):
|
||||
killEvents(event);
|
||||
if (s_copyMode && s_copyTgtOfs == 0) {
|
||||
deleteExpo(s_currIdx);
|
||||
event = 0;
|
||||
@@ -296,6 +297,7 @@ void menuModelExposAll(event_t event)
|
||||
}
|
||||
// no break
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
killEvents(event);
|
||||
if (s_copyTgtOfs) {
|
||||
s_copyMode = 0;
|
||||
s_copyTgtOfs = 0;
|
||||
@@ -319,6 +321,7 @@ void menuModelExposAll(event_t event)
|
||||
// TODO: add PLUS / MINUS?
|
||||
// case EVT_KEY_LONG(KEY_LEFT):
|
||||
// case EVT_KEY_LONG(KEY_RIGHT):
|
||||
// killEvents(event);
|
||||
// if (s_copyMode && !s_copyTgtOfs) {
|
||||
// if (reachExposLimit()) break;
|
||||
// s_currCh = chn;
|
||||
|
||||
@@ -176,6 +176,7 @@ void menuModelMixAll(event_t event)
|
||||
s_copyTgtOfs = 0;
|
||||
break;
|
||||
case EVT_KEY_LONG(KEY_EXIT):
|
||||
killEvents(event);
|
||||
if (s_copyMode && s_copyTgtOfs == 0) {
|
||||
deleteMix(s_currIdx);
|
||||
event = 0;
|
||||
@@ -213,6 +214,7 @@ void menuModelMixAll(event_t event)
|
||||
// no break
|
||||
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
killEvents(event);
|
||||
if (s_copyTgtOfs) {
|
||||
s_copyMode = 0;
|
||||
s_copyTgtOfs = 0;
|
||||
@@ -236,6 +238,7 @@ void menuModelMixAll(event_t event)
|
||||
// TODO: add PLUS / MINUS?
|
||||
// case EVT_KEY_LONG(KEY_LEFT):
|
||||
// case EVT_KEY_LONG(KEY_RIGHT):
|
||||
// killEvents(event);
|
||||
// if (s_copyMode && !s_copyTgtOfs) {
|
||||
// if (reachMixesLimit()) break;
|
||||
// s_currCh = chn;
|
||||
|
||||
@@ -103,6 +103,7 @@ void menuModelModuleOptions(event_t event)
|
||||
}
|
||||
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER) && reusableBuffer.hardwareAndSettings.moduleSettings.dirty) {
|
||||
killEvents(event);
|
||||
reusableBuffer.hardwareAndSettings.moduleSettings.dirty = MODULE_SETTINGS_OK;
|
||||
moduleState[g_moduleIdx].writeModuleSettings(&reusableBuffer.hardwareAndSettings.moduleSettings);
|
||||
}
|
||||
|
||||
@@ -127,6 +127,7 @@ void menuModelReceiverOptions(event_t event)
|
||||
}
|
||||
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER) && reusableBuffer.hardwareAndSettings.receiverSettings.dirty) {
|
||||
killEvents(event);
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.dirty = RECEIVER_SETTINGS_OK;
|
||||
moduleState[g_moduleIdx].writeReceiverSettings(&reusableBuffer.hardwareAndSettings.receiverSettings);
|
||||
}
|
||||
|
||||
@@ -182,6 +182,7 @@ void runPopupRegister(event_t event)
|
||||
// no break
|
||||
|
||||
case EVT_KEY_LONG(KEY_EXIT):
|
||||
killEvents(event);
|
||||
s_editMode = 0;
|
||||
// no break;
|
||||
|
||||
|
||||
@@ -53,7 +53,6 @@ void menuModelUSBJoystickOne(event_t event)
|
||||
#if defined(NAVIGATION_XLITE)
|
||||
if (event == EVT_KEY_FIRST(KEY_ENTER) && keysGetState(KEY_SHIFT)) {
|
||||
pushMenu(menuChannelsView);
|
||||
killEvents(event);
|
||||
}
|
||||
#else
|
||||
if (event == EVT_KEY_BREAK(KEY_MODEL) || event == EVT_KEY_BREAK(KEY_MENU)) {
|
||||
|
||||
@@ -344,8 +344,8 @@ void POPUP_MENU_TITLE(const char * s)
|
||||
|
||||
void POPUP_MENU_START(PopupMenuHandler handler)
|
||||
{
|
||||
killAllEvents();
|
||||
if (handler != popupMenuHandler) {
|
||||
killAllEvents();
|
||||
AUDIO_KEY_PRESS();
|
||||
popupMenuHandler = handler;
|
||||
}
|
||||
|
||||
@@ -112,6 +112,7 @@ void menuRadioTrainer(event_t event)
|
||||
if (attr) {
|
||||
s_editMode = 0;
|
||||
if (event==EVT_KEY_LONG(KEY_ENTER)){
|
||||
killEvents(event);
|
||||
memcpy(g_eeGeneral.trainer.calib, trainerInput, sizeof(g_eeGeneral.trainer.calib));
|
||||
storageDirty(EE_GENERAL);
|
||||
AUDIO_WARNING1();
|
||||
|
||||
@@ -62,9 +62,11 @@ void menuViewTelemetry(event_t event)
|
||||
}
|
||||
#endif
|
||||
else if (EVT_KEY_PREVIOUS_VIEW(event)) {
|
||||
killEvents(event);
|
||||
decrTelemetryScreen();
|
||||
}
|
||||
else if (EVT_KEY_NEXT_VIEW(event)) {
|
||||
killEvents(event);
|
||||
incrTelemetryScreen();
|
||||
}
|
||||
else if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
|
||||
Reference in New Issue
Block a user