diff --git a/radio/src/gui/128x64/model_curve_edit.cpp b/radio/src/gui/128x64/model_curve_edit.cpp index 741aca4b1..188f4c868 100644 --- a/radio/src/gui/128x64/model_curve_edit.cpp +++ b/radio/src/gui/128x64/model_curve_edit.cpp @@ -24,7 +24,7 @@ void runPopupCurvePreset(event_t event) { warningResult = false; - drawMessageBox(); + drawMessageBox(warningText); lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+2*FH, STR_POPUPS_ENTER_EXIT); diff --git a/radio/src/gui/128x64/model_flightmodes.cpp b/radio/src/gui/128x64/model_flightmodes.cpp index 9672d8601..a9dd6fa4a 100644 --- a/radio/src/gui/128x64/model_flightmodes.cpp +++ b/radio/src/gui/128x64/model_flightmodes.cpp @@ -39,7 +39,7 @@ enum MenuModelFlightModeItems { IF_ROTARY_ENCODERS(ITEM_MODEL_FLIGHT_MODE_ROTARY_ENCODERS) ITEM_MODEL_FLIGHT_MODE_FADE_IN, ITEM_MODEL_FLIGHT_MODE_FADE_OUT, -#if defined(GVARS) && !defined(PCBSTD) +#if defined(GVARS) ITEM_MODEL_FLIGHT_MODE_GVARS_LABEL, ITEM_MODEL_FLIGHT_MODE_GV1, ITEM_MODEL_FLIGHT_MODE_GV2, @@ -87,7 +87,7 @@ void menuModelFlightModeOne(event_t event) int8_t sub = menuVerticalPosition; int8_t editMode = s_editMode; -#if defined(GVARS) && !defined(PCBSTD) +#if defined(GVARS) if (s_currIdx == 0 && sub>=ITEM_MODEL_FLIGHT_MODE_SWITCH) sub += VERTICAL_SHIFT; for (uint8_t k=0; kfadeOut = EDIT_DELAY(0, y, event, attr, STR_FADEOUT, fm->fadeOut); break; -#if defined(GVARS) && !defined(PCBSTD) +#if defined(GVARS) case ITEM_MODEL_FLIGHT_MODE_GVARS_LABEL: lcdDrawTextAlignedLeft(y, STR_GLOBAL_VARS); break; diff --git a/radio/src/gui/128x64/model_setup.cpp b/radio/src/gui/128x64/model_setup.cpp index af70b54d4..ce205ec30 100644 --- a/radio/src/gui/128x64/model_setup.cpp +++ b/radio/src/gui/128x64/model_setup.cpp @@ -350,7 +350,7 @@ void runPopupRegister(event_t event) case EVT_KEY_BREAK(KEY_EXIT): if (s_editMode <= 0) { - warningText = NULL; + warningText = nullptr; } break; } @@ -359,7 +359,7 @@ void runPopupRegister(event_t event) const uint8_t dialogRows[] = { 0, 0, uint8_t(reusableBuffer.moduleSetup.pxx2.registerStep < REGISTER_RX_NAME_RECEIVED ? READONLY_ROW : 0), uint8_t(reusableBuffer.moduleSetup.pxx2.registerStep < REGISTER_RX_NAME_RECEIVED ? 0 : 1)}; check(event, 0, nullptr, 0, dialogRows, 3, 4 - HEADER_LINE); // TODO add a comment for 3 - HEADER_LINE once understood - drawMessageBox(); + drawMessageBox(warningText); // registration password lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y - 4, STR_REG_ID); diff --git a/radio/src/gui/128x64/popups.cpp b/radio/src/gui/128x64/popups.cpp index 7e773f5f6..d86f076e7 100644 --- a/radio/src/gui/128x64/popups.cpp +++ b/radio/src/gui/128x64/popups.cpp @@ -27,22 +27,14 @@ uint8_t warningType; uint8_t warningResult = 0; uint8_t warningInfoFlags = ZCHAR; -void drawMessageBox() +void drawMessageBox(const char * title) { lcdDrawFilledRect(MENU_X, MENU_Y, MENU_W, 40, SOLID, ERASE); lcdDrawRect(MENU_X, MENU_Y, MENU_W, 40); - lcdDrawSizedText(WARNING_LINE_X, WARNING_LINE_Y, warningText, WARNING_LINE_LEN); + lcdDrawSizedText(WARNING_LINE_X, WARNING_LINE_Y, title, WARNING_LINE_LEN); // could be a place for a warningInfoText } -void showMessageBox(const char * str) -{ - warningText = str; - drawMessageBox(); - warningText = NULL; - lcdRefresh(); -} - const unsigned char ASTERISK_BITMAP[] = { #include "asterisk.lbm" }; diff --git a/radio/src/gui/128x64/popups.h b/radio/src/gui/128x64/popups.h index aa4a0caf9..b3f5f9fd4 100644 --- a/radio/src/gui/128x64/popups.h +++ b/radio/src/gui/128x64/popups.h @@ -30,12 +30,10 @@ #define WARNING_LINE_X 16 #define WARNING_LINE_Y 3*FH -void drawMessageBox(); +void drawMessageBox(const char * title); void showMessageBox(const char * title); void runPopupWarning(event_t event); -#define DRAW_MESSAGE_BOX(title) (warningText = title, drawMessageBox(), warningText = NULL) - extern void (*popupFunc)(event_t event); extern uint8_t warningInfoFlags; diff --git a/radio/src/gui/128x64/view_main.cpp b/radio/src/gui/128x64/view_main.cpp index 79c49be53..6be26d9e9 100644 --- a/radio/src/gui/128x64/view_main.cpp +++ b/radio/src/gui/128x64/view_main.cpp @@ -399,7 +399,7 @@ void menuMainView(event_t event) break; case EVT_KEY_FIRST(KEY_EXIT): -#if defined(GVARS) && !defined(PCBSTD) +#if defined(GVARS) if (gvarDisplayTimer > 0) { gvarDisplayTimer = 0; } @@ -551,11 +551,11 @@ void menuMainView(event_t event) } #endif -#if defined(GVARS) && !defined(PCBSTD) +#if defined(GVARS) if (gvarDisplayTimer > 0) { gvarDisplayTimer--; warningText = STR_GLOBAL_VAR; - drawMessageBox(); + drawMessageBox(warningText); lcdDrawSizedText(16, 5*FH, g_model.gvars[gvarLastChanged].name, LEN_GVAR_NAME, ZCHAR); lcdDrawText(16+6*FW, 5*FH, "[", BOLD); drawGVarValue(lcdLastRightPos, 5*FH, gvarLastChanged, GVAR_VALUE(gvarLastChanged, getGVarFlightMode(mixerCurrentFlightMode, gvarLastChanged)), LEFT|BOLD); diff --git a/radio/src/gui/212x64/popups.cpp b/radio/src/gui/212x64/popups.cpp index 3a85afb4c..f5eafda2d 100644 --- a/radio/src/gui/212x64/popups.cpp +++ b/radio/src/gui/212x64/popups.cpp @@ -35,12 +35,6 @@ void drawMessageBox(const char * title) // could be a place for a warningInfoText } -void showMessageBox(const char * title) -{ - drawMessageBox(title); - lcdRefresh(); -} - const unsigned char ASTERISK_BITMAP[] = { #include "asterisk.lbm" }; diff --git a/radio/src/gui/212x64/popups.h b/radio/src/gui/212x64/popups.h index b3d9aa1ee..8ba73f281 100644 --- a/radio/src/gui/212x64/popups.h +++ b/radio/src/gui/212x64/popups.h @@ -31,7 +31,6 @@ void drawMessageBox(const char * title); void showMessageBox(const char * title); void runPopupWarning(event_t event); -#define DRAW_MESSAGE_BOX(title) drawMessageBox(title) extern void (*popupFunc)(event_t event); extern uint8_t warningInfoFlags; diff --git a/radio/src/gui/common/stdlcd/popups.cpp b/radio/src/gui/common/stdlcd/popups.cpp index 69293745a..cd8d0fc6c 100644 --- a/radio/src/gui/common/stdlcd/popups.cpp +++ b/radio/src/gui/common/stdlcd/popups.cpp @@ -139,7 +139,7 @@ void runPopupWarning(event_t event) { warningResult = false; - drawMessageBox(); + drawMessageBox(warningText); if (warningInfoText) { lcdDrawSizedText(WARNING_LINE_X, WARNING_LINE_Y+FH, warningInfoText, warningInfoLength, WARNING_INFO_FLAGS); @@ -174,6 +174,12 @@ void runPopupWarning(event_t event) } } +void showMessageBox(const char * str) +{ + drawMessageBox(str); + lcdRefresh(); +} + void showAlertBox(const char * title, const char * text, const char * action , uint8_t sound) { drawAlertBox(title, text, action); diff --git a/radio/src/lua/interface.cpp b/radio/src/lua/interface.cpp index 83f5d3f3a..cd035720c 100644 --- a/radio/src/lua/interface.cpp +++ b/radio/src/lua/interface.cpp @@ -733,7 +733,7 @@ void luaLoadPermanentScripts() void displayLuaError(const char * title) { #if !defined(COLORLCD) - DRAW_MESSAGE_BOX(title); + drawMessageBox(title); #endif if (lua_warning_info[0]) { char * split = strstr(lua_warning_info, ": ");