chore(bw): remove unused READ_ONLY and READ_ONLY_UNLOCKED macros (#5156)

This commit is contained in:
philmoz
2024-06-12 09:54:59 +10:00
committed by GitHub
parent 0c742e2863
commit 1bc114d99f
27 changed files with 156 additions and 202 deletions
@@ -79,7 +79,7 @@ void menuModelCustomScriptOne(event_t event)
lcdDrawSizedText(SCRIPT_ONE_2ND_COLUMN_POS, y, sd.file, sizeof(sd.file), attr);
else
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;
if (sdListFiles(SCRIPTS_MIXES_PATH, SCRIPTS_EXT, sizeof(sd.file), sd.file, LIST_NONE_SD_FILE)) {
POPUP_MENU_START(onModelCustomScriptMenu);
+1 -1
View File
@@ -162,7 +162,7 @@ void menuModelDisplay(event_t event)
else
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;
if (sdListFiles(SCRIPTS_TELEM_PATH, SCRIPTS_EXT, sizeof(g_model.screens[screenIndex].script.file), g_model.screens[screenIndex].script.file)) {
POPUP_MENU_START(onTelemetryScriptFileSelectionMenu);
+1 -1
View File
@@ -64,7 +64,7 @@ void menuModelFailsafe(event_t event)
if (g_eeGeneral.ppmunit == PPM_PERCENT_PREC1)
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);
}
+1 -1
View File
@@ -234,7 +234,7 @@ void menuModelLimits(event_t event)
if (sub == k &&
((event == EVT_KEY_BREAK(KEY_ENTER)) ||
(event == EVT_KEY_LONG(KEY_ENTER))) &&
!READ_ONLY() && (k != MAX_OUTPUT_CHANNELS)) {
(k != MAX_OUTPUT_CHANNELS)) {
s_editMode = 0;
POPUP_MENU_START(onLimitsMenu, 5, STR_EDIT, STR_RESET,
STR_COPY_TRIMS_TO_OFS, STR_COPY_STICKS_TO_OFS,
+1 -6
View File
@@ -167,12 +167,7 @@ void menuModelSelect(event_t event)
case EVT_KEY_LONG(KEY_ENTER):
case EVT_KEY_BREAK(KEY_ENTER):
s_editMode = 0;
if (READ_ONLY()) {
if (g_eeGeneral.currModel != sub && modelExists(sub)) {
selectModel(sub);
}
}
else if (s_copyMode && (s_copyTgtOfs || s_copySrcRow>=0)) {
if (s_copyMode && (s_copyTgtOfs || s_copySrcRow>=0)) {
showMessageBox(s_copyMode==COPY_MODE ? STR_COPYINGMODEL : STR_MOVINGMODEL);
storageCheck(true); // force writing of current model data before this is changed
+25 -29
View File
@@ -1073,29 +1073,27 @@ void menuModelSetup(event_t event)
if (attr) {
#endif
s_editMode = 0;
if (!READ_ONLY()) {
switch (event) {
case EVT_KEY_BREAK(KEY_ENTER):
break;
switch (event) {
case EVT_KEY_BREAK(KEY_ENTER):
break;
case EVT_KEY_LONG(KEY_ENTER):
if (menuHorizontalPosition < 0 ||
menuHorizontalPosition >= switchWarningsCount) {
START_NO_HIGHLIGHT();
getMovedSwitch();
// Mask switches enabled for warnings
swarnstate_t sw_mask = 0;
for(uint8_t i = 0; i < switchGetMaxSwitches(); i++) {
if (SWITCH_WARNING_ALLOWED(i))
if (g_model.switchWarning & (0x07 << (3 * i)))
sw_mask |= (0x07 << (3 * i));
}
g_model.switchWarning = switches_states & sw_mask;
AUDIO_WARNING1();
storageDirty(EE_MODEL);
case EVT_KEY_LONG(KEY_ENTER):
if (menuHorizontalPosition < 0 ||
menuHorizontalPosition >= switchWarningsCount) {
START_NO_HIGHLIGHT();
getMovedSwitch();
// Mask switches enabled for warnings
swarnstate_t sw_mask = 0;
for(uint8_t i = 0; i < switchGetMaxSwitches(); i++) {
if (SWITCH_WARNING_ALLOWED(i))
if (g_model.switchWarning & (0x07 << (3 * i)))
sw_mask |= (0x07 << (3 * i));
}
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++) {
if (SWITCH_WARNING_ALLOWED(i)) {
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) {
uint8_t curr_state = (states & 0x07);
// remove old setting
@@ -1145,7 +1143,7 @@ void menuModelSetup(event_t event)
if (attr) {
if (menuHorizontalPosition > 0) s_editMode = 0;
if (!READ_ONLY() && menuHorizontalPosition > 0) {
if (menuHorizontalPosition > 0) {
switch (event) {
case EVT_KEY_LONG(KEY_ENTER):
if (g_model.potsWarnMode == POTS_WARN_MANUAL) {
@@ -1203,11 +1201,9 @@ void menuModelSetup(event_t event)
}
if (attr) {
if (event == EVT_KEY_BREAK(KEY_ENTER)) {
if (READ_ONLY_UNLOCKED()) {
s_editMode = 0;
g_model.beepANACenter ^= ((BeepANACenter)1<<menuHorizontalPosition);
storageDirty(EE_MODEL);
}
s_editMode = 0;
g_model.beepANACenter ^= ((BeepANACenter)1<<menuHorizontalPosition);
storageDirty(EE_MODEL);
}
}
} break;
@@ -2379,7 +2375,7 @@ void menuModelSetup(event_t event)
case ITEM_MODEL_SETUP_USBJOYSTICK_APPLY:
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();
}
break;
@@ -156,9 +156,9 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
#if defined(PCBTARANIS)
#if defined(PCBXLITE)
// 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
if (menuHorizontalPosition<0 && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) {
if (menuHorizontalPosition<0 && event==EVT_KEY_LONG(KEY_ENTER)) {
#endif
CustomFunctionData *cfn = &functions[sub];
if (!CFN_EMPTY(cfn))
+1 -1
View File
@@ -27,7 +27,7 @@ void menuRadioCalibration(event_t event)
{
check_submenu_simple(event, 0);
title(STR_MENUCALIBRATION);
menuCommonCalib(READ_ONLY() ? 0 : event);
menuCommonCalib(event);
if (menuEvent) {
menuCalibrationState = CALIB_START;
}