chore(bw): remove unused READ_ONLY and READ_ONLY_UNLOCKED macros (#5156)
This commit is contained in:
@@ -79,7 +79,7 @@ void menuModelCustomScriptOne(event_t event)
|
|||||||
lcdDrawSizedText(SCRIPT_ONE_2ND_COLUMN_POS, y, sd.file, sizeof(sd.file), attr);
|
lcdDrawSizedText(SCRIPT_ONE_2ND_COLUMN_POS, y, sd.file, sizeof(sd.file), attr);
|
||||||
else
|
else
|
||||||
lcdDrawTextAtIndex(SCRIPT_ONE_2ND_COLUMN_POS, y, STR_VCSWFUNC, 0, attr);
|
lcdDrawTextAtIndex(SCRIPT_ONE_2ND_COLUMN_POS, y, STR_VCSWFUNC, 0, attr);
|
||||||
if (attr && event==EVT_KEY_BREAK(KEY_ENTER) && !READ_ONLY()) {
|
if (attr && event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||||
s_editMode = 0;
|
s_editMode = 0;
|
||||||
if (sdListFiles(SCRIPTS_MIXES_PATH, SCRIPTS_EXT, sizeof(sd.file), sd.file, LIST_NONE_SD_FILE)) {
|
if (sdListFiles(SCRIPTS_MIXES_PATH, SCRIPTS_EXT, sizeof(sd.file), sd.file, LIST_NONE_SD_FILE)) {
|
||||||
POPUP_MENU_START(onModelCustomScriptMenu);
|
POPUP_MENU_START(onModelCustomScriptMenu);
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ void menuModelDisplay(event_t event)
|
|||||||
else
|
else
|
||||||
lcdDrawTextAtIndex(DISPLAY_COL2+7*FW, y, STR_VCSWFUNC, 0, (menuHorizontalPosition==1 ? attr : 0));
|
lcdDrawTextAtIndex(DISPLAY_COL2+7*FW, y, STR_VCSWFUNC, 0, (menuHorizontalPosition==1 ? attr : 0));
|
||||||
|
|
||||||
if (menuHorizontalPosition==1 && attr && event==EVT_KEY_BREAK(KEY_ENTER) && READ_ONLY_UNLOCKED()) {
|
if (menuHorizontalPosition==1 && attr && event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||||
s_editMode = 0;
|
s_editMode = 0;
|
||||||
if (sdListFiles(SCRIPTS_TELEM_PATH, SCRIPTS_EXT, sizeof(g_model.screens[screenIndex].script.file), g_model.screens[screenIndex].script.file)) {
|
if (sdListFiles(SCRIPTS_TELEM_PATH, SCRIPTS_EXT, sizeof(g_model.screens[screenIndex].script.file), g_model.screens[screenIndex].script.file)) {
|
||||||
POPUP_MENU_START(onTelemetryScriptFileSelectionMenu);
|
POPUP_MENU_START(onTelemetryScriptFileSelectionMenu);
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ void menuModelFailsafe(event_t event)
|
|||||||
if (g_eeGeneral.ppmunit == PPM_PERCENT_PREC1)
|
if (g_eeGeneral.ppmunit == PPM_PERCENT_PREC1)
|
||||||
wbar -= 6;
|
wbar -= 6;
|
||||||
|
|
||||||
if (sub == k && !READ_ONLY() && event == EVT_KEY_LONG(KEY_ENTER)) {
|
if (sub == k && event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||||
POPUP_MENU_START(onFailsafeMenu, 4, STR_NONE, STR_HOLD, STR_CHANNEL2FAILSAFE, STR_CHANNELS2FAILSAFE);
|
POPUP_MENU_START(onFailsafeMenu, 4, STR_NONE, STR_HOLD, STR_CHANNEL2FAILSAFE, STR_CHANNELS2FAILSAFE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ void menuModelLimits(event_t event)
|
|||||||
if (sub == k &&
|
if (sub == k &&
|
||||||
((event == EVT_KEY_BREAK(KEY_ENTER)) ||
|
((event == EVT_KEY_BREAK(KEY_ENTER)) ||
|
||||||
(event == EVT_KEY_LONG(KEY_ENTER))) &&
|
(event == EVT_KEY_LONG(KEY_ENTER))) &&
|
||||||
!READ_ONLY() && (k != MAX_OUTPUT_CHANNELS)) {
|
(k != MAX_OUTPUT_CHANNELS)) {
|
||||||
s_editMode = 0;
|
s_editMode = 0;
|
||||||
POPUP_MENU_START(onLimitsMenu, 5, STR_EDIT, STR_RESET,
|
POPUP_MENU_START(onLimitsMenu, 5, STR_EDIT, STR_RESET,
|
||||||
STR_COPY_TRIMS_TO_OFS, STR_COPY_STICKS_TO_OFS,
|
STR_COPY_TRIMS_TO_OFS, STR_COPY_STICKS_TO_OFS,
|
||||||
|
|||||||
@@ -167,12 +167,7 @@ void menuModelSelect(event_t event)
|
|||||||
case EVT_KEY_LONG(KEY_ENTER):
|
case EVT_KEY_LONG(KEY_ENTER):
|
||||||
case EVT_KEY_BREAK(KEY_ENTER):
|
case EVT_KEY_BREAK(KEY_ENTER):
|
||||||
s_editMode = 0;
|
s_editMode = 0;
|
||||||
if (READ_ONLY()) {
|
if (s_copyMode && (s_copyTgtOfs || s_copySrcRow>=0)) {
|
||||||
if (g_eeGeneral.currModel != sub && modelExists(sub)) {
|
|
||||||
selectModel(sub);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (s_copyMode && (s_copyTgtOfs || s_copySrcRow>=0)) {
|
|
||||||
showMessageBox(s_copyMode==COPY_MODE ? STR_COPYINGMODEL : STR_MOVINGMODEL);
|
showMessageBox(s_copyMode==COPY_MODE ? STR_COPYINGMODEL : STR_MOVINGMODEL);
|
||||||
storageCheck(true); // force writing of current model data before this is changed
|
storageCheck(true); // force writing of current model data before this is changed
|
||||||
|
|
||||||
|
|||||||
@@ -1073,29 +1073,27 @@ void menuModelSetup(event_t event)
|
|||||||
if (attr) {
|
if (attr) {
|
||||||
#endif
|
#endif
|
||||||
s_editMode = 0;
|
s_editMode = 0;
|
||||||
if (!READ_ONLY()) {
|
switch (event) {
|
||||||
switch (event) {
|
case EVT_KEY_BREAK(KEY_ENTER):
|
||||||
case EVT_KEY_BREAK(KEY_ENTER):
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case EVT_KEY_LONG(KEY_ENTER):
|
case EVT_KEY_LONG(KEY_ENTER):
|
||||||
if (menuHorizontalPosition < 0 ||
|
if (menuHorizontalPosition < 0 ||
|
||||||
menuHorizontalPosition >= switchWarningsCount) {
|
menuHorizontalPosition >= switchWarningsCount) {
|
||||||
START_NO_HIGHLIGHT();
|
START_NO_HIGHLIGHT();
|
||||||
getMovedSwitch();
|
getMovedSwitch();
|
||||||
// Mask switches enabled for warnings
|
// Mask switches enabled for warnings
|
||||||
swarnstate_t sw_mask = 0;
|
swarnstate_t sw_mask = 0;
|
||||||
for(uint8_t i = 0; i < switchGetMaxSwitches(); i++) {
|
for(uint8_t i = 0; i < switchGetMaxSwitches(); i++) {
|
||||||
if (SWITCH_WARNING_ALLOWED(i))
|
if (SWITCH_WARNING_ALLOWED(i))
|
||||||
if (g_model.switchWarning & (0x07 << (3 * i)))
|
if (g_model.switchWarning & (0x07 << (3 * i)))
|
||||||
sw_mask |= (0x07 << (3 * i));
|
sw_mask |= (0x07 << (3 * i));
|
||||||
}
|
|
||||||
g_model.switchWarning = switches_states & sw_mask;
|
|
||||||
AUDIO_WARNING1();
|
|
||||||
storageDirty(EE_MODEL);
|
|
||||||
}
|
}
|
||||||
break;
|
g_model.switchWarning = switches_states & sw_mask;
|
||||||
}
|
AUDIO_WARNING1();
|
||||||
|
storageDirty(EE_MODEL);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1103,7 +1101,7 @@ void menuModelSetup(event_t event)
|
|||||||
for (int i = 0; i < switchGetMaxSwitches(); i++) {
|
for (int i = 0; i < switchGetMaxSwitches(); i++) {
|
||||||
if (SWITCH_WARNING_ALLOWED(i)) {
|
if (SWITCH_WARNING_ALLOWED(i)) {
|
||||||
div_t qr = div(current, MAX_SWITCH_PER_LINE);
|
div_t qr = div(current, MAX_SWITCH_PER_LINE);
|
||||||
if (!READ_ONLY() && event == EVT_KEY_BREAK(KEY_ENTER) && attr &&
|
if (event == EVT_KEY_BREAK(KEY_ENTER) && attr &&
|
||||||
l_posHorz == current && old_posHorz >= 0) {
|
l_posHorz == current && old_posHorz >= 0) {
|
||||||
uint8_t curr_state = (states & 0x07);
|
uint8_t curr_state = (states & 0x07);
|
||||||
// remove old setting
|
// remove old setting
|
||||||
@@ -1145,7 +1143,7 @@ void menuModelSetup(event_t event)
|
|||||||
|
|
||||||
if (attr) {
|
if (attr) {
|
||||||
if (menuHorizontalPosition > 0) s_editMode = 0;
|
if (menuHorizontalPosition > 0) s_editMode = 0;
|
||||||
if (!READ_ONLY() && menuHorizontalPosition > 0) {
|
if (menuHorizontalPosition > 0) {
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case EVT_KEY_LONG(KEY_ENTER):
|
case EVT_KEY_LONG(KEY_ENTER):
|
||||||
if (g_model.potsWarnMode == POTS_WARN_MANUAL) {
|
if (g_model.potsWarnMode == POTS_WARN_MANUAL) {
|
||||||
@@ -1203,11 +1201,9 @@ void menuModelSetup(event_t event)
|
|||||||
}
|
}
|
||||||
if (attr) {
|
if (attr) {
|
||||||
if (event == EVT_KEY_BREAK(KEY_ENTER)) {
|
if (event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||||
if (READ_ONLY_UNLOCKED()) {
|
s_editMode = 0;
|
||||||
s_editMode = 0;
|
g_model.beepANACenter ^= ((BeepANACenter)1<<menuHorizontalPosition);
|
||||||
g_model.beepANACenter ^= ((BeepANACenter)1<<menuHorizontalPosition);
|
storageDirty(EE_MODEL);
|
||||||
storageDirty(EE_MODEL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
@@ -2379,7 +2375,7 @@ void menuModelSetup(event_t event)
|
|||||||
|
|
||||||
case ITEM_MODEL_SETUP_USBJOYSTICK_APPLY:
|
case ITEM_MODEL_SETUP_USBJOYSTICK_APPLY:
|
||||||
lcdDrawText(INDENT_WIDTH, y, BUTTON(TR_USBJOYSTICK_APPLY_CHANGES), attr);
|
lcdDrawText(INDENT_WIDTH, y, BUTTON(TR_USBJOYSTICK_APPLY_CHANGES), attr);
|
||||||
if (attr && !READ_ONLY() && event == EVT_KEY_BREAK(KEY_ENTER)) {
|
if (attr && event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||||
onUSBJoystickModelChanged();
|
onUSBJoystickModelChanged();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -156,9 +156,9 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
|||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
#if defined(PCBXLITE)
|
#if defined(PCBXLITE)
|
||||||
// ENT LONG on xlite brings up switch type menu, so this menu is activated with SHIFT + ENT LONG
|
// ENT LONG on xlite brings up switch type menu, so this menu is activated with SHIFT + ENT LONG
|
||||||
if (menuHorizontalPosition==0 && event==EVT_KEY_LONG(KEY_ENTER) && keysGetState(KEY_SHIFT) && !READ_ONLY()) {
|
if (menuHorizontalPosition==0 && event==EVT_KEY_LONG(KEY_ENTER) && keysGetState(KEY_SHIFT)) {
|
||||||
#else
|
#else
|
||||||
if (menuHorizontalPosition<0 && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) {
|
if (menuHorizontalPosition<0 && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||||
#endif
|
#endif
|
||||||
CustomFunctionData *cfn = &functions[sub];
|
CustomFunctionData *cfn = &functions[sub];
|
||||||
if (!CFN_EMPTY(cfn))
|
if (!CFN_EMPTY(cfn))
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ void menuRadioCalibration(event_t event)
|
|||||||
{
|
{
|
||||||
check_submenu_simple(event, 0);
|
check_submenu_simple(event, 0);
|
||||||
title(STR_MENUCALIBRATION);
|
title(STR_MENUCALIBRATION);
|
||||||
menuCommonCalib(READ_ONLY() ? 0 : event);
|
menuCommonCalib(event);
|
||||||
if (menuEvent) {
|
if (menuEvent) {
|
||||||
menuCalibrationState = CALIB_START;
|
menuCalibrationState = CALIB_START;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ void menuModelCustomScriptOne(event_t event)
|
|||||||
lcdDrawSizedText(SCRIPT_ONE_2ND_COLUMN_POS, y, sd.file, sizeof(sd.file), attr);
|
lcdDrawSizedText(SCRIPT_ONE_2ND_COLUMN_POS, y, sd.file, sizeof(sd.file), attr);
|
||||||
else
|
else
|
||||||
lcdDrawTextAtIndex(SCRIPT_ONE_2ND_COLUMN_POS, y, STR_VCSWFUNC, 0, attr);
|
lcdDrawTextAtIndex(SCRIPT_ONE_2ND_COLUMN_POS, y, STR_VCSWFUNC, 0, attr);
|
||||||
if (attr && event==EVT_KEY_BREAK(KEY_ENTER) && !READ_ONLY()) {
|
if (attr && event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||||
s_editMode = 0;
|
s_editMode = 0;
|
||||||
if (sdListFiles(SCRIPTS_MIXES_PATH, SCRIPTS_EXT, sizeof(sd.file), sd.file, LIST_NONE_SD_FILE)) {
|
if (sdListFiles(SCRIPTS_MIXES_PATH, SCRIPTS_EXT, sizeof(sd.file), sd.file, LIST_NONE_SD_FILE)) {
|
||||||
POPUP_MENU_START(onModelCustomScriptMenu);
|
POPUP_MENU_START(onModelCustomScriptMenu);
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ void menuModelDisplay(event_t event)
|
|||||||
else
|
else
|
||||||
lcdDrawTextAtIndex(DISPLAY_COL2+7*FW, y, STR_VCSWFUNC, 0, (menuHorizontalPosition==1 ? attr : 0));
|
lcdDrawTextAtIndex(DISPLAY_COL2+7*FW, y, STR_VCSWFUNC, 0, (menuHorizontalPosition==1 ? attr : 0));
|
||||||
|
|
||||||
if (menuHorizontalPosition==1 && attr && event==EVT_KEY_BREAK(KEY_ENTER) && READ_ONLY_UNLOCKED()) {
|
if (menuHorizontalPosition==1 && attr && event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||||
s_editMode = 0;
|
s_editMode = 0;
|
||||||
if (sdListFiles(SCRIPTS_TELEM_PATH, SCRIPTS_EXT, sizeof(g_model.screens[screenIndex].script.file), g_model.screens[screenIndex].script.file)) {
|
if (sdListFiles(SCRIPTS_TELEM_PATH, SCRIPTS_EXT, sizeof(g_model.screens[screenIndex].script.file), g_model.screens[screenIndex].script.file)) {
|
||||||
POPUP_MENU_START(onTelemetryScriptFileSelectionMenu);
|
POPUP_MENU_START(onTelemetryScriptFileSelectionMenu);
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ void menuModelLogicalSwitches(event_t event)
|
|||||||
horzpos_t horz = menuHorizontalPosition;
|
horzpos_t horz = menuHorizontalPosition;
|
||||||
bool showHeader = true;
|
bool showHeader = true;
|
||||||
|
|
||||||
if (horz<0 && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) {
|
if (horz<0 && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||||
LogicalSwitchData * cs = lswAddress(sub);
|
LogicalSwitchData * cs = lswAddress(sub);
|
||||||
if (cs->func)
|
if (cs->func)
|
||||||
POPUP_MENU_ADD_ITEM(STR_COPY);
|
POPUP_MENU_ADD_ITEM(STR_COPY);
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ void menuModelLimits(event_t event)
|
|||||||
int limit = (g_model.extendedLimits ? LIMIT_EXT_MAX : 1000);
|
int limit = (g_model.extendedLimits ? LIMIT_EXT_MAX : 1000);
|
||||||
|
|
||||||
putsChn(0, y, k+1, (sub==k && menuHorizontalPosition < 0) ? INVERS : 0);
|
putsChn(0, y, k+1, (sub==k && menuHorizontalPosition < 0) ? INVERS : 0);
|
||||||
if (sub==k && menuHorizontalPosition < 0 && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) {
|
if (sub==k && menuHorizontalPosition < 0 && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||||
POPUP_MENU_START(onLimitsMenu, 4, STR_RESET, STR_COPY_TRIMS_TO_OFS, STR_COPY_STICKS_TO_OFS, STR_COPY_MIN_MAX_TO_OUTPUTS);
|
POPUP_MENU_START(onLimitsMenu, 4, STR_RESET, STR_COPY_TRIMS_TO_OFS, STR_COPY_STICKS_TO_OFS, STR_COPY_MIN_MAX_TO_OUTPUTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -163,12 +163,7 @@ void menuModelSelect(event_t event)
|
|||||||
case EVT_KEY_LONG(KEY_ENTER):
|
case EVT_KEY_LONG(KEY_ENTER):
|
||||||
case EVT_KEY_BREAK(KEY_ENTER):
|
case EVT_KEY_BREAK(KEY_ENTER):
|
||||||
s_editMode = 0;
|
s_editMode = 0;
|
||||||
if (READ_ONLY()) {
|
if (s_copyMode && (s_copyTgtOfs || s_copySrcRow>=0)) {
|
||||||
if (g_eeGeneral.currModel != sub && modelExists(sub)) {
|
|
||||||
selectModel(sub);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (s_copyMode && (s_copyTgtOfs || s_copySrcRow>=0)) {
|
|
||||||
showMessageBox(s_copyMode==COPY_MODE ? STR_COPYINGMODEL : STR_MOVINGMODEL);
|
showMessageBox(s_copyMode==COPY_MODE ? STR_COPYINGMODEL : STR_MOVINGMODEL);
|
||||||
storageCheck(true); // force writing of current model data before this is changed
|
storageCheck(true); // force writing of current model data before this is changed
|
||||||
|
|
||||||
|
|||||||
@@ -644,7 +644,7 @@ void menuModelSetup(event_t event)
|
|||||||
lcdDrawSizedText(MODEL_SETUP_2ND_COLUMN, y, g_model.header.bitmap, LEN_BITMAP_NAME, attr);
|
lcdDrawSizedText(MODEL_SETUP_2ND_COLUMN, y, g_model.header.bitmap, LEN_BITMAP_NAME, attr);
|
||||||
else
|
else
|
||||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VCSWFUNC, 0, attr);
|
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VCSWFUNC, 0, attr);
|
||||||
if (attr && event==EVT_KEY_BREAK(KEY_ENTER) && READ_ONLY_UNLOCKED()) {
|
if (attr && event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||||
s_editMode = 0;
|
s_editMode = 0;
|
||||||
if (sdListFiles(BITMAPS_PATH, BITMAPS_EXT, LEN_BITMAP_NAME, g_model.header.bitmap, LIST_NONE_SD_FILE)) {
|
if (sdListFiles(BITMAPS_PATH, BITMAPS_EXT, LEN_BITMAP_NAME, g_model.header.bitmap, LIST_NONE_SD_FILE)) {
|
||||||
POPUP_MENU_START(onModelSetupBitmapMenu);
|
POPUP_MENU_START(onModelSetupBitmapMenu);
|
||||||
@@ -876,28 +876,26 @@ void menuModelSetup(event_t event)
|
|||||||
|
|
||||||
if (attr) {
|
if (attr) {
|
||||||
s_editMode = 0;
|
s_editMode = 0;
|
||||||
if (!READ_ONLY()) {
|
switch (event) {
|
||||||
switch (event) {
|
case EVT_KEY_BREAK(KEY_ENTER):
|
||||||
case EVT_KEY_BREAK(KEY_ENTER):
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case EVT_KEY_LONG(KEY_ENTER):
|
case EVT_KEY_LONG(KEY_ENTER):
|
||||||
if (menuHorizontalPosition < 0) {
|
if (menuHorizontalPosition < 0) {
|
||||||
START_NO_HIGHLIGHT();
|
START_NO_HIGHLIGHT();
|
||||||
getMovedSwitch();
|
getMovedSwitch();
|
||||||
// Mask switches enabled for warnings
|
// Mask switches enabled for warnings
|
||||||
swarnstate_t sw_mask = 0;
|
swarnstate_t sw_mask = 0;
|
||||||
for(uint8_t i = 0; i < switchGetMaxSwitches(); i++) {
|
for(uint8_t i = 0; i < switchGetMaxSwitches(); i++) {
|
||||||
if (SWITCH_WARNING_ALLOWED(i))
|
if (SWITCH_WARNING_ALLOWED(i))
|
||||||
if (g_model.switchWarning & (0x07 << (3 * i)))
|
if (g_model.switchWarning & (0x07 << (3 * i)))
|
||||||
sw_mask |= (0x07 << (3 * i));
|
sw_mask |= (0x07 << (3 * i));
|
||||||
}
|
|
||||||
g_model.switchWarning = switches_states & sw_mask;
|
|
||||||
AUDIO_WARNING1();
|
|
||||||
storageDirty(EE_MODEL);
|
|
||||||
}
|
}
|
||||||
break;
|
g_model.switchWarning = switches_states & sw_mask;
|
||||||
}
|
AUDIO_WARNING1();
|
||||||
|
storageDirty(EE_MODEL);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -907,7 +905,7 @@ void menuModelSetup(event_t event)
|
|||||||
for (int i = 0; i < switchGetMaxSwitches(); i++) {
|
for (int i = 0; i < switchGetMaxSwitches(); i++) {
|
||||||
if (SWITCH_WARNING_ALLOWED(i)) {
|
if (SWITCH_WARNING_ALLOWED(i)) {
|
||||||
div_t qr = div(current, 8);
|
div_t qr = div(current, 8);
|
||||||
if (!READ_ONLY() && event == EVT_KEY_BREAK(KEY_ENTER) && line &&
|
if (event == EVT_KEY_BREAK(KEY_ENTER) && line &&
|
||||||
l_posHorz == current) {
|
l_posHorz == current) {
|
||||||
uint8_t curr_state = (states & 0x07);
|
uint8_t curr_state = (states & 0x07);
|
||||||
// remove old setting
|
// remove old setting
|
||||||
@@ -957,7 +955,7 @@ void menuModelSetup(event_t event)
|
|||||||
|
|
||||||
if (attr) {
|
if (attr) {
|
||||||
if (menuHorizontalPosition > 0) s_editMode = 0;
|
if (menuHorizontalPosition > 0) s_editMode = 0;
|
||||||
if (!READ_ONLY() && menuHorizontalPosition > 0) {
|
if (menuHorizontalPosition > 0) {
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case EVT_KEY_LONG(KEY_ENTER):
|
case EVT_KEY_LONG(KEY_ENTER):
|
||||||
if (g_model.potsWarnMode == POTS_WARN_MANUAL) {
|
if (g_model.potsWarnMode == POTS_WARN_MANUAL) {
|
||||||
@@ -1033,11 +1031,9 @@ void menuModelSetup(event_t event)
|
|||||||
}
|
}
|
||||||
if (attr && CURSOR_ON_CELL) {
|
if (attr && CURSOR_ON_CELL) {
|
||||||
if (event==EVT_KEY_BREAK(KEY_ENTER)) {
|
if (event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||||
if (READ_ONLY_UNLOCKED()) {
|
s_editMode = 0;
|
||||||
s_editMode = 0;
|
g_model.beepANACenter ^= ((BeepANACenter)1<<menuHorizontalPosition);
|
||||||
g_model.beepANACenter ^= ((BeepANACenter)1<<menuHorizontalPosition);
|
storageDirty(EE_MODEL);
|
||||||
storageDirty(EE_MODEL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -2024,7 +2020,7 @@ void menuModelSetup(event_t event)
|
|||||||
|
|
||||||
case ITEM_MODEL_SETUP_USBJOYSTICK_APPLY:
|
case ITEM_MODEL_SETUP_USBJOYSTICK_APPLY:
|
||||||
lcdDrawText(INDENT_WIDTH, y, BUTTON(TR_USBJOYSTICK_APPLY_CHANGES), attr);
|
lcdDrawText(INDENT_WIDTH, y, BUTTON(TR_USBJOYSTICK_APPLY_CHANGES), attr);
|
||||||
if (attr && !READ_ONLY() && event == EVT_KEY_BREAK(KEY_ENTER)) {
|
if (attr && event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||||
onUSBJoystickModelChanged();
|
onUSBJoystickModelChanged();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
|||||||
{
|
{
|
||||||
int sub = menuVerticalPosition;
|
int sub = menuVerticalPosition;
|
||||||
uint8_t eeFlags = (functions == g_model.customFn) ? EE_MODEL : EE_GENERAL;
|
uint8_t eeFlags = (functions == g_model.customFn) ? EE_MODEL : EE_GENERAL;
|
||||||
if (menuHorizontalPosition<0 && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) {
|
if (menuHorizontalPosition<0 && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||||
CustomFunctionData *cfn = &functions[sub];
|
CustomFunctionData *cfn = &functions[sub];
|
||||||
if (!CFN_EMPTY(cfn))
|
if (!CFN_EMPTY(cfn))
|
||||||
POPUP_MENU_ADD_ITEM(STR_COPY);
|
POPUP_MENU_ADD_ITEM(STR_COPY);
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ void menuRadioCalibration(event_t event)
|
|||||||
{
|
{
|
||||||
check_submenu_simple(event, 0);
|
check_submenu_simple(event, 0);
|
||||||
title(STR_MENUCALIBRATION);
|
title(STR_MENUCALIBRATION);
|
||||||
menuCommonCalib(READ_ONLY() ? 0 : event);
|
menuCommonCalib(event);
|
||||||
drawPotsBars();
|
drawPotsBars();
|
||||||
if (menuEvent) {
|
if (menuEvent) {
|
||||||
menuCalibrationState = CALIB_START;
|
menuCalibrationState = CALIB_START;
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ void RadioSdManagerPage::fileAction(const char* path, const char* name,
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
#if defined(MULTIMODULE) && !defined(DISABLE_MULTI_UPDATE)
|
#if defined(MULTIMODULE) && !defined(DISABLE_MULTI_UPDATE)
|
||||||
if (!READ_ONLY() && !strcasecmp(ext, MULTI_FIRMWARE_EXT)) {
|
if (!strcasecmp(ext, MULTI_FIRMWARE_EXT)) {
|
||||||
MultiFirmwareInformation information;
|
MultiFirmwareInformation information;
|
||||||
if (information.readMultiFirmwareInformation(fullpath) == nullptr) {
|
if (information.readMultiFirmwareInformation(fullpath) == nullptr) {
|
||||||
#if defined(INTERNAL_MODULE_MULTI)
|
#if defined(INTERNAL_MODULE_MULTI)
|
||||||
@@ -287,7 +287,7 @@ void RadioSdManagerPage::fileAction(const char* path, const char* name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else if (!READ_ONLY() && !strcasecmp(ext, ELRS_FIRMWARE_EXT)) {
|
else if (!strcasecmp(ext, ELRS_FIRMWARE_EXT)) {
|
||||||
menu->addLine(STR_FLASH_EXTERNAL_ELRS, [=]() {
|
menu->addLine(STR_FLASH_EXTERNAL_ELRS, [=]() {
|
||||||
MultiFirmwareUpdate(fullpath, EXTERNAL_MODULE, MULTI_TYPE_ELRS);
|
MultiFirmwareUpdate(fullpath, EXTERNAL_MODULE, MULTI_TYPE_ELRS);
|
||||||
});
|
});
|
||||||
@@ -318,12 +318,12 @@ void RadioSdManagerPage::fileAction(const char* path, const char* name,
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!READ_ONLY() && !strcasecmp(ext, FIRMWARE_EXT)) {
|
if (!strcasecmp(ext, FIRMWARE_EXT)) {
|
||||||
if (isBootloader(fullpath)) {
|
if (isBootloader(fullpath)) {
|
||||||
menu->addLine(STR_FLASH_BOOTLOADER,
|
menu->addLine(STR_FLASH_BOOTLOADER,
|
||||||
[=]() { BootloaderUpdate(fullpath); });
|
[=]() { BootloaderUpdate(fullpath); });
|
||||||
}
|
}
|
||||||
} else if (!READ_ONLY() && !strcasecmp(ext, SPORT_FIRMWARE_EXT)) {
|
} else if (!strcasecmp(ext, SPORT_FIRMWARE_EXT)) {
|
||||||
|
|
||||||
auto mod_desc = modulePortGetModuleDescription(SPORT_MODULE);
|
auto mod_desc = modulePortGetModuleDescription(SPORT_MODULE);
|
||||||
if (mod_desc && mod_desc->set_pwr) {
|
if (mod_desc && mod_desc->set_pwr) {
|
||||||
@@ -334,7 +334,7 @@ void RadioSdManagerPage::fileAction(const char* path, const char* name,
|
|||||||
[=]() { FrSkyFirmwareUpdate(fullpath, INTERNAL_MODULE); });
|
[=]() { FrSkyFirmwareUpdate(fullpath, INTERNAL_MODULE); });
|
||||||
menu->addLine(STR_FLASH_EXTERNAL_MODULE,
|
menu->addLine(STR_FLASH_EXTERNAL_MODULE,
|
||||||
[=]() { FrSkyFirmwareUpdate(fullpath, EXTERNAL_MODULE); });
|
[=]() { FrSkyFirmwareUpdate(fullpath, EXTERNAL_MODULE); });
|
||||||
} else if (!READ_ONLY() && !strcasecmp(ext, FRSKY_FIRMWARE_EXT)) {
|
} else if (!strcasecmp(ext, FRSKY_FIRMWARE_EXT)) {
|
||||||
FrSkyFirmwareInformation information;
|
FrSkyFirmwareInformation information;
|
||||||
if (readFrSkyFirmwareInformation(fullpath, information) ==
|
if (readFrSkyFirmwareInformation(fullpath, information) ==
|
||||||
nullptr) {
|
nullptr) {
|
||||||
@@ -422,57 +422,55 @@ void RadioSdManagerPage::fileAction(const char* path, const char* name,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (!READ_ONLY()) {
|
menu->addLine(STR_COPY_FILE, [=]() {
|
||||||
menu->addLine(STR_COPY_FILE, [=]() {
|
clipboard.type = CLIPBOARD_TYPE_SD_FILE;
|
||||||
clipboard.type = CLIPBOARD_TYPE_SD_FILE;
|
f_getcwd(clipboard.data.sd.directory, CLIPBOARD_PATH_LEN);
|
||||||
f_getcwd(clipboard.data.sd.directory, CLIPBOARD_PATH_LEN);
|
strncpy(clipboard.data.sd.filename, name, CLIPBOARD_PATH_LEN - 1);
|
||||||
strncpy(clipboard.data.sd.filename, name, CLIPBOARD_PATH_LEN - 1);
|
});
|
||||||
});
|
if (clipboard.type == CLIPBOARD_TYPE_SD_FILE) {
|
||||||
if (clipboard.type == CLIPBOARD_TYPE_SD_FILE) {
|
menu->addLine(STR_PASTE, [=]() {
|
||||||
menu->addLine(STR_PASTE, [=]() {
|
static char lfn[FF_MAX_LFN + 1]; // TODO optimize that!
|
||||||
static char lfn[FF_MAX_LFN + 1]; // TODO optimize that!
|
char destFileName[2 * CLIPBOARD_PATH_LEN + 1];
|
||||||
char destFileName[2 * CLIPBOARD_PATH_LEN + 1];
|
f_getcwd((TCHAR*)lfn, FF_MAX_LFN);
|
||||||
f_getcwd((TCHAR*)lfn, FF_MAX_LFN);
|
// prevent copying to the same directory with the same name
|
||||||
// prevent copying to the same directory with the same name
|
char* destNamePtr = clipboard.data.sd.filename;
|
||||||
char* destNamePtr = clipboard.data.sd.filename;
|
if (!strcmp(clipboard.data.sd.directory, lfn)) {
|
||||||
if (!strcmp(clipboard.data.sd.directory, lfn)) {
|
destNamePtr =
|
||||||
destNamePtr =
|
strAppend(destFileName, FILE_COPY_PREFIX, CLIPBOARD_PATH_LEN);
|
||||||
strAppend(destFileName, FILE_COPY_PREFIX, CLIPBOARD_PATH_LEN);
|
destNamePtr = strAppend(destNamePtr, clipboard.data.sd.filename,
|
||||||
destNamePtr = strAppend(destNamePtr, clipboard.data.sd.filename,
|
CLIPBOARD_PATH_LEN);
|
||||||
CLIPBOARD_PATH_LEN);
|
destNamePtr = destFileName;
|
||||||
destNamePtr = destFileName;
|
}
|
||||||
}
|
sdCopyFile(clipboard.data.sd.filename, clipboard.data.sd.directory,
|
||||||
sdCopyFile(clipboard.data.sd.filename, clipboard.data.sd.directory,
|
destNamePtr, lfn);
|
||||||
destNamePtr, lfn);
|
clipboard.type = CLIPBOARD_TYPE_NONE;
|
||||||
clipboard.type = CLIPBOARD_TYPE_NONE;
|
|
||||||
|
|
||||||
browser->refresh();
|
browser->refresh();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
menu->addLine(STR_RENAME_FILE, [=]() {
|
menu->addLine(STR_RENAME_FILE, [=]() {
|
||||||
uint8_t nameLength;
|
uint8_t nameLength;
|
||||||
uint8_t extLength;
|
uint8_t extLength;
|
||||||
|
|
||||||
const char *ext = getFileExtension(name, 0, 0, &nameLength, &extLength);
|
const char *ext = getFileExtension(name, 0, 0, &nameLength, &extLength);
|
||||||
|
|
||||||
const uint8_t maxNameLength = SD_SCREEN_FILE_LENGTH - extLength;
|
const uint8_t maxNameLength = SD_SCREEN_FILE_LENGTH - extLength;
|
||||||
nameLength = min((uint8_t)(nameLength - extLength), maxNameLength);
|
nameLength = min((uint8_t)(nameLength - extLength), maxNameLength);
|
||||||
|
|
||||||
std::string fname(name, nameLength);
|
std::string fname(name, nameLength);
|
||||||
std::string extension("");
|
std::string extension("");
|
||||||
if (ext) extension = ext;
|
if (ext) extension = ext;
|
||||||
|
|
||||||
new LabelDialog(Layer::back(), fname.c_str(), maxNameLength, STR_RENAME_FILE, [=](std::string label) {
|
new LabelDialog(Layer::back(), fname.c_str(), maxNameLength, STR_RENAME_FILE, [=](std::string label) {
|
||||||
label += extension;
|
label += extension;
|
||||||
f_rename((const TCHAR *)name, (const TCHAR *)label.c_str());
|
f_rename((const TCHAR *)name, (const TCHAR *)label.c_str());
|
||||||
browser->refresh();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
menu->addLine(STR_DELETE_FILE, [=]() {
|
|
||||||
f_unlink(fullpath);
|
|
||||||
browser->refresh();
|
browser->refresh();
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
|
menu->addLine(STR_DELETE_FILE, [=]() {
|
||||||
|
f_unlink(fullpath);
|
||||||
|
browser->refresh();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadioSdManagerPage::BootloaderUpdate(const char* fn)
|
void RadioSdManagerPage::BootloaderUpdate(const char* fn)
|
||||||
|
|||||||
@@ -43,9 +43,7 @@ void menuCommonCalib(event_t event)
|
|||||||
switch (reusableBuffer.calib.state) {
|
switch (reusableBuffer.calib.state) {
|
||||||
case CALIB_START:
|
case CALIB_START:
|
||||||
// START CALIBRATION
|
// START CALIBRATION
|
||||||
if (!READ_ONLY()) {
|
lcdDrawText(LCD_W/2, MENU_HEADER_HEIGHT+2*FH, STR_MENUTOSTART, CENTERED);
|
||||||
lcdDrawText(LCD_W/2, MENU_HEADER_HEIGHT+2*FH, STR_MENUTOSTART, CENTERED);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CALIB_SET_MIDPOINT:
|
case CALIB_SET_MIDPOINT:
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ void menuModelCurvesAll(event_t event)
|
|||||||
int8_t sub = menuVerticalPosition - HEADER_LINE;
|
int8_t sub = menuVerticalPosition - HEADER_LINE;
|
||||||
|
|
||||||
if (event == EVT_KEY_BREAK(KEY_ENTER) &&
|
if (event == EVT_KEY_BREAK(KEY_ENTER) &&
|
||||||
CURVE_SELECTED() && !READ_ONLY()) {
|
CURVE_SELECTED()) {
|
||||||
|
|
||||||
s_currIdxSubMenu = sub;
|
s_currIdxSubMenu = sub;
|
||||||
s_currSrcRaw = MIXSRC_NONE;
|
s_currSrcRaw = MIXSRC_NONE;
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ void menuModelExposAll(event_t event)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EVT_KEY_BREAK(KEY_ENTER):
|
case EVT_KEY_BREAK(KEY_ENTER):
|
||||||
if ((!s_currCh || (s_copyMode && !s_copyTgtOfs)) && !READ_ONLY()) {
|
if ((!s_currCh || (s_copyMode && !s_copyTgtOfs))) {
|
||||||
s_copyMode = (s_copyMode == COPY_MODE ? MOVE_MODE : COPY_MODE);
|
s_copyMode = (s_copyMode == COPY_MODE ? MOVE_MODE : COPY_MODE);
|
||||||
s_copySrcIdx = s_currIdx;
|
s_copySrcIdx = s_currIdx;
|
||||||
s_copySrcCh = chn;
|
s_copySrcCh = chn;
|
||||||
@@ -301,24 +301,17 @@ void menuModelExposAll(event_t event)
|
|||||||
s_copyTgtOfs = 0;
|
s_copyTgtOfs = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (READ_ONLY()) {
|
if (s_copyMode) s_currCh = 0;
|
||||||
if (!s_currCh) {
|
if (s_currCh) {
|
||||||
pushMenu(menuModelExpoOne);
|
if (reachExposLimit()) break;
|
||||||
}
|
insertExpo(s_currIdx);
|
||||||
|
pushMenu(menuModelExpoOne);
|
||||||
|
s_copyMode = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (s_copyMode) s_currCh = 0;
|
event = 0;
|
||||||
if (s_currCh) {
|
s_copyMode = 0;
|
||||||
if (reachExposLimit()) break;
|
POPUP_MENU_START(onExposMenu, 6, STR_EDIT, STR_INSERT_BEFORE, STR_INSERT_AFTER, STR_COPY, STR_MOVE, STR_DELETE);
|
||||||
insertExpo(s_currIdx);
|
|
||||||
pushMenu(menuModelExpoOne);
|
|
||||||
s_copyMode = 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
event = 0;
|
|
||||||
s_copyMode = 0;
|
|
||||||
POPUP_MENU_START(onExposMenu, 6, STR_EDIT, STR_INSERT_BEFORE, STR_INSERT_AFTER, STR_COPY, STR_MOVE, STR_DELETE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ void menuModelMixAll(event_t event)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EVT_KEY_BREAK(KEY_ENTER):
|
case EVT_KEY_BREAK(KEY_ENTER):
|
||||||
if ((!s_currCh || (s_copyMode && !s_copyTgtOfs)) && !READ_ONLY()) {
|
if ((!s_currCh || (s_copyMode && !s_copyTgtOfs))) {
|
||||||
s_copyMode = (s_copyMode == COPY_MODE ? MOVE_MODE : COPY_MODE);
|
s_copyMode = (s_copyMode == COPY_MODE ? MOVE_MODE : COPY_MODE);
|
||||||
s_copySrcIdx = s_currIdx;
|
s_copySrcIdx = s_currIdx;
|
||||||
s_copySrcCh = chn;
|
s_copySrcCh = chn;
|
||||||
@@ -218,24 +218,17 @@ void menuModelMixAll(event_t event)
|
|||||||
s_copyTgtOfs = 0;
|
s_copyTgtOfs = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (READ_ONLY()) {
|
if (s_copyMode) s_currCh = 0;
|
||||||
if (!s_currCh) {
|
if (s_currCh) {
|
||||||
pushMenu(menuModelMixOne);
|
if (reachMixesLimit()) break;
|
||||||
}
|
insertMix(s_currIdx, s_currCh - 1);
|
||||||
|
pushMenu(menuModelMixOne);
|
||||||
|
s_copyMode = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (s_copyMode) s_currCh = 0;
|
event = 0;
|
||||||
if (s_currCh) {
|
s_copyMode = 0;
|
||||||
if (reachMixesLimit()) break;
|
POPUP_MENU_START(onMixesMenu, 6, STR_EDIT, STR_INSERT_BEFORE, STR_INSERT_AFTER, STR_COPY, STR_MOVE, STR_DELETE);
|
||||||
insertMix(s_currIdx, s_currCh - 1);
|
|
||||||
pushMenu(menuModelMixOne);
|
|
||||||
s_copyMode = 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
event = 0;
|
|
||||||
s_copyMode = 0;
|
|
||||||
POPUP_MENU_START(onMixesMenu, 6, STR_EDIT, STR_INSERT_BEFORE, STR_INSERT_AFTER, STR_COPY, STR_MOVE, STR_DELETE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ void menuRadioSdManager(event_t _event)
|
|||||||
|
|
||||||
#if defined(KEYS_GPIO_REG_MENU)
|
#if defined(KEYS_GPIO_REG_MENU)
|
||||||
case EVT_KEY_LONG(KEY_MENU):
|
case EVT_KEY_LONG(KEY_MENU):
|
||||||
if (SD_CARD_PRESENT() && !READ_ONLY() && s_editMode == 0) {
|
if (SD_CARD_PRESENT() && s_editMode == 0) {
|
||||||
POPUP_MENU_ADD_ITEM(STR_SD_INFO);
|
POPUP_MENU_ADD_ITEM(STR_SD_INFO);
|
||||||
POPUP_MENU_START(onSdManagerMenu);
|
POPUP_MENU_START(onSdManagerMenu);
|
||||||
}
|
}
|
||||||
@@ -360,7 +360,7 @@ void menuRadioSdManager(event_t _event)
|
|||||||
}
|
}
|
||||||
#if LCD_DEPTH > 1
|
#if LCD_DEPTH > 1
|
||||||
else if (isExtensionMatching(ext, BITMAPS_EXT)) {
|
else if (isExtensionMatching(ext, BITMAPS_EXT)) {
|
||||||
if (!READ_ONLY() && (ext-line) <= LEN_BITMAP_NAME) {
|
if ((ext-line) <= LEN_BITMAP_NAME) {
|
||||||
POPUP_MENU_ADD_ITEM(STR_ASSIGN_BITMAP);
|
POPUP_MENU_ADD_ITEM(STR_ASSIGN_BITMAP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -371,7 +371,7 @@ void menuRadioSdManager(event_t _event)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(MULTIMODULE) && !defined(DISABLE_MULTI_UPDATE)
|
#if defined(MULTIMODULE) && !defined(DISABLE_MULTI_UPDATE)
|
||||||
if (!READ_ONLY() && !strcasecmp(ext, MULTI_FIRMWARE_EXT)) {
|
if (!strcasecmp(ext, MULTI_FIRMWARE_EXT)) {
|
||||||
MultiFirmwareInformation information;
|
MultiFirmwareInformation information;
|
||||||
if (information.readMultiFirmwareInformation(line) == nullptr) {
|
if (information.readMultiFirmwareInformation(line) == nullptr) {
|
||||||
#if defined(INTERNAL_MODULE_MULTI)
|
#if defined(INTERNAL_MODULE_MULTI)
|
||||||
@@ -381,19 +381,19 @@ void menuRadioSdManager(event_t _event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!READ_ONLY() && !strcasecmp(ext, ELRS_FIRMWARE_EXT)) {
|
if (!strcasecmp(ext, ELRS_FIRMWARE_EXT)) {
|
||||||
TCHAR lfn[FF_MAX_LFN + 1];
|
TCHAR lfn[FF_MAX_LFN + 1];
|
||||||
getSelectionFullPath(lfn);
|
getSelectionFullPath(lfn);
|
||||||
POPUP_MENU_ADD_ITEM(STR_FLASH_EXTERNAL_ELRS);
|
POPUP_MENU_ADD_ITEM(STR_FLASH_EXTERNAL_ELRS);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
if (!READ_ONLY() && !strcasecmp(ext, FIRMWARE_EXT)) {
|
if (!strcasecmp(ext, FIRMWARE_EXT)) {
|
||||||
if (isBootloader(lfn)) {
|
if (isBootloader(lfn)) {
|
||||||
POPUP_MENU_ADD_ITEM(STR_FLASH_BOOTLOADER);
|
POPUP_MENU_ADD_ITEM(STR_FLASH_BOOTLOADER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!READ_ONLY() && !strcasecmp(ext, SPORT_FIRMWARE_EXT)) {
|
else if (!strcasecmp(ext, SPORT_FIRMWARE_EXT)) {
|
||||||
auto mod_desc = modulePortGetModuleDescription(SPORT_MODULE);
|
auto mod_desc = modulePortGetModuleDescription(SPORT_MODULE);
|
||||||
if (mod_desc && mod_desc->set_pwr)
|
if (mod_desc && mod_desc->set_pwr)
|
||||||
POPUP_MENU_ADD_ITEM(STR_FLASH_EXTERNAL_DEVICE);
|
POPUP_MENU_ADD_ITEM(STR_FLASH_EXTERNAL_DEVICE);
|
||||||
@@ -404,7 +404,7 @@ void menuRadioSdManager(event_t _event)
|
|||||||
|
|
||||||
POPUP_MENU_ADD_ITEM(STR_FLASH_EXTERNAL_MODULE);
|
POPUP_MENU_ADD_ITEM(STR_FLASH_EXTERNAL_MODULE);
|
||||||
}
|
}
|
||||||
else if (!READ_ONLY() && !strcasecmp(ext, FRSKY_FIRMWARE_EXT)) {
|
else if (!strcasecmp(ext, FRSKY_FIRMWARE_EXT)) {
|
||||||
FrSkyFirmwareInformation information;
|
FrSkyFirmwareInformation information;
|
||||||
if (readFrSkyFirmwareInformation(line, information) == nullptr) {
|
if (readFrSkyFirmwareInformation(line, information) == nullptr) {
|
||||||
|
|
||||||
@@ -448,15 +448,13 @@ void menuRadioSdManager(event_t _event)
|
|||||||
POPUP_MENU_ADD_ITEM(STR_VIEW_TEXT);
|
POPUP_MENU_ADD_ITEM(STR_VIEW_TEXT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!READ_ONLY()) {
|
if (IS_FILE(line))
|
||||||
if (IS_FILE(line))
|
POPUP_MENU_ADD_ITEM(STR_COPY_FILE);
|
||||||
POPUP_MENU_ADD_ITEM(STR_COPY_FILE);
|
if (clipboard.type == CLIPBOARD_TYPE_SD_FILE)
|
||||||
if (clipboard.type == CLIPBOARD_TYPE_SD_FILE)
|
POPUP_MENU_ADD_ITEM(STR_PASTE);
|
||||||
POPUP_MENU_ADD_ITEM(STR_PASTE);
|
POPUP_MENU_ADD_ITEM(STR_RENAME_FILE);
|
||||||
POPUP_MENU_ADD_ITEM(STR_RENAME_FILE);
|
if (IS_FILE(line))
|
||||||
if (IS_FILE(line))
|
POPUP_MENU_ADD_ITEM(STR_DELETE_FILE);
|
||||||
POPUP_MENU_ADD_ITEM(STR_DELETE_FILE);
|
|
||||||
}
|
|
||||||
POPUP_MENU_START(onSdManagerMenu);
|
POPUP_MENU_START(onSdManagerMenu);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ int checkIncDec(event_t event, int val, int i_min, int i_max,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!READ_ONLY() && i_min == 0 && i_max == 1 &&
|
if (i_min == 0 && i_max == 1 &&
|
||||||
(event == EVT_KEY_BREAK(KEY_ENTER))) {
|
(event == EVT_KEY_BREAK(KEY_ENTER))) {
|
||||||
s_editMode = 0;
|
s_editMode = 0;
|
||||||
newval = !val;
|
newval = !val;
|
||||||
@@ -230,9 +230,7 @@ void check(event_t event, uint8_t curr, const MenuHandler *menuTab,
|
|||||||
|
|
||||||
case EVT_KEY_BREAK(KEY_ENTER):
|
case EVT_KEY_BREAK(KEY_ENTER):
|
||||||
if (!menuTab || l_posVert>0) {
|
if (!menuTab || l_posVert>0) {
|
||||||
if (READ_ONLY_UNLOCKED()) {
|
s_editMode = (s_editMode <= 0);
|
||||||
s_editMode = (s_editMode <= 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ int checkIncDec(event_t event, int val, int i_min, int i_max,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!READ_ONLY() && i_min == 0 && i_max == 1 &&
|
if (i_min == 0 && i_max == 1 &&
|
||||||
event == EVT_KEY_BREAK(KEY_ENTER)) {
|
event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||||
s_editMode = 0;
|
s_editMode = 0;
|
||||||
newval = !val;
|
newval = !val;
|
||||||
@@ -323,11 +323,11 @@ void check(event_t event, uint8_t curr, const MenuHandler *menuTab,
|
|||||||
case EVT_KEY_BREAK(KEY_ENTER):
|
case EVT_KEY_BREAK(KEY_ENTER):
|
||||||
if (s_editMode > 1)
|
if (s_editMode > 1)
|
||||||
break;
|
break;
|
||||||
if (menuHorizontalPosition < 0 && maxcol > 0 && READ_ONLY_UNLOCKED()) {
|
if (menuHorizontalPosition < 0 && maxcol > 0) {
|
||||||
l_posHorz = 0;
|
l_posHorz = 0;
|
||||||
AUDIO_KEY_PRESS();
|
AUDIO_KEY_PRESS();
|
||||||
}
|
}
|
||||||
else if (READ_ONLY_UNLOCKED()) {
|
else {
|
||||||
s_editMode = (s_editMode<=0);
|
s_editMode = (s_editMode<=0);
|
||||||
AUDIO_KEY_PRESS();
|
AUDIO_KEY_PRESS();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ int checkIncDec(event_t event, int val, int i_min, int i_max,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!READ_ONLY() && i_min == 0 && i_max == 1 &&
|
if (i_min == 0 && i_max == 1 &&
|
||||||
event == EVT_KEY_BREAK(KEY_ENTER)) {
|
event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||||
s_editMode = 0;
|
s_editMode = 0;
|
||||||
newval = !val;
|
newval = !val;
|
||||||
@@ -383,11 +383,11 @@ void check(event_t event, uint8_t curr, const MenuHandler *menuTab,
|
|||||||
case EVT_KEY_BREAK(KEY_ENTER):
|
case EVT_KEY_BREAK(KEY_ENTER):
|
||||||
if (s_editMode > 1)
|
if (s_editMode > 1)
|
||||||
break;
|
break;
|
||||||
if (menuHorizontalPosition < 0 && maxcol > 0 && READ_ONLY_UNLOCKED()) {
|
if (menuHorizontalPosition < 0 && maxcol > 0) {
|
||||||
l_posHorz = 0;
|
l_posHorz = 0;
|
||||||
AUDIO_KEY_PRESS();
|
AUDIO_KEY_PRESS();
|
||||||
}
|
}
|
||||||
else if (READ_ONLY_UNLOCKED()) {
|
else {
|
||||||
s_editMode = (s_editMode<=0);
|
s_editMode = (s_editMode<=0);
|
||||||
AUDIO_KEY_PRESS();
|
AUDIO_KEY_PRESS();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ int checkIncDec(event_t event, int val, int i_min, int i_max,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!READ_ONLY() && i_min == 0 && i_max == 1 &&
|
if (i_min == 0 && i_max == 1 &&
|
||||||
event == EVT_KEY_BREAK(KEY_ENTER)) {
|
event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||||
s_editMode = 0;
|
s_editMode = 0;
|
||||||
newval = !val;
|
newval = !val;
|
||||||
@@ -318,9 +318,7 @@ void check(event_t event, uint8_t curr, const MenuHandler *menuTab,
|
|||||||
|
|
||||||
case EVT_KEY_FIRST(KEY_ENTER):
|
case EVT_KEY_FIRST(KEY_ENTER):
|
||||||
if (!menuTab || l_posVert > 0) {
|
if (!menuTab || l_posVert > 0) {
|
||||||
if (READ_ONLY_UNLOCKED()) {
|
s_editMode = (s_editMode <= 0);
|
||||||
s_editMode = (s_editMode <= 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -351,10 +351,6 @@ void flightReset(uint8_t check=true);
|
|||||||
#define RESET_THR_TRACE() s_timeCum16ThrP = s_timeCumThr = 0
|
#define RESET_THR_TRACE() s_timeCum16ThrP = s_timeCumThr = 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// disabled function (not used anywhere)
|
|
||||||
#define READ_ONLY() false
|
|
||||||
#define READ_ONLY_UNLOCKED() true
|
|
||||||
|
|
||||||
void checkLowEEPROM();
|
void checkLowEEPROM();
|
||||||
void checkThrottleStick();
|
void checkThrottleStick();
|
||||||
void checkSwitches();
|
void checkSwitches();
|
||||||
|
|||||||
Reference in New Issue
Block a user