This commit is contained in:
Bertrand Songis
2019-09-09 14:18:50 +02:00
parent 63a1a5d1a9
commit e8c7229ff2
7 changed files with 14 additions and 17 deletions
+1
View File
@@ -281,6 +281,7 @@ void onMainViewMenu(const char *result)
POPUP_MENU_ADD_ITEM(STR_RESET_TIMER2);
POPUP_MENU_ADD_ITEM(STR_RESET_TIMER3);
POPUP_MENU_ADD_ITEM(STR_RESET_TELEMETRY);
POPUP_MENU_START(onMainViewMenu);
}
else if (result == STR_RESET_TELEMETRY) {
telemetryReset();
+2 -12
View File
@@ -342,7 +342,7 @@ void menuMainViewChannelsMonitor(event_t event)
return menuChannelsView(event);
}
void onMainViewMenu(const char *result)
void onMainViewMenu(const char * result)
{
if (result == STR_RESET_TIMER1) {
timerReset(0);
@@ -364,6 +364,7 @@ void onMainViewMenu(const char *result)
POPUP_MENU_ADD_ITEM(STR_RESET_TIMER2);
POPUP_MENU_ADD_ITEM(STR_RESET_TIMER3);
POPUP_MENU_ADD_ITEM(STR_RESET_TELEMETRY);
POPUP_MENU_START(onMainViewMenu);
}
else if (result == STR_RESET_TELEMETRY) {
telemetryReset();
@@ -409,16 +410,6 @@ void displaySwitch(coord_t x, coord_t y, int width, unsigned int index)
}
}
bool isMenuAvailable(int index)
{
if (index == 4) {
return modelHasNotes();
}
else {
return true;
}
}
int getSwitchCount()
{
int count = 0;
@@ -435,7 +426,6 @@ void menuMainView(event_t event)
static bool secondPage = false;
switch(event) {
case EVT_ENTRY:
killEvents(KEY_EXIT);
killEvents(KEY_UP);
+3
View File
@@ -557,6 +557,9 @@ inline void POPUP_MENU_START(PopupMenuHandler handler)
inline void CLEAR_POPUP()
{
warningText = nullptr;
warningInfoText = nullptr;
popupMenuHandler = nullptr;
popupMenuItemsCount = 0;
}
inline void POPUP_WAIT(const char * s)
+1
View File
@@ -114,6 +114,7 @@ void onMainViewMenu(const char *result)
POPUP_MENU_ADD_ITEM(STR_RESET_TIMER2);
POPUP_MENU_ADD_ITEM(STR_RESET_TIMER3);
POPUP_MENU_ADD_ITEM(STR_RESET_TELEMETRY);
POPUP_MENU_START(onMainViewMenu);
}
else if (result == STR_RESET_TELEMETRY) {
telemetryReset();
+3
View File
@@ -79,6 +79,9 @@ enum
inline void CLEAR_POPUP()
{
warningText = nullptr;
warningInfoText = nullptr;
popupMenuHandler = nullptr;
popupMenuItemsCount = 0;
}
inline void POPUP_WAIT(const char * s)
+3 -4
View File
@@ -291,7 +291,7 @@ void guiMain(event_t evt)
if (!refreshNeeded) {
DEBUG_TIMER_START(debugTimerMenus);
while (1) {
while (true) {
// normal GUI from menus
const char * warn = warningText;
uint8_t menu = popupMenuItemsCount;
@@ -315,7 +315,7 @@ void guiMain(event_t evt)
if (result) {
TRACE("popupMenuHandler(%s)", result);
auto handler = popupMenuHandler;
popupMenuHandler = nullptr;
CLEAR_POPUP();
handler(result);
if (menuEvent == 0) {
evt = EVT_REFRESH;
@@ -391,7 +391,6 @@ void handleGui(event_t event) {
}
}
menuHandlers[menuLevel](event);
// todo drawStatusLine(); here???
}
else
#endif
@@ -456,7 +455,7 @@ void guiMain(event_t evt)
if (result) {
TRACE("popupMenuHandler(%s)", result);
auto handler = popupMenuHandler;
popupMenuHandler = nullptr;
CLEAR_POPUP();
handler(result);
}
}
+1 -1
View File
@@ -232,7 +232,7 @@ TASK_FUNCTION(menusTask)
opentxInit();
#if defined(PWR_BUTTON_PRESS)
while (1) {
while (true) {
uint32_t pwr_check = pwrCheck();
if (pwr_check == e_power_off) {
break;