From bd872a7a98528da6e1fab95382488ce703fe24c1 Mon Sep 17 00:00:00 2001 From: Vovodroid Date: Fri, 24 Nov 2023 21:03:06 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Configurable=20FR/Flow=20edit=20?= =?UTF-8?q?ranges=20(#26446)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/Configuration_adv.h | 11 +- Marlin/src/inc/Conditionals_LCD.h | 1079 ++++++++++++------------ 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, 577 insertions(+), 565 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 275bcaa669..b72f7d8da1 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 HAS_FEEDRATE_EDIT + #define SPEED_EDIT_MIN 10 // (%) Feedrate percentage edit range minimum + #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 //#define SET_PROGRESS_MANUALLY #if ENABLED(SET_PROGRESS_MANUALLY) diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index a252edfb4a..955b8fd960 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -26,10 +26,541 @@ * Conditionals that need to be set before Configuration_adv.h or pins.h */ +/** + * 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 +#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 +#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 + #define E_MANUAL 1 + +#elif HAS_SWITCHING_EXTRUDER // One stepper for every two EXTRUDERS + + #if EXTRUDERS > 4 + #define E_STEPPERS 3 + #elif EXTRUDERS > 2 + #define E_STEPPERS 2 + #else + #define E_STEPPERS 1 + #endif + +#elif ENABLED(MIXING_EXTRUDER) // Multiple feeds are mixed proportionally + + #define E_STEPPERS MIXING_STEPPERS + #define E_MANUAL 1 + #if MIXING_STEPPERS == 2 + #define HAS_DUAL_MIXING 1 + #endif + +#elif ENABLED(SWITCHING_TOOLHEAD) // Toolchanger + + #define E_STEPPERS EXTRUDERS + #define E_MANUAL EXTRUDERS + +#elif HAS_PRUSA_MMU2 // Průša Multi-Material Unit v2 + + #define E_STEPPERS 1 + #define E_MANUAL 1 + +#endif + +// 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 + +// 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 + +// 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 + #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 + +// 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 @@ -579,541 +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 - -/** - * 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 -#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 -#endif - -#if ENABLED(E_DUAL_STEPPER_DRIVERS) // E0/E1 steppers act in tandem as E0 - - #define E_STEPPERS 2 - #define E_MANUAL 1 - -#elif HAS_SWITCHING_EXTRUDER // One stepper for every two EXTRUDERS - - #if EXTRUDERS > 4 - #define E_STEPPERS 3 - #elif EXTRUDERS > 2 - #define E_STEPPERS 2 - #else - #define E_STEPPERS 1 - #endif - -#elif ENABLED(MIXING_EXTRUDER) // Multiple feeds are mixed proportionally - - #define E_STEPPERS MIXING_STEPPERS - #define E_MANUAL 1 - #if MIXING_STEPPERS == 2 - #define HAS_DUAL_MIXING 1 - #endif - -#elif ENABLED(SWITCHING_TOOLHEAD) // Toolchanger - - #define E_STEPPERS EXTRUDERS - #define E_MANUAL EXTRUDERS - -#elif HAS_PRUSA_MMU2 // Průša Multi-Material Unit v2 - - #define E_STEPPERS 1 - #define E_MANUAL 1 - -#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 - -// 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 -#endif -#ifndef E_MANUAL - #define E_MANUAL EXTRUDERS -#endif - -// 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 - -// 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 -#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) - /** * Disable unused SINGLENOZZLE sub-options */ @@ -1124,6 +1120,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 +1554,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 */ diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index c71ab8cff2..f3935f39dd 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 341521ee84..366ecffbd9 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 @@ -2254,8 +2252,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) @@ -2263,7 +2261,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); } @@ -2308,7 +2306,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 d1c2387682..c2e6bcdb7d 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 49b9fecad8..178f0b74ec 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, SPEED_EDIT_MIN, SPEED_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 ea26b48907..4d3e33db4c 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 c36ac013b8..ecd4e5f342 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 4d5056183b..8e79e397ad 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, 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], 10, 999, []{ 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], 10, 999, []{ 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