From e8b0796fc70d06f59cb217dbe11a2ad695243ad1 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 29 Apr 2020 14:52:42 -0500 Subject: [PATCH] Revert menu_item_if ahead of refactor --- Marlin/src/lcd/menu/menu.h | 15 ++------ Marlin/src/lcd/menu/menu_advanced.cpp | 43 +++++++++++------------ Marlin/src/lcd/menu/menu_bed_leveling.cpp | 8 ++--- Marlin/src/lcd/menu/menu_cancelobject.cpp | 2 +- Marlin/src/lcd/menu/menu_filament.cpp | 32 ++++++++--------- Marlin/src/lcd/menu/menu_led.cpp | 6 ++-- Marlin/src/lcd/menu/menu_main.cpp | 10 +++--- Marlin/src/lcd/menu/menu_media.cpp | 4 +-- Marlin/src/lcd/menu/menu_motion.cpp | 26 +++++++------- Marlin/src/lcd/menu/menu_temperature.cpp | 31 +++++++--------- Marlin/src/lcd/menu/menu_tune.cpp | 18 ++++------ Marlin/src/lcd/menu/menu_ubl.cpp | 4 +-- 12 files changed, 84 insertions(+), 115 deletions(-) diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index 91976cd19..fc5ff3698 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -340,8 +340,8 @@ class MenuItem_bool : public MenuEditItemBase { * menu item that exists in two screen segments is drawn and processed twice per screen * update. With each item processed 5, 10, 20, or 40 times the logic has to be simple. * - * To keep performance optimal, use the MENU_ITEM_IF/ELSE/ELIF macros. If function calls - * are needed to test conditions, they should come before START_MENU / START_SCREEN. + * To avoid repetition and side-effects, function calls for testing menu item conditions + * should be done before the menu loop (START_MENU / START_SCREEN). */ /** @@ -536,17 +536,6 @@ class MenuItem_bool : public MenuEditItemBase { #define YESNO_ITEM_N_P(N,PLABEL, V...) _CONFIRM_ITEM_N_P(N, PLABEL, ##V) #define YESNO_ITEM_N(N,LABEL, V...) YESNO_ITEM_N_P(N, GET_TEXT(LABEL), ##V) -/** - * MENU_ITEM_IF/ELSE/ELIF - * - * Apply a condition for a menu item to exist. - * When the condition passes, NEXT_ITEM updates _thisItemNr. - * This cannot be used to wrap multiple menu items. - */ -#define MENU_ITEM_IF(COND) if ((_menuLineNr == _thisItemNr) && (COND)) -#define MENU_ITEM_ELIF(COND) else if ((_menuLineNr == _thisItemNr) && (COND)) -#define MENU_ITEM_ELSE else if (_menuLineNr == _thisItemNr) - //////////////////////////////////////////// /////////////// Menu Screens /////////////// //////////////////////////////////////////// diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index e055b5c8e..9828e7ec8 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -147,12 +147,10 @@ void menu_cancelobject(); #endif #if ENABLED(FILAMENT_RUNOUT_SENSOR) && FILAMENT_RUNOUT_DISTANCE_MM - MENU_ITEM_IF(1) { - editable.decimal = runout.runout_distance(); - EDIT_ITEM(float3, MSG_RUNOUT_DISTANCE_MM, &editable.decimal, 1, 30, - []{ runout.set_runout_distance(editable.decimal); }, true - ); - } + editable.decimal = runout.runout_distance(); + EDIT_ITEM(float3, MSG_RUNOUT_DISTANCE_MM, &editable.decimal, 1, 30, + []{ runout.set_runout_distance(editable.decimal); }, true + ); #endif END_MENU(); @@ -417,10 +415,8 @@ void menu_cancelobject(); #ifdef XY_FREQUENCY_LIMIT EDIT_ITEM(int8, MSG_XY_FREQUENCY_LIMIT, &planner.xy_freq_limit_hz, 0, 100, planner.refresh_frequency_limit, true); - MENU_ITEM_IF(1) { - editable.uint8 = uint8_t(LROUND(planner.xy_freq_min_speed_factor * 255 * 100)); // percent to u8 - EDIT_ITEM(percent, MSG_XY_FREQUENCY_FEEDRATE, &editable.uint8, 3, 255, []{ planner.set_min_speed_factor_u8(editable.uint8); }, true); - } + editable.uint8 = uint8_t(LROUND(planner.xy_freq_min_speed_factor * 255 * 100)); // percent to u8 + EDIT_ITEM(percent, MSG_XY_FREQUENCY_FEEDRATE, &editable.uint8, 3, 255, []{ planner.set_min_speed_factor_u8(editable.uint8); }, true); #endif END_MENU(); @@ -504,6 +500,10 @@ void menu_advanced_steps_per_mm() { void menu_advanced_settings() { const bool is_busy = printer_busy(); + #if ENABLED(SD_FIRMWARE_UPDATE) + bool sd_update_state = settings.sd_update_status(); + #endif + START_MENU(); BACK_ITEM(MSG_CONFIGURATION); @@ -576,19 +576,16 @@ void menu_advanced_settings() { #endif #if ENABLED(SD_FIRMWARE_UPDATE) - MENU_ITEM_IF (1) { - bool sd_update_state = settings.sd_update_status(); - EDIT_ITEM(bool, MSG_MEDIA_UPDATE, &sd_update_state, []{ - // - // Toggle the SD Firmware Update state in EEPROM - // - const bool new_state = !settings.sd_update_status(), - didset = settings.set_sd_update_status(new_state); - ui.completion_feedback(didset); - ui.return_to_status(); - if (new_state) LCD_MESSAGEPGM(MSG_RESET_PRINTER); else ui.reset_status(); - }); - } + EDIT_ITEM(bool, MSG_MEDIA_UPDATE, &sd_update_state, []{ + // + // Toggle the SD Firmware Update state in EEPROM + // + const bool new_state = !settings.sd_update_status(), + didset = settings.set_sd_update_status(new_state); + ui.completion_feedback(didset); + ui.return_to_status(); + if (new_state) LCD_MESSAGEPGM(MSG_RESET_PRINTER); else ui.reset_status(); + }); #endif #if ENABLED(EEPROM_SETTINGS) && DISABLED(SLIM_LCD_MENUS) diff --git a/Marlin/src/lcd/menu/menu_bed_leveling.cpp b/Marlin/src/lcd/menu/menu_bed_leveling.cpp index 2592f2664..5192c596d 100644 --- a/Marlin/src/lcd/menu/menu_bed_leveling.cpp +++ b/Marlin/src/lcd/menu/menu_bed_leveling.cpp @@ -256,11 +256,9 @@ void menu_bed_leveling() { // Z Fade Height #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) - MENU_ITEM_IF (1) { - // Shadow for editing the fade height - editable.decimal = planner.z_fade_height; - EDIT_ITEM_FAST(float3, MSG_Z_FADE_HEIGHT, &editable.decimal, 0, 100, []{ set_z_fade_height(editable.decimal); }); - } + // Shadow for editing the fade height + editable.decimal = planner.z_fade_height; + EDIT_ITEM_FAST(float3, MSG_Z_FADE_HEIGHT, &editable.decimal, 0, 100, []{ set_z_fade_height(editable.decimal); }); #endif // diff --git a/Marlin/src/lcd/menu/menu_cancelobject.cpp b/Marlin/src/lcd/menu/menu_cancelobject.cpp index 68fb1c991..f49e478c2 100644 --- a/Marlin/src/lcd/menu/menu_cancelobject.cpp +++ b/Marlin/src/lcd/menu/menu_cancelobject.cpp @@ -62,7 +62,7 @@ void menu_cancelobject() { for (int8_t i = -1; i < cancelable.object_count; i++) { if (i == ao) continue; // Active is drawn on -1 index const int8_t j = i < 0 ? ao : i; // Active or index item - MENU_ITEM_IF (!cancelable.is_canceled(j)) { // Not canceled already? + if (!cancelable.is_canceled(j)) { // Not canceled already? SUBMENU_N(j, MSG_CANCEL_OBJECT_N, lcd_cancel_object_confirm); // Offer the option. if (i < 0) SKIP_ITEM(); // Extra line after active } diff --git a/Marlin/src/lcd/menu/menu_filament.cpp b/Marlin/src/lcd/menu/menu_filament.cpp index ec45eb377..5598306ae 100644 --- a/Marlin/src/lcd/menu/menu_filament.cpp +++ b/Marlin/src/lcd/menu/menu_filament.cpp @@ -116,16 +116,16 @@ void _menu_temp_filament_op(const PauseMode mode, const int8_t extruder) { // Change filament #if E_STEPPERS == 1 PGM_P const msg = GET_TEXT(MSG_FILAMENTCHANGE); - MENU_ITEM_IF (thermalManager.targetTooColdToExtrude(active_extruder)) + if (thermalManager.targetTooColdToExtrude(active_extruder)) SUBMENU_P(msg, []{ _menu_temp_filament_op(PAUSE_MODE_CHANGE_FILAMENT, 0); }); - MENU_ITEM_ELSE + else GCODES_ITEM_P(msg, PSTR("M600 B0")); #else PGM_P const msg = GET_TEXT(MSG_FILAMENTCHANGE_E); LOOP_L_N(s, E_STEPPERS) { - MENU_ITEM_IF (thermalManager.targetTooColdToExtrude(s)) + if (thermalManager.targetTooColdToExtrude(s)) SUBMENU_N_P(s, msg, []{ _menu_temp_filament_op(PAUSE_MODE_CHANGE_FILAMENT, MenuItemBase::itemIndex); }); - MENU_ITEM_ELSE { + else { ACTION_ITEM_N_P(s, msg, []{ char cmd[13]; sprintf_P(cmd, PSTR("M600 B0 T%i"), int(MenuItemBase::itemIndex)); @@ -140,16 +140,16 @@ void _menu_temp_filament_op(const PauseMode mode, const int8_t extruder) { // Load filament #if E_STEPPERS == 1 PGM_P const msg_load = GET_TEXT(MSG_FILAMENTLOAD); - MENU_ITEM_IF (thermalManager.targetTooColdToExtrude(active_extruder)) + if (thermalManager.targetTooColdToExtrude(active_extruder)) SUBMENU_P(msg_load, []{ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 0); }); - MENU_ITEM_ELSE + else GCODES_ITEM_P(msg_load, PSTR("M701")); #else PGM_P const msg_load = GET_TEXT(MSG_FILAMENTLOAD_E); LOOP_L_N(s, E_STEPPERS) { - MENU_ITEM_IF (thermalManager.targetTooColdToExtrude(s)) + if (thermalManager.targetTooColdToExtrude(s)) SUBMENU_N_P(s, msg_load, []{ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, MenuItemBase::itemIndex); }); - MENU_ITEM_ELSE { + else { ACTION_ITEM_N_P(s, msg_load, []{ char cmd[12]; sprintf_P(cmd, PSTR("M701 T%i"), int(MenuItemBase::itemIndex)); @@ -162,22 +162,22 @@ void _menu_temp_filament_op(const PauseMode mode, const int8_t extruder) { // Unload filament #if E_STEPPERS == 1 PGM_P const msg_unload = GET_TEXT(MSG_FILAMENTUNLOAD); - MENU_ITEM_IF (thermalManager.targetTooColdToExtrude(active_extruder)) + if (thermalManager.targetTooColdToExtrude(active_extruder)) SUBMENU_P(msg_unload, []{ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 0); }); - MENU_ITEM_ELSE + else GCODES_ITEM_P(msg_unload, PSTR("M702")); #else #if ENABLED(FILAMENT_UNLOAD_ALL_EXTRUDERS) - MENU_ITEM_IF (too_cold) + if (too_cold) SUBMENU(MSG_FILAMENTUNLOAD_ALL, []{ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, -1); }); - MENU_ITEM_ELSE + else GCODES_ITEM(MSG_FILAMENTUNLOAD_ALL, PSTR("M702")); #endif PGM_P const msg_unload = GET_TEXT(MSG_FILAMENTUNLOAD_E); LOOP_L_N(s, E_STEPPERS) { - MENU_ITEM_IF (thermalManager.targetTooColdToExtrude(s)) + if (thermalManager.targetTooColdToExtrude(s)) SUBMENU_N_P(s, msg_unload, []{ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, MenuItemBase::itemIndex); }); - MENU_ITEM_ELSE { + else { ACTION_ITEM_N_P(s, msg_unload, []{ char cmd[12]; sprintf_P(cmd, PSTR("M702 T%i"), int(MenuItemBase::itemIndex)); @@ -230,13 +230,13 @@ void menu_pause_option() { #if HAS_FILAMENT_SENSOR const bool still_out = runout.filament_ran_out; - MENU_ITEM_IF (still_out) + if (still_out) EDIT_ITEM(bool, MSG_RUNOUT_SENSOR, &runout.enabled, runout.reset); #else constexpr bool still_out = false; #endif - MENU_ITEM_IF (!still_out) + if (!still_out) ACTION_ITEM(MSG_FILAMENT_CHANGE_OPTION_RESUME, []{ pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT; }); END_MENU(); diff --git a/Marlin/src/lcd/menu/menu_led.cpp b/Marlin/src/lcd/menu/menu_led.cpp index 62689b8a4..ea76ae74d 100644 --- a/Marlin/src/lcd/menu/menu_led.cpp +++ b/Marlin/src/lcd/menu/menu_led.cpp @@ -70,10 +70,8 @@ void menu_led_custom() { void menu_led() { START_MENU(); BACK_ITEM(MSG_MAIN); - MENU_ITEM_IF(1) { - bool led_on = leds.lights_on; - EDIT_ITEM(bool, MSG_LEDS, &led_on, leds.toggle); - } + bool led_on = leds.lights_on; + EDIT_ITEM(bool, MSG_LEDS, &led_on, leds.toggle); ACTION_ITEM(MSG_SET_LEDS_DEFAULT, leds.set_default); #if ENABLED(LED_COLOR_PRESETS) SUBMENU(MSG_LED_PRESETS, menu_led_presets); diff --git a/Marlin/src/lcd/menu/menu_main.cpp b/Marlin/src/lcd/menu/menu_main.cpp index 7e7ea71ce..f882fe686 100644 --- a/Marlin/src/lcd/menu/menu_main.cpp +++ b/Marlin/src/lcd/menu/menu_main.cpp @@ -144,7 +144,7 @@ void menu_main() { #endif // !HAS_ENCODER_WHEEL && SDSUPPORT - MENU_ITEM_IF (TERN0(MACHINE_CAN_PAUSE, printingIsPaused())) + if (TERN0(MACHINE_CAN_PAUSE, printingIsPaused())) ACTION_ITEM(MSG_RESUME_PRINT, ui.resume_print); SUBMENU(MSG_MOTION, menu_motion); @@ -176,9 +176,9 @@ void menu_main() { #if ENABLED(ADVANCED_PAUSE_FEATURE) #if E_STEPPERS == 1 && DISABLED(FILAMENT_LOAD_UNLOAD_GCODES) - MENU_ITEM_IF (thermalManager.targetHotEnoughToExtrude(active_extruder)) + if (thermalManager.targetHotEnoughToExtrude(active_extruder)) GCODES_ITEM(MSG_FILAMENTCHANGE, PSTR("M600 B0")); - MENU_ITEM_ELSE + else SUBMENU(MSG_FILAMENTCHANGE, []{ _menu_temp_filament_op(PAUSE_MODE_CHANGE_FILAMENT, 0); }); #else SUBMENU(MSG_FILAMENTCHANGE, menu_change_filament); @@ -197,9 +197,9 @@ void menu_main() { // Switch power on/off // #if ENABLED(PSU_CONTROL) - MENU_ITEM_IF (powersupply_on) + if (powersupply_on) GCODES_ITEM(MSG_SWITCH_PS_OFF, PSTR("M81")); - MENU_ITEM_ELSE + else GCODES_ITEM(MSG_SWITCH_PS_ON, PSTR("M80")); #endif diff --git a/Marlin/src/lcd/menu/menu_media.cpp b/Marlin/src/lcd/menu/menu_media.cpp index 3b3c78c1d..7b3d1e549 100644 --- a/Marlin/src/lcd/menu/menu_media.cpp +++ b/Marlin/src/lcd/menu/menu_media.cpp @@ -127,9 +127,9 @@ void menu_media() { if (ui.should_draw()) for (uint16_t i = 0; i < fileCnt; i++) { if (_menuLineNr == _thisItemNr) { card.getfilename_sorted(SD_ORDER(i, fileCnt)); - MENU_ITEM_IF (card.flag.filenameIsDir) + if (card.flag.filenameIsDir) MENU_ITEM(sdfolder, MSG_MEDIA_MENU, card); - MENU_ITEM_ELSE + else MENU_ITEM(sdfile, MSG_MEDIA_MENU, card); } else diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index 63533ee22..be2effafd 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -217,7 +217,7 @@ void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int SUBMENU(MSG_MOVE_10MM, []{ _goto_manual_move(10); }); SUBMENU(MSG_MOVE_1MM, []{ _goto_manual_move( 1); }); SUBMENU(MSG_MOVE_01MM, []{ _goto_manual_move( 0.1f); }); - MENU_ITEM_IF (axis == Z_AXIS && (SHORT_MANUAL_Z_MOVE) > 0.0f && (SHORT_MANUAL_Z_MOVE) < 0.1f) { + if (axis == Z_AXIS && (SHORT_MANUAL_Z_MOVE) > 0.0f && (SHORT_MANUAL_Z_MOVE) < 0.1f) { extern const char NUL_STR[]; SUBMENU_P(NUL_STR, []{ _goto_manual_move(float(SHORT_MANUAL_Z_MOVE)); }); MENU_ITEM_ADDON_START(0 + ENABLED(HAS_CHARACTER_LCD)); @@ -271,23 +271,23 @@ void menu_move() { } #elif EXTRUDERS == 3 if (active_extruder < 2) { - MENU_ITEM_IF (active_extruder) + if (active_extruder) GCODES_ITEM_N(0, MSG_SELECT_E, PSTR("T0")); - MENU_ITEM_ELSE + else GCODES_ITEM_N(1, MSG_SELECT_E, PSTR("T1")); } #else - MENU_ITEM_IF (active_extruder) + if (active_extruder) GCODES_ITEM_N(0, MSG_SELECT_E, PSTR("T0")); - MENU_ITEM_ELSE + else GCODES_ITEM_N(1, MSG_SELECT_E, PSTR("T1")); #endif #elif ENABLED(DUAL_X_CARRIAGE) - MENU_ITEM_IF (active_extruder) + if (active_extruder) GCODES_ITEM_N(0, MSG_SELECT_E, PSTR("T0")); - MENU_ITEM_ELSE + else GCODES_ITEM_N(1, MSG_SELECT_E, PSTR("T1")); #endif @@ -335,7 +335,7 @@ void menu_motion() { // // Move Axis // - MENU_ITEM_IF (TERN1(DELTA, all_axes_homed())) + if (TERN1(DELTA, all_axes_homed())) SUBMENU(MSG_MOVE_AXIS, menu_move); // @@ -364,7 +364,7 @@ void menu_motion() { #elif ENABLED(LCD_BED_LEVELING) - MENU_ITEM_IF (!g29_in_progress) + if (!g29_in_progress) SUBMENU(MSG_BED_LEVELING, menu_bed_leveling); #elif HAS_LEVELING && DISABLED(SLIM_LCD_MENUS) @@ -373,16 +373,14 @@ void menu_motion() { GCODES_ITEM(MSG_LEVEL_BED, PSTR("G28\nG29")); #endif - MENU_ITEM_IF (all_axes_homed() && leveling_is_valid()) { + if (all_axes_homed() && leveling_is_valid()) { bool show_state = planner.leveling_active; EDIT_ITEM(bool, MSG_BED_LEVELING, &show_state, _lcd_toggle_bed_leveling); } #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) - MENU_ITEM_IF(1) { - editable.decimal = planner.z_fade_height; - EDIT_ITEM_FAST(float3, MSG_Z_FADE_HEIGHT, &editable.decimal, 0, 100, []{ set_z_fade_height(editable.decimal); }); - } + editable.decimal = planner.z_fade_height; + EDIT_ITEM_FAST(float3, MSG_Z_FADE_HEIGHT, &editable.decimal, 0, 100, []{ set_z_fade_height(editable.decimal); }); #endif #endif diff --git a/Marlin/src/lcd/menu/menu_temperature.cpp b/Marlin/src/lcd/menu/menu_temperature.cpp index 552684893..e95a7cf22 100644 --- a/Marlin/src/lcd/menu/menu_temperature.cpp +++ b/Marlin/src/lcd/menu/menu_temperature.cpp @@ -154,6 +154,11 @@ void Temperature::lcd_preheat(const int16_t e, const int8_t indh, const int8_t i #endif // HAS_TEMP_HOTEND || HAS_HEATED_BED void menu_temperature() { + #if HAS_TEMP_HOTEND + bool has_heat = false; + HOTEND_LOOP() if (thermalManager.temp_hotend[HOTEND_INDEX].target) { has_heat = true; break; } + #endif + START_MENU(); BACK_ITEM(MSG_MAIN); @@ -198,10 +203,8 @@ void menu_temperature() { #if HAS_FAN1 || HAS_FAN2 || HAS_FAN3 || HAS_FAN4 || HAS_FAN5 || HAS_FAN6 || HAS_FAN7 auto fan_edit_items = [&](const uint8_t f) { - MENU_ITEM_IF(1) { - editable.uint8 = thermalManager.fan_speed[f]; - EDIT_ITEM_FAST_N(percent, f, MSG_FAN_SPEED_N, &editable.uint8, 0, 255, on_fan_update); - } + editable.uint8 = thermalManager.fan_speed[f]; + EDIT_ITEM_FAST_N(percent, f, MSG_FAN_SPEED_N, &editable.uint8, 0, 255, on_fan_update); #if ENABLED(EXTRA_FAN_SPEED) EDIT_ITEM_FAST_N(percent, f, MSG_EXTRA_FAN_SPEED_N, &thermalManager.new_fan_speed[f], 3, 255); #endif @@ -211,18 +214,14 @@ void menu_temperature() { #define SNFAN(N) (ENABLED(SINGLENOZZLE_STANDBY_FAN) && !HAS_FAN##N && EXTRUDERS > N) #if SNFAN(1) || SNFAN(2) || SNFAN(3) || SNFAN(4) || SNFAN(5) || SNFAN(6) || SNFAN(7) auto singlenozzle_item = [&](const uint8_t f) { - MENU_ITEM_IF(1) { - editable.uint8 = singlenozzle_fan_speed[f]; - EDIT_ITEM_FAST_N(percent, f, MSG_STORED_FAN_N, &editable.uint8, 0, 255, on_fan_update); - } + editable.uint8 = singlenozzle_fan_speed[f]; + EDIT_ITEM_FAST_N(percent, f, MSG_STORED_FAN_N, &editable.uint8, 0, 255, on_fan_update); }; #endif #if HAS_FAN0 - MENU_ITEM_IF(1) { - editable.uint8 = thermalManager.fan_speed[0]; - EDIT_ITEM_FAST_N(percent, 0, MSG_FIRST_FAN_SPEED, &editable.uint8, 0, 255, on_fan_update); - } + editable.uint8 = thermalManager.fan_speed[0]; + EDIT_ITEM_FAST_N(percent, 0, MSG_FIRST_FAN_SPEED, &editable.uint8, 0, 255, on_fan_update); #if ENABLED(EXTRA_FAN_SPEED) EDIT_ITEM_FAST_N(percent, 0, MSG_FIRST_EXTRA_FAN_SPEED, &thermalManager.new_fan_speed[0], 3, 255); #endif @@ -281,12 +280,8 @@ void menu_temperature() { // // Cooldown // - MENU_ITEM_IF(1) { - bool has_heat = false; - HOTEND_LOOP() if (thermalManager.temp_hotend[HOTEND_INDEX].target) { has_heat = true; break; } - if (TERN0(HAS_HEATED_BED, thermalManager.temp_bed.target)) has_heat = true; - if (has_heat) ACTION_ITEM(MSG_COOLDOWN, lcd_cooldown); - } + if (TERN0(HAS_HEATED_BED, thermalManager.temp_bed.target)) has_heat = true; + if (has_heat) ACTION_ITEM(MSG_COOLDOWN, lcd_cooldown); #endif // HAS_TEMP_HOTEND diff --git a/Marlin/src/lcd/menu/menu_tune.cpp b/Marlin/src/lcd/menu/menu_tune.cpp index e510bae63..b39133525 100644 --- a/Marlin/src/lcd/menu/menu_tune.cpp +++ b/Marlin/src/lcd/menu/menu_tune.cpp @@ -147,10 +147,8 @@ void menu_tune() { #if HAS_FAN1 || HAS_FAN2 || HAS_FAN3 || HAS_FAN4 || HAS_FAN5 || HAS_FAN6 || HAS_FAN7 auto fan_edit_items = [&](const uint8_t f) { - MENU_ITEM_IF(1) { - editable.uint8 = thermalManager.fan_speed[f]; - EDIT_ITEM_FAST_N(percent, f, MSG_FAN_SPEED_N, &editable.uint8, 0, 255, on_fan_update); - } + editable.uint8 = thermalManager.fan_speed[f]; + EDIT_ITEM_FAST_N(percent, f, MSG_FAN_SPEED_N, &editable.uint8, 0, 255, on_fan_update); #if ENABLED(EXTRA_FAN_SPEED) EDIT_ITEM_FAST_N(percent, f, MSG_EXTRA_FAN_SPEED_N, &thermalManager.new_fan_speed[f], 3, 255); #endif @@ -160,18 +158,14 @@ void menu_tune() { #define SNFAN(N) (ENABLED(SINGLENOZZLE_STANDBY_FAN) && !HAS_FAN##N && EXTRUDERS > N) #if SNFAN(1) || SNFAN(2) || SNFAN(3) || SNFAN(4) || SNFAN(5) || SNFAN(6) || SNFAN(7) auto singlenozzle_item = [&](const uint8_t f) { - MENU_ITEM_IF(1) { - editable.uint8 = singlenozzle_fan_speed[f]; - EDIT_ITEM_FAST_N(percent, f, MSG_STORED_FAN_N, &editable.uint8, 0, 255, on_fan_update); - } + editable.uint8 = singlenozzle_fan_speed[f]; + EDIT_ITEM_FAST_N(percent, f, MSG_STORED_FAN_N, &editable.uint8, 0, 255, on_fan_update); }; #endif #if HAS_FAN0 - MENU_ITEM_IF(1) { - editable.uint8 = thermalManager.fan_speed[0]; - EDIT_ITEM_FAST_N(percent, 0, MSG_FIRST_FAN_SPEED, &editable.uint8, 0, 255, on_fan_update); - } + editable.uint8 = thermalManager.fan_speed[0]; + EDIT_ITEM_FAST_N(percent, 0, MSG_FIRST_FAN_SPEED, &editable.uint8, 0, 255, on_fan_update); #if ENABLED(EXTRA_FAN_SPEED) EDIT_ITEM_FAST_N(percent, 0, MSG_FIRST_EXTRA_FAN_SPEED, &thermalManager.new_fan_speed[0], 3, 255); #endif diff --git a/Marlin/src/lcd/menu/menu_ubl.cpp b/Marlin/src/lcd/menu/menu_ubl.cpp index fdb0da0b3..521487c3d 100644 --- a/Marlin/src/lcd/menu/menu_ubl.cpp +++ b/Marlin/src/lcd/menu/menu_ubl.cpp @@ -579,9 +579,9 @@ void _lcd_ubl_step_by_step() { void _lcd_ubl_level_bed() { START_MENU(); BACK_ITEM(MSG_MOTION); - MENU_ITEM_IF (planner.leveling_active) + if (planner.leveling_active) GCODES_ITEM(MSG_UBL_DEACTIVATE_MESH, PSTR("G29 D")); - MENU_ITEM_ELSE + else GCODES_ITEM(MSG_UBL_ACTIVATE_MESH, PSTR("G29 A")); SUBMENU(MSG_UBL_STEP_BY_STEP_MENU, _lcd_ubl_step_by_step); ACTION_ITEM(MSG_UBL_MESH_EDIT, _lcd_ubl_output_map_lcd_cmd);