1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-19 06:15:10 +03:00
This commit is contained in:
Bertrand Songis 2019-09-09 14:18:50 +02:00
parent 63a1a5d1a9
commit e8c7229ff2
No known key found for this signature in database
GPG key ID: F189F79290FEC50F
7 changed files with 14 additions and 17 deletions

View file

@ -281,6 +281,7 @@ void onMainViewMenu(const char *result)
POPUP_MENU_ADD_ITEM(STR_RESET_TIMER2); POPUP_MENU_ADD_ITEM(STR_RESET_TIMER2);
POPUP_MENU_ADD_ITEM(STR_RESET_TIMER3); POPUP_MENU_ADD_ITEM(STR_RESET_TIMER3);
POPUP_MENU_ADD_ITEM(STR_RESET_TELEMETRY); POPUP_MENU_ADD_ITEM(STR_RESET_TELEMETRY);
POPUP_MENU_START(onMainViewMenu);
} }
else if (result == STR_RESET_TELEMETRY) { else if (result == STR_RESET_TELEMETRY) {
telemetryReset(); telemetryReset();

View file

@ -342,7 +342,7 @@ void menuMainViewChannelsMonitor(event_t event)
return menuChannelsView(event); return menuChannelsView(event);
} }
void onMainViewMenu(const char *result) void onMainViewMenu(const char * result)
{ {
if (result == STR_RESET_TIMER1) { if (result == STR_RESET_TIMER1) {
timerReset(0); timerReset(0);
@ -364,6 +364,7 @@ void onMainViewMenu(const char *result)
POPUP_MENU_ADD_ITEM(STR_RESET_TIMER2); POPUP_MENU_ADD_ITEM(STR_RESET_TIMER2);
POPUP_MENU_ADD_ITEM(STR_RESET_TIMER3); POPUP_MENU_ADD_ITEM(STR_RESET_TIMER3);
POPUP_MENU_ADD_ITEM(STR_RESET_TELEMETRY); POPUP_MENU_ADD_ITEM(STR_RESET_TELEMETRY);
POPUP_MENU_START(onMainViewMenu);
} }
else if (result == STR_RESET_TELEMETRY) { else if (result == STR_RESET_TELEMETRY) {
telemetryReset(); 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 getSwitchCount()
{ {
int count = 0; int count = 0;
@ -435,7 +426,6 @@ void menuMainView(event_t event)
static bool secondPage = false; static bool secondPage = false;
switch(event) { switch(event) {
case EVT_ENTRY: case EVT_ENTRY:
killEvents(KEY_EXIT); killEvents(KEY_EXIT);
killEvents(KEY_UP); killEvents(KEY_UP);

View file

@ -557,6 +557,9 @@ inline void POPUP_MENU_START(PopupMenuHandler handler)
inline void CLEAR_POPUP() inline void CLEAR_POPUP()
{ {
warningText = nullptr; warningText = nullptr;
warningInfoText = nullptr;
popupMenuHandler = nullptr;
popupMenuItemsCount = 0;
} }
inline void POPUP_WAIT(const char * s) inline void POPUP_WAIT(const char * s)

View file

@ -114,6 +114,7 @@ void onMainViewMenu(const char *result)
POPUP_MENU_ADD_ITEM(STR_RESET_TIMER2); POPUP_MENU_ADD_ITEM(STR_RESET_TIMER2);
POPUP_MENU_ADD_ITEM(STR_RESET_TIMER3); POPUP_MENU_ADD_ITEM(STR_RESET_TIMER3);
POPUP_MENU_ADD_ITEM(STR_RESET_TELEMETRY); POPUP_MENU_ADD_ITEM(STR_RESET_TELEMETRY);
POPUP_MENU_START(onMainViewMenu);
} }
else if (result == STR_RESET_TELEMETRY) { else if (result == STR_RESET_TELEMETRY) {
telemetryReset(); telemetryReset();

View file

@ -79,6 +79,9 @@ enum
inline void CLEAR_POPUP() inline void CLEAR_POPUP()
{ {
warningText = nullptr; warningText = nullptr;
warningInfoText = nullptr;
popupMenuHandler = nullptr;
popupMenuItemsCount = 0;
} }
inline void POPUP_WAIT(const char * s) inline void POPUP_WAIT(const char * s)

View file

@ -291,7 +291,7 @@ void guiMain(event_t evt)
if (!refreshNeeded) { if (!refreshNeeded) {
DEBUG_TIMER_START(debugTimerMenus); DEBUG_TIMER_START(debugTimerMenus);
while (1) { while (true) {
// normal GUI from menus // normal GUI from menus
const char * warn = warningText; const char * warn = warningText;
uint8_t menu = popupMenuItemsCount; uint8_t menu = popupMenuItemsCount;
@ -315,7 +315,7 @@ void guiMain(event_t evt)
if (result) { if (result) {
TRACE("popupMenuHandler(%s)", result); TRACE("popupMenuHandler(%s)", result);
auto handler = popupMenuHandler; auto handler = popupMenuHandler;
popupMenuHandler = nullptr; CLEAR_POPUP();
handler(result); handler(result);
if (menuEvent == 0) { if (menuEvent == 0) {
evt = EVT_REFRESH; evt = EVT_REFRESH;
@ -391,7 +391,6 @@ void handleGui(event_t event) {
} }
} }
menuHandlers[menuLevel](event); menuHandlers[menuLevel](event);
// todo drawStatusLine(); here???
} }
else else
#endif #endif
@ -456,7 +455,7 @@ void guiMain(event_t evt)
if (result) { if (result) {
TRACE("popupMenuHandler(%s)", result); TRACE("popupMenuHandler(%s)", result);
auto handler = popupMenuHandler; auto handler = popupMenuHandler;
popupMenuHandler = nullptr; CLEAR_POPUP();
handler(result); handler(result);
} }
} }

View file

@ -232,7 +232,7 @@ TASK_FUNCTION(menusTask)
opentxInit(); opentxInit();
#if defined(PWR_BUTTON_PRESS) #if defined(PWR_BUTTON_PRESS)
while (1) { while (true) {
uint32_t pwr_check = pwrCheck(); uint32_t pwr_check = pwrCheck();
if (pwr_check == e_power_off) { if (pwr_check == e_power_off) {
break; break;