Streamline menu item logic (#17664)

This commit is contained in:
Scott Lahteine
2020-04-27 23:52:11 -05:00
committed by GitHub
parent f709c565a1
commit 4f003fc7a7
17 changed files with 303 additions and 251 deletions

View File

@@ -126,6 +126,8 @@ void menu_advanced_settings();
#include "../../module/motion.h" // for active_extruder
void menu_toolchange_migration() {
PGM_P const msg_migrate = GET_TEXT(MSG_TOOL_MIGRATION_SWAP);
START_MENU();
BACK_ITEM(MSG_CONFIGURATION);
@@ -134,7 +136,6 @@ void menu_advanced_settings();
EDIT_ITEM(uint8, MSG_TOOL_MIGRATION_END, &migration.last, 0, EXTRUDERS - 1);
// Migrate to a chosen extruder
PGM_P const msg_migrate = GET_TEXT(MSG_TOOL_MIGRATION_SWAP);
LOOP_L_N(s, EXTRUDERS) {
if (s != active_extruder) {
ACTION_ITEM_N_P(s, msg_migrate, []{
@@ -182,11 +183,12 @@ void menu_advanced_settings();
#if ENABLED(DUAL_X_CARRIAGE)
void menu_idex() {
const bool need_g28 = !(TEST(axis_known_position, Y_AXIS) && TEST(axis_known_position, Z_AXIS));
START_MENU();
BACK_ITEM(MSG_CONFIGURATION);
GCODES_ITEM(MSG_IDEX_MODE_AUTOPARK, PSTR("M605 S1\nG28 X\nG1 X100"));
const bool need_g28 = !(TEST(axis_known_position, Y_AXIS) && TEST(axis_known_position, Z_AXIS));
GCODES_ITEM(MSG_IDEX_MODE_DUPLICATE, need_g28
? PSTR("M605 S1\nT0\nG28\nM605 S2 X200\nG28 X\nG1 X100") // If Y or Z is not homed, do a full G28 first
: PSTR("M605 S1\nT0\nM605 S2 X200\nG28 X\nG1 X100")
@@ -237,9 +239,10 @@ void menu_advanced_settings();
#endif
#if ENABLED(TOUCH_MI_PROBE)
void menu_touchmi() {
START_MENU();
ui.defer_status_screen();
START_MENU();
BACK_ITEM(MSG_CONFIGURATION);
GCODES_ITEM(MSG_TOUCHMI_INIT, PSTR("M851 Z0\nG28\nG1 F200 Z0"));
SUBMENU(MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset);
@@ -247,6 +250,7 @@ void menu_advanced_settings();
GCODES_ITEM(MSG_TOUCHMI_ZTEST, PSTR("G28\nG1 F200 Z0"));
END_MENU();
}
#endif
#if ENABLED(CONTROLLER_FAN_MENU)
@@ -342,6 +346,8 @@ void menu_advanced_settings();
#endif
void menu_configuration() {
const bool busy = printer_busy();
START_MENU();
BACK_ITEM(MSG_MAIN);
@@ -367,7 +373,6 @@ void menu_configuration() {
SUBMENU(MSG_CONTROLLER_FAN, menu_controller_fan);
#endif
const bool busy = printer_busy();
if (!busy) {
#if EITHER(DELTA_CALIBRATION_MENU, DELTA_AUTO_CALIBRATION)
SUBMENU(MSG_DELTA_CALIBRATE, menu_delta_calibrate);
@@ -435,8 +440,7 @@ void menu_configuration() {
#if ENABLED(EEPROM_SETTINGS)
ACTION_ITEM(MSG_STORE_EEPROM, lcd_store_settings);
if (!busy)
ACTION_ITEM(MSG_LOAD_EEPROM, lcd_load_settings);
if (!busy) ACTION_ITEM(MSG_LOAD_EEPROM, lcd_load_settings);
#endif
if (!busy)