Check model is off before changing model
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -99,6 +99,8 @@ bool isRssiSensorAvailable(int sensor);
|
||||
|
||||
bool modelHasNotes();
|
||||
|
||||
bool confirmModelChange();
|
||||
|
||||
#if defined(COLORLCD)
|
||||
bool isSwitch2POSWarningStateAvailable(int state);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user