Fixes #6727
This commit is contained in:
@@ -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();
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
+3
-4
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user