From d9125c54aee987878e14b70b2a8282424f90c284 Mon Sep 17 00:00:00 2001 From: vovodroid Date: Tue, 21 Nov 2023 18:11:57 +0200 Subject: [PATCH 1/6] Limit speed and flow menu ranges. --- Marlin/Configuration.h | 7 +++++++ Marlin/src/lcd/tft/touch.cpp | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 6374760db54a..e6367da249d8 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -3397,6 +3397,13 @@ #if ENABLED(TFT_COLOR_UI) //#define SINGLE_TOUCH_NAVIGATION #endif + + //Range for speed and flow adjustment sliders (expressed in percents) + #define TOUCH_SPEED_TUNE_MIN 10 + #define TOUCH_SPEED_TUNE_MAX 999 + + #define TOUCH_FLOW_TUNE_MIN 10 + #define TOUCH_FLOW_TUNE_MAX 999 #endif // diff --git a/Marlin/src/lcd/tft/touch.cpp b/Marlin/src/lcd/tft/touch.cpp index 4d5056183bb9..310c23cc84ce 100644 --- a/Marlin/src/lcd/tft/touch.cpp +++ b/Marlin/src/lcd/tft/touch.cpp @@ -220,7 +220,7 @@ void Touch::touch(touch_control_t *control) { break; case FEEDRATE: ui.clear_lcd(); - MenuItem_int3::action(GET_TEXT_F(MSG_SPEED), &feedrate_percentage, 10, 999); + MenuItem_int3::action(GET_TEXT_F(MSG_SPEED), &feedrate_percentage, TOUCH_SPEED_TUNE_MIN, TOUCH_SPEED_TUNE_MAX); break; #if HAS_EXTRUDERS @@ -228,9 +228,9 @@ void Touch::touch(touch_control_t *control) { ui.clear_lcd(); MenuItemBase::itemIndex = control->data; #if EXTRUDERS == 1 - MenuItem_int3::action(GET_TEXT_F(MSG_FLOW), &planner.flow_percentage[MenuItemBase::itemIndex], 10, 999, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); }); + MenuItem_int3::action(GET_TEXT_F(MSG_FLOW), &planner.flow_percentage[MenuItemBase::itemIndex], TOUCH_FLOW_TUNE_MIN, TOUCH_FLOW_TUNE_MAX, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); }); #else - MenuItem_int3::action(GET_TEXT_F(MSG_FLOW_N), &planner.flow_percentage[MenuItemBase::itemIndex], 10, 999, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); }); + MenuItem_int3::action(GET_TEXT_F(MSG_FLOW_N), &planner.flow_percentage[MenuItemBase::itemIndex], TOUCH_FLOW_TUNE_MIN, TOUCH_FLOW_TUNE_MAX, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); }); #endif break; #endif From b45a1ae05bda9704b6f07836d0808523ce162fe5 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 22 Nov 2023 23:15:01 -0600 Subject: [PATCH 2/6] apply to more things --- Marlin/Configuration.h | 7 ------- Marlin/Configuration_adv.h | 11 ++++++++++- Marlin/src/lcd/e3v2/creality/dwin.cpp | 6 +----- Marlin/src/lcd/e3v2/proui/dwin.cpp | 24 +++++++++++------------- Marlin/src/lcd/extui/malyan/malyan.cpp | 2 +- Marlin/src/lcd/marlinui.cpp | 2 +- Marlin/src/lcd/menu/menu_item.h | 6 +++--- Marlin/src/lcd/menu/menu_tune.cpp | 6 +++--- Marlin/src/lcd/tft/touch.cpp | 6 +++--- 9 files changed, 33 insertions(+), 37 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index e6367da249d8..6374760db54a 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -3397,13 +3397,6 @@ #if ENABLED(TFT_COLOR_UI) //#define SINGLE_TOUCH_NAVIGATION #endif - - //Range for speed and flow adjustment sliders (expressed in percents) - #define TOUCH_SPEED_TUNE_MIN 10 - #define TOUCH_SPEED_TUNE_MAX 999 - - #define TOUCH_FLOW_TUNE_MIN 10 - #define TOUCH_FLOW_TUNE_MAX 999 #endif // diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 275bcaa66926..ae3ac1945621 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1254,7 +1254,7 @@ */ //#define XY_FREQUENCY_LIMIT 10 // (Hz) Maximum frequency of small zigzag infill moves. Set with M201 F. #ifdef XY_FREQUENCY_LIMIT - #define XY_FREQUENCY_MIN_PERCENT 5 // (percent) Minimum FR percentage to apply. Set with M201 G. + #define XY_FREQUENCY_MIN_PERCENT 5 // (%) Minimum FR percentage to apply. Set with M201 G. #endif // @@ -1625,6 +1625,15 @@ #endif // HAS_DISPLAY +#if ANY(HAS_MARLINUI_MENU, DWIN_CREALITY_LCD, DWIN_LCD_PROUI, MALYAN_LCD, TOUCH_SCREEN) + #define SPEED_EDIT_MIN 10 // (%) Feedrate percentage edit range minimum + #define SPEED_EDIT_MAX 999 // (%) Feedrate percentage edit range minimum + #if HAS_EXTRUDERS + #define FLOW_EDIT_MIN 10 // (%) Flow percentage edit range minimum + #define FLOW_EDIT_MAX 999 // (%) Flow percentage edit range minimum + #endif +#endif + // Add 'M73' to set print job progress, overrides Marlin's built-in estimate //#define SET_PROGRESS_MANUALLY #if ENABLED(SET_PROGRESS_MANUALLY) diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index c71ab8cff280..f3935f39dd5e 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp @@ -97,10 +97,6 @@ #define MENU_CHAR_LIMIT 24 #define STATUS_Y 354 -// Print speed limit -#define MIN_PRINT_SPEED 10 -#define MAX_PRINT_SPEED 999 - #define FEEDRATE_E (60) // Minimum unit (0.1) : multiple (10) @@ -1559,7 +1555,7 @@ void hmiPrintSpeed() { return; } // printSpeed limit - LIMIT(hmiValues.printSpeed, MIN_PRINT_SPEED, MAX_PRINT_SPEED); + LIMIT(hmiValues.printSpeed, SPEED_EDIT_MIN, SPEED_EDIT_MAX); // printSpeed value drawEditInteger3(select_tune.now + MROWS - index_tune, hmiValues.printSpeed, true); } diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 843009c27461..820fc11558bc 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -135,16 +135,14 @@ #define PAUSE_HEAT -// Print speed limit -#define MIN_PRINT_SPEED 10 -#define MAX_PRINT_SPEED 999 - -// Print flow limit -#define MIN_PRINT_FLOW 10 -#define MAX_PRINT_FLOW 299 - // Load and Unload limits -#define MAX_LOAD_UNLOAD 500 +#ifndef EXTRUDE_MAXLENGTH + #ifdef FILAMENT_CHANGE_UNLOAD_LENGTH + #define EXTRUDE_MAXLENGTH (FILAMENT_CHANGE_UNLOAD_LENGTH + 10) + #else + #define EXTRUDE_MAXLENGTH 500 + #endif +#endif // Juntion deviation limits #define MIN_JD_MM 0.001 @@ -2243,8 +2241,8 @@ void setMoveZ() { hmiValue.axis = Z_AXIS; setPFloatOnClick(Z_MIN_POS, Z_MAX_POS, #endif #if ENABLED(ADVANCED_PAUSE_FEATURE) - void setFilLoad() { setPFloatOnClick(0, MAX_LOAD_UNLOAD, UNITFDIGITS); } - void setFilUnload() { setPFloatOnClick(0, MAX_LOAD_UNLOAD, UNITFDIGITS); } + void setFilLoad() { setPFloatOnClick(0, EXTRUDE_MAXLENGTH, UNITFDIGITS); } + void setFilUnload() { setPFloatOnClick(0, EXTRUDE_MAXLENGTH, UNITFDIGITS); } #endif #if ENABLED(PREVENT_COLD_EXTRUSION) @@ -2252,7 +2250,7 @@ void setMoveZ() { hmiValue.axis = Z_AXIS; setPFloatOnClick(Z_MIN_POS, Z_MAX_POS, void setExtMinT() { setPIntOnClick(MIN_ETEMP, MAX_ETEMP, applyExtMinT); } #endif -void setSpeed() { setPIntOnClick(MIN_PRINT_SPEED, MAX_PRINT_SPEED); } +void setSpeed() { setPIntOnClick(SPEED_EDIT_MIN, SPEED_EDIT_MAX); } #if HAS_HOTEND void applyHotendTemp() { thermalManager.setTargetHotend(menuData.value, 0); } @@ -2297,7 +2295,7 @@ void setSpeed() { setPIntOnClick(MIN_PRINT_SPEED, MAX_PRINT_SPEED); } #endif // ADVANCED_PAUSE_FEATURE -void setFlow() { setPIntOnClick(MIN_PRINT_FLOW, MAX_PRINT_FLOW, []{ planner.refresh_e_factor(0); }); } +void setFlow() { setPIntOnClick(FLOW_EDIT_MIN, FLOW_EDIT_MAX, []{ planner.refresh_e_factor(0); }); } // Bed Tramming diff --git a/Marlin/src/lcd/extui/malyan/malyan.cpp b/Marlin/src/lcd/extui/malyan/malyan.cpp index d1c2387682ff..c2e6bcdb7dd1 100644 --- a/Marlin/src/lcd/extui/malyan/malyan.cpp +++ b/Marlin/src/lcd/extui/malyan/malyan.cpp @@ -130,7 +130,7 @@ void process_lcd_c_command(const char *command) { case 'C': // Cope with both V1 early rev and later LCDs. case 'S': feedrate_percentage = target_val * 10; - LIMIT(feedrate_percentage, 10, 999); + LIMIT(feedrate_percentage, SPEED_EDIT_MIN, SPEED_EDIT_MAX); break; case 'T': diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 49b9fecad8ae..4dbc87a13f86 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -695,7 +695,7 @@ void MarlinUI::init() { else if ((old_frm < 100 && new_frm > 100) || (old_frm > 100 && new_frm < 100)) new_frm = 100; - LIMIT(new_frm, 10, 999); + LIMIT(new_frm, FLOW_EDIT_MIN, FLOW_EDIT_MAX); if (old_frm != new_frm) { feedrate_percentage = new_frm; diff --git a/Marlin/src/lcd/menu/menu_item.h b/Marlin/src/lcd/menu/menu_item.h index ea26b48907a2..4d3e33db4c5a 100644 --- a/Marlin/src/lcd/menu/menu_item.h +++ b/Marlin/src/lcd/menu/menu_item.h @@ -264,9 +264,9 @@ class MenuItem_bool : public MenuEditItemBase { * MenuItem_function::action(flabel, lcd_sdcard_pause) * MenuItem_function::draw(sel, row, flabel, lcd_sdcard_pause) * - * EDIT_ITEM(int3, MSG_SPEED, &feedrate_percentage, 10, 999) - * MenuItem_int3::action(flabel, &feedrate_percentage, 10, 999) - * MenuItem_int3::draw(sel, row, flabel, &feedrate_percentage, 10, 999) + * EDIT_ITEM(int3, MSG_SPEED, &feedrate_percentage, SPEED_EDIT_MIN, SPEED_EDIT_MAX) + * MenuItem_int3::action(flabel, &feedrate_percentage, SPEED_EDIT_MIN, SPEED_EDIT_MAX) + * MenuItem_int3::draw(sel, row, flabel, &feedrate_percentage, SPEED_EDIT_MIN, SPEED_EDIT_MAX) */ #if ENABLED(ENCODER_RATE_MULTIPLIER) diff --git a/Marlin/src/lcd/menu/menu_tune.cpp b/Marlin/src/lcd/menu/menu_tune.cpp index c36ac013b86f..ecd4e5f342fc 100644 --- a/Marlin/src/lcd/menu/menu_tune.cpp +++ b/Marlin/src/lcd/menu/menu_tune.cpp @@ -114,7 +114,7 @@ void menu_tune() { // // Speed: // - EDIT_ITEM(int3, MSG_SPEED, &feedrate_percentage, 10, 999); + EDIT_ITEM(int3, MSG_SPEED, &feedrate_percentage, SPEED_EDIT_MIN, SPEED_EDIT_MAX); // // Manual bed leveling, Bed Z: @@ -198,11 +198,11 @@ void menu_tune() { // Flow: // #if HAS_EXTRUDERS - EDIT_ITEM(int3, MSG_FLOW, &planner.flow_percentage[active_extruder], 10, 999, []{ planner.refresh_e_factor(active_extruder); }); + EDIT_ITEM(int3, MSG_FLOW, &planner.flow_percentage[active_extruder], FLOW_EDIT_MIN, FLOW_EDIT_MAX, []{ planner.refresh_e_factor(active_extruder); }); // Flow En: #if HAS_MULTI_EXTRUDER EXTRUDER_LOOP() - EDIT_ITEM_N(int3, e, MSG_FLOW_N, &planner.flow_percentage[e], 10, 999, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); }); + EDIT_ITEM_N(int3, e, MSG_FLOW_N, &planner.flow_percentage[e], FLOW_EDIT_MIN, FLOW_EDIT_MAX, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); }); #endif #endif diff --git a/Marlin/src/lcd/tft/touch.cpp b/Marlin/src/lcd/tft/touch.cpp index 310c23cc84ce..8e79e397adea 100644 --- a/Marlin/src/lcd/tft/touch.cpp +++ b/Marlin/src/lcd/tft/touch.cpp @@ -220,7 +220,7 @@ void Touch::touch(touch_control_t *control) { break; case FEEDRATE: ui.clear_lcd(); - MenuItem_int3::action(GET_TEXT_F(MSG_SPEED), &feedrate_percentage, TOUCH_SPEED_TUNE_MIN, TOUCH_SPEED_TUNE_MAX); + MenuItem_int3::action(GET_TEXT_F(MSG_SPEED), &feedrate_percentage, SPEED_EDIT_MIN, SPEED_EDIT_MAX); break; #if HAS_EXTRUDERS @@ -228,9 +228,9 @@ void Touch::touch(touch_control_t *control) { ui.clear_lcd(); MenuItemBase::itemIndex = control->data; #if EXTRUDERS == 1 - MenuItem_int3::action(GET_TEXT_F(MSG_FLOW), &planner.flow_percentage[MenuItemBase::itemIndex], TOUCH_FLOW_TUNE_MIN, TOUCH_FLOW_TUNE_MAX, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); }); + MenuItem_int3::action(GET_TEXT_F(MSG_FLOW), &planner.flow_percentage[MenuItemBase::itemIndex], FLOW_EDIT_MIN, FLOW_EDIT_MAX, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); }); #else - MenuItem_int3::action(GET_TEXT_F(MSG_FLOW_N), &planner.flow_percentage[MenuItemBase::itemIndex], TOUCH_FLOW_TUNE_MIN, TOUCH_FLOW_TUNE_MAX, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); }); + MenuItem_int3::action(GET_TEXT_F(MSG_FLOW_N), &planner.flow_percentage[MenuItemBase::itemIndex], FLOW_EDIT_MIN, FLOW_EDIT_MAX, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); }); #endif break; #endif From 28a001502db498c6bc25eee5a170826c7d0e4897 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 24 Nov 2023 11:09:40 -0600 Subject: [PATCH 3/6] status screen flow --- Marlin/Configuration_adv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index ae3ac1945621..4bb6d00a6f2d 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1625,7 +1625,7 @@ #endif // HAS_DISPLAY -#if ANY(HAS_MARLINUI_MENU, DWIN_CREALITY_LCD, DWIN_LCD_PROUI, MALYAN_LCD, TOUCH_SCREEN) +#if ANY(HAS_MARLINUI_MENU, ULTIPANEL_FEEDMULTIPLY, DWIN_CREALITY_LCD, DWIN_LCD_PROUI, MALYAN_LCD, TOUCH_SCREEN) #define SPEED_EDIT_MIN 10 // (%) Feedrate percentage edit range minimum #define SPEED_EDIT_MAX 999 // (%) Feedrate percentage edit range minimum #if HAS_EXTRUDERS From 0efb229a29a0f03d1b474c3ca4849eb072f5a7e6 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 24 Nov 2023 11:21:36 -0600 Subject: [PATCH 4/6] conditional flags --- Marlin/Configuration_adv.h | 12 +- Marlin/src/inc/Conditionals_LCD.h | 1815 +++++++++++++++-------------- 2 files changed, 920 insertions(+), 907 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 4bb6d00a6f2d..b72f7d8da11b 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1625,13 +1625,13 @@ #endif // HAS_DISPLAY -#if ANY(HAS_MARLINUI_MENU, ULTIPANEL_FEEDMULTIPLY, DWIN_CREALITY_LCD, DWIN_LCD_PROUI, MALYAN_LCD, TOUCH_SCREEN) +#if HAS_FEEDRATE_EDIT #define SPEED_EDIT_MIN 10 // (%) Feedrate percentage edit range minimum - #define SPEED_EDIT_MAX 999 // (%) Feedrate percentage edit range minimum - #if HAS_EXTRUDERS - #define FLOW_EDIT_MIN 10 // (%) Flow percentage edit range minimum - #define FLOW_EDIT_MAX 999 // (%) Flow percentage edit range minimum - #endif + #define SPEED_EDIT_MAX 999 // (%) Feedrate percentage edit range maximum +#endif +#if HAS_FLOW_EDIT + #define FLOW_EDIT_MIN 10 // (%) Flow percentage edit range minimum + #define FLOW_EDIT_MAX 999 // (%) Flow percentage edit range maximum #endif // Add 'M73' to set print job progress, overrides Marlin's built-in estimate diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index a252edfb4a56..b797c6ad3538 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -26,179 +26,684 @@ * Conditionals that need to be set before Configuration_adv.h or pins.h */ -#if ENABLED(SDSUPPORT) - #define HAS_MEDIA 1 -#endif - -// MKS_LCD12864A/B is a variant of MKS_MINI_12864 -#if ANY(MKS_LCD12864A, MKS_LCD12864B) - #define MKS_MINI_12864 -#endif - -// MKS_MINI_12864_V3 and BTT_MINI_12864 have identical pinouts to FYSETC_MINI_12864_2_1 -#if ANY(MKS_MINI_12864_V3, BTT_MINI_12864) - #define FYSETC_MINI_12864_2_1 -#endif - -// Old settings are now conditional on DGUS_LCD_UI -#if DGUS_UI_IS(ORIGIN) - #define DGUS_LCD_UI_ORIGIN 1 -#elif DGUS_UI_IS(FYSETC) - #define DGUS_LCD_UI_FYSETC 1 -#elif DGUS_UI_IS(HIPRECY) - #define DGUS_LCD_UI_HIPRECY 1 -#elif DGUS_UI_IS(MKS) - #define DGUS_LCD_UI_MKS 1 -#elif DGUS_UI_IS(RELOADED) - #define DGUS_LCD_UI_RELOADED 1 -#elif DGUS_UI_IS(IA_CREALITY) - #define DGUS_LCD_UI_IA_CREALITY 1 -#elif DGUS_UI_IS(E3S1PRO) - #define DGUS_LCD_UI_E3S1PRO 1 -#endif - /** - * General Flags that may be set below by specific LCDs + * Extruders have some combination of stepper motors and hotends + * so we separate these concepts into the defines: * - * DOGLCD : Run a Graphical LCD through U8GLib (with MarlinUI) - * IS_ULTIPANEL : Define LCD_PINS_D5/6/7 for direct-connected "Ultipanel" LCDs - * HAS_WIRED_LCD : Ultra LCD, not necessarily Ultipanel. - * IS_RRD_SC : Common RRD Smart Controller digital interface pins - * IS_RRD_FG_SC : Common RRD Full Graphical Smart Controller digital interface pins - * IS_U8GLIB_ST7920 : Most common DOGM display SPI interface, supporting a "lightweight" display mode. - * U8GLIB_SH1106 : SH1106 OLED with I2C interface via U8GLib - * IS_U8GLIB_SSD1306 : SSD1306 OLED with I2C interface via U8GLib (U8GLIB_SSD1306) - * U8GLIB_SSD1309 : SSD1309 OLED with I2C interface via U8GLib (HAS_U8GLIB_I2C_OLED, HAS_WIRED_LCD, DOGLCD) - * IS_U8GLIB_ST7565_64128N : ST7565 128x64 LCD with SPI interface via U8GLib - * IS_U8GLIB_LM6059_AF : LM6059 with Hardware SPI via U8GLib + * EXTRUDERS - Number of Selectable Tools + * HOTENDS - Number of hotends, whether connected or separate + * E_STEPPERS - Number of actual E stepper motors + * E_MANUAL - Number of E steppers for LCD move options + * + * These defines must be simple constants for use in REPEAT, etc. */ -#if ANY(MKS_MINI_12864, ENDER2_STOCKDISPLAY) - - #define MINIPANEL - -#elif ENABLED(YHCB2004) - - #define IS_ULTIPANEL 1 - -#elif ENABLED(CARTESIO_UI) - - #define DOGLCD - #define IS_ULTIPANEL 1 - -#elif ANY(DWIN_MARLINUI_PORTRAIT, DWIN_MARLINUI_LANDSCAPE) - - #define IS_DWIN_MARLINUI 1 - #define IS_ULTIPANEL 1 - -#elif ENABLED(ZONESTAR_LCD) - - #define HAS_ADC_BUTTONS 1 - #define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 - #define ADC_KEY_NUM 8 - #define IS_ULTIPANEL 1 - - // This helps to implement HAS_ADC_BUTTONS menus - #define REVERSE_MENU_DIRECTION - #define STD_ENCODER_PULSES_PER_STEP 1 - #define STD_ENCODER_STEPS_PER_MENU_ITEM 1 - #define ENCODER_FEEDRATE_DEADZONE 2 - -#elif ENABLED(ZONESTAR_12864LCD) - #define DOGLCD - #define IS_RRD_SC 1 - #define IS_U8GLIB_ST7920 1 +#if EXTRUDERS + #define HAS_EXTRUDERS 1 + #if EXTRUDERS > 1 + #define HAS_MULTI_EXTRUDER 1 + #endif + #define E_AXIS_N(E) AxisEnum(E_AXIS + E_INDEX_N(E)) +#else + #undef EXTRUDERS + #define EXTRUDERS 0 + #undef TEMP_SENSOR_0 + #undef TEMP_SENSOR_1 + #undef TEMP_SENSOR_2 + #undef TEMP_SENSOR_3 + #undef TEMP_SENSOR_4 + #undef TEMP_SENSOR_5 + #undef TEMP_SENSOR_6 + #undef TEMP_SENSOR_7 + #undef SINGLENOZZLE + #undef SWITCHING_EXTRUDER + #undef MECHANICAL_SWITCHING_EXTRUDER + #undef SWITCHING_NOZZLE + #undef MECHANICAL_SWITCHING_NOZZLE + #undef MIXING_EXTRUDER + #undef HOTEND_IDLE_TIMEOUT + #undef DISABLE_E + #undef PREVENT_LENGTHY_EXTRUDE + #undef FILAMENT_RUNOUT_SENSOR + #undef FILAMENT_RUNOUT_DISTANCE_MM + #undef DISABLE_OTHER_EXTRUDERS +#endif -#elif ENABLED(ZONESTAR_12864OLED) - #define IS_RRD_SC 1 - #define U8GLIB_SH1106 +#define E_OPTARG(N) OPTARG(HAS_MULTI_EXTRUDER, N) +#define E_TERN_(N) TERN_(HAS_MULTI_EXTRUDER, N) +#define E_TERN0(N) TERN0(HAS_MULTI_EXTRUDER, N) -#elif ENABLED(ZONESTAR_12864OLED_SSD1306) - #define IS_RRD_SC 1 - #define IS_U8GLIB_SSD1306 +#if ANY(SWITCHING_EXTRUDER, MECHANICAL_SWITCHING_EXTRUDER) + #define HAS_SWITCHING_EXTRUDER 1 +#endif +#if ANY(SWITCHING_NOZZLE, MECHANICAL_SWITCHING_NOZZLE) + #define HAS_SWITCHING_NOZZLE 1 +#endif -#elif ENABLED(RADDS_DISPLAY) - #define IS_ULTIPANEL 1 - #define STD_ENCODER_PULSES_PER_STEP 2 +#if ENABLED(E_DUAL_STEPPER_DRIVERS) // E0/E1 steppers act in tandem as E0 -#elif ANY(miniVIKI, VIKI2, WYH_L12864, ELB_FULL_GRAPHIC_CONTROLLER, AZSMZ_12864, EMOTION_TECH_LCD) + #define E_STEPPERS 2 + #define E_MANUAL 1 - #define DOGLCD - #define IS_DOGM_12864 1 - #define IS_ULTIPANEL 1 +#elif HAS_SWITCHING_EXTRUDER // One stepper for every two EXTRUDERS - #if ENABLED(miniVIKI) - #define IS_U8GLIB_ST7565_64128N 1 - #elif ENABLED(VIKI2) - #define IS_U8GLIB_ST7565_64128N 1 - #elif ENABLED(WYH_L12864) - #define IS_U8GLIB_ST7565_64128N 1 - #define ST7565_XOFFSET 0x04 - #elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) - #define IS_U8GLIB_LM6059_AF 1 - #elif ENABLED(AZSMZ_12864) - #define IS_U8GLIB_ST7565_64128N 1 - #elif ENABLED(EMOTION_TECH_LCD) - #define IS_U8GLIB_ST7565_64128N 1 - #define ST7565_VOLTAGE_DIVIDER_VALUE 0x07 + #if EXTRUDERS > 4 + #define E_STEPPERS 3 + #elif EXTRUDERS > 2 + #define E_STEPPERS 2 + #else + #define E_STEPPERS 1 #endif -#elif ENABLED(OLED_PANEL_TINYBOY2) - - #define IS_U8GLIB_SSD1306 - #define IS_ULTIPANEL 1 +#elif ENABLED(MIXING_EXTRUDER) // Multiple feeds are mixed proportionally -#elif ENABLED(RA_CONTROL_PANEL) + #define E_STEPPERS MIXING_STEPPERS + #define E_MANUAL 1 + #if MIXING_STEPPERS == 2 + #define HAS_DUAL_MIXING 1 + #endif - #define LCD_I2C_TYPE_PCA8574 - #define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander - #define IS_ULTIPANEL 1 +#elif ENABLED(SWITCHING_TOOLHEAD) // Toolchanger -#elif ENABLED(REPRAPWORLD_GRAPHICAL_LCD) + #define E_STEPPERS EXTRUDERS + #define E_MANUAL EXTRUDERS - #define DOGLCD - #define IS_U8GLIB_ST7920 1 - #define IS_ULTIPANEL 1 - #define ENCODER_PULSES_PER_STEP 2 +#elif HAS_PRUSA_MMU2 // Průša Multi-Material Unit v2 -#elif ENABLED(MKS_12864OLED) + #define E_STEPPERS 1 + #define E_MANUAL 1 - #define IS_RRD_SC 1 - #define U8GLIB_SH1106 +#endif -#elif ENABLED(MKS_12864OLED_SSD1306) +// Průša MMU1, MMU(S) 2.0 and EXTENDABLE_EMU_MMU2(S) force SINGLENOZZLE +#if HAS_MMU + #define SINGLENOZZLE +#endif - #define IS_RRD_SC 1 - #define IS_U8GLIB_SSD1306 +// Default E steppers / manual motion is one per extruder +#ifndef E_STEPPERS + #define E_STEPPERS EXTRUDERS +#endif +#ifndef E_MANUAL + #define E_MANUAL EXTRUDERS +#endif -#elif ENABLED(SAV_3DGLCD) +// Number of hotends... +#if ANY(SINGLENOZZLE, MIXING_EXTRUDER) // Only one for singlenozzle or mixing extruder + #define HOTENDS 1 +#elif HAS_SWITCHING_EXTRUDER && !HAS_SWITCHING_NOZZLE // One for each pair of abstract "extruders" + #define HOTENDS E_STEPPERS +#elif TEMP_SENSOR_0 + #define HOTENDS EXTRUDERS // One per extruder if at least one heater exists +#else + #define HOTENDS 0 // A machine with no hotends at all can still extrude +#endif - #ifdef U8GLIB_SSD1306 - #define IS_U8GLIB_SSD1306 // Allow for U8GLIB_SSD1306 + SAV_3DGLCD +// More than one hotend... +#if HOTENDS > 1 + #define HAS_MULTI_HOTEND 1 + #define HAS_HOTEND_OFFSET 1 + #ifndef HOTEND_OFFSET_X + #define HOTEND_OFFSET_X { 0 } // X offsets for each extruder #endif - #define IS_NEWPANEL 1 - -#elif ENABLED(FYSETC_242_OLED_12864) - - #define IS_RRD_SC 1 - #define U8GLIB_SH1106 - - #ifndef NEOPIXEL_BRIGHTNESS - #define NEOPIXEL_BRIGHTNESS 127 + #ifndef HOTEND_OFFSET_Y + #define HOTEND_OFFSET_Y { 0 } // Y offsets for each extruder #endif - -#elif ANY(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1, FYSETC_GENERIC_12864_1_1) - - #define FYSETC_MINI_12864 - #define DOGLCD - #define IS_ULTIPANEL 1 - #define LED_COLORS_REDUCE_GREEN - - // Require LED backlighting enabled - #if ENABLED(FYSETC_MINI_12864_2_1) - #ifndef NEOPIXEL_BRIGHTNESS - #define NEOPIXEL_BRIGHTNESS 127 - #endif - //#define NEOPIXEL_STARTUP_TEST + #ifndef HOTEND_OFFSET_Z + #define HOTEND_OFFSET_Z { 0 } // Z offsets for each extruder + #endif +#else + #undef HOTEND_OFFSET_X + #undef HOTEND_OFFSET_Y + #undef HOTEND_OFFSET_Z +#endif + +// At least one hotend... +#if HOTENDS + #define HAS_HOTEND 1 + #ifndef HOTEND_OVERSHOOT + #define HOTEND_OVERSHOOT 15 + #endif +#endif + +// Clean up E-stepper-based settings... +#if E_STEPPERS <= 7 + #undef INVERT_E7_DIR + #undef E7_DRIVER_TYPE + #if E_STEPPERS <= 6 + #undef INVERT_E6_DIR + #undef E6_DRIVER_TYPE + #if E_STEPPERS <= 5 + #undef INVERT_E5_DIR + #undef E5_DRIVER_TYPE + #if E_STEPPERS <= 4 + #undef INVERT_E4_DIR + #undef E4_DRIVER_TYPE + #if E_STEPPERS <= 3 + #undef INVERT_E3_DIR + #undef E3_DRIVER_TYPE + #if E_STEPPERS <= 2 + #undef INVERT_E2_DIR + #undef E2_DRIVER_TYPE + #if E_STEPPERS <= 1 + #undef INVERT_E1_DIR + #undef E1_DRIVER_TYPE + #if E_STEPPERS == 0 + #undef INVERT_E0_DIR + #undef E0_DRIVER_TYPE + #endif + #endif + #endif + #endif + #endif + #endif + #endif +#endif + +/** + * Number of Linear Axes (e.g., XYZIJKUVW) + * All the logical axes except for the tool (E) axis + */ +#ifdef NUM_AXES + #undef NUM_AXES + #define NUM_AXES_WARNING 1 +#endif + +#ifdef W_DRIVER_TYPE + #define NUM_AXES 9 +#elif defined(V_DRIVER_TYPE) + #define NUM_AXES 8 +#elif defined(U_DRIVER_TYPE) + #define NUM_AXES 7 +#elif defined(K_DRIVER_TYPE) + #define NUM_AXES 6 +#elif defined(J_DRIVER_TYPE) + #define NUM_AXES 5 +#elif defined(I_DRIVER_TYPE) + #define NUM_AXES 4 +#elif defined(Z_DRIVER_TYPE) + #define NUM_AXES 3 +#elif defined(Y_DRIVER_TYPE) + #define NUM_AXES 2 +#elif defined(X_DRIVER_TYPE) + #define NUM_AXES 1 +#else + #define NUM_AXES 0 +#endif +#if NUM_AXES >= 1 + #define HAS_X_AXIS 1 + #if NUM_AXES >= XY + #define HAS_Y_AXIS 1 + #if NUM_AXES >= XYZ + #define HAS_Z_AXIS 1 + #if NUM_AXES >= 4 + #define HAS_I_AXIS 1 + #if NUM_AXES >= 5 + #define HAS_J_AXIS 1 + #if NUM_AXES >= 6 + #define HAS_K_AXIS 1 + #if NUM_AXES >= 7 + #define HAS_U_AXIS 1 + #if NUM_AXES >= 8 + #define HAS_V_AXIS 1 + #if NUM_AXES >= 9 + #define HAS_W_AXIS 1 + #endif + #endif + #endif + #endif + #endif + #endif + #endif + #endif +#endif + +#if !HAS_X_AXIS + #undef AVOID_OBSTACLES + #undef ENDSTOPPULLUP_XMIN + #undef ENDSTOPPULLUP_XMAX + #undef X_MIN_ENDSTOP_HIT_STATE + #undef X_MAX_ENDSTOP_HIT_STATE + #undef X2_DRIVER_TYPE + #undef X_ENABLE_ON + #undef DISABLE_X + #undef INVERT_X_DIR + #undef X_HOME_DIR + #undef X_MIN_POS + #undef X_MAX_POS + #undef MANUAL_X_HOME_POS + #undef MIN_SOFTWARE_ENDSTOPS + #undef MAX_SOFTWARE_ENDSTOPS +#endif + +#if !HAS_Y_AXIS + #undef AVOID_OBSTACLES + #undef ENDSTOPPULLUP_YMIN + #undef ENDSTOPPULLUP_YMAX + #undef Y_MIN_ENDSTOP_HIT_STATE + #undef Y_MAX_ENDSTOP_HIT_STATE + #undef Y2_DRIVER_TYPE + #undef Y_ENABLE_ON + #undef DISABLE_Y + #undef INVERT_Y_DIR + #undef Y_HOME_DIR + #undef Y_MIN_POS + #undef Y_MAX_POS + #undef MANUAL_Y_HOME_POS + #undef MIN_SOFTWARE_ENDSTOP_Y + #undef MAX_SOFTWARE_ENDSTOP_Y +#endif + +#if HAS_Z_AXIS + #ifdef Z4_DRIVER_TYPE + #define NUM_Z_STEPPERS 4 + #elif defined(Z3_DRIVER_TYPE) + #define NUM_Z_STEPPERS 3 + #elif defined(Z2_DRIVER_TYPE) + #define NUM_Z_STEPPERS 2 + #else + #define NUM_Z_STEPPERS 1 + #endif +#else + #undef ENDSTOPPULLUP_ZMIN + #undef ENDSTOPPULLUP_ZMAX + #undef Z_MIN_ENDSTOP_HIT_STATE + #undef Z_MAX_ENDSTOP_HIT_STATE + #undef Z2_DRIVER_TYPE + #undef Z3_DRIVER_TYPE + #undef Z4_DRIVER_TYPE + #undef Z_ENABLE_ON + #undef DISABLE_Z + #undef INVERT_Z_DIR + #undef Z_HOME_DIR + #undef Z_MIN_POS + #undef Z_MAX_POS + #undef MANUAL_Z_HOME_POS + #undef Z_SAFE_HOMING + #undef MIN_SOFTWARE_ENDSTOP_Z + #undef MAX_SOFTWARE_ENDSTOP_Z +#endif + +#if !HAS_I_AXIS + #undef ENDSTOPPULLUP_IMIN + #undef ENDSTOPPULLUP_IMAX + #undef I_MIN_ENDSTOP_HIT_STATE + #undef I_MAX_ENDSTOP_HIT_STATE + #undef I_ENABLE_ON + #undef DISABLE_I + #undef INVERT_I_DIR + #undef I_HOME_DIR + #undef I_MIN_POS + #undef I_MAX_POS + #undef MANUAL_I_HOME_POS + #undef MIN_SOFTWARE_ENDSTOP_I + #undef MAX_SOFTWARE_ENDSTOP_I +#endif + +#if !HAS_J_AXIS + #undef ENDSTOPPULLUP_JMIN + #undef ENDSTOPPULLUP_JMAX + #undef J_MIN_ENDSTOP_HIT_STATE + #undef J_MAX_ENDSTOP_HIT_STATE + #undef J_ENABLE_ON + #undef DISABLE_J + #undef INVERT_J_DIR + #undef J_HOME_DIR + #undef J_MIN_POS + #undef J_MAX_POS + #undef MANUAL_J_HOME_POS + #undef MIN_SOFTWARE_ENDSTOP_J + #undef MAX_SOFTWARE_ENDSTOP_J +#endif + +#if !HAS_K_AXIS + #undef ENDSTOPPULLUP_KMIN + #undef ENDSTOPPULLUP_KMAX + #undef K_MIN_ENDSTOP_HIT_STATE + #undef K_MAX_ENDSTOP_HIT_STATE + #undef K_ENABLE_ON + #undef DISABLE_K + #undef INVERT_K_DIR + #undef K_HOME_DIR + #undef K_MIN_POS + #undef K_MAX_POS + #undef MANUAL_K_HOME_POS + #undef MIN_SOFTWARE_ENDSTOP_K + #undef MAX_SOFTWARE_ENDSTOP_K +#endif + +#if !HAS_U_AXIS + #undef ENDSTOPPULLUP_UMIN + #undef ENDSTOPPULLUP_UMAX + #undef U_MIN_ENDSTOP_HIT_STATE + #undef U_MAX_ENDSTOP_HIT_STATE + #undef U_ENABLE_ON + #undef DISABLE_U + #undef INVERT_U_DIR + #undef U_HOME_DIR + #undef U_MIN_POS + #undef U_MAX_POS + #undef MANUAL_U_HOME_POS + #undef MIN_SOFTWARE_ENDSTOP_U + #undef MAX_SOFTWARE_ENDSTOP_U +#endif + +#if !HAS_V_AXIS + #undef ENDSTOPPULLUP_VMIN + #undef ENDSTOPPULLUP_VMAX + #undef V_MIN_ENDSTOP_HIT_STATE + #undef V_MAX_ENDSTOP_HIT_STATE + #undef V_ENABLE_ON + #undef DISABLE_V + #undef INVERT_V_DIR + #undef V_HOME_DIR + #undef V_MIN_POS + #undef V_MAX_POS + #undef MANUAL_V_HOME_POS + #undef MIN_SOFTWARE_ENDSTOP_V + #undef MAX_SOFTWARE_ENDSTOP_V +#endif + +#if !HAS_W_AXIS + #undef ENDSTOPPULLUP_WMIN + #undef ENDSTOPPULLUP_WMAX + #undef W_MIN_ENDSTOP_HIT_STATE + #undef W_MAX_ENDSTOP_HIT_STATE + #undef W_ENABLE_ON + #undef DISABLE_W + #undef INVERT_W_DIR + #undef W_HOME_DIR + #undef W_MIN_POS + #undef W_MAX_POS + #undef MANUAL_W_HOME_POS + #undef MIN_SOFTWARE_ENDSTOP_W + #undef MAX_SOFTWARE_ENDSTOP_W +#endif + +#define _OR_HAS_DA(A) ENABLED(DISABLE_##A) || +#if MAP(_OR_HAS_DA, X, Y, Z, I, J, K, U, V, W) 0 + #define HAS_DISABLE_MAIN_AXES 1 +#endif +#if HAS_DISABLE_MAIN_AXES || ENABLED(DISABLE_E) + #define HAS_DISABLE_AXES 1 +#endif +#undef _OR_HAS_DA + +#ifdef X2_DRIVER_TYPE + #define HAS_X2_STEPPER 1 +#endif +#ifdef Y2_DRIVER_TYPE + #define HAS_Y2_STEPPER 1 +#endif + +/** + * Number of Primary Linear Axes (e.g., XYZ) + * X, XY, or XYZ axes. Excluding duplicate axes (X2, Y2, Z2, Z3, Z4) + */ +#if NUM_AXES >= 3 + #define PRIMARY_LINEAR_AXES 3 +#else + #define PRIMARY_LINEAR_AXES NUM_AXES +#endif + +/** + * Number of Secondary Axes (e.g., IJKUVW) + * All linear/rotational axes between XYZ and E. + */ +#define SECONDARY_AXES SUB3(NUM_AXES) + +/** + * Number of Rotational Axes (e.g., IJK) + * All axes for which AXIS*_ROTATES is defined. + * For these axes, positions are specified in angular degrees. + */ +#if ENABLED(AXIS9_ROTATES) + #define ROTATIONAL_AXES 6 +#elif ENABLED(AXIS8_ROTATES) + #define ROTATIONAL_AXES 5 +#elif ENABLED(AXIS7_ROTATES) + #define ROTATIONAL_AXES 4 +#elif ENABLED(AXIS6_ROTATES) + #define ROTATIONAL_AXES 3 +#elif ENABLED(AXIS5_ROTATES) + #define ROTATIONAL_AXES 2 +#elif ENABLED(AXIS4_ROTATES) + #define ROTATIONAL_AXES 1 +#else + #define ROTATIONAL_AXES 0 +#endif + +/** + * Number of Secondary Linear Axes (e.g., UVW) + * All secondary axes for which AXIS*_ROTATES is not defined. + * Excluding primary axes and excluding duplicate axes (X2, Y2, Z2, Z3, Z4) + */ +#define SECONDARY_LINEAR_AXES (NUM_AXES - PRIMARY_LINEAR_AXES - ROTATIONAL_AXES) + +/** + * Number of Logical Axes (e.g., XYZIJKUVWE) + * All logical axes that can be commanded directly by G-code. + * Delta maps stepper-specific values to ABC steppers. + */ +#if HAS_EXTRUDERS + #define LOGICAL_AXES INCREMENT(NUM_AXES) +#else + #define LOGICAL_AXES NUM_AXES +#endif + +/** + * DISTINCT_E_FACTORS is set to give extruders (some) individual settings. + * + * DISTINCT_AXES is the number of distinct addressable axes (not steppers). + * Includes all linear axes plus all distinguished extruders. + * The default behavior is to treat all extruders as a single E axis + * with shared motion and temperature settings. + * + * DISTINCT_E is the number of distinguished extruders. By default this + * will be 1 which indicates all extruders share the same settings. + * + * E_INDEX_N(E) should be used to get the E index of any item that might be + * distinguished. + */ +#if ENABLED(DISTINCT_E_FACTORS) && E_STEPPERS > 1 + #define DISTINCT_AXES (NUM_AXES + E_STEPPERS) + #define DISTINCT_E E_STEPPERS + #define E_INDEX_N(E) (E) +#else + #undef DISTINCT_E_FACTORS + #define DISTINCT_AXES LOGICAL_AXES + #define DISTINCT_E 1 + #define E_INDEX_N(E) 0 +#endif + +// Helper macros for extruder and hotend arrays +#define _EXTRUDER_LOOP(E) for (int8_t E = 0; E < EXTRUDERS; E++) +#define EXTRUDER_LOOP() _EXTRUDER_LOOP(e) +#define _HOTEND_LOOP(H) for (int8_t H = 0; H < HOTENDS; H++) +#define HOTEND_LOOP() _HOTEND_LOOP(e) + +#define ARRAY_BY_EXTRUDERS(V...) ARRAY_N(EXTRUDERS, V) +#define ARRAY_BY_EXTRUDERS1(v1) ARRAY_N_1(EXTRUDERS, v1) +#define ARRAY_BY_HOTENDS(V...) ARRAY_N(HOTENDS, V) +#define ARRAY_BY_HOTENDS1(v1) ARRAY_N_1(HOTENDS, v1) + +// Support for SD Card and other file storage +#if ENABLED(SDSUPPORT) + #define HAS_MEDIA 1 +#endif + +/** + * Conditionals for the configured LCD / Controller + */ + +// MKS_LCD12864A/B is a variant of MKS_MINI_12864 +#if ANY(MKS_LCD12864A, MKS_LCD12864B) + #define MKS_MINI_12864 +#endif + +// MKS_MINI_12864_V3 and BTT_MINI_12864 have identical pinouts to FYSETC_MINI_12864_2_1 +#if ANY(MKS_MINI_12864_V3, BTT_MINI_12864) + #define FYSETC_MINI_12864_2_1 +#endif + +// Old settings are now conditional on DGUS_LCD_UI +#if DGUS_UI_IS(ORIGIN) + #define DGUS_LCD_UI_ORIGIN 1 +#elif DGUS_UI_IS(FYSETC) + #define DGUS_LCD_UI_FYSETC 1 +#elif DGUS_UI_IS(HIPRECY) + #define DGUS_LCD_UI_HIPRECY 1 +#elif DGUS_UI_IS(MKS) + #define DGUS_LCD_UI_MKS 1 +#elif DGUS_UI_IS(RELOADED) + #define DGUS_LCD_UI_RELOADED 1 +#elif DGUS_UI_IS(IA_CREALITY) + #define DGUS_LCD_UI_IA_CREALITY 1 +#elif DGUS_UI_IS(E3S1PRO) + #define DGUS_LCD_UI_E3S1PRO 1 +#endif + +/** + * General Flags that may be set below by specific LCDs + * + * DOGLCD : Run a Graphical LCD through U8GLib (with MarlinUI) + * IS_ULTIPANEL : Define LCD_PINS_D5/6/7 for direct-connected "Ultipanel" LCDs + * HAS_WIRED_LCD : Ultra LCD, not necessarily Ultipanel. + * IS_RRD_SC : Common RRD Smart Controller digital interface pins + * IS_RRD_FG_SC : Common RRD Full Graphical Smart Controller digital interface pins + * IS_U8GLIB_ST7920 : Most common DOGM display SPI interface, supporting a "lightweight" display mode. + * U8GLIB_SH1106 : SH1106 OLED with I2C interface via U8GLib + * IS_U8GLIB_SSD1306 : SSD1306 OLED with I2C interface via U8GLib (U8GLIB_SSD1306) + * U8GLIB_SSD1309 : SSD1309 OLED with I2C interface via U8GLib (HAS_U8GLIB_I2C_OLED, HAS_WIRED_LCD, DOGLCD) + * IS_U8GLIB_ST7565_64128N : ST7565 128x64 LCD with SPI interface via U8GLib + * IS_U8GLIB_LM6059_AF : LM6059 with Hardware SPI via U8GLib + */ +#if ANY(MKS_MINI_12864, ENDER2_STOCKDISPLAY) + + #define MINIPANEL + +#elif ENABLED(YHCB2004) + + #define IS_ULTIPANEL 1 + +#elif ENABLED(CARTESIO_UI) + + #define DOGLCD + #define IS_ULTIPANEL 1 + +#elif ANY(DWIN_MARLINUI_PORTRAIT, DWIN_MARLINUI_LANDSCAPE) + + #define IS_DWIN_MARLINUI 1 + #define IS_ULTIPANEL 1 + +#elif ENABLED(ZONESTAR_LCD) + + #define HAS_ADC_BUTTONS 1 + #define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 + #define ADC_KEY_NUM 8 + #define IS_ULTIPANEL 1 + + // This helps to implement HAS_ADC_BUTTONS menus + #define REVERSE_MENU_DIRECTION + #define STD_ENCODER_PULSES_PER_STEP 1 + #define STD_ENCODER_STEPS_PER_MENU_ITEM 1 + #define ENCODER_FEEDRATE_DEADZONE 2 + +#elif ENABLED(ZONESTAR_12864LCD) + #define DOGLCD + #define IS_RRD_SC 1 + #define IS_U8GLIB_ST7920 1 + +#elif ENABLED(ZONESTAR_12864OLED) + #define IS_RRD_SC 1 + #define U8GLIB_SH1106 + +#elif ENABLED(ZONESTAR_12864OLED_SSD1306) + #define IS_RRD_SC 1 + #define IS_U8GLIB_SSD1306 + +#elif ENABLED(RADDS_DISPLAY) + #define IS_ULTIPANEL 1 + #define STD_ENCODER_PULSES_PER_STEP 2 + +#elif ANY(miniVIKI, VIKI2, WYH_L12864, ELB_FULL_GRAPHIC_CONTROLLER, AZSMZ_12864, EMOTION_TECH_LCD) + + #define DOGLCD + #define IS_DOGM_12864 1 + #define IS_ULTIPANEL 1 + + #if ENABLED(miniVIKI) + #define IS_U8GLIB_ST7565_64128N 1 + #elif ENABLED(VIKI2) + #define IS_U8GLIB_ST7565_64128N 1 + #elif ENABLED(WYH_L12864) + #define IS_U8GLIB_ST7565_64128N 1 + #define ST7565_XOFFSET 0x04 + #elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) + #define IS_U8GLIB_LM6059_AF 1 + #elif ENABLED(AZSMZ_12864) + #define IS_U8GLIB_ST7565_64128N 1 + #elif ENABLED(EMOTION_TECH_LCD) + #define IS_U8GLIB_ST7565_64128N 1 + #define ST7565_VOLTAGE_DIVIDER_VALUE 0x07 + #endif + +#elif ENABLED(OLED_PANEL_TINYBOY2) + + #define IS_U8GLIB_SSD1306 + #define IS_ULTIPANEL 1 + +#elif ENABLED(RA_CONTROL_PANEL) + + #define LCD_I2C_TYPE_PCA8574 + #define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander + #define IS_ULTIPANEL 1 + +#elif ENABLED(REPRAPWORLD_GRAPHICAL_LCD) + + #define DOGLCD + #define IS_U8GLIB_ST7920 1 + #define IS_ULTIPANEL 1 + #define ENCODER_PULSES_PER_STEP 2 + +#elif ENABLED(MKS_12864OLED) + + #define IS_RRD_SC 1 + #define U8GLIB_SH1106 + +#elif ENABLED(MKS_12864OLED_SSD1306) + + #define IS_RRD_SC 1 + #define IS_U8GLIB_SSD1306 + +#elif ENABLED(SAV_3DGLCD) + + #ifdef U8GLIB_SSD1306 + #define IS_U8GLIB_SSD1306 // Allow for U8GLIB_SSD1306 + SAV_3DGLCD + #endif + #define IS_NEWPANEL 1 + +#elif ENABLED(FYSETC_242_OLED_12864) + + #define IS_RRD_SC 1 + #define U8GLIB_SH1106 + + #ifndef NEOPIXEL_BRIGHTNESS + #define NEOPIXEL_BRIGHTNESS 127 + #endif + +#elif ANY(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1, FYSETC_GENERIC_12864_1_1) + + #define FYSETC_MINI_12864 + #define DOGLCD + #define IS_ULTIPANEL 1 + #define LED_COLORS_REDUCE_GREEN + + // Require LED backlighting enabled + #if ENABLED(FYSETC_MINI_12864_2_1) + #ifndef NEOPIXEL_BRIGHTNESS + #define NEOPIXEL_BRIGHTNESS 127 + #endif + //#define NEOPIXEL_STARTUP_TEST #endif #elif ENABLED(ULTI_CONTROLLER) @@ -277,842 +782,337 @@ #define IS_RRD_SC 1 #endif -// ST7565 / 64128N graphical displays -#if ANY(MAKRPANEL, MINIPANEL) - #define IS_ULTIPANEL 1 - #define DOGLCD - #if ENABLED(MAKRPANEL) - #define IS_U8GLIB_ST7565_64128N 1 - #endif -#endif - -#if ENABLED(IS_U8GLIB_SSD1306) - #define U8GLIB_SSD1306 -#endif - -#if ENABLED(OVERLORD_OLED) - #define IS_ULTIPANEL 1 - #define U8GLIB_SH1106 - /** - * PCA9632 for buzzer and LEDs via i2c - * No auto-inc, red and green leds switched, buzzer - */ - #define PCA9632 - #define PCA9632_NO_AUTO_INC - #define PCA9632_GRN 0x00 - #define PCA9632_RED 0x02 - #define PCA9632_BUZZER - #define PCA9632_BUZZER_DATA { 0x09, 0x02 } - - #define STD_ENCODER_PULSES_PER_STEP 1 // Overlord uses buttons - #define STD_ENCODER_STEPS_PER_MENU_ITEM 1 -#endif - -// 128x64 I2C OLED LCDs - SSD1306/SSD1309/SH1106 -#if ANY(U8GLIB_SSD1306, U8GLIB_SSD1309, U8GLIB_SH1106) - #define HAS_U8GLIB_I2C_OLED 1 - #define HAS_WIRED_LCD 1 - #define DOGLCD -#endif - -/** - * SPI Ultipanels - */ - -// Basic Ultipanel-like displays -#if ANY(ULTIMAKERCONTROLLER, IS_RRD_SC, G3D_PANEL, RIGIDBOT_PANEL, PANEL_ONE, U8GLIB_SH1106) - #define IS_ULTIPANEL 1 -#endif - -// Einstart OLED has Cardinal nav via pins defined in pins_EINSTART-S.h -#if ENABLED(U8GLIB_SH1106_EINSTART) - #define DOGLCD - #define IS_ULTIPANEL 1 -#endif - -// TFT Legacy options masquerade as TFT_GENERIC -#if ANY(FSMC_GRAPHICAL_TFT, SPI_GRAPHICAL_TFT, TFT_320x240, TFT_480x320, TFT_320x240_SPI, TFT_480x320_SPI, TFT_LVGL_UI_FSMC, TFT_LVGL_UI_SPI) - #define IS_LEGACY_TFT 1 - #define TFT_GENERIC - #if ANY(FSMC_GRAPHICAL_TFT, TFT_320x240, TFT_480x320, TFT_LVGL_UI_FSMC) - #define TFT_INTERFACE_FSMC - #elif ANY(SPI_GRAPHICAL_TFT, TFT_320x240_SPI, TFT_480x320_SPI, TFT_LVGL_UI_SPI) - #define TFT_INTERFACE_SPI - #endif - #if ANY(FSMC_GRAPHICAL_TFT, SPI_GRAPHICAL_TFT) - #define TFT_CLASSIC_UI - #elif ANY(TFT_320x240, TFT_480x320, TFT_320x240_SPI, TFT_480x320_SPI) - #define TFT_COLOR_UI - #elif ANY(TFT_LVGL_UI_FSMC, TFT_LVGL_UI_SPI) - #define TFT_LVGL_UI - #endif -#endif - -// FSMC/SPI TFT Panels (LVGL) -#if ENABLED(TFT_LVGL_UI) - #define HAS_TFT_LVGL_UI 1 - #define SERIAL_RUNTIME_HOOK 1 -#endif - -// FSMC/SPI TFT Panels -#if ENABLED(TFT_CLASSIC_UI) - #define TFT_SCALED_DOGLCD 1 -#endif - -#if TFT_SCALED_DOGLCD - #define DOGLCD - #define IS_ULTIPANEL 1 - #define DELAYED_BACKLIGHT_INIT -#elif HAS_TFT_LVGL_UI - #define DELAYED_BACKLIGHT_INIT -#endif - -// Color UI -#if ENABLED(TFT_COLOR_UI) - #define HAS_GRAPHICAL_TFT 1 - #define IS_ULTIPANEL 1 -#endif - -/** - * I2C Panels - */ - -#if ANY(IS_RRD_SC, IS_DOGM_12864, OLED_PANEL_TINYBOY2, LCD_I2C_PANELOLU2) - - #define STD_ENCODER_PULSES_PER_STEP 4 - #define STD_ENCODER_STEPS_PER_MENU_ITEM 1 - - #if ENABLED(LCD_I2C_PANELOLU2) // PANELOLU2 LCD with status LEDs, separate encoder and click inputs - #define LCD_I2C_TYPE_MCP23017 // I2C Character-based 12864 display - #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander - #define LCD_USE_I2C_BUZZER // Enable buzzer on LCD (optional) - #define IS_ULTIPANEL 1 - #endif - -#elif ANY(LCD_SAINSMART_I2C_1602, LCD_SAINSMART_I2C_2004) - - #define LCD_I2C_TYPE_PCF8575 // I2C Character-based 12864 display - #define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander - #define IS_ULTIPANEL 1 - - #if ENABLED(LCD_SAINSMART_I2C_2004) - #define LCD_WIDTH 20 - #define LCD_HEIGHT 4 - #endif - -#elif ENABLED(LCD_I2C_VIKI) - - /** - * Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs - * - * This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 ) - * Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory. - * Note: The pause/stop/resume LCD button pin should be connected to the Arduino - * BTN_ENC pin (or set BTN_ENC to -1 if not used) - */ - #define LCD_I2C_TYPE_MCP23017 - #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander - #define LCD_USE_I2C_BUZZER // Enable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later) - #define IS_ULTIPANEL 1 - - #define ENCODER_FEEDRATE_DEADZONE 4 - - #define STD_ENCODER_PULSES_PER_STEP 1 - #define STD_ENCODER_STEPS_PER_MENU_ITEM 2 - -#elif ENABLED(G3D_PANEL) - - #define STD_ENCODER_PULSES_PER_STEP 2 - #define STD_ENCODER_STEPS_PER_MENU_ITEM 1 - -#endif - -#if ANY(LCD_I2C_TYPE_MCP23017, LCD_I2C_TYPE_MCP23008) && DISABLED(NO_LCD_DETECT) - #define DETECT_I2C_LCD_DEVICE 1 -#endif - -#ifndef STD_ENCODER_PULSES_PER_STEP - #if ENABLED(TOUCH_SCREEN) - #define STD_ENCODER_PULSES_PER_STEP 2 - #else - #define STD_ENCODER_PULSES_PER_STEP 5 - #endif -#endif -#ifndef STD_ENCODER_STEPS_PER_MENU_ITEM - #define STD_ENCODER_STEPS_PER_MENU_ITEM 1 -#endif -#ifndef ENCODER_PULSES_PER_STEP - #define ENCODER_PULSES_PER_STEP STD_ENCODER_PULSES_PER_STEP -#endif -#ifndef ENCODER_STEPS_PER_MENU_ITEM - #define ENCODER_STEPS_PER_MENU_ITEM STD_ENCODER_STEPS_PER_MENU_ITEM -#endif -#ifndef ENCODER_FEEDRATE_DEADZONE - #define ENCODER_FEEDRATE_DEADZONE 6 -#endif - -// Shift register panels -// --------------------- -// 2 wire Non-latching LCD SR from: -// https://github.com/fmalpartida/New-LiquidCrystal/wiki/schematics#user-content-ShiftRegister_connection -#if ENABLED(FF_INTERFACEBOARD) - #define SR_LCD_3W_NL // Non latching 3 wire shift register - #define IS_ULTIPANEL 1 -#elif ENABLED(SAV_3DLCD) - #define SR_LCD_2W_NL // Non latching 2 wire shift register - #define IS_ULTIPANEL 1 -#elif ENABLED(ULTIPANEL) - #define IS_ULTIPANEL 1 -#endif - -#if ANY(IS_ULTIPANEL, ULTRA_LCD) - #define HAS_WIRED_LCD 1 -#endif - -#if ANY(IS_ULTIPANEL, REPRAPWORLD_KEYPAD) - #define IS_NEWPANEL 1 -#endif - -#if ANY(ZONESTAR_LCD, REPRAPWORLD_KEYPAD) - #define IS_RRW_KEYPAD 1 - #ifndef REPRAPWORLD_KEYPAD_MOVE_STEP - #define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0 - #endif -#endif - -// Aliases for LCD features -#if !DGUS_UI_IS(NONE) || ENABLED(ANYCUBIC_LCD_VYPER) - #define HAS_DGUS_LCD 1 - #if DGUS_UI_IS(ORIGIN, FYSETC, HIPRECY, MKS) - #define HAS_DGUS_LCD_CLASSIC 1 - #endif -#endif - -// Extensible UI serial touch screens. (See src/lcd/extui) -#if ANY(HAS_DGUS_LCD, MALYAN_LCD, ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, NEXTION_TFT, TOUCH_UI_FTDI_EVE) - #define IS_EXTUI 1 // Just for sanity check. - #define EXTENSIBLE_UI -#endif - -// Aliases for LCD features -#if ANY(DWIN_CREALITY_LCD, DWIN_LCD_PROUI) - #define HAS_DWIN_E3V2_BASIC 1 -#endif -#if ANY(HAS_DWIN_E3V2_BASIC, DWIN_CREALITY_LCD_JYERSUI) - #define HAS_DWIN_E3V2 1 -#endif - -// E3V2 extras -#if HAS_DWIN_E3V2 || IS_DWIN_MARLINUI - #define SERIAL_CATCHALL 0 - #define HAS_LCD_BRIGHTNESS 1 - #define LCD_BRIGHTNESS_MAX 250 -#endif - -#if ENABLED(DWIN_LCD_PROUI) - #define DO_LIST_BIN_FILES 1 - #define LCD_BRIGHTNESS_DEFAULT 127 -#endif - -// Serial Controllers require LCD_SERIAL_PORT -#if ANY(IS_DWIN_MARLINUI, HAS_DWIN_E3V2, HAS_DGUS_LCD, MALYAN_LCD, ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, NEXTION_TFT) - #define LCD_IS_SERIAL_HOST 1 +// ST7565 / 64128N graphical displays +#if ANY(MAKRPANEL, MINIPANEL) + #define IS_ULTIPANEL 1 + #define DOGLCD + #if ENABLED(MAKRPANEL) + #define IS_U8GLIB_ST7565_64128N 1 + #endif #endif -#if HAS_WIRED_LCD - #if ENABLED(DOGLCD) - #define HAS_MARLINUI_U8GLIB 1 - #elif IS_TFTGLCD_PANEL - // Neither DOGM nor HD44780. Fully customized interface. - #elif IS_DWIN_MARLINUI - // Since HAS_MARLINUI_U8GLIB refers to U8G displays - // the DWIN display can define its own flags - #elif !HAS_GRAPHICAL_TFT - #define HAS_MARLINUI_HD44780 1 - #endif +#if ENABLED(IS_U8GLIB_SSD1306) + #define U8GLIB_SSD1306 #endif -#if ANY(HAS_WIRED_LCD, EXTENSIBLE_UI, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) +#if ENABLED(OVERLORD_OLED) + #define IS_ULTIPANEL 1 + #define U8GLIB_SH1106 /** - * HAS_DISPLAY indicates the display uses these MarlinUI methods... - * - update - * - abort_print - * - pause_print - * - resume_print - * - poweroff (for PSU_CONTROL and HAS_MARLINUI_MENU) - * - * ...and implements these MarlinUI methods: - * - zoffset_overlay (if BABYSTEP_GFX_OVERLAY or MESH_EDIT_GFX_OVERLAY are supported) - * - draw_kill_screen - * - kill_screen - * - draw_status_message + * PCA9632 for buzzer and LEDs via i2c + * No auto-inc, red and green leds switched, buzzer */ - #define HAS_DISPLAY 1 -#endif + #define PCA9632 + #define PCA9632_NO_AUTO_INC + #define PCA9632_GRN 0x00 + #define PCA9632_RED 0x02 + #define PCA9632_BUZZER + #define PCA9632_BUZZER_DATA { 0x09, 0x02 } -#if HAS_WIRED_LCD && !HAS_GRAPHICAL_TFT && !IS_DWIN_MARLINUI - #define HAS_LCDPRINT 1 + #define STD_ENCODER_PULSES_PER_STEP 1 // Overlord uses buttons + #define STD_ENCODER_STEPS_PER_MENU_ITEM 1 #endif -#if HAS_DISPLAY || HAS_LCDPRINT - #define HAS_UTF8_UTILS 1 +// 128x64 I2C OLED LCDs - SSD1306/SSD1309/SH1106 +#if ANY(U8GLIB_SSD1306, U8GLIB_SSD1309, U8GLIB_SH1106) + #define HAS_U8GLIB_I2C_OLED 1 + #define HAS_WIRED_LCD 1 + #define DOGLCD #endif -#if ANY(HAS_DISPLAY, HAS_DWIN_E3V2) - #define HAS_STATUS_MESSAGE 1 -#endif +/** + * SPI Ultipanels + */ -#if IS_ULTIPANEL && DISABLED(NO_LCD_MENUS) - #define HAS_MARLINUI_MENU 1 +// Basic Ultipanel-like displays +#if ANY(ULTIMAKERCONTROLLER, IS_RRD_SC, G3D_PANEL, RIGIDBOT_PANEL, PANEL_ONE, U8GLIB_SH1106) + #define IS_ULTIPANEL 1 #endif -#if ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI, HAS_DWIN_E3V2) - #define HAS_MANUAL_MOVE_MENU 1 +// Einstart OLED has Cardinal nav via pins defined in pins_EINSTART-S.h +#if ENABLED(U8GLIB_SH1106_EINSTART) + #define DOGLCD + #define IS_ULTIPANEL 1 #endif -#if HAS_MARLINUI_U8GLIB - #ifndef LCD_PIXEL_WIDTH - #define LCD_PIXEL_WIDTH 128 +// TFT Legacy options masquerade as TFT_GENERIC +#if ANY(FSMC_GRAPHICAL_TFT, SPI_GRAPHICAL_TFT, TFT_320x240, TFT_480x320, TFT_320x240_SPI, TFT_480x320_SPI, TFT_LVGL_UI_FSMC, TFT_LVGL_UI_SPI) + #define IS_LEGACY_TFT 1 + #define TFT_GENERIC + #if ANY(FSMC_GRAPHICAL_TFT, TFT_320x240, TFT_480x320, TFT_LVGL_UI_FSMC) + #define TFT_INTERFACE_FSMC + #elif ANY(SPI_GRAPHICAL_TFT, TFT_320x240_SPI, TFT_480x320_SPI, TFT_LVGL_UI_SPI) + #define TFT_INTERFACE_SPI #endif - #ifndef LCD_PIXEL_HEIGHT - #define LCD_PIXEL_HEIGHT 64 + #if ANY(FSMC_GRAPHICAL_TFT, SPI_GRAPHICAL_TFT) + #define TFT_CLASSIC_UI + #elif ANY(TFT_320x240, TFT_480x320, TFT_320x240_SPI, TFT_480x320_SPI) + #define TFT_COLOR_UI + #elif ANY(TFT_LVGL_UI_FSMC, TFT_LVGL_UI_SPI) + #define TFT_LVGL_UI #endif #endif -/** - * Multi-Material-Unit supported models - */ -#define PRUSA_MMU1 1 -#define PRUSA_MMU2 2 -#define PRUSA_MMU2S 3 -#define EXTENDABLE_EMU_MMU2 12 -#define EXTENDABLE_EMU_MMU2S 13 - -#ifdef MMU_MODEL - #define HAS_MMU 1 - #if MMU_MODEL == PRUSA_MMU1 - #define HAS_PRUSA_MMU1 1 - #elif MMU_MODEL % 10 == PRUSA_MMU2 - #define HAS_PRUSA_MMU2 1 - #elif MMU_MODEL % 10 == PRUSA_MMU2S - #define HAS_PRUSA_MMU2 1 - #define HAS_PRUSA_MMU2S 1 - #endif - #if MMU_MODEL >= EXTENDABLE_EMU_MMU2 - #define HAS_EXTENDABLE_MMU 1 - #endif +// FSMC/SPI TFT Panels (LVGL) +#if ENABLED(TFT_LVGL_UI) + #define HAS_TFT_LVGL_UI 1 + #define SERIAL_RUNTIME_HOOK 1 #endif -#undef PRUSA_MMU1 -#undef PRUSA_MMU2 -#undef PRUSA_MMU2S -#undef EXTENDABLE_EMU_MMU2 -#undef EXTENDABLE_EMU_MMU2S - -/** - * Extruders have some combination of stepper motors and hotends - * so we separate these concepts into the defines: - * - * EXTRUDERS - Number of Selectable Tools - * HOTENDS - Number of hotends, whether connected or separate - * E_STEPPERS - Number of actual E stepper motors - * E_MANUAL - Number of E steppers for LCD move options - * - * These defines must be simple constants for use in REPEAT, etc. - */ -#if EXTRUDERS - #define HAS_EXTRUDERS 1 - #if EXTRUDERS > 1 - #define HAS_MULTI_EXTRUDER 1 - #endif - #define E_AXIS_N(E) AxisEnum(E_AXIS + E_INDEX_N(E)) -#else - #undef EXTRUDERS - #define EXTRUDERS 0 - #undef TEMP_SENSOR_0 - #undef TEMP_SENSOR_1 - #undef TEMP_SENSOR_2 - #undef TEMP_SENSOR_3 - #undef TEMP_SENSOR_4 - #undef TEMP_SENSOR_5 - #undef TEMP_SENSOR_6 - #undef TEMP_SENSOR_7 - #undef SINGLENOZZLE - #undef SWITCHING_EXTRUDER - #undef MECHANICAL_SWITCHING_EXTRUDER - #undef SWITCHING_NOZZLE - #undef MECHANICAL_SWITCHING_NOZZLE - #undef MIXING_EXTRUDER - #undef HOTEND_IDLE_TIMEOUT - #undef DISABLE_E - #undef PREVENT_LENGTHY_EXTRUDE - #undef FILAMENT_RUNOUT_SENSOR - #undef FILAMENT_RUNOUT_DISTANCE_MM - #undef DISABLE_OTHER_EXTRUDERS +// FSMC/SPI TFT Panels +#if ENABLED(TFT_CLASSIC_UI) + #define TFT_SCALED_DOGLCD 1 #endif -#define E_OPTARG(N) OPTARG(HAS_MULTI_EXTRUDER, N) -#define E_TERN_(N) TERN_(HAS_MULTI_EXTRUDER, N) -#define E_TERN0(N) TERN0(HAS_MULTI_EXTRUDER, N) - -#if ANY(SWITCHING_EXTRUDER, MECHANICAL_SWITCHING_EXTRUDER) - #define HAS_SWITCHING_EXTRUDER 1 -#endif -#if ANY(SWITCHING_NOZZLE, MECHANICAL_SWITCHING_NOZZLE) - #define HAS_SWITCHING_NOZZLE 1 +#if TFT_SCALED_DOGLCD + #define DOGLCD + #define IS_ULTIPANEL 1 + #define DELAYED_BACKLIGHT_INIT +#elif HAS_TFT_LVGL_UI + #define DELAYED_BACKLIGHT_INIT #endif -#if ENABLED(E_DUAL_STEPPER_DRIVERS) // E0/E1 steppers act in tandem as E0 - - #define E_STEPPERS 2 - #define E_MANUAL 1 +// Color UI +#if ENABLED(TFT_COLOR_UI) + #define HAS_GRAPHICAL_TFT 1 + #define IS_ULTIPANEL 1 +#endif -#elif HAS_SWITCHING_EXTRUDER // One stepper for every two EXTRUDERS +/** + * I2C Panels + */ - #if EXTRUDERS > 4 - #define E_STEPPERS 3 - #elif EXTRUDERS > 2 - #define E_STEPPERS 2 - #else - #define E_STEPPERS 1 - #endif +#if ANY(IS_RRD_SC, IS_DOGM_12864, OLED_PANEL_TINYBOY2, LCD_I2C_PANELOLU2) -#elif ENABLED(MIXING_EXTRUDER) // Multiple feeds are mixed proportionally + #define STD_ENCODER_PULSES_PER_STEP 4 + #define STD_ENCODER_STEPS_PER_MENU_ITEM 1 - #define E_STEPPERS MIXING_STEPPERS - #define E_MANUAL 1 - #if MIXING_STEPPERS == 2 - #define HAS_DUAL_MIXING 1 + #if ENABLED(LCD_I2C_PANELOLU2) // PANELOLU2 LCD with status LEDs, separate encoder and click inputs + #define LCD_I2C_TYPE_MCP23017 // I2C Character-based 12864 display + #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander + #define LCD_USE_I2C_BUZZER // Enable buzzer on LCD (optional) + #define IS_ULTIPANEL 1 #endif -#elif ENABLED(SWITCHING_TOOLHEAD) // Toolchanger - - #define E_STEPPERS EXTRUDERS - #define E_MANUAL EXTRUDERS +#elif ANY(LCD_SAINSMART_I2C_1602, LCD_SAINSMART_I2C_2004) -#elif HAS_PRUSA_MMU2 // Průša Multi-Material Unit v2 + #define LCD_I2C_TYPE_PCF8575 // I2C Character-based 12864 display + #define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander + #define IS_ULTIPANEL 1 - #define E_STEPPERS 1 - #define E_MANUAL 1 + #if ENABLED(LCD_SAINSMART_I2C_2004) + #define LCD_WIDTH 20 + #define LCD_HEIGHT 4 + #endif -#endif +#elif ENABLED(LCD_I2C_VIKI) -// No inactive extruders with SWITCHING_NOZZLE or Průša MMU1 or just 1 E stepper exists -#if HAS_SWITCHING_NOZZLE || HAS_PRUSA_MMU1 || E_STEPPERS < 2 - #undef DISABLE_OTHER_EXTRUDERS -#endif + /** + * Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs + * + * This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 ) + * Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory. + * Note: The pause/stop/resume LCD button pin should be connected to the Arduino + * BTN_ENC pin (or set BTN_ENC to -1 if not used) + */ + #define LCD_I2C_TYPE_MCP23017 + #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander + #define LCD_USE_I2C_BUZZER // Enable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later) + #define IS_ULTIPANEL 1 -// Průša MMU1, MMU(S) 2.0 and EXTENDABLE_EMU_MMU2(S) force SINGLENOZZLE -#if HAS_MMU - #define SINGLENOZZLE -#endif + #define ENCODER_FEEDRATE_DEADZONE 4 -// Default E steppers / manual motion is one per extruder -#ifndef E_STEPPERS - #define E_STEPPERS EXTRUDERS -#endif -#ifndef E_MANUAL - #define E_MANUAL EXTRUDERS -#endif + #define STD_ENCODER_PULSES_PER_STEP 1 + #define STD_ENCODER_STEPS_PER_MENU_ITEM 2 -// Number of hotends... -#if ANY(SINGLENOZZLE, MIXING_EXTRUDER) // Only one for singlenozzle or mixing extruder - #define HOTENDS 1 -#elif HAS_SWITCHING_EXTRUDER && !HAS_SWITCHING_NOZZLE // One for each pair of abstract "extruders" - #define HOTENDS E_STEPPERS -#elif TEMP_SENSOR_0 - #define HOTENDS EXTRUDERS // One per extruder if at least one heater exists -#else - #define HOTENDS 0 // A machine with no hotends at all can still extrude -#endif +#elif ENABLED(G3D_PANEL) + + #define STD_ENCODER_PULSES_PER_STEP 2 + #define STD_ENCODER_STEPS_PER_MENU_ITEM 1 -// More than one hotend... -#if HOTENDS > 1 - #define HAS_MULTI_HOTEND 1 - #define HAS_HOTEND_OFFSET 1 - #ifndef HOTEND_OFFSET_X - #define HOTEND_OFFSET_X { 0 } // X offsets for each extruder - #endif - #ifndef HOTEND_OFFSET_Y - #define HOTEND_OFFSET_Y { 0 } // Y offsets for each extruder - #endif - #ifndef HOTEND_OFFSET_Z - #define HOTEND_OFFSET_Z { 0 } // Z offsets for each extruder - #endif -#else - #undef HOTEND_OFFSET_X - #undef HOTEND_OFFSET_Y - #undef HOTEND_OFFSET_Z #endif -// At least one hotend... -#if HOTENDS - #define HAS_HOTEND 1 - #ifndef HOTEND_OVERSHOOT - #define HOTEND_OVERSHOOT 15 - #endif +#if ANY(LCD_I2C_TYPE_MCP23017, LCD_I2C_TYPE_MCP23008) && DISABLED(NO_LCD_DETECT) + #define DETECT_I2C_LCD_DEVICE 1 #endif -// Clean up E-stepper-based settings... -#if E_STEPPERS <= 7 - #undef INVERT_E7_DIR - #undef E7_DRIVER_TYPE - #if E_STEPPERS <= 6 - #undef INVERT_E6_DIR - #undef E6_DRIVER_TYPE - #if E_STEPPERS <= 5 - #undef INVERT_E5_DIR - #undef E5_DRIVER_TYPE - #if E_STEPPERS <= 4 - #undef INVERT_E4_DIR - #undef E4_DRIVER_TYPE - #if E_STEPPERS <= 3 - #undef INVERT_E3_DIR - #undef E3_DRIVER_TYPE - #if E_STEPPERS <= 2 - #undef INVERT_E2_DIR - #undef E2_DRIVER_TYPE - #if E_STEPPERS <= 1 - #undef INVERT_E1_DIR - #undef E1_DRIVER_TYPE - #if E_STEPPERS == 0 - #undef INVERT_E0_DIR - #undef E0_DRIVER_TYPE - #endif - #endif - #endif - #endif - #endif - #endif +#ifndef STD_ENCODER_PULSES_PER_STEP + #if ENABLED(TOUCH_SCREEN) + #define STD_ENCODER_PULSES_PER_STEP 2 + #else + #define STD_ENCODER_PULSES_PER_STEP 5 #endif #endif - -/** - * Number of Linear Axes (e.g., XYZIJKUVW) - * All the logical axes except for the tool (E) axis - */ -#ifdef NUM_AXES - #undef NUM_AXES - #define NUM_AXES_WARNING 1 +#ifndef STD_ENCODER_STEPS_PER_MENU_ITEM + #define STD_ENCODER_STEPS_PER_MENU_ITEM 1 #endif - -#ifdef W_DRIVER_TYPE - #define NUM_AXES 9 -#elif defined(V_DRIVER_TYPE) - #define NUM_AXES 8 -#elif defined(U_DRIVER_TYPE) - #define NUM_AXES 7 -#elif defined(K_DRIVER_TYPE) - #define NUM_AXES 6 -#elif defined(J_DRIVER_TYPE) - #define NUM_AXES 5 -#elif defined(I_DRIVER_TYPE) - #define NUM_AXES 4 -#elif defined(Z_DRIVER_TYPE) - #define NUM_AXES 3 -#elif defined(Y_DRIVER_TYPE) - #define NUM_AXES 2 -#elif defined(X_DRIVER_TYPE) - #define NUM_AXES 1 -#else - #define NUM_AXES 0 +#ifndef ENCODER_PULSES_PER_STEP + #define ENCODER_PULSES_PER_STEP STD_ENCODER_PULSES_PER_STEP #endif -#if NUM_AXES >= 1 - #define HAS_X_AXIS 1 - #if NUM_AXES >= XY - #define HAS_Y_AXIS 1 - #if NUM_AXES >= XYZ - #define HAS_Z_AXIS 1 - #if NUM_AXES >= 4 - #define HAS_I_AXIS 1 - #if NUM_AXES >= 5 - #define HAS_J_AXIS 1 - #if NUM_AXES >= 6 - #define HAS_K_AXIS 1 - #if NUM_AXES >= 7 - #define HAS_U_AXIS 1 - #if NUM_AXES >= 8 - #define HAS_V_AXIS 1 - #if NUM_AXES >= 9 - #define HAS_W_AXIS 1 - #endif - #endif - #endif - #endif - #endif - #endif - #endif - #endif +#ifndef ENCODER_STEPS_PER_MENU_ITEM + #define ENCODER_STEPS_PER_MENU_ITEM STD_ENCODER_STEPS_PER_MENU_ITEM #endif - -#if !HAS_X_AXIS - #undef AVOID_OBSTACLES - #undef ENDSTOPPULLUP_XMIN - #undef ENDSTOPPULLUP_XMAX - #undef X_MIN_ENDSTOP_HIT_STATE - #undef X_MAX_ENDSTOP_HIT_STATE - #undef X2_DRIVER_TYPE - #undef X_ENABLE_ON - #undef DISABLE_X - #undef INVERT_X_DIR - #undef X_HOME_DIR - #undef X_MIN_POS - #undef X_MAX_POS - #undef MANUAL_X_HOME_POS - #undef MIN_SOFTWARE_ENDSTOPS - #undef MAX_SOFTWARE_ENDSTOPS +#ifndef ENCODER_FEEDRATE_DEADZONE + #define ENCODER_FEEDRATE_DEADZONE 6 #endif -#if !HAS_Y_AXIS - #undef AVOID_OBSTACLES - #undef ENDSTOPPULLUP_YMIN - #undef ENDSTOPPULLUP_YMAX - #undef Y_MIN_ENDSTOP_HIT_STATE - #undef Y_MAX_ENDSTOP_HIT_STATE - #undef Y2_DRIVER_TYPE - #undef Y_ENABLE_ON - #undef DISABLE_Y - #undef INVERT_Y_DIR - #undef Y_HOME_DIR - #undef Y_MIN_POS - #undef Y_MAX_POS - #undef MANUAL_Y_HOME_POS - #undef MIN_SOFTWARE_ENDSTOP_Y - #undef MAX_SOFTWARE_ENDSTOP_Y +// Shift register panels +// --------------------- +// 2 wire Non-latching LCD SR from: +// https://github.com/fmalpartida/New-LiquidCrystal/wiki/schematics#user-content-ShiftRegister_connection +#if ENABLED(FF_INTERFACEBOARD) + #define SR_LCD_3W_NL // Non latching 3 wire shift register + #define IS_ULTIPANEL 1 +#elif ENABLED(SAV_3DLCD) + #define SR_LCD_2W_NL // Non latching 2 wire shift register + #define IS_ULTIPANEL 1 +#elif ENABLED(ULTIPANEL) + #define IS_ULTIPANEL 1 #endif -#if HAS_Z_AXIS - #ifdef Z4_DRIVER_TYPE - #define NUM_Z_STEPPERS 4 - #elif defined(Z3_DRIVER_TYPE) - #define NUM_Z_STEPPERS 3 - #elif defined(Z2_DRIVER_TYPE) - #define NUM_Z_STEPPERS 2 - #else - #define NUM_Z_STEPPERS 1 - #endif -#else - #undef ENDSTOPPULLUP_ZMIN - #undef ENDSTOPPULLUP_ZMAX - #undef Z_MIN_ENDSTOP_HIT_STATE - #undef Z_MAX_ENDSTOP_HIT_STATE - #undef Z2_DRIVER_TYPE - #undef Z3_DRIVER_TYPE - #undef Z4_DRIVER_TYPE - #undef Z_ENABLE_ON - #undef DISABLE_Z - #undef INVERT_Z_DIR - #undef Z_HOME_DIR - #undef Z_MIN_POS - #undef Z_MAX_POS - #undef MANUAL_Z_HOME_POS - #undef Z_SAFE_HOMING - #undef MIN_SOFTWARE_ENDSTOP_Z - #undef MAX_SOFTWARE_ENDSTOP_Z +#if ANY(IS_ULTIPANEL, ULTRA_LCD) + #define HAS_WIRED_LCD 1 #endif -#if !HAS_I_AXIS - #undef ENDSTOPPULLUP_IMIN - #undef ENDSTOPPULLUP_IMAX - #undef I_MIN_ENDSTOP_HIT_STATE - #undef I_MAX_ENDSTOP_HIT_STATE - #undef I_ENABLE_ON - #undef DISABLE_I - #undef INVERT_I_DIR - #undef I_HOME_DIR - #undef I_MIN_POS - #undef I_MAX_POS - #undef MANUAL_I_HOME_POS - #undef MIN_SOFTWARE_ENDSTOP_I - #undef MAX_SOFTWARE_ENDSTOP_I +#if ANY(IS_ULTIPANEL, REPRAPWORLD_KEYPAD) + #define IS_NEWPANEL 1 #endif -#if !HAS_J_AXIS - #undef ENDSTOPPULLUP_JMIN - #undef ENDSTOPPULLUP_JMAX - #undef J_MIN_ENDSTOP_HIT_STATE - #undef J_MAX_ENDSTOP_HIT_STATE - #undef J_ENABLE_ON - #undef DISABLE_J - #undef INVERT_J_DIR - #undef J_HOME_DIR - #undef J_MIN_POS - #undef J_MAX_POS - #undef MANUAL_J_HOME_POS - #undef MIN_SOFTWARE_ENDSTOP_J - #undef MAX_SOFTWARE_ENDSTOP_J +#if ANY(ZONESTAR_LCD, REPRAPWORLD_KEYPAD) + #define IS_RRW_KEYPAD 1 + #ifndef REPRAPWORLD_KEYPAD_MOVE_STEP + #define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0 + #endif #endif -#if !HAS_K_AXIS - #undef ENDSTOPPULLUP_KMIN - #undef ENDSTOPPULLUP_KMAX - #undef K_MIN_ENDSTOP_HIT_STATE - #undef K_MAX_ENDSTOP_HIT_STATE - #undef K_ENABLE_ON - #undef DISABLE_K - #undef INVERT_K_DIR - #undef K_HOME_DIR - #undef K_MIN_POS - #undef K_MAX_POS - #undef MANUAL_K_HOME_POS - #undef MIN_SOFTWARE_ENDSTOP_K - #undef MAX_SOFTWARE_ENDSTOP_K +// Aliases for LCD features +#if !DGUS_UI_IS(NONE) || ENABLED(ANYCUBIC_LCD_VYPER) + #define HAS_DGUS_LCD 1 + #if DGUS_UI_IS(ORIGIN, FYSETC, HIPRECY, MKS) + #define HAS_DGUS_LCD_CLASSIC 1 + #endif #endif -#if !HAS_U_AXIS - #undef ENDSTOPPULLUP_UMIN - #undef ENDSTOPPULLUP_UMAX - #undef U_MIN_ENDSTOP_HIT_STATE - #undef U_MAX_ENDSTOP_HIT_STATE - #undef U_ENABLE_ON - #undef DISABLE_U - #undef INVERT_U_DIR - #undef U_HOME_DIR - #undef U_MIN_POS - #undef U_MAX_POS - #undef MANUAL_U_HOME_POS - #undef MIN_SOFTWARE_ENDSTOP_U - #undef MAX_SOFTWARE_ENDSTOP_U +// Extensible UI serial touch screens. (See src/lcd/extui) +#if ANY(HAS_DGUS_LCD, MALYAN_LCD, ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, NEXTION_TFT, TOUCH_UI_FTDI_EVE) + #define IS_EXTUI 1 // Just for sanity check. + #define EXTENSIBLE_UI #endif -#if !HAS_V_AXIS - #undef ENDSTOPPULLUP_VMIN - #undef ENDSTOPPULLUP_VMAX - #undef V_MIN_ENDSTOP_HIT_STATE - #undef V_MAX_ENDSTOP_HIT_STATE - #undef V_ENABLE_ON - #undef DISABLE_V - #undef INVERT_V_DIR - #undef V_HOME_DIR - #undef V_MIN_POS - #undef V_MAX_POS - #undef MANUAL_V_HOME_POS - #undef MIN_SOFTWARE_ENDSTOP_V - #undef MAX_SOFTWARE_ENDSTOP_V +// Aliases for LCD features +#if ANY(DWIN_CREALITY_LCD, DWIN_LCD_PROUI) + #define HAS_DWIN_E3V2_BASIC 1 +#endif +#if ANY(HAS_DWIN_E3V2_BASIC, DWIN_CREALITY_LCD_JYERSUI) + #define HAS_DWIN_E3V2 1 #endif -#if !HAS_W_AXIS - #undef ENDSTOPPULLUP_WMIN - #undef ENDSTOPPULLUP_WMAX - #undef W_MIN_ENDSTOP_HIT_STATE - #undef W_MAX_ENDSTOP_HIT_STATE - #undef W_ENABLE_ON - #undef DISABLE_W - #undef INVERT_W_DIR - #undef W_HOME_DIR - #undef W_MIN_POS - #undef W_MAX_POS - #undef MANUAL_W_HOME_POS - #undef MIN_SOFTWARE_ENDSTOP_W - #undef MAX_SOFTWARE_ENDSTOP_W +// E3V2 extras +#if HAS_DWIN_E3V2 || IS_DWIN_MARLINUI + #define SERIAL_CATCHALL 0 + #define HAS_LCD_BRIGHTNESS 1 + #define LCD_BRIGHTNESS_MAX 250 #endif -#define _OR_HAS_DA(A) ENABLED(DISABLE_##A) || -#if MAP(_OR_HAS_DA, X, Y, Z, I, J, K, U, V, W) 0 - #define HAS_DISABLE_MAIN_AXES 1 +#if ENABLED(DWIN_LCD_PROUI) + #define DO_LIST_BIN_FILES 1 + #define LCD_BRIGHTNESS_DEFAULT 127 #endif -#if HAS_DISABLE_MAIN_AXES || ENABLED(DISABLE_E) - #define HAS_DISABLE_AXES 1 + +// Serial Controllers require LCD_SERIAL_PORT +#if ANY(IS_DWIN_MARLINUI, HAS_DWIN_E3V2, HAS_DGUS_LCD, MALYAN_LCD, ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, NEXTION_TFT) + #define LCD_IS_SERIAL_HOST 1 #endif -#undef _OR_HAS_DA -#ifdef X2_DRIVER_TYPE - #define HAS_X2_STEPPER 1 +#if HAS_WIRED_LCD + #if ENABLED(DOGLCD) + #define HAS_MARLINUI_U8GLIB 1 + #elif IS_TFTGLCD_PANEL + // Neither DOGM nor HD44780. Fully customized interface. + #elif IS_DWIN_MARLINUI + // Since HAS_MARLINUI_U8GLIB refers to U8G displays + // the DWIN display can define its own flags + #elif !HAS_GRAPHICAL_TFT + #define HAS_MARLINUI_HD44780 1 + #endif #endif -#ifdef Y2_DRIVER_TYPE - #define HAS_Y2_STEPPER 1 + +#if ANY(HAS_WIRED_LCD, EXTENSIBLE_UI, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) + /** + * HAS_DISPLAY indicates the display uses these MarlinUI methods... + * - update + * - abort_print + * - pause_print + * - resume_print + * - poweroff (for PSU_CONTROL and HAS_MARLINUI_MENU) + * + * ...and implements these MarlinUI methods: + * - zoffset_overlay (if BABYSTEP_GFX_OVERLAY or MESH_EDIT_GFX_OVERLAY are supported) + * - draw_kill_screen + * - kill_screen + * - draw_status_message + */ + #define HAS_DISPLAY 1 #endif -/** - * Number of Primary Linear Axes (e.g., XYZ) - * X, XY, or XYZ axes. Excluding duplicate axes (X2, Y2, Z2, Z3, Z4) - */ -#if NUM_AXES >= 3 - #define PRIMARY_LINEAR_AXES 3 -#else - #define PRIMARY_LINEAR_AXES NUM_AXES +#if HAS_WIRED_LCD && !HAS_GRAPHICAL_TFT && !IS_DWIN_MARLINUI + #define HAS_LCDPRINT 1 #endif -/** - * Number of Secondary Axes (e.g., IJKUVW) - * All linear/rotational axes between XYZ and E. - */ -#define SECONDARY_AXES SUB3(NUM_AXES) +#if HAS_DISPLAY || HAS_LCDPRINT + #define HAS_UTF8_UTILS 1 +#endif -/** - * Number of Rotational Axes (e.g., IJK) - * All axes for which AXIS*_ROTATES is defined. - * For these axes, positions are specified in angular degrees. - */ -#if ENABLED(AXIS9_ROTATES) - #define ROTATIONAL_AXES 6 -#elif ENABLED(AXIS8_ROTATES) - #define ROTATIONAL_AXES 5 -#elif ENABLED(AXIS7_ROTATES) - #define ROTATIONAL_AXES 4 -#elif ENABLED(AXIS6_ROTATES) - #define ROTATIONAL_AXES 3 -#elif ENABLED(AXIS5_ROTATES) - #define ROTATIONAL_AXES 2 -#elif ENABLED(AXIS4_ROTATES) - #define ROTATIONAL_AXES 1 -#else - #define ROTATIONAL_AXES 0 +#if ANY(HAS_DISPLAY, HAS_DWIN_E3V2) + #define HAS_STATUS_MESSAGE 1 #endif -/** - * Number of Secondary Linear Axes (e.g., UVW) - * All secondary axes for which AXIS*_ROTATES is not defined. - * Excluding primary axes and excluding duplicate axes (X2, Y2, Z2, Z3, Z4) - */ -#define SECONDARY_LINEAR_AXES (NUM_AXES - PRIMARY_LINEAR_AXES - ROTATIONAL_AXES) +#if IS_ULTIPANEL && DISABLED(NO_LCD_MENUS) + #define HAS_MARLINUI_MENU 1 +#endif -/** - * Number of Logical Axes (e.g., XYZIJKUVWE) - * All logical axes that can be commanded directly by G-code. - * Delta maps stepper-specific values to ABC steppers. - */ -#if HAS_EXTRUDERS - #define LOGICAL_AXES INCREMENT(NUM_AXES) -#else - #define LOGICAL_AXES NUM_AXES +#if ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI, HAS_DWIN_E3V2) + #define HAS_MANUAL_MOVE_MENU 1 +#endif + +#if HAS_MARLINUI_U8GLIB + #ifndef LCD_PIXEL_WIDTH + #define LCD_PIXEL_WIDTH 128 + #endif + #ifndef LCD_PIXEL_HEIGHT + #define LCD_PIXEL_HEIGHT 64 + #endif #endif /** - * DISTINCT_E_FACTORS is set to give extruders (some) individual settings. - * - * DISTINCT_AXES is the number of distinct addressable axes (not steppers). - * Includes all linear axes plus all distinguished extruders. - * The default behavior is to treat all extruders as a single E axis - * with shared motion and temperature settings. - * - * DISTINCT_E is the number of distinguished extruders. By default this - * will be 1 which indicates all extruders share the same settings. - * - * E_INDEX_N(E) should be used to get the E index of any item that might be - * distinguished. + * Multi-Material-Unit supported models */ -#if ENABLED(DISTINCT_E_FACTORS) && E_STEPPERS > 1 - #define DISTINCT_AXES (NUM_AXES + E_STEPPERS) - #define DISTINCT_E E_STEPPERS - #define E_INDEX_N(E) (E) -#else - #undef DISTINCT_E_FACTORS - #define DISTINCT_AXES LOGICAL_AXES - #define DISTINCT_E 1 - #define E_INDEX_N(E) 0 -#endif +#define PRUSA_MMU1 1 +#define PRUSA_MMU2 2 +#define PRUSA_MMU2S 3 +#define EXTENDABLE_EMU_MMU2 12 +#define EXTENDABLE_EMU_MMU2S 13 -// Helper macros for extruder and hotend arrays -#define _EXTRUDER_LOOP(E) for (int8_t E = 0; E < EXTRUDERS; E++) -#define EXTRUDER_LOOP() _EXTRUDER_LOOP(e) -#define _HOTEND_LOOP(H) for (int8_t H = 0; H < HOTENDS; H++) -#define HOTEND_LOOP() _HOTEND_LOOP(e) +#ifdef MMU_MODEL + #define HAS_MMU 1 + #if MMU_MODEL == PRUSA_MMU1 + #define HAS_PRUSA_MMU1 1 + #elif MMU_MODEL % 10 == PRUSA_MMU2 + #define HAS_PRUSA_MMU2 1 + #elif MMU_MODEL % 10 == PRUSA_MMU2S + #define HAS_PRUSA_MMU2 1 + #define HAS_PRUSA_MMU2S 1 + #endif + #if MMU_MODEL >= EXTENDABLE_EMU_MMU2 + #define HAS_EXTENDABLE_MMU 1 + #endif +#endif -#define ARRAY_BY_EXTRUDERS(V...) ARRAY_N(EXTRUDERS, V) -#define ARRAY_BY_EXTRUDERS1(v1) ARRAY_N_1(EXTRUDERS, v1) -#define ARRAY_BY_HOTENDS(V...) ARRAY_N(HOTENDS, V) -#define ARRAY_BY_HOTENDS1(v1) ARRAY_N_1(HOTENDS, v1) +#undef PRUSA_MMU1 +#undef PRUSA_MMU2 +#undef PRUSA_MMU2S +#undef EXTENDABLE_EMU_MMU2 +#undef EXTENDABLE_EMU_MMU2S /** * Disable unused SINGLENOZZLE sub-options @@ -1124,6 +1124,11 @@ #undef SINGLENOZZLE_STANDBY_FAN #endif +// No inactive extruders with SWITCHING_NOZZLE or Průša MMU1 or just 1 E stepper exists +#if HAS_SWITCHING_NOZZLE || HAS_PRUSA_MMU1 || E_STEPPERS < 2 + #undef DISABLE_OTHER_EXTRUDERS +#endif + // Switching extruder has its own servo? #if ENABLED(SWITCHING_EXTRUDER) && (!HAS_SWITCHING_NOZZLE || SWITCHING_EXTRUDER_SERVO_NR != SWITCHING_NOZZLE_SERVO_NR) #define DO_SWITCH_EXTRUDER 1 @@ -1553,6 +1558,14 @@ #define BOOT_MARLIN_LOGO_SMALL #endif +// Flow and feedrate editing +#if HAS_EXTRUDERS && ANY(HAS_MARLINUI_MENU, DWIN_CREALITY_LCD, DWIN_LCD_PROUI, MALYAN_LCD, TOUCH_SCREEN) + #define HAS_FLOW_EDIT 1 +#endif +#if ANY(HAS_MARLINUI_MENU, ULTIPANEL_FEEDMULTIPLY, DWIN_CREALITY_LCD, DWIN_LCD_PROUI, MALYAN_LCD, TOUCH_SCREEN) + #define HAS_FEEDRATE_EDIT 1 +#endif + /** * CoreXY, CoreXZ, and CoreYZ - and their reverse */ From ede57618b04af05523590ed7c59dd2ed91627d26 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 24 Nov 2023 11:47:32 -0600 Subject: [PATCH 5/6] speed --- Marlin/src/lcd/marlinui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 4dbc87a13f86..178f0b74ecc5 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -695,7 +695,7 @@ void MarlinUI::init() { else if ((old_frm < 100 && new_frm > 100) || (old_frm > 100 && new_frm < 100)) new_frm = 100; - LIMIT(new_frm, FLOW_EDIT_MIN, FLOW_EDIT_MAX); + LIMIT(new_frm, SPEED_EDIT_MIN, SPEED_EDIT_MAX); if (old_frm != new_frm) { feedrate_percentage = new_frm; From 91e5438676e6e60e061c09a0945a9f332b970e30 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 24 Nov 2023 12:05:07 -0600 Subject: [PATCH 6/6] reorder --- Marlin/src/inc/Conditionals_LCD.h | 82 +++++++++++++++---------------- 1 file changed, 39 insertions(+), 43 deletions(-) diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index b797c6ad3538..955b8fd960f4 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -79,6 +79,37 @@ #define HAS_SWITCHING_NOZZLE 1 #endif +/** + * Multi-Material-Unit supported models + */ +#define PRUSA_MMU1 1 +#define PRUSA_MMU2 2 +#define PRUSA_MMU2S 3 +#define EXTENDABLE_EMU_MMU2 12 +#define EXTENDABLE_EMU_MMU2S 13 + +#ifdef MMU_MODEL + #define HAS_MMU 1 + #define SINGLENOZZLE + #if MMU_MODEL == PRUSA_MMU1 + #define HAS_PRUSA_MMU1 1 + #elif MMU_MODEL % 10 == PRUSA_MMU2 + #define HAS_PRUSA_MMU2 1 + #elif MMU_MODEL % 10 == PRUSA_MMU2S + #define HAS_PRUSA_MMU2 1 + #define HAS_PRUSA_MMU2S 1 + #endif + #if MMU_MODEL >= EXTENDABLE_EMU_MMU2 + #define HAS_EXTENDABLE_MMU 1 + #endif +#endif + +#undef PRUSA_MMU1 +#undef PRUSA_MMU2 +#undef PRUSA_MMU2S +#undef EXTENDABLE_EMU_MMU2 +#undef EXTENDABLE_EMU_MMU2S + #if ENABLED(E_DUAL_STEPPER_DRIVERS) // E0/E1 steppers act in tandem as E0 #define E_STEPPERS 2 @@ -114,11 +145,6 @@ #endif -// Průša MMU1, MMU(S) 2.0 and EXTENDABLE_EMU_MMU2(S) force SINGLENOZZLE -#if HAS_MMU - #define SINGLENOZZLE -#endif - // Default E steppers / manual motion is one per extruder #ifndef E_STEPPERS #define E_STEPPERS EXTRUDERS @@ -138,6 +164,14 @@ #define HOTENDS 0 // A machine with no hotends at all can still extrude #endif +// At least one hotend... +#if HOTENDS + #define HAS_HOTEND 1 + #ifndef HOTEND_OVERSHOOT + #define HOTEND_OVERSHOOT 15 + #endif +#endif + // More than one hotend... #if HOTENDS > 1 #define HAS_MULTI_HOTEND 1 @@ -157,14 +191,6 @@ #undef HOTEND_OFFSET_Z #endif -// At least one hotend... -#if HOTENDS - #define HAS_HOTEND 1 - #ifndef HOTEND_OVERSHOOT - #define HOTEND_OVERSHOOT 15 - #endif -#endif - // Clean up E-stepper-based settings... #if E_STEPPERS <= 7 #undef INVERT_E7_DIR @@ -1084,36 +1110,6 @@ #endif #endif -/** - * Multi-Material-Unit supported models - */ -#define PRUSA_MMU1 1 -#define PRUSA_MMU2 2 -#define PRUSA_MMU2S 3 -#define EXTENDABLE_EMU_MMU2 12 -#define EXTENDABLE_EMU_MMU2S 13 - -#ifdef MMU_MODEL - #define HAS_MMU 1 - #if MMU_MODEL == PRUSA_MMU1 - #define HAS_PRUSA_MMU1 1 - #elif MMU_MODEL % 10 == PRUSA_MMU2 - #define HAS_PRUSA_MMU2 1 - #elif MMU_MODEL % 10 == PRUSA_MMU2S - #define HAS_PRUSA_MMU2 1 - #define HAS_PRUSA_MMU2S 1 - #endif - #if MMU_MODEL >= EXTENDABLE_EMU_MMU2 - #define HAS_EXTENDABLE_MMU 1 - #endif -#endif - -#undef PRUSA_MMU1 -#undef PRUSA_MMU2 -#undef PRUSA_MMU2S -#undef EXTENDABLE_EMU_MMU2 -#undef EXTENDABLE_EMU_MMU2S - /** * Disable unused SINGLENOZZLE sub-options */