diff --git a/radio/src/gui/128x64/model_select.cpp b/radio/src/gui/128x64/model_select.cpp index d0184e5ea..bbd21b221 100644 --- a/radio/src/gui/128x64/model_select.cpp +++ b/radio/src/gui/128x64/model_select.cpp @@ -36,6 +36,10 @@ void onModelSelectMenu(const char * result) int8_t sub = menuVerticalPosition; if (result == STR_SELECT_MODEL || result == STR_CREATE_MODEL) { + if (!g_eeGeneral.disableRssiPoweroffAlarm) { + if (!confirmModelChange()) + return; + } selectModel(sub); } else if (result == STR_COPY_MODEL) { diff --git a/radio/src/gui/212x64/model_select.cpp b/radio/src/gui/212x64/model_select.cpp index 8b396e1b4..d4223a3c1 100644 --- a/radio/src/gui/212x64/model_select.cpp +++ b/radio/src/gui/212x64/model_select.cpp @@ -28,6 +28,10 @@ void onModelSelectMenu(const char * result) int8_t sub = menuVerticalPosition; if (result == STR_SELECT_MODEL || result == STR_CREATE_MODEL) { + if (!g_eeGeneral.disableRssiPoweroffAlarm) { + if (!confirmModelChange()) + return; + } selectModel(sub); } else if (result == STR_COPY_MODEL) { diff --git a/radio/src/gui/480x272/model_select.cpp b/radio/src/gui/480x272/model_select.cpp index 36dac8ba8..661edd814 100644 --- a/radio/src/gui/480x272/model_select.cpp +++ b/radio/src/gui/480x272/model_select.cpp @@ -242,6 +242,10 @@ void onDeleteModelConfirm(const char * result) void onModelSelectMenu(const char * result) { if (result == STR_SELECT_MODEL) { + if (!g_eeGeneral.disableRssiPoweroffAlarm) { + if (!confirmModelChange()) + return; + } // we store the latest changes if any storageFlushCurrentModel(); storageCheck(true); @@ -259,6 +263,10 @@ void onModelSelectMenu(const char * result) deleteMode = MODE_DELETE_MODEL; } else if (result == STR_CREATE_MODEL) { + if (!g_eeGeneral.disableRssiPoweroffAlarm) { + if (!confirmModelChange()) + return; + } storageCheck(true); modelslist.addModel(currentCategory, createModel()); selectMode = MODE_SELECT_MODEL; diff --git a/radio/src/gui/gui_common.cpp b/radio/src/gui/gui_common.cpp index b491d84b4..3b9bb3421 100644 --- a/radio/src/gui/gui_common.cpp +++ b/radio/src/gui/gui_common.cpp @@ -805,6 +805,25 @@ bool modelHasNotes() return false; } +bool confirmModelChange() +{ + if (TELEMETRY_STREAMING()) { + RAISE_ALERT(STR_MODEL, STR_MODEL_STILL_POWERED, STR_PRESS_ENTER_TO_CONFIRM, AU_MODEL_STILL_POWERED); + while (TELEMETRY_STREAMING()) { + RTOS_WAIT_MS(20); + if (readKeys() == (1 << KEY_ENTER)) { + killEvents(KEY_ENTER); + return true; + } + else if (readKeys() == (1 << KEY_EXIT)) { + killEvents(KEY_EXIT); + return false; + } + } + } + return true; +} + int getFirstAvailable(int min, int max, IsValueAvailable isValueAvailable) { int retval = 0; diff --git a/radio/src/gui/gui_common.h b/radio/src/gui/gui_common.h index d1fdb8fa1..f5d7e1f51 100644 --- a/radio/src/gui/gui_common.h +++ b/radio/src/gui/gui_common.h @@ -99,6 +99,8 @@ bool isRssiSensorAvailable(int sensor); bool modelHasNotes(); +bool confirmModelChange(); + #if defined(COLORLCD) bool isSwitch2POSWarningStateAvailable(int state); #endif