Revert menu_item_if ahead of refactor
This commit is contained in:
parent
c26725c5a0
commit
e8b0796fc7
@ -340,8 +340,8 @@ class MenuItem_bool : public MenuEditItemBase {
|
|||||||
* menu item that exists in two screen segments is drawn and processed twice per screen
|
* 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.
|
* 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
|
* To avoid repetition and side-effects, function calls for testing menu item conditions
|
||||||
* are needed to test conditions, they should come before START_MENU / START_SCREEN.
|
* 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_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)
|
#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 ///////////////
|
/////////////// Menu Screens ///////////////
|
||||||
////////////////////////////////////////////
|
////////////////////////////////////////////
|
||||||
|
@ -147,12 +147,10 @@ void menu_cancelobject();
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR) && FILAMENT_RUNOUT_DISTANCE_MM
|
#if ENABLED(FILAMENT_RUNOUT_SENSOR) && FILAMENT_RUNOUT_DISTANCE_MM
|
||||||
MENU_ITEM_IF(1) {
|
editable.decimal = runout.runout_distance();
|
||||||
editable.decimal = runout.runout_distance();
|
EDIT_ITEM(float3, MSG_RUNOUT_DISTANCE_MM, &editable.decimal, 1, 30,
|
||||||
EDIT_ITEM(float3, MSG_RUNOUT_DISTANCE_MM, &editable.decimal, 1, 30,
|
[]{ runout.set_runout_distance(editable.decimal); }, true
|
||||||
[]{ runout.set_runout_distance(editable.decimal); }, true
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
END_MENU();
|
END_MENU();
|
||||||
@ -417,10 +415,8 @@ void menu_cancelobject();
|
|||||||
|
|
||||||
#ifdef XY_FREQUENCY_LIMIT
|
#ifdef XY_FREQUENCY_LIMIT
|
||||||
EDIT_ITEM(int8, MSG_XY_FREQUENCY_LIMIT, &planner.xy_freq_limit_hz, 0, 100, planner.refresh_frequency_limit, true);
|
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
|
||||||
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);
|
||||||
EDIT_ITEM(percent, MSG_XY_FREQUENCY_FEEDRATE, &editable.uint8, 3, 255, []{ planner.set_min_speed_factor_u8(editable.uint8); }, true);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
END_MENU();
|
END_MENU();
|
||||||
@ -504,6 +500,10 @@ void menu_advanced_steps_per_mm() {
|
|||||||
void menu_advanced_settings() {
|
void menu_advanced_settings() {
|
||||||
const bool is_busy = printer_busy();
|
const bool is_busy = printer_busy();
|
||||||
|
|
||||||
|
#if ENABLED(SD_FIRMWARE_UPDATE)
|
||||||
|
bool sd_update_state = settings.sd_update_status();
|
||||||
|
#endif
|
||||||
|
|
||||||
START_MENU();
|
START_MENU();
|
||||||
BACK_ITEM(MSG_CONFIGURATION);
|
BACK_ITEM(MSG_CONFIGURATION);
|
||||||
|
|
||||||
@ -576,19 +576,16 @@ void menu_advanced_settings() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(SD_FIRMWARE_UPDATE)
|
#if ENABLED(SD_FIRMWARE_UPDATE)
|
||||||
MENU_ITEM_IF (1) {
|
EDIT_ITEM(bool, MSG_MEDIA_UPDATE, &sd_update_state, []{
|
||||||
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
|
||||||
//
|
//
|
||||||
// Toggle the SD Firmware Update state in EEPROM
|
const bool new_state = !settings.sd_update_status(),
|
||||||
//
|
didset = settings.set_sd_update_status(new_state);
|
||||||
const bool new_state = !settings.sd_update_status(),
|
ui.completion_feedback(didset);
|
||||||
didset = settings.set_sd_update_status(new_state);
|
ui.return_to_status();
|
||||||
ui.completion_feedback(didset);
|
if (new_state) LCD_MESSAGEPGM(MSG_RESET_PRINTER); else ui.reset_status();
|
||||||
ui.return_to_status();
|
});
|
||||||
if (new_state) LCD_MESSAGEPGM(MSG_RESET_PRINTER); else ui.reset_status();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(EEPROM_SETTINGS) && DISABLED(SLIM_LCD_MENUS)
|
#if ENABLED(EEPROM_SETTINGS) && DISABLED(SLIM_LCD_MENUS)
|
||||||
|
@ -256,11 +256,9 @@ void menu_bed_leveling() {
|
|||||||
|
|
||||||
// Z Fade Height
|
// Z Fade Height
|
||||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||||
MENU_ITEM_IF (1) {
|
// Shadow for editing the fade height
|
||||||
// Shadow for editing the fade height
|
editable.decimal = planner.z_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); });
|
||||||
EDIT_ITEM_FAST(float3, MSG_Z_FADE_HEIGHT, &editable.decimal, 0, 100, []{ set_z_fade_height(editable.decimal); });
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -62,7 +62,7 @@ void menu_cancelobject() {
|
|||||||
for (int8_t i = -1; i < cancelable.object_count; i++) {
|
for (int8_t i = -1; i < cancelable.object_count; i++) {
|
||||||
if (i == ao) continue; // Active is drawn on -1 index
|
if (i == ao) continue; // Active is drawn on -1 index
|
||||||
const int8_t j = i < 0 ? ao : i; // Active or index item
|
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.
|
SUBMENU_N(j, MSG_CANCEL_OBJECT_N, lcd_cancel_object_confirm); // Offer the option.
|
||||||
if (i < 0) SKIP_ITEM(); // Extra line after active
|
if (i < 0) SKIP_ITEM(); // Extra line after active
|
||||||
}
|
}
|
||||||
|
@ -116,16 +116,16 @@ void _menu_temp_filament_op(const PauseMode mode, const int8_t extruder) {
|
|||||||
// Change filament
|
// Change filament
|
||||||
#if E_STEPPERS == 1
|
#if E_STEPPERS == 1
|
||||||
PGM_P const msg = GET_TEXT(MSG_FILAMENTCHANGE);
|
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); });
|
SUBMENU_P(msg, []{ _menu_temp_filament_op(PAUSE_MODE_CHANGE_FILAMENT, 0); });
|
||||||
MENU_ITEM_ELSE
|
else
|
||||||
GCODES_ITEM_P(msg, PSTR("M600 B0"));
|
GCODES_ITEM_P(msg, PSTR("M600 B0"));
|
||||||
#else
|
#else
|
||||||
PGM_P const msg = GET_TEXT(MSG_FILAMENTCHANGE_E);
|
PGM_P const msg = GET_TEXT(MSG_FILAMENTCHANGE_E);
|
||||||
LOOP_L_N(s, E_STEPPERS) {
|
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); });
|
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, []{
|
ACTION_ITEM_N_P(s, msg, []{
|
||||||
char cmd[13];
|
char cmd[13];
|
||||||
sprintf_P(cmd, PSTR("M600 B0 T%i"), int(MenuItemBase::itemIndex));
|
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
|
// Load filament
|
||||||
#if E_STEPPERS == 1
|
#if E_STEPPERS == 1
|
||||||
PGM_P const msg_load = GET_TEXT(MSG_FILAMENTLOAD);
|
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); });
|
SUBMENU_P(msg_load, []{ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 0); });
|
||||||
MENU_ITEM_ELSE
|
else
|
||||||
GCODES_ITEM_P(msg_load, PSTR("M701"));
|
GCODES_ITEM_P(msg_load, PSTR("M701"));
|
||||||
#else
|
#else
|
||||||
PGM_P const msg_load = GET_TEXT(MSG_FILAMENTLOAD_E);
|
PGM_P const msg_load = GET_TEXT(MSG_FILAMENTLOAD_E);
|
||||||
LOOP_L_N(s, E_STEPPERS) {
|
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); });
|
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, []{
|
ACTION_ITEM_N_P(s, msg_load, []{
|
||||||
char cmd[12];
|
char cmd[12];
|
||||||
sprintf_P(cmd, PSTR("M701 T%i"), int(MenuItemBase::itemIndex));
|
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
|
// Unload filament
|
||||||
#if E_STEPPERS == 1
|
#if E_STEPPERS == 1
|
||||||
PGM_P const msg_unload = GET_TEXT(MSG_FILAMENTUNLOAD);
|
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); });
|
SUBMENU_P(msg_unload, []{ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 0); });
|
||||||
MENU_ITEM_ELSE
|
else
|
||||||
GCODES_ITEM_P(msg_unload, PSTR("M702"));
|
GCODES_ITEM_P(msg_unload, PSTR("M702"));
|
||||||
#else
|
#else
|
||||||
#if ENABLED(FILAMENT_UNLOAD_ALL_EXTRUDERS)
|
#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); });
|
SUBMENU(MSG_FILAMENTUNLOAD_ALL, []{ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, -1); });
|
||||||
MENU_ITEM_ELSE
|
else
|
||||||
GCODES_ITEM(MSG_FILAMENTUNLOAD_ALL, PSTR("M702"));
|
GCODES_ITEM(MSG_FILAMENTUNLOAD_ALL, PSTR("M702"));
|
||||||
#endif
|
#endif
|
||||||
PGM_P const msg_unload = GET_TEXT(MSG_FILAMENTUNLOAD_E);
|
PGM_P const msg_unload = GET_TEXT(MSG_FILAMENTUNLOAD_E);
|
||||||
LOOP_L_N(s, E_STEPPERS) {
|
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); });
|
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, []{
|
ACTION_ITEM_N_P(s, msg_unload, []{
|
||||||
char cmd[12];
|
char cmd[12];
|
||||||
sprintf_P(cmd, PSTR("M702 T%i"), int(MenuItemBase::itemIndex));
|
sprintf_P(cmd, PSTR("M702 T%i"), int(MenuItemBase::itemIndex));
|
||||||
@ -230,13 +230,13 @@ void menu_pause_option() {
|
|||||||
|
|
||||||
#if HAS_FILAMENT_SENSOR
|
#if HAS_FILAMENT_SENSOR
|
||||||
const bool still_out = runout.filament_ran_out;
|
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);
|
EDIT_ITEM(bool, MSG_RUNOUT_SENSOR, &runout.enabled, runout.reset);
|
||||||
#else
|
#else
|
||||||
constexpr bool still_out = false;
|
constexpr bool still_out = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MENU_ITEM_IF (!still_out)
|
if (!still_out)
|
||||||
ACTION_ITEM(MSG_FILAMENT_CHANGE_OPTION_RESUME, []{ pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT; });
|
ACTION_ITEM(MSG_FILAMENT_CHANGE_OPTION_RESUME, []{ pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT; });
|
||||||
|
|
||||||
END_MENU();
|
END_MENU();
|
||||||
|
@ -70,10 +70,8 @@ void menu_led_custom() {
|
|||||||
void menu_led() {
|
void menu_led() {
|
||||||
START_MENU();
|
START_MENU();
|
||||||
BACK_ITEM(MSG_MAIN);
|
BACK_ITEM(MSG_MAIN);
|
||||||
MENU_ITEM_IF(1) {
|
bool led_on = leds.lights_on;
|
||||||
bool led_on = leds.lights_on;
|
EDIT_ITEM(bool, MSG_LEDS, &led_on, leds.toggle);
|
||||||
EDIT_ITEM(bool, MSG_LEDS, &led_on, leds.toggle);
|
|
||||||
}
|
|
||||||
ACTION_ITEM(MSG_SET_LEDS_DEFAULT, leds.set_default);
|
ACTION_ITEM(MSG_SET_LEDS_DEFAULT, leds.set_default);
|
||||||
#if ENABLED(LED_COLOR_PRESETS)
|
#if ENABLED(LED_COLOR_PRESETS)
|
||||||
SUBMENU(MSG_LED_PRESETS, menu_led_presets);
|
SUBMENU(MSG_LED_PRESETS, menu_led_presets);
|
||||||
|
@ -144,7 +144,7 @@ void menu_main() {
|
|||||||
|
|
||||||
#endif // !HAS_ENCODER_WHEEL && SDSUPPORT
|
#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);
|
ACTION_ITEM(MSG_RESUME_PRINT, ui.resume_print);
|
||||||
|
|
||||||
SUBMENU(MSG_MOTION, menu_motion);
|
SUBMENU(MSG_MOTION, menu_motion);
|
||||||
@ -176,9 +176,9 @@ void menu_main() {
|
|||||||
|
|
||||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||||
#if E_STEPPERS == 1 && DISABLED(FILAMENT_LOAD_UNLOAD_GCODES)
|
#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"));
|
GCODES_ITEM(MSG_FILAMENTCHANGE, PSTR("M600 B0"));
|
||||||
MENU_ITEM_ELSE
|
else
|
||||||
SUBMENU(MSG_FILAMENTCHANGE, []{ _menu_temp_filament_op(PAUSE_MODE_CHANGE_FILAMENT, 0); });
|
SUBMENU(MSG_FILAMENTCHANGE, []{ _menu_temp_filament_op(PAUSE_MODE_CHANGE_FILAMENT, 0); });
|
||||||
#else
|
#else
|
||||||
SUBMENU(MSG_FILAMENTCHANGE, menu_change_filament);
|
SUBMENU(MSG_FILAMENTCHANGE, menu_change_filament);
|
||||||
@ -197,9 +197,9 @@ void menu_main() {
|
|||||||
// Switch power on/off
|
// Switch power on/off
|
||||||
//
|
//
|
||||||
#if ENABLED(PSU_CONTROL)
|
#if ENABLED(PSU_CONTROL)
|
||||||
MENU_ITEM_IF (powersupply_on)
|
if (powersupply_on)
|
||||||
GCODES_ITEM(MSG_SWITCH_PS_OFF, PSTR("M81"));
|
GCODES_ITEM(MSG_SWITCH_PS_OFF, PSTR("M81"));
|
||||||
MENU_ITEM_ELSE
|
else
|
||||||
GCODES_ITEM(MSG_SWITCH_PS_ON, PSTR("M80"));
|
GCODES_ITEM(MSG_SWITCH_PS_ON, PSTR("M80"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -127,9 +127,9 @@ void menu_media() {
|
|||||||
if (ui.should_draw()) for (uint16_t i = 0; i < fileCnt; i++) {
|
if (ui.should_draw()) for (uint16_t i = 0; i < fileCnt; i++) {
|
||||||
if (_menuLineNr == _thisItemNr) {
|
if (_menuLineNr == _thisItemNr) {
|
||||||
card.getfilename_sorted(SD_ORDER(i, fileCnt));
|
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(sdfolder, MSG_MEDIA_MENU, card);
|
||||||
MENU_ITEM_ELSE
|
else
|
||||||
MENU_ITEM(sdfile, MSG_MEDIA_MENU, card);
|
MENU_ITEM(sdfile, MSG_MEDIA_MENU, card);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -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_10MM, []{ _goto_manual_move(10); });
|
||||||
SUBMENU(MSG_MOVE_1MM, []{ _goto_manual_move( 1); });
|
SUBMENU(MSG_MOVE_1MM, []{ _goto_manual_move( 1); });
|
||||||
SUBMENU(MSG_MOVE_01MM, []{ _goto_manual_move( 0.1f); });
|
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[];
|
extern const char NUL_STR[];
|
||||||
SUBMENU_P(NUL_STR, []{ _goto_manual_move(float(SHORT_MANUAL_Z_MOVE)); });
|
SUBMENU_P(NUL_STR, []{ _goto_manual_move(float(SHORT_MANUAL_Z_MOVE)); });
|
||||||
MENU_ITEM_ADDON_START(0 + ENABLED(HAS_CHARACTER_LCD));
|
MENU_ITEM_ADDON_START(0 + ENABLED(HAS_CHARACTER_LCD));
|
||||||
@ -271,23 +271,23 @@ void menu_move() {
|
|||||||
}
|
}
|
||||||
#elif EXTRUDERS == 3
|
#elif EXTRUDERS == 3
|
||||||
if (active_extruder < 2) {
|
if (active_extruder < 2) {
|
||||||
MENU_ITEM_IF (active_extruder)
|
if (active_extruder)
|
||||||
GCODES_ITEM_N(0, MSG_SELECT_E, PSTR("T0"));
|
GCODES_ITEM_N(0, MSG_SELECT_E, PSTR("T0"));
|
||||||
MENU_ITEM_ELSE
|
else
|
||||||
GCODES_ITEM_N(1, MSG_SELECT_E, PSTR("T1"));
|
GCODES_ITEM_N(1, MSG_SELECT_E, PSTR("T1"));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
MENU_ITEM_IF (active_extruder)
|
if (active_extruder)
|
||||||
GCODES_ITEM_N(0, MSG_SELECT_E, PSTR("T0"));
|
GCODES_ITEM_N(0, MSG_SELECT_E, PSTR("T0"));
|
||||||
MENU_ITEM_ELSE
|
else
|
||||||
GCODES_ITEM_N(1, MSG_SELECT_E, PSTR("T1"));
|
GCODES_ITEM_N(1, MSG_SELECT_E, PSTR("T1"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#elif ENABLED(DUAL_X_CARRIAGE)
|
#elif ENABLED(DUAL_X_CARRIAGE)
|
||||||
|
|
||||||
MENU_ITEM_IF (active_extruder)
|
if (active_extruder)
|
||||||
GCODES_ITEM_N(0, MSG_SELECT_E, PSTR("T0"));
|
GCODES_ITEM_N(0, MSG_SELECT_E, PSTR("T0"));
|
||||||
MENU_ITEM_ELSE
|
else
|
||||||
GCODES_ITEM_N(1, MSG_SELECT_E, PSTR("T1"));
|
GCODES_ITEM_N(1, MSG_SELECT_E, PSTR("T1"));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -335,7 +335,7 @@ void menu_motion() {
|
|||||||
//
|
//
|
||||||
// Move Axis
|
// Move Axis
|
||||||
//
|
//
|
||||||
MENU_ITEM_IF (TERN1(DELTA, all_axes_homed()))
|
if (TERN1(DELTA, all_axes_homed()))
|
||||||
SUBMENU(MSG_MOVE_AXIS, menu_move);
|
SUBMENU(MSG_MOVE_AXIS, menu_move);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -364,7 +364,7 @@ void menu_motion() {
|
|||||||
|
|
||||||
#elif ENABLED(LCD_BED_LEVELING)
|
#elif ENABLED(LCD_BED_LEVELING)
|
||||||
|
|
||||||
MENU_ITEM_IF (!g29_in_progress)
|
if (!g29_in_progress)
|
||||||
SUBMENU(MSG_BED_LEVELING, menu_bed_leveling);
|
SUBMENU(MSG_BED_LEVELING, menu_bed_leveling);
|
||||||
|
|
||||||
#elif HAS_LEVELING && DISABLED(SLIM_LCD_MENUS)
|
#elif HAS_LEVELING && DISABLED(SLIM_LCD_MENUS)
|
||||||
@ -373,16 +373,14 @@ void menu_motion() {
|
|||||||
GCODES_ITEM(MSG_LEVEL_BED, PSTR("G28\nG29"));
|
GCODES_ITEM(MSG_LEVEL_BED, PSTR("G28\nG29"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MENU_ITEM_IF (all_axes_homed() && leveling_is_valid()) {
|
if (all_axes_homed() && leveling_is_valid()) {
|
||||||
bool show_state = planner.leveling_active;
|
bool show_state = planner.leveling_active;
|
||||||
EDIT_ITEM(bool, MSG_BED_LEVELING, &show_state, _lcd_toggle_bed_leveling);
|
EDIT_ITEM(bool, MSG_BED_LEVELING, &show_state, _lcd_toggle_bed_leveling);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||||
MENU_ITEM_IF(1) {
|
editable.decimal = planner.z_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); });
|
||||||
EDIT_ITEM_FAST(float3, MSG_Z_FADE_HEIGHT, &editable.decimal, 0, 100, []{ set_z_fade_height(editable.decimal); });
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -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
|
#endif // HAS_TEMP_HOTEND || HAS_HEATED_BED
|
||||||
|
|
||||||
void menu_temperature() {
|
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();
|
START_MENU();
|
||||||
BACK_ITEM(MSG_MAIN);
|
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
|
#if HAS_FAN1 || HAS_FAN2 || HAS_FAN3 || HAS_FAN4 || HAS_FAN5 || HAS_FAN6 || HAS_FAN7
|
||||||
auto fan_edit_items = [&](const uint8_t f) {
|
auto fan_edit_items = [&](const uint8_t f) {
|
||||||
MENU_ITEM_IF(1) {
|
editable.uint8 = thermalManager.fan_speed[f];
|
||||||
editable.uint8 = thermalManager.fan_speed[f];
|
EDIT_ITEM_FAST_N(percent, f, MSG_FAN_SPEED_N, &editable.uint8, 0, 255, on_fan_update);
|
||||||
EDIT_ITEM_FAST_N(percent, f, MSG_FAN_SPEED_N, &editable.uint8, 0, 255, on_fan_update);
|
|
||||||
}
|
|
||||||
#if ENABLED(EXTRA_FAN_SPEED)
|
#if ENABLED(EXTRA_FAN_SPEED)
|
||||||
EDIT_ITEM_FAST_N(percent, f, MSG_EXTRA_FAN_SPEED_N, &thermalManager.new_fan_speed[f], 3, 255);
|
EDIT_ITEM_FAST_N(percent, f, MSG_EXTRA_FAN_SPEED_N, &thermalManager.new_fan_speed[f], 3, 255);
|
||||||
#endif
|
#endif
|
||||||
@ -211,18 +214,14 @@ void menu_temperature() {
|
|||||||
#define SNFAN(N) (ENABLED(SINGLENOZZLE_STANDBY_FAN) && !HAS_FAN##N && EXTRUDERS > N)
|
#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)
|
#if SNFAN(1) || SNFAN(2) || SNFAN(3) || SNFAN(4) || SNFAN(5) || SNFAN(6) || SNFAN(7)
|
||||||
auto singlenozzle_item = [&](const uint8_t f) {
|
auto singlenozzle_item = [&](const uint8_t f) {
|
||||||
MENU_ITEM_IF(1) {
|
editable.uint8 = singlenozzle_fan_speed[f];
|
||||||
editable.uint8 = singlenozzle_fan_speed[f];
|
EDIT_ITEM_FAST_N(percent, f, MSG_STORED_FAN_N, &editable.uint8, 0, 255, on_fan_update);
|
||||||
EDIT_ITEM_FAST_N(percent, f, MSG_STORED_FAN_N, &editable.uint8, 0, 255, on_fan_update);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_FAN0
|
#if HAS_FAN0
|
||||||
MENU_ITEM_IF(1) {
|
editable.uint8 = thermalManager.fan_speed[0];
|
||||||
editable.uint8 = thermalManager.fan_speed[0];
|
EDIT_ITEM_FAST_N(percent, 0, MSG_FIRST_FAN_SPEED, &editable.uint8, 0, 255, on_fan_update);
|
||||||
EDIT_ITEM_FAST_N(percent, 0, MSG_FIRST_FAN_SPEED, &editable.uint8, 0, 255, on_fan_update);
|
|
||||||
}
|
|
||||||
#if ENABLED(EXTRA_FAN_SPEED)
|
#if ENABLED(EXTRA_FAN_SPEED)
|
||||||
EDIT_ITEM_FAST_N(percent, 0, MSG_FIRST_EXTRA_FAN_SPEED, &thermalManager.new_fan_speed[0], 3, 255);
|
EDIT_ITEM_FAST_N(percent, 0, MSG_FIRST_EXTRA_FAN_SPEED, &thermalManager.new_fan_speed[0], 3, 255);
|
||||||
#endif
|
#endif
|
||||||
@ -281,12 +280,8 @@ void menu_temperature() {
|
|||||||
//
|
//
|
||||||
// Cooldown
|
// Cooldown
|
||||||
//
|
//
|
||||||
MENU_ITEM_IF(1) {
|
if (TERN0(HAS_HEATED_BED, thermalManager.temp_bed.target)) has_heat = true;
|
||||||
bool has_heat = false;
|
if (has_heat) ACTION_ITEM(MSG_COOLDOWN, lcd_cooldown);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // HAS_TEMP_HOTEND
|
#endif // HAS_TEMP_HOTEND
|
||||||
|
|
||||||
|
@ -147,10 +147,8 @@ void menu_tune() {
|
|||||||
|
|
||||||
#if HAS_FAN1 || HAS_FAN2 || HAS_FAN3 || HAS_FAN4 || HAS_FAN5 || HAS_FAN6 || HAS_FAN7
|
#if HAS_FAN1 || HAS_FAN2 || HAS_FAN3 || HAS_FAN4 || HAS_FAN5 || HAS_FAN6 || HAS_FAN7
|
||||||
auto fan_edit_items = [&](const uint8_t f) {
|
auto fan_edit_items = [&](const uint8_t f) {
|
||||||
MENU_ITEM_IF(1) {
|
editable.uint8 = thermalManager.fan_speed[f];
|
||||||
editable.uint8 = thermalManager.fan_speed[f];
|
EDIT_ITEM_FAST_N(percent, f, MSG_FAN_SPEED_N, &editable.uint8, 0, 255, on_fan_update);
|
||||||
EDIT_ITEM_FAST_N(percent, f, MSG_FAN_SPEED_N, &editable.uint8, 0, 255, on_fan_update);
|
|
||||||
}
|
|
||||||
#if ENABLED(EXTRA_FAN_SPEED)
|
#if ENABLED(EXTRA_FAN_SPEED)
|
||||||
EDIT_ITEM_FAST_N(percent, f, MSG_EXTRA_FAN_SPEED_N, &thermalManager.new_fan_speed[f], 3, 255);
|
EDIT_ITEM_FAST_N(percent, f, MSG_EXTRA_FAN_SPEED_N, &thermalManager.new_fan_speed[f], 3, 255);
|
||||||
#endif
|
#endif
|
||||||
@ -160,18 +158,14 @@ void menu_tune() {
|
|||||||
#define SNFAN(N) (ENABLED(SINGLENOZZLE_STANDBY_FAN) && !HAS_FAN##N && EXTRUDERS > N)
|
#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)
|
#if SNFAN(1) || SNFAN(2) || SNFAN(3) || SNFAN(4) || SNFAN(5) || SNFAN(6) || SNFAN(7)
|
||||||
auto singlenozzle_item = [&](const uint8_t f) {
|
auto singlenozzle_item = [&](const uint8_t f) {
|
||||||
MENU_ITEM_IF(1) {
|
editable.uint8 = singlenozzle_fan_speed[f];
|
||||||
editable.uint8 = singlenozzle_fan_speed[f];
|
EDIT_ITEM_FAST_N(percent, f, MSG_STORED_FAN_N, &editable.uint8, 0, 255, on_fan_update);
|
||||||
EDIT_ITEM_FAST_N(percent, f, MSG_STORED_FAN_N, &editable.uint8, 0, 255, on_fan_update);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_FAN0
|
#if HAS_FAN0
|
||||||
MENU_ITEM_IF(1) {
|
editable.uint8 = thermalManager.fan_speed[0];
|
||||||
editable.uint8 = thermalManager.fan_speed[0];
|
EDIT_ITEM_FAST_N(percent, 0, MSG_FIRST_FAN_SPEED, &editable.uint8, 0, 255, on_fan_update);
|
||||||
EDIT_ITEM_FAST_N(percent, 0, MSG_FIRST_FAN_SPEED, &editable.uint8, 0, 255, on_fan_update);
|
|
||||||
}
|
|
||||||
#if ENABLED(EXTRA_FAN_SPEED)
|
#if ENABLED(EXTRA_FAN_SPEED)
|
||||||
EDIT_ITEM_FAST_N(percent, 0, MSG_FIRST_EXTRA_FAN_SPEED, &thermalManager.new_fan_speed[0], 3, 255);
|
EDIT_ITEM_FAST_N(percent, 0, MSG_FIRST_EXTRA_FAN_SPEED, &thermalManager.new_fan_speed[0], 3, 255);
|
||||||
#endif
|
#endif
|
||||||
|
@ -579,9 +579,9 @@ void _lcd_ubl_step_by_step() {
|
|||||||
void _lcd_ubl_level_bed() {
|
void _lcd_ubl_level_bed() {
|
||||||
START_MENU();
|
START_MENU();
|
||||||
BACK_ITEM(MSG_MOTION);
|
BACK_ITEM(MSG_MOTION);
|
||||||
MENU_ITEM_IF (planner.leveling_active)
|
if (planner.leveling_active)
|
||||||
GCODES_ITEM(MSG_UBL_DEACTIVATE_MESH, PSTR("G29 D"));
|
GCODES_ITEM(MSG_UBL_DEACTIVATE_MESH, PSTR("G29 D"));
|
||||||
MENU_ITEM_ELSE
|
else
|
||||||
GCODES_ITEM(MSG_UBL_ACTIVATE_MESH, PSTR("G29 A"));
|
GCODES_ITEM(MSG_UBL_ACTIVATE_MESH, PSTR("G29 A"));
|
||||||
SUBMENU(MSG_UBL_STEP_BY_STEP_MENU, _lcd_ubl_step_by_step);
|
SUBMENU(MSG_UBL_STEP_BY_STEP_MENU, _lcd_ubl_step_by_step);
|
||||||
ACTION_ITEM(MSG_UBL_MESH_EDIT, _lcd_ubl_output_map_lcd_cmd);
|
ACTION_ITEM(MSG_UBL_MESH_EDIT, _lcd_ubl_output_map_lcd_cmd);
|
||||||
|
Loading…
Reference in New Issue
Block a user