[ghost] Fix RTN behavior on Ghost config menus (#1261)

* Fix menu back behavior in the Ghost menu

When backing out of a ghost sub-menu one level, don't close the module menu unless already in the root menu.

* Fix formatting
This commit is contained in:
Tony Cake
2021-12-17 10:38:19 +11:00
committed by GitHub
parent 843d1be868
commit f8357be887
2 changed files with 17 additions and 2 deletions
@@ -134,10 +134,24 @@ void RadioGhostModuleConfig::onEvent(event_t event)
reusableBuffer.ghostMenu.menuAction = GHST_MENU_CTRL_CLOSE;
moduleState[EXTERNAL_MODULE].counter = GHST_MENU_CONTROL;
RTOS_WAIT_MS(10);
deleteLater();
Page::onEvent(event);
break;
}
Page::onEvent(event);
}
void RadioGhostModuleConfig::checkEvents()
{
Page::checkEvents();
if (reusableBuffer.ghostMenu.menuStatus == GHST_MENU_STATUS_UNOPENED) { // Handles situation where module is plugged after tools start
reusableBuffer.ghostMenu.buttonAction = GHST_BTN_NONE;
reusableBuffer.ghostMenu.menuAction = GHST_MENU_CTRL_OPEN;
moduleState[EXTERNAL_MODULE].counter = GHST_MENU_CONTROL;
}
else if (reusableBuffer.ghostMenu.menuStatus == GHST_MENU_STATUS_CLOSING) {
RTOS_WAIT_MS(10);
deleteLater();
}
}
#endif
@@ -30,6 +30,7 @@ class RadioGhostModuleConfig: public Page
#if defined(HARDWARE_KEYS)
void onEvent(event_t event) override;
void checkEvents();
#endif
protected: