From a0a963fe1d989c7ef04b9f5f42dc42590bff1203 Mon Sep 17 00:00:00 2001 From: Giuliano Zaro <3684609+GMagician@users.noreply.github.com> Date: Tue, 26 Apr 2022 05:03:16 +0200 Subject: [PATCH 001/241] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20"elapsed"=20text?= =?UTF-8?q?=20on=20DOGLCD=20(#24087)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/dogm/status_screen_DOGM.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp index 47b5a3e20b0a..010a1397f620 100644 --- a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp @@ -791,7 +791,7 @@ void MarlinUI::draw_status_screen() { lcd_put_u8str(estimation_x_pos, EXTRAS_BASELINE, estimation_string); } else if (elapsed_string[0]) { - lcd_put_u8str_P(PROGRESS_BAR_X, EXTRAS_BASELINE, E_LBL); + lcd_put_u8str(PROGRESS_BAR_X, EXTRAS_BASELINE, F("E:")); lcd_put_u8str(elapsed_x_pos, EXTRAS_BASELINE, elapsed_string); } From e633ef895db41799606c396855de076e21c66b20 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 26 Apr 2022 06:00:51 +0000 Subject: [PATCH 002/241] [cron] Bump distribution date (2022-04-26) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 12a67a2461e9..dff1b1a05b85 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-04-24" +//#define STRING_DISTRIBUTION_DATE "2022-04-26" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 6e3be7545df0..51bb2d09659b 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-04-24" + #define STRING_DISTRIBUTION_DATE "2022-04-26" #endif /** From 60b6df4542d78e8263f75a989c77c2f386a894fc Mon Sep 17 00:00:00 2001 From: tombrazier <68918209+tombrazier@users.noreply.github.com> Date: Fri, 29 Apr 2022 18:54:57 +0100 Subject: [PATCH 003/241] =?UTF-8?q?=F0=9F=90=9B=20Fix=20kinetic=20ABL=20me?= =?UTF-8?q?sh=20after=20refactor=20(#24107)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #23868 --- Marlin/src/feature/bedlevel/abl/bbl.h | 1 + Marlin/src/gcode/bedlevel/abl/G29.cpp | 4 ++++ Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp | 5 ++--- Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Marlin/src/feature/bedlevel/abl/bbl.h b/Marlin/src/feature/bedlevel/abl/bbl.h index 86da5aea1075..fbdb22cd00c9 100644 --- a/Marlin/src/feature/bedlevel/abl/bbl.h +++ b/Marlin/src/feature/bedlevel/abl/bbl.h @@ -24,6 +24,7 @@ #include "../../../inc/MarlinConfigPre.h" class LevelingBilinear { +private: static xy_pos_t grid_spacing, grid_start; static xy_float_t grid_factor; static bed_mesh_t z_values; diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 3743f1ffc6a9..f9bdbf5e9f97 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -507,6 +507,10 @@ G29_TYPE GcodeSuite::G29() { // Can't re-enable (on error) until the new grid is written abl.reenable = false; } + + // Pre-populate local Z values from the stored mesh + TERN_(IS_KINEMATIC, COPY(abl.z_values, Z_VALUES_ARR)); + #endif // AUTO_BED_LEVELING_BILINEAR } // !g29_in_progress diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp index 6388e1683d05..0b584fac3bce 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp @@ -200,7 +200,7 @@ void DGUSScreenHandler::StoreSettings(char *buff) { data.initialized = true; data.volume = dgus_display.GetVolume(); data.brightness = dgus_display.GetBrightness(); - data.abl = (ExtUI::getLevelingActive() && ExtUI::getMeshValid()); + data.abl_okay = (ExtUI::getLevelingActive() && ExtUI::getMeshValid()); memcpy(buff, &data, sizeof(data)); } @@ -216,8 +216,7 @@ void DGUSScreenHandler::LoadSettings(const char *buff) { dgus_display.SetBrightness(data.initialized ? data.brightness : DGUS_DEFAULT_BRIGHTNESS); if (data.initialized) { - leveling_active = (data.abl && ExtUI::getMeshValid()); - + leveling_active = (data.abl_okay && ExtUI::getMeshValid()); ExtUI::setLevelingActive(leveling_active); } } diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h index 509d59920066..cc59bda6d7fa 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h @@ -134,7 +134,7 @@ class DGUSScreenHandler { bool initialized; uint8_t volume; uint8_t brightness; - bool abl; + bool abl_okay; } eeprom_data_t; }; From 5c47476e0c961401c55a97e4b1cc146150221c60 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 29 Apr 2022 18:14:41 +0000 Subject: [PATCH 004/241] [cron] Bump distribution date (2022-04-29) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index dff1b1a05b85..fba79352097c 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-04-26" +//#define STRING_DISTRIBUTION_DATE "2022-04-29" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 51bb2d09659b..885edefb8e06 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-04-26" + #define STRING_DISTRIBUTION_DATE "2022-04-29" #endif /** From 12eb1e0829e5c4625d8ecddfd3bdea8f7e2ccc9f Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Fri, 29 Apr 2022 13:19:38 -0700 Subject: [PATCH 005/241] =?UTF-8?q?=F0=9F=93=9D=20Update=20NEOPIXEL=5FTYPE?= =?UTF-8?q?=20comment=20(#24110)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index b06a2cafbc78..5e58d5273237 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -3051,7 +3051,8 @@ // Support for Adafruit NeoPixel LED driver //#define NEOPIXEL_LED #if ENABLED(NEOPIXEL_LED) - #define NEOPIXEL_TYPE NEO_GRBW // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h) + #define NEOPIXEL_TYPE NEO_GRBW // NEO_GRBW, NEO_RGBW, NEO_GRB, NEO_RBG, etc. + // See https://github.com/adafruit/Adafruit_NeoPixel/blob/master/Adafruit_NeoPixel.h //#define NEOPIXEL_PIN 4 // LED driving pin //#define NEOPIXEL2_TYPE NEOPIXEL_TYPE //#define NEOPIXEL2_PIN 5 From b37d13af7278c241064b61279e7e8538a03206a3 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 29 Apr 2022 15:21:15 -0500 Subject: [PATCH 006/241] =?UTF-8?q?=F0=9F=94=A7=20Base=20NUM=5FAXES=20on?= =?UTF-8?q?=20defined=20DRIVER=5FTYPEs=20(#24106)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 100 ++++----- Marlin/src/inc/Conditionals_LCD.h | 264 +++++++++++++++--------- Marlin/src/inc/Warnings.cpp | 4 + Marlin/src/libs/L64XX/L64XX_Marlin.cpp | 14 +- Marlin/src/module/motion.cpp | 18 +- Marlin/src/module/stepper.cpp | 20 +- Marlin/src/module/stepper/indirection.h | 168 +++++++-------- 7 files changed, 320 insertions(+), 268 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 5e58d5273237..04e1115728f4 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -150,20 +150,45 @@ //#define MACHINE_UUID "00000000-0000-0000-0000-000000000000" /** - * Define the number of coordinated axes. - * See https://github.com/DerAndere1/Marlin/wiki - * Each axis gets its own stepper control and endstop: + * Stepper Drivers + * + * These settings allow Marlin to tune stepper driver timing and enable advanced options for + * stepper drivers that support them. You may also override timing options in Configuration_adv.h. + * + * A4988 is assumed for unspecified drivers. * - * Steppers: *_STEP_PIN, *_ENABLE_PIN, *_DIR_PIN, *_ENABLE_ON - * Endstops: *_STOP_PIN, USE_*MIN_PLUG, USE_*MAX_PLUG - * Axes: *_MIN_POS, *_MAX_POS, INVERT_*_DIR - * Planner: DEFAULT_AXIS_STEPS_PER_UNIT, DEFAULT_MAX_FEEDRATE - * DEFAULT_MAX_ACCELERATION, AXIS_RELATIVE_MODES, - * MICROSTEP_MODES, MANUAL_FEEDRATE + * Use TMC2208/TMC2208_STANDALONE for TMC2225 drivers and TMC2209/TMC2209_STANDALONE for TMC2226 drivers. * - * :[3, 4, 5, 6, 7, 8, 9] + * Options: A4988, A5984, DRV8825, LV8729, L6470, L6474, POWERSTEP01, + * TB6560, TB6600, TMC2100, + * TMC2130, TMC2130_STANDALONE, TMC2160, TMC2160_STANDALONE, + * TMC2208, TMC2208_STANDALONE, TMC2209, TMC2209_STANDALONE, + * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, + * TMC5130, TMC5130_STANDALONE, TMC5160, TMC5160_STANDALONE + * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'L6474', 'POWERSTEP01', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE'] */ -//#define NUM_AXES 3 +#define X_DRIVER_TYPE A4988 +#define Y_DRIVER_TYPE A4988 +#define Z_DRIVER_TYPE A4988 +//#define X2_DRIVER_TYPE A4988 +//#define Y2_DRIVER_TYPE A4988 +//#define Z2_DRIVER_TYPE A4988 +//#define Z3_DRIVER_TYPE A4988 +//#define Z4_DRIVER_TYPE A4988 +//#define I_DRIVER_TYPE A4988 +//#define J_DRIVER_TYPE A4988 +//#define K_DRIVER_TYPE A4988 +//#define U_DRIVER_TYPE A4988 +//#define V_DRIVER_TYPE A4988 +//#define W_DRIVER_TYPE A4988 +#define E0_DRIVER_TYPE A4988 +//#define E1_DRIVER_TYPE A4988 +//#define E2_DRIVER_TYPE A4988 +//#define E3_DRIVER_TYPE A4988 +//#define E4_DRIVER_TYPE A4988 +//#define E5_DRIVER_TYPE A4988 +//#define E6_DRIVER_TYPE A4988 +//#define E7_DRIVER_TYPE A4988 /** * Additional Axis Settings @@ -182,27 +207,27 @@ * * Regardless of these settings the axes are internally named I, J, K, U, V, W. */ -#if NUM_AXES >= 4 +#ifdef I_DRIVER_TYPE #define AXIS4_NAME 'A' // :['A', 'B', 'C', 'U', 'V', 'W'] #define AXIS4_ROTATES #endif -#if NUM_AXES >= 5 +#ifdef J_DRIVER_TYPE #define AXIS5_NAME 'B' // :['B', 'C', 'U', 'V', 'W'] #define AXIS5_ROTATES #endif -#if NUM_AXES >= 6 +#ifdef K_DRIVER_TYPE #define AXIS6_NAME 'C' // :['C', 'U', 'V', 'W'] #define AXIS6_ROTATES #endif -#if NUM_AXES >= 7 +#ifdef U_DRIVER_TYPE #define AXIS7_NAME 'U' // :['U', 'V', 'W'] //#define AXIS7_ROTATES #endif -#if NUM_AXES >= 8 +#ifdef V_DRIVER_TYPE #define AXIS8_NAME 'V' // :['V', 'W'] //#define AXIS8_ROTATES #endif -#if NUM_AXES >= 9 +#ifdef W_DRIVER_TYPE #define AXIS9_NAME 'W' // :['W'] //#define AXIS9_ROTATES #endif @@ -941,47 +966,6 @@ #define W_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. #define Z_MIN_PROBE_ENDSTOP_INVERTING false // Set to true to invert the logic of the probe. -/** - * Stepper Drivers - * - * These settings allow Marlin to tune stepper driver timing and enable advanced options for - * stepper drivers that support them. You may also override timing options in Configuration_adv.h. - * - * A4988 is assumed for unspecified drivers. - * - * Use TMC2208/TMC2208_STANDALONE for TMC2225 drivers and TMC2209/TMC2209_STANDALONE for TMC2226 drivers. - * - * Options: A4988, A5984, DRV8825, LV8729, L6470, L6474, POWERSTEP01, - * TB6560, TB6600, TMC2100, - * TMC2130, TMC2130_STANDALONE, TMC2160, TMC2160_STANDALONE, - * TMC2208, TMC2208_STANDALONE, TMC2209, TMC2209_STANDALONE, - * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE, TMC5160, TMC5160_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'L6474', 'POWERSTEP01', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE'] - */ -#define X_DRIVER_TYPE A4988 -#define Y_DRIVER_TYPE A4988 -#define Z_DRIVER_TYPE A4988 -//#define X2_DRIVER_TYPE A4988 -//#define Y2_DRIVER_TYPE A4988 -//#define Z2_DRIVER_TYPE A4988 -//#define Z3_DRIVER_TYPE A4988 -//#define Z4_DRIVER_TYPE A4988 -//#define I_DRIVER_TYPE A4988 -//#define J_DRIVER_TYPE A4988 -//#define K_DRIVER_TYPE A4988 -//#define U_DRIVER_TYPE A4988 -//#define V_DRIVER_TYPE A4988 -//#define W_DRIVER_TYPE A4988 -#define E0_DRIVER_TYPE A4988 -//#define E1_DRIVER_TYPE A4988 -//#define E2_DRIVER_TYPE A4988 -//#define E3_DRIVER_TYPE A4988 -//#define E4_DRIVER_TYPE A4988 -//#define E5_DRIVER_TYPE A4988 -//#define E6_DRIVER_TYPE A4988 -//#define E7_DRIVER_TYPE A4988 - // Enable this feature if all enabled endstop pins are interrupt-capable. // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 95647d100e25..2945bec4a563 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -679,8 +679,29 @@ * Number of Linear Axes (e.g., XYZIJKUVW) * All the logical axes except for the tool (E) axis */ -#ifndef NUM_AXES - #define NUM_AXES XYZ +#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 +#else + #define NUM_AXES 1 #endif #if NUM_AXES >= XY #define HAS_Y_AXIS 1 @@ -707,6 +728,147 @@ #endif #endif +#if E_STEPPERS <= 0 + #undef E0_DRIVER_TYPE +#endif +#if E_STEPPERS <= 1 + #undef E1_DRIVER_TYPE +#endif +#if E_STEPPERS <= 2 + #undef E2_DRIVER_TYPE +#endif +#if E_STEPPERS <= 3 + #undef E3_DRIVER_TYPE +#endif +#if E_STEPPERS <= 4 + #undef E4_DRIVER_TYPE +#endif +#if E_STEPPERS <= 5 + #undef E5_DRIVER_TYPE +#endif +#if E_STEPPERS <= 6 + #undef E6_DRIVER_TYPE +#endif +#if E_STEPPERS <= 7 + #undef E7_DRIVER_TYPE +#endif + +#if !HAS_Y_AXIS + #undef ENDSTOPPULLUP_YMIN + #undef ENDSTOPPULLUP_YMAX + #undef Y_MIN_ENDSTOP_INVERTING + #undef Y_MAX_ENDSTOP_INVERTING + #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 +#endif + +#if !HAS_Z_AXIS + #undef ENDSTOPPULLUP_ZMIN + #undef ENDSTOPPULLUP_ZMAX + #undef Z_MIN_ENDSTOP_INVERTING + #undef Z_MAX_ENDSTOP_INVERTING + #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 +#endif + +#if !HAS_I_AXIS + #undef ENDSTOPPULLUP_IMIN + #undef ENDSTOPPULLUP_IMAX + #undef I_MIN_ENDSTOP_INVERTING + #undef I_MAX_ENDSTOP_INVERTING + #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 +#endif + +#if !HAS_J_AXIS + #undef ENDSTOPPULLUP_JMIN + #undef ENDSTOPPULLUP_JMAX + #undef J_MIN_ENDSTOP_INVERTING + #undef J_MAX_ENDSTOP_INVERTING + #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 +#endif + +#if !HAS_K_AXIS + #undef ENDSTOPPULLUP_KMIN + #undef ENDSTOPPULLUP_KMAX + #undef K_MIN_ENDSTOP_INVERTING + #undef K_MAX_ENDSTOP_INVERTING + #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 +#endif + +#if !HAS_U_AXIS + #undef ENDSTOPPULLUP_UMIN + #undef ENDSTOPPULLUP_UMAX + #undef U_MIN_ENDSTOP_INVERTING + #undef U_MAX_ENDSTOP_INVERTING + #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 +#endif + +#if !HAS_V_AXIS + #undef ENDSTOPPULLUP_VMIN + #undef ENDSTOPPULLUP_VMAX + #undef V_MIN_ENDSTOP_INVERTING + #undef V_MAX_ENDSTOP_INVERTING + #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 +#endif + +#if !HAS_W_AXIS + #undef ENDSTOPPULLUP_WMIN + #undef ENDSTOPPULLUP_WMAX + #undef W_MIN_ENDSTOP_INVERTING + #undef W_MAX_ENDSTOP_INVERTING + #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 +#endif + /** * Number of Primary Linear Axes (e.g., XYZ) * X, XY, or XYZ axes. Excluding duplicate axes (X2, Y2. Z2. Z3, Z4) @@ -1214,104 +1376,6 @@ #define HAS_ETHERNET 1 #endif -// Fallback Stepper Driver types that don't depend on Configuration_adv.h -#ifndef X_DRIVER_TYPE - #define X_DRIVER_TYPE A4988 -#endif -#ifndef X2_DRIVER_TYPE - #define X2_DRIVER_TYPE A4988 -#endif -#ifndef Y_DRIVER_TYPE - #define Y_DRIVER_TYPE A4988 -#endif -#ifndef Y2_DRIVER_TYPE - #define Y2_DRIVER_TYPE A4988 -#endif -#ifndef Z_DRIVER_TYPE - #define Z_DRIVER_TYPE A4988 -#endif -#ifndef Z2_DRIVER_TYPE - #define Z2_DRIVER_TYPE A4988 -#endif -#ifndef Z3_DRIVER_TYPE - #define Z3_DRIVER_TYPE A4988 -#endif -#ifndef Z4_DRIVER_TYPE - #define Z4_DRIVER_TYPE A4988 -#endif -#if E_STEPPERS <= 0 - #undef E0_DRIVER_TYPE -#elif !defined(E0_DRIVER_TYPE) - #define E0_DRIVER_TYPE A4988 -#endif -#if E_STEPPERS <= 1 - #undef E1_DRIVER_TYPE -#elif !defined(E1_DRIVER_TYPE) - #define E1_DRIVER_TYPE A4988 -#endif -#if E_STEPPERS <= 2 - #undef E2_DRIVER_TYPE -#elif !defined(E2_DRIVER_TYPE) - #define E2_DRIVER_TYPE A4988 -#endif -#if E_STEPPERS <= 3 - #undef E3_DRIVER_TYPE -#elif !defined(E3_DRIVER_TYPE) - #define E3_DRIVER_TYPE A4988 -#endif -#if E_STEPPERS <= 4 - #undef E4_DRIVER_TYPE -#elif !defined(E4_DRIVER_TYPE) - #define E4_DRIVER_TYPE A4988 -#endif -#if E_STEPPERS <= 5 - #undef E5_DRIVER_TYPE -#elif !defined(E5_DRIVER_TYPE) - #define E5_DRIVER_TYPE A4988 -#endif -#if E_STEPPERS <= 6 - #undef E6_DRIVER_TYPE -#elif !defined(E6_DRIVER_TYPE) - #define E6_DRIVER_TYPE A4988 -#endif -#if E_STEPPERS <= 7 - #undef E7_DRIVER_TYPE -#elif !defined(E7_DRIVER_TYPE) - #define E7_DRIVER_TYPE A4988 -#endif - -// Fallback axis inverting -#ifndef INVERT_X_DIR - #define INVERT_X_DIR false -#endif -#if HAS_Y_AXIS && !defined(INVERT_Y_DIR) - #define INVERT_Y_DIR false -#endif -#if HAS_Z_AXIS && !defined(INVERT_Z_DIR) - #define INVERT_Z_DIR false -#endif -#if HAS_I_AXIS && !defined(INVERT_I_DIR) - #define INVERT_I_DIR false -#endif -#if HAS_J_AXIS && !defined(INVERT_J_DIR) - #define INVERT_J_DIR false -#endif -#if HAS_K_AXIS && !defined(INVERT_K_DIR) - #define INVERT_K_DIR false -#endif -#if HAS_U_AXIS && !defined(INVERT_U_DIR) - #define INVERT_U_DIR false -#endif -#if HAS_V_AXIS && !defined(INVERT_V_DIR) - #define INVERT_V_DIR false -#endif -#if HAS_W_AXIS && !defined(INVERT_W_DIR) - #define INVERT_W_DIR false -#endif -#if HAS_EXTRUDERS && !defined(INVERT_E_DIR) - #define INVERT_E_DIR false -#endif - /** * This setting is also used by M109 when trying to calculate * a ballpark safe margin to prevent wait-forever situation. diff --git a/Marlin/src/inc/Warnings.cpp b/Marlin/src/inc/Warnings.cpp index 96f8dc7d54b2..6023247f9496 100644 --- a/Marlin/src/inc/Warnings.cpp +++ b/Marlin/src/inc/Warnings.cpp @@ -35,6 +35,10 @@ #warning "WARNING! Disable MARLIN_DEV_MODE for the final build!" #endif +#if NUM_AXES_WARNING + #warning "Note: NUM_AXES is now based on the *_DRIVER_TYPE settings so you can remove NUM_AXES from Configuration.h." +#endif + // Safety Features #if DISABLED(USE_WATCHDOG) #warning "Safety Alert! Enable USE_WATCHDOG for the final build!" diff --git a/Marlin/src/libs/L64XX/L64XX_Marlin.cpp b/Marlin/src/libs/L64XX/L64XX_Marlin.cpp index 30c837432440..8a20b8f58c8c 100644 --- a/Marlin/src/libs/L64XX/L64XX_Marlin.cpp +++ b/Marlin/src/libs/L64XX/L64XX_Marlin.cpp @@ -66,14 +66,14 @@ void echo_yes_no(const bool yes) { DEBUG_ECHOPGM_P(yes ? PSTR(" YES") : PSTR(" N uint8_t L64XX_Marlin::dir_commands[MAX_L64XX]; // array to hold direction command for each driver -#define _EN_ITEM(N) , INVERT_E##N##_DIR +#define _EN_ITEM(N) , ENABLED(INVERT_E##N##_DIR) const uint8_t L64XX_Marlin::index_to_dir[MAX_L64XX] = { - NUM_AXIS_LIST(INVERT_X_DIR, INVERT_Y_DIR, INVERT_Z_DIR, INVERT_I_DIR, INVERT_J_DIR, INVERT_K_DIR) - , (INVERT_X_DIR) ^ BOTH(X_DUAL_STEPPER_DRIVERS, INVERT_X2_VS_X_DIR) // X2 - , (INVERT_Y_DIR) ^ BOTH(Y_DUAL_STEPPER_DRIVERS, INVERT_Y2_VS_Y_DIR) // Y2 - , (INVERT_Z_DIR) ^ ENABLED(INVERT_Z2_VS_Z_DIR) // Z2 - , (INVERT_Z_DIR) ^ ENABLED(INVERT_Z3_VS_Z_DIR) // Z3 - , (INVERT_Z_DIR) ^ ENABLED(INVERT_Z4_VS_Z_DIR) // Z4 + NUM_AXIS_LIST(ENABLED(INVERT_X_DIR), ENABLED(INVERT_Y_DIR), ENABLED(INVERT_Z_DIR), ENABLED(INVERT_I_DIR), ENABLED(INVERT_J_DIR), ENABLED(INVERT_K_DIR), ENABLED(INVERT_U_DIR), ENABLED(INVERT_V_DIR), ENABLED(INVERT_W_DIR)) + , ENABLED(INVERT_X_DIR) ^ BOTH(X_DUAL_STEPPER_DRIVERS, INVERT_X2_VS_X_DIR) // X2 + , ENABLED(INVERT_Y_DIR) ^ BOTH(Y_DUAL_STEPPER_DRIVERS, INVERT_Y2_VS_Y_DIR) // Y2 + , ENABLED(INVERT_Z_DIR) ^ ENABLED(INVERT_Z2_VS_Z_DIR) // Z2 + , ENABLED(INVERT_Z_DIR) ^ ENABLED(INVERT_Z3_VS_Z_DIR) // Z3 + , ENABLED(INVERT_Z_DIR) ^ ENABLED(INVERT_Z4_VS_Z_DIR) // Z4 REPEAT(E_STEPPERS, _EN_ITEM) }; #undef _EN_ITEM diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 5195ad400f25..8bdf97c0e109 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -1754,7 +1754,7 @@ void prepare_line_to_destination() { phasePerUStep = PHASE_PER_MICROSTEP(X); phaseCurrent = stepperX.get_microstep_counter(); effectorBackoutDir = -X_HOME_DIR; - stepperBackoutDir = INVERT_X_DIR ? effectorBackoutDir : -effectorBackoutDir; + stepperBackoutDir = IF_DISABLED(INVERT_X_DIR, -)effectorBackoutDir; break; #endif #ifdef Y_MICROSTEPS @@ -1762,7 +1762,7 @@ void prepare_line_to_destination() { phasePerUStep = PHASE_PER_MICROSTEP(Y); phaseCurrent = stepperY.get_microstep_counter(); effectorBackoutDir = -Y_HOME_DIR; - stepperBackoutDir = INVERT_Y_DIR ? effectorBackoutDir : -effectorBackoutDir; + stepperBackoutDir = IF_DISABLED(INVERT_Y_DIR, -)effectorBackoutDir; break; #endif #ifdef Z_MICROSTEPS @@ -1770,7 +1770,7 @@ void prepare_line_to_destination() { phasePerUStep = PHASE_PER_MICROSTEP(Z); phaseCurrent = stepperZ.get_microstep_counter(); effectorBackoutDir = -Z_HOME_DIR; - stepperBackoutDir = INVERT_Z_DIR ? effectorBackoutDir : -effectorBackoutDir; + stepperBackoutDir = IF_DISABLED(INVERT_Z_DIR, -)effectorBackoutDir; break; #endif #ifdef I_MICROSTEPS @@ -1778,7 +1778,7 @@ void prepare_line_to_destination() { phasePerUStep = PHASE_PER_MICROSTEP(I); phaseCurrent = stepperI.get_microstep_counter(); effectorBackoutDir = -I_HOME_DIR; - stepperBackoutDir = INVERT_I_DIR ? effectorBackoutDir : -effectorBackoutDir; + stepperBackoutDir = IF_DISABLED(INVERT_I_DIR, -)effectorBackoutDir; break; #endif #ifdef J_MICROSTEPS @@ -1786,7 +1786,7 @@ void prepare_line_to_destination() { phasePerUStep = PHASE_PER_MICROSTEP(J); phaseCurrent = stepperJ.get_microstep_counter(); effectorBackoutDir = -J_HOME_DIR; - stepperBackoutDir = INVERT_J_DIR ? effectorBackoutDir : -effectorBackoutDir; + stepperBackoutDir = IF_DISABLED(INVERT_J_DIR, -)effectorBackoutDir; break; #endif #ifdef K_MICROSTEPS @@ -1794,7 +1794,7 @@ void prepare_line_to_destination() { phasePerUStep = PHASE_PER_MICROSTEP(K); phaseCurrent = stepperK.get_microstep_counter(); effectorBackoutDir = -K_HOME_DIR; - stepperBackoutDir = INVERT_K_DIR ? effectorBackoutDir : -effectorBackoutDir; + stepperBackoutDir = IF_DISABLED(INVERT_K_DIR, -)effectorBackoutDir; break; #endif #ifdef U_MICROSTEPS @@ -1802,7 +1802,7 @@ void prepare_line_to_destination() { phasePerUStep = PHASE_PER_MICROSTEP(U); phaseCurrent = stepperU.get_microstep_counter(); effectorBackoutDir = -U_HOME_DIR; - stepperBackoutDir = INVERT_U_DIR ? effectorBackoutDir : -effectorBackoutDir; + stepperBackoutDir = IF_DISABLED(INVERT_U_DIR, -)effectorBackoutDir; break; #endif #ifdef V_MICROSTEPS @@ -1810,7 +1810,7 @@ void prepare_line_to_destination() { phasePerUStep = PHASE_PER_MICROSTEP(V); phaseCurrent = stepperV.get_microstep_counter(); effectorBackoutDir = -V_HOME_DIR; - stepperBackoutDir = INVERT_V_DIR ? effectorBackoutDir : -effectorBackoutDir; + stepperBackoutDir = IF_DISABLED(INVERT_V_DIR, -)effectorBackoutDir; break; #endif #ifdef W_MICROSTEPS @@ -1818,7 +1818,7 @@ void prepare_line_to_destination() { phasePerUStep = PHASE_PER_MICROSTEP(W); phaseCurrent = stepperW.get_microstep_counter(); effectorBackoutDir = -W_HOME_DIR; - stepperBackoutDir = INVERT_W_DIR ? effectorBackoutDir : -effectorBackoutDir; + stepperBackoutDir = IF_DISABLED(INVERT_W_DIR, -)effectorBackoutDir; break; #endif default: return; diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 1140a6eb1e38..85b42f61bbbb 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -3058,7 +3058,7 @@ void Stepper::report_positions() { #define _ENABLE_AXIS(A) enable_axis(_AXIS(A)) #define _READ_DIR(AXIS) AXIS ##_DIR_READ() - #define _INVERT_DIR(AXIS) INVERT_## AXIS ##_DIR + #define _INVERT_DIR(AXIS) ENABLED(INVERT_## AXIS ##_DIR) #define _APPLY_DIR(AXIS, INVERT) AXIS ##_APPLY_DIR(INVERT, true) #if MINIMUM_STEPPER_PULSE @@ -3203,30 +3203,30 @@ void Stepper::report_positions() { U_DIR_READ(), V_DIR_READ(), W_DIR_READ() ); - X_DIR_WRITE(INVERT_X_DIR ^ z_direction); + X_DIR_WRITE(ENABLED(INVERT_X_DIR) ^ z_direction); #ifdef Y_DIR_WRITE - Y_DIR_WRITE(INVERT_Y_DIR ^ z_direction); + Y_DIR_WRITE(ENABLED(INVERT_Y_DIR) ^ z_direction); #endif #ifdef Z_DIR_WRITE - Z_DIR_WRITE(INVERT_Z_DIR ^ z_direction); + Z_DIR_WRITE(ENABLED(INVERT_Z_DIR) ^ z_direction); #endif #ifdef I_DIR_WRITE - I_DIR_WRITE(INVERT_I_DIR ^ z_direction); + I_DIR_WRITE(ENABLED(INVERT_I_DIR) ^ z_direction); #endif #ifdef J_DIR_WRITE - J_DIR_WRITE(INVERT_J_DIR ^ z_direction); + J_DIR_WRITE(ENABLED(INVERT_J_DIR) ^ z_direction); #endif #ifdef K_DIR_WRITE - K_DIR_WRITE(INVERT_K_DIR ^ z_direction); + K_DIR_WRITE(ENABLED(INVERT_K_DIR) ^ z_direction); #endif #ifdef U_DIR_WRITE - U_DIR_WRITE(INVERT_U_DIR ^ z_direction); + U_DIR_WRITE(ENABLED(INVERT_U_DIR) ^ z_direction); #endif #ifdef V_DIR_WRITE - V_DIR_WRITE(INVERT_V_DIR ^ z_direction); + V_DIR_WRITE(ENABLED(INVERT_V_DIR) ^ z_direction); #endif #ifdef W_DIR_WRITE - W_DIR_WRITE(INVERT_W_DIR ^ z_direction); + W_DIR_WRITE(ENABLED(INVERT_W_DIR) ^ z_direction); #endif DIR_WAIT_AFTER(); diff --git a/Marlin/src/module/stepper/indirection.h b/Marlin/src/module/stepper/indirection.h index 879185ca14ef..687a0f289628 100644 --- a/Marlin/src/module/stepper/indirection.h +++ b/Marlin/src/module/stepper/indirection.h @@ -462,91 +462,91 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #if EXTRUDERS > 7 #define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else if (E < 4) { E1_STEP_WRITE(V); } else if (E < 6) { E2_STEP_WRITE(V); } else { E3_STEP_WRITE(V); } }while(0) #define NORM_E_DIR(E) do{ switch (E) { \ - case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E0_DIR_WRITE( INVERT_E0_DIR); break; \ - case 2: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 3: E1_DIR_WRITE( INVERT_E1_DIR); break; \ - case 4: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 5: E2_DIR_WRITE( INVERT_E2_DIR); break; \ - case 6: E3_DIR_WRITE( INVERT_E3_DIR); break; case 7: E3_DIR_WRITE( INVERT_E3_DIR); break; \ + case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; \ + case 2: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \ + case 4: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; case 5: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; \ + case 6: E3_DIR_WRITE( ENABLED(INVERT_E3_DIR)); break; case 7: E3_DIR_WRITE( ENABLED(INVERT_E3_DIR)); break; \ } }while(0) #define REV_E_DIR(E) do{ switch (E) { \ - case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E0_DIR_WRITE(!INVERT_E0_DIR); break; \ - case 2: E1_DIR_WRITE( INVERT_E1_DIR); break; case 3: E1_DIR_WRITE(!INVERT_E1_DIR); break; \ - case 4: E2_DIR_WRITE( INVERT_E2_DIR); break; case 5: E2_DIR_WRITE(!INVERT_E2_DIR); break; \ - case 6: E3_DIR_WRITE(!INVERT_E3_DIR); break; case 7: E3_DIR_WRITE(!INVERT_E3_DIR); break; \ + case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; \ + case 2: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \ + case 4: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; case 5: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; \ + case 6: E3_DIR_WRITE(DISABLED(INVERT_E3_DIR)); break; case 7: E3_DIR_WRITE(DISABLED(INVERT_E3_DIR)); break; \ } }while(0) #elif EXTRUDERS > 6 #define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else if (E < 4) { E1_STEP_WRITE(V); } else if (E < 6) { E2_STEP_WRITE(V); } else { E3_STEP_WRITE(V); } }while(0) #define NORM_E_DIR(E) do{ switch (E) { \ - case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E0_DIR_WRITE( INVERT_E0_DIR); break; \ - case 2: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 3: E1_DIR_WRITE( INVERT_E1_DIR); break; \ - case 4: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 5: E2_DIR_WRITE( INVERT_E2_DIR); break; \ - case 6: E3_DIR_WRITE( INVERT_E3_DIR); break; \ + case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; \ + case 2: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \ + case 4: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; case 5: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; \ + case 6: E3_DIR_WRITE( ENABLED(INVERT_E3_DIR)); break; \ } }while(0) #define REV_E_DIR(E) do{ switch (E) { \ - case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E0_DIR_WRITE(!INVERT_E0_DIR); break; \ - case 2: E1_DIR_WRITE( INVERT_E1_DIR); break; case 3: E1_DIR_WRITE(!INVERT_E1_DIR); break; \ - case 4: E2_DIR_WRITE( INVERT_E2_DIR); break; case 5: E2_DIR_WRITE(!INVERT_E2_DIR); break; \ - case 6: E3_DIR_WRITE(!INVERT_E3_DIR); } }while(0) + case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; \ + case 2: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \ + case 4: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; case 5: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; \ + case 6: E3_DIR_WRITE(DISABLED(INVERT_E3_DIR)); } }while(0) #elif EXTRUDERS > 5 #define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else if (E < 4) { E1_STEP_WRITE(V); } else { E2_STEP_WRITE(V); } }while(0) #define NORM_E_DIR(E) do{ switch (E) { \ - case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E0_DIR_WRITE( INVERT_E0_DIR); break; \ - case 2: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 3: E1_DIR_WRITE( INVERT_E1_DIR); break; \ - case 4: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 5: E2_DIR_WRITE( INVERT_E2_DIR); break; \ + case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; \ + case 2: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \ + case 4: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; case 5: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; \ } }while(0) #define REV_E_DIR(E) do{ switch (E) { \ - case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E0_DIR_WRITE(!INVERT_E0_DIR); break; \ - case 2: E1_DIR_WRITE( INVERT_E1_DIR); break; case 3: E1_DIR_WRITE(!INVERT_E1_DIR); break; \ - case 4: E2_DIR_WRITE( INVERT_E2_DIR); break; case 5: E2_DIR_WRITE(!INVERT_E2_DIR); break; \ + case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; \ + case 2: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \ + case 4: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; case 5: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; \ } }while(0) #elif EXTRUDERS > 4 #define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else if (E < 4) { E1_STEP_WRITE(V); } else { E2_STEP_WRITE(V); } }while(0) #define NORM_E_DIR(E) do{ switch (E) { \ - case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E0_DIR_WRITE( INVERT_E0_DIR); break; \ - case 2: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 3: E1_DIR_WRITE( INVERT_E1_DIR); break; \ - case 4: E2_DIR_WRITE(!INVERT_E2_DIR); break; \ + case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; \ + case 2: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \ + case 4: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; \ } }while(0) #define REV_E_DIR(E) do{ switch (E) { \ - case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E0_DIR_WRITE(!INVERT_E0_DIR); break; \ - case 2: E1_DIR_WRITE( INVERT_E1_DIR); break; case 3: E1_DIR_WRITE(!INVERT_E1_DIR); break; \ - case 4: E2_DIR_WRITE( INVERT_E2_DIR); break; \ + case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; \ + case 2: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \ + case 4: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; \ } }while(0) #elif EXTRUDERS > 3 #define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else { E1_STEP_WRITE(V); } }while(0) #define NORM_E_DIR(E) do{ switch (E) { \ - case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E0_DIR_WRITE( INVERT_E0_DIR); break; \ - case 2: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 3: E1_DIR_WRITE( INVERT_E1_DIR); break; \ + case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; \ + case 2: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \ } }while(0) #define REV_E_DIR(E) do{ switch (E) { \ - case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E0_DIR_WRITE(!INVERT_E0_DIR); break; \ - case 2: E1_DIR_WRITE( INVERT_E1_DIR); break; case 3: E1_DIR_WRITE(!INVERT_E1_DIR); break; \ + case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; \ + case 2: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \ } }while(0) #elif EXTRUDERS > 2 #define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else { E1_STEP_WRITE(V); } }while(0) #define NORM_E_DIR(E) do{ switch (E) { \ - case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E0_DIR_WRITE( INVERT_E0_DIR); break; \ - case 2: E1_DIR_WRITE(!INVERT_E1_DIR); break; \ + case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; \ + case 2: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \ } }while(0) #define REV_E_DIR(E) do{ switch (E) { \ - case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E0_DIR_WRITE(!INVERT_E0_DIR); break; \ - case 2: E1_DIR_WRITE( INVERT_E1_DIR); break; \ + case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; \ + case 2: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \ } }while(0) #else #define E_STEP_WRITE(E,V) E0_STEP_WRITE(V) - #define NORM_E_DIR(E) do{ E0_DIR_WRITE(E ? INVERT_E0_DIR : !INVERT_E0_DIR); }while(0) - #define REV_E_DIR(E) do{ E0_DIR_WRITE(E ? !INVERT_E0_DIR : INVERT_E0_DIR); }while(0) + #define NORM_E_DIR(E) do{ E0_DIR_WRITE(E ? ENABLED(INVERT_E0_DIR) : DISABLED(INVERT_E0_DIR)); }while(0) + #define REV_E_DIR(E) do{ E0_DIR_WRITE(E ? DISABLED(INVERT_E0_DIR) : ENABLED(INVERT_E0_DIR)); }while(0) #endif #elif HAS_PRUSA_MMU2 // One multiplexed stepper driver #define E_STEP_WRITE(E,V) E0_STEP_WRITE(V) - #define NORM_E_DIR(E) E0_DIR_WRITE(!INVERT_E0_DIR) - #define REV_E_DIR(E) E0_DIR_WRITE( INVERT_E0_DIR) + #define NORM_E_DIR(E) E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)) + #define REV_E_DIR(E) E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)) #elif HAS_PRUSA_MMU1 // One multiplexed stepper driver, reversed on odd index #define E_STEP_WRITE(E,V) E0_STEP_WRITE(V) - #define NORM_E_DIR(E) do{ E0_DIR_WRITE(TEST(E, 0) ? !INVERT_E0_DIR: INVERT_E0_DIR); }while(0) - #define REV_E_DIR(E) do{ E0_DIR_WRITE(TEST(E, 0) ? INVERT_E0_DIR: !INVERT_E0_DIR); }while(0) + #define NORM_E_DIR(E) do{ E0_DIR_WRITE(TEST(E, 0) ? DISABLED(INVERT_E0_DIR): ENABLED(INVERT_E0_DIR)); }while(0) + #define REV_E_DIR(E) do{ E0_DIR_WRITE(TEST(E, 0) ? ENABLED(INVERT_E0_DIR): DISABLED(INVERT_E0_DIR)); }while(0) #elif E_STEPPERS > 1 @@ -557,16 +557,16 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset case 4: E4_STEP_WRITE(V); break; case 5: E5_STEP_WRITE(V); break; case 6: E6_STEP_WRITE(V); break; case 7: E7_STEP_WRITE(V); break; \ } }while(0) #define _NORM_E_DIR(E) do{ switch (E) { \ - case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; \ - case 2: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 3: E3_DIR_WRITE(!INVERT_E3_DIR); break; \ - case 4: E4_DIR_WRITE(!INVERT_E4_DIR); break; case 5: E5_DIR_WRITE(!INVERT_E5_DIR); break; \ - case 6: E6_DIR_WRITE(!INVERT_E6_DIR); break; case 7: E7_DIR_WRITE(!INVERT_E7_DIR); break; \ + case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \ + case 2: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE(DISABLED(INVERT_E3_DIR)); break; \ + case 4: E4_DIR_WRITE(DISABLED(INVERT_E4_DIR)); break; case 5: E5_DIR_WRITE(DISABLED(INVERT_E5_DIR)); break; \ + case 6: E6_DIR_WRITE(DISABLED(INVERT_E6_DIR)); break; case 7: E7_DIR_WRITE(DISABLED(INVERT_E7_DIR)); break; \ } }while(0) #define _REV_E_DIR(E) do{ switch (E) { \ - case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; \ - case 2: E2_DIR_WRITE( INVERT_E2_DIR); break; case 3: E3_DIR_WRITE( INVERT_E3_DIR); break; \ - case 4: E4_DIR_WRITE( INVERT_E4_DIR); break; case 5: E5_DIR_WRITE( INVERT_E5_DIR); break; \ - case 6: E6_DIR_WRITE( INVERT_E6_DIR); break; case 7: E7_DIR_WRITE( INVERT_E7_DIR); break; \ + case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \ + case 2: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE( ENABLED(INVERT_E3_DIR)); break; \ + case 4: E4_DIR_WRITE( ENABLED(INVERT_E4_DIR)); break; case 5: E5_DIR_WRITE( ENABLED(INVERT_E5_DIR)); break; \ + case 6: E6_DIR_WRITE( ENABLED(INVERT_E6_DIR)); break; case 7: E7_DIR_WRITE( ENABLED(INVERT_E7_DIR)); break; \ } }while(0) #elif E_STEPPERS > 6 @@ -576,16 +576,16 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset case 4: E4_STEP_WRITE(V); break; case 5: E5_STEP_WRITE(V); break; case 6: E6_STEP_WRITE(V); break; \ } }while(0) #define _NORM_E_DIR(E) do{ switch (E) { \ - case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; \ - case 2: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 3: E3_DIR_WRITE(!INVERT_E3_DIR); break; \ - case 4: E4_DIR_WRITE(!INVERT_E4_DIR); break; case 5: E5_DIR_WRITE(!INVERT_E5_DIR); break; \ - case 6: E6_DIR_WRITE(!INVERT_E6_DIR); break; \ + case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \ + case 2: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE(DISABLED(INVERT_E3_DIR)); break; \ + case 4: E4_DIR_WRITE(DISABLED(INVERT_E4_DIR)); break; case 5: E5_DIR_WRITE(DISABLED(INVERT_E5_DIR)); break; \ + case 6: E6_DIR_WRITE(DISABLED(INVERT_E6_DIR)); break; \ } }while(0) #define _REV_E_DIR(E) do{ switch (E) { \ - case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; \ - case 2: E2_DIR_WRITE( INVERT_E2_DIR); break; case 3: E3_DIR_WRITE( INVERT_E3_DIR); break; \ - case 4: E4_DIR_WRITE( INVERT_E4_DIR); break; case 5: E5_DIR_WRITE( INVERT_E5_DIR); break; \ - case 6: E6_DIR_WRITE( INVERT_E6_DIR); break; \ + case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \ + case 2: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE( ENABLED(INVERT_E3_DIR)); break; \ + case 4: E4_DIR_WRITE( ENABLED(INVERT_E4_DIR)); break; case 5: E5_DIR_WRITE( ENABLED(INVERT_E5_DIR)); break; \ + case 6: E6_DIR_WRITE( ENABLED(INVERT_E6_DIR)); break; \ } }while(0) #elif E_STEPPERS > 5 @@ -595,14 +595,14 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset case 4: E4_STEP_WRITE(V); break; case 5: E5_STEP_WRITE(V); break; \ } }while(0) #define _NORM_E_DIR(E) do{ switch (E) { \ - case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; \ - case 2: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 3: E3_DIR_WRITE(!INVERT_E3_DIR); break; \ - case 4: E4_DIR_WRITE(!INVERT_E4_DIR); break; case 5: E5_DIR_WRITE(!INVERT_E5_DIR); break; \ + case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \ + case 2: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE(DISABLED(INVERT_E3_DIR)); break; \ + case 4: E4_DIR_WRITE(DISABLED(INVERT_E4_DIR)); break; case 5: E5_DIR_WRITE(DISABLED(INVERT_E5_DIR)); break; \ } }while(0) #define _REV_E_DIR(E) do{ switch (E) { \ - case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; \ - case 2: E2_DIR_WRITE( INVERT_E2_DIR); break; case 3: E3_DIR_WRITE( INVERT_E3_DIR); break; \ - case 4: E4_DIR_WRITE( INVERT_E4_DIR); break; case 5: E5_DIR_WRITE( INVERT_E5_DIR); break; \ + case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \ + case 2: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE( ENABLED(INVERT_E3_DIR)); break; \ + case 4: E4_DIR_WRITE( ENABLED(INVERT_E4_DIR)); break; case 5: E5_DIR_WRITE( ENABLED(INVERT_E5_DIR)); break; \ } }while(0) #elif E_STEPPERS > 4 @@ -612,14 +612,14 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset case 4: E4_STEP_WRITE(V); break; \ } }while(0) #define _NORM_E_DIR(E) do{ switch (E) { \ - case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; \ - case 2: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 3: E3_DIR_WRITE(!INVERT_E3_DIR); break; \ - case 4: E4_DIR_WRITE(!INVERT_E4_DIR); break; \ + case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \ + case 2: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE(DISABLED(INVERT_E3_DIR)); break; \ + case 4: E4_DIR_WRITE(DISABLED(INVERT_E4_DIR)); break; \ } }while(0) #define _REV_E_DIR(E) do{ switch (E) { \ - case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; \ - case 2: E2_DIR_WRITE( INVERT_E2_DIR); break; case 3: E3_DIR_WRITE( INVERT_E3_DIR); break; \ - case 4: E4_DIR_WRITE( INVERT_E4_DIR); break; \ + case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \ + case 2: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE( ENABLED(INVERT_E3_DIR)); break; \ + case 4: E4_DIR_WRITE( ENABLED(INVERT_E4_DIR)); break; \ } }while(0) #elif E_STEPPERS > 3 @@ -628,25 +628,25 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset case 0: E0_STEP_WRITE(V); break; case 1: E1_STEP_WRITE(V); break; case 2: E2_STEP_WRITE(V); break; case 3: E3_STEP_WRITE(V); break; \ } }while(0) #define _NORM_E_DIR(E) do{ switch (E) { \ - case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; \ - case 2: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 3: E3_DIR_WRITE(!INVERT_E3_DIR); break; \ + case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \ + case 2: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE(DISABLED(INVERT_E3_DIR)); break; \ } }while(0) #define _REV_E_DIR(E) do{ switch (E) { \ - case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; \ - case 2: E2_DIR_WRITE( INVERT_E2_DIR); break; case 3: E3_DIR_WRITE( INVERT_E3_DIR); break; \ + case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \ + case 2: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE( ENABLED(INVERT_E3_DIR)); break; \ } }while(0) #elif E_STEPPERS > 2 #define _E_STEP_WRITE(E,V) do{ switch (E) { case 0: E0_STEP_WRITE(V); break; case 1: E1_STEP_WRITE(V); break; case 2: E2_STEP_WRITE(V); } }while(0) - #define _NORM_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 2: E2_DIR_WRITE(!INVERT_E2_DIR); } }while(0) - #define _REV_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; case 2: E2_DIR_WRITE( INVERT_E2_DIR); } }while(0) + #define _NORM_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; case 2: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); } }while(0) + #define _REV_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; case 2: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); } }while(0) #else #define _E_STEP_WRITE(E,V) do{ if (E == 0) { E0_STEP_WRITE(V); } else { E1_STEP_WRITE(V); } }while(0) - #define _NORM_E_DIR(E) do{ if (E == 0) { E0_DIR_WRITE(!INVERT_E0_DIR); } else { E1_DIR_WRITE(!INVERT_E1_DIR); } }while(0) - #define _REV_E_DIR(E) do{ if (E == 0) { E0_DIR_WRITE( INVERT_E0_DIR); } else { E1_DIR_WRITE( INVERT_E1_DIR); } }while(0) + #define _NORM_E_DIR(E) do{ if (E == 0) { E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); } else { E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); } }while(0) + #define _REV_E_DIR(E) do{ if (E == 0) { E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); } else { E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); } }while(0) #endif #if HAS_DUPLICATION_MODE @@ -657,8 +657,8 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define _DUPE(N,T,V) E##N##_##T##_WRITE(V) #endif - #define NDIR(N) _DUPE(N,DIR,!INVERT_E##N##_DIR) - #define RDIR(N) _DUPE(N,DIR, INVERT_E##N##_DIR) + #define NDIR(N) _DUPE(N,DIR,DISABLED(INVERT_E##N##_DIR)) + #define RDIR(N) _DUPE(N,DIR, ENABLED(INVERT_E##N##_DIR)) #define E_STEP_WRITE(E,V) do{ if (extruder_duplication_enabled) { DUPE(STEP,V); } else _E_STEP_WRITE(E,V); }while(0) @@ -704,13 +704,13 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #elif ENABLED(E_DUAL_STEPPER_DRIVERS) #define E_STEP_WRITE(E,V) do{ E0_STEP_WRITE(V); E1_STEP_WRITE(V); }while(0) - #define NORM_E_DIR(E) do{ E0_DIR_WRITE(!INVERT_E0_DIR); E1_DIR_WRITE(!INVERT_E0_DIR ^ ENABLED(INVERT_E1_VS_E0_DIR)); }while(0) - #define REV_E_DIR(E) do{ E0_DIR_WRITE( INVERT_E0_DIR); E1_DIR_WRITE( INVERT_E0_DIR ^ ENABLED(INVERT_E1_VS_E0_DIR)); }while(0) + #define NORM_E_DIR(E) do{ E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); E1_DIR_WRITE(DISABLED(INVERT_E0_DIR) ^ ENABLED(INVERT_E1_VS_E0_DIR)); }while(0) + #define REV_E_DIR(E) do{ E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); E1_DIR_WRITE( ENABLED(INVERT_E0_DIR) ^ ENABLED(INVERT_E1_VS_E0_DIR)); }while(0) #elif E_STEPPERS #define E_STEP_WRITE(E,V) E0_STEP_WRITE(V) - #define NORM_E_DIR(E) E0_DIR_WRITE(!INVERT_E0_DIR) - #define REV_E_DIR(E) E0_DIR_WRITE( INVERT_E0_DIR) + #define NORM_E_DIR(E) E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)) + #define REV_E_DIR(E) E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)) #else #define E_STEP_WRITE(E,V) NOOP From 60f8287208006a64afa32d98634b3f056c33e5e4 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 30 Apr 2022 00:02:33 +0000 Subject: [PATCH 007/241] [cron] Bump distribution date (2022-04-30) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index fba79352097c..f2bcd1622945 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-04-29" +//#define STRING_DISTRIBUTION_DATE "2022-04-30" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 885edefb8e06..5def0da8eec7 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-04-29" + #define STRING_DISTRIBUTION_DATE "2022-04-30" #endif /** From 3bcbd3259f8d1ff3fc262b2ede83efd873863d5f Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Fri, 29 Apr 2022 22:54:42 -0700 Subject: [PATCH 008/241] =?UTF-8?q?=F0=9F=94=A7=20Mini=20LCD=20followup=20?= =?UTF-8?q?(#24111)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/SanityCheck.h | 18 ++++++++---------- Marlin/src/inc/Warnings.cpp | 4 ++-- buildroot/tests/LPC1768 | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 59effff1a310..87e967cbe3bb 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2443,23 +2443,21 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #endif /** - * FYSETC LCD Requirements + * FYSETC/MKS/BTT Mini Panel Requirements */ #if EITHER(FYSETC_242_OLED_12864, FYSETC_MINI_12864_2_1) - #ifndef NEO_GRB - #define NEO_GRB 123 - #define FAUX_RGB 1 + #ifndef NEO_RGB + #define NEO_RGB 123 #endif - #if defined(NEOPIXEL_TYPE) && NEOPIXEL_TYPE != NEO_GRB - #error "Your FYSETC Mini Panel requires NEOPIXEL_TYPE to be NEO_GRB." + #if defined(NEOPIXEL_TYPE) && NEOPIXEL_TYPE != NEO_RGB + #error "Your FYSETC/MKS/BTT Mini Panel requires NEOPIXEL_TYPE to be NEO_RGB." #elif defined(NEOPIXEL_PIXELS) && NEOPIXEL_PIXELS < 3 - #error "Your FYSETC Mini Panel requires NEOPIXEL_PIXELS >= 3." + #error "Your FYSETC/MKS/BTT Mini Panel requires NEOPIXEL_PIXELS >= 3." #endif #if FAUX_RGB - #undef NEO_GRB - #undef FAUX_RGB + #undef NEO_RGB #endif -#elif EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) && !DISABLED(RGB_LED) +#elif EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) && DISABLED(RGB_LED) #error "Your FYSETC Mini Panel requires RGB_LED." #endif diff --git a/Marlin/src/inc/Warnings.cpp b/Marlin/src/inc/Warnings.cpp index 6023247f9496..0cb798396240 100644 --- a/Marlin/src/inc/Warnings.cpp +++ b/Marlin/src/inc/Warnings.cpp @@ -740,10 +740,10 @@ #endif /** - * FYSETC backlighting + * FYSETC/MKS/BTT Mini Panel backlighting */ #if EITHER(FYSETC_242_OLED_12864, FYSETC_MINI_12864_2_1) && !ALL(NEOPIXEL_LED, LED_CONTROL_MENU, LED_USER_PRESET_STARTUP, LED_COLOR_PRESETS) - #warning "Your FYSETC Mini Panel works best with NEOPIXEL_LED, LED_CONTROL_MENU, LED_USER_PRESET_STARTUP, and LED_COLOR_PRESETS." + #warning "Your FYSETC/MKS/BTT Mini Panel works best with NEOPIXEL_LED, LED_CONTROL_MENU, LED_USER_PRESET_STARTUP, and LED_COLOR_PRESETS." #endif #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) && DISABLED(RGB_LED) diff --git a/buildroot/tests/LPC1768 b/buildroot/tests/LPC1768 index 34ae40d18a96..9fb7479d9921 100755 --- a/buildroot/tests/LPC1768 +++ b/buildroot/tests/LPC1768 @@ -15,7 +15,7 @@ set -e restore_configs opt_set MOTHERBOARD BOARD_RAMPS_14_RE_ARM_EFB SERIAL_PORT_3 3 \ - NEOPIXEL_TYPE NEO_GRB RGB_LED_R_PIN P2_12 RGB_LED_G_PIN P1_23 RGB_LED_B_PIN P1_22 RGB_LED_W_PIN P1_24 + NEOPIXEL_TYPE NEO_RGB RGB_LED_R_PIN P2_12 RGB_LED_G_PIN P1_23 RGB_LED_B_PIN P1_22 RGB_LED_W_PIN P1_24 opt_enable FYSETC_MINI_12864_2_1 SDSUPPORT SDCARD_READONLY SERIAL_PORT_2 RGBW_LED E_DUAL_STEPPER_DRIVERS \ NEOPIXEL_LED NEOPIXEL_IS_SEQUENTIAL NEOPIXEL_STARTUP_TEST NEOPIXEL_BKGD_INDEX_FIRST NEOPIXEL_BKGD_INDEX_LAST NEOPIXEL_BKGD_COLOR NEOPIXEL_BKGD_ALWAYS_ON exec_test $1 $2 "ReARM EFB VIKI2, SDSUPPORT, 2 Serial ports (USB CDC + UART0), NeoPixel" "$3" From a1d4942f760fa1d589af11d378a938fba6f45cd2 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sun, 1 May 2022 00:01:58 +0000 Subject: [PATCH 009/241] [cron] Bump distribution date (2022-05-01) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index f2bcd1622945..b051c6204149 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-04-30" +//#define STRING_DISTRIBUTION_DATE "2022-05-01" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 5def0da8eec7..ebd012c6ec06 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-04-30" + #define STRING_DISTRIBUTION_DATE "2022-05-01" #endif /** From 43b43491ab87169518172995a5cd698be453420e Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Mon, 2 May 2022 16:29:25 -0700 Subject: [PATCH 010/241] =?UTF-8?q?=F0=9F=93=9D=20Fix=20extraneous=20URL?= =?UTF-8?q?=20args=20(#24125)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/ramps/pins_FYSETC_F6_13.h | 2 +- Marlin/src/pins/ramps/pins_RAMPS.h | 2 +- Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h | 2 +- Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h | 2 +- Marlin/src/pins/stm32f4/pins_ARMED.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h b/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h index 9c6b74f1269d..b8de260909b6 100644 --- a/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h +++ b/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h @@ -234,7 +234,7 @@ #if ENABLED(FYSETC_MINI_12864) // - // See https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 + // See https://wiki.fysetc.com/Mini12864_Panel/ // #define DOGLCD_A0 16 #define DOGLCD_CS 17 diff --git a/Marlin/src/pins/ramps/pins_RAMPS.h b/Marlin/src/pins/ramps/pins_RAMPS.h index c7ef0be99e64..d88d7e33127b 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS.h +++ b/Marlin/src/pins/ramps/pins_RAMPS.h @@ -752,7 +752,7 @@ #elif ENABLED(FYSETC_MINI_12864) - // From https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 + // From https://wiki.fysetc.com/Mini12864_Panel/ #define DOGLCD_A0 EXP1_07_PIN #define DOGLCD_CS EXP1_08_PIN diff --git a/Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h b/Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h index 1e0efcf0b21d..1315d994c8b8 100644 --- a/Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h +++ b/Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h @@ -439,7 +439,7 @@ #elif ENABLED(FYSETC_MINI_12864) - // From https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 + // From https://wiki.fysetc.com/Mini12864_Panel/ // TO TEST //#define DOGLCD_A0 16 diff --git a/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h b/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h index 2484674a90b3..5450b3766b71 100644 --- a/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h +++ b/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h @@ -490,7 +490,7 @@ #elif ENABLED(FYSETC_MINI_12864) - // From https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 + // From https://wiki.fysetc.com/Mini12864_Panel/ // TO TEST //#define DOGLCD_A0 16 diff --git a/Marlin/src/pins/stm32f4/pins_ARMED.h b/Marlin/src/pins/stm32f4/pins_ARMED.h index 7cccac7caa3a..f7c6b7f88a76 100644 --- a/Marlin/src/pins/stm32f4/pins_ARMED.h +++ b/Marlin/src/pins/stm32f4/pins_ARMED.h @@ -150,7 +150,7 @@ #if ENABLED(FYSETC_MINI_12864) // - // See https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 + // See https://wiki.fysetc.com/Mini12864_Panel/ // #define DOGLCD_A0 PE9 #define DOGLCD_CS PE8 From b038078541251aa33c6220b9b8370a37ca558ef4 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 3 May 2022 00:01:42 +0000 Subject: [PATCH 011/241] [cron] Bump distribution date (2022-05-03) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index b051c6204149..48fa2a020cae 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-05-01" +//#define STRING_DISTRIBUTION_DATE "2022-05-03" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index ebd012c6ec06..cb13e444616b 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-05-01" + #define STRING_DISTRIBUTION_DATE "2022-05-03" #endif /** From 4c8c02f66ff501fdf84082f9b89a9cc04be626d3 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 4 May 2022 12:47:15 -0500 Subject: [PATCH 012/241] =?UTF-8?q?=F0=9F=93=9D=20Replace=20KB=20with=20K?= =?UTF-8?q?=20in=20pins?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/linux/pins_RAMPS_LINUX.h | 2 +- Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h | 2 +- Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h | 2 +- Marlin/src/pins/sam/pins_KRATOS32.h | 2 +- Marlin/src/pins/sam/pins_RADDS.h | 2 +- Marlin/src/pins/stm32f0/pins_MALYAN_M300.h | 2 +- Marlin/src/pins/stm32f1/pins_BTT_SKR_CR6.h | 4 ++-- Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h | 4 ++-- Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h | 2 +- Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h | 4 ++-- Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h | 4 ++-- Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h | 4 ++-- Marlin/src/pins/stm32f1/pins_CHITU3D_common.h | 4 ++-- Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h | 2 +- Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h | 4 ++-- Marlin/src/pins/stm32f1/pins_FLY_MINI.h | 2 +- Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h | 4 ++-- Marlin/src/pins/stm32f1/pins_FYSETC_CHEETAH.h | 4 ++-- Marlin/src/pins/stm32f1/pins_GTM32_MINI.h | 2 +- Marlin/src/pins/stm32f1/pins_GTM32_MINI_A30.h | 2 +- Marlin/src/pins/stm32f1/pins_GTM32_PRO_VB.h | 2 +- Marlin/src/pins/stm32f1/pins_GTM32_REV_B.h | 2 +- Marlin/src/pins/stm32f1/pins_JGAURORA_A5S_A1.h | 4 ++-- Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h | 10 +++++----- Marlin/src/pins/stm32f1/pins_MINGDA_MPX_ARM_MINI.h | 6 +++--- Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h | 2 +- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h | 2 +- .../src/pins/stm32f1/pins_MKS_ROBIN_E3_V1_1_common.h | 2 +- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h | 4 ++-- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h | 4 ++-- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h | 2 +- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h | 4 ++-- Marlin/src/pins/stm32f1/pins_PANDA_PI_V29.h | 4 ++-- Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h | 4 ++-- Marlin/src/pins/stm32f1/pins_ZM3E2_V1_0.h | 4 ++-- Marlin/src/pins/stm32f1/pins_ZM3E4_V1_0.h | 4 ++-- Marlin/src/pins/stm32f1/pins_ZM3E4_V2_0.h | 4 ++-- Marlin/src/pins/stm32f4/pins_ANET_ET4.h | 4 ++-- Marlin/src/pins/stm32f4/pins_ARMED.h | 2 +- Marlin/src/pins/stm32f4/pins_ARTILLERY_RUBY.h | 2 +- Marlin/src/pins/stm32f4/pins_BLACK_STM32F407VE.h | 2 +- Marlin/src/pins/stm32f4/pins_BTT_E3_RRF.h | 2 +- Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h | 2 +- Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h | 2 +- Marlin/src/pins/stm32f4/pins_FLYF407ZG.h | 4 ++-- Marlin/src/pins/stm32f4/pins_FYSETC_S6.h | 2 +- Marlin/src/pins/stm32f4/pins_FYSETC_SPIDER.h | 2 +- Marlin/src/pins/stm32f4/pins_INDEX_REV03.h | 2 +- Marlin/src/pins/stm32f4/pins_LERDGE_S.h | 6 +++--- Marlin/src/pins/stm32f4/pins_MKS_MONSTER8.h | 2 +- .../src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h | 2 +- Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h | 2 +- Marlin/src/pins/stm32f4/pins_RUMBA32_AUS3D.h | 4 ++-- Marlin/src/pins/stm32f4/pins_RUMBA32_BTT.h | 2 +- Marlin/src/pins/stm32f4/pins_RUMBA32_MKS.h | 2 +- Marlin/src/pins/stm32f4/pins_TH3D_EZBOARD_V2.h | 2 +- Marlin/src/pins/stm32f4/pins_VAKE403D.h | 2 +- Marlin/src/pins/stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h | 2 +- Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h | 2 +- 59 files changed, 88 insertions(+), 88 deletions(-) diff --git a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h b/Marlin/src/pins/linux/pins_RAMPS_LINUX.h index e2efdfa4929b..7953f678fa48 100644 --- a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h +++ b/Marlin/src/pins/linux/pins_RAMPS_LINUX.h @@ -54,7 +54,7 @@ #endif #ifndef MARLIN_EEPROM_SIZE - #define MARLIN_EEPROM_SIZE 0x1000 // 4KB + #define MARLIN_EEPROM_SIZE 0x1000 // 4K #endif // diff --git a/Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h b/Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h index 56ee7fa73235..27b65c22cd5c 100644 --- a/Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h +++ b/Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h @@ -35,7 +35,7 @@ // Onboard I2C EEPROM #define I2C_EEPROM -#define MARLIN_EEPROM_SIZE 0x1000 // 4KB (AT24C32) +#define MARLIN_EEPROM_SIZE 0x1000 // 4K (AT24C32) // // Servos diff --git a/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h b/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h index 7edfb9196fa2..0c001e6061cc 100644 --- a/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h +++ b/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h @@ -39,7 +39,7 @@ //#define SDCARD_EEPROM_EMULATION //#define I2C_EEPROM // AT24C32 #define FLASH_EEPROM_EMULATION - #define MARLIN_EEPROM_SIZE 0x1000 // 4KB + #define MARLIN_EEPROM_SIZE 0x1000 // 4K #endif // diff --git a/Marlin/src/pins/sam/pins_KRATOS32.h b/Marlin/src/pins/sam/pins_KRATOS32.h index f429e5634706..f7867f9b2607 100644 --- a/Marlin/src/pins/sam/pins_KRATOS32.h +++ b/Marlin/src/pins/sam/pins_KRATOS32.h @@ -34,7 +34,7 @@ // #if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM) #define I2C_EEPROM - #define MARLIN_EEPROM_SIZE 0x1F400 // 16KB + #define MARLIN_EEPROM_SIZE 0x1F400 // 16K #endif // diff --git a/Marlin/src/pins/sam/pins_RADDS.h b/Marlin/src/pins/sam/pins_RADDS.h index da176f444784..af24014614c1 100644 --- a/Marlin/src/pins/sam/pins_RADDS.h +++ b/Marlin/src/pins/sam/pins_RADDS.h @@ -34,7 +34,7 @@ // #if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM) #define I2C_EEPROM - #define MARLIN_EEPROM_SIZE 0x2000 // 8KB + #define MARLIN_EEPROM_SIZE 0x2000 // 8K #endif // diff --git a/Marlin/src/pins/stm32f0/pins_MALYAN_M300.h b/Marlin/src/pins/stm32f0/pins_MALYAN_M300.h index 904a9a56fac6..d38d4bbdb378 100644 --- a/Marlin/src/pins/stm32f0/pins_MALYAN_M300.h +++ b/Marlin/src/pins/stm32f0/pins_MALYAN_M300.h @@ -33,7 +33,7 @@ #if NO_EEPROM_SELECTED #define FLASH_EEPROM_EMULATION #ifndef MARLIN_EEPROM_SIZE - #define MARLIN_EEPROM_SIZE 0x800U // 2KB + #define MARLIN_EEPROM_SIZE 0x800U // 2K #endif #endif diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_CR6.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_CR6.h index 7b8abb130060..e3e91ff35ad4 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_CR6.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_CR6.h @@ -52,9 +52,9 @@ #if ENABLED(I2C_EEPROM) #define IIC_EEPROM_SDA PB7 #define IIC_EEPROM_SCL PB6 - #define MARLIN_EEPROM_SIZE 0x1000 // 4KB + #define MARLIN_EEPROM_SIZE 0x1000 // 4K #elif ENABLED(SDCARD_EEPROM_EMULATION) - #define MARLIN_EEPROM_SIZE 0x1000 // 4KB + #define MARLIN_EEPROM_SIZE 0x1000 // 4K #endif // diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h index 704501de108b..7300919d9df7 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h @@ -33,9 +33,9 @@ #if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION - #define EEPROM_PAGE_SIZE (0x800U) // 2KB + #define EEPROM_PAGE_SIZE (0x800U) // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) - #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2KB + #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2K #endif // diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h index 2ab7a61e0b95..b5fddc4d7494 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h @@ -29,7 +29,7 @@ #if NO_EEPROM_SELECTED #define I2C_EEPROM #define SOFT_I2C_EEPROM - #define MARLIN_EEPROM_SIZE 0x1000 // 4KB + #define MARLIN_EEPROM_SIZE 0x1000 // 4K #define I2C_SDA_PIN PB7 #define I2C_SCL_PIN PB6 #undef NO_EEPROM_SELECTED diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h index 5b48d7cadbcf..e728af317d82 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h @@ -33,9 +33,9 @@ #if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION - #define EEPROM_PAGE_SIZE (0x800U) // 2KB + #define EEPROM_PAGE_SIZE (0x800U) // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) - #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2KB + #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2K #endif // diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h index 4f52dfb4fc8c..1ea947ffdf18 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h @@ -33,9 +33,9 @@ #if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION - #define EEPROM_PAGE_SIZE (0x800U) // 2KB + #define EEPROM_PAGE_SIZE (0x800U) // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) - #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2KB + #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2K #endif // diff --git a/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h b/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h index b0b201f1d50d..ed3a653d2192 100644 --- a/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h +++ b/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h @@ -43,9 +43,9 @@ // #if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION - #define EEPROM_PAGE_SIZE 0x800U // 2KB + #define EEPROM_PAGE_SIZE 0x800U // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) - #define MARLIN_EEPROM_SIZE 0x1000 // 4KB + #define MARLIN_EEPROM_SIZE 0x1000 // 4K #endif // diff --git a/Marlin/src/pins/stm32f1/pins_CHITU3D_common.h b/Marlin/src/pins/stm32f1/pins_CHITU3D_common.h index 989b7eec6f65..bc41e97041fc 100644 --- a/Marlin/src/pins/stm32f1/pins_CHITU3D_common.h +++ b/Marlin/src/pins/stm32f1/pins_CHITU3D_common.h @@ -44,10 +44,10 @@ #if ENABLED(FLASH_EEPROM_EMULATION) // SoC Flash (framework-arduinoststm32-maple/STM32F1/libraries/EEPROM/EEPROM.h) #define EEPROM_START_ADDRESS (0x8000000UL + (512 * 1024) - 2 * EEPROM_PAGE_SIZE) - #define EEPROM_PAGE_SIZE (0x800U) // 2KB, but will use 2x more (4KB) + #define EEPROM_PAGE_SIZE (0x800U) // 2K, but will use 2x more (4K) #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE #else - #define MARLIN_EEPROM_SIZE 0x800U // On SD, Limit to 2KB, require this amount of RAM + #define MARLIN_EEPROM_SIZE 0x800U // On SD, Limit to 2K, require this amount of RAM #endif // diff --git a/Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h b/Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h index 0682bfd73620..8d0093a4d989 100644 --- a/Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h @@ -41,7 +41,7 @@ #if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION - #define EEPROM_PAGE_SIZE (0x800U) // 2KB + #define EEPROM_PAGE_SIZE (0x800U) // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) #define MARLIN_EEPROM_SIZE (EEPROM_PAGE_SIZE) #endif diff --git a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h index 947e36c765e7..ada12ee3ea4b 100644 --- a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h +++ b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h @@ -53,9 +53,9 @@ // #if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION - #define EEPROM_PAGE_SIZE (0x800U) // 2KB + #define EEPROM_PAGE_SIZE (0x800U) // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) - #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2KB + #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2K #endif // diff --git a/Marlin/src/pins/stm32f1/pins_FLY_MINI.h b/Marlin/src/pins/stm32f1/pins_FLY_MINI.h index 5468d0b4bd7c..952b40c1dedb 100644 --- a/Marlin/src/pins/stm32f1/pins_FLY_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_FLY_MINI.h @@ -32,7 +32,7 @@ // #if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION - #define EEPROM_PAGE_SIZE 0x800 // 2KB + #define EEPROM_PAGE_SIZE 0x800 // 2K #define EEPROM_START_ADDRESS (0x8000000 + 256 * 1024 - 2 * EEPROM_PAGE_SIZE) // 256K firmware space #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE #endif diff --git a/Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h b/Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h index fe6fd6fa5733..9250ee112762 100644 --- a/Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h +++ b/Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h @@ -40,9 +40,9 @@ // #if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION - #define EEPROM_PAGE_SIZE (0x800U) // 2KB + #define EEPROM_PAGE_SIZE (0x800U) // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) - #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2KB + #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2K #endif // diff --git a/Marlin/src/pins/stm32f1/pins_FYSETC_CHEETAH.h b/Marlin/src/pins/stm32f1/pins_FYSETC_CHEETAH.h index 08aeca8c5b59..beda50d29b1b 100644 --- a/Marlin/src/pins/stm32f1/pins_FYSETC_CHEETAH.h +++ b/Marlin/src/pins/stm32f1/pins_FYSETC_CHEETAH.h @@ -37,9 +37,9 @@ #if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION - #define EEPROM_PAGE_SIZE (0x800U) // 2KB + #define EEPROM_PAGE_SIZE (0x800U) // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) - #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2KB + #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2K #endif // diff --git a/Marlin/src/pins/stm32f1/pins_GTM32_MINI.h b/Marlin/src/pins/stm32f1/pins_GTM32_MINI.h index 03547381c010..5515132c7844 100644 --- a/Marlin/src/pins/stm32f1/pins_GTM32_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_GTM32_MINI.h @@ -53,7 +53,7 @@ // Enable EEPROM Emulation for this board as it doesn't have EEPROM #if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION - #define MARLIN_EEPROM_SIZE 0x1000 // 4KB + #define MARLIN_EEPROM_SIZE 0x1000 // 4K #endif // diff --git a/Marlin/src/pins/stm32f1/pins_GTM32_MINI_A30.h b/Marlin/src/pins/stm32f1/pins_GTM32_MINI_A30.h index cb5200bc27da..dc23680b8c20 100644 --- a/Marlin/src/pins/stm32f1/pins_GTM32_MINI_A30.h +++ b/Marlin/src/pins/stm32f1/pins_GTM32_MINI_A30.h @@ -53,7 +53,7 @@ // Enable EEPROM Emulation for this board as it doesn't have EEPROM #if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION - #define MARLIN_EEPROM_SIZE 0x1000 // 4KB + #define MARLIN_EEPROM_SIZE 0x1000 // 4K #endif // diff --git a/Marlin/src/pins/stm32f1/pins_GTM32_PRO_VB.h b/Marlin/src/pins/stm32f1/pins_GTM32_PRO_VB.h index 88aa35f2c08b..4b5d38e8c544 100644 --- a/Marlin/src/pins/stm32f1/pins_GTM32_PRO_VB.h +++ b/Marlin/src/pins/stm32f1/pins_GTM32_PRO_VB.h @@ -58,7 +58,7 @@ // Enable EEPROM Emulation for this board as it doesn't have EEPROM #if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION - #define MARLIN_EEPROM_SIZE 0x1000 // 4KB + #define MARLIN_EEPROM_SIZE 0x1000 // 4K #endif // diff --git a/Marlin/src/pins/stm32f1/pins_GTM32_REV_B.h b/Marlin/src/pins/stm32f1/pins_GTM32_REV_B.h index 12a6d5b84d7f..968d9cb6bd58 100644 --- a/Marlin/src/pins/stm32f1/pins_GTM32_REV_B.h +++ b/Marlin/src/pins/stm32f1/pins_GTM32_REV_B.h @@ -53,7 +53,7 @@ // Enable EEPROM Emulation for this board as it doesn't have EEPROM #if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION - #define MARLIN_EEPROM_SIZE 0x1000 // 4KB + #define MARLIN_EEPROM_SIZE 0x1000 // 4K #endif // diff --git a/Marlin/src/pins/stm32f1/pins_JGAURORA_A5S_A1.h b/Marlin/src/pins/stm32f1/pins_JGAURORA_A5S_A1.h index beae0a3bf0b6..86a8ed6b9a81 100644 --- a/Marlin/src/pins/stm32f1/pins_JGAURORA_A5S_A1.h +++ b/Marlin/src/pins/stm32f1/pins_JGAURORA_A5S_A1.h @@ -53,9 +53,9 @@ #endif #if ENABLED(I2C_EEPROM) - //#define MARLIN_EEPROM_SIZE 0x8000UL // 32KB + //#define MARLIN_EEPROM_SIZE 0x8000UL // 32K #elif ENABLED(FLASH_EEPROM_EMULATION) - //#define MARLIN_EEPROM_SIZE 0x1000UL // 4KB + //#define MARLIN_EEPROM_SIZE 0x1000UL // 4K //#define MARLIN_EEPROM_SIZE (EEPROM_START_ADDRESS + (EEPROM_PAGE_SIZE) * 2UL) #endif diff --git a/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h b/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h index ac11bd8b38b8..59d9b8d95676 100644 --- a/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h +++ b/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h @@ -194,19 +194,19 @@ #define EEPROM_SCK_PIN BOARD_SPI1_SCK_PIN // PA5 pin 30 #define EEPROM_MISO_PIN BOARD_SPI1_MISO_PIN // PA6 pin 31 #define EEPROM_MOSI_PIN BOARD_SPI1_MOSI_PIN // PA7 pin 32 - #define EEPROM_PAGE_SIZE 0x1000U // 4KB (from datasheet) - #define MARLIN_EEPROM_SIZE 16UL * (EEPROM_PAGE_SIZE) // Limit to 64KB for now... + #define EEPROM_PAGE_SIZE 0x1000U // 4K (from datasheet) + #define MARLIN_EEPROM_SIZE 16UL * (EEPROM_PAGE_SIZE) // Limit to 64K for now... #elif HAS_SPI_FLASH - #define SPI_FLASH_SIZE 0x40000U // limit to 256KB (M993 will reboot with 512) + #define SPI_FLASH_SIZE 0x40000U // limit to 256K (M993 will reboot with 512) #define SPI_FLASH_CS_PIN PC5 #define SPI_FLASH_MOSI_PIN PA7 #define SPI_FLASH_MISO_PIN PA6 #define SPI_FLASH_SCK_PIN PA5 #elif ENABLED(FLASH_EEPROM_EMULATION) // SoC Flash (framework-arduinoststm32-maple/STM32F1/libraries/EEPROM/EEPROM.h) - #define EEPROM_PAGE_SIZE (0x800U) // 2KB + #define EEPROM_PAGE_SIZE (0x800U) // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) #define MARLIN_EEPROM_SIZE (EEPROM_PAGE_SIZE) #else - #define MARLIN_EEPROM_SIZE 0x800U // On SD, Limit to 2KB, require this amount of RAM + #define MARLIN_EEPROM_SIZE 0x800U // On SD, Limit to 2K, require this amount of RAM #endif diff --git a/Marlin/src/pins/stm32f1/pins_MINGDA_MPX_ARM_MINI.h b/Marlin/src/pins/stm32f1/pins_MINGDA_MPX_ARM_MINI.h index 87526bac8797..37c67708848c 100644 --- a/Marlin/src/pins/stm32f1/pins_MINGDA_MPX_ARM_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_MINGDA_MPX_ARM_MINI.h @@ -46,16 +46,16 @@ #define I2C_EEPROM #undef NO_EEPROM_SELECTED -#define MARLIN_EEPROM_SIZE 0x1000 // 4KB +#define MARLIN_EEPROM_SIZE 0x1000 // 4K #define USE_SHARED_EEPROM 1 // Use Platform-independent Arduino functions for I2C EEPROM #define E2END 0xFFFF // EEPROM end address AT24C256 (32kB) */ #if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION - #define EEPROM_PAGE_SIZE 0x800U // 2KB + #define EEPROM_PAGE_SIZE 0x800U // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) - #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2KB + #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2K #endif #define SPI_DEVICE 2 diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h index 150c18d79a1b..6ab20681ad5a 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h @@ -53,7 +53,7 @@ #endif #if ENABLED(FLASH_EEPROM_EMULATION) - #define EEPROM_PAGE_SIZE (0x800U) // 2KB + #define EEPROM_PAGE_SIZE (0x800U) // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) #define MARLIN_EEPROM_SIZE (EEPROM_PAGE_SIZE) #endif diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h index 88c5d5f53c73..ef800b15c7a3 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h @@ -54,7 +54,7 @@ #if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM) #define I2C_EEPROM // EEPROM on I2C-0 - #define MARLIN_EEPROM_SIZE 0x1000 // 4KB + #define MARLIN_EEPROM_SIZE 0x1000 // 4K #endif // diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_V1_1_common.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_V1_1_common.h index 4eaf2e946939..31e034e025e9 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_V1_1_common.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_V1_1_common.h @@ -27,7 +27,7 @@ // Onboard I2C EEPROM #if NO_EEPROM_SELECTED #define I2C_EEPROM - #define MARLIN_EEPROM_SIZE 0x1000// 4KB + #define MARLIN_EEPROM_SIZE 0x1000// 4K #undef NO_EEPROM_SELECTED #endif diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h index a1a822a9c2f3..4af88c18482a 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h @@ -40,9 +40,9 @@ // #if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION - #define EEPROM_PAGE_SIZE (0x800U) // 2KB + #define EEPROM_PAGE_SIZE (0x800U) // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) - #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2KB + #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2K #endif // diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h index c981fdc00a57..d45ab1a950ec 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h @@ -45,9 +45,9 @@ // #if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION - #define EEPROM_PAGE_SIZE (0x800U) // 2KB + #define EEPROM_PAGE_SIZE (0x800U) // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) - #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2KB + #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2K #endif #define SPI_DEVICE 2 diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h index 07ee8c4fa060..49fe59577edc 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h @@ -54,7 +54,7 @@ #if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM) #define I2C_EEPROM // EEPROM on I2C-0 - #define MARLIN_EEPROM_SIZE 0x1000 // 4KB + #define MARLIN_EEPROM_SIZE 0x1000 // 4K #endif // diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h index e057e13c25f0..2040a4ba29d8 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h @@ -42,9 +42,9 @@ #endif #if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION - #define EEPROM_PAGE_SIZE (0x800U) // 2KB + #define EEPROM_PAGE_SIZE (0x800U) // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) - #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2KB + #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2K #endif #define SPI_DEVICE 2 diff --git a/Marlin/src/pins/stm32f1/pins_PANDA_PI_V29.h b/Marlin/src/pins/stm32f1/pins_PANDA_PI_V29.h index 7f4aa563b01c..98ef165e2d66 100644 --- a/Marlin/src/pins/stm32f1/pins_PANDA_PI_V29.h +++ b/Marlin/src/pins/stm32f1/pins_PANDA_PI_V29.h @@ -33,9 +33,9 @@ #if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION - #define EEPROM_PAGE_SIZE (0x800U) // 2KB + #define EEPROM_PAGE_SIZE (0x800U) // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) - #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2KB + #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2K #endif // diff --git a/Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h b/Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h index 6c7e7cbbfa48..4ffa8da924d3 100644 --- a/Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h +++ b/Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h @@ -51,10 +51,10 @@ #if ENABLED(FLASH_EEPROM_EMULATION) // SoC Flash (framework-arduinoststm32-maple/STM32F1/libraries/EEPROM/EEPROM.h) #define EEPROM_START_ADDRESS (0x8000000UL + (512 * 1024) - 2 * EEPROM_PAGE_SIZE) - #define EEPROM_PAGE_SIZE (0x800U) // 2KB, but will use 2x more (4KB) + #define EEPROM_PAGE_SIZE (0x800U) // 2K, but will use 2x more (4K) #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE #else - #define MARLIN_EEPROM_SIZE (0x800U) // On SD, Limit to 2KB, require this amount of RAM + #define MARLIN_EEPROM_SIZE (0x800U) // On SD, Limit to 2K, require this amount of RAM #endif // diff --git a/Marlin/src/pins/stm32f1/pins_ZM3E2_V1_0.h b/Marlin/src/pins/stm32f1/pins_ZM3E2_V1_0.h index b1e5f77d0e9f..f1f03a7dd789 100644 --- a/Marlin/src/pins/stm32f1/pins_ZM3E2_V1_0.h +++ b/Marlin/src/pins/stm32f1/pins_ZM3E2_V1_0.h @@ -30,9 +30,9 @@ #if NO_EEPROM_SELECTED #define FLASH_EEPROM_EMULATION - #define EEPROM_PAGE_SIZE (0x800) // 2KB + #define EEPROM_PAGE_SIZE (0x800) // 2K #define EEPROM_START_ADDRESS (0x08000000 + (STM32_FLASH_SIZE) * 1024 - 2 * EEPROM_PAGE_SIZE) - #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2KB + #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2K #endif //============================================================================= diff --git a/Marlin/src/pins/stm32f1/pins_ZM3E4_V1_0.h b/Marlin/src/pins/stm32f1/pins_ZM3E4_V1_0.h index 49e9564b2738..17e13bdc87ba 100644 --- a/Marlin/src/pins/stm32f1/pins_ZM3E4_V1_0.h +++ b/Marlin/src/pins/stm32f1/pins_ZM3E4_V1_0.h @@ -30,9 +30,9 @@ #if NO_EEPROM_SELECTED #define FLASH_EEPROM_EMULATION - #define EEPROM_PAGE_SIZE (0x800) // 2KB + #define EEPROM_PAGE_SIZE (0x800) // 2K #define EEPROM_START_ADDRESS (0x08000000 + (STM32_FLASH_SIZE) * 1024 - 2 * EEPROM_PAGE_SIZE) - #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2KB + #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2K #endif //#define OPTION_DUALZ_DRIVE diff --git a/Marlin/src/pins/stm32f1/pins_ZM3E4_V2_0.h b/Marlin/src/pins/stm32f1/pins_ZM3E4_V2_0.h index 295ab4c50ccc..df0eb9c3d812 100644 --- a/Marlin/src/pins/stm32f1/pins_ZM3E4_V2_0.h +++ b/Marlin/src/pins/stm32f1/pins_ZM3E4_V2_0.h @@ -30,9 +30,9 @@ #if NO_EEPROM_SELECTED #define FLASH_EEPROM_EMULATION - #define EEPROM_PAGE_SIZE (0x800) // 2KB + #define EEPROM_PAGE_SIZE (0x800) // 2K #define EEPROM_START_ADDRESS (0x08000000 + (STM32_FLASH_SIZE) * 1024 - 2 * EEPROM_PAGE_SIZE) - #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2KB + #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2K #endif //#define OPTION_DUALZ_DRIVE diff --git a/Marlin/src/pins/stm32f4/pins_ANET_ET4.h b/Marlin/src/pins/stm32f4/pins_ANET_ET4.h index 43aefe97f51d..09da5adf7c6d 100644 --- a/Marlin/src/pins/stm32f4/pins_ANET_ET4.h +++ b/Marlin/src/pins/stm32f4/pins_ANET_ET4.h @@ -39,7 +39,7 @@ #if NO_EEPROM_SELECTED //#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation #define FLASH_EEPROM_EMULATION // Use Flash-based EEPROM emulation - //#define IIC_BL24CXX_EEPROM // Use I2C EEPROM onboard IC (AT24C04C, Size 4KB, PageSize 16B) + //#define IIC_BL24CXX_EEPROM // Use I2C EEPROM onboard IC (AT24C04C, Size 4K, PageSize 16B) #endif #if ENABLED(FLASH_EEPROM_EMULATION) @@ -50,7 +50,7 @@ #define IIC_EEPROM_SDA PB11 #define IIC_EEPROM_SCL PB10 #define EEPROM_DEVICE_ADDRESS 0xA0 - #define MARLIN_EEPROM_SIZE 0x1000 // 4KB + #define MARLIN_EEPROM_SIZE 0x1000 // 4K #endif // diff --git a/Marlin/src/pins/stm32f4/pins_ARMED.h b/Marlin/src/pins/stm32f4/pins_ARMED.h index f7c6b7f88a76..6d5b87240d6b 100644 --- a/Marlin/src/pins/stm32f4/pins_ARMED.h +++ b/Marlin/src/pins/stm32f4/pins_ARMED.h @@ -40,7 +40,7 @@ #if NO_EEPROM_SELECTED #define I2C_EEPROM - #define MARLIN_EEPROM_SIZE 0x1000 // 4KB + #define MARLIN_EEPROM_SIZE 0x1000 // 4K #endif // diff --git a/Marlin/src/pins/stm32f4/pins_ARTILLERY_RUBY.h b/Marlin/src/pins/stm32f4/pins_ARTILLERY_RUBY.h index 7a60f4aa0220..653735bd61d0 100644 --- a/Marlin/src/pins/stm32f4/pins_ARTILLERY_RUBY.h +++ b/Marlin/src/pins/stm32f4/pins_ARTILLERY_RUBY.h @@ -33,7 +33,7 @@ #define FLASH_EEPROM_EMULATION //#define I2C_EEPROM #endif -//#define E2END 0xFFF // 4KB +//#define E2END 0xFFF // 4K #define HAL_TIMER_RATE F_CPU diff --git a/Marlin/src/pins/stm32f4/pins_BLACK_STM32F407VE.h b/Marlin/src/pins/stm32f4/pins_BLACK_STM32F407VE.h index 061680aa79cd..9da6e1a01b6a 100644 --- a/Marlin/src/pins/stm32f4/pins_BLACK_STM32F407VE.h +++ b/Marlin/src/pins/stm32f4/pins_BLACK_STM32F407VE.h @@ -42,7 +42,7 @@ //#define I2C_EEPROM #define SRAM_EEPROM_EMULATION -#define MARLIN_EEPROM_SIZE 0x2000 // 8KB +#define MARLIN_EEPROM_SIZE 0x2000 // 8K // // Servos diff --git a/Marlin/src/pins/stm32f4/pins_BTT_E3_RRF.h b/Marlin/src/pins/stm32f4/pins_BTT_E3_RRF.h index 554b2704c7df..40f953a7e8f5 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_E3_RRF.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_E3_RRF.h @@ -36,7 +36,7 @@ // Onboard I2C EEPROM #define I2C_EEPROM -#define MARLIN_EEPROM_SIZE 0x1000 // 4KB +#define MARLIN_EEPROM_SIZE 0x1000 // 4K // // Servos diff --git a/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h b/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h index 7db6c4922e88..25736b1a4905 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h @@ -37,7 +37,7 @@ // Onboard I2C EEPROM #define I2C_EEPROM -#define MARLIN_EEPROM_SIZE 0x2000 // 8KB (24C64 ... 64Kb = 8KB) +#define MARLIN_EEPROM_SIZE 0x2000 // 8K (24C64 ... 64Kb = 8K) // // Servos diff --git a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h index 8652a815c21b..c53e9344aaa6 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h @@ -28,7 +28,7 @@ // Onboard I2C EEPROM #define I2C_EEPROM -#define MARLIN_EEPROM_SIZE 0x8000 // 32KB (24C32A) +#define MARLIN_EEPROM_SIZE 0x8000 // 32K (24C32A) #define I2C_SCL_PIN PB8 #define I2C_SDA_PIN PB9 diff --git a/Marlin/src/pins/stm32f4/pins_FLYF407ZG.h b/Marlin/src/pins/stm32f4/pins_FLYF407ZG.h index 514fad4b8924..3f5f7262b387 100644 --- a/Marlin/src/pins/stm32f4/pins_FLYF407ZG.h +++ b/Marlin/src/pins/stm32f4/pins_FLYF407ZG.h @@ -50,11 +50,11 @@ // the 128kB sector allocated for EEPROM emulation. #define FLASH_EEPROM_LEVELING #elif ENABLED(I2C_EEPROM) - #define MARLIN_EEPROM_SIZE 0x2000 // 8KB + #define MARLIN_EEPROM_SIZE 0x2000 // 8K #endif #ifndef MARLIN_EEPROM_SIZE - #define MARLIN_EEPROM_SIZE 0x1000 // 4KB + #define MARLIN_EEPROM_SIZE 0x1000 // 4K #endif // diff --git a/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h b/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h index dfcb4217c9db..299cc153773d 100644 --- a/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h +++ b/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h @@ -50,7 +50,7 @@ // 128 kB sector allocated for EEPROM emulation. #define FLASH_EEPROM_LEVELING #elif ENABLED(I2C_EEPROM) - #define MARLIN_EEPROM_SIZE 0x1000 // 4KB + #define MARLIN_EEPROM_SIZE 0x1000 // 4K #endif // diff --git a/Marlin/src/pins/stm32f4/pins_FYSETC_SPIDER.h b/Marlin/src/pins/stm32f4/pins_FYSETC_SPIDER.h index e05811552e2b..67f276bd2295 100644 --- a/Marlin/src/pins/stm32f4/pins_FYSETC_SPIDER.h +++ b/Marlin/src/pins/stm32f4/pins_FYSETC_SPIDER.h @@ -39,7 +39,7 @@ #endif #if ENABLED(I2C_EEPROM) - #define MARLIN_EEPROM_SIZE 0x1000 // 4KB + #define MARLIN_EEPROM_SIZE 0x1000 // 4K #endif // diff --git a/Marlin/src/pins/stm32f4/pins_INDEX_REV03.h b/Marlin/src/pins/stm32f4/pins_INDEX_REV03.h index 977f4763437c..ba3172aa8008 100644 --- a/Marlin/src/pins/stm32f4/pins_INDEX_REV03.h +++ b/Marlin/src/pins/stm32f4/pins_INDEX_REV03.h @@ -40,7 +40,7 @@ */ #define SRAM_EEPROM_EMULATION -#define MARLIN_EEPROM_SIZE 0x2000 // 8KB +#define MARLIN_EEPROM_SIZE 0x2000 // 8K // I2C MCP3426 (16-Bit, 240SPS, dual-channel ADC) #define HAS_MCP3426_ADC diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h index e4fc97170c44..4def11abec8e 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h @@ -186,15 +186,15 @@ #define EEPROM_SCK_PIN PB13 // datasheet: CLK pin, found with multimeter, not tested #define EEPROM_MISO_PIN PB14 // datasheet: DO pin, found with multimeter, not tested #define EEPROM_MOSI_PIN PB15 // datasheet: DI pin, found with multimeter, not tested - #define EEPROM_PAGE_SIZE 0x1000U // 4KB (from datasheet) - #define MARLIN_EEPROM_SIZE 16UL * (EEPROM_PAGE_SIZE) // Limit to 64KB for now... + #define EEPROM_PAGE_SIZE 0x1000U // 4K (from datasheet) + #define MARLIN_EEPROM_SIZE 16UL * (EEPROM_PAGE_SIZE) // Limit to 64K for now... #elif ENABLED(I2C_EEPROM) // FM24CL64BG (CYP1813) 64Kbit F-RAM #define SOFT_I2C_EEPROM // Force the use of Software I2C #define I2C_SDA_PIN PG13 #define I2C_SCL_PIN PG14 // To be confirmed on the Lerdge S, but probably same as the K #define MARLIN_EEPROM_SIZE 0x10000 #else - #define MARLIN_EEPROM_SIZE 0x800U // On SD, Limit to 2KB, require this amount of RAM + #define MARLIN_EEPROM_SIZE 0x800U // On SD, Limit to 2K, require this amount of RAM #endif // diff --git a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8.h b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8.h index af71f0d562c8..124923fef841 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8.h @@ -44,7 +44,7 @@ //#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation //#define FLASH_EEPROM_EMULATION // Use Flash-based EEPROM emulation #define I2C_EEPROM // Need use jumpers set i2c for EEPROM -#define MARLIN_EEPROM_SIZE 0x1000 // 4KB +#define MARLIN_EEPROM_SIZE 0x1000 // 4K #define I2C_SCL_PIN PB8 // I2C_SCL and CAN_RX #define I2C_SDA_PIN PB9 // I2C_SDA and CAN_TX diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h index 032ce41bcb2f..22e00a4eb4a7 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h @@ -36,7 +36,7 @@ //#define FLASH_EEPROM_EMULATION // Use Flash-based EEPROM emulation #if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM) #define I2C_EEPROM - #define MARLIN_EEPROM_SIZE 0x1000 // 4KB + #define MARLIN_EEPROM_SIZE 0x1000 // 4K #define I2C_SCL_PIN PB6 #define I2C_SDA_PIN PB7 #endif diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h index 68b238525477..fde2682dc097 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h @@ -37,7 +37,7 @@ //#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation //#define FLASH_EEPROM_EMULATION // Use Flash-based EEPROM emulation #define I2C_EEPROM -#define MARLIN_EEPROM_SIZE 0x1000 // 4KB +#define MARLIN_EEPROM_SIZE 0x1000 // 4K #define HAS_OTG_USB_HOST_SUPPORT // USB Flash Drive support diff --git a/Marlin/src/pins/stm32f4/pins_RUMBA32_AUS3D.h b/Marlin/src/pins/stm32f4/pins_RUMBA32_AUS3D.h index f2073457b13b..e926a2b0c6a4 100644 --- a/Marlin/src/pins/stm32f4/pins_RUMBA32_AUS3D.h +++ b/Marlin/src/pins/stm32f4/pins_RUMBA32_AUS3D.h @@ -33,10 +33,10 @@ #if NO_EEPROM_SELECTED #if MB(RUMBA32_V1_0) #define FLASH_EEPROM_EMULATION - #define MARLIN_EEPROM_SIZE 0x1000 // 4KB + #define MARLIN_EEPROM_SIZE 0x1000 // 4K #elif MB(RUMBA32_V1_1) #define I2C_EEPROM - #define MARLIN_EEPROM_SIZE 0x2000 // 8KB (24LC64T-I/OT) + #define MARLIN_EEPROM_SIZE 0x2000 // 8K (24LC64T-I/OT) #endif #endif diff --git a/Marlin/src/pins/stm32f4/pins_RUMBA32_BTT.h b/Marlin/src/pins/stm32f4/pins_RUMBA32_BTT.h index 28d2dfd1806f..2f3e121fe17a 100644 --- a/Marlin/src/pins/stm32f4/pins_RUMBA32_BTT.h +++ b/Marlin/src/pins/stm32f4/pins_RUMBA32_BTT.h @@ -30,7 +30,7 @@ #if NO_EEPROM_SELECTED #define I2C_EEPROM - #define MARLIN_EEPROM_SIZE 0x1000 // 4KB (24LC32AT-I/OT) + #define MARLIN_EEPROM_SIZE 0x1000 // 4K (24LC32AT-I/OT) #endif #if ENABLED(FLASH_EEPROM_EMULATION) diff --git a/Marlin/src/pins/stm32f4/pins_RUMBA32_MKS.h b/Marlin/src/pins/stm32f4/pins_RUMBA32_MKS.h index 0b539417d6d0..3833a3a007a9 100644 --- a/Marlin/src/pins/stm32f4/pins_RUMBA32_MKS.h +++ b/Marlin/src/pins/stm32f4/pins_RUMBA32_MKS.h @@ -37,7 +37,7 @@ #if NO_EEPROM_SELECTED #define FLASH_EEPROM_EMULATION - #define MARLIN_EEPROM_SIZE 0x1000 // 4KB + #define MARLIN_EEPROM_SIZE 0x1000 // 4K #endif #if ENABLED(FLASH_EEPROM_EMULATION) diff --git a/Marlin/src/pins/stm32f4/pins_TH3D_EZBOARD_V2.h b/Marlin/src/pins/stm32f4/pins_TH3D_EZBOARD_V2.h index fd6b96054214..1439e6de651c 100644 --- a/Marlin/src/pins/stm32f4/pins_TH3D_EZBOARD_V2.h +++ b/Marlin/src/pins/stm32f4/pins_TH3D_EZBOARD_V2.h @@ -34,7 +34,7 @@ // Onboard I2C EEPROM #if NO_EEPROM_SELECTED #define I2C_EEPROM - #define MARLIN_EEPROM_SIZE 0x1000 // 4KB + #define MARLIN_EEPROM_SIZE 0x1000 // 4K #define I2C_SCL_PIN PB6 #define I2C_SDA_PIN PB7 #undef NO_EEPROM_SELECTED diff --git a/Marlin/src/pins/stm32f4/pins_VAKE403D.h b/Marlin/src/pins/stm32f4/pins_VAKE403D.h index c6b24f9eca61..813944d3cb43 100644 --- a/Marlin/src/pins/stm32f4/pins_VAKE403D.h +++ b/Marlin/src/pins/stm32f4/pins_VAKE403D.h @@ -32,7 +32,7 @@ #define BOARD_INFO_NAME "STM32F4 VAkE" //#define I2C_EEPROM -#define MARLIN_EEPROM_SIZE 0x1000 // 4KB +#define MARLIN_EEPROM_SIZE 0x1000 // 4K // // Servos diff --git a/Marlin/src/pins/stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h b/Marlin/src/pins/stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h index 2fddb68a7c0c..4fc3504ed1c9 100644 --- a/Marlin/src/pins/stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h +++ b/Marlin/src/pins/stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h @@ -41,7 +41,7 @@ #define SOFT_I2C_EEPROM // Force the use of Software I2C #define I2C_SCL_PIN PB6 #define I2C_SDA_PIN PB7 - #define MARLIN_EEPROM_SIZE 0x1000 // 4KB + #define MARLIN_EEPROM_SIZE 0x1000 // 4K #endif // diff --git a/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h b/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h index 9eb0acf1448d..0b6edc9d3c6e 100644 --- a/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h +++ b/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h @@ -30,7 +30,7 @@ // Onboard I2C EEPROM #define I2C_EEPROM -#define MARLIN_EEPROM_SIZE 0x1000 // 4KB (24C32 ... 32Kb = 4KB) +#define MARLIN_EEPROM_SIZE 0x1000 // 4K (24C32 ... 32Kb = 4K) #define HAS_OTG_USB_HOST_SUPPORT // USB Flash Drive support From 0a6c58ea71b556da6f1a0d133f46c1eeee67ac00 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Wed, 4 May 2022 18:13:21 +0000 Subject: [PATCH 013/241] [cron] Bump distribution date (2022-05-04) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 48fa2a020cae..4bc69bfeb8e8 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-05-03" +//#define STRING_DISTRIBUTION_DATE "2022-05-04" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index cb13e444616b..823a3536d1b8 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-05-03" + #define STRING_DISTRIBUTION_DATE "2022-05-04" #endif /** From 492d91791c5effa894d22977ff5032bed7856877 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 29 Mar 2022 03:24:15 -0500 Subject: [PATCH 014/241] =?UTF-8?q?=F0=9F=92=9A=20Lock=20CI=20testing=20to?= =?UTF-8?q?=20PlatformIO=205.2.5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test-builds.yml | 2 +- docker/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-builds.yml b/.github/workflows/test-builds.yml index 75cd6ee05fe7..069f36714d93 100644 --- a/.github/workflows/test-builds.yml +++ b/.github/workflows/test-builds.yml @@ -137,7 +137,7 @@ jobs: - name: Install PlatformIO run: | - pip install -U https://github.com/platformio/platformio-core/archive/develop.zip + pip install -U https://github.com/platformio/platformio-core/archive/v5.2.5.zip platformio update - name: Run ${{ matrix.test-platform }} Tests diff --git a/docker/Dockerfile b/docker/Dockerfile index 903b8b71fd32..ad3e15d5de6f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,6 +1,6 @@ FROM python:3.9.0-buster -RUN pip install -U https://github.com/platformio/platformio-core/archive/develop.zip +RUN pip install -U https://github.com/platformio/platformio-core/archive/v5.2.5.zip RUN platformio update # To get the test platforms RUN pip install PyYaml From 23a26e4033763b4c7b8763fd420211423e558d08 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 4 May 2022 17:03:25 -0500 Subject: [PATCH 015/241] =?UTF-8?q?=F0=9F=8C=90=20Clean=20up=20languages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/language/language_an.h | 1 - Marlin/src/lcd/language/language_bg.h | 1 - Marlin/src/lcd/language/language_ca.h | 1 - Marlin/src/lcd/language/language_cz.h | 1 - Marlin/src/lcd/language/language_da.h | 1 - Marlin/src/lcd/language/language_de.h | 1 - Marlin/src/lcd/language/language_el.h | 1 - Marlin/src/lcd/language/language_el_gr.h | 1 - Marlin/src/lcd/language/language_en.h | 1 - Marlin/src/lcd/language/language_es.h | 1 - Marlin/src/lcd/language/language_eu.h | 1 - Marlin/src/lcd/language/language_fi.h | 1 - Marlin/src/lcd/language/language_fr.h | 1 - Marlin/src/lcd/language/language_gl.h | 1 - Marlin/src/lcd/language/language_hr.h | 1 - Marlin/src/lcd/language/language_hu.h | 1 - Marlin/src/lcd/language/language_it.h | 1 - Marlin/src/lcd/language/language_jp_kana.h | 1 - Marlin/src/lcd/language/language_nl.h | 1 - Marlin/src/lcd/language/language_pl.h | 1 - Marlin/src/lcd/language/language_pt.h | 1 - Marlin/src/lcd/language/language_pt_br.h | 1 - Marlin/src/lcd/language/language_ro.h | 1 - Marlin/src/lcd/language/language_ru.h | 1 - Marlin/src/lcd/language/language_sk.h | 1 - Marlin/src/lcd/language/language_sv.h | 1 - Marlin/src/lcd/language/language_tr.h | 1 - Marlin/src/lcd/language/language_uk.h | 1 - Marlin/src/lcd/language/language_vi.h | 1 - Marlin/src/lcd/language/language_zh_CN.h | 1 - Marlin/src/lcd/language/language_zh_TW.h | 1 - 31 files changed, 31 deletions(-) diff --git a/Marlin/src/lcd/language/language_an.h b/Marlin/src/lcd/language/language_an.h index 1ebe13868717..c5a7e1877ec5 100644 --- a/Marlin/src/lcd/language/language_an.h +++ b/Marlin/src/lcd/language/language_an.h @@ -55,7 +55,6 @@ namespace Language_an { LSTR MSG_LEVEL_BED_DONE = _UxGT("Nivelacion feita!"); LSTR MSG_SET_HOME_OFFSETS = _UxGT("Achustar desfases"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Desfase aplicau"); - LSTR MSG_SET_ORIGIN = _UxGT("Establir orichen"); #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Precalentar ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Precalentar ") PREHEAT_1_LABEL " ~"; diff --git a/Marlin/src/lcd/language/language_bg.h b/Marlin/src/lcd/language/language_bg.h index 3137228c2d29..95ca4ce1bfcc 100644 --- a/Marlin/src/lcd/language/language_bg.h +++ b/Marlin/src/lcd/language/language_bg.h @@ -44,7 +44,6 @@ namespace Language_bg { LSTR MSG_DISABLE_STEPPERS = _UxGT("Изкл. двигатели"); LSTR MSG_AUTO_HOME = _UxGT("Паркиране"); LSTR MSG_SET_HOME_OFFSETS = _UxGT("Задай Начало"); - LSTR MSG_SET_ORIGIN = _UxGT("Изходна точка"); #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Подгряване ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Подгряване ") PREHEAT_1_LABEL " ~"; diff --git a/Marlin/src/lcd/language/language_ca.h b/Marlin/src/lcd/language/language_ca.h index 0e16c1a1fa47..582c27b1ae6a 100644 --- a/Marlin/src/lcd/language/language_ca.h +++ b/Marlin/src/lcd/language/language_ca.h @@ -53,7 +53,6 @@ namespace Language_ca { LSTR MSG_LEVEL_BED_DONE = _UxGT("Anivellament fet!"); LSTR MSG_SET_HOME_OFFSETS = _UxGT("Ajusta decalatge"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Decalatge aplicat"); - LSTR MSG_SET_ORIGIN = _UxGT("Estableix origen"); #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Preescalfa ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Preescalfa ") PREHEAT_1_LABEL " ~"; diff --git a/Marlin/src/lcd/language/language_cz.h b/Marlin/src/lcd/language/language_cz.h index 6f5d8445af82..76469c5fe5a8 100644 --- a/Marlin/src/lcd/language/language_cz.h +++ b/Marlin/src/lcd/language/language_cz.h @@ -77,7 +77,6 @@ namespace Language_cz { LSTR MSG_Z_FADE_HEIGHT = _UxGT("Výška srovnávání"); LSTR MSG_SET_HOME_OFFSETS = _UxGT("Nastavit ofsety"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Ofsety nastaveny"); - LSTR MSG_SET_ORIGIN = _UxGT("Nastavit počátek"); #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Zahřát ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Zahřát ") PREHEAT_1_LABEL " ~"; diff --git a/Marlin/src/lcd/language/language_da.h b/Marlin/src/lcd/language/language_da.h index b022720b5cae..01281db2688c 100644 --- a/Marlin/src/lcd/language/language_da.h +++ b/Marlin/src/lcd/language/language_da.h @@ -47,7 +47,6 @@ namespace Language_da { LSTR MSG_LEVEL_BED_DONE = _UxGT("Bed level er færdig!"); LSTR MSG_SET_HOME_OFFSETS = _UxGT("Sæt forsk. af home"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Forsk. er nu aktiv"); - LSTR MSG_SET_ORIGIN = _UxGT("Sæt origin"); #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Forvarm ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Forvarm ") PREHEAT_1_LABEL " ~"; diff --git a/Marlin/src/lcd/language/language_de.h b/Marlin/src/lcd/language/language_de.h index 49d30f2ef6fb..76dd48a9f5c9 100644 --- a/Marlin/src/lcd/language/language_de.h +++ b/Marlin/src/lcd/language/language_de.h @@ -91,7 +91,6 @@ namespace Language_de { LSTR MSG_HOME_OFFSET_V = _UxGT("Homeversatz ") STR_V; LSTR MSG_HOME_OFFSET_W = _UxGT("Homeversatz ") STR_W; LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Homeversatz aktiv"); - LSTR MSG_SET_ORIGIN = _UxGT("Setze Nullpunkte"); //"G92 X0 Y0 Z0" commented out in marlinui.cpp LSTR MSG_TRAMMING_WIZARD = _UxGT("Tramming Assistent"); LSTR MSG_SELECT_ORIGIN = _UxGT("Wählen Sie Ursprung"); LSTR MSG_LAST_VALUE_SP = _UxGT("Letzter Wert "); diff --git a/Marlin/src/lcd/language/language_el.h b/Marlin/src/lcd/language/language_el.h index f3cd7ef27898..370568175656 100644 --- a/Marlin/src/lcd/language/language_el.h +++ b/Marlin/src/lcd/language/language_el.h @@ -64,7 +64,6 @@ namespace Language_el { LSTR MSG_LEVEL_BED_DONE = _UxGT("Τέλος επιπεδοποίησης!"); LSTR MSG_SET_HOME_OFFSETS = _UxGT("Ορισμός μετατοπίσεων"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Εφαρμογή μετατοπίσεων"); - LSTR MSG_SET_ORIGIN = _UxGT("Ορισμός προέλευσης"); #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Προθέρμανση ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Προθέρμανση ") PREHEAT_1_LABEL " ~"; diff --git a/Marlin/src/lcd/language/language_el_gr.h b/Marlin/src/lcd/language/language_el_gr.h index d8c7cae38d68..b13893fb4cde 100644 --- a/Marlin/src/lcd/language/language_el_gr.h +++ b/Marlin/src/lcd/language/language_el_gr.h @@ -53,7 +53,6 @@ namespace Language_el_gr { LSTR MSG_LEVEL_BED_DONE = _UxGT("Ολοκλήρωση επιπεδοποίησης!"); LSTR MSG_SET_HOME_OFFSETS = _UxGT("Ορισμός βασικών μετατοπίσεων"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Εφαρμόστηκαν οι μετατοπίσεις"); - LSTR MSG_SET_ORIGIN = _UxGT("Ορισμός προέλευσης"); #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Προθέρμανση ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Προθέρμανση ") PREHEAT_1_LABEL " ~"; diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 31c19e542e01..6492508f26fb 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -107,7 +107,6 @@ namespace Language_en { LSTR MSG_HOME_OFFSET_V = _UxGT("Home Offset ") STR_V; LSTR MSG_HOME_OFFSET_W = _UxGT("Home Offset ") STR_W; LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Offsets Applied"); - LSTR MSG_SET_ORIGIN = _UxGT("Set Origin"); LSTR MSG_TRAMMING_WIZARD = _UxGT("Tramming Wizard"); LSTR MSG_SELECT_ORIGIN = _UxGT("Select Origin"); LSTR MSG_LAST_VALUE_SP = _UxGT("Last value "); diff --git a/Marlin/src/lcd/language/language_es.h b/Marlin/src/lcd/language/language_es.h index 6e2c82533e6f..4eb7c9f7e1a6 100644 --- a/Marlin/src/lcd/language/language_es.h +++ b/Marlin/src/lcd/language/language_es.h @@ -72,7 +72,6 @@ namespace Language_es { LSTR MSG_Z_FADE_HEIGHT = _UxGT("Compen. Altura"); LSTR MSG_SET_HOME_OFFSETS = _UxGT("Ajustar desfases"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Desfase aplicada"); - LSTR MSG_SET_ORIGIN = _UxGT("Establecer origen"); #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Precal. ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Precal. ") PREHEAT_1_LABEL " ~"; diff --git a/Marlin/src/lcd/language/language_eu.h b/Marlin/src/lcd/language/language_eu.h index 5742fa8f6f97..2d84518f0bfe 100644 --- a/Marlin/src/lcd/language/language_eu.h +++ b/Marlin/src/lcd/language/language_eu.h @@ -56,7 +56,6 @@ namespace Language_eu { LSTR MSG_LEVEL_BED_DONE = _UxGT("Berdintzea eginda"); LSTR MSG_SET_HOME_OFFSETS = _UxGT("Etxe. offset eza."); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Offsetak ezarrita"); - LSTR MSG_SET_ORIGIN = _UxGT("Hasiera ipini"); #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Berotu ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Berotu ") PREHEAT_1_LABEL " ~"; diff --git a/Marlin/src/lcd/language/language_fi.h b/Marlin/src/lcd/language/language_fi.h index 62f3aae807a5..066179c9504d 100644 --- a/Marlin/src/lcd/language/language_fi.h +++ b/Marlin/src/lcd/language/language_fi.h @@ -43,7 +43,6 @@ namespace Language_fi { LSTR MSG_RUN_AUTO_FILES = _UxGT("Automaatti"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Vapauta moottorit"); LSTR MSG_AUTO_HOME = _UxGT("Aja referenssiin"); - LSTR MSG_SET_ORIGIN = _UxGT("Aseta origo"); #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Esilämmitä ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Esilämmitä ") PREHEAT_1_LABEL " ~"; diff --git a/Marlin/src/lcd/language/language_fr.h b/Marlin/src/lcd/language/language_fr.h index ae23efd367d7..f3ea9b5e3b80 100644 --- a/Marlin/src/lcd/language/language_fr.h +++ b/Marlin/src/lcd/language/language_fr.h @@ -76,7 +76,6 @@ namespace Language_fr { LSTR MSG_HOME_OFFSET_J = _UxGT("Décal. origine ") STR_J; LSTR MSG_HOME_OFFSET_K = _UxGT("Décal. origine ") STR_K; LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Décalages appliqués"); - LSTR MSG_SET_ORIGIN = _UxGT("Régler origine"); LSTR MSG_TRAMMING_WIZARD = _UxGT("Assistant Molettes"); LSTR MSG_SELECT_ORIGIN = _UxGT("Molette du lit"); // Not a selection of the origin LSTR MSG_LAST_VALUE_SP = _UxGT("Ecart origine "); diff --git a/Marlin/src/lcd/language/language_gl.h b/Marlin/src/lcd/language/language_gl.h index 731f89cad4dd..cc57545e6564 100644 --- a/Marlin/src/lcd/language/language_gl.h +++ b/Marlin/src/lcd/language/language_gl.h @@ -69,7 +69,6 @@ namespace Language_gl { LSTR MSG_Z_FADE_HEIGHT = _UxGT("Compensación Altura"); LSTR MSG_SET_HOME_OFFSETS = _UxGT("Axustar Desfases"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Desfases aplicados"); - LSTR MSG_SET_ORIGIN = _UxGT("Fixar orixe"); #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Prequentar ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Prequentar ") PREHEAT_1_LABEL " ~"; diff --git a/Marlin/src/lcd/language/language_hr.h b/Marlin/src/lcd/language/language_hr.h index 78db2ad66029..40705bbc91d9 100644 --- a/Marlin/src/lcd/language/language_hr.h +++ b/Marlin/src/lcd/language/language_hr.h @@ -53,7 +53,6 @@ namespace Language_hr { LSTR MSG_LEVEL_BED_DONE = _UxGT("Niveliranje gotovo!"); LSTR MSG_SET_HOME_OFFSETS = _UxGT("Postavi home offsete"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Offsets postavljeni"); - LSTR MSG_SET_ORIGIN = _UxGT("Postavi ishodište"); #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Predgrij ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Predgrij ") PREHEAT_1_LABEL " ~"; diff --git a/Marlin/src/lcd/language/language_hu.h b/Marlin/src/lcd/language/language_hu.h index 341d1b467ddb..a47b687f3a15 100644 --- a/Marlin/src/lcd/language/language_hu.h +++ b/Marlin/src/lcd/language/language_hu.h @@ -83,7 +83,6 @@ namespace Language_hu { LSTR MSG_HOME_OFFSET_J = _UxGT("Kezdö eltol. ") STR_J; LSTR MSG_HOME_OFFSET_K = _UxGT("Kezdö eltol. ") STR_K; LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Eltolás beállítva."); - LSTR MSG_SET_ORIGIN = _UxGT("Eredeti Be"); LSTR MSG_TRAMMING_WIZARD = _UxGT("Elektromos varázsló"); LSTR MSG_SELECT_ORIGIN = _UxGT("Eredeti választása"); LSTR MSG_LAST_VALUE_SP = _UxGT("Utolsó érték "); diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index 7113fdcd57cd..654ecbacbbd2 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -102,7 +102,6 @@ namespace Language_it { LSTR MSG_HOME_OFFSET_V = _UxGT("Offset home ") STR_V; LSTR MSG_HOME_OFFSET_W = _UxGT("Offset home ") STR_W; LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Offset applicato"); - LSTR MSG_SET_ORIGIN = _UxGT("Imposta Origine"); LSTR MSG_TRAMMING_WIZARD = _UxGT("Wizard Tramming"); LSTR MSG_SELECT_ORIGIN = _UxGT("Selez. origine"); LSTR MSG_LAST_VALUE_SP = _UxGT("Ultimo valore "); diff --git a/Marlin/src/lcd/language/language_jp_kana.h b/Marlin/src/lcd/language/language_jp_kana.h index 164dca8fcfe2..01d1c0b987ea 100644 --- a/Marlin/src/lcd/language/language_jp_kana.h +++ b/Marlin/src/lcd/language/language_jp_kana.h @@ -61,7 +61,6 @@ namespace Language_jp_kana { LSTR MSG_LEVEL_BED_DONE = _UxGT("レベリングカンリョウ"); // "Leveling Done!" LSTR MSG_SET_HOME_OFFSETS = _UxGT("キジュンオフセットセッテイ"); // "Set home offsets" LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("オフセットガテキヨウサレマシタ"); // "Offsets applied" - LSTR MSG_SET_ORIGIN = _UxGT("キジュンセット"); // "Set origin" #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = PREHEAT_1_LABEL _UxGT(" ヨネツ"); // "Preheat " PREHEAT_1_LABEL LSTR MSG_PREHEAT_1_H = PREHEAT_1_LABEL _UxGT(" ヨネツ ~"); // "Preheat " PREHEAT_1_LABEL diff --git a/Marlin/src/lcd/language/language_nl.h b/Marlin/src/lcd/language/language_nl.h index e55ed9fea78f..29a8a1fdc8d8 100644 --- a/Marlin/src/lcd/language/language_nl.h +++ b/Marlin/src/lcd/language/language_nl.h @@ -53,7 +53,6 @@ namespace Language_nl { LSTR MSG_LEVEL_BED_DONE = _UxGT("Bed level kompl."); LSTR MSG_SET_HOME_OFFSETS = _UxGT("Zet home offsets"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("H offset toegep."); - LSTR MSG_SET_ORIGIN = _UxGT("Nulpunt instellen"); #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = PREHEAT_1_LABEL _UxGT(" voorverwarmen"); LSTR MSG_PREHEAT_1_H = PREHEAT_1_LABEL _UxGT(" voorverw. ~"); diff --git a/Marlin/src/lcd/language/language_pl.h b/Marlin/src/lcd/language/language_pl.h index 47c89e9e3291..8bd7d2d30159 100644 --- a/Marlin/src/lcd/language/language_pl.h +++ b/Marlin/src/lcd/language/language_pl.h @@ -80,7 +80,6 @@ namespace Language_pl { LSTR MSG_Z_FADE_HEIGHT = _UxGT("Wys. zanikania"); LSTR MSG_SET_HOME_OFFSETS = _UxGT("Ust. poz. zer."); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Poz. zerowa ust."); - LSTR MSG_SET_ORIGIN = _UxGT("Ustaw punkt zero"); LSTR MSG_SELECT_ORIGIN = _UxGT("Wybierz punkt zero"); LSTR MSG_LAST_VALUE_SP = _UxGT("Poprzednia wartość "); #if HAS_PREHEAT diff --git a/Marlin/src/lcd/language/language_pt.h b/Marlin/src/lcd/language/language_pt.h index f73fe1f1b481..2366142f062f 100644 --- a/Marlin/src/lcd/language/language_pt.h +++ b/Marlin/src/lcd/language/language_pt.h @@ -52,7 +52,6 @@ namespace Language_pt { LSTR MSG_LEVEL_BED_DONE = _UxGT("Pronto !"); LSTR MSG_SET_HOME_OFFSETS = _UxGT("Definir desvio"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Offsets aplicados"); - LSTR MSG_SET_ORIGIN = _UxGT("Definir origem"); #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Pre-aquecer ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Pre-aquecer ") PREHEAT_1_LABEL " ~"; diff --git a/Marlin/src/lcd/language/language_pt_br.h b/Marlin/src/lcd/language/language_pt_br.h index 8d8c65f63d4e..5e3e33b37625 100644 --- a/Marlin/src/lcd/language/language_pt_br.h +++ b/Marlin/src/lcd/language/language_pt_br.h @@ -67,7 +67,6 @@ namespace Language_pt_br { LSTR MSG_Z_FADE_HEIGHT = _UxGT("Suavizar altura"); LSTR MSG_SET_HOME_OFFSETS = _UxGT("Compensar origem"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Alteração aplicada"); - LSTR MSG_SET_ORIGIN = _UxGT("Ajustar Origem"); #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Pre-aquecer ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Pre-aquecer ") PREHEAT_1_LABEL " ~"; diff --git a/Marlin/src/lcd/language/language_ro.h b/Marlin/src/lcd/language/language_ro.h index f51179829a8e..c3fc37bf483d 100644 --- a/Marlin/src/lcd/language/language_ro.h +++ b/Marlin/src/lcd/language/language_ro.h @@ -68,7 +68,6 @@ namespace Language_ro { LSTR MSG_Z_FADE_HEIGHT = _UxGT("Fade Inaltime"); LSTR MSG_SET_HOME_OFFSETS = _UxGT("Seteaza Offseturile Acasa"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Offseturi Aplicate"); - LSTR MSG_SET_ORIGIN = _UxGT("Seteaza Originea"); #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Preincalzeste ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Preincalzeste ") PREHEAT_1_LABEL " ~"; diff --git a/Marlin/src/lcd/language/language_ru.h b/Marlin/src/lcd/language/language_ru.h index d6b5bbfbdf04..4b52c926087b 100644 --- a/Marlin/src/lcd/language/language_ru.h +++ b/Marlin/src/lcd/language/language_ru.h @@ -97,7 +97,6 @@ namespace Language_ru { LSTR MSG_HOME_OFFSET_K = _UxGT("Смещ. дома ") STR_K; #endif LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Смещения применены"); - LSTR MSG_SET_ORIGIN = _UxGT("Установить ноль"); LSTR MSG_SELECT_ORIGIN = _UxGT("Выберите ноль"); #if LCD_WIDTH > 21 || HAS_DWIN_E3V2 LSTR MSG_LAST_VALUE_SP = _UxGT("Последнее знач. "); diff --git a/Marlin/src/lcd/language/language_sk.h b/Marlin/src/lcd/language/language_sk.h index 64e298cb152e..80cca911e53f 100644 --- a/Marlin/src/lcd/language/language_sk.h +++ b/Marlin/src/lcd/language/language_sk.h @@ -102,7 +102,6 @@ namespace Language_sk { LSTR MSG_HOME_OFFSET_J = STR_J _UxGT(" Ofset"); LSTR MSG_HOME_OFFSET_K = STR_K _UxGT(" Ofset"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Ofsety nastavené"); - LSTR MSG_SET_ORIGIN = _UxGT("Nastaviť začiatok"); LSTR MSG_TRAMMING_WIZARD = _UxGT("Spriev. vyrovn."); LSTR MSG_SELECT_ORIGIN = _UxGT("Vyberte začiatok"); LSTR MSG_LAST_VALUE_SP = _UxGT("Posl. hodnota "); diff --git a/Marlin/src/lcd/language/language_sv.h b/Marlin/src/lcd/language/language_sv.h index 744fb7e3e603..c077da1e6925 100644 --- a/Marlin/src/lcd/language/language_sv.h +++ b/Marlin/src/lcd/language/language_sv.h @@ -73,7 +73,6 @@ namespace Language_sv { LSTR MSG_Z_FADE_HEIGHT = _UxGT("Falna Höjd"); LSTR MSG_SET_HOME_OFFSETS = _UxGT("Sätt Hem Offset"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Offset Tillämpad"); - LSTR MSG_SET_ORIGIN = _UxGT("Sätt Origo"); LSTR MSG_TRAMMING_WIZARD = _UxGT("Justerings Wizard"); LSTR MSG_SELECT_ORIGIN = _UxGT("Välj Origo"); LSTR MSG_LAST_VALUE_SP = _UxGT("Senaste värde "); diff --git a/Marlin/src/lcd/language/language_tr.h b/Marlin/src/lcd/language/language_tr.h index 8a1864c96647..0acdd958c32d 100644 --- a/Marlin/src/lcd/language/language_tr.h +++ b/Marlin/src/lcd/language/language_tr.h @@ -72,7 +72,6 @@ namespace Language_tr { LSTR MSG_Z_FADE_HEIGHT = _UxGT("Kaçınma Yüksekliği"); LSTR MSG_SET_HOME_OFFSETS = _UxGT("Ofset Ayarla"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Ofset Tamam"); - LSTR MSG_SET_ORIGIN = _UxGT("Sıfır Belirle"); #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Ön Isınma ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Ön Isınma ") PREHEAT_1_LABEL " ~"; diff --git a/Marlin/src/lcd/language/language_uk.h b/Marlin/src/lcd/language/language_uk.h index b67c21f25f7c..892eb57cf629 100644 --- a/Marlin/src/lcd/language/language_uk.h +++ b/Marlin/src/lcd/language/language_uk.h @@ -99,7 +99,6 @@ namespace Language_uk { LSTR MSG_HOME_OFFSET_K = _UxGT("Зміщ. дому ") STR_K; #endif LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Зміщення прийняті"); - LSTR MSG_SET_ORIGIN = _UxGT("Встановити нуль"); LSTR MSG_SELECT_ORIGIN = _UxGT("Оберіть нуль"); #if LCD_WIDTH > 21 || HAS_DWIN_E3V2 LSTR MSG_LAST_VALUE_SP = _UxGT("Останнє значення "); diff --git a/Marlin/src/lcd/language/language_vi.h b/Marlin/src/lcd/language/language_vi.h index 879ccdeae7c6..da9e1fc03015 100644 --- a/Marlin/src/lcd/language/language_vi.h +++ b/Marlin/src/lcd/language/language_vi.h @@ -63,7 +63,6 @@ namespace Language_vi { LSTR MSG_Z_FADE_HEIGHT = _UxGT("Chiều cao mờ dần"); // Fade Height LSTR MSG_SET_HOME_OFFSETS = _UxGT("Đặt bù đắp nhà"); // Set home offsets LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Bù đắp được áp dụng"); // Offsets applied - LSTR MSG_SET_ORIGIN = _UxGT("Đặt nguồn gốc"); // Set origin #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Làm nóng ") PREHEAT_1_LABEL _UxGT(" trước"); // Preheat LSTR MSG_PREHEAT_1_H = _UxGT("Làm nóng ") PREHEAT_1_LABEL _UxGT(" trước ~"); // Preheat diff --git a/Marlin/src/lcd/language/language_zh_CN.h b/Marlin/src/lcd/language/language_zh_CN.h index ce5dcefaa401..e947cee661b1 100644 --- a/Marlin/src/lcd/language/language_zh_CN.h +++ b/Marlin/src/lcd/language/language_zh_CN.h @@ -68,7 +68,6 @@ namespace Language_zh_CN { LSTR MSG_Z_FADE_HEIGHT = _UxGT("淡出高度"); // "Fade Height" LSTR MSG_SET_HOME_OFFSETS = _UxGT("设置原点偏移"); // "Set home offsets" LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("偏移已启用"); // "Offsets applied" - LSTR MSG_SET_ORIGIN = _UxGT("设置原点"); // "Set origin" #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("预热 ") PREHEAT_1_LABEL; // "Preheat PREHEAT_2_LABEL" LSTR MSG_PREHEAT_1_H = _UxGT("预热 ") PREHEAT_1_LABEL " ~"; // "Preheat PREHEAT_2_LABEL" diff --git a/Marlin/src/lcd/language/language_zh_TW.h b/Marlin/src/lcd/language/language_zh_TW.h index 6c91cc1fec25..3c0acd5fa87d 100644 --- a/Marlin/src/lcd/language/language_zh_TW.h +++ b/Marlin/src/lcd/language/language_zh_TW.h @@ -65,7 +65,6 @@ namespace Language_zh_TW { LSTR MSG_Z_FADE_HEIGHT = _UxGT("淡出高度"); // "Fade Height" LSTR MSG_SET_HOME_OFFSETS = _UxGT("設置原點偏移"); // "Set home offsets" LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("偏移已啟用"); // "Offsets applied" - LSTR MSG_SET_ORIGIN = _UxGT("設置原點"); // "Set origin" #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("預熱 ") PREHEAT_1_LABEL; // "Preheat PREHEAT_1_LABEL" LSTR MSG_PREHEAT_1_H = _UxGT("預熱 ") PREHEAT_1_LABEL " ~"; // "Preheat PREHEAT_1_LABEL" From 6237a6a6d31710955467df703b8f487dd1a6675a Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Thu, 5 May 2022 00:12:10 +0000 Subject: [PATCH 016/241] [cron] Bump distribution date (2022-05-05) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 4bc69bfeb8e8..1e3253fe33eb 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-05-04" +//#define STRING_DISTRIBUTION_DATE "2022-05-05" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 823a3536d1b8..eb472fdf148e 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-05-04" + #define STRING_DISTRIBUTION_DATE "2022-05-05" #endif /** From df40181357b08761766067ef5012b2b3d0e34d3e Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Wed, 4 May 2022 17:25:02 -0700 Subject: [PATCH 017/241] =?UTF-8?q?=F0=9F=92=A5=20Num=20Axes=20and=20Multi?= =?UTF-8?q?-Stepper=20based=20on=20Driver=20Types=20(#24120)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/Configuration.h | 2 - Marlin/Configuration_adv.h | 142 ++++++++++---------- Marlin/src/core/drivers.h | 10 +- Marlin/src/feature/z_stepper_align.cpp | 22 +-- Marlin/src/feature/z_stepper_align.h | 4 +- Marlin/src/gcode/calibrate/G34.cpp | 2 +- Marlin/src/gcode/calibrate/G34_M422.cpp | 36 ++--- Marlin/src/gcode/calibrate/M666.cpp | 8 +- Marlin/src/gcode/feature/pause/M600.cpp | 2 +- Marlin/src/inc/Conditionals_LCD.h | 18 +++ Marlin/src/inc/Conditionals_adv.h | 29 ++-- Marlin/src/inc/Conditionals_post.h | 22 +-- Marlin/src/inc/SanityCheck.h | 54 ++++---- Marlin/src/lcd/e3v2/proui/dwin.cpp | 4 +- Marlin/src/libs/L64XX/L64XX_Marlin.cpp | 4 +- Marlin/src/module/endstops.cpp | 16 +-- Marlin/src/module/endstops.h | 8 +- Marlin/src/module/motion.cpp | 14 +- Marlin/src/module/settings.cpp | 16 +-- Marlin/src/module/stepper.cpp | 40 +++--- Marlin/src/module/stepper.h | 12 +- Marlin/src/pins/pins_postprocess.h | 28 ++-- Marlin/src/pins/ramps/pins_RL200.h | 4 +- Marlin/src/pins/ramps/pins_ZRIB_V53.h | 2 +- Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h | 2 +- Marlin/src/pins/sensitive_pins.h | 8 +- buildroot/tests/BIGTREE_GTR_V1_0 | 2 +- buildroot/tests/DUE | 2 +- buildroot/tests/SAMD51_grandcentral_m4 | 1 - buildroot/tests/mega1280 | 2 +- buildroot/tests/rambo | 5 +- buildroot/tests/teensy35 | 2 +- buildroot/tests/teensy41 | 2 +- 33 files changed, 266 insertions(+), 259 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 04e1115728f4..875adc21a481 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -155,8 +155,6 @@ * These settings allow Marlin to tune stepper driver timing and enable advanced options for * stepper drivers that support them. You may also override timing options in Configuration_adv.h. * - * A4988 is assumed for unspecified drivers. - * * Use TMC2208/TMC2208_STANDALONE for TMC2225 drivers and TMC2209/TMC2209_STANDALONE for TMC2226 drivers. * * Options: A4988, A5984, DRV8825, LV8729, L6470, L6474, POWERSTEP01, diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 7ec7ed40a7f9..ce69f385d258 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -713,73 +713,6 @@ //#define CLOSED_LOOP_MOVE_COMPLETE_PIN -1 #endif -/** - * Dual Steppers / Dual Endstops - * - * This section will allow you to use extra E drivers to drive a second motor for X, Y, or Z axes. - * - * For example, set X_DUAL_STEPPER_DRIVERS setting to use a second motor. If the motors need to - * spin in opposite directions set INVERT_X2_VS_X_DIR. If the second motor needs its own endstop - * set X_DUAL_ENDSTOPS. This can adjust for "racking." Use X2_USE_ENDSTOP to set the endstop plug - * that should be used for the second endstop. Extra endstops will appear in the output of 'M119'. - * - * Use X_DUAL_ENDSTOP_ADJUSTMENT to adjust for mechanical imperfection. After homing both motors - * this offset is applied to the X2 motor. To find the offset home the X axis, and measure the error - * in X2. Dual endstop offsets can be set at runtime with 'M666 X Y Z'. - */ - -//#define X_DUAL_STEPPER_DRIVERS -#if ENABLED(X_DUAL_STEPPER_DRIVERS) - //#define INVERT_X2_VS_X_DIR // Enable if X2 direction signal is opposite to X - //#define X_DUAL_ENDSTOPS - #if ENABLED(X_DUAL_ENDSTOPS) - #define X2_USE_ENDSTOP _XMAX_ - #define X2_ENDSTOP_ADJUSTMENT 0 - #endif -#endif - -//#define Y_DUAL_STEPPER_DRIVERS -#if ENABLED(Y_DUAL_STEPPER_DRIVERS) - //#define INVERT_Y2_VS_Y_DIR // Enable if Y2 direction signal is opposite to Y - //#define Y_DUAL_ENDSTOPS - #if ENABLED(Y_DUAL_ENDSTOPS) - #define Y2_USE_ENDSTOP _YMAX_ - #define Y2_ENDSTOP_ADJUSTMENT 0 - #endif -#endif - -// -// For Z set the number of stepper drivers -// -#define NUM_Z_STEPPER_DRIVERS 1 // (1-4) Z options change based on how many - -#if NUM_Z_STEPPER_DRIVERS > 1 - // Enable if Z motor direction signals are the opposite of Z1 - //#define INVERT_Z2_VS_Z_DIR - //#define INVERT_Z3_VS_Z_DIR - //#define INVERT_Z4_VS_Z_DIR - - //#define Z_MULTI_ENDSTOPS - #if ENABLED(Z_MULTI_ENDSTOPS) - #define Z2_USE_ENDSTOP _XMAX_ - #define Z2_ENDSTOP_ADJUSTMENT 0 - #if NUM_Z_STEPPER_DRIVERS >= 3 - #define Z3_USE_ENDSTOP _YMAX_ - #define Z3_ENDSTOP_ADJUSTMENT 0 - #endif - #if NUM_Z_STEPPER_DRIVERS >= 4 - #define Z4_USE_ENDSTOP _ZMAX_ - #define Z4_ENDSTOP_ADJUSTMENT 0 - #endif - #endif -#endif - -// Drive the E axis with two synchronized steppers -//#define E_DUAL_STEPPER_DRIVERS -#if ENABLED(E_DUAL_STEPPER_DRIVERS) - //#define INVERT_E1_VS_E0_DIR // Enable if the E motors need opposite DIR states -#endif - /** * Dual X Carriage * @@ -830,6 +763,77 @@ //#define EVENT_GCODE_IDEX_AFTER_MODECHANGE "G28X" #endif +/** + * Multi-Stepper / Multi-Endstop + * + * When X2_DRIVER_TYPE is defined, this indicates that the X and X2 motors work in tandem. + * The following explanations for X also apply to Y and Z multi-stepper setups. + * Endstop offsets may be changed by 'M666 X Y Z' and stored to EEPROM. + * + * - Enable INVERT_X2_VS_X_DIR if the X2 motor requires an opposite DIR signal from X. + * + * - Enable X_DUAL_ENDSTOPS if the second motor has its own endstop, with adjustable offset. + * + * - Extra endstops are included in the output of 'M119'. + * + * - Set X_DUAL_ENDSTOP_ADJUSTMENT to the known error in the X2 endstop. + * Applied to the X2 motor on 'G28' / 'G28 X'. + * Get the offset by homing X and measuring the error. + * Also set with 'M666 X' and stored to EEPROM with 'M500'. + * + * - Use X2_USE_ENDSTOP to set the endstop plug by name. (_XMIN_, _XMAX_, _YMIN_, _YMAX_, _ZMIN_, _ZMAX_) + */ +#if HAS_X2_STEPPER && DISABLED(DUAL_X_CARRIAGE) + //#define INVERT_X2_VS_X_DIR // X2 direction signal is the opposite of X + //#define X_DUAL_ENDSTOPS // X2 has its own endstop + #if ENABLED(X_DUAL_ENDSTOPS) + #define X2_USE_ENDSTOP _XMAX_ // X2 endstop board plug. Don't forget to enable USE_*_PLUG. + #define X2_ENDSTOP_ADJUSTMENT 0 // X2 offset relative to X endstop + #endif +#endif + +#if HAS_DUAL_Y_STEPPERS + //#define INVERT_Y2_VS_Y_DIR // Y2 direction signal is the opposite of Y + //#define Y_DUAL_ENDSTOPS // Y2 has its own endstop + #if ENABLED(Y_DUAL_ENDSTOPS) + #define Y2_USE_ENDSTOP _YMAX_ // Y2 endstop board plug. Don't forget to enable USE_*_PLUG. + #define Y2_ENDSTOP_ADJUSTMENT 0 // Y2 offset relative to Y endstop + #endif +#endif + +// +// Multi-Z steppers +// +#ifdef Z2_DRIVER_TYPE + //#define INVERT_Z2_VS_Z_DIR // Z2 direction signal is the opposite of Z + + //#define Z_MULTI_ENDSTOPS // Other Z axes have their own endstops + #if ENABLED(Z_MULTI_ENDSTOPS) + #define Z2_USE_ENDSTOP _XMAX_ // Z2 endstop board plug. Don't forget to enable USE_*_PLUG. + #define Z2_ENDSTOP_ADJUSTMENT 0 // Z2 offset relative to Y endstop + #endif + #ifdef Z3_DRIVER_TYPE + //#define INVERT_Z3_VS_Z_DIR // Z3 direction signal is the opposite of Z + #if ENABLED(Z_MULTI_ENDSTOPS) + #define Z3_USE_ENDSTOP _YMAX_ // Z3 endstop board plug. Don't forget to enable USE_*_PLUG. + #define Z3_ENDSTOP_ADJUSTMENT 0 // Z3 offset relative to Y endstop + #endif + #endif + #ifdef Z4_DRIVER_TYPE + //#define INVERT_Z4_VS_Z_DIR // Z4 direction signal is the opposite of Z + #if ENABLED(Z_MULTI_ENDSTOPS) + #define Z4_USE_ENDSTOP _ZMAX_ // Z4 endstop board plug. Don't forget to enable USE_*_PLUG. + #define Z4_ENDSTOP_ADJUSTMENT 0 // Z4 offset relative to Y endstop + #endif + #endif +#endif + +// Drive the E axis with two synchronized steppers +//#define E_DUAL_STEPPER_DRIVERS +#if ENABLED(E_DUAL_STEPPER_DRIVERS) + //#define INVERT_E1_VS_E0_DIR // E direction signals are opposites +#endif + // Activate a solenoid on the active extruder with M380. Disable all with M381. // Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. //#define EXT_SOLENOID @@ -963,7 +967,7 @@ /** * Z Stepper positions for more rapid convergence in bed alignment. - * Requires NUM_Z_STEPPER_DRIVERS to be 3 or 4. + * Requires 3 or 4 Z steppers. * * Define Stepper XY positions for Z1, Z2, Z3... corresponding to the screw * positions in the bed carriage, with one position per Z stepper in stepper @@ -2460,7 +2464,7 @@ /** * Extra G-code to run while executing tool-change commands. Can be used to use an additional - * stepper motor (I axis, see option NUM_AXES in Configuration.h) to drive the tool-changer. + * stepper motor (e.g., I axis in Configuration.h) to drive the tool-changer. */ //#define EVENT_GCODE_TOOLCHANGE_T0 "G28 A\nG1 A0" // Extra G-code to run while executing tool-change command T0 //#define EVENT_GCODE_TOOLCHANGE_T1 "G1 A10" // Extra G-code to run while executing tool-change command T1 diff --git a/Marlin/src/core/drivers.h b/Marlin/src/core/drivers.h index 80262d513f38..7f9da909b248 100644 --- a/Marlin/src/core/drivers.h +++ b/Marlin/src/core/drivers.h @@ -67,11 +67,11 @@ #define AXIS_DRIVER_TYPE_V(T) _AXIS_DRIVER_TYPE(V,T) #define AXIS_DRIVER_TYPE_W(T) _AXIS_DRIVER_TYPE(W,T) -#define AXIS_DRIVER_TYPE_X2(T) (EITHER(X_DUAL_STEPPER_DRIVERS, DUAL_X_CARRIAGE) && _AXIS_DRIVER_TYPE(X2,T)) -#define AXIS_DRIVER_TYPE_Y2(T) (ENABLED(Y_DUAL_STEPPER_DRIVERS) && _AXIS_DRIVER_TYPE(Y2,T)) -#define AXIS_DRIVER_TYPE_Z2(T) (NUM_Z_STEPPER_DRIVERS >= 2 && _AXIS_DRIVER_TYPE(Z2,T)) -#define AXIS_DRIVER_TYPE_Z3(T) (NUM_Z_STEPPER_DRIVERS >= 3 && _AXIS_DRIVER_TYPE(Z3,T)) -#define AXIS_DRIVER_TYPE_Z4(T) (NUM_Z_STEPPER_DRIVERS >= 4 && _AXIS_DRIVER_TYPE(Z4,T)) +#define AXIS_DRIVER_TYPE_X2(T) (HAS_X2_STEPPER && _AXIS_DRIVER_TYPE(X2,T)) +#define AXIS_DRIVER_TYPE_Y2(T) (HAS_DUAL_Y_STEPPERS && _AXIS_DRIVER_TYPE(Y2,T)) +#define AXIS_DRIVER_TYPE_Z2(T) (NUM_Z_STEPPERS >= 2 && _AXIS_DRIVER_TYPE(Z2,T)) +#define AXIS_DRIVER_TYPE_Z3(T) (NUM_Z_STEPPERS >= 3 && _AXIS_DRIVER_TYPE(Z3,T)) +#define AXIS_DRIVER_TYPE_Z4(T) (NUM_Z_STEPPERS >= 4 && _AXIS_DRIVER_TYPE(Z4,T)) #define AXIS_DRIVER_TYPE_E(N,T) (E_STEPPERS > N && _AXIS_DRIVER_TYPE(E##N,T)) #define AXIS_DRIVER_TYPE_E0(T) AXIS_DRIVER_TYPE_E(0,T) diff --git a/Marlin/src/feature/z_stepper_align.cpp b/Marlin/src/feature/z_stepper_align.cpp index fdbd464ea1b4..9dba21d8219d 100644 --- a/Marlin/src/feature/z_stepper_align.cpp +++ b/Marlin/src/feature/z_stepper_align.cpp @@ -33,35 +33,35 @@ ZStepperAlign z_stepper_align; -xy_pos_t ZStepperAlign::xy[NUM_Z_STEPPER_DRIVERS]; +xy_pos_t ZStepperAlign::xy[NUM_Z_STEPPERS]; #if HAS_Z_STEPPER_ALIGN_STEPPER_XY - xy_pos_t ZStepperAlign::stepper_xy[NUM_Z_STEPPER_DRIVERS]; + xy_pos_t ZStepperAlign::stepper_xy[NUM_Z_STEPPERS]; #endif void ZStepperAlign::reset_to_default() { #ifdef Z_STEPPER_ALIGN_XY constexpr xy_pos_t xy_init[] = Z_STEPPER_ALIGN_XY; - static_assert(COUNT(xy_init) == NUM_Z_STEPPER_DRIVERS, + static_assert(COUNT(xy_init) == NUM_Z_STEPPERS, "Z_STEPPER_ALIGN_XY requires " - #if NUM_Z_STEPPER_DRIVERS == 4 + #if NUM_Z_STEPPERS == 4 "four {X,Y} entries (Z, Z2, Z3, and Z4)." - #elif NUM_Z_STEPPER_DRIVERS == 3 + #elif NUM_Z_STEPPERS == 3 "three {X,Y} entries (Z, Z2, and Z3)." #else "two {X,Y} entries (Z and Z2)." #endif ); - #define VALIDATE_ALIGN_POINT(N) static_assert(N >= NUM_Z_STEPPER_DRIVERS || Probe::build_time::can_reach(xy_init[N]), \ + #define VALIDATE_ALIGN_POINT(N) static_assert(N >= NUM_Z_STEPPERS || Probe::build_time::can_reach(xy_init[N]), \ "Z_STEPPER_ALIGN_XY point " STRINGIFY(N) " is not reachable with the default NOZZLE_TO_PROBE offset and PROBING_MARGIN.") VALIDATE_ALIGN_POINT(0); VALIDATE_ALIGN_POINT(1); VALIDATE_ALIGN_POINT(2); VALIDATE_ALIGN_POINT(3); #else // !Z_STEPPER_ALIGN_XY const xy_pos_t xy_init[] = { - #if NUM_Z_STEPPER_DRIVERS >= 3 // First probe point... + #if NUM_Z_STEPPERS >= 3 // First probe point... #if !Z_STEPPERS_ORIENTATION { probe.min_x(), probe.min_y() }, // SW #elif Z_STEPPERS_ORIENTATION == 1 @@ -73,7 +73,7 @@ void ZStepperAlign::reset_to_default() { #else #error "Z_STEPPERS_ORIENTATION must be from 0 to 3 (first point SW, NW, NE, SE)." #endif - #if NUM_Z_STEPPER_DRIVERS == 4 // 3 more points... + #if NUM_Z_STEPPERS == 4 // 3 more points... #if !Z_STEPPERS_ORIENTATION { probe.min_x(), probe.max_y() }, { probe.max_x(), probe.max_y() }, { probe.max_x(), probe.min_y() } // SW #elif Z_STEPPERS_ORIENTATION == 1 @@ -106,11 +106,11 @@ void ZStepperAlign::reset_to_default() { #if HAS_Z_STEPPER_ALIGN_STEPPER_XY constexpr xy_pos_t stepper_xy_init[] = Z_STEPPER_ALIGN_STEPPER_XY; static_assert( - COUNT(stepper_xy_init) == NUM_Z_STEPPER_DRIVERS, + COUNT(stepper_xy_init) == NUM_Z_STEPPERS, "Z_STEPPER_ALIGN_STEPPER_XY requires " - #if NUM_Z_STEPPER_DRIVERS == 4 + #if NUM_Z_STEPPERS == 4 "four {X,Y} entries (Z, Z2, Z3, and Z4)." - #elif NUM_Z_STEPPER_DRIVERS == 3 + #elif NUM_Z_STEPPERS == 3 "three {X,Y} entries (Z, Z2, and Z3)." #endif ); diff --git a/Marlin/src/feature/z_stepper_align.h b/Marlin/src/feature/z_stepper_align.h index 8a12cd18b0bd..f3f9abb845b9 100644 --- a/Marlin/src/feature/z_stepper_align.h +++ b/Marlin/src/feature/z_stepper_align.h @@ -29,10 +29,10 @@ class ZStepperAlign { public: - static xy_pos_t xy[NUM_Z_STEPPER_DRIVERS]; + static xy_pos_t xy[NUM_Z_STEPPERS]; #if HAS_Z_STEPPER_ALIGN_STEPPER_XY - static xy_pos_t stepper_xy[NUM_Z_STEPPER_DRIVERS]; + static xy_pos_t stepper_xy[NUM_Z_STEPPERS]; #endif static void reset_to_default(); diff --git a/Marlin/src/gcode/calibrate/G34.cpp b/Marlin/src/gcode/calibrate/G34.cpp index 38fa9266b430..6fdebb69b0f0 100644 --- a/Marlin/src/gcode/calibrate/G34.cpp +++ b/Marlin/src/gcode/calibrate/G34.cpp @@ -91,7 +91,7 @@ void GcodeSuite::G34() { digipot_i2c.set_current(Z_AXIS, target_current) #elif HAS_TRINAMIC_CONFIG const uint16_t target_current = parser.intval('S', GANTRY_CALIBRATION_CURRENT); - static uint16_t previous_current_arr[NUM_Z_STEPPER_DRIVERS]; + static uint16_t previous_current_arr[NUM_Z_STEPPERS]; #if AXIS_IS_TMC(Z) previous_current_arr[0] = stepperZ.getMilliamps(); stepperZ.rms_current(target_current); diff --git a/Marlin/src/gcode/calibrate/G34_M422.cpp b/Marlin/src/gcode/calibrate/G34_M422.cpp index d1f82e7e9874..d68207885d39 100644 --- a/Marlin/src/gcode/calibrate/G34_M422.cpp +++ b/Marlin/src/gcode/calibrate/G34_M422.cpp @@ -52,9 +52,9 @@ #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) #include "../../core/debug_out.h" -#if NUM_Z_STEPPER_DRIVERS >= 3 +#if NUM_Z_STEPPERS >= 3 #define TRIPLE_Z 1 - #if NUM_Z_STEPPER_DRIVERS >= 4 + #if NUM_Z_STEPPERS >= 4 #define QUAD_Z 1 #endif #endif @@ -180,11 +180,11 @@ void GcodeSuite::G34() { // This hack is un-done at the end of G34 - either by re-homing, or by using the probed heights of the last iteration. #if !HAS_Z_STEPPER_ALIGN_STEPPER_XY - float last_z_align_move[NUM_Z_STEPPER_DRIVERS] = ARRAY_N_1(NUM_Z_STEPPER_DRIVERS, 10000.0f); + float last_z_align_move[NUM_Z_STEPPERS] = ARRAY_N_1(NUM_Z_STEPPERS, 10000.0f); #else float last_z_align_level_indicator = 10000.0f; #endif - float z_measured[NUM_Z_STEPPER_DRIVERS] = { 0 }, + float z_measured[NUM_Z_STEPPERS] = { 0 }, z_maxdiff = 0.0f, amplification = z_auto_align_amplification; @@ -217,9 +217,9 @@ void GcodeSuite::G34() { float z_measured_max = -100000.0f; // Probe all positions (one per Z-Stepper) - LOOP_L_N(i, NUM_Z_STEPPER_DRIVERS) { + LOOP_L_N(i, NUM_Z_STEPPERS) { // iteration odd/even --> downward / upward stepper sequence - const uint8_t iprobe = (iteration & 1) ? NUM_Z_STEPPER_DRIVERS - 1 - i : i; + const uint8_t iprobe = (iteration & 1) ? NUM_Z_STEPPERS - 1 - i : i; // Safe clearance even on an incline if ((iteration == 0 || i > 0) && z_probe > current_position.z) do_blocking_move_to_z(z_probe); @@ -270,20 +270,20 @@ void GcodeSuite::G34() { // This allows the actual adjustment logic to be shared by both algorithms. linear_fit_data lfd; incremental_LSF_reset(&lfd); - LOOP_L_N(i, NUM_Z_STEPPER_DRIVERS) { + LOOP_L_N(i, NUM_Z_STEPPERS) { SERIAL_ECHOLNPGM("PROBEPT_", i, ": ", z_measured[i]); incremental_LSF(&lfd, z_stepper_align.xy[i], z_measured[i]); } finish_incremental_LSF(&lfd); z_measured_min = 100000.0f; - LOOP_L_N(i, NUM_Z_STEPPER_DRIVERS) { + LOOP_L_N(i, NUM_Z_STEPPERS) { z_measured[i] = -(lfd.A * z_stepper_align.stepper_xy[i].x + lfd.B * z_stepper_align.stepper_xy[i].y + lfd.D); z_measured_min = _MIN(z_measured_min, z_measured[i]); } SERIAL_ECHOLNPGM( - LIST_N(DOUBLE(NUM_Z_STEPPER_DRIVERS), + LIST_N(DOUBLE(NUM_Z_STEPPERS), "Calculated Z1=", z_measured[0], " Z2=", z_measured[1], " Z3=", z_measured[2], @@ -307,7 +307,7 @@ void GcodeSuite::G34() { #if HAS_STATUS_MESSAGE char fstr1[10]; - char msg[6 + (6 + 5) * NUM_Z_STEPPER_DRIVERS + 1] + char msg[6 + (6 + 5) * NUM_Z_STEPPERS + 1] #if TRIPLE_Z , fstr2[10], fstr3[10] #if QUAD_Z @@ -345,12 +345,12 @@ void GcodeSuite::G34() { // Calculate mean value as a reference float z_measured_mean = 0.0f; - LOOP_L_N(zstepper, NUM_Z_STEPPER_DRIVERS) z_measured_mean += z_measured[zstepper]; - z_measured_mean /= NUM_Z_STEPPER_DRIVERS; + LOOP_L_N(zstepper, NUM_Z_STEPPERS) z_measured_mean += z_measured[zstepper]; + z_measured_mean /= NUM_Z_STEPPERS; // Calculate the sum of the absolute deviations from the mean value float z_align_level_indicator = 0.0f; - LOOP_L_N(zstepper, NUM_Z_STEPPER_DRIVERS) + LOOP_L_N(zstepper, NUM_Z_STEPPERS) z_align_level_indicator += ABS(z_measured[zstepper] - z_measured_mean); // If it's getting worse, stop and throw an error @@ -365,7 +365,7 @@ void GcodeSuite::G34() { bool success_break = true; // Correct the individual stepper offsets - LOOP_L_N(zstepper, NUM_Z_STEPPER_DRIVERS) { + LOOP_L_N(zstepper, NUM_Z_STEPPERS) { // Calculate current stepper move float z_align_move = z_measured[zstepper] - z_measured_min; const float z_align_abs = ABS(z_align_move); @@ -515,9 +515,9 @@ void GcodeSuite::M422() { #endif } - if (!WITHIN(position_index, 1, NUM_Z_STEPPER_DRIVERS)) { + if (!WITHIN(position_index, 1, NUM_Z_STEPPERS)) { SERIAL_ECHOF(err_string); - SERIAL_ECHOLNPGM(" index invalid (1.." STRINGIFY(NUM_Z_STEPPER_DRIVERS) ")."); + SERIAL_ECHOLNPGM(" index invalid (1.." STRINGIFY(NUM_Z_STEPPERS) ")."); return; } @@ -544,7 +544,7 @@ void GcodeSuite::M422() { void GcodeSuite::M422_report(const bool forReplay/*=true*/) { report_heading(forReplay, F(STR_Z_AUTO_ALIGN)); - LOOP_L_N(i, NUM_Z_STEPPER_DRIVERS) { + LOOP_L_N(i, NUM_Z_STEPPERS) { report_echo_start(forReplay); SERIAL_ECHOLNPGM_P( PSTR(" M422 S"), i + 1, @@ -553,7 +553,7 @@ void GcodeSuite::M422_report(const bool forReplay/*=true*/) { ); } #if HAS_Z_STEPPER_ALIGN_STEPPER_XY - LOOP_L_N(i, NUM_Z_STEPPER_DRIVERS) { + LOOP_L_N(i, NUM_Z_STEPPERS) { report_echo_start(forReplay); SERIAL_ECHOLNPGM_P( PSTR(" M422 W"), i + 1, diff --git a/Marlin/src/gcode/calibrate/M666.cpp b/Marlin/src/gcode/calibrate/M666.cpp index f6ebc670e115..90fad1811c8c 100644 --- a/Marlin/src/gcode/calibrate/M666.cpp +++ b/Marlin/src/gcode/calibrate/M666.cpp @@ -93,12 +93,12 @@ #if ENABLED(Z_MULTI_ENDSTOPS) if (parser.seenval('Z')) { const float z_adj = parser.value_linear_units(); - #if NUM_Z_STEPPER_DRIVERS == 2 + #if NUM_Z_STEPPERS == 2 endstops.z2_endstop_adj = z_adj; #else const int ind = parser.intval('S'); #define _SET_ZADJ(N) if (!ind || ind == N) endstops.z##N##_endstop_adj = z_adj; - REPEAT_S(2, INCREMENT(NUM_Z_STEPPER_DRIVERS), _SET_ZADJ) + REPEAT_S(2, INCREMENT(NUM_Z_STEPPERS), _SET_ZADJ) #endif } #endif @@ -114,11 +114,11 @@ SERIAL_ECHOLNPGM_P(SP_Y_STR, LINEAR_UNIT(endstops.y2_endstop_adj)); #endif #if ENABLED(Z_MULTI_ENDSTOPS) - #if NUM_Z_STEPPER_DRIVERS >= 3 + #if NUM_Z_STEPPERS >= 3 SERIAL_ECHOPGM(" S2 Z", LINEAR_UNIT(endstops.z3_endstop_adj)); report_echo_start(forReplay); SERIAL_ECHOPGM(" M666 S3 Z", LINEAR_UNIT(endstops.z3_endstop_adj)); - #if NUM_Z_STEPPER_DRIVERS >= 4 + #if NUM_Z_STEPPERS >= 4 report_echo_start(forReplay); SERIAL_ECHOPGM(" M666 S4 Z", LINEAR_UNIT(endstops.z4_endstop_adj)); #endif diff --git a/Marlin/src/gcode/feature/pause/M600.cpp b/Marlin/src/gcode/feature/pause/M600.cpp index 4fd08489d39a..c42db203b675 100644 --- a/Marlin/src/gcode/feature/pause/M600.cpp +++ b/Marlin/src/gcode/feature/pause/M600.cpp @@ -34,7 +34,7 @@ #include "../../../module/tool_change.h" #endif -#if ENABLED(HAS_PRUSA_MMU2) +#if HAS_PRUSA_MMU2 #include "../../../feature/mmu/mmu2.h" #if ENABLED(MMU2_MENUS) #include "../../../lcd/menu/menu_mmu2.h" diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 2945bec4a563..2bca6c45570c 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -707,6 +707,15 @@ #define HAS_Y_AXIS 1 #if NUM_AXES >= XYZ #define HAS_Z_AXIS 1 + #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 #if NUM_AXES >= 4 #define HAS_I_AXIS 1 #if NUM_AXES >= 5 @@ -869,6 +878,15 @@ #undef MANUAL_W_HOME_POS #endif +#ifdef X2_DRIVER_TYPE + #define HAS_X2_STEPPER 1 + // Dual X Carriage isn't known yet. TODO: Consider moving it to Configuration.h. +#endif +#ifdef Y2_DRIVER_TYPE + #define HAS_Y2_STEPPER 1 + #define HAS_DUAL_Y_STEPPERS 1 +#endif + /** * Number of Primary Linear Axes (e.g., XYZ) * X, XY, or XYZ axes. Excluding duplicate axes (X2, Y2. Z2. Z3, Z4) diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 5b70f58cdc60..5e198d757d9b 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -650,33 +650,20 @@ #endif // Multiple Z steppers -#ifndef NUM_Z_STEPPER_DRIVERS - #define NUM_Z_STEPPER_DRIVERS 1 -#endif - -// Fallback Stepper Driver types that depend on Configuration_adv.h -#if EITHER(DUAL_X_CARRIAGE, X_DUAL_STEPPER_DRIVERS) - #define HAS_X2_STEPPER 1 -#else - #undef X2_DRIVER_TYPE -#endif -#if DISABLED(Y_DUAL_STEPPER_DRIVERS) - #undef Y2_DRIVER_TYPE -#endif - -#if NUM_Z_STEPPER_DRIVERS < 4 - #undef Z4_DRIVER_TYPE +#if NUM_Z_STEPPERS < 4 #undef INVERT_Z4_VS_Z_DIR - #if NUM_Z_STEPPER_DRIVERS < 3 - #undef Z3_DRIVER_TYPE + #if NUM_Z_STEPPERS < 3 #undef INVERT_Z3_VS_Z_DIR - #if NUM_Z_STEPPER_DRIVERS < 2 - #undef Z2_DRIVER_TYPE + #if NUM_Z_STEPPERS < 2 #undef INVERT_Z2_VS_Z_DIR #endif #endif #endif +#if defined(X2_DRIVER_TYPE) && DISABLED(DUAL_X_CARRIAGE) + #define HAS_DUAL_X_STEPPERS 1 +#endif + // // Spindle/Laser power display types // Defined here so sanity checks can use them @@ -956,7 +943,7 @@ #undef HOME_Z_FIRST #undef HOMING_Z_WITH_PROBE #undef ENABLE_LEVELING_FADE_HEIGHT - #undef NUM_Z_STEPPER_DRIVERS + #undef NUM_Z_STEPPERS #undef CNC_WORKSPACE_PLANES #if NUM_AXES < 2 #undef STEALTHCHOP_Y diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index e1de8b28b06c..88d1bb0c2b89 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -1234,7 +1234,7 @@ #endif #endif - #if NUM_Z_STEPPER_DRIVERS >= 3 + #if NUM_Z_STEPPERS >= 3 #if Z_HOME_TO_MAX #ifndef Z3_MAX_ENDSTOP_INVERTING #if Z3_USE_ENDSTOP == _XMIN_ @@ -1366,7 +1366,7 @@ #endif #endif - #if NUM_Z_STEPPER_DRIVERS >= 4 + #if NUM_Z_STEPPERS >= 4 #if Z_HOME_TO_MAX #ifndef Z4_MAX_ENDSTOP_INVERTING #if Z4_USE_ENDSTOP == _XMIN_ @@ -1675,7 +1675,7 @@ #undef DISABLE_INACTIVE_Z #endif -#if NUM_Z_STEPPER_DRIVERS >= 2 +#if NUM_Z_STEPPERS >= 2 #if PIN_EXISTS(Z2_ENABLE) || AXIS_IS_L64XX(Z2) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z2)) #define HAS_Z2_ENABLE 1 #endif @@ -1690,7 +1690,7 @@ #endif #endif -#if NUM_Z_STEPPER_DRIVERS >= 3 +#if NUM_Z_STEPPERS >= 3 #if PIN_EXISTS(Z3_ENABLE) || AXIS_IS_L64XX(Z3) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z3)) #define HAS_Z3_ENABLE 1 #endif @@ -1705,7 +1705,7 @@ #endif #endif -#if NUM_Z_STEPPER_DRIVERS >= 4 +#if NUM_Z_STEPPERS >= 4 #if PIN_EXISTS(Z4_ENABLE) || AXIS_IS_L64XX(Z4) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z4)) #define HAS_Z4_ENABLE 1 #endif @@ -2080,7 +2080,7 @@ #ifndef Y_SLAVE_ADDRESS #define Y_SLAVE_ADDRESS 0 #endif - #if ENABLED(Y_DUAL_STEPPER_DRIVERS) + #if HAS_DUAL_Y_STEPPERS #if defined(Y2_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Y2) #define Y2_SENSORLESS 1 #endif @@ -2127,7 +2127,7 @@ #ifndef Z_SLAVE_ADDRESS #define Z_SLAVE_ADDRESS 0 #endif - #if NUM_Z_STEPPER_DRIVERS >= 2 + #if NUM_Z_STEPPERS >= 2 #if defined(Z2_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z2) #define Z2_SENSORLESS 1 #endif @@ -2144,7 +2144,7 @@ #define Z2_SLAVE_ADDRESS 0 #endif #endif - #if NUM_Z_STEPPER_DRIVERS >= 3 + #if NUM_Z_STEPPERS >= 3 #if defined(Z3_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z3) #define Z3_SENSORLESS 1 #endif @@ -2161,7 +2161,7 @@ #define Z3_SLAVE_ADDRESS 0 #endif #endif - #if NUM_Z_STEPPER_DRIVERS >= 4 + #if NUM_Z_STEPPERS >= 4 #if defined(Z4_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z4) #define Z4_SENSORLESS 1 #endif @@ -2542,8 +2542,8 @@ #define IS_X2_ENDSTOP(A,M) (ENABLED(X_DUAL_ENDSTOPS) && X2_USE_ENDSTOP == _##A##M##_) #define IS_Y2_ENDSTOP(A,M) (ENABLED(Y_DUAL_ENDSTOPS) && Y2_USE_ENDSTOP == _##A##M##_) #define IS_Z2_ENDSTOP(A,M) (ENABLED(Z_MULTI_ENDSTOPS) && Z2_USE_ENDSTOP == _##A##M##_) -#define IS_Z3_ENDSTOP(A,M) (ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3 && Z3_USE_ENDSTOP == _##A##M##_) -#define IS_Z4_ENDSTOP(A,M) (ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4 && Z4_USE_ENDSTOP == _##A##M##_) +#define IS_Z3_ENDSTOP(A,M) (ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPERS >= 3 && Z3_USE_ENDSTOP == _##A##M##_) +#define IS_Z4_ENDSTOP(A,M) (ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPERS >= 4 && Z4_USE_ENDSTOP == _##A##M##_) #define _HAS_STOP(A,M) (PIN_EXISTS(A##_##M) && !IS_PROBE_PIN(A,M) && !IS_X2_ENDSTOP(A,M) && !IS_Y2_ENDSTOP(A,M) && !IS_Z2_ENDSTOP(A,M) && !IS_Z3_ENDSTOP(A,M) && !IS_Z4_ENDSTOP(A,M)) #if _HAS_STOP(X,MIN) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 87e967cbe3bb..244ea0b17846 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -524,11 +524,11 @@ #elif defined(Z_QUAD_ENDSTOPS_ADJUSTMENT2) || defined(Z_QUAD_ENDSTOPS_ADJUSTMENT3) || defined(Z_QUAD_ENDSTOPS_ADJUSTMENT4) #error "Z_QUAD_ENDSTOPS_ADJUSTMENT[234] is now Z[234]_ENDSTOP_ADJUSTMENT." #elif defined(Z_DUAL_STEPPER_DRIVERS) - #error "Z_DUAL_STEPPER_DRIVERS is now NUM_Z_STEPPER_DRIVERS with a value of 2." + #error "Z_DUAL_STEPPER_DRIVERS is no longer needed and should be removed." #elif defined(Z_TRIPLE_STEPPER_DRIVERS) - #error "Z_TRIPLE_STEPPER_DRIVERS is now NUM_Z_STEPPER_DRIVERS with a value of 3." + #error "Z_TRIPLE_STEPPER_DRIVERS is no longer needed and should be removed." #elif defined(Z_QUAD_STEPPER_DRIVERS) - #error "Z_QUAD_STEPPER_DRIVERS is now NUM_Z_STEPPER_DRIVERS with a value of 4." + #error "Z_QUAD_STEPPER_DRIVERS is no longer needed and should be removed." #elif defined(Z_DUAL_ENDSTOPS) || defined(Z_TRIPLE_ENDSTOPS) || defined(Z_QUAD_ENDSTOPS) #error "Z_(DUAL|TRIPLE|QUAD)_ENDSTOPS is now Z_MULTI_ENDSTOPS." #elif defined(DUGS_UI_MOVE_DIS_OPTION) @@ -621,6 +621,12 @@ #error "DWIN_CREALITY_LCD_ENHANCED is now DWIN_LCD_PROUI." #elif defined(LINEAR_AXES) #error "LINEAR_AXES is now NUM_AXES (to account for rotational axes)." +#elif defined(X_DUAL_STEPPER_DRIVERS) + #error "X_DUAL_STEPPER_DRIVERS is no longer needed and should be removed." +#elif defined(Y_DUAL_STEPPER_DRIVERS) + #error "Y_DUAL_STEPPER_DRIVERS is no longer needed and should be removed." +#elif defined(NUM_Z_STEPPER_DRIVERS) + #error "NUM_Z_STEPPER_DRIVERS is no longer needed and should be removed." #endif constexpr float arm[] = AXIS_RELATIVE_MODES; @@ -737,27 +743,21 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L * Multiple Stepper Drivers Per Axis */ #define GOOD_AXIS_PINS(A) (HAS_##A##_ENABLE && HAS_##A##_STEP && HAS_##A##_DIR) -#if ENABLED(X_DUAL_STEPPER_DRIVERS) - #if ENABLED(DUAL_X_CARRIAGE) - #error "DUAL_X_CARRIAGE is not compatible with X_DUAL_STEPPER_DRIVERS." - #elif !GOOD_AXIS_PINS(X) - #error "X_DUAL_STEPPER_DRIVERS requires X2 pins to be defined." - #endif +#if HAS_X2_STEPPER && !GOOD_AXIS_PINS(X) + #error "If X2_DRIVER_TYPE is defined, then X2 ENABLE/STEP/DIR pins are also needed." #endif -#if ENABLED(Y_DUAL_STEPPER_DRIVERS) && !GOOD_AXIS_PINS(Y) - #error "Y_DUAL_STEPPER_DRIVERS requires Y2 pins to be defined." +#if HAS_DUAL_Y_STEPPERS && !GOOD_AXIS_PINS(Y) + #error "If Y2_DRIVER_TYPE is defined, then Y2 ENABLE/STEP/DIR pins are also needed." #endif #if HAS_Z_AXIS - #if !WITHIN(NUM_Z_STEPPER_DRIVERS, 1, 4) - #error "NUM_Z_STEPPER_DRIVERS must be an integer from 1 to 4." - #elif NUM_Z_STEPPER_DRIVERS == 2 && !GOOD_AXIS_PINS(Z2) - #error "If NUM_Z_STEPPER_DRIVERS is 2, you must define stepper pins for Z2." - #elif NUM_Z_STEPPER_DRIVERS == 3 && !(GOOD_AXIS_PINS(Z2) && GOOD_AXIS_PINS(Z3)) - #error "If NUM_Z_STEPPER_DRIVERS is 3, you must define stepper pins for Z2 and Z3." - #elif NUM_Z_STEPPER_DRIVERS == 4 && !(GOOD_AXIS_PINS(Z2) && GOOD_AXIS_PINS(Z3) && GOOD_AXIS_PINS(Z4)) - #error "If NUM_Z_STEPPER_DRIVERS is 4, you must define stepper pins for Z2, Z3, and Z4." + #if NUM_Z_STEPPERS >= 2 && !GOOD_AXIS_PINS(Z2) + #error "If Z2_DRIVER_TYPE is defined, then Z2 ENABLE/STEP/DIR pins are also needed." + #elif NUM_Z_STEPPERS >= 3 && !GOOD_AXIS_PINS(Z3) + #error "If Z3_DRIVER_TYPE is defined, then Z3 ENABLE/STEP/DIR pins are also needed." + #elif NUM_Z_STEPPERS >= 4 && !GOOD_AXIS_PINS(Z4) + #error "If Z4_DRIVER_TYPE is defined, then Z4 ENABLE/STEP/DIR pins are also needed." #endif #endif @@ -2637,10 +2637,10 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "Z_MULTI_ENDSTOPS is not compatible with DELTA." #elif !Z2_USE_ENDSTOP #error "Z2_USE_ENDSTOP must be set with Z_MULTI_ENDSTOPS." - #elif !Z3_USE_ENDSTOP && NUM_Z_STEPPER_DRIVERS >= 3 - #error "Z3_USE_ENDSTOP must be set with Z_MULTI_ENDSTOPS and NUM_Z_STEPPER_DRIVERS >= 3." - #elif !Z4_USE_ENDSTOP && NUM_Z_STEPPER_DRIVERS >= 4 - #error "Z4_USE_ENDSTOP must be set with Z_MULTI_ENDSTOPS and NUM_Z_STEPPER_DRIVERS >= 4." + #elif !Z3_USE_ENDSTOP && NUM_Z_STEPPERS >= 3 + #error "Z3_USE_ENDSTOP must be set with Z_MULTI_ENDSTOPS and Z3_DRIVER_TYPE." + #elif !Z4_USE_ENDSTOP && NUM_Z_STEPPERS >= 4 + #error "Z4_USE_ENDSTOP must be set with Z_MULTI_ENDSTOPS and Z4_DRIVER_TYPE." #endif #endif @@ -3701,14 +3701,14 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive."); #endif #if ENABLED(Z_STEPPER_AUTO_ALIGN) - #if NUM_Z_STEPPER_DRIVERS <= 1 - #error "Z_STEPPER_AUTO_ALIGN requires NUM_Z_STEPPER_DRIVERS greater than 1." + #if NUM_Z_STEPPERS <= 1 + #error "Z_STEPPER_AUTO_ALIGN requires more than one Z stepper." #elif !HAS_BED_PROBE #error "Z_STEPPER_AUTO_ALIGN requires a Z-bed probe." #elif HAS_Z_STEPPER_ALIGN_STEPPER_XY static_assert(WITHIN(Z_STEPPER_ALIGN_AMP, 0.5, 2.0), "Z_STEPPER_ALIGN_AMP must be between 0.5 and 2.0."); - #if NUM_Z_STEPPER_DRIVERS < 3 - #error "Z_STEPPER_ALIGN_STEPPER_XY requires NUM_Z_STEPPER_DRIVERS to be 3 or 4." + #if NUM_Z_STEPPERS < 3 + #error "Z_STEPPER_ALIGN_STEPPER_XY requires 3 or 4 Z steppers." #endif #endif #endif diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 9db6355e98bd..fe424e062a61 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -2090,7 +2090,7 @@ void SetPID(celsius_t t, heater_id_t h) { DWIN_UpdateLCD(); } #endif - #if ENABLED(HAS_COLOR_LEDS) + #if HAS_COLOR_LEDS void LiveLedColorR() { leds.color.r = MenuData.Value; HMI_data.Led_Color = leds.color; leds.update(); } void SetLedColorR() { SetIntOnClick(0, 255, leds.color.r, nullptr, LiveLedColorR); } void LiveLedColorG() { leds.color.g = MenuData.Value; HMI_data.Led_Color = leds.color; leds.update(); } @@ -3260,7 +3260,7 @@ void Draw_GetColor_Menu() { #if !BOTH(CASE_LIGHT_MENU, CASE_LIGHT_USE_NEOPIXEL) MENU_ITEM(ICON_LedControl, GET_TEXT_F(MSG_LEDS), onDrawLedStatus, SetLedStatus); #endif - #if (HAS_COLOR_LEDS) + #if HAS_COLOR_LEDS EDIT_ITEM(ICON_LedControl, GET_TEXT_F(MSG_COLORS_RED), onDrawPInt8Menu, SetLedColorR, &leds.color.r); EDIT_ITEM(ICON_LedControl, GET_TEXT_F(MSG_COLORS_GREEN), onDrawPInt8Menu, SetLedColorG, &leds.color.g); EDIT_ITEM(ICON_LedControl, GET_TEXT_F(MSG_COLORS_BLUE), onDrawPInt8Menu, SetLedColorB, &leds.color.b); diff --git a/Marlin/src/libs/L64XX/L64XX_Marlin.cpp b/Marlin/src/libs/L64XX/L64XX_Marlin.cpp index 8a20b8f58c8c..f7641ad72313 100644 --- a/Marlin/src/libs/L64XX/L64XX_Marlin.cpp +++ b/Marlin/src/libs/L64XX/L64XX_Marlin.cpp @@ -69,8 +69,8 @@ uint8_t L64XX_Marlin::dir_commands[MAX_L64XX]; // array to hold direction comma #define _EN_ITEM(N) , ENABLED(INVERT_E##N##_DIR) const uint8_t L64XX_Marlin::index_to_dir[MAX_L64XX] = { NUM_AXIS_LIST(ENABLED(INVERT_X_DIR), ENABLED(INVERT_Y_DIR), ENABLED(INVERT_Z_DIR), ENABLED(INVERT_I_DIR), ENABLED(INVERT_J_DIR), ENABLED(INVERT_K_DIR), ENABLED(INVERT_U_DIR), ENABLED(INVERT_V_DIR), ENABLED(INVERT_W_DIR)) - , ENABLED(INVERT_X_DIR) ^ BOTH(X_DUAL_STEPPER_DRIVERS, INVERT_X2_VS_X_DIR) // X2 - , ENABLED(INVERT_Y_DIR) ^ BOTH(Y_DUAL_STEPPER_DRIVERS, INVERT_Y2_VS_Y_DIR) // Y2 + , ENABLED(INVERT_X_DIR) ^ BOTH(HAS_DUAL_X_STEPPERS, INVERT_X2_VS_X_DIR) // X2 + , ENABLED(INVERT_Y_DIR) ^ BOTH(HAS_DUAL_Y_STEPPERS, INVERT_Y2_VS_Y_DIR) // Y2 , ENABLED(INVERT_Z_DIR) ^ ENABLED(INVERT_Z2_VS_Z_DIR) // Z2 , ENABLED(INVERT_Z_DIR) ^ ENABLED(INVERT_Z3_VS_Z_DIR) // Z3 , ENABLED(INVERT_Z_DIR) ^ ENABLED(INVERT_Z4_VS_Z_DIR) // Z4 diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index 7381e98b01b2..656018a48c98 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -78,9 +78,9 @@ Endstops::endstop_mask_t Endstops::live_state = 0; #endif #if ENABLED(Z_MULTI_ENDSTOPS) float Endstops::z2_endstop_adj; - #if NUM_Z_STEPPER_DRIVERS >= 3 + #if NUM_Z_STEPPERS >= 3 float Endstops::z3_endstop_adj; - #if NUM_Z_STEPPER_DRIVERS >= 4 + #if NUM_Z_STEPPERS >= 4 float Endstops::z4_endstop_adj; #endif #endif @@ -792,14 +792,14 @@ void Endstops::update() { #else COPY_LIVE_STATE(Z_MIN, Z2_MIN); #endif - #if NUM_Z_STEPPER_DRIVERS >= 3 + #if NUM_Z_STEPPERS >= 3 #if HAS_Z3_MIN UPDATE_ENDSTOP_BIT(Z3, MIN); #else COPY_LIVE_STATE(Z_MIN, Z3_MIN); #endif #endif - #if NUM_Z_STEPPER_DRIVERS >= 4 + #if NUM_Z_STEPPERS >= 4 #if HAS_Z4_MIN UPDATE_ENDSTOP_BIT(Z4, MIN); #else @@ -824,14 +824,14 @@ void Endstops::update() { #else COPY_LIVE_STATE(Z_MAX, Z2_MAX); #endif - #if NUM_Z_STEPPER_DRIVERS >= 3 + #if NUM_Z_STEPPERS >= 3 #if HAS_Z3_MAX UPDATE_ENDSTOP_BIT(Z3, MAX); #else COPY_LIVE_STATE(Z_MAX, Z3_MAX); #endif #endif - #if NUM_Z_STEPPER_DRIVERS >= 4 + #if NUM_Z_STEPPERS >= 4 #if HAS_Z4_MAX UPDATE_ENDSTOP_BIT(Z4, MAX); #else @@ -1090,9 +1090,9 @@ void Endstops::update() { #if DISABLED(Z_MULTI_ENDSTOPS) #define PROCESS_ENDSTOP_Z(MINMAX) PROCESS_ENDSTOP(Z, MINMAX) - #elif NUM_Z_STEPPER_DRIVERS == 4 + #elif NUM_Z_STEPPERS == 4 #define PROCESS_ENDSTOP_Z(MINMAX) PROCESS_QUAD_ENDSTOP(Z, MINMAX) - #elif NUM_Z_STEPPER_DRIVERS == 3 + #elif NUM_Z_STEPPERS == 3 #define PROCESS_ENDSTOP_Z(MINMAX) PROCESS_TRIPLE_ENDSTOP(Z, MINMAX) #else #define PROCESS_ENDSTOP_Z(MINMAX) PROCESS_DUAL_ENDSTOP(Z, MINMAX) diff --git a/Marlin/src/module/endstops.h b/Marlin/src/module/endstops.h index 1848e6cdcf2c..101a00108876 100644 --- a/Marlin/src/module/endstops.h +++ b/Marlin/src/module/endstops.h @@ -64,11 +64,11 @@ enum EndstopEnum : char { #if ENABLED(Z_MULTI_ENDSTOPS) _ES_ITEM(HAS_Z_MIN, Z2_MIN) _ES_ITEM(HAS_Z_MAX, Z2_MAX) - #if NUM_Z_STEPPER_DRIVERS >= 3 + #if NUM_Z_STEPPERS >= 3 _ES_ITEM(HAS_Z_MIN, Z3_MIN) _ES_ITEM(HAS_Z_MAX, Z3_MAX) #endif - #if NUM_Z_STEPPER_DRIVERS >= 4 + #if NUM_Z_STEPPERS >= 4 _ES_ITEM(HAS_Z_MIN, Z4_MIN) _ES_ITEM(HAS_Z_MAX, Z4_MAX) #endif @@ -120,10 +120,10 @@ class Endstops { #if ENABLED(Z_MULTI_ENDSTOPS) static float z2_endstop_adj; #endif - #if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3 + #if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPERS >= 3 static float z3_endstop_adj; #endif - #if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4 + #if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPERS >= 4 static float z4_endstop_adj; #endif diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 8bdf97c0e109..a07d8e22b436 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -2038,7 +2038,7 @@ void prepare_line_to_destination() { #if ENABLED(Z_MULTI_ENDSTOPS) if (axis == Z_AXIS) { - #if NUM_Z_STEPPER_DRIVERS == 2 + #if NUM_Z_STEPPERS == 2 const float adj = ABS(endstops.z2_endstop_adj); if (adj) { @@ -2056,13 +2056,13 @@ void prepare_line_to_destination() { adjustFunc_t lock[] = { stepper.set_z1_lock, stepper.set_z2_lock, stepper.set_z3_lock - #if NUM_Z_STEPPER_DRIVERS >= 4 + #if NUM_Z_STEPPERS >= 4 , stepper.set_z4_lock #endif }; float adj[] = { 0, endstops.z2_endstop_adj, endstops.z3_endstop_adj - #if NUM_Z_STEPPER_DRIVERS >= 4 + #if NUM_Z_STEPPERS >= 4 , endstops.z4_endstop_adj #endif }; @@ -2081,7 +2081,7 @@ void prepare_line_to_destination() { lock[1] = lock[2], adj[1] = adj[2]; lock[2] = tempLock, adj[2] = tempAdj; } - #if NUM_Z_STEPPER_DRIVERS >= 4 + #if NUM_Z_STEPPERS >= 4 if (adj[3] < adj[2]) { tempLock = lock[2], tempAdj = adj[2]; lock[2] = lock[3], adj[2] = adj[3]; @@ -2106,14 +2106,14 @@ void prepare_line_to_destination() { // lock the second stepper for the final correction (*lock[1])(true); do_homing_move(axis, adj[2] - adj[1]); - #if NUM_Z_STEPPER_DRIVERS >= 4 + #if NUM_Z_STEPPERS >= 4 // lock the third stepper for the final correction (*lock[2])(true); do_homing_move(axis, adj[3] - adj[2]); #endif } else { - #if NUM_Z_STEPPER_DRIVERS >= 4 + #if NUM_Z_STEPPERS >= 4 (*lock[3])(true); do_homing_move(axis, adj[2] - adj[3]); #endif @@ -2126,7 +2126,7 @@ void prepare_line_to_destination() { stepper.set_z1_lock(false); stepper.set_z2_lock(false); stepper.set_z3_lock(false); - #if NUM_Z_STEPPER_DRIVERS >= 4 + #if NUM_Z_STEPPERS >= 4 stepper.set_z4_lock(false); #endif diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index a9737e5ed3c3..bae5d36aaa47 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -347,9 +347,9 @@ typedef struct SettingsDataStruct { // Z_STEPPER_AUTO_ALIGN, HAS_Z_STEPPER_ALIGN_STEPPER_XY // #if ENABLED(Z_STEPPER_AUTO_ALIGN) - xy_pos_t z_stepper_align_xy[NUM_Z_STEPPER_DRIVERS]; // M422 S X Y + xy_pos_t z_stepper_align_xy[NUM_Z_STEPPERS]; // M422 S X Y #if HAS_Z_STEPPER_ALIGN_STEPPER_XY - xy_pos_t z_stepper_align_stepper_xy[NUM_Z_STEPPER_DRIVERS]; // M422 W X Y + xy_pos_t z_stepper_align_stepper_xy[NUM_Z_STEPPERS]; // M422 W X Y #endif #endif @@ -1017,13 +1017,13 @@ void MarlinSettings::postprocess() { EEPROM_WRITE(TERN(Y_DUAL_ENDSTOPS, endstops.y2_endstop_adj, dummyf)); // 1 float EEPROM_WRITE(TERN(Z_MULTI_ENDSTOPS, endstops.z2_endstop_adj, dummyf)); // 1 float - #if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3 + #if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPERS >= 3 EEPROM_WRITE(endstops.z3_endstop_adj); // 1 float #else EEPROM_WRITE(dummyf); #endif - #if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4 + #if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPERS >= 4 EEPROM_WRITE(endstops.z4_endstop_adj); // 1 float #else EEPROM_WRITE(dummyf); @@ -1969,12 +1969,12 @@ void MarlinSettings::postprocess() { EEPROM_READ(TERN(Y_DUAL_ENDSTOPS, endstops.y2_endstop_adj, dummyf)); // 1 float EEPROM_READ(TERN(Z_MULTI_ENDSTOPS, endstops.z2_endstop_adj, dummyf)); // 1 float - #if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3 + #if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPERS >= 3 EEPROM_READ(endstops.z3_endstop_adj); // 1 float #else EEPROM_READ(dummyf); #endif - #if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4 + #if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPERS >= 4 EEPROM_READ(endstops.z4_endstop_adj); // 1 float #else EEPROM_READ(dummyf); @@ -3042,13 +3042,13 @@ void MarlinSettings::reset() { #define Z2_ENDSTOP_ADJUSTMENT 0 #endif endstops.z2_endstop_adj = Z2_ENDSTOP_ADJUSTMENT; - #if NUM_Z_STEPPER_DRIVERS >= 3 + #if NUM_Z_STEPPERS >= 3 #ifndef Z3_ENDSTOP_ADJUSTMENT #define Z3_ENDSTOP_ADJUSTMENT 0 #endif endstops.z3_endstop_adj = Z3_ENDSTOP_ADJUSTMENT; #endif - #if NUM_Z_STEPPER_DRIVERS >= 4 + #if NUM_Z_STEPPERS >= 4 #ifndef Z4_ENDSTOP_ADJUSTMENT #define Z4_ENDSTOP_ADJUSTMENT 0 #endif diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 85b42f61bbbb..aadea0f1c698 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -177,9 +177,9 @@ bool Stepper::abort_current_block; #if EITHER(Z_MULTI_ENDSTOPS, Z_STEPPER_AUTO_ALIGN) bool Stepper::locked_Z_motor = false, Stepper::locked_Z2_motor = false - #if NUM_Z_STEPPER_DRIVERS >= 3 + #if NUM_Z_STEPPERS >= 3 , Stepper::locked_Z3_motor = false - #if NUM_Z_STEPPER_DRIVERS >= 4 + #if NUM_Z_STEPPERS >= 4 , Stepper::locked_Z4_motor = false #endif #endif @@ -365,7 +365,7 @@ xyze_int8_t Stepper::count_direction{0}; A##4_STEP_WRITE(V); \ } -#if ENABLED(X_DUAL_STEPPER_DRIVERS) +#if HAS_DUAL_X_STEPPERS #define X_APPLY_DIR(v,Q) do{ X_DIR_WRITE(v); X2_DIR_WRITE((v) ^ ENABLED(INVERT_X2_VS_X_DIR)); }while(0) #if ENABLED(X_DUAL_ENDSTOPS) #define X_APPLY_STEP(v,Q) DUAL_ENDSTOP_APPLY_STEP(X,v) @@ -386,7 +386,7 @@ xyze_int8_t Stepper::count_direction{0}; #define X_APPLY_STEP(v,Q) X_STEP_WRITE(v) #endif -#if ENABLED(Y_DUAL_STEPPER_DRIVERS) +#if HAS_DUAL_Y_STEPPERS #define Y_APPLY_DIR(v,Q) do{ Y_DIR_WRITE(v); Y2_DIR_WRITE((v) ^ ENABLED(INVERT_Y2_VS_Y_DIR)); }while(0) #if ENABLED(Y_DUAL_ENDSTOPS) #define Y_APPLY_STEP(v,Q) DUAL_ENDSTOP_APPLY_STEP(Y,v) @@ -398,7 +398,7 @@ xyze_int8_t Stepper::count_direction{0}; #define Y_APPLY_STEP(v,Q) Y_STEP_WRITE(v) #endif -#if NUM_Z_STEPPER_DRIVERS == 4 +#if NUM_Z_STEPPERS == 4 #define Z_APPLY_DIR(v,Q) do{ \ Z_DIR_WRITE(v); Z2_DIR_WRITE((v) ^ ENABLED(INVERT_Z2_VS_Z_DIR)); \ Z3_DIR_WRITE((v) ^ ENABLED(INVERT_Z3_VS_Z_DIR)); Z4_DIR_WRITE((v) ^ ENABLED(INVERT_Z4_VS_Z_DIR)); \ @@ -410,7 +410,7 @@ xyze_int8_t Stepper::count_direction{0}; #else #define Z_APPLY_STEP(v,Q) do{ Z_STEP_WRITE(v); Z2_STEP_WRITE(v); Z3_STEP_WRITE(v); Z4_STEP_WRITE(v); }while(0) #endif -#elif NUM_Z_STEPPER_DRIVERS == 3 +#elif NUM_Z_STEPPERS == 3 #define Z_APPLY_DIR(v,Q) do{ \ Z_DIR_WRITE(v); Z2_DIR_WRITE((v) ^ ENABLED(INVERT_Z2_VS_Z_DIR)); Z3_DIR_WRITE((v) ^ ENABLED(INVERT_Z3_VS_Z_DIR)); \ }while(0) @@ -421,7 +421,7 @@ xyze_int8_t Stepper::count_direction{0}; #else #define Z_APPLY_STEP(v,Q) do{ Z_STEP_WRITE(v); Z2_STEP_WRITE(v); Z3_STEP_WRITE(v); }while(0) #endif -#elif NUM_Z_STEPPER_DRIVERS == 2 +#elif NUM_Z_STEPPERS == 2 #define Z_APPLY_DIR(v,Q) do{ Z_DIR_WRITE(v); Z2_DIR_WRITE((v) ^ ENABLED(INVERT_Z2_VS_Z_DIR)); }while(0) #if ENABLED(Z_MULTI_ENDSTOPS) #define Z_APPLY_STEP(v,Q) DUAL_ENDSTOP_APPLY_STEP(Z,v) @@ -2613,19 +2613,19 @@ void Stepper::init() { TERN_(HAS_X2_DIR, X2_DIR_INIT()); #if HAS_Y_DIR Y_DIR_INIT(); - #if BOTH(Y_DUAL_STEPPER_DRIVERS, HAS_Y2_DIR) + #if BOTH(HAS_DUAL_Y_STEPPERS, HAS_Y2_DIR) Y2_DIR_INIT(); #endif #endif #if HAS_Z_DIR Z_DIR_INIT(); - #if NUM_Z_STEPPER_DRIVERS >= 2 && HAS_Z2_DIR + #if NUM_Z_STEPPERS >= 2 && HAS_Z2_DIR Z2_DIR_INIT(); #endif - #if NUM_Z_STEPPER_DRIVERS >= 3 && HAS_Z3_DIR + #if NUM_Z_STEPPERS >= 3 && HAS_Z3_DIR Z3_DIR_INIT(); #endif - #if NUM_Z_STEPPER_DRIVERS >= 4 && HAS_Z4_DIR + #if NUM_Z_STEPPERS >= 4 && HAS_Z4_DIR Z4_DIR_INIT(); #endif #endif @@ -2684,7 +2684,7 @@ void Stepper::init() { #if HAS_Y_ENABLE Y_ENABLE_INIT(); if (!Y_ENABLE_ON) Y_ENABLE_WRITE(HIGH); - #if BOTH(Y_DUAL_STEPPER_DRIVERS, HAS_Y2_ENABLE) + #if BOTH(HAS_DUAL_Y_STEPPERS, HAS_Y2_ENABLE) Y2_ENABLE_INIT(); if (!Y_ENABLE_ON) Y2_ENABLE_WRITE(HIGH); #endif @@ -2692,15 +2692,15 @@ void Stepper::init() { #if HAS_Z_ENABLE Z_ENABLE_INIT(); if (!Z_ENABLE_ON) Z_ENABLE_WRITE(HIGH); - #if NUM_Z_STEPPER_DRIVERS >= 2 && HAS_Z2_ENABLE + #if NUM_Z_STEPPERS >= 2 && HAS_Z2_ENABLE Z2_ENABLE_INIT(); if (!Z_ENABLE_ON) Z2_ENABLE_WRITE(HIGH); #endif - #if NUM_Z_STEPPER_DRIVERS >= 3 && HAS_Z3_ENABLE + #if NUM_Z_STEPPERS >= 3 && HAS_Z3_ENABLE Z3_ENABLE_INIT(); if (!Z_ENABLE_ON) Z3_ENABLE_WRITE(HIGH); #endif - #if NUM_Z_STEPPER_DRIVERS >= 4 && HAS_Z4_ENABLE + #if NUM_Z_STEPPERS >= 4 && HAS_Z4_ENABLE Z4_ENABLE_INIT(); if (!Z_ENABLE_ON) Z4_ENABLE_WRITE(HIGH); #endif @@ -2775,7 +2775,7 @@ void Stepper::init() { // Init Step Pins #if HAS_X_STEP - #if EITHER(X_DUAL_STEPPER_DRIVERS, DUAL_X_CARRIAGE) + #if HAS_X2_STEPPER X2_STEP_INIT(); X2_STEP_WRITE(INVERT_X_STEP_PIN); #endif @@ -2783,7 +2783,7 @@ void Stepper::init() { #endif #if HAS_Y_STEP - #if ENABLED(Y_DUAL_STEPPER_DRIVERS) + #if HAS_DUAL_Y_STEPPERS Y2_STEP_INIT(); Y2_STEP_WRITE(INVERT_Y_STEP_PIN); #endif @@ -2791,15 +2791,15 @@ void Stepper::init() { #endif #if HAS_Z_STEP - #if NUM_Z_STEPPER_DRIVERS >= 2 + #if NUM_Z_STEPPERS >= 2 Z2_STEP_INIT(); Z2_STEP_WRITE(INVERT_Z_STEP_PIN); #endif - #if NUM_Z_STEPPER_DRIVERS >= 3 + #if NUM_Z_STEPPERS >= 3 Z3_STEP_INIT(); Z3_STEP_WRITE(INVERT_Z_STEP_PIN); #endif - #if NUM_Z_STEPPER_DRIVERS >= 4 + #if NUM_Z_STEPPERS >= 4 Z4_STEP_INIT(); Z4_STEP_WRITE(INVERT_Z_STEP_PIN); #endif diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h index fbbef2bb9c8b..47a4847b822f 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -366,9 +366,9 @@ class Stepper { #endif #if EITHER(Z_MULTI_ENDSTOPS, Z_STEPPER_AUTO_ALIGN) static bool locked_Z_motor, locked_Z2_motor - #if NUM_Z_STEPPER_DRIVERS >= 3 + #if NUM_Z_STEPPERS >= 3 , locked_Z3_motor - #if NUM_Z_STEPPER_DRIVERS >= 4 + #if NUM_Z_STEPPERS >= 4 , locked_Z4_motor #endif #endif @@ -570,18 +570,18 @@ class Stepper { #if EITHER(Z_MULTI_ENDSTOPS, Z_STEPPER_AUTO_ALIGN) FORCE_INLINE static void set_z1_lock(const bool state) { locked_Z_motor = state; } FORCE_INLINE static void set_z2_lock(const bool state) { locked_Z2_motor = state; } - #if NUM_Z_STEPPER_DRIVERS >= 3 + #if NUM_Z_STEPPERS >= 3 FORCE_INLINE static void set_z3_lock(const bool state) { locked_Z3_motor = state; } - #if NUM_Z_STEPPER_DRIVERS >= 4 + #if NUM_Z_STEPPERS >= 4 FORCE_INLINE static void set_z4_lock(const bool state) { locked_Z4_motor = state; } #endif #endif static void set_all_z_lock(const bool lock, const int8_t except=-1) { set_z1_lock(lock ^ (except == 0)); set_z2_lock(lock ^ (except == 1)); - #if NUM_Z_STEPPER_DRIVERS >= 3 + #if NUM_Z_STEPPERS >= 3 set_z3_lock(lock ^ (except == 2)); - #if NUM_Z_STEPPER_DRIVERS >= 4 + #if NUM_Z_STEPPERS >= 4 set_z4_lock(lock ^ (except == 3)); #endif #endif diff --git a/Marlin/src/pins/pins_postprocess.h b/Marlin/src/pins/pins_postprocess.h index 8da2b969bc02..990f40ad4de8 100644 --- a/Marlin/src/pins/pins_postprocess.h +++ b/Marlin/src/pins/pins_postprocess.h @@ -486,10 +486,10 @@ #ifndef Z2_USE_ENDSTOP #define Z2_USE_ENDSTOP _ZSTOP_ #endif - #if NUM_Z_STEPPER_DRIVERS >= 3 && !defined(Z3_USE_ENDSTOP) + #if NUM_Z_STEPPERS >= 3 && !defined(Z3_USE_ENDSTOP) #define Z3_USE_ENDSTOP _ZSTOP_ #endif - #if NUM_Z_STEPPER_DRIVERS >= 4 && !defined(Z4_USE_ENDSTOP) + #if NUM_Z_STEPPERS >= 4 && !defined(Z4_USE_ENDSTOP) #define Z4_USE_ENDSTOP _ZSTOP_ #endif #endif @@ -775,14 +775,14 @@ #define X2_MS3_PIN -1 #endif -#if ENABLED(Y_DUAL_STEPPER_DRIVERS) && !defined(Y2_DIAG_PIN) && !defined(Y2_STEP_PIN) && !PIN_EXISTS(Y2_CS_PIN) +#if HAS_DUAL_Y_STEPPERS && !defined(Y2_DIAG_PIN) && !defined(Y2_STEP_PIN) && !PIN_EXISTS(Y2_CS_PIN) #define Z2_E_INDEX INCREMENT(Y2_E_INDEX) #else #define Z2_E_INDEX Y2_E_INDEX #endif // The Y2 axis, if any, should be the next open extruder port -#if ENABLED(Y_DUAL_STEPPER_DRIVERS) +#if HAS_DUAL_Y_STEPPERS #ifndef Y2_STEP_PIN #define Y2_STEP_PIN _EPIN(Y2_E_INDEX, STEP) #define Y2_DIR_PIN _EPIN(Y2_E_INDEX, DIR) @@ -861,14 +861,14 @@ #define Y2_MS3_PIN -1 #endif -#if NUM_Z_STEPPER_DRIVERS >= 2 && !defined(Z2_DIAG_PIN) && !defined(Z2_STEP_PIN) && !PIN_EXISTS(Z2_CS_PIN) +#if NUM_Z_STEPPERS >= 2 && !defined(Z2_DIAG_PIN) && !defined(Z2_STEP_PIN) && !PIN_EXISTS(Z2_CS_PIN) #define Z3_E_INDEX INCREMENT(Z2_E_INDEX) #else #define Z3_E_INDEX Z2_E_INDEX #endif // The Z2 axis, if any, should be the next open extruder port -#if NUM_Z_STEPPER_DRIVERS >= 2 +#if NUM_Z_STEPPERS >= 2 #ifndef Z2_STEP_PIN #define Z2_STEP_PIN _EPIN(Z2_E_INDEX, STEP) #define Z2_DIR_PIN _EPIN(Z2_E_INDEX, DIR) @@ -947,14 +947,14 @@ #define Z2_MS3_PIN -1 #endif -#if NUM_Z_STEPPER_DRIVERS >= 3 && !defined(Z3_DIAG_PIN) && !defined(Z3_STEP_PIN) && !PIN_EXISTS(Z3_CS_PIN) +#if NUM_Z_STEPPERS >= 3 && !defined(Z3_DIAG_PIN) && !defined(Z3_STEP_PIN) && !PIN_EXISTS(Z3_CS_PIN) #define Z4_E_INDEX INCREMENT(Z3_E_INDEX) #else #define Z4_E_INDEX Z3_E_INDEX #endif // The Z3 axis, if any, should be the next open extruder port -#if NUM_Z_STEPPER_DRIVERS >= 3 +#if NUM_Z_STEPPERS >= 3 #ifndef Z3_STEP_PIN #define Z3_STEP_PIN _EPIN(Z3_E_INDEX, STEP) #define Z3_DIR_PIN _EPIN(Z3_E_INDEX, DIR) @@ -1033,14 +1033,14 @@ #define Z3_MS3_PIN -1 #endif -#if NUM_Z_STEPPER_DRIVERS >= 4 && !defined(Z4_DIAG_PIN) && !defined(Z4_STEP_PIN) && !PIN_EXISTS(Z4_CS_PIN) +#if NUM_Z_STEPPERS >= 4 && !defined(Z4_DIAG_PIN) && !defined(Z4_STEP_PIN) && !PIN_EXISTS(Z4_CS_PIN) #define I_E_INDEX INCREMENT(Z4_E_INDEX) #else #define I_E_INDEX Z4_E_INDEX #endif // The Z4 axis, if any, should be the next open extruder port -#if NUM_Z_STEPPER_DRIVERS >= 4 +#if NUM_Z_STEPPERS >= 4 #ifndef Z4_STEP_PIN #define Z4_STEP_PIN _EPIN(Z4_E_INDEX, STEP) #define Z4_DIR_PIN _EPIN(Z4_E_INDEX, DIR) @@ -1747,16 +1747,16 @@ #if DISABLED(Z_MULTI_ENDSTOPS) || Z_HOME_TO_MIN #undef Z2_MAX_PIN #endif -#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPER_DRIVERS < 3 || Z_HOME_TO_MAX +#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPERS < 3 || Z_HOME_TO_MAX #undef Z3_MIN_PIN #endif -#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPER_DRIVERS < 3 || Z_HOME_TO_MIN +#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPERS < 3 || Z_HOME_TO_MIN #undef Z3_MAX_PIN #endif -#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPER_DRIVERS < 4 || Z_HOME_TO_MAX +#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPERS < 4 || Z_HOME_TO_MAX #undef Z4_MIN_PIN #endif -#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPER_DRIVERS < 4 || Z_HOME_TO_MIN +#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPERS < 4 || Z_HOME_TO_MIN #undef Z4_MAX_PIN #endif diff --git a/Marlin/src/pins/ramps/pins_RL200.h b/Marlin/src/pins/ramps/pins_RL200.h index 047ad160bed1..52d0173c00a8 100644 --- a/Marlin/src/pins/ramps/pins_RL200.h +++ b/Marlin/src/pins/ramps/pins_RL200.h @@ -31,8 +31,8 @@ #if HOTENDS > 2 || E_STEPPERS > 2 #error "RL200v1 supports up to 2 hotends / E-steppers. Comment out this line to continue." -#elif NUM_Z_STEPPER_DRIVERS != 2 - #error "RL200 uses dual Z stepper motors. Set NUM_Z_STEPPER_DRIVERS to 2 or comment out this line to continue." +#elif NUM_Z_STEPPERS != 2 + #error "RL200 uses dual Z stepper motors. Set NUM_Z_STEPPERS to 2 or comment out this line to continue." #elif !(AXIS_DRIVER_TYPE_X(DRV8825) && AXIS_DRIVER_TYPE_Y(DRV8825) && AXIS_DRIVER_TYPE_Z(DRV8825) && AXIS_DRIVER_TYPE_Z2(DRV8825) && AXIS_DRIVER_TYPE_E0(DRV8825)) #error "You must set ([XYZ]|Z2|E0)_DRIVER_TYPE to DRV8825 in Configuration.h for RL200." #endif diff --git a/Marlin/src/pins/ramps/pins_ZRIB_V53.h b/Marlin/src/pins/ramps/pins_ZRIB_V53.h index 6cbc0351ba98..3a2604586ef0 100644 --- a/Marlin/src/pins/ramps/pins_ZRIB_V53.h +++ b/Marlin/src/pins/ramps/pins_ZRIB_V53.h @@ -118,7 +118,7 @@ #define Z_DIR_PIN 48 #define Z_ENABLE_PIN 62 -#if NUM_Z_STEPPER_DRIVERS == 2 +#if NUM_Z_STEPPERS == 2 #define Z2_STEP_PIN 26 // E0 connector #define Z2_DIR_PIN 28 #define Z2_ENABLE_PIN 24 diff --git a/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h b/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h index 5450b3766b71..711cb16b464f 100644 --- a/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h +++ b/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h @@ -110,7 +110,7 @@ // This board have the option to use an extra TMC2209 stepper, one of the use could be as a second extruder. #if EXTRUDERS < 2 // TODO: Corregir aquí que cuando tenemos dos extrusores o lo que sea, utiliza los endstop que le sobran, osea los max, no hay Z2_endstop - #if NUM_Z_STEPPER_DRIVERS > 1 + #if NUM_Z_STEPPERS > 1 #define Z2_STOP_PIN 14 #endif #else diff --git a/Marlin/src/pins/sensitive_pins.h b/Marlin/src/pins/sensitive_pins.h index db6cb2353b3f..061e27faf4f7 100644 --- a/Marlin/src/pins/sensitive_pins.h +++ b/Marlin/src/pins/sensitive_pins.h @@ -778,7 +778,7 @@ #define _X2_PINS #endif -#if ENABLED(Y_DUAL_STEPPER_DRIVERS) +#if HAS_DUAL_Y_STEPPERS #if PIN_EXISTS(Y2_CS) && AXIS_HAS_SPI(Y2) #define _Y2_CS Y2_CS_PIN, #else @@ -804,7 +804,7 @@ #define _Y2_PINS #endif -#if NUM_Z_STEPPER_DRIVERS >= 2 +#if NUM_Z_STEPPERS >= 2 #if PIN_EXISTS(Z2_CS) && AXIS_HAS_SPI(Z2) #define _Z2_CS Z2_CS_PIN, #else @@ -830,7 +830,7 @@ #define _Z2_PINS #endif -#if NUM_Z_STEPPER_DRIVERS >= 3 +#if NUM_Z_STEPPERS >= 3 #if PIN_EXISTS(Z3_CS) && AXIS_HAS_SPI(Z3) #define _Z3_CS Z3_CS_PIN, #else @@ -856,7 +856,7 @@ #define _Z3_PINS #endif -#if NUM_Z_STEPPER_DRIVERS >= 4 +#if NUM_Z_STEPPERS >= 4 #if PIN_EXISTS(Z4_CS) && AXIS_HAS_SPI(Z4) #define _Z4_CS Z4_CS_PIN, #else diff --git a/buildroot/tests/BIGTREE_GTR_V1_0 b/buildroot/tests/BIGTREE_GTR_V1_0 index 93342ed4a472..c9e15e9c2e67 100755 --- a/buildroot/tests/BIGTREE_GTR_V1_0 +++ b/buildroot/tests/BIGTREE_GTR_V1_0 @@ -22,7 +22,7 @@ exec_test $1 $2 "BigTreeTech GTR | 8 Extruders | Auto-Fan | Mixed TMC Drivers | restore_configs opt_set MOTHERBOARD BOARD_BTT_GTR_V1_0 SERIAL_PORT -1 \ EXTRUDERS 5 TEMP_SENSOR_1 1 TEMP_SENSOR_2 1 TEMP_SENSOR_3 1 TEMP_SENSOR_4 1 \ - NUM_Z_STEPPER_DRIVERS 4 \ + Z_DRIVER_TYPE A4988 Z2_DRIVER_TYPE A4988 Z3_DRIVER_TYPE A4988 Z4_DRIVER_TYPE A4988 \ DEFAULT_Kp_LIST '{ 22.2, 20.0, 21.0, 19.0, 18.0 }' DEFAULT_Ki_LIST '{ 1.08 }' DEFAULT_Kd_LIST '{ 114.0, 112.0, 110.0, 108.0 }' opt_enable TOOLCHANGE_FILAMENT_SWAP TOOLCHANGE_MIGRATION_FEATURE TOOLCHANGE_FS_SLOW_FIRST_PRIME TOOLCHANGE_FS_PRIME_FIRST_USED \ PID_PARAMS_PER_HOTEND Z_MULTI_ENDSTOPS diff --git a/buildroot/tests/DUE b/buildroot/tests/DUE index 9b968cbd8d4d..a2f3fda7a7ac 100755 --- a/buildroot/tests/DUE +++ b/buildroot/tests/DUE @@ -35,7 +35,7 @@ exec_test $1 $2 "RAMPS4DUE_EFB with ABL (Bilinear), ExtUI, S-Curve, many options # RADDS with BLTouch, ABL(B), 3 x Z auto-align # restore_configs -opt_set MOTHERBOARD BOARD_RADDS NUM_Z_STEPPER_DRIVERS 3 +opt_set MOTHERBOARD BOARD_RADDS Z_DRIVER_TYPE A4988 Z2_DRIVER_TYPE A4988 Z3_DRIVER_TYPE A4988 opt_enable USE_XMAX_PLUG USE_YMAX_PLUG ENDSTOPPULLUPS BLTOUCH AUTO_BED_LEVELING_BILINEAR \ Z_STEPPER_AUTO_ALIGN Z_STEPPER_ALIGN_STEPPER_XY Z_SAFE_HOMING pins_set ramps/RAMPS X_MAX_PIN -1 diff --git a/buildroot/tests/SAMD51_grandcentral_m4 b/buildroot/tests/SAMD51_grandcentral_m4 index 92a62c9d37a4..e6e27d8cb8c9 100755 --- a/buildroot/tests/SAMD51_grandcentral_m4 +++ b/buildroot/tests/SAMD51_grandcentral_m4 @@ -16,7 +16,6 @@ opt_set MOTHERBOARD BOARD_AGCM4_RAMPS_144 SERIAL_PORT -1 \ RESTORE_LEVELING_AFTER_G28 false \ LCD_LANGUAGE it \ SDCARD_CONNECTION LCD \ - NUM_Z_STEPPER_DRIVERS 2 \ HOMING_BUMP_MM '{ 0, 0, 0 }' opt_enable ENDSTOP_INTERRUPTS_FEATURE S_CURVE_ACCELERATION BLTOUCH Z_MIN_PROBE_REPEATABILITY_TEST \ FILAMENT_RUNOUT_SENSOR G26_MESH_VALIDATION MESH_EDIT_GFX_OVERLAY Z_SAFE_HOMING \ diff --git a/buildroot/tests/mega1280 b/buildroot/tests/mega1280 index a7f25953acd0..5bf37289ba61 100755 --- a/buildroot/tests/mega1280 +++ b/buildroot/tests/mega1280 @@ -39,7 +39,7 @@ exec_test $1 $2 "(No PWM)" "$3" restore_configs opt_set MOTHERBOARD BOARD_ZRIB_V52 \ LCD_LANGUAGE pt REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 \ - EXTRUDERS 2 TEMP_SENSOR_1 1 + EXTRUDERS 2 TEMP_SENSOR_1 1 X2_DRIVER_TYPE A4988 opt_enable USE_XMAX_PLUG DUAL_X_CARRIAGE REPRAPWORLD_KEYPAD exec_test $1 $2 "ZRIB_V52 | DUAL_X_CARRIAGE" "$3" diff --git a/buildroot/tests/rambo b/buildroot/tests/rambo index e696dce96ec3..f8fef704f1c2 100755 --- a/buildroot/tests/rambo +++ b/buildroot/tests/rambo @@ -51,10 +51,11 @@ opt_set MOTHERBOARD BOARD_RAMBO \ DEFAULT_MAX_ACCELERATION '{ 3000, 3000, 100 }' \ MANUAL_FEEDRATE '{ 50*60, 50*60, 4*60 }' \ AXIS_RELATIVE_MODES '{ false, false, false }' \ - LEVEL_CORNERS_LEVELING_ORDER '{ LF, RF }' + LEVEL_CORNERS_LEVELING_ORDER '{ LF, RF }' \ + X2_DRIVER_TYPE A4988 Y2_DRIVER_TYPE A4988 opt_enable USE_XMAX_PLUG USE_YMAX_PLUG USE_ZMAX_PLUG \ REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER REVERSE_ENCODER_DIRECTION SDSUPPORT EEPROM_SETTINGS \ - S_CURVE_ACCELERATION X_DUAL_STEPPER_DRIVERS X_DUAL_ENDSTOPS Y_DUAL_STEPPER_DRIVERS Y_DUAL_ENDSTOPS \ + S_CURVE_ACCELERATION X_DUAL_ENDSTOPS Y_DUAL_ENDSTOPS \ ADAPTIVE_STEP_SMOOTHING CNC_COORDINATE_SYSTEMS GCODE_MOTION_MODES \ LEVEL_BED_CORNERS LEVEL_CENTER_TOO opt_disable MIN_SOFTWARE_ENDSTOP_Z MAX_SOFTWARE_ENDSTOPS diff --git a/buildroot/tests/teensy35 b/buildroot/tests/teensy35 index 09e8cee58ef3..64ce4e65505a 100755 --- a/buildroot/tests/teensy35 +++ b/buildroot/tests/teensy35 @@ -101,7 +101,7 @@ exec_test $1 $2 "Teensy 3.5/3.6 COREXZ | BACKLASH" "$3" # Enable Dual Z with Dual Z endstops # restore_configs -opt_set MOTHERBOARD BOARD_TEENSY35_36 NUM_Z_STEPPER_DRIVERS 2 Z2_MIN_PIN 2 +opt_set MOTHERBOARD BOARD_TEENSY35_36 Z_DRIVER_TYPE A4988 Z2_DRIVER_TYPE A4988 Z2_MIN_PIN 2 opt_enable Z_MULTI_ENDSTOPS USE_XMAX_PLUG pins_set ramps/RAMPS X_MAX_PIN -1 exec_test $1 $2 "Dual Z with Dual Z endstops" "$3" diff --git a/buildroot/tests/teensy41 b/buildroot/tests/teensy41 index 1affd7c89e12..56bd5043c736 100755 --- a/buildroot/tests/teensy41 +++ b/buildroot/tests/teensy41 @@ -105,7 +105,7 @@ exec_test $1 $2 "Teensy 4.0/4.1 COREXZ" "$3" # Enable Dual Z with Dual Z endstops # restore_configs -opt_set MOTHERBOARD BOARD_TEENSY41 NUM_Z_STEPPER_DRIVERS 2 Z2_MIN_PIN 2 +opt_set MOTHERBOARD BOARD_TEENSY41 Z_DRIVER_TYPE A4988 Z2_DRIVER_TYPE A4988 Z2_MIN_PIN 2 opt_enable Z_MULTI_ENDSTOPS USE_XMAX_PLUG pins_set ramps/RAMPS X_MAX_PIN -1 exec_test $1 $2 "Dual Z with Dual Z endstops" "$3" From 81a6834876cf30b73e38683ec12603a11f45a4c1 Mon Sep 17 00:00:00 2001 From: Stephen Hawes Date: Thu, 5 May 2022 03:37:47 -0400 Subject: [PATCH 018/241] =?UTF-8?q?=E2=9C=A8=20Add=20M3426=20A=20par?= =?UTF-8?q?ameter=20(#24130)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/feature/adc/adc_mcp3426.cpp | 6 +++--- Marlin/src/feature/adc/adc_mcp3426.h | 5 +---- Marlin/src/gcode/feature/adc/M3426.cpp | 15 ++++++++++----- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Marlin/src/feature/adc/adc_mcp3426.cpp b/Marlin/src/feature/adc/adc_mcp3426.cpp index aaddf46821b0..49bb67ef6d5c 100644 --- a/Marlin/src/feature/adc/adc_mcp3426.cpp +++ b/Marlin/src/feature/adc/adc_mcp3426.cpp @@ -34,7 +34,7 @@ #include "adc_mcp3426.h" // Read the ADC value from MCP342X on a specific channel -int16_t MCP3426::ReadValue(uint8_t channel, uint8_t gain) { +int16_t MCP3426::ReadValue(uint8_t channel, uint8_t gain, uint8_t address) { Error = false; #if PINS_EXIST(I2C_SCL, I2C_SDA) && DISABLED(SOFT_I2C_EEPROM) @@ -44,7 +44,7 @@ int16_t MCP3426::ReadValue(uint8_t channel, uint8_t gain) { Wire.begin(); // No address joins the BUS as the master - Wire.beginTransmission(I2C_ADDRESS(MCP342X_ADC_I2C_ADDRESS)); + Wire.beginTransmission(I2C_ADDRESS(address)); // Continuous Conversion Mode, 16 bit, Channel 1, Gain x4 // 26 = 0b00011000 @@ -75,7 +75,7 @@ int16_t MCP3426::ReadValue(uint8_t channel, uint8_t gain) { uint8_t buffer[len] = {}; do { - Wire.requestFrom(I2C_ADDRESS(MCP342X_ADC_I2C_ADDRESS), len); + Wire.requestFrom(I2C_ADDRESS(address), len); if (Wire.available() != len) { Error = true; return 0; diff --git a/Marlin/src/feature/adc/adc_mcp3426.h b/Marlin/src/feature/adc/adc_mcp3426.h index 35458716b975..af48593369e1 100644 --- a/Marlin/src/feature/adc/adc_mcp3426.h +++ b/Marlin/src/feature/adc/adc_mcp3426.h @@ -29,12 +29,9 @@ #include #include -// Address of MCP342X chip -#define MCP342X_ADC_I2C_ADDRESS 104 - class MCP3426 { public: - int16_t ReadValue(uint8_t channel, uint8_t gain); + int16_t ReadValue(uint8_t channel, uint8_t gain, uint8_t address); bool Error; }; diff --git a/Marlin/src/gcode/feature/adc/M3426.cpp b/Marlin/src/gcode/feature/adc/M3426.cpp index 8205fa01f2bd..2820c8b88093 100644 --- a/Marlin/src/gcode/feature/adc/M3426.cpp +++ b/Marlin/src/gcode/feature/adc/M3426.cpp @@ -28,6 +28,8 @@ #include "../../../feature/adc/adc_mcp3426.h" +#define MCP3426_BASE_ADDR (0b1101 << 3) + /** * M3426: Read 16 bit (signed) value from I2C MCP3426 ADC device * @@ -36,12 +38,15 @@ * M3426 I 0 or 1, invert reply */ void GcodeSuite::M3426() { - uint8_t channel = parser.byteval('C', 1), // Select the channel 1 or 2 - gain = parser.byteval('G', 1); - const bool inverted = parser.byteval('I') == 1; + uint8_t channel = parser.byteval('C', 1), // Channel 1 or 2 + gain = parser.byteval('G', 1), // Gain 1, 2, 4, or 8 + address = parser.byteval('A', 3); // Address 0-7 (or 104-111) + const bool inverted = parser.boolval('I'); + + if (address <= 7) address += MCP3426_BASE_ADDR; - if (channel <= 2 && (gain == 1 || gain == 2 || gain == 4 || gain == 8)) { - int16_t result = mcp3426.ReadValue(channel, gain); + if (WITHIN(channel, 1, 2) && (gain == 1 || gain == 2 || gain == 4 || gain == 8) && WITHIN(address, MCP3426_BASE_ADDR, MCP3426_BASE_ADDR + 7)) { + int16_t result = mcp3426.ReadValue(channel, gain, address); if (mcp3426.Error == false) { if (inverted) { From 3cea0a00b102096318f44d3ba8ede29d7f14ab8b Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Thu, 5 May 2022 00:38:48 -0700 Subject: [PATCH 019/241] =?UTF-8?q?=F0=9F=90=9B=20Some=20EEPROM=20size=20f?= =?UTF-8?q?ixes=20(#24113)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h | 4 ++-- Marlin/src/pins/sam/pins_RURAMPS4D_11.h | 2 +- Marlin/src/pins/sam/pins_RURAMPS4D_13.h | 2 +- Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h | 2 +- Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h | 2 +- Marlin/src/pins/stm32f1/pins_CREALITY_V4.h | 4 ++-- Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h | 4 ++-- Marlin/src/pins/stm32f1/pins_CREALITY_V45x.h | 4 ++-- Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h | 2 +- Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h | 2 +- Marlin/src/pins/stm32f4/pins_LERDGE_S.h | 4 ++-- Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h | 2 +- 12 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h index df6ae8c01721..25c7ba69b6db 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h @@ -46,9 +46,9 @@ #endif #if ENABLED(I2C_EEPROM) - #define MARLIN_EEPROM_SIZE 0x8000 // 32Kb + #define MARLIN_EEPROM_SIZE 0x8000 // 32K #elif ENABLED(SDCARD_EEPROM_EMULATION) - #define MARLIN_EEPROM_SIZE 0x800 // 2Kb + #define MARLIN_EEPROM_SIZE 0x800 // 2K #endif // diff --git a/Marlin/src/pins/sam/pins_RURAMPS4D_11.h b/Marlin/src/pins/sam/pins_RURAMPS4D_11.h index 4bdadd80828e..643c68ae4fad 100644 --- a/Marlin/src/pins/sam/pins_RURAMPS4D_11.h +++ b/Marlin/src/pins/sam/pins_RURAMPS4D_11.h @@ -179,7 +179,7 @@ // // EEPROM // -#define MARLIN_EEPROM_SIZE 0x8000 // 32Kb (24lc256) +#define MARLIN_EEPROM_SIZE 0x8000 // 32K (24lc256) #define I2C_EEPROM // EEPROM on I2C-0 //#define EEPROM_SD // EEPROM on SDCARD //#define SPI_EEPROM // EEPROM on SPI-0 diff --git a/Marlin/src/pins/sam/pins_RURAMPS4D_13.h b/Marlin/src/pins/sam/pins_RURAMPS4D_13.h index 5273cbcd0e93..ee741dcbf540 100644 --- a/Marlin/src/pins/sam/pins_RURAMPS4D_13.h +++ b/Marlin/src/pins/sam/pins_RURAMPS4D_13.h @@ -162,7 +162,7 @@ // // EEPROM // -#define MARLIN_EEPROM_SIZE 0x8000 // 32Kb (24lc256) +#define MARLIN_EEPROM_SIZE 0x8000 // 32K (24lc256) #define I2C_EEPROM // EEPROM on I2C-0 //#define EEPROM_SD // EEPROM on SDCARD //#define SPI_EEPROM // EEPROM on SPI-0 diff --git a/Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h b/Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h index 1315d994c8b8..382c607d239b 100644 --- a/Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h +++ b/Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h @@ -44,7 +44,7 @@ */ //#define FLASH_EEPROM_EMULATION #define I2C_EEPROM // EEPROM on I2C-0 -#define MARLIN_EEPROM_SIZE 0x70000 // 512K (CAT24C512) +#define MARLIN_EEPROM_SIZE 0x10000 // 64K (CAT24C512) // This is another option to emulate an EEPROM, but it's more efficient to not lose the data in the first place. //#define SDCARD_EEPROM_EMULATION diff --git a/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h b/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h index 711cb16b464f..0f4bb1d0b591 100644 --- a/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h +++ b/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h @@ -48,7 +48,7 @@ */ //#define FLASH_EEPROM_EMULATION #define I2C_EEPROM // EEPROM on I2C-0 -#define MARLIN_EEPROM_SIZE 0x70000 // 512K (CAT24C512) +#define MARLIN_EEPROM_SIZE 0x10000 // 64K (CAT24C512) //This its another option to emulate an EEPROM, but its more efficient to dont loose the data the first One. //#define SDCARD_EEPROM_EMULATION diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h index d6d496624121..b2534beab6db 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h @@ -51,9 +51,9 @@ #if ENABLED(IIC_BL24CXX_EEPROM) #define IIC_EEPROM_SDA PA11 #define IIC_EEPROM_SCL PA12 - #define MARLIN_EEPROM_SIZE 0x800 // 2Kb (24C16) + #define MARLIN_EEPROM_SIZE 0x800 // 2K (24C16) #elif ENABLED(SDCARD_EEPROM_EMULATION) - #define MARLIN_EEPROM_SIZE 0x800 // 2Kb + #define MARLIN_EEPROM_SIZE 0x800 // 2K #endif // diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h index 7bf34441bcf4..87101ecccd54 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h @@ -52,10 +52,10 @@ #if ENABLED(IIC_BL24CXX_EEPROM) #define IIC_EEPROM_SDA PA11 #define IIC_EEPROM_SCL PA12 - #define MARLIN_EEPROM_SIZE 0x800 // 2Kb (24C16) + #define MARLIN_EEPROM_SIZE 0x800 // 2K (24C16) #else #define SDCARD_EEPROM_EMULATION // SD EEPROM until all EEPROM is BL24CXX - #define MARLIN_EEPROM_SIZE 0x800 // 2Kb + #define MARLIN_EEPROM_SIZE 0x800 // 2K #endif // SPI diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V45x.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V45x.h index 85d279872d55..a9ff02d1f4e2 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V45x.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V45x.h @@ -47,9 +47,9 @@ #if ENABLED(IIC_BL24CXX_EEPROM) #define IIC_EEPROM_SDA PA11 #define IIC_EEPROM_SCL PA12 - #define MARLIN_EEPROM_SIZE 0x800 // 2Kb (24C16) + #define MARLIN_EEPROM_SIZE 0x800 // 2K (24C16) #elif ENABLED(SDCARD_EEPROM_EMULATION) - #define MARLIN_EEPROM_SIZE 0x800 // 2Kb + #define MARLIN_EEPROM_SIZE 0x800 // 2K #endif // diff --git a/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h b/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h index 25736b1a4905..68d92e1c30d7 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h @@ -37,7 +37,7 @@ // Onboard I2C EEPROM #define I2C_EEPROM -#define MARLIN_EEPROM_SIZE 0x2000 // 8K (24C64 ... 64Kb = 8K) +#define MARLIN_EEPROM_SIZE 0x2000 // 8K (24C64) // // Servos diff --git a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h index c53e9344aaa6..4255881baf86 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h @@ -28,7 +28,7 @@ // Onboard I2C EEPROM #define I2C_EEPROM -#define MARLIN_EEPROM_SIZE 0x8000 // 32K (24C32A) +#define MARLIN_EEPROM_SIZE 0x1000 // 4KB (AT24C32) #define I2C_SCL_PIN PB8 #define I2C_SDA_PIN PB9 diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h index 4def11abec8e..0e8b6e09a865 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h @@ -187,12 +187,12 @@ #define EEPROM_MISO_PIN PB14 // datasheet: DO pin, found with multimeter, not tested #define EEPROM_MOSI_PIN PB15 // datasheet: DI pin, found with multimeter, not tested #define EEPROM_PAGE_SIZE 0x1000U // 4K (from datasheet) - #define MARLIN_EEPROM_SIZE 16UL * (EEPROM_PAGE_SIZE) // Limit to 64K for now... + #define MARLIN_EEPROM_SIZE 16UL * (EEPROM_PAGE_SIZE) // Limit to 64K for now... #elif ENABLED(I2C_EEPROM) // FM24CL64BG (CYP1813) 64Kbit F-RAM #define SOFT_I2C_EEPROM // Force the use of Software I2C #define I2C_SDA_PIN PG13 #define I2C_SCL_PIN PG14 // To be confirmed on the Lerdge S, but probably same as the K - #define MARLIN_EEPROM_SIZE 0x10000 + #define MARLIN_EEPROM_SIZE 0x2000U // 8K #else #define MARLIN_EEPROM_SIZE 0x800U // On SD, Limit to 2K, require this amount of RAM #endif diff --git a/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h b/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h index 0b6edc9d3c6e..f48c007d8cec 100644 --- a/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h +++ b/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h @@ -30,7 +30,7 @@ // Onboard I2C EEPROM #define I2C_EEPROM -#define MARLIN_EEPROM_SIZE 0x1000 // 4K (24C32 ... 32Kb = 4K) +#define MARLIN_EEPROM_SIZE 0x1000 // 4K (24C32) #define HAS_OTG_USB_HOST_SUPPORT // USB Flash Drive support From 9d6b4a2e97a214beeca7fb9e1d6cbd87ff3948e1 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 5 May 2022 11:47:08 -0500 Subject: [PATCH 020/241] =?UTF-8?q?=F0=9F=94=A7=20Move=20LASER=5FCOOLANT?= =?UTF-8?q?=5FFLOW=5FMETER=20to=20LASER=5FFEATURE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index ce69f385d258..4218a2cd8cdd 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -249,20 +249,6 @@ #endif #endif -// -// Laser Coolant Flow Meter -// -//#define LASER_COOLANT_FLOW_METER -#if ENABLED(LASER_COOLANT_FLOW_METER) - #define FLOWMETER_PIN 20 // Requires an external interrupt-enabled pin (e.g., RAMPS 2,3,18,19,20,21) - #define FLOWMETER_PPL 5880 // (pulses/liter) Flow meter pulses-per-liter on the input pin - #define FLOWMETER_INTERVAL 1000 // (ms) Flow rate calculation interval in milliseconds - #define FLOWMETER_SAFETY // Prevent running the laser without the minimum flow rate set below - #if ENABLED(FLOWMETER_SAFETY) - #define FLOWMETER_MIN_LITERS_PER_MINUTE 1.5 // (liters/min) Minimum flow required when enabled - #endif -#endif - /** * Thermal Protection provides additional protection to your printer from damage * and fire. Marlin always includes safe min and max temperature ranges which @@ -3766,6 +3752,20 @@ #define I2C_AMMETER_SHUNT_RESISTOR 0.1 // (Ohms) Calibration shunt resistor value #endif + // + // Laser Coolant Flow Meter + // + //#define LASER_COOLANT_FLOW_METER + #if ENABLED(LASER_COOLANT_FLOW_METER) + #define FLOWMETER_PIN 20 // Requires an external interrupt-enabled pin (e.g., RAMPS 2,3,18,19,20,21) + #define FLOWMETER_PPL 5880 // (pulses/liter) Flow meter pulses-per-liter on the input pin + #define FLOWMETER_INTERVAL 1000 // (ms) Flow rate calculation interval in milliseconds + #define FLOWMETER_SAFETY // Prevent running the laser without the minimum flow rate set below + #if ENABLED(FLOWMETER_SAFETY) + #define FLOWMETER_MIN_LITERS_PER_MINUTE 1.5 // (liters/min) Minimum flow required when enabled + #endif + #endif + #endif #endif // SPINDLE_FEATURE || LASER_FEATURE From 6e902727830e217b32f349c8c974220d2df9d7d9 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 5 May 2022 14:57:29 -0500 Subject: [PATCH 021/241] =?UTF-8?q?=F0=9F=A9=B9=20Bring=20G425=20report=20?= =?UTF-8?q?up=20to=20date?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #23112 --- Marlin/src/gcode/calibrate/G425.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Marlin/src/gcode/calibrate/G425.cpp b/Marlin/src/gcode/calibrate/G425.cpp index 450a71511748..a22608f5b42b 100644 --- a/Marlin/src/gcode/calibrate/G425.cpp +++ b/Marlin/src/gcode/calibrate/G425.cpp @@ -438,26 +438,26 @@ inline void probe_sides(measurements_t &m, const float uncertainty) { #endif #if HAS_U_AXIS #if ENABLED(CALIBRATION_MEASURE_UMIN) - SERIAL_ECHOLNPAIR(" " STR_U_MIN ": ", m.obj_side[UMINIMUM]); + SERIAL_ECHOLNPGM(" " STR_U_MIN ": ", m.obj_side[UMINIMUM]); #endif #if ENABLED(CALIBRATION_MEASURE_UMAX) - SERIAL_ECHOLNPAIR(" " STR_U_MAX ": ", m.obj_side[UMAXIMUM]); + SERIAL_ECHOLNPGM(" " STR_U_MAX ": ", m.obj_side[UMAXIMUM]); #endif #endif #if HAS_V_AXIS #if ENABLED(CALIBRATION_MEASURE_VMIN) - SERIAL_ECHOLNPAIR(" " STR_V_MIN ": ", m.obj_side[VMINIMUM]); + SERIAL_ECHOLNPGM(" " STR_V_MIN ": ", m.obj_side[VMINIMUM]); #endif #if ENABLED(CALIBRATION_MEASURE_VMAX) - SERIAL_ECHOLNPAIR(" " STR_V_MAX ": ", m.obj_side[VMAXIMUM]); + SERIAL_ECHOLNPGM(" " STR_V_MAX ": ", m.obj_side[VMAXIMUM]); #endif #endif #if HAS_W_AXIS #if ENABLED(CALIBRATION_MEASURE_WMIN) - SERIAL_ECHOLNPAIR(" " STR_W_MIN ": ", m.obj_side[WMINIMUM]); + SERIAL_ECHOLNPGM(" " STR_W_MIN ": ", m.obj_side[WMINIMUM]); #endif #if ENABLED(CALIBRATION_MEASURE_WMAX) - SERIAL_ECHOLNPAIR(" " STR_W_MAX ": ", m.obj_side[WMAXIMUM]); + SERIAL_ECHOLNPGM(" " STR_W_MAX ": ", m.obj_side[WMAXIMUM]); #endif #endif SERIAL_EOL(); From a5b57a09fdc29959299eae6d19fa1859891974e3 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 6 May 2022 00:01:36 +0000 Subject: [PATCH 022/241] [cron] Bump distribution date (2022-05-06) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 1e3253fe33eb..0e52d63fc003 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-05-05" +//#define STRING_DISTRIBUTION_DATE "2022-05-06" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index eb472fdf148e..908bb2aaa6f1 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-05-05" + #define STRING_DISTRIBUTION_DATE "2022-05-06" #endif /** From 659b4172aa49d82e54a08b5ed674b3ba4ad51fb0 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 5 May 2022 18:55:43 -0500 Subject: [PATCH 023/241] =?UTF-8?q?=F0=9F=94=A8=20Prevent=20build=20attrib?= =?UTF-8?q?ute=20define=20conflicts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/macros.h | 10 +++++----- Marlin/src/feature/bedlevel/ubl/ubl.h | 18 +++++++++--------- Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp | 2 +- Marlin/src/libs/bresenham.h | 6 +++--- Marlin/src/libs/nozzle.h | 12 ++++++------ Marlin/src/module/endstops.cpp | 2 +- Marlin/src/module/temperature.h | 2 +- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Marlin/src/core/macros.h b/Marlin/src/core/macros.h index 629486d85f43..c24b4a1a9c91 100644 --- a/Marlin/src/core/macros.h +++ b/Marlin/src/core/macros.h @@ -82,11 +82,11 @@ #define FORCE_INLINE __attribute__((always_inline)) inline #define NO_INLINE __attribute__((noinline)) #define _UNUSED __attribute__((unused)) -#define _O0 __attribute__((optimize("O0"))) -#define _Os __attribute__((optimize("Os"))) -#define _O1 __attribute__((optimize("O1"))) -#define _O2 __attribute__((optimize("O2"))) -#define _O3 __attribute__((optimize("O3"))) +#define __O0 __attribute__((optimize("O0"))) +#define __Os __attribute__((optimize("Os"))) +#define __O1 __attribute__((optimize("O1"))) +#define __O2 __attribute__((optimize("O2"))) +#define __O3 __attribute__((optimize("O3"))) #define IS_CONSTEXPR(...) __builtin_constant_p(__VA_ARGS__) // Only valid solution with C++14. Should use std::is_constant_evaluated() in C++20 instead diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.h b/Marlin/src/feature/bedlevel/ubl/ubl.h index f117c1af65d3..8dad966acb84 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.h +++ b/Marlin/src/feature/bedlevel/ubl/ubl.h @@ -70,13 +70,13 @@ class unified_bed_leveling { static void move_z_with_encoder(const_float_t multiplier); static float measure_point_with_encoder(); static float measure_business_card_thickness(); - static void manually_probe_remaining_mesh(const xy_pos_t&, const_float_t , const_float_t , const bool) _O0; - static void fine_tune_mesh(const xy_pos_t &pos, const bool do_ubl_mesh_map) _O0; + static void manually_probe_remaining_mesh(const xy_pos_t&, const_float_t , const_float_t , const bool) __O0; + static void fine_tune_mesh(const xy_pos_t &pos, const bool do_ubl_mesh_map) __O0; #endif - static bool G29_parse_parameters() _O0; + static bool G29_parse_parameters() __O0; static void shift_mesh_height(); - static void probe_entire_mesh(const xy_pos_t &near, const bool do_ubl_mesh_map, const bool stow_probe, const bool do_furthest) _O0; + static void probe_entire_mesh(const xy_pos_t &near, const bool do_ubl_mesh_map, const bool stow_probe, const bool do_furthest) __O0; static void tilt_mesh_based_on_3pts(const_float_t z1, const_float_t z2, const_float_t z3); static void tilt_mesh_based_on_probed_grid(const bool do_ubl_mesh_map); static bool smart_fill_one(const uint8_t x, const uint8_t y, const int8_t xdir, const int8_t ydir); @@ -98,17 +98,17 @@ class unified_bed_leveling { static void report_state(); static void save_ubl_active_state_and_disable(); static void restore_ubl_active_state_and_leave(); - static void display_map(const uint8_t) _O0; - static mesh_index_pair find_closest_mesh_point_of_type(const MeshPointType, const xy_pos_t&, const bool=false, MeshFlags *done_flags=nullptr) _O0; - static mesh_index_pair find_furthest_invalid_mesh_point() _O0; + static void display_map(const uint8_t) __O0; + static mesh_index_pair find_closest_mesh_point_of_type(const MeshPointType, const xy_pos_t&, const bool=false, MeshFlags *done_flags=nullptr) __O0; + static mesh_index_pair find_furthest_invalid_mesh_point() __O0; static void reset(); static void invalidate(); static void set_all_mesh_points_to_value(const_float_t value); static void adjust_mesh_to_mean(const bool cflag, const_float_t value); static bool sanity_check(); - static void G29() _O0; // O0 for no optimization - static void smart_fill_wlsf(const_float_t ) _O2; // O2 gives smaller code than Os on A2560 + static void G29() __O0; // O0 for no optimization + static void smart_fill_wlsf(const_float_t ) __O2; // O2 gives smaller code than Os on A2560 static int8_t storage_slot; diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp index f7e98c9fa77d..3da4ed9809f9 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp @@ -340,7 +340,7 @@ * Returns true if did NOT move, false if moved (requires current_position update). */ - bool _O2 unified_bed_leveling::line_to_destination_segmented(const_feedRate_t scaled_fr_mm_s) { + bool __O2 unified_bed_leveling::line_to_destination_segmented(const_feedRate_t scaled_fr_mm_s) { if (!position_is_reachable(destination)) // fail if moving outside reachable boundary return true; // did not move, so current_position still accurate diff --git a/Marlin/src/libs/bresenham.h b/Marlin/src/libs/bresenham.h index 865c43c29e0b..39ab60700769 100644 --- a/Marlin/src/libs/bresenham.h +++ b/Marlin/src/libs/bresenham.h @@ -30,7 +30,7 @@ */ #define FORCE_INLINE __attribute__((always_inline)) inline -#define _O3 __attribute__((optimize("O3"))) +#define __O3 __attribute__((optimize("O3"))) template struct BresenhamCfg { static constexpr uint8_t UID = uid, SIZE = size; }; @@ -114,9 +114,9 @@ class Bresenham { if (tick1(index)) { value[index] += dir[index]; back(index); } } - FORCE_INLINE static void tick1() _O3 { for (uint8_t i = 0; i < Cfg::SIZE; i++) (void)tick1(i); } + FORCE_INLINE static void tick1() __O3 { for (uint8_t i = 0; i < Cfg::SIZE; i++) (void)tick1(i); } - FORCE_INLINE static void tick() _O3 { for (uint8_t i = 0; i < Cfg::SIZE; i++) (void)tick(i); } + FORCE_INLINE static void tick() __O3 { for (uint8_t i = 0; i < Cfg::SIZE; i++) (void)tick(i); } static void report(const uint8_t index) { if (index < Cfg::SIZE) { diff --git a/Marlin/src/libs/nozzle.h b/Marlin/src/libs/nozzle.h index 7bbd0e35c11b..69790f5a6786 100644 --- a/Marlin/src/libs/nozzle.h +++ b/Marlin/src/libs/nozzle.h @@ -41,7 +41,7 @@ class Nozzle { * @param end xyz_pos_t defining the ending point * @param strokes number of strokes to execute */ - static void stroke(const xyz_pos_t &start, const xyz_pos_t &end, const uint8_t &strokes) _Os; + static void stroke(const xyz_pos_t &start, const xyz_pos_t &end, const uint8_t &strokes) __Os; /** * @brief Zig-zag clean pattern @@ -52,7 +52,7 @@ class Nozzle { * @param strokes number of strokes to execute * @param objects number of objects to create */ - static void zigzag(const xyz_pos_t &start, const xyz_pos_t &end, const uint8_t &strokes, const uint8_t &objects) _Os; + static void zigzag(const xyz_pos_t &start, const xyz_pos_t &end, const uint8_t &strokes, const uint8_t &objects) __Os; /** * @brief Circular clean pattern @@ -62,7 +62,7 @@ class Nozzle { * @param strokes number of strokes to execute * @param radius radius of circle */ - static void circle(const xyz_pos_t &start, const xyz_pos_t &middle, const uint8_t &strokes, const_float_t radius) _Os; + static void circle(const xyz_pos_t &start, const xyz_pos_t &middle, const uint8_t &strokes, const_float_t radius) __Os; #endif // NOZZLE_CLEAN_FEATURE @@ -77,14 +77,14 @@ class Nozzle { * @param pattern one of the available patterns * @param argument depends on the cleaning pattern */ - static void clean(const uint8_t &pattern, const uint8_t &strokes, const_float_t radius, const uint8_t &objects, const uint8_t cleans) _Os; + static void clean(const uint8_t &pattern, const uint8_t &strokes, const_float_t radius, const uint8_t &objects, const uint8_t cleans) __Os; #endif // NOZZLE_CLEAN_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - static float park_mode_0_height(const_float_t park_z) _Os; - static void park(const uint8_t z_action, const xyz_pos_t &park=NOZZLE_PARK_POINT) _Os; + static float park_mode_0_height(const_float_t park_z) __Os; + static void park(const uint8_t z_action, const xyz_pos_t &park=NOZZLE_PARK_POINT) __Os; #endif }; diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index 656018a48c98..3f7b47a98b95 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -560,7 +560,7 @@ static void print_es_state(const bool is_hit, FSTR_P const flabel=nullptr) { #pragma GCC diagnostic pop -void _O2 Endstops::report_states() { +void __O2 Endstops::report_states() { TERN_(BLTOUCH, bltouch._set_SW_mode()); SERIAL_ECHOLNPGM(STR_M119_REPORT); #define ES_REPORT(S) print_es_state(READ(S##_PIN) != S##_ENDSTOP_INVERTING, F(STR_##S)) diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index f54cd0334bf2..2cc238217462 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -716,7 +716,7 @@ class Temperature { /** * Call periodically to manage heaters */ - static void manage_heater() _O2; // Added _O2 to work around a compiler error + static void manage_heater() __O2; // __O2 added to work around a compiler error /** * Preheating hotends From 505ab1bb62033d08e94ae15b515beefec343177a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 5 May 2022 19:11:59 -0500 Subject: [PATCH 024/241] =?UTF-8?q?=F0=9F=94=A8=20Use=20first=20g++=20in?= =?UTF-8?q?=20path=20for=20'native'=20targets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../share/PlatformIO/scripts/preprocessor.py | 16 ++++++++++------ ini/native.ini | 9 ++++++--- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/buildroot/share/PlatformIO/scripts/preprocessor.py b/buildroot/share/PlatformIO/scripts/preprocessor.py index 6f4ed900cab1..3d324bac4b38 100644 --- a/buildroot/share/PlatformIO/scripts/preprocessor.py +++ b/buildroot/share/PlatformIO/scripts/preprocessor.py @@ -3,6 +3,7 @@ # import subprocess,os,re +nocache = 1 verbose = 0 def blab(str): @@ -50,7 +51,7 @@ def run_preprocessor(env, fn=None): # def search_compiler(env): - ENV_BUILD_PATH = os.path.join(env.Dictionary('PROJECT_BUILD_DIR'), env['PIOENV']) + ENV_BUILD_PATH = os.path.join(env['PROJECT_BUILD_DIR'], env['PIOENV']) GCC_PATH_CACHE = os.path.join(ENV_BUILD_PATH, ".gcc_path") try: @@ -60,14 +61,17 @@ def search_compiler(env): except: pass - if os.path.exists(GCC_PATH_CACHE): + # Warning: The cached .gcc_path will obscure a newly-installed toolkit + if not nocache and os.path.exists(GCC_PATH_CACHE): blab("Getting g++ path from cache") with open(GCC_PATH_CACHE, 'r') as f: return f.read() - # Find the current platform compiler by searching the $PATH - # which will be in a platformio toolchain bin folder - path_regex = re.escape(env['PROJECT_PACKAGES_DIR']) + # Find a platform compiler by searching $PATH items + # A native target will search all PATH bin folders. + # Others look only within $HOME/.platformio. + path_regex = "" if env.GetProjectOption('platform') == 'native' else re.escape(env['PROJECT_PACKAGES_DIR']) + gcc = "g++" if env['PLATFORM'] == 'win32': path_separator = ';' @@ -87,7 +91,7 @@ def search_compiler(env): # Use entire path to not rely on env PATH filepath = os.path.sep.join([pathdir, filepath]) # Cache the g++ path to no search always - if os.path.exists(ENV_BUILD_PATH): + if not nocache and os.path.exists(ENV_BUILD_PATH): blab("Caching g++ for current env") with open(GCC_PATH_CACHE, 'w+') as f: f.write(filepath) diff --git a/ini/native.ini b/ini/native.ini index 3d196f343649..02737a074638 100644 --- a/ini/native.ini +++ b/ini/native.ini @@ -63,12 +63,12 @@ build_flags = ${simulator_linux.build_flags} ${simulator_linux.release_flags} # # Simulator for macOS (MacPorts) # -# sudo port install gcc10 gdb glm libsdl2 libsdl2_net freetype +# sudo port install gcc11 gdb glm libsdl2 libsdl2_net freetype # sudo port install ld64 @3_3 +ld64_xcode # # cd /opt/local/bin # sudo rm -f gcc g++ cc -# sudo ln -s gcc-mp-10 gcc ; sudo ln -s g++-mp-10 g++ ; sudo ln -s g++ cc +# sudo ln -s gcc-mp-11 gcc ; sudo ln -s g++-mp-11 g++ ; sudo ln -s g++ cc # This step may be obsolete: # sudo port uninstall ld64 ld64-latest # @@ -79,7 +79,6 @@ build_flags = ${simulator_linux.build_flags} ${simulator_linux.release_flags} # [simulator_macos] build_unflags = -lGL -custom_verbose = 0 build_flags = -I/opt/local/include -I/opt/local/include/freetype2 @@ -93,11 +92,15 @@ build_flags = extends = env:simulator_linux_debug build_flags = ${env:simulator_linux_debug.build_flags} ${simulator_macos.build_flags} -ggdb -Og -D_THREAD_SAFE build_unflags = ${simulator_macos.build_unflags} +custom_verbose = 0 +custom_gcc = g++ [env:simulator_macos_release] extends = env:simulator_linux_release build_flags = ${env:simulator_linux_release.build_flags} ${simulator_macos.build_flags} build_unflags = ${simulator_macos.build_unflags} +custom_verbose = 0 +custom_gcc = g++ # # Simulator for Windows 10 From 2a88cc0fcdec3f728784526e9e0c531a3e743286 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 7 May 2022 00:01:30 +0000 Subject: [PATCH 025/241] [cron] Bump distribution date (2022-05-07) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 0e52d63fc003..a0f1e4260fee 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-05-06" +//#define STRING_DISTRIBUTION_DATE "2022-05-07" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 908bb2aaa6f1..87578bc84e5a 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-05-06" + #define STRING_DISTRIBUTION_DATE "2022-05-07" #endif /** From 5f4ec825448cd5c9a7a03d3292b3d4a74377bba2 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sun, 8 May 2022 14:56:09 +1200 Subject: [PATCH 026/241] =?UTF-8?q?=E2=9C=8F=EF=B8=8FFix=20Markforged=20en?= =?UTF-8?q?dstops/G38=20(#24141)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/endstops.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index 3f7b47a98b95..bebe09c99c4c 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -703,7 +703,7 @@ void Endstops::update() { #define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT_TO(live_state, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX))) #define COPY_LIVE_STATE(SRC_BIT, DST_BIT) SET_BIT_TO(live_state, DST_BIT, TEST(live_state, SRC_BIT)) - #if ENABLED(G38_PROBE_TARGET) && NONE(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY, MARKFORGED_XY) + #if ENABLED(G38_PROBE_TARGET) && NONE(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY, MARKFORGED_YX) #define HAS_G38_PROBE 1 // For G38 moves check the probe's pin for ALL movement if (G38_move) UPDATE_ENDSTOP_BIT(Z, TERN(USES_Z_MIN_PROBE_PIN, MIN_PROBE, MIN)); @@ -714,7 +714,7 @@ void Endstops::update() { #define X_MAX_TEST() TERN1(DUAL_X_CARRIAGE, TERN0(X_HOME_TO_MAX, stepper.last_moved_extruder == 0) || TERN0(X2_HOME_TO_MAX, stepper.last_moved_extruder != 0)) // Use HEAD for core axes, AXIS for others - #if ANY(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY, MARKFORGED_XY) + #if ANY(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY, MARKFORGED_YX) #define X_AXIS_HEAD X_HEAD #else #define X_AXIS_HEAD X_AXIS From e43f4207a006e93d0def10ffa0d4793334dc70b7 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sun, 8 May 2022 14:57:13 +1200 Subject: [PATCH 027/241] =?UTF-8?q?=F0=9F=93=8C=20Use=20ESP3DLib=20master?= =?UTF-8?q?=20branch=20(#24140)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ini/features.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ini/features.ini b/ini/features.ini index 1ee8f3d8955d..e33c6fecf77f 100644 --- a/ini/features.ini +++ b/ini/features.ini @@ -236,7 +236,7 @@ HAS_SERVOS = src_filter=+ + HAS_MICROSTEPS = src_filter=+ (ESP3D_)?WIFISUPPORT = AsyncTCP, ESP Async WebServer - ESP3DLib=https://github.com/luc-github/ESP3DLib/archive/master-2.0.7.zip + ESP3DLib=https://github.com/luc-github/ESP3DLib/archive/master.zip arduinoWebSockets=links2004/WebSockets@2.3.4 luc-github/ESP32SSDP@^1.1.1 lib_ignore=ESPAsyncTCP From 1a9e8c047b6ce512a6462ac0681028cafe3242fa Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Sat, 7 May 2022 19:58:57 -0700 Subject: [PATCH 028/241] =?UTF-8?q?=F0=9F=94=A7=20Fix=20Neo=20RGB=20sanity?= =?UTF-8?q?=20check=20(#24146)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/SanityCheck.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 244ea0b17846..2a85a589b991 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2448,6 +2448,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #if EITHER(FYSETC_242_OLED_12864, FYSETC_MINI_12864_2_1) #ifndef NEO_RGB #define NEO_RGB 123 + #define FAUX_RGB 1 #endif #if defined(NEOPIXEL_TYPE) && NEOPIXEL_TYPE != NEO_RGB #error "Your FYSETC/MKS/BTT Mini Panel requires NEOPIXEL_TYPE to be NEO_RGB." @@ -2456,6 +2457,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #endif #if FAUX_RGB #undef NEO_RGB + #undef FAUX_RGB #endif #elif EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) && DISABLED(RGB_LED) #error "Your FYSETC Mini Panel requires RGB_LED." From 9e43ec9dcdcda708f3c24428e8089f9c0809199f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 7 May 2022 14:58:39 -0500 Subject: [PATCH 029/241] =?UTF-8?q?=F0=9F=94=A8=20Improved=20mfprep=20scri?= =?UTF-8?q?pt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/share/git/mfprep | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/buildroot/share/git/mfprep b/buildroot/share/git/mfprep index b329d7d8c5d9..7245126de156 100755 --- a/buildroot/share/git/mfprep +++ b/buildroot/share/git/mfprep @@ -2,11 +2,16 @@ # # mfprep tag1 [tag2] # -# Find commits in bugfix-2.0.x not yet in 2.0.x +# Find commits in bugfix-2.0.x that are not yet in 2.0.x. +# +# Specify a version tag to start from, and optional version tag to end at. +# For bugfix-2.0.x the tag will be prefixed by bf- to distinguish it from the version tag, +# so at every release be sure to create a bf- tag and publish it to origin. # SED=$(which gsed sed | head -n1) SELF=`basename "$0"` +DRYRUN=0 [[ $# < 1 || $# > 2 ]] && { echo "Usage $SELF tag1 [tag2]" ; exit 1 ; } @@ -38,13 +43,22 @@ git log --pretty="[%h] %s" $TAG1..$TAG2 | $SED '1!G;h;$!d' >"$LOG2" || { echo "C cat "$LOG2" | while read line; do #echo "... $line" - if [[ $line =~ (\(#[0-9]{5}\))$ ]]; then - PATT=${BASH_REMATCH[1]} + if [[ $line =~ \(((#[0-9]{5}),* *)((#[0-9]{5}),* *)?((#[0-9]{5}),* *)?\)$ ]]; then + PATT="" + for i in ${!BASH_REMATCH[@]}; do + if ((i > 0 && (i % 2 == 0))); then + if [[ -n "${BASH_REMATCH[i]}" ]]; then + [[ -n "$PATT" ]] && PATT="$PATT|" + PATT="$PATT${BASH_REMATCH[i]}" + fi + fi + done #echo "... $PATT" + [[ -n $PATT ]] && { grep -vE "$PATT" "$LOGB" >"$TMPF" ; cp "$TMPF" "$LOGB" ; } else PATT=$( $SED -E 's/^\[[0-9a-f]{10}\]( . )?(.+)$/\2/' <<<"$line" ) + [[ -n $PATT ]] && { grep -v "$PATT" "$LOGB" >"$TMPF" ; cp "$TMPF" "$LOGB" ; } fi - [[ -n $PATT ]] && { grep -v "$PATT" "$LOGB" >"$TMPF" ; cp "$TMPF" "$LOGB" ; } done # Convert remaining commits into git commands @@ -62,4 +76,4 @@ done mv "$TMPF" "$SCRF" chmod ug+x "$SCRF" -open "$TMPDIR" +((DRYRUN)) && rm -r "$TMPDIR" || open "$TMPDIR" From 198ef1e474276afb0a712cf2ec7dc7bf06b0898d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 7 May 2022 22:02:18 -0500 Subject: [PATCH 030/241] =?UTF-8?q?=F0=9F=8E=A8=20Misc.=20code=20cleanup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/NATIVE_SIM/u8g/LCD_pin_routines.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_pin_routines.cpp b/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_pin_routines.cpp index 3b5acc1656cd..91b7e0f67f76 100644 --- a/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_pin_routines.cpp +++ b/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_pin_routines.cpp @@ -38,13 +38,13 @@ #ifdef __cplusplus extern "C" { #endif -void u8g_SetPinOutput(uint8_t internal_pin_number){SET_DIR_OUTPUT(internal_pin_number);} -void u8g_SetPinInput(uint8_t internal_pin_number){SET_DIR_INPUT(internal_pin_number);} -void u8g_SetPinLevel(uint8_t pin, uint8_t pin_status){WRITE_PIN(pin, pin_status);} -uint8_t u8g_GetPinLevel(uint8_t pin){return READ_PIN(pin);} -void usleep(uint64_t microsec){ -assert(false); // why we here? -} + +void u8g_SetPinOutput(uint8_t internal_pin_number) { SET_DIR_OUTPUT(internal_pin_number); } +void u8g_SetPinInput(uint8_t internal_pin_number) { SET_DIR_INPUT(internal_pin_number); } +void u8g_SetPinLevel(uint8_t pin, uint8_t pin_status) { WRITE_PIN(pin, pin_status); } +uint8_t u8g_GetPinLevel(uint8_t pin) { return READ_PIN(pin); } +void usleep(uint64_t microsec) { assert(false); /* why we here? */ } + #ifdef __cplusplus } #endif From 4a17589496d1499c52ebcb24bdc9063e2485a653 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sun, 8 May 2022 06:01:02 +0000 Subject: [PATCH 031/241] [cron] Bump distribution date (2022-05-08) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index a0f1e4260fee..e9a4e6663d8c 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-05-07" +//#define STRING_DISTRIBUTION_DATE "2022-05-08" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 87578bc84e5a..0abe920d093f 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-05-07" + #define STRING_DISTRIBUTION_DATE "2022-05-08" #endif /** From 726a38712e17f1f31436d033d0597237c086d309 Mon Sep 17 00:00:00 2001 From: Mike La Spina Date: Mon, 9 May 2022 17:18:47 -0500 Subject: [PATCH 032/241] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20Fan=20Tail=20Speed?= =?UTF-8?q?=20Init=20(#24076)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/module/planner.cpp | 30 +++++++++++++++--------------- Marlin/src/module/planner.h | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 6dc2c9e084dd..a22a99340f93 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1306,7 +1306,7 @@ void Planner::check_axes_activity() { #if HAS_FAN && DISABLED(LASER_SYNCHRONOUS_M106_M107) #define HAS_TAIL_FAN_SPEED 1 - static uint8_t tail_fan_speed[FAN_COUNT] = ARRAY_N_1(FAN_COUNT, 128); + static uint8_t tail_fan_speed[FAN_COUNT] = ARRAY_N_1(FAN_COUNT, 13); bool fans_need_update = false; #endif @@ -1342,18 +1342,18 @@ void Planner::check_axes_activity() { #if ANY(DISABLE_X, DISABLE_Y, DISABLE_Z, DISABLE_I, DISABLE_J, DISABLE_K, DISABLE_E) for (uint8_t b = block_buffer_tail; b != block_buffer_head; b = next_block_index(b)) { - block_t *block = &block_buffer[b]; + block_t * const bnext = &block_buffer[b]; LOGICAL_AXIS_CODE( - if (TERN0(DISABLE_E, block->steps.e)) axis_active.e = true, - if (TERN0(DISABLE_X, block->steps.x)) axis_active.x = true, - if (TERN0(DISABLE_Y, block->steps.y)) axis_active.y = true, - if (TERN0(DISABLE_Z, block->steps.z)) axis_active.z = true, - if (TERN0(DISABLE_I, block->steps.i)) axis_active.i = true, - if (TERN0(DISABLE_J, block->steps.j)) axis_active.j = true, - if (TERN0(DISABLE_K, block->steps.k)) axis_active.k = true, - if (TERN0(DISABLE_U, block->steps.u)) axis_active.u = true, - if (TERN0(DISABLE_V, block->steps.v)) axis_active.v = true, - if (TERN0(DISABLE_W, block->steps.w)) axis_active.w = true + if (TERN0(DISABLE_E, bnext->steps.e)) axis_active.e = true, + if (TERN0(DISABLE_X, bnext->steps.x)) axis_active.x = true, + if (TERN0(DISABLE_Y, bnext->steps.y)) axis_active.y = true, + if (TERN0(DISABLE_Z, bnext->steps.z)) axis_active.z = true, + if (TERN0(DISABLE_I, bnext->steps.i)) axis_active.i = true, + if (TERN0(DISABLE_J, bnext->steps.j)) axis_active.j = true, + if (TERN0(DISABLE_K, bnext->steps.k)) axis_active.k = true, + if (TERN0(DISABLE_U, bnext->steps.u)) axis_active.u = true, + if (TERN0(DISABLE_V, bnext->steps.v)) axis_active.v = true, + if (TERN0(DISABLE_W, bnext->steps.w)) axis_active.w = true ); } #endif @@ -1451,14 +1451,14 @@ void Planner::check_axes_activity() { * currently in the planner. */ void Planner::autotemp_task() { - static float oldt = 0; + static float oldt = 0.0f; if (!autotemp_enabled) return; if (thermalManager.degTargetHotend(active_extruder) < autotemp_min - 2) return; // Below the min? - float high = 0.0; + float high = 0.0f; for (uint8_t b = block_buffer_tail; b != block_buffer_head; b = next_block_index(b)) { - block_t *block = &block_buffer[b]; + const block_t * const block = &block_buffer[b]; if (NUM_AXIS_GANG(block->steps.x, || block->steps.y, || block->steps.z, || block->steps.i, || block->steps.j, || block->steps.k, || block->steps.u, || block->steps.v, || block->steps.w)) { const float se = (float)block->steps.e / block->step_event_count * SQRT(block->nominal_speed_sqr); // mm/sec; NOLESS(high, se); diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index afcc5a1566cb..dbc8592179ca 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -1022,7 +1022,7 @@ class Planner { return limit_value; } - #endif // !CLASSIC_JERK + #endif // HAS_JUNCTION_DEVIATION }; #define PLANNER_XY_FEEDRATE() _MIN(planner.settings.max_feedrate_mm_s[X_AXIS], planner.settings.max_feedrate_mm_s[Y_AXIS]) From 3bf768f925b83705be69728fe0d87ef9f2b09ccf Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 7 May 2022 23:51:38 -0500 Subject: [PATCH 033/241] =?UTF-8?q?=F0=9F=94=A8=20OpenOCD=20Debug=20for=20?= =?UTF-8?q?VSCode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../share/PlatformIO/debugging/launch.json | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/buildroot/share/PlatformIO/debugging/launch.json b/buildroot/share/PlatformIO/debugging/launch.json index 335c4c663e89..583d860eb36c 100644 --- a/buildroot/share/PlatformIO/debugging/launch.json +++ b/buildroot/share/PlatformIO/debugging/launch.json @@ -12,26 +12,17 @@ "version": "0.2.0", "configurations": [ { - "name": "Debug STM32 (launch)", + "name": "Debug STM32 (ST-Link)", "request": "launch", "type": "cortex-debug", "servertype": "openocd", "cwd": "${workspaceRoot}", "showDevDebugOutput": false, "configFiles": [ "interface/stlink.cfg", "target/stm32f4x.cfg" ], - "device": "STM32F407", - "executable": ".pio/build/BIGTREE_SKR_2_USB_debug/firmware.elf", - }, - { - "name": "Debug STM32 (attach)", - "request": "attach", - "type": "cortex-debug", - "servertype": "openocd", - "cwd": "${workspaceRoot}", - "showDevDebugOutput": false, - "configFiles": [ "interface/stlink.cfg", "target/stm32f4x.cfg" ], - "device": "STM32F407", - "executable": ".pio/build/BIGTREE_SKR_2_USB_debug/firmware.elf", + "device": "stlink", + "executable": "${workspaceRoot}/.pio/build/BIGTREE_SKR_2_USB_debug/firmware.elf", + "openOCDLaunchCommands": [ "init", "reset init" ], + "svdFile": "${env:HOME}/.platformio/platforms/ststm32@12.1.1/misc/svd/STM32F40x.svd", }, { "name": "Debug Sim", From 9d32bc31535eea64f78021cbe82316db492fee8d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 9 May 2022 16:47:04 -0500 Subject: [PATCH 034/241] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20Fix=20spurious=20U?= =?UTF-8?q?TF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/LPC1768/eeprom_wired.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/HAL/LPC1768/eeprom_wired.cpp b/Marlin/src/HAL/LPC1768/eeprom_wired.cpp index f9286a74ac88..1bbc39d4a242 100644 --- a/Marlin/src/HAL/LPC1768/eeprom_wired.cpp +++ b/Marlin/src/HAL/LPC1768/eeprom_wired.cpp @@ -34,7 +34,7 @@ #include "../shared/eeprom_api.h" #ifndef MARLIN_EEPROM_SIZE - #define MARLIN_EEPROM_SIZE 0x8000 // 32KB‬ + #define MARLIN_EEPROM_SIZE 0x8000 // 32K #endif size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; } From 8e24b34160e462fc8f3cff30cdb28e5cbdb2457d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 9 May 2022 17:35:32 -0500 Subject: [PATCH 035/241] =?UTF-8?q?=F0=9F=93=8C=20Define=20RAMPS=5FSMART?= =?UTF-8?q?=20EXP=20headers,=20AZSMZ=5F12864?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See #23501 --- Marlin/src/inc/Conditionals_LCD.h | 3 +- Marlin/src/pins/ramps/pins_RAMPS.h | 4 ++ Marlin/src/pins/sam/pins_RAMPS_SMART.h | 69 +++++++++++++++++--------- 3 files changed, 51 insertions(+), 25 deletions(-) diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 2bca6c45570c..5fd0081165e1 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -101,9 +101,8 @@ #elif ANY(miniVIKI, VIKI2, WYH_L12864, ELB_FULL_GRAPHIC_CONTROLLER, AZSMZ_12864) - #define IS_DOGM_12864 1 - #define DOGLCD + #define IS_DOGM_12864 1 #define IS_ULTIPANEL 1 #if ENABLED(miniVIKI) diff --git a/Marlin/src/pins/ramps/pins_RAMPS.h b/Marlin/src/pins/ramps/pins_RAMPS.h index d88d7e33127b..4ab7f4007331 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS.h +++ b/Marlin/src/pins/ramps/pins_RAMPS.h @@ -600,6 +600,10 @@ #define LCD_PINS_D6 AUX2_08_PIN #define LCD_PINS_D7 AUX2_10_PIN + #elif ENABLED(AZSMZ_12864) + + // Pins only defined for RAMPS_SMART currently + #else #if EITHER(MKS_12864OLED, MKS_12864OLED_SSD1306) diff --git a/Marlin/src/pins/sam/pins_RAMPS_SMART.h b/Marlin/src/pins/sam/pins_RAMPS_SMART.h index 96d0c9e1cc9a..2b8942c6ad2d 100644 --- a/Marlin/src/pins/sam/pins_RAMPS_SMART.h +++ b/Marlin/src/pins/sam/pins_RAMPS_SMART.h @@ -61,53 +61,43 @@ */ #define BOARD_INFO_NAME "RAMPS-SMART" -#define ALLOW_SAM3X8E -#include "../ramps/pins_RAMPS.h" // I2C EEPROM with 4K of space #define I2C_EEPROM -#define MARLIN_EEPROM_SIZE 0x1000 - -#define SDA_PIN 20 -#define SCL_PIN 21 +#define MARLIN_EEPROM_SIZE 0x1000 // 4K // See EEPROM device datasheet for the following values. These are for 24xx256 -#define EEPROM_SERIAL_ADDR 0x50 // 7 bit i2c address (without R/W bit) -#define EEPROM_PAGE_SIZE 64 // page write buffer size -#define EEPROM_PAGE_WRITE_TIME 7 // page write time in milliseconds (docs say 5ms but that is too short) - -#define TWI_CLOCK_FREQ 400000 -#define EEPROM_ADDRSZ_BYTES TWI_MMR_IADRSZ_2_BYTE // TWI_MMR_IADRSZ_1_BYTE for 1 byte, or TWI_MMR_IADRSZ_2_BYTE for 2 byte -#define EEPROM_AVAILABLE EEPROM_I2C - -#define RESET_PIN 42 // Resets the board if the jumper is attached +#define EEPROM_DEVICE_ADDRESS 0x50 // 7 bit i2c address (without R/W bit) +#define EEPROM_WRITE_DELAY 7 // page write time in milliseconds (docs say 5ms but that is too short) +//#define EEPROM_PAGE_SIZE 64 // page write buffer size +//#define TWI_CLOCK_FREQ 400000 +//#define EEPROM_ADDRSZ_BYTES TWI_MMR_IADRSZ_2_BYTE // TWI_MMR_IADRSZ_1_BYTE for 1 byte, or TWI_MMR_IADRSZ_2_BYTE for 2 byte +//#define EEPROM_AVAILABLE EEPROM_I2C // // Temperature Sensors // -#undef TEMP_0_PIN #define TEMP_0_PIN 9 // Analog Input - -#undef TEMP_1_PIN #define TEMP_1_PIN 10 // Analog Input - -#undef TEMP_BED_PIN #define TEMP_BED_PIN 11 // Analog Input // SPI for MAX Thermocouple -#undef TEMP_0_CS_PIN #if DISABLED(SDSUPPORT) #define TEMP_0_CS_PIN 67 // Don't use 53 if using Display/SD card #else #define TEMP_0_CS_PIN 67 // Don't use 49 (SD_DETECT_PIN) #endif +#define SDA_PIN 20 +#define SCL_PIN 21 +#define RESET_PIN 42 // Resets the board if the jumper is attached + // // LCD / Controller // - -// Support for AZSMZ 12864 LCD with SD Card 3D printer smart controller control panel #if ENABLED(AZSMZ_12864) + + // Support for AZSMZ 12864 LCD with SD Card 3D printer smart controller control panel #define BEEPER_PIN 66 // Smart RAMPS 1.42 pinout diagram on RepRap WIKI erroneously says this should be pin 65 #define DOGLCD_A0 59 #define DOGLCD_CS 44 @@ -116,4 +106,37 @@ #define BTN_ENC 67 // Smart RAMPS 1.42 pinout diagram on RepRap WIKI erroneously says this should be pin 66 #define SD_DETECT_PIN 49 // Pin 49 for display sd interface, 72 for easy adapter board #define KILL_PIN 42 + +#else + + /** ------ ------ + * 37 |10 9 | 35 (MISO) 50 |10 9 | 52 (SCK) + * 31 | 8 7 | 41 29 | 8 7 | 53 + * 33 6 5 | 23 25 6 5 | 51 (MOSI) + * 42 | 4 3 | 44 49 | 4 3 | 27 + * GND | 2 1 | 5V GND | 2 1 | -- + * ------ ------ + * EXP1 EXP2 + */ + #define EXP1_03_PIN 44 + #define EXP1_04_PIN 42 + #define EXP1_05_PIN 23 + #define EXP1_06_PIN 33 + #define EXP1_07_PIN 41 + #define EXP1_08_PIN 31 + #define EXP1_09_PIN 35 + #define EXP1_10_PIN 37 + + #define EXP2_03_PIN 27 + #define EXP2_04_PIN 49 + #define EXP2_05_PIN 51 + #define EXP2_06_PIN 25 + #define EXP2_07_PIN 53 + #define EXP2_08_PIN 29 + #define EXP2_09_PIN 52 + #define EXP2_10_PIN 50 + #endif + +#define ALLOW_SAM3X8E +#include "../ramps/pins_RAMPS.h" From 918a9cf3d1c613e59dca5c59b567af86a5a3c8c9 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 9 May 2022 18:50:14 -0500 Subject: [PATCH 036/241] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Cla?= =?UTF-8?q?rify=20acceleration=20factor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/planner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index a22a99340f93..62cbc172dfbb 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -2564,7 +2564,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, block->acceleration_steps_per_s2 = accel; block->acceleration = accel / steps_per_mm; #if DISABLED(S_CURVE_ACCELERATION) - block->acceleration_rate = (uint32_t)(accel * (sq(4096.0f) / (STEPPER_TIMER_RATE))); + block->acceleration_rate = (uint32_t)(accel * (float(1 << 24) / (STEPPER_TIMER_RATE))); #endif #if ENABLED(LIN_ADVANCE) if (block->use_advance_lead) { From ba95e85e5363258604cdb03adacf67ab2aace41b Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 10 May 2022 00:01:50 +0000 Subject: [PATCH 037/241] [cron] Bump distribution date (2022-05-10) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index e9a4e6663d8c..cc007c97e704 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-05-08" +//#define STRING_DISTRIBUTION_DATE "2022-05-10" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 0abe920d093f..e92ed964f6c4 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-05-08" + #define STRING_DISTRIBUTION_DATE "2022-05-10" #endif /** From 11c701af9b03280f43ea261bc0cd9111700266ad Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 11 May 2022 20:44:11 -0500 Subject: [PATCH 038/241] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20Maple=20warning=20?= =?UTF-8?q?followup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #23661 --- Marlin/src/inc/Warnings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/inc/Warnings.cpp b/Marlin/src/inc/Warnings.cpp index 0cb798396240..0abcd0513dda 100644 --- a/Marlin/src/inc/Warnings.cpp +++ b/Marlin/src/inc/Warnings.cpp @@ -757,7 +757,7 @@ #endif /** - * Maple environent + * Maple environment */ #ifdef __STM32F1__ #warning "Maple build environments are deprecated. Please use a non-Maple build environment. Report issues to the Marlin Firmware project." From 04fe50936e23a8aca7a400591e700c1220f68b3f Mon Sep 17 00:00:00 2001 From: Pauli Jokela Date: Thu, 12 May 2022 05:23:16 +0300 Subject: [PATCH 039/241] =?UTF-8?q?=E2=9C=A8=20SOUND=5FON=5FDEFAULT=20opti?= =?UTF-8?q?on=20(#24102)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/Configuration_adv.h | 1 + Marlin/src/MarlinCore.cpp | 6 ++-- Marlin/src/feature/spindle_laser.h | 4 +-- Marlin/src/inc/Conditionals_post.h | 4 +-- Marlin/src/lcd/HD44780/marlinui_HD44780.cpp | 2 +- Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp | 2 +- Marlin/src/lcd/e3v2/common/encoder.cpp | 6 +--- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 10 +++---- Marlin/src/lcd/e3v2/proui/dwin.cpp | 6 ++-- .../src/lcd/extui/anycubic_chiron/Tunes.cpp | 9 +++--- .../extui/anycubic_i3mega/anycubic_extui.cpp | 4 +-- Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp | 9 ++---- Marlin/src/lcd/marlinui.cpp | 15 +++++----- Marlin/src/lcd/marlinui.h | 20 ++++++------- Marlin/src/lcd/menu/menu_bed_corners.cpp | 2 +- Marlin/src/lcd/menu/menu_configuration.cpp | 2 +- Marlin/src/lcd/tft/ui_1024x600.cpp | 2 +- Marlin/src/lcd/tft/ui_320x240.cpp | 2 +- Marlin/src/lcd/tft/ui_480x320.cpp | 2 +- Marlin/src/libs/buzzer.cpp | 8 ++--- Marlin/src/libs/buzzer.h | 30 ++++++++++--------- Marlin/src/module/settings.cpp | 12 ++++---- Marlin/src/module/temperature.cpp | 14 ++++----- 23 files changed, 80 insertions(+), 92 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 4218a2cd8cdd..c62483362150 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1337,6 +1337,7 @@ #if ANY(HAS_DISPLAY, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) //#define SOUND_MENU_ITEM // Add a mute option to the LCD menu + #define SOUND_ON_DEFAULT // Buzzer/speaker default enabled state #endif #if EITHER(HAS_DISPLAY, DWIN_LCD_PROUI) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 50172f98b95b..bdcdfc0508d9 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -97,7 +97,7 @@ #include "feature/host_actions.h" #endif -#if USE_BEEPER +#if HAS_BEEPER #include "libs/buzzer.h" #endif @@ -827,7 +827,7 @@ void idle(bool no_stepper_sleep/*=false*/) { TERN_(PRINTCOUNTER, print_job_timer.tick()); // Update the Beeper queue - TERN_(USE_BEEPER, buzzer.tick()); + TERN_(HAS_BEEPER, buzzer.tick()); // Handle UI input / draw events TERN(DWIN_CREALITY_LCD, DWIN_Update(), ui.update()); @@ -1287,7 +1287,7 @@ void setup() { calibrate_delay_loop(); // Init buzzer pin(s) - #if USE_BEEPER + #if HAS_BEEPER SETUP_RUN(buzzer.init()); #endif diff --git a/Marlin/src/feature/spindle_laser.h b/Marlin/src/feature/spindle_laser.h index e948d2d37b73..1f9bec7bf0f9 100644 --- a/Marlin/src/feature/spindle_laser.h +++ b/Marlin/src/feature/spindle_laser.h @@ -30,7 +30,7 @@ #include "spindle_laser_types.h" -#if USE_BEEPER +#if HAS_BEEPER #include "../libs/buzzer.h" #endif @@ -272,7 +272,7 @@ class SpindleLaser { * If not set defaults to 80% power */ static void test_fire_pulse() { - TERN_(USE_BEEPER, buzzer.tone(30, 3000)); + TERN_(HAS_BEEPER, buzzer.tone(30, 3000)); enable_forward(); // Turn Laser on (Spindle speak but same funct) delay(testPulse); // Delay for time set by user in pulse ms menu screen. disable(); // Turn laser off diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 88d1bb0c2b89..6c025b1dbbf9 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -3552,9 +3552,9 @@ * Buzzer/Speaker */ #if PIN_EXISTS(BEEPER) - #define USE_BEEPER 1 + #define HAS_BEEPER 1 #endif -#if USE_BEEPER || ANY(LCD_USE_I2C_BUZZER, PCA9632_BUZZER) +#if ANY(HAS_BEEPER, LCD_USE_I2C_BUZZER, PCA9632_BUZZER) #define HAS_BUZZER 1 #endif diff --git a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp index db4bd4e19e8c..8b00b7ccdae0 100644 --- a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp +++ b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp @@ -121,7 +121,7 @@ static void createChar_P(const char c, const byte * const ptr) { #if ENABLED(LCD_USE_I2C_BUZZER) void MarlinUI::buzz(const long duration, const uint16_t freq) { - if (!buzzer_enabled) return; + if (!sound_on) return; lcd.buzz(duration, freq); } #endif diff --git a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp index 0745397f4f99..cef5fdb17098 100644 --- a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp +++ b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp @@ -301,7 +301,7 @@ uint8_t MarlinUI::read_slow_buttons() { // Duration in ms, freq in Hz void MarlinUI::buzz(const long duration, const uint16_t freq) { if (!PanelDetected) return; - if (!buzzer_enabled) return; + if (!sound_on) return; #if ENABLED(TFTGLCD_PANEL_SPI) WRITE(TFTGLCD_CS, LOW); SPI_SEND_ONE(BUZZER); diff --git a/Marlin/src/lcd/e3v2/common/encoder.cpp b/Marlin/src/lcd/e3v2/common/encoder.cpp index edfaf60aae1e..9922b70b29df 100644 --- a/Marlin/src/lcd/e3v2/common/encoder.cpp +++ b/Marlin/src/lcd/e3v2/common/encoder.cpp @@ -51,11 +51,7 @@ ENCODER_Rate EncoderRate; // TODO: Replace with ui.quick_feedback void Encoder_tick() { #if PIN_EXISTS(BEEPER) - if (ui.buzzer_enabled) { - WRITE(BEEPER_PIN, HIGH); - delay(10); - WRITE(BEEPER_PIN, LOW); - } + if (ui.sound_on) buzzer.click(10); #endif } diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index fd51ab468639..04a612a9cc2d 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -2587,11 +2587,11 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ case ADVANCED_BEEPER: if (draw) { Draw_Menu_Item(row, ICON_Version, F("LCD Beeper")); - Draw_Checkbox(row, ui.buzzer_enabled); + Draw_Checkbox(row, ui.sound_on); } else { - ui.buzzer_enabled = !ui.buzzer_enabled; - Draw_Checkbox(row, ui.buzzer_enabled); + ui.sound_on = !ui.sound_on; + Draw_Checkbox(row, ui.sound_on); } break; #endif @@ -4602,7 +4602,7 @@ void CrealityDWINClass::Screen_Update() { } void CrealityDWINClass::AudioFeedback(const bool success/*=true*/) { - if (ui.buzzer_enabled) + if (ui.sound_on) DONE_BUZZ(success); else Update_Status(success ? "Success" : "Failed"); @@ -4646,7 +4646,7 @@ void CrealityDWINClass::Reset_Settings() { eeprom_settings.coordinates_split_line = 0; TERN_(AUTO_BED_LEVELING_UBL, mesh_conf.tilt_grid = eeprom_settings.tilt_grid_size + 1); corner_pos = eeprom_settings.corner_pos / 10.0f; - TERN_(SOUND_MENU_ITEM, ui.buzzer_enabled = true); + TERN_(SOUND_MENU_ITEM, ui.sound_on = ENABLED(SOUND_ON_DEFAULT)); Redraw_Screen(); } diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index fe424e062a61..1933c82d365e 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -2106,8 +2106,8 @@ void SetPID(celsius_t t, heater_id_t h) { #if ENABLED(SOUND_MENU_ITEM) void SetEnableSound() { - ui.buzzer_enabled = !ui.buzzer_enabled; - Draw_Chkb_Line(CurrentMenu->line(), ui.buzzer_enabled); + ui.sound_on = !ui.sound_on; + Draw_Chkb_Line(CurrentMenu->line(), ui.sound_on); DWIN_UpdateLCD(); } #endif @@ -2638,7 +2638,7 @@ void onDrawLanguage(MenuItemClass* menuitem, int8_t line) { #endif #if ENABLED(SOUND_MENU_ITEM) - void onDrawEnableSound(MenuItemClass* menuitem, int8_t line) { onDrawChkbMenu(menuitem, line, ui.buzzer_enabled); } + void onDrawEnableSound(MenuItemClass* menuitem, int8_t line) { onDrawChkbMenu(menuitem, line, ui.sound_on); } #endif #ifdef BLTOUCH_HS_MODE diff --git a/Marlin/src/lcd/extui/anycubic_chiron/Tunes.cpp b/Marlin/src/lcd/extui/anycubic_chiron/Tunes.cpp index f228c471c9ca..adbf98e3bb82 100644 --- a/Marlin/src/lcd/extui/anycubic_chiron/Tunes.cpp +++ b/Marlin/src/lcd/extui/anycubic_chiron/Tunes.cpp @@ -35,6 +35,8 @@ #include "../../../inc/MarlinConfigPre.h" +// TODO: Use Marlin's built-in tone player instead. + #if ENABLED(ANYCUBIC_LCD_CHIRON) #include "Tunes.h" @@ -44,15 +46,12 @@ namespace Anycubic { void PlayTune(uint8_t beeperPin, const uint16_t *tune, uint8_t speed=1) { uint8_t pos = 1; - uint16_t wholenotelen = tune[0] / speed; + const uint16_t wholenotelen = tune[0] / speed; do { - uint16_t freq = tune[pos]; - uint16_t notelen = wholenotelen / tune[pos + 1]; - + const uint16_t freq = tune[pos], notelen = wholenotelen / tune[pos + 1]; ::tone(beeperPin, freq, notelen); ExtUI::delay_ms(notelen); pos += 2; - if (pos >= MAX_TUNE_LENGTH) break; } while (tune[pos] != n_END); } diff --git a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp index 469202ee222b..40a670b5b073 100644 --- a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp +++ b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp @@ -42,9 +42,7 @@ namespace ExtUI { void onMediaError() { AnycubicTFT.OnSDCardError(); } void onMediaRemoved() { AnycubicTFT.OnSDCardStateChange(false); } void onPlayTone(const uint16_t frequency, const uint16_t duration) { - #if ENABLED(SPEAKER) - ::tone(BEEPER_PIN, frequency, duration); - #endif + TERN_(SPEAKER, ::tone(BEEPER_PIN, frequency, duration)); } void onPrintTimerStarted() { AnycubicTFT.OnPrintTimerStarted(); } void onPrintTimerPaused() { AnycubicTFT.OnPrintTimerPaused(); } diff --git a/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp b/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp index a14fa4d1dfb2..c679751ebe90 100644 --- a/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp +++ b/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp @@ -160,6 +160,8 @@ #endif } + #include "../../../libs/buzzer.h" + void init_test_gpio() { endstops.init(); @@ -201,12 +203,7 @@ #endif } - void mks_test_beeper() { - WRITE(BEEPER_PIN, HIGH); - delay(100); - WRITE(BEEPER_PIN, LOW); - delay(100); - } + void mks_test_beeper() { buzzer.click(100); } #if ENABLED(SDSUPPORT) diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index d2af634896da..955813c2fbf2 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -118,19 +118,18 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; #endif #if ENABLED(SOUND_MENU_ITEM) - bool MarlinUI::buzzer_enabled = true; + bool MarlinUI::sound_on = ENABLED(SOUND_ON_DEFAULT); #endif -#if EITHER(PCA9632_BUZZER, USE_BEEPER) - #include "../libs/buzzer.h" // for BUZZ() macro +#if EITHER(PCA9632_BUZZER, HAS_BEEPER) #if ENABLED(PCA9632_BUZZER) #include "../feature/leds/pca9632.h" #endif void MarlinUI::buzz(const long duration, const uint16_t freq) { - if (!buzzer_enabled) return; + if (!sound_on) return; #if ENABLED(PCA9632_BUZZER) PCA9632_buzz(duration, freq); - #elif USE_BEEPER + #elif HAS_BEEPER buzzer.tone(duration, freq); #endif } @@ -694,7 +693,7 @@ void MarlinUI::init() { const millis_t ms = millis(); #endif if (ELAPSED(ms, next_beep)) { - buzz(FEEDRATE_CHANGE_BEEP_DURATION, FEEDRATE_CHANGE_BEEP_FREQUENCY); + BUZZ(FEEDRATE_CHANGE_BEEP_DURATION, FEEDRATE_CHANGE_BEEP_FREQUENCY); next_beep = ms + 500UL; } #endif @@ -748,7 +747,7 @@ void MarlinUI::init() { #if HAS_CHIRP chirp(); // Buzz and wait. Is the delay needed for buttons to settle? - #if BOTH(HAS_MARLINUI_MENU, USE_BEEPER) + #if BOTH(HAS_MARLINUI_MENU, HAS_BEEPER) for (int8_t i = 5; i--;) { buzzer.tick(); delay(2); } #elif HAS_MARLINUI_MENU delay(10); @@ -1646,7 +1645,7 @@ void MarlinUI::init() { void MarlinUI::flow_fault() { LCD_ALERTMESSAGE(MSG_FLOWMETER_FAULT); - TERN_(HAS_BUZZER, buzz(1000, 440)); + BUZZ(1000, 440); TERN_(HAS_MARLINUI_MENU, return_to_status()); } diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index cb2d8f8672f0..c27ced6fdd16 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -21,15 +21,12 @@ */ #pragma once +#include "../inc/MarlinConfig.h" #include "../sd/cardreader.h" #include "../module/motion.h" -#include "buttons.h" +#include "../libs/buzzer.h" -#include "../inc/MarlinConfig.h" - -#if HAS_BUZZER - #include "../libs/buzzer.h" -#endif +#include "buttons.h" #if ENABLED(TOUCH_SCREEN_CALIBRATION) #include "tft_io/touch_calibration.h" @@ -192,6 +189,9 @@ typedef bool (*statusResetFunc_t)(); //////////// MarlinUI Singleton //////////// //////////////////////////////////////////// +class MarlinUI; +extern MarlinUI ui; + class MarlinUI { public: @@ -225,9 +225,9 @@ class MarlinUI { #endif #if ENABLED(SOUND_MENU_ITEM) - static bool buzzer_enabled; // Initialized by settings.load() + static bool sound_on; // Initialized by settings.load() #else - static constexpr bool buzzer_enabled = true; + static constexpr bool sound_on = true; #endif #if HAS_BUZZER @@ -235,7 +235,7 @@ class MarlinUI { #endif FORCE_INLINE static void chirp() { - TERN_(HAS_CHIRP, buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ)); + TERN_(HAS_CHIRP, TERN(HAS_BUZZER, buzz, BUZZ)(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ)); } #if ENABLED(LCD_HAS_STATUS_INDICATORS) @@ -786,8 +786,6 @@ class MarlinUI { #endif }; -extern MarlinUI ui; - #define LCD_MESSAGE_F(S) ui.set_status(F(S)) #define LCD_MESSAGE(M) ui.set_status(GET_TEXT_F(M)) #define LCD_ALERTMESSAGE_F(S) ui.set_alert_status(F(S)) diff --git a/Marlin/src/lcd/menu/menu_bed_corners.cpp b/Marlin/src/lcd/menu/menu_bed_corners.cpp index e3f5c460ed24..163a2a751a34 100644 --- a/Marlin/src/lcd/menu/menu_bed_corners.cpp +++ b/Marlin/src/lcd/menu/menu_bed_corners.cpp @@ -247,7 +247,7 @@ static void _lcd_level_bed_corners_get_next_position() { probe_triggered = PROBE_TRIGGERED(); if (probe_triggered) { endstops.hit_on_purpose(); - TERN_(LEVEL_CORNERS_AUDIO_FEEDBACK, ui.buzz(200, 600)); + TERN_(LEVEL_CORNERS_AUDIO_FEEDBACK, BUZZ(200, 600)); } idle(); } diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp index d4590a65f902..f91ea60ad9a3 100644 --- a/Marlin/src/lcd/menu/menu_configuration.cpp +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -574,7 +574,7 @@ void menu_configuration() { #endif #if ENABLED(SOUND_MENU_ITEM) - EDIT_ITEM(bool, MSG_SOUND, &ui.buzzer_enabled, []{ ui.chirp(); }); + EDIT_ITEM(bool, MSG_SOUND, &ui.sound_on, []{ ui.chirp(); }); #endif #if ENABLED(EEPROM_SETTINGS) diff --git a/Marlin/src/lcd/tft/ui_1024x600.cpp b/Marlin/src/lcd/tft/ui_1024x600.cpp index 7c3d04345f48..49c374d29b73 100644 --- a/Marlin/src/lcd/tft/ui_1024x600.cpp +++ b/Marlin/src/lcd/tft/ui_1024x600.cpp @@ -596,7 +596,7 @@ MotionAxisState motionAxisState; static void quick_feedback() { #if HAS_CHIRP ui.chirp(); // Buzz and wait. Is the delay needed for buttons to settle? - #if BOTH(HAS_MARLINUI_MENU, USE_BEEPER) + #if BOTH(HAS_MARLINUI_MENU, HAS_BEEPER) for (int8_t i = 5; i--;) { buzzer.tick(); delay(2); } #elif HAS_MARLINUI_MENU delay(10); diff --git a/Marlin/src/lcd/tft/ui_320x240.cpp b/Marlin/src/lcd/tft/ui_320x240.cpp index 812a03594795..35f04fae64b8 100644 --- a/Marlin/src/lcd/tft/ui_320x240.cpp +++ b/Marlin/src/lcd/tft/ui_320x240.cpp @@ -578,7 +578,7 @@ MotionAxisState motionAxisState; static void quick_feedback() { #if HAS_CHIRP ui.chirp(); // Buzz and wait. Is the delay needed for buttons to settle? - #if BOTH(HAS_MARLINUI_MENU, USE_BEEPER) + #if BOTH(HAS_MARLINUI_MENU, HAS_BEEPER) for (int8_t i = 5; i--;) { buzzer.tick(); delay(2); } #elif HAS_MARLINUI_MENU delay(10); diff --git a/Marlin/src/lcd/tft/ui_480x320.cpp b/Marlin/src/lcd/tft/ui_480x320.cpp index f142dbbc06c1..7952ba30cf9f 100644 --- a/Marlin/src/lcd/tft/ui_480x320.cpp +++ b/Marlin/src/lcd/tft/ui_480x320.cpp @@ -583,7 +583,7 @@ MotionAxisState motionAxisState; static void quick_feedback() { #if HAS_CHIRP ui.chirp(); // Buzz and wait. Is the delay needed for buttons to settle? - #if BOTH(HAS_MARLINUI_MENU, USE_BEEPER) + #if BOTH(HAS_MARLINUI_MENU, HAS_BEEPER) for (int8_t i = 5; i--;) { buzzer.tick(); delay(2); } #elif HAS_MARLINUI_MENU delay(10); diff --git a/Marlin/src/libs/buzzer.cpp b/Marlin/src/libs/buzzer.cpp index 57ed5fb41910..a3c838ebc0a3 100644 --- a/Marlin/src/libs/buzzer.cpp +++ b/Marlin/src/libs/buzzer.cpp @@ -22,7 +22,7 @@ #include "../inc/MarlinConfig.h" -#if USE_BEEPER +#if HAS_BEEPER #include "buzzer.h" #include "../module/temperature.h" @@ -45,7 +45,7 @@ Buzzer buzzer; * @param frequency Frequency of the tone in hertz */ void Buzzer::tone(const uint16_t duration, const uint16_t frequency/*=0*/) { - if (!ui.buzzer_enabled) return; + if (!ui.sound_on) return; while (buffer.isFull()) { tick(); thermalManager.manage_heater(); @@ -55,7 +55,7 @@ void Buzzer::tone(const uint16_t duration, const uint16_t frequency/*=0*/) { } void Buzzer::tick() { - if (!ui.buzzer_enabled) return; + if (!ui.sound_on) return; const millis_t now = millis(); if (!state.endtime) { @@ -81,4 +81,4 @@ void Buzzer::tick() { else if (ELAPSED(now, state.endtime)) reset(); } -#endif // USE_BEEPER +#endif // HAS_BEEPER diff --git a/Marlin/src/libs/buzzer.h b/Marlin/src/libs/buzzer.h index 73406c0591be..b1c286a66222 100644 --- a/Marlin/src/libs/buzzer.h +++ b/Marlin/src/libs/buzzer.h @@ -23,7 +23,7 @@ #include "../inc/MarlinConfig.h" -#if USE_BEEPER +#if HAS_BEEPER #include "circularqueue.h" @@ -61,18 +61,6 @@ */ FORCE_INLINE static void invert() { TOGGLE(BEEPER_PIN); } - /** - * @brief Turn off a digital PIN - * @details Alias of digitalWrite(PIN, LOW) using FastIO - */ - FORCE_INLINE static void off() { WRITE(BEEPER_PIN, LOW); } - - /** - * @brief Turn on a digital PIN - * @details Alias of digitalWrite(PIN, HIGH) using FastIO - */ - FORCE_INLINE static void on() { WRITE(BEEPER_PIN, HIGH); } - /** * @brief Resets the state of the class * @details Brings the class state to a known one. @@ -91,6 +79,20 @@ reset(); } + /** + * @brief Turn on a digital PIN + * @details Alias of digitalWrite(PIN, HIGH) using FastIO + */ + FORCE_INLINE static void on() { WRITE(BEEPER_PIN, HIGH); } + + /** + * @brief Turn off a digital PIN + * @details Alias of digitalWrite(PIN, LOW) using FastIO + */ + FORCE_INLINE static void off() { WRITE(BEEPER_PIN, LOW); } + + static void click(const uint16_t duration) { on(); delay(duration); off(); } + /** * @brief Add a tone to the queue * @details Adds a tone_t structure to the ring buffer, will block IO if the @@ -118,8 +120,8 @@ #elif HAS_BUZZER // Buzz indirectly via the MarlinUI instance - #include "../lcd/marlinui.h" #define BUZZ(d,f) ui.buzz(d,f) + #include "../lcd/marlinui.h" #else diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index bae5d36aaa47..cf91dc25b4fc 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -541,7 +541,7 @@ typedef struct SettingsDataStruct { // Buzzer enable/disable // #if ENABLED(SOUND_MENU_ITEM) - bool buzzer_enabled; + bool sound_on; #endif // @@ -1576,7 +1576,7 @@ void MarlinSettings::postprocess() { // Buzzer enable/disable // #if ENABLED(SOUND_MENU_ITEM) - EEPROM_WRITE(ui.buzzer_enabled); + EEPROM_WRITE(ui.sound_on); #endif // @@ -2546,8 +2546,8 @@ void MarlinSettings::postprocess() { // Buzzer enable/disable // #if ENABLED(SOUND_MENU_ITEM) - _FIELD_TEST(buzzer_enabled); - EEPROM_READ(ui.buzzer_enabled); + _FIELD_TEST(sound_on); + EEPROM_READ(ui.sound_on); #endif // @@ -2945,7 +2945,9 @@ void MarlinSettings::reset() { // // Buzzer enable/disable // - TERN_(SOUND_MENU_ITEM, ui.buzzer_enabled = true); + #if ENABLED(SOUND_MENU_ITEM) + ui.sound_on = ENABLED(SOUND_ON_DEFAULT); + #endif // // Magnetic Parking Extruder diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 9cadcdc84e74..84bd1c50078e 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -178,7 +178,7 @@ #include "tool_change.h" #endif -#if USE_BEEPER +#if HAS_BEEPER #include "../libs/buzzer.h" #endif @@ -1224,18 +1224,14 @@ int16_t Temperature::getHeaterPower(const heater_id_t heater_id) { inline void loud_kill(FSTR_P const lcd_msg, const heater_id_t heater_id) { marlin_state = MF_KILLED; thermalManager.disable_all_heaters(); - #if USE_BEEPER + #if HAS_BEEPER for (uint8_t i = 20; i--;) { - WRITE(BEEPER_PIN, HIGH); - delay(25); watchdog_refresh(); - WRITE(BEEPER_PIN, LOW); - delay(40); - watchdog_refresh(); - delay(40); + buzzer.click(25); + delay(80); watchdog_refresh(); } - WRITE(BEEPER_PIN, HIGH); + buzzer.on(); #endif #if ENABLED(NOZZLE_PARK_FEATURE) if (!homing_needed_error()) { From 672d0d444821408f3f76af70ed5f2c806cc92ea6 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 11 May 2022 23:37:40 -0500 Subject: [PATCH 040/241] =?UTF-8?q?=F0=9F=93=9D=20Refer=20to=20'PROGMEM'?= =?UTF-8?q?=20as=20'flash'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index c62483362150..9a3210b5f8dc 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1679,11 +1679,11 @@ //#define XYZ_NO_FRAME #define XYZ_HOLLOW_FRAME - // A bigger font is available for edit items. Costs 3120 bytes of PROGMEM. + // A bigger font is available for edit items. Costs 3120 bytes of flash. // Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese. //#define USE_BIG_EDIT_FONT - // A smaller font may be used on the Info Screen. Costs 2434 bytes of PROGMEM. + // A smaller font may be used on the Info Screen. Costs 2434 bytes of flash. // Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese. //#define USE_SMALL_INFOFONT @@ -1739,7 +1739,7 @@ //#define STATUS_ALT_FAN_BITMAP // Use the alternative fan bitmap //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar - //#define BOOT_MARLIN_LOGO_ANIMATED // Animated Marlin logo. Costs ~3260 (or ~940) bytes of PROGMEM. + //#define BOOT_MARLIN_LOGO_ANIMATED // Animated Marlin logo. Costs ~3260 (or ~940) bytes of flash. // Frivolous Game Options //#define MARLIN_BRICKOUT @@ -2300,7 +2300,7 @@ #define BUFSIZE 4 // Transmission to Host Buffer Size -// To save 386 bytes of PROGMEM (and TX_BUFFER_SIZE+3 bytes of RAM) set to 0. +// To save 386 bytes of flash (and TX_BUFFER_SIZE+3 bytes of RAM) set to 0. // To buffer a simple "ok" you need 4 bytes. // For ADVANCED_OK (M105) you need 32 bytes. // For debug-echo: 128 bytes for the optimal speed. From 30eb2aa869afb218394b98f747b09fe9b40d1aea Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Thu, 12 May 2022 06:00:54 +0000 Subject: [PATCH 041/241] [cron] Bump distribution date (2022-05-12) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index cc007c97e704..65116da8fcd8 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-05-10" +//#define STRING_DISTRIBUTION_DATE "2022-05-12" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index e92ed964f6c4..97af839ea286 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-05-10" + #define STRING_DISTRIBUTION_DATE "2022-05-12" #endif /** From 84b9de9a19554275ad3a4ea5b10c02353bada43f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 12 May 2022 00:07:22 -0500 Subject: [PATCH 042/241] =?UTF-8?q?=F0=9F=94=A8=20Fix=20g++=20locator=20fo?= =?UTF-8?q?r=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/share/PlatformIO/scripts/preprocessor.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/buildroot/share/PlatformIO/scripts/preprocessor.py b/buildroot/share/PlatformIO/scripts/preprocessor.py index 3d324bac4b38..d9c472006c28 100644 --- a/buildroot/share/PlatformIO/scripts/preprocessor.py +++ b/buildroot/share/PlatformIO/scripts/preprocessor.py @@ -67,11 +67,9 @@ def search_compiler(env): with open(GCC_PATH_CACHE, 'r') as f: return f.read() - # Find a platform compiler by searching $PATH items - # A native target will search all PATH bin folders. - # Others look only within $HOME/.platformio. - path_regex = "" if env.GetProjectOption('platform') == 'native' else re.escape(env['PROJECT_PACKAGES_DIR']) - + # Find the current platform compiler by searching the $PATH + # which will be in a platformio toolchain bin folder + path_regex = re.escape(env['PROJECT_PACKAGES_DIR']) gcc = "g++" if env['PLATFORM'] == 'win32': path_separator = ';' From f1ab24d0ae2aa226235755be2345a677103952aa Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 12 May 2022 04:16:31 -0500 Subject: [PATCH 043/241] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20accel=20dividend?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/planner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 62cbc172dfbb..90424b55eeed 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -2564,7 +2564,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, block->acceleration_steps_per_s2 = accel; block->acceleration = accel / steps_per_mm; #if DISABLED(S_CURVE_ACCELERATION) - block->acceleration_rate = (uint32_t)(accel * (float(1 << 24) / (STEPPER_TIMER_RATE))); + block->acceleration_rate = (uint32_t)(accel * (float(1UL << 24) / (STEPPER_TIMER_RATE))); #endif #if ENABLED(LIN_ADVANCE) if (block->use_advance_lead) { From 64ebb78892026e22996dca50af1480232f915dac Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Thu, 12 May 2022 06:38:05 -0400 Subject: [PATCH 044/241] =?UTF-8?q?=E2=9C=A8=20Creality=20CR-10=20SmartPro?= =?UTF-8?q?=20(#24151)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/core/boards.h | 27 ++-- Marlin/src/pins/pins.h | 2 + Marlin/src/pins/stm32f1/pins_CREALITY_V24S1.h | 2 +- Marlin/src/pins/stm32f1/pins_CREALITY_V25S1.h | 152 ++++++++++++++++++ Marlin/src/pins/stm32f1/pins_CREALITY_V4.h | 10 +- Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h | 55 +++---- .../share/PlatformIO/ldscripts/crealityPro.ld | 14 ++ ini/stm32f1-maple.ini | 8 + ini/stm32f1.ini | 5 + 9 files changed, 222 insertions(+), 53 deletions(-) create mode 100644 Marlin/src/pins/stm32f1/pins_CREALITY_V25S1.h create mode 100644 buildroot/share/PlatformIO/ldscripts/crealityPro.ld diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 14303754820c..ec85970ac411 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -352,19 +352,20 @@ #define BOARD_CREALITY_V431_D 4049 // Creality v4.3.1d (STM32F103RC / STM32F103RE) #define BOARD_CREALITY_V452 4050 // Creality v4.5.2 (STM32F103RC / STM32F103RE) #define BOARD_CREALITY_V453 4051 // Creality v4.5.3 (STM32F103RC / STM32F103RE) -#define BOARD_CREALITY_V24S1 4052 // Creality v2.4.S1 (STM32F103RC / STM32F103RE) v101 as found in the Ender 7 -#define BOARD_CREALITY_V24S1_301 4053 // Creality v2.4.S1_301 (STM32F103RC / STM32F103RE) as found in the Ender 3 S1 -#define BOARD_TRIGORILLA_PRO 4054 // Trigorilla Pro (STM32F103ZE) -#define BOARD_FLY_MINI 4055 // FLYmaker FLY MINI (STM32F103RC) -#define BOARD_FLSUN_HISPEED 4056 // FLSUN HiSpeedV1 (STM32F103VE) -#define BOARD_BEAST 4057 // STM32F103RE Libmaple-based controller -#define BOARD_MINGDA_MPX_ARM_MINI 4058 // STM32F103ZE Mingda MD-16 -#define BOARD_GTM32_PRO_VD 4059 // STM32F103VE controller -#define BOARD_ZONESTAR_ZM3E2 4060 // Zonestar ZM3E2 (STM32F103RC) -#define BOARD_ZONESTAR_ZM3E4 4061 // Zonestar ZM3E4 V1 (STM32F103VC) -#define BOARD_ZONESTAR_ZM3E4V2 4062 // Zonestar ZM3E4 V2 (STM32F103VC) -#define BOARD_ERYONE_ERY32_MINI 4063 // Eryone Ery32 mini (STM32F103VE) -#define BOARD_PANDA_PI_V29 4064 // Panda Pi V2.9 - Standalone (STM32F103RC) +#define BOARD_CREALITY_V24S1 4052 // Creality v2.4.S1 (STM32F103RC / STM32F103RE) v101 as found in the Ender-7 +#define BOARD_CREALITY_V24S1_301 4053 // Creality v2.4.S1_301 (STM32F103RC / STM32F103RE) v301 as found in the Ender-3 S1 +#define BOARD_CREALITY_V25S1 4054 // Creality v2.5.S1 (STM32F103RE) as found in the CR-10 Smart Pro +#define BOARD_TRIGORILLA_PRO 4055 // Trigorilla Pro (STM32F103ZE) +#define BOARD_FLY_MINI 4056 // FLYmaker FLY MINI (STM32F103RC) +#define BOARD_FLSUN_HISPEED 4057 // FLSUN HiSpeedV1 (STM32F103VE) +#define BOARD_BEAST 4058 // STM32F103RE Libmaple-based controller +#define BOARD_MINGDA_MPX_ARM_MINI 4059 // STM32F103ZE Mingda MD-16 +#define BOARD_GTM32_PRO_VD 4060 // STM32F103VE controller +#define BOARD_ZONESTAR_ZM3E2 4061 // Zonestar ZM3E2 (STM32F103RC) +#define BOARD_ZONESTAR_ZM3E4 4062 // Zonestar ZM3E4 V1 (STM32F103VC) +#define BOARD_ZONESTAR_ZM3E4V2 4063 // Zonestar ZM3E4 V2 (STM32F103VC) +#define BOARD_ERYONE_ERY32_MINI 4064 // Eryone Ery32 mini (STM32F103VE) +#define BOARD_PANDA_PI_V29 4065 // Panda Pi V2.9 - Standalone (STM32F103RC) // // ARM Cortex-M4F diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 01e5ee41e383..aecf17284ac5 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -583,6 +583,8 @@ #include "stm32f1/pins_CREALITY_V24S1.h" // STM32F1 env:STM32F103RE_creality env:STM32F103RE_creality_xfer env:STM32F103RC_creality env:STM32F103RC_creality_xfer env:STM32F103RE_creality_maple #elif MB(CREALITY_V24S1_301) #include "stm32f1/pins_CREALITY_V24S1_301.h" // STM32F1 env:STM32F103RE_creality env:STM32F103RE_creality_xfer env:STM32F103RC_creality env:STM32F103RC_creality_xfer env:STM32F103RE_creality_maple +#elif MB(CREALITY_V25S1) + #include "stm32f1/pins_CREALITY_V25S1.h" // STM32F1 env:STM32F103RE_creality_smartPro env:STM32F103RE_creality_smartPro_maple #elif MB(TRIGORILLA_PRO) #include "stm32f1/pins_TRIGORILLA_PRO.h" // STM32F1 env:trigorilla_pro env:trigorilla_pro_maple #elif MB(FLY_MINI) diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1.h index 9d7e0f695b79..0d2ad835d397 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1.h @@ -22,7 +22,7 @@ #pragma once /** - * Creality v2.4.S1 (STM32F103RE / STM32F103RC) v101 as found in the Ender 7 board pin assignments + * Creality v2.4.S1 (STM32F103RE / STM32F103RC) v101 as found in the Ender 7 */ #define BOARD_INFO_NAME "Creality v2.4.S1 V101" diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V25S1.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V25S1.h new file mode 100644 index 000000000000..0425a45d1d25 --- /dev/null +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V25S1.h @@ -0,0 +1,152 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * Creality v2.5.S1 (STM32F103RE / STM32F103RC) as found in the CR-10 Smart Pro + */ + +#include "env_validate.h" + +#if HAS_MULTI_HOTEND || E_STEPPERS > 1 + #error "Creality V2.5.S1 only supports one hotend / E-stepper. Comment out this line to continue." +#endif + +#define BOARD_INFO_NAME "Creality v2.5.S1" +#define DEFAULT_MACHINE_NAME "Creality3D" + +// +// Release PB4 (Y_ENABLE_PIN) from JTAG NRST role +// +#define DISABLE_DEBUG + +// +// EEPROM +// +#if NO_EEPROM_SELECTED + #define IIC_BL24CXX_EEPROM // EEPROM on I2C-0 + //#define SDCARD_EEPROM_EMULATION + //#define FLASH_EEPROM_EMULATION +#endif + +#if ENABLED(IIC_BL24CXX_EEPROM) + #define IIC_EEPROM_SDA PA11 + #define IIC_EEPROM_SCL PA12 + #define MARLIN_EEPROM_SIZE 0x800 // 2K (24C16) +#elif EITHER(SDCARD_EEPROM_EMULATION, FLASH_EEPROM_EMULATION) + #define MARLIN_EEPROM_SIZE 0x800 // 2K +#endif + +// +// Limit Switches +// +#define X_STOP_PIN PC4 +#define Y_STOP_PIN PC5 + +#if ENABLED(BLTOUCH) + #define Z_STOP_PIN -1 + #define SERVO0_PIN PC14 // BLTouch OUT PIN + #ifndef Z_MIN_PROBE_PIN + #define Z_MIN_PROBE_PIN PC15 // BLTouch IN PIN + #endif +#else + #define Z_STOP_PIN PC15 + #if ENABLED(PROBE_ACTIVATION_SWITCH) + #define PROBE_TARE_PIN PC14 + #define PROBE_ACTIVATION_SWITCH_PIN PB2 + #endif +#endif + +// +// Filament Runout Sensor +// +#if ENABLED(FILAMENT_RUNOUT_SENSOR) + #define FIL_RUNOUT_PIN PA15 // "Pulled-high" +#endif + +// +// Steppers +// +#define X_STEP_PIN PB8 +#define X_DIR_PIN PB7 +#define X_ENABLE_PIN PC3 + +#define Y_STEP_PIN PB6 +#define Y_DIR_PIN PB5 +#define Y_ENABLE_PIN X_ENABLE_PIN + +#define Z_STEP_PIN PB4 +#define Z_DIR_PIN PB3 +#define Z_ENABLE_PIN X_ENABLE_PIN + +#define E0_STEP_PIN PC2 +#define E0_DIR_PIN PB9 +#define E0_ENABLE_PIN X_ENABLE_PIN + +// +// Temperature Sensors +// +#define TEMP_0_PIN PB1 // TH1 +#define TEMP_BED_PIN PB0 // TB1 + +// +// Heaters / Fans +// +#define HEATER_0_PIN PB14 // HEATER1 +#define HEATER_BED_PIN PB13 // HOT BED + +#define FAN_PIN PB15 // FAN +#ifndef E0_AUTO_FAN_PIN + #define E0_AUTO_FAN_PIN PC13 // FAN +#endif +#define FAN_SOFT_PWM_REQUIRED + +// +// SD Card +// +#define SD_DETECT_PIN PC7 +#define SDCARD_CONNECTION ONBOARD +#define ON_BOARD_SPI_DEVICE 1 +#define ONBOARD_SD_CS_PIN PC12 // SDSS +#define SDIO_SUPPORT +#define NO_SD_HOST_DRIVE // This board's SD is only seen by the printer + +// +// Misc. Functions +// +#define CASE_LIGHT_PIN PA7 + +// +// Suicide Power +// +#define PS_ON_PIN PA0 +#define MOTOR_CIRCUIT_PIN PA1 + +// +// Motor Protect +// +#define MOTOR_PROTECT_PIN PC0 + +// +// WiFi Reset +// +#define RESET_WIFI_PIN PB12 diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h index b2534beab6db..1b95032b367f 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h @@ -40,6 +40,11 @@ #define BOARD_NO_NATIVE_USB +// +// Release PB4 (Y_ENABLE_PIN) from JTAG NRST role +// +#define DISABLE_DEBUG + // // EEPROM // @@ -122,11 +127,6 @@ #endif #define E0_ENABLE_PIN X_ENABLE_PIN -// -// Release PB4 (Y_ENABLE_PIN) from JTAG NRST role -// -#define DISABLE_DEBUG - // // Temperature Sensors // diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h index 87101ecccd54..1c9a0a8f997f 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h @@ -40,34 +40,24 @@ #define BOARD_NO_NATIVE_USB +// +// Release PB4 (Y_ENABLE_PIN) from JTAG NRST role +// +#define DISABLE_DEBUG + // // EEPROM // #if NO_EEPROM_SELECTED - // FLASH - //#define FLASH_EEPROM_EMULATION - - // I2C - #define IIC_BL24CXX_EEPROM // EEPROM on I2C-0 used only for display settings - #if ENABLED(IIC_BL24CXX_EEPROM) - #define IIC_EEPROM_SDA PA11 - #define IIC_EEPROM_SCL PA12 - #define MARLIN_EEPROM_SIZE 0x800 // 2K (24C16) - #else - #define SDCARD_EEPROM_EMULATION // SD EEPROM until all EEPROM is BL24CXX - #define MARLIN_EEPROM_SIZE 0x800 // 2K - #endif - - // SPI - //#define SPI_EEPROM // EEPROM on SPI-0 - //#define SPI_CHAN_EEPROM1 ? - //#define SPI_EEPROM1_CS_PIN ? - - // 2K EEPROM - //#define SPI_EEPROM2_CS_PIN ? - - // 32Mb FLASH - //#define SPI_FLASH_CS_PIN ? + #define IIC_BL24CXX_EEPROM // EEPROM on I2C-0 +#endif +#if ENABLED(IIC_BL24CXX_EEPROM) + #define IIC_EEPROM_SDA PA11 + #define IIC_EEPROM_SCL PA12 + #define MARLIN_EEPROM_SIZE 0x800 // 2K (24C16) +#else + #define SDCARD_EEPROM_EMULATION // SD EEPROM until all EEPROM is BL24CXX + #define MARLIN_EEPROM_SIZE 0x800 // 2K #endif // @@ -82,7 +72,9 @@ #define Y_STOP_PIN PA7 #define Z_STOP_PIN PA5 -#define Z_MIN_PROBE_PIN PA5 // BLTouch IN +#ifndef Z_MIN_PROBE_PIN + #define Z_MIN_PROBE_PIN PA5 // BLTouch IN +#endif // // Filament Runout Sensor @@ -94,42 +86,37 @@ // // Steppers // -#define X_ENABLE_PIN PC3 #ifndef X_STEP_PIN #define X_STEP_PIN PC2 #endif #ifndef X_DIR_PIN #define X_DIR_PIN PB9 #endif +#define X_ENABLE_PIN PC3 -#define Y_ENABLE_PIN PC3 #ifndef Y_STEP_PIN #define Y_STEP_PIN PB8 #endif #ifndef Y_DIR_PIN #define Y_DIR_PIN PB7 #endif +#define Y_ENABLE_PIN X_ENABLE_PIN -#define Z_ENABLE_PIN PC3 #ifndef Z_STEP_PIN #define Z_STEP_PIN PB6 #endif #ifndef Z_DIR_PIN #define Z_DIR_PIN PB5 #endif +#define Z_ENABLE_PIN X_ENABLE_PIN -#define E0_ENABLE_PIN PC3 #ifndef E0_STEP_PIN #define E0_STEP_PIN PB4 #endif #ifndef E0_DIR_PIN #define E0_DIR_PIN PB3 #endif - -// -// Release PB4 (Y_ENABLE_PIN) from JTAG NRST role -// -#define DISABLE_DEBUG +#define E0_ENABLE_PIN X_ENABLE_PIN // // Temperature Sensors diff --git a/buildroot/share/PlatformIO/ldscripts/crealityPro.ld b/buildroot/share/PlatformIO/ldscripts/crealityPro.ld new file mode 100644 index 000000000000..442c5c75078f --- /dev/null +++ b/buildroot/share/PlatformIO/ldscripts/crealityPro.ld @@ -0,0 +1,14 @@ +MEMORY +{ + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K - 40 + rom (rx) : ORIGIN = 0x08010000, LENGTH = 512K - 64K +} + +/* Provide memory region aliases for common.inc */ +REGION_ALIAS("REGION_TEXT", rom); +REGION_ALIAS("REGION_DATA", ram); +REGION_ALIAS("REGION_BSS", ram); +REGION_ALIAS("REGION_RODATA", rom); + +/* Let common.inc handle the real work. */ +INCLUDE common.inc \ No newline at end of file diff --git a/ini/stm32f1-maple.ini b/ini/stm32f1-maple.ini index 9ea848f1b6b1..f0a0f9375850 100644 --- a/ini/stm32f1-maple.ini +++ b/ini/stm32f1-maple.ini @@ -147,6 +147,14 @@ extra_scripts = ${common_stm32f1.extra_scripts} debug_tool = jlink upload_protocol = jlink +# +# Creality (STM32F103RET6) +# +[env:STM32F103RE_creality_smartPro_maple] +extends = env:STM32F103RE_creality_maple +board_build.address = 0x08010000 +board_build.ldscript = crealityPro.ld + # # BigTree SKR Mini E3 V2.0 & DIP / SKR CR6 (STM32F103RET6 ARM Cortex-M3) # diff --git a/ini/stm32f1.ini b/ini/stm32f1.ini index 9002f81a8143..464048adcb1a 100644 --- a/ini/stm32f1.ini +++ b/ini/stm32f1.ini @@ -153,6 +153,11 @@ board = genericSTM32F103RE extends = STM32F103Rx_creality_xfer board = genericSTM32F103RE +[env:STM32F103RE_creality_smartPro] +extends = STM32F103Rx_creality +board_build.offset = 0x10000 +board_upload.offset_address = 0x08010000 + # # Creality 256K (STM32F103RC) # From d1e9f53cb80e110a980b77e1a352935318d5bc19 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 13 May 2022 00:01:33 +0000 Subject: [PATCH 045/241] [cron] Bump distribution date (2022-05-13) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 65116da8fcd8..5c472c3e4603 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-05-12" +//#define STRING_DISTRIBUTION_DATE "2022-05-13" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 97af839ea286..c94769084f94 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-05-12" + #define STRING_DISTRIBUTION_DATE "2022-05-13" #endif /** From e039d51d183314a1cfb1b2b088e5edfe4af054ea Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 12 May 2022 20:23:32 -0500 Subject: [PATCH 046/241] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20ProUI=20leveling?= =?UTF-8?q?=20start=20message?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/bedlevel/abl/G29.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index f9bdbf5e9f97..0d2abbfb35a7 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -428,7 +428,7 @@ G29_TYPE GcodeSuite::G29() { if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> 3-point Leveling"); points[0].z = points[1].z = points[2].z = 0; // Probe at 3 arbitrary points #elif ENABLED(AUTO_BED_LEVELING_BILINEAR) - TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_LevelingStart()); + TERN_(DWIN_LCD_PROUI, DWIN_LevelingStart()); #endif TERN_(EXTENSIBLE_UI, ExtUI::onLevelingStart()); From 38f4d8abfcc89d188674ec3b809102995efc9436 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 12 May 2022 20:09:25 -0500 Subject: [PATCH 047/241] =?UTF-8?q?=E2=9C=A8=20Add=20BOARD=5FCREALITY=5FV2?= =?UTF-8?q?4S1=5F301F4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Miguel Risco-Castillo --- .github/workflows/test-builds.yml | 1 + Marlin/src/core/boards.h | 1 + Marlin/src/inc/Conditionals_LCD.h | 2 +- Marlin/src/libs/BL24CXX.cpp | 2 +- Marlin/src/pins/pins.h | 2 + Marlin/src/pins/stm32f1/env_validate.h | 8 +- .../pins/stm32f1/pins_CREALITY_V24S1_301.h | 22 +- Marlin/src/pins/stm32f1/pins_CREALITY_V4.h | 4 +- .../pins/stm32f4/pins_CREALITY_V24S1_301F4.h | 38 ++ .../boards/marlin_CREALITY_STM32F401RC.json | 65 +++ .../PeripheralPins.c | 252 +++++++++ .../MARLIN_CREALITY_STM32F401RC/PinNamesVar.h | 33 ++ .../hal_conf_custom.h | 495 ++++++++++++++++++ .../MARLIN_CREALITY_STM32F401RC/ldscript.ld | 187 +++++++ .../MARLIN_CREALITY_STM32F401RC/variant.cpp | 238 +++++++++ .../MARLIN_CREALITY_STM32F401RC/variant.h | 151 ++++++ buildroot/tests/STM32F103RE_creality | 6 - buildroot/tests/STM32F401RC_creality | 20 + ini/stm32f4.ini | 29 +- 19 files changed, 1537 insertions(+), 19 deletions(-) create mode 100644 Marlin/src/pins/stm32f4/pins_CREALITY_V24S1_301F4.h create mode 100644 buildroot/share/PlatformIO/boards/marlin_CREALITY_STM32F401RC.json create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/PeripheralPins.c create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/PinNamesVar.h create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/hal_conf_custom.h create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/ldscript.ld create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/variant.cpp create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/variant.h create mode 100755 buildroot/tests/STM32F401RC_creality diff --git a/.github/workflows/test-builds.yml b/.github/workflows/test-builds.yml index 069f36714d93..e339f856462e 100644 --- a/.github/workflows/test-builds.yml +++ b/.github/workflows/test-builds.yml @@ -76,6 +76,7 @@ jobs: - STM32F103RE_btt - STM32F103RE_btt_USB - STM32F103RE_creality + - STM32F401RC_creality - STM32F103VE_longer - STM32F407VE_black - STM32F401VE_STEVAL diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index ec85970ac411..653bbf1e173e 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -418,6 +418,7 @@ #define BOARD_MKS_EAGLE 4237 // MKS Eagle (STM32F407VE) #define BOARD_ARTILLERY_RUBY 4238 // Artillery Ruby (STM32F401RC) #define BOARD_FYSETC_SPIDER_V2_2 4239 // FYSETC Spider V2.2 (STM32F446VE) +#define BOARD_CREALITY_V24S1_301F4 4240 // Creality v2.4.S1_301F4 (STM32F401RC) as found in the Ender-3 S1 F4 // // ARM Cortex M7 diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 5fd0081165e1..0ce092ef2fa8 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -488,7 +488,7 @@ #ifndef LCD_SERIAL_PORT #if MB(BTT_SKR_MINI_E3_V1_0, BTT_SKR_MINI_E3_V1_2, BTT_SKR_MINI_E3_V2_0, BTT_SKR_MINI_E3_V3_0, BTT_SKR_E3_TURBO) #define LCD_SERIAL_PORT 1 - #elif MB(CREALITY_V24S1_301) + #elif MB(CREALITY_V24S1_301, CREALITY_V24S1_301F4) #define LCD_SERIAL_PORT 2 // Creality Ender3S1 board #else #define LCD_SERIAL_PORT 3 // Creality 4.x board diff --git a/Marlin/src/libs/BL24CXX.cpp b/Marlin/src/libs/BL24CXX.cpp index 6407fac67086..59352d4380c1 100644 --- a/Marlin/src/libs/BL24CXX.cpp +++ b/Marlin/src/libs/BL24CXX.cpp @@ -48,7 +48,7 @@ #ifdef __STM32F1__ #define SDA_IN() do{ PIN_MAP[IIC_EEPROM_SDA].gpio_device->regs->CRH &= 0XFFFF0FFF; PIN_MAP[IIC_EEPROM_SDA].gpio_device->regs->CRH |= 8 << 12; }while(0) #define SDA_OUT() do{ PIN_MAP[IIC_EEPROM_SDA].gpio_device->regs->CRH &= 0XFFFF0FFF; PIN_MAP[IIC_EEPROM_SDA].gpio_device->regs->CRH |= 3 << 12; }while(0) -#elif STM32F1 +#elif defined(STM32F1) || defined(STM32F4) #define SDA_IN() SET_INPUT(IIC_EEPROM_SDA) #define SDA_OUT() SET_OUTPUT(IIC_EEPROM_SDA) #endif diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index aecf17284ac5..5db9f71d10c0 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -695,6 +695,8 @@ #include "stm32f4/pins_MKS_EAGLE.h" // STM32F4 env:mks_eagle #elif MB(ARTILLERY_RUBY) #include "stm32f4/pins_ARTILLERY_RUBY.h" // STM32F4 env:Artillery_Ruby +#elif MB(CREALITY_V24S1_301F4) + #include "stm32f4/pins_CREALITY_V24S1_301F4.h" // STM32F4 env:STM32F401RC_creality env:STM32F401RC_creality_jlink env:STM32F401RC_creality_stlink // // ARM Cortex M7 diff --git a/Marlin/src/pins/stm32f1/env_validate.h b/Marlin/src/pins/stm32f1/env_validate.h index 2e7b78517215..2d325428ac8c 100644 --- a/Marlin/src/pins/stm32f1/env_validate.h +++ b/Marlin/src/pins/stm32f1/env_validate.h @@ -22,5 +22,11 @@ #pragma once #if NOT_TARGET(__STM32F1__, STM32F1) - #error "Oops! Select an STM32F1 board in 'Tools > Board.'" + #if DISABLED(ALLOW_STM32F4) + #error "Oops! Select an STM32F1 board in 'Tools > Board.'" + #elif NOT_TARGET(STM32F4) + #error "Oops! Select an STM32F4 board in 'Tools > Board.'" + #endif #endif + +#undef ALLOW_STM32F4 diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h index fb7198e57c21..66ee8af61b6a 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h @@ -22,7 +22,8 @@ #pragma once /** - * Creality V24S1_301 (STM32F103RE / STM32F103RC) board pin assignments as found on Ender 3 S1 + * Creality V24S1_301 (STM32F103RE / STM32F103RC) board pin assignments as found on Ender 3 S1. + * Also supports the STM32F4 version of the board with identical pin mapping. */ #include "env_validate.h" @@ -35,8 +36,12 @@ #error "Disable Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN when using BLTOUCH with Creality V24S1-301." #endif -#define BOARD_INFO_NAME "Creality V24S1-301" -#define DEFAULT_MACHINE_NAME "Ender 3 S1" +#ifndef BOARD_INFO_NAME + #define BOARD_INFO_NAME "Creality V24S1-301" +#endif +#ifndef DEFAULT_MACHINE_NAME + #define DEFAULT_MACHINE_NAME "Ender 3 S1" +#endif // // Servos @@ -70,8 +75,8 @@ // // SD Card // -#define ONBOARD_SPI_DEVICE 1 -#define ONBOARD_SD_CS_PIN PA4 // SDSS +#define ONBOARD_SPI_DEVICE 1 +#define ONBOARD_SD_CS_PIN PA4 // SDSS // // M3/M4/M5 - Spindle/Laser Control @@ -80,9 +85,10 @@ //#define HEATER_0_PIN -1 //#define HEATER_BED_PIN -1 #define FAN_PIN -1 - #define SPINDLE_LASER_ENA_PIN PA0 // FET 1 - #define SPINDLE_LASER_PWM_PIN PA0 // Bed FET - #define SPINDLE_DIR_PIN PA0 // FET 4 + #define SPINDLE_LASER_ENA_PIN PC0 // FET 1 + #define SPINDLE_LASER_PWM_PIN PC0 // Bed FET + #define SPINDLE_DIR_PIN PC0 // FET 4 + #define LASER_SOFT_PWM_PIN PC0 #endif #include "pins_CREALITY_V4.h" diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h index 1b95032b367f..5552d19ab926 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h @@ -43,7 +43,9 @@ // // Release PB4 (Y_ENABLE_PIN) from JTAG NRST role // -#define DISABLE_DEBUG +#ifndef DISABLE_DEBUG + #define DISABLE_DEBUG +#endif // // EEPROM diff --git a/Marlin/src/pins/stm32f4/pins_CREALITY_V24S1_301F4.h b/Marlin/src/pins/stm32f4/pins_CREALITY_V24S1_301F4.h new file mode 100644 index 000000000000..883640d5772e --- /dev/null +++ b/Marlin/src/pins/stm32f4/pins_CREALITY_V24S1_301F4.h @@ -0,0 +1,38 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * Creality V24S1_301F4 (STM32F401RC) board pin assignments as found on Ender 3 S1. + */ + +#ifndef BOARD_INFO_NAME + #define BOARD_INFO_NAME "Creality V24S1-301F4" +#endif +#ifndef DEFAULT_MACHINE_NAME + #define DEFAULT_MACHINE_NAME "Ender-3 S1 F4" +#endif + +#define DISABLE_DEBUG false // DISABLE_(DEBUG|JTAG) is not supported for STM32F4. +#define ALLOW_STM32F4 + +#include "../stm32f1/pins_CREALITY_V24S1_301.h" diff --git a/buildroot/share/PlatformIO/boards/marlin_CREALITY_STM32F401RC.json b/buildroot/share/PlatformIO/boards/marlin_CREALITY_STM32F401RC.json new file mode 100644 index 000000000000..82f49fa815d6 --- /dev/null +++ b/buildroot/share/PlatformIO/boards/marlin_CREALITY_STM32F401RC.json @@ -0,0 +1,65 @@ +{ + "build": { + "core": "stm32", + "cpu": "cortex-m4", + "extra_flags": "-DSTM32F401xx", + "f_cpu": "84000000L", + "hwids": [ + [ + "0x1EAF", + "0x0003" + ], + [ + "0x0483", + "0x3748" + ] + ], + "ldscript": "ldscript.ld", + "mcu": "stm32f401rct6", + "variant": "MARLIN_CREALITY_STM32F401RC" + }, + "debug": { + "jlink_device": "STM32F401RC", + "openocd_target": "stm32f4x", + "svd_path": "STM32F40x.svd", + "tools": { + "stlink": { + "server": { + "arguments": [ + "-f", + "scripts/interface/stlink.cfg", + "-c", + "transport select hla_swd", + "-f", + "scripts/target/stm32f4x.cfg", + "-c", + "reset_config none" + ], + "executable": "bin/openocd", + "package": "tool-openocd" + } + } + } + }, + "frameworks": [ + "arduino", + "stm32cube" + ], + "name": "STM32F401RC (64k RAM. 256k Flash)", + "upload": { + "disable_flushing": false, + "maximum_ram_size": 65536, + "maximum_size": 262144, + "protocol": "stlink", + "protocols": [ + "stlink", + "dfu", + "jlink" + ], + "require_upload_port": true, + "use_1200bps_touch": false, + "wait_for_upload_port": false + }, + "url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f401rc.html", + "vendor": "Generic" +} diff --git a/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/PeripheralPins.c b/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/PeripheralPins.c new file mode 100644 index 000000000000..418ef5aa7abc --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/PeripheralPins.c @@ -0,0 +1,252 @@ +/* + ******************************************************************************* + * Copyright (c) 2019, STMicroelectronics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************* + * Automatically generated from STM32F401R[(B-C)|(D-E)]Tx.xml + */ +#include "Arduino.h" +#include "PeripheralPins.h" + +/* ===== + * Note: Commented lines are alternative possibilities which are not used per default. + * If you change them, you will have to know what you do + * ===== + */ + +//*** ADC *** + +#ifdef HAL_ADC_MODULE_ENABLED +WEAK const PinMap PinMap_ADC[] = { + {PA_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC1_IN0 + {PA_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC1_IN1 + {PA_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_IN2 + {PA_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_IN3 + {PA_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_IN4 + {PA_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC1_IN5 + {PA_6, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC1_IN6 + {PA_7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC1_IN7 + {PB_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_IN8 + {PB_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_IN9 + {PC_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_IN10 + {PC_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC1_IN11 + {PC_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC1_IN12 + {PC_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC1_IN13 + {PC_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC1_IN14 + {PC_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC1_IN15 + {NC, NP, 0} +}; +#endif + +//*** No DAC *** + +//*** I2C *** + +#ifdef HAL_I2C_MODULE_ENABLED +WEAK const PinMap PinMap_I2C_SDA[] = { + {PB_3, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF9_I2C2)}, + {PB_4, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF9_I2C3)}, + {PB_7, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_9, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PC_9, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, + {NC, NP, 0} +}; + +WEAK const PinMap PinMap_I2C_SCL[] = { + {PA_8, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, + {PB_6, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_8, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_10, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + {NC, NP, 0} +}; +#endif + +//*** PWM *** + +#ifdef HAL_TIM_MODULE_ENABLED +WEAK const PinMap PinMap_PWM[] = { + //{PA_0, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + {PA_0, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 1, 0)}, // TIM5_CH1 + //{PA_1, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 + {PA_1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)}, // TIM5_CH2 + //{PA_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 + {PA_2, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 3, 0)}, // TIM5_CH3 + //{PA_2, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 1, 0)}, // TIM9_CH1 + //{PA_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 + {PA_3, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 4, 0)}, // TIM5_CH4 + //{PA_3, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 2, 0)}, // TIM9_CH2 + {PA_5, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + {PA_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + //{PA_7, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N + {PA_7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + {PA_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1 + {PA_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2 + {PA_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3 + {PA_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4 + {PA_15, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + //{PB_0, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + {PB_0, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 + //{PB_1, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + {PB_1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 + {PB_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 + {PB_4, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + {PB_5, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + {PB_6, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1 + {PB_7, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2 + {PB_8, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3 + //{PB_8, TIM10, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM10, 1, 0)}, // TIM10_CH1 + {PB_9, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4 + //{PB_9, TIM11, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM11, 1, 0)}, // TIM11_CH1 + {PB_10, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 + {PB_13, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N + {PB_14, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + {PB_15, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + {PC_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + {PC_7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + {PC_8, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 + {PC_9, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 + {NC, NP, 0} +}; +#endif + +//*** SERIAL *** + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_TX[] = { + {PA_2, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_9, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PA_11, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + {PB_6, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PC_6, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + {NC, NP, 0} +}; + +WEAK const PinMap PinMap_UART_RX[] = { + {PA_3, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_10, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PA_12, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + {PB_7, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PC_7, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + {NC, NP, 0} +}; + +WEAK const PinMap PinMap_UART_RTS[] = { + {PA_1, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_12, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {NC, NP, 0} +}; + +WEAK const PinMap PinMap_UART_CTS[] = { + {PA_0, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_11, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {NC, NP, 0} +}; +#endif + +//*** SPI *** + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK const PinMap PinMap_SPI_MOSI[] = { + {PA_7, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + //{PB_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_5, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PB_15, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_3, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_12, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {NC, NP, 0} +}; + +WEAK const PinMap PinMap_SPI_MISO[] = { + {PA_6, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + //{PB_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_4, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PB_14, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_2, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_11, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {NC, NP, 0} +}; + +WEAK const PinMap PinMap_SPI_SCLK[] = { + {PA_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + //{PB_3, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_3, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PB_10, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PB_13, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_10, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {NC, NP, 0} +}; + +WEAK const PinMap PinMap_SPI_SSEL[] = { + {PA_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + //{PA_4, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + //{PA_15, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PA_15, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PB_9, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PB_12, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {NC, NP, 0} +}; +#endif + +//*** No CAN *** + +//*** No ETHERNET *** + +//*** No QUADSPI *** + +//*** USB *** + +#ifdef HAL_PCD_MODULE_ENABLED +WEAK const PinMap PinMap_USB_OTG_FS[] = { +#ifndef ARDUINO_CoreBoard_F401RC + {PA_8, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_SOF + {PA_9, USB_OTG_FS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, GPIO_AF_NONE)}, // USB_OTG_FS_VBUS + {PA_10, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_ID +#endif + {PA_11, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_DM + {PA_12, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_DP + {NC, NP, 0} +}; +#endif + +//*** No USB_OTG_HS *** + +//*** SD *** + +#ifdef HAL_SD_MODULE_ENABLED +WEAK const PinMap PinMap_SD[] = { + {PB_8, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D4 + {PB_9, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D5 + {PC_6, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D6 + {PC_7, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D7 + {PC_8, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D0 + {PC_9, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D1 + {PC_10, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D2 + {PC_11, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D3 + {PC_12, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDIO)}, // SDIO_CK + {PD_2, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDIO)}, // SDIO_CMD + {NC, NP, 0} +}; +#endif diff --git a/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/PinNamesVar.h b/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/PinNamesVar.h new file mode 100644 index 000000000000..e1536bcf30f4 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/PinNamesVar.h @@ -0,0 +1,33 @@ +/* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = NC, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = NC, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = NC, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = NC, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif +/* USB */ +#ifdef USBCON + USB_OTG_FS_SOF = PA_8, + USB_OTG_FS_VBUS = PA_9, + USB_OTG_FS_ID = PA_10, + USB_OTG_FS_DM = PA_11, + USB_OTG_FS_DP = PA_12, +#endif \ No newline at end of file diff --git a/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/hal_conf_custom.h b/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/hal_conf_custom.h new file mode 100644 index 000000000000..1dd047bb9005 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/hal_conf_custom.h @@ -0,0 +1,495 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_conf.h + * @brief HAL configuration file. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __STM32F4xx_HAL_CONF_CUSTOM +#define __STM32F4xx_HAL_CONF_CUSTOM + +#ifdef __cplusplus +extern "C" { +#endif + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/* ########################## Module Selection ############################## */ + /** + * @brief This is the list of modules to be used in the HAL driver + */ +#define HAL_MODULE_ENABLED +#define HAL_ADC_MODULE_ENABLED +#define HAL_CRC_MODULE_ENABLED +#define HAL_DMA_MODULE_ENABLED +#define HAL_FLASH_MODULE_ENABLED +#define HAL_GPIO_MODULE_ENABLED +#define HAL_I2C_MODULE_ENABLED +#define HAL_IWDG_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED +#define HAL_RCC_MODULE_ENABLED +#define HAL_RTC_MODULE_ENABLED +#define HAL_SPI_MODULE_ENABLED +#define HAL_TIM_MODULE_ENABLED +#define HAL_CORTEX_MODULE_ENABLED +//#define HAL_PCD_MODULE_ENABLED // Automatically added if any type of USB is enabled, as in Arduino IDE. (STM32 v3.10700.191028) + +//#define HAL_CAN_MODULE_ENABLED +//#define HAL_CAN_LEGACY_MODULE_ENABLED +//#define HAL_CEC_MODULE_ENABLED +//#define HAL_CRYP_MODULE_ENABLED +//#define HAL_DAC_MODULE_ENABLED +//#define HAL_DCMI_MODULE_ENABLED +//#define HAL_DMA2D_MODULE_ENABLED +//#define HAL_ETH_MODULE_ENABLED +//#define HAL_NAND_MODULE_ENABLED +//#define HAL_NOR_MODULE_ENABLED +//#define HAL_PCCARD_MODULE_ENABLED +//#define HAL_SRAM_MODULE_ENABLED +//#define HAL_SDRAM_MODULE_ENABLED +//#define HAL_HASH_MODULE_ENABLED +//#define HAL_EXTI_MODULE_ENABLED +//#define HAL_SMBUS_MODULE_ENABLED +//#define HAL_I2S_MODULE_ENABLED +//#define HAL_LTDC_MODULE_ENABLED +//#define HAL_DSI_MODULE_ENABLED +//#define HAL_QSPI_MODULE_ENABLED +//#define HAL_RNG_MODULE_ENABLED +//#define HAL_SAI_MODULE_ENABLED +#define HAL_SD_MODULE_ENABLED +//#define HAL_UART_MODULE_ENABLED +//#define HAL_USART_MODULE_ENABLED +//#define HAL_IRDA_MODULE_ENABLED +//#define HAL_SMARTCARD_MODULE_ENABLED +//#define HAL_WWDG_MODULE_ENABLED +//#define HAL_HCD_MODULE_ENABLED +//#define HAL_FMPI2C_MODULE_ENABLED +//#define HAL_SPDIFRX_MODULE_ENABLED +//#define HAL_DFSDM_MODULE_ENABLED +//#define HAL_LPTIM_MODULE_ENABLED +//#define HAL_MMC_MODULE_ENABLED + +/* ########################## HSE/HSI Values adaptation ##################### */ +/** + * @brief Adjust the value of External High Speed oscillator (HSE) used in your application. + * This value is used by the RCC HAL module to compute the system frequency + * (when HSE is used as system clock source, directly or through the PLL). + */ +#ifndef HSE_VALUE +#define HSE_VALUE 8000000U /*!< Value of the External oscillator in Hz */ +#endif /* HSE_VALUE */ + +#ifndef HSE_STARTUP_TIMEOUT +#define HSE_STARTUP_TIMEOUT 100U /*!< Time out for HSE start up, in ms */ +#endif /* HSE_STARTUP_TIMEOUT */ + +/** + * @brief Internal High Speed oscillator (HSI) value. + * This value is used by the RCC HAL module to compute the system frequency + * (when HSI is used as system clock source, directly or through the PLL). + */ +#ifndef HSI_VALUE +#define HSI_VALUE 16000000U /*!< Value of the Internal oscillator in Hz */ +#endif /* HSI_VALUE */ + +/** + * @brief Internal Low Speed oscillator (LSI) value. + */ +#ifndef LSI_VALUE +#define LSI_VALUE 32000U /*!< LSI Typical Value in Hz */ +#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz +The real value may vary depending on the variations +in voltage and temperature. */ +/** + * @brief External Low Speed oscillator (LSE) value. + */ +#ifndef LSE_VALUE +#define LSE_VALUE 32768U /*!< Value of the External Low Speed oscillator in Hz */ +#endif /* LSE_VALUE */ + +#ifndef LSE_STARTUP_TIMEOUT +#define LSE_STARTUP_TIMEOUT 5000U /*!< Time out for LSE start up, in ms */ +#endif /* LSE_STARTUP_TIMEOUT */ + +/** + * @brief External clock source for I2S peripheral + * This value is used by the I2S HAL module to compute the I2S clock source + * frequency, this source is inserted directly through I2S_CKIN pad. + */ +#ifndef EXTERNAL_CLOCK_VALUE +#define EXTERNAL_CLOCK_VALUE 12288000U /*!< Value of the External oscillator in Hz*/ +#endif /* EXTERNAL_CLOCK_VALUE */ + +/* Tip: To avoid modifying this file each time you need to use different HSE, + === you can define the HSE value in your toolchain compiler preprocessor. */ + +/* ########################### System Configuration ######################### */ +/** + * @brief This is the HAL system configuration section + */ +#if !defined (VDD_VALUE) +#define VDD_VALUE 3300U /*!< Value of VDD in mv */ +#endif +#if !defined (TICK_INT_PRIORITY) +#define TICK_INT_PRIORITY 0x00U /*!< tick interrupt priority */ +#endif +#if !defined (USE_RTOS) +#define USE_RTOS 0U +#endif +#if !defined (PREFETCH_ENABLE) +#define PREFETCH_ENABLE 1U +#endif +#if !defined (INSTRUCTION_CACHE_ENABLE) +#define INSTRUCTION_CACHE_ENABLE 1U +#endif +#if !defined (DATA_CACHE_ENABLE) +#define DATA_CACHE_ENABLE 1U +#endif + +#define USE_HAL_ADC_REGISTER_CALLBACKS 0U /* ADC register callback disabled */ +#define USE_HAL_CAN_REGISTER_CALLBACKS 0U /* CAN register callback disabled */ +#define USE_HAL_CEC_REGISTER_CALLBACKS 0U /* CEC register callback disabled */ +#define USE_HAL_CRYP_REGISTER_CALLBACKS 0U /* CRYP register callback disabled */ +#define USE_HAL_DAC_REGISTER_CALLBACKS 0U /* DAC register callback disabled */ +#define USE_HAL_DCMI_REGISTER_CALLBACKS 0U /* DCMI register callback disabled */ +#define USE_HAL_DFSDM_REGISTER_CALLBACKS 0U /* DFSDM register callback disabled */ +#define USE_HAL_DMA2D_REGISTER_CALLBACKS 0U /* DMA2D register callback disabled */ +#define USE_HAL_DSI_REGISTER_CALLBACKS 0U /* DSI register callback disabled */ +#define USE_HAL_ETH_REGISTER_CALLBACKS 0U /* ETH register callback disabled */ +#define USE_HAL_HASH_REGISTER_CALLBACKS 0U /* HASH register callback disabled */ +#define USE_HAL_HCD_REGISTER_CALLBACKS 0U /* HCD register callback disabled */ +#define USE_HAL_I2C_REGISTER_CALLBACKS 0U /* I2C register callback disabled */ +#define USE_HAL_FMPI2C_REGISTER_CALLBACKS 0U /* FMPI2C register callback disabled */ +#define USE_HAL_I2S_REGISTER_CALLBACKS 0U /* I2S register callback disabled */ +#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U /* IRDA register callback disabled */ +#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0U /* LPTIM register callback disabled */ +#define USE_HAL_LTDC_REGISTER_CALLBACKS 0U /* LTDC register callback disabled */ +#define USE_HAL_MMC_REGISTER_CALLBACKS 0U /* MMC register callback disabled */ +#define USE_HAL_NAND_REGISTER_CALLBACKS 0U /* NAND register callback disabled */ +#define USE_HAL_NOR_REGISTER_CALLBACKS 0U /* NOR register callback disabled */ +#define USE_HAL_PCCARD_REGISTER_CALLBACKS 0U /* PCCARD register callback disabled */ +#define USE_HAL_PCD_REGISTER_CALLBACKS 0U /* PCD register callback disabled */ +#define USE_HAL_QSPI_REGISTER_CALLBACKS 0U /* QSPI register callback disabled */ +#define USE_HAL_RNG_REGISTER_CALLBACKS 0U /* RNG register callback disabled */ +#define USE_HAL_RTC_REGISTER_CALLBACKS 0U /* RTC register callback disabled */ +#define USE_HAL_SAI_REGISTER_CALLBACKS 0U /* SAI register callback disabled */ +#define USE_HAL_SD_REGISTER_CALLBACKS 0U /* SD register callback disabled */ +#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U /* SMARTCARD register callback disabled */ +#define USE_HAL_SDRAM_REGISTER_CALLBACKS 0U /* SDRAM register callback disabled */ +#define USE_HAL_SRAM_REGISTER_CALLBACKS 0U /* SRAM register callback disabled */ +#define USE_HAL_SPDIFRX_REGISTER_CALLBACKS 0U /* SPDIFRX register callback disabled */ +#define USE_HAL_SMBUS_REGISTER_CALLBACKS 0U /* SMBUS register callback disabled */ +#define USE_HAL_SPI_REGISTER_CALLBACKS 0U /* SPI register callback disabled */ +#define USE_HAL_TIM_REGISTER_CALLBACKS 0U /* TIM register callback disabled */ +#define USE_HAL_UART_REGISTER_CALLBACKS 0U /* UART register callback disabled */ +#define USE_HAL_USART_REGISTER_CALLBACKS 0U /* USART register callback disabled */ +#define USE_HAL_WWDG_REGISTER_CALLBACKS 0U /* WWDG register callback disabled */ + +/* ########################## Assert Selection ############################## */ +/** + * @brief Uncomment the line below to expanse the "assert_param" macro in the + * HAL drivers code + */ +/* #define USE_FULL_ASSERT 1U */ + +/* ################## Ethernet peripheral configuration ##################### */ + +/* Section 1 : Ethernet peripheral configuration */ + +/* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */ +#define MAC_ADDR0 2U +#define MAC_ADDR1 0U +#define MAC_ADDR2 0U +#define MAC_ADDR3 0U +#define MAC_ADDR4 0U +#define MAC_ADDR5 0U + +/* Definition of the Ethernet driver buffers size and count */ +#define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */ +#define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */ +#define ETH_RXBUFNB ((uint32_t)4U) /* 4 Rx buffers of size ETH_RX_BUF_SIZE */ +#define ETH_TXBUFNB ((uint32_t)4U) /* 4 Tx buffers of size ETH_TX_BUF_SIZE */ + +/* Section 2: PHY configuration section */ + +/* DP83848_PHY_ADDRESS Address*/ +#define DP83848_PHY_ADDRESS 0x01U +/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/ +#define PHY_RESET_DELAY 0x000000FFU +/* PHY Configuration delay */ +#define PHY_CONFIG_DELAY 0x00000FFFU + +#define PHY_READ_TO 0x0000FFFFU +#define PHY_WRITE_TO 0x0000FFFFU + +/* Section 3: Common PHY Registers */ + +#define PHY_BCR ((uint16_t)0x0000) /*!< Transceiver Basic Control Register */ +#define PHY_BSR ((uint16_t)0x0001) /*!< Transceiver Basic Status Register */ + +#define PHY_RESET ((uint16_t)0x8000) /*!< PHY Reset */ +#define PHY_LOOPBACK ((uint16_t)0x4000) /*!< Select loop-back mode */ +#define PHY_FULLDUPLEX_100M ((uint16_t)0x2100) /*!< Set the full-duplex mode at 100 Mb/s */ +#define PHY_HALFDUPLEX_100M ((uint16_t)0x2000) /*!< Set the half-duplex mode at 100 Mb/s */ +#define PHY_FULLDUPLEX_10M ((uint16_t)0x0100) /*!< Set the full-duplex mode at 10 Mb/s */ +#define PHY_HALFDUPLEX_10M ((uint16_t)0x0000) /*!< Set the half-duplex mode at 10 Mb/s */ +#define PHY_AUTONEGOTIATION ((uint16_t)0x1000) /*!< Enable auto-negotiation function */ +#define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200) /*!< Restart auto-negotiation function */ +#define PHY_POWERDOWN ((uint16_t)0x0800) /*!< Select the power down mode */ +#define PHY_ISOLATE ((uint16_t)0x0400) /*!< Isolate PHY from MII */ + +#define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020) /*!< Auto-Negotiation process completed */ +#define PHY_LINKED_STATUS ((uint16_t)0x0004) /*!< Valid link established */ +#define PHY_JABBER_DETECTION ((uint16_t)0x0002) /*!< Jabber condition detected */ + +/* Section 4: Extended PHY Registers */ +#define PHY_SR ((uint16_t)0x10U) /*!< PHY status register Offset */ + +#define PHY_SPEED_STATUS ((uint16_t)0x0002U) /*!< PHY Speed mask */ +#define PHY_DUPLEX_STATUS ((uint16_t)0x0004U) /*!< PHY Duplex mask */ + +/* ################## SPI peripheral configuration ########################## */ + +/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver + * Activated: CRC code is present inside driver + * Deactivated: CRC code cleaned from driver + */ +#ifndef USE_SPI_CRC +#define USE_SPI_CRC 0U +#endif + +/* Includes ------------------------------------------------------------------*/ +/** + * @brief Include module's header file + */ + +#ifdef HAL_RCC_MODULE_ENABLED +#include "stm32f4xx_hal_rcc.h" +#endif /* HAL_RCC_MODULE_ENABLED */ + +#ifdef HAL_GPIO_MODULE_ENABLED +#include "stm32f4xx_hal_gpio.h" +#endif /* HAL_GPIO_MODULE_ENABLED */ + +#ifdef HAL_EXTI_MODULE_ENABLED +#include "stm32f4xx_hal_exti.h" +#endif /* HAL_EXTI_MODULE_ENABLED */ + +#ifdef HAL_DMA_MODULE_ENABLED +#include "stm32f4xx_hal_dma.h" +#endif /* HAL_DMA_MODULE_ENABLED */ + +#ifdef HAL_CORTEX_MODULE_ENABLED +#include "stm32f4xx_hal_cortex.h" +#endif /* HAL_CORTEX_MODULE_ENABLED */ + +#ifdef HAL_ADC_MODULE_ENABLED +#include "stm32f4xx_hal_adc.h" +#endif /* HAL_ADC_MODULE_ENABLED */ + +#ifdef HAL_CAN_MODULE_ENABLED +#include "stm32f4xx_hal_can.h" +#endif /* HAL_CAN_MODULE_ENABLED */ + +#ifdef HAL_CAN_LEGACY_MODULE_ENABLED +#include "stm32f4xx_hal_can_legacy.h" +#endif /* HAL_CAN_LEGACY_MODULE_ENABLED */ + +#ifdef HAL_CRC_MODULE_ENABLED +#include "stm32f4xx_hal_crc.h" +#endif /* HAL_CRC_MODULE_ENABLED */ + +#ifdef HAL_CRYP_MODULE_ENABLED +#include "stm32f4xx_hal_cryp.h" +#endif /* HAL_CRYP_MODULE_ENABLED */ + +#ifdef HAL_DMA2D_MODULE_ENABLED +#include "stm32f4xx_hal_dma2d.h" +#endif /* HAL_DMA2D_MODULE_ENABLED */ + +#ifdef HAL_DAC_MODULE_ENABLED +#include "stm32f4xx_hal_dac.h" +#endif /* HAL_DAC_MODULE_ENABLED */ + +#ifdef HAL_DCMI_MODULE_ENABLED +#include "stm32f4xx_hal_dcmi.h" +#endif /* HAL_DCMI_MODULE_ENABLED */ + +#ifdef HAL_ETH_MODULE_ENABLED +#include "stm32f4xx_hal_eth.h" +#endif /* HAL_ETH_MODULE_ENABLED */ + +#ifdef HAL_FLASH_MODULE_ENABLED +#include "stm32f4xx_hal_flash.h" +#endif /* HAL_FLASH_MODULE_ENABLED */ + +#ifdef HAL_SRAM_MODULE_ENABLED +#include "stm32f4xx_hal_sram.h" +#endif /* HAL_SRAM_MODULE_ENABLED */ + +#ifdef HAL_NOR_MODULE_ENABLED +#include "stm32f4xx_hal_nor.h" +#endif /* HAL_NOR_MODULE_ENABLED */ + +#ifdef HAL_NAND_MODULE_ENABLED +#include "stm32f4xx_hal_nand.h" +#endif /* HAL_NAND_MODULE_ENABLED */ + +#ifdef HAL_PCCARD_MODULE_ENABLED +#include "stm32f4xx_hal_pccard.h" +#endif /* HAL_PCCARD_MODULE_ENABLED */ + +#ifdef HAL_SDRAM_MODULE_ENABLED +#include "stm32f4xx_hal_sdram.h" +#endif /* HAL_SDRAM_MODULE_ENABLED */ + +#ifdef HAL_HASH_MODULE_ENABLED +#include "stm32f4xx_hal_hash.h" +#endif /* HAL_HASH_MODULE_ENABLED */ + +#ifdef HAL_I2C_MODULE_ENABLED +#include "stm32f4xx_hal_i2c.h" +#endif /* HAL_I2C_MODULE_ENABLED */ + +#ifdef HAL_SMBUS_MODULE_ENABLED +#include "stm32f4xx_hal_smbus.h" +#endif /* HAL_SMBUS_MODULE_ENABLED */ + +#ifdef HAL_I2S_MODULE_ENABLED +#include "stm32f4xx_hal_i2s.h" +#endif /* HAL_I2S_MODULE_ENABLED */ + +#ifdef HAL_IWDG_MODULE_ENABLED +#include "stm32f4xx_hal_iwdg.h" +#endif /* HAL_IWDG_MODULE_ENABLED */ + +#ifdef HAL_LTDC_MODULE_ENABLED +#include "stm32f4xx_hal_ltdc.h" +#endif /* HAL_LTDC_MODULE_ENABLED */ + +#ifdef HAL_PWR_MODULE_ENABLED +#include "stm32f4xx_hal_pwr.h" +#endif /* HAL_PWR_MODULE_ENABLED */ + +#ifdef HAL_RNG_MODULE_ENABLED +#include "stm32f4xx_hal_rng.h" +#endif /* HAL_RNG_MODULE_ENABLED */ + +#ifdef HAL_RTC_MODULE_ENABLED +#include "stm32f4xx_hal_rtc.h" +#endif /* HAL_RTC_MODULE_ENABLED */ + +#ifdef HAL_SAI_MODULE_ENABLED +#include "stm32f4xx_hal_sai.h" +#endif /* HAL_SAI_MODULE_ENABLED */ + +#ifdef HAL_SD_MODULE_ENABLED +#include "stm32f4xx_hal_sd.h" +#endif /* HAL_SD_MODULE_ENABLED */ + +#ifdef HAL_SPI_MODULE_ENABLED +#include "stm32f4xx_hal_spi.h" +#endif /* HAL_SPI_MODULE_ENABLED */ + +#ifdef HAL_TIM_MODULE_ENABLED +#include "stm32f4xx_hal_tim.h" +#endif /* HAL_TIM_MODULE_ENABLED */ + +#ifdef HAL_UART_MODULE_ENABLED +#include "stm32f4xx_hal_uart.h" +#endif /* HAL_UART_MODULE_ENABLED */ + +#ifdef HAL_USART_MODULE_ENABLED +#include "stm32f4xx_hal_usart.h" +#endif /* HAL_USART_MODULE_ENABLED */ + +#ifdef HAL_IRDA_MODULE_ENABLED +#include "stm32f4xx_hal_irda.h" +#endif /* HAL_IRDA_MODULE_ENABLED */ + +#ifdef HAL_SMARTCARD_MODULE_ENABLED +#include "stm32f4xx_hal_smartcard.h" +#endif /* HAL_SMARTCARD_MODULE_ENABLED */ + +#ifdef HAL_WWDG_MODULE_ENABLED +#include "stm32f4xx_hal_wwdg.h" +#endif /* HAL_WWDG_MODULE_ENABLED */ + +#ifdef HAL_PCD_MODULE_ENABLED +#include "stm32f4xx_hal_pcd.h" +#endif /* HAL_PCD_MODULE_ENABLED */ + +#ifdef HAL_HCD_MODULE_ENABLED +#include "stm32f4xx_hal_hcd.h" +#endif /* HAL_HCD_MODULE_ENABLED */ + +#ifdef HAL_DSI_MODULE_ENABLED +#include "stm32f4xx_hal_dsi.h" +#endif /* HAL_DSI_MODULE_ENABLED */ + +#ifdef HAL_QSPI_MODULE_ENABLED +#include "stm32f4xx_hal_qspi.h" +#endif /* HAL_QSPI_MODULE_ENABLED */ + +#ifdef HAL_CEC_MODULE_ENABLED +#include "stm32f4xx_hal_cec.h" +#endif /* HAL_CEC_MODULE_ENABLED */ + +#ifdef HAL_FMPI2C_MODULE_ENABLED +#include "stm32f4xx_hal_fmpi2c.h" +#endif /* HAL_FMPI2C_MODULE_ENABLED */ + +#ifdef HAL_SPDIFRX_MODULE_ENABLED +#include "stm32f4xx_hal_spdifrx.h" +#endif /* HAL_SPDIFRX_MODULE_ENABLED */ + +#ifdef HAL_DFSDM_MODULE_ENABLED +#include "stm32f4xx_hal_dfsdm.h" +#endif /* HAL_DFSDM_MODULE_ENABLED */ + +#ifdef HAL_LPTIM_MODULE_ENABLED +#include "stm32f4xx_hal_lptim.h" +#endif /* HAL_LPTIM_MODULE_ENABLED */ + +#ifdef HAL_MMC_MODULE_ENABLED +#include "stm32f4xx_hal_mmc.h" +#endif /* HAL_MMC_MODULE_ENABLED */ + +/* Exported macro ------------------------------------------------------------*/ +#ifdef USE_FULL_ASSERT +/** + * @brief The assert_param macro is used for function's parameters check. + * @param expr If expr is false, it calls assert_failed function + * which reports the name of the source file and the source + * line number of the call that failed. + * If expr is true, it returns no value. + * @retval None + */ +#define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__)) +/* Exported functions ------------------------------------------------------- */ +void assert_failed(uint8_t *file, uint32_t line); +#else +#define assert_param(expr) ((void)0U) +#endif /* USE_FULL_ASSERT */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_HAL_CONF_CUSTOM_H */ + + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/ldscript.ld b/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/ldscript.ld new file mode 100644 index 000000000000..004714cd6dc0 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/ldscript.ld @@ -0,0 +1,187 @@ +/* +***************************************************************************** +** + +** File : LinkerScript.ld +** +** Abstract : Linker script for STM32F401RETx Device with +** 512KByte FLASH, 96KByte RAM +** +** Set heap size, stack size and stack location according +** to application requirements. +** +** Set memory bank area and size if external memory is used. +** +** Target : STMicroelectronics STM32 +** +** +** Distribution: The file is distributed as is, without any warranty +** of any kind. +** +***************************************************************************** +** @attention +** +**

© COPYRIGHT(c) 2014 Ac6

+** +** Redistribution and use in source and binary forms, with or without modification, +** are permitted provided that the following conditions are met: +** 1. Redistributions of source code must retain the above copyright notice, +** this list of conditions and the following disclaimer. +** 2. Redistributions in binary form must reproduce the above copyright notice, +** this list of conditions and the following disclaimer in the documentation +** and/or other materials provided with the distribution. +** 3. Neither the name of Ac6 nor the names of its contributors +** may be used to endorse or promote products derived from this software +** without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +** +***************************************************************************** +*/ + +/* Entry Point */ +ENTRY(Reset_Handler) + +/* Highest address of the user mode stack */ +_estack = 0x20010000; /* end of RAM */ + +/* Generate a link error if heap and stack don't fit into RAM */ +_Min_Heap_Size = 0x200;; /* required amount of heap */ +_Min_Stack_Size = 0x400;; /* required amount of stack */ + +/* Specify the memory areas */ +MEMORY +{ +FLASH (rx) : ORIGIN = 0x8000000 + LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET +RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K +} + +/* Define output sections */ +SECTIONS +{ + /* The startup code goes first into FLASH */ + .isr_vector : + { + . = ALIGN(4); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(4); + } >FLASH + + /* The program code and other data goes into FLASH */ + .text ALIGN(4): + { + . = ALIGN(4); + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + *(.eh_frame) + + KEEP (*(.init)) + KEEP (*(.fini)) + + . = ALIGN(4); + _etext = .; /* define a global symbols at end of code */ + } >FLASH + + /* Constant data goes into FLASH */ + .rodata : + { + . = ALIGN(4); + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + . = ALIGN(4); + } >FLASH + + .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH + .ARM : { + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + } >FLASH + + .preinit_array : + { + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + } >FLASH + .init_array : + { + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + } >FLASH + .fini_array : + { + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array*)) + PROVIDE_HIDDEN (__fini_array_end = .); + } >FLASH + + /* used by the startup to initialize data */ + _sidata = LOADADDR(.data); + + /* Initialized data sections goes into RAM, load LMA copy after code */ + .data : + { + . = ALIGN(4); + _sdata = .; /* create a global symbol at data start */ + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + + . = ALIGN(4); + _edata = .; /* define a global symbol at data end */ + } >RAM AT> FLASH + + + /* Uninitialized data section */ + . = ALIGN(4); + .bss : + { + /* This is used by the startup in order to initialize the .bss secion */ + _sbss = .; /* define a global symbol at bss start */ + __bss_start__ = _sbss; + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ebss = .; /* define a global symbol at bss end */ + __bss_end__ = _ebss; + } >RAM + + /* User_heap_stack section, used to check that there is enough RAM left */ + ._user_heap_stack : + { + . = ALIGN(8); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(8); + } >RAM + + + + /* Remove information from the standard libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } +} \ No newline at end of file diff --git a/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/variant.cpp b/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/variant.cpp new file mode 100644 index 000000000000..71f3509ed57b --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/variant.cpp @@ -0,0 +1,238 @@ +/* + Copyright (c) 2011 Arduino. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "pins_arduino.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Digital PinName array +const PinName digitalPin[] = { + PA_0, // Digital pin 0 + PA_1, // Digital pin 1 + PA_2, // Digital pin 2 + PA_3, // Digital pin 3 + PA_4, // Digital pin 4 + PA_5, // Digital pin 5 + PA_6, // Digital pin 6 + PA_7, // Digital pin 7 + PA_8, // Digital pin 8 + PA_9, // Digital pin 9 + PA_10, // Digital pin 10 + PA_11, // Digital pin 11 + PA_12, // Digital pin 12 + PA_13, // Digital pin 13 + PA_14, // Digital pin 14 + PA_15, // Digital pin 15 + + PB_0, // Digital pin 16 + PB_1, // Digital pin 17 + PB_2, // Digital pin 18 + PB_3, // Digital pin 19 + PB_4, // Digital pin 20 + PB_5, // Digital pin 21 + PB_6, // Digital pin 22 + PB_7, // Digital pin 23 + PB_8, // Digital pin 24 + PB_9, // Digital pin 25 + PB_10, // Digital pin 26 + PB_12, // Digital pin 27 + PB_13, // Digital pin 28 + PB_14, // Digital pin 29 + PB_15, // Digital pin 30 + + PC_0, // Digital pin 31 + PC_1, // Digital pin 32 + PC_2, // Digital pin 33 + PC_3, // Digital pin 34 + PC_4, // Digital pin 35 + PC_5, // Digital pin 36 + PC_6, // Digital pin 37 + PC_7, // Digital pin 38 + PC_8, // Digital pin 39 + PC_9, // Digital pin 40 + PC_10, // Digital pin 41 + PC_11, // Digital pin 42 + PC_12, // Digital pin 43 + PC_13, // Digital pin 44 + PC_14, // Digital pin 45 + PC_15, // Digital pin 46 + + PD_2, // Digital pin 47 + + PH_0, // Digital pin 48, used by the external oscillator + PH_1 // Digital pin 49, used by the external oscillator +}; + +// Analog (Ax) pin number array +const uint32_t analogInputPin[] = { + 0, // A0, PA0 + 1, // A1, PA1 + 2, // A2, PA2 + 3, // A3, PA3 + 4, // A4, PA4 + 5, // A5, PA5 + 6, // A6, PA6 + 7, // A7, PA7 + 16, // A8, PB0 + 17, // A9, PB1 + 31, // A10, PC0 + 32, // A11, PC1 + 33, // A12, PC2 + 34, // A13, PC3 + 35, // A14, PC4 + 36 // A15, PC5 +}; + +#ifdef __cplusplus +} +#endif + +// ---------------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * @brief Configures the System clock source, PLL Multiplier and Divider factors, + * AHB/APBx prescalers and Flash settings + * @note This function should be called only once the RCC clock configuration + * is reset to the default reset state (done in SystemInit() function). + * @param None + * @retval None + */ + +/******************************************************************************/ +/* PLL (clocked by HSE) used as System clock source */ +/******************************************************************************/ +static uint8_t SetSysClock_PLL_HSE(uint8_t bypass) +{ + RCC_OscInitTypeDef RCC_OscInitStruct; + RCC_ClkInitTypeDef RCC_ClkInitStruct; + + /* The voltage scaling allows optimizing the power consumption when the device is + clocked below the maximum system frequency, to update the voltage scaling value + regarding system frequency refer to product datasheet. */ + __HAL_RCC_PWR_CLK_ENABLE(); + __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2); + + // Enable HSE oscillator and activate PLL with HSE as source + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; + if (bypass == 0) { + RCC_OscInitStruct.HSEState = RCC_HSE_ON; // External 8 MHz xtal on OSC_IN/OSC_OUT + } else { + RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS; // External 8 MHz clock on OSC_IN + } + + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; + RCC_OscInitStruct.PLL.PLLM = HSE_VALUE / 1000000L; // Expects an 8 MHz external clock by default. Redefine HSE_VALUE if not + RCC_OscInitStruct.PLL.PLLN = 336; // VCO output clock = 336 MHz (1 MHz * 336) + RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4; // PLLCLK = 84 MHz (336 MHz / 4) + RCC_OscInitStruct.PLL.PLLQ = 7; // USB clock = 48 MHz (336 MHz / 7) --> OK for USB + if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { + return 0; // FAIL + } + + // Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 clocks dividers + RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2; + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; // 84 MHz + RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; // 84 MHz + RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; // 42 MHz + RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; // 84 MHz + if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) { + return 0; // FAIL + } + + /* Output clock on MCO1 pin(PA8) for debugging purpose */ + /* + if (bypass == 0) + HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSE, RCC_MCODIV_2); // 4 MHz + else + HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSE, RCC_MCODIV_1); // 8 MHz + */ + + return 1; // OK +} + +/******************************************************************************/ +/* PLL (clocked by HSI) used as System clock source */ +/******************************************************************************/ +uint8_t SetSysClock_PLL_HSI(void) +{ + RCC_OscInitTypeDef RCC_OscInitStruct; + RCC_ClkInitTypeDef RCC_ClkInitStruct; + + /* The voltage scaling allows optimizing the power consumption when the device is + clocked below the maximum system frequency, to update the voltage scaling value + regarding system frequency refer to product datasheet. */ + __HAL_RCC_PWR_CLK_ENABLE(); + __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2); + + // Enable HSI oscillator and activate PLL with HSI as source + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_HSE; + RCC_OscInitStruct.HSIState = RCC_HSI_ON; + RCC_OscInitStruct.HSEState = RCC_HSE_OFF; + RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT; + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; + RCC_OscInitStruct.PLL.PLLM = 16; // VCO input clock = 1 MHz (16 MHz / 16) + RCC_OscInitStruct.PLL.PLLN = 336; // VCO output clock = 336 MHz (1 MHz * 336) + RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4; // PLLCLK = 84 MHz (336 MHz / 4) + RCC_OscInitStruct.PLL.PLLQ = 7; // USB clock = 48 MHz (336 MHz / 7) --> freq is ok but not precise enough + if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { + return 0; // FAIL + } + + /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 clocks dividers */ + RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2); + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; // 84 MHz + RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; // 84 MHz + RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; // 42 MHz + RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; // 84 MHz + if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) { + return 0; // FAIL + } + + /* Output clock on MCO1 pin(PA8) for debugging purpose */ + //HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSI, RCC_MCODIV_1); // 16 MHz + + return 1; // OK +} + +WEAK void SystemClock_Config(void) +{ + /* 1- If fail try to start with HSE and external xtal */ + if (SetSysClock_PLL_HSE(0) == 0) { + /* 2- Try to start with HSE and external clock */ + if (SetSysClock_PLL_HSE(1) == 0) { + /* 3- If fail start with HSI clock */ + if (SetSysClock_PLL_HSI() == 0) { + Error_Handler(); + } + } + } + /* Output clock on MCO2 pin(PC9) for debugging purpose */ + //HAL_RCC_MCOConfig(RCC_MCO2, RCC_MCO2SOURCE_SYSCLK, RCC_MCODIV_4); +} + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/variant.h new file mode 100644 index 000000000000..b5a4e5ef80c2 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/variant.h @@ -0,0 +1,151 @@ +/* + Copyright (c) 2011 Arduino. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef _VARIANT_ARDUINO_STM32_ +#define _VARIANT_ARDUINO_STM32_ + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + + +// | DIGITAL | ANALOG | USART | TWI | SPI | SPECIAL | +// |---------|--------|-----------|----------|------------------------|-----------| +#define PA0 0 // | 0 | A0 | | | | | +#define PA1 1 // | 1 | A1 | | | | | +#define PA2 2 // | 2 | A2 | USART2_TX | | | | +#define PA3 3 // | 3 | A3 | USART2_RX | | | | +#define PA4 4 // | 4 | A4 | | | SPI1_SS, (SPI3_SS) | | +#define PA5 5 // | 5 | A5 | | | SPI1_SCK | | +#define PA6 6 // | 6 | A6 | | | SPI1_MISO | | +#define PA7 7 // | 7 | A7 | | | SPI1_MOSI | | +#define PA8 8 // | 8 | | | TWI3_SCL | | | +#define PA9 9 // | 9 | | USART1_TX | | | | +#define PA10 10 // | 10 | | USART1_RX | | | | +#define PA11 11 // | 11 | | USART6_TX | | | | +#define PA12 12 // | 12 | | USART6_RX | | | | +#define PA13 13 // | 13 | | | | | SWD_SWDIO | +#define PA14 14 // | 14 | | | | | SWD_SWCLK | +#define PA15 15 // | 15 | | | | SPI3_SS, (SPI1_SS) | | +// |---------|--------|-----------|----------|------------------------|-----------| +#define PB0 16 // | 16 | A8 | | | | | +#define PB1 17 // | 17 | A9 | | | | | +#define PB2 18 // | 18 | | | | | BOOT1 | +#define PB3 19 // | 19 | | | TWI2_SDA | SPI3_SCK, (SPI1_SCK) | | +#define PB4 20 // | 20 | | | TWI3_SDA | SPI3_MISO, (SPI1_MISO) | | +#define PB5 21 // | 21 | | | | SPI3_MOSI, (SPI1_MOSI) | | +#define PB6 22 // | 22 | | USART1_TX | TWI1_SCL | | | +#define PB7 23 // | 23 | | USART1_RX | TWI1_SDA | | | +#define PB8 24 // | 24 | | | TWI1_SCL | | | +#define PB9 25 // | 25 | | | TWI1_SDA | SPI2_SS | | +#define PB10 26 // | 26 | | | TWI2_SCL | SPI2_SCK | | +#define PB12 27 // | 27 | | | | SPI2_SS | | +#define PB13 28 // | 28 | | | | SPI2_SCK | | +#define PB14 29 // | 29 | | | | SPI2_MISO | | +#define PB15 30 // | 30 | | | | SPI2_MOSI | | +// |---------|--------|-----------|----------|------------------------|-----------| +#define PC0 31 // | 31 | A10 | | | | | +#define PC1 32 // | 32 | A11 | | | | | +#define PC2 33 // | 33 | A12 | | | SPI2_MISO | | +#define PC3 34 // | 34 | A13 | | | SPI2_MOSI | | +#define PC4 35 // | 35 | A14 | | | | | +#define PC5 36 // | 36 | A15 | | | | | +#define PC6 37 // | 37 | | USART6_TX | | | | +#define PC7 38 // | 38 | | USART6_RX | | | | +#define PC8 39 // | 39 | | | | | | +#define PC9 40 // | 40 | | | TWI3_SDA | | | +#define PC10 41 // | 41 | | | | SPI3_SCK | | +#define PC11 42 // | 42 | | | | SPI3_MISO | | +#define PC12 43 // | 43 | | | | SPI3_MOSI | | +#define PC13 44 // | 44 | | | | | | +#define PC14 45 // | 45 | | | | | OSC32_IN | +#define PC15 46 // | 46 | | | | | OSC32_OUT | +// |---------|--------|-----------|----------|------------------------|-----------| +#define PD2 47 // | 47 | | | | | | +// |---------|--------|-----------|----------|------------------------|-----------| +#define PH0 48 // | 48 | | | | | OSC_IN | +#define PH1 49 // | 49 | | | | | OSC_OUT | +// |---------|--------|-----------|----------|------------------------|-----------| + +// This must be a literal +#define NUM_DIGITAL_PINS 50 +#define NUM_ANALOG_INPUTS 16 + +// SPI definitions +#define PIN_SPI_SS PA4 +#define PIN_SPI_SS1 PA4 +#define PIN_SPI_MOSI PA7 +#define PIN_SPI_MISO PA6 +#define PIN_SPI_SCK PA5 + + +// Timer Definitions +#define TIMER_TONE TIM2 +#define TIMER_SERVO TIM5 +#define TIMER_SERIAL TIM11 + +// UART Definitions +//#define ENABLE_HWSERIAL1 done automatically by the #define SERIAL_UART_INSTANCE below +#define ENABLE_HWSERIAL2 + + +// Define here Serial instance number to map on Serial generic name (if not already used by SerialUSB) +#define SERIAL_UART_INSTANCE 1 //1 for Serial = Serial1 (USART1) + +// Default pin used for 'Serial' instance +// Mandatory for Firmata +#define PIN_SERIAL_RX PA10 +#define PIN_SERIAL_TX PA9 + +// Used when user instanciate a hardware Serial using its peripheral name. +// Example: HardwareSerial mySerial(USART3); +// will use PIN_SERIAL3_RX and PIN_SERIAL3_TX if defined. +#define PIN_SERIAL1_RX PA10 +#define PIN_SERIAL1_TX PA9 +#define PIN_SERIAL2_RX PA3 +#define PIN_SERIAL2_TX PA2 + +#ifdef __cplusplus +} // extern "C" +#endif +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ + +#ifdef __cplusplus + // These serial port names are intended to allow libraries and architecture-neutral + // sketches to automatically default to the correct port name for a particular type + // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, + // the first hardware serial port whose RX/TX pins are not dedicated to another use. + // + // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor + // + // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial + // + // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library + // + // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. + // + // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX + // pins are NOT connected to anything by default. + #define SERIAL_PORT_MONITOR Serial + #define SERIAL_PORT_HARDWARE Serial1 + #define SERIAL_PORT_HARDWARE_OPEN Serial2 +#endif + +#endif /* _VARIANT_ARDUINO_STM32_ */ \ No newline at end of file diff --git a/buildroot/tests/STM32F103RE_creality b/buildroot/tests/STM32F103RE_creality index 6440c5679224..a5d2899dd565 100755 --- a/buildroot/tests/STM32F103RE_creality +++ b/buildroot/tests/STM32F103RE_creality @@ -13,12 +13,6 @@ use_example_configs "Creality/Ender-3 V2/CrealityV422/CrealityUI" opt_enable MARLIN_DEV_MODE BUFFER_MONITORING BLTOUCH AUTO_BED_LEVELING_BILINEAR Z_SAFE_HOMING exec_test $1 $2 "Ender 3 v2 with CrealityUI" "$3" -use_example_configs "Creality/Ender-3 V2/CrealityV422/CrealityUI" -opt_disable DWIN_CREALITY_LCD -opt_enable BLTOUCH AUTO_BED_LEVELING_UBL Z_SAFE_HOMING INDIVIDUAL_AXIS_HOMING_SUBMENU LCD_SET_PROGRESS_MANUALLY STATUS_MESSAGE_SCROLLING BAUD_RATE_GCODE \ - DWIN_LCD_PROUI SOUND_MENU_ITEM PRINTCOUNTER -exec_test $1 $2 "Ender 3 v2 with ProUI" "$3" - use_example_configs "Creality/Ender-3 V2/CrealityV422/CrealityUI" opt_disable DWIN_CREALITY_LCD opt_enable DWIN_CREALITY_LCD_JYERSUI AUTO_BED_LEVELING_BILINEAR PROBE_MANUALLY diff --git a/buildroot/tests/STM32F401RC_creality b/buildroot/tests/STM32F401RC_creality new file mode 100755 index 000000000000..c7cd464df066 --- /dev/null +++ b/buildroot/tests/STM32F401RC_creality @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# +# Build tests for STM32F401RC_creality +# + +# exit on first failure +set -e + +use_example_configs "Creality/Ender-3 S1" +opt_disable DWIN_CREALITY_LCD Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN AUTO_BED_LEVELING_BILINEAR CONFIGURATION_EMBEDDING CANCEL_OBJECTS FWRETRACT +opt_enable DWIN_LCD_PROUI INDIVIDUAL_AXIS_HOMING_SUBMENU LCD_SET_PROGRESS_MANUALLY STATUS_MESSAGE_SCROLLING \ + SOUND_MENU_ITEM PRINTCOUNTER NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE FILAMENT_RUNOUT_SENSOR \ + BLTOUCH Z_SAFE_HOMING AUTO_BED_LEVELING_UBL MESH_EDIT_MENU \ + LIMITED_MAX_FR_EDITING LIMITED_MAX_ACCEL_EDITING LIMITED_JERK_EDITING BAUD_RATE_GCODE +opt_set MOTHERBOARD BOARD_CREALITY_V24S1_301F4 \ + PREHEAT_3_LABEL '"CUSTOM"' PREHEAT_3_TEMP_HOTEND 240 PREHEAT_3_TEMP_BED 60 PREHEAT_3_FAN_SPEED 128 +exec_test $1 $2 "Ender-3 S1 with ProUI" "$3" + +# clean up +restore_configs diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 437dbdcd9be1..260593f8a295 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -588,4 +588,31 @@ build_flags = ${common_stm32.build_flags} -DUSB_PRODUCT=\"Artillery_3D_Printer\" -DFLASH_DATA_SECTOR=1U -DFLASH_BASE_ADDRESS=0x08004000 extra_scripts = ${common_stm32.extra_scripts} - pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py + pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py + +# +# Ender-3 S1 STM32F401RC_creality +# +[env:STM32F401RC_creality] +extends = stm32_variant +board = genericSTM32F401RC +board_build.variant = MARLIN_CREALITY_STM32F401RC +board_build.offset = 0x10000 +board_upload.offset_address = 0x08010000 +build_flags = ${stm32_variant.build_flags} -DMCU_STM32F401RC -DSTM32F4 + -DSS_TIMER=4 -DTIMER_SERVO=TIM5 + -DENABLE_HWSERIAL3 -DTRANSFER_CLOCK_DIV=8 +build_unflags = ${stm32_variant.build_unflags} -DUSBCON -DUSBD_USE_CDC +extra_scripts = ${stm32_variant.extra_scripts} + pre:buildroot/share/PlatformIO/scripts/random-bin.py +monitor_speed = 115200 + +[env:STM32F401RC_creality_jlink] +extends = env:STM32F401RC_creality +debug_tool = jlink +upload_protocol = jlink + +[env:STM32F401RC_creality_stlink] +extends = env:STM32F401RC_creality +debug_tool = stlink +upload_protocol = stlink From 1e749e4f48f528179213e736c99371843a90b4fb Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 12 May 2022 20:13:59 -0500 Subject: [PATCH 048/241] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Mis?= =?UTF-8?q?c.=20LCD=20cleanup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/MarlinCore.cpp | 4 ++ Marlin/src/MarlinCore.h | 2 + Marlin/src/feature/bedlevel/ubl/ubl.h | 2 +- Marlin/src/gcode/lcd/M73.cpp | 2 +- Marlin/src/inc/SanityCheck.h | 2 +- Marlin/src/lcd/e3v2/creality/dwin.cpp | 4 +- Marlin/src/lcd/e3v2/proui/dwin.cpp | 59 +++++++++++----------- Marlin/src/lcd/e3v2/proui/dwin.h | 12 ++--- Marlin/src/lcd/e3v2/proui/dwin_defines.h | 2 +- Marlin/src/lcd/e3v2/proui/dwin_popup.h | 2 +- Marlin/src/lcd/e3v2/proui/dwinui.cpp | 2 +- Marlin/src/lcd/e3v2/proui/dwinui.h | 2 +- Marlin/src/lcd/e3v2/proui/endstop_diag.cpp | 2 +- Marlin/src/lcd/e3v2/proui/lockscreen.cpp | 7 ++- Marlin/src/lcd/e3v2/proui/meshviewer.cpp | 11 ++-- Marlin/src/lcd/e3v2/proui/printstats.cpp | 2 +- Marlin/src/lcd/language/language_de.h | 4 +- Marlin/src/lcd/language/language_en.h | 11 +++- Marlin/src/lcd/language/language_gl.h | 6 +-- Marlin/src/lcd/language/language_hu.h | 4 +- Marlin/src/lcd/language/language_it.h | 4 +- Marlin/src/lcd/language/language_ro.h | 4 +- Marlin/src/lcd/language/language_ru.h | 4 +- Marlin/src/lcd/language/language_sk.h | 4 +- Marlin/src/lcd/language/language_sv.h | 4 +- Marlin/src/lcd/language/language_uk.h | 4 +- Marlin/src/lcd/language/language_zh_CN.h | 4 +- Marlin/src/lcd/menu/menu.cpp | 4 -- Marlin/src/lcd/menu/menu.h | 1 - Marlin/src/lcd/menu/menu_bed_leveling.cpp | 2 +- Marlin/src/libs/BL24CXX.cpp | 10 ++-- Marlin/src/module/settings.cpp | 10 ++-- 32 files changed, 105 insertions(+), 92 deletions(-) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index bdcdfc0508d9..a4cf46dbbf88 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -321,6 +321,10 @@ bool pin_is_protected(const pin_t pin) { #pragma GCC diagnostic pop +bool printer_busy() { + return planner.movesplanned() || printingIsActive(); +} + /** * A Print Job exists when the timer is running or SD is printing */ diff --git a/Marlin/src/MarlinCore.h b/Marlin/src/MarlinCore.h index 7063c7e2de38..f80405a302ee 100644 --- a/Marlin/src/MarlinCore.h +++ b/Marlin/src/MarlinCore.h @@ -61,6 +61,8 @@ bool printJobOngoing(); bool printingIsPaused(); void startOrResumeJob(); +bool printer_busy(); + extern bool wait_for_heatup; #if HAS_RESUME_CONTINUE diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.h b/Marlin/src/feature/bedlevel/ubl/ubl.h index 8dad966acb84..9dd964c46cfb 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.h +++ b/Marlin/src/feature/bedlevel/ubl/ubl.h @@ -83,7 +83,6 @@ class unified_bed_leveling { static bool smart_fill_one(const xy_uint8_t &pos, const xy_uint8_t &dir) { return smart_fill_one(pos.x, pos.y, dir.x, dir.y); } - static void smart_fill_mesh(); #if ENABLED(UBL_DEVEL_DEBUGGING) static void g29_what_command(); @@ -106,6 +105,7 @@ class unified_bed_leveling { static void set_all_mesh_points_to_value(const_float_t value); static void adjust_mesh_to_mean(const bool cflag, const_float_t value); static bool sanity_check(); + static void smart_fill_mesh(); static void G29() __O0; // O0 for no optimization static void smart_fill_wlsf(const_float_t ) __O2; // O2 gives smaller code than Os on A2560 diff --git a/Marlin/src/gcode/lcd/M73.cpp b/Marlin/src/gcode/lcd/M73.cpp index 355445c573b9..a86eee4d9967 100644 --- a/Marlin/src/gcode/lcd/M73.cpp +++ b/Marlin/src/gcode/lcd/M73.cpp @@ -42,7 +42,7 @@ void GcodeSuite::M73() { #if ENABLED(DWIN_LCD_PROUI) - DWIN_Progress_Update(); + DWIN_M73(); #else diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 2a85a589b991..c800dae9b495 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1917,7 +1917,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS * LCD_BED_LEVELING requirements */ #if ENABLED(LCD_BED_LEVELING) - #if NONE(HAS_MARLINUI_MENU, DWIN_CREALITY_LCD, DWIN_LCD_PROUI) + #if !HAS_MARLINUI_MENU #error "LCD_BED_LEVELING is not supported by the selected LCD controller." #elif !(ENABLED(MESH_BED_LEVELING) || HAS_ABL_NOT_UBL) #error "LCD_BED_LEVELING requires MESH_BED_LEVELING or AUTO_BED_LEVELING." diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index 05ac38d226ce..65da4cb42157 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp @@ -33,7 +33,7 @@ //#define USE_STRING_HEADINGS //#define USE_STRING_TITLES -#if ENABLED(LCD_BED_LEVELING) && DISABLED(PROBE_MANUALLY) && ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT) +#if DISABLED(PROBE_MANUALLY) && ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT) #define HAS_ONESTEP_LEVELING 1 #endif @@ -1366,8 +1366,6 @@ void HMI_Move_Z() { #if HAS_ZOFFSET_ITEM - bool printer_busy() { return planner.movesplanned() || printingIsActive(); } - void HMI_Zoffset() { EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 1933c82d365e..68d4010ef698 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -432,7 +432,7 @@ void Draw_Back_First(const bool is_sel=true) { //PopUps void Popup_window_PauseOrStop() { if (HMI_IsChinese()) { - DWINUI::ClearMenuArea(); + DWINUI::ClearMainArea(); Draw_Popup_Bkgd(); if (select_print.now == PRINT_PAUSE_RESUME) DWIN_Frame_AreaCopy(1, 237, 338, 269, 356, 98, 150); else if (select_print.now == PRINT_STOP) DWIN_Frame_AreaCopy(1, 221, 320, 253, 336, 98, 150); @@ -451,7 +451,7 @@ void Popup_window_PauseOrStop() { void Popup_Window_ETempTooLow() { if (HMI_IsChinese()) { HMI_SaveProcessID(WaitResponse); - DWINUI::ClearMenuArea(); + DWINUI::ClearMainArea(); Draw_Popup_Bkgd(); DWINUI::Draw_Icon(ICON_TempTooLow, 102, 105); DWIN_Frame_AreaCopy(1, 103, 371, 136, 386, 69, 240); @@ -469,7 +469,7 @@ void Popup_window_PauseOrStop() { void DWIN_Popup_Temperature(const bool toohigh) { HMI_SaveProcessID(WaitResponse); if (HMI_IsChinese()) { - DWINUI::ClearMenuArea(); + DWINUI::ClearMainArea(); Draw_Popup_Bkgd(); if (toohigh) { DWINUI::Draw_Icon(ICON_TempTooHigh, 102, 165); @@ -579,13 +579,13 @@ void Draw_Print_ProgressBar() { void Draw_Print_ProgressElapsed() { char buf[10]; duration_t elapsed = print_job_timer.duration(); // print timer - sprintf_P(buf, PSTR("%02i:%02i"), (uint16_t)(elapsed.value / 3600), ((uint16_t)elapsed.value % 3600) / 60); + sprintf_P(buf, PSTR("%02i:%02i "), (uint16_t)(elapsed.value / 3600), ((uint16_t)elapsed.value % 3600) / 60); DWINUI::Draw_String(HMI_data.Text_Color, HMI_data.Background_Color, 47, 192, buf); } void Draw_Print_ProgressRemain() { char buf[10]; - sprintf_P(buf, PSTR("%02i:%02i"), (uint16_t)(_remain_time / 3600), ((uint16_t)_remain_time % 3600) / 60); + sprintf_P(buf, PSTR("%02i:%02i "), (uint16_t)(_remain_time / 3600), ((uint16_t)_remain_time % 3600) / 60); DWINUI::Draw_String(HMI_data.Text_Color, HMI_data.Background_Color, 181, 192, buf); } @@ -612,7 +612,7 @@ void Draw_PrintProcess() { Title.FrameCopy(30, 1, 42, 14); // "Printing" else Title.ShowCaption(GET_TEXT_F(MSG_PRINTING)); - DWINUI::ClearMenuArea(); + DWINUI::ClearMainArea(); DWIN_Print_Header(sdprint ? card.longest_filename() : nullptr); Draw_Print_Labels(); DWINUI::Draw_Icon(ICON_PrintTime, 15, 173); @@ -641,7 +641,7 @@ void Draw_PrintDone() { _remain_time = 0; Title.ShowCaption(GET_TEXT_F(MSG_PRINT_DONE)); - DWINUI::ClearMenuArea(); + DWINUI::ClearMainArea(); DWIN_Print_Header(nullptr); Draw_Print_ProgressBar(); Draw_Print_Labels(); @@ -663,7 +663,7 @@ void Goto_PrintDone() { } void Draw_Main_Menu() { - DWINUI::ClearMenuArea(); + DWINUI::ClearMainArea(); if (HMI_IsChinese()) Title.FrameCopy(2, 2, 26, 13); // "Home" etc else @@ -933,7 +933,7 @@ void Redraw_SD_List() { select_file.reset(); index_file = MROWS; - DWINUI::ClearMenuArea(); // Leave title bar unchanged + DWINUI::ClearMainArea(); // Leave title bar unchanged Draw_Back_First(); @@ -1041,7 +1041,7 @@ void DWIN_Draw_Dashboard() { } void Draw_Info_Menu() { - DWINUI::ClearMenuArea(); + DWINUI::ClearMainArea(); Draw_Back_First(); if (HMI_IsChinese()) Title.FrameCopy(30, 17, 28, 13); // "Info" @@ -1107,7 +1107,7 @@ void HMI_MainMenu() { case PAGE_PRINT: checkkey = SelectFile; card.mount(); - delay(300); + safe_delay(300); Draw_Print_File_Menu(); break; case PAGE_PREPARE: Draw_Prepare_Menu(); break; @@ -1349,8 +1349,8 @@ void HMI_Init() { void EachMomentUpdate() { static millis_t next_var_update_ms = 0, next_rts_update_ms = 0, next_status_update_ms = 0; - const millis_t ms = millis(); + if (ELAPSED(ms, next_var_update_ms)) { next_var_update_ms = ms + DWIN_VAR_UPDATE_INTERVAL; update_variable(); @@ -1439,7 +1439,7 @@ void EachMomentUpdate() { #if ENABLED(POWER_LOSS_RECOVERY) void Popup_PowerLossRecovery() { - DWINUI::ClearMenuArea(); + DWINUI::ClearMainArea(); Draw_Popup_Bkgd(); if (HMI_IsChinese()) { DWIN_Frame_AreaCopy(1, 160, 338, 235, 354, 98, 115); @@ -1478,7 +1478,7 @@ void EachMomentUpdate() { void Goto_PowerLossRecovery() { recovery.dwin_flag = false; - LCD_MESSAGE_F(GET_TEXT_F(MSG_CONTINUE_PRINT_JOB)); + LCD_MESSAGE(MSG_CONTINUE_PRINT_JOB); Goto_Popup(Popup_PowerLossRecovery, onClick_PowerLossRecovery); } @@ -1581,15 +1581,15 @@ void DWIN_PidTuning(pidresult_t result) { break; case PID_BAD_EXTRUDER_NUM: checkkey = last_checkkey; - DWIN_Popup_Confirm(ICON_TempTooLow, F("PID Autotune failed!"), F("Bad extruder")); + DWIN_Popup_Confirm(ICON_TempTooLow, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), GET_TEXT_F(MSG_BAD_EXTRUDER_NUM)); break; case PID_TUNING_TIMEOUT: checkkey = last_checkkey; - DWIN_Popup_Confirm(ICON_TempTooHigh, F("Error"), GET_TEXT_F(MSG_PID_TIMEOUT)); + DWIN_Popup_Confirm(ICON_TempTooHigh, GET_TEXT_F(MSG_ERROR), GET_TEXT_F(MSG_PID_TIMEOUT)); break; case PID_TEMP_TOO_HIGH: checkkey = last_checkkey; - DWIN_Popup_Confirm(ICON_TempTooHigh, F("PID Autotune failed!"), F("Temperature too high")); + DWIN_Popup_Confirm(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), GET_TEXT_F(MSG_TEMP_TOO_HIGH)); break; case PID_DONE: checkkey = last_checkkey; @@ -1637,7 +1637,7 @@ void DWIN_Print_Finished() { HMI_flag.pause_flag = false; wait_for_heatup = false; planner.finish_and_disable(); - thermalManager.cooldown(); + thermalManager.cooldown(); Goto_PrintDone(); } @@ -1652,8 +1652,8 @@ void DWIN_Print_Aborted() { } // Progress Bar update -void DWIN_Progress_Update() { if (parser.seenval('P')) _percent_done = parser.byteval('P'); +void DWIN_M73() { if (parser.seenval('R')) { _remain_time = parser.ulongval('R') * 60; HMI_flag.remain_flag = true; @@ -1707,11 +1707,11 @@ void DWIN_SetDataDefaults() { TERN_(BAUD_RATE_GCODE, SetBaud250K()); } -void DWIN_StoreSettings(char *buff) { +void DWIN_CopySettingsTo(char * const buff) { memcpy(buff, &HMI_data, _MIN(sizeof(HMI_data), eeprom_data_size)); } -void DWIN_LoadSettings(const char *buff) { +void DWIN_CopySettingsFrom(const char * const buff) { // (void *)-> Avoid Warning when save data different from uintX_t in HMI_data_t struct memcpy((void *)&HMI_data, buff, _MIN(sizeof(HMI_data), eeprom_data_size)); dwin_zoffset = TERN0(HAS_BED_PROBE, probe.offset.z); @@ -1729,6 +1729,7 @@ void DWIN_LoadSettings(const char *buff) { // Apply Led Color leds.set_color(HMI_data.Led_Color); #endif + } // Initialize or re-initialize the LCD @@ -1773,10 +1774,10 @@ void DWIN_RebootScreen() { DWIN_JPG_ShowAndCache(0); DWINUI::Draw_CenteredString(Color_White, 220, GET_TEXT_F(MSG_PLEASE_WAIT_REBOOT)); DWIN_UpdateLCD(); - delay(500); + safe_delay(500); } -void DWIN_Redraw_screen() { +void DWIN_RedrawScreen() { Draw_Main_Area(); hash_changed = true; DWIN_DrawStatusMessage(); @@ -1898,13 +1899,13 @@ void Goto_ConfirmToPrint() { void ReadEeprom() { const bool success = settings.load(); - DWIN_Redraw_screen(); + DWIN_RedrawScreen(); HMI_AudioFeedback(success); } void ResetEeprom() { settings.reset(); - DWIN_Redraw_screen(); + DWIN_RedrawScreen(); HMI_AudioFeedback(); } #endif @@ -1947,7 +1948,7 @@ void SetHome() { } #if HAS_ZOFFSET_ITEM - bool printer_busy() { return planner.movesplanned() || printingIsActive(); } + void ApplyZOffset() { TERN_(EEPROM_SETTINGS, settings.save()); } void LiveZOffset() { last_zoffset = dwin_zoffset; @@ -2066,7 +2067,7 @@ void SetPID(celsius_t t, heater_id_t h) { void ApplyBrightness() { ui.set_brightness(MenuData.Value); } void LiveBrightness() { DWIN_LCD_Brightness(MenuData.Value); } void SetBrightness() { SetIntOnClick(LCD_BRIGHTNESS_MIN, LCD_BRIGHTNESS_MAX, ui.brightness, ApplyBrightness, LiveBrightness); } - void TurnOffBacklight() { HMI_SaveProcessID(WaitResponse); ui.set_brightness(0); DWIN_Redraw_screen(); } + void TurnOffBacklight() { HMI_SaveProcessID(WaitResponse); ui.set_brightness(0); DWIN_RedrawScreen(); } #endif #if ENABLED(CASE_LIGHT_MENU) @@ -2170,7 +2171,7 @@ void SetPID(celsius_t t, heater_id_t h) { void RestoreDefaultsColors() { DWIN_SetColorDefaults(); DWINUI::SetColors(HMI_data.Text_Color, HMI_data.Background_Color, HMI_data.StatusBg_Color); - DWIN_Redraw_screen(); + DWIN_RedrawScreen(); } void SelColor() { @@ -2981,7 +2982,7 @@ void Draw_Prepare_Menu() { } void Draw_Tramming_Menu() { - DWINUI::ClearMenuArea(); + DWINUI::ClearMainArea(); checkkey = Menu; if (!TrammingMenu) TrammingMenu = new MenuClass(); if (CurrentMenu != TrammingMenu) { diff --git a/Marlin/src/lcd/e3v2/proui/dwin.h b/Marlin/src/lcd/e3v2/proui/dwin.h index b61ed846dfcb..d1f0a90042ce 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.h +++ b/Marlin/src/lcd/e3v2/proui/dwin.h @@ -114,14 +114,14 @@ void Goto_Info_Menu(); void Goto_PowerLossRecovery(); void Goto_ConfirmToPrint(); void DWIN_Draw_Dashboard(const bool with_update); // Status Area -void Draw_Main_Area(); // Redraw main area; -void DWIN_Redraw_screen(); // Redraw all screen elements +void Draw_Main_Area(); // Redraw main area +void DWIN_RedrawScreen(); // Redraw all screen elements void HMI_MainMenu(); // Main process screen void HMI_SelectFile(); // File page void HMI_Printing(); // Print page void HMI_ReturnScreen(); // Return to previous screen before popups void ApplyExtMinT(); -void HMI_SetLanguageCache(); // Set the languaje image cache +void HMI_SetLanguageCache(); // Set the language image cache void RebootPrinter(); #if ENABLED(BAUD_RATE_GCODE) void HMI_SetBaudRate(); @@ -158,12 +158,12 @@ void DWIN_Print_Aborted(); #if HAS_FILAMENT_SENSOR void DWIN_FilamentRunout(const uint8_t extruder); #endif -void DWIN_Progress_Update(); +void DWIN_M73(); void DWIN_Print_Header(const char *text); void DWIN_SetColorDefaults(); void DWIN_ApplyColor(); -void DWIN_StoreSettings(char *buff); -void DWIN_LoadSettings(const char *buff); +void DWIN_CopySettingsTo(char * const buff); +void DWIN_CopySettingsFrom(const char * const buff); void DWIN_SetDataDefaults(); void DWIN_RebootScreen(); diff --git a/Marlin/src/lcd/e3v2/proui/dwin_defines.h b/Marlin/src/lcd/e3v2/proui/dwin_defines.h index 4ebc2c16c6e4..1e361c8c1133 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_defines.h +++ b/Marlin/src/lcd/e3v2/proui/dwin_defines.h @@ -80,7 +80,7 @@ #define HAS_ESDIAG 1 -#if ENABLED(LED_CONTROL_MENU, HAS_COLOR_LEDS) +#if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS) #define Def_Leds_Color LEDColorWhite() #endif #if ENABLED(CASELIGHT_USES_BRIGHTNESS) diff --git a/Marlin/src/lcd/e3v2/proui/dwin_popup.h b/Marlin/src/lcd/e3v2/proui/dwin_popup.h index 0d864994754b..b4503ea7866b 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_popup.h +++ b/Marlin/src/lcd/e3v2/proui/dwin_popup.h @@ -50,7 +50,7 @@ inline void Draw_Popup_Bkgd() { template void DWIN_Draw_Popup(const uint8_t icon, T amsg1=nullptr, U amsg2=nullptr, uint8_t button=0) { - DWINUI::ClearMenuArea(); + DWINUI::ClearMainArea(); Draw_Popup_Bkgd(); if (icon) DWINUI::Draw_Icon(icon, 101, 105); if (amsg1) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 210, amsg1); diff --git a/Marlin/src/lcd/e3v2/proui/dwinui.cpp b/Marlin/src/lcd/e3v2/proui/dwinui.cpp index ddc494fc8492..e190fa06fbfe 100644 --- a/Marlin/src/lcd/e3v2/proui/dwinui.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwinui.cpp @@ -304,7 +304,7 @@ void DWINUI::Draw_Checkbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t } // Clear Menu by filling the menu area with background color -void DWINUI::ClearMenuArea() { +void DWINUI::ClearMainArea() { DWIN_Draw_Rectangle(1, backcolor, 0, TITLE_HEIGHT, DWIN_WIDTH - 1, STATUS_Y - 1); } diff --git a/Marlin/src/lcd/e3v2/proui/dwinui.h b/Marlin/src/lcd/e3v2/proui/dwinui.h index 1504dcd30598..6771c77d5d81 100644 --- a/Marlin/src/lcd/e3v2/proui/dwinui.h +++ b/Marlin/src/lcd/e3v2/proui/dwinui.h @@ -593,7 +593,7 @@ namespace DWINUI { // Clear Menu by filling the area with background color // Area (0, TITLE_HEIGHT, DWIN_WIDTH, STATUS_Y - 1) - void ClearMenuArea(); + void ClearMainArea(); // Clear MenuItems array and free MenuItems elements void MenuItemsClear(); diff --git a/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp b/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp index 0b450bd4c0f6..19d726037ce9 100644 --- a/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp +++ b/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp @@ -71,7 +71,7 @@ void draw_es_state(const bool is_hit) { void ESDiagClass::Draw() { Title.ShowCaption(F("End-stops Diagnostic")); - DWINUI::ClearMenuArea(); + DWINUI::ClearMainArea(); Draw_Popup_Bkgd(); DWINUI::Draw_Button(BTN_Continue, 86, 250); DWINUI::cursor.y = 80; diff --git a/Marlin/src/lcd/e3v2/proui/lockscreen.cpp b/Marlin/src/lcd/e3v2/proui/lockscreen.cpp index 2895c01544b0..c179856c6acb 100644 --- a/Marlin/src/lcd/e3v2/proui/lockscreen.cpp +++ b/Marlin/src/lcd/e3v2/proui/lockscreen.cpp @@ -50,11 +50,10 @@ void LockScreenClass::init() { } void LockScreenClass::draw() { - Title.SetCaption(PSTR("Lock Screen")); - DWINUI::ClearMenuArea(); + DWINUI::ClearMainArea(); DWINUI::Draw_Icon(ICON_LOGO, 71, 120); // CREALITY logo - DWINUI::Draw_CenteredString(Color_White, 180, F("Printer is Locked,")); - DWINUI::Draw_CenteredString(Color_White, 200, F("Scroll to unlock.")); + DWINUI::Draw_CenteredString(Color_White, 180, GET_TEXT_F(MSG_LOCKSCREEN_LOCKED)); + DWINUI::Draw_CenteredString(Color_White, 200, GET_TEXT_F(MSG_LOCKSCREEN_UNLOCK)); DWINUI::Draw_CenteredString(Color_White, 240, F("-> | <-")); DWIN_Draw_Box(1, HMI_data.Barfill_Color, 0, 260, DWIN_WIDTH, 20); DWIN_Draw_VLine(Color_Yellow, lock_pos * DWIN_WIDTH / 255, 260, 20); diff --git a/Marlin/src/lcd/e3v2/proui/meshviewer.cpp b/Marlin/src/lcd/e3v2/proui/meshviewer.cpp index 0b22ae98d5ef..6121ab35d45f 100644 --- a/Marlin/src/lcd/e3v2/proui/meshviewer.cpp +++ b/Marlin/src/lcd/e3v2/proui/meshviewer.cpp @@ -67,7 +67,7 @@ void MeshViewerClass::DrawMesh(bed_mesh_t zval, const uint8_t sizex, const uint8 max = (float)maxz / 100; min = (float)minz / 100; avg = avg / (100 * sizex * sizey); - DWINUI::ClearMenuArea(); + DWINUI::ClearMainArea(); DWIN_Draw_Rectangle(0, HMI_data.SplitLine_Color, px(0), py(0), px(sizex - 1), py(sizey - 1)); LOOP_S_L_N(x, 1, sizex - 1) DrawMeshVLine(x); LOOP_S_L_N(y, 1, sizey - 1) DrawMeshHLine(y); @@ -90,7 +90,7 @@ void MeshViewerClass::DrawMesh(bed_mesh_t zval, const uint8_t sizex, const uint8 sprintf_P(str_1, PSTR("-.%02i"), -zmesh[x][y]); break; case 0: - DWIN_Draw_String(false, font6x12, DWINUI::textcolor, DWINUI::backcolor, px(x) - 4, py(y) - 6, "0");; + DWIN_Draw_String(false, font6x12, DWINUI::textcolor, DWINUI::backcolor, px(x) - 4, py(y) - 6, "0"); break; case 1 ... 99: sprintf_P(str_1, PSTR(".%02i"), zmesh[x][y]); @@ -107,13 +107,16 @@ void MeshViewerClass::DrawMesh(bed_mesh_t zval, const uint8_t sizex, const uint8 } void MeshViewerClass::Draw(bool withsave /*= false*/) { - Title.ShowCaption(F("Mesh Viewer")); + Title.ShowCaption(GET_TEXT_F(MSG_MESH_VIEWER)); DrawMesh(Z_VALUES_ARR, GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y); if (withsave) { DWINUI::Draw_Button(BTN_Save, 26, 305); DWINUI::Draw_Button(BTN_Continue, 146, 305); Draw_Select_Highlight(HMI_flag.select_flag, 305); - } else DWINUI::Draw_Button(BTN_Continue, 86, 305); + } + else + DWINUI::Draw_Button(BTN_Continue, 86, 305); + char str_1[6], str_2[6] = ""; ui.status_printf(0, F("Mesh minZ: %s, maxZ: %s"), dtostrf(min, 1, 2, str_1), diff --git a/Marlin/src/lcd/e3v2/proui/printstats.cpp b/Marlin/src/lcd/e3v2/proui/printstats.cpp index d4ca4ca2255f..f33d0d15faa9 100644 --- a/Marlin/src/lcd/e3v2/proui/printstats.cpp +++ b/Marlin/src/lcd/e3v2/proui/printstats.cpp @@ -50,7 +50,7 @@ void PrintStatsClass::Draw() { constexpr int8_t MRG = 30; Title.ShowCaption(GET_TEXT_F(MSG_INFO_STATS_MENU)); - DWINUI::ClearMenuArea(); + DWINUI::ClearMainArea(); Draw_Popup_Bkgd(); DWINUI::Draw_Button(BTN_Continue, 86, 250); printStatistics ps = print_job_timer.getStats(); diff --git a/Marlin/src/lcd/language/language_de.h b/Marlin/src/lcd/language/language_de.h index 76dd48a9f5c9..111608dd4671 100644 --- a/Marlin/src/lcd/language/language_de.h +++ b/Marlin/src/lcd/language/language_de.h @@ -329,8 +329,8 @@ namespace Language_de { LSTR MSG_PID_AUTOTUNE_E = _UxGT("PID Autotune *"); LSTR MSG_PID_CYCLE = _UxGT("PID Zyklus"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("PID Tuning fertig"); - LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Autotune fehlge. Falscher Extruder"); - LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Autotune fehlge. Temperatur zu hoch."); + LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Autotune fehlge.! Falscher Extruder"); + LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Autotune fehlge.! Temperatur zu hoch."); LSTR MSG_PID_TIMEOUT = _UxGT("Autotune fehlge.! Timeout."); LSTR MSG_MPC_MEASURING_AMBIENT = _UxGT("teste Wärmeverlust"); LSTR MSG_MPC_AUTOTUNE = _UxGT("Autotune MPC"); diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 6492508f26fb..7e9dc2bdf266 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -54,6 +54,7 @@ namespace Language_en { LSTR MSG_YES = _UxGT("YES"); LSTR MSG_NO = _UxGT("NO"); LSTR MSG_BACK = _UxGT("Back"); + LSTR MSG_ERROR = _UxGT("Error"); LSTR MSG_MEDIA_ABORTING = _UxGT("Aborting..."); LSTR MSG_MEDIA_INSERTED = MEDIA_TYPE_EN _UxGT(" Inserted"); LSTR MSG_MEDIA_REMOVED = MEDIA_TYPE_EN _UxGT(" Removed"); @@ -346,8 +347,11 @@ namespace Language_en { LSTR MSG_PID_AUTOTUNE_E = _UxGT("PID Autotune *"); LSTR MSG_PID_CYCLE = _UxGT("PID Cycles"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("PID tuning done"); - LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Autotune failed. Bad extruder."); - LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Autotune failed. Temperature too high."); + LSTR MSG_PID_AUTOTUNE_FAILED = _UxGT("PID Autotune failed!"); + LSTR MSG_BAD_EXTRUDER_NUM = _UxGT("Bad extruder."); + LSTR MSG_TEMP_TOO_HIGH = _UxGT("Temperature too high."); + LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Autotune failed! Bad extruder."); + LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Autotune failed! Temperature too high."); LSTR MSG_PID_TIMEOUT = _UxGT("Autotune failed! Timeout."); LSTR MSG_MPC_MEASURING_AMBIENT = _UxGT("Testing heat loss"); LSTR MSG_MPC_AUTOTUNE = _UxGT("MPC Autotune"); @@ -629,6 +633,9 @@ namespace Language_en { LSTR MSG_CASE_LIGHT_BRIGHTNESS = _UxGT("Light Brightness"); LSTR MSG_KILL_EXPECTED_PRINTER = _UxGT("INCORRECT PRINTER"); + LSTR MSG_LOCKSCREEN = _UxGT("Lock Screen"); + LSTR MSG_LOCKSCREEN_LOCKED = _UxGT("Printer is Locked,"); + LSTR MSG_LOCKSCREEN_UNLOCK = _UxGT("Scroll to unlock."); #if LCD_WIDTH >= 20 || HAS_DWIN_E3V2 LSTR MSG_MEDIA_NOT_INSERTED = _UxGT("No media inserted."); LSTR MSG_PLEASE_WAIT_REBOOT = _UxGT("Please wait until reboot. "); diff --git a/Marlin/src/lcd/language/language_gl.h b/Marlin/src/lcd/language/language_gl.h index cc57545e6564..55dc03ac9d95 100644 --- a/Marlin/src/lcd/language/language_gl.h +++ b/Marlin/src/lcd/language/language_gl.h @@ -261,9 +261,9 @@ namespace Language_gl { LSTR MSG_PID_AUTOTUNE = _UxGT("Auto-Sint. PID"); LSTR MSG_PID_AUTOTUNE_E = _UxGT("Auto-Sint. PID *"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("Fin Auto-Sint PID"); - LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Auto-Sint. fallida. Extrusor danado."); - LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Auto-Sint. fallida. Temperatura moi alta."); - LSTR MSG_PID_TIMEOUT = _UxGT("Auto-Sint. fallida. Tempo excedido."); + LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Auto-Sint. fallida! Extrusor danado."); + LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Auto-Sint. fallida! Temperatura moi alta."); + LSTR MSG_PID_TIMEOUT = _UxGT("Auto-Sint. fallida! Tempo excedido."); LSTR MSG_SELECT = _UxGT("Escolla"); LSTR MSG_SELECT_E = _UxGT("Escolla *"); LSTR MSG_ACC = _UxGT("Acel"); diff --git a/Marlin/src/lcd/language/language_hu.h b/Marlin/src/lcd/language/language_hu.h index a47b687f3a15..6321ed136741 100644 --- a/Marlin/src/lcd/language/language_hu.h +++ b/Marlin/src/lcd/language/language_hu.h @@ -309,8 +309,8 @@ namespace Language_hu { LSTR MSG_PID_AUTOTUNE_E = _UxGT("PID hangolás *"); LSTR MSG_PID_CYCLE = _UxGT("PID ciklus"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("PID hangolás kész"); - LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Hangolási hiba. Rossz adagoló."); - LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Hangolási hiba. Magas hömérséklet."); + LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Hangolási hiba! Rossz adagoló."); + LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Hangolási hiba! Magas hömérséklet."); LSTR MSG_PID_TIMEOUT = _UxGT("Hangolási hiba! Idötúllépés."); LSTR MSG_SELECT = _UxGT("Kiválaszt"); LSTR MSG_SELECT_E = _UxGT("Kiválaszt *"); diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index 654ecbacbbd2..82c595aa8c22 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -343,8 +343,8 @@ namespace Language_it { LSTR MSG_PID_AUTOTUNE_E = _UxGT("Calib.PID *"); LSTR MSG_PID_CYCLE = _UxGT("Ciclo PID"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("Calibr.PID eseguita"); - LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Calibrazione fallita. Estrusore errato."); - LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Calibrazione fallita. Temperatura troppo alta."); + LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Calibrazione fallita! Estrusore errato."); + LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Calibrazione fallita! Temperatura troppo alta."); LSTR MSG_PID_TIMEOUT = _UxGT("Calibrazione fallita! Tempo scaduto."); LSTR MSG_MPC_MEASURING_AMBIENT = _UxGT("Testing heat loss"); LSTR MSG_MPC_AUTOTUNE = _UxGT("MPC Autotune"); diff --git a/Marlin/src/lcd/language/language_ro.h b/Marlin/src/lcd/language/language_ro.h index c3fc37bf483d..79421752af01 100644 --- a/Marlin/src/lcd/language/language_ro.h +++ b/Marlin/src/lcd/language/language_ro.h @@ -260,8 +260,8 @@ namespace Language_ro { LSTR MSG_PID_AUTOTUNE = _UxGT("PID Autotune"); LSTR MSG_PID_AUTOTUNE_E = _UxGT("PID Autotune *"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("PID tuning done"); - LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Autotune failed. Bad extruder."); - LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Autotune failed. Temperature too high."); + LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Autotune failed! Bad extruder."); + LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Autotune failed! Temperature too high."); LSTR MSG_PID_TIMEOUT = _UxGT("Autotune failed! Timeout."); LSTR MSG_SELECT = _UxGT("Select"); LSTR MSG_SELECT_E = _UxGT("Select *"); diff --git a/Marlin/src/lcd/language/language_ru.h b/Marlin/src/lcd/language/language_ru.h index 4b52c926087b..4b8d4703e453 100644 --- a/Marlin/src/lcd/language/language_ru.h +++ b/Marlin/src/lcd/language/language_ru.h @@ -390,8 +390,8 @@ namespace Language_ru { LSTR MSG_PID_AUTOTUNE = _UxGT("Автоподбор PID"); LSTR MSG_PID_AUTOTUNE_E = _UxGT("Автоподбор PID *"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("Подбор PID выполнен"); - LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Сбой автоподбора. Плохой экструдер."); - LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Сбой автоподбора. Температура повышена."); + LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Сбой автоподбора! Плохой экструдер."); + LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Сбой автоподбора! Температура повышена."); LSTR MSG_PID_TIMEOUT = _UxGT("Сбой автоподбора! Завершение времени."); LSTR MSG_SELECT = _UxGT("Выбор"); diff --git a/Marlin/src/lcd/language/language_sk.h b/Marlin/src/lcd/language/language_sk.h index 80cca911e53f..7ba505ede511 100644 --- a/Marlin/src/lcd/language/language_sk.h +++ b/Marlin/src/lcd/language/language_sk.h @@ -337,8 +337,8 @@ namespace Language_sk { LSTR MSG_PID_AUTOTUNE_E = _UxGT("Kalibrácia PID *"); LSTR MSG_PID_CYCLE = _UxGT("Cykly PID"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("Kal. PID dokončená"); - LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Auto-kal. zlyhala. Zlý extrúder."); - LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Auto-kal. zlyhala. Príliš vysoká tepl."); + LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Auto-kal. zlyhala! Zlý extrúder."); + LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Auto-kal. zlyhala! Príliš vysoká tepl."); LSTR MSG_PID_TIMEOUT = _UxGT("Auto-kal. zlyhala! Čas vypršal."); LSTR MSG_SELECT = _UxGT("Vybrať"); LSTR MSG_SELECT_E = _UxGT("Vybrať *"); diff --git a/Marlin/src/lcd/language/language_sv.h b/Marlin/src/lcd/language/language_sv.h index c077da1e6925..db2196fa46ae 100644 --- a/Marlin/src/lcd/language/language_sv.h +++ b/Marlin/src/lcd/language/language_sv.h @@ -290,8 +290,8 @@ namespace Language_sv { LSTR MSG_PID_AUTOTUNE = _UxGT("PID Autojustera"); LSTR MSG_PID_AUTOTUNE_E = _UxGT("PID Autojustera *"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("PID tuning done"); - LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Autojustera misslyckad. Dålig extruder."); - LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Autojustera misslyckad. Temperatur för hög."); + LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Autojustera misslyckad! Dålig extruder."); + LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Autojustera misslyckad! Temperatur för hög."); LSTR MSG_PID_TIMEOUT = _UxGT("Autojustera misslyckad! Tidsgräns."); LSTR MSG_SELECT = _UxGT("Välj"); LSTR MSG_SELECT_E = _UxGT("Välj *"); diff --git a/Marlin/src/lcd/language/language_uk.h b/Marlin/src/lcd/language/language_uk.h index 892eb57cf629..bfb74b9f6e9b 100644 --- a/Marlin/src/lcd/language/language_uk.h +++ b/Marlin/src/lcd/language/language_uk.h @@ -395,8 +395,8 @@ namespace Language_uk { LSTR MSG_PID_AUTOTUNE = _UxGT("Автопідбір PID"); LSTR MSG_PID_AUTOTUNE_E = _UxGT("Автопідбір PID *"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("Підбір PID виконано"); - LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Збій автопідбору. Поганий екструдер."); - LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Збій автопідбору. Температура завищена."); + LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Збій автопідбору! Поганий екструдер."); + LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Збій автопідбору! Температура завищена."); LSTR MSG_PID_TIMEOUT = _UxGT("Збій автопідбору! Вичерпан час."); LSTR MSG_SELECT = _UxGT("Вибрати"); diff --git a/Marlin/src/lcd/language/language_zh_CN.h b/Marlin/src/lcd/language/language_zh_CN.h index e947cee661b1..f2d348b3965b 100644 --- a/Marlin/src/lcd/language/language_zh_CN.h +++ b/Marlin/src/lcd/language/language_zh_CN.h @@ -260,8 +260,8 @@ namespace Language_zh_CN { LSTR MSG_PID_AUTOTUNE = _UxGT("自动PID"); LSTR MSG_PID_AUTOTUNE_E = _UxGT("自动PID *"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("PID调整完成"); - LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("自动调失败. 坏的挤出机"); - LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("自动调失败. 温度太高"); + LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("自动调失败! 坏的挤出机"); + LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("自动调失败! 温度太高"); LSTR MSG_PID_TIMEOUT = _UxGT("自动调失败! 超时"); LSTR MSG_SELECT = _UxGT("选择"); // "Select" LSTR MSG_SELECT_E = _UxGT("选择 *"); diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp index bcdff450bd4c..d56bc9b5ff1b 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -163,10 +163,6 @@ void MenuEditItemBase::goto_edit_screen( #include "../../MarlinCore.h" -bool printer_busy() { - return planner.movesplanned() || printingIsActive(); -} - /** * General function to go directly to a screen */ diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index b111236d69cd..288dd5be2fed 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -30,7 +30,6 @@ extern int8_t encoderLine, encoderTopLine, screen_items; void scroll_screen(const uint8_t limit, const bool is_menu); -bool printer_busy(); typedef void (*selectFunc_t)(); diff --git a/Marlin/src/lcd/menu/menu_bed_leveling.cpp b/Marlin/src/lcd/menu/menu_bed_leveling.cpp index a47e2517aedf..f6add52f570c 100644 --- a/Marlin/src/lcd/menu/menu_bed_leveling.cpp +++ b/Marlin/src/lcd/menu/menu_bed_leveling.cpp @@ -230,7 +230,7 @@ * Mesh Z Offset: --- (Req: MESH_BED_LEVELING) * Z Probe Offset: --- (Req: HAS_BED_PROBE, Opt: BABYSTEP_ZPROBE_OFFSET) * Level Bed > - * Level Corners > (if homed) + * Bed Tramming > (if homed) * Load Settings (Req: EEPROM_SETTINGS) * Save Settings (Req: EEPROM_SETTINGS) */ diff --git a/Marlin/src/libs/BL24CXX.cpp b/Marlin/src/libs/BL24CXX.cpp index 59352d4380c1..4b5a23e4c550 100644 --- a/Marlin/src/libs/BL24CXX.cpp +++ b/Marlin/src/libs/BL24CXX.cpp @@ -54,11 +54,11 @@ #endif // IO ops -#define IIC_SCL_0() WRITE(IIC_EEPROM_SCL, LOW) -#define IIC_SCL_1() WRITE(IIC_EEPROM_SCL, HIGH) -#define IIC_SDA_0() WRITE(IIC_EEPROM_SDA, LOW) -#define IIC_SDA_1() WRITE(IIC_EEPROM_SDA, HIGH) -#define READ_SDA() READ(IIC_EEPROM_SDA) +#define IIC_SCL_0() WRITE(IIC_EEPROM_SCL, LOW) +#define IIC_SCL_1() WRITE(IIC_EEPROM_SCL, HIGH) +#define IIC_SDA_0() WRITE(IIC_EEPROM_SDA, LOW) +#define IIC_SDA_1() WRITE(IIC_EEPROM_SDA, HIGH) +#define READ_SDA() READ(IIC_EEPROM_SDA) // // Simple IIC interface via libmaple diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index cf91dc25b4fc..2d74751a82f0 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -1517,7 +1517,7 @@ void MarlinSettings::postprocess() { { _FIELD_TEST(dwin_data); char dwin_data[eeprom_data_size] = { 0 }; - DWIN_StoreSettings(dwin_data); + DWIN_CopySettingsTo(dwin_data); EEPROM_WRITE(dwin_data); } #endif @@ -2493,7 +2493,7 @@ void MarlinSettings::postprocess() { const char dwin_data[eeprom_data_size] = { 0 }; _FIELD_TEST(dwin_data); EEPROM_READ(dwin_data); - if (!validating) DWIN_LoadSettings(dwin_data); + if (!validating) DWIN_CopySettingsFrom(dwin_data); } #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) { @@ -2929,7 +2929,6 @@ void MarlinSettings::reset() { #endif #endif - TERN_(DWIN_LCD_PROUI, DWIN_SetDataDefaults()); TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWIN.Reset_Settings()); // @@ -3304,6 +3303,11 @@ void MarlinSettings::reset() { // TERN_(DGUS_LCD_UI_MKS, MKS_reset_settings()); + // + // Ender-3 V2 with ProUI + // + TERN_(DWIN_LCD_PROUI, DWIN_SetDataDefaults()); + // // Model predictive control // From ecc138fc9e15b0805448dcf58a0e7c753bdbe098 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Fri, 13 May 2022 16:07:27 +1200 Subject: [PATCH 049/241] =?UTF-8?q?=F0=9F=94=A7=20AVR/DUE=20Serial=20Port?= =?UTF-8?q?=20pin=20conflict=20checks=20(#24148)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/HAL/AVR/inc/SanityCheck.h | 24 ++++++++++++++++++++ Marlin/src/HAL/DUE/inc/SanityCheck.h | 24 ++++++++++++++++++++ Marlin/src/pins/mega/pins_GT2560_V3_MC2.h | 8 +++---- Marlin/src/pins/pins_postprocess.h | 27 +++++++++++++++++++++++ buildroot/tests/FYSETC_F6 | 2 +- 5 files changed, 80 insertions(+), 5 deletions(-) diff --git a/Marlin/src/HAL/AVR/inc/SanityCheck.h b/Marlin/src/HAL/AVR/inc/SanityCheck.h index 15a5be4cd257..7936de8b9903 100644 --- a/Marlin/src/HAL/AVR/inc/SanityCheck.h +++ b/Marlin/src/HAL/AVR/inc/SanityCheck.h @@ -25,6 +25,30 @@ * Test AVR-specific configuration values for errors at compile-time. */ +/** + * Check for common serial pin conflicts + */ +#define CHECK_SERIAL_PIN(N) ( \ + X_STOP_PIN == N || Y_STOP_PIN == N || Z_STOP_PIN == N \ + || X_MIN_PIN == N || Y_MIN_PIN == N || Z_MIN_PIN == N \ + || X_MAX_PIN == N || Y_MAX_PIN == N || Z_MAX_PIN == N \ + || X_STEP_PIN == N || Y_STEP_PIN == N || Z_STEP_PIN == N \ + || X_DIR_PIN == N || Y_DIR_PIN == N || Z_DIR_PIN == N \ + || X_ENA_PIN == N || Y_ENA_PIN == N || Z_ENA_PIN == N \ +) +#if CONF_SERIAL_IS(0) // D0-D1. No known conflicts. +#endif +#if CONF_SERIAL_IS(1) && (CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19)) + #error "Serial Port 1 pin D18 and/or D19 conflicts with another pin on the board." +#endif +#if CONF_SERIAL_IS(2) && (CHECK_SERIAL_PIN(16) || CHECK_SERIAL_PIN(17)) + #error "Serial Port 2 pin D16 and/or D17 conflicts with another pin on the board." +#endif +#if CONF_SERIAL_IS(3) && (CHECK_SERIAL_PIN(14) || CHECK_SERIAL_PIN(15)) + #error "Serial Port 3 pin D14 and/or D15 conflicts with another pin on the board." +#endif +#undef CHECK_SERIAL_PIN + /** * Checks for FAST PWM */ diff --git a/Marlin/src/HAL/DUE/inc/SanityCheck.h b/Marlin/src/HAL/DUE/inc/SanityCheck.h index 75480acaf2e2..dd37a7bde183 100644 --- a/Marlin/src/HAL/DUE/inc/SanityCheck.h +++ b/Marlin/src/HAL/DUE/inc/SanityCheck.h @@ -25,6 +25,30 @@ * Test Arduino Due specific configuration values for errors at compile-time. */ +/** + * Check for common serial pin conflicts + */ +#define CHECK_SERIAL_PIN(N) ( \ + X_STOP_PIN == N || Y_STOP_PIN == N || Z_STOP_PIN == N \ + || X_MIN_PIN == N || Y_MIN_PIN == N || Z_MIN_PIN == N \ + || X_MAX_PIN == N || Y_MAX_PIN == N || Z_MAX_PIN == N \ + || X_STEP_PIN == N || Y_STEP_PIN == N || Z_STEP_PIN == N \ + || X_DIR_PIN == N || Y_DIR_PIN == N || Z_DIR_PIN == N \ + || X_ENA_PIN == N || Y_ENA_PIN == N || Z_ENA_PIN == N \ +) +#if CONF_SERIAL_IS(0) // D0-D1. No known conflicts. +#endif +#if CONF_SERIAL_IS(1) && (CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19)) + #error "Serial Port 1 pin D18 and/or D19 conflicts with another pin on the board." +#endif +#if CONF_SERIAL_IS(2) && (CHECK_SERIAL_PIN(16) || CHECK_SERIAL_PIN(17)) + #error "Serial Port 2 pin D16 and/or D17 conflicts with another pin on the board." +#endif +#if CONF_SERIAL_IS(3) && (CHECK_SERIAL_PIN(14) || CHECK_SERIAL_PIN(15)) + #error "Serial Port 3 pin D14 and/or D15 conflicts with another pin on the board." +#endif +#undef CHECK_SERIAL_PIN + /** * HARDWARE VS. SOFTWARE SPI COMPATIBILITY * diff --git a/Marlin/src/pins/mega/pins_GT2560_V3_MC2.h b/Marlin/src/pins/mega/pins_GT2560_V3_MC2.h index 6b22b4139b6d..e683d4dfda4b 100644 --- a/Marlin/src/pins/mega/pins_GT2560_V3_MC2.h +++ b/Marlin/src/pins/mega/pins_GT2560_V3_MC2.h @@ -27,9 +27,9 @@ #define BOARD_INFO_NAME "GT2560 V3.0 (MC2)" -#define X_MIN_PIN 22 -#define X_MAX_PIN 24 -#define Y_MIN_PIN 26 -#define Y_MAX_PIN 28 +#define X_MIN_PIN 22 +#define X_MAX_PIN 24 +#define Y_MIN_PIN 26 +#define Y_MAX_PIN 28 #include "pins_GT2560_V3.h" diff --git a/Marlin/src/pins/pins_postprocess.h b/Marlin/src/pins/pins_postprocess.h index 990f40ad4de8..c3c217557beb 100644 --- a/Marlin/src/pins/pins_postprocess.h +++ b/Marlin/src/pins/pins_postprocess.h @@ -1664,6 +1664,9 @@ #undef X_MAX_PIN #define X_MAX_PIN -1 #endif +#if NONE(USE_XMIN_PLUG, USE_XMAX_PLUG) + #undef X_STOP_PIN +#endif #if DISABLED(USE_YMIN_PLUG) #undef Y_MIN_PIN #define Y_MIN_PIN -1 @@ -1672,6 +1675,9 @@ #undef Y_MAX_PIN #define Y_MAX_PIN -1 #endif +#if NONE(USE_YMIN_PLUG, USE_YMAX_PLUG) + #undef Y_STOP_PIN +#endif #if DISABLED(USE_ZMIN_PLUG) #undef Z_MIN_PIN #define Z_MIN_PIN -1 @@ -1680,6 +1686,9 @@ #undef Z_MAX_PIN #define Z_MAX_PIN -1 #endif +#if NONE(USE_ZMIN_PLUG, USE_ZMAX_PLUG) + #undef Z_STOP_PIN +#endif #if DISABLED(USE_IMIN_PLUG) #undef I_MIN_PIN #define I_MIN_PIN -1 @@ -1688,6 +1697,9 @@ #undef I_MAX_PIN #define I_MAX_PIN -1 #endif +#if NONE(USE_IMIN_PLUG, USE_IMAX_PLUG) + #undef I_STOP_PIN +#endif #if DISABLED(USE_JMIN_PLUG) #undef J_MIN_PIN #define J_MIN_PIN -1 @@ -1696,6 +1708,9 @@ #undef J_MAX_PIN #define J_MAX_PIN -1 #endif +#if NONE(USE_JMIN_PLUG, USE_JMAX_PLUG) + #undef J_STOP_PIN +#endif #if DISABLED(USE_KMIN_PLUG) #undef K_MIN_PIN #define K_MIN_PIN -1 @@ -1704,6 +1719,9 @@ #undef K_MAX_PIN #define K_MAX_PIN -1 #endif +#if NONE(USE_KMIN_PLUG, USE_KMAX_PLUG) + #undef K_STOP_PIN +#endif #if DISABLED(USE_UMIN_PLUG) #undef U_MIN_PIN #define U_MIN_PIN -1 @@ -1712,6 +1730,9 @@ #undef U_MAX_PIN #define U_MAX_PIN -1 #endif +#if NONE(USE_UMIN_PLUG, USE_UMAX_PLUG) + #undef U_STOP_PIN +#endif #if DISABLED(USE_VMIN_PLUG) #undef V_MIN_PIN #define V_MIN_PIN -1 @@ -1720,6 +1741,9 @@ #undef V_MAX_PIN #define V_MAX_PIN -1 #endif +#if NONE(USE_VMIN_PLUG, USE_VMAX_PLUG) + #undef V_STOP_PIN +#endif #if DISABLED(USE_WMIN_PLUG) #undef W_MIN_PIN #define W_MIN_PIN -1 @@ -1728,6 +1752,9 @@ #undef W_MAX_PIN #define W_MAX_PIN -1 #endif +#if NONE(USE_WMIN_PLUG, USE_WMAX_PLUG) + #undef W_STOP_PIN +#endif #if DISABLED(X_DUAL_ENDSTOPS) || X_HOME_TO_MAX #undef X2_MIN_PIN diff --git a/buildroot/tests/FYSETC_F6 b/buildroot/tests/FYSETC_F6 index 9306686af5ce..17f8eb42b1e2 100755 --- a/buildroot/tests/FYSETC_F6 +++ b/buildroot/tests/FYSETC_F6 @@ -10,7 +10,7 @@ set -e # Build with the default configurations # restore_configs -opt_set MOTHERBOARD BOARD_FYSETC_F6_13 +opt_set MOTHERBOARD BOARD_FYSETC_F6_13 LCD_SERIAL_PORT 1 opt_enable DGUS_LCD_UI_FYSETC exec_test $1 $2 "FYSETC F6 1.3 with DGUS" "$3" From cb31a9931938a65f2ac5022e06ddd044d464f78d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 12 May 2022 23:29:29 -0500 Subject: [PATCH 050/241] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20Fix=20MSG=5FLOCKSC?= =?UTF-8?q?REEN?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/language/language_en.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 7e9dc2bdf266..03f4f62b1750 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -654,7 +654,6 @@ namespace Language_en { LSTR MSG_COLORS_WHITE = _UxGT("White"); LSTR MSG_UI_LANGUAGE = _UxGT("UI Language"); LSTR MSG_SOUND_ENABLE = _UxGT("Enable sound"); - LSTR MSG_LOCKSCREEN = _UxGT("Lock Screen"); #else LSTR MSG_MEDIA_NOT_INSERTED = _UxGT("No Media"); LSTR MSG_PLEASE_PREHEAT = _UxGT("Please Preheat"); From b934a4c612a09cfd577e3811df01e8a2fdbb81dd Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 12 May 2022 23:40:56 -0500 Subject: [PATCH 051/241] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20printer=5Fbusy,=20?= =?UTF-8?q?M73?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to "Misc. LCD cleanup" --- Marlin/src/lcd/e3v2/proui/dwin.cpp | 2 +- Marlin/src/lcd/menu/menu_advanced.cpp | 1 + Marlin/src/lcd/menu/menu_configuration.cpp | 2 ++ Marlin/src/lcd/menu/menu_filament.cpp | 3 +++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 68d4010ef698..7d87725b8158 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -1652,8 +1652,8 @@ void DWIN_Print_Aborted() { } // Progress Bar update - if (parser.seenval('P')) _percent_done = parser.byteval('P'); void DWIN_M73() { + if (parser.seenval('P')) _percent_done = parser.byteval('P'); if (parser.seenval('R')) { _remain_time = parser.ulongval('R') * 60; HMI_flag.remain_flag = true; diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 214ff133b2b8..b786931a42f0 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -29,6 +29,7 @@ #if HAS_MARLINUI_MENU #include "menu_item.h" +#include "../../MarlinCore.h" #include "../../module/planner.h" #if DISABLED(NO_VOLUMETRICS) diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp index f91ea60ad9a3..d755706b1612 100644 --- a/Marlin/src/lcd/menu/menu_configuration.cpp +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -30,6 +30,8 @@ #include "menu_item.h" +#include "../../MarlinCore.h" + #if HAS_FILAMENT_SENSOR #include "../../feature/runout.h" #endif diff --git a/Marlin/src/lcd/menu/menu_filament.cpp b/Marlin/src/lcd/menu/menu_filament.cpp index 9f432c405c4f..03ac6e512cf8 100644 --- a/Marlin/src/lcd/menu/menu_filament.cpp +++ b/Marlin/src/lcd/menu/menu_filament.cpp @@ -35,6 +35,9 @@ #if HAS_FILAMENT_SENSOR #include "../../feature/runout.h" #endif +#if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) + #include "../../MarlinCore.h" +#endif // // Change Filament > Change/Unload/Load Filament From 8ccc601218d96f6735d69719afce2cfc2551dbfc Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Thu, 12 May 2022 22:41:38 -0700 Subject: [PATCH 052/241] =?UTF-8?q?=F0=9F=8E=A8=20Clean=20up=20warnings=20?= =?UTF-8?q?/=20extra=20check=20(#24163)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/calibrate/G76_M871.cpp | 10 +++++----- Marlin/src/inc/SanityCheck.h | 10 ---------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/Marlin/src/gcode/calibrate/G76_M871.cpp b/Marlin/src/gcode/calibrate/G76_M871.cpp index ad13b20306ae..c484d4f1b770 100644 --- a/Marlin/src/gcode/calibrate/G76_M871.cpp +++ b/Marlin/src/gcode/calibrate/G76_M871.cpp @@ -82,13 +82,13 @@ * - `P` - Run probe temperature calibration. */ -static void say_waiting_for() { SERIAL_ECHOPGM("Waiting for "); } -static void say_waiting_for_probe_heating() { say_waiting_for(); SERIAL_ECHOLNPGM("probe heating."); } -static void say_successfully_calibrated() { SERIAL_ECHOPGM("Successfully calibrated"); } -static void say_failed_to_calibrate() { SERIAL_ECHOPGM("!Failed to calibrate"); } - #if BOTH(PTC_PROBE, PTC_BED) + static void say_waiting_for() { SERIAL_ECHOPGM("Waiting for "); } + static void say_waiting_for_probe_heating() { say_waiting_for(); SERIAL_ECHOLNPGM("probe heating."); } + static void say_successfully_calibrated() { SERIAL_ECHOPGM("Successfully calibrated"); } + static void say_failed_to_calibrate() { SERIAL_ECHOPGM("!Failed to calibrate"); } + void GcodeSuite::G76() { auto report_temps = [](millis_t &ntr, millis_t timeout=0) { idle_no_sleep(); diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index c800dae9b495..2dc81cbee70a 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2381,16 +2381,6 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #endif #endif -#if TEMP_SENSOR_PROBE - #if !PIN_EXISTS(TEMP_PROBE) - #error "TEMP_SENSOR_PROBE requires TEMP_PROBE_PIN." - #elif !HAS_TEMP_ADC_PROBE - #error "TEMP_PROBE_PIN must be an ADC pin." - #elif DISABLED(FIX_MOUNTED_PROBE) - #error "TEMP_SENSOR_PROBE shouldn't be set without FIX_MOUNTED_PROBE." - #endif -#endif - #if TEMP_SENSOR_BOARD #if !PIN_EXISTS(TEMP_BOARD) #error "TEMP_SENSOR_BOARD requires TEMP_BOARD_PIN." From e438c77c6a5bb59966d39a6ea6aa7703ec4131a3 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 4 May 2022 19:10:14 -0500 Subject: [PATCH 053/241] =?UTF-8?q?=F0=9F=9A=9A=20Move=20speed=5Flookuptab?= =?UTF-8?q?le.h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/stepper.cpp | 2 +- Marlin/src/module/stepper.h | 2 +- Marlin/src/module/{ => stepper}/speed_lookuptable.h | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename Marlin/src/module/{ => stepper}/speed_lookuptable.h (100%) diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index aadea0f1c698..60eb635965f3 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -84,7 +84,7 @@ Stepper stepper; // Singleton #define BABYSTEPPING_EXTRA_DIR_WAIT #ifdef __AVR__ - #include "speed_lookuptable.h" + #include "stepper/speed_lookuptable.h" #endif #include "endstops.h" diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h index 47a4847b822f..09117f44c6b5 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -46,7 +46,7 @@ #include "planner.h" #include "stepper/indirection.h" #ifdef __AVR__ - #include "speed_lookuptable.h" + #include "stepper/speed_lookuptable.h" #endif // Disable multiple steps per ISR diff --git a/Marlin/src/module/speed_lookuptable.h b/Marlin/src/module/stepper/speed_lookuptable.h similarity index 100% rename from Marlin/src/module/speed_lookuptable.h rename to Marlin/src/module/stepper/speed_lookuptable.h From c1b53d63fc5a7fa5f17e5459e632cd8e7a0fd5ec Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 4 May 2022 15:14:31 -0500 Subject: [PATCH 054/241] =?UTF-8?q?=F0=9F=8E=A8=20Nextion=20cleanup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/lcd/extui/nextion/nextion_extui.cpp | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Marlin/src/lcd/extui/nextion/nextion_extui.cpp b/Marlin/src/lcd/extui/nextion/nextion_extui.cpp index da54fac38349..0e84fd33cf4f 100644 --- a/Marlin/src/lcd/extui/nextion/nextion_extui.cpp +++ b/Marlin/src/lcd/extui/nextion/nextion_extui.cpp @@ -35,25 +35,25 @@ namespace ExtUI { - void onStartup() { nextion.Startup(); } - void onIdle() { nextion.IdleLoop(); } + void onStartup() { nextion.Startup(); } + void onIdle() { nextion.IdleLoop(); } void onPrinterKilled(FSTR_P const error, FSTR_P const component) { nextion.PrinterKilled(error, component); } void onMediaInserted() {} - void onMediaError() {} - void onMediaRemoved() {} + void onMediaError() {} + void onMediaRemoved() {} void onPlayTone(const uint16_t frequency, const uint16_t duration) {} void onPrintTimerStarted() {} - void onPrintTimerPaused() {} + void onPrintTimerPaused() {} void onPrintTimerStopped() {} - void onFilamentRunout(const extruder_t) {} + void onFilamentRunout(const extruder_t) {} void onUserConfirmRequired(const char * const msg) { nextion.ConfirmationRequest(msg); } - void onStatusChanged(const char * const msg) { nextion.StatusChange(msg); } + void onStatusChanged(const char * const msg) { nextion.StatusChange(msg); } - void onHomingStart() {} + void onHomingStart() {} void onHomingDone() {} - void onPrintDone() { nextion.PrintFinished(); } + void onPrintDone() { nextion.PrintFinished(); } - void onFactoryReset() {} + void onFactoryReset() {} void onStoreSettings(char *buff) { // Called when saving to EEPROM (i.e. M500). If the ExtUI needs @@ -61,7 +61,7 @@ namespace ExtUI { // into buff. // Example: - // static_assert(sizeof(myDataStruct) <= ExtUI::eeprom_data_size); + // static_assert(sizeof(myDataStruct) <= eeprom_data_size); // memcpy(buff, &myDataStruct, sizeof(myDataStruct)); } @@ -71,7 +71,7 @@ namespace ExtUI { // from buff // Example: - // static_assert(sizeof(myDataStruct) <= ExtUI::eeprom_data_size); + // static_assert(sizeof(myDataStruct) <= eeprom_data_size); // memcpy(&myDataStruct, buff, sizeof(myDataStruct)); } @@ -97,7 +97,7 @@ namespace ExtUI { // Called when any mesh points are updated } - void onMeshUpdate(const int8_t xpos, const int8_t ypos, const ExtUI::probe_state_t state) { + void onMeshUpdate(const int8_t xpos, const int8_t ypos, const probe_state_t state) { // Called to indicate a special condition } #endif From a7ade2d63e1fb7fe0740f5a07958611ffc796ae8 Mon Sep 17 00:00:00 2001 From: Roxy-3D Date: Fri, 13 May 2022 17:29:50 -0500 Subject: [PATCH 055/241] =?UTF-8?q?=F0=9F=94=A8=20BTT=20Octopus=20ST-Link?= =?UTF-8?q?=20programming/debugging?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ini/stm32f4.ini | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 260593f8a295..688cc1054736 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -251,11 +251,14 @@ build_unflags = ${env:BIGTREE_SKR_2_F429_USB.build_unflags} -Os -NDEBUG # BigTreeTech Octopus V1.0/1.1 / Octopus Pro V1.0 (STM32F446ZET6 ARM Cortex-M4) # [env:BIGTREE_OCTOPUS_V1] -extends = stm32_variant -board = marlin_BigTree_Octopus_v1 -board_build.offset = 0x8000 -build_flags = ${stm32_variant.build_flags} - -DSTM32F446_5VX -DUSE_USB_HS_IN_FS +extends = stm32_variant +board = marlin_BigTree_Octopus_v1 +board_build.offset = 0x8000 +board_upload.offset_address = 0x08008000 +debug_tool = stlink +upload_protocol = stlink +build_flags = ${stm32_variant.build_flags} + -DSTM32F446_5VX -DUSE_USB_HS_IN_FS # # BigTreeTech Octopus V1.0/1.1 / Octopus Pro V1.0 (STM32F446ZET6 ARM Cortex-M4) with USB Flash Drive Support @@ -274,11 +277,14 @@ build_flags = ${stm_flash_drive.build_flags} # BigTreeTech Octopus Pro V1.0 (STM32F429ZGT6 ARM Cortex-M4) # [env:BIGTREE_OCTOPUS_PRO_V1_F429] -extends = stm32_variant -board = marlin_BigTree_Octopus_Pro_v1_F429 -board_build.offset = 0x8000 -build_flags = ${stm32_variant.build_flags} - -DUSE_USB_HS_IN_FS +extends = stm32_variant +board = marlin_BigTree_Octopus_Pro_v1_F429 +board_build.offset = 0x8000 +board_upload.offset_address = 0x08008000 +debug_tool = stlink +upload_protocol = stlink +build_flags = ${stm32_variant.build_flags} + -DUSE_USB_HS_IN_FS # # BigTreeTech Octopus Pro V1.0 (STM32F429ZGT6 ARM Cortex-M4) with USB Flash Drive Support From 6c2249451e006d957275899bd707946d77465b20 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 13 May 2022 19:06:25 -0500 Subject: [PATCH 056/241] [cron] Bump distribution date (2022-05-14) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 5c472c3e4603..e8bfed01bdc6 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-05-13" +//#define STRING_DISTRIBUTION_DATE "2022-05-14" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index c94769084f94..8f69ed3c881e 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-05-13" + #define STRING_DISTRIBUTION_DATE "2022-05-14" #endif /** From eb352b11b9653150e902e9b664dda83618c056cc Mon Sep 17 00:00:00 2001 From: grauerfuchs <42082416+grauerfuchs@users.noreply.github.com> Date: Fri, 13 May 2022 20:08:50 -0400 Subject: [PATCH 057/241] =?UTF-8?q?=F0=9F=90=9B=20Fix=20Mightyboard=20LED?= =?UTF-8?q?=20pin,=20fan=20override=20(#24168)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h index 13ffc9448640..c44b1f449c71 100644 --- a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h +++ b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h @@ -166,19 +166,23 @@ #ifndef E0_AUTO_FAN_PIN #define E0_AUTO_FAN_PIN MOSFET_2_PIN #else - #define FAN_PIN MOSFET_2_PIN + #ifndef FAN_PIN + #define FAN_PIN MOSFET_2_PIN + #endif #endif // EX2 FAN (Automatic Fans are disabled by default in Configuration_adv.h - comment that out for auto fans) #ifndef E1_AUTO_FAN_PIN #define E1_AUTO_FAN_PIN MOSFET_4_PIN #else - #define FAN1_PIN MOSFET_4_PIN + #ifndef FAN1_PIN + #define FAN1_PIN MOSFET_4_PIN + #endif #endif // // Misc. Functions // -#define LED_PIN MOSFET_6_PIN // B7 +#define LED_PIN 13 // B7 #define CUTOFF_RESET_PIN 16 // H1 #define CUTOFF_TEST_PIN 17 // H0 #define CUTOFF_SR_CHECK_PIN 70 // G4 (TOSC1) From 1397cf0eaa66424caf5c54adcb8ee42f93db1619 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Fri, 13 May 2022 17:17:19 -0700 Subject: [PATCH 058/241] =?UTF-8?q?=F0=9F=94=A7=20Allow=20board=20&=20prob?= =?UTF-8?q?e=20dummy=20thermistors=20(#24165)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/SanityCheck.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 2dc81cbee70a..24278f9f6a4d 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2374,8 +2374,6 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #if TEMP_SENSOR_PROBE #if !PIN_EXISTS(TEMP_PROBE) #error "TEMP_SENSOR_PROBE requires TEMP_PROBE_PIN." - #elif !HAS_TEMP_ADC_PROBE - #error "TEMP_PROBE_PIN must be an ADC pin." #elif DISABLED(FIX_MOUNTED_PROBE) #error "TEMP_SENSOR_PROBE shouldn't be set without FIX_MOUNTED_PROBE." #endif @@ -2384,8 +2382,6 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #if TEMP_SENSOR_BOARD #if !PIN_EXISTS(TEMP_BOARD) #error "TEMP_SENSOR_BOARD requires TEMP_BOARD_PIN." - #elif !HAS_TEMP_ADC_BOARD - #error "TEMP_BOARD_PIN must be an ADC pin." #elif ENABLED(THERMAL_PROTECTION_BOARD) && (!defined(BOARD_MINTEMP) || !defined(BOARD_MAXTEMP)) #error "THERMAL_PROTECTION_BOARD requires BOARD_MINTEMP and BOARD_MAXTEMP." #endif From 0e4348c718a44eb32ba70c5253daae93197b10b7 Mon Sep 17 00:00:00 2001 From: Dominic <91095348+d0m1d@users.noreply.github.com> Date: Sat, 14 May 2022 02:18:04 +0200 Subject: [PATCH 059/241] =?UTF-8?q?=F0=9F=90=9B=20Fix=20AIR=5FASSIST=20(#2?= =?UTF-8?q?4162)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/spindle_laser.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/feature/spindle_laser.cpp b/Marlin/src/feature/spindle_laser.cpp index 52bb471b0f7e..ef3503c40d88 100644 --- a/Marlin/src/feature/spindle_laser.cpp +++ b/Marlin/src/feature/spindle_laser.cpp @@ -159,8 +159,8 @@ void SpindleLaser::apply_power(const uint8_t opwr) { #if ENABLED(AIR_ASSIST) // Enable / disable air assist - void SpindleLaser::air_assist_enable() { WRITE(AIR_ASSIST_PIN, AIR_ASSIST_PIN); } // Turn ON - void SpindleLaser::air_assist_disable() { WRITE(AIR_ASSIST_PIN, !AIR_ASSIST_PIN); } // Turn OFF + void SpindleLaser::air_assist_enable() { WRITE(AIR_ASSIST_PIN, AIR_ASSIST_ACTIVE); } // Turn ON + void SpindleLaser::air_assist_disable() { WRITE(AIR_ASSIST_PIN, !AIR_ASSIST_ACTIVE); } // Turn OFF void SpindleLaser::air_assist_toggle() { TOGGLE(AIR_ASSIST_PIN); } // Toggle state #endif From a62dc7c70c8869083c407b758d3c8a4edb115add Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Fri, 13 May 2022 17:27:13 -0700 Subject: [PATCH 060/241] =?UTF-8?q?=F0=9F=9A=B8=20Improve=20MKS=20SGEN=5FL?= =?UTF-8?q?=20V2,=20Robin=20Nano=20V3=20pins=20(#24147)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h | 18 +++++++++++++++--- .../stm32f4/pins_MKS_ROBIN_NANO_V3_common.h | 8 ++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h b/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h index 0c001e6061cc..13ebbe1f2859 100644 --- a/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h +++ b/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h @@ -36,9 +36,7 @@ // EEPROM, MKS SGEN_L V2.0 hardware has 4K EEPROM on the board // #if NO_EEPROM_SELECTED - //#define SDCARD_EEPROM_EMULATION - //#define I2C_EEPROM // AT24C32 - #define FLASH_EEPROM_EMULATION + #define I2C_EEPROM // AT24C32 #define MARLIN_EEPROM_SIZE 0x1000 // 4K #endif @@ -103,6 +101,12 @@ #define Z_MIN_PROBE_PIN P1_24 #endif +// +// Filament Runout Sensor +// +#define FIL_RUNOUT_PIN P1_28 // X+ +#define FIL_RUNOUT2_PIN P1_26 // Y+ + // // Steppers // @@ -203,6 +207,14 @@ #define TEMP_1_PIN P0_25_A2 // Analog Input A2 (TH2) #define TEMP_2_PIN P0_26_A3 // Analog Input A3 (P0.26, No pull up) +#if HOTENDS == 1 && !REDUNDANT_TEMP_MATCH(SOURCE, E1) + #if TEMP_SENSOR_PROBE + #define TEMP_PROBE_PIN TEMP_1_PIN + #elif TEMP_SENSOR_CHAMBER + #define TEMP_CHAMBER_PIN TEMP_1_PIN + #endif +#endif + // // Heaters / Fans // diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h index 22e00a4eb4a7..ead8799f5e09 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h @@ -119,6 +119,14 @@ #define TEMP_1_PIN PA2 // TH2 #define TEMP_BED_PIN PC0 // TB1 +#if HOTENDS == 1 && !REDUNDANT_TEMP_MATCH(SOURCE, E1) + #if TEMP_SENSOR_PROBE + #define TEMP_PROBE_PIN TEMP_1_PIN + #elif TEMP_SENSOR_CHAMBER + #define TEMP_CHAMBER_PIN TEMP_1_PIN + #endif +#endif + // // Heaters / Fans // From 66e32cb0fa1ed6cfae482bec31dfbb834340a408 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 13 May 2022 19:31:07 -0500 Subject: [PATCH 061/241] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Cla?= =?UTF-8?q?rify=20MSerialUSB,=20drop=20HardwareSerial=20workaround?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/AVR/HAL.h | 1 - Marlin/src/HAL/STM32/HAL.cpp | 2 +- Marlin/src/HAL/STM32/HAL.h | 52 +++++++++++++++++++++-------------- Marlin/src/core/serial_hook.h | 2 +- 4 files changed, 33 insertions(+), 24 deletions(-) diff --git a/Marlin/src/HAL/AVR/HAL.h b/Marlin/src/HAL/AVR/HAL.h index a2062775c424..b96169b2edfb 100644 --- a/Marlin/src/HAL/AVR/HAL.h +++ b/Marlin/src/HAL/AVR/HAL.h @@ -32,7 +32,6 @@ #ifdef USBCON #include #else - #define HardwareSerial_h // Hack to prevent HardwareSerial.h header inclusion #include "MarlinSerial.h" #endif diff --git a/Marlin/src/HAL/STM32/HAL.cpp b/Marlin/src/HAL/STM32/HAL.cpp index d28f506db9d3..2d8b672c3dfb 100644 --- a/Marlin/src/HAL/STM32/HAL.cpp +++ b/Marlin/src/HAL/STM32/HAL.cpp @@ -31,7 +31,7 @@ #include "../shared/Delay.h" #ifdef USBCON - DefaultSerial1 MSerial0(false, SerialUSB); + DefaultSerial1 MSerialUSB(false, SerialUSB); #endif #if ENABLED(SRAM_EEPROM_EMULATION) diff --git a/Marlin/src/HAL/STM32/HAL.h b/Marlin/src/HAL/STM32/HAL.h index d88342b889b5..1bd7f7604257 100644 --- a/Marlin/src/HAL/STM32/HAL.h +++ b/Marlin/src/HAL/STM32/HAL.h @@ -51,57 +51,67 @@ #include #include "../../core/serial_hook.h" typedef ForwardSerial1Class< decltype(SerialUSB) > DefaultSerial1; - extern DefaultSerial1 MSerial0; + extern DefaultSerial1 MSerialUSB; #endif #define _MSERIAL(X) MSerial##X #define MSERIAL(X) _MSERIAL(X) -#if SERIAL_PORT == -1 - #define MYSERIAL1 MSerial0 -#elif WITHIN(SERIAL_PORT, 1, 6) +#if WITHIN(SERIAL_PORT, 1, 6) #define MYSERIAL1 MSERIAL(SERIAL_PORT) +#elif !defined(USBCON) + #error "SERIAL_PORT must be from 1 to 6." +#elif SERIAL_PORT == -1 + #define MYSERIAL1 MSerialUSB #else - #error "SERIAL_PORT must be from 1 to 6. You can also use -1 if the board supports Native USB." + #error "SERIAL_PORT must be from 1 to 6, or -1 for Native USB." #endif #ifdef SERIAL_PORT_2 - #if SERIAL_PORT_2 == -1 - #define MYSERIAL2 MSerial0 - #elif WITHIN(SERIAL_PORT_2, 1, 6) + #if WITHIN(SERIAL_PORT_2, 1, 6) #define MYSERIAL2 MSERIAL(SERIAL_PORT_2) + #elif !defined(USBCON) + #error "SERIAL_PORT must be from 1 to 6." + #elif SERIAL_PORT_2 == -1 + #define MYSERIAL2 MSerialUSB #else - #error "SERIAL_PORT_2 must be from 1 to 6. You can also use -1 if the board supports Native USB." + #error "SERIAL_PORT_2 must be from 1 to 6, or -1 for Native USB." #endif #endif #ifdef SERIAL_PORT_3 - #if SERIAL_PORT_3 == -1 - #define MYSERIAL3 MSerial0 - #elif WITHIN(SERIAL_PORT_3, 1, 6) + #if WITHIN(SERIAL_PORT_3, 1, 6) #define MYSERIAL3 MSERIAL(SERIAL_PORT_3) + #elif !defined(USBCON) + #error "SERIAL_PORT must be from 1 to 6." + #elif SERIAL_PORT_3 == -1 + #define MYSERIAL3 MSerialUSB #else - #error "SERIAL_PORT_3 must be from 1 to 6. You can also use -1 if the board supports Native USB." + #error "SERIAL_PORT_3 must be from 1 to 6, or -1 for Native USB." #endif #endif #ifdef MMU2_SERIAL_PORT - #if MMU2_SERIAL_PORT == -1 - #define MMU2_SERIAL MSerial0 - #elif WITHIN(MMU2_SERIAL_PORT, 1, 6) + #if WITHIN(MMU2_SERIAL_PORT, 1, 6) #define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT) + #elif !defined(USBCON) + #error "SERIAL_PORT must be from 1 to 6." + #elif MMU2_SERIAL_PORT == -1 + #define MMU2_SERIAL MSerialUSB #else - #error "MMU2_SERIAL_PORT must be from 1 to 6. You can also use -1 if the board supports Native USB." + #error "MMU2_SERIAL_PORT must be from 1 to 6, or -1 for Native USB." #endif #endif #ifdef LCD_SERIAL_PORT - #if LCD_SERIAL_PORT == -1 - #define LCD_SERIAL MSerial0 - #elif WITHIN(LCD_SERIAL_PORT, 1, 6) + #if WITHIN(LCD_SERIAL_PORT, 1, 6) #define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT) + #elif !defined(USBCON) + #error "SERIAL_PORT must be from 1 to 6." + #elif LCD_SERIAL_PORT == -1 + #define LCD_SERIAL MSerialUSB #else - #error "LCD_SERIAL_PORT must be from 1 to 6. You can also use -1 if the board supports Native USB." + #error "LCD_SERIAL_PORT must be from 1 to 6, or -1 for Native USB." #endif #if HAS_DGUS_LCD #define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite() diff --git a/Marlin/src/core/serial_hook.h b/Marlin/src/core/serial_hook.h index 2e3c31b2085a..65c553c70259 100644 --- a/Marlin/src/core/serial_hook.h +++ b/Marlin/src/core/serial_hook.h @@ -300,7 +300,7 @@ struct MultiSerial : public SerialBase< MultiSerial< REPEAT(NUM_SERIAL, _S_NAME) // Build the actual serial object depending on current configuration #define Serial1Class TERN(SERIAL_RUNTIME_HOOK, RuntimeSerial, BaseSerial) #define ForwardSerial1Class TERN(SERIAL_RUNTIME_HOOK, RuntimeSerial, ForwardSerial) -#ifdef HAS_MULTI_SERIAL +#if HAS_MULTI_SERIAL #define Serial2Class ConditionalSerial #if NUM_SERIAL >= 3 #define Serial3Class ConditionalSerial From be0f1088f0f537be5e75af5e0a63a0c110b96efa Mon Sep 17 00:00:00 2001 From: Miguel Risco-Castillo Date: Fri, 13 May 2022 19:34:30 -0500 Subject: [PATCH 062/241] =?UTF-8?q?=F0=9F=9A=B8=20DWIN/DACAI=20for=20Creal?= =?UTF-8?q?ity=204.2.3=20(#24132)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Conditionals_LCD.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 0ce092ef2fa8..b93478933ddd 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -488,7 +488,7 @@ #ifndef LCD_SERIAL_PORT #if MB(BTT_SKR_MINI_E3_V1_0, BTT_SKR_MINI_E3_V1_2, BTT_SKR_MINI_E3_V2_0, BTT_SKR_MINI_E3_V3_0, BTT_SKR_E3_TURBO) #define LCD_SERIAL_PORT 1 - #elif MB(CREALITY_V24S1_301, CREALITY_V24S1_301F4) + #elif MB(CREALITY_V24S1_301, CREALITY_V24S1_301F4, CREALITY_V423) #define LCD_SERIAL_PORT 2 // Creality Ender3S1 board #else #define LCD_SERIAL_PORT 3 // Creality 4.x board From 956f7d32fbd74845b4d64a416460bdc6f25ed118 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Fri, 13 May 2022 17:50:42 -0700 Subject: [PATCH 063/241] =?UTF-8?q?=F0=9F=A9=B9=20Run=20TMC=20test=20last?= =?UTF-8?q?=20in=20setup=20(#24160)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/MarlinCore.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index a4cf46dbbf88..96580905f4a9 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -1577,10 +1577,6 @@ void setup() { SETUP_RUN(hostui.prompt_end()); #endif - #if HAS_TRINAMIC_CONFIG && DISABLED(PSU_DEFAULT_OFF) - SETUP_RUN(test_tmc_connection()); - #endif - #if HAS_DRIVER_SAFE_POWER_PROTECT SETUP_RUN(stepper_driver_backward_report()); #endif @@ -1638,6 +1634,10 @@ void setup() { SETUP_RUN(easythreed_ui.init()); #endif + #if HAS_TRINAMIC_CONFIG && DISABLED(PSU_DEFAULT_OFF) + SETUP_RUN(test_tmc_connection()); + #endif + marlin_state = MF_RUNNING; SETUP_LOG("setup() completed."); From 86fe4fde4002fbdf24d128aac51fb9f8b551a60e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 13 May 2022 23:49:29 -0500 Subject: [PATCH 064/241] =?UTF-8?q?=F0=9F=8E=A8=20HAL=5FMinSerial.*=20=3D>?= =?UTF-8?q?=20MinSerial.*?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/DUE/{HAL_MinSerial.cpp => MinSerial.cpp} | 2 +- Marlin/src/HAL/LPC1768/{HAL_MinSerial.cpp => MinSerial.cpp} | 2 +- Marlin/src/HAL/STM32/{HAL_MinSerial.cpp => MinSerial.cpp} | 2 +- Marlin/src/HAL/STM32F1/{HAL_MinSerial.cpp => MinSerial.cpp} | 2 +- Marlin/src/HAL/shared/{HAL_MinSerial.cpp => MinSerial.cpp} | 2 +- Marlin/src/HAL/shared/{HAL_MinSerial.h => MinSerial.h} | 0 Marlin/src/HAL/shared/backtrace/backtrace.cpp | 2 +- Marlin/src/HAL/shared/cpu_exception/exception_arm.cpp | 2 +- 8 files changed, 7 insertions(+), 7 deletions(-) rename Marlin/src/HAL/DUE/{HAL_MinSerial.cpp => MinSerial.cpp} (98%) rename Marlin/src/HAL/LPC1768/{HAL_MinSerial.cpp => MinSerial.cpp} (97%) rename Marlin/src/HAL/STM32/{HAL_MinSerial.cpp => MinSerial.cpp} (99%) rename Marlin/src/HAL/STM32F1/{HAL_MinSerial.cpp => MinSerial.cpp} (99%) rename Marlin/src/HAL/shared/{HAL_MinSerial.cpp => MinSerial.cpp} (97%) rename Marlin/src/HAL/shared/{HAL_MinSerial.h => MinSerial.h} (100%) diff --git a/Marlin/src/HAL/DUE/HAL_MinSerial.cpp b/Marlin/src/HAL/DUE/MinSerial.cpp similarity index 98% rename from Marlin/src/HAL/DUE/HAL_MinSerial.cpp rename to Marlin/src/HAL/DUE/MinSerial.cpp index 93c4ed67d63c..e5b3dbfe6f36 100644 --- a/Marlin/src/HAL/DUE/HAL_MinSerial.cpp +++ b/Marlin/src/HAL/DUE/MinSerial.cpp @@ -25,7 +25,7 @@ #if ENABLED(POSTMORTEM_DEBUGGING) -#include "../shared/HAL_MinSerial.h" +#include "../shared/MinSerial.h" #include diff --git a/Marlin/src/HAL/LPC1768/HAL_MinSerial.cpp b/Marlin/src/HAL/LPC1768/MinSerial.cpp similarity index 97% rename from Marlin/src/HAL/LPC1768/HAL_MinSerial.cpp rename to Marlin/src/HAL/LPC1768/MinSerial.cpp index 57065c49ac83..7a1c038c0b0b 100644 --- a/Marlin/src/HAL/LPC1768/HAL_MinSerial.cpp +++ b/Marlin/src/HAL/LPC1768/MinSerial.cpp @@ -26,7 +26,7 @@ #if ENABLED(POSTMORTEM_DEBUGGING) -#include "../shared/HAL_MinSerial.h" +#include "../shared/MinSerial.h" #include static void TX(char c) { _DBC(c); } diff --git a/Marlin/src/HAL/STM32/HAL_MinSerial.cpp b/Marlin/src/HAL/STM32/MinSerial.cpp similarity index 99% rename from Marlin/src/HAL/STM32/HAL_MinSerial.cpp rename to Marlin/src/HAL/STM32/MinSerial.cpp index b6e86b72daa9..d99ed9cd9b99 100644 --- a/Marlin/src/HAL/STM32/HAL_MinSerial.cpp +++ b/Marlin/src/HAL/STM32/MinSerial.cpp @@ -28,7 +28,7 @@ #if ENABLED(POSTMORTEM_DEBUGGING) -#include "../shared/HAL_MinSerial.h" +#include "../shared/MinSerial.h" #include "watchdog.h" /* Instruction Synchronization Barrier */ diff --git a/Marlin/src/HAL/STM32F1/HAL_MinSerial.cpp b/Marlin/src/HAL/STM32F1/MinSerial.cpp similarity index 99% rename from Marlin/src/HAL/STM32F1/HAL_MinSerial.cpp rename to Marlin/src/HAL/STM32F1/MinSerial.cpp index 0fc3d014d484..0f7e0d5f10c5 100644 --- a/Marlin/src/HAL/STM32F1/HAL_MinSerial.cpp +++ b/Marlin/src/HAL/STM32F1/MinSerial.cpp @@ -26,7 +26,7 @@ #if ENABLED(POSTMORTEM_DEBUGGING) -#include "../shared/HAL_MinSerial.h" +#include "../shared/MinSerial.h" #include "watchdog.h" #include diff --git a/Marlin/src/HAL/shared/HAL_MinSerial.cpp b/Marlin/src/HAL/shared/MinSerial.cpp similarity index 97% rename from Marlin/src/HAL/shared/HAL_MinSerial.cpp rename to Marlin/src/HAL/shared/MinSerial.cpp index 9dda5fdf8c67..2e718d83dc12 100644 --- a/Marlin/src/HAL/shared/HAL_MinSerial.cpp +++ b/Marlin/src/HAL/shared/MinSerial.cpp @@ -19,7 +19,7 @@ * along with this program. If not, see . * */ -#include "HAL_MinSerial.h" +#include "MinSerial.h" #if ENABLED(POSTMORTEM_DEBUGGING) diff --git a/Marlin/src/HAL/shared/HAL_MinSerial.h b/Marlin/src/HAL/shared/MinSerial.h similarity index 100% rename from Marlin/src/HAL/shared/HAL_MinSerial.h rename to Marlin/src/HAL/shared/MinSerial.h diff --git a/Marlin/src/HAL/shared/backtrace/backtrace.cpp b/Marlin/src/HAL/shared/backtrace/backtrace.cpp index ad88de8385ac..33e8e65154a0 100644 --- a/Marlin/src/HAL/shared/backtrace/backtrace.cpp +++ b/Marlin/src/HAL/shared/backtrace/backtrace.cpp @@ -25,7 +25,7 @@ #include "unwinder.h" #include "unwmemaccess.h" -#include "../HAL_MinSerial.h" +#include "../MinSerial.h" #include // Dump a backtrace entry diff --git a/Marlin/src/HAL/shared/cpu_exception/exception_arm.cpp b/Marlin/src/HAL/shared/cpu_exception/exception_arm.cpp index a106ed2b05e5..deaf09d2c000 100644 --- a/Marlin/src/HAL/shared/cpu_exception/exception_arm.cpp +++ b/Marlin/src/HAL/shared/cpu_exception/exception_arm.cpp @@ -54,7 +54,7 @@ #include "exception_hook.h" #include "../backtrace/backtrace.h" -#include "../HAL_MinSerial.h" +#include "../MinSerial.h" #define HW_REG(X) (*((volatile unsigned long *)(X))) From 66d94aad21018bb082d85579d775430514c957eb Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sun, 15 May 2022 00:01:54 +0000 Subject: [PATCH 065/241] [cron] Bump distribution date (2022-05-15) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index e8bfed01bdc6..8360d07ee39f 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-05-14" +//#define STRING_DISTRIBUTION_DATE "2022-05-15" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 8f69ed3c881e..2535ebc33751 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-05-14" + #define STRING_DISTRIBUTION_DATE "2022-05-15" #endif /** From e092a02d77c83a3d44e2d0e3ea66a801ea5c3cc5 Mon Sep 17 00:00:00 2001 From: Marcio T Date: Mon, 16 May 2022 20:45:47 -0600 Subject: [PATCH 066/241] =?UTF-8?q?=F0=9F=90=9B=20Fix=20Due=20cli/sei=20(#?= =?UTF-8?q?24182)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #23357 --- Marlin/src/HAL/DUE/HAL.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/HAL/DUE/HAL.h b/Marlin/src/HAL/DUE/HAL.h index d00c4d3da102..2f5c647aa319 100644 --- a/Marlin/src/HAL/DUE/HAL.h +++ b/Marlin/src/HAL/DUE/HAL.h @@ -115,8 +115,8 @@ typedef Servo hal_servo_t; // // Interrupts // -#define sei() noInterrupts() -#define cli() interrupts() +#define sei() interrupts() +#define cli() noInterrupts() #define CRITICAL_SECTION_START() const bool _irqon = hal.isr_state(); hal.isr_off() #define CRITICAL_SECTION_END() if (_irqon) hal.isr_on() From 79789571bc6141e8889e6aa062a8103a6892e680 Mon Sep 17 00:00:00 2001 From: Oliver Jean Eifler Date: Tue, 17 May 2022 06:23:03 +0200 Subject: [PATCH 067/241] =?UTF-8?q?=F0=9F=A9=B9=20Suppress=20ZERO()=20warn?= =?UTF-8?q?ing=20(#24178)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/macros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/core/macros.h b/Marlin/src/core/macros.h index c24b4a1a9c91..c12386b46b72 100644 --- a/Marlin/src/core/macros.h +++ b/Marlin/src/core/macros.h @@ -290,7 +290,7 @@ #define NUMERIC_SIGNED(a) (NUMERIC(a) || (a) == '-' || (a) == '+') #define DECIMAL_SIGNED(a) (DECIMAL(a) || (a) == '-' || (a) == '+') #define COUNT(a) (sizeof(a)/sizeof(*a)) -#define ZERO(a) memset(a,0,sizeof(a)) +#define ZERO(a) memset((void*)a,0,sizeof(a)) #define COPY(a,b) do{ \ static_assert(sizeof(a[0]) == sizeof(b[0]), "COPY: '" STRINGIFY(a) "' and '" STRINGIFY(b) "' types (sizes) don't match!"); \ memcpy(&a[0],&b[0],_MIN(sizeof(a),sizeof(b))); \ From 0b787e8ed3d1743728eff28ccbb247cbb3101f04 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 17 May 2022 06:00:50 +0000 Subject: [PATCH 068/241] [cron] Bump distribution date (2022-05-17) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 8360d07ee39f..577682a00b85 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-05-15" +//#define STRING_DISTRIBUTION_DATE "2022-05-17" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 2535ebc33751..fe5e5da90532 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-05-15" + #define STRING_DISTRIBUTION_DATE "2022-05-17" #endif /** From 7894cd9d6a108653f77ccb59de389b53405af1eb Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Tue, 17 May 2022 20:01:32 +1200 Subject: [PATCH 069/241] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20MarlinUI=20allow-c?= =?UTF-8?q?old-extrude=20(#24176)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/lcd/menu/menu_motion.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index 1ef38c014bd4..73101e7bcf16 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -166,6 +166,7 @@ void _goto_manual_move(const_float_t scale) { ui.defer_status_screen(); ui.manual_move.menu_scale = scale; ui.goto_screen(_manual_move_func_ptr); + thermalManager.set_menu_cold_override(true); } void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int8_t eindex=active_extruder) { @@ -228,7 +229,7 @@ void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int ui.goto_screen([]{ MenuItem_confirm::select_screen( GET_TEXT(MSG_BUTTON_PROCEED), GET_TEXT(MSG_BACK), - [] { _goto_menu_move_distance_e(); thermalManager.set_menu_cold_override(true); }, nullptr, + _goto_menu_move_distance_e, nullptr, GET_TEXT(MSG_HOTEND_TOO_COLD), (const char *)nullptr, PSTR("!") ); }); From 310ff2367690a9b3c40cec756f193add76900fe3 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 17 May 2022 15:05:25 -0500 Subject: [PATCH 070/241] =?UTF-8?q?=F0=9F=8E=A8=20Misc.=20E3V2=20DWIN=20cl?= =?UTF-8?q?eanup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/e3v2/creality/dwin.cpp | 10 +++++----- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 2 +- Marlin/src/lcd/e3v2/proui/dwin.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index 65da4cb42157..b2cb1bee30ce 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp @@ -2728,7 +2728,7 @@ void HMI_Prepare() { EncoderRate.enabled = true; #else // Apply workspace offset, making the current position 0,0,0 - queue.inject(F("G92 X0 Y0 Z0")); + queue.inject(F("G92X0Y0Z0")); HMI_AudioFeedback(); #endif break; @@ -3556,9 +3556,9 @@ void HMI_AdvSet() { case ADVSET_CASE_HOMEOFF: checkkey = HomeOff; select_item.reset(); - HMI_ValueStruct.Home_OffX_scaled = home_offset[X_AXIS] * 10; - HMI_ValueStruct.Home_OffY_scaled = home_offset[Y_AXIS] * 10; - HMI_ValueStruct.Home_OffZ_scaled = home_offset[Z_AXIS] * 10; + HMI_ValueStruct.Home_OffX_scaled = home_offset.x * 10; + HMI_ValueStruct.Home_OffY_scaled = home_offset.y * 10; + HMI_ValueStruct.Home_OffZ_scaled = home_offset.z * 10; Draw_HomeOff_Menu(); break; #endif @@ -3806,7 +3806,7 @@ void HMI_Tune() { EncoderRate.enabled = true; #else // Apply workspace offset, making the current position 0,0,0 - queue.inject(F("G92 X0 Y0 Z0")); + queue.inject(F("G92X0Y0Z0")); HMI_AudioFeedback(); #endif break; diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 04a612a9cc2d..9d6871fc2dda 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -1246,7 +1246,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ if (draw) Draw_Menu_Item(row, ICON_SetHome, F("Set Home Position")); else { - gcode.process_subcommands_now(F("G92 X0 Y0 Z0")); + gcode.process_subcommands_now(F("G92X0Y0Z0")); AudioFeedback(); } break; diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 7d87725b8158..68099f207686 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -1943,7 +1943,7 @@ void HomeZ() { queue.inject(F("G28Z")); } void SetHome() { // Apply workspace offset, making the current position 0,0,0 - queue.inject(F("G92 X0 Y0 Z0")); + queue.inject(F("G92X0Y0Z0")); HMI_AudioFeedback(); } From a65e4edb1c794dcd22980f3cce9bf2993da1514b Mon Sep 17 00:00:00 2001 From: Miguel Risco-Castillo Date: Tue, 17 May 2022 15:44:30 -0500 Subject: [PATCH 071/241] =?UTF-8?q?=F0=9F=9A=B8=20ProUI=20APRIL2022=20upda?= =?UTF-8?q?tes=20(#24084)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/MarlinCore.cpp | 2 +- Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 2 + Marlin/src/gcode/probe/G30.cpp | 26 +- Marlin/src/gcode/stats/M31.cpp | 2 +- Marlin/src/lcd/e3v2/common/dwin_api.cpp | 4 +- Marlin/src/lcd/e3v2/proui/dwin.cpp | 1229 ++++++++++--------- Marlin/src/lcd/e3v2/proui/dwin.h | 86 +- Marlin/src/lcd/e3v2/proui/dwin_defines.h | 30 +- Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp | 52 +- Marlin/src/lcd/e3v2/proui/dwin_lcd.h | 22 +- Marlin/src/lcd/e3v2/proui/dwinui.cpp | 183 +-- Marlin/src/lcd/e3v2/proui/dwinui.h | 196 ++- Marlin/src/lcd/e3v2/proui/lockscreen.cpp | 5 +- Marlin/src/lcd/e3v2/proui/lockscreen.h | 4 +- Marlin/src/lcd/e3v2/proui/menus.cpp | 198 ++- Marlin/src/lcd/e3v2/proui/menus.h | 98 +- Marlin/src/lcd/e3v2/proui/meshviewer.cpp | 44 +- Marlin/src/lcd/e3v2/proui/meshviewer.h | 6 +- Marlin/src/lcd/e3v2/proui/printstats.cpp | 2 +- Marlin/src/lcd/e3v2/proui/ubl_tools.cpp | 255 ++++ Marlin/src/lcd/e3v2/proui/ubl_tools.h | 59 + Marlin/src/lcd/language/language_en.h | 65 +- 22 files changed, 1612 insertions(+), 958 deletions(-) create mode 100644 Marlin/src/lcd/e3v2/proui/ubl_tools.cpp create mode 100644 Marlin/src/lcd/e3v2/proui/ubl_tools.h diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 96580905f4a9..748d3d03cf91 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -890,7 +890,7 @@ void kill(FSTR_P const lcd_error/*=nullptr*/, FSTR_P const lcd_component/*=nullp // Echo the LCD message to serial for extra context if (lcd_error) { SERIAL_ECHO_START(); SERIAL_ECHOLNF(lcd_error); } - #if EITHER(HAS_DISPLAY, DWIN_LCD_PROUI) + #if HAS_DISPLAY ui.kill_screen(lcd_error ?: GET_TEXT_F(MSG_KILLED), lcd_component ?: FPSTR(NUL_STR)); #else UNUSED(lcd_error); UNUSED(lcd_component); diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index 0ae3e301ccbb..278d982f70de 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -763,6 +763,7 @@ void unified_bed_leveling::shift_mesh_height() { TERN_(HAS_MARLINUI_MENU, ui.capture()); TERN_(EXTENSIBLE_UI, ExtUI::onLevelingStart()); + TERN_(DWIN_LCD_PROUI, DWIN_LevelingStart()); save_ubl_active_state_and_disable(); // No bed level correction so only raw data is obtained uint8_t count = GRID_MAX_POINTS; @@ -826,6 +827,7 @@ void unified_bed_leveling::shift_mesh_height() { ); TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone()); + TERN_(DWIN_LCD_PROUI, DWIN_LevelingDone()); } #endif // HAS_BED_PROBE diff --git a/Marlin/src/gcode/probe/G30.cpp b/Marlin/src/gcode/probe/G30.cpp index 474f1f252a04..a16853bdf894 100644 --- a/Marlin/src/gcode/probe/G30.cpp +++ b/Marlin/src/gcode/probe/G30.cpp @@ -33,6 +33,10 @@ #include "../../feature/probe_temp_comp.h" #endif +#if ENABLED(DWIN_LCD_PROUI) + #include "../../lcd/marlinui.h" +#endif + /** * G30: Do a single Z probe at the current XY * @@ -48,20 +52,38 @@ void GcodeSuite::G30() { const xy_pos_t pos = { parser.linearval('X', current_position.x + probe.offset_xy.x), parser.linearval('Y', current_position.y + probe.offset_xy.y) }; - if (!probe.can_reach(pos)) return; + if (!probe.can_reach(pos)) { + #if ENABLED(DWIN_LCD_PROUI) + SERIAL_ECHOLNF(GET_EN_TEXT_F(MSG_ZPROBE_OUT)); + LCD_MESSAGE(MSG_ZPROBE_OUT); + #endif + return; + } // Disable leveling so the planner won't mess with us TERN_(HAS_LEVELING, set_bed_leveling_enabled(false)); remember_feedrate_scaling_off(); + TERN_(DWIN_LCD_PROUI, process_subcommands_now(F("G28O"))); + const ProbePtRaise raise_after = parser.boolval('E', true) ? PROBE_PT_STOW : PROBE_PT_NONE; TERN_(HAS_PTC, ptc.set_enabled(!parser.seen('C') || parser.value_bool())); const float measured_z = probe.probe_at_point(pos, raise_after, 1); TERN_(HAS_PTC, ptc.set_enabled(true)); - if (!isnan(measured_z)) + if (!isnan(measured_z)) { SERIAL_ECHOLNPGM("Bed X: ", pos.x, " Y: ", pos.y, " Z: ", measured_z); + #if ENABLED(DWIN_LCD_PROUI) + char msg[31], str_1[6], str_2[6], str_3[6]; + sprintf_P(msg, PSTR("X:%s, Y:%s, Z:%s"), + dtostrf(pos.x, 1, 1, str_1), + dtostrf(pos.y, 1, 1, str_2), + dtostrf(measured_z, 1, 2, str_3) + ); + ui.set_status(msg); + #endif + } restore_feedrate_and_scaling(); diff --git a/Marlin/src/gcode/stats/M31.cpp b/Marlin/src/gcode/stats/M31.cpp index 355701f6a413..1a1c13ba2f1a 100644 --- a/Marlin/src/gcode/stats/M31.cpp +++ b/Marlin/src/gcode/stats/M31.cpp @@ -33,7 +33,7 @@ void GcodeSuite::M31() { char buffer[22]; duration_t(print_job_timer.duration()).toString(buffer); - ui.set_status(buffer); + ui.set_status(buffer, ENABLED(DWIN_LCD_PROUI)); SERIAL_ECHO_MSG("Print time: ", buffer); } diff --git a/Marlin/src/lcd/e3v2/common/dwin_api.cpp b/Marlin/src/lcd/e3v2/common/dwin_api.cpp index 63a75b89c8af..3f699465a9c8 100644 --- a/Marlin/src/lcd/e3v2/common/dwin_api.cpp +++ b/Marlin/src/lcd/e3v2/common/dwin_api.cpp @@ -234,7 +234,9 @@ void DWIN_Frame_AreaMove(uint8_t mode, uint8_t dir, uint16_t dis, // *string: The string // rlimit: To limit the drawn string length void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const char * const string, uint16_t rlimit/*=0xFFFF*/) { - DWIN_Draw_Rectangle(1, bColor, x, y, x + (fontWidth(size) * strlen_P(string)), y + fontHeight(size)); + #if DISABLED(DWIN_LCD_PROUI) + DWIN_Draw_Rectangle(1, bColor, x, y, x + (fontWidth(size) * strlen_P(string)), y + fontHeight(size)); + #endif constexpr uint8_t widthAdjust = 0; size_t i = 0; DWIN_Byte(i, 0x11); diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 68099f207686..cae29e5b28e9 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -23,8 +23,8 @@ /** * DWIN Enhanced implementation for PRO UI * Author: Miguel A. Risco-Castillo (MRISCOC) - * Version: 3.15.2 - * Date: 2022/03/01 + * Version: 3.17.2 + * Date: 2022/04/08 */ #include "../../../inc/MarlinConfig.h" @@ -64,7 +64,7 @@ #include "../../../feature/host_actions.h" #endif -#if ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT) && DISABLED(PROBE_MANUALLY) +#if DISABLED(PROBE_MANUALLY) && ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT) #define HAS_ONESTEP_LEVELING 1 #endif @@ -82,11 +82,11 @@ #if ANY(BABYSTEPPING, HAS_BED_PROBE, HAS_WORKSPACE_OFFSET) #define HAS_ZOFFSET_ITEM 1 - #if !HAS_BED_PROBE && ENABLED(BABYSTEPPING) - #define JUST_BABYSTEP 1 - #endif - #if EITHER(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP) + #if ENABLED(BABYSTEPPING) #include "../../../feature/babystep.h" + #if !HAS_BED_PROBE + #define JUST_BABYSTEP 1 + #endif #endif #endif @@ -94,10 +94,6 @@ #include "../../../feature/powerloss.h" #endif -#if HAS_GCODE_PREVIEW - #include "gcode_preview.h" -#endif - #if HAS_ESDIAG #include "endstop_diag.h" #endif @@ -106,6 +102,10 @@ #include "meshviewer.h" #endif +#if ENABLED(AUTO_BED_LEVELING_UBL) + #include "ubl_tools.h" +#endif + #if ENABLED(PRINTCOUNTER) #include "printstats.h" #endif @@ -143,29 +143,26 @@ // Load and Unload limits #define MAX_LOAD_UNLOAD 500 -// Feedspeed limit (max feedspeed = DEFAULT_MAX_FEEDRATE * 2) +// Feedspeed limit (max feedspeed = MAX_FEEDRATE_EDIT_VALUES) #define MIN_MAXFEEDSPEED 1 #define MIN_MAXACCELERATION 1 #define MIN_MAXJERK 0.1 #define MIN_STEP 1 #define MAX_STEP 999.9 -// Extruder's temperature limits -#define MIN_ETEMP HEATER_0_MINTEMP -#define MAX_ETEMP (HEATER_0_MAXTEMP - HOTEND_OVERSHOOT) +// Editable temperature limits +#define MIN_ETEMP 0 +#define MAX_ETEMP (HEATER_0_MAXTEMP - (HOTEND_OVERSHOOT)) +#define MIN_BEDTEMP 0 +#define MAX_BEDTEMP BED_MAX_TARGET #define FEEDRATE_E (60) -// Minimum unit (0.1) : multiple (10) -#define UNITFDIGITS 1 -#define MINUNITMULT POW(10, UNITFDIGITS) - -#define ENCODER_WAIT_MS 20 #define DWIN_VAR_UPDATE_INTERVAL 1024 #define DWIN_SCROLL_UPDATE_INTERVAL SEC_TO_MS(2) #define DWIN_REMAIN_TIME_UPDATE_INTERVAL SEC_TO_MS(20) -#define BABY_Z_VAR TERN(HAS_BED_PROBE, probe.offset.z, dwin_zoffset) +#define BABY_Z_VAR TERN(HAS_BED_PROBE, probe.offset.z, HMI_data.ManualZOffset) // Structs HMI_value_t HMI_value; @@ -203,11 +200,11 @@ uint8_t index_file = MROWS; bool hash_changed = true; // Flag to know if message status was changed -constexpr float max_feedrate_edit_values[] = DEFAULT_MAX_FEEDRATE; -constexpr float max_acceleration_edit_values[] = DEFAULT_MAX_ACCELERATION; +constexpr float max_feedrate_edit_values[] = MAX_FEEDRATE_EDIT_VALUES; +constexpr float max_acceleration_edit_values[] = MAX_ACCEL_EDIT_VALUES; #if HAS_CLASSIC_JERK - constexpr float max_jerk_edit_values[] = { DEFAULT_XJERK, DEFAULT_YJERK, DEFAULT_ZJERK, DEFAULT_EJERK }; + constexpr float max_jerk_edit_values[] = MAX_JERK_EDIT_VALUES; #endif static uint8_t _percent_done = 0; @@ -216,10 +213,6 @@ static uint32_t _remain_time = 0; // Additional Aux Host Support static bool sdprint = false; -#if HAS_ZOFFSET_ITEM - float dwin_zoffset = 0, last_zoffset = 0; -#endif - #if HAS_HOTEND float last_E = 0; #endif @@ -267,12 +260,22 @@ MenuClass *BedPIDMenu = nullptr; #if ENABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU) MenuClass *HomingMenu = nullptr; #endif +#if ENABLED(FWRETRACT) + MenuClass *FWRetractMenu = nullptr; +#endif +#if HAS_MESH + MenuClass *MeshMenu = nullptr; + #if ENABLED(MESH_EDIT_MENU) + MenuClass *EditMeshMenu = nullptr; + #endif +#endif // Updatable menuitems pointers MenuItemClass *HotendTargetItem = nullptr; MenuItemClass *BedTargetItem = nullptr; MenuItemClass *FanSpeedItem = nullptr; MenuItemClass *MMeshMoveZItem = nullptr; +MenuItemClass *EditZValueItem = nullptr; #define DWIN_LANGUAGE_EEPROM_ADDRESS 0x01 // Between 0x01 and 0x63 (EEPROM_OFFSET-1) // BL24CXX::check() uses 0x00 @@ -493,6 +496,11 @@ void DWIN_DrawStatusLine(const char *text) { if (text) DWINUI::Draw_CenteredString(HMI_data.StatusTxt_Color, STATUS_Y + 2, text); } +void DWIN_DrawStatusLine(FSTR_P fstr) { + DWIN_Draw_Rectangle(1, HMI_data.StatusBg_Color, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 20); + if (fstr) DWINUI::Draw_CenteredString(HMI_data.StatusTxt_Color, STATUS_Y + 2, fstr); +} + // Clear & reset status line void DWIN_ResetStatusLine() { ui.status_message[0] = 0; @@ -631,6 +639,7 @@ void Goto_PrintProcess() { else { checkkey = PrintProcess; Draw_PrintProcess(); + TERN_(DASH_REDRAW, DWIN_RedrawDash()); } DWIN_UpdateLCD(); } @@ -649,8 +658,7 @@ void Draw_PrintDone() { DWINUI::Draw_Icon(ICON_RemainTime, 150, 171); Draw_Print_ProgressElapsed(); Draw_Print_ProgressRemain(); - // show print done confirm - DWINUI::Draw_Button(BTN_Confirm, 86, 273); + DWINUI::Draw_Button(BTN_Continue, 86, 273); } void Goto_PrintDone() { @@ -746,16 +754,13 @@ void update_variable() { if (checkkey == Menu && (CurrentMenu == TuneMenu || CurrentMenu == TemperatureMenu)) { // Tune page temperature update #if HAS_HOTEND - if (_new_hotend_target) - HotendTargetItem->draw(CurrentMenu->line(HotendTargetItem->pos)); + if (_new_hotend_target) HotendTargetItem->redraw(); #endif #if HAS_HEATED_BED - if (_new_bed_target) - BedTargetItem->draw(CurrentMenu->line(BedTargetItem->pos)); + if (_new_bed_target) BedTargetItem->redraw(); #endif #if HAS_FAN - if (_new_fanspeed) - FanSpeedItem->draw(CurrentMenu->line(FanSpeedItem->pos)); + if (_new_fanspeed) FanSpeedItem->redraw(); #endif } @@ -1013,7 +1018,7 @@ void DWIN_Draw_Dashboard() { DWINUI::Draw_Icon(ICON_BedTemp, 10, 416); DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 28, 417, thermalManager.wholeDegBed()); DWINUI::Draw_String(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 25 + 3 * STAT_CHR_W + 5, 417, F("/")); - DWINUI::Draw_Int(true, true, 0, DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 25 + 4 * STAT_CHR_W + 6, 417, thermalManager.degTargetBed()); + DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 25 + 4 * STAT_CHR_W + 6, 417, thermalManager.degTargetBed()); #endif DWINUI::Draw_Icon(ICON_Speed, 113, 383); @@ -1025,7 +1030,7 @@ void DWIN_Draw_Dashboard() { DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 195 + 2 * STAT_CHR_W, 384, thermalManager.fan_speed[0]); #endif - #if HAS_ZOFFSET_ITEM + #if BOTH(BABYSTEPPING, HAS_BED_PROBE) DWINUI::Draw_Icon(planner.leveling_active ? ICON_SetZOffset : ICON_Zoffset, 187, 416); #endif @@ -1075,6 +1080,7 @@ void Draw_Print_File_Menu() { else Title.ShowCaption(GET_TEXT_F(MSG_MEDIA_MENU)); Redraw_SD_List(); + TERN_(DASH_REDRAW, DWIN_RedrawDash()); } // Main Process @@ -1285,8 +1291,6 @@ void HMI_Printing() { #include "../../../libs/buzzer.h" -void HMI_AudioFeedback(const bool success/*=true*/) { DONE_BUZZ(success); } - void Draw_Main_Area() { switch (checkkey) { case MainMenu: Draw_Main_Menu(); break; @@ -1303,7 +1307,7 @@ void Draw_Main_Area() { case SetPInt: case SetIntNoDraw: case SetFloat: - case SetPFloat: CurrentMenu->draw(); break; + case SetPFloat: ReDrawMenu(); break; default: break; } } @@ -1322,15 +1326,8 @@ void HMI_WaitForUser() { select_page.reset(); Goto_Main_Menu(); break; - #if HAS_ONESTEP_LEVELING - case Leveling: - //TERN_(ProUI, ProEx.StopLeveling()); - HMI_ReturnScreen(); - break; - #endif - default: - HMI_ReturnScreen(); - break; + TERN_(HAS_ONESTEP_LEVELING, case Leveling:) + default: HMI_ReturnScreen(); break; } } } @@ -1354,17 +1351,17 @@ void EachMomentUpdate() { if (ELAPSED(ms, next_var_update_ms)) { next_var_update_ms = ms + DWIN_VAR_UPDATE_INTERVAL; update_variable(); - switch (checkkey) { - #if HAS_ESDIAG - case ESDiagProcess: - ESDiag.Update(); - break; - #endif - default: - break; - } + #if HAS_ESDIAG + if (checkkey == ESDiagProcess) ESDiag.Update(); + #endif } + #if HAS_STATUS_MESSAGE_TIMEOUT + bool did_expire = ui.status_reset_callback && (*ui.status_reset_callback)(); + did_expire |= ui.status_message_expire_ms && ELAPSED(ms, ui.status_message_expire_ms); + if (did_expire) ui.reset_status(); + #endif + if (ELAPSED(ms, next_status_update_ms)) { next_status_update_ms = ms + 500; DWIN_DrawStatusMessage(); @@ -1402,7 +1399,7 @@ void EachMomentUpdate() { duration_t elapsed = print_job_timer.duration(); // print timer - if (sdprint && card.isPrinting()) { + if (sdprint && card.isPrinting() && !HMI_flag.percent_flag) { uint8_t percentDone = card.percentDone(); if (_percent_done != percentDone) { // print percent _percent_done = percentDone; @@ -1497,8 +1494,7 @@ void DWIN_HandleScreen() { case SelectFile: HMI_SelectFile(); break; case PrintProcess: HMI_Printing(); break; case Popup: HMI_Popup(); break; - case Leveling: //TERN_(ProUI, HMI_WaitForUser()); - break; + case Leveling: break; case Locked: HMI_LockScreen(); break; case PrintDone: TERN_(HAS_ESDIAG, case ESDiagProcess:) @@ -1541,7 +1537,10 @@ void DWIN_HomingStart() { void DWIN_HomingDone() { HMI_flag.home_flag = false; - dwin_zoffset = TERN0(HAS_BED_PROBE, probe.offset.z); + #if ENABLED(MESH_BED_LEVELING) && EITHER(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP) + planner.synchronize(); + babystep.add_mm(Z_AXIS, HMI_data.ManualZOffset); + #endif if (HMI_flag.abort_action) DWIN_Print_Aborted(); else HMI_ReturnScreen(); } @@ -1550,13 +1549,25 @@ void DWIN_LevelingStart() { HMI_SaveProcessID(Leveling); Title.ShowCaption(GET_TEXT_F(MSG_BED_LEVELING)); DWIN_Show_Popup(ICON_AutoLeveling, GET_TEXT_F(MSG_BED_LEVELING), GET_TEXT_F(MSG_PLEASE_WAIT)); + #if BOTH(AUTO_BED_LEVELING_UBL, PREHEAT_BEFORE_LEVELING) + #if HAS_HOTEND + if (thermalManager.degTargetHotend(0) < LEVELING_NOZZLE_TEMP) + thermalManager.setTargetHotend(LEVELING_NOZZLE_TEMP, 0); + #endif + #if HAS_HEATED_BED + if (thermalManager.degTargetBed() < HMI_data.BedLevT) + thermalManager.setTargetBed(HMI_data.BedLevT); + #endif + TERN_(HAS_HOTEND, thermalManager.wait_for_hotend(0)); + TERN_(HAS_HEATED_BED, thermalManager.wait_for_bed_heating()); + #endif #elif ENABLED(MESH_BED_LEVELING) Draw_ManualMesh_Menu(); #endif } void DWIN_LevelingDone() { - TERN_(HAS_ONESTEP_LEVELING, if (planner.leveling_active) Goto_MeshViewer()); + TERN_(HAS_MESH, Goto_MeshViewer()); } #if HAS_MESH @@ -1606,6 +1617,7 @@ void DWIN_Print_Started(const bool sd) { sdprint = IS_SD_PRINTING() || sd; _percent_done = 0; _remain_time = 0; + HMI_flag.percent_flag = false; HMI_flag.remain_flag = false; HMI_flag.pause_flag = false; HMI_flag.pause_action = false; @@ -1653,9 +1665,12 @@ void DWIN_Print_Aborted() { // Progress Bar update void DWIN_M73() { - if (parser.seenval('P')) _percent_done = parser.byteval('P'); + if (parser.seenval('P')) { + _percent_done = parser.value_byte(); + HMI_flag.percent_flag = true; + } if (parser.seenval('R')) { - _remain_time = parser.ulongval('R') * 60; + _remain_time = parser.value_ulong() * 60; HMI_flag.remain_flag = true; } if (checkkey == PrintProcess) { @@ -1705,16 +1720,18 @@ void DWIN_SetDataDefaults() { HMI_data.BedLevT = LEVELING_BED_TEMP; #endif TERN_(BAUD_RATE_GCODE, SetBaud250K()); + #if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS) + leds.set_default(); + ApplyLEDColor(); + #endif } void DWIN_CopySettingsTo(char * const buff) { - memcpy(buff, &HMI_data, _MIN(sizeof(HMI_data), eeprom_data_size)); + memcpy(buff, &HMI_data, eeprom_data_size); } void DWIN_CopySettingsFrom(const char * const buff) { - // (void *)-> Avoid Warning when save data different from uintX_t in HMI_data_t struct - memcpy((void *)&HMI_data, buff, _MIN(sizeof(HMI_data), eeprom_data_size)); - dwin_zoffset = TERN0(HAS_BED_PROBE, probe.offset.z); + memcpy(&HMI_data, buff, sizeof(HMI_data_t)); if (HMI_data.Text_Color == HMI_data.Background_Color) DWIN_SetColorDefaults(); DWINUI::SetColors(HMI_data.Text_Color, HMI_data.Background_Color, HMI_data.StatusBg_Color); TERN_(PREVENT_COLD_EXTRUSION, ApplyExtMinT()); @@ -1726,8 +1743,13 @@ void DWIN_CopySettingsFrom(const char * const buff) { caselight.update_brightness(); #endif #if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS) - // Apply Led Color - leds.set_color(HMI_data.Led_Color); + leds.set_color( + (HMI_data.LED_Color >> 16) & 0xFF, + (HMI_data.LED_Color >> 8) & 0xFF, + (HMI_data.LED_Color >> 0) & 0xFF + OPTARG(HAS_WHITE_LED, (HMI_data.LED_Color >> 24) & 0xFF) + ); + leds.update(); #endif } @@ -1742,11 +1764,17 @@ void MarlinUI::init_lcd() { void DWIN_InitScreen() { HMI_Init(); // draws boot screen - DWINUI::onCursorDraw = Draw_Menu_Cursor; - DWINUI::onCursorErase = Erase_Menu_Cursor; + onCursorDraw = Draw_Menu_Cursor; + onCursorErase = Erase_Menu_Cursor; DWINUI::onTitleDraw = Draw_Title; - DWINUI::onMenuDraw = Draw_Menu; - DWIN_DrawStatusLine(nullptr); + onMenuDraw = Draw_Menu; + checkkey = 255; + CurrentMenu = nullptr; + PreviousMenu = nullptr; + index_file = MROWS; + hash_changed = true; + last_E = 0; + DWIN_DrawStatusLine(FSTR_P(nullptr)); DWIN_Draw_Dashboard(); Goto_Main_Menu(); } @@ -1764,8 +1792,8 @@ void MarlinUI::refresh() { /* Nothing to see here */ } #endif void MarlinUI::kill_screen(FSTR_P const lcd_error, FSTR_P const lcd_component) { - DWIN_Draw_Popup(ICON_BLTouch, F("Printer killed:"), lcd_error); - DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 270, F("Turn off the printer")); + DWIN_Draw_Popup(ICON_BLTouch, GET_TEXT_F(MSG_PRINTER_KILLED), lcd_error); + DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 270, GET_TEXT_F(MSG_TURN_OFF)); DWIN_UpdateLCD(); } @@ -1777,13 +1805,17 @@ void DWIN_RebootScreen() { safe_delay(500); } -void DWIN_RedrawScreen() { - Draw_Main_Area(); +void DWIN_RedrawDash() { hash_changed = true; DWIN_DrawStatusMessage(); DWIN_Draw_Dashboard(); } +void DWIN_RedrawScreen() { + Draw_Main_Area(); + DWIN_RedrawDash(); +} + #if ENABLED(ADVANCED_PAUSE_FEATURE) void DWIN_Popup_Pause(FSTR_P const fmsg, uint8_t button /*= 0*/) { HMI_SaveProcessID(button ? WaitResponse : NothingToDo); @@ -1810,15 +1842,15 @@ void DWIN_RedrawScreen() { case PAUSE_MESSAGE_OPTION: Goto_FilamentPurge(); break; case PAUSE_MESSAGE_RESUME: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_RESUME)); break; case PAUSE_MESSAGE_HEAT: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEAT), BTN_Continue); break; - case PAUSE_MESSAGE_HEATING: LCD_MESSAGE(MSG_FILAMENT_CHANGE_HEATING); break; + case PAUSE_MESSAGE_HEATING: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEATING)); break; case PAUSE_MESSAGE_STATUS: HMI_ReturnScreen(); break; // Exit from Pause, Load and Unload default: break; } } void Draw_Popup_FilamentPurge() { - DWIN_Draw_Popup(ICON_BLTouch, GET_TEXT_F(MSG_ADVANCED_PAUSE), F("Purge or Continue?")); - DWINUI::Draw_Button(BTN_Confirm, 26, 280); + DWIN_Draw_Popup(ICON_BLTouch, GET_TEXT_F(MSG_ADVANCED_PAUSE), GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE_CONTINUE)); + DWINUI::Draw_Button(BTN_Purge, 26, 280); DWINUI::Draw_Button(BTN_Continue, 146, 280); Draw_Select_Highlight(true); } @@ -1893,21 +1925,26 @@ void Goto_ConfirmToPrint() { #if ENABLED(EEPROM_SETTINGS) void WriteEeprom() { - const bool success = settings.save(); - HMI_AudioFeedback(success); + DWIN_DrawStatusLine(GET_TEXT_F(MSG_STORE_EEPROM)); + DWIN_UpdateLCD(); + DONE_BUZZ(settings.save()); } void ReadEeprom() { const bool success = settings.load(); DWIN_RedrawScreen(); - HMI_AudioFeedback(success); + DONE_BUZZ(success); } void ResetEeprom() { settings.reset(); DWIN_RedrawScreen(); - HMI_AudioFeedback(); + DONE_BUZZ(true); } + + #if HAS_MESH + void SaveMesh() { TERN(AUTO_BED_LEVELING_UBL, UBLSaveMesh(), WriteEeprom()); } + #endif #endif // Reset Printer @@ -1919,22 +1956,24 @@ void RebootPrinter() { hal.reboot(); } -void Goto_Info_Menu(){ +void Goto_Info_Menu() { Draw_Info_Menu(); + DWIN_UpdateLCD(); HMI_SaveProcessID(WaitResponse); } void Goto_Move_Menu() { #if HAS_HOTEND gcode.process_subcommands_now(F("G92E0")); // reset extruder position - planner.synchronize(); #endif Draw_Move_Menu(); } void DisableMotors() { queue.inject(F("M84")); } -void AutoLev() { queue.inject(F("G28XYO\nG28Z\nG29")); } // Force to get the current Z home position +void AutoLev() { // Always reacquire the Z "home" position + queue.inject(F(TERN(AUTO_BED_LEVELING_UBL, "G28Z\nG29P1", "G28XYO\nG28Z\nG29"))); +} void AutoHome() { queue.inject_P(G28_STR); } void HomeX() { queue.inject(F("G28X")); } @@ -1944,48 +1983,56 @@ void HomeZ() { queue.inject(F("G28Z")); } void SetHome() { // Apply workspace offset, making the current position 0,0,0 queue.inject(F("G92X0Y0Z0")); - HMI_AudioFeedback(); + DONE_BUZZ(true); } #if HAS_ZOFFSET_ITEM void ApplyZOffset() { TERN_(EEPROM_SETTINGS, settings.save()); } void LiveZOffset() { - last_zoffset = dwin_zoffset; - dwin_zoffset = MenuData.Value / 100.0f; #if EITHER(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP) - if (BABYSTEP_ALLOWED()) babystep.add_mm(Z_AXIS, dwin_zoffset - last_zoffset); + const_float_t step_zoffset = round((MenuData.Value / 100.0f) * planner.settings.axis_steps_per_mm[Z_AXIS]) - babystep.accum; + if (BABYSTEP_ALLOWED()) babystep.add_steps(Z_AXIS, step_zoffset); #endif } - #if EITHER(HAS_BED_PROBE, BABYSTEPPING) + + #if EITHER(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP) void SetZOffset() { + babystep.accum = round(planner.settings.axis_steps_per_mm[Z_AXIS] * BABY_Z_VAR); SetPFloatOnClick(Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX, 2, ApplyZOffset, LiveZOffset); } #endif void SetMoveZto0() { - char cmd[48] = ""; - char str_1[5] = "", str_2[5] = ""; - sprintf_P(cmd, PSTR("G28XYO\nG28Z\nG0X%sY%sF5000\nM420S0\nG0Z0F300"), - #if ENABLED(MESH_BED_LEVELING) - dtostrf(0, 1, 1, str_1), - dtostrf(0, 1, 1, str_2) - #else - dtostrf(X_CENTER, 1, 1, str_1), - dtostrf(Y_CENTER, 1, 1, str_2) - #endif - ); - gcode.process_subcommands_now(cmd); - planner.synchronize(); - LCD_MESSAGE_F("Now adjust Z Offset"); - HMI_AudioFeedback(true); + #if ENABLED(Z_SAFE_HOMING) + char cmd[54], str_1[5], str_2[5]; + sprintf_P(cmd, PSTR("G28XYO\nG28Z\nG0X%sY%sF5000\nM420S0\nG0Z0F300\nM400"), + dtostrf(Z_SAFE_HOMING_X_POINT, 1, 1, str_1), + dtostrf(Z_SAFE_HOMING_Y_POINT, 1, 1, str_2) + ); + gcode.process_subcommands_now(cmd); + #else + gcode.process_subcommands_now(F("G28O\nM420S0\nG0Z0F300\nM400")); + #endif + ui.reset_status(); + DONE_BUZZ(true); } -#endif + + void HomeZandDisable() { + SetMoveZto0(); + DisableMotors(); + } + +#endif // HAS_ZOFFSET_ITEM #if HAS_PREHEAT void DoPreheat0() { ui.preheat_all(0); } - void DoPreheat1() { ui.preheat_all(1); } - void DoPreheat2() { ui.preheat_all(2); } + #if PREHEAT_COUNT >= 2 + void DoPreheat1() { ui.preheat_all(1); } + #if PREHEAT_COUNT >= 3 + void DoPreheat2() { ui.preheat_all(2); } + #endif + #endif #endif void DoCoolDown() { thermalManager.cooldown(); } @@ -2010,9 +2057,9 @@ void ApplyMoveE() { planner.buffer_line(current_position, MMM_TO_MMS(FEEDRATE_E)); } } -void SetMoveX() { HMI_value.axis = X_AXIS; SetPFloatOnClick(X_MIN_POS, X_MAX_POS, UNITFDIGITS, planner.synchronize, LiveMove);} -void SetMoveY() { HMI_value.axis = Y_AXIS; SetPFloatOnClick(Y_MIN_POS, Y_MAX_POS, UNITFDIGITS, planner.synchronize, LiveMove);} -void SetMoveZ() { HMI_value.axis = Z_AXIS; SetPFloatOnClick(Z_MIN_POS, Z_MAX_POS, UNITFDIGITS, planner.synchronize, LiveMove);} +void SetMoveX() { HMI_value.axis = X_AXIS; SetPFloatOnClick(X_MIN_POS, X_MAX_POS, UNITFDIGITS, planner.synchronize, LiveMove); } +void SetMoveY() { HMI_value.axis = Y_AXIS; SetPFloatOnClick(Y_MIN_POS, Y_MAX_POS, UNITFDIGITS, planner.synchronize, LiveMove); } +void SetMoveZ() { HMI_value.axis = Z_AXIS; SetPFloatOnClick(Z_MIN_POS, Z_MAX_POS, UNITFDIGITS, planner.synchronize, LiveMove); } #if HAS_HOTEND void SetMoveE() { @@ -2025,14 +2072,13 @@ void SetMoveZ() { HMI_value.axis = Z_AXIS; SetPFloatOnClick(Z_MIN_POS, Z_MAX_POS #endif void SetPID(celsius_t t, heater_id_t h) { - char cmd[48] = ""; + char cmd[53] = ""; char str_1[5] = "", str_2[5] = ""; - sprintf_P(cmd, PSTR("G28OXY\nG0Z5F300\nG0X%sY%sF5000\nM84"), + sprintf_P(cmd, PSTR("G28OXY\nG0Z5F300\nG0X%sY%sF5000\nM84\nM400"), dtostrf(X_CENTER, 1, 1, str_1), dtostrf(Y_CENTER, 1, 1, str_2) ); gcode.process_subcommands_now(cmd); - planner.synchronize(); thermalManager.PID_autotune(t, h, HMI_data.PidCycles, true); } #if HAS_HOTEND @@ -2078,7 +2124,7 @@ void SetPID(celsius_t t, heater_id_t h) { DWIN_UpdateLCD(); } #if ENABLED(CASELIGHT_USES_BRIGHTNESS) - void LiveCaseLightBrightness() { HMI_data.CaseLight_Brightness = caselight.brightness = MenuData.Value; caselight.update_brightness(); } + void LiveCaseLightBrightness() { caselight.brightness = MenuData.Value; caselight.update_brightness(); } void SetCaseLightBrightness() { SetIntOnClick(0, 255, caselight.brightness, nullptr, LiveCaseLightBrightness); } #endif #endif @@ -2092,15 +2138,17 @@ void SetPID(celsius_t t, heater_id_t h) { } #endif #if HAS_COLOR_LEDS - void LiveLedColorR() { leds.color.r = MenuData.Value; HMI_data.Led_Color = leds.color; leds.update(); } - void SetLedColorR() { SetIntOnClick(0, 255, leds.color.r, nullptr, LiveLedColorR); } - void LiveLedColorG() { leds.color.g = MenuData.Value; HMI_data.Led_Color = leds.color; leds.update(); } - void SetLedColorG() { SetIntOnClick(0, 255, leds.color.g, nullptr, LiveLedColorG); } - void LiveLedColorB() { leds.color.b = MenuData.Value; HMI_data.Led_Color = leds.color; leds.update(); } - void SetLedColorB() { SetIntOnClick(0, 255, leds.color.b, nullptr, LiveLedColorB); } + void ApplyLEDColor() { HMI_data.LED_Color = TERN0(HAS_WHITE_LED, (leds.color.w << 24)) | (leds.color.r << 16) | (leds.color.g << 8) | leds.color.b; } + void LiveLEDColor(uint8_t *color) { *color = MenuData.Value; leds.update(); } + void LiveLEDColorR() { LiveLEDColor(&leds.color.r); } + void LiveLEDColorG() { LiveLEDColor(&leds.color.g); } + void LiveLEDColorB() { LiveLEDColor(&leds.color.b); } + void SetLEDColorR() { SetIntOnClick(0, 255, leds.color.r, ApplyLEDColor, LiveLEDColorR); } + void SetLEDColorG() { SetIntOnClick(0, 255, leds.color.g, ApplyLEDColor, LiveLEDColorG); } + void SetLEDColorB() { SetIntOnClick(0, 255, leds.color.b, ApplyLEDColor, LiveLEDColorB); } #if HAS_WHITE_LED - void LiveLedColorW() { leds.color.w = MenuData.Value; HMI_data.Led_Color = leds.color; leds.update(); } - void SetLedColorW() { SetIntOnClick(0, 255, leds.color.w, nullptr, LiveLedColorW); } + void LiveLEDColorW() { LiveLEDColor(&leds.color.w); } + void SetLEDColorW() { SetIntOnClick(0, 255, leds.color.w, ApplyLEDColor, LiveLEDColorW); } #endif #endif #endif @@ -2139,10 +2187,6 @@ void SetPID(celsius_t t, heater_id_t h) { } #endif - #if BOTH(HAS_HEATED_BED, PREHEAT_BEFORE_LEVELING) - void SetBedLevT() { SetPIntOnClick(BED_MINTEMP, BED_MAX_TARGET); } - #endif - #endif #if HAS_FILAMENT_SENSOR @@ -2197,7 +2241,7 @@ void DWIN_ApplyColor() { DWINUI::SetColors(HMI_data.Text_Color, HMI_data.Background_Color, HMI_data.StatusBg_Color); Draw_SelectColors_Menu(); hash_changed = true; - LCD_MESSAGE_F(GET_TEXT_F(MSG_COLORS_APPLIED)); + LCD_MESSAGE(MSG_COLORS_APPLIED); DWIN_Draw_Dashboard(); } @@ -2210,7 +2254,7 @@ void SetSpeed() { SetPIntOnClick(MIN_PRINT_SPEED, MAX_PRINT_SPEED); } #if HAS_HEATED_BED void ApplyBedTemp() { thermalManager.setTargetBed(MenuData.Value); } - void SetBedTemp() { SetIntOnClick(BED_MINTEMP, BED_MAX_TARGET, thermalManager.degTargetBed(), ApplyBedTemp); } + void SetBedTemp() { SetIntOnClick(MIN_BEDTEMP, MAX_BEDTEMP, thermalManager.degTargetBed(), ApplyBedTemp); } #endif #if HAS_FAN @@ -2225,18 +2269,18 @@ void SetSpeed() { SetPIntOnClick(MIN_PRINT_SPEED, MAX_PRINT_SPEED); } queue.inject(F("M600 B2")); } - void ParkHead(){ + void ParkHead() { LCD_MESSAGE(MSG_FILAMENT_PARK_ENABLED); queue.inject(F("G28O\nG27")); } #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - void UnloadFilament(){ + void UnloadFilament() { LCD_MESSAGE(MSG_FILAMENTUNLOAD); queue.inject(F("M702 Z20")); } - void LoadFilament(){ + void LoadFilament() { LCD_MESSAGE(MSG_FILAMENTLOAD); queue.inject(F("M701 Z20")); } @@ -2248,9 +2292,9 @@ void ApplyFlow() { planner.refresh_e_factor(0); } void SetFlow() { SetPIntOnClick(MIN_PRINT_FLOW, MAX_PRINT_FLOW, ApplyFlow); } // Bed Tramming -TERN(HAS_ONESTEP_LEVELING, float, void) Tram(uint8_t point) { +TERN(HAS_BED_PROBE, float, void) Tram(uint8_t point) { char cmd[100] = ""; - #if HAS_ONESTEP_LEVELING + #if HAS_BED_PROBE static bool inLev = false; float xpos = 0, ypos = 0, zval = 0, margin = 0; char str_1[6] = "", str_2[6] = "", str_3[6] = ""; @@ -2286,7 +2330,7 @@ TERN(HAS_ONESTEP_LEVELING, float, void) Tram(uint8_t point) { planner.synchronize(); - #if HAS_ONESTEP_LEVELING + #if HAS_BED_PROBE if (HMI_data.FullManualTramming) { planner.synchronize(); @@ -2297,15 +2341,14 @@ TERN(HAS_ONESTEP_LEVELING, float, void) Tram(uint8_t point) { queue.inject(cmd); } else { - LIMIT(xpos, X_MIN_POS, (X_MAX_POS + probe.offset.x)); - LIMIT(ypos, Y_MIN_POS, (Y_MAX_POS + probe.offset.y)); + LIMIT(xpos, MESH_MIN_X, MESH_MAX_X); + LIMIT(ypos, MESH_MIN_Y, MESH_MAX_Y); probe.stow(); gcode.process_subcommands_now(F("M420S0\nG28O")); - planner.synchronize(); inLev = true; zval = probe.probe_at_point(xpos, ypos, PROBE_PT_STOW); if (isnan(zval)) - LCD_MESSAGE_F("Position Not Reachable, check offsets"); + LCD_MESSAGE(MSG_ZPROBE_OUT); else { sprintf_P(cmd, PSTR("X:%s, Y:%s, Z:%s"), dtostrf(xpos, 1, 1, str_1), @@ -2318,7 +2361,7 @@ TERN(HAS_ONESTEP_LEVELING, float, void) Tram(uint8_t point) { } return zval; - #else + #else // !HAS_BED_PROBE sprintf_P(cmd, PSTR("M420S0\nG28O\nG90\nG0Z5F300\nG0X%iY%iF5000\nG0Z0F300"), xpos, ypos); queue.inject(cmd); @@ -2332,7 +2375,7 @@ void TramBR() { Tram(2); } void TramBL() { Tram(3); } void TramC () { Tram(4); } -#if HAS_ONESTEP_LEVELING +#if HAS_BED_PROBE void Trammingwizard() { bed_mesh_t zval = {0}; @@ -2349,22 +2392,30 @@ void TramC () { Tram(4); } MeshViewer.DrawMesh(zval, 2, 2); zval[0][1] = Tram(3); MeshViewer.DrawMesh(zval, 2, 2); - char str_1[6] = "", str_2[6] = ""; - ui.status_printf(0, F("Limits minZ: %s, maxZ: %s"), - dtostrf(MeshViewer.min, 1, 2, str_1), - dtostrf(MeshViewer.max, 1, 2, str_2) - ); + + DWINUI::Draw_CenteredString(140, F("Calculating average")); + DWINUI::Draw_CenteredString(160, F("and relative heights")); + safe_delay(1000); + float avg = 0.0f; + LOOP_L_N(x, 2) LOOP_L_N(y, 2) avg += zval[x][y]; + avg /= 4.0f; + LOOP_L_N(x, 2) LOOP_L_N(y, 2) zval[x][y] -= avg; + MeshViewer.DrawMesh(zval, 2, 2); + ui.reset_status(); + if (ABS(MeshViewer.max - MeshViewer.min) < 0.05) { DWINUI::Draw_CenteredString(140,F("Corners leveled")); DWINUI::Draw_CenteredString(160,F("Tolerance achieved!")); } else { uint8_t p = 0; - float d, max = 0; + float max = 0; FSTR_P plabel; - LOOP_L_N(x,2) LOOP_L_N(y,2) { - d = ABS(zval[x][y] - MeshViewer.avg); + bool s = true; + LOOP_L_N(x, 2) LOOP_L_N(y, 2) { + const float d = ABS(zval[x][y]); if (max < d) { + s = (zval[x][y] >= 0); max = d; p = x + 2 * y; } @@ -2376,9 +2427,10 @@ void TramC () { Tram(4); } case 0b11 : plabel = GET_TEXT_F(MSG_LEVBED_BR); break; default : plabel = F(""); break; } - DWINUI::Draw_CenteredString(130, F("Corners not leveled")); - DWINUI::Draw_CenteredString(150, F("Knob adjustment required")); - DWINUI::Draw_CenteredString(Color_Green, 170, plabel); + DWINUI::Draw_CenteredString(120, F("Corners not leveled")); + DWINUI::Draw_CenteredString(140, F("Knob adjustment required")); + DWINUI::Draw_CenteredString(Color_Green, 160, s ? F("Lower") : F("Raise")); + DWINUI::Draw_CenteredString(Color_Green, 180, plabel); } DWINUI::Draw_Button(BTN_Continue, 86, 305); checkkey = Menu; @@ -2391,14 +2443,13 @@ void TramC () { Tram(4); } DWIN_UpdateLCD(); } -#endif // HAS_ONESTEP_LEVELING +#endif // HAS_BED_PROBE #if ENABLED(MESH_BED_LEVELING) - void ManualMeshStart(){ + void ManualMeshStart() { LCD_MESSAGE(MSG_UBL_BUILD_MESH_MENU); gcode.process_subcommands_now(F("G28XYO\nG28Z\nM211S0\nG29S1")); - planner.synchronize(); #ifdef MANUAL_PROBE_START_Z const uint8_t line = CurrentMenu->line(MMeshMoveZItem->pos); DWINUI::Draw_Signed_Float(HMI_data.Text_Color, HMI_data.Background_Color, 3, 2, VALX - 2 * DWINUI::fontWidth(DWIN_FONT_MENU), MBASE(line), MANUAL_PROBE_START_Z); @@ -2412,15 +2463,14 @@ void TramC () { Tram(4); } planner.buffer_line(current_position, homing_feedrate(Z_AXIS)); } } - void SetMMeshMoveZ() { SetPFloatOnClick(-1, 1, 2, planner.synchronize, LiveMeshMoveZ);} + void SetMMeshMoveZ() { SetPFloatOnClick(-1, 1, 2, planner.synchronize, LiveMeshMoveZ); } - void ManualMeshContinue(){ + void ManualMeshContinue() { gcode.process_subcommands_now(F("G29S2")); - planner.synchronize(); - MMeshMoveZItem->draw(CurrentMenu->line(MMeshMoveZItem->pos)); + MMeshMoveZItem->redraw(); } - void ManualMeshSave(){ + void ManualMeshSave() { LCD_MESSAGE(MSG_UBL_STORAGE_MESH_MENU); queue.inject(F("M211S1\nM500")); } @@ -2432,7 +2482,7 @@ void TramC () { Tram(4); } void SetPreheatEndTemp() { SetPIntOnClick(MIN_ETEMP, MAX_ETEMP); } #endif #if HAS_HEATED_BED - void SetPreheatBedTemp() { SetPIntOnClick(BED_MINTEMP, BED_MAX_TARGET); } + void SetPreheatBedTemp() { SetPIntOnClick(MIN_BEDTEMP, MAX_BEDTEMP); } #endif #if HAS_FAN void SetPreheatFanSpeed() { SetPIntOnClick(0, 255); } @@ -2473,7 +2523,7 @@ void SetStepsZ() { HMI_value.axis = Z_AXIS, SetPFloatOnClick( MIN_STEP, MAX_STEP void SetHotendPidT() { SetPIntOnClick(MIN_ETEMP, MAX_ETEMP); } #endif #if HAS_HEATED_BED - void SetBedPidT() { SetPIntOnClick(BED_MINTEMP, BED_MAX_TARGET); } + void SetBedPidT() { SetPIntOnClick(MIN_BEDTEMP, MAX_BEDTEMP); } #endif #if HAS_HOTEND || HAS_HEATED_BED @@ -2500,10 +2550,12 @@ void SetStepsZ() { HMI_value.axis = Z_AXIS, SetPFloatOnClick( MIN_STEP, MAX_STEP #endif #if ENABLED(FWRETRACT) - void SetRetractLength() { SetPFloatOnClick( 0, 10, UNITFDIGITS); }; - void SetRetractSpeed() { SetPFloatOnClick( 1, 90, UNITFDIGITS); }; - void SetZRaise() { SetPFloatOnClick( 0, 2, 2); }; - void SetRecoverSpeed() { SetPFloatOnClick( 1, 90, UNITFDIGITS); }; + void Return_FWRetract_Menu() { (PreviousMenu == FilSetMenu) ? Draw_FilSet_Menu() : Draw_Tune_Menu(); } + void SetRetractLength() { SetPFloatOnClick( 0, 10, UNITFDIGITS); } + void SetRetractSpeed() { SetPFloatOnClick( 1, 90, UNITFDIGITS); } + void SetZRaise() { SetPFloatOnClick( 0, 2, 2); } + void SetRecoverSpeed() { SetPFloatOnClick( 1, 90, UNITFDIGITS); } + void SetAddRecover() { SetPFloatOnClick(-5, 5, UNITFDIGITS); } #endif // Special Menuitem Drawing functions ================================================= @@ -2583,7 +2635,7 @@ void onDrawAutoHome(MenuItemClass* menuitem, int8_t line) { } #if HAS_ZOFFSET_ITEM - #if EITHER(HAS_BED_PROBE, BABYSTEPPING) + #if EITHER(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP) void onDrawZOffset(MenuItemClass* menuitem, int8_t line) { if (HMI_IsChinese()) menuitem->SetFrame(1, 174, 164, 223, 177); onDrawPFloat2Menu(menuitem, line); @@ -2601,10 +2653,12 @@ void onDrawAutoHome(MenuItemClass* menuitem, int8_t line) { if (HMI_IsChinese()) menuitem->SetFrame(1, 100, 89, 151, 101); onDrawMenuItem(menuitem, line); } - void onDrawPreheat2(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 180, 89, 233, 100); - onDrawMenuItem(menuitem, line); - } + #if PREHEAT_COUNT > 1 + void onDrawPreheat2(MenuItemClass* menuitem, int8_t line) { + if (HMI_IsChinese()) menuitem->SetFrame(1, 180, 89, 233, 100); + onDrawMenuItem(menuitem, line); + } + #endif #endif #if HAS_PREHEAT @@ -2620,32 +2674,6 @@ void onDrawLanguage(MenuItemClass* menuitem, int8_t line) { DWINUI::Draw_String(VALX, MBASE(line), HMI_IsChinese() ? F("CN") : F("EN")); } -#if ENABLED(POWER_LOSS_RECOVERY) - void onDrawPwrLossR(MenuItemClass* menuitem, int8_t line) { onDrawChkbMenu(menuitem, line, recovery.enabled); } -#endif - -#if ENABLED(BAUD_RATE_GCODE) - void onDrawBaudrate(MenuItemClass* menuitem, int8_t line) { onDrawChkbMenu(menuitem, line, HMI_data.Baud115K); } -#endif - -#if ENABLED(CASE_LIGHT_MENU) - void onDrawCaseLight(MenuItemClass* menuitem, int8_t line) { onDrawChkbMenu(menuitem, line, caselight.on); } -#endif - -#if ENABLED(LED_CONTROL_MENU) - #if !BOTH(CASE_LIGHT_MENU, CASE_LIGHT_USE_NEOPIXEL) - void onDrawLedStatus(MenuItemClass* menuitem, int8_t line) { onDrawChkbMenu(menuitem, line, leds.lights_on); } - #endif -#endif - -#if ENABLED(SOUND_MENU_ITEM) - void onDrawEnableSound(MenuItemClass* menuitem, int8_t line) { onDrawChkbMenu(menuitem, line, ui.sound_on); } -#endif - -#ifdef BLTOUCH_HS_MODE - void onDrawHSMode(MenuItemClass* menuitem, int8_t line) { onDrawChkbMenu(menuitem, line, bltouch.high_speed_mode); } -#endif - void onDrawSelColorItem(MenuItemClass* menuitem, int8_t line) { const uint16_t color = *(uint16_t*)static_cast(menuitem)->value; DWIN_Draw_Rectangle(0, HMI_data.Highlight_Color, ICOX + 1, MBASE(line) - 1 + 1, ICOX + 18, MBASE(line) - 1 + 18); @@ -2737,10 +2765,12 @@ void onDrawSteps(MenuItemClass* menuitem, int8_t line) { if (HMI_IsChinese()) menuitem->SetFrame(1, 100, 89, 178, 101); onDrawSubMenu(menuitem,line); } - void onDrawABSPreheatSubMenu(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 180, 89, 260, 100); - onDrawSubMenu(menuitem,line); - } + #if PREHEAT_COUNT >= 2 + void onDrawABSPreheatSubMenu(MenuItemClass* menuitem, int8_t line) { + if (HMI_IsChinese()) menuitem->SetFrame(1, 180, 89, 260, 100); + onDrawSubMenu(menuitem,line); + } + #endif #endif // HAS_PREHEAT void onDrawSpeed(MenuItemClass* menuitem, int8_t line) { @@ -2937,70 +2967,67 @@ void Draw_Prepare_Menu() { if (CurrentMenu != PrepareMenu) { CurrentMenu = PrepareMenu; SetMenuTitle({133, 1, 28, 13}, GET_TEXT_F(MSG_PREPARE)); - DWINUI::MenuItemsPrepare(13); - MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Goto_Main_Menu); + MenuItemsPrepare(13); + BACK_ITEM(Goto_Main_Menu); #if ENABLED(ADVANCED_PAUSE_FEATURE) - MENU_ITEM(ICON_FilMan, GET_TEXT_F(MSG_FILAMENT_MAN), onDrawSubMenu, Draw_FilamentMan_Menu); + MENU_ITEM_F(ICON_FilMan, MSG_FILAMENT_MAN, onDrawSubMenu, Draw_FilamentMan_Menu); #endif - MENU_ITEM(ICON_Axis, GET_TEXT_F(MSG_MOVE_AXIS), onDrawMoveSubMenu, Goto_Move_Menu); - MENU_ITEM(ICON_Tram, GET_TEXT_F(MSG_BED_TRAMMING), onDrawSubMenu, Draw_Tramming_Menu); - MENU_ITEM(ICON_CloseMotor, GET_TEXT_F(MSG_DISABLE_STEPPERS), onDrawDisableMotors, DisableMotors); + MENU_ITEM_F(ICON_Axis, MSG_MOVE_AXIS, onDrawMoveSubMenu, Goto_Move_Menu); + MENU_ITEM_F(ICON_Tram, MSG_BED_TRAMMING, onDrawSubMenu, Draw_Tramming_Menu); + MENU_ITEM_F(ICON_CloseMotor, MSG_DISABLE_STEPPERS, onDrawDisableMotors, DisableMotors); #if ENABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU) - MENU_ITEM(ICON_Homing, GET_TEXT_F(MSG_HOMING), onDrawSubMenu, Draw_Homing_Menu); + MENU_ITEM_F(ICON_Homing, MSG_HOMING, onDrawSubMenu, Draw_Homing_Menu); #else - MENU_ITEM(ICON_Homing, GET_TEXT_F(MSG_AUTO_HOME), onDrawAutoHome, AutoHome); + MENU_ITEM_F(ICON_Homing, MSG_AUTO_HOME, onDrawAutoHome, AutoHome); #endif #if ENABLED(MESH_BED_LEVELING) - MENU_ITEM(ICON_ManualMesh, GET_TEXT_F(MSG_MANUAL_MESH), onDrawSubMenu, Draw_ManualMesh_Menu); + MENU_ITEM_F(ICON_ManualMesh, MSG_MANUAL_MESH, onDrawSubMenu, Draw_ManualMesh_Menu); #endif #if HAS_ONESTEP_LEVELING - MENU_ITEM(ICON_Level, GET_TEXT_F(MSG_AUTO_MESH), onDrawMenuItem, AutoLev); + MENU_ITEM_F(ICON_Level, MSG_AUTO_MESH, onDrawMenuItem, AutoLev); #endif #if HAS_ZOFFSET_ITEM - #if HAS_BED_PROBE - MENU_ITEM(ICON_SetZOffset, GET_TEXT_F(MSG_PROBE_WIZARD), onDrawSubMenu, Draw_ZOffsetWiz_Menu); - #elif ENABLED(BABYSTEPPING) - EDIT_ITEM(ICON_Zoffset, GET_TEXT_F(MSG_ZPROBE_ZOFFSET), onDrawPFloat2Menu, SetZOffset, &BABY_Z_VAR); + #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + MENU_ITEM_F(ICON_SetZOffset, MSG_PROBE_WIZARD, onDrawSubMenu, Draw_ZOffsetWiz_Menu); + #elif JUST_BABYSTEP + EDIT_ITEM_F(ICON_Zoffset, MSG_ZPROBE_ZOFFSET, onDrawPFloat2Menu, SetZOffset, &BABY_Z_VAR); #else - MENU_ITEM(ICON_SetHome, GET_TEXT_F(MSG_SET_HOME_OFFSETS), onDrawHomeOffset, SetHome); + MENU_ITEM_F(ICON_SetHome, MSG_SET_HOME_OFFSETS, onDrawHomeOffset, SetHome); #endif #endif #if HAS_PREHEAT - MENU_ITEM(ICON_PLAPreheat, GET_TEXT_F(MSG_PREHEAT_1), onDrawPreheat1, DoPreheat0); + MENU_ITEM_F(ICON_PLAPreheat, MSG_PREHEAT_1, onDrawPreheat1, DoPreheat0); #if PREHEAT_COUNT > 1 - MENU_ITEM(ICON_ABSPreheat, PSTR("Preheat " PREHEAT_2_LABEL), onDrawPreheat2, DoPreheat1); - #endif - #if PREHEAT_COUNT > 2 - MENU_ITEM(ICON_CustomPreheat, GET_TEXT_F(MSG_PREHEAT_CUSTOM), onDrawMenuItem, DoPreheat2); + MENU_ITEM(ICON_ABSPreheat, F("Preheat " PREHEAT_2_LABEL), onDrawPreheat2, DoPreheat1); + #if PREHEAT_COUNT > 2 + MENU_ITEM(ICON_CustomPreheat, F("Preheat " PREHEAT_3_LABEL), onDrawMenuItem, DoPreheat2); + #endif #endif #endif - MENU_ITEM(ICON_Cool, GET_TEXT_F(MSG_COOLDOWN), onDrawCooldown, DoCoolDown); - MENU_ITEM(ICON_Language, PSTR(GET_TEXT_F(MSG_UI_LANGUAGE)), onDrawLanguage, SetLanguage); + MENU_ITEM_F(ICON_Cool, MSG_COOLDOWN, onDrawCooldown, DoCoolDown); + MENU_ITEM_F(ICON_Language, MSG_UI_LANGUAGE, onDrawLanguage, SetLanguage); } ui.reset_status(true); CurrentMenu->draw(); } void Draw_Tramming_Menu() { - DWINUI::ClearMainArea(); checkkey = Menu; - if (!TrammingMenu) TrammingMenu = new MenuClass(); - if (CurrentMenu != TrammingMenu) { - CurrentMenu = TrammingMenu; - SetMenuTitle({0}, GET_TEXT_F(MSG_BED_TRAMMING)); // TODO: Chinese, English "Bed Tramming" JPG - DWINUI::MenuItemsPrepare(8); - MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu); - MENU_ITEM(ICON_Axis, GET_TEXT_F(MSG_LEVBED_FL), onDrawMenuItem, TramFL); - MENU_ITEM(ICON_Axis, GET_TEXT_F(MSG_LEVBED_FR), onDrawMenuItem, TramFR); - MENU_ITEM(ICON_Axis, GET_TEXT_F(MSG_LEVBED_BR), onDrawMenuItem, TramBR); - MENU_ITEM(ICON_Axis, GET_TEXT_F(MSG_LEVBED_BL), onDrawMenuItem, TramBL); - MENU_ITEM(ICON_Axis, GET_TEXT_F(MSG_LEVBED_C ), onDrawMenuItem, TramC ); - #if HAS_ONESTEP_LEVELING - MENU_ITEM(ICON_ProbeSet, F("Bed tramming wizard"), onDrawMenuItem, Trammingwizard); - MENU_ITEM(ICON_ProbeSet, GET_TEXT_F(MSG_BED_TRAMMING_MANUAL), onDrawManualTramming, SetManualTramming); + if (SetMenu(TrammingMenu, GET_TEXT_F(MSG_BED_TRAMMING), 8)) { + BACK_ITEM(Draw_Prepare_Menu); + #if HAS_BED_PROBE + MENU_ITEM_F(ICON_ProbeSet, MSG_TRAMMING_WIZARD, onDrawMenuItem, Trammingwizard); + EDIT_ITEM_F(ICON_ProbeSet, MSG_BED_TRAMMING_MANUAL, onDrawChkbMenu, SetManualTramming, &HMI_data.FullManualTramming); + #else + MENU_ITEM(ICON_MoveZ0, F("Home Z and disable"), onDrawMenuItem, HomeZandDisable); #endif + MENU_ITEM_F(ICON_Axis, MSG_LEVBED_FL, onDrawMenuItem, TramFL); + MENU_ITEM_F(ICON_Axis, MSG_LEVBED_FR, onDrawMenuItem, TramFR); + MENU_ITEM_F(ICON_Axis, MSG_LEVBED_BR, onDrawMenuItem, TramBR); + MENU_ITEM_F(ICON_Axis, MSG_LEVBED_BL, onDrawMenuItem, TramBL); + MENU_ITEM(ICON_Axis, GET_TEXT_F(MSG_LEVBED_C ), onDrawMenuItem, TramC ); } - CurrentMenu->draw(); + UpdateMenu(TrammingMenu); } void Draw_Control_Menu() { @@ -3009,27 +3036,27 @@ void Draw_Control_Menu() { if (CurrentMenu != ControlMenu) { CurrentMenu = ControlMenu; SetMenuTitle({103, 1, 28, 14}, GET_TEXT_F(MSG_CONTROL)); - DWINUI::MenuItemsPrepare(10); - MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Goto_Main_Menu); + MenuItemsPrepare(10); + BACK_ITEM(Goto_Main_Menu); + MENU_ITEM_F(ICON_Temperature, MSG_TEMPERATURE, onDrawTempSubMenu, Draw_Temperature_Menu); + MENU_ITEM_F(ICON_Motion, MSG_MOTION, onDrawMotionSubMenu, Draw_Motion_Menu); + #if ENABLED(EEPROM_SETTINGS) + MENU_ITEM_F(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawWriteEeprom, WriteEeprom); + MENU_ITEM_F(ICON_ReadEEPROM, MSG_LOAD_EEPROM, onDrawReadEeprom, ReadEeprom); + MENU_ITEM_F(ICON_ResumeEEPROM, MSG_RESTORE_DEFAULTS, onDrawResetEeprom, ResetEeprom); + #endif + MENU_ITEM_F(ICON_Reboot, MSG_RESET_PRINTER, onDrawMenuItem, RebootPrinter); #if ENABLED(CASE_LIGHT_MENU) #if ENABLED(CASELIGHT_USES_BRIGHTNESS) - MENU_ITEM(ICON_CaseLight, GET_TEXT_F(MSG_CASE_LIGHT), onDrawSubMenu, Draw_CaseLight_Menu); + MENU_ITEM_F(ICON_CaseLight, MSG_CASE_LIGHT, onDrawSubMenu, Draw_CaseLight_Menu); #else - MENU_ITEM(ICON_CaseLight, GET_TEXT_F(MSG_CASE_LIGHT), onDrawCaseLight, SetCaseLight); + MENU_ITEM_F(ICON_CaseLight, MSG_CASE_LIGHT, onDrawChkbMenu, SetCaseLight, &caselight.on); #endif #endif #if ENABLED(LED_CONTROL_MENU) - MENU_ITEM(ICON_LedControl, GET_TEXT_F(MSG_LED_CONTROL), onDrawSubMenu, Draw_LedControl_Menu); + MENU_ITEM_F(ICON_LedControl, MSG_LED_CONTROL, onDrawSubMenu, Draw_LedControl_Menu); #endif - MENU_ITEM(ICON_Temperature, GET_TEXT_F(MSG_TEMPERATURE), onDrawTempSubMenu, Draw_Temperature_Menu); - MENU_ITEM(ICON_Motion, GET_TEXT_F(MSG_MOTION), onDrawMotionSubMenu, Draw_Motion_Menu); - #if ENABLED(EEPROM_SETTINGS) - MENU_ITEM(ICON_WriteEEPROM, GET_TEXT_F(MSG_STORE_EEPROM), onDrawWriteEeprom, WriteEeprom); - MENU_ITEM(ICON_ReadEEPROM, GET_TEXT_F(MSG_LOAD_EEPROM), onDrawReadEeprom, ReadEeprom); - MENU_ITEM(ICON_ResumeEEPROM, GET_TEXT_F(MSG_RESTORE_DEFAULTS), onDrawResetEeprom, ResetEeprom); - #endif - MENU_ITEM(ICON_Reboot, GET_TEXT_F(MSG_RESET_PRINTER), onDrawMenuItem, RebootPrinter); - MENU_ITEM(ICON_Info, GET_TEXT_F(MSG_INFO_SCREEN), onDrawInfoSubMenu, Goto_Info_Menu); + MENU_ITEM_F(ICON_Info, MSG_INFO_SCREEN, onDrawInfoSubMenu, Goto_Info_Menu); } ui.reset_status(true); CurrentMenu->draw(); @@ -3037,57 +3064,52 @@ void Draw_Control_Menu() { void Draw_AdvancedSettings_Menu() { checkkey = Menu; - if (!AdvancedSettings) AdvancedSettings = new MenuClass(); - if (CurrentMenu != AdvancedSettings) { - CurrentMenu = AdvancedSettings; - SetMenuTitle({0}, GET_TEXT_F(MSG_ADVANCED_SETTINGS)); // TODO: Chinese, English "Advanced Settings" JPG - DWINUI::MenuItemsPrepare(17); - MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Goto_Main_Menu); + if (SetMenu(AdvancedSettings, GET_TEXT_F(MSG_ADVANCED_SETTINGS), 20)) { + BACK_ITEM(Goto_Main_Menu); #if ENABLED(EEPROM_SETTINGS) - MENU_ITEM(ICON_WriteEEPROM, GET_TEXT_F(MSG_STORE_EEPROM), onDrawMenuItem, WriteEeprom); - #endif - #if HAS_HOME_OFFSET - MENU_ITEM(ICON_HomeOffset, GET_TEXT_F(MSG_SET_HOME_OFFSETS), onDrawSubMenu, Draw_HomeOffset_Menu); + MENU_ITEM_F(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawMenuItem, WriteEeprom); #endif #if HAS_BED_PROBE - MENU_ITEM(ICON_ProbeSet, GET_TEXT_F(MSG_ZPROBE_SETTINGS), onDrawSubMenu, Draw_ProbeSet_Menu); + MENU_ITEM_F(ICON_ProbeSet, MSG_ZPROBE_SETTINGS, onDrawSubMenu, Draw_ProbeSet_Menu); + #endif + #if HAS_MESH + MENU_ITEM_F(ICON_ProbeSet, MSG_MESH_LEVELING, onDrawSubMenu, Draw_MeshSet_Menu); + #endif + #if HAS_HOME_OFFSET + MENU_ITEM_F(ICON_HomeOffset, MSG_SET_HOME_OFFSETS, onDrawSubMenu, Draw_HomeOffset_Menu); #endif #if HAS_HOTEND - MENU_ITEM(ICON_PIDNozzle, F("Hotend PID Settings"), onDrawSubMenu, Draw_HotendPID_Menu); + MENU_ITEM(ICON_PIDNozzle, F(STR_HOTEND_PID " Settings"), onDrawSubMenu, Draw_HotendPID_Menu); #endif #if HAS_HEATED_BED - MENU_ITEM(ICON_PIDbed, F("Bed PID Settings"), onDrawSubMenu, Draw_BedPID_Menu); - #endif - #if HAS_FILAMENT_SENSOR - MENU_ITEM(ICON_FilSet, GET_TEXT_F(MSG_FILAMENT_SET), onDrawSubMenu, Draw_FilSet_Menu); + MENU_ITEM(ICON_PIDbed, F(STR_BED_PID " Settings"), onDrawSubMenu, Draw_BedPID_Menu); #endif + MENU_ITEM_F(ICON_FilSet, MSG_FILAMENT_SET, onDrawSubMenu, Draw_FilSet_Menu); #if ENABLED(POWER_LOSS_RECOVERY) - MENU_ITEM(ICON_Pwrlossr, GET_TEXT_F(MSG_OUTAGE_RECOVERY), onDrawPwrLossR, SetPwrLossr); + EDIT_ITEM_F(ICON_Pwrlossr, MSG_OUTAGE_RECOVERY, onDrawChkbMenu, SetPwrLossr, &recovery.enabled); #endif #if ENABLED(BAUD_RATE_GCODE) - MENU_ITEM(ICON_SetBaudRate, F("115K baud"), onDrawBaudrate, SetBaudRate); + EDIT_ITEM(ICON_SetBaudRate, F("115K baud"), onDrawChkbMenu, SetBaudRate, &HMI_data.Baud115K); #endif #if HAS_LCD_BRIGHTNESS - EDIT_ITEM(ICON_Brightness, GET_TEXT_F(MSG_BRIGHTNESS), onDrawPInt8Menu, SetBrightness, &ui.brightness); + EDIT_ITEM_F(ICON_Brightness, MSG_BRIGHTNESS, onDrawPInt8Menu, SetBrightness, &ui.brightness); + MENU_ITEM_F(ICON_Brightness, MSG_BRIGHTNESS_OFF, onDrawMenuItem, TurnOffBacklight); #endif - MENU_ITEM(ICON_Scolor, GET_TEXT_F(MSG_COLORS_SELECT), onDrawSubMenu, Draw_SelectColors_Menu); + MENU_ITEM_F(ICON_Scolor, MSG_COLORS_SELECT, onDrawSubMenu, Draw_SelectColors_Menu); #if ENABLED(SOUND_MENU_ITEM) - MENU_ITEM(ICON_Sound, GET_TEXT_F(MSG_SOUND_ENABLE), onDrawEnableSound, SetEnableSound); - #endif - #if HAS_MESH - MENU_ITEM(ICON_MeshViewer, GET_TEXT_F(MSG_MESH_VIEW), onDrawSubMenu, DWIN_MeshViewer); + EDIT_ITEM_F(ICON_Sound, MSG_SOUND_ENABLE, onDrawChkbMenu, SetEnableSound, &ui.sound_on); #endif #if HAS_ESDIAG MENU_ITEM(ICON_ESDiag, F("End-stops diag."), onDrawSubMenu, Draw_EndStopDiag); #endif #if ENABLED(PRINTCOUNTER) - MENU_ITEM(ICON_PrintStats, GET_TEXT_F(MSG_INFO_STATS_MENU), onDrawSubMenu, Goto_PrintStats); - MENU_ITEM(ICON_PrintStatsReset, GET_TEXT_F(MSG_INFO_PRINT_COUNT_RESET), onDrawSubMenu, PrintStats.Reset); + MENU_ITEM_F(ICON_PrintStats, MSG_INFO_STATS_MENU, onDrawSubMenu, Goto_PrintStats); + MENU_ITEM_F(ICON_PrintStatsReset, MSG_INFO_PRINT_COUNT_RESET, onDrawSubMenu, PrintStats.Reset); #endif - MENU_ITEM(ICON_Lock, GET_TEXT_F(MSG_LOCKSCREEN), onDrawMenuItem, DWIN_LockScreen); + MENU_ITEM_F(ICON_Lock, MSG_LOCKSCREEN, onDrawMenuItem, DWIN_LockScreen); } ui.reset_status(true); - CurrentMenu->draw(); + UpdateMenu(AdvancedSettings); } void Draw_Move_Menu() { @@ -3096,181 +3118,146 @@ void Draw_Move_Menu() { if (CurrentMenu != MoveMenu) { CurrentMenu = MoveMenu; SetMenuTitle({192, 1, 42, 14}, GET_TEXT_F(MSG_MOVE_AXIS)); - DWINUI::MenuItemsPrepare(5); - MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu); - EDIT_ITEM(ICON_MoveX, GET_TEXT_F(MSG_MOVE_X), onDrawMoveX, SetMoveX, ¤t_position.x); - EDIT_ITEM(ICON_MoveY, GET_TEXT_F(MSG_MOVE_Y), onDrawMoveY, SetMoveY, ¤t_position.y); - EDIT_ITEM(ICON_MoveZ, GET_TEXT_F(MSG_MOVE_Z), onDrawMoveZ, SetMoveZ, ¤t_position.z); + MenuItemsPrepare(5); + BACK_ITEM(Draw_Prepare_Menu); + EDIT_ITEM_F(ICON_MoveX, MSG_MOVE_X, onDrawMoveX, SetMoveX, ¤t_position.x); + EDIT_ITEM_F(ICON_MoveY, MSG_MOVE_Y, onDrawMoveY, SetMoveY, ¤t_position.y); + EDIT_ITEM_F(ICON_MoveZ, MSG_MOVE_Z, onDrawMoveZ, SetMoveZ, ¤t_position.z); #if HAS_HOTEND - EDIT_ITEM(ICON_Extruder, GET_TEXT_F(MSG_MOVE_E), onDrawMoveE, SetMoveE, ¤t_position.e); + EDIT_ITEM_F(ICON_Extruder, MSG_MOVE_E, onDrawMoveE, SetMoveE, ¤t_position.e); #endif } CurrentMenu->draw(); - if (!all_axes_trusted()) LCD_MESSAGE_F("WARNING: current position is unknown, home axes"); + if (!all_axes_trusted()) LCD_MESSAGE_F("WARNING: Current position unknown. Home axes."); } #if HAS_HOME_OFFSET void Draw_HomeOffset_Menu() { checkkey = Menu; - if (!HomeOffMenu) HomeOffMenu = new MenuClass(); - if (CurrentMenu != HomeOffMenu) { - CurrentMenu = HomeOffMenu; - SetMenuTitle({0}, GET_TEXT_F(MSG_SET_HOME_OFFSETS)); // TODO: Chinese, English "Set Home Offsets" JPG - DWINUI::MenuItemsPrepare(4); - MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_AdvancedSettings_Menu); - EDIT_ITEM(ICON_HomeOffsetX, GET_TEXT_F(MSG_HOME_OFFSET_X), onDrawPFloatMenu, SetHomeOffsetX, &home_offset[X_AXIS]); - EDIT_ITEM(ICON_HomeOffsetY, GET_TEXT_F(MSG_HOME_OFFSET_Y), onDrawPFloatMenu, SetHomeOffsetY, &home_offset[Y_AXIS]); - EDIT_ITEM(ICON_HomeOffsetZ, GET_TEXT_F(MSG_HOME_OFFSET_Z), onDrawPFloatMenu, SetHomeOffsetZ, &home_offset[Z_AXIS]); + if (SetMenu(HomeOffMenu, GET_TEXT_F(MSG_SET_HOME_OFFSETS), 4)) { + BACK_ITEM(Draw_AdvancedSettings_Menu); + EDIT_ITEM_F(ICON_HomeOffsetX, MSG_HOME_OFFSET_X, onDrawPFloatMenu, SetHomeOffsetX, &home_offset.x); + EDIT_ITEM_F(ICON_HomeOffsetY, MSG_HOME_OFFSET_Y, onDrawPFloatMenu, SetHomeOffsetY, &home_offset.y); + EDIT_ITEM_F(ICON_HomeOffsetZ, MSG_HOME_OFFSET_Z, onDrawPFloatMenu, SetHomeOffsetZ, &home_offset.z); } - CurrentMenu->draw(); + UpdateMenu(HomeOffMenu); } #endif #if HAS_BED_PROBE void Draw_ProbeSet_Menu() { checkkey = Menu; - if (!ProbeSetMenu) ProbeSetMenu = new MenuClass(); - if (CurrentMenu != ProbeSetMenu) { - CurrentMenu = ProbeSetMenu; - SetMenuTitle({0}, GET_TEXT_F(MSG_ZPROBE_SETTINGS)); // TODO: Chinese, English "Probe Settings" JPG - DWINUI::MenuItemsPrepare(9); - MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_AdvancedSettings_Menu); - EDIT_ITEM(ICON_ProbeOffsetX, GET_TEXT_F(MSG_ZPROBE_XOFFSET), onDrawPFloatMenu, SetProbeOffsetX, &probe.offset.x); - EDIT_ITEM(ICON_ProbeOffsetY, GET_TEXT_F(MSG_ZPROBE_YOFFSET), onDrawPFloatMenu, SetProbeOffsetY, &probe.offset.y); - EDIT_ITEM(ICON_ProbeOffsetZ, GET_TEXT_F(MSG_ZPROBE_ZOFFSET), onDrawPFloat2Menu, SetProbeOffsetZ, &probe.offset.z); - #if BOTH(HAS_HEATED_BED, PREHEAT_BEFORE_LEVELING) - EDIT_ITEM(ICON_Temperature, GET_TEXT_F(MSG_UBL_SET_TEMP_BED), onDrawPIntMenu, SetBedLevT, &HMI_data.BedLevT); - #endif + if (SetMenu(ProbeSetMenu, GET_TEXT_F(MSG_ZPROBE_SETTINGS), 8)) { + BACK_ITEM(Draw_AdvancedSettings_Menu); + EDIT_ITEM_F(ICON_ProbeOffsetX, MSG_ZPROBE_XOFFSET, onDrawPFloatMenu, SetProbeOffsetX, &probe.offset.x); + EDIT_ITEM_F(ICON_ProbeOffsetY, MSG_ZPROBE_YOFFSET, onDrawPFloatMenu, SetProbeOffsetY, &probe.offset.y); + EDIT_ITEM_F(ICON_ProbeOffsetZ, MSG_ZPROBE_ZOFFSET, onDrawPFloat2Menu, SetProbeOffsetZ, &probe.offset.z); #ifdef BLTOUCH_HS_MODE - MENU_ITEM(ICON_HSMode, F("Enable HS mode"), onDrawHSMode, SetHSMode); + EDIT_ITEM_F(ICON_HSMode, MSG_ENABLE_HS_MODE, onDrawChkbMenu, SetHSMode, &bltouch.high_speed_mode); #endif - MENU_ITEM(ICON_ProbeTest, GET_TEXT_F(MSG_M48_TEST), onDrawMenuItem, ProbeTest); - MENU_ITEM(ICON_ProbeStow, GET_TEXT_F(MSG_MANUAL_STOW), onDrawMenuItem, ProbeStow); - MENU_ITEM(ICON_ProbeDeploy, GET_TEXT_F(MSG_MANUAL_DEPLOY), onDrawMenuItem, ProbeDeploy); + MENU_ITEM_F(ICON_ProbeTest, MSG_M48_TEST, onDrawMenuItem, ProbeTest); + MENU_ITEM_F(ICON_ProbeStow, MSG_MANUAL_STOW, onDrawMenuItem, ProbeStow); + MENU_ITEM_F(ICON_ProbeDeploy, MSG_MANUAL_DEPLOY, onDrawMenuItem, ProbeDeploy); } - CurrentMenu->draw(); + UpdateMenu(ProbeSetMenu); } + #endif -#if HAS_FILAMENT_SENSOR - void Draw_FilSet_Menu() { - checkkey = Menu; - if (!FilSetMenu) FilSetMenu = new MenuClass(); - if (CurrentMenu != FilSetMenu) { - CurrentMenu = FilSetMenu; - CurrentMenu->MenuTitle.SetCaption(GET_TEXT_F(MSG_FILAMENT_SET)); - DWINUI::MenuItemsPrepare(10); - MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawMenuItem, Draw_AdvancedSettings_Menu); - #if HAS_FILAMENT_SENSOR - MENU_ITEM(ICON_Runout, GET_TEXT_F(MSG_RUNOUT_ENABLE), onDrawRunoutEnable, SetRunoutEnable); - #endif - #if HAS_FILAMENT_RUNOUT_DISTANCE - EDIT_ITEM(ICON_Runout, F("Runout Distance"), onDrawPFloatMenu, SetRunoutDistance, &runout.runout_distance()); - #endif - #if ENABLED(PREVENT_COLD_EXTRUSION) - EDIT_ITEM(ICON_ExtrudeMinT, F("Extrude Min Temp."), onDrawPIntMenu, SetExtMinT, &HMI_data.ExtMinT); - #endif - #if ENABLED(ADVANCED_PAUSE_FEATURE) - EDIT_ITEM(ICON_FilLoad, GET_TEXT_F(MSG_FILAMENT_LOAD), onDrawPFloatMenu, SetFilLoad, &fc_settings[0].load_length); - EDIT_ITEM(ICON_FilUnload, GET_TEXT_F(MSG_FILAMENT_UNLOAD), onDrawPFloatMenu, SetFilUnload, &fc_settings[0].unload_length); - #endif - #if ENABLED(FWRETRACT) - EDIT_ITEM(ICON_FWRetLength, GET_TEXT_F(MSG_CONTROL_RETRACT), onDrawPFloatMenu, SetRetractLength, &fwretract.settings.retract_length); - EDIT_ITEM(ICON_FWRetSpeed, GET_TEXT_F(MSG_SINGLENOZZLE_RETRACT_SPEED), onDrawPFloatMenu, SetRetractSpeed, &fwretract.settings.retract_feedrate_mm_s); - EDIT_ITEM(ICON_FWRetZRaise, GET_TEXT_F(MSG_CONTROL_RETRACT_ZHOP), onDrawPFloat2Menu, SetZRaise, &fwretract.settings.retract_zraise); - EDIT_ITEM(ICON_FWRecSpeed, GET_TEXT_F(MSG_SINGLENOZZLE_UNRETRACT_SPEED), onDrawPFloatMenu, SetRecoverSpeed, &fwretract.settings.retract_recover_feedrate_mm_s); - #endif - } - CurrentMenu->draw(); +void Draw_FilSet_Menu() { + checkkey = Menu; + if (SetMenu(FilSetMenu, GET_TEXT_F(MSG_FILAMENT_SET), 9)) { + BACK_ITEM(Draw_AdvancedSettings_Menu); + #if HAS_FILAMENT_SENSOR + EDIT_ITEM_F(ICON_Runout, MSG_RUNOUT_ENABLE, onDrawChkbMenu, SetRunoutEnable, &runout.enabled); + #endif + #if HAS_FILAMENT_RUNOUT_DISTANCE + EDIT_ITEM_F(ICON_Runout, MSG_RUNOUT_DISTANCE_MM, onDrawPFloatMenu, SetRunoutDistance, &runout.runout_distance()); + #endif + #if ENABLED(PREVENT_COLD_EXTRUSION) + EDIT_ITEM_F(ICON_ExtrudeMinT, MSG_EXTRUDER_MIN_TEMP, onDrawPIntMenu, SetExtMinT, &HMI_data.ExtMinT); + #endif + #if ENABLED(ADVANCED_PAUSE_FEATURE) + EDIT_ITEM_F(ICON_FilLoad, MSG_FILAMENT_LOAD, onDrawPFloatMenu, SetFilLoad, &fc_settings[0].load_length); + EDIT_ITEM_F(ICON_FilUnload, MSG_FILAMENT_UNLOAD, onDrawPFloatMenu, SetFilUnload, &fc_settings[0].unload_length); + #endif + #if ENABLED(FWRETRACT) + MENU_ITEM_F(ICON_FWRetract, MSG_FWRETRACT, onDrawSubMenu, Draw_FWRetract_Menu); + #endif } -#endif // HAS_FILAMENT_SENSOR + UpdateMenu(FilSetMenu); +} void Draw_SelectColors_Menu() { checkkey = Menu; - if (!SelectColorMenu) SelectColorMenu = new MenuClass(); - if (CurrentMenu != SelectColorMenu) { - CurrentMenu = SelectColorMenu; - SetMenuTitle({0}, GET_TEXT_F(MSG_COLORS_SELECT)); // TODO: Chinese, English "Select Color" JPG - DWINUI::MenuItemsPrepare(20); - MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_AdvancedSettings_Menu); - MENU_ITEM(ICON_StockConfiguration, GET_TEXT_F(MSG_RESTORE_DEFAULTS), onDrawMenuItem, RestoreDefaultsColors); - EDIT_ITEM(0, "Screen Background", onDrawSelColorItem, SelColor, &HMI_data.Background_Color); - EDIT_ITEM(0, "Cursor", onDrawSelColorItem, SelColor, &HMI_data.Cursor_color); - EDIT_ITEM(0, "Title Background", onDrawSelColorItem, SelColor, &HMI_data.TitleBg_color); - EDIT_ITEM(0, "Title Text", onDrawSelColorItem, SelColor, &HMI_data.TitleTxt_color); - EDIT_ITEM(0, "Text", onDrawSelColorItem, SelColor, &HMI_data.Text_Color); - EDIT_ITEM(0, "Selected", onDrawSelColorItem, SelColor, &HMI_data.Selected_Color); - EDIT_ITEM(0, "Split Line", onDrawSelColorItem, SelColor, &HMI_data.SplitLine_Color); - EDIT_ITEM(0, "Highlight", onDrawSelColorItem, SelColor, &HMI_data.Highlight_Color); - EDIT_ITEM(0, "Status Background", onDrawSelColorItem, SelColor, &HMI_data.StatusBg_Color); - EDIT_ITEM(0, "Status Text", onDrawSelColorItem, SelColor, &HMI_data.StatusTxt_Color); - EDIT_ITEM(0, "Popup Background", onDrawSelColorItem, SelColor, &HMI_data.PopupBg_color); - EDIT_ITEM(0, "Popup Text", onDrawSelColorItem, SelColor, &HMI_data.PopupTxt_Color); - EDIT_ITEM(0, "Alert Background", onDrawSelColorItem, SelColor, &HMI_data.AlertBg_Color); - EDIT_ITEM(0, "Alert Text", onDrawSelColorItem, SelColor, &HMI_data.AlertTxt_Color); - EDIT_ITEM(0, "Percent Text", onDrawSelColorItem, SelColor, &HMI_data.PercentTxt_Color); - EDIT_ITEM(0, "Bar Fill", onDrawSelColorItem, SelColor, &HMI_data.Barfill_Color); - EDIT_ITEM(0, "Indicator value", onDrawSelColorItem, SelColor, &HMI_data.Indicator_Color); - EDIT_ITEM(0, "Coordinate value", onDrawSelColorItem, SelColor, &HMI_data.Coordinate_Color); - } - CurrentMenu->draw(); + if (SetMenu(SelectColorMenu, GET_TEXT_F(MSG_COLORS_SELECT), 20)) { + BACK_ITEM(Draw_AdvancedSettings_Menu); + MENU_ITEM_F(ICON_StockConfiguration, MSG_RESTORE_DEFAULTS, onDrawMenuItem, RestoreDefaultsColors); + EDIT_ITEM(0, F("Screen Background"), onDrawSelColorItem, SelColor, &HMI_data.Background_Color); + EDIT_ITEM(0, F("Cursor"), onDrawSelColorItem, SelColor, &HMI_data.Cursor_color); + EDIT_ITEM(0, F("Title Background"), onDrawSelColorItem, SelColor, &HMI_data.TitleBg_color); + EDIT_ITEM(0, F("Title Text"), onDrawSelColorItem, SelColor, &HMI_data.TitleTxt_color); + EDIT_ITEM(0, F("Text"), onDrawSelColorItem, SelColor, &HMI_data.Text_Color); + EDIT_ITEM(0, F("Selected"), onDrawSelColorItem, SelColor, &HMI_data.Selected_Color); + EDIT_ITEM(0, F("Split Line"), onDrawSelColorItem, SelColor, &HMI_data.SplitLine_Color); + EDIT_ITEM(0, F("Highlight"), onDrawSelColorItem, SelColor, &HMI_data.Highlight_Color); + EDIT_ITEM(0, F("Status Background"), onDrawSelColorItem, SelColor, &HMI_data.StatusBg_Color); + EDIT_ITEM(0, F("Status Text"), onDrawSelColorItem, SelColor, &HMI_data.StatusTxt_Color); + EDIT_ITEM(0, F("Popup Background"), onDrawSelColorItem, SelColor, &HMI_data.PopupBg_color); + EDIT_ITEM(0, F("Popup Text"), onDrawSelColorItem, SelColor, &HMI_data.PopupTxt_Color); + EDIT_ITEM(0, F("Alert Background"), onDrawSelColorItem, SelColor, &HMI_data.AlertBg_Color); + EDIT_ITEM(0, F("Alert Text"), onDrawSelColorItem, SelColor, &HMI_data.AlertTxt_Color); + EDIT_ITEM(0, F("Percent Text"), onDrawSelColorItem, SelColor, &HMI_data.PercentTxt_Color); + EDIT_ITEM(0, F("Bar Fill"), onDrawSelColorItem, SelColor, &HMI_data.Barfill_Color); + EDIT_ITEM(0, F("Indicator value"), onDrawSelColorItem, SelColor, &HMI_data.Indicator_Color); + EDIT_ITEM(0, F("Coordinate value"), onDrawSelColorItem, SelColor, &HMI_data.Coordinate_Color); + } + UpdateMenu(SelectColorMenu); } void Draw_GetColor_Menu() { checkkey = Menu; - if (!GetColorMenu) GetColorMenu = new MenuClass(); - if (CurrentMenu != GetColorMenu) { - CurrentMenu = GetColorMenu; - SetMenuTitle({0}, GET_TEXT_F(MSG_COLORS_GET)); // TODO: Chinese, English "Get Color" JPG - DWINUI::MenuItemsPrepare(5); - MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, DWIN_ApplyColor); - MENU_ITEM(ICON_Cancel, GET_TEXT_F(MSG_BUTTON_CANCEL), onDrawMenuItem, Draw_SelectColors_Menu); - MENU_ITEM(0, GET_TEXT_F(MSG_COLORS_RED), onDrawGetColorItem, SetRGBColor); - MENU_ITEM(1, GET_TEXT_F(MSG_COLORS_GREEN), onDrawGetColorItem, SetRGBColor); - MENU_ITEM(2, GET_TEXT_F(MSG_COLORS_BLUE), onDrawGetColorItem, SetRGBColor); - } - CurrentMenu->draw(); + if (SetMenu(GetColorMenu, GET_TEXT_F(MSG_COLORS_GET), 5)) { + BACK_ITEM(DWIN_ApplyColor); + MENU_ITEM_F(ICON_Cancel, MSG_BUTTON_CANCEL, onDrawMenuItem, Draw_SelectColors_Menu); + MENU_ITEM_F(0, MSG_COLORS_RED, onDrawGetColorItem, SetRGBColor); + MENU_ITEM_F(1, MSG_COLORS_GREEN, onDrawGetColorItem, SetRGBColor); + MENU_ITEM_F(2, MSG_COLORS_BLUE, onDrawGetColorItem, SetRGBColor); + } + UpdateMenu(GetColorMenu); DWIN_Draw_Rectangle(1, *MenuData.P_Int, 20, 315, DWIN_WIDTH - 20, 335); } #if BOTH(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS) void Draw_CaseLight_Menu() { checkkey = Menu; - if (!CaseLightMenu) CaseLightMenu = new MenuClass(); - if (CurrentMenu != CaseLightMenu) { - CurrentMenu = CaseLightMenu; - SetMenuTitle({0}, GET_TEXT_F(MSG_CASE_LIGHT)); // TODO: Chinese, English "Case Light" JPG - DWINUI::MenuItemsPrepare(3); - MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Control_Menu); - MENU_ITEM(ICON_CaseLight, GET_TEXT_F(MSG_CASE_LIGHT), onDrawCaseLight, SetCaseLight); - EDIT_ITEM(ICON_Brightness, GET_TEXT_F(MSG_CASE_LIGHT_BRIGHTNESS), onDrawPInt8Menu, SetCaseLightBrightness, &caselight.brightness); + if (SetMenu(CaseLightMenu, GET_TEXT_F(MSG_CASE_LIGHT), 3)) { + BACK_ITEM(Draw_Control_Menu); + EDIT_ITEM_F(ICON_CaseLight, MSG_CASE_LIGHT, onDrawChkbMenu, SetCaseLight, &caselight.on); + EDIT_ITEM_F(ICON_Brightness, MSG_CASE_LIGHT_BRIGHTNESS, onDrawPInt8Menu, SetCaseLightBrightness, &caselight.brightness); } - CurrentMenu->draw(); + UpdateMenu(CaseLightMenu); } #endif #if ENABLED(LED_CONTROL_MENU) void Draw_LedControl_Menu() { checkkey = Menu; - if (!LedControlMenu) LedControlMenu = new MenuClass(); - if (CurrentMenu != LedControlMenu) { - CurrentMenu = LedControlMenu; - SetMenuTitle({0}, GET_TEXT_F(MSG_LED_CONTROL)); // TODO: Chinese, English "LED Control" JPG - DWINUI::MenuItemsPrepare(6); - MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Control_Menu); + if (SetMenu(LedControlMenu, GET_TEXT_F(MSG_LED_CONTROL), 6)) { + BACK_ITEM(Draw_Control_Menu); #if !BOTH(CASE_LIGHT_MENU, CASE_LIGHT_USE_NEOPIXEL) - MENU_ITEM(ICON_LedControl, GET_TEXT_F(MSG_LEDS), onDrawLedStatus, SetLedStatus); + EDIT_ITEM_F(ICON_LedControl, MSG_LEDS, onDrawChkbMenu, SetLedStatus, &leds.lights_on); #endif #if HAS_COLOR_LEDS - EDIT_ITEM(ICON_LedControl, GET_TEXT_F(MSG_COLORS_RED), onDrawPInt8Menu, SetLedColorR, &leds.color.r); - EDIT_ITEM(ICON_LedControl, GET_TEXT_F(MSG_COLORS_GREEN), onDrawPInt8Menu, SetLedColorG, &leds.color.g); - EDIT_ITEM(ICON_LedControl, GET_TEXT_F(MSG_COLORS_BLUE), onDrawPInt8Menu, SetLedColorB, &leds.color.b); + EDIT_ITEM_F(ICON_LedControl, MSG_COLORS_RED, onDrawPInt8Menu, SetLEDColorR, &leds.color.r); + EDIT_ITEM_F(ICON_LedControl, MSG_COLORS_GREEN, onDrawPInt8Menu, SetLEDColorG, &leds.color.g); + EDIT_ITEM_F(ICON_LedControl, MSG_COLORS_BLUE, onDrawPInt8Menu, SetLEDColorB, &leds.color.b); #if ENABLED(HAS_WHITE_LED) - EDIT_ITEM(ICON_LedControl, GET_TEXT_F(MSG_COLORS_WHITE), onDrawPInt8Menu, SetLedColorW, &leds.color.w); + EDIT_ITEM_F(ICON_LedControl, MSG_COLORS_WHITE, onDrawPInt8Menu, SetLedColorW, &leds.color.w); #endif #endif } - CurrentMenu->draw(); + UpdateMenu(LedControlMenu); } #endif @@ -3280,40 +3267,37 @@ void Draw_Tune_Menu() { if (CurrentMenu != TuneMenu) { CurrentMenu = TuneMenu; SetMenuTitle({73, 2, 28, 12}, GET_TEXT_F(MSG_TUNE)); // TODO: Chinese, English "Tune" JPG - DWINUI::MenuItemsPrepare(16); - MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Goto_PrintProcess); - #if ENABLED(CASE_LIGHT_MENU) - MENU_ITEM(ICON_CaseLight, GET_TEXT_F(MSG_CASE_LIGHT), onDrawCaseLight, SetCaseLight); - #elif ENABLED(LED_CONTROL_MENU) && DISABLED(CASE_LIGHT_USE_NEOPIXEL) - MENU_ITEM(ICON_LedControl, GET_TEXT_F(MSG_LEDS), onDrawLedStatus, SetLedStatus); - #endif - EDIT_ITEM(ICON_Speed, GET_TEXT_F(MSG_SPEED), onDrawSpeedItem, SetSpeed, &feedrate_percentage); + MenuItemsPrepare(16); + BACK_ITEM(Goto_PrintProcess); + EDIT_ITEM_F(ICON_Speed, MSG_SPEED, onDrawSpeedItem, SetSpeed, &feedrate_percentage); #if HAS_HOTEND - HotendTargetItem = EDIT_ITEM(ICON_HotendTemp, GET_TEXT_F(MSG_UBL_SET_TEMP_HOTEND), onDrawHotendTemp, SetHotendTemp, &thermalManager.temp_hotend[0].target); + HotendTargetItem = EDIT_ITEM_F(ICON_HotendTemp, MSG_UBL_SET_TEMP_HOTEND, onDrawHotendTemp, SetHotendTemp, &thermalManager.temp_hotend[0].target); #endif #if HAS_HEATED_BED - BedTargetItem = EDIT_ITEM(ICON_BedTemp, GET_TEXT_F(MSG_UBL_SET_TEMP_BED), onDrawBedTemp, SetBedTemp, &thermalManager.temp_bed.target); + BedTargetItem = EDIT_ITEM_F(ICON_BedTemp, MSG_UBL_SET_TEMP_BED, onDrawBedTemp, SetBedTemp, &thermalManager.temp_bed.target); #endif #if HAS_FAN - FanSpeedItem = EDIT_ITEM(ICON_FanSpeed, GET_TEXT_F(MSG_FAN_SPEED), onDrawFanSpeed, SetFanSpeed, &thermalManager.fan_speed[0]); + FanSpeedItem = EDIT_ITEM_F(ICON_FanSpeed, MSG_FAN_SPEED, onDrawFanSpeed, SetFanSpeed, &thermalManager.fan_speed[0]); #endif - #if HAS_ZOFFSET_ITEM && EITHER(HAS_BED_PROBE, BABYSTEPPING) - EDIT_ITEM(ICON_Zoffset, GET_TEXT_F(MSG_ZPROBE_ZOFFSET), onDrawZOffset, SetZOffset, &BABY_Z_VAR); - #endif - #if ENABLED(FWRETRACT) - EDIT_ITEM(ICON_FWRetLength, GET_TEXT_F(MSG_CONTROL_RETRACT), onDrawPFloatMenu, SetRetractLength, &fwretract.settings.retract_length); - EDIT_ITEM(ICON_FWRetSpeed, GET_TEXT_F(MSG_SINGLENOZZLE_RETRACT_SPEED), onDrawPFloatMenu, SetRetractSpeed, &fwretract.settings.retract_feedrate_mm_s); - EDIT_ITEM(ICON_FWRetZRaise, GET_TEXT_F(MSG_CONTROL_RETRACT_ZHOP), onDrawPFloat2Menu, SetZRaise, &fwretract.settings.retract_zraise); - EDIT_ITEM(ICON_FWRecSpeed, GET_TEXT_F(MSG_SINGLENOZZLE_UNRETRACT_SPEED), onDrawPFloatMenu, SetRecoverSpeed, &fwretract.settings.retract_recover_feedrate_mm_s); + #if HAS_ZOFFSET_ITEM && EITHER(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP) + EDIT_ITEM_F(ICON_Zoffset, MSG_ZPROBE_ZOFFSET, onDrawZOffset, SetZOffset, &BABY_Z_VAR); #endif - EDIT_ITEM(ICON_Flow, GET_TEXT_F(MSG_FLOW), onDrawPIntMenu, SetFlow, &planner.flow_percentage[0]); + EDIT_ITEM_F(ICON_Flow, MSG_FLOW, onDrawPIntMenu, SetFlow, &planner.flow_percentage[0]); #if ENABLED(ADVANCED_PAUSE_FEATURE) - MENU_ITEM(ICON_FilMan, GET_TEXT_F(MSG_FILAMENTCHANGE), onDrawMenuItem, ChangeFilament); + MENU_ITEM_F(ICON_FilMan, MSG_FILAMENTCHANGE, onDrawMenuItem, ChangeFilament); #endif - MENU_ITEM(ICON_Lock, GET_TEXT_F(MSG_LOCKSCREEN), onDrawMenuItem, DWIN_LockScreen); + #if ENABLED(FWRETRACT) + MENU_ITEM_F(ICON_FWRetract, MSG_FWRETRACT, onDrawSubMenu, Draw_FWRetract_Menu); + #endif + MENU_ITEM_F(ICON_Lock, MSG_LOCKSCREEN, onDrawMenuItem, DWIN_LockScreen); #if HAS_LCD_BRIGHTNESS - EDIT_ITEM(ICON_Brightness, GET_TEXT_F(MSG_BRIGHTNESS), onDrawPInt8Menu, SetBrightness, &ui.brightness); - MENU_ITEM(ICON_Brightness, GET_TEXT_F(MSG_BRIGHTNESS_OFF), onDrawMenuItem, TurnOffBacklight); + EDIT_ITEM_F(ICON_Brightness, MSG_BRIGHTNESS, onDrawPInt8Menu, SetBrightness, &ui.brightness); + MENU_ITEM_F(ICON_Brightness, MSG_BRIGHTNESS_OFF, onDrawMenuItem, TurnOffBacklight); + #endif + #if ENABLED(CASE_LIGHT_MENU) + EDIT_ITEM_F(ICON_CaseLight, MSG_CASE_LIGHT, onDrawChkbMenu, SetCaseLight, &caselight.on); + #elif ENABLED(LED_CONTROL_MENU) && DISABLED(CASE_LIGHT_USE_NEOPIXEL) + EDIT_ITEM_F(ICON_LedControl, MSG_LEDS, onDrawChkbMenu, SetLedStatus, &leds.lights_on); #endif } CurrentMenu->draw(); @@ -3325,15 +3309,15 @@ void Draw_Motion_Menu() { if (CurrentMenu != MotionMenu) { CurrentMenu = MotionMenu; SetMenuTitle({1, 16, 28, 13}, GET_TEXT_F(MSG_MOTION)); // TODO: Chinese, English "Motion" JPG - DWINUI::MenuItemsPrepare(6); - MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Control_Menu); - MENU_ITEM(ICON_MaxSpeed, GET_TEXT_F(MSG_SPEED), onDrawSpeed, Draw_MaxSpeed_Menu); - MENU_ITEM(ICON_MaxAccelerated, GET_TEXT_F(MSG_ACCELERATION), onDrawAcc, Draw_MaxAccel_Menu); + MenuItemsPrepare(6); + BACK_ITEM(Draw_Control_Menu); + MENU_ITEM_F(ICON_MaxSpeed, MSG_SPEED, onDrawSpeed, Draw_MaxSpeed_Menu); + MENU_ITEM_F(ICON_MaxAccelerated, MSG_ACCELERATION, onDrawAcc, Draw_MaxAccel_Menu); #if HAS_CLASSIC_JERK - MENU_ITEM(ICON_MaxJerk, GET_TEXT_F(MSG_JERK), onDrawJerk, Draw_MaxJerk_Menu); + MENU_ITEM_F(ICON_MaxJerk, MSG_JERK, onDrawJerk, Draw_MaxJerk_Menu); #endif - MENU_ITEM(ICON_Step, GET_TEXT_F(MSG_STEPS_PER_MM), onDrawSteps, Draw_Steps_Menu); - EDIT_ITEM(ICON_Flow, GET_TEXT_F(MSG_FLOW), onDrawPIntMenu, SetFlow, &planner.flow_percentage[0]); + MENU_ITEM_F(ICON_Step, MSG_STEPS_PER_MM, onDrawSteps, Draw_Steps_Menu); + EDIT_ITEM_F(ICON_Flow, MSG_FLOW, onDrawPIntMenu, SetFlow, &planner.flow_percentage[0]); } CurrentMenu->draw(); } @@ -3341,39 +3325,31 @@ void Draw_Motion_Menu() { #if ENABLED(ADVANCED_PAUSE_FEATURE) void Draw_FilamentMan_Menu() { checkkey = Menu; - if (!FilamentMenu) FilamentMenu = new MenuClass(); - if (CurrentMenu != FilamentMenu) { - CurrentMenu = FilamentMenu; - SetMenuTitle({0}, GET_TEXT_F(MSG_FILAMENT_MAN)); // TODO: Chinese, English "Filament Management" JPG - DWINUI::MenuItemsPrepare(5); - MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu); - MENU_ITEM(ICON_Park, GET_TEXT_F(MSG_FILAMENT_PARK_ENABLED), onDrawMenuItem, ParkHead); - MENU_ITEM(ICON_FilMan, GET_TEXT_F(MSG_FILAMENTCHANGE), onDrawMenuItem, ChangeFilament); + if (SetMenu(FilamentMenu, GET_TEXT_F(MSG_FILAMENT_MAN), 5)) { + BACK_ITEM(Draw_Prepare_Menu); + MENU_ITEM_F(ICON_Park, MSG_FILAMENT_PARK_ENABLED, onDrawMenuItem, ParkHead); + MENU_ITEM_F(ICON_FilMan, MSG_FILAMENTCHANGE, onDrawMenuItem, ChangeFilament); #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - MENU_ITEM(ICON_FilUnload, GET_TEXT_F(MSG_FILAMENTUNLOAD), onDrawMenuItem, UnloadFilament); - MENU_ITEM(ICON_FilLoad, GET_TEXT_F(MSG_FILAMENTLOAD), onDrawMenuItem, LoadFilament); + MENU_ITEM_F(ICON_FilUnload, MSG_FILAMENTUNLOAD, onDrawMenuItem, UnloadFilament); + MENU_ITEM_F(ICON_FilLoad, MSG_FILAMENTLOAD, onDrawMenuItem, LoadFilament); #endif } - CurrentMenu->draw(); + UpdateMenu(FilamentMenu); } #endif #if ENABLED(MESH_BED_LEVELING) void Draw_ManualMesh_Menu() { checkkey = Menu; - if (!ManualMesh) ManualMesh = new MenuClass(); - if (CurrentMenu != ManualMesh) { - CurrentMenu = ManualMesh; - SetMenuTitle({0}, GET_TEXT_F(MSG_MANUAL_MESH)); // TODO: Chinese, English "Manual Mesh Leveling" JPG - DWINUI::MenuItemsPrepare(6); - MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu); - MENU_ITEM(ICON_ManualMesh, GET_TEXT_F(MSG_LEVEL_BED), onDrawMenuItem, ManualMeshStart); - MMeshMoveZItem = EDIT_ITEM(ICON_Zoffset, GET_TEXT_F(MSG_MOVE_Z), onDrawMMeshMoveZ, SetMMeshMoveZ, ¤t_position.z); - MENU_ITEM(ICON_Axis, GET_TEXT_F(MSG_UBL_CONTINUE_MESH), onDrawMenuItem, ManualMeshContinue); - MENU_ITEM(ICON_MeshViewer, GET_TEXT_F(MSG_MESH_VIEW), onDrawSubMenu, DWIN_MeshViewer); - MENU_ITEM(ICON_MeshSave, GET_TEXT_F(MSG_UBL_SAVE_MESH), onDrawMenuItem, ManualMeshSave); + if (SetMenu(ManualMesh, GET_TEXT_F(MSG_UBL_MANUAL_MESH), 6)) { + BACK_ITEM(Draw_Prepare_Menu); + MENU_ITEM_F(ICON_ManualMesh, MSG_LEVEL_BED, onDrawMenuItem, ManualMeshStart); + MMeshMoveZItem = EDIT_ITEM_F(ICON_Zoffset, MSG_MOVE_Z, onDrawMMeshMoveZ, SetMMeshMoveZ, ¤t_position.z); + MENU_ITEM_F(ICON_Axis, MSG_UBL_CONTINUE_MESH, onDrawMenuItem, ManualMeshContinue); + MENU_ITEM_F(ICON_MeshViewer, MSG_MESH_VIEW, onDrawSubMenu, DWIN_MeshViewer); + MENU_ITEM_F(ICON_MeshSave, MSG_UBL_SAVE_MESH, onDrawMenuItem, ManualMeshSave); } - CurrentMenu->draw(); + UpdateMenu(ManualMesh); } #endif @@ -3384,42 +3360,43 @@ void Draw_Motion_Menu() { if (CurrentMenu != PreheatMenu) { CurrentMenu = PreheatMenu; SetMenuTitle(cn, fstr); - DWINUI::MenuItemsPrepare(5); - MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Temperature_Menu); + MenuItemsPrepare(5); + BACK_ITEM(Draw_Temperature_Menu); #if HAS_HOTEND - EDIT_ITEM(ICON_SetEndTemp, GET_TEXT_F(MSG_UBL_SET_TEMP_HOTEND), onDrawSetPreheatHotend, SetPreheatEndTemp, &ui.material_preset[HMI_value.Preheat].hotend_temp); + EDIT_ITEM_F(ICON_SetEndTemp, MSG_UBL_SET_TEMP_HOTEND, onDrawSetPreheatHotend, SetPreheatEndTemp, &ui.material_preset[HMI_value.Select].hotend_temp); #endif #if HAS_HEATED_BED - EDIT_ITEM(ICON_SetBedTemp, GET_TEXT_F(MSG_UBL_SET_TEMP_BED), onDrawSetPreheatBed, SetPreheatBedTemp, &ui.material_preset[HMI_value.Preheat].bed_temp); + EDIT_ITEM_F(ICON_SetBedTemp, MSG_UBL_SET_TEMP_BED, onDrawSetPreheatBed, SetPreheatBedTemp, &ui.material_preset[HMI_value.Select].bed_temp); #endif #if HAS_FAN - EDIT_ITEM(ICON_FanSpeed, GET_TEXT_F(MSG_FAN_SPEED), onDrawSetPreheatFan, SetPreheatFanSpeed, &ui.material_preset[HMI_value.Preheat].fan_speed); + EDIT_ITEM_F(ICON_FanSpeed, MSG_FAN_SPEED, onDrawSetPreheatFan, SetPreheatFanSpeed, &ui.material_preset[HMI_value.Select].fan_speed); #endif #if ENABLED(EEPROM_SETTINGS) - MENU_ITEM(ICON_WriteEEPROM, GET_TEXT_F(MSG_STORE_EEPROM), onDrawWriteEeprom, WriteEeprom); + MENU_ITEM_F(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawWriteEeprom, WriteEeprom); #endif } CurrentMenu->draw(); } void Draw_Preheat1_Menu() { - HMI_value.Preheat = 0; + HMI_value.Select = 0; if (!PreheatMenu) PreheatMenu = new MenuClass(); Draw_Preheat_Menu({59, 16, 81, 14}, F(PREHEAT_1_LABEL " Preheat Settings")); // TODO: English "PLA Settings" JPG } - void Draw_Preheat2_Menu() { - HMI_value.Preheat = 1; - if (!PreheatMenu) PreheatMenu = new MenuClass(); - Draw_Preheat_Menu({142, 16, 82, 14}, F(PREHEAT_2_LABEL " Preheat Settings")); // TODO: English "ABS Settings" JPG - } + #if PREHEAT_COUNT >= 2 + void Draw_Preheat2_Menu() { + HMI_value.Select = 1; + if (!PreheatMenu) PreheatMenu = new MenuClass(); + Draw_Preheat_Menu({142, 16, 82, 14}, F(PREHEAT_2_LABEL " Preheat Settings")); // TODO: English "ABS Settings" JPG + } + #endif - #ifdef PREHEAT_3_LABEL + #if PREHEAT_COUNT >= 3 void Draw_Preheat3_Menu() { - HMI_value.Preheat = 2; + HMI_value.Select = 2; if (!PreheatMenu) PreheatMenu = new MenuClass(); - #define PREHEAT_3_TITLE PREHEAT_3_LABEL " Preheat Set." - Draw_Preheat_Menu({0}, F(PREHEAT_3_TITLE)); // TODO: Chinese, English "Custom Preheat Settings" JPG + Draw_Preheat_Menu({225, 16, 82, 14}, F(PREHEAT_3_LABEL " Preheat Settings")); // TODO: English "... Settings" JPG } #endif @@ -3431,22 +3408,24 @@ void Draw_Temperature_Menu() { if (CurrentMenu != TemperatureMenu) { CurrentMenu = TemperatureMenu; SetMenuTitle({236, 2, 28, 12}, GET_TEXT_F(MSG_TEMPERATURE)); - DWINUI::MenuItemsPrepare(7); - MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Control_Menu); + MenuItemsPrepare(7); + BACK_ITEM(Draw_Control_Menu); #if HAS_HOTEND - HotendTargetItem = EDIT_ITEM(ICON_SetEndTemp, GET_TEXT_F(MSG_UBL_SET_TEMP_HOTEND), onDrawHotendTemp, SetHotendTemp, &thermalManager.temp_hotend[0].target); + HotendTargetItem = EDIT_ITEM_F(ICON_SetEndTemp, MSG_UBL_SET_TEMP_HOTEND, onDrawHotendTemp, SetHotendTemp, &thermalManager.temp_hotend[0].target); #endif #if HAS_HEATED_BED - BedTargetItem = EDIT_ITEM(ICON_SetBedTemp, GET_TEXT_F(MSG_UBL_SET_TEMP_BED), onDrawBedTemp, SetBedTemp, &thermalManager.temp_bed.target); + BedTargetItem = EDIT_ITEM_F(ICON_SetBedTemp, MSG_UBL_SET_TEMP_BED, onDrawBedTemp, SetBedTemp, &thermalManager.temp_bed.target); #endif #if HAS_FAN - FanSpeedItem = EDIT_ITEM(ICON_FanSpeed, GET_TEXT_F(MSG_FAN_SPEED), onDrawFanSpeed, SetFanSpeed, &thermalManager.fan_speed[0]); + FanSpeedItem = EDIT_ITEM_F(ICON_FanSpeed, MSG_FAN_SPEED, onDrawFanSpeed, SetFanSpeed, &thermalManager.fan_speed[0]); #endif - #if HAS_HOTEND - MENU_ITEM(ICON_SetPLAPreheat, F(PREHEAT_1_LABEL " Preheat Settings"), onDrawPLAPreheatSubMenu, Draw_Preheat1_Menu); - MENU_ITEM(ICON_SetABSPreheat, F(PREHEAT_2_LABEL " Preheat Settings"), onDrawABSPreheatSubMenu, Draw_Preheat2_Menu); - #ifdef PREHEAT_3_LABEL - MENU_ITEM(ICON_SetCustomPreheat, PREHEAT_3_TITLE, onDrawSubMenu, Draw_Preheat3_Menu); + #if HAS_PREHEAT + MENU_ITEM_F(ICON_SetPLAPreheat, MSG_PREHEAT_1_SETTINGS, onDrawPLAPreheatSubMenu, Draw_Preheat1_Menu); + #if PREHEAT_COUNT >= 2 + MENU_ITEM_F(ICON_SetABSPreheat, MSG_PREHEAT_2_SETTINGS, onDrawABSPreheatSubMenu, Draw_Preheat2_Menu); + #if PREHEAT_COUNT >= 3 + MENU_ITEM_F(ICON_SetCustomPreheat, MSG_PREHEAT_3_SETTINGS, onDrawSubMenu, Draw_Preheat3_Menu); + #endif #endif #endif } @@ -3459,13 +3438,13 @@ void Draw_MaxSpeed_Menu() { if (CurrentMenu != MaxSpeedMenu) { CurrentMenu = MaxSpeedMenu; SetMenuTitle({1, 16, 28, 13}, GET_TEXT_F(MSG_MAXSPEED)); - DWINUI::MenuItemsPrepare(5); - MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu); - EDIT_ITEM(ICON_MaxSpeedX, GET_TEXT_F(MSG_MAXSPEED_X), onDrawMaxSpeedX, SetMaxSpeedX, &planner.settings.max_feedrate_mm_s[X_AXIS]); - EDIT_ITEM(ICON_MaxSpeedY, GET_TEXT_F(MSG_MAXSPEED_Y), onDrawMaxSpeedY, SetMaxSpeedY, &planner.settings.max_feedrate_mm_s[Y_AXIS]); - EDIT_ITEM(ICON_MaxSpeedZ, GET_TEXT_F(MSG_MAXSPEED_Z), onDrawMaxSpeedZ, SetMaxSpeedZ, &planner.settings.max_feedrate_mm_s[Z_AXIS]); + MenuItemsPrepare(5); + BACK_ITEM(Draw_Motion_Menu); + EDIT_ITEM_F(ICON_MaxSpeedX, MSG_MAXSPEED_X, onDrawMaxSpeedX, SetMaxSpeedX, &planner.settings.max_feedrate_mm_s[X_AXIS]); + EDIT_ITEM_F(ICON_MaxSpeedY, MSG_MAXSPEED_Y, onDrawMaxSpeedY, SetMaxSpeedY, &planner.settings.max_feedrate_mm_s[Y_AXIS]); + EDIT_ITEM_F(ICON_MaxSpeedZ, MSG_MAXSPEED_Z, onDrawMaxSpeedZ, SetMaxSpeedZ, &planner.settings.max_feedrate_mm_s[Z_AXIS]); #if HAS_HOTEND - EDIT_ITEM(ICON_MaxSpeedE, GET_TEXT_F(MSG_MAXSPEED_E), onDrawMaxSpeedE, SetMaxSpeedE, &planner.settings.max_feedrate_mm_s[E_AXIS]); + EDIT_ITEM_F(ICON_MaxSpeedE, MSG_MAXSPEED_E, onDrawMaxSpeedE, SetMaxSpeedE, &planner.settings.max_feedrate_mm_s[E_AXIS]); #endif } CurrentMenu->draw(); @@ -3477,13 +3456,13 @@ void Draw_MaxAccel_Menu() { if (CurrentMenu != MaxAccelMenu) { CurrentMenu = MaxAccelMenu; SetMenuTitle({1, 16, 28, 13}, GET_TEXT_F(MSG_ACCELERATION)); - DWINUI::MenuItemsPrepare(5); - MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu); - EDIT_ITEM(ICON_MaxAccX, GET_TEXT_F(MSG_AMAX_A), onDrawMaxAccelX, SetMaxAccelX, &planner.settings.max_acceleration_mm_per_s2[X_AXIS]); - EDIT_ITEM(ICON_MaxAccY, GET_TEXT_F(MSG_AMAX_B), onDrawMaxAccelY, SetMaxAccelY, &planner.settings.max_acceleration_mm_per_s2[Y_AXIS]); - EDIT_ITEM(ICON_MaxAccZ, GET_TEXT_F(MSG_AMAX_C), onDrawMaxAccelZ, SetMaxAccelZ, &planner.settings.max_acceleration_mm_per_s2[Z_AXIS]); + MenuItemsPrepare(5); + BACK_ITEM(Draw_Motion_Menu); + EDIT_ITEM_F(ICON_MaxAccX, MSG_AMAX_A, onDrawMaxAccelX, SetMaxAccelX, &planner.settings.max_acceleration_mm_per_s2[X_AXIS]); + EDIT_ITEM_F(ICON_MaxAccY, MSG_AMAX_B, onDrawMaxAccelY, SetMaxAccelY, &planner.settings.max_acceleration_mm_per_s2[Y_AXIS]); + EDIT_ITEM_F(ICON_MaxAccZ, MSG_AMAX_C, onDrawMaxAccelZ, SetMaxAccelZ, &planner.settings.max_acceleration_mm_per_s2[Z_AXIS]); #if HAS_HOTEND - EDIT_ITEM(ICON_MaxAccE, GET_TEXT_F(MSG_AMAX_E), onDrawMaxAccelE, SetMaxAccelE, &planner.settings.max_acceleration_mm_per_s2[E_AXIS]); + EDIT_ITEM_F(ICON_MaxAccE, MSG_AMAX_E, onDrawMaxAccelE, SetMaxAccelE, &planner.settings.max_acceleration_mm_per_s2[E_AXIS]); #endif } CurrentMenu->draw(); @@ -3496,13 +3475,13 @@ void Draw_MaxAccel_Menu() { if (CurrentMenu != MaxJerkMenu) { CurrentMenu = MaxJerkMenu; SetMenuTitle({1, 16, 28, 13}, GET_TEXT_F(MSG_JERK)); - DWINUI::MenuItemsPrepare(5); - MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu); - EDIT_ITEM(ICON_MaxSpeedJerkX, GET_TEXT_F(MSG_VA_JERK), onDrawMaxJerkX, SetMaxJerkX, &planner.max_jerk[X_AXIS]); - EDIT_ITEM(ICON_MaxSpeedJerkY, GET_TEXT_F(MSG_VB_JERK), onDrawMaxJerkY, SetMaxJerkY, &planner.max_jerk[Y_AXIS]); - EDIT_ITEM(ICON_MaxSpeedJerkZ, GET_TEXT_F(MSG_VC_JERK), onDrawMaxJerkZ, SetMaxJerkZ, &planner.max_jerk[Z_AXIS]); + MenuItemsPrepare(5); + BACK_ITEM(Draw_Motion_Menu); + EDIT_ITEM_F(ICON_MaxSpeedJerkX, MSG_VA_JERK, onDrawMaxJerkX, SetMaxJerkX, &planner.max_jerk[X_AXIS]); + EDIT_ITEM_F(ICON_MaxSpeedJerkY, MSG_VB_JERK, onDrawMaxJerkY, SetMaxJerkY, &planner.max_jerk[Y_AXIS]); + EDIT_ITEM_F(ICON_MaxSpeedJerkZ, MSG_VC_JERK, onDrawMaxJerkZ, SetMaxJerkZ, &planner.max_jerk[Z_AXIS]); #if HAS_HOTEND - EDIT_ITEM(ICON_MaxSpeedJerkE, GET_TEXT_F(MSG_VE_JERK), onDrawMaxJerkE, SetMaxJerkE, &planner.max_jerk[E_AXIS]); + EDIT_ITEM_F(ICON_MaxSpeedJerkE, MSG_VE_JERK, onDrawMaxJerkE, SetMaxJerkE, &planner.max_jerk[E_AXIS]); #endif } CurrentMenu->draw(); @@ -3515,13 +3494,13 @@ void Draw_Steps_Menu() { if (CurrentMenu != StepsMenu) { CurrentMenu = StepsMenu; SetMenuTitle({1, 16, 28, 13}, GET_TEXT_F(MSG_STEPS_PER_MM)); - DWINUI::MenuItemsPrepare(5); - MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu); - EDIT_ITEM(ICON_StepX, GET_TEXT_F(MSG_A_STEPS), onDrawStepsX, SetStepsX, &planner.settings.axis_steps_per_mm[X_AXIS]); - EDIT_ITEM(ICON_StepY, GET_TEXT_F(MSG_B_STEPS), onDrawStepsY, SetStepsY, &planner.settings.axis_steps_per_mm[Y_AXIS]); - EDIT_ITEM(ICON_StepZ, GET_TEXT_F(MSG_C_STEPS), onDrawStepsZ, SetStepsZ, &planner.settings.axis_steps_per_mm[Z_AXIS]); + MenuItemsPrepare(5); + BACK_ITEM(Draw_Motion_Menu); + EDIT_ITEM_F(ICON_StepX, MSG_A_STEPS, onDrawStepsX, SetStepsX, &planner.settings.axis_steps_per_mm[X_AXIS]); + EDIT_ITEM_F(ICON_StepY, MSG_B_STEPS, onDrawStepsY, SetStepsY, &planner.settings.axis_steps_per_mm[Y_AXIS]); + EDIT_ITEM_F(ICON_StepZ, MSG_C_STEPS, onDrawStepsZ, SetStepsZ, &planner.settings.axis_steps_per_mm[Z_AXIS]); #if HAS_HOTEND - EDIT_ITEM(ICON_StepE, GET_TEXT_F(MSG_E_STEPS), onDrawStepsE, SetStepsE, &planner.settings.axis_steps_per_mm[E_AXIS]); + EDIT_ITEM_F(ICON_StepE, MSG_E_STEPS, onDrawStepsE, SetStepsE, &planner.settings.axis_steps_per_mm[E_AXIS]); #endif } CurrentMenu->draw(); @@ -3530,63 +3509,51 @@ void Draw_Steps_Menu() { #if HAS_HOTEND void Draw_HotendPID_Menu() { checkkey = Menu; - if (!HotendPIDMenu) HotendPIDMenu = new MenuClass(); - if (CurrentMenu != HotendPIDMenu) { - CurrentMenu = HotendPIDMenu; - CurrentMenu->MenuTitle.SetCaption(F("Hotend PID Settings")); - DWINUI::MenuItemsPrepare(8); - MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawMenuItem, Draw_AdvancedSettings_Menu); - MENU_ITEM(ICON_PIDNozzle, F("Hotend PID"), onDrawMenuItem, HotendPID); + if (SetMenu(HotendPIDMenu, F(STR_HOTEND_PID " Settings"),8)) { + BACK_ITEM(Draw_AdvancedSettings_Menu); + MENU_ITEM(ICON_PIDNozzle, F(STR_HOTEND_PID), onDrawMenuItem, HotendPID); EDIT_ITEM(ICON_PIDValue, F("Set" STR_KP), onDrawPFloat2Menu, SetKp, &thermalManager.temp_hotend[0].pid.Kp); EDIT_ITEM(ICON_PIDValue, F("Set" STR_KI), onDrawPIDi, SetKi, &thermalManager.temp_hotend[0].pid.Ki); EDIT_ITEM(ICON_PIDValue, F("Set" STR_KD), onDrawPIDd, SetKd, &thermalManager.temp_hotend[0].pid.Kd); - EDIT_ITEM(ICON_Temperature, GET_TEXT_F(MSG_TEMPERATURE), onDrawPIntMenu, SetHotendPidT, &HMI_data.HotendPidT); - EDIT_ITEM(ICON_PIDcycles, GET_TEXT_F(MSG_PID_CYCLE), onDrawPIntMenu, SetPidCycles, &HMI_data.PidCycles); + EDIT_ITEM_F(ICON_Temperature, MSG_TEMPERATURE, onDrawPIntMenu, SetHotendPidT, &HMI_data.HotendPidT); + EDIT_ITEM_F(ICON_PIDcycles, MSG_PID_CYCLE, onDrawPIntMenu, SetPidCycles, &HMI_data.PidCycles); #if ENABLED(EEPROM_SETTINGS) - MENU_ITEM(ICON_WriteEEPROM, GET_TEXT_F(MSG_STORE_EEPROM), onDrawMenuItem, WriteEeprom); + MENU_ITEM_F(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawMenuItem, WriteEeprom); #endif } - CurrentMenu->draw(); + UpdateMenu(HotendPIDMenu); } #endif #if HAS_HEATED_BED void Draw_BedPID_Menu() { checkkey = Menu; - if (!BedPIDMenu) BedPIDMenu = new MenuClass(); - if (CurrentMenu != BedPIDMenu) { - CurrentMenu = BedPIDMenu; - CurrentMenu->MenuTitle.SetCaption(F("Bed PID Settings")); - DWINUI::MenuItemsPrepare(8); - MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawMenuItem, Draw_AdvancedSettings_Menu); - MENU_ITEM(ICON_PIDNozzle, F("Bed PID"), onDrawMenuItem,BedPID); + if (SetMenu(BedPIDMenu, F(STR_BED_PID " Settings"),8)) { + BACK_ITEM(Draw_AdvancedSettings_Menu); + MENU_ITEM(ICON_PIDNozzle, F(STR_BED_PID), onDrawMenuItem,BedPID); EDIT_ITEM(ICON_PIDValue, F("Set" STR_KP), onDrawPFloat2Menu, SetKp, &thermalManager.temp_bed.pid.Kp); EDIT_ITEM(ICON_PIDValue, F("Set" STR_KI), onDrawPIDi, SetKi, &thermalManager.temp_bed.pid.Ki); EDIT_ITEM(ICON_PIDValue, F("Set" STR_KD), onDrawPIDd, SetKd, &thermalManager.temp_bed.pid.Kd); - EDIT_ITEM(ICON_Temperature, GET_TEXT_F(MSG_TEMPERATURE), onDrawPIntMenu, SetBedPidT, &HMI_data.BedPidT); - EDIT_ITEM(ICON_PIDcycles, GET_TEXT_F(MSG_PID_CYCLE), onDrawPIntMenu, SetPidCycles, &HMI_data.PidCycles); + EDIT_ITEM_F(ICON_Temperature, MSG_TEMPERATURE, onDrawPIntMenu, SetBedPidT, &HMI_data.BedPidT); + EDIT_ITEM_F(ICON_PIDcycles, MSG_PID_CYCLE, onDrawPIntMenu, SetPidCycles, &HMI_data.PidCycles); #if ENABLED(EEPROM_SETTINGS) - MENU_ITEM(ICON_WriteEEPROM, GET_TEXT_F(MSG_STORE_EEPROM), onDrawMenuItem, WriteEeprom); + MENU_ITEM_F(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawMenuItem, WriteEeprom); #endif } - CurrentMenu->draw(); + UpdateMenu(BedPIDMenu); } #endif -#if HAS_BED_PROBE +#if ENABLED(BABYSTEP_ZPROBE_OFFSET) void Draw_ZOffsetWiz_Menu() { checkkey = Menu; - if (!ZOffsetWizMenu) ZOffsetWizMenu = new MenuClass(); - if (CurrentMenu != ZOffsetWizMenu) { - CurrentMenu = ZOffsetWizMenu; - CurrentMenu->MenuTitle.SetCaption(GET_TEXT_F(MSG_PROBE_WIZARD)); - DWINUI::MenuItemsPrepare(4); - MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawMenuItem, Draw_Prepare_Menu); - MENU_ITEM(ICON_Homing, GET_TEXT_F(MSG_AUTO_HOME), onDrawMenuItem, AutoHome); + if (SetMenu(ZOffsetWizMenu, GET_TEXT_F(MSG_PROBE_WIZARD), 4)) { + BACK_ITEM(Draw_Prepare_Menu); + MENU_ITEM_F(ICON_Homing, MSG_AUTO_HOME, onDrawMenuItem, AutoHome); MENU_ITEM(ICON_MoveZ0, F("Move Z to Home"), onDrawMenuItem, SetMoveZto0); - EDIT_ITEM(ICON_Zoffset, GET_TEXT_F(MSG_ZPROBE_ZOFFSET), onDrawPFloat2Menu, SetZOffset, &BABY_Z_VAR); + EDIT_ITEM_F(ICON_Zoffset, MSG_ZPROBE_ZOFFSET, onDrawPFloat2Menu, SetZOffset, &BABY_Z_VAR); } - CurrentMenu->draw(); + UpdateMenu(ZOffsetWizMenu); if (!axis_is_trusted(Z_AXIS)) LCD_MESSAGE_F("WARNING: Z position unknown, move Z to home"); } #endif @@ -3594,19 +3561,165 @@ void Draw_Steps_Menu() { #if ENABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU) void Draw_Homing_Menu() { checkkey = Menu; - if (!HomingMenu) HomingMenu = new MenuClass(); - if (CurrentMenu != HomingMenu) { - CurrentMenu = HomingMenu; - CurrentMenu->MenuTitle.SetCaption(GET_TEXT_F(MSG_HOMING)); - DWINUI::MenuItemsPrepare(5); - MENU_ITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawMenuItem, Draw_Prepare_Menu); - MENU_ITEM(ICON_Homing, GET_TEXT_F(MSG_AUTO_HOME), onDrawMenuItem, AutoHome); - MENU_ITEM(ICON_HomeX, GET_TEXT_F(MSG_AUTO_HOME_X), onDrawMenuItem, HomeX); - MENU_ITEM(ICON_HomeY, GET_TEXT_F(MSG_AUTO_HOME_Y), onDrawMenuItem, HomeY); - MENU_ITEM(ICON_HomeZ, GET_TEXT_F(MSG_AUTO_HOME_Z), onDrawMenuItem, HomeZ); + if (SetMenu(HomingMenu, GET_TEXT_F(MSG_HOMING), 5)) { + BACK_ITEM(Draw_Prepare_Menu); + MENU_ITEM_F(ICON_Homing, MSG_AUTO_HOME, onDrawMenuItem, AutoHome); + MENU_ITEM_F(ICON_HomeX, MSG_AUTO_HOME_X, onDrawMenuItem, HomeX); + MENU_ITEM_F(ICON_HomeY, MSG_AUTO_HOME_Y, onDrawMenuItem, HomeY); + MENU_ITEM_F(ICON_HomeZ, MSG_AUTO_HOME_Z, onDrawMenuItem, HomeZ); } - CurrentMenu->draw(); + UpdateMenu(HomingMenu); + } +#endif + +#if ENABLED(FWRETRACT) + void Draw_FWRetract_Menu() { + checkkey = Menu; + if (SetMenu(FWRetractMenu, GET_TEXT_F(MSG_FWRETRACT), 6)) { + BACK_ITEM(Return_FWRetract_Menu); + EDIT_ITEM_F(ICON_FWRetLength, MSG_CONTROL_RETRACT, onDrawPFloatMenu, SetRetractLength, &fwretract.settings.retract_length); + EDIT_ITEM_F(ICON_FWRetSpeed, MSG_SINGLENOZZLE_RETRACT_SPEED, onDrawPFloatMenu, SetRetractSpeed, &fwretract.settings.retract_feedrate_mm_s); + EDIT_ITEM_F(ICON_FWRetZRaise, MSG_CONTROL_RETRACT_ZHOP, onDrawPFloat2Menu, SetZRaise, &fwretract.settings.retract_zraise); + EDIT_ITEM_F(ICON_FWRecSpeed, MSG_SINGLENOZZLE_UNRETRACT_SPEED, onDrawPFloatMenu, SetRecoverSpeed, &fwretract.settings.retract_recover_feedrate_mm_s); + EDIT_ITEM_F(ICON_FWRecExtra, MSG_CONTROL_RETRACT_RECOVER, onDrawPFloatMenu, SetAddRecover, &fwretract.settings.retract_recover_extra); + } + UpdateMenu(FWRetractMenu); + } +#endif + +//============================================================================= +// Mesh Bed Leveling +//============================================================================= + +#if HAS_MESH + + void ApplyMeshFadeHeight() { set_z_fade_height(planner.z_fade_height); } + void SetMeshFadeHeight() { SetPFloatOnClick(0, 100, 1, ApplyMeshFadeHeight); } + + void SetMeshActive() { + set_bed_leveling_enabled(!planner.leveling_active); + Draw_Chkb_Line(CurrentMenu->line(), planner.leveling_active); + DWIN_UpdateLCD(); } + + #if BOTH(HAS_HEATED_BED, PREHEAT_BEFORE_LEVELING) + void SetBedLevT() { SetPIntOnClick(MIN_BEDTEMP, MAX_BEDTEMP); } + #endif + + uint8_t mesh_x = 0; + uint8_t mesh_y = 0; + #define Z_OFFSET_MIN -3 + #define Z_OFFSET_MAX 3 + + void LiveEditMesh() { ((MenuItemPtrClass*)EditZValueItem)->value = &Z_VALUES_ARR[HMI_value.Select ? mesh_x : MenuData.Value][HMI_value.Select ? MenuData.Value : mesh_y]; EditZValueItem->redraw(); } + void ApplyEditMeshX() { mesh_x = MenuData.Value; } + void SetEditMeshX() { HMI_value.Select = 0; SetIntOnClick(0, GRID_MAX_POINTS_X - 1, mesh_x, ApplyEditMeshX, LiveEditMesh); } + void ApplyEditMeshY() { mesh_y = MenuData.Value; } + void SetEditMeshY() { HMI_value.Select = 1; SetIntOnClick(0, GRID_MAX_POINTS_Y - 1, mesh_y, ApplyEditMeshY, LiveEditMesh); } + void SetEditZValue() { SetPFloatOnClick(Z_OFFSET_MIN, Z_OFFSET_MAX, 3); } + #endif +#if ENABLED(AUTO_BED_LEVELING_UBL) + + void ApplyUBLSlot() { ubl.storage_slot = MenuData.Value; } + void SetUBLSlot() { SetIntOnClick(0, settings.calc_num_meshes() - 1, ubl.storage_slot, ApplyUBLSlot); } + void onDrawUBLSlot(MenuItemClass* menuitem, int8_t line) { + if (ubl.storage_slot < 0) ubl.storage_slot = 0; + onDrawIntMenu(menuitem, line, ubl.storage_slot); + } + + void ApplyUBLTiltGrid() { ubl_tools.tilt_grid = MenuData.Value; } + void SetUBLTiltGrid() { SetIntOnClick(1, 3, ubl_tools.tilt_grid, ApplyUBLTiltGrid); } + + void UBLTiltMesh() { + if (ubl.storage_slot < 0) ubl.storage_slot = 0; + char buf[15]; + if (ubl_tools.tilt_grid > 1) { + sprintf_P(buf, PSTR("G28O\nG29 J%i"), ubl_tools.tilt_grid); + gcode.process_subcommands_now(buf); + } + else + gcode.process_subcommands_now(F("G28O\nG29J")); + LCD_MESSAGE(MSG_UBL_MESH_TILTED); + } + + void UBLSmartFillMesh() { + ubl.smart_fill_mesh(); + LCD_MESSAGE(MSG_UBL_MESH_FILLED); + } + + bool UBLValidMesh() { + const bool valid = ubl_tools.validate(); + if (!valid) ubl.invalidate(); + return valid; + } + + void UBLSaveMesh() { + if (ubl.storage_slot < 0) ubl.storage_slot = 0; + settings.store_mesh(ubl.storage_slot); + ui.status_printf(0, GET_TEXT_F(MSG_MESH_SAVED), ubl.storage_slot); + DONE_BUZZ(true); + } + + void UBLLoadMesh() { + if (ubl.storage_slot < 0) ubl.storage_slot = 0; + settings.load_mesh(ubl.storage_slot); + if (UBLValidMesh()) { + ui.status_printf(0, GET_TEXT_F(MSG_MESH_LOADED), ubl.storage_slot); + DONE_BUZZ(true); + } + else { + LCD_MESSAGE_F("Invalid Mesh Loaded"); + DONE_BUZZ(false); + } + } + +#endif // AUTO_BED_LEVELING_UBL + +#if HAS_MESH + void Draw_MeshSet_Menu() { + checkkey = Menu; + if (SetMenu(MeshMenu, GET_TEXT_F(MSG_MESH_LEVELING), 15)) { + BACK_ITEM(Draw_AdvancedSettings_Menu); + #if BOTH(HAS_HEATED_BED, PREHEAT_BEFORE_LEVELING) + EDIT_ITEM_F(ICON_Temperature, MSG_UBL_SET_TEMP_BED, onDrawPIntMenu, SetBedLevT, &HMI_data.BedLevT); + #endif + EDIT_ITEM_F(ICON_SetZOffset, MSG_Z_FADE_HEIGHT, onDrawPFloatMenu, SetMeshFadeHeight, &planner.z_fade_height); + EDIT_ITEM_F(ICON_UBLActive, MSG_ACTIVATE_MESH, onDrawChkbMenu, SetMeshActive, &planner.leveling_active); + #if HAS_BED_PROBE + MENU_ITEM_F(ICON_Level, MSG_AUTO_MESH, onDrawMenuItem, AutoLev); + #endif + #if ENABLED(AUTO_BED_LEVELING_UBL) + EDIT_ITEM_F(ICON_UBLActive, MSG_UBL_STORAGE_SLOT, onDrawUBLSlot, SetUBLSlot, &ubl.storage_slot); + MENU_ITEM_F(ICON_UBLActive, MSG_UBL_SAVE_MESH, onDrawMenuItem, UBLSaveMesh); + MENU_ITEM_F(ICON_UBLActive, MSG_UBL_LOAD_MESH, onDrawMenuItem, UBLLoadMesh); + EDIT_ITEM_F(ICON_UBLActive, MSG_UBL_TILTING_GRID, onDrawPInt8Menu, SetUBLTiltGrid, &ubl_tools.tilt_grid); + MENU_ITEM_F(ICON_UBLActive, MSG_UBL_TILT_MESH, onDrawMenuItem, UBLTiltMesh); + MENU_ITEM_F(ICON_UBLActive, MSG_UBL_SMART_FILLIN, onDrawMenuItem, UBLSmartFillMesh); + #endif + #if ENABLED(MESH_EDIT_MENU) + MENU_ITEM_F(ICON_UBLActive, MSG_EDIT_MESH, onDrawSubMenu, Draw_EditMesh_Menu); + #endif + MENU_ITEM_F(ICON_MeshViewer, MSG_MESH_VIEW, onDrawSubMenu, DWIN_MeshViewer); + } + UpdateMenu(MeshMenu); + } + + #if ENABLED(MESH_EDIT_MENU) + void Draw_EditMesh_Menu() { + checkkey = Menu; + if (SetMenu(EditMeshMenu, GET_TEXT_F(MSG_EDIT_MESH), 4)) { + mesh_x = mesh_y = 0; + BACK_ITEM(Draw_MeshSet_Menu); + EDIT_ITEM_F(ICON_UBLActive, MSG_MESH_X, onDrawPInt8Menu, SetEditMeshX, &mesh_x); + EDIT_ITEM_F(ICON_UBLActive, MSG_MESH_Y, onDrawPInt8Menu, SetEditMeshY, &mesh_y); + EditZValueItem = EDIT_ITEM_F(ICON_UBLActive, MSG_MESH_EDIT_Z, onDrawPFloat3Menu, SetEditZValue, &Z_VALUES_ARR[mesh_x][mesh_y]); + } + UpdateMenu(EditMeshMenu); + } + #endif + +#endif // HAS_MESH + #endif // DWIN_LCD_PROUI diff --git a/Marlin/src/lcd/e3v2/proui/dwin.h b/Marlin/src/lcd/e3v2/proui/dwin.h index d1f0a90042ce..f4e550295ea5 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.h +++ b/Marlin/src/lcd/e3v2/proui/dwin.h @@ -24,8 +24,8 @@ /** * DWIN Enhanced implementation for PRO UI * Author: Miguel A. Risco-Castillo (MRISCOC) - * Version: 3.15.2 - * Date: 2022/03/01 + * Version: 3.17.2 + * Date: 2022/04/08 */ #include "dwin_defines.h" @@ -73,12 +73,13 @@ enum pidresult_t : uint8_t { typedef struct { int8_t Color[3]; // Color components pidresult_t pidresult = PID_DONE; - int8_t Preheat = 0; // Material Select 0: PLA, 1: ABS, 2: Custom + uint8_t Select = 0; // Auxiliary selector variable AxisEnum axis = X_AXIS; // Axis Select } HMI_value_t; typedef struct { uint8_t language; + bool percent_flag:1; // percent was override by M73 bool remain_flag:1; // remain was override by M73 bool pause_flag:1; // printing is paused bool pause_action:1; // flag a pause action @@ -103,9 +104,53 @@ extern millis_t dwin_heat_time; void Popup_PowerLossRecovery(); #endif -// SD Card -void HMI_SDCardInit(); -void HMI_SDCardUpdate(); +// Tool Functions +#if ENABLED(EEPROM_SETTINGS) + void WriteEeprom(); + void ReadEeprom(); + void ResetEeprom(); + #if HAS_MESH + void SaveMesh(); + #endif +#endif +void RebootPrinter(); +void DisableMotors(); +void AutoLev(); +void AutoHome(); +#if HAS_PREHEAT + void DoPreheat0(); + void DoPreheat1(); + void DoPreheat2(); +#endif +void DoCoolDown(); +#if HAS_HOTEND + void HotendPID(); +#endif +#if HAS_HEATED_BED + void BedPID(); +#endif +#if ENABLED(BAUD_RATE_GCODE) + void HMI_SetBaudRate(); + void SetBaud115K(); + void SetBaud250K(); +#endif +#if HAS_LCD_BRIGHTNESS + void TurnOffBacklight(); +#endif +void ApplyExtMinT(); +void ParkHead(); +#if HAS_ONESTEP_LEVELING + void Trammingwizard(); +#endif +#if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS) + void ApplyLEDColor(); +#endif +#if ENABLED(AUTO_BED_LEVELING_UBL) + void UBLTiltMesh(); + bool UBLValidMesh(); + void UBLSaveMesh(); + void UBLLoadMesh(); +#endif // Other void Goto_PrintProcess(); @@ -115,28 +160,18 @@ void Goto_PowerLossRecovery(); void Goto_ConfirmToPrint(); void DWIN_Draw_Dashboard(const bool with_update); // Status Area void Draw_Main_Area(); // Redraw main area +void DWIN_DrawStatusLine(const char *text); // Draw simple status text +void DWIN_DrawStatusLine(FSTR_P fstr); +void DWIN_RedrawDash(); // Redraw Dash and Status line void DWIN_RedrawScreen(); // Redraw all screen elements void HMI_MainMenu(); // Main process screen void HMI_SelectFile(); // File page void HMI_Printing(); // Print page void HMI_ReturnScreen(); // Return to previous screen before popups -void ApplyExtMinT(); -void HMI_SetLanguageCache(); // Set the language image cache -void RebootPrinter(); -#if ENABLED(BAUD_RATE_GCODE) - void HMI_SetBaudRate(); - void SetBaud115K(); - void SetBaud250K(); -#endif -#if ENABLED(EEPROM_SETTINGS) - void WriteEeprom(); - void ReadEeprom(); - void ResetEeprom(); -#endif - void HMI_WaitForUser(); void HMI_SaveProcessID(const uint8_t id); -void HMI_AudioFeedback(const bool success=true); +void HMI_SDCardInit(); +void HMI_SDCardUpdate(); void EachMomentUpdate(); void update_variable(); void DWIN_InitScreen(); @@ -248,3 +283,12 @@ void Draw_Steps_Menu(); #if ENABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU) void Draw_Homing_Menu(); #endif +#if ENABLED(FWRETRACT) + void Draw_FWRetract_Menu(); +#endif +#if HAS_MESH + void Draw_MeshSet_Menu(); + #if ENABLED(MESH_EDIT_MENU) + void Draw_EditMesh_Menu(); + #endif +#endif diff --git a/Marlin/src/lcd/e3v2/proui/dwin_defines.h b/Marlin/src/lcd/e3v2/proui/dwin_defines.h index 1e361c8c1133..bfeb06d76341 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_defines.h +++ b/Marlin/src/lcd/e3v2/proui/dwin_defines.h @@ -34,6 +34,23 @@ #include "../../../inc/MarlinConfigPre.h" #include +#define HAS_ESDIAG 1 +#if defined(__STM32F1__) || defined(STM32F1) + #define DASH_REDRAW 1 +#endif + +#if DISABLED(LIMITED_MAX_FR_EDITING) + #error "LIMITED_MAX_FR_EDITING is required with ProUI." +#endif +#if DISABLED(LIMITED_MAX_ACCEL_EDITING) + #error "LIMITED_MAX_ACCEL_EDITING is required with ProUI." +#endif +#if ENABLED(CLASSIC_JERK) && DISABLED(LIMITED_JERK_EDITING) + #error "LIMITED_JERK_EDITING is required with ProUI." +#endif +#if DISABLED(FILAMENT_RUNOUT_SENSOR) + #error "FILAMENT_RUNOUT_SENSOR is required with ProUI." +#endif #if DISABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU) #error "INDIVIDUAL_AXIS_HOMING_SUBMENU is required with ProUI." #endif @@ -81,7 +98,7 @@ #define HAS_ESDIAG 1 #if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS) - #define Def_Leds_Color LEDColorWhite() + #define Def_Leds_Color 0xFFFFFFFF #endif #if ENABLED(CASELIGHT_USES_BRIGHTNESS) #define Def_CaseLight_Brightness 255 @@ -128,14 +145,13 @@ typedef struct { #endif bool FullManualTramming = false; // Led - #if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS) - LEDColor Led_Color = Def_Leds_Color; + #if ENABLED(MESH_BED_LEVELING) + float ManualZOffset = 0; #endif - // Case Light - #if ENABLED(CASELIGHT_USES_BRIGHTNESS) - uint8_t CaseLight_Brightness = Def_CaseLight_Brightness; + #if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS) + uint32_t LED_Color = Def_Leds_Color; #endif } HMI_data_t; -static constexpr size_t eeprom_data_size = 64; +static constexpr size_t eeprom_data_size = sizeof(HMI_data_t); extern HMI_data_t HMI_data; diff --git a/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp b/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp index 3da3fc808624..f2cefe0cb745 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp @@ -23,8 +23,8 @@ /** * DWIN Enhanced implementation for PRO UI * Author: Miguel A. Risco-Castillo (MRISCOC) - * Version: 3.9.1 - * Date: 2022/02/08 + * Version: 3.10.1 + * Date: 2022/03/06 */ #include "../../../inc/MarlinConfigPre.h" @@ -35,54 +35,6 @@ #include "dwin_lcd.h" -/*---------------------------------------- Numeric related functions ----------------------------------------*/ - -// Draw a numeric value -// bShow: true=display background color; false=don't display background color -// zeroFill: true=zero fill; false=no zero fill -// signedMode: 1=signed; 0=unsigned -// zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space -// size: Font size -// color: Character color -// bColor: Background color -// iNum: Number of digits -// fNum: Number of decimal digits -// x/y: Upper-left coordinate -// value: Integer value -void DWIN_Draw_Value(uint8_t bShow, bool signedMode, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, - uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, int32_t value) { - size_t i = 0; - DWIN_Byte(i, 0x14); - // Bit 7: bshow - // Bit 6: 1 = signed; 0 = unsigned number; - // Bit 5: zeroFill - // Bit 4: zeroMode - // Bit 3-0: size - DWIN_Byte(i, (bShow * 0x80) | (signedMode * 0x40) | (zeroFill * 0x20) | (zeroMode * 0x10) | size); - DWIN_Word(i, color); - DWIN_Word(i, bColor); - DWIN_Byte(i, signedMode && (value >= 0) ? iNum + 1 : iNum); - DWIN_Byte(i, fNum); - DWIN_Word(i, x); - DWIN_Word(i, y); - // Write a big-endian 64 bit integer - const size_t p = i + 1; - for (size_t count = 8; count--;) { // 7..0 - ++i; - DWIN_SendBuf[p + count] = value; - value >>= 8; - } - DWIN_Send(i); -} - -// Draw a numeric value -// value: positive unscaled float value -void DWIN_Draw_Value(uint8_t bShow, bool signedMode, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, - uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - const int32_t val = round(value * POW(10, fNum)); - DWIN_Draw_Value(bShow, signedMode, zeroFill, zeroMode, size, color, bColor, iNum, fNum, x, y, val); -} - /*---------------------------------------- Picture related functions ----------------------------------------*/ // Display QR code diff --git a/Marlin/src/lcd/e3v2/proui/dwin_lcd.h b/Marlin/src/lcd/e3v2/proui/dwin_lcd.h index cdffb96f2f30..6e0a254db4ee 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_lcd.h +++ b/Marlin/src/lcd/e3v2/proui/dwin_lcd.h @@ -24,30 +24,12 @@ /** * DWIN Enhanced implementation for PRO UI * Author: Miguel A. Risco-Castillo (MRISCOC) - * Version: 3.9.1 - * Date: 2022/02/08 + * Version: 3.10.1 + * Date: 2022/03/06 */ #include "../common/dwin_api.h" -// Draw a numeric value -// bShow: true=display background color; false=don't display background color -// zeroFill: true=zero fill; false=no zero fill -// signedMode: 1=signed; 0=unsigned -// zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space -// size: Font size -// color: Character color -// bColor: Background color -// iNum: Number of digits -// fNum: Number of decimal digits -// x/y: Upper-left coordinate -// value: Integer value -void DWIN_Draw_Value(uint8_t bShow, bool signedMode, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, - uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, int32_t value); -// value: positive unscaled float value -void DWIN_Draw_Value(uint8_t bShow, bool signedMode, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, - uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value); - // Display QR code // The size of the QR code is (46*QR_Pixel)*(46*QR_Pixel) dot matrix // QR_Pixel: The pixel size occupied by each point of the QR code: 0x01-0x0F (1-16) diff --git a/Marlin/src/lcd/e3v2/proui/dwinui.cpp b/Marlin/src/lcd/e3v2/proui/dwinui.cpp index e190fa06fbfe..ecb4754a0f35 100644 --- a/Marlin/src/lcd/e3v2/proui/dwinui.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwinui.cpp @@ -23,8 +23,8 @@ /** * DWIN Enhanced implementation for PRO UI * Author: Miguel A. Risco-Castillo (MRISCOC) - * Version: 3.15.1 - * Date: 2022/02/25 + * Version: 3.17.1 + * Date: 2022/04/12 */ #include "../../../inc/MarlinConfigPre.h" @@ -39,12 +39,6 @@ //#define DEBUG_OUT 1 #include "../../../core/debug_out.h" -int8_t MenuItemTotal = 0; -int8_t MenuItemCount = 0; -MenuItemClass** MenuItems = nullptr; -MenuClass *CurrentMenu = nullptr; -MenuClass *PreviousMenu = nullptr; - xy_int_t DWINUI::cursor = { 0 }; uint16_t DWINUI::pencolor = Color_White; uint16_t DWINUI::textcolor = Def_Text_Color; @@ -53,16 +47,15 @@ uint16_t DWINUI::buttoncolor = Def_Button_Color; uint8_t DWINUI::font = font8x16; FSTR_P const DWINUI::Author = F(STRING_CONFIG_H_AUTHOR); -void (*DWINUI::onCursorErase)(const int8_t line)=nullptr; -void (*DWINUI::onCursorDraw)(const int8_t line)=nullptr; -void (*DWINUI::onTitleDraw)(TitleClass* title)=nullptr; -void (*DWINUI::onMenuDraw)(MenuClass* menu)=nullptr; +void (*DWINUI::onTitleDraw)(TitleClass* title) = nullptr; void DWINUI::init() { - TERN_(DEBUG_DWIN, SERIAL_ECHOPGM("\r\nDWIN handshake ")); delay(750); // Delay for wait to wakeup screen - const bool hs = DWIN_Handshake(); - TERN(DEBUG_DWIN, SERIAL_ECHOLNF(hs ? F("ok.") : F("error.")), UNUSED(hs)); + const bool hs = DWIN_Handshake(); UNUSED(hs); + #if ENABLED(DEBUG_DWIN) + SERIAL_ECHOPGM("DWIN_Handshake "); + SERIAL_ECHOLNF(hs ? F("ok.") : F("error.")); + #endif DWIN_Frame_SetDir(1); cursor.reset(); pencolor = Color_White; @@ -164,16 +157,19 @@ void DWINUI::Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint1 DWIN_Draw_String(bShow, size, color, bColor, x, y, string); } -// // Draw a Centered string using DWIN_WIDTH -// void DWINUI::Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, const char * const string) { -// const int8_t x = _MAX(0U, DWIN_WIDTH - strlen_P(string) * fontWidth(size)) / 2 - 1; -// DWIN_Draw_String(bShow, size, color, bColor, x, y, string); -// } +// Draw a char +// color: Character color +// x: abscissa of the display +// y: ordinate of the display +// c: ASCII code of char +void DWINUI::Draw_Char(uint16_t color, uint16_t x, uint16_t y, const char c) { + const char string[2] = { c, 0}; + DWIN_Draw_String(false, font, color, backcolor, x, y, string, 1); +} -// Draw a char at cursor position +// Draw a char at cursor position and increment cursor void DWINUI::Draw_Char(uint16_t color, const char c) { - const char string[2] = { c, 0}; - DWIN_Draw_String(false, font, color, backcolor, cursor.x, cursor.y, string, 1); + Draw_Char(color, cursor.x, cursor.y, c); MoveBy(fontWidth(font), 0); } @@ -190,6 +186,36 @@ void DWINUI::Draw_String(uint16_t color, const char * const string, uint16_t rli MoveBy(strlen(string) * fontWidth(font), 0); } +// Draw a numeric integer value +// bShow: true=display background color; false=don't display background color +// signedMode: 1=signed; 0=unsigned +// size: Font size +// color: Character color +// bColor: Background color +// iNum: Number of digits +// x/y: Upper-left coordinate +// value: Integer value +void DWINUI::Draw_Int(uint8_t bShow, bool signedMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value) { + char nstr[10]; + sprintf_P(nstr, PSTR("%*li"), (signedMode ? iNum + 1 : iNum), value); + DWIN_Draw_String(bShow, size, color, bColor, x, y, nstr); +} + +// Draw a numeric float value +// bShow: true=display background color; false=don't display background color +// signedMode: 1=signed; 0=unsigned +// size: Font size +// color: Character color +// bColor: Background color +// iNum: Number of digits +// fNum: Number of decimal digits +// x/y: Upper-left coordinate +// value: float value +void DWINUI::Draw_Float(uint8_t bShow, bool signedMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + char nstr[10]; + DWIN_Draw_String(bShow, size, color, bColor, x, y, dtostrf(value, iNum + (signedMode ? 2:1) + fNum, fNum, nstr)); +} + // ------------------------- Buttons ------------------------------// void DWINUI::Draw_Button(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char * const caption) { @@ -204,6 +230,7 @@ void DWINUI::Draw_Button(uint8_t id, uint16_t x, uint16_t y) { case BTN_Continue: Draw_Button(GET_TEXT_F(MSG_BUTTON_CONTINUE), x, y); break; case BTN_Print : Draw_Button(GET_TEXT_F(MSG_BUTTON_PRINT), x, y); break; case BTN_Save : Draw_Button(GET_TEXT_F(MSG_BUTTON_SAVE), x, y); break; + case BTN_Purge : Draw_Button(GET_TEXT_F(MSG_BUTTON_PURGE), x, y); break; default: break; } } @@ -265,7 +292,7 @@ uint16_t DWINUI::ColorInt(int16_t val, int16_t minv, int16_t maxv, uint16_t colo return RGB(R, G, B); } -// Color Interpolator through Red->Yellow->Green->Blue +// Color Interpolator through Red->Yellow->Green->Blue (Pro UI) // val : Interpolator minv..maxv // minv : Minimum value // maxv : Maximum value @@ -308,33 +335,6 @@ void DWINUI::ClearMainArea() { DWIN_Draw_Rectangle(1, backcolor, 0, TITLE_HEIGHT, DWIN_WIDTH - 1, STATUS_Y - 1); } -void DWINUI::MenuItemsClear() { - if (MenuItems == nullptr) return; - for (int8_t i = 0; i < MenuItemCount; i++) delete MenuItems[i]; - delete[] MenuItems; - MenuItems = nullptr; - MenuItemCount = 0; - MenuItemTotal = 0; -} - -void DWINUI::MenuItemsPrepare(int8_t totalitems) { - MenuItemsClear(); - MenuItemTotal = totalitems; - MenuItems = new MenuItemClass*[totalitems]; -} - -MenuItemClass* DWINUI::MenuItemsAdd(MenuItemClass* menuitem) { - if (MenuItemCount < MenuItemTotal) { - MenuItems[MenuItemCount] = menuitem; - menuitem->pos = MenuItemCount++; - return menuitem; - } - else { - delete menuitem; - return nullptr; - } -} - /* Title Class ==============================================================*/ TitleClass Title; @@ -375,85 +375,4 @@ void TitleClass::FrameCopy(uint16_t x, uint16_t y, uint16_t w, uint16_t h) { FrameCopy(1, x, y, x + w - 1, y + h - 1); } -/* Menu Class ===============================================================*/ - -MenuClass::MenuClass() { - selected = 0; - topline = 0; -} - -void MenuClass::draw() { - MenuTitle.draw(); - if (DWINUI::onMenuDraw != nullptr) (*DWINUI::onMenuDraw)(this); - for (int8_t i = 0; i < MenuItemCount; i++) - MenuItems[i]->draw(i - topline); - if (DWINUI::onCursorDraw != nullptr) DWINUI::onCursorDraw(line()); - DWIN_UpdateLCD(); -} - -void MenuClass::onScroll(bool dir) { - int8_t sel = selected; - if (dir) sel++; else sel--; - LIMIT(sel, 0, MenuItemCount - 1); - if (sel != selected) { - if (DWINUI::onCursorErase != nullptr) DWINUI::onCursorErase(line()); - if ((sel - topline) == TROWS) { - DWIN_Frame_AreaMove(1, DWIN_SCROLL_UP, MLINE, DWINUI::backcolor, 0, TITLE_HEIGHT + 1, DWIN_WIDTH, STATUS_Y - 1); - topline++; - MenuItems[sel]->draw(TROWS - 1); - } - if ((sel < topline)) { - DWIN_Frame_AreaMove(1, DWIN_SCROLL_DOWN, MLINE, DWINUI::backcolor, 0, TITLE_HEIGHT + 1, DWIN_WIDTH, STATUS_Y - 1); - topline--; - MenuItems[sel]->draw(0); - } - selected = sel; - if (DWINUI::onCursorDraw != nullptr) DWINUI::onCursorDraw(line()); - DWIN_UpdateLCD(); - } -} - -void MenuClass::onClick() { - if (MenuItems[selected]->onClick != nullptr) (*MenuItems[selected]->onClick)(); -} - -MenuItemClass *MenuClass::SelectedItem() { - return MenuItems[selected]; -} - -/* MenuItem Class ===========================================================*/ - -MenuItemClass::MenuItemClass(uint8_t cicon, const char * const text, void (*ondraw)(MenuItemClass* menuitem, int8_t line), void (*onclick)()) { - icon = cicon; - onClick = onclick; - onDraw = ondraw; - const uint8_t len = _MIN(sizeof(caption) - 1, strlen(text)); - memcpy(&caption[0], text, len); - caption[len] = '\0'; -} - -MenuItemClass::MenuItemClass(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, void (*ondraw)(MenuItemClass* menuitem, int8_t line), void (*onclick)()) { - icon = cicon; - onClick = onclick; - onDraw = ondraw; - caption[0] = '\0'; - frameid = id; - frame = { x1, y1, x2, y2 }; -} - -void MenuItemClass::SetFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) { - caption[0] = '\0'; - frameid = id; - frame = { x1, y1, x2, y2 }; -} - -void MenuItemClass::draw(int8_t line) { - if (line < 0 || line >= TROWS) return; - if (onDraw != nullptr) (*onDraw)(this, line); -}; - -MenuItemPtrClass::MenuItemPtrClass(uint8_t cicon, const char * const text, void (*ondraw)(MenuItemClass* menuitem, int8_t line), void (*onclick)(), void* val) : MenuItemClass(cicon, text, ondraw, onclick) { - value = val; -}; - #endif // DWIN_LCD_PROUI diff --git a/Marlin/src/lcd/e3v2/proui/dwinui.h b/Marlin/src/lcd/e3v2/proui/dwinui.h index 6771c77d5d81..f8ff0917694d 100644 --- a/Marlin/src/lcd/e3v2/proui/dwinui.h +++ b/Marlin/src/lcd/e3v2/proui/dwinui.h @@ -24,8 +24,8 @@ /** * DWIN Enhanced implementation for PRO UI * Author: Miguel A. Risco-Castillo (MRISCOC) - * Version: 3.15.1 - * Date: 2022/02/25 + * Version: 3.17.1 + * Date: 2022/04/12 */ #include "dwin_lcd.h" @@ -37,6 +37,7 @@ #define ICON_AdvSet ICON_Language #define ICON_BedSizeX ICON_PrintSize #define ICON_BedSizeY ICON_PrintSize +#define ICON_BedTramming ICON_SetHome #define ICON_Binary ICON_Contact #define ICON_Brightness ICON_Motion #define ICON_Cancel ICON_StockConfiguration @@ -50,10 +51,12 @@ #define ICON_FilUnload ICON_ReadEEPROM #define ICON_Flow ICON_StepE #define ICON_Folder ICON_More +#define ICON_FWRetract ICON_StepE #define ICON_FWRetLength ICON_StepE #define ICON_FWRetSpeed ICON_Setspeed #define ICON_FWRetZRaise ICON_MoveZ #define ICON_FWRecSpeed ICON_Setspeed +#define ICON_FWRecExtra ICON_StepE #define ICON_HomeX ICON_MoveX #define ICON_HomeY ICON_MoveY #define ICON_HomeZ ICON_MoveZ @@ -102,6 +105,9 @@ #define ICON_SetBaudRate ICON_Setspeed #define ICON_SetCustomPreheat ICON_SetEndTemp #define ICON_Sound ICON_Cool +#define ICON_TBSetup ICON_Contact +#define ICON_UBLActive ICON_HotendTemp + #define ICON_CaseLight ICON_Motion #define ICON_LedControl ICON_Motion @@ -111,12 +117,27 @@ #define BTN_Confirm 89 #define BTN_Print 90 #define BTN_Save 91 +#define BTN_Purge 92 // Extended and default UI Colors #define Color_Black 0 #define Color_Green RGB(0,63,0) #define Color_Aqua RGB(0,63,31) #define Color_Blue RGB(0,0,31) +#define Color_Light_White 0xBDD7 +#define Color_Light_Green 0x3460 +#define Color_Cyan 0x07FF +#define Color_Light_Cyan 0x04F3 +#define Color_Light_Blue 0x3A6A +#define Color_Magenta 0xF81F +#define Color_Light_Magenta 0x9813 +#define Color_Light_Red 0x8800 +#define Color_Orange 0xFA20 +#define Color_Light_Orange 0xFBC0 +#define Color_Light_Yellow 0x8BE0 +#define Color_Brown 0xCC27 +#define Color_Light_Brown 0x6204 +#define Color_Grey 0x18E3 // UI element defines and constants #define DWIN_FONT_MENU font8x16 @@ -130,7 +151,7 @@ #define UNITFDIGITS 1 #define MINUNITMULT POW(10, UNITFDIGITS) -constexpr uint16_t TITLE_HEIGHT = 30, // Title bar height +constexpr uint8_t TITLE_HEIGHT = 30, // Title bar height MLINE = 53, // Menu line height TROWS = (STATUS_Y - TITLE_HEIGHT) / MLINE, // Total rows MROWS = TROWS - 1, // Other-than-Back @@ -149,10 +170,6 @@ constexpr uint16_t TITLE_HEIGHT = 30, // Title bar heig // Menuitem caption Y position #define MBASE(L) (MYPOS(L) + CAPOFF) -// Create and add a MenuItem object to the menu array -#define MENU_ITEM(V...) DWINUI::MenuItemsAdd(new MenuItemClass(V)) -#define EDIT_ITEM(V...) DWINUI::MenuItemsAdd(new MenuItemPtrClass(V)) - typedef struct { uint16_t left, top, right, bottom; } rect_t; typedef struct { uint16_t x, y, w, h; } frame_rect_t; @@ -173,49 +190,6 @@ class TitleClass { }; extern TitleClass Title; -class MenuItemClass { -protected: -public: - int8_t pos = 0; - uint8_t icon = 0; - char caption[32] = ""; - uint8_t frameid = 0; - rect_t frame = {0}; - void (*onDraw)(MenuItemClass* menuitem, int8_t line) = nullptr; - void (*onClick)() = nullptr; - MenuItemClass() {}; - MenuItemClass(uint8_t cicon, const char * const text=nullptr, void (*ondraw)(MenuItemClass* menuitem, int8_t line)=nullptr, void (*onclick)()=nullptr); - MenuItemClass(uint8_t cicon, FSTR_P text = nullptr, void (*ondraw)(MenuItemClass* menuitem, int8_t line)=nullptr, void (*onclick)()=nullptr) : MenuItemClass(cicon, FTOP(text), ondraw, onclick){} - MenuItemClass(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, void (*ondraw)(MenuItemClass* menuitem, int8_t line)=nullptr, void (*onclick)()=nullptr); - void SetFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); - virtual ~MenuItemClass(){}; - virtual void draw(int8_t line); -}; - -class MenuItemPtrClass: public MenuItemClass { -public: - void *value = nullptr; - using MenuItemClass::MenuItemClass; - MenuItemPtrClass(uint8_t cicon, const char * const text, void (*ondraw)(MenuItemClass* menuitem, int8_t line), void (*onclick)(), void* val); - MenuItemPtrClass(uint8_t cicon, FSTR_P text, void (*ondraw)(MenuItemClass* menuitem, int8_t line), void (*onclick)(), void* val) : MenuItemPtrClass(cicon, FTOP(text), ondraw, onclick, val){} -}; - -class MenuClass { -public: - int8_t topline = 0; - int8_t selected = 0; - TitleClass MenuTitle; - MenuClass(); - virtual ~MenuClass(){}; - inline int8_t line() { return selected - topline; }; - inline int8_t line(uint8_t pos) {return pos - topline; }; - void draw(); - void onScroll(bool dir); - void onClick(); - MenuItemClass* SelectedItem(); -}; -extern MenuClass *CurrentMenu; - namespace DWINUI { extern xy_int_t cursor; extern uint16_t pencolor; @@ -225,10 +199,7 @@ namespace DWINUI { extern uint8_t font; extern FSTR_P const Author; - extern void (*onCursorErase)(const int8_t line); - extern void (*onCursorDraw)(const int8_t line); extern void (*onTitleDraw)(TitleClass* title); - extern void (*onMenuDraw)(MenuClass* menu); // DWIN LCD Initialization void init(); @@ -304,129 +275,121 @@ namespace DWINUI { DWIN_ICON_Show(true, false, false, ICON, icon, x, y); } - // Draw a positive integer + // Draw a numeric integer value // bShow: true=display background color; false=don't display background color - // zeroFill: true=zero fill; false=no zero fill - // zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space + // signedMode: 1=signed; 0=unsigned // size: Font size // color: Character color // bColor: Background color // iNum: Number of digits // x/y: Upper-left coordinate // value: Integer value - inline void Draw_Int(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - DWIN_Draw_Value(bShow, 0, zeroFill, zeroMode, size, color, bColor, iNum, 0, x, y, value); + void Draw_Int(uint8_t bShow, bool signedMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value); + + // Draw a positive integer + inline void Draw_Int(uint8_t bShow, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { + Draw_Int(bShow, 0, size, color, bColor, iNum, x, y, value); } inline void Draw_Int(uint8_t iNum, long value) { - DWIN_Draw_Value(false, 0, true, 0, font, textcolor, backcolor, iNum, 0, cursor.x, cursor.y, value); + Draw_Int(false, 0, font, textcolor, backcolor, iNum, cursor.x, cursor.y, value); MoveBy(iNum * fontWidth(font), 0); } inline void Draw_Int(uint8_t iNum, uint16_t x, uint16_t y, long value) { - DWIN_Draw_Value(false, 0, true, 0, font, textcolor, backcolor, iNum, 0, x, y, value); + Draw_Int(false, 0, font, textcolor, backcolor, iNum, x, y, value); } inline void Draw_Int(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) { - DWIN_Draw_Value(false, 0, true, 0, font, color, backcolor, iNum, 0, x, y, value); + Draw_Int(false, 0, font, color, backcolor, iNum, x, y, value); } inline void Draw_Int(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - DWIN_Draw_Value(true, 0, true, 0, font, color, bColor, iNum, 0, x, y, value); + Draw_Int(true, 0, font, color, bColor, iNum, x, y, value); } inline void Draw_Int(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - DWIN_Draw_Value(true, 0, true, 0, size, color, bColor, iNum, 0, x, y, value); + Draw_Int(true, 0, size, color, bColor, iNum, x, y, value); } // Draw a signed integer - // bShow: true=display background color; false=don't display background color - // zeroFill: true=zero fill; false=no zero fill - // zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space - // size: Font size - // color: Character color - // bColor: Background color - // iNum: Number of digits - // x/y: Upper-left coordinate - // value: Integer value - inline void Draw_Signed_Int(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - DWIN_Draw_Value(bShow, 1, zeroFill, zeroMode, size, color, bColor, iNum, 0, x, y, value); + inline void Draw_Signed_Int(uint8_t bShow, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { + Draw_Int(bShow, 1, size, color, bColor, iNum, x, y, value); } inline void Draw_Signed_Int(uint8_t iNum, long value) { - DWIN_Draw_Value(false, 1, true, 0, font, textcolor, backcolor, iNum, 0, cursor.x, cursor.y, value); + Draw_Int(false, 1, font, textcolor, backcolor, iNum, cursor.x, cursor.y, value); MoveBy(iNum * fontWidth(font), 0); } inline void Draw_Signed_Int(uint8_t iNum, uint16_t x, uint16_t y, long value) { - DWIN_Draw_Value(false, 1, true, 0, font, textcolor, backcolor, iNum, 0, x, y, value); + Draw_Int(false, 1, font, textcolor, backcolor, iNum, x, y, value); } inline void Draw_Signed_Int(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) { - DWIN_Draw_Value(false, 1, true, 0, font, color, backcolor, iNum, 0, x, y, value); + Draw_Int(false, 1, font, color, backcolor, iNum, x, y, value); } inline void Draw_Signed_Int(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - DWIN_Draw_Value(true, 1, true, 0, font, color, bColor, iNum, 0, x, y, value); + Draw_Int(true, 1, font, color, bColor, iNum, x, y, value); } inline void Draw_Signed_Int(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - DWIN_Draw_Value(true, 1, true, 0, size, color, bColor, iNum, 0, x, y, value); + Draw_Int(true, 1, size, color, bColor, iNum, x, y, value); } - // Draw a positive floating point number + // Draw a numeric float value // bShow: true=display background color; false=don't display background color - // zeroFill: true=zero fill; false=no zero fill - // zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space + // signedMode: 1=signed; 0=unsigned // size: Font size // color: Character color // bColor: Background color - // iNum: Number of whole digits + // iNum: Number of digits // fNum: Number of decimal digits - // x/y: Upper-left point - // value: Float value - inline void Draw_Float(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - DWIN_Draw_Value(bShow, 0, zeroFill, zeroMode, size, color, bColor, iNum, fNum, x, y, value); + // x/y: Upper-left coordinate + // value: float value + void Draw_Float(uint8_t bShow, bool signedMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value); + + // Draw a positive floating point number + inline void Draw_Float(uint8_t bShow, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + Draw_Float(bShow, 0, size, color, bColor, iNum, fNum, x, y, value); } inline void Draw_Float(uint8_t iNum, uint8_t fNum, float value) { - DWIN_Draw_Value(false, 0, true, 0, font, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value); + Draw_Float(false, 0, font, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value); MoveBy((iNum + fNum + 1) * fontWidth(font), 0); } inline void Draw_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - DWIN_Draw_Value(false, 0, true, 0, font, textcolor, backcolor, iNum, fNum, x, y, value); + Draw_Float(false, 0, font, textcolor, backcolor, iNum, fNum, x, y, value); } - inline void Draw_Float(uint16_t color, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - DWIN_Draw_Value(false, 0, true, 0, font, color, backcolor, iNum, fNum, x, y, value); + inline void Draw_Float(uint8_t size, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + Draw_Float(false, 0, size, textcolor, backcolor, iNum, fNum, x, y, value); } inline void Draw_Float(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - DWIN_Draw_Value(true, 0, true, 0, font, color, bColor, iNum, fNum, x, y, value); + Draw_Float(true, 0, font, color, bColor, iNum, fNum, x, y, value); } inline void Draw_Float(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - DWIN_Draw_Value(true, 0, true, 0, size, color, bColor, iNum, fNum, x, y, value); + Draw_Float(true, 0, size, color, bColor, iNum, fNum, x, y, value); } // Draw a signed floating point number - // bShow: true=display background color; false=don't display background color - // zeroFill: true=zero fill; false=no zero fill - // zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space - // size: Font size - // color: Character color - // bColor: Background color - // iNum: Number of whole digits - // fNum: Number of decimal digits - // x/y: Upper-left point - // value: Float value - inline void Draw_Signed_Float(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - DWIN_Draw_Value(bShow, 1, zeroFill, zeroMode, size, color, bColor, iNum, fNum, x, y, value); + inline void Draw_Signed_Float(uint8_t bShow, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + Draw_Float(bShow, 1, size, color, bColor, iNum, fNum, x, y, value); } inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, float value) { - DWIN_Draw_Value(false, 1, true, 0, font, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value); + Draw_Float(false, 1, font, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value); MoveBy((iNum + fNum + 1) * fontWidth(font), 0); } inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - DWIN_Draw_Value(false, 1, true, 0, font, textcolor, backcolor, iNum, fNum, x, y, value); + Draw_Float(false, 1, font, textcolor, backcolor, iNum, fNum, x, y, value); } inline void Draw_Signed_Float(uint8_t size, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - DWIN_Draw_Value(false, 1, true, 0, size, textcolor, backcolor, iNum, fNum, x, y, value); + Draw_Float(false, 1, size, textcolor, backcolor, iNum, fNum, x, y, value); } inline void Draw_Signed_Float(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - DWIN_Draw_Value(true, 1, true, 0, font, color, bColor, iNum, fNum, x, y, value); + Draw_Float(true, 1, font, color, bColor, iNum, fNum, x, y, value); } inline void Draw_Signed_Float(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - DWIN_Draw_Value(true, 1, true, 0, size, color, bColor, iNum, fNum, x, y, value); + Draw_Float(true, 1, size, color, bColor, iNum, fNum, x, y, value); } - // Draw a char at cursor position + // Draw a char + // color: Character color + // x: abscissa of the display + // y: ordinate of the display + // c: ASCII code of char + void Draw_Char(uint16_t color, uint16_t x, uint16_t y, const char c); + inline void Draw_Char(uint16_t x, uint16_t y, const char c) { Draw_Char(textcolor, x, y, c); }; + // Draw a char at cursor position and increment cursor void Draw_Char(uint16_t color, const char c); inline void Draw_Char(const char c) { Draw_Char(textcolor, c); } @@ -591,17 +554,8 @@ namespace DWINUI { DWIN_WriteToMem(0xA5, addr, length, data); } - // Clear Menu by filling the area with background color + // Clear by filling the area with background color // Area (0, TITLE_HEIGHT, DWIN_WIDTH, STATUS_Y - 1) void ClearMainArea(); - // Clear MenuItems array and free MenuItems elements - void MenuItemsClear(); - - // Prepare MenuItems array - void MenuItemsPrepare(int8_t totalitems); - - // Add elements to the MenuItems array - MenuItemClass* MenuItemsAdd(MenuItemClass* menuitem); - }; diff --git a/Marlin/src/lcd/e3v2/proui/lockscreen.cpp b/Marlin/src/lcd/e3v2/proui/lockscreen.cpp index c179856c6acb..44b595096a88 100644 --- a/Marlin/src/lcd/e3v2/proui/lockscreen.cpp +++ b/Marlin/src/lcd/e3v2/proui/lockscreen.cpp @@ -23,8 +23,8 @@ /** * Lock screen implementation for PRO UI * Author: Miguel A. Risco-Castillo (MRISCOC) - * Version: 2.1 - * Date: 2021/11/09 + * Version: 2.2.0 + * Date: 2022/04/11 */ #include "../../../inc/MarlinConfigPre.h" @@ -50,6 +50,7 @@ void LockScreenClass::init() { } void LockScreenClass::draw() { + Title.SetCaption(GET_TEXT_F(MSG_LOCKSCREEN)); DWINUI::ClearMainArea(); DWINUI::Draw_Icon(ICON_LOGO, 71, 120); // CREALITY logo DWINUI::Draw_CenteredString(Color_White, 180, GET_TEXT_F(MSG_LOCKSCREEN_LOCKED)); diff --git a/Marlin/src/lcd/e3v2/proui/lockscreen.h b/Marlin/src/lcd/e3v2/proui/lockscreen.h index ec967fe2db7c..83d5530be3e4 100644 --- a/Marlin/src/lcd/e3v2/proui/lockscreen.h +++ b/Marlin/src/lcd/e3v2/proui/lockscreen.h @@ -24,8 +24,8 @@ /** * Lock screen implementation for PRO UI * Author: Miguel A. Risco-Castillo (MRISCOC) - * Version: 2.1 - * Date: 2021/11/09 + * Version: 2.2.0 + * Date: 2022/04/11 */ #include "../common/encoder.h" diff --git a/Marlin/src/lcd/e3v2/proui/menus.cpp b/Marlin/src/lcd/e3v2/proui/menus.cpp index 6dfcb8595c87..6438545cb251 100644 --- a/Marlin/src/lcd/e3v2/proui/menus.cpp +++ b/Marlin/src/lcd/e3v2/proui/menus.cpp @@ -23,8 +23,8 @@ /** * Menu functions for ProUI * Author: Miguel A. Risco-Castillo - * Version: 1.2.1 - * Date: 2022/02/25 + * Version: 1.4.1 + * Date: 2022/04/14 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -51,6 +51,14 @@ #include "dwin.h" #include "menus.h" +int8_t MenuItemTotal = 0; +int8_t MenuItemCount = 0; +MenuItemClass** MenuItems = nullptr; +MenuClass *CurrentMenu = nullptr; +MenuClass *PreviousMenu = nullptr; +void (*onMenuDraw)(MenuClass* menu) = nullptr; +void (*onCursorErase)(const int8_t line) = nullptr; +void (*onCursorDraw)(const int8_t line) = nullptr; MenuData_t MenuData; // Menuitem Drawing functions ================================================= @@ -69,11 +77,13 @@ void Draw_Menu(MenuClass* menu) { } void Draw_Menu_Cursor(const int8_t line) { - DWIN_Draw_Rectangle(1, HMI_data.Cursor_color, 0, MBASE(line) - 18, 14, MBASE(line + 1) - 20); + const uint16_t ypos = MYPOS(line); + DWINUI::Draw_Box(1, HMI_data.Cursor_color, {0, ypos, 15, MLINE - 1}); } void Erase_Menu_Cursor(const int8_t line) { - DWIN_Draw_Rectangle(1, HMI_data.Background_Color, 0, MBASE(line) - 18, 14, MBASE(line + 1) - 20); + const uint16_t ypos = MYPOS(line); + DWINUI::Draw_Box(1, HMI_data.Background_Color, {0, ypos, 15, MLINE - 1}); } void Draw_Menu_Line(const uint8_t line, const uint8_t icon /*=0*/, const char * const label /*=nullptr*/, bool more /*=false*/) { @@ -84,7 +94,7 @@ void Draw_Menu_Line(const uint8_t line, const uint8_t icon /*=0*/, const char * } void Draw_Chkb_Line(const uint8_t line, const bool checked) { - DWINUI::Draw_Checkbox(HMI_data.Text_Color, HMI_data.Background_Color, VALX + 16, MBASE(line) - 1, checked); + DWINUI::Draw_Checkbox(HMI_data.Text_Color, HMI_data.Background_Color, VALX + 3 * DWINUI::fontWidth(), MBASE(line) - 1, checked); } void Draw_Menu_IntValue(uint16_t bcolor, const uint8_t line, uint8_t iNum, const int32_t value /*=0*/) { @@ -141,11 +151,21 @@ void onDrawPFloat2Menu(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, value); } +void onDrawPFloat3Menu(MenuItemClass* menuitem, int8_t line) { + const float value = *(float*)static_cast(menuitem)->value; + onDrawFloatMenu(menuitem, line, 3, value); +} + void onDrawChkbMenu(MenuItemClass* menuitem, int8_t line, bool checked) { onDrawMenuItem(menuitem, line); Draw_Chkb_Line(line, checked); } +void onDrawChkbMenu(MenuItemClass* menuitem, int8_t line) { + const bool val = *(bool*)static_cast(menuitem)->value; + onDrawChkbMenu(menuitem, line, val); +} + //----------------------------------------------------------------------------- // On click functions //----------------------------------------------------------------------------- @@ -165,7 +185,7 @@ void SetOnClick(uint8_t process, const int32_t lo, const int32_t hi, uint8_t dp, MenuData.dp = dp; MenuData.Apply = Apply; MenuData.LiveUpdate = LiveUpdate; - MenuData.Value = val; + MenuData.Value = constrain(val, lo, hi); EncoderRate.enabled = true; } @@ -257,6 +277,7 @@ void HMI_Menu() { // 1 : live change // 2 : apply change int8_t HMI_GetIntNoDraw(const int32_t lo, const int32_t hi) { + const int32_t cval = MenuData.Value; EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); if (encoder_diffState != ENCODER_DIFF_NO) { if (Apply_Encoder(encoder_diffState, MenuData.Value)) { @@ -265,9 +286,8 @@ int8_t HMI_GetIntNoDraw(const int32_t lo, const int32_t hi) { return 2; } LIMIT(MenuData.Value, lo, hi); - return 1; } - return 0; + return int8_t(cval != MenuData.Value); } // Get an integer value using the encoder @@ -367,4 +387,166 @@ void HMI_SetPFloat() { } } +// Menu Classes =============================================================== + +MenuClass::MenuClass() { + selected = 0; + topline = 0; +} + +void MenuClass::draw() { + MenuTitle.draw(); + if (onMenuDraw != nullptr) onMenuDraw(this); + for (int8_t i = 0; i < MenuItemCount; i++) + MenuItems[i]->draw(i - topline); + if (onCursorDraw != nullptr) onCursorDraw(line()); + DWIN_UpdateLCD(); +} + +void MenuClass::onScroll(bool dir) { + int8_t sel = selected; + if (dir) sel++; else sel--; + LIMIT(sel, 0, MenuItemCount - 1); + if (sel != selected) { + if (onCursorErase != nullptr) onCursorErase(line()); + DWIN_UpdateLCD(); + if ((sel - topline) == TROWS) { + DWIN_Frame_AreaMove(1, DWIN_SCROLL_UP, MLINE, DWINUI::backcolor, 0, TITLE_HEIGHT + 1, DWIN_WIDTH, STATUS_Y - 1); + topline++; + MenuItems[sel]->draw(TROWS - 1); + } + if ((sel < topline)) { + DWIN_Frame_AreaMove(1, DWIN_SCROLL_DOWN, MLINE, DWINUI::backcolor, 0, TITLE_HEIGHT + 1, DWIN_WIDTH, STATUS_Y - 1); + topline--; + MenuItems[sel]->draw(0); + } + selected = sel; + if (onCursorDraw != nullptr) onCursorDraw(line()); + DWIN_UpdateLCD(); + } +} + +void MenuClass::onClick() { + if (MenuItems[selected]->onClick != nullptr) (*MenuItems[selected]->onClick)(); +} + +MenuItemClass *MenuClass::SelectedItem() { + return MenuItems[selected]; +} + +MenuItemClass** MenuClass::Items() { + return MenuItems; +} + +int8_t MenuClass::count() { + return MenuItemCount; +}; + +/* MenuItem Class ===========================================================*/ + +MenuItemClass::MenuItemClass(uint8_t cicon, const char * const text, void (*ondraw)(MenuItemClass* menuitem, int8_t line), void (*onclick)()) { + icon = cicon; + onClick = onclick; + onDraw = ondraw; + const uint8_t len = _MIN(sizeof(caption) - 1, strlen(text)); + memcpy(&caption[0], text, len); + caption[len] = '\0'; +} + +MenuItemClass::MenuItemClass(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, void (*ondraw)(MenuItemClass* menuitem, int8_t line), void (*onclick)()) { + icon = cicon; + onClick = onclick; + onDraw = ondraw; + caption[0] = '\0'; + frameid = id; + frame = { x1, y1, x2, y2 }; +} + +void MenuItemClass::SetFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) { + caption[0] = '\0'; + frameid = id; + frame = { x1, y1, x2, y2 }; +} + +void MenuItemClass::draw(int8_t line) { + if (line < 0 || line >= TROWS) return; + if (onDraw != nullptr) (*onDraw)(this, line); +}; + +void MenuItemClass::redraw() { + draw(CurrentMenu->line(this->pos)); +} + +MenuItemPtrClass::MenuItemPtrClass(uint8_t cicon, const char * const text, void (*ondraw)(MenuItemClass* menuitem, int8_t line), void (*onclick)(), void* val) : MenuItemClass(cicon, text, ondraw, onclick) { + value = val; +}; + +// Menu auxiliary functions =================================================== + +void MenuItemsClear() { + if (MenuItems == nullptr) return; + for (int8_t i = 0; i < MenuItemCount; i++) delete MenuItems[i]; + delete[] MenuItems; + MenuItems = nullptr; + MenuItemCount = 0; + MenuItemTotal = 0; +} + +void MenuItemsPrepare(int8_t totalitems) { + MenuItemsClear(); + MenuItemTotal = totalitems; + MenuItems = new MenuItemClass*[totalitems]; +} + +MenuItemClass* MenuItemsAdd(MenuItemClass* menuitem) { + MenuItems[MenuItemCount] = menuitem; + menuitem->pos = MenuItemCount++; + return menuitem; +} + +MenuItemClass* MenuItemsAdd(uint8_t cicon, const char * const text/*=nullptr*/, void (*ondraw)(MenuItemClass* menuitem, int8_t line)/*=nullptr*/, void (*onclick)()/*=nullptr*/) { + if (MenuItemCount < MenuItemTotal) { + MenuItemClass* menuitem = new MenuItemClass(cicon, text, ondraw, onclick); + return MenuItemsAdd(menuitem); + } + else return nullptr; +} + +MenuItemClass* MenuItemsAdd(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, void (*ondraw)(MenuItemClass* menuitem, int8_t line)/*=nullptr*/, void (*onclick)()/*=nullptr*/) { + if (MenuItemCount < MenuItemTotal) { + MenuItemClass* menuitem = new MenuItemClass(cicon, id, x1, y1, x2, y2, ondraw, onclick); + return MenuItemsAdd(menuitem); + } + else return nullptr; +} + +MenuItemClass* MenuItemsAdd(uint8_t cicon, const char * const text, void (*ondraw)(MenuItemClass* menuitem, int8_t line), void (*onclick)(), void* val) { + if (MenuItemCount < MenuItemTotal) { + MenuItemClass* menuitem = new MenuItemPtrClass(cicon, text, ondraw, onclick, val); + return MenuItemsAdd(menuitem); + } + else return nullptr; +} + +bool SetMenu(MenuClass* &menu, FSTR_P title, int8_t totalitems) { + if (!menu) menu = new MenuClass(); + const bool NotCurrent = (CurrentMenu != menu); + if (NotCurrent) { + menu->MenuTitle.SetCaption(title); + MenuItemsPrepare(totalitems); + } + return NotCurrent; +} + +void UpdateMenu(MenuClass* &menu) { + if (!menu) return; + if (CurrentMenu != menu) { + PreviousMenu = CurrentMenu; + CurrentMenu = menu; + } + menu->draw(); +} + +void ReDrawMenu() { if (CurrentMenu && checkkey==Menu) CurrentMenu->draw(); } + #endif // DWIN_LCD_PROUI diff --git a/Marlin/src/lcd/e3v2/proui/menus.h b/Marlin/src/lcd/e3v2/proui/menus.h index 0147c1616b31..d4514d173237 100644 --- a/Marlin/src/lcd/e3v2/proui/menus.h +++ b/Marlin/src/lcd/e3v2/proui/menus.h @@ -23,8 +23,8 @@ /** * Menu functions for ProUI * Author: Miguel A. Risco-Castillo - * Version: 1.2.1 - * Date: 2022/02/25 + * Version: 1.4.1 + * Date: 2022/04/14 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -56,8 +56,70 @@ typedef struct { } MenuData_t; extern MenuData_t MenuData; +extern void (*onCursorErase)(const int8_t line); +extern void (*onCursorDraw)(const int8_t line); + +// Auxiliary Macros =========================================================== + +// Create and add a MenuItem object to the menu array +#define BACK_ITEM(H) MenuItemsAdd(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawMenuItem, H) +#define MENU_ITEM(V...) MenuItemsAdd(V) +#define EDIT_ITEM(V...) MenuItemsAdd(V) +#define MENU_ITEM_F(I,L,V...) MenuItemsAdd(I, GET_TEXT_F(L), V) +#define EDIT_ITEM_F(I,L,V...) MenuItemsAdd(I, GET_TEXT_F(L), V) + +// Menu Classes =============================================================== + +class MenuItemClass { +protected: +public: + int8_t pos = 0; + uint8_t icon = 0; + char caption[32] = ""; + uint8_t frameid = 0; + rect_t frame = {0}; + void (*onDraw)(MenuItemClass* menuitem, int8_t line) = nullptr; + void (*onClick)() = nullptr; + MenuItemClass() {}; + MenuItemClass(uint8_t cicon, const char * const text=nullptr, void (*ondraw)(MenuItemClass* menuitem, int8_t line)=nullptr, void (*onclick)()=nullptr); + // MenuItemClass(uint8_t cicon, FSTR_P text = nullptr, void (*ondraw)(MenuItemClass* menuitem, int8_t line)=nullptr, void (*onclick)()=nullptr) : MenuItemClass(cicon, FTOP(text), ondraw, onclick){} + MenuItemClass(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, void (*ondraw)(MenuItemClass* menuitem, int8_t line)=nullptr, void (*onclick)()=nullptr); + void SetFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); + virtual ~MenuItemClass(){}; + virtual void draw(int8_t line); + void redraw(); +}; + +class MenuItemPtrClass: public MenuItemClass { +public: + void *value = nullptr; + using MenuItemClass::MenuItemClass; + MenuItemPtrClass(uint8_t cicon, const char * const text, void (*ondraw)(MenuItemClass* menuitem, int8_t line), void (*onclick)(), void* val); + MenuItemPtrClass(uint8_t cicon, FSTR_P text, void (*ondraw)(MenuItemClass* menuitem, int8_t line), void (*onclick)(), void* val) : MenuItemPtrClass(cicon, FTOP(text), ondraw, onclick, val){} +}; + +class MenuClass { +public: + int8_t topline = 0; + int8_t selected = 0; + TitleClass MenuTitle; + MenuClass(); + virtual ~MenuClass(){}; + inline int8_t line() { return selected - topline; }; + inline int8_t line(uint8_t pos) {return pos - topline; }; + int8_t count(); + virtual void draw(); + virtual void onScroll(bool dir); + void onClick(); + MenuItemClass* SelectedItem(); + static MenuItemClass** Items(); +}; +extern MenuClass *CurrentMenu; +extern MenuClass *PreviousMenu; +extern void (*onMenuDraw)(MenuClass* menu); // Menuitem Drawing functions ================================================= + void Draw_Title(TitleClass* title); void Draw_Menu(MenuClass* menu); void Draw_Menu_Cursor(const int8_t line); @@ -74,9 +136,12 @@ void onDrawPInt32Menu(MenuItemClass* menuitem, int8_t line); void onDrawFloatMenu(MenuItemClass* menuitem, int8_t line, uint8_t dp, const float value); void onDrawPFloatMenu(MenuItemClass* menuitem, int8_t line); void onDrawPFloat2Menu(MenuItemClass* menuitem, int8_t line); +void onDrawPFloat3Menu(MenuItemClass* menuitem, int8_t line); void onDrawChkbMenu(MenuItemClass* menuitem, int8_t line, bool checked); +void onDrawChkbMenu(MenuItemClass* menuitem, int8_t line); // On click functions ========================================================= + void SetOnClick(uint8_t process, const int32_t lo, const int32_t hi, uint8_t dp, const int32_t val, void (*Apply)() = nullptr, void (*LiveUpdate)() = nullptr); void SetValueOnClick(uint8_t process, const int32_t lo, const int32_t hi, const int32_t val, void (*Apply)() = nullptr, void (*LiveUpdate)() = nullptr); void SetValueOnClick(uint8_t process, const float lo, const float hi, uint8_t dp, const float val, void (*Apply)() = nullptr, void (*LiveUpdate)() = nullptr); @@ -86,9 +151,38 @@ void SetFloatOnClick(const float lo, const float hi, uint8_t dp, const float val void SetPFloatOnClick(const float lo, const float hi, uint8_t dp, void (*Apply)() = nullptr, void (*LiveUpdate)() = nullptr); // HMI user control functions ================================================= + void HMI_Menu(); void HMI_SetInt(); void HMI_SetPInt(); void HMI_SetIntNoDraw(); void HMI_SetFloat(); void HMI_SetPFloat(); + +// Menu auxiliary functions =================================================== + +// Create a new menu +bool SetMenu(MenuClass* &menu, FSTR_P title, int8_t totalitems); + +//Update the Menu and Draw if it is valid +void UpdateMenu(MenuClass* &menu); + +//Redraw the current Menu if it is valid +void ReDrawMenu(); + +// Clear MenuItems array and free MenuItems elements +void MenuItemsClear(); + +// Prepare MenuItems array +void MenuItemsPrepare(int8_t totalitems); + +// Add elements to the MenuItems array +MenuItemClass* MenuItemsAdd(uint8_t cicon, const char * const text=nullptr, void (*ondraw)(MenuItemClass* menuitem, int8_t line)=nullptr, void (*onclick)()=nullptr); +inline MenuItemClass* MenuItemsAdd(uint8_t cicon, FSTR_P text = nullptr, void (*ondraw)(MenuItemClass* menuitem, int8_t line)=nullptr, void (*onclick)()=nullptr) { + return MenuItemsAdd(cicon, FTOP(text), ondraw, onclick); +} +MenuItemClass* MenuItemsAdd(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, void (*ondraw)(MenuItemClass* menuitem, int8_t line)=nullptr, void (*onclick)()=nullptr); +MenuItemClass* MenuItemsAdd(uint8_t cicon, const char * const text, void (*ondraw)(MenuItemClass* menuitem, int8_t line), void (*onclick)(), void* val); +inline MenuItemClass* MenuItemsAdd(uint8_t cicon, FSTR_P text, void (*ondraw)(MenuItemClass* menuitem, int8_t line), void (*onclick)(), void* val) { + return MenuItemsAdd(cicon, FTOP(text), ondraw, onclick, val); +} diff --git a/Marlin/src/lcd/e3v2/proui/meshviewer.cpp b/Marlin/src/lcd/e3v2/proui/meshviewer.cpp index 6121ab35d45f..5fe8b1bb104a 100644 --- a/Marlin/src/lcd/e3v2/proui/meshviewer.cpp +++ b/Marlin/src/lcd/e3v2/proui/meshviewer.cpp @@ -23,8 +23,8 @@ /** * Mesh Viewer for PRO UI * Author: Miguel A. Risco-Castillo (MRISCOC) - * version: 3.12.1 - * Date: 2022/02/24 + * version: 3.14.1 + * Date: 2022/04/11 */ #include "../../../inc/MarlinConfigPre.h" @@ -41,6 +41,10 @@ #include "dwin_popup.h" #include "../../../feature/bedlevel/bedlevel.h" +#if ENABLED(AUTO_BED_LEVELING_UBL) + #include "ubl_tools.h" +#endif + MeshViewerClass MeshViewer; void MeshViewerClass::DrawMesh(bed_mesh_t zval, const uint8_t sizex, const uint8_t sizey) { @@ -56,17 +60,15 @@ void MeshViewerClass::DrawMesh(bed_mesh_t zval, const uint8_t sizex, const uint8 #define DrawMeshValue(xp, yp, zv) DWINUI::Draw_Signed_Float(font6x12, 1, 2, px(xp) - 18, py(yp) - 6, zv) #define DrawMeshHLine(yp) DWIN_Draw_HLine(HMI_data.SplitLine_Color, px(0), py(yp), DWIN_WIDTH - 2 * mx) #define DrawMeshVLine(xp) DWIN_Draw_VLine(HMI_data.SplitLine_Color, px(xp), py(sizey - 1), DWIN_WIDTH - 2 * my) - int16_t maxz =-32000; int16_t minz = 32000; avg = 0; + int16_t maxz =-32000; int16_t minz = 32000; LOOP_L_N(y, sizey) LOOP_L_N(x, sizex) { const float v = isnan(zval[x][y]) ? 0 : round(zval[x][y] * 100); zmesh[x][y] = v; - avg += v; NOLESS(maxz, v); NOMORE(minz, v); } max = (float)maxz / 100; min = (float)minz / 100; - avg = avg / (100 * sizex * sizey); DWINUI::ClearMainArea(); DWIN_Draw_Rectangle(0, HMI_data.SplitLine_Color, px(0), py(0), px(sizex - 1), py(sizey - 1)); LOOP_S_L_N(x, 1, sizex - 1) DrawMeshVLine(x); @@ -77,8 +79,10 @@ void MeshViewerClass::DrawMesh(bed_mesh_t zval, const uint8_t sizex, const uint8 uint16_t color = DWINUI::RainbowInt(zmesh[x][y], _MIN(-5, minz), _MAX(5, maxz)); uint8_t radius = rm(zmesh[x][y]); DWINUI::Draw_FillCircle(color, px(x), py(y), radius); - if (sizex < 9) - DWINUI::Draw_Signed_Float(font6x12, 1, 2, px(x) - 18, py(y) - 6, zval[x][y]); + if (sizex < 9) { + if (zmesh[x][y] == 0) DWINUI::Draw_Float(font6x12, 1, 2, px(x) - 12, py(y) - 6, 0); + else DWINUI::Draw_Signed_Float(font6x12, 1, 2, px(x) - 18, py(y) - 6, zval[x][y]); + } else { char str_1[9]; str_1[0] = 0; @@ -108,7 +112,13 @@ void MeshViewerClass::DrawMesh(bed_mesh_t zval, const uint8_t sizex, const uint8 void MeshViewerClass::Draw(bool withsave /*= false*/) { Title.ShowCaption(GET_TEXT_F(MSG_MESH_VIEWER)); - DrawMesh(Z_VALUES_ARR, GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y); + #if ENABLED(USE_UBL_VIEWER) + DWINUI::ClearMainArea(); + ubl_tools.viewer_print_value = true; + ubl_tools.Draw_Bed_Mesh(-1, 1, 8, 10 + TITLE_HEIGHT); + #else + DrawMesh(Z_VALUES_ARR, GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y); + #endif if (withsave) { DWINUI::Draw_Button(BTN_Save, 26, 305); DWINUI::Draw_Button(BTN_Continue, 146, 305); @@ -117,15 +127,19 @@ void MeshViewerClass::Draw(bool withsave /*= false*/) { else DWINUI::Draw_Button(BTN_Continue, 86, 305); - char str_1[6], str_2[6] = ""; - ui.status_printf(0, F("Mesh minZ: %s, maxZ: %s"), - dtostrf(min, 1, 2, str_1), - dtostrf(max, 1, 2, str_2) - ); + #if ENABLED(USE_UBL_VIEWER) + ubl_tools.Set_Mesh_Viewer_Status(); + #else + char str_1[6], str_2[6] = ""; + ui.status_printf(0, F("Mesh minZ: %s, maxZ: %s"), + dtostrf(min, 1, 2, str_1), + dtostrf(max, 1, 2, str_2) + ); + #endif } void Draw_MeshViewer() { MeshViewer.Draw(true); } -void onClick_MeshViewer() { if (HMI_flag.select_flag) WriteEeprom(); HMI_ReturnScreen(); } -void Goto_MeshViewer() { if (leveling_is_valid()) Goto_Popup(Draw_MeshViewer, onClick_MeshViewer); else HMI_ReturnScreen(); } +void onClick_MeshViewer() { if (HMI_flag.select_flag) SaveMesh(); HMI_ReturnScreen(); } +void Goto_MeshViewer() { if (leveling_is_valid()) Goto_Popup(Draw_MeshViewer, onClick_MeshViewer); else HMI_ReturnScreen(); } #endif // DWIN_LCD_PROUI && HAS_MESH diff --git a/Marlin/src/lcd/e3v2/proui/meshviewer.h b/Marlin/src/lcd/e3v2/proui/meshviewer.h index f914bab4ae23..1e78ff2657b8 100644 --- a/Marlin/src/lcd/e3v2/proui/meshviewer.h +++ b/Marlin/src/lcd/e3v2/proui/meshviewer.h @@ -27,13 +27,13 @@ /** * Mesh Viewer for PRO UI * Author: Miguel A. Risco-Castillo (MRISCOC) - * version: 3.12.1 - * Date: 2022/02/24 + * version: 3.14.1 + * Date: 2022/04/11 */ class MeshViewerClass { public: - float avg, max, min; + float max, min; void Draw(bool withsave = false); void DrawMesh(bed_mesh_t zval, const uint8_t sizex, const uint8_t sizey); }; diff --git a/Marlin/src/lcd/e3v2/proui/printstats.cpp b/Marlin/src/lcd/e3v2/proui/printstats.cpp index f33d0d15faa9..5a7b6c9c4170 100644 --- a/Marlin/src/lcd/e3v2/proui/printstats.cpp +++ b/Marlin/src/lcd/e3v2/proui/printstats.cpp @@ -71,7 +71,7 @@ void PrintStatsClass::Draw() { void PrintStatsClass::Reset() { print_job_timer.initStats(); - HMI_AudioFeedback(); + DONE_BUZZ(true); } void Goto_PrintStats() { diff --git a/Marlin/src/lcd/e3v2/proui/ubl_tools.cpp b/Marlin/src/lcd/e3v2/proui/ubl_tools.cpp new file mode 100644 index 000000000000..1783ee18c523 --- /dev/null +++ b/Marlin/src/lcd/e3v2/proui/ubl_tools.cpp @@ -0,0 +1,255 @@ +/** + * UBL Tools and Mesh Viewer for Pro UI + * Version: 1.0.0 + * Date: 2022/04/13 + * + * Original Author: Henri-J-Norden + * Original Source: https://github.com/Jyers/Marlin/pull/126 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "../../../inc/MarlinConfigPre.h" +#include "ubl_tools.h" + +#if ENABLED(DWIN_LCD_PROUI) + +#include "../../marlinui.h" +#include "../../../core/types.h" +#include "dwin.h" +#include "dwinui.h" +#include "dwin_popup.h" +#include "../../../feature/bedlevel/bedlevel.h" +#include "../../../module/probe.h" +#include "../../../gcode/gcode.h" +#include "../../../module/planner.h" +#include "../../../gcode/queue.h" +#include "../../../libs/least_squares_fit.h" +#include "../../../libs/vector_3.h" + +UBLMeshToolsClass ubl_tools; + +#if ENABLED(USE_UBL_VIEWER) + bool UBLMeshToolsClass::viewer_asymmetric_range = false; + bool UBLMeshToolsClass::viewer_print_value = false; +#endif +bool UBLMeshToolsClass::goto_mesh_value = false; +uint8_t UBLMeshToolsClass::tilt_grid = 1; + +bool drawing_mesh = false; +char cmd[MAX_CMD_SIZE+16], str_1[16], str_2[16], str_3[16]; + +#if ENABLED(AUTO_BED_LEVELING_UBL) + + void UBLMeshToolsClass::manual_value_update(const uint8_t mesh_x, const uint8_t mesh_y, bool undefined/*=false*/) { + sprintf_P(cmd, PSTR("M421 I%i J%i Z%s %s"), mesh_x, mesh_y, dtostrf(current_position.z, 1, 3, str_1), undefined ? "N" : ""); + gcode.process_subcommands_now(cmd); + planner.synchronize(); + } + + bool UBLMeshToolsClass::create_plane_from_mesh() { + struct linear_fit_data lsf_results; + incremental_LSF_reset(&lsf_results); + GRID_LOOP(x, y) { + if (!isnan(Z_VALUES_ARR[x][y])) { + xy_pos_t rpos; + rpos.x = ubl.mesh_index_to_xpos(x); + rpos.y = ubl.mesh_index_to_ypos(y); + incremental_LSF(&lsf_results, rpos, Z_VALUES_ARR[x][y]); + } + } + + if (finish_incremental_LSF(&lsf_results)) { + SERIAL_ECHOPGM("Could not complete LSF!"); + return true; + } + + ubl.set_all_mesh_points_to_value(0); + + matrix_3x3 rotation = matrix_3x3::create_look_at(vector_3(lsf_results.A, lsf_results.B, 1)); + GRID_LOOP(i, j) { + float mx = ubl.mesh_index_to_xpos(i), + my = ubl.mesh_index_to_ypos(j), + mz = Z_VALUES_ARR[i][j]; + + if (DEBUGGING(LEVELING)) { + DEBUG_ECHOPAIR_F("before rotation = [", mx, 7); + DEBUG_CHAR(','); + DEBUG_ECHO_F(my, 7); + DEBUG_CHAR(','); + DEBUG_ECHO_F(mz, 7); + DEBUG_ECHOPGM("] ---> "); + DEBUG_DELAY(20); + } + + rotation.apply_rotation_xyz(mx, my, mz); + + if (DEBUGGING(LEVELING)) { + DEBUG_ECHOPAIR_F("after rotation = [", mx, 7); + DEBUG_CHAR(','); + DEBUG_ECHO_F(my, 7); + DEBUG_CHAR(','); + DEBUG_ECHO_F(mz, 7); + DEBUG_ECHOLNPGM("]"); + DEBUG_DELAY(20); + } + + Z_VALUES_ARR[i][j] = mz - lsf_results.D; + } + return false; + } + +#else + + void UBLMeshToolsClass::manual_value_update(const uint8_t mesh_x, const uint8_t mesh_y) { + sprintf_P(cmd, PSTR("G29 I%i J%i Z%s"), mesh_x, mesh_y, dtostrf(current_position.z, 1, 3, str_1)); + gcode.process_subcommands_now(cmd); + planner.synchronize(); + } + +#endif + +void UBLMeshToolsClass::manual_move(const uint8_t mesh_x, const uint8_t mesh_y, bool zmove/*=false*/) { + if (zmove) { + planner.synchronize(); + current_position.z = goto_mesh_value ? Z_VALUES_ARR[mesh_x][mesh_y] : Z_CLEARANCE_BETWEEN_PROBES; + planner.buffer_line(current_position, homing_feedrate(Z_AXIS), active_extruder); + planner.synchronize(); + } + else { + DWIN_Show_Popup(ICON_BLTouch, F("Moving to Point"), F("Please wait until done.")); + HMI_SaveProcessID(NothingToDo); + sprintf_P(cmd, PSTR("G0 F300 Z%s"), dtostrf(Z_CLEARANCE_BETWEEN_PROBES, 1, 3, str_1)); + gcode.process_subcommands_now(cmd); + sprintf_P(cmd, PSTR("G42 F4000 I%i J%i"), mesh_x, mesh_y); + gcode.process_subcommands_now(cmd); + planner.synchronize(); + current_position.z = goto_mesh_value ? Z_VALUES_ARR[mesh_x][mesh_y] : Z_CLEARANCE_BETWEEN_PROBES; + planner.buffer_line(current_position, homing_feedrate(Z_AXIS), active_extruder); + planner.synchronize(); + HMI_ReturnScreen(); + } +} + +float UBLMeshToolsClass::get_max_value() { + float max = __FLT_MIN__; + GRID_LOOP(x, y) { + if (!isnan(Z_VALUES_ARR[x][y]) && Z_VALUES_ARR[x][y] > max) + max = Z_VALUES_ARR[x][y]; + } + return max; +} + +float UBLMeshToolsClass::get_min_value() { + float min = __FLT_MAX__; + GRID_LOOP(x, y) { + if (!isnan(Z_VALUES_ARR[x][y]) && Z_VALUES_ARR[x][y] < min) + min = Z_VALUES_ARR[x][y]; + } + return min; +} + +bool UBLMeshToolsClass::validate() { + float min = __FLT_MAX__; + float max = __FLT_MIN__; + + GRID_LOOP(x, y) { + if (isnan(Z_VALUES_ARR[x][y])) return false; + if (Z_VALUES_ARR[x][y] < min) min = Z_VALUES_ARR[x][y]; + if (Z_VALUES_ARR[x][y] > max) max = Z_VALUES_ARR[x][y]; + } + return max <= UBL_Z_OFFSET_MAX && min >= UBL_Z_OFFSET_MIN; +} + +#if ENABLED(USE_UBL_VIEWER) + void UBLMeshToolsClass::Draw_Bed_Mesh(int16_t selected /*= -1*/, uint8_t gridline_width /*= 1*/, uint16_t padding_x /*= 8*/, uint16_t padding_y_top /*= 40 + 53 - 7*/) { + drawing_mesh = true; + const uint16_t total_width_px = DWIN_WIDTH - padding_x - padding_x; + const uint16_t cell_width_px = total_width_px / GRID_MAX_POINTS_X; + const uint16_t cell_height_px = total_width_px / GRID_MAX_POINTS_Y; + const float v_max = abs(get_max_value()), v_min = abs(get_min_value()), range = _MAX(v_min, v_max); + + // Clear background from previous selection and select new square + DWIN_Draw_Rectangle(1, Color_Bg_Black, _MAX(0, padding_x - gridline_width), _MAX(0, padding_y_top - gridline_width), padding_x + total_width_px, padding_y_top + total_width_px); + if (selected >= 0) { + const auto selected_y = selected / GRID_MAX_POINTS_X; + const auto selected_x = selected - (GRID_MAX_POINTS_X * selected_y); + const auto start_y_px = padding_y_top + selected_y * cell_height_px; + const auto start_x_px = padding_x + selected_x * cell_width_px; + DWIN_Draw_Rectangle(1, Color_White, _MAX(0, start_x_px - gridline_width), _MAX(0, start_y_px - gridline_width), start_x_px + cell_width_px, start_y_px + cell_height_px); + } + + // Draw value square grid + char buf[8]; + GRID_LOOP(x, y) { + const auto start_x_px = padding_x + x * cell_width_px; + const auto end_x_px = start_x_px + cell_width_px - 1 - gridline_width; + const auto start_y_px = padding_y_top + (GRID_MAX_POINTS_Y - y - 1) * cell_height_px; + const auto end_y_px = start_y_px + cell_height_px - 1 - gridline_width; + DWIN_Draw_Rectangle(1, // RGB565 colors: http://www.barth-dev.de/online/rgb565-color-picker/ + isnan(Z_VALUES_ARR[x][y]) ? Color_Grey : ( // gray if undefined + (Z_VALUES_ARR[x][y] < 0 ? + (uint16_t)round(0x1F * -Z_VALUES_ARR[x][y] / (!viewer_asymmetric_range ? range : v_min)) << 11 : // red if mesh point value is negative + (uint16_t)round(0x3F * Z_VALUES_ARR[x][y] / (!viewer_asymmetric_range ? range : v_max)) << 5) | // green if mesh point value is positive + _MIN(0x1F, (((uint8_t)abs(Z_VALUES_ARR[x][y]) / 10) * 4))), // + blue stepping for every mm + start_x_px, start_y_px, end_x_px, end_y_px + ); + + safe_delay(10); + LCD_SERIAL.flushTX(); + + // Draw value text on + if (viewer_print_value) { + int8_t offset_x, offset_y = cell_height_px / 2 - 6; + if (isnan(Z_VALUES_ARR[x][y])) { // undefined + DWIN_Draw_String(false, font6x12, Color_White, Color_Bg_Blue, start_x_px + cell_width_px / 2 - 5, start_y_px + offset_y, F("X")); + } + else { // has value + if (GRID_MAX_POINTS_X < 10) + sprintf_P(buf, PSTR("%s"), dtostrf(abs(Z_VALUES_ARR[x][y]), 1, 2, str_1)); + else + sprintf_P(buf, PSTR("%02i"), (uint16_t)(abs(Z_VALUES_ARR[x][y] - (int16_t)Z_VALUES_ARR[x][y]) * 100)); + offset_x = cell_width_px / 2 - 3 * (strlen(buf)) - 2; + if (!(GRID_MAX_POINTS_X < 10)) + DWIN_Draw_String(false, font6x12, Color_White, Color_Bg_Blue, start_x_px - 2 + offset_x, start_y_px + offset_y /*+ square / 2 - 6*/, F(".")); + DWIN_Draw_String(false, font6x12, Color_White, Color_Bg_Blue, start_x_px + 1 + offset_x, start_y_px + offset_y /*+ square / 2 - 6*/, buf); + } + safe_delay(10); + LCD_SERIAL.flushTX(); + } + } + } + + void UBLMeshToolsClass::Set_Mesh_Viewer_Status() { // TODO: draw gradient with values as a legend instead + float v_max = abs(get_max_value()), v_min = abs(get_min_value()), range = _MAX(v_min, v_max); + if (v_min > 3e+10F) v_min = 0.0000001; + if (v_max > 3e+10F) v_max = 0.0000001; + if (range > 3e+10F) range = 0.0000001; + char msg[46]; + if (viewer_asymmetric_range) { + dtostrf(-v_min, 1, 3, str_1); + dtostrf( v_max, 1, 3, str_2); + } + else { + dtostrf(-range, 1, 3, str_1); + dtostrf( range, 1, 3, str_2); + } + sprintf_P(msg, PSTR("Red %s..0..%s Green"), str_1, str_2); + ui.set_status(msg); + drawing_mesh = false; + } +#endif + +#endif // DWIN_LCD_PROUI diff --git a/Marlin/src/lcd/e3v2/proui/ubl_tools.h b/Marlin/src/lcd/e3v2/proui/ubl_tools.h new file mode 100644 index 000000000000..563794a46385 --- /dev/null +++ b/Marlin/src/lcd/e3v2/proui/ubl_tools.h @@ -0,0 +1,59 @@ +/** + * UBL Tools and Mesh Viewer for Pro UI + * Version: 1.0.0 + * Date: 2022/04/13 + * + * Original Author: Henri-J-Norden (https://github.com/Henri-J-Norden) + * Original Source: https://github.com/Jyers/Marlin/pull/135 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +#include "../../../inc/MarlinConfigPre.h" + +//#define USE_UBL_VIEWER 1 + +#define UBL_Z_OFFSET_MIN -3.0 +#define UBL_Z_OFFSET_MAX 3.0 + +class UBLMeshToolsClass { +public: + #if ENABLED(USE_UBL_VIEWER) + static bool viewer_asymmetric_range; + static bool viewer_print_value; + #endif + static bool goto_mesh_value; + static uint8_t tilt_grid; + + #if ENABLED(AUTO_BED_LEVELING_UBL) + static void manual_value_update(const uint8_t mesh_x, const uint8_t mesh_y, bool undefined=false); + static bool create_plane_from_mesh(); + #else + static void manual_value_update(const uint8_t mesh_x, const uint8_t mesh_y); + #endif + static void manual_move(const uint8_t mesh_x, const uint8_t mesh_y, bool zmove=false); + static float get_max_value(); + static float get_min_value(); + static bool validate(); + #if ENABLED(USE_UBL_VIEWER) + static void Draw_Bed_Mesh(int16_t selected = -1, uint8_t gridline_width = 1, uint16_t padding_x = 8, uint16_t padding_y_top = 40 + 53 - 7); + static void Set_Mesh_Viewer_Status(); + #endif +}; + +extern UBLMeshToolsClass ubl_tools; + +void Goto_MeshViewer(); diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 03f4f62b1750..93ef1b5a7149 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -53,6 +53,8 @@ namespace Language_en { LSTR WELCOME_MSG = MACHINE_NAME _UxGT(" Ready."); LSTR MSG_YES = _UxGT("YES"); LSTR MSG_NO = _UxGT("NO"); + LSTR MSG_HIGH = _UxGT("HIGH"); + LSTR MSG_LOW = _UxGT("LOW"); LSTR MSG_BACK = _UxGT("Back"); LSTR MSG_ERROR = _UxGT("Error"); LSTR MSG_MEDIA_ABORTING = _UxGT("Aborting..."); @@ -68,6 +70,8 @@ namespace Language_en { LSTR MSG_LCD_SOFT_ENDSTOPS = _UxGT("Soft Endstops"); LSTR MSG_MAIN = _UxGT("Main"); LSTR MSG_ADVANCED_SETTINGS = _UxGT("Advanced Settings"); + LSTR MSG_TOOLBAR_SETUP = _UxGT("Toolbar Setup"); + LSTR MSG_OPTION_DISABLED = _UxGT("Option Disabled"); LSTR MSG_CONFIGURATION = _UxGT("Configuration"); LSTR MSG_RUN_AUTO_FILES = _UxGT("Run Auto Files"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Disable Steppers"); @@ -81,6 +85,7 @@ namespace Language_en { LSTR MSG_AUTO_HOME_Z = _UxGT("Home Z"); LSTR MSG_FILAMENT_SET = _UxGT("Filament Settings"); LSTR MSG_FILAMENT_MAN = _UxGT("Filament Management"); + LSTR MSG_MANUAL_LEVELING = _UxGT("Manual Leveling"); LSTR MSG_LEVBED_FL = _UxGT("Front Left"); LSTR MSG_LEVBED_FR = _UxGT("Front Right"); LSTR MSG_LEVBED_C = _UxGT("Center"); @@ -119,7 +124,14 @@ namespace Language_en { LSTR MSG_PREHEAT_1_ALL = _UxGT("Preheat ") PREHEAT_1_LABEL _UxGT(" All"); LSTR MSG_PREHEAT_1_BEDONLY = _UxGT("Preheat ") PREHEAT_1_LABEL _UxGT(" Bed"); LSTR MSG_PREHEAT_1_SETTINGS = _UxGT("Preheat ") PREHEAT_1_LABEL _UxGT(" Conf"); - + #ifdef PREHEAT_2_LABEL + LSTR MSG_PREHEAT_2 = _UxGT("Preheat ") PREHEAT_2_LABEL; + LSTR MSG_PREHEAT_2_SETTINGS = _UxGT("Preheat ") PREHEAT_2_LABEL _UxGT(" Conf"); + #endif + #ifdef PREHEAT_3_LABEL + LSTR MSG_PREHEAT_3 = _UxGT("Preheat ") PREHEAT_3_LABEL; + LSTR MSG_PREHEAT_3_SETTINGS = _UxGT("Preheat ") PREHEAT_3_LABEL _UxGT(" Conf"); + #endif LSTR MSG_PREHEAT_M = _UxGT("Preheat $"); LSTR MSG_PREHEAT_M_H = _UxGT("Preheat $ ~"); LSTR MSG_PREHEAT_M_END = _UxGT("Preheat $ End"); @@ -166,10 +178,19 @@ namespace Language_en { LSTR MSG_MESH_VIEW = _UxGT("View Mesh"); LSTR MSG_EDITING_STOPPED = _UxGT("Mesh Editing Stopped"); LSTR MSG_NO_VALID_MESH = _UxGT("No valid mesh"); + LSTR MSG_ACTIVATE_MESH = _UxGT("Activate Leveling"); LSTR MSG_PROBING_POINT = _UxGT("Probing Point"); LSTR MSG_MESH_X = _UxGT("Index X"); LSTR MSG_MESH_Y = _UxGT("Index Y"); + LSTR MSG_MESH_INSET = _UxGT("Mesh Inset"); + LSTR MSG_MESH_MIN_X = _UxGT("Mesh X Minimum"); + LSTR MSG_MESH_MAX_X = _UxGT("Mesh X Maximum"); + LSTR MSG_MESH_MIN_Y = _UxGT("Mesh Y Minimum"); + LSTR MSG_MESH_MAX_Y = _UxGT("Mesh Y Maximum"); + LSTR MSG_MESH_AMAX = _UxGT("Maximize Area"); + LSTR MSG_MESH_CENTER = _UxGT("Center Area"); LSTR MSG_MESH_EDIT_Z = _UxGT("Z Value"); + LSTR MSG_MESH_CANCEL = _UxGT("Mesh cancelled"); LSTR MSG_CUSTOM_COMMANDS = _UxGT("Custom Commands"); LSTR MSG_M48_TEST = _UxGT("M48 Probe Test"); LSTR MSG_M48_POINT = _UxGT("M48 Point"); @@ -188,6 +209,9 @@ namespace Language_en { LSTR MSG_UBL_TOOLS = _UxGT("UBL Tools"); LSTR MSG_UBL_LEVEL_BED = _UxGT("Unified Bed Leveling"); LSTR MSG_LCD_TILTING_MESH = _UxGT("Tilting Point"); + LSTR MSG_UBL_TILT_MESH = _UxGT("Tilt Mesh"); + LSTR MSG_UBL_TILTING_GRID = _UxGT("Tilting Grid Size"); + LSTR MSG_UBL_MESH_TILTED = _UxGT("Mesh Tilted"); LSTR MSG_UBL_MANUAL_MESH = _UxGT("Manually Build Mesh"); LSTR MSG_UBL_MESH_WIZARD = _UxGT("UBL Mesh Wizard"); LSTR MSG_UBL_BC_INSERT = _UxGT("Place Shim & Measure"); @@ -236,6 +260,7 @@ namespace Language_en { LSTR MSG_UBL_MANUAL_FILLIN = _UxGT("Manual Fill-in"); LSTR MSG_UBL_SMART_FILLIN = _UxGT("Smart Fill-in"); LSTR MSG_UBL_FILLIN_MESH = _UxGT("Fill-in Mesh"); + LSTR MSG_UBL_MESH_FILLED = _UxGT("Missing Points Filled"); LSTR MSG_UBL_INVALIDATE_ALL = _UxGT("Invalidate All"); LSTR MSG_UBL_INVALIDATE_CLOSEST = _UxGT("Invalidate Closest"); LSTR MSG_UBL_FINE_TUNE_ALL = _UxGT("Fine Tune All"); @@ -244,6 +269,7 @@ namespace Language_en { LSTR MSG_UBL_STORAGE_SLOT = _UxGT("Memory Slot"); LSTR MSG_UBL_LOAD_MESH = _UxGT("Load Bed Mesh"); LSTR MSG_UBL_SAVE_MESH = _UxGT("Save Bed Mesh"); + LSTR MSG_UBL_INVALID_SLOT = _UxGT("First Select a Mesh Slot"); LSTR MSG_MESH_LOADED = _UxGT("Mesh %i Loaded"); LSTR MSG_MESH_SAVED = _UxGT("Mesh %i Saved"); LSTR MSG_UBL_NO_STORAGE = _UxGT("No Storage"); @@ -350,6 +376,7 @@ namespace Language_en { LSTR MSG_PID_AUTOTUNE_FAILED = _UxGT("PID Autotune failed!"); LSTR MSG_BAD_EXTRUDER_NUM = _UxGT("Bad extruder."); LSTR MSG_TEMP_TOO_HIGH = _UxGT("Temperature too high."); + LSTR MSG_TIMEOUT = _UxGT("Timeout."); LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Autotune failed! Bad extruder."); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Autotune failed! Temperature too high."); LSTR MSG_PID_TIMEOUT = _UxGT("Autotune failed! Timeout."); @@ -447,6 +474,10 @@ namespace Language_en { LSTR MSG_RESET_PRINTER = _UxGT("Reset Printer"); LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Refresh"); LSTR MSG_INFO_SCREEN = _UxGT("Info Screen"); + LSTR MSG_INFO_MACHINENAME = _UxGT("Machine Name"); + LSTR MSG_INFO_SIZE = _UxGT("Size"); + LSTR MSG_INFO_FWVERSION = _UxGT("Firmware Version"); + LSTR MSG_INFO_BUILD = _UxGT("Build Datetime"); LSTR MSG_PREPARE = _UxGT("Prepare"); LSTR MSG_TUNE = _UxGT("Tune"); LSTR MSG_POWER_MONITOR = _UxGT("Power monitor"); @@ -473,6 +504,7 @@ namespace Language_en { LSTR MSG_BUTTON_RESUME = _UxGT("Resume"); LSTR MSG_BUTTON_ADVANCED = _UxGT("Advanced"); LSTR MSG_BUTTON_SAVE = _UxGT("Save"); + LSTR MSG_BUTTON_PURGE = _UxGT("Purge"); LSTR MSG_PAUSING = _UxGT("Pausing..."); LSTR MSG_PAUSE_PRINT = _UxGT("Pause Print"); LSTR MSG_ADVANCED_PAUSE = _UxGT("Advanced Pause"); @@ -495,9 +527,12 @@ namespace Language_en { LSTR MSG_REMAINING_TIME = _UxGT("Remaining"); LSTR MSG_PRINT_ABORTED = _UxGT("Print Aborted"); LSTR MSG_PRINT_DONE = _UxGT("Print Done"); + LSTR MSG_PRINTER_KILLED = _UxGT("Printer killed!"); + LSTR MSG_TURN_OFF = _UxGT("Turn off the printer"); LSTR MSG_NO_MOVE = _UxGT("No Move."); LSTR MSG_KILLED = _UxGT("KILLED. "); LSTR MSG_STOPPED = _UxGT("STOPPED. "); + LSTR MSG_FWRETRACT = _UxGT("Firmware Retract"); LSTR MSG_CONTROL_RETRACT = _UxGT("Retract mm"); LSTR MSG_CONTROL_RETRACT_SWAP = _UxGT("Swap Re.mm"); LSTR MSG_CONTROL_RETRACTF = _UxGT("Retract V"); @@ -563,6 +598,9 @@ namespace Language_en { LSTR MSG_ZPROBE_XOFFSET = _UxGT("Probe X Offset"); LSTR MSG_ZPROBE_YOFFSET = _UxGT("Probe Y Offset"); LSTR MSG_ZPROBE_ZOFFSET = _UxGT("Probe Z Offset"); + LSTR MSG_ZPROBE_MARGIN = _UxGT("Probe Margin"); + LSTR MSG_Z_FEED_RATE = _UxGT("Z Feed Rate"); + LSTR MSG_ENABLE_HS_MODE = _UxGT("Enable HS mode"); LSTR MSG_MOVE_NOZZLE_TO_BED = _UxGT("Move Nozzle to Bed"); LSTR MSG_BABYSTEP_X = _UxGT("Babystep X"); LSTR MSG_BABYSTEP_Y = _UxGT("Babystep Y"); @@ -633,27 +671,28 @@ namespace Language_en { LSTR MSG_CASE_LIGHT_BRIGHTNESS = _UxGT("Light Brightness"); LSTR MSG_KILL_EXPECTED_PRINTER = _UxGT("INCORRECT PRINTER"); + LSTR MSG_COLORS_GET = _UxGT("Get Color"); + LSTR MSG_COLORS_SELECT = _UxGT("Select Colors"); + LSTR MSG_COLORS_APPLIED = _UxGT("Colors applied"); + LSTR MSG_COLORS_RED = _UxGT("Red"); + LSTR MSG_COLORS_GREEN = _UxGT("Green"); + LSTR MSG_COLORS_BLUE = _UxGT("Blue"); + LSTR MSG_COLORS_WHITE = _UxGT("White"); + LSTR MSG_UI_LANGUAGE = _UxGT("UI Language"); + LSTR MSG_SOUND_ENABLE = _UxGT("Enable sound"); LSTR MSG_LOCKSCREEN = _UxGT("Lock Screen"); LSTR MSG_LOCKSCREEN_LOCKED = _UxGT("Printer is Locked,"); LSTR MSG_LOCKSCREEN_UNLOCK = _UxGT("Scroll to unlock."); + LSTR MSG_PLEASE_WAIT_REBOOT = _UxGT("Please wait until reboot."); + #if LCD_WIDTH >= 20 || HAS_DWIN_E3V2 LSTR MSG_MEDIA_NOT_INSERTED = _UxGT("No media inserted."); - LSTR MSG_PLEASE_WAIT_REBOOT = _UxGT("Please wait until reboot. "); LSTR MSG_PLEASE_PREHEAT = _UxGT("Please preheat the hot end."); LSTR MSG_INFO_PRINT_COUNT_RESET = _UxGT("Reset Print Count"); LSTR MSG_INFO_PRINT_COUNT = _UxGT("Print Count"); LSTR MSG_INFO_PRINT_TIME = _UxGT("Print Time"); LSTR MSG_INFO_PRINT_LONGEST = _UxGT("Longest Job Time"); LSTR MSG_INFO_PRINT_FILAMENT = _UxGT("Extruded Total"); - LSTR MSG_COLORS_GET = _UxGT("Get Color"); - LSTR MSG_COLORS_SELECT = _UxGT("Select Colors"); - LSTR MSG_COLORS_APPLIED = _UxGT("Colors applied"); - LSTR MSG_COLORS_RED = _UxGT("Red"); - LSTR MSG_COLORS_GREEN = _UxGT("Green"); - LSTR MSG_COLORS_BLUE = _UxGT("Blue"); - LSTR MSG_COLORS_WHITE = _UxGT("White"); - LSTR MSG_UI_LANGUAGE = _UxGT("UI Language"); - LSTR MSG_SOUND_ENABLE = _UxGT("Enable sound"); #else LSTR MSG_MEDIA_NOT_INSERTED = _UxGT("No Media"); LSTR MSG_PLEASE_PREHEAT = _UxGT("Please Preheat"); @@ -687,10 +726,14 @@ namespace Language_en { LSTR MSG_FILAMENT_CHANGE_OPTION_HEADER = _UxGT("RESUME OPTIONS:"); LSTR MSG_FILAMENT_CHANGE_OPTION_PURGE = _UxGT("Purge more"); LSTR MSG_FILAMENT_CHANGE_OPTION_RESUME = _UxGT("Continue"); + LSTR MSG_FILAMENT_CHANGE_PURGE_CONTINUE = _UxGT("Purge or Continue?"); LSTR MSG_FILAMENT_CHANGE_NOZZLE = _UxGT(" Nozzle: "); LSTR MSG_RUNOUT_SENSOR = _UxGT("Runout Sensor"); LSTR MSG_RUNOUT_DISTANCE_MM = _UxGT("Runout Dist mm"); LSTR MSG_RUNOUT_ENABLE = _UxGT("Enable Runout"); + LSTR MSG_RUNOUT_ACTIVE = _UxGT("Runout Active"); + LSTR MSG_INVERT_EXTRUDER = _UxGT("Invert Extruder"); + LSTR MSG_EXTRUDER_MIN_TEMP = _UxGT("Extruder Min Temp."); LSTR MSG_FANCHECK = _UxGT("Fan Tacho Check"); LSTR MSG_KILL_HOMING_FAILED = _UxGT("Homing Failed"); LSTR MSG_LCD_PROBING_FAILED = _UxGT("Probing Failed"); From c814fe98d7e250692908af03836a7c362a5ce843 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 18 May 2022 00:47:11 +0300 Subject: [PATCH 072/241] =?UTF-8?q?=F0=9F=94=A8=20Use=20PlatformIO=20Core?= =?UTF-8?q?=206.0=20Dev=20for=20CI=20(#24194)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test-builds.yml | 5 +++-- docker/Dockerfile | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-builds.yml b/.github/workflows/test-builds.yml index e339f856462e..2d94b000c68c 100644 --- a/.github/workflows/test-builds.yml +++ b/.github/workflows/test-builds.yml @@ -138,8 +138,9 @@ jobs: - name: Install PlatformIO run: | - pip install -U https://github.com/platformio/platformio-core/archive/v5.2.5.zip - platformio update + pip install -U platformio + pio upgrade --dev + pio pkg update --global - name: Run ${{ matrix.test-platform }} Tests run: | diff --git a/docker/Dockerfile b/docker/Dockerfile index ad3e15d5de6f..7d32f9c63758 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,7 +1,7 @@ FROM python:3.9.0-buster -RUN pip install -U https://github.com/platformio/platformio-core/archive/v5.2.5.zip -RUN platformio update +RUN pip install -U platformio +RUN pio upgrade --dev # To get the test platforms RUN pip install PyYaml #ENV PATH /code/buildroot/bin/:/code/buildroot/tests/:${PATH} From b523ddf1b2820488c6cc46887ee85e8a781ce726 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 19 May 2022 06:05:52 -0500 Subject: [PATCH 073/241] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Common=20Bed=20Lev?= =?UTF-8?q?eling=20object=20name,=20accessors=20(#24214)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/AVR/inc/SanityCheck.h | 6 +- Marlin/src/HAL/DUE/inc/SanityCheck.h | 6 +- Marlin/src/MarlinCore.cpp | 2 +- Marlin/src/core/utility.cpp | 8 +- Marlin/src/feature/bedlevel/abl/bbl.cpp | 4 +- Marlin/src/feature/bedlevel/abl/bbl.h | 21 ++- Marlin/src/feature/bedlevel/bedlevel.cpp | 37 +++-- Marlin/src/feature/bedlevel/bedlevel.h | 5 +- .../bedlevel/mbl/mesh_bed_leveling.cpp | 2 +- .../feature/bedlevel/mbl/mesh_bed_leveling.h | 21 ++- Marlin/src/feature/bedlevel/ubl/ubl.cpp | 2 +- Marlin/src/feature/bedlevel/ubl/ubl.h | 35 +++-- Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 44 +++--- .../src/feature/bedlevel/ubl/ubl_motion.cpp | 21 ++- Marlin/src/gcode/bedlevel/G26.cpp | 16 +-- Marlin/src/gcode/bedlevel/G42.cpp | 4 +- Marlin/src/gcode/bedlevel/M420.cpp | 34 ++--- Marlin/src/gcode/bedlevel/abl/G29.cpp | 28 ++-- Marlin/src/gcode/bedlevel/abl/M421.cpp | 6 +- Marlin/src/gcode/bedlevel/mbl/G29.cpp | 18 +-- Marlin/src/gcode/bedlevel/mbl/M421.cpp | 6 +- Marlin/src/gcode/bedlevel/ubl/G29.cpp | 2 +- Marlin/src/gcode/bedlevel/ubl/M421.cpp | 4 +- Marlin/src/gcode/control/M17_M18_M84.cpp | 2 +- Marlin/src/gcode/motion/M290.cpp | 2 +- Marlin/src/lcd/HD44780/marlinui_HD44780.cpp | 16 +-- Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp | 8 +- Marlin/src/lcd/dogm/marlinui_DOGM.cpp | 10 +- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 132 +++++++++--------- Marlin/src/lcd/e3v2/marlinui/ui_common.cpp | 10 +- Marlin/src/lcd/e3v2/proui/dwin.cpp | 32 ++--- Marlin/src/lcd/e3v2/proui/meshviewer.cpp | 2 +- Marlin/src/lcd/e3v2/proui/ubl_tools.cpp | 65 ++++----- .../lcd/extui/dgus_reloaded/DGUSTxHandler.cpp | 4 +- Marlin/src/lcd/extui/ui_api.cpp | 6 +- Marlin/src/lcd/marlinui.cpp | 2 +- Marlin/src/lcd/menu/menu.cpp | 4 +- Marlin/src/lcd/menu/menu_bed_leveling.cpp | 4 +- Marlin/src/lcd/menu/menu_tune.cpp | 2 +- Marlin/src/lcd/menu/menu_ubl.cpp | 26 ++-- Marlin/src/lcd/tft/touch.cpp | 4 +- Marlin/src/lcd/tft/ui_1024x600.cpp | 14 +- Marlin/src/lcd/tft/ui_320x240.cpp | 6 +- Marlin/src/lcd/tft/ui_480x320.cpp | 6 +- Marlin/src/module/motion.cpp | 12 +- Marlin/src/module/planner.cpp | 32 ++--- Marlin/src/module/settings.cpp | 89 ++++++------ 47 files changed, 389 insertions(+), 433 deletions(-) diff --git a/Marlin/src/HAL/AVR/inc/SanityCheck.h b/Marlin/src/HAL/AVR/inc/SanityCheck.h index 7936de8b9903..1c1d8d441351 100644 --- a/Marlin/src/HAL/AVR/inc/SanityCheck.h +++ b/Marlin/src/HAL/AVR/inc/SanityCheck.h @@ -37,16 +37,16 @@ || X_ENA_PIN == N || Y_ENA_PIN == N || Z_ENA_PIN == N \ ) #if CONF_SERIAL_IS(0) // D0-D1. No known conflicts. -#endif +#endif #if CONF_SERIAL_IS(1) && (CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19)) #error "Serial Port 1 pin D18 and/or D19 conflicts with another pin on the board." -#endif +#endif #if CONF_SERIAL_IS(2) && (CHECK_SERIAL_PIN(16) || CHECK_SERIAL_PIN(17)) #error "Serial Port 2 pin D16 and/or D17 conflicts with another pin on the board." #endif #if CONF_SERIAL_IS(3) && (CHECK_SERIAL_PIN(14) || CHECK_SERIAL_PIN(15)) #error "Serial Port 3 pin D14 and/or D15 conflicts with another pin on the board." -#endif +#endif #undef CHECK_SERIAL_PIN /** diff --git a/Marlin/src/HAL/DUE/inc/SanityCheck.h b/Marlin/src/HAL/DUE/inc/SanityCheck.h index dd37a7bde183..13484f7029d1 100644 --- a/Marlin/src/HAL/DUE/inc/SanityCheck.h +++ b/Marlin/src/HAL/DUE/inc/SanityCheck.h @@ -37,16 +37,16 @@ || X_ENA_PIN == N || Y_ENA_PIN == N || Z_ENA_PIN == N \ ) #if CONF_SERIAL_IS(0) // D0-D1. No known conflicts. -#endif +#endif #if CONF_SERIAL_IS(1) && (CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19)) #error "Serial Port 1 pin D18 and/or D19 conflicts with another pin on the board." -#endif +#endif #if CONF_SERIAL_IS(2) && (CHECK_SERIAL_PIN(16) || CHECK_SERIAL_PIN(17)) #error "Serial Port 2 pin D16 and/or D17 conflicts with another pin on the board." #endif #if CONF_SERIAL_IS(3) && (CHECK_SERIAL_PIN(14) || CHECK_SERIAL_PIN(15)) #error "Serial Port 3 pin D14 and/or D15 conflicts with another pin on the board." -#endif +#endif #undef CHECK_SERIAL_PIN /** diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 748d3d03cf91..59c76b6c2dae 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -448,7 +448,7 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) { TERN_(DISABLE_INACTIVE_W, stepper.disable_axis(W_AXIS)); TERN_(DISABLE_INACTIVE_E, stepper.disable_e_steppers()); - TERN_(AUTO_BED_LEVELING_UBL, ubl.steppers_were_disabled()); + TERN_(AUTO_BED_LEVELING_UBL, bedlevel.steppers_were_disabled()); } } else diff --git a/Marlin/src/core/utility.cpp b/Marlin/src/core/utility.cpp index 658ed6cd81a5..bba2f0a986a1 100644 --- a/Marlin/src/core/utility.cpp +++ b/Marlin/src/core/utility.cpp @@ -132,10 +132,10 @@ void safe_delay(millis_t ms) { #else #if ENABLED(AUTO_BED_LEVELING_UBL) SERIAL_ECHOPGM("UBL Adjustment Z"); - const float rz = ubl.get_z_correction(current_position); + const float rz = bedlevel.get_z_correction(current_position); #elif ENABLED(AUTO_BED_LEVELING_BILINEAR) SERIAL_ECHOPGM("ABL Adjustment Z"); - const float rz = bbl.get_z_correction(current_position); + const float rz = bedlevel.get_z_correction(current_position); #endif SERIAL_ECHO(ftostr43sign(rz, '+')); #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) @@ -156,11 +156,11 @@ void safe_delay(millis_t ms) { SERIAL_ECHOPGM("Mesh Bed Leveling"); if (planner.leveling_active) { SERIAL_ECHOLNPGM(" (enabled)"); - SERIAL_ECHOPGM("MBL Adjustment Z", ftostr43sign(mbl.get_z(current_position), '+')); + SERIAL_ECHOPGM("MBL Adjustment Z", ftostr43sign(bedlevel.get_z(current_position), '+')); #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) if (planner.z_fade_height) { SERIAL_ECHOPGM(" (", ftostr43sign( - mbl.get_z(current_position, planner.fade_scaling_factor_for_z(current_position.z)), '+' + bedlevel.get_z(current_position, planner.fade_scaling_factor_for_z(current_position.z)), '+' )); SERIAL_CHAR(')'); } diff --git a/Marlin/src/feature/bedlevel/abl/bbl.cpp b/Marlin/src/feature/bedlevel/abl/bbl.cpp index 9dcd66912893..be0e862cc16a 100644 --- a/Marlin/src/feature/bedlevel/abl/bbl.cpp +++ b/Marlin/src/feature/bedlevel/abl/bbl.cpp @@ -35,7 +35,7 @@ #include "../../../lcd/extui/ui_api.h" #endif -LevelingBilinear bbl; +LevelingBilinear bedlevel; xy_pos_t LevelingBilinear::grid_spacing, LevelingBilinear::grid_start; @@ -258,8 +258,8 @@ void LevelingBilinear::print_leveling_grid(const bed_mesh_t* _z_values /*= NULL* ); } } -#endif // ABL_BILINEAR_SUBDIVISION +#endif // ABL_BILINEAR_SUBDIVISION // Refresh after other values have been updated void LevelingBilinear::refresh_bed_level() { diff --git a/Marlin/src/feature/bedlevel/abl/bbl.h b/Marlin/src/feature/bedlevel/abl/bbl.h index fbdb22cd00c9..c2be4fee821c 100644 --- a/Marlin/src/feature/bedlevel/abl/bbl.h +++ b/Marlin/src/feature/bedlevel/abl/bbl.h @@ -24,10 +24,12 @@ #include "../../../inc/MarlinConfigPre.h" class LevelingBilinear { -private: +public: + static bed_mesh_t z_values; static xy_pos_t grid_spacing, grid_start; + +private: static xy_float_t grid_factor; - static bed_mesh_t z_values; static xy_pos_t cached_rel; static xy_int8_t cached_g; @@ -54,20 +56,15 @@ class LevelingBilinear { static void print_leveling_grid(const bed_mesh_t* _z_values = NULL); static void refresh_bed_level(); static bool has_mesh() { return !!grid_spacing.x; } - static bed_mesh_t& get_z_values() { return z_values; } - static const xy_pos_t& get_grid_spacing() { return grid_spacing; } - static const xy_pos_t& get_grid_start() { return grid_start; } - static float get_mesh_x(int16_t i) { return grid_start.x + i * grid_spacing.x; } - static float get_mesh_y(int16_t j) { return grid_start.y + j * grid_spacing.y; } + static bool mesh_is_valid() { return has_mesh(); } + static float get_mesh_x(const uint8_t i) { return grid_start.x + i * grid_spacing.x; } + static float get_mesh_y(const uint8_t j) { return grid_start.y + j * grid_spacing.y; } static float get_z_correction(const xy_pos_t &raw); + static constexpr float get_z_offset() { return 0.0f; } #if IS_CARTESIAN && DISABLED(SEGMENT_LEVELED_MOVES) static void line_to_destination(const_feedRate_t scaled_fr_mm_s, uint16_t x_splits=0xFFFF, uint16_t y_splits=0xFFFF); #endif }; -extern LevelingBilinear bbl; - -#define _GET_MESH_X(I) bbl.get_mesh_x(I) -#define _GET_MESH_Y(J) bbl.get_mesh_y(J) -#define Z_VALUES_ARR bbl.get_z_values() +extern LevelingBilinear bedlevel; diff --git a/Marlin/src/feature/bedlevel/bedlevel.cpp b/Marlin/src/feature/bedlevel/bedlevel.cpp index 2405905d4e65..f9d17a69a13f 100644 --- a/Marlin/src/feature/bedlevel/bedlevel.cpp +++ b/Marlin/src/feature/bedlevel/bedlevel.cpp @@ -47,14 +47,11 @@ #endif bool leveling_is_valid() { - return TERN1(MESH_BED_LEVELING, mbl.has_mesh()) - && TERN1(AUTO_BED_LEVELING_BILINEAR, bbl.has_mesh()) - && TERN1(AUTO_BED_LEVELING_UBL, ubl.mesh_is_valid()); + return TERN1(HAS_MESH, bedlevel.mesh_is_valid()); } /** - * Turn bed leveling on or off, fixing the current - * position as-needed. + * Turn bed leveling on or off, correcting the current position. * * Disable: Current position = physical position * Enable: Current position = "unleveled" physical position @@ -65,24 +62,31 @@ void set_bed_leveling_enabled(const bool enable/*=true*/) { if (can_change && enable != planner.leveling_active) { + auto _report_leveling = []{ + if (DEBUGGING(LEVELING)) { + if (planner.leveling_active) + DEBUG_POS("Leveling ON", current_position); + else + DEBUG_POS("Leveling OFF", current_position); + } + }; + + _report_leveling(); planner.synchronize(); if (planner.leveling_active) { // leveling from on to off - if (DEBUGGING(LEVELING)) DEBUG_POS("Leveling ON", current_position); // change unleveled current_position to physical current_position without moving steppers. planner.apply_leveling(current_position); planner.leveling_active = false; // disable only AFTER calling apply_leveling - if (DEBUGGING(LEVELING)) DEBUG_POS("...Now OFF", current_position); } else { // leveling from off to on - if (DEBUGGING(LEVELING)) DEBUG_POS("Leveling OFF", current_position); planner.leveling_active = true; // enable BEFORE calling unapply_leveling, otherwise ignored // change physical current_position to unleveled current_position without moving steppers. planner.unapply_leveling(current_position); - if (DEBUGGING(LEVELING)) DEBUG_POS("...Now ON", current_position); } sync_plan_position(); + _report_leveling(); } } @@ -116,18 +120,9 @@ TemporaryBedLevelingState::TemporaryBedLevelingState(const bool enable) : saved( */ void reset_bed_level() { if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("reset_bed_level"); - #if ENABLED(AUTO_BED_LEVELING_UBL) - ubl.reset(); - #else - set_bed_leveling_enabled(false); - #if ENABLED(MESH_BED_LEVELING) - mbl.reset(); - #elif ENABLED(AUTO_BED_LEVELING_BILINEAR) - bbl.reset(); - #elif ABL_PLANAR - planner.bed_level_matrix.set_to_identity(); - #endif - #endif + IF_DISABLED(AUTO_BED_LEVELING_UBL, set_bed_leveling_enabled(false)); + TERN_(HAS_MESH, bedlevel.reset()); + TERN_(ABL_PLANAR, planner.bed_level_matrix.set_to_identity()); } #if EITHER(AUTO_BED_LEVELING_BILINEAR, MESH_BED_LEVELING) diff --git a/Marlin/src/feature/bedlevel/bedlevel.h b/Marlin/src/feature/bedlevel/bedlevel.h index f295da1d037a..aeafec10d6ab 100644 --- a/Marlin/src/feature/bedlevel/bedlevel.h +++ b/Marlin/src/feature/bedlevel/bedlevel.h @@ -69,9 +69,6 @@ class TemporaryBedLevelingState { #include "mbl/mesh_bed_leveling.h" #endif - #define Z_VALUES(X,Y) Z_VALUES_ARR[X][Y] - #define _GET_MESH_POS(M) { _GET_MESH_X(M.a), _GET_MESH_Y(M.b) } - #if EITHER(AUTO_BED_LEVELING_BILINEAR, MESH_BED_LEVELING) #include @@ -92,7 +89,7 @@ class TemporaryBedLevelingState { bool valid() const { return pos.x >= 0 && pos.y >= 0; } #if ENABLED(AUTO_BED_LEVELING_UBL) xy_pos_t meshpos() { - return { ubl.mesh_index_to_xpos(pos.x), ubl.mesh_index_to_ypos(pos.y) }; + return { bedlevel.get_mesh_x(pos.x), bedlevel.get_mesh_y(pos.y) }; } #endif operator xy_int8_t&() { return pos; } diff --git a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp index fbc3f2785e14..193cbbf7654a 100644 --- a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp +++ b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp @@ -32,7 +32,7 @@ #include "../../../lcd/extui/ui_api.h" #endif - mesh_bed_leveling mbl; + mesh_bed_leveling bedlevel; float mesh_bed_leveling::z_offset, mesh_bed_leveling::z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y], diff --git a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h index 06fae16c21e9..1a8e693e8180 100644 --- a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h +++ b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h @@ -34,9 +34,6 @@ enum MeshLevelingState : char { #define MESH_X_DIST (float(MESH_MAX_X - (MESH_MIN_X)) / (GRID_MAX_CELLS_X)) #define MESH_Y_DIST (float(MESH_MAX_Y - (MESH_MIN_Y)) / (GRID_MAX_CELLS_Y)) -#define _GET_MESH_X(I) mbl.index_to_xpos[I] -#define _GET_MESH_Y(J) mbl.index_to_ypos[J] -#define Z_VALUES_ARR mbl.z_values class mesh_bed_leveling { public: @@ -56,6 +53,8 @@ class mesh_bed_leveling { return false; } + static bool mesh_is_valid() { return has_mesh(); } + static void set_z(const int8_t px, const int8_t py, const_float_t z) { z_values[px][py] = z; } static void zigzag(const int8_t index, int8_t &px, int8_t &py) { @@ -70,6 +69,9 @@ class mesh_bed_leveling { set_z(px, py, z); } + static float get_mesh_x(const uint8_t i) { return index_to_xpos[i]; } + static float get_mesh_y(const uint8_t i) { return index_to_ypos[i]; } + static int8_t cell_index_x(const_float_t x) { int8_t cx = (x - (MESH_MIN_X)) * RECIPROCAL(MESH_X_DIST); return constrain(cx, 0, GRID_MAX_CELLS_X - 1); @@ -102,12 +104,9 @@ class mesh_bed_leveling { return z1 + delta_a * delta_z; } - static float get_z(const xy_pos_t &pos - OPTARG(ENABLE_LEVELING_FADE_HEIGHT, const_float_t factor=1.0f) - ) { - #if DISABLED(ENABLE_LEVELING_FADE_HEIGHT) - constexpr float factor = 1.0f; - #endif + static float get_z_offset() { return z_offset; } + + static float get_z_correction(const xy_pos_t &pos) { const xy_int8_t ind = cell_indexes(pos); const float x1 = index_to_xpos[ind.x], x2 = index_to_xpos[ind.x+1], y1 = index_to_xpos[ind.y], y2 = index_to_xpos[ind.y+1], @@ -115,7 +114,7 @@ class mesh_bed_leveling { z2 = calc_z0(pos.x, x1, z_values[ind.x][ind.y+1], x2, z_values[ind.x+1][ind.y+1]), zf = calc_z0(pos.y, y1, z1, y2, z2); - return z_offset + zf * factor; + return zf; } #if IS_CARTESIAN && DISABLED(SEGMENT_LEVELED_MOVES) @@ -123,4 +122,4 @@ class mesh_bed_leveling { #endif }; -extern mesh_bed_leveling mbl; +extern mesh_bed_leveling bedlevel; diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.cpp b/Marlin/src/feature/bedlevel/ubl/ubl.cpp index c162062f8609..2aa50be34d26 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl.cpp @@ -26,7 +26,7 @@ #include "../bedlevel.h" -unified_bed_leveling ubl; +unified_bed_leveling bedlevel; #include "../../../MarlinCore.h" #include "../../../gcode/gcode.h" diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.h b/Marlin/src/feature/bedlevel/ubl/ubl.h index 9dd964c46cfb..a7103d6e18c4 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.h +++ b/Marlin/src/feature/bedlevel/ubl/ubl.h @@ -215,7 +215,7 @@ class unified_bed_leveling { return _UBL_OUTER_Z_RAISE; } - const float xratio = (rx0 - mesh_index_to_xpos(x1_i)) * RECIPROCAL(MESH_X_DIST), + const float xratio = (rx0 - get_mesh_x(x1_i)) * RECIPROCAL(MESH_X_DIST), z1 = z_values[x1_i][yi]; return z1 + xratio * (z_values[_MIN(x1_i, (GRID_MAX_POINTS_X) - 2) + 1][yi] - z1); // Don't allow x1_i+1 to be past the end of the array @@ -238,7 +238,7 @@ class unified_bed_leveling { return _UBL_OUTER_Z_RAISE; } - const float yratio = (ry0 - mesh_index_to_ypos(y1_i)) * RECIPROCAL(MESH_Y_DIST), + const float yratio = (ry0 - get_mesh_y(y1_i)) * RECIPROCAL(MESH_Y_DIST), z1 = z_values[xi][y1_i]; return z1 + yratio * (z_values[xi][_MIN(y1_i, (GRID_MAX_POINTS_Y) - 2) + 1] - z1); // Don't allow y1_i+1 to be past the end of the array @@ -264,16 +264,17 @@ class unified_bed_leveling { return UBL_Z_RAISE_WHEN_OFF_MESH; #endif - const uint8_t mx = _MIN(cx, (GRID_MAX_POINTS_X) - 2) + 1, my = _MIN(cy, (GRID_MAX_POINTS_Y) - 2) + 1; - const float z1 = calc_z0(rx0, mesh_index_to_xpos(cx), z_values[cx][cy], mesh_index_to_xpos(cx + 1), z_values[mx][cy]); - const float z2 = calc_z0(rx0, mesh_index_to_xpos(cx), z_values[cx][my], mesh_index_to_xpos(cx + 1), z_values[mx][my]); - float z0 = calc_z0(ry0, mesh_index_to_ypos(cy), z1, mesh_index_to_ypos(cy + 1), z2); + const uint8_t mx = _MIN(cx, (GRID_MAX_POINTS_X) - 2) + 1, my = _MIN(cy, (GRID_MAX_POINTS_Y) - 2) + 1, + x0 = get_mesh_x(cx), x1 = get_mesh_x(cx + 1); + const float z1 = calc_z0(rx0, x0, z_values[cx][cy], x1, z_values[mx][cy]), + z2 = calc_z0(rx0, x0, z_values[cx][my], x1, z_values[mx][my]); + float z0 = calc_z0(ry0, get_mesh_y(cy), z1, get_mesh_y(cy + 1), z2); - if (isnan(z0)) { // if part of the Mesh is undefined, it will show up as NAN - z0 = 0.0; // in ubl.z_values[][] and propagate through the - // calculations. If our correction is NAN, we throw it out - // because part of the Mesh is undefined and we don't have the - // information we need to complete the height correction. + if (isnan(z0)) { // If part of the Mesh is undefined, it will show up as NAN + z0 = 0.0; // in z_values[][] and propagate through the calculations. + // If our correction is NAN, we throw it out because part of + // the Mesh is undefined and we don't have the information + // needed to complete the height correction. if (DEBUGGING(MESH_ADJUST)) DEBUG_ECHOLNPGM("??? Yikes! NAN in "); } @@ -287,10 +288,12 @@ class unified_bed_leveling { } static float get_z_correction(const xy_pos_t &pos) { return get_z_correction(pos.x, pos.y); } - static float mesh_index_to_xpos(const uint8_t i) { + static constexpr float get_z_offset() { return 0.0f; } + + static float get_mesh_x(const uint8_t i) { return i < (GRID_MAX_POINTS_X) ? pgm_read_float(&_mesh_index_to_xpos[i]) : MESH_MIN_X + i * (MESH_X_DIST); } - static float mesh_index_to_ypos(const uint8_t i) { + static float get_mesh_y(const uint8_t i) { return i < (GRID_MAX_POINTS_Y) ? pgm_read_float(&_mesh_index_to_ypos[i]) : MESH_MIN_Y + i * (MESH_Y_DIST); } @@ -307,11 +310,7 @@ class unified_bed_leveling { }; // class unified_bed_leveling -extern unified_bed_leveling ubl; - -#define _GET_MESH_X(I) ubl.mesh_index_to_xpos(I) -#define _GET_MESH_Y(J) ubl.mesh_index_to_ypos(J) -#define Z_VALUES_ARR ubl.z_values +extern unified_bed_leveling bedlevel; // Prevent debugging propagating to other files #include "../../../core/debug_out.h" diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index 278d982f70de..a02918ff297e 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -941,11 +941,7 @@ void set_message_with_feedback(FSTR_P const fstr) { // It doesn't matter if the probe can't reach the NAN location. This is a manual probe. if (!location.valid()) continue; - const xyz_pos_t ppos = { - mesh_index_to_xpos(lpos.x), - mesh_index_to_ypos(lpos.y), - z_clearance - }; + const xyz_pos_t ppos = { get_mesh_x(lpos.x), get_mesh_y(lpos.y), z_clearance }; if (!position_is_reachable(ppos)) break; // SHOULD NOT OCCUR (find_closest_mesh_point only returns reachable points) @@ -1040,11 +1036,7 @@ void set_message_with_feedback(FSTR_P const fstr) { done_flags.mark(lpos); // Mark this location as 'adjusted' so a new // location is used on the next loop - const xyz_pos_t raw = { - mesh_index_to_xpos(lpos.x), - mesh_index_to_ypos(lpos.y), - Z_CLEARANCE_BETWEEN_PROBES - }; + const xyz_pos_t raw = { get_mesh_x(lpos.x), get_mesh_y(lpos.y), Z_CLEARANCE_BETWEEN_PROBES }; if (!position_is_reachable(raw)) break; // SHOULD NOT OCCUR (find_closest_mesh_point_of_type only returns reachable) @@ -1277,7 +1269,7 @@ mesh_index_pair unified_bed_leveling::find_furthest_invalid_mesh_point() { if (!isnan(z_values[i][j])) continue; // Skip valid mesh points // Skip unreachable points - if (!probe.can_reach(mesh_index_to_xpos(i), mesh_index_to_ypos(j))) + if (!probe.can_reach(get_mesh_x(i), get_mesh_y(j))) continue; found_a_NAN = true; @@ -1329,11 +1321,11 @@ mesh_index_pair unified_bed_leveling::find_furthest_invalid_mesh_point() { static bool test_func(uint8_t i, uint8_t j, void *data) { find_closest_t *d = (find_closest_t*)data; - if ( d->type == CLOSEST || d->type == (isnan(ubl.z_values[i][j]) ? INVALID : REAL) + if ( d->type == CLOSEST || d->type == (isnan(bedlevel.z_values[i][j]) ? INVALID : REAL) || (d->type == SET_IN_BITMAP && !d->done_flags->marked(i, j)) ) { // Found a Mesh Point of the specified type! - const xy_pos_t mpos = { ubl.mesh_index_to_xpos(i), ubl.mesh_index_to_ypos(j) }; + const xy_pos_t mpos = { bedlevel.get_mesh_x(i), bedlevel.get_mesh_y(j) }; // If using the probe as the reference there are some unreachable locations. // Also for round beds, there are grid points outside the bed the nozzle can't reach. @@ -1377,7 +1369,7 @@ mesh_index_pair unified_bed_leveling::find_closest_mesh_point_of_type(const Mesh || (type == SET_IN_BITMAP && !done_flags->marked(i, j)) ) { // Found a Mesh Point of the specified type! - const xy_pos_t mpos = { mesh_index_to_xpos(i), mesh_index_to_ypos(j) }; + const xy_pos_t mpos = { get_mesh_x(i), get_mesh_y(j) }; // If using the probe as the reference there are some unreachable locations. // Also for round beds, there are grid points outside the bed the nozzle can't reach. @@ -1433,10 +1425,10 @@ typedef struct { uint8_t sx, ex, sy, ey; bool yfirst; } smart_fill_info; void unified_bed_leveling::smart_fill_mesh() { static const smart_fill_info - info0 PROGMEM = { 0, GRID_MAX_POINTS_X, 0, GRID_MAX_POINTS_Y - 2, false }, // Bottom of the mesh looking up - info1 PROGMEM = { 0, GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y - 1, 0, false }, // Top of the mesh looking down - info2 PROGMEM = { 0, GRID_MAX_POINTS_X - 2, 0, GRID_MAX_POINTS_Y, true }, // Left side of the mesh looking right - info3 PROGMEM = { GRID_MAX_POINTS_X - 1, 0, 0, GRID_MAX_POINTS_Y, true }; // Right side of the mesh looking left + info0 PROGMEM = { 0, GRID_MAX_POINTS_X, 0, (GRID_MAX_POINTS_Y) - 2, false }, // Bottom of the mesh looking up + info1 PROGMEM = { 0, GRID_MAX_POINTS_X, (GRID_MAX_POINTS_Y) - 1, 0, false }, // Top of the mesh looking down + info2 PROGMEM = { 0, (GRID_MAX_POINTS_X) - 2, 0, GRID_MAX_POINTS_Y, true }, // Left side of the mesh looking right + info3 PROGMEM = { (GRID_MAX_POINTS_X) - 1, 0, 0, GRID_MAX_POINTS_Y, true }; // Right side of the mesh looking left static const smart_fill_info * const info[] PROGMEM = { &info0, &info1, &info2, &info3 }; LOOP_L_N(i, COUNT(info)) { @@ -1625,9 +1617,7 @@ void unified_bed_leveling::smart_fill_mesh() { matrix_3x3 rotation = matrix_3x3::create_look_at(vector_3(lsf_results.A, lsf_results.B, 1)); GRID_LOOP(i, j) { - float mx = mesh_index_to_xpos(i), - my = mesh_index_to_ypos(j), - mz = z_values[i][j]; + float mx = get_mesh_x(i), my = get_mesh_y(j), mz = z_values[i][j]; if (DEBUGGING(LEVELING)) { DEBUG_ECHOPAIR_F("before rotation = [", mx, 7); @@ -1724,18 +1714,18 @@ void unified_bed_leveling::smart_fill_mesh() { xy_pos_t ppos; LOOP_L_N(ix, GRID_MAX_POINTS_X) { - ppos.x = mesh_index_to_xpos(ix); + ppos.x = get_mesh_x(ix); LOOP_L_N(iy, GRID_MAX_POINTS_Y) { - ppos.y = mesh_index_to_ypos(iy); + ppos.y = get_mesh_y(iy); if (isnan(z_values[ix][iy])) { // undefined mesh point at (ppos.x,ppos.y), compute weighted LSF from original valid mesh points. incremental_LSF_reset(&lsf_results); xy_pos_t rpos; LOOP_L_N(jx, GRID_MAX_POINTS_X) { - rpos.x = mesh_index_to_xpos(jx); + rpos.x = get_mesh_x(jx); LOOP_L_N(jy, GRID_MAX_POINTS_Y) { if (TEST(bitmap[jx], jy)) { - rpos.y = mesh_index_to_ypos(jy); + rpos.y = get_mesh_y(jy); const float rz = z_values[jx][jy], w = 1.0f + weight_scaled / (rpos - ppos).magnitude(); incremental_WLSF(&lsf_results, rpos, rz, w); @@ -1794,7 +1784,7 @@ void unified_bed_leveling::smart_fill_mesh() { SERIAL_ECHOPGM("X-Axis Mesh Points at: "); LOOP_L_N(i, GRID_MAX_POINTS_X) { - SERIAL_ECHO_F(LOGICAL_X_POSITION(mesh_index_to_xpos(i)), 3); + SERIAL_ECHO_F(LOGICAL_X_POSITION(get_mesh_x(i)), 3); SERIAL_ECHOPGM(" "); serial_delay(25); } @@ -1802,7 +1792,7 @@ void unified_bed_leveling::smart_fill_mesh() { SERIAL_ECHOPGM("Y-Axis Mesh Points at: "); LOOP_L_N(i, GRID_MAX_POINTS_Y) { - SERIAL_ECHO_F(LOGICAL_Y_POSITION(mesh_index_to_ypos(i)), 3); + SERIAL_ECHO_F(LOGICAL_Y_POSITION(get_mesh_y(i)), 3); SERIAL_ECHOPGM(" "); serial_delay(25); } diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp index 3da4ed9809f9..e6eec0de63fd 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp @@ -76,8 +76,8 @@ #endif // The distance is always MESH_X_DIST so multiply by the constant reciprocal. - const float xratio = (end.x - mesh_index_to_xpos(iend.x)) * RECIPROCAL(MESH_X_DIST), - yratio = (end.y - mesh_index_to_ypos(iend.y)) * RECIPROCAL(MESH_Y_DIST), + const float xratio = (end.x - get_mesh_x(iend.x)) * RECIPROCAL(MESH_X_DIST), + yratio = (end.y - get_mesh_y(iend.y)) * RECIPROCAL(MESH_Y_DIST), z1 = z_values[iend.x][iend.y ] + xratio * (z_values[iend.x + 1][iend.y ] - z_values[iend.x][iend.y ]), z2 = z_values[iend.x][iend.y + 1] + xratio * (z_values[iend.x + 1][iend.y + 1] - z_values[iend.x][iend.y + 1]); @@ -139,7 +139,7 @@ icell.y += ineg.y; // Line going down? Just go to the bottom. while (icell.y != iend.y + ineg.y) { icell.y += iadd.y; - const float next_mesh_line_y = mesh_index_to_ypos(icell.y); + const float next_mesh_line_y = get_mesh_y(icell.y); /** * Skip the calculations for an infinite slope. @@ -155,7 +155,7 @@ // Replace NAN corrections with 0.0 to prevent NAN propagation. if (isnan(z0)) z0 = 0.0; - dest.y = mesh_index_to_ypos(icell.y); + dest.y = get_mesh_y(icell.y); /** * Without this check, it's possible to generate a zero length move, as in the case where @@ -196,7 +196,7 @@ while (icell.x != iend.x + ineg.x) { icell.x += iadd.x; - dest.x = mesh_index_to_xpos(icell.x); + dest.x = get_mesh_x(icell.x); dest.y = ratio * dest.x + c; // Calculate Y at the next X mesh line float z0 = z_correction_for_y_on_vertical_mesh_line(dest.y, icell.x, icell.y) @@ -245,8 +245,8 @@ while (cnt) { - const float next_mesh_line_x = mesh_index_to_xpos(icell.x + iadd.x), - next_mesh_line_y = mesh_index_to_ypos(icell.y + iadd.y); + const float next_mesh_line_x = get_mesh_x(icell.x + iadd.x), + next_mesh_line_y = get_mesh_y(icell.y + iadd.y); dest.y = ratio * next_mesh_line_x + c; // Calculate Y at the next X mesh line dest.x = (next_mesh_line_y - c) / ratio; // Calculate X at the next Y mesh line @@ -423,7 +423,7 @@ if (isnan(z_x0y1)) z_x0y1 = 0; // in order to avoid isnan tests per cell, if (isnan(z_x1y1)) z_x1y1 = 0; // thus guessing zero for undefined points - const xy_pos_t pos = { mesh_index_to_xpos(icell.x), mesh_index_to_ypos(icell.y) }; + const xy_pos_t pos = { get_mesh_x(icell.x), get_mesh_y(icell.y) }; xy_pos_t cell = raw - pos; const float z_xmy0 = (z_x1y0 - z_x0y0) * RECIPROCAL(MESH_X_DIST), // z slope per x along y0 (lower left to lower right) @@ -450,10 +450,7 @@ if (--segments == 0) raw = destination; // if this is last segment, use destination for exact const float z_cxcy = (z_cxy0 + z_cxym * cell.y) // interpolated mesh z height along cell.x at cell.y - #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) - * fade_scaling_factor // apply fade factor to interpolated mesh height - #endif - ; + TERN_(ENABLE_LEVELING_FADE_HEIGHT, * fade_scaling_factor); // apply fade factor to interpolated height const float oldz = raw.z; raw.z += z_cxcy; planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, segment_xyz_mm OPTARG(SCARA_FEEDRATE_SCALING, inv_duration) ); diff --git a/Marlin/src/gcode/bedlevel/G26.cpp b/Marlin/src/gcode/bedlevel/G26.cpp index 6691d6c9ab55..21fa08fc107a 100644 --- a/Marlin/src/gcode/bedlevel/G26.cpp +++ b/Marlin/src/gcode/bedlevel/G26.cpp @@ -293,10 +293,10 @@ typedef struct { if (circle_flags.marked(p1.x, p1.y) && circle_flags.marked(p2.x, p2.y)) { xyz_pos_t s, e; - s.x = _GET_MESH_X(p1.x) + (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)) * dx; - e.x = _GET_MESH_X(p2.x) - (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)) * dx; - s.y = _GET_MESH_Y(p1.y) + (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)) * dy; - e.y = _GET_MESH_Y(p2.y) - (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)) * dy; + s.x = bedlevel.get_mesh_x(p1.x) + (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)) * dx; + e.x = bedlevel.get_mesh_x(p2.x) - (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)) * dx; + s.y = bedlevel.get_mesh_y(p1.y) + (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)) * dy; + e.y = bedlevel.get_mesh_y(p2.y) - (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)) * dy; s.z = e.z = layer_height; #if HAS_ENDSTOPS @@ -448,7 +448,7 @@ typedef struct { GRID_LOOP(i, j) { if (!circle_flags.marked(i, j)) { // We found a circle that needs to be printed - const xy_pos_t m = { _GET_MESH_X(i), _GET_MESH_Y(j) }; + const xy_pos_t m = { bedlevel.get_mesh_x(i), bedlevel.get_mesh_y(j) }; // Get the distance to this intersection float f = (pos - m).magnitude(); @@ -729,7 +729,7 @@ void GcodeSuite::G26() { if (location.valid()) { TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(location.pos, ExtUI::G26_POINT_START)); - const xy_pos_t circle = _GET_MESH_POS(location.pos); + const xy_pos_t circle = { bedlevel.get_mesh_x(location.pos.a), bedlevel.get_mesh_y(location.pos.b) }; // If this mesh location is outside the printable radius, skip it. if (!position_is_reachable(circle)) continue; @@ -738,8 +738,8 @@ void GcodeSuite::G26() { // which is always drawn counter-clockwise. const xy_int8_t st = location; const bool f = st.y == 0, - r = st.x >= GRID_MAX_POINTS_X - 1, - b = st.y >= GRID_MAX_POINTS_Y - 1; + r = st.x >= (GRID_MAX_POINTS_X) - 1, + b = st.y >= (GRID_MAX_POINTS_Y) - 1; #if ENABLED(ARC_SUPPORT) diff --git a/Marlin/src/gcode/bedlevel/G42.cpp b/Marlin/src/gcode/bedlevel/G42.cpp index a2896ed6c705..cb5ed9740604 100644 --- a/Marlin/src/gcode/bedlevel/G42.cpp +++ b/Marlin/src/gcode/bedlevel/G42.cpp @@ -48,8 +48,8 @@ void GcodeSuite::G42() { // Move to current_position, as modified by I, J, P parameters destination = current_position; - if (hasI) destination.x = _GET_MESH_X(ix); - if (hasJ) destination.y = _GET_MESH_Y(iy); + if (hasI) destination.x = bedlevel.get_mesh_x(ix); + if (hasJ) destination.y = bedlevel.get_mesh_y(iy); #if HAS_PROBE_XY_OFFSET if (parser.boolval('P')) { diff --git a/Marlin/src/gcode/bedlevel/M420.cpp b/Marlin/src/gcode/bedlevel/M420.cpp index c8325b1fc5c1..277f95b9ffe1 100644 --- a/Marlin/src/gcode/bedlevel/M420.cpp +++ b/Marlin/src/gcode/bedlevel/M420.cpp @@ -71,13 +71,13 @@ void GcodeSuite::M420() { start.set(x_min, y_min); spacing.set((x_max - x_min) / (GRID_MAX_CELLS_X), (y_max - y_min) / (GRID_MAX_CELLS_Y)); - bbl.set_grid(spacing, start); + bedlevel.set_grid(spacing, start); #endif GRID_LOOP(x, y) { - Z_VALUES(x, y) = 0.001 * random(-200, 200); - TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, Z_VALUES(x, y))); + bedlevel.z_values[x][y] = 0.001 * random(-200, 200); + TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, bedlevel.z_values[x][y])); } - TERN_(AUTO_BED_LEVELING_BILINEAR, bbl.refresh_bed_level()); + TERN_(AUTO_BED_LEVELING_BILINEAR, bedlevel.refresh_bed_level()); SERIAL_ECHOPGM("Simulated " STRINGIFY(GRID_MAX_POINTS_X) "x" STRINGIFY(GRID_MAX_POINTS_Y) " mesh "); SERIAL_ECHOPGM(" (", x_min); SERIAL_CHAR(','); SERIAL_ECHO(y_min); @@ -101,7 +101,7 @@ void GcodeSuite::M420() { set_bed_leveling_enabled(false); #if ENABLED(EEPROM_SETTINGS) - const int8_t storage_slot = parser.has_value() ? parser.value_int() : ubl.storage_slot; + const int8_t storage_slot = parser.has_value() ? parser.value_int() : bedlevel.storage_slot; const int16_t a = settings.calc_num_meshes(); if (!a) { @@ -116,7 +116,7 @@ void GcodeSuite::M420() { } settings.load_mesh(storage_slot); - ubl.storage_slot = storage_slot; + bedlevel.storage_slot = storage_slot; #else @@ -128,10 +128,10 @@ void GcodeSuite::M420() { // L or V display the map info if (parser.seen("LV")) { - ubl.display_map(parser.byteval('T')); + bedlevel.display_map(parser.byteval('T')); SERIAL_ECHOPGM("Mesh is "); - if (!ubl.mesh_is_valid()) SERIAL_ECHOPGM("in"); - SERIAL_ECHOLNPGM("valid\nStorage slot: ", ubl.storage_slot); + if (!bedlevel.mesh_is_valid()) SERIAL_ECHOPGM("in"); + SERIAL_ECHOLNPGM("valid\nStorage slot: ", bedlevel.storage_slot); } #endif // AUTO_BED_LEVELING_UBL @@ -148,7 +148,7 @@ void GcodeSuite::M420() { #if ENABLED(AUTO_BED_LEVELING_UBL) set_bed_leveling_enabled(false); - ubl.adjust_mesh_to_mean(true, cval); + bedlevel.adjust_mesh_to_mean(true, cval); #else @@ -156,7 +156,7 @@ void GcodeSuite::M420() { // Get the sum and average of all mesh values float mesh_sum = 0; - GRID_LOOP(x, y) mesh_sum += Z_VALUES(x, y); + GRID_LOOP(x, y) mesh_sum += bedlevel.z_values[x][y]; const float zmean = mesh_sum / float(GRID_MAX_POINTS); #else // midrange @@ -164,7 +164,7 @@ void GcodeSuite::M420() { // Find the low and high mesh values. float lo_val = 100, hi_val = -100; GRID_LOOP(x, y) { - const float z = Z_VALUES(x, y); + const float z = bedlevel.z_values[x][y]; NOMORE(lo_val, z); NOLESS(hi_val, z); } @@ -178,10 +178,10 @@ void GcodeSuite::M420() { set_bed_leveling_enabled(false); // Subtract the mean from all values GRID_LOOP(x, y) { - Z_VALUES(x, y) -= zmean; - TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, Z_VALUES(x, y))); + bedlevel.z_values[x][y] -= zmean; + TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, bedlevel.z_values[x][y])); } - TERN_(AUTO_BED_LEVELING_BILINEAR, bbl.refresh_bed_level()); + TERN_(AUTO_BED_LEVELING_BILINEAR, bedlevel.refresh_bed_level()); } #endif @@ -202,10 +202,10 @@ void GcodeSuite::M420() { #else if (leveling_is_valid()) { #if ENABLED(AUTO_BED_LEVELING_BILINEAR) - bbl.print_leveling_grid(); + bedlevel.print_leveling_grid(); #elif ENABLED(MESH_BED_LEVELING) SERIAL_ECHOLNPGM("Mesh Bed Level data:"); - mbl.report_mesh(); + bedlevel.report_mesh(); #endif } #endif diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 0d2abbfb35a7..8fac5e753ebe 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -313,8 +313,8 @@ G29_TYPE GcodeSuite::G29() { if (!isnan(rx) && !isnan(ry)) { // Get nearest i / j from rx / ry - i = (rx - bbl.get_grid_start().x) / bbl.get_grid_spacing().x + 0.5f; - j = (ry - bbl.get_grid_start().y) / bbl.get_grid_spacing().y + 0.5f; + i = (rx - bedlevel.grid_start.x) / bedlevel.grid_spacing.x + 0.5f; + j = (ry - bedlevel.grid_start.y) / bedlevel.grid_spacing.y + 0.5f; LIMIT(i, 0, (GRID_MAX_POINTS_X) - 1); LIMIT(j, 0, (GRID_MAX_POINTS_Y) - 1); } @@ -323,8 +323,8 @@ G29_TYPE GcodeSuite::G29() { if (WITHIN(i, 0, (GRID_MAX_POINTS_X) - 1) && WITHIN(j, 0, (GRID_MAX_POINTS_Y) - 1)) { set_bed_leveling_enabled(false); - Z_VALUES_ARR[i][j] = rz; - bbl.refresh_bed_level(); + bedlevel.z_values[i][j] = rz; + bedlevel.refresh_bed_level(); TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(i, j, rz)); set_bed_leveling_enabled(abl.reenable); if (abl.reenable) report_current_position(); @@ -499,7 +499,7 @@ G29_TYPE GcodeSuite::G29() { #if ENABLED(AUTO_BED_LEVELING_BILINEAR) if (!abl.dryrun - && (abl.gridSpacing != bbl.get_grid_spacing() || abl.probe_position_lf != bbl.get_grid_start()) + && (abl.gridSpacing != bedlevel.grid_spacing || abl.probe_position_lf != bedlevel.grid_start) ) { // Reset grid to 0.0 or "not probed". (Also disables ABL) reset_bed_level(); @@ -509,7 +509,7 @@ G29_TYPE GcodeSuite::G29() { } // Pre-populate local Z values from the stored mesh - TERN_(IS_KINEMATIC, COPY(abl.z_values, Z_VALUES_ARR)); + TERN_(IS_KINEMATIC, COPY(abl.z_values, bedlevel.z_values)); #endif // AUTO_BED_LEVELING_BILINEAR @@ -796,14 +796,14 @@ G29_TYPE GcodeSuite::G29() { #if ENABLED(AUTO_BED_LEVELING_BILINEAR) if (abl.dryrun) - bbl.print_leveling_grid(&abl.z_values); + bedlevel.print_leveling_grid(&abl.z_values); else { - bbl.set_grid(abl.gridSpacing, abl.probe_position_lf); - COPY(Z_VALUES_ARR, abl.z_values); - TERN_(IS_KINEMATIC, bbl.extrapolate_unprobed_bed_level()); - bbl.refresh_bed_level(); + bedlevel.set_grid(abl.gridSpacing, abl.probe_position_lf); + COPY(bedlevel.z_values, abl.z_values); + TERN_(IS_KINEMATIC, bedlevel.extrapolate_unprobed_bed_level()); + bedlevel.refresh_bed_level(); - bbl.print_leveling_grid(); + bedlevel.print_leveling_grid(); } #elif ENABLED(AUTO_BED_LEVELING_LINEAR) @@ -923,8 +923,8 @@ G29_TYPE GcodeSuite::G29() { // Unapply the offset because it is going to be immediately applied // and cause compensation movement in Z - const float fade_scaling_factor = TERN(ENABLE_LEVELING_FADE_HEIGHT, planner.fade_scaling_factor_for_z(current_position.z), 1); - current_position.z -= fade_scaling_factor * bbl.get_z_correction(current_position); + current_position.z -= bedlevel.get_z_correction(current_position) + TERN_(ENABLE_LEVELING_FADE_HEIGHT, * planner.fade_scaling_factor_for_z(current_position.z)); if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM(" corrected Z:", current_position.z); } diff --git a/Marlin/src/gcode/bedlevel/abl/M421.cpp b/Marlin/src/gcode/bedlevel/abl/M421.cpp index 0c12268cb109..3272ea1bd227 100644 --- a/Marlin/src/gcode/bedlevel/abl/M421.cpp +++ b/Marlin/src/gcode/bedlevel/abl/M421.cpp @@ -58,11 +58,11 @@ void GcodeSuite::M421() { sy = iy >= 0 ? iy : 0, ey = iy >= 0 ? iy : GRID_MAX_POINTS_Y - 1; LOOP_S_LE_N(x, sx, ex) { LOOP_S_LE_N(y, sy, ey) { - Z_VALUES_ARR[x][y] = zval + (hasQ ? Z_VALUES_ARR[x][y] : 0); - TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, Z_VALUES_ARR[x][y])); + bedlevel.z_values[x][y] = zval + (hasQ ? bedlevel.z_values[x][y] : 0); + TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, bedlevel.z_values[x][y])); } } - bbl.refresh_bed_level(); + bedlevel.refresh_bed_level(); } else SERIAL_ERROR_MSG(STR_ERR_MESH_XY); diff --git a/Marlin/src/gcode/bedlevel/mbl/G29.cpp b/Marlin/src/gcode/bedlevel/mbl/G29.cpp index e04073b122c9..b9440f78b2e9 100644 --- a/Marlin/src/gcode/bedlevel/mbl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/mbl/G29.cpp @@ -93,14 +93,14 @@ void GcodeSuite::G29() { SERIAL_ECHOPGM("Mesh Bed Leveling "); if (leveling_is_valid()) { serialprintln_onoff(planner.leveling_active); - mbl.report_mesh(); + bedlevel.report_mesh(); } else SERIAL_ECHOLNPGM("has no data."); break; case MeshStart: - mbl.reset(); + bedlevel.reset(); mbl_probe_index = 0; if (!ui.wait_for_move) { queue.inject(parser.seen_test('N') ? F("G28" TERN(CAN_SET_LEVELING_AFTER_G28, "L0", "") "\nG29S2") : F("G29S2")); @@ -165,7 +165,7 @@ void GcodeSuite::G29() { } else { // Save Z for the previous mesh position - mbl.set_zigzag_z(mbl_probe_index - 1, current_position.z); + bedlevel.set_zigzag_z(mbl_probe_index - 1, current_position.z); TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ix, iy, current_position.z)); TERN_(DWIN_LCD_PROUI, DWIN_MeshUpdate(_MIN(mbl_probe_index, GRID_MAX_POINTS), int(GRID_MAX_POINTS), current_position.z)); SET_SOFT_ENDSTOP_LOOSE(false); @@ -175,8 +175,8 @@ void GcodeSuite::G29() { // Disable software endstops to allow manual adjustment // If G29 is left hanging without completion they won't be re-enabled! SET_SOFT_ENDSTOP_LOOSE(true); - mbl.zigzag(mbl_probe_index++, ix, iy); - _manual_goto_xy({ mbl.index_to_xpos[ix], mbl.index_to_ypos[iy] }); + bedlevel.zigzag(mbl_probe_index++, ix, iy); + _manual_goto_xy({ bedlevel.index_to_xpos[ix], bedlevel.index_to_ypos[iy] }); } else { // Move to the after probing position @@ -232,9 +232,9 @@ void GcodeSuite::G29() { return echo_not_entered('J'); if (parser.seenval('Z')) { - mbl.z_values[ix][iy] = parser.value_linear_units(); - TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ix, iy, mbl.z_values[ix][iy])); - TERN_(DWIN_LCD_PROUI, DWIN_MeshUpdate(ix, iy, mbl.z_values[ix][iy])); + bedlevel.z_values[ix][iy] = parser.value_linear_units(); + TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ix, iy, bedlevel.z_values[ix][iy])); + TERN_(DWIN_LCD_PROUI, DWIN_MeshUpdate(ix, iy, bedlevel.z_values[ix][iy])); } else return echo_not_entered('Z'); @@ -242,7 +242,7 @@ void GcodeSuite::G29() { case MeshSetZOffset: if (parser.seenval('Z')) - mbl.z_offset = parser.value_linear_units(); + bedlevel.z_offset = parser.value_linear_units(); else return echo_not_entered('Z'); break; diff --git a/Marlin/src/gcode/bedlevel/mbl/M421.cpp b/Marlin/src/gcode/bedlevel/mbl/M421.cpp index 1368ab0bef98..e23683d55f34 100644 --- a/Marlin/src/gcode/bedlevel/mbl/M421.cpp +++ b/Marlin/src/gcode/bedlevel/mbl/M421.cpp @@ -43,9 +43,9 @@ */ void GcodeSuite::M421() { const bool hasX = parser.seen('X'), hasI = parser.seen('I'); - const int8_t ix = hasI ? parser.value_int() : hasX ? mbl.probe_index_x(RAW_X_POSITION(parser.value_linear_units())) : -1; + const int8_t ix = hasI ? parser.value_int() : hasX ? bedlevel.probe_index_x(RAW_X_POSITION(parser.value_linear_units())) : -1; const bool hasY = parser.seen('Y'), hasJ = parser.seen('J'); - const int8_t iy = hasJ ? parser.value_int() : hasY ? mbl.probe_index_y(RAW_Y_POSITION(parser.value_linear_units())) : -1; + const int8_t iy = hasJ ? parser.value_int() : hasY ? bedlevel.probe_index_y(RAW_Y_POSITION(parser.value_linear_units())) : -1; const bool hasZ = parser.seen('Z'), hasQ = !hasZ && parser.seen('Q'); if (int(hasI && hasJ) + int(hasX && hasY) != 1 || !(hasZ || hasQ)) @@ -53,7 +53,7 @@ void GcodeSuite::M421() { else if (ix < 0 || iy < 0) SERIAL_ERROR_MSG(STR_ERR_MESH_XY); else - mbl.set_z(ix, iy, parser.value_linear_units() + (hasQ ? mbl.z_values[ix][iy] : 0)); + bedlevel.set_z(ix, iy, parser.value_linear_units() + (hasQ ? bedlevel.z_values[ix][iy] : 0)); } #endif // MESH_BED_LEVELING diff --git a/Marlin/src/gcode/bedlevel/ubl/G29.cpp b/Marlin/src/gcode/bedlevel/ubl/G29.cpp index 932503d72b97..90deab3d2e3e 100644 --- a/Marlin/src/gcode/bedlevel/ubl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/ubl/G29.cpp @@ -39,7 +39,7 @@ void GcodeSuite::G29() { TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_PROBE)); - ubl.G29(); + bedlevel.G29(); TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE)); } diff --git a/Marlin/src/gcode/bedlevel/ubl/M421.cpp b/Marlin/src/gcode/bedlevel/ubl/M421.cpp index c11a20ebf33c..ff74f4c6f744 100644 --- a/Marlin/src/gcode/bedlevel/ubl/M421.cpp +++ b/Marlin/src/gcode/bedlevel/ubl/M421.cpp @@ -56,7 +56,7 @@ void GcodeSuite::M421() { hasZ = parser.seen('Z'), hasQ = !hasZ && parser.seen('Q'); - if (hasC) ij = ubl.find_closest_mesh_point_of_type(CLOSEST, current_position); + if (hasC) ij = bedlevel.find_closest_mesh_point_of_type(CLOSEST, current_position); // Test for bad parameter combinations if (int(hasC) + int(hasI && hasJ) != 1 || !(hasZ || hasQ || hasN)) @@ -66,7 +66,7 @@ void GcodeSuite::M421() { else if (!WITHIN(ij.x, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(ij.y, 0, GRID_MAX_POINTS_Y - 1)) SERIAL_ERROR_MSG(STR_ERR_MESH_XY); else { - float &zval = ubl.z_values[ij.x][ij.y]; // Altering this Mesh Point + float &zval = bedlevel.z_values[ij.x][ij.y]; // Altering this Mesh Point zval = hasN ? NAN : parser.value_linear_units() + (hasQ ? zval : 0); // N=NAN, Z=NEWVAL, or Q=ADDVAL TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ij.x, ij.y, zval)); // Ping ExtUI in case it's showing the mesh TERN_(DWIN_LCD_PROUI, DWIN_MeshUpdate(ij.x, ij.y, zval)); diff --git a/Marlin/src/gcode/control/M17_M18_M84.cpp b/Marlin/src/gcode/control/M17_M18_M84.cpp index a9beaa3f02cd..715f7f2a37af 100644 --- a/Marlin/src/gcode/control/M17_M18_M84.cpp +++ b/Marlin/src/gcode/control/M17_M18_M84.cpp @@ -233,6 +233,6 @@ void GcodeSuite::M18_M84() { else planner.finish_and_disable(); - TERN_(AUTO_BED_LEVELING_UBL, ubl.steppers_were_disabled()); + TERN_(AUTO_BED_LEVELING_UBL, bedlevel.steppers_were_disabled()); } } diff --git a/Marlin/src/gcode/motion/M290.cpp b/Marlin/src/gcode/motion/M290.cpp index 8185bf8f78b4..6f6afa3a551b 100644 --- a/Marlin/src/gcode/motion/M290.cpp +++ b/Marlin/src/gcode/motion/M290.cpp @@ -111,7 +111,7 @@ void GcodeSuite::M290() { #endif #if ENABLED(MESH_BED_LEVELING) - SERIAL_ECHOLNPGM("MBL Adjust Z", mbl.z_offset); + SERIAL_ECHOLNPGM("MBL Adjust Z", bedlevel.z_offset); #endif #if ENABLED(BABYSTEP_DISPLAY_TOTAL) diff --git a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp index 8b00b7ccdae0..6c6ff4737793 100644 --- a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp +++ b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp @@ -1281,9 +1281,9 @@ void MarlinUI::draw_status_screen() { * Show X and Y positions */ _XLABEL(_PLOT_X, 0); - lcd_put_u8str(ftostr52(LOGICAL_X_POSITION(ubl.mesh_index_to_xpos(x_plot)))); + lcd_put_u8str(ftostr52(LOGICAL_X_POSITION(bedlevel.get_mesh_x(x_plot)))); _YLABEL(_LCD_W_POS, 0); - lcd_put_u8str(ftostr52(LOGICAL_Y_POSITION(ubl.mesh_index_to_ypos(y_plot)))); + lcd_put_u8str(ftostr52(LOGICAL_Y_POSITION(bedlevel.get_mesh_y(y_plot)))); lcd_moveto(_PLOT_X, 0); @@ -1475,8 +1475,8 @@ void MarlinUI::draw_status_screen() { * Print Z values */ _ZLABEL(_LCD_W_POS, 1); - if (!isnan(ubl.z_values[x_plot][y_plot])) - lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot])); + if (!isnan(bedlevel.z_values[x_plot][y_plot])) + lcd_put_u8str(ftostr43sign(bedlevel.z_values[x_plot][y_plot])); else lcd_put_u8str(F(" -----")); @@ -1486,16 +1486,16 @@ void MarlinUI::draw_status_screen() { * Show all values at right of screen */ _XLABEL(_LCD_W_POS, 1); - lcd_put_u8str(ftostr52(LOGICAL_X_POSITION(ubl.mesh_index_to_xpos(x_plot)))); + lcd_put_u8str(ftostr52(LOGICAL_X_POSITION(bedlevel.get_mesh_x(x_plot)))); _YLABEL(_LCD_W_POS, 2); - lcd_put_u8str(ftostr52(LOGICAL_Y_POSITION(ubl.mesh_index_to_ypos(y_plot)))); + lcd_put_u8str(ftostr52(LOGICAL_Y_POSITION(bedlevel.get_mesh_y(y_plot)))); /** * Show the location value */ _ZLABEL(_LCD_W_POS, 3); - if (!isnan(ubl.z_values[x_plot][y_plot])) - lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot])); + if (!isnan(bedlevel.z_values[x_plot][y_plot])) + lcd_put_u8str(ftostr43sign(bedlevel.z_values[x_plot][y_plot])); else lcd_put_u8str(F(" -----")); diff --git a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp index cef5fdb17098..5e418e2fe3fd 100644 --- a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp +++ b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp @@ -1069,15 +1069,15 @@ void MarlinUI::draw_status_screen() { // Show all values lcd.setCursor(_LCD_W_POS, 1); lcd_put_u8str(F("X:")); - lcd.print(ftostr52(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot])))); + lcd.print(ftostr52(LOGICAL_X_POSITION(pgm_read_float(&bedlevel._mesh_index_to_xpos[x_plot])))); lcd.setCursor(_LCD_W_POS, 2); lcd_put_u8str(F("Y:")); - lcd.print(ftostr52(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot])))); + lcd.print(ftostr52(LOGICAL_Y_POSITION(pgm_read_float(&bedlevel._mesh_index_to_ypos[y_plot])))); // Show the location value lcd.setCursor(_LCD_W_POS, 3); lcd_put_u8str(F("Z:")); - if (!isnan(ubl.z_values[x_plot][y_plot])) - lcd.print(ftostr43sign(ubl.z_values[x_plot][y_plot])); + if (!isnan(bedlevel.z_values[x_plot][y_plot])) + lcd.print(ftostr43sign(bedlevel.z_values[x_plot][y_plot])); else lcd_put_u8str(F(" -----")); diff --git a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp index 19611f678d31..eacd3d0afb74 100644 --- a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp +++ b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp @@ -579,9 +579,9 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop u8g.setColorIndex(1); const u8g_uint_t sx = x_offset + pixels_per_x_mesh_pnt / 2; u8g_uint_t y = y_offset + pixels_per_y_mesh_pnt / 2; - for (uint8_t j = 0; j < GRID_MAX_POINTS_Y; j++, y += pixels_per_y_mesh_pnt) + for (uint8_t j = 0; j < (GRID_MAX_POINTS_Y); j++, y += pixels_per_y_mesh_pnt) if (PAGE_CONTAINS(y, y)) - for (uint8_t i = 0, x = sx; i < GRID_MAX_POINTS_X; i++, x += pixels_per_x_mesh_pnt) + for (uint8_t i = 0, x = sx; i < (GRID_MAX_POINTS_X); i++, x += pixels_per_x_mesh_pnt) u8g.drawBox(x, y, 1, 1); // Fill in the Specified Mesh Point @@ -601,7 +601,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop // Show X and Y positions at top of screen u8g.setColorIndex(1); if (PAGE_UNDER(7)) { - const xy_pos_t pos = { ubl.mesh_index_to_xpos(x_plot), ubl.mesh_index_to_ypos(y_plot) }, + const xy_pos_t pos = { bedlevel.get_mesh_x(x_plot), bedlevel.get_mesh_y(y_plot) }, lpos = pos.asLogical(); lcd_put_u8str_P(5, 7, X_LBL); lcd_put_u8str(ftostr52(lpos.x)); @@ -619,8 +619,8 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop // Show the location value lcd_put_u8str_P(74, LCD_PIXEL_HEIGHT, Z_LBL); - if (!isnan(ubl.z_values[x_plot][y_plot])) - lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot])); + if (!isnan(bedlevel.z_values[x_plot][y_plot])) + lcd_put_u8str(ftostr43sign(bedlevel.z_values[x_plot][y_plot])); else lcd_put_u8str(F(" -----")); } diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 9d6871fc2dda..e8d6abab0ca4 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -207,11 +207,9 @@ CrealityDWINClass CrealityDWIN; struct linear_fit_data lsf_results; incremental_LSF_reset(&lsf_results); GRID_LOOP(x, y) { - if (!isnan(Z_VALUES_ARR[x][y])) { - xy_pos_t rpos; - rpos.x = ubl.mesh_index_to_xpos(x); - rpos.y = ubl.mesh_index_to_ypos(y); - incremental_LSF(&lsf_results, rpos, Z_VALUES_ARR[x][y]); + if (!isnan(bedlevel.z_values[x][y])) { + xy_pos_t rpos = { bedlevel.get_mesh_x(x), bedlevel.get_mesh_y(y) }; + incremental_LSF(&lsf_results, rpos, bedlevel.z_values[x][y]); } } @@ -220,13 +218,13 @@ CrealityDWINClass CrealityDWIN; return true; } - ubl.set_all_mesh_points_to_value(0); + bedlevel.set_all_mesh_points_to_value(0); matrix_3x3 rotation = matrix_3x3::create_look_at(vector_3(lsf_results.A, lsf_results.B, 1)); GRID_LOOP(i, j) { - float mx = ubl.mesh_index_to_xpos(i), - my = ubl.mesh_index_to_ypos(j), - mz = Z_VALUES_ARR[i][j]; + float mx = bedlevel.get_mesh_x(i), + my = bedlevel.get_mesh_y(j), + mz = bedlevel.z_values[i][j]; if (DEBUGGING(LEVELING)) { DEBUG_ECHOPAIR_F("before rotation = [", mx, 7); @@ -250,7 +248,7 @@ CrealityDWINClass CrealityDWIN; DEBUG_DELAY(20); } - Z_VALUES_ARR[i][j] = mz - lsf_results.D; + bedlevel.z_values[i][j] = mz - lsf_results.D; } return false; } @@ -268,7 +266,7 @@ CrealityDWINClass CrealityDWIN; void manual_move(bool zmove=false) { if (zmove) { planner.synchronize(); - current_position.z = goto_mesh_value ? Z_VALUES_ARR[mesh_x][mesh_y] : Z_CLEARANCE_BETWEEN_PROBES; + current_position.z = goto_mesh_value ? bedlevel.z_values[mesh_x][mesh_y] : Z_CLEARANCE_BETWEEN_PROBES; planner.buffer_line(current_position, homing_feedrate(Z_AXIS), active_extruder); planner.synchronize(); } @@ -279,7 +277,7 @@ CrealityDWINClass CrealityDWIN; sprintf_P(cmd, PSTR("G42 F4000 I%i J%i"), mesh_x, mesh_y); gcode.process_subcommands_now(cmd); planner.synchronize(); - current_position.z = goto_mesh_value ? Z_VALUES_ARR[mesh_x][mesh_y] : Z_CLEARANCE_BETWEEN_PROBES; + current_position.z = goto_mesh_value ? bedlevel.z_values[mesh_x][mesh_y] : Z_CLEARANCE_BETWEEN_PROBES; planner.buffer_line(current_position, homing_feedrate(Z_AXIS), active_extruder); planner.synchronize(); CrealityDWIN.Redraw_Menu(); @@ -289,8 +287,8 @@ CrealityDWINClass CrealityDWIN; float get_max_value() { float max = __FLT_MIN__; GRID_LOOP(x, y) { - if (!isnan(Z_VALUES_ARR[x][y]) && Z_VALUES_ARR[x][y] > max) - max = Z_VALUES_ARR[x][y]; + if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] > max) + max = bedlevel.z_values[x][y]; } return max; } @@ -298,24 +296,24 @@ CrealityDWINClass CrealityDWIN; float get_min_value() { float min = __FLT_MAX__; GRID_LOOP(x, y) { - if (!isnan(Z_VALUES_ARR[x][y]) && Z_VALUES_ARR[x][y] < min) - min = Z_VALUES_ARR[x][y]; + if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] < min) + min = bedlevel.z_values[x][y]; } return min; } void Draw_Bed_Mesh(int16_t selected = -1, uint8_t gridline_width = 1, uint16_t padding_x = 8, uint16_t padding_y_top = 40 + 53 - 7) { drawing_mesh = true; - const uint16_t total_width_px = DWIN_WIDTH - padding_x - padding_x; - const uint16_t cell_width_px = total_width_px / GRID_MAX_POINTS_X; - const uint16_t cell_height_px = total_width_px / GRID_MAX_POINTS_Y; + const uint16_t total_width_px = DWIN_WIDTH - padding_x - padding_x, + cell_width_px = total_width_px / (GRID_MAX_POINTS_X), + cell_height_px = total_width_px / (GRID_MAX_POINTS_Y); const float v_max = abs(get_max_value()), v_min = abs(get_min_value()), range = _MAX(v_min, v_max); // Clear background from previous selection and select new square DWIN_Draw_Rectangle(1, Color_Bg_Black, _MAX(0, padding_x - gridline_width), _MAX(0, padding_y_top - gridline_width), padding_x + total_width_px, padding_y_top + total_width_px); if (selected >= 0) { - const auto selected_y = selected / GRID_MAX_POINTS_X; - const auto selected_x = selected - (GRID_MAX_POINTS_X * selected_y); + const auto selected_y = selected / (GRID_MAX_POINTS_X); + const auto selected_x = selected - (GRID_MAX_POINTS_X) * selected_y; const auto start_y_px = padding_y_top + selected_y * cell_height_px; const auto start_x_px = padding_x + selected_x * cell_width_px; DWIN_Draw_Rectangle(1, Color_White, _MAX(0, start_x_px - gridline_width), _MAX(0, start_y_px - gridline_width), start_x_px + cell_width_px, start_y_px + cell_height_px); @@ -329,11 +327,11 @@ CrealityDWINClass CrealityDWIN; const auto start_y_px = padding_y_top + (GRID_MAX_POINTS_Y - y - 1) * cell_height_px; const auto end_y_px = start_y_px + cell_height_px - 1 - gridline_width; DWIN_Draw_Rectangle(1, // RGB565 colors: http://www.barth-dev.de/online/rgb565-color-picker/ - isnan(Z_VALUES_ARR[x][y]) ? Color_Grey : ( // gray if undefined - (Z_VALUES_ARR[x][y] < 0 ? - (uint16_t)round(0x1F * -Z_VALUES_ARR[x][y] / (!viewer_asymmetric_range ? range : v_min)) << 11 : // red if mesh point value is negative - (uint16_t)round(0x3F * Z_VALUES_ARR[x][y] / (!viewer_asymmetric_range ? range : v_max)) << 5) | // green if mesh point value is positive - _MIN(0x1F, (((uint8_t)abs(Z_VALUES_ARR[x][y]) / 10) * 4))), // + blue stepping for every mm + isnan(bedlevel.z_values[x][y]) ? Color_Grey : ( // gray if undefined + (bedlevel.z_values[x][y] < 0 ? + (uint16_t)round(0x1F * -bedlevel.z_values[x][y] / (!viewer_asymmetric_range ? range : v_min)) << 11 : // red if mesh point value is negative + (uint16_t)round(0x3F * bedlevel.z_values[x][y] / (!viewer_asymmetric_range ? range : v_max)) << 5) | // green if mesh point value is positive + _MIN(0x1F, (((uint8_t)abs(bedlevel.z_values[x][y]) / 10) * 4))), // + blue stepping for every mm start_x_px, start_y_px, end_x_px, end_y_px ); @@ -343,14 +341,14 @@ CrealityDWINClass CrealityDWIN; // Draw value text on if (viewer_print_value) { int8_t offset_x, offset_y = cell_height_px / 2 - 6; - if (isnan(Z_VALUES_ARR[x][y])) { // undefined + if (isnan(bedlevel.z_values[x][y])) { // undefined DWIN_Draw_String(false, font6x12, Color_White, Color_Bg_Blue, start_x_px + cell_width_px / 2 - 5, start_y_px + offset_y, F("X")); } else { // has value if (GRID_MAX_POINTS_X < 10) - sprintf_P(buf, PSTR("%s"), dtostrf(abs(Z_VALUES_ARR[x][y]), 1, 2, str_1)); + sprintf_P(buf, PSTR("%s"), dtostrf(abs(bedlevel.z_values[x][y]), 1, 2, str_1)); else - sprintf_P(buf, PSTR("%02i"), (uint16_t)(abs(Z_VALUES_ARR[x][y] - (int16_t)Z_VALUES_ARR[x][y]) * 100)); + sprintf_P(buf, PSTR("%02i"), (uint16_t)(abs(bedlevel.z_values[x][y] - (int16_t)bedlevel.z_values[x][y]) * 100)); offset_x = cell_width_px / 2 - 3 * (strlen(buf)) - 2; if (!(GRID_MAX_POINTS_X < 10)) DWIN_Draw_String(false, font6x12, Color_White, Color_Bg_Blue, start_x_px - 2 + offset_x, start_y_px + offset_y /*+ square / 2 - 6*/, F(".")); @@ -417,14 +415,14 @@ void CrealityDWINClass::Draw_Float(float value, uint8_t row, bool selected/*=fal } void CrealityDWINClass::Draw_Option(uint8_t value, const char * const * options, uint8_t row, bool selected/*=false*/, bool color/*=false*/) { - uint16_t bColor = (selected) ? Select_Color : Color_Bg_Black; - uint16_t tColor = (color) ? GetColor(value, Color_White, false) : Color_White; + uint16_t bColor = (selected) ? Select_Color : Color_Bg_Black, + tColor = (color) ? GetColor(value, Color_White, false) : Color_White; DWIN_Draw_Rectangle(1, bColor, 202, MBASE(row) + 14, 258, MBASE(row) - 2); DWIN_Draw_String(false, DWIN_FONT_MENU, tColor, bColor, 202, MBASE(row) - 1, options[value]); } uint16_t CrealityDWINClass::GetColor(uint8_t color, uint16_t original, bool light/*=false*/) { - switch (color){ + switch (color) { case Default: return original; break; @@ -2842,7 +2840,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ if (draw) Draw_Menu_Item(row, ICON_Tilt, F("Autotilt Current Mesh")); else { - if (ubl.storage_slot < 0) { + if (bedlevel.storage_slot < 0) { Popup_Handler(MeshSlot); break; } @@ -2914,7 +2912,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ } #endif #if ENABLED(AUTO_BED_LEVELING_UBL) - if (ubl.storage_slot < 0) { + if (bedlevel.storage_slot < 0) { Popup_Handler(MeshSlot); break; } @@ -2949,7 +2947,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ Draw_Menu_Item(row, ICON_Mesh, GET_TEXT(MSG_MESH_VIEW), nullptr, true); else { #if ENABLED(AUTO_BED_LEVELING_UBL) - if (ubl.storage_slot < 0) { + if (bedlevel.storage_slot < 0) { Popup_Handler(MeshSlot); break; } @@ -2967,16 +2965,16 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ case LEVELING_SLOT: if (draw) { Draw_Menu_Item(row, ICON_PrintSize, F("Mesh Slot")); - Draw_Float(ubl.storage_slot, row, false, 1); + Draw_Float(bedlevel.storage_slot, row, false, 1); } else - Modify_Value(ubl.storage_slot, 0, settings.calc_num_meshes() - 1, 1); + Modify_Value(bedlevel.storage_slot, 0, settings.calc_num_meshes() - 1, 1); break; case LEVELING_LOAD: if (draw) Draw_Menu_Item(row, ICON_ReadEEPROM, F("Load Mesh")); else { - if (ubl.storage_slot < 0) { + if (bedlevel.storage_slot < 0) { Popup_Handler(MeshSlot); break; } @@ -2989,7 +2987,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ if (draw) Draw_Menu_Item(row, ICON_WriteEEPROM, F("Save Mesh")); else { - if (ubl.storage_slot < 0) { + if (bedlevel.storage_slot < 0) { Popup_Handler(MeshSlot); break; } @@ -3098,13 +3096,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ if (draw) Draw_Menu_Item(row, ICON_Mesh, F("Zero Current Mesh")); else - ZERO(Z_VALUES_ARR); + ZERO(bedlevel.z_values); break; case LEVELING_SETTINGS_UNDEF: if (draw) Draw_Menu_Item(row, ICON_Mesh, F("Clear Current Mesh")); else - ubl.invalidate(); + bedlevel.invalidate(); break; #endif // AUTO_BED_LEVELING_UBL } @@ -3146,7 +3144,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ Draw_Menu_Item(row, ICON_Back, F("Back")); else { set_bed_leveling_enabled(level_state); - TERN_(AUTO_BED_LEVELING_BILINEAR, bbl.refresh_bed_level()); + TERN_(AUTO_BED_LEVELING_BILINEAR, bedlevel.refresh_bed_level()); Draw_Menu(Leveling, LEVELING_MANUAL); } break; @@ -3184,36 +3182,36 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ case LEVELING_M_OFFSET: if (draw) { Draw_Menu_Item(row, ICON_SetZOffset, F("Point Z Offset")); - Draw_Float(Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y], row, false, 100); + Draw_Float(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], row, false, 100); } else { - if (isnan(Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y])) - Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y] = 0; - Modify_Value(Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y], MIN_Z_OFFSET, MAX_Z_OFFSET, 100); + if (isnan(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y])) + bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] = 0; + Modify_Value(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], MIN_Z_OFFSET, MAX_Z_OFFSET, 100); } break; case LEVELING_M_UP: if (draw) Draw_Menu_Item(row, ICON_Axis, F("Microstep Up")); - else if (Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y] < MAX_Z_OFFSET) { - Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y] += 0.01; + else if (bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] < MAX_Z_OFFSET) { + bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] += 0.01; gcode.process_subcommands_now(F("M290 Z0.01")); planner.synchronize(); current_position.z += 0.01f; sync_plan_position(); - Draw_Float(Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y], row - 1, false, 100); + Draw_Float(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], row - 1, false, 100); } break; case LEVELING_M_DOWN: if (draw) Draw_Menu_Item(row, ICON_AxisD, F("Microstep Down")); - else if (Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y] > MIN_Z_OFFSET) { - Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y] -= 0.01; + else if (bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] > MIN_Z_OFFSET) { + bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] -= 0.01; gcode.process_subcommands_now(F("M290 Z-0.01")); planner.synchronize(); current_position.z -= 0.01f; sync_plan_position(); - Draw_Float(Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y], row - 2, false, 100); + Draw_Float(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], row - 2, false, 100); } break; case LEVELING_M_GOTO_VALUE: @@ -3305,36 +3303,36 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ case UBL_M_OFFSET: if (draw) { Draw_Menu_Item(row, ICON_SetZOffset, F("Point Z Offset")); - Draw_Float(Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y], row, false, 100); + Draw_Float(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], row, false, 100); } else { - if (isnan(Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y])) - Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y] = 0; - Modify_Value(Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y], MIN_Z_OFFSET, MAX_Z_OFFSET, 100); + if (isnan(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y])) + bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] = 0; + Modify_Value(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], MIN_Z_OFFSET, MAX_Z_OFFSET, 100); } break; case UBL_M_UP: if (draw) Draw_Menu_Item(row, ICON_Axis, F("Microstep Up")); - else if (Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y] < MAX_Z_OFFSET) { - Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y] += 0.01; + else if (bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] < MAX_Z_OFFSET) { + bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] += 0.01; gcode.process_subcommands_now(F("M290 Z0.01")); planner.synchronize(); current_position.z += 0.01f; sync_plan_position(); - Draw_Float(Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y], row - 1, false, 100); + Draw_Float(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], row - 1, false, 100); } break; case UBL_M_DOWN: if (draw) Draw_Menu_Item(row, ICON_Axis, F("Microstep Down")); - else if (Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y] > MIN_Z_OFFSET) { - Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y] -= 0.01; + else if (bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] > MIN_Z_OFFSET) { + bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] -= 0.01; gcode.process_subcommands_now(F("M290 Z-0.01")); planner.synchronize(); current_position.z -= 0.01f; sync_plan_position(); - Draw_Float(Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y], row - 2, false, 100); + Draw_Float(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], row - 2, false, 100); } break; } @@ -3418,13 +3416,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ case MMESH_OLD: uint8_t mesh_x, mesh_y; // 0,0 -> 1,0 -> 2,0 -> 2,1 -> 1,1 -> 0,1 -> 0,2 -> 1,2 -> 2,2 - mesh_y = (gridpoint - 1) / GRID_MAX_POINTS_Y; - mesh_x = (gridpoint - 1) % GRID_MAX_POINTS_X; + mesh_y = (gridpoint - 1) / (GRID_MAX_POINTS_Y); + mesh_x = (gridpoint - 1) % (GRID_MAX_POINTS_X); if (mesh_y % 2 == 1) - mesh_x = GRID_MAX_POINTS_X - mesh_x - 1; + mesh_x = (GRID_MAX_POINTS_X) - mesh_x - 1; - const float currval = Z_VALUES_ARR[mesh_x][mesh_y]; + const float currval = bedlevel.z_values[mesh_x][mesh_y]; if (draw) { Draw_Menu_Item(row, ICON_Zoffset, F("Goto Mesh Value")); @@ -4283,7 +4281,7 @@ void CrealityDWINClass::Popup_Control() { #if ENABLED(AUTO_BED_LEVELING_UBL) case MeshSlot: - if (selection == 0) ubl.storage_slot = 0; + if (selection == 0) bedlevel.storage_slot = 0; Redraw_Menu(true, true); break; #endif diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp index 1730e6832759..9cc634c3064e 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp @@ -516,8 +516,8 @@ void MarlinUI::draw_status_message(const bool blink) { // Display Mesh Point Locations const dwin_coord_t sx = x_offset + pixels_per_x_mesh_pnt / 2; dwin_coord_t y = y_offset + pixels_per_y_mesh_pnt / 2; - for (uint8_t j = 0; j < GRID_MAX_POINTS_Y; j++, y += pixels_per_y_mesh_pnt) - for (uint8_t i = 0, x = sx; i < GRID_MAX_POINTS_X; i++, x += pixels_per_x_mesh_pnt) + for (uint8_t j = 0; j < (GRID_MAX_POINTS_Y); j++, y += pixels_per_y_mesh_pnt) + for (uint8_t i = 0, x = sx; i < (GRID_MAX_POINTS_X); i++, x += pixels_per_x_mesh_pnt) DWIN_Draw_Point(Color_White, 1, 1, x, y); // Put Relevant Text on Display @@ -525,7 +525,7 @@ void MarlinUI::draw_status_message(const bool blink) { // Show X and Y positions at top of screen dwin_font.fg = Color_White; dwin_font.solid = true; - const xy_pos_t pos = { ubl.mesh_index_to_xpos(x_plot), ubl.mesh_index_to_ypos(y_plot) }, + const xy_pos_t pos = { bedlevel.get_mesh_x(x_plot), bedlevel.get_mesh_y(y_plot) }, lpos = pos.asLogical(); lcd_moveto( @@ -555,8 +555,8 @@ void MarlinUI::draw_status_message(const bool blink) { // Show the location value dwin_string.set(Z_LBL); - if (!isnan(Z_VALUES_ARR[x_plot][y_plot])) - dwin_string.add(ftostr43sign(Z_VALUES_ARR[x_plot][y_plot])); + if (!isnan(bedlevel.z_values[x_plot][y_plot])) + dwin_string.add(ftostr43sign(bedlevel.z_values[x_plot][y_plot])); else dwin_string.add(PSTR(" -----")); lcd_moveto( diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index cae29e5b28e9..122136c1a082 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -3611,7 +3611,7 @@ void Draw_Steps_Menu() { #define Z_OFFSET_MIN -3 #define Z_OFFSET_MAX 3 - void LiveEditMesh() { ((MenuItemPtrClass*)EditZValueItem)->value = &Z_VALUES_ARR[HMI_value.Select ? mesh_x : MenuData.Value][HMI_value.Select ? MenuData.Value : mesh_y]; EditZValueItem->redraw(); } + void LiveEditMesh() { ((MenuItemPtrClass*)EditZValueItem)->value = &bedlevel.z_values[HMI_value.Select ? mesh_x : MenuData.Value][HMI_value.Select ? MenuData.Value : mesh_y]; EditZValueItem->redraw(); } void ApplyEditMeshX() { mesh_x = MenuData.Value; } void SetEditMeshX() { HMI_value.Select = 0; SetIntOnClick(0, GRID_MAX_POINTS_X - 1, mesh_x, ApplyEditMeshX, LiveEditMesh); } void ApplyEditMeshY() { mesh_y = MenuData.Value; } @@ -3622,18 +3622,18 @@ void Draw_Steps_Menu() { #if ENABLED(AUTO_BED_LEVELING_UBL) - void ApplyUBLSlot() { ubl.storage_slot = MenuData.Value; } - void SetUBLSlot() { SetIntOnClick(0, settings.calc_num_meshes() - 1, ubl.storage_slot, ApplyUBLSlot); } + void ApplyUBLSlot() { bedlevel.storage_slot = MenuData.Value; } + void SetUBLSlot() { SetIntOnClick(0, settings.calc_num_meshes() - 1, bedlevel.storage_slot, ApplyUBLSlot); } void onDrawUBLSlot(MenuItemClass* menuitem, int8_t line) { - if (ubl.storage_slot < 0) ubl.storage_slot = 0; - onDrawIntMenu(menuitem, line, ubl.storage_slot); + if (bedlevel.storage_slot < 0) bedlevel.storage_slot = 0; + onDrawIntMenu(menuitem, line, bedlevel.storage_slot); } void ApplyUBLTiltGrid() { ubl_tools.tilt_grid = MenuData.Value; } void SetUBLTiltGrid() { SetIntOnClick(1, 3, ubl_tools.tilt_grid, ApplyUBLTiltGrid); } void UBLTiltMesh() { - if (ubl.storage_slot < 0) ubl.storage_slot = 0; + if (bedlevel.storage_slot < 0) bedlevel.storage_slot = 0; char buf[15]; if (ubl_tools.tilt_grid > 1) { sprintf_P(buf, PSTR("G28O\nG29 J%i"), ubl_tools.tilt_grid); @@ -3645,28 +3645,28 @@ void Draw_Steps_Menu() { } void UBLSmartFillMesh() { - ubl.smart_fill_mesh(); + bedlevel.smart_fill_mesh(); LCD_MESSAGE(MSG_UBL_MESH_FILLED); } bool UBLValidMesh() { const bool valid = ubl_tools.validate(); - if (!valid) ubl.invalidate(); + if (!valid) bedlevel.invalidate(); return valid; } void UBLSaveMesh() { - if (ubl.storage_slot < 0) ubl.storage_slot = 0; - settings.store_mesh(ubl.storage_slot); - ui.status_printf(0, GET_TEXT_F(MSG_MESH_SAVED), ubl.storage_slot); + if (bedlevel.storage_slot < 0) bedlevel.storage_slot = 0; + settings.store_mesh(bedlevel.storage_slot); + ui.status_printf(0, GET_TEXT_F(MSG_MESH_SAVED), bedlevel.storage_slot); DONE_BUZZ(true); } void UBLLoadMesh() { - if (ubl.storage_slot < 0) ubl.storage_slot = 0; - settings.load_mesh(ubl.storage_slot); + if (bedlevel.storage_slot < 0) bedlevel.storage_slot = 0; + settings.load_mesh(bedlevel.storage_slot); if (UBLValidMesh()) { - ui.status_printf(0, GET_TEXT_F(MSG_MESH_LOADED), ubl.storage_slot); + ui.status_printf(0, GET_TEXT_F(MSG_MESH_LOADED), bedlevel.storage_slot); DONE_BUZZ(true); } else { @@ -3691,7 +3691,7 @@ void Draw_Steps_Menu() { MENU_ITEM_F(ICON_Level, MSG_AUTO_MESH, onDrawMenuItem, AutoLev); #endif #if ENABLED(AUTO_BED_LEVELING_UBL) - EDIT_ITEM_F(ICON_UBLActive, MSG_UBL_STORAGE_SLOT, onDrawUBLSlot, SetUBLSlot, &ubl.storage_slot); + EDIT_ITEM_F(ICON_UBLActive, MSG_UBL_STORAGE_SLOT, onDrawUBLSlot, SetUBLSlot, &bedlevel.storage_slot); MENU_ITEM_F(ICON_UBLActive, MSG_UBL_SAVE_MESH, onDrawMenuItem, UBLSaveMesh); MENU_ITEM_F(ICON_UBLActive, MSG_UBL_LOAD_MESH, onDrawMenuItem, UBLLoadMesh); EDIT_ITEM_F(ICON_UBLActive, MSG_UBL_TILTING_GRID, onDrawPInt8Menu, SetUBLTiltGrid, &ubl_tools.tilt_grid); @@ -3714,7 +3714,7 @@ void Draw_Steps_Menu() { BACK_ITEM(Draw_MeshSet_Menu); EDIT_ITEM_F(ICON_UBLActive, MSG_MESH_X, onDrawPInt8Menu, SetEditMeshX, &mesh_x); EDIT_ITEM_F(ICON_UBLActive, MSG_MESH_Y, onDrawPInt8Menu, SetEditMeshY, &mesh_y); - EditZValueItem = EDIT_ITEM_F(ICON_UBLActive, MSG_MESH_EDIT_Z, onDrawPFloat3Menu, SetEditZValue, &Z_VALUES_ARR[mesh_x][mesh_y]); + EditZValueItem = EDIT_ITEM_F(ICON_UBLActive, MSG_MESH_EDIT_Z, onDrawPFloat3Menu, SetEditZValue, &bedlevel.z_values[mesh_x][mesh_y]); } UpdateMenu(EditMeshMenu); } diff --git a/Marlin/src/lcd/e3v2/proui/meshviewer.cpp b/Marlin/src/lcd/e3v2/proui/meshviewer.cpp index 5fe8b1bb104a..ab968c44b103 100644 --- a/Marlin/src/lcd/e3v2/proui/meshviewer.cpp +++ b/Marlin/src/lcd/e3v2/proui/meshviewer.cpp @@ -117,7 +117,7 @@ void MeshViewerClass::Draw(bool withsave /*= false*/) { ubl_tools.viewer_print_value = true; ubl_tools.Draw_Bed_Mesh(-1, 1, 8, 10 + TITLE_HEIGHT); #else - DrawMesh(Z_VALUES_ARR, GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y); + DrawMesh(bedlevel.z_values, GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y); #endif if (withsave) { DWINUI::Draw_Button(BTN_Save, 26, 305); diff --git a/Marlin/src/lcd/e3v2/proui/ubl_tools.cpp b/Marlin/src/lcd/e3v2/proui/ubl_tools.cpp index 1783ee18c523..96a7f52becc6 100644 --- a/Marlin/src/lcd/e3v2/proui/ubl_tools.cpp +++ b/Marlin/src/lcd/e3v2/proui/ubl_tools.cpp @@ -63,11 +63,9 @@ char cmd[MAX_CMD_SIZE+16], str_1[16], str_2[16], str_3[16]; struct linear_fit_data lsf_results; incremental_LSF_reset(&lsf_results); GRID_LOOP(x, y) { - if (!isnan(Z_VALUES_ARR[x][y])) { - xy_pos_t rpos; - rpos.x = ubl.mesh_index_to_xpos(x); - rpos.y = ubl.mesh_index_to_ypos(y); - incremental_LSF(&lsf_results, rpos, Z_VALUES_ARR[x][y]); + if (!isnan(bedlevel.z_values[x][y])) { + xy_pos_t rpos = { bedlevel.get_mesh_x(x), bedlevel.get_mesh_y(y) }; + incremental_LSF(&lsf_results, rpos, bedlevel.z_values[x][y]); } } @@ -76,13 +74,13 @@ char cmd[MAX_CMD_SIZE+16], str_1[16], str_2[16], str_3[16]; return true; } - ubl.set_all_mesh_points_to_value(0); + bedlevel.set_all_mesh_points_to_value(0); matrix_3x3 rotation = matrix_3x3::create_look_at(vector_3(lsf_results.A, lsf_results.B, 1)); GRID_LOOP(i, j) { - float mx = ubl.mesh_index_to_xpos(i), - my = ubl.mesh_index_to_ypos(j), - mz = Z_VALUES_ARR[i][j]; + float mx = bedlevel.get_mesh_x(i), + my = bedlevel.get_mesh_y(j), + mz = bedlevel.z_values[i][j]; if (DEBUGGING(LEVELING)) { DEBUG_ECHOPAIR_F("before rotation = [", mx, 7); @@ -106,7 +104,7 @@ char cmd[MAX_CMD_SIZE+16], str_1[16], str_2[16], str_3[16]; DEBUG_DELAY(20); } - Z_VALUES_ARR[i][j] = mz - lsf_results.D; + bedlevel.z_values[i][j] = mz - lsf_results.D; } return false; } @@ -124,7 +122,7 @@ char cmd[MAX_CMD_SIZE+16], str_1[16], str_2[16], str_3[16]; void UBLMeshToolsClass::manual_move(const uint8_t mesh_x, const uint8_t mesh_y, bool zmove/*=false*/) { if (zmove) { planner.synchronize(); - current_position.z = goto_mesh_value ? Z_VALUES_ARR[mesh_x][mesh_y] : Z_CLEARANCE_BETWEEN_PROBES; + current_position.z = goto_mesh_value ? bedlevel.z_values[mesh_x][mesh_y] : Z_CLEARANCE_BETWEEN_PROBES; planner.buffer_line(current_position, homing_feedrate(Z_AXIS), active_extruder); planner.synchronize(); } @@ -136,7 +134,7 @@ void UBLMeshToolsClass::manual_move(const uint8_t mesh_x, const uint8_t mesh_y, sprintf_P(cmd, PSTR("G42 F4000 I%i J%i"), mesh_x, mesh_y); gcode.process_subcommands_now(cmd); planner.synchronize(); - current_position.z = goto_mesh_value ? Z_VALUES_ARR[mesh_x][mesh_y] : Z_CLEARANCE_BETWEEN_PROBES; + current_position.z = goto_mesh_value ? bedlevel.z_values[mesh_x][mesh_y] : Z_CLEARANCE_BETWEEN_PROBES; planner.buffer_line(current_position, homing_feedrate(Z_AXIS), active_extruder); planner.synchronize(); HMI_ReturnScreen(); @@ -146,8 +144,8 @@ void UBLMeshToolsClass::manual_move(const uint8_t mesh_x, const uint8_t mesh_y, float UBLMeshToolsClass::get_max_value() { float max = __FLT_MIN__; GRID_LOOP(x, y) { - if (!isnan(Z_VALUES_ARR[x][y]) && Z_VALUES_ARR[x][y] > max) - max = Z_VALUES_ARR[x][y]; + if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] > max) + max = bedlevel.z_values[x][y]; } return max; } @@ -155,20 +153,19 @@ float UBLMeshToolsClass::get_max_value() { float UBLMeshToolsClass::get_min_value() { float min = __FLT_MAX__; GRID_LOOP(x, y) { - if (!isnan(Z_VALUES_ARR[x][y]) && Z_VALUES_ARR[x][y] < min) - min = Z_VALUES_ARR[x][y]; + if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] < min) + min = bedlevel.z_values[x][y]; } return min; } bool UBLMeshToolsClass::validate() { - float min = __FLT_MAX__; - float max = __FLT_MIN__; + float min = __FLT_MAX__, max = __FLT_MIN__; GRID_LOOP(x, y) { - if (isnan(Z_VALUES_ARR[x][y])) return false; - if (Z_VALUES_ARR[x][y] < min) min = Z_VALUES_ARR[x][y]; - if (Z_VALUES_ARR[x][y] > max) max = Z_VALUES_ARR[x][y]; + if (isnan(bedlevel.z_values[x][y])) return false; + if (bedlevel.z_values[x][y] < min) min = bedlevel.z_values[x][y]; + if (bedlevel.z_values[x][y] > max) max = bedlevel.z_values[x][y]; } return max <= UBL_Z_OFFSET_MAX && min >= UBL_Z_OFFSET_MIN; } @@ -177,15 +174,15 @@ bool UBLMeshToolsClass::validate() { void UBLMeshToolsClass::Draw_Bed_Mesh(int16_t selected /*= -1*/, uint8_t gridline_width /*= 1*/, uint16_t padding_x /*= 8*/, uint16_t padding_y_top /*= 40 + 53 - 7*/) { drawing_mesh = true; const uint16_t total_width_px = DWIN_WIDTH - padding_x - padding_x; - const uint16_t cell_width_px = total_width_px / GRID_MAX_POINTS_X; - const uint16_t cell_height_px = total_width_px / GRID_MAX_POINTS_Y; + const uint16_t cell_width_px = total_width_px / (GRID_MAX_POINTS_X); + const uint16_t cell_height_px = total_width_px / (GRID_MAX_POINTS_Y); const float v_max = abs(get_max_value()), v_min = abs(get_min_value()), range = _MAX(v_min, v_max); // Clear background from previous selection and select new square DWIN_Draw_Rectangle(1, Color_Bg_Black, _MAX(0, padding_x - gridline_width), _MAX(0, padding_y_top - gridline_width), padding_x + total_width_px, padding_y_top + total_width_px); if (selected >= 0) { - const auto selected_y = selected / GRID_MAX_POINTS_X; - const auto selected_x = selected - (GRID_MAX_POINTS_X * selected_y); + const auto selected_y = selected / (GRID_MAX_POINTS_X); + const auto selected_x = selected - (GRID_MAX_POINTS_X) * selected_y; const auto start_y_px = padding_y_top + selected_y * cell_height_px; const auto start_x_px = padding_x + selected_x * cell_width_px; DWIN_Draw_Rectangle(1, Color_White, _MAX(0, start_x_px - gridline_width), _MAX(0, start_y_px - gridline_width), start_x_px + cell_width_px, start_y_px + cell_height_px); @@ -196,14 +193,14 @@ bool UBLMeshToolsClass::validate() { GRID_LOOP(x, y) { const auto start_x_px = padding_x + x * cell_width_px; const auto end_x_px = start_x_px + cell_width_px - 1 - gridline_width; - const auto start_y_px = padding_y_top + (GRID_MAX_POINTS_Y - y - 1) * cell_height_px; + const auto start_y_px = padding_y_top + ((GRID_MAX_POINTS_Y) - y - 1) * cell_height_px; const auto end_y_px = start_y_px + cell_height_px - 1 - gridline_width; DWIN_Draw_Rectangle(1, // RGB565 colors: http://www.barth-dev.de/online/rgb565-color-picker/ - isnan(Z_VALUES_ARR[x][y]) ? Color_Grey : ( // gray if undefined - (Z_VALUES_ARR[x][y] < 0 ? - (uint16_t)round(0x1F * -Z_VALUES_ARR[x][y] / (!viewer_asymmetric_range ? range : v_min)) << 11 : // red if mesh point value is negative - (uint16_t)round(0x3F * Z_VALUES_ARR[x][y] / (!viewer_asymmetric_range ? range : v_max)) << 5) | // green if mesh point value is positive - _MIN(0x1F, (((uint8_t)abs(Z_VALUES_ARR[x][y]) / 10) * 4))), // + blue stepping for every mm + isnan(bedlevel.z_values[x][y]) ? Color_Grey : ( // gray if undefined + (bedlevel.z_values[x][y] < 0 ? + (uint16_t)round(0x1F * -bedlevel.z_values[x][y] / (!viewer_asymmetric_range ? range : v_min)) << 11 : // red if mesh point value is negative + (uint16_t)round(0x3F * bedlevel.z_values[x][y] / (!viewer_asymmetric_range ? range : v_max)) << 5) | // green if mesh point value is positive + _MIN(0x1F, (((uint8_t)abs(bedlevel.z_values[x][y]) / 10) * 4))), // + blue stepping for every mm start_x_px, start_y_px, end_x_px, end_y_px ); @@ -213,14 +210,14 @@ bool UBLMeshToolsClass::validate() { // Draw value text on if (viewer_print_value) { int8_t offset_x, offset_y = cell_height_px / 2 - 6; - if (isnan(Z_VALUES_ARR[x][y])) { // undefined + if (isnan(bedlevel.z_values[x][y])) { // undefined DWIN_Draw_String(false, font6x12, Color_White, Color_Bg_Blue, start_x_px + cell_width_px / 2 - 5, start_y_px + offset_y, F("X")); } else { // has value if (GRID_MAX_POINTS_X < 10) - sprintf_P(buf, PSTR("%s"), dtostrf(abs(Z_VALUES_ARR[x][y]), 1, 2, str_1)); + sprintf_P(buf, PSTR("%s"), dtostrf(abs(bedlevel.z_values[x][y]), 1, 2, str_1)); else - sprintf_P(buf, PSTR("%02i"), (uint16_t)(abs(Z_VALUES_ARR[x][y] - (int16_t)Z_VALUES_ARR[x][y]) * 100)); + sprintf_P(buf, PSTR("%02i"), (uint16_t)(abs(bedlevel.z_values[x][y] - (int16_t)bedlevel.z_values[x][y]) * 100)); offset_x = cell_width_px / 2 - 3 * (strlen(buf)) - 2; if (!(GRID_MAX_POINTS_X < 10)) DWIN_Draw_String(false, font6x12, Color_White, Color_Bg_Blue, start_x_px - 2 + offset_x, start_y_px + offset_y /*+ square / 2 - 6*/, F(".")); diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.cpp index 961b29ca2236..62df84e53d8f 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.cpp @@ -341,8 +341,8 @@ void DGUSTxHandler::ABLGrid(DGUS_VP &vp) { int16_t fixed; for (int i = 0; i < DGUS_LEVEL_GRID_SIZE; i++) { - point.x = i % GRID_MAX_POINTS_X; - point.y = i / GRID_MAX_POINTS_X; + point.x = i % (GRID_MAX_POINTS_X); + point.y = i / (GRID_MAX_POINTS_X); fixed = dgus_display.ToFixedPoint(ExtUI::getMeshPoint(point)); data[i] = Swap16(fixed); } diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index 5d25be938c8a..bba03fc6d43f 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -919,11 +919,11 @@ namespace ExtUI { #if HAS_MESH - bed_mesh_t& getMeshArray() { return Z_VALUES_ARR; } - float getMeshPoint(const xy_uint8_t &pos) { return Z_VALUES(pos.x, pos.y); } + bed_mesh_t& getMeshArray() { return bedlevel.z_values; } + float getMeshPoint(const xy_uint8_t &pos) { return bedlevel.z_values[pos.x][pos.y]; } void setMeshPoint(const xy_uint8_t &pos, const_float_t zoff) { if (WITHIN(pos.x, 0, (GRID_MAX_POINTS_X) - 1) && WITHIN(pos.y, 0, (GRID_MAX_POINTS_Y) - 1)) { - Z_VALUES(pos.x, pos.y) = zoff; + bedlevel.z_values[pos.x][pos.y] = zoff; TERN_(ABL_BILINEAR_SUBDIVISION, bed_level_virt_interpolate()); } } diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 955813c2fbf2..675e22b11097 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -863,7 +863,7 @@ void MarlinUI::init() { void MarlinUI::external_encoder() { if (external_control && encoderDiff) { - ubl.encoder_diff += encoderDiff; // Encoder for UBL G29 mesh editing + bedlevel.encoder_diff += encoderDiff; // Encoder for UBL G29 mesh editing encoderDiff = 0; // Hide encoder events from the screen handler refresh(LCDVIEW_REDRAW_NOW); // ...but keep the refresh. } diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp index d56bc9b5ff1b..2f075238e4a5 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -203,14 +203,14 @@ void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, co if (on_status_screen()) { defer_status_screen(false); clear_menu_history(); - TERN_(AUTO_BED_LEVELING_UBL, ubl.lcd_map_control = false); + TERN_(AUTO_BED_LEVELING_UBL, bedlevel.lcd_map_control = false); } clear_lcd(); // Re-initialize custom characters that may be re-used #if HAS_MARLINUI_HD44780 - if (TERN1(AUTO_BED_LEVELING_UBL, !ubl.lcd_map_control)) + if (TERN1(AUTO_BED_LEVELING_UBL, !bedlevel.lcd_map_control)) set_custom_characters(on_status_screen() ? CHARSET_INFO : CHARSET_MENU); #endif diff --git a/Marlin/src/lcd/menu/menu_bed_leveling.cpp b/Marlin/src/lcd/menu/menu_bed_leveling.cpp index f6add52f570c..866f709b8e33 100644 --- a/Marlin/src/lcd/menu/menu_bed_leveling.cpp +++ b/Marlin/src/lcd/menu/menu_bed_leveling.cpp @@ -214,7 +214,7 @@ BACK_ITEM(MSG_BED_LEVELING); EDIT_ITEM(uint8, MSG_MESH_X, &xind, 0, (GRID_MAX_POINTS_X) - 1); EDIT_ITEM(uint8, MSG_MESH_Y, &yind, 0, (GRID_MAX_POINTS_Y) - 1); - EDIT_ITEM_FAST(float43, MSG_MESH_EDIT_Z, &Z_VALUES(xind, yind), -(LCD_PROBE_Z_RANGE) * 0.5, (LCD_PROBE_Z_RANGE) * 0.5, refresh_planner); + EDIT_ITEM_FAST(float43, MSG_MESH_EDIT_Z, &bedlevel.z_values[xind][yind], -(LCD_PROBE_Z_RANGE) * 0.5, (LCD_PROBE_Z_RANGE) * 0.5, refresh_planner); END_MENU(); } @@ -281,7 +281,7 @@ void menu_bed_leveling() { #else #define LCD_Z_OFFSET_TYPE float42_52 // Values from -99.99 to 99.99 #endif - EDIT_ITEM(LCD_Z_OFFSET_TYPE, MSG_BED_Z, &mbl.z_offset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX); + EDIT_ITEM(LCD_Z_OFFSET_TYPE, MSG_BED_Z, &bedlevel.z_offset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX); #endif #if ENABLED(BABYSTEP_ZPROBE_OFFSET) diff --git a/Marlin/src/lcd/menu/menu_tune.cpp b/Marlin/src/lcd/menu/menu_tune.cpp index 7954edf5a127..40513f71ab7e 100644 --- a/Marlin/src/lcd/menu/menu_tune.cpp +++ b/Marlin/src/lcd/menu/menu_tune.cpp @@ -118,7 +118,7 @@ void menu_tune() { // Manual bed leveling, Bed Z: // #if BOTH(MESH_BED_LEVELING, LCD_BED_LEVELING) - EDIT_ITEM(float43, MSG_BED_Z, &mbl.z_offset, -1, 1); + EDIT_ITEM(float43, MSG_BED_Z, &bedlevel.z_offset, -1, 1); #endif // diff --git a/Marlin/src/lcd/menu/menu_ubl.cpp b/Marlin/src/lcd/menu/menu_ubl.cpp index d324e057be62..df60eaa6f5ae 100644 --- a/Marlin/src/lcd/menu/menu_ubl.cpp +++ b/Marlin/src/lcd/menu/menu_ubl.cpp @@ -58,7 +58,7 @@ inline float rounded_mesh_value() { /** * This screen displays the temporary mesh value and updates it based on encoder - * movement. While this screen is active ubl.fine_tune_mesh sits in a loop getting + * movement. While this screen is active bedlevel.fine_tune_mesh sits in a loop getting * the current value via ubl_mesh_value, moves the Z axis, and updates the mesh * value until the encoder button is pressed. * @@ -70,12 +70,12 @@ inline float rounded_mesh_value() { void _lcd_mesh_fine_tune(PGM_P const msg) { constexpr float mesh_edit_step = 1.0f / 200.0f; ui.defer_status_screen(); - if (ubl.encoder_diff) { + if (bedlevel.encoder_diff) { mesh_edit_accumulator += TERN(IS_TFTGLCD_PANEL, - ubl.encoder_diff * mesh_edit_step / ENCODER_PULSES_PER_STEP, - ubl.encoder_diff > 0 ? mesh_edit_step : -mesh_edit_step + bedlevel.encoder_diff * mesh_edit_step / ENCODER_PULSES_PER_STEP, + bedlevel.encoder_diff > 0 ? mesh_edit_step : -mesh_edit_step ); - ubl.encoder_diff = 0; + bedlevel.encoder_diff = 0; IF_DISABLED(IS_TFTGLCD_PANEL, ui.refresh(LCDVIEW_CALL_REDRAW_NEXT)); } TERN_(IS_TFTGLCD_PANEL, ui.refresh(LCDVIEW_CALL_REDRAW_NEXT)); @@ -89,7 +89,7 @@ void _lcd_mesh_fine_tune(PGM_P const msg) { } // -// Init mesh editing and go to the fine tuning screen (ubl.fine_tune_mesh) +// Init mesh editing and go to the fine tuning screen (bedlevel.fine_tune_mesh) // To capture encoder events UBL will also call ui.capture and ui.release. // void MarlinUI::ubl_mesh_edit_start(const_float_t initial) { @@ -99,7 +99,7 @@ void MarlinUI::ubl_mesh_edit_start(const_float_t initial) { } // -// Get the mesh value within a Z adjustment loop (ubl.fine_tune_mesh) +// Get the mesh value within a Z adjustment loop (bedlevel.fine_tune_mesh) // float MarlinUI::ubl_mesh_value() { return rounded_mesh_value(); } @@ -291,7 +291,7 @@ void _menu_ubl_fillin() { } void _lcd_ubl_invalidate() { - ubl.invalidate(); + bedlevel.invalidate(); SERIAL_ECHOLNPGM("Mesh invalidated."); } @@ -390,8 +390,8 @@ void _lcd_ubl_storage_mesh() { */ void _lcd_ubl_map_edit_cmd() { char ubl_lcd_gcode[50], str[10], str2[10]; - dtostrf(ubl.mesh_index_to_xpos(x_plot), 0, 2, str); - dtostrf(ubl.mesh_index_to_ypos(y_plot), 0, 2, str2); + dtostrf(bedlevel.get_mesh_x(x_plot), 0, 2, str); + dtostrf(bedlevel.get_mesh_y(y_plot), 0, 2, str2); snprintf_P(ubl_lcd_gcode, sizeof(ubl_lcd_gcode), PSTR("G29P4X%sY%sR%i"), str, str2, int(n_edit_pts)); queue.inject(ubl_lcd_gcode); } @@ -400,7 +400,7 @@ void _lcd_ubl_map_edit_cmd() { * UBL LCD Map Movement */ void ubl_map_move_to_xy() { - const xy_pos_t xy = { ubl.mesh_index_to_xpos(x_plot), ubl.mesh_index_to_ypos(y_plot) }; + const xy_pos_t xy = { bedlevel.get_mesh_x(x_plot), bedlevel.get_mesh_y(y_plot) }; // Some printers have unreachable areas in the mesh. Skip the move if unreachable. if (!position_is_reachable(xy)) return; @@ -459,7 +459,7 @@ void ubl_map_screen() { // Validate if needed #if IS_KINEMATIC - const xy_pos_t xy = { ubl.mesh_index_to_xpos(x), ubl.mesh_index_to_ypos(y) }; + const xy_pos_t xy = { bedlevel.get_mesh_x(x), bedlevel.get_mesh_y(y) }; if (position_is_reachable(xy)) break; // Found a valid point ui.encoderPosition += step_dir; // Test the next point #endif @@ -500,7 +500,7 @@ void _ubl_map_screen_homing() { ui.defer_status_screen(); _lcd_draw_homing(); if (all_axes_homed()) { - ubl.lcd_map_control = true; // Return to the map screen after editing Z + bedlevel.lcd_map_control = true; // Return to the map screen after editing Z ui.goto_screen(ubl_map_screen, grid_index(x_plot, y_plot)); // Pre-set the encoder value ui.manual_move.menu_scale = 0; // Immediate move ubl_map_move_to_xy(); // Move to current mesh point diff --git a/Marlin/src/lcd/tft/touch.cpp b/Marlin/src/lcd/tft/touch.cpp index a04715a2952d..57cd6e724e26 100644 --- a/Marlin/src/lcd/tft/touch.cpp +++ b/Marlin/src/lcd/tft/touch.cpp @@ -180,8 +180,8 @@ void Touch::touch(touch_control_t *control) { ui.refresh(); break; case SLIDER: hold(control); ui.encoderPosition = (x - control->x) * control->data / control->width; break; - case INCREASE: hold(control, repeat_delay - 5); TERN(AUTO_BED_LEVELING_UBL, ui.external_control ? ubl.encoder_diff++ : ui.encoderPosition++, ui.encoderPosition++); break; - case DECREASE: hold(control, repeat_delay - 5); TERN(AUTO_BED_LEVELING_UBL, ui.external_control ? ubl.encoder_diff-- : ui.encoderPosition--, ui.encoderPosition--); break; + case INCREASE: hold(control, repeat_delay - 5); TERN(AUTO_BED_LEVELING_UBL, ui.external_control ? bedlevel.encoder_diff++ : ui.encoderPosition++, ui.encoderPosition++); break; + case DECREASE: hold(control, repeat_delay - 5); TERN(AUTO_BED_LEVELING_UBL, ui.external_control ? bedlevel.encoder_diff-- : ui.encoderPosition--, ui.encoderPosition--); break; case HEATER: int8_t heater; heater = control->data; diff --git a/Marlin/src/lcd/tft/ui_1024x600.cpp b/Marlin/src/lcd/tft/ui_1024x600.cpp index 49c374d29b73..3fbb26b69ddf 100644 --- a/Marlin/src/lcd/tft/ui_1024x600.cpp +++ b/Marlin/src/lcd/tft/ui_1024x600.cpp @@ -501,14 +501,14 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const tft.set_background(COLOR_BACKGROUND); tft.add_rectangle(0, 0, GRID_WIDTH, GRID_HEIGHT, COLOR_WHITE); - for (uint16_t x = 0; x < GRID_MAX_POINTS_X ; x++) - for (uint16_t y = 0; y < GRID_MAX_POINTS_Y ; y++) - if (position_is_reachable({ ubl.mesh_index_to_xpos(x), ubl.mesh_index_to_ypos(y) })) - tft.add_bar(1 + (x * 2 + 1) * (GRID_WIDTH - 4) / GRID_MAX_POINTS_X / 2, GRID_HEIGHT - 3 - ((y * 2 + 1) * (GRID_HEIGHT - 4) / GRID_MAX_POINTS_Y / 2), 2, 2, COLOR_UBL); + for (uint16_t x = 0; x < (GRID_MAX_POINTS_X); x++) + for (uint16_t y = 0; y < (GRID_MAX_POINTS_Y); y++) + if (position_is_reachable({ bedlevel.get_mesh_x(x), bedlevel.get_mesh_y(y) })) + tft.add_bar(1 + (x * 2 + 1) * (GRID_WIDTH - 4) / (GRID_MAX_POINTS_X) / 2, GRID_HEIGHT - 3 - ((y * 2 + 1) * (GRID_HEIGHT - 4) / (GRID_MAX_POINTS_Y) / 2), 2, 2, COLOR_UBL); - tft.add_rectangle((x_plot * 2 + 1) * (GRID_WIDTH - 4) / GRID_MAX_POINTS_X / 2 - 1, GRID_HEIGHT - 5 - ((y_plot * 2 + 1) * (GRID_HEIGHT - 4) / GRID_MAX_POINTS_Y / 2), 6, 6, COLOR_UBL); + tft.add_rectangle((x_plot * 2 + 1) * (GRID_WIDTH - 4) / (GRID_MAX_POINTS_X) / 2 - 1, GRID_HEIGHT - 5 - ((y_plot * 2 + 1) * (GRID_HEIGHT - 4) / (GRID_MAX_POINTS_Y) / 2), 6, 6, COLOR_UBL); - const xy_pos_t pos = { ubl.mesh_index_to_xpos(x_plot), ubl.mesh_index_to_ypos(y_plot) }, + const xy_pos_t pos = { bedlevel.get_mesh_x(x_plot), bedlevel.get_mesh_y(y_plot) }, lpos = pos.asLogical(); tft.canvas(320, GRID_OFFSET_Y + (GRID_HEIGHT - MENU_ITEM_HEIGHT) / 2 - MENU_ITEM_HEIGHT, 120, MENU_ITEM_HEIGHT); @@ -531,7 +531,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const tft.set_background(COLOR_BACKGROUND); tft_string.set(Z_LBL); tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); - tft_string.set(isnan(ubl.z_values[x_plot][y_plot]) ? "-----" : ftostr43sign(ubl.z_values[x_plot][y_plot])); + tft_string.set(isnan(bedlevel.z_values[x_plot][y_plot]) ? "-----" : ftostr43sign(bedlevel.z_values[x_plot][y_plot])); tft_string.trim(); tft.add_text(120 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string); diff --git a/Marlin/src/lcd/tft/ui_320x240.cpp b/Marlin/src/lcd/tft/ui_320x240.cpp index 35f04fae64b8..b1a781fad10a 100644 --- a/Marlin/src/lcd/tft/ui_320x240.cpp +++ b/Marlin/src/lcd/tft/ui_320x240.cpp @@ -485,12 +485,12 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const for (uint16_t x = 0; x < (GRID_MAX_POINTS_X); x++) for (uint16_t y = 0; y < (GRID_MAX_POINTS_Y); y++) - if (position_is_reachable({ ubl.mesh_index_to_xpos(x), ubl.mesh_index_to_ypos(y) })) + if (position_is_reachable({ bedlevel.get_mesh_x(x), bedlevel.get_mesh_y(y) })) tft.add_bar(1 + (x * 2 + 1) * (GRID_WIDTH - 4) / (GRID_MAX_POINTS_X) / 2, GRID_HEIGHT - 3 - ((y * 2 + 1) * (GRID_HEIGHT - 4) / (GRID_MAX_POINTS_Y) / 2), 2, 2, COLOR_UBL); tft.add_rectangle((x_plot * 2 + 1) * (GRID_WIDTH - 4) / (GRID_MAX_POINTS_X) / 2 - 1, GRID_HEIGHT - 5 - ((y_plot * 2 + 1) * (GRID_HEIGHT - 4) / (GRID_MAX_POINTS_Y) / 2), 6, 6, COLOR_UBL); - const xy_pos_t pos = { ubl.mesh_index_to_xpos(x_plot), ubl.mesh_index_to_ypos(y_plot) }, + const xy_pos_t pos = { bedlevel.get_mesh_x(x_plot), bedlevel.get_mesh_y(y_plot) }, lpos = pos.asLogical(); tft.canvas(216, GRID_OFFSET_Y + (GRID_HEIGHT - MENU_ITEM_HEIGHT) / 2 - MENU_ITEM_HEIGHT, 96, MENU_ITEM_HEIGHT); @@ -513,7 +513,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const tft.set_background(COLOR_BACKGROUND); tft_string.set(Z_LBL); tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); - tft_string.set(isnan(ubl.z_values[x_plot][y_plot]) ? "-----" : ftostr43sign(ubl.z_values[x_plot][y_plot])); + tft_string.set(isnan(bedlevel.z_values[x_plot][y_plot]) ? "-----" : ftostr43sign(bedlevel.z_values[x_plot][y_plot])); tft_string.trim(); tft.add_text(96 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string); diff --git a/Marlin/src/lcd/tft/ui_480x320.cpp b/Marlin/src/lcd/tft/ui_480x320.cpp index 7952ba30cf9f..6f7327f1e8a2 100644 --- a/Marlin/src/lcd/tft/ui_480x320.cpp +++ b/Marlin/src/lcd/tft/ui_480x320.cpp @@ -490,12 +490,12 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const for (uint16_t x = 0; x < (GRID_MAX_POINTS_X); x++) for (uint16_t y = 0; y < (GRID_MAX_POINTS_Y); y++) - if (position_is_reachable({ ubl.mesh_index_to_xpos(x), ubl.mesh_index_to_ypos(y) })) + if (position_is_reachable({ bedlevel.get_mesh_x(x), bedlevel.get_mesh_y(y) })) tft.add_bar(1 + (x * 2 + 1) * (GRID_WIDTH - 4) / (GRID_MAX_POINTS_X) / 2, GRID_HEIGHT - 3 - ((y * 2 + 1) * (GRID_HEIGHT - 4) / (GRID_MAX_POINTS_Y) / 2), 2, 2, COLOR_UBL); tft.add_rectangle((x_plot * 2 + 1) * (GRID_WIDTH - 4) / (GRID_MAX_POINTS_X) / 2 - 1, GRID_HEIGHT - 5 - ((y_plot * 2 + 1) * (GRID_HEIGHT - 4) / (GRID_MAX_POINTS_Y) / 2), 6, 6, COLOR_UBL); - const xy_pos_t pos = { ubl.mesh_index_to_xpos(x_plot), ubl.mesh_index_to_ypos(y_plot) }, + const xy_pos_t pos = { bedlevel.get_mesh_x(x_plot), bedlevel.get_mesh_y(y_plot) }, lpos = pos.asLogical(); tft.canvas(320, GRID_OFFSET_Y + (GRID_HEIGHT - MENU_ITEM_HEIGHT) / 2 - MENU_ITEM_HEIGHT, 120, MENU_ITEM_HEIGHT); @@ -518,7 +518,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const tft.set_background(COLOR_BACKGROUND); tft_string.set(Z_LBL); tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); - tft_string.set(isnan(ubl.z_values[x_plot][y_plot]) ? "-----" : ftostr43sign(ubl.z_values[x_plot][y_plot])); + tft_string.set(isnan(bedlevel.z_values[x_plot][y_plot]) ? "-----" : ftostr43sign(bedlevel.z_values[x_plot][y_plot])); tft_string.trim(); tft.add_text(120 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string); diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index a07d8e22b436..e231a410058b 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -427,7 +427,7 @@ void line_to_current_position(const_feedRate_t fr_mm_s/*=feedrate_mm_s*/) { #if UBL_SEGMENTED // UBL segmented line will do Z-only moves in single segment - ubl.line_to_destination_segmented(scaled_fr_mm_s); + bedlevel.line_to_destination_segmented(scaled_fr_mm_s); #else if (current_position == destination) return; @@ -995,7 +995,7 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) { * small incremental moves for DELTA or SCARA. * * For Unified Bed Leveling (Delta or Segmented Cartesian) - * the ubl.line_to_destination_segmented method replaces this. + * the bedlevel.line_to_destination_segmented method replaces this. * * For Auto Bed Leveling (Bilinear) with SEGMENT_LEVELED_MOVES * this is replaced by segmented_line_to_destination below. @@ -1151,7 +1151,7 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) { #if HAS_MESH if (planner.leveling_active && planner.leveling_active_at_z(destination.z)) { #if ENABLED(AUTO_BED_LEVELING_UBL) - ubl.line_to_destination_cartesian(scaled_fr_mm_s, active_extruder); // UBL's motion routine needs to know about + bedlevel.line_to_destination_cartesian(scaled_fr_mm_s, active_extruder); // UBL's motion routine needs to know about return true; // all moves, including Z-only moves. #elif ENABLED(SEGMENT_LEVELED_MOVES) segmented_line_to_destination(scaled_fr_mm_s); @@ -1163,9 +1163,9 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) { */ if (xy_pos_t(current_position) != xy_pos_t(destination)) { #if ENABLED(MESH_BED_LEVELING) - mbl.line_to_destination(scaled_fr_mm_s); + bedlevel.line_to_destination(scaled_fr_mm_s); #elif ENABLED(AUTO_BED_LEVELING_BILINEAR) - bbl.line_to_destination(scaled_fr_mm_s); + bedlevel.line_to_destination(scaled_fr_mm_s); #endif return true; } @@ -1363,7 +1363,7 @@ void prepare_line_to_destination() { if ( #if UBL_SEGMENTED #if IS_KINEMATIC // UBL using Kinematic / Cartesian cases as a workaround for now. - ubl.line_to_destination_segmented(MMS_SCALED(feedrate_mm_s)) + bedlevel.line_to_destination_segmented(MMS_SCALED(feedrate_mm_s)) #else line_to_destination_cartesian() #endif diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 90424b55eeed..3a65c9591baa 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1587,19 +1587,12 @@ void Planner::check_axes_activity() { #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) const float fade_scaling_factor = fade_scaling_factor_for_z(raw.z); - #elif DISABLED(MESH_BED_LEVELING) - constexpr float fade_scaling_factor = 1.0; + if (fade_scaling_factor) raw.z += fade_scaling_factor * bedlevel.get_z_correction(raw); + #else + raw.z += bedlevel.get_z_correction(raw); #endif - raw.z += ( - #if ENABLED(MESH_BED_LEVELING) - mbl.get_z(raw OPTARG(ENABLE_LEVELING_FADE_HEIGHT, fade_scaling_factor)) - #elif ENABLED(AUTO_BED_LEVELING_UBL) - fade_scaling_factor ? fade_scaling_factor * ubl.get_z_correction(raw) : 0.0 - #elif ENABLED(AUTO_BED_LEVELING_BILINEAR) - fade_scaling_factor ? fade_scaling_factor * bbl.get_z_correction(raw) : 0.0 - #endif - ); + TERN_(MESH_BED_LEVELING, raw.z += bedlevel.get_z_offset()); #endif } @@ -1618,22 +1611,15 @@ void Planner::check_axes_activity() { #elif HAS_MESH + TERN_(MESH_BED_LEVELING, raw.z -= bedlevel.get_z_offset()); + #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) const float fade_scaling_factor = fade_scaling_factor_for_z(raw.z); - #elif DISABLED(MESH_BED_LEVELING) - constexpr float fade_scaling_factor = 1.0; + if (fade_scaling_factor) raw.z -= fade_scaling_factor * bedlevel.get_z_correction(raw); + #else + raw.z -= bedlevel.get_z_correction(raw); #endif - raw.z -= ( - #if ENABLED(MESH_BED_LEVELING) - mbl.get_z(raw OPTARG(ENABLE_LEVELING_FADE_HEIGHT, fade_scaling_factor)) - #elif ENABLED(AUTO_BED_LEVELING_UBL) - fade_scaling_factor ? fade_scaling_factor * ubl.get_z_correction(raw) : 0.0 - #elif ENABLED(AUTO_BED_LEVELING_BILINEAR) - fade_scaling_factor ? fade_scaling_factor * bbl.get_z_correction(raw) : 0.0 - #endif - ); - #endif } } diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 2d74751a82f0..99994b9f8f82 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -247,9 +247,9 @@ typedef struct SettingsDataStruct { // // MESH_BED_LEVELING // - float mbl_z_offset; // mbl.z_offset + float mbl_z_offset; // bedlevel.z_offset uint8_t mesh_num_x, mesh_num_y; // GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y - float mbl_z_values[TERN(MESH_BED_LEVELING, GRID_MAX_POINTS_X, 3)] // mbl.z_values + float mbl_z_values[TERN(MESH_BED_LEVELING, GRID_MAX_POINTS_X, 3)] // bedlevel.z_values [TERN(MESH_BED_LEVELING, GRID_MAX_POINTS_Y, 3)]; // @@ -287,7 +287,7 @@ typedef struct SettingsDataStruct { // AUTO_BED_LEVELING_UBL // bool planner_leveling_active; // M420 S planner.leveling_active - int8_t ubl_storage_slot; // ubl.storage_slot + int8_t ubl_storage_slot; // bedlevel.storage_slot // // SERVO_ANGLES @@ -615,7 +615,7 @@ void MarlinSettings::postprocess() { TERN_(ENABLE_LEVELING_FADE_HEIGHT, set_z_fade_height(new_z_fade_height, false)); // false = no report - TERN_(AUTO_BED_LEVELING_BILINEAR, bbl.refresh_bed_level()); + TERN_(AUTO_BED_LEVELING_BILINEAR, bedlevel.refresh_bed_level()); TERN_(HAS_MOTOR_CURRENT_PWM, stepper.refresh_motor_power()); @@ -844,7 +844,7 @@ void MarlinSettings::postprocess() { { #if ENABLED(MESH_BED_LEVELING) static_assert( - sizeof(mbl.z_values) == (GRID_MAX_POINTS) * sizeof(mbl.z_values[0][0]), + sizeof(bedlevel.z_values) == (GRID_MAX_POINTS) * sizeof(bedlevel.z_values[0][0]), "MBL Z array is the wrong size." ); #else @@ -854,12 +854,12 @@ void MarlinSettings::postprocess() { const uint8_t mesh_num_x = TERN(MESH_BED_LEVELING, GRID_MAX_POINTS_X, 3), mesh_num_y = TERN(MESH_BED_LEVELING, GRID_MAX_POINTS_Y, 3); - EEPROM_WRITE(TERN(MESH_BED_LEVELING, mbl.z_offset, dummyf)); + EEPROM_WRITE(TERN(MESH_BED_LEVELING, bedlevel.z_offset, dummyf)); EEPROM_WRITE(mesh_num_x); EEPROM_WRITE(mesh_num_y); #if ENABLED(MESH_BED_LEVELING) - EEPROM_WRITE(mbl.z_values); + EEPROM_WRITE(bedlevel.z_values); #else for (uint8_t q = mesh_num_x * mesh_num_y; q--;) EEPROM_WRITE(dummyf); #endif @@ -896,7 +896,7 @@ void MarlinSettings::postprocess() { { #if ENABLED(AUTO_BED_LEVELING_BILINEAR) static_assert( - sizeof(Z_VALUES_ARR) == (GRID_MAX_POINTS) * sizeof(Z_VALUES_ARR[0][0]), + sizeof(bedlevel.z_values) == (GRID_MAX_POINTS) * sizeof(bedlevel.z_values[0][0]), "Bilinear Z array is the wrong size." ); #endif @@ -906,16 +906,16 @@ void MarlinSettings::postprocess() { EEPROM_WRITE(grid_max_x); EEPROM_WRITE(grid_max_y); #if ENABLED(AUTO_BED_LEVELING_BILINEAR) - EEPROM_WRITE(bbl.get_grid_spacing()); - EEPROM_WRITE(bbl.get_grid_start()); + EEPROM_WRITE(bedlevel.grid_spacing); + EEPROM_WRITE(bedlevel.grid_start); #else - const xy_pos_t bilinear_start{0}, bilinear_grid_spacing{0}; + const xy_pos_t bilinear_grid_spacing{0}, bilinear_start{0}; EEPROM_WRITE(bilinear_grid_spacing); EEPROM_WRITE(bilinear_start); #endif #if ENABLED(AUTO_BED_LEVELING_BILINEAR) - EEPROM_WRITE(Z_VALUES_ARR); // 9-256 floats + EEPROM_WRITE(bedlevel.z_values); // 9-256 floats #else dummyf = 0; for (uint16_t q = grid_max_x * grid_max_y; q--;) EEPROM_WRITE(dummyf); @@ -938,7 +938,7 @@ void MarlinSettings::postprocess() { { _FIELD_TEST(planner_leveling_active); const bool ubl_active = TERN(AUTO_BED_LEVELING_UBL, planner.leveling_active, false); - const int8_t storage_slot = TERN(AUTO_BED_LEVELING_UBL, ubl.storage_slot, -1); + const int8_t storage_slot = TERN(AUTO_BED_LEVELING_UBL, bedlevel.storage_slot, -1); EEPROM_WRITE(ubl_active); EEPROM_WRITE(storage_slot); } @@ -1638,8 +1638,8 @@ void MarlinSettings::postprocess() { // UBL Mesh // #if ENABLED(UBL_SAVE_ACTIVE_ON_M500) - if (ubl.storage_slot >= 0) - store_mesh(ubl.storage_slot); + if (bedlevel.storage_slot >= 0) + store_mesh(bedlevel.storage_slot); #endif if (!eeprom_error) { @@ -1796,20 +1796,20 @@ void MarlinSettings::postprocess() { EEPROM_READ_ALWAYS(mesh_num_y); #if ENABLED(MESH_BED_LEVELING) - if (!validating) mbl.z_offset = dummyf; + if (!validating) bedlevel.z_offset = dummyf; if (mesh_num_x == (GRID_MAX_POINTS_X) && mesh_num_y == (GRID_MAX_POINTS_Y)) { // EEPROM data fits the current mesh - EEPROM_READ(mbl.z_values); + EEPROM_READ(bedlevel.z_values); } else { // EEPROM data is stale - if (!validating) mbl.reset(); + if (!validating) bedlevel.reset(); for (uint16_t q = mesh_num_x * mesh_num_y; q--;) EEPROM_READ(dummyf); } #else // MBL is disabled - skip the stored data for (uint16_t q = mesh_num_x * mesh_num_y; q--;) EEPROM_READ(dummyf); - #endif // MESH_BED_LEVELING + #endif } // @@ -1849,8 +1849,8 @@ void MarlinSettings::postprocess() { #if ENABLED(AUTO_BED_LEVELING_BILINEAR) if (grid_max_x == (GRID_MAX_POINTS_X) && grid_max_y == (GRID_MAX_POINTS_Y)) { if (!validating) set_bed_leveling_enabled(false); - bbl.set_grid(spacing, start); - EEPROM_READ(Z_VALUES_ARR); // 9 to 256 floats + bedlevel.set_grid(spacing, start); + EEPROM_READ(bedlevel.z_values); // 9 to 256 floats } else // EEPROM data is stale #endif // AUTO_BED_LEVELING_BILINEAR @@ -1877,7 +1877,7 @@ void MarlinSettings::postprocess() { _FIELD_TEST(planner_leveling_active); #if ENABLED(AUTO_BED_LEVELING_UBL) const bool &planner_leveling_active = planner.leveling_active; - const int8_t &ubl_storage_slot = ubl.storage_slot; + const int8_t &ubl_storage_slot = bedlevel.storage_slot; #else bool planner_leveling_active; int8_t ubl_storage_slot; @@ -2617,11 +2617,11 @@ void MarlinSettings::postprocess() { #if ENABLED(AUTO_BED_LEVELING_UBL) if (!validating) { - ubl.report_state(); + bedlevel.report_state(); - if (!ubl.sanity_check()) { + if (!bedlevel.sanity_check()) { #if BOTH(EEPROM_CHITCHAT, DEBUG_LEVELING_FEATURE) - ubl.echo_name(); + bedlevel.echo_name(); DEBUG_ECHOLNPGM(" initialized.\n"); #endif } @@ -2629,18 +2629,18 @@ void MarlinSettings::postprocess() { eeprom_error = true; #if BOTH(EEPROM_CHITCHAT, DEBUG_LEVELING_FEATURE) DEBUG_ECHOPGM("?Can't enable "); - ubl.echo_name(); + bedlevel.echo_name(); DEBUG_ECHOLNPGM("."); #endif - ubl.reset(); + bedlevel.reset(); } - if (ubl.storage_slot >= 0) { - load_mesh(ubl.storage_slot); - DEBUG_ECHOLNPGM("Mesh ", ubl.storage_slot, " loaded from storage."); + if (bedlevel.storage_slot >= 0) { + load_mesh(bedlevel.storage_slot); + DEBUG_ECHOLNPGM("Mesh ", bedlevel.storage_slot, " loaded from storage."); } else { - ubl.reset(); + bedlevel.reset(); DEBUG_ECHOLNPGM("UBL reset"); } } @@ -2708,7 +2708,7 @@ void MarlinSettings::postprocess() { return (datasize() + EEPROM_OFFSET + 32) & 0xFFF8; } - #define MESH_STORE_SIZE sizeof(TERN(OPTIMIZED_MESH_STORAGE, mesh_store_t, ubl.z_values)) + #define MESH_STORE_SIZE sizeof(TERN(OPTIMIZED_MESH_STORAGE, mesh_store_t, bedlevel.z_values)) uint16_t MarlinSettings::calc_num_meshes() { return (meshes_end - meshes_start_index()) / MESH_STORE_SIZE; @@ -2734,10 +2734,10 @@ void MarlinSettings::postprocess() { #if ENABLED(OPTIMIZED_MESH_STORAGE) int16_t z_mesh_store[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; - ubl.set_store_from_mesh(ubl.z_values, z_mesh_store); + bedlevel.set_store_from_mesh(bedlevel.z_values, z_mesh_store); uint8_t * const src = (uint8_t*)&z_mesh_store; #else - uint8_t * const src = (uint8_t*)&ubl.z_values; + uint8_t * const src = (uint8_t*)&bedlevel.z_values; #endif // Write crc to MAT along with other data, or just tack on to the beginning or end @@ -2772,7 +2772,7 @@ void MarlinSettings::postprocess() { int16_t z_mesh_store[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; uint8_t * const dest = (uint8_t*)&z_mesh_store; #else - uint8_t * const dest = into ? (uint8_t*)into : (uint8_t*)&ubl.z_values; + uint8_t * const dest = into ? (uint8_t*)into : (uint8_t*)&bedlevel.z_values; #endif persistentStore.access_start(); @@ -2782,11 +2782,11 @@ void MarlinSettings::postprocess() { #if ENABLED(OPTIMIZED_MESH_STORAGE) if (into) { float z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; - ubl.set_mesh_from_store(z_mesh_store, z_values); + bedlevel.set_mesh_from_store(z_mesh_store, z_values); memcpy(into, z_values, sizeof(z_values)); } else - ubl.set_mesh_from_store(z_mesh_store, ubl.z_values); + bedlevel.set_mesh_from_store(z_mesh_store, bedlevel.z_values); #endif if (status) SERIAL_ECHOLNPGM("?Unable to load mesh data."); @@ -3441,24 +3441,25 @@ void MarlinSettings::reset() { LOOP_L_N(px, GRID_MAX_POINTS_X) { CONFIG_ECHO_START(); SERIAL_ECHOPGM(" G29 S3 I", px, " J", py); - SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, LINEAR_UNIT(mbl.z_values[px][py]), 5); + SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, LINEAR_UNIT(bedlevel.z_values[px][py]), 5); } } CONFIG_ECHO_START(); - SERIAL_ECHOLNPAIR_F(" G29 S4 Z", LINEAR_UNIT(mbl.z_offset), 5); + SERIAL_ECHOLNPAIR_F(" G29 S4 Z", LINEAR_UNIT(bedlevel.z_offset), 5); } #elif ENABLED(AUTO_BED_LEVELING_UBL) if (!forReplay) { SERIAL_EOL(); - ubl.report_state(); - SERIAL_ECHO_MSG("Active Mesh Slot ", ubl.storage_slot); + bedlevel.report_state(); + SERIAL_ECHO_MSG("Active Mesh Slot ", bedlevel.storage_slot); SERIAL_ECHO_MSG("EEPROM can hold ", calc_num_meshes(), " meshes.\n"); } - //ubl.report_current_mesh(); // This is too verbose for large meshes. A better (more terse) - // solution needs to be found. + //bedlevel.report_current_mesh(); // This is too verbose for large meshes. A better (more terse) + // solution needs to be found. + #elif ENABLED(AUTO_BED_LEVELING_BILINEAR) if (leveling_is_valid()) { @@ -3466,7 +3467,7 @@ void MarlinSettings::reset() { LOOP_L_N(px, GRID_MAX_POINTS_X) { CONFIG_ECHO_START(); SERIAL_ECHOPGM(" G29 W I", px, " J", py); - SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, LINEAR_UNIT(Z_VALUES_ARR[px][py]), 5); + SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, LINEAR_UNIT(bedlevel.z_values[px][py]), 5); } } } From 6a880280e4c7e7ed6ebc72d9b446017bd7db3702 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Fri, 20 May 2022 02:15:57 +1200 Subject: [PATCH 074/241] =?UTF-8?q?=F0=9F=94=A8=20Require=20PIO=20>=3D=206?= =?UTF-8?q?.0.1=20(#24205)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PlatformIO/scripts/common-dependencies.py | 6 ++-- ini/avr.ini | 2 +- ini/due.ini | 6 ++-- ini/esp32.ini | 16 +++++----- ini/lpc176x.ini | 2 +- ini/native.ini | 22 ++++++------- ini/samd51.ini | 20 ++++++------ ini/stm32-common.ini | 2 +- ini/stm32f0.ini | 12 +++---- ini/stm32f1-maple.ini | 2 +- ini/stm32f1.ini | 12 +++---- ini/teensy.ini | 32 +++++++++---------- platformio.ini | 8 ++--- 13 files changed, 71 insertions(+), 71 deletions(-) diff --git a/buildroot/share/PlatformIO/scripts/common-dependencies.py b/buildroot/share/PlatformIO/scripts/common-dependencies.py index 24e780d9b670..e9e8c7918767 100644 --- a/buildroot/share/PlatformIO/scripts/common-dependencies.py +++ b/buildroot/share/PlatformIO/scripts/common-dependencies.py @@ -15,7 +15,7 @@ FEATURE_CONFIG = {} def validate_pio(): - PIO_VERSION_MIN = (5, 0, 3) + PIO_VERSION_MIN = (6, 0, 1) try: from platformio import VERSION as PIO_VERSION weights = (1000, 100, 1) @@ -174,7 +174,7 @@ def apply_features_config(): env.SConscript(feat['extra_scripts'], exports="env") if 'src_filter' in feat: - blab("========== Adding src_filter for %s... " % feature, 2) + blab("========== Adding build_src_filter for %s... " % feature, 2) src_filter = ' '.join(env.GetProjectOption('src_filter')) # first we need to remove the references to the same folder my_srcs = re.findall(r'[+-](<.*?>)', feat['src_filter']) @@ -184,7 +184,7 @@ def apply_features_config(): src_filter = re.sub(r'[+-]' + d, '', src_filter) src_filter = feat['src_filter'] + ' ' + src_filter - set_env_field('src_filter', [src_filter]) + set_env_field('build_src_filter', [src_filter]) env.Replace(SRC_FILTER=src_filter) if 'lib_ignore' in feat: diff --git a/ini/avr.ini b/ini/avr.ini index b13596afe119..5944f8158344 100644 --- a/ini/avr.ini +++ b/ini/avr.ini @@ -16,7 +16,7 @@ platform = atmelavr@~3.4 build_flags = ${common.build_flags} -Wl,--relax board_build.f_cpu = 16000000L -src_filter = ${common.default_src_filter} + +build_src_filter = ${common.default_src_filter} + # # ATmega2560 diff --git a/ini/due.ini b/ini/due.ini index 28b68383074d..c1e2375d7c5a 100644 --- a/ini/due.ini +++ b/ini/due.ini @@ -16,9 +16,9 @@ # - RADDS # [env:DUE] -platform = atmelsam -board = due -src_filter = ${common.default_src_filter} + + +platform = atmelsam +board = due +build_src_filter = ${common.default_src_filter} + + [env:DUE_USB] extends = env:DUE diff --git a/ini/esp32.ini b/ini/esp32.ini index 4ac6b96f5c3d..05b045f16e83 100644 --- a/ini/esp32.ini +++ b/ini/esp32.ini @@ -13,14 +13,14 @@ # Espressif ESP32 # [env:esp32] -platform = espressif32@2.1.0 -board = esp32dev -build_flags = ${common.build_flags} -DCORE_DEBUG_LEVEL=0 -src_filter = ${common.default_src_filter} + -lib_ignore = NativeEthernet -upload_speed = 500000 -monitor_speed = 250000 -#upload_port = marlinesp.local +platform = espressif32@2.1.0 +board = esp32dev +build_flags = ${common.build_flags} -DCORE_DEBUG_LEVEL=0 +build_src_filter = ${common.default_src_filter} + +lib_ignore = NativeEthernet +upload_speed = 500000 +monitor_speed = 250000 +#upload_port = marlinesp.local #board_build.flash_mode = qio [env:FYSETC_E4] diff --git a/ini/lpc176x.ini b/ini/lpc176x.ini index 95f5637a5dec..0cb26628fe49 100644 --- a/ini/lpc176x.ini +++ b/ini/lpc176x.ini @@ -20,7 +20,7 @@ lib_ldf_mode = off lib_compat_mode = strict extra_scripts = ${common.extra_scripts} Marlin/src/HAL/LPC1768/upload_extra_script.py -src_filter = ${common.default_src_filter} + + +build_src_filter = ${common.default_src_filter} + + lib_deps = ${common.lib_deps} Servo custom_marlin.USES_LIQUIDCRYSTAL = arduino-libraries/LiquidCrystal@~1.0.7 diff --git a/ini/native.ini b/ini/native.ini index 02737a074638..b34945397ecf 100644 --- a/ini/native.ini +++ b/ini/native.ini @@ -13,14 +13,14 @@ # No supported Arduino libraries, base Marlin only # [env:linux_native] -platform = native -framework = -build_flags = -D__PLAT_LINUX__ -std=gnu++17 -ggdb -g -lrt -lpthread -D__MARLIN_FIRMWARE__ -Wno-expansion-to-defined -src_build_flags = -Wall -IMarlin/src/HAL/LINUX/include -build_unflags = -Wall -lib_ldf_mode = off -lib_deps = -src_filter = ${common.default_src_filter} + +platform = native +framework = +build_flags = -D__PLAT_LINUX__ -std=gnu++17 -ggdb -g -lrt -lpthread -D__MARLIN_FIRMWARE__ -Wno-expansion-to-defined +build_src_flags = -Wall -IMarlin/src/HAL/LINUX/include +build_unflags = -Wall +lib_ldf_mode = off +lib_deps = +build_src_filter = ${common.default_src_filter} + # # Native Simulation @@ -35,11 +35,11 @@ src_filter = ${common.default_src_filter} + platform = native framework = build_flags = ${common.build_flags} -std=gnu++17 -D__PLAT_NATIVE_SIM__ -DU8G_HAL_LINKS -I/usr/include/SDL2 -IMarlin -IMarlin/src/HAL/NATIVE_SIM/u8g -src_build_flags = -Wall -Wno-expansion-to-defined -Wcast-align +build_src_flags = -Wall -Wno-expansion-to-defined -Wcast-align release_flags = -g0 -O3 -flto debug_build_flags = -fstack-protector-strong -g -g3 -ggdb lib_compat_mode = off -src_filter = ${common.default_src_filter} + +build_src_filter = ${common.default_src_filter} + lib_deps = ${common.lib_deps} MarlinSimUI=https://github.com/p3p/MarlinSimUI/archive/0.0.2.zip Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/marlin_sim_native.zip @@ -110,6 +110,6 @@ custom_gcc = g++ # [env:simulator_windows] extends = simulator_common -src_build_flags = ${simulator_common.src_build_flags} -fpermissive +build_src_flags = ${simulator_common.build_src_flags} -fpermissive build_flags = ${simulator_common.build_flags} ${simulator_common.debug_build_flags} -IC:\\msys64\\mingw64\\include\\SDL2 -fno-stack-protector -Wl,-subsystem,windows -ldl -lmingw32 -lSDL2main -lSDL2 -lSDL2_net -lopengl32 -lssp build_type = debug diff --git a/ini/samd51.ini b/ini/samd51.ini index 34fcc84371c8..d7d9b3a4211c 100644 --- a/ini/samd51.ini +++ b/ini/samd51.ini @@ -13,14 +13,14 @@ # Adafruit Grand Central M4 (Atmel SAMD51P20A ARM Cortex-M4) # [env:SAMD51_grandcentral_m4] -platform = atmelsam -board = adafruit_grandcentral_m4 -build_flags = ${common.build_flags} -std=gnu++17 -build_unflags = -std=gnu++11 -src_filter = ${common.default_src_filter} + -lib_deps = ${common.lib_deps} - SoftwareSerialM -extra_scripts = ${common.extra_scripts} - pre:buildroot/share/PlatformIO/scripts/SAMD51_grandcentral_m4.py +platform = atmelsam +board = adafruit_grandcentral_m4 +build_flags = ${common.build_flags} -std=gnu++17 +build_unflags = -std=gnu++11 +build_src_filter = ${common.default_src_filter} + +lib_deps = ${common.lib_deps} + SoftwareSerialM +extra_scripts = ${common.extra_scripts} + pre:buildroot/share/PlatformIO/scripts/SAMD51_grandcentral_m4.py custom_marlin.SDSUPPORT = SdFat - Adafruit Fork, Adafruit SPIFlash -debug_tool = jlink +debug_tool = jlink diff --git a/ini/stm32-common.ini b/ini/stm32-common.ini index 1d3f858bf8e9..c8f28cd0e314 100644 --- a/ini/stm32-common.ini +++ b/ini/stm32-common.ini @@ -18,7 +18,7 @@ build_flags = ${common.build_flags} -DTIM_IRQ_PRIO=13 -DADC_RESOLUTION=12 build_unflags = -std=gnu++11 -src_filter = ${common.default_src_filter} + + +build_src_filter = ${common.default_src_filter} + + extra_scripts = ${common.extra_scripts} pre:buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py diff --git a/ini/stm32f0.ini b/ini/stm32f0.ini index d6251344c365..d62ac3acf54f 100644 --- a/ini/stm32f0.ini +++ b/ini/stm32f0.ini @@ -43,9 +43,9 @@ build_flags = ${common_stm32.build_flags} # Malyan M300 (STM32F070CB) # [env:malyan_M300] -extends = common_stm32 -board = malyanm300_f070cb -build_flags = ${common_stm32.build_flags} - -DHAL_PCD_MODULE_ENABLED -DDISABLE_GENERIC_SERIALUSB - -DHAL_UART_MODULE_ENABLED -src_filter = ${common.default_src_filter} + +extends = common_stm32 +board = malyanm300_f070cb +build_flags = ${common_stm32.build_flags} + -DHAL_PCD_MODULE_ENABLED -DDISABLE_GENERIC_SERIALUSB + -DHAL_UART_MODULE_ENABLED +build_src_filter = ${common.default_src_filter} + diff --git a/ini/stm32f1-maple.ini b/ini/stm32f1-maple.ini index f0a0f9375850..bfa82876286e 100644 --- a/ini/stm32f1-maple.ini +++ b/ini/stm32f1-maple.ini @@ -28,7 +28,7 @@ board_build.core = maple build_flags = !python Marlin/src/HAL/STM32F1/build_flags.py ${common.build_flags} -DARDUINO_ARCH_STM32 -DMAPLE_STM32F1 build_unflags = -std=gnu11 -std=gnu++11 -src_filter = ${common.default_src_filter} + +build_src_filter = ${common.default_src_filter} + lib_ignore = SPI, FreeRTOS701, FreeRTOS821 lib_deps = ${common.lib_deps} SoftwareSerialM diff --git a/ini/stm32f1.ini b/ini/stm32f1.ini index 464048adcb1a..6bf6a1cb851c 100644 --- a/ini/stm32f1.ini +++ b/ini/stm32f1.ini @@ -249,12 +249,12 @@ build_unflags = ${stm32_variant.build_unflags} # Malyan M200 (STM32F103CB) # [env:STM32F103CB_malyan] -extends = common_stm32 -board = malyanm200_f103cb -build_flags = ${common_stm32.build_flags} - -DHAL_PCD_MODULE_ENABLED -DDISABLE_GENERIC_SERIALUSB - -DHAL_UART_MODULE_ENABLED -src_filter = ${common.default_src_filter} + +extends = common_stm32 +board = malyanm200_f103cb +build_flags = ${common_stm32.build_flags} + -DHAL_PCD_MODULE_ENABLED -DDISABLE_GENERIC_SERIALUSB + -DHAL_UART_MODULE_ENABLED +build_src_filter = ${common.default_src_filter} + # # FLYmaker FLY Mini (STM32F103RCT6) diff --git a/ini/teensy.ini b/ini/teensy.ini index ab0617b5b7b5..dac4b40c3053 100644 --- a/ini/teensy.ini +++ b/ini/teensy.ini @@ -45,36 +45,36 @@ board = teensy2pp # Teensy 3.x - 4.x # [teensy_arm] -platform = teensy@~4.12.0 -src_filter = ${common.default_src_filter} -lib_ignore = NativeEthernet +platform = teensy@~4.12.0 +build_src_filter = ${common.default_src_filter} +lib_ignore = NativeEthernet # # Teensy 3.1 / 3.2 (ARM Cortex-M4) # [env:teensy31] -extends = teensy_arm -board = teensy31 -src_filter = ${teensy_arm.src_filter} + +extends = teensy_arm +board = teensy31 +build_src_filter = ${teensy_arm.build_src_filter} + # # Teensy 3.5 / 3.6 (ARM Cortex-M4) # [env:teensy35] -extends = teensy_arm -board = teensy35 -src_filter = ${teensy_arm.src_filter} + +extends = teensy_arm +board = teensy35 +build_src_filter = ${teensy_arm.build_src_filter} + [env:teensy36] -extends = teensy_arm -board = teensy36 -src_filter = ${teensy_arm.src_filter} + +extends = teensy_arm +board = teensy36 +build_src_filter = ${teensy_arm.build_src_filter} + # # Teensy 4.0 / 4.1 (ARM Cortex-M7) # [env:teensy41] -extends = teensy_arm -board = teensy41 -src_filter = ${teensy_arm.src_filter} + -lib_ignore = +extends = teensy_arm +board = teensy41 +build_src_filter = ${teensy_arm.build_src_filter} + +lib_ignore = diff --git a/platformio.ini b/platformio.ini index ac52fd7a1f47..b715bafb9697 100644 --- a/platformio.ini +++ b/platformio.ini @@ -281,7 +281,7 @@ monitor_flags = # Just print the dependency tree # [env:include_tree] -platform = atmelavr -board = megaatmega2560 -build_flags = -c -H -std=gnu++11 -Wall -Os -D__MARLIN_FIRMWARE__ -src_filter = + +platform = atmelavr +board = megaatmega2560 +build_flags = -c -H -std=gnu++11 -Wall -Os -D__MARLIN_FIRMWARE__ +build_src_filter = + From 00075990d062088f1a291f0546295c1d36821c63 Mon Sep 17 00:00:00 2001 From: Marcio T Date: Thu, 19 May 2022 09:45:48 -0600 Subject: [PATCH 075/241] =?UTF-8?q?=F0=9F=90=9B=20Fix=20FTDI=5FEVE=5FTOUCH?= =?UTF-8?q?=5FUI=20reboot=20loop=20(#24195)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/buttons.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/lcd/buttons.h b/Marlin/src/lcd/buttons.h index 429fb971ec83..2580a71d1b82 100644 --- a/Marlin/src/lcd/buttons.h +++ b/Marlin/src/lcd/buttons.h @@ -26,7 +26,7 @@ #if ((!HAS_ADC_BUTTONS && IS_NEWPANEL) || BUTTONS_EXIST(EN1, EN2)) && !IS_TFTGLCD_PANEL #define HAS_ENCODER_WHEEL 1 #endif -#if HAS_ENCODER_WHEEL || ANY_BUTTON(ENC, BACK, UP, DWN, LFT, RT) +#if (HAS_ENCODER_WHEEL || ANY_BUTTON(ENC, BACK, UP, DWN, LFT, RT)) && DISABLED(TOUCH_UI_FTDI_EVE) #define HAS_DIGITAL_BUTTONS 1 #endif #if !HAS_ADC_BUTTONS && (IS_RRW_KEYPAD || (HAS_WIRED_LCD && !IS_NEWPANEL)) From 62057d3204c727fdf5c2c5e9f112e0c597e60924 Mon Sep 17 00:00:00 2001 From: tombrazier <68918209+tombrazier@users.noreply.github.com> Date: Thu, 19 May 2022 22:15:15 +0100 Subject: [PATCH 076/241] =?UTF-8?q?=F0=9F=90=9B=20Fix=20Leveling=20apply/u?= =?UTF-8?q?napply=20(#24188)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/feature/bedlevel/bedlevel.cpp | 14 ++----- Marlin/src/gcode/bedlevel/abl/G29.cpp | 53 ++++++++++++------------ Marlin/src/module/planner.cpp | 38 +++++++++-------- 3 files changed, 52 insertions(+), 53 deletions(-) diff --git a/Marlin/src/feature/bedlevel/bedlevel.cpp b/Marlin/src/feature/bedlevel/bedlevel.cpp index f9d17a69a13f..1ca9696a3a30 100644 --- a/Marlin/src/feature/bedlevel/bedlevel.cpp +++ b/Marlin/src/feature/bedlevel/bedlevel.cpp @@ -74,16 +74,10 @@ void set_bed_leveling_enabled(const bool enable/*=true*/) { _report_leveling(); planner.synchronize(); - if (planner.leveling_active) { // leveling from on to off - // change unleveled current_position to physical current_position without moving steppers. - planner.apply_leveling(current_position); - planner.leveling_active = false; // disable only AFTER calling apply_leveling - } - else { // leveling from off to on - planner.leveling_active = true; // enable BEFORE calling unapply_leveling, otherwise ignored - // change physical current_position to unleveled current_position without moving steppers. - planner.unapply_leveling(current_position); - } + // Get the corrected leveled / unleveled position + planner.apply_modifiers(current_position); // Physical position with all modifiers + planner.leveling_active ^= true; // Toggle leveling between apply and unapply + planner.unapply_modifiers(current_position); // Logical position with modifiers removed sync_plan_position(); _report_leveling(); diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 8fac5e753ebe..a2c53b5ab253 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -74,14 +74,18 @@ #endif #endif +static void pre_g29_return(const bool retry, const bool did) { + if (!retry) { + TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE, false)); + } + if (did) { + TERN_(HAS_DWIN_E3V2_BASIC, DWIN_LevelingDone()); + TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone()); + } +} + #define G29_RETURN(retry, did) do{ \ - if (TERN(G29_RETRY_AND_RECOVER, !retry, true)) { \ - TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE, false)); \ - } \ - if (did) { \ - TERN_(HAS_DWIN_E3V2_BASIC, DWIN_LevelingDone()); \ - TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone()); \ - } \ + pre_g29_return(TERN0(G29_RETRY_AND_RECOVER, retry), did); \ return TERN_(G29_RETRY_AND_RECOVER, retry); \ }while(0) @@ -326,8 +330,10 @@ G29_TYPE GcodeSuite::G29() { bedlevel.z_values[i][j] = rz; bedlevel.refresh_bed_level(); TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(i, j, rz)); - set_bed_leveling_enabled(abl.reenable); - if (abl.reenable) report_current_position(); + if (abl.reenable) { + set_bed_leveling_enabled(true); + report_current_position(); + } } G29_RETURN(false, false); } // parser.seen_test('W') @@ -729,7 +735,7 @@ G29_TYPE GcodeSuite::G29() { #endif - abl.reenable = false; + abl.reenable = false; // Don't re-enable after modifying the mesh idle_no_sleep(); } // inner @@ -914,33 +920,28 @@ G29_TYPE GcodeSuite::G29() { current_position = converted; if (DEBUGGING(LEVELING)) DEBUG_POS("G29 corrected XYZ", current_position); - } - #elif ENABLED(AUTO_BED_LEVELING_BILINEAR) + abl.reenable = true; + } - if (!abl.dryrun) { - if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("G29 uncorrected Z:", current_position.z); + // Auto Bed Leveling is complete! Enable if possible. + if (abl.reenable) { + planner.leveling_active = true; + sync_plan_position(); + } - // Unapply the offset because it is going to be immediately applied - // and cause compensation movement in Z - current_position.z -= bedlevel.get_z_correction(current_position) - TERN_(ENABLE_LEVELING_FADE_HEIGHT, * planner.fade_scaling_factor_for_z(current_position.z)); + #elif ENABLED(AUTO_BED_LEVELING_BILINEAR) - if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM(" corrected Z:", current_position.z); - } + // Auto Bed Leveling is complete! Enable if possible. + if (!abl.dryrun || abl.reenable) set_bed_leveling_enabled(true); - #endif // ABL_PLANAR + #endif - // Auto Bed Leveling is complete! Enable if possible. - planner.leveling_active = !abl.dryrun || abl.reenable; } // !isnan(abl.measured_z) // Restore state after probing if (!faux) restore_feedrate_and_scaling(); - // Sync the planner from the current_position - if (planner.leveling_active) sync_plan_position(); - TERN_(HAS_BED_PROBE, probe.move_z_after_probing()); #ifdef Z_PROBE_END_SCRIPT diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 3a65c9591baa..e11a76090236 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1598,30 +1598,34 @@ void Planner::check_axes_activity() { } void Planner::unapply_leveling(xyz_pos_t &raw) { + if (!leveling_active) return; - if (leveling_active) { - - #if ABL_PLANAR - - matrix_3x3 inverse = matrix_3x3::transpose(bed_level_matrix); + #if ABL_PLANAR - xy_pos_t d = raw - level_fulcrum; - inverse.apply_rotation_xyz(d.x, d.y, raw.z); - raw = d + level_fulcrum; + matrix_3x3 inverse = matrix_3x3::transpose(bed_level_matrix); - #elif HAS_MESH + xy_pos_t d = raw - level_fulcrum; + inverse.apply_rotation_xyz(d.x, d.y, raw.z); + raw = d + level_fulcrum; - TERN_(MESH_BED_LEVELING, raw.z -= bedlevel.get_z_offset()); + #elif HAS_MESH - #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) - const float fade_scaling_factor = fade_scaling_factor_for_z(raw.z); - if (fade_scaling_factor) raw.z -= fade_scaling_factor * bedlevel.get_z_correction(raw); - #else - raw.z -= bedlevel.get_z_correction(raw); - #endif + const float z_correction = bedlevel.get_z_correction(raw), + z_full_fade = DIFF_TERN(MESH_BED_LEVELING, raw.z, bedlevel.get_z_offset()), + z_no_fade = z_full_fade - z_correction; + #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) + if (!z_fade_height || z_no_fade <= 0.0f) // Not fading or at bed level? + raw.z = z_no_fade; // Unapply full mesh Z. + else if (z_full_fade >= z_fade_height) // Above the fade height? + raw.z = z_full_fade; // Nothing more to unapply. + else // Within the fade zone? + raw.z = z_no_fade / (1.0f - z_correction * inverse_z_fade_height); // Unapply the faded Z offset + #else + raw.z = z_no_fade; #endif - } + + #endif } #endif // HAS_LEVELING From 22c5bd7eae574d5efdceafb69a55fbe20d134338 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 14 May 2022 01:45:14 -0500 Subject: [PATCH 077/241] =?UTF-8?q?=F0=9F=94=A8=20Move,=20tweak=20maple=20?= =?UTF-8?q?envs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test-builds.yml | 2 +- Marlin/src/pins/pins.h | 12 +- ...F103.json => marlin_maple_CHITU_F103.json} | 2 +- ...EB_3DP.json => marlin_maple_MEEB_3DP.json} | 2 +- .../ldscripts/fysetc_stm32f103rc.ld | 18 - .../scripts/STM32F103RC_MEEB_3DP.py | 23 -- .../share/PlatformIO/scripts/mks_robin.py | 5 - .../share/PlatformIO/scripts/mks_robin_e3.py | 5 - .../share/PlatformIO/scripts/mks_robin_e3p.py | 5 - .../PlatformIO/scripts/mks_robin_lite.py | 5 - .../PlatformIO/scripts/mks_robin_lite3.py | 5 - .../PlatformIO/scripts/mks_robin_mini.py | 5 - .../PlatformIO/scripts/mks_robin_nano.py | 5 - .../PlatformIO/scripts/mks_robin_nano35.py | 5 - .../share/PlatformIO/scripts/mks_robin_pro.py | 5 - buildroot/share/PlatformIO/scripts/robin.py | 14 - .../board.cpp | 0 .../board/board.h | 0 .../ld/common.inc | 0 .../ld/extra_libs.inc | 0 .../ld/flash.ld | 0 .../ld/stm32f103z_dfu.ld | 0 .../ld/stm32f103zc.ld | 0 .../ld/stm32f103zd.ld | 0 .../ld/stm32f103ze.ld | 0 .../ld/vector_symbols.inc | 0 .../pins_arduino.h | 0 .../variant.h | 0 .../wirish/boards.cpp | 0 .../wirish/boards_setup.cpp | 0 .../wirish/start.S | 0 .../wirish/start_c.c | 0 .../wirish/syscalls.c | 0 .../board.cpp | 0 .../board/board.h | 0 .../ld/bootloader.ld | 0 .../ld/common.inc | 0 .../ld/extra_libs.inc | 0 .../ld/flash.ld | 0 .../ld/jtag.ld | 0 .../ld/mem-flash.inc | 0 .../ld/mem-jtag.inc | 0 .../ld/mem-ram.inc | 0 .../ld/ram.ld | 0 .../ld/stm32f103rb.ld | 0 .../ld/stm32f103rb_bootloader.ld | 0 .../ld/stm32f103rc.ld | 0 .../ld/stm32f103rc_bootloader.ld | 0 .../ld/stm32f103re.ld | 0 .../ld/vector_symbols.inc | 0 .../pins_arduino.h | 0 .../variant.h | 0 .../wirish/boards.cpp | 0 .../wirish/boards_setup.cpp | 0 .../wirish/start.S | 0 .../wirish/start_c.c | 0 .../wirish/syscalls.c | 0 ...TM32F103RC_meeb => STM32F103RC_meeb_maple} | 0 ini/renamed.ini | 8 + ini/stm32f1-maple.ini | 357 ++++++++---------- 60 files changed, 184 insertions(+), 299 deletions(-) rename buildroot/share/PlatformIO/boards/{marlin_CHITU_F103.json => marlin_maple_CHITU_F103.json} (95%) rename buildroot/share/PlatformIO/boards/{marlin_MEEB_3DP.json => marlin_maple_MEEB_3DP.json} (96%) delete mode 100644 buildroot/share/PlatformIO/ldscripts/fysetc_stm32f103rc.ld delete mode 100644 buildroot/share/PlatformIO/scripts/mks_robin.py delete mode 100644 buildroot/share/PlatformIO/scripts/mks_robin_e3.py delete mode 100644 buildroot/share/PlatformIO/scripts/mks_robin_e3p.py delete mode 100644 buildroot/share/PlatformIO/scripts/mks_robin_lite.py delete mode 100644 buildroot/share/PlatformIO/scripts/mks_robin_lite3.py delete mode 100644 buildroot/share/PlatformIO/scripts/mks_robin_mini.py delete mode 100644 buildroot/share/PlatformIO/scripts/mks_robin_nano.py delete mode 100644 buildroot/share/PlatformIO/scripts/mks_robin_nano35.py delete mode 100644 buildroot/share/PlatformIO/scripts/mks_robin_pro.py delete mode 100644 buildroot/share/PlatformIO/scripts/robin.py rename buildroot/share/PlatformIO/variants/{marlin_CHITU_F103 => marlin_maple_CHITU_F103}/board.cpp (100%) rename buildroot/share/PlatformIO/variants/{marlin_CHITU_F103 => marlin_maple_CHITU_F103}/board/board.h (100%) rename buildroot/share/PlatformIO/variants/{marlin_CHITU_F103 => marlin_maple_CHITU_F103}/ld/common.inc (100%) rename buildroot/share/PlatformIO/variants/{marlin_CHITU_F103 => marlin_maple_CHITU_F103}/ld/extra_libs.inc (100%) rename buildroot/share/PlatformIO/variants/{marlin_CHITU_F103 => marlin_maple_CHITU_F103}/ld/flash.ld (100%) rename buildroot/share/PlatformIO/variants/{marlin_CHITU_F103 => marlin_maple_CHITU_F103}/ld/stm32f103z_dfu.ld (100%) rename buildroot/share/PlatformIO/variants/{marlin_CHITU_F103 => marlin_maple_CHITU_F103}/ld/stm32f103zc.ld (100%) rename buildroot/share/PlatformIO/variants/{marlin_CHITU_F103 => marlin_maple_CHITU_F103}/ld/stm32f103zd.ld (100%) rename buildroot/share/PlatformIO/variants/{marlin_CHITU_F103 => marlin_maple_CHITU_F103}/ld/stm32f103ze.ld (100%) rename buildroot/share/PlatformIO/variants/{marlin_CHITU_F103 => marlin_maple_CHITU_F103}/ld/vector_symbols.inc (100%) rename buildroot/share/PlatformIO/variants/{marlin_CHITU_F103 => marlin_maple_CHITU_F103}/pins_arduino.h (100%) rename buildroot/share/PlatformIO/variants/{marlin_CHITU_F103 => marlin_maple_CHITU_F103}/variant.h (100%) rename buildroot/share/PlatformIO/variants/{marlin_CHITU_F103 => marlin_maple_CHITU_F103}/wirish/boards.cpp (100%) rename buildroot/share/PlatformIO/variants/{marlin_CHITU_F103 => marlin_maple_CHITU_F103}/wirish/boards_setup.cpp (100%) rename buildroot/share/PlatformIO/variants/{marlin_CHITU_F103 => marlin_maple_CHITU_F103}/wirish/start.S (100%) rename buildroot/share/PlatformIO/variants/{marlin_CHITU_F103 => marlin_maple_CHITU_F103}/wirish/start_c.c (100%) rename buildroot/share/PlatformIO/variants/{marlin_CHITU_F103 => marlin_maple_CHITU_F103}/wirish/syscalls.c (100%) rename buildroot/share/PlatformIO/variants/{marlin_MEEB_3DP => marlin_maple_MEEB_3DP}/board.cpp (100%) rename buildroot/share/PlatformIO/variants/{marlin_MEEB_3DP => marlin_maple_MEEB_3DP}/board/board.h (100%) rename buildroot/share/PlatformIO/variants/{marlin_MEEB_3DP => marlin_maple_MEEB_3DP}/ld/bootloader.ld (100%) rename buildroot/share/PlatformIO/variants/{marlin_MEEB_3DP => marlin_maple_MEEB_3DP}/ld/common.inc (100%) rename buildroot/share/PlatformIO/variants/{marlin_MEEB_3DP => marlin_maple_MEEB_3DP}/ld/extra_libs.inc (100%) rename buildroot/share/PlatformIO/variants/{marlin_MEEB_3DP => marlin_maple_MEEB_3DP}/ld/flash.ld (100%) rename buildroot/share/PlatformIO/variants/{marlin_MEEB_3DP => marlin_maple_MEEB_3DP}/ld/jtag.ld (100%) rename buildroot/share/PlatformIO/variants/{marlin_MEEB_3DP => marlin_maple_MEEB_3DP}/ld/mem-flash.inc (100%) rename buildroot/share/PlatformIO/variants/{marlin_MEEB_3DP => marlin_maple_MEEB_3DP}/ld/mem-jtag.inc (100%) rename buildroot/share/PlatformIO/variants/{marlin_MEEB_3DP => marlin_maple_MEEB_3DP}/ld/mem-ram.inc (100%) rename buildroot/share/PlatformIO/variants/{marlin_MEEB_3DP => marlin_maple_MEEB_3DP}/ld/ram.ld (100%) rename buildroot/share/PlatformIO/variants/{marlin_MEEB_3DP => marlin_maple_MEEB_3DP}/ld/stm32f103rb.ld (100%) rename buildroot/share/PlatformIO/variants/{marlin_MEEB_3DP => marlin_maple_MEEB_3DP}/ld/stm32f103rb_bootloader.ld (100%) rename buildroot/share/PlatformIO/variants/{marlin_MEEB_3DP => marlin_maple_MEEB_3DP}/ld/stm32f103rc.ld (100%) rename buildroot/share/PlatformIO/variants/{marlin_MEEB_3DP => marlin_maple_MEEB_3DP}/ld/stm32f103rc_bootloader.ld (100%) rename buildroot/share/PlatformIO/variants/{marlin_MEEB_3DP => marlin_maple_MEEB_3DP}/ld/stm32f103re.ld (100%) rename buildroot/share/PlatformIO/variants/{marlin_MEEB_3DP => marlin_maple_MEEB_3DP}/ld/vector_symbols.inc (100%) rename buildroot/share/PlatformIO/variants/{marlin_MEEB_3DP => marlin_maple_MEEB_3DP}/pins_arduino.h (100%) rename buildroot/share/PlatformIO/variants/{marlin_MEEB_3DP => marlin_maple_MEEB_3DP}/variant.h (100%) rename buildroot/share/PlatformIO/variants/{marlin_MEEB_3DP => marlin_maple_MEEB_3DP}/wirish/boards.cpp (100%) rename buildroot/share/PlatformIO/variants/{marlin_MEEB_3DP => marlin_maple_MEEB_3DP}/wirish/boards_setup.cpp (100%) rename buildroot/share/PlatformIO/variants/{marlin_MEEB_3DP => marlin_maple_MEEB_3DP}/wirish/start.S (100%) rename buildroot/share/PlatformIO/variants/{marlin_MEEB_3DP => marlin_maple_MEEB_3DP}/wirish/start_c.c (100%) rename buildroot/share/PlatformIO/variants/{marlin_MEEB_3DP => marlin_maple_MEEB_3DP}/wirish/syscalls.c (100%) rename buildroot/tests/{STM32F103RC_meeb => STM32F103RC_meeb_maple} (100%) diff --git a/.github/workflows/test-builds.yml b/.github/workflows/test-builds.yml index 2d94b000c68c..498cfc1d1f51 100644 --- a/.github/workflows/test-builds.yml +++ b/.github/workflows/test-builds.yml @@ -59,7 +59,7 @@ jobs: #- STM32F103RC_btt_maple - STM32F103RC_btt_USB_maple - STM32F103RC_fysetc_maple - - STM32F103RC_meeb + - STM32F103RC_meeb_maple - jgaurora_a5s_a1_maple - STM32F103VE_longer_maple #- mks_robin_maple diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 5db9f71d10c0..82c91290c24c 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -492,15 +492,15 @@ #elif MB(STM3R_MINI) #include "stm32f1/pins_STM3R_MINI.h" // STM32F103VE? env:STM32F103VE env:STM32F103RE_maple #elif MB(GTM32_PRO_VB) - #include "stm32f1/pins_GTM32_PRO_VB.h" // STM32F103VE env:STM32F103VE env:STM32F103RE_maple + #include "stm32f1/pins_GTM32_PRO_VB.h" // STM32F103VE env:STM32F103VE env:STM32F103VE_GTM32_maple #elif MB(GTM32_PRO_VD) - #include "stm32f1/pins_GTM32_PRO_VD.h" // STM32F103VE env:STM32F103VE env:STM32F103RE_maple + #include "stm32f1/pins_GTM32_PRO_VD.h" // STM32F103VE env:STM32F103VE env:STM32F103VE_GTM32_maple #elif MB(GTM32_MINI) - #include "stm32f1/pins_GTM32_MINI.h" // STM32F103VE env:STM32F103VE env:STM32F103RE_maple + #include "stm32f1/pins_GTM32_MINI.h" // STM32F103VE env:STM32F103VE env:STM32F103VE_GTM32_maple #elif MB(GTM32_MINI_A30) - #include "stm32f1/pins_GTM32_MINI_A30.h" // STM32F103VE env:STM32F103VE env:STM32F103RE_maple + #include "stm32f1/pins_GTM32_MINI_A30.h" // STM32F103VE env:STM32F103VE env:STM32F103VE_GTM32_maple #elif MB(GTM32_REV_B) - #include "stm32f1/pins_GTM32_REV_B.h" // STM32F103VE env:STM32F103VE env:STM32F103RE_maple + #include "stm32f1/pins_GTM32_REV_B.h" // STM32F103VE env:STM32F103VE env:STM32F103VE_GTM32_maple #elif MB(MORPHEUS) #include "stm32f1/pins_MORPHEUS.h" // STM32F103RE env:STM32F103RE env:STM32F103RE_maple #elif MB(CHITU3D) @@ -556,7 +556,7 @@ #elif MB(LONGER3D_LK) #include "stm32f1/pins_LONGER3D_LK.h" // STM32F1 env:STM32F103VE_longer env:STM32F103VE_longer_maple #elif MB(CCROBOT_MEEB_3DP) - #include "stm32f1/pins_CCROBOT_MEEB_3DP.h" // STM32F1 env:STM32F103RC_meeb + #include "stm32f1/pins_CCROBOT_MEEB_3DP.h" // STM32F1 env:STM32F103RC_meeb_maple #elif MB(CHITU3D_V5) #include "stm32f1/pins_CHITU3D_V5.h" // STM32F1 env:chitu_f103 env:chitu_f103_maple env:chitu_v5_gpio_init env:chitu_v5_gpio_init_maple #elif MB(CHITU3D_V6) diff --git a/buildroot/share/PlatformIO/boards/marlin_CHITU_F103.json b/buildroot/share/PlatformIO/boards/marlin_maple_CHITU_F103.json similarity index 95% rename from buildroot/share/PlatformIO/boards/marlin_CHITU_F103.json rename to buildroot/share/PlatformIO/boards/marlin_maple_CHITU_F103.json index dbfbc21cb275..45c80b3ec037 100644 --- a/buildroot/share/PlatformIO/boards/marlin_CHITU_F103.json +++ b/buildroot/share/PlatformIO/boards/marlin_maple_CHITU_F103.json @@ -15,7 +15,7 @@ ] ], "mcu": "stm32f103zet6", - "variant": "marlin_CHITU_F103" + "variant": "marlin_maple_CHITU_F103" }, "debug": { "jlink_device": "STM32F103ZE", diff --git a/buildroot/share/PlatformIO/boards/marlin_MEEB_3DP.json b/buildroot/share/PlatformIO/boards/marlin_maple_MEEB_3DP.json similarity index 96% rename from buildroot/share/PlatformIO/boards/marlin_MEEB_3DP.json rename to buildroot/share/PlatformIO/boards/marlin_maple_MEEB_3DP.json index 73ec9aaf48e2..54fd5fbed950 100644 --- a/buildroot/share/PlatformIO/boards/marlin_MEEB_3DP.json +++ b/buildroot/share/PlatformIO/boards/marlin_maple_MEEB_3DP.json @@ -18,7 +18,7 @@ "ldscript": "stm32f103xc.ld" }, "mcu": "stm32f103rct6", - "variant": "marlin_MEEB_3DP" + "variant": "marlin_maple_MEEB_3DP" }, "debug": { "jlink_device": "STM32F103RC", diff --git a/buildroot/share/PlatformIO/ldscripts/fysetc_stm32f103rc.ld b/buildroot/share/PlatformIO/ldscripts/fysetc_stm32f103rc.ld deleted file mode 100644 index 6777e5918262..000000000000 --- a/buildroot/share/PlatformIO/ldscripts/fysetc_stm32f103rc.ld +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Linker script for Generic STM32F103RC boards, using the generic bootloader (which takes the lower 8k of memory) - */ - -MEMORY -{ - ram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K - rom (rx) : ORIGIN = 0x08008000, LENGTH = 256K - 32K -} - -/* Provide memory region aliases for common.inc */ -REGION_ALIAS("REGION_TEXT", rom); -REGION_ALIAS("REGION_DATA", ram); -REGION_ALIAS("REGION_BSS", ram); -REGION_ALIAS("REGION_RODATA", rom); - -/* Let common.inc handle the real work. */ -INCLUDE common.inc diff --git a/buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py b/buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py index eccee7606804..551f4c63160b 100644 --- a/buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py +++ b/buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py @@ -4,29 +4,9 @@ import pioutil if pioutil.is_pio_build(): - try: - import configparser - except ImportError: - import ConfigParser as configparser - import os Import("env", "projenv") - config = configparser.ConfigParser() - config.read("platformio.ini") - - # - # Upload actions - # - def before_upload(source, target, env): - env.Execute("pwd") - - def after_upload(source, target, env): - env.Execute("pwd") - - env.AddPreAction("upload", before_upload) - env.AddPostAction("upload", after_upload) - flash_size = 0 vect_tab_addr = 0 @@ -38,6 +18,3 @@ def after_upload(source, target, env): print('Use the {0:s} address as the marlin app entry point.'.format(vect_tab_addr)) print('Use the {0:d}KB flash version of stm32f103rct6 chip.'.format(flash_size)) - - import marlin - marlin.custom_ld_script("STM32F103RC_MEEB_3DP.ld") diff --git a/buildroot/share/PlatformIO/scripts/mks_robin.py b/buildroot/share/PlatformIO/scripts/mks_robin.py deleted file mode 100644 index 7b423bedabc7..000000000000 --- a/buildroot/share/PlatformIO/scripts/mks_robin.py +++ /dev/null @@ -1,5 +0,0 @@ -# -# mks_robin.py -# -import robin -robin.prepare("0x08007000", "mks_robin.ld", "Robin.bin") diff --git a/buildroot/share/PlatformIO/scripts/mks_robin_e3.py b/buildroot/share/PlatformIO/scripts/mks_robin_e3.py deleted file mode 100644 index 645230c625c2..000000000000 --- a/buildroot/share/PlatformIO/scripts/mks_robin_e3.py +++ /dev/null @@ -1,5 +0,0 @@ -# -# mks_robin_e3.py -# -import robin -robin.prepare("0x08005000", "mks_robin_e3.ld", "Robin_e3.bin") diff --git a/buildroot/share/PlatformIO/scripts/mks_robin_e3p.py b/buildroot/share/PlatformIO/scripts/mks_robin_e3p.py deleted file mode 100644 index bb15cb5a70f2..000000000000 --- a/buildroot/share/PlatformIO/scripts/mks_robin_e3p.py +++ /dev/null @@ -1,5 +0,0 @@ -# -# mks_robin_e3p.py -# -import robin -robin.prepare("0x08007000", "mks_robin_e3p.ld", "Robin_e3p.bin") diff --git a/buildroot/share/PlatformIO/scripts/mks_robin_lite.py b/buildroot/share/PlatformIO/scripts/mks_robin_lite.py deleted file mode 100644 index 123b043f7cfb..000000000000 --- a/buildroot/share/PlatformIO/scripts/mks_robin_lite.py +++ /dev/null @@ -1,5 +0,0 @@ -# -# mks_robin_lite.py -# -import robin -robin.prepare("0x08005000", "mks_robin_lite.ld", "mksLite.bin") diff --git a/buildroot/share/PlatformIO/scripts/mks_robin_lite3.py b/buildroot/share/PlatformIO/scripts/mks_robin_lite3.py deleted file mode 100644 index 092231eae81f..000000000000 --- a/buildroot/share/PlatformIO/scripts/mks_robin_lite3.py +++ /dev/null @@ -1,5 +0,0 @@ -# -# mks_robin_lite3.py -# -import robin -robin.prepare("0x08005000", "mks_robin_lite.ld", "mksLite3.bin") diff --git a/buildroot/share/PlatformIO/scripts/mks_robin_mini.py b/buildroot/share/PlatformIO/scripts/mks_robin_mini.py deleted file mode 100644 index d1d175dd1c17..000000000000 --- a/buildroot/share/PlatformIO/scripts/mks_robin_mini.py +++ /dev/null @@ -1,5 +0,0 @@ -# -# mks_robin_mini.py -# -import robin -robin.prepare("0x08007000", "mks_robin_mini.ld", "Robin_mini.bin") diff --git a/buildroot/share/PlatformIO/scripts/mks_robin_nano.py b/buildroot/share/PlatformIO/scripts/mks_robin_nano.py deleted file mode 100644 index 32d1af23662c..000000000000 --- a/buildroot/share/PlatformIO/scripts/mks_robin_nano.py +++ /dev/null @@ -1,5 +0,0 @@ -# -# mks_robin_nano.py -# -import robin -robin.prepare("0x08007000", "mks_robin_nano.ld", "Robin_nano.bin") diff --git a/buildroot/share/PlatformIO/scripts/mks_robin_nano35.py b/buildroot/share/PlatformIO/scripts/mks_robin_nano35.py deleted file mode 100644 index 7e635bd6ecf7..000000000000 --- a/buildroot/share/PlatformIO/scripts/mks_robin_nano35.py +++ /dev/null @@ -1,5 +0,0 @@ -# -# mks_robin_nano35.py -# -import robin -robin.prepare("0x08007000", "mks_robin_nano.ld", "Robin_nano35.bin") diff --git a/buildroot/share/PlatformIO/scripts/mks_robin_pro.py b/buildroot/share/PlatformIO/scripts/mks_robin_pro.py deleted file mode 100644 index 54526aeaef57..000000000000 --- a/buildroot/share/PlatformIO/scripts/mks_robin_pro.py +++ /dev/null @@ -1,5 +0,0 @@ -# -# mks_robin_pro.py -# -import robin -robin.prepare("0x08007000", "mks_robin_pro.ld", "Robin_pro.bin") diff --git a/buildroot/share/PlatformIO/scripts/robin.py b/buildroot/share/PlatformIO/scripts/robin.py deleted file mode 100644 index ffc9a43b9004..000000000000 --- a/buildroot/share/PlatformIO/scripts/robin.py +++ /dev/null @@ -1,14 +0,0 @@ -# -# robin.py -# - -# Apply customizations for a MKS Robin -def prepare(address, ldname, fwname): - import pioutil - if pioutil.is_pio_build(): - import marlin - def encrypt(source, target, env): - marlin.encrypt_mks(source, target, env, fwname) - marlin.relocate_firmware(address) - marlin.custom_ld_script(ldname) - marlin.add_post_action(encrypt); diff --git a/buildroot/share/PlatformIO/variants/marlin_CHITU_F103/board.cpp b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/board.cpp similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_CHITU_F103/board.cpp rename to buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/board.cpp diff --git a/buildroot/share/PlatformIO/variants/marlin_CHITU_F103/board/board.h b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/board/board.h similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_CHITU_F103/board/board.h rename to buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/board/board.h diff --git a/buildroot/share/PlatformIO/variants/marlin_CHITU_F103/ld/common.inc b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/common.inc similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_CHITU_F103/ld/common.inc rename to buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/common.inc diff --git a/buildroot/share/PlatformIO/variants/marlin_CHITU_F103/ld/extra_libs.inc b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/extra_libs.inc similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_CHITU_F103/ld/extra_libs.inc rename to buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/extra_libs.inc diff --git a/buildroot/share/PlatformIO/variants/marlin_CHITU_F103/ld/flash.ld b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/flash.ld similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_CHITU_F103/ld/flash.ld rename to buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/flash.ld diff --git a/buildroot/share/PlatformIO/variants/marlin_CHITU_F103/ld/stm32f103z_dfu.ld b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/stm32f103z_dfu.ld similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_CHITU_F103/ld/stm32f103z_dfu.ld rename to buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/stm32f103z_dfu.ld diff --git a/buildroot/share/PlatformIO/variants/marlin_CHITU_F103/ld/stm32f103zc.ld b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/stm32f103zc.ld similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_CHITU_F103/ld/stm32f103zc.ld rename to buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/stm32f103zc.ld diff --git a/buildroot/share/PlatformIO/variants/marlin_CHITU_F103/ld/stm32f103zd.ld b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/stm32f103zd.ld similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_CHITU_F103/ld/stm32f103zd.ld rename to buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/stm32f103zd.ld diff --git a/buildroot/share/PlatformIO/variants/marlin_CHITU_F103/ld/stm32f103ze.ld b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/stm32f103ze.ld similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_CHITU_F103/ld/stm32f103ze.ld rename to buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/stm32f103ze.ld diff --git a/buildroot/share/PlatformIO/variants/marlin_CHITU_F103/ld/vector_symbols.inc b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/vector_symbols.inc similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_CHITU_F103/ld/vector_symbols.inc rename to buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/vector_symbols.inc diff --git a/buildroot/share/PlatformIO/variants/marlin_CHITU_F103/pins_arduino.h b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/pins_arduino.h similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_CHITU_F103/pins_arduino.h rename to buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/pins_arduino.h diff --git a/buildroot/share/PlatformIO/variants/marlin_CHITU_F103/variant.h b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/variant.h similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_CHITU_F103/variant.h rename to buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/variant.h diff --git a/buildroot/share/PlatformIO/variants/marlin_CHITU_F103/wirish/boards.cpp b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/wirish/boards.cpp similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_CHITU_F103/wirish/boards.cpp rename to buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/wirish/boards.cpp diff --git a/buildroot/share/PlatformIO/variants/marlin_CHITU_F103/wirish/boards_setup.cpp b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/wirish/boards_setup.cpp similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_CHITU_F103/wirish/boards_setup.cpp rename to buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/wirish/boards_setup.cpp diff --git a/buildroot/share/PlatformIO/variants/marlin_CHITU_F103/wirish/start.S b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/wirish/start.S similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_CHITU_F103/wirish/start.S rename to buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/wirish/start.S diff --git a/buildroot/share/PlatformIO/variants/marlin_CHITU_F103/wirish/start_c.c b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/wirish/start_c.c similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_CHITU_F103/wirish/start_c.c rename to buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/wirish/start_c.c diff --git a/buildroot/share/PlatformIO/variants/marlin_CHITU_F103/wirish/syscalls.c b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/wirish/syscalls.c similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_CHITU_F103/wirish/syscalls.c rename to buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/wirish/syscalls.c diff --git a/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/board.cpp b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/board.cpp similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/board.cpp rename to buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/board.cpp diff --git a/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/board/board.h b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/board/board.h similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/board/board.h rename to buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/board/board.h diff --git a/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/bootloader.ld b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/bootloader.ld similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/bootloader.ld rename to buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/bootloader.ld diff --git a/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/common.inc b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/common.inc similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/common.inc rename to buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/common.inc diff --git a/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/extra_libs.inc b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/extra_libs.inc similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/extra_libs.inc rename to buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/extra_libs.inc diff --git a/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/flash.ld b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/flash.ld similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/flash.ld rename to buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/flash.ld diff --git a/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/jtag.ld b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/jtag.ld similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/jtag.ld rename to buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/jtag.ld diff --git a/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/mem-flash.inc b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/mem-flash.inc similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/mem-flash.inc rename to buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/mem-flash.inc diff --git a/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/mem-jtag.inc b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/mem-jtag.inc similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/mem-jtag.inc rename to buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/mem-jtag.inc diff --git a/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/mem-ram.inc b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/mem-ram.inc similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/mem-ram.inc rename to buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/mem-ram.inc diff --git a/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/ram.ld b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/ram.ld similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/ram.ld rename to buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/ram.ld diff --git a/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/stm32f103rb.ld b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/stm32f103rb.ld similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/stm32f103rb.ld rename to buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/stm32f103rb.ld diff --git a/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/stm32f103rb_bootloader.ld b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/stm32f103rb_bootloader.ld similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/stm32f103rb_bootloader.ld rename to buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/stm32f103rb_bootloader.ld diff --git a/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/stm32f103rc.ld b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/stm32f103rc.ld similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/stm32f103rc.ld rename to buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/stm32f103rc.ld diff --git a/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/stm32f103rc_bootloader.ld b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/stm32f103rc_bootloader.ld similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/stm32f103rc_bootloader.ld rename to buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/stm32f103rc_bootloader.ld diff --git a/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/stm32f103re.ld b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/stm32f103re.ld similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/stm32f103re.ld rename to buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/stm32f103re.ld diff --git a/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/vector_symbols.inc b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/vector_symbols.inc similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/vector_symbols.inc rename to buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/ld/vector_symbols.inc diff --git a/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/pins_arduino.h b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/pins_arduino.h similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/pins_arduino.h rename to buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/pins_arduino.h diff --git a/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/variant.h b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/variant.h similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/variant.h rename to buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/variant.h diff --git a/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/wirish/boards.cpp b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/wirish/boards.cpp similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/wirish/boards.cpp rename to buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/wirish/boards.cpp diff --git a/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/wirish/boards_setup.cpp b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/wirish/boards_setup.cpp similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/wirish/boards_setup.cpp rename to buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/wirish/boards_setup.cpp diff --git a/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/wirish/start.S b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/wirish/start.S similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/wirish/start.S rename to buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/wirish/start.S diff --git a/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/wirish/start_c.c b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/wirish/start_c.c similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/wirish/start_c.c rename to buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/wirish/start_c.c diff --git a/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/wirish/syscalls.c b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/wirish/syscalls.c similarity index 100% rename from buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/wirish/syscalls.c rename to buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/wirish/syscalls.c diff --git a/buildroot/tests/STM32F103RC_meeb b/buildroot/tests/STM32F103RC_meeb_maple similarity index 100% rename from buildroot/tests/STM32F103RC_meeb rename to buildroot/tests/STM32F103RC_meeb_maple diff --git a/ini/renamed.ini b/ini/renamed.ini index b325476d2f9e..75f5dc3accc7 100644 --- a/ini/renamed.ini +++ b/ini/renamed.ini @@ -48,3 +48,11 @@ extends = renamed [env:STM32F103RC_btt_512K_USB_maple] # Renamed to STM32F103RE_btt_USB_maple extends = renamed + +[env:STM32F103RC_meeb] +# Renamed to STM32F103RC_meeb_maple +extends = renamed + +[env:STM32F103VE_GTM32] +# Renamed to STM32F103VE_GTM32_maple +extends = renamed diff --git a/ini/stm32f1-maple.ini b/ini/stm32f1-maple.ini index bfa82876286e..18c861ba1ebe 100644 --- a/ini/stm32f1-maple.ini +++ b/ini/stm32f1-maple.ini @@ -22,7 +22,7 @@ # # HAL/STM32F1 Common Environment values # -[common_stm32f1] +[STM32F1_maple] platform = ststm32@~12.1 board_build.core = maple build_flags = !python Marlin/src/HAL/STM32F1/build_flags.py @@ -34,52 +34,62 @@ lib_deps = ${common.lib_deps} SoftwareSerialM platform_packages = tool-stm32duino extra_scripts = ${common.extra_scripts} - pre:buildroot/share/PlatformIO/scripts/fix_framework_weakness.py - pre:buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py - buildroot/share/PlatformIO/scripts/offset_and_rename.py + pre:buildroot/share/PlatformIO/scripts/fix_framework_weakness.py + pre:buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py + buildroot/share/PlatformIO/scripts/custom_board.py + buildroot/share/PlatformIO/scripts/offset_and_rename.py # -# STM32F103RC +# Generic STM32F103RC environment # -[common_STM32F103RC_maple] -extends = common_stm32f1 -board = genericSTM32F103RC -monitor_speed = 115200 +[env:STM32F103RC_maple] +extends = STM32F1_maple +board = genericSTM32F103RC +monitor_speed = 115200 + +# +# Generic STM32F103RE environment +# +[env:STM32F103RE_maple] +extends = STM32F1_maple +board = genericSTM32F103RE +monitor_speed = 115200 # # MEEB_3DP (STM32F103RCT6 with 512K) # -[env:STM32F103RC_meeb] -extends = common_STM32F103RC_maple -board = marlin_MEEB_3DP -build_flags = ${common_stm32f1.build_flags} - -DDEBUG_LEVEL=0 - -DSS_TIMER=4 - -DSTM32_FLASH_SIZE=512 - -DHSE_VALUE=12000000U - -DUSE_USB_COMPOSITE - -DVECT_TAB_OFFSET=0x2000 - -DGENERIC_BOOTLOADER -extra_scripts = ${common_stm32f1.extra_scripts} - pre:buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py - buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py -lib_deps = ${common_stm32f1.lib_deps} - USBComposite for STM32F1@0.91 +[env:STM32F103RC_meeb_maple] +extends = env:STM32F103RC_maple +board = marlin_maple_MEEB_3DP +build_flags = ${STM32F1_maple.build_flags} + -DDEBUG_LEVEL=0 + -DSS_TIMER=4 + -DSTM32_FLASH_SIZE=512 + -DHSE_VALUE=12000000U + -DUSE_USB_COMPOSITE + -DVECT_TAB_OFFSET=0x2000 + -DGENERIC_BOOTLOADER +board_build.ldscript = STM32F103RC_MEEB_3DP.ld +extra_scripts = ${STM32F1_maple.extra_scripts} + pre:buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py + buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py +lib_deps = ${STM32F1_maple.lib_deps} + USBComposite for STM32F1@0.91 custom_marlin.NEOPIXEL_LED = Adafruit NeoPixel=https://github.com/ccccmagicboy/Adafruit_NeoPixel#meeb_3dp_use -debug_tool = stlink -upload_protocol = dfu +debug_tool = stlink +upload_protocol = dfu # # FYSETC STM32F103RC # [env:STM32F103RC_fysetc_maple] -extends = common_STM32F103RC_maple -extra_scripts = ${common_stm32f1.extra_scripts} - buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py -build_flags = ${common_stm32f1.build_flags} -DDEBUG_LEVEL=0 -lib_ldf_mode = chain -debug_tool = stlink -upload_protocol = serial +extends = env:STM32F103RC_maple +extra_scripts = ${STM32F1_maple.extra_scripts} + buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py +build_flags = ${STM32F1_maple.build_flags} -DDEBUG_LEVEL=0 +lib_ldf_mode = chain +debug_tool = stlink +upload_protocol = serial # # BigTree SKR Mini V1.1 / SKR Mini E3 & MZ (STM32F103RCT6 ARM Cortex-M3) @@ -88,48 +98,28 @@ upload_protocol = serial # STM32F103RC_btt_USB_maple ......... RCT6 with 256K (USB mass storage) # [env:STM32F103RC_btt_maple] -extends = common_STM32F103RC_maple +extends = env:STM32F103RC_maple board_build.address = 0x08007000 board_build.ldscript = STM32F103RC_SKR_MINI_256K.ld -extra_scripts = ${common_stm32f1.extra_scripts} - buildroot/share/PlatformIO/scripts/custom_board.py -build_flags = ${common_stm32f1.build_flags} - -DDEBUG_LEVEL=0 -DSS_TIMER=4 +build_flags = ${STM32F1_maple.build_flags} -DDEBUG_LEVEL=0 -DSS_TIMER=4 monitor_speed = 115200 [env:STM32F103RC_btt_USB_maple] -extends = env:STM32F103RC_btt_maple -build_flags = ${env:STM32F103RC_btt_maple.build_flags} -DUSE_USB_COMPOSITE -lib_deps = ${env:STM32F103RC_btt_maple.lib_deps} - USBComposite for STM32F1@0.91 - -# -# Generic STM32F103RE environment -# -[env:STM32F103RE_maple] -extends = common_stm32f1 -board = genericSTM32F103RE -monitor_speed = 115200 - -# -# Generic STM32F103RC environment -# -[env:STM32F103RC_maple] -extends = common_stm32f1 -board = genericSTM32F103RC -monitor_speed = 115200 +extends = env:STM32F103RC_btt_maple +build_flags = ${env:STM32F103RC_btt_maple.build_flags} -DUSE_USB_COMPOSITE +lib_deps = ${env:STM32F103RC_btt_maple.lib_deps} + USBComposite for STM32F1@0.91 # # Creality (STM32F103RET6) # [env:STM32F103RE_creality_maple] extends = env:STM32F103RE_maple -build_flags = ${common_stm32f1.build_flags} -DTEMP_TIMER_CHAN=4 +build_flags = ${STM32F1_maple.build_flags} -DTEMP_TIMER_CHAN=4 board_build.address = 0x08007000 board_build.ldscript = creality.ld -extra_scripts = ${common_stm32f1.extra_scripts} - pre:buildroot/share/PlatformIO/scripts/random-bin.py - buildroot/share/PlatformIO/scripts/custom_board.py +extra_scripts = ${STM32F1_maple.extra_scripts} + pre:buildroot/share/PlatformIO/scripts/random-bin.py debug_tool = jlink upload_protocol = jlink @@ -138,12 +128,11 @@ upload_protocol = jlink # [env:STM32F103RC_creality_maple] extends = env:STM32F103RC_maple -build_flags = ${common_stm32f1.build_flags} -DTEMP_TIMER_CHAN=4 +build_flags = ${STM32F1_maple.build_flags} -DTEMP_TIMER_CHAN=4 board_build.address = 0x08007000 board_build.ldscript = creality.ld -extra_scripts = ${common_stm32f1.extra_scripts} - pre:buildroot/share/PlatformIO/scripts/random-bin.py - buildroot/share/PlatformIO/scripts/custom_board.py +extra_scripts = ${STM32F1_maple.extra_scripts} + pre:buildroot/share/PlatformIO/scripts/random-bin.py debug_tool = jlink upload_protocol = jlink @@ -162,204 +151,197 @@ board_build.ldscript = crealityPro.ld # STM32F103RE_btt_USB_maple ......... RET6 (USB mass storage) # [env:STM32F103RE_btt_maple] -extends = env:STM32F103RE_maple +extends = env:STM32F103RE_maple board_build.address = 0x08007000 board_build.ldscript = STM32F103RE_SKR_MINI_512K.ld -extra_scripts = ${common_stm32f1.extra_scripts} - buildroot/share/PlatformIO/scripts/custom_board.py -build_flags = ${common_stm32f1.build_flags} -DDEBUG_LEVEL=0 -DSS_TIMER=4 -debug_tool = stlink -upload_protocol = stlink +build_flags = ${STM32F1_maple.build_flags} -DDEBUG_LEVEL=0 -DSS_TIMER=4 +debug_tool = stlink +upload_protocol = stlink [env:STM32F103RE_btt_USB_maple] -extends = env:STM32F103RE_btt_maple -build_flags = ${env:STM32F103RE_btt_maple.build_flags} -DUSE_USB_COMPOSITE -lib_deps = ${common_stm32f1.lib_deps} - USBComposite for STM32F1@0.91 +extends = env:STM32F103RE_btt_maple +build_flags = ${env:STM32F103RE_btt_maple.build_flags} -DUSE_USB_COMPOSITE +lib_deps = ${STM32F1_maple.lib_deps} + USBComposite for STM32F1@0.91 # # Geeetech GTM32 (STM32F103VET6) # -[env:STM32F103VE_GTM32] -extends = common_stm32f1 +[env:STM32F103VE_GTM32_maple] +extends = STM32F1_maple board = genericSTM32F103VE -build_flags = ${common_stm32f1.build_flags} - -ffunction-sections -fdata-sections -nostdlib -MMD - -DMCU_STM32F103VE -DARDUINO_GENERIC_STM32F103V -DARDUINO_ARCH_STM32F1 -DBOARD_generic_stm32f103v - -DDEBUG_LEVEL=DEBUG_NONE -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DVECT_TAB_ADDR=0x8000000 - -DERROR_LED_PORT=GPIOE -DERROR_LED_PIN=6 +build_flags = ${STM32F1_maple.build_flags} + -ffunction-sections -fdata-sections -nostdlib -MMD + -DMCU_STM32F103VE -DARDUINO_GENERIC_STM32F103V -DARDUINO_ARCH_STM32F1 -DBOARD_generic_stm32f103v + -DDEBUG_LEVEL=DEBUG_NONE -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DVECT_TAB_ADDR=0x8000000 + -DERROR_LED_PORT=GPIOE -DERROR_LED_PIN=6 upload_protocol = serial # # Longer 3D board in Alfawise U20 (STM32F103VET6) # [env:STM32F103VE_longer_maple] -extends = common_stm32f1 -board = genericSTM32F103VE +extends = STM32F1_maple +board = genericSTM32F103VE board_build.address = 0x08010000 board_build.rename = project.bin board_build.ldscript = STM32F103VE_longer.ld -extra_scripts = ${common_stm32f1.extra_scripts} - buildroot/share/PlatformIO/scripts/custom_board.py -build_flags = ${common_stm32f1.build_flags} - -DMCU_STM32F103VE -DSTM32F1xx -USERIAL_USB -DU20 -DTS_V12 -build_unflags = ${common_stm32f1.build_unflags} - -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DERROR_LED_PORT=GPIOE -DERROR_LED_PIN=6 +build_flags = ${STM32F1_maple.build_flags} + -DMCU_STM32F103VE -DSTM32F1xx -USERIAL_USB -DU20 -DTS_V12 +build_unflags = ${STM32F1_maple.build_unflags} + -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DERROR_LED_PORT=GPIOE -DERROR_LED_PIN=6 # # MKS Robin Mini (STM32F103VET6) # [env:mks_robin_mini_maple] -extends = common_stm32f1 -board = genericSTM32F103VE -extra_scripts = ${common_stm32f1.extra_scripts} - buildroot/share/PlatformIO/scripts/mks_robin_mini.py -build_flags = ${common_stm32f1.build_flags} - -DMCU_STM32F103VE +extends = STM32F1_maple +board = genericSTM32F103VE +board_build.address = 0x08007000 +board_build.rename = Robin_mini.bin +board_build.ldscript = mks_robin_mini.ld +build_flags = ${STM32F1_maple.build_flags} -DMCU_STM32F103VE # # MKS Robin Nano (STM32F103VET6) # [env:mks_robin_nano35_maple] -extends = common_stm32f1 -board = genericSTM32F103VE -extra_scripts = ${common_stm32f1.extra_scripts} - buildroot/share/PlatformIO/scripts/mks_robin_nano35.py -build_flags = ${common_stm32f1.build_flags} - -DMCU_STM32F103VE -DSS_TIMER=4 -debug_tool = jlink -upload_protocol = jlink +extends = STM32F1_maple +board = genericSTM32F103VE +board_build.address = 0x08007000 +board_build.rename = Robin_nano35.bin +board_build.ldscript = mks_robin_nano.ld +build_flags = ${STM32F1_maple.build_flags} -DMCU_STM32F103VE -DSS_TIMER=4 +debug_tool = jlink +upload_protocol = jlink # # MKS Robin (STM32F103ZET6) # [env:mks_robin_maple] -extends = common_stm32f1 -board = genericSTM32F103ZE -extra_scripts = ${common_stm32f1.extra_scripts} - buildroot/share/PlatformIO/scripts/mks_robin.py -build_flags = ${common_stm32f1.build_flags} - -DSS_TIMER=4 -DSTM32_XL_DENSITY +extends = STM32F1_maple +board = genericSTM32F103ZE +board_build.address = 0x08007000 +board_build.rename = Robin.bin +board_build.ldscript = mks_robin.ld +build_flags = ${STM32F1_maple.build_flags} -DSS_TIMER=4 -DSTM32_XL_DENSITY # # MKS Robin Pro (STM32F103ZET6) # [env:mks_robin_pro_maple] -extends = env:mks_robin_maple -extra_scripts = ${common_stm32f1.extra_scripts} - buildroot/share/PlatformIO/scripts/mks_robin_pro.py +extends = env:mks_robin_maple +board_build.address = 0x08007000 +board_build.rename = Robin_pro.bin +board_build.ldscript = mks_robin_pro.ld # # TRIGORILLA PRO (STM32F103ZET6) # [env:trigorilla_pro_maple] extends = env:mks_robin_maple -extra_scripts = ${common_stm32f1.extra_scripts} +extra_scripts = ${STM32F1_maple.extra_scripts} # # MKS Robin E3D (STM32F103RCT6) and # MKS Robin E3 with TMC2209 # [env:mks_robin_e3_maple] -extends = common_stm32f1 -board = genericSTM32F103RC -extra_scripts = ${common_stm32f1.extra_scripts} - buildroot/share/PlatformIO/scripts/mks_robin_e3.py -build_flags = ${common_stm32f1.build_flags} - -DDEBUG_LEVEL=0 -DSS_TIMER=4 +extends = STM32F1_maple +board = genericSTM32F103RC +board_build.address = 0x08005000 +board_build.rename = Robin_e3.bin +board_build.ldscript = mks_robin_e3.ld +build_flags = ${STM32F1_maple.build_flags} -DDEBUG_LEVEL=0 -DSS_TIMER=4 # # MKS Robin E3p (STM32F103VET6) # - LVGL UI # [env:mks_robin_e3p_maple] -extends = common_stm32f1 -board = genericSTM32F103VE -extra_scripts = ${common_stm32f1.extra_scripts} - buildroot/share/PlatformIO/scripts/mks_robin_e3p.py -build_flags = ${common_stm32f1.build_flags} - -DMCU_STM32F103VE -DSS_TIMER=4 -debug_tool = jlink -upload_protocol = jlink +extends = STM32F1_maple +board = genericSTM32F103VE +board_build.address = 0x08007000 +board_build.rename = Robin_e3p.bin +board_build.ldscript = mks_robin_e3p.ld +build_flags = ${STM32F1_maple.build_flags} -DMCU_STM32F103VE -DSS_TIMER=4 +debug_tool = jlink +upload_protocol = jlink # # MKS Robin Lite/Lite2 (STM32F103RCT6) # [env:mks_robin_lite_maple] -extends = common_stm32f1 -board = genericSTM32F103RC -extra_scripts = ${common_stm32f1.extra_scripts} - buildroot/share/PlatformIO/scripts/mks_robin_lite.py +extends = STM32F1_maple +board = genericSTM32F103RC +board_build.address = 0x08005000 +board_build.rename = mksLite.bin +board_build.ldscript = mks_robin_lite.ld # # MKS ROBIN LITE3 (STM32F103RCT6) # [env:mks_robin_lite3_maple] -extends = common_stm32f1 -board = genericSTM32F103RC -extra_scripts = ${common_stm32f1.extra_scripts} - buildroot/share/PlatformIO/scripts/mks_robin_lite3.py +extends = STM32F1_maple +board = genericSTM32F103RC +board_build.address = 0x08005000 +board_build.rename = mksLite3.bin +board_build.ldscript = mks_robin_lite.ld # # JGAurora A5S A1 (STM32F103ZET6) # [env:jgaurora_a5s_a1_maple] -extends = common_stm32f1 -board = genericSTM32F103ZE +extends = STM32F1_maple +board = genericSTM32F103ZE board_build.address = 0x0800A000 board_build.ldscript = jgaurora_a5s_a1.ld -extra_scripts = ${common_stm32f1.extra_scripts} - buildroot/share/PlatformIO/scripts/custom_board.py - buildroot/share/PlatformIO/scripts/jgaurora_a5s_a1_with_bootloader.py -build_flags = ${common_stm32f1.build_flags} - -DSTM32F1xx -DSTM32_XL_DENSITY +extra_scripts = ${STM32F1_maple.extra_scripts} + buildroot/share/PlatformIO/scripts/jgaurora_a5s_a1_with_bootloader.py +build_flags = ${STM32F1_maple.build_flags} -DSTM32F1xx -DSTM32_XL_DENSITY # # Malyan M200 (STM32F103CB) # [env:STM32F103CB_malyan_maple] -extends = common_stm32f1 -board = marlin_malyanM200 -build_flags = ${common_stm32f1.build_flags} - -DMCU_STM32F103CB -D__STM32F1__=1 -std=c++1y -DSERIAL_USB -ffunction-sections -fdata-sections - -Wl,--gc-sections -DDEBUG_LEVEL=0 -D__MARLIN_FIRMWARE__ -lib_ignore = ${common_stm32f1.lib_ignore} - SoftwareSerialM +extends = STM32F1_maple +board = marlin_malyanM200 +build_flags = ${STM32F1_maple.build_flags} + -DMCU_STM32F103CB -D__STM32F1__=1 -std=c++1y -DSERIAL_USB -ffunction-sections -fdata-sections + -Wl,--gc-sections -DDEBUG_LEVEL=0 -D__MARLIN_FIRMWARE__ +lib_ignore = ${STM32F1_maple.lib_ignore} + SoftwareSerialM # # Chitu boards like Tronxy X5s (STM32F103ZET6) # [env:chitu_f103_maple] -extends = common_stm32f1 -board = marlin_CHITU_F103 -extra_scripts = ${common_stm32f1.extra_scripts} - pre:buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py - buildroot/share/PlatformIO/scripts/chitu_crypt.py -build_flags = ${common_stm32f1.build_flags} - -DSTM32F1xx -DSTM32_XL_DENSITY -build_unflags = ${common_stm32f1.build_unflags} - -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG= -DERROR_LED_PORT=GPIOE -DERROR_LED_PIN=6 +extends = STM32F1_maple +board = marlin_maple_CHITU_F103 +extra_scripts = ${STM32F1_maple.extra_scripts} + pre:buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py + buildroot/share/PlatformIO/scripts/chitu_crypt.py +build_flags = ${STM32F1_maple.build_flags} -DSTM32F1xx -DSTM32_XL_DENSITY +build_unflags = ${STM32F1_maple.build_unflags} + -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG= -DERROR_LED_PORT=GPIOE -DERROR_LED_PIN=6 # # Some Chitu V5 boards have a problem with GPIO init. # Use this target if G28 or G29 are always failing. # [env:chitu_v5_gpio_init_maple] -extends = env:chitu_f103_maple -build_flags = ${env:chitu_f103_maple.build_flags} -DCHITU_V5_Z_MIN_BUGFIX +extends = env:chitu_f103_maple +build_flags = ${env:chitu_f103_maple.build_flags} -DCHITU_V5_Z_MIN_BUGFIX # # FLYmaker FLY Mini (STM32F103RCT6) # [env:FLY_MINI_maple] -extends = common_stm32f1 -board = genericSTM32F103RC +extends = STM32F1_maple +board = genericSTM32F103RC board_build.address = 0x08005000 board_build.ldscript = fly_mini.ld -extra_scripts = ${common_stm32f1.extra_scripts} - buildroot/share/PlatformIO/scripts/custom_board.py -build_flags = ${common_stm32f1.build_flags} - -DDEBUG_LEVEL=0 -DSS_TIMER=4 +build_flags = ${STM32F1_maple.build_flags} -DDEBUG_LEVEL=0 -DSS_TIMER=4 # # Zonestar ZM3E2 V1.0 / ZM3E4 V1.0 / ZM3E4 V2.0 @@ -369,18 +351,15 @@ build_flags = ${common_stm32f1.build_flags} # STM32F103VE_ZM3E4V2_USB_maple ......... VET6 with 512K # [ZONESTAR_ZM3E_maple] -extends = common_stm32f1 +extends = STM32F1_maple platform_packages = tool-stm32duino board_build.address = 0x08005000 board_build.offset = 0x5000 board_upload.maximum_size = 237568 -extra_scripts = ${common.extra_scripts} - buildroot/share/PlatformIO/scripts/custom_board.py - buildroot/share/PlatformIO/scripts/offset_and_rename.py -build_flags = ${common_stm32f1.build_flags} - -D__STM32F1__=1 -DDEBUG_LEVEL=0 -DSS_TIMER=4 -DSERIAL_USB -lib_deps = ${common_stm32f1.lib_deps} - USBComposite for STM32F1@0.91 +build_flags = ${STM32F1_maple.build_flags} + -D__STM32F1__=1 -DDEBUG_LEVEL=0 -DSS_TIMER=4 -DSERIAL_USB +lib_deps = ${STM32F1_maple.lib_deps} + USBComposite for STM32F1@0.91 lib_ignore = Adafruit NeoPixel, SPI, SailfishLCD, SailfishRGB_LED, SlowSoftI2CMaster, TMCStepper [env:STM32F103RC_ZM3E2_USB_maple] @@ -395,26 +374,24 @@ board_build.ldscript = ZONESTAR_ZM3E_256K.ld build_flags = ${ZONESTAR_ZM3E_maple.build_flags} -DTONE_TIMER=1 -DTONE_CHANNEL=2 [env:STM32F103VE_ZM3E4V2_USB_maple] -extends = ZONESTAR_ZM3E_maple -board = genericSTM32F103VE -board_build.ldscript = ZONESTAR_ZM3E_512K.ld -build_flags = ${ZONESTAR_ZM3E_maple.build_flags} -DTONE_TIMER=1 -DTONE_CHANNEL=2 +extends = ZONESTAR_ZM3E_maple +board = genericSTM32F103VE +board_build.ldscript = ZONESTAR_ZM3E_512K.ld +build_flags = ${ZONESTAR_ZM3E_maple.build_flags} -DTONE_TIMER=1 -DTONE_CHANNEL=2 board_upload.maximum_size = 499712 # # ERYONE ERY32 Mini (STM32F103VET6) # [env:ERYONE_ERY32_MINI_maple] -extends = common_stm32f1 +extends = STM32F1_maple board = genericSTM32F103VE -build_flags = ${common_stm32f1.build_flags} - -ffunction-sections -fdata-sections -nostdlib -MMD - -DMCU_STM32F103VE -DARDUINO_GENERIC_STM32F103V -DARDUINO_ARCH_STM32F1 - -DDEBUG_LEVEL=DEBUG_NONE -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 - -DSS_TIMER=4 +build_flags = ${STM32F1_maple.build_flags} + -ffunction-sections -fdata-sections -nostdlib -MMD + -DMCU_STM32F103VE -DARDUINO_GENERIC_STM32F103V -DARDUINO_ARCH_STM32F1 + -DDEBUG_LEVEL=DEBUG_NONE -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 + -DSS_TIMER=4 board_build.variant = MARLIN_F103Vx board_build.ldscript = eryone_ery32_mini.ld board_build.address = 0x08004000 -build_unflags = ${common_stm32f1.build_unflags} -extra_scripts = ${common_stm32f1.extra_scripts} - buildroot/share/PlatformIO/scripts/custom_board.py +build_unflags = ${STM32F1_maple.build_unflags} From 12da2e92882a67d29456f02882ff1ee747191939 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 14 May 2022 15:31:51 -0500 Subject: [PATCH 078/241] =?UTF-8?q?=F0=9F=8E=A8=20Minor=20HAL=20cleanup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/AVR/HAL.cpp | 4 +++ Marlin/src/HAL/AVR/HAL.h | 2 +- Marlin/src/HAL/DUE/HAL.cpp | 15 ++++++++--- Marlin/src/HAL/DUE/HAL_SPI.cpp | 2 -- Marlin/src/HAL/HAL.h | 1 + Marlin/src/HAL/LPC1768/HAL.h | 2 +- Marlin/src/HAL/NATIVE_SIM/HAL.h | 2 +- Marlin/src/HAL/STM32/HAL.cpp | 5 ++-- Marlin/src/HAL/STM32F1/HAL.cpp | 9 +++++-- Marlin/src/HAL/TEENSY31_32/HAL.cpp | 40 ++++++++++++++-------------- Marlin/src/HAL/TEENSY35_36/HAL.cpp | 42 +++++++++++++++--------------- Marlin/src/HAL/TEENSY35_36/HAL.h | 2 +- Marlin/src/HAL/TEENSY40_41/HAL.cpp | 40 ++++++++++++++-------------- Marlin/src/HAL/TEENSY40_41/HAL.h | 2 +- Marlin/src/inc/MarlinConfig.h | 1 - 15 files changed, 94 insertions(+), 75 deletions(-) diff --git a/Marlin/src/HAL/AVR/HAL.cpp b/Marlin/src/HAL/AVR/HAL.cpp index 7c39c5200b4d..0527f3d8c5df 100644 --- a/Marlin/src/HAL/AVR/HAL.cpp +++ b/Marlin/src/HAL/AVR/HAL.cpp @@ -88,6 +88,10 @@ void MarlinHAL::reboot() { #endif } +// ------------------------ +// Free Memory Accessor +// ------------------------ + #if ENABLED(SDSUPPORT) #include "../../sd/SdFatUtil.h" diff --git a/Marlin/src/HAL/AVR/HAL.h b/Marlin/src/HAL/AVR/HAL.h index b96169b2edfb..b2995b90cfde 100644 --- a/Marlin/src/HAL/AVR/HAL.h +++ b/Marlin/src/HAL/AVR/HAL.h @@ -167,7 +167,7 @@ typedef Servo hal_servo_t; #define strtof strtod // ------------------------ -// Class Utilities +// Free Memory Accessor // ------------------------ #pragma GCC diagnostic push diff --git a/Marlin/src/HAL/DUE/HAL.cpp b/Marlin/src/HAL/DUE/HAL.cpp index bbd13dc05aac..39a28359e5da 100644 --- a/Marlin/src/HAL/DUE/HAL.cpp +++ b/Marlin/src/HAL/DUE/HAL.cpp @@ -40,14 +40,15 @@ uint16_t MarlinHAL::adc_result; // Public functions // ------------------------ -TERN_(POSTMORTEM_DEBUGGING, extern void install_min_serial()); +#if ENABLED(POSTMORTEM_DEBUGGING) + extern void install_min_serial(); +#endif void MarlinHAL::init() { - // Initialize the USB stack #if ENABLED(SDSUPPORT) OUT_WRITE(SDSS, HIGH); // Try to set SDSS inactive before any other SPI users start up #endif - usb_task_init(); + usb_task_init(); // Initialize the USB stack TERN_(POSTMORTEM_DEBUGGING, install_min_serial()); // Install the min serial handler } @@ -72,6 +73,10 @@ uint8_t MarlinHAL::get_reset_source() { void MarlinHAL::reboot() { rstc_start_software_reset(RSTC); } +// ------------------------ +// Free Memory Accessor +// ------------------------ + extern "C" { extern unsigned int _ebss; // end of bss section } @@ -82,6 +87,10 @@ int freeMemory() { return (int)&free_memory - (heap_end ?: (int)&_ebss); } +// ------------------------ +// Serial Ports +// ------------------------ + // Forward the default serial ports #if USING_HW_SERIAL0 DefaultSerial1 MSerial0(false, Serial); diff --git a/Marlin/src/HAL/DUE/HAL_SPI.cpp b/Marlin/src/HAL/DUE/HAL_SPI.cpp index c5e8f2433d7d..7e3fe0135645 100644 --- a/Marlin/src/HAL/DUE/HAL_SPI.cpp +++ b/Marlin/src/HAL/DUE/HAL_SPI.cpp @@ -31,8 +31,6 @@ /** * HAL for Arduino Due and compatible (SAM3X8E) - * - * For ARDUINO_ARCH_SAM */ #ifdef ARDUINO_ARCH_SAM diff --git a/Marlin/src/HAL/HAL.h b/Marlin/src/HAL/HAL.h index 0cd836af2b68..2dda287ac7a1 100644 --- a/Marlin/src/HAL/HAL.h +++ b/Marlin/src/HAL/HAL.h @@ -28,6 +28,7 @@ #endif #include HAL_PATH(.,HAL.h) +extern MarlinHAL hal; #define HAL_ADC_RANGE _BV(HAL_ADC_RESOLUTION) diff --git a/Marlin/src/HAL/LPC1768/HAL.h b/Marlin/src/HAL/LPC1768/HAL.h index 0f26509129d5..d058de8720bb 100644 --- a/Marlin/src/HAL/LPC1768/HAL.h +++ b/Marlin/src/HAL/LPC1768/HAL.h @@ -177,7 +177,7 @@ void flashFirmware(const int16_t); #define CPU_ST7920_DELAY_3 750 // ------------------------ -// Class Utilities +// Free Memory Accessor // ------------------------ #pragma GCC diagnostic push diff --git a/Marlin/src/HAL/NATIVE_SIM/HAL.h b/Marlin/src/HAL/NATIVE_SIM/HAL.h index 49a5b6ea560b..35fce855cbd4 100644 --- a/Marlin/src/HAL/NATIVE_SIM/HAL.h +++ b/Marlin/src/HAL/NATIVE_SIM/HAL.h @@ -186,7 +186,7 @@ constexpr inline char* strstr_constexpr(char* str, const char* target) { } // ------------------------ -// Class Utilities +// Free Memory Accessor // ------------------------ #pragma GCC diagnostic push diff --git a/Marlin/src/HAL/STM32/HAL.cpp b/Marlin/src/HAL/STM32/HAL.cpp index 2d8b672c3dfb..7e410fff8464 100644 --- a/Marlin/src/HAL/STM32/HAL.cpp +++ b/Marlin/src/HAL/STM32/HAL.cpp @@ -24,12 +24,11 @@ #ifdef HAL_STM32 -#include "HAL.h" -#include "usb_serial.h" - #include "../../inc/MarlinConfig.h" #include "../shared/Delay.h" +#include "usb_serial.h" + #ifdef USBCON DefaultSerial1 MSerialUSB(false, SerialUSB); #endif diff --git a/Marlin/src/HAL/STM32F1/HAL.cpp b/Marlin/src/HAL/STM32F1/HAL.cpp index 636dc742fcf5..43ee91e49044 100644 --- a/Marlin/src/HAL/STM32F1/HAL.cpp +++ b/Marlin/src/HAL/STM32F1/HAL.cpp @@ -83,6 +83,7 @@ // ------------------------ #if defined(SERIAL_USB) && !HAS_SD_HOST_DRIVE + USBSerial SerialUSB; DefaultSerial1 MSerial0(true, SerialUSB); @@ -211,6 +212,10 @@ void MarlinHAL::idletask() { void MarlinHAL::reboot() { nvic_sys_reset(); } +// ------------------------ +// Free Memory Accessor +// ------------------------ + extern "C" { extern unsigned int _ebss; // end of bss section } @@ -243,9 +248,9 @@ extern "C" { } */ -// +// ------------------------ // ADC -// +// ------------------------ enum ADCIndex : uint8_t { OPTITEM(HAS_TEMP_ADC_0, TEMP_0) diff --git a/Marlin/src/HAL/TEENSY31_32/HAL.cpp b/Marlin/src/HAL/TEENSY31_32/HAL.cpp index b923ab77b1f1..28c3fdc4d6f4 100644 --- a/Marlin/src/HAL/TEENSY31_32/HAL.cpp +++ b/Marlin/src/HAL/TEENSY31_32/HAL.cpp @@ -44,25 +44,6 @@ #endif USBSerialType USBSerial(false, SerialUSB); -// ------------------------ -// Class Utilities -// ------------------------ - -extern "C" { - extern char __bss_end; - extern char __heap_start; - extern void* __brkval; - - int freeMemory() { - int free_memory; - if ((int)__brkval == 0) - free_memory = ((int)&free_memory) - ((int)&__bss_end); - else - free_memory = ((int)&free_memory) - ((int)__brkval); - return free_memory; - } -} - // ------------------------ // MarlinHAL Class // ------------------------ @@ -81,7 +62,9 @@ uint8_t MarlinHAL::get_reset_source() { return 0; } +// ------------------------ // ADC +// ------------------------ void MarlinHAL::adc_init() { analog_init(); @@ -102,4 +85,23 @@ void MarlinHAL::adc_start(const pin_t pin) { uint16_t MarlinHAL::adc_value() { return ADC0_RA; } +// ------------------------ +// Free Memory Accessor +// ------------------------ + +extern "C" { + extern char __bss_end; + extern char __heap_start; + extern void* __brkval; + + int freeMemory() { + int free_memory; + if ((int)__brkval == 0) + free_memory = ((int)&free_memory) - ((int)&__bss_end); + else + free_memory = ((int)&free_memory) - ((int)__brkval); + return free_memory; + } +} + #endif // __MK20DX256__ diff --git a/Marlin/src/HAL/TEENSY35_36/HAL.cpp b/Marlin/src/HAL/TEENSY35_36/HAL.cpp index 54a5ad385536..5fbb49fd924f 100644 --- a/Marlin/src/HAL/TEENSY35_36/HAL.cpp +++ b/Marlin/src/HAL/TEENSY35_36/HAL.cpp @@ -43,33 +43,12 @@ USBSerialType USBSerial(false, SerialUSB); -// ------------------------ -// Class Utilities -// ------------------------ - -extern "C" { - extern char __bss_end; - extern char __heap_start; - extern void* __brkval; - - int freeMemory() { - int free_memory; - if ((int)__brkval == 0) - free_memory = ((int)&free_memory) - ((int)&__bss_end); - else - free_memory = ((int)&free_memory) - ((int)__brkval); - return free_memory; - } -} - // ------------------------ // MarlinHAL Class // ------------------------ void MarlinHAL::reboot() { _reboot_Teensyduino_(); } -// Reset - uint8_t MarlinHAL::get_reset_source() { switch (RCM_SRS0) { case 128: return RST_POWER_ON; break; @@ -82,7 +61,9 @@ uint8_t MarlinHAL::get_reset_source() { return 0; } +// ------------------------ // ADC +// ------------------------ int8_t MarlinHAL::adc_select; @@ -131,4 +112,23 @@ uint16_t MarlinHAL::adc_value() { return 0; } +// ------------------------ +// Free Memory Accessor +// ------------------------ + +extern "C" { + extern char __bss_end; + extern char __heap_start; + extern void* __brkval; + + int freeMemory() { + int free_memory; + if ((int)__brkval == 0) + free_memory = ((int)&free_memory) - ((int)&__bss_end); + else + free_memory = ((int)&free_memory) - ((int)__brkval); + return free_memory; + } +} + #endif // __MK64FX512__ || __MK66FX1M0__ diff --git a/Marlin/src/HAL/TEENSY35_36/HAL.h b/Marlin/src/HAL/TEENSY35_36/HAL.h index c45f2aa49307..84f071d73d49 100644 --- a/Marlin/src/HAL/TEENSY35_36/HAL.h +++ b/Marlin/src/HAL/TEENSY35_36/HAL.h @@ -118,7 +118,7 @@ typedef int8_t pin_t; #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval) // ------------------------ -// Class Utilities +// Free Memory Accessor // ------------------------ #pragma GCC diagnostic push diff --git a/Marlin/src/HAL/TEENSY40_41/HAL.cpp b/Marlin/src/HAL/TEENSY40_41/HAL.cpp index 68bd38f72ff8..4b9c55a2ca89 100644 --- a/Marlin/src/HAL/TEENSY40_41/HAL.cpp +++ b/Marlin/src/HAL/TEENSY40_41/HAL.cpp @@ -44,25 +44,6 @@ #endif USBSerialType USBSerial(false, SerialUSB); -// ------------------------ -// Class Utilities -// ------------------------ - -#define __bss_end _ebss - -extern "C" { - extern char __bss_end; - extern char __heap_start; - extern void* __brkval; - - // Doesn't work on Teensy 4.x - uint32_t freeMemory() { - uint32_t free_memory; - free_memory = ((uint32_t)&free_memory) - (((uint32_t)__brkval) ?: ((uint32_t)&__bss_end)); - return free_memory; - } -} - // ------------------------ // FastIO // ------------------------ @@ -97,7 +78,9 @@ void MarlinHAL::clear_reset_source() { SRC_SRSR = reset_source; } +// ------------------------ // ADC +// ------------------------ int8_t MarlinHAL::adc_select; @@ -180,4 +163,23 @@ uint16_t MarlinHAL::adc_value() { return 0; } +// ------------------------ +// Free Memory Accessor +// ------------------------ + +#define __bss_end _ebss + +extern "C" { + extern char __bss_end; + extern char __heap_start; + extern void* __brkval; + + // Doesn't work on Teensy 4.x + uint32_t freeMemory() { + uint32_t free_memory; + free_memory = ((uint32_t)&free_memory) - (((uint32_t)__brkval) ?: ((uint32_t)&__bss_end)); + return free_memory; + } +} + #endif // __IMXRT1062__ diff --git a/Marlin/src/HAL/TEENSY40_41/HAL.h b/Marlin/src/HAL/TEENSY40_41/HAL.h index ea874da2faea..0476a9809de0 100644 --- a/Marlin/src/HAL/TEENSY40_41/HAL.h +++ b/Marlin/src/HAL/TEENSY40_41/HAL.h @@ -140,7 +140,7 @@ typedef int8_t pin_t; bool is_output(pin_t pin); // ------------------------ -// Class Utilities +// Free Memory Accessor // ------------------------ #pragma GCC diagnostic push diff --git a/Marlin/src/inc/MarlinConfig.h b/Marlin/src/inc/MarlinConfig.h index 505a0682ebaa..8fdb4b9baeae 100644 --- a/Marlin/src/inc/MarlinConfig.h +++ b/Marlin/src/inc/MarlinConfig.h @@ -29,7 +29,6 @@ #ifndef __MARLIN_DEPS__ #include "../HAL/HAL.h" - extern MarlinHAL hal; #endif #include "../pins/pins.h" From 52eefa90e1c18616f127cdf43798907880e05ee5 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 19 May 2022 11:36:13 -0500 Subject: [PATCH 079/241] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Move=20watchdog=20?= =?UTF-8?q?to=20MarlinHAL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/AVR/HAL.cpp | 53 ++++++++ Marlin/src/HAL/AVR/HAL.h | 5 +- Marlin/src/HAL/AVR/watchdog.cpp | 70 ----------- Marlin/src/HAL/AVR/watchdog.h | 31 ----- Marlin/src/HAL/DUE/HAL.cpp | 95 ++++++++++++++- Marlin/src/HAL/DUE/HAL.h | 11 +- Marlin/src/HAL/DUE/watchdog.cpp | 114 ------------------ Marlin/src/HAL/DUE/watchdog.h | 33 ----- Marlin/src/HAL/ESP32/HAL.cpp | 25 ++++ Marlin/src/HAL/ESP32/HAL.h | 11 +- Marlin/src/HAL/ESP32/watchdog.cpp | 42 ------- Marlin/src/HAL/ESP32/watchdog.h | 38 ------ Marlin/src/HAL/HAL.h | 4 - Marlin/src/HAL/LINUX/HAL.h | 10 +- Marlin/src/HAL/LINUX/watchdog.cpp | 37 ------ Marlin/src/HAL/LINUX/watchdog.h | 25 ---- Marlin/src/HAL/LPC1768/HAL.cpp | 54 +++++++-- Marlin/src/HAL/LPC1768/HAL.h | 11 +- Marlin/src/HAL/LPC1768/watchdog.cpp | 72 ----------- Marlin/src/HAL/LPC1768/watchdog.h | 28 ----- Marlin/src/HAL/NATIVE_SIM/HAL.h | 5 +- Marlin/src/HAL/NATIVE_SIM/watchdog.h | 27 ----- Marlin/src/HAL/SAMD51/HAL.cpp | 34 ++++++ Marlin/src/HAL/SAMD51/HAL.h | 5 +- Marlin/src/HAL/SAMD51/watchdog.cpp | 54 --------- Marlin/src/HAL/SAMD51/watchdog.h | 31 ----- Marlin/src/HAL/STM32/HAL.cpp | 23 ++++ Marlin/src/HAL/STM32/HAL.h | 9 +- Marlin/src/HAL/STM32/MinSerial.cpp | 3 +- Marlin/src/HAL/STM32/sdio.cpp | 8 +- Marlin/src/HAL/STM32/watchdog.cpp | 52 -------- Marlin/src/HAL/STM32/watchdog.h | 25 ---- Marlin/src/HAL/STM32F1/HAL.cpp | 41 +++++++ Marlin/src/HAL/STM32F1/HAL.h | 5 +- Marlin/src/HAL/STM32F1/MinSerial.cpp | 3 +- Marlin/src/HAL/STM32F1/watchdog.cpp | 66 ---------- Marlin/src/HAL/STM32F1/watchdog.h | 35 ------ Marlin/src/HAL/TEENSY31_32/HAL.cpp | 22 ++++ Marlin/src/HAL/TEENSY31_32/HAL.h | 5 +- Marlin/src/HAL/TEENSY31_32/watchdog.cpp | 40 ------ Marlin/src/HAL/TEENSY31_32/watchdog.h | 34 ------ Marlin/src/HAL/TEENSY35_36/HAL.cpp | 22 ++++ Marlin/src/HAL/TEENSY35_36/HAL.h | 5 +- Marlin/src/HAL/TEENSY35_36/watchdog.cpp | 40 ------ Marlin/src/HAL/TEENSY35_36/watchdog.h | 30 ----- Marlin/src/HAL/TEENSY40_41/HAL.cpp | 25 ++++ Marlin/src/HAL/TEENSY40_41/HAL.h | 5 +- Marlin/src/HAL/TEENSY40_41/watchdog.cpp | 52 -------- Marlin/src/HAL/TEENSY40_41/watchdog.h | 30 ----- Marlin/src/MarlinCore.cpp | 8 +- Marlin/src/gcode/config/M43.cpp | 10 +- Marlin/src/gcode/feature/L6470/M916-M918.cpp | 1 - Marlin/src/gcode/gcode_d.cpp | 4 +- Marlin/src/lcd/e3v2/proui/meshviewer.cpp | 2 +- .../src/lcd/extui/mks_ui/draw_print_file.cpp | 2 +- .../lcd/extui/mks_ui/draw_z_offset_wizard.cpp | 4 +- Marlin/src/lcd/extui/mks_ui/pic_manager.cpp | 22 ++-- .../extui/mks_ui/tft_lvgl_configuration.cpp | 12 +- Marlin/src/lcd/extui/mks_ui/wifi_module.cpp | 12 +- Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp | 6 +- Marlin/src/module/temperature.cpp | 10 +- Marlin/src/sd/Sd2Card.cpp | 8 +- 62 files changed, 505 insertions(+), 1101 deletions(-) delete mode 100644 Marlin/src/HAL/AVR/watchdog.cpp delete mode 100644 Marlin/src/HAL/AVR/watchdog.h delete mode 100644 Marlin/src/HAL/DUE/watchdog.cpp delete mode 100644 Marlin/src/HAL/DUE/watchdog.h delete mode 100644 Marlin/src/HAL/ESP32/watchdog.cpp delete mode 100644 Marlin/src/HAL/ESP32/watchdog.h delete mode 100644 Marlin/src/HAL/LINUX/watchdog.cpp delete mode 100644 Marlin/src/HAL/LINUX/watchdog.h delete mode 100644 Marlin/src/HAL/LPC1768/watchdog.cpp delete mode 100644 Marlin/src/HAL/LPC1768/watchdog.h delete mode 100644 Marlin/src/HAL/NATIVE_SIM/watchdog.h delete mode 100644 Marlin/src/HAL/SAMD51/watchdog.cpp delete mode 100644 Marlin/src/HAL/SAMD51/watchdog.h delete mode 100644 Marlin/src/HAL/STM32/watchdog.cpp delete mode 100644 Marlin/src/HAL/STM32/watchdog.h delete mode 100644 Marlin/src/HAL/STM32F1/watchdog.cpp delete mode 100644 Marlin/src/HAL/STM32F1/watchdog.h delete mode 100644 Marlin/src/HAL/TEENSY31_32/watchdog.cpp delete mode 100644 Marlin/src/HAL/TEENSY31_32/watchdog.h delete mode 100644 Marlin/src/HAL/TEENSY35_36/watchdog.cpp delete mode 100644 Marlin/src/HAL/TEENSY35_36/watchdog.h delete mode 100644 Marlin/src/HAL/TEENSY40_41/watchdog.cpp delete mode 100644 Marlin/src/HAL/TEENSY40_41/watchdog.h diff --git a/Marlin/src/HAL/AVR/HAL.cpp b/Marlin/src/HAL/AVR/HAL.cpp index 0527f3d8c5df..5382eb36a2bd 100644 --- a/Marlin/src/HAL/AVR/HAL.cpp +++ b/Marlin/src/HAL/AVR/HAL.cpp @@ -23,6 +23,7 @@ #include "../../inc/MarlinConfig.h" #include "HAL.h" +#include #ifdef USBCON DefaultSerial1 MSerial0(false, Serial); @@ -88,6 +89,58 @@ void MarlinHAL::reboot() { #endif } +// ------------------------ +// Watchdog Timer +// ------------------------ + +#if ENABLED(USE_WATCHDOG) + + #include + #include "../../MarlinCore.h" + + // Initialize watchdog with 8s timeout, if possible. Otherwise, make it 4s. + void MarlinHAL::watchdog_init() { + #if ENABLED(WATCHDOG_DURATION_8S) && defined(WDTO_8S) + #define WDTO_NS WDTO_8S + #else + #define WDTO_NS WDTO_4S + #endif + #if ENABLED(WATCHDOG_RESET_MANUAL) + // Enable the watchdog timer, but only for the interrupt. + // Take care, as this requires the correct order of operation, with interrupts disabled. + // See the datasheet of any AVR chip for details. + wdt_reset(); + cli(); + _WD_CONTROL_REG = _BV(_WD_CHANGE_BIT) | _BV(WDE); + _WD_CONTROL_REG = _BV(WDIE) | (WDTO_NS & 0x07) | ((WDTO_NS & 0x08) << 2); // WDTO_NS directly does not work. bit 0-2 are consecutive in the register but the highest value bit is at bit 5 + // So worked for up to WDTO_2S + sei(); + wdt_reset(); + #else + wdt_enable(WDTO_NS); // The function handles the upper bit correct. + #endif + //delay(10000); // test it! + } + + //=========================================================================== + //=================================== ISR =================================== + //=========================================================================== + + // Watchdog timer interrupt, called if main program blocks >4sec and manual reset is enabled. + #if ENABLED(WATCHDOG_RESET_MANUAL) + ISR(WDT_vect) { + sei(); // With the interrupt driven serial we need to allow interrupts. + SERIAL_ERROR_MSG(STR_WATCHDOG_FIRED); + minkill(); // interrupt-safe final kill and infinite loop + } + #endif + + // Reset watchdog. MUST be called at least every 4 seconds after the + // first watchdog_init or AVR will go into emergency procedures. + void MarlinHAL::watchdog_refresh() { wdt_reset(); } + +#endif // USE_WATCHDOG + // ------------------------ // Free Memory Accessor // ------------------------ diff --git a/Marlin/src/HAL/AVR/HAL.h b/Marlin/src/HAL/AVR/HAL.h index b2995b90cfde..149186772158 100644 --- a/Marlin/src/HAL/AVR/HAL.h +++ b/Marlin/src/HAL/AVR/HAL.h @@ -26,7 +26,6 @@ #include "../shared/Marduino.h" #include "../shared/HAL_SPI.h" #include "fastio.h" -#include "watchdog.h" #include "math.h" #ifdef USBCON @@ -189,6 +188,10 @@ class MarlinHAL { // Earliest possible init, before setup() MarlinHAL() {} + // Watchdog + static void watchdog_init() IF_DISABLED(USE_WATCHDOG, {}); + static void watchdog_refresh() IF_DISABLED(USE_WATCHDOG, {}); + static void init(); // Called early in setup() static void init_board() {} // Called less early in setup() static void reboot(); // Restart the firmware from 0x0 diff --git a/Marlin/src/HAL/AVR/watchdog.cpp b/Marlin/src/HAL/AVR/watchdog.cpp deleted file mode 100644 index 3f10c4adff81..000000000000 --- a/Marlin/src/HAL/AVR/watchdog.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#ifdef __AVR__ - -#include "../../inc/MarlinConfig.h" - -#if ENABLED(USE_WATCHDOG) - -#include "watchdog.h" - -#include "../../MarlinCore.h" - -// Initialize watchdog with 8s timeout, if possible. Otherwise, make it 4s. -void watchdog_init() { - #if ENABLED(WATCHDOG_DURATION_8S) && defined(WDTO_8S) - #define WDTO_NS WDTO_8S - #else - #define WDTO_NS WDTO_4S - #endif - #if ENABLED(WATCHDOG_RESET_MANUAL) - // Enable the watchdog timer, but only for the interrupt. - // Take care, as this requires the correct order of operation, with interrupts disabled. - // See the datasheet of any AVR chip for details. - wdt_reset(); - cli(); - _WD_CONTROL_REG = _BV(_WD_CHANGE_BIT) | _BV(WDE); - _WD_CONTROL_REG = _BV(WDIE) | (WDTO_NS & 0x07) | ((WDTO_NS & 0x08) << 2); // WDTO_NS directly does not work. bit 0-2 are consecutive in the register but the highest value bit is at bit 5 - // So worked for up to WDTO_2S - sei(); - wdt_reset(); - #else - wdt_enable(WDTO_NS); // The function handles the upper bit correct. - #endif - //delay(10000); // test it! -} - -//=========================================================================== -//=================================== ISR =================================== -//=========================================================================== - -// Watchdog timer interrupt, called if main program blocks >4sec and manual reset is enabled. -#if ENABLED(WATCHDOG_RESET_MANUAL) - ISR(WDT_vect) { - sei(); // With the interrupt driven serial we need to allow interrupts. - SERIAL_ERROR_MSG(STR_WATCHDOG_FIRED); - minkill(); // interrupt-safe final kill and infinite loop - } -#endif - -#endif // USE_WATCHDOG -#endif // __AVR__ diff --git a/Marlin/src/HAL/AVR/watchdog.h b/Marlin/src/HAL/AVR/watchdog.h deleted file mode 100644 index a16c88b35e87..000000000000 --- a/Marlin/src/HAL/AVR/watchdog.h +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#pragma once - -#include - -// Initialize watchdog with a 4 second interrupt time -void watchdog_init(); - -// Reset watchdog. MUST be called at least every 4 seconds after the -// first watchdog_init or AVR will go into emergency procedures. -inline void HAL_watchdog_refresh() { wdt_reset(); } diff --git a/Marlin/src/HAL/DUE/HAL.cpp b/Marlin/src/HAL/DUE/HAL.cpp index 39a28359e5da..4353f1649732 100644 --- a/Marlin/src/HAL/DUE/HAL.cpp +++ b/Marlin/src/HAL/DUE/HAL.cpp @@ -25,7 +25,7 @@ #ifdef ARDUINO_ARCH_SAM #include "../../inc/MarlinConfig.h" -#include "HAL.h" +#include "../../MarlinCore.h" #include #include "usb/usb_task.h" @@ -73,6 +73,99 @@ uint8_t MarlinHAL::get_reset_source() { void MarlinHAL::reboot() { rstc_start_software_reset(RSTC); } +// ------------------------ +// Watchdog Timer +// ------------------------ + +#if ENABLED(USE_WATCHDOG) + + // Initialize watchdog - On SAM3X, Watchdog was already configured + // and enabled or disabled at startup, so no need to reconfigure it + // here. + void MarlinHAL::watchdog_init() { WDT_Restart(WDT); } // Reset watchdog to start clean + + // Reset watchdog. MUST be called at least every 4 seconds after the + // first watchdog_init or AVR will go into emergency procedures. + void MarlinHAL::watchdog_refresh() { watchdogReset(); } + +#endif + +// Override Arduino runtime to either config or disable the watchdog +// +// We need to configure the watchdog as soon as possible in the boot +// process, because watchdog initialization at hardware reset on SAM3X8E +// is unreliable, and there is risk of unintended resets if we delay +// that initialization to a later time. +void watchdogSetup() { + + #if ENABLED(USE_WATCHDOG) + + // 4 seconds timeout + uint32_t timeout = TERN(WATCHDOG_DURATION_8S, 8000, 4000); + + // Calculate timeout value in WDT counter ticks: This assumes + // the slow clock is running at 32.768 kHz watchdog + // frequency is therefore 32768 / 128 = 256 Hz + timeout = (timeout << 8) / 1000; + if (timeout == 0) + timeout = 1; + else if (timeout > 0xFFF) + timeout = 0xFFF; + + // We want to enable the watchdog with the specified timeout + uint32_t value = + WDT_MR_WDV(timeout) | // With the specified timeout + WDT_MR_WDD(timeout) | // and no invalid write window + #if !(SAMV70 || SAMV71 || SAME70 || SAMS70) + WDT_MR_WDRPROC | // WDT fault resets processor only - We want + // to keep PIO controller state + #endif + WDT_MR_WDDBGHLT | // WDT stops in debug state. + WDT_MR_WDIDLEHLT; // WDT stops in idle state. + + #if ENABLED(WATCHDOG_RESET_MANUAL) + // We enable the watchdog timer, but only for the interrupt. + + // Configure WDT to only trigger an interrupt + value |= WDT_MR_WDFIEN; // Enable WDT fault interrupt. + + // Disable WDT interrupt (just in case, to avoid triggering it!) + NVIC_DisableIRQ(WDT_IRQn); + + // We NEED memory barriers to ensure Interrupts are actually disabled! + // ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the ) + __DSB(); + __ISB(); + + // Initialize WDT with the given parameters + WDT_Enable(WDT, value); + + // Configure and enable WDT interrupt. + NVIC_ClearPendingIRQ(WDT_IRQn); + NVIC_SetPriority(WDT_IRQn, 0); // Use highest priority, so we detect all kinds of lockups + NVIC_EnableIRQ(WDT_IRQn); + + #else + + // a WDT fault triggers a reset + value |= WDT_MR_WDRSTEN; + + // Initialize WDT with the given parameters + WDT_Enable(WDT, value); + + #endif + + // Reset the watchdog + WDT_Restart(WDT); + + #else + + // Make sure to completely disable the Watchdog + WDT_Disable(WDT); + + #endif +} + // ------------------------ // Free Memory Accessor // ------------------------ diff --git a/Marlin/src/HAL/DUE/HAL.h b/Marlin/src/HAL/DUE/HAL.h index 2f5c647aa319..4d3f4823a517 100644 --- a/Marlin/src/HAL/DUE/HAL.h +++ b/Marlin/src/HAL/DUE/HAL.h @@ -32,7 +32,6 @@ #include "../shared/math_32bit.h" #include "../shared/HAL_SPI.h" #include "fastio.h" -#include "watchdog.h" #include @@ -176,9 +175,13 @@ class MarlinHAL { // Earliest possible init, before setup() MarlinHAL() {} - static void init(); // Called early in setup() - static void init_board(); // Called less early in setup() - static void reboot(); // Software reset + // Watchdog + static void watchdog_init() IF_DISABLED(USE_WATCHDOG, {}); + static void watchdog_refresh() IF_DISABLED(USE_WATCHDOG, {}); + + static void init(); // Called early in setup() + static void init_board(); // Called less early in setup() + static void reboot(); // Restart the firmware // Interrupts static bool isr_state() { return !__get_PRIMASK(); } diff --git a/Marlin/src/HAL/DUE/watchdog.cpp b/Marlin/src/HAL/DUE/watchdog.cpp deleted file mode 100644 index e144db8291e3..000000000000 --- a/Marlin/src/HAL/DUE/watchdog.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#ifdef ARDUINO_ARCH_SAM - -#include "../../inc/MarlinConfig.h" -#include "../../MarlinCore.h" -#include "watchdog.h" - -// Override Arduino runtime to either config or disable the watchdog -// -// We need to configure the watchdog as soon as possible in the boot -// process, because watchdog initialization at hardware reset on SAM3X8E -// is unreliable, and there is risk of unintended resets if we delay -// that initialization to a later time. -void watchdogSetup() { - - #if ENABLED(USE_WATCHDOG) - - // 4 seconds timeout - uint32_t timeout = TERN(WATCHDOG_DURATION_8S, 8000, 4000); - - // Calculate timeout value in WDT counter ticks: This assumes - // the slow clock is running at 32.768 kHz watchdog - // frequency is therefore 32768 / 128 = 256 Hz - timeout = (timeout << 8) / 1000; - if (timeout == 0) - timeout = 1; - else if (timeout > 0xFFF) - timeout = 0xFFF; - - // We want to enable the watchdog with the specified timeout - uint32_t value = - WDT_MR_WDV(timeout) | // With the specified timeout - WDT_MR_WDD(timeout) | // and no invalid write window - #if !(SAMV70 || SAMV71 || SAME70 || SAMS70) - WDT_MR_WDRPROC | // WDT fault resets processor only - We want - // to keep PIO controller state - #endif - WDT_MR_WDDBGHLT | // WDT stops in debug state. - WDT_MR_WDIDLEHLT; // WDT stops in idle state. - - #if ENABLED(WATCHDOG_RESET_MANUAL) - // We enable the watchdog timer, but only for the interrupt. - - // Configure WDT to only trigger an interrupt - value |= WDT_MR_WDFIEN; // Enable WDT fault interrupt. - - // Disable WDT interrupt (just in case, to avoid triggering it!) - NVIC_DisableIRQ(WDT_IRQn); - - // We NEED memory barriers to ensure Interrupts are actually disabled! - // ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the ) - __DSB(); - __ISB(); - - // Initialize WDT with the given parameters - WDT_Enable(WDT, value); - - // Configure and enable WDT interrupt. - NVIC_ClearPendingIRQ(WDT_IRQn); - NVIC_SetPriority(WDT_IRQn, 0); // Use highest priority, so we detect all kinds of lockups - NVIC_EnableIRQ(WDT_IRQn); - - #else - - // a WDT fault triggers a reset - value |= WDT_MR_WDRSTEN; - - // Initialize WDT with the given parameters - WDT_Enable(WDT, value); - - #endif - - // Reset the watchdog - WDT_Restart(WDT); - - #else - - // Make sure to completely disable the Watchdog - WDT_Disable(WDT); - - #endif -} - -#if ENABLED(USE_WATCHDOG) - // Initialize watchdog - On SAM3X, Watchdog was already configured - // and enabled or disabled at startup, so no need to reconfigure it - // here. - void watchdog_init() { - // Reset watchdog to start clean - WDT_Restart(WDT); - } -#endif // USE_WATCHDOG - -#endif diff --git a/Marlin/src/HAL/DUE/watchdog.h b/Marlin/src/HAL/DUE/watchdog.h deleted file mode 100644 index 5725a10007a7..000000000000 --- a/Marlin/src/HAL/DUE/watchdog.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#pragma once - -// Arduino Due core now has watchdog support - -#include "HAL.h" - -// Initialize watchdog with a 4 second interrupt time -void watchdog_init(); - -// Reset watchdog. MUST be called at least every 4 seconds after the -// first watchdog_init or AVR will go into emergency procedures. -inline void HAL_watchdog_refresh() { watchdogReset(); } diff --git a/Marlin/src/HAL/ESP32/HAL.cpp b/Marlin/src/HAL/ESP32/HAL.cpp index 767f65d341bc..65af39786eeb 100644 --- a/Marlin/src/HAL/ESP32/HAL.cpp +++ b/Marlin/src/HAL/ESP32/HAL.cpp @@ -179,6 +179,31 @@ void _delay_ms(int delay_ms) { delay(delay_ms); } // return free memory between end of heap (or end bss) and whatever is current int MarlinHAL::freeMemory() { return ESP.getFreeHeap(); } +// ------------------------ +// Watchdog Timer +// ------------------------ + +#if ENABLED(USE_WATCHDOG) + + #define WDT_TIMEOUT_US TERN(WATCHDOG_DURATION_8S, 8000000, 4000000) // 4 or 8 second timeout + + extern "C" { + esp_err_t esp_task_wdt_reset(); + } + + void watchdogSetup() { + // do whatever. don't remove this function. + } + + void MarlinHAL::watchdog_init() { + // TODO + } + + // Reset watchdog. + void MarlinHAL::watchdog_refresh() { esp_task_wdt_reset(); } + +#endif + // ------------------------ // ADC // ------------------------ diff --git a/Marlin/src/HAL/ESP32/HAL.h b/Marlin/src/HAL/ESP32/HAL.h index ba3627b1fd31..a07303d4891f 100644 --- a/Marlin/src/HAL/ESP32/HAL.h +++ b/Marlin/src/HAL/ESP32/HAL.h @@ -32,7 +32,6 @@ #include "../shared/HAL_SPI.h" #include "fastio.h" -#include "watchdog.h" #include "i2s.h" #if ENABLED(WIFISUPPORT) @@ -172,9 +171,13 @@ class MarlinHAL { // Earliest possible init, before setup() MarlinHAL() {} - static void init() {} // Called early in setup() - static void init_board(); // Called less early in setup() - static void reboot(); // Restart the firmware + // Watchdog + static void watchdog_init() IF_DISABLED(USE_WATCHDOG, {}); + static void watchdog_refresh() IF_DISABLED(USE_WATCHDOG, {}); + + static void init() {} // Called early in setup() + static void init_board(); // Called less early in setup() + static void reboot(); // Restart the firmware // Interrupts static portMUX_TYPE spinlock; diff --git a/Marlin/src/HAL/ESP32/watchdog.cpp b/Marlin/src/HAL/ESP32/watchdog.cpp deleted file mode 100644 index 5ec03c46079b..000000000000 --- a/Marlin/src/HAL/ESP32/watchdog.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#ifdef ARDUINO_ARCH_ESP32 - -#include "../../inc/MarlinConfig.h" - -#if ENABLED(USE_WATCHDOG) - -#define WDT_TIMEOUT_US TERN(WATCHDOG_DURATION_8S, 8000000, 4000000) // 4 or 8 second timeout - -#include "watchdog.h" - -void watchdogSetup() { - // do whatever. don't remove this function. -} - -void watchdog_init() { - // TODO -} - -#endif // USE_WATCHDOG - -#endif // ARDUINO_ARCH_ESP32 diff --git a/Marlin/src/HAL/ESP32/watchdog.h b/Marlin/src/HAL/ESP32/watchdog.h deleted file mode 100644 index 43db8130763f..000000000000 --- a/Marlin/src/HAL/ESP32/watchdog.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#pragma once - -#ifdef __cplusplus - extern "C" { -#endif - - esp_err_t esp_task_wdt_reset(); - -#ifdef __cplusplus - } -#endif - -// Initialize watchdog with a 4 second interrupt time -void watchdog_init(); - -// Reset watchdog. -inline void HAL_watchdog_refresh() { esp_task_wdt_reset(); } diff --git a/Marlin/src/HAL/HAL.h b/Marlin/src/HAL/HAL.h index 2dda287ac7a1..518657801905 100644 --- a/Marlin/src/HAL/HAL.h +++ b/Marlin/src/HAL/HAL.h @@ -45,7 +45,3 @@ extern MarlinHAL hal; #ifndef PGMSTR #define PGMSTR(NAM,STR) const char NAM[] = STR #endif - -inline void watchdog_refresh() { - TERN_(USE_WATCHDOG, HAL_watchdog_refresh()); -} diff --git a/Marlin/src/HAL/LINUX/HAL.h b/Marlin/src/HAL/LINUX/HAL.h index 43899c632de5..22c3e521f086 100644 --- a/Marlin/src/HAL/LINUX/HAL.h +++ b/Marlin/src/HAL/LINUX/HAL.h @@ -21,6 +21,8 @@ */ #pragma once +#include "../../inc/MarlinConfigPre.h" + #include #include #include @@ -29,12 +31,10 @@ #include #include "hardware/Clock.h" - #include "../shared/Marduino.h" #include "../shared/math_32bit.h" #include "../shared/HAL_SPI.h" #include "fastio.h" -#include "watchdog.h" #include "serial.h" // ------------------------ @@ -106,9 +106,13 @@ class MarlinHAL { // Earliest possible init, before setup() MarlinHAL() {} + // Watchdog + static void watchdog_init() {} + static void watchdog_refresh() {} + static void init() {} // Called early in setup() static void init_board() {} // Called less early in setup() - static void reboot(); // Reset the application state and GPIO + static void reboot(); // Reset the application state and GPIO // Interrupts static bool isr_state() { return true; } diff --git a/Marlin/src/HAL/LINUX/watchdog.cpp b/Marlin/src/HAL/LINUX/watchdog.cpp deleted file mode 100644 index 84202e48b6c5..000000000000 --- a/Marlin/src/HAL/LINUX/watchdog.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#ifdef __PLAT_LINUX__ - -#include "../../inc/MarlinConfig.h" - -#if ENABLED(USE_WATCHDOG) - -#include "watchdog.h" - -#define WDT_TIMEOUT_US TERN(WATCHDOG_DURATION_8S, 8000000, 4000000) // 4 or 8 second timeout - -void watchdog_init() {} -void HAL_watchdog_refresh() {} - -#endif - -#endif // __PLAT_LINUX__ diff --git a/Marlin/src/HAL/LINUX/watchdog.h b/Marlin/src/HAL/LINUX/watchdog.h deleted file mode 100644 index 49a0d9c631d8..000000000000 --- a/Marlin/src/HAL/LINUX/watchdog.h +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#pragma once - -void watchdog_init(); -void HAL_watchdog_refresh(); diff --git a/Marlin/src/HAL/LPC1768/HAL.cpp b/Marlin/src/HAL/LPC1768/HAL.cpp index 541848b08acc..9ff3a6ba598f 100644 --- a/Marlin/src/HAL/LPC1768/HAL.cpp +++ b/Marlin/src/HAL/LPC1768/HAL.cpp @@ -25,10 +25,6 @@ #include "../shared/Delay.h" #include "../../../gcode/parser.h" -#if ENABLED(USE_WATCHDOG) - #include "watchdog.h" -#endif - DefaultSerial1 USBSerial(false, UsbSerial); uint32_t MarlinHAL::adc_result = 0; @@ -61,9 +57,7 @@ uint8_t MarlinHAL::get_reset_source() { return RST_POWER_ON; } -void MarlinHAL::clear_reset_source() { - TERN_(USE_WATCHDOG, watchdog_clear_timeout_flag()); -} +void MarlinHAL::clear_reset_source() { watchdog_clear_timeout_flag(); } void flashFirmware(const int16_t) { delay(500); // Give OS time to disconnect @@ -72,6 +66,52 @@ void flashFirmware(const int16_t) { hal.reboot(); } +#if ENABLED(USE_WATCHDOG) + + #include + + #define WDT_TIMEOUT_US TERN(WATCHDOG_DURATION_8S, 8000000, 4000000) // 4 or 8 second timeout + + void MarlinHAL::watchdog_init() { + #if ENABLED(WATCHDOG_RESET_MANUAL) + // We enable the watchdog timer, but only for the interrupt. + + // Configure WDT to only trigger an interrupt + // Disable WDT interrupt (just in case, to avoid triggering it!) + NVIC_DisableIRQ(WDT_IRQn); + + // We NEED memory barriers to ensure Interrupts are actually disabled! + // ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the ) + __DSB(); + __ISB(); + + // Configure WDT to only trigger an interrupt + // Initialize WDT with the given parameters + WDT_Init(WDT_CLKSRC_IRC, WDT_MODE_INT_ONLY); + + // Configure and enable WDT interrupt. + NVIC_ClearPendingIRQ(WDT_IRQn); + NVIC_SetPriority(WDT_IRQn, 0); // Use highest priority, so we detect all kinds of lockups + NVIC_EnableIRQ(WDT_IRQn); + #else + WDT_Init(WDT_CLKSRC_IRC, WDT_MODE_RESET); + #endif + WDT_Start(WDT_TIMEOUT_US); + } + + void MarlinHAL::watchdog_refresh() { + WDT_Feed(); + #if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED) + TOGGLE(LED_PIN); // heartbeat indicator + #endif + } + + // Timeout state + bool MarlinHAL::watchdog_timed_out() { return TEST(WDT_ReadTimeOutFlag(), 0); } + void MarlinHAL::watchdog_clear_timeout_flag() { WDT_ClrTimeOutFlag(); } + +#endif // USE_WATCHDOG + // For M42/M43, scan command line for pin code // return index into pin map array if found and the pin is valid. // return dval if not found or not a valid pin. diff --git a/Marlin/src/HAL/LPC1768/HAL.h b/Marlin/src/HAL/LPC1768/HAL.h index d058de8720bb..b0eeb983b445 100644 --- a/Marlin/src/HAL/LPC1768/HAL.h +++ b/Marlin/src/HAL/LPC1768/HAL.h @@ -38,7 +38,6 @@ extern "C" volatile uint32_t _millis; #include "../shared/math_32bit.h" #include "../shared/HAL_SPI.h" #include "fastio.h" -#include "watchdog.h" #include "MarlinSerial.h" #include @@ -199,9 +198,9 @@ class MarlinHAL { // Earliest possible init, before setup() MarlinHAL() {} - static void init(); // Called early in setup() + static void init(); // Called early in setup() static void init_board() {} // Called less early in setup() - static void reboot(); // Restart the firmware from 0x0 + static void reboot(); // Restart the firmware from 0x0 // Interrupts static bool isr_state() { return !__get_PRIMASK(); } @@ -210,6 +209,12 @@ class MarlinHAL { static void delay_ms(const int ms) { _delay_ms(ms); } + // Watchdog + static void watchdog_init() IF_DISABLED(USE_WATCHDOG, {}); + static void watchdog_refresh() IF_DISABLED(USE_WATCHDOG, {}); + static bool watchdog_timed_out() IF_DISABLED(USE_WATCHDOG, { return false; }); + static void watchdog_clear_timeout_flag() IF_DISABLED(USE_WATCHDOG, {}); + // Tasks, called from idle() static void idletask(); diff --git a/Marlin/src/HAL/LPC1768/watchdog.cpp b/Marlin/src/HAL/LPC1768/watchdog.cpp deleted file mode 100644 index f23ccf5b512d..000000000000 --- a/Marlin/src/HAL/LPC1768/watchdog.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#ifdef TARGET_LPC1768 - -#include "../../inc/MarlinConfig.h" - -#if ENABLED(USE_WATCHDOG) - -#include -#include "watchdog.h" - -#define WDT_TIMEOUT_US TERN(WATCHDOG_DURATION_8S, 8000000, 4000000) // 4 or 8 second timeout - -void watchdog_init() { - #if ENABLED(WATCHDOG_RESET_MANUAL) - // We enable the watchdog timer, but only for the interrupt. - - // Configure WDT to only trigger an interrupt - // Disable WDT interrupt (just in case, to avoid triggering it!) - NVIC_DisableIRQ(WDT_IRQn); - - // We NEED memory barriers to ensure Interrupts are actually disabled! - // ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the ) - __DSB(); - __ISB(); - - // Configure WDT to only trigger an interrupt - // Initialize WDT with the given parameters - WDT_Init(WDT_CLKSRC_IRC, WDT_MODE_INT_ONLY); - - // Configure and enable WDT interrupt. - NVIC_ClearPendingIRQ(WDT_IRQn); - NVIC_SetPriority(WDT_IRQn, 0); // Use highest priority, so we detect all kinds of lockups - NVIC_EnableIRQ(WDT_IRQn); - #else - WDT_Init(WDT_CLKSRC_IRC, WDT_MODE_RESET); - #endif - WDT_Start(WDT_TIMEOUT_US); -} - -void HAL_watchdog_refresh() { - WDT_Feed(); - #if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED) - TOGGLE(LED_PIN); // heartbeat indicator - #endif -} - -// Timeout state -bool watchdog_timed_out() { return TEST(WDT_ReadTimeOutFlag(), 0); } -void watchdog_clear_timeout_flag() { WDT_ClrTimeOutFlag(); } - -#endif // USE_WATCHDOG -#endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/LPC1768/watchdog.h b/Marlin/src/HAL/LPC1768/watchdog.h deleted file mode 100644 index c843f0ed5571..000000000000 --- a/Marlin/src/HAL/LPC1768/watchdog.h +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#pragma once - -void watchdog_init(); -void HAL_watchdog_refresh(); - -bool watchdog_timed_out(); -void watchdog_clear_timeout_flag(); diff --git a/Marlin/src/HAL/NATIVE_SIM/HAL.h b/Marlin/src/HAL/NATIVE_SIM/HAL.h index 35fce855cbd4..66203611447f 100644 --- a/Marlin/src/HAL/NATIVE_SIM/HAL.h +++ b/Marlin/src/HAL/NATIVE_SIM/HAL.h @@ -45,7 +45,6 @@ uint8_t _getc(); #include "../shared/math_32bit.h" #include "../shared/HAL_SPI.h" #include "fastio.h" -#include "watchdog.h" #include "serial.h" // ------------------------ @@ -208,6 +207,10 @@ class MarlinHAL { // Earliest possible init, before setup() MarlinHAL() {} + // Watchdog + static void watchdog_init() IF_DISABLED(USE_WATCHDOG, {}); + static void watchdog_refresh() IF_DISABLED(USE_WATCHDOG, {}); + static void init() {} // Called early in setup() static void init_board() {} // Called less early in setup() static void reboot(); // Restart the firmware from 0x0 diff --git a/Marlin/src/HAL/NATIVE_SIM/watchdog.h b/Marlin/src/HAL/NATIVE_SIM/watchdog.h deleted file mode 100644 index 4e404c3887da..000000000000 --- a/Marlin/src/HAL/NATIVE_SIM/watchdog.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#pragma once - -#define WDT_TIMEOUT 4000000 // 4 second timeout - -void watchdog_init(); -void HAL_watchdog_refresh(); diff --git a/Marlin/src/HAL/SAMD51/HAL.cpp b/Marlin/src/HAL/SAMD51/HAL.cpp index 14b6a437dccc..648e0a4f144b 100644 --- a/Marlin/src/HAL/SAMD51/HAL.cpp +++ b/Marlin/src/HAL/SAMD51/HAL.cpp @@ -203,6 +203,40 @@ enum ADCIndex { ADC_COUNT }; +#if ENABLED(USE_WATCHDOG) + + #define WDT_TIMEOUT_REG TERN(WATCHDOG_DURATION_8S, WDT_CONFIG_PER_CYC8192, WDT_CONFIG_PER_CYC4096) // 4 or 8 second timeout + + void MarlinHAL::watchdog_init() { + // The low-power oscillator used by the WDT runs at 32,768 Hz with + // a 1:32 prescale, thus 1024 Hz, though probably not super precise. + + // Setup WDT clocks + MCLK->APBAMASK.bit.OSC32KCTRL_ = true; + MCLK->APBAMASK.bit.WDT_ = true; + OSC32KCTRL->OSCULP32K.bit.EN1K = true; // Enable out 1K (this is what WDT uses) + + WDT->CTRLA.bit.ENABLE = false; // Disable watchdog for config + SYNC(WDT->SYNCBUSY.bit.ENABLE); + + WDT->INTENCLR.reg = WDT_INTENCLR_EW; // Disable early warning interrupt + WDT->CONFIG.reg = WDT_TIMEOUT_REG; // Set a 4s or 8s period for chip reset + + hal.watchdog_refresh(); + + WDT->CTRLA.reg = WDT_CTRLA_ENABLE; // Start watchdog now in normal mode + SYNC(WDT->SYNCBUSY.bit.ENABLE); + } + + // Reset watchdog. MUST be called at least every 4 seconds after the + // first watchdog_init or SAMD will go into emergency procedures. + void MarlinHAL::watchdog_refresh() { + SYNC(WDT->SYNCBUSY.bit.CLEAR); // Test first if previous is 'ongoing' to save time waiting for command execution + WDT->CLEAR.reg = WDT_CLEAR_CLEAR_KEY; + } + +#endif + // ------------------------ // Types // ------------------------ diff --git a/Marlin/src/HAL/SAMD51/HAL.h b/Marlin/src/HAL/SAMD51/HAL.h index abcc28098776..79ba8021f4fd 100644 --- a/Marlin/src/HAL/SAMD51/HAL.h +++ b/Marlin/src/HAL/SAMD51/HAL.h @@ -26,7 +26,6 @@ #include "../shared/math_32bit.h" #include "../shared/HAL_SPI.h" #include "fastio.h" -#include "watchdog.h" #ifdef ADAFRUIT_GRAND_CENTRAL_M4 #include "MarlinSerial_AGCM4.h" @@ -157,6 +156,10 @@ class MarlinHAL { // Earliest possible init, before setup() MarlinHAL() {} + // Watchdog + static void watchdog_init() IF_DISABLED(USE_WATCHDOG, {}); + static void watchdog_refresh() IF_DISABLED(USE_WATCHDOG, {}); + static void init(); // Called early in setup() static void init_board() {} // Called less early in setup() static void reboot(); // Restart the firmware from 0x0 diff --git a/Marlin/src/HAL/SAMD51/watchdog.cpp b/Marlin/src/HAL/SAMD51/watchdog.cpp deleted file mode 100644 index 9de451836aeb..000000000000 --- a/Marlin/src/HAL/SAMD51/watchdog.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#ifdef __SAMD51__ - -#include "../../inc/MarlinConfig.h" - -#if ENABLED(USE_WATCHDOG) - -#include "watchdog.h" - -#define WDT_TIMEOUT_REG TERN(WATCHDOG_DURATION_8S, WDT_CONFIG_PER_CYC8192, WDT_CONFIG_PER_CYC4096) // 4 or 8 second timeout - -void watchdog_init() { - // The low-power oscillator used by the WDT runs at 32,768 Hz with - // a 1:32 prescale, thus 1024 Hz, though probably not super precise. - - // Setup WDT clocks - MCLK->APBAMASK.bit.OSC32KCTRL_ = true; - MCLK->APBAMASK.bit.WDT_ = true; - OSC32KCTRL->OSCULP32K.bit.EN1K = true; // Enable out 1K (this is what WDT uses) - - WDT->CTRLA.bit.ENABLE = false; // Disable watchdog for config - SYNC(WDT->SYNCBUSY.bit.ENABLE); - - WDT->INTENCLR.reg = WDT_INTENCLR_EW; // Disable early warning interrupt - WDT->CONFIG.reg = WDT_TIMEOUT_REG; // Set a 4s or 8s period for chip reset - - HAL_watchdog_refresh(); - - WDT->CTRLA.reg = WDT_CTRLA_ENABLE; // Start watchdog now in normal mode - SYNC(WDT->SYNCBUSY.bit.ENABLE); -} - -#endif // USE_WATCHDOG - -#endif // __SAMD51__ diff --git a/Marlin/src/HAL/SAMD51/watchdog.h b/Marlin/src/HAL/SAMD51/watchdog.h deleted file mode 100644 index 2cd4788229b0..000000000000 --- a/Marlin/src/HAL/SAMD51/watchdog.h +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#pragma once - -// Initialize watchdog with a 4 second interrupt time -void watchdog_init(); - -// Reset watchdog. MUST be called at least every 4 seconds after the -// first watchdog_init or SAMD will go into emergency procedures. -inline void HAL_watchdog_refresh() { - SYNC(WDT->SYNCBUSY.bit.CLEAR); // Test first if previous is 'ongoing' to save time waiting for command execution - WDT->CLEAR.reg = WDT_CLEAR_CLEAR_KEY; -} diff --git a/Marlin/src/HAL/STM32/HAL.cpp b/Marlin/src/HAL/STM32/HAL.cpp index 7e410fff8464..aff52f597f4d 100644 --- a/Marlin/src/HAL/STM32/HAL.cpp +++ b/Marlin/src/HAL/STM32/HAL.cpp @@ -140,6 +140,29 @@ uint8_t MarlinHAL::get_reset_source() { void MarlinHAL::clear_reset_source() { __HAL_RCC_CLEAR_RESET_FLAGS(); } +// ------------------------ +// Watchdog Timer +// ------------------------ + +#if ENABLED(USE_WATCHDOG) + + #define WDT_TIMEOUT_US TERN(WATCHDOG_DURATION_8S, 8000000, 4000000) // 4 or 8 second timeout + + #include + + void MarlinHAL::watchdog_init() { + IF_DISABLED(DISABLE_WATCHDOG_INIT, IWatchdog.begin(WDT_TIMEOUT_US)); + } + + void MarlinHAL::watchdog_refresh() { + IWatchdog.reload(); + #if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED) + TOGGLE(LED_PIN); // heartbeat indicator + #endif + } + +#endif + extern "C" { extern unsigned int _ebss; // end of bss section } diff --git a/Marlin/src/HAL/STM32/HAL.h b/Marlin/src/HAL/STM32/HAL.h index 1bd7f7604257..3e85aca293d2 100644 --- a/Marlin/src/HAL/STM32/HAL.h +++ b/Marlin/src/HAL/STM32/HAL.h @@ -30,7 +30,6 @@ #include "../shared/HAL_SPI.h" #include "fastio.h" #include "Servo.h" -#include "watchdog.h" #include "MarlinSerial.h" #include "../../inc/MarlinConfigPre.h" @@ -218,9 +217,13 @@ class MarlinHAL { // Earliest possible init, before setup() MarlinHAL() {} - static void init(); // Called early in setup() + // Watchdog + static void watchdog_init() IF_DISABLED(USE_WATCHDOG, {}); + static void watchdog_refresh() IF_DISABLED(USE_WATCHDOG, {}); + + static void init(); // Called early in setup() static void init_board() {} // Called less early in setup() - static void reboot(); // Restart the firmware from 0x0 + static void reboot(); // Restart the firmware from 0x0 // Interrupts static bool isr_state() { return !__get_PRIMASK(); } diff --git a/Marlin/src/HAL/STM32/MinSerial.cpp b/Marlin/src/HAL/STM32/MinSerial.cpp index d99ed9cd9b99..b0fcff20c172 100644 --- a/Marlin/src/HAL/STM32/MinSerial.cpp +++ b/Marlin/src/HAL/STM32/MinSerial.cpp @@ -29,7 +29,6 @@ #if ENABLED(POSTMORTEM_DEBUGGING) #include "../shared/MinSerial.h" -#include "watchdog.h" /* Instruction Synchronization Barrier */ #define isb() __asm__ __volatile__ ("isb" : : : "memory") @@ -120,7 +119,7 @@ static void TX(char c) { #if WITHIN(SERIAL_PORT, 1, 6) constexpr uint32_t usart_sr_txe = _BV(7); while (!(regs->SR & usart_sr_txe)) { - TERN_(USE_WATCHDOG, HAL_watchdog_refresh()); + hal.watchdog_refresh(); sw_barrier(); } regs->DR = c; diff --git a/Marlin/src/HAL/STM32/sdio.cpp b/Marlin/src/HAL/STM32/sdio.cpp index 0af5f9040e54..b26ec768e8cd 100644 --- a/Marlin/src/HAL/STM32/sdio.cpp +++ b/Marlin/src/HAL/STM32/sdio.cpp @@ -208,7 +208,7 @@ bool SDIO_Init() { uint8_t retry_Cnt = retryCnt; for (;;) { - TERN_(USE_WATCHDOG, HAL_watchdog_refresh()); + hal.watchdog_refresh(); status = (bool) HAL_SD_Init(&hsd); if (!status) break; if (!--retry_Cnt) return false; // return failing status if retries are exhausted @@ -219,7 +219,7 @@ bool SDIO_Init() { #if PINS_EXIST(SDIO_D1, SDIO_D2, SDIO_D3) // go to 4 bit wide mode if pins are defined retry_Cnt = retryCnt; for (;;) { - TERN_(USE_WATCHDOG, HAL_watchdog_refresh()); + hal.watchdog_refresh(); if (!HAL_SD_ConfigWideBusOperation(&hsd, SDIO_BUS_WIDE_4B)) break; // some cards are only 1 bit wide so a pass here is not required if (!--retry_Cnt) break; } @@ -228,7 +228,7 @@ bool SDIO_Init() { SD_LowLevel_Init(); retry_Cnt = retryCnt; for (;;) { - TERN_(USE_WATCHDOG, HAL_watchdog_refresh()); + hal.watchdog_refresh(); status = (bool) HAL_SD_Init(&hsd); if (!status) break; if (!--retry_Cnt) return false; // return failing status if retries are exhausted @@ -243,7 +243,7 @@ bool SDIO_Init() { static bool SDIO_ReadWriteBlock_DMA(uint32_t block, const uint8_t *src, uint8_t *dst) { if (HAL_SD_GetCardState(&hsd) != HAL_SD_CARD_TRANSFER) return false; - TERN_(USE_WATCHDOG, HAL_watchdog_refresh()); + hal.watchdog_refresh(); HAL_StatusTypeDef ret; if (src) { diff --git a/Marlin/src/HAL/STM32/watchdog.cpp b/Marlin/src/HAL/STM32/watchdog.cpp deleted file mode 100644 index 1eccdec4985d..000000000000 --- a/Marlin/src/HAL/STM32/watchdog.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -#include "../platforms.h" - -#ifdef HAL_STM32 - -#include "../../inc/MarlinConfigPre.h" - -#if ENABLED(USE_WATCHDOG) - -#define WDT_TIMEOUT_US TERN(WATCHDOG_DURATION_8S, 8000000, 4000000) // 4 or 8 second timeout - -#include "../../inc/MarlinConfig.h" - -#include "watchdog.h" -#include - -void watchdog_init() { - #if DISABLED(DISABLE_WATCHDOG_INIT) - IWatchdog.begin(WDT_TIMEOUT_US); - #endif -} - -void HAL_watchdog_refresh() { - IWatchdog.reload(); - #if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED) - TOGGLE(LED_PIN); // heartbeat indicator - #endif -} - -#endif // USE_WATCHDOG -#endif // HAL_STM32 diff --git a/Marlin/src/HAL/STM32/watchdog.h b/Marlin/src/HAL/STM32/watchdog.h deleted file mode 100644 index 49a0d9c631d8..000000000000 --- a/Marlin/src/HAL/STM32/watchdog.h +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#pragma once - -void watchdog_init(); -void HAL_watchdog_refresh(); diff --git a/Marlin/src/HAL/STM32F1/HAL.cpp b/Marlin/src/HAL/STM32F1/HAL.cpp index 43ee91e49044..4d3140001e82 100644 --- a/Marlin/src/HAL/STM32F1/HAL.cpp +++ b/Marlin/src/HAL/STM32F1/HAL.cpp @@ -113,6 +113,47 @@ #endif #endif +// ------------------------ +// Watchdog Timer +// ------------------------ + +#if ENABLED(USE_WATCHDOG) + + #include + + void watchdogSetup() { + // do whatever. don't remove this function. + } + + /** + * The watchdog clock is 40Khz. So for a 4s or 8s interval use a /256 preescaler and 625 or 1250 reload value (counts down to 0). + */ + #define STM32F1_WD_RELOAD TERN(WATCHDOG_DURATION_8S, 1250, 625) // 4 or 8 second timeout + + /** + * @brief Initialize the independent hardware watchdog. + * + * @return No return + * + * @details The watchdog clock is 40Khz. So for a 4s or 8s interval use a /256 preescaler and 625 or 1250 reload value (counts down to 0). + */ + void MarlinHAL::watchdog_init() { + #if DISABLED(DISABLE_WATCHDOG_INIT) + iwdg_init(IWDG_PRE_256, STM32F1_WD_RELOAD); + #endif + } + + // Reset watchdog. MUST be called every 4 or 8 seconds after the + // first watchdog_init or the STM32F1 will reset. + void MarlinHAL::watchdog_refresh() { + #if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED) + TOGGLE(LED_PIN); // heartbeat indicator + #endif + iwdg_feed(); + } + +#endif // USE_WATCHDOG + // ------------------------ // ADC // ------------------------ diff --git a/Marlin/src/HAL/STM32F1/HAL.h b/Marlin/src/HAL/STM32F1/HAL.h index a42dd89b8d27..b14b5f7e7926 100644 --- a/Marlin/src/HAL/STM32F1/HAL.h +++ b/Marlin/src/HAL/STM32F1/HAL.h @@ -34,7 +34,6 @@ #include "../shared/HAL_SPI.h" #include "fastio.h" -#include "watchdog.h" #include #include @@ -247,6 +246,10 @@ class MarlinHAL { // Earliest possible init, before setup() MarlinHAL() {} + // Watchdog + static void watchdog_init() IF_DISABLED(USE_WATCHDOG, {}); + static void watchdog_refresh() IF_DISABLED(USE_WATCHDOG, {}); + static void init(); // Called early in setup() static void init_board() {} // Called less early in setup() static void reboot(); // Restart the firmware from 0x0 diff --git a/Marlin/src/HAL/STM32F1/MinSerial.cpp b/Marlin/src/HAL/STM32F1/MinSerial.cpp index 0f7e0d5f10c5..6cf68d8d8f45 100644 --- a/Marlin/src/HAL/STM32F1/MinSerial.cpp +++ b/Marlin/src/HAL/STM32F1/MinSerial.cpp @@ -27,7 +27,6 @@ #if ENABLED(POSTMORTEM_DEBUGGING) #include "../shared/MinSerial.h" -#include "watchdog.h" #include #include @@ -82,7 +81,7 @@ static void TX(char c) { #if WITHIN(SERIAL_PORT, 1, 6) struct usart_dev* dev = MYSERIAL1.c_dev(); while (!(dev->regs->SR & USART_SR_TXE)) { - TERN_(USE_WATCHDOG, HAL_watchdog_refresh()); + hal.watchdog_refresh(); sw_barrier(); } dev->regs->DR = c; diff --git a/Marlin/src/HAL/STM32F1/watchdog.cpp b/Marlin/src/HAL/STM32F1/watchdog.cpp deleted file mode 100644 index b812a4fa6403..000000000000 --- a/Marlin/src/HAL/STM32F1/watchdog.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -/** - * HAL for stm32duino.com based on Libmaple and compatible (STM32F1) - */ - -#ifdef __STM32F1__ - -#include "../../inc/MarlinConfig.h" - -#if ENABLED(USE_WATCHDOG) - -#include -#include "watchdog.h" - -/** - * The watchdog clock is 40Khz. So for a 4s or 8s interval use a /256 preescaler and 625 or 1250 reload value (counts down to 0). - */ -#define STM32F1_WD_RELOAD TERN(WATCHDOG_DURATION_8S, 1250, 625) // 4 or 8 second timeout - -void HAL_watchdog_refresh() { - #if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED) - TOGGLE(LED_PIN); // heartbeat indicator - #endif - iwdg_feed(); -} - -void watchdogSetup() { - // do whatever. don't remove this function. -} - -/** - * @brief Initialized the independent hardware watchdog. - * - * @return No return - * - * @details The watchdog clock is 40Khz. So for a 4s or 8s interval use a /256 preescaler and 625 or 1250 reload value (counts down to 0). - */ -void watchdog_init() { - #if DISABLED(DISABLE_WATCHDOG_INIT) - iwdg_init(IWDG_PRE_256, STM32F1_WD_RELOAD); - #endif -} - -#endif // USE_WATCHDOG -#endif // __STM32F1__ diff --git a/Marlin/src/HAL/STM32F1/watchdog.h b/Marlin/src/HAL/STM32F1/watchdog.h deleted file mode 100644 index 68920f8cb692..000000000000 --- a/Marlin/src/HAL/STM32F1/watchdog.h +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#pragma once - -/** - * HAL for stm32duino.com based on Libmaple and compatible (STM32F1) - */ - -#include - -// Initialize watchdog with a 4 or 8 second countdown time -void watchdog_init(); - -// Reset watchdog. MUST be called every 4 or 8 seconds after the -// first watchdog_init or the STM32F1 will reset. -void HAL_watchdog_refresh(); diff --git a/Marlin/src/HAL/TEENSY31_32/HAL.cpp b/Marlin/src/HAL/TEENSY31_32/HAL.cpp index 28c3fdc4d6f4..2892368967e4 100644 --- a/Marlin/src/HAL/TEENSY31_32/HAL.cpp +++ b/Marlin/src/HAL/TEENSY31_32/HAL.cpp @@ -62,6 +62,28 @@ uint8_t MarlinHAL::get_reset_source() { return 0; } +// ------------------------ +// Watchdog Timer +// ------------------------ + +#if ENABLED(USE_WATCHDOG) + + #define WDT_TIMEOUT_MS TERN(WATCHDOG_DURATION_8S, 8000, 4000) // 4 or 8 second timeout + + void MarlinHAL::watchdog_init() { + WDOG_TOVALH = 0; + WDOG_TOVALL = WDT_TIMEOUT_MS; + WDOG_STCTRLH = WDOG_STCTRLH_WDOGEN; + } + + void MarlinHAL::watchdog_refresh() { + // Watchdog refresh sequence + WDOG_REFRESH = 0xA602; + WDOG_REFRESH = 0xB480; + } + +#endif + // ------------------------ // ADC // ------------------------ diff --git a/Marlin/src/HAL/TEENSY31_32/HAL.h b/Marlin/src/HAL/TEENSY31_32/HAL.h index dc0d2d3fa939..a7aa9f0da211 100644 --- a/Marlin/src/HAL/TEENSY31_32/HAL.h +++ b/Marlin/src/HAL/TEENSY31_32/HAL.h @@ -32,7 +32,6 @@ #include "../shared/HAL_SPI.h" #include "fastio.h" -#include "watchdog.h" #include @@ -135,6 +134,10 @@ class MarlinHAL { // Earliest possible init, before setup() MarlinHAL() {} + // Watchdog + static void watchdog_init() IF_DISABLED(USE_WATCHDOG, {}); + static void watchdog_refresh() IF_DISABLED(USE_WATCHDOG, {}); + static void init() {} // Called early in setup() static void init_board() {} // Called less early in setup() static void reboot(); // Restart the firmware from 0x0 diff --git a/Marlin/src/HAL/TEENSY31_32/watchdog.cpp b/Marlin/src/HAL/TEENSY31_32/watchdog.cpp deleted file mode 100644 index 5e21236129db..000000000000 --- a/Marlin/src/HAL/TEENSY31_32/watchdog.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#ifdef __MK20DX256__ - -#include "../../inc/MarlinConfig.h" - -#if ENABLED(USE_WATCHDOG) - -#include "watchdog.h" - -#define WDT_TIMEOUT_MS TERN(WATCHDOG_DURATION_8S, 8000, 4000) // 4 or 8 second timeout - -void watchdog_init() { - WDOG_TOVALH = 0; - WDOG_TOVALL = WDT_TIMEOUT_MS; - WDOG_STCTRLH = WDOG_STCTRLH_WDOGEN; -} - -#endif // USE_WATCHDOG - -#endif // __MK20DX256__ diff --git a/Marlin/src/HAL/TEENSY31_32/watchdog.h b/Marlin/src/HAL/TEENSY31_32/watchdog.h deleted file mode 100644 index b8b46a403013..000000000000 --- a/Marlin/src/HAL/TEENSY31_32/watchdog.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#pragma once - -#include "HAL.h" - -// Arduino Due core now has watchdog support - -void watchdog_init(); - -inline void HAL_watchdog_refresh() { - // Watchdog refresh sequence - WDOG_REFRESH = 0xA602; - WDOG_REFRESH = 0xB480; -} diff --git a/Marlin/src/HAL/TEENSY35_36/HAL.cpp b/Marlin/src/HAL/TEENSY35_36/HAL.cpp index 5fbb49fd924f..bc02ac1c4524 100644 --- a/Marlin/src/HAL/TEENSY35_36/HAL.cpp +++ b/Marlin/src/HAL/TEENSY35_36/HAL.cpp @@ -61,6 +61,28 @@ uint8_t MarlinHAL::get_reset_source() { return 0; } +// ------------------------ +// Watchdog Timer +// ------------------------ + +#if ENABLED(USE_WATCHDOG) + + #define WDT_TIMEOUT_MS TERN(WATCHDOG_DURATION_8S, 8000, 4000) // 4 or 8 second timeout + + void MarlinHAL::watchdog_init() { + WDOG_TOVALH = 0; + WDOG_TOVALL = WDT_TIMEOUT_MS; + WDOG_STCTRLH = WDOG_STCTRLH_WDOGEN; + } + + void MarlinHAL::watchdog_refresh() { + // Watchdog refresh sequence + WDOG_REFRESH = 0xA602; + WDOG_REFRESH = 0xB480; + } + +#endif + // ------------------------ // ADC // ------------------------ diff --git a/Marlin/src/HAL/TEENSY35_36/HAL.h b/Marlin/src/HAL/TEENSY35_36/HAL.h index 84f071d73d49..2a192e47189d 100644 --- a/Marlin/src/HAL/TEENSY35_36/HAL.h +++ b/Marlin/src/HAL/TEENSY35_36/HAL.h @@ -32,7 +32,6 @@ #include "../shared/HAL_SPI.h" #include "fastio.h" -#include "watchdog.h" #include #include @@ -140,6 +139,10 @@ class MarlinHAL { // Earliest possible init, before setup() MarlinHAL() {} + // Watchdog + static void watchdog_init() IF_DISABLED(USE_WATCHDOG, {}); + static void watchdog_refresh() IF_DISABLED(USE_WATCHDOG, {}); + static void init() {} // Called early in setup() static void init_board() {} // Called less early in setup() static void reboot(); // Restart the firmware from 0x0 diff --git a/Marlin/src/HAL/TEENSY35_36/watchdog.cpp b/Marlin/src/HAL/TEENSY35_36/watchdog.cpp deleted file mode 100644 index 3825e2792869..000000000000 --- a/Marlin/src/HAL/TEENSY35_36/watchdog.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#if defined(__MK64FX512__) || defined(__MK66FX1M0__) - -#include "../../inc/MarlinConfig.h" - -#if ENABLED(USE_WATCHDOG) - -#include "watchdog.h" - -#define WDT_TIMEOUT_MS TERN(WATCHDOG_DURATION_8S, 8000, 4000) // 4 or 8 second timeout - -void watchdog_init() { - WDOG_TOVALH = 0; - WDOG_TOVALL = WDT_TIMEOUT_MS; - WDOG_STCTRLH = WDOG_STCTRLH_WDOGEN; -} - -#endif // USE_WATCHDOG - -#endif // __MK64FX512__ || __MK66FX1M0__ diff --git a/Marlin/src/HAL/TEENSY35_36/watchdog.h b/Marlin/src/HAL/TEENSY35_36/watchdog.h deleted file mode 100644 index 981b1f0bd20b..000000000000 --- a/Marlin/src/HAL/TEENSY35_36/watchdog.h +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#pragma once - -void watchdog_init(); - -inline void HAL_watchdog_refresh() { - // Watchdog refresh sequence - WDOG_REFRESH = 0xA602; - WDOG_REFRESH = 0xB480; -} diff --git a/Marlin/src/HAL/TEENSY40_41/HAL.cpp b/Marlin/src/HAL/TEENSY40_41/HAL.cpp index 4b9c55a2ca89..1d02ab8575c3 100644 --- a/Marlin/src/HAL/TEENSY40_41/HAL.cpp +++ b/Marlin/src/HAL/TEENSY40_41/HAL.cpp @@ -78,6 +78,31 @@ void MarlinHAL::clear_reset_source() { SRC_SRSR = reset_source; } +// ------------------------ +// Watchdog Timer +// ------------------------ + +#if ENABLED(USE_WATCHDOG) + + #define WDT_TIMEOUT TERN(WATCHDOG_DURATION_8S, 8, 4) // 4 or 8 second timeout + + constexpr uint8_t timeoutval = (WDT_TIMEOUT - 0.5f) / 0.5f; + + void MarlinHAL::watchdog_init() { + CCM_CCGR3 |= CCM_CCGR3_WDOG1(3); // enable WDOG1 clocks + WDOG1_WMCR = 0; // disable power down PDE + WDOG1_WCR |= WDOG_WCR_SRS | WDOG_WCR_WT(timeoutval); + WDOG1_WCR |= WDOG_WCR_WDE | WDOG_WCR_WDT | WDOG_WCR_SRE; + } + + void MarlinHAL::watchdog_refresh() { + // Watchdog refresh sequence + WDOG1_WSR = 0x5555; + WDOG1_WSR = 0xAAAA; + } + +#endif + // ------------------------ // ADC // ------------------------ diff --git a/Marlin/src/HAL/TEENSY40_41/HAL.h b/Marlin/src/HAL/TEENSY40_41/HAL.h index 0476a9809de0..c54a2e8a0b64 100644 --- a/Marlin/src/HAL/TEENSY40_41/HAL.h +++ b/Marlin/src/HAL/TEENSY40_41/HAL.h @@ -32,7 +32,6 @@ #include "../shared/HAL_SPI.h" #include "fastio.h" -#include "watchdog.h" #include #include @@ -162,6 +161,10 @@ class MarlinHAL { // Earliest possible init, before setup() MarlinHAL() {} + // Watchdog + static void watchdog_init() IF_DISABLED(USE_WATCHDOG, {}); + static void watchdog_refresh() IF_DISABLED(USE_WATCHDOG, {}); + static void init() {} // Called early in setup() static void init_board() {} // Called less early in setup() static void reboot(); // Restart the firmware from 0x0 diff --git a/Marlin/src/HAL/TEENSY40_41/watchdog.cpp b/Marlin/src/HAL/TEENSY40_41/watchdog.cpp deleted file mode 100644 index dd7c0aa92f09..000000000000 --- a/Marlin/src/HAL/TEENSY40_41/watchdog.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#ifdef __IMXRT1062__ - -/** - * HAL Watchdog for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A) - */ - -#include "../../inc/MarlinConfig.h" - -#if ENABLED(USE_WATCHDOG) - -#include "watchdog.h" - -#define WDT_TIMEOUT TERN(WATCHDOG_DURATION_8S, 8, 4) // 4 or 8 second timeout - -constexpr uint8_t timeoutval = (WDT_TIMEOUT - 0.5f) / 0.5f; - -void watchdog_init() { - CCM_CCGR3 |= CCM_CCGR3_WDOG1(3); // enable WDOG1 clocks - WDOG1_WMCR = 0; // disable power down PDE - WDOG1_WCR |= WDOG_WCR_SRS | WDOG_WCR_WT(timeoutval); - WDOG1_WCR |= WDOG_WCR_WDE | WDOG_WCR_WDT | WDOG_WCR_SRE; -} - -void HAL_watchdog_refresh() { - // Watchdog refresh sequence - WDOG1_WSR = 0x5555; - WDOG1_WSR = 0xAAAA; -} - -#endif // USE_WATCHDOG -#endif // __IMXRT1062__ diff --git a/Marlin/src/HAL/TEENSY40_41/watchdog.h b/Marlin/src/HAL/TEENSY40_41/watchdog.h deleted file mode 100644 index 03ab151b0706..000000000000 --- a/Marlin/src/HAL/TEENSY40_41/watchdog.h +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#pragma once - -/** - * HAL Watchdog for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A) - */ - -void watchdog_init(); - -void HAL_watchdog_refresh(); diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 59c76b6c2dae..4572dc9d7c87 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -934,18 +934,18 @@ void minkill(const bool steppers_off/*=false*/) { // Wait for both KILL and ENC to be released while (TERN0(HAS_KILL, kill_state()) || TERN0(SOFT_RESET_ON_KILL, ui.button_pressed())) - watchdog_refresh(); + hal.watchdog_refresh(); // Wait for either KILL or ENC to be pressed again while (TERN1(HAS_KILL, !kill_state()) && TERN1(SOFT_RESET_ON_KILL, !ui.button_pressed())) - watchdog_refresh(); + hal.watchdog_refresh(); // Reboot the board hal.reboot(); #else - for (;;) watchdog_refresh(); // Wait for RESET button or power-cycle + for (;;) hal.watchdog_refresh(); // Wait for RESET button or power-cycle #endif } @@ -1561,7 +1561,7 @@ void setup() { #endif #if ENABLED(USE_WATCHDOG) - SETUP_RUN(watchdog_init()); // Reinit watchdog after hal.get_reset_source call + SETUP_RUN(hal.watchdog_init()); // Reinit watchdog after hal.get_reset_source call #endif #if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER) diff --git a/Marlin/src/gcode/config/M43.cpp b/Marlin/src/gcode/config/M43.cpp index 0fc5edc54e98..de76b8e97936 100644 --- a/Marlin/src/gcode/config/M43.cpp +++ b/Marlin/src/gcode/config/M43.cpp @@ -69,7 +69,7 @@ inline void toggle_pins() { SERIAL_EOL(); } else { - watchdog_refresh(); + hal.watchdog_refresh(); report_pin_state_extended(pin, ignore_protection, true, F("Pulsing ")); #ifdef __STM32F1__ const auto prior_mode = _GET_MODE(i); @@ -98,10 +98,10 @@ inline void toggle_pins() { { pinMode(pin, OUTPUT); for (int16_t j = 0; j < repeat; j++) { - watchdog_refresh(); extDigitalWrite(pin, 0); safe_delay(wait); - watchdog_refresh(); extDigitalWrite(pin, 1); safe_delay(wait); - watchdog_refresh(); extDigitalWrite(pin, 0); safe_delay(wait); - watchdog_refresh(); + hal.watchdog_refresh(); extDigitalWrite(pin, 0); safe_delay(wait); + hal.watchdog_refresh(); extDigitalWrite(pin, 1); safe_delay(wait); + hal.watchdog_refresh(); extDigitalWrite(pin, 0); safe_delay(wait); + hal.watchdog_refresh(); } } #ifdef __STM32F1__ diff --git a/Marlin/src/gcode/feature/L6470/M916-M918.cpp b/Marlin/src/gcode/feature/L6470/M916-M918.cpp index 8d614603eda0..9e1f1b98da34 100644 --- a/Marlin/src/gcode/feature/L6470/M916-M918.cpp +++ b/Marlin/src/gcode/feature/L6470/M916-M918.cpp @@ -309,7 +309,6 @@ void GcodeSuite::M917() { } DEBUG_ECHOLNPGM("."); reset_stepper_timeout(); // keep steppers powered - watchdog_refresh(); safe_delay(5000); status_composite_temp = 0; for (j = 0; j < driver_count; j++) { diff --git a/Marlin/src/gcode/gcode_d.cpp b/Marlin/src/gcode/gcode_d.cpp index 2dd1de00013b..2ebe38bbcf19 100644 --- a/Marlin/src/gcode/gcode_d.cpp +++ b/Marlin/src/gcode/gcode_d.cpp @@ -214,7 +214,7 @@ void GcodeSuite::D(const int16_t dcode) { c = 1024 * 4; while (c--) { - TERN_(USE_WATCHDOG, watchdog_refresh()); + hal.watchdog_refresh(); card.write(buf, COUNT(buf)); } SERIAL_ECHOLNPGM(" done"); @@ -231,7 +231,7 @@ void GcodeSuite::D(const int16_t dcode) { __attribute__((aligned(sizeof(size_t)))) uint8_t buf[512]; uint16_t c = 1024 * 4; while (c--) { - TERN_(USE_WATCHDOG, watchdog_refresh()); + hal.watchdog_refresh(); card.read(buf, COUNT(buf)); bool error = false; for (uint16_t i = 0; i < COUNT(buf); i++) { diff --git a/Marlin/src/lcd/e3v2/proui/meshviewer.cpp b/Marlin/src/lcd/e3v2/proui/meshviewer.cpp index ab968c44b103..c2d01a07eb76 100644 --- a/Marlin/src/lcd/e3v2/proui/meshviewer.cpp +++ b/Marlin/src/lcd/e3v2/proui/meshviewer.cpp @@ -74,7 +74,7 @@ void MeshViewerClass::DrawMesh(bed_mesh_t zval, const uint8_t sizex, const uint8 LOOP_S_L_N(x, 1, sizex - 1) DrawMeshVLine(x); LOOP_S_L_N(y, 1, sizey - 1) DrawMeshHLine(y); LOOP_L_N(y, sizey) { - watchdog_refresh(); + hal.watchdog_refresh(); LOOP_L_N(x, sizex) { uint16_t color = DWINUI::RainbowInt(zmesh[x][y], _MIN(-5, minz), _MAX(5, maxz)); uint8_t radius = rm(zmesh[x][y]); diff --git a/Marlin/src/lcd/extui/mks_ui/draw_print_file.cpp b/Marlin/src/lcd/extui/mks_ui/draw_print_file.cpp index ebad70859741..5d6a99191034 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_print_file.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_print_file.cpp @@ -402,7 +402,7 @@ void lv_gcode_file_read(uint8_t *data_buf) { char temp_test[200]; volatile uint16_t *p_index; - watchdog_refresh(); + hal.watchdog_refresh(); memset(public_buf, 0, 200); while (card.isFileOpen()) { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_z_offset_wizard.cpp b/Marlin/src/lcd/extui/mks_ui/draw_z_offset_wizard.cpp index d95efd862ba9..d143234fd53e 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_z_offset_wizard.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_z_offset_wizard.cpp @@ -104,7 +104,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { sync_plan_position(); // Raise Z as if it was homed do_z_clearance(Z_POST_CLEARANCE); - watchdog_refresh(); + hal.watchdog_refresh(); draw_return_ui(); return; case ID_M_RETURN: @@ -117,7 +117,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { #else // Otherwise do a Z clearance move like after Homing do_z_clearance(Z_POST_CLEARANCE); #endif - watchdog_refresh(); + hal.watchdog_refresh(); draw_return_ui(); return; } diff --git a/Marlin/src/lcd/extui/mks_ui/pic_manager.cpp b/Marlin/src/lcd/extui/mks_ui/pic_manager.cpp index ba2df10ecbd9..c618127980bb 100644 --- a/Marlin/src/lcd/extui/mks_ui/pic_manager.cpp +++ b/Marlin/src/lcd/extui/mks_ui/pic_manager.cpp @@ -267,12 +267,12 @@ void spiFlashErase_PIC() { W25QXX.init(SPI_QUARTER_SPEED); // erase 0x001000 -64K for (pic_sectorcnt = 0; pic_sectorcnt < (64 - 4) / 4; pic_sectorcnt++) { - watchdog_refresh(); + hal.watchdog_refresh(); W25QXX.SPI_FLASH_SectorErase(PICINFOADDR + pic_sectorcnt * 4 * 1024); } // erase 64K -- 6M for (pic_sectorcnt = 0; pic_sectorcnt < (PIC_SIZE_xM * 1024 / 64 - 1); pic_sectorcnt++) { - watchdog_refresh(); + hal.watchdog_refresh(); W25QXX.SPI_FLASH_BlockErase((pic_sectorcnt + 1) * 64 * 1024); } } @@ -282,7 +282,7 @@ void spiFlashErase_PIC() { volatile uint32_t Font_sectorcnt = 0; W25QXX.init(SPI_QUARTER_SPEED); for (Font_sectorcnt = 0; Font_sectorcnt < 32 - 1; Font_sectorcnt++) { - watchdog_refresh(); + hal.watchdog_refresh(); W25QXX.SPI_FLASH_BlockErase(FONTINFOADDR + Font_sectorcnt * 64 * 1024); } } @@ -414,7 +414,7 @@ uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) { return; } - watchdog_refresh(); + hal.watchdog_refresh(); disp_assets_update_progress(fn); W25QXX.init(SPI_QUARTER_SPEED); @@ -427,21 +427,21 @@ uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) { totalSizeLoaded += pfileSize; if (assetType == ASSET_TYPE_LOGO) { do { - watchdog_refresh(); + hal.watchdog_refresh(); pbr = file.read(public_buf, BMP_WRITE_BUF_LEN); Pic_Logo_Write((uint8_t*)fn, public_buf, pbr); } while (pbr >= BMP_WRITE_BUF_LEN); } else if (assetType == ASSET_TYPE_TITLE_LOGO) { do { - watchdog_refresh(); + hal.watchdog_refresh(); pbr = file.read(public_buf, BMP_WRITE_BUF_LEN); Pic_TitleLogo_Write((uint8_t*)fn, public_buf, pbr); } while (pbr >= BMP_WRITE_BUF_LEN); } else if (assetType == ASSET_TYPE_G_PREVIEW) { do { - watchdog_refresh(); + hal.watchdog_refresh(); pbr = file.read(public_buf, BMP_WRITE_BUF_LEN); default_view_Write(public_buf, pbr); } while (pbr >= BMP_WRITE_BUF_LEN); @@ -451,7 +451,7 @@ uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) { SPIFlash.beginWrite(Pic_Write_Addr); #if HAS_SPI_FLASH_COMPRESSION do { - watchdog_refresh(); + hal.watchdog_refresh(); pbr = file.read(public_buf, SPI_FLASH_PageSize); TERN_(MARLIN_DEV_MODE, totalSizes += pbr); SPIFlash.writeData(public_buf, SPI_FLASH_PageSize); @@ -472,7 +472,7 @@ uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) { else if (assetType == ASSET_TYPE_FONT) { Pic_Write_Addr = UNIGBK_FLASH_ADDR; do { - watchdog_refresh(); + hal.watchdog_refresh(); pbr = file.read(public_buf, BMP_WRITE_BUF_LEN); W25QXX.SPI_FLASH_BufferWrite(public_buf, Pic_Write_Addr, pbr); Pic_Write_Addr += pbr; @@ -493,11 +493,11 @@ uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) { disp_assets_update(); disp_assets_update_progress(F("Erasing pics...")); - watchdog_refresh(); + hal.watchdog_refresh(); spiFlashErase_PIC(); #if HAS_SPI_FLASH_FONT disp_assets_update_progress(F("Erasing fonts...")); - watchdog_refresh(); + hal.watchdog_refresh(); spiFlashErase_FONT(); #endif diff --git a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp index 6e852a748703..378521031509 100644 --- a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp +++ b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp @@ -125,13 +125,13 @@ void tft_lvgl_init() { ui_cfg_init(); disp_language_init(); - watchdog_refresh(); // LVGL init takes time + hal.watchdog_refresh(); // LVGL init takes time // Init TFT first! SPI_TFT.spi_init(SPI_FULL_SPEED); SPI_TFT.LCD_init(); - watchdog_refresh(); // LVGL init takes time + hal.watchdog_refresh(); // LVGL init takes time #if ENABLED(USB_FLASH_DRIVE_SUPPORT) uint16_t usb_flash_loop = 1000; @@ -142,21 +142,21 @@ void tft_lvgl_init() { #endif do { card.media_driver_usbFlash.idle(); - watchdog_refresh(); + hal.watchdog_refresh(); delay(2); } while (!card.media_driver_usbFlash.isInserted() && usb_flash_loop--); card.mount(); #elif HAS_LOGO_IN_FLASH delay(1000); - watchdog_refresh(); + hal.watchdog_refresh(); delay(1000); #endif - watchdog_refresh(); // LVGL init takes time + hal.watchdog_refresh(); // LVGL init takes time #if ENABLED(SDSUPPORT) UpdateAssets(); - watchdog_refresh(); // LVGL init takes time + hal.watchdog_refresh(); // LVGL init takes time TERN_(MKS_TEST, mks_test_get()); #endif diff --git a/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp b/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp index df90321c895d..73a76323fd2b 100644 --- a/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp +++ b/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp @@ -123,7 +123,7 @@ uint32_t getWifiTickDiff(int32_t lastTick, int32_t curTick) { void wifi_delay(int n) { const uint32_t start = getWifiTick(); while (getWifiTickDiff(start, getWifiTick()) < (uint32_t)n) - watchdog_refresh(); + hal.watchdog_refresh(); } void wifi_reset() { @@ -1882,7 +1882,7 @@ void wifi_rcv_handle() { void wifi_looping() { do { wifi_rcv_handle(); - watchdog_refresh(); + hal.watchdog_refresh(); } while (wifi_link_state == WIFI_TRANS_FILE); } @@ -1897,7 +1897,7 @@ void mks_esp_wifi_init() { esp_state = TRANSFER_IDLE; esp_port_begin(1); - watchdog_refresh(); + hal.watchdog_refresh(); wifi_reset(); #if 0 @@ -1950,14 +1950,14 @@ void mks_esp_wifi_init() { } void mks_wifi_firmware_update() { - watchdog_refresh(); + hal.watchdog_refresh(); card.openFileRead((char *)ESP_FIRMWARE_FILE); if (card.isFileOpen()) { card.closefile(); wifi_delay(2000); - watchdog_refresh(); + hal.watchdog_refresh(); if (usartFifoAvailable((SZ_USART_FIFO *)&WifiRxFifo) < 20) return; clear_cur_ui(); @@ -1965,7 +1965,7 @@ void mks_wifi_firmware_update() { lv_draw_dialog(DIALOG_TYPE_UPDATE_ESP_FIRMWARE); lv_task_handler(); - watchdog_refresh(); + hal.watchdog_refresh(); if (wifi_upload(0) >= 0) { card.removeFile((char *)ESP_FIRMWARE_FILE_RENAME); diff --git a/Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp b/Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp index 675e0eb666d2..c07cc47a3689 100644 --- a/Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp +++ b/Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp @@ -265,7 +265,7 @@ EspUploadResult readPacket(uint8_t op, uint32_t *valp, size_t *bodyLen, uint32_t EspUploadResult stat; //IWDG_ReloadCounter(); - watchdog_refresh(); + hal.watchdog_refresh(); if (getWifiTickDiff(startTime, getWifiTick()) > msTimeout) return timeout; @@ -445,7 +445,7 @@ EspUploadResult Sync(uint16_t timeout) { for (;;) { size_t bodyLen; EspUploadResult rc = readPacket(ESP_SYNC, 0, &bodyLen, defaultTimeout); - watchdog_refresh(); + hal.watchdog_refresh(); if (rc != success || bodyLen != 2) break; } } @@ -673,7 +673,7 @@ int32_t wifi_upload(int type) { while (esp_upload.state != upload_idle) { upload_spin(); - watchdog_refresh(); + hal.watchdog_refresh(); } ResetWiFiForUpload(1); diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 84bd1c50078e..aa1cc04a3a03 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -1226,10 +1226,10 @@ inline void loud_kill(FSTR_P const lcd_msg, const heater_id_t heater_id) { thermalManager.disable_all_heaters(); #if HAS_BEEPER for (uint8_t i = 20; i--;) { - watchdog_refresh(); + hal.watchdog_refresh(); buzzer.click(25); delay(80); - watchdog_refresh(); + hal.watchdog_refresh(); } buzzer.on(); #endif @@ -1274,7 +1274,7 @@ void Temperature::_temp_error(const heater_id_t heater_id, FSTR_P const serial_m } disable_all_heaters(); // always disable (even for bogus temp) - watchdog_refresh(); + hal.watchdog_refresh(); #if BOGUS_TEMPERATURE_GRACE_PERIOD const millis_t ms = millis(); @@ -1638,7 +1638,7 @@ void Temperature::min_temp_error(const heater_id_t heater_id) { * - Update the heated bed PID output value */ void Temperature::manage_heater() { - if (marlin_state == MF_INITIALIZING) return watchdog_refresh(); // If Marlin isn't started, at least reset the watchdog! + if (marlin_state == MF_INITIALIZING) return hal.watchdog_refresh(); // If Marlin isn't started, at least reset the watchdog! static bool no_reentry = false; // Prevent recursion if (no_reentry) return; @@ -2387,7 +2387,7 @@ void Temperature::manage_heater() { */ void Temperature::updateTemperaturesFromRawValues() { - watchdog_refresh(); // Reset because raw_temps_ready was set by the interrupt + hal.watchdog_refresh(); // Reset because raw_temps_ready was set by the interrupt TERN_(TEMP_SENSOR_0_IS_MAX_TC, temp_hotend[0].setraw(READ_MAX_TC(0))); TERN_(TEMP_SENSOR_1_IS_MAX_TC, temp_hotend[1].setraw(READ_MAX_TC(1))); diff --git a/Marlin/src/sd/Sd2Card.cpp b/Marlin/src/sd/Sd2Card.cpp index 3402bfaee382..2d84c95a3d19 100644 --- a/Marlin/src/sd/Sd2Card.cpp +++ b/Marlin/src/sd/Sd2Card.cpp @@ -249,7 +249,7 @@ bool DiskIODriver_SPI_SD::init(const uint8_t sckRateID, const pin_t chipSelectPi const millis_t init_timeout = millis() + SD_INIT_TIMEOUT; uint32_t arg; - watchdog_refresh(); // In case init takes too long + hal.watchdog_refresh(); // In case init takes too long // Set pin modes #if ENABLED(ZONESTAR_12864OLED) @@ -270,7 +270,7 @@ bool DiskIODriver_SPI_SD::init(const uint8_t sckRateID, const pin_t chipSelectPi // Must supply min of 74 clock cycles with CS high. LOOP_L_N(i, 10) spiSend(0xFF); - watchdog_refresh(); // In case init takes too long + hal.watchdog_refresh(); // In case init takes too long // Command to go idle in SPI mode while ((status_ = cardCommand(CMD0, 0)) != R1_IDLE_STATE) { @@ -284,7 +284,7 @@ bool DiskIODriver_SPI_SD::init(const uint8_t sckRateID, const pin_t chipSelectPi crcSupported = (cardCommand(CMD59, 1) == R1_IDLE_STATE); #endif - watchdog_refresh(); // In case init takes too long + hal.watchdog_refresh(); // In case init takes too long // check SD version for (;;) { @@ -306,7 +306,7 @@ bool DiskIODriver_SPI_SD::init(const uint8_t sckRateID, const pin_t chipSelectPi } } - watchdog_refresh(); // In case init takes too long + hal.watchdog_refresh(); // In case init takes too long // Initialize card and send host supports SDHC if SD2 arg = type() == SD_CARD_TYPE_SD2 ? 0x40000000 : 0; From 2bb9e0d58e6513b47f90e729876de98ac7ccdade Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 20 May 2022 11:27:09 -0500 Subject: [PATCH 080/241] =?UTF-8?q?=F0=9F=94=A7=20Remove=20LCD=5FSERIAL=5F?= =?UTF-8?q?PORT=20defaults,=20warn=20on=20auto-assign=20(#24170)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 7 ------- Marlin/Configuration_adv.h | 1 - Marlin/src/inc/Conditionals_LCD.h | 9 --------- Marlin/src/inc/Conditionals_adv.h | 18 ++++++++++++++++++ Marlin/src/inc/SanityCheck.h | 2 ++ Marlin/src/inc/Warnings.cpp | 4 ++++ 6 files changed, 24 insertions(+), 17 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 875adc21a481..b43421f93033 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -2732,9 +2732,6 @@ // Touch-screen LCD for Malyan M200/M300 printers // //#define MALYAN_LCD -#if ENABLED(MALYAN_LCD) - #define LCD_SERIAL_PORT 1 // Default is 1 for Malyan M200 -#endif // // Touch UI for FTDI EVE (FT800/FT810) displays @@ -2748,7 +2745,6 @@ //#define ANYCUBIC_LCD_I3MEGA //#define ANYCUBIC_LCD_CHIRON #if EITHER(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON) - #define LCD_SERIAL_PORT 3 // Default is 3 for Anycubic //#define ANYCUBIC_LCD_DEBUG #endif @@ -2756,9 +2752,6 @@ // 320x240 Nextion 2.8" serial TFT Resistive Touch Screen NX3224T028 // //#define NEXTION_TFT -#if ENABLED(NEXTION_TFT) - #define LCD_SERIAL_PORT 1 // Default is 1 for Nextion -#endif // // Third-party or vendor-customized controller interfaces. diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 9a3210b5f8dc..ef54315e604f 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1764,7 +1764,6 @@ // Additional options for DGUS / DWIN displays // #if HAS_DGUS_LCD - #define LCD_SERIAL_PORT 3 #define LCD_BAUDRATE 115200 #define DGUS_RX_BUFFER_SIZE 128 diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index b93478933ddd..ba60e2481fcb 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -485,15 +485,6 @@ // E3V2 extras #if HAS_DWIN_E3V2 || IS_DWIN_MARLINUI #define SERIAL_CATCHALL 0 - #ifndef LCD_SERIAL_PORT - #if MB(BTT_SKR_MINI_E3_V1_0, BTT_SKR_MINI_E3_V1_2, BTT_SKR_MINI_E3_V2_0, BTT_SKR_MINI_E3_V3_0, BTT_SKR_E3_TURBO) - #define LCD_SERIAL_PORT 1 - #elif MB(CREALITY_V24S1_301, CREALITY_V24S1_301F4, CREALITY_V423) - #define LCD_SERIAL_PORT 2 // Creality Ender3S1 board - #else - #define LCD_SERIAL_PORT 3 // Creality 4.x board - #endif - #endif #define HAS_LCD_BRIGHTNESS 1 #define LCD_BRIGHTNESS_MAX 250 #if ENABLED(DWIN_LCD_PROUI) diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 5e198d757d9b..caed384a6383 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -1014,6 +1014,24 @@ #define HAS_USER_ITEM(N) 0 #endif +/** + * LCD_SERIAL_PORT must be defined ahead of HAL.h + */ +#ifndef LCD_SERIAL_PORT + #if HAS_DWIN_E3V2 || IS_DWIN_MARLINUI + #if MB(BTT_SKR_MINI_E3_V1_0, BTT_SKR_MINI_E3_V1_2, BTT_SKR_MINI_E3_V2_0, BTT_SKR_MINI_E3_V3_0, BTT_SKR_E3_TURBO) + #define LCD_SERIAL_PORT 1 + #elif MB(CREALITY_V24S1_301, CREALITY_V24S1_301F4, CREALITY_V423) + #define LCD_SERIAL_PORT 2 // Creality Ender3S1 board + #else + #define LCD_SERIAL_PORT 3 // Creality 4.x board + #endif + #endif + #ifdef LCD_SERIAL_PORT + #define AUTO_ASSIGNED_LCD_SERIAL 1 + #endif +#endif + #if !HAS_MULTI_SERIAL #undef MEATPACK_ON_SERIAL_PORT_2 #endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 24278f9f6a4d..eb442d58b8fb 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -3035,6 +3035,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "The ANYCUBIC LCD requires LCD_SERIAL_PORT to be defined." #elif ENABLED(MALYAN_LCD) #error "MALYAN_LCD requires LCD_SERIAL_PORT to be defined." + #elif ENABLED(NEXTION_LCD) + #error "NEXTION_LCD requires LCD_SERIAL_PORT to be defined." #endif #endif diff --git a/Marlin/src/inc/Warnings.cpp b/Marlin/src/inc/Warnings.cpp index 0abcd0513dda..054a006aff26 100644 --- a/Marlin/src/inc/Warnings.cpp +++ b/Marlin/src/inc/Warnings.cpp @@ -71,6 +71,10 @@ #ifndef NO_AUTO_ASSIGN_WARNING + #if AUTO_ASSIGNED_LCD_SERIAL + #warning "Note: Auto-assigned LCD_SERIAL_PORT. (Define NO_AUTO_ASSIGN_WARNING to suppress this warning.)" + #endif + #if AUTO_ASSIGNED_X2_STEPPER #warning "Note: Auto-assigned X2 STEP/DIR/ENABLE_PINs to unused En_STEP/DIR/ENABLE_PINs. (Define NO_AUTO_ASSIGN_WARNING to suppress this warning.)" #endif From 4b0b6e22a7b0050b696e8b4a15f94a8483bcb976 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Fri, 20 May 2022 09:48:34 -0700 Subject: [PATCH 081/241] =?UTF-8?q?=F0=9F=91=94=20Move=20GitHub=20template?= =?UTF-8?q?s,=20update=20README=20(#24199)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/ISSUE_TEMPLATE/bug_report.yml | 169 +++++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 20 +++ .github/ISSUE_TEMPLATE/feature_request.yml | 44 ++++++ .github/contributing.md | 10 +- .github/issue_template.md | 35 ----- README.md | 126 ++++++--------- buildroot/web-ui/data/www/index.html | 2 +- 7 files changed, 285 insertions(+), 121 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml delete mode 100644 .github/issue_template.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 000000000000..59269af81d7d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,169 @@ +name: 🪲 Report a bug +description: Create a bug report to help improve Marlin Firmware +title: "[BUG] (bug summary)" +body: + - type: markdown + attributes: + value: > + Do you want to ask a question? Are you looking for support? Please use one of the [support links](https://github.com/MarlinFirmware/Marlin/issues/new/choose). + + - type: markdown + attributes: + value: | + **Thank you for reporting a bug in Marlin Firmware!** + + ## Before Reporting a Bug + + - Read and understand Marlin's [Code of Conduct](https://github.com/MarlinFirmware/Marlin/blob/bugfix-2.0.x/.github/code_of_conduct.md). You are expected to comply with it, including treating everyone with respect. + + - Test with the [`bugfix-2.0.x` branch](https://github.com/MarlinFirmware/Marlin/archive/bugfix-2.0.x.zip) to see whether the issue still exists. + + ## Instructions + + Please follow the instructions below. Failure to do so may result in your issue being closed. See [Contributing to Marlin](https://github.com/MarlinFirmware/Marlin/blob/bugfix-2.0.x/.github/contributing.md) for additional guidelines. + + 1. Provide a good title starting with [BUG]. + 2. Fill out all sections of this bug report form. + 3. Always attach configuration files so we can build and test your setup. + + - type: dropdown + attributes: + label: Did you test the latest `bugfix-2.0.x` code? + description: >- + Always try the latest code to make sure the issue you are reporting is not already fixed. To download + the latest code just [click this link](https://github.com/MarlinFirmware/Marlin/archive/bugfix-2.0.x.zip). + options: + - Yes, and the problem still exists. + - No, but I will test it now! + validations: + required: true + + - type: markdown + attributes: + value: | + # Bug Details + + - type: textarea + attributes: + label: Bug Description + description: >- + Describe the bug in this section. Tell us what you were trying to do and what + happened that you did not expect. Provide a clear and concise description of the + problem and include as many details as possible. + placeholder: | + Marlin doesn't work. + validations: + required: true + + - type: input + attributes: + label: Bug Timeline + description: Is this a new bug or an old issue? When did it first start? + + - type: textarea + attributes: + label: Expected behavior + description: >- + What did you expect to happen? + placeholder: I expected it to move left. + + - type: textarea + attributes: + label: Actual behavior + description: What actually happened instead? + placeholder: It moved right instead of left. + + - type: textarea + attributes: + label: Steps to Reproduce + description: >- + Please describe the steps needed to reproduce the issue. + placeholder: | + 1. [First Step] ... + 2. [Second Step] ... + 3. [and so on] ... + + - type: markdown + attributes: + value: | + # Your Setup + + - type: input + attributes: + label: Version of Marlin Firmware + description: "See the About Menu on the LCD or the output of `M115`. NOTE: For older releases we only patch critical bugs." + validations: + required: true + + - type: input + attributes: + label: Printer model + description: Creality Ender 3, Prusa mini, or Kossel Delta? + + - type: input + attributes: + label: Electronics + description: Stock electronics, upgrade board, or something else? + + - type: input + attributes: + label: Add-ons + description: Please list any hardware add-ons that could be involved. + + - type: dropdown + attributes: + label: Bed Leveling + description: What kind of bed leveling compensation are you using? + options: + - UBL Bilinear mesh + - ABL Bilinear mesh + - ABL Linear grid + - ABL 3-point + - MBL Manual Bed Leveling + - No Bed Leveling + + - type: dropdown + attributes: + label: Your Slicer + description: Do you use Slic3r, Prusa Slicer, Simplify3D, IdeaMaker...? + options: + - Slic3r + - Simplify3D + - Prusa Slicer + - IdeaMaker + - Cura + - Other (explain below) + + - type: dropdown + attributes: + label: Host Software + description: Do you use OctoPrint, Repetier Host, Pronterface...? + options: + - SD Card (headless) + - Repetier Host + - OctoPrint + - Pronterface + - Cura + - Same as my slicer + - Other (explain below) + + - type: markdown + attributes: + value: >- + ## Other things to include + + Please also be sure to include these items to help with troubleshooting: + + * **A ZIP file** containing your `Configuration.h` and `Configuration_adv.h`. + (Please don't paste lengthy configuration text here.) + * **Log output** from the host. (`M111 S247` for maximum logging.) + * **Images or videos** demonstrating the problem, if it helps to make it clear. + * **A G-Code file** that exposes the problem, if not affecting _all_ G-code. + + If you've made any other modifications to the firmware, please describe them in detail in the space provided. + + When pasting formatted text into the box below don't forget to put ` ``` ` (on its own line) before and after to make it readable. + + - type: textarea + attributes: + label: Additional information & file uploads diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000000..1fe68966fbba --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,20 @@ +blank_issues_enabled: false +contact_links: + - name: 📖 Marlin Documentation + url: https://marlinfw.org/ + about: Lots of documentation on installing and using Marlin. + - name: 👤 MarlinFirmware Facebook group + url: https://www.facebook.com/groups/1049718498464482 + about: Please ask and answer questions here. + - name: 🕹 Marlin on Discord + url: https://discord.gg/n5NJ59y + about: Join the Discord server for support and discussion. + - name: 🔗 Marlin Discussion Forum + url: https://reprap.org/forum/list.php?415 + about: A searchable web forum hosted by RepRap dot org. + - name: 📺 Marlin Videos on YouTube + url: https://www.youtube.com/results?search_query=marlin+firmware + about: Tutorials and more from Marlin users all around the world. Great for new users! + - name: 💸 Want to donate? + url: https://www.thinkyhead.com/donate-to-marlin + about: Please take a look at the various options to support Marlin Firmware's development financially! diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 000000000000..df1938ccd84a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,44 @@ +name: ✨ Request a feature +description: Request a new Marlin Firmware feature +title: "[FR] (feature summary)" +labels: 'T: Feature Request' +body: + - type: markdown + attributes: + value: > + Do you want to ask a question? Are you looking for support? Please use one of the [support links](https://github.com/MarlinFirmware/Marlin/issues/new/choose). + + - type: markdown + attributes: + value: > + **Thank you for requesting a new Marlin Firmware feature!** + + ## Before Requesting a Feature + + - Read and understand Marlin's [Code of Conduct](https://github.com/MarlinFirmware/Marlin/blob/master/.github/code_of_conduct.md). You are expected to comply with it, including treating everyone with respect. + + - Check the latest [`bugfix-2.0.x` branch](https://github.com/MarlinFirmware/Marlin/archive/bugfix-2.0.x.zip) to see if the feature already exists. + + - Before you proceed with your request, please consider if it is necessary to make it into a firmware feature, or if it may be better suited for a slicer or host feature. + + - type: textarea + attributes: + label: Is your feature request related to a problem? Please describe. + description: A clear description of the problem (e.g., "I need X but Marlin can't do it [...]"). + + - type: textarea + attributes: + label: Are you looking for hardware support? + description: Tell us the printer, board, or peripheral that needs support. + + - type: textarea + attributes: + label: Describe the feature you want + description: A clear description of the feature and how you think it should work. + validations: + required: true + + - type: textarea + attributes: + label: Additional context + description: Add any other context or screenshots about the feature request here. diff --git a/.github/contributing.md b/.github/contributing.md index 6bc7b5a00514..24b9dbdf8d0d 100644 --- a/.github/contributing.md +++ b/.github/contributing.md @@ -50,13 +50,13 @@ If chat is more your speed, you can join the MarlinFirmware Discord server: This section guides you through submitting a Bug Report for Marlin. Following these guidelines helps maintainers and the community understand your report, reproduce the behavior, and find related reports. -Before creating a Bug Report, please test the "nightly" development branch, as you might find out that you don't need to create one. When you are creating a Bug Report, please [include as many details as possible](#how-do-i-submit-a-good-bug-report). Fill out [the required template](issue_template.md), the information it asks for helps us resolve issues faster. +Before creating a Bug Report, please test the "nightly" development branch, as you might find out that you don't need to create one. When you are creating a Bug Report, please [include as many details as possible](#how-do-i-submit-a-good-bug-report). Fill out [the required template](ISSUE_TEMPLATE/bug_report.yml), the information it asks for helps us resolve issues faster. > **Note:** Regressions can happen. If you find a **Closed** issue that seems like your issue, go ahead and open a new issue and include a link to the original issue in the body of your new one. All you need to create a link is the issue number, preceded by #. For example, #8888. #### How Do I Submit A (Good) Bug Report? -Bugs are tracked as [GitHub issues](https://guides.github.com/features/issues/). Use the New Issue button to create an issue and provide the following information by filling in [the template](issue_template.md). +Bugs are tracked as [GitHub issues](https://guides.github.com/features/issues/). Use the New Issue button to create an issue and provide the following information by filling in [the template](ISSUE_TEMPLATE/bug_report.yml). Explain the problem and include additional details to help maintainers reproduce the problem: @@ -88,12 +88,12 @@ Include details about your configuration and environment: This section guides you through submitting a suggestion for Marlin, including completely new features and minor improvements to existing functionality. Following these guidelines helps maintainers and the community understand your suggestion and find related suggestions. -Before creating a suggestion, please check [this list](#before-submitting-a-suggestion) as you might find out that you don't need to create one. When you are creating an enhancement suggestion, please [include as many details as possible](#how-do-i-submit-a-good-enhancement-suggestion). Fill in [the template](issue_template.md), including the steps that you imagine you would take if the feature you're requesting existed. +Before creating a suggestion, please check [this list](https://github.com/MarlinFirmware/Marlin/issues?q=is%3Aopen+is%3Aissue+label%3A%22T%3A+Feature+Request%22) as you might find out that you don't need to create one. When you are creating an enhancement suggestion, please [include as many details as possible](#how-do-i-submit-a-good-feature-request). Fill in [the template](ISSUE_TEMPLATE/feature_request.yml), including the steps that you imagine you would take if the feature you're requesting existed. #### Before Submitting a Feature Request * **Check the [Marlin website](https://marlinfw.org/)** for tips — you might discover that the feature is already included. Most importantly, check if you're using [the latest version of Marlin](https://github.com/MarlinFirmware/Marlin/releases) and if you can get the desired behavior by changing [Marlin's config settings](https://marlinfw.org/docs/configuration/configuration.html). -* **Perform a [cursory search](https://github.com/MarlinFirmware/Marlin/issues?q=is%3Aissue)** to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one. +* **Perform a [cursory search](https://github.com/MarlinFirmware/Marlin/issues?q=is%3Aopen+is%3Aissue+label%3A%22T%3A+Feature+Request%22)** to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one. #### How Do I Submit A (Good) Feature Request? @@ -116,7 +116,7 @@ Unsure where to begin contributing to Marlin? You can start by looking through t ### Pull Requests -Pull Requests should always be targeted to working branches (e.g., `bugfix-1.1.x` and/or `bugfix-2.0.x`) and never to release branches (e.g., `1.1.x`). If this is your first Pull Request, please read our [Guide to Pull Requests](https://marlinfw.org/docs/development/getting_started_pull_requests.html) and Github's [Pull Request](https://help.github.com/articles/creating-a-pull-request/) documentation. +Pull Requests should always be targeted to working branches (e.g., `bugfix-2.0.x` and/or `bugfix-1.1.x`) and never to release branches (e.g., `2.0.x` and/or `1.1.x`). If this is your first Pull Request, please read our [Guide to Pull Requests](https://marlinfw.org/docs/development/getting_started_pull_requests.html) and Github's [Pull Request](https://help.github.com/articles/creating-a-pull-request/) documentation. * Fill in [the required template](pull_request_template.md). * Don't include issue numbers in the PR title. diff --git a/.github/issue_template.md b/.github/issue_template.md deleted file mode 100644 index 6cb34b8f588a..000000000000 --- a/.github/issue_template.md +++ /dev/null @@ -1,35 +0,0 @@ - - -### Description - - - -### Steps to Reproduce - - - -1. [First Step] -2. [Second Step] -3. [and so on...] - -**Expected behavior:** [What you expect to happen] - -**Actual behavior:** [What actually happens] - -#### Additional Information - -* Include a ZIP file containing your `Configuration.h` and `Configuration_adv.h` files. -* Provide pictures or links to videos that clearly demonstrate the issue. -* See [How Can I Contribute](#how-can-i-contribute) for additional guidelines. diff --git a/README.md b/README.md index 8b623b382e78..3dba2df2b3fc 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,10 @@ This branch is for patches to the latest 2.0.x release version. Periodically thi Download earlier versions of Marlin on the [Releases page](https://github.com/MarlinFirmware/Marlin/releases). +## Example Configurations + +Before building Marlin you'll need to configure it for your specific hardware. Your vendor should have already provided source code with configurations for the installed firmware, but if you ever decide to upgrade you'll need updated configuration files. Marlin users have contributed dozens of tested example configurations to get you started. Visit the [MarlinFirmware/Configurations](https://github.com/MarlinFirmware/Configurations) repository to find the right configuration for your hardware. + ## Building Marlin 2.0 To build Marlin 2.0 you'll need [Arduino IDE 1.8.8 or newer](https://www.arduino.cc/en/main/software) or [PlatformIO](https://docs.platformio.org/en/latest/ide.html#platformio-ide). We've posted detailed instructions on [Building Marlin with Arduino](https://marlinfw.org/docs/basics/install_arduino.html) and [Building Marlin with PlatformIO for ReArm](https://marlinfw.org/docs/basics/install_rearm.html) (which applies well to other 32-bit boards). @@ -28,80 +32,25 @@ To build Marlin 2.0 you'll need [Arduino IDE 1.8.8 or newer](https://www.arduino Marlin 2.0 introduces a layer of abstraction so that all the existing high-level code can be built for 32-bit platforms while still retaining full 8-bit AVR compatibility. Retaining AVR compatibility and a single code-base is important to us, because we want to make sure that features and patches get as much testing and attention as possible, and that all platforms always benefit from the latest improvements. -### Current HALs - - #### AVR (8-bit) - - board|processor|speed|flash|sram|logic|fpu - ----|---------|-----|-----|----|-----|--- - [Arduino AVR](https://www.arduino.cc/)|ATmega, ATTiny, etc.|16-20MHz|64-256k|2-16k|5V|no - - #### DUE - - boards|processor|speed|flash|sram|logic|fpu - ----|---------|-----|-----|----|-----|--- - [Arduino Due](https://www.arduino.cc/en/Guide/ArduinoDue), [RAMPS-FD](https://www.reprap.org/wiki/RAMPS-FD), etc.|[SAM3X8E ARM-Cortex M3](https://www.microchip.com/wwwproducts/en/ATsam3x8e)|84MHz|512k|64+32k|3.3V|no - - #### ESP32 - - board|processor|speed|flash|sram|logic|fpu - ----|---------|-----|-----|----|-----|--- - [ESP32](https://www.espressif.com/en/products/hardware/esp32/overview)|Tensilica Xtensa LX6|160-240MHz variants|---|---|3.3V|--- - - #### LPC1768 / LPC1769 - - boards|processor|speed|flash|sram|logic|fpu - ----|---------|-----|-----|----|-----|--- - [Re-ARM](https://www.kickstarter.com/projects/1245051645/re-arm-for-ramps-simple-32-bit-upgrade)|[LPC1768 ARM-Cortex M3](https://www.nxp.com/products/microcontrollers-and-processors/arm-based-processors-and-mcus/lpc-cortex-m-mcus/lpc1700-cortex-m3/512kb-flash-64kb-sram-ethernet-usb-lqfp100-package:LPC1768FBD100)|100MHz|512k|32+16+16k|3.3-5V|no - [MKS SBASE](https://reprap.org/forum/read.php?13,499322)|LPC1768 ARM-Cortex M3|100MHz|512k|32+16+16k|3.3-5V|no - [Selena Compact](https://github.com/Ales2-k/Selena)|LPC1768 ARM-Cortex M3|100MHz|512k|32+16+16k|3.3-5V|no - [Azteeg X5 GT](https://www.panucatt.com/azteeg_X5_GT_reprap_3d_printer_controller_p/ax5gt.htm)|LPC1769 ARM-Cortex M3|120MHz|512k|32+16+16k|3.3-5V|no - [Smoothieboard](https://reprap.org/wiki/Smoothieboard)|LPC1769 ARM-Cortex M3|120MHz|512k|64k|3.3-5V|no - - #### SAMD51 - - boards|processor|speed|flash|sram|logic|fpu - ----|---------|-----|-----|----|-----|--- - [Adafruit Grand Central M4](https://www.adafruit.com/product/4064)|[SAMD51P20A ARM-Cortex M4](https://www.microchip.com/wwwproducts/en/ATSAMD51P20A)|120MHz|1M|256k|3.3V|yes - - #### STM32F1 - - boards|processor|speed|flash|sram|logic|fpu - ----|---------|-----|-----|----|-----|--- - [Arduino STM32](https://github.com/rogerclarkmelbourne/Arduino_STM32)|[STM32F1](https://www.st.com/en/microcontrollers-microprocessors/stm32f103.html) ARM-Cortex M3|72MHz|256-512k|48-64k|3.3V|no - [Geeetech3D GTM32](https://github.com/Geeetech3D/Diagram/blob/master/Rostock301/Hardware_GTM32_PRO_VB.pdf)|[STM32F1](https://www.st.com/en/microcontrollers-microprocessors/stm32f103.html) ARM-Cortex M3|72MHz|256-512k|48-64k|3.3V|no - - #### STM32F4 - - boards|processor|speed|flash|sram|logic|fpu - ----|---------|-----|-----|----|-----|--- - [STEVAL-3DP001V1](https://www.st.com/en/evaluation-tools/steval-3dp001v1.html)|[STM32F401VE Arm-Cortex M4](https://www.st.com/en/microcontrollers-microprocessors/stm32f401ve.html)|84MHz|512k|64+32k|3.3-5V|yes - - #### Teensy++ 2.0 - - boards|processor|speed|flash|sram|logic|fpu - ----|---------|-----|-----|----|-----|--- - [Teensy++ 2.0](https://www.microchip.com/wwwproducts/en/AT90USB1286)|[AT90USB1286](https://www.microchip.com/wwwproducts/en/AT90USB1286)|16MHz|128k|8k|5V|no - - #### Teensy 3.1 / 3.2 - - boards|processor|speed|flash|sram|logic|fpu - ----|---------|-----|-----|----|-----|--- - [Teensy 3.2](https://www.pjrc.com/store/teensy32.html)|[MK20DX256VLH7](https://www.mouser.com/ProductDetail/NXP-Freescale/MK20DX256VLH7) ARM-Cortex M4|72MHz|256k|32k|3.3V-5V|yes - - #### Teensy 3.5 / 3.6 - - boards|processor|speed|flash|sram|logic|fpu - ----|---------|-----|-----|----|-----|--- - [Teensy 3.5](https://www.pjrc.com/store/teensy35.html)|[MK64FX512VMD12](https://www.mouser.com/ProductDetail/NXP-Freescale/MK64FX512VMD12) ARM-Cortex M4|120MHz|512k|192k|3.3-5V|yes - [Teensy 3.6](https://www.pjrc.com/store/teensy36.html)|[MK66FX1M0VMD18](https://www.mouser.com/ProductDetail/NXP-Freescale/MK66FX1M0VMD18) ARM-Cortex M4|180MHz|1M|256k|3.3V|yes - - #### Teensy 4.0 / 4.1 - - boards|processor|speed|flash|sram|logic|fpu - ----|---------|-----|-----|----|-----|--- - [Teensy 4.0](https://www.pjrc.com/store/teensy40.html)|[IMXRT1062DVL6A](https://www.mouser.com/new/nxp-semiconductors/nxp-imx-rt1060-crossover-processor/) ARM-Cortex M7|600MHz|1M|2M|3.3V|yes - [Teensy 4.1](https://www.pjrc.com/store/teensy41.html)|[IMXRT1062DVJ6A](https://www.mouser.com/new/nxp-semiconductors/nxp-imx-rt1060-crossover-processor/) ARM-Cortex M7|600MHz|1M|2M|3.3V|yes +### Supported Platforms + + Platform|MCU|Example Boards + --------|---|------- + [Arduino AVR](https://www.arduino.cc/)|ATmega|RAMPS, Melzi, RAMBo + [Teensy++ 2.0](https://www.microchip.com/en-us/product/AT90USB1286)|AT90USB1286|Printrboard + [Arduino Due](https://www.arduino.cc/en/Guide/ArduinoDue)|SAM3X8E|RAMPS-FD, RADDS, RAMPS4DUE + [ESP32](https://github.com/espressif/arduino-esp32)|ESP32|FYSETC E4, E4d@BOX, MRR + [LPC1768](https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/lpc1700-cortex-m3/512-kb-flash-64-kb-sram-ethernet-usb-lqfp100-package:LPC1768FBD100)|ARM® Cortex-M3|MKS SBASE, Re-ARM, Selena Compact + [LPC1769](https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/lpc1700-cortex-m3/512-kb-flash-64-kb-sram-ethernet-usb-lqfp100-package:LPC1769FBD100)|ARM® Cortex-M3|Smoothieboard, Azteeg X5 mini, TH3D EZBoard + [STM32F103](https://www.st.com/en/microcontrollers-microprocessors/stm32f103.html)|ARM® Cortex-M3|Malyan M200, GTM32 Pro, MKS Robin, BTT SKR Mini + [STM32F401](https://www.st.com/en/microcontrollers-microprocessors/stm32f401.html)|ARM® Cortex-M4|ARMED, Rumba32, SKR Pro, Lerdge, FYSETC S6 + [STM32F7x6](https://www.st.com/en/microcontrollers-microprocessors/stm32f7x6.html)|ARM® Cortex-M7|The Borg, RemRam V1 + [SAMD51P20A](https://www.adafruit.com/product/4064)|ARM® Cortex-M4|Adafruit Grand Central M4 + [Teensy 3.5](https://www.pjrc.com/store/teensy35.html)|ARM® Cortex-M4| + [Teensy 3.6](https://www.pjrc.com/store/teensy36.html)|ARM® Cortex-M4| + [Teensy 4.0](https://www.pjrc.com/store/teensy40.html)|ARM® Cortex-M7| + [Teensy 4.1](https://www.pjrc.com/store/teensy41.html)|ARM® Cortex-M7| + Linux Native|x86/ARM/etc.|Raspberry Pi ## Submitting Patches @@ -116,18 +65,35 @@ Proposed patches should be submitted as a Pull Request against the ([bugfix-2.0. - You can use `make tests-all-local` or `make tests-single-local TEST_TARGET=...`. - If you prefer Docker you can use `make tests-all-local-docker` or `make tests-all-local-docker TEST_TARGET=...`. -### [RepRap.org Wiki Page](https://reprap.org/wiki/Marlin) +## Marlin Support + +The Issue Queue is reserved for Bug Reports and Feature Requests. To get help with configuration and troubleshooting, please use the following resources: + +- [Marlin Documentation](https://marlinfw.org) - Official Marlin documentation +- [Marlin Discord](https://discord.gg/n5NJ59y) - Discuss issues with Marlin users and developers +- Facebook Group ["Marlin Firmware"](https://www.facebook.com/groups/1049718498464482/) +- RepRap.org [Marlin Forum](https://forums.reprap.org/list.php?415) +- Facebook Group ["Marlin Firmware for 3D Printers"](https://www.facebook.com/groups/3Dtechtalk/) +- [Marlin Configuration](https://www.youtube.com/results?search_query=marlin+configuration) on YouTube + +## Contributors + +Marlin is constantly improving thanks to a huge number of contributors from all over the world bringing their specialties and talents. Huge thanks are due to [all the contributors](https://github.com/MarlinFirmware/Marlin/graphs/contributors) who regularly patch up bugs, help direct traffic, and basically keep Marlin from falling apart. Marlin's continued existence would not be possible without them. -## Credits +## Administration -The current Marlin dev team consists of: +Regular users can open and close their own issues, but only the administrators can do project-related things like add labels, merge changes, set milestones, and kick trolls. The current Marlin admin team consists of: - - Scott Lahteine [[@thinkyhead](https://github.com/thinkyhead)] - USA   [Donate](https://www.thinkyhead.com/donate-to-marlin) / Flattr: [![Flattr Scott](https://api.flattr.com/button/flattr-badge-small.png)](https://flattr.com/submit/auto?user_id=thinkyhead&url=https://github.com/MarlinFirmware/Marlin&title=Marlin&language=&tags=github&category=software) + - Scott Lahteine [[@thinkyhead](https://github.com/thinkyhead)] - USA - Project Maintainer   [💸 Donate](https://www.thinkyhead.com/donate-to-marlin) - Roxanne Neufeld [[@Roxy-3D](https://github.com/Roxy-3D)] - USA + - Keith Bennett [[@thisiskeithb](https://github.com/thisiskeithb)] - USA   [💸 Donate](https://github.com/sponsors/thisiskeithb) + - Peter Ellens [[@ellensp](https://github.com/ellensp)] - New Zealand + - Victor Oliveira [[@rhapsodyv](https://github.com/rhapsodyv)] - Brazil - Chris Pepper [[@p3p](https://github.com/p3p)] - UK + - Jason Smith [[@sjasonsmith](https://github.com/sjasonsmith)] - USA + - Luu Lac [[@shitcreek](https://github.com/shitcreek)] - USA - Bob Kuhn [[@Bob-the-Kuhn](https://github.com/Bob-the-Kuhn)] - USA - - João Brazio [[@jbrazio](https://github.com/jbrazio)] - Portugal - - Erik van der Zalm [[@ErikZalm](https://github.com/ErikZalm)] - Netherlands   [![Flattr Erik](https://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=ErikZalm&url=https://github.com/MarlinFirmware/Marlin&title=Marlin&language=&tags=github&category=software) + - Erik van der Zalm [[@ErikZalm](https://github.com/ErikZalm)] - Netherlands   [💸 Donate](https://flattr.com/submit/auto?user_id=ErikZalm&url=https://github.com/MarlinFirmware/Marlin&title=Marlin&language=&tags=github&category=software) ## License diff --git a/buildroot/web-ui/data/www/index.html b/buildroot/web-ui/data/www/index.html index 54bcc13d7386..1a8db1cafb04 100644 --- a/buildroot/web-ui/data/www/index.html +++ b/buildroot/web-ui/data/www/index.html @@ -456,7 +456,7 @@
- +
From af59056c0904dfc95c870b905ada0ebb6dc9b05e Mon Sep 17 00:00:00 2001 From: Arthur Masson Date: Sat, 21 May 2022 21:45:30 +0200 Subject: [PATCH 082/241] =?UTF-8?q?=F0=9F=90=9B=20Fix=20Polargraph=20G92?= =?UTF-8?q?=20command=20(#24223)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/geometry/G92.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/gcode/geometry/G92.cpp b/Marlin/src/gcode/geometry/G92.cpp index 6e14cc4df915..58ed26a15aa8 100644 --- a/Marlin/src/gcode/geometry/G92.cpp +++ b/Marlin/src/gcode/geometry/G92.cpp @@ -93,7 +93,7 @@ void GcodeSuite::G92() { v = TERN0(HAS_EXTRUDERS, i == E_AXIS) ? l : LOGICAL_TO_NATIVE(l, i), // Axis position in NATIVE space (applying the existing offset) d = v - current_position[i]; // How much is the current axis position altered by? if (!NEAR_ZERO(d)) { - #if HAS_POSITION_SHIFT && !IS_SCARA // When using workspaces... + #if HAS_POSITION_SHIFT && NONE(IS_SCARA, POLARGRAPH) // When using workspaces... if (TERN1(HAS_EXTRUDERS, i != E_AXIS)) { position_shift[i] += d; // ...most axes offset the workspace... update_workspace_offset((AxisEnum)i); From e340a61e5226f4a93ec9ad0e5d6feeea452b90a2 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Sat, 21 May 2022 16:13:00 -0700 Subject: [PATCH 083/241] =?UTF-8?q?=F0=9F=90=9B=20Fix=20FLSUN=20Hispeed=20?= =?UTF-8?q?FIL=5FRUNOUT=5FPIN,=20MKS=20Robin=20Mini=20TFT=20pins=20(#24204?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h | 8 ++++---- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h index ada12ee3ea4b..9efae6e3a887 100644 --- a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h +++ b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h @@ -41,7 +41,7 @@ #define BOARD_NO_NATIVE_USB // Avoid conflict with TIMER_SERVO when using the STM32 HAL -#define TEMP_TIMER 5 +#define TEMP_TIMER 5 // // Release PB4 (Y_ENABLE_PIN) from JTAG NRST role @@ -92,7 +92,7 @@ #define Z_MAX_PIN PC4 // +Z #ifndef FIL_RUNOUT_PIN - #define FIL_RUNOUT_PIN MT_DET_1_PIN + #define FIL_RUNOUT_PIN PA4 // MT_DET #endif // @@ -217,14 +217,14 @@ // #if ENABLED(PSU_CONTROL) #define KILL_PIN PA2 // PW_DET - #define KILL_PIN_STATE HIGH + #define KILL_PIN_STATE HIGH //#define PS_ON_PIN PA3 // PW_CN /PW_OFF #endif #if HAS_TFT_LVGL_UI #define MT_DET_1_PIN PA4 // MT_DET #define MT_DET_2_PIN PE6 - #define MT_DET_PIN_STATE LOW + #define MT_DET_PIN_STATE LOW #endif // diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h index d45ab1a950ec..dac09d037fc6 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h @@ -153,6 +153,9 @@ #define FSMC_CS_PIN PD7 // NE4 #define FSMC_RS_PIN PD11 // A0 + #define TFT_CS_PIN FSMC_CS_PIN + #define TFT_RS_PIN FSMC_RS_PIN + #define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT #define FSMC_DMA_DEV DMA2 #define FSMC_DMA_CHANNEL DMA_CH5 From c16ae2451d83518fc43da17bc09527ab71372384 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 21 May 2022 19:29:59 -0500 Subject: [PATCH 084/241] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20const=20warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/AVR/pinsDebug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/HAL/AVR/pinsDebug.h b/Marlin/src/HAL/AVR/pinsDebug.h index 247ae32b8fa7..64d90ac94997 100644 --- a/Marlin/src/HAL/AVR/pinsDebug.h +++ b/Marlin/src/HAL/AVR/pinsDebug.h @@ -74,7 +74,7 @@ #define MULTI_NAME_PAD 26 // space needed to be pretty if not first name assigned to a pin void PRINT_ARRAY_NAME(uint8_t x) { - char *name_mem_pointer = (PGM_P)pgm_read_ptr(&pin_array[x].name); + const char * const name_mem_pointer = (PGM_P)pgm_read_ptr(&pin_array[x].name); LOOP_L_N(y, MAX_NAME_LENGTH) { char temp_char = pgm_read_byte(name_mem_pointer + y); if (temp_char != 0) From c5126de559719ebdaf4475b0db4ab21c26b90a1a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 22 May 2022 16:08:29 -0500 Subject: [PATCH 085/241] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20MAP?= =?UTF-8?q?=20macro=20for=20axis=20lists,=20etc.=20(#24191)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/macros.h | 29 +++++++++++++++-------- Marlin/src/core/types.h | 8 +++++++ Marlin/src/feature/spindle_laser.h | 2 -- Marlin/src/gcode/calibrate/M425.cpp | 13 ++--------- Marlin/src/lcd/menu/menu_advanced.cpp | 28 +++++++++------------- Marlin/src/lcd/menu/menu_motion.cpp | 5 ++-- Marlin/src/libs/L64XX/L64XX_Marlin.h | 2 +- Marlin/src/module/motion.cpp | 19 +++++---------- Marlin/src/module/probe.cpp | 6 +++-- Marlin/src/module/settings.cpp | 6 ++--- Marlin/src/module/stepper.cpp | 12 ++-------- Marlin/src/module/stepper/trinamic.cpp | 32 ++++++++------------------ 12 files changed, 67 insertions(+), 95 deletions(-) diff --git a/Marlin/src/core/macros.h b/Marlin/src/core/macros.h index c12386b46b72..b7d1ac916eee 100644 --- a/Marlin/src/core/macros.h +++ b/Marlin/src/core/macros.h @@ -712,13 +712,22 @@ #define RREPEAT2_S(S,N,OP,V...) EVAL1024(_RREPEAT2(S,SUB##S(N),OP,V)) #define RREPEAT2(N,OP,V...) RREPEAT2_S(0,N,OP,V) -// See https://github.com/swansontec/map-macro -#define MAP_OUT -#define MAP_END(...) -#define MAP_GET_END() 0, MAP_END -#define MAP_NEXT0(test, next, ...) next MAP_OUT -#define MAP_NEXT1(test, next) MAP_NEXT0 (test, next, 0) -#define MAP_NEXT(test, next) MAP_NEXT1 (MAP_GET_END test, next) -#define MAP0(f, x, peek, ...) f(x) MAP_NEXT (peek, MAP1) (f, peek, __VA_ARGS__) -#define MAP1(f, x, peek, ...) f(x) MAP_NEXT (peek, MAP0) (f, peek, __VA_ARGS__) -#define MAP(f, ...) EVAL512 (MAP1 (f, __VA_ARGS__, (), 0)) +// Call OP(A) with each item as an argument +#define _MAP(_MAP_OP,A,V...) \ + _MAP_OP(A) \ + IF_ELSE(HAS_ARGS(V)) \ + ( DEFER2(__MAP)()(_MAP_OP,V) ) \ + ( /* Do nothing */ ) +#define __MAP() _MAP + +#define MAP(OP,V...) EVAL(_MAP(OP,V)) + +// Emit a list of OP(A) with the given items +#define _MAPLIST(_MAP_OP,A,V...) \ + _MAP_OP(A) \ + IF_ELSE(HAS_ARGS(V)) \ + ( , DEFER2(__MAPLIST)()(_MAP_OP,V) ) \ + ( /* Do nothing */ ) +#define __MAPLIST() _MAPLIST + +#define MAPLIST(OP,V...) EVAL(_MAPLIST(OP,V)) diff --git a/Marlin/src/core/types.h b/Marlin/src/core/types.h index dace435fd14d..48a96d668cd4 100644 --- a/Marlin/src/core/types.h +++ b/Marlin/src/core/types.h @@ -39,18 +39,26 @@ struct IF { typedef L type; }; #define NUM_AXIS_GANG(V...) GANG_N(NUM_AXES, V) #define NUM_AXIS_CODE(V...) CODE_N(NUM_AXES, V) #define NUM_AXIS_LIST(V...) LIST_N(NUM_AXES, V) +#define NUM_AXIS_LIST_1(V) LIST_N_1(NUM_AXES, V) #define NUM_AXIS_ARRAY(V...) { NUM_AXIS_LIST(V) } +#define NUM_AXIS_ARRAY_1(V) { NUM_AXIS_LIST_1(V) } #define NUM_AXIS_ARGS(T...) NUM_AXIS_LIST(T x, T y, T z, T i, T j, T k, T u, T v, T w) #define NUM_AXIS_ELEM(O) NUM_AXIS_LIST(O.x, O.y, O.z, O.i, O.j, O.k, O.u, O.v, O.w) #define NUM_AXIS_DEFS(T,V) NUM_AXIS_LIST(T x=V, T y=V, T z=V, T i=V, T j=V, T k=V, T u=V, T v=V, T w=V) +#define MAIN_AXIS_NAMES NUM_AXIS_LIST(X, Y, Z, I, J, K, U, V, W) +#define MAIN_AXIS_MAP(F) MAP(F, MAIN_AXIS_NAMES) #define LOGICAL_AXIS_GANG(E,V...) NUM_AXIS_GANG(V) GANG_ITEM_E(E) #define LOGICAL_AXIS_CODE(E,V...) NUM_AXIS_CODE(V) CODE_ITEM_E(E) #define LOGICAL_AXIS_LIST(E,V...) NUM_AXIS_LIST(V) LIST_ITEM_E(E) +#define LOGICAL_AXIS_LIST_1(V) NUM_AXIS_LIST_1(V) LIST_ITEM_E(V) #define LOGICAL_AXIS_ARRAY(E,V...) { LOGICAL_AXIS_LIST(E,V) } +#define LOGICAL_AXIS_ARRAY_1(V) { LOGICAL_AXIS_LIST_1(V) } #define LOGICAL_AXIS_ARGS(T...) LOGICAL_AXIS_LIST(T e, T x, T y, T z, T i, T j, T k, T u, T v, T w) #define LOGICAL_AXIS_ELEM(O) LOGICAL_AXIS_LIST(O.e, O.x, O.y, O.z, O.i, O.j, O.k, O.u, O.v, O.w) #define LOGICAL_AXIS_DECL(T,V) LOGICAL_AXIS_LIST(T e=V, T x=V, T y=V, T z=V, T i=V, T j=V, T k=V, T u=V, T v=V, T w=V) +#define LOGICAL_AXIS_NAMES LOGICAL_AXIS_LIST(E, X, Y, Z, I, J, K, U, V, W) +#define LOGICAL_AXIS_MAP(F) MAP(F, LOGICAL_AXIS_NAMES) #define LOGICAL_AXES_STRING LOGICAL_AXIS_GANG("E", "X", "Y", "Z", STR_I, STR_J, STR_K, STR_U, STR_V, STR_W) diff --git a/Marlin/src/feature/spindle_laser.h b/Marlin/src/feature/spindle_laser.h index 1f9bec7bf0f9..2791dc7ad1be 100644 --- a/Marlin/src/feature/spindle_laser.h +++ b/Marlin/src/feature/spindle_laser.h @@ -41,8 +41,6 @@ #define PCT_TO_PWM(X) ((X) * 255 / 100) #define PCT_TO_SERVO(X) ((X) * 180 / 100) -// #define _MAP(N,S1,S2,D1,D2) ((N)*_MAX((D2)-(D1),0)/_MAX((S2)-(S1),1)+(D1)) - class SpindleLaser { public: static const inline uint8_t pct_to_ocr(const_float_t pct) { return uint8_t(PCT_TO_PWM(pct)); } diff --git a/Marlin/src/gcode/calibrate/M425.cpp b/Marlin/src/gcode/calibrate/M425.cpp index 77e0e5c09457..a6c6ff9dae3e 100644 --- a/Marlin/src/gcode/calibrate/M425.cpp +++ b/Marlin/src/gcode/calibrate/M425.cpp @@ -47,19 +47,10 @@ void GcodeSuite::M425() { bool noArgs = true; auto axis_can_calibrate = [](const uint8_t a) { + #define _CAN_CASE(N) case N##_AXIS: return AXIS_CAN_CALIBRATE(N); switch (a) { default: return false; - NUM_AXIS_CODE( - case X_AXIS: return AXIS_CAN_CALIBRATE(X), - case Y_AXIS: return AXIS_CAN_CALIBRATE(Y), - case Z_AXIS: return AXIS_CAN_CALIBRATE(Z), - case I_AXIS: return AXIS_CAN_CALIBRATE(I), - case J_AXIS: return AXIS_CAN_CALIBRATE(J), - case K_AXIS: return AXIS_CAN_CALIBRATE(K), - case U_AXIS: return AXIS_CAN_CALIBRATE(U), - case V_AXIS: return AXIS_CAN_CALIBRATE(V), - case W_AXIS: return AXIS_CAN_CALIBRATE(W) - ); + MAIN_AXIS_MAP(_CAN_CASE) } }; diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index b786931a42f0..b8dc08a5f12a 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -68,8 +68,8 @@ void menu_backlash(); LOOP_LOGICAL_AXES(i) driverPercent[i] = stepper_dac.get_current_percent((AxisEnum)i); START_MENU(); BACK_ITEM(MSG_ADVANCED_SETTINGS); - #define EDIT_DAC_PERCENT(A) EDIT_ITEM(uint8, MSG_DAC_PERCENT_##A, &driverPercent[_AXIS(A)], 0, 100, []{ stepper_dac.set_current_percents(driverPercent); }) - LOGICAL_AXIS_CODE(EDIT_DAC_PERCENT(E), EDIT_DAC_PERCENT(A), EDIT_DAC_PERCENT(B), EDIT_DAC_PERCENT(C), EDIT_DAC_PERCENT(I), EDIT_DAC_PERCENT(J), EDIT_DAC_PERCENT(K), EDIT_DAC_PERCENT(U), EDIT_DAC_PERCENT(V), EDIT_DAC_PERCENT(W)); + #define EDIT_DAC_PERCENT(A) EDIT_ITEM(uint8, MSG_DAC_PERCENT_##A, &driverPercent[_AXIS(A)], 0, 100, []{ stepper_dac.set_current_percents(driverPercent); }); + MAP(EDIT_DAC_PERCENT, LOGICAL_AXIS_LIST(E, A, B, C, I, J, K, U, V, W)); ACTION_ITEM(MSG_DAC_EEPROM_WRITE, stepper_dac.commit_eeprom); END_MENU(); } @@ -415,7 +415,7 @@ void menu_backlash(); #elif ENABLED(LIMITED_MAX_FR_EDITING) DEFAULT_MAX_FEEDRATE #else - LOGICAL_AXIS_ARRAY(9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999) + LOGICAL_AXIS_ARRAY_1(9999) #endif ; #if ENABLED(LIMITED_MAX_FR_EDITING) && !defined(MAX_FEEDRATE_EDIT_VALUES) @@ -427,8 +427,8 @@ void menu_backlash(); START_MENU(); BACK_ITEM(MSG_ADVANCED_SETTINGS); - #define EDIT_VMAX(N) EDIT_ITEM_FAST(float5, MSG_VMAX_##N, &planner.settings.max_feedrate_mm_s[_AXIS(N)], 1, max_fr_edit_scaled[_AXIS(N)]) - NUM_AXIS_CODE(EDIT_VMAX(A), EDIT_VMAX(B), EDIT_VMAX(C), EDIT_VMAX(I), EDIT_VMAX(J), EDIT_VMAX(K), EDIT_VMAX(U), EDIT_VMAX(V), EDIT_VMAX(W)); + #define EDIT_VMAX(N) EDIT_ITEM_FAST(float5, MSG_VMAX_##N, &planner.settings.max_feedrate_mm_s[_AXIS(N)], 1, max_fr_edit_scaled[_AXIS(N)]); + MAP(EDIT_VMAX, NUM_AXIS_LIST(A, B, C, I, J, K, U, V, W)); #if E_STEPPERS EDIT_ITEM_FAST(float5, MSG_VMAX_E, &planner.settings.max_feedrate_mm_s[E_AXIS_N(active_extruder)], 1, max_fr_edit_scaled.e); @@ -458,7 +458,7 @@ void menu_backlash(); #elif ENABLED(LIMITED_MAX_ACCEL_EDITING) DEFAULT_MAX_ACCELERATION #else - LOGICAL_AXIS_ARRAY(99000, 99000, 99000, 99000, 99000, 99000, 99000, 99000, 99000, 99000) + LOGICAL_AXIS_ARRAY_1(99000) #endif ; #if ENABLED(LIMITED_MAX_ACCEL_EDITING) && !defined(MAX_ACCEL_EDIT_VALUES) @@ -526,12 +526,10 @@ void menu_backlash(); #ifdef MAX_JERK_EDIT_VALUES MAX_JERK_EDIT_VALUES #elif ENABLED(LIMITED_JERK_EDITING) - { LOGICAL_AXIS_LIST((DEFAULT_EJERK) * 2, - (DEFAULT_XJERK) * 2, (DEFAULT_YJERK) * 2, (DEFAULT_ZJERK) * 2, - (DEFAULT_IJERK) * 2, (DEFAULT_JJERK) * 2, (DEFAULT_KJERK) * 2, - (DEFAULT_UJERK) * 2, (DEFAULT_VJERK) * 2, (DEFAULT_WJERK) * 2) } + #define _JERK2(N) DEFAULT_##N##JERK * 2 + { MAPLIST(_JERK2, LOGICAL_AXIS_NAMES) } #else - { LOGICAL_AXIS_LIST(990, 990, 990, 990, 990, 990, 990, 990, 990, 990) } + LOGICAL_AXIS_ARRAY_1(990) #endif ; #define EDIT_JERK(N) EDIT_ITEM_FAST(float3, MSG_V##N##_JERK, &planner.max_jerk[_AXIS(N)], 1, max_jerk_edit[_AXIS(N)]) @@ -585,12 +583,8 @@ void menu_advanced_steps_per_mm() { START_MENU(); BACK_ITEM(MSG_ADVANCED_SETTINGS); - #define EDIT_QSTEPS(Q) EDIT_ITEM_FAST(float61, MSG_##Q##_STEPS, &planner.settings.axis_steps_per_mm[_AXIS(Q)], 5, 9999, []{ planner.refresh_positioning(); }) - NUM_AXIS_CODE( - EDIT_QSTEPS(A), EDIT_QSTEPS(B), EDIT_QSTEPS(C), - EDIT_QSTEPS(I), EDIT_QSTEPS(J), EDIT_QSTEPS(K), - EDIT_QSTEPS(U), EDIT_QSTEPS(V), EDIT_QSTEPS(W) - ); + #define EDIT_QSTEPS(Q) EDIT_ITEM_FAST(float61, MSG_##Q##_STEPS, &planner.settings.axis_steps_per_mm[_AXIS(Q)], 5, 9999, []{ planner.refresh_positioning(); }); + MAP(EDIT_QSTEPS, NUM_AXIS_LIST(A, B, C, I, J, K, U, V, W)); #if ENABLED(DISTINCT_E_FACTORS) LOOP_L_N(n, E_STEPPERS) diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index 73101e7bcf16..493fbc1cac59 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -174,9 +174,8 @@ void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int START_MENU(); if (LCD_HEIGHT >= 4) { switch (axis) { - case X_AXIS: STATIC_ITEM(MSG_MOVE_X, SS_DEFAULT|SS_INVERT); break; - case Y_AXIS: STATIC_ITEM(MSG_MOVE_Y, SS_DEFAULT|SS_INVERT); break; - case Z_AXIS: STATIC_ITEM(MSG_MOVE_Z, SS_DEFAULT|SS_INVERT); break; + #define _CASE_MOVE(N) case N##_AXIS: STATIC_ITEM(MSG_MOVE_##N, SS_DEFAULT|SS_INVERT); break; + MAIN_AXIS_MAP(_CASE_MOVE) default: TERN_(MANUAL_E_MOVES_RELATIVE, manual_move_e_origin = current_position.e); STATIC_ITEM(MSG_MOVE_E, SS_DEFAULT|SS_INVERT); diff --git a/Marlin/src/libs/L64XX/L64XX_Marlin.h b/Marlin/src/libs/L64XX/L64XX_Marlin.h index b71d97a0d6fb..e8d8498ac7a6 100644 --- a/Marlin/src/libs/L64XX/L64XX_Marlin.h +++ b/Marlin/src/libs/L64XX/L64XX_Marlin.h @@ -36,7 +36,7 @@ #define HAS_L64XX_EXTRUDER (AXIS_IS_L64XX(E0) || AXIS_IS_L64XX(E1) || AXIS_IS_L64XX(E2) || AXIS_IS_L64XX(E3) || AXIS_IS_L64XX(E4) || AXIS_IS_L64XX(E5) || AXIS_IS_L64XX(E6) || AXIS_IS_L64XX(E7)) #define _EN_ITEM(N) , E##N -enum L64XX_axis_t : uint8_t { NUM_AXIS_LIST(X, Y, Z, I, J, K, U, V, W), X2, Y2, Z2, Z3, Z4 REPEAT(E_STEPPERS, _EN_ITEM), MAX_L64XX }; +enum L64XX_axis_t : uint8_t { MAIN_AXIS_NAMES, X2, Y2, Z2, Z3, Z4 REPEAT(E_STEPPERS, _EN_ITEM), MAX_L64XX }; #undef _EN_ITEM class L64XX_Marlin : public L64XXHelper { diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index e231a410058b..a824f56d9344 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -738,10 +738,12 @@ void restore_feedrate_and_scaling() { #if HAS_SOFTWARE_ENDSTOPS // Software Endstops are based on the configured limits. + #define _AMIN(A) A##_MIN_POS + #define _AMAX(A) A##_MAX_POS soft_endstops_t soft_endstop = { true, false, - NUM_AXIS_ARRAY(X_MIN_POS, Y_MIN_POS, Z_MIN_POS, I_MIN_POS, J_MIN_POS, K_MIN_POS, U_MIN_POS, V_MIN_POS, W_MIN_POS), - NUM_AXIS_ARRAY(X_MAX_BED, Y_MAX_BED, Z_MAX_POS, I_MAX_POS, J_MAX_POS, K_MAX_POS, U_MAX_POS, V_MAX_POS, W_MAX_POS) + { MAPLIST(_AMIN, MAIN_AXIS_NAMES) }, + { MAPLIST(_AMAX, MAIN_AXIS_NAMES) }, }; /** @@ -1877,17 +1879,8 @@ void prepare_line_to_destination() { || TERN0(A##_HOME_TO_MIN, A##_MIN_PIN > -1) \ || TERN0(A##_HOME_TO_MAX, A##_MAX_PIN > -1) \ )) - if (NUM_AXIS_GANG( - !_CAN_HOME(X), - && !_CAN_HOME(Y), - && !_CAN_HOME(Z), - && !_CAN_HOME(I), - && !_CAN_HOME(J), - && !_CAN_HOME(K), - && !_CAN_HOME(U), - && !_CAN_HOME(V), - && !_CAN_HOME(W)) - ) return; + #define _ANDCANT(N) && !_CAN_HOME(N) + if (true MAIN_AXIS_MAP(_ANDCANT)) return; #endif if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM(">>> homeaxis(", AS_CHAR(AXIS_CHAR(axis)), ")"); diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 30cd8d5162b9..91c100bd7200 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -899,8 +899,10 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai * Change the current in the TMC drivers to N##_CURRENT_HOME. And we save the current configuration of each TMC driver. */ void Probe::set_homing_current(const bool onoff) { - #define HAS_CURRENT_HOME(N) (defined(N##_CURRENT_HOME) && N##_CURRENT_HOME != N##_CURRENT) - #if HAS_CURRENT_HOME(X) || HAS_CURRENT_HOME(Y) || HAS_CURRENT_HOME(Z) || HAS_CURRENT_HOME(I) || HAS_CURRENT_HOME(J) || HAS_CURRENT_HOME(K) || HAS_CURRENT_HOME(U) || HAS_CURRENT_HOME(V) || HAS_CURRENT_HOME(W) + #define _defined(N) defined(N) + #define HAS_CURRENT_HOME(N) (N##_CURRENT_HOME > 0 && N##_CURRENT_HOME != N##_CURRENT) + #define _HOME_ELEM(N) HAS_CURRENT_HOME(N) || + #if MAIN_AXIS_MAP(_HOME_ELEM) 0 #if ENABLED(DELTA) static int16_t saved_current_X, saved_current_Y; #endif diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 99994b9f8f82..ac9970bf5a18 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -180,9 +180,9 @@ #define _EN_ITEM(N) , E##N #define _EN1_ITEM(N) , E##N:1 -typedef struct { uint16_t NUM_AXIS_LIST(X, Y, Z, I, J, K, U, V, W), X2, Y2, Z2, Z3, Z4 REPEAT(E_STEPPERS, _EN_ITEM); } per_stepper_uint16_t; -typedef struct { uint32_t NUM_AXIS_LIST(X, Y, Z, I, J, K, U, V, W), X2, Y2, Z2, Z3, Z4 REPEAT(E_STEPPERS, _EN_ITEM); } per_stepper_uint32_t; -typedef struct { int16_t NUM_AXIS_LIST(X, Y, Z, I, J, K, U, V, W), X2, Y2, Z2, Z3, Z4; } mot_stepper_int16_t; +typedef struct { uint16_t MAIN_AXIS_NAMES, X2, Y2, Z2, Z3, Z4 REPEAT(E_STEPPERS, _EN_ITEM); } per_stepper_uint16_t; +typedef struct { uint32_t MAIN_AXIS_NAMES, X2, Y2, Z2, Z3, Z4 REPEAT(E_STEPPERS, _EN_ITEM); } per_stepper_uint32_t; +typedef struct { int16_t MAIN_AXIS_NAMES, X2, Y2, Z2, Z3, Z4; } mot_stepper_int16_t; typedef struct { bool NUM_AXIS_LIST(X:1, Y:1, Z:1, I:1, J:1, K:1, U:1, V:1, W:1), X2:1, Y2:1, Z2:1, Z3:1, Z4:1 REPEAT(E_STEPPERS, _EN1_ITEM); } per_stepper_bool_t; #undef _EN_ITEM diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 60eb635965f3..4e44199f22d2 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -498,11 +498,7 @@ xyze_int8_t Stepper::count_direction{0}; void Stepper::enable_axis(const AxisEnum axis) { #define _CASE_ENABLE(N) case N##_AXIS: ENABLE_AXIS_##N(); break; switch (axis) { - NUM_AXIS_CODE( - _CASE_ENABLE(X), _CASE_ENABLE(Y), _CASE_ENABLE(Z), - _CASE_ENABLE(I), _CASE_ENABLE(J), _CASE_ENABLE(K), - _CASE_ENABLE(U), _CASE_ENABLE(V), _CASE_ENABLE(W) - ); + MAIN_AXIS_MAP(_CASE_ENABLE) default: break; } mark_axis_enabled(axis); @@ -518,11 +514,7 @@ bool Stepper::disable_axis(const AxisEnum axis) { if (can_disable) { #define _CASE_DISABLE(N) case N##_AXIS: DISABLE_AXIS_##N(); break; switch (axis) { - NUM_AXIS_CODE( - _CASE_DISABLE(X), _CASE_DISABLE(Y), _CASE_DISABLE(Z), - _CASE_DISABLE(I), _CASE_DISABLE(J), _CASE_DISABLE(K), - _CASE_DISABLE(U), _CASE_DISABLE(V), _CASE_DISABLE(W) - ); + MAIN_AXIS_MAP(_CASE_DISABLE) default: break; } } diff --git a/Marlin/src/module/stepper/trinamic.cpp b/Marlin/src/module/stepper/trinamic.cpp index ee156a198629..76373515569e 100644 --- a/Marlin/src/module/stepper/trinamic.cpp +++ b/Marlin/src/module/stepper/trinamic.cpp @@ -493,7 +493,7 @@ enum StealthIndex : uint8_t { #endif #define _EN_ITEM(N) , E##N - enum TMCAxis : uint8_t { NUM_AXIS_LIST(X, Y, Z, I, J, K, U, V, W), X2, Y2, Z2, Z3, Z4 REPEAT(EXTRUDERS, _EN_ITEM), TOTAL }; + enum TMCAxis : uint8_t { MAIN_AXIS_NAMES, X2, Y2, Z2, Z3, Z4 REPEAT(EXTRUDERS, _EN_ITEM), TOTAL }; #undef _EN_ITEM void tmc_serial_begin() { @@ -1023,18 +1023,16 @@ void reset_trinamic_drivers() { // 2. For each axis in use, static_assert using a constexpr function, which counts the // number of matching/conflicting axis. If the value is not exactly 1, fail. +#define ALL_AXIS_NAMES X, X2, Y, Y2, Z, Z2, Z3, Z4, I, J, K, U, V, W, E0, E1, E2, E3, E4, E5, E6, E7 + #if ANY_AXIS_HAS(HW_SERIAL) // Hardware serial names are compared as strings, since actually resolving them cannot occur in a constexpr. // Using a fixed-length character array for the port name allows this to be constexpr compatible. struct SanityHwSerialDetails { const char port[20]; uint32_t address; }; #define TMC_HW_DETAIL_ARGS(A) TERN(A##_HAS_HW_SERIAL, STRINGIFY(A##_HARDWARE_SERIAL), ""), TERN0(A##_HAS_HW_SERIAL, A##_SLAVE_ADDRESS) - #define TMC_HW_DETAIL(A) { TMC_HW_DETAIL_ARGS(A) } + #define TMC_HW_DETAIL(A) { TMC_HW_DETAIL_ARGS(A) }, constexpr SanityHwSerialDetails sanity_tmc_hw_details[] = { - TMC_HW_DETAIL(X), TMC_HW_DETAIL(X2), - TMC_HW_DETAIL(Y), TMC_HW_DETAIL(Y2), - TMC_HW_DETAIL(Z), TMC_HW_DETAIL(Z2), TMC_HW_DETAIL(Z3), TMC_HW_DETAIL(Z4), - TMC_HW_DETAIL(I), TMC_HW_DETAIL(J), TMC_HW_DETAIL(K), TMC_HW_DETAIL(U), TMC_HW_DETAIL(V), TMC_HW_DETAIL(W), - TMC_HW_DETAIL(E0), TMC_HW_DETAIL(E1), TMC_HW_DETAIL(E2), TMC_HW_DETAIL(E3), TMC_HW_DETAIL(E4), TMC_HW_DETAIL(E5), TMC_HW_DETAIL(E6), TMC_HW_DETAIL(E7) + MAP(TMC_HW_DETAIL, ALL_AXIS_NAMES) }; // constexpr compatible string comparison @@ -1053,23 +1051,15 @@ void reset_trinamic_drivers() { #define TMC_HWSERIAL_CONFLICT_MSG(A) STRINGIFY(A) "_SLAVE_ADDRESS conflicts with another driver using the same " STRINGIFY(A) "_HARDWARE_SERIAL" #define SA_NO_TMC_HW_C(A) static_assert(1 >= count_tmc_hw_serial_matches(TMC_HW_DETAIL_ARGS(A), 0, COUNT(sanity_tmc_hw_details)), TMC_HWSERIAL_CONFLICT_MSG(A)); - SA_NO_TMC_HW_C(X); SA_NO_TMC_HW_C(X2); - SA_NO_TMC_HW_C(Y); SA_NO_TMC_HW_C(Y2); - SA_NO_TMC_HW_C(Z); SA_NO_TMC_HW_C(Z2); SA_NO_TMC_HW_C(Z3); SA_NO_TMC_HW_C(Z4); - SA_NO_TMC_HW_C(I); SA_NO_TMC_HW_C(J); SA_NO_TMC_HW_C(K); SA_NO_TMC_HW_C(U); SA_NO_TMC_HW_C(V); SA_NO_TMC_HW_C(W); - SA_NO_TMC_HW_C(E0); SA_NO_TMC_HW_C(E1); SA_NO_TMC_HW_C(E2); SA_NO_TMC_HW_C(E3); SA_NO_TMC_HW_C(E4); SA_NO_TMC_HW_C(E5); SA_NO_TMC_HW_C(E6); SA_NO_TMC_HW_C(E7); + MAP(SA_NO_TMC_HW_C, ALL_AXIS_NAMES) #endif #if ANY_AXIS_HAS(SW_SERIAL) struct SanitySwSerialDetails { int32_t txpin; int32_t rxpin; uint32_t address; }; #define TMC_SW_DETAIL_ARGS(A) TERN(A##_HAS_SW_SERIAL, A##_SERIAL_TX_PIN, -1), TERN(A##_HAS_SW_SERIAL, A##_SERIAL_RX_PIN, -1), TERN0(A##_HAS_SW_SERIAL, A##_SLAVE_ADDRESS) - #define TMC_SW_DETAIL(A) TMC_SW_DETAIL_ARGS(A) + #define TMC_SW_DETAIL(A) TMC_SW_DETAIL_ARGS(A), constexpr SanitySwSerialDetails sanity_tmc_sw_details[] = { - TMC_SW_DETAIL(X), TMC_SW_DETAIL(X2), - TMC_SW_DETAIL(Y), TMC_SW_DETAIL(Y2), - TMC_SW_DETAIL(Z), TMC_SW_DETAIL(Z2), TMC_SW_DETAIL(Z3), TMC_SW_DETAIL(Z4), - TMC_SW_DETAIL(I), TMC_SW_DETAIL(J), TMC_SW_DETAIL(K), TMC_SW_DETAIL(U), TMC_SW_DETAIL(V), TMC_SW_DETAIL(W), - TMC_SW_DETAIL(E0), TMC_SW_DETAIL(E1), TMC_SW_DETAIL(E2), TMC_SW_DETAIL(E3), TMC_SW_DETAIL(E4), TMC_SW_DETAIL(E5), TMC_SW_DETAIL(E6), TMC_SW_DETAIL(E7) + MAP(TMC_SW_DETAIL, ALL_AXIS_NAMES) }; constexpr bool sc_sw_done(size_t start, size_t end) { return start == end; } @@ -1083,11 +1073,7 @@ void reset_trinamic_drivers() { #define TMC_SWSERIAL_CONFLICT_MSG(A) STRINGIFY(A) "_SLAVE_ADDRESS conflicts with another driver using the same " STRINGIFY(A) "_SERIAL_RX_PIN or " STRINGIFY(A) "_SERIAL_TX_PIN" #define SA_NO_TMC_SW_C(A) static_assert(1 >= count_tmc_sw_serial_matches(TMC_SW_DETAIL_ARGS(A), 0, COUNT(sanity_tmc_sw_details)), TMC_SWSERIAL_CONFLICT_MSG(A)); - SA_NO_TMC_SW_C(X); SA_NO_TMC_SW_C(X2); - SA_NO_TMC_SW_C(Y); SA_NO_TMC_SW_C(Y2); - SA_NO_TMC_SW_C(Z); SA_NO_TMC_SW_C(Z2); SA_NO_TMC_SW_C(Z3); SA_NO_TMC_SW_C(Z4); - SA_NO_TMC_SW_C(I); SA_NO_TMC_SW_C(J); SA_NO_TMC_SW_C(K); SA_NO_TMC_SW_C(U); SA_NO_TMC_SW_C(V); SA_NO_TMC_SW_C(W); - SA_NO_TMC_SW_C(E0); SA_NO_TMC_SW_C(E1); SA_NO_TMC_SW_C(E2); SA_NO_TMC_SW_C(E3); SA_NO_TMC_SW_C(E4); SA_NO_TMC_SW_C(E5); SA_NO_TMC_SW_C(E6); SA_NO_TMC_SW_C(E7); + MAP(SA_NO_TMC_SW_C, ALL_AXIS_NAMES) #endif #endif // HAS_TRINAMIC_CONFIG From d99185be24e035d6370c8f36851e09917d7fe342 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Sun, 22 May 2022 14:32:16 -0700 Subject: [PATCH 086/241] =?UTF-8?q?=F0=9F=8E=A8=20Fix/adjust=20warnings=20?= =?UTF-8?q?(#24225)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/menu/menu_motion.cpp | 2 +- Marlin/src/module/stepper.cpp | 2 +- Marlin/src/module/stepper.h | 2 +- Marlin/src/pins/esp32/pins_E4D.h | 4 ++-- Marlin/src/pins/esp32/pins_FYSETC_E4.h | 4 ++-- Marlin/src/pins/esp32/pins_MKS_TINYBEE.h | 4 ++-- Marlin/src/pins/esp32/pins_MRR_ESPA.h | 4 ++-- Marlin/src/pins/esp32/pins_MRR_ESPE.h | 4 ++-- Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h | 8 ++++++-- Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h | 8 ++++++-- Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h | 4 +++- .../src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h | 8 ++++++-- Marlin/src/pins/mega/pins_MEGACONTROLLER.h | 2 +- Marlin/src/pins/mega/pins_MINITRONICS.h | 2 +- Marlin/src/pins/mega/pins_OVERLORD.h | 2 +- Marlin/src/pins/ramps/pins_AZTEEG_X3.h | 2 +- Marlin/src/pins/ramps/pins_AZTEEG_X3_PRO.h | 2 +- Marlin/src/pins/ramps/pins_BAM_DICE_DUE.h | 2 +- Marlin/src/pins/ramps/pins_BIQU_KFB_2.h | 2 +- Marlin/src/pins/ramps/pins_DAGOMA_F5.h | 2 +- Marlin/src/pins/ramps/pins_FELIX2.h | 2 +- Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR.h | 2 +- .../src/pins/ramps/pins_FORMBOT_TREX2PLUS.h | 2 +- Marlin/src/pins/ramps/pins_FORMBOT_TREX3.h | 2 +- Marlin/src/pins/ramps/pins_K8600.h | 2 +- Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h | 2 +- Marlin/src/pins/ramps/pins_MKS_BASE_10.h | 2 +- Marlin/src/pins/ramps/pins_MKS_BASE_14.h | 2 +- Marlin/src/pins/ramps/pins_MKS_BASE_15.h | 2 +- Marlin/src/pins/ramps/pins_MKS_BASE_16.h | 2 +- Marlin/src/pins/ramps/pins_MKS_GEN_13.h | 2 +- Marlin/src/pins/ramps/pins_MKS_GEN_L.h | 2 +- Marlin/src/pins/ramps/pins_MKS_GEN_L_V2.h | 2 +- Marlin/src/pins/ramps/pins_MKS_GEN_L_V21.h | 2 +- Marlin/src/pins/ramps/pins_RAMPS.h | 9 +++++++-- Marlin/src/pins/ramps/pins_RAMPS_CREALITY.h | 2 +- Marlin/src/pins/ramps/pins_RAMPS_ENDER_4.h | 2 +- Marlin/src/pins/ramps/pins_RL200.h | 4 ++-- Marlin/src/pins/ramps/pins_RUMBA.h | 2 +- Marlin/src/pins/ramps/pins_SAINSMART_2IN1.h | 2 +- Marlin/src/pins/ramps/pins_TENLOG_D3_HERO.h | 2 +- Marlin/src/pins/ramps/pins_TRONXY_V3_1_0.h | 2 +- Marlin/src/pins/ramps/pins_TT_OSCAR.h | 2 +- Marlin/src/pins/ramps/pins_ZRIB_V52.h | 2 +- Marlin/src/pins/ramps/pins_ZRIB_V53.h | 4 ++-- Marlin/src/pins/ramps/pins_Z_BOLT_X_SERIES.h | 2 +- Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h | 8 ++++++-- .../stm32f1/pins_BTT_SKR_MINI_E3_common.h | 20 ++++++++++++++----- .../src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h | 2 +- .../pins/stm32f1/pins_CREALITY_V24S1_301.h | 2 +- Marlin/src/pins/stm32f1/pins_CREALITY_V25S1.h | 2 +- Marlin/src/pins/stm32f1/pins_CREALITY_V4.h | 2 +- Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h | 2 +- Marlin/src/pins/stm32f1/pins_CREALITY_V452.h | 2 +- Marlin/src/pins/stm32f1/pins_CREALITY_V453.h | 2 +- .../src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h | 2 +- Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h | 2 +- .../src/pins/stm32f1/pins_JGAURORA_A5S_A1.h | 2 +- Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h | 2 +- .../pins/stm32f1/pins_MINGDA_MPX_ARM_MINI.h | 2 +- Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h | 2 +- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3.h | 2 +- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D.h | 2 +- .../pins/stm32f1/pins_MKS_ROBIN_E3D_V1_1.h | 2 +- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h | 2 +- .../src/pins/stm32f1/pins_MKS_ROBIN_E3_V1_1.h | 2 +- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE.h | 2 +- .../src/pins/stm32f1/pins_MKS_ROBIN_LITE3.h | 2 +- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h | 2 +- .../src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h | 2 +- .../pins/stm32f1/pins_MKS_ROBIN_NANO_common.h | 2 +- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h | 2 +- Marlin/src/pins/stm32f1/pins_PANDA_PI_V29.h | 4 +++- Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h | 2 +- Marlin/src/pins/stm32f4/pins_ANET_ET4.h | 2 +- Marlin/src/pins/stm32f4/pins_ARMED.h | 2 +- Marlin/src/pins/stm32f4/pins_ARTILLERY_RUBY.h | 2 +- .../src/pins/stm32f4/pins_BLACK_STM32F407VE.h | 2 +- .../src/pins/stm32f4/pins_BTT_BTT002_V1_0.h | 2 +- Marlin/src/pins/stm32f4/pins_BTT_E3_RRF.h | 16 +++++++++++---- Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h | 2 +- .../src/pins/stm32f4/pins_BTT_SKR_PRO_V1_1.h | 2 +- .../src/pins/stm32f4/pins_BTT_SKR_PRO_V1_2.h | 2 +- .../pins/stm32f4/pins_BTT_SKR_PRO_common.h | 4 +++- Marlin/src/pins/stm32f4/pins_FLYF407ZG.h | 2 +- Marlin/src/pins/stm32f4/pins_FYSETC_S6.h | 2 +- Marlin/src/pins/stm32f4/pins_FYSETC_SPIDER.h | 2 +- Marlin/src/pins/stm32f4/pins_LERDGE_K.h | 2 +- Marlin/src/pins/stm32f4/pins_LERDGE_S.h | 2 +- Marlin/src/pins/stm32f4/pins_LERDGE_X.h | 2 +- Marlin/src/pins/stm32f4/pins_MKS_EAGLE.h | 2 +- Marlin/src/pins/stm32f4/pins_MKS_MONSTER8.h | 2 +- Marlin/src/pins/stm32f4/pins_MKS_ROBIN2.h | 2 +- .../src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h | 2 +- .../src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h | 2 +- Marlin/src/pins/stm32f4/pins_RUMBA32_common.h | 2 +- Marlin/src/pins/stm32f4/pins_VAKE403D.h | 2 +- Marlin/src/pins/stm32f7/pins_REMRAM_V1.h | 2 +- .../pins/stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h | 20 ++++++++++++++----- 99 files changed, 177 insertions(+), 122 deletions(-) diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index 493fbc1cac59..4b42bd8136da 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -337,7 +337,7 @@ void menu_move() { #elif MULTI_E_MANUAL - // Independent extruders with one E-stepper per hotend + // Independent extruders with one E stepper per hotend LOOP_L_N(n, E_MANUAL) SUBMENU_MOVE_E(n); #endif diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 4e44199f22d2..d098179fc183 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -611,7 +611,7 @@ void Stepper::set_directions() { #if DISABLED(LIN_ADVANCE) #if ENABLED(MIXING_EXTRUDER) // Because this is valid for the whole block we don't know - // what e-steppers will step. Likely all. Set all. + // what E steppers will step. Likely all. Set all. if (motor_direction(E_AXIS)) { MIXER_STEPPER_LOOP(j) REV_E_DIR(j); count_direction.e = -1; diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h index 09117f44c6b5..52b870929f3a 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -214,7 +214,7 @@ // Directions are set up for MIXING_STEPPERS - like before. // Finding the right stepper may last up to MIXING_STEPPERS loops in get_next_stepper(). // These loops are a bit faster than advancing a bresenham counter. - // Always only one e-stepper is stepped. + // Always only one E stepper is stepped. #define MIN_ISR_LA_LOOP_CYCLES ((MIXING_STEPPERS) * (ISR_STEPPER_CYCLES)) #else #define MIN_ISR_LA_LOOP_CYCLES ISR_STEPPER_CYCLES diff --git a/Marlin/src/pins/esp32/pins_E4D.h b/Marlin/src/pins/esp32/pins_E4D.h index 02a5fe4e33aa..42177e9a4e31 100644 --- a/Marlin/src/pins/esp32/pins_E4D.h +++ b/Marlin/src/pins/esp32/pins_E4D.h @@ -31,9 +31,9 @@ #include "env_validate.h" #if EXTRUDERS > 1 || E_STEPPERS > 1 - #error "E4d@box only supports one E Stepper. Comment out this line to continue." + #error "E4d@box only supports 1 E stepper." #elif HAS_MULTI_HOTEND - #error "E4d@box only supports one hotend / E-stepper. Comment out this line to continue." + #error "E4d@box only supports 1 hotend / E stepper." #endif #define BOARD_INFO_NAME "E4d@box" diff --git a/Marlin/src/pins/esp32/pins_FYSETC_E4.h b/Marlin/src/pins/esp32/pins_FYSETC_E4.h index e75b6ece2820..7dc59979c8f1 100644 --- a/Marlin/src/pins/esp32/pins_FYSETC_E4.h +++ b/Marlin/src/pins/esp32/pins_FYSETC_E4.h @@ -31,9 +31,9 @@ #include "env_validate.h" #if EXTRUDERS > 1 || E_STEPPERS > 1 - #error "FYSETC E4 only supports one E Stepper. Comment out this line to continue." + #error "FYSETC E4 only supports 1 E stepper." #elif HAS_MULTI_HOTEND - #error "FYSETC E4 only supports one hotend / E-stepper. Comment out this line to continue." + #error "FYSETC E4 only supports 1 hotend / E stepper." #endif #define BOARD_INFO_NAME "FYSETC_E4" diff --git a/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h b/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h index 68b8ed4ac800..ba3b60151b35 100644 --- a/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h +++ b/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h @@ -31,9 +31,9 @@ #include "env_validate.h" #if EXTRUDERS > 2 || E_STEPPERS > 2 - #error "MKS ESP Nano only supports two E Steppers. Comment out this line to continue." + #error "MKS TinyBee supports up to 2 E steppers." #elif HOTENDS > 2 - #error "MKS ESP Nano only supports two hotend / E-stepper. Comment out this line to continue." + #error "MKS TinyBee supports up to 2 hotends / E steppers." #endif #define BOARD_INFO_NAME "MKS TinyBee" diff --git a/Marlin/src/pins/esp32/pins_MRR_ESPA.h b/Marlin/src/pins/esp32/pins_MRR_ESPA.h index cc67bc025cec..e9e3db575896 100644 --- a/Marlin/src/pins/esp32/pins_MRR_ESPA.h +++ b/Marlin/src/pins/esp32/pins_MRR_ESPA.h @@ -31,9 +31,9 @@ #include "env_validate.h" #if EXTRUDERS > 1 || E_STEPPERS > 1 - #error "MRR ESPA only supports one E Stepper. Comment out this line to continue." + #error "MRR ESPA only supports 1 E stepper." #elif HAS_MULTI_HOTEND - #error "MRR ESPA only supports one hotend / E-stepper. Comment out this line to continue." + #error "MRR ESPA only supports 1 hotend / E stepper." #endif #define BOARD_INFO_NAME "MRR ESPA" diff --git a/Marlin/src/pins/esp32/pins_MRR_ESPE.h b/Marlin/src/pins/esp32/pins_MRR_ESPE.h index 9b9b54e3aebe..b59cc7bb39ba 100644 --- a/Marlin/src/pins/esp32/pins_MRR_ESPE.h +++ b/Marlin/src/pins/esp32/pins_MRR_ESPE.h @@ -32,9 +32,9 @@ #include "env_validate.h" #if EXTRUDERS > 2 || E_STEPPERS > 2 - #error "MRR ESPE only supports two E Steppers. Comment out this line to continue." + #error "MRR ESPE supports up to 2 E steppers." #elif HAS_MULTI_HOTEND - #error "MRR ESPE only supports one hotend / E-stepper. Comment out this line to continue." + #error "MRR ESPE only supports 1 hotend / E stepper." #endif #define BOARD_INFO_NAME "MRR ESPE" diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h index 586fb14e8eb7..97d86fe810d7 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h @@ -223,7 +223,9 @@ #elif ENABLED(ANET_FULL_GRAPHICS_LCD) - #error "CAUTION! ANET_FULL_GRAPHICS_LCD requires wiring modifications. See 'pins_BTT_SKR_V1_3.h' for details. Comment out this line to continue." + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! ANET_FULL_GRAPHICS_LCD requires wiring modifications. See 'pins_BTT_SKR_V1_3.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif /** * 1. Cut the tab off the LCD connector so it can be plugged into the "EXP1" connector the other way. @@ -257,7 +259,9 @@ #elif ENABLED(WYH_L12864) - #error "CAUTION! WYH_L12864 requires wiring modifications. Comment out this line to continue." + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! WYH_L12864 requires wiring modifications. See 'pins_BTT_SKR_V1_3.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif /** * 1. Cut the tab off the LCD connector so it can be plugged into the "EXP1" connector the other way. diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h index 25c7ba69b6db..b50e8e578006 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h @@ -286,7 +286,9 @@ #elif HAS_WIRED_LCD #if ENABLED(ANET_FULL_GRAPHICS_LCD_ALT_WIRING) - #error "CAUTION! ANET_FULL_GRAPHICS_LCD_ALT_WIRING requires wiring modifications. See 'pins_BTT_SKR_V1_4.h' for details. Comment out this line to continue." + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! ANET_FULL_GRAPHICS_LCD_ALT_WIRING requires wiring modifications. See 'pins_BTT_SKR_V1_4.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif /** * 1. Cut the tab off the LCD connector so it can be plugged into the "EXP1" connector the other way. @@ -318,7 +320,9 @@ #define BEEPER_PIN EXP1_03_PIN #elif ENABLED(ANET_FULL_GRAPHICS_LCD) - #error "CAUTION! ANET_FULL_GRAPHICS_LCD requires wiring modifications. See 'pins_BTT_SKR_V1_4.h' for details. Comment out this line to continue." + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! ANET_FULL_GRAPHICS_LCD requires wiring modifications. See 'pins_BTT_SKR_V1_4.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif /** * 1. Cut the tab off the LCD connector so it can be plugged into the "EXP1" connector the other way. diff --git a/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h b/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h index b08ac536b3d0..56d75a748cbc 100644 --- a/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h +++ b/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h @@ -307,7 +307,9 @@ #elif ENABLED(ZONESTAR_LCD) - #error "CAUTION! ZONESTAR_LCD on REARM requires wiring modifications. NB. ADCs are not 5V tolerant. Comment out this line to continue." + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! ZONESTAR_LCD on REARM requires wiring modifications. NB. ADCs are not 5V tolerant. See 'pins_RAMPS_RE_ARM.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif #elif IS_TFTGLCD_PANEL diff --git a/Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h b/Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h index 27b65c22cd5c..090a2e40517e 100644 --- a/Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h +++ b/Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h @@ -204,7 +204,9 @@ #define EXP1_10_PIN P2_08 #if HAS_DWIN_E3V2 || IS_DWIN_MARLINUI - #error "Ender-3 V2 display requires a custom cable with TX = P0_15, RX = P0_16. Comment out this line to continue." + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! Ender-3 V2 display requires a custom cable with TX = P0_15, RX = P0_16. See 'pins_BTT_SKR_E3_TURBO.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif /** * Ender 3 V2 display SKR E3 Turbo (EXP1) Ender 3 V2 display --> SKR E3 Turbo @@ -238,7 +240,9 @@ #elif ENABLED(ZONESTAR_LCD) // ANET A8 LCD Controller - Must convert to 3.3V - CONNECTING TO 5V WILL DAMAGE THE BOARD! - #error "CAUTION! ZONESTAR_LCD requires wiring modifications. See 'pins_BTT_SKR_E3_TURBO.h' for details. Comment out this line to continue." + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! ZONESTAR_LCD requires wiring modifications. See 'pins_BTT_SKR_E3_TURBO.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif #define LCD_PINS_RS EXP1_05_PIN #define LCD_PINS_ENABLE EXP1_09_PIN diff --git a/Marlin/src/pins/mega/pins_MEGACONTROLLER.h b/Marlin/src/pins/mega/pins_MEGACONTROLLER.h index dc9fa52af8e6..7ebef6e281cf 100644 --- a/Marlin/src/pins/mega/pins_MEGACONTROLLER.h +++ b/Marlin/src/pins/mega/pins_MEGACONTROLLER.h @@ -26,7 +26,7 @@ */ #if HOTENDS > 2 || E_STEPPERS > 2 - #error "Mega Controller supports up to 2 hotends / E-steppers. Comment out this line to continue." + #error "Mega Controller supports up to 2 hotends / E steppers." #endif #include "env_validate.h" diff --git a/Marlin/src/pins/mega/pins_MINITRONICS.h b/Marlin/src/pins/mega/pins_MINITRONICS.h index bbe746461eca..ec712a3b90e5 100644 --- a/Marlin/src/pins/mega/pins_MINITRONICS.h +++ b/Marlin/src/pins/mega/pins_MINITRONICS.h @@ -34,7 +34,7 @@ #if NOT_TARGET(__AVR_ATmega1281__) #error "Oops! Select 'Minitronics' in 'Tools > Board.'" #elif HOTENDS > 2 || E_STEPPERS > 2 - #error "Minitronics supports up to 2 hotends / E-steppers. Comment out this line to continue." + #error "Minitronics supports up to 2 hotends / E steppers." #endif #define BOARD_INFO_NAME "Minitronics v1.0/1.1" diff --git a/Marlin/src/pins/mega/pins_OVERLORD.h b/Marlin/src/pins/mega/pins_OVERLORD.h index 98f8da571940..f1062b413e83 100644 --- a/Marlin/src/pins/mega/pins_OVERLORD.h +++ b/Marlin/src/pins/mega/pins_OVERLORD.h @@ -26,7 +26,7 @@ */ #if HOTENDS > 2 || E_STEPPERS > 2 - #error "Overlord Controller supports up to 2 hotends / E-steppers. Comment out this line to continue." + #error "Overlord supports up to 2 hotends / E steppers." #endif #include "env_validate.h" diff --git a/Marlin/src/pins/ramps/pins_AZTEEG_X3.h b/Marlin/src/pins/ramps/pins_AZTEEG_X3.h index ee8cafa89766..44d8341c11d6 100644 --- a/Marlin/src/pins/ramps/pins_AZTEEG_X3.h +++ b/Marlin/src/pins/ramps/pins_AZTEEG_X3.h @@ -29,7 +29,7 @@ #include "env_validate.h" #if HOTENDS > 2 || E_STEPPERS > 2 - #error "Azteeg X3 supports up to 2 hotends / E-steppers. Comment out this line to continue." + #error "Azteeg X3 supports up to 2 hotends / E steppers." #endif #if ENABLED(CASE_LIGHT_ENABLE) && !PIN_EXISTS(CASE_LIGHT) diff --git a/Marlin/src/pins/ramps/pins_AZTEEG_X3_PRO.h b/Marlin/src/pins/ramps/pins_AZTEEG_X3_PRO.h index c2896146e64f..5aba83fc9fb5 100644 --- a/Marlin/src/pins/ramps/pins_AZTEEG_X3_PRO.h +++ b/Marlin/src/pins/ramps/pins_AZTEEG_X3_PRO.h @@ -29,7 +29,7 @@ #include "env_validate.h" #if HOTENDS > 5 || E_STEPPERS > 5 - #error "Azteeg X3 Pro supports up to 5 hotends / E-steppers. Comment out this line to continue." + #error "Azteeg X3 Pro supports up to 5 hotends / E steppers." #endif #define BOARD_INFO_NAME "Azteeg X3 Pro" diff --git a/Marlin/src/pins/ramps/pins_BAM_DICE_DUE.h b/Marlin/src/pins/ramps/pins_BAM_DICE_DUE.h index 4d7a79263570..fa622ffb15dc 100644 --- a/Marlin/src/pins/ramps/pins_BAM_DICE_DUE.h +++ b/Marlin/src/pins/ramps/pins_BAM_DICE_DUE.h @@ -26,7 +26,7 @@ */ #if HOTENDS > 2 || E_STEPPERS > 2 - #error "2PrintBeta Due supports up to 2 hotends / E-steppers. Comment out this line to continue." + #error "2PrintBeta Due supports up to 2 hotends / E steppers." #endif #define BOARD_INFO_NAME "2PrintBeta Due" diff --git a/Marlin/src/pins/ramps/pins_BIQU_KFB_2.h b/Marlin/src/pins/ramps/pins_BIQU_KFB_2.h index b31df115637d..58a62fb8bc74 100644 --- a/Marlin/src/pins/ramps/pins_BIQU_KFB_2.h +++ b/Marlin/src/pins/ramps/pins_BIQU_KFB_2.h @@ -26,7 +26,7 @@ */ #if HOTENDS > 2 || E_STEPPERS > 2 - #error "KFB 2.0 supports up to 2 hotends / E-steppers. Comment out this line to continue." + #error "KFB 2.0 supports up to 2 hotends / E steppers." #endif #define BOARD_INFO_NAME "KFB 2.0" diff --git a/Marlin/src/pins/ramps/pins_DAGOMA_F5.h b/Marlin/src/pins/ramps/pins_DAGOMA_F5.h index ced66d80b875..e1bd2ec4ed54 100644 --- a/Marlin/src/pins/ramps/pins_DAGOMA_F5.h +++ b/Marlin/src/pins/ramps/pins_DAGOMA_F5.h @@ -22,7 +22,7 @@ #pragma once #if HOTENDS > 2 || E_STEPPERS > 2 - #error "Dagoma3D F5 supports only 2 hotends / E-steppers. Comment out this line to continue." + #error "Dagoma3D F5 supports up to 2 hotends / E steppers." #endif #define BOARD_INFO_NAME "Dagoma3D F5" diff --git a/Marlin/src/pins/ramps/pins_FELIX2.h b/Marlin/src/pins/ramps/pins_FELIX2.h index bdf83c44ba8e..3e7849d71f23 100644 --- a/Marlin/src/pins/ramps/pins_FELIX2.h +++ b/Marlin/src/pins/ramps/pins_FELIX2.h @@ -26,7 +26,7 @@ */ #if HOTENDS > 2 || E_STEPPERS > 2 - #error "Felix 2.0+ supports up to 2 hotends / E-steppers. Comment out this line to continue." + #error "Felix 2.0+ supports up to 2 hotends / E steppers." #endif #define BOARD_INFO_NAME "Felix 2.0+" diff --git a/Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR.h b/Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR.h index 845e2d65ec0f..a6791ff7c8b5 100644 --- a/Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR.h +++ b/Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR.h @@ -29,7 +29,7 @@ #include "env_validate.h" #if HOTENDS > 3 || E_STEPPERS > 3 - #error "Formbot supports up to 3 hotends / E-steppers. Comment out this line to continue." + #error "Formbot supports up to 3 hotends / E steppers." #endif #ifndef BOARD_INFO_NAME diff --git a/Marlin/src/pins/ramps/pins_FORMBOT_TREX2PLUS.h b/Marlin/src/pins/ramps/pins_FORMBOT_TREX2PLUS.h index 7a128318620b..17d3abc71f37 100644 --- a/Marlin/src/pins/ramps/pins_FORMBOT_TREX2PLUS.h +++ b/Marlin/src/pins/ramps/pins_FORMBOT_TREX2PLUS.h @@ -29,7 +29,7 @@ #include "env_validate.h" #if HOTENDS > 2 || E_STEPPERS > 2 - #error "Formbot supports up to 2 hotends / E-steppers. Comment out this line to continue." + #error "Formbot supports up to 2 hotends / E steppers." #endif #define BOARD_INFO_NAME "Formbot" diff --git a/Marlin/src/pins/ramps/pins_FORMBOT_TREX3.h b/Marlin/src/pins/ramps/pins_FORMBOT_TREX3.h index 0a94a582d43c..e23a63994faa 100644 --- a/Marlin/src/pins/ramps/pins_FORMBOT_TREX3.h +++ b/Marlin/src/pins/ramps/pins_FORMBOT_TREX3.h @@ -29,7 +29,7 @@ #include "env_validate.h" #if HOTENDS > 2 || E_STEPPERS > 2 - #error "Formbot supports up to 2 hotends / E-steppers. Comment out this line to continue." + #error "Formbot supports up to 2 hotends / E steppers." #endif #define BOARD_INFO_NAME "Formbot" diff --git a/Marlin/src/pins/ramps/pins_K8600.h b/Marlin/src/pins/ramps/pins_K8600.h index 2dabd9d59b93..a9613e8eb27f 100644 --- a/Marlin/src/pins/ramps/pins_K8600.h +++ b/Marlin/src/pins/ramps/pins_K8600.h @@ -26,7 +26,7 @@ */ #if HAS_MULTI_HOTEND - #error "Only 1 hotend is supported for Vertex Nano." + #error "K8600 only supports 1 hotend / E stepper." #endif #define BOARD_INFO_NAME "K8600" diff --git a/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h b/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h index a7817c6f3a7b..af1d33c83c60 100644 --- a/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h +++ b/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h @@ -29,7 +29,7 @@ #include "env_validate.h" #if HAS_MULTI_HOTEND || E_STEPPERS > 1 - #error "Longer3D LGT KIT V1.0 board only supports one hotend / E-stepper. Comment out this line to continue." + #error "Longer3D LGT KIT V1.0 only supports 1 hotend / E stepper." #endif #if SERIAL_PORT == 1 || SERIAL_PORT_2 == 1 || SERIAL_PORT_3 == 1 diff --git a/Marlin/src/pins/ramps/pins_MKS_BASE_10.h b/Marlin/src/pins/ramps/pins_MKS_BASE_10.h index c40cabe32515..64efa46c0550 100644 --- a/Marlin/src/pins/ramps/pins_MKS_BASE_10.h +++ b/Marlin/src/pins/ramps/pins_MKS_BASE_10.h @@ -28,7 +28,7 @@ */ #if HOTENDS > 2 || E_STEPPERS > 2 - #error "MKS BASE 1.0 supports up to 2 hotends / E-steppers. Comment out this line to continue." + #error "MKS BASE 1.0 supports up to 2 hotends / E steppers." #endif #define BOARD_INFO_NAME "MKS BASE 1.0" diff --git a/Marlin/src/pins/ramps/pins_MKS_BASE_14.h b/Marlin/src/pins/ramps/pins_MKS_BASE_14.h index 992ab92ee9c2..7e2a722cf222 100644 --- a/Marlin/src/pins/ramps/pins_MKS_BASE_14.h +++ b/Marlin/src/pins/ramps/pins_MKS_BASE_14.h @@ -26,7 +26,7 @@ */ #if HOTENDS > 2 || E_STEPPERS > 2 - #error "MKS BASE 1.4 only supports up to 2 hotends / E-steppers. Comment out this line to continue." + #error "MKS BASE 1.4 supports up to 2 hotends / E steppers." #endif #define BOARD_INFO_NAME "MKS BASE 1.4" diff --git a/Marlin/src/pins/ramps/pins_MKS_BASE_15.h b/Marlin/src/pins/ramps/pins_MKS_BASE_15.h index 2b0c2bb88300..5fedd3f97c8a 100644 --- a/Marlin/src/pins/ramps/pins_MKS_BASE_15.h +++ b/Marlin/src/pins/ramps/pins_MKS_BASE_15.h @@ -26,7 +26,7 @@ */ #if HOTENDS > 2 || E_STEPPERS > 2 - #error "MKS BASE 1.5 only supports up to 2 hotends / E-steppers. Comment out this line to continue." + #error "MKS BASE 1.5 supports up to 2 hotends / E steppers." #endif #define BOARD_INFO_NAME "MKS BASE 1.5" diff --git a/Marlin/src/pins/ramps/pins_MKS_BASE_16.h b/Marlin/src/pins/ramps/pins_MKS_BASE_16.h index 31a8fdab8d3a..63e0b51d3cc5 100644 --- a/Marlin/src/pins/ramps/pins_MKS_BASE_16.h +++ b/Marlin/src/pins/ramps/pins_MKS_BASE_16.h @@ -26,7 +26,7 @@ */ #if HOTENDS > 2 || E_STEPPERS > 2 - #error "MKS BASE 1.6 only supports up to 2 hotends / E-steppers. Comment out this line to continue." + #error "MKS BASE 1.6 supports up to 2 hotends / E steppers." #endif #define BOARD_INFO_NAME "MKS BASE 1.6" diff --git a/Marlin/src/pins/ramps/pins_MKS_GEN_13.h b/Marlin/src/pins/ramps/pins_MKS_GEN_13.h index 5f373f99d74b..bb7b55893ec1 100644 --- a/Marlin/src/pins/ramps/pins_MKS_GEN_13.h +++ b/Marlin/src/pins/ramps/pins_MKS_GEN_13.h @@ -31,7 +31,7 @@ */ #if HOTENDS > 2 || E_STEPPERS > 2 - #error "MKS GEN 1.3/1.4 supports up to 2 hotends / E-steppers. Comment out this line to continue." + #error "MKS GEN 1.3/1.4 supports up to 2 hotends / E steppers." #endif #define BOARD_INFO_NAME "MKS GEN >= v1.3" diff --git a/Marlin/src/pins/ramps/pins_MKS_GEN_L.h b/Marlin/src/pins/ramps/pins_MKS_GEN_L.h index 4dca1ca187b0..ca1f1338164e 100644 --- a/Marlin/src/pins/ramps/pins_MKS_GEN_L.h +++ b/Marlin/src/pins/ramps/pins_MKS_GEN_L.h @@ -26,7 +26,7 @@ */ #if HOTENDS > 2 || E_STEPPERS > 2 - #error "MKS GEN L supports up to 2 hotends / E-steppers. Comment out this line to continue." + #error "MKS GEN L supports up to 2 hotends / E steppers." #endif #define BOARD_INFO_NAME "MKS GEN L" diff --git a/Marlin/src/pins/ramps/pins_MKS_GEN_L_V2.h b/Marlin/src/pins/ramps/pins_MKS_GEN_L_V2.h index 20f3dece4273..0378b166a2d4 100644 --- a/Marlin/src/pins/ramps/pins_MKS_GEN_L_V2.h +++ b/Marlin/src/pins/ramps/pins_MKS_GEN_L_V2.h @@ -26,7 +26,7 @@ */ #if HOTENDS > 2 || E_STEPPERS > 2 - #error "MKS GEN L V2 supports up to 2 hotends / E-steppers. Comment out this line to continue." + #error "MKS GEN L V2 supports up to 2 hotends / E steppers." #endif #define BOARD_INFO_NAME "MKS GEN L V2" diff --git a/Marlin/src/pins/ramps/pins_MKS_GEN_L_V21.h b/Marlin/src/pins/ramps/pins_MKS_GEN_L_V21.h index 24e04a39ff1f..d508cb453f4d 100644 --- a/Marlin/src/pins/ramps/pins_MKS_GEN_L_V21.h +++ b/Marlin/src/pins/ramps/pins_MKS_GEN_L_V21.h @@ -26,7 +26,7 @@ */ #if HOTENDS > 2 || E_STEPPERS > 2 - #error "MKS GEN L V2.1 supports up to 2 hotends / E-steppers. Comment out this line to continue." + #error "MKS GEN L V2.1 supports up to 2 hotends / E steppers." #endif #define BOARD_INFO_NAME "MKS GEN L V2.1" diff --git a/Marlin/src/pins/ramps/pins_RAMPS.h b/Marlin/src/pins/ramps/pins_RAMPS.h index 4ab7f4007331..199be4a1c92a 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS.h +++ b/Marlin/src/pins/ramps/pins_RAMPS.h @@ -592,7 +592,10 @@ #elif ENABLED(ZONESTAR_LCD) - #error "CAUTION! ZONESTAR_LCD on RAMPS requires wiring modifications. It plugs into AUX2 but GND and 5V need to be swapped. Comment out this line to continue." + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! ZONESTAR_LCD on RAMPS requires wiring modifications. It plugs into AUX2 but GND and 5V need to be swapped. See 'pins_RAMPS.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif + #define LCD_PINS_RS AUX2_05_PIN #define LCD_PINS_ENABLE AUX2_07_PIN #define LCD_PINS_D4 AUX2_04_PIN @@ -859,7 +862,9 @@ #if BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) - #error "CAUTION! LCD_FYSETC_TFT81050 requires wiring modifications. See 'pins_RAMPS.h' for details. Comment out this line to continue." + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! LCD_FYSETC_TFT81050 requires wiring modifications. See 'pins_RAMPS.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif /** * FYSETC TFT-81050 display pinout diff --git a/Marlin/src/pins/ramps/pins_RAMPS_CREALITY.h b/Marlin/src/pins/ramps/pins_RAMPS_CREALITY.h index 679503e98268..3d5f5d6f9107 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS_CREALITY.h +++ b/Marlin/src/pins/ramps/pins_RAMPS_CREALITY.h @@ -22,7 +22,7 @@ #pragma once #if HOTENDS > 2 || E_STEPPERS > 2 - #error "Creality3D RAMPS supports only 2 hotends / E-steppers. Comment out this line to continue." + #error "Creality RAMPS supports up to 2 hotends / E steppers." #endif #define BOARD_INFO_NAME "Creality3D RAMPS" diff --git a/Marlin/src/pins/ramps/pins_RAMPS_ENDER_4.h b/Marlin/src/pins/ramps/pins_RAMPS_ENDER_4.h index 358395890624..8f9148b732ee 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS_ENDER_4.h +++ b/Marlin/src/pins/ramps/pins_RAMPS_ENDER_4.h @@ -22,7 +22,7 @@ #pragma once #if HAS_MULTI_HOTEND || E_STEPPERS > 1 - #error "Ender-4 only supports one hotend / E-stepper. Comment out this line to continue." + #error "Ender-4 only supports 1 hotend / E stepper." #endif #define BOARD_INFO_NAME "Ender-4" diff --git a/Marlin/src/pins/ramps/pins_RL200.h b/Marlin/src/pins/ramps/pins_RL200.h index 52d0173c00a8..00fb39a43901 100644 --- a/Marlin/src/pins/ramps/pins_RL200.h +++ b/Marlin/src/pins/ramps/pins_RL200.h @@ -30,9 +30,9 @@ #define DEFAULT_MACHINE_NAME "Rapide Lite 200" #if HOTENDS > 2 || E_STEPPERS > 2 - #error "RL200v1 supports up to 2 hotends / E-steppers. Comment out this line to continue." + #error "RL200v1 supports up to 2 hotends / E steppers." #elif NUM_Z_STEPPERS != 2 - #error "RL200 uses dual Z stepper motors. Set NUM_Z_STEPPERS to 2 or comment out this line to continue." + #error "RL200 uses dual Z stepper motors. Z_DRIVER_TYPE and Z2_DRIVER_TYPE must be defined." #elif !(AXIS_DRIVER_TYPE_X(DRV8825) && AXIS_DRIVER_TYPE_Y(DRV8825) && AXIS_DRIVER_TYPE_Z(DRV8825) && AXIS_DRIVER_TYPE_Z2(DRV8825) && AXIS_DRIVER_TYPE_E0(DRV8825)) #error "You must set ([XYZ]|Z2|E0)_DRIVER_TYPE to DRV8825 in Configuration.h for RL200." #endif diff --git a/Marlin/src/pins/ramps/pins_RUMBA.h b/Marlin/src/pins/ramps/pins_RUMBA.h index 7d17bf2e12ed..eb049c48dd99 100644 --- a/Marlin/src/pins/ramps/pins_RUMBA.h +++ b/Marlin/src/pins/ramps/pins_RUMBA.h @@ -29,7 +29,7 @@ #include "env_validate.h" #if HOTENDS > 3 || E_STEPPERS > 3 - #error "RUMBA supports up to 3 hotends / E-steppers. Comment out this line to continue." + #error "RUMBA supports up to 3 hotends / E steppers." #endif #ifndef BOARD_INFO_NAME diff --git a/Marlin/src/pins/ramps/pins_SAINSMART_2IN1.h b/Marlin/src/pins/ramps/pins_SAINSMART_2IN1.h index 85defdf1bd80..d25029a7a39c 100644 --- a/Marlin/src/pins/ramps/pins_SAINSMART_2IN1.h +++ b/Marlin/src/pins/ramps/pins_SAINSMART_2IN1.h @@ -26,7 +26,7 @@ */ #if HOTENDS > 2 || E_STEPPERS > 2 - #error "Sainsmart 2-in-1 supports up to 2 hotends / E-steppers. Comment out this line to continue." + #error "Sainsmart 2-in-1 supports up to 2 hotends / E steppers." #endif #define BOARD_INFO_NAME "Sainsmart" diff --git a/Marlin/src/pins/ramps/pins_TENLOG_D3_HERO.h b/Marlin/src/pins/ramps/pins_TENLOG_D3_HERO.h index b884fcbfc7c1..61c5ddd64306 100644 --- a/Marlin/src/pins/ramps/pins_TENLOG_D3_HERO.h +++ b/Marlin/src/pins/ramps/pins_TENLOG_D3_HERO.h @@ -29,7 +29,7 @@ #include "env_validate.h" #if HOTENDS > 2 || E_STEPPERS > 2 - #error "Tenlog supports up to 2 hotends / E-steppers. Comment out this line to continue." + #error "Tenlog supports up to 2 hotends / E steppers." #endif #define BOARD_INFO_NAME "Tenlog D3 Hero" diff --git a/Marlin/src/pins/ramps/pins_TRONXY_V3_1_0.h b/Marlin/src/pins/ramps/pins_TRONXY_V3_1_0.h index ffe6d56eb8b1..04c6af67b002 100644 --- a/Marlin/src/pins/ramps/pins_TRONXY_V3_1_0.h +++ b/Marlin/src/pins/ramps/pins_TRONXY_V3_1_0.h @@ -29,7 +29,7 @@ #include "env_validate.h" #if HOTENDS > 2 || E_STEPPERS > 2 - #error "TRONXY-V3-1.0 supports only 2 hotends/E-steppers. Comment out this line to continue." + #error "TRONXY-V3-1.0 supports up to 2 hotends/E steppers." #endif #define BOARD_INFO_NAME "TRONXY-V3-1.0" diff --git a/Marlin/src/pins/ramps/pins_TT_OSCAR.h b/Marlin/src/pins/ramps/pins_TT_OSCAR.h index 9d844ebcdcba..f81cc6039aed 100644 --- a/Marlin/src/pins/ramps/pins_TT_OSCAR.h +++ b/Marlin/src/pins/ramps/pins_TT_OSCAR.h @@ -24,7 +24,7 @@ #include "env_validate.h" #if HOTENDS > 5 || E_STEPPERS > 5 - #error "TTOSCAR supports up to 5 hotends / E-steppers. Comment out this line to continue." + #error "TTOSCAR supports up to 5 hotends / E steppers." #endif #define BOARD_INFO_NAME "TT OSCAR" diff --git a/Marlin/src/pins/ramps/pins_ZRIB_V52.h b/Marlin/src/pins/ramps/pins_ZRIB_V52.h index 002b9dbef580..2df789cd6f7f 100644 --- a/Marlin/src/pins/ramps/pins_ZRIB_V52.h +++ b/Marlin/src/pins/ramps/pins_ZRIB_V52.h @@ -26,7 +26,7 @@ */ #if HOTENDS > 2 || E_STEPPERS > 2 - #error "ZRIB V5.2 only supports up to 2 hotends / E-steppers. Comment out this line to continue." + #error "ZRIB V5.2 supports up to 2 hotends / E steppers." #endif #define BOARD_INFO_NAME "ZRIB V5.2" diff --git a/Marlin/src/pins/ramps/pins_ZRIB_V53.h b/Marlin/src/pins/ramps/pins_ZRIB_V53.h index 3a2604586ef0..48808d9601c8 100644 --- a/Marlin/src/pins/ramps/pins_ZRIB_V53.h +++ b/Marlin/src/pins/ramps/pins_ZRIB_V53.h @@ -28,9 +28,9 @@ #include "env_validate.h" #if HOTENDS > 2 - #error "ZRIB V5.3 only supports up to 2 hotends. Comment out this line to continue." + #error "ZRIB V5.3 supports up to 2 hotends." #elif E_STEPPERS > 3 - #error "ZRIB V5.3 only supports up to 3 E-steppers. Comment out this line to continue." + #error "ZRIB V5.3 supports up to 3 E steppers." #endif #define BOARD_INFO_NAME "ZRIB V5.3" diff --git a/Marlin/src/pins/ramps/pins_Z_BOLT_X_SERIES.h b/Marlin/src/pins/ramps/pins_Z_BOLT_X_SERIES.h index feaa4ba98b95..b68e3edb4567 100644 --- a/Marlin/src/pins/ramps/pins_Z_BOLT_X_SERIES.h +++ b/Marlin/src/pins/ramps/pins_Z_BOLT_X_SERIES.h @@ -29,7 +29,7 @@ #include "env_validate.h" #if HOTENDS > 4 || E_STEPPERS > 4 - #error "Z-Bolt X Series board supports up to 4 hotends / E-steppers." + #error "Z-Bolt X Series supports up to 4 hotends / E steppers." #endif #define BOARD_INFO_NAME "Z-Bolt X Series" diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h index 7300919d9df7..06788139f01f 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h @@ -182,7 +182,9 @@ #elif ENABLED(ZONESTAR_LCD) // ANET A8 LCD Controller - Must convert to 3.3V - CONNECTING TO 5V WILL DAMAGE THE BOARD! - #error "CAUTION! ZONESTAR_LCD requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. Comment out this line to continue." + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! ZONESTAR_LCD requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_DIP.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif #define LCD_PINS_RS PB9 #define LCD_PINS_ENABLE PB6 @@ -224,7 +226,9 @@ #if BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) - #error "CAUTION! LCD_FYSETC_TFT81050 requires wiring modifications. See 'pins_BTT_SKR_E3_DIP.h' for details. Comment out this line to continue." + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! LCD_FYSETC_TFT81050 requires wiring modifications. See 'pins_BTT_SKR_E3_DIP.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif /** FYSETC TFT TFT81050 display pinout * diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h index e728af317d82..fa7eb3dd115c 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h @@ -150,7 +150,9 @@ * All pins are labeled as printed on DWIN PCB. Connect TX-TX, A-A and so on. */ - #error "Ender-3 V2 display requires a custom cable, see diagram above this line. Comment out this line to continue." + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! Ender-3 V2 display requires a custom cable. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif #define BEEPER_PIN EXP1_9 #define BTN_EN1 EXP1_3 @@ -173,7 +175,9 @@ #elif ENABLED(ZONESTAR_LCD) // ANET A8 LCD Controller - Must convert to 3.3V - CONNECTING TO 5V WILL DAMAGE THE BOARD! - #error "CAUTION! ZONESTAR_LCD requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. Comment out this line to continue." + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! ZONESTAR_LCD requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif #define LCD_PINS_RS PB9 #define LCD_PINS_ENABLE EXP1_9 @@ -201,7 +205,9 @@ #if ENABLED(TFTGLCD_PANEL_SPI) - #error "CAUTION! TFTGLCD_PANEL_SPI requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. Comment out this line to continue." + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! TFTGLCD_PANEL_SPI requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif /** * TFTGLCD_PANEL_SPI display pinout @@ -238,7 +244,9 @@ #elif ENABLED(FYSETC_MINI_12864_2_1) - #error "CAUTION! FYSETC_MINI_12864_2_1 / MKS_MINI_12864_V3 / BTT_MINI_12864_V1 requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. Comment out this line to continue." + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! FYSETC_MINI_12864_2_1 / MKS_MINI_12864_V3 / BTT_MINI_12864_V1 requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif /** * FYSETC_MINI_12864_2_1 / MKS_MINI_12864_V3 / BTT_MINI_12864_V1 display pinout @@ -308,7 +316,9 @@ #if BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) - #error "CAUTION! LCD_FYSETC_TFT81050 requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. Comment out this line to continue." + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! LCD_FYSETC_TFT81050 requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif /** * FYSETC TFT TFT81050 display pinout diff --git a/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h b/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h index ed3a653d2192..9dec1e127967 100644 --- a/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h +++ b/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h @@ -24,7 +24,7 @@ #include "env_validate.h" #if HAS_MULTI_HOTEND || E_STEPPERS > 1 - #error "CCROBOT-ONLINE MEEB_3DP only supports one hotend / E-stepper. Comment out this line to continue." + #error "CCROBOT-ONLINE MEEB_3DP only supports 1 hotend / E stepper." #endif // https://github.com/ccrobot-online/MEEB_3DP diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h index 66ee8af61b6a..53953f9ebccc 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h @@ -29,7 +29,7 @@ #include "env_validate.h" #if HAS_MULTI_HOTEND || E_STEPPERS > 1 - #error "Creality V24S1 only supports one hotend / E-stepper. Comment out this line to continue." + #error "Creality v24S1 only supports 1 hotend / E stepper." #endif #if BOTH(BLTOUCH, Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V25S1.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V25S1.h index 0425a45d1d25..a0152a522166 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V25S1.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V25S1.h @@ -28,7 +28,7 @@ #include "env_validate.h" #if HAS_MULTI_HOTEND || E_STEPPERS > 1 - #error "Creality V2.5.S1 only supports one hotend / E-stepper. Comment out this line to continue." + #error "Creality V2.5.S1 only supports 1 hotend / E stepper." #endif #define BOARD_INFO_NAME "Creality v2.5.S1" diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h index 5552d19ab926..cb11c3e53b5b 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h @@ -28,7 +28,7 @@ #include "env_validate.h" #if HAS_MULTI_HOTEND || E_STEPPERS > 1 - #error "Creality V4 only supports one hotend / E-stepper. Comment out this line to continue." + #error "Creality v4 only supports 1 hotend / E stepper." #endif #ifndef BOARD_INFO_NAME diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h index 1c9a0a8f997f..484ff6544275 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h @@ -28,7 +28,7 @@ #include "env_validate.h" #if HAS_MULTI_HOTEND || E_STEPPERS > 1 - #error "CREALITY supports up to 1 hotends / E-steppers. Comment out this line to continue." + #error "Creality v4.2.10 only supports 1 hotend / E stepper." #endif #ifndef BOARD_INFO_NAME diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V452.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V452.h index ced64e2a893c..4f57f8a805df 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V452.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V452.h @@ -26,7 +26,7 @@ */ #if HAS_MULTI_HOTEND || E_STEPPERS > 1 - #error "Creality v4.5.2 only supports one hotend / E-stepper. Comment out this line to continue." + #error "Creality v4.5.2 only supports 1 hotend / E stepper." #endif #define BOARD_INFO_NAME "Creality v4.5.2" diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V453.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V453.h index e7296d1ed077..6a0fa4f41802 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V453.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V453.h @@ -26,7 +26,7 @@ */ #if HAS_MULTI_HOTEND || E_STEPPERS > 1 - #error "Creality v4.5.3 only supports one hotend / E-stepper. Comment out this line to continue." + #error "Creality v4.5.3 only supports 1 hotend / E stepper." #endif #define BOARD_INFO_NAME "Creality v4.5.3" diff --git a/Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h b/Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h index 8d0093a4d989..08c9500fc5e1 100644 --- a/Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h @@ -28,7 +28,7 @@ #include "env_validate.h" #if HOTENDS > 2 || E_STEPPERS > 2 - #error "Eryone Ery32 mini supports up to 2 hotends / E-steppers. Comment out this line to continue." + #error "Eryone Ery32 mini supports up to 2 hotends / E steppers." #endif #ifndef BOARD_INFO_NAME diff --git a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h index 9efae6e3a887..dd621eb5c126 100644 --- a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h +++ b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h @@ -32,7 +32,7 @@ #if NOT_TARGET(__STM32F1__, STM32F1xx) #error "Oops! Select an STM32F1 board in 'Tools > Board.'" #elif HAS_MULTI_HOTEND || E_STEPPERS > 1 - #error "FLSUN HiSpeedV1 only supports one hotend / E-stepper. Comment out this line to continue." + #error "FLSUN HiSpeedV1 only supports 1 hotend / E stepper." #endif #define BOARD_INFO_NAME "FLSun HiSpeedV1" diff --git a/Marlin/src/pins/stm32f1/pins_JGAURORA_A5S_A1.h b/Marlin/src/pins/stm32f1/pins_JGAURORA_A5S_A1.h index 86a8ed6b9a81..d3cf3e5cf52c 100644 --- a/Marlin/src/pins/stm32f1/pins_JGAURORA_A5S_A1.h +++ b/Marlin/src/pins/stm32f1/pins_JGAURORA_A5S_A1.h @@ -33,7 +33,7 @@ #include "env_validate.h" #if HAS_MULTI_HOTEND || E_STEPPERS > 1 - #error "JGAurora A5S A1 only supports one hotend / E-stepper. Comment out this line to continue." + #error "JGAurora A5S A1 only supports 1 hotend / E stepper." #endif #define BOARD_INFO_NAME "JGAurora A5S A1" diff --git a/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h b/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h index 59d9b8d95676..e6d31746539a 100644 --- a/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h +++ b/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h @@ -28,7 +28,7 @@ #if NOT_TARGET(__STM32F1__, STM32F1xx) #error "Oops! Select a STM32F1 board in 'Tools > Board.'" #elif HAS_MULTI_HOTEND || E_STEPPERS > 1 - #error "Longer3D only supports one hotend / E-stepper. Comment out this line to continue." + #error "Longer3D only supports 1 hotend / E stepper." #endif #define BOARD_INFO_NAME "Longer3D" diff --git a/Marlin/src/pins/stm32f1/pins_MINGDA_MPX_ARM_MINI.h b/Marlin/src/pins/stm32f1/pins_MINGDA_MPX_ARM_MINI.h index 37c67708848c..f157c8e45544 100644 --- a/Marlin/src/pins/stm32f1/pins_MINGDA_MPX_ARM_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_MINGDA_MPX_ARM_MINI.h @@ -28,7 +28,7 @@ #if NOT_TARGET(STM32F1, STM32F1xx) #error "Oops! Select an STM32F1 board in 'Tools > Board.'" #elif HOTENDS > 1 || E_STEPPERS > 1 - #error "MPX ARM Mini only supports one hotend / E-stepper. Comment out this line to continue." + #error "MPX ARM Mini only supports 1 hotend / E stepper." #endif #define BOARD_INFO_NAME "Mingda MPX ARM Mini" diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h index 6ab20681ad5a..2c147eb9f3e0 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h @@ -29,7 +29,7 @@ #if NOT_TARGET(STM32F1, STM32F1xx) #error "Oops! Select an STM32F1 board in 'Tools > Board.'" #elif HOTENDS > 2 || E_STEPPERS > 2 - #error "MKS Robin supports up to 2 hotends / E-steppers. Comment out this line to continue." + #error "MKS Robin supports up to 2 hotends / E steppers." #endif #define BOARD_INFO_NAME "MKS Robin" diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3.h index 6b05bb7a7487..448e62ac8dad 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3.h @@ -26,7 +26,7 @@ */ #if HAS_MULTI_HOTEND || E_STEPPERS > 1 - #error "MKS Robin E3 only supports one hotend / E-stepper. Comment out this line to continue." + #error "MKS Robin E3 only supports 1 hotend / E stepper." #endif #ifndef BOARD_INFO_NAME diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D.h index 9d11af43ef2b..77c2b792157a 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D.h @@ -26,7 +26,7 @@ */ #if HAS_MULTI_HOTEND || E_STEPPERS > 1 - #error "MKS Robin E3D only supports one hotend / E-stepper. Comment out this line to continue." + #error "MKS Robin E3D only supports 1 hotend / E stepper." #endif #ifndef BOARD_INFO_NAME diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D_V1_1.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D_V1_1.h index 930ef9722d50..2ad68a01405c 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D_V1_1.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D_V1_1.h @@ -26,7 +26,7 @@ */ #if HAS_MULTI_HOTEND || E_STEPPERS > 1 - #error "MKS Robin E3D v1.1 only supports one hotend / E-stepper. Comment out this line to continue." + #error "MKS Robin E3D v1.1 only supports 1 hotend / E stepper." #endif #ifndef BOARD_INFO_NAME diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h index ef800b15c7a3..f7a47a8f143d 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h @@ -28,7 +28,7 @@ #include "env_validate.h" #if HAS_MULTI_HOTEND || E_STEPPERS > 1 - #error "MKS Robin E3P only supports one hotend / E-stepper. Comment out this line to continue." + #error "MKS Robin E3P only supports 1 hotend / E stepper." #elif HAS_FSMC_TFT #error "MKS Robin E3P doesn't support FSMC-based TFT displays." #endif diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_V1_1.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_V1_1.h index 7a38507c7621..13677b40a0ef 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_V1_1.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_V1_1.h @@ -26,7 +26,7 @@ */ #if HAS_MULTI_HOTEND || E_STEPPERS > 1 - #error "MKS Robin E3 v1.1 only supports one hotend / E-stepper. Comment out this line to continue." + #error "MKS Robin E3 v1.1 only supports 1 hotend / E stepper." #endif #ifndef BOARD_INFO_NAME diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE.h index 9f33d4392a14..bc42bd02eba0 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE.h @@ -24,7 +24,7 @@ #include "env_validate.h" #if HAS_MULTI_HOTEND || E_STEPPERS > 1 - #error "MKS Robin Lite only supports one hotend / E-stepper. Comment out this line to continue." + #error "MKS Robin Lite only supports 1 hotend / E stepper." #endif #ifndef BOARD_INFO_NAME diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE3.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE3.h index 416a061412e1..b1aaa53c9487 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE3.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE3.h @@ -28,7 +28,7 @@ #include "env_validate.h" #if HOTENDS > 2 || E_STEPPERS > 2 - #error "MKS Robin Lite3 supports up to 2 hotends / E-steppers. Comment out this line to continue." + #error "MKS Robin Lite3 supports up to 2 hotends / E steppers." #endif #ifndef BOARD_INFO_NAME diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h index dac09d037fc6..0bfc7f5c8d93 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h @@ -28,7 +28,7 @@ #include "env_validate.h" #if HAS_MULTI_HOTEND || E_STEPPERS > 1 - #error "MKS Robin mini only supports one hotend / E-stepper. Comment out this line to continue." + #error "MKS Robin mini only supports 1 hotend / E stepper." #endif #define BOARD_INFO_NAME "MKS Robin Mini" diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h index 49fe59577edc..8337e5fac49a 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h @@ -28,7 +28,7 @@ #if NOT_TARGET(__STM32F1__, STM32F1) #error "Oops! Select an STM32F1 board in 'Tools > Board.'" #elif HOTENDS > 2 || E_STEPPERS > 2 - #error "MKS Robin nano supports up to 2 hotends / E-steppers. Comment out this line to continue." + #error "MKS Robin nano supports up to 2 hotends / E steppers." #elif HAS_FSMC_TFT #error "MKS Robin nano v2 doesn't support FSMC-based TFT displays." #endif diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h index 2040a4ba29d8..0eb7bbdffeb4 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h @@ -26,7 +26,7 @@ */ #if HOTENDS > 2 || E_STEPPERS > 2 - #error "MKS Robin nano supports up to 2 hotends / E-steppers. Comment out this line to continue." + #error "MKS Robin nano boards support up to 2 hotends / E steppers." #endif #define BOARD_NO_NATIVE_USB diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h index 53f207adb7ab..1db2d0c5dd84 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h @@ -28,7 +28,7 @@ #include "env_validate.h" #if HOTENDS > 3 || E_STEPPERS > 3 - #error "MKS Robin pro supports up to 3 hotends / E-steppers. Comment out this line to continue." + #error "MKS Robin pro supports up to 3 hotends / E steppers." #endif #define BOARD_INFO_NAME "MKS Robin pro" diff --git a/Marlin/src/pins/stm32f1/pins_PANDA_PI_V29.h b/Marlin/src/pins/stm32f1/pins_PANDA_PI_V29.h index 98ef165e2d66..ad28e5c47b64 100644 --- a/Marlin/src/pins/stm32f1/pins_PANDA_PI_V29.h +++ b/Marlin/src/pins/stm32f1/pins_PANDA_PI_V29.h @@ -173,7 +173,9 @@ #if BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) - #error "CAUTION! LCD_FYSETC_TFT81050 requires wiring modifications. See 'pins_BTT_SKR_E3_DIP.h' for details. Comment out this line to continue." + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! LCD_FYSETC_TFT81050 requires wiring modifications. See 'pins_PANDA_PI_V29.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif /** FYSETC TFT TFT81050 display pinout * diff --git a/Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h b/Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h index 4ffa8da924d3..73f61c1aca70 100644 --- a/Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h +++ b/Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h @@ -31,7 +31,7 @@ #include "env_validate.h" #if HOTENDS > 2 || E_STEPPERS > 2 - #error "Trigorilla Pro supports up to 2 hotends / E-steppers. Comment out this line to continue." + #error "Trigorilla Pro supports up to 2 hotends / E steppers." #endif #define BOARD_INFO_NAME "Trigorilla Pro" diff --git a/Marlin/src/pins/stm32f4/pins_ANET_ET4.h b/Marlin/src/pins/stm32f4/pins_ANET_ET4.h index 09da5adf7c6d..7816e5e5056a 100644 --- a/Marlin/src/pins/stm32f4/pins_ANET_ET4.h +++ b/Marlin/src/pins/stm32f4/pins_ANET_ET4.h @@ -24,7 +24,7 @@ #include "env_validate.h" #if HAS_MULTI_HOTEND || E_STEPPERS > 1 - #error "Anet ET4 only supports one hotend / E-stepper. Comment out this line to continue." + #error "Anet ET4 only supports 1 hotend / E stepper." #endif #ifndef BOARD_INFO_NAME diff --git a/Marlin/src/pins/stm32f4/pins_ARMED.h b/Marlin/src/pins/stm32f4/pins_ARMED.h index 6d5b87240d6b..d08d3fb66c0a 100644 --- a/Marlin/src/pins/stm32f4/pins_ARMED.h +++ b/Marlin/src/pins/stm32f4/pins_ARMED.h @@ -27,7 +27,7 @@ #include "env_validate.h" #if HOTENDS > 2 || E_STEPPERS > 2 - #error "Arm'ed supports up to 2 hotends / E-steppers." + #error "Arm'ed supports up to 2 hotends / E steppers." #endif #ifndef ARMED_V1_0 diff --git a/Marlin/src/pins/stm32f4/pins_ARTILLERY_RUBY.h b/Marlin/src/pins/stm32f4/pins_ARTILLERY_RUBY.h index 653735bd61d0..47d009c5a61e 100644 --- a/Marlin/src/pins/stm32f4/pins_ARTILLERY_RUBY.h +++ b/Marlin/src/pins/stm32f4/pins_ARTILLERY_RUBY.h @@ -24,7 +24,7 @@ #include "env_validate.h" #if HOTENDS > 1 || E_STEPPERS > 1 - #error "Artillery Ruby supports up to 1 hotends / E-steppers." + #error "Artillery Ruby only supports 1 hotend / E stepper." #endif #define BOARD_INFO_NAME "Artillery Ruby" diff --git a/Marlin/src/pins/stm32f4/pins_BLACK_STM32F407VE.h b/Marlin/src/pins/stm32f4/pins_BLACK_STM32F407VE.h index 9da6e1a01b6a..c49abca9ef85 100644 --- a/Marlin/src/pins/stm32f4/pins_BLACK_STM32F407VE.h +++ b/Marlin/src/pins/stm32f4/pins_BLACK_STM32F407VE.h @@ -31,7 +31,7 @@ #include "env_validate.h" #if HOTENDS > 2 || E_STEPPERS > 2 - #error "Black STM32F4VET6 supports up to 2 hotends / E-steppers." + #error "Black STM32F4VET6 supports up to 2 hotends / E steppers." #endif #ifndef BOARD_INFO_NAME diff --git a/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h b/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h index 99de2e43e7a3..531ab7a9581d 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h @@ -24,7 +24,7 @@ #include "env_validate.h" #if HAS_MULTI_HOTEND || E_STEPPERS > 1 - #error "BIGTREE BTT002 V1.0 only supports one hotend / E-stepper. Comment out this line to continue." + #error "BIGTREE BTT002 V1.0 only supports 1 hotend / E stepper." #endif #define BOARD_INFO_NAME "BTT BTT002 V1.0" diff --git a/Marlin/src/pins/stm32f4/pins_BTT_E3_RRF.h b/Marlin/src/pins/stm32f4/pins_BTT_E3_RRF.h index 40f953a7e8f5..c7cd35c7ad85 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_E3_RRF.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_E3_RRF.h @@ -211,7 +211,9 @@ #if ENABLED(LCD_FOR_MELZI) - #error "CAUTION! LCD_FOR_MELZI requires wiring modifications. See 'pins_BTT_E3_RRF.h' for details. Comment out this line to continue." + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! LCD_FOR_MELZI requires wiring modifications. See 'pins_BTT_E3_RRF.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif /** LCD_FOR_MELZI display pinout * @@ -245,7 +247,9 @@ #elif ENABLED(ZONESTAR_LCD) // ANET A8 LCD Controller - Must convert to 3.3V - CONNECTING TO 5V WILL DAMAGE THE BOARD! - #error "CAUTION! ZONESTAR_LCD requires wiring modifications. See 'pins_BTT_E3_RRF.h' for details. Comment out this line to continue." + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! ZONESTAR_LCD requires wiring modifications. See 'pins_BTT_E3_RRF.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif #define LCD_PINS_RS PE10 #define LCD_PINS_ENABLE PE9 @@ -273,7 +277,9 @@ #if ENABLED(TFTGLCD_PANEL_SPI) - #error "CAUTION! TFTGLCD_PANEL_SPI requires wiring modifications. See 'pins_BTT_E3_RRF.h' for details. Comment out this line to continue." + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! TFTGLCD_PANEL_SPI requires wiring modifications. See 'pins_BTT_E3_RRF.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif /** * TFTGLCD_PANEL_SPI display pinout @@ -327,7 +333,9 @@ #if BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) - #error "CAUTION! LCD_FYSETC_TFT81050 requires wiring modifications. See 'pins_BTT_E3_RRF.h' for details. Comment out this line to continue." + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! LCD_FYSETC_TFT81050 requires wiring modifications. See 'pins_BTT_E3_RRF.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif /** FYSETC TFT TFT81050 display pinout * diff --git a/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h b/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h index 68d92e1c30d7..b9525a9267ab 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h @@ -26,7 +26,7 @@ #if E_STEPPERS > MAX_E_STEPPERS #error "Marlin extruder/hotends limit! Increase MAX_E_STEPPERS to continue." #elif HOTENDS > 8 || E_STEPPERS > 8 - #error "BIGTREE GTR V1.0 supports up to 8 hotends / E-steppers." + #error "BIGTREE GTR V1.0 supports up to 8 hotends / E steppers." #endif #define BOARD_INFO_NAME "BTT GTR V1.0" diff --git a/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_V1_1.h b/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_V1_1.h index fb4b17b6fb22..8a918835f75e 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_V1_1.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_V1_1.h @@ -22,7 +22,7 @@ #pragma once #if HOTENDS > 3 || E_STEPPERS > 3 - #error "BIGTREE SKR Pro V1.1 supports up to 3 hotends / E-steppers." + #error "BIGTREE SKR Pro V1.1 supports up to 3 hotends / E steppers." #endif #define BOARD_INFO_NAME "BTT SKR Pro V1.1" diff --git a/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_V1_2.h b/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_V1_2.h index 615751b62d37..c88483f73ed4 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_V1_2.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_V1_2.h @@ -22,7 +22,7 @@ #pragma once #if HOTENDS > 3 || E_STEPPERS > 3 - #error "BIGTREE SKR Pro V1.2 supports up to 3 hotends / E-steppers." + #error "BIGTREE SKR Pro V1.2 supports up to 3 hotends / E steppers." #endif #define BOARD_INFO_NAME "BTT SKR Pro V1.2" diff --git a/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h b/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h index 5e424d4105fb..7c902b008cf6 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h @@ -456,7 +456,9 @@ #elif ENABLED(WYH_L12864) - #error "CAUTION! WYH_L12864 requires wiring modifications. Comment out this line to continue." + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! WYH_L12864 requires wiring modifications. See 'pins_BTT_SKR_PRO_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif /** * 1. Cut the tab off the LCD connector so it can be plugged into the "EXP1" connector the other way. diff --git a/Marlin/src/pins/stm32f4/pins_FLYF407ZG.h b/Marlin/src/pins/stm32f4/pins_FLYF407ZG.h index 3f5f7262b387..11b5dbbb6cc4 100644 --- a/Marlin/src/pins/stm32f4/pins_FLYF407ZG.h +++ b/Marlin/src/pins/stm32f4/pins_FLYF407ZG.h @@ -25,7 +25,7 @@ #include "env_validate.h" #if HOTENDS > 6 || E_STEPPERS > 6 - #error "FLYF407ZG supports up to 6 hotends / E-steppers." + #error "FLYF407ZG supports up to 6 hotends / E steppers." #endif #define BOARD_INFO_NAME "FLYF407ZG" diff --git a/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h b/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h index 299cc153773d..3ed18f9abc68 100644 --- a/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h +++ b/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h @@ -24,7 +24,7 @@ #include "env_validate.h" #if HOTENDS > 3 || E_STEPPERS > 3 - #error "FYSETC S6 supports up to 3 hotends / E-steppers." + #error "FYSETC S6 supports up to 3 hotends / E steppers." #endif #ifndef BOARD_INFO_NAME diff --git a/Marlin/src/pins/stm32f4/pins_FYSETC_SPIDER.h b/Marlin/src/pins/stm32f4/pins_FYSETC_SPIDER.h index 67f276bd2295..009bfb248dfe 100644 --- a/Marlin/src/pins/stm32f4/pins_FYSETC_SPIDER.h +++ b/Marlin/src/pins/stm32f4/pins_FYSETC_SPIDER.h @@ -117,7 +117,7 @@ #endif #if HOTENDS > 3 || E_STEPPERS > 3 - #error "FYSETC SPIDER supports up to 3 hotends / E-steppers." + #error "FYSETC SPIDER supports up to 3 hotends / E steppers." #else #include "pins_FYSETC_S6.h" #endif diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h index 099b3b79a497..6c6f8d25ea39 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h @@ -25,7 +25,7 @@ #include "env_validate.h" #if HOTENDS > 2 || E_STEPPERS > 2 - #error "LERDGE K supports up to 2 hotends / E-steppers." + #error "LERDGE K supports up to 2 hotends / E steppers." #endif #define BOARD_INFO_NAME "Lerdge K" diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h index 0e8b6e09a865..376c2f3f2734 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h @@ -25,7 +25,7 @@ #include "env_validate.h" #if HOTENDS > 2 || E_STEPPERS > 2 - #error "LERDGE S supports up to 2 hotends / E-steppers." + #error "LERDGE S supports up to 2 hotends / E steppers." #endif #define BOARD_INFO_NAME "Lerdge S" diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_X.h b/Marlin/src/pins/stm32f4/pins_LERDGE_X.h index 5048933146fe..6325697655ee 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_X.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_X.h @@ -25,7 +25,7 @@ #include "env_validate.h" #if HAS_MULTI_HOTEND || E_STEPPERS > 1 - #error "LERDGE X only supports one hotend / E-stepper. Comment out this line to continue." + #error "LERDGE X only supports 1 hotend / E stepper." #endif #define BOARD_INFO_NAME "Lerdge X" diff --git a/Marlin/src/pins/stm32f4/pins_MKS_EAGLE.h b/Marlin/src/pins/stm32f4/pins_MKS_EAGLE.h index 50f06b7e8119..ecea8e182b9e 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_EAGLE.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_EAGLE.h @@ -25,7 +25,7 @@ #include "env_validate.h" #if HOTENDS > 2 || E_STEPPERS > 2 - #error "MKS Eagle supports up to 2 hotends / E-steppers." + #error "MKS Eagle supports up to 2 hotends / E steppers." #elif HAS_FSMC_TFT #error "MKS Eagle doesn't support FSMC-based TFT displays." #endif diff --git a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8.h b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8.h index 124923fef841..d52cd77909ac 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8.h @@ -25,7 +25,7 @@ #include "env_validate.h" #if HOTENDS > 3 || E_STEPPERS > 5 - #error "MKS Monster supports up to 3 hotends and 5 E-steppers." + #error "MKS Monster supports up to 3 hotends and 5 E steppers." #elif HAS_FSMC_TFT #error "MKS Monster doesn't support FSMC-based TFT displays." #endif diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN2.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN2.h index 589300f34175..2274d0c0dff3 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN2.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN2.h @@ -24,7 +24,7 @@ #include "env_validate.h" #if HOTENDS > 2 || E_STEPPERS > 2 - #error "MKS_ROBIN2 supports up to 2 hotends / E-steppers." + #error "MKS_ROBIN2 supports up to 2 hotends / E steppers." #endif #ifndef BOARD_INFO_NAME diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h index 02140865f96a..32d8a47488b9 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h @@ -25,7 +25,7 @@ #include "env_validate.h" #if HOTENDS > 2 || E_STEPPERS > 2 - #error "MKS Robin Nano V3 supports up to 2 hotends / E-steppers." + #error "MKS Robin Nano V3 supports up to 2 hotends / E steppers." #elif HAS_FSMC_TFT #error "MKS Robin Nano V3 doesn't support FSMC-based TFT displays." #endif diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h index fde2682dc097..2ce06e356c39 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h @@ -25,7 +25,7 @@ #include "env_validate.h" #if HOTENDS > 2 || E_STEPPERS > 2 - #error "MKS Robin Nano V3 supports up to 1 hotends / E-steppers." + #error "MKS Robin Nano V3 supports up to 2 hotends / E steppers." #endif #define BOARD_INFO_NAME "MKS Robin PRO V2" diff --git a/Marlin/src/pins/stm32f4/pins_RUMBA32_common.h b/Marlin/src/pins/stm32f4/pins_RUMBA32_common.h index 873a4d4ad382..12871becbb40 100644 --- a/Marlin/src/pins/stm32f4/pins_RUMBA32_common.h +++ b/Marlin/src/pins/stm32f4/pins_RUMBA32_common.h @@ -28,7 +28,7 @@ #include "env_validate.h" #if HOTENDS > 3 || E_STEPPERS > 3 - #error "RUMBA32 boards support up to 3 hotends / E-steppers." + #error "RUMBA32 boards support up to 3 hotends / E steppers." #endif #define DEFAULT_MACHINE_NAME BOARD_INFO_NAME diff --git a/Marlin/src/pins/stm32f4/pins_VAKE403D.h b/Marlin/src/pins/stm32f4/pins_VAKE403D.h index 813944d3cb43..864a69d35093 100644 --- a/Marlin/src/pins/stm32f4/pins_VAKE403D.h +++ b/Marlin/src/pins/stm32f4/pins_VAKE403D.h @@ -25,7 +25,7 @@ #include "env_validate.h" #if HOTENDS > 2 || E_STEPPERS > 2 - #error "STM32F4 supports up to 2 hotends / E-steppers." + #error "STM32F4 VAkE supports up to 2 hotends / E steppers." #endif #define DEFAULT_MACHINE_NAME "STM32F446VET6" diff --git a/Marlin/src/pins/stm32f7/pins_REMRAM_V1.h b/Marlin/src/pins/stm32f7/pins_REMRAM_V1.h index 5bfc2551acfa..c4feba692fd8 100644 --- a/Marlin/src/pins/stm32f7/pins_REMRAM_V1.h +++ b/Marlin/src/pins/stm32f7/pins_REMRAM_V1.h @@ -33,7 +33,7 @@ #endif #if HAS_MULTI_HOTEND || E_STEPPERS > 1 - #error "RemRam only supports one hotend / E-stepper. Comment out this line to continue." + #error "RemRam only supports 1 hotend / E stepper." #endif // diff --git a/Marlin/src/pins/stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h b/Marlin/src/pins/stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h index 4fc3504ed1c9..769f10c8a48b 100644 --- a/Marlin/src/pins/stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h +++ b/Marlin/src/pins/stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h @@ -170,7 +170,9 @@ * All pins are labeled as printed on DWIN PCB. Connect TX-TX, A-A and so on. */ - #error "DWIN_CREALITY_LCD requires a custom cable, see diagram above this line. Comment out this line to continue." + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! DWIN_CREALITY_LCD requires a custom cable, see diagram above this line. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif #define BEEPER_PIN EXP1_09_PIN #define BTN_EN1 EXP1_03_PIN @@ -193,7 +195,9 @@ #elif ENABLED(ZONESTAR_LCD) // ANET A8 LCD Controller - Must convert to 3.3V - CONNECTING TO 5V WILL DAMAGE THE BOARD! - #error "CAUTION! ZONESTAR_LCD requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. Comment out this line to continue." + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! ZONESTAR_LCD requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif #define LCD_PINS_RS PB9 #define LCD_PINS_ENABLE EXP1_09_PIN @@ -221,7 +225,9 @@ #if ENABLED(TFTGLCD_PANEL_SPI) - #error "CAUTION! TFTGLCD_PANEL_SPI requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. Comment out this line to continue." + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! TFTGLCD_PANEL_SPI requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif /** * TFTGLCD_PANEL_SPI display pinout @@ -258,7 +264,9 @@ #elif ENABLED(FYSETC_MINI_12864_2_1) - #error "CAUTION! FYSETC_MINI_12864_2_1 and clones require wiring modifications. See 'pins_BTT_SKR_MINI_E3_V3_0.h' for details. Comment out this line to continue." + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! FYSETC_MINI_12864_2_1 and clones require wiring modifications. See 'pins_BTT_SKR_MINI_E3_V3_0.h' for details. Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning" + #endif /** * @@ -307,7 +315,9 @@ #if BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) - #error "CAUTION! LCD_FYSETC_TFT81050 requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. Comment out this line to continue." + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! LCD_FYSETC_TFT81050 requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif /** * FYSETC TFT TFT81050 display pinout From a93146b71d723e6cd0520fc0b0c75752d59d190f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 22 May 2022 16:53:12 -0500 Subject: [PATCH 087/241] =?UTF-8?q?=F0=9F=90=9B=20Fix=20SEGMENT=5FLEVELED?= =?UTF-8?q?=5FMOVES=20with=20UBL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Conditionals_LCD.h | 2 +- Marlin/src/module/motion.cpp | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index ba60e2481fcb..adb65f5f7d7d 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -1241,7 +1241,7 @@ */ #if ENABLED(AUTO_BED_LEVELING_UBL) #undef LCD_BED_LEVELING - #if ENABLED(DELTA) + #if EITHER(DELTA, SEGMENT_LEVELED_MOVES) #define UBL_SEGMENTED 1 #endif #endif diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index a824f56d9344..5d78df485915 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -960,8 +960,6 @@ void restore_feedrate_and_scaling() { #endif // !HAS_SOFTWARE_ENDSTOPS -#if !UBL_SEGMENTED - FORCE_INLINE void segment_idle(millis_t &next_idle_ms) { const millis_t ms = millis(); if (ELAPSED(ms, next_idle_ms)) { @@ -1078,7 +1076,7 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) { #else // !IS_KINEMATIC - #if ENABLED(SEGMENT_LEVELED_MOVES) + #if ENABLED(SEGMENT_LEVELED_MOVES) && DISABLED(AUTO_BED_LEVELING_UBL) /** * Prepare a segmented move on a CARTESIAN setup. @@ -1138,7 +1136,7 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) { planner.buffer_line(destination, fr_mm_s, active_extruder, cartesian_segment_mm OPTARG(SCARA_FEEDRATE_SCALING, inv_duration)); } - #endif // SEGMENT_LEVELED_MOVES + #endif // SEGMENT_LEVELED_MOVES && !AUTO_BED_LEVELING_UBL /** * Prepare a linear move in a Cartesian setup. @@ -1153,8 +1151,12 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) { #if HAS_MESH if (planner.leveling_active && planner.leveling_active_at_z(destination.z)) { #if ENABLED(AUTO_BED_LEVELING_UBL) - bedlevel.line_to_destination_cartesian(scaled_fr_mm_s, active_extruder); // UBL's motion routine needs to know about - return true; // all moves, including Z-only moves. + #if UBL_SEGMENTED + return bedlevel.line_to_destination_segmented(scaled_fr_mm_s); + #else + bedlevel.line_to_destination_cartesian(scaled_fr_mm_s, active_extruder); // UBL's motion routine needs to know about + return true; // all moves, including Z-only moves. + #endif #elif ENABLED(SEGMENT_LEVELED_MOVES) segmented_line_to_destination(scaled_fr_mm_s); return false; // caller will update current_position @@ -1180,7 +1182,6 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) { } #endif // !IS_KINEMATIC -#endif // !UBL_SEGMENTED #if HAS_DUPLICATION_MODE bool extruder_duplication_enabled; From 167672dcd760fcfa7124eecb77ccdbedd3d99948 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 22 May 2022 17:45:07 -0500 Subject: [PATCH 088/241] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20For?= =?UTF-8?q?ward-compatible=20axis=20strings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/serial.cpp | 15 ++++++++------ Marlin/src/core/serial.h | 40 +++++++++++++++++++++++++++----------- 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/Marlin/src/core/serial.cpp b/Marlin/src/core/serial.cpp index 140a031b7756..4dbf63c9bc12 100644 --- a/Marlin/src/core/serial.cpp +++ b/Marlin/src/core/serial.cpp @@ -30,12 +30,15 @@ uint8_t marlin_debug_flags = MARLIN_DEBUG_NONE; // Commonly-used strings in serial output -PGMSTR(NUL_STR, ""); PGMSTR(SP_P_STR, " P"); PGMSTR(SP_T_STR, " T"); -PGMSTR(SP_A_STR, " A"); PGMSTR(SP_B_STR, " B"); PGMSTR(SP_C_STR, " C"); -LOGICAL_AXIS_CODE(PGMSTR(SP_E_STR, " E"), PGMSTR(SP_X_STR, " X"), PGMSTR(SP_Y_STR, " Y"), PGMSTR(SP_Z_STR, " Z"), PGMSTR(SP_I_STR, " " STR_I), PGMSTR(SP_J_STR, " " STR_J), PGMSTR(SP_K_STR, " " STR_K), PGMSTR(SP_U_STR, " " STR_U), PGMSTR(SP_V_STR, " " STR_V), PGMSTR(SP_W_STR, " " STR_W)); -LOGICAL_AXIS_CODE(PGMSTR(SP_E_LBL, " E:"), PGMSTR(SP_X_LBL, " X:"), PGMSTR(SP_Y_LBL, " Y:"), PGMSTR(SP_Z_LBL, " Z:"), PGMSTR(SP_I_LBL, " " STR_I ":"), PGMSTR(SP_J_LBL, " " STR_J ":"), PGMSTR(SP_K_LBL, " " STR_K ":"), PGMSTR(SP_U_LBL, " " STR_U ":"), PGMSTR(SP_V_LBL, " " STR_V ":"), PGMSTR(SP_W_LBL, " " STR_W ":")); -LOGICAL_AXIS_CODE(PGMSTR(E_STR, "E"), PGMSTR(X_STR, "X"), PGMSTR(Y_STR, "Y"), PGMSTR(Z_STR, "Z"), PGMSTR(I_STR, STR_I), PGMSTR(J_STR, STR_J), PGMSTR(K_STR, STR_K), PGMSTR(U_STR, STR_U), PGMSTR(V_STR, STR_V), PGMSTR(W_STR, STR_W)); -LOGICAL_AXIS_CODE(PGMSTR(E_LBL, "E:"), PGMSTR(X_LBL, "X:"), PGMSTR(Y_LBL, "Y:"), PGMSTR(Z_LBL, "Z:"), PGMSTR(I_LBL, STR_I ":"), PGMSTR(J_LBL, STR_J ":"), PGMSTR(K_LBL, STR_K ":"), PGMSTR(U_LBL, STR_U ":"), PGMSTR(V_LBL, STR_V ":"), PGMSTR(W_LBL, STR_W ":")); +PGMSTR(SP_A_STR, " A"); PGMSTR(SP_B_STR, " B"); PGMSTR(SP_C_STR, " C"); +PGMSTR(SP_P_STR, " P"); PGMSTR(SP_T_STR, " T"); PGMSTR(NUL_STR, ""); + +#define _N_STR(N) PGMSTR(N##_STR, STR_##N); +#define _N_LBL(N) PGMSTR(N##_LBL, STR_##N ":"); +#define _SP_N_STR(N) PGMSTR(SP_##N##_STR, STR_##N ":"); +#define _SP_N_LBL(N) PGMSTR(SP_##N##_LBL, " " STR_##N ":"); +MAP(_N_STR, LOGICAL_AXIS_NAMES); MAP(_SP_N_STR, LOGICAL_AXIS_NAMES); +MAP(_N_LBL, LOGICAL_AXIS_NAMES); MAP(_SP_N_LBL, LOGICAL_AXIS_NAMES); // Hook Meatpack if it's enabled on the first leaf #if ENABLED(MEATPACK_ON_SERIAL_PORT_1) diff --git a/Marlin/src/core/serial.h b/Marlin/src/core/serial.h index 000e2060c532..c19bc087833d 100644 --- a/Marlin/src/core/serial.h +++ b/Marlin/src/core/serial.h @@ -28,17 +28,6 @@ #include "../feature/meatpack.h" #endif -// Commonly-used strings in serial output -extern const char NUL_STR[], SP_P_STR[], SP_T_STR[], - SP_A_STR[], SP_B_STR[], SP_C_STR[], - LOGICAL_AXIS_LIST(SP_E_STR[], SP_X_STR[], SP_Y_STR[], SP_Z_STR[], SP_I_STR[], SP_J_STR[], SP_K_STR[], SP_U_STR[], SP_V_STR[], SP_W_STR[]), - LOGICAL_AXIS_LIST(SP_E_LBL[], SP_X_LBL[], SP_Y_LBL[], SP_Z_LBL[], SP_I_LBL[], SP_J_LBL[], SP_K_LBL[], SP_U_LBL[], SP_V_LBL[], SP_W_LBL[]), - LOGICAL_AXIS_LIST(E_STR[], X_STR[], Y_STR[], Z_STR[], I_STR[], J_STR[], K_STR[], U_STR[], V_STR[], W_STR[]), - LOGICAL_AXIS_LIST(E_LBL[], X_LBL[], Y_LBL[], Z_LBL[], I_LBL[], J_LBL[], K_LBL[], U_LBL[], V_LBL[], W_LBL[]); - -PGM_P const SP_AXIS_LBL[] PROGMEM = LOGICAL_AXIS_ARRAY(SP_E_LBL, SP_X_LBL, SP_Y_LBL, SP_Z_LBL, SP_I_LBL, SP_J_LBL, SP_K_LBL, SP_U_LBL, SP_V_LBL, SP_W_LBL); -PGM_P const SP_AXIS_STR[] PROGMEM = LOGICAL_AXIS_ARRAY(SP_E_STR, SP_X_STR, SP_Y_STR, SP_Z_STR, SP_I_STR, SP_J_STR, SP_K_STR, SP_U_STR, SP_V_STR, SP_W_STR); - // // Debugging flags for use by M111 // @@ -354,3 +343,32 @@ inline void print_pos(const xyz_pos_t &xyz, FSTR_P const prefix=nullptr, FSTR_P #define SERIAL_POS(SUFFIX,VAR) do { print_pos(VAR, F(" " STRINGIFY(VAR) "="), F(" : " SUFFIX "\n")); }while(0) #define SERIAL_XYZ(PREFIX,V...) do { print_pos(V, F(PREFIX)); }while(0) + +// +// Commonly-used strings in serial output +// + +#define _N_STR(N) N##_STR +#define _N_LBL(N) N##_LBL +#define _N_STR_A(N) _N_STR(N)[] +#define _N_LBL_A(N) _N_LBL(N)[] +#define _SP_N_STR(N) SP_##N##_STR +#define _SP_N_LBL(N) SP_##N##_LBL +#define _SP_N_STR_A(N) _SP_N_STR(N)[] +#define _SP_N_LBL_A(N) _SP_N_LBL(N)[] + +extern const char SP_A_STR[], SP_B_STR[], SP_C_STR[], SP_P_STR[], SP_T_STR[], NUL_STR[], + MAPLIST(_N_STR_A, LOGICAL_AXIS_NAMES), MAPLIST(_SP_N_STR_A, LOGICAL_AXIS_NAMES), + MAPLIST(_N_LBL_A, LOGICAL_AXIS_NAMES), MAPLIST(_SP_N_LBL_A, LOGICAL_AXIS_NAMES); + +PGM_P const SP_AXIS_LBL[] PROGMEM = { MAPLIST(_SP_N_LBL, LOGICAL_AXIS_NAMES) }; +PGM_P const SP_AXIS_STR[] PROGMEM = { MAPLIST(_SP_N_STR, LOGICAL_AXIS_NAMES) }; + +#undef _N_STR +#undef _N_LBL +#undef _N_STR_A +#undef _N_LBL_A +#undef _SP_N_STR +#undef _SP_N_LBL +#undef _SP_N_STR_A +#undef _SP_N_LBL_A From c6b5bf7c00a949512317cb0d96909d3a0082bebd Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Sun, 22 May 2022 18:47:30 -0400 Subject: [PATCH 089/241] =?UTF-8?q?=F0=9F=9A=A8=20Fix=20build=20warnings?= =?UTF-8?q?=20on=20Lulzbot=20Taz=20(#24227)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/tune_menu.cpp | 4 ---- Marlin/src/pins/rambo/pins_EINSY_RETRO.h | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/tune_menu.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/tune_menu.cpp index 4fd060eb2e40..0370c4417478 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/tune_menu.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/tune_menu.cpp @@ -41,8 +41,6 @@ void TuneMenu::onRedraw(draw_mode_t what) { } #if ENABLED(TOUCH_UI_PORTRAIT) - #define GRID_COLS 2 - #define GRID_ROWS 9 #define TEMPERATURE_POS BTN_POS(1,1), BTN_SIZE(2,1) #define FIL_CHANGE_POS BTN_POS(1,2), BTN_SIZE(2,1) #define FILAMENT_POS BTN_POS(1,3), BTN_SIZE(2,1) @@ -54,8 +52,6 @@ void TuneMenu::onRedraw(draw_mode_t what) { #define ADVANCED_SETTINGS_POS BTN_POS(1,9), BTN_SIZE(1,1) #define BACK_POS BTN_POS(2,9), BTN_SIZE(1,1) #else - #define GRID_COLS 2 - #define GRID_ROWS 5 #define TEMPERATURE_POS BTN_POS(1,1), BTN_SIZE(1,1) #define NUDGE_NOZ_POS BTN_POS(2,1), BTN_SIZE(1,1) #define FIL_CHANGE_POS BTN_POS(1,2), BTN_SIZE(1,1) diff --git a/Marlin/src/pins/rambo/pins_EINSY_RETRO.h b/Marlin/src/pins/rambo/pins_EINSY_RETRO.h index 8bc0a90c0586..413eb8c98cc6 100644 --- a/Marlin/src/pins/rambo/pins_EINSY_RETRO.h +++ b/Marlin/src/pins/rambo/pins_EINSY_RETRO.h @@ -84,7 +84,7 @@ #endif #define Z_MAX_PIN 7 -#ifndef Z_MIN_PIN 7 +#ifndef Z_MIN_PIN #define Z_MIN_PIN 10 // Z- #endif From e88fabafc8b2650aba43f7c57ecff536d8351e4b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 22 May 2022 18:42:25 -0500 Subject: [PATCH 090/241] =?UTF-8?q?=F0=9F=94=A8=20Fix=20mfprep=20string=20?= =?UTF-8?q?test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/share/git/mfprep | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/buildroot/share/git/mfprep b/buildroot/share/git/mfprep index 7245126de156..6a8850286153 100755 --- a/buildroot/share/git/mfprep +++ b/buildroot/share/git/mfprep @@ -18,32 +18,33 @@ DRYRUN=0 TAG1=$1 TAG2=${2:-"HEAD"} +DEST=2.1.x + # Validate that the required tags exist MTAG=`git tag | grep -e "^bf-$TAG1\$"` -[[ -n $MTAG ]] || { echo "Can't find tag bf-$TAG1" ; exit 1 ; } +[[ -n "$MTAG" ]] || { echo "Can't find tag bf-$TAG1" ; exit 1 ; } MTAG=`git tag | grep -e "^$TAG1\$"` -[[ -n $MTAG ]] || { echo "Can't find tag $TAG1" ; exit 1 ; } +[[ -n "$MTAG" ]] || { echo "Can't find tag $TAG1" ; exit 1 ; } -# Generate log of recent commits for bugfix-2.0.x and 2.0.x +# Generate log of recent commits for bugfix-2.0.x and DEST TMPDIR=`mktemp -d` LOGB="$TMPDIR/log-bf.txt" -LOG2="$TMPDIR/log-20x.txt" +LOG2="$TMPDIR/log-2x.txt" TMPF="$TMPDIR/tmp.txt" -SCRF="$TMPDIR/update-20x.sh" +SCRF="$TMPDIR/update-$DEST.sh" git checkout bugfix-2.0.x git log --pretty="[%h] %s" bf-$TAG1..$TAG2 | grep -v '\[cron\]' | $SED '1!G;h;$!d' >"$LOGB" -git checkout 2.0.x +git checkout $DEST git log --pretty="[%h] %s" $TAG1..$TAG2 | $SED '1!G;h;$!d' >"$LOG2" || { echo "Can't find tag bf-$TAG1" ; exit 1 ; } -# Go through commit text from 2.0.x removing all matches from the bugfix log +# Go through commit text from DEST removing all matches from the bugfix log cat "$LOG2" | while read line; do - #echo "... $line" - if [[ $line =~ \(((#[0-9]{5}),* *)((#[0-9]{5}),* *)?((#[0-9]{5}),* *)?\)$ ]]; then + if [[ $line =~ \(((#[0-9]{5}),* *)((#[0-9]{5}),* *)?((#[0-9]{5}),* *)?((#[0-9]{5}),* *)?((#[0-9]{5}),* *)?((#[0-9]{5}),* *)?\)$ ]]; then PATT="" for i in ${!BASH_REMATCH[@]}; do if ((i > 0 && (i % 2 == 0))); then @@ -54,16 +55,16 @@ cat "$LOG2" | while read line; do fi done #echo "... $PATT" - [[ -n $PATT ]] && { grep -vE "$PATT" "$LOGB" >"$TMPF" ; cp "$TMPF" "$LOGB" ; } + [[ -n "$PATT" ]] && { grep -vE "$PATT" "$LOGB" >"$TMPF" ; cp "$TMPF" "$LOGB" ; } else PATT=$( $SED -E 's/^\[[0-9a-f]{10}\]( . )?(.+)$/\2/' <<<"$line" ) - [[ -n $PATT ]] && { grep -v "$PATT" "$LOGB" >"$TMPF" ; cp "$TMPF" "$LOGB" ; } + [[ -n "$PATT" ]] && { grep -v "$PATT" "$LOGB" >"$TMPF" ; cp "$TMPF" "$LOGB" ; } fi done # Convert remaining commits into git commands -echo -e "#!/usr/bin/env bash\nset -e\ngit checkout 2.0.x\n" >"$TMPF" +echo -e "#!/usr/bin/env bash\nset -e\ngit checkout ${DEST}\n" >"$TMPF" cat "$LOGB" | while read line; do if [[ $line =~ ^\[([0-9a-f]{10})\]\ *(.*)$ ]]; then CID=${BASH_REMATCH[1]} @@ -74,6 +75,6 @@ cat "$LOGB" | while read line; do fi done mv "$TMPF" "$SCRF" -chmod ug+x "$SCRF" +chmod +x "$SCRF" ((DRYRUN)) && rm -r "$TMPDIR" || open "$TMPDIR" From a5e1d4c50ae40c8203d8490be83ef86e16ebf1c2 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 22 May 2022 19:56:46 -0500 Subject: [PATCH 091/241] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Apply=20F()=20to?= =?UTF-8?q?=20more=20LCD=20code=20(#24228)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/multi_language.h | 1 + Marlin/src/lcd/HD44780/marlinui_HD44780.cpp | 40 +-- Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp | 49 ++-- Marlin/src/lcd/dogm/marlinui_DOGM.cpp | 32 +-- .../dogm/u8g_dev_tft_upscale_from_128x64.cpp | 12 +- Marlin/src/lcd/e3v2/common/dwin_api.h | 2 +- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 4 +- Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp | 8 +- Marlin/src/lcd/e3v2/marlinui/dwin_string.h | 13 +- Marlin/src/lcd/e3v2/marlinui/ui_common.cpp | 36 +-- .../bioprinter/advanced_settings.cpp | 2 +- Marlin/src/lcd/marlinui.cpp | 48 ++-- Marlin/src/lcd/marlinui.h | 6 +- Marlin/src/lcd/menu/menu.cpp | 20 +- Marlin/src/lcd/menu/menu.h | 56 ++-- Marlin/src/lcd/menu/menu_advanced.cpp | 4 +- Marlin/src/lcd/menu/menu_bed_corners.cpp | 18 +- Marlin/src/lcd/menu/menu_bed_leveling.cpp | 14 +- Marlin/src/lcd/menu/menu_cancelobject.cpp | 2 +- Marlin/src/lcd/menu/menu_configuration.cpp | 50 ++-- Marlin/src/lcd/menu/menu_delta_calibrate.cpp | 6 +- Marlin/src/lcd/menu/menu_filament.cpp | 104 ++++---- Marlin/src/lcd/menu/menu_info.cpp | 56 ++-- Marlin/src/lcd/menu/menu_item.h | 244 +++++++++--------- Marlin/src/lcd/menu/menu_language.cpp | 10 +- Marlin/src/lcd/menu/menu_main.cpp | 56 ++-- Marlin/src/lcd/menu/menu_media.cpp | 26 +- Marlin/src/lcd/menu/menu_mixer.cpp | 10 +- Marlin/src/lcd/menu/menu_motion.cpp | 106 ++++---- Marlin/src/lcd/menu/menu_password.cpp | 12 +- Marlin/src/lcd/menu/menu_probe_offset.cpp | 10 +- Marlin/src/lcd/menu/menu_spindle_laser.cpp | 2 +- Marlin/src/lcd/menu/menu_tmc.cpp | 8 +- Marlin/src/lcd/menu/menu_tramming.cpp | 2 +- Marlin/src/lcd/menu/menu_tune.cpp | 10 +- Marlin/src/lcd/menu/menu_ubl.cpp | 58 ++--- Marlin/src/lcd/menu/menu_x_twist.cpp | 18 +- Marlin/src/lcd/tft/tft_string.cpp | 8 +- Marlin/src/lcd/tft/tft_string.h | 12 +- Marlin/src/lcd/tft/touch.cpp | 18 +- Marlin/src/lcd/tft/ui_1024x600.cpp | 22 +- Marlin/src/lcd/tft/ui_320x240.cpp | 14 +- Marlin/src/lcd/tft/ui_480x320.cpp | 14 +- Marlin/src/lcd/tft/ui_common.cpp | 16 +- 44 files changed, 636 insertions(+), 623 deletions(-) diff --git a/Marlin/src/core/multi_language.h b/Marlin/src/core/multi_language.h index a605a6f02441..05a713e435de 100644 --- a/Marlin/src/core/multi_language.h +++ b/Marlin/src/core/multi_language.h @@ -45,6 +45,7 @@ typedef const char Language_Str[]; // Set unused languages equal to each other so the // compiler can optimize away the conditionals. +#define LCD_LANGUAGE_1 LCD_LANGUAGE #ifndef LCD_LANGUAGE_2 #define LCD_LANGUAGE_2 LCD_LANGUAGE #endif diff --git a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp index 6c6ff4737793..f70b5b01749f 100644 --- a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp +++ b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp @@ -410,7 +410,7 @@ void MarlinUI::clear_lcd() { lcd.clear(); } // Scroll the PSTR 'text' in a 'len' wide field for 'time' milliseconds at position col,line void lcd_scroll(const lcd_uint_t col, const lcd_uint_t line, FSTR_P const ftxt, const uint8_t len, const int16_t time) { - uint8_t slen = utf8_strlen_P(FTOP(ftxt)); + uint8_t slen = utf8_strlen(ftxt); if (slen < len) { lcd_put_u8str_max(col, line, ftxt, len); for (; slen < len; ++slen) lcd_put_wchar(' '); @@ -437,10 +437,10 @@ void MarlinUI::clear_lcd() { lcd.clear(); } } } - static void logo_lines(PGM_P const extra) { - int16_t indent = (LCD_WIDTH - 8 - utf8_strlen_P(extra)) / 2; + static void logo_lines(FSTR_P const extra) { + int16_t indent = (LCD_WIDTH - 8 - utf8_strlen(extra)) / 2; lcd_put_wchar(indent, 0, '\x00'); lcd_put_u8str(F( "------" )); lcd_put_wchar('\x01'); - lcd_put_u8str(indent, 1, F("|Marlin|")); lcd_put_u8str_P(extra); + lcd_put_u8str(indent, 1, F("|Marlin|")); lcd_put_u8str(extra); lcd_put_wchar(indent, 2, '\x02'); lcd_put_u8str(F( "------" )); lcd_put_wchar('\x03'); } @@ -468,7 +468,7 @@ void MarlinUI::clear_lcd() { lcd.clear(); } // // Show the Marlin logo, splash line1, and splash line 2 // - logo_lines(PSTR(" " SHORT_BUILD_VERSION)); + logo_lines(F(" " SHORT_BUILD_VERSION)); CENTER_OR_SCROLL(MARLIN_WEBSITE_URL, 2000); } else { @@ -476,7 +476,7 @@ void MarlinUI::clear_lcd() { lcd.clear(); } // Show the Marlin logo and short build version // After a delay show the website URL // - logo_lines(NUL_STR); + logo_lines(FPSTR(NUL_STR)); CENTER_OR_SCROLL(SHORT_BUILD_VERSION, 1500); CENTER_OR_SCROLL(MARLIN_WEBSITE_URL, 1500); #ifdef STRING_SPLASH_LINE3 @@ -1067,33 +1067,33 @@ void MarlinUI::draw_status_screen() { #endif // ADVANCED_PAUSE_FEATURE // Draw a static item with no left-right margin required. Centered by default. - void MenuItem_static::draw(const uint8_t row, PGM_P const pstr, const uint8_t style/*=SS_DEFAULT*/, const char * const vstr/*=nullptr*/) { + void MenuItem_static::draw(const uint8_t row, FSTR_P const fstr, const uint8_t style/*=SS_DEFAULT*/, const char * const vstr/*=nullptr*/) { int8_t n = LCD_WIDTH; lcd_moveto(0, row); - const int8_t plen = pstr ? utf8_strlen_P(pstr) : 0, + const int8_t plen = fstr ? utf8_strlen(fstr) : 0, vlen = vstr ? utf8_strlen(vstr) : 0; if (style & SS_CENTER) { int8_t pad = (LCD_WIDTH - plen - vlen) / 2; while (--pad >= 0) { lcd_put_wchar(' '); n--; } } - if (plen) n = lcd_put_u8str_ind_P(pstr, itemIndex, itemString, n); + if (plen) n = lcd_put_u8str_ind(fstr, itemIndex, itemString, n); if (vlen) n -= lcd_put_u8str_max(vstr, n); for (; n > 0; --n) lcd_put_wchar(' '); } // Draw a generic menu item with pre_char (if selected) and post_char - void MenuItemBase::_draw(const bool sel, const uint8_t row, PGM_P const pstr, const char pre_char, const char post_char) { + void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char pre_char, const char post_char) { lcd_put_wchar(0, row, sel ? pre_char : ' '); - uint8_t n = lcd_put_u8str_ind_P(pstr, itemIndex, itemString, LCD_WIDTH - 2); + uint8_t n = lcd_put_u8str_ind(fstr, itemIndex, itemString, LCD_WIDTH - 2); for (; n; --n) lcd_put_wchar(' '); lcd_put_wchar(post_char); } // Draw a menu item with a (potentially) editable value - void MenuEditItemBase::draw(const bool sel, const uint8_t row, PGM_P const pstr, const char * const inStr, const bool pgm) { + void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char * const inStr, const bool pgm) { const uint8_t vlen = inStr ? (pgm ? utf8_strlen_P(inStr) : utf8_strlen(inStr)) : 0; lcd_put_wchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' '); - uint8_t n = lcd_put_u8str_ind_P(pstr, itemIndex, itemString, LCD_WIDTH - 2 - vlen); + uint8_t n = lcd_put_u8str_ind(fstr, itemIndex, itemString, LCD_WIDTH - 2 - vlen); if (vlen) { lcd_put_wchar(':'); for (; n; --n) lcd_put_wchar(' '); @@ -1102,9 +1102,9 @@ void MarlinUI::draw_status_screen() { } // Low-level draw_edit_screen can be used to draw an edit screen from anyplace - void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char * const value/*=nullptr*/) { + void MenuEditItemBase::draw_edit_screen(FSTR_P const fstr, const char * const value/*=nullptr*/) { ui.encoder_direction_normal(); - uint8_t n = lcd_put_u8str_ind_P(0, 1, pstr, itemIndex, itemString, LCD_WIDTH - 1); + uint8_t n = lcd_put_u8str_ind(0, 1, fstr, itemIndex, itemString, LCD_WIDTH - 1); if (value) { lcd_put_wchar(':'); n--; const uint8_t len = utf8_strlen(value) + 1; // Plus one for a leading space @@ -1115,21 +1115,21 @@ void MarlinUI::draw_status_screen() { } // The Select Screen presents a prompt and two "buttons" - void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string/*=nullptr*/, PGM_P const suff/*=nullptr*/) { + void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, const bool yesno, FSTR_P const pref, const char * const string/*=nullptr*/, FSTR_P const suff/*=nullptr*/) { ui.draw_select_screen_prompt(pref, string, suff); if (no) { SETCURSOR(0, LCD_HEIGHT - 1); - lcd_put_wchar(yesno ? ' ' : '['); lcd_put_u8str_P(no); lcd_put_wchar(yesno ? ' ' : ']'); + lcd_put_wchar(yesno ? ' ' : '['); lcd_put_u8str(no); lcd_put_wchar(yesno ? ' ' : ']'); } if (yes) { - SETCURSOR_RJ(utf8_strlen_P(yes) + 2, LCD_HEIGHT - 1); - lcd_put_wchar(yesno ? '[' : ' '); lcd_put_u8str_P(yes); lcd_put_wchar(yesno ? ']' : ' '); + SETCURSOR_RJ(utf8_strlen(yes) + 2, LCD_HEIGHT - 1); + lcd_put_wchar(yesno ? '[' : ' '); lcd_put_u8str(yes); lcd_put_wchar(yesno ? ']' : ' '); } } #if ENABLED(SDSUPPORT) - void MenuItem_sdbase::draw(const bool sel, const uint8_t row, PGM_P const, CardReader &theCard, const bool isDir) { + void MenuItem_sdbase::draw(const bool sel, const uint8_t row, FSTR_P const, CardReader &theCard, const bool isDir) { lcd_put_wchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' '); constexpr uint8_t maxlen = LCD_WIDTH - 2; uint8_t n = maxlen - lcd_put_u8str_max(ui.scrolled_filename(theCard, maxlen, row, sel), maxlen); diff --git a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp index 5e418e2fe3fd..ca830960cb8f 100644 --- a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp +++ b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp @@ -380,13 +380,10 @@ void MarlinUI::clear_lcd() { void MarlinUI::_set_contrast() { lcd.setContrast(contrast); } #endif -static void center_text_P(PGM_P pstart, uint8_t y) { - uint8_t len = utf8_strlen_P(pstart); - if (len < LCD_WIDTH) - lcd.setCursor((LCD_WIDTH - len) / 2, y); - else - lcd.setCursor(0, y); - lcd_put_u8str_P(pstart); +static void center_text(FSTR_P const fstart, const uint8_t y) { + const uint8_t len = utf8_strlen(fstart); + lcd.setCursor(len < LCD_WIDTH ? (LCD_WIDTH - len) / 2 : 0, y); + lcd_put_u8str(fstart); } #if ENABLED(SHOW_BOOTSCREEN) @@ -402,8 +399,8 @@ static void center_text_P(PGM_P pstart, uint8_t y) { lcd.setCursor(indent, 0); lcd.write(TLC); lcd_put_u8str(F("------")); lcd.write(TRC); lcd.setCursor(indent, 1); lcd.write(LR); lcd_put_u8str(F("Marlin")); lcd.write(LR); lcd.setCursor(indent, 2); lcd.write(BLC); lcd_put_u8str(F("------")); lcd.write(BRC); - center_text_P(PSTR(SHORT_BUILD_VERSION), 3); - center_text_P(PSTR(MARLIN_WEBSITE_URL), 4); + center_text(F(SHORT_BUILD_VERSION), 3); + center_text(F(MARLIN_WEBSITE_URL), 4); picBits = ICON_LOGO; lcd.print_screen(); } @@ -420,8 +417,8 @@ void MarlinUI::draw_kill_screen() { lcd.setCursor(0, 3); lcd.write(COLOR_ERROR); lcd.setCursor((LCD_WIDTH - utf8_strlen(status_message)) / 2 + 1, 3); lcd_put_u8str(status_message); - center_text_P(GET_TEXT(MSG_HALTED), 5); - center_text_P(GET_TEXT(MSG_PLEASE_RESET), 6); + center_text(GET_TEXT_F(MSG_HALTED), 5); + center_text(GET_TEXT_F(MSG_PLEASE_RESET), 6); lcd.print_screen(); } @@ -940,38 +937,38 @@ void MarlinUI::draw_status_screen() { #endif // Draw a static item with no left-right margin required. Centered by default. - void MenuItem_static::draw(const uint8_t row, PGM_P const pstr, const uint8_t style/*=SS_DEFAULT*/, const char * const valstr/*=nullptr*/) { + void MenuItem_static::draw(const uint8_t row, FSTR_P const fstr, const uint8_t style/*=SS_DEFAULT*/, const char * const valstr/*=nullptr*/) { if (!PanelDetected) return; uint8_t n = LCD_WIDTH; lcd.setCursor(0, row); if ((style & SS_CENTER) && !valstr) { - int8_t pad = (LCD_WIDTH - utf8_strlen_P(pstr)) / 2; + int8_t pad = (LCD_WIDTH - utf8_strlen(fstr)) / 2; while (--pad >= 0) { lcd.write(' '); n--; } } - n = lcd_put_u8str_ind_P(pstr, itemIndex, itemString, n); + n = lcd_put_u8str_ind(fstr, itemIndex, itemString, n); if (valstr) n -= lcd_put_u8str_max(valstr, n); for (; n; --n) lcd.write(' '); lcd.print_line(); } // Draw a generic menu item with pre_char (if selected) and post_char - void MenuItemBase::_draw(const bool sel, const uint8_t row, PGM_P const pstr, const char pre_char, const char post_char) { + void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char pre_char, const char post_char) { if (!PanelDetected) return; lcd.setCursor(0, row); lcd.write(sel ? pre_char : ' '); - uint8_t n = lcd_put_u8str_ind_P(pstr, itemIndex, itemString, LCD_WIDTH - 2); + uint8_t n = lcd_put_u8str_ind(fstr, itemIndex, itemString, LCD_WIDTH - 2); for (; n; --n) lcd.write(' '); lcd.write(post_char); lcd.print_line(); } // Draw a menu item with a (potentially) editable value - void MenuEditItemBase::draw(const bool sel, const uint8_t row, PGM_P const pstr, const char * const data, const bool pgm) { + void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char * const data, const bool pgm) { if (!PanelDetected) return; const uint8_t vlen = data ? (pgm ? utf8_strlen_P(data) : utf8_strlen(data)) : 0; lcd.setCursor(0, row); lcd.write(sel ? LCD_STR_ARROW_RIGHT[0] : ' '); - uint8_t n = lcd_put_u8str_ind_P(pstr, itemIndex, itemString, LCD_WIDTH - 2 - vlen); + uint8_t n = lcd_put_u8str_ind(fstr, itemIndex, itemString, LCD_WIDTH - 2 - vlen); if (vlen) { lcd.write(':'); for (; n; --n) lcd.write(' '); @@ -982,13 +979,13 @@ void MarlinUI::draw_status_screen() { // Low-level draw_edit_screen can be used to draw an edit screen from anyplace // This line moves to the last line of the screen for UBL plot screen on the panel side - void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char * const value/*=nullptr*/) { + void MenuEditItemBase::draw_edit_screen(FSTR_P const fstr, const char * const value/*=nullptr*/) { if (!PanelDetected) return; ui.encoder_direction_normal(); const uint8_t y = TERN0(AUTO_BED_LEVELING_UBL, ui.external_control) ? LCD_HEIGHT - 1 : MIDDLE_Y; lcd.setCursor(0, y); lcd.write(COLOR_EDIT); - lcd_put_u8str_P(pstr); + lcd_put_u8str(fstr); if (value) { lcd.write(':'); lcd.setCursor((LCD_WIDTH - 1) - (utf8_strlen(value) + 1), y); // Right-justified, padded by spaces @@ -1000,24 +997,24 @@ void MarlinUI::draw_status_screen() { } // The Select Screen presents a prompt and two "buttons" - void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string, PGM_P const suff) { + void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, const bool yesno, FSTR_P const pref, const char * const string, FSTR_P const suff) { if (!PanelDetected) return; ui.draw_select_screen_prompt(pref, string, suff); lcd.write(COLOR_EDIT); if (no) { lcd.setCursor(0, MIDDLE_Y); - lcd.write(yesno ? ' ' : '['); lcd_put_u8str_P(no); lcd.write(yesno ? ' ' : ']'); + lcd.write(yesno ? ' ' : '['); lcd_put_u8str(no); lcd.write(yesno ? ' ' : ']'); } if (yes) { - lcd.setCursor(LCD_WIDTH - utf8_strlen_P(yes) - 3, MIDDLE_Y); - lcd.write(yesno ? '[' : ' '); lcd_put_u8str_P(yes); lcd.write(yesno ? ']' : ' '); + lcd.setCursor(LCD_WIDTH - utf8_strlen(yes) - 3, MIDDLE_Y); + lcd.write(yesno ? '[' : ' '); lcd_put_u8str(yes); lcd.write(yesno ? ']' : ' '); } lcd.print_line(); } #if ENABLED(SDSUPPORT) - void MenuItem_sdbase::draw(const bool sel, const uint8_t row, PGM_P const, CardReader &theCard, const bool isDir) { + void MenuItem_sdbase::draw(const bool sel, const uint8_t row, FSTR_P const, CardReader &theCard, const bool isDir) { if (!PanelDetected) return; lcd.setCursor(0, row); lcd.write(sel ? LCD_STR_ARROW_RIGHT[0] : ' '); @@ -1081,7 +1078,7 @@ void MarlinUI::draw_status_screen() { else lcd_put_u8str(F(" -----")); - center_text_P(GET_TEXT(MSG_UBL_FINE_TUNE_MESH), 8); + center_text(GET_TEXT_F(MSG_UBL_FINE_TUNE_MESH), 8); lcd.print_screen(); } diff --git a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp index eacd3d0afb74..3b40343628b0 100644 --- a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp +++ b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp @@ -412,28 +412,28 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop } // Draw a static line of text in the same idiom as a menu item - void MenuItem_static::draw(const uint8_t row, PGM_P const pstr, const uint8_t style/*=SS_DEFAULT*/, const char * const vstr/*=nullptr*/) { + void MenuItem_static::draw(const uint8_t row, FSTR_P const fstr, const uint8_t style/*=SS_DEFAULT*/, const char * const vstr/*=nullptr*/) { if (mark_as_selected(row, style & SS_INVERT)) { pixel_len_t n = LCD_PIXEL_WIDTH; // pixel width of string allowed - const int plen = pstr ? calculateWidth(pstr) : 0, + const int plen = fstr ? calculateWidth(FTOP(fstr)) : 0, vlen = vstr ? utf8_strlen(vstr) : 0; if (style & SS_CENTER) { int pad = (LCD_PIXEL_WIDTH - plen - vlen * MENU_FONT_WIDTH) / MENU_FONT_WIDTH / 2; while (--pad >= 0) n -= lcd_put_wchar(' '); } - if (plen) n = lcd_put_u8str_ind_P(pstr, itemIndex, itemString, n / (MENU_FONT_WIDTH)) * (MENU_FONT_WIDTH); + if (plen) n = lcd_put_u8str_ind(fstr, itemIndex, itemString, n / (MENU_FONT_WIDTH)) * (MENU_FONT_WIDTH); if (vlen) n -= lcd_put_u8str_max(vstr, n); while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' '); } } // Draw a generic menu item - void MenuItemBase::_draw(const bool sel, const uint8_t row, PGM_P const pstr, const char, const char post_char) { + void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char, const char post_char) { if (mark_as_selected(row, sel)) { - pixel_len_t n = lcd_put_u8str_ind_P(pstr, itemIndex, itemString, LCD_WIDTH - 1) * (MENU_FONT_WIDTH); + pixel_len_t n = lcd_put_u8str_ind(fstr, itemIndex, itemString, LCD_WIDTH - 1) * (MENU_FONT_WIDTH); while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' '); lcd_put_wchar(LCD_PIXEL_WIDTH - (MENU_FONT_WIDTH), row_y2, post_char); lcd_put_wchar(' '); @@ -441,13 +441,13 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop } // Draw a menu item with an editable value - void MenuEditItemBase::draw(const bool sel, const uint8_t row, PGM_P const pstr, const char * const inStr, const bool pgm) { + void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char * const inStr, const bool pgm) { if (mark_as_selected(row, sel)) { const uint8_t vallen = (pgm ? utf8_strlen_P(inStr) : utf8_strlen((char*)inStr)), pixelwidth = (pgm ? uxg_GetUtf8StrPixelWidthP(u8g.getU8g(), inStr) : uxg_GetUtf8StrPixelWidth(u8g.getU8g(), (char*)inStr)); const u8g_uint_t prop = USE_WIDE_GLYPH ? 2 : 1; - pixel_len_t n = lcd_put_u8str_ind_P(pstr, itemIndex, itemString, LCD_WIDTH - 2 - vallen * prop) * (MENU_FONT_WIDTH); + pixel_len_t n = lcd_put_u8str_ind(fstr, itemIndex, itemString, LCD_WIDTH - 2 - vallen * prop) * (MENU_FONT_WIDTH); if (vallen) { lcd_put_wchar(':'); while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' '); @@ -457,11 +457,11 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop } } - void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char * const value/*=nullptr*/) { + void MenuEditItemBase::draw_edit_screen(FSTR_P const fstr, const char * const value/*=nullptr*/) { ui.encoder_direction_normal(); const u8g_uint_t prop = USE_WIDE_GLYPH ? 2 : 1; - const u8g_uint_t labellen = utf8_strlen_P(pstr), vallen = utf8_strlen(value); + const u8g_uint_t labellen = utf8_strlen(fstr), vallen = utf8_strlen(value); bool extra_row = labellen * prop > LCD_WIDTH - 2 - vallen * prop; #if ENABLED(USE_BIG_EDIT_FONT) @@ -490,7 +490,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop // Assume the label is alpha-numeric (with a descender) bool onpage = PAGE_CONTAINS(baseline - (EDIT_FONT_ASCENT - 1), baseline + EDIT_FONT_DESCENT); - if (onpage) lcd_put_u8str_ind_P(0, baseline, pstr, itemIndex, itemString); + if (onpage) lcd_put_u8str_ind(0, baseline, fstr, itemIndex, itemString); // If a value is included, print a colon, then print the value right-justified if (value) { @@ -508,8 +508,8 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop TERN_(USE_BIG_EDIT_FONT, ui.set_font(FONT_MENU)); } - inline void draw_boxed_string(const u8g_uint_t x, const u8g_uint_t y, PGM_P const pstr, const bool inv) { - const u8g_uint_t len = utf8_strlen_P(pstr), + inline void draw_boxed_string(const u8g_uint_t x, const u8g_uint_t y, FSTR_P const fstr, const bool inv) { + const u8g_uint_t len = utf8_strlen(fstr), by = (y + 1) * (MENU_FONT_HEIGHT); const u8g_uint_t prop = USE_WIDE_GLYPH ? 2 : 1; const pixel_len_t bw = len * prop * (MENU_FONT_WIDTH), bx = x * prop * (MENU_FONT_WIDTH); @@ -518,19 +518,19 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop u8g.drawBox(bx / prop - 1, by - (MENU_FONT_ASCENT), bw + 2, MENU_FONT_HEIGHT); u8g.setColorIndex(0); } - lcd_put_u8str_P(bx / prop, by, pstr); + lcd_put_u8str(bx / prop, by, fstr); if (inv) u8g.setColorIndex(1); } - void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string/*=nullptr*/, PGM_P const suff/*=nullptr*/) { + void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, const bool yesno, FSTR_P const pref, const char * const string/*=nullptr*/, FSTR_P const suff/*=nullptr*/) { ui.draw_select_screen_prompt(pref, string, suff); if (no) draw_boxed_string(1, LCD_HEIGHT - 1, no, !yesno); - if (yes) draw_boxed_string(LCD_WIDTH - (utf8_strlen_P(yes) * (USE_WIDE_GLYPH ? 2 : 1) + 1), LCD_HEIGHT - 1, yes, yesno); + if (yes) draw_boxed_string(LCD_WIDTH - (utf8_strlen(yes) * (USE_WIDE_GLYPH ? 2 : 1) + 1), LCD_HEIGHT - 1, yes, yesno); } #if ENABLED(SDSUPPORT) - void MenuItem_sdbase::draw(const bool sel, const uint8_t row, PGM_P const, CardReader &theCard, const bool isDir) { + void MenuItem_sdbase::draw(const bool sel, const uint8_t row, FSTR_P const, CardReader &theCard, const bool isDir) { if (mark_as_selected(row, sel)) { const uint8_t maxlen = LCD_WIDTH - isDir; if (isDir) lcd_put_wchar(LCD_STR_FOLDER[0]); diff --git a/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp b/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp index 4a794f500007..f1bf9d032ec8 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp @@ -517,14 +517,14 @@ U8G_PB_DEV(u8g_dev_tft_320x240_upscale_from_128x64, WIDTH, HEIGHT, PAGE_HEIGHT, drawCross(x, y, TFT_MARLINBG_COLOR); } - const char *str = nullptr; + FSTR_P str = nullptr; if (calibration_stage < CALIBRATION_SUCCESS) { // handle current state switch (calibration_stage) { - case CALIBRATION_TOP_LEFT: str = GET_TEXT(MSG_TOP_LEFT); break; - case CALIBRATION_BOTTOM_LEFT: str = GET_TEXT(MSG_BOTTOM_LEFT); break; - case CALIBRATION_TOP_RIGHT: str = GET_TEXT(MSG_TOP_RIGHT); break; - case CALIBRATION_BOTTOM_RIGHT: str = GET_TEXT(MSG_BOTTOM_RIGHT); break; + case CALIBRATION_TOP_LEFT: str = GET_TEXT_F(MSG_TOP_LEFT); break; + case CALIBRATION_BOTTOM_LEFT: str = GET_TEXT_F(MSG_BOTTOM_LEFT); break; + case CALIBRATION_TOP_RIGHT: str = GET_TEXT_F(MSG_TOP_RIGHT); break; + case CALIBRATION_BOTTOM_RIGHT: str = GET_TEXT_F(MSG_BOTTOM_RIGHT); break; default: break; } @@ -534,7 +534,7 @@ U8G_PB_DEV(u8g_dev_tft_320x240_upscale_from_128x64, WIDTH, HEIGHT, PAGE_HEIGHT, } else { // end calibration - str = calibration_stage == CALIBRATION_SUCCESS ? GET_TEXT(MSG_CALIBRATION_COMPLETED) : GET_TEXT(MSG_CALIBRATION_FAILED); + str = calibration_stage == CALIBRATION_SUCCESS ? GET_TEXT_F(MSG_CALIBRATION_COMPLETED) : GET_TEXT_F(MSG_CALIBRATION_FAILED); defer_status_screen(false); touch_calibration.calibration_end(); TERN_(HAS_TOUCH_BUTTONS, redrawTouchButtons = true); diff --git a/Marlin/src/lcd/e3v2/common/dwin_api.h b/Marlin/src/lcd/e3v2/common/dwin_api.h index 37b1525ba34a..81724c6edf97 100644 --- a/Marlin/src/lcd/e3v2/common/dwin_api.h +++ b/Marlin/src/lcd/e3v2/common/dwin_api.h @@ -74,7 +74,7 @@ inline void DWIN_Text(size_t &i, const char * const string, uint16_t rlimit=0xFF inline void DWIN_Text(size_t &i, FSTR_P string, uint16_t rlimit=0xFFFF) { if (!string) return; - const size_t len = _MIN(sizeof(DWIN_SendBuf) - i, _MIN(rlimit, strlen_P((PGM_P)string))); // cast to PGM_P (const char*) measure with strlen_P. + const size_t len = _MIN(sizeof(DWIN_SendBuf) - i, _MIN(rlimit, strlen_P(FTOP(string)))); if (len == 0) return; memcpy_P(&DWIN_SendBuf[i+1], string, len); i += len; diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index e8d6abab0ca4..9fed9fee83d9 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -2944,7 +2944,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case LEVELING_VIEW: if (draw) - Draw_Menu_Item(row, ICON_Mesh, GET_TEXT(MSG_MESH_VIEW), nullptr, true); + Draw_Menu_Item(row, ICON_Mesh, GET_TEXT_F(MSG_MESH_VIEW), nullptr, true); else { #if ENABLED(AUTO_BED_LEVELING_UBL) if (bedlevel.storage_slot < 0) { @@ -3017,7 +3017,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case LEVELING_VIEW_MESH: if (draw) - Draw_Menu_Item(row, ICON_PrintSize, GET_TEXT(MSG_MESH_VIEW), nullptr, true); + Draw_Menu_Item(row, ICON_PrintSize, GET_TEXT_F(MSG_MESH_VIEW), nullptr, true); else Draw_Menu(MeshViewer); break; diff --git a/Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp b/Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp index e2d4d62c771e..52a0ff62fdcc 100644 --- a/Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp @@ -43,13 +43,13 @@ uint8_t read_byte(uint8_t *byte) { return *byte; } /** * Add a string, applying substitutions for the following characters: * - * $ displays the clipped C-string given by the itemString argument + * $ displays the clipped C-string given by the inStr argument * = displays '0'....'10' for indexes 0 - 10 * ~ displays '1'....'11' for indexes 0 - 10 * * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL) * @ displays an axis name such as XYZUVW, or E for an extruder */ -void DWIN_String::add(uint8_t *string, const int8_t index, uint8_t *itemString/*=nullptr*/) { +void DWIN_String::add(uint8_t *string, const int8_t index, uint8_t *inStr/*=nullptr*/) { wchar_t wchar; while (*string) { @@ -67,8 +67,8 @@ void DWIN_String::add(uint8_t *string, const int8_t index, uint8_t *itemString/* else add(index == -2 ? GET_TEXT(MSG_CHAMBER) : GET_TEXT(MSG_BED)); } - else if (ch == '$' && itemString) - add(itemString); + else if (ch == '$' && inStr) + add(inStr); else if (ch == '@') add_character(AXIS_CHAR(index)); else diff --git a/Marlin/src/lcd/e3v2/marlinui/dwin_string.h b/Marlin/src/lcd/e3v2/marlinui/dwin_string.h index 64676dddfdaf..d013d56a870e 100644 --- a/Marlin/src/lcd/e3v2/marlinui/dwin_string.h +++ b/Marlin/src/lcd/e3v2/marlinui/dwin_string.h @@ -61,15 +61,20 @@ class DWIN_String { //static void add(uint8_t character) { add_character(character); eol(); } static void add(wchar_t character); static void add(uint8_t *string, uint8_t max_len=MAX_STRING_LENGTH); - static void add(uint8_t *string, const int8_t index, uint8_t *itemString=nullptr); + static void add(uint8_t *string, const int8_t index, uint8_t *inStr=nullptr); static void set(uint8_t *string) { set(); add(string); } static void set(wchar_t character) { set(); add(character); } - static void set(uint8_t *string, int8_t index, const char *itemString=nullptr) { set(); add(string, index, (uint8_t *)itemString); } - static void set(FSTR_P fstring) { set((uint8_t *)fstring); } + static void set(uint8_t *string, int8_t index, const char *inStr=nullptr) { set(); add(string, index, (uint8_t *)inStr); } static void set(const char *string) { set((uint8_t *)string); } - static void set(const char *string, int8_t index, const char *itemString=nullptr) { set((uint8_t *)string, index, itemString); } + static void set(const char *string, int8_t index, const char *inStr=nullptr) { set((uint8_t *)string, index, inStr); } static void add(const char *string) { add((uint8_t *)string); } + static void add(FSTR_P const string, uint8_t max_len=MAX_STRING_LENGTH) { add((uint8_t *)FTOP(string), max_len); } + static void add(FSTR_P const string, int8_t index, uint8_t *inStr=nullptr) { add((uint8_t *)FTOP(string), index, inStr); } + static void set(FSTR_P const string) { set((uint8_t *)FTOP(string)); } + static void set(FSTR_P const string, int8_t index, const char *inStr=nullptr) { set((uint8_t *)FTOP(string), index, inStr); } + static void add(FSTR_P const string) { add((uint8_t *)FTOP(string)); } + static void trim(const uint8_t character=0x20); static void rtrim(const uint8_t character=0x20); static void ltrim(const uint8_t character=0x20); diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp index 9cc634c3064e..d124c5294640 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp @@ -311,7 +311,7 @@ void MarlinUI::draw_status_message(const bool blink) { // Draw a static line of text in the same idiom as a menu item - void MenuItem_static::draw(const uint8_t row, PGM_P const pstr, const uint8_t style/*=SS_DEFAULT*/, const char * const vstr/*=nullptr*/) { + void MenuItem_static::draw(const uint8_t row, FSTR_P const fstr, const uint8_t style/*=SS_DEFAULT*/, const char * const vstr/*=nullptr*/) { // Call mark_as_selected to draw a bigger selection box // and draw the text without a background if (mark_as_selected(row, (bool)(style & SS_INVERT), true)) { @@ -320,14 +320,14 @@ void MarlinUI::draw_status_message(const bool blink) { dwin_font.fg = Color_White; dwin_string.set(); - const int8_t plen = pstr ? utf8_strlen_P(pstr) : 0, + const int8_t plen = fstr ? utf8_strlen(fstr) : 0, vlen = vstr ? utf8_strlen(vstr) : 0; if (style & SS_CENTER) { int8_t pad = (LCD_WIDTH - 1 - plen - vlen) / 2; while (--pad) dwin_string.add(' '); } - if (plen) dwin_string.add((uint8_t*)pstr, itemIndex, (uint8_t*)itemString); + if (plen) dwin_string.add((uint8_t*)FTOP(fstr), itemIndex, (uint8_t*)FTOP(itemString)); if (vlen) dwin_string.add((uint8_t*)vstr); if (style & SS_CENTER) { int8_t pad = (LCD_WIDTH - 1 - plen - vlen) / 2; @@ -340,13 +340,13 @@ void MarlinUI::draw_status_message(const bool blink) { } // Draw a generic menu item - void MenuItemBase::_draw(const bool sel, const uint8_t row, PGM_P const pstr, const char, const char post_char) { + void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char, const char post_char) { if (mark_as_selected(row, sel)) { ui.set_font(DWIN_FONT_MENU); dwin_font.solid = false; dwin_font.fg = Color_White; - dwin_string.set(pstr, itemIndex, itemString); + dwin_string.set(fstr, itemIndex, FTOP(itemString)); pixel_len_t n = LCD_WIDTH - 1 - dwin_string.length(); while (--n > 1) dwin_string.add(' '); @@ -361,15 +361,15 @@ void MarlinUI::draw_status_message(const bool blink) { // // Draw a menu item with an editable value // - void MenuEditItemBase::draw(const bool sel, const uint8_t row, PGM_P const pstr, const char* const data, const bool pgm) { + void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char * const inStr, const bool pgm) { if (mark_as_selected(row, sel)) { ui.set_font(DWIN_FONT_MENU); dwin_font.solid = false; dwin_font.fg = Color_White; - const uint8_t vallen = (pgm ? utf8_strlen_P(data) : utf8_strlen(S(data))); + const uint8_t vallen = (pgm ? utf8_strlen_P(inStr) : utf8_strlen(S(inStr))); - dwin_string.set(pstr, itemIndex, itemString); + dwin_string.set(fstr, itemIndex, FTOP(itemString)); if (vallen) dwin_string.add(':'); lcd_moveto(1, row); @@ -377,7 +377,7 @@ void MarlinUI::draw_status_message(const bool blink) { if (vallen) { dwin_font.fg = Color_Yellow; - dwin_string.set(data); + dwin_string.set(inStr); lcd_moveto(LCD_WIDTH - vallen - 1, row); lcd_put_dwin_string(); } @@ -387,13 +387,13 @@ void MarlinUI::draw_status_message(const bool blink) { // // Draw an edit screen with label and current value // - void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char* const value/*=nullptr*/) { + void MenuEditItemBase::draw_edit_screen(FSTR_P const fstr, const char* const value/*=nullptr*/) { ui.encoder_direction_normal(); - const dwin_coord_t labellen = utf8_strlen_P(pstr), vallen = utf8_strlen(value); + const dwin_coord_t labellen = utf8_strlen(fstr), vallen = utf8_strlen(value); dwin_string.set(); - dwin_string.add((uint8_t*)pstr, itemIndex); + dwin_string.add((uint8_t*)FTOP(fstr), itemIndex); if (vallen) dwin_string.add(':'); // If a value is included, add a colon // Assume the label is alpha-numeric (with a descender) @@ -430,19 +430,19 @@ void MarlinUI::draw_status_message(const bool blink) { } } - inline void draw_boxed_string(const bool yesopt, PGM_P const pstr, const bool inv) { - const uint8_t len = utf8_strlen_P(pstr), + inline void draw_boxed_string(const bool yesopt, FSTR_P const fstr, const bool inv) { + const uint8_t len = utf8_strlen(fstr), mar = TERN(DWIN_MARLINUI_PORTRAIT, 1, 4), col = yesopt ? LCD_WIDTH - mar - len : mar, row = (LCD_HEIGHT >= 8 ? LCD_HEIGHT / 2 + 3 : LCD_HEIGHT - 1); lcd_moveto(col, row); DWIN_Draw_Box(1, inv ? Select_Color : Color_Bg_Black, cursor.x - dwin_font.width, cursor.y + 1, dwin_font.width * (len + 2), dwin_font.height + 2); - lcd_put_u8str_P(col, row, pstr); + lcd_put_u8str(col, row, fstr); } void MenuItem_confirm::draw_select_screen( - PGM_P const yes, PGM_P const no, const bool yesno, - PGM_P const pref, const char * const string/*=nullptr*/, PGM_P const suff/*=nullptr*/ + FSTR_P const yes, FSTR_P const no, const bool yesno, + FSTR_P const pref, const char * const string/*=nullptr*/, FSTR_P const suff/*=nullptr*/ ) { ui.set_font(DWIN_FONT_MENU); dwin_font.solid = false; @@ -454,7 +454,7 @@ void MarlinUI::draw_status_message(const bool blink) { #if ENABLED(SDSUPPORT) - void MenuItem_sdbase::draw(const bool sel, const uint8_t row, PGM_P const, CardReader &theCard, const bool isDir) { + void MenuItem_sdbase::draw(const bool sel, const uint8_t row, FSTR_P const, CardReader &theCard, const bool isDir) { if (mark_as_selected(row, sel)) { dwin_string.set(); diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/advanced_settings.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/advanced_settings.cpp index 6d42fd41e4dd..e9df264c1dd2 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/advanced_settings.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/advanced_settings.cpp @@ -64,7 +64,7 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) { .tag(13) .button(BTN_POS(1,7), BTN_SIZE(2,1), GET_TEXT_F(MSG_INTERFACE)) .tag(14) .button(BTN_POS(1,8), BTN_SIZE(2,1), GET_TEXT_F(MSG_RESTORE_DEFAULTS)) .colors(action_btn) - .tag(1). button( BTN_POS(1,9), BTN_SIZE(2,1), GET_TEXT_F(MSG_BUTTON_DONE)); + .tag(1) .button( BTN_POS(1,9), BTN_SIZE(2,1), GET_TEXT_F(MSG_BUTTON_DONE)); } } diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 675e22b11097..51620c9913bb 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -140,12 +140,12 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; preheat_t MarlinUI::material_preset[PREHEAT_COUNT]; // Initialized by settings.load() - PGM_P MarlinUI::get_preheat_label(const uint8_t m) { + FSTR_P MarlinUI::get_preheat_label(const uint8_t m) { #define _PDEF(N) static PGMSTR(preheat_##N##_label, PREHEAT_##N##_LABEL); #define _PLBL(N) preheat_##N##_label, REPEAT_1(PREHEAT_COUNT, _PDEF); static PGM_P const preheat_labels[PREHEAT_COUNT] PROGMEM = { REPEAT_1(PREHEAT_COUNT, _PLBL) }; - return (PGM_P)pgm_read_ptr(&preheat_labels[m]); + return FPSTR((PGM_P)pgm_read_ptr(&preheat_labels[m])); } void MarlinUI::apply_preheat(const uint8_t m, const uint8_t pmask, const uint8_t e/*=active_extruder*/) { @@ -454,20 +454,20 @@ void MarlinUI::init() { } } - void MarlinUI::draw_select_screen_prompt(PGM_P const pref, const char * const string/*=nullptr*/, PGM_P const suff/*=nullptr*/) { - const uint8_t plen = utf8_strlen_P(pref), slen = suff ? utf8_strlen_P(suff) : 0; + void MarlinUI::draw_select_screen_prompt(FSTR_P const pref, const char * const string/*=nullptr*/, FSTR_P const suff/*=nullptr*/) { + const uint8_t plen = utf8_strlen(pref), slen = suff ? utf8_strlen(suff) : 0; uint8_t col = 0, row = 0; if (!string && plen + slen <= LCD_WIDTH) { col = (LCD_WIDTH - plen - slen) / 2; row = LCD_HEIGHT > 3 ? 1 : 0; } if (LCD_HEIGHT >= 8) row = LCD_HEIGHT / 2 - 2; - wrap_string_P(col, row, pref, true); + wrap_string_P(col, row, FTOP(pref), true); if (string) { if (col) { col = 0; row++; } // Move to the start of the next line wrap_string(col, row, string); } - if (suff) wrap_string_P(col, row, suff); + if (suff) wrap_string_P(col, row, FTOP(suff)); } #endif // !HAS_GRAPHICAL_TFT @@ -484,17 +484,17 @@ void MarlinUI::init() { #if HAS_MARLINUI_MENU && !HAS_ADC_BUTTONS - void lcd_move_x(); - void lcd_move_y(); - void lcd_move_z(); - void _reprapworld_keypad_move(const AxisEnum axis, const int16_t dir) { ui.manual_move.menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP; ui.encoderPosition = dir; switch (axis) { - case X_AXIS: lcd_move_x(); break; - case Y_AXIS: lcd_move_y(); break; - case Z_AXIS: lcd_move_z(); + case X_AXIS: { void lcd_move_x(); lcd_move_x(); } break; + #if HAS_Y_AXIS + case Y_AXIS: { void lcd_move_y(); lcd_move_y(); } break; + #endif + #if HAS_Z_AXIS + case Z_AXIS: { void lcd_move_z(); lcd_move_z(); } break; + #endif default: break; } } @@ -1651,7 +1651,7 @@ void MarlinUI::init() { void MarlinUI::pause_print() { #if HAS_MARLINUI_MENU - synchronize(GET_TEXT(MSG_PAUSING)); + synchronize(GET_TEXT_F(MSG_PAUSING)); defer_status_screen(); #endif @@ -1855,12 +1855,12 @@ void MarlinUI::init() { #if DISABLED(EEPROM_AUTO_INIT) - static inline PGM_P eeprom_err(const uint8_t msgid) { + static inline FSTR_P eeprom_err(const uint8_t msgid) { switch (msgid) { default: - case 0: return GET_TEXT(MSG_ERR_EEPROM_CRC); - case 1: return GET_TEXT(MSG_ERR_EEPROM_INDEX); - case 2: return GET_TEXT(MSG_ERR_EEPROM_VERSION); + case 0: return GET_TEXT_F(MSG_ERR_EEPROM_CRC); + case 1: return GET_TEXT_F(MSG_ERR_EEPROM_INDEX); + case 2: return GET_TEXT_F(MSG_ERR_EEPROM_VERSION); } } @@ -1868,17 +1868,17 @@ void MarlinUI::init() { #if HAS_MARLINUI_MENU editable.uint8 = msgid; goto_screen([]{ - PGM_P const restore_msg = GET_TEXT(MSG_INIT_EEPROM); - char msg[utf8_strlen_P(restore_msg) + 1]; - strcpy_P(msg, restore_msg); + FSTR_P const restore_msg = GET_TEXT_F(MSG_INIT_EEPROM); + char msg[utf8_strlen(restore_msg) + 1]; + strcpy_P(msg, FTOP(restore_msg)); MenuItem_confirm::select_screen( - GET_TEXT(MSG_BUTTON_RESET), GET_TEXT(MSG_BUTTON_IGNORE), + GET_TEXT_F(MSG_BUTTON_RESET), GET_TEXT_F(MSG_BUTTON_IGNORE), init_eeprom, return_to_status, - eeprom_err(editable.uint8), msg, PSTR("?") + eeprom_err(editable.uint8), msg, F("?") ); }); #else - set_status(FPSTR(eeprom_err(msgid))); + set_status(eeprom_err(msgid)); #endif } diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index c27ced6fdd16..66e5e0c26181 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -520,7 +520,7 @@ class MarlinUI { #if HAS_PREHEAT enum PreheatTarget : uint8_t { PT_HOTEND, PT_BED, PT_FAN, PT_CHAMBER, PT_ALL = 0xFF }; static preheat_t material_preset[PREHEAT_COUNT]; - static PGM_P get_preheat_label(const uint8_t m); + static FSTR_P get_preheat_label(const uint8_t m); static void apply_preheat(const uint8_t m, const uint8_t pmask, const uint8_t e=active_extruder); static void preheat_set_fan(const uint8_t m) { TERN_(HAS_FAN, apply_preheat(m, _BV(PT_FAN))); } static void preheat_hotend(const uint8_t m, const uint8_t e=active_extruder) { TERN_(HAS_HOTEND, apply_preheat(m, _BV(PT_HOTEND))); } @@ -559,7 +559,7 @@ class MarlinUI { static void set_selection(const bool sel) { selection = sel; } static bool update_selection(); - static void synchronize(PGM_P const msg=nullptr); + static void synchronize(FSTR_P const msg=nullptr); static screenFunc_t currentScreen; static bool screen_changed; @@ -605,7 +605,7 @@ class MarlinUI { static float ubl_mesh_value(); #endif - static void draw_select_screen_prompt(PGM_P const pref, const char * const string=nullptr, PGM_P const suff=nullptr); + static void draw_select_screen_prompt(FSTR_P const pref, const char * const string=nullptr, FSTR_P const suff=nullptr); #else diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp index 2f075238e4a5..92be24aa0642 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -69,11 +69,11 @@ menuPosition screen_history[6]; uint8_t screen_history_depth = 0; int8_t MenuItemBase::itemIndex; // Index number for draw and action -PGM_P MenuItemBase::itemString; // A PSTR for substitution +FSTR_P MenuItemBase::itemString; // A string for substitution chimera_t editable; // Value Editing // Menu Edit Items -PGM_P MenuEditItemBase::editLabel; +FSTR_P MenuEditItemBase::editLabel; void* MenuEditItemBase::editValue; int32_t MenuEditItemBase::minEditValue, MenuEditItemBase::maxEditValue; @@ -134,7 +134,7 @@ void MenuEditItemBase::edit_screen(strfunc_t strfunc, loadfunc_t loadfunc) { // Going to an edit screen sets up some persistent values first void MenuEditItemBase::goto_edit_screen( - PGM_P const el, // Edit label + FSTR_P const el, // Edit label void * const ev, // Edit value pointer const int32_t minv, // Encoder minimum const int32_t maxv, // Encoder maximum @@ -232,8 +232,8 @@ void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, co // Display a "synchronize" screen with a custom message until // all moves are finished. Go back to calling screen when done. // -void MarlinUI::synchronize(PGM_P const msg/*=nullptr*/) { - static PGM_P sync_message = msg ?: GET_TEXT(MSG_MOVING); +void MarlinUI::synchronize(FSTR_P const fmsg/*=nullptr*/) { + static FSTR_P sync_message = fmsg ?: GET_TEXT_F(MSG_MOVING); push_current_screen(); goto_screen([]{ if (should_draw()) MenuItem_static::draw(LCD_HEIGHT >= 4, sync_message); @@ -319,12 +319,12 @@ void scroll_screen(const uint8_t limit, const bool is_menu) { } if (ui.should_draw()) { if (do_probe) { - MenuEditItemBase::draw_edit_screen(GET_TEXT(MSG_ZPROBE_ZOFFSET), BABYSTEP_TO_STR(probe.offset.z)); + MenuEditItemBase::draw_edit_screen(GET_TEXT_F(MSG_ZPROBE_ZOFFSET), BABYSTEP_TO_STR(probe.offset.z)); TERN_(BABYSTEP_ZPROBE_GFX_OVERLAY, ui.zoffset_overlay(probe.offset.z)); } else { #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) - MenuEditItemBase::draw_edit_screen(GET_TEXT(MSG_HOTEND_OFFSET_Z), ftostr54sign(hotend_offset[active_extruder].z)); + MenuEditItemBase::draw_edit_screen(GET_TEXT_F(MSG_HOTEND_OFFSET_Z), ftostr54sign(hotend_offset[active_extruder].z)); #endif } } @@ -335,7 +335,7 @@ void scroll_screen(const uint8_t limit, const bool is_menu) { void _lcd_draw_homing() { if (ui.should_draw()) { constexpr uint8_t line = (LCD_HEIGHT - 1) / 2; - MenuItem_static::draw(line, GET_TEXT(MSG_LEVEL_BED_HOMING)); + MenuItem_static::draw(line, GET_TEXT_F(MSG_LEVEL_BED_HOMING)); } } @@ -357,9 +357,9 @@ bool MarlinUI::update_selection() { } void MenuItem_confirm::select_screen( - PGM_P const yes, PGM_P const no, + FSTR_P const yes, FSTR_P const no, selectFunc_t yesFunc, selectFunc_t noFunc, - PGM_P const pref, const char * const string/*=nullptr*/, PGM_P const suff/*=nullptr*/ + FSTR_P const pref, const char * const string/*=nullptr*/, FSTR_P const suff/*=nullptr*/ ) { ui.defer_status_screen(); const bool ui_selection = !yes ? false : !no || ui.update_selection(), diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index 288dd5be2fed..fbee2c8501f4 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -54,72 +54,72 @@ class MenuItemBase { static int8_t itemIndex; // An optional pointer for use in display or by the action - static PGM_P itemString; + static FSTR_P itemString; // Store the index of the item ahead of use by indexed items - FORCE_INLINE static void init(const int8_t ind=0, PGM_P const pstr=nullptr) { itemIndex = ind; itemString = pstr; } + FORCE_INLINE static void init(const int8_t ind=0, FSTR_P const fstr=nullptr) { itemIndex = ind; itemString = fstr; } // Implementation-specific: // Draw an item either selected (pre_char) or not (space) with post_char // Menus may set up itemIndex, itemString and pass them to string-building or string-emitting functions - static void _draw(const bool sel, const uint8_t row, PGM_P const pstr, const char pre_char, const char post_char); + static void _draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char pre_char, const char post_char); // Draw an item either selected ('>') or not (space) with post_char - FORCE_INLINE static void _draw(const bool sel, const uint8_t row, PGM_P const pstr, const char post_char) { - _draw(sel, row, pstr, '>', post_char); + FORCE_INLINE static void _draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char post_char) { + _draw(sel, row, fstr, '>', post_char); } }; // STATIC_ITEM(LABEL,...) class MenuItem_static : public MenuItemBase { public: - static void draw(const uint8_t row, PGM_P const pstr, const uint8_t style=SS_DEFAULT, const char * const vstr=nullptr); + static void draw(const uint8_t row, FSTR_P const fstr, const uint8_t style=SS_DEFAULT, const char * const vstr=nullptr); }; // BACK_ITEM(LABEL) class MenuItem_back : public MenuItemBase { public: - FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr) { - _draw(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0]); + FORCE_INLINE static void draw(const bool sel, const uint8_t row, FSTR_P const fstr) { + _draw(sel, row, fstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0]); } // Back Item action goes back one step in history - FORCE_INLINE static void action(PGM_P const=nullptr) { ui.go_back(); } + FORCE_INLINE static void action(FSTR_P const=nullptr) { ui.go_back(); } }; // CONFIRM_ITEM(LABEL,Y,N,FY,FN,...), // YESNO_ITEM(LABEL,FY,FN,...) class MenuItem_confirm : public MenuItemBase { public: - FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr, ...) { - _draw(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0]); + FORCE_INLINE static void draw(const bool sel, const uint8_t row, FSTR_P const fstr, ...) { + _draw(sel, row, fstr, '>', LCD_STR_ARROW_RIGHT[0]); } // Implemented for HD44780 and DOGM // Draw the prompt, buttons, and state static void draw_select_screen( - PGM_P const yes, // Right option label - PGM_P const no, // Left option label + FSTR_P const yes, // Right option label + FSTR_P const no, // Left option label const bool yesno, // Is "yes" selected? - PGM_P const pref, // Prompt prefix + FSTR_P const pref, // Prompt prefix const char * const string, // Prompt runtime string - PGM_P const suff // Prompt suffix + FSTR_P const suff // Prompt suffix ); static void select_screen( - PGM_P const yes, PGM_P const no, + FSTR_P const yes, FSTR_P const no, selectFunc_t yesFunc, selectFunc_t noFunc, - PGM_P const pref, const char * const string=nullptr, PGM_P const suff=nullptr + FSTR_P const pref, const char * const string=nullptr, FSTR_P const suff=nullptr ); static void select_screen( - PGM_P const yes, PGM_P const no, + FSTR_P const yes, FSTR_P const no, selectFunc_t yesFunc, selectFunc_t noFunc, - PGM_P const pref, FSTR_P const string, PGM_P const suff=nullptr + FSTR_P const pref, FSTR_P const string, FSTR_P const suff=nullptr ) { char str[strlen_P(FTOP(string)) + 1]; strcpy_P(str, FTOP(string)); select_screen(yes, no, yesFunc, noFunc, pref, str, suff); } // Shortcut for prompt with "NO"/ "YES" labels - FORCE_INLINE static void confirm_screen(selectFunc_t yesFunc, selectFunc_t noFunc, PGM_P const pref, const char * const string=nullptr, PGM_P const suff=nullptr) { - select_screen(GET_TEXT(MSG_YES), GET_TEXT(MSG_NO), yesFunc, noFunc, pref, string, suff); + FORCE_INLINE static void confirm_screen(selectFunc_t yesFunc, selectFunc_t noFunc, FSTR_P const pref, const char * const string=nullptr, FSTR_P const suff=nullptr) { + select_screen(GET_TEXT_F(MSG_YES), GET_TEXT_F(MSG_NO), yesFunc, noFunc, pref, string, suff); } }; @@ -148,7 +148,7 @@ class MenuEditItemBase : public MenuItemBase { // The action() method acts like the instantiator. The entire lifespan // of a menu item is within its declaration, so all these values decompose // into behavior and unused items get optimized out. - static PGM_P editLabel; + static FSTR_P editLabel; static void *editValue; static int32_t minEditValue, maxEditValue; // Encoder value range static screenFunc_t callbackFunc; @@ -157,7 +157,7 @@ class MenuEditItemBase : public MenuItemBase { typedef const char* (*strfunc_t)(const int32_t); typedef void (*loadfunc_t)(void *, const int32_t); static void goto_edit_screen( - PGM_P const el, // Edit label + FSTR_P const el, // Edit label void * const ev, // Edit value pointer const int32_t minv, // Encoder minimum const int32_t maxv, // Encoder maximum @@ -170,11 +170,15 @@ class MenuEditItemBase : public MenuItemBase { public: // Implementation-specific: // Draw the current item at specified row with edit data - static void draw(const bool sel, const uint8_t row, PGM_P const pstr, const char * const inStr, const bool pgm=false); + static void draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char * const inStr, const bool pgm=false); + + static void draw(const bool sel, const uint8_t row, FSTR_P const fstr, FSTR_P const inStr) { + draw(sel, row, fstr, FTOP(inStr), true); + } // Implementation-specific: // This low-level method is good to draw from anywhere - static void draw_edit_screen(PGM_P const pstr, const char * const value); + static void draw_edit_screen(FSTR_P const fstr, const char * const value); // This method is for the current menu item static void draw_edit_screen(const char * const value) { draw_edit_screen(editLabel, value); } @@ -185,7 +189,7 @@ class MenuEditItemBase : public MenuItemBase { class MenuItem_sdbase { public: // Implemented for HD44780 and DOGM - static void draw(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir); + static void draw(const bool sel, const uint8_t row, FSTR_P const fstr, CardReader &theCard, const bool isDir); }; #endif diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index b8dc08a5f12a..d99627d5120d 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -83,7 +83,7 @@ void menu_backlash(); void menu_pwm() { START_MENU(); BACK_ITEM(MSG_ADVANCED_SETTINGS); - #define EDIT_CURRENT_PWM(LABEL,I) EDIT_ITEM_P(long5, PSTR(LABEL), &stepper.motor_current_setting[I], 100, 2000, stepper.refresh_motor_power) + #define EDIT_CURRENT_PWM(LABEL,I) EDIT_ITEM_F(long5, F(LABEL), &stepper.motor_current_setting[I], 100, 2000, stepper.refresh_motor_power) #if ANY_PIN(MOTOR_CURRENT_PWM_XY, MOTOR_CURRENT_PWM_X, MOTOR_CURRENT_PWM_Y) EDIT_CURRENT_PWM(STR_A STR_B, 0); #endif @@ -703,7 +703,7 @@ void menu_advanced_settings() { CONFIRM_ITEM(MSG_INIT_EEPROM, MSG_BUTTON_INIT, MSG_BUTTON_CANCEL, ui.init_eeprom, nullptr, - GET_TEXT(MSG_INIT_EEPROM), (const char *)nullptr, PSTR("?") + GET_TEXT_F(MSG_INIT_EEPROM), (const char *)nullptr, F("?") ); #endif diff --git a/Marlin/src/lcd/menu/menu_bed_corners.cpp b/Marlin/src/lcd/menu/menu_bed_corners.cpp index 163a2a751a34..b37e05f3a4b3 100644 --- a/Marlin/src/lcd/menu/menu_bed_corners.cpp +++ b/Marlin/src/lcd/menu/menu_bed_corners.cpp @@ -168,7 +168,7 @@ static void _lcd_level_bed_corners_get_next_position() { TERN_(HAS_MARLINUI_U8GLIB, ui.set_font(FONT_MENU)); // Set up the font for extra info - MenuItem_static::draw(0, GET_TEXT(MSG_PROBING_POINT), SS_INVERT); // "Probing Mesh" heading + MenuItem_static::draw(0, GET_TEXT_F(MSG_PROBING_POINT), SS_INVERT); // "Probing Mesh" heading uint8_t cy = TERN(TFT_COLOR_UI, 3, LCD_HEIGHT - 1), y = LCD_ROW_Y(cy); @@ -197,10 +197,10 @@ static void _lcd_level_bed_corners_get_next_position() { void _lcd_draw_raise() { if (!ui.should_draw()) return; MenuItem_confirm::select_screen( - GET_TEXT(MSG_BUTTON_DONE), GET_TEXT(MSG_BUTTON_SKIP) + GET_TEXT_F(MSG_BUTTON_DONE), GET_TEXT_F(MSG_BUTTON_SKIP) , []{ corner_probing_done = true; wait_for_probe = false; } , []{ wait_for_probe = false; } - , GET_TEXT(MSG_BED_TRAMMING_RAISE) + , GET_TEXT_F(MSG_BED_TRAMMING_RAISE) , (const char*)nullptr, NUL_STR ); } @@ -208,11 +208,11 @@ static void _lcd_level_bed_corners_get_next_position() { void _lcd_draw_level_prompt() { if (!ui.should_draw()) return; MenuItem_confirm::select_screen( - GET_TEXT(TERN(HAS_LEVELING, MSG_BUTTON_LEVEL, MSG_BUTTON_DONE)), - TERN(HAS_LEVELING, GET_TEXT(MSG_BUTTON_BACK), nullptr) + GET_TEXT_F(TERN(HAS_LEVELING, MSG_BUTTON_LEVEL, MSG_BUTTON_DONE)), + TERN(HAS_LEVELING, GET_TEXT_F(MSG_BUTTON_BACK), nullptr) , []{ queue.inject(TERN(HAS_LEVELING, F("G29N"), FPSTR(G28_STR))); ui.return_to_status(); } , TERN(HAS_LEVELING, ui.goto_previous_screen_no_defer, []{}) - , GET_TEXT(MSG_BED_TRAMMING_IN_RANGE) + , GET_TEXT_F(MSG_BED_TRAMMING_IN_RANGE) , (const char*)nullptr, NUL_STR ); } @@ -332,15 +332,15 @@ static void _lcd_level_bed_corners_homing() { bed_corner = 0; ui.goto_screen([]{ MenuItem_confirm::select_screen( - GET_TEXT(MSG_BUTTON_NEXT), GET_TEXT(MSG_BUTTON_DONE) + GET_TEXT_F(MSG_BUTTON_NEXT), GET_TEXT_F(MSG_BUTTON_DONE) , _lcd_goto_next_corner , []{ line_to_z(LEVEL_CORNERS_Z_HOP); // Raise Z off the bed when done TERN_(HAS_LEVELING, set_bed_leveling_enabled(leveling_was_active)); ui.goto_previous_screen_no_defer(); } - , GET_TEXT(TERN(LEVEL_CENTER_TOO, MSG_LEVEL_BED_NEXT_POINT, MSG_NEXT_CORNER)) - , (const char*)nullptr, PSTR("?") + , GET_TEXT_F(TERN(LEVEL_CENTER_TOO, MSG_LEVEL_BED_NEXT_POINT, MSG_NEXT_CORNER)) + , (const char*)nullptr, F("?") ); }); ui.set_selection(true); diff --git a/Marlin/src/lcd/menu/menu_bed_leveling.cpp b/Marlin/src/lcd/menu/menu_bed_leveling.cpp index 866f709b8e33..142da1696af8 100644 --- a/Marlin/src/lcd/menu/menu_bed_leveling.cpp +++ b/Marlin/src/lcd/menu/menu_bed_leveling.cpp @@ -71,12 +71,12 @@ #if Z_AFTER_PROBING > 0 && DISABLED(MESH_BED_LEVELING) // Display "Done" screen and wait for moves to complete line_to_z(Z_AFTER_PROBING); - ui.synchronize(GET_TEXT(MSG_LEVEL_BED_DONE)); + ui.synchronize(GET_TEXT_F(MSG_LEVEL_BED_DONE)); #endif ui.goto_previous_screen_no_defer(); ui.completion_feedback(); } - if (ui.should_draw()) MenuItem_static::draw(LCD_HEIGHT >= 4, GET_TEXT(MSG_LEVEL_BED_DONE)); + if (ui.should_draw()) MenuItem_static::draw(LCD_HEIGHT >= 4, GET_TEXT_F(MSG_LEVEL_BED_DONE)); ui.refresh(LCDVIEW_CALL_REDRAW_NEXT); } @@ -127,7 +127,7 @@ // if (ui.should_draw()) { const float v = current_position.z; - MenuEditItemBase::draw_edit_screen(GET_TEXT(MSG_MOVE_Z), ftostr43sign(v + (v < 0 ? -0.0001f : 0.0001f), '+')); + MenuEditItemBase::draw_edit_screen(GET_TEXT_F(MSG_MOVE_Z), ftostr43sign(v + (v < 0 ? -0.0001f : 0.0001f), '+')); } } @@ -138,7 +138,7 @@ if (ui.should_draw()) { char msg[10]; sprintf_P(msg, PSTR("%i / %u"), int(manual_probe_index + 1), total_probe_points); - MenuEditItemBase::draw_edit_screen(GET_TEXT(MSG_LEVEL_BED_NEXT_POINT), msg); + MenuEditItemBase::draw_edit_screen(GET_TEXT_F(MSG_LEVEL_BED_NEXT_POINT), msg); } ui.refresh(LCDVIEW_CALL_NO_REDRAW); if (!ui.wait_for_move) ui.goto_screen(_lcd_level_bed_get_z); @@ -165,7 +165,7 @@ // void _lcd_level_bed_homing_done() { if (ui.should_draw()) { - MenuItem_static::draw(1, GET_TEXT(MSG_LEVEL_BED_WAITING)); + MenuItem_static::draw(1, GET_TEXT_F(MSG_LEVEL_BED_WAITING)); // Color UI needs a control to detect a touch #if BOTH(TOUCH_SCREEN, HAS_GRAPHICAL_TFT) touch.add_control(CLICK, 0, 0, TFT_WIDTH, TFT_HEIGHT); @@ -243,7 +243,7 @@ void menu_bed_leveling() { // Auto Home if not using manual probing #if NONE(PROBE_MANUALLY, MESH_BED_LEVELING) - if (!is_homed) GCODES_ITEM(MSG_AUTO_HOME, G28_STR); + if (!is_homed) GCODES_ITEM(MSG_AUTO_HOME, FPSTR(G28_STR)); #endif // Level Bed @@ -252,7 +252,7 @@ void menu_bed_leveling() { SUBMENU(MSG_LEVEL_BED, _lcd_level_bed_continue); #else // Automatic leveling can just run the G-code - GCODES_ITEM(MSG_LEVEL_BED, is_homed ? PSTR("G29") : PSTR("G29N")); + GCODES_ITEM(MSG_LEVEL_BED, is_homed ? F("G29") : F("G29N")); #endif #if ENABLED(MESH_EDIT_MENU) diff --git a/Marlin/src/lcd/menu/menu_cancelobject.cpp b/Marlin/src/lcd/menu/menu_cancelobject.cpp index 8db698d300f2..b2d36bf8c30d 100644 --- a/Marlin/src/lcd/menu/menu_cancelobject.cpp +++ b/Marlin/src/lcd/menu/menu_cancelobject.cpp @@ -48,7 +48,7 @@ static void lcd_cancel_object_confirm() { ui.goto_previous_screen(); }, nullptr, - GET_TEXT(MSG_CANCEL_OBJECT), item_num, PSTR("?") + GET_TEXT_F(MSG_CANCEL_OBJECT), item_num, F("?") ); } diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp index d755706b1612..cb36f4bc98a2 100644 --- a/Marlin/src/lcd/menu/menu_configuration.cpp +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -78,7 +78,7 @@ void menu_advanced_settings(); bar_percent += (int8_t)ui.encoderPosition; LIMIT(bar_percent, 0, 100); ui.encoderPosition = 0; - MenuItem_static::draw(0, GET_TEXT(MSG_PROGRESS_BAR_TEST), SS_DEFAULT|SS_INVERT); + MenuItem_static::draw(0, GET_TEXT_F(MSG_PROGRESS_BAR_TEST), SS_DEFAULT|SS_INVERT); lcd_put_int((LCD_WIDTH) / 2 - 2, LCD_HEIGHT - 2, bar_percent); lcd_put_wchar('%'); lcd_moveto(0, LCD_HEIGHT - 1); ui.draw_progress_bar(bar_percent); } @@ -137,7 +137,7 @@ void menu_advanced_settings(); #include "../../gcode/queue.h" void menu_toolchange_migration() { - PGM_P const msg_migrate = GET_TEXT(MSG_TOOL_MIGRATION_SWAP); + FSTR_P const msg_migrate = GET_TEXT_F(MSG_TOOL_MIGRATION_SWAP); START_MENU(); BACK_ITEM(MSG_CONFIGURATION); @@ -149,7 +149,7 @@ void menu_advanced_settings(); // Migrate to a chosen extruder EXTRUDER_LOOP() { if (e != active_extruder) { - ACTION_ITEM_N_P(e, msg_migrate, []{ + ACTION_ITEM_N_F(e, msg_migrate, []{ char cmd[12]; sprintf_P(cmd, PSTR("M217 T%i"), int(MenuItemBase::itemIndex)); queue.inject(cmd); @@ -199,16 +199,16 @@ void menu_advanced_settings(); START_MENU(); BACK_ITEM(MSG_CONFIGURATION); - GCODES_ITEM(MSG_IDEX_MODE_AUTOPARK, PSTR("M605S1\nG28X\nG1X0")); + GCODES_ITEM(MSG_IDEX_MODE_AUTOPARK, F("M605S1\nG28X\nG1X0")); GCODES_ITEM(MSG_IDEX_MODE_DUPLICATE, need_g28 - ? PSTR("M605S1\nT0\nG28\nM605S2\nG28X\nG1X0") // If Y or Z is not homed, do a full G28 first - : PSTR("M605S1\nT0\nM605S2\nG28X\nG1X0") + ? F("M605S1\nT0\nG28\nM605S2\nG28X\nG1X0") // If Y or Z is not homed, do a full G28 first + : F("M605S1\nT0\nM605S2\nG28X\nG1X0") ); GCODES_ITEM(MSG_IDEX_MODE_MIRRORED_COPY, need_g28 - ? PSTR("M605S1\nT0\nG28\nM605S2\nG28X\nG1X0\nM605S3") // If Y or Z is not homed, do a full G28 first - : PSTR("M605S1\nT0\nM605S2\nG28 X\nG1X0\nM605S3") + ? F("M605S1\nT0\nG28\nM605S2\nG28X\nG1X0\nM605S3") // If Y or Z is not homed, do a full G28 first + : F("M605S1\nT0\nM605S2\nG28 X\nG1X0\nM605S3") ); - GCODES_ITEM(MSG_IDEX_MODE_FULL_CTRL, PSTR("M605S0\nG28X")); + GCODES_ITEM(MSG_IDEX_MODE_FULL_CTRL, F("M605S0\nG28X")); EDIT_ITEM(float42_52, MSG_IDEX_DUPE_GAP, &duplicate_extruder_x_offset, (X2_MIN_POS) - (X1_MIN_POS), (X_BED_SIZE) - 20); @@ -246,11 +246,11 @@ void menu_advanced_settings(); EDIT_ITEM(bool, MSG_BLTOUCH_SPEED_MODE, &bltouch.high_speed_mode); #endif #if ENABLED(BLTOUCH_LCD_VOLTAGE_MENU) - CONFIRM_ITEM(MSG_BLTOUCH_5V_MODE, MSG_BLTOUCH_5V_MODE, MSG_BUTTON_CANCEL, bltouch._set_5V_mode, nullptr, GET_TEXT(MSG_BLTOUCH_MODE_CHANGE)); - CONFIRM_ITEM(MSG_BLTOUCH_OD_MODE, MSG_BLTOUCH_OD_MODE, MSG_BUTTON_CANCEL, bltouch._set_OD_mode, nullptr, GET_TEXT(MSG_BLTOUCH_MODE_CHANGE)); + CONFIRM_ITEM(MSG_BLTOUCH_5V_MODE, MSG_BLTOUCH_5V_MODE, MSG_BUTTON_CANCEL, bltouch._set_5V_mode, nullptr, GET_TEXT_F(MSG_BLTOUCH_MODE_CHANGE)); + CONFIRM_ITEM(MSG_BLTOUCH_OD_MODE, MSG_BLTOUCH_OD_MODE, MSG_BUTTON_CANCEL, bltouch._set_OD_mode, nullptr, GET_TEXT_F(MSG_BLTOUCH_MODE_CHANGE)); ACTION_ITEM(MSG_BLTOUCH_MODE_STORE, bltouch._mode_store); - CONFIRM_ITEM(MSG_BLTOUCH_MODE_STORE_5V, MSG_BLTOUCH_MODE_STORE_5V, MSG_BUTTON_CANCEL, bltouch.mode_conv_5V, nullptr, GET_TEXT(MSG_BLTOUCH_MODE_CHANGE)); - CONFIRM_ITEM(MSG_BLTOUCH_MODE_STORE_OD, MSG_BLTOUCH_MODE_STORE_OD, MSG_BUTTON_CANCEL, bltouch.mode_conv_OD, nullptr, GET_TEXT(MSG_BLTOUCH_MODE_CHANGE)); + CONFIRM_ITEM(MSG_BLTOUCH_MODE_STORE_5V, MSG_BLTOUCH_MODE_STORE_5V, MSG_BUTTON_CANCEL, bltouch.mode_conv_5V, nullptr, GET_TEXT_F(MSG_BLTOUCH_MODE_CHANGE)); + CONFIRM_ITEM(MSG_BLTOUCH_MODE_STORE_OD, MSG_BLTOUCH_MODE_STORE_OD, MSG_BUTTON_CANCEL, bltouch.mode_conv_OD, nullptr, GET_TEXT_F(MSG_BLTOUCH_MODE_CHANGE)); ACTION_ITEM(MSG_BLTOUCH_MODE_ECHO, bltouch_report); #endif END_MENU(); @@ -264,10 +264,10 @@ void menu_advanced_settings(); ui.defer_status_screen(); START_MENU(); BACK_ITEM(MSG_CONFIGURATION); - GCODES_ITEM(MSG_TOUCHMI_INIT, PSTR("M851 Z0\nG28\nG1 F200 Z0")); + GCODES_ITEM(MSG_TOUCHMI_INIT, F("M851 Z0\nG28\nG1 F200 Z0")); SUBMENU(MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset); - GCODES_ITEM(MSG_TOUCHMI_SAVE, PSTR("M500\nG1 F200 Z10")); - GCODES_ITEM(MSG_TOUCHMI_ZTEST, PSTR("G28\nG1 F200 Z0")); + GCODES_ITEM(MSG_TOUCHMI_SAVE, F("M500\nG1 F200 Z10")); + GCODES_ITEM(MSG_TOUCHMI_ZTEST, F("G28\nG1 F200 Z0")); END_MENU(); } @@ -329,7 +329,7 @@ void menu_advanced_settings(); #define MAXTEMP_ALL _MAX(REPEAT(HOTENDS, _MAXTEMP_ITEM) 0) const uint8_t m = MenuItemBase::itemIndex; START_MENU(); - STATIC_ITEM_P(ui.get_preheat_label(m), SS_DEFAULT|SS_INVERT); + STATIC_ITEM_F(ui.get_preheat_label(m), SS_DEFAULT|SS_INVERT); BACK_ITEM(MSG_CONFIGURATION); #if HAS_FAN editable.uint8 = uint8_t(ui.material_preset[m].fan_speed); @@ -369,13 +369,13 @@ void menu_advanced_settings(); #define _DONE_SCRIPT "" #endif #define GCODE_LAMBDA_CONF(N) []{ _lcd_custom_menus_configuration_gcode(F(CONFIG_MENU_ITEM_##N##_GCODE _DONE_SCRIPT)); } - #define _CUSTOM_ITEM_CONF(N) ACTION_ITEM_P(PSTR(CONFIG_MENU_ITEM_##N##_DESC), GCODE_LAMBDA_CONF(N)); - #define _CUSTOM_ITEM_CONF_CONFIRM(N) \ - SUBMENU_P(PSTR(CONFIG_MENU_ITEM_##N##_DESC), []{ \ - MenuItem_confirm::confirm_screen( \ - GCODE_LAMBDA_CONF(N), nullptr, \ - PSTR(CONFIG_MENU_ITEM_##N##_DESC "?") \ - ); \ + #define _CUSTOM_ITEM_CONF(N) ACTION_ITEM_F(F(CONFIG_MENU_ITEM_##N##_DESC), GCODE_LAMBDA_CONF(N)); + #define _CUSTOM_ITEM_CONF_CONFIRM(N) \ + SUBMENU_F(F(CONFIG_MENU_ITEM_##N##_DESC), []{ \ + MenuItem_confirm::confirm_screen( \ + GCODE_LAMBDA_CONF(N), nullptr, \ + F(CONFIG_MENU_ITEM_##N##_DESC "?") \ + ); \ }) #define CUSTOM_ITEM_CONF(N) do{ \ @@ -483,7 +483,7 @@ void menu_configuration() { #if ENABLED(CUSTOM_MENU_CONFIG) if (TERN1(CUSTOM_MENU_CONFIG_ONLY_IDLE, !busy)) { #ifdef CUSTOM_MENU_CONFIG_TITLE - SUBMENU_P(PSTR(CUSTOM_MENU_CONFIG_TITLE), custom_menus_configuration); + SUBMENU_F(F(CUSTOM_MENU_CONFIG_TITLE), custom_menus_configuration); #else SUBMENU(MSG_CUSTOM_COMMANDS, custom_menus_configuration); #endif diff --git a/Marlin/src/lcd/menu/menu_delta_calibrate.cpp b/Marlin/src/lcd/menu/menu_delta_calibrate.cpp index f491c5b576ee..76d5677a806f 100644 --- a/Marlin/src/lcd/menu/menu_delta_calibrate.cpp +++ b/Marlin/src/lcd/menu/menu_delta_calibrate.cpp @@ -107,12 +107,12 @@ void lcd_delta_settings() { START_MENU(); BACK_ITEM(MSG_DELTA_CALIBRATE); EDIT_ITEM(float52sign, MSG_DELTA_HEIGHT, &delta_height, delta_height - 10, delta_height + 10, _recalc_delta_settings); - #define EDIT_ENDSTOP_ADJ(LABEL,N) EDIT_ITEM_P(float43, PSTR(LABEL), &delta_endstop_adj.N, -5, 0, _recalc_delta_settings) + #define EDIT_ENDSTOP_ADJ(LABEL,N) EDIT_ITEM_F(float43, F(LABEL), &delta_endstop_adj.N, -5, 0, _recalc_delta_settings) EDIT_ENDSTOP_ADJ("Ex", a); EDIT_ENDSTOP_ADJ("Ey", b); EDIT_ENDSTOP_ADJ("Ez", c); EDIT_ITEM(float52sign, MSG_DELTA_RADIUS, &delta_radius, delta_radius - 5, delta_radius + 5, _recalc_delta_settings); - #define EDIT_ANGLE_TRIM(LABEL,N) EDIT_ITEM_P(float43, PSTR(LABEL), &delta_tower_angle_trim.N, -5, 5, _recalc_delta_settings) + #define EDIT_ANGLE_TRIM(LABEL,N) EDIT_ITEM_F(float43, F(LABEL), &delta_tower_angle_trim.N, -5, 5, _recalc_delta_settings) EDIT_ANGLE_TRIM("Tx", a); EDIT_ANGLE_TRIM("Ty", b); EDIT_ANGLE_TRIM("Tz", c); @@ -129,7 +129,7 @@ void menu_delta_calibrate() { BACK_ITEM(MSG_MAIN); #if ENABLED(DELTA_AUTO_CALIBRATION) - GCODES_ITEM(MSG_DELTA_AUTO_CALIBRATE, PSTR("G33")); + GCODES_ITEM(MSG_DELTA_AUTO_CALIBRATE, F("G33")); #if ENABLED(EEPROM_SETTINGS) ACTION_ITEM(MSG_STORE_EEPROM, ui.store_settings); ACTION_ITEM(MSG_LOAD_EEPROM, ui.load_settings); diff --git a/Marlin/src/lcd/menu/menu_filament.cpp b/Marlin/src/lcd/menu/menu_filament.cpp index 03ac6e512cf8..5e4e11669695 100644 --- a/Marlin/src/lcd/menu/menu_filament.cpp +++ b/Marlin/src/lcd/menu/menu_filament.cpp @@ -45,22 +45,22 @@ static PauseMode _change_filament_mode; // = PAUSE_MODE_PAUSE_PRINT static int8_t _change_filament_extruder; // = 0 -inline PGM_P _change_filament_command() { +inline FSTR_P _change_filament_command() { switch (_change_filament_mode) { - case PAUSE_MODE_LOAD_FILAMENT: return PSTR("M701 T%d"); + case PAUSE_MODE_LOAD_FILAMENT: return F("M701 T%d"); case PAUSE_MODE_UNLOAD_FILAMENT: return _change_filament_extruder >= 0 - ? PSTR("M702 T%d") : PSTR("M702 ;%d"); + ? F("M702 T%d") : F("M702 ;%d"); case PAUSE_MODE_CHANGE_FILAMENT: case PAUSE_MODE_PAUSE_PRINT: default: break; } - return PSTR("M600 B0 T%d"); + return F("M600 B0 T%d"); } // Initiate Filament Load/Unload/Change at the specified temperature static void _change_filament_with_temp(const uint16_t celsius) { char cmd[11]; - sprintf_P(cmd, _change_filament_command(), _change_filament_extruder); + sprintf_P(cmd, FTOP(_change_filament_command()), _change_filament_extruder); thermalManager.setTargetHotend(celsius, _change_filament_extruder); queue.inject(cmd); } @@ -77,13 +77,13 @@ static void _change_filament_with_custom() { // Menu to choose the temperature and start Filament Change // -inline PGM_P change_filament_header(const PauseMode mode) { +inline FSTR_P change_filament_header(const PauseMode mode) { switch (mode) { - case PAUSE_MODE_LOAD_FILAMENT: return GET_TEXT(MSG_FILAMENTLOAD); - case PAUSE_MODE_UNLOAD_FILAMENT: return GET_TEXT(MSG_FILAMENTUNLOAD); + case PAUSE_MODE_LOAD_FILAMENT: return GET_TEXT_F(MSG_FILAMENTLOAD); + case PAUSE_MODE_UNLOAD_FILAMENT: return GET_TEXT_F(MSG_FILAMENTUNLOAD); default: break; } - return GET_TEXT(MSG_FILAMENTCHANGE); + return GET_TEXT_F(MSG_FILAMENTCHANGE); } void _menu_temp_filament_op(const PauseMode mode, const int8_t extruder) { @@ -91,7 +91,7 @@ void _menu_temp_filament_op(const PauseMode mode, const int8_t extruder) { _change_filament_extruder = extruder; const int8_t old_index = MenuItemBase::itemIndex; START_MENU(); - if (LCD_HEIGHT >= 4) STATIC_ITEM_P(change_filament_header(mode), SS_DEFAULT|SS_INVERT); + if (LCD_HEIGHT >= 4) STATIC_ITEM_F(change_filament_header(mode), SS_DEFAULT|SS_INVERT); BACK_ITEM(MSG_BACK); #if HAS_PREHEAT LOOP_L_N(m, PREHEAT_COUNT) @@ -132,18 +132,18 @@ void menu_change_filament() { // Change filament #if E_STEPPERS == 1 - PGM_P const msg = GET_TEXT(MSG_FILAMENTCHANGE); + FSTR_P const msg = GET_TEXT_F(MSG_FILAMENTCHANGE); if (thermalManager.targetTooColdToExtrude(active_extruder)) - SUBMENU_P(msg, []{ _menu_temp_filament_op(PAUSE_MODE_CHANGE_FILAMENT, 0); }); + SUBMENU_F(msg, []{ _menu_temp_filament_op(PAUSE_MODE_CHANGE_FILAMENT, 0); }); else - GCODES_ITEM_P(msg, PSTR("M600 B0")); + GCODES_ITEM_F(msg, F("M600 B0")); #else - PGM_P const msg = GET_TEXT(MSG_FILAMENTCHANGE_E); + FSTR_P const msg = GET_TEXT_F(MSG_FILAMENTCHANGE_E); LOOP_L_N(s, E_STEPPERS) { if (thermalManager.targetTooColdToExtrude(s)) - SUBMENU_N_P(s, msg, []{ _menu_temp_filament_op(PAUSE_MODE_CHANGE_FILAMENT, MenuItemBase::itemIndex); }); + SUBMENU_N_F(s, msg, []{ _menu_temp_filament_op(PAUSE_MODE_CHANGE_FILAMENT, MenuItemBase::itemIndex); }); else { - ACTION_ITEM_N_P(s, msg, []{ + ACTION_ITEM_N_F(s, msg, []{ PGM_P const cmdpstr = PSTR("M600 B0 T%i"); char cmd[strlen_P(cmdpstr) + 3 + 1]; sprintf_P(cmd, cmdpstr, int(MenuItemBase::itemIndex)); @@ -157,18 +157,18 @@ void menu_change_filament() { if (!is_busy) { // Load filament #if E_STEPPERS == 1 - PGM_P const msg_load = GET_TEXT(MSG_FILAMENTLOAD); + FSTR_P const msg_load = GET_TEXT_F(MSG_FILAMENTLOAD); if (thermalManager.targetTooColdToExtrude(active_extruder)) - SUBMENU_P(msg_load, []{ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 0); }); + SUBMENU_F(msg_load, []{ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 0); }); else - GCODES_ITEM_P(msg_load, PSTR("M701")); + GCODES_ITEM_F(msg_load, F("M701")); #else - PGM_P const msg_load = GET_TEXT(MSG_FILAMENTLOAD_E); + FSTR_P const msg_load = GET_TEXT_F(MSG_FILAMENTLOAD_E); LOOP_L_N(s, E_STEPPERS) { if (thermalManager.targetTooColdToExtrude(s)) - SUBMENU_N_P(s, msg_load, []{ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, MenuItemBase::itemIndex); }); + SUBMENU_N_F(s, msg_load, []{ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, MenuItemBase::itemIndex); }); else { - ACTION_ITEM_N_P(s, msg_load, []{ + ACTION_ITEM_N_F(s, msg_load, []{ char cmd[12]; sprintf_P(cmd, PSTR("M701 T%i"), int(MenuItemBase::itemIndex)); queue.inject(cmd); @@ -179,24 +179,24 @@ void menu_change_filament() { // Unload filament #if E_STEPPERS == 1 - PGM_P const msg_unload = GET_TEXT(MSG_FILAMENTUNLOAD); + FSTR_P const msg_unload = GET_TEXT_F(MSG_FILAMENTUNLOAD); if (thermalManager.targetTooColdToExtrude(active_extruder)) - SUBMENU_P(msg_unload, []{ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 0); }); + SUBMENU_F(msg_unload, []{ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 0); }); else - GCODES_ITEM_P(msg_unload, PSTR("M702")); + GCODES_ITEM_F(msg_unload, F("M702")); #else #if ENABLED(FILAMENT_UNLOAD_ALL_EXTRUDERS) if (too_cold) SUBMENU(MSG_FILAMENTUNLOAD_ALL, []{ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, -1); }); else - GCODES_ITEM(MSG_FILAMENTUNLOAD_ALL, PSTR("M702")); + GCODES_ITEM(MSG_FILAMENTUNLOAD_ALL, F("M702")); #endif - PGM_P const msg_unload = GET_TEXT(MSG_FILAMENTUNLOAD_E); + FSTR_P const msg_unload = GET_TEXT_F(MSG_FILAMENTUNLOAD_E); LOOP_L_N(s, E_STEPPERS) { if (thermalManager.targetTooColdToExtrude(s)) - SUBMENU_N_P(s, msg_unload, []{ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, MenuItemBase::itemIndex); }); + SUBMENU_N_F(s, msg_unload, []{ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, MenuItemBase::itemIndex); }); else { - ACTION_ITEM_N_P(s, msg_unload, []{ + ACTION_ITEM_N_F(s, msg_unload, []{ char cmd[12]; sprintf_P(cmd, PSTR("M702 T%i"), int(MenuItemBase::itemIndex)); queue.inject(cmd); @@ -221,21 +221,21 @@ void menu_change_filament() { static uint8_t hotend_status_extruder = 0; -static PGM_P pause_header() { +static FSTR_P pause_header() { switch (pause_mode) { - case PAUSE_MODE_CHANGE_FILAMENT: return GET_TEXT(MSG_FILAMENT_CHANGE_HEADER); - case PAUSE_MODE_LOAD_FILAMENT: return GET_TEXT(MSG_FILAMENT_CHANGE_HEADER_LOAD); - case PAUSE_MODE_UNLOAD_FILAMENT: return GET_TEXT(MSG_FILAMENT_CHANGE_HEADER_UNLOAD); + case PAUSE_MODE_CHANGE_FILAMENT: return GET_TEXT_F(MSG_FILAMENT_CHANGE_HEADER); + case PAUSE_MODE_LOAD_FILAMENT: return GET_TEXT_F(MSG_FILAMENT_CHANGE_HEADER_LOAD); + case PAUSE_MODE_UNLOAD_FILAMENT: return GET_TEXT_F(MSG_FILAMENT_CHANGE_HEADER_UNLOAD); default: break; } - return GET_TEXT(MSG_FILAMENT_CHANGE_HEADER_PAUSE); + return GET_TEXT_F(MSG_FILAMENT_CHANGE_HEADER_PAUSE); } // Portions from STATIC_ITEM... #define HOTEND_STATUS_ITEM() do { \ if (_menuLineNr == _thisItemNr) { \ if (ui.should_draw()) { \ - IF_DISABLED(HAS_GRAPHICAL_TFT, MenuItem_static::draw(_lcdLineNr, GET_TEXT(MSG_FILAMENT_CHANGE_NOZZLE), SS_INVERT)); \ + IF_DISABLED(HAS_GRAPHICAL_TFT, MenuItem_static::draw(_lcdLineNr, GET_TEXT_F(MSG_FILAMENT_CHANGE_NOZZLE), SS_INVERT)); \ ui.draw_hotend_status(_lcdLineNr, hotend_status_extruder); \ } \ if (_skipStatic && encoderLine <= _thisItemNr) { \ @@ -273,39 +273,39 @@ void menu_pause_option() { // // Warning: msg must have three null bytes to delimit lines! // -void _lcd_pause_message(PGM_P const msg) { - PGM_P const msg1 = msg; +void _lcd_pause_message(FSTR_P const msg) { + PGM_P const msg1 = FTOP(msg); PGM_P const msg2 = msg1 + strlen_P(msg1) + 1; PGM_P const msg3 = msg2 + strlen_P(msg2) + 1; const bool has2 = msg2[0], has3 = msg3[0], skip1 = !has2 && (LCD_HEIGHT) >= 5; START_SCREEN(); - STATIC_ITEM_P(pause_header(), SS_DEFAULT|SS_INVERT); // 1: Header + STATIC_ITEM_F(pause_header(), SS_DEFAULT|SS_INVERT); // 1: Header if (skip1) SKIP_ITEM(); // Move a single-line message down - STATIC_ITEM_P(msg1); // 2: Message Line 1 - if (has2) STATIC_ITEM_P(msg2); // 3: Message Line 2 - if (has3 && (LCD_HEIGHT) >= 5) STATIC_ITEM_P(msg3); // 4: Message Line 3 (if LCD has 5 lines) + STATIC_ITEM_F(FPSTR(msg1)); // 2: Message Line 1 + if (has2) STATIC_ITEM_F(FPSTR(msg2)); // 3: Message Line 2 + if (has3 && (LCD_HEIGHT) >= 5) STATIC_ITEM_F(FPSTR(msg3)); // 4: Message Line 3 (if LCD has 5 lines) if (skip1 + 1 + has2 + has3 < (LCD_HEIGHT) - 2) SKIP_ITEM(); // Push Hotend Status down, if needed HOTEND_STATUS_ITEM(); // 5: Hotend Status END_SCREEN(); } -void lcd_pause_parking_message() { _lcd_pause_message(GET_TEXT(MSG_PAUSE_PRINT_PARKING)); } -void lcd_pause_changing_message() { _lcd_pause_message(GET_TEXT(MSG_FILAMENT_CHANGE_INIT)); } -void lcd_pause_unload_message() { _lcd_pause_message(GET_TEXT(MSG_FILAMENT_CHANGE_UNLOAD)); } -void lcd_pause_heating_message() { _lcd_pause_message(GET_TEXT(MSG_FILAMENT_CHANGE_HEATING)); } -void lcd_pause_heat_message() { _lcd_pause_message(GET_TEXT(MSG_FILAMENT_CHANGE_HEAT)); } -void lcd_pause_insert_message() { _lcd_pause_message(GET_TEXT(MSG_FILAMENT_CHANGE_INSERT)); } -void lcd_pause_load_message() { _lcd_pause_message(GET_TEXT(MSG_FILAMENT_CHANGE_LOAD)); } -void lcd_pause_waiting_message() { _lcd_pause_message(GET_TEXT(MSG_ADVANCED_PAUSE_WAITING)); } -void lcd_pause_resume_message() { _lcd_pause_message(GET_TEXT(MSG_FILAMENT_CHANGE_RESUME)); } +void lcd_pause_parking_message() { _lcd_pause_message(GET_TEXT_F(MSG_PAUSE_PRINT_PARKING)); } +void lcd_pause_changing_message() { _lcd_pause_message(GET_TEXT_F(MSG_FILAMENT_CHANGE_INIT)); } +void lcd_pause_unload_message() { _lcd_pause_message(GET_TEXT_F(MSG_FILAMENT_CHANGE_UNLOAD)); } +void lcd_pause_heating_message() { _lcd_pause_message(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEATING)); } +void lcd_pause_heat_message() { _lcd_pause_message(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEAT)); } +void lcd_pause_insert_message() { _lcd_pause_message(GET_TEXT_F(MSG_FILAMENT_CHANGE_INSERT)); } +void lcd_pause_load_message() { _lcd_pause_message(GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD)); } +void lcd_pause_waiting_message() { _lcd_pause_message(GET_TEXT_F(MSG_ADVANCED_PAUSE_WAITING)); } +void lcd_pause_resume_message() { _lcd_pause_message(GET_TEXT_F(MSG_FILAMENT_CHANGE_RESUME)); } void lcd_pause_purge_message() { #if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE) - _lcd_pause_message(GET_TEXT(MSG_FILAMENT_CHANGE_CONT_PURGE)); + _lcd_pause_message(GET_TEXT_F(MSG_FILAMENT_CHANGE_CONT_PURGE)); #else - _lcd_pause_message(GET_TEXT(MSG_FILAMENT_CHANGE_PURGE)); + _lcd_pause_message(GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE)); #endif } diff --git a/Marlin/src/lcd/menu/menu_info.cpp b/Marlin/src/lcd/menu/menu_info.cpp index 3a23cf004884..101861074d95 100644 --- a/Marlin/src/lcd/menu/menu_info.cpp +++ b/Marlin/src/lcd/menu/menu_info.cpp @@ -35,7 +35,7 @@ #endif #define VALUE_ITEM(MSG, VALUE, STYL) do{ char msg[21]; strcpy_P(msg, PSTR(": ")); strcpy(msg + 2, VALUE); STATIC_ITEM(MSG, STYL, msg); }while(0) -#define VALUE_ITEM_P(MSG, PVALUE, STYL) do{ char msg[21]; strcpy_P(msg, PSTR(": ")); strcpy_P(msg + 2, PSTR(PVALUE)); STATIC_ITEM(MSG, STYL, msg); }while(0) +#define VALUE_ITEM_F(MSG, PVALUE, STYL) do{ char msg[21]; strcpy_P(msg, PSTR(": ")); strcpy_P(msg + 2, PSTR(PVALUE)); STATIC_ITEM(MSG, STYL, msg); }while(0) #if ENABLED(PRINTCOUNTER) @@ -56,35 +56,35 @@ VALUE_ITEM(MSG_INFO_COMPLETED_PRINTS, i16tostr3left(stats.finishedPrints), SS_LEFT); // Completed : 666 STATIC_ITEM(MSG_INFO_PRINT_TIME, SS_LEFT); // Total print Time: - STATIC_ITEM_P(PSTR("> "), SS_LEFT, duration_t(stats.printTime).toString(buffer)); // > 99y 364d 23h 59m 59s + STATIC_ITEM_F(F("> "), SS_LEFT, duration_t(stats.printTime).toString(buffer)); // > 99y 364d 23h 59m 59s STATIC_ITEM(MSG_INFO_PRINT_LONGEST, SS_LEFT); // Longest job time: - STATIC_ITEM_P(PSTR("> "), SS_LEFT, duration_t(stats.longestPrint).toString(buffer)); // > 99y 364d 23h 59m 59s + STATIC_ITEM_F(F("> "), SS_LEFT, duration_t(stats.longestPrint).toString(buffer)); // > 99y 364d 23h 59m 59s STATIC_ITEM(MSG_INFO_PRINT_FILAMENT, SS_LEFT); // Extruded total: sprintf_P(buffer, PSTR("%ld.%im") , long(stats.filamentUsed / 1000) , int16_t(stats.filamentUsed / 100) % 10 ); - STATIC_ITEM_P(PSTR("> "), SS_LEFT, buffer); // > 125m + STATIC_ITEM_F(F("> "), SS_LEFT, buffer); // > 125m #if SERVICE_INTERVAL_1 > 0 || SERVICE_INTERVAL_2 > 0 || SERVICE_INTERVAL_3 > 0 strcpy_P(buffer, GET_TEXT(MSG_SERVICE_IN)); #endif #if SERVICE_INTERVAL_1 > 0 - STATIC_ITEM_P(PSTR(SERVICE_NAME_1 " "), SS_LEFT, buffer); // Service X in: - STATIC_ITEM_P(PSTR("> "), SS_LEFT, duration_t(stats.nextService1).toString(buffer)); // > 7d 12h 11m 10s + STATIC_ITEM_F(F(SERVICE_NAME_1 " "), SS_LEFT, buffer); // Service X in: + STATIC_ITEM_F(F("> "), SS_LEFT, duration_t(stats.nextService1).toString(buffer)); // > 7d 12h 11m 10s #endif #if SERVICE_INTERVAL_2 > 0 - STATIC_ITEM_P(PSTR(SERVICE_NAME_2 " "), SS_LEFT, buffer); - STATIC_ITEM_P(PSTR("> "), SS_LEFT, duration_t(stats.nextService2).toString(buffer)); + STATIC_ITEM_F(F(SERVICE_NAME_2 " "), SS_LEFT, buffer); + STATIC_ITEM_F(F("> "), SS_LEFT, duration_t(stats.nextService2).toString(buffer)); #endif #if SERVICE_INTERVAL_3 > 0 - STATIC_ITEM_P(PSTR(SERVICE_NAME_3 " "), SS_LEFT, buffer); - STATIC_ITEM_P(PSTR("> "), SS_LEFT, duration_t(stats.nextService3).toString(buffer)); + STATIC_ITEM_F(F(SERVICE_NAME_3 " "), SS_LEFT, buffer); + STATIC_ITEM_F(F("> "), SS_LEFT, duration_t(stats.nextService3).toString(buffer)); #endif END_SCREEN(); @@ -103,7 +103,7 @@ void menu_info_thermistors() { #if HAS_EXTRUDERS #define THERMISTOR_ID TEMP_SENSOR_0 #include "../thermistornames.h" - STATIC_ITEM_P(PSTR(STR_E0 ": " THERMISTOR_NAME), SS_INVERT); + STATIC_ITEM_F(F(STR_E0 ": " THERMISTOR_NAME), SS_INVERT); PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_0_MINTEMP), SS_LEFT); PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_0_MAXTEMP), SS_LEFT); STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT); @@ -113,7 +113,7 @@ void menu_info_thermistors() { #undef THERMISTOR_ID #define THERMISTOR_ID TEMP_SENSOR_1 #include "../thermistornames.h" - STATIC_ITEM_P(PSTR(STR_E1 ": " THERMISTOR_NAME), SS_INVERT); + STATIC_ITEM_F(F(STR_E1 ": " THERMISTOR_NAME), SS_INVERT); PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_1_MINTEMP), SS_LEFT); PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_1_MAXTEMP), SS_LEFT); STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT); @@ -123,7 +123,7 @@ void menu_info_thermistors() { #undef THERMISTOR_ID #define THERMISTOR_ID TEMP_SENSOR_2 #include "../thermistornames.h" - STATIC_ITEM_P(PSTR(STR_E2 ": " THERMISTOR_NAME), SS_INVERT); + STATIC_ITEM_F(F(STR_E2 ": " THERMISTOR_NAME), SS_INVERT); PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_2_MINTEMP), SS_LEFT); PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_2_MAXTEMP), SS_LEFT); STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT); @@ -133,7 +133,7 @@ void menu_info_thermistors() { #undef THERMISTOR_ID #define THERMISTOR_ID TEMP_SENSOR_3 #include "../thermistornames.h" - STATIC_ITEM_P(PSTR(STR_E3 ": " THERMISTOR_NAME), SS_INVERT); + STATIC_ITEM_F(F(STR_E3 ": " THERMISTOR_NAME), SS_INVERT); PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_3_MINTEMP), SS_LEFT); PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_3_MAXTEMP), SS_LEFT); STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT); @@ -143,7 +143,7 @@ void menu_info_thermistors() { #undef THERMISTOR_ID #define THERMISTOR_ID TEMP_SENSOR_4 #include "../thermistornames.h" - STATIC_ITEM_P(PSTR(STR_E4 ": " THERMISTOR_NAME), SS_INVERT); + STATIC_ITEM_F(F(STR_E4 ": " THERMISTOR_NAME), SS_INVERT); PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_4_MINTEMP), SS_LEFT); PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_4_MAXTEMP), SS_LEFT); STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT); @@ -153,7 +153,7 @@ void menu_info_thermistors() { #undef THERMISTOR_ID #define THERMISTOR_ID TEMP_SENSOR_5 #include "../thermistornames.h" - STATIC_ITEM_P(PSTR(STR_E5 ": " THERMISTOR_NAME), SS_INVERT); + STATIC_ITEM_F(F(STR_E5 ": " THERMISTOR_NAME), SS_INVERT); PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_5_MINTEMP), SS_LEFT); PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_5_MAXTEMP), SS_LEFT); STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT); @@ -163,7 +163,7 @@ void menu_info_thermistors() { #undef THERMISTOR_ID #define THERMISTOR_ID TEMP_SENSOR_6 #include "../thermistornames.h" - STATIC_ITEM_P(PSTR(STR_E6 ": " THERMISTOR_NAME), SS_INVERT); + STATIC_ITEM_F(F(STR_E6 ": " THERMISTOR_NAME), SS_INVERT); PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_6_MINTEMP), SS_LEFT); PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_6_MAXTEMP), SS_LEFT); STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT); @@ -173,7 +173,7 @@ void menu_info_thermistors() { #undef THERMISTOR_ID #define THERMISTOR_ID TEMP_SENSOR_7 #include "../thermistornames.h" - STATIC_ITEM_P(PSTR(STR_E7 ": " THERMISTOR_NAME), SS_INVERT); + STATIC_ITEM_F(F(STR_E7 ": " THERMISTOR_NAME), SS_INVERT); PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_7_MINTEMP), SS_LEFT); PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_7_MAXTEMP), SS_LEFT); STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT); @@ -183,7 +183,7 @@ void menu_info_thermistors() { #undef THERMISTOR_ID #define THERMISTOR_ID TEMP_SENSOR_BED #include "../thermistornames.h" - STATIC_ITEM_P(PSTR("BED: " THERMISTOR_NAME), SS_INVERT); + STATIC_ITEM_F(F("BED: " THERMISTOR_NAME), SS_INVERT); PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(BED_MINTEMP), SS_LEFT); PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(BED_MAXTEMP), SS_LEFT); STATIC_ITEM(TERN(WATCH_BED, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT); @@ -193,7 +193,7 @@ void menu_info_thermistors() { #undef THERMISTOR_ID #define THERMISTOR_ID TEMP_SENSOR_CHAMBER #include "../thermistornames.h" - STATIC_ITEM_P(PSTR("CHAM: " THERMISTOR_NAME), SS_INVERT); + STATIC_ITEM_F(F("CHAM: " THERMISTOR_NAME), SS_INVERT); PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(CHAMBER_MINTEMP), SS_LEFT); PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(CHAMBER_MAXTEMP), SS_LEFT); STATIC_ITEM(TERN(WATCH_CHAMBER, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT); @@ -203,7 +203,7 @@ void menu_info_thermistors() { #undef THERMISTOR_ID #define THERMISTOR_ID TEMP_SENSOR_COOLER #include "../thermistornames.h" - STATIC_ITEM_P(PSTR("COOL: " THERMISTOR_NAME), SS_INVERT); + STATIC_ITEM_F(F("COOL: " THERMISTOR_NAME), SS_INVERT); PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(COOLER_MINTEMP), SS_LEFT); PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(COOLER_MAXTEMP), SS_LEFT); STATIC_ITEM(TERN(WATCH_COOLER, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT); @@ -219,9 +219,9 @@ void menu_info_board() { if (ui.use_click()) return ui.go_back(); START_SCREEN(); - STATIC_ITEM_P(PSTR(BOARD_INFO_NAME), SS_DEFAULT|SS_INVERT); // MyPrinterController + STATIC_ITEM_F(F(BOARD_INFO_NAME), SS_DEFAULT|SS_INVERT); // MyPrinterController #ifdef BOARD_WEBSITE_URL - STATIC_ITEM_P(PSTR(BOARD_WEBSITE_URL), SS_LEFT); // www.my3dprinter.com + STATIC_ITEM_F(F(BOARD_WEBSITE_URL), SS_LEFT); // www.my3dprinter.com #endif PSTRING_ITEM(MSG_INFO_BAUDRATE, STRINGIFY(BAUDRATE), SS_CENTER); // Baud: 250000 PSTRING_ITEM(MSG_INFO_PROTOCOL, PROTOCOL_VERSION, SS_CENTER); // Protocol: 1.0 @@ -251,11 +251,11 @@ void menu_info_board() { void menu_info_printer() { if (ui.use_click()) return ui.go_back(); START_SCREEN(); - STATIC_ITEM(MSG_MARLIN, SS_DEFAULT|SS_INVERT); // Marlin - STATIC_ITEM_P(PSTR(SHORT_BUILD_VERSION)); // x.x.x-Branch - STATIC_ITEM_P(PSTR(STRING_DISTRIBUTION_DATE)); // YYYY-MM-DD HH:MM - STATIC_ITEM_P(PSTR(MACHINE_NAME), SS_DEFAULT|SS_INVERT); // My3DPrinter - STATIC_ITEM_P(PSTR(WEBSITE_URL)); // www.my3dprinter.com + STATIC_ITEM(MSG_MARLIN, SS_DEFAULT|SS_INVERT); // Marlin + STATIC_ITEM_F(F(SHORT_BUILD_VERSION)); // x.x.x-Branch + STATIC_ITEM_F(F(STRING_DISTRIBUTION_DATE)); // YYYY-MM-DD HH:MM + STATIC_ITEM_F(F(MACHINE_NAME), SS_DEFAULT|SS_INVERT); // My3DPrinter + STATIC_ITEM_F(F(WEBSITE_URL)); // www.my3dprinter.com PSTRING_ITEM(MSG_INFO_EXTRUDERS, STRINGIFY(EXTRUDERS), SS_CENTER); // Extruders: 2 #if HAS_LEVELING STATIC_ITEM( diff --git a/Marlin/src/lcd/menu/menu_item.h b/Marlin/src/lcd/menu/menu_item.h index fcde9f580193..80a0872da652 100644 --- a/Marlin/src/lcd/menu/menu_item.h +++ b/Marlin/src/lcd/menu/menu_item.h @@ -36,36 +36,36 @@ void lcd_move_z(); // SUBMENU(LABEL, screen_handler) class MenuItem_submenu : public MenuItemBase { public: - FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr, ...) { - _draw(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0]); + FORCE_INLINE static void draw(const bool sel, const uint8_t row, FSTR_P const fstr, ...) { + _draw(sel, row, fstr, '>', LCD_STR_ARROW_RIGHT[0]); } - static void action(PGM_P const, const screenFunc_t func) { ui.push_current_screen(); ui.goto_screen(func); } + static void action(FSTR_P const, const screenFunc_t func) { ui.push_current_screen(); ui.goto_screen(func); } }; // Any menu item that invokes an immediate action class MenuItem_button : public MenuItemBase { public: // Button-y Items are selectable lines with no other indicator - static void draw(const bool sel, const uint8_t row, PGM_P const pstr, ...) { - _draw(sel, row, pstr, '>', ' '); + static void draw(const bool sel, const uint8_t row, FSTR_P const fstr, ...) { + _draw(sel, row, fstr, '>', ' '); } }; // ACTION_ITEM(LABEL, FUNC) class MenuItem_function : public MenuItem_button { public: - //static void action(PGM_P const, const uint8_t, const menuAction_t func) { (*func)(); }; - static void action(PGM_P const, const menuAction_t func) { if (func) (*func)(); }; + //static void action(FSTR_P const, const uint8_t, const menuAction_t func) { (*func)(); }; + static void action(FSTR_P const, const menuAction_t func) { if (func) (*func)(); }; }; // GCODES_ITEM(LABEL, GCODES) class MenuItem_gcode : public MenuItem_button { public: - FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr, ...) { - _draw(sel, row, pstr, '>', ' '); + FORCE_INLINE static void draw(const bool sel, const uint8_t row, FSTR_P const fstr, ...) { + _draw(sel, row, fstr, '>', ' '); } - static void action(PGM_P const, PGM_P const pgcode) { queue.inject(FPSTR(pgcode)); } - static void action(PGM_P const pstr, const uint8_t, PGM_P const pgcode) { action(pstr, pgcode); } + static void action(FSTR_P const, FSTR_P const fgcode) { queue.inject(fgcode); } + static void action(FSTR_P const fstr, const uint8_t, FSTR_P const fgcode) { action(fstr, fgcode); } }; //////////////////////////////////////////// @@ -82,16 +82,16 @@ class TMenuEditItem : MenuEditItemBase { static const char* to_string(const int32_t value) { return NAME::strfunc(unscale(value)); } static void load(void *ptr, const int32_t value) { *((type_t*)ptr) = unscale(value); } public: - FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr, type_t * const data, ...) { - MenuEditItemBase::draw(sel, row, pstr, NAME::strfunc(*(data))); + FORCE_INLINE static void draw(const bool sel, const uint8_t row, FSTR_P const fstr, type_t * const data, ...) { + MenuEditItemBase::draw(sel, row, fstr, NAME::strfunc(*(data))); } - FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr, type_t (*pget)(), ...) { - MenuEditItemBase::draw(sel, row, pstr, NAME::strfunc(pget())); + FORCE_INLINE static void draw(const bool sel, const uint8_t row, FSTR_P const fstr, type_t (*pget)(), ...) { + MenuEditItemBase::draw(sel, row, fstr, NAME::strfunc(pget())); } // Edit screen for this type of item static void edit_screen() { MenuEditItemBase::edit_screen(to_string, load); } static void action( - PGM_P const pstr, // Edit label + FSTR_P const fstr, // Edit label type_t * const ptr, // Value pointer const type_t minValue, // Value range const type_t maxValue, @@ -101,7 +101,7 @@ class TMenuEditItem : MenuEditItemBase { // Make sure minv and maxv fit within int32_t const int32_t minv = _MAX(scale(minValue), INT32_MIN), maxv = _MIN(scale(maxValue), INT32_MAX); - goto_edit_screen(pstr, ptr, minv, maxv - minv, scale(*ptr) - minv, + goto_edit_screen(fstr, ptr, minv, maxv - minv, scale(*ptr) - minv, edit_screen, callback, live); } }; @@ -168,16 +168,16 @@ DEFINE_MENU_EDIT_ITEM_TYPE(long5_25 ,uint32_t ,ftostr5rj , 0.04f ); class MenuItem_bool : public MenuEditItemBase { public: - FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr, const bool onoff) { - MenuEditItemBase::draw(sel, row, pstr, onoff ? GET_TEXT(MSG_LCD_ON) : GET_TEXT(MSG_LCD_OFF), true); + FORCE_INLINE static void draw(const bool sel, const uint8_t row, FSTR_P const fstr, const bool onoff) { + MenuEditItemBase::draw(sel, row, fstr, onoff ? GET_TEXT_F(MSG_LCD_ON) : GET_TEXT_F(MSG_LCD_OFF)); } - FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr, bool * const data, ...) { - draw(sel, row, pstr, *data); + FORCE_INLINE static void draw(const bool sel, const uint8_t row, FSTR_P const fstr, bool * const data, ...) { + draw(sel, row, fstr, *data); } - FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr, PGM_P const, bool (*pget)(), ...) { - draw(sel, row, pstr, pget()); + FORCE_INLINE static void draw(const bool sel, const uint8_t row, FSTR_P const fstr, FSTR_P const, bool (*pget)(), ...) { + draw(sel, row, fstr, pget()); } - static void action(PGM_P const pstr, bool * const ptr, const screenFunc_t callbackFunc=nullptr) { + static void action(FSTR_P const fstr, bool * const ptr, const screenFunc_t callbackFunc=nullptr) { *ptr ^= true; ui.refresh(); if (callbackFunc) (*callbackFunc)(); } @@ -250,16 +250,16 @@ class MenuItem_bool : public MenuEditItemBase { * * Examples: * BACK_ITEM(MSG_INFO_SCREEN) - * MenuItem_back::action(plabel, ...) - * MenuItem_back::draw(sel, row, plabel, ...) + * MenuItem_back::action(flabel, ...) + * MenuItem_back::draw(sel, row, flabel, ...) * * ACTION_ITEM(MSG_PAUSE_PRINT, lcd_sdcard_pause) - * MenuItem_function::action(plabel, lcd_sdcard_pause) - * MenuItem_function::draw(sel, row, plabel, lcd_sdcard_pause) + * 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(plabel, &feedrate_percentage, 10, 999) - * MenuItem_int3::draw(sel, row, plabel, &feedrate_percentage, 10, 999) + * MenuItem_int3::action(flabel, &feedrate_percentage, 10, 999) + * MenuItem_int3::draw(sel, row, flabel, &feedrate_percentage, 10, 999) */ #if ENABLED(ENCODER_RATE_MULTIPLIER) @@ -268,19 +268,19 @@ class MenuItem_bool : public MenuEditItemBase { #define _MENU_ITEM_MULTIPLIER_CHECK(USE_MULTIPLIER) #endif -#define _MENU_INNER_P(TYPE, USE_MULTIPLIER, PLABEL, V...) do { \ - PGM_P const plabel = PLABEL; \ +#define _MENU_INNER_P(TYPE, USE_MULTIPLIER, FLABEL, V...) do { \ + FSTR_P const flabel = FLABEL; \ if (encoderLine == _thisItemNr && ui.use_click()) { \ _MENU_ITEM_MULTIPLIER_CHECK(USE_MULTIPLIER); \ - MenuItem_##TYPE::action(plabel, ##V); \ + MenuItem_##TYPE::action(flabel, ##V); \ if (ui.screen_changed) return; \ } \ if (ui.should_draw()) \ MenuItem_##TYPE::draw \ - (encoderLine == _thisItemNr, _lcdLineNr, plabel, ##V); \ + (encoderLine == _thisItemNr, _lcdLineNr, flabel, ##V); \ }while(0) -#define _MENU_ITEM_P(TYPE, V...) do { \ +#define _MENU_ITEM_F(TYPE, V...) do { \ if (_menuLineNr == _thisItemNr) { \ _skipStatic = false; \ _MENU_INNER_P(TYPE, ##V); \ @@ -289,7 +289,7 @@ class MenuItem_bool : public MenuEditItemBase { }while(0) // Indexed items set a global index value and optional data -#define _MENU_ITEM_N_S_P(TYPE, N, S, V...) do{ \ +#define _MENU_ITEM_N_S_F(TYPE, N, S, V...) do{ \ if (_menuLineNr == _thisItemNr) { \ _skipStatic = false; \ MenuItemBase::init(N, S); \ @@ -299,7 +299,7 @@ class MenuItem_bool : public MenuEditItemBase { }while(0) // Indexed items set a global index value -#define _MENU_ITEM_N_P(TYPE, N, V...) do{ \ +#define _MENU_ITEM_N_F(TYPE, N, V...) do{ \ if (_menuLineNr == _thisItemNr) { \ _skipStatic = false; \ MenuItemBase::itemIndex = N; \ @@ -309,7 +309,7 @@ class MenuItem_bool : public MenuEditItemBase { }while(0) // Items with a unique string -#define _MENU_ITEM_S_P(TYPE, S, V...) do{ \ +#define _MENU_ITEM_S_F(TYPE, S, V...) do{ \ if (_menuLineNr == _thisItemNr) { \ _skipStatic = false; \ MenuItemBase::itemString = S; \ @@ -321,25 +321,25 @@ class MenuItem_bool : public MenuEditItemBase { // STATIC_ITEM draws a styled string with no highlight. // Parameters: label [, style [, char *value] ] -#define STATIC_ITEM_INNER_P(PLABEL, V...) do{ \ +#define STATIC_ITEM_INNER_F(FLABEL, V...) do{ \ if (_skipStatic && encoderLine <= _thisItemNr) { \ ui.encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \ ++encoderLine; \ } \ if (ui.should_draw()) \ - MenuItem_static::draw(_lcdLineNr, PLABEL, ##V); \ + MenuItem_static::draw(_lcdLineNr, FLABEL, ##V); \ } while(0) -#define STATIC_ITEM_P(PLABEL, V...) do{ \ +#define STATIC_ITEM_F(FLABEL, V...) do{ \ if (_menuLineNr == _thisItemNr) \ - STATIC_ITEM_INNER_P(PLABEL, ##V); \ + STATIC_ITEM_INNER_F(FLABEL, ##V); \ NEXT_ITEM(); \ } while(0) -#define STATIC_ITEM_N_P(PLABEL, N, V...) do{ \ +#define STATIC_ITEM_N_F(FLABEL, N, V...) do{ \ if (_menuLineNr == _thisItemNr) { \ MenuItemBase::init(N); \ - STATIC_ITEM_INNER_P(PLABEL, ##V); \ + STATIC_ITEM_INNER_F(FLABEL, ##V); \ } \ NEXT_ITEM(); \ }while(0) @@ -347,124 +347,124 @@ class MenuItem_bool : public MenuEditItemBase { // PSTRING_ITEM is like STATIC_ITEM but it takes // two PSTRs with the style as the last parameter. -#define PSTRING_ITEM_P(PLABEL, PVAL, STYL) do{ \ +#define PSTRING_ITEM_F(FLABEL, PVAL, STYL) do{ \ constexpr int m = 20; \ char msg[m+1]; \ msg[0] = ':'; msg[1] = ' '; \ strncpy_P(msg+2, PSTR(PVAL), m-2); \ if (msg[m-1] & 0x80) msg[m-1] = '\0'; \ - STATIC_ITEM_P(PLABEL, STYL, msg); \ + STATIC_ITEM_F(FLABEL, STYL, msg); \ }while(0) -#define PSTRING_ITEM(LABEL, V...) PSTRING_ITEM_P(GET_TEXT(LABEL), ##V) +#define PSTRING_ITEM(LABEL, V...) PSTRING_ITEM_F(GET_TEXT_F(LABEL), ##V) -#define STATIC_ITEM(LABEL, V...) STATIC_ITEM_P(GET_TEXT(LABEL), ##V) -#define STATIC_ITEM_N(LABEL, N, V...) STATIC_ITEM_N_P(GET_TEXT(LABEL), N, ##V) +#define STATIC_ITEM(LABEL, V...) STATIC_ITEM_F(GET_TEXT_F(LABEL), ##V) +#define STATIC_ITEM_N(LABEL, N, V...) STATIC_ITEM_N_F(GET_TEXT_F(LABEL), N, ##V) -#define MENU_ITEM_N_S_P(TYPE, N, S, PLABEL, V...) _MENU_ITEM_N_S_P(TYPE, N, S, false, PLABEL, ##V) -#define MENU_ITEM_N_S(TYPE, N, S, LABEL, V...) MENU_ITEM_N_S_P(TYPE, N, S, GET_TEXT(LABEL), ##V) -#define MENU_ITEM_S_P(TYPE, S, PLABEL, V...) _MENU_ITEM_S_P(TYPE, S, false, PLABEL, ##V) -#define MENU_ITEM_S(TYPE, S, LABEL, V...) MENU_ITEM_S_P(TYPE, S, GET_TEXT(LABEL), ##V) -#define MENU_ITEM_N_P(TYPE, N, PLABEL, V...) _MENU_ITEM_N_P(TYPE, N, false, PLABEL, ##V) -#define MENU_ITEM_N(TYPE, N, LABEL, V...) MENU_ITEM_N_P(TYPE, N, GET_TEXT(LABEL), ##V) -#define MENU_ITEM_P(TYPE, PLABEL, V...) _MENU_ITEM_P(TYPE, false, PLABEL, ##V) -#define MENU_ITEM(TYPE, LABEL, V...) MENU_ITEM_P(TYPE, GET_TEXT(LABEL), ##V) +#define MENU_ITEM_N_S_F(TYPE, N, S, FLABEL, V...) _MENU_ITEM_N_S_F(TYPE, N, S, false, FLABEL, ##V) +#define MENU_ITEM_N_S(TYPE, N, S, LABEL, V...) MENU_ITEM_N_S_F(TYPE, N, S, GET_TEXT_F(LABEL), ##V) +#define MENU_ITEM_S_F(TYPE, S, FLABEL, V...) _MENU_ITEM_S_F(TYPE, S, false, FLABEL, ##V) +#define MENU_ITEM_S(TYPE, S, LABEL, V...) MENU_ITEM_S_F(TYPE, S, GET_TEXT_F(LABEL), ##V) +#define MENU_ITEM_N_F(TYPE, N, FLABEL, V...) _MENU_ITEM_N_F(TYPE, N, false, FLABEL, ##V) +#define MENU_ITEM_N(TYPE, N, LABEL, V...) MENU_ITEM_N_F(TYPE, N, GET_TEXT_F(LABEL), ##V) +#define MENU_ITEM_F(TYPE, FLABEL, V...) _MENU_ITEM_F(TYPE, false, FLABEL, ##V) +#define MENU_ITEM(TYPE, LABEL, V...) MENU_ITEM_F(TYPE, GET_TEXT_F(LABEL), ##V) -#define BACK_ITEM_P(PLABEL) MENU_ITEM_P(back, PLABEL) +#define BACK_ITEM_F(FLABEL) MENU_ITEM_F(back, FLABEL) #define BACK_ITEM(LABEL) MENU_ITEM(back, LABEL) -#define ACTION_ITEM_N_S_P(N, S, PLABEL, ACTION) MENU_ITEM_N_S_P(function, N, S, PLABEL, ACTION) -#define ACTION_ITEM_N_S(N, S, LABEL, ACTION) ACTION_ITEM_N_S_P(N, S, GET_TEXT(LABEL), ACTION) -#define ACTION_ITEM_S_P(S, PLABEL, ACTION) MENU_ITEM_S_P(function, S, PLABEL, ACTION) -#define ACTION_ITEM_S(S, LABEL, ACTION) ACTION_ITEM_S_P(S, GET_TEXT(LABEL), ACTION) -#define ACTION_ITEM_N_P(N, PLABEL, ACTION) MENU_ITEM_N_P(function, N, PLABEL, ACTION) -#define ACTION_ITEM_N(N, LABEL, ACTION) ACTION_ITEM_N_P(N, GET_TEXT(LABEL), ACTION) -#define ACTION_ITEM_P(PLABEL, ACTION) MENU_ITEM_P(function, PLABEL, ACTION) -#define ACTION_ITEM(LABEL, ACTION) ACTION_ITEM_P(GET_TEXT(LABEL), ACTION) - -#define GCODES_ITEM_N_S_P(N, S, PLABEL, GCODES) MENU_ITEM_N_S_P(gcode, N, S, PLABEL, GCODES) -#define GCODES_ITEM_N_S(N, S, LABEL, GCODES) GCODES_ITEM_N_S_P(N, S, GET_TEXT(LABEL), GCODES) -#define GCODES_ITEM_S_P(S, PLABEL, GCODES) MENU_ITEM_S_P(gcode, S, PLABEL, GCODES) -#define GCODES_ITEM_S(S, LABEL, GCODES) GCODES_ITEM_S_P(S, GET_TEXT(LABEL), GCODES) -#define GCODES_ITEM_N_P(N, PLABEL, GCODES) MENU_ITEM_N_P(gcode, N, PLABEL, GCODES) -#define GCODES_ITEM_N(N, LABEL, GCODES) GCODES_ITEM_N_P(N, GET_TEXT(LABEL), GCODES) -#define GCODES_ITEM_P(PLABEL, GCODES) MENU_ITEM_P(gcode, PLABEL, GCODES) -#define GCODES_ITEM(LABEL, GCODES) GCODES_ITEM_P(GET_TEXT(LABEL), GCODES) - -#define SUBMENU_N_S_P(N, S, PLABEL, DEST) MENU_ITEM_N_S_P(submenu, N, S, PLABEL, DEST) -#define SUBMENU_N_S(N, S, LABEL, DEST) SUBMENU_N_S_P(N, S, GET_TEXT(LABEL), DEST) -#define SUBMENU_S_P(S, PLABEL, DEST) MENU_ITEM_S_P(submenu, S, PLABEL, DEST) -#define SUBMENU_S(S, LABEL, DEST) SUBMENU_S_P(S, GET_TEXT(LABEL), DEST) -#define SUBMENU_N_P(N, PLABEL, DEST) MENU_ITEM_N_P(submenu, N, PLABEL, DEST) -#define SUBMENU_N(N, LABEL, DEST) SUBMENU_N_P(N, GET_TEXT(LABEL), DEST) -#define SUBMENU_P(PLABEL, DEST) MENU_ITEM_P(submenu, PLABEL, DEST) -#define SUBMENU(LABEL, DEST) SUBMENU_P(GET_TEXT(LABEL), DEST) - -#define EDIT_ITEM_N_S_P(TYPE, N, S, PLABEL, V...) MENU_ITEM_N_S_P(TYPE, N, S, PLABEL, ##V) -#define EDIT_ITEM_N_S(TYPE, N, S, LABEL, V...) EDIT_ITEM_N_S_P(TYPE, N, S, GET_TEXT(LABEL), ##V) -#define EDIT_ITEM_S_P(TYPE, S, PLABEL, V...) MENU_ITEM_S_P(TYPE, S, PLABEL, ##V) -#define EDIT_ITEM_S(TYPE, S, LABEL, V...) EDIT_ITEM_S_P(TYPE, S, GET_TEXT(LABEL), ##V) -#define EDIT_ITEM_N_P(TYPE, N, PLABEL, V...) MENU_ITEM_N_P(TYPE, N, PLABEL, ##V) -#define EDIT_ITEM_N(TYPE, N, LABEL, V...) EDIT_ITEM_N_P(TYPE, N, GET_TEXT(LABEL), ##V) -#define EDIT_ITEM_P(TYPE, PLABEL, V...) MENU_ITEM_P(TYPE, PLABEL, ##V) -#define EDIT_ITEM(TYPE, LABEL, V...) EDIT_ITEM_P(TYPE, GET_TEXT(LABEL), ##V) - -#define EDIT_ITEM_FAST_N_S_P(TYPE, N, S, PLABEL, V...) _MENU_ITEM_N_S_P(TYPE, N, S, true, PLABEL, ##V) -#define EDIT_ITEM_FAST_N_S(TYPE, N, S, LABEL, V...) EDIT_ITEM_FAST_N_S_P(TYPE, N, S, true, GET_TEXT(LABEL), ##V) -#define EDIT_ITEM_FAST_S_P(TYPE, S, PLABEL, V...) _MENU_ITEM_S_P(TYPE, S, true, PLABEL, ##V) -#define EDIT_ITEM_FAST_S(TYPE, S, LABEL, V...) EDIT_ITEM_FAST_S_P(TYPE, S, GET_TEXT(LABEL), ##V) -#define EDIT_ITEM_FAST_N_P(TYPE, N, PLABEL, V...) _MENU_ITEM_N_P(TYPE, N, true, PLABEL, ##V) -#define EDIT_ITEM_FAST_N(TYPE, N, LABEL, V...) EDIT_ITEM_FAST_N_P(TYPE, N, GET_TEXT(LABEL), ##V) -#define EDIT_ITEM_FAST_P(TYPE, PLABEL, V...) _MENU_ITEM_P(TYPE, true, PLABEL, ##V) -#define EDIT_ITEM_FAST(TYPE, LABEL, V...) EDIT_ITEM_FAST_P(TYPE, GET_TEXT(LABEL), ##V) - -#define _CONFIRM_ITEM_INNER_P(PLABEL, V...) do { \ +#define ACTION_ITEM_N_S_F(N, S, FLABEL, ACTION) MENU_ITEM_N_S_F(function, N, S, FLABEL, ACTION) +#define ACTION_ITEM_N_S(N, S, LABEL, ACTION) ACTION_ITEM_N_S_F(N, S, GET_TEXT_F(LABEL), ACTION) +#define ACTION_ITEM_S_F(S, FLABEL, ACTION) MENU_ITEM_S_F(function, S, FLABEL, ACTION) +#define ACTION_ITEM_S(S, LABEL, ACTION) ACTION_ITEM_S_F(S, GET_TEXT_F(LABEL), ACTION) +#define ACTION_ITEM_N_F(N, FLABEL, ACTION) MENU_ITEM_N_F(function, N, FLABEL, ACTION) +#define ACTION_ITEM_N(N, LABEL, ACTION) ACTION_ITEM_N_F(N, GET_TEXT_F(LABEL), ACTION) +#define ACTION_ITEM_F(FLABEL, ACTION) MENU_ITEM_F(function, FLABEL, ACTION) +#define ACTION_ITEM(LABEL, ACTION) ACTION_ITEM_F(GET_TEXT_F(LABEL), ACTION) + +#define GCODES_ITEM_N_S_F(N, S, FLABEL, GCODES) MENU_ITEM_N_S_F(gcode, N, S, FLABEL, GCODES) +#define GCODES_ITEM_N_S(N, S, LABEL, GCODES) GCODES_ITEM_N_S_F(N, S, GET_TEXT_F(LABEL), GCODES) +#define GCODES_ITEM_S_F(S, FLABEL, GCODES) MENU_ITEM_S_F(gcode, S, FLABEL, GCODES) +#define GCODES_ITEM_S(S, LABEL, GCODES) GCODES_ITEM_S_F(S, GET_TEXT_F(LABEL), GCODES) +#define GCODES_ITEM_N_F(N, FLABEL, GCODES) MENU_ITEM_N_F(gcode, N, FLABEL, GCODES) +#define GCODES_ITEM_N(N, LABEL, GCODES) GCODES_ITEM_N_F(N, GET_TEXT_F(LABEL), GCODES) +#define GCODES_ITEM_F(FLABEL, GCODES) MENU_ITEM_F(gcode, FLABEL, GCODES) +#define GCODES_ITEM(LABEL, GCODES) GCODES_ITEM_F(GET_TEXT_F(LABEL), GCODES) + +#define SUBMENU_N_S_F(N, S, FLABEL, DEST) MENU_ITEM_N_S_F(submenu, N, S, FLABEL, DEST) +#define SUBMENU_N_S(N, S, LABEL, DEST) SUBMENU_N_S_F(N, S, GET_TEXT_F(LABEL), DEST) +#define SUBMENU_S_F(S, FLABEL, DEST) MENU_ITEM_S_F(submenu, S, FLABEL, DEST) +#define SUBMENU_S(S, LABEL, DEST) SUBMENU_S_F(S, GET_TEXT_F(LABEL), DEST) +#define SUBMENU_N_F(N, FLABEL, DEST) MENU_ITEM_N_F(submenu, N, FLABEL, DEST) +#define SUBMENU_N(N, LABEL, DEST) SUBMENU_N_F(N, GET_TEXT_F(LABEL), DEST) +#define SUBMENU_F(FLABEL, DEST) MENU_ITEM_F(submenu, FLABEL, DEST) +#define SUBMENU(LABEL, DEST) SUBMENU_F(GET_TEXT_F(LABEL), DEST) + +#define EDIT_ITEM_N_S_F(TYPE, N, S, FLABEL, V...) MENU_ITEM_N_S_F(TYPE, N, S, FLABEL, ##V) +#define EDIT_ITEM_N_S(TYPE, N, S, LABEL, V...) EDIT_ITEM_N_S_F(TYPE, N, S, GET_TEXT_F(LABEL), ##V) +#define EDIT_ITEM_S_F(TYPE, S, FLABEL, V...) MENU_ITEM_S_F(TYPE, S, FLABEL, ##V) +#define EDIT_ITEM_S(TYPE, S, LABEL, V...) EDIT_ITEM_S_F(TYPE, S, GET_TEXT_F(LABEL), ##V) +#define EDIT_ITEM_N_F(TYPE, N, FLABEL, V...) MENU_ITEM_N_F(TYPE, N, FLABEL, ##V) +#define EDIT_ITEM_N(TYPE, N, LABEL, V...) EDIT_ITEM_N_F(TYPE, N, GET_TEXT_F(LABEL), ##V) +#define EDIT_ITEM_F(TYPE, FLABEL, V...) MENU_ITEM_F(TYPE, FLABEL, ##V) +#define EDIT_ITEM(TYPE, LABEL, V...) EDIT_ITEM_F(TYPE, GET_TEXT_F(LABEL), ##V) + +#define EDIT_ITEM_FAST_N_S_F(TYPE, N, S, FLABEL, V...) _MENU_ITEM_N_S_F(TYPE, N, S, true, FLABEL, ##V) +#define EDIT_ITEM_FAST_N_S(TYPE, N, S, LABEL, V...) EDIT_ITEM_FAST_N_S_F(TYPE, N, S, true, GET_TEXT_F(LABEL), ##V) +#define EDIT_ITEM_FAST_S_F(TYPE, S, FLABEL, V...) _MENU_ITEM_S_F(TYPE, S, true, FLABEL, ##V) +#define EDIT_ITEM_FAST_S(TYPE, S, LABEL, V...) EDIT_ITEM_FAST_S_F(TYPE, S, GET_TEXT_F(LABEL), ##V) +#define EDIT_ITEM_FAST_N_F(TYPE, N, FLABEL, V...) _MENU_ITEM_N_F(TYPE, N, true, FLABEL, ##V) +#define EDIT_ITEM_FAST_N(TYPE, N, LABEL, V...) EDIT_ITEM_FAST_N_F(TYPE, N, GET_TEXT_F(LABEL), ##V) +#define EDIT_ITEM_FAST_F(TYPE, FLABEL, V...) _MENU_ITEM_F(TYPE, true, FLABEL, ##V) +#define EDIT_ITEM_FAST(TYPE, LABEL, V...) EDIT_ITEM_FAST_F(TYPE, GET_TEXT_F(LABEL), ##V) + +#define _CONFIRM_ITEM_INNER_F(FLABEL, V...) do { \ if (encoderLine == _thisItemNr && ui.use_click()) { \ ui.push_current_screen(); \ ui.goto_screen([]{MenuItem_confirm::select_screen(V);}); \ return; \ } \ if (ui.should_draw()) MenuItem_confirm::draw \ - (encoderLine == _thisItemNr, _lcdLineNr, PLABEL, ##V); \ + (encoderLine == _thisItemNr, _lcdLineNr, FLABEL, ##V); \ }while(0) // Indexed items set a global index value and optional data -#define _CONFIRM_ITEM_P(PLABEL, V...) do { \ +#define _CONFIRM_ITEM_F(FLABEL, V...) do { \ if (_menuLineNr == _thisItemNr) { \ _skipStatic = false; \ - _CONFIRM_ITEM_INNER_P(PLABEL, ##V); \ + _CONFIRM_ITEM_INNER_F(FLABEL, ##V); \ } \ NEXT_ITEM(); \ }while(0) // Indexed items set a global index value -#define _CONFIRM_ITEM_N_S_P(N, S, V...) do{ \ +#define _CONFIRM_ITEM_N_S_F(N, S, V...) do{ \ if (_menuLineNr == _thisItemNr) { \ _skipStatic = false; \ MenuItemBase::init(N, S); \ - _CONFIRM_ITEM_INNER_P(TYPE, ##V); \ + _CONFIRM_ITEM_INNER_F(TYPE, ##V); \ } \ NEXT_ITEM(); \ }while(0) // Indexed items set a global index value -#define _CONFIRM_ITEM_N_P(N, V...) _CONFIRM_ITEM_N_S_P(N, nullptr, V) +#define _CONFIRM_ITEM_N_F(N, V...) _CONFIRM_ITEM_N_S_F(N, nullptr, V) -#define CONFIRM_ITEM_P(PLABEL,A,B,V...) _CONFIRM_ITEM_P(PLABEL, GET_TEXT(A), GET_TEXT(B), ##V) -#define CONFIRM_ITEM(LABEL, V...) CONFIRM_ITEM_P(GET_TEXT(LABEL), ##V) +#define CONFIRM_ITEM_F(FLABEL,A,B,V...) _CONFIRM_ITEM_F(FLABEL, GET_TEXT_F(A), GET_TEXT_F(B), ##V) +#define CONFIRM_ITEM(LABEL, V...) CONFIRM_ITEM_F(GET_TEXT_F(LABEL), ##V) -#define YESNO_ITEM_P(PLABEL, V...) CONFIRM_ITEM_P(PLABEL, MSG_YES, MSG_NO, ##V) -#define YESNO_ITEM(LABEL, V...) YESNO_ITEM_P(GET_TEXT(LABEL), ##V) +#define YESNO_ITEM_F(FLABEL, V...) CONFIRM_ITEM_F(FLABEL, MSG_YES, MSG_NO, ##V) +#define YESNO_ITEM(LABEL, V...) YESNO_ITEM_F(GET_TEXT_F(LABEL), ##V) -#define CONFIRM_ITEM_N_S_P(N,S,PLABEL,A,B,V...) _CONFIRM_ITEM_N_S_P(N, S, PLABEL, GET_TEXT(A), GET_TEXT(B), ##V) -#define CONFIRM_ITEM_N_S(N,S,LABEL,V...) CONFIRM_ITEM_N_S_P(N, S, GET_TEXT(LABEL), ##V) -#define CONFIRM_ITEM_N_P(N,PLABEL,A,B,V...) _CONFIRM_ITEM_N_P(N, PLABEL, GET_TEXT(A), GET_TEXT(B), ##V) -#define CONFIRM_ITEM_N(N,LABEL, V...) CONFIRM_ITEM_N_P(N, GET_TEXT(LABEL), ##V) +#define CONFIRM_ITEM_N_S_F(N,S,FLABEL,A,B,V...) _CONFIRM_ITEM_N_S_F(N, S, FLABEL, GET_TEXT_F(A), GET_TEXT_F(B), ##V) +#define CONFIRM_ITEM_N_S(N,S,LABEL,V...) CONFIRM_ITEM_N_S_F(N, S, GET_TEXT_F(LABEL), ##V) +#define CONFIRM_ITEM_N_F(N,FLABEL,A,B,V...) _CONFIRM_ITEM_N_F(N, FLABEL, GET_TEXT_F(A), GET_TEXT_F(B), ##V) +#define CONFIRM_ITEM_N(N,LABEL, V...) CONFIRM_ITEM_N_F(N, GET_TEXT_F(LABEL), ##V) -#define YESNO_ITEM_N_S_P(N,S,PLABEL, V...) _CONFIRM_ITEM_N_S_P(N, S, PLABEL, MSG_YES, MSG_NO, ##V) -#define YESNO_ITEM_N_S(N,S,LABEL, V...) YESNO_ITEM_N_S_P(N, S, GET_TEXT(LABEL), ##V) -#define YESNO_ITEM_N_P(N,PLABEL, V...) CONFIRM_ITEM_N_P(N, PLABEL, MSG_YES, MSG_NO, ##V) -#define YESNO_ITEM_N(N,LABEL, V...) YESNO_ITEM_N_P(N, GET_TEXT(LABEL), ##V) +#define YESNO_ITEM_N_S_F(N,S,FLABEL, V...) _CONFIRM_ITEM_N_S_F(N, S, FLABEL, MSG_YES, MSG_NO, ##V) +#define YESNO_ITEM_N_S(N,S,LABEL, V...) YESNO_ITEM_N_S_F(N, S, GET_TEXT_F(LABEL), ##V) +#define YESNO_ITEM_N_F(N,FLABEL, V...) CONFIRM_ITEM_N_F(N, FLABEL, MSG_YES, MSG_NO, ##V) +#define YESNO_ITEM_N(N,LABEL, V...) YESNO_ITEM_N_F(N, GET_TEXT_F(LABEL), ##V) #if ENABLED(LEVEL_BED_CORNERS) void _lcd_level_bed_corners(); diff --git a/Marlin/src/lcd/menu/menu_language.cpp b/Marlin/src/lcd/menu/menu_language.cpp index 4c4b7880f2c3..2ea4359c6bb7 100644 --- a/Marlin/src/lcd/menu/menu_language.cpp +++ b/Marlin/src/lcd/menu/menu_language.cpp @@ -41,14 +41,14 @@ void menu_language() { START_MENU(); BACK_ITEM(MSG_MAIN); - MENU_ITEM_P(function, GET_LANG(LCD_LANGUAGE )::LANGUAGE, []{ set_lcd_language(0); }); - MENU_ITEM_P(function, GET_LANG(LCD_LANGUAGE_2)::LANGUAGE, []{ set_lcd_language(1); }); + MENU_ITEM_F(function, FPSTR(GET_LANGUAGE_NAME(1)), []{ set_lcd_language(0); }); + MENU_ITEM_F(function, FPSTR(GET_LANGUAGE_NAME(2)), []{ set_lcd_language(1); }); #if NUM_LANGUAGES > 2 - MENU_ITEM_P(function, GET_LANG(LCD_LANGUAGE_3)::LANGUAGE, []{ set_lcd_language(2); }); + MENU_ITEM_F(function, FPSTR(GET_LANGUAGE_NAME(3)), []{ set_lcd_language(2); }); #if NUM_LANGUAGES > 3 - MENU_ITEM_P(function, GET_LANG(LCD_LANGUAGE_4)::LANGUAGE, []{ set_lcd_language(3); }); + MENU_ITEM_F(function, FPSTR(GET_LANGUAGE_NAME(4)), []{ set_lcd_language(3); }); #if NUM_LANGUAGES > 4 - MENU_ITEM_P(function, GET_LANG(LCD_LANGUAGE_5)::LANGUAGE, []{ set_lcd_language(4); }); + MENU_ITEM_F(function, FPSTR(GET_LANGUAGE_NAME(5)), []{ set_lcd_language(4); }); #endif #endif #endif diff --git a/Marlin/src/lcd/menu/menu_main.cpp b/Marlin/src/lcd/menu/menu_main.cpp index a15653589523..fdedddb6ddda 100644 --- a/Marlin/src/lcd/menu/menu_main.cpp +++ b/Marlin/src/lcd/menu/menu_main.cpp @@ -124,13 +124,13 @@ void menu_configuration(); #define _DONE_SCRIPT "" #endif #define GCODE_LAMBDA_MAIN(N) []{ _lcd_custom_menu_main_gcode(F(MAIN_MENU_ITEM_##N##_GCODE _DONE_SCRIPT)); } - #define _CUSTOM_ITEM_MAIN(N) ACTION_ITEM_P(PSTR(MAIN_MENU_ITEM_##N##_DESC), GCODE_LAMBDA_MAIN(N)); - #define _CUSTOM_ITEM_MAIN_CONFIRM(N) \ - SUBMENU_P(PSTR(MAIN_MENU_ITEM_##N##_DESC), []{ \ - MenuItem_confirm::confirm_screen( \ - GCODE_LAMBDA_MAIN(N), nullptr, \ - PSTR(MAIN_MENU_ITEM_##N##_DESC "?") \ - ); \ + #define _CUSTOM_ITEM_MAIN(N) ACTION_ITEM_F(F(MAIN_MENU_ITEM_##N##_DESC), GCODE_LAMBDA_MAIN(N)); + #define _CUSTOM_ITEM_MAIN_CONFIRM(N) \ + SUBMENU_F(F(MAIN_MENU_ITEM_##N##_DESC), []{ \ + MenuItem_confirm::confirm_screen( \ + GCODE_LAMBDA_MAIN(N), nullptr, \ + F(MAIN_MENU_ITEM_##N##_DESC "?") \ + ); \ }) #define CUSTOM_ITEM_MAIN(N) do{ \ @@ -247,10 +247,10 @@ void menu_main() { if (card_detected) { if (!card_open) { #if PIN_EXISTS(SD_DETECT) - GCODES_ITEM(MSG_CHANGE_MEDIA, PSTR("M21")); // M21 Change Media - #else // - or - - ACTION_ITEM(MSG_RELEASE_MEDIA, []{ // M22 Release Media - queue.inject(PSTR("M22")); + GCODES_ITEM(MSG_CHANGE_MEDIA, F("M21")); // M21 Change Media + #else // - or - + ACTION_ITEM(MSG_RELEASE_MEDIA, []{ // M22 Release Media + queue.inject(F("M22")); #if ENABLED(TFT_COLOR_UI) // Menu display issue on item removal with multi language selection menu if (encoderTopLine > 0) encoderTopLine--; @@ -258,14 +258,14 @@ void menu_main() { #endif }); #endif - SUBMENU(MSG_MEDIA_MENU, MEDIA_MENU_GATEWAY); // Media Menu (or Password First) + SUBMENU(MSG_MEDIA_MENU, MEDIA_MENU_GATEWAY); // Media Menu (or Password First) } } else { #if PIN_EXISTS(SD_DETECT) - ACTION_ITEM(MSG_NO_MEDIA, nullptr); // "No Media" + ACTION_ITEM(MSG_NO_MEDIA, nullptr); // "No Media" #else - GCODES_ITEM(MSG_ATTACH_MEDIA, PSTR("M21")); // M21 Attach Media + GCODES_ITEM(MSG_ATTACH_MEDIA, F("M21")); // M21 Attach Media #endif } }; @@ -279,9 +279,9 @@ void menu_main() { #if MACHINE_CAN_STOP SUBMENU(MSG_STOP_PRINT, []{ MenuItem_confirm::select_screen( - GET_TEXT(MSG_BUTTON_STOP), GET_TEXT(MSG_BACK), + GET_TEXT_F(MSG_BUTTON_STOP), GET_TEXT_F(MSG_BACK), ui.abort_print, nullptr, - GET_TEXT(MSG_STOP_PRINT), (const char *)nullptr, PSTR("?") + GET_TEXT_F(MSG_STOP_PRINT), (const char *)nullptr, F("?") ); }); #endif @@ -342,7 +342,7 @@ void menu_main() { #if ENABLED(CUSTOM_MENU_MAIN) if (TERN1(CUSTOM_MENU_MAIN_ONLY_IDLE, !busy)) { #ifdef CUSTOM_MENU_MAIN_TITLE - SUBMENU_P(PSTR(CUSTOM_MENU_MAIN_TITLE), custom_menus_main); + SUBMENU_F(F(CUSTOM_MENU_MAIN_TITLE), custom_menus_main); #else SUBMENU(MSG_CUSTOM_COMMANDS, custom_menus_main); #endif @@ -353,7 +353,7 @@ void menu_main() { #if E_STEPPERS == 1 && DISABLED(FILAMENT_LOAD_UNLOAD_GCODES) YESNO_ITEM(MSG_FILAMENTCHANGE, menu_change_filament, nullptr, - GET_TEXT(MSG_FILAMENTCHANGE), (const char *)nullptr, PSTR("?") + GET_TEXT_F(MSG_FILAMENTCHANGE), (const char *)nullptr, F("?") ); #else SUBMENU(MSG_FILAMENTCHANGE, menu_change_filament); @@ -377,13 +377,13 @@ void menu_main() { CONFIRM_ITEM(MSG_SWITCH_PS_OFF, MSG_YES, MSG_NO, ui.poweroff, nullptr, - GET_TEXT(MSG_SWITCH_PS_OFF), (const char *)nullptr, PSTR("?") + GET_TEXT_F(MSG_SWITCH_PS_OFF), (const char *)nullptr, F("?") ); #else ACTION_ITEM(MSG_SWITCH_PS_OFF, ui.poweroff); #endif else - GCODES_ITEM(MSG_SWITCH_PS_ON, PSTR("M80")); + GCODES_ITEM(MSG_SWITCH_PS_ON, F("M80")); #endif #if ENABLED(SDSUPPORT) && DISABLED(MEDIA_MENU_AT_TOP) @@ -398,24 +398,24 @@ void menu_main() { ui.return_to_status(); }; #if SERVICE_INTERVAL_1 > 0 - CONFIRM_ITEM_P(PSTR(SERVICE_NAME_1), + CONFIRM_ITEM_F(F(SERVICE_NAME_1), MSG_BUTTON_RESET, MSG_BUTTON_CANCEL, []{ _service_reset(1); }, nullptr, - GET_TEXT(MSG_SERVICE_RESET), F(SERVICE_NAME_1), PSTR("?") + GET_TEXT_F(MSG_SERVICE_RESET), F(SERVICE_NAME_1), F("?") ); #endif #if SERVICE_INTERVAL_2 > 0 - CONFIRM_ITEM_P(PSTR(SERVICE_NAME_2), + CONFIRM_ITEM_F(F(SERVICE_NAME_2), MSG_BUTTON_RESET, MSG_BUTTON_CANCEL, []{ _service_reset(2); }, nullptr, - GET_TEXT(MSG_SERVICE_RESET), F(SERVICE_NAME_2), PSTR("?") + GET_TEXT_F(MSG_SERVICE_RESET), F(SERVICE_NAME_2), F("?") ); #endif #if SERVICE_INTERVAL_3 > 0 - CONFIRM_ITEM_P(PSTR(SERVICE_NAME_3), + CONFIRM_ITEM_F(F(SERVICE_NAME_3), MSG_BUTTON_RESET, MSG_BUTTON_CANCEL, []{ _service_reset(3); }, nullptr, - GET_TEXT(MSG_SERVICE_RESET), F(SERVICE_NAME_3), PSTR("?") + GET_TEXT_F(MSG_SERVICE_RESET), F(SERVICE_NAME_3), F("?") ); #endif #endif @@ -451,9 +451,9 @@ void menu_main() { #if ENABLED(HOST_SHUTDOWN_MENU_ITEM) && defined(SHUTDOWN_ACTION) SUBMENU(MSG_HOST_SHUTDOWN, []{ MenuItem_confirm::select_screen( - GET_TEXT(MSG_BUTTON_PROCEED), GET_TEXT(MSG_BUTTON_CANCEL), + GET_TEXT_F(MSG_BUTTON_PROCEED), GET_TEXT_F(MSG_BUTTON_CANCEL), []{ ui.return_to_status(); hostui.shutdown(); }, nullptr, - GET_TEXT(MSG_HOST_SHUTDOWN), (const char *)nullptr, PSTR("?") + GET_TEXT_F(MSG_HOST_SHUTDOWN), (const char *)nullptr, F("?") ); }); #endif diff --git a/Marlin/src/lcd/menu/menu_media.cpp b/Marlin/src/lcd/menu/menu_media.cpp index db1baa9bee6f..e979f04e119d 100644 --- a/Marlin/src/lcd/menu/menu_media.cpp +++ b/Marlin/src/lcd/menu/menu_media.cpp @@ -61,10 +61,10 @@ inline void sdcard_start_selected_file() { class MenuItem_sdfile : public MenuItem_sdbase { public: - static inline void draw(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard) { - MenuItem_sdbase::draw(sel, row, pstr, theCard, false); + static inline void draw(const bool sel, const uint8_t row, FSTR_P const fstr, CardReader &theCard) { + MenuItem_sdbase::draw(sel, row, fstr, theCard, false); } - static void action(PGM_P const pstr, CardReader &) { + static void action(FSTR_P const fstr, CardReader &) { #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) // Save menu state for the selected file sd_encoder_position = ui.encoderPosition; @@ -72,30 +72,30 @@ class MenuItem_sdfile : public MenuItem_sdbase { sd_items = screen_items; #endif #if ENABLED(SD_MENU_CONFIRM_START) - MenuItem_submenu::action(pstr, []{ + MenuItem_submenu::action(fstr, []{ char * const longest = card.longest_filename(); char buffer[strlen(longest) + 2]; buffer[0] = ' '; strcpy(buffer + 1, longest); MenuItem_confirm::select_screen( - GET_TEXT(MSG_BUTTON_PRINT), GET_TEXT(MSG_BUTTON_CANCEL), + GET_TEXT_F(MSG_BUTTON_PRINT), GET_TEXT_F(MSG_BUTTON_CANCEL), sdcard_start_selected_file, nullptr, - GET_TEXT(MSG_START_PRINT), buffer, PSTR("?") + GET_TEXT_F(MSG_START_PRINT), buffer, F("?") ); }); #else sdcard_start_selected_file(); - UNUSED(pstr); + UNUSED(fstr); #endif } }; class MenuItem_sdfolder : public MenuItem_sdbase { public: - static inline void draw(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard) { - MenuItem_sdbase::draw(sel, row, pstr, theCard, true); + static inline void draw(const bool sel, const uint8_t row, FSTR_P const fstr, CardReader &theCard) { + MenuItem_sdbase::draw(sel, row, fstr, theCard, true); } - static void action(PGM_P const, CardReader &theCard) { + static void action(FSTR_P const, CardReader &theCard) { card.cd(theCard.filename); encoderTopLine = 0; ui.encoderPosition = 2 * (ENCODER_STEPS_PER_MENU_ITEM); @@ -119,7 +119,7 @@ void menu_media_filelist() { #if ENABLED(MULTI_VOLUME) ACTION_ITEM(MSG_BACK, []{ ui.goto_screen(menu_media); }); #else - BACK_ITEM_P(TERN1(BROWSE_MEDIA_ON_INSERT, screen_history_depth) ? GET_TEXT(MSG_MAIN) : GET_TEXT(MSG_BACK)); + BACK_ITEM_F(TERN1(BROWSE_MEDIA_ON_INSERT, screen_history_depth) ? GET_TEXT_F(MSG_MAIN) : GET_TEXT_F(MSG_BACK)); #endif if (card.flag.workDirIsRoot) { #if !PIN_EXISTS(SD_DETECT) @@ -127,7 +127,7 @@ void menu_media_filelist() { #endif } else if (card.isMounted()) - ACTION_ITEM_P(PSTR(LCD_STR_FOLDER " .."), lcd_sd_updir); + ACTION_ITEM_F(F(LCD_STR_FOLDER " .."), lcd_sd_updir); if (ui.should_draw()) for (uint16_t i = 0; i < fileCnt; i++) { if (_menuLineNr == _thisItemNr) { @@ -146,7 +146,7 @@ void menu_media_filelist() { #if ENABLED(MULTI_VOLUME) void menu_media_select() { START_MENU(); - BACK_ITEM_P(TERN1(BROWSE_MEDIA_ON_INSERT, screen_history_depth) ? GET_TEXT(MSG_MAIN) : GET_TEXT(MSG_BACK)); + BACK_ITEM_F(TERN1(BROWSE_MEDIA_ON_INSERT, screen_history_depth) ? GET_TEXT_F(MSG_MAIN) : GET_TEXT_F(MSG_BACK)); #if ENABLED(VOLUME_SD_ONBOARD) ACTION_ITEM(MSG_SD_CARD, []{ card.changeMedia(&card.media_driver_sdcard); card.mount(); ui.goto_screen(menu_media_filelist); }); #endif diff --git a/Marlin/src/lcd/menu/menu_mixer.cpp b/Marlin/src/lcd/menu/menu_mixer.cpp index f91f62ef8393..feb4c59f181c 100644 --- a/Marlin/src/lcd/menu/menu_mixer.cpp +++ b/Marlin/src/lcd/menu/menu_mixer.cpp @@ -89,15 +89,15 @@ char tmp[18]; - PGM_P const slabel = GET_TEXT(MSG_START_Z); - SUBMENU_P(slabel, []{ _lcd_mixer_gradient_z_edit(false); }); + FSTR_P const slabel = GET_TEXT_F(MSG_START_Z); + SUBMENU_F(slabel, []{ _lcd_mixer_gradient_z_edit(false); }); MENU_ITEM_ADDON_START_RJ(11); sprintf_P(tmp, PSTR("%4d.%d mm"), int(mixer.gradient.start_z), int(mixer.gradient.start_z * 10) % 10); lcd_put_u8str(tmp); MENU_ITEM_ADDON_END(); - PGM_P const elabel = GET_TEXT(MSG_END_Z); - SUBMENU_P(elabel, []{ _lcd_mixer_gradient_z_edit(true); }); + FSTR_P const elabel = GET_TEXT_F(MSG_END_Z); + SUBMENU_F(elabel, []{ _lcd_mixer_gradient_z_edit(true); }); MENU_ITEM_ADDON_START_RJ(11); sprintf_P(tmp, PSTR("%4d.%d mm"), int(mixer.gradient.end_z), int(mixer.gradient.end_z * 10) % 10); lcd_put_u8str(tmp); @@ -257,7 +257,7 @@ void menu_mixer() { ui.return_to_status(); }, nullptr, - GET_TEXT(MSG_RESET_VTOOLS), (const char *)nullptr, PSTR("?") + GET_TEXT_F(MSG_RESET_VTOOLS), (const char *)nullptr, F("?") ); #if ENABLED(GRADIENT_MIX) diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index 4b42bd8136da..e762089075aa 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -57,7 +57,7 @@ // "Motion" > "Move Axis" submenu // -static void _lcd_move_xyz(PGM_P const name, const AxisEnum axis) { +static void _lcd_move_xyz(FSTR_P const name, const AxisEnum axis) { if (ui.use_click()) return ui.goto_previous_screen_no_defer(); if (ui.encoderPosition && !ui.manual_move.processing) { // Get motion limit from software endstops, if any @@ -90,30 +90,30 @@ static void _lcd_move_xyz(PGM_P const name, const AxisEnum axis) { MenuEditItemBase::draw_edit_screen(name, ui.manual_move.menu_scale >= 0.1f ? (LARGE_AREA_TEST ? ftostr51sign(pos) : ftostr41sign(pos)) : ftostr63(pos)); } } -void lcd_move_x() { _lcd_move_xyz(GET_TEXT(MSG_MOVE_X), X_AXIS); } +void lcd_move_x() { _lcd_move_xyz(GET_TEXT_F(MSG_MOVE_X), X_AXIS); } #if HAS_Y_AXIS - void lcd_move_y() { _lcd_move_xyz(GET_TEXT(MSG_MOVE_Y), Y_AXIS); } + void lcd_move_y() { _lcd_move_xyz(GET_TEXT_F(MSG_MOVE_Y), Y_AXIS); } #endif #if HAS_Z_AXIS - void lcd_move_z() { _lcd_move_xyz(GET_TEXT(MSG_MOVE_Z), Z_AXIS); } + void lcd_move_z() { _lcd_move_xyz(GET_TEXT_F(MSG_MOVE_Z), Z_AXIS); } #endif #if HAS_I_AXIS - void lcd_move_i() { _lcd_move_xyz(GET_TEXT(MSG_MOVE_I), I_AXIS); } + void lcd_move_i() { _lcd_move_xyz(GET_TEXT_F(MSG_MOVE_I), I_AXIS); } #endif #if HAS_J_AXIS - void lcd_move_j() { _lcd_move_xyz(GET_TEXT(MSG_MOVE_J), J_AXIS); } + void lcd_move_j() { _lcd_move_xyz(GET_TEXT_F(MSG_MOVE_J), J_AXIS); } #endif #if HAS_K_AXIS - void lcd_move_k() { _lcd_move_xyz(GET_TEXT(MSG_MOVE_K), K_AXIS); } + void lcd_move_k() { _lcd_move_xyz(GET_TEXT_F(MSG_MOVE_K), K_AXIS); } #endif #if HAS_U_AXIS - void lcd_move_u() { _lcd_move_xyz(GET_TEXT(MSG_MOVE_U), U_AXIS); } + void lcd_move_u() { _lcd_move_xyz(GET_TEXT_F(MSG_MOVE_U), U_AXIS); } #endif #if HAS_V_AXIS - void lcd_move_v() { _lcd_move_xyz(GET_TEXT(MSG_MOVE_V), V_AXIS); } + void lcd_move_v() { _lcd_move_xyz(GET_TEXT_F(MSG_MOVE_V), V_AXIS); } #endif #if HAS_W_AXIS - void lcd_move_w() { _lcd_move_xyz(GET_TEXT(MSG_MOVE_W), W_AXIS); } + void lcd_move_w() { _lcd_move_xyz(GET_TEXT_F(MSG_MOVE_W), W_AXIS); } #endif #if E_MANUAL @@ -132,7 +132,7 @@ void lcd_move_x() { _lcd_move_xyz(GET_TEXT(MSG_MOVE_X), X_AXIS); } if (ui.should_draw()) { TERN_(MULTI_E_MANUAL, MenuItemBase::init(eindex)); MenuEditItemBase::draw_edit_screen( - GET_TEXT(TERN(MULTI_E_MANUAL, MSG_MOVE_EN, MSG_MOVE_E)), + GET_TEXT_F(TERN(MULTI_E_MANUAL, MSG_MOVE_EN, MSG_MOVE_E)), ftostr41sign(current_position.e PLUS_TERN0(IS_KINEMATIC, ui.manual_move.offset) MINUS_TERN0(MANUAL_E_MOVES_RELATIVE, manual_move_e_origin) @@ -203,12 +203,12 @@ void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int char tmp[strlen_P(label) + 10 + 1], numstr[10]; sprintf_P(tmp, label, dtostrf(FINE_MANUAL_MOVE, 1, digs, numstr)); #if DISABLED(HAS_GRAPHICAL_TFT) - SUBMENU_P(NUL_STR, []{ _goto_manual_move(float(FINE_MANUAL_MOVE)); }); + SUBMENU_F(FPSTR(NUL_STR), []{ _goto_manual_move(float(FINE_MANUAL_MOVE)); }); MENU_ITEM_ADDON_START(0 + ENABLED(HAS_MARLINUI_HD44780)); lcd_put_u8str(tmp); MENU_ITEM_ADDON_END(); #else - SUBMENU_P(tmp, []{ _goto_manual_move(float(FINE_MANUAL_MOVE)); }); + SUBMENU_F(FPSTR(tmp), []{ _goto_manual_move(float(FINE_MANUAL_MOVE)); }); #endif } } @@ -227,9 +227,9 @@ void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int if (too_cold) { ui.goto_screen([]{ MenuItem_confirm::select_screen( - GET_TEXT(MSG_BUTTON_PROCEED), GET_TEXT(MSG_BACK), + GET_TEXT_F(MSG_BUTTON_PROCEED), GET_TEXT_F(MSG_BACK), _goto_menu_move_distance_e, nullptr, - GET_TEXT(MSG_HOTEND_TOO_COLD), (const char *)nullptr, PSTR("!") + GET_TEXT_F(MSG_HOTEND_TOO_COLD), (const char *)nullptr, F("!") ); }); return; @@ -283,41 +283,41 @@ void menu_move() { #endif } else - GCODES_ITEM(MSG_AUTO_HOME, G28_STR); + GCODES_ITEM(MSG_AUTO_HOME, FPSTR(G28_STR)); #if ANY(SWITCHING_EXTRUDER, SWITCHING_NOZZLE, MAGNETIC_SWITCHING_TOOLHEAD) #if EXTRUDERS >= 4 switch (active_extruder) { - case 0: GCODES_ITEM_N(1, MSG_SELECT_E, PSTR("T1")); break; - case 1: GCODES_ITEM_N(0, MSG_SELECT_E, PSTR("T0")); break; - case 2: GCODES_ITEM_N(3, MSG_SELECT_E, PSTR("T3")); break; - case 3: GCODES_ITEM_N(2, MSG_SELECT_E, PSTR("T2")); break; + case 0: GCODES_ITEM_N(1, MSG_SELECT_E, F("T1")); break; + case 1: GCODES_ITEM_N(0, MSG_SELECT_E, F("T0")); break; + case 2: GCODES_ITEM_N(3, MSG_SELECT_E, F("T3")); break; + case 3: GCODES_ITEM_N(2, MSG_SELECT_E, F("T2")); break; #if EXTRUDERS == 6 - case 4: GCODES_ITEM_N(5, MSG_SELECT_E, PSTR("T5")); break; - case 5: GCODES_ITEM_N(4, MSG_SELECT_E, PSTR("T4")); break; + case 4: GCODES_ITEM_N(5, MSG_SELECT_E, F("T5")); break; + case 5: GCODES_ITEM_N(4, MSG_SELECT_E, F("T4")); break; #endif } #elif EXTRUDERS == 3 if (active_extruder < 2) { if (active_extruder) - GCODES_ITEM_N(0, MSG_SELECT_E, PSTR("T0")); + GCODES_ITEM_N(0, MSG_SELECT_E, F("T0")); else - GCODES_ITEM_N(1, MSG_SELECT_E, PSTR("T1")); + GCODES_ITEM_N(1, MSG_SELECT_E, F("T1")); } #else if (active_extruder) - GCODES_ITEM_N(0, MSG_SELECT_E, PSTR("T0")); + GCODES_ITEM_N(0, MSG_SELECT_E, F("T0")); else - GCODES_ITEM_N(1, MSG_SELECT_E, PSTR("T1")); + GCODES_ITEM_N(1, MSG_SELECT_E, F("T1")); #endif #elif ENABLED(DUAL_X_CARRIAGE) if (active_extruder) - GCODES_ITEM_N(0, MSG_SELECT_E, PSTR("T0")); + GCODES_ITEM_N(0, MSG_SELECT_E, F("T0")); else - GCODES_ITEM_N(1, MSG_SELECT_E, PSTR("T1")); + GCODES_ITEM_N(1, MSG_SELECT_E, F("T1")); #endif @@ -355,31 +355,31 @@ void menu_move() { START_MENU(); BACK_ITEM(MSG_MOTION); - GCODES_ITEM(MSG_AUTO_HOME, G28_STR); - GCODES_ITEM_N(X_AXIS, MSG_AUTO_HOME_A, PSTR("G28X")); + GCODES_ITEM(MSG_AUTO_HOME, FPSTR(G28_STR)); + GCODES_ITEM_N(X_AXIS, MSG_AUTO_HOME_A, F("G28X")); #if HAS_Y_AXIS - GCODES_ITEM_N(Y_AXIS, MSG_AUTO_HOME_A, PSTR("G28Y")); + GCODES_ITEM_N(Y_AXIS, MSG_AUTO_HOME_A, F("G28Y")); #endif #if HAS_Z_AXIS - GCODES_ITEM_N(Z_AXIS, MSG_AUTO_HOME_A, PSTR("G28Z")); + GCODES_ITEM_N(Z_AXIS, MSG_AUTO_HOME_A, F("G28Z")); #endif #if HAS_I_AXIS - GCODES_ITEM_N(I_AXIS, MSG_AUTO_HOME_A, PSTR("G28" STR_I)); + GCODES_ITEM_N(I_AXIS, MSG_AUTO_HOME_A, F("G28" STR_I)); #endif #if HAS_J_AXIS - GCODES_ITEM_N(J_AXIS, MSG_AUTO_HOME_A, PSTR("G28" STR_J)); + GCODES_ITEM_N(J_AXIS, MSG_AUTO_HOME_A, F("G28" STR_J)); #endif #if HAS_K_AXIS - GCODES_ITEM_N(K_AXIS, MSG_AUTO_HOME_A, PSTR("G28" STR_K)); + GCODES_ITEM_N(K_AXIS, MSG_AUTO_HOME_A, F("G28" STR_K)); #endif #if HAS_U_AXIS - GCODES_ITEM_N(U_AXIS, MSG_AUTO_HOME_A, PSTR("G28" STR_U)); + GCODES_ITEM_N(U_AXIS, MSG_AUTO_HOME_A, F("G28" STR_U)); #endif #if HAS_V_AXIS - GCODES_ITEM_N(V_AXIS, MSG_AUTO_HOME_A, PSTR("G28" STR_V)); + GCODES_ITEM_N(V_AXIS, MSG_AUTO_HOME_A, F("G28" STR_V)); #endif #if HAS_W_AXIS - GCODES_ITEM_N(W_AXIS, MSG_AUTO_HOME_A, PSTR("G28" STR_W)); + GCODES_ITEM_N(W_AXIS, MSG_AUTO_HOME_A, F("G28" STR_W)); #endif END_MENU(); @@ -416,32 +416,32 @@ void menu_motion() { #if ENABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU) SUBMENU(MSG_HOMING, menu_home); #else - GCODES_ITEM(MSG_AUTO_HOME, G28_STR); + GCODES_ITEM(MSG_AUTO_HOME, FPSTR(G28_STR)); #if ENABLED(INDIVIDUAL_AXIS_HOMING_MENU) - GCODES_ITEM_N(X_AXIS, MSG_AUTO_HOME_A, PSTR("G28X")); + GCODES_ITEM_N(X_AXIS, MSG_AUTO_HOME_A, F("G28X")); #if HAS_Y_AXIS - GCODES_ITEM_N(Y_AXIS, MSG_AUTO_HOME_A, PSTR("G28Y")); + GCODES_ITEM_N(Y_AXIS, MSG_AUTO_HOME_A, F("G28Y")); #endif #if HAS_Z_AXIS - GCODES_ITEM_N(Z_AXIS, MSG_AUTO_HOME_A, PSTR("G28Z")); + GCODES_ITEM_N(Z_AXIS, MSG_AUTO_HOME_A, F("G28Z")); #endif #if HAS_I_AXIS - GCODES_ITEM_N(I_AXIS, MSG_AUTO_HOME_A, PSTR("G28" STR_I)); + GCODES_ITEM_N(I_AXIS, MSG_AUTO_HOME_A, F("G28" STR_I)); #endif #if HAS_J_AXIS - GCODES_ITEM_N(J_AXIS, MSG_AUTO_HOME_A, PSTR("G28" STR_J)); + GCODES_ITEM_N(J_AXIS, MSG_AUTO_HOME_A, F("G28" STR_J)); #endif #if HAS_K_AXIS - GCODES_ITEM_N(K_AXIS, MSG_AUTO_HOME_A, PSTR("G28" STR_K)); + GCODES_ITEM_N(K_AXIS, MSG_AUTO_HOME_A, F("G28" STR_K)); #endif #if HAS_U_AXIS - GCODES_ITEM_N(U_AXIS, MSG_AUTO_HOME_A, PSTR("G28" STR_U)); + GCODES_ITEM_N(U_AXIS, MSG_AUTO_HOME_A, F("G28" STR_U)); #endif #if HAS_V_AXIS - GCODES_ITEM_N(V_AXIS, MSG_AUTO_HOME_A, PSTR("G28" STR_V)); + GCODES_ITEM_N(V_AXIS, MSG_AUTO_HOME_A, F("G28" STR_V)); #endif #if HAS_W_AXIS - GCODES_ITEM_N(W_AXIS, MSG_AUTO_HOME_A, PSTR("G28" STR_W)); + GCODES_ITEM_N(W_AXIS, MSG_AUTO_HOME_A, F("G28" STR_W)); #endif #endif #endif @@ -450,14 +450,14 @@ void menu_motion() { // Auto-calibration // #if ENABLED(CALIBRATION_GCODE) - GCODES_ITEM(MSG_AUTO_CALIBRATE, PSTR("G425")); + GCODES_ITEM(MSG_AUTO_CALIBRATE, F("G425")); #endif // // Auto Z-Align // #if EITHER(Z_STEPPER_AUTO_ALIGN, MECHANICAL_GANTRY_CALIBRATION) - GCODES_ITEM(MSG_AUTO_Z_ALIGN, PSTR("G34")); + GCODES_ITEM(MSG_AUTO_Z_ALIGN, F("G34")); #endif // @@ -482,7 +482,7 @@ void menu_motion() { #elif HAS_LEVELING && DISABLED(SLIM_LCD_MENUS) #if DISABLED(PROBE_MANUALLY) - GCODES_ITEM(MSG_LEVEL_BED, PSTR("G29N")); + GCODES_ITEM(MSG_LEVEL_BED, F("G29N")); #endif if (all_axes_homed() && leveling_is_valid()) { @@ -502,13 +502,13 @@ void menu_motion() { #endif #if ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST) - GCODES_ITEM(MSG_M48_TEST, PSTR("G28O\nM48 P10")); + GCODES_ITEM(MSG_M48_TEST, F("G28O\nM48 P10")); #endif // // Disable Steppers // - GCODES_ITEM(MSG_DISABLE_STEPPERS, PSTR("M84")); + GCODES_ITEM(MSG_DISABLE_STEPPERS, F("M84")); END_MENU(); } diff --git a/Marlin/src/lcd/menu/menu_password.cpp b/Marlin/src/lcd/menu/menu_password.cpp index 32059103b3f4..89ea42d70477 100644 --- a/Marlin/src/lcd/menu/menu_password.cpp +++ b/Marlin/src/lcd/menu/menu_password.cpp @@ -49,18 +49,18 @@ void Password::menu_password_entry() { START_MENU(); // "Login" or "New Code" - STATIC_ITEM_P(authenticating ? GET_TEXT(MSG_LOGIN_REQUIRED) : GET_TEXT(MSG_EDIT_PASSWORD), SS_CENTER|SS_INVERT); + STATIC_ITEM_F(authenticating ? GET_TEXT_F(MSG_LOGIN_REQUIRED) : GET_TEXT_F(MSG_EDIT_PASSWORD), SS_CENTER|SS_INVERT); - STATIC_ITEM_P(NUL_STR, SS_CENTER, string); + STATIC_ITEM_F(FPSTR(NUL_STR), SS_CENTER, string); #if HAS_MARLINUI_U8GLIB - STATIC_ITEM_P(NUL_STR, SS_CENTER, ""); + STATIC_ITEM_F(FPSTR(NUL_STR), SS_CENTER, ""); #endif // Make the digit edit item look like a sub-menu - PGM_P const label = GET_TEXT(MSG_ENTER_DIGIT); - EDIT_ITEM_P(uint8, label, &editable.uint8, 0, 9, digit_entered); - MENU_ITEM_ADDON_START(utf8_strlen_P(label) + 1); + FSTR_P const label = GET_TEXT_F(MSG_ENTER_DIGIT); + EDIT_ITEM_F(uint8, label, &editable.uint8, 0, 9, digit_entered); + MENU_ITEM_ADDON_START(utf8_strlen(label) + 1); lcd_put_wchar(' '); lcd_put_wchar('1' + digit_no); SETCURSOR_X(LCD_WIDTH - 2); diff --git a/Marlin/src/lcd/menu/menu_probe_offset.cpp b/Marlin/src/lcd/menu/menu_probe_offset.cpp index 79db47005d0a..6271b314f404 100644 --- a/Marlin/src/lcd/menu/menu_probe_offset.cpp +++ b/Marlin/src/lcd/menu/menu_probe_offset.cpp @@ -62,7 +62,7 @@ void probe_offset_wizard_menu() { if (LCD_HEIGHT >= 4) STATIC_ITEM(MSG_MOVE_NOZZLE_TO_BED, SS_CENTER|SS_INVERT); - STATIC_ITEM_P(PSTR("Z"), SS_CENTER, ftostr42_52(current_position.z)); + STATIC_ITEM_F(F("Z"), SS_CENTER, ftostr42_52(current_position.z)); STATIC_ITEM(MSG_ZPROBE_ZOFFSET, SS_LEFT, ftostr42_52(calculated_z_offset)); SUBMENU(MSG_MOVE_1MM, []{ _goto_manual_move_z( 1); }); @@ -75,12 +75,12 @@ void probe_offset_wizard_menu() { !UNEAR_ZERO((FINE_MANUAL_MOVE) * 100 - int((FINE_MANUAL_MOVE) * 100)) ? 3 : 2; sprintf_P(tmp, GET_TEXT(MSG_MOVE_N_MM), dtostrf(FINE_MANUAL_MOVE, 1, digs, numstr)); #if DISABLED(HAS_GRAPHICAL_TFT) - SUBMENU_P(NUL_STR, []{ _goto_manual_move_z(float(FINE_MANUAL_MOVE)); }); + SUBMENU_F(FPSTR(NUL_STR), []{ _goto_manual_move_z(float(FINE_MANUAL_MOVE)); }); MENU_ITEM_ADDON_START(0 + ENABLED(HAS_MARLINUI_HD44780)); lcd_put_u8str(tmp); MENU_ITEM_ADDON_END(); #else - SUBMENU_P(tmp, []{ _goto_manual_move_z(float(FINE_MANUAL_MOVE)); }); + SUBMENU_F(tmp, []{ _goto_manual_move_z(float(FINE_MANUAL_MOVE)); }); #endif } @@ -107,7 +107,7 @@ void probe_offset_wizard_menu() { void prepare_for_probe_offset_wizard() { #if defined(PROBE_OFFSET_WIZARD_XY_POS) || !HOMING_Z_WITH_PROBE - if (ui.should_draw()) MenuItem_static::draw(1, GET_TEXT(MSG_PROBE_WIZARD_PROBING)); + if (ui.should_draw()) MenuItem_static::draw(1, GET_TEXT_F(MSG_PROBE_WIZARD_PROBING)); if (ui.wait_for_move) return; @@ -133,7 +133,7 @@ void prepare_for_probe_offset_wizard() { ui.wait_for_move = true; current_position += probe.offset_xy; line_to_current_position(MMM_TO_MMS(XY_PROBE_FEEDRATE)); - ui.synchronize(GET_TEXT(MSG_PROBE_WIZARD_MOVING)); + ui.synchronize(GET_TEXT_F(MSG_PROBE_WIZARD_MOVING)); ui.wait_for_move = false; SET_SOFT_ENDSTOP_LOOSE(true); // Disable soft endstops for free Z movement diff --git a/Marlin/src/lcd/menu/menu_spindle_laser.cpp b/Marlin/src/lcd/menu/menu_spindle_laser.cpp index 306d3d6c57df..9efd68ca005d 100644 --- a/Marlin/src/lcd/menu/menu_spindle_laser.cpp +++ b/Marlin/src/lcd/menu/menu_spindle_laser.cpp @@ -64,7 +64,7 @@ #if ENABLED(SPINDLE_CHANGE_DIR) if (!is_enabled) { editable.state = is_rev; - ACTION_ITEM_P(is_rev ? GET_TEXT(MSG_CUTTER(REVERSE)) : GET_TEXT(MSG_CUTTER(FORWARD)), []{ cutter.set_reverse(!editable.state); }); + ACTION_ITEM_F(is_rev ? GET_TEXT_F(MSG_CUTTER(REVERSE)) : GET_TEXT_F(MSG_CUTTER(FORWARD)), []{ cutter.set_reverse(!editable.state); }); } #endif diff --git a/Marlin/src/lcd/menu/menu_tmc.cpp b/Marlin/src/lcd/menu/menu_tmc.cpp index 995bc3b195ed..c3503ede41cd 100644 --- a/Marlin/src/lcd/menu/menu_tmc.cpp +++ b/Marlin/src/lcd/menu/menu_tmc.cpp @@ -32,7 +32,7 @@ #include "../../module/stepper/indirection.h" #include "../../feature/tmc_util.h" -#define TMC_EDIT_STORED_I_RMS(ST,STR) EDIT_ITEM_P(uint16_4, PSTR(STR), &stepper##ST.val_mA, 100, 3000, []{ stepper##ST.refresh_stepper_current(); }) +#define TMC_EDIT_STORED_I_RMS(ST,STR) EDIT_ITEM_F(uint16_4, F(STR), &stepper##ST.val_mA, 100, 3000, []{ stepper##ST.refresh_stepper_current(); }) void menu_tmc_current() { START_MENU(); @@ -90,7 +90,7 @@ void menu_tmc_current() { #if ENABLED(HYBRID_THRESHOLD) - #define TMC_EDIT_STORED_HYBRID_THRS(ST, STR) EDIT_ITEM_P(uint8, PSTR(STR), &stepper##ST.stored.hybrid_thrs, 0, 255, []{ stepper##ST.refresh_hybrid_thrs(); }); + #define TMC_EDIT_STORED_HYBRID_THRS(ST, STR) EDIT_ITEM_F(uint8, F(STR), &stepper##ST.stored.hybrid_thrs, 0, 255, []{ stepper##ST.refresh_hybrid_thrs(); }); void menu_tmc_hybrid_thrs() { START_MENU(); @@ -118,7 +118,7 @@ void menu_tmc_current() { #if ENABLED(SENSORLESS_HOMING) - #define TMC_EDIT_STORED_SGT(ST) EDIT_ITEM_P(int4, PSTR(STR_##ST), &stepper##ST.stored.homing_thrs, stepper##ST.sgt_min, stepper##ST.sgt_max, []{ stepper##ST.refresh_homing_thrs(); }); + #define TMC_EDIT_STORED_SGT(ST) EDIT_ITEM_F(int4, F(STR_##ST), &stepper##ST.stored.homing_thrs, stepper##ST.sgt_min, stepper##ST.sgt_max, []{ stepper##ST.refresh_homing_thrs(); }); void menu_tmc_homing_thrs() { START_MENU(); @@ -144,7 +144,7 @@ void menu_tmc_current() { #if HAS_STEALTHCHOP - #define TMC_EDIT_STEP_MODE(ST, STR) EDIT_ITEM_P(bool, PSTR(STR), &stepper##ST.stored.stealthChop_enabled, []{ stepper##ST.refresh_stepping_mode(); }) + #define TMC_EDIT_STEP_MODE(ST, STR) EDIT_ITEM_F(bool, F(STR), &stepper##ST.stored.stealthChop_enabled, []{ stepper##ST.refresh_stepping_mode(); }) void menu_tmc_step_mode() { START_MENU(); diff --git a/Marlin/src/lcd/menu/menu_tramming.cpp b/Marlin/src/lcd/menu/menu_tramming.cpp index 0789044d7d8e..1dd8a1cab6fd 100644 --- a/Marlin/src/lcd/menu/menu_tramming.cpp +++ b/Marlin/src/lcd/menu/menu_tramming.cpp @@ -83,7 +83,7 @@ static void tramming_wizard_menu() { // Draw a menu item for each tramming point for (tram_index = 0; tram_index < G35_PROBE_COUNT; tram_index++) - SUBMENU_P((PGM_P)pgm_read_ptr(&tramming_point_name[tram_index]), _menu_single_probe); + SUBMENU_F(FPSTR(pgm_read_ptr(&tramming_point_name[tram_index])), _menu_single_probe); ACTION_ITEM(MSG_BUTTON_DONE, []{ probe.stow(); // Stow before exiting Tramming Wizard diff --git a/Marlin/src/lcd/menu/menu_tune.cpp b/Marlin/src/lcd/menu/menu_tune.cpp index 40513f71ab7e..5d4c3a4bfb47 100644 --- a/Marlin/src/lcd/menu/menu_tune.cpp +++ b/Marlin/src/lcd/menu/menu_tune.cpp @@ -50,7 +50,7 @@ #include "../dogm/marlinui_DOGM.h" #endif - void _lcd_babystep(const AxisEnum axis, PGM_P const msg) { + void _lcd_babystep(const AxisEnum axis, FSTR_P const fmsg) { if (ui.use_click()) return ui.goto_previous_screen_no_defer(); if (ui.encoderPosition) { const int16_t steps = int16_t(ui.encoderPosition) * ( @@ -66,7 +66,7 @@ } if (ui.should_draw()) { const float mps = planner.mm_per_step[axis]; - MenuEditItemBase::draw_edit_screen(msg, BABYSTEP_TO_STR(mps * babystep.accum)); + MenuEditItemBase::draw_edit_screen(fmsg, BABYSTEP_TO_STR(mps * babystep.accum)); #if ENABLED(BABYSTEP_DISPLAY_TOTAL) const bool in_view = TERN1(HAS_MARLINUI_U8GLIB, PAGE_CONTAINS(LCD_PIXEL_HEIGHT - MENU_FONT_HEIGHT, LCD_PIXEL_HEIGHT - 1)); if (in_view) { @@ -94,12 +94,12 @@ } #if ENABLED(BABYSTEP_XY) - void _lcd_babystep_x() { _lcd_babystep(X_AXIS, GET_TEXT(MSG_BABYSTEP_X)); } - void _lcd_babystep_y() { _lcd_babystep(Y_AXIS, GET_TEXT(MSG_BABYSTEP_Y)); } + void _lcd_babystep_x() { _lcd_babystep(X_AXIS, GET_TEXT_F(MSG_BABYSTEP_X)); } + void _lcd_babystep_y() { _lcd_babystep(Y_AXIS, GET_TEXT_F(MSG_BABYSTEP_Y)); } #endif #if DISABLED(BABYSTEP_ZPROBE_OFFSET) - void _lcd_babystep_z() { _lcd_babystep(Z_AXIS, GET_TEXT(MSG_BABYSTEP_Z)); } + void _lcd_babystep_z() { _lcd_babystep(Z_AXIS, GET_TEXT_F(MSG_BABYSTEP_Z)); } void lcd_babystep_z() { _lcd_babystep_go(_lcd_babystep_z); } #endif diff --git a/Marlin/src/lcd/menu/menu_ubl.cpp b/Marlin/src/lcd/menu/menu_ubl.cpp index df60eaa6f5ae..297325348d23 100644 --- a/Marlin/src/lcd/menu/menu_ubl.cpp +++ b/Marlin/src/lcd/menu/menu_ubl.cpp @@ -67,7 +67,7 @@ inline float rounded_mesh_value() { * - Draw the graphical overlay, if enabled. * - Update the 'refresh' state according to the display type */ -void _lcd_mesh_fine_tune(PGM_P const msg) { +void _lcd_mesh_fine_tune(FSTR_P const fmsg) { constexpr float mesh_edit_step = 1.0f / 200.0f; ui.defer_status_screen(); if (bedlevel.encoder_diff) { @@ -82,7 +82,7 @@ void _lcd_mesh_fine_tune(PGM_P const msg) { if (ui.should_draw()) { const float rounded_f = rounded_mesh_value(); - MenuEditItemBase::draw_edit_screen(msg, ftostr43sign(rounded_f)); + MenuEditItemBase::draw_edit_screen(fmsg, ftostr43sign(rounded_f)); TERN_(MESH_EDIT_GFX_OVERLAY, ui.zoffset_overlay(rounded_f)); TERN_(HAS_GRAPHICAL_TFT, ui.refresh(LCDVIEW_NONE)); } @@ -95,7 +95,7 @@ void _lcd_mesh_fine_tune(PGM_P const msg) { void MarlinUI::ubl_mesh_edit_start(const_float_t initial) { TERN_(HAS_GRAPHICAL_TFT, clear_lcd()); mesh_edit_accumulator = initial; - goto_screen([]{ _lcd_mesh_fine_tune(GET_TEXT(MSG_MESH_EDIT_Z)); }); + goto_screen([]{ _lcd_mesh_fine_tune(GET_TEXT_F(MSG_MESH_EDIT_Z)); }); } // @@ -176,8 +176,8 @@ void _menu_ubl_height_adjust() { void _lcd_ubl_edit_mesh() { START_MENU(); BACK_ITEM(MSG_UBL_TOOLS); - GCODES_ITEM(MSG_UBL_FINE_TUNE_ALL, PSTR("G29P4RT")); - GCODES_ITEM(MSG_UBL_FINE_TUNE_CLOSEST, PSTR("G29P4T")); + GCODES_ITEM(MSG_UBL_FINE_TUNE_ALL, F("G29P4RT")); + GCODES_ITEM(MSG_UBL_FINE_TUNE_CLOSEST, F("G29P4T")); SUBMENU(MSG_UBL_MESH_HEIGHT_ADJUST, _menu_ubl_height_adjust); ACTION_ITEM(MSG_INFO_SCREEN, ui.return_to_status); END_MENU(); @@ -211,10 +211,10 @@ void _lcd_ubl_edit_mesh() { #if HAS_PREHEAT #if HAS_HEATED_BED #define VALIDATE_MESH_GCODE_ITEM(M) \ - GCODES_ITEM_N_S(M, ui.get_preheat_label(M), MSG_UBL_VALIDATE_MESH_M, PSTR("G28\nG26CPI" STRINGIFY(M))); + GCODES_ITEM_N_S(M, ui.get_preheat_label(M), MSG_UBL_VALIDATE_MESH_M, F("G28\nG26CPI" STRINGIFY(M))); #else #define VALIDATE_MESH_GCODE_ITEM(M) \ - GCODES_ITEM_N_S(M, ui.get_preheat_label(M), MSG_UBL_VALIDATE_MESH_M, PSTR("G28\nG26CPB0I" STRINGIFY(M))); + GCODES_ITEM_N_S(M, ui.get_preheat_label(M), MSG_UBL_VALIDATE_MESH_M, F("G28\nG26CPB0I" STRINGIFY(M))); #endif REPEAT(PREHEAT_COUNT, VALIDATE_MESH_GCODE_ITEM) #endif @@ -255,7 +255,7 @@ void _lcd_ubl_grid_level() { void _lcd_ubl_mesh_leveling() { START_MENU(); BACK_ITEM(MSG_UBL_TOOLS); - GCODES_ITEM(MSG_UBL_3POINT_MESH_LEVELING, PSTR("G29J0")); + GCODES_ITEM(MSG_UBL_3POINT_MESH_LEVELING, F("G29J0")); SUBMENU(MSG_UBL_GRID_MESH_LEVELING, _lcd_ubl_grid_level); ACTION_ITEM(MSG_INFO_SCREEN, ui.return_to_status); END_MENU(); @@ -284,8 +284,8 @@ void _menu_ubl_fillin() { START_MENU(); BACK_ITEM(MSG_UBL_BUILD_MESH_MENU); EDIT_ITEM(int3, MSG_UBL_FILLIN_AMOUNT, &ubl_fillin_amount, 0, 9, _lcd_ubl_fillin_amount_cmd); - GCODES_ITEM(MSG_UBL_SMART_FILLIN, PSTR("G29P3T0")); - GCODES_ITEM(MSG_UBL_MANUAL_FILLIN, PSTR("G29P2BT0")); + GCODES_ITEM(MSG_UBL_SMART_FILLIN, F("G29P3T0")); + GCODES_ITEM(MSG_UBL_MANUAL_FILLIN, F("G29P2BT0")); ACTION_ITEM(MSG_INFO_SCREEN, ui.return_to_status); END_MENU(); } @@ -318,7 +318,7 @@ void _lcd_ubl_build_mesh() { #define PREHEAT_BED_GCODE(M) "" #endif #define BUILD_MESH_GCODE_ITEM(M) GCODES_ITEM_S(ui.get_preheat_label(M), MSG_UBL_BUILD_MESH_M, \ - PSTR( \ + F( \ "G28\n" \ PREHEAT_BED_GCODE(M) \ "M109I" STRINGIFY(M) "\n" \ @@ -342,11 +342,11 @@ void _lcd_ubl_build_mesh() { #endif // HAS_PREHEAT SUBMENU(MSG_UBL_BUILD_CUSTOM_MESH, _lcd_ubl_custom_mesh); - GCODES_ITEM(MSG_UBL_BUILD_COLD_MESH, PSTR("G29NP1")); + GCODES_ITEM(MSG_UBL_BUILD_COLD_MESH, F("G29NP1")); SUBMENU(MSG_UBL_FILLIN_MESH, _menu_ubl_fillin); - GCODES_ITEM(MSG_UBL_CONTINUE_MESH, PSTR("G29P1C")); + GCODES_ITEM(MSG_UBL_CONTINUE_MESH, F("G29P1C")); ACTION_ITEM(MSG_UBL_INVALIDATE_ALL, _lcd_ubl_invalidate); - GCODES_ITEM(MSG_UBL_INVALIDATE_CLOSEST, PSTR("G29I")); + GCODES_ITEM(MSG_UBL_INVALIDATE_CLOSEST, F("G29I")); ACTION_ITEM(MSG_INFO_SCREEN, ui.return_to_status); END_MENU(); } @@ -354,14 +354,14 @@ void _lcd_ubl_build_mesh() { /** * UBL Load / Save Mesh Commands */ -inline void _lcd_ubl_load_save_cmd(const char loadsave, PGM_P const msg) { +inline void _lcd_ubl_load_save_cmd(const char loadsave, FSTR_P const fmsg) { char ubl_lcd_gcode[40]; sprintf_P(ubl_lcd_gcode, PSTR("G29%c%i\nM117 "), loadsave, ubl_storage_slot); - sprintf_P(&ubl_lcd_gcode[strlen(ubl_lcd_gcode)], msg, ubl_storage_slot); + sprintf_P(&ubl_lcd_gcode[strlen(ubl_lcd_gcode)], FTOP(fmsg), ubl_storage_slot); gcode.process_subcommands_now(ubl_lcd_gcode); } -void _lcd_ubl_load_mesh_cmd() { _lcd_ubl_load_save_cmd('L', GET_TEXT(MSG_MESH_LOADED)); } -void _lcd_ubl_save_mesh_cmd() { _lcd_ubl_load_save_cmd('S', GET_TEXT(MSG_MESH_SAVED)); } +void _lcd_ubl_load_mesh_cmd() { _lcd_ubl_load_save_cmd('L', GET_TEXT_F(MSG_MESH_LOADED)); } +void _lcd_ubl_save_mesh_cmd() { _lcd_ubl_load_save_cmd('S', GET_TEXT_F(MSG_MESH_SAVED)); } /** * UBL Mesh Storage submenu @@ -531,9 +531,9 @@ void _ubl_goto_map_screen() { void _lcd_ubl_output_map() { START_MENU(); BACK_ITEM(MSG_UBL_LEVEL_BED); - GCODES_ITEM(MSG_UBL_OUTPUT_MAP_HOST, PSTR("G29T0")); - GCODES_ITEM(MSG_UBL_OUTPUT_MAP_CSV, PSTR("G29T1")); - GCODES_ITEM(MSG_UBL_OUTPUT_MAP_BACKUP, PSTR("G29S-1")); + GCODES_ITEM(MSG_UBL_OUTPUT_MAP_HOST, F("G29T0")); + GCODES_ITEM(MSG_UBL_OUTPUT_MAP_CSV, F("G29T1")); + GCODES_ITEM(MSG_UBL_OUTPUT_MAP_BACKUP, F("G29S-1")); END_MENU(); } @@ -550,7 +550,7 @@ void _menu_ubl_tools() { START_MENU(); BACK_ITEM(MSG_UBL_LEVEL_BED); SUBMENU(MSG_UBL_BUILD_MESH_MENU, _lcd_ubl_build_mesh); - GCODES_ITEM(MSG_UBL_MANUAL_MESH, PSTR("G29I999\nG29P2BT0")); + GCODES_ITEM(MSG_UBL_MANUAL_MESH, F("G29I999\nG29P2BT0")); #if ENABLED(G26_MESH_VALIDATION) SUBMENU(MSG_UBL_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh); #endif @@ -576,12 +576,12 @@ void _menu_ubl_tools() { void _lcd_ubl_step_by_step() { START_MENU(); BACK_ITEM(MSG_UBL_LEVEL_BED); - GCODES_ITEM(MSG_UBL_1_BUILD_COLD_MESH, PSTR("G29NP1")); - GCODES_ITEM(MSG_UBL_2_SMART_FILLIN, PSTR("G29P3T0")); + GCODES_ITEM(MSG_UBL_1_BUILD_COLD_MESH, F("G29NP1")); + GCODES_ITEM(MSG_UBL_2_SMART_FILLIN, F("G29P3T0")); SUBMENU(MSG_UBL_3_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh); - GCODES_ITEM(MSG_UBL_4_FINE_TUNE_ALL, PSTR("G29P4RT")); + GCODES_ITEM(MSG_UBL_4_FINE_TUNE_ALL, F("G29P4RT")); SUBMENU(MSG_UBL_5_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh); - GCODES_ITEM(MSG_UBL_6_FINE_TUNE_ALL, PSTR("G29P4RT")); + GCODES_ITEM(MSG_UBL_6_FINE_TUNE_ALL, F("G29P4RT")); ACTION_ITEM(MSG_UBL_7_SAVE_MESH, _lcd_ubl_save_mesh_cmd); END_MENU(); } @@ -650,9 +650,9 @@ void _lcd_ubl_level_bed() { START_MENU(); BACK_ITEM(MSG_MOTION); if (planner.leveling_active) - GCODES_ITEM(MSG_UBL_DEACTIVATE_MESH, PSTR("G29D")); + GCODES_ITEM(MSG_UBL_DEACTIVATE_MESH, F("G29D")); else - GCODES_ITEM(MSG_UBL_ACTIVATE_MESH, PSTR("G29A")); + GCODES_ITEM(MSG_UBL_ACTIVATE_MESH, F("G29A")); #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) editable.decimal = planner.z_fade_height; EDIT_ITEM_FAST(float3, MSG_Z_FADE_HEIGHT, &editable.decimal, 0, 100, []{ set_z_fade_height(editable.decimal); }); @@ -667,7 +667,7 @@ void _lcd_ubl_level_bed() { SUBMENU(MSG_UBL_STORAGE_MESH_MENU, _lcd_ubl_storage_mesh); SUBMENU(MSG_UBL_OUTPUT_MAP, _lcd_ubl_output_map); SUBMENU(MSG_UBL_TOOLS, _menu_ubl_tools); - GCODES_ITEM(MSG_UBL_INFO_UBL, PSTR("G29W")); + GCODES_ITEM(MSG_UBL_INFO_UBL, F("G29W")); END_MENU(); } diff --git a/Marlin/src/lcd/menu/menu_x_twist.cpp b/Marlin/src/lcd/menu/menu_x_twist.cpp index ce46053dfc34..eba22cca620c 100644 --- a/Marlin/src/lcd/menu/menu_x_twist.cpp +++ b/Marlin/src/lcd/menu/menu_x_twist.cpp @@ -51,7 +51,7 @@ void xatc_wizard_done() { ui.goto_screen(menu_advanced_settings); } if (ui.should_draw()) - MenuItem_static::draw(LCD_HEIGHT >= 4, GET_TEXT(MSG_XATC_DONE)); + MenuItem_static::draw(LCD_HEIGHT >= 4, GET_TEXT_F(MSG_XATC_DONE)); ui.refresh(LCDVIEW_CALL_REDRAW_NEXT); } @@ -62,14 +62,14 @@ void xatc_wizard_goto_next_point(); // void xatc_wizard_update_z_offset() { MenuItem_confirm::select_screen( - GET_TEXT(MSG_YES), GET_TEXT(MSG_NO) + GET_TEXT_F(MSG_YES), GET_TEXT_F(MSG_NO) , []{ probe.offset.z = z_offset; ui.goto_screen(xatc_wizard_done); } , xatc_wizard_done - , GET_TEXT(MSG_XATC_UPDATE_Z_OFFSET) - , ftostr42_52(z_offset), PSTR("?") + , GET_TEXT_F(MSG_XATC_UPDATE_Z_OFFSET) + , ftostr42_52(z_offset), F("?") ); } @@ -93,7 +93,7 @@ void xatc_wizard_menu() { if (LCD_HEIGHT >= 4) STATIC_ITEM(MSG_MOVE_NOZZLE_TO_BED, SS_CENTER|SS_INVERT); - STATIC_ITEM_P(PSTR("Z="), SS_CENTER, ftostr42_52(current_position.z)); + STATIC_ITEM_F(F("Z="), SS_CENTER, ftostr42_52(current_position.z)); STATIC_ITEM(MSG_ZPROBE_ZOFFSET, SS_LEFT, ftostr42_52(calculated_z_offset)); SUBMENU(MSG_MOVE_1MM, []{ _goto_manual_move_z( 1); }); @@ -106,12 +106,12 @@ void xatc_wizard_menu() { !UNEAR_ZERO((FINE_MANUAL_MOVE) * 100 - int((FINE_MANUAL_MOVE) * 100)) ? 3 : 2; sprintf_P(tmp, GET_TEXT(MSG_MOVE_N_MM), dtostrf(FINE_MANUAL_MOVE, 1, digs, numstr)); #if DISABLED(HAS_GRAPHICAL_TFT) - SUBMENU_P(NUL_STR, []{ _goto_manual_move_z(float(FINE_MANUAL_MOVE)); }); + SUBMENU_F(FPSTR(NUL_STR), []{ _goto_manual_move_z(float(FINE_MANUAL_MOVE)); }); MENU_ITEM_ADDON_START(0 + ENABLED(HAS_MARLINUI_HD44780)); lcd_put_u8str(tmp); MENU_ITEM_ADDON_END(); #else - SUBMENU_P(tmp, []{ _goto_manual_move_z(float(FINE_MANUAL_MOVE)); }); + SUBMENU_F(FPSTR(tmp), []{ _goto_manual_move_z(float(FINE_MANUAL_MOVE)); }); #endif } @@ -127,7 +127,7 @@ void xatc_wizard_moving() { if (ui.should_draw()) { char msg[10]; sprintf_P(msg, PSTR("%i / %u"), manual_probe_index + 1, XATC_MAX_POINTS); - MenuEditItemBase::draw_edit_screen(GET_TEXT(MSG_LEVEL_BED_NEXT_POINT), msg); + MenuEditItemBase::draw_edit_screen(GET_TEXT_F(MSG_LEVEL_BED_NEXT_POINT), msg); } ui.refresh(LCDVIEW_CALL_NO_REDRAW); if (!ui.wait_for_move) ui.goto_screen(xatc_wizard_menu); @@ -180,7 +180,7 @@ void xatc_wizard_goto_next_point() { // void xatc_wizard_homing_done() { if (ui.should_draw()) { - MenuItem_static::draw(1, GET_TEXT(MSG_LEVEL_BED_WAITING)); + MenuItem_static::draw(1, GET_TEXT_F(MSG_LEVEL_BED_WAITING)); // Color UI needs a control to detect a touch #if BOTH(TOUCH_SCREEN, HAS_GRAPHICAL_TFT) diff --git a/Marlin/src/lcd/tft/tft_string.cpp b/Marlin/src/lcd/tft/tft_string.cpp index 008b5eba35cf..395144d05a18 100644 --- a/Marlin/src/lcd/tft/tft_string.cpp +++ b/Marlin/src/lcd/tft/tft_string.cpp @@ -89,13 +89,13 @@ uint8_t read_byte(uint8_t *byte) { return *byte; } /** * Add a string, applying substitutions for the following characters: * - * $ displays an inserted C-string given by the itemString parameter + * $ displays an inserted C-string given by the inStr parameter * = displays '0'....'10' for indexes 0 - 10 * ~ displays '1'....'11' for indexes 0 - 10 * * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL) * @ displays an axis name such as XYZUVW, or E for an extruder */ -void TFT_String::add(uint8_t *string, int8_t index, uint8_t *itemString/*=nullptr*/) { +void TFT_String::add(uint8_t *string, int8_t index, uint8_t *inStr/*=nullptr*/) { wchar_t wchar; while (*string) { @@ -113,8 +113,8 @@ void TFT_String::add(uint8_t *string, int8_t index, uint8_t *itemString/*=nullpt else add(index == -2 ? GET_TEXT(MSG_CHAMBER) : GET_TEXT(MSG_BED)); } - else if (ch == '$' && itemString) - add(itemString); + else if (ch == '$' && inStr) + add(inStr); else if (ch == '@') add_character(AXIS_CHAR(index)); else diff --git a/Marlin/src/lcd/tft/tft_string.h b/Marlin/src/lcd/tft/tft_string.h index e486c2ee91c8..7fd87bdf5277 100644 --- a/Marlin/src/lcd/tft/tft_string.h +++ b/Marlin/src/lcd/tft/tft_string.h @@ -86,13 +86,19 @@ class TFT_String { static void set(); static void add(uint8_t character) { add_character(character); eol(); } static void add(uint8_t *string, uint8_t max_len=MAX_STRING_LENGTH); - static void add(uint8_t *string, int8_t index, uint8_t *itemString=nullptr); + static void add(uint8_t *string, int8_t index, uint8_t *inStr=nullptr); static void set(uint8_t *string) { set(); add(string); }; - static void set(uint8_t *string, int8_t index, const char *itemString=nullptr) { set(); add(string, index, (uint8_t *)itemString); }; + static void set(uint8_t *string, int8_t index, const char *inStr=nullptr) { set(); add(string, index, (uint8_t *)inStr); }; static void set(const char *string) { set((uint8_t *)string); } - static void set(const char *string, int8_t index, const char *itemString=nullptr) { set((uint8_t *)string, index, itemString); } + static void set(const char *string, int8_t index, const char *inStr=nullptr) { set((uint8_t *)string, index, inStr); } static void add(const char *string) { add((uint8_t *)string); } + static void add(FSTR_P const string, uint8_t max_len=MAX_STRING_LENGTH) { add((uint8_t *)FTOP(string), max_len); } + static void add(FSTR_P const string, int8_t index, uint8_t *inStr=nullptr) { add((uint8_t *)FTOP(string), index, inStr); } + static void set(FSTR_P const string) { set((uint8_t *)FTOP(string)); } + static void set(FSTR_P const string, int8_t index, const char *inStr=nullptr) { set((uint8_t *)FTOP(string), index, inStr); } + static void add(FSTR_P const string) { add((uint8_t *)FTOP(string)); } + static void trim(uint8_t character=0x20); static void rtrim(uint8_t character=0x20); static void ltrim(uint8_t character=0x20); diff --git a/Marlin/src/lcd/tft/touch.cpp b/Marlin/src/lcd/tft/touch.cpp index 57cd6e724e26..a152907a9dde 100644 --- a/Marlin/src/lcd/tft/touch.cpp +++ b/Marlin/src/lcd/tft/touch.cpp @@ -189,26 +189,26 @@ void Touch::touch(touch_control_t *control) { #if HAS_HOTEND if (heater >= 0) { // HotEnd #if HOTENDS == 1 - MenuItem_int3::action((const char *)GET_TEXT_F(MSG_NOZZLE), &thermalManager.temp_hotend[0].target, 0, thermalManager.hotend_max_target(0), []{ thermalManager.start_watching_hotend(0); }); + MenuItem_int3::action(GET_TEXT_F(MSG_NOZZLE), &thermalManager.temp_hotend[0].target, 0, thermalManager.hotend_max_target(0), []{ thermalManager.start_watching_hotend(0); }); #else MenuItemBase::itemIndex = heater; - MenuItem_int3::action((const char *)GET_TEXT_F(MSG_NOZZLE_N), &thermalManager.temp_hotend[heater].target, 0, thermalManager.hotend_max_target(heater), []{ thermalManager.start_watching_hotend(MenuItemBase::itemIndex); }); + MenuItem_int3::action(GET_TEXT_F(MSG_NOZZLE_N), &thermalManager.temp_hotend[heater].target, 0, thermalManager.hotend_max_target(heater), []{ thermalManager.start_watching_hotend(MenuItemBase::itemIndex); }); #endif } #endif #if HAS_HEATED_BED else if (heater == H_BED) { - MenuItem_int3::action((const char *)GET_TEXT_F(MSG_BED), &thermalManager.temp_bed.target, 0, BED_MAX_TARGET, thermalManager.start_watching_bed); + MenuItem_int3::action(GET_TEXT_F(MSG_BED), &thermalManager.temp_bed.target, 0, BED_MAX_TARGET, thermalManager.start_watching_bed); } #endif #if HAS_HEATED_CHAMBER else if (heater == H_CHAMBER) { - MenuItem_int3::action((const char *)GET_TEXT_F(MSG_CHAMBER), &thermalManager.temp_chamber.target, 0, CHAMBER_MAX_TARGET, thermalManager.start_watching_chamber); + MenuItem_int3::action(GET_TEXT_F(MSG_CHAMBER), &thermalManager.temp_chamber.target, 0, CHAMBER_MAX_TARGET, thermalManager.start_watching_chamber); } #endif #if HAS_COOLER else if (heater == H_COOLER) { - MenuItem_int3::action((const char *)GET_TEXT_F(MSG_COOLER), &thermalManager.temp_cooler.target, 0, COOLER_MAX_TARGET, thermalManager.start_watching_cooler); + MenuItem_int3::action(GET_TEXT_F(MSG_COOLER), &thermalManager.temp_cooler.target, 0, COOLER_MAX_TARGET, thermalManager.start_watching_cooler); } #endif @@ -218,19 +218,19 @@ void Touch::touch(touch_control_t *control) { static uint8_t fan, fan_speed; fan = 0; fan_speed = thermalManager.fan_speed[fan]; - MenuItem_percent::action((const char *)GET_TEXT_F(MSG_FIRST_FAN_SPEED), &fan_speed, 0, 255, []{ thermalManager.set_fan_speed(fan, fan_speed); }); + MenuItem_percent::action(GET_TEXT_F(MSG_FIRST_FAN_SPEED), &fan_speed, 0, 255, []{ thermalManager.set_fan_speed(fan, fan_speed); }); break; case FEEDRATE: ui.clear_lcd(); - MenuItem_int3::action((const char *)GET_TEXT_F(MSG_SPEED), &feedrate_percentage, 10, 999); + MenuItem_int3::action(GET_TEXT_F(MSG_SPEED), &feedrate_percentage, 10, 999); break; case FLOWRATE: ui.clear_lcd(); MenuItemBase::itemIndex = control->data; #if EXTRUDERS == 1 - MenuItem_int3::action((const char *)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], 10, 999, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); }); #else - MenuItem_int3::action((const char *)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], 10, 999, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); }); #endif break; diff --git a/Marlin/src/lcd/tft/ui_1024x600.cpp b/Marlin/src/lcd/tft/ui_1024x600.cpp index 3fbb26b69ddf..e8ba4737a80f 100644 --- a/Marlin/src/lcd/tft/ui_1024x600.cpp +++ b/Marlin/src/lcd/tft/ui_1024x600.cpp @@ -105,12 +105,12 @@ void MarlinUI::draw_kill_screen() { line++; menu_line(line++, COLOR_KILL_SCREEN_BG); - tft_string.set(GET_TEXT(MSG_HALTED)); + tft_string.set(GET_TEXT_F(MSG_HALTED)); tft_string.trim(); tft.add_text(tft_string.center(TFT_WIDTH), 0, COLOR_MENU_TEXT, tft_string); menu_line(line++, COLOR_KILL_SCREEN_BG); - tft_string.set(GET_TEXT(MSG_PLEASE_RESET)); + tft_string.set(GET_TEXT_F(MSG_PLEASE_RESET)); tft_string.trim(); tft.add_text(tft_string.center(TFT_WIDTH), 0, COLOR_MENU_TEXT, tft_string); @@ -352,14 +352,14 @@ void MarlinUI::draw_status_screen() { } // Low-level draw_edit_screen can be used to draw an edit screen from anyplace -void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char * const value/*=nullptr*/) { +void MenuEditItemBase::draw_edit_screen(FSTR_P const fstr, const char * const value/*=nullptr*/) { ui.encoder_direction_normal(); TERN_(TOUCH_SCREEN, touch.clear()); uint16_t line = 1; menu_line(line++); - tft_string.set(pstr, itemIndex, itemString); + tft_string.set(FTOP(fstr), itemIndex, FTOP(itemString)); tft_string.trim(); tft.add_text(tft_string.center(TFT_WIDTH), MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); @@ -421,7 +421,7 @@ void TFT::draw_edit_screen_buttons() { } // The Select Screen presents a prompt and two "buttons" -void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string/*=nullptr*/, PGM_P const suff/*=nullptr*/) { +void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, const bool yesno, FSTR_P const pref, const char * const string/*=nullptr*/, FSTR_P const suff/*=nullptr*/) { uint16_t line = 1; if (!string) line++; @@ -473,7 +473,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const #endif menu_line(row); - tft_string.set(GET_TEXT(MSG_FILAMENT_CHANGE_NOZZLE)); + tft_string.set(GET_TEXT_F(MSG_FILAMENT_CHANGE_NOZZLE)); tft_string.add('E'); tft_string.add((char)('1' + extruder)); tft_string.add(' '); @@ -693,18 +693,18 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { drawAxisValue(axis); } else { - drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS)); + drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS)); } #elif HAS_BED_PROBE // only change probe.offset.z probe.offset.z += diff; if (direction < 0 && current_position[axis] < Z_PROBE_OFFSET_RANGE_MIN) { current_position[axis] = Z_PROBE_OFFSET_RANGE_MIN; - drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS)); + drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS)); } else if (direction > 0 && current_position[axis] > Z_PROBE_OFFSET_RANGE_MAX) { current_position[axis] = Z_PROBE_OFFSET_RANGE_MAX; - drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS)); + drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS)); } else { drawMessage(""); // clear the error @@ -733,7 +733,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { #if IS_KINEMATIC UNUSED(limited); #else - PGM_P const msg = limited ? GET_TEXT(MSG_LCD_SOFT_ENDSTOPS) : NUL_STR; + FSTR_P const msg = limited ? GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS) : FPSTR(NUL_STR); drawMessage(msg); #endif @@ -766,7 +766,7 @@ static void z_minus() { moveAxis(Z_AXIS, -1); } static void do_home() { quick_feedback(); - drawMessage(GET_TEXT(MSG_LEVEL_BED_HOMING)); + drawMessage(GET_TEXT_F(MSG_LEVEL_BED_HOMING)); queue.inject_P(G28_STR); // Disable touch until home is done TERN_(TOUCH_SCREEN, touch.disable()); diff --git a/Marlin/src/lcd/tft/ui_320x240.cpp b/Marlin/src/lcd/tft/ui_320x240.cpp index b1a781fad10a..148d5d3964c1 100644 --- a/Marlin/src/lcd/tft/ui_320x240.cpp +++ b/Marlin/src/lcd/tft/ui_320x240.cpp @@ -347,14 +347,14 @@ void MarlinUI::draw_status_screen() { } // Low-level draw_edit_screen can be used to draw an edit screen from anyplace -void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char * const value/*=nullptr*/) { +void MenuEditItemBase::draw_edit_screen(FSTR_P const fstr, const char * const value/*=nullptr*/) { ui.encoder_direction_normal(); TERN_(TOUCH_SCREEN, touch.clear()); uint16_t line = 1; menu_line(line++); - tft_string.set(pstr, itemIndex, itemString); + tft_string.set(FTOP(fstr), itemIndex, FTOP(itemString)); tft_string.trim(); tft.add_text(tft_string.center(TFT_WIDTH), MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); @@ -416,7 +416,7 @@ void TFT::draw_edit_screen_buttons() { } // The Select Screen presents a prompt and two "buttons" -void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string/*=nullptr*/, PGM_P const suff/*=nullptr*/) { +void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, const bool yesno, FSTR_P const pref, const char * const string/*=nullptr*/, FSTR_P const suff/*=nullptr*/) { uint16_t line = 1; if (!string) line++; @@ -621,7 +621,7 @@ static void drawCurESelection() { tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection)); } -static void drawMessage(const char *msg) { +static void drawMessage(PGM_P const msg) { tft.canvas(X_MARGIN, TFT_HEIGHT - Y_MARGIN - 29, (TFT_WIDTH / 2) - (BTN_WIDTH / 2) - X_MARGIN, 20); tft.set_background(COLOR_BACKGROUND); tft.add_text(0, 0, COLOR_YELLOW, msg); @@ -652,7 +652,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { #if ENABLED(PREVENT_COLD_EXTRUSION) if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) { - drawMessage("Too cold"); + drawMessage(PSTR("Too cold")); return; } #endif @@ -675,7 +675,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { probe.offset.z = new_offs; else TERN(BABYSTEP_HOTEND_Z_OFFSET, hotend_offset[active_extruder].z = new_offs, NOOP); - drawMessage(""); // clear the error + drawMessage(NUL_STR); // clear the error drawAxisValue(axis); } else { @@ -693,7 +693,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS)); } else { - drawMessage(""); // clear the error + drawMessage(NUL_STR); // clear the error } drawAxisValue(axis); #endif diff --git a/Marlin/src/lcd/tft/ui_480x320.cpp b/Marlin/src/lcd/tft/ui_480x320.cpp index 6f7327f1e8a2..34502df54026 100644 --- a/Marlin/src/lcd/tft/ui_480x320.cpp +++ b/Marlin/src/lcd/tft/ui_480x320.cpp @@ -352,14 +352,14 @@ void MarlinUI::draw_status_screen() { } // Low-level draw_edit_screen can be used to draw an edit screen from anyplace -void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char * const value/*=nullptr*/) { +void MenuEditItemBase::draw_edit_screen(FSTR_P const fstr, const char * const value/*=nullptr*/) { ui.encoder_direction_normal(); TERN_(TOUCH_SCREEN, touch.clear()); uint16_t line = 1; menu_line(line++); - tft_string.set(pstr, itemIndex, itemString); + tft_string.set(FTOP(fstr), itemIndex, FTOP(itemString)); tft_string.trim(); tft.add_text(tft_string.center(TFT_WIDTH), MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); @@ -421,7 +421,7 @@ void TFT::draw_edit_screen_buttons() { } // The Select Screen presents a prompt and two "buttons" -void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string/*=nullptr*/, PGM_P const suff/*=nullptr*/) { +void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, const bool yesno, FSTR_P const pref, const char * const string/*=nullptr*/, FSTR_P const suff/*=nullptr*/) { uint16_t line = 1; if (!string) line++; @@ -622,7 +622,7 @@ static void drawCurESelection() { tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection)); } -static void drawMessage(const char *msg) { +static void drawMessage(PGM_P const msg) { tft.canvas(X_MARGIN, TFT_HEIGHT - Y_MARGIN - 34, TFT_HEIGHT / 2, 34); tft.set_background(COLOR_BACKGROUND); tft.add_text(0, 0, COLOR_YELLOW, msg); @@ -653,7 +653,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { #if ENABLED(PREVENT_COLD_EXTRUSION) if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) { - drawMessage("Too cold"); + drawMessage(PSTR("Too cold")); return; } #endif @@ -676,7 +676,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { probe.offset.z = new_offs; else TERN(BABYSTEP_HOTEND_Z_OFFSET, hotend_offset[active_extruder].z = new_offs, NOOP); - drawMessage(""); // clear the error + drawMessage(NUL_STR); // clear the error drawAxisValue(axis); } else { @@ -694,7 +694,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS)); } else { - drawMessage(""); // clear the error + drawMessage(NUL_STR); // clear the error } drawAxisValue(axis); #endif diff --git a/Marlin/src/lcd/tft/ui_common.cpp b/Marlin/src/lcd/tft/ui_common.cpp index acc91f51fa83..023ff59ca6d6 100644 --- a/Marlin/src/lcd/tft/ui_common.cpp +++ b/Marlin/src/lcd/tft/ui_common.cpp @@ -130,10 +130,10 @@ void lcd_put_int(const int i) { // // Draw a generic menu item with pre_char (if selected) and post_char -void MenuItemBase::_draw(const bool sel, const uint8_t row, PGM_P const pstr, const char pre_char, const char post_char) { +void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char pre_char, const char post_char) { menu_item(row, sel); - uint8_t *string = (uint8_t *)pstr; + uint8_t *string = (uint8_t *)FTOP(fstr); MarlinImage image = noImage; switch (*string) { case 0x01: image = imgRefresh; break; // LCD_STR_REFRESH @@ -147,15 +147,15 @@ void MenuItemBase::_draw(const bool sel, const uint8_t row, PGM_P const pstr, co tft.add_image(MENU_ITEM_ICON_X, MENU_ITEM_ICON_Y, image, COLOR_MENU_TEXT, sel ? COLOR_SELECTION_BG : COLOR_BACKGROUND); } - tft_string.set(string, itemIndex, itemString); + tft_string.set(string, itemIndex, FTOP(itemString)); tft.add_text(offset, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); } // Draw a menu item with a (potentially) editable value -void MenuEditItemBase::draw(const bool sel, const uint8_t row, PGM_P const pstr, const char * const data, const bool pgm) { +void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char * const data, const bool pgm) { menu_item(row, sel); - tft_string.set(pstr, itemIndex, itemString); + tft_string.set(FTOP(fstr), itemIndex, FTOP(itemString)); tft.add_text(MENU_TEXT_X_OFFSET, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); if (data) { tft_string.set(data); @@ -164,16 +164,16 @@ void MenuEditItemBase::draw(const bool sel, const uint8_t row, PGM_P const pstr, } // Draw a static item with no left-right margin required. Centered by default. -void MenuItem_static::draw(const uint8_t row, PGM_P const pstr, const uint8_t style/*=SS_DEFAULT*/, const char * const vstr/*=nullptr*/) { +void MenuItem_static::draw(const uint8_t row, FSTR_P const fstr, const uint8_t style/*=SS_DEFAULT*/, const char * const vstr/*=nullptr*/) { menu_item(row); - tft_string.set(pstr, itemIndex, itemString); + tft_string.set(FTOP(fstr), itemIndex, FTOP(itemString)); if (vstr) tft_string.add(vstr); tft.add_text(tft_string.center(TFT_WIDTH), MENU_TEXT_Y_OFFSET, COLOR_YELLOW, tft_string); } #if ENABLED(SDSUPPORT) - void MenuItem_sdbase::draw(const bool sel, const uint8_t row, PGM_P const, CardReader &theCard, const bool isDir) { + void MenuItem_sdbase::draw(const bool sel, const uint8_t row, FSTR_P const, CardReader &theCard, const bool isDir) { menu_item(row, sel); if (isDir) tft.add_image(MENU_ITEM_ICON_X, MENU_ITEM_ICON_Y, imgDirectory, COLOR_MENU_TEXT, sel ? COLOR_SELECTION_BG : COLOR_BACKGROUND); constexpr uint8_t maxlen = (MENU_ITEM_HEIGHT) - (MENU_TEXT_Y_OFFSET) + 1; From 04d0d9431be774d4e7801498a12e31d4d3060d91 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 22 May 2022 20:44:43 -0500 Subject: [PATCH 092/241] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Watchdog=20followu?= =?UTF-8?q?p?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to 52eefa90e1 --- Marlin/src/HAL/STM32/msc_sd.cpp | 8 ++++---- Marlin/src/HAL/shared/cpu_exception/exception_arm.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Marlin/src/HAL/STM32/msc_sd.cpp b/Marlin/src/HAL/STM32/msc_sd.cpp index 4f85af0d446a..a40bec9d644d 100644 --- a/Marlin/src/HAL/STM32/msc_sd.cpp +++ b/Marlin/src/HAL/STM32/msc_sd.cpp @@ -57,7 +57,7 @@ class Sd2CardUSBMscHandler : public USBMscHandler { auto sd2card = diskIODriver(); // single block if (blkLen == 1) { - watchdog_refresh(); + hal.watchdog_refresh(); sd2card->writeBlock(blkAddr, pBuf); return true; } @@ -65,7 +65,7 @@ class Sd2CardUSBMscHandler : public USBMscHandler { // multi block optimization sd2card->writeStart(blkAddr, blkLen); while (blkLen--) { - watchdog_refresh(); + hal.watchdog_refresh(); sd2card->writeData(pBuf); pBuf += BLOCK_SIZE; } @@ -77,7 +77,7 @@ class Sd2CardUSBMscHandler : public USBMscHandler { auto sd2card = diskIODriver(); // single block if (blkLen == 1) { - watchdog_refresh(); + hal.watchdog_refresh(); sd2card->readBlock(blkAddr, pBuf); return true; } @@ -85,7 +85,7 @@ class Sd2CardUSBMscHandler : public USBMscHandler { // multi block optimization sd2card->readStart(blkAddr); while (blkLen--) { - watchdog_refresh(); + hal.watchdog_refresh(); sd2card->readData(pBuf); pBuf += BLOCK_SIZE; } diff --git a/Marlin/src/HAL/shared/cpu_exception/exception_arm.cpp b/Marlin/src/HAL/shared/cpu_exception/exception_arm.cpp index deaf09d2c000..e54661c77071 100644 --- a/Marlin/src/HAL/shared/cpu_exception/exception_arm.cpp +++ b/Marlin/src/HAL/shared/cpu_exception/exception_arm.cpp @@ -221,7 +221,7 @@ bool resume_from_fault() { // So we'll just need to refresh the watchdog for a while and then stop for the system to reboot uint32_t last = start; while (PENDING(last, end)) { - watchdog_refresh(); + hal.watchdog_refresh(); while (millis() == last) { /* nada */ } last = millis(); MinSerial::TX('.'); From 15b6159f6af740f17db2dc8815697759c714cc12 Mon Sep 17 00:00:00 2001 From: Robby Candra Date: Mon, 23 May 2022 09:13:17 +0700 Subject: [PATCH 093/241] =?UTF-8?q?=F0=9F=A9=B9=20Adjust=20manage=5Fmedia?= =?UTF-8?q?=20for=20slow/late=20media=20init=20(USB=20FD)=20(#24015)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/sd/cardreader.cpp | 38 ++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index ec5f1a970913..0aa06e47c9f4 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -472,29 +472,32 @@ void CardReader::mount() { #endif void CardReader::manage_media() { - static uint8_t prev_stat = 2; // First call, no prior state + static uint8_t prev_stat = 2; // At boot we don't know if media is present or not uint8_t stat = uint8_t(IS_SD_INSERTED()); - if (stat == prev_stat) return; + if (stat == prev_stat) return; // Already checked and still no change? - DEBUG_SECTION(mm, "CardReader::manage_media", true); - DEBUG_ECHOLNPGM("SD Status ", prev_stat, " -> ", stat); - - flag.workDirIsRoot = true; // Return to root on mount/release + DEBUG_SECTION(cmm, "CardReader::manage_media()", true); + DEBUG_ECHOLNPGM("Media present: ", prev_stat, " -> ", stat); if (!ui.detected()) { DEBUG_ECHOLNPGM("SD: No UI Detected."); return; } - uint8_t old_stat = prev_stat; - prev_stat = stat; // Change now to prevent re-entry + flag.workDirIsRoot = true; // Return to root on mount/release/init + + const uint8_t old_stat = prev_stat; + prev_stat = stat; // Change now to prevent re-entry in safe_delay if (stat) { // Media Inserted safe_delay(500); // Some boards need a delay to get settled // Try to mount the media (only later with SD_IGNORE_AT_STARTUP) if (TERN1(SD_IGNORE_AT_STARTUP, old_stat != 2)) mount(); - if (!isMounted()) stat = 0; // Not mounted? + if (!isMounted()) { // Not mounted? + stat = 0; + IF_DISABLED(SD_IGNORE_AT_STARTUP, prev_stat = 0); + } TERN_(RESET_STEPPERS_ON_MEDIA_INSERT, reset_stepper_drivers()); // Workaround for Cheetah bug } @@ -504,16 +507,25 @@ void CardReader::manage_media() { #endif } - ui.media_changed(old_stat, stat); // Update the UI + ui.media_changed(old_stat, stat); // Update the UI or flag an error if (!stat) return; // Exit if no media is present - TERN_(SDCARD_EEPROM_EMULATION, settings.first_load()); - - if (old_stat != 2) return; // First mount? + static bool did_first_insert = false; + if (did_first_insert) return; // Did a media insert already happen? + did_first_insert = true; // Definitely handling this media insert... DEBUG_ECHOLNPGM("First mount."); + // Load settings the first time media is inserted (not just during init) + TERN_(SDCARD_EEPROM_EMULATION, settings.first_load()); + + #if HAS_USB_FLASH_DRIVE + const millis_t ms = millis(); + DEBUG_ECHOLNPGM("USB mount waiting time = ", ms); + if (ms > 5000) return; // Too late to be considered "already inserted"? + #endif + bool do_auto = true; UNUSED(do_auto); // Check for PLR file. From c1ff38c7a0d2d578638324212677d2e855fb190f Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Mon, 23 May 2022 14:19:10 +1200 Subject: [PATCH 094/241] =?UTF-8?q?=F0=9F=9A=B8=20Firmware=20upload=20dest?= =?UTF-8?q?ination=20prompt=20(using=20Tk)=20(#24074)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scripts/upload_prompt_extra_script.py | 52 +++++++++++++++++++ ini/stm32f1.ini | 7 +++ 2 files changed, 59 insertions(+) create mode 100755 buildroot/share/PlatformIO/scripts/upload_prompt_extra_script.py diff --git a/buildroot/share/PlatformIO/scripts/upload_prompt_extra_script.py b/buildroot/share/PlatformIO/scripts/upload_prompt_extra_script.py new file mode 100755 index 000000000000..87cc945089b8 --- /dev/null +++ b/buildroot/share/PlatformIO/scripts/upload_prompt_extra_script.py @@ -0,0 +1,52 @@ +# +# upload_prompt_extra_script.py +# set the output_port +# +from __future__ import print_function + +has_tkinter = False +try: + import sys + if sys.version_info[0] < 3: + import Tkinter as tk + import tkFileDialog as fileDialog + from Tkinter import Tk + else: + import tkinter as tk + from tkinter import Tk + from tkinter import filedialog as fileDialog + has_tkinter = True +except: + pass + +import pioutil +if has_tkinter and pioutil.is_pio_build(): + + Import("env") + + def print_error(e): + print('\nUnable to find destination disk (%s)\n' %( e ) ) + + def before_upload(source, target, env): + # + # Find a disk for upload + # + upload_disk = '' + + root = Tk() # pointing root to Tk() to use it as Tk() in program. + root.withdraw() # Hides small tkinter window. + + root.attributes('-topmost', True) # Opened windows will be active. above all windows despite of selection. + + upload_disk = fileDialog.askdirectory(title="Select the root of your SDCARD") # Returns opened path as str + if not upload_disk: + print_error('Canceled') + return + else: + env.Replace( + UPLOAD_FLAGS="-P$UPLOAD_PORT" + ) + env.Replace(UPLOAD_PORT=upload_disk) + print('\nUpload disk: ', upload_disk, '\n') + + env.AddPreAction("upload", before_upload) diff --git a/ini/stm32f1.ini b/ini/stm32f1.ini index 6bf6a1cb851c..4b3714f6d413 100644 --- a/ini/stm32f1.ini +++ b/ini/stm32f1.ini @@ -148,6 +148,10 @@ upload_protocol = custom [env:STM32F103RE_creality] extends = STM32F103Rx_creality board = genericSTM32F103RE +extra_scripts = ${STM32F103Rx_creality.extra_scripts} + buildroot/share/PlatformIO/scripts/upload_prompt_extra_script.py +upload_protocol = mbed + [env:STM32F103RE_creality_xfer] extends = STM32F103Rx_creality_xfer @@ -164,6 +168,9 @@ board_upload.offset_address = 0x08010000 [env:STM32F103RC_creality] extends = STM32F103Rx_creality board = genericSTM32F103RC +extra_scripts = ${STM32F103Rx_creality.extra_scripts} + buildroot/share/PlatformIO/scripts/upload_prompt_extra_script.py +upload_protocol = mbed [env:STM32F103RC_creality_xfer] extends = STM32F103Rx_creality_xfer From f26b8bf8efd16cc2412880f0976645a8e4cb7b89 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Sun, 22 May 2022 19:32:28 -0700 Subject: [PATCH 095/241] =?UTF-8?q?=F0=9F=93=9D=20Add=20logo,=20helpful=20?= =?UTF-8?q?links=20to=20README=20(#24226)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 21 +++++++++++------- .../pixmaps/logo/marlin-outrun-nf-500.png | Bin 0 -> 172495 bytes 2 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 buildroot/share/pixmaps/logo/marlin-outrun-nf-500.png diff --git a/README.md b/README.md index 3dba2df2b3fc..84a600d257dd 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,16 @@ -# Marlin 3D Printer Firmware - -![GitHub](https://img.shields.io/github/license/marlinfirmware/marlin.svg) -![GitHub contributors](https://img.shields.io/github/contributors/marlinfirmware/marlin.svg) -![GitHub Release Date](https://img.shields.io/github/release-date/marlinfirmware/marlin.svg) -[![Build Status](https://github.com/MarlinFirmware/Marlin/workflows/CI/badge.svg?branch=bugfix-2.0.x)](https://github.com/MarlinFirmware/Marlin/actions) - - +

MarlinFirmware's logo

+ +

Marlin 3D Printer Firmware

+ +

+ GPL-V3.0 License + Contributors + Last Release Date + CI Status + GitHub Sponsors +
+ Follow MarlinFirmware on Twitter +

Additional documentation can be found at the [Marlin Home Page](https://marlinfw.org/). Please test this firmware and let us know if it misbehaves in any way. Volunteers are standing by! diff --git a/buildroot/share/pixmaps/logo/marlin-outrun-nf-500.png b/buildroot/share/pixmaps/logo/marlin-outrun-nf-500.png new file mode 100644 index 0000000000000000000000000000000000000000..e36a3eb5c2165caf8d140eacd3b66dfb614053f2 GIT binary patch literal 172495 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 z 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 literal 0 HcmV?d00001 From 7d9bd3a97cc15bab0de9813a19eb44c47b3043da Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 23 May 2022 02:37:28 -0500 Subject: [PATCH 096/241] =?UTF-8?q?=F0=9F=8E=A8=20Add=20EXP1/2=20headers,?= =?UTF-8?q?=20adjust=20TFT=20pins=20(#24230)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/STM32F1/tft/tft_spi.cpp | 2 +- Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h | 2 +- Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h | 3 +- Marlin/src/pins/mega/pins_CNCONTROLS_11.h | 25 ++-- Marlin/src/pins/mega/pins_CNCONTROLS_12.h | 26 ++-- Marlin/src/pins/ramps/pins_AZTEEG_X3_PRO.h | 2 +- Marlin/src/pins/sam/pins_RAMPS_FD_V1.h | 81 +++++++---- Marlin/src/pins/sam/pins_RURAMPS4D_11.h | 78 +++++++---- Marlin/src/pins/sam/pins_RURAMPS4D_13.h | 83 +++++++---- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h | 129 +++++++++++------- .../src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h | 3 +- .../pins/stm32f4/pins_BTT_SKR_V2_0_common.h | 8 +- Marlin/src/pins/stm32f4/pins_MKS_MONSTER8.h | 6 +- .../stm32f4/pins_MKS_ROBIN_NANO_V3_common.h | 6 +- .../src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h | 5 +- Marlin/src/pins/stm32f4/pins_VAKE403D.h | 58 ++++++-- Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h | 2 - 17 files changed, 333 insertions(+), 186 deletions(-) diff --git a/Marlin/src/HAL/STM32F1/tft/tft_spi.cpp b/Marlin/src/HAL/STM32F1/tft/tft_spi.cpp index 9bf6bbb32bc7..f447cec81107 100644 --- a/Marlin/src/HAL/STM32F1/tft/tft_spi.cpp +++ b/Marlin/src/HAL/STM32F1/tft/tft_spi.cpp @@ -30,7 +30,7 @@ SPIClass TFT_SPI::SPIx(1); void TFT_SPI::Init() { #if PIN_EXISTS(TFT_RESET) - OUT_WRITE(TFT_RST_PIN, HIGH); + OUT_WRITE(TFT_RESET_PIN, HIGH); delay(100); #endif diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h index 97d86fe810d7..4ab5b109372f 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h @@ -314,7 +314,7 @@ #define TFT_RESET_PIN EXP1_07_PIN #define TFT_BACKLIGHT_PIN EXP1_08_PIN - #define TFT_RST_PIN EXP2_04_PIN + //#define TFT_RST_PIN EXP2_04_PIN #define TFT_MOSI_PIN EXP2_05_PIN #define TFT_SCK_PIN EXP2_09_PIN #define TFT_MISO_PIN EXP2_10_PIN diff --git a/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h b/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h index 13ebbe1f2859..4cff5d59e17d 100644 --- a/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h +++ b/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h @@ -339,9 +339,10 @@ #define KILL_PIN -1 // NC #elif HAS_SPI_TFT // Config for Classic UI (emulated DOGM) and Color UI + #define TFT_CS_PIN EXP1_04_PIN - #define TFT_A0_PIN EXP1_03_PIN #define TFT_DC_PIN EXP1_03_PIN + #define TFT_A0_PIN TFT_DC_PIN #define TFT_MISO_PIN EXP2_10_PIN #define TFT_BACKLIGHT_PIN EXP1_08_PIN #define TFT_RESET_PIN EXP1_07_PIN diff --git a/Marlin/src/pins/mega/pins_CNCONTROLS_11.h b/Marlin/src/pins/mega/pins_CNCONTROLS_11.h index 6f9e5e8e6c47..5f7a534d115b 100644 --- a/Marlin/src/pins/mega/pins_CNCONTROLS_11.h +++ b/Marlin/src/pins/mega/pins_CNCONTROLS_11.h @@ -135,17 +135,20 @@ // // LCD / Controller // -#define BEEPER_PIN 6 - -// Pins for DOGM SPI LCD Support -#define DOGLCD_A0 26 -#define DOGLCD_CS 24 -#define DOGLCD_MOSI -1 // Prevent auto-define by Conditionals_post.h -#define DOGLCD_SCK -1 - -#define BTN_EN1 23 -#define BTN_EN2 25 -#define BTN_ENC 27 +#if HAS_WIRED_LCD + #define BEEPER_PIN 6 + + #define BTN_EN1 23 + #define BTN_EN2 25 + #define BTN_ENC 27 + + #if HAS_MARLINUI_U8GLIB + #define DOGLCD_A0 26 + #define DOGLCD_CS 24 + #define DOGLCD_MOSI -1 // Prevent auto-define by Conditionals_post.h + #define DOGLCD_SCK -1 + #endif +#endif // Hardware buttons for manual movement of XYZ #define SHIFT_OUT_PIN 19 diff --git a/Marlin/src/pins/mega/pins_CNCONTROLS_12.h b/Marlin/src/pins/mega/pins_CNCONTROLS_12.h index 137650eeed58..0aa0b59ca945 100644 --- a/Marlin/src/pins/mega/pins_CNCONTROLS_12.h +++ b/Marlin/src/pins/mega/pins_CNCONTROLS_12.h @@ -140,18 +140,20 @@ // // LCD / Controller // -#define BEEPER_PIN 16 - -// Pins for DOGM SPI LCD Support -#define DOGLCD_A0 39 -#define DOGLCD_CS 35 -#define DOGLCD_MOSI 48 -#define DOGLCD_SCK 49 - -// The encoder and click button -#define BTN_EN1 36 -#define BTN_EN2 34 -#define BTN_ENC 38 +#if HAS_WIRED_LCD + #define BEEPER_PIN 16 + + #define BTN_EN1 36 + #define BTN_EN2 34 + #define BTN_ENC 38 + + #if HAS_MARLINUI_U8GLIB + #define DOGLCD_A0 39 + #define DOGLCD_CS 35 + #define DOGLCD_MOSI 48 + #define DOGLCD_SCK 49 + #endif +#endif // Hardware buttons for manual movement of XYZ #define SHIFT_OUT_PIN 42 diff --git a/Marlin/src/pins/ramps/pins_AZTEEG_X3_PRO.h b/Marlin/src/pins/ramps/pins_AZTEEG_X3_PRO.h index 5aba83fc9fb5..5dc191cd2016 100644 --- a/Marlin/src/pins/ramps/pins_AZTEEG_X3_PRO.h +++ b/Marlin/src/pins/ramps/pins_AZTEEG_X3_PRO.h @@ -158,7 +158,7 @@ #if ENABLED(CASE_LIGHT_ENABLE) && PIN_EXISTS(CASE_LIGHT) && defined(DOGLCD_A0) && DOGLCD_A0 == CASE_LIGHT_PIN #undef DOGLCD_A0 // Steal pin 44 for the case light; if you have a Viki2 and have connected it #define DOGLCD_A0 57 // following the Panucatt wiring diagram, you may need to tweak these pin assignments - // as the wiring diagram uses pin 44 for DOGLCD_A0 + // as the wiring diagram uses pin 44 for DOGLCD_A0. #endif // diff --git a/Marlin/src/pins/sam/pins_RAMPS_FD_V1.h b/Marlin/src/pins/sam/pins_RAMPS_FD_V1.h index 30f209ad3713..980a957a505a 100644 --- a/Marlin/src/pins/sam/pins_RAMPS_FD_V1.h +++ b/Marlin/src/pins/sam/pins_RAMPS_FD_V1.h @@ -134,71 +134,98 @@ #define SDSS 4 #define LED_PIN 13 +/** ------ ------ + * 37 |10 9 | 35 (MISO) 50 |10 9 | 76 (SCK) + * 29 | 8 7 | 27 (EN2) 31 | 8 7 | 4 (SD_SS) + * 25 6 5 | 23 (EN1) 33 6 5 | 75 (MOSI) + * 16 | 4 3 | 17 (SDD) 49 | 4 3 | RESET + * GND | 2 1 | 5V GND | 2 1 | -- + * ------ ------ + * EXP1 EXP2 + */ +#define EXP1_03_PIN 17 +#define EXP1_04_PIN 16 +#define EXP1_05_PIN 23 +#define EXP1_06_PIN 25 +#define EXP1_07_PIN 27 +#define EXP1_08_PIN 29 +#define EXP1_09_PIN 35 +#define EXP1_10_PIN 37 + +#define EXP2_03_PIN -1 +#define EXP2_04_PIN 49 +#define EXP2_05_PIN 75 +#define EXP2_06_PIN 33 +#define EXP2_07_PIN 4 +#define EXP2_08_PIN 31 +#define EXP2_09_PIN 76 +#define EXP2_10_PIN 74 + // // LCD / Controller // #if HAS_WIRED_LCD // ramps-fd lcd adaptor - #define BEEPER_PIN 37 - #define BTN_EN1 33 - #define BTN_EN2 31 - #define BTN_ENC 35 - #define SD_DETECT_PIN 49 + #define BEEPER_PIN EXP1_10_PIN + #define BTN_EN1 EXP2_06_PIN + #define BTN_EN2 EXP2_08_PIN + #define BTN_ENC EXP1_09_PIN + #define SD_DETECT_PIN EXP2_04_PIN #if IS_NEWPANEL - #define LCD_PINS_RS 16 - #define LCD_PINS_ENABLE 17 + #define LCD_PINS_RS EXP1_04_PIN + #define LCD_PINS_ENABLE EXP1_03_PIN #endif #if ENABLED(FYSETC_MINI_12864) #define DOGLCD_CS LCD_PINS_ENABLE #define DOGLCD_A0 LCD_PINS_RS - #define DOGLCD_SCK 76 - #define DOGLCD_MOSI 75 + #define DOGLCD_SCK EXP2_09_PIN + #define DOGLCD_MOSI EXP2_05_PIN //#define FORCE_SOFT_SPI // Use this if default of hardware SPI causes display problems // results in LCD soft SPI mode 3, SD soft SPI mode 0 - #define LCD_RESET_PIN 23 // Must be high or open for LCD to operate normally. + #define LCD_RESET_PIN EXP1_05_PIN // Must be high or open for LCD to operate normally. #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN - #define RGB_LED_R_PIN 25 + #define RGB_LED_R_PIN EXP1_06_PIN #endif #ifndef RGB_LED_G_PIN - #define RGB_LED_G_PIN 27 + #define RGB_LED_G_PIN EXP1_07_PIN #endif #ifndef RGB_LED_B_PIN - #define RGB_LED_B_PIN 29 + #define RGB_LED_B_PIN EXP1_08_PIN #endif #elif ENABLED(FYSETC_MINI_12864_2_1) - #define NEOPIXEL_PIN 25 + #define NEOPIXEL_PIN EXP1_06_PIN #endif #elif IS_NEWPANEL - #define LCD_PINS_D4 23 - #define LCD_PINS_D5 25 - #define LCD_PINS_D6 27 - #define LCD_PINS_D7 29 + #define LCD_PINS_D4 EXP1_05_PIN + #define LCD_PINS_D5 EXP1_06_PIN + #define LCD_PINS_D6 EXP1_07_PIN + #define LCD_PINS_D7 EXP1_08_PIN #if ENABLED(MINIPANEL) - #define DOGLCD_CS 25 - #define DOGLCD_A0 27 + #define DOGLCD_CS EXP1_06_PIN + #define DOGLCD_A0 EXP1_07_PIN #endif #endif #if ANY(VIKI2, miniVIKI) - #define DOGLCD_A0 16 + #define DOGLCD_A0 EXP1_04_PIN #define KILL_PIN 51 - #define STAT_LED_BLUE_PIN 29 - #define STAT_LED_RED_PIN 23 - #define DOGLCD_CS 17 - #define DOGLCD_SCK 76 // SCK_PIN - Required for DUE Hardware SPI - #define DOGLCD_MOSI 75 // MOSI_PIN - #define DOGLCD_MISO 74 // MISO_PIN + #define STAT_LED_BLUE_PIN EXP1_08_PIN + #define STAT_LED_RED_PIN EXP1_05_PIN + #define DOGLCD_CS EXP1_03_PIN + #define DOGLCD_SCK EXP2_09_PIN // SCK_PIN - Required for DUE Hardware SPI + #define DOGLCD_MOSI EXP2_05_PIN // MOSI_PIN + #define DOGLCD_MISO EXP2_10_PIN // MISO_PIN #endif #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) diff --git a/Marlin/src/pins/sam/pins_RURAMPS4D_11.h b/Marlin/src/pins/sam/pins_RURAMPS4D_11.h index 643c68ae4fad..9d24828ce3aa 100644 --- a/Marlin/src/pins/sam/pins_RURAMPS4D_11.h +++ b/Marlin/src/pins/sam/pins_RURAMPS4D_11.h @@ -153,7 +153,7 @@ // SPI for MAX Thermocouple /* #if DISABLED(SDSUPPORT) - #define TEMP_0_CS_PIN 53 + #define TEMP_0_CS_PIN EXP1_03_PIN #else #define TEMP_0_CS_PIN 49 #endif @@ -190,59 +190,87 @@ // 32Mb FLASH //#define SPI_FLASH_CS_PIN ? +/** + * ------ ------ + * (BEEPER) 62 |10 9 | 40 (BTN_ENC) (MISO) 74 |10 9 | 76 (SCK) + * (LCD_EN) 64 | 8 7 | 63 (LCD_RS) (BTN_EN1) 44 | 8 7 | 10 (SD_SS) + * (LCD_D4) 48 | 6 5 50 (LCD_D5) (BTN_EN2) 42 | 6 5 75 (MOSI) + * (LCD_D6) 52 | 4 3 | 53 (LCD_D7) (SD_DETECT) 51 | 4 3 | RESET + * GND | 2 1 | 5V GND | 2 1 | -- + * ------ ------ + * EXP1 EXP2 + */ +#define EXP1_03_PIN 53 +#define EXP1_04_PIN 52 +#define EXP1_05_PIN 50 +#define EXP1_06_PIN 48 +#define EXP1_07_PIN 63 +#define EXP1_08_PIN 64 +#define EXP1_09_PIN 40 +#define EXP1_10_PIN 62 + +#define EXP2_03_PIN -1 // RESET +#define EXP2_04_PIN 51 +#define EXP2_05_PIN 75 // MOSI +#define EXP2_06_PIN 42 +#define EXP2_07_PIN 10 +#define EXP2_08_PIN 44 +#define EXP2_09_PIN 76 // SCK +#define EXP2_10_PIN 74 // MISO + // // LCD / Controller // #if HAS_WIRED_LCD #if ANY(RADDS_DISPLAY, IS_RRD_SC, IS_RRD_FG_SC) - #define BEEPER_PIN 62 - #define LCD_PINS_D4 48 - #define LCD_PINS_D5 50 - #define LCD_PINS_D6 52 - #define LCD_PINS_D7 53 - #define SD_DETECT_PIN 51 + #define BEEPER_PIN EXP1_10_PIN + #define LCD_PINS_D4 EXP1_06_PIN + #define LCD_PINS_D5 EXP1_05_PIN + #define LCD_PINS_D6 EXP1_04_PIN + #define LCD_PINS_D7 EXP1_03_PIN + #define SD_DETECT_PIN EXP2_04_PIN #endif #if EITHER(RADDS_DISPLAY, IS_RRD_SC) - #define LCD_PINS_RS 63 - #define LCD_PINS_ENABLE 64 + #define LCD_PINS_RS EXP1_07_PIN + #define LCD_PINS_ENABLE EXP1_08_PIN #elif IS_RRD_FG_SC - #define LCD_PINS_RS 52 - #define LCD_PINS_ENABLE 53 + #define LCD_PINS_RS EXP1_04_PIN + #define LCD_PINS_ENABLE EXP1_03_PIN #elif HAS_U8GLIB_I2C_OLED - #define BEEPER_PIN 62 - #define LCD_SDSS 10 - #define SD_DETECT_PIN 51 + #define BEEPER_PIN EXP1_10_PIN + #define LCD_SDSS EXP2_07_PIN + #define SD_DETECT_PIN EXP2_04_PIN #elif ENABLED(FYSETC_MINI_12864) - #define BEEPER_PIN 62 - #define DOGLCD_CS 64 - #define DOGLCD_A0 63 + #define BEEPER_PIN EXP1_10_PIN + #define DOGLCD_CS EXP1_08_PIN + #define DOGLCD_A0 EXP1_07_PIN //#define FORCE_SOFT_SPI // Use this if default of hardware SPI causes display problems // results in LCD soft SPI mode 3, SD soft SPI mode 0 - #define LCD_RESET_PIN 48 // Must be high or open for LCD to operate normally. + #define LCD_RESET_PIN EXP1_06_PIN // Must be high or open for LCD to operate normally. #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN - #define RGB_LED_R_PIN 50 // D5 + #define RGB_LED_R_PIN EXP1_05_PIN // D5 #endif #ifndef RGB_LED_G_PIN - #define RGB_LED_G_PIN 52 // D6 + #define RGB_LED_G_PIN EXP1_04_PIN // D6 #endif #ifndef RGB_LED_B_PIN - #define RGB_LED_B_PIN 53 // D7 + #define RGB_LED_B_PIN EXP1_03_PIN // D7 #endif #elif ENABLED(FYSETC_MINI_12864_2_1) - #define NEOPIXEL_PIN 50 // D5 + #define NEOPIXEL_PIN EXP1_05_PIN // D5 #endif #elif ENABLED(SPARK_FULL_GRAPHICS) @@ -259,9 +287,9 @@ #endif // SPARK_FULL_GRAPHICS #if IS_NEWPANEL - #define BTN_EN1 44 - #define BTN_EN2 42 - #define BTN_ENC 40 + #define BTN_EN1 EXP2_08_PIN + #define BTN_EN2 EXP2_06_PIN + #define BTN_ENC EXP1_09_PIN #endif #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) diff --git a/Marlin/src/pins/sam/pins_RURAMPS4D_13.h b/Marlin/src/pins/sam/pins_RURAMPS4D_13.h index ee741dcbf540..cc919d0a4fdc 100644 --- a/Marlin/src/pins/sam/pins_RURAMPS4D_13.h +++ b/Marlin/src/pins/sam/pins_RURAMPS4D_13.h @@ -173,74 +173,101 @@ // 32Mb FLASH //#define SPI_FLASH_CS_PIN ? +/** + * ------ ------ + * (BEEPER) 62 |10 9 | 40 (BTN_ENC) (MISO) 74 |10 9 | 76 (SCK) + * (LCD_EN) 64 | 8 7 | 63 (LCD_RS) (BTN_EN1) 44 | 8 7 | 10 (SD_SS) + * (LCD_D4) 48 | 6 5 50 (LCD_D5) (BTN_EN2) 42 | 6 5 75 (MOSI) + * (LCD_D6) 52 | 4 3 | 53 (LCD_D7) (SD_DETECT) 51 | 4 3 | RESET + * GND | 2 1 | 5V GND | 2 1 | -- + * ------ ------ + * EXP1 EXP2 + */ +#define EXP1_03_PIN 53 +#define EXP1_04_PIN 52 +#define EXP1_05_PIN 50 +#define EXP1_06_PIN 48 +#define EXP1_07_PIN 63 +#define EXP1_08_PIN 64 +#define EXP1_09_PIN 40 +#define EXP1_10_PIN 62 + +#define EXP2_03_PIN -1 // RESET +#define EXP2_04_PIN 51 +#define EXP2_05_PIN 75 // MOSI +#define EXP2_06_PIN 42 +#define EXP2_07_PIN 10 +#define EXP2_08_PIN 44 +#define EXP2_09_PIN 76 // SCK +#define EXP2_10_PIN 74 // MISO + // // LCD / Controller // #if HAS_WIRED_LCD #if ANY(RADDS_DISPLAY, IS_RRD_SC, IS_RRD_FG_SC) - #define BEEPER_PIN 62 - #define LCD_PINS_D4 48 - #define LCD_PINS_D5 50 - #define LCD_PINS_D6 52 - #define LCD_PINS_D7 53 - #define SD_DETECT_PIN 51 + #define BEEPER_PIN EXP1_10_PIN + #define LCD_PINS_D4 EXP1_06_PIN + #define LCD_PINS_D5 EXP1_05_PIN + #define LCD_PINS_D6 EXP1_04_PIN + #define LCD_PINS_D7 EXP1_03_PIN + #define SD_DETECT_PIN EXP2_04_PIN #endif #if EITHER(RADDS_DISPLAY, IS_RRD_SC) - #define LCD_PINS_RS 63 - #define LCD_PINS_ENABLE 64 + #define LCD_PINS_RS EXP1_07_PIN + #define LCD_PINS_ENABLE EXP1_08_PIN #elif IS_RRD_FG_SC - #define LCD_PINS_RS 52 - #define LCD_PINS_ENABLE 53 + #define LCD_PINS_RS EXP1_04_PIN + #define LCD_PINS_ENABLE EXP1_03_PIN #elif HAS_U8GLIB_I2C_OLED - #define BEEPER_PIN 62 - #define LCD_SDSS 10 - #define SD_DETECT_PIN 51 + #define BEEPER_PIN EXP1_10_PIN + #define LCD_SDSS EXP2_07_PIN + #define SD_DETECT_PIN EXP2_04_PIN #elif ENABLED(FYSETC_MINI_12864) - #define BEEPER_PIN 62 - #define DOGLCD_CS 64 - #define DOGLCD_A0 63 + #define BEEPER_PIN EXP1_10_PIN + #define DOGLCD_CS EXP1_08_PIN + #define DOGLCD_A0 EXP1_07_PIN //#define FORCE_SOFT_SPI // Use this if default of hardware SPI causes display problems // results in LCD soft SPI mode 3, SD soft SPI mode 0 - #define LCD_RESET_PIN 48 // Must be high or open for LCD to operate normally. + #define LCD_RESET_PIN EXP1_06_PIN // Must be high or open for LCD to operate normally. #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN - #define RGB_LED_R_PIN 50 // D5 + #define RGB_LED_R_PIN EXP1_05_PIN // D5 #endif #ifndef RGB_LED_G_PIN - #define RGB_LED_G_PIN 52 // D6 + #define RGB_LED_G_PIN EXP1_04_PIN // D6 #endif #ifndef RGB_LED_B_PIN - #define RGB_LED_B_PIN 53 // D7 + #define RGB_LED_B_PIN EXP1_03_PIN // D7 #endif #elif ENABLED(FYSETC_MINI_12864_2_1) - #define NEOPIXEL_PIN 50 // D5 + #define NEOPIXEL_PIN EXP1_05_PIN // D5 #endif #elif ENABLED(MKS_MINI_12864) + #define DOGLCD_A0 EXP1_04_PIN + #define DOGLCD_CS EXP1_05_PIN - #define DOGLCD_A0 52 - #define DOGLCD_CS 50 - - #define SD_DETECT_PIN 51 + #define SD_DETECT_PIN EXP2_04_PIN #endif #if IS_NEWPANEL - #define BTN_EN1 44 - #define BTN_EN2 42 - #define BTN_ENC 40 + #define BTN_EN1 EXP2_08_PIN + #define BTN_EN2 EXP2_06_PIN + #define BTN_ENC EXP1_09_PIN #endif #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h index f7a47a8f143d..38f10f671359 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h @@ -205,6 +205,34 @@ //#define LED_PIN PB2 +/** + * ------ ------ + * PC5 |10 9 | PE13 PA6 |10 9 | PA5 + * PD13 | 8 7 | PC6 PE8 | 8 7 | PE10 + * PE14 | 6 5 PE15 PE11 | 6 5 PA7 + * PD11 | 4 3 | PD10 PE12 | 4 3 | RESET + * GND | 2 1 | 5V GND | 2 1 | 3.3V + * ------ ------ + * EXP1 EXP2 + */ +#define EXP1_03_PIN PD10 +#define EXP1_04_PIN PD11 +#define EXP1_05_PIN PE15 +#define EXP1_06_PIN PE14 +#define EXP1_07_PIN PC6 +#define EXP1_08_PIN PD13 +#define EXP1_09_PIN PE13 +#define EXP1_10_PIN PC5 + +#define EXP2_03_PIN -1 +#define EXP2_04_PIN PE12 +#define EXP2_05_PIN PA7 +#define EXP2_06_PIN PE11 +#define EXP2_07_PIN PE10 +#define EXP2_08_PIN PE8 +#define EXP2_09_PIN PA5 +#define EXP2_10_PIN PA6 + // // SD Card // @@ -219,11 +247,11 @@ #define ONBOARD_SD_CS_PIN PC11 #elif SD_CONNECTION_IS(LCD) #define ENABLE_SPI1 - #define SDSS PE10 - #define SD_SCK_PIN PA5 - #define SD_MISO_PIN PA6 - #define SD_MOSI_PIN PA7 - #define SD_DETECT_PIN PE12 + #define SDSS EXP2_07_PIN + #define SD_SCK_PIN EXP2_09_PIN + #define SD_MISO_PIN EXP2_10_PIN + #define SD_MOSI_PIN EXP2_05_PIN + #define SD_DETECT_PIN EXP2_04_PIN #endif // @@ -240,27 +268,26 @@ // Shared SPI TFT - #define LCD_BACKLIGHT_PIN PD13 + #define LCD_BACKLIGHT_PIN EXP1_08_PIN - #define TOUCH_CS_PIN PE14 // SPI1_NSS - #define TOUCH_SCK_PIN PA5 // SPI1_SCK - #define TOUCH_MISO_PIN PA6 // SPI1_MISO - #define TOUCH_MOSI_PIN PA7 // SPI1_MOSI + #define TOUCH_CS_PIN EXP1_06_PIN // SPI1_NSS + #define TOUCH_SCK_PIN EXP2_09_PIN // SPI1_SCK + #define TOUCH_MISO_PIN EXP2_10_PIN // SPI1_MISO + #define TOUCH_MOSI_PIN EXP2_05_PIN // SPI1_MOSI - #define BTN_EN1 PE8 - #define BTN_EN2 PE11 - #define BTN_ENC PE13 + #define BTN_EN1 EXP2_08_PIN + #define BTN_EN2 EXP2_06_PIN + #define BTN_ENC EXP1_09_PIN - #define TFT_CS_PIN PD11 - #define TFT_SCK_PIN PA5 - #define TFT_MISO_PIN PA6 - #define TFT_MOSI_PIN PA7 - #define TFT_DC_PIN PD10 - #define TFT_RST_PIN PC6 + #define TFT_CS_PIN EXP1_04_PIN + #define TFT_SCK_PIN EXP2_09_PIN + #define TFT_MISO_PIN EXP2_10_PIN + #define TFT_MOSI_PIN EXP2_05_PIN + #define TFT_DC_PIN EXP1_03_PIN #define TFT_A0_PIN TFT_DC_PIN - #define TFT_RESET_PIN PC6 - #define TFT_BACKLIGHT_PIN PD13 + #define TFT_RESET_PIN EXP1_07_PIN + #define TFT_BACKLIGHT_PIN LCD_BACKLIGHT_PIN #define TOUCH_BUTTONS_HW_SPI #define TOUCH_BUTTONS_HW_SPI_DEVICE 1 @@ -271,22 +298,22 @@ #if ENABLED(TFT_CLASSIC_UI) // Emulated DOGM SPI - #define LCD_PINS_ENABLE PD13 - #define LCD_PINS_RS PC6 - #define BTN_ENC PE13 - #define BTN_EN1 PE8 - #define BTN_EN2 PE11 + #define LCD_PINS_ENABLE EXP1_08_PIN + #define LCD_PINS_RS EXP1_07_PIN + #define BTN_ENC EXP1_09_PIN + #define BTN_EN1 EXP2_08_PIN + #define BTN_EN2 EXP2_06_PIN #elif ENABLED(TFT_COLOR_UI) #define TFT_BUFFER_SIZE 14400 #endif #if HAS_WIRED_LCD && !HAS_SPI_TFT - #define BEEPER_PIN PC5 - #define BTN_ENC PE13 - #define LCD_PINS_ENABLE PD13 - #define LCD_PINS_RS PC6 - #define BTN_EN1 PE8 - #define BTN_EN2 PE11 + #define BEEPER_PIN EXP1_10_PIN + #define BTN_ENC EXP1_09_PIN + #define LCD_PINS_ENABLE EXP1_08_PIN + #define LCD_PINS_RS EXP1_07_PIN + #define BTN_EN1 EXP2_08_PIN + #define BTN_EN2 EXP2_06_PIN #define LCD_BACKLIGHT_PIN -1 #if ENABLED(MKS_MINI_12864) @@ -296,18 +323,18 @@ #define LCD_BACKLIGHT_PIN -1 #define LCD_RESET_PIN -1 - #define DOGLCD_A0 PD11 - #define DOGLCD_CS PE15 - #define DOGLCD_SCK PA5 - #define DOGLCD_MOSI PA7 + #define DOGLCD_A0 EXP1_04_PIN + #define DOGLCD_CS EXP1_05_PIN + #define DOGLCD_SCK EXP2_09_PIN + #define DOGLCD_MOSI EXP2_05_PIN #elif IS_TFTGLCD_PANEL #if ENABLED(TFTGLCD_PANEL_SPI) - #define PIN_SPI_SCK PA5 - #define PIN_TFT_MISO PA6 - #define PIN_TFT_MOSI PA7 - #define TFTGLCD_CS PE8 + #define PIN_SPI_SCK EXP2_09_PIN + #define PIN_TFT_MISO EXP2_10_PIN + #define PIN_TFT_MOSI EXP2_05_PIN + #define TFTGLCD_CS EXP2_08_PIN #endif #ifndef BEEPER_PIN @@ -315,14 +342,14 @@ #endif #elif ENABLED(FYSETC_MINI_12864_2_1) - #define LCD_PINS_DC PC6 - #define DOGLCD_CS PD13 + #define LCD_PINS_DC EXP1_07_PIN + #define DOGLCD_CS EXP1_08_PIN #define DOGLCD_A0 DOGLCD_A0 #define LCD_BACKLIGHT_PIN -1 - #define LCD_RESET_PIN PE14 - #define NEOPIXEL_PIN PE15 - #define DOGLCD_MOSI PA7 - #define DOGLCD_SCK PA5 + #define LCD_RESET_PIN EXP1_06_PIN + #define NEOPIXEL_PIN EXP1_05_PIN + #define DOGLCD_MOSI EXP2_05_PIN + #define DOGLCD_SCK EXP2_09_PIN #if SD_CONNECTION_IS(ONBOARD) #define FORCE_SOFT_SPI #endif @@ -330,11 +357,11 @@ #else // !MKS_MINI_12864 - #define LCD_PINS_D4 PE14 + #define LCD_PINS_D4 EXP1_06_PIN #if IS_ULTIPANEL - #define LCD_PINS_D5 PE15 - #define LCD_PINS_D6 PD11 - #define LCD_PINS_D7 PD10 + #define LCD_PINS_D5 EXP1_05_PIN + #define LCD_PINS_D6 EXP1_04_PIN + #define LCD_PINS_D7 EXP1_03_PIN #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) #define BTN_ENC_EN LCD_PINS_D7 // Detect the presence of the encoder @@ -360,7 +387,7 @@ #endif #ifndef BEEPER_PIN - #define BEEPER_PIN PC5 + #define BEEPER_PIN EXP1_10_PIN #endif #if ENABLED(SPEAKER) && BEEPER_PIN == PC5 diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h index 8337e5fac49a..9ce5d270b556 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h @@ -282,11 +282,10 @@ #define TFT_MISO_PIN PA6 #define TFT_MOSI_PIN PA7 #define TFT_DC_PIN PD10 - #define TFT_RST_PIN PC6 #define TFT_A0_PIN TFT_DC_PIN #define TFT_RESET_PIN PC6 - #define TFT_BACKLIGHT_PIN PD13 + #define TFT_BACKLIGHT_PIN LCD_BACKLIGHT_PIN #define TOUCH_BUTTONS_HW_SPI #define TOUCH_BUTTONS_HW_SPI_DEVICE 1 diff --git a/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h index d526c75b6396..4e311d48628a 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h @@ -527,6 +527,11 @@ #endif #if HAS_SPI_TFT + + #define BTN_EN1 EXP2_08_PIN + #define BTN_EN2 EXP2_06_PIN + #define BTN_ENC EXP1_09_PIN + // // e.g., BTT_TFT35_SPI_V1_0 (480x320, 3.5", SPI Stock Display with Rotary Encoder in BIQU B1 SE) // @@ -542,9 +547,6 @@ #define TOUCH_SCK_PIN EXP1_06_PIN #define TOUCH_CS_PIN EXP1_07_PIN - #define BTN_EN1 EXP2_08_PIN - #define BTN_EN2 EXP2_06_PIN - #define BTN_ENC EXP1_09_PIN #endif // diff --git a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8.h b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8.h index d52cd77909ac..e55f3170d03e 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8.h @@ -289,16 +289,16 @@ #define TFT_MISO_PIN EXP2_10_PIN #define TFT_MOSI_PIN EXP2_05_PIN #define TFT_DC_PIN EXP1_03_PIN - #define TFT_RST_PIN EXP1_07_PIN #define TFT_A0_PIN TFT_DC_PIN #define TFT_RESET_PIN EXP1_07_PIN - #define TFT_BACKLIGHT_PIN EXP1_08_PIN + + #define LCD_BACKLIGHT_PIN EXP1_08_PIN + #define TFT_BACKLIGHT_PIN LCD_BACKLIGHT_PIN #define TOUCH_BUTTONS_HW_SPI #define TOUCH_BUTTONS_HW_SPI_DEVICE 1 - #define LCD_BACKLIGHT_PIN EXP1_08_PIN #ifndef TFT_WIDTH #define TFT_WIDTH 480 #endif diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h index ead8799f5e09..989010e47f36 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h @@ -283,16 +283,16 @@ #define TFT_MISO_PIN EXP2_10_PIN #define TFT_MOSI_PIN EXP2_05_PIN #define TFT_DC_PIN EXP1_03_PIN - #define TFT_RST_PIN EXP1_07_PIN #define TFT_A0_PIN TFT_DC_PIN #define TFT_RESET_PIN EXP1_07_PIN - #define TFT_BACKLIGHT_PIN EXP1_08_PIN + + #define LCD_BACKLIGHT_PIN EXP1_08_PIN + #define TFT_BACKLIGHT_PIN LCD_BACKLIGHT_PIN #define TOUCH_BUTTONS_HW_SPI #define TOUCH_BUTTONS_HW_SPI_DEVICE 1 - #define LCD_BACKLIGHT_PIN EXP1_08_PIN #ifndef TFT_WIDTH #define TFT_WIDTH 480 #endif diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h index 2ce06e356c39..1627bb909b4c 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h @@ -305,16 +305,15 @@ #define TFT_MISO_PIN EXP2_10_PIN #define TFT_MOSI_PIN EXP2_05_PIN #define TFT_DC_PIN EXP1_03_PIN - #define TFT_RST_PIN EXP1_07_PIN #define TFT_A0_PIN TFT_DC_PIN #define TFT_RESET_PIN EXP1_07_PIN - #define TFT_BACKLIGHT_PIN EXP1_08_PIN + #define LCD_BACKLIGHT_PIN EXP1_08_PIN + #define TFT_BACKLIGHT_PIN LCD_BACKLIGHT_PIN #define TOUCH_BUTTONS_HW_SPI #define TOUCH_BUTTONS_HW_SPI_DEVICE 1 - #define LCD_BACKLIGHT_PIN EXP1_08_PIN #ifndef TFT_WIDTH #define TFT_WIDTH 480 #endif diff --git a/Marlin/src/pins/stm32f4/pins_VAKE403D.h b/Marlin/src/pins/stm32f4/pins_VAKE403D.h index 864a69d35093..66caec588f60 100644 --- a/Marlin/src/pins/stm32f4/pins_VAKE403D.h +++ b/Marlin/src/pins/stm32f4/pins_VAKE403D.h @@ -161,27 +161,61 @@ #define POWER_LOSS_PIN PA4 // ?? Power loss / nAC_FAULT #if ENABLED(SDSUPPORT) - #define SD_DETECT_PIN PB7 - #define SD_SS_PIN PB_15 // USD_CS -> CS for onboard SD + #define SD_DETECT_PIN EXP2_04_PIN + #define SD_SS_PIN PB15 // USD_CS -> CS for onboard SD #endif +/** + * ------ ------ + * PC9 |10 9 | PB12 ? |10 9 | ? + * PD7 | 8 7 | PC12 PD6 | 8 7 | ? + * PD1 | 6 5 PD2 PD0 | 6 5 ? + * PD3 | 4 3 | PD4 PB7 | 4 3 | RESET + * GND | 2 1 | 5V GND | 2 1 | 3.3V + * ------ ------ + * EXP1 EXP2 + */ +#define EXP1_03_PIN PD4 +#define EXP1_04_PIN PD3 +#define EXP1_05_PIN PD2 +#define EXP1_06_PIN PD1 +#define EXP1_07_PIN PC12 +#define EXP1_08_PIN PD7 +#define EXP1_09_PIN PB12 +#define EXP1_10_PIN PC9 + +#define EXP2_03_PIN -1 +#define EXP2_04_PIN PB7 +//#define EXP2_05_PIN ? +#define EXP2_06_PIN PD0 +//#define EXP2_07_PIN ? +#define EXP2_08_PIN PD6 +//#define EXP2_09_PIN ? +//#define EXP2_10_PIN ? + // // LCD / Controller // #if HAS_WIRED_LCD + #if ENABLED(SDSUPPORT) #define SDSS PB6 // CS for SD card in LCD #endif - #define BEEPER_PIN PC9 - #define LCD_PINS_RS PC12 - #define LCD_PINS_ENABLE PD7 - #define LCD_PINS_D4 PD1 - #define LCD_PINS_D5 PD2 - #define LCD_PINS_D6 PD3 - #define LCD_PINS_D7 PD4 - #define BTN_EN1 PD6 - #define BTN_EN2 PD0 - #define BTN_ENC PB12 + + #define BEEPER_PIN EXP1_10_PIN + + #define BTN_EN1 EXP2_08_PIN + #define BTN_EN2 EXP2_06_PIN + #define BTN_ENC EXP1_09_PIN + + #define LCD_PINS_ENABLE EXP1_08_PIN + #define LCD_PINS_RS EXP1_07_PIN + + #define LCD_PINS_D4 EXP1_06_PIN + #define LCD_PINS_D5 EXP1_05_PIN + #define LCD_PINS_D6 EXP1_04_PIN + #define LCD_PINS_D7 EXP1_03_PIN + #endif // Alter timing for graphical display diff --git a/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h b/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h index f48c007d8cec..5a772eb21b09 100644 --- a/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h +++ b/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h @@ -50,8 +50,6 @@ #define LED_PIN PA13 #define BEEPER_PIN PA14 -#define TFT_BACKLIGHT_PIN PB5 - #define POWER_MONITOR_PIN PB0 #define RPI_POWER_PIN PE5 From 639b1f64c64c581f67c5133f5d13144eccfb90bd Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Mon, 23 May 2022 19:39:50 +1200 Subject: [PATCH 097/241] =?UTF-8?q?Revert=20"Firmware=20upload=E2=80=A6"?= =?UTF-8?q?=20(#24229)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scripts/upload_prompt_extra_script.py | 52 ------------------- ini/stm32f1.ini | 7 --- 2 files changed, 59 deletions(-) delete mode 100755 buildroot/share/PlatformIO/scripts/upload_prompt_extra_script.py diff --git a/buildroot/share/PlatformIO/scripts/upload_prompt_extra_script.py b/buildroot/share/PlatformIO/scripts/upload_prompt_extra_script.py deleted file mode 100755 index 87cc945089b8..000000000000 --- a/buildroot/share/PlatformIO/scripts/upload_prompt_extra_script.py +++ /dev/null @@ -1,52 +0,0 @@ -# -# upload_prompt_extra_script.py -# set the output_port -# -from __future__ import print_function - -has_tkinter = False -try: - import sys - if sys.version_info[0] < 3: - import Tkinter as tk - import tkFileDialog as fileDialog - from Tkinter import Tk - else: - import tkinter as tk - from tkinter import Tk - from tkinter import filedialog as fileDialog - has_tkinter = True -except: - pass - -import pioutil -if has_tkinter and pioutil.is_pio_build(): - - Import("env") - - def print_error(e): - print('\nUnable to find destination disk (%s)\n' %( e ) ) - - def before_upload(source, target, env): - # - # Find a disk for upload - # - upload_disk = '' - - root = Tk() # pointing root to Tk() to use it as Tk() in program. - root.withdraw() # Hides small tkinter window. - - root.attributes('-topmost', True) # Opened windows will be active. above all windows despite of selection. - - upload_disk = fileDialog.askdirectory(title="Select the root of your SDCARD") # Returns opened path as str - if not upload_disk: - print_error('Canceled') - return - else: - env.Replace( - UPLOAD_FLAGS="-P$UPLOAD_PORT" - ) - env.Replace(UPLOAD_PORT=upload_disk) - print('\nUpload disk: ', upload_disk, '\n') - - env.AddPreAction("upload", before_upload) diff --git a/ini/stm32f1.ini b/ini/stm32f1.ini index 4b3714f6d413..6bf6a1cb851c 100644 --- a/ini/stm32f1.ini +++ b/ini/stm32f1.ini @@ -148,10 +148,6 @@ upload_protocol = custom [env:STM32F103RE_creality] extends = STM32F103Rx_creality board = genericSTM32F103RE -extra_scripts = ${STM32F103Rx_creality.extra_scripts} - buildroot/share/PlatformIO/scripts/upload_prompt_extra_script.py -upload_protocol = mbed - [env:STM32F103RE_creality_xfer] extends = STM32F103Rx_creality_xfer @@ -168,9 +164,6 @@ board_upload.offset_address = 0x08010000 [env:STM32F103RC_creality] extends = STM32F103Rx_creality board = genericSTM32F103RC -extra_scripts = ${STM32F103Rx_creality.extra_scripts} - buildroot/share/PlatformIO/scripts/upload_prompt_extra_script.py -upload_protocol = mbed [env:STM32F103RC_creality_xfer] extends = STM32F103Rx_creality_xfer From 31413a7d773e384753dd889ca2f5dcd8aa1fdeca Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 23 May 2022 21:59:36 -0500 Subject: [PATCH 098/241] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Com?= =?UTF-8?q?bined=20axis=20strings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/types.h | 4 ++-- Marlin/src/gcode/config/M200-M205.cpp | 4 ++-- Marlin/src/gcode/config/M92.cpp | 2 +- Marlin/src/gcode/feature/digipot/M907-M910.cpp | 2 +- Marlin/src/gcode/feature/pause/G61.cpp | 2 +- Marlin/src/gcode/motion/G0_G1.cpp | 2 +- Marlin/src/gcode/motion/M290.cpp | 2 +- Marlin/src/gcode/parser.h | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Marlin/src/core/types.h b/Marlin/src/core/types.h index 48a96d668cd4..ee996569254d 100644 --- a/Marlin/src/core/types.h +++ b/Marlin/src/core/types.h @@ -47,6 +47,7 @@ struct IF { typedef L type; }; #define NUM_AXIS_DEFS(T,V) NUM_AXIS_LIST(T x=V, T y=V, T z=V, T i=V, T j=V, T k=V, T u=V, T v=V, T w=V) #define MAIN_AXIS_NAMES NUM_AXIS_LIST(X, Y, Z, I, J, K, U, V, W) #define MAIN_AXIS_MAP(F) MAP(F, MAIN_AXIS_NAMES) +#define STR_AXES_MAIN NUM_AXIS_GANG("X", "Y", "Z", STR_I, STR_J, STR_K, STR_U, STR_V, STR_W) #define LOGICAL_AXIS_GANG(E,V...) NUM_AXIS_GANG(V) GANG_ITEM_E(E) #define LOGICAL_AXIS_CODE(E,V...) NUM_AXIS_CODE(V) CODE_ITEM_E(E) @@ -59,8 +60,7 @@ struct IF { typedef L type; }; #define LOGICAL_AXIS_DECL(T,V) LOGICAL_AXIS_LIST(T e=V, T x=V, T y=V, T z=V, T i=V, T j=V, T k=V, T u=V, T v=V, T w=V) #define LOGICAL_AXIS_NAMES LOGICAL_AXIS_LIST(E, X, Y, Z, I, J, K, U, V, W) #define LOGICAL_AXIS_MAP(F) MAP(F, LOGICAL_AXIS_NAMES) - -#define LOGICAL_AXES_STRING LOGICAL_AXIS_GANG("E", "X", "Y", "Z", STR_I, STR_J, STR_K, STR_U, STR_V, STR_W) +#define STR_AXES_LOGICAL LOGICAL_AXIS_GANG("E", "X", "Y", "Z", STR_I, STR_J, STR_K, STR_U, STR_V, STR_W) #define XYZ_GANG(V...) GANG_N(PRIMARY_LINEAR_AXES, V) #define XYZ_CODE(V...) CODE_N(PRIMARY_LINEAR_AXES, V) diff --git a/Marlin/src/gcode/config/M200-M205.cpp b/Marlin/src/gcode/config/M200-M205.cpp index 5911f77f2e28..9af8c3a2b305 100644 --- a/Marlin/src/gcode/config/M200-M205.cpp +++ b/Marlin/src/gcode/config/M200-M205.cpp @@ -113,7 +113,7 @@ * With multiple extruders use T to specify which one. */ void GcodeSuite::M201() { - if (!parser.seen("T" LOGICAL_AXES_STRING)) + if (!parser.seen("T" STR_AXES_LOGICAL)) return M201_report(); const int8_t target_extruder = get_target_extruder_from_command(); @@ -167,7 +167,7 @@ void GcodeSuite::M201_report(const bool forReplay/*=true*/) { * With multiple extruders use T to specify which one. */ void GcodeSuite::M203() { - if (!parser.seen("T" LOGICAL_AXES_STRING)) + if (!parser.seen("T" STR_AXES_LOGICAL)) return M203_report(); const int8_t target_extruder = get_target_extruder_from_command(); diff --git a/Marlin/src/gcode/config/M92.cpp b/Marlin/src/gcode/config/M92.cpp index 3d1a9cb7cebc..c7610b83a9b9 100644 --- a/Marlin/src/gcode/config/M92.cpp +++ b/Marlin/src/gcode/config/M92.cpp @@ -43,7 +43,7 @@ void GcodeSuite::M92() { if (target_extruder < 0) return; // No arguments? Show M92 report. - if (!parser.seen(LOGICAL_AXES_STRING TERN_(MAGIC_NUMBERS_GCODE, "HL"))) + if (!parser.seen(STR_AXES_LOGICAL TERN_(MAGIC_NUMBERS_GCODE, "HL"))) return M92_report(true, target_extruder); LOOP_LOGICAL_AXES(i) { diff --git a/Marlin/src/gcode/feature/digipot/M907-M910.cpp b/Marlin/src/gcode/feature/digipot/M907-M910.cpp index f1f1bcb484cf..9ebe713cde46 100644 --- a/Marlin/src/gcode/feature/digipot/M907-M910.cpp +++ b/Marlin/src/gcode/feature/digipot/M907-M910.cpp @@ -48,7 +48,7 @@ void GcodeSuite::M907() { #if HAS_MOTOR_CURRENT_SPI - if (!parser.seen("BS" LOGICAL_AXES_STRING)) + if (!parser.seen("BS" STR_AXES_LOGICAL)) return M907_report(); if (parser.seenval('S')) LOOP_L_N(i, MOTOR_CURRENT_COUNT) stepper.set_digipot_current(i, parser.value_int()); diff --git a/Marlin/src/gcode/feature/pause/G61.cpp b/Marlin/src/gcode/feature/pause/G61.cpp index b59e93ac0783..b85487af45c2 100644 --- a/Marlin/src/gcode/feature/pause/G61.cpp +++ b/Marlin/src/gcode/feature/pause/G61.cpp @@ -68,7 +68,7 @@ void GcodeSuite::G61() { SYNC_E(stored_position[slot].e); } else { - if (parser.seen(NUM_AXIS_GANG("X", "Y", "Z", STR_I, STR_J, STR_K, STR_U, STR_V, STR_W))) { + if (parser.seen(STR_AXES_MAIN)) { DEBUG_ECHOPGM(STR_RESTORING_POS " S", slot); LOOP_NUM_AXES(i) { destination[i] = parser.seenval(AXIS_CHAR(i)) diff --git a/Marlin/src/gcode/motion/G0_G1.cpp b/Marlin/src/gcode/motion/G0_G1.cpp index d647894d2774..933bf3d5d9ef 100644 --- a/Marlin/src/gcode/motion/G0_G1.cpp +++ b/Marlin/src/gcode/motion/G0_G1.cpp @@ -92,7 +92,7 @@ void GcodeSuite::G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move/*=false*/)) { if (MIN_AUTORETRACT <= MAX_AUTORETRACT) { // When M209 Autoretract is enabled, convert E-only moves to firmware retract/recover moves if (fwretract.autoretract_enabled && parser.seen_test('E') - && !parser.seen(NUM_AXIS_GANG("X", "Y", "Z", STR_I, STR_J, STR_K, STR_U, STR_V, STR_W)) + && !parser.seen(STR_AXES_MAIN) ) { const float echange = destination.e - current_position.e; // Is this a retract or recover move? diff --git a/Marlin/src/gcode/motion/M290.cpp b/Marlin/src/gcode/motion/M290.cpp index 6f6afa3a551b..4fe83ccd4079 100644 --- a/Marlin/src/gcode/motion/M290.cpp +++ b/Marlin/src/gcode/motion/M290.cpp @@ -87,7 +87,7 @@ void GcodeSuite::M290() { } #endif - if (!parser.seen(NUM_AXIS_GANG("X", "Y", "Z", STR_I, STR_J, STR_K, STR_U, STR_V, STR_W)) || parser.seen('R')) { + if (!parser.seen(STR_AXES_MAIN) || parser.seen('R')) { SERIAL_ECHO_START(); #if ENABLED(BABYSTEP_ZPROBE_OFFSET) diff --git a/Marlin/src/gcode/parser.h b/Marlin/src/gcode/parser.h index c91a0de5f219..3b46cde631bc 100644 --- a/Marlin/src/gcode/parser.h +++ b/Marlin/src/gcode/parser.h @@ -225,7 +225,7 @@ class GCodeParser { #endif // !FASTER_GCODE_PARSER // Seen any axis parameter - static bool seen_axis() { return seen(LOGICAL_AXES_STRING); } + static bool seen_axis() { return seen(STR_AXES_LOGICAL); } #if ENABLED(GCODE_QUOTED_STRINGS) static char* unescape_string(char* &src); From 0a8672ae6c070e68864d04f7b623cf537a67707e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 23 May 2022 22:03:59 -0500 Subject: [PATCH 099/241] =?UTF-8?q?=F0=9F=91=94=20Move=20actions=20to=20de?= =?UTF-8?q?fault=20branch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/pull_request_template.md | 22 ++++++++++----- .github/workflows/bump-date.yml | 39 +++++++++++++++++++++++++++ .github/workflows/check-pr.yml | 33 +++++++++++++++++++++++ .github/workflows/clean-closed.yml | 39 +++++++++++++++++++++++++++ .github/workflows/close-stale.yml | 28 +++++++++++++++++++ .github/workflows/lock-closed.yml | 32 ++++++++++++++++++++++ .github/workflows/unlock-reopened.yml | 22 +++++++++++++++ 7 files changed, 209 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/bump-date.yml create mode 100644 .github/workflows/check-pr.yml create mode 100644 .github/workflows/clean-closed.yml create mode 100644 .github/workflows/close-stale.yml create mode 100644 .github/workflows/lock-closed.yml create mode 100644 .github/workflows/unlock-reopened.yml diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index d82fb0f9e37b..cd5158b3ce8c 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,23 +1,33 @@ -### Requirements + ### Description +### Requirements + + + ### Benefits - + ### Configurations - + ### Related Issues - + diff --git a/.github/workflows/bump-date.yml b/.github/workflows/bump-date.yml new file mode 100644 index 000000000000..2366da725806 --- /dev/null +++ b/.github/workflows/bump-date.yml @@ -0,0 +1,39 @@ +# +# bump-date.yml +# Bump the distribution date once per day +# + +name: Bump Distribution Date + +on: + schedule: + - cron: '0 */6 * * *' + +jobs: + bump_date: + name: Bump Distribution Date + if: github.repository == 'MarlinFirmware/Marlin' + + runs-on: ubuntu-latest + + steps: + + - name: Check out bugfix-2.0.x + uses: actions/checkout@v2 + with: + ref: bugfix-2.0.x + + - name: Bump Distribution Date + run: | + # Inline Bump Script + if [[ ! "$( git log -1 --pretty=%B )" =~ ^\[cron\] ]]; then + DIST=$( date +"%Y-%m-%d" ) + eval "sed -E -i 's/(#define +STRING_DISTRIBUTION_DATE) .*$/\1 \"$DIST\"/g' Marlin/src/inc/Version.h" && \ + eval "sed -E -i 's/(#define +STRING_DISTRIBUTION_DATE) .*$/\1 \"$DIST\"/g' Marlin/Version.h" && \ + git config user.name "${GITHUB_ACTOR}" && \ + git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" && \ + git add . && \ + git commit -m "[cron] Bump distribution date ($DIST)" && \ + git push + fi + exit 0 diff --git a/.github/workflows/check-pr.yml b/.github/workflows/check-pr.yml new file mode 100644 index 000000000000..93a110f270d3 --- /dev/null +++ b/.github/workflows/check-pr.yml @@ -0,0 +1,33 @@ +# +# check-pr.yml +# Close PRs directed at release branches +# + +name: PR Bad Target + +on: + pull_request_target: + types: [opened] + branches: + - 1.0.x + - 1.1.x + - 2.0.x + +jobs: + bad_target: + name: PR Bad Target + if: github.repository == 'MarlinFirmware/Marlin' + + runs-on: ubuntu-latest + + steps: + - uses: superbrothers/close-pull-request@v3 + with: + comment: > + Thanks for your contribution! Unfortunately we can't accept PRs directed at release branches. We make patches to the bugfix branches and only later do we push them out as releases. + + Please redo this PR starting with the `bugfix-2.0.x` branch and be careful to target `bugfix-2.0.x` when resubmitting the PR. + + It may help to set your fork's default branch to `bugfix-2.0.x`. + + See [this page](http://marlinfw.org/docs/development/getting_started_pull_requests.html) for full instructions. diff --git a/.github/workflows/clean-closed.yml b/.github/workflows/clean-closed.yml new file mode 100644 index 000000000000..befec4498f25 --- /dev/null +++ b/.github/workflows/clean-closed.yml @@ -0,0 +1,39 @@ +# +# clean-closed.yml +# Remove obsolete labels when an Issue or PR is closed +# + +name: Clean Closed + +on: + pull_request: + types: [closed] + issues: + types: [closed] + +jobs: + remove_label: + runs-on: ubuntu-latest + + strategy: + matrix: + label: + - "S: Don't Merge" + - "S: Hold for 2.1" + - "S: Please Merge" + - "S: Please Test" + - "help wanted" + - "Needs: Discussion" + - "Needs: Documentation" + - "Needs: More Data" + - "Needs: Patch" + - "Needs: Testing" + - "Needs: Work" + + steps: + - uses: actions/checkout@v2 + - name: Remove Labels + uses: actions-ecosystem/action-remove-labels@v1 + with: + github_token: ${{ github.token }} + labels: ${{ matrix.label }} diff --git a/.github/workflows/close-stale.yml b/.github/workflows/close-stale.yml new file mode 100644 index 000000000000..f90c079f6605 --- /dev/null +++ b/.github/workflows/close-stale.yml @@ -0,0 +1,28 @@ +# +# close-stale.yml +# Close open issues after a period of inactivity +# + +name: Close Stale Issues + +on: + schedule: + - cron: "22 1 * * *" + +jobs: + stale: + name: Close Stale Issues + if: github.repository == 'MarlinFirmware/Marlin' + + runs-on: ubuntu-latest + + steps: + - uses: actions/stale@v3 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: 'This issue has had no activity in the last 60 days. Please add a reply if you want to keep this issue active, otherwise it will be automatically closed within 10 days.' + days-before-stale: 60 + days-before-close: 10 + stale-issue-label: 'stale-closing-soon' + exempt-all-assignees: true + exempt-issue-labels: 'Bug: Confirmed !,T: Feature Request,Needs: Discussion,Needs: Documentation,Needs: Patch,Needs: Work,Needs: Testing,help wanted,no-locking' diff --git a/.github/workflows/lock-closed.yml b/.github/workflows/lock-closed.yml new file mode 100644 index 000000000000..8cdcd7a8369e --- /dev/null +++ b/.github/workflows/lock-closed.yml @@ -0,0 +1,32 @@ +# +# lock-closed.yml +# Lock closed issues after a period of inactivity +# + +name: Lock Closed Issues + +on: + schedule: + - cron: '0 1/13 * * *' + +jobs: + lock: + name: Lock Closed Issues + if: github.repository == 'MarlinFirmware/Marlin' + + runs-on: ubuntu-latest + + steps: + - uses: dessant/lock-threads@v2 + with: + github-token: ${{ github.token }} + process-only: 'issues' + issue-lock-inactive-days: '60' + issue-exclude-created-before: '' + issue-exclude-labels: 'no-locking' + issue-lock-labels: '' + issue-lock-comment: > + This issue has been automatically locked since there + has not been any recent activity after it was closed. + Please open a new issue for related bugs. + issue-lock-reason: '' diff --git a/.github/workflows/unlock-reopened.yml b/.github/workflows/unlock-reopened.yml new file mode 100644 index 000000000000..614ef3fab297 --- /dev/null +++ b/.github/workflows/unlock-reopened.yml @@ -0,0 +1,22 @@ +# +# unlock-reopened.yml +# Unlock an issue whenever it is re-opened +# + +name: "Unlock reopened issue" + +on: + issues: + types: [reopened] + +jobs: + unlock: + name: Unlock Reopened + if: github.repository == 'MarlinFirmware/Marlin' + + runs-on: ubuntu-latest + + steps: + - uses: OSDKDev/unlock-issues@v1.1 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" From 0da862fd1e78559ec31d5bd03c4c1db65c53cd26 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 24 May 2022 06:07:20 +0000 Subject: [PATCH 100/241] [cron] Bump distribution date (2022-05-24) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 577682a00b85..5f868e3c99da 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-05-17" +//#define STRING_DISTRIBUTION_DATE "2022-05-24" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index fe5e5da90532..b4b2cb3c202d 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-05-17" + #define STRING_DISTRIBUTION_DATE "2022-05-24" #endif /** From eb0c4682d5e89b07038fa98346db1ab68c7ddc1a Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Wed, 25 May 2022 07:49:57 +1200 Subject: [PATCH 101/241] =?UTF-8?q?=F0=9F=93=8C=20Use=20MarlinSimUI/bugfix?= =?UTF-8?q?-2.0.x=20(#24232)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ini/native.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ini/native.ini b/ini/native.ini index b34945397ecf..e860a55958f2 100644 --- a/ini/native.ini +++ b/ini/native.ini @@ -41,7 +41,7 @@ debug_build_flags = -fstack-protector-strong -g -g3 -ggdb lib_compat_mode = off build_src_filter = ${common.default_src_filter} + lib_deps = ${common.lib_deps} - MarlinSimUI=https://github.com/p3p/MarlinSimUI/archive/0.0.2.zip + MarlinSimUI=https://github.com/p3p/MarlinSimUI/archive/refs/heads/bugfix-2.0.x.zip Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/marlin_sim_native.zip LiquidCrystal=https://github.com/p3p/LiquidCrystal/archive/master.zip extra_scripts = ${common.extra_scripts} From e197695f4caaa24dd30f91bf1563a0ed177e3e8d Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Wed, 25 May 2022 08:31:29 +1200 Subject: [PATCH 102/241] =?UTF-8?q?=F0=9F=8E=A8=20Remove=20MKS=20custom=20?= =?UTF-8?q?pins,=20TinyBee=20cleanup=20(#24186)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/ESP32/u8g_esp32_spi.cpp | 21 +++---- Marlin/src/pins/esp32/pins_MKS_TINYBEE.h | 78 +++++++++--------------- 2 files changed, 37 insertions(+), 62 deletions(-) diff --git a/Marlin/src/HAL/ESP32/u8g_esp32_spi.cpp b/Marlin/src/HAL/ESP32/u8g_esp32_spi.cpp index 5437e8181b95..a445035b2b43 100644 --- a/Marlin/src/HAL/ESP32/u8g_esp32_spi.cpp +++ b/Marlin/src/HAL/ESP32/u8g_esp32_spi.cpp @@ -23,24 +23,17 @@ */ #ifdef ARDUINO_ARCH_ESP32 -#include "../../inc/MarlinConfigPre.h" +#include "../../inc/MarlinConfig.h" #if EITHER(MKS_MINI_12864, FYSETC_MINI_12864_2_1) #include -#include "Arduino.h" #include "../shared/HAL_SPI.h" #include "HAL.h" #include "SPI.h" static SPISettings spiConfig; -#define MDOGLCD_MOSI 23 -#define MDOGLCD_SCK 18 -#define MLCD_RESET_PIN 0 -#define MLCD_PINS_DC 4 -#define MDOGLCD_CS 21 -#define MDOGLCD_A0 4 #ifndef LCD_SPI_SPEED #ifdef SD_SPI_SPEED @@ -61,24 +54,24 @@ uint8_t u8g_eps_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_pt case U8G_COM_MSG_STOP: break; case U8G_COM_MSG_INIT: - OUT_WRITE(MDOGLCD_CS, HIGH); - OUT_WRITE(MDOGLCD_A0, HIGH); - OUT_WRITE(MLCD_RESET_PIN, HIGH); + OUT_WRITE(DOGLCD_CS, HIGH); + OUT_WRITE(DOGLCD_A0, HIGH); + OUT_WRITE(LCD_RESET_PIN, HIGH); u8g_Delay(5); spiBegin(); spiInit(LCD_SPI_SPEED); break; case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */ - WRITE(MDOGLCD_A0, arg_val ? HIGH : LOW); + WRITE(DOGLCD_A0, arg_val ? HIGH : LOW); break; case U8G_COM_MSG_CHIP_SELECT: /* arg_val == 0 means HIGH level of U8G_PI_CS */ - WRITE(MDOGLCD_CS, arg_val ? LOW : HIGH); + WRITE(DOGLCD_CS, arg_val ? LOW : HIGH); break; case U8G_COM_MSG_RESET: - WRITE(MLCD_RESET_PIN, arg_val); + WRITE(LCD_RESET_PIN, arg_val); break; case U8G_COM_MSG_WRITE_BYTE: diff --git a/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h b/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h index ba3b60151b35..9938d9b4fa01 100644 --- a/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h +++ b/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h @@ -116,17 +116,7 @@ // // ADC Reference Voltage // -#define ADC_REFERENCE_VOLTAGE 2.5 // 2.5V reference VDDA - -// -// MicroSD card -// -#define SD_MOSI_PIN 23 -#define SD_MISO_PIN 19 -#define SD_SCK_PIN 18 -#define SDSS 5 -#define SD_DETECT_PIN 34 // IO34 default is SD_DET signal (Jump to SDDET) -#define USES_SHARED_SPI // SPI is shared by SD card with TMC SPI drivers +#define ADC_REFERENCE_VOLTAGE 2.5 // 2.5V reference VDDA /** * ------ ------ @@ -157,56 +147,48 @@ #define EXP2_09_PIN 18 #define EXP2_10_PIN 19 -#if HAS_WIRED_LCD +// +// MicroSD card +// +//#define SD_MOSI_PIN EXP2_05_PIN // uses esp32 default 23 +//#define SD_MISO_PIN EXP2_10_PIN // uses esp32 default 19 +//#define SD_SCK_PIN EXP2_09_PIN // uses esp32 default 18 +#define SDSS EXP2_07_PIN +#define SD_DETECT_PIN EXP2_04_PIN // IO34 default is SD_DET signal (Jump to SDDET) +#define USES_SHARED_SPI // SPI is shared by SD card with TMC SPI drivers - #define BEEPER_PIN 149 - #define BTN_ENC 13 - #define LCD_PINS_ENABLE 21 - #define LCD_PINS_RS 4 - #define BTN_EN1 14 - #define BTN_EN2 12 +#if HAS_WIRED_LCD + #define BEEPER_PIN EXP1_10_PIN + #define LCD_PINS_ENABLE EXP1_08_PIN + #define LCD_PINS_RS EXP1_07_PIN + #define BTN_ENC EXP1_09_PIN + #define BTN_EN1 EXP2_08_PIN + #define BTN_EN2 EXP2_06_PIN #define LCD_BACKLIGHT_PIN -1 - // MKS MINI12864 and MKS LCD12864B; If using MKS LCD12864A (Need to remove RPK2 resistor) #if ENABLED(MKS_MINI_12864) - - //#define LCD_BACKLIGHT_PIN -1 - //#define LCD_RESET_PIN -1 - #define DOGLCD_A0 15 - #define DOGLCD_CS 16 - //#define DOGLCD_SCK 19 - //#define DOGLCD_MOSI 23 - - // Required for MKS_MINI_12864 with this board - //#define MKS_LCD12864B - - #elif ENABLED(MKS_MINI_12864_V3) - - #define LCD_PINS_DC EXP1_07_PIN + // MKS MINI12864 and MKS LCD12864B; If using MKS LCD12864A (Need to remove RPK2 resistor) + #define DOGLCD_CS EXP1_05_PIN + #define DOGLCD_A0 EXP1_04_PIN + #define LCD_RESET_PIN -1 + #elif ENABLED(FYSETC_MINI_12864_2_1) + // MKS_MINI_12864_V3, BTT_MINI_12864_V1, FYSETC_MINI_12864_2_1 #define DOGLCD_CS EXP1_08_PIN - #define DOGLCD_A0 LCD_PINS_DC - #define LCD_BACKLIGHT_PIN -1 + #define DOGLCD_A0 EXP1_07_PIN #define LCD_RESET_PIN EXP1_06_PIN #define NEOPIXEL_PIN EXP1_05_PIN - #define DOGLCD_MOSI EXP2_05_PIN - #define DOGLCD_SCK EXP2_09_PIN #if SD_CONNECTION_IS(ONBOARD) #define FORCE_SOFT_SPI #endif - - #else // !MKS_MINI_12864 - - #define LCD_PINS_D4 0 + #else + #define LCD_PINS_D4 EXP1_06_PIN #if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) - #define LCD_PINS_D5 16 - #define LCD_PINS_D6 15 - #define LCD_PINS_D7 17 + #define LCD_PINS_D5 EXP1_05_PIN + #define LCD_PINS_D6 EXP1_04_PIN + #define LCD_PINS_D7 EXP1_03_PIN #endif - #define BOARD_ST7920_DELAY_1 96 #define BOARD_ST7920_DELAY_2 48 #define BOARD_ST7920_DELAY_3 600 - - #endif // !MKS_MINI_12864 - + #endif #endif // HAS_WIRED_LCD From 54c9358964a71e28dcff0f5f64055b07333757c4 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Wed, 25 May 2022 00:24:56 +0000 Subject: [PATCH 103/241] [cron] Bump distribution date (2022-05-25) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 5f868e3c99da..5ac850a15fca 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-05-24" +//#define STRING_DISTRIBUTION_DATE "2022-05-25" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index b4b2cb3c202d..e3a49200cf2d 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-05-24" + #define STRING_DISTRIBUTION_DATE "2022-05-25" #endif /** From 740f652b6ae77c0bb87bbc5d52ce0465989e678f Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Thu, 26 May 2022 16:07:10 -0700 Subject: [PATCH 104/241] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20Fix=20some=20mothe?= =?UTF-8?q?rboard=20checks=20(#24238)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/pins.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 82c91290c24c..a6e0fb6128f7 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -841,8 +841,8 @@ #elif MB(RAMPS_LONGER3D_LK4PRO) #error "BOARD_RAMPS_LONGER3D_LK4PRO is now BOARD_LONGER3D_LKx_PRO. Please update your configuration." #elif MB(BTT_SKR_V2_0) - #error "BTT_SKR_V2_0 is now BTT_SKR_V2_0_REV_A or BTT_SKR_V2_0_REV_B. See https://bit.ly/3t5d9JQ for more information. Please update your configuration." - #elif MB(BOARD_TH3D_EZBOARD_LITE_V2) + #error "BOARD_BTT_SKR_V2_0 is now BOARD_BTT_SKR_V2_0_REV_A or BOARD_BTT_SKR_V2_0_REV_B. See https://bit.ly/3t5d9JQ for more information. Please update your configuration." + #elif MB(TH3D_EZBOARD_LITE_V2) #error "BOARD_TH3D_EZBOARD_LITE_V2 is now BOARD_TH3D_EZBOARD_V2. Please update your configuration." #elif defined(MOTHERBOARD) #error "Unknown MOTHERBOARD value set in Configuration.h." @@ -873,6 +873,7 @@ #undef BOARD_RAMPS_DAGOMA #undef BOARD_RAMPS_LONGER3D_LK4PRO #undef BOARD_BTT_SKR_V2_0 + #undef BOARD_TH3D_EZBOARD_LITE_V2 #endif From 460e2436935e65ddbd32d6342063cbab5eab2d38 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Fri, 27 May 2022 12:02:42 +1200 Subject: [PATCH 105/241] =?UTF-8?q?=F0=9F=94=A8=20Add=20src=5Ffilter=20for?= =?UTF-8?q?=20I2C=5FAMMETER=20(#24242)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ini/features.ini | 1 + platformio.ini | 1 + 2 files changed, 2 insertions(+) diff --git a/ini/features.ini b/ini/features.ini index e33c6fecf77f..355544029e0c 100644 --- a/ini/features.ini +++ b/ini/features.ini @@ -32,6 +32,7 @@ LIB_INTERNAL_MAX31865 = src_filter=+ NEOPIXEL_LED = adafruit/Adafruit NeoPixel@~1.8.0 src_filter=+ I2C_AMMETER = peterus/INA226Lib@1.1.2 + src_filter=+ USES_LIQUIDCRYSTAL = LiquidCrystal=https://github.com/MarlinFirmware/New-LiquidCrystal/archive/1.5.1.zip USES_LIQUIDCRYSTAL_I2C = marcoschwartz/LiquidCrystal_I2C@1.1.4 USES_LIQUIDTWI2 = LiquidTWI2@1.2.7 diff --git a/platformio.ini b/platformio.ini index b715bafb9697..ae50293e3f2b 100644 --- a/platformio.ini +++ b/platformio.ini @@ -96,6 +96,7 @@ default_src_filter = + - - + - - - - + - - - - - From ff201e6552d319134f70cce0588fd6b12e2c1252 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 27 May 2022 00:24:11 +0000 Subject: [PATCH 106/241] [cron] Bump distribution date (2022-05-27) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 5ac850a15fca..ab28c47ae9dd 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-05-25" +//#define STRING_DISTRIBUTION_DATE "2022-05-27" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index e3a49200cf2d..627caca64bbd 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-05-25" + #define STRING_DISTRIBUTION_DATE "2022-05-27" #endif /** From 1d4f928342a104ba97538ab68697f83c00c05a69 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 26 May 2022 18:18:41 -0500 Subject: [PATCH 107/241] =?UTF-8?q?=F0=9F=8E=A8=20Combine=20serial=20echos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/DUE/eeprom_flash.cpp | 36 +++++++------------ Marlin/src/feature/mmu/mmu2.cpp | 3 +- Marlin/src/gcode/probe/M951.cpp | 14 ++++---- .../archim2-flash/flash_storage.cpp | 13 ++++--- .../ftdi_eve_lib/basic/commands.cpp | 4 +-- .../ftdi_eve_lib/extended/dl_cache.cpp | 18 ++++------ 6 files changed, 33 insertions(+), 55 deletions(-) diff --git a/Marlin/src/HAL/DUE/eeprom_flash.cpp b/Marlin/src/HAL/DUE/eeprom_flash.cpp index 7ce4a84df531..607764155b0a 100644 --- a/Marlin/src/HAL/DUE/eeprom_flash.cpp +++ b/Marlin/src/HAL/DUE/eeprom_flash.cpp @@ -199,8 +199,7 @@ static bool ee_PageWrite(uint16_t page, const void *data) { for (i = 0; i > 2; i++) pageContents[i] = (((uint32_t*)data)[i]) | (~(pageContents[i] ^ ((uint32_t*)data)[i])); - DEBUG_ECHO_START(); - DEBUG_ECHOLNPGM("EEPROM PageWrite ", page); + DEBUG_ECHO_MSG("EEPROM PageWrite ", page); DEBUG_ECHOLNPGM(" in FLASH address ", (uint32_t)addrflash); DEBUG_ECHOLNPGM(" base address ", (uint32_t)getFlashStorage(0)); DEBUG_FLUSH(); @@ -245,8 +244,7 @@ static bool ee_PageWrite(uint16_t page, const void *data) { // Reenable interrupts __enable_irq(); - DEBUG_ECHO_START(); - DEBUG_ECHOLNPGM("EEPROM Unlock failure for page ", page); + DEBUG_ECHO_MSG("EEPROM Unlock failure for page ", page); return false; } @@ -270,8 +268,7 @@ static bool ee_PageWrite(uint16_t page, const void *data) { // Reenable interrupts __enable_irq(); - DEBUG_ECHO_START(); - DEBUG_ECHOLNPGM("EEPROM Write failure for page ", page); + DEBUG_ECHO_MSG("EEPROM Write failure for page ", page); return false; } @@ -286,8 +283,7 @@ static bool ee_PageWrite(uint16_t page, const void *data) { if (memcmp(getFlashStorage(page),data,PageSize)) { #ifdef EE_EMU_DEBUG - DEBUG_ECHO_START(); - DEBUG_ECHOLNPGM("EEPROM Verify Write failure for page ", page); + DEBUG_ECHO_MSG("EEPROM Verify Write failure for page ", page); ee_Dump( page, (uint32_t *)addrflash); ee_Dump(-page, data); @@ -325,8 +321,7 @@ static bool ee_PageErase(uint16_t page) { uint16_t i; uint32_t addrflash = uint32_t(getFlashStorage(page)); - DEBUG_ECHO_START(); - DEBUG_ECHOLNPGM("EEPROM PageErase ", page); + DEBUG_ECHO_MSG("EEPROM PageErase ", page); DEBUG_ECHOLNPGM(" in FLASH address ", (uint32_t)addrflash); DEBUG_ECHOLNPGM(" base address ", (uint32_t)getFlashStorage(0)); DEBUG_FLUSH(); @@ -370,8 +365,7 @@ static bool ee_PageErase(uint16_t page) { // Reenable interrupts __enable_irq(); - DEBUG_ECHO_START(); - DEBUG_ECHOLNPGM("EEPROM Unlock failure for page ",page); + DEBUG_ECHO_MSG("EEPROM Unlock failure for page ",page); return false; } @@ -394,8 +388,7 @@ static bool ee_PageErase(uint16_t page) { // Reenable interrupts __enable_irq(); - DEBUG_ECHO_START(); - DEBUG_ECHOLNPGM("EEPROM Erase failure for page ",page); + DEBUG_ECHO_MSG("EEPROM Erase failure for page ",page); return false; } @@ -410,8 +403,7 @@ static bool ee_PageErase(uint16_t page) { uint32_t * aligned_src = (uint32_t *) addrflash; for (i = 0; i < PageSize >> 2; i++) { if (*aligned_src++ != 0xFFFFFFFF) { - DEBUG_ECHO_START(); - DEBUG_ECHOLNPGM("EEPROM Verify Erase failure for page ",page); + DEBUG_ECHO_MSG("EEPROM Verify Erase failure for page ",page); ee_Dump(page, (uint32_t *)addrflash); return false; } @@ -921,8 +913,7 @@ static void ee_Init() { // If all groups seem to be used, default to first group if (curGroup >= GroupCount) curGroup = 0; - DEBUG_ECHO_START(); - DEBUG_ECHOLNPGM("EEPROM Current Group: ",curGroup); + DEBUG_ECHO_MSG("EEPROM Current Group: ",curGroup); DEBUG_FLUSH(); // Now, validate that all the other group pages are empty @@ -931,8 +922,7 @@ static void ee_Init() { for (int page = 0; page < PagesPerGroup; page++) { if (!ee_IsPageClean(grp * PagesPerGroup + page)) { - DEBUG_ECHO_START(); - DEBUG_ECHOLNPGM("EEPROM Page ", page, " not clean on group ", grp); + DEBUG_ECHO_MSG("EEPROM Page ", page, " not clean on group ", grp); DEBUG_FLUSH(); ee_PageErase(grp * PagesPerGroup + page); } @@ -948,15 +938,13 @@ static void ee_Init() { } } - DEBUG_ECHO_START(); - DEBUG_ECHOLNPGM("EEPROM Active page: ", curPage); + DEBUG_ECHO_MSG("EEPROM Active page: ", curPage); DEBUG_FLUSH(); // Make sure the pages following the first clean one are also clean for (int page = curPage + 1; page < PagesPerGroup; page++) { if (!ee_IsPageClean(curGroup * PagesPerGroup + page)) { - DEBUG_ECHO_START(); - DEBUG_ECHOLNPGM("EEPROM Page ", page, " not clean on active group ", curGroup); + DEBUG_ECHO_MSG("EEPROM Page ", page, " not clean on active group ", curGroup); DEBUG_FLUSH(); ee_Dump(curGroup * PagesPerGroup + page, getFlashStorage(curGroup * PagesPerGroup + page)); ee_PageErase(curGroup * PagesPerGroup + page); diff --git a/Marlin/src/feature/mmu/mmu2.cpp b/Marlin/src/feature/mmu/mmu2.cpp index a469c988c9cf..2544995c6d18 100644 --- a/Marlin/src/feature/mmu/mmu2.cpp +++ b/Marlin/src/feature/mmu/mmu2.cpp @@ -1031,8 +1031,7 @@ void MMU2::execute_extruder_sequence(const E_Step * sequence, int steps) { const float es = pgm_read_float(&(step->extrude)); const feedRate_t fr_mm_m = pgm_read_float(&(step->feedRate)); - DEBUG_ECHO_START(); - DEBUG_ECHOLNPGM("E step ", es, "/", fr_mm_m); + DEBUG_ECHO_MSG("E step ", es, "/", fr_mm_m); current_position.e += es; line_to_current_position(MMM_TO_MMS(fr_mm_m)); diff --git a/Marlin/src/gcode/probe/M951.cpp b/Marlin/src/gcode/probe/M951.cpp index c6a9cfbe206c..7a06400e3336 100644 --- a/Marlin/src/gcode/probe/M951.cpp +++ b/Marlin/src/gcode/probe/M951.cpp @@ -32,13 +32,13 @@ mpe_settings_t mpe_settings; inline void mpe_settings_report() { SERIAL_ECHO_MSG("Magnetic Parking Extruder"); - SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("L: Left parking :", mpe_settings.parking_xpos[0]); - SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("R: Right parking :", mpe_settings.parking_xpos[1]); - SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("I: Grab Offset :", mpe_settings.grab_distance); - SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("J: Normal speed :", long(MMS_TO_MMM(mpe_settings.slow_feedrate))); - SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("H: High speed :", long(MMS_TO_MMM(mpe_settings.fast_feedrate))); - SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("D: Distance trav.:", mpe_settings.travel_distance); - SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("C: Compenstion :", mpe_settings.compensation_factor); + SERIAL_ECHO_MSG("L: Left parking :", mpe_settings.parking_xpos[0]); + SERIAL_ECHO_MSG("R: Right parking :", mpe_settings.parking_xpos[1]); + SERIAL_ECHO_MSG("I: Grab Offset :", mpe_settings.grab_distance); + SERIAL_ECHO_MSG("J: Normal speed :", long(MMS_TO_MMM(mpe_settings.slow_feedrate))); + SERIAL_ECHO_MSG("H: High speed :", long(MMS_TO_MMM(mpe_settings.fast_feedrate))); + SERIAL_ECHO_MSG("D: Distance trav.:", mpe_settings.travel_distance); + SERIAL_ECHO_MSG("C: Compenstion :", mpe_settings.compensation_factor); } void mpe_settings_init() { diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/archim2-flash/flash_storage.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/archim2-flash/flash_storage.cpp index dbee1e034b07..a23ad6e37e76 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/archim2-flash/flash_storage.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/archim2-flash/flash_storage.cpp @@ -178,9 +178,9 @@ bool UIFlashStorage::is_present = false; if (!is_known) { SERIAL_ECHO_MSG("Unable to locate supported SPI Flash Memory."); - SERIAL_ECHO_START(); SERIAL_ECHOLNPGM(" Manufacturer ID, got: ", manufacturer_id); - SERIAL_ECHO_START(); SERIAL_ECHOLNPGM(" Device Type , got: ", device_type); - SERIAL_ECHO_START(); SERIAL_ECHOLNPGM(" Capacity , got: ", capacity); + SERIAL_ECHO_MSG(" Manufacturer ID, got: ", manufacturer_id); + SERIAL_ECHO_MSG(" Device Type , got: ", device_type); + SERIAL_ECHO_MSG(" Capacity , got: ", capacity); } return is_known; @@ -247,7 +247,7 @@ bool UIFlashStorage::is_present = false; case 0xFFFFFFFFul: return read_offset; case delimiter: read_offset = offset; break; default: - SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("Invalid delimiter in Flash: ", delim); + SERIAL_ECHO_MSG("Invalid delimiter in Flash: ", delim); return -1; } } @@ -325,8 +325,7 @@ bool UIFlashStorage::is_present = false; } SERIAL_ECHO_START(); - SERIAL_ECHOPGM("Writing UI settings to SPI Flash (offset ", write_addr); - SERIAL_ECHOPGM(")..."); + SERIAL_ECHOPGM("Writing UI settings to SPI Flash (offset ", write_addr, ")..."); const uint32_t delim = delimiter; write_addr = write(write_addr, &delim, sizeof(delim)); @@ -509,7 +508,7 @@ bool UIFlashStorage::is_present = false; bytes_remaining = get_media_file_size(slot); if (bytes_remaining != 0xFFFFFFFFUL) { - SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("Boot media file size:", bytes_remaining); + SERIAL_ECHO_MSG("Boot media file size:", bytes_remaining); addr = get_media_file_start(slot); return true; } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/basic/commands.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/basic/commands.cpp index 8e788421ad25..a796c8edcf5f 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/basic/commands.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/basic/commands.cpp @@ -1024,9 +1024,7 @@ template bool CLCD::CommandFifo::write(T data, uint16_t len) { uint16_t Command_Space = mem_read_32(REG::CMDB_SPACE) & 0x0FFF; if (Command_Space < (len + padding)) { #if ENABLED(TOUCH_UI_DEBUG) - SERIAL_ECHO_START(); - SERIAL_ECHOPGM("Waiting for ", len + padding); - SERIAL_ECHOLNPGM(" bytes in command queue, now free: ", Command_Space); + SERIAL_ECHO_MSG("Waiting for ", len + padding, " bytes in command queue, now free: ", Command_Space); #endif do { Command_Space = mem_read_32(REG::CMDB_SPACE) & 0x0FFF; diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/dl_cache.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/dl_cache.cpp index 1ee73c140e3a..f947a352b1f1 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/dl_cache.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/dl_cache.cpp @@ -131,9 +131,7 @@ bool DLCache::store(uint32_t min_bytes /* = 0*/) { if (dl_size > dl_slot_size) { // Not enough memory to cache the display list. #if ENABLED(TOUCH_UI_DEBUG) - SERIAL_ECHO_START(); - SERIAL_ECHOPGM ("Not enough space in GRAM to cache display list, free space: ", dl_slot_size); - SERIAL_ECHOLNPGM(" Required: ", dl_size); + SERIAL_ECHO_MSG("Not enough space in GRAM to cache display list, free space: ", dl_slot_size, " Required: ", dl_size); #endif dl_slot_used = 0; save_slot(); @@ -141,9 +139,7 @@ bool DLCache::store(uint32_t min_bytes /* = 0*/) { } else { #if ENABLED(TOUCH_UI_DEBUG) - SERIAL_ECHO_START(); - SERIAL_ECHOPGM ("Saving DL to RAMG cache, bytes: ", dl_slot_used); - SERIAL_ECHOLNPGM(" Free space: ", dl_slot_size); + SERIAL_ECHO_MSG("Saving DL to RAMG cache, bytes: ", dl_slot_used, " Free space: ", dl_slot_size); #endif dl_slot_used = dl_size; save_slot(); @@ -160,9 +156,9 @@ void DLCache::save_slot(uint8_t indx, uint32_t addr, uint16_t size, uint16_t use } void DLCache::load_slot(uint8_t indx, uint32_t &addr, uint16_t &size, uint16_t &used) { - addr = CLCD::mem_read_32(DL_CACHE_START + indx * 12 + 0); - size = CLCD::mem_read_32(DL_CACHE_START + indx * 12 + 4); - used = CLCD::mem_read_32(DL_CACHE_START + indx * 12 + 8); + addr = CLCD::mem_read_32(DL_CACHE_START + indx * 12 + 0); + size = CLCD::mem_read_32(DL_CACHE_START + indx * 12 + 4); + used = CLCD::mem_read_32(DL_CACHE_START + indx * 12 + 8); } void DLCache::append() { @@ -171,9 +167,7 @@ void DLCache::append() { #if ENABLED(TOUCH_UI_DEBUG) cmd.execute(); wait_until_idle(); - SERIAL_ECHO_START(); - SERIAL_ECHOPGM ("Appending to DL from RAMG cache, bytes: ", dl_slot_used); - SERIAL_ECHOLNPGM(" REG_CMD_DL: ", CLCD::mem_read_32(REG::CMD_DL)); + SERIAL_ECHO_MSG("Appending to DL from RAMG cache, bytes: ", dl_slot_used, " REG_CMD_DL: ", CLCD::mem_read_32(REG::CMD_DL)); #endif } From 1f322b565f409ab5068e225a4d9a929907c966f1 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 26 May 2022 18:31:05 -0500 Subject: [PATCH 108/241] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20More=20updates=20f?= =?UTF-8?q?or=20multi-axis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/types.h | 1 - Marlin/src/gcode/control/M17_M18_M84.cpp | 3 +- Marlin/src/gcode/feature/clean/G12.cpp | 5 ++- .../lcd/e3v2/marlinui/ui_status_480x272.cpp | 8 ++-- Marlin/src/module/motion.cpp | 23 +++------- Marlin/src/module/motion.h | 45 ++++++++++--------- Marlin/src/module/probe.cpp | 4 +- Marlin/src/module/stepper.h | 8 ++-- 8 files changed, 46 insertions(+), 51 deletions(-) diff --git a/Marlin/src/core/types.h b/Marlin/src/core/types.h index ee996569254d..fc3ef178b6df 100644 --- a/Marlin/src/core/types.h +++ b/Marlin/src/core/types.h @@ -181,7 +181,6 @@ enum AxisEnum : uint8_t { }; typedef IF<(NUM_AXIS_ENUMS > 8), uint16_t, uint8_t>::type axis_bits_t; -typedef IF<(NUM_AXES > 8), uint16_t, uint8_t>::type linear_axis_bits_t; // // Loop over axes diff --git a/Marlin/src/gcode/control/M17_M18_M84.cpp b/Marlin/src/gcode/control/M17_M18_M84.cpp index 715f7f2a37af..ebb8c7eff0ec 100644 --- a/Marlin/src/gcode/control/M17_M18_M84.cpp +++ b/Marlin/src/gcode/control/M17_M18_M84.cpp @@ -23,6 +23,7 @@ #include "../gcode.h" #include "../../MarlinCore.h" // for stepper_inactive_time, disable_e_steppers #include "../../lcd/marlinui.h" +#include "../../module/motion.h" // for e_axis_mask #include "../../module/stepper.h" #if ENABLED(AUTO_BED_LEVELING_UBL) @@ -43,7 +44,7 @@ inline stepper_flags_t selected_axis_bits() { selected.bits = _BV(INDEX_OF_AXIS(E_AXIS, e)); } else - selected.bits = selected.e_bits(); + selected.bits = e_axis_mask; } #endif selected.bits |= NUM_AXIS_GANG( diff --git a/Marlin/src/gcode/feature/clean/G12.cpp b/Marlin/src/gcode/feature/clean/G12.cpp index 999a9b10bd85..0113170f1d9c 100644 --- a/Marlin/src/gcode/feature/clean/G12.cpp +++ b/Marlin/src/gcode/feature/clean/G12.cpp @@ -45,9 +45,10 @@ * X, Y, Z : Specify axes to move during cleaning. Default: ALL. */ void GcodeSuite::G12() { + // Don't allow nozzle cleaning without homing first - if (homing_needed_error(linear_bits & ~TERN0(NOZZLE_CLEAN_NO_Z, Z_AXIS) & ~TERN0(NOZZLE_CLEAN_NO_Y, Y_AXIS))) - return; + constexpr main_axes_bits_t clean_axis_mask = main_axes_mask & ~TERN0(NOZZLE_CLEAN_NO_Z, Z_AXIS) & ~TERN0(NOZZLE_CLEAN_NO_Y, Y_AXIS); + if (homing_needed_error(clean_axis_mask)) return; #ifdef WIPE_SEQUENCE_COMMANDS if (!parser.seen_any()) { diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp index ba6814a57a10..20dbd45d67f3 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp @@ -80,9 +80,9 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const dwin_string.set(); if (blink) dwin_string.add(value); - else if (!TEST(axis_homed, axis)) + else if (!TEST(axes_homed, axis)) while (const char c = *value++) dwin_string.add(c <= '.' ? c : '?'); - else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !TEST(axis_trusted, axis)) + else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !TEST(axes_trusted, axis)) dwin_string.add(TERN1(DWIN_MARLINUI_PORTRAIT, axis == Z_AXIS) ? PSTR(" ") : PSTR(" ")); else dwin_string.add(value); @@ -105,11 +105,11 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const if (blink) dwin_string.add(value); else { - if (!TEST(axis_homed, axis)) + if (!TEST(axes_homed, axis)) while (const char c = *value++) dwin_string.add(c <= '.' ? c : '?'); else { #if NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) - if (!TEST(axis_trusted, axis)) + if (!TEST(axes_trusted, axis)) dwin_string.add(TERN1(DWIN_MARLINUI_PORTRAIT, axis == Z_AXIS) ? PSTR(" ") : PSTR(" ")); else #endif diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 5d78df485915..b7c48783d1a9 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -1382,10 +1382,10 @@ void prepare_line_to_destination() { #if HAS_ENDSTOPS - linear_axis_bits_t axis_homed, axis_trusted; // = 0 + main_axes_bits_t axes_homed, axes_trusted; // = 0 - linear_axis_bits_t axes_should_home(linear_axis_bits_t axis_bits/*=linear_bits*/) { - auto set_should = [](linear_axis_bits_t &b, AxisEnum a) { + main_axes_bits_t axes_should_home(main_axes_bits_t axis_bits/*=main_axes_mask*/) { + auto set_should = [](main_axes_bits_t &b, AxisEnum a) { if (TEST(b, a) && TERN(HOME_AFTER_DEACTIVATE, axis_is_trusted, axis_was_homed)(a)) CBI(b, a); }; @@ -1398,23 +1398,12 @@ void prepare_line_to_destination() { return axis_bits; } - bool homing_needed_error(linear_axis_bits_t axis_bits/*=linear_bits*/) { + bool homing_needed_error(main_axes_bits_t axis_bits/*=main_axes_mask*/) { if ((axis_bits = axes_should_home(axis_bits))) { PGM_P home_first = GET_TEXT(MSG_HOME_FIRST); char msg[30]; - sprintf_P(msg, home_first, - NUM_AXIS_LIST( - TEST(axis_bits, X_AXIS) ? STR_A : "", - TEST(axis_bits, Y_AXIS) ? STR_B : "", - TEST(axis_bits, Z_AXIS) ? STR_C : "", - TEST(axis_bits, I_AXIS) ? STR_I : "", - TEST(axis_bits, J_AXIS) ? STR_J : "", - TEST(axis_bits, K_AXIS) ? STR_K : "", - TEST(axis_bits, U_AXIS) ? STR_U : "", - TEST(axis_bits, V_AXIS) ? STR_V : "", - TEST(axis_bits, W_AXIS) ? STR_W : "" - ) - ); + #define _AXIS_CHAR(N) TEST(axis_bits, _AXIS(N)) ? STR_##N : "" + sprintf_P(msg, home_first, MAPLIST(_AXIS_CHAR, MAIN_AXIS_NAMES)); SERIAL_ECHO_START(); SERIAL_ECHOLN(msg); ui.set_status(msg); diff --git a/Marlin/src/module/motion.h b/Marlin/src/module/motion.h index 45dae5d6090a..ec478188772c 100644 --- a/Marlin/src/module/motion.h +++ b/Marlin/src/module/motion.h @@ -407,38 +407,41 @@ void restore_feedrate_and_scaling(); /** * Homing and Trusted Axes */ -typedef IF<(NUM_AXES > 8), uint16_t, uint8_t>::type linear_axis_bits_t; -constexpr linear_axis_bits_t linear_bits = _BV(NUM_AXES) - 1; +typedef IF<(NUM_AXES > 8), uint16_t, uint8_t>::type main_axes_bits_t; +constexpr main_axes_bits_t main_axes_mask = _BV(NUM_AXES) - 1; + +typedef IF<(NUM_AXES + EXTRUDERS > 8), uint16_t, uint8_t>::type e_axis_bits_t; +constexpr e_axis_bits_t e_axis_mask = (_BV(EXTRUDERS) - 1) << NUM_AXES; void set_axis_is_at_home(const AxisEnum axis); #if HAS_ENDSTOPS /** - * axis_homed + * axes_homed * Flags that each linear axis was homed. * XYZ on cartesian, ABC on delta, ABZ on SCARA. * - * axis_trusted + * axes_trusted * Flags that the position is trusted in each linear axis. Set when homed. * Cleared whenever a stepper powers off, potentially losing its position. */ - extern linear_axis_bits_t axis_homed, axis_trusted; + extern main_axes_bits_t axes_homed, axes_trusted; void homeaxis(const AxisEnum axis); void set_axis_never_homed(const AxisEnum axis); - linear_axis_bits_t axes_should_home(linear_axis_bits_t axis_bits=linear_bits); - bool homing_needed_error(linear_axis_bits_t axis_bits=linear_bits); - inline void set_axis_unhomed(const AxisEnum axis) { CBI(axis_homed, axis); } - inline void set_axis_untrusted(const AxisEnum axis) { CBI(axis_trusted, axis); } - inline void set_all_unhomed() { axis_homed = axis_trusted = 0; } - inline void set_axis_homed(const AxisEnum axis) { SBI(axis_homed, axis); } - inline void set_axis_trusted(const AxisEnum axis) { SBI(axis_trusted, axis); } - inline void set_all_homed() { axis_homed = axis_trusted = linear_bits; } + main_axes_bits_t axes_should_home(main_axes_bits_t axes_mask=main_axes_mask); + bool homing_needed_error(main_axes_bits_t axes_mask=main_axes_mask); + inline void set_axis_unhomed(const AxisEnum axis) { CBI(axes_homed, axis); } + inline void set_axis_untrusted(const AxisEnum axis) { CBI(axes_trusted, axis); } + inline void set_all_unhomed() { axes_homed = axes_trusted = 0; } + inline void set_axis_homed(const AxisEnum axis) { SBI(axes_homed, axis); } + inline void set_axis_trusted(const AxisEnum axis) { SBI(axes_trusted, axis); } + inline void set_all_homed() { axes_homed = axes_trusted = main_axes_mask; } #else - constexpr linear_axis_bits_t axis_homed = linear_bits, axis_trusted = linear_bits; // Zero-endstop machines are always homed and trusted + constexpr main_axes_bits_t axes_homed = main_axes_mask, axes_trusted = main_axes_mask; // Zero-endstop machines are always homed and trusted inline void homeaxis(const AxisEnum axis) {} inline void set_axis_never_homed(const AxisEnum) {} - inline linear_axis_bits_t axes_should_home(linear_axis_bits_t=linear_bits) { return 0; } - inline bool homing_needed_error(linear_axis_bits_t=linear_bits) { return false; } + inline main_axes_bits_t axes_should_home(main_axes_bits_t=main_axes_mask) { return 0; } + inline bool homing_needed_error(main_axes_bits_t=main_axes_mask) { return false; } inline void set_axis_unhomed(const AxisEnum axis) {} inline void set_axis_untrusted(const AxisEnum axis) {} inline void set_all_unhomed() {} @@ -447,13 +450,13 @@ void set_axis_is_at_home(const AxisEnum axis); inline void set_all_homed() {} #endif -inline bool axis_was_homed(const AxisEnum axis) { return TEST(axis_homed, axis); } -inline bool axis_is_trusted(const AxisEnum axis) { return TEST(axis_trusted, axis); } +inline bool axis_was_homed(const AxisEnum axis) { return TEST(axes_homed, axis); } +inline bool axis_is_trusted(const AxisEnum axis) { return TEST(axes_trusted, axis); } inline bool axis_should_home(const AxisEnum axis) { return (axes_should_home() & _BV(axis)) != 0; } -inline bool no_axes_homed() { return !axis_homed; } -inline bool all_axes_homed() { return linear_bits == (axis_homed & linear_bits); } +inline bool no_axes_homed() { return !axes_homed; } +inline bool all_axes_homed() { return main_axes_mask == (axes_homed & main_axes_mask); } inline bool homing_needed() { return !all_axes_homed(); } -inline bool all_axes_trusted() { return linear_bits == (axis_trusted & linear_bits); } +inline bool all_axes_trusted() { return main_axes_mask == (axes_trusted & main_axes_mask); } void home_if_needed(const bool keeplev=false); diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 91c100bd7200..dc97971a25b1 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -274,14 +274,14 @@ xyz_pos_t Probe::offset; // Initialized by settings.load() #if ENABLED(PROBING_STEPPERS_OFF) && DISABLED(DELTA) static uint8_t old_trusted; if (dopause) { - old_trusted = axis_trusted; + old_trusted = axes_trusted; stepper.disable_axis(X_AXIS); stepper.disable_axis(Y_AXIS); } else { if (TEST(old_trusted, X_AXIS)) stepper.enable_axis(X_AXIS); if (TEST(old_trusted, Y_AXIS)) stepper.enable_axis(Y_AXIS); - axis_trusted = old_trusted; + axes_trusted = old_trusted; } #endif if (dopause) safe_delay(_MAX(DELAY_BEFORE_PROBING, 25)); diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h index 52b870929f3a..3b899e93e27c 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -246,7 +246,11 @@ #define MIN_STEP_ISR_FREQUENCY (MAX_STEP_ISR_FREQUENCY_1X / 2) #define ENABLE_COUNT (NUM_AXES + E_STEPPERS) -typedef IF<(ENABLE_COUNT > 8), uint16_t, uint8_t>::type ena_mask_t; +#if ENABLE_COUNT > 16 + typedef uint32_t ena_mask_t; +#else + typedef IF<(ENABLE_COUNT > 8), uint16_t, uint8_t>::type ena_mask_t; +#endif // Axis flags type, for enabled state or other simple state typedef struct { @@ -259,8 +263,6 @@ typedef struct { #endif }; }; - constexpr ena_mask_t linear_bits() { return _BV(NUM_AXES) - 1; } - constexpr ena_mask_t e_bits() { return (_BV(EXTRUDERS) - 1) << NUM_AXES; } } stepper_flags_t; // All the stepper enable pins From 4407ff31ec86f54dff543560b40622ffc5b2beaa Mon Sep 17 00:00:00 2001 From: Simon Pilepich Date: Sat, 28 May 2022 08:08:24 +1000 Subject: [PATCH 109/241] =?UTF-8?q?=F0=9F=93=9D=20Fix=20Mightyboard=20MOSF?= =?UTF-8?q?ET=20comments=20(#24183)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h index c44b1f449c71..3bcece400f96 100644 --- a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h +++ b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h @@ -149,8 +149,8 @@ #define MOSFET_1_PIN 6 // Plug EX1 Pin 1-2 -> PH3 #15 -> Logical 06 #define MOSFET_2_PIN 7 // Plug EX1 Pin 3-4 -> PH4 #16 -> Logical 07 -#define MOSFET_3_PIN 11 // Plug EX2 1-2 -> PB6 #24 -> Logical 11 -#define MOSFET_4_PIN 12 // Plug EX2 3-4 -> PB5 #25 -> Logical 12 +#define MOSFET_3_PIN 11 // Plug EX2 1-2 -> PB5 #24 -> Logical 11 +#define MOSFET_4_PIN 12 // Plug EX2 3-4 -> PB6 #25 -> Logical 12 #define MOSFET_5_PIN 45 // Plug HBD 1-2 -> PL4 #39 -> Logical 45 #define MOSFET_6_PIN 44 // Plug Extra 1-2 -> PL5 #40 -> Logical 44 (FET not soldered in all boards) From 21d2d22a6fd334934d5663f53e80a9e7bf9f4530 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 28 May 2022 00:22:28 +0000 Subject: [PATCH 110/241] [cron] Bump distribution date (2022-05-28) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index ab28c47ae9dd..91126c4b1665 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-05-27" +//#define STRING_DISTRIBUTION_DATE "2022-05-28" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 627caca64bbd..a53d50958444 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-05-27" + #define STRING_DISTRIBUTION_DATE "2022-05-28" #endif /** From 26f5c32872d39e9ce2595edc368bc463522fd5ac Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 28 May 2022 14:41:50 -0500 Subject: [PATCH 111/241] =?UTF-8?q?=F0=9F=8E=A8=20=20Misc.=20boards/pins?= =?UTF-8?q?=20cleanup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/boards.h | 38 ++++++++++++------------- Marlin/src/pins/pins.h | 8 +++--- Marlin/src/pins/sam/pins_RURAMPS4D_11.h | 9 +----- 3 files changed, 24 insertions(+), 31 deletions(-) diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 653bbf1e173e..20ec0298d528 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -228,33 +228,33 @@ #define BOARD_RAMPS_14_RE_ARM_EFF 2002 // Re-ARM with RAMPS 1.4 (Power outputs: Hotend, Fan0, Fan1) #define BOARD_RAMPS_14_RE_ARM_EEF 2003 // Re-ARM with RAMPS 1.4 (Power outputs: Hotend0, Hotend1, Fan) #define BOARD_RAMPS_14_RE_ARM_SF 2004 // Re-ARM with RAMPS 1.4 (Power outputs: Spindle, Controller Fan) -#define BOARD_MKS_SBASE 2005 // MKS-Sbase (Power outputs: Hotend0, Hotend1, Bed, Fan) +#define BOARD_MKS_SBASE 2005 // MKS-Sbase #define BOARD_AZSMZ_MINI 2006 // AZSMZ Mini -#define BOARD_BIQU_BQ111_A4 2007 // BIQU BQ111-A4 (Power outputs: Hotend, Fan, Bed) -#define BOARD_SELENA_COMPACT 2008 // Selena Compact (Power outputs: Hotend0, Hotend1, Bed0, Bed1, Fan0, Fan1) -#define BOARD_BIQU_B300_V1_0 2009 // BIQU B300_V1.0 (Power outputs: Hotend0, Fan, Bed, SPI Driver) -#define BOARD_MKS_SGEN_L 2010 // MKS-SGen-L (Power outputs: Hotend0, Hotend1, Bed, Fan) +#define BOARD_BIQU_BQ111_A4 2007 // BIQU BQ111-A4 +#define BOARD_SELENA_COMPACT 2008 // Selena Compact +#define BOARD_BIQU_B300_V1_0 2009 // BIQU B300_V1.0 +#define BOARD_MKS_SGEN_L 2010 // MKS-SGen-L #define BOARD_GMARSH_X6_REV1 2011 // GMARSH X6, revision 1 prototype -#define BOARD_BTT_SKR_V1_1 2012 // BigTreeTech SKR v1.1 (Power outputs: Hotend0, Hotend1, Fan, Bed) -#define BOARD_BTT_SKR_V1_3 2013 // BigTreeTech SKR v1.3 (Power outputs: Hotend0, Hotend1, Fan, Bed) -#define BOARD_BTT_SKR_V1_4 2014 // BigTreeTech SKR v1.4 (Power outputs: Hotend0, Hotend1, Fan, Bed) +#define BOARD_BTT_SKR_V1_1 2012 // BigTreeTech SKR v1.1 +#define BOARD_BTT_SKR_V1_3 2013 // BigTreeTech SKR v1.3 +#define BOARD_BTT_SKR_V1_4 2014 // BigTreeTech SKR v1.4 // // LPC1769 ARM Cortex M3 // -#define BOARD_MKS_SGEN 2500 // MKS-SGen (Power outputs: Hotend0, Hotend1, Bed, Fan) -#define BOARD_AZTEEG_X5_GT 2501 // Azteeg X5 GT (Power outputs: Hotend0, Hotend1, Bed, Fan) -#define BOARD_AZTEEG_X5_MINI 2502 // Azteeg X5 Mini (Power outputs: Hotend0, Bed, Fan) -#define BOARD_AZTEEG_X5_MINI_WIFI 2503 // Azteeg X5 Mini Wifi (Power outputs: Hotend0, Bed, Fan) +#define BOARD_MKS_SGEN 2500 // MKS-SGen +#define BOARD_AZTEEG_X5_GT 2501 // Azteeg X5 GT +#define BOARD_AZTEEG_X5_MINI 2502 // Azteeg X5 Mini +#define BOARD_AZTEEG_X5_MINI_WIFI 2503 // Azteeg X5 Mini Wifi #define BOARD_COHESION3D_REMIX 2504 // Cohesion3D ReMix #define BOARD_COHESION3D_MINI 2505 // Cohesion3D Mini #define BOARD_SMOOTHIEBOARD 2506 // Smoothieboard #define BOARD_TH3D_EZBOARD 2507 // TH3D EZBoard v1.0 -#define BOARD_BTT_SKR_V1_4_TURBO 2508 // BigTreeTech SKR v1.4 TURBO (Power outputs: Hotend0, Hotend1, Fan, Bed) -#define BOARD_MKS_SGEN_L_V2 2509 // MKS SGEN_L V2 (Power outputs: Hotend0, Hotend1, Bed, Fan) -#define BOARD_BTT_SKR_E3_TURBO 2510 // BigTreeTech SKR E3 Turbo (Power outputs: Hotend0, Hotend1, Bed, Fan0, Fan1) -#define BOARD_FLY_CDY 2511 // FLYmaker FLY CDY (Power outputs: Hotend0, Hotend1, Hotend2, Bed, Fan0, Fan1, Fan2) +#define BOARD_BTT_SKR_V1_4_TURBO 2508 // BigTreeTech SKR v1.4 TURBO +#define BOARD_MKS_SGEN_L_V2 2509 // MKS SGEN_L V2 +#define BOARD_BTT_SKR_E3_TURBO 2510 // BigTreeTech SKR E3 Turbo +#define BOARD_FLY_CDY 2511 // FLYmaker FLY CDY // // SAM3X8E ARM Cortex M3 @@ -280,8 +280,8 @@ #define BOARD_RAMPS4DUE_EFF 3017 // RAMPS4DUE (Power outputs: Hotend, Fan0, Fan1) #define BOARD_RAMPS4DUE_EEF 3018 // RAMPS4DUE (Power outputs: Hotend0, Hotend1, Fan) #define BOARD_RAMPS4DUE_SF 3019 // RAMPS4DUE (Power outputs: Spindle, Controller Fan) -#define BOARD_RURAMPS4D_11 3020 // RuRAMPS4Duo v1.1 (Power outputs: Hotend0, Hotend1, Hotend2, Fan0, Fan1, Bed) -#define BOARD_RURAMPS4D_13 3021 // RuRAMPS4Duo v1.3 (Power outputs: Hotend0, Hotend1, Hotend2, Fan0, Fan1, Bed) +#define BOARD_RURAMPS4D_11 3020 // RuRAMPS4Duo v1.1 +#define BOARD_RURAMPS4D_13 3021 // RuRAMPS4Duo v1.3 #define BOARD_ULTRATRONICS_PRO 3022 // ReprapWorld Ultratronics Pro V1.0 #define BOARD_ARCHIM1 3023 // UltiMachine Archim1 (with DRV8825 drivers) #define BOARD_ARCHIM2 3024 // UltiMachine Archim2 (with TMC2130 drivers) @@ -293,7 +293,7 @@ // SAM3X8C ARM Cortex M3 // -#define BOARD_PRINTRBOARD_G2 3100 // PRINTRBOARD G2 +#define BOARD_PRINTRBOARD_G2 3100 // Printrboard G2 #define BOARD_ADSK 3101 // Arduino DUE Shield Kit (ADSK) // diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index a6e0fb6128f7..da2075911433 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -464,14 +464,14 @@ #include "sam/pins_ARCHIM2.h" // SAM3X8E env:DUE_archim env:DUE_archim_debug #elif MB(ALLIGATOR) #include "sam/pins_ALLIGATOR_R2.h" // SAM3X8E env:DUE env:DUE_debug -#elif MB(ADSK) - #include "sam/pins_ADSK.h" // SAM3X8E env:DUE env:DUE_debug -#elif MB(PRINTRBOARD_G2) - #include "sam/pins_PRINTRBOARD_G2.h" // SAM3X8C env:DUE_USB #elif MB(CNCONTROLS_15D) #include "sam/pins_CNCONTROLS_15D.h" // SAM3X8E env:DUE env:DUE_USB #elif MB(KRATOS32) #include "sam/pins_KRATOS32.h" // SAM3X8E env:DUE env:DUE_USB +#elif MB(PRINTRBOARD_G2) + #include "sam/pins_PRINTRBOARD_G2.h" // SAM3X8C env:DUE_USB +#elif MB(ADSK) + #include "sam/pins_ADSK.h" // SAM3X8C env:DUE env:DUE_debug // // STM32 ARM Cortex-M0 diff --git a/Marlin/src/pins/sam/pins_RURAMPS4D_11.h b/Marlin/src/pins/sam/pins_RURAMPS4D_11.h index 9d24828ce3aa..064ce2751ab3 100644 --- a/Marlin/src/pins/sam/pins_RURAMPS4D_11.h +++ b/Marlin/src/pins/sam/pins_RURAMPS4D_11.h @@ -18,19 +18,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . * - * Ported sys0724 & Vynt */ #pragma once /** * Arduino Mega? or Due with RuRAMPS4DUE pin assignments - * - * Applies to the following boards: - * RURAMPS4DUE (Hotend0, Hotend1, Hotend2, Fan0, Fan1, Bed) - * - * Differences between - * RADDS | RuRAMPS4DUE - * | + * Ported by sys0724 & Vynt */ #include "env_validate.h" From 2b4a89eafe50322d276a6104374e797c00cedfac Mon Sep 17 00:00:00 2001 From: elimisback Date: Sat, 28 May 2022 16:22:59 -0400 Subject: [PATCH 112/241] =?UTF-8?q?=F0=9F=94=A8=20BTT=20STM32G0B1RE=20xfer?= =?UTF-8?q?=20build=20(#24245)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/SanityCheck.h | 5 +++++ Marlin/src/pins/pins.h | 2 +- ini/stm32f1.ini | 1 + ini/stm32g0.ini | 10 ++++++++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index eb442d58b8fb..ab4643f86771 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -4137,3 +4137,8 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive."); #elif ENABLED(DISABLE_JTAG) && !defined(JTAG_DISABLE) #error "DISABLE_JTAG is not supported for the selected MCU/Board." #endif + +// Check requirements for upload.py +#if ENABLED(XFER_BUILD) && !BOTH(BINARY_FILE_TRANSFER, CUSTOM_FIRMWARE_UPLOAD) + #error "BINARY_FILE_TRANSFER and CUSTOM_FIRMWARE_UPLOAD are required for custom upload." +#endif diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index da2075911433..e1849c509d2c 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -538,7 +538,7 @@ #elif MB(BTT_SKR_MINI_E3_V2_0) #include "stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h" // STM32F1 env:STM32F103RC_btt env:STM32F103RC_btt_USB env:STM32F103RE_btt env:STM32F103RE_btt_USB env:STM32F103RC_btt_maple env:STM32F103RC_btt_USB_maple env:STM32F103RE_btt_maple env:STM32F103RE_btt_USB_maple #elif MB(BTT_SKR_MINI_E3_V3_0) - #include "stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h" // STM32G0 env:STM32G0B1RE_btt + #include "stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h" // STM32G0 env:STM32G0B1RE_btt env:STM32G0B1RE_btt_xfer #elif MB(BTT_SKR_MINI_MZ_V1_0) #include "stm32f1/pins_BTT_SKR_MINI_MZ_V1_0.h" // STM32F1 env:STM32F103RC_btt env:STM32F103RC_btt_USB env:STM32F103RC_btt_maple env:STM32F103RC_btt_USB_maple #elif MB(BTT_SKR_E3_DIP) diff --git a/ini/stm32f1.ini b/ini/stm32f1.ini index 6bf6a1cb851c..7493e3682ce5 100644 --- a/ini/stm32f1.ini +++ b/ini/stm32f1.ini @@ -138,6 +138,7 @@ upload_protocol = jlink # [STM32F103Rx_creality_xfer] extends = STM32F103Rx_creality +build_flags = ${STM32F103Rx_creality.build_flags} -DXFER_BUILD extra_scripts = ${STM32F103Rx_creality.extra_scripts} pre:buildroot/share/scripts/upload.py upload_protocol = custom diff --git a/ini/stm32g0.ini b/ini/stm32g0.ini index e6094c1e312d..b6074d3af8d0 100644 --- a/ini/stm32g0.ini +++ b/ini/stm32g0.ini @@ -36,3 +36,13 @@ build_flags = ${stm32_variant.build_flags} -DSTEP_TIMER_IRQ_PRIO=0 upload_protocol = stlink debug_tool = stlink + +# +# Custom upload to SD via Marlin with Binary Protocol +# +[env:STM32G0B1RE_btt_xfer] +extends = env:STM32G0B1RE_btt +build_flags = ${env:STM32G0B1RE_btt.build_flags} -DXFER_BUILD +extra_scripts = ${env:STM32G0B1RE_btt.extra_scripts} + pre:buildroot/share/scripts/upload.py +upload_protocol = custom From a59766195cd19e6cded497499044bed76137d8ea Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 28 May 2022 15:24:09 -0500 Subject: [PATCH 113/241] =?UTF-8?q?=F0=9F=8E=A8=20Use=20pos.set=20method?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/extui/ui_api.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index bba03fc6d43f..143f240c2d53 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -936,12 +936,10 @@ namespace ExtUI { if (x_target != current_position.x || y_target != current_position.y) { // If moving across bed, raise nozzle to safe height over bed feedrate_mm_s = Z_PROBE_FEEDRATE_FAST; - destination = current_position; - destination.z = Z_CLEARANCE_BETWEEN_PROBES; + destination.set(current_position.x, current_position.y, Z_CLEARANCE_BETWEEN_PROBES); prepare_line_to_destination(); feedrate_mm_s = XY_PROBE_FEEDRATE; - destination.x = x_target; - destination.y = y_target; + destination.set(x_target, y_target); prepare_line_to_destination(); } feedrate_mm_s = Z_PROBE_FEEDRATE_FAST; From 41a469208afd14e3f804039291e0f2437b44aefc Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 28 May 2022 17:05:09 -0500 Subject: [PATCH 114/241] =?UTF-8?q?=F0=9F=9A=B8=20Change=20M201=20G=20to?= =?UTF-8?q?=20S?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/config/M200-M205.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Marlin/src/gcode/config/M200-M205.cpp b/Marlin/src/gcode/config/M200-M205.cpp index 9af8c3a2b305..bd31c7f27280 100644 --- a/Marlin/src/gcode/config/M200-M205.cpp +++ b/Marlin/src/gcode/config/M200-M205.cpp @@ -108,12 +108,21 @@ #endif // !NO_VOLUMETRICS /** - * M201: Set max acceleration in units/s^2 for print moves (M201 X1000 Y1000) + * M201: Set max acceleration in units/s^2 for print moves. * - * With multiple extruders use T to specify which one. + * X : Max Acceleration for X + * Y : Max Acceleration for Y + * Z : Max Acceleration for Z + * ... : etc + * E : Max Acceleration for Extruder + * T : Extruder index to set + * + * With XY_FREQUENCY_LIMIT: + * F : Frequency limit for XY...IJKUVW + * S : Speed factor percentage. */ void GcodeSuite::M201() { - if (!parser.seen("T" STR_AXES_LOGICAL)) + if (!parser.seen("T" STR_AXES_LOGICAL TERN_(XY_FREQUENCY_LIMIT, "FS"))) return M201_report(); const int8_t target_extruder = get_target_extruder_from_command(); @@ -121,7 +130,7 @@ void GcodeSuite::M201() { #ifdef XY_FREQUENCY_LIMIT if (parser.seenval('F')) planner.set_frequency_limit(parser.value_byte()); - if (parser.seenval('G')) planner.xy_freq_min_speed_factor = constrain(parser.value_float(), 1, 100) / 100; + if (parser.seenval('S')) planner.xy_freq_min_speed_factor = constrain(parser.value_float(), 1, 100) / 100; #endif LOOP_LOGICAL_AXES(i) { From eec9c800c9e82eb36b566ea6aca7cf7c1483a4bf Mon Sep 17 00:00:00 2001 From: Miguel Risco-Castillo Date: Sat, 28 May 2022 17:34:36 -0500 Subject: [PATCH 115/241] =?UTF-8?q?=F0=9F=9A=B8=20Fix,=20improve,=20update?= =?UTF-8?q?=20ProUI=20(#24251)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/e3v2/proui/dwin.cpp | 154 +++++++++++++++++------ Marlin/src/lcd/e3v2/proui/dwin.h | 4 +- Marlin/src/lcd/e3v2/proui/dwin_defines.h | 31 ----- Marlin/src/lcd/e3v2/proui/ubl_tools.cpp | 6 +- 4 files changed, 117 insertions(+), 78 deletions(-) diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 122136c1a082..b4a1bad746bb 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -31,6 +31,37 @@ #if ENABLED(DWIN_LCD_PROUI) +#if DISABLED(LIMITED_MAX_FR_EDITING) + #warning "LIMITED_MAX_FR_EDITING is recommended with ProUI." +#endif +#if DISABLED(LIMITED_MAX_ACCEL_EDITING) + #warning "LIMITED_MAX_ACCEL_EDITING is recommended with ProUI." +#endif +#if ENABLED(CLASSIC_JERK) && DISABLED(LIMITED_JERK_EDITING) + #warning "LIMITED_JERK_EDITING is recommended with ProUI." +#endif +#if DISABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU) + #warning "INDIVIDUAL_AXIS_HOMING_SUBMENU is recommended with ProUI." +#endif +#if DISABLED(LCD_SET_PROGRESS_MANUALLY) + #warning "LCD_SET_PROGRESS_MANUALLY is recommended with ProUI." +#endif +#if DISABLED(STATUS_MESSAGE_SCROLLING) + #warning "STATUS_MESSAGE_SCROLLING is recommended with ProUI." +#endif +#if DISABLED(BAUD_RATE_GCODE) + #warning "BAUD_RATE_GCODE is recommended with ProUI." +#endif +#if DISABLED(SOUND_MENU_ITEM) + #warning "SOUND_MENU_ITEM is recommended with ProUI." +#endif +#if DISABLED(PRINTCOUNTER) + #warning "PRINTCOUNTER is recommended with ProUI." +#endif +#if HAS_MESH && DISABLED(MESH_EDIT_MENU) + #warning "MESH_EDIT_MENU is recommended with ProUI." +#endif + #include "dwin.h" #include "menus.h" #include "dwin_popup.h" @@ -162,7 +193,12 @@ #define DWIN_SCROLL_UPDATE_INTERVAL SEC_TO_MS(2) #define DWIN_REMAIN_TIME_UPDATE_INTERVAL SEC_TO_MS(20) -#define BABY_Z_VAR TERN(HAS_BED_PROBE, probe.offset.z, HMI_data.ManualZOffset) +#if HAS_MESH + #define BABY_Z_VAR TERN(HAS_BED_PROBE, probe.offset.z, HMI_data.ManualZOffset) +#else + float z_offset = 0; + #define BABY_Z_VAR z_offset +#endif // Structs HMI_value_t HMI_value; @@ -200,11 +236,28 @@ uint8_t index_file = MROWS; bool hash_changed = true; // Flag to know if message status was changed -constexpr float max_feedrate_edit_values[] = MAX_FEEDRATE_EDIT_VALUES; -constexpr float max_acceleration_edit_values[] = MAX_ACCEL_EDIT_VALUES; - +constexpr float max_feedrate_edit_values[] = + #ifdef MAX_FEEDRATE_EDIT_VALUES + MAX_FEEDRATE_EDIT_VALUES + #else + { 1000, 1000, 10, 50 } + #endif +; +constexpr float max_acceleration_edit_values[] = + #ifdef MAX_ACCEL_EDIT_VALUES + MAX_ACCEL_EDIT_VALUES + #else + { 1000, 1000, 200, 2000 } + #endif +; #if HAS_CLASSIC_JERK - constexpr float max_jerk_edit_values[] = MAX_JERK_EDIT_VALUES; + constexpr float max_jerk_edit_values[] = + #ifdef MAX_JERK_EDIT_VALUES + MAX_JERK_EDIT_VALUES + #else + { DEFAULT_XJERK * 2, DEFAULT_YJERK * 2, DEFAULT_ZJERK * 2, DEFAULT_EJERK * 2 } + #endif + ; #endif static uint8_t _percent_done = 0; @@ -815,6 +868,8 @@ void update_variable() { else DWINUI::Draw_Icon(ICON_Zoffset, 187, 416); } + #else + DWINUI::Draw_Icon(ICON_Zoffset, 187, 416); #endif _draw_xyz_position(false); @@ -2292,48 +2347,45 @@ void ApplyFlow() { planner.refresh_e_factor(0); } void SetFlow() { SetPIntOnClick(MIN_PRINT_FLOW, MAX_PRINT_FLOW, ApplyFlow); } // Bed Tramming -TERN(HAS_BED_PROBE, float, void) Tram(uint8_t point) { - char cmd[100] = ""; - #if HAS_BED_PROBE - static bool inLev = false; - float xpos = 0, ypos = 0, zval = 0, margin = 0; - char str_1[6] = "", str_2[6] = "", str_3[6] = ""; - if (inLev) return NAN; - margin = HMI_data.FullManualTramming ? 30 : PROBING_MARGIN; - #else - int16_t xpos = 0, ypos = 0; - int16_t margin = 30; - #endif +void TramXY(const uint8_t point, const float &margin, float &x, float &y) { switch (point) { case 0: LCD_MESSAGE(MSG_LEVBED_FL); - xpos = ypos = margin; + x = y = margin; break; case 1: LCD_MESSAGE(MSG_LEVBED_FR); - xpos = X_BED_SIZE - margin; ypos = margin; + x = X_BED_SIZE - margin; y = margin; break; case 2: LCD_MESSAGE(MSG_LEVBED_BR); - xpos = X_BED_SIZE - margin; ypos = Y_BED_SIZE - margin; + x = X_BED_SIZE - margin; y = Y_BED_SIZE - margin; break; case 3: LCD_MESSAGE(MSG_LEVBED_BL); - xpos = margin; ypos = Y_BED_SIZE - margin; + x = margin; y = Y_BED_SIZE - margin; break; case 4: LCD_MESSAGE(MSG_LEVBED_C); - xpos = X_BED_SIZE / 2; ypos = Y_BED_SIZE / 2; + x = X_CENTER; y = Y_CENTER; break; } +} - planner.synchronize(); +#if HAS_BED_PROBE - #if HAS_BED_PROBE + float Tram(const uint8_t point) { + char cmd[100] = ""; + static bool inLev = false; + float xpos = 0, ypos = 0, zval = 0, margin = 0; + char str_1[6] = "", str_2[6] = "", str_3[6] = ""; + if (inLev) return NAN; + margin = HMI_data.FullManualTramming ? 30 : PROBING_MARGIN; + + TramXY(point, margin, xpos, ypos); if (HMI_data.FullManualTramming) { - planner.synchronize(); sprintf_P(cmd, PSTR("M420S0\nG28O\nG90\nG0Z5F300\nG0X%sY%sF5000\nG0Z0F300"), dtostrf(xpos, 1, 1, str_1), dtostrf(ypos, 1, 1, str_2) @@ -2341,6 +2393,20 @@ TERN(HAS_BED_PROBE, float, void) Tram(uint8_t point) { queue.inject(cmd); } else { + // AUTO_BED_LEVELING_BILINEAR does not define MESH_INSET + #ifndef MESH_MIN_X + #define MESH_MIN_X (_MAX(X_MIN_BED + PROBING_MARGIN, X_MIN_POS)) + #endif + #ifndef MESH_MIN_Y + #define MESH_MIN_Y (_MAX(Y_MIN_BED + PROBING_MARGIN, Y_MIN_POS)) + #endif + #ifndef MESH_MAX_X + #define MESH_MAX_X (_MIN(X_MAX_BED - (PROBING_MARGIN), X_MAX_POS)) + #endif + #ifndef MESH_MAX_Y + #define MESH_MAX_Y (_MIN(Y_MAX_BED - (PROBING_MARGIN), Y_MAX_POS)) + #endif + LIMIT(xpos, MESH_MIN_X, MESH_MAX_X); LIMIT(ypos, MESH_MIN_Y, MESH_MAX_Y); probe.stow(); @@ -2360,14 +2426,20 @@ TERN(HAS_BED_PROBE, float, void) Tram(uint8_t point) { inLev = false; } return zval; + } - #else // !HAS_BED_PROBE +#else - sprintf_P(cmd, PSTR("M420S0\nG28O\nG90\nG0Z5F300\nG0X%iY%iF5000\nG0Z0F300"), xpos, ypos); + void Tram(const uint8_t point) { + float xpos = 0, ypos = 0, margin = 30; + TramXY(point, margin, xpos, ypos); + + char cmd[100] = "", str_1[6] = "", str_2[6] = ""; + sprintf_P(cmd, PSTR("M420S0\nG28O\nG90\nG0Z5F300\nG0X%sY%sF5000\nG0Z0F300"), dtostrf(xpos, 1, 1, str_1), dtostrf(ypos, 1, 1, str_2)); queue.inject(cmd); + } - #endif -} +#endif void TramFL() { Tram(0); } void TramFR() { Tram(1); } @@ -3606,18 +3678,18 @@ void Draw_Steps_Menu() { void SetBedLevT() { SetPIntOnClick(MIN_BEDTEMP, MAX_BEDTEMP); } #endif - uint8_t mesh_x = 0; - uint8_t mesh_y = 0; - #define Z_OFFSET_MIN -3 - #define Z_OFFSET_MAX 3 - - void LiveEditMesh() { ((MenuItemPtrClass*)EditZValueItem)->value = &bedlevel.z_values[HMI_value.Select ? mesh_x : MenuData.Value][HMI_value.Select ? MenuData.Value : mesh_y]; EditZValueItem->redraw(); } - void ApplyEditMeshX() { mesh_x = MenuData.Value; } - void SetEditMeshX() { HMI_value.Select = 0; SetIntOnClick(0, GRID_MAX_POINTS_X - 1, mesh_x, ApplyEditMeshX, LiveEditMesh); } - void ApplyEditMeshY() { mesh_y = MenuData.Value; } - void SetEditMeshY() { HMI_value.Select = 1; SetIntOnClick(0, GRID_MAX_POINTS_Y - 1, mesh_y, ApplyEditMeshY, LiveEditMesh); } - void SetEditZValue() { SetPFloatOnClick(Z_OFFSET_MIN, Z_OFFSET_MAX, 3); } - + #if ENABLED(MESH_EDIT_MENU) + uint8_t mesh_x = 0, mesh_y = 0; + #define Z_OFFSET_MIN -3 + #define Z_OFFSET_MAX 3 + + void LiveEditMesh() { ((MenuItemPtrClass*)EditZValueItem)->value = &bedlevel.z_values[HMI_value.Select ? mesh_x : MenuData.Value][HMI_value.Select ? MenuData.Value : mesh_y]; EditZValueItem->redraw(); } + void ApplyEditMeshX() { mesh_x = MenuData.Value; } + void SetEditMeshX() { HMI_value.Select = 0; SetIntOnClick(0, GRID_MAX_POINTS_X - 1, mesh_x, ApplyEditMeshX, LiveEditMesh); } + void ApplyEditMeshY() { mesh_y = MenuData.Value; } + void SetEditMeshY() { HMI_value.Select = 1; SetIntOnClick(0, GRID_MAX_POINTS_Y - 1, mesh_y, ApplyEditMeshY, LiveEditMesh); } + void SetEditZValue() { SetPFloatOnClick(Z_OFFSET_MIN, Z_OFFSET_MAX, 3); } + #endif #endif #if ENABLED(AUTO_BED_LEVELING_UBL) diff --git a/Marlin/src/lcd/e3v2/proui/dwin.h b/Marlin/src/lcd/e3v2/proui/dwin.h index f4e550295ea5..4f992b3a7895 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.h +++ b/Marlin/src/lcd/e3v2/proui/dwin.h @@ -238,9 +238,7 @@ void Draw_Tramming_Menu(); #if HAS_BED_PROBE void Draw_ProbeSet_Menu(); #endif -#if HAS_FILAMENT_SENSOR - void Draw_FilSet_Menu(); -#endif +void Draw_FilSet_Menu(); #if ENABLED(NOZZLE_PARK_FEATURE) void Draw_ParkPos_Menu(); #endif diff --git a/Marlin/src/lcd/e3v2/proui/dwin_defines.h b/Marlin/src/lcd/e3v2/proui/dwin_defines.h index bfeb06d76341..3ab2d23696c5 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_defines.h +++ b/Marlin/src/lcd/e3v2/proui/dwin_defines.h @@ -39,37 +39,6 @@ #define DASH_REDRAW 1 #endif -#if DISABLED(LIMITED_MAX_FR_EDITING) - #error "LIMITED_MAX_FR_EDITING is required with ProUI." -#endif -#if DISABLED(LIMITED_MAX_ACCEL_EDITING) - #error "LIMITED_MAX_ACCEL_EDITING is required with ProUI." -#endif -#if ENABLED(CLASSIC_JERK) && DISABLED(LIMITED_JERK_EDITING) - #error "LIMITED_JERK_EDITING is required with ProUI." -#endif -#if DISABLED(FILAMENT_RUNOUT_SENSOR) - #error "FILAMENT_RUNOUT_SENSOR is required with ProUI." -#endif -#if DISABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU) - #error "INDIVIDUAL_AXIS_HOMING_SUBMENU is required with ProUI." -#endif -#if DISABLED(LCD_SET_PROGRESS_MANUALLY) - #error "LCD_SET_PROGRESS_MANUALLY is required with ProUI." -#endif -#if DISABLED(STATUS_MESSAGE_SCROLLING) - #error "STATUS_MESSAGE_SCROLLING is required with ProUI." -#endif -#if DISABLED(BAUD_RATE_GCODE) - #error "BAUD_RATE_GCODE is required with ProUI." -#endif -#if DISABLED(SOUND_MENU_ITEM) - #error "SOUND_MENU_ITEM is required with ProUI." -#endif -#if DISABLED(PRINTCOUNTER) - #error "PRINTCOUNTER is required with ProUI." -#endif - #include "../common/dwin_color.h" #if ENABLED(LED_CONTROL_MENU) #include "../../../feature/leds/leds.h" diff --git a/Marlin/src/lcd/e3v2/proui/ubl_tools.cpp b/Marlin/src/lcd/e3v2/proui/ubl_tools.cpp index 96a7f52becc6..45cb05266828 100644 --- a/Marlin/src/lcd/e3v2/proui/ubl_tools.cpp +++ b/Marlin/src/lcd/e3v2/proui/ubl_tools.cpp @@ -22,10 +22,10 @@ */ #include "../../../inc/MarlinConfigPre.h" -#include "ubl_tools.h" -#if ENABLED(DWIN_LCD_PROUI) +#if BOTH(DWIN_LCD_PROUI, AUTO_BED_LEVELING_UBL) +#include "ubl_tools.h" #include "../../marlinui.h" #include "../../../core/types.h" #include "dwin.h" @@ -249,4 +249,4 @@ bool UBLMeshToolsClass::validate() { } #endif -#endif // DWIN_LCD_PROUI +#endif // DWIN_LCD_PROUI && AUTO_BED_LEVELING_UBL From 6ecf52f196d08d399c24b1516fc0b33b227ed66c Mon Sep 17 00:00:00 2001 From: tombrazier <68918209+tombrazier@users.noreply.github.com> Date: Sat, 28 May 2022 23:40:08 +0100 Subject: [PATCH 116/241] =?UTF-8?q?=F0=9F=9A=A9=20MPC=20update=20(#24253)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 6 +++--- Marlin/src/gcode/temp/M306.cpp | 8 ++++++-- Marlin/src/module/settings.cpp | 3 +++ Marlin/src/module/temperature.cpp | 6 +++--- Marlin/src/module/temperature.h | 11 ++++++----- buildroot/tests/BIGTREE_GTR_V1_0 | 3 ++- 6 files changed, 23 insertions(+), 14 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index b43421f93033..a1561ce731a9 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -688,15 +688,15 @@ //#define MPC_FAN_0_ACTIVE_HOTEND #endif - #define FILAMENT_HEAT_CAPACITY_PERMM 5.6e-3f // 0.0056 J/K/mm for 1.75mm PLA (0.0149 J/K/mm for 2.85mm PLA). - //#define FILAMENT_HEAT_CAPACITY_PERMM 3.6e-3f // 0.0036 J/K/mm for 1.75mm PETG (0.0094 J/K/mm for 2.85mm PETG). + #define FILAMENT_HEAT_CAPACITY_PERMM { 5.6e-3f } // 0.0056 J/K/mm for 1.75mm PLA (0.0149 J/K/mm for 2.85mm PLA). + //#define FILAMENT_HEAT_CAPACITY_PERMM { 3.6e-3f } // 0.0036 J/K/mm for 1.75mm PETG (0.0094 J/K/mm for 2.85mm PETG). // Advanced options #define MPC_SMOOTHING_FACTOR 0.5f // (0.0...1.0) Noisy temperature sensors may need a lower value for stabilization. #define MPC_MIN_AMBIENT_CHANGE 1.0f // (K/s) Modeled ambient temperature rate of change, when correcting model inaccuracies. #define MPC_STEADYSTATE 0.5f // (K/s) Temperature change rate for steady state logic to be enforced. - #define MPC_TUNING_POS { X_CENTER, Y_CENTER, 1.0f } // (mm) M306 Autotuning position, ideally bed center just above the surface. + #define MPC_TUNING_POS { X_CENTER, Y_CENTER, 1.0f } // (mm) M306 Autotuning position, ideally bed center at first layer height. #define MPC_TUNING_END_Z 10.0f // (mm) M306 Autotuning final Z position. #endif diff --git a/Marlin/src/gcode/temp/M306.cpp b/Marlin/src/gcode/temp/M306.cpp index 0f286e73b236..4286b2017e22 100644 --- a/Marlin/src/gcode/temp/M306.cpp +++ b/Marlin/src/gcode/temp/M306.cpp @@ -36,6 +36,7 @@ * C Block heat capacity. * E Extruder number to set. (Default: E0) * F Ambient heat transfer coefficient (fan on full). + * H Filament heat capacity per mm. * P Heater power. * R Sensor responsiveness (= transfer coefficient / heat capcity). */ @@ -43,7 +44,7 @@ void GcodeSuite::M306() { if (parser.seen_test('T')) { thermalManager.MPC_autotune(); return; } - if (parser.seen("ACFPR")) { + if (parser.seen("ACFPRH")) { const heater_id_t hid = (heater_id_t)parser.intval('E', 0); MPC_t &constants = thermalManager.temp_hotend[hid].constants; if (parser.seenval('P')) constants.heater_power = parser.value_float(); @@ -53,6 +54,7 @@ void GcodeSuite::M306() { #if ENABLED(MPC_INCLUDE_FAN) if (parser.seenval('F')) constants.fan255_adjustment = parser.value_float() - constants.ambient_xfer_coeff_fan0; #endif + if (parser.seenval('H')) constants.filament_heat_capacity_permm = parser.value_float(); return; } @@ -70,8 +72,10 @@ void GcodeSuite::M306_report(const bool forReplay/*=true*/) { SERIAL_ECHOPAIR_F(" R", constants.sensor_responsiveness, 4); SERIAL_ECHOPAIR_F(" A", constants.ambient_xfer_coeff_fan0, 4); #if ENABLED(MPC_INCLUDE_FAN) - SERIAL_ECHOLNPAIR_F(" F", constants.ambient_xfer_coeff_fan0 + constants.fan255_adjustment, 4); + SERIAL_ECHOPAIR_F(" F", constants.ambient_xfer_coeff_fan0 + constants.fan255_adjustment, 4); #endif + SERIAL_ECHOPAIR_F(" M", constants.filament_heat_capacity_permm, 4); + SERIAL_EOL(); } } diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index ac9970bf5a18..149b1b6dc1e0 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -3319,6 +3319,7 @@ void MarlinSettings::reset() { #if ENABLED(MPC_INCLUDE_FAN) constexpr float _mpc_ambient_xfer_coeff_fan255[] = MPC_AMBIENT_XFER_COEFF_FAN255; #endif + constexpr float _filament_heat_capacity_permm[] = FILAMENT_HEAT_CAPACITY_PERMM; static_assert(COUNT(_mpc_heater_power) == HOTENDS, "MPC_HEATER_POWER must have HOTENDS items."); static_assert(COUNT(_mpc_block_heat_capacity) == HOTENDS, "MPC_BLOCK_HEAT_CAPACITY must have HOTENDS items."); @@ -3327,6 +3328,7 @@ void MarlinSettings::reset() { #if ENABLED(MPC_INCLUDE_FAN) static_assert(COUNT(_mpc_ambient_xfer_coeff_fan255) == HOTENDS, "MPC_AMBIENT_XFER_COEFF_FAN255 must have HOTENDS items."); #endif + static_assert(COUNT(_filament_heat_capacity_permm) == HOTENDS, "FILAMENT_HEAT_CAPACITY_PERMM must have HOTENDS items."); HOTEND_LOOP() { thermalManager.temp_hotend[e].constants.heater_power = _mpc_heater_power[e]; @@ -3336,6 +3338,7 @@ void MarlinSettings::reset() { #if ENABLED(MPC_INCLUDE_FAN) thermalManager.temp_hotend[e].constants.fan255_adjustment = _mpc_ambient_xfer_coeff_fan255[e] - _mpc_ambient_xfer_coeff[e]; #endif + thermalManager.temp_hotend[e].constants.filament_heat_capacity_permm = _filament_heat_capacity_permm[e]; } #endif diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index aa1cc04a3a03..e3d276b4eea7 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -994,7 +994,7 @@ volatile bool Temperature::raw_temps_ready = false; float asymp_temp = (t2 * t2 - t1 * t3) / (2 * t2 - t1 - t3), block_responsiveness = -log((t2 - asymp_temp) / (t1 - asymp_temp)) / (sample_distance * (sample_count >> 1)); - constants.ambient_xfer_coeff_fan0 = constants.heater_power * MPC_MAX / 255 / (asymp_temp - ambient_temp); + constants.ambient_xfer_coeff_fan0 = constants.heater_power * (MPC_MAX) / 255 / (asymp_temp - ambient_temp); constants.fan255_adjustment = 0.0f; constants.block_heat_capacity = constants.ambient_xfer_coeff_fan0 / block_responsiveness; constants.sensor_responsiveness = block_responsiveness / (1.0f - (ambient_temp - asymp_temp) * exp(-block_responsiveness * t1_time) / (t1 - asymp_temp)); @@ -1058,7 +1058,7 @@ volatile bool Temperature::raw_temps_ready = false; #endif // Calculate a new and better asymptotic temperature and re-evaluate the other constants - asymp_temp = ambient_temp + constants.heater_power / constants.ambient_xfer_coeff_fan0; + asymp_temp = ambient_temp + constants.heater_power * (MPC_MAX) / 255 / constants.ambient_xfer_coeff_fan0; block_responsiveness = -log((t2 - asymp_temp) / (t1 - asymp_temp)) / (sample_distance * (sample_count >> 1)); constants.block_heat_capacity = constants.ambient_xfer_coeff_fan0 / block_responsiveness; constants.sensor_responsiveness = block_responsiveness / (1.0f - (ambient_temp - asymp_temp) * exp(-block_responsiveness * t1_time) / (t1 - asymp_temp)); @@ -1442,7 +1442,7 @@ void Temperature::min_temp_error(const heater_id_t heater_id) { if (fabs(e_speed) > planner.settings.max_feedrate_mm_s[E_AXIS]) mpc_e_position = e_position; else if (e_speed > 0.0f) { // Ignore retract/recover moves - ambient_xfer_coeff += e_speed * FILAMENT_HEAT_CAPACITY_PERMM; + ambient_xfer_coeff += e_speed * constants.filament_heat_capacity_permm; mpc_e_position = e_position; } } diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index 2cc238217462..da9d4a071b9f 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -96,13 +96,14 @@ hotend_pid_t; #if ENABLED(MPCTEMP) typedef struct { - float heater_power; // M306 P - float block_heat_capacity; // M306 C - float sensor_responsiveness; // M306 R - float ambient_xfer_coeff_fan0; // M306 A + float heater_power; // M306 P + float block_heat_capacity; // M306 C + float sensor_responsiveness; // M306 R + float ambient_xfer_coeff_fan0; // M306 A #if ENABLED(MPC_INCLUDE_FAN) - float fan255_adjustment; // M306 F + float fan255_adjustment; // M306 F #endif + float filament_heat_capacity_permm; // M306 M } MPC_t; #endif diff --git a/buildroot/tests/BIGTREE_GTR_V1_0 b/buildroot/tests/BIGTREE_GTR_V1_0 index c9e15e9c2e67..d6eccaff07dc 100755 --- a/buildroot/tests/BIGTREE_GTR_V1_0 +++ b/buildroot/tests/BIGTREE_GTR_V1_0 @@ -37,7 +37,8 @@ opt_set MOTHERBOARD BOARD_BTT_GTR_V1_0 SERIAL_PORT -1 \ MPC_BLOCK_HEAT_CAPACITY '{ 16.7f, 16.7f, 16.7f }' \ MPC_SENSOR_RESPONSIVENESS '{ 0.22f, 0.22f, 0.22f }' \ MPC_AMBIENT_XFER_COEFF '{ 0.068f, 0.068f, 0.068f }' \ - MPC_AMBIENT_XFER_COEFF_FAN255 '{ 0.097f, 0.097f, 0.097f }' + MPC_AMBIENT_XFER_COEFF_FAN255 '{ 0.097f, 0.097f, 0.097f }' \ + FILAMENT_HEAT_CAPACITY_PERMM '{ 5.6e-3f, 3.6e-3f, 5.6e-3f }' opt_enable SWITCHING_TOOLHEAD TOOL_SENSOR MPCTEMP MPC_EDIT_MENU MPC_AUTOTUNE_MENU opt_disable PIDTEMP exec_test $1 $2 "BigTreeTech GTR | MPC | Switching Toolhead | Tool Sensors" "$3" From 68a7a3f88f93326bd4b904b0c8c7e0ebc7e63082 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sun, 29 May 2022 00:21:51 +0000 Subject: [PATCH 117/241] [cron] Bump distribution date (2022-05-29) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 91126c4b1665..79725c21860d 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-05-28" +//#define STRING_DISTRIBUTION_DATE "2022-05-29" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index a53d50958444..56f1f5c630d9 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-05-28" + #define STRING_DISTRIBUTION_DATE "2022-05-29" #endif /** From ea7bebb56887491d9c6b2a2ba2c2aee98dabc3e5 Mon Sep 17 00:00:00 2001 From: tombrazier <68918209+tombrazier@users.noreply.github.com> Date: Tue, 31 May 2022 18:01:59 +0100 Subject: [PATCH 118/241] =?UTF-8?q?=F0=9F=92=A5=20More=20M306=20M=20=3D>?= =?UTF-8?q?=20M306=20H=20(#24258)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #24253 --- Marlin/src/gcode/temp/M306.cpp | 2 +- Marlin/src/module/temperature.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/gcode/temp/M306.cpp b/Marlin/src/gcode/temp/M306.cpp index 4286b2017e22..7978922ff4c0 100644 --- a/Marlin/src/gcode/temp/M306.cpp +++ b/Marlin/src/gcode/temp/M306.cpp @@ -74,7 +74,7 @@ void GcodeSuite::M306_report(const bool forReplay/*=true*/) { #if ENABLED(MPC_INCLUDE_FAN) SERIAL_ECHOPAIR_F(" F", constants.ambient_xfer_coeff_fan0 + constants.fan255_adjustment, 4); #endif - SERIAL_ECHOPAIR_F(" M", constants.filament_heat_capacity_permm, 4); + SERIAL_ECHOPAIR_F(" H", constants.filament_heat_capacity_permm, 4); SERIAL_EOL(); } } diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index da9d4a071b9f..c11c9d76defb 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -103,7 +103,7 @@ hotend_pid_t; #if ENABLED(MPC_INCLUDE_FAN) float fan255_adjustment; // M306 F #endif - float filament_heat_capacity_permm; // M306 M + float filament_heat_capacity_permm; // M306 H } MPC_t; #endif From 1a555b381235878650cb2e9c6e74db5254bbff68 Mon Sep 17 00:00:00 2001 From: kisslorand <50251547+kisslorand@users.noreply.github.com> Date: Tue, 31 May 2022 20:05:57 +0300 Subject: [PATCH 119/241] Fix axis string 'N' (#24259) Followup to 167672d --- Marlin/src/core/serial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/core/serial.cpp b/Marlin/src/core/serial.cpp index 4dbf63c9bc12..49e792110efc 100644 --- a/Marlin/src/core/serial.cpp +++ b/Marlin/src/core/serial.cpp @@ -35,7 +35,7 @@ PGMSTR(SP_P_STR, " P"); PGMSTR(SP_T_STR, " T"); PGMSTR(NUL_STR, ""); #define _N_STR(N) PGMSTR(N##_STR, STR_##N); #define _N_LBL(N) PGMSTR(N##_LBL, STR_##N ":"); -#define _SP_N_STR(N) PGMSTR(SP_##N##_STR, STR_##N ":"); +#define _SP_N_STR(N) PGMSTR(SP_##N##_STR, " " STR_##N); #define _SP_N_LBL(N) PGMSTR(SP_##N##_LBL, " " STR_##N ":"); MAP(_N_STR, LOGICAL_AXIS_NAMES); MAP(_SP_N_STR, LOGICAL_AXIS_NAMES); MAP(_N_LBL, LOGICAL_AXIS_NAMES); MAP(_SP_N_LBL, LOGICAL_AXIS_NAMES); From 7dd34848b6244ac72771080706716dee57894eb5 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Wed, 1 Jun 2022 05:21:59 +1200 Subject: [PATCH 120/241] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20EXTRUDERS=200=20ma?= =?UTF-8?q?nual=20move=20compile=20(#24255)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/lcd/menu/menu_motion.cpp | 32 ++++++++++++----------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index e762089075aa..5704ebedb43d 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -35,15 +35,12 @@ #include "../../module/motion.h" #include "../../gcode/parser.h" // for inch support +#include "../../module/temperature.h" #if ENABLED(DELTA) #include "../../module/delta.h" #endif -#if ENABLED(PREVENT_COLD_EXTRUSION) - #include "../../module/temperature.h" -#endif - #if HAS_LEVELING #include "../../module/planner.h" #include "../../feature/bedlevel/bedlevel.h" @@ -222,23 +219,20 @@ void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int } inline void _menu_move_distance_e_maybe() { - #if ENABLED(PREVENT_COLD_EXTRUSION) - const bool too_cold = thermalManager.tooColdToExtrude(active_extruder); - if (too_cold) { - ui.goto_screen([]{ - MenuItem_confirm::select_screen( - GET_TEXT_F(MSG_BUTTON_PROCEED), GET_TEXT_F(MSG_BACK), - _goto_menu_move_distance_e, nullptr, - GET_TEXT_F(MSG_HOTEND_TOO_COLD), (const char *)nullptr, F("!") - ); - }); - return; - } - #endif - _goto_menu_move_distance_e(); + if (thermalManager.tooColdToExtrude(active_extruder)) { + ui.goto_screen([]{ + MenuItem_confirm::select_screen( + GET_TEXT_F(MSG_BUTTON_PROCEED), GET_TEXT_F(MSG_BACK), + _goto_menu_move_distance_e, nullptr, + GET_TEXT_F(MSG_HOTEND_TOO_COLD), (const char *)nullptr, F("!") + ); + }); + } + else + _goto_menu_move_distance_e(); } -#endif // E_MANUAL +#endif void menu_move() { START_MENU(); From 58ce5182c2ea93e79ccaef4c912c68aa554e637e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 31 May 2022 12:43:44 -0500 Subject: [PATCH 121/241] =?UTF-8?q?=F0=9F=8E=A8=20Fix=20spelling,=20whites?= =?UTF-8?q?pace?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 2 +- Marlin/Makefile | 2 +- Marlin/src/core/boards.h | 2 +- Marlin/src/feature/meatpack.cpp | 2 +- Marlin/src/feature/meatpack.h | 4 ++-- Marlin/src/feature/mmu/mmu2-serial-protocol.md | 2 +- Marlin/src/feature/mmu/mmu2.cpp | 2 +- Marlin/src/gcode/gcode.cpp | 2 +- Marlin/src/gcode/gcode.h | 2 +- Marlin/src/gcode/parser.h | 2 +- Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp | 2 +- Marlin/src/lcd/extui/dgus/DGUSDisplay.cpp | 2 +- Marlin/src/lcd/extui/malyan/malyan.cpp | 2 +- Marlin/src/lcd/extui/mks_ui/draw_print_file.cpp | 6 +++--- Marlin/src/lcd/extui/mks_ui/draw_ui.cpp | 6 +++--- Marlin/src/lcd/extui/mks_ui/pic_manager.h | 2 +- Marlin/src/module/planner.h | 4 ++-- buildroot/share/scripts/g29_auto.py | 10 +++++----- 18 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index a1561ce731a9..cdfaa49fb624 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -643,7 +643,7 @@ #if ENABLED(PIDTEMP) //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders) - // Set/get with gcode: M301 E[extruder number, 0-2] + // Set/get with G-code: M301 E[extruder number, 0-2] #if ENABLED(PID_PARAMS_PER_HOTEND) // Specify up to one value per hotend here, according to your setup. diff --git a/Marlin/Makefile b/Marlin/Makefile index f1c89ff7f520..417c979f8857 100644 --- a/Marlin/Makefile +++ b/Marlin/Makefile @@ -512,7 +512,7 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1324) else ifeq ($(HARDWARE_MOTHERBOARD),1325) # Intamsys 4.0 (Funmat HT) else ifeq ($(HARDWARE_MOTHERBOARD),1326) -# Malyan M180 Mainboard Version 2 (no display function, direct gcode only) +# Malyan M180 Mainboard Version 2 (no display function, direct G-code only) else ifeq ($(HARDWARE_MOTHERBOARD),1327) # Geeetech GT2560 Rev B for A20(M/T/D) else ifeq ($(HARDWARE_MOTHERBOARD),1328) diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 20ec0298d528..beda61567534 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -161,7 +161,7 @@ #define BOARD_PICA_REVB 1324 // PICA Shield (original version) #define BOARD_PICA 1325 // PICA Shield (rev C or later) #define BOARD_INTAMSYS40 1326 // Intamsys 4.0 (Funmat HT) -#define BOARD_MALYAN_M180 1327 // Malyan M180 Mainboard Version 2 (no display function, direct gcode only) +#define BOARD_MALYAN_M180 1327 // Malyan M180 Mainboard Version 2 (no display function, direct G-code only) #define BOARD_GT2560_V4_A20 1328 // Geeetech GT2560 Rev B for A20(M/T/D) #define BOARD_PROTONEER_CNC_SHIELD_V3 1329 // Mega controller & Protoneer CNC Shield V3.00 #define BOARD_WEEDO_62A 1330 // WEEDO 62A board (TINA2, Monoprice Cadet, etc.) diff --git a/Marlin/src/feature/meatpack.cpp b/Marlin/src/feature/meatpack.cpp index b2899243b2fb..07ff41e5be22 100644 --- a/Marlin/src/feature/meatpack.cpp +++ b/Marlin/src/feature/meatpack.cpp @@ -26,7 +26,7 @@ * Algorithm & Implementation: Scott Mudge - mail@scottmudge.com * Date: Dec. 2020 * - * Character Frequencies from ~30 MB of comment-stripped gcode: + * Character Frequencies from ~30 MB of comment-stripped G-code: * '1' -> 4451136 '4' -> 1353273 '\n' -> 1087683 '-' -> 90242 * '0' -> 4253577 '9' -> 1352147 'G' -> 1075806 'Z' -> 34109 * ' ' -> 3053297 '3' -> 1262929 'X' -> 975742 'M' -> 11879 diff --git a/Marlin/src/feature/meatpack.h b/Marlin/src/feature/meatpack.h index a56e65b6cc30..98a535e5923f 100644 --- a/Marlin/src/feature/meatpack.h +++ b/Marlin/src/feature/meatpack.h @@ -29,7 +29,7 @@ * Specifically optimized for 3D printing G-Code, this is a zero-cost data compression method * which packs ~180-190% more data into the same amount of bytes going to the CNC controller. * As a majority of G-Code can be represented by a restricted alphabet, I performed histogram - * analysis on a wide variety of 3D printing gcode samples, and found ~93% of all gcode could + * analysis on a wide variety of 3D printing G-code samples, and found ~93% of all G-code could * be represented by the same 15-character alphabet. * * This allowed me to design a system of packing 2 8-bit characters into a single byte, assuming @@ -38,7 +38,7 @@ * * Combined with some logic to allow commingling of full-width characters outside of this 15- * character alphabet (at the cost of an extra 8-bits per full-width character), and by stripping - * out unnecessary comments, the end result is gcode which is roughly half the original size. + * out unnecessary comments, the end result is G-code which is roughly half the original size. * * Why did I do this? I noticed micro-stuttering and other data-bottleneck issues while printing * objects with high curvature, especially at high speeds. There is also the issue of the limited diff --git a/Marlin/src/feature/mmu/mmu2-serial-protocol.md b/Marlin/src/feature/mmu/mmu2-serial-protocol.md index 7ff0901742af..93135e406f36 100644 --- a/Marlin/src/feature/mmu/mmu2-serial-protocol.md +++ b/Marlin/src/feature/mmu/mmu2-serial-protocol.md @@ -51,7 +51,7 @@ When done, the MMU sends - MMU => 'ok\n' -We don't wait for a response here but immediately continue with the next gcode which should +We don't wait for a response here but immediately continue with the next G-code which should be one or more extruder moves to feed the filament into the hotend. diff --git a/Marlin/src/feature/mmu/mmu2.cpp b/Marlin/src/feature/mmu/mmu2.cpp index 2544995c6d18..a4718b53d9d8 100644 --- a/Marlin/src/feature/mmu/mmu2.cpp +++ b/Marlin/src/feature/mmu/mmu2.cpp @@ -939,7 +939,7 @@ bool MMU2::load_filament_to_nozzle(const uint8_t index) { * Load filament to nozzle of multimaterial printer * * This function is used only after T? (user select filament) and M600 (change filament). - * It is not used after T0 .. T4 command (select filament), in such case, gcode is responsible for loading + * It is not used after T0 .. T4 command (select filament), in such case, G-code is responsible for loading * filament to nozzle. */ void MMU2::load_to_nozzle() { diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index b8668c74a856..2ba48f9ef286 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -21,7 +21,7 @@ */ /** - * gcode.cpp - Temporary container for all gcode handlers + * gcode.cpp - Temporary container for all G-code handlers * Most will migrate to classes, by feature. */ diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 215d0d4f9b92..150cbab4c23e 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -110,7 +110,7 @@ * M33 - Get the longname version of a path. (Requires LONG_FILENAME_HOST_SUPPORT) * M34 - Set SD Card sorting options. (Requires SDCARD_SORT_ALPHA) * - * M42 - Change pin status via gcode: M42 P S. LED pin assumed if P is omitted. (Requires DIRECT_PIN_CONTROL) + * M42 - Change pin status via G-code: M42 P S. LED pin assumed if P is omitted. (Requires DIRECT_PIN_CONTROL) * M43 - Display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins (Requires PINS_DEBUGGING) * M48 - Measure Z Probe repeatability: M48 P X Y V E L S. (Requires Z_MIN_PROBE_REPEATABILITY_TEST) * diff --git a/Marlin/src/gcode/parser.h b/Marlin/src/gcode/parser.h index 3b46cde631bc..3f5290e81c67 100644 --- a/Marlin/src/gcode/parser.h +++ b/Marlin/src/gcode/parser.h @@ -45,7 +45,7 @@ /** * GCode parser * - * - Parse a single gcode line for its letter, code, subcode, and parameters + * - Parse a single G-code line for its letter, code, subcode, and parameters * - FASTER_GCODE_PARSER: * - Flags existing params (1 bit each) * - Stores value offsets (1 byte each) diff --git a/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp b/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp index 7561c89d79bf..285729cc15d2 100644 --- a/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp +++ b/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp @@ -708,7 +708,7 @@ void ChironTFT::PanelAction(uint8_t req) { // Old TFT A22 X -1F1500 A22 X +1F1500 // New TFT A22 X-1.0 F1500 A22 X1.0 F1500 - // lets just wrap this in a gcode relative nonprint move and let the controller deal with it + // Send a G-code-relative non-print move and let the controller deal with it // G91 G0 G90 if (!isPrinting()) { // Ignore request if printing diff --git a/Marlin/src/lcd/extui/dgus/DGUSDisplay.cpp b/Marlin/src/lcd/extui/dgus/DGUSDisplay.cpp index 6fa188bf5ff3..0eb95bb041ba 100644 --- a/Marlin/src/lcd/extui/dgus/DGUSDisplay.cpp +++ b/Marlin/src/lcd/extui/dgus/DGUSDisplay.cpp @@ -243,7 +243,7 @@ void DGUSDisplay::WritePGM(const char str[], uint8_t len) { } void DGUSDisplay::loop() { - // protect against recursion… ProcessRx() may indirectly call idle() when injecting gcode commands. + // Protect against recursion. ProcessRx() may indirectly call idle() when injecting G-code commands. if (!no_reentrance) { no_reentrance = true; ProcessRx(); diff --git a/Marlin/src/lcd/extui/malyan/malyan.cpp b/Marlin/src/lcd/extui/malyan/malyan.cpp index df7f305df2be..06c9886f0131 100644 --- a/Marlin/src/lcd/extui/malyan/malyan.cpp +++ b/Marlin/src/lcd/extui/malyan/malyan.cpp @@ -24,7 +24,7 @@ * lcd/extui/malyan/malyan.cpp * * LCD implementation for Malyan's LCD, a separate ESP8266 MCU running - * on Serial1 for the M200 board. This module outputs a pseudo-gcode + * on Serial1 for the M200 board. This module outputs a pseudo-G-code * wrapped in curly braces which the LCD implementation translates into * actual G-code commands. * diff --git a/Marlin/src/lcd/extui/mks_ui/draw_print_file.cpp b/Marlin/src/lcd/extui/mks_ui/draw_print_file.cpp index 5d6a99191034..0199bc1f555d 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_print_file.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_print_file.cpp @@ -369,7 +369,7 @@ uint32_t lv_open_gcode_file(char *path) { card.openFileRead(cur_name); card.read(public_buf, 512); ps4 = (uint32_t *)strstr((char *)public_buf, ";simage:"); - // Ignore the beginning message of gcode file + // Ignore the beginning message of G-code file if (ps4) { pre_sread_cnt = (uintptr_t)ps4 - (uintptr_t)((uint32_t *)(&public_buf[0])); card.setIndex(pre_sread_cnt); @@ -490,7 +490,7 @@ void cutFileName(char *path, int len, int bytePerLine, char *outStr) { //&& (strIndex2 != 0) && (strIndex1 < strIndex2) ) ? strIndex1 + 1 : tmpFile; - if (strIndex2 == 0 || (strIndex1 > strIndex2)) { // not gcode file + if (strIndex2 == 0 || (strIndex1 > strIndex2)) { // not G-code file #if _LFN_UNICODE if (wcslen(beginIndex) > len) wcsncpy(outStr, beginIndex, len); @@ -503,7 +503,7 @@ void cutFileName(char *path, int len, int bytePerLine, char *outStr) { strcpy(outStr, beginIndex); #endif } - else { // gcode file + else { // G-code file if (strIndex2 - beginIndex > (len - 2)) { #if _LFN_UNICODE wcsncpy(outStr, (const WCHAR *)beginIndex, len - 3); diff --git a/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp b/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp index d3f192e44f70..6a8333fd66df 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp @@ -159,7 +159,7 @@ void gCfgItems_init() { gCfgItems.spi_flash_flag = FLASH_INF_VALID_FLAG; W25QXX.SPI_FLASH_SectorErase(VAR_INF_ADDR); W25QXX.SPI_FLASH_BufferWrite((uint8_t *)&gCfgItems, VAR_INF_ADDR, sizeof(gCfgItems)); - // init gcode command + // Init G-code command W25QXX.SPI_FLASH_BufferWrite((uint8_t *)&custom_gcode_command[0], AUTO_LEVELING_COMMAND_ADDR, 100); W25QXX.SPI_FLASH_BufferWrite((uint8_t *)&custom_gcode_command[1], OTHERS_COMMAND_ADDR_1, 100); W25QXX.SPI_FLASH_BufferWrite((uint8_t *)&custom_gcode_command[2], OTHERS_COMMAND_ADDR_2, 100); @@ -238,7 +238,7 @@ void update_spi_flash() { uint8_t command_buf[512]; W25QXX.init(SPI_QUARTER_SPEED); - // read back the gcode command before erase spi flash + // read back the G-code command before erase spi flash W25QXX.SPI_FLASH_BufferRead((uint8_t *)&command_buf, GCODE_COMMAND_ADDR, sizeof(command_buf)); W25QXX.SPI_FLASH_SectorErase(VAR_INF_ADDR); W25QXX.SPI_FLASH_BufferWrite((uint8_t *)&gCfgItems, VAR_INF_ADDR, sizeof(gCfgItems)); @@ -249,7 +249,7 @@ void update_gcode_command(int addr, uint8_t *s) { uint8_t command_buf[512]; W25QXX.init(SPI_QUARTER_SPEED); - // read back the gcode command before erase spi flash + // read back the G-code command before erase spi flash W25QXX.SPI_FLASH_BufferRead((uint8_t *)&command_buf, GCODE_COMMAND_ADDR, sizeof(command_buf)); W25QXX.SPI_FLASH_SectorErase(VAR_INF_ADDR); W25QXX.SPI_FLASH_BufferWrite((uint8_t *)&gCfgItems, VAR_INF_ADDR, sizeof(gCfgItems)); diff --git a/Marlin/src/lcd/extui/mks_ui/pic_manager.h b/Marlin/src/lcd/extui/mks_ui/pic_manager.h index 320cb20b0b8d..cdcc5b76b8a9 100644 --- a/Marlin/src/lcd/extui/mks_ui/pic_manager.h +++ b/Marlin/src/lcd/extui/mks_ui/pic_manager.h @@ -122,7 +122,7 @@ #define VAR_INF_ADDR 0x000000 #define FLASH_INF_VALID_FLAG 0x20201118 -// Store some gcode commands, such as auto leveling commands +// Store some G-code commands, such as auto-leveling commands #define GCODE_COMMAND_ADDR VAR_INF_ADDR + 3 * 1024 #define AUTO_LEVELING_COMMAND_ADDR GCODE_COMMAND_ADDR #define OTHERS_COMMAND_ADDR_1 AUTO_LEVELING_COMMAND_ADDR + 100 diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index dbc8592179ca..bef381b5c7c4 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -163,7 +163,7 @@ enum BlockFlag : char { * A single entry in the planner buffer. * Tracks linear movement over multiple axes. * - * The "nominal" values are as-specified by gcode, and + * The "nominal" values are as-specified by G-code, and * may never actually be reached due to acceleration limits. */ typedef struct block_t { @@ -412,7 +412,7 @@ class Planner { /** * The current position of the tool in absolute steps - * Recalculated if any axis_steps_per_mm are changed by gcode + * Recalculated if any axis_steps_per_mm are changed by G-code */ static xyze_long_t position; diff --git a/buildroot/share/scripts/g29_auto.py b/buildroot/share/scripts/g29_auto.py index ca36346dd9dd..5cf27b996865 100755 --- a/buildroot/share/scripts/g29_auto.py +++ b/buildroot/share/scripts/g29_auto.py @@ -1,13 +1,13 @@ #!/usr/bin/env python -# This file is for preprocessing gcode and the new G29 Autobedleveling from Marlin -# It will analyse the first 2 Layer and return the maximum size for this part -# After this it will replace with g29_keyword = ';MarlinG29Script' with the new G29 LRFB -# the new file will be created in the same folder. +# This file is for preprocessing G-code and the new G29 Auto bed leveling from Marlin +# It will analyze the first 2 layers and return the maximum size for this part +# Then it will be replaced with g29_keyword = ';MarlinG29Script' with the new G29 LRFB. +# The new file will be created in the same folder. from __future__ import print_function -# your gcode-file/folder +# Your G-code file/folder folder = './' my_file = 'test.gcode' From 3d70aca6e8c88ae8ab7a5d05c3cade0c6c760e7d Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 31 May 2022 18:24:10 +0000 Subject: [PATCH 122/241] [cron] Bump distribution date (2022-05-31) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 79725c21860d..f8bf0082e835 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-05-29" +//#define STRING_DISTRIBUTION_DATE "2022-05-31" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 56f1f5c630d9..f69fc8ce8762 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-05-29" + #define STRING_DISTRIBUTION_DATE "2022-05-31" #endif /** From 6f3d7d864fe930517f5b0d81875a38fd1eafaad8 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Tue, 31 May 2022 14:28:01 -0700 Subject: [PATCH 123/241] =?UTF-8?q?=F0=9F=91=94=20Configs=20required=20to?= =?UTF-8?q?=20submit=20a=20Bug=20Report=20(#24256)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/ISSUE_TEMPLATE/bug_report.yml | 29 +++++++++++++-------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 59269af81d7d..9d8b0666e5eb 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -50,6 +50,8 @@ body: Describe the bug in this section. Tell us what you were trying to do and what happened that you did not expect. Provide a clear and concise description of the problem and include as many details as possible. + + When pasting formatted text don't forget to put ` ``` ` (on its own line) before and after to make it readable. placeholder: | Marlin doesn't work. validations: @@ -147,23 +149,20 @@ body: - Same as my slicer - Other (explain below) - - type: markdown + - type: checkboxes attributes: - value: >- - ## Other things to include - - Please also be sure to include these items to help with troubleshooting: - - * **A ZIP file** containing your `Configuration.h` and `Configuration_adv.h`. - (Please don't paste lengthy configuration text here.) - * **Log output** from the host. (`M111 S247` for maximum logging.) - * **Images or videos** demonstrating the problem, if it helps to make it clear. - * **A G-Code file** that exposes the problem, if not affecting _all_ G-code. - - If you've made any other modifications to the firmware, please describe them in detail in the space provided. - - When pasting formatted text into the box below don't forget to put ` ``` ` (on its own line) before and after to make it readable. + label: Other things to include + options: + - label: A ZIP file containing your `Configuration.h` and `Configuration_adv.h`. + required: true + - label: Log output from the host. (`M111 S247` for maximum logging.) + - label: Images or videos demonstrating the problem, if it helps to make it clear. + - label: A G-Code file that exposes the problem, if not affecting _all_ G-code. - type: textarea attributes: label: Additional information & file uploads + description: >- + If you've made any other modifications to the firmware, please describe them in detail. + + When pasting formatted text don't forget to put ` ``` ` (on its own line) before and after to make it readable. From 85c0875db28477d7ed6515c39376b93407353b27 Mon Sep 17 00:00:00 2001 From: John Robertson Date: Tue, 31 May 2022 23:09:44 +0100 Subject: [PATCH 124/241] =?UTF-8?q?=E2=9C=A8=20Laser=20Safety=20Timeout=20?= =?UTF-8?q?(#24189)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 10 +++++ Marlin/src/MarlinCore.cpp | 57 ++++++++++++------------ Marlin/src/feature/spindle_laser.cpp | 4 +- Marlin/src/feature/spindle_laser.h | 3 +- Marlin/src/gcode/control/M17_M18_M84.cpp | 11 ++++- Marlin/src/gcode/control/M3-M5.cpp | 4 ++ Marlin/src/gcode/control/M85.cpp | 9 +++- Marlin/src/gcode/gcode.cpp | 7 ++- Marlin/src/gcode/gcode.h | 16 ++++--- Marlin/src/inc/Conditionals_adv.h | 4 ++ Marlin/src/inc/SanityCheck.h | 6 +++ Marlin/src/module/temperature.cpp | 13 ++++++ buildroot/tests/BIGTREE_SKR_PRO | 2 +- buildroot/tests/mega2560 | 8 ++-- 14 files changed, 109 insertions(+), 45 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index ef54315e604f..16a4f36e4fb5 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -3668,6 +3668,16 @@ #define LASER_TEST_PULSE_MIN 1 // Used with Laser Control Menu #define LASER_TEST_PULSE_MAX 999 // Caution: Menu may not show more than 3 characters + /** + * Laser Safety Timeout + * + * The laser should be turned off when there is no movement for a period of time. + * Consider material flammability, cut rate, and G-code order when setting this + * value. Too low and it could turn off during a very slow move; too high and + * the material could ignite. + */ + #define LASER_SAFETY_TIMEOUT_MS 1000 // (ms) + /** * Enable inline laser power to be handled in the planner / stepper routines. * Inline power is specified by the I (inline) flag in an M3 command (e.g., M3 S20 I) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 4572dc9d7c87..e85ee6fb80ce 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -423,37 +423,38 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) { kill(); } - // M18 / M84 : Handle steppers inactive time timeout - if (gcode.stepper_inactive_time) { - - static bool already_shutdown_steppers; // = false + const bool has_blocks = planner.has_blocks_queued(); // Any moves in the planner? + if (has_blocks) gcode.reset_stepper_timeout(ms); // Reset timeout for M18/M84, M85 max 'kill', and laser. - // Any moves in the planner? Resets both the M18/M84 - // activity timeout and the M85 max 'kill' timeout - if (planner.has_blocks_queued()) - gcode.reset_stepper_timeout(ms); - else if (!do_reset_timeout && gcode.stepper_inactive_timeout()) { - if (!already_shutdown_steppers) { - already_shutdown_steppers = true; // L6470 SPI will consume 99% of free time without this - - // Individual axes will be disabled if configured - TERN_(DISABLE_INACTIVE_X, stepper.disable_axis(X_AXIS)); - TERN_(DISABLE_INACTIVE_Y, stepper.disable_axis(Y_AXIS)); - TERN_(DISABLE_INACTIVE_Z, stepper.disable_axis(Z_AXIS)); - TERN_(DISABLE_INACTIVE_I, stepper.disable_axis(I_AXIS)); - TERN_(DISABLE_INACTIVE_J, stepper.disable_axis(J_AXIS)); - TERN_(DISABLE_INACTIVE_K, stepper.disable_axis(K_AXIS)); - TERN_(DISABLE_INACTIVE_U, stepper.disable_axis(U_AXIS)); - TERN_(DISABLE_INACTIVE_V, stepper.disable_axis(V_AXIS)); - TERN_(DISABLE_INACTIVE_W, stepper.disable_axis(W_AXIS)); - TERN_(DISABLE_INACTIVE_E, stepper.disable_e_steppers()); - - TERN_(AUTO_BED_LEVELING_UBL, bedlevel.steppers_were_disabled()); + // M18 / M84 : Handle steppers inactive time timeout + #if HAS_DISABLE_INACTIVE_AXIS + if (gcode.stepper_inactive_time) { + + static bool already_shutdown_steppers; // = false + + if (!has_blocks && !do_reset_timeout && gcode.stepper_inactive_timeout()) { + if (!already_shutdown_steppers) { + already_shutdown_steppers = true; // L6470 SPI will consume 99% of free time without this + + // Individual axes will be disabled if configured + TERN_(DISABLE_INACTIVE_X, stepper.disable_axis(X_AXIS)); + TERN_(DISABLE_INACTIVE_Y, stepper.disable_axis(Y_AXIS)); + TERN_(DISABLE_INACTIVE_Z, stepper.disable_axis(Z_AXIS)); + TERN_(DISABLE_INACTIVE_I, stepper.disable_axis(I_AXIS)); + TERN_(DISABLE_INACTIVE_J, stepper.disable_axis(J_AXIS)); + TERN_(DISABLE_INACTIVE_K, stepper.disable_axis(K_AXIS)); + TERN_(DISABLE_INACTIVE_U, stepper.disable_axis(U_AXIS)); + TERN_(DISABLE_INACTIVE_V, stepper.disable_axis(V_AXIS)); + TERN_(DISABLE_INACTIVE_W, stepper.disable_axis(W_AXIS)); + TERN_(DISABLE_INACTIVE_E, stepper.disable_e_steppers()); + + TERN_(AUTO_BED_LEVELING_UBL, bedlevel.steppers_were_disabled()); + } } + else + already_shutdown_steppers = false; } - else - already_shutdown_steppers = false; - } + #endif #if ENABLED(PHOTO_GCODE) && PIN_EXISTS(CHDK) // Check if CHDK should be set to LOW (after M240 set it HIGH) diff --git a/Marlin/src/feature/spindle_laser.cpp b/Marlin/src/feature/spindle_laser.cpp index ef3503c40d88..8f70816c9942 100644 --- a/Marlin/src/feature/spindle_laser.cpp +++ b/Marlin/src/feature/spindle_laser.cpp @@ -39,7 +39,8 @@ #endif SpindleLaser cutter; -uint8_t SpindleLaser::power; +uint8_t SpindleLaser::power, + SpindleLaser::last_power_applied; // = 0 // Basic power state tracking #if ENABLED(LASER_FEATURE) cutter_test_pulse_t SpindleLaser::testPulse = 50; // Test fire Pulse time ms value. #endif @@ -113,7 +114,6 @@ void SpindleLaser::init() { * @param opwr Power value. Range 0 to MAX. When 0 disable spindle/laser. */ void SpindleLaser::apply_power(const uint8_t opwr) { - static uint8_t last_power_applied = 0; if (opwr == last_power_applied) return; last_power_applied = opwr; power = opwr; diff --git a/Marlin/src/feature/spindle_laser.h b/Marlin/src/feature/spindle_laser.h index 2791dc7ad1be..808fa634e162 100644 --- a/Marlin/src/feature/spindle_laser.h +++ b/Marlin/src/feature/spindle_laser.h @@ -89,7 +89,8 @@ class SpindleLaser { #endif static bool isReady; // Ready to apply power setting from the UI to OCR - static uint8_t power; + static uint8_t power, + last_power_applied; // Basic power state tracking #if ENABLED(MARLIN_DEV_MODE) static cutter_frequency_t frequency; // Set PWM frequency; range: 2K-50K diff --git a/Marlin/src/gcode/control/M17_M18_M84.cpp b/Marlin/src/gcode/control/M17_M18_M84.cpp index ebb8c7eff0ec..c2c8a702a1b6 100644 --- a/Marlin/src/gcode/control/M17_M18_M84.cpp +++ b/Marlin/src/gcode/control/M17_M18_M84.cpp @@ -211,7 +211,16 @@ void try_to_disable(const stepper_flags_t to_disable) { void GcodeSuite::M18_M84() { if (parser.seenval('S')) { reset_stepper_timeout(); - stepper_inactive_time = parser.value_millis_from_seconds(); + #if HAS_DISABLE_INACTIVE_AXIS + const millis_t ms = parser.value_millis_from_seconds(); + #if LASER_SAFETY_TIMEOUT_MS > 0 + if (ms && ms <= LASER_SAFETY_TIMEOUT_MS) { + SERIAL_ECHO_MSG("M18 timeout must be > ", MS_TO_SEC(LASER_SAFETY_TIMEOUT_MS + 999), " s for laser safety."); + return; + } + #endif + stepper_inactive_time = ms; + #endif } else { if (parser.seen_axis()) { diff --git a/Marlin/src/gcode/control/M3-M5.cpp b/Marlin/src/gcode/control/M3-M5.cpp index cdb37a1207ad..817ed4fcb4d9 100644 --- a/Marlin/src/gcode/control/M3-M5.cpp +++ b/Marlin/src/gcode/control/M3-M5.cpp @@ -66,6 +66,10 @@ * PWM duty cycle goes from 0 (off) to 255 (always on). */ void GcodeSuite::M3_M4(const bool is_M4) { + #if LASER_SAFETY_TIMEOUT_MS > 0 + reset_stepper_timeout(); // Reset timeout to allow subsequent G-code to power the laser (imm.) + #endif + #if EITHER(SPINDLE_LASER_USE_PWM, SPINDLE_SERVO) auto get_s_power = [] { if (parser.seenval('S')) { diff --git a/Marlin/src/gcode/control/M85.cpp b/Marlin/src/gcode/control/M85.cpp index 9c8c02c59aa0..ee868349ed75 100644 --- a/Marlin/src/gcode/control/M85.cpp +++ b/Marlin/src/gcode/control/M85.cpp @@ -29,7 +29,14 @@ void GcodeSuite::M85() { if (parser.seen('S')) { reset_stepper_timeout(); - max_inactive_time = parser.value_millis_from_seconds(); + const millis_t ms = parser.value_millis_from_seconds(); + #if LASER_SAFETY_TIMEOUT_MS > 0 + if (ms && ms <= LASER_SAFETY_TIMEOUT_MS) { + SERIAL_ECHO_MSG("M85 timeout must be > ", MS_TO_SEC(LASER_SAFETY_TIMEOUT_MS + 999), " s for laser safety."); + return; + } + #endif + max_inactive_time = ms; } } diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 2ba48f9ef286..5425fc701fcd 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -73,8 +73,11 @@ GcodeSuite gcode; // Inactivity shutdown millis_t GcodeSuite::previous_move_ms = 0, - GcodeSuite::max_inactive_time = 0, - GcodeSuite::stepper_inactive_time = SEC_TO_MS(DEFAULT_STEPPER_DEACTIVE_TIME); + GcodeSuite::max_inactive_time = 0; + +#if HAS_DISABLE_INACTIVE_AXIS + millis_t GcodeSuite::stepper_inactive_time = SEC_TO_MS(DEFAULT_STEPPER_DEACTIVE_TIME); +#endif // Relative motion mode for each logical axis static constexpr xyze_bool_t ar_init = AXIS_RELATIVE_MODES; diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 150cbab4c23e..1efcb1cf9345 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -396,14 +396,20 @@ class GcodeSuite { static bool select_coordinate_system(const int8_t _new); #endif - static millis_t previous_move_ms, max_inactive_time, stepper_inactive_time; - FORCE_INLINE static void reset_stepper_timeout(const millis_t ms=millis()) { previous_move_ms = ms; } + static millis_t previous_move_ms, max_inactive_time; FORCE_INLINE static bool stepper_max_timed_out(const millis_t ms=millis()) { return max_inactive_time && ELAPSED(ms, previous_move_ms + max_inactive_time); } - FORCE_INLINE static bool stepper_inactive_timeout(const millis_t ms=millis()) { - return ELAPSED(ms, previous_move_ms + stepper_inactive_time); - } + FORCE_INLINE static void reset_stepper_timeout(const millis_t ms=millis()) { previous_move_ms = ms; } + + #if HAS_DISABLE_INACTIVE_AXIS + static millis_t stepper_inactive_time; + FORCE_INLINE static bool stepper_inactive_timeout(const millis_t ms=millis()) { + return ELAPSED(ms, previous_move_ms + stepper_inactive_time); + } + #else + static bool stepper_inactive_timeout(const millis_t) { return false; } + #endif static void report_echo_start(const bool forReplay); static void report_heading(const bool forReplay, FSTR_P const fstr, const bool eol=true); diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index caed384a6383..130e68f61ee9 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -1044,3 +1044,7 @@ #undef CONFIGURATION_EMBEDDING #define CANNOT_EMBED_CONFIGURATION defined(__AVR__) #endif + +#if ANY(DISABLE_INACTIVE_X, DISABLE_INACTIVE_Y, DISABLE_INACTIVE_Z, DISABLE_INACTIVE_I, DISABLE_INACTIVE_J, DISABLE_INACTIVE_K, DISABLE_INACTIVE_U, DISABLE_INACTIVE_V, DISABLE_INACTIVE_W, DISABLE_INACTIVE_E) + #define HAS_DISABLE_INACTIVE_AXIS 1 +#endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index ab4643f86771..ebbd85ad1b2a 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -3867,6 +3867,7 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive."); #error "Enabled an inline laser feature without inline laser power being enabled." #endif #endif + #define _PIN_CONFLICT(P) (PIN_EXISTS(P) && P##_PIN == SPINDLE_LASER_PWM_PIN) #if BOTH(SPINDLE_FEATURE, LASER_FEATURE) #error "Enable only one of SPINDLE_FEATURE or LASER_FEATURE." @@ -3934,6 +3935,11 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive."); #endif #endif #undef _PIN_CONFLICT + + #ifdef LASER_SAFETY_TIMEOUT_MS + static_assert(LASER_SAFETY_TIMEOUT_MS < (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL, "LASER_SAFETY_TIMEOUT_MS must be less than DEFAULT_STEPPER_DEACTIVE_TIME (" STRINGIFY(DEFAULT_STEPPER_DEACTIVE_TIME) " seconds)"); + #endif + #endif #if ENABLED(COOLANT_MIST) && !PIN_EXISTS(COOLANT_MIST) diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index e3d276b4eea7..4fe71d3feffb 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -71,6 +71,10 @@ #include "../libs/nozzle.h" #endif +#if LASER_SAFETY_TIMEOUT_MS > 0 + #include "../feature/spindle_laser.h" +#endif + // MAX TC related macros #define TEMP_SENSOR_IS_MAX(n, M) (ENABLED(TEMP_SENSOR_##n##_IS_MAX##M) || (ENABLED(TEMP_SENSOR_REDUNDANT_IS_MAX##M) && REDUNDANT_TEMP_MATCH(SOURCE, E##n))) #define TEMP_SENSOR_IS_ANY_MAX_TC(n) (ENABLED(TEMP_SENSOR_##n##_IS_MAX_TC) || (ENABLED(TEMP_SENSOR_REDUNDANT_IS_MAX_TC) && REDUNDANT_TEMP_MATCH(SOURCE, E##n))) @@ -3328,6 +3332,7 @@ class SoftPWM { /** * Handle various ~1kHz tasks associated with temperature + * - Check laser safety timeout * - Heater PWM (~1kHz with scaler) * - LCD Button polling (~500Hz) * - Start / Read one ADC sensor @@ -3337,6 +3342,14 @@ class SoftPWM { */ void Temperature::isr() { + // Shut down the laser if steppers are inactive for > LASER_SAFETY_TIMEOUT_MS ms + #if LASER_SAFETY_TIMEOUT_MS > 0 + if (cutter.last_power_applied && ELAPSED(millis(), gcode.previous_move_ms + (LASER_SAFETY_TIMEOUT_MS))) { + cutter.power = 0; // Prevent planner idle from re-enabling power + cutter.apply_power(0); + } + #endif + static int8_t temp_count = -1; static ADCSensorState adc_sensor_state = StartupDelay; static uint8_t pwm_count = _BV(SOFT_PWM_SCALE); diff --git a/buildroot/tests/BIGTREE_SKR_PRO b/buildroot/tests/BIGTREE_SKR_PRO index 2503b28544ad..2f1075c7ef22 100755 --- a/buildroot/tests/BIGTREE_SKR_PRO +++ b/buildroot/tests/BIGTREE_SKR_PRO @@ -26,7 +26,7 @@ opt_set MOTHERBOARD BOARD_BTT_SKR_PRO_V1_1 SERIAL_PORT -1 \ CUTTER_POWER_UNIT PERCENT \ SPINDLE_LASER_PWM_PIN HEATER_1_PIN SPINDLE_LASER_ENA_PIN HEATER_2_PIN \ TEMP_SENSOR_COOLER 1000 TEMP_COOLER_PIN PD13 -opt_enable LASER_FEATURE REPRAP_DISCOUNT_SMART_CONTROLLER +opt_enable LASER_FEATURE LASER_SAFETY_TIMEOUT_MS REPRAP_DISCOUNT_SMART_CONTROLLER exec_test $1 $2 "BigTreeTech SKR Pro | Laser (Percent) | Cooling | LCD" "$3" # clean up diff --git a/buildroot/tests/mega2560 b/buildroot/tests/mega2560 index 3677abf60ef0..fc24cf212509 100755 --- a/buildroot/tests/mega2560 +++ b/buildroot/tests/mega2560 @@ -179,8 +179,8 @@ opt_set MOTHERBOARD BOARD_RAMPS_14_EFB EXTRUDERS 0 LCD_LANGUAGE en TEMP_SENSOR_C DEFAULT_MAX_ACCELERATION '{ 3000, 3000, 100 }' \ MANUAL_FEEDRATE '{ 50*60, 50*60, 4*60 }' \ AXIS_RELATIVE_MODES '{ false, false, false }' -opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER SDSUPPORT EEPROM_SETTINGS EEPROM_BOOT_SILENT EEPROM_AUTO_INIT \ - LASER_FEATURE AIR_EVACUATION AIR_EVACUATION_PIN AIR_ASSIST AIR_ASSIST_PIN LASER_COOLANT_FLOW_METER MEATPACK_ON_SERIAL_PORT_1 +opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER SDSUPPORT EEPROM_SETTINGS EEPROM_BOOT_SILENT EEPROM_AUTO_INIT MEATPACK_ON_SERIAL_PORT_1 \ + LASER_FEATURE LASER_SAFETY_TIMEOUT_MS LASER_COOLANT_FLOW_METER AIR_EVACUATION AIR_EVACUATION_PIN AIR_ASSIST AIR_ASSIST_PIN exec_test $1 $2 "MEGA2560 RAMPS | Laser Feature | Air Evacuation | Air Assist | Cooler | Flowmeter | 12864 LCD | meatpack | SERIAL_PORT_2 " "$3" # @@ -193,8 +193,8 @@ opt_set MOTHERBOARD BOARD_RAMPS_14_EFB EXTRUDERS 0 LCD_LANGUAGE en TEMP_SENSOR_C DEFAULT_MAX_ACCELERATION '{ 3000, 3000, 100 }' \ MANUAL_FEEDRATE '{ 50*60, 50*60, 4*60 }' \ AXIS_RELATIVE_MODES '{ false, false, false }' -opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT EEPROM_SETTINGS EEPROM_BOOT_SILENT EEPROM_AUTO_INIT PRINTCOUNTER \ - LASER_FEATURE AIR_EVACUATION AIR_EVACUATION_PIN AIR_ASSIST AIR_ASSIST_PIN LASER_COOLANT_FLOW_METER I2C_AMMETER +opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT EEPROM_SETTINGS EEPROM_BOOT_SILENT EEPROM_AUTO_INIT PRINTCOUNTER I2C_AMMETER \ + LASER_FEATURE LASER_SAFETY_TIMEOUT_MS LASER_COOLANT_FLOW_METER AIR_EVACUATION AIR_EVACUATION_PIN AIR_ASSIST AIR_ASSIST_PIN exec_test $1 $2 "MEGA2560 RAMPS | Laser Feature | Air Evacuation | Air Assist | Cooler | Flowmeter | 44780 LCD " "$3" # From 30a7c4ca52db1a46460666bed5c0aa30cdf2e2b5 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Wed, 1 Jun 2022 00:25:07 +0000 Subject: [PATCH 125/241] [cron] Bump distribution date (2022-06-01) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index f8bf0082e835..a4d30bc26b80 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-05-31" +//#define STRING_DISTRIBUTION_DATE "2022-06-01" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index f69fc8ce8762..50994141714b 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-05-31" + #define STRING_DISTRIBUTION_DATE "2022-06-01" #endif /** From e260d90d2130ba76e72d83da8eaac0eec0685163 Mon Sep 17 00:00:00 2001 From: ledzepman71 Date: Thu, 2 Jun 2022 02:49:48 -0600 Subject: [PATCH 126/241] =?UTF-8?q?=F0=9F=93=8C=20Tenlog=20PSU=20pin=20(#2?= =?UTF-8?q?4266)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/ramps/pins_TENLOG_D3_HERO.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Marlin/src/pins/ramps/pins_TENLOG_D3_HERO.h b/Marlin/src/pins/ramps/pins_TENLOG_D3_HERO.h index 61c5ddd64306..b11487b21d36 100644 --- a/Marlin/src/pins/ramps/pins_TENLOG_D3_HERO.h +++ b/Marlin/src/pins/ramps/pins_TENLOG_D3_HERO.h @@ -148,6 +148,7 @@ // // Misc. Functions // +//#define PS_ON_PIN 40 // The M80/M81 PSU pin for boards v2.1-2.3 //#define CASE_LIGHT_PIN 5 #define SDSS 53 //#ifndef LED_PIN From f6b425613e0e2eb01ab7fe06bd29fcd34885544b Mon Sep 17 00:00:00 2001 From: bryan065 <30362590+bryan065@users.noreply.github.com> Date: Thu, 2 Jun 2022 04:51:39 -0400 Subject: [PATCH 127/241] =?UTF-8?q?=F0=9F=9A=B8=20Custom=20Menu=20Items=20?= =?UTF-8?q?for=20JyersUI=20(#24270)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 167 ++++++++++++++++++++++++++- Marlin/src/lcd/e3v2/jyersui/dwin.h | 3 +- 2 files changed, 168 insertions(+), 2 deletions(-) diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 9fed9fee83d9..f8ba1090d91b 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -121,6 +121,26 @@ #define MIN_BED_TEMP 0 #endif +/** + * Custom menu items with jyersLCD + */ +#if ENABLED(CUSTOM_MENU_CONFIG) + #ifdef CONFIG_MENU_ITEM_5_DESC + #define CUSTOM_MENU_COUNT 5 + #elif defined(CONFIG_MENU_ITEM_4_DESC) + #define CUSTOM_MENU_COUNT 4 + #elif defined(CONFIG_MENU_ITEM_3_DESC) + #define CUSTOM_MENU_COUNT 3 + #elif defined(CONFIG_MENU_ITEM_2_DESC) + #define CUSTOM_MENU_COUNT 2 + #elif defined(CONFIG_MENU_ITEM_1_DESC) + #define CUSTOM_MENU_COUNT 1 + #endif + #if CUSTOM_MENU_COUNT + #define HAS_CUSTOM_MENU 1 + #endif +#endif + constexpr uint16_t TROWS = 6, MROWS = TROWS - 1, TITLE_HEIGHT = 30, MLINE = 53, @@ -1078,7 +1098,8 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #define PREPARE_PREHEAT (PREPARE_ZOFFSET + ENABLED(HAS_PREHEAT)) #define PREPARE_COOLDOWN (PREPARE_PREHEAT + EITHER(HAS_HOTEND, HAS_HEATED_BED)) #define PREPARE_CHANGEFIL (PREPARE_COOLDOWN + ENABLED(ADVANCED_PAUSE_FEATURE)) - #define PREPARE_TOTAL PREPARE_CHANGEFIL + #define PREPARE_CUSTOM_MENU (PREPARE_CHANGEFIL + ENABLED(HAS_CUSTOM_MENU)) + #define PREPARE_TOTAL PREPARE_CUSTOM_MENU switch (item) { case PREPARE_BACK: @@ -1153,6 +1174,18 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; #endif + #if HAS_CUSTOM_MENU + case PREPARE_CUSTOM_MENU: + #ifndef CUSTOM_MENU_CONFIG_TITLE + #define CUSTOM_MENU_CONFIG_TITLE "Custom Commands" + #endif + if (draw) + Draw_Menu_Item(row, ICON_Version, F(CUSTOM_MENU_CONFIG_TITLE)); + else + Draw_Menu(MenuCustom); + break; + #endif + #if ENABLED(ADVANCED_PAUSE_FEATURE) case PREPARE_CHANGEFIL: if (draw) { @@ -1750,6 +1783,126 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; #endif // FILAMENT_LOAD_UNLOAD_GCODES + #if HAS_CUSTOM_MENU + + case MenuCustom: + + #define CUSTOM_MENU_BACK 0 + #define CUSTOM_MENU_1 1 + #define CUSTOM_MENU_2 2 + #define CUSTOM_MENU_3 3 + #define CUSTOM_MENU_4 4 + #define CUSTOM_MENU_5 5 + #define CUSTOM_MENU_TOTAL CUSTOM_MENU_COUNT + + switch (item) { + case CUSTOM_MENU_BACK: + if (draw) + Draw_Menu_Item(row, ICON_Back, F("Back")); + else + Draw_Menu(Prepare, PREPARE_CUSTOM_MENU); + break; + + #if CUSTOM_MENU_COUNT >= 1 + case CUSTOM_MENU_1: + if (draw) + Draw_Menu_Item(row, ICON_Info, F(CONFIG_MENU_ITEM_1_DESC)); + else { + Popup_Handler(Custom); + //queue.inject(F(CONFIG_MENU_ITEM_1_GCODE)); // Old code + gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_1_GCODE)); + planner.synchronize(); + Redraw_Menu(); + #if ENABLED(CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK) + AudioFeedback(); + #endif + #ifdef CUSTOM_MENU_CONFIG_SCRIPT_RETURN + queue.inject(F(CUSTOM_MENU_CONFIG_SCRIPT_DONE)); + #endif + } + break; + #endif + + #if CUSTOM_MENU_COUNT >= 2 + case CUSTOM_MENU_2: + if (draw) + Draw_Menu_Item(row, ICON_Info, F(CONFIG_MENU_ITEM_2_DESC)); + else { + Popup_Handler(Custom); + gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_2_GCODE)); + planner.synchronize(); + Redraw_Menu(); + #if ENABLED(CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK) + AudioFeedback(); + #endif + #ifdef CUSTOM_MENU_CONFIG_SCRIPT_RETURN + queue.inject(F(CUSTOM_MENU_CONFIG_SCRIPT_DONE)); + #endif + } + break; + #endif + + #if CUSTOM_MENU_COUNT >= 3 + case CUSTOM_MENU_3: + if (draw) + Draw_Menu_Item(row, ICON_Info, F(CONFIG_MENU_ITEM_3_DESC)); + else { + Popup_Handler(Custom); + gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_3_GCODE)); + planner.synchronize(); + Redraw_Menu(); + #if ENABLED(CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK) + AudioFeedback(); + #endif + #ifdef CUSTOM_MENU_CONFIG_SCRIPT_RETURN + queue.inject(F(CUSTOM_MENU_CONFIG_SCRIPT_DONE)); + #endif + } + break; + #endif + + #if CUSTOM_MENU_COUNT >= 4 + case CUSTOM_MENU_4: + if (draw) + Draw_Menu_Item(row, ICON_Info, F(CONFIG_MENU_ITEM_4_DESC)); + else { + Popup_Handler(Custom); + gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_4_GCODE)); + planner.synchronize(); + Redraw_Menu(); + #if ENABLED(CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK) + AudioFeedback(); + #endif + #ifdef CUSTOM_MENU_CONFIG_SCRIPT_RETURN + queue.inject(F(CUSTOM_MENU_CONFIG_SCRIPT_DONE)); + #endif + } + break; + #endif + + #if CUSTOM_MENU_COUNT >= 5 + case CUSTOM_MENU_5: + if (draw) + Draw_Menu_Item(row, ICON_Info, F(CONFIG_MENU_ITEM_5_DESC)); + else { + Popup_Handler(Custom); + gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_5_GCODE)); + planner.synchronize(); + Redraw_Menu(); + #if ENABLED(CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK) + AudioFeedback(); + #endif + #ifdef CUSTOM_MENU_CONFIG_SCRIPT_RETURN + queue.inject(F(CUSTOM_MENU_CONFIG_SCRIPT_DONE)); + #endif + } + break; + #endif // Custom Menu + } + break; + + #endif // HAS_CUSTOM_MENU + case Control: #define CONTROL_BACK 0 @@ -3688,6 +3841,14 @@ FSTR_P CrealityDWINClass::Get_Menu_Title(uint8_t menu) { #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) case ChangeFilament: return F("Change Filament"); #endif + #if HAS_CUSTOM_MENU + case MenuCustom: + #ifdef CUSTOM_MENU_CONFIG_TITLE + return F(CUSTOM_MENU_CONFIG_TITLE); + #else + return F("Custom Commands"); + #endif + #endif case Control: return F("Control"); case TempMenu: return F("Temperature"); #if HAS_HOTEND || HAS_HEATED_BED @@ -3753,6 +3914,9 @@ uint8_t CrealityDWINClass::Get_Menu_Size(uint8_t menu) { #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) case ChangeFilament: return CHANGEFIL_TOTAL; #endif + #if HAS_CUSTOM_MENU + case MenuCustom: return CUSTOM_MENU_TOTAL; + #endif case Control: return CONTROL_TOTAL; case TempMenu: return TEMP_TOTAL; #if HAS_HOTEND || HAS_HEATED_BED @@ -3831,6 +3995,7 @@ void CrealityDWINClass::Popup_Handler(PopupID popupid, bool option/*=false*/) { case Runout: Draw_Popup(F("Filament Runout"), F(""), F(""), Wait, ICON_BLTouch); break; case PIDWait: Draw_Popup(F("PID Autotune"), F("in process"), F("Please wait until done."), Wait, ICON_BLTouch); break; case Resuming: Draw_Popup(F("Resuming Print"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break; + case Custom: Draw_Popup(F("Running Custom GCode"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break; default: break; } } diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.h b/Marlin/src/lcd/e3v2/jyersui/dwin.h index d238d8e24ffa..8985647cd131 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.h +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.h @@ -43,7 +43,7 @@ enum processID : uint8_t { enum PopupID : uint8_t { Pause, Stop, Resume, SaveLevel, ETemp, ConfFilChange, PurgeMore, MeshSlot, Level, Home, MoveWait, Heating, FilLoad, FilChange, TempWarn, Runout, PIDWait, Resuming, ManualProbing, - FilInsert, HeaterTime, UserInput, LevelError, InvalidMesh, UI, Complete + FilInsert, HeaterTime, UserInput, LevelError, InvalidMesh, UI, Complete, Custom }; enum menuID : uint8_t { @@ -55,6 +55,7 @@ enum menuID : uint8_t { ZOffset, Preheat, ChangeFilament, + MenuCustom, Control, TempMenu, PID, From eda61a2cbd1de39001193ca6ebf5c5c22df3878c Mon Sep 17 00:00:00 2001 From: BIGTREETECH <38851044+bigtreetech@users.noreply.github.com> Date: Thu, 2 Jun 2022 17:02:06 +0800 Subject: [PATCH 128/241] =?UTF-8?q?=E2=9C=A8=20BigTreeTech=20SKR3=20-=20ST?= =?UTF-8?q?M32H743=20(#24271)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Alan.Ma --- Marlin/src/HAL/STM32/sdio.cpp | 377 +++++------- Marlin/src/core/boards.h | 2 + Marlin/src/pins/pins.h | 4 + Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0.h | 26 + .../src/pins/stm32h7/pins_BTT_SKR_V3_0_EZ.h | 26 + .../pins/stm32h7/pins_BTT_SKR_V3_0_common.h | 569 ++++++++++++++++++ .../PlatformIO/boards/marlin_STM32H743Vx.json | 61 ++ .../variants/MARLIN_H743Vx/PeripheralPins.c | 539 +++++++++++++++++ .../variants/MARLIN_H743Vx/PinNamesVar.h | 112 ++++ .../variants/MARLIN_H743Vx/ldscript.ld | 208 +++++++ .../variant_MARLIN_STM32H743Vx.cpp | 245 ++++++++ .../variant_MARLIN_STM32H743Vx.h | 268 +++++++++ ini/stm32h7.ini | 21 + 13 files changed, 2243 insertions(+), 215 deletions(-) create mode 100644 Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0.h create mode 100644 Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_EZ.h create mode 100644 Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h create mode 100644 buildroot/share/PlatformIO/boards/marlin_STM32H743Vx.json create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_H743Vx/PeripheralPins.c create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_H743Vx/PinNamesVar.h create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_H743Vx/ldscript.ld create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_H743Vx/variant_MARLIN_STM32H743Vx.cpp create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_H743Vx/variant_MARLIN_STM32H743Vx.h diff --git a/Marlin/src/HAL/STM32/sdio.cpp b/Marlin/src/HAL/STM32/sdio.cpp index b26ec768e8cd..a58589c43ee4 100644 --- a/Marlin/src/HAL/STM32/sdio.cpp +++ b/Marlin/src/HAL/STM32/sdio.cpp @@ -35,42 +35,15 @@ // use local drivers #if defined(STM32F103xE) || defined(STM32F103xG) - #include - #include + #include #elif defined(STM32F4xx) - #include - #include - #include - #include + #include #elif defined(STM32F7xx) - #include - #include - #include - #include + #include +#elif defined(STM32H7xx) + #include #else - #error "SDIO only supported with STM32F103xE, STM32F103xG, STM32F4xx, or STM32F7xx." -#endif - -SD_HandleTypeDef hsd; // create SDIO structure -// F4 supports one DMA for RX and another for TX, but Marlin will never -// do read and write at same time, so we use the same DMA for both. -DMA_HandleTypeDef hdma_sdio; - -/* - SDIO_INIT_CLK_DIV is 118 - SDIO clock frequency is 48MHz / (TRANSFER_CLOCK_DIV + 2) - SDIO init clock frequency should not exceed 400kHz = 48MHz / (118 + 2) - - Default TRANSFER_CLOCK_DIV is 2 (118 / 40) - Default SDIO clock frequency is 48MHz / (2 + 2) = 12 MHz - This might be too fast for stable SDIO operations - - MKS Robin board seems to have stable SDIO with BusWide 1bit and ClockDiv 8 i.e. 4.8MHz SDIO clock frequency - Additional testing is required as there are clearly some 4bit initialization problems -*/ - -#ifndef USBD_OK - #define USBD_OK 0 + #error "SDIO only supported with STM32F103xE, STM32F103xG, STM32F4xx, STM32F7xx, or STM32H7xx." #endif // Target Clock, configurable. Default is 18MHz, from STM32F1 @@ -78,223 +51,208 @@ DMA_HandleTypeDef hdma_sdio; #define SDIO_CLOCK 18000000 // 18 MHz #endif -// SDIO retries, configurable. Default is 3, from STM32F1 -#ifndef SDIO_READ_RETRIES - #define SDIO_READ_RETRIES 3 -#endif +#define SD_TIMEOUT 1000 // ms // SDIO Max Clock (naming from STM Manual, don't change) #define SDIOCLK 48000000 -static uint32_t clock_to_divider(uint32_t clk) { - // limit the SDIO master clock to 8/3 of PCLK2. See STM32 Manuals - // Also limited to no more than 48Mhz (SDIOCLK). - const uint32_t pclk2 = HAL_RCC_GetPCLK2Freq(); - clk = min(clk, (uint32_t)(pclk2 * 8 / 3)); - clk = min(clk, (uint32_t)SDIOCLK); - // Round up divider, so we don't run the card over the speed supported, - // and subtract by 2, because STM32 will add 2, as written in the manual: - // SDIO_CK frequency = SDIOCLK / [CLKDIV + 2] - return pclk2 / clk + (pclk2 % clk != 0) - 2; -} - -void go_to_transfer_speed() { - /* Default SDIO peripheral configuration for SD card initialization */ - hsd.Init.ClockEdge = hsd.Init.ClockEdge; - hsd.Init.ClockBypass = hsd.Init.ClockBypass; - hsd.Init.ClockPowerSave = hsd.Init.ClockPowerSave; - hsd.Init.BusWide = hsd.Init.BusWide; - hsd.Init.HardwareFlowControl = hsd.Init.HardwareFlowControl; - hsd.Init.ClockDiv = clock_to_divider(SDIO_CLOCK); - - /* Initialize SDIO peripheral interface with default configuration */ - SDIO_Init(hsd.Instance, hsd.Init); -} - -void SD_LowLevel_Init(void) { - uint32_t tempreg; +#if defined(STM32F1xx) + DMA_HandleTypeDef hdma_sdio; + extern "C" void DMA2_Channel4_5_IRQHandler(void) { + HAL_DMA_IRQHandler(&hdma_sdio); + } +#elif defined(STM32F4xx) + DMA_HandleTypeDef hdma_sdio_rx; + DMA_HandleTypeDef hdma_sdio_tx; + extern "C" void DMA2_Stream3_IRQHandler(void) { + HAL_DMA_IRQHandler(&hdma_sdio_rx); + } - __HAL_RCC_GPIOC_CLK_ENABLE(); //enable GPIO clocks - __HAL_RCC_GPIOD_CLK_ENABLE(); //enable GPIO clocks + extern "C" void DMA2_Stream6_IRQHandler(void) { + HAL_DMA_IRQHandler(&hdma_sdio_tx); + } +#elif defined(STM32H7xx) + #define __HAL_RCC_SDIO_FORCE_RESET __HAL_RCC_SDMMC1_FORCE_RESET + #define __HAL_RCC_SDIO_RELEASE_RESET __HAL_RCC_SDMMC1_RELEASE_RESET + #define __HAL_RCC_SDIO_CLK_ENABLE __HAL_RCC_SDMMC1_CLK_ENABLE + #define SDIO SDMMC1 + #define SDIO_IRQn SDMMC1_IRQn + #define SDIO_IRQHandler SDMMC1_IRQHandler + #define SDIO_CLOCK_EDGE_RISING SDMMC_CLOCK_EDGE_RISING + #define SDIO_CLOCK_POWER_SAVE_DISABLE SDMMC_CLOCK_POWER_SAVE_DISABLE + #define SDIO_BUS_WIDE_1B SDMMC_BUS_WIDE_1B + #define SDIO_BUS_WIDE_4B SDMMC_BUS_WIDE_4B + #define SDIO_HARDWARE_FLOW_CONTROL_DISABLE SDMMC_HARDWARE_FLOW_CONTROL_DISABLE +#endif - GPIO_InitTypeDef GPIO_InitStruct; +uint8_t waitingRxCplt = 0; +uint8_t waitingTxCplt = 0; +SD_HandleTypeDef hsd; - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = 1; //GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; +extern "C" void SDIO_IRQHandler(void) { + HAL_SD_IRQHandler(&hsd); +} - #if DISABLED(STM32F1xx) - GPIO_InitStruct.Alternate = GPIO_AF12_SDIO; - #endif +void HAL_SD_TxCpltCallback(SD_HandleTypeDef *hsdio) { + waitingTxCplt = 0; +} - GPIO_InitStruct.Pin = GPIO_PIN_8 | GPIO_PIN_12; // D0 & SCK - HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); +void HAL_SD_RxCpltCallback(SD_HandleTypeDef *hsdio) { + waitingRxCplt = 0; +} +void HAL_SD_MspInit(SD_HandleTypeDef *hsd) { + pinmap_pinout(PC_12, PinMap_SD); + pinmap_pinout(PD_2, PinMap_SD); + pinmap_pinout(PC_8, PinMap_SD); #if PINS_EXIST(SDIO_D1, SDIO_D2, SDIO_D3) // define D1-D3 only if have a four bit wide SDIO bus - GPIO_InitStruct.Pin = GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11; // D1-D3 - HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); + // D1-D3 + pinmap_pinout(PC_9, PinMap_SD); + pinmap_pinout(PC_10, PinMap_SD); + pinmap_pinout(PC_11, PinMap_SD); #endif - // Configure PD.02 CMD line - GPIO_InitStruct.Pin = GPIO_PIN_2; - HAL_GPIO_Init(GPIOD, &GPIO_InitStruct); + __HAL_RCC_SDIO_CLK_ENABLE(); + HAL_NVIC_EnableIRQ(SDIO_IRQn); - // Setup DMA + // DMA Config #if defined(STM32F1xx) - hdma_sdio.Init.Mode = DMA_NORMAL; - hdma_sdio.Instance = DMA2_Channel4; + __HAL_RCC_DMA2_CLK_ENABLE(); HAL_NVIC_EnableIRQ(DMA2_Channel4_5_IRQn); + hdma_sdio.Instance = DMA2_Channel4; + hdma_sdio.Init.Direction = DMA_PERIPH_TO_MEMORY; + hdma_sdio.Init.PeriphInc = DMA_PINC_DISABLE; + hdma_sdio.Init.MemInc = DMA_MINC_ENABLE; + hdma_sdio.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD; + hdma_sdio.Init.MemDataAlignment = DMA_MDATAALIGN_WORD; + hdma_sdio.Init.Mode = DMA_NORMAL; + hdma_sdio.Init.Priority = DMA_PRIORITY_LOW; + HAL_DMA_Init(&hdma_sdio); + + __HAL_LINKDMA(hsd, hdmarx ,hdma_sdio); + __HAL_LINKDMA(hsd, hdmatx, hdma_sdio); #elif defined(STM32F4xx) - hdma_sdio.Init.Mode = DMA_PFCTRL; - hdma_sdio.Instance = DMA2_Stream3; - hdma_sdio.Init.Channel = DMA_CHANNEL_4; - hdma_sdio.Init.FIFOMode = DMA_FIFOMODE_ENABLE; - hdma_sdio.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL; - hdma_sdio.Init.MemBurst = DMA_MBURST_INC4; - hdma_sdio.Init.PeriphBurst = DMA_PBURST_INC4; + __HAL_RCC_DMA2_CLK_ENABLE(); HAL_NVIC_EnableIRQ(DMA2_Stream3_IRQn); + HAL_NVIC_EnableIRQ(DMA2_Stream6_IRQn); + hdma_sdio_rx.Instance = DMA2_Stream3; + hdma_sdio_rx.Init.Channel = DMA_CHANNEL_4; + hdma_sdio_rx.Init.Direction = DMA_PERIPH_TO_MEMORY; + hdma_sdio_rx.Init.PeriphInc = DMA_PINC_DISABLE; + hdma_sdio_rx.Init.MemInc = DMA_MINC_ENABLE; + hdma_sdio_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD; + hdma_sdio_rx.Init.MemDataAlignment = DMA_MDATAALIGN_WORD; + hdma_sdio_rx.Init.Mode = DMA_PFCTRL; + hdma_sdio_rx.Init.Priority = DMA_PRIORITY_LOW; + hdma_sdio_rx.Init.FIFOMode = DMA_FIFOMODE_ENABLE; + hdma_sdio_rx.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL; + hdma_sdio_rx.Init.MemBurst = DMA_MBURST_INC4; + hdma_sdio_rx.Init.PeriphBurst = DMA_PBURST_INC4; + HAL_DMA_Init(&hdma_sdio_rx); + + __HAL_LINKDMA(hsd,hdmarx,hdma_sdio_rx); + + hdma_sdio_tx.Instance = DMA2_Stream6; + hdma_sdio_tx.Init.Channel = DMA_CHANNEL_4; + hdma_sdio_tx.Init.Direction = DMA_MEMORY_TO_PERIPH; + hdma_sdio_tx.Init.PeriphInc = DMA_PINC_DISABLE; + hdma_sdio_tx.Init.MemInc = DMA_MINC_ENABLE; + hdma_sdio_tx.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD; + hdma_sdio_tx.Init.MemDataAlignment = DMA_MDATAALIGN_WORD; + hdma_sdio_tx.Init.Mode = DMA_PFCTRL; + hdma_sdio_tx.Init.Priority = DMA_PRIORITY_LOW; + hdma_sdio_tx.Init.FIFOMode = DMA_FIFOMODE_ENABLE; + hdma_sdio_tx.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL; + hdma_sdio_tx.Init.MemBurst = DMA_MBURST_INC4; + hdma_sdio_tx.Init.PeriphBurst = DMA_PBURST_INC4; + HAL_DMA_Init(&hdma_sdio_tx); + + __HAL_LINKDMA(hsd,hdmatx,hdma_sdio_tx); #endif - HAL_NVIC_EnableIRQ(SDIO_IRQn); - hdma_sdio.Init.PeriphInc = DMA_PINC_DISABLE; - hdma_sdio.Init.MemInc = DMA_MINC_ENABLE; - hdma_sdio.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD; - hdma_sdio.Init.MemDataAlignment = DMA_MDATAALIGN_WORD; - hdma_sdio.Init.Priority = DMA_PRIORITY_LOW; - __HAL_LINKDMA(&hsd, hdmarx, hdma_sdio); - __HAL_LINKDMA(&hsd, hdmatx, hdma_sdio); +} - #if defined(STM32F1xx) - __HAL_RCC_SDIO_CLK_ENABLE(); - __HAL_RCC_DMA2_CLK_ENABLE(); - #else +void HAL_SD_MspDeInit(SD_HandleTypeDef *hsd) { + #if !defined(STM32F1xx) __HAL_RCC_SDIO_FORCE_RESET(); - delay(2); + delay(10); __HAL_RCC_SDIO_RELEASE_RESET(); - delay(2); - __HAL_RCC_SDIO_CLK_ENABLE(); - - __HAL_RCC_DMA2_FORCE_RESET(); - delay(2); - __HAL_RCC_DMA2_RELEASE_RESET(); - delay(2); - __HAL_RCC_DMA2_CLK_ENABLE(); + delay(10); #endif - - //Initialize the SDIO (with initial <400Khz Clock) - tempreg = 0; //Reset value - tempreg |= SDIO_CLKCR_CLKEN; // Clock enabled - tempreg |= SDIO_INIT_CLK_DIV; // Clock Divider. Clock = 48000 / (118 + 2) = 400Khz - // Keep the rest at 0 => HW_Flow Disabled, Rising Clock Edge, Disable CLK ByPass, Bus Width = 0, Power save Disable - SDIO->CLKCR = tempreg; - - // Power up the SDIO - SDIO_PowerState_ON(SDIO); - hsd.Instance = SDIO; } -void HAL_SD_MspInit(SD_HandleTypeDef *hsd) { // application specific init - UNUSED(hsd); // Prevent unused argument(s) compilation warning - __HAL_RCC_SDIO_CLK_ENABLE(); // turn on SDIO clock +static uint32_t clock_to_divider(uint32_t clk) { + #if defined(STM32H7xx) + // SDMMC_CK frequency = sdmmc_ker_ck / [2 * CLKDIV]. + uint32_t sdmmc_clk = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_SDMMC); + return sdmmc_clk / (2U * SDIO_CLOCK) + (sdmmc_clk % (2U * SDIO_CLOCK) != 0); + #else + // limit the SDIO master clock to 8/3 of PCLK2. See STM32 Manuals + // Also limited to no more than 48Mhz (SDIOCLK). + const uint32_t pclk2 = HAL_RCC_GetPCLK2Freq(); + clk = min(clk, (uint32_t)(pclk2 * 8 / 3)); + clk = min(clk, (uint32_t)SDIOCLK); + // Round up divider, so we don't run the card over the speed supported, + // and subtract by 2, because STM32 will add 2, as written in the manual: + // SDIO_CK frequency = SDIOCLK / [CLKDIV + 2] + return pclk2 / clk + (pclk2 % clk != 0) - 2; + #endif } bool SDIO_Init() { - uint8_t retryCnt = SDIO_READ_RETRIES; + HAL_StatusTypeDef sd_state = HAL_OK; + HAL_SD_DeInit(&hsd); - bool status; + /* HAL SD initialization */ hsd.Instance = SDIO; - hsd.State = HAL_SD_STATE_RESET; - - SD_LowLevel_Init(); - - uint8_t retry_Cnt = retryCnt; - for (;;) { - hal.watchdog_refresh(); - status = (bool) HAL_SD_Init(&hsd); - if (!status) break; - if (!--retry_Cnt) return false; // return failing status if retries are exhausted - } - - go_to_transfer_speed(); - - #if PINS_EXIST(SDIO_D1, SDIO_D2, SDIO_D3) // go to 4 bit wide mode if pins are defined - retry_Cnt = retryCnt; - for (;;) { - hal.watchdog_refresh(); - if (!HAL_SD_ConfigWideBusOperation(&hsd, SDIO_BUS_WIDE_4B)) break; // some cards are only 1 bit wide so a pass here is not required - if (!--retry_Cnt) break; - } - if (!retry_Cnt) { // wide bus failed, go back to one bit wide mode - hsd.State = (HAL_SD_StateTypeDef) 0; // HAL_SD_STATE_RESET - SD_LowLevel_Init(); - retry_Cnt = retryCnt; - for (;;) { - hal.watchdog_refresh(); - status = (bool) HAL_SD_Init(&hsd); - if (!status) break; - if (!--retry_Cnt) return false; // return failing status if retries are exhausted - } - go_to_transfer_speed(); + hsd.Init.ClockEdge = SDIO_CLOCK_EDGE_RISING; + hsd.Init.ClockPowerSave = SDIO_CLOCK_POWER_SAVE_DISABLE; + hsd.Init.BusWide = SDIO_BUS_WIDE_1B; + hsd.Init.HardwareFlowControl = SDIO_HARDWARE_FLOW_CONTROL_DISABLE; + hsd.Init.ClockDiv = clock_to_divider(SDIO_CLOCK); + sd_state = HAL_SD_Init(&hsd); + + #if PINS_EXIST(SDIO_D1, SDIO_D2, SDIO_D3) + if (sd_state == HAL_OK) { + sd_state = HAL_SD_ConfigWideBusOperation(&hsd, SDIO_BUS_WIDE_4B); } #endif - return true; + return (sd_state == HAL_OK) ? true : false; } -static bool SDIO_ReadWriteBlock_DMA(uint32_t block, const uint8_t *src, uint8_t *dst) { - if (HAL_SD_GetCardState(&hsd) != HAL_SD_CARD_TRANSFER) return false; - - hal.watchdog_refresh(); +bool SDIO_ReadBlock(uint32_t block, uint8_t *dst) { + uint32_t timeout = HAL_GetTick() + SD_TIMEOUT; - HAL_StatusTypeDef ret; - if (src) { - hdma_sdio.Init.Direction = DMA_MEMORY_TO_PERIPH; - HAL_DMA_Init(&hdma_sdio); - ret = HAL_SD_WriteBlocks_DMA(&hsd, (uint8_t *)src, block, 1); - } - else { - hdma_sdio.Init.Direction = DMA_PERIPH_TO_MEMORY; - HAL_DMA_Init(&hdma_sdio); - ret = HAL_SD_ReadBlocks_DMA(&hsd, (uint8_t *)dst, block, 1); + while (HAL_SD_GetCardState(&hsd) != HAL_SD_CARD_TRANSFER) { + if (HAL_GetTick() >= timeout) return false; } - if (ret != HAL_OK) { - HAL_DMA_Abort_IT(&hdma_sdio); - HAL_DMA_DeInit(&hdma_sdio); + waitingRxCplt = 1; + if (HAL_SD_ReadBlocks_DMA(&hsd, (uint8_t *)dst, block, 1) != HAL_OK) return false; - } - millis_t timeout = millis() + 500; - // Wait the transfer - while (hsd.State != HAL_SD_STATE_READY) { - if (ELAPSED(millis(), timeout)) { - HAL_DMA_Abort_IT(&hdma_sdio); - HAL_DMA_DeInit(&hdma_sdio); - return false; - } - } + timeout = HAL_GetTick() + SD_TIMEOUT; + while (waitingRxCplt) + if (HAL_GetTick() >= timeout) return false; - while (__HAL_DMA_GET_FLAG(&hdma_sdio, __HAL_DMA_GET_TC_FLAG_INDEX(&hdma_sdio)) != 0 - || __HAL_DMA_GET_FLAG(&hdma_sdio, __HAL_DMA_GET_TE_FLAG_INDEX(&hdma_sdio)) != 0) { /* nada */ } + return true; +} - HAL_DMA_Abort_IT(&hdma_sdio); - HAL_DMA_DeInit(&hdma_sdio); +bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) { + uint32_t timeout = HAL_GetTick() + SD_TIMEOUT; - timeout = millis() + 500; - while (HAL_SD_GetCardState(&hsd) != HAL_SD_CARD_TRANSFER) if (ELAPSED(millis(), timeout)) return false; + while (HAL_SD_GetCardState(&hsd) != HAL_SD_CARD_TRANSFER) + if (HAL_GetTick() >= timeout) return false; - return true; -} + waitingTxCplt = 1; + if (HAL_SD_WriteBlocks_DMA(&hsd, (uint8_t *)src, block, 1) != HAL_OK) + return false; -bool SDIO_ReadBlock(uint32_t block, uint8_t *dst) { - uint8_t retries = SDIO_READ_RETRIES; - while (retries--) if (SDIO_ReadWriteBlock_DMA(block, nullptr, dst)) return true; - return false; -} + timeout = HAL_GetTick() + SD_TIMEOUT; + while (waitingTxCplt) + if (HAL_GetTick() >= timeout) return false; -bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) { - uint8_t retries = SDIO_READ_RETRIES; - while (retries--) if (SDIO_ReadWriteBlock_DMA(block, src, nullptr)) return true; - return false; + return true; } bool SDIO_IsReady() { @@ -305,16 +263,5 @@ uint32_t SDIO_GetCardSize() { return (uint32_t)(hsd.SdCard.BlockNbr) * (hsd.SdCard.BlockSize); } -#if defined(STM32F1xx) - #define DMA_IRQ_HANDLER DMA2_Channel4_5_IRQHandler -#elif defined(STM32F4xx) - #define DMA_IRQ_HANDLER DMA2_Stream3_IRQHandler -#else - #error "Unknown STM32 architecture." -#endif - -extern "C" void SDIO_IRQHandler(void) { HAL_SD_IRQHandler(&hsd); } -extern "C" void DMA_IRQ_HANDLER(void) { HAL_DMA_IRQHandler(&hdma_sdio); } - #endif // SDIO_SUPPORT #endif // HAL_STM32 diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index beda61567534..ef750056d6fc 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -429,6 +429,8 @@ #define BOARD_T41U5XBB 5002 // T41U5XBB Teensy 4.1 breakout board #define BOARD_NUCLEO_F767ZI 5003 // ST NUCLEO-F767ZI Dev Board #define BOARD_BTT_SKR_SE_BX 5004 // BigTreeTech SKR SE BX (STM32H743II) +#define BOARD_BTT_SKR_V3_0 5005 // BigTreeTech SKR V3.0 (STM32H743VG) +#define BOARD_BTT_SKR_V3_0_EZ 5006 // BigTreeTech SKR V3.0 EZ (STM32H743VG) // // Espressif ESP32 WiFi diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index e1849c509d2c..40b0c714c6dd 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -708,6 +708,10 @@ #include "stm32f7/pins_NUCLEO_F767ZI.h" // STM32F7 env:NUCLEO_F767ZI #elif MB(BTT_SKR_SE_BX) #include "stm32h7/pins_BTT_SKR_SE_BX.h" // STM32H7 env:BTT_SKR_SE_BX +#elif MB(BTT_SKR_V3_0) + #include "stm32h7/pins_BTT_SKR_V3_0.h" // STM32H7 env:STM32H743Vx_btt +#elif MB(BTT_SKR_V3_0_EZ) + #include "stm32h7/pins_BTT_SKR_V3_0_EZ.h" // STM32H7 env:STM32H743Vx_btt #elif MB(TEENSY41) #include "teensy4/pins_TEENSY41.h" // Teensy-4.x env:teensy41 #elif MB(T41U5XBB) diff --git a/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0.h b/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0.h new file mode 100644 index 000000000000..d83548608585 --- /dev/null +++ b/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0.h @@ -0,0 +1,26 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +#define BOARD_INFO_NAME "BTT SKR V3" + +#include "pins_BTT_SKR_V3_0_common.h" diff --git a/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_EZ.h b/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_EZ.h new file mode 100644 index 000000000000..003f20f5cf6e --- /dev/null +++ b/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_EZ.h @@ -0,0 +1,26 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +#define BOARD_INFO_NAME "BTT SKR V3 EZ" + +#include "pins_BTT_SKR_V3_0_common.h" diff --git a/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h b/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h new file mode 100644 index 000000000000..02e195a1852e --- /dev/null +++ b/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h @@ -0,0 +1,569 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +#if NOT_TARGET(STM32H7) + #error "Oops! Select an STM32H7 board in 'Tools > Board.'" +#endif + +// If you have the BigTreeTech driver expansion module, enable BTT_MOTOR_EXPANSION +// https://github.com/bigtreetech/BTT-Expansion-module/tree/master/BTT%20EXP-MOT +//#define BTT_MOTOR_EXPANSION + +#if BOTH(HAS_WIRED_LCD, BTT_MOTOR_EXPANSION) + #if EITHER(CR10_STOCKDISPLAY, ENDER2_STOCKDISPLAY) + #define EXP_MOT_USE_EXP2_ONLY 1 + #else + #error "You can't use both an LCD and a Motor Expansion Module on EXP1/EXP2 at the same time." + #endif +#endif + +#define USES_DIAG_JUMPERS + +// Onboard I2C EEPROM +#if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM) + #undef NO_EEPROM_SELECTED + #define I2C_EEPROM + #define SOFT_I2C_EEPROM // Force the use of Software I2C + #define I2C_SCL_PIN PA14 + #define I2C_SDA_PIN PA13 + #define MARLIN_EEPROM_SIZE 0x1000 // 4KB +#endif + +// +// Servos +// +#define SERVO0_PIN PE5 + +// +// Trinamic Stallguard pins +// +#define X_DIAG_PIN PC1 // X-STOP +#define Y_DIAG_PIN PC3 // Y-STOP +#define Z_DIAG_PIN PC0 // Z-STOP +#define E0_DIAG_PIN PC2 // E0DET +#define E1_DIAG_PIN PA0 // E1DET + +// +// Limit Switches +// +#ifdef X_STALL_SENSITIVITY + #define X_STOP_PIN X_DIAG_PIN + #if X_HOME_TO_MIN + #define X_MAX_PIN PC2 // E0DET + #else + #define X_MIN_PIN PC2 // E0DET + #endif +#elif ENABLED(X_DUAL_ENDSTOPS) + #ifndef X_MIN_PIN + #define X_MIN_PIN PC1 // X-STOP + #endif + #ifndef X_MAX_PIN + #define X_MAX_PIN PC2 // E0DET + #endif +#else + #define X_STOP_PIN PC1 // X-STOP +#endif + +#ifdef Y_STALL_SENSITIVITY + #define Y_STOP_PIN Y_DIAG_PIN + #if Y_HOME_TO_MIN + #define Y_MAX_PIN PA0 // E1DET + #else + #define Y_MIN_PIN PA0 // E1DET + #endif +#elif ENABLED(Y_DUAL_ENDSTOPS) + #ifndef Y_MIN_PIN + #define Y_MIN_PIN PC3 // Y-STOP + #endif + #ifndef Y_MAX_PIN + #define Y_MAX_PIN PA0 // E1DET + #endif +#else + #define Y_STOP_PIN PC3 // Y-STOP +#endif + +#ifdef Z_STALL_SENSITIVITY + #define Z_STOP_PIN Z_DIAG_PIN + #if Z_HOME_TO_MIN + #define Z_MAX_PIN PC15 // PWRDET + #else + #define Z_MIN_PIN PC15 // PWRDET + #endif +#elif ENABLED(Z_MULTI_ENDSTOPS) + #ifndef Z_MIN_PIN + #define Z_MIN_PIN PC0 // Z-STOP + #endif + #ifndef Z_MAX_PIN + #define Z_MAX_PIN PC15 // PWRDET + #endif +#else + #ifndef Z_STOP_PIN + #define Z_STOP_PIN PC0 // Z-STOP + #endif +#endif + +// +// Z Probe (when not Z_MIN_PIN) +// +#ifndef Z_MIN_PROBE_PIN + #define Z_MIN_PROBE_PIN PC13 +#endif + +// +// Probe enable +// +#if ENABLED(PROBE_ENABLE_DISABLE) + #ifndef PROBE_ENABLE_PIN + #define PROBE_ENABLE_PIN SERVO0_PIN + #endif +#endif + +// +// Filament Runout Sensor +// +#define FIL_RUNOUT_PIN PC2 // E0DET +#define FIL_RUNOUT2_PIN PA0 // E1DET + +// +// Power Supply Control +// +#ifndef PS_ON_PIN + #define PS_ON_PIN PE4 // PS-ON +#endif + +// +// Power Loss Detection +// +#ifndef POWER_LOSS_PIN + #define POWER_LOSS_PIN PC15 // PWRDET +#endif + +// +// Steppers +// +#define X_STEP_PIN PD4 +#define X_DIR_PIN PD3 +#define X_ENABLE_PIN PD6 +#ifndef X_CS_PIN + #define X_CS_PIN PD5 +#endif + +#define Y_STEP_PIN PA15 +#define Y_DIR_PIN PA8 +#define Y_ENABLE_PIN PD1 +#ifndef Y_CS_PIN + #define Y_CS_PIN PD0 +#endif + +#define Z_STEP_PIN PE2 +#define Z_DIR_PIN PE3 +#define Z_ENABLE_PIN PE0 +#ifndef Z_CS_PIN + #define Z_CS_PIN PE1 +#endif + +#ifndef E0_STEP_PIN + #define E0_STEP_PIN PD15 +#endif +#ifndef E0_DIR_PIN + #define E0_DIR_PIN PD14 +#endif +#ifndef E0_ENABLE_PIN + #define E0_ENABLE_PIN PC7 +#endif +#ifndef E0_CS_PIN + #define E0_CS_PIN PC6 +#endif + +#ifndef E1_STEP_PIN + #define E1_STEP_PIN PD11 +#endif +#ifndef E1_DIR_PIN + #define E1_DIR_PIN PD10 +#endif +#ifndef E1_ENABLE_PIN + #define E1_ENABLE_PIN PD13 +#endif +#ifndef E1_CS_PIN + #define E1_CS_PIN PD12 +#endif + +// +// Temperature Sensors +// +#ifndef TEMP_0_PIN + #define TEMP_0_PIN PA2 // TH0 +#endif +#ifndef TEMP_1_PIN + #define TEMP_1_PIN PA3 // TH1 +#endif +#ifndef TEMP_BED_PIN + #define TEMP_BED_PIN PA1 // TB +#endif + +#if HOTENDS == 1 && DISABLED(HEATERS_PARALLEL) + #if TEMP_SENSOR_PROBE + #define TEMP_PROBE_PIN TEMP_1_PIN + #elif TEMP_SENSOR_CHAMBER + #define TEMP_CHAMBER_PIN TEMP_1_PIN + #endif +#endif + +// +// Heaters / Fans +// +#ifndef HEATER_0_PIN + #define HEATER_0_PIN PB3 // Heater0 +#endif +#ifndef HEATER_1_PIN + #define HEATER_1_PIN PB4 // Heater1 +#endif +#ifndef HEATER_BED_PIN + #define HEATER_BED_PIN PD7 // Hotbed +#endif +#ifndef FAN_PIN + #define FAN_PIN PB7 // Fan0 +#endif + +#if HAS_CUTTER + #ifndef SPINDLE_LASER_PWM_PIN + #define SPINDLE_LASER_PWM_PIN PB5 + #endif + #ifndef SPINDLE_LASER_ENA_PIN + #define SPINDLE_LASER_ENA_PIN PB6 + #endif +#else + #ifndef FAN1_PIN + #define FAN1_PIN PB6 // Fan1 + #endif + #ifndef FAN2_PIN + #define FAN2_PIN PB5 // Fan2 + #endif +#endif // SPINDLE_FEATURE || LASER_FEATURE + +// +// Software SPI pins for TMC2130 stepper drivers +// +#if ENABLED(TMC_USE_SW_SPI) + #ifndef TMC_SW_MOSI + #define TMC_SW_MOSI PE13 + #endif + #ifndef TMC_SW_MISO + #define TMC_SW_MISO PE15 + #endif + #ifndef TMC_SW_SCK + #define TMC_SW_SCK PE14 + #endif +#endif + +#if HAS_TMC_UART + /** + * TMC2208/TMC2209 stepper drivers + * + * Hardware serial communication ports. + * If undefined software serial is used according to the pins below + */ + //#define X_HARDWARE_SERIAL Serial1 + //#define X2_HARDWARE_SERIAL Serial1 + //#define Y_HARDWARE_SERIAL Serial1 + //#define Y2_HARDWARE_SERIAL Serial1 + //#define Z_HARDWARE_SERIAL Serial1 + //#define Z2_HARDWARE_SERIAL Serial1 + //#define E0_HARDWARE_SERIAL Serial1 + //#define E1_HARDWARE_SERIAL Serial1 + //#define E2_HARDWARE_SERIAL Serial1 + //#define E3_HARDWARE_SERIAL Serial1 + //#define E4_HARDWARE_SERIAL Serial1 + + // + // Software serial + // + #define X_SERIAL_TX_PIN PD5 + #define X_SERIAL_RX_PIN X_SERIAL_TX_PIN + + #define Y_SERIAL_TX_PIN PD0 + #define Y_SERIAL_RX_PIN Y_SERIAL_TX_PIN + + #define Z_SERIAL_TX_PIN PE1 + #define Z_SERIAL_RX_PIN Z_SERIAL_TX_PIN + + #define E0_SERIAL_TX_PIN PC6 + #define E0_SERIAL_RX_PIN E0_SERIAL_TX_PIN + + #define E1_SERIAL_TX_PIN PD12 + #define E1_SERIAL_RX_PIN E1_SERIAL_TX_PIN + + // Reduce baud rate to improve software serial reliability + #define TMC_BAUD_RATE 19200 +#endif + +// +// SD Connection +// +#ifndef SDCARD_CONNECTION + #define SDCARD_CONNECTION ONBOARD +#endif + +/** + * ------ ------ + * (BEEPER) PC5 |10 9 | PB0 (BTN_ENC) (MISO) PA6 |10 9 | PA5 (SCK) + * (LCD_EN) PB1 | 8 7 | PE8 (LCD_RS) (BTN_EN1) PE7 | 8 7 | PA4 (SD_SS) + * (LCD_D4) PE9 | 6 5 PE10 (LCD_D5) (BTN_EN2) PB2 | 6 5 PA7 (MOSI) + * (LCD_D6) PE11 | 4 3 | PE12 (LCD_D7) (SD_DETECT) PC4 | 4 3 | RESET + * GND | 2 1 | 5V GND | 2 1 | -- + * ------ ------ + * EXP1 EXP2 + */ +#define EXP1_03_PIN PE12 +#define EXP1_04_PIN PE11 +#define EXP1_05_PIN PE10 +#define EXP1_06_PIN PE9 +#define EXP1_07_PIN PE8 +#define EXP1_08_PIN PB1 +#define EXP1_09_PIN PB0 +#define EXP1_10_PIN PC5 + +#define EXP2_03_PIN -1 +#define EXP2_04_PIN PC4 +#define EXP2_05_PIN PA7 +#define EXP2_06_PIN PB2 +#define EXP2_07_PIN PA4 +#define EXP2_08_PIN PE7 +#define EXP2_09_PIN PA5 +#define EXP2_10_PIN PA6 + +// +// Onboard SD card +// Must use soft SPI because Marlin's default hardware SPI is tied to LCD's EXP2 +// +#if SD_CONNECTION_IS(LCD) + #define SDSS EXP2_07_PIN + #define SD_SS_PIN SDSS + #define SD_SCK_PIN EXP2_09_PIN + #define SD_MISO_PIN EXP2_10_PIN + #define SD_MOSI_PIN EXP2_05_PIN + #define SD_DETECT_PIN EXP2_04_PIN +#elif SD_CONNECTION_IS(ONBOARD) + #define SDIO_SUPPORT + #define SDIO_CLOCK 24000000 // 24MHz +#elif SD_CONNECTION_IS(CUSTOM_CABLE) + #error "No custom SD drive cable defined for this board." +#endif + +#if ENABLED(BTT_MOTOR_EXPANSION) + /** ----- ----- + * -- | . . | GND -- | . . | GND + * -- | . . | M1EN M2EN | . . | M3EN + * M1STP | . . M1DIR M1RX | . . M1DIAG + * M2DIR | . . | M2STP M2RX | . . | M2DIAG + * M3DIR | . . | M3STP M3RX | . . | M3DIAG + * ----- ----- + * EXP2 EXP1 + * + * NB In EXP_MOT_USE_EXP2_ONLY mode EXP1 is not used and M2EN and M3EN need to be jumpered to M1EN + */ + + // M1 on Driver Expansion Module + #define E2_STEP_PIN EXP2_05_PIN + #define E2_DIR_PIN EXP2_06_PIN + #define E2_ENABLE_PIN EXP2_04_PIN + #if !EXP_MOT_USE_EXP2_ONLY + #define E2_DIAG_PIN EXP1_06_PIN + #define E2_CS_PIN EXP1_05_PIN + #if HAS_TMC_UART + #define E2_SERIAL_TX_PIN EXP1_05_PIN + #define E2_SERIAL_RX_PIN EXP1_05_PIN + #endif + #endif + + // M2 on Driver Expansion Module + #define E3_STEP_PIN EXP2_08_PIN + #define E3_DIR_PIN EXP2_07_PIN + #if !EXP_MOT_USE_EXP2_ONLY + #define E3_ENABLE_PIN EXP1_03_PIN + #define E3_DIAG_PIN EXP1_08_PIN + #define E3_CS_PIN EXP1_07_PIN + #if HAS_TMC_UART + #define E3_SERIAL_TX_PIN EXP1_07_PIN + #define E3_SERIAL_RX_PIN EXP1_07_PIN + #endif + #else + #define E3_ENABLE_PIN EXP2_04_PIN + #endif + + // M3 on Driver Expansion Module + #define E4_STEP_PIN EXP2_10_PIN + #define E4_DIR_PIN EXP2_09_PIN + #if !EXP_MOT_USE_EXP2_ONLY + #define E4_ENABLE_PIN EXP1_04_PIN + #define E4_DIAG_PIN EXP1_10_PIN + #define E4_CS_PIN EXP1_09_PIN + #if HAS_TMC_UART + #define E4_SERIAL_TX_PIN EXP1_09_PIN + #define E4_SERIAL_RX_PIN EXP1_09_PIN + #endif + #else + #define E4_ENABLE_PIN EXP2_04_PIN + #endif + +#endif // BTT_MOTOR_EXPANSION + +// +// LCDs and Controllers +// +#if IS_TFTGLCD_PANEL + + #if ENABLED(TFTGLCD_PANEL_SPI) + #define TFTGLCD_CS EXP2_08_PIN + #endif + +#elif HAS_WIRED_LCD + + #define BEEPER_PIN EXP1_10_PIN + #define BTN_ENC EXP1_09_PIN + + #if ENABLED(CR10_STOCKDISPLAY) + + #define LCD_PINS_RS EXP1_04_PIN + + #define BTN_EN1 EXP1_08_PIN + #define BTN_EN2 EXP1_06_PIN + + #define LCD_PINS_ENABLE EXP1_03_PIN + #define LCD_PINS_D4 EXP1_05_PIN + + #elif ENABLED(MKS_MINI_12864) + + #define DOGLCD_A0 EXP1_04_PIN + #define DOGLCD_CS EXP1_05_PIN + #define BTN_EN1 EXP2_08_PIN + #define BTN_EN2 EXP2_06_PIN + + #else + + #define LCD_PINS_RS EXP1_07_PIN + + #define BTN_EN1 EXP2_08_PIN + #define BTN_EN2 EXP2_06_PIN + + #define LCD_PINS_ENABLE EXP1_08_PIN + #define LCD_PINS_D4 EXP1_06_PIN + + #if ENABLED(FYSETC_MINI_12864) + #define DOGLCD_CS EXP1_08_PIN + #define DOGLCD_A0 EXP1_07_PIN + //#define LCD_BACKLIGHT_PIN -1 + #define LCD_RESET_PIN EXP1_06_PIN // Must be high or open for LCD to operate normally. + #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) + #ifndef RGB_LED_R_PIN + #define RGB_LED_R_PIN EXP1_05_PIN + #endif + #ifndef RGB_LED_G_PIN + #define RGB_LED_G_PIN EXP1_04_PIN + #endif + #ifndef RGB_LED_B_PIN + #define RGB_LED_B_PIN EXP1_03_PIN + #endif + #elif ENABLED(FYSETC_MINI_12864_2_1) + #define NEOPIXEL_PIN EXP1_05_PIN + #endif + #endif // !FYSETC_MINI_12864 + + #if IS_ULTIPANEL + #define LCD_PINS_D5 EXP1_05_PIN + #define LCD_PINS_D6 EXP1_04_PIN + #define LCD_PINS_D7 EXP1_03_PIN + + #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) + #define BTN_ENC_EN LCD_PINS_D7 // Detect the presence of the encoder + #endif + + #endif + + #endif + +#endif // HAS_WIRED_LCD + +// Alter timing for graphical display +#if IS_U8GLIB_ST7920 + #ifndef BOARD_ST7920_DELAY_1 + #define BOARD_ST7920_DELAY_1 120 + #endif + #ifndef BOARD_ST7920_DELAY_2 + #define BOARD_ST7920_DELAY_2 80 + #endif + #ifndef BOARD_ST7920_DELAY_3 + #define BOARD_ST7920_DELAY_3 580 + #endif +#endif + +#if HAS_SPI_TFT + // + // e.g., BTT_TFT35_SPI_V1_0 (480x320, 3.5", SPI Stock Display with Rotary Encoder in BIQU B1 SE) + // + #define TFT_CS_PIN EXP2_07_PIN + #define TFT_A0_PIN EXP2_04_PIN + #define TFT_SCK_PIN EXP2_09_PIN + #define TFT_MISO_PIN EXP2_10_PIN + #define TFT_MOSI_PIN EXP2_05_PIN + + #define TOUCH_INT_PIN EXP1_04_PIN + #define TOUCH_MISO_PIN EXP1_05_PIN + #define TOUCH_MOSI_PIN EXP1_08_PIN + #define TOUCH_SCK_PIN EXP1_06_PIN + #define TOUCH_CS_PIN EXP1_07_PIN + + #define BTN_EN1 EXP2_08_PIN + #define BTN_EN2 EXP2_06_PIN + #define BTN_ENC EXP1_09_PIN +#endif + +// +// NeoPixel LED +// +#ifndef NEOPIXEL_PIN + #define NEOPIXEL_PIN PE6 +#endif + +// +// WIFI +// + +/** + * ------- + * GND | 9 | | 8 | 3.3V + * (ESP-CS) PB12 | 10 | | 7 | PB15 (ESP-MOSI) + * 3.3V | 11 | | 6 | PB14 (ESP-MISO) + * (ESP-IO0) PB10 | 12 | | 5 | PB13 (ESP-CLK) + * (ESP-IO4) PB11 | 13 | | 4 | -- + * -- | 14 | | 3 | 3.3V (ESP-EN) + * (ESP-RX) PD8 | 15 | | 2 | -- + * (ESP-TX) PD9 | 16 | | 1 | PC14 (ESP-RST) + * ------- + * WIFI + */ +#define ESP_WIFI_MODULE_COM 3 // Must also set either SERIAL_PORT or SERIAL_PORT_2 to this +#define ESP_WIFI_MODULE_BAUDRATE BAUDRATE // Must use same BAUDRATE as SERIAL_PORT & SERIAL_PORT_2 +#define ESP_WIFI_MODULE_RESET_PIN PC14 +#define ESP_WIFI_MODULE_GPIO0_PIN PB10 +#define ESP_WIFI_MODULE_GPIO4_PIN PB11 diff --git a/buildroot/share/PlatformIO/boards/marlin_STM32H743Vx.json b/buildroot/share/PlatformIO/boards/marlin_STM32H743Vx.json new file mode 100644 index 000000000000..3b8fa73060b7 --- /dev/null +++ b/buildroot/share/PlatformIO/boards/marlin_STM32H743Vx.json @@ -0,0 +1,61 @@ +{ + "build": { + "core": "stm32", + "cpu": "cortex-m7", + "extra_flags": "-DSTM32H7xx -DSTM32H743xx", + "f_cpu": "400000000L", + "mcu": "stm32h743vit6", + "product_line": "STM32H743xx", + "variant": "MARLIN_H743Vx" + }, + "connectivity": [ + "can", + "ethernet" + ], + "debug": { + "jlink_device": "STM32H743VI", + "openocd_target": "stm32h7x", + "svd_path": "STM32H7x3.svd", + "tools": { + "stlink": { + "server": { + "arguments": [ + "-f", + "scripts/interface/stlink.cfg", + "-c", + "transport select hla_swd", + "-f", + "scripts/target/stm32h7x.cfg", + "-c", + "reset_config none" + ], + "executable": "bin/openocd", + "package": "tool-openocd" + } + } + } + }, + "frameworks": [ + "arduino", + "stm32cube" + ], + "name": "STM32H743VI (1024k RAM. 2048k Flash)", + "upload": { + "disable_flushing": false, + "maximum_ram_size": 1048576, + "maximum_size": 2097152, + "protocol": "stlink", + "protocols": [ + "stlink", + "dfu", + "jlink", + "cmsis-dap" + ], + "offset_address": "0x8020000", + "require_upload_port": true, + "use_1200bps_touch": false, + "wait_for_upload_port": false + }, + "url": "https://www.st.com/en/microcontrollers-microprocessors/stm32h743vi.html", + "vendor": "ST" +} diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H743Vx/PeripheralPins.c b/buildroot/share/PlatformIO/variants/MARLIN_H743Vx/PeripheralPins.c new file mode 100644 index 000000000000..49c4cbb87aa9 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_H743Vx/PeripheralPins.c @@ -0,0 +1,539 @@ +/* + ******************************************************************************* + * Copyright (c) 2020-2021, STMicroelectronics + * All rights reserved. + * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ******************************************************************************* + */ +/* + * Automatically generated from STM32H742V(G-I)Hx.xml, STM32H742V(G-I)Tx.xml + * STM32H743V(G-I)Hx.xml, STM32H743VGTx.xml + * STM32H743VITx.xml, STM32H750VBTx.xml + * STM32H753VIHx.xml, STM32H753VITx.xml + * CubeMX DB release 6.0.30 + */ +#if !defined(CUSTOM_PERIPHERAL_PINS) +#include "Arduino.h" +#include "PeripheralPins.h" + +/* ===== + * Notes: + * - The pins mentioned Px_y_ALTz are alternative possibilities which use other + * HW peripheral instances. You can use them the same way as any other "normal" + * pin (i.e. analogWrite(PA7_ALT1, 128);). + * + * - Commented lines are alternative possibilities which are not used per default. + * If you change them, you will have to know what you do + * ===== + */ + +//*** ADC *** + +#ifdef HAL_ADC_MODULE_ENABLED +WEAK const PinMap PinMap_ADC[] = { + {PA_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 16, 0)}, // ADC1_INP16 + {PA_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 17, 0)}, // ADC1_INP17 + {PA_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC1_INP14 + {PA_2_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC2_INP14 + {PA_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC1_INP15 + {PA_3_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC2_INP15 + {PA_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 18, 0)}, // ADC1_INP18 + {PA_4_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 18, 0)}, // ADC2_INP18 + {PA_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 19, 0)}, // ADC1_INP19 + {PA_5_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 19, 0)}, // ADC2_INP19 + {PA_6, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_INP3 + {PA_6_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC2_INP3 + {PA_7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC1_INP7 + {PA_7_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC2_INP7 + {PB_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_INP9 + {PB_0_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC2_INP9 + {PB_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC1_INP5 + {PB_1_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC2_INP5 + {PC_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_INP10 + {PC_0_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC2_INP10 + {PC_0_ALT2, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC3_INP10 + {PC_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC1_INP11 + {PC_1_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC2_INP11 + {PC_1_ALT2, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC3_INP11 + {PC_2_C, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC3_INP0 + {PC_3_C, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC3_INP1 + {PC_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_INP4 + {PC_4_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC2_INP4 + {PC_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_INP8 + {PC_5_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC2_INP8 + {NC, NP, 0} +}; +#endif + +//*** DAC *** + +#ifdef HAL_DAC_MODULE_ENABLED +WEAK const PinMap PinMap_DAC[] = { + {PA_4, DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // DAC1_OUT1 + {PA_5, DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // DAC1_OUT2 + {NC, NP, 0} +}; +#endif + +//*** I2C *** + +#ifdef HAL_I2C_MODULE_ENABLED +WEAK const PinMap PinMap_I2C_SDA[] = { + {PB_7, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_7_ALT1, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C4)}, + {PB_9, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_9_ALT1, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C4)}, + {PB_11, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + {PC_9, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, + {PD_13, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C4)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_I2C_MODULE_ENABLED +WEAK const PinMap PinMap_I2C_SCL[] = { + {PA_8, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, + {PB_6, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_6_ALT1, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C4)}, + {PB_8, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_8_ALT1, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C4)}, + {PB_10, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + {PD_12, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C4)}, + {NC, NP, 0} +}; +#endif + +//*** TIM *** + +#ifdef HAL_TIM_MODULE_ENABLED +WEAK const PinMap PinMap_TIM[] = { + {PA_0, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + {PA_0_ALT1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 1, 0)}, // TIM5_CH1 + {PA_1, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 + {PA_1_ALT1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)}, // TIM5_CH2 + {PA_1_ALT2, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 1, 1)}, // TIM15_CH1N + {PA_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 + {PA_2_ALT1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 3, 0)}, // TIM5_CH3 + {PA_2_ALT2, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 1, 0)}, // TIM15_CH1 + {PA_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 + {PA_3_ALT1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 4, 0)}, // TIM5_CH4 + {PA_3_ALT2, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 2, 0)}, // TIM15_CH2 + {PA_5, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + {PA_5_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 1)}, // TIM8_CH1N + {PA_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + {PA_6_ALT1, TIM13, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM13, 1, 0)}, // TIM13_CH1 + {PA_7, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N + {PA_7_ALT1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + {PA_7_ALT2, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 1)}, // TIM8_CH1N + {PA_7_ALT3, TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM14, 1, 0)}, // TIM14_CH1 + {PA_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1 + {PA_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2 + {PA_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3 + {PA_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4 + {PA_15, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + {PB_0, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + {PB_0_ALT1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 + {PB_0_ALT2, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)}, // TIM8_CH2N + {PB_1, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + {PB_1_ALT1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 + {PB_1_ALT2, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 1)}, // TIM8_CH3N + {PB_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 + {PB_4, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + {PB_5, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + {PB_6, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1 + {PB_6_ALT1, TIM16, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM16, 1, 1)}, // TIM16_CH1N + {PB_7, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2 + {PB_7_ALT1, TIM17, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM17, 1, 1)}, // TIM17_CH1N + {PB_8, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3 + {PB_8_ALT1, TIM16, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM16, 1, 0)}, // TIM16_CH1 + {PB_9, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4 + {PB_9_ALT1, TIM17, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM17, 1, 0)}, // TIM17_CH1 + {PB_10, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 + {PB_11, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 + {PB_13, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N + {PB_14, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + {PB_14_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)}, // TIM8_CH2N + {PB_14_ALT2, TIM12, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM12, 1, 0)}, // TIM12_CH1 + {PB_15, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + {PB_15_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 1)}, // TIM8_CH3N + {PB_15_ALT2, TIM12, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM12, 2, 0)}, // TIM12_CH2 + {PC_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + {PC_6_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 0)}, // TIM8_CH1 + {PC_7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + {PC_7_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 0)}, // TIM8_CH2 + {PC_8, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 + {PC_8_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 0)}, // TIM8_CH3 + {PC_9, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 + {PC_9_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 4, 0)}, // TIM8_CH4 + {PD_12, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1 + {PD_13, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2 + {PD_14, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3 + {PD_15, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4 + {PE_4, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 1, 1)}, // TIM15_CH1N + {PE_5, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 1, 0)}, // TIM15_CH1 + {PE_6, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 2, 0)}, // TIM15_CH2 + {PE_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N + {PE_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1 + {PE_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + {PE_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2 + {PE_12, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + {PE_13, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3 + {PE_14, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4 + {NC, NP, 0} +}; +#endif + +//*** UART *** + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_TX[] = { + {PA_0, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PA_2, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_9, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_LPUART)}, + {PA_9_ALT1, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PA_12, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_UART4)}, + {PA_15, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART7)}, + {PB_4, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART7)}, + {PB_6, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART)}, + {PB_6_ALT1, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_UART5)}, + {PB_6_ALT2, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PB_9, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PB_10, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PB_13, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_UART5)}, + {PB_14, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART1)}, + {PC_6, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)}, + {PC_10, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PC_10_ALT1, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PC_12, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)}, + {PD_1, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PD_5, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PD_8, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PE_1, UART8, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART8)}, + {PE_8, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_RX[] = { + {PA_1, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PA_3, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_8, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART7)}, + {PA_10, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_LPUART)}, + {PA_10_ALT1, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PA_11, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_UART4)}, + {PB_3, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART7)}, + {PB_5, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_UART5)}, + {PB_7, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART)}, + {PB_7_ALT1, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PB_8, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PB_11, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PB_12, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_UART5)}, + {PB_15, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART1)}, + {PC_7, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)}, + {PC_11, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PC_11_ALT1, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PD_0, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PD_2, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)}, + {PD_6, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PD_9, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PE_0, UART8, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART8)}, + {PE_7, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_RTS[] = { + {PA_1, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_12, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_LPUART)}, + {PA_12_ALT1, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PA_15, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PB_14, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PB_14_ALT1, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PC_8, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)}, + {PD_4, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PD_12, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PD_15, UART8, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART8)}, + {PE_9, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_CTS[] = { + {PA_0, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_11, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_LPUART)}, + {PA_11_ALT1, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PB_0, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PB_13, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PB_15, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PC_9, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)}, + {PD_3, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PD_11, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PD_14, UART8, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART8)}, + {PE_10, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)}, + {NC, NP, 0} +}; +#endif + +//*** SPI *** + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK const PinMap PinMap_SPI_MOSI[] = { + {PA_7, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PA_7_ALT1, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PB_2, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI3)}, + {PB_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_5_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI3)}, + {PB_5_ALT2, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PB_15, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_1, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_3_C, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_12, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PD_6, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI3)}, + {PD_7, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PE_6, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {PE_14, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK const PinMap PinMap_SPI_MISO[] = { + {PA_6, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PA_6_ALT1, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PB_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_4_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PB_4_ALT2, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PB_14, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_2_C, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_11, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PE_5, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {PE_13, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK const PinMap PinMap_SPI_SCLK[] = { + {PA_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PA_5_ALT1, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PA_9, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PA_12, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PB_3, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_3_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PB_3_ALT2, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PB_10, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PB_13, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_10, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PD_3, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PE_2, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {PE_12, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK const PinMap PinMap_SPI_SSEL[] = { + {PA_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PA_4_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PA_4_ALT2, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PA_11, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PA_15, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PA_15_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PA_15_ALT2, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI6)}, + {PB_4, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI2)}, + {PB_9, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PB_12, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PE_4, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {PE_11, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {NC, NP, 0} +}; +#endif + +//*** FDCAN *** + +#ifdef HAL_FDCAN_MODULE_ENABLED +WEAK const PinMap PinMap_CAN_RD[] = { + {PA_11, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {PB_5, FDCAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN2)}, + {PB_8, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {PB_12, FDCAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN2)}, + {PD_0, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_FDCAN_MODULE_ENABLED +WEAK const PinMap PinMap_CAN_TD[] = { + {PA_12, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {PB_6, FDCAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN2)}, + {PB_9, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {PB_13, FDCAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN2)}, + {PD_1, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {NC, NP, 0} +}; +#endif + +//*** ETHERNET *** + +#ifdef HAL_ETH_MODULE_ENABLED +WEAK const PinMap PinMap_Ethernet[] = { + {PA_0, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_CRS + {PA_1, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_REF_CLK + {PA_1_ALT1, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RX_CLK + {PA_2, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_MDIO + {PA_3, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_COL + {PA_7, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_CRS_DV + {PA_7_ALT1, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RX_DV + {PB_0, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD2 + {PB_1, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD3 + {PB_5, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_PPS_OUT + {PB_8, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD3 + {PB_10, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RX_ER + {PB_11, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TX_EN + {PB_12, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD0 + {PB_13, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD1 + {PC_1, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_MDC + {PC_2_C, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD2 + {PC_3_C, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TX_CLK + {PC_4, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD0 + {PC_5, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD1 + {PE_2, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD3 + {NC, NP, 0} +}; +#endif + +//*** QUADSPI *** + +#ifdef HAL_QSPI_MODULE_ENABLED +WEAK const PinMap PinMap_QUADSPI_DATA0[] = { + {PC_9, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QUADSPI)}, // QUADSPI_BK1_IO0 + {PD_11, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QUADSPI)}, // QUADSPI_BK1_IO0 + {PE_7, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_QUADSPI)}, // QUADSPI_BK2_IO0 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_QSPI_MODULE_ENABLED +WEAK const PinMap PinMap_QUADSPI_DATA1[] = { + {PC_10, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QUADSPI)}, // QUADSPI_BK1_IO1 + {PD_12, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QUADSPI)}, // QUADSPI_BK1_IO1 + {PE_8, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_QUADSPI)}, // QUADSPI_BK2_IO1 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_QSPI_MODULE_ENABLED +WEAK const PinMap PinMap_QUADSPI_DATA2[] = { + {PE_2, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QUADSPI)}, // QUADSPI_BK1_IO2 + {PE_9, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_QUADSPI)}, // QUADSPI_BK2_IO2 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_QSPI_MODULE_ENABLED +WEAK const PinMap PinMap_QUADSPI_DATA3[] = { + {PA_1, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QUADSPI)}, // QUADSPI_BK1_IO3 + {PD_13, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QUADSPI)}, // QUADSPI_BK1_IO3 + {PE_10, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_QUADSPI)}, // QUADSPI_BK2_IO3 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_QSPI_MODULE_ENABLED +WEAK const PinMap PinMap_QUADSPI_SCLK[] = { + {PB_2, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QUADSPI)}, // QUADSPI_CLK + {NC, NP, 0} +}; +#endif + +#ifdef HAL_QSPI_MODULE_ENABLED +WEAK const PinMap PinMap_QUADSPI_SSEL[] = { + {PB_6, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_QUADSPI)}, // QUADSPI_BK1_NCS + {PB_10, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QUADSPI)}, // QUADSPI_BK1_NCS + {PC_11, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QUADSPI)}, // QUADSPI_BK2_NCS + {NC, NP, 0} +}; +#endif + +//*** USB *** + +#if defined(HAL_PCD_MODULE_ENABLED) || defined(HAL_HCD_MODULE_ENABLED) +WEAK const PinMap PinMap_USB_OTG_FS[] = { + {PA_8, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_FS)}, // USB_OTG_FS_SOF + {PA_9, USB_OTG_FS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, GPIO_AF_NONE)}, // USB_OTG_FS_VBUS + {PA_10, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF10_OTG1_FS)}, // USB_OTG_FS_ID + {PA_11, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_FS)}, // USB_OTG_FS_DM + {PA_12, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_FS)}, // USB_OTG_FS_DP + {NC, NP, 0} +}; +#endif + +#if defined(HAL_PCD_MODULE_ENABLED) || defined(HAL_HCD_MODULE_ENABLED) +WEAK const PinMap PinMap_USB_OTG_HS[] = { +#ifdef USE_USB_HS_IN_FS + // {PA_4, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_OTG2_FS)}, // USB_OTG_HS_SOF + // {PB_12, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF12_OTG2_FS)}, // USB_OTG_HS_ID + // {PB_13, USB_OTG_HS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, GPIO_AF_NONE)}, // USB_OTG_HS_VBUS + {PB_14, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_OTG2_FS)}, // USB_OTG_HS_DM + {PB_15, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_OTG2_FS)}, // USB_OTG_HS_DP +#else + {PA_3, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG2_HS)}, // USB_OTG_HS_ULPI_D0 + {PA_5, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG2_HS)}, // USB_OTG_HS_ULPI_CK + {PB_0, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG2_HS)}, // USB_OTG_HS_ULPI_D1 + {PB_1, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG2_HS)}, // USB_OTG_HS_ULPI_D2 + {PB_5, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG2_HS)}, // USB_OTG_HS_ULPI_D7 + {PB_10, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG2_HS)}, // USB_OTG_HS_ULPI_D3 + {PB_11, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG2_HS)}, // USB_OTG_HS_ULPI_D4 + {PB_12, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG2_HS)}, // USB_OTG_HS_ULPI_D5 + {PB_13, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG2_HS)}, // USB_OTG_HS_ULPI_D6 + {PC_0, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG2_HS)}, // USB_OTG_HS_ULPI_STP + {PC_2_C, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG2_HS)}, // USB_OTG_HS_ULPI_DIR + {PC_3_C, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG2_HS)}, // USB_OTG_HS_ULPI_NXT +#endif /* USE_USB_HS_IN_FS */ + {NC, NP, 0} +}; +#endif + +//*** SD *** + +#ifdef HAL_SD_MODULE_ENABLED +WEAK const PinMap PinMap_SD[] = { + {PA_0, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_SDIO2)}, // SDMMC2_CMD + {PB_3, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_SDIO2)}, // SDMMC2_D2 + {PB_4, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_SDIO2)}, // SDMMC2_D3 + {PB_8, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF7_SDIO1)}, // SDMMC1_CKIN + {PB_8_ALT1, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO1)}, // SDMMC1_D4 + {PB_8_ALT2, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDIO2)}, // SDMMC2_D4 + {PB_9, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF7_SDIO1)}, // SDMMC1_CDIR + {PB_9_ALT1, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO1)}, // SDMMC1_D5 + {PB_9_ALT2, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDIO2)}, // SDMMC2_D5 + {PB_14, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_SDIO2)}, // SDMMC2_D0 + {PB_15, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_SDIO2)}, // SDMMC2_D1 + {PC_1, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_SDIO2)}, // SDMMC2_CK + {PC_6, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF8_SDIO1)}, // SDMMC1_D0DIR + {PC_6_ALT1, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO1)}, // SDMMC1_D6 + {PC_6_ALT2, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDIO2)}, // SDMMC2_D6 + {PC_7, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF8_SDIO1)}, // SDMMC1_D123DIR + {PC_7_ALT1, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO1)}, // SDMMC1_D7 + {PC_7_ALT2, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDIO2)}, // SDMMC2_D7 + {PC_8, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO1)}, // SDMMC1_D0 + {PC_9, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO1)}, // SDMMC1_D1 + {PC_10, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO1)}, // SDMMC1_D2 + {PC_11, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO1)}, // SDMMC1_D3 + {PC_12, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDIO1)}, // SDMMC1_CK + {PD_2, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDIO1)}, // SDMMC1_CMD + {PD_6, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF11_SDIO2)}, // SDMMC2_CK + {PD_7, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF11_SDIO2)}, // SDMMC2_CMD + {NC, NP, 0} +}; +#endif + +#endif /* !CUSTOM_PERIPHERAL_PINS */ diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H743Vx/PinNamesVar.h b/buildroot/share/PlatformIO/variants/MARLIN_H743Vx/PinNamesVar.h new file mode 100644 index 000000000000..2128732a400c --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_H743Vx/PinNamesVar.h @@ -0,0 +1,112 @@ +/* Dual pad pin name */ +PC_2_C = PC_2 | PDUAL, +PC_3_C = PC_3 | PDUAL, + +/* Alternate pin name */ +PA_0_ALT1 = PA_0 | ALT1, +PA_1_ALT1 = PA_1 | ALT1, +PA_1_ALT2 = PA_1 | ALT2, +PA_2_ALT1 = PA_2 | ALT1, +PA_2_ALT2 = PA_2 | ALT2, +PA_3_ALT1 = PA_3 | ALT1, +PA_3_ALT2 = PA_3 | ALT2, +PA_4_ALT1 = PA_4 | ALT1, +PA_4_ALT2 = PA_4 | ALT2, +PA_5_ALT1 = PA_5 | ALT1, +PA_6_ALT1 = PA_6 | ALT1, +PA_7_ALT1 = PA_7 | ALT1, +PA_7_ALT2 = PA_7 | ALT2, +PA_7_ALT3 = PA_7 | ALT3, +PA_9_ALT1 = PA_9 | ALT1, +PA_10_ALT1 = PA_10 | ALT1, +PA_11_ALT1 = PA_11 | ALT1, +PA_12_ALT1 = PA_12 | ALT1, +PA_15_ALT1 = PA_15 | ALT1, +PA_15_ALT2 = PA_15 | ALT2, +PB_0_ALT1 = PB_0 | ALT1, +PB_0_ALT2 = PB_0 | ALT2, +PB_1_ALT1 = PB_1 | ALT1, +PB_1_ALT2 = PB_1 | ALT2, +PB_3_ALT1 = PB_3 | ALT1, +PB_3_ALT2 = PB_3 | ALT2, +PB_4_ALT1 = PB_4 | ALT1, +PB_4_ALT2 = PB_4 | ALT2, +PB_5_ALT1 = PB_5 | ALT1, +PB_5_ALT2 = PB_5 | ALT2, +PB_6_ALT1 = PB_6 | ALT1, +PB_6_ALT2 = PB_6 | ALT2, +PB_7_ALT1 = PB_7 | ALT1, +PB_8_ALT1 = PB_8 | ALT1, +PB_8_ALT2 = PB_8 | ALT2, +PB_9_ALT1 = PB_9 | ALT1, +PB_9_ALT2 = PB_9 | ALT2, +PB_14_ALT1 = PB_14 | ALT1, +PB_14_ALT2 = PB_14 | ALT2, +PB_15_ALT1 = PB_15 | ALT1, +PB_15_ALT2 = PB_15 | ALT2, +PC_0_ALT1 = PC_0 | ALT1, +PC_0_ALT2 = PC_0 | ALT2, +PC_1_ALT1 = PC_1 | ALT1, +PC_1_ALT2 = PC_1 | ALT2, +PC_4_ALT1 = PC_4 | ALT1, +PC_5_ALT1 = PC_5 | ALT1, +PC_6_ALT1 = PC_6 | ALT1, +PC_6_ALT2 = PC_6 | ALT2, +PC_7_ALT1 = PC_7 | ALT1, +PC_7_ALT2 = PC_7 | ALT2, +PC_8_ALT1 = PC_8 | ALT1, +PC_9_ALT1 = PC_9 | ALT1, +PC_10_ALT1 = PC_10 | ALT1, +PC_11_ALT1 = PC_11 | ALT1, + +/* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, /* SYS_WKUP0 */ +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = PA_2, /* SYS_WKUP1 */ +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = PC_13, /* SYS_WKUP2 */ +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = NC, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = PC_1, /* SYS_WKUP5 */ +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif + +/* USB */ +#ifdef USBCON + USB_OTG_FS_DM = PA_11, + USB_OTG_FS_DP = PA_12, + USB_OTG_FS_ID = PA_10, + USB_OTG_FS_SOF = PA_8, + USB_OTG_FS_VBUS = PA_9, + USB_OTG_HS_DM = PB_14, + USB_OTG_HS_DP = PB_15, + USB_OTG_HS_ID = PB_12, + USB_OTG_HS_SOF = PA_4, + USB_OTG_HS_ULPI_CK = PA_5, + USB_OTG_HS_ULPI_D0 = PA_3, + USB_OTG_HS_ULPI_D1 = PB_0, + USB_OTG_HS_ULPI_D2 = PB_1, + USB_OTG_HS_ULPI_D3 = PB_10, + USB_OTG_HS_ULPI_D4 = PB_11, + USB_OTG_HS_ULPI_D5 = PB_12, + USB_OTG_HS_ULPI_D6 = PB_13, + USB_OTG_HS_ULPI_D7 = PB_5, + USB_OTG_HS_ULPI_DIR = PC_2_C, + USB_OTG_HS_ULPI_NXT = PC_3_C, + USB_OTG_HS_ULPI_STP = PC_0, + USB_OTG_HS_VBUS = PB_13, +#endif diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H743Vx/ldscript.ld b/buildroot/share/PlatformIO/variants/MARLIN_H743Vx/ldscript.ld new file mode 100644 index 000000000000..7d248a268283 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_H743Vx/ldscript.ld @@ -0,0 +1,208 @@ +/* +****************************************************************************** +** +** File : LinkerScript.ld +** +** Author : Auto-generated by STM32CubeIDE +** +** Abstract : Linker script for STM32H743VI Device from STM32H7 series +** 2048Kbytes FLASH +** 128Kbytes DTCMRAM +** 64Kbytes ITCMRAM +** 512Kbytes RAM_D1 +** 288Kbytes RAM_D2 +** 64Kbytes RAM_D3 +** +** Set heap size, stack size and stack location according +** to application requirements. +** +** Set memory bank area and size if external memory is used. +** +** Target : STMicroelectronics STM32 +** +** Distribution: The file is distributed as is without any warranty +** of any kind. +** +***************************************************************************** +** @attention +** +**

© COPYRIGHT(c) 2019 STMicroelectronics

+** +** Redistribution and use in source and binary forms, with or without modification, +** are permitted provided that the following conditions are met: +** 1. Redistributions of source code must retain the above copyright notice, +** this list of conditions and the following disclaimer. +** 2. Redistributions in binary form must reproduce the above copyright notice, +** this list of conditions and the following disclaimer in the documentation +** and/or other materials provided with the distribution. +** 3. Neither the name of STMicroelectronics nor the names of its contributors +** may be used to endorse or promote products derived from this software +** without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +** +***************************************************************************** +*/ + +/* Entry Point */ +ENTRY(Reset_Handler) + +/* Highest address of the user mode stack */ +_estack = 0x24080000; /* end of "RAM_D1" Ram type memory */ + +_Min_Heap_Size = 0x200; /* required amount of heap */ +_Min_Stack_Size = 0x400; /* required amount of stack */ + +/* Memories definition */ +MEMORY +{ + DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K + ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K + RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 512K + RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 288K + RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 64K + FLASH (rx) : ORIGIN = 0x8000000 + LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET +} + +/* Sections */ +SECTIONS +{ + /* The startup code into "FLASH" Rom type memory */ + .isr_vector : + { + . = ALIGN(4); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(4); + } >FLASH + + /* The program code and other data into "FLASH" Rom type memory */ + .text : + { + . = ALIGN(4); + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + *(.eh_frame) + + KEEP (*(.init)) + KEEP (*(.fini)) + + . = ALIGN(4); + _etext = .; /* define a global symbols at end of code */ + } >FLASH + + /* Constant data into "FLASH" Rom type memory */ + .rodata : + { + . = ALIGN(4); + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + . = ALIGN(4); + } >FLASH + + .ARM.extab : { + . = ALIGN(4); + *(.ARM.extab* .gnu.linkonce.armextab.*) + . = ALIGN(4); + } >FLASH + + .ARM : { + . = ALIGN(4); + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + . = ALIGN(4); + } >FLASH + + .preinit_array : + { + . = ALIGN(4); + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + . = ALIGN(4); + } >FLASH + + .init_array : + { + . = ALIGN(4); + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + . = ALIGN(4); + } >FLASH + + .fini_array : + { + . = ALIGN(4); + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array*)) + PROVIDE_HIDDEN (__fini_array_end = .); + . = ALIGN(4); + } >FLASH + + /* Used by the startup to initialize data */ + _sidata = LOADADDR(.data); + + /* Initialized data sections into "RAM_D1" Ram type memory */ + .data : + { + . = ALIGN(4); + _sdata = .; /* create a global symbol at data start */ + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + + . = ALIGN(4); + _edata = .; /* define a global symbol at data end */ + + } >RAM_D1 AT> FLASH + + /* Uninitialized data section into "RAM_D1" Ram type memory */ + . = ALIGN(4); + .bss : + { + /* This is used by the startup in order to initialize the .bss section */ + _sbss = .; /* define a global symbol at bss start */ + __bss_start__ = _sbss; + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ebss = .; /* define a global symbol at bss end */ + __bss_end__ = _ebss; + } >RAM_D1 + + /* User_heap_stack section, used to check that there is enough "RAM_D1" Ram type memory left */ + ._user_heap_stack : + { + . = ALIGN(8); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(8); + } >RAM_D1 + + /* Remove information from the compiler libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } +} diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H743Vx/variant_MARLIN_STM32H743Vx.cpp b/buildroot/share/PlatformIO/variants/MARLIN_H743Vx/variant_MARLIN_STM32H743Vx.cpp new file mode 100644 index 000000000000..7813f8860e58 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_H743Vx/variant_MARLIN_STM32H743Vx.cpp @@ -0,0 +1,245 @@ +/* + ******************************************************************************* + * Copyright (c) 2020-2021, STMicroelectronics + * All rights reserved. + * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ******************************************************************************* + */ +#if defined(STM32H743xx) +#include "pins_arduino.h" + +// Digital PinName array +const PinName digitalPin[] = { + PA_0, // D0/A0 + PA_1, // D1/A1 + PA_2, // D2/A2 + PA_3, // D3/A3 + PA_4, // D4/A4 + PA_5, // D5/A5 + PA_6, // D6/A6 + PA_7, // D7/A7 + PA_8, // D8 + PA_9, // D9 + PA_10, // D10 + PA_11, // D11 + PA_12, // D12 + PA_13, // D13 + PA_14, // D14 + PA_15, // D15 + PB_0, // D16/A8 + PB_1, // D17/A9 + PB_2, // D18 + PB_3, // D19 + PB_4, // D20 + PB_5, // D21 + PB_6, // D22 + PB_7, // D23 + PB_8, // D24 + PB_9, // D25 + PB_10, // D26 + PB_11, // D27 + PB_12, // D28 + PB_13, // D29 + PB_14, // D30 + PB_15, // D31 + PC_0, // D32/A10 + PC_1, // D33/A11 + PC_4, // D34/A12 + PC_5, // D35/A13 + PC_6, // D36 + PC_7, // D37 + PC_8, // D38 + PC_9, // D39 + PC_10, // D40 + PC_11, // D41 + PC_12, // D42 + PC_13, // D43 + PC_14, // D44 + PC_15, // D45 + PD_0, // D46 + PD_1, // D47 + PD_2, // D48 + PD_3, // D49 + PD_4, // D50 + PD_5, // D51 + PD_6, // D52 + PD_7, // D53 + PD_8, // D54 + PD_9, // D55 + PD_10, // D56 + PD_11, // D57 + PD_12, // D58 + PD_13, // D59 + PD_14, // D60 + PD_15, // D61 + PE_0, // D62 + PE_1, // D63 + PE_2, // D64 + PE_3, // D65 + PE_4, // D66 + PE_5, // D67 + PE_6, // D68 + PE_7, // D69 + PE_8, // D70 + PE_9, // D71 + PE_10, // D72 + PE_11, // D73 + PE_12, // D74 + PE_13, // D75 + PE_14, // D76 + PE_15, // D77 + PH_0, // D78 + PH_1, // D79 + PC_2_C, // D80/A14 + PC_3_C // D81/A15 +}; + +// Analog (Ax) pin number array +const uint32_t analogInputPin[] = { + 0, // A0, PA0 + 1, // A1, PA1 + 2, // A2, PA2 + 3, // A3, PA3 + 4, // A4, PA4 + 5, // A5, PA5 + 6, // A6, PA6 + 7, // A7, PA7 + 16, // A8, PB0 + 17, // A9, PB1 + 32, // A10, PC0 + 33, // A11, PC1 + 34, // A12, PC4 + 35, // A13, PC5 + 80, // A14, PC2_C + 81 // A15, PC3_C +}; + +/* + * @brief System Clock Configuration + * @param None + * @retval None + */ +WEAK void SystemClock_Config(void) +{ + RCC_OscInitTypeDef RCC_OscInitStruct = {0}; + RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; + RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {}; + + /** Supply configuration update enable + */ + HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY); + /** Configure the main internal regulator output voltage + */ + __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE0); + + while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {} + /** Initializes the RCC Oscillators according to the specified parameters + * in the RCC_OscInitTypeDef structure. + */ + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; + RCC_OscInitStruct.HSEState = RCC_HSE_ON; + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; + RCC_OscInitStruct.PLL.PLLM = 5; // 25Mhz / 5 = 5Mhz + RCC_OscInitStruct.PLL.PLLN = 192; // 25Mhz / 5 * 192 = 960Mhz + RCC_OscInitStruct.PLL.PLLP = 2; // 960Mhz / 2 = 480Mhz + RCC_OscInitStruct.PLL.PLLQ = 20; // 960Mhz / 20 = 48Mhz for USB + RCC_OscInitStruct.PLL.PLLR = 20; // unused + RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_2; + RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOWIDE; + RCC_OscInitStruct.PLL.PLLFRACN = 0; + if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) + { + Error_Handler(); + } + /** Initializes the CPU, AHB and APB buses clocks + */ + RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK + |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2 + |RCC_CLOCKTYPE_D3PCLK1|RCC_CLOCKTYPE_D1PCLK1; + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; + RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1; + RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV2; + RCC_ClkInitStruct.APB3CLKDivider = RCC_APB3_DIV2; + RCC_ClkInitStruct.APB1CLKDivider = RCC_APB1_DIV2; + RCC_ClkInitStruct.APB2CLKDivider = RCC_APB2_DIV2; + RCC_ClkInitStruct.APB4CLKDivider = RCC_APB4_DIV2; + + if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4) != HAL_OK) + { + Error_Handler(); + } + + PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USB | RCC_PERIPHCLK_QSPI + | RCC_PERIPHCLK_SDMMC | RCC_PERIPHCLK_ADC + | RCC_PERIPHCLK_LPUART1 | RCC_PERIPHCLK_USART16 + | RCC_PERIPHCLK_USART234578 | RCC_PERIPHCLK_I2C123 + | RCC_PERIPHCLK_I2C4 | RCC_PERIPHCLK_SPI123 + | RCC_PERIPHCLK_SPI45 | RCC_PERIPHCLK_SPI6; + + /* PLL1 qclk used for USB 48 Mhz */ + /* PLL1 qclk also used for FMC, QUADSPI, SDMMC, RNG, SAI */ + /* PLL2 pclk is needed for adc max 80 Mhz (p,q,r same) */ + /* PLL2 pclk also used for LP timers 2,3,4,5, SPI 1,2,3 */ + /* PLL2 qclk is needed for uart, can, spi4,5,6 80 Mhz */ + /* PLL3 r clk is needed for i2c 80 Mhz (p,q,r same) */ + PeriphClkInitStruct.PLL2.PLL2M = 15; // M DIV 15 vco 25 / 15 ~ 1.667 Mhz + PeriphClkInitStruct.PLL2.PLL2N = 96; // N MUL 96 + PeriphClkInitStruct.PLL2.PLL2P = 2; // P div 2 + PeriphClkInitStruct.PLL2.PLL2Q = 2; // Q div 2 + PeriphClkInitStruct.PLL2.PLL2R = 2; // R div 2 + // RCC_PLL1VCIRANGE_0 Clock range frequency between 1 and 2 MHz + PeriphClkInitStruct.PLL2.PLL2RGE = RCC_PLL2VCIRANGE_0; + PeriphClkInitStruct.PLL2.PLL2VCOSEL = RCC_PLL2VCOMEDIUM; + PeriphClkInitStruct.PLL2.PLL2FRACN = 0; + PeriphClkInitStruct.PLL3.PLL3M = 15; // M DIV 15 vco 25 / 15 ~ 1.667 Mhz + PeriphClkInitStruct.PLL3.PLL3N = 96; // N MUL 96 + PeriphClkInitStruct.PLL3.PLL3P = 2; // P div 2 + PeriphClkInitStruct.PLL3.PLL3Q = 2; // Q div 2 + PeriphClkInitStruct.PLL3.PLL3R = 2; // R div 2 + // RCC_PLL1VCIRANGE_0 Clock range frequency between 1 and 2 MHz + PeriphClkInitStruct.PLL3.PLL3RGE = RCC_PLL3VCIRANGE_0; + PeriphClkInitStruct.PLL3.PLL3VCOSEL = RCC_PLL3VCOMEDIUM; + PeriphClkInitStruct.PLL3.PLL3FRACN = 0; + // ADC from PLL2 pclk + PeriphClkInitStruct.AdcClockSelection = RCC_ADCCLKSOURCE_PLL2; + // USB from PLL1 qclk + PeriphClkInitStruct.UsbClockSelection = RCC_USBCLKSOURCE_PLL; + // QSPI from PLL1 qclk + PeriphClkInitStruct.QspiClockSelection = RCC_QSPICLKSOURCE_PLL; + // SDMMC from PLL1 qclk + PeriphClkInitStruct.SdmmcClockSelection = 0; + //PeriphClkInitStruct.SdmmcClockSelection = RCC_SDMMCCLKSOURCE_PLL; + // LPUART from PLL2 qclk + PeriphClkInitStruct.Lpuart1ClockSelection = 0; + //PeriphClkInitStruct.Lpuart1ClockSelection = RCC_LPUART1CLKSOURCE_PLL2; + // USART from PLL2 qclk + PeriphClkInitStruct.Usart16ClockSelection = RCC_USART16CLKSOURCE_PLL2; + // USART from PLL2 qclk + PeriphClkInitStruct.Usart234578ClockSelection = 0; + //PeriphClkInitStruct.Usart234578ClockSelection = RCC_USART234578CLKSOURCE_PLL2; + // I2C123 from PLL3 rclk + PeriphClkInitStruct.I2c123ClockSelection = RCC_I2C123CLKSOURCE_PLL3; + // I2C4 from PLL3 rclk + PeriphClkInitStruct.I2c4ClockSelection = 0; + //PeriphClkInitStruct.I2c4ClockSelection = RCC_I2C4CLKSOURCE_PLL3; + // SPI123 from PLL2 pclk + PeriphClkInitStruct.Spi123ClockSelection = RCC_SPI123CLKSOURCE_PLL2; + // SPI45 from PLL2 qclk + PeriphClkInitStruct.Spi45ClockSelection = 0; + //PeriphClkInitStruct.Spi45ClockSelection = RCC_SPI45CLKSOURCE_PLL2; + // SPI6 from PLL2 qclk + PeriphClkInitStruct.Spi6ClockSelection = 0; + //PeriphClkInitStruct.Spi6ClockSelection = RCC_SPI6CLKSOURCE_PLL2; + + if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) { + Error_Handler(); + } +} + +#endif /* ARDUINO_GENERIC_* */ diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H743Vx/variant_MARLIN_STM32H743Vx.h b/buildroot/share/PlatformIO/variants/MARLIN_H743Vx/variant_MARLIN_STM32H743Vx.h new file mode 100644 index 000000000000..35cf65dee9b9 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_H743Vx/variant_MARLIN_STM32H743Vx.h @@ -0,0 +1,268 @@ +/* + ******************************************************************************* + * Copyright (c) 2020-2021, STMicroelectronics + * All rights reserved. + * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ******************************************************************************* + */ +#pragma once + +/*---------------------------------------------------------------------------- + * STM32 pins number + *----------------------------------------------------------------------------*/ +#define PA0 PIN_A0 +#define PA1 PIN_A1 +#define PA2 PIN_A2 +#define PA3 PIN_A3 +#define PA4 PIN_A4 +#define PA5 PIN_A5 +#define PA6 PIN_A6 +#define PA7 PIN_A7 +#define PA8 8 +#define PA9 9 +#define PA10 10 +#define PA11 11 +#define PA12 12 +#define PA13 13 +#define PA14 14 +#define PA15 15 +#define PB0 PIN_A8 +#define PB1 PIN_A9 +#define PB2 18 +#define PB3 19 +#define PB4 20 +#define PB5 21 +#define PB6 22 +#define PB7 23 +#define PB8 24 +#define PB9 25 +#define PB10 26 +#define PB11 27 +#define PB12 28 +#define PB13 29 +#define PB14 30 +#define PB15 31 +#define PC0 PIN_A10 +#define PC1 PIN_A11 +#define PC4 PIN_A12 +#define PC5 PIN_A13 +#define PC6 36 +#define PC7 37 +#define PC8 38 +#define PC9 39 +#define PC10 40 +#define PC11 41 +#define PC12 42 +#define PC13 43 +#define PC14 44 +#define PC15 45 +#define PD0 46 +#define PD1 47 +#define PD2 48 +#define PD3 49 +#define PD4 50 +#define PD5 51 +#define PD6 52 +#define PD7 53 +#define PD8 54 +#define PD9 55 +#define PD10 56 +#define PD11 57 +#define PD12 58 +#define PD13 59 +#define PD14 60 +#define PD15 61 +#define PE0 62 +#define PE1 63 +#define PE2 64 +#define PE3 65 +#define PE4 66 +#define PE5 67 +#define PE6 68 +#define PE7 69 +#define PE8 70 +#define PE9 71 +#define PE10 72 +#define PE11 73 +#define PE12 74 +#define PE13 75 +#define PE14 76 +#define PE15 77 +#define PH0 78 +#define PH1 79 +#define PC2_C PIN_A14 +#define PC3_C PIN_A15 +#define PC2 PC2_C +#define PC3 PC3_C + +// Alternate pins number +#define PA0_ALT1 (PA0 | ALT1) +#define PA1_ALT1 (PA1 | ALT1) +#define PA1_ALT2 (PA1 | ALT2) +#define PA2_ALT1 (PA2 | ALT1) +#define PA2_ALT2 (PA2 | ALT2) +#define PA3_ALT1 (PA3 | ALT1) +#define PA3_ALT2 (PA3 | ALT2) +#define PA4_ALT1 (PA4 | ALT1) +#define PA4_ALT2 (PA4 | ALT2) +#define PA5_ALT1 (PA5 | ALT1) +#define PA6_ALT1 (PA6 | ALT1) +#define PA7_ALT1 (PA7 | ALT1) +#define PA7_ALT2 (PA7 | ALT2) +#define PA7_ALT3 (PA7 | ALT3) +#define PA9_ALT1 (PA9 | ALT1) +#define PA10_ALT1 (PA10 | ALT1) +#define PA11_ALT1 (PA11 | ALT1) +#define PA12_ALT1 (PA12 | ALT1) +#define PA15_ALT1 (PA15 | ALT1) +#define PA15_ALT2 (PA15 | ALT2) +#define PB0_ALT1 (PB0 | ALT1) +#define PB0_ALT2 (PB0 | ALT2) +#define PB1_ALT1 (PB1 | ALT1) +#define PB1_ALT2 (PB1 | ALT2) +#define PB3_ALT1 (PB3 | ALT1) +#define PB3_ALT2 (PB3 | ALT2) +#define PB4_ALT1 (PB4 | ALT1) +#define PB4_ALT2 (PB4 | ALT2) +#define PB5_ALT1 (PB5 | ALT1) +#define PB5_ALT2 (PB5 | ALT2) +#define PB6_ALT1 (PB6 | ALT1) +#define PB6_ALT2 (PB6 | ALT2) +#define PB7_ALT1 (PB7 | ALT1) +#define PB8_ALT1 (PB8 | ALT1) +#define PB8_ALT2 (PB8 | ALT2) +#define PB9_ALT1 (PB9 | ALT1) +#define PB9_ALT2 (PB9 | ALT2) +#define PB14_ALT1 (PB14 | ALT1) +#define PB14_ALT2 (PB14 | ALT2) +#define PB15_ALT1 (PB15 | ALT1) +#define PB15_ALT2 (PB15 | ALT2) +#define PC0_ALT1 (PC0 | ALT1) +#define PC0_ALT2 (PC0 | ALT2) +#define PC1_ALT1 (PC1 | ALT1) +#define PC1_ALT2 (PC1 | ALT2) +#define PC4_ALT1 (PC4 | ALT1) +#define PC5_ALT1 (PC5 | ALT1) +#define PC6_ALT1 (PC6 | ALT1) +#define PC6_ALT2 (PC6 | ALT2) +#define PC7_ALT1 (PC7 | ALT1) +#define PC7_ALT2 (PC7 | ALT2) +#define PC8_ALT1 (PC8 | ALT1) +#define PC9_ALT1 (PC9 | ALT1) +#define PC10_ALT1 (PC10 | ALT1) +#define PC11_ALT1 (PC11 | ALT1) + +#define NUM_DIGITAL_PINS 82 +#define NUM_DUALPAD_PINS 2 +#define NUM_ANALOG_INPUTS 16 + +// On-board LED pin number +#ifndef LED_BUILTIN + #define LED_BUILTIN PNUM_NOT_DEFINED +#endif + +// On-board user button +#ifndef USER_BTN + #define USER_BTN PNUM_NOT_DEFINED +#endif + +// SPI definitions +#ifndef PIN_SPI_SS + #define PIN_SPI_SS PA4 +#endif +#ifndef PIN_SPI_SS1 + #define PIN_SPI_SS1 PA15 +#endif +#ifndef PIN_SPI_SS2 + #define PIN_SPI_SS2 PNUM_NOT_DEFINED +#endif +#ifndef PIN_SPI_SS3 + #define PIN_SPI_SS3 PNUM_NOT_DEFINED +#endif +#ifndef PIN_SPI_MOSI + #define PIN_SPI_MOSI PA7 +#endif +#ifndef PIN_SPI_MISO + #define PIN_SPI_MISO PA6 +#endif +#ifndef PIN_SPI_SCK + #define PIN_SPI_SCK PA5 +#endif + +// I2C definitions +#ifndef PIN_WIRE_SDA + #define PIN_WIRE_SDA PB7 +#endif +#ifndef PIN_WIRE_SCL + #define PIN_WIRE_SCL PB6 +#endif + +// Timer Definitions +// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin +#ifndef TIMER_TONE + #define TIMER_TONE TIM6 +#endif +#ifndef TIMER_SERVO + #define TIMER_SERVO TIM7 +#endif + +// UART Definitions +#ifndef SERIAL_UART_INSTANCE + #define SERIAL_UART_INSTANCE 4 +#endif + +// Default pin used for generic 'Serial' instance +// Mandatory for Firmata +#ifndef PIN_SERIAL_RX + #define PIN_SERIAL_RX PA1 +#endif +#ifndef PIN_SERIAL_TX + #define PIN_SERIAL_TX PA0 +#endif + +// Extra HAL modules +#if !defined(HAL_DAC_MODULE_DISABLED) + #define HAL_DAC_MODULE_ENABLED +#endif +#if !defined(HAL_ETH_MODULE_DISABLED) + #define HAL_ETH_MODULE_ENABLED +#endif +#if !defined(HAL_QSPI_MODULE_DISABLED) + #define HAL_QSPI_MODULE_ENABLED +#endif +#if !defined(HAL_SD_MODULE_DISABLED) + #define HAL_SD_MODULE_ENABLED +#endif + +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ + +#ifdef __cplusplus + // These serial port names are intended to allow libraries and architecture-neutral + // sketches to automatically default to the correct port name for a particular type + // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, + // the first hardware serial port whose RX/TX pins are not dedicated to another use. + // + // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor + // + // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial + // + // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library + // + // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. + // + // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX + // pins are NOT connected to anything by default. + #ifndef SERIAL_PORT_MONITOR + #define SERIAL_PORT_MONITOR Serial + #endif + #ifndef SERIAL_PORT_HARDWARE + #define SERIAL_PORT_HARDWARE Serial + #endif +#endif diff --git a/ini/stm32h7.ini b/ini/stm32h7.ini index b0cb10866c55..c5d7d6299a1e 100644 --- a/ini/stm32h7.ini +++ b/ini/stm32h7.ini @@ -38,3 +38,24 @@ build_flags = ${stm32_variant.build_flags} ${stm_flash_drive.build_flags} -DHAL_SD_MODULE_ENABLED upload_protocol = cmsis-dap debug_tool = cmsis-dap + +# +# BigTreeTech SKR V3.0 / V3.0 EZ (STM32H743VIT6 ARM Cortex-M7) +# +[env:STM32H743Vx_btt] +extends = stm32_variant +platform = ststm32@~14.1.0 +platform_packages = framework-arduinoststm32@https://github.com/stm32duino/Arduino_Core_STM32/archive/main.zip +board = marlin_STM32H743Vx +board_build.offset = 0x20000 +board_upload.offset_address = 0x08020000 +build_flags = ${stm32_variant.build_flags} + -DPIN_SERIAL1_RX=PA_10 -DPIN_SERIAL1_TX=PA_9 + -DPIN_SERIAL3_RX=PD_9 -DPIN_SERIAL3_TX=PD_8 + -DPIN_SERIAL4_RX=PA_1 -DPIN_SERIAL4_TX=PA_0 + -DSERIAL_RX_BUFFER_SIZE=1024 -DSERIAL_TX_BUFFER_SIZE=1024 + -DTIMER_SERVO=TIM5 -DTIMER_TONE=TIM2 + -DSTEP_TIMER_IRQ_PRIO=0 + -DD_CACHE_DISABLED +upload_protocol = cmsis-dap +debug_tool = cmsis-dap From 08c51a405a7f2b5ec153cb17d5737c3396825898 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Thu, 2 Jun 2022 21:22:09 +1200 Subject: [PATCH 129/241] =?UTF-8?q?=F0=9F=90=9B=20Init=20Stepper=20SPI=20b?= =?UTF-8?q?efore=20PSU=20Control=20(#24269)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/MarlinCore.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index e85ee6fb80ce..67950299dbd4 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -1242,6 +1242,17 @@ void setup() { SETUP_RUN(tmc_serial_begin()); #endif + #if HAS_TMC_SPI + #if DISABLED(TMC_USE_SW_SPI) + SETUP_RUN(SPI.begin()); + #endif + SETUP_RUN(tmc_init_cs_pins()); + #endif + + #if HAS_L64XX + SETUP_RUN(L64xxManager.init()); // Set up SPI, init drivers + #endif + #if ENABLED(PSU_CONTROL) SETUP_LOG("PSU_CONTROL"); powerManager.init(); @@ -1251,21 +1262,10 @@ void setup() { SETUP_RUN(recovery.setup()); #endif - #if HAS_L64XX - SETUP_RUN(L64xxManager.init()); // Set up SPI, init drivers - #endif - #if HAS_STEPPER_RESET SETUP_RUN(disableStepperDrivers()); #endif - #if HAS_TMC_SPI - #if DISABLED(TMC_USE_SW_SPI) - SETUP_RUN(SPI.begin()); - #endif - SETUP_RUN(tmc_init_cs_pins()); - #endif - SETUP_RUN(hal.init_board()); SETUP_RUN(esp_wifi_init()); From 49db4ef5e492d601ba50b784ddd0bf6964709e3d Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Thu, 2 Jun 2022 21:28:07 +1200 Subject: [PATCH 130/241] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20G60/G61=20debug=20?= =?UTF-8?q?code=20(#24231)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/feature/pause/G60.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Marlin/src/gcode/feature/pause/G60.cpp b/Marlin/src/gcode/feature/pause/G60.cpp index 9e0962fd34f6..b32935b341b9 100644 --- a/Marlin/src/gcode/feature/pause/G60.cpp +++ b/Marlin/src/gcode/feature/pause/G60.cpp @@ -50,14 +50,14 @@ void GcodeSuite::G60() { { const xyze_pos_t &pos = stored_position[slot]; DEBUG_ECHOPGM(STR_SAVED_POS " S", slot, " :"); - DEBUG_ECHOLNPAIR_F_P( + DEBUG_ECHOLNPGM_P( LIST_N(DOUBLE(NUM_AXES), - SP_Y_STR, pos.x, SP_Y_STR, pos.y, SP_Z_STR, pos.z, - SP_I_STR, pos.i, SP_J_STR, pos.j, SP_K_STR, pos.k, - SP_U_STR, pos.u, SP_V_STR, pos.v, SP_W_STR, pos.w + SP_X_LBL, pos.x, SP_Y_LBL, pos.y, SP_Z_LBL, pos.z, + SP_I_LBL, pos.i, SP_J_LBL, pos.j, SP_K_LBL, pos.k, + SP_U_LBL, pos.u, SP_V_LBL, pos.v, SP_W_LBL, pos.w ) #if HAS_EXTRUDERS - , SP_E_STR, pos.e + , SP_E_LBL, pos.e #endif ); } From 0e8e735e4cd41827574d5aa9372bf03ca4164d89 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Thu, 2 Jun 2022 12:07:36 +0000 Subject: [PATCH 131/241] [cron] Bump distribution date (2022-06-02) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index a4d30bc26b80..9f4e86d2d11d 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-06-01" +//#define STRING_DISTRIBUTION_DATE "2022-06-02" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 50994141714b..b2abe0107e91 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-06-01" + #define STRING_DISTRIBUTION_DATE "2022-06-02" #endif /** From 12aded95dce45d317d912dfc3eae663c37d69f33 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Thu, 2 Jun 2022 05:14:38 -0700 Subject: [PATCH 132/241] =?UTF-8?q?=F0=9F=92=9A=20SKR=20V3=20case-sensitiv?= =?UTF-8?q?e=20fs=20fix=20(#24272)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...iant_MARLIN_STM32H743Vx.cpp => variant_MARLIN_STM32H743VX.cpp} | 0 ...{variant_MARLIN_STM32H743Vx.h => variant_MARLIN_STM32H743VX.h} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename buildroot/share/PlatformIO/variants/MARLIN_H743Vx/{variant_MARLIN_STM32H743Vx.cpp => variant_MARLIN_STM32H743VX.cpp} (100%) rename buildroot/share/PlatformIO/variants/MARLIN_H743Vx/{variant_MARLIN_STM32H743Vx.h => variant_MARLIN_STM32H743VX.h} (100%) diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H743Vx/variant_MARLIN_STM32H743Vx.cpp b/buildroot/share/PlatformIO/variants/MARLIN_H743Vx/variant_MARLIN_STM32H743VX.cpp similarity index 100% rename from buildroot/share/PlatformIO/variants/MARLIN_H743Vx/variant_MARLIN_STM32H743Vx.cpp rename to buildroot/share/PlatformIO/variants/MARLIN_H743Vx/variant_MARLIN_STM32H743VX.cpp diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H743Vx/variant_MARLIN_STM32H743Vx.h b/buildroot/share/PlatformIO/variants/MARLIN_H743Vx/variant_MARLIN_STM32H743VX.h similarity index 100% rename from buildroot/share/PlatformIO/variants/MARLIN_H743Vx/variant_MARLIN_STM32H743Vx.h rename to buildroot/share/PlatformIO/variants/MARLIN_H743Vx/variant_MARLIN_STM32H743VX.h From 833ea4ec290d5f891c6084b96c7204e7bfe38882 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 3 Jun 2022 00:18:25 +0000 Subject: [PATCH 133/241] [cron] Bump distribution date (2022-06-03) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 9f4e86d2d11d..b0da2191c3e5 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-06-02" +//#define STRING_DISTRIBUTION_DATE "2022-06-03" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index b2abe0107e91..108cc148b955 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-06-02" + #define STRING_DISTRIBUTION_DATE "2022-06-03" #endif /** From c9b97b8d641b974de3023dabf7fedbfa352c232e Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Fri, 3 Jun 2022 02:23:07 +0200 Subject: [PATCH 134/241] =?UTF-8?q?=F0=9F=9A=91=EF=B8=8F=20Fix=20SDIO=20In?= =?UTF-8?q?it=20bootloop=20on=20STM32F1=20(#24275)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/STM32/sdio.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Marlin/src/HAL/STM32/sdio.cpp b/Marlin/src/HAL/STM32/sdio.cpp index a58589c43ee4..e958d8c3bc48 100644 --- a/Marlin/src/HAL/STM32/sdio.cpp +++ b/Marlin/src/HAL/STM32/sdio.cpp @@ -200,7 +200,8 @@ static uint32_t clock_to_divider(uint32_t clk) { bool SDIO_Init() { HAL_StatusTypeDef sd_state = HAL_OK; - HAL_SD_DeInit(&hsd); + if (hsd.Instance == SDIO) + HAL_SD_DeInit(&hsd); /* HAL SD initialization */ hsd.Instance = SDIO; From 845e2f6fb79bdb58ee88066f8ca368db9c00ca64 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Wed, 25 May 2022 08:07:11 +0200 Subject: [PATCH 135/241] Use default null args in select_screen --- Marlin/src/lcd/menu/menu_bed_corners.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Marlin/src/lcd/menu/menu_bed_corners.cpp b/Marlin/src/lcd/menu/menu_bed_corners.cpp index b37e05f3a4b3..c820ff15e7ee 100644 --- a/Marlin/src/lcd/menu/menu_bed_corners.cpp +++ b/Marlin/src/lcd/menu/menu_bed_corners.cpp @@ -201,7 +201,6 @@ static void _lcd_level_bed_corners_get_next_position() { , []{ corner_probing_done = true; wait_for_probe = false; } , []{ wait_for_probe = false; } , GET_TEXT_F(MSG_BED_TRAMMING_RAISE) - , (const char*)nullptr, NUL_STR ); } @@ -213,7 +212,6 @@ static void _lcd_level_bed_corners_get_next_position() { , []{ queue.inject(TERN(HAS_LEVELING, F("G29N"), FPSTR(G28_STR))); ui.return_to_status(); } , TERN(HAS_LEVELING, ui.goto_previous_screen_no_defer, []{}) , GET_TEXT_F(MSG_BED_TRAMMING_IN_RANGE) - , (const char*)nullptr, NUL_STR ); } From 41f73cb457116ed9646932eb505b5e9fbe29e77d Mon Sep 17 00:00:00 2001 From: lujios <83166168+lujios@users.noreply.github.com> Date: Fri, 3 Jun 2022 07:19:25 +0200 Subject: [PATCH 136/241] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Improve=20Sensorle?= =?UTF-8?q?ss=20homing/probing=20accuracy=20for=20G28,=20G33,=20M48=20(#24?= =?UTF-8?q?220)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Robby Candra Co-authored-by: ellensp <530024+ellensp@users.noreply.github.com> --- Marlin/src/gcode/calibrate/G28.cpp | 2 + Marlin/src/gcode/calibrate/G33.cpp | 47 ++++++-- Marlin/src/inc/Conditionals_adv.h | 5 + .../lcd/extui/dgus/mks/DGUSScreenHandler.cpp | 3 +- Marlin/src/lcd/menu/menu_delta_calibrate.cpp | 8 +- Marlin/src/module/delta.cpp | 6 + Marlin/src/module/delta.h | 11 ++ Marlin/src/module/endstops.cpp | 63 +++++++++++ Marlin/src/module/endstops.h | 5 + Marlin/src/module/motion.cpp | 10 +- Marlin/src/module/planner.cpp | 5 +- Marlin/src/module/probe.cpp | 105 ++++++++---------- Marlin/src/module/probe.h | 11 +- 13 files changed, 202 insertions(+), 79 deletions(-) diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index 2a1fec84aef2..175a3015681f 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -321,6 +321,7 @@ void GcodeSuite::G28() { stepperW.rms_current(W_CURRENT_HOME); if (DEBUGGING(LEVELING)) debug_current(F(STR_W), tmc_save_current_W, W_CURRENT_HOME); #endif + safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle #endif #if ENABLED(IMPROVE_HOMING_RELIABILITY) @@ -576,6 +577,7 @@ void GcodeSuite::G28() { #if HAS_CURRENT_HOME(W) stepperW.rms_current(tmc_save_current_W); #endif + safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle #endif // HAS_HOMING_CURRENT ui.refresh(); diff --git a/Marlin/src/gcode/calibrate/G33.cpp b/Marlin/src/gcode/calibrate/G33.cpp index 7f487abd6b87..810fb734dc68 100644 --- a/Marlin/src/gcode/calibrate/G33.cpp +++ b/Marlin/src/gcode/calibrate/G33.cpp @@ -71,9 +71,9 @@ float lcd_probe_pt(const xy_pos_t &xy); void ac_home() { endstops.enable(true); - TERN_(HAS_DELTA_SENSORLESS_PROBING, probe.set_homing_current(true)); + TERN_(SENSORLESS_HOMING, endstops.set_homing_current(true)); home_delta(); - TERN_(HAS_DELTA_SENSORLESS_PROBING, probe.set_homing_current(false)); + TERN_(SENSORLESS_HOMING, endstops.set_homing_current(false)); endstops.not_homing(); } @@ -390,6 +390,8 @@ static float auto_tune_a(const float dcr) { * X Don't activate stallguard on X. * Y Don't activate stallguard on Y. * Z Don't activate stallguard on Z. + * + * S Save offset_sensorless_adj */ void GcodeSuite::G33() { @@ -411,7 +413,8 @@ void GcodeSuite::G33() { dcr -= probe_at_offset ? _MAX(total_offset, PROBING_MARGIN) : total_offset; #endif NOMORE(dcr, DELTA_PRINTABLE_RADIUS); - if (parser.seenval('R')) dcr -= _MAX(parser.value_float(),0); + if (parser.seenval('R')) dcr -= _MAX(parser.value_float(), 0.0f); + TERN_(HAS_DELTA_SENSORLESS_PROBING, dcr *= sensorless_radius_factor); const float calibration_precision = parser.floatval('C', 0.0f); if (calibration_precision < 0) { @@ -434,9 +437,8 @@ void GcodeSuite::G33() { const bool stow_after_each = parser.seen_test('E'); #if HAS_DELTA_SENSORLESS_PROBING - probe.test_sensitivity.x = !parser.seen_test('X'); - TERN_(HAS_Y_AXIS, probe.test_sensitivity.y = !parser.seen_test('Y')); - TERN_(HAS_Z_AXIS, probe.test_sensitivity.z = !parser.seen_test('Z')); + probe.test_sensitivity.set(!parser.seen_test('X'), !parser.seen_test('Y'), !parser.seen_test('Z')); + const bool do_save_offset_adj = parser.seen_test('S'); #endif const bool _0p_calibration = probe_points == 0, @@ -475,6 +477,25 @@ void GcodeSuite::G33() { if (!_0p_calibration) ac_home(); + #if HAS_DELTA_SENSORLESS_PROBING + if (verbose_level > 0 && do_save_offset_adj) { + offset_sensorless_adj.reset(); + + auto caltower = [&](Probe::sense_bool_t s){ + float z_at_pt[NPP + 1]; + LOOP_CAL_ALL(rad) z_at_pt[rad] = 0.0f; + probe.test_sensitivity = s; + if (probe_calibration_points(z_at_pt, 1, dcr, false, false, probe_at_offset)) + probe.set_offset_sensorless_adj(z_at_pt[CEN]); + }; + caltower({ true, false, false }); // A + caltower({ false, true, false }); // B + caltower({ false, false, true }); // C + + probe.test_sensitivity = { true, true, true }; // reset to all + } + #endif + do { // start iterations float z_at_pt[NPP + 1] = { 0.0f }; @@ -598,8 +619,17 @@ void GcodeSuite::G33() { // print report - if (verbose_level == 3 || verbose_level == 0) + if (verbose_level == 3 || verbose_level == 0) { print_calibration_results(z_at_pt, _tower_results, _opposite_results); + #if HAS_DELTA_SENSORLESS_PROBING + if (verbose_level == 0 && probe_points == 1) { + if (do_save_offset_adj) + probe.set_offset_sensorless_adj(z_at_pt[CEN]); + else + probe.refresh_largest_sensorless_adj(); + } + #endif + } if (verbose_level != 0) { // !dry run if ((zero_std_dev >= test_precision && iterations > force_iterations) || zero_std_dev <= calibration_precision) { // end iterations @@ -660,6 +690,9 @@ void GcodeSuite::G33() { ac_cleanup(TERN_(HAS_MULTI_HOTEND, old_tool_index)); TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE)); + #if HAS_DELTA_SENSORLESS_PROBING + probe.test_sensitivity = { true, true, true }; + #endif } #endif // DELTA_AUTO_CALIBRATION diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 130e68f61ee9..fc690fa724d2 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -1048,3 +1048,8 @@ #if ANY(DISABLE_INACTIVE_X, DISABLE_INACTIVE_Y, DISABLE_INACTIVE_Z, DISABLE_INACTIVE_I, DISABLE_INACTIVE_J, DISABLE_INACTIVE_K, DISABLE_INACTIVE_U, DISABLE_INACTIVE_V, DISABLE_INACTIVE_W, DISABLE_INACTIVE_E) #define HAS_DISABLE_INACTIVE_AXIS 1 #endif + +// Delay Sensorless Homing/Probing +#if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) && !defined(SENSORLESS_STALLGUARD_DELAY) + #define SENSORLESS_STALLGUARD_DELAY 0 +#endif diff --git a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp index 35c2de05497f..739265e49636 100644 --- a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp @@ -193,7 +193,6 @@ void DGUSScreenHandlerMKS::DGUSLCD_SendTMCStepValue(DGUS_VP_Variable &var) { if (!ExtUI::isPrintingFromMedia()) return; // avoid race condition when user stays in this menu and printer finishes. switch (swap16(*(uint16_t*)val_ptr)) { case 0: { // Resume - auto cs = getCurrentScreen(); if (runout_mks.runout_status != RUNOUT_WAITING_STATUS && runout_mks.runout_status != UNRUNOUT_STATUS) { if (cs == MKSLCD_SCREEN_PRINT || cs == MKSLCD_SCREEN_PAUSE) @@ -213,7 +212,6 @@ void DGUSScreenHandlerMKS::DGUSLCD_SendTMCStepValue(DGUS_VP_Variable &var) { } break; case 1: // Pause - GotoScreen(MKSLCD_SCREEN_PAUSE); if (!ExtUI::isPrintingFromMediaPaused()) { nozzle_park_mks.print_pause_start_flag = 1; @@ -222,6 +220,7 @@ void DGUSScreenHandlerMKS::DGUSLCD_SendTMCStepValue(DGUS_VP_Variable &var) { //ExtUI::mks_pausePrint(); } break; + case 2: // Abort HandleUserConfirmationPopUp(VP_SD_AbortPrintConfirmed, nullptr, PSTR("Abort printing"), filelist.filename(), PSTR("?"), true, true, false, true); break; diff --git a/Marlin/src/lcd/menu/menu_delta_calibrate.cpp b/Marlin/src/lcd/menu/menu_delta_calibrate.cpp index 76d5677a806f..b86f1012586d 100644 --- a/Marlin/src/lcd/menu/menu_delta_calibrate.cpp +++ b/Marlin/src/lcd/menu/menu_delta_calibrate.cpp @@ -41,6 +41,10 @@ #include "../extui/ui_api.h" #endif +#if HAS_PROBE_XY_OFFSET + #include "../../module/probe.h" +#endif + void _man_probe_pt(const xy_pos_t &xy) { if (!ui.wait_for_move) { ui.wait_for_move = true; @@ -88,7 +92,9 @@ void _man_probe_pt(const xy_pos_t &xy) { } void _goto_tower_a(const_float_t a) { - constexpr float dcr = DELTA_PRINTABLE_RADIUS; + float dcr = DELTA_PRINTABLE_RADIUS - PROBING_MARGIN; + TERN_(HAS_PROBE_XY_OFFSET, dcr -= HYPOT(probe.offset_xy.x, probe.offset_xy.y)); + TERN_(HAS_DELTA_SENSORLESS_PROBING, dcr *= sensorless_radius_factor); xy_pos_t tower_vec = { cos(RADIANS(a)), sin(RADIANS(a)) }; _man_probe_pt(tower_vec * dcr); } diff --git a/Marlin/src/module/delta.cpp b/Marlin/src/module/delta.cpp index 39eb15f896da..f22ab08658a0 100644 --- a/Marlin/src/module/delta.cpp +++ b/Marlin/src/module/delta.cpp @@ -60,6 +60,10 @@ xy_float_t delta_tower[ABC]; abc_float_t delta_diagonal_rod_2_tower; float delta_clip_start_height = Z_MAX_POS; abc_float_t delta_diagonal_rod_trim; +#if HAS_DELTA_SENSORLESS_PROBING + abc_float_t offset_sensorless_adj{0}; + float largest_sensorless_adj = 0; +#endif float delta_safe_distance_from_top(); @@ -236,6 +240,7 @@ void home_delta() { TERN_(U_SENSORLESS, sensorless_t stealth_states_u = start_sensorless_homing_per_axis(U_AXIS)); TERN_(V_SENSORLESS, sensorless_t stealth_states_v = start_sensorless_homing_per_axis(V_AXIS)); TERN_(W_SENSORLESS, sensorless_t stealth_states_w = start_sensorless_homing_per_axis(W_AXIS)); + safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle #endif // Move all carriages together linearly until an endstop is hit. @@ -255,6 +260,7 @@ void home_delta() { TERN_(U_SENSORLESS, end_sensorless_homing_per_axis(U_AXIS, stealth_states_u)); TERN_(V_SENSORLESS, end_sensorless_homing_per_axis(V_AXIS, stealth_states_v)); TERN_(W_SENSORLESS, end_sensorless_homing_per_axis(W_AXIS, stealth_states_w)); + safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle #endif endstops.validate_homing_move(); diff --git a/Marlin/src/module/delta.h b/Marlin/src/module/delta.h index 7cd42805c90a..f7067ef9c713 100644 --- a/Marlin/src/module/delta.h +++ b/Marlin/src/module/delta.h @@ -38,6 +38,10 @@ extern xy_float_t delta_tower[ABC]; extern abc_float_t delta_diagonal_rod_2_tower; extern float delta_clip_start_height; extern abc_float_t delta_diagonal_rod_trim; +#if HAS_DELTA_SENSORLESS_PROBING + extern abc_float_t offset_sensorless_adj; + extern float largest_sensorless_adj; +#endif /** * Recalculate factors used for delta kinematics whenever @@ -45,6 +49,13 @@ extern abc_float_t delta_diagonal_rod_trim; */ void recalc_delta_settings(); +/** + * Get a safe radius for calibration + */ +#if HAS_DELTA_SENSORLESS_PROBING + static constexpr float sensorless_radius_factor = 0.7f; +#endif + /** * Delta Inverse Kinematics * diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index bebe09c99c4c..261ab80217b5 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -31,6 +31,9 @@ #include "temperature.h" #include "../lcd/marlinui.h" +#define DEBUG_OUT BOTH(USE_SENSORLESS, DEBUG_LEVELING_FEATURE) +#include "../core/debug_out.h" + #if ENABLED(ENDSTOP_INTERRUPTS_FEATURE) #include HAL_PATH(../HAL, endstop_interrupts.h) #endif @@ -1621,3 +1624,63 @@ void Endstops::update() { } #endif // PINS_DEBUGGING + +#if USE_SENSORLESS + /** + * Change TMC driver currents to N##_CURRENT_HOME, saving the current configuration of each. + */ + void Endstops::set_homing_current(const bool onoff) { + #define HAS_CURRENT_HOME(N) (defined(N##_CURRENT_HOME) && N##_CURRENT_HOME != N##_CURRENT) + #define HAS_DELTA_X_CURRENT (ENABLED(DELTA) && HAS_CURRENT_HOME(X)) + #define HAS_DELTA_Y_CURRENT (ENABLED(DELTA) && HAS_CURRENT_HOME(Y)) + #if HAS_DELTA_X_CURRENT || HAS_DELTA_Y_CURRENT || HAS_CURRENT_HOME(Z) + #if HAS_DELTA_X_CURRENT + static int16_t saved_current_x; + #endif + #if HAS_DELTA_Y_CURRENT + static int16_t saved_current_y; + #endif + #if HAS_CURRENT_HOME(Z) + static int16_t saved_current_z; + #endif + auto debug_current_on = [](PGM_P const s, const int16_t a, const int16_t b) { + if (DEBUGGING(LEVELING)) { DEBUG_ECHOPGM_P(s); DEBUG_ECHOLNPGM(" current: ", a, " -> ", b); } + }; + if (onoff) { + #if HAS_DELTA_X_CURRENT + saved_current_x = stepperX.getMilliamps(); + stepperX.rms_current(X_CURRENT_HOME); + debug_current_on(PSTR("X"), saved_current_x, X_CURRENT_HOME); + #endif + #if HAS_DELTA_Y_CURRENT + saved_current_y = stepperY.getMilliamps(); + stepperY.rms_current(Y_CURRENT_HOME); + debug_current_on(PSTR("Y"), saved_current_y, Y_CURRENT_HOME); + #endif + #if HAS_CURRENT_HOME(Z) + saved_current_z = stepperZ.getMilliamps(); + stepperZ.rms_current(Z_CURRENT_HOME); + debug_current_on(PSTR("Z"), saved_current_z, Z_CURRENT_HOME); + #endif + } + else { + #if HAS_DELTA_X_CURRENT + stepperX.rms_current(saved_current_x); + debug_current_on(PSTR("X"), X_CURRENT_HOME, saved_current_x); + #endif + #if HAS_DELTA_Y_CURRENT + stepperY.rms_current(saved_current_y); + debug_current_on(PSTR("Y"), Y_CURRENT_HOME, saved_current_y); + #endif + #if HAS_CURRENT_HOME(Z) + stepperZ.rms_current(saved_current_z); + debug_current_on(PSTR("Z"), Z_CURRENT_HOME, saved_current_z); + #endif + } + + TERN_(IMPROVE_HOMING_RELIABILITY, planner.enable_stall_prevention(onoff)); + safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle + + #endif // XYZ + } +#endif diff --git a/Marlin/src/module/endstops.h b/Marlin/src/module/endstops.h index 101a00108876..9e411adbdaee 100644 --- a/Marlin/src/module/endstops.h +++ b/Marlin/src/module/endstops.h @@ -247,6 +247,11 @@ class Endstops { static void clear_endstop_state(); static bool tmc_spi_homing_check(); #endif + public: + // Basic functions for Sensorless Homing + #if USE_SENSORLESS + static void set_homing_current(const bool onoff); + #endif }; extern Endstops endstops; diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index b7c48783d1a9..b5061f637b46 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -1663,7 +1663,10 @@ void prepare_line_to_destination() { } // Disable stealthChop if used. Enable diag1 pin on driver. - TERN_(SENSORLESS_HOMING, stealth_states = start_sensorless_homing_per_axis(axis)); + #if ENABLED(SENSORLESS_HOMING) + stealth_states = start_sensorless_homing_per_axis(axis); + safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle + #endif } #if EITHER(MORGAN_SCARA, MP_SCARA) @@ -1699,7 +1702,10 @@ void prepare_line_to_destination() { endstops.validate_homing_move(); // Re-enable stealthChop if used. Disable diag1 pin on driver. - TERN_(SENSORLESS_HOMING, end_sensorless_homing_per_axis(axis, stealth_states)); + #if ENABLED(SENSORLESS_HOMING) + end_sensorless_homing_per_axis(axis, stealth_states); + safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle + #endif } } diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index e11a76090236..6aa363890e44 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1663,10 +1663,7 @@ void Planner::quick_stop() { // forced to empty, there's no risk the ISR will touch this. delay_before_delivering = BLOCK_DELAY_FOR_1ST_MOVE; - #if HAS_WIRED_LCD - // Clear the accumulated runtime - clear_block_buffer_runtime(); - #endif + TERN_(HAS_WIRED_LCD, clear_block_buffer_runtime()); // Clear the accumulated runtime // Make sure to drop any attempt of queuing moves for 1 second cleaning_buffer_counter = TEMP_TIMER_FREQUENCY; diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index dc97971a25b1..66e1c850284f 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -103,7 +103,7 @@ xyz_pos_t Probe::offset; // Initialized by settings.load() #endif #if ENABLED(SENSORLESS_PROBING) - Probe::sense_bool_t Probe::test_sensitivity; + Probe::sense_bool_t Probe::test_sensitivity = { true, true, true }; #endif #if ENABLED(Z_PROBE_SLED) @@ -531,12 +531,12 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) { #if ENABLED(SENSORLESS_PROBING) sensorless_t stealth_states { false }; #if HAS_DELTA_SENSORLESS_PROBING - if (test_sensitivity.x) stealth_states.x = tmc_enable_stallguard(stepperX); // Delta watches all DIAG pins for a stall + if (test_sensitivity.x) stealth_states.x = tmc_enable_stallguard(stepperX); // Delta watches all DIAG pins for a stall if (test_sensitivity.y) stealth_states.y = tmc_enable_stallguard(stepperY); #endif - if (test_sensitivity.z) stealth_states.z = tmc_enable_stallguard(stepperZ); // All machines will check Z-DIAG for stall + if (test_sensitivity.z) stealth_states.z = tmc_enable_stallguard(stepperZ); // All machines will check Z-DIAG for stall + endstops.set_homing_current(true); // The "homing" current also applies to probing endstops.enable(true); - set_homing_current(true); // The "homing" current also applies to probing #endif TERN_(HAS_QUIET_PROBING, set_probing_paused(true)); @@ -553,6 +553,11 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) { #endif ; + // Offset sensorless probing + #if HAS_DELTA_SENSORLESS_PROBING + if (probe_triggered) probe.refresh_largest_sensorless_adj(); + #endif + TERN_(HAS_QUIET_PROBING, set_probing_paused(false)); // Re-enable stealthChop if used. Disable diag1 pin on driver. @@ -563,7 +568,7 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) { if (test_sensitivity.y) tmc_disable_stallguard(stepperY, stealth_states.y); #endif if (test_sensitivity.z) tmc_disable_stallguard(stepperZ, stealth_states.z); - set_homing_current(false); + endstops.set_homing_current(false); #endif #if ENABLED(BLTOUCH) @@ -666,8 +671,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) { if (try_to_probe(PSTR("FAST"), z_probe_low_point, z_probe_fast_mm_s, sanity_check, Z_CLEARANCE_BETWEEN_PROBES) ) return NAN; - const float first_probe_z = current_position.z; - + const float first_probe_z = DIFF_TERN(HAS_DELTA_SENSORLESS_PROBING, current_position.z, largest_sensorless_adj); if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("1st Probe Z:", first_probe_z); // Raise to give the probe clearance @@ -709,7 +713,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) { TERN_(MEASURE_BACKLASH_WHEN_PROBING, backlash.measure_with_probe()); - const float z = current_position.z; + const float z = DIFF_TERN(HAS_DELTA_SENSORLESS_PROBING, current_position.z, largest_sensorless_adj); #if EXTRA_PROBING > 0 // Insert Z measurement into probes[]. Keep it sorted ascending. @@ -760,7 +764,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) { #elif TOTAL_PROBING == 2 - const float z2 = current_position.z; + const float z2 = DIFF_TERN(HAS_DELTA_SENSORLESS_PROBING, current_position.z, largest_sensorless_adj); if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("2nd Probe Z:", z2, " Discrepancy:", first_probe_z - z2); @@ -843,7 +847,7 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai SERIAL_ERROR_MSG(STR_ERR_PROBING_FAILED); #endif } - + DEBUG_ECHOLNPGM("measured_z: ", measured_z); return measured_z; } @@ -896,60 +900,39 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai } /** - * Change the current in the TMC drivers to N##_CURRENT_HOME. And we save the current configuration of each TMC driver. + * Set the sensorless Z offset */ - void Probe::set_homing_current(const bool onoff) { - #define _defined(N) defined(N) - #define HAS_CURRENT_HOME(N) (N##_CURRENT_HOME > 0 && N##_CURRENT_HOME != N##_CURRENT) - #define _HOME_ELEM(N) HAS_CURRENT_HOME(N) || - #if MAIN_AXIS_MAP(_HOME_ELEM) 0 - #if ENABLED(DELTA) - static int16_t saved_current_X, saved_current_Y; - #endif - #if HAS_CURRENT_HOME(Z) - static int16_t saved_current_Z; + void Probe::set_offset_sensorless_adj(const_float_t sz) { + #if ENABLED(SENSORLESS_PROBING) + DEBUG_SECTION(pso, "Probe::set_offset_sensorless_adj", true); + #if HAS_DELTA_SENSORLESS_PROBING + if (test_sensitivity.x) offset_sensorless_adj.a = sz; + if (test_sensitivity.y) offset_sensorless_adj.b = sz; #endif - #if ((ENABLED(DELTA) && (HAS_CURRENT_HOME(X) || HAS_CURRENT_HOME(Y))) || HAS_CURRENT_HOME(Z)) - auto debug_current_on = [](PGM_P const s, const int16_t a, const int16_t b) { - if (DEBUGGING(LEVELING)) { DEBUG_ECHOPGM_P(s); DEBUG_ECHOLNPGM(" current: ", a, " -> ", b); } - }; + if (test_sensitivity.z) offset_sensorless_adj.c = sz; + #endif + } + + /** + * Refresh largest_sensorless_adj based on triggered endstops + */ + void Probe::refresh_largest_sensorless_adj() { + #if ENABLED(SENSORLESS_PROBING) + DEBUG_SECTION(rso, "Probe::refresh_largest_sensorless_adj", true); + largest_sensorless_adj = -3; // A reference away from any real probe height + #if HAS_DELTA_SENSORLESS_PROBING + if (TEST(endstops.state(), X_MAX)) { + NOLESS(largest_sensorless_adj, offset_sensorless_adj.a); + DEBUG_ECHOLNPGM("Endstop_X: ", largest_sensorless_adj, " TowerX"); + } + if (TEST(endstops.state(), Y_MAX)) { + NOLESS(largest_sensorless_adj, offset_sensorless_adj.b); + DEBUG_ECHOLNPGM("Endstop_Y: ", largest_sensorless_adj, " TowerY"); + } #endif - if (onoff) { - #if ENABLED(DELTA) - #if HAS_CURRENT_HOME(X) - saved_current_X = stepperX.getMilliamps(); - stepperX.rms_current(X_CURRENT_HOME); - debug_current_on(PSTR("X"), saved_current_X, X_CURRENT_HOME); - #endif - #if HAS_CURRENT_HOME(Y) - saved_current_Y = stepperY.getMilliamps(); - stepperY.rms_current(Y_CURRENT_HOME); - debug_current_on(PSTR("Y"), saved_current_Y, Y_CURRENT_HOME); - #endif - #endif - #if HAS_CURRENT_HOME(Z) - saved_current_Z = stepperZ.getMilliamps(); - stepperZ.rms_current(Z_CURRENT_HOME); - debug_current_on(PSTR("Z"), saved_current_Z, Z_CURRENT_HOME); - #endif - TERN_(IMPROVE_HOMING_RELIABILITY, planner.enable_stall_prevention(true)); - } - else { - #if ENABLED(DELTA) - #if HAS_CURRENT_HOME(X) - stepperX.rms_current(saved_current_X); - debug_current_on(PSTR("X"), X_CURRENT_HOME, saved_current_X); - #endif - #if HAS_CURRENT_HOME(Y) - stepperY.rms_current(saved_current_Y); - debug_current_on(PSTR("Y"), Y_CURRENT_HOME, saved_current_Y); - #endif - #endif - #if HAS_CURRENT_HOME(Z) - stepperZ.rms_current(saved_current_Z); - debug_current_on(PSTR("Z"), Z_CURRENT_HOME, saved_current_Z); - #endif - TERN_(IMPROVE_HOMING_RELIABILITY, planner.enable_stall_prevention(false)); + if (TEST(endstops.state(), Z_MAX)) { + NOLESS(largest_sensorless_adj, offset_sensorless_adj.c); + DEBUG_ECHOLNPGM("Endstop_Z: ", largest_sensorless_adj, " TowerZ"); } #endif } diff --git a/Marlin/src/module/probe.h b/Marlin/src/module/probe.h index 6185196320c8..ca596e896977 100644 --- a/Marlin/src/module/probe.h +++ b/Marlin/src/module/probe.h @@ -66,7 +66,13 @@ class Probe { public: #if ENABLED(SENSORLESS_PROBING) - typedef struct { bool x:1, y:1, z:1; } sense_bool_t; + typedef struct { + #if HAS_DELTA_SENSORLESS_PROBING + bool x:1, y:1, z:1; + #else + bool z; + #endif + } sense_bool_t; static sense_bool_t test_sensitivity; #endif @@ -299,7 +305,8 @@ class Probe { #if USE_SENSORLESS static void enable_stallguard_diag1(); static void disable_stallguard_diag1(); - static void set_homing_current(const bool onoff); + static void set_offset_sensorless_adj(const_float_t sz); + static void refresh_largest_sensorless_adj(); #endif private: From bcd9bb96285d426baed9e938c0a182c7841d5b66 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 3 Jun 2022 01:31:01 -0500 Subject: [PATCH 137/241] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20const=20warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to c16ae2451d --- Marlin/src/HAL/AVR/pinsDebug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/HAL/AVR/pinsDebug.h b/Marlin/src/HAL/AVR/pinsDebug.h index 64d90ac94997..dab4e4471524 100644 --- a/Marlin/src/HAL/AVR/pinsDebug.h +++ b/Marlin/src/HAL/AVR/pinsDebug.h @@ -74,7 +74,7 @@ #define MULTI_NAME_PAD 26 // space needed to be pretty if not first name assigned to a pin void PRINT_ARRAY_NAME(uint8_t x) { - const char * const name_mem_pointer = (PGM_P)pgm_read_ptr(&pin_array[x].name); + PGM_P const name_mem_pointer = (PGM_P)pgm_read_ptr(&pin_array[x].name); LOOP_L_N(y, MAX_NAME_LENGTH) { char temp_char = pgm_read_byte(name_mem_pointer + y); if (temp_char != 0) From 2b3ba02f09832379cffa4fc1baaa055228b82fe8 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 3 Jun 2022 18:16:43 -0500 Subject: [PATCH 138/241] =?UTF-8?q?=F0=9F=94=A7=20LEVEL=5FBED=5FCORNERS=20?= =?UTF-8?q?=3D>=20LCD=5FBED=5FTRAMMING?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 26 +++--- Marlin/src/inc/Conditionals_post.h | 2 +- Marlin/src/inc/SanityCheck.h | 32 ++++--- .../lcd/extui/dgus_reloaded/DGUSRxHandler.cpp | 8 +- .../dgus_reloaded/config/DGUS_Constants.h | 10 +-- Marlin/src/lcd/menu/menu.cpp | 2 +- Marlin/src/lcd/menu/menu.h | 4 +- Marlin/src/lcd/menu/menu_bed_corners.cpp | 90 +++++++++---------- Marlin/src/lcd/menu/menu_bed_leveling.cpp | 2 +- Marlin/src/lcd/menu/menu_item.h | 2 +- Marlin/src/lcd/menu/menu_motion.cpp | 2 +- .../PlatformIO/scripts/common-dependencies.h | 2 +- .../tests/BIGTREE_GTR_V1_0_usb_flash_drive | 2 +- buildroot/tests/LPC1769 | 2 +- buildroot/tests/rambo | 6 +- 15 files changed, 99 insertions(+), 93 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index cdfaa49fb624..6d38e833cc3d 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1806,18 +1806,18 @@ #endif // Add a menu item to move between bed corners for manual bed adjustment -//#define LEVEL_BED_CORNERS - -#if ENABLED(LEVEL_BED_CORNERS) - #define LEVEL_CORNERS_INSET_LFRB { 30, 30, 30, 30 } // (mm) Left, Front, Right, Back insets - #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points - #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Z height of nozzle between leveling points - //#define LEVEL_CENTER_TOO // Move to the center after the last corner - //#define LEVEL_CORNERS_USE_PROBE - #if ENABLED(LEVEL_CORNERS_USE_PROBE) - #define LEVEL_CORNERS_PROBE_TOLERANCE 0.1 - #define LEVEL_CORNERS_VERIFY_RAISED // After adjustment triggers the probe, re-probe to verify - //#define LEVEL_CORNERS_AUDIO_FEEDBACK +//#define LCD_BED_TRAMMING + +#if ENABLED(LCD_BED_TRAMMING) + #define BED_TRAMMING_INSET_LFRB { 30, 30, 30, 30 } // (mm) Left, Front, Right, Back insets + #define BED_TRAMMING_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points + #define BED_TRAMMING_Z_HOP 4.0 // (mm) Z height of nozzle between leveling points + //#define BED_TRAMMING_INCLUDE_CENTER // Move to the center after the last corner + //#define BED_TRAMMING_USE_PROBE + #if ENABLED(BED_TRAMMING_USE_PROBE) + #define BED_TRAMMING_PROBE_TOLERANCE 0.1 // (mm) + #define BED_TRAMMING_VERIFY_RAISED // After adjustment triggers the probe, re-probe to verify + //#define BED_TRAMMING_AUDIO_FEEDBACK #endif /** @@ -1837,7 +1837,7 @@ * | 1 2 | | 1 4 | | 1 2 | | 2 | * LF --------- RF LF --------- RF LF --------- RF LF --------- RF */ - #define LEVEL_CORNERS_LEVELING_ORDER { LF, RF, RB, LB } + #define BED_TRAMMING_LEVELING_ORDER { LF, RF, RB, LB } #endif /** diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 6c025b1dbbf9..98f5ed3f48cf 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -266,7 +266,7 @@ * No adjustable bed on non-cartesians */ #if IS_KINEMATIC - #undef LEVEL_BED_CORNERS + #undef LCD_BED_TRAMMING #endif /** diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index ebbd85ad1b2a..8cb87ca8bc80 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -371,7 +371,7 @@ #elif defined(FILAMENT_CHANGE_LOAD_LENGTH) #error "FILAMENT_CHANGE_LOAD_LENGTH is now FILAMENT_CHANGE_FAST_LOAD_LENGTH." #elif defined(LEVEL_CORNERS_INSET) - #error "LEVEL_CORNERS_INSET is now LEVEL_CORNERS_INSET_LFRB." + #error "LEVEL_CORNERS_INSET is now BED_TRAMMING_INSET_LFRB." #elif defined(BEZIER_JERK_CONTROL) #error "BEZIER_JERK_CONTROL is now S_CURVE_ACCELERATION." #elif HAS_JUNCTION_DEVIATION && defined(JUNCTION_DEVIATION_FACTOR) @@ -627,6 +627,12 @@ #error "Y_DUAL_STEPPER_DRIVERS is no longer needed and should be removed." #elif defined(NUM_Z_STEPPER_DRIVERS) #error "NUM_Z_STEPPER_DRIVERS is no longer needed and should be removed." +#elif defined(LEVEL_BED_CORNERS) + #error "LEVEL_BED_CORNERS is now LCD_BED_TRAMMING." +#elif defined(LEVEL_CORNERS_INSET_LFRB) || defined(LEVEL_CORNERS_HEIGHT) || defined(LEVEL_CORNERS_Z_HOP) || defined(LEVEL_CORNERS_USE_PROBE) || defined(LEVEL_CORNERS_PROBE_TOLERANCE) || defined(LEVEL_CORNERS_VERIFY_RAISED) || defined(LEVEL_CORNERS_AUDIO_FEEDBACK) + #error "LEVEL_CORNERS_* settings have been renamed BED_TRAMMING_*." +#elif defined(LEVEL_CENTER_TOO) + #error "LEVEL_CENTER_TOO is now BED_TRAMMING_INCLUDE_CENTER." #endif constexpr float arm[] = AXIS_RELATIVE_MODES; @@ -1824,14 +1830,14 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #endif -#if ENABLED(LEVEL_BED_CORNERS) - #ifndef LEVEL_CORNERS_INSET_LFRB - #error "LEVEL_BED_CORNERS requires LEVEL_CORNERS_INSET_LFRB values." - #elif ENABLED(LEVEL_CORNERS_USE_PROBE) +#if ENABLED(LCD_BED_TRAMMING) + #ifndef BED_TRAMMING_INSET_LFRB + #error "LCD_BED_TRAMMING requires BED_TRAMMING_INSET_LFRB values." + #elif ENABLED(BED_TRAMMING_USE_PROBE) #if !HAS_BED_PROBE - #error "LEVEL_CORNERS_USE_PROBE requires a real probe." + #error "BED_TRAMMING_USE_PROBE requires a real probe." #elif ENABLED(SENSORLESS_PROBING) - #error "LEVEL_CORNERS_USE_PROBE is incompatible with SENSORLESS_PROBING." + #error "BED_TRAMMING_USE_PROBE is incompatible with SENSORLESS_PROBING." #endif #endif #endif @@ -2952,8 +2958,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "DWIN_CREALITY_LCD does not support PID_EDIT_MENU or PID_AUTOTUNE_MENU." #elif EITHER(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) #error "DWIN_CREALITY_LCD does not support MPC_EDIT_MENU or MPC_AUTOTUNE_MENU." - #elif ENABLED(LEVEL_BED_CORNERS) - #error "DWIN_CREALITY_LCD does not support LEVEL_BED_CORNERS." + #elif ENABLED(LCD_BED_TRAMMING) + #error "DWIN_CREALITY_LCD does not support LCD_BED_TRAMMING." #elif BOTH(LCD_BED_LEVELING, PROBE_MANUALLY) #error "DWIN_CREALITY_LCD does not support LCD_BED_LEVELING with PROBE_MANUALLY." #endif @@ -2964,8 +2970,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "DWIN_LCD_PROUI does not support PID_EDIT_MENU or PID_AUTOTUNE_MENU." #elif EITHER(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) #error "DWIN_LCD_PROUI does not support MPC_EDIT_MENU or MPC_AUTOTUNE_MENU." - #elif ENABLED(LEVEL_BED_CORNERS) - #error "DWIN_LCD_PROUI does not support LEVEL_BED_CORNERS." + #elif ENABLED(LCD_BED_TRAMMING) + #error "DWIN_LCD_PROUI does not support LCD_BED_TRAMMING." #elif BOTH(LCD_BED_LEVELING, PROBE_MANUALLY) #error "DWIN_LCD_PROUI does not support LCD_BED_LEVELING with PROBE_MANUALLY." #endif @@ -4121,8 +4127,8 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive."); #error "DGUS_LCD_UI_RELOADED requires a bed probe." #elif !HAS_MESH #error "DGUS_LCD_UI_RELOADED requires mesh leveling." - #elif DISABLED(LEVEL_BED_CORNERS) - #error "DGUS_LCD_UI_RELOADED requires LEVEL_BED_CORNERS." + #elif DISABLED(LCD_BED_TRAMMING) + #error "DGUS_LCD_UI_RELOADED requires LCD_BED_TRAMMING." #elif DISABLED(BABYSTEP_ALWAYS_AVAILABLE) #error "DGUS_LCD_UI_RELOADED requires BABYSTEP_ALWAYS_AVAILABLE." #elif DISABLED(BABYSTEP_ZPROBE_OFFSET) diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp index cf95bb1d761d..cef9c772e9df 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp @@ -466,7 +466,7 @@ void DGUSRxHandler::MoveToPoint(DGUS_VP &vp, void *data_ptr) { } const uint8_t point = ((uint8_t*)data_ptr)[1]; - constexpr float lfrb[4] = LEVEL_CORNERS_INSET_LFRB; + constexpr float lfrb[4] = BED_TRAMMING_INSET_LFRB; float x, y; switch (point) { @@ -493,12 +493,12 @@ void DGUSRxHandler::MoveToPoint(DGUS_VP &vp, void *data_ptr) { break; } - if (ExtUI::getAxisPosition_mm(ExtUI::Z) < Z_MIN_POS + LEVEL_CORNERS_Z_HOP) { - ExtUI::setAxisPosition_mm(Z_MIN_POS + LEVEL_CORNERS_Z_HOP, ExtUI::Z); + if (ExtUI::getAxisPosition_mm(ExtUI::Z) < Z_MIN_POS + BED_TRAMMING_Z_HOP) { + ExtUI::setAxisPosition_mm(Z_MIN_POS + BED_TRAMMING_Z_HOP, ExtUI::Z); } ExtUI::setAxisPosition_mm(x, ExtUI::X); ExtUI::setAxisPosition_mm(y, ExtUI::Y); - ExtUI::setAxisPosition_mm(Z_MIN_POS + LEVEL_CORNERS_HEIGHT, ExtUI::Z); + ExtUI::setAxisPosition_mm(Z_MIN_POS + BED_TRAMMING_HEIGHT, ExtUI::Z); } void DGUSRxHandler::Probe(DGUS_VP &vp, void *data_ptr) { diff --git a/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Constants.h b/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Constants.h index 9b275fb2f550..846fd1594216 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Constants.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Constants.h @@ -71,15 +71,15 @@ static_assert((DGUS_LEVEL_GRID_SIZE == GRID_MAX_POINTS_X * GRID_MAX_POINTS_Y), " #define DGUS_DEFAULT_FILAMENT_LEN 10 #endif -#ifndef LEVEL_CORNERS_Z_HOP - #define LEVEL_CORNERS_Z_HOP 4.0 +#ifndef BED_TRAMMING_Z_HOP + #define BED_TRAMMING_Z_HOP 4.0 #endif -#ifndef LEVEL_CORNERS_HEIGHT - #define LEVEL_CORNERS_HEIGHT 0.0 +#ifndef BED_TRAMMING_HEIGHT + #define BED_TRAMMING_HEIGHT 0.0 #endif -static_assert(LEVEL_CORNERS_Z_HOP >= 0, "LEVEL_CORNERS_Z_HOP must be >= 0. Please update your configuration."); +static_assert(BED_TRAMMING_Z_HOP >= 0, "BED_TRAMMING_Z_HOP must be >= 0. Please update your configuration."); #ifndef DGUS_LEVEL_CENTER_X #define DGUS_LEVEL_CENTER_X ((X_BED_SIZE) / 2) diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp index 92be24aa0642..13ef0d2bc1c1 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -47,7 +47,7 @@ ///////////// Global Variables ///////////// //////////////////////////////////////////// -#if HAS_LEVELING && ANY(LEVEL_BED_CORNERS, PROBE_OFFSET_WIZARD, X_AXIS_TWIST_COMPENSATION) +#if HAS_LEVELING && ANY(LCD_BED_TRAMMING, PROBE_OFFSET_WIZARD, X_AXIS_TWIST_COMPENSATION) bool leveling_was_active; // = false #endif #if ANY(PROBE_MANUALLY, MESH_BED_LEVELING, X_AXIS_TWIST_COMPENSATION) diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index fbee2c8501f4..67e337213ab8 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -211,7 +211,7 @@ void menu_move(); void lcd_move_z(); void _lcd_draw_homing(); -#define HAS_LINE_TO_Z ANY(DELTA, PROBE_MANUALLY, MESH_BED_LEVELING, LEVEL_BED_CORNERS) +#define HAS_LINE_TO_Z ANY(DELTA, PROBE_MANUALLY, MESH_BED_LEVELING, LCD_BED_TRAMMING) #if HAS_LINE_TO_Z void line_to_z(const_float_t z); @@ -258,7 +258,7 @@ inline void clear_menu_history() { screen_history_depth = 0; } #define STICKY_SCREEN(S) []{ ui.defer_status_screen(); ui.goto_screen(S); } -#if HAS_LEVELING && ANY(LEVEL_BED_CORNERS, PROBE_OFFSET_WIZARD, X_AXIS_TWIST_COMPENSATION) +#if HAS_LEVELING && ANY(LCD_BED_TRAMMING, PROBE_OFFSET_WIZARD, X_AXIS_TWIST_COMPENSATION) extern bool leveling_was_active; #endif diff --git a/Marlin/src/lcd/menu/menu_bed_corners.cpp b/Marlin/src/lcd/menu/menu_bed_corners.cpp index c820ff15e7ee..3fe0c582cb10 100644 --- a/Marlin/src/lcd/menu/menu_bed_corners.cpp +++ b/Marlin/src/lcd/menu/menu_bed_corners.cpp @@ -26,7 +26,7 @@ #include "../../inc/MarlinConfigPre.h" -#if BOTH(HAS_MARLINUI_MENU, LEVEL_BED_CORNERS) +#if BOTH(HAS_MARLINUI_MENU, LCD_BED_TRAMMING) #include "menu_item.h" #include "../../module/motion.h" @@ -36,21 +36,21 @@ #include "../../feature/bedlevel/bedlevel.h" #endif -#ifndef LEVEL_CORNERS_Z_HOP - #define LEVEL_CORNERS_Z_HOP 4.0 +#ifndef BED_TRAMMING_Z_HOP + #define BED_TRAMMING_Z_HOP 4.0 #endif -#ifndef LEVEL_CORNERS_HEIGHT - #define LEVEL_CORNERS_HEIGHT 0.0 +#ifndef BED_TRAMMING_HEIGHT + #define BED_TRAMMING_HEIGHT 0.0 #endif -#if ENABLED(LEVEL_CORNERS_USE_PROBE) +#if ENABLED(BED_TRAMMING_USE_PROBE) #include "../../module/probe.h" #include "../../module/endstops.h" #if ENABLED(BLTOUCH) #include "../../feature/bltouch.h" #endif - #ifndef LEVEL_CORNERS_PROBE_TOLERANCE - #define LEVEL_CORNERS_PROBE_TOLERANCE 0.2 + #ifndef BED_TRAMMING_PROBE_TOLERANCE + #define BED_TRAMMING_PROBE_TOLERANCE 0.2 #endif float last_z; int good_points; @@ -64,32 +64,32 @@ #endif -static_assert(LEVEL_CORNERS_Z_HOP >= 0, "LEVEL_CORNERS_Z_HOP must be >= 0. Please update your configuration."); +static_assert(BED_TRAMMING_Z_HOP >= 0, "BED_TRAMMING_Z_HOP must be >= 0. Please update your configuration."); -#ifndef LEVEL_CORNERS_LEVELING_ORDER - #define LEVEL_CORNERS_LEVELING_ORDER { LF, RF, LB, RB } // Default - //#define LEVEL_CORNERS_LEVELING_ORDER { LF, LB, RF } // 3 hard-coded points - //#define LEVEL_CORNERS_LEVELING_ORDER { LF, RF } // 3-Point tramming - Rear - //#define LEVEL_CORNERS_LEVELING_ORDER { LF, LB } // 3-Point tramming - Right - //#define LEVEL_CORNERS_LEVELING_ORDER { RF, RB } // 3-Point tramming - Left - //#define LEVEL_CORNERS_LEVELING_ORDER { LB, RB } // 3-Point tramming - Front +#ifndef BED_TRAMMING_LEVELING_ORDER + #define BED_TRAMMING_LEVELING_ORDER { LF, RF, LB, RB } // Default + //#define BED_TRAMMING_LEVELING_ORDER { LF, LB, RF } // 3 hard-coded points + //#define BED_TRAMMING_LEVELING_ORDER { LF, RF } // 3-Point tramming - Rear + //#define BED_TRAMMING_LEVELING_ORDER { LF, LB } // 3-Point tramming - Right + //#define BED_TRAMMING_LEVELING_ORDER { RF, RB } // 3-Point tramming - Left + //#define BED_TRAMMING_LEVELING_ORDER { LB, RB } // 3-Point tramming - Front #endif #define LF 1 #define RF 2 #define RB 3 #define LB 4 -constexpr int lco[] = LEVEL_CORNERS_LEVELING_ORDER; +constexpr int lco[] = BED_TRAMMING_LEVELING_ORDER; constexpr bool level_corners_3_points = COUNT(lco) == 2; -static_assert(level_corners_3_points || COUNT(lco) == 4, "LEVEL_CORNERS_LEVELING_ORDER must have exactly 2 or 4 corners."); +static_assert(level_corners_3_points || COUNT(lco) == 4, "BED_TRAMMING_LEVELING_ORDER must have exactly 2 or 4 corners."); constexpr int lcodiff = ABS(lco[0] - lco[1]); -static_assert(COUNT(lco) == 4 || lcodiff == 1 || lcodiff == 3, "The first two LEVEL_CORNERS_LEVELING_ORDER corners must be on the same edge."); +static_assert(COUNT(lco) == 4 || lcodiff == 1 || lcodiff == 3, "The first two BED_TRAMMING_LEVELING_ORDER corners must be on the same edge."); constexpr int nr_edge_points = level_corners_3_points ? 3 : 4; -constexpr int available_points = nr_edge_points + ENABLED(LEVEL_CENTER_TOO); -constexpr int center_index = TERN(LEVEL_CENTER_TOO, available_points - 1, -1); -constexpr float inset_lfrb[4] = LEVEL_CORNERS_INSET_LFRB; +constexpr int available_points = nr_edge_points + ENABLED(BED_TRAMMING_INCLUDE_CENTER); +constexpr int center_index = TERN(BED_TRAMMING_INCLUDE_CENTER, available_points - 1, -1); +constexpr float inset_lfrb[4] = BED_TRAMMING_INSET_LFRB; constexpr xy_pos_t lf { (X_MIN_BED) + inset_lfrb[0], (Y_MIN_BED) + inset_lfrb[1] }, rb { (X_MAX_BED) - inset_lfrb[2], (Y_MAX_BED) - inset_lfrb[3] }; @@ -120,12 +120,12 @@ static void _lcd_level_bed_corners_get_next_position() { if ((lco[0] == LF && lco[1] == LB) || (lco[0] == LB && lco[1] == LF)) current_position.x = rb.x; // Center Right if ((lco[0] == RF && lco[1] == RB) || (lco[0] == RB && lco[1] == RF)) current_position.x = lf.x; // Left Center if ((lco[0] == LF && lco[1] == RF) || (lco[0] == RF && lco[1] == LF)) current_position.y = rb.y; // Center Back - #if DISABLED(LEVEL_CENTER_TOO) && ENABLED(LEVEL_CORNERS_USE_PROBE) + #if DISABLED(BED_TRAMMING_INCLUDE_CENTER) && ENABLED(BED_TRAMMING_USE_PROBE) bed_corner++; // Must increment the count to ensure it resets the loop if the 3rd point is out of tolerance #endif break; - #if ENABLED(LEVEL_CENTER_TOO) + #if ENABLED(BED_TRAMMING_INCLUDE_CENTER) case 3: current_position.set(X_CENTER, Y_CENTER); break; @@ -134,9 +134,9 @@ static void _lcd_level_bed_corners_get_next_position() { } else { // Four-Corner Bed Tramming with optional center - if (TERN0(LEVEL_CENTER_TOO, bed_corner == center_index)) { + if (TERN0(BED_TRAMMING_INCLUDE_CENTER, bed_corner == center_index)) { current_position.set(X_CENTER, Y_CENTER); - TERN_(LEVEL_CORNERS_USE_PROBE, good_points--); // Decrement to allow one additional probe point + TERN_(BED_TRAMMING_USE_PROBE, good_points--); // Decrement to allow one additional probe point } else { current_position = lf; // Left front @@ -152,10 +152,10 @@ static void _lcd_level_bed_corners_get_next_position() { /** * Level corners, starting in the front-left corner. */ -#if ENABLED(LEVEL_CORNERS_USE_PROBE) +#if ENABLED(BED_TRAMMING_USE_PROBE) #define VALIDATE_POINT(X, Y, STR) static_assert(Probe::build_time::can_reach((X), (Y)), \ - "LEVEL_CORNERS_INSET_LFRB " STR " inset is not reachable with the default NOZZLE_TO_PROBE offset and PROBING_MARGIN.") + "BED_TRAMMING_INSET_LFRB " STR " inset is not reachable with the default NOZZLE_TO_PROBE offset and PROBING_MARGIN.") VALIDATE_POINT(lf.x, Y_CENTER, "left"); VALIDATE_POINT(X_CENTER, lf.y, "front"); VALIDATE_POINT(rb.x, Y_CENTER, "right"); VALIDATE_POINT(X_CENTER, rb.y, "back"); @@ -216,16 +216,16 @@ static void _lcd_level_bed_corners_get_next_position() { } bool _lcd_level_bed_corners_probe(bool verify=false) { - if (verify) do_blocking_move_to_z(current_position.z + LEVEL_CORNERS_Z_HOP); // do clearance if needed + if (verify) do_blocking_move_to_z(current_position.z + BED_TRAMMING_Z_HOP); // do clearance if needed TERN_(BLTOUCH, if (!bltouch.high_speed_mode) bltouch.deploy()); // Deploy in LOW SPEED MODE on every probe action - do_blocking_move_to_z(last_z - LEVEL_CORNERS_PROBE_TOLERANCE, MMM_TO_MMS(Z_PROBE_FEEDRATE_SLOW)); // Move down to lower tolerance + do_blocking_move_to_z(last_z - BED_TRAMMING_PROBE_TOLERANCE, MMM_TO_MMS(Z_PROBE_FEEDRATE_SLOW)); // Move down to lower tolerance if (TEST(endstops.trigger_state(), Z_MIN_PROBE)) { // check if probe triggered endstops.hit_on_purpose(); set_current_from_steppers_for_axis(Z_AXIS); sync_plan_position(); TERN_(BLTOUCH, if (!bltouch.high_speed_mode) bltouch.stow()); // Stow in LOW SPEED MODE on every trigger // Triggered outside tolerance range? - if (ABS(current_position.z - last_z) > LEVEL_CORNERS_PROBE_TOLERANCE) { + if (ABS(current_position.z - last_z) > BED_TRAMMING_PROBE_TOLERANCE) { last_z = current_position.z; // Above tolerance. Set a new Z for subsequent corners. good_points = 0; // ...and start over } @@ -245,7 +245,7 @@ static void _lcd_level_bed_corners_get_next_position() { probe_triggered = PROBE_TRIGGERED(); if (probe_triggered) { endstops.hit_on_purpose(); - TERN_(LEVEL_CORNERS_AUDIO_FEEDBACK, BUZZ(200, 600)); + TERN_(BED_TRAMMING_AUDIO_FEEDBACK, BUZZ(200, 600)); } idle(); } @@ -255,8 +255,8 @@ static void _lcd_level_bed_corners_get_next_position() { } void _lcd_test_corners() { - bed_corner = TERN(LEVEL_CENTER_TOO, center_index, 0); - last_z = LEVEL_CORNERS_HEIGHT; + bed_corner = TERN(BED_TRAMMING_INCLUDE_CENTER, center_index, 0); + last_z = BED_TRAMMING_HEIGHT; endstops.enable_z_probe(true); good_points = 0; ui.goto_screen(_lcd_draw_probing); @@ -264,7 +264,7 @@ static void _lcd_level_bed_corners_get_next_position() { ui.refresh(LCDVIEW_REDRAW_NOW); _lcd_draw_probing(); // update screen with # of good points - do_blocking_move_to_z(current_position.z + LEVEL_CORNERS_Z_HOP + TERN0(BLTOUCH, bltouch.z_extra_clearance())); // clearance + do_blocking_move_to_z(current_position.z + BED_TRAMMING_Z_HOP + TERN0(BLTOUCH, bltouch.z_extra_clearance())); // clearance _lcd_level_bed_corners_get_next_position(); // Select next corner coordinates current_position -= probe.offset_xy; // Account for probe offsets @@ -273,7 +273,7 @@ static void _lcd_level_bed_corners_get_next_position() { TERN_(BLTOUCH, if (bltouch.high_speed_mode) bltouch.deploy()); // Deploy in HIGH SPEED MODE if (!_lcd_level_bed_corners_probe()) { // Probe down to tolerance if (_lcd_level_bed_corners_raise()) { // Prompt user to raise bed if needed - #if ENABLED(LEVEL_CORNERS_VERIFY_RAISED) // Verify + #if ENABLED(BED_TRAMMING_VERIFY_RAISED) // Verify while (!_lcd_level_bed_corners_probe(true)) { // Loop while corner verified if (!_lcd_level_bed_corners_raise()) { // Prompt user to raise bed if needed if (corner_probing_done) return; // Done was selected @@ -294,7 +294,7 @@ static void _lcd_level_bed_corners_get_next_position() { #if ENABLED(BLTOUCH) if (bltouch.high_speed_mode) { // In HIGH SPEED MODE do clearance and stow at the very end - do_blocking_move_to_z(current_position.z + LEVEL_CORNERS_Z_HOP); + do_blocking_move_to_z(current_position.z + BED_TRAMMING_Z_HOP); bltouch.stow(); } #endif @@ -303,25 +303,25 @@ static void _lcd_level_bed_corners_get_next_position() { ui.set_selection(true); } -#else // !LEVEL_CORNERS_USE_PROBE +#else // !BED_TRAMMING_USE_PROBE static void _lcd_goto_next_corner() { - line_to_z(LEVEL_CORNERS_Z_HOP); + line_to_z(BED_TRAMMING_Z_HOP); // Select next corner coordinates _lcd_level_bed_corners_get_next_position(); line_to_current_position(manual_feedrate_mm_s.x); - line_to_z(LEVEL_CORNERS_HEIGHT); + line_to_z(BED_TRAMMING_HEIGHT); if (++bed_corner >= available_points) bed_corner = 0; } -#endif // !LEVEL_CORNERS_USE_PROBE +#endif // !BED_TRAMMING_USE_PROBE static void _lcd_level_bed_corners_homing() { _lcd_draw_homing(); if (!all_axes_homed()) return; - #if ENABLED(LEVEL_CORNERS_USE_PROBE) + #if ENABLED(BED_TRAMMING_USE_PROBE) _lcd_test_corners(); if (corner_probing_done) ui.goto_previous_screen_no_defer(); TERN_(HAS_LEVELING, set_bed_leveling_enabled(leveling_was_active)); @@ -333,11 +333,11 @@ static void _lcd_level_bed_corners_homing() { GET_TEXT_F(MSG_BUTTON_NEXT), GET_TEXT_F(MSG_BUTTON_DONE) , _lcd_goto_next_corner , []{ - line_to_z(LEVEL_CORNERS_Z_HOP); // Raise Z off the bed when done + line_to_z(BED_TRAMMING_Z_HOP); // Raise Z off the bed when done TERN_(HAS_LEVELING, set_bed_leveling_enabled(leveling_was_active)); ui.goto_previous_screen_no_defer(); } - , GET_TEXT_F(TERN(LEVEL_CENTER_TOO, MSG_LEVEL_BED_NEXT_POINT, MSG_NEXT_CORNER)) + , GET_TEXT_F(TERN(BED_TRAMMING_INCLUDE_CENTER, MSG_LEVEL_BED_NEXT_POINT, MSG_NEXT_CORNER)) , (const char*)nullptr, F("?") ); }); @@ -362,4 +362,4 @@ void _lcd_level_bed_corners() { ui.goto_screen(_lcd_level_bed_corners_homing); } -#endif // HAS_MARLINUI_MENU && LEVEL_BED_CORNERS +#endif // HAS_MARLINUI_MENU && LCD_BED_TRAMMING diff --git a/Marlin/src/lcd/menu/menu_bed_leveling.cpp b/Marlin/src/lcd/menu/menu_bed_leveling.cpp index 142da1696af8..294666e35621 100644 --- a/Marlin/src/lcd/menu/menu_bed_leveling.cpp +++ b/Marlin/src/lcd/menu/menu_bed_leveling.cpp @@ -290,7 +290,7 @@ void menu_bed_leveling() { EDIT_ITEM(LCD_Z_OFFSET_TYPE, MSG_ZPROBE_ZOFFSET, &probe.offset.z, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX); #endif - #if ENABLED(LEVEL_BED_CORNERS) + #if ENABLED(LCD_BED_TRAMMING) SUBMENU(MSG_BED_TRAMMING, _lcd_level_bed_corners); #endif diff --git a/Marlin/src/lcd/menu/menu_item.h b/Marlin/src/lcd/menu/menu_item.h index 80a0872da652..85ae1c4b4176 100644 --- a/Marlin/src/lcd/menu/menu_item.h +++ b/Marlin/src/lcd/menu/menu_item.h @@ -466,7 +466,7 @@ class MenuItem_bool : public MenuEditItemBase { #define YESNO_ITEM_N_F(N,FLABEL, V...) CONFIRM_ITEM_N_F(N, FLABEL, MSG_YES, MSG_NO, ##V) #define YESNO_ITEM_N(N,LABEL, V...) YESNO_ITEM_N_F(N, GET_TEXT_F(LABEL), ##V) -#if ENABLED(LEVEL_BED_CORNERS) +#if ENABLED(LCD_BED_TRAMMING) void _lcd_level_bed_corners(); #endif diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index 5704ebedb43d..25f201837749 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -491,7 +491,7 @@ void menu_motion() { #endif - #if ENABLED(LEVEL_BED_CORNERS) && DISABLED(LCD_BED_LEVELING) + #if ENABLED(LCD_BED_TRAMMING) && DISABLED(LCD_BED_LEVELING) SUBMENU(MSG_BED_TRAMMING, _lcd_level_bed_corners); #endif diff --git a/buildroot/share/PlatformIO/scripts/common-dependencies.h b/buildroot/share/PlatformIO/scripts/common-dependencies.h index 4aa97c41ad69..da2d380a82b6 100644 --- a/buildroot/share/PlatformIO/scripts/common-dependencies.h +++ b/buildroot/share/PlatformIO/scripts/common-dependencies.h @@ -53,7 +53,7 @@ #if ENABLED(BACKLASH_GCODE) #define HAS_MENU_BACKLASH #endif - #if ENABLED(LEVEL_BED_CORNERS) + #if ENABLED(LCD_BED_TRAMMING) #define HAS_MENU_BED_CORNERS #endif #if ENABLED(CANCEL_OBJECTS) diff --git a/buildroot/tests/BIGTREE_GTR_V1_0_usb_flash_drive b/buildroot/tests/BIGTREE_GTR_V1_0_usb_flash_drive index 34bf77be27a4..78aec1329558 100755 --- a/buildroot/tests/BIGTREE_GTR_V1_0_usb_flash_drive +++ b/buildroot/tests/BIGTREE_GTR_V1_0_usb_flash_drive @@ -10,7 +10,7 @@ restore_configs opt_set MOTHERBOARD BOARD_BTT_GTR_V1_0 SERIAL_PORT 3 \ EXTRUDERS 8 TEMP_SENSOR_1 1 TEMP_SENSOR_2 1 TEMP_SENSOR_3 1 TEMP_SENSOR_4 1 TEMP_SENSOR_5 1 TEMP_SENSOR_6 1 TEMP_SENSOR_7 1 opt_enable SDSUPPORT USB_FLASH_DRIVE_SUPPORT USE_OTG_USB_HOST \ - REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER BLTOUCH LEVEL_BED_CORNERS LEVEL_CORNERS_USE_PROBE \ + REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER BLTOUCH LCD_BED_TRAMMING BED_TRAMMING_USE_PROBE \ NEOPIXEL_LED Z_SAFE_HOMING FILAMENT_RUNOUT_SENSOR NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE # Not necessary to enable auto-fan for all extruders to hit problematic code paths opt_set E0_AUTO_FAN_PIN PC10 E1_AUTO_FAN_PIN PC11 E2_AUTO_FAN_PIN PC12 NEOPIXEL_PIN PF13 \ diff --git a/buildroot/tests/LPC1769 b/buildroot/tests/LPC1769 index 3fe99734ca6b..086dffffc92c 100755 --- a/buildroot/tests/LPC1769 +++ b/buildroot/tests/LPC1769 @@ -21,7 +21,7 @@ opt_set MOTHERBOARD BOARD_SMOOTHIEBOARD \ opt_enable TFTGLCD_PANEL_SPI SDSUPPORT ADAPTIVE_FAN_SLOWING NO_FAN_SLOWING_IN_PID_TUNING \ MAX31865_SENSOR_OHMS_0 MAX31865_CALIBRATION_OHMS_0 \ FIX_MOUNTED_PROBE AUTO_BED_LEVELING_BILINEAR G29_RETRY_AND_RECOVER Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \ - BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET LEVEL_CORNERS_USE_PROBE LEVEL_CORNERS_VERIFY_RAISED \ + BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET BED_TRAMMING_USE_PROBE BED_TRAMMING_VERIFY_RAISED \ PRINTCOUNTER NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE SLOW_PWM_HEATERS PIDTEMPBED EEPROM_SETTINGS INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT \ Z_SAFE_HOMING ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE \ LCD_INFO_MENU ARC_SUPPORT BEZIER_CURVE_SUPPORT EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES SDCARD_SORT_ALPHA EMERGENCY_PARSER diff --git a/buildroot/tests/rambo b/buildroot/tests/rambo index f8fef704f1c2..167f6d89aae2 100755 --- a/buildroot/tests/rambo +++ b/buildroot/tests/rambo @@ -24,7 +24,7 @@ opt_enable USE_ZMAX_PLUG REPRAP_DISCOUNT_SMART_CONTROLLER LCD_PROGRESS_BAR LCD_P BLINKM PCA9533 PCA9632 RGB_LED RGB_LED_R_PIN RGB_LED_G_PIN RGB_LED_B_PIN LED_CONTROL_MENU \ NEOPIXEL_LED NEOPIXEL_PIN CASE_LIGHT_ENABLE CASE_LIGHT_USE_NEOPIXEL CASE_LIGHT_MENU \ PID_PARAMS_PER_HOTEND PID_AUTOTUNE_MENU PID_EDIT_MENU LCD_SHOW_E_TOTAL \ - PRINTCOUNTER SERVICE_NAME_1 SERVICE_INTERVAL_1 LEVEL_BED_CORNERS LEVEL_CENTER_TOO \ + PRINTCOUNTER SERVICE_NAME_1 SERVICE_INTERVAL_1 LCD_BED_TRAMMING BED_TRAMMING_INCLUDE_CENTER \ NOZZLE_PARK_FEATURE FILAMENT_RUNOUT_SENSOR FILAMENT_RUNOUT_DISTANCE_MM \ ADVANCED_PAUSE_FEATURE FILAMENT_LOAD_UNLOAD_GCODES FILAMENT_UNLOAD_ALL_EXTRUDERS \ PASSWORD_FEATURE PASSWORD_ON_STARTUP PASSWORD_ON_SD_PRINT_MENU PASSWORD_AFTER_SD_PRINT_END PASSWORD_AFTER_SD_PRINT_ABORT \ @@ -51,13 +51,13 @@ opt_set MOTHERBOARD BOARD_RAMBO \ DEFAULT_MAX_ACCELERATION '{ 3000, 3000, 100 }' \ MANUAL_FEEDRATE '{ 50*60, 50*60, 4*60 }' \ AXIS_RELATIVE_MODES '{ false, false, false }' \ - LEVEL_CORNERS_LEVELING_ORDER '{ LF, RF }' \ + BED_TRAMMING_LEVELING_ORDER '{ LF, RF }' \ X2_DRIVER_TYPE A4988 Y2_DRIVER_TYPE A4988 opt_enable USE_XMAX_PLUG USE_YMAX_PLUG USE_ZMAX_PLUG \ REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER REVERSE_ENCODER_DIRECTION SDSUPPORT EEPROM_SETTINGS \ S_CURVE_ACCELERATION X_DUAL_ENDSTOPS Y_DUAL_ENDSTOPS \ ADAPTIVE_STEP_SMOOTHING CNC_COORDINATE_SYSTEMS GCODE_MOTION_MODES \ - LEVEL_BED_CORNERS LEVEL_CENTER_TOO + LCD_BED_TRAMMING BED_TRAMMING_INCLUDE_CENTER opt_disable MIN_SOFTWARE_ENDSTOP_Z MAX_SOFTWARE_ENDSTOPS exec_test $1 $2 "Rambo CNC Configuration" "$3" From 384ff264d73d5a2cbddd104f72a639332612e5e3 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 4 May 2022 23:19:18 -0500 Subject: [PATCH 139/241] =?UTF-8?q?=F0=9F=90=9B=20Fix=20M203=20report?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/config/M200-M205.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/gcode/config/M200-M205.cpp b/Marlin/src/gcode/config/M200-M205.cpp index bd31c7f27280..87c1f2ce305e 100644 --- a/Marlin/src/gcode/config/M200-M205.cpp +++ b/Marlin/src/gcode/config/M200-M205.cpp @@ -209,7 +209,7 @@ void GcodeSuite::M203_report(const bool forReplay/*=true*/) { ); #if ENABLED(DISTINCT_E_FACTORS) LOOP_L_N(i, E_STEPPERS) { - SERIAL_ECHO_START(); + if (!forReplay) SERIAL_ECHO_START(); SERIAL_ECHOLNPGM_P( PSTR(" M203 T"), i , SP_E_STR, VOLUMETRIC_UNIT(planner.settings.max_feedrate_mm_s[E_AXIS_N(i)]) From 2c0b8b52d8376d2af3ed515953262b07c0a71cb8 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 4 Jun 2022 00:22:33 +0000 Subject: [PATCH 140/241] [cron] Bump distribution date (2022-06-04) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index b0da2191c3e5..32f31717129d 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-06-03" +//#define STRING_DISTRIBUTION_DATE "2022-06-04" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 108cc148b955..8bc51ca9ff79 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-06-03" + #define STRING_DISTRIBUTION_DATE "2022-06-04" #endif /** From 3522d5376cbf03658b71ddaf8c341e35f59b369b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 3 Jun 2022 20:55:15 -0500 Subject: [PATCH 141/241] =?UTF-8?q?=F0=9F=A9=B9=20Wrap=20SENSORLESS=5FSTAL?= =?UTF-8?q?LGUARD=5FDELAY?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/calibrate/G28.cpp | 8 ++++++-- Marlin/src/inc/Conditionals_adv.h | 5 ----- Marlin/src/module/delta.cpp | 8 ++++++-- Marlin/src/module/endstops.cpp | 5 ++++- Marlin/src/module/motion.cpp | 8 ++++++-- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index 175a3015681f..27551fb10911 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -321,7 +321,9 @@ void GcodeSuite::G28() { stepperW.rms_current(W_CURRENT_HOME); if (DEBUGGING(LEVELING)) debug_current(F(STR_W), tmc_save_current_W, W_CURRENT_HOME); #endif - safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle + #if SENSORLESS_STALLGUARD_DELAY + safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle + #endif #endif #if ENABLED(IMPROVE_HOMING_RELIABILITY) @@ -577,7 +579,9 @@ void GcodeSuite::G28() { #if HAS_CURRENT_HOME(W) stepperW.rms_current(tmc_save_current_W); #endif - safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle + #if SENSORLESS_STALLGUARD_DELAY + safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle + #endif #endif // HAS_HOMING_CURRENT ui.refresh(); diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index fc690fa724d2..130e68f61ee9 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -1048,8 +1048,3 @@ #if ANY(DISABLE_INACTIVE_X, DISABLE_INACTIVE_Y, DISABLE_INACTIVE_Z, DISABLE_INACTIVE_I, DISABLE_INACTIVE_J, DISABLE_INACTIVE_K, DISABLE_INACTIVE_U, DISABLE_INACTIVE_V, DISABLE_INACTIVE_W, DISABLE_INACTIVE_E) #define HAS_DISABLE_INACTIVE_AXIS 1 #endif - -// Delay Sensorless Homing/Probing -#if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) && !defined(SENSORLESS_STALLGUARD_DELAY) - #define SENSORLESS_STALLGUARD_DELAY 0 -#endif diff --git a/Marlin/src/module/delta.cpp b/Marlin/src/module/delta.cpp index f22ab08658a0..8207dacaf700 100644 --- a/Marlin/src/module/delta.cpp +++ b/Marlin/src/module/delta.cpp @@ -240,7 +240,9 @@ void home_delta() { TERN_(U_SENSORLESS, sensorless_t stealth_states_u = start_sensorless_homing_per_axis(U_AXIS)); TERN_(V_SENSORLESS, sensorless_t stealth_states_v = start_sensorless_homing_per_axis(V_AXIS)); TERN_(W_SENSORLESS, sensorless_t stealth_states_w = start_sensorless_homing_per_axis(W_AXIS)); - safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle + #if SENSORLESS_STALLGUARD_DELAY + safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle + #endif #endif // Move all carriages together linearly until an endstop is hit. @@ -260,7 +262,9 @@ void home_delta() { TERN_(U_SENSORLESS, end_sensorless_homing_per_axis(U_AXIS, stealth_states_u)); TERN_(V_SENSORLESS, end_sensorless_homing_per_axis(V_AXIS, stealth_states_v)); TERN_(W_SENSORLESS, end_sensorless_homing_per_axis(W_AXIS, stealth_states_w)); - safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle + #if SENSORLESS_STALLGUARD_DELAY + safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle + #endif #endif endstops.validate_homing_move(); diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index 261ab80217b5..1ee4b92b5f36 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -1679,7 +1679,10 @@ void Endstops::update() { } TERN_(IMPROVE_HOMING_RELIABILITY, planner.enable_stall_prevention(onoff)); - safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle + + #if SENSORLESS_STALLGUARD_DELAY + safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle + #endif #endif // XYZ } diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index b5061f637b46..36afdb2e485f 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -1665,7 +1665,9 @@ void prepare_line_to_destination() { // Disable stealthChop if used. Enable diag1 pin on driver. #if ENABLED(SENSORLESS_HOMING) stealth_states = start_sensorless_homing_per_axis(axis); - safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle + #if SENSORLESS_STALLGUARD_DELAY + safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle + #endif #endif } @@ -1704,7 +1706,9 @@ void prepare_line_to_destination() { // Re-enable stealthChop if used. Disable diag1 pin on driver. #if ENABLED(SENSORLESS_HOMING) end_sensorless_homing_per_axis(axis, stealth_states); - safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle + #if SENSORLESS_STALLGUARD_DELAY + safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle + #endif #endif } } From 9c872b214c1cef9791d7d7da45348d562c18d0ab Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 3 Jun 2022 22:06:32 -0500 Subject: [PATCH 142/241] =?UTF-8?q?=F0=9F=90=9B=20Fix=20min/max=20temp=20e?= =?UTF-8?q?valuation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #24257 --- Marlin/src/module/temperature.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 4fe71d3feffb..531c52c09de6 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -2709,13 +2709,15 @@ void Temperature::init() { #if HAS_HOTEND #define _TEMP_MIN_E(NR) do{ \ - const celsius_t tmin = _MAX(HEATER_##NR##_MINTEMP, TERN(TEMP_SENSOR_##NR##_IS_CUSTOM, 0, (int)pgm_read_word(&TEMPTABLE_##NR [TEMP_SENSOR_##NR##_MINTEMP_IND].celsius))); \ + const celsius_t tmin_tmp = TERN(TEMP_SENSOR_##NR##_IS_CUSTOM, 0, int16_t(pgm_read_word(&TEMPTABLE_##NR [TEMP_SENSOR_##NR##_MINTEMP_IND].celsius))), \ + tmin = _MAX(HEATER_##NR##_MINTEMP, tmin_tmp); \ temp_range[NR].mintemp = tmin; \ while (analog_to_celsius_hotend(temp_range[NR].raw_min, NR) < tmin) \ temp_range[NR].raw_min += TEMPDIR(NR) * (OVERSAMPLENR); \ }while(0) #define _TEMP_MAX_E(NR) do{ \ - const celsius_t tmax = _MIN(HEATER_##NR##_MAXTEMP, TERN(TEMP_SENSOR_##NR##_IS_CUSTOM, 2000, (int)pgm_read_word(&TEMPTABLE_##NR [TEMP_SENSOR_##NR##_MAXTEMP_IND].celsius) - 1)); \ + const celsius_t tmax_tmp = TERN(TEMP_SENSOR_##NR##_IS_CUSTOM, 2000, int16_t(pgm_read_word(&TEMPTABLE_##NR [TEMP_SENSOR_##NR##_MAXTEMP_IND].celsius)) - 1), \ + tmax = _MIN(HEATER_##NR##_MAXTEMP, tmax_tmp); \ temp_range[NR].maxtemp = tmax; \ while (analog_to_celsius_hotend(temp_range[NR].raw_max, NR) > tmax) \ temp_range[NR].raw_max -= TEMPDIR(NR) * (OVERSAMPLENR); \ From 8aca38351cd6d33a1202bf9a13890dc8e5eadd49 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 3 Jun 2022 22:56:38 -0500 Subject: [PATCH 143/241] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Ext?= =?UTF-8?q?end=20LCD=20string=20substitution=20(#24278)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/dac/stepper_dac.cpp | 1 - Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp | 10 +- Marlin/src/lcd/HD44780/marlinui_HD44780.cpp | 23 +- Marlin/src/lcd/TFTGLCD/lcdprint_TFTGLCD.cpp | 10 +- Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp | 142 +++++----- Marlin/src/lcd/dogm/lcdprint_u8g.cpp | 6 +- Marlin/src/lcd/dogm/marlinui_DOGM.cpp | 38 +-- Marlin/src/lcd/dogm/u8g_fontutf8.cpp | 2 +- Marlin/src/lcd/dogm/u8g_fontutf8.h | 6 +- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 10 +- Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp | 60 +++-- Marlin/src/lcd/e3v2/marlinui/dwin_string.h | 93 +++++-- .../src/lcd/e3v2/marlinui/lcdprint_dwin.cpp | 41 ++- Marlin/src/lcd/e3v2/marlinui/ui_common.cpp | 38 ++- .../lcd/e3v2/marlinui/ui_status_480x272.cpp | 10 +- Marlin/src/lcd/e3v2/proui/dwin.cpp | 10 +- Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp | 2 +- .../bioprinter/advanced_settings.cpp | 2 +- .../cocoa_press/advanced_settings_menu.cpp | 2 +- .../generic/advanced_settings_menu.cpp | 2 +- .../generic/max_velocity_screen.cpp | 2 +- .../ftdi_eve_touch_ui/language/language.h | 2 + .../ftdi_eve_touch_ui/language/language_en.h | 254 +++++++++--------- Marlin/src/lcd/fontutils.cpp | 13 +- Marlin/src/lcd/fontutils.h | 12 +- Marlin/src/lcd/language/language_an.h | 13 +- Marlin/src/lcd/language/language_bg.h | 7 +- Marlin/src/lcd/language/language_ca.h | 11 +- Marlin/src/lcd/language/language_cz.h | 33 +-- Marlin/src/lcd/language/language_da.h | 10 +- Marlin/src/lcd/language/language_de.h | 54 +--- Marlin/src/lcd/language/language_el.h | 20 +- Marlin/src/lcd/language/language_el_gr.h | 20 +- Marlin/src/lcd/language/language_en.h | 98 ++----- Marlin/src/lcd/language/language_es.h | 41 +-- Marlin/src/lcd/language/language_eu.h | 19 +- Marlin/src/lcd/language/language_fi.h | 2 +- Marlin/src/lcd/language/language_fr.h | 43 +-- Marlin/src/lcd/language/language_gl.h | 40 +-- Marlin/src/lcd/language/language_hr.h | 2 +- Marlin/src/lcd/language/language_hu.h | 43 +-- Marlin/src/lcd/language/language_it.h | 79 +----- Marlin/src/lcd/language/language_jp_kana.h | 22 +- Marlin/src/lcd/language/language_nl.h | 3 +- Marlin/src/lcd/language/language_pl.h | 25 +- Marlin/src/lcd/language/language_pt.h | 6 +- Marlin/src/lcd/language/language_pt_br.h | 13 +- Marlin/src/lcd/language/language_ro.h | 45 ++-- Marlin/src/lcd/language/language_ru.h | 44 +-- Marlin/src/lcd/language/language_sk.h | 66 ++--- Marlin/src/lcd/language/language_sv.h | 33 +-- Marlin/src/lcd/language/language_tr.h | 33 +-- Marlin/src/lcd/language/language_uk.h | 44 +-- Marlin/src/lcd/language/language_vi.h | 31 +-- Marlin/src/lcd/language/language_zh_CN.h | 32 +-- Marlin/src/lcd/language/language_zh_TW.h | 32 +-- Marlin/src/lcd/lcdprint.cpp | 19 +- Marlin/src/lcd/lcdprint.h | 134 +++++++-- Marlin/src/lcd/marlinui.cpp | 5 +- Marlin/src/lcd/menu/menu.cpp | 7 +- Marlin/src/lcd/menu/menu.h | 22 +- Marlin/src/lcd/menu/menu_advanced.cpp | 48 ++-- Marlin/src/lcd/menu/menu_backlash.cpp | 2 +- Marlin/src/lcd/menu/menu_configuration.cpp | 2 +- Marlin/src/lcd/menu/menu_filament.cpp | 20 +- Marlin/src/lcd/menu/menu_item.h | 80 +++++- Marlin/src/lcd/menu/menu_motion.cpp | 20 +- Marlin/src/lcd/menu/menu_probe_offset.cpp | 17 +- Marlin/src/lcd/menu/menu_temperature.cpp | 24 +- Marlin/src/lcd/menu/menu_tune.cpp | 8 +- Marlin/src/lcd/menu/menu_ubl.cpp | 6 +- Marlin/src/lcd/menu/menu_x_twist.cpp | 11 +- Marlin/src/lcd/tft/tft.h | 2 +- Marlin/src/lcd/tft/tft_queue.cpp | 4 +- Marlin/src/lcd/tft/tft_queue.h | 5 +- Marlin/src/lcd/tft/tft_string.cpp | 38 +-- Marlin/src/lcd/tft/tft_string.h | 93 +++++-- Marlin/src/lcd/tft/ui_1024x600.cpp | 10 +- Marlin/src/lcd/tft/ui_320x240.cpp | 10 +- Marlin/src/lcd/tft/ui_480x320.cpp | 10 +- Marlin/src/lcd/tft/ui_common.cpp | 24 +- Marlin/src/libs/L64XX/L64XX_Marlin.cpp | 2 +- buildroot/share/fonts/genpages.c | 2 +- 83 files changed, 1068 insertions(+), 1312 deletions(-) diff --git a/Marlin/src/feature/dac/stepper_dac.cpp b/Marlin/src/feature/dac/stepper_dac.cpp index 53d5720cce9b..f5664bc59855 100644 --- a/Marlin/src/feature/dac/stepper_dac.cpp +++ b/Marlin/src/feature/dac/stepper_dac.cpp @@ -29,7 +29,6 @@ #if HAS_MOTOR_CURRENT_DAC #include "stepper_dac.h" -#include "../../MarlinCore.h" // for SP_X_LBL... bool dac_present = false; constexpr xyze_uint8_t dac_order = DAC_STEPPER_ORDER; diff --git a/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp b/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp index 31b26aa5bbcb..1e82fe403d9f 100644 --- a/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp +++ b/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp @@ -992,7 +992,7 @@ void lcd_put_int(const int i) { lcd.print(i); } // return < 0 on error // return the advanced cols -int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) { +int lcd_put_wchar_max(const wchar_t c, const pixel_len_t max_length) { // find the HD44780 internal ROM first int ret; @@ -1047,9 +1047,9 @@ int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) { * * Draw a UTF-8 string */ -static int lcd_put_u8str_max_cb(const char * utf8_str, uint8_t (*cb_read_byte)(uint8_t * str), pixel_len_t max_length) { +static int lcd_put_u8str_max_cb(const char * utf8_str, read_byte_cb_t cb_read_byte, const pixel_len_t max_length) { pixel_len_t ret = 0; - uint8_t *p = (uint8_t *)utf8_str; + const uint8_t *p = (uint8_t *)utf8_str; while (ret < max_length) { wchar_t ch = 0; p = get_utf8_value_cb(p, cb_read_byte, &ch); @@ -1059,11 +1059,11 @@ static int lcd_put_u8str_max_cb(const char * utf8_str, uint8_t (*cb_read_byte)(u return (int)ret; } -int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length) { +int lcd_put_u8str_max(const char * utf8_str, const pixel_len_t max_length) { return lcd_put_u8str_max_cb(utf8_str, read_byte_ram, max_length); } -int lcd_put_u8str_max_P(PGM_P utf8_pstr, pixel_len_t max_length) { +int lcd_put_u8str_max_P(PGM_P utf8_pstr, const pixel_len_t max_length) { return lcd_put_u8str_max_cb(utf8_pstr, read_byte_rom, max_length); } diff --git a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp index f70b5b01749f..da4db8b2d419 100644 --- a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp +++ b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp @@ -495,12 +495,13 @@ void MarlinUI::clear_lcd() { lcd.clear(); } #endif // SHOW_BOOTSCREEN void MarlinUI::draw_kill_screen() { - lcd_put_u8str(0, 0, status_message); - lcd_uint_t y = 2; + lcd_uint_t x = 0, y = 0; + lcd_put_u8str(x, y, status_message); + y = 2; #if LCD_HEIGHT >= 4 - lcd_put_u8str(0, y++, GET_TEXT_F(MSG_HALTED)); + lcd_put_u8str(x, y++, GET_TEXT_F(MSG_HALTED)); #endif - lcd_put_u8str(0, y, GET_TEXT_F(MSG_PLEASE_RESET)); + lcd_put_u8str(x, y, GET_TEXT_F(MSG_PLEASE_RESET)); } // @@ -1076,24 +1077,24 @@ void MarlinUI::draw_status_screen() { int8_t pad = (LCD_WIDTH - plen - vlen) / 2; while (--pad >= 0) { lcd_put_wchar(' '); n--; } } - if (plen) n = lcd_put_u8str_ind(fstr, itemIndex, itemString, n); + if (plen) n = lcd_put_u8str(fstr, itemIndex, itemStringC, itemStringF, n); if (vlen) n -= lcd_put_u8str_max(vstr, n); for (; n > 0; --n) lcd_put_wchar(' '); } // Draw a generic menu item with pre_char (if selected) and post_char - void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char pre_char, const char post_char) { + void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char pre_char, const char post_char) { lcd_put_wchar(0, row, sel ? pre_char : ' '); - uint8_t n = lcd_put_u8str_ind(fstr, itemIndex, itemString, LCD_WIDTH - 2); + uint8_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2); for (; n; --n) lcd_put_wchar(' '); lcd_put_wchar(post_char); } // Draw a menu item with a (potentially) editable value - void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char * const inStr, const bool pgm) { + void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char * const inStr, const bool pgm) { const uint8_t vlen = inStr ? (pgm ? utf8_strlen_P(inStr) : utf8_strlen(inStr)) : 0; lcd_put_wchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' '); - uint8_t n = lcd_put_u8str_ind(fstr, itemIndex, itemString, LCD_WIDTH - 2 - vlen); + uint8_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2 - vlen); if (vlen) { lcd_put_wchar(':'); for (; n; --n) lcd_put_wchar(' '); @@ -1102,9 +1103,9 @@ void MarlinUI::draw_status_screen() { } // Low-level draw_edit_screen can be used to draw an edit screen from anyplace - void MenuEditItemBase::draw_edit_screen(FSTR_P const fstr, const char * const value/*=nullptr*/) { + void MenuEditItemBase::draw_edit_screen(FSTR_P const ftpl, const char * const value/*=nullptr*/) { ui.encoder_direction_normal(); - uint8_t n = lcd_put_u8str_ind(0, 1, fstr, itemIndex, itemString, LCD_WIDTH - 1); + uint8_t n = lcd_put_u8str(0, 1, ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 1); if (value) { lcd_put_wchar(':'); n--; const uint8_t len = utf8_strlen(value) + 1; // Plus one for a leading space diff --git a/Marlin/src/lcd/TFTGLCD/lcdprint_TFTGLCD.cpp b/Marlin/src/lcd/TFTGLCD/lcdprint_TFTGLCD.cpp index d0cf5795d235..7b15b786055c 100644 --- a/Marlin/src/lcd/TFTGLCD/lcdprint_TFTGLCD.cpp +++ b/Marlin/src/lcd/TFTGLCD/lcdprint_TFTGLCD.cpp @@ -991,7 +991,7 @@ void lcd_put_int(const int i) { // return < 0 on error // return the advanced cols -int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) { +int lcd_put_wchar_max(const wchar_t c, const pixel_len_t max_length) { // find the HD44780 internal ROM first int ret; @@ -1045,9 +1045,9 @@ int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) { * * Draw a UTF-8 string */ -static int lcd_put_u8str_max_cb(const char * utf8_str, uint8_t (*cb_read_byte)(uint8_t * str), pixel_len_t max_length) { +static int lcd_put_u8str_max_cb(const char * utf8_str, read_byte_cb_t cb_read_byte, const pixel_len_t max_length) { pixel_len_t ret = 0; - uint8_t *p = (uint8_t *)utf8_str; + const uint8_t *p = (uint8_t *)utf8_str; while (ret < max_length) { wchar_t ch = 0; p = get_utf8_value_cb(p, cb_read_byte, &ch); @@ -1057,11 +1057,11 @@ static int lcd_put_u8str_max_cb(const char * utf8_str, uint8_t (*cb_read_byte)(u return (int)ret; } -int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length) { +int lcd_put_u8str_max(const char * utf8_str, const pixel_len_t max_length) { return lcd_put_u8str_max_cb(utf8_str, read_byte_ram, max_length); } -int lcd_put_u8str_max_P(PGM_P utf8_pstr, pixel_len_t max_length) { +int lcd_put_u8str_max_P(PGM_P utf8_pstr, const pixel_len_t max_length) { return lcd_put_u8str_max_cb(utf8_pstr, read_byte_rom, max_length); } diff --git a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp index ca830960cb8f..46564bb1e6e2 100644 --- a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp +++ b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp @@ -380,9 +380,13 @@ void MarlinUI::clear_lcd() { void MarlinUI::_set_contrast() { lcd.setContrast(contrast); } #endif +#if !IS_TFTGLCD_PANEL + void lcd_moveto(const uint8_t col, const uint8_t row) { lcd.setCursor(col, row); } +#endif + static void center_text(FSTR_P const fstart, const uint8_t y) { const uint8_t len = utf8_strlen(fstart); - lcd.setCursor(len < LCD_WIDTH ? (LCD_WIDTH - len) / 2 : 0, y); + lcd_moveto(len < LCD_WIDTH ? (LCD_WIDTH - len) / 2 : 0, y); lcd_put_u8str(fstart); } @@ -396,9 +400,9 @@ static void center_text(FSTR_P const fstart, const uint8_t y) { uint8_t indent = (LCD_WIDTH - 8) / 2; // symbols 217 (bottom right corner) and 218 (top left corner) are using for letters in some languages // and they should be moved to beginning ASCII table as special symbols - lcd.setCursor(indent, 0); lcd.write(TLC); lcd_put_u8str(F("------")); lcd.write(TRC); - lcd.setCursor(indent, 1); lcd.write(LR); lcd_put_u8str(F("Marlin")); lcd.write(LR); - lcd.setCursor(indent, 2); lcd.write(BLC); lcd_put_u8str(F("------")); lcd.write(BRC); + lcd_moveto(indent, 0); lcd.write(TLC); lcd_put_u8str(F("------")); lcd.write(TRC); + lcd_moveto(indent, 1); lcd.write(LR); lcd_put_u8str(F("Marlin")); lcd.write(LR); + lcd_moveto(indent, 2); lcd.write(BLC); lcd_put_u8str(F("------")); lcd.write(BRC); center_text(F(SHORT_BUILD_VERSION), 3); center_text(F(MARLIN_WEBSITE_URL), 4); picBits = ICON_LOGO; @@ -414,8 +418,8 @@ static void center_text(FSTR_P const fstart, const uint8_t y) { void MarlinUI::draw_kill_screen() { if (!PanelDetected) return; lcd.clear_buffer(); - lcd.setCursor(0, 3); lcd.write(COLOR_ERROR); - lcd.setCursor((LCD_WIDTH - utf8_strlen(status_message)) / 2 + 1, 3); + lcd_moveto(0, 3); lcd.write(COLOR_ERROR); + lcd_moveto((LCD_WIDTH - utf8_strlen(status_message)) / 2 + 1, 3); lcd_put_u8str(status_message); center_text(GET_TEXT_F(MSG_HALTED), 5); center_text(GET_TEXT_F(MSG_PLEASE_RESET), 6); @@ -453,25 +457,25 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const #if HOTENDS < 2 if (heater_id == H_E0) { - lcd.setCursor(2, 5); lcd.print(prefix); //HE - lcd.setCursor(1, 6); lcd.print(i16tostr3rj(t1)); - lcd.setCursor(1, 7); + lcd_moveto(2, 5); lcd.print(prefix); //HE + lcd_moveto(1, 6); lcd.print(i16tostr3rj(t1)); + lcd_moveto(1, 7); } else { - lcd.setCursor(6, 5); lcd.print(prefix); //BED - lcd.setCursor(6, 6); lcd.print(i16tostr3rj(t1)); - lcd.setCursor(6, 7); + lcd_moveto(6, 5); lcd.print(prefix); //BED + lcd_moveto(6, 6); lcd.print(i16tostr3rj(t1)); + lcd_moveto(6, 7); } #else if (heater_id > H_BED) { - lcd.setCursor(heater_id * 4, 5); lcd.print(prefix); // HE1 or HE2 or HE3 - lcd.setCursor(heater_id * 4, 6); lcd.print(i16tostr3rj(t1)); - lcd.setCursor(heater_id * 4, 7); + lcd_moveto(heater_id * 4, 5); lcd.print(prefix); // HE1 or HE2 or HE3 + lcd_moveto(heater_id * 4, 6); lcd.print(i16tostr3rj(t1)); + lcd_moveto(heater_id * 4, 7); } else { - lcd.setCursor(13, 5); lcd.print(prefix); //BED - lcd.setCursor(13, 6); lcd.print(i16tostr3rj(t1)); - lcd.setCursor(13, 7); + lcd_moveto(13, 5); lcd.print(prefix); //BED + lcd_moveto(13, 6); lcd.print(i16tostr3rj(t1)); + lcd_moveto(13, 7); } #endif // HOTENDS <= 1 @@ -512,9 +516,9 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const FORCE_INLINE void _draw_cooler_status(const bool blink) { const celsius_t t2 = thermalManager.degTargetCooler(); - lcd.setCursor(0, 5); lcd_put_u8str(F("COOL")); - lcd.setCursor(1, 6); lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegCooler())); - lcd.setCursor(1, 7); + lcd_moveto(0, 5); lcd_put_u8str(F("COOL")); + lcd_moveto(1, 6); lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegCooler())); + lcd_moveto(1, 7); #if !HEATER_IDLE_HANDLER UNUSED(blink); @@ -540,9 +544,9 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const #if ENABLED(LASER_COOLANT_FLOW_METER) FORCE_INLINE void _draw_flowmeter_status() { - lcd.setCursor(5, 5); lcd_put_u8str(F("FLOW")); - lcd.setCursor(7, 6); lcd_put_wchar('L'); - lcd.setCursor(6, 7); lcd_put_u8str(ftostr11ns(cooler.flowrate)); + lcd_moveto(5, 5); lcd_put_u8str(F("FLOW")); + lcd_moveto(7, 6); lcd_put_wchar('L'); + lcd_moveto(6, 7); lcd_put_u8str(ftostr11ns(cooler.flowrate)); if (cooler.flowrate) picBits |= ICON_FAN; else picBits &= ~ICON_FAN; @@ -553,18 +557,18 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const #if ENABLED(I2C_AMMETER) FORCE_INLINE void _draw_ammeter_status() { - lcd.setCursor(10, 5); lcd_put_u8str(F("ILAZ")); + lcd_moveto(10, 5); lcd_put_u8str(F("ILAZ")); ammeter.read(); - lcd.setCursor(11, 6); + lcd_moveto(11, 6); if (ammeter.current <= 0.999f) { lcd_put_u8str("mA"); - lcd.setCursor(10, 7); + lcd_moveto(10, 7); lcd_put_wchar(' '); lcd_put_u8str(ui16tostr3rj(uint16_t(ammeter.current * 1000 + 0.5f))); } else { lcd_put_u8str(" A"); - lcd.setCursor(10, 7); + lcd_moveto(10, 7); lcd_put_u8str(ftostr12ns(ammeter.current)); } @@ -577,16 +581,16 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const #if HAS_CUTTER FORCE_INLINE void _draw_cutter_status() { - lcd.setCursor(15, 5); lcd_put_u8str(F("CUTT")); + lcd_moveto(15, 5); lcd_put_u8str(F("CUTT")); #if CUTTER_UNIT_IS(RPM) - lcd.setCursor(16, 6); lcd_put_u8str(F("RPM")); - lcd.setCursor(15, 7); lcd_put_u8str(ftostr31ns(float(cutter.unitPower) / 1000)); + lcd_moveto(16, 6); lcd_put_u8str(F("RPM")); + lcd_moveto(15, 7); lcd_put_u8str(ftostr31ns(float(cutter.unitPower) / 1000)); lcd_put_wchar('K'); #elif CUTTER_UNIT_IS(PERCENT) - lcd.setCursor(17, 6); lcd_put_wchar('%'); - lcd.setCursor(18, 7); lcd_put_u8str(cutter_power2str(cutter.unitPower)); + lcd_moveto(17, 6); lcd_put_wchar('%'); + lcd_moveto(18, 7); lcd_put_u8str(cutter_power2str(cutter.unitPower)); #else - lcd.setCursor(17, 7); lcd_put_u8str(cutter_power2str(cutter.unitPower)); + lcd_moveto(17, 7); lcd_put_u8str(cutter_power2str(cutter.unitPower)); #endif if (cutter.unitPower) picBits |= ICON_HOT; @@ -622,10 +626,10 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const lcd.write('%'); lcd.write(percent); } else { // For progress bar test - lcd.setCursor(LCD_WIDTH / 2 - 2, MIDDLE_Y); - lcd.print(i16tostr3rj(percent)); lcd.write('%'); + lcd_moveto(LCD_WIDTH / 2 - 2, MIDDLE_Y); + lcd.print(i16tostr3rj(percent)); lcd.write('%'); lcd.print_line(); - lcd.setCursor(0, MIDDLE_Y + 1); + lcd_moveto(0, MIDDLE_Y + 1); lcd.write('%'); lcd.write(percent); lcd.print_line(); } @@ -635,7 +639,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const void MarlinUI::draw_status_message(const bool blink) { if (!PanelDetected) return; - lcd.setCursor(0, 3); + lcd_moveto(0, 3); #if BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT) // Alternate Status message and Filament display @@ -784,7 +788,7 @@ void MarlinUI::draw_status_screen() { // Line 1 - XYZ coordinates // - lcd.setCursor(0, 0); + lcd_moveto(0, 0); const xyz_pos_t lpos = current_position.asLogical(); _draw_axis_value(X_AXIS, ftostr4sign(lpos.x), blink); lcd.write(' '); _draw_axis_value(Y_AXIS, ftostr4sign(lpos.y), blink); lcd.write(' '); @@ -798,11 +802,11 @@ void MarlinUI::draw_status_screen() { // Line 2 - feedrate, , time // - lcd.setCursor(0, 1); + lcd_moveto(0, 1); lcd_put_u8str(F("FR")); lcd.print(i16tostr3rj(feedrate_percentage)); lcd.write('%'); #if BOTH(SDSUPPORT, HAS_PRINT_PROGRESS) - lcd.setCursor(LCD_WIDTH / 2 - 3, 1); + lcd_moveto(LCD_WIDTH / 2 - 3, 1); _draw_print_progress(); #endif @@ -810,14 +814,14 @@ void MarlinUI::draw_status_screen() { duration_t elapsed = print_job_timer.duration(); uint8_t len = elapsed.toDigital(buffer); - lcd.setCursor((LCD_WIDTH - 1) - len, 1); + lcd_moveto((LCD_WIDTH - 1) - len, 1); lcd.write(LCD_STR_CLOCK[0]); lcd.print(buffer); // // Line 3 - progressbar // - lcd.setCursor(0, 2); + lcd_moveto(0, 2); #if ENABLED(LCD_PROGRESS_BAR) draw_progress_bar(_get_progress()); #else @@ -836,7 +840,7 @@ void MarlinUI::draw_status_screen() { #if HOTENDS <= 1 || (HOTENDS <= 2 && !HAS_HEATED_BED) #if DUAL_MIXING_EXTRUDER - lcd.setCursor(0, 4); + lcd_moveto(0, 4); // Two-component mix / gradient instead of XY char mixer_messages[12]; const char *mix_label; @@ -892,9 +896,9 @@ void MarlinUI::draw_status_screen() { #else #define FANX 17 #endif - lcd.setCursor(FANX, 5); lcd_put_u8str(F("FAN")); - lcd.setCursor(FANX + 1, 6); lcd.write('%'); - lcd.setCursor(FANX, 7); + lcd_moveto(FANX, 5); lcd_put_u8str(F("FAN")); + lcd_moveto(FANX + 1, 6); lcd.write('%'); + lcd_moveto(FANX, 7); lcd.print(i16tostr3rj(per)); if (TERN0(HAS_FAN0, thermalManager.fan_speed[0]) || TERN0(HAS_FAN1, thermalManager.fan_speed[1]) || TERN0(HAS_FAN2, thermalManager.fan_speed[2])) @@ -927,7 +931,7 @@ void MarlinUI::draw_status_screen() { void MarlinUI::draw_hotend_status(const uint8_t row, const uint8_t extruder) { if (!PanelDetected) return; - lcd.setCursor((LCD_WIDTH - 14) / 2, row + 1); + lcd_moveto((LCD_WIDTH - 14) / 2, row + 1); lcd.write(LCD_STR_THERMOMETER[0]); lcd_put_u8str(F(" E")); lcd.write('1' + extruder); lcd.write(' '); lcd.print(i16tostr3rj(thermalManager.wholeDegHotend(extruder))); lcd.write(LCD_STR_DEGREE[0]); lcd.write('/'); lcd.print(i16tostr3rj(thermalManager.degTargetHotend(extruder))); lcd.write(LCD_STR_DEGREE[0]); @@ -940,12 +944,12 @@ void MarlinUI::draw_status_screen() { void MenuItem_static::draw(const uint8_t row, FSTR_P const fstr, const uint8_t style/*=SS_DEFAULT*/, const char * const valstr/*=nullptr*/) { if (!PanelDetected) return; uint8_t n = LCD_WIDTH; - lcd.setCursor(0, row); + lcd_moveto(0, row); if ((style & SS_CENTER) && !valstr) { int8_t pad = (LCD_WIDTH - utf8_strlen(fstr)) / 2; while (--pad >= 0) { lcd.write(' '); n--; } } - n = lcd_put_u8str_ind(fstr, itemIndex, itemString, n); + n = lcd_put_u8str(fstr, itemIndex, itemStringC, itemStringF, n); if (valstr) n -= lcd_put_u8str_max(valstr, n); for (; n; --n) lcd.write(' '); lcd.print_line(); @@ -954,25 +958,25 @@ void MarlinUI::draw_status_screen() { // Draw a generic menu item with pre_char (if selected) and post_char void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char pre_char, const char post_char) { if (!PanelDetected) return; - lcd.setCursor(0, row); + lcd_moveto(0, row); lcd.write(sel ? pre_char : ' '); - uint8_t n = lcd_put_u8str_ind(fstr, itemIndex, itemString, LCD_WIDTH - 2); + uint8_t n = lcd_put_u8str(fstr, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2); for (; n; --n) lcd.write(' '); lcd.write(post_char); lcd.print_line(); } // Draw a menu item with a (potentially) editable value - void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char * const data, const bool pgm) { + void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char * const inStr, const bool pgm) { if (!PanelDetected) return; - const uint8_t vlen = data ? (pgm ? utf8_strlen_P(data) : utf8_strlen(data)) : 0; - lcd.setCursor(0, row); + const uint8_t vlen = inStr ? (pgm ? utf8_strlen_P(inStr) : utf8_strlen(inStr)) : 0; + lcd_moveto(0, row); lcd.write(sel ? LCD_STR_ARROW_RIGHT[0] : ' '); - uint8_t n = lcd_put_u8str_ind(fstr, itemIndex, itemString, LCD_WIDTH - 2 - vlen); + uint8_t n = lcd_put_u8str(fstr, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2 - vlen); if (vlen) { lcd.write(':'); for (; n; --n) lcd.write(' '); - if (pgm) lcd_put_u8str_P(data); else lcd_put_u8str(data); + if (pgm) lcd_put_u8str_P(inStr); else lcd_put_u8str(inStr); } lcd.print_line(); } @@ -983,12 +987,12 @@ void MarlinUI::draw_status_screen() { if (!PanelDetected) return; ui.encoder_direction_normal(); const uint8_t y = TERN0(AUTO_BED_LEVELING_UBL, ui.external_control) ? LCD_HEIGHT - 1 : MIDDLE_Y; - lcd.setCursor(0, y); + lcd_moveto(0, y); lcd.write(COLOR_EDIT); lcd_put_u8str(fstr); if (value) { lcd.write(':'); - lcd.setCursor((LCD_WIDTH - 1) - (utf8_strlen(value) + 1), y); // Right-justified, padded by spaces + lcd_moveto((LCD_WIDTH - 1) - (utf8_strlen(value) + 1), y); // Right-justified, padded by spaces lcd.write(' '); // Overwrite char if value gets shorter lcd.print(value); lcd.write(' '); @@ -1002,11 +1006,11 @@ void MarlinUI::draw_status_screen() { ui.draw_select_screen_prompt(pref, string, suff); lcd.write(COLOR_EDIT); if (no) { - lcd.setCursor(0, MIDDLE_Y); + lcd_moveto(0, MIDDLE_Y); lcd.write(yesno ? ' ' : '['); lcd_put_u8str(no); lcd.write(yesno ? ' ' : ']'); } if (yes) { - lcd.setCursor(LCD_WIDTH - utf8_strlen(yes) - 3, MIDDLE_Y); + lcd_moveto(LCD_WIDTH - utf8_strlen(yes) - 3, MIDDLE_Y); lcd.write(yesno ? '[' : ' '); lcd_put_u8str(yes); lcd.write(yesno ? ']' : ' '); } lcd.print_line(); @@ -1016,7 +1020,7 @@ void MarlinUI::draw_status_screen() { void MenuItem_sdbase::draw(const bool sel, const uint8_t row, FSTR_P const, CardReader &theCard, const bool isDir) { if (!PanelDetected) return; - lcd.setCursor(0, row); + lcd_moveto(0, row); lcd.write(sel ? LCD_STR_ARROW_RIGHT[0] : ' '); constexpr uint8_t maxlen = LCD_WIDTH - 2; uint8_t n = maxlen - lcd_put_u8str_max(ui.scrolled_filename(theCard, maxlen, row, sel), maxlen); @@ -1055,23 +1059,23 @@ void MarlinUI::draw_status_screen() { lcd.clear_buffer(); //print only top left corner. All frame with grid points will be printed by panel - lcd.setCursor(0, 0); + lcd_moveto(0, 0); *fb++ = TLC; //top left corner - marker for plot parameters *fb = (GRID_MAX_POINTS_X << 4) + GRID_MAX_POINTS_Y; //set mesh size // Print plot position - lcd.setCursor(_LCD_W_POS, 0); - *fb++ = '('; lcd.print(i16tostr3left(x_plot)); - *fb++ = ','; lcd.print(i16tostr3left(y_plot)); *fb = ')'; + lcd_moveto(_LCD_W_POS, 0); + *fb++ = '('; lcd.print(i16tostr3left(x_plot)); + *fb++ = ','; lcd.print(i16tostr3left(y_plot)); *fb = ')'; // Show all values - lcd.setCursor(_LCD_W_POS, 1); lcd_put_u8str(F("X:")); + lcd_moveto(_LCD_W_POS, 1); lcd_put_u8str(F("X:")); lcd.print(ftostr52(LOGICAL_X_POSITION(pgm_read_float(&bedlevel._mesh_index_to_xpos[x_plot])))); - lcd.setCursor(_LCD_W_POS, 2); lcd_put_u8str(F("Y:")); + lcd_moveto(_LCD_W_POS, 2); lcd_put_u8str(F("Y:")); lcd.print(ftostr52(LOGICAL_Y_POSITION(pgm_read_float(&bedlevel._mesh_index_to_ypos[y_plot])))); // Show the location value - lcd.setCursor(_LCD_W_POS, 3); lcd_put_u8str(F("Z:")); + lcd_moveto(_LCD_W_POS, 3); lcd_put_u8str(F("Z:")); if (!isnan(bedlevel.z_values[x_plot][y_plot])) lcd.print(ftostr43sign(bedlevel.z_values[x_plot][y_plot])); diff --git a/Marlin/src/lcd/dogm/lcdprint_u8g.cpp b/Marlin/src/lcd/dogm/lcdprint_u8g.cpp index f74a59a08c7c..f5c13798f234 100644 --- a/Marlin/src/lcd/dogm/lcdprint_u8g.cpp +++ b/Marlin/src/lcd/dogm/lcdprint_u8g.cpp @@ -28,7 +28,7 @@ void lcd_put_int(const int i) { u8g.print(i); } // return < 0 on error // return the advanced pixels -int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) { +int lcd_put_wchar_max(const wchar_t c, const pixel_len_t max_length) { if (c < 256) { u8g.print((char)c); return u8g_GetFontBBXWidth(u8g.getU8g()); @@ -39,14 +39,14 @@ int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) { return ret; } -int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length) { +int lcd_put_u8str_max(const char * utf8_str, const pixel_len_t max_length) { u8g_uint_t x = u8g.getPrintCol(), y = u8g.getPrintRow(), ret = uxg_DrawUtf8Str(u8g.getU8g(), x, y, utf8_str, max_length); u8g.setPrintPos(x + ret, y); return ret; } -int lcd_put_u8str_max_P(PGM_P utf8_pstr, pixel_len_t max_length) { +int lcd_put_u8str_max_P(PGM_P utf8_pstr, const pixel_len_t max_length) { u8g_uint_t x = u8g.getPrintCol(), y = u8g.getPrintRow(), ret = uxg_DrawUtf8StrP(u8g.getU8g(), x, y, utf8_pstr, max_length); u8g.setPrintPos(x + ret, y); diff --git a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp index 3b40343628b0..3c661a44294a 100644 --- a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp +++ b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp @@ -330,13 +330,13 @@ void MarlinUI::update_language_font() { // The kill screen is displayed for unrecoverable conditions void MarlinUI::draw_kill_screen() { TERN_(LIGHTWEIGHT_UI, ST7920_Lite_Status_Screen::clear_text_buffer()); - const u8g_uint_t h4 = u8g.getHeight() / 4; + const u8g_uint_t x = 0, h4 = u8g.getHeight() / 4; u8g.firstPage(); do { set_font(FONT_MENU); - lcd_put_u8str(0, h4 * 1, status_message); - lcd_put_u8str(0, h4 * 2, GET_TEXT_F(MSG_HALTED)); - lcd_put_u8str(0, h4 * 3, GET_TEXT_F(MSG_PLEASE_RESET)); + lcd_put_u8str(x, h4 * 1, status_message); + lcd_put_u8str(x, h4 * 2, GET_TEXT_F(MSG_HALTED)); + lcd_put_u8str(x, h4 * 3, GET_TEXT_F(MSG_PLEASE_RESET)); } while (u8g.nextPage()); } @@ -412,28 +412,28 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop } // Draw a static line of text in the same idiom as a menu item - void MenuItem_static::draw(const uint8_t row, FSTR_P const fstr, const uint8_t style/*=SS_DEFAULT*/, const char * const vstr/*=nullptr*/) { + void MenuItem_static::draw(const uint8_t row, FSTR_P const ftpl, const uint8_t style/*=SS_DEFAULT*/, const char * const vstr/*=nullptr*/) { if (mark_as_selected(row, style & SS_INVERT)) { pixel_len_t n = LCD_PIXEL_WIDTH; // pixel width of string allowed - const int plen = fstr ? calculateWidth(FTOP(fstr)) : 0, + const int plen = ftpl ? calculateWidth(ftpl) : 0, vlen = vstr ? utf8_strlen(vstr) : 0; if (style & SS_CENTER) { int pad = (LCD_PIXEL_WIDTH - plen - vlen * MENU_FONT_WIDTH) / MENU_FONT_WIDTH / 2; while (--pad >= 0) n -= lcd_put_wchar(' '); } - if (plen) n = lcd_put_u8str_ind(fstr, itemIndex, itemString, n / (MENU_FONT_WIDTH)) * (MENU_FONT_WIDTH); + if (plen) n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, n / (MENU_FONT_WIDTH)) * (MENU_FONT_WIDTH); if (vlen) n -= lcd_put_u8str_max(vstr, n); while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' '); } } // Draw a generic menu item - void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char, const char post_char) { + void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char, const char post_char) { if (mark_as_selected(row, sel)) { - pixel_len_t n = lcd_put_u8str_ind(fstr, itemIndex, itemString, LCD_WIDTH - 1) * (MENU_FONT_WIDTH); + pixel_len_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 1) * (MENU_FONT_WIDTH); while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' '); lcd_put_wchar(LCD_PIXEL_WIDTH - (MENU_FONT_WIDTH), row_y2, post_char); lcd_put_wchar(' '); @@ -441,27 +441,27 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop } // Draw a menu item with an editable value - void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char * const inStr, const bool pgm) { + void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char * const inStr, const bool pgm) { if (mark_as_selected(row, sel)) { - const uint8_t vallen = (pgm ? utf8_strlen_P(inStr) : utf8_strlen((char*)inStr)), - pixelwidth = (pgm ? uxg_GetUtf8StrPixelWidthP(u8g.getU8g(), inStr) : uxg_GetUtf8StrPixelWidth(u8g.getU8g(), (char*)inStr)); + const uint8_t vallen = (pgm ? utf8_strlen_P(inStr) : utf8_strlen(inStr)), + pixelwidth = (pgm ? uxg_GetUtf8StrPixelWidthP(u8g.getU8g(), inStr) : uxg_GetUtf8StrPixelWidth(u8g.getU8g(), inStr)); const u8g_uint_t prop = USE_WIDE_GLYPH ? 2 : 1; - pixel_len_t n = lcd_put_u8str_ind(fstr, itemIndex, itemString, LCD_WIDTH - 2 - vallen * prop) * (MENU_FONT_WIDTH); + pixel_len_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2 - vallen * prop) * (MENU_FONT_WIDTH); if (vallen) { lcd_put_wchar(':'); while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' '); lcd_moveto(LCD_PIXEL_WIDTH - _MAX((MENU_FONT_WIDTH) * vallen, pixelwidth + 2), row_y2); - if (pgm) lcd_put_u8str_P(inStr); else lcd_put_u8str((char*)inStr); + if (pgm) lcd_put_u8str_P(inStr); else lcd_put_u8str(inStr); } } } - void MenuEditItemBase::draw_edit_screen(FSTR_P const fstr, const char * const value/*=nullptr*/) { + void MenuEditItemBase::draw_edit_screen(FSTR_P const ftpl, const char * const value/*=nullptr*/) { ui.encoder_direction_normal(); const u8g_uint_t prop = USE_WIDE_GLYPH ? 2 : 1; - const u8g_uint_t labellen = utf8_strlen(fstr), vallen = utf8_strlen(value); + const u8g_uint_t labellen = utf8_strlen(ftpl), vallen = utf8_strlen(value); bool extra_row = labellen * prop > LCD_WIDTH - 2 - vallen * prop; #if ENABLED(USE_BIG_EDIT_FONT) @@ -490,7 +490,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop // Assume the label is alpha-numeric (with a descender) bool onpage = PAGE_CONTAINS(baseline - (EDIT_FONT_ASCENT - 1), baseline + EDIT_FONT_DESCENT); - if (onpage) lcd_put_u8str_ind(0, baseline, fstr, itemIndex, itemString); + if (onpage) lcd_put_u8str(0, baseline, ftpl, itemIndex, itemStringC, itemStringF); // If a value is included, print a colon, then print the value right-justified if (value) { @@ -522,8 +522,8 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop if (inv) u8g.setColorIndex(1); } - void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, const bool yesno, FSTR_P const pref, const char * const string/*=nullptr*/, FSTR_P const suff/*=nullptr*/) { - ui.draw_select_screen_prompt(pref, string, suff); + void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, const bool yesno, FSTR_P const fpre, const char * const string/*=nullptr*/, FSTR_P const suff/*=nullptr*/) { + ui.draw_select_screen_prompt(fpre, string, suff); if (no) draw_boxed_string(1, LCD_HEIGHT - 1, no, !yesno); if (yes) draw_boxed_string(LCD_WIDTH - (utf8_strlen(yes) * (USE_WIDE_GLYPH ? 2 : 1) + 1), LCD_HEIGHT - 1, yes, yesno); } diff --git a/Marlin/src/lcd/dogm/u8g_fontutf8.cpp b/Marlin/src/lcd/dogm/u8g_fontutf8.cpp index 89bdb09e1be2..8ba0e7d50a8b 100644 --- a/Marlin/src/lcd/dogm/u8g_fontutf8.cpp +++ b/Marlin/src/lcd/dogm/u8g_fontutf8.cpp @@ -104,7 +104,7 @@ static void fontgroup_drawwchar(font_group_t *group, const font_t *fnt_default, * Get the screen pixel width of a ROM UTF-8 string */ static void fontgroup_drawstring(font_group_t *group, const font_t *fnt_default, const char *utf8_msg, read_byte_cb_t cb_read_byte, void * userdata, fontgroup_cb_draw_t cb_draw_ram) { - uint8_t *p = (uint8_t*)utf8_msg; + const uint8_t *p = (uint8_t*)utf8_msg; for (;;) { wchar_t val = 0; p = get_utf8_value_cb(p, cb_read_byte, &val); diff --git a/Marlin/src/lcd/dogm/u8g_fontutf8.h b/Marlin/src/lcd/dogm/u8g_fontutf8.h index 9760ef106bd1..5933f027cc79 100644 --- a/Marlin/src/lcd/dogm/u8g_fontutf8.h +++ b/Marlin/src/lcd/dogm/u8g_fontutf8.h @@ -26,10 +26,10 @@ typedef struct _uxg_fontinfo_t { int uxg_SetUtf8Fonts(const uxg_fontinfo_t * fntinfo, int number); // fntinfo is type of PROGMEM -unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, wchar_t ch, pixel_len_t max_length); +unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, wchar_t ch, const pixel_len_t max_length); -unsigned int uxg_DrawUtf8Str(u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, pixel_len_t max_length); -unsigned int uxg_DrawUtf8StrP(u8g_t *pu8g, unsigned int x, unsigned int y, PGM_P utf8_msg, pixel_len_t max_length); +unsigned int uxg_DrawUtf8Str(u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, const pixel_len_t max_length); +unsigned int uxg_DrawUtf8StrP(u8g_t *pu8g, unsigned int x, unsigned int y, PGM_P utf8_msg, const pixel_len_t max_length); int uxg_GetUtf8StrPixelWidth(u8g_t *pu8g, const char *utf8_msg); int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, PGM_P utf8_msg); diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index f8ba1090d91b..19155fd5e55d 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -4280,14 +4280,14 @@ void CrealityDWINClass::Print_Screen_Control() { card.startOrResumeFilePrinting(); TERN_(POWER_LOSS_RECOVERY, recovery.prepare()); #else - char cmnd[20]; + char cmd[20]; #if HAS_HEATED_BED - cmnd[sprintf_P(cmnd, PSTR("M140 S%i"), pausebed)] = '\0'; - gcode.process_subcommands_now(cmnd); + sprintf_P(cmd, PSTR("M140 S%i"), pausebed); + gcode.process_subcommands_now(cmd); #endif #if HAS_EXTRUDERS - cmnd[sprintf_P(cmnd, PSTR("M109 S%i"), pausetemp)] = '\0'; - gcode.process_subcommands_now(cmnd); + sprintf_P(cmd, PSTR("M109 S%i"), pausetemp); + gcode.process_subcommands_now(cmd); #endif TERN_(HAS_FAN, thermalManager.fan_speed[0] = pausefan); planner.synchronize(); diff --git a/Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp b/Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp index 52a0ff62fdcc..30e86270c726 100644 --- a/Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp @@ -27,35 +27,35 @@ #include "dwin_string.h" //#include "../../fontutils.h" -uint8_t DWIN_String::data[]; +char DWIN_String::data[]; uint16_t DWIN_String::span; -uint8_t DWIN_String::len; +uint8_t DWIN_String::length; void DWIN_String::set() { //*data = 0x00; memset(data, 0x00, sizeof(data)); span = 0; - len = 0; + length = 0; } -uint8_t read_byte(uint8_t *byte) { return *byte; } +uint8_t read_byte(const uint8_t *byte) { return *byte; } /** * Add a string, applying substitutions for the following characters: * - * $ displays the clipped C-string given by the inStr argument + * $ displays the clipped string given by fstr or cstr * = displays '0'....'10' for indexes 0 - 10 * ~ displays '1'....'11' for indexes 0 - 10 * * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL) * @ displays an axis name such as XYZUVW, or E for an extruder */ -void DWIN_String::add(uint8_t *string, const int8_t index, uint8_t *inStr/*=nullptr*/) { +void DWIN_String::add(const char *tpl, const int8_t index, const char *cstr/*=nullptr*/, FSTR_P const fstr/*=nullptr*/) { wchar_t wchar; - while (*string) { - string = get_utf8_value_cb(string, read_byte, &wchar); + while (*tpl) { + tpl = get_utf8_value_cb(tpl, read_byte, &wchar); if (wchar > 255) wchar |= 0x0080; - uint8_t ch = uint8_t(wchar & 0x00FF); + const uint8_t ch = uint8_t(wchar & 0x00FF); if (ch == '=' || ch == '~' || ch == '*') { if (index >= 0) { @@ -65,10 +65,12 @@ void DWIN_String::add(uint8_t *string, const int8_t index, uint8_t *inStr/*=null add_character('0' + inum); } else - add(index == -2 ? GET_TEXT(MSG_CHAMBER) : GET_TEXT(MSG_BED)); + add(index == -2 ? GET_TEXT_F(MSG_CHAMBER) : GET_TEXT_F(MSG_BED)); } - else if (ch == '$' && inStr) - add(inStr); + else if (ch == '$' && fstr) + add(fstr); + else if (ch == '$' && cstr) + add(cstr); else if (ch == '@') add_character(AXIS_CHAR(index)); else @@ -77,10 +79,10 @@ void DWIN_String::add(uint8_t *string, const int8_t index, uint8_t *inStr/*=null eol(); } -void DWIN_String::add(uint8_t *string, uint8_t max_len) { +void DWIN_String::add(const char *cstr, uint8_t max_len/*=MAX_STRING_LENGTH*/) { wchar_t wchar; - while (*string && max_len) { - string = get_utf8_value_cb(string, read_byte, &wchar); + while (*cstr && max_len) { + cstr = get_utf8_value_cb(cstr, read_byte, &wchar); /* if (wchar > 255) wchar |= 0x0080; uint8_t ch = uint8_t(wchar & 0x00FF); @@ -92,7 +94,7 @@ void DWIN_String::add(uint8_t *string, uint8_t max_len) { eol(); } -void DWIN_String::add(wchar_t character) { +void DWIN_String::add(const wchar_t character) { int ret; size_t idx = 0; dwin_charmap_t pinval; @@ -127,18 +129,18 @@ void DWIN_String::add(wchar_t character) { if (str[1]) add_character(str[1]); } -void DWIN_String::add_character(const uint8_t character) { - if (len < MAX_STRING_LENGTH) { - data[len] = character; - len++; +void DWIN_String::add_character(const char character) { + if (length < MAX_STRING_LENGTH) { + data[length] = character; + length++; //span += glyph(character)->DWidth; } } -void DWIN_String::rtrim(const uint8_t character) { - while (len) { - if (data[len - 1] == 0x20 || data[len - 1] == character) { - len--; +void DWIN_String::rtrim(const char character) { + while (length) { + if (data[length - 1] == 0x20 || data[length - 1] == character) { + length--; //span -= glyph(data[length])->DWidth; eol(); } @@ -147,18 +149,18 @@ void DWIN_String::rtrim(const uint8_t character) { } } -void DWIN_String::ltrim(const uint8_t character) { +void DWIN_String::ltrim(const char character) { uint16_t i, j; - for (i = 0; (i < len) && (data[i] == 0x20 || data[i] == character); i++) { + for (i = 0; (i < length) && (data[i] == 0x20 || data[i] == character); i++) { //span -= glyph(data[i])->DWidth; } if (i == 0) return; - for (j = 0; i < len; data[j++] = data[i++]); - len = j; + for (j = 0; i < length; data[j++] = data[i++]); + length = j; eol(); } -void DWIN_String::trim(const uint8_t character) { +void DWIN_String::trim(const char character) { rtrim(character); ltrim(character); } diff --git a/Marlin/src/lcd/e3v2/marlinui/dwin_string.h b/Marlin/src/lcd/e3v2/marlinui/dwin_string.h index d013d56a870e..c29777ae7b12 100644 --- a/Marlin/src/lcd/e3v2/marlinui/dwin_string.h +++ b/Marlin/src/lcd/e3v2/marlinui/dwin_string.h @@ -21,6 +21,8 @@ */ #pragma once +// TODO: Make AVR-compatible with separate ROM / RAM string methods + #include "../../fontutils.h" #include "../../marlinui.h" @@ -41,14 +43,14 @@ class DWIN_String { //static glyph_t *glyphs[256]; //static font_t *font_header; - static uint8_t data[MAX_STRING_LENGTH + 1]; + static char data[MAX_STRING_LENGTH + 1]; static uint16_t span; // in pixels - static uint8_t len; // in characters - static void add_character(const uint8_t character); - static void eol() { data[len] = 0x00; } + static void add_character(const char character); + static void eol() { data[length] = 0x00; } public: + static uint8_t length; // in characters //static void set_font(const uint8_t *font); //static void add_glyphs(const uint8_t *font); @@ -57,34 +59,71 @@ class DWIN_String { //static glyph_t *glyph(uint8_t character) { return glyphs[character] ?: glyphs[0x3F]; } /* Use '?' for unknown glyphs */ //static glyph_t *glyph(uint8_t *character) { return glyph(*character); } + /** + * @brief Set the string empty + */ static void set(); - //static void add(uint8_t character) { add_character(character); eol(); } - static void add(wchar_t character); - static void add(uint8_t *string, uint8_t max_len=MAX_STRING_LENGTH); - static void add(uint8_t *string, const int8_t index, uint8_t *inStr=nullptr); - static void set(uint8_t *string) { set(); add(string); } - static void set(wchar_t character) { set(); add(character); } - static void set(uint8_t *string, int8_t index, const char *inStr=nullptr) { set(); add(string, index, (uint8_t *)inStr); } - static void set(const char *string) { set((uint8_t *)string); } - static void set(const char *string, int8_t index, const char *inStr=nullptr) { set((uint8_t *)string, index, inStr); } - static void add(const char *string) { add((uint8_t *)string); } - static void add(FSTR_P const string, uint8_t max_len=MAX_STRING_LENGTH) { add((uint8_t *)FTOP(string), max_len); } - static void add(FSTR_P const string, int8_t index, uint8_t *inStr=nullptr) { add((uint8_t *)FTOP(string), index, inStr); } - static void set(FSTR_P const string) { set((uint8_t *)FTOP(string)); } - static void set(FSTR_P const string, int8_t index, const char *inStr=nullptr) { set((uint8_t *)FTOP(string), index, inStr); } - static void add(FSTR_P const string) { add((uint8_t *)FTOP(string)); } + //static void add(const char character) { add_character(character); eol(); } - static void trim(const uint8_t character=0x20); - static void rtrim(const uint8_t character=0x20); - static void ltrim(const uint8_t character=0x20); - - static void truncate(uint8_t maxlen) { if (len > maxlen) { len = maxlen; eol(); } } + /** + * @brief Append a UTF-8 character + * + * @param character The UTF-8 character + */ + static void add(wchar_t character); + static void set(wchar_t character) { set(); add(character); } - static uint8_t length() { return len; } + /** + * @brief Append / Set C-string + * + * @param cstr The string + * @param max_len Character limit + */ + static void add(const char *cstr, uint8_t max_len=MAX_STRING_LENGTH); + static void set(const char *cstr) { set(); add(cstr); } + + /** + * @brief Append / Set F-string + * + * @param fstr The string + * @param max_len Character limit + */ + static void add(FSTR_P const fstr, uint8_t max_len=MAX_STRING_LENGTH) { add(FTOP(fstr), max_len); } + static void set(FSTR_P const fstr) { set(FTOP(fstr)); } + + /** + * @brief Append / Set C-string with optional substitution + * + * @param tpl A string with optional substitution + * @param index An index + * @param cstr An SRAM C-string to use for $ substitution + * @param fstr A ROM F-string to use for $ substitution + */ + static void add(const char *tpl, const int8_t index, const char *cstr=nullptr, FSTR_P const fstr=nullptr); + static void set(const char *tpl, const int8_t index, const char *cstr=nullptr, FSTR_P const fstr=nullptr) { set(); add(tpl, index, cstr, fstr); } + + /** + * @brief Append / Set F-string with optional substitution + * + * @param ftpl A ROM F-string with optional substitution + * @param index An index + * @param cstr An SRAM C-string to use for $ substitution + * @param fstr A ROM F-string to use for $ substitution + */ + static void add(FSTR_P const ftpl, const int8_t index, const char *cstr=nullptr, FSTR_P const fstr=nullptr) { add(FTOP(ftpl), index, cstr, fstr); } + static void set(FSTR_P const ftpl, const int8_t index, const char *cstr=nullptr, FSTR_P const fstr=nullptr) { set(); add(ftpl, index, cstr, fstr); } + + // Common string ops + static void trim(const char character=' '); + static void rtrim(const char character=' '); + static void ltrim(const char character=' '); + static void truncate(const uint8_t maxlen) { if (length > maxlen) { length = maxlen; eol(); } } + + // Accessors + static char *string() { return data; } static uint16_t width() { return span; } - static uint8_t *string() { return data; } - static uint16_t center(uint16_t width) { return span > width ? 0 : (width - span) / 2; } + static uint16_t center(const uint16_t width) { return span > width ? 0 : (width - span) / 2; } }; int dwin_charmap_compare(dwin_charmap_t *v1, dwin_charmap_t *v2); diff --git a/Marlin/src/lcd/e3v2/marlinui/lcdprint_dwin.cpp b/Marlin/src/lcd/e3v2/marlinui/lcdprint_dwin.cpp index 44be749d41fc..278f17fac994 100644 --- a/Marlin/src/lcd/e3v2/marlinui/lcdprint_dwin.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/lcdprint_dwin.cpp @@ -56,20 +56,20 @@ void lcd_put_int(const int i) { } int lcd_put_dwin_string() { - DWIN_Draw_String(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, (char*)dwin_string.string()); - lcd_advance_cursor(dwin_string.length()); - return dwin_string.length(); + DWIN_Draw_String(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, dwin_string.string()); + lcd_advance_cursor(dwin_string.length); + return dwin_string.length; } // return < 0 on error // return the advanced cols -int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) { +int lcd_put_wchar_max(const wchar_t c, const pixel_len_t max_length) { dwin_string.set(c); dwin_string.truncate(max_length); // Draw the char(s) at the cursor and advance the cursor - DWIN_Draw_String(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, (char*)dwin_string.string()); - lcd_advance_cursor(dwin_string.length()); - return dwin_string.length(); + DWIN_Draw_String(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, dwin_string.string()); + lcd_advance_cursor(dwin_string.length); + return dwin_string.length; } /** @@ -83,35 +83,34 @@ int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) { * * Draw a UTF-8 string */ -static int lcd_put_u8str_max_cb(const char * utf8_str, uint8_t (*cb_read_byte)(uint8_t * str), pixel_len_t max_length) { - uint8_t *p = (uint8_t *)utf8_str; +static int lcd_put_u8str_max_cb(const char * utf8_str, read_byte_cb_t cb_read_byte, const pixel_len_t max_length) { + const uint8_t *p = (uint8_t *)utf8_str; dwin_string.set(); - while (dwin_string.length() < max_length) { + while (dwin_string.length < max_length) { wchar_t ch = 0; p = get_utf8_value_cb(p, cb_read_byte, &ch); if (!ch) break; dwin_string.add(ch); } - DWIN_Draw_String(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, (char*)dwin_string.string()); - lcd_advance_cursor(dwin_string.length()); - return dwin_string.length(); + DWIN_Draw_String(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, dwin_string.string()); + lcd_advance_cursor(dwin_string.length); + return dwin_string.length; } -int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length) { +int lcd_put_u8str_max(const char * utf8_str, const pixel_len_t max_length) { return lcd_put_u8str_max_cb(utf8_str, read_byte_ram, max_length); } -int lcd_put_u8str_max_P(PGM_P utf8_pstr, pixel_len_t max_length) { +int lcd_put_u8str_max_P(PGM_P utf8_pstr, const pixel_len_t max_length) { return lcd_put_u8str_max_cb(utf8_pstr, read_byte_rom, max_length); } -lcd_uint_t lcd_put_u8str_ind_P(PGM_P const pstr, const int8_t ind, PGM_P const inStr/*=nullptr*/, const lcd_uint_t maxlen/*=LCD_WIDTH*/) { - dwin_string.set(); - dwin_string.add((uint8_t*)pstr, ind, (uint8_t*)inStr); +lcd_uint_t lcd_put_u8str_P(PGM_P const ptpl, const int8_t ind, const char * const cstr/*=nullptr*/, FSTR_P const fstr/*=nullptr*/, const lcd_uint_t maxlen/*=LCD_WIDTH*/) { + dwin_string.set(ptpl, ind, cstr, fstr); dwin_string.truncate(maxlen); - DWIN_Draw_String(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, (char*)dwin_string.string()); - lcd_advance_cursor(dwin_string.length()); - return dwin_string.length(); + DWIN_Draw_String(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, dwin_string.string()); + lcd_advance_cursor(dwin_string.length); + return dwin_string.length; } #if ENABLED(DEBUG_LCDPRINT) diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp index d124c5294640..f01a2beddf4e 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp @@ -110,7 +110,7 @@ void MarlinUI::clear_lcd() { #define VERSION_Y 84 #endif - DWIN_Draw_String(false, font10x20, Color_Yellow, Color_Bg_Black, INFO_CENTER - (dwin_string.length() * 10) / 2, VERSION_Y, S(dwin_string.string())); + DWIN_Draw_String(false, font10x20, Color_Yellow, Color_Bg_Black, INFO_CENTER - (dwin_string.length * 10) / 2, VERSION_Y, S(dwin_string.string())); TERN_(SHOW_CUSTOM_BOOTSCREEN, safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT)); clear_lcd(); @@ -127,7 +127,7 @@ void MarlinUI::clear_lcd() { DWIN_ICON_Show(BOOT_ICON, ICON_MarlinURL, INFO_CENTER - 100 / 2, 152); DWIN_ICON_Show(BOOT_ICON, ICON_Copyright, INFO_CENTER - 126 / 2, 200); #endif - DWIN_Draw_String(false, font10x20, Color_Yellow, Color_Bg_Black, INFO_CENTER - (dwin_string.length() * 10) / 2, VERSION_Y, S(dwin_string.string())); + DWIN_Draw_String(false, font10x20, Color_Yellow, Color_Bg_Black, INFO_CENTER - (dwin_string.length * 10) / 2, VERSION_Y, S(dwin_string.string())); DWIN_UpdateLCD(); } @@ -284,7 +284,7 @@ void MarlinUI::draw_status_message(const bool blink) { else dwin_string.add(PSTR(" ")); - lcd_moveto(LCD_WIDTH - dwin_string.length(), row); + lcd_moveto(LCD_WIDTH - dwin_string.length, row); lcd_put_dwin_string(); } @@ -311,7 +311,7 @@ void MarlinUI::draw_status_message(const bool blink) { // Draw a static line of text in the same idiom as a menu item - void MenuItem_static::draw(const uint8_t row, FSTR_P const fstr, const uint8_t style/*=SS_DEFAULT*/, const char * const vstr/*=nullptr*/) { + void MenuItem_static::draw(const uint8_t row, FSTR_P const ftpl, const uint8_t style/*=SS_DEFAULT*/, const char * const vstr/*=nullptr*/) { // Call mark_as_selected to draw a bigger selection box // and draw the text without a background if (mark_as_selected(row, (bool)(style & SS_INVERT), true)) { @@ -320,15 +320,15 @@ void MarlinUI::draw_status_message(const bool blink) { dwin_font.fg = Color_White; dwin_string.set(); - const int8_t plen = fstr ? utf8_strlen(fstr) : 0, + const int8_t plen = ftpl ? utf8_strlen(ftpl) : 0, vlen = vstr ? utf8_strlen(vstr) : 0; if (style & SS_CENTER) { int8_t pad = (LCD_WIDTH - 1 - plen - vlen) / 2; while (--pad) dwin_string.add(' '); } - if (plen) dwin_string.add((uint8_t*)FTOP(fstr), itemIndex, (uint8_t*)FTOP(itemString)); - if (vlen) dwin_string.add((uint8_t*)vstr); + if (plen) dwin_string.add(ftpl, itemIndex, itemStringC, itemStringF); + if (vlen) dwin_string.add(vstr); if (style & SS_CENTER) { int8_t pad = (LCD_WIDTH - 1 - plen - vlen) / 2; while (--pad) dwin_string.add(' '); @@ -340,15 +340,15 @@ void MarlinUI::draw_status_message(const bool blink) { } // Draw a generic menu item - void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char, const char post_char) { + void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char, const char post_char) { if (mark_as_selected(row, sel)) { ui.set_font(DWIN_FONT_MENU); dwin_font.solid = false; dwin_font.fg = Color_White; - dwin_string.set(fstr, itemIndex, FTOP(itemString)); + dwin_string.set(ftpl, itemIndex, itemStringC, itemStringF); - pixel_len_t n = LCD_WIDTH - 1 - dwin_string.length(); + pixel_len_t n = LCD_WIDTH - 1 - dwin_string.length; while (--n > 1) dwin_string.add(' '); dwin_string.add(post_char); @@ -361,7 +361,7 @@ void MarlinUI::draw_status_message(const bool blink) { // // Draw a menu item with an editable value // - void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char * const inStr, const bool pgm) { + void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char * const inStr, const bool pgm) { if (mark_as_selected(row, sel)) { ui.set_font(DWIN_FONT_MENU); dwin_font.solid = false; @@ -369,7 +369,7 @@ void MarlinUI::draw_status_message(const bool blink) { const uint8_t vallen = (pgm ? utf8_strlen_P(inStr) : utf8_strlen(S(inStr))); - dwin_string.set(fstr, itemIndex, FTOP(itemString)); + dwin_string.set(ftpl, itemIndex, itemStringC, itemStringF); if (vallen) dwin_string.add(':'); lcd_moveto(1, row); @@ -392,8 +392,7 @@ void MarlinUI::draw_status_message(const bool blink) { const dwin_coord_t labellen = utf8_strlen(fstr), vallen = utf8_strlen(value); - dwin_string.set(); - dwin_string.add((uint8_t*)FTOP(fstr), itemIndex); + dwin_string.set(FTOP(fstr), itemIndex); if (vallen) dwin_string.add(':'); // If a value is included, add a colon // Assume the label is alpha-numeric (with a descender) @@ -406,8 +405,7 @@ void MarlinUI::draw_status_message(const bool blink) { // If a value is included, print the value in larger text below the label if (vallen) { - dwin_string.set(); - dwin_string.add(value); + dwin_string.set(value); const dwin_coord_t by = (row * MENU_LINE_HEIGHT) + MENU_FONT_HEIGHT + EXTRA_ROW_HEIGHT / 2; DWIN_Draw_String(true, font16x32, Color_Yellow, Color_Bg_Black, (LCD_PIXEL_WIDTH - vallen * 16) / 2, by, S(dwin_string.string())); @@ -464,8 +462,8 @@ void MarlinUI::draw_status_message(const bool blink) { maxlen -= 2; } - dwin_string.add((uint8_t*)ui.scrolled_filename(theCard, maxlen, row, sel), maxlen); - uint8_t n = maxlen - dwin_string.length(); + dwin_string.add(ui.scrolled_filename(theCard, maxlen, row, sel), maxlen); + uint8_t n = maxlen - dwin_string.length; while (n > 0) { dwin_string.add(' '); --n; } lcd_moveto(1, row); lcd_put_dwin_string(); @@ -548,7 +546,7 @@ void MarlinUI::draw_status_message(const bool blink) { dwin_string.add(i8tostr3rj(y_plot)); dwin_string.add(")"); lcd_moveto( - TERN(DWIN_MARLINUI_LANDSCAPE, ((x_offset + x_map_pixels) / MENU_FONT_WIDTH) + 2, LCD_WIDTH - dwin_string.length()), + TERN(DWIN_MARLINUI_LANDSCAPE, ((x_offset + x_map_pixels) / MENU_FONT_WIDTH) + 2, LCD_WIDTH - dwin_string.length), TERN(DWIN_MARLINUI_LANDSCAPE, LCD_HEIGHT - 2, ((y_offset + y_map_pixels) / MENU_LINE_HEIGHT) + 1) ); lcd_put_dwin_string(); @@ -560,7 +558,7 @@ void MarlinUI::draw_status_message(const bool blink) { else dwin_string.add(PSTR(" -----")); lcd_moveto( - TERN(DWIN_MARLINUI_LANDSCAPE, ((x_offset + x_map_pixels) / MENU_FONT_WIDTH) + 2, LCD_WIDTH - dwin_string.length()), + TERN(DWIN_MARLINUI_LANDSCAPE, ((x_offset + x_map_pixels) / MENU_FONT_WIDTH) + 2, LCD_WIDTH - dwin_string.length), TERN(DWIN_MARLINUI_LANDSCAPE, LCD_HEIGHT - 1, ((y_offset + y_map_pixels) / MENU_LINE_HEIGHT) + 2) ); lcd_put_dwin_string(); diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp index 20dbd45d67f3..edd8bb06f369 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp @@ -72,8 +72,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const uint8_t vallen = utf8_strlen(value); if (!ui.did_first_redraw) { - dwin_string.set(); - dwin_string.add('X' + axis); + dwin_string.set('X' + axis); DWIN_Draw_String(true, font16x32, Color_IconBlue, Color_Bg_Black, x + (vallen * 14 - 14) / 2, y + 2, S(dwin_string.string())); } @@ -96,8 +95,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const #else // !DWIN_MARLINUI_PORTRAIT if (!ui.did_first_redraw || ui.old_is_printing != print_job_timer.isRunning()) { - dwin_string.set(); - dwin_string.add('X' + axis); + dwin_string.set('X' + axis); DWIN_Draw_String(true, font16x32, Color_IconBlue, Color_Bg_Black, x, y, S(dwin_string.string())); } @@ -391,7 +389,7 @@ void MarlinUI::draw_status_screen() { time.toDigital(buffer); dwin_string.add(prefix); dwin_string.add(buffer); - DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, (LCD_PIXEL_WIDTH - ((dwin_string.length() + 1) * 14)), 290, S(dwin_string.string())); + DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, (LCD_PIXEL_WIDTH - ((dwin_string.length + 1) * 14)), 290, S(dwin_string.string())); #else @@ -454,7 +452,7 @@ void MarlinUI::draw_status_screen() { dwin_string.add(PSTR("%")); DWIN_Draw_String( false, font16x32, Percent_Color, Color_Bg_Black, - pb_left + (pb_width - dwin_string.length() * 16) / 2, + pb_left + (pb_width - dwin_string.length * 16) / 2, pb_top + (pb_height - 32) / 2, S(dwin_string.string()) ); diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index b4a1bad746bb..8594a899f913 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -3509,14 +3509,14 @@ void Draw_MaxSpeed_Menu() { if (!MaxSpeedMenu) MaxSpeedMenu = new MenuClass(); if (CurrentMenu != MaxSpeedMenu) { CurrentMenu = MaxSpeedMenu; - SetMenuTitle({1, 16, 28, 13}, GET_TEXT_F(MSG_MAXSPEED)); + SetMenuTitle({1, 16, 28, 13}, GET_TEXT_F(MSG_MAX_SPEED)); MenuItemsPrepare(5); BACK_ITEM(Draw_Motion_Menu); - EDIT_ITEM_F(ICON_MaxSpeedX, MSG_MAXSPEED_X, onDrawMaxSpeedX, SetMaxSpeedX, &planner.settings.max_feedrate_mm_s[X_AXIS]); - EDIT_ITEM_F(ICON_MaxSpeedY, MSG_MAXSPEED_Y, onDrawMaxSpeedY, SetMaxSpeedY, &planner.settings.max_feedrate_mm_s[Y_AXIS]); - EDIT_ITEM_F(ICON_MaxSpeedZ, MSG_MAXSPEED_Z, onDrawMaxSpeedZ, SetMaxSpeedZ, &planner.settings.max_feedrate_mm_s[Z_AXIS]); + EDIT_ITEM_F(ICON_MaxSpeedX, MSG_VMAX_A, onDrawMaxSpeedX, SetMaxSpeedX, &planner.settings.max_feedrate_mm_s[X_AXIS]); + EDIT_ITEM_F(ICON_MaxSpeedY, MSG_VMAX_B, onDrawMaxSpeedY, SetMaxSpeedY, &planner.settings.max_feedrate_mm_s[Y_AXIS]); + EDIT_ITEM_F(ICON_MaxSpeedZ, MSG_VMAX_C, onDrawMaxSpeedZ, SetMaxSpeedZ, &planner.settings.max_feedrate_mm_s[Z_AXIS]); #if HAS_HOTEND - EDIT_ITEM_F(ICON_MaxSpeedE, MSG_MAXSPEED_E, onDrawMaxSpeedE, SetMaxSpeedE, &planner.settings.max_feedrate_mm_s[E_AXIS]); + EDIT_ITEM_F(ICON_MaxSpeedE, MSG_VMAX_E, onDrawMaxSpeedE, SetMaxSpeedE, &planner.settings.max_feedrate_mm_s[E_AXIS]); #endif } CurrentMenu->draw(); diff --git a/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp b/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp index f2cefe0cb745..6cdafc8a935f 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp @@ -147,7 +147,7 @@ void DWIN_SRAMToPic(uint8_t picID) { //--------------------------Test area ------------------------- -//void DWIN_ReadSRAM(uint16_t addr, uint8_t length, const char * const data) { +//void DWIN_ReadSRAM(uint16_t addr, const uint8_t length, const char * const data) { // size_t i = 0; // DWIN_Byte(i, 0x32); // DWIN_Byte(i, 0x5A); // 0x5A Read from SRAM - 0xA5 Read from Flash diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/advanced_settings.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/advanced_settings.cpp index e9df264c1dd2..e3b95c4cd490 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/advanced_settings.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/advanced_settings.cpp @@ -54,7 +54,7 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) { .tag(7) .button(BTN_POS(2,1), BTN_SIZE(1,1), GET_TEXT_F(MSG_STEPS_PER_MM)) - .tag(8) .button(BTN_POS(2,2), BTN_SIZE(1,1), GET_TEXT_F(MSG_VELOCITY)) + .tag(8) .button(BTN_POS(2,2), BTN_SIZE(1,1), GET_TEXT_F(MSG_MAX_SPEED)) .tag(9) .button(BTN_POS(2,3), BTN_SIZE(1,1), GET_TEXT_F(MSG_ACCELERATION)) .tag(10) .button(BTN_POS(2,4), BTN_SIZE(1,1), GET_TEXT_F(TERN(HAS_JUNCTION_DEVIATION, MSG_JUNCTION_DEVIATION, MSG_JERK))) .enabled(ENABLED(BACKLASH_GCODE)) diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/advanced_settings_menu.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/advanced_settings_menu.cpp index 888f2c2cdd24..00cdf76331d6 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/advanced_settings_menu.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/advanced_settings_menu.cpp @@ -59,7 +59,7 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) { .tag(3) .button(TMC_CURRENT_POS, GET_TEXT_F(MSG_TMC_CURRENT)) .enabled(ENABLED(LIN_ADVANCE)) .tag(4) .button(LIN_ADVANCE_POS, GET_TEXT_F(MSG_LINEAR_ADVANCE)) - .tag(5) .button(VELOCITY_POS, GET_TEXT_F(MSG_VELOCITY)) + .tag(5) .button(VELOCITY_POS, GET_TEXT_F(MSG_MAX_SPEED)) .tag(6) .button(ACCELERATION_POS, GET_TEXT_F(MSG_ACCELERATION)) .tag(7) .button(JERK_POS, GET_TEXT_F(TERN(HAS_JUNCTION_DEVIATION, MSG_JUNCTION_DEVIATION, MSG_JERK))) .tag(8) .button(ENDSTOPS_POS, GET_TEXT_F(MSG_LCD_ENDSTOPS)) diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/advanced_settings_menu.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/advanced_settings_menu.cpp index 8e0a01e1c8a3..8753b44e709b 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/advanced_settings_menu.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/advanced_settings_menu.cpp @@ -105,7 +105,7 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) { .tag(15).button(DISPLAY_POS, GET_TEXT_F(MSG_DISPLAY_MENU)) .tag(9) .button(INTERFACE_POS, GET_TEXT_F(MSG_INTERFACE)) .tag(10).button(RESTORE_DEFAULTS_POS, GET_TEXT_F(MSG_RESTORE_DEFAULTS)) - .tag(5) .button(VELOCITY_POS, GET_TEXT_F(MSG_VELOCITY)) + .tag(5) .button(VELOCITY_POS, GET_TEXT_F(MSG_MAX_SPEED)) .tag(6) .button(ACCELERATION_POS, GET_TEXT_F(MSG_ACCELERATION)) .tag(7) .button(JERK_POS, GET_TEXT_F(TERN(HAS_JUNCTION_DEVIATION, MSG_JUNCTION_DEVIATION, MSG_JERK))) .enabled(ENABLED(BACKLASH_GCODE)) diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/max_velocity_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/max_velocity_screen.cpp index 011127621120..e7fc23ab4870 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/max_velocity_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/max_velocity_screen.cpp @@ -34,7 +34,7 @@ void MaxVelocityScreen::onRedraw(draw_mode_t what) { widgets_t w(what); w.precision(0); w.units(GET_TEXT_F(MSG_UNITS_MM_S)); - w.heading( GET_TEXT_F(MSG_VELOCITY)); + w.heading( GET_TEXT_F(MSG_MAX_SPEED)); w.color(x_axis) .adjuster( 2, GET_TEXT_F(MSG_VMAX_X), getAxisMaxFeedrate_mm_s(X) ); w.color(y_axis) .adjuster( 4, GET_TEXT_F(MSG_VMAX_Y), getAxisMaxFeedrate_mm_s(Y) ); w.color(z_axis) .adjuster( 6, GET_TEXT_F(MSG_VMAX_Z), getAxisMaxFeedrate_mm_s(Z) ); diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/language/language.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/language/language.h index cbc05c5aa3b0..8c123db6a1f7 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/language/language.h +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/language/language.h @@ -20,4 +20,6 @@ ****************************************************************************/ #pragma once +#define LSTR PROGMEM Language_Str + #include "language_en.h" diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/language/language_en.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/language/language_en.h index 83e762430ce1..5dbde8a5c359 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/language/language_en.h +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/language/language_en.h @@ -36,142 +36,142 @@ #endif namespace Language_en { - PROGMEM Language_Str MSG_BUTTON_OKAY = u8"Okay"; - PROGMEM Language_Str MSG_BUTTON_MENU = u8"Menu"; - PROGMEM Language_Str MSG_BUTTON_MEDIA = u8"Media"; - PROGMEM Language_Str MSG_BUTTON_OPEN = u8"Open"; - PROGMEM Language_Str MSG_CLEAN_NOZZLE = u8"Clean Nozzle"; - PROGMEM Language_Str MSG_VMAX_X = u8"Vmax X"; - PROGMEM Language_Str MSG_VMAX_Y = u8"Vmax Y"; - PROGMEM Language_Str MSG_VMAX_Z = u8"Vmax Z"; - PROGMEM Language_Str MSG_ACCEL_PRINTING = u8"Printing"; - PROGMEM Language_Str MSG_ACCEL_TRAVEL = u8"Travel"; - PROGMEM Language_Str MSG_ACCEL_RETRACT = u8"Retraction"; - PROGMEM Language_Str MSG_AMAX_X = u8"Amax X"; - PROGMEM Language_Str MSG_AMAX_Y = u8"Amax Y"; - PROGMEM Language_Str MSG_AMAX_Z = u8"Amax Z"; - PROGMEM Language_Str MSG_AXIS_X = u8"X"; - PROGMEM Language_Str MSG_AXIS_X2 = u8"X2"; - PROGMEM Language_Str MSG_AXIS_Y = u8"Y"; - PROGMEM Language_Str MSG_AXIS_Y2 = u8"Y2"; - PROGMEM Language_Str MSG_AXIS_Z = u8"Z"; - PROGMEM Language_Str MSG_AXIS_Z2 = u8"Z2"; - PROGMEM Language_Str MSG_AXIS_E = u8"E"; - PROGMEM Language_Str MSG_AXIS_E1 = u8"E1"; - PROGMEM Language_Str MSG_AXIS_E2 = u8"E2"; - PROGMEM Language_Str MSG_AXIS_E3 = u8"E3"; - PROGMEM Language_Str MSG_AXIS_E4 = u8"E4"; - PROGMEM Language_Str MSG_AXIS_ALL = u8"All"; - PROGMEM Language_Str MSG_HOME = u8"Home"; - PROGMEM Language_Str MSG_PRINT_STARTING = u8"Print starting"; - PROGMEM Language_Str MSG_PRINT_FINISHED = u8"Print finished"; - PROGMEM Language_Str MSG_PRINT_ERROR = u8"Print error"; - PROGMEM Language_Str MSG_ABOUT_TOUCH_PANEL_1 = u8"Color Touch Panel"; - PROGMEM Language_Str MSG_ABOUT_TOUCH_PANEL_2 = WEBSITE_URL; - PROGMEM Language_Str MSG_LICENSE = u8"This program is free software: you can redistribute it and/or modify it under the terms of " + LSTR MSG_BUTTON_OKAY = u8"Okay"; + LSTR MSG_BUTTON_MENU = u8"Menu"; + LSTR MSG_BUTTON_MEDIA = u8"Media"; + LSTR MSG_BUTTON_OPEN = u8"Open"; + LSTR MSG_CLEAN_NOZZLE = u8"Clean Nozzle"; + LSTR MSG_VMAX_X = u8"Max X Speed"; + LSTR MSG_VMAX_Y = u8"Max Y Speed"; + LSTR MSG_VMAX_Z = u8"Max Z Speed"; + LSTR MSG_ACCEL_PRINTING = u8"Printing"; + LSTR MSG_ACCEL_TRAVEL = u8"Travel"; + LSTR MSG_ACCEL_RETRACT = u8"Retraction"; + LSTR MSG_AMAX_X = u8"Max X Accel."; + LSTR MSG_AMAX_Y = u8"Max Y Accel."; + LSTR MSG_AMAX_Z = u8"Max Z Accel."; + LSTR MSG_AXIS_X = u8"X"; + LSTR MSG_AXIS_X2 = u8"X2"; + LSTR MSG_AXIS_Y = u8"Y"; + LSTR MSG_AXIS_Y2 = u8"Y2"; + LSTR MSG_AXIS_Z = u8"Z"; + LSTR MSG_AXIS_Z2 = u8"Z2"; + LSTR MSG_AXIS_E = u8"E"; + LSTR MSG_AXIS_E1 = u8"E1"; + LSTR MSG_AXIS_E2 = u8"E2"; + LSTR MSG_AXIS_E3 = u8"E3"; + LSTR MSG_AXIS_E4 = u8"E4"; + LSTR MSG_AXIS_ALL = u8"All"; + LSTR MSG_HOME = u8"Home"; + LSTR MSG_PRINT_STARTING = u8"Print starting"; + LSTR MSG_PRINT_FINISHED = u8"Print finished"; + LSTR MSG_PRINT_ERROR = u8"Print error"; + LSTR MSG_ABOUT_TOUCH_PANEL_1 = u8"Color Touch Panel"; + LSTR MSG_ABOUT_TOUCH_PANEL_2 = WEBSITE_URL; + LSTR MSG_LICENSE = u8"This program is free software: you can redistribute it and/or modify it under the terms of " "the GNU General Public License as published by the Free Software Foundation, either version 3 " "of the License, or (at your option) any later version. To view a copy of the GNU General " "Public License, go to the following location: https://www.gnu.org/licenses."; - PROGMEM Language_Str MSG_RUNOUT_1 = u8"Runout 1"; - PROGMEM Language_Str MSG_RUNOUT_2 = u8"Runout 2"; - PROGMEM Language_Str MSG_DISPLAY_MENU = u8"Display"; - PROGMEM Language_Str MSG_INTERFACE = u8"Interface"; - PROGMEM Language_Str MSG_MEASURE_AUTOMATICALLY = u8"Measure automatically"; - PROGMEM Language_Str MSG_H_OFFSET = u8"H Offset"; - PROGMEM Language_Str MSG_V_OFFSET = u8"V Offset"; - PROGMEM Language_Str MSG_TOUCH_SCREEN = u8"Touch Screen"; - PROGMEM Language_Str MSG_CALIBRATE = u8"Calibrate"; - PROGMEM Language_Str MSG_UNITS_MILLIAMP = u8"mA"; - PROGMEM Language_Str MSG_UNITS_MM = u8"mm"; - PROGMEM Language_Str MSG_UNITS_MM_S = u8"mm/s"; - PROGMEM Language_Str MSG_UNITS_MM_S2 = u8"mm/s" SUPERSCRIPT_TWO; - PROGMEM Language_Str MSG_UNITS_STEP_MM = u8"st/mm"; - PROGMEM Language_Str MSG_UNITS_PERCENT = u8"%"; - PROGMEM Language_Str MSG_UNITS_C = DEGREE_SIGN u8"C"; - PROGMEM Language_Str MSG_IDLE = u8"idle"; - PROGMEM Language_Str MSG_SET_MAXIMUM = u8"Set Maximum"; - PROGMEM Language_Str MSG_PRINT_SPEED = u8"Print Speed"; - PROGMEM Language_Str MSG_LINEAR_ADVANCE = u8"Linear Advance"; - PROGMEM Language_Str MSG_LINEAR_ADVANCE_K = u8"K"; - PROGMEM Language_Str MSG_LINEAR_ADVANCE_K1 = u8"K E1"; - PROGMEM Language_Str MSG_LINEAR_ADVANCE_K2 = u8"K E2"; - PROGMEM Language_Str MSG_LINEAR_ADVANCE_K3 = u8"K E3"; - PROGMEM Language_Str MSG_LINEAR_ADVANCE_K4 = u8"K E4"; - PROGMEM Language_Str MSG_NUDGE_NOZZLE = u8"Nudge Nozzle"; - PROGMEM Language_Str MSG_ADJUST_BOTH_NOZZLES = u8"Adjust Both Nozzles"; - PROGMEM Language_Str MSG_SHOW_OFFSETS = u8"Show Offsets"; - PROGMEM Language_Str MSG_INCREMENT = u8"Increment"; - PROGMEM Language_Str MSG_ERASE_FLASH_WARNING = u8"Are you sure? SPI flash will be erased."; - PROGMEM Language_Str MSG_ERASING = u8"Erasing..."; - PROGMEM Language_Str MSG_ERASED = u8"SPI flash erased"; - PROGMEM Language_Str MSG_CALIBRATION_WARNING = u8"For best results, unload the filament and clean the hotend prior to starting calibration. Continue?"; - PROGMEM Language_Str MSG_START_PRINT_CONFIRMATION = u8"Start printing %s?"; - PROGMEM Language_Str MSG_ABORT_WARNING = u8"Are you sure you want to cancel the print?"; - PROGMEM Language_Str MSG_EXTRUDER_SELECTION = u8"Extruder Selection"; - PROGMEM Language_Str MSG_CURRENT_TEMPERATURE = u8"Current Temp"; - PROGMEM Language_Str MSG_REMOVAL_TEMPERATURE = u8"Removal Temp"; - PROGMEM Language_Str MSG_CAUTION = u8"Caution:"; - PROGMEM Language_Str MSG_HOT = u8"Hot!"; - PROGMEM Language_Str MSG_UNLOAD_FILAMENT = u8"Unload/Retract"; - PROGMEM Language_Str MSG_LOAD_FILAMENT = u8"Load/Extrude"; - PROGMEM Language_Str MSG_MOMENTARY = u8"Momentary"; - PROGMEM Language_Str MSG_CONTINUOUS = u8"Continuous"; - PROGMEM Language_Str MSG_PRINT_MENU = u8"Print Menu"; - PROGMEM Language_Str MSG_FINE_MOTION = u8"Fine motion"; - PROGMEM Language_Str MSG_ENABLE_MEDIA = u8"Enable Media"; - PROGMEM Language_Str MSG_INSERT_MEDIA = u8"Insert Media..."; - PROGMEM Language_Str MSG_LCD_BRIGHTNESS = u8"LCD brightness"; - PROGMEM Language_Str MSG_SOUND_VOLUME = u8"Sound volume"; - PROGMEM Language_Str MSG_SCREEN_LOCK = u8"Screen lock"; - PROGMEM Language_Str MSG_BOOT_SCREEN = u8"Boot screen"; - PROGMEM Language_Str MSG_SOUNDS = u8"Sounds"; - PROGMEM Language_Str MSG_CLICK_SOUNDS = u8"Click sounds"; - PROGMEM Language_Str MSG_EEPROM_RESTORED = u8"Settings restored from backup"; - PROGMEM Language_Str MSG_EEPROM_RESET = u8"Settings restored to default"; - PROGMEM Language_Str MSG_EEPROM_SAVED = u8"Settings saved!"; - PROGMEM Language_Str MSG_EEPROM_SAVE_PROMPT = u8"Settings applied. Save these settings for next power-on?"; - PROGMEM Language_Str MSG_EEPROM_RESET_WARNING = u8"Are you sure? Customizations will be lost."; + LSTR MSG_RUNOUT_1 = u8"Runout 1"; + LSTR MSG_RUNOUT_2 = u8"Runout 2"; + LSTR MSG_DISPLAY_MENU = u8"Display"; + LSTR MSG_INTERFACE = u8"Interface"; + LSTR MSG_MEASURE_AUTOMATICALLY = u8"Measure automatically"; + LSTR MSG_H_OFFSET = u8"H Offset"; + LSTR MSG_V_OFFSET = u8"V Offset"; + LSTR MSG_TOUCH_SCREEN = u8"Touch Screen"; + LSTR MSG_CALIBRATE = u8"Calibrate"; + LSTR MSG_UNITS_MILLIAMP = u8"mA"; + LSTR MSG_UNITS_MM = u8"mm"; + LSTR MSG_UNITS_MM_S = u8"mm/s"; + LSTR MSG_UNITS_MM_S2 = u8"mm/s" SUPERSCRIPT_TWO; + LSTR MSG_UNITS_STEP_MM = u8"st/mm"; + LSTR MSG_UNITS_PERCENT = u8"%"; + LSTR MSG_UNITS_C = DEGREE_SIGN u8"C"; + LSTR MSG_IDLE = u8"idle"; + LSTR MSG_SET_MAXIMUM = u8"Set Maximum"; + LSTR MSG_PRINT_SPEED = u8"Print Speed"; + LSTR MSG_LINEAR_ADVANCE = u8"Linear Advance"; + LSTR MSG_LINEAR_ADVANCE_K = u8"K"; + LSTR MSG_LINEAR_ADVANCE_K1 = u8"K E1"; + LSTR MSG_LINEAR_ADVANCE_K2 = u8"K E2"; + LSTR MSG_LINEAR_ADVANCE_K3 = u8"K E3"; + LSTR MSG_LINEAR_ADVANCE_K4 = u8"K E4"; + LSTR MSG_NUDGE_NOZZLE = u8"Nudge Nozzle"; + LSTR MSG_ADJUST_BOTH_NOZZLES = u8"Adjust Both Nozzles"; + LSTR MSG_SHOW_OFFSETS = u8"Show Offsets"; + LSTR MSG_INCREMENT = u8"Increment"; + LSTR MSG_ERASE_FLASH_WARNING = u8"Are you sure? SPI flash will be erased."; + LSTR MSG_ERASING = u8"Erasing..."; + LSTR MSG_ERASED = u8"SPI flash erased"; + LSTR MSG_CALIBRATION_WARNING = u8"For best results, unload the filament and clean the hotend prior to starting calibration. Continue?"; + LSTR MSG_START_PRINT_CONFIRMATION = u8"Start printing %s?"; + LSTR MSG_ABORT_WARNING = u8"Are you sure you want to cancel the print?"; + LSTR MSG_EXTRUDER_SELECTION = u8"Extruder Selection"; + LSTR MSG_CURRENT_TEMPERATURE = u8"Current Temp"; + LSTR MSG_REMOVAL_TEMPERATURE = u8"Removal Temp"; + LSTR MSG_CAUTION = u8"Caution:"; + LSTR MSG_HOT = u8"Hot!"; + LSTR MSG_UNLOAD_FILAMENT = u8"Unload/Retract"; + LSTR MSG_LOAD_FILAMENT = u8"Load/Extrude"; + LSTR MSG_MOMENTARY = u8"Momentary"; + LSTR MSG_CONTINUOUS = u8"Continuous"; + LSTR MSG_PRINT_MENU = u8"Print Menu"; + LSTR MSG_FINE_MOTION = u8"Fine motion"; + LSTR MSG_ENABLE_MEDIA = u8"Enable Media"; + LSTR MSG_INSERT_MEDIA = u8"Insert Media..."; + LSTR MSG_LCD_BRIGHTNESS = u8"LCD brightness"; + LSTR MSG_SOUND_VOLUME = u8"Sound volume"; + LSTR MSG_SCREEN_LOCK = u8"Screen lock"; + LSTR MSG_BOOT_SCREEN = u8"Boot screen"; + LSTR MSG_SOUNDS = u8"Sounds"; + LSTR MSG_CLICK_SOUNDS = u8"Click sounds"; + LSTR MSG_EEPROM_RESTORED = u8"Settings restored from backup"; + LSTR MSG_EEPROM_RESET = u8"Settings restored to default"; + LSTR MSG_EEPROM_SAVED = u8"Settings saved!"; + LSTR MSG_EEPROM_SAVE_PROMPT = u8"Settings applied. Save these settings for next power-on?"; + LSTR MSG_EEPROM_RESET_WARNING = u8"Are you sure? Customizations will be lost."; - PROGMEM Language_Str MSG_PASSCODE_REJECTED = u8"Wrong passcode!"; - PROGMEM Language_Str MSG_PASSCODE_ACCEPTED = u8"Passcode accepted!"; - PROGMEM Language_Str MSG_PASSCODE_SELECT = u8"Select Passcode:"; - PROGMEM Language_Str MSG_PASSCODE_REQUEST = u8"Enter Passcode:"; + LSTR MSG_PASSCODE_REJECTED = u8"Wrong passcode!"; + LSTR MSG_PASSCODE_ACCEPTED = u8"Passcode accepted!"; + LSTR MSG_PASSCODE_SELECT = u8"Select Passcode:"; + LSTR MSG_PASSCODE_REQUEST = u8"Enter Passcode:"; - PROGMEM Language_Str MSG_TOUCH_CALIBRATION_START = u8"Release to begin screen calibration"; - PROGMEM Language_Str MSG_TOUCH_CALIBRATION_PROMPT = u8"Touch the dots to calibrate"; - PROGMEM Language_Str MSG_BED_MAPPING_DONE = u8"Bed mapping finished"; - PROGMEM Language_Str MSG_BED_MAPPING_INCOMPLETE = u8"Not all points probed"; - PROGMEM Language_Str MSG_LEVELING = u8"Leveling"; - PROGMEM Language_Str MSG_AXIS_LEVELING = u8"Axis Leveling"; - PROGMEM Language_Str MSG_PROBE_BED = u8"Probe Mesh"; - PROGMEM Language_Str MSG_PRINT_TEST = u8"Print Test (PLA)"; - PROGMEM Language_Str MSG_MOVE_Z_TO_TOP = u8"Raise Z to Top"; + LSTR MSG_TOUCH_CALIBRATION_START = u8"Release to begin screen calibration"; + LSTR MSG_TOUCH_CALIBRATION_PROMPT = u8"Touch the dots to calibrate"; + LSTR MSG_BED_MAPPING_DONE = u8"Bed mapping finished"; + LSTR MSG_BED_MAPPING_INCOMPLETE = u8"Not all points probed"; + LSTR MSG_LEVELING = u8"Leveling"; + LSTR MSG_AXIS_LEVELING = u8"Axis Leveling"; + LSTR MSG_PROBE_BED = u8"Probe Mesh"; + LSTR MSG_PRINT_TEST = u8"Print Test (PLA)"; + LSTR MSG_MOVE_Z_TO_TOP = u8"Raise Z to Top"; #if ENABLED(TOUCH_UI_LULZBOT_BIO) - PROGMEM Language_Str MSG_MOVE_TO_HOME = u8"Move to Home"; - PROGMEM Language_Str MSG_RAISE_PLUNGER = u8"Raise Plunger"; - PROGMEM Language_Str MSG_RELEASE_XY_AXIS = u8"Release X and Y Axis"; - PROGMEM Language_Str MSG_BED_TEMPERATURE = u8"Bed Temperature"; - PROGMEM Language_Str MSG_HOME_XYZ_WARNING = u8"About to move to home position. Ensure the top and the bed of the printer are clear.\n\nContinue?"; - PROGMEM Language_Str MSG_HOME_E_WARNING = u8"About to re-home plunger and auto-level. Remove syringe prior to proceeding.\n\nContinue?"; + LSTR MSG_MOVE_TO_HOME = u8"Move to Home"; + LSTR MSG_RAISE_PLUNGER = u8"Raise Plunger"; + LSTR MSG_RELEASE_XY_AXIS = u8"Release X and Y Axis"; + LSTR MSG_BED_TEMPERATURE = u8"Bed Temperature"; + LSTR MSG_HOME_XYZ_WARNING = u8"About to move to home position. Ensure the top and the bed of the printer are clear.\n\nContinue?"; + LSTR MSG_HOME_E_WARNING = u8"About to re-home plunger and auto-level. Remove syringe prior to proceeding.\n\nContinue?"; #endif #ifdef TOUCH_UI_COCOA_PRESS - PROGMEM Language_Str MSG_BODY = u8"Body"; - PROGMEM Language_Str MSG_SELECT_CHOCOLATE_TYPE = u8"Select Chocolate Type"; - PROGMEM Language_Str MSG_EXTERNAL = u8"External"; - PROGMEM Language_Str MSG_CHOCOLATE = u8"Chocolate"; - PROGMEM Language_Str MSG_UNLOAD_CARTRIDGE = u8"Unload Cartridge"; - PROGMEM Language_Str MSG_LOAD_UNLOAD = u8"Load/Unload"; - PROGMEM Language_Str MSG_FULL_LOAD = u8"Full Load"; - PROGMEM Language_Str MSG_FULL_UNLOAD = u8"Full Unload"; - PROGMEM Language_Str MSG_PREHEAT_CHOCOLATE = u8"Preheat Chocolate"; - PROGMEM Language_Str MSG_PREHEAT_FINISHED = u8"Preheat finished"; - PROGMEM Language_Str MSG_PREHEAT = u8"Preheat"; - PROGMEM Language_Str MSG_BUTTON_PAUSE = u8"Pause"; - PROGMEM Language_Str MSG_BUTTON_RESUME = u8"Resume"; - PROGMEM Language_Str MSG_ELAPSED_PRINT = u8"Elapsed Print"; - PROGMEM Language_Str MSG_XYZ_MOVE = u8"XYZ Move"; - PROGMEM Language_Str MSG_E_MOVE = u8"Extrusion Move"; + LSTR MSG_BODY = u8"Body"; + LSTR MSG_SELECT_CHOCOLATE_TYPE = u8"Select Chocolate Type"; + LSTR MSG_EXTERNAL = u8"External"; + LSTR MSG_CHOCOLATE = u8"Chocolate"; + LSTR MSG_UNLOAD_CARTRIDGE = u8"Unload Cartridge"; + LSTR MSG_LOAD_UNLOAD = u8"Load/Unload"; + LSTR MSG_FULL_LOAD = u8"Full Load"; + LSTR MSG_FULL_UNLOAD = u8"Full Unload"; + LSTR MSG_PREHEAT_CHOCOLATE = u8"Preheat Chocolate"; + LSTR MSG_PREHEAT_FINISHED = u8"Preheat finished"; + LSTR MSG_PREHEAT = u8"Preheat"; + LSTR MSG_BUTTON_PAUSE = u8"Pause"; + LSTR MSG_BUTTON_RESUME = u8"Resume"; + LSTR MSG_ELAPSED_PRINT = u8"Elapsed Print"; + LSTR MSG_XYZ_MOVE = u8"XYZ Move"; + LSTR MSG_E_MOVE = u8"Extrusion Move"; #endif }; // namespace Language_en diff --git a/Marlin/src/lcd/fontutils.cpp b/Marlin/src/lcd/fontutils.cpp index 50b671ea33a5..a97e63ac4d3a 100644 --- a/Marlin/src/lcd/fontutils.cpp +++ b/Marlin/src/lcd/fontutils.cpp @@ -40,13 +40,8 @@ #include "fontutils.h" -uint8_t read_byte_ram(uint8_t * str) { - return *str; -} - -uint8_t read_byte_rom(uint8_t * str) { - return pgm_read_byte(str); -} +uint8_t read_byte_ram(const uint8_t *str) { return *str; } +uint8_t read_byte_rom(const uint8_t *str) { return pgm_read_byte(str); } /** * @brief Using binary search to find the position by data_pin @@ -104,9 +99,9 @@ static inline bool utf8_is_start_byte_of_char(const uint8_t b) { /* This function gets the character at the pstart position, interpreting UTF8 multibyte sequences and returns the pointer to the next character */ -uint8_t* get_utf8_value_cb(uint8_t *pstart, read_byte_cb_t cb_read_byte, wchar_t *pval) { +const uint8_t* get_utf8_value_cb(const uint8_t *pstart, read_byte_cb_t cb_read_byte, wchar_t *pval) { uint32_t val = 0; - uint8_t *p = pstart; + const uint8_t *p = pstart; #define NEXT_6_BITS() do{ val <<= 6; p++; valcur = cb_read_byte(p); val |= (valcur & 0x3F); }while(0) diff --git a/Marlin/src/lcd/fontutils.h b/Marlin/src/lcd/fontutils.h index 21aee1e93919..e01962d7ad80 100644 --- a/Marlin/src/lcd/fontutils.h +++ b/Marlin/src/lcd/fontutils.h @@ -38,10 +38,10 @@ #include "../core/macros.h" // read a byte from ROM or RAM -typedef uint8_t (*read_byte_cb_t)(uint8_t * str); +typedef uint8_t (*read_byte_cb_t)(const uint8_t * str); -uint8_t read_byte_ram(uint8_t * str); -uint8_t read_byte_rom(uint8_t * str); +uint8_t read_byte_ram(const uint8_t *str); +uint8_t read_byte_rom(const uint8_t *str); // there's overflow of the wchar_t due to the 2-byte size in Arduino // sizeof(wchar_t)=2; sizeof(size_t)=2; sizeof(uint32_t)=4; @@ -58,7 +58,11 @@ typedef int (* pf_bsearch_cb_comp_t)(void *userdata, size_t idx, void * data_pin int pf_bsearch_r(void *userdata, size_t num_data, pf_bsearch_cb_comp_t cb_comp, void *data_pinpoint, size_t *ret_idx); /* Get the character, decoding multibyte UTF8 characters and returning a pointer to the start of the next UTF8 character */ -uint8_t* get_utf8_value_cb(uint8_t *pstart, read_byte_cb_t cb_read_byte, wchar_t *pval); +const uint8_t* get_utf8_value_cb(const uint8_t *pstart, read_byte_cb_t cb_read_byte, wchar_t *pval); + +inline const char* get_utf8_value_cb(const char *pstart, read_byte_cb_t cb_read_byte, wchar_t *pval) { + return (const char *)get_utf8_value_cb((const uint8_t *)pstart, cb_read_byte, pval); +} /* Returns length of string in CHARACTERS, NOT BYTES */ uint8_t utf8_strlen(const char *pstart); diff --git a/Marlin/src/lcd/language/language_an.h b/Marlin/src/lcd/language/language_an.h index c5a7e1877ec5..98f3d4ed97e1 100644 --- a/Marlin/src/lcd/language/language_an.h +++ b/Marlin/src/lcd/language/language_an.h @@ -85,7 +85,7 @@ namespace Language_an { LSTR MSG_MOVE_Z = _UxGT("Mover Z"); LSTR MSG_MOVE_E = _UxGT("Extrusor"); LSTR MSG_MOVE_EN = _UxGT("Extrusor *"); - LSTR MSG_MOVE_N_MM = _UxGT("Mover %smm"); + LSTR MSG_MOVE_N_MM = _UxGT("Mover $mm"); LSTR MSG_MOVE_01MM = _UxGT("Mover 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Mover 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Mover 10mm"); @@ -109,10 +109,8 @@ namespace Language_an { LSTR MSG_AMAX_A = _UxGT("Acel. max ") STR_A; LSTR MSG_AMAX_B = _UxGT("Acel. max ") STR_B; LSTR MSG_AMAX_C = _UxGT("Acel. max ") STR_C; - LSTR MSG_AMAX_I = _UxGT("Acel. max ") STR_I; - LSTR MSG_AMAX_J = _UxGT("Acel. max ") STR_J; - LSTR MSG_AMAX_K = _UxGT("Acel. max ") STR_K; - LSTR MSG_AMAX_E = _UxGT("Acel. max ") STR_E; + LSTR MSG_AMAX_N = _UxGT("Acel. max @"); + LSTR MSG_AMAX_E = _UxGT("Acel. max E"); LSTR MSG_AMAX_EN = _UxGT("Acel. max *"); LSTR MSG_A_RETRACT = _UxGT("Acel. retrac."); LSTR MSG_A_TRAVEL = _UxGT("Acel. Viaje"); @@ -120,9 +118,7 @@ namespace Language_an { LSTR MSG_A_STEPS = STR_A _UxGT(" trangos/mm"); LSTR MSG_B_STEPS = STR_B _UxGT(" trangos/mm"); LSTR MSG_C_STEPS = STR_C _UxGT(" trangos/mm"); - LSTR MSG_I_STEPS = STR_I _UxGT(" trangos/mm"); - LSTR MSG_J_STEPS = STR_J _UxGT(" trangos/mm"); - LSTR MSG_K_STEPS = STR_K _UxGT(" trangos/mm"); + LSTR MSG_N_STEPS = _UxGT("@ trangos/mm"); LSTR MSG_E_STEPS = _UxGT("E trangos/mm"); LSTR MSG_EN_STEPS = _UxGT("* trangos/mm"); LSTR MSG_TEMPERATURE = _UxGT("Temperatura"); @@ -168,6 +164,7 @@ namespace Language_an { LSTR MSG_BABYSTEP_X = _UxGT("Micropaso X"); LSTR MSG_BABYSTEP_Y = _UxGT("Micropaso Y"); LSTR MSG_BABYSTEP_Z = _UxGT("Micropaso Z"); + LSTR MSG_BABYSTEP_N = _UxGT("Micropaso @"); LSTR MSG_ENDSTOP_ABORT = _UxGT("Cancelado - Endstop"); LSTR MSG_HEATING_FAILED_LCD = _UxGT("Error: en calentar"); LSTR MSG_ERR_REDUNDANT_TEMP = _UxGT("Error: temperatura"); diff --git a/Marlin/src/lcd/language/language_bg.h b/Marlin/src/lcd/language/language_bg.h index 95ca4ce1bfcc..2596d62564e6 100644 --- a/Marlin/src/lcd/language/language_bg.h +++ b/Marlin/src/lcd/language/language_bg.h @@ -74,7 +74,7 @@ namespace Language_bg { LSTR MSG_MOVE_Z = _UxGT("Движение по Z"); LSTR MSG_MOVE_E = _UxGT("Екструдер"); LSTR MSG_MOVE_EN = _UxGT("Екструдер *"); - LSTR MSG_MOVE_N_MM = _UxGT("Премести с %smm"); + LSTR MSG_MOVE_N_MM = _UxGT("Премести с $mm"); LSTR MSG_MOVE_01MM = _UxGT("Премести с 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Премести с 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Премести с 10mm"); @@ -101,9 +101,7 @@ namespace Language_bg { LSTR MSG_A_STEPS = STR_A _UxGT(" стъпки/mm"); LSTR MSG_B_STEPS = STR_B _UxGT(" стъпки/mm"); LSTR MSG_C_STEPS = STR_C _UxGT(" стъпки/mm"); - LSTR MSG_I_STEPS = STR_I _UxGT(" стъпки/mm"); - LSTR MSG_J_STEPS = STR_J _UxGT(" стъпки/mm"); - LSTR MSG_K_STEPS = STR_K _UxGT(" стъпки/mm"); + LSTR MSG_N_STEPS = _UxGT("@ стъпки/mm"); LSTR MSG_E_STEPS = _UxGT("E стъпки/mm"); LSTR MSG_EN_STEPS = _UxGT("* стъпки/mm"); LSTR MSG_TEMPERATURE = _UxGT("Температура"); @@ -148,6 +146,7 @@ namespace Language_bg { LSTR MSG_BABYSTEP_X = _UxGT("Министъпка X"); LSTR MSG_BABYSTEP_Y = _UxGT("Министъпка Y"); LSTR MSG_BABYSTEP_Z = _UxGT("Министъпка Z"); + LSTR MSG_BABYSTEP_N = _UxGT("Министъпка @"); LSTR MSG_ENDSTOP_ABORT = _UxGT("Стоп Кр.Изключватели"); LSTR MSG_DELTA_CALIBRATE = _UxGT("Делта Калибровка"); LSTR MSG_DELTA_CALIBRATE_X = _UxGT("Калибровка X"); diff --git a/Marlin/src/lcd/language/language_ca.h b/Marlin/src/lcd/language/language_ca.h index 582c27b1ae6a..fd46bcc28fc0 100644 --- a/Marlin/src/lcd/language/language_ca.h +++ b/Marlin/src/lcd/language/language_ca.h @@ -85,7 +85,7 @@ namespace Language_ca { LSTR MSG_MOVE_Z = _UxGT("Mou Z"); LSTR MSG_MOVE_E = _UxGT("Extrusor"); LSTR MSG_MOVE_EN = _UxGT("Extrusor *"); - LSTR MSG_MOVE_N_MM = _UxGT("Mou %smm"); + LSTR MSG_MOVE_N_MM = _UxGT("Mou $mm"); LSTR MSG_MOVE_01MM = _UxGT("Mou 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Mou 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Mou 10mm"); @@ -107,11 +107,9 @@ namespace Language_ca { LSTR MSG_A_STEPS = STR_A _UxGT(" passos/mm"); LSTR MSG_B_STEPS = STR_B _UxGT(" passos/mm"); LSTR MSG_C_STEPS = STR_C _UxGT(" passos/mm"); - LSTR MSG_I_STEPS = STR_I _UxGT(" passos/mm"); - LSTR MSG_J_STEPS = STR_J _UxGT(" passos/mm"); - LSTR MSG_K_STEPS = STR_K _UxGT(" passos/mm"); - LSTR MSG_E_STEPS = _UxGT("Epassos/mm"); - LSTR MSG_EN_STEPS = _UxGT("*passos/mm"); + LSTR MSG_E_STEPS = _UxGT("@ passos/mm"); + LSTR MSG_N_STEPS = _UxGT("E passos/mm"); + LSTR MSG_EN_STEPS = _UxGT("* passos/mm"); LSTR MSG_TEMPERATURE = _UxGT("Temperatura"); LSTR MSG_MOTION = _UxGT("Moviment"); LSTR MSG_FILAMENT = _UxGT("Filament"); @@ -156,6 +154,7 @@ namespace Language_ca { LSTR MSG_BABYSTEP_X = _UxGT("Micropas X"); LSTR MSG_BABYSTEP_Y = _UxGT("Micropas Y"); LSTR MSG_BABYSTEP_Z = _UxGT("Micropas Z"); + LSTR MSG_BABYSTEP_N = _UxGT("Micropas @"); LSTR MSG_ENDSTOP_ABORT = _UxGT("Cancel. Endstop"); LSTR MSG_HEATING_FAILED_LCD = _UxGT("Error al escalfar"); LSTR MSG_ERR_REDUNDANT_TEMP = _UxGT("Err: TEMP REDUNDANT"); diff --git a/Marlin/src/lcd/language/language_cz.h b/Marlin/src/lcd/language/language_cz.h index 76469c5fe5a8..d78b43f9a9e0 100644 --- a/Marlin/src/lcd/language/language_cz.h +++ b/Marlin/src/lcd/language/language_cz.h @@ -235,7 +235,7 @@ namespace Language_cz { LSTR MSG_MOVE_E = _UxGT("Extrudér"); LSTR MSG_MOVE_EN = _UxGT("Extrudér *"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("Hotend je studený"); - LSTR MSG_MOVE_N_MM = _UxGT("Posunout o %smm"); + LSTR MSG_MOVE_N_MM = _UxGT("Posunout o $mm"); LSTR MSG_MOVE_01MM = _UxGT("Posunout o 0,1mm"); LSTR MSG_MOVE_1MM = _UxGT("Posunout o 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Posunout o 10mm"); @@ -269,19 +269,15 @@ namespace Language_cz { LSTR MSG_VA_JERK = _UxGT("Max ") STR_A _UxGT(" Jerk"); LSTR MSG_VB_JERK = _UxGT("Max ") STR_B _UxGT(" Jerk"); LSTR MSG_VC_JERK = _UxGT("Max ") STR_C _UxGT(" Jerk"); - LSTR MSG_VI_JERK = _UxGT("Max ") STR_I _UxGT(" Jerk"); - LSTR MSG_VJ_JERK = _UxGT("Max ") STR_J _UxGT(" Jerk"); - LSTR MSG_VK_JERK = _UxGT("Max ") STR_K _UxGT(" Jerk"); + LSTR MSG_VN_JERK = _UxGT("Max @ Jerk"); LSTR MSG_VE_JERK = _UxGT("Max E Jerk"); LSTR MSG_JUNCTION_DEVIATION = _UxGT("Odchylka spoje"); - LSTR MSG_VELOCITY = _UxGT("Rychlost"); + LSTR MSG_MAX_SPEED = _UxGT("Max Rychlost"); LSTR MSG_VMAX_A = _UxGT("Max ") STR_A _UxGT(" Rychlost"); LSTR MSG_VMAX_B = _UxGT("Max ") STR_B _UxGT(" Rychlost"); LSTR MSG_VMAX_C = _UxGT("Max ") STR_C _UxGT(" Rychlost"); - LSTR MSG_VMAX_I = _UxGT("Max ") STR_I _UxGT(" Rychlost"); - LSTR MSG_VMAX_J = _UxGT("Max ") STR_J _UxGT(" Rychlost"); - LSTR MSG_VMAX_K = _UxGT("Max ") STR_K _UxGT(" Rychlost"); - LSTR MSG_VMAX_E = _UxGT("Max ") STR_E _UxGT(" Rychlost"); + LSTR MSG_VMAX_N = _UxGT("Max @ Rychlost"); + LSTR MSG_VMAX_E = _UxGT("Max E Rychlost"); LSTR MSG_VMAX_EN = _UxGT("Max * Rychlost"); LSTR MSG_VMIN = _UxGT("Vmin"); LSTR MSG_VTRAV_MIN = _UxGT("VTrav Min"); @@ -289,10 +285,8 @@ namespace Language_cz { LSTR MSG_AMAX_A = _UxGT("Max ") STR_A _UxGT(" Akcel"); LSTR MSG_AMAX_B = _UxGT("Max ") STR_B _UxGT(" Akcel"); LSTR MSG_AMAX_C = _UxGT("Max ") STR_C _UxGT(" Akcel"); - LSTR MSG_AMAX_I = _UxGT("Max ") STR_I _UxGT(" Akcel"); - LSTR MSG_AMAX_J = _UxGT("Max ") STR_J _UxGT(" Akcel"); - LSTR MSG_AMAX_K = _UxGT("Max ") STR_K _UxGT(" Akcel"); - LSTR MSG_AMAX_E = _UxGT("Max ") STR_E _UxGT(" Akcel"); + LSTR MSG_AMAX_N = _UxGT("Max @ Akcel"); + LSTR MSG_AMAX_E = _UxGT("Max E Akcel"); LSTR MSG_AMAX_EN = _UxGT("Max * Akcel"); LSTR MSG_A_RETRACT = _UxGT("A-retrakt"); LSTR MSG_A_TRAVEL = _UxGT("A-přejezd"); @@ -300,9 +294,7 @@ namespace Language_cz { LSTR MSG_A_STEPS = STR_A _UxGT(" kroků/mm"); LSTR MSG_B_STEPS = STR_B _UxGT(" kroků/mm"); LSTR MSG_C_STEPS = STR_C _UxGT(" kroků/mm"); - LSTR MSG_I_STEPS = STR_I _UxGT(" kroků/mm"); - LSTR MSG_J_STEPS = STR_J _UxGT(" kroků/mm"); - LSTR MSG_K_STEPS = STR_K _UxGT(" kroků/mm"); + LSTR MSG_N_STEPS = _UxGT("@ kroků/mm"); LSTR MSG_E_STEPS = _UxGT("E kroků/mm"); LSTR MSG_EN_STEPS = _UxGT("* kroků/mm"); LSTR MSG_TEMPERATURE = _UxGT("Teplota"); @@ -407,6 +399,7 @@ namespace Language_cz { LSTR MSG_BABYSTEP_X = _UxGT("Babystep X"); LSTR MSG_BABYSTEP_Y = _UxGT("Babystep Y"); LSTR MSG_BABYSTEP_Z = _UxGT("Babystep Z"); + LSTR MSG_BABYSTEP_N = _UxGT("Babystep @"); LSTR MSG_BABYSTEP_TOTAL = _UxGT("Celkem"); LSTR MSG_ENDSTOP_ABORT = _UxGT("Endstop abort"); LSTR MSG_HEATING_FAILED_LCD = _UxGT("Chyba zahřívání"); @@ -482,13 +475,7 @@ namespace Language_cz { LSTR MSG_INFO_MAX_TEMP = _UxGT("Teplota max"); LSTR MSG_INFO_PSU = _UxGT("Nap. zdroj"); LSTR MSG_DRIVE_STRENGTH = _UxGT("Buzení motorů"); - LSTR MSG_DAC_PERCENT_A = STR_A _UxGT(" Motor %"); - LSTR MSG_DAC_PERCENT_B = STR_B _UxGT(" Motor %"); - LSTR MSG_DAC_PERCENT_C = STR_C _UxGT(" Motor %"); - LSTR MSG_DAC_PERCENT_I = STR_I _UxGT(" Motor %"); - LSTR MSG_DAC_PERCENT_J = STR_J _UxGT(" Motor %"); - LSTR MSG_DAC_PERCENT_K = STR_K _UxGT(" Motor %"); - LSTR MSG_DAC_PERCENT_E = _UxGT("E Motor %"); + LSTR MSG_DAC_PERCENT_N = _UxGT("@ Motor %"); LSTR MSG_DAC_EEPROM_WRITE = _UxGT("DAC uložit EEPROM"); LSTR MSG_ERROR_TMC = _UxGT("TMC CHYBA SPOJENÍ"); LSTR MSG_FILAMENT_CHANGE_HEADER = _UxGT("VÝMĚNA FILAMENTU"); diff --git a/Marlin/src/lcd/language/language_da.h b/Marlin/src/lcd/language/language_da.h index 01281db2688c..05474744d0ac 100644 --- a/Marlin/src/lcd/language/language_da.h +++ b/Marlin/src/lcd/language/language_da.h @@ -74,7 +74,7 @@ namespace Language_da { LSTR MSG_MOVE_X = _UxGT("Flyt X"); LSTR MSG_MOVE_Y = _UxGT("Flyt Y"); LSTR MSG_MOVE_Z = _UxGT("Flyt Z"); - LSTR MSG_MOVE_N_MM = _UxGT("Flyt %smm"); + LSTR MSG_MOVE_N_MM = _UxGT("Flyt $mm"); LSTR MSG_MOVE_01MM = _UxGT("Flyt 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Flyt 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Flyt 10mm"); @@ -172,13 +172,7 @@ namespace Language_da { LSTR MSG_INFO_PSU = _UxGT("Strømfors."); LSTR MSG_DRIVE_STRENGTH = _UxGT("Driv Styrke"); - LSTR MSG_DAC_PERCENT_A = STR_A _UxGT(" Driv %"); - LSTR MSG_DAC_PERCENT_B = STR_B _UxGT(" Driv %"); - LSTR MSG_DAC_PERCENT_C = STR_C _UxGT(" Driv %"); - LSTR MSG_DAC_PERCENT_I = STR_I _UxGT(" Driv %"); - LSTR MSG_DAC_PERCENT_J = STR_J _UxGT(" Driv %"); - LSTR MSG_DAC_PERCENT_K = STR_K _UxGT(" Driv %"); - LSTR MSG_DAC_PERCENT_E = _UxGT("E Driv %"); + LSTR MSG_DAC_PERCENT_N = _UxGT("@ Driv %"); LSTR MSG_DAC_EEPROM_WRITE = _UxGT("DAC EEPROM Skriv"); diff --git a/Marlin/src/lcd/language/language_de.h b/Marlin/src/lcd/language/language_de.h index 111608dd4671..2b22319361aa 100644 --- a/Marlin/src/lcd/language/language_de.h +++ b/Marlin/src/lcd/language/language_de.h @@ -84,12 +84,6 @@ namespace Language_de { LSTR MSG_HOME_OFFSET_X = _UxGT("Homeversatz X"); LSTR MSG_HOME_OFFSET_Y = _UxGT("Homeversatz Y"); LSTR MSG_HOME_OFFSET_Z = _UxGT("Homeversatz Z"); - LSTR MSG_HOME_OFFSET_I = _UxGT("Homeversatz ") STR_I; - LSTR MSG_HOME_OFFSET_J = _UxGT("Homeversatz ") STR_J; - LSTR MSG_HOME_OFFSET_K = _UxGT("Homeversatz ") STR_K; - LSTR MSG_HOME_OFFSET_U = _UxGT("Homeversatz ") STR_U; - LSTR MSG_HOME_OFFSET_V = _UxGT("Homeversatz ") STR_V; - LSTR MSG_HOME_OFFSET_W = _UxGT("Homeversatz ") STR_W; LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Homeversatz aktiv"); LSTR MSG_TRAMMING_WIZARD = _UxGT("Tramming Assistent"); LSTR MSG_SELECT_ORIGIN = _UxGT("Wählen Sie Ursprung"); @@ -273,13 +267,11 @@ namespace Language_de { LSTR MSG_MOVE_X = _UxGT("Bewege X"); LSTR MSG_MOVE_Y = _UxGT("Bewege Y"); LSTR MSG_MOVE_Z = _UxGT("Bewege Z"); - LSTR MSG_MOVE_I = _UxGT("Bewege ") STR_I; - LSTR MSG_MOVE_J = _UxGT("Bewege ") STR_J; - LSTR MSG_MOVE_K = _UxGT("Bewege ") STR_K; + LSTR MSG_MOVE_N = _UxGT("Bewege @"); LSTR MSG_MOVE_E = _UxGT("Bewege Extruder"); LSTR MSG_MOVE_EN = _UxGT("Bewege Extruder *"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("Hotend zu kalt"); - LSTR MSG_MOVE_N_MM = _UxGT(" %s mm"); + LSTR MSG_MOVE_N_MM = _UxGT(" $ mm"); LSTR MSG_MOVE_01MM = _UxGT(" 0,1 mm"); LSTR MSG_MOVE_1MM = _UxGT(" 1,0 mm"); LSTR MSG_MOVE_10MM = _UxGT(" 10,0 mm"); @@ -289,12 +281,6 @@ namespace Language_de { LSTR MSG_MOVE_01IN = _UxGT("0.100 in"); LSTR MSG_MOVE_1IN = _UxGT("1.000 in"); LSTR MSG_SPEED = _UxGT("Geschw."); - LSTR MSG_MAXSPEED = _UxGT("Max Geschw. (mm/s)"); - LSTR MSG_MAXSPEED_X = _UxGT("Max ") STR_A _UxGT(" Geschw."); - LSTR MSG_MAXSPEED_Y = _UxGT("Max ") STR_B _UxGT(" Geschw."); - LSTR MSG_MAXSPEED_Z = _UxGT("Max ") STR_C _UxGT(" Geschw."); - LSTR MSG_MAXSPEED_E = _UxGT("Max ") STR_E _UxGT(" Geschw."); - LSTR MSG_MAXSPEED_A = _UxGT("Max @ Geschw."); LSTR MSG_BED_Z = _UxGT("Bett Z"); LSTR MSG_NOZZLE = _UxGT("Düse"); LSTR MSG_NOZZLE_N = _UxGT("Düse ~"); @@ -347,19 +333,15 @@ namespace Language_de { LSTR MSG_VA_JERK = _UxGT("Max ") STR_A _UxGT(" Jerk"); LSTR MSG_VB_JERK = _UxGT("Max ") STR_B _UxGT(" Jerk"); LSTR MSG_VC_JERK = _UxGT("Max ") STR_C _UxGT(" Jerk"); - LSTR MSG_VI_JERK = _UxGT("Max ") STR_I _UxGT(" Jerk"); - LSTR MSG_VJ_JERK = _UxGT("Max ") STR_J _UxGT(" Jerk"); - LSTR MSG_VK_JERK = _UxGT("Max ") STR_K _UxGT(" Jerk"); + LSTR MSG_VN_JERK = _UxGT("Max @ Jerk"); LSTR MSG_VE_JERK = _UxGT("Max E Jerk"); LSTR MSG_JUNCTION_DEVIATION = _UxGT("Junction Dev"); - LSTR MSG_VELOCITY = _UxGT("Geschwindigkeit"); + LSTR MSG_MAX_SPEED = _UxGT("Max Geschw. (mm/s)"); LSTR MSG_VMAX_A = _UxGT("V max ") STR_A; LSTR MSG_VMAX_B = _UxGT("V max ") STR_B; LSTR MSG_VMAX_C = _UxGT("V max ") STR_C; - LSTR MSG_VMAX_I = _UxGT("V max ") STR_I; - LSTR MSG_VMAX_J = _UxGT("V max ") STR_J; - LSTR MSG_VMAX_K = _UxGT("V max ") STR_K; - LSTR MSG_VMAX_E = _UxGT("V max ") STR_E; + LSTR MSG_VMAX_N = _UxGT("V max @"); + LSTR MSG_VMAX_E = _UxGT("V max E"); LSTR MSG_VMAX_EN = _UxGT("V max *"); LSTR MSG_VMIN = _UxGT("V min "); LSTR MSG_VTRAV_MIN = _UxGT("V min Leerfahrt"); @@ -367,10 +349,8 @@ namespace Language_de { LSTR MSG_AMAX_A = _UxGT("A max ") STR_A; LSTR MSG_AMAX_B = _UxGT("A max ") STR_B; LSTR MSG_AMAX_C = _UxGT("A max ") STR_C; - LSTR MSG_AMAX_I = _UxGT("A max ") STR_I; - LSTR MSG_AMAX_J = _UxGT("A max ") STR_J; - LSTR MSG_AMAX_K = _UxGT("A max ") STR_K; - LSTR MSG_AMAX_E = _UxGT("A max ") STR_E; + LSTR MSG_AMAX_N = _UxGT("A max @"); + LSTR MSG_AMAX_E = _UxGT("A max E"); LSTR MSG_AMAX_EN = _UxGT("A max *"); LSTR MSG_A_RETRACT = _UxGT("A Einzug"); LSTR MSG_A_TRAVEL = _UxGT("A Leerfahrt"); @@ -380,10 +360,8 @@ namespace Language_de { LSTR MSG_A_STEPS = STR_A _UxGT(" Steps/mm"); LSTR MSG_B_STEPS = STR_B _UxGT(" Steps/mm"); LSTR MSG_C_STEPS = STR_C _UxGT(" Steps/mm"); - LSTR MSG_I_STEPS = STR_I _UxGT(" Steps/mm"); - LSTR MSG_J_STEPS = STR_J _UxGT(" Steps/mm"); - LSTR MSG_K_STEPS = STR_K _UxGT(" Steps/mm"); - LSTR MSG_E_STEPS = STR_E _UxGT(" Steps/mm"); + LSTR MSG_N_STEPS = _UxGT("@ Steps/mm"); + LSTR MSG_E_STEPS = _UxGT("E Steps/mm"); LSTR MSG_EN_STEPS = _UxGT("* Steps/mm"); LSTR MSG_TEMPERATURE = _UxGT("Temperatur"); LSTR MSG_MOTION = _UxGT("Bewegung"); @@ -533,9 +511,7 @@ namespace Language_de { LSTR MSG_BABYSTEP_X = _UxGT("Babystep X"); LSTR MSG_BABYSTEP_Y = _UxGT("Babystep Y"); LSTR MSG_BABYSTEP_Z = _UxGT("Babystep Z"); - LSTR MSG_BABYSTEP_I = _UxGT("Babystep ") STR_I; - LSTR MSG_BABYSTEP_J = _UxGT("Babystep ") STR_J; - LSTR MSG_BABYSTEP_K = _UxGT("Babystep ") STR_K; + LSTR MSG_BABYSTEP_N = _UxGT("Babystep @"); LSTR MSG_BABYSTEP_TOTAL = _UxGT("Total"); LSTR MSG_ENDSTOP_ABORT = _UxGT("Abbr. mit Endstopp"); LSTR MSG_HEATING_FAILED_LCD = _UxGT("HEIZEN ERFOLGLOS"); @@ -629,13 +605,7 @@ namespace Language_de { LSTR MSG_INFO_MAX_TEMP = _UxGT("Max Temp"); LSTR MSG_INFO_PSU = _UxGT("Netzteil"); LSTR MSG_DRIVE_STRENGTH = _UxGT("Motorleistung"); - LSTR MSG_DAC_PERCENT_A = STR_A _UxGT(" Treiber %"); - LSTR MSG_DAC_PERCENT_B = STR_B _UxGT(" Treiber %"); - LSTR MSG_DAC_PERCENT_C = STR_C _UxGT(" Treiber %"); - LSTR MSG_DAC_PERCENT_I = STR_I _UxGT(" Treiber %"); - LSTR MSG_DAC_PERCENT_J = STR_J _UxGT(" Treiber %"); - LSTR MSG_DAC_PERCENT_K = STR_K _UxGT(" Treiber %"); - LSTR MSG_DAC_PERCENT_E = _UxGT("E Treiber %"); + LSTR MSG_DAC_PERCENT_N = _UxGT("@ Treiber %"); LSTR MSG_ERROR_TMC = _UxGT("TMC Verbindungsfehler"); LSTR MSG_DAC_EEPROM_WRITE = _UxGT("Werte speichern"); LSTR MSG_FILAMENT_CHANGE_HEADER = _UxGT("FILAMENT WECHSEL"); diff --git a/Marlin/src/lcd/language/language_el.h b/Marlin/src/lcd/language/language_el.h index 370568175656..47d6a5b2da35 100644 --- a/Marlin/src/lcd/language/language_el.h +++ b/Marlin/src/lcd/language/language_el.h @@ -119,17 +119,13 @@ namespace Language_el { LSTR MSG_VA_JERK = _UxGT("Vαντίδραση ") STR_A; LSTR MSG_VB_JERK = _UxGT("Vαντίδραση ") STR_B; LSTR MSG_VC_JERK = _UxGT("Vαντίδραση ") STR_C; - LSTR MSG_VI_JERK = _UxGT("Vαντίδραση ") STR_I; - LSTR MSG_VJ_JERK = _UxGT("Vαντίδραση ") STR_J; - LSTR MSG_VK_JERK = _UxGT("Vαντίδραση ") STR_K; + LSTR MSG_VN_JERK = _UxGT("Vαντίδραση @"); LSTR MSG_VE_JERK = _UxGT("Vαντίδραση E"); LSTR MSG_VMAX_A = _UxGT("V Μέγιστο") STR_A; LSTR MSG_VMAX_B = _UxGT("V Μέγιστο") STR_B; LSTR MSG_VMAX_C = _UxGT("V Μέγιστο") STR_C; - LSTR MSG_VMAX_I = _UxGT("V Μέγιστο") STR_I; - LSTR MSG_VMAX_J = _UxGT("V Μέγιστο") STR_J; - LSTR MSG_VMAX_K = _UxGT("V Μέγιστο") STR_K; - LSTR MSG_VMAX_E = _UxGT("V Μέγιστο") STR_E; + LSTR MSG_VMAX_N = _UxGT("V Μέγιστο@"); + LSTR MSG_VMAX_E = _UxGT("V ΜέγιστοE"); LSTR MSG_VMAX_EN = _UxGT("V Μέγιστο *"); LSTR MSG_VMIN = _UxGT("V Ελάχιστο"); LSTR MSG_VTRAV_MIN = _UxGT("Vελάχ. μετατόπιση"); @@ -137,10 +133,8 @@ namespace Language_el { LSTR MSG_AMAX_A = _UxGT("Aμεγ ") STR_A; LSTR MSG_AMAX_B = _UxGT("Aμεγ ") STR_B; LSTR MSG_AMAX_C = _UxGT("Aμεγ ") STR_C; - LSTR MSG_AMAX_I = _UxGT("Aμεγ ") STR_I; - LSTR MSG_AMAX_J = _UxGT("Aμεγ ") STR_J; - LSTR MSG_AMAX_K = _UxGT("Aμεγ ") STR_K; - LSTR MSG_AMAX_E = _UxGT("Aμεγ ") STR_E; + LSTR MSG_AMAX_N = _UxGT("Aμεγ @"); + LSTR MSG_AMAX_E = _UxGT("Aμεγ E"); LSTR MSG_AMAX_EN = _UxGT("Aμεγ *"); LSTR MSG_A_RETRACT = _UxGT("Α-ανάσυρση"); LSTR MSG_A_TRAVEL = _UxGT("Α-μετατόπιση"); @@ -148,9 +142,7 @@ namespace Language_el { LSTR MSG_A_STEPS = _UxGT("Bήματα ") STR_A _UxGT(" ανά μμ"); LSTR MSG_B_STEPS = _UxGT("Bήματα ") STR_B _UxGT(" ανά μμ"); LSTR MSG_C_STEPS = _UxGT("Bήματα ") STR_C _UxGT(" ανά μμ"); - LSTR MSG_I_STEPS = _UxGT("Bήματα ") STR_I _UxGT(" ανά μμ"); - LSTR MSG_J_STEPS = _UxGT("Bήματα ") STR_J _UxGT(" ανά μμ"); - LSTR MSG_K_STEPS = _UxGT("Bήματα ") STR_K _UxGT(" ανά μμ"); + LSTR MSG_N_STEPS = _UxGT("Bήματα @ ανά μμ"); LSTR MSG_E_STEPS = _UxGT("Bήματα Ε ανά μμ"); LSTR MSG_EN_STEPS = _UxGT("Bήματα * ανά μμ"); LSTR MSG_TEMPERATURE = _UxGT("Θερμοκρασία"); diff --git a/Marlin/src/lcd/language/language_el_gr.h b/Marlin/src/lcd/language/language_el_gr.h index b13893fb4cde..bd2e7d595d9a 100644 --- a/Marlin/src/lcd/language/language_el_gr.h +++ b/Marlin/src/lcd/language/language_el_gr.h @@ -109,17 +109,13 @@ namespace Language_el_gr { LSTR MSG_VA_JERK = _UxGT("Vαντίδραση ") STR_A; LSTR MSG_VB_JERK = _UxGT("Vαντίδραση ") STR_B; LSTR MSG_VC_JERK = _UxGT("Vαντίδραση ") STR_C; - LSTR MSG_VI_JERK = _UxGT("Vαντίδραση ") STR_I; - LSTR MSG_VJ_JERK = _UxGT("Vαντίδραση ") STR_J; - LSTR MSG_VK_JERK = _UxGT("Vαντίδραση ") STR_K; + LSTR MSG_VN_JERK = _UxGT("Vαντίδραση @"); LSTR MSG_VE_JERK = _UxGT("Vαντίδραση E"); LSTR MSG_VMAX_A = _UxGT("Vμεγ ") STR_A; LSTR MSG_VMAX_B = _UxGT("Vμεγ ") STR_B; LSTR MSG_VMAX_C = _UxGT("Vμεγ ") STR_C; - LSTR MSG_VMAX_I = _UxGT("Vμεγ ") STR_I; - LSTR MSG_VMAX_J = _UxGT("Vμεγ ") STR_J; - LSTR MSG_VMAX_K = _UxGT("Vμεγ ") STR_K; - LSTR MSG_VMAX_E = _UxGT("Vμεγ ") STR_E; + LSTR MSG_VMAX_N = _UxGT("Vμεγ @"); + LSTR MSG_VMAX_E = _UxGT("Vμεγ E"); LSTR MSG_VMAX_EN = _UxGT("Vμεγ *"); LSTR MSG_VMIN = _UxGT("Vελαχ"); LSTR MSG_VTRAV_MIN = _UxGT("Vελάχ. μετατόπιση"); @@ -127,10 +123,8 @@ namespace Language_el_gr { LSTR MSG_AMAX_A = _UxGT("Aμεγ ") STR_A; LSTR MSG_AMAX_B = _UxGT("Aμεγ ") STR_B; LSTR MSG_AMAX_C = _UxGT("Aμεγ ") STR_C; - LSTR MSG_AMAX_I = _UxGT("Aμεγ ") STR_I; - LSTR MSG_AMAX_J = _UxGT("Aμεγ ") STR_J; - LSTR MSG_AMAX_K = _UxGT("Aμεγ ") STR_K; - LSTR MSG_AMAX_E = _UxGT("Aμεγ ") STR_E; + LSTR MSG_AMAX_N = _UxGT("Aμεγ @"); + LSTR MSG_AMAX_E = _UxGT("Aμεγ E"); LSTR MSG_AMAX_EN = _UxGT("Aμεγ *"); LSTR MSG_A_RETRACT = _UxGT("Α-ανάσυρση"); LSTR MSG_A_TRAVEL = _UxGT("Α-μετατόπιση"); @@ -138,9 +132,7 @@ namespace Language_el_gr { LSTR MSG_A_STEPS = _UxGT("Bήματα ") STR_A _UxGT(" ανά μμ"); LSTR MSG_B_STEPS = _UxGT("Bήματα ") STR_B _UxGT(" ανά μμ"); LSTR MSG_C_STEPS = _UxGT("Bήματα ") STR_C _UxGT(" ανά μμ"); - LSTR MSG_I_STEPS = _UxGT("Bήματα ") STR_I _UxGT(" ανά μμ"); - LSTR MSG_J_STEPS = _UxGT("Bήματα ") STR_J _UxGT(" ανά μμ"); - LSTR MSG_K_STEPS = _UxGT("Bήματα ") STR_K _UxGT(" ανά μμ"); + LSTR MSG_N_STEPS = _UxGT("Bήματα @ ανά μμ"); LSTR MSG_E_STEPS = _UxGT("Bήματα Ε ανά μμ"); LSTR MSG_EN_STEPS = _UxGT("Bήματα * ανά μμ"); LSTR MSG_TEMPERATURE = _UxGT("Θερμοκρασία"); diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 93ef1b5a7149..81f30b61d8ef 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -27,10 +27,9 @@ * LCD Menu Messages * See also https://marlinfw.org/docs/development/lcd_language.html * - * Substitutions are applied for the following characters when used - * in menu items that call lcd_put_u8str_ind_P with an index: + * Substitutions are applied for the following characters when used in menu items titles: * - * $ displays an inserted C-string + * $ displays an inserted string * = displays '0'....'10' for indexes 0 - 10 * ~ displays '1'....'11' for indexes 0 - 10 * * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL) @@ -106,12 +105,6 @@ namespace Language_en { LSTR MSG_HOME_OFFSET_X = _UxGT("Home Offset X"); LSTR MSG_HOME_OFFSET_Y = _UxGT("Home Offset Y"); LSTR MSG_HOME_OFFSET_Z = _UxGT("Home Offset Z"); - LSTR MSG_HOME_OFFSET_I = _UxGT("Home Offset ") STR_I; - LSTR MSG_HOME_OFFSET_J = _UxGT("Home Offset ") STR_J; - LSTR MSG_HOME_OFFSET_K = _UxGT("Home Offset ") STR_K; - LSTR MSG_HOME_OFFSET_U = _UxGT("Home Offset ") STR_U; - LSTR MSG_HOME_OFFSET_V = _UxGT("Home Offset ") STR_V; - LSTR MSG_HOME_OFFSET_W = _UxGT("Home Offset ") STR_W; LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Offsets Applied"); LSTR MSG_TRAMMING_WIZARD = _UxGT("Tramming Wizard"); LSTR MSG_SELECT_ORIGIN = _UxGT("Select Origin"); @@ -314,16 +307,11 @@ namespace Language_en { LSTR MSG_MOVE_X = _UxGT("Move X"); // Used by draw_edit_screen LSTR MSG_MOVE_Y = _UxGT("Move Y"); LSTR MSG_MOVE_Z = _UxGT("Move Z"); - LSTR MSG_MOVE_I = _UxGT("Move ") STR_I; - LSTR MSG_MOVE_J = _UxGT("Move ") STR_J; - LSTR MSG_MOVE_K = _UxGT("Move ") STR_K; - LSTR MSG_MOVE_U = _UxGT("Move ") STR_U; - LSTR MSG_MOVE_V = _UxGT("Move ") STR_V; - LSTR MSG_MOVE_W = _UxGT("Move ") STR_W; + LSTR MSG_MOVE_N = _UxGT("Move @"); LSTR MSG_MOVE_E = _UxGT("Move Extruder"); LSTR MSG_MOVE_EN = _UxGT("Move E*"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("Hotend too cold"); - LSTR MSG_MOVE_N_MM = _UxGT("Move %smm"); + LSTR MSG_MOVE_N_MM = _UxGT("Move $mm"); LSTR MSG_MOVE_01MM = _UxGT("Move 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Move 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Move 10mm"); @@ -333,12 +321,6 @@ namespace Language_en { LSTR MSG_MOVE_01IN = _UxGT("Move 0.1in"); LSTR MSG_MOVE_1IN = _UxGT("Move 1.0in"); LSTR MSG_SPEED = _UxGT("Speed"); - LSTR MSG_MAXSPEED = _UxGT("Max Speed (mm/s)"); - LSTR MSG_MAXSPEED_X = _UxGT("Max ") STR_A _UxGT(" Speed"); - LSTR MSG_MAXSPEED_Y = _UxGT("Max ") STR_B _UxGT(" Speed"); - LSTR MSG_MAXSPEED_Z = _UxGT("Max ") STR_C _UxGT(" Speed"); - LSTR MSG_MAXSPEED_E = _UxGT("Max ") STR_E _UxGT(" Speed"); - LSTR MSG_MAXSPEED_A = _UxGT("Max @ Speed"); LSTR MSG_BED_Z = _UxGT("Bed Z"); LSTR MSG_NOZZLE = _UxGT("Nozzle"); LSTR MSG_NOZZLE_N = _UxGT("Nozzle ~"); @@ -395,39 +377,24 @@ namespace Language_en { LSTR MSG_VA_JERK = _UxGT("Max ") STR_A _UxGT(" Jerk"); LSTR MSG_VB_JERK = _UxGT("Max ") STR_B _UxGT(" Jerk"); LSTR MSG_VC_JERK = _UxGT("Max ") STR_C _UxGT(" Jerk"); - LSTR MSG_VI_JERK = _UxGT("Max ") STR_I _UxGT(" Jerk"); - LSTR MSG_VJ_JERK = _UxGT("Max ") STR_J _UxGT(" Jerk"); - LSTR MSG_VK_JERK = _UxGT("Max ") STR_K _UxGT(" Jerk"); - LSTR MSG_VU_JERK = _UxGT("Max ") STR_U _UxGT(" Jerk"); - LSTR MSG_VV_JERK = _UxGT("Max ") STR_V _UxGT(" Jerk"); - LSTR MSG_VW_JERK = _UxGT("Max ") STR_W _UxGT(" Jerk"); + LSTR MSG_VN_JERK = _UxGT("Max @ Jerk"); LSTR MSG_VE_JERK = _UxGT("Max E Jerk"); LSTR MSG_JUNCTION_DEVIATION = _UxGT("Junction Dev"); - LSTR MSG_VELOCITY = _UxGT("Velocity"); - LSTR MSG_VMAX_A = _UxGT("Max ") STR_A _UxGT(" Vel"); - LSTR MSG_VMAX_B = _UxGT("Max ") STR_B _UxGT(" Vel"); - LSTR MSG_VMAX_C = _UxGT("Max ") STR_C _UxGT(" Vel"); - LSTR MSG_VMAX_I = _UxGT("Max ") STR_I _UxGT(" Vel"); - LSTR MSG_VMAX_J = _UxGT("Max ") STR_J _UxGT(" Vel"); - LSTR MSG_VMAX_K = _UxGT("Max ") STR_K _UxGT(" Vel"); - LSTR MSG_VMAX_U = _UxGT("Max ") STR_U _UxGT(" Vel"); - LSTR MSG_VMAX_V = _UxGT("Max ") STR_V _UxGT(" Vel"); - LSTR MSG_VMAX_W = _UxGT("Max ") STR_W _UxGT(" Vel"); - LSTR MSG_VMAX_E = _UxGT("Max ") STR_E _UxGT(" Vel"); - LSTR MSG_VMAX_EN = _UxGT("Max * Vel"); + LSTR MSG_MAX_SPEED = _UxGT("Max Speed (mm/s)"); + LSTR MSG_VMAX_A = _UxGT("Max ") STR_A _UxGT(" Speed"); + LSTR MSG_VMAX_B = _UxGT("Max ") STR_B _UxGT(" Speed"); + LSTR MSG_VMAX_C = _UxGT("Max ") STR_C _UxGT(" Speed"); + LSTR MSG_VMAX_N = _UxGT("Max @ Speed"); + LSTR MSG_VMAX_E = _UxGT("Max E Speed"); + LSTR MSG_VMAX_EN = _UxGT("Max * Speed"); LSTR MSG_VMIN = _UxGT("Min Velocity"); - LSTR MSG_VTRAV_MIN = _UxGT("Min Travel Vel"); + LSTR MSG_VTRAV_MIN = _UxGT("Min Travel Speed"); LSTR MSG_ACCELERATION = _UxGT("Acceleration"); LSTR MSG_AMAX_A = _UxGT("Max ") STR_A _UxGT(" Accel"); LSTR MSG_AMAX_B = _UxGT("Max ") STR_B _UxGT(" Accel"); LSTR MSG_AMAX_C = _UxGT("Max ") STR_C _UxGT(" Accel"); - LSTR MSG_AMAX_I = _UxGT("Max ") STR_I _UxGT(" Accel"); - LSTR MSG_AMAX_J = _UxGT("Max ") STR_J _UxGT(" Accel"); - LSTR MSG_AMAX_K = _UxGT("Max ") STR_K _UxGT(" Accel"); - LSTR MSG_AMAX_U = _UxGT("Max ") STR_U _UxGT(" Accel"); - LSTR MSG_AMAX_V = _UxGT("Max ") STR_V _UxGT(" Accel"); - LSTR MSG_AMAX_W = _UxGT("Max ") STR_W _UxGT(" Accel"); - LSTR MSG_AMAX_E = _UxGT("Max ") STR_E _UxGT(" Accel"); + LSTR MSG_AMAX_N = _UxGT("Max @ Accel"); + LSTR MSG_AMAX_E = _UxGT("Max E Accel"); LSTR MSG_AMAX_EN = _UxGT("Max * Accel"); LSTR MSG_A_RETRACT = _UxGT("Retract Accel"); LSTR MSG_A_TRAVEL = _UxGT("Travel Accel"); @@ -437,12 +404,7 @@ namespace Language_en { LSTR MSG_A_STEPS = STR_A _UxGT(" Steps/mm"); LSTR MSG_B_STEPS = STR_B _UxGT(" Steps/mm"); LSTR MSG_C_STEPS = STR_C _UxGT(" Steps/mm"); - LSTR MSG_I_STEPS = STR_I _UxGT(" Steps/mm"); - LSTR MSG_J_STEPS = STR_J _UxGT(" Steps/mm"); - LSTR MSG_K_STEPS = STR_K _UxGT(" Steps/mm"); - LSTR MSG_U_STEPS = STR_U _UxGT(" Steps/mm"); - LSTR MSG_V_STEPS = STR_V _UxGT(" Steps/mm"); - LSTR MSG_W_STEPS = STR_W _UxGT(" Steps/mm"); + LSTR MSG_N_STEPS = _UxGT("@ steps/mm"); LSTR MSG_E_STEPS = _UxGT("E steps/mm"); LSTR MSG_EN_STEPS = _UxGT("* Steps/mm"); LSTR MSG_TEMPERATURE = _UxGT("Temperature"); @@ -605,12 +567,7 @@ namespace Language_en { LSTR MSG_BABYSTEP_X = _UxGT("Babystep X"); LSTR MSG_BABYSTEP_Y = _UxGT("Babystep Y"); LSTR MSG_BABYSTEP_Z = _UxGT("Babystep Z"); - LSTR MSG_BABYSTEP_I = _UxGT("Babystep ") STR_I; - LSTR MSG_BABYSTEP_J = _UxGT("Babystep ") STR_J; - LSTR MSG_BABYSTEP_K = _UxGT("Babystep ") STR_K; - LSTR MSG_BABYSTEP_U = _UxGT("Babystep ") STR_U; - LSTR MSG_BABYSTEP_V = _UxGT("Babystep ") STR_V; - LSTR MSG_BABYSTEP_W = _UxGT("Babystep ") STR_W; + LSTR MSG_BABYSTEP_N = _UxGT("Babystep @"); LSTR MSG_BABYSTEP_TOTAL = _UxGT("Total"); LSTR MSG_ENDSTOP_ABORT = _UxGT("Endstop Abort"); LSTR MSG_HEATING_FAILED_LCD = _UxGT("Heating Failed"); @@ -707,16 +664,7 @@ namespace Language_en { LSTR MSG_INFO_MAX_TEMP = _UxGT("Max Temp"); LSTR MSG_INFO_PSU = _UxGT("PSU"); LSTR MSG_DRIVE_STRENGTH = _UxGT("Drive Strength"); - LSTR MSG_DAC_PERCENT_A = STR_A _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_B = STR_B _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_C = STR_C _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_I = STR_I _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_J = STR_J _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_K = STR_K _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_U = STR_U _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_V = STR_V _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_W = STR_W _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_E = _UxGT("E Driver %"); + LSTR MSG_DAC_PERCENT_N = _UxGT("@ Driver %"); LSTR MSG_ERROR_TMC = _UxGT("TMC CONNECTION ERROR"); LSTR MSG_DAC_EEPROM_WRITE = _UxGT("DAC EEPROM Write"); LSTR MSG_FILAMENT_CHANGE_HEADER = _UxGT("FILAMENT CHANGE"); @@ -889,15 +837,7 @@ namespace Language_en { LSTR MSG_PID_C_E = _UxGT("PID-C *"); LSTR MSG_PID_F = _UxGT("PID-F"); LSTR MSG_PID_F_E = _UxGT("PID-F *"); - LSTR MSG_BACKLASH_A = STR_A; - LSTR MSG_BACKLASH_B = STR_B; - LSTR MSG_BACKLASH_C = STR_C; - LSTR MSG_BACKLASH_I = STR_I; - LSTR MSG_BACKLASH_J = STR_J; - LSTR MSG_BACKLASH_K = STR_K; - LSTR MSG_BACKLASH_U = STR_U; - LSTR MSG_BACKLASH_V = STR_V; - LSTR MSG_BACKLASH_W = STR_W; + LSTR MSG_BACKLASH_N = _UxGT("@"); } #if FAN_COUNT == 1 diff --git a/Marlin/src/lcd/language/language_es.h b/Marlin/src/lcd/language/language_es.h index 4eb7c9f7e1a6..cc331efd4562 100644 --- a/Marlin/src/lcd/language/language_es.h +++ b/Marlin/src/lcd/language/language_es.h @@ -229,7 +229,7 @@ namespace Language_es { LSTR MSG_MOVE_E = _UxGT("Extrusor"); LSTR MSG_MOVE_EN = _UxGT("Extrusor *"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("Hotend muy frio"); - LSTR MSG_MOVE_N_MM = _UxGT("Mover %smm"); + LSTR MSG_MOVE_N_MM = _UxGT("Mover $mm"); LSTR MSG_MOVE_01MM = _UxGT("Mover 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Mover 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Mover 10mm"); @@ -270,30 +270,24 @@ namespace Language_es { LSTR MSG_VA_JERK = _UxGT("Max ") STR_A _UxGT(" Jerk"); LSTR MSG_VB_JERK = _UxGT("Max ") STR_B _UxGT(" Jerk"); LSTR MSG_VC_JERK = _UxGT("Max ") STR_C _UxGT(" Jerk"); - LSTR MSG_VI_JERK = _UxGT("Max ") STR_I _UxGT(" Jerk"); - LSTR MSG_VJ_JERK = _UxGT("Max ") STR_J _UxGT(" Jerk"); - LSTR MSG_VK_JERK = _UxGT("Max ") STR_K _UxGT(" Jerk"); + LSTR MSG_VN_JERK = _UxGT("Max @ Jerk"); LSTR MSG_VE_JERK = _UxGT("Max E Jerk"); LSTR MSG_JUNCTION_DEVIATION = _UxGT("Desvi. Unión"); - LSTR MSG_VELOCITY = _UxGT("Velocidad"); - LSTR MSG_VMAX_A = _UxGT("Max ") STR_A _UxGT(" Vel"); - LSTR MSG_VMAX_B = _UxGT("Max ") STR_B _UxGT(" Vel"); - LSTR MSG_VMAX_C = _UxGT("Max ") STR_C _UxGT(" Vel"); - LSTR MSG_VMAX_I = _UxGT("Max ") STR_I _UxGT(" Vel"); - LSTR MSG_VMAX_J = _UxGT("Max ") STR_J _UxGT(" Vel"); - LSTR MSG_VMAX_K = _UxGT("Max ") STR_K _UxGT(" Vel"); - LSTR MSG_VMAX_E = _UxGT("Max ") STR_E _UxGT(" Vel"); - LSTR MSG_VMAX_EN = _UxGT("Max * Vel"); + LSTR MSG_MAX_SPEED = _UxGT("Max Velocidad"); + LSTR MSG_VMAX_A = _UxGT("Max ") STR_A _UxGT(" Speed"); + LSTR MSG_VMAX_B = _UxGT("Max ") STR_B _UxGT(" Speed"); + LSTR MSG_VMAX_C = _UxGT("Max ") STR_C _UxGT(" Speed"); + LSTR MSG_VMAX_N = _UxGT("Max @ Speed"); + LSTR MSG_VMAX_E = _UxGT("Max E Speed"); + LSTR MSG_VMAX_EN = _UxGT("Max * Speed"); LSTR MSG_VMIN = _UxGT("Vmin"); LSTR MSG_VTRAV_MIN = _UxGT("Vel. viaje min"); LSTR MSG_ACCELERATION = _UxGT("Acceleración"); LSTR MSG_AMAX_A = _UxGT("Acel. max") STR_A; LSTR MSG_AMAX_B = _UxGT("Acel. max") STR_B; LSTR MSG_AMAX_C = _UxGT("Acel. max") STR_C; - LSTR MSG_AMAX_I = _UxGT("Acel. max") STR_I; - LSTR MSG_AMAX_J = _UxGT("Acel. max") STR_J; - LSTR MSG_AMAX_K = _UxGT("Acel. max") STR_K; - LSTR MSG_AMAX_E = _UxGT("Acel. max") STR_E; + LSTR MSG_AMAX_N = _UxGT("Acel. max@"); + LSTR MSG_AMAX_E = _UxGT("Acel. maxE"); LSTR MSG_AMAX_EN = _UxGT("Acel. max *"); LSTR MSG_A_RETRACT = _UxGT("Acel. retrac."); LSTR MSG_A_TRAVEL = _UxGT("Acel. Viaje"); @@ -301,9 +295,7 @@ namespace Language_es { LSTR MSG_A_STEPS = STR_A _UxGT(" pasos/mm"); LSTR MSG_B_STEPS = STR_B _UxGT(" pasos/mm"); LSTR MSG_C_STEPS = STR_C _UxGT(" pasos/mm"); - LSTR MSG_I_STEPS = STR_I _UxGT(" pasos/mm"); - LSTR MSG_J_STEPS = STR_J _UxGT(" pasos/mm"); - LSTR MSG_K_STEPS = STR_K _UxGT(" pasos/mm"); + LSTR MSG_N_STEPS = _UxGT("@ pasos/mm"); LSTR MSG_E_STEPS = _UxGT("E pasos/mm"); LSTR MSG_EN_STEPS = _UxGT("* pasos/mm"); LSTR MSG_TEMPERATURE = _UxGT("Temperatura"); @@ -413,6 +405,7 @@ namespace Language_es { LSTR MSG_BABYSTEP_X = _UxGT("Micropaso X"); LSTR MSG_BABYSTEP_Y = _UxGT("Micropaso Y"); LSTR MSG_BABYSTEP_Z = _UxGT("Micropaso Z"); + LSTR MSG_BABYSTEP_N = _UxGT("Micropaso @"); LSTR MSG_BABYSTEP_TOTAL = _UxGT("Total"); LSTR MSG_ENDSTOP_ABORT = _UxGT("Cancelado - Endstop"); LSTR MSG_HEATING_FAILED_LCD = _UxGT("Calent. fallido"); @@ -480,13 +473,7 @@ namespace Language_es { LSTR MSG_INFO_MAX_TEMP = _UxGT("Temp. Máxima"); LSTR MSG_INFO_PSU = _UxGT("F. Aliment."); LSTR MSG_DRIVE_STRENGTH = _UxGT("Fuerza de empuje"); - LSTR MSG_DAC_PERCENT_A = STR_A _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_B = STR_B _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_C = STR_C _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_I = STR_I _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_J = STR_J _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_K = STR_K _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_E = _UxGT("E Driver %"); + LSTR MSG_DAC_PERCENT_N = _UxGT("@ Driver %"); LSTR MSG_ERROR_TMC = _UxGT("ERROR CONEX. TMC"); LSTR MSG_DAC_EEPROM_WRITE = _UxGT("Escribe DAC EEPROM"); LSTR MSG_FILAMENT_CHANGE_HEADER = _UxGT("CAMBIAR FILAMENTO"); diff --git a/Marlin/src/lcd/language/language_eu.h b/Marlin/src/lcd/language/language_eu.h index 2d84518f0bfe..09a0fbeb6ac6 100644 --- a/Marlin/src/lcd/language/language_eu.h +++ b/Marlin/src/lcd/language/language_eu.h @@ -138,7 +138,7 @@ namespace Language_eu { LSTR MSG_MOVE_Z = _UxGT("Mugitu Z"); LSTR MSG_MOVE_E = _UxGT("Estrusorea"); LSTR MSG_MOVE_EN = _UxGT("Estrusorea *"); - LSTR MSG_MOVE_N_MM = _UxGT("Mugitu %smm"); + LSTR MSG_MOVE_N_MM = _UxGT("Mugitu $mm"); LSTR MSG_MOVE_01MM = _UxGT("Mugitu 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Mugitu 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Mugitu 10mm"); @@ -166,9 +166,7 @@ namespace Language_eu { LSTR MSG_VA_JERK = _UxGT("V") STR_A _UxGT("-astindua"); LSTR MSG_VB_JERK = _UxGT("V") STR_B _UxGT("-astindua"); LSTR MSG_VC_JERK = _UxGT("V") STR_C _UxGT("-astindua"); - LSTR MSG_VI_JERK = _UxGT("V") STR_I _UxGT("-astindua"); - LSTR MSG_VJ_JERK = _UxGT("V") STR_J _UxGT("-astindua"); - LSTR MSG_VK_JERK = _UxGT("V") STR_K _UxGT("-astindua"); + LSTR MSG_VN_JERK = _UxGT("V@-astindua"); LSTR MSG_VE_JERK = _UxGT("Ve-astindua"); LSTR MSG_VTRAV_MIN = _UxGT("VBidaia min"); LSTR MSG_A_RETRACT = _UxGT("A-retrakt"); @@ -177,9 +175,7 @@ namespace Language_eu { LSTR MSG_A_STEPS = STR_A _UxGT(" pausoak/mm"); LSTR MSG_B_STEPS = STR_B _UxGT(" pausoak/mm"); LSTR MSG_C_STEPS = STR_C _UxGT(" pausoak/mm"); - LSTR MSG_I_STEPS = STR_I _UxGT(" pausoak/mm"); - LSTR MSG_J_STEPS = STR_J _UxGT(" pausoak/mm"); - LSTR MSG_K_STEPS = STR_K _UxGT(" pausoak/mm"); + LSTR MSG_N_STEPS = _UxGT("@ pausoak/mm"); LSTR MSG_E_STEPS = _UxGT("E pausoak/mm"); LSTR MSG_EN_STEPS = _UxGT("* pausoak/mm"); LSTR MSG_TEMPERATURE = _UxGT("Tenperatura"); @@ -243,6 +239,7 @@ namespace Language_eu { LSTR MSG_BABYSTEP_X = _UxGT("Mikro-urratsa X"); LSTR MSG_BABYSTEP_Y = _UxGT("Mikro-urratsa Y"); LSTR MSG_BABYSTEP_Z = _UxGT("Mikro-urratsa Z"); + LSTR MSG_BABYSTEP_N = _UxGT("Mikro-urratsa @"); LSTR MSG_ENDSTOP_ABORT = _UxGT("Endstop deusezta."); LSTR MSG_HEATING_FAILED_LCD = _UxGT("Err: Beroketa"); LSTR MSG_ERR_REDUNDANT_TEMP = _UxGT("Err: Tenperatura"); @@ -296,13 +293,7 @@ namespace Language_eu { LSTR MSG_INFO_MAX_TEMP = _UxGT("Tenp. Maximoa"); LSTR MSG_INFO_PSU = _UxGT("Elikadura-iturria"); LSTR MSG_DRIVE_STRENGTH = _UxGT("Driver-aren potentzia"); - LSTR MSG_DAC_PERCENT_A = STR_A _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_B = STR_B _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_C = STR_C _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_I = STR_I _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_J = STR_J _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_K = STR_K _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_E = _UxGT("E Driver %"); + LSTR MSG_DAC_PERCENT_N = _UxGT("@ Driver %"); LSTR MSG_DAC_EEPROM_WRITE = _UxGT("Idatzi DAC EEPROM"); LSTR MSG_FILAMENT_CHANGE_HEADER_PAUSE = _UxGT("HARIZPIA ALDATU"); LSTR MSG_FILAMENT_CHANGE_HEADER_LOAD = _UxGT("HARIZPIA KARGATU"); diff --git a/Marlin/src/lcd/language/language_fi.h b/Marlin/src/lcd/language/language_fi.h index 066179c9504d..8fd53a79e36d 100644 --- a/Marlin/src/lcd/language/language_fi.h +++ b/Marlin/src/lcd/language/language_fi.h @@ -71,7 +71,7 @@ namespace Language_fi { LSTR MSG_MOVE_Z = _UxGT("Liikuta Z"); LSTR MSG_MOVE_E = _UxGT("Extruder"); LSTR MSG_MOVE_EN = _UxGT("Extruder *"); - LSTR MSG_MOVE_N_MM = _UxGT("Liikuta %smm"); + LSTR MSG_MOVE_N_MM = _UxGT("Liikuta $mm"); LSTR MSG_MOVE_01MM = _UxGT("Liikuta 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Liikuta 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Liikuta 10mm"); diff --git a/Marlin/src/lcd/language/language_fr.h b/Marlin/src/lcd/language/language_fr.h index f3ea9b5e3b80..6081234607f4 100644 --- a/Marlin/src/lcd/language/language_fr.h +++ b/Marlin/src/lcd/language/language_fr.h @@ -72,9 +72,6 @@ namespace Language_fr { LSTR MSG_HOME_OFFSET_X = _UxGT("Décal. origine X"); LSTR MSG_HOME_OFFSET_Y = _UxGT("Décal. origine Y"); LSTR MSG_HOME_OFFSET_Z = _UxGT("Décal. origine Z"); - LSTR MSG_HOME_OFFSET_I = _UxGT("Décal. origine ") STR_I; - LSTR MSG_HOME_OFFSET_J = _UxGT("Décal. origine ") STR_J; - LSTR MSG_HOME_OFFSET_K = _UxGT("Décal. origine ") STR_K; LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Décalages appliqués"); LSTR MSG_TRAMMING_WIZARD = _UxGT("Assistant Molettes"); LSTR MSG_SELECT_ORIGIN = _UxGT("Molette du lit"); // Not a selection of the origin @@ -233,13 +230,11 @@ namespace Language_fr { LSTR MSG_MOVE_X = _UxGT("Déplacer X"); LSTR MSG_MOVE_Y = _UxGT("Déplacer Y"); LSTR MSG_MOVE_Z = _UxGT("Déplacer Z"); - LSTR MSG_MOVE_I = _UxGT("Déplacer ") STR_I; - LSTR MSG_MOVE_J = _UxGT("Déplacer ") STR_J; - LSTR MSG_MOVE_K = _UxGT("Déplacer ") STR_K; + LSTR MSG_MOVE_N = _UxGT("Déplacer @"); LSTR MSG_MOVE_E = _UxGT("Extruder"); LSTR MSG_MOVE_EN = _UxGT("Extruder *"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("Buse trop froide"); - LSTR MSG_MOVE_N_MM = _UxGT("Déplacer %smm"); + LSTR MSG_MOVE_N_MM = _UxGT("Déplacer $mm"); LSTR MSG_MOVE_01MM = _UxGT("Déplacer 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Déplacer 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Déplacer 10mm"); @@ -282,18 +277,14 @@ namespace Language_fr { LSTR MSG_VA_JERK = _UxGT("V") STR_A _UxGT(" jerk"); LSTR MSG_VB_JERK = _UxGT("V") STR_B _UxGT(" jerk"); LSTR MSG_VC_JERK = _UxGT("V") STR_C _UxGT(" jerk"); - LSTR MSG_VI_JERK = _UxGT("V") STR_I _UxGT(" jerk"); - LSTR MSG_VJ_JERK = _UxGT("V") STR_J _UxGT(" jerk"); - LSTR MSG_VK_JERK = _UxGT("V") STR_K _UxGT(" jerk"); + LSTR MSG_VN_JERK = _UxGT("V@ jerk"); LSTR MSG_VE_JERK = _UxGT("Ve jerk"); - LSTR MSG_VELOCITY = _UxGT("Vélocité"); + LSTR MSG_MAX_SPEED = _UxGT("Max Vélocité"); LSTR MSG_VMAX_A = _UxGT("Vit. Max ") STR_A; LSTR MSG_VMAX_B = _UxGT("Vit. Max ") STR_B; LSTR MSG_VMAX_C = _UxGT("Vit. Max ") STR_C; - LSTR MSG_VMAX_I = _UxGT("Vit. Max ") STR_I; - LSTR MSG_VMAX_J = _UxGT("Vit. Max ") STR_J; - LSTR MSG_VMAX_K = _UxGT("Vit. Max ") STR_K; - LSTR MSG_VMAX_E = _UxGT("Vit. Max ") STR_E; + LSTR MSG_VMAX_N = _UxGT("Vit. Max @"); + LSTR MSG_VMAX_E = _UxGT("Vit. Max E"); LSTR MSG_VMAX_EN = _UxGT("Vit. Max *"); LSTR MSG_JUNCTION_DEVIATION = _UxGT("Déviat. jonct."); LSTR MSG_VMIN = _UxGT("Vit. Min"); @@ -302,10 +293,8 @@ namespace Language_fr { LSTR MSG_AMAX_A = _UxGT("Max Accél. ") STR_A; LSTR MSG_AMAX_B = _UxGT("Max Accél. ") STR_B; LSTR MSG_AMAX_C = _UxGT("Max Accél. ") STR_C; - LSTR MSG_AMAX_I = _UxGT("Max Accél. ") STR_I; - LSTR MSG_AMAX_J = _UxGT("Max Accél. ") STR_J; - LSTR MSG_AMAX_K = _UxGT("Max Accél. ") STR_K; - LSTR MSG_AMAX_E = _UxGT("Max Accél. ") STR_E; + LSTR MSG_AMAX_N = _UxGT("Max Accél. @"); + LSTR MSG_AMAX_E = _UxGT("Max Accél. E"); LSTR MSG_AMAX_EN = _UxGT("Max Accél. *"); LSTR MSG_A_RETRACT = _UxGT("Acc.rétraction"); LSTR MSG_A_TRAVEL = _UxGT("Acc.course"); @@ -315,9 +304,7 @@ namespace Language_fr { LSTR MSG_A_STEPS = STR_A _UxGT(" pas/mm"); LSTR MSG_B_STEPS = STR_B _UxGT(" pas/mm"); LSTR MSG_C_STEPS = STR_C _UxGT(" pas/mm"); - LSTR MSG_I_STEPS = STR_I _UxGT(" pas/mm"); - LSTR MSG_J_STEPS = STR_J _UxGT(" pas/mm"); - LSTR MSG_K_STEPS = STR_K _UxGT(" pas/mm"); + LSTR MSG_N_STEPS = _UxGT("@ pas/mm"); LSTR MSG_E_STEPS = _UxGT("E pas/mm"); LSTR MSG_EN_STEPS = _UxGT("* pas/mm"); LSTR MSG_TEMPERATURE = _UxGT("Température"); @@ -443,9 +430,7 @@ namespace Language_fr { LSTR MSG_BABYSTEP_X = _UxGT("Babystep X"); LSTR MSG_BABYSTEP_Y = _UxGT("Babystep Y"); LSTR MSG_BABYSTEP_Z = _UxGT("Babystep Z"); - LSTR MSG_BABYSTEP_I = _UxGT("Babystep ") STR_I; - LSTR MSG_BABYSTEP_J = _UxGT("Babystep ") STR_J; - LSTR MSG_BABYSTEP_K = _UxGT("Babystep ") STR_K; + LSTR MSG_BABYSTEP_N = _UxGT("Babystep @"); LSTR MSG_BABYSTEP_TOTAL = _UxGT("Total"); LSTR MSG_ENDSTOP_ABORT = _UxGT("Butée abandon"); LSTR MSG_HEATING_FAILED_LCD = _UxGT("Err de chauffe"); @@ -521,13 +506,7 @@ namespace Language_fr { LSTR MSG_INFO_MAX_TEMP = _UxGT("Temp Max"); LSTR MSG_INFO_PSU = _UxGT("Alim."); LSTR MSG_DRIVE_STRENGTH = _UxGT("Puiss. moteur "); - LSTR MSG_DAC_PERCENT_A = _UxGT("Driver ") STR_A _UxGT(" %"); - LSTR MSG_DAC_PERCENT_B = _UxGT("Driver ") STR_B _UxGT(" %"); - LSTR MSG_DAC_PERCENT_C = _UxGT("Driver ") STR_C _UxGT(" %"); - LSTR MSG_DAC_PERCENT_I = _UxGT("Driver ") STR_I _UxGT(" %"); - LSTR MSG_DAC_PERCENT_J = _UxGT("Driver ") STR_J _UxGT(" %"); - LSTR MSG_DAC_PERCENT_K = _UxGT("Driver ") STR_K _UxGT(" %"); - LSTR MSG_DAC_PERCENT_E = _UxGT("Driver E %"); + LSTR MSG_DAC_PERCENT_N = _UxGT("Driver @ %"); LSTR MSG_DAC_EEPROM_WRITE = _UxGT("DAC EEPROM sauv."); LSTR MSG_ERROR_TMC = _UxGT("ERREUR CONNEXION TMC"); diff --git a/Marlin/src/lcd/language/language_gl.h b/Marlin/src/lcd/language/language_gl.h index 55dc03ac9d95..dabd35efcf9b 100644 --- a/Marlin/src/lcd/language/language_gl.h +++ b/Marlin/src/lcd/language/language_gl.h @@ -226,7 +226,7 @@ namespace Language_gl { LSTR MSG_MOVE_E = _UxGT("Extrusor"); LSTR MSG_MOVE_EN = _UxGT("Extrusor *"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("Bico moi frío"); - LSTR MSG_MOVE_N_MM = _UxGT("Mover %smm"); + LSTR MSG_MOVE_N_MM = _UxGT("Mover $mm"); LSTR MSG_MOVE_01MM = _UxGT("Mover 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Mover 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Mover 10mm"); @@ -271,30 +271,23 @@ namespace Language_gl { LSTR MSG_VA_JERK = _UxGT("Max ") STR_A _UxGT(" Jerk"); LSTR MSG_VB_JERK = _UxGT("Max ") STR_B _UxGT(" Jerk"); LSTR MSG_VC_JERK = _UxGT("Max ") STR_C _UxGT(" Jerk"); - LSTR MSG_VI_JERK = _UxGT("Max ") STR_I _UxGT(" Jerk"); - LSTR MSG_VJ_JERK = _UxGT("Max ") STR_J _UxGT(" Jerk"); - LSTR MSG_VK_JERK = _UxGT("Max ") STR_K _UxGT(" Jerk"); + LSTR MSG_VN_JERK = _UxGT("Max @ Jerk"); LSTR MSG_VE_JERK = _UxGT("Max E Jerk"); LSTR MSG_JUNCTION_DEVIATION = _UxGT("Desvío Unión"); - LSTR MSG_VELOCITY = _UxGT("Velocidade"); - LSTR MSG_VMAX_A = _UxGT("Max ") STR_A _UxGT(" Vel"); - LSTR MSG_VMAX_B = _UxGT("Max ") STR_B _UxGT(" Vel"); - LSTR MSG_VMAX_C = _UxGT("Max ") STR_C _UxGT(" Vel"); - LSTR MSG_VMAX_I = _UxGT("Max ") STR_I _UxGT(" Vel"); - LSTR MSG_VMAX_J = _UxGT("Max ") STR_J _UxGT(" Vel"); - LSTR MSG_VMAX_K = _UxGT("Max ") STR_K _UxGT(" Vel"); - LSTR MSG_VMAX_E = _UxGT("Max ") STR_E _UxGT(" Vel"); - LSTR MSG_VMAX_EN = _UxGT("Max * Vel"); + LSTR MSG_MAX_SPEED = _UxGT("Max Velocidade"); + LSTR MSG_VMAX_A = _UxGT("Max ") STR_A _UxGT(" Speed"); + LSTR MSG_VMAX_B = _UxGT("Max ") STR_B _UxGT(" Speed"); + LSTR MSG_VMAX_C = _UxGT("Max ") STR_C _UxGT(" Speed"); + LSTR MSG_VMAX_N = _UxGT("Max @ Speed"); + LSTR MSG_VMAX_E = _UxGT("Max E Speed"); + LSTR MSG_VMAX_EN = _UxGT("Max * Speed"); LSTR MSG_VMIN = _UxGT("Vmin"); LSTR MSG_VTRAV_MIN = _UxGT("V-viaxe min"); LSTR MSG_ACCELERATION = _UxGT("Aceleración"); LSTR MSG_AMAX_A = _UxGT("Max ") STR_A _UxGT(" Accel"); LSTR MSG_AMAX_B = _UxGT("Max ") STR_B _UxGT(" Accel"); LSTR MSG_AMAX_C = _UxGT("Max ") STR_C _UxGT(" Accel"); - LSTR MSG_AMAX_I = _UxGT("Max ") STR_I _UxGT(" Accel"); - LSTR MSG_AMAX_J = _UxGT("Max ") STR_J _UxGT(" Accel"); - LSTR MSG_AMAX_K = _UxGT("Max ") STR_K _UxGT(" Accel"); - LSTR MSG_AMAX_E = _UxGT("Max ") STR_E _UxGT(" Accel"); + LSTR MSG_AMAX_E = _UxGT("Max E Accel"); LSTR MSG_AMAX_EN = _UxGT("Max * Accel"); LSTR MSG_A_RETRACT = _UxGT("A-retrac."); LSTR MSG_A_TRAVEL = _UxGT("A-viaxe"); @@ -304,9 +297,7 @@ namespace Language_gl { LSTR MSG_A_STEPS = STR_A _UxGT(" pasos/mm"); LSTR MSG_B_STEPS = STR_B _UxGT(" pasos/mm"); LSTR MSG_C_STEPS = STR_C _UxGT(" pasos/mm"); - LSTR MSG_I_STEPS = STR_I _UxGT(" pasos/mm"); - LSTR MSG_J_STEPS = STR_J _UxGT(" pasos/mm"); - LSTR MSG_K_STEPS = STR_K _UxGT(" pasos/mm"); + LSTR MSG_N_STEPS = _UxGT("@ pasos/mm"); LSTR MSG_E_STEPS = _UxGT("E pasos/mm"); LSTR MSG_EN_STEPS = _UxGT("* pasos/mm"); LSTR MSG_TEMPERATURE = _UxGT("Temperatura"); @@ -429,6 +420,7 @@ namespace Language_gl { LSTR MSG_BABYSTEP_X = _UxGT("Micropaso X"); LSTR MSG_BABYSTEP_Y = _UxGT("Micropaso Y"); LSTR MSG_BABYSTEP_Z = _UxGT("Micropaso Z"); + LSTR MSG_BABYSTEP_N = _UxGT("Micropaso @"); LSTR MSG_BABYSTEP_TOTAL = _UxGT("Total"); LSTR MSG_ENDSTOP_ABORT = _UxGT("Erro FinCarro"); LSTR MSG_HEATING_FAILED_LCD = _UxGT("Fallo Quentando"); @@ -496,13 +488,7 @@ namespace Language_gl { LSTR MSG_INFO_MAX_TEMP = _UxGT("Temp Máx"); LSTR MSG_INFO_PSU = _UxGT("Fonte Alimentación"); LSTR MSG_DRIVE_STRENGTH = _UxGT("Forza do Motor"); - LSTR MSG_DAC_PERCENT_A = STR_A _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_B = STR_B _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_C = STR_C _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_I = STR_I _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_J = STR_J _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_K = STR_K _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_E = _UxGT("E Driver %"); + LSTR MSG_DAC_PERCENT_N = _UxGT("@ Driver %"); LSTR MSG_ERROR_TMC = _UxGT("ERRO CONEX. TMC"); LSTR MSG_DAC_EEPROM_WRITE = _UxGT("Escribe DAC EEPROM"); LSTR MSG_FILAMENT_CHANGE_HEADER = _UxGT("CAMBIAR FILAMENTO"); diff --git a/Marlin/src/lcd/language/language_hr.h b/Marlin/src/lcd/language/language_hr.h index 40705bbc91d9..10f11f616f5f 100644 --- a/Marlin/src/lcd/language/language_hr.h +++ b/Marlin/src/lcd/language/language_hr.h @@ -78,7 +78,7 @@ namespace Language_hr { LSTR MSG_LEVEL_BED = _UxGT("Niveliraj bed"); LSTR MSG_MOVE_X = _UxGT("Miči X"); LSTR MSG_MOVE_Y = _UxGT("Miči Y"); - LSTR MSG_MOVE_N_MM = _UxGT("Miči %smm"); + LSTR MSG_MOVE_N_MM = _UxGT("Miči $mm"); LSTR MSG_MOVE_01MM = _UxGT("Miči 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Miči 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Miči 10mm"); diff --git a/Marlin/src/lcd/language/language_hu.h b/Marlin/src/lcd/language/language_hu.h index 6321ed136741..81db96df1702 100644 --- a/Marlin/src/lcd/language/language_hu.h +++ b/Marlin/src/lcd/language/language_hu.h @@ -79,9 +79,6 @@ namespace Language_hu { LSTR MSG_HOME_OFFSET_X = _UxGT("X Kezdö eltol."); LSTR MSG_HOME_OFFSET_Y = _UxGT("Y Kezdö eltol."); LSTR MSG_HOME_OFFSET_Z = _UxGT("Z Kezdö eltol."); - LSTR MSG_HOME_OFFSET_I = _UxGT("Kezdö eltol. ") STR_I; - LSTR MSG_HOME_OFFSET_J = _UxGT("Kezdö eltol. ") STR_J; - LSTR MSG_HOME_OFFSET_K = _UxGT("Kezdö eltol. ") STR_K; LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Eltolás beállítva."); LSTR MSG_TRAMMING_WIZARD = _UxGT("Elektromos varázsló"); LSTR MSG_SELECT_ORIGIN = _UxGT("Eredeti választása"); @@ -259,13 +256,11 @@ namespace Language_hu { LSTR MSG_MOVE_X = _UxGT("X mozgás"); LSTR MSG_MOVE_Y = _UxGT("Y mozgás"); LSTR MSG_MOVE_Z = _UxGT("Z mozgás"); - LSTR MSG_MOVE_I = _UxGT("Mozgás ") STR_I; - LSTR MSG_MOVE_J = _UxGT("Mozgás ") STR_J; - LSTR MSG_MOVE_K = _UxGT("Mozgás ") STR_K; + LSTR MSG_MOVE_N = _UxGT("@ mozgás"); LSTR MSG_MOVE_E = _UxGT("Adagoló"); LSTR MSG_MOVE_EN = _UxGT("Adagoló *"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("A fej túl hideg"); - LSTR MSG_MOVE_N_MM = _UxGT("Mozgás %smm"); + LSTR MSG_MOVE_N_MM = _UxGT("Mozgás $mm"); LSTR MSG_MOVE_01MM = _UxGT("Mozgás 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Mozgás 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Mozgás 10mm"); @@ -319,19 +314,15 @@ namespace Language_hu { LSTR MSG_VA_JERK = _UxGT("Seb.") STR_A _UxGT("-Rántás"); LSTR MSG_VB_JERK = _UxGT("Seb.") STR_B _UxGT("-Rántás"); LSTR MSG_VC_JERK = _UxGT("Seb.") STR_C _UxGT("-Rántás"); - LSTR MSG_VI_JERK = _UxGT("Seb.") STR_I _UxGT("-Rántás"); - LSTR MSG_VJ_JERK = _UxGT("Seb.") STR_J _UxGT("-Rántás"); - LSTR MSG_VK_JERK = _UxGT("Seb.") STR_K _UxGT("-Rántás"); + LSTR MSG_VN_JERK = _UxGT("Seb.@-Rántás"); LSTR MSG_VE_JERK = _UxGT("E ránt. seb."); LSTR MSG_JUNCTION_DEVIATION = _UxGT("Csomopont eltérés"); - LSTR MSG_VELOCITY = _UxGT("Sebesség"); + LSTR MSG_MAX_SPEED = _UxGT("Max Sebesség (mm/s)"); LSTR MSG_VMAX_A = _UxGT("Max Seb. ") STR_A; LSTR MSG_VMAX_B = _UxGT("Max Seb. ") STR_B; LSTR MSG_VMAX_C = _UxGT("Max Seb. ") STR_C; - LSTR MSG_VMAX_I = _UxGT("Max Seb. ") STR_I; - LSTR MSG_VMAX_J = _UxGT("Max Seb. ") STR_J; - LSTR MSG_VMAX_K = _UxGT("Max Seb. ") STR_K; - LSTR MSG_VMAX_E = _UxGT("Max Seb. ") STR_E; + LSTR MSG_VMAX_N = _UxGT("Max Seb. @"); + LSTR MSG_VMAX_E = _UxGT("Max Seb. E"); LSTR MSG_VMAX_EN = _UxGT("Max sebesség *"); LSTR MSG_VMIN = _UxGT("Min sebesség"); LSTR MSG_VTRAV_MIN = _UxGT("Min utazó.seb."); @@ -339,10 +330,8 @@ namespace Language_hu { LSTR MSG_AMAX_A = _UxGT("Max gyors. ") STR_A; LSTR MSG_AMAX_B = _UxGT("Max gyors. ") STR_B; LSTR MSG_AMAX_C = _UxGT("Max gyors. ") STR_C; - LSTR MSG_AMAX_I = _UxGT("Max gyors. ") STR_I; - LSTR MSG_AMAX_J = _UxGT("Max gyors. ") STR_J; - LSTR MSG_AMAX_K = _UxGT("Max gyors. ") STR_K; - LSTR MSG_AMAX_E = _UxGT("Max gyors. ") STR_E; + LSTR MSG_AMAX_N = _UxGT("Max gyors. @"); + LSTR MSG_AMAX_E = _UxGT("Max gyors. E"); LSTR MSG_AMAX_EN = _UxGT("Max gyorsulás *"); LSTR MSG_A_RETRACT = _UxGT("Visszahúzás"); LSTR MSG_A_TRAVEL = _UxGT("Utazás"); @@ -352,9 +341,7 @@ namespace Language_hu { LSTR MSG_A_STEPS = STR_A _UxGT(" Lépés/mm"); LSTR MSG_B_STEPS = STR_B _UxGT(" Lépés/mm"); LSTR MSG_C_STEPS = STR_C _UxGT(" Lépés/mm"); - LSTR MSG_I_STEPS = STR_I _UxGT(" Lépés/mm"); - LSTR MSG_J_STEPS = STR_J _UxGT(" Lépés/mm"); - LSTR MSG_K_STEPS = STR_K _UxGT(" Lépés/mm"); + LSTR MSG_N_STEPS = _UxGT("@ lépés/mm"); LSTR MSG_E_STEPS = _UxGT("E lépés/mm"); LSTR MSG_EN_STEPS = _UxGT("*Lépés/mm"); LSTR MSG_TEMPERATURE = _UxGT("Höfok"); @@ -488,9 +475,7 @@ namespace Language_hu { LSTR MSG_BABYSTEP_X = _UxGT("Mikrolépés X"); LSTR MSG_BABYSTEP_Y = _UxGT("Mikrolépés Y"); LSTR MSG_BABYSTEP_Z = _UxGT("Mikrolépés Z"); - LSTR MSG_BABYSTEP_I = _UxGT("Mikrolépés ") STR_I; - LSTR MSG_BABYSTEP_J = _UxGT("Mikrolépés ") STR_J; - LSTR MSG_BABYSTEP_K = _UxGT("Mikrolépés ") STR_K; + LSTR MSG_BABYSTEP_N = _UxGT("Mikrolépés @"); LSTR MSG_BABYSTEP_TOTAL = _UxGT("Teljes"); LSTR MSG_ENDSTOP_ABORT = _UxGT("Végállás megszakítva!"); LSTR MSG_HEATING_FAILED_LCD = _UxGT("Fütés hiba!"); @@ -568,13 +553,7 @@ namespace Language_hu { LSTR MSG_INFO_MAX_TEMP = _UxGT("Max höfok"); LSTR MSG_INFO_PSU = _UxGT("PSU"); LSTR MSG_DRIVE_STRENGTH = _UxGT("Meghajtási erö"); - LSTR MSG_DAC_PERCENT_A = STR_A _UxGT(" Meghajtó %"); - LSTR MSG_DAC_PERCENT_B = STR_B _UxGT(" Meghajtó %"); - LSTR MSG_DAC_PERCENT_C = STR_C _UxGT(" Meghajtó %"); - LSTR MSG_DAC_PERCENT_I = STR_I _UxGT(" Meghajtó %"); - LSTR MSG_DAC_PERCENT_J = STR_J _UxGT(" Meghajtó %"); - LSTR MSG_DAC_PERCENT_K = STR_K _UxGT(" Meghajtó %"); - LSTR MSG_DAC_PERCENT_E = _UxGT("E meghajtó %"); + LSTR MSG_DAC_PERCENT_N = _UxGT("@ meghajtó %"); LSTR MSG_ERROR_TMC = _UxGT("TMC CSATLAKOZÁSI HIBA"); LSTR MSG_DAC_EEPROM_WRITE = _UxGT("DAC EEPROM írása"); LSTR MSG_FILAMENT_CHANGE_HEADER = _UxGT("NYOMTATÓSZÁL CSERE"); diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index 82c595aa8c22..b043ac26e168 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -27,10 +27,9 @@ * LCD Menu Messages * See also https://marlinfw.org/docs/development/lcd_language.html * - * Substitutions are applied for the following characters when used - * in menu items that call lcd_put_u8str_ind_P with an index: + * Substitutions are applied for the following characters when used in menu items titles: * - * $ displays an inserted C-string + * $ displays an inserted string * = displays '0'....'10' for indexes 0 - 10 * ~ displays '1'....'11' for indexes 0 - 10 * * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL) @@ -95,12 +94,6 @@ namespace Language_it { LSTR MSG_HOME_OFFSET_X = _UxGT("Offset home X"); LSTR MSG_HOME_OFFSET_Y = _UxGT("Offset home Y"); LSTR MSG_HOME_OFFSET_Z = _UxGT("Offset home Z"); - LSTR MSG_HOME_OFFSET_I = _UxGT("Offset home ") STR_I; - LSTR MSG_HOME_OFFSET_J = _UxGT("Offset home ") STR_J; - LSTR MSG_HOME_OFFSET_K = _UxGT("Offset home ") STR_K; - LSTR MSG_HOME_OFFSET_U = _UxGT("Offset home ") STR_U; - LSTR MSG_HOME_OFFSET_V = _UxGT("Offset home ") STR_V; - LSTR MSG_HOME_OFFSET_W = _UxGT("Offset home ") STR_W; LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Offset applicato"); LSTR MSG_TRAMMING_WIZARD = _UxGT("Wizard Tramming"); LSTR MSG_SELECT_ORIGIN = _UxGT("Selez. origine"); @@ -284,16 +277,11 @@ namespace Language_it { LSTR MSG_MOVE_X = _UxGT("Muovi X"); LSTR MSG_MOVE_Y = _UxGT("Muovi Y"); LSTR MSG_MOVE_Z = _UxGT("Muovi Z"); - LSTR MSG_MOVE_I = _UxGT("Muovi ") STR_I; - LSTR MSG_MOVE_J = _UxGT("Muovi ") STR_J; - LSTR MSG_MOVE_K = _UxGT("Muovi ") STR_K; - LSTR MSG_MOVE_U = _UxGT("Muovi ") STR_U; - LSTR MSG_MOVE_V = _UxGT("Muovi ") STR_V; - LSTR MSG_MOVE_W = _UxGT("Muovi ") STR_W; + LSTR MSG_MOVE_N = _UxGT("Muovi @"); LSTR MSG_MOVE_E = _UxGT("Estrusore"); LSTR MSG_MOVE_EN = _UxGT("Estrusore *"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("Ugello freddo"); - LSTR MSG_MOVE_N_MM = _UxGT("Muovi di %smm"); + LSTR MSG_MOVE_N_MM = _UxGT("Muovi di $mm"); LSTR MSG_MOVE_01MM = _UxGT("Muovi di 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Muovi di 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Muovi di 10mm"); @@ -302,13 +290,6 @@ namespace Language_it { LSTR MSG_MOVE_001IN = _UxGT("Muovi di 0.01\""); LSTR MSG_MOVE_01IN = _UxGT("Muovi di 0.1\""); LSTR MSG_MOVE_1IN = _UxGT("Muovi di 1\""); - LSTR MSG_SPEED = _UxGT("Velocità"); - LSTR MSG_MAXSPEED = _UxGT("Vel.massima (mm/s)"); - LSTR MSG_MAXSPEED_X = _UxGT("Vel.massima ") STR_A; - LSTR MSG_MAXSPEED_Y = _UxGT("Vel.massima ") STR_B; - LSTR MSG_MAXSPEED_Z = _UxGT("Vel.massima ") STR_C; - LSTR MSG_MAXSPEED_E = _UxGT("Vel.massima ") STR_E; - LSTR MSG_MAXSPEED_A = _UxGT("Vel.massima @"); LSTR MSG_BED_Z = _UxGT("Piatto Z"); LSTR MSG_NOZZLE = _UxGT("Ugello"); LSTR MSG_NOZZLE_N = _UxGT("Ugello ~"); @@ -361,25 +342,15 @@ namespace Language_it { LSTR MSG_VA_JERK = _UxGT("Max Jerk ") STR_A; LSTR MSG_VB_JERK = _UxGT("Max Jerk ") STR_B; LSTR MSG_VC_JERK = _UxGT("Max Jerk ") STR_C; - LSTR MSG_VI_JERK = _UxGT("Max Jerk ") STR_I; - LSTR MSG_VJ_JERK = _UxGT("Max Jerk ") STR_J; - LSTR MSG_VK_JERK = _UxGT("Max Jerk ") STR_K; - LSTR MSG_VU_JERK = _UxGT("Max Jerk ") STR_U; - LSTR MSG_VV_JERK = _UxGT("Max Jerk ") STR_V; - LSTR MSG_VW_JERK = _UxGT("Max Jerk ") STR_W; + LSTR MSG_VN_JERK = _UxGT("Max Jerk @"); LSTR MSG_VE_JERK = _UxGT("Max Jerk E"); LSTR MSG_JUNCTION_DEVIATION = _UxGT("Deviaz. giunzioni"); - LSTR MSG_VELOCITY = _UxGT("Velocità"); + LSTR MSG_MAX_SPEED = _UxGT("Vel.massima (mm/s)"); LSTR MSG_VMAX_A = _UxGT("Vel.Massima ") STR_A; LSTR MSG_VMAX_B = _UxGT("Vel.Massima ") STR_B; LSTR MSG_VMAX_C = _UxGT("Vel.Massima ") STR_C; - LSTR MSG_VMAX_I = _UxGT("Vel.Massima ") STR_I; - LSTR MSG_VMAX_J = _UxGT("Vel.Massima ") STR_J; - LSTR MSG_VMAX_K = _UxGT("Vel.Massima ") STR_K; - LSTR MSG_VMAX_U = _UxGT("Vel.Massima ") STR_U; - LSTR MSG_VMAX_V = _UxGT("Vel.Massima ") STR_V; - LSTR MSG_VMAX_W = _UxGT("Vel.Massima ") STR_W; - LSTR MSG_VMAX_E = _UxGT("Vel.Massima ") STR_E; + LSTR MSG_VMAX_N = _UxGT("Vel.Massima @"); + LSTR MSG_VMAX_E = _UxGT("Vel.Massima E"); LSTR MSG_VMAX_EN = _UxGT("Vel.Massima *"); LSTR MSG_VMIN = _UxGT("Vel.Minima"); LSTR MSG_VTRAV_MIN = _UxGT("Vel.Min spostam."); @@ -387,13 +358,8 @@ namespace Language_it { LSTR MSG_AMAX_A = _UxGT("Acc.Massima ") STR_A; LSTR MSG_AMAX_B = _UxGT("Acc.Massima ") STR_B; LSTR MSG_AMAX_C = _UxGT("Acc.Massima ") STR_C; - LSTR MSG_AMAX_I = _UxGT("Acc.Massima ") STR_I; - LSTR MSG_AMAX_J = _UxGT("Acc.Massima ") STR_J; - LSTR MSG_AMAX_K = _UxGT("Acc.Massima ") STR_K; - LSTR MSG_AMAX_E = _UxGT("Acc.Massima ") STR_E; - LSTR MSG_AMAX_U = _UxGT("Acc.Massima ") STR_U; - LSTR MSG_AMAX_V = _UxGT("Acc.Massima ") STR_V; - LSTR MSG_AMAX_W = _UxGT("Acc.Massima ") STR_W; + LSTR MSG_AMAX_N = _UxGT("Acc.Massima @"); + LSTR MSG_AMAX_E = _UxGT("Acc.Massima E"); LSTR MSG_AMAX_EN = _UxGT("Acc.Massima *"); LSTR MSG_A_RETRACT = _UxGT("A-Ritrazione"); LSTR MSG_A_TRAVEL = _UxGT("A-Spostamento"); @@ -403,12 +369,7 @@ namespace Language_it { LSTR MSG_A_STEPS = STR_A _UxGT(" passi/mm"); LSTR MSG_B_STEPS = STR_B _UxGT(" passi/mm"); LSTR MSG_C_STEPS = STR_C _UxGT(" passi/mm"); - LSTR MSG_I_STEPS = STR_I _UxGT(" passi/mm"); - LSTR MSG_J_STEPS = STR_J _UxGT(" passi/mm"); - LSTR MSG_K_STEPS = STR_K _UxGT(" passi/mm"); - LSTR MSG_U_STEPS = STR_U _UxGT(" passi/mm"); - LSTR MSG_V_STEPS = STR_V _UxGT(" passi/mm"); - LSTR MSG_W_STEPS = STR_W _UxGT(" passi/mm"); + LSTR MSG_N_STEPS = _UxGT("@ passi/mm"); LSTR MSG_E_STEPS = _UxGT("E passi/mm"); LSTR MSG_EN_STEPS = _UxGT("* passi/mm"); LSTR MSG_TEMPERATURE = _UxGT("Temperatura"); @@ -560,12 +521,7 @@ namespace Language_it { LSTR MSG_BABYSTEP_X = _UxGT("Babystep X"); LSTR MSG_BABYSTEP_Y = _UxGT("Babystep Y"); LSTR MSG_BABYSTEP_Z = _UxGT("Babystep Z"); - LSTR MSG_BABYSTEP_I = _UxGT("Babystep ") STR_I; - LSTR MSG_BABYSTEP_J = _UxGT("Babystep ") STR_J; - LSTR MSG_BABYSTEP_K = _UxGT("Babystep ") STR_K; - LSTR MSG_BABYSTEP_U = _UxGT("Babystep ") STR_U; - LSTR MSG_BABYSTEP_V = _UxGT("Babystep ") STR_V; - LSTR MSG_BABYSTEP_W = _UxGT("Babystep ") STR_W; + LSTR MSG_BABYSTEP_N = _UxGT("Babystep @"); LSTR MSG_BABYSTEP_TOTAL = _UxGT("Totali"); LSTR MSG_ENDSTOP_ABORT = _UxGT("Interrompi se FC"); LSTR MSG_HEATING_FAILED_LCD = _UxGT("Risc.Fallito"); // Max 12 characters @@ -658,16 +614,7 @@ namespace Language_it { LSTR MSG_INFO_MAX_TEMP = _UxGT("Temp max"); LSTR MSG_INFO_PSU = _UxGT("Alimentatore"); LSTR MSG_DRIVE_STRENGTH = _UxGT("Potenza Drive"); - LSTR MSG_DAC_PERCENT_A = _UxGT("Driver ") STR_A _UxGT(" %"); - LSTR MSG_DAC_PERCENT_B = _UxGT("Driver ") STR_B _UxGT(" %"); - LSTR MSG_DAC_PERCENT_C = _UxGT("Driver ") STR_C _UxGT(" %"); - LSTR MSG_DAC_PERCENT_I = _UxGT("Driver ") STR_I _UxGT(" %"); - LSTR MSG_DAC_PERCENT_J = _UxGT("Driver ") STR_J _UxGT(" %"); - LSTR MSG_DAC_PERCENT_K = _UxGT("Driver ") STR_K _UxGT(" %"); - LSTR MSG_DAC_PERCENT_U = _UxGT("Driver ") STR_U _UxGT(" %"); - LSTR MSG_DAC_PERCENT_V = _UxGT("Driver ") STR_V _UxGT(" %"); - LSTR MSG_DAC_PERCENT_W = _UxGT("Driver ") STR_W _UxGT(" %"); - LSTR MSG_DAC_PERCENT_E = _UxGT("Driver E %"); + LSTR MSG_DAC_PERCENT_N = _UxGT("Driver @ %"); LSTR MSG_ERROR_TMC = _UxGT("ERR.CONNESSIONE TMC"); LSTR MSG_DAC_EEPROM_WRITE = _UxGT("Scrivi DAC EEPROM"); LSTR MSG_FILAMENT_CHANGE_HEADER = _UxGT("CAMBIO FILAMENTO"); diff --git a/Marlin/src/lcd/language/language_jp_kana.h b/Marlin/src/lcd/language/language_jp_kana.h index 01d1c0b987ea..0a53ee50d21f 100644 --- a/Marlin/src/lcd/language/language_jp_kana.h +++ b/Marlin/src/lcd/language/language_jp_kana.h @@ -93,7 +93,7 @@ namespace Language_jp_kana { LSTR MSG_MOVE_Y = _UxGT("Yジク イドウ"); // "Move Y" LSTR MSG_MOVE_Z = _UxGT("Zジク イドウ"); // "Move Z" LSTR MSG_MOVE_E = _UxGT("エクストルーダー"); // "Extruder" - LSTR MSG_MOVE_N_MM = _UxGT("%smm イドウ"); // "Move 0.025mm" + LSTR MSG_MOVE_N_MM = _UxGT("$mm イドウ"); // "Move 0.025mm" LSTR MSG_MOVE_01MM = _UxGT("0.1mm イドウ"); // "Move 0.1mm" LSTR MSG_MOVE_1MM = _UxGT(" 1mm イドウ"); // "Move 1mm" LSTR MSG_MOVE_10MM = _UxGT(" 10mm イドウ"); // "Move 10mm" @@ -118,20 +118,16 @@ namespace Language_jp_kana { LSTR MSG_VA_JERK = _UxGT("ジク ヤクドウ mm/s") STR_A; // "Va-jerk" LSTR MSG_VB_JERK = _UxGT("ジク ヤクドウ mm/s") STR_B; // "Vb-jerk" LSTR MSG_VC_JERK = _UxGT("ジク ヤクドウ mm/s") STR_C; // "Vc-jerk" - LSTR MSG_VI_JERK = _UxGT("ジク ヤクドウ mm/s") STR_I; // "Va-jerk" - LSTR MSG_VJ_JERK = _UxGT("ジク ヤクドウ mm/s") STR_J; // "Vb-jerk" - LSTR MSG_VK_JERK = _UxGT("ジク ヤクドウ mm/s") STR_K; // "Vc-jerk" + LSTR MSG_VN_JERK = _UxGT("ジク ヤクドウ mm/s@"); // "V@-jerk" LSTR MSG_A_STEPS = STR_A _UxGT("ステップ/mm"); LSTR MSG_B_STEPS = STR_B _UxGT("ステップ/mm"); LSTR MSG_C_STEPS = STR_C _UxGT("ステップ/mm"); + LSTR MSG_N_STEPS = _UxGT("@ステップ/mm"); LSTR MSG_VE_JERK = _UxGT("エクストルーダー ヤクド"); // "Ve-jerk" LSTR MSG_VMAX_A = _UxGT("サイダイオクリソクド ") STR_A; // "Vmax A" LSTR MSG_VMAX_B = _UxGT("サイダイオクリソクド ") STR_B; // "Vmax B" LSTR MSG_VMAX_C = _UxGT("サイダイオクリソクド ") STR_C; // "Vmax C" - LSTR MSG_VMAX_I = _UxGT("サイダイオクリソクド ") STR_I; // "Vmax I" - LSTR MSG_VMAX_J = _UxGT("サイダイオクリソクド ") STR_J; // "Vmax J" - LSTR MSG_VMAX_K = _UxGT("サイダイオクリソクド ") STR_K; // "Vmax K" - LSTR MSG_VMAX_E = _UxGT("サイダイオクリソクド ") STR_E; // "Vmax E" + LSTR MSG_VMAX_E = _UxGT("サイダイオクリソクド E"); // "Vmax E" LSTR MSG_VMAX_EN = _UxGT("サイダイオクリソクド *"); // "Vmax E1" LSTR MSG_VMIN = _UxGT("サイショウオクリソクド"); // "Vmin" LSTR MSG_VTRAV_MIN = _UxGT("サイショウイドウソクド"); // "VTrav min" @@ -215,13 +211,7 @@ namespace Language_jp_kana { LSTR MSG_INFO_MAX_TEMP = _UxGT("セッテイサイコウオン"); // "Max Temp" LSTR MSG_INFO_PSU = _UxGT("デンゲンシュベツ"); // "Power Supply" LSTR MSG_DRIVE_STRENGTH = _UxGT("モータークドウリョク"); // "Drive Strength" - LSTR MSG_DAC_PERCENT_A = STR_A _UxGT(" DACシュツリョク %"); // "X Driver %" - LSTR MSG_DAC_PERCENT_B = STR_B _UxGT(" DACシュツリョク %"); // "Y Driver %" - LSTR MSG_DAC_PERCENT_C = STR_C _UxGT(" DACシュツリョク %"); // "Z Driver %" - LSTR MSG_DAC_PERCENT_I = STR_I _UxGT(" DACシュツリョク %"); // "I Driver %" - LSTR MSG_DAC_PERCENT_J = STR_J _UxGT(" DACシュツリョク %"); // "J Driver %" - LSTR MSG_DAC_PERCENT_K = STR_K _UxGT(" DACシュツリョク %"); // "K Driver %" - LSTR MSG_DAC_PERCENT_E = _UxGT("E DACシュツリョク %"); // "E Driver %" + LSTR MSG_DAC_PERCENT_N = _UxGT("@ DACシュツリョク %"); // "@ Driver %" LSTR MSG_DAC_EEPROM_WRITE = _UxGT("EEPROMヘホゾン"); // "Store memory" LSTR MSG_FILAMENT_CHANGE_HEADER_PAUSE = _UxGT("イチジテイシ"); LSTR MSG_FILAMENT_CHANGE_OPTION_RESUME = _UxGT("プリントサイカイ"); // "Resume print" @@ -249,7 +239,7 @@ namespace Language_jp_kana { LSTR MSG_YES = _UxGT("ハイ"); LSTR MSG_NO = _UxGT("イイエ"); LSTR MSG_BACK = _UxGT("モドリ"); - LSTR MSG_VELOCITY = _UxGT("ソクド"); + LSTR MSG_MAX_SPEED = _UxGT("ソクド"); LSTR MSG_STEPS_PER_MM = _UxGT("ステップ/mm"); LSTR MSG_CUSTOM_COMMANDS = _UxGT("ユーザーコマンド"); LSTR MSG_PRINT_PAUSED = _UxGT("プリントガイチジテイシサレマシタ"); diff --git a/Marlin/src/lcd/language/language_nl.h b/Marlin/src/lcd/language/language_nl.h index 29a8a1fdc8d8..6b308ba48bac 100644 --- a/Marlin/src/lcd/language/language_nl.h +++ b/Marlin/src/lcd/language/language_nl.h @@ -86,7 +86,7 @@ namespace Language_nl { LSTR MSG_MOVE_Z = _UxGT("Verplaats Z"); LSTR MSG_MOVE_E = _UxGT("Extruder"); LSTR MSG_MOVE_EN = _UxGT("Extruder *"); - LSTR MSG_MOVE_N_MM = _UxGT("Verplaats %smm"); + LSTR MSG_MOVE_N_MM = _UxGT("Verplaats $mm"); LSTR MSG_MOVE_01MM = _UxGT("Verplaats 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Verplaats 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Verplaats 10mm"); @@ -157,6 +157,7 @@ namespace Language_nl { LSTR MSG_BABYSTEP_X = _UxGT("Babystap X"); LSTR MSG_BABYSTEP_Y = _UxGT("Babystap Y"); LSTR MSG_BABYSTEP_Z = _UxGT("Babystap Z"); + LSTR MSG_BABYSTEP_N = _UxGT("Babystap @"); LSTR MSG_ENDSTOP_ABORT = _UxGT("Endstop afbr."); LSTR MSG_HEATING_FAILED_LCD = _UxGT("Voorverw. fout"); LSTR MSG_ERR_REDUNDANT_TEMP = _UxGT("Redun. temp fout"); diff --git a/Marlin/src/lcd/language/language_pl.h b/Marlin/src/lcd/language/language_pl.h index 8bd7d2d30159..630f94ab12df 100644 --- a/Marlin/src/lcd/language/language_pl.h +++ b/Marlin/src/lcd/language/language_pl.h @@ -27,10 +27,9 @@ * LCD Menu Messages * See also https://marlinfw.org/docs/development/lcd_language.html * - * Substitutions are applied for the following characters when used - * in menu items that call lcd_put_u8str_ind_P with an index: + * Substitutions are applied for the following characters when used in menu items titles: * - * $ displays an inserted C-string + * $ displays an inserted string * = displays '0'....'10' for indexes 0 - 10 * ~ displays '1'....'11' for indexes 0 - 10 * * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL) @@ -239,7 +238,7 @@ namespace Language_pl { LSTR MSG_MOVE_E = _UxGT("Ekstruzja (os E)"); LSTR MSG_MOVE_EN = _UxGT("Ekstruzja (os E) *"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("Dysza za zimna"); - LSTR MSG_MOVE_N_MM = _UxGT("Przesuń co %s mm"); + LSTR MSG_MOVE_N_MM = _UxGT("Przesuń co $ mm"); LSTR MSG_MOVE_01MM = _UxGT("Przesuń co .1 mm"); LSTR MSG_MOVE_1MM = _UxGT("Przesuń co 1 mm"); LSTR MSG_MOVE_10MM = _UxGT("Przesuń co 10 mm"); @@ -276,11 +275,9 @@ namespace Language_pl { LSTR MSG_VA_JERK = _UxGT("Zryw V") STR_A; LSTR MSG_VB_JERK = _UxGT("Zryw V") STR_B; LSTR MSG_VC_JERK = _UxGT("Zryw V") STR_C; - LSTR MSG_VI_JERK = _UxGT("Zryw V") STR_I; - LSTR MSG_VJ_JERK = _UxGT("Zryw V") STR_J; - LSTR MSG_VK_JERK = _UxGT("Zryw V") STR_K; + LSTR MSG_VN_JERK = _UxGT("Zryw V@"); LSTR MSG_VE_JERK = _UxGT("Zryw Ve"); - LSTR MSG_VELOCITY = _UxGT("Prędkość (V)"); + LSTR MSG_MAX_SPEED = _UxGT("Prędkość (V)"); LSTR MSG_VTRAV_MIN = _UxGT("Vskok min"); LSTR MSG_ACCELERATION = _UxGT("Przyspieszenie (A)"); @@ -292,9 +289,7 @@ namespace Language_pl { LSTR MSG_A_STEPS = STR_A _UxGT(" kroki/mm"); LSTR MSG_B_STEPS = STR_B _UxGT(" kroki/mm"); LSTR MSG_C_STEPS = STR_C _UxGT(" kroki/mm"); - LSTR MSG_I_STEPS = STR_I _UxGT(" kroki/mm"); - LSTR MSG_J_STEPS = STR_J _UxGT(" kroki/mm"); - LSTR MSG_K_STEPS = STR_K _UxGT(" kroki/mm"); + LSTR MSG_N_STEPS = _UxGT("@ kroki/mm"); LSTR MSG_E_STEPS = _UxGT("E kroki/mm"); LSTR MSG_EN_STEPS = _UxGT("* kroki/mm"); LSTR MSG_TEMPERATURE = _UxGT("Temperatura"); @@ -445,13 +440,7 @@ namespace Language_pl { LSTR MSG_INFO_PSU = _UxGT("Zasilacz"); LSTR MSG_DRIVE_STRENGTH = _UxGT("Siła silnika"); - LSTR MSG_DAC_PERCENT_A = STR_A _UxGT(" Siła %"); - LSTR MSG_DAC_PERCENT_B = STR_B _UxGT(" Siła %"); - LSTR MSG_DAC_PERCENT_C = STR_C _UxGT(" Siła %"); - LSTR MSG_DAC_PERCENT_I = STR_I _UxGT(" Siła %"); - LSTR MSG_DAC_PERCENT_J = STR_J _UxGT(" Siła %"); - LSTR MSG_DAC_PERCENT_K = STR_K _UxGT(" Siła %"); - LSTR MSG_DAC_PERCENT_E = _UxGT("E Siła %"); + LSTR MSG_DAC_PERCENT_N = _UxGT("@ Siła %"); LSTR MSG_ERROR_TMC = _UxGT("TMC BŁĄD POŁĄCZENIA"); LSTR MSG_DAC_EEPROM_WRITE = _UxGT("Zapisz DAC EEPROM"); LSTR MSG_FILAMENT_CHANGE_HEADER = _UxGT("ZMIEŃ FILAMENT"); diff --git a/Marlin/src/lcd/language/language_pt.h b/Marlin/src/lcd/language/language_pt.h index 2366142f062f..69df8bdf5427 100644 --- a/Marlin/src/lcd/language/language_pt.h +++ b/Marlin/src/lcd/language/language_pt.h @@ -80,7 +80,7 @@ namespace Language_pt { LSTR MSG_MOVE_Z = _UxGT("Mover Z"); LSTR MSG_MOVE_E = _UxGT("Mover Extrusor"); LSTR MSG_MOVE_EN = _UxGT("Mover Extrusor *"); - LSTR MSG_MOVE_N_MM = _UxGT("Mover %smm"); + LSTR MSG_MOVE_N_MM = _UxGT("Mover $mm"); LSTR MSG_MOVE_01MM = _UxGT("Mover 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Mover 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Mover 10mm"); @@ -104,9 +104,7 @@ namespace Language_pt { LSTR MSG_A_STEPS = STR_A _UxGT(" passo/mm"); LSTR MSG_B_STEPS = STR_B _UxGT(" passo/mm"); LSTR MSG_C_STEPS = STR_C _UxGT(" passo/mm"); - LSTR MSG_I_STEPS = STR_I _UxGT(" passo/mm"); - LSTR MSG_J_STEPS = STR_J _UxGT(" passo/mm"); - LSTR MSG_K_STEPS = STR_K _UxGT(" passo/mm"); + LSTR MSG_N_STEPS = _UxGT("@ passo/mm"); LSTR MSG_E_STEPS = _UxGT("E passo/mm"); LSTR MSG_EN_STEPS = _UxGT("* passo/mm"); LSTR MSG_TEMPERATURE = _UxGT("Temperatura"); diff --git a/Marlin/src/lcd/language/language_pt_br.h b/Marlin/src/lcd/language/language_pt_br.h index 5e3e33b37625..5b73d6df6def 100644 --- a/Marlin/src/lcd/language/language_pt_br.h +++ b/Marlin/src/lcd/language/language_pt_br.h @@ -212,7 +212,7 @@ namespace Language_pt_br { LSTR MSG_MOVE_E = _UxGT("Mover Extrusor"); LSTR MSG_MOVE_EN = _UxGT("Mover Extrusor *"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("Extrus. mto fria"); - LSTR MSG_MOVE_N_MM = _UxGT("Mover %smm"); + LSTR MSG_MOVE_N_MM = _UxGT("Mover $mm"); LSTR MSG_MOVE_01MM = _UxGT("Mover 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Mover 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Mover 10mm"); @@ -242,12 +242,10 @@ namespace Language_pt_br { LSTR MSG_VA_JERK = _UxGT("arrancada V") STR_A; LSTR MSG_VB_JERK = _UxGT("arrancada V") STR_B; LSTR MSG_VC_JERK = _UxGT("arrancada V") STR_C; - LSTR MSG_VI_JERK = _UxGT("arrancada V") STR_I; - LSTR MSG_VJ_JERK = _UxGT("arrancada V") STR_J; - LSTR MSG_VK_JERK = _UxGT("arrancada V") STR_K; + LSTR MSG_VN_JERK = _UxGT("arrancada V@"); LSTR MSG_VE_JERK = _UxGT("arrancada VE"); LSTR MSG_JUNCTION_DEVIATION = _UxGT("Desv. Junção"); - LSTR MSG_VELOCITY = _UxGT("Velocidade"); + LSTR MSG_MAX_SPEED = _UxGT("Velocidade"); LSTR MSG_VTRAV_MIN = _UxGT("VDeslocamento min"); LSTR MSG_ACCELERATION = _UxGT("Aceleração"); LSTR MSG_A_RETRACT = _UxGT("Retrair A"); @@ -256,9 +254,7 @@ namespace Language_pt_br { LSTR MSG_A_STEPS = _UxGT("Passo ") STR_A _UxGT("/mm"); LSTR MSG_B_STEPS = _UxGT("Passo ") STR_B _UxGT("/mm"); LSTR MSG_C_STEPS = _UxGT("Passo ") STR_C _UxGT("/mm"); - LSTR MSG_I_STEPS = _UxGT("Passo ") STR_I _UxGT("/mm"); - LSTR MSG_J_STEPS = _UxGT("Passo ") STR_J _UxGT("/mm"); - LSTR MSG_K_STEPS = _UxGT("Passo ") STR_K _UxGT("/mm"); + LSTR MSG_N_STEPS = _UxGT("Passo @/mm"); LSTR MSG_E_STEPS = _UxGT("E/mm"); LSTR MSG_EN_STEPS = _UxGT("*/mm"); LSTR MSG_TEMPERATURE = _UxGT("Temperatura"); @@ -352,6 +348,7 @@ namespace Language_pt_br { LSTR MSG_BABYSTEP_X = _UxGT("Passinho X"); LSTR MSG_BABYSTEP_Y = _UxGT("Passinho Y"); LSTR MSG_BABYSTEP_Z = _UxGT("Passinho Z"); + LSTR MSG_BABYSTEP_N = _UxGT("Passinho @"); LSTR MSG_BABYSTEP_TOTAL = _UxGT("Total"); LSTR MSG_ENDSTOP_ABORT = _UxGT("Abortar Fim de Curso"); LSTR MSG_HEATING_FAILED_LCD = _UxGT("Aquecimento falhou"); diff --git a/Marlin/src/lcd/language/language_ro.h b/Marlin/src/lcd/language/language_ro.h index 79421752af01..79160624e7a4 100644 --- a/Marlin/src/lcd/language/language_ro.h +++ b/Marlin/src/lcd/language/language_ro.h @@ -225,7 +225,7 @@ namespace Language_ro { LSTR MSG_MOVE_E = _UxGT("Extruder"); LSTR MSG_MOVE_EN = _UxGT("Extruder *"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("Capat Prea Rece"); - LSTR MSG_MOVE_N_MM = _UxGT("Move %smm"); + LSTR MSG_MOVE_N_MM = _UxGT("Move $mm"); LSTR MSG_MOVE_01MM = _UxGT("Move 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Move 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Move 10mm"); @@ -270,30 +270,24 @@ namespace Language_ro { LSTR MSG_VA_JERK = _UxGT("V") STR_A _UxGT("-Jerk"); LSTR MSG_VB_JERK = _UxGT("V") STR_B _UxGT("-Jerk"); LSTR MSG_VC_JERK = _UxGT("V") STR_C _UxGT("-Jerk"); - LSTR MSG_VI_JERK = _UxGT("V") STR_I _UxGT("-Jerk"); - LSTR MSG_VJ_JERK = _UxGT("V") STR_J _UxGT("-Jerk"); - LSTR MSG_VK_JERK = _UxGT("V") STR_K _UxGT("-Jerk"); + LSTR MSG_VN_JERK = _UxGT("V@-Jerk"); LSTR MSG_VE_JERK = _UxGT("Ve-Jerk"); LSTR MSG_JUNCTION_DEVIATION = _UxGT("Junction Dev"); - LSTR MSG_VELOCITY = _UxGT("Velocity"); - LSTR MSG_VMAX_A = _UxGT("Vmax ") STR_A; - LSTR MSG_VMAX_B = _UxGT("Vmax ") STR_B; - LSTR MSG_VMAX_C = _UxGT("Vmax ") STR_C; - LSTR MSG_VMAX_I = _UxGT("Vmax ") STR_I; - LSTR MSG_VMAX_J = _UxGT("Vmax ") STR_J; - LSTR MSG_VMAX_K = _UxGT("Vmax ") STR_K; - LSTR MSG_VMAX_E = _UxGT("Vmax ") STR_E; - LSTR MSG_VMAX_EN = _UxGT("Vmax *"); + LSTR MSG_MAX_SPEED = _UxGT("Max Speed"); + LSTR MSG_VMAX_A = _UxGT("Max Speed ") STR_A; + LSTR MSG_VMAX_B = _UxGT("Max Speed ") STR_B; + LSTR MSG_VMAX_C = _UxGT("Max Speed ") STR_C; + LSTR MSG_VMAX_N = _UxGT("Max Speed @"); + LSTR MSG_VMAX_E = _UxGT("Max Speed E"); + LSTR MSG_VMAX_EN = _UxGT("Max Speed *"); LSTR MSG_VMIN = _UxGT("Vmin"); LSTR MSG_VTRAV_MIN = _UxGT("VTrav Min"); LSTR MSG_ACCELERATION = _UxGT("Acceleration"); LSTR MSG_AMAX_A = _UxGT("Amax ") STR_A; LSTR MSG_AMAX_B = _UxGT("Amax ") STR_B; LSTR MSG_AMAX_C = _UxGT("Amax ") STR_C; - LSTR MSG_AMAX_I = _UxGT("Amax ") STR_I; - LSTR MSG_AMAX_J = _UxGT("Amax ") STR_J; - LSTR MSG_AMAX_K = _UxGT("Amax ") STR_K; - LSTR MSG_AMAX_E = _UxGT("Amax ") STR_E; + LSTR MSG_AMAX_N = _UxGT("Amax @"); + LSTR MSG_AMAX_E = _UxGT("Amax E"); LSTR MSG_AMAX_EN = _UxGT("Amax *"); LSTR MSG_A_RETRACT = _UxGT("A-Retract"); LSTR MSG_A_TRAVEL = _UxGT("A-Travel"); @@ -303,11 +297,9 @@ namespace Language_ro { LSTR MSG_A_STEPS = STR_A _UxGT(" steps/mm"); LSTR MSG_B_STEPS = STR_B _UxGT(" steps/mm"); LSTR MSG_C_STEPS = STR_C _UxGT(" steps/mm"); - LSTR MSG_I_STEPS = STR_I _UxGT(" steps/mm"); - LSTR MSG_J_STEPS = STR_J _UxGT(" steps/mm"); - LSTR MSG_K_STEPS = STR_K _UxGT(" steps/mm"); - LSTR MSG_E_STEPS = _UxGT("Esteps/mm"); - LSTR MSG_EN_STEPS = _UxGT("*steps/mm"); + LSTR MSG_N_STEPS = _UxGT("@ steps/mm"); + LSTR MSG_E_STEPS = _UxGT("E steps/mm"); + LSTR MSG_EN_STEPS = _UxGT("* steps/mm"); LSTR MSG_TEMPERATURE = _UxGT("Temperature"); LSTR MSG_MOTION = _UxGT("Motion"); LSTR MSG_FILAMENT = _UxGT("Filament"); @@ -435,6 +427,7 @@ namespace Language_ro { LSTR MSG_BABYSTEP_X = _UxGT("Babystep X"); LSTR MSG_BABYSTEP_Y = _UxGT("Babystep Y"); LSTR MSG_BABYSTEP_Z = _UxGT("Babystep Z"); + LSTR MSG_BABYSTEP_N = _UxGT("Babystep @"); LSTR MSG_BABYSTEP_TOTAL = _UxGT("Total"); LSTR MSG_ENDSTOP_ABORT = _UxGT("Endstop Abort"); LSTR MSG_HEATING_FAILED_LCD = _UxGT("Heating Failed"); @@ -503,13 +496,7 @@ namespace Language_ro { LSTR MSG_INFO_MAX_TEMP = _UxGT("Temperatura Maxima"); LSTR MSG_INFO_PSU = _UxGT("PSU"); LSTR MSG_DRIVE_STRENGTH = _UxGT("Drive Strength"); - LSTR MSG_DAC_PERCENT_A = STR_A _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_B = STR_B _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_C = STR_C _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_I = STR_I _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_J = STR_J _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_K = STR_K _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_E = _UxGT("E Driver %"); + LSTR MSG_DAC_PERCENT_N = _UxGT("@ Driver %"); LSTR MSG_ERROR_TMC = _UxGT("TMC CONNECTION ERROR"); LSTR MSG_DAC_EEPROM_WRITE = _UxGT("DAC EEPROM Write"); LSTR MSG_FILAMENT_CHANGE_HEADER = _UxGT("FILAMENT CHANGE"); diff --git a/Marlin/src/lcd/language/language_ru.h b/Marlin/src/lcd/language/language_ru.h index 4b8d4703e453..5f05f1d2beb3 100644 --- a/Marlin/src/lcd/language/language_ru.h +++ b/Marlin/src/lcd/language/language_ru.h @@ -84,17 +84,11 @@ namespace Language_ru { LSTR MSG_HOME_OFFSET_X = _UxGT("Смещение дома X"); LSTR MSG_HOME_OFFSET_Y = _UxGT("Смещение дома Y"); LSTR MSG_HOME_OFFSET_Z = _UxGT("Смещение дома Z"); - LSTR MSG_HOME_OFFSET_I = _UxGT("Смещение дома ") STR_I; - LSTR MSG_HOME_OFFSET_J = _UxGT("Смещение дома ") STR_J; - LSTR MSG_HOME_OFFSET_K = _UxGT("Смещение дома ") STR_K; #else LSTR MSG_SET_HOME_OFFSETS = _UxGT("Установ.смещ.дома"); LSTR MSG_HOME_OFFSET_X = _UxGT("Смещ. дома X"); LSTR MSG_HOME_OFFSET_Y = _UxGT("Смещ. дома Y"); LSTR MSG_HOME_OFFSET_Z = _UxGT("Смещ. дома Z"); - LSTR MSG_HOME_OFFSET_I = _UxGT("Смещ. дома ") STR_I; - LSTR MSG_HOME_OFFSET_J = _UxGT("Смещ. дома ") STR_J; - LSTR MSG_HOME_OFFSET_K = _UxGT("Смещ. дома ") STR_K; #endif LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Смещения применены"); LSTR MSG_SELECT_ORIGIN = _UxGT("Выберите ноль"); @@ -338,9 +332,7 @@ namespace Language_ru { LSTR MSG_MOVE_X = _UxGT("Движение по X"); LSTR MSG_MOVE_Y = _UxGT("Движение по Y"); LSTR MSG_MOVE_Z = _UxGT("Движение по Z"); - LSTR MSG_MOVE_I = _UxGT("Движение по ") STR_I; - LSTR MSG_MOVE_J = _UxGT("Движение по ") STR_J; - LSTR MSG_MOVE_K = _UxGT("Движение по ") STR_K; + LSTR MSG_MOVE_N = _UxGT("Движение по @"); LSTR MSG_MOVE_E = _UxGT("Экструдер"); LSTR MSG_MOVE_EN = _UxGT("Экструдер *"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("Сопло не нагрето"); @@ -401,23 +393,19 @@ namespace Language_ru { LSTR MSG_VA_JERK = _UxGT("V") STR_A _UxGT("-рывок"); LSTR MSG_VB_JERK = _UxGT("V") STR_B _UxGT("-рывок"); LSTR MSG_VC_JERK = _UxGT("V") STR_C _UxGT("-рывок"); - LSTR MSG_VI_JERK = _UxGT("V") STR_I _UxGT("-рывок"); - LSTR MSG_VJ_JERK = _UxGT("V") STR_J _UxGT("-рывок"); - LSTR MSG_VK_JERK = _UxGT("V") STR_K _UxGT("-рывок"); + LSTR MSG_VN_JERK = _UxGT("V@-рывок"); LSTR MSG_VE_JERK = _UxGT("Ve-рывок"); #if LCD_WIDTH > 21 || HAS_DWIN_E3V2 LSTR MSG_JUNCTION_DEVIATION = _UxGT("Отклонение узла"); #else LSTR MSG_JUNCTION_DEVIATION = _UxGT("Отклон. узла"); #endif - LSTR MSG_VELOCITY = _UxGT("Скорость, мм/с"); + LSTR MSG_MAX_SPEED = _UxGT("Скорость, мм/с"); LSTR MSG_VMAX_A = _UxGT("Скор.макс ") STR_A; LSTR MSG_VMAX_B = _UxGT("Скор.макс ") STR_B; LSTR MSG_VMAX_C = _UxGT("Скор.макс ") STR_C; - LSTR MSG_VMAX_I = _UxGT("Скор.макс ") STR_I; - LSTR MSG_VMAX_J = _UxGT("Скор.макс ") STR_J; - LSTR MSG_VMAX_K = _UxGT("Скор.макс ") STR_K; - LSTR MSG_VMAX_E = _UxGT("Скор.макс ") STR_E; + LSTR MSG_VMAX_N = _UxGT("Скор.макс @"); + LSTR MSG_VMAX_E = _UxGT("Скор.макс E"); LSTR MSG_VMAX_EN = _UxGT("Скор.макс *"); LSTR MSG_VMIN = _UxGT("Скор.мин"); LSTR MSG_VTRAV_MIN = _UxGT("Перемещение мин"); @@ -425,10 +413,8 @@ namespace Language_ru { LSTR MSG_AMAX_A = _UxGT("Ускор.макс ") STR_A; LSTR MSG_AMAX_B = _UxGT("Ускор.макс ") STR_B; LSTR MSG_AMAX_C = _UxGT("Ускор.макс ") STR_C; - LSTR MSG_AMAX_I = _UxGT("Ускор.макс ") STR_I; - LSTR MSG_AMAX_J = _UxGT("Ускор.макс ") STR_J; - LSTR MSG_AMAX_K = _UxGT("Ускор.макс ") STR_K; - LSTR MSG_AMAX_E = _UxGT("Ускор.макс ") STR_E; + LSTR MSG_AMAX_N = _UxGT("Ускор.макс @"); + LSTR MSG_AMAX_E = _UxGT("Ускор.макс E"); LSTR MSG_AMAX_EN = _UxGT("Ускор.макс *"); LSTR MSG_A_RETRACT = _UxGT("Ускор.втягив."); LSTR MSG_A_TRAVEL = _UxGT("Ускор.путеш."); @@ -438,9 +424,7 @@ namespace Language_ru { LSTR MSG_A_STEPS = STR_A _UxGT(" шаг/мм"); LSTR MSG_B_STEPS = STR_B _UxGT(" шаг/мм"); LSTR MSG_C_STEPS = STR_C _UxGT(" шаг/мм"); - LSTR MSG_I_STEPS = STR_I _UxGT(" шаг/мм"); - LSTR MSG_J_STEPS = STR_J _UxGT(" шаг/мм"); - LSTR MSG_K_STEPS = STR_K _UxGT(" шаг/мм"); + LSTR MSG_N_STEPS = _UxGT("@ шаг/мм"); LSTR MSG_E_STEPS = _UxGT("E шаг/мм"); LSTR MSG_EN_STEPS = _UxGT("* шаг/мм"); LSTR MSG_TEMPERATURE = _UxGT("Температура"); @@ -611,9 +595,7 @@ namespace Language_ru { LSTR MSG_BABYSTEP_X = _UxGT("Микрошаг X"); LSTR MSG_BABYSTEP_Y = _UxGT("Микрошаг Y"); LSTR MSG_BABYSTEP_Z = _UxGT("Микрошаг Z"); - LSTR MSG_BABYSTEP_I = _UxGT("Микрошаг ") STR_I; - LSTR MSG_BABYSTEP_J = _UxGT("Микрошаг ") STR_J; - LSTR MSG_BABYSTEP_K = _UxGT("Микрошаг ") STR_K; + LSTR MSG_BABYSTEP_N = _UxGT("Микрошаг @"); LSTR MSG_BABYSTEP_TOTAL = _UxGT("Сумарно"); LSTR MSG_ENDSTOP_ABORT = _UxGT("Сработал концевик"); LSTR MSG_HEATING_FAILED_LCD = _UxGT("Разогрев не удался"); @@ -710,13 +692,7 @@ namespace Language_ru { LSTR MSG_INFO_MAX_TEMP = _UxGT("Макс. ") LCD_STR_THERMOMETER; LSTR MSG_INFO_PSU = _UxGT("БП"); LSTR MSG_DRIVE_STRENGTH = _UxGT("Сила привода"); - LSTR MSG_DAC_PERCENT_A = STR_A _UxGT(" Привод, %"); - LSTR MSG_DAC_PERCENT_B = STR_B _UxGT(" Привод, %"); - LSTR MSG_DAC_PERCENT_C = STR_C _UxGT(" Привод, %"); - LSTR MSG_DAC_PERCENT_I = STR_I _UxGT(" Привод, %"); - LSTR MSG_DAC_PERCENT_J = STR_J _UxGT(" Привод, %"); - LSTR MSG_DAC_PERCENT_K = STR_K _UxGT(" Привод, %"); - LSTR MSG_DAC_PERCENT_E = _UxGT("E Привод, %"); + LSTR MSG_DAC_PERCENT_N = _UxGT("@ Привод, %"); LSTR MSG_ERROR_TMC = _UxGT("СБОЙ СВЯЗИ С TMC"); LSTR MSG_DAC_EEPROM_WRITE = _UxGT("Запись DAC в EEPROM"); LSTR MSG_FILAMENT_CHANGE_HEADER = _UxGT("ЗАМЕНА ФИЛАМЕНТА"); diff --git a/Marlin/src/lcd/language/language_sk.h b/Marlin/src/lcd/language/language_sk.h index 7ba505ede511..124080de0b85 100644 --- a/Marlin/src/lcd/language/language_sk.h +++ b/Marlin/src/lcd/language/language_sk.h @@ -31,10 +31,9 @@ * Translated by Michal Holeš, Farma MaM * https://www.facebook.com/farmamam * - * Substitutions are applied for the following characters when used - * in menu items that call lcd_put_u8str_ind_P with an index: + * Substitutions are applied for the following characters when used in menu items titles: * - * $ displays an inserted C-string + * $ displays an inserted string * = displays '0'....'10' for indexes 0 - 10 * ~ displays '1'....'11' for indexes 0 - 10 * * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL) @@ -98,9 +97,6 @@ namespace Language_sk { LSTR MSG_HOME_OFFSET_X = _UxGT("X Ofset"); LSTR MSG_HOME_OFFSET_Y = _UxGT("Y Ofset"); LSTR MSG_HOME_OFFSET_Z = _UxGT("Z Ofset"); - LSTR MSG_HOME_OFFSET_I = STR_I _UxGT(" Ofset"); - LSTR MSG_HOME_OFFSET_J = STR_J _UxGT(" Ofset"); - LSTR MSG_HOME_OFFSET_K = STR_K _UxGT(" Ofset"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Ofsety nastavené"); LSTR MSG_TRAMMING_WIZARD = _UxGT("Spriev. vyrovn."); LSTR MSG_SELECT_ORIGIN = _UxGT("Vyberte začiatok"); @@ -281,13 +277,11 @@ namespace Language_sk { LSTR MSG_MOVE_X = _UxGT("Posunúť X"); LSTR MSG_MOVE_Y = _UxGT("Posunúť Y"); LSTR MSG_MOVE_Z = _UxGT("Posunúť Z"); - LSTR MSG_MOVE_I = _UxGT("Posunúť ") STR_I; - LSTR MSG_MOVE_J = _UxGT("Posunúť ") STR_J; - LSTR MSG_MOVE_K = _UxGT("Posunúť ") STR_K; + LSTR MSG_MOVE_N = _UxGT("Posunúť @"); LSTR MSG_MOVE_E = _UxGT("Extrudér"); LSTR MSG_MOVE_EN = _UxGT("Extrudér *"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("Hotend je studený"); - LSTR MSG_MOVE_N_MM = _UxGT("Posunúť o %smm"); + LSTR MSG_MOVE_N_MM = _UxGT("Posunúť o $mm"); LSTR MSG_MOVE_01MM = _UxGT("Posunúť o 0,1mm"); LSTR MSG_MOVE_1MM = _UxGT("Posunúť o 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Posunúť o 10mm"); @@ -297,12 +291,6 @@ namespace Language_sk { LSTR MSG_MOVE_01IN = _UxGT("Posunúť o 0,1in"); LSTR MSG_MOVE_1IN = _UxGT("Posunúť o 1,0in"); LSTR MSG_SPEED = _UxGT("Rýchlosť"); - LSTR MSG_MAXSPEED = _UxGT("Max rýchl. (mm/s)"); - LSTR MSG_MAXSPEED_X = _UxGT("Max rýchl. ") STR_A; - LSTR MSG_MAXSPEED_Y = _UxGT("Max rýchl. ") STR_B; - LSTR MSG_MAXSPEED_Z = _UxGT("Max rýchl. ") STR_C; - LSTR MSG_MAXSPEED_E = _UxGT("Max rýchl. ") STR_E; - LSTR MSG_MAXSPEED_A = _UxGT("Max rýchl. @"); LSTR MSG_BED_Z = _UxGT("Výška podl."); LSTR MSG_NOZZLE = _UxGT("Tryska"); LSTR MSG_NOZZLE_N = _UxGT("Tryska ~"); @@ -347,30 +335,24 @@ namespace Language_sk { LSTR MSG_VA_JERK = _UxGT("V") STR_A _UxGT("-skok"); LSTR MSG_VB_JERK = _UxGT("V") STR_B _UxGT("-skok"); LSTR MSG_VC_JERK = _UxGT("V") STR_C _UxGT("-skok"); - LSTR MSG_VI_JERK = _UxGT("V") STR_I _UxGT("-skok"); - LSTR MSG_VJ_JERK = _UxGT("V") STR_J _UxGT("-skok"); - LSTR MSG_VK_JERK = _UxGT("V") STR_K _UxGT("-skok"); + LSTR MSG_VN_JERK = _UxGT("V@-skok"); LSTR MSG_VE_JERK = _UxGT("Ve-skok"); LSTR MSG_JUNCTION_DEVIATION = _UxGT("Junction Dev"); - LSTR MSG_VELOCITY = _UxGT("Rýchlosť"); - LSTR MSG_VMAX_A = _UxGT("Vmax ") STR_A; - LSTR MSG_VMAX_B = _UxGT("Vmax ") STR_B; - LSTR MSG_VMAX_C = _UxGT("Vmax ") STR_C; - LSTR MSG_VMAX_I = _UxGT("Vmax ") STR_I; - LSTR MSG_VMAX_J = _UxGT("Vmax ") STR_J; - LSTR MSG_VMAX_K = _UxGT("Vmax ") STR_K; - LSTR MSG_VMAX_E = _UxGT("Vmax ") STR_E; - LSTR MSG_VMAX_EN = _UxGT("Vmax *"); + LSTR MSG_MAX_SPEED = _UxGT("Max rýchl. (mm/s)"); + LSTR MSG_VMAX_A = _UxGT("Max rýchl. ") STR_A; + LSTR MSG_VMAX_B = _UxGT("Max rýchl. ") STR_B; + LSTR MSG_VMAX_C = _UxGT("Max rýchl. ") STR_C; + LSTR MSG_VMAX_N = _UxGT("Max rýchl. @"); + LSTR MSG_VMAX_E = _UxGT("Max rýchl. E"); + LSTR MSG_VMAX_EN = _UxGT("Max rýchl. *"); LSTR MSG_VMIN = _UxGT("Vmin"); LSTR MSG_VTRAV_MIN = _UxGT("VPrej Min"); LSTR MSG_ACCELERATION = _UxGT("Akcelerácia"); LSTR MSG_AMAX_A = _UxGT("Amax ") STR_A; LSTR MSG_AMAX_B = _UxGT("Amax ") STR_B; LSTR MSG_AMAX_C = _UxGT("Amax ") STR_C; - LSTR MSG_AMAX_I = _UxGT("Amax ") STR_I; - LSTR MSG_AMAX_J = _UxGT("Amax ") STR_J; - LSTR MSG_AMAX_K = _UxGT("Amax ") STR_K; - LSTR MSG_AMAX_E = _UxGT("Amax ") STR_E; + LSTR MSG_AMAX_N = _UxGT("Amax @"); + LSTR MSG_AMAX_E = _UxGT("Amax E"); LSTR MSG_AMAX_EN = _UxGT("Amax *"); LSTR MSG_A_RETRACT = _UxGT("A-retrakt"); LSTR MSG_A_TRAVEL = _UxGT("A-prejazd"); @@ -380,11 +362,9 @@ namespace Language_sk { LSTR MSG_A_STEPS = STR_A _UxGT(" krokov/mm"); LSTR MSG_B_STEPS = STR_B _UxGT(" krokov/mm"); LSTR MSG_C_STEPS = STR_C _UxGT(" krokov/mm"); - LSTR MSG_I_STEPS = STR_I _UxGT(" krokov/mm"); - LSTR MSG_J_STEPS = STR_J _UxGT(" krokov/mm"); - LSTR MSG_K_STEPS = STR_K _UxGT(" krokov/mm"); - LSTR MSG_E_STEPS = _UxGT("Ekrokov/mm"); - LSTR MSG_EN_STEPS = _UxGT("*krokov/mm"); + LSTR MSG_N_STEPS = _UxGT("@ krokov/mm"); + LSTR MSG_E_STEPS = _UxGT("E krokov/mm"); + LSTR MSG_EN_STEPS = _UxGT("* krokov/mm"); LSTR MSG_TEMPERATURE = _UxGT("Teplota"); LSTR MSG_MOTION = _UxGT("Pohyb"); LSTR MSG_FILAMENT = _UxGT("Filament"); @@ -527,9 +507,7 @@ namespace Language_sk { LSTR MSG_BABYSTEP_X = _UxGT("Babystep X"); LSTR MSG_BABYSTEP_Y = _UxGT("Babystep Y"); LSTR MSG_BABYSTEP_Z = _UxGT("Babystep Z"); - LSTR MSG_BABYSTEP_I = _UxGT("Babystep ") STR_I; - LSTR MSG_BABYSTEP_J = _UxGT("Babystep ") STR_J; - LSTR MSG_BABYSTEP_K = _UxGT("Babystep ") STR_K; + LSTR MSG_BABYSTEP_N = _UxGT("Babystep @"); LSTR MSG_BABYSTEP_TOTAL = _UxGT("Celkom"); LSTR MSG_ENDSTOP_ABORT = _UxGT("Zastavenie Endstop"); LSTR MSG_HEATING_FAILED_LCD = _UxGT("Chyba ohrevu"); @@ -624,13 +602,7 @@ namespace Language_sk { LSTR MSG_INFO_MAX_TEMP = _UxGT("Teplota max"); LSTR MSG_INFO_PSU = _UxGT("Nap. zdroj"); LSTR MSG_DRIVE_STRENGTH = _UxGT("Budenie motorov"); - LSTR MSG_DAC_PERCENT_A = STR_A _UxGT(" Motor %"); - LSTR MSG_DAC_PERCENT_B = STR_B _UxGT(" Motor %"); - LSTR MSG_DAC_PERCENT_C = STR_C _UxGT(" Motor %"); - LSTR MSG_DAC_PERCENT_I = STR_I _UxGT(" Motor %"); - LSTR MSG_DAC_PERCENT_J = STR_J _UxGT(" Motor %"); - LSTR MSG_DAC_PERCENT_K = STR_K _UxGT(" Motor %"); - LSTR MSG_DAC_PERCENT_E = _UxGT("E Motor %"); + LSTR MSG_DAC_PERCENT_N = _UxGT("@ Motor %"); LSTR MSG_ERROR_TMC = _UxGT("CHYBA KOMUNIKÁ. TMC"); LSTR MSG_DAC_EEPROM_WRITE = _UxGT("Uložiť do EEPROM"); LSTR MSG_FILAMENT_CHANGE_HEADER = _UxGT("VÝMENA FILAMENTU"); diff --git a/Marlin/src/lcd/language/language_sv.h b/Marlin/src/lcd/language/language_sv.h index db2196fa46ae..6e6d3e11ecd0 100644 --- a/Marlin/src/lcd/language/language_sv.h +++ b/Marlin/src/lcd/language/language_sv.h @@ -252,7 +252,7 @@ namespace Language_sv { LSTR MSG_MOVE_E = _UxGT("Extruder"); LSTR MSG_MOVE_EN = _UxGT("Extruder *"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("Hetände för kall"); - LSTR MSG_MOVE_N_MM = _UxGT("Flytta %smm"); + LSTR MSG_MOVE_N_MM = _UxGT("Flytta $mm"); LSTR MSG_MOVE_01MM = _UxGT("Flytta 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Flytta 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Flytta 10mm"); @@ -300,19 +300,15 @@ namespace Language_sv { LSTR MSG_VA_JERK = _UxGT("V") STR_A _UxGT("-Ryck"); LSTR MSG_VB_JERK = _UxGT("V") STR_B _UxGT("-Ryck"); LSTR MSG_VC_JERK = _UxGT("V") STR_C _UxGT("-Ryck"); - LSTR MSG_VI_JERK = _UxGT("V") STR_I _UxGT("-Ryck"); - LSTR MSG_VJ_JERK = _UxGT("V") STR_J _UxGT("-Ryck"); - LSTR MSG_VK_JERK = _UxGT("V") STR_K _UxGT("-Ryck"); + LSTR MSG_VN_JERK = _UxGT("V@-Ryck"); LSTR MSG_VE_JERK = _UxGT("Ve-Ryck"); LSTR MSG_JUNCTION_DEVIATION = _UxGT("Knutpunkt Avv"); - LSTR MSG_VELOCITY = _UxGT("Hastighet"); + LSTR MSG_MAX_SPEED = _UxGT("Hastighet"); LSTR MSG_VMAX_A = _UxGT("Vmax ") STR_A; LSTR MSG_VMAX_B = _UxGT("Vmax ") STR_B; LSTR MSG_VMAX_C = _UxGT("Vmax ") STR_C; - LSTR MSG_VMAX_I = _UxGT("Vmax ") STR_I; - LSTR MSG_VMAX_J = _UxGT("Vmax ") STR_J; - LSTR MSG_VMAX_K = _UxGT("Vmax ") STR_K; - LSTR MSG_VMAX_E = _UxGT("Vmax ") STR_E; + LSTR MSG_VMAX_N = _UxGT("Vmax @"); + LSTR MSG_VMAX_E = _UxGT("Vmax E"); LSTR MSG_VMAX_EN = _UxGT("Vmax *"); LSTR MSG_VMIN = _UxGT("Vmin"); LSTR MSG_VTRAV_MIN = _UxGT("VTrav Min"); @@ -320,10 +316,8 @@ namespace Language_sv { LSTR MSG_AMAX_A = _UxGT("Amax ") STR_A; LSTR MSG_AMAX_B = _UxGT("Amax ") STR_B; LSTR MSG_AMAX_C = _UxGT("Amax ") STR_C; - LSTR MSG_AMAX_I = _UxGT("Amax ") STR_I; - LSTR MSG_AMAX_J = _UxGT("Amax ") STR_J; - LSTR MSG_AMAX_K = _UxGT("Amax ") STR_K; - LSTR MSG_AMAX_E = _UxGT("Amax ") STR_E; + LSTR MSG_AMAX_N = _UxGT("Amax @"); + LSTR MSG_AMAX_E = _UxGT("Amax E"); LSTR MSG_AMAX_EN = _UxGT("Amax *"); LSTR MSG_A_RETRACT = _UxGT("A-Dra tillbaka"); LSTR MSG_A_TRAVEL = _UxGT("A-Färdas"); @@ -333,9 +327,7 @@ namespace Language_sv { LSTR MSG_A_STEPS = STR_A _UxGT(" Steg/mm"); LSTR MSG_B_STEPS = STR_B _UxGT(" Steg/mm"); LSTR MSG_C_STEPS = STR_C _UxGT(" Steg/mm"); - LSTR MSG_I_STEPS = STR_I _UxGT(" Steg/mm"); - LSTR MSG_J_STEPS = STR_J _UxGT(" Steg/mm"); - LSTR MSG_K_STEPS = STR_K _UxGT(" Steg/mm"); + LSTR MSG_N_STEPS = _UxGT("@ Steg/mm"); LSTR MSG_E_STEPS = _UxGT("E Steg/mm"); LSTR MSG_EN_STEPS = _UxGT("* Steg/mm"); LSTR MSG_TEMPERATURE = _UxGT("Temperatur"); @@ -469,6 +461,7 @@ namespace Language_sv { LSTR MSG_BABYSTEP_X = _UxGT("Småsteg X"); LSTR MSG_BABYSTEP_Y = _UxGT("Småsteg Y"); LSTR MSG_BABYSTEP_Z = _UxGT("Småsteg Z"); + LSTR MSG_BABYSTEP_N = _UxGT("Småsteg @"); LSTR MSG_BABYSTEP_TOTAL = _UxGT("Total"); LSTR MSG_ENDSTOP_ABORT = _UxGT("Slutstopp Avbrott"); LSTR MSG_HEATING_FAILED_LCD = _UxGT("Värma Misslyckad"); @@ -540,13 +533,7 @@ namespace Language_sv { LSTR MSG_INFO_MAX_TEMP = _UxGT("Max Temp"); LSTR MSG_INFO_PSU = _UxGT("PSU"); LSTR MSG_DRIVE_STRENGTH = _UxGT("Driv Styrka"); - LSTR MSG_DAC_PERCENT_A = STR_A _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_B = STR_B _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_C = STR_C _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_I = STR_I _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_J = STR_J _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_K = STR_K _UxGT(" Driver %"); - LSTR MSG_DAC_PERCENT_E = _UxGT("E Driver %"); + LSTR MSG_DAC_PERCENT_N = _UxGT("@ Driver %"); LSTR MSG_ERROR_TMC = _UxGT("TMC KOPPLNINGSFEL"); LSTR MSG_DAC_EEPROM_WRITE = _UxGT("DAC EEPROM Skriv"); LSTR MSG_FILAMENT_CHANGE_HEADER = _UxGT("TRÅDBYTE"); diff --git a/Marlin/src/lcd/language/language_tr.h b/Marlin/src/lcd/language/language_tr.h index 0acdd958c32d..b981127ed1cd 100644 --- a/Marlin/src/lcd/language/language_tr.h +++ b/Marlin/src/lcd/language/language_tr.h @@ -228,7 +228,7 @@ namespace Language_tr { LSTR MSG_MOVE_E = _UxGT("Ekstruder"); LSTR MSG_MOVE_EN = _UxGT("Ekstruder *"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("Nozul Çok Soğuk"); - LSTR MSG_MOVE_N_MM = _UxGT("%smm"); + LSTR MSG_MOVE_N_MM = _UxGT("$mm"); LSTR MSG_MOVE_01MM = _UxGT("0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("1mm"); LSTR MSG_MOVE_10MM = _UxGT("10mm"); @@ -263,19 +263,15 @@ namespace Language_tr { LSTR MSG_VA_JERK = _UxGT("V") STR_A _UxGT("-Sarsım"); LSTR MSG_VB_JERK = _UxGT("V") STR_B _UxGT("-Sarsım"); LSTR MSG_VC_JERK = _UxGT("V") STR_C _UxGT("-Sarsım"); - LSTR MSG_VI_JERK = _UxGT("V") STR_I _UxGT("-Sarsım"); - LSTR MSG_VJ_JERK = _UxGT("V") STR_J _UxGT("-Sarsım"); - LSTR MSG_VK_JERK = _UxGT("V") STR_K _UxGT("-Sarsım"); + LSTR MSG_VN_JERK = _UxGT("V@-Sarsım"); LSTR MSG_VE_JERK = _UxGT("Ve-Sarsım"); LSTR MSG_JUNCTION_DEVIATION = _UxGT("Jonksiyon Sapması"); - LSTR MSG_VELOCITY = _UxGT("Hız Vektörü"); + LSTR MSG_MAX_SPEED = _UxGT("Hız Vektörü"); LSTR MSG_VMAX_A = _UxGT("HızVektör.max ") STR_A; LSTR MSG_VMAX_B = _UxGT("HızVektör.max ") STR_B; LSTR MSG_VMAX_C = _UxGT("HızVektör.max ") STR_C; - LSTR MSG_VMAX_I = _UxGT("HızVektör.max ") STR_I; - LSTR MSG_VMAX_J = _UxGT("HızVektör.max ") STR_J; - LSTR MSG_VMAX_K = _UxGT("HızVektör.max ") STR_K; - LSTR MSG_VMAX_E = _UxGT("HızVektör.max ") STR_E; + LSTR MSG_VMAX_N = _UxGT("HızVektör.max @"); + LSTR MSG_VMAX_E = _UxGT("HızVektör.max E"); LSTR MSG_VMAX_EN = _UxGT("HızVektör.max *"); LSTR MSG_VMIN = _UxGT("HızVektör.min"); LSTR MSG_VTRAV_MIN = _UxGT("HV.gezinme min"); @@ -283,10 +279,8 @@ namespace Language_tr { LSTR MSG_AMAX_A = _UxGT("Max. ivme ") STR_A; LSTR MSG_AMAX_B = _UxGT("Max. ivme ") STR_B; LSTR MSG_AMAX_C = _UxGT("Max. ivme ") STR_C; - LSTR MSG_AMAX_I = _UxGT("Max. ivme ") STR_I; - LSTR MSG_AMAX_J = _UxGT("Max. ivme ") STR_J; - LSTR MSG_AMAX_K = _UxGT("Max. ivme ") STR_K; - LSTR MSG_AMAX_E = _UxGT("Max. ivme ") STR_E; + LSTR MSG_AMAX_N = _UxGT("Max. ivme @"); + LSTR MSG_AMAX_E = _UxGT("Max. ivme E"); LSTR MSG_AMAX_EN = _UxGT("Max. ivme *"); LSTR MSG_A_RETRACT = _UxGT("Ivme-geri çekme"); LSTR MSG_A_TRAVEL = _UxGT("Ivme-gezinme"); @@ -294,9 +288,7 @@ namespace Language_tr { LSTR MSG_A_STEPS = STR_A _UxGT(" adım/mm"); LSTR MSG_B_STEPS = STR_B _UxGT(" adım/mm"); LSTR MSG_C_STEPS = STR_C _UxGT(" adım/mm"); - LSTR MSG_I_STEPS = STR_I _UxGT(" adım/mm"); - LSTR MSG_J_STEPS = STR_J _UxGT(" adım/mm"); - LSTR MSG_K_STEPS = STR_K _UxGT(" adım/mm"); + LSTR MSG_N_STEPS = _UxGT("@ adım/mm"); LSTR MSG_E_STEPS = _UxGT("E adım/mm"); LSTR MSG_EN_STEPS = _UxGT("* adım/mm"); LSTR MSG_TEMPERATURE = _UxGT("Sıcaklık"); @@ -406,6 +398,7 @@ namespace Language_tr { LSTR MSG_BABYSTEP_X = _UxGT("Miniadım X"); LSTR MSG_BABYSTEP_Y = _UxGT("Miniadım Y"); LSTR MSG_BABYSTEP_Z = _UxGT("Miniadım Z"); + LSTR MSG_BABYSTEP_N = _UxGT("Miniadım @"); LSTR MSG_BABYSTEP_TOTAL = _UxGT("Toplam"); LSTR MSG_ENDSTOP_ABORT = _UxGT("Endstop iptal"); LSTR MSG_HEATING_FAILED_LCD = _UxGT("Isınma başarısız"); @@ -473,13 +466,7 @@ namespace Language_tr { LSTR MSG_INFO_MAX_TEMP = _UxGT("Max Sıc."); LSTR MSG_INFO_PSU = _UxGT("Güç Kaynağı"); LSTR MSG_DRIVE_STRENGTH = _UxGT("Sürücü Gücü"); - LSTR MSG_DAC_PERCENT_A = STR_A _UxGT(" Sürücü %"); - LSTR MSG_DAC_PERCENT_B = STR_B _UxGT(" Sürücü %"); - LSTR MSG_DAC_PERCENT_C = STR_C _UxGT(" Sürücü %"); - LSTR MSG_DAC_PERCENT_I = STR_I _UxGT(" Sürücü %"); - LSTR MSG_DAC_PERCENT_J = STR_J _UxGT(" Sürücü %"); - LSTR MSG_DAC_PERCENT_K = STR_K _UxGT(" Sürücü %"); - LSTR MSG_DAC_PERCENT_E = _UxGT("E Sürücü %"); + LSTR MSG_DAC_PERCENT_N = _UxGT("@ Sürücü %"); LSTR MSG_ERROR_TMC = _UxGT("TMC BAĞLANTI HATASI"); LSTR MSG_DAC_EEPROM_WRITE = _UxGT("DAC EEPROM Yaz"); LSTR MSG_FILAMENT_CHANGE_HEADER = _UxGT("FILAMAN DEGISTIR"); diff --git a/Marlin/src/lcd/language/language_uk.h b/Marlin/src/lcd/language/language_uk.h index bfb74b9f6e9b..3c47ccada916 100644 --- a/Marlin/src/lcd/language/language_uk.h +++ b/Marlin/src/lcd/language/language_uk.h @@ -86,17 +86,11 @@ namespace Language_uk { LSTR MSG_HOME_OFFSET_X = _UxGT("Зміщення дому X"); LSTR MSG_HOME_OFFSET_Y = _UxGT("Зміщення дому Y"); LSTR MSG_HOME_OFFSET_Z = _UxGT("Зміщення дому Z"); - LSTR MSG_HOME_OFFSET_I = _UxGT("Зміщення дому ") STR_I; - LSTR MSG_HOME_OFFSET_J = _UxGT("Зміщення дому ") STR_J; - LSTR MSG_HOME_OFFSET_K = _UxGT("Зміщення дому ") STR_K; #else LSTR MSG_SET_HOME_OFFSETS = _UxGT("Встан. зміщ. дому"); LSTR MSG_HOME_OFFSET_X = _UxGT("Зміщ. дому X"); LSTR MSG_HOME_OFFSET_Y = _UxGT("Зміщ. дому Y"); LSTR MSG_HOME_OFFSET_Z = _UxGT("Зміщ. дому Z"); - LSTR MSG_HOME_OFFSET_I = _UxGT("Зміщ. дому ") STR_I; - LSTR MSG_HOME_OFFSET_J = _UxGT("Зміщ. дому ") STR_J; - LSTR MSG_HOME_OFFSET_K = _UxGT("Зміщ. дому ") STR_K; #endif LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Зміщення прийняті"); LSTR MSG_SELECT_ORIGIN = _UxGT("Оберіть нуль"); @@ -339,9 +333,7 @@ namespace Language_uk { LSTR MSG_MOVE_X = _UxGT("Рух по X"); LSTR MSG_MOVE_Y = _UxGT("Рух по Y"); LSTR MSG_MOVE_Z = _UxGT("Рух по Z"); - LSTR MSG_MOVE_I = _UxGT("Рух по ") STR_I; - LSTR MSG_MOVE_J = _UxGT("Рух по ") STR_J; - LSTR MSG_MOVE_K = _UxGT("Рух по ") STR_K; + LSTR MSG_MOVE_N = _UxGT("Рух по @"); LSTR MSG_MOVE_E = _UxGT("Екструдер"); LSTR MSG_MOVE_EN = _UxGT("Екструдер *"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("Сопло дуже холодне"); @@ -406,23 +398,19 @@ namespace Language_uk { LSTR MSG_VA_JERK = _UxGT("V") STR_A _UxGT("-ривок"); LSTR MSG_VB_JERK = _UxGT("V") STR_B _UxGT("-ривок"); LSTR MSG_VC_JERK = _UxGT("V") STR_C _UxGT("-ривок"); - LSTR MSG_VI_JERK = _UxGT("V") STR_I _UxGT("-ривок"); - LSTR MSG_VJ_JERK = _UxGT("V") STR_J _UxGT("-ривок"); - LSTR MSG_VK_JERK = _UxGT("V") STR_K _UxGT("-ривок"); + LSTR MSG_VN_JERK = _UxGT("V@-ривок"); LSTR MSG_VE_JERK = _UxGT("Ve-ривок"); #if LCD_WIDTH > 21 || HAS_DWIN_E3V2 LSTR MSG_JUNCTION_DEVIATION = _UxGT("Відхилення вузла"); #else LSTR MSG_JUNCTION_DEVIATION = _UxGT("Відхил.вузла"); #endif - LSTR MSG_VELOCITY = _UxGT("Швидкість, мм/с"); + LSTR MSG_MAX_SPEED = _UxGT("Швидкість, мм/с"); LSTR MSG_VMAX_A = _UxGT("Швидк.макс ") STR_A; LSTR MSG_VMAX_B = _UxGT("Швидк.макс ") STR_B; LSTR MSG_VMAX_C = _UxGT("Швидк.макс ") STR_C; - LSTR MSG_VMAX_I = _UxGT("Швидк.макс ") STR_I; - LSTR MSG_VMAX_J = _UxGT("Швидк.макс ") STR_J; - LSTR MSG_VMAX_K = _UxGT("Швидк.макс ") STR_K; - LSTR MSG_VMAX_E = _UxGT("Швидк.макс ") STR_E; + LSTR MSG_VMAX_N = _UxGT("Швидк.макс @"); + LSTR MSG_VMAX_E = _UxGT("Швидк.макс E"); LSTR MSG_VMAX_EN = _UxGT("Швидк.макс *"); LSTR MSG_VMIN = _UxGT("Швидк. мін"); #if LCD_WIDTH > 21 || HAS_DWIN_E3V2 @@ -434,10 +422,8 @@ namespace Language_uk { LSTR MSG_AMAX_A = _UxGT("Приск.макс ") STR_A; LSTR MSG_AMAX_B = _UxGT("Приск.макс ") STR_B; LSTR MSG_AMAX_C = _UxGT("Приск.макс ") STR_C; - LSTR MSG_AMAX_I = _UxGT("Приск.макс ") STR_I; - LSTR MSG_AMAX_J = _UxGT("Приск.макс ") STR_J; - LSTR MSG_AMAX_K = _UxGT("Приск.макс ") STR_K; - LSTR MSG_AMAX_E = _UxGT("Приск.макс ") STR_E; + LSTR MSG_AMAX_N = _UxGT("Приск.макс @"); + LSTR MSG_AMAX_E = _UxGT("Приск.макс E"); LSTR MSG_AMAX_EN = _UxGT("Приск.макс *"); LSTR MSG_A_RETRACT = _UxGT("Приск.втягув."); LSTR MSG_A_TRAVEL = _UxGT("Приск.переміщ."); @@ -447,9 +433,7 @@ namespace Language_uk { LSTR MSG_A_STEPS = STR_A _UxGT(" кроків/мм"); LSTR MSG_B_STEPS = STR_B _UxGT(" кроків/мм"); LSTR MSG_C_STEPS = STR_C _UxGT(" кроків/мм"); - LSTR MSG_I_STEPS = STR_I _UxGT(" кроків/мм"); - LSTR MSG_J_STEPS = STR_J _UxGT(" кроків/мм"); - LSTR MSG_K_STEPS = STR_K _UxGT(" кроків/мм"); + LSTR MSG_N_STEPS = _UxGT("@ кроків/мм"); LSTR MSG_E_STEPS = _UxGT("E кроків/мм"); LSTR MSG_EN_STEPS = _UxGT("* кроків/мм"); LSTR MSG_TEMPERATURE = _UxGT("Температура"); @@ -624,9 +608,7 @@ namespace Language_uk { LSTR MSG_BABYSTEP_X = _UxGT("Мікрокрок X"); LSTR MSG_BABYSTEP_Y = _UxGT("Мікрокрок Y"); LSTR MSG_BABYSTEP_Z = _UxGT("Мікрокрок Z"); - LSTR MSG_BABYSTEP_I = _UxGT("Мікрокрок ") STR_I; - LSTR MSG_BABYSTEP_J = _UxGT("Мікрокрок ") STR_J; - LSTR MSG_BABYSTEP_K = _UxGT("Мікрокрок ") STR_K; + LSTR MSG_BABYSTEP_N = _UxGT("Мікрокрок @"); LSTR MSG_BABYSTEP_TOTAL = _UxGT("Сумарно"); LSTR MSG_ENDSTOP_ABORT = _UxGT("Кінцевик спрацював"); LSTR MSG_HEATING_FAILED_LCD = _UxGT("Збій нагріву"); @@ -749,13 +731,7 @@ namespace Language_uk { LSTR MSG_INFO_MAX_TEMP = _UxGT("Макс. ") LCD_STR_THERMOMETER; LSTR MSG_INFO_PSU = _UxGT("Блок жив-ня"); LSTR MSG_DRIVE_STRENGTH = _UxGT("Сила мотору"); - LSTR MSG_DAC_PERCENT_A = _UxGT("Драйвер ") STR_A _UxGT(", %"); - LSTR MSG_DAC_PERCENT_B = _UxGT("Драйвер ") STR_B _UxGT(", %"); - LSTR MSG_DAC_PERCENT_C = _UxGT("Драйвер ") STR_C _UxGT(", %"); - LSTR MSG_DAC_PERCENT_I = _UxGT("Драйвер ") STR_I _UxGT(", %"); - LSTR MSG_DAC_PERCENT_J = _UxGT("Драйвер ") STR_J _UxGT(", %"); - LSTR MSG_DAC_PERCENT_K = _UxGT("Драйвер ") STR_K _UxGT(", %"); - LSTR MSG_DAC_PERCENT_E = _UxGT("Драйвер E, %"); + LSTR MSG_DAC_PERCENT_N = _UxGT("Драйвер @, %"); LSTR MSG_ERROR_TMC = _UxGT("ЗБІЙ ЗВ'ЯЗКУ З TMC"); LSTR MSG_DAC_EEPROM_WRITE = _UxGT("Запис ЦАП у EEPROM"); LSTR MSG_FILAMENT_CHANGE_HEADER = _UxGT("ЗАМІНА ПРУТКА"); diff --git a/Marlin/src/lcd/language/language_vi.h b/Marlin/src/lcd/language/language_vi.h index da9e1fc03015..f963e3e346bc 100644 --- a/Marlin/src/lcd/language/language_vi.h +++ b/Marlin/src/lcd/language/language_vi.h @@ -230,19 +230,15 @@ namespace Language_vi { LSTR MSG_VA_JERK = _UxGT("Giật-V") STR_A; LSTR MSG_VB_JERK = _UxGT("Giật-V") STR_B; LSTR MSG_VC_JERK = _UxGT("Giật-V") STR_C; - LSTR MSG_VI_JERK = _UxGT("Giật-V") STR_I; - LSTR MSG_VJ_JERK = _UxGT("Giật-V") STR_J; - LSTR MSG_VK_JERK = _UxGT("Giật-V") STR_K; + LSTR MSG_VN_JERK = _UxGT("Giật-V@"); LSTR MSG_VE_JERK = _UxGT("Giật-Ve"); LSTR MSG_JUNCTION_DEVIATION = _UxGT("Độ Lệch Chỗ Giao"); // Junction Dev - LSTR MSG_VELOCITY = _UxGT("Vận tốc"); // velocity + LSTR MSG_MAX_SPEED = _UxGT("Vận tốc"); // velocity LSTR MSG_VMAX_A = _UxGT("Vđa") STR_A; // Vmax LSTR MSG_VMAX_B = _UxGT("Vđa") STR_B; LSTR MSG_VMAX_C = _UxGT("Vđa") STR_C; - LSTR MSG_VMAX_I = _UxGT("Vđa") STR_I; - LSTR MSG_VMAX_J = _UxGT("Vđa") STR_J; - LSTR MSG_VMAX_K = _UxGT("Vđa") STR_K; - LSTR MSG_VMAX_E = _UxGT("Vđa") STR_E; + LSTR MSG_VMAX_N = _UxGT("Vđa@"); + LSTR MSG_VMAX_E = _UxGT("VđaE"); LSTR MSG_VMAX_EN = _UxGT("Vđa *"); LSTR MSG_VMIN = _UxGT("Vthiểu"); // Vmin LSTR MSG_VTRAV_MIN = _UxGT("Vchuyển thiểu"); // VTrav min @@ -250,10 +246,8 @@ namespace Language_vi { LSTR MSG_AMAX_A = _UxGT("Tăng tốc ca") STR_A; // Amax LSTR MSG_AMAX_B = _UxGT("Tăng tốc ca") STR_B; LSTR MSG_AMAX_C = _UxGT("Tăng tốc ca") STR_C; - LSTR MSG_AMAX_I = _UxGT("Tăng tốc ca") STR_I; // Amax - LSTR MSG_AMAX_J = _UxGT("Tăng tốc ca") STR_J; - LSTR MSG_AMAX_K = _UxGT("Tăng tốc ca") STR_K; - LSTR MSG_AMAX_E = _UxGT("Tăng tốc ca") STR_E; + LSTR MSG_AMAX_N = _UxGT("Tăng tốc ca@"); + LSTR MSG_AMAX_E = _UxGT("Tăng tốc caE"); LSTR MSG_AMAX_EN = _UxGT("Tăng tốc ca *"); LSTR MSG_A_RETRACT = _UxGT("TT-Rút"); // A-retract LSTR MSG_A_TRAVEL = _UxGT("TT-Chuyển"); // A-travel @@ -261,9 +255,7 @@ namespace Language_vi { LSTR MSG_A_STEPS = _UxGT("Bước") STR_A _UxGT("/mm"); // Steps/mm LSTR MSG_B_STEPS = _UxGT("Bước") STR_B _UxGT("/mm"); LSTR MSG_C_STEPS = _UxGT("Bước") STR_C _UxGT("/mm"); - LSTR MSG_I_STEPS = _UxGT("Bước") STR_I _UxGT("/mm"); // Steps/mm - LSTR MSG_J_STEPS = _UxGT("Bước") STR_J _UxGT("/mm"); - LSTR MSG_K_STEPS = _UxGT("Bước") STR_K _UxGT("/mm"); + LSTR MSG_N_STEPS = _UxGT("Bước@/mm"); LSTR MSG_E_STEPS = _UxGT("BướcE/mm"); LSTR MSG_EN_STEPS = _UxGT("Bước */mm"); LSTR MSG_TEMPERATURE = _UxGT("Nhiệt độ"); // Temperature @@ -339,6 +331,7 @@ namespace Language_vi { LSTR MSG_BABYSTEP_X = _UxGT("Nhít X"); // Babystep X LSTR MSG_BABYSTEP_Y = _UxGT("Nhít Y"); LSTR MSG_BABYSTEP_Z = _UxGT("Nhít Z"); + LSTR MSG_BABYSTEP_N = _UxGT("Nhít @"); LSTR MSG_ENDSTOP_ABORT = _UxGT("Hủy bỏ công tắc"); // Endstop abort LSTR MSG_HEATING_FAILED_LCD = _UxGT("Sưởi đầu phun không thành công"); // Heating failed LSTR MSG_ERR_REDUNDANT_TEMP = _UxGT("Điều sai: nhiệt độ dư"); // Err: REDUNDANT TEMP @@ -399,13 +392,7 @@ namespace Language_vi { LSTR MSG_INFO_MAX_TEMP = _UxGT("Nhiệt độ tối đa"); // Max temp LSTR MSG_INFO_PSU = _UxGT("Bộ nguồn"); // PSU LSTR MSG_DRIVE_STRENGTH = _UxGT("Sức mạnh ổ đĩa"); // Drive Strength - LSTR MSG_DAC_PERCENT_A = STR_A _UxGT(" % trình điều khiển"); // X Driver % - LSTR MSG_DAC_PERCENT_B = STR_B _UxGT(" % trình điều khiển"); - LSTR MSG_DAC_PERCENT_C = STR_C _UxGT(" % trình điều khiển"); - LSTR MSG_DAC_PERCENT_I = STR_I _UxGT(" % trình điều khiển"); - LSTR MSG_DAC_PERCENT_J = STR_J _UxGT(" % trình điều khiển"); - LSTR MSG_DAC_PERCENT_K = STR_K _UxGT(" % trình điều khiển"); - LSTR MSG_DAC_PERCENT_E = _UxGT("E % trình điều khiển"); + LSTR MSG_DAC_PERCENT_N = _UxGT("@ % trình điều khiển"); LSTR MSG_DAC_EEPROM_WRITE = _UxGT("Ghi DAC EEPROM"); // DAC EEPROM Write LSTR MSG_FILAMENT_CHANGE_HEADER_PAUSE = _UxGT("In tạm dừng"); // PRINT PAUSED LSTR MSG_FILAMENT_CHANGE_HEADER_LOAD = _UxGT("Nạp dây nhựa"); diff --git a/Marlin/src/lcd/language/language_zh_CN.h b/Marlin/src/lcd/language/language_zh_CN.h index f2d348b3965b..a4816ff899c0 100644 --- a/Marlin/src/lcd/language/language_zh_CN.h +++ b/Marlin/src/lcd/language/language_zh_CN.h @@ -225,7 +225,7 @@ namespace Language_zh_CN { LSTR MSG_MOVE_E = _UxGT("挤出机"); // "Extruder" LSTR MSG_MOVE_EN = _UxGT("挤出机 *"); // "Extruder" LSTR MSG_HOTEND_TOO_COLD = _UxGT("热端太冷"); - LSTR MSG_MOVE_N_MM = _UxGT("移动 %s mm"); // "Move 0.025mm" + LSTR MSG_MOVE_N_MM = _UxGT("移动 $ mm"); // "Move 0.025mm" LSTR MSG_MOVE_01MM = _UxGT("移动 0.1 mm"); // "Move 0.1mm" LSTR MSG_MOVE_1MM = _UxGT("移动 1 mm"); // "Move 1mm" LSTR MSG_MOVE_10MM = _UxGT("移动 10 mm"); // "Move 10mm" @@ -270,19 +270,15 @@ namespace Language_zh_CN { LSTR MSG_VA_JERK = _UxGT("轴抖动速率") STR_A; // "Va-jerk" LSTR MSG_VB_JERK = _UxGT("轴抖动速率") STR_B; // "Vb-jerk" LSTR MSG_VC_JERK = _UxGT("轴抖动速率") STR_C; // "Vc-jerk" - LSTR MSG_VI_JERK = _UxGT("轴抖动速率") STR_I; // "Vi-jerk" - LSTR MSG_VJ_JERK = _UxGT("轴抖动速率") STR_J; // "Vj-jerk" - LSTR MSG_VK_JERK = _UxGT("轴抖动速率") STR_K; // "Vk-jerk" + LSTR MSG_VN_JERK = _UxGT("轴抖动速率@"); // "V@-jerk" LSTR MSG_VE_JERK = _UxGT("挤出机抖动速率"); // "Ve-jerk" LSTR MSG_JUNCTION_DEVIATION = _UxGT("接点差"); - LSTR MSG_VELOCITY = _UxGT("速度"); // "Velocity" + LSTR MSG_MAX_SPEED = _UxGT("速度"); // "Velocity" LSTR MSG_VMAX_A = _UxGT("最大进料速率") STR_A; // "Vmax " max_feedrate_mm_s LSTR MSG_VMAX_B = _UxGT("最大进料速率") STR_B; LSTR MSG_VMAX_C = _UxGT("最大进料速率") STR_C; - LSTR MSG_VMAX_I = _UxGT("最大进料速率") STR_I; - LSTR MSG_VMAX_J = _UxGT("最大进料速率") STR_J; - LSTR MSG_VMAX_K = _UxGT("最大进料速率") STR_K; - LSTR MSG_VMAX_E = _UxGT("最大进料速率") STR_E; + LSTR MSG_VMAX_N = _UxGT("最大进料速率@"); + LSTR MSG_VMAX_E = _UxGT("最大进料速率E"); LSTR MSG_VMAX_EN = _UxGT("最大进料速率 *"); LSTR MSG_VMIN = _UxGT("最小进料速率"); // "Vmin" min_feedrate_mm_s LSTR MSG_VTRAV_MIN = _UxGT("最小移动速率"); // "VTrav min" min_travel_feedrate_mm_s, (target) speed of the move @@ -290,10 +286,8 @@ namespace Language_zh_CN { LSTR MSG_AMAX_A = _UxGT("最大打印加速度") STR_A; // "Amax " max_acceleration_mm_per_s2, acceleration in units/s^2 for print moves LSTR MSG_AMAX_B = _UxGT("最大打印加速度") STR_B; LSTR MSG_AMAX_C = _UxGT("最大打印加速度") STR_C; - LSTR MSG_AMAX_I = _UxGT("最大打印加速度") STR_I; - LSTR MSG_AMAX_J = _UxGT("最大打印加速度") STR_J; - LSTR MSG_AMAX_K = _UxGT("最大打印加速度") STR_K; - LSTR MSG_AMAX_E = _UxGT("最大打印加速度") STR_E; + LSTR MSG_AMAX_N = _UxGT("最大打印加速度@"); + LSTR MSG_AMAX_E = _UxGT("最大打印加速度E"); LSTR MSG_AMAX_EN = _UxGT("最大打印加速度 *"); LSTR MSG_A_RETRACT = _UxGT("收进加速度"); // "A-retract" retract_acceleration, E acceleration in mm/s^2 for retracts LSTR MSG_A_TRAVEL = _UxGT("非打印移动加速度"); // "A-travel" travel_acceleration, X, Y, Z acceleration in mm/s^2 for travel (non printing) moves @@ -303,9 +297,7 @@ namespace Language_zh_CN { LSTR MSG_A_STEPS = STR_A _UxGT(" 步数/mm"); // "Asteps/mm" LSTR MSG_B_STEPS = STR_B _UxGT(" 步数/mm"); LSTR MSG_C_STEPS = STR_C _UxGT(" 步数/mm"); - LSTR MSG_I_STEPS = STR_I _UxGT(" 步数/mm"); - LSTR MSG_J_STEPS = STR_J _UxGT(" 步数/mm"); - LSTR MSG_K_STEPS = STR_K _UxGT(" 步数/mm"); + LSTR MSG_N_STEPS = _UxGT("@ 步数/mm"); LSTR MSG_E_STEPS = _UxGT("E 步数/mm"); // "Esteps/mm" LSTR MSG_EN_STEPS = _UxGT("* 步数/mm"); LSTR MSG_TEMPERATURE = _UxGT("温度"); // "Temperature" @@ -507,13 +499,7 @@ namespace Language_zh_CN { LSTR MSG_INFO_MAX_TEMP = _UxGT("最高温度"); // "Max Temp" LSTR MSG_INFO_PSU = _UxGT("电源供应"); // "Power Supply" LSTR MSG_DRIVE_STRENGTH = _UxGT("驱动力度"); // "Drive Strength" - LSTR MSG_DAC_PERCENT_A = STR_A _UxGT(" 驱动 %"); // "X Driver %" - LSTR MSG_DAC_PERCENT_B = STR_B _UxGT(" 驱动 %"); - LSTR MSG_DAC_PERCENT_C = STR_C _UxGT(" 驱动 %"); - LSTR MSG_DAC_PERCENT_I = STR_I _UxGT(" 驱动 %"); - LSTR MSG_DAC_PERCENT_J = STR_J _UxGT(" 驱动 %"); - LSTR MSG_DAC_PERCENT_K = STR_K _UxGT(" 驱动 %"); - LSTR MSG_DAC_PERCENT_E = _UxGT("E 驱动 %"); // "E Driver %" + LSTR MSG_DAC_PERCENT_N = _UxGT("@ 驱动 %"); // "E Driver %" LSTR MSG_ERROR_TMC = _UxGT("TMC 连接错误"); LSTR MSG_DAC_EEPROM_WRITE = _UxGT("保存驱动设置"); // "DAC EEPROM Write" LSTR MSG_FILAMENT_CHANGE_HEADER = _UxGT("更换料"); diff --git a/Marlin/src/lcd/language/language_zh_TW.h b/Marlin/src/lcd/language/language_zh_TW.h index 3c0acd5fa87d..5f7c85c8383d 100644 --- a/Marlin/src/lcd/language/language_zh_TW.h +++ b/Marlin/src/lcd/language/language_zh_TW.h @@ -221,7 +221,7 @@ namespace Language_zh_TW { LSTR MSG_MOVE_E = _UxGT("擠出機"); // "Extruder" LSTR MSG_MOVE_EN = _UxGT("擠出機 *"); // "Extruder *" LSTR MSG_HOTEND_TOO_COLD = _UxGT("噴嘴溫度不夠"); // "Hotend too cold" - LSTR MSG_MOVE_N_MM = _UxGT("移動 %s mm"); // "Move 0.025mm" + LSTR MSG_MOVE_N_MM = _UxGT("移動 $ mm"); // "Move 0.025mm" LSTR MSG_MOVE_01MM = _UxGT("移動 0.1 mm"); // "Move 0.1mm" LSTR MSG_MOVE_1MM = _UxGT("移動 1 mm"); // "Move 1mm" LSTR MSG_MOVE_10MM = _UxGT("移動 10 mm"); // "Move 10mm" @@ -254,19 +254,15 @@ namespace Language_zh_TW { LSTR MSG_VA_JERK = _UxGT("軸抖動速率") STR_A; // "Va-jerk" LSTR MSG_VB_JERK = _UxGT("軸抖動速率") STR_B; LSTR MSG_VC_JERK = _UxGT("軸抖動速率") STR_C; - LSTR MSG_VI_JERK = _UxGT("軸抖動速率") STR_I; - LSTR MSG_VJ_JERK = _UxGT("軸抖動速率") STR_J; - LSTR MSG_VK_JERK = _UxGT("軸抖動速率") STR_K; + LSTR MSG_VN_JERK = _UxGT("軸抖動速率@"); LSTR MSG_VE_JERK = _UxGT("擠出機抖動速率"); - LSTR MSG_VELOCITY = _UxGT("速度"); // "Velocity" + LSTR MSG_MAX_SPEED = _UxGT("速度"); // "Velocity" LSTR MSG_VMAX_A = _UxGT("最大進料速率") STR_A; // "Vmax " max_feedrate_mm_s LSTR MSG_VMAX_B = _UxGT("最大進料速率") STR_B; LSTR MSG_VMAX_C = _UxGT("最大進料速率") STR_C; - LSTR MSG_VMAX_I = _UxGT("最大進料速率") STR_I; - LSTR MSG_VMAX_J = _UxGT("最大進料速率") STR_J; - LSTR MSG_VMAX_K = _UxGT("最大進料速率") STR_K; - LSTR MSG_VMAX_E = _UxGT("最大進料速率") STR_E; + LSTR MSG_VMAX_N = _UxGT("最大進料速率@"); + LSTR MSG_VMAX_E = _UxGT("最大進料速率E"); LSTR MSG_VMAX_EN = _UxGT("最大進料速率 *"); // "Vmax " max_feedrate_mm_s LSTR MSG_VMIN = _UxGT("最小進料速率"); // "Vmin" min_feedrate_mm_s LSTR MSG_VTRAV_MIN = _UxGT("最小移動速率"); // "VTrav min" min_travel_feedrate_mm_s, (target) speed of the move @@ -274,10 +270,8 @@ namespace Language_zh_TW { LSTR MSG_AMAX_A = _UxGT("最大列印加速度") STR_A; // "Amax " max_acceleration_mm_per_s2, acceleration in units/s^2 for print moves LSTR MSG_AMAX_B = _UxGT("最大列印加速度") STR_B; LSTR MSG_AMAX_C = _UxGT("最大列印加速度") STR_C; - LSTR MSG_AMAX_I = _UxGT("最大列印加速度") STR_I; - LSTR MSG_AMAX_J = _UxGT("最大列印加速度") STR_J; - LSTR MSG_AMAX_K = _UxGT("最大列印加速度") STR_K; - LSTR MSG_AMAX_E = _UxGT("最大列印加速度") STR_E; + LSTR MSG_AMAX_N = _UxGT("最大列印加速度@"); + LSTR MSG_AMAX_E = _UxGT("最大列印加速度E"); LSTR MSG_AMAX_EN = _UxGT("最大列印加速度 *"); // "Amax " max_acceleration_mm_per_s2, acceleration in units/s^2 for print moves LSTR MSG_A_RETRACT = _UxGT("回縮加速度"); // "A-retract" retract_acceleration, E acceleration in mm/s^2 for retracts LSTR MSG_A_TRAVEL = _UxGT("非列印移動加速度"); // "A-travel" travel_acceleration, X, Y, Z acceleration in mm/s^2 for travel (non printing) moves @@ -285,9 +279,7 @@ namespace Language_zh_TW { LSTR MSG_A_STEPS = STR_A _UxGT(" 軸步數/mm"); // "Asteps/mm" axis_steps_per_mm, axis steps-per-unit G92 LSTR MSG_B_STEPS = STR_B _UxGT(" 軸步數/mm"); LSTR MSG_C_STEPS = STR_C _UxGT(" 軸步數/mm"); - LSTR MSG_I_STEPS = STR_I _UxGT(" 軸步數/mm"); - LSTR MSG_J_STEPS = STR_J _UxGT(" 軸步數/mm"); - LSTR MSG_K_STEPS = STR_K _UxGT(" 軸步數/mm"); + LSTR MSG_N_STEPS = _UxGT("@ 軸步數/mm"); LSTR MSG_E_STEPS = _UxGT("擠出機步數/mm"); // "Esteps/mm" LSTR MSG_EN_STEPS = _UxGT("擠出機~步數/mm"); LSTR MSG_TEMPERATURE = _UxGT("溫度"); // "Temperature" @@ -454,13 +446,7 @@ namespace Language_zh_TW { LSTR MSG_INFO_MAX_TEMP = _UxGT("最高溫度"); // "Max Temp" LSTR MSG_INFO_PSU = _UxGT("電源供應"); // "Power Supply" LSTR MSG_DRIVE_STRENGTH = _UxGT("驅動力度"); // "Drive Strength" - LSTR MSG_DAC_PERCENT_A = STR_A _UxGT(" 驅動 %"); // X Driver % - LSTR MSG_DAC_PERCENT_B = STR_B _UxGT(" 驅動 %"); // Y Driver % - LSTR MSG_DAC_PERCENT_C = STR_C _UxGT(" 驅動 %"); // Z Driver % - LSTR MSG_DAC_PERCENT_I = STR_I _UxGT(" 驅動 %"); // I Driver % - LSTR MSG_DAC_PERCENT_J = STR_J _UxGT(" 驅動 %"); // J Driver % - LSTR MSG_DAC_PERCENT_K = STR_K _UxGT(" 驅動 %"); // K Driver % - LSTR MSG_DAC_PERCENT_E = _UxGT("E 驅動 %"); //E Driver % + LSTR MSG_DAC_PERCENT_N = _UxGT("@ 驅動 %"); //E Driver % LSTR MSG_ERROR_TMC = _UxGT("TMC連接錯誤"); // "TMC CONNECTION ERROR" LSTR MSG_DAC_EEPROM_WRITE = _UxGT("保存驅動設置"); // "DAC EEPROM Write" LSTR MSG_FILAMENT_CHANGE_HEADER = _UxGT("更換絲料"); // "FILAMENT CHANGE" diff --git a/Marlin/src/lcd/lcdprint.cpp b/Marlin/src/lcd/lcdprint.cpp index 52d30fdfa331..deec2b1778b8 100644 --- a/Marlin/src/lcd/lcdprint.cpp +++ b/Marlin/src/lcd/lcdprint.cpp @@ -32,19 +32,19 @@ #include "lcdprint.h" /** - * lcd_put_u8str_ind_P + * lcd_put_u8str_P * - * Print a string with an index substituted within it: + * Print a string with optional substitutions: * - * $ displays the clipped C-string given by the inStr argument + * $ displays the clipped string given by fstr or cstr * = displays '0'....'10' for indexes 0 - 10 * ~ displays '1'....'11' for indexes 0 - 10 * * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL) * @ displays an axis name such as XYZUVW, or E for an extruder */ -lcd_uint_t lcd_put_u8str_ind_P(PGM_P const pstr, const int8_t ind, PGM_P const inStr/*=nullptr*/, const lcd_uint_t maxlen/*=LCD_WIDTH*/) { +lcd_uint_t lcd_put_u8str_P(PGM_P const ptpl, const int8_t ind, const char *cstr/*=nullptr*/, FSTR_P const fstr/*=nullptr*/, const lcd_uint_t maxlen/*=LCD_WIDTH*/) { const uint8_t prop = USE_WIDE_GLYPH ? 2 : 1; - uint8_t *p = (uint8_t*)pstr; + const uint8_t *p = (uint8_t*)ptpl; int8_t n = maxlen; while (n > 0) { wchar_t ch; @@ -71,8 +71,11 @@ lcd_uint_t lcd_put_u8str_ind_P(PGM_P const pstr, const int8_t ind, PGM_P const i break; } } - else if (ch == '$' && inStr) { - n -= lcd_put_u8str_max_P(inStr, n * (MENU_FONT_WIDTH)) / (MENU_FONT_WIDTH); + else if (ch == '$' && fstr) { + n -= lcd_put_u8str_max_P(FTOP(fstr), n * (MENU_FONT_WIDTH)) / (MENU_FONT_WIDTH); + } + else if (ch == '$' && cstr) { + n -= lcd_put_u8str_max(cstr, n * (MENU_FONT_WIDTH)) / (MENU_FONT_WIDTH); } else if (ch == '@') { lcd_put_wchar(AXIS_CHAR(ind)); @@ -90,7 +93,7 @@ lcd_uint_t lcd_put_u8str_ind_P(PGM_P const pstr, const int8_t ind, PGM_P const i int calculateWidth(PGM_P const pstr) { if (!USE_WIDE_GLYPH) return utf8_strlen_P(pstr) * MENU_FONT_WIDTH; const uint8_t prop = 2; - uint8_t *p = (uint8_t*)pstr; + const uint8_t *p = (uint8_t*)pstr; int n = 0; do { diff --git a/Marlin/src/lcd/lcdprint.h b/Marlin/src/lcd/lcdprint.h index d716d035caf6..2eb47c534b05 100644 --- a/Marlin/src/lcd/lcdprint.h +++ b/Marlin/src/lcd/lcdprint.h @@ -130,83 +130,167 @@ int lcd_glyph_height(); -int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length); +/** + * @brief Draw a UTF-8 character + * + * @param utf8_str : the UTF-8 character + * @param max_length : the output width limit (in pixels on GLCD) + * + * @return the output width (in pixels on GLCD) + */ +int lcd_put_wchar_max(const wchar_t c, const pixel_len_t max_length); /** - * @brief Draw a UTF-8 string + * @brief Draw a SRAM UTF-8 string * * @param utf8_str : the UTF-8 string - * @param max_length : the pixel length of the string allowed (or number of slots in HD44780) - * - * @return the pixel width + * @param max_length : the output width limit (in pixels on GLCD) * - * Draw a UTF-8 string + * @return the output width (in pixels on GLCD) */ -int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length); +int lcd_put_u8str_max(const char *utf8_str, const pixel_len_t max_length); /** - * Set the print baseline position + * Change the print cursor position */ void lcd_moveto(const lcd_uint_t col, const lcd_uint_t row); /** * @brief Draw a ROM UTF-8 string * - * @param utf8_pstr : the ROM UTF-8 string - * @param max_length : the pixel length of the string allowed (or number of slots in HD44780) + * @param pstr : the ROM UTF-8 string + * @param max_length : the output width limit (in pixels on GLCD) * - * @return the pixel width - * - * Draw a ROM UTF-8 string + * @return the output width (in pixels on GLCD) */ -int lcd_put_u8str_max_P(PGM_P utf8_pstr, pixel_len_t max_length); -inline int lcd_put_u8str_max_P(const lcd_uint_t col, const lcd_uint_t row, PGM_P utf8_pstr, pixel_len_t max_length) { +int lcd_put_u8str_max_P(PGM_P pstr, const pixel_len_t max_length); +inline int lcd_put_u8str_max_P(const lcd_uint_t col, const lcd_uint_t row, PGM_P pstr, const pixel_len_t max_length) { lcd_moveto(col, row); - return lcd_put_u8str_max_P(utf8_pstr, max_length); + return lcd_put_u8str_max_P(pstr, max_length); } -inline int lcd_put_u8str_max(const lcd_uint_t col, const lcd_uint_t row, FSTR_P const utf8_fstr, pixel_len_t max_length) { - return lcd_put_u8str_max_P(col, row, FTOP(utf8_fstr), max_length); +inline int lcd_put_u8str_max(const lcd_uint_t col, const lcd_uint_t row, FSTR_P const fstr, const pixel_len_t max_length) { + return lcd_put_u8str_max_P(col, row, FTOP(fstr), max_length); } +/** + * @brief Draw an integer, left-justified + * + * @param i : the integer + */ void lcd_put_int(const int i); inline void lcd_put_int(const lcd_uint_t col, const lcd_uint_t row, const int i) { lcd_moveto(col, row); lcd_put_int(i); } +/** + * @brief Draw a ROM UTF-8 string + * + * @param i : the integer + */ inline int lcd_put_u8str_P(PGM_P const pstr) { return lcd_put_u8str_max_P(pstr, PIXEL_LEN_NOLIMIT); } inline int lcd_put_u8str_P(const lcd_uint_t col, const lcd_uint_t row, PGM_P const pstr) { lcd_moveto(col, row); return lcd_put_u8str_P(pstr); } +/** + * @brief Draw a ROM UTF-8 F-string + * + * @param fstr The F-string pointer + * @return the output width (in pixels on GLCD) + */ inline int lcd_put_u8str(FSTR_P const fstr) { return lcd_put_u8str_P(FTOP(fstr)); } inline int lcd_put_u8str(const lcd_uint_t col, const lcd_uint_t row, FSTR_P const fstr) { return lcd_put_u8str_P(col, row, FTOP(fstr)); } -lcd_uint_t lcd_put_u8str_ind_P(PGM_P const pstr, const int8_t ind, PGM_P const inStr=nullptr, const lcd_uint_t maxlen=LCD_WIDTH); -inline lcd_uint_t lcd_put_u8str_ind_P(const lcd_uint_t col, const lcd_uint_t row, PGM_P const pstr, const int8_t ind, PGM_P const inStr=nullptr, const lcd_uint_t maxlen=LCD_WIDTH) { +/** + * @brief Draw a string with optional substitution + * @details Print a string with optional substitutions: + * $ displays the clipped string given by fstr or cstr + * = displays '0'....'10' for indexes 0 - 10 + * ~ displays '1'....'11' for indexes 0 - 10 + * * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL) + * @ displays an axis name such as XYZUVW, or E for an extruder + * + * @param ptpl A ROM string (template) + * @param ind An index value to use for = ~ * substitution + * @param cstr An SRAM C-string to use for $ substitution + * @param fstr A ROM F-string to use for $ substitution + * @param maxlen The maximum size of the string (in pixels on GLCD) + * @return the output width (in pixels on GLCD) + */ +lcd_uint_t lcd_put_u8str_P(PGM_P const ptpl, const int8_t ind, const char *cstr=nullptr, FSTR_P const fstr=nullptr, const lcd_uint_t maxlen=LCD_WIDTH); +inline lcd_uint_t lcd_put_u8str_P(const lcd_uint_t col, const lcd_uint_t row, PGM_P const ptpl, const int8_t ind, const char *cstr=nullptr, FSTR_P const fstr=nullptr, const lcd_uint_t maxlen=LCD_WIDTH) { lcd_moveto(col, row); - return lcd_put_u8str_ind_P(pstr, ind, inStr, maxlen); + return lcd_put_u8str_P(ptpl, ind, cstr, fstr, maxlen); } -inline lcd_uint_t lcd_put_u8str_ind(FSTR_P const fstr, const int8_t ind, FSTR_P const inFstr=nullptr, const lcd_uint_t maxlen=LCD_WIDTH) { - return lcd_put_u8str_ind_P(FTOP(fstr), ind, FTOP(inFstr), maxlen); +/** + * @brief Draw a ROM UTF-8 F-string with optional substitution + * @details (See above) + * + * @param ftpl A ROM F-string (template) + * @param ind An index value to use for = ~ * substitution + * @param cstr An SRAM C-string to use for $ substitution + * @param fstr A ROM F-string to use for $ substitution + * @param maxlen The maximum size of the string (in pixels on GLCD) + * @return the output width (in pixels on GLCD) + */ +inline lcd_uint_t lcd_put_u8str(FSTR_P const ftpl, const int8_t ind, const char *cstr=nullptr, FSTR_P const fstr=nullptr, const lcd_uint_t maxlen=LCD_WIDTH) { + return lcd_put_u8str_P(FTOP(ftpl), ind, cstr, fstr, maxlen); } -inline lcd_uint_t lcd_put_u8str_ind(const lcd_uint_t col, const lcd_uint_t row, FSTR_P const fstr, const int8_t ind, FSTR_P const inFstr=nullptr, const lcd_uint_t maxlen=LCD_WIDTH) { - return lcd_put_u8str_ind_P(col, row, FTOP(fstr), ind, FTOP(inFstr), maxlen); +/** + * @param col + * @param row + */ +inline lcd_uint_t lcd_put_u8str(const lcd_uint_t col, const lcd_uint_t row, FSTR_P const ftpl, const int8_t ind, const char *cstr=nullptr, FSTR_P const fstr=nullptr, const lcd_uint_t maxlen=LCD_WIDTH) { + return lcd_put_u8str_P(col, row, FTOP(ftpl), ind, cstr, fstr, maxlen); } +/** + * @brief Draw a SRAM string with no width limit + * + * @param str The UTF-8 string + * @return the output width (in pixels on GLCD) + */ inline int lcd_put_u8str(const char * const str) { return lcd_put_u8str_max(str, PIXEL_LEN_NOLIMIT); } +/** + * @param col + * @param row + */ inline int lcd_put_u8str(const lcd_uint_t col, const lcd_uint_t row, const char * const str) { lcd_moveto(col, row); return lcd_put_u8str(str); } +/** + * @brief Draw a UTF-8 character with no width limit + * + * @param c The wchar to draw + * @return the output width (in pixels on GLCD) + */ inline int lcd_put_wchar(const wchar_t c) { return lcd_put_wchar_max(c, PIXEL_LEN_NOLIMIT); } +/** + * @param col + * @param row + */ inline int lcd_put_wchar(const lcd_uint_t col, const lcd_uint_t row, const wchar_t c) { lcd_moveto(col, row); return lcd_put_wchar(c); } +/** + * @brief Calculate the width of a ROM UTF-8 string (in pixels on GLCD) + * + * @param pstr The ROM-based UTF-8 string + * @return the string width (in pixels on GLCD) + */ int calculateWidth(PGM_P const pstr); +/** + * @brief Calculate the width of a ROM UTF-8 string (in pixels on GLCD) + * + * @param pstr The ROM-based UTF-8 string + * @return the string width (in pixels on GLCD) + */ +inline int calculateWidth(FSTR_P const fstr) { return calculateWidth(FTOP(fstr)); } diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 51620c9913bb..8958de657ca0 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -416,10 +416,11 @@ void MarlinUI::init() { SETCURSOR(0, row); // Simulate carriage return }; - uint8_t *p = (uint8_t*)string; + const uint8_t *p = (uint8_t*)string; wchar_t ch; if (wordwrap) { - uint8_t *wrd = nullptr, c = 0; + const uint8_t *wrd = nullptr; + uint8_t c = 0; // find the end of the part for (;;) { if (!wrd) wrd = p; // Get word start /before/ advancing diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp index 13ef0d2bc1c1..a1e2beaf72d0 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -68,9 +68,10 @@ typedef struct { menuPosition screen_history[6]; uint8_t screen_history_depth = 0; -int8_t MenuItemBase::itemIndex; // Index number for draw and action -FSTR_P MenuItemBase::itemString; // A string for substitution -chimera_t editable; // Value Editing +int8_t MenuItemBase::itemIndex; // Index number for draw and action +FSTR_P MenuItemBase::itemStringF; // A string for substitution +const char *MenuItemBase::itemStringC; +chimera_t editable; // Value Editing // Menu Edit Items FSTR_P MenuEditItemBase::editLabel; diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index 67e337213ab8..3e88f68690a6 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -53,15 +53,17 @@ class MenuItemBase { // Index to interject in the item label and/or for use by its action. static int8_t itemIndex; - // An optional pointer for use in display or by the action - static FSTR_P itemString; + // Optional pointers for use in display or by the action + static FSTR_P itemStringF; + static const char* itemStringC; - // Store the index of the item ahead of use by indexed items - FORCE_INLINE static void init(const int8_t ind=0, FSTR_P const fstr=nullptr) { itemIndex = ind; itemString = fstr; } + // Store an index and string for later substitution + FORCE_INLINE static void init(const int8_t ind=0, FSTR_P const fstr=nullptr) { itemIndex = ind; itemStringF = fstr; itemStringC = nullptr; } + FORCE_INLINE static void init(const int8_t ind, const char * const cstr) { itemIndex = ind; itemStringC = cstr; itemStringF = nullptr; } // Implementation-specific: // Draw an item either selected (pre_char) or not (space) with post_char - // Menus may set up itemIndex, itemString and pass them to string-building or string-emitting functions + // Menus may set up itemIndex, itemStringC/F and pass them to string-building or string-emitting functions static void _draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char pre_char, const char post_char); // Draw an item either selected ('>') or not (space) with post_char @@ -90,8 +92,8 @@ class MenuItem_back : public MenuItemBase { // YESNO_ITEM(LABEL,FY,FN,...) class MenuItem_confirm : public MenuItemBase { public: - FORCE_INLINE static void draw(const bool sel, const uint8_t row, FSTR_P const fstr, ...) { - _draw(sel, row, fstr, '>', LCD_STR_ARROW_RIGHT[0]); + FORCE_INLINE static void draw(const bool sel, const uint8_t row, FSTR_P const ftpl, ...) { + _draw(sel, row, ftpl, '>', LCD_STR_ARROW_RIGHT[0]); } // Implemented for HD44780 and DOGM // Draw the prompt, buttons, and state @@ -170,10 +172,10 @@ class MenuEditItemBase : public MenuItemBase { public: // Implementation-specific: // Draw the current item at specified row with edit data - static void draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char * const inStr, const bool pgm=false); + static void draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char * const inStr, const bool pgm=false); - static void draw(const bool sel, const uint8_t row, FSTR_P const fstr, FSTR_P const inStr) { - draw(sel, row, fstr, FTOP(inStr), true); + static void draw(const bool sel, const uint8_t row, FSTR_P const ftpl, FSTR_P const fstr) { + draw(sel, row, ftpl, FTOP(fstr), true); } // Implementation-specific: diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index d99627d5120d..a6ebb104076d 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -68,8 +68,10 @@ void menu_backlash(); LOOP_LOGICAL_AXES(i) driverPercent[i] = stepper_dac.get_current_percent((AxisEnum)i); START_MENU(); BACK_ITEM(MSG_ADVANCED_SETTINGS); - #define EDIT_DAC_PERCENT(A) EDIT_ITEM(uint8, MSG_DAC_PERCENT_##A, &driverPercent[_AXIS(A)], 0, 100, []{ stepper_dac.set_current_percents(driverPercent); }); - MAP(EDIT_DAC_PERCENT, LOGICAL_AXIS_LIST(E, A, B, C, I, J, K, U, V, W)); + + LOOP_LOGICAL_AXES(a) + EDIT_ITEM_N(uint8, a, MSG_DAC_PERCENT_N, &driverPercent[a], 0, 100, []{ stepper_dac.set_current_percents(driverPercent); }); + ACTION_ITEM(MSG_DAC_EEPROM_WRITE, stepper_dac.commit_eeprom); END_MENU(); } @@ -427,11 +429,11 @@ void menu_backlash(); START_MENU(); BACK_ITEM(MSG_ADVANCED_SETTINGS); - #define EDIT_VMAX(N) EDIT_ITEM_FAST(float5, MSG_VMAX_##N, &planner.settings.max_feedrate_mm_s[_AXIS(N)], 1, max_fr_edit_scaled[_AXIS(N)]); - MAP(EDIT_VMAX, NUM_AXIS_LIST(A, B, C, I, J, K, U, V, W)); + LOOP_NUM_AXES(a) + EDIT_ITEM_FAST_N(float5, a, MSG_VMAX_N, &planner.settings.max_feedrate_mm_s[a], 1, max_fr_edit_scaled[a]); #if E_STEPPERS - EDIT_ITEM_FAST(float5, MSG_VMAX_E, &planner.settings.max_feedrate_mm_s[E_AXIS_N(active_extruder)], 1, max_fr_edit_scaled.e); + EDIT_ITEM_FAST_N(float5, E_AXIS, MSG_VMAX_N, &planner.settings.max_feedrate_mm_s[E_AXIS_N(active_extruder)], 1, max_fr_edit_scaled.e); #endif #if ENABLED(DISTINCT_E_FACTORS) LOOP_L_N(n, E_STEPPERS) @@ -515,11 +517,9 @@ void menu_backlash(); BACK_ITEM(MSG_ADVANCED_SETTINGS); #if HAS_JUNCTION_DEVIATION - #if ENABLED(LIN_ADVANCE) - EDIT_ITEM(float43, MSG_JUNCTION_DEVIATION, &planner.junction_deviation_mm, 0.001f, 0.3f, planner.recalculate_max_e_jerk); - #else - EDIT_ITEM(float43, MSG_JUNCTION_DEVIATION, &planner.junction_deviation_mm, 0.001f, 0.5f); - #endif + EDIT_ITEM(float43, MSG_JUNCTION_DEVIATION, &planner.junction_deviation_mm, 0.001f, TERN(LIN_ADVANCE, 0.3f, 0.5f) + OPTARG(LIN_ADVANCE, planner.recalculate_max_e_jerk) + ); #endif constexpr xyze_float_t max_jerk_edit = @@ -532,21 +532,13 @@ void menu_backlash(); LOGICAL_AXIS_ARRAY_1(990) #endif ; - #define EDIT_JERK(N) EDIT_ITEM_FAST(float3, MSG_V##N##_JERK, &planner.max_jerk[_AXIS(N)], 1, max_jerk_edit[_AXIS(N)]) - #if ENABLED(DELTA) - #define EDIT_JERK_C() EDIT_JERK(C) - #else - #define EDIT_JERK_C() EDIT_ITEM_FAST(float52sign, MSG_VC_JERK, &planner.max_jerk.c, 0.1f, max_jerk_edit.c) - #endif - NUM_AXIS_CODE( - EDIT_JERK(A), EDIT_JERK(B), EDIT_JERK_C(), - EDIT_JERK(I), EDIT_JERK(J), EDIT_JERK(K), - EDIT_JERK(U), EDIT_JERK(V), EDIT_JERK(W) - ); - #if HAS_EXTRUDERS - EDIT_ITEM_FAST(float52sign, MSG_VE_JERK, &planner.max_jerk.e, 0.1f, max_jerk_edit.e); - #endif + LOOP_LOGICAL_AXES(a) { + if (a == C_AXIS || TERN0(HAS_EXTRUDERS, a == E_AXIS)) + EDIT_ITEM_FAST_N(float52sign, a, MSG_VN_JERK, &planner.max_jerk[a], 0.1f, max_jerk_edit[a]); + else + EDIT_ITEM_FAST_N(float3, a, MSG_VN_JERK, &planner.max_jerk[a], 1.0f, max_jerk_edit[a]); + } END_MENU(); } @@ -583,8 +575,8 @@ void menu_advanced_steps_per_mm() { START_MENU(); BACK_ITEM(MSG_ADVANCED_SETTINGS); - #define EDIT_QSTEPS(Q) EDIT_ITEM_FAST(float61, MSG_##Q##_STEPS, &planner.settings.axis_steps_per_mm[_AXIS(Q)], 5, 9999, []{ planner.refresh_positioning(); }); - MAP(EDIT_QSTEPS, NUM_AXIS_LIST(A, B, C, I, J, K, U, V, W)); + LOOP_NUM_AXES(a) + EDIT_ITEM_FAST_N(float61, a, MSG_N_STEPS, &planner.settings.axis_steps_per_mm[a], 5, 9999, []{ planner.refresh_positioning(); }); #if ENABLED(DISTINCT_E_FACTORS) LOOP_L_N(n, E_STEPPERS) @@ -596,7 +588,7 @@ void menu_advanced_steps_per_mm() { planner.mm_per_step[E_AXIS_N(e)] = 1.0f / planner.settings.axis_steps_per_mm[E_AXIS_N(e)]; }); #elif E_STEPPERS - EDIT_ITEM_FAST(float61, MSG_E_STEPS, &planner.settings.axis_steps_per_mm[E_AXIS], 5, 9999, []{ planner.refresh_positioning(); }); + EDIT_ITEM_FAST_N(float61, E_AXIS, MSG_N_STEPS, &planner.settings.axis_steps_per_mm[E_AXIS], 5, 9999, []{ planner.refresh_positioning(); }); #endif END_MENU(); @@ -622,7 +614,7 @@ void menu_advanced_settings() { #endif // M203 / M205 - Feedrate items - SUBMENU(MSG_VELOCITY, menu_advanced_velocity); + SUBMENU(MSG_MAX_SPEED, menu_advanced_velocity); // M201 - Acceleration items SUBMENU(MSG_ACCELERATION, menu_advanced_acceleration); diff --git a/Marlin/src/lcd/menu/menu_backlash.cpp b/Marlin/src/lcd/menu/menu_backlash.cpp index 07f3c9d7046b..e71606fc12a9 100644 --- a/Marlin/src/lcd/menu/menu_backlash.cpp +++ b/Marlin/src/lcd/menu/menu_backlash.cpp @@ -47,7 +47,7 @@ void menu_backlash() { #define EDIT_BACKLASH_DISTANCE(N) do { \ editable.decimal = backlash.get_distance_mm(_AXIS(N)); \ - EDIT_ITEM_FAST(float43, MSG_BACKLASH_##N, &editable.decimal, 0.0f, 9.9f, []{ backlash.set_distance_mm(_AXIS(N), editable.decimal); }); \ + EDIT_ITEM_FAST_N(float43, _AXIS(N), MSG_BACKLASH_N, &editable.decimal, 0.0f, 9.9f, []{ backlash.set_distance_mm(_AXIS(N), editable.decimal); }); \ } while (0); if (_CAN_CALI(A)) EDIT_BACKLASH_DISTANCE(A); diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp index cb36f4bc98a2..8b6af33fd11e 100644 --- a/Marlin/src/lcd/menu/menu_configuration.cpp +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -572,7 +572,7 @@ void menu_configuration() { // Preheat configurations #if HAS_PREHEAT && DISABLED(SLIM_LCD_MENUS) LOOP_L_N(m, PREHEAT_COUNT) - SUBMENU_N_S(m, ui.get_preheat_label(m), MSG_PREHEAT_M_SETTINGS, _menu_configuration_preheat_settings); + SUBMENU_N_f(m, ui.get_preheat_label(m), MSG_PREHEAT_M_SETTINGS, _menu_configuration_preheat_settings); #endif #if ENABLED(SOUND_MENU_ITEM) diff --git a/Marlin/src/lcd/menu/menu_filament.cpp b/Marlin/src/lcd/menu/menu_filament.cpp index 5e4e11669695..5902a2f63f35 100644 --- a/Marlin/src/lcd/menu/menu_filament.cpp +++ b/Marlin/src/lcd/menu/menu_filament.cpp @@ -95,7 +95,7 @@ void _menu_temp_filament_op(const PauseMode mode, const int8_t extruder) { BACK_ITEM(MSG_BACK); #if HAS_PREHEAT LOOP_L_N(m, PREHEAT_COUNT) - ACTION_ITEM_N_S(m, ui.get_preheat_label(m), MSG_PREHEAT_M, _change_filament_with_preset); + ACTION_ITEM_N_f(m, ui.get_preheat_label(m), MSG_PREHEAT_M, _change_filament_with_preset); #endif EDIT_ITEM_FAST_N(int3, extruder, MSG_PREHEAT_CUSTOM, &thermalManager.temp_hotend[extruder].target, EXTRUDE_MINTEMP, thermalManager.hotend_max_target(extruder), @@ -132,18 +132,18 @@ void menu_change_filament() { // Change filament #if E_STEPPERS == 1 - FSTR_P const msg = GET_TEXT_F(MSG_FILAMENTCHANGE); + FSTR_P const fmsg = GET_TEXT_F(MSG_FILAMENTCHANGE); if (thermalManager.targetTooColdToExtrude(active_extruder)) - SUBMENU_F(msg, []{ _menu_temp_filament_op(PAUSE_MODE_CHANGE_FILAMENT, 0); }); + SUBMENU_F(fmsg, []{ _menu_temp_filament_op(PAUSE_MODE_CHANGE_FILAMENT, 0); }); else - GCODES_ITEM_F(msg, F("M600 B0")); + GCODES_ITEM_F(fmsg, F("M600 B0")); #else - FSTR_P const msg = GET_TEXT_F(MSG_FILAMENTCHANGE_E); + FSTR_P const fmsg = GET_TEXT_F(MSG_FILAMENTCHANGE_E); LOOP_L_N(s, E_STEPPERS) { if (thermalManager.targetTooColdToExtrude(s)) - SUBMENU_N_F(s, msg, []{ _menu_temp_filament_op(PAUSE_MODE_CHANGE_FILAMENT, MenuItemBase::itemIndex); }); + SUBMENU_N_F(s, fmsg, []{ _menu_temp_filament_op(PAUSE_MODE_CHANGE_FILAMENT, MenuItemBase::itemIndex); }); else { - ACTION_ITEM_N_F(s, msg, []{ + ACTION_ITEM_N_F(s, fmsg, []{ PGM_P const cmdpstr = PSTR("M600 B0 T%i"); char cmd[strlen_P(cmdpstr) + 3 + 1]; sprintf_P(cmd, cmdpstr, int(MenuItemBase::itemIndex)); @@ -271,10 +271,10 @@ void menu_pause_option() { // // ADVANCED_PAUSE_FEATURE message screens // -// Warning: msg must have three null bytes to delimit lines! +// Warning: fmsg must have three null bytes to delimit lines! // -void _lcd_pause_message(FSTR_P const msg) { - PGM_P const msg1 = FTOP(msg); +void _lcd_pause_message(FSTR_P const fmsg) { + PGM_P const msg1 = FTOP(fmsg); PGM_P const msg2 = msg1 + strlen_P(msg1) + 1; PGM_P const msg3 = msg2 + strlen_P(msg2) + 1; const bool has2 = msg2[0], has3 = msg3[0], diff --git a/Marlin/src/lcd/menu/menu_item.h b/Marlin/src/lcd/menu/menu_item.h index 85ae1c4b4176..b48eaf9bae06 100644 --- a/Marlin/src/lcd/menu/menu_item.h +++ b/Marlin/src/lcd/menu/menu_item.h @@ -268,7 +268,7 @@ class MenuItem_bool : public MenuEditItemBase { #define _MENU_ITEM_MULTIPLIER_CHECK(USE_MULTIPLIER) #endif -#define _MENU_INNER_P(TYPE, USE_MULTIPLIER, FLABEL, V...) do { \ +#define _MENU_INNER_F(TYPE, USE_MULTIPLIER, FLABEL, V...) do { \ FSTR_P const flabel = FLABEL; \ if (encoderLine == _thisItemNr && ui.use_click()) { \ _MENU_ITEM_MULTIPLIER_CHECK(USE_MULTIPLIER); \ @@ -280,30 +280,41 @@ class MenuItem_bool : public MenuEditItemBase { (encoderLine == _thisItemNr, _lcdLineNr, flabel, ##V); \ }while(0) +// Item with optional data #define _MENU_ITEM_F(TYPE, V...) do { \ if (_menuLineNr == _thisItemNr) { \ _skipStatic = false; \ - _MENU_INNER_P(TYPE, ##V); \ + _MENU_INNER_F(TYPE, ##V); \ } \ NEXT_ITEM(); \ }while(0) -// Indexed items set a global index value and optional data +// Item with index value, C-string, and optional data #define _MENU_ITEM_N_S_F(TYPE, N, S, V...) do{ \ if (_menuLineNr == _thisItemNr) { \ _skipStatic = false; \ MenuItemBase::init(N, S); \ - _MENU_INNER_P(TYPE, ##V); \ + _MENU_INNER_F(TYPE, ##V); \ } \ NEXT_ITEM(); \ }while(0) -// Indexed items set a global index value +// Item with index value and F-string +#define _MENU_ITEM_N_f_F(TYPE, N, f, V...) do{ \ + if (_menuLineNr == _thisItemNr) { \ + _skipStatic = false; \ + MenuItemBase::init(N, f); \ + _MENU_INNER_F(TYPE, ##V); \ + } \ + NEXT_ITEM(); \ +}while(0) + +// Item with index value #define _MENU_ITEM_N_F(TYPE, N, V...) do{ \ if (_menuLineNr == _thisItemNr) { \ _skipStatic = false; \ - MenuItemBase::itemIndex = N; \ - _MENU_INNER_P(TYPE, ##V); \ + MenuItemBase::init(N); \ + _MENU_INNER_F(TYPE, ##V); \ } \ NEXT_ITEM(); \ }while(0) @@ -312,8 +323,18 @@ class MenuItem_bool : public MenuEditItemBase { #define _MENU_ITEM_S_F(TYPE, S, V...) do{ \ if (_menuLineNr == _thisItemNr) { \ _skipStatic = false; \ - MenuItemBase::itemString = S; \ - _MENU_INNER_P(TYPE, ##V); \ + MenuItemBase::init(0, S); \ + _MENU_INNER_F(TYPE, ##V); \ + } \ + NEXT_ITEM(); \ +}while(0) + +// Items with a unique F-string +#define _MENU_ITEM_f_F(TYPE, f, V...) do{ \ + if (_menuLineNr == _thisItemNr) { \ + _skipStatic = false; \ + MenuItemBase::init(0, f); \ + _MENU_INNER_F(TYPE, ##V); \ } \ NEXT_ITEM(); \ }while(0) @@ -361,15 +382,24 @@ class MenuItem_bool : public MenuEditItemBase { #define STATIC_ITEM(LABEL, V...) STATIC_ITEM_F(GET_TEXT_F(LABEL), ##V) #define STATIC_ITEM_N(LABEL, N, V...) STATIC_ITEM_N_F(GET_TEXT_F(LABEL), N, ##V) +// Menu item with index and composed C-string substitution #define MENU_ITEM_N_S_F(TYPE, N, S, FLABEL, V...) _MENU_ITEM_N_S_F(TYPE, N, S, false, FLABEL, ##V) #define MENU_ITEM_N_S(TYPE, N, S, LABEL, V...) MENU_ITEM_N_S_F(TYPE, N, S, GET_TEXT_F(LABEL), ##V) + +// Menu item with composed C-string substitution #define MENU_ITEM_S_F(TYPE, S, FLABEL, V...) _MENU_ITEM_S_F(TYPE, S, false, FLABEL, ##V) #define MENU_ITEM_S(TYPE, S, LABEL, V...) MENU_ITEM_S_F(TYPE, S, GET_TEXT_F(LABEL), ##V) + +// Menu item substitution, indexed #define MENU_ITEM_N_F(TYPE, N, FLABEL, V...) _MENU_ITEM_N_F(TYPE, N, false, FLABEL, ##V) #define MENU_ITEM_N(TYPE, N, LABEL, V...) MENU_ITEM_N_F(TYPE, N, GET_TEXT_F(LABEL), ##V) + +// Basic menu items, no substitution #define MENU_ITEM_F(TYPE, FLABEL, V...) _MENU_ITEM_F(TYPE, false, FLABEL, ##V) #define MENU_ITEM(TYPE, LABEL, V...) MENU_ITEM_F(TYPE, GET_TEXT_F(LABEL), ##V) +// Predefined menu item types // + #define BACK_ITEM_F(FLABEL) MENU_ITEM_F(back, FLABEL) #define BACK_ITEM(LABEL) MENU_ITEM(back, LABEL) @@ -418,6 +448,38 @@ class MenuItem_bool : public MenuEditItemBase { #define EDIT_ITEM_FAST_F(TYPE, FLABEL, V...) _MENU_ITEM_F(TYPE, true, FLABEL, ##V) #define EDIT_ITEM_FAST(TYPE, LABEL, V...) EDIT_ITEM_FAST_F(TYPE, GET_TEXT_F(LABEL), ##V) +// F-string substitution instead of C-string // + +#define MENU_ITEM_N_f_F(TYPE, N, f, FLABEL, V...) _MENU_ITEM_N_f_F(TYPE, N, f, false, FLABEL, ##V) +#define MENU_ITEM_N_f(TYPE, N, f, LABEL, V...) MENU_ITEM_N_f_F(TYPE, N, f, GET_TEXT_F(LABEL), ##V) +#define MENU_ITEM_f_F(TYPE, f, FLABEL, V...) _MENU_ITEM_f_F(TYPE, f, false, FLABEL, ##V) +#define MENU_ITEM_f(TYPE, f, LABEL, V...) MENU_ITEM_f_F(TYPE, f, GET_TEXT_F(LABEL), ##V) + +#define ACTION_ITEM_N_f_F(N, f, FLABEL, ACTION) MENU_ITEM_N_f_F(function, N, f, FLABEL, ACTION) +#define ACTION_ITEM_N_f(N, f, LABEL, ACTION) ACTION_ITEM_N_f_F(N, f, GET_TEXT_F(LABEL), ACTION) +#define ACTION_ITEM_f_F(f, FLABEL, ACTION) MENU_ITEM_f_F(function, f, FLABEL, ACTION) +#define ACTION_ITEM_f(f, LABEL, ACTION) ACTION_ITEM_f_F(f, GET_TEXT_F(LABEL), ACTION) + +#define GCODES_ITEM_N_f_F(N, f, FLABEL, GCODES) MENU_ITEM_N_f_F(gcode, N, f, FLABEL, GCODES) +#define GCODES_ITEM_N_f(N, f, LABEL, GCODES) GCODES_ITEM_N_f_F(N, f, GET_TEXT_F(LABEL), GCODES) +#define GCODES_ITEM_f_F(f, FLABEL, GCODES) MENU_ITEM_f_F(gcode, f, FLABEL, GCODES) +#define GCODES_ITEM_f(f, LABEL, GCODES) GCODES_ITEM_f_F(f, GET_TEXT_F(LABEL), GCODES) + +#define SUBMENU_N_f_F(N, f, FLABEL, DEST) MENU_ITEM_N_f_F(submenu, N, f, FLABEL, DEST) +#define SUBMENU_N_f(N, f, LABEL, DEST) SUBMENU_N_f_F(N, f, GET_TEXT_F(LABEL), DEST) +#define SUBMENU_f_F(f, FLABEL, DEST) MENU_ITEM_f_F(submenu, f, FLABEL, DEST) +#define SUBMENU_f(f, LABEL, DEST) SUBMENU_f_F(f, GET_TEXT_F(LABEL), DEST) + +#define EDIT_ITEM_N_f_F(TYPE, N, f, FLABEL, V...) MENU_ITEM_N_f_F(TYPE, N, f, FLABEL, ##V) +#define EDIT_ITEM_N_f(TYPE, N, f, LABEL, V...) EDIT_ITEM_N_f_F(TYPE, N, f, GET_TEXT_F(LABEL), ##V) +#define EDIT_ITEM_f_F(TYPE, f, FLABEL, V...) MENU_ITEM_f_F(TYPE, f, FLABEL, ##V) +#define EDIT_ITEM_f(TYPE, f, LABEL, V...) EDIT_ITEM_f_F(TYPE, f, GET_TEXT_F(LABEL), ##V) + +#define EDIT_ITEM_FAST_N_f_F(TYPE, N, f, FLABEL, V...) _MENU_ITEM_N_f_F(TYPE, N, f, true, FLABEL, ##V) +#define EDIT_ITEM_FAST_N_f(TYPE, N, f, LABEL, V...) EDIT_ITEM_FAST_N_f_F(TYPE, N, f, true, GET_TEXT_F(LABEL), ##V) +#define EDIT_ITEM_FAST_f_F(TYPE, f, FLABEL, V...) _MENU_ITEM_f_F(TYPE, f, true, FLABEL, ##V) +#define EDIT_ITEM_FAST_f(TYPE, f, LABEL, V...) EDIT_ITEM_FAST_f_F(TYPE, f, GET_TEXT_F(LABEL), ##V) + #define _CONFIRM_ITEM_INNER_F(FLABEL, V...) do { \ if (encoderLine == _thisItemNr && ui.use_click()) { \ ui.push_current_screen(); \ diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index 25f201837749..90bd015efff4 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -54,6 +54,8 @@ // "Motion" > "Move Axis" submenu // +// TODO: Use substitution here with MSG_MOVE_N + static void _lcd_move_xyz(FSTR_P const name, const AxisEnum axis) { if (ui.use_click()) return ui.goto_previous_screen_no_defer(); if (ui.encoderPosition && !ui.manual_move.processing) { @@ -192,22 +194,8 @@ void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int SUBMENU(MSG_MOVE_10MM, []{ _goto_manual_move(10); }); SUBMENU(MSG_MOVE_1MM, []{ _goto_manual_move( 1); }); SUBMENU(MSG_MOVE_01MM, []{ _goto_manual_move( 0.1f); }); - if (axis == Z_AXIS && (FINE_MANUAL_MOVE) > 0.0f && (FINE_MANUAL_MOVE) < 0.1f) { - // Determine digits needed right of decimal - constexpr uint8_t digs = !UNEAR_ZERO((FINE_MANUAL_MOVE) * 1000 - int((FINE_MANUAL_MOVE) * 1000)) ? 4 : - !UNEAR_ZERO((FINE_MANUAL_MOVE) * 100 - int((FINE_MANUAL_MOVE) * 100)) ? 3 : 2; - PGM_P const label = GET_TEXT(MSG_MOVE_N_MM); - char tmp[strlen_P(label) + 10 + 1], numstr[10]; - sprintf_P(tmp, label, dtostrf(FINE_MANUAL_MOVE, 1, digs, numstr)); - #if DISABLED(HAS_GRAPHICAL_TFT) - SUBMENU_F(FPSTR(NUL_STR), []{ _goto_manual_move(float(FINE_MANUAL_MOVE)); }); - MENU_ITEM_ADDON_START(0 + ENABLED(HAS_MARLINUI_HD44780)); - lcd_put_u8str(tmp); - MENU_ITEM_ADDON_END(); - #else - SUBMENU_F(FPSTR(tmp), []{ _goto_manual_move(float(FINE_MANUAL_MOVE)); }); - #endif - } + if (axis == Z_AXIS && (FINE_MANUAL_MOVE) > 0.0f && (FINE_MANUAL_MOVE) < 0.1f) + SUBMENU_f(F(STRINGIFY(FINE_MANUAL_MOVE)), MSG_MOVE_N_MM, []{ _goto_manual_move(float(FINE_MANUAL_MOVE)); }); } END_MENU(); } diff --git a/Marlin/src/lcd/menu/menu_probe_offset.cpp b/Marlin/src/lcd/menu/menu_probe_offset.cpp index 6271b314f404..c7cbebaade82 100644 --- a/Marlin/src/lcd/menu/menu_probe_offset.cpp +++ b/Marlin/src/lcd/menu/menu_probe_offset.cpp @@ -68,21 +68,8 @@ void probe_offset_wizard_menu() { SUBMENU(MSG_MOVE_1MM, []{ _goto_manual_move_z( 1); }); SUBMENU(MSG_MOVE_01MM, []{ _goto_manual_move_z( 0.1f); }); - if ((FINE_MANUAL_MOVE) > 0.0f && (FINE_MANUAL_MOVE) < 0.1f) { - char tmp[20], numstr[10]; - // Determine digits needed right of decimal - const uint8_t digs = !UNEAR_ZERO((FINE_MANUAL_MOVE) * 1000 - int((FINE_MANUAL_MOVE) * 1000)) ? 4 : - !UNEAR_ZERO((FINE_MANUAL_MOVE) * 100 - int((FINE_MANUAL_MOVE) * 100)) ? 3 : 2; - sprintf_P(tmp, GET_TEXT(MSG_MOVE_N_MM), dtostrf(FINE_MANUAL_MOVE, 1, digs, numstr)); - #if DISABLED(HAS_GRAPHICAL_TFT) - SUBMENU_F(FPSTR(NUL_STR), []{ _goto_manual_move_z(float(FINE_MANUAL_MOVE)); }); - MENU_ITEM_ADDON_START(0 + ENABLED(HAS_MARLINUI_HD44780)); - lcd_put_u8str(tmp); - MENU_ITEM_ADDON_END(); - #else - SUBMENU_F(tmp, []{ _goto_manual_move_z(float(FINE_MANUAL_MOVE)); }); - #endif - } + if ((FINE_MANUAL_MOVE) > 0.0f && (FINE_MANUAL_MOVE) < 0.1f) + SUBMENU_f(F(STRINGIFY(FINE_MANUAL_MOVE)), MSG_MOVE_N_MM, []{ _goto_manual_move_z(float(FINE_MANUAL_MOVE)); }); ACTION_ITEM(MSG_BUTTON_DONE, []{ set_offset_and_go_back(calculated_z_offset); diff --git a/Marlin/src/lcd/menu/menu_temperature.cpp b/Marlin/src/lcd/menu/menu_temperature.cpp index fb539f006c14..e493972a9712 100644 --- a/Marlin/src/lcd/menu/menu_temperature.cpp +++ b/Marlin/src/lcd/menu/menu_temperature.cpp @@ -88,14 +88,14 @@ void Temperature::lcd_preheat(const uint8_t e, const int8_t indh, const int8_t i // Indexed "Preheat ABC" and "Heat Bed" items #define PREHEAT_ITEMS(M,E) do{ \ - ACTION_ITEM_N_S(E, ui.get_preheat_label(M), MSG_PREHEAT_M_H, []{ _preheat_both(M, MenuItemBase::itemIndex); }); \ - ACTION_ITEM_N_S(E, ui.get_preheat_label(M), MSG_PREHEAT_M_END_E, []{ _preheat_end(M, MenuItemBase::itemIndex); }); \ + ACTION_ITEM_N_f(E, ui.get_preheat_label(M), MSG_PREHEAT_M_H, []{ _preheat_both(M, MenuItemBase::itemIndex); }); \ + ACTION_ITEM_N_f(E, ui.get_preheat_label(M), MSG_PREHEAT_M_END_E, []{ _preheat_end(M, MenuItemBase::itemIndex); }); \ }while(0) #elif HAS_MULTI_HOTEND // No heated bed, so just indexed "Preheat ABC" items - #define PREHEAT_ITEMS(M,E) ACTION_ITEM_N_S(E, ui.get_preheat_label(M), MSG_PREHEAT_M_H, []{ _preheat_end(M, MenuItemBase::itemIndex); }) + #define PREHEAT_ITEMS(M,E) ACTION_ITEM_N_f(E, ui.get_preheat_label(M), MSG_PREHEAT_M_H, []{ _preheat_end(M, MenuItemBase::itemIndex); }) #endif @@ -112,16 +112,16 @@ void Temperature::lcd_preheat(const uint8_t e, const int8_t indh, const int8_t i #if HOTENDS == 1 #if HAS_HEATED_BED - ACTION_ITEM_S(ui.get_preheat_label(m), MSG_PREHEAT_M, []{ _preheat_both(editable.int8, 0); }); - ACTION_ITEM_S(ui.get_preheat_label(m), MSG_PREHEAT_M_END, do_preheat_end_m); + ACTION_ITEM_f(ui.get_preheat_label(m), MSG_PREHEAT_M, []{ _preheat_both(editable.int8, 0); }); + ACTION_ITEM_f(ui.get_preheat_label(m), MSG_PREHEAT_M_END, do_preheat_end_m); #else - ACTION_ITEM_S(ui.get_preheat_label(m), MSG_PREHEAT_M, do_preheat_end_m); + ACTION_ITEM_f(ui.get_preheat_label(m), MSG_PREHEAT_M, do_preheat_end_m); #endif #elif HAS_MULTI_HOTEND HOTEND_LOOP() PREHEAT_ITEMS(editable.int8, e); - ACTION_ITEM_S(ui.get_preheat_label(m), MSG_PREHEAT_M_ALL, []() { + ACTION_ITEM_f(ui.get_preheat_label(m), MSG_PREHEAT_M_ALL, []() { const celsius_t t = ui.material_preset[editable.int8].hotend_temp; HOTEND_LOOP() thermalManager.setTargetHotend(t, e); TERN(HAS_HEATED_BED, _preheat_bed(editable.int8), ui.return_to_status()); @@ -130,7 +130,7 @@ void Temperature::lcd_preheat(const uint8_t e, const int8_t indh, const int8_t i #endif #if HAS_HEATED_BED - ACTION_ITEM_S(ui.get_preheat_label(m), MSG_PREHEAT_M_BEDONLY, []{ _preheat_bed(editable.int8); }); + ACTION_ITEM_f(ui.get_preheat_label(m), MSG_PREHEAT_M_BEDONLY, []{ _preheat_bed(editable.int8); }); #endif END_MENU(); @@ -269,9 +269,9 @@ void menu_temperature() { LOOP_L_N(m, PREHEAT_COUNT) { editable.int8 = m; #if HAS_MULTI_HOTEND || HAS_HEATED_BED - SUBMENU_S(ui.get_preheat_label(m), MSG_PREHEAT_M, menu_preheat_m); + SUBMENU_f(ui.get_preheat_label(m), MSG_PREHEAT_M, menu_preheat_m); #elif HAS_HOTEND - ACTION_ITEM_S(ui.get_preheat_label(m), MSG_PREHEAT_M, do_preheat_end_m); + ACTION_ITEM_f(ui.get_preheat_label(m), MSG_PREHEAT_M, do_preheat_end_m); #endif } #endif @@ -296,9 +296,9 @@ void menu_temperature() { LOOP_L_N(m, PREHEAT_COUNT) { editable.int8 = m; #if HAS_MULTI_HOTEND || HAS_HEATED_BED - SUBMENU_S(ui.get_preheat_label(m), MSG_PREHEAT_M, menu_preheat_m); + SUBMENU_f(ui.get_preheat_label(m), MSG_PREHEAT_M, menu_preheat_m); #else - ACTION_ITEM_S(ui.get_preheat_label(m), MSG_PREHEAT_M, do_preheat_end_m); + ACTION_ITEM_f(ui.get_preheat_label(m), MSG_PREHEAT_M, do_preheat_end_m); #endif } diff --git a/Marlin/src/lcd/menu/menu_tune.cpp b/Marlin/src/lcd/menu/menu_tune.cpp index 5d4c3a4bfb47..b13c55f80a3b 100644 --- a/Marlin/src/lcd/menu/menu_tune.cpp +++ b/Marlin/src/lcd/menu/menu_tune.cpp @@ -50,6 +50,8 @@ #include "../dogm/marlinui_DOGM.h" #endif + // TODO: Replace fmsg with MSG_BABYSTEP_N and index substitution + void _lcd_babystep(const AxisEnum axis, FSTR_P const fmsg) { if (ui.use_click()) return ui.goto_previous_screen_no_defer(); if (ui.encoderPosition) { @@ -223,13 +225,13 @@ void menu_tune() { // #if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEP_XY) - SUBMENU(MSG_BABYSTEP_X, []{ _lcd_babystep_go(_lcd_babystep_x); }); - SUBMENU(MSG_BABYSTEP_Y, []{ _lcd_babystep_go(_lcd_babystep_y); }); + SUBMENU_N(X_AXIS, MSG_BABYSTEP_N, []{ _lcd_babystep_go(_lcd_babystep_x); }); + SUBMENU_N(Y_AXIS, MSG_BABYSTEP_N, []{ _lcd_babystep_go(_lcd_babystep_y); }); #endif #if ENABLED(BABYSTEP_ZPROBE_OFFSET) SUBMENU(MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset); #else - SUBMENU(MSG_BABYSTEP_Z, lcd_babystep_z); + SUBMENU_N(Z_AXIS, MSG_BABYSTEP_N, lcd_babystep_z); #endif #endif diff --git a/Marlin/src/lcd/menu/menu_ubl.cpp b/Marlin/src/lcd/menu/menu_ubl.cpp index 297325348d23..62c1770bd4c3 100644 --- a/Marlin/src/lcd/menu/menu_ubl.cpp +++ b/Marlin/src/lcd/menu/menu_ubl.cpp @@ -211,10 +211,10 @@ void _lcd_ubl_edit_mesh() { #if HAS_PREHEAT #if HAS_HEATED_BED #define VALIDATE_MESH_GCODE_ITEM(M) \ - GCODES_ITEM_N_S(M, ui.get_preheat_label(M), MSG_UBL_VALIDATE_MESH_M, F("G28\nG26CPI" STRINGIFY(M))); + GCODES_ITEM_N_f(M, ui.get_preheat_label(M), MSG_UBL_VALIDATE_MESH_M, F("G28\nG26CPI" STRINGIFY(M))); #else #define VALIDATE_MESH_GCODE_ITEM(M) \ - GCODES_ITEM_N_S(M, ui.get_preheat_label(M), MSG_UBL_VALIDATE_MESH_M, F("G28\nG26CPB0I" STRINGIFY(M))); + GCODES_ITEM_N_f(M, ui.get_preheat_label(M), MSG_UBL_VALIDATE_MESH_M, F("G28\nG26CPB0I" STRINGIFY(M))); #endif REPEAT(PREHEAT_COUNT, VALIDATE_MESH_GCODE_ITEM) #endif @@ -317,7 +317,7 @@ void _lcd_ubl_build_mesh() { #else #define PREHEAT_BED_GCODE(M) "" #endif - #define BUILD_MESH_GCODE_ITEM(M) GCODES_ITEM_S(ui.get_preheat_label(M), MSG_UBL_BUILD_MESH_M, \ + #define BUILD_MESH_GCODE_ITEM(M) GCODES_ITEM_f(ui.get_preheat_label(M), MSG_UBL_BUILD_MESH_M, \ F( \ "G28\n" \ PREHEAT_BED_GCODE(M) \ diff --git a/Marlin/src/lcd/menu/menu_x_twist.cpp b/Marlin/src/lcd/menu/menu_x_twist.cpp index eba22cca620c..e46745e8b761 100644 --- a/Marlin/src/lcd/menu/menu_x_twist.cpp +++ b/Marlin/src/lcd/menu/menu_x_twist.cpp @@ -100,19 +100,10 @@ void xatc_wizard_menu() { SUBMENU(MSG_MOVE_01MM, []{ _goto_manual_move_z( 0.1f); }); if ((FINE_MANUAL_MOVE) > 0.0f && (FINE_MANUAL_MOVE) < 0.1f) { - char tmp[20], numstr[10]; // Determine digits needed right of decimal const uint8_t digs = !UNEAR_ZERO((FINE_MANUAL_MOVE) * 1000 - int((FINE_MANUAL_MOVE) * 1000)) ? 4 : !UNEAR_ZERO((FINE_MANUAL_MOVE) * 100 - int((FINE_MANUAL_MOVE) * 100)) ? 3 : 2; - sprintf_P(tmp, GET_TEXT(MSG_MOVE_N_MM), dtostrf(FINE_MANUAL_MOVE, 1, digs, numstr)); - #if DISABLED(HAS_GRAPHICAL_TFT) - SUBMENU_F(FPSTR(NUL_STR), []{ _goto_manual_move_z(float(FINE_MANUAL_MOVE)); }); - MENU_ITEM_ADDON_START(0 + ENABLED(HAS_MARLINUI_HD44780)); - lcd_put_u8str(tmp); - MENU_ITEM_ADDON_END(); - #else - SUBMENU_F(FPSTR(tmp), []{ _goto_manual_move_z(float(FINE_MANUAL_MOVE)); }); - #endif + SUBMENU_f(F(STRINGIFY(FINE_MANUAL_MOVE)), MSG_MOVE_N_MM, []{ _goto_manual_move_z(float(FINE_MANUAL_MOVE)); }); } ACTION_ITEM(MSG_BUTTON_DONE, xatc_wizard_set_offset_and_go_to_next_point); diff --git a/Marlin/src/lcd/tft/tft.h b/Marlin/src/lcd/tft/tft.h index 435e7c30bf51..67cec2ee1c7e 100644 --- a/Marlin/src/lcd/tft/tft.h +++ b/Marlin/src/lcd/tft/tft.h @@ -94,7 +94,7 @@ class TFT { static void canvas(uint16_t x, uint16_t y, uint16_t width, uint16_t height) { queue.canvas(x, y, width, height); } static void set_background(uint16_t color) { queue.set_background(color); } static void add_text(uint16_t x, uint16_t y, uint16_t color, TFT_String tft_string, uint16_t maxWidth = 0) { queue.add_text(x, y, color, tft_string.string(), maxWidth); } - static void add_text(uint16_t x, uint16_t y, uint16_t color, const char *string, uint16_t maxWidth = 0) { queue.add_text(x, y, color, (uint8_t *)string, maxWidth); } + static void add_text(uint16_t x, uint16_t y, uint16_t color, const char *string, uint16_t maxWidth = 0) { queue.add_text(x, y, color, string, maxWidth); } static void add_image(int16_t x, int16_t y, MarlinImage image, uint16_t *colors) { queue.add_image(x, y, image, colors); } static void add_image(int16_t x, int16_t y, MarlinImage image, uint16_t color_main = COLOR_WHITE, uint16_t color_background = COLOR_BACKGROUND, uint16_t color_shadow = COLOR_BLACK) { queue.add_image(x, y, image, color_main, color_background, color_shadow); } static void add_bar(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { queue.add_bar(x, y, width, height, color); } diff --git a/Marlin/src/lcd/tft/tft_queue.cpp b/Marlin/src/lcd/tft/tft_queue.cpp index 3f604005f9e5..25ab452cef31 100644 --- a/Marlin/src/lcd/tft/tft_queue.cpp +++ b/Marlin/src/lcd/tft/tft_queue.cpp @@ -215,13 +215,13 @@ void TFT_Queue::handle_queue_overflow(uint16_t sizeNeeded) { } } -void TFT_Queue::add_text(uint16_t x, uint16_t y, uint16_t color, uint8_t *string, uint16_t maxWidth) { +void TFT_Queue::add_text(uint16_t x, uint16_t y, uint16_t color, const uint8_t *string, uint16_t maxWidth) { handle_queue_overflow(sizeof(parametersCanvasText_t) + maxWidth); parametersCanvas_t *task_parameters = (parametersCanvas_t *)(((uint8_t *)last_task) + sizeof(queueTask_t)); parametersCanvasText_t *parameters = (parametersCanvasText_t *)end_of_queue; last_parameter = end_of_queue; - uint8_t *pointer = string; + const uint8_t *pointer = string; parameters->type = CANVAS_ADD_TEXT; parameters->x = x; diff --git a/Marlin/src/lcd/tft/tft_queue.h b/Marlin/src/lcd/tft/tft_queue.h index 51387254c55d..55d0a526b5e3 100644 --- a/Marlin/src/lcd/tft/tft_queue.h +++ b/Marlin/src/lcd/tft/tft_queue.h @@ -139,7 +139,10 @@ class TFT_Queue { static void fill(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color); static void canvas(uint16_t x, uint16_t y, uint16_t width, uint16_t height); static void set_background(uint16_t color); - static void add_text(uint16_t x, uint16_t y, uint16_t color, uint8_t *string, uint16_t maxWidth); + static void add_text(uint16_t x, uint16_t y, uint16_t color, const uint8_t *string, uint16_t maxWidth); + static void add_text(uint16_t x, uint16_t y, uint16_t color, const char *string, uint16_t maxWidth) { + add_text(x, y, color, (uint8_t *)string, maxWidth); + } static void add_image(int16_t x, int16_t y, MarlinImage image, uint16_t *colors); static void add_image(int16_t x, int16_t y, MarlinImage image, uint16_t color_main, uint16_t color_background, uint16_t color_shadow); diff --git a/Marlin/src/lcd/tft/tft_string.cpp b/Marlin/src/lcd/tft/tft_string.cpp index 395144d05a18..d8c419d1a078 100644 --- a/Marlin/src/lcd/tft/tft_string.cpp +++ b/Marlin/src/lcd/tft/tft_string.cpp @@ -35,7 +35,7 @@ glyph_t *TFT_String::glyphs[256]; font_t *TFT_String::font_header; -uint8_t TFT_String::data[]; +char TFT_String::data[]; uint16_t TFT_String::span; uint8_t TFT_String::length; @@ -84,24 +84,22 @@ void TFT_String::set() { length = 0; } -uint8_t read_byte(uint8_t *byte) { return *byte; } - /** * Add a string, applying substitutions for the following characters: * - * $ displays an inserted C-string given by the inStr parameter + * $ displays the string given by fstr or cstr * = displays '0'....'10' for indexes 0 - 10 * ~ displays '1'....'11' for indexes 0 - 10 * * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL) * @ displays an axis name such as XYZUVW, or E for an extruder */ -void TFT_String::add(uint8_t *string, int8_t index, uint8_t *inStr/*=nullptr*/) { +void TFT_String::add(const char *tpl, const int8_t index, const char *cstr/*=nullptr*/, FSTR_P const fstr/*=nullptr*/) { wchar_t wchar; - while (*string) { - string = get_utf8_value_cb(string, read_byte, &wchar); + while (*tpl) { + tpl = get_utf8_value_cb(tpl, read_byte_ram, &wchar); if (wchar > 255) wchar |= 0x0080; - uint8_t ch = uint8_t(wchar & 0x00FF); + const uint8_t ch = uint8_t(wchar & 0x00FF); if (ch == '=' || ch == '~' || ch == '*') { if (index >= 0) { @@ -111,10 +109,12 @@ void TFT_String::add(uint8_t *string, int8_t index, uint8_t *inStr/*=nullptr*/) add_character('0' + inum); } else - add(index == -2 ? GET_TEXT(MSG_CHAMBER) : GET_TEXT(MSG_BED)); + add(index == -2 ? GET_TEXT_F(MSG_CHAMBER) : GET_TEXT_F(MSG_BED)); } - else if (ch == '$' && inStr) - add(inStr); + else if (ch == '$' && fstr) + add(fstr); + else if (ch == '$' && cstr) + add(cstr); else if (ch == '@') add_character(AXIS_CHAR(index)); else @@ -123,19 +123,19 @@ void TFT_String::add(uint8_t *string, int8_t index, uint8_t *inStr/*=nullptr*/) eol(); } -void TFT_String::add(uint8_t *string, uint8_t max_len) { +void TFT_String::add(const char *cstr, uint8_t max_len/*=MAX_STRING_LENGTH*/) { wchar_t wchar; - while (*string && max_len) { - string = get_utf8_value_cb(string, read_byte, &wchar); + while (*cstr && max_len) { + cstr = get_utf8_value_cb(cstr, read_byte_ram, &wchar); if (wchar > 255) wchar |= 0x0080; - uint8_t ch = uint8_t(wchar & 0x00FF); + const uint8_t ch = uint8_t(wchar & 0x00FF); add_character(ch); max_len--; } eol(); } -void TFT_String::add_character(uint8_t character) { +void TFT_String::add_character(const char character) { if (length < MAX_STRING_LENGTH) { data[length] = character; length++; @@ -143,7 +143,7 @@ void TFT_String::add_character(uint8_t character) { } } -void TFT_String::rtrim(uint8_t character) { +void TFT_String::rtrim(const char character) { while (length) { if (data[length - 1] == 0x20 || data[length - 1] == character) { length--; @@ -155,7 +155,7 @@ void TFT_String::rtrim(uint8_t character) { } } -void TFT_String::ltrim(uint8_t character) { +void TFT_String::ltrim(const char character) { uint16_t i, j; for (i = 0; (i < length) && (data[i] == 0x20 || data[i] == character); i++) { span -= glyph(data[i])->DWidth; @@ -166,7 +166,7 @@ void TFT_String::ltrim(uint8_t character) { eol(); } -void TFT_String::trim(uint8_t character) { +void TFT_String::trim(const char character) { rtrim(character); ltrim(character); } diff --git a/Marlin/src/lcd/tft/tft_string.h b/Marlin/src/lcd/tft/tft_string.h index 7fd87bdf5277..5940a48ac98b 100644 --- a/Marlin/src/lcd/tft/tft_string.h +++ b/Marlin/src/lcd/tft/tft_string.h @@ -21,6 +21,8 @@ */ #pragma once +// TODO: Make AVR-compatible with separate ROM / RAM string methods + #include extern const uint8_t ISO10646_1_5x7[]; @@ -67,14 +69,15 @@ class TFT_String { static glyph_t *glyphs[256]; static font_t *font_header; - static uint8_t data[MAX_STRING_LENGTH + 1]; + static char data[MAX_STRING_LENGTH + 1]; static uint16_t span; // in pixels - static uint8_t length; // in characters - static void add_character(uint8_t character); - static void eol() { data[length] = 0x00; } + static void add_character(const char character); + static void eol() { data[length] = '\0'; } public: + static uint8_t length; // in characters + static void set_font(const uint8_t *font); static void add_glyphs(const uint8_t *font); @@ -83,31 +86,69 @@ class TFT_String { static glyph_t *glyph(uint8_t character) { return glyphs[character] ?: glyphs[0x3F]; } /* Use '?' for unknown glyphs */ static glyph_t *glyph(uint8_t *character) { return glyph(*character); } + /** + * @brief Set the string empty + */ static void set(); - static void add(uint8_t character) { add_character(character); eol(); } - static void add(uint8_t *string, uint8_t max_len=MAX_STRING_LENGTH); - static void add(uint8_t *string, int8_t index, uint8_t *inStr=nullptr); - static void set(uint8_t *string) { set(); add(string); }; - static void set(uint8_t *string, int8_t index, const char *inStr=nullptr) { set(); add(string, index, (uint8_t *)inStr); }; - static void set(const char *string) { set((uint8_t *)string); } - static void set(const char *string, int8_t index, const char *inStr=nullptr) { set((uint8_t *)string, index, inStr); } - static void add(const char *string) { add((uint8_t *)string); } - - static void add(FSTR_P const string, uint8_t max_len=MAX_STRING_LENGTH) { add((uint8_t *)FTOP(string), max_len); } - static void add(FSTR_P const string, int8_t index, uint8_t *inStr=nullptr) { add((uint8_t *)FTOP(string), index, inStr); } - static void set(FSTR_P const string) { set((uint8_t *)FTOP(string)); } - static void set(FSTR_P const string, int8_t index, const char *inStr=nullptr) { set((uint8_t *)FTOP(string), index, inStr); } - static void add(FSTR_P const string) { add((uint8_t *)FTOP(string)); } - - static void trim(uint8_t character=0x20); - static void rtrim(uint8_t character=0x20); - static void ltrim(uint8_t character=0x20); - - static void truncate(uint8_t maxlen) { if (length > maxlen) { length = maxlen; eol(); } } + /** + * @brief Append an ASCII character and EOL + * + * @param character The ASCII character + */ + static void add(const char character) { add_character(character); eol(); } + static void set(wchar_t character) { set(); add(character); } + + /** + * @brief Append / Set C-string + * + * @param cstr The string + * @param max_len Character limit + */ + static void add(const char *cstr, uint8_t max_len=MAX_STRING_LENGTH); + static void set(const char *cstr, uint8_t max_len=MAX_STRING_LENGTH) { set(); add(cstr, max_len); } + + /** + * @brief Append / Set F-string + * + * @param fstr The string + * @param max_len Character limit + */ + static void add(FSTR_P const fstr, uint8_t max_len=MAX_STRING_LENGTH) { add(FTOP(fstr), max_len); } + static void set(FSTR_P const fstr, uint8_t max_len=MAX_STRING_LENGTH) { set(FTOP(fstr), max_len); } + + /** + * @brief Append / Set C-string with optional substitution + * + * @param tpl A string with optional substitution + * @param index An index + * @param cstr An SRAM C-string to use for $ substitution + * @param fstr A ROM F-string to use for $ substitution + */ + static void add(const char *tpl, const int8_t index, const char *cstr=nullptr, FSTR_P const fstr=nullptr); + static void set(const char *tpl, const int8_t index, const char *cstr=nullptr, FSTR_P const fstr=nullptr) { set(); add(tpl, index, cstr, fstr); } + + /** + * @brief Append / Set F-string with optional substitution + * + * @param ftpl A ROM F-string with optional substitution + * @param index An index + * @param cstr An SRAM C-string to use for $ substitution + * @param fstr A ROM F-string to use for $ substitution + */ + static void add(FSTR_P const ftpl, const int8_t index, const char *cstr=nullptr, FSTR_P const fstr=nullptr) { add(FTOP(ftpl), index, cstr, fstr); } + static void set(FSTR_P const ftpl, const int8_t index, const char *cstr=nullptr, FSTR_P const fstr=nullptr) { set(); add(ftpl, index, cstr, fstr); } + + // Common string ops + static void trim(const char character=' '); + static void rtrim(const char character=' '); + static void ltrim(const char character=' '); + static void truncate(const uint8_t maxlen) { if (length > maxlen) { length = maxlen; eol(); } } + + // Accessors + static char *string() { return data; } static uint16_t width() { return span; } - static uint8_t *string() { return data; } - static uint16_t center(uint16_t width) { return span > width ? 0 : (width - span) / 2; } + static uint16_t center(const uint16_t width) { return span > width ? 0 : (width - span) / 2; } }; extern TFT_String tft_string; diff --git a/Marlin/src/lcd/tft/ui_1024x600.cpp b/Marlin/src/lcd/tft/ui_1024x600.cpp index e8ba4737a80f..a1b6ee69e3b2 100644 --- a/Marlin/src/lcd/tft/ui_1024x600.cpp +++ b/Marlin/src/lcd/tft/ui_1024x600.cpp @@ -181,13 +181,13 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) { tft.add_image(8, 28, image, Color); - tft_string.set((uint8_t *)i16tostr3rj(currentTemperature)); + tft_string.set(i16tostr3rj(currentTemperature)); tft_string.add(LCD_STR_DEGREE); tft_string.trim(); tft.add_text(tft_string.center(80) + 2, 82, Color, tft_string); if (targetTemperature >= 0) { - tft_string.set((uint8_t *)i16tostr3rj(targetTemperature)); + tft_string.set(i16tostr3rj(targetTemperature)); tft_string.add(LCD_STR_DEGREE); tft_string.trim(); tft.add_text(tft_string.center(80) + 2, 8, Color, tft_string); @@ -211,7 +211,7 @@ void draw_fan_status(uint16_t x, uint16_t y, const bool blink) { tft.add_image(8, 20, image, COLOR_FAN); - tft_string.set((uint8_t *)ui8tostr4pctrj(thermalManager.fan_speed[0])); + tft_string.set(ui8tostr4pctrj(thermalManager.fan_speed[0])); tft_string.trim(); tft.add_text(tft_string.center(80) + 6, 82, COLOR_FAN, tft_string); } @@ -359,7 +359,7 @@ void MenuEditItemBase::draw_edit_screen(FSTR_P const fstr, const char * const va uint16_t line = 1; menu_line(line++); - tft_string.set(FTOP(fstr), itemIndex, FTOP(itemString)); + tft_string.set(fstr, itemIndex, itemStringC, itemStringF); tft_string.trim(); tft.add_text(tft_string.center(TFT_WIDTH), MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); @@ -606,7 +606,7 @@ static void quick_feedback() { #define CUR_STEP_VALUE_WIDTH 104 static void drawCurStepValue() { - tft_string.set((uint8_t *)ftostr52sp(motionAxisState.currentStepSize)); + tft_string.set(ftostr52sp(motionAxisState.currentStepSize)); tft_string.add("mm"); tft.canvas(motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT); tft.set_background(COLOR_BACKGROUND); diff --git a/Marlin/src/lcd/tft/ui_320x240.cpp b/Marlin/src/lcd/tft/ui_320x240.cpp index 148d5d3964c1..15031d0da2ec 100644 --- a/Marlin/src/lcd/tft/ui_320x240.cpp +++ b/Marlin/src/lcd/tft/ui_320x240.cpp @@ -181,13 +181,13 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) { tft.add_image(0, 18, image, Color); - tft_string.set((uint8_t *)i16tostr3rj(currentTemperature)); + tft_string.set(i16tostr3rj(currentTemperature)); tft_string.add(LCD_STR_DEGREE); tft_string.trim(); tft.add_text(tft_string.center(64) + 2, 72, Color, tft_string); if (targetTemperature >= 0) { - tft_string.set((uint8_t *)i16tostr3rj(targetTemperature)); + tft_string.set(i16tostr3rj(targetTemperature)); tft_string.add(LCD_STR_DEGREE); tft_string.trim(); tft.add_text(tft_string.center(64) + 2, 8, Color, tft_string); @@ -211,7 +211,7 @@ void draw_fan_status(uint16_t x, uint16_t y, const bool blink) { tft.add_image(0, 10, image, COLOR_FAN); - tft_string.set((uint8_t *)ui8tostr4pctrj(thermalManager.fan_speed[0])); + tft_string.set(ui8tostr4pctrj(thermalManager.fan_speed[0])); tft_string.trim(); tft.add_text(tft_string.center(64) + 6, 72, COLOR_FAN, tft_string); } @@ -354,7 +354,7 @@ void MenuEditItemBase::draw_edit_screen(FSTR_P const fstr, const char * const va uint16_t line = 1; menu_line(line++); - tft_string.set(FTOP(fstr), itemIndex, FTOP(itemString)); + tft_string.set(fstr, itemIndex, itemStringC, itemStringF); tft_string.trim(); tft.add_text(tft_string.center(TFT_WIDTH), MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); @@ -588,7 +588,7 @@ static void quick_feedback() { #define CUR_STEP_VALUE_WIDTH 38 static void drawCurStepValue() { - tft_string.set((uint8_t *)ftostr52sp(motionAxisState.currentStepSize)); + tft_string.set(ftostr52sp(motionAxisState.currentStepSize)); tft.canvas(motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, 20); tft.set_background(COLOR_BACKGROUND); tft.add_text(CUR_STEP_VALUE_WIDTH - tft_string.width(), 0, COLOR_AXIS_HOMED, tft_string); diff --git a/Marlin/src/lcd/tft/ui_480x320.cpp b/Marlin/src/lcd/tft/ui_480x320.cpp index 34502df54026..5a964525ecd1 100644 --- a/Marlin/src/lcd/tft/ui_480x320.cpp +++ b/Marlin/src/lcd/tft/ui_480x320.cpp @@ -181,13 +181,13 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) { tft.add_image(8, 28, image, Color); - tft_string.set((uint8_t *)i16tostr3rj(currentTemperature)); + tft_string.set(i16tostr3rj(currentTemperature)); tft_string.add(LCD_STR_DEGREE); tft_string.trim(); tft.add_text(tft_string.center(80) + 2, 82, Color, tft_string); if (targetTemperature >= 0) { - tft_string.set((uint8_t *)i16tostr3rj(targetTemperature)); + tft_string.set(i16tostr3rj(targetTemperature)); tft_string.add(LCD_STR_DEGREE); tft_string.trim(); tft.add_text(tft_string.center(80) + 2, 8, Color, tft_string); @@ -211,7 +211,7 @@ void draw_fan_status(uint16_t x, uint16_t y, const bool blink) { tft.add_image(8, 20, image, COLOR_FAN); - tft_string.set((uint8_t *)ui8tostr4pctrj(thermalManager.fan_speed[0])); + tft_string.set(ui8tostr4pctrj(thermalManager.fan_speed[0])); tft_string.trim(); tft.add_text(tft_string.center(80) + 6, 82, COLOR_FAN, tft_string); } @@ -359,7 +359,7 @@ void MenuEditItemBase::draw_edit_screen(FSTR_P const fstr, const char * const va uint16_t line = 1; menu_line(line++); - tft_string.set(FTOP(fstr), itemIndex, FTOP(itemString)); + tft_string.set(fstr, itemIndex, itemStringC, itemStringF); tft_string.trim(); tft.add_text(tft_string.center(TFT_WIDTH), MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); @@ -593,7 +593,7 @@ static void quick_feedback() { #define CUR_STEP_VALUE_WIDTH 104 static void drawCurStepValue() { - tft_string.set((uint8_t *)ftostr52sp(motionAxisState.currentStepSize)); + tft_string.set(ftostr52sp(motionAxisState.currentStepSize)); tft_string.add("mm"); tft.canvas(motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT); tft.set_background(COLOR_BACKGROUND); diff --git a/Marlin/src/lcd/tft/ui_common.cpp b/Marlin/src/lcd/tft/ui_common.cpp index 023ff59ca6d6..c9e069dbbd6f 100644 --- a/Marlin/src/lcd/tft/ui_common.cpp +++ b/Marlin/src/lcd/tft/ui_common.cpp @@ -96,16 +96,15 @@ void lcd_moveto(const lcd_uint_t col, const lcd_uint_t row) { lcd_gotopixel(int(col) * (TFT_COL_WIDTH), int(row) * MENU_LINE_HEIGHT); } -int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) { +int lcd_put_wchar_max(const wchar_t c, const pixel_len_t max_length) { if (max_length < 1) return 0; - tft_string.set(); - tft_string.add(c); + tft_string.set(c); tft.add_text(MENU_TEXT_X_OFFSET, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); lcd_gotopixel((cursor.x + 1) * (TFT_COL_WIDTH) + tft_string.width(), cursor.y * MENU_LINE_HEIGHT); return tft_string.width(); } -int lcd_put_u8str_max_P(PGM_P utf8_pstr, pixel_len_t max_length) { +int lcd_put_u8str_max_P(PGM_P utf8_pstr, const pixel_len_t max_length) { if (max_length < 1) return 0; tft_string.set(utf8_pstr); tft_string.trim(); @@ -115,7 +114,7 @@ int lcd_put_u8str_max_P(PGM_P utf8_pstr, pixel_len_t max_length) { return tft_string.width(); } -int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length) { +int lcd_put_u8str_max(const char * utf8_str, const pixel_len_t max_length) { return lcd_put_u8str_max_P(utf8_str, max_length); } @@ -133,7 +132,7 @@ void lcd_put_int(const int i) { void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char pre_char, const char post_char) { menu_item(row, sel); - uint8_t *string = (uint8_t *)FTOP(fstr); + const char *string = FTOP(fstr); MarlinImage image = noImage; switch (*string) { case 0x01: image = imgRefresh; break; // LCD_STR_REFRESH @@ -147,18 +146,19 @@ void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const fstr, c tft.add_image(MENU_ITEM_ICON_X, MENU_ITEM_ICON_Y, image, COLOR_MENU_TEXT, sel ? COLOR_SELECTION_BG : COLOR_BACKGROUND); } - tft_string.set(string, itemIndex, FTOP(itemString)); + tft_string.set(string, itemIndex, itemStringC, itemStringF); + tft.add_text(offset, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); } // Draw a menu item with a (potentially) editable value -void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char * const data, const bool pgm) { +void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char * const inStr, const bool pgm) { menu_item(row, sel); - tft_string.set(FTOP(fstr), itemIndex, FTOP(itemString)); + tft_string.set(fstr, itemIndex, itemStringC, itemStringF); tft.add_text(MENU_TEXT_X_OFFSET, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); - if (data) { - tft_string.set(data); + if (inStr) { + tft_string.set(inStr); tft.add_text(TFT_WIDTH - MENU_TEXT_X_OFFSET - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string); } } @@ -166,7 +166,7 @@ void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const fstr // Draw a static item with no left-right margin required. Centered by default. void MenuItem_static::draw(const uint8_t row, FSTR_P const fstr, const uint8_t style/*=SS_DEFAULT*/, const char * const vstr/*=nullptr*/) { menu_item(row); - tft_string.set(FTOP(fstr), itemIndex, FTOP(itemString)); + tft_string.set(fstr, itemIndex, itemStringC, itemStringF); if (vstr) tft_string.add(vstr); tft.add_text(tft_string.center(TFT_WIDTH), MENU_TEXT_Y_OFFSET, COLOR_YELLOW, tft_string); } diff --git a/Marlin/src/libs/L64XX/L64XX_Marlin.cpp b/Marlin/src/libs/L64XX/L64XX_Marlin.cpp index f7641ad72313..1d6943406722 100644 --- a/Marlin/src/libs/L64XX/L64XX_Marlin.cpp +++ b/Marlin/src/libs/L64XX/L64XX_Marlin.cpp @@ -38,7 +38,7 @@ L64XX_Marlin L64xxManager; #include "../../HAL/shared/Delay.h" static const char NUM_AXIS_LIST( - str_X[] PROGMEM = "X ", str_Y[] PROGMEM = "Y ", str_Z[] PROGMEM = "Z ", + str_X[] PROGMEM = "X ", str_Y[] PROGMEM = "Y ", str_Z[] PROGMEM = "Z ", str_I[] PROGMEM = STR_I " ", str_J[] PROGMEM = STR_J " ", str_K[] PROGMEM = STR_K " " ), str_X2[] PROGMEM = "X2", str_Y2[] PROGMEM = "Y2", diff --git a/buildroot/share/fonts/genpages.c b/buildroot/share/fonts/genpages.c index dea5b05c5c80..8009e553fa68 100644 --- a/buildroot/share/fonts/genpages.c +++ b/buildroot/share/fonts/genpages.c @@ -66,7 +66,7 @@ wchar_t get_val_utf82uni(uint8_t *pstart) { */ uint8_t* get_utf8_value(uint8_t *pstart, wchar_t *pval) { uint32_t val = 0; - uint8_t *p = pstart; + const uint8_t *p = pstart; /*size_t maxlen = strlen(pstart);*/ assert(NULL != pstart); From d08223429be30218eb74dd57603b60751ba9e0aa Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 3 Jun 2022 23:50:20 -0500 Subject: [PATCH 144/241] =?UTF-8?q?=F0=9F=94=96=20=20Moving=20to=20bugfix-?= =?UTF-8?q?2.1.x?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/ISSUE_TEMPLATE/bug_report.yml | 10 +++++----- .github/ISSUE_TEMPLATE/feature_request.yml | 2 +- .github/contributing.md | 2 +- .github/workflows/bump-date.yml | 4 ++-- .github/workflows/check-pr.yml | 4 ++-- .github/workflows/test-builds.yml | 4 ++-- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- Marlin/src/lcd/e3v2/README.md | 2 +- Marlin/src/lcd/e3v2/jyersui/README.md | 2 +- Marlin/src/pins/stm32f4/pins_ANET_ET4.h | 2 +- README.md | 2 +- buildroot/bin/use_example_configs | 2 +- buildroot/share/git/mfconfig | 4 ++-- buildroot/share/git/mffp | 2 +- buildroot/share/git/mfinfo | 6 +++--- buildroot/share/git/mfprep | 18 +++++++++--------- config/README.md | 6 +++--- 18 files changed, 38 insertions(+), 38 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 9d8b0666e5eb..696a00b44097 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -14,13 +14,13 @@ body: ## Before Reporting a Bug - - Read and understand Marlin's [Code of Conduct](https://github.com/MarlinFirmware/Marlin/blob/bugfix-2.0.x/.github/code_of_conduct.md). You are expected to comply with it, including treating everyone with respect. + - Read and understand Marlin's [Code of Conduct](https://github.com/MarlinFirmware/Marlin/blob/bugfix-2.1.x/.github/code_of_conduct.md). You are expected to comply with it, including treating everyone with respect. - - Test with the [`bugfix-2.0.x` branch](https://github.com/MarlinFirmware/Marlin/archive/bugfix-2.0.x.zip) to see whether the issue still exists. + - Test with the [`bugfix-2.1.x` branch](https://github.com/MarlinFirmware/Marlin/archive/bugfix-2.1.x.zip) to see whether the issue still exists. ## Instructions - Please follow the instructions below. Failure to do so may result in your issue being closed. See [Contributing to Marlin](https://github.com/MarlinFirmware/Marlin/blob/bugfix-2.0.x/.github/contributing.md) for additional guidelines. + Please follow the instructions below. Failure to do so may result in your issue being closed. See [Contributing to Marlin](https://github.com/MarlinFirmware/Marlin/blob/bugfix-2.1.x/.github/contributing.md) for additional guidelines. 1. Provide a good title starting with [BUG]. 2. Fill out all sections of this bug report form. @@ -28,10 +28,10 @@ body: - type: dropdown attributes: - label: Did you test the latest `bugfix-2.0.x` code? + label: Did you test the latest `bugfix-2.1.x` code? description: >- Always try the latest code to make sure the issue you are reporting is not already fixed. To download - the latest code just [click this link](https://github.com/MarlinFirmware/Marlin/archive/bugfix-2.0.x.zip). + the latest code just [click this link](https://github.com/MarlinFirmware/Marlin/archive/bugfix-2.1.x.zip). options: - Yes, and the problem still exists. - No, but I will test it now! diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index df1938ccd84a..b64383cd48b2 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -17,7 +17,7 @@ body: - Read and understand Marlin's [Code of Conduct](https://github.com/MarlinFirmware/Marlin/blob/master/.github/code_of_conduct.md). You are expected to comply with it, including treating everyone with respect. - - Check the latest [`bugfix-2.0.x` branch](https://github.com/MarlinFirmware/Marlin/archive/bugfix-2.0.x.zip) to see if the feature already exists. + - Check the latest [`bugfix-2.1.x` branch](https://github.com/MarlinFirmware/Marlin/archive/bugfix-2.1.x.zip) to see if the feature already exists. - Before you proceed with your request, please consider if it is necessary to make it into a firmware feature, or if it may be better suited for a slicer or host feature. diff --git a/.github/contributing.md b/.github/contributing.md index 24b9dbdf8d0d..fcb87b014123 100644 --- a/.github/contributing.md +++ b/.github/contributing.md @@ -116,7 +116,7 @@ Unsure where to begin contributing to Marlin? You can start by looking through t ### Pull Requests -Pull Requests should always be targeted to working branches (e.g., `bugfix-2.0.x` and/or `bugfix-1.1.x`) and never to release branches (e.g., `2.0.x` and/or `1.1.x`). If this is your first Pull Request, please read our [Guide to Pull Requests](https://marlinfw.org/docs/development/getting_started_pull_requests.html) and Github's [Pull Request](https://help.github.com/articles/creating-a-pull-request/) documentation. +Pull Requests should always be targeted to working branches (e.g., `bugfix-2.1.x` and/or `bugfix-1.1.x`) and never to release branches (e.g., `2.0.x` and/or `1.1.x`). If this is your first Pull Request, please read our [Guide to Pull Requests](https://marlinfw.org/docs/development/getting_started_pull_requests.html) and Github's [Pull Request](https://help.github.com/articles/creating-a-pull-request/) documentation. * Fill in [the required template](pull_request_template.md). * Don't include issue numbers in the PR title. diff --git a/.github/workflows/bump-date.yml b/.github/workflows/bump-date.yml index 2366da725806..d517d7d05ea3 100644 --- a/.github/workflows/bump-date.yml +++ b/.github/workflows/bump-date.yml @@ -18,10 +18,10 @@ jobs: steps: - - name: Check out bugfix-2.0.x + - name: Check out bugfix-2.1.x uses: actions/checkout@v2 with: - ref: bugfix-2.0.x + ref: bugfix-2.1.x - name: Bump Distribution Date run: | diff --git a/.github/workflows/check-pr.yml b/.github/workflows/check-pr.yml index 93a110f270d3..fe64b833386f 100644 --- a/.github/workflows/check-pr.yml +++ b/.github/workflows/check-pr.yml @@ -26,8 +26,8 @@ jobs: comment: > Thanks for your contribution! Unfortunately we can't accept PRs directed at release branches. We make patches to the bugfix branches and only later do we push them out as releases. - Please redo this PR starting with the `bugfix-2.0.x` branch and be careful to target `bugfix-2.0.x` when resubmitting the PR. + Please redo this PR starting with the `bugfix-2.1.x` branch and be careful to target `bugfix-2.1.x` when resubmitting the PR. - It may help to set your fork's default branch to `bugfix-2.0.x`. + It may help to set your fork's default branch to `bugfix-2.1.x`. See [this page](http://marlinfw.org/docs/development/getting_started_pull_requests.html) for full instructions. diff --git a/.github/workflows/test-builds.yml b/.github/workflows/test-builds.yml index 498cfc1d1f51..2ad77003cc77 100644 --- a/.github/workflows/test-builds.yml +++ b/.github/workflows/test-builds.yml @@ -8,7 +8,7 @@ name: CI on: pull_request: branches: - - bugfix-2.0.x + - bugfix-2.1.x paths-ignore: - config/** - data/** @@ -16,7 +16,7 @@ on: - '**/*.md' push: branches: - - bugfix-2.0.x + - bugfix-2.1.x paths-ignore: - config/** - data/** diff --git a/Marlin/Version.h b/Marlin/Version.h index 32f31717129d..ea181fb3fdc2 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -28,7 +28,7 @@ /** * Marlin release version identifier */ -//#define SHORT_BUILD_VERSION "bugfix-2.0.x" +//#define SHORT_BUILD_VERSION "bugfix-2.1.x" /** * Verbose version identifier which should contain a reference to the location diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 8bc51ca9ff79..bbe0a61bb887 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -25,7 +25,7 @@ * Release version. Leave the Marlin version or apply a custom scheme. */ #ifndef SHORT_BUILD_VERSION - #define SHORT_BUILD_VERSION "bugfix-2.0.x" + #define SHORT_BUILD_VERSION "bugfix-2.1.x" #endif /** diff --git a/Marlin/src/lcd/e3v2/README.md b/Marlin/src/lcd/e3v2/README.md index 10b05455fdaf..91f25e2433bf 100644 --- a/Marlin/src/lcd/e3v2/README.md +++ b/Marlin/src/lcd/e3v2/README.md @@ -1,6 +1,6 @@ # DWIN for Creality Ender 3 v2 -Marlin's Ender 3 v2 support requires the `DWIN_SET` included with the Ender 3 V2 [example configuration](https://github.com/MarlinFirmware/Configurations/tree/bugfix-2.0.x/config/examples/Creality/Ender-3%20V2). +Marlin's Ender 3 v2 support requires the `DWIN_SET` included with the Ender 3 V2 [example configuration](https://github.com/MarlinFirmware/Configurations/tree/bugfix-2.1.x/config/examples/Creality/Ender-3%20V2). ## Easy Install diff --git a/Marlin/src/lcd/e3v2/jyersui/README.md b/Marlin/src/lcd/e3v2/jyersui/README.md index 10b05455fdaf..91f25e2433bf 100644 --- a/Marlin/src/lcd/e3v2/jyersui/README.md +++ b/Marlin/src/lcd/e3v2/jyersui/README.md @@ -1,6 +1,6 @@ # DWIN for Creality Ender 3 v2 -Marlin's Ender 3 v2 support requires the `DWIN_SET` included with the Ender 3 V2 [example configuration](https://github.com/MarlinFirmware/Configurations/tree/bugfix-2.0.x/config/examples/Creality/Ender-3%20V2). +Marlin's Ender 3 v2 support requires the `DWIN_SET` included with the Ender 3 V2 [example configuration](https://github.com/MarlinFirmware/Configurations/tree/bugfix-2.1.x/config/examples/Creality/Ender-3%20V2). ## Easy Install diff --git a/Marlin/src/pins/stm32f4/pins_ANET_ET4.h b/Marlin/src/pins/stm32f4/pins_ANET_ET4.h index 7816e5e5056a..01ca4560fe4a 100644 --- a/Marlin/src/pins/stm32f4/pins_ANET_ET4.h +++ b/Marlin/src/pins/stm32f4/pins_ANET_ET4.h @@ -64,7 +64,7 @@ // Z Probe // #if ENABLED(BLTOUCH) - #error "You will need to use 24V to 5V converter and remove one resistor and capacitor from the motherboard. See https://github.com/davidtgbe/Marlin/blob/bugfix-2.0.x/docs/Tutorials/bltouch-en.md for more information. Comment out this line to proceed at your own risk." + #error "You will need to use 24V to 5V converter and remove one resistor and capacitor from the motherboard. See https://bit.ly/3xg9cXO for more information. Comment out this line to proceed at your own risk." #define SERVO0_PIN PC3 #elif !defined(Z_MIN_PROBE_PIN) #define Z_MIN_PROBE_PIN PC3 diff --git a/README.md b/README.md index 84a600d257dd..13614828077b 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ Marlin 2.0 introduces a layer of abstraction so that all the existing high-level ## Submitting Patches -Proposed patches should be submitted as a Pull Request against the ([bugfix-2.0.x](https://github.com/MarlinFirmware/Marlin/tree/bugfix-2.0.x)) branch. +Proposed patches should be submitted as a Pull Request against the ([bugfix-2.1.x](https://github.com/MarlinFirmware/Marlin/tree/bugfix-2.1.x)) branch. - This branch is for fixing bugs and integrating any new features for the duration of the Marlin 2.0.x life-cycle. - Follow the [Coding Standards](https://marlinfw.org/docs/development/coding_standards.html) to gain points with the maintainers. diff --git a/buildroot/bin/use_example_configs b/buildroot/bin/use_example_configs index 83c0f5485d2c..d6b479e040e1 100755 --- a/buildroot/bin/use_example_configs +++ b/buildroot/bin/use_example_configs @@ -2,7 +2,7 @@ IFS=: read -r PART1 PART2 <<< "$@" [ -n "${PART2}" ] && { REPO="$PART1" ; RDIR="${PART2// /%20}" ; } \ - || { REPO=bugfix-2.0.x ; RDIR="${PART1// /%20}" ; } + || { REPO=bugfix-2.1.x ; RDIR="${PART1// /%20}" ; } EXAMPLES="https://raw.githubusercontent.com/MarlinFirmware/Configurations/$REPO/config/examples" which curl >/dev/null && TOOL='curl -L -s -S -f -o wgot' diff --git a/buildroot/share/git/mfconfig b/buildroot/share/git/mfconfig index d3e0b67b3e40..dbef1990a155 100755 --- a/buildroot/share/git/mfconfig +++ b/buildroot/share/git/mfconfig @@ -35,7 +35,7 @@ COMMIT_STEPS=0 ACTION=${1:-init} IMPORT=${2:-"import-2.0.x"} -EXPORT=${3:-"bugfix-2.0.x"} +EXPORT=${3:-"bugfix-2.1.x"} echo -n "Doing grhh ... " ; grhh ; echo @@ -52,7 +52,7 @@ if [[ $ACTION == "manual" ]]; then git checkout $IMPORT || exit # Reset from the latest complete state - #git reset --hard bugfix-2.0.x + #git reset --hard bugfix-2.1.x cp "$MARLINREPO/Marlin/"Configuration*.h "$CDEF/" #git add . && git commit -m "Changes from Marlin ($(date '+%Y-%m-%d %H:%M'))." diff --git a/buildroot/share/git/mffp b/buildroot/share/git/mffp index ab4dd4c0b771..6fe52d47e5a3 100755 --- a/buildroot/share/git/mffp +++ b/buildroot/share/git/mffp @@ -3,7 +3,7 @@ # mffp [1|2] [ref] # # Push the given commit (or HEAD) upstream immediately. -# By default: `git push upstream HEAD:bugfix-2.0.x` +# By default: `git push upstream HEAD:bugfix-2.1.x` # usage() { echo "usage: `basename $0` [1|2] [ref]" 1>&2 ; } diff --git a/buildroot/share/git/mfinfo b/buildroot/share/git/mfinfo index 0c2113d92293..3f183b8fd8f0 100755 --- a/buildroot/share/git/mfinfo +++ b/buildroot/share/git/mfinfo @@ -7,13 +7,13 @@ # - Remote (upstream) Org name (MarlinFirmware) # - Remote (origin) Org name (your Github username) # - Repo Name (Marlin, MarlinDocumentation) -# - PR Target branch (e.g., bugfix-2.0.x) +# - PR Target branch (e.g., bugfix-2.1.x) # - Branch Arg (the branch argument or current branch) # - Current Branch # # Example output # > mfinfo -q ongoing -# MarlinFirmware john.doe Marlin bugfix-2.0.x ongoing bugfix-2.0.x -q +# MarlinFirmware john.doe Marlin bugfix-2.1.x ongoing bugfix-2.1.x -q # CURR=$(git branch 2>/dev/null | grep ^* | sed 's/\* //g') @@ -55,7 +55,7 @@ while [[ $# -gt 0 ]]; do done case "$REPO" in - Marlin ) TARG=bugfix-2.0.x ; ((INDEX == 1)) && TARG=bugfix-1.1.x ; [[ $BRANCH =~ ^[12]$ ]] && USAGE=1 ;; + Marlin ) TARG=bugfix-2.1.x ; ((INDEX == 1)) && TARG=bugfix-1.1.x ; [[ $BRANCH =~ ^[12]$ ]] && USAGE=1 ;; Configurations ) TARG=import-2.0.x ;; MarlinDocumentation ) TARG=master ;; AutoBuildMarlin ) TARG=master ;; diff --git a/buildroot/share/git/mfprep b/buildroot/share/git/mfprep index 6a8850286153..0c9e54fe8de4 100755 --- a/buildroot/share/git/mfprep +++ b/buildroot/share/git/mfprep @@ -2,11 +2,11 @@ # # mfprep tag1 [tag2] # -# Find commits in bugfix-2.0.x that are not yet in 2.0.x. +# Find commits in bugfix-2.1.x that are not yet in 2.0.x. # # Specify a version tag to start from, and optional version tag to end at. -# For bugfix-2.0.x the tag will be prefixed by bf- to distinguish it from the version tag, -# so at every release be sure to create a bf- tag and publish it to origin. +# For bugfix-2.1.x the tag will be prefixed by dev- to distinguish it from the version tag, +# so at every release be sure to create a dev- tag and publish it to origin. # SED=$(which gsed sed | head -n1) @@ -22,12 +22,12 @@ DEST=2.1.x # Validate that the required tags exist -MTAG=`git tag | grep -e "^bf-$TAG1\$"` -[[ -n "$MTAG" ]] || { echo "Can't find tag bf-$TAG1" ; exit 1 ; } +MTAG=`git tag | grep -e "^dev-$TAG1\$"` +[[ -n "$MTAG" ]] || { echo "Can't find tag dev-$TAG1" ; exit 1 ; } MTAG=`git tag | grep -e "^$TAG1\$"` [[ -n "$MTAG" ]] || { echo "Can't find tag $TAG1" ; exit 1 ; } -# Generate log of recent commits for bugfix-2.0.x and DEST +# Generate log of recent commits for bugfix-2.1.x and DEST TMPDIR=`mktemp -d` LOGB="$TMPDIR/log-bf.txt" @@ -35,11 +35,11 @@ LOG2="$TMPDIR/log-2x.txt" TMPF="$TMPDIR/tmp.txt" SCRF="$TMPDIR/update-$DEST.sh" -git checkout bugfix-2.0.x -git log --pretty="[%h] %s" bf-$TAG1..$TAG2 | grep -v '\[cron\]' | $SED '1!G;h;$!d' >"$LOGB" +git checkout bugfix-2.1.x +git log --pretty="[%h] %s" dev-$TAG1..$TAG2 | grep -v '\[cron\]' | $SED '1!G;h;$!d' >"$LOGB" git checkout $DEST -git log --pretty="[%h] %s" $TAG1..$TAG2 | $SED '1!G;h;$!d' >"$LOG2" || { echo "Can't find tag bf-$TAG1" ; exit 1 ; } +git log --pretty="[%h] %s" $TAG1..$TAG2 | $SED '1!G;h;$!d' >"$LOG2" || { echo "Can't find tag dev-$TAG1" ; exit 1 ; } # Go through commit text from DEST removing all matches from the bugfix log diff --git a/config/README.md b/config/README.md index 4bd6ab851e52..b19527ccc30a 100644 --- a/config/README.md +++ b/config/README.md @@ -2,8 +2,8 @@ Marlin configurations for specific machines are now maintained in their own repository at: -## https://github.com/MarlinFirmware/Configurations/tree/bugfix-2.0.x +## https://github.com/MarlinFirmware/Configurations/tree/bugfix-2.1.x -Configuration files for use with the nightly `bugfix-2.0.x` branch can be downloaded from: +Configuration files for use with the nightly `bugfix-2.1.x` branch can be downloaded from: -## https://github.com/MarlinFirmware/Configurations/archive/bugfix-2.0.x.zip +## https://github.com/MarlinFirmware/Configurations/archive/bugfix-2.1.x.zip From ca06c6eab97407b3ef897f1512cc51e1b4aa083c Mon Sep 17 00:00:00 2001 From: John Robertson Date: Sat, 4 Jun 2022 07:26:08 +0100 Subject: [PATCH 145/241] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20PWM=20for=20ESP32?= =?UTF-8?q?=20I2S=20expander=20(#24193)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 5 ++- Marlin/Makefile | 2 +- Marlin/src/HAL/ESP32/HAL.cpp | 50 ++++++++++++++++----- Marlin/src/HAL/ESP32/HAL.h | 11 +++++ Marlin/src/HAL/ESP32/i2s.cpp | 20 +++++++++ Marlin/src/HAL/ESP32/inc/Conditionals_adv.h | 7 +++ Marlin/src/HAL/ESP32/inc/SanityCheck.h | 4 ++ Marlin/src/module/stepper.cpp | 4 +- Marlin/src/pins/esp32/pins_E4D.h | 9 +--- Marlin/src/pins/esp32/pins_ENWI_ESPNP.h | 8 ++-- Marlin/src/pins/esp32/pins_ESP32.h | 8 ++-- Marlin/src/pins/esp32/pins_ESPA_common.h | 8 ---- Marlin/src/pins/esp32/pins_MKS_TINYBEE.h | 5 +-- Marlin/src/pins/esp32/pins_MRR_ESPE.h | 9 ++-- 14 files changed, 104 insertions(+), 46 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 16a4f36e4fb5..96a3e04d0b77 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -3592,7 +3592,10 @@ #if ENABLED(SPINDLE_LASER_USE_PWM) #define SPINDLE_LASER_PWM_INVERT false // Set to "true" if the speed/power goes up when you want it to go slower #define SPINDLE_LASER_FREQUENCY 2500 // (Hz) Spindle/laser frequency (only on supported HALs: AVR, ESP32, and LPC) - #endif + // ESP32: If SPINDLE_LASER_PWM_PIN is onboard then <=78125Hz. For I2S expander + // the frequency determines the PWM resolution. 2500Hz = 0-100, 977Hz = 0-255, ... + // (250000 / SPINDLE_LASER_FREQUENCY) = max value. +#endif //#define AIR_EVACUATION // Cutter Vacuum / Laser Blower motor control with G-codes M10-M11 #if ENABLED(AIR_EVACUATION) diff --git a/Marlin/Makefile b/Marlin/Makefile index 417c979f8857..563354fdbe1f 100644 --- a/Marlin/Makefile +++ b/Marlin/Makefile @@ -109,7 +109,7 @@ LIQUID_TWI2 ?= 0 # This defines if Wire is needed WIRE ?= 0 -# This defines if Tone is needed (i.e SPEAKER is defined in Configuration.h) +# This defines if Tone is needed (i.e., SPEAKER is defined in Configuration.h) # Disabling this (and SPEAKER) saves approximately 350 bytes of memory. TONE ?= 1 diff --git a/Marlin/src/HAL/ESP32/HAL.cpp b/Marlin/src/HAL/ESP32/HAL.cpp index 65af39786eeb..29f3be3c028a 100644 --- a/Marlin/src/HAL/ESP32/HAL.cpp +++ b/Marlin/src/HAL/ESP32/HAL.cpp @@ -65,6 +65,7 @@ portMUX_TYPE MarlinHAL::spinlock = portMUX_INITIALIZER_UNLOCKED; // ------------------------ uint16_t MarlinHAL::adc_result; +pwm_pin_t MarlinHAL::pwm_pin_data[MAX_EXPANDER_BITS]; // ------------------------ // Private Variables @@ -330,21 +331,46 @@ int8_t get_pwm_channel(const pin_t pin, const uint32_t freq, const uint16_t res) } void MarlinHAL::set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=_BV(PWM_RESOLUTION)-1*/, const bool invert/*=false*/) { - const int8_t cid = get_pwm_channel(pin, PWM_FREQUENCY, PWM_RESOLUTION); - if (cid >= 0) { - uint32_t duty = map(invert ? v_size - v : v, 0, v_size, 0, _BV(PWM_RESOLUTION)-1); - ledcWrite(cid, duty); - } + #if ENABLED(I2S_STEPPER_STREAM) + if (pin > 127) { + const uint8_t pinlo = pin & 0x7F; + pwm_pin_t &pindata = pwm_pin_data[pinlo]; + const uint32_t duty = map(invert ? v_size - v : v, 0, v_size, 0, pindata.pwm_cycle_ticks); + if (duty == 0 || duty == pindata.pwm_cycle_ticks) { // max or min (i.e., on/off) + pindata.pwm_duty_ticks = 0; // turn off PWM for this pin + duty ? SBI32(i2s_port_data, pinlo) : CBI32(i2s_port_data, pinlo); // set pin level + } + else + pindata.pwm_duty_ticks = duty; // PWM duty count = # of 4µs ticks per full PWM cycle + } + else + #endif + { + const int8_t cid = get_pwm_channel(pin, PWM_FREQUENCY, PWM_RESOLUTION); + if (cid >= 0) { + const uint32_t duty = map(invert ? v_size - v : v, 0, v_size, 0, _BV(PWM_RESOLUTION)-1); + ledcWrite(cid, duty); + } + } } int8_t MarlinHAL::set_pwm_frequency(const pin_t pin, const uint32_t f_desired) { - const int8_t cid = channel_for_pin(pin); - if (cid >= 0) { - if (f_desired == ledcReadFreq(cid)) return cid; // no freq change - ledcDetachPin(chan_pin[cid]); - chan_pin[cid] = 0; // remove old freq channel - } - return get_pwm_channel(pin, f_desired, PWM_RESOLUTION); // try for new one + #if ENABLED(I2S_STEPPER_STREAM) + if (pin > 127) { + pwm_pin_data[pin & 0x7F].pwm_cycle_ticks = 1000000UL / f_desired / 4; // # of 4µs ticks per full PWM cycle + return 0; + } + else + #endif + { + const int8_t cid = channel_for_pin(pin); + if (cid >= 0) { + if (f_desired == ledcReadFreq(cid)) return cid; // no freq change + ledcDetachPin(chan_pin[cid]); + chan_pin[cid] = 0; // remove old freq channel + } + return get_pwm_channel(pin, f_desired, PWM_RESOLUTION); // try for new one + } } // use hardware PWM if avail, if not then ISR diff --git a/Marlin/src/HAL/ESP32/HAL.h b/Marlin/src/HAL/ESP32/HAL.h index a07303d4891f..600ca8f5ee37 100644 --- a/Marlin/src/HAL/ESP32/HAL.h +++ b/Marlin/src/HAL/ESP32/HAL.h @@ -68,6 +68,9 @@ #define PWM_RESOLUTION 10u // Default PWM bit resolution #define CHANNEL_MAX_NUM 15u // max PWM channel # to allocate (7 to only use low speed, 15 to use low & high) #define MAX_PWM_IOPIN 33u // hardware pwm pins < 34 +#ifndef MAX_EXPANDER_BITS + #define MAX_EXPANDER_BITS 32 // I2S expander bit width (max 32) +#endif // ------------------------ // Types @@ -76,6 +79,12 @@ typedef double isr_float_t; // FPU ops are used for single-precision, so use double for ISRs. typedef int16_t pin_t; +typedef struct pwm_pin { + uint32_t pwm_cycle_ticks = 1000000UL / (PWM_FREQUENCY) / 4; // # ticks per pwm cycle + uint32_t pwm_tick_count = 0; // current tick count + uint32_t pwm_duty_ticks = 0; // # of ticks for current duty cycle +} pwm_pin_t; + class Servo; typedef Servo hal_servo_t; @@ -197,6 +206,8 @@ class MarlinHAL { // Free SRAM static int freeMemory(); + static pwm_pin_t pwm_pin_data[MAX_EXPANDER_BITS]; + // // ADC Methods // diff --git a/Marlin/src/HAL/ESP32/i2s.cpp b/Marlin/src/HAL/ESP32/i2s.cpp index 3e77b658360b..cf337eeb4622 100644 --- a/Marlin/src/HAL/ESP32/i2s.cpp +++ b/Marlin/src/HAL/ESP32/i2s.cpp @@ -337,6 +337,26 @@ uint8_t i2s_state(uint8_t pin) { } void i2s_push_sample() { + // Every 4µs (when space in DMA buffer) toggle each expander PWM output using + // the current duty cycle/frequency so they sync with any steps (once + // through the DMA/FIFO buffers). PWM signal inversion handled by other functions + LOOP_L_N(p, MAX_EXPANDER_BITS) { + if (hal.pwm_pin_data[p].pwm_duty_ticks > 0) { // pin has active pwm? + if (hal.pwm_pin_data[p].pwm_tick_count == 0) { + if (TEST32(i2s_port_data, p)) { // hi->lo + CBI32(i2s_port_data, p); + hal.pwm_pin_data[p].pwm_tick_count = hal.pwm_pin_data[p].pwm_cycle_ticks - hal.pwm_pin_data[p].pwm_duty_ticks; + } + else { // lo->hi + SBI32(i2s_port_data, p); + hal.pwm_pin_data[p].pwm_tick_count = hal.pwm_pin_data[p].pwm_duty_ticks; + } + } + else + hal.pwm_pin_data[p].pwm_tick_count--; + } + } + dma.current[dma.rw_pos++] = i2s_port_data; } diff --git a/Marlin/src/HAL/ESP32/inc/Conditionals_adv.h b/Marlin/src/HAL/ESP32/inc/Conditionals_adv.h index 5f1c4b16019d..3ca806897a89 100644 --- a/Marlin/src/HAL/ESP32/inc/Conditionals_adv.h +++ b/Marlin/src/HAL/ESP32/inc/Conditionals_adv.h @@ -20,3 +20,10 @@ * */ #pragma once + +// +// Board-specific options need to be defined before HAL.h +// +#if MB(MKS_TINYBEE) + #define MAX_EXPANDER_BITS 24 // TinyBee has 3 x HC595 +#endif diff --git a/Marlin/src/HAL/ESP32/inc/SanityCheck.h b/Marlin/src/HAL/ESP32/inc/SanityCheck.h index 04d70ec14f0b..3ccb15989f33 100644 --- a/Marlin/src/HAL/ESP32/inc/SanityCheck.h +++ b/Marlin/src/HAL/ESP32/inc/SanityCheck.h @@ -48,3 +48,7 @@ #if USING_PULLDOWNS #error "PULLDOWN pin mode is not available on ESP32 boards." #endif + +#if BOTH(I2S_STEPPER_STREAM, LIN_ADVANCE) + #error "I2S stream is currently incompatible with LIN_ADVANCE." +#endif diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index d098179fc183..40cf7d02eaae 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -1898,9 +1898,7 @@ void Stepper::pulse_phase_isr() { #endif #endif - #if ENABLED(I2S_STEPPER_STREAM) - i2s_push_sample(); - #endif + TERN_(I2S_STEPPER_STREAM, i2s_push_sample()); // TODO: need to deal with MINIMUM_STEPPER_PULSE over i2s #if ISR_MULTI_STEPS diff --git a/Marlin/src/pins/esp32/pins_E4D.h b/Marlin/src/pins/esp32/pins_E4D.h index 42177e9a4e31..d12b5276b7be 100644 --- a/Marlin/src/pins/esp32/pins_E4D.h +++ b/Marlin/src/pins/esp32/pins_E4D.h @@ -40,19 +40,14 @@ #define BOARD_WEBSITE_URL "github.com/Exilaus/E4d@box" #define DEFAULT_MACHINE_NAME BOARD_INFO_NAME -// -// Disable I2S stepper stream -// -#undef I2S_STEPPER_STREAM - // // Redefine I2S for ESP32 // #undef I2S_WS -#define I2S_WS 23 #undef I2S_BCK -#define I2S_BCK 22 #undef I2S_DATA +#define I2S_WS 23 +#define I2S_BCK 22 #define I2S_DATA 21 // diff --git a/Marlin/src/pins/esp32/pins_ENWI_ESPNP.h b/Marlin/src/pins/esp32/pins_ENWI_ESPNP.h index aff7f742edf9..80923d972deb 100644 --- a/Marlin/src/pins/esp32/pins_ENWI_ESPNP.h +++ b/Marlin/src/pins/esp32/pins_ENWI_ESPNP.h @@ -35,9 +35,11 @@ // I2S (steppers & other output-only pins) // #define I2S_STEPPER_STREAM -#define I2S_WS 17 -#define I2S_BCK 22 -#define I2S_DATA 21 +#if ENABLED(I2S_STEPPER_STREAM) + #define I2S_WS 17 + #define I2S_BCK 22 + #define I2S_DATA 21 +#endif // // Servos diff --git a/Marlin/src/pins/esp32/pins_ESP32.h b/Marlin/src/pins/esp32/pins_ESP32.h index 6578770ba0e2..266de7e9f60e 100644 --- a/Marlin/src/pins/esp32/pins_ESP32.h +++ b/Marlin/src/pins/esp32/pins_ESP32.h @@ -33,9 +33,11 @@ // I2S (steppers & other output-only pins) // #define I2S_STEPPER_STREAM -#define I2S_WS 25 -#define I2S_BCK 26 -#define I2S_DATA 27 +#if ENABLED(I2S_STEPPER_STREAM) + #define I2S_WS 25 + #define I2S_BCK 26 + #define I2S_DATA 27 +#endif // // Limit Switches diff --git a/Marlin/src/pins/esp32/pins_ESPA_common.h b/Marlin/src/pins/esp32/pins_ESPA_common.h index 2fcacb3002b4..ca949cdf9716 100644 --- a/Marlin/src/pins/esp32/pins_ESPA_common.h +++ b/Marlin/src/pins/esp32/pins_ESPA_common.h @@ -32,14 +32,6 @@ #define DEFAULT_MACHINE_NAME BOARD_INFO_NAME #endif -// -// Disable I2S stepper stream, by default -// -#undef I2S_STEPPER_STREAM -#undef I2S_WS -#undef I2S_BCK -#undef I2S_DATA - // // Limit Switches // diff --git a/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h b/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h index 9938d9b4fa01..3d5e3964f490 100644 --- a/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h +++ b/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h @@ -40,6 +40,8 @@ #define BOARD_WEBSITE_URL "https://github.com/makerbase-mks" #define DEFAULT_MACHINE_NAME BOARD_INFO_NAME +// MAX_EXPANDER_BITS is defined for MKS TinyBee in HAL/ESP32/inc/Conditionals_adv.h + // // Servos // @@ -61,9 +63,6 @@ #define I2S_WS 26 #define I2S_BCK 25 #define I2S_DATA 27 - #if ENABLED(LIN_ADVANCE) - #error "I2S stream is currently incompatible with LIN_ADVANCE." - #endif #endif // diff --git a/Marlin/src/pins/esp32/pins_MRR_ESPE.h b/Marlin/src/pins/esp32/pins_MRR_ESPE.h index b59cc7bb39ba..f372de9e0110 100644 --- a/Marlin/src/pins/esp32/pins_MRR_ESPE.h +++ b/Marlin/src/pins/esp32/pins_MRR_ESPE.h @@ -52,11 +52,10 @@ // Enable I2S stepper stream // #define I2S_STEPPER_STREAM -#define I2S_WS 26 -#define I2S_BCK 25 -#define I2S_DATA 27 -#if ENABLED(LIN_ADVANCE) - #error "I2S stream is currently incompatible with LIN_ADVANCE." +#if ENABLED(I2S_STEPPER_STREAM) + #define I2S_WS 26 + #define I2S_BCK 25 + #define I2S_DATA 27 #endif // From ec7cc59818455af49b21651e6e0e9acf909e9864 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sun, 5 Jun 2022 00:25:04 +0000 Subject: [PATCH 146/241] [cron] Bump distribution date (2022-06-05) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index ea181fb3fdc2..bb97a637d21b 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-06-04" +//#define STRING_DISTRIBUTION_DATE "2022-06-05" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index bbe0a61bb887..7e4656b0b610 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-06-04" + #define STRING_DISTRIBUTION_DATE "2022-06-05" #endif /** From 41a9dea149902fd6525919a0163303a9b2f3be76 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 5 Jun 2022 20:25:58 -0500 Subject: [PATCH 147/241] =?UTF-8?q?=F0=9F=91=94=20Update=20Marlin=20action?= =?UTF-8?q?s=20for=202.1.x?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/bump-date.yml | 22 +++++++++++++++++++++- .github/workflows/check-pr.yml | 5 +++-- .github/workflows/test-builds.yml | 2 ++ buildroot/bin/use_example_configs | 4 +++- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/.github/workflows/bump-date.yml b/.github/workflows/bump-date.yml index d517d7d05ea3..51b58ad493f0 100644 --- a/.github/workflows/bump-date.yml +++ b/.github/workflows/bump-date.yml @@ -23,7 +23,27 @@ jobs: with: ref: bugfix-2.1.x - - name: Bump Distribution Date + - name: Bump Date (bugfix-2.0.x) + run: | + # Inline Bump Script + if [[ ! "$( git log -1 --pretty=%B )" =~ ^\[cron\] ]]; then + DIST=$( date +"%Y-%m-%d" ) + eval "sed -E -i 's/(#define +STRING_DISTRIBUTION_DATE) .*$/\1 \"$DIST\"/g' Marlin/src/inc/Version.h" && \ + eval "sed -E -i 's/(#define +STRING_DISTRIBUTION_DATE) .*$/\1 \"$DIST\"/g' Marlin/Version.h" && \ + git config user.name "${GITHUB_ACTOR}" && \ + git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" && \ + git add . && \ + git commit -m "[cron] Bump distribution date ($DIST)" && \ + git push + fi + exit 0 + + - name: Check out bugfix-2.1.x + uses: actions/checkout@v2 + with: + ref: bugfix-2.1.x + + - name: Bump Date (bugfix-2.1.x) run: | # Inline Bump Script if [[ ! "$( git log -1 --pretty=%B )" =~ ^\[cron\] ]]; then diff --git a/.github/workflows/check-pr.yml b/.github/workflows/check-pr.yml index fe64b833386f..79d0b5e2d041 100644 --- a/.github/workflows/check-pr.yml +++ b/.github/workflows/check-pr.yml @@ -12,6 +12,7 @@ on: - 1.0.x - 1.1.x - 2.0.x + - 2.1.x jobs: bad_target: @@ -26,8 +27,8 @@ jobs: comment: > Thanks for your contribution! Unfortunately we can't accept PRs directed at release branches. We make patches to the bugfix branches and only later do we push them out as releases. - Please redo this PR starting with the `bugfix-2.1.x` branch and be careful to target `bugfix-2.1.x` when resubmitting the PR. + Please redo this PR starting with the `bugfix-2.1.x` branch and be careful to target `bugfix-2.1.x` when resubmitting the PR. Patches may also target `bugfix-2.0.x` if they are specifically for 2.0.9.x. - It may help to set your fork's default branch to `bugfix-2.1.x`. + It may help to set your fork's default branch to `bugfix-2.0.x`. See [this page](http://marlinfw.org/docs/development/getting_started_pull_requests.html) for full instructions. diff --git a/.github/workflows/test-builds.yml b/.github/workflows/test-builds.yml index 2ad77003cc77..747095e07f96 100644 --- a/.github/workflows/test-builds.yml +++ b/.github/workflows/test-builds.yml @@ -8,6 +8,7 @@ name: CI on: pull_request: branches: + - bugfix-2.0.x - bugfix-2.1.x paths-ignore: - config/** @@ -16,6 +17,7 @@ on: - '**/*.md' push: branches: + - bugfix-2.0.x - bugfix-2.1.x paths-ignore: - config/** diff --git a/buildroot/bin/use_example_configs b/buildroot/bin/use_example_configs index d6b479e040e1..48e23b1695e3 100755 --- a/buildroot/bin/use_example_configs +++ b/buildroot/bin/use_example_configs @@ -1,8 +1,10 @@ #!/usr/bin/env bash +BRANCH=$(git branch 2>/dev/null | grep ^* | sed 's/\* //g') + IFS=: read -r PART1 PART2 <<< "$@" [ -n "${PART2}" ] && { REPO="$PART1" ; RDIR="${PART2// /%20}" ; } \ - || { REPO=bugfix-2.1.x ; RDIR="${PART1// /%20}" ; } + || { REPO=$BRANCH ; RDIR="${PART1// /%20}" ; } EXAMPLES="https://raw.githubusercontent.com/MarlinFirmware/Configurations/$REPO/config/examples" which curl >/dev/null && TOOL='curl -L -s -S -f -o wgot' From c9a9b25d41e7eb805c166e8a27cfa938b36bd2ba Mon Sep 17 00:00:00 2001 From: Miguel Risco-Castillo Date: Mon, 6 Jun 2022 00:01:06 -0500 Subject: [PATCH 148/241] =?UTF-8?q?=F0=9F=9A=B8=20ProUI=20G-code=20preview?= =?UTF-8?q?,=20PID=20plot=20(#24282)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/e3v2/proui/base64.hpp | 208 ++++++++++++++++ Marlin/src/lcd/e3v2/proui/dwin.cpp | 101 ++++++-- Marlin/src/lcd/e3v2/proui/dwin_defines.h | 2 + Marlin/src/lcd/e3v2/proui/gcode_preview.cpp | 253 ++++++++++++++++++++ Marlin/src/lcd/e3v2/proui/gcode_preview.h | 27 +++ Marlin/src/lcd/e3v2/proui/plot.cpp | 94 ++++++++ Marlin/src/lcd/e3v2/proui/plot.h | 54 +++++ Marlin/src/lcd/e3v2/proui/ubl_tools.cpp | 18 +- buildroot/tests/STM32F103RE_creality | 11 +- buildroot/tests/STM32F401RC_creality | 13 +- 10 files changed, 749 insertions(+), 32 deletions(-) create mode 100644 Marlin/src/lcd/e3v2/proui/base64.hpp create mode 100644 Marlin/src/lcd/e3v2/proui/gcode_preview.cpp create mode 100644 Marlin/src/lcd/e3v2/proui/gcode_preview.h create mode 100644 Marlin/src/lcd/e3v2/proui/plot.cpp create mode 100644 Marlin/src/lcd/e3v2/proui/plot.h diff --git a/Marlin/src/lcd/e3v2/proui/base64.hpp b/Marlin/src/lcd/e3v2/proui/base64.hpp new file mode 100644 index 000000000000..d82d0b27e8ac --- /dev/null +++ b/Marlin/src/lcd/e3v2/proui/base64.hpp @@ -0,0 +1,208 @@ +/** + * Base64 encoder/decoder for arduino repo + * Uses common web conventions - '+' for 62, '/' for 63, '=' for padding. + * Note that invalid base64 characters are interpreted as padding. + * Author: Densaugeo + * Maintainer: Densaugeo + * Version: 1.2.1.1 + * Changed unsigned int to uint16_t for use in the professional Ender 3V2/S1 firmware + * Url: https://www.arduino.cc/reference/en/libraries/base64/ + */ + +#ifndef BASE64_H_INCLUDED +#define BASE64_H_INCLUDED + +/* binary_to_base64: + * Description: + * Converts a single byte from a binary value to the corresponding base64 character + * Parameters: + * v - Byte to convert + * Returns: + * ascii code of base64 character. If byte is >= 64, then there is not corresponding base64 character + * and 255 is returned + */ +unsigned char binary_to_base64(unsigned char v); + +/* base64_to_binary: + * Description: + * Converts a single byte from a base64 character to the corresponding binary value + * Parameters: + * c - Base64 character (as ascii code) + * Returns: + * 6-bit binary value + */ +unsigned char base64_to_binary(unsigned char c); + +/* encode_base64_length: + * Description: + * Calculates length of base64 string needed for a given number of binary bytes + * Parameters: + * input_length - Amount of binary data in bytes + * Returns: + * Number of base64 characters needed to encode input_length bytes of binary data + */ +uint16_t encode_base64_length(uint16_t input_length); + +/* decode_base64_length: + * Description: + * Calculates number of bytes of binary data in a base64 string + * Variant that does not use input_length no longer used within library, retained for API compatibility + * Parameters: + * input - Base64-encoded null-terminated string + * input_length (optional) - Number of bytes to read from input pointer + * Returns: + * Number of bytes of binary data in input + */ +uint16_t decode_base64_length(unsigned char input[]); +uint16_t decode_base64_length(unsigned char input[], uint16_t input_length); + +/* encode_base64: + * Description: + * Converts an array of bytes to a base64 null-terminated string + * Parameters: + * input - Pointer to input data + * input_length - Number of bytes to read from input pointer + * output - Pointer to output string. Null terminator will be added automatically + * Returns: + * Length of encoded string in bytes (not including null terminator) + */ +uint16_t encode_base64(unsigned char input[], uint16_t input_length, unsigned char output[]); + +/* decode_base64: + * Description: + * Converts a base64 null-terminated string to an array of bytes + * Parameters: + * input - Pointer to input string + * input_length (optional) - Number of bytes to read from input pointer + * output - Pointer to output array + * Returns: + * Number of bytes in the decoded binary + */ +uint16_t decode_base64(unsigned char input[], unsigned char output[]); +uint16_t decode_base64(unsigned char input[], uint16_t input_length, unsigned char output[]); + +unsigned char binary_to_base64(unsigned char v) { + // Capital letters - 'A' is ascii 65 and base64 0 + if (v < 26) return v + 'A'; + + // Lowercase letters - 'a' is ascii 97 and base64 26 + if (v < 52) return v + 71; + + // Digits - '0' is ascii 48 and base64 52 + if (v < 62) return v - 4; + + // '+' is ascii 43 and base64 62 + if (v == 62) return '+'; + + // '/' is ascii 47 and base64 63 + if (v == 63) return '/'; + + return 64; +} + +unsigned char base64_to_binary(unsigned char c) { + // Capital letters - 'A' is ascii 65 and base64 0 + if ('A' <= c && c <= 'Z') return c - 'A'; + + // Lowercase letters - 'a' is ascii 97 and base64 26 + if ('a' <= c && c <= 'z') return c - 71; + + // Digits - '0' is ascii 48 and base64 52 + if ('0' <= c && c <= '9') return c + 4; + + // '+' is ascii 43 and base64 62 + if (c == '+') return 62; + + // '/' is ascii 47 and base64 63 + if (c == '/') return 63; + + return 255; +} + +uint16_t encode_base64_length(uint16_t input_length) { + return (input_length + 2)/3*4; +} + +uint16_t decode_base64_length(unsigned char input[]) { + return decode_base64_length(input, -1); +} + +uint16_t decode_base64_length(unsigned char input[], uint16_t input_length) { + unsigned char *start = input; + + while (base64_to_binary(input[0]) < 64 && (unsigned char)(input - start) < input_length) { + ++input; + } + + input_length = input - start; + return input_length/4*3 + (input_length % 4 ? input_length % 4 - 1 : 0); +} + +uint16_t encode_base64(unsigned char input[], uint16_t input_length, unsigned char output[]) { + uint16_t full_sets = input_length/3; + + // While there are still full sets of 24 bits... + for (uint16_t i = 0; i < full_sets; ++i) { + output[0] = binary_to_base64( input[0] >> 2); + output[1] = binary_to_base64((input[0] & 0x03) << 4 | input[1] >> 4); + output[2] = binary_to_base64((input[1] & 0x0F) << 2 | input[2] >> 6); + output[3] = binary_to_base64( input[2] & 0x3F); + + input += 3; + output += 4; + } + + switch(input_length % 3) { + case 0: + output[0] = '\0'; + break; + case 1: + output[0] = binary_to_base64( input[0] >> 2); + output[1] = binary_to_base64((input[0] & 0x03) << 4); + output[2] = '='; + output[3] = '='; + output[4] = '\0'; + break; + case 2: + output[0] = binary_to_base64( input[0] >> 2); + output[1] = binary_to_base64((input[0] & 0x03) << 4 | input[1] >> 4); + output[2] = binary_to_base64((input[1] & 0x0F) << 2); + output[3] = '='; + output[4] = '\0'; + break; + } + + return encode_base64_length(input_length); +} + +uint16_t decode_base64(unsigned char input[], unsigned char output[]) { + return decode_base64(input, -1, output); +} + +uint16_t decode_base64(unsigned char input[], uint16_t input_length, unsigned char output[]) { + uint16_t output_length = decode_base64_length(input, input_length); + + // While there are still full sets of 24 bits... + for (uint16_t i = 2; i < output_length; i += 3) { + output[0] = base64_to_binary(input[0]) << 2 | base64_to_binary(input[1]) >> 4; + output[1] = base64_to_binary(input[1]) << 4 | base64_to_binary(input[2]) >> 2; + output[2] = base64_to_binary(input[2]) << 6 | base64_to_binary(input[3]); + + input += 4; + output += 3; + } + + switch(output_length % 3) { + case 1: + output[0] = base64_to_binary(input[0]) << 2 | base64_to_binary(input[1]) >> 4; + break; + case 2: + output[0] = base64_to_binary(input[0]) << 2 | base64_to_binary(input[1]) >> 4; + output[1] = base64_to_binary(input[1]) << 4 | base64_to_binary(input[2]) >> 2; + break; + } + + return output_length; +} + +#endif // ifndef diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 8594a899f913..07b134471b58 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -129,6 +129,14 @@ #include "endstop_diag.h" #endif +#if HAS_PIDPLOT + #include "plot.h" +#endif + +#if HAS_GCODE_PREVIEW + #include "gcode_preview.h" +#endif + #if HAS_MESH #include "meshviewer.h" #endif @@ -705,13 +713,19 @@ void Draw_PrintDone() { Title.ShowCaption(GET_TEXT_F(MSG_PRINT_DONE)); DWINUI::ClearMainArea(); DWIN_Print_Header(nullptr); - Draw_Print_ProgressBar(); - Draw_Print_Labels(); - DWINUI::Draw_Icon(ICON_PrintTime, 15, 173); - DWINUI::Draw_Icon(ICON_RemainTime, 150, 171); - Draw_Print_ProgressElapsed(); - Draw_Print_ProgressRemain(); - DWINUI::Draw_Button(BTN_Continue, 86, 273); + if (sdprint && TERN0(HAS_GCODE_PREVIEW, Preview_Valid())) { + DWIN_ICON_Show(0, 0, 1, 21, 100, 0x00); + DWINUI::Draw_Button(BTN_Continue, 86, 300); + } + else { + Draw_Print_ProgressBar(); + Draw_Print_Labels(); + DWINUI::Draw_Icon(ICON_PrintTime, 15, 173); + DWINUI::Draw_Icon(ICON_RemainTime, 150, 171); + Draw_Print_ProgressElapsed(); + Draw_Print_ProgressRemain(); + DWINUI::Draw_Button(BTN_Continue, 86, 273); + } } void Goto_PrintDone() { @@ -1409,6 +1423,9 @@ void EachMomentUpdate() { #if HAS_ESDIAG if (checkkey == ESDiagProcess) ESDiag.Update(); #endif + #if HAS_PIDPLOT + if (checkkey == PidProcess) Plot.Update((HMI_value.pidresult == PID_EXTR_START) ? thermalManager.wholeDegHotend(0) : thermalManager.wholeDegBed()); + #endif } #if HAS_STATUS_MESSAGE_TIMEOUT @@ -1635,15 +1652,49 @@ void DWIN_LevelingDone() { #endif // PID process + +#if HAS_PIDPLOT + void DWIN_Draw_PIDPopup() { + frame_rect_t gfrm = {40, 180, DWIN_WIDTH - 80, 120}; + DWINUI::ClearMainArea(); + Draw_Popup_Bkgd(); + DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 100, GET_TEXT_F(MSG_PID_AUTOTUNE)); + DWINUI::Draw_String(HMI_data.PopupTxt_Color, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("PID target: Celsius")); + switch (HMI_value.pidresult) { + case PID_EXTR_START: + DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 120, F("for Nozzle is running.")); + Plot.Draw(gfrm, thermalManager.hotend_maxtemp[0], HMI_data.HotendPidT); + DWINUI::Draw_Int(HMI_data.PopupTxt_Color, 3, gfrm.x + 90, gfrm.y - DWINUI::fontHeight() - 4, HMI_data.HotendPidT); + break; + case PID_BED_START: + DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 120, F("for BED is running.")); + Plot.Draw(gfrm, BED_MAXTEMP, HMI_data.BedPidT); + DWINUI::Draw_Int(HMI_data.PopupTxt_Color, 3, gfrm.x + 90, gfrm.y - DWINUI::fontHeight() - 4, HMI_data.BedPidT); + break; + default: + break; + } + } +#endif + void DWIN_PidTuning(pidresult_t result) { + HMI_value.pidresult = result; switch (result) { case PID_BED_START: - HMI_SaveProcessID(NothingToDo); - DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), F("for BED is running.")); + HMI_SaveProcessID(PidProcess); + #if HAS_PIDPLOT + DWIN_Draw_PIDPopup(); + #else + DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), F("for BED is running.")); + #endif break; case PID_EXTR_START: - HMI_SaveProcessID(NothingToDo); - DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), F("for Nozzle is running.")); + HMI_SaveProcessID(PidProcess); + #if HAS_PIDPLOT + DWIN_Draw_PIDPopup(); + #else + DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), F("for Nozzle is running.")); + #endif break; case PID_BAD_EXTRUDER_NUM: checkkey = last_checkkey; @@ -1960,10 +2011,30 @@ void HMI_LockScreen() { } -void Goto_ConfirmToPrint() { - card.openAndPrintFile(card.filename); - DWIN_Print_Started(true); -} +#if HAS_GCODE_PREVIEW + + void onClick_ConfirmToPrint() { + if (HMI_flag.select_flag) { // Confirm + card.openAndPrintFile(card.filename); + return DWIN_Print_Started(true); + } + else { // Cancel + DWIN_ResetStatusLine(); + checkkey = SelectFile; + return Draw_Print_File_Menu(); + } + } + + void Goto_ConfirmToPrint() { + Goto_Popup(Preview_DrawFromSD, onClick_ConfirmToPrint); + } + +#else + void Goto_ConfirmToPrint() { + card.openAndPrintFile(card.filename); + DWIN_Print_Started(true); + } +#endif #if HAS_ESDIAG void Draw_EndStopDiag() { diff --git a/Marlin/src/lcd/e3v2/proui/dwin_defines.h b/Marlin/src/lcd/e3v2/proui/dwin_defines.h index 3ab2d23696c5..1517acd238d0 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_defines.h +++ b/Marlin/src/lcd/e3v2/proui/dwin_defines.h @@ -35,6 +35,8 @@ #include #define HAS_ESDIAG 1 +#define HAS_PIDPLOT 1 +#define HAS_GCODE_PREVIEW 1 #if defined(__STM32F1__) || defined(STM32F1) #define DASH_REDRAW 1 #endif diff --git a/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp b/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp new file mode 100644 index 000000000000..951f469e1c60 --- /dev/null +++ b/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp @@ -0,0 +1,253 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * DWIN g-code thumbnail preview + * Author: Miguel A. Risco-Castillo + * version: 2.1 + * Date: 2021/06/19 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * For commercial applications additional licenses can be requested + */ + +#include "dwin_defines.h" + +#if HAS_GCODE_PREVIEW + +#include "../../../core/types.h" +#include "../../marlinui.h" +#include "../../../sd/cardreader.h" +#include "dwin_lcd.h" +#include "dwinui.h" +#include "dwin.h" +#include "dwin_popup.h" +#include "base64.hpp" +#include "gcode_preview.h" + +typedef struct { + char name[13] = ""; //8.3 + null + uint32_t thumbstart = 0; + int thumbsize = 0; + int thumbheight = 0; + int thumbwidth = 0; + uint8_t *thumbdata = nullptr; + float time = 0; + float filament = 0; + float layer = 0; + float width = 0; + float height = 0; + float length = 0; + void setname(const char * const fn); + void clear(); +} fileprop_t; +fileprop_t fileprop; + +void fileprop_t::setname(const char * const fn) { + const uint8_t len = _MIN(sizeof(name) - 1, strlen(fn)); + memcpy(&name[0], fn, len); + name[len] = '\0'; +} + +void fileprop_t::clear() { + fileprop.name[0] = '\0'; + fileprop.thumbstart = 0; + fileprop.thumbsize = 0; + fileprop.thumbheight = 0; + fileprop.thumbwidth = 0; + fileprop.thumbdata = nullptr; + fileprop.time = 0; + fileprop.filament = 0; + fileprop.layer = 0; + fileprop.height = 0; + fileprop.width = 0; + fileprop.length = 0; +} + +void Get_Value(char *buf, const char * const key, float &value) { + char num[10] = ""; + char * posptr = 0; + uint8_t i = 0; + if (!!value) return; + posptr = strstr(buf, key); + if (posptr != nullptr) { + while (i < sizeof(num)) { + char c = posptr[0]; + if (!ISEOL(c) && (c != 0)) { + if ((c > 47 && c < 58) || (c == '.')) num[i++] = c; + posptr++; + } + else { + num[i] = '\0'; + value = atof(num); + return; + } + } + } +} + +bool Has_Preview() { + const char * tbstart = "; thumbnail begin 230x180"; + char * posptr = 0; + uint8_t nbyte = 1; + uint32_t indx = 0; + char buf[256]; + float tmp = 0; + + fileprop.clear(); + fileprop.setname(card.filename); + + card.openFileRead(fileprop.name); + + while ((nbyte > 0) && (indx < 4 * sizeof(buf)) && !fileprop.thumbstart) { + nbyte = card.read(buf, sizeof(buf) - 1); + if (nbyte > 0) { + buf[nbyte] = '\0'; + Get_Value(buf, ";TIME:", fileprop.time); + Get_Value(buf, ";Filament used:", fileprop.filament); + Get_Value(buf, ";Layer height:", fileprop.layer); + Get_Value(buf, ";MINX:", tmp); + Get_Value(buf, ";MAXX:", fileprop.width); + fileprop.width -= tmp; + tmp = 0; + Get_Value(buf, ";MINY:", tmp); + Get_Value(buf, ";MAXY:", fileprop.length); + fileprop.length -= tmp; + tmp = 0; + Get_Value(buf, ";MINZ:", tmp); + Get_Value(buf, ";MAXZ:", fileprop.height); + fileprop.height -= tmp; + posptr = strstr(buf, tbstart); + if (posptr != NULL) { + fileprop.thumbstart = indx + (posptr - &buf[0]); + } + else { + indx += _MAX(10, nbyte - (signed)strlen(tbstart)); + card.setIndex(indx); + } + } + } + + if (!fileprop.thumbstart) { + card.closefile(); + LCD_MESSAGE_F("Thumbnail not found"); + return 0; + } + + // Get the size of the thumbnail + card.setIndex(fileprop.thumbstart + strlen(tbstart)); + for (uint8_t i = 0; i < 16; i++) { + char c = card.get(); + if (!ISEOL(c)) { + buf[i] = c; + } + else { + buf[i] = 0; + break; + } + } + fileprop.thumbsize = atoi(buf); + + // Exit if there isn't a thumbnail + if (!fileprop.thumbsize) { + card.closefile(); + LCD_MESSAGE_F("Invalid Thumbnail Size"); + return 0; + } + + uint16_t readed = 0; + uint8_t buf64[fileprop.thumbsize]; + + fileprop.thumbdata = new uint8_t[3 + 3 * (fileprop.thumbsize / 4)]; // Reserve space for the JPEG thumbnail + + while (readed < fileprop.thumbsize) { + uint8_t c = card.get(); + if (!ISEOL(c) && (c != ';') && (c != ' ')) { + buf64[readed] = c; + readed++; + } + } + card.closefile(); + buf64[readed] = 0; + + fileprop.thumbsize = decode_base64(buf64, fileprop.thumbdata); card.closefile(); + DWINUI::WriteToSRAM(0x00, fileprop.thumbsize, fileprop.thumbdata); + delete[] fileprop.thumbdata; + return true; +} + +void Preview_DrawFromSD() { + if (Has_Preview()) { + char buf[46]; + char str_1[6] = ""; + char str_2[6] = ""; + char str_3[6] = ""; + DWIN_Draw_Rectangle(1, HMI_data.Background_Color, 0, 0, DWIN_WIDTH, STATUS_Y - 1); + if (fileprop.time) { + sprintf_P(buf, PSTR("Estimated time: %i:%02i"), (uint16_t)fileprop.time / 3600, ((uint16_t)fileprop.time % 3600) / 60); + DWINUI::Draw_String(20, 10, buf); + } + if (fileprop.filament) { + sprintf_P(buf, PSTR("Filament used: %s m"), dtostrf(fileprop.filament, 1, 2, str_1)); + DWINUI::Draw_String(20, 30, buf); + } + if (fileprop.layer) { + sprintf_P(buf, PSTR("Layer height: %s mm"), dtostrf(fileprop.layer, 1, 2, str_1)); + DWINUI::Draw_String(20, 50, buf); + } + if (fileprop.width) { + sprintf_P(buf, PSTR("Volume: %sx%sx%s mm"), dtostrf(fileprop.width, 1, 1, str_1), dtostrf(fileprop.length, 1, 1, str_2), dtostrf(fileprop.height, 1, 1, str_3)); + DWINUI::Draw_String(20, 70, buf); + } + DWINUI::Draw_Button(BTN_Print, 26, 290); + DWINUI::Draw_Button(BTN_Cancel, 146, 290); + DWIN_ICON_Show(0, 0, 1, 21, 90, 0x00); + Draw_Select_Highlight(true, 290); + DWIN_UpdateLCD(); + } + else { + HMI_flag.select_flag = 1; + wait_for_user = false; + } +} + +bool Preview_Valid() { + return !!fileprop.thumbstart; +} + +void Preview_Reset() { + fileprop.thumbsize = 0; +} + +#endif // HAS_GCODE_PREVIEW diff --git a/Marlin/src/lcd/e3v2/proui/gcode_preview.h b/Marlin/src/lcd/e3v2/proui/gcode_preview.h new file mode 100644 index 000000000000..4417084a242d --- /dev/null +++ b/Marlin/src/lcd/e3v2/proui/gcode_preview.h @@ -0,0 +1,27 @@ +/** + * DWIN g-code thumbnail preview + * Author: Miguel A. Risco-Castillo + * version: 2.1 + * Date: 2021/06/19 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * For commercial applications additional licenses can be requested + */ + +#pragma once + +void Preview_DrawFromSD(); +bool Preview_Valid(); +void Preview_Reset(); diff --git a/Marlin/src/lcd/e3v2/proui/plot.cpp b/Marlin/src/lcd/e3v2/proui/plot.cpp new file mode 100644 index 000000000000..ebc685fa2453 --- /dev/null +++ b/Marlin/src/lcd/e3v2/proui/plot.cpp @@ -0,0 +1,94 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * DWIN Single var plot + * Author: Miguel A. Risco-Castillo + * Version: 2.0 + * Date: 2022/01/31 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * For commercial applications additional licenses can be requested + */ + +#include "../../../inc/MarlinConfigPre.h" + +#ifdef DWIN_LCD_PROUI + +#include "plot.h" + +#include "../../../core/types.h" +#include "../../marlinui.h" +#include "dwin_lcd.h" +#include "dwinui.h" +#include "dwin_popup.h" +#include "dwin.h" + +#define Plot_Bg_Color RGB( 1, 12, 8) + +PlotClass Plot; + +uint16_t grphpoints, r, x2, y2 = 0; +frame_rect_t grphframe = {0}; +float scale = 0; + +void PlotClass::Draw(const frame_rect_t frame, const float max, const float ref) { + grphframe = frame; + grphpoints = 0; + scale = frame.h / max; + x2 = frame.x + frame.w - 1; + y2 = frame.y + frame.h - 1; + r = round((y2) - ref * scale); + DWINUI::Draw_Box(1, Plot_Bg_Color, frame); + for (uint8_t i = 1; i < 4; i++) if (i*50 < frame.w) DWIN_Draw_VLine(Line_Color, i*50 + frame.x, frame.y, frame.h); + DWINUI::Draw_Box(0, Color_White, DWINUI::ExtendFrame(frame, 1)); + DWIN_Draw_HLine(Color_Red, frame.x, r, frame.w); +} + +void PlotClass::Update(const float value) { + if (!scale) return; + uint16_t y = round((y2) - value * scale); + if (grphpoints < grphframe.w) { + DWIN_Draw_Point(Color_Yellow, 1, 1, grphpoints + grphframe.x, y); + } + else { + DWIN_Frame_AreaMove(1, 0, 1, Plot_Bg_Color, grphframe.x, grphframe.y, x2, y2); + if ((grphpoints % 50) == 0) DWIN_Draw_VLine(Line_Color, x2 - 1, grphframe.y + 1, grphframe.h - 2); + DWIN_Draw_Point(Color_Red, 1, 1, x2 - 1, r); + DWIN_Draw_Point(Color_Yellow, 1, 1, x2 - 1, y); + } + grphpoints++; +} + +#endif // DWIN_LCD_PROUI diff --git a/Marlin/src/lcd/e3v2/proui/plot.h b/Marlin/src/lcd/e3v2/proui/plot.h new file mode 100644 index 000000000000..8522c530bd3f --- /dev/null +++ b/Marlin/src/lcd/e3v2/proui/plot.h @@ -0,0 +1,54 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * DWIN Single var plot + * Author: Miguel A. Risco-Castillo + * Version: 1.0 + * Date: 2022/01/30 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * For commercial applications additional licenses can be requested + */ +#pragma once + +#include "dwinui.h" + +class PlotClass { +public: + void Draw(frame_rect_t frame, float max, float ref = 0); + void Update(float value); +}; + +extern PlotClass Plot; diff --git a/Marlin/src/lcd/e3v2/proui/ubl_tools.cpp b/Marlin/src/lcd/e3v2/proui/ubl_tools.cpp index 45cb05266828..87909d2dd2a2 100644 --- a/Marlin/src/lcd/e3v2/proui/ubl_tools.cpp +++ b/Marlin/src/lcd/e3v2/proui/ubl_tools.cpp @@ -1,10 +1,9 @@ /** - * UBL Tools and Mesh Viewer for Pro UI - * Version: 1.0.0 - * Date: 2022/04/13 + * Marlin 3D Printer Firmware + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * - * Original Author: Henri-J-Norden - * Original Source: https://github.com/Jyers/Marlin/pull/126 + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,6 +20,15 @@ * */ +/** + * UBL Tools and Mesh Viewer for Pro UI + * Version: 1.0.0 + * Date: 2022/04/13 + * + * Original Author: Henri-J-Norden + * Original Source: https://github.com/Jyers/Marlin/pull/126 + */ + #include "../../../inc/MarlinConfigPre.h" #if BOTH(DWIN_LCD_PROUI, AUTO_BED_LEVELING_UBL) diff --git a/buildroot/tests/STM32F103RE_creality b/buildroot/tests/STM32F103RE_creality index a5d2899dd565..5e6d5f044ac3 100755 --- a/buildroot/tests/STM32F103RE_creality +++ b/buildroot/tests/STM32F103RE_creality @@ -18,9 +18,14 @@ opt_disable DWIN_CREALITY_LCD opt_enable DWIN_CREALITY_LCD_JYERSUI AUTO_BED_LEVELING_BILINEAR PROBE_MANUALLY exec_test $1 $2 "Ender 3 v2 with JyersUI" "$3" -use_example_configs "Creality/Ender-3 V2/CrealityV422/MarlinUI" -opt_add SDCARD_EEPROM_EMULATION AUTO_BED_LEVELING_BILINEAR Z_SAFE_HOMING -exec_test $1 $2 "Ender 3 v2 with MarlinUI" "$3" +use_example_configs "Creality/Ender-3 S1" +opt_disable DWIN_CREALITY_LCD Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN AUTO_BED_LEVELING_BILINEAR CONFIGURATION_EMBEDDING CANCEL_OBJECTS FWRETRACT +opt_enable DWIN_LCD_PROUI INDIVIDUAL_AXIS_HOMING_SUBMENU LCD_SET_PROGRESS_MANUALLY STATUS_MESSAGE_SCROLLING \ + SOUND_MENU_ITEM PRINTCOUNTER NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE FILAMENT_RUNOUT_SENSOR \ + BLTOUCH Z_SAFE_HOMING AUTO_BED_LEVELING_UBL MESH_EDIT_MENU \ + LIMITED_MAX_FR_EDITING LIMITED_MAX_ACCEL_EDITING LIMITED_JERK_EDITING BAUD_RATE_GCODE +opt_set PREHEAT_3_LABEL '"CUSTOM"' PREHEAT_3_TEMP_HOTEND 240 PREHEAT_3_TEMP_BED 60 PREHEAT_3_FAN_SPEED 128 +exec_test $1 $2 "Ender-3 S1 with ProUI" "$3" restore_configs opt_set MOTHERBOARD BOARD_CREALITY_V452 SERIAL_PORT 1 diff --git a/buildroot/tests/STM32F401RC_creality b/buildroot/tests/STM32F401RC_creality index c7cd464df066..380711d061c2 100755 --- a/buildroot/tests/STM32F401RC_creality +++ b/buildroot/tests/STM32F401RC_creality @@ -6,15 +6,10 @@ # exit on first failure set -e -use_example_configs "Creality/Ender-3 S1" -opt_disable DWIN_CREALITY_LCD Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN AUTO_BED_LEVELING_BILINEAR CONFIGURATION_EMBEDDING CANCEL_OBJECTS FWRETRACT -opt_enable DWIN_LCD_PROUI INDIVIDUAL_AXIS_HOMING_SUBMENU LCD_SET_PROGRESS_MANUALLY STATUS_MESSAGE_SCROLLING \ - SOUND_MENU_ITEM PRINTCOUNTER NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE FILAMENT_RUNOUT_SENSOR \ - BLTOUCH Z_SAFE_HOMING AUTO_BED_LEVELING_UBL MESH_EDIT_MENU \ - LIMITED_MAX_FR_EDITING LIMITED_MAX_ACCEL_EDITING LIMITED_JERK_EDITING BAUD_RATE_GCODE -opt_set MOTHERBOARD BOARD_CREALITY_V24S1_301F4 \ - PREHEAT_3_LABEL '"CUSTOM"' PREHEAT_3_TEMP_HOTEND 240 PREHEAT_3_TEMP_BED 60 PREHEAT_3_FAN_SPEED 128 -exec_test $1 $2 "Ender-3 S1 with ProUI" "$3" +use_example_configs "Creality/Ender-3 V2/CrealityV422/MarlinUI" +opt_add SDCARD_EEPROM_EMULATION AUTO_BED_LEVELING_BILINEAR Z_SAFE_HOMING +opt_set MOTHERBOARD BOARD_CREALITY_V24S1_301F4 +exec_test $1 $2 "Ender 3 v2 with MarlinUI" "$3" # clean up restore_configs From a7a730f81190991b377296f4f95771b33548da5d Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Mon, 6 Jun 2022 06:06:26 +0000 Subject: [PATCH 149/241] [cron] Bump distribution date (2022-06-06) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index bb97a637d21b..d056fcefbe51 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-06-05" +//#define STRING_DISTRIBUTION_DATE "2022-06-06" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 7e4656b0b610..3ea332abbc3d 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-06-05" + #define STRING_DISTRIBUTION_DATE "2022-06-06" #endif /** From d355ad04a01b33ea64324d718ac2f0d807631acc Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 6 Jun 2022 19:06:03 -0500 Subject: [PATCH 150/241] =?UTF-8?q?=F0=9F=91=94=20Fix=20and=20comment=20us?= =?UTF-8?q?e=5Fexample=5Fconfigs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/bin/use_example_configs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/buildroot/bin/use_example_configs b/buildroot/bin/use_example_configs index 48e23b1695e3..bfd4aa612f0e 100755 --- a/buildroot/bin/use_example_configs +++ b/buildroot/bin/use_example_configs @@ -1,10 +1,20 @@ #!/usr/bin/env bash +# +# use_example_configs [repo:]configpath +# +# Examples: +# use_example_configs Creality/CR-10/CrealityV1 +# use_example_configs release-2.0.9.4:Creality/CR-10/CrealityV1 +# +# If a configpath has spaces (or quotes) escape them or enquote the path +# -BRANCH=$(git branch 2>/dev/null | grep ^* | sed 's/\* //g') +CURR=$(git branch 2>/dev/null | grep ^* | sed 's/\* //g') +[[ $CURR == "bugfix-2.0.x" ]] && BRANCH=bugfix-2.0.x || BRANCH=bugfix-2.1.x IFS=: read -r PART1 PART2 <<< "$@" -[ -n "${PART2}" ] && { REPO="$PART1" ; RDIR="${PART2// /%20}" ; } \ - || { REPO=$BRANCH ; RDIR="${PART1// /%20}" ; } +[[ -n $PART2 ]] && { REPO="$PART1" ; RDIR="${PART2// /%20}" ; } \ + || { REPO=$BRANCH ; RDIR="${PART1// /%20}" ; } EXAMPLES="https://raw.githubusercontent.com/MarlinFirmware/Configurations/$REPO/config/examples" which curl >/dev/null && TOOL='curl -L -s -S -f -o wgot' @@ -14,6 +24,8 @@ restore_configs cd Marlin +echo "Fetching $RDIR configurations from $REPO..." + $TOOL "$EXAMPLES/$RDIR/Configuration.h" >/dev/null 2>&1 && mv wgot Configuration.h $TOOL "$EXAMPLES/$RDIR/Configuration_adv.h" >/dev/null 2>&1 && mv wgot Configuration_adv.h $TOOL "$EXAMPLES/$RDIR/_Bootscreen.h" >/dev/null 2>&1 && mv wgot _Bootscreen.h From 3b142e531ce6dcd15e5a32cc94bd6c4d5fa8fb46 Mon Sep 17 00:00:00 2001 From: lujios <83166168+lujios@users.noreply.github.com> Date: Tue, 7 Jun 2022 02:22:17 +0200 Subject: [PATCH 151/241] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20G33=20Delta=20Sens?= =?UTF-8?q?orless=20Probing=20compile=20(#24291)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/calibrate/G33.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/gcode/calibrate/G33.cpp b/Marlin/src/gcode/calibrate/G33.cpp index 810fb734dc68..ffe53b63fbef 100644 --- a/Marlin/src/gcode/calibrate/G33.cpp +++ b/Marlin/src/gcode/calibrate/G33.cpp @@ -437,7 +437,7 @@ void GcodeSuite::G33() { const bool stow_after_each = parser.seen_test('E'); #if HAS_DELTA_SENSORLESS_PROBING - probe.test_sensitivity.set(!parser.seen_test('X'), !parser.seen_test('Y'), !parser.seen_test('Z')); + probe.test_sensitivity = { !parser.seen_test('X'), !parser.seen_test('Y'), !parser.seen_test('Z') }; const bool do_save_offset_adj = parser.seen_test('S'); #endif From f6e123430f189128c00ff2f6e4fa6c3a27986bff Mon Sep 17 00:00:00 2001 From: tombrazier <68918209+tombrazier@users.noreply.github.com> Date: Tue, 7 Jun 2022 01:23:55 +0100 Subject: [PATCH 152/241] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20Mesh=20Leveling=20?= =?UTF-8?q?+=20Debug=20compile=20(#24297)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/utility.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Marlin/src/core/utility.cpp b/Marlin/src/core/utility.cpp index bba2f0a986a1..84e4c1f69696 100644 --- a/Marlin/src/core/utility.cpp +++ b/Marlin/src/core/utility.cpp @@ -132,11 +132,10 @@ void safe_delay(millis_t ms) { #else #if ENABLED(AUTO_BED_LEVELING_UBL) SERIAL_ECHOPGM("UBL Adjustment Z"); - const float rz = bedlevel.get_z_correction(current_position); #elif ENABLED(AUTO_BED_LEVELING_BILINEAR) SERIAL_ECHOPGM("ABL Adjustment Z"); - const float rz = bedlevel.get_z_correction(current_position); #endif + const float rz = bedlevel.get_z_correction(current_position); SERIAL_ECHO(ftostr43sign(rz, '+')); #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) if (planner.z_fade_height) { @@ -156,11 +155,13 @@ void safe_delay(millis_t ms) { SERIAL_ECHOPGM("Mesh Bed Leveling"); if (planner.leveling_active) { SERIAL_ECHOLNPGM(" (enabled)"); - SERIAL_ECHOPGM("MBL Adjustment Z", ftostr43sign(bedlevel.get_z(current_position), '+')); + const float z_offset = bedlevel.get_z_offset(), + z_correction = bedlevel.get_z_correction(current_position); + SERIAL_ECHOPGM("MBL Adjustment Z", ftostr43sign(z_offset + z_correction, '+')); #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) if (planner.z_fade_height) { SERIAL_ECHOPGM(" (", ftostr43sign( - bedlevel.get_z(current_position, planner.fade_scaling_factor_for_z(current_position.z)), '+' + z_offset + z_correction * planner.fade_scaling_factor_for_z(current_position.z), '+' )); SERIAL_CHAR(')'); } From 371ac49fc137fbae6bf58491e274d1099ddafa34 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 7 Jun 2022 00:30:16 +0000 Subject: [PATCH 153/241] [cron] Bump distribution date (2022-06-07) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index d056fcefbe51..6a57f890a203 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-06-06" +//#define STRING_DISTRIBUTION_DATE "2022-06-07" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 3ea332abbc3d..a6e2b323691c 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-06-06" + #define STRING_DISTRIBUTION_DATE "2022-06-07" #endif /** From 9e73fd714971b525c47a5fbc896c927fa1659978 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 6 Jun 2022 23:38:06 -0500 Subject: [PATCH 154/241] =?UTF-8?q?=F0=9F=91=94=20Update=20mfconfig=20impo?= =?UTF-8?q?rt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/share/git/mfconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildroot/share/git/mfconfig b/buildroot/share/git/mfconfig index dbef1990a155..7092bc822002 100755 --- a/buildroot/share/git/mfconfig +++ b/buildroot/share/git/mfconfig @@ -34,7 +34,7 @@ COMMIT_STEPS=0 #cd "$CONFIGREPO" 2>/dev/null || { echo "Can't find Configurations repo!" ; exit 1; } ACTION=${1:-init} -IMPORT=${2:-"import-2.0.x"} +IMPORT=${2:-"import-2.1.x"} EXPORT=${3:-"bugfix-2.1.x"} echo -n "Doing grhh ... " ; grhh ; echo From 3e9fb34892e85bc4069acf5baddbf12d6cd47789 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Tue, 7 Jun 2022 18:59:21 +1200 Subject: [PATCH 155/241] =?UTF-8?q?=F0=9F=A9=B9=20Media=20Change=20followu?= =?UTF-8?q?p=20(#24302)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #24015 --- Marlin/src/HAL/SAMD51/HAL.cpp | 2 +- Marlin/src/inc/Conditionals_post.h | 32 ++++++++++++------- Marlin/src/inc/SanityCheck.h | 3 +- .../anycubic_i3mega/anycubic_i3mega_lcd.cpp | 4 +-- .../lcd/extui/dgus_reloaded/DGUSRxHandler.cpp | 4 +-- .../extui/mks_ui/tft_lvgl_configuration.cpp | 3 +- Marlin/src/lcd/marlinui.cpp | 2 +- Marlin/src/lcd/menu/menu_main.cpp | 4 +-- Marlin/src/lcd/menu/menu_media.cpp | 2 +- Marlin/src/sd/cardreader.cpp | 19 +++++------ Marlin/src/sd/cardreader.h | 2 +- 11 files changed, 42 insertions(+), 35 deletions(-) diff --git a/Marlin/src/HAL/SAMD51/HAL.cpp b/Marlin/src/HAL/SAMD51/HAL.cpp index 648e0a4f144b..bd1c98bfa1d9 100644 --- a/Marlin/src/HAL/SAMD51/HAL.cpp +++ b/Marlin/src/HAL/SAMD51/HAL.cpp @@ -598,7 +598,7 @@ void MarlinHAL::dma_init() { void MarlinHAL::init() { TERN_(DMA_IS_REQUIRED, dma_init()); #if ENABLED(SDSUPPORT) - #if SD_CONNECTION_IS(ONBOARD) && PIN_EXISTS(SD_DETECT) + #if HAS_SD_DETECT && SD_CONNECTION_IS(ONBOARD) SET_INPUT_PULLUP(SD_DETECT_PIN); #endif OUT_WRITE(SDSS, HIGH); // Try to set SDSS inactive before any other SPI users start up diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 98f5ed3f48cf..9edcd6f1aa9a 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -517,20 +517,28 @@ #define HAS_SHARED_MEDIA 1 #endif - // Set SD_DETECT_STATE based on hardware if not overridden - #if PIN_EXISTS(SD_DETECT) && !defined(SD_DETECT_STATE) - #if BOTH(HAS_MARLINUI_MENU, ELB_FULL_GRAPHIC_CONTROLLER) && (SD_CONNECTION_IS(LCD) || !defined(SDCARD_CONNECTION)) - #define SD_DETECT_STATE HIGH - #else - #define SD_DETECT_STATE LOW - #endif - #endif - // Extender cable doesn't support SD_DETECT_PIN #if ENABLED(NO_SD_DETECT) #undef SD_DETECT_PIN #endif + // Not onboard or custom cable + #if SD_CONNECTION_IS(LCD) || !defined(SDCARD_CONNECTION) + #define SD_CONNECTION_TYPICAL 1 + #endif + + // Set SD_DETECT_STATE based on hardware if not overridden + #if PIN_EXISTS(SD_DETECT) + #define HAS_SD_DETECT 1 + #ifndef SD_DETECT_STATE + #if ALL(SD_CONNECTION_TYPICAL, HAS_MARLINUI_MENU, ELB_FULL_GRAPHIC_CONTROLLER) + #define SD_DETECT_STATE HIGH + #else + #define SD_DETECT_STATE LOW + #endif + #endif + #endif + #if DISABLED(USB_FLASH_DRIVE_SUPPORT) || BOTH(MULTI_VOLUME, VOLUME_SD_ONBOARD) #if ENABLED(SDIO_SUPPORT) #define NEED_SD2CARD_SDIO 1 @@ -539,10 +547,10 @@ #endif #endif -#endif + #if HAS_SD_DETECT && NONE(HAS_GRAPHICAL_TFT, LCD_USE_DMA_FSMC, HAS_FSMC_GRAPHICAL_TFT, HAS_SPI_GRAPHICAL_TFT, IS_DWIN_MARLINUI, EXTENSIBLE_UI, HAS_DWIN_E3V2) + #define REINIT_NOISY_LCD 1 // Have the LCD re-init on SD insertion + #endif -#if PIN_EXISTS(SD_DETECT) && NONE(HAS_GRAPHICAL_TFT, LCD_USE_DMA_FSMC, HAS_FSMC_GRAPHICAL_TFT, HAS_SPI_GRAPHICAL_TFT, IS_DWIN_MARLINUI, EXTENSIBLE_UI, HAS_DWIN_E3V2) - #define REINIT_NOISY_LCD 1 // Have the LCD re-init on SD insertion #endif /** diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 8cb87ca8bc80..90516c932d9d 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -893,9 +893,10 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS /** * SD Card Settings */ -#if ALL(SDSUPPORT, ELB_FULL_GRAPHIC_CONTROLLER, HAS_MARLINUI_MENU) && PIN_EXISTS(SD_DETECT) && SD_DETECT_STATE != HIGH && (SD_CONNECTION_IS(LCD) || !defined(SDCARD_CONNECTION)) +#if ALL(SDSUPPORT, HAS_SD_DETECT, SD_CONNECTION_TYPICAL, ELB_FULL_GRAPHIC_CONTROLLER, HAS_MARLINUI_MENU) && SD_DETECT_STATE == LOW #error "SD_DETECT_STATE must be set HIGH for SD on the ELB_FULL_GRAPHIC_CONTROLLER." #endif +#undef SD_CONNECTION_TYPICAL /** * SD File Sorting diff --git a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp index c382af3fe2e5..0da8bb36a780 100644 --- a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp +++ b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp @@ -86,7 +86,7 @@ void AnycubicTFTClass::OnSetup() { delay_ms(10); // Init the state of the key pins running on the TFT - #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) + #if BOTH(SDSUPPORT, HAS_SD_DETECT) SET_INPUT_PULLUP(SD_DETECT_PIN); #endif #if ENABLED(FILAMENT_RUNOUT_SENSOR) @@ -916,7 +916,7 @@ void AnycubicTFTClass::GetCommandFromTFT() { } void AnycubicTFTClass::DoSDCardStateCheck() { - #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) + #if BOTH(SDSUPPORT, HAS_SD_DETECT) bool isInserted = isMediaInserted(); if (isInserted) SENDLINE_DBG_PGM("J00", "TFT Serial Debug: SD card state changed... isInserted"); diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp index cef9c772e9df..88fe30a0273f 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp @@ -47,9 +47,7 @@ void DGUSRxHandler::ScreenChange(DGUS_VP &vp, void *data_ptr) { if (vp.addr == DGUS_Addr::SCREENCHANGE_SD) { #if ENABLED(SDSUPPORT) - #if !PIN_EXISTS(SD_DETECT) - card.mount(); - #endif + IF_DISABLED(HAS_SD_DETECT, card.mount()); if (!ExtUI::isMediaInserted()) { dgus_screen_handler.SetStatusMessage(GET_TEXT_F(MSG_NO_MEDIA)); diff --git a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp index 378521031509..38612358110b 100644 --- a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp +++ b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp @@ -137,8 +137,7 @@ void tft_lvgl_init() { uint16_t usb_flash_loop = 1000; #if ENABLED(MULTI_VOLUME) && !HAS_SD_HOST_DRIVE SET_INPUT_PULLUP(SD_DETECT_PIN); - if (READ(SD_DETECT_PIN) == LOW) card.changeMedia(&card.media_driver_sdcard); - else card.changeMedia(&card.media_driver_usbFlash); + card.changeMedia(IS_SD_INSERTED() ? &card.media_driver_sdcard : &card.media_driver_usbFlash); #endif do { card.media_driver_usbFlash.idle(); diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 8958de657ca0..3976c48dc76b 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -1756,7 +1756,7 @@ void MarlinUI::init() { if (old_status < 2) { #if ENABLED(EXTENSIBLE_UI) ExtUI::onMediaRemoved(); - #elif PIN_EXISTS(SD_DETECT) + #elif HAS_SD_DETECT LCD_MESSAGE(MSG_MEDIA_REMOVED); #if HAS_MARLINUI_MENU if (!defer_return_to_status) return_to_status(); diff --git a/Marlin/src/lcd/menu/menu_main.cpp b/Marlin/src/lcd/menu/menu_main.cpp index fdedddb6ddda..518f1e0f502d 100644 --- a/Marlin/src/lcd/menu/menu_main.cpp +++ b/Marlin/src/lcd/menu/menu_main.cpp @@ -246,7 +246,7 @@ void menu_main() { if (card_detected) { if (!card_open) { - #if PIN_EXISTS(SD_DETECT) + #if HAS_SD_DETECT GCODES_ITEM(MSG_CHANGE_MEDIA, F("M21")); // M21 Change Media #else // - or - ACTION_ITEM(MSG_RELEASE_MEDIA, []{ // M22 Release Media @@ -262,7 +262,7 @@ void menu_main() { } } else { - #if PIN_EXISTS(SD_DETECT) + #if HAS_SD_DETECT ACTION_ITEM(MSG_NO_MEDIA, nullptr); // "No Media" #else GCODES_ITEM(MSG_ATTACH_MEDIA, F("M21")); // M21 Attach Media diff --git a/Marlin/src/lcd/menu/menu_media.cpp b/Marlin/src/lcd/menu/menu_media.cpp index e979f04e119d..20ef6e3d198f 100644 --- a/Marlin/src/lcd/menu/menu_media.cpp +++ b/Marlin/src/lcd/menu/menu_media.cpp @@ -122,7 +122,7 @@ void menu_media_filelist() { BACK_ITEM_F(TERN1(BROWSE_MEDIA_ON_INSERT, screen_history_depth) ? GET_TEXT_F(MSG_MAIN) : GET_TEXT_F(MSG_BACK)); #endif if (card.flag.workDirIsRoot) { - #if !PIN_EXISTS(SD_DETECT) + #if !HAS_SD_DETECT ACTION_ITEM(MSG_REFRESH, []{ encoderTopLine = 0; card.mount(); }); #endif } diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index 0aa06e47c9f4..5e03795692da 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -171,7 +171,7 @@ CardReader::CardReader() { workDirDepth = 0; ZERO(workDirParents); - #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) + #if BOTH(SDSUPPORT, HAS_SD_DETECT) SET_INPUT_PULLUP(SD_DETECT_PIN); #endif @@ -456,10 +456,11 @@ void CardReader::mount() { if (flag.mounted) cdroot(); - #if ENABLED(USB_FLASH_DRIVE_SUPPORT) || PIN_EXISTS(SD_DETECT) - else if (marlin_state != MF_INITIALIZING) - LCD_ALERTMESSAGE(MSG_MEDIA_INIT_FAIL); - #endif + else { + #if EITHER(HAS_SD_DETECT, USB_FLASH_DRIVE_SUPPORT) + if (marlin_state != MF_INITIALIZING) LCD_ALERTMESSAGE(MSG_MEDIA_INIT_FAIL); + #endif + } ui.refresh(); } @@ -496,15 +497,15 @@ void CardReader::manage_media() { if (TERN1(SD_IGNORE_AT_STARTUP, old_stat != 2)) mount(); if (!isMounted()) { // Not mounted? stat = 0; - IF_DISABLED(SD_IGNORE_AT_STARTUP, prev_stat = 0); + #if HAS_SD_DETECT && DISABLED(SD_IGNORE_AT_STARTUP) + prev_stat = 0; + #endif } TERN_(RESET_STEPPERS_ON_MEDIA_INSERT, reset_stepper_drivers()); // Workaround for Cheetah bug } else { - #if PIN_EXISTS(SD_DETECT) - release(); // Card is released - #endif + TERN_(HAS_SD_DETECT, release()); // Card is released } ui.media_changed(old_stat, stat); // Update the UI or flag an error diff --git a/Marlin/src/sd/cardreader.h b/Marlin/src/sd/cardreader.h index 483ab8139584..d2f462c2a777 100644 --- a/Marlin/src/sd/cardreader.h +++ b/Marlin/src/sd/cardreader.h @@ -362,7 +362,7 @@ class CardReader { #if ENABLED(USB_FLASH_DRIVE_SUPPORT) #define IS_SD_INSERTED() DiskIODriver_USBFlash::isInserted() -#elif PIN_EXISTS(SD_DETECT) +#elif HAS_SD_DETECT #define IS_SD_INSERTED() (READ(SD_DETECT_PIN) == SD_DETECT_STATE) #else // No card detect line? Assume the card is inserted. From 76a0cab782d3822776bf9455426fae940a6b82b8 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Wed, 8 Jun 2022 00:20:44 +0000 Subject: [PATCH 156/241] [cron] Bump distribution date (2022-06-08) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 6a57f890a203..a29fe8e37f66 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-06-07" +//#define STRING_DISTRIBUTION_DATE "2022-06-08" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index a6e2b323691c..5c05f2f021df 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-06-07" + #define STRING_DISTRIBUTION_DATE "2022-06-08" #endif /** From e4e6abe5af0f97ff5cb0c9334cb298d3584968e3 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 9 Jun 2022 00:51:08 -0500 Subject: [PATCH 157/241] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Rem?= =?UTF-8?q?ove=20servo=20macros?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/bltouch.cpp | 2 +- Marlin/src/feature/spindle_laser.cpp | 4 ++-- Marlin/src/gcode/config/M43.cpp | 8 ++++---- Marlin/src/gcode/control/M280.cpp | 6 +++--- Marlin/src/gcode/control/M282.cpp | 2 +- Marlin/src/module/probe.cpp | 2 +- Marlin/src/module/servo.cpp | 8 ++++---- Marlin/src/module/servo.h | 7 ++----- Marlin/src/module/temperature.cpp | 6 +++--- Marlin/src/module/tool_change.cpp | 8 ++++---- 10 files changed, 25 insertions(+), 28 deletions(-) diff --git a/Marlin/src/feature/bltouch.cpp b/Marlin/src/feature/bltouch.cpp index d911fae6ae75..10d3131aedcb 100644 --- a/Marlin/src/feature/bltouch.cpp +++ b/Marlin/src/feature/bltouch.cpp @@ -45,7 +45,7 @@ void stop(); bool BLTouch::command(const BLTCommand cmd, const millis_t &ms) { if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("BLTouch Command :", cmd); - MOVE_SERVO(Z_PROBE_SERVO_NR, cmd); + servo[Z_PROBE_SERVO_NR].move(cmd); safe_delay(_MAX(ms, (uint32_t)BLTOUCH_DELAY)); // BLTOUCH_DELAY is also the *minimum* delay return triggered(); } diff --git a/Marlin/src/feature/spindle_laser.cpp b/Marlin/src/feature/spindle_laser.cpp index 8f70816c9942..4f8f4d49dc2f 100644 --- a/Marlin/src/feature/spindle_laser.cpp +++ b/Marlin/src/feature/spindle_laser.cpp @@ -58,7 +58,7 @@ cutter_power_t SpindleLaser::menuPower, // Power s */ void SpindleLaser::init() { #if ENABLED(SPINDLE_SERVO) - MOVE_SERVO(SPINDLE_SERVO_NR, SPINDLE_SERVO_MIN); + servo[SPINDLE_SERVO_NR].move(SPINDLE_SERVO_MIN); #else OUT_WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ACTIVE_STATE); // Init spindle to off #endif @@ -131,7 +131,7 @@ void SpindleLaser::apply_power(const uint8_t opwr) { isReady = false; } #elif ENABLED(SPINDLE_SERVO) - MOVE_SERVO(SPINDLE_SERVO_NR, power); + servo[SPINDLE_SERVO_NR].move(power); #else WRITE(SPINDLE_LASER_ENA_PIN, enabled() ? SPINDLE_LASER_ACTIVE_STATE : !SPINDLE_LASER_ACTIVE_STATE); isReady = true; diff --git a/Marlin/src/gcode/config/M43.cpp b/Marlin/src/gcode/config/M43.cpp index de76b8e97936..688b94c9bf39 100644 --- a/Marlin/src/gcode/config/M43.cpp +++ b/Marlin/src/gcode/config/M43.cpp @@ -198,10 +198,10 @@ inline void servo_probe_test() { uint8_t i = 0; SERIAL_ECHOLNPGM(". Deploy & stow 4 times"); do { - MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][0]); // Deploy + servo[probe_index].move(servo_angles[Z_PROBE_SERVO_NR][0]); // Deploy safe_delay(500); deploy_state = READ(PROBE_TEST_PIN); - MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][1]); // Stow + servo[probe_index].move(servo_angles[Z_PROBE_SERVO_NR][1]); // Stow safe_delay(500); stow_state = READ(PROBE_TEST_PIN); } while (++i < 4); @@ -226,7 +226,7 @@ inline void servo_probe_test() { } // Ask the user for a trigger event and measure the pulse width. - MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][0]); // Deploy + servo[probe_index].move(servo_angles[Z_PROBE_SERVO_NR][0]); // Deploy safe_delay(500); SERIAL_ECHOLNPGM("** Please trigger probe within 30 sec **"); uint16_t probe_counter = 0; @@ -256,7 +256,7 @@ inline void servo_probe_test() { } else SERIAL_ECHOLNPGM("FAIL: Noise detected - please re-run test"); - MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][1]); // Stow + servo[probe_index].move(servo_angles[Z_PROBE_SERVO_NR][1]); // Stow return; } } diff --git a/Marlin/src/gcode/control/M280.cpp b/Marlin/src/gcode/control/M280.cpp index ed156e16e952..82981e44bcee 100644 --- a/Marlin/src/gcode/control/M280.cpp +++ b/Marlin/src/gcode/control/M280.cpp @@ -56,14 +56,14 @@ void GcodeSuite::M280() { while (PENDING(now, end)) { safe_delay(50); now = _MIN(millis(), end); - MOVE_SERVO(servo_index, LROUND(aold + (anew - aold) * (float(now - start) / t))); + servo[servo_index].move(LROUND(aold + (anew - aold) * (float(now - start) / t))); } } #endif // POLARGRAPH - MOVE_SERVO(servo_index, anew); + servo[servo_index].move(anew); } else - DETACH_SERVO(servo_index); + servo[servo_index].detach(); } else SERIAL_ECHO_MSG(" Servo ", servo_index, ": ", servo[servo_index].read()); diff --git a/Marlin/src/gcode/control/M282.cpp b/Marlin/src/gcode/control/M282.cpp index e6f5ce7dccc3..3ac5ac9f5bfc 100644 --- a/Marlin/src/gcode/control/M282.cpp +++ b/Marlin/src/gcode/control/M282.cpp @@ -36,7 +36,7 @@ void GcodeSuite::M282() { const int servo_index = parser.value_int(); if (WITHIN(servo_index, 0, NUM_SERVOS - 1)) - DETACH_SERVO(servo_index); + servo[servo_index].detach(); else SERIAL_ECHO_MSG("Servo ", servo_index, " out of range"); diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 66e1c850284f..2649aa41b634 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -343,7 +343,7 @@ FORCE_INLINE void probe_specific_action(const bool deploy) { #elif HAS_Z_SERVO_PROBE - MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][deploy ? 0 : 1]); + servo[Z_PROBE_SERVO_NR].move(servo_angles[Z_PROBE_SERVO_NR][deploy ? 0 : 1]); #elif EITHER(TOUCH_MI_PROBE, Z_PROBE_ALLEN_KEY) diff --git a/Marlin/src/module/servo.cpp b/Marlin/src/module/servo.cpp index 96d5ba9da837..2782be1f2bd9 100644 --- a/Marlin/src/module/servo.cpp +++ b/Marlin/src/module/servo.cpp @@ -39,19 +39,19 @@ hal_servo_t servo[NUM_SERVOS]; void servo_init() { #if NUM_SERVOS >= 1 && HAS_SERVO_0 servo[0].attach(SERVO0_PIN); - DETACH_SERVO(0); // Just set up the pin. We don't have a position yet. Don't move to a random position. + servo[0].detach(); // Just set up the pin. We don't have a position yet. Don't move to a random position. #endif #if NUM_SERVOS >= 2 && HAS_SERVO_1 servo[1].attach(SERVO1_PIN); - DETACH_SERVO(1); + servo[1].detach(); #endif #if NUM_SERVOS >= 3 && HAS_SERVO_2 servo[2].attach(SERVO2_PIN); - DETACH_SERVO(2); + servo[2].detach(); #endif #if NUM_SERVOS >= 4 && HAS_SERVO_3 servo[3].attach(SERVO3_PIN); - DETACH_SERVO(3); + servo[3].detach(); #endif } diff --git a/Marlin/src/module/servo.h b/Marlin/src/module/servo.h index cd55a317a275..2ed992aa03f7 100644 --- a/Marlin/src/module/servo.h +++ b/Marlin/src/module/servo.h @@ -103,14 +103,11 @@ }; #if HAS_Z_SERVO_PROBE - #define DEPLOY_Z_SERVO() MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][0]) - #define STOW_Z_SERVO() MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][1]) + #define DEPLOY_Z_SERVO() servo[Z_PROBE_SERVO_NR].move(servo_angles[Z_PROBE_SERVO_NR][0]) + #define STOW_Z_SERVO() servo[Z_PROBE_SERVO_NR].move(servo_angles[Z_PROBE_SERVO_NR][1]) #endif #endif // HAS_SERVO_ANGLES -#define MOVE_SERVO(I, P) servo[I].move(P) -#define DETACH_SERVO(I) servo[I].detach() - extern hal_servo_t servo[NUM_SERVOS]; void servo_init(); diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 531c52c09de6..17ab08d4c20e 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -1881,7 +1881,7 @@ void Temperature::manage_heater() { #endif #if ENABLED(CHAMBER_VENT) flag_chamber_excess_heat = false; - MOVE_SERVO(CHAMBER_VENT_SERVO_NR, 90); + servo[CHAMBER_VENT_SERVO_NR].move(90); #endif } #endif @@ -1897,7 +1897,7 @@ void Temperature::manage_heater() { if (flag_chamber_excess_heat) { temp_chamber.soft_pwm_amount = 0; #if ENABLED(CHAMBER_VENT) - if (!flag_chamber_off) MOVE_SERVO(CHAMBER_VENT_SERVO_NR, temp_chamber.celsius <= temp_chamber.target ? 0 : 90); + if (!flag_chamber_off) servo[CHAMBER_VENT_SERVO_NR].move(temp_chamber.celsius <= temp_chamber.target ? 0 : 90); #endif } else { @@ -1910,7 +1910,7 @@ void Temperature::manage_heater() { temp_chamber.soft_pwm_amount = temp_chamber.celsius < temp_chamber.target ? (MAX_CHAMBER_POWER) >> 1 : 0; #endif #if ENABLED(CHAMBER_VENT) - if (!flag_chamber_off) MOVE_SERVO(CHAMBER_VENT_SERVO_NR, 0); + if (!flag_chamber_off) servo[CHAMBER_VENT_SERVO_NR].move(0); #endif } } diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index e2f1443048ed..4b292c92f98b 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -116,7 +116,7 @@ void move_extruder_servo(const uint8_t e) { planner.synchronize(); if ((EXTRUDERS & 1) && e < EXTRUDERS - 1) { - MOVE_SERVO(_SERVO_NR(e), servo_angles[_SERVO_NR(e)][e & 1]); + servo[_SERVO_NR(e)].move(servo_angles[_SERVO_NR(e)][e & 1]); safe_delay(500); } } @@ -131,7 +131,7 @@ constexpr int8_t sns_index[2] = { SWITCHING_NOZZLE_SERVO_NR, SWITCHING_NOZZLE_E1_SERVO_NR }; constexpr int16_t sns_angles[2] = SWITCHING_NOZZLE_SERVO_ANGLES; planner.synchronize(); - MOVE_SERVO(sns_index[e], sns_angles[angle_index]); + servo[sns_index[e]].move(sns_angles[angle_index]); safe_delay(500); } @@ -142,7 +142,7 @@ void move_nozzle_servo(const uint8_t angle_index) { planner.synchronize(); - MOVE_SERVO(SWITCHING_NOZZLE_SERVO_NR, servo_angles[SWITCHING_NOZZLE_SERVO_NR][angle_index]); + servo[SWITCHING_NOZZLE_SERVO_NR].move(servo_angles[SWITCHING_NOZZLE_SERVO_NR][angle_index]); safe_delay(500); } @@ -443,7 +443,7 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0. inline void switching_toolhead_lock(const bool locked) { #ifdef SWITCHING_TOOLHEAD_SERVO_ANGLES const uint16_t swt_angles[2] = SWITCHING_TOOLHEAD_SERVO_ANGLES; - MOVE_SERVO(SWITCHING_TOOLHEAD_SERVO_NR, swt_angles[locked ? 0 : 1]); + servo[SWITCHING_TOOLHEAD_SERVO_NR].move(swt_angles[locked ? 0 : 1]); #elif PIN_EXISTS(SWT_SOLENOID) OUT_WRITE(SWT_SOLENOID_PIN, locked); gcode.dwell(10); From 0ca33429b679674f582532f8aa8c54ec60eaa655 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 9 Jun 2022 00:51:47 -0500 Subject: [PATCH 158/241] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Mis?= =?UTF-8?q?c.=20servo=20code=20cleanup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/AVR/Servo.cpp | 2 +- Marlin/src/HAL/DUE/Servo.cpp | 21 ++++++++------------- Marlin/src/HAL/SAMD51/Servo.cpp | 4 ++-- Marlin/src/HAL/STM32F1/Servo.cpp | 16 ++++++++-------- Marlin/src/HAL/shared/servo.cpp | 13 +++++++------ Marlin/src/HAL/shared/servo_private.h | 12 ++++++------ 6 files changed, 32 insertions(+), 36 deletions(-) diff --git a/Marlin/src/HAL/AVR/Servo.cpp b/Marlin/src/HAL/AVR/Servo.cpp index 526352b77339..6dc1e2fb0732 100644 --- a/Marlin/src/HAL/AVR/Servo.cpp +++ b/Marlin/src/HAL/AVR/Servo.cpp @@ -66,7 +66,7 @@ static volatile int8_t Channel[_Nbr_16timers]; // counter for the s /************ static functions common to all instances ***********************/ -static inline void handle_interrupts(timer16_Sequence_t timer, volatile uint16_t* TCNTn, volatile uint16_t* OCRnA) { +static inline void handle_interrupts(const timer16_Sequence_t timer, volatile uint16_t* TCNTn, volatile uint16_t* OCRnA) { if (Channel[timer] < 0) *TCNTn = 0; // channel set to -1 indicated that refresh interval completed so reset the timer else { diff --git a/Marlin/src/HAL/DUE/Servo.cpp b/Marlin/src/HAL/DUE/Servo.cpp index 5524aa9cef47..72a7d649ef04 100644 --- a/Marlin/src/HAL/DUE/Servo.cpp +++ b/Marlin/src/HAL/DUE/Servo.cpp @@ -52,7 +52,7 @@ static volatile int8_t Channel[_Nbr_16timers]; // counter for the s // ------------------------ /// Interrupt handler for the TC0 channel 1. // ------------------------ -void Servo_Handler(timer16_Sequence_t timer, Tc *pTc, uint8_t channel); +void Servo_Handler(const timer16_Sequence_t, Tc*, const uint8_t); #ifdef _useTimer1 void HANDLER_FOR_TIMER1() { Servo_Handler(_timer1, TC_FOR_TIMER1, CHANNEL_FOR_TIMER1); } @@ -70,7 +70,7 @@ void Servo_Handler(timer16_Sequence_t timer, Tc *pTc, uint8_t channel); void HANDLER_FOR_TIMER5() { Servo_Handler(_timer5, TC_FOR_TIMER5, CHANNEL_FOR_TIMER5); } #endif -void Servo_Handler(timer16_Sequence_t timer, Tc *tc, uint8_t channel) { +void Servo_Handler(const timer16_Sequence_t timer, Tc *tc, const uint8_t channel) { // clear interrupt tc->TC_CHANNEL[channel].TC_SR; if (Channel[timer] < 0) @@ -113,26 +113,21 @@ static void _initISR(Tc *tc, uint32_t channel, uint32_t id, IRQn_Type irqn) { TC_Start(tc, channel); } -void initISR(timer16_Sequence_t timer) { +void initISR(const timer16_Sequence_t timer) { #ifdef _useTimer1 - if (timer == _timer1) - _initISR(TC_FOR_TIMER1, CHANNEL_FOR_TIMER1, ID_TC_FOR_TIMER1, IRQn_FOR_TIMER1); + if (timer == _timer1) _initISR(TC_FOR_TIMER1, CHANNEL_FOR_TIMER1, ID_TC_FOR_TIMER1, IRQn_FOR_TIMER1); #endif #ifdef _useTimer2 - if (timer == _timer2) - _initISR(TC_FOR_TIMER2, CHANNEL_FOR_TIMER2, ID_TC_FOR_TIMER2, IRQn_FOR_TIMER2); + if (timer == _timer2) _initISR(TC_FOR_TIMER2, CHANNEL_FOR_TIMER2, ID_TC_FOR_TIMER2, IRQn_FOR_TIMER2); #endif #ifdef _useTimer3 - if (timer == _timer3) - _initISR(TC_FOR_TIMER3, CHANNEL_FOR_TIMER3, ID_TC_FOR_TIMER3, IRQn_FOR_TIMER3); + if (timer == _timer3) _initISR(TC_FOR_TIMER3, CHANNEL_FOR_TIMER3, ID_TC_FOR_TIMER3, IRQn_FOR_TIMER3); #endif #ifdef _useTimer4 - if (timer == _timer4) - _initISR(TC_FOR_TIMER4, CHANNEL_FOR_TIMER4, ID_TC_FOR_TIMER4, IRQn_FOR_TIMER4); + if (timer == _timer4) _initISR(TC_FOR_TIMER4, CHANNEL_FOR_TIMER4, ID_TC_FOR_TIMER4, IRQn_FOR_TIMER4); #endif #ifdef _useTimer5 - if (timer == _timer5) - _initISR(TC_FOR_TIMER5, CHANNEL_FOR_TIMER5, ID_TC_FOR_TIMER5, IRQn_FOR_TIMER5); + if (timer == _timer5) _initISR(TC_FOR_TIMER5, CHANNEL_FOR_TIMER5, ID_TC_FOR_TIMER5, IRQn_FOR_TIMER5); #endif } diff --git a/Marlin/src/HAL/SAMD51/Servo.cpp b/Marlin/src/HAL/SAMD51/Servo.cpp index 23ab21c615c4..04461653f94f 100644 --- a/Marlin/src/HAL/SAMD51/Servo.cpp +++ b/Marlin/src/HAL/SAMD51/Servo.cpp @@ -124,7 +124,7 @@ HAL_SERVO_TIMER_ISR() { } } -void initISR(timer16_Sequence_t timer) { +void initISR(const timer16_Sequence_t timer) { Tc * const tc = timer_config[SERVO_TC].pTc; const uint8_t tcChannel = TIMER_TCCHANNEL(timer); @@ -201,7 +201,7 @@ void initISR(timer16_Sequence_t timer) { } } -void finISR(timer16_Sequence_t timer) { +void finISR(const timer16_Sequence_t timer) { Tc * const tc = timer_config[SERVO_TC].pTc; const uint8_t tcChannel = TIMER_TCCHANNEL(timer); diff --git a/Marlin/src/HAL/STM32F1/Servo.cpp b/Marlin/src/HAL/STM32F1/Servo.cpp index 8dc1ef7b6a5b..47ffb631cf8f 100644 --- a/Marlin/src/HAL/STM32F1/Servo.cpp +++ b/Marlin/src/HAL/STM32F1/Servo.cpp @@ -147,17 +147,17 @@ void libServo::move(const int32_t value) { uint16_t SR = timer_get_status(tdev); if (SR & TIMER_SR_CC1IF) { // channel 1 off #ifdef SERVO0_PWM_OD - OUT_WRITE_OD(SERVO0_PIN, 1); // off + OUT_WRITE_OD(SERVO0_PIN, HIGH); // off #else - OUT_WRITE(SERVO0_PIN, 0); + OUT_WRITE(SERVO0_PIN, LOW); #endif timer_reset_status_bit(tdev, TIMER_SR_CC1IF_BIT); } if (SR & TIMER_SR_CC2IF) { // channel 2 resume #ifdef SERVO0_PWM_OD - OUT_WRITE_OD(SERVO0_PIN, 0); // on + OUT_WRITE_OD(SERVO0_PIN, LOW); // on #else - OUT_WRITE(SERVO0_PIN, 1); + OUT_WRITE(SERVO0_PIN, HIGH); #endif timer_reset_status_bit(tdev, TIMER_SR_CC2IF_BIT); } @@ -167,9 +167,9 @@ void libServo::move(const int32_t value) { timer_dev *tdev = HAL_get_timer_dev(MF_TIMER_SERVO0); if (!tdev) return false; #ifdef SERVO0_PWM_OD - OUT_WRITE_OD(inPin, 1); + OUT_WRITE_OD(inPin, HIGH); #else - OUT_WRITE(inPin, 0); + OUT_WRITE(inPin, LOW); #endif timer_pause(tdev); @@ -200,9 +200,9 @@ void libServo::move(const int32_t value) { timer_disable_irq(tdev, 1); timer_disable_irq(tdev, 2); #ifdef SERVO0_PWM_OD - OUT_WRITE_OD(pin, 1); // off + OUT_WRITE_OD(pin, HIGH); // off #else - OUT_WRITE(pin, 0); + OUT_WRITE(pin, LOW); #endif } } diff --git a/Marlin/src/HAL/shared/servo.cpp b/Marlin/src/HAL/shared/servo.cpp index cfec6f301737..b838800de654 100644 --- a/Marlin/src/HAL/shared/servo.cpp +++ b/Marlin/src/HAL/shared/servo.cpp @@ -65,7 +65,7 @@ uint8_t ServoCount = 0; // the total number of attached /************ static functions common to all instances ***********************/ -static boolean isTimerActive(timer16_Sequence_t timer) { +static bool anyTimerChannelActive(const timer16_Sequence_t timer) { // returns true if any servo is active on this timer LOOP_L_N(channel, SERVOS_PER_TIMER) { if (SERVO(timer, channel).Pin.isActive) @@ -101,17 +101,18 @@ int8_t Servo::attach(const int inPin, const int inMin, const int inMax) { max = (MAX_PULSE_WIDTH - inMax) / 4; // initialize the timer if it has not already been initialized - timer16_Sequence_t timer = SERVO_INDEX_TO_TIMER(servoIndex); - if (!isTimerActive(timer)) initISR(timer); - servo_info[servoIndex].Pin.isActive = true; // this must be set after the check for isTimerActive + const timer16_Sequence_t timer = SERVO_INDEX_TO_TIMER(servoIndex); + if (!anyTimerChannelActive(timer)) initISR(timer); + servo_info[servoIndex].Pin.isActive = true; // this must be set after the check for anyTimerChannelActive return servoIndex; } void Servo::detach() { servo_info[servoIndex].Pin.isActive = false; - timer16_Sequence_t timer = SERVO_INDEX_TO_TIMER(servoIndex); - if (!isTimerActive(timer)) finISR(timer); + const timer16_Sequence_t timer = SERVO_INDEX_TO_TIMER(servoIndex); + if (!anyTimerChannelActive(timer)) finISR(timer); + //pinMode(servo_info[servoIndex].Pin.nbr, INPUT); // set servo pin to input } void Servo::write(int value) { diff --git a/Marlin/src/HAL/shared/servo_private.h b/Marlin/src/HAL/shared/servo_private.h index d85d8da8ba43..021e0cb81d01 100644 --- a/Marlin/src/HAL/shared/servo_private.h +++ b/Marlin/src/HAL/shared/servo_private.h @@ -70,10 +70,10 @@ #define ticksToUs(_ticks) (unsigned(_ticks) * (SERVO_TIMER_PRESCALER) / clockCyclesPerMicrosecond()) // convenience macros -#define SERVO_INDEX_TO_TIMER(_servo_nbr) ((timer16_Sequence_t)(_servo_nbr / (SERVOS_PER_TIMER))) // returns the timer controlling this servo -#define SERVO_INDEX_TO_CHANNEL(_servo_nbr) (_servo_nbr % (SERVOS_PER_TIMER)) // returns the index of the servo on this timer -#define SERVO_INDEX(_timer,_channel) ((_timer*(SERVOS_PER_TIMER)) + _channel) // macro to access servo index by timer and channel -#define SERVO(_timer,_channel) (servo_info[SERVO_INDEX(_timer,_channel)]) // macro to access servo class by timer and channel +#define SERVO_INDEX_TO_TIMER(_servo_nbr) timer16_Sequence_t(_servo_nbr / (SERVOS_PER_TIMER)) // the timer controlling this servo +#define SERVO_INDEX_TO_CHANNEL(_servo_nbr) (_servo_nbr % (SERVOS_PER_TIMER)) // the index of the servo on this timer +#define SERVO_INDEX(_timer,_channel) ((_timer*(SERVOS_PER_TIMER)) + _channel) // servo index by timer and channel +#define SERVO(_timer,_channel) servo_info[SERVO_INDEX(_timer,_channel)] // servo class by timer and channel // Types @@ -94,5 +94,5 @@ extern ServoInfo_t servo_info[MAX_SERVOS]; // Public functions -extern void initISR(timer16_Sequence_t timer); -extern void finISR(timer16_Sequence_t timer); +extern void initISR(const timer16_Sequence_t timer); +extern void finISR(const timer16_Sequence_t timer); From fb76ce841b8e6108207b2d33eb217191fdc80427 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Thu, 9 Jun 2022 06:07:54 +0000 Subject: [PATCH 159/241] [cron] Bump distribution date (2022-06-09) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index a29fe8e37f66..b8010bf9c7c2 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-06-08" +//#define STRING_DISTRIBUTION_DATE "2022-06-09" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 5c05f2f021df..fc8ee1fdfb97 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-06-08" + #define STRING_DISTRIBUTION_DATE "2022-06-09" #endif /** From ee90ae2c872c29950a79ea1f181f2c8f6f4d2006 Mon Sep 17 00:00:00 2001 From: Steven Haigh Date: Sat, 11 Jun 2022 12:08:55 +1000 Subject: [PATCH 160/241] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20ProUI=20compile=20?= =?UTF-8?q?(#24310)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/lcd/e3v2/proui/gcode_preview.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp b/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp index 951f469e1c60..1a3a3abfab58 100644 --- a/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp +++ b/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp @@ -49,6 +49,7 @@ #include "../../../core/types.h" #include "../../marlinui.h" #include "../../../sd/cardreader.h" +#include "../../../MarlinCore.h" // for wait_for_user #include "dwin_lcd.h" #include "dwinui.h" #include "dwin.h" From 20dea2209124761d53110e4f60d6da1729249a9b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 10 Jun 2022 23:53:35 -0500 Subject: [PATCH 161/241] =?UTF-8?q?=F0=9F=91=94=20Fewer=20checkboxes=20in?= =?UTF-8?q?=20Bug=20Report?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/ISSUE_TEMPLATE/bug_report.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 696a00b44097..efc5972325f6 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -149,15 +149,25 @@ body: - Same as my slicer - Other (explain below) + - type: markdown + attributes: + value: | + # Attachments + - type: checkboxes attributes: - label: Other things to include + label: Don't forget to include options: - label: A ZIP file containing your `Configuration.h` and `Configuration_adv.h`. required: true - - label: Log output from the host. (`M111 S247` for maximum logging.) - - label: Images or videos demonstrating the problem, if it helps to make it clear. - - label: A G-Code file that exposes the problem, if not affecting _all_ G-code. + + - type: markdown + attributes: + value: | + ### Optional items to include: + - 'Log output from the host. (`M111 S247` for maximum logging.)' + - Images or videos demonstrating the problem, if it helps to make it clear. + - A G-Code file that exposes the problem, if not affecting _all_ G-code. - type: textarea attributes: From 43e9fe7f8874fe11ea7152276e43279c88fea1e8 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sat, 11 Jun 2022 17:03:20 +1200 Subject: [PATCH 162/241] =?UTF-8?q?=F0=9F=90=9B=20Fix=20JGAurora=20A5S=20A?= =?UTF-8?q?1=20build=20(#24326)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ini/stm32f1.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/ini/stm32f1.ini b/ini/stm32f1.ini index 7493e3682ce5..91005af2ff5a 100644 --- a/ini/stm32f1.ini +++ b/ini/stm32f1.ini @@ -331,7 +331,6 @@ extends = stm32_variant board = genericSTM32F103ZE board_build.variant = MARLIN_F103Zx board_build.offset = 0xA000 -board_build.rename = firmware_for_sd_upload.bin board_upload.offset_address = 0x0800A000 build_flags = ${stm32_variant.build_flags} -DSTM32F1xx -DSTM32_XL_DENSITY From 9c6e0428afb2638f7f725e092206cce8e2aded47 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 11 Jun 2022 06:06:31 +0000 Subject: [PATCH 163/241] [cron] Bump distribution date (2022-06-11) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index b8010bf9c7c2..2613432af8b7 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-06-09" +//#define STRING_DISTRIBUTION_DATE "2022-06-11" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index fc8ee1fdfb97..648cfdb4cfbf 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-06-09" + #define STRING_DISTRIBUTION_DATE "2022-06-11" #endif /** From 0ff3018fd2caa957c0a90d6f58e7f3c760a78fc0 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Tue, 14 Jun 2022 13:38:19 +1200 Subject: [PATCH 164/241] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20missing=20ProUI=20?= =?UTF-8?q?cpp=20wrapper=20(#24313)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/e3v2/proui/gcode_preview.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp b/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp index 1a3a3abfab58..adb23a96646b 100644 --- a/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp +++ b/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp @@ -42,6 +42,9 @@ * For commercial applications additional licenses can be requested */ +#include "../../../inc/MarlinConfigPre.h" +#if ENABLED(DWIN_LCD_PROUI) + #include "dwin_defines.h" #if HAS_GCODE_PREVIEW @@ -252,3 +255,4 @@ void Preview_Reset() { } #endif // HAS_GCODE_PREVIEW +#endif // DWIN_LCD_PROUI From 640282b8dc5de4ccdfb607b99e795d3eaa1334a7 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 13 Jun 2022 20:43:23 -0500 Subject: [PATCH 165/241] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20App?= =?UTF-8?q?ly=20F()=20to=20some=20LCD=20/=20TFT=20strings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #24228 --- Marlin/src/gcode/queue.cpp | 5 ++-- Marlin/src/gcode/queue.h | 3 +- Marlin/src/lcd/e3v2/common/dwin_api.h | 10 +++++-- Marlin/src/lcd/e3v2/creality/dwin.cpp | 10 +++++-- Marlin/src/lcd/e3v2/marlinui/ui_common.cpp | 12 ++++---- .../lcd/e3v2/marlinui/ui_status_480x272.cpp | 20 ++++++------- .../src/lcd/extui/dgus/DGUSScreenHandler.cpp | 13 +++------ .../bioprinter/printing_dialog_box.cpp | 22 +++++++++------ .../bioprinter/status_screen.cpp | 6 ++-- .../ftdi_eve_lib/extended/text_box.cpp | 10 +++++-- .../ftdi_eve_lib/extended/unicode/unicode.cpp | 10 +++++-- .../generic/dialog_box_base_class.cpp | 5 ++-- .../generic/dialog_box_base_class.h | 7 +++-- .../generic/status_screen.cpp | 12 +++++--- Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp | 16 +++++++---- Marlin/src/lcd/extui/ui_api.cpp | 20 +++++++++---- Marlin/src/lcd/menu/menu.h | 12 +++++--- Marlin/src/lcd/tft/ui_1024x600.cpp | 28 ++++++++++++------- Marlin/src/lcd/tft/ui_320x240.cpp | 24 ++++++++-------- Marlin/src/lcd/tft/ui_480x320.cpp | 24 ++++++++-------- 20 files changed, 160 insertions(+), 109 deletions(-) diff --git a/Marlin/src/gcode/queue.cpp b/Marlin/src/gcode/queue.cpp index 2250cd3b7452..454a009b8598 100644 --- a/Marlin/src/gcode/queue.cpp +++ b/Marlin/src/gcode/queue.cpp @@ -196,14 +196,15 @@ bool GCodeQueue::process_injected_command() { * Never call this from a G-code handler! */ void GCodeQueue::enqueue_one_now(const char * const cmd) { while (!enqueue_one(cmd)) idle(); } +void GCodeQueue::enqueue_one_now(FSTR_P const fcmd) { while (!enqueue_one(fcmd)) idle(); } /** * Attempt to enqueue a single G-code command * and return 'true' if successful. */ -bool GCodeQueue::enqueue_one(FSTR_P const fgcode) { +bool GCodeQueue::enqueue_one(FSTR_P const fcmd) { size_t i = 0; - PGM_P p = FTOP(fgcode); + PGM_P p = FTOP(fcmd); char c; while ((c = pgm_read_byte(&p[i])) && c != '\n') i++; char cmd[i + 1]; diff --git a/Marlin/src/gcode/queue.h b/Marlin/src/gcode/queue.h index 1a2baaa6bbc4..142283008001 100644 --- a/Marlin/src/gcode/queue.h +++ b/Marlin/src/gcode/queue.h @@ -141,12 +141,13 @@ class GCodeQueue { * Enqueue and return only when commands are actually enqueued */ static void enqueue_one_now(const char * const cmd); + static void enqueue_one_now(FSTR_P const fcmd); /** * Attempt to enqueue a single G-code command * and return 'true' if successful. */ - static bool enqueue_one(FSTR_P const fgcode); + static bool enqueue_one(FSTR_P const fcmd); /** * Enqueue with Serial Echo diff --git a/Marlin/src/lcd/e3v2/common/dwin_api.h b/Marlin/src/lcd/e3v2/common/dwin_api.h index 81724c6edf97..dc97ef2723fa 100644 --- a/Marlin/src/lcd/e3v2/common/dwin_api.h +++ b/Marlin/src/lcd/e3v2/common/dwin_api.h @@ -176,9 +176,13 @@ void DWIN_Frame_AreaMove(uint8_t mode, uint8_t dir, uint16_t dis, void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const char * const string, uint16_t rlimit=0xFFFF); inline void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, FSTR_P const ftitle) { - char ctitle[strlen_P(FTOP(ftitle)) + 1]; - strcpy_P(ctitle, FTOP(ftitle)); - DWIN_Draw_String(bShow, size, color, bColor, x, y, ctitle); + #ifdef __AVR__ + char ctitle[strlen_P(FTOP(ftitle)) + 1]; + strcpy_P(ctitle, FTOP(ftitle)); + DWIN_Draw_String(bShow, size, color, bColor, x, y, ctitle); + #else + DWIN_Draw_String(bShow, size, color, bColor, x, y, FTOP(ftitle)); + #endif } // Draw a positive integer diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index b2cb1bee30ce..3ca7627db086 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp @@ -4307,9 +4307,13 @@ void DWIN_StatusChanged(const char * const cstr/*=nullptr*/) { } void DWIN_StatusChanged(FSTR_P const fstr) { - char str[strlen_P(FTOP(fstr)) + 1]; - strcpy_P(str, FTOP(fstr)); - DWIN_StatusChanged(str); + #ifdef __AVR__ + char str[strlen_P(FTOP(fstr)) + 1]; + strcpy_P(str, FTOP(fstr)); + DWIN_StatusChanged(str); + #else + DWIN_StatusChanged(FTOP(fstr)); + #endif } #endif // DWIN_CREALITY_LCD diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp index f01a2beddf4e..ce1758f1da64 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp @@ -274,7 +274,7 @@ void MarlinUI::draw_status_message(const bool blink) { dwin_font.solid = false; dwin_font.fg = Color_White; - dwin_string.set("E"); + dwin_string.set('E'); dwin_string.add('1' + extruder); dwin_string.add(' '); dwin_string.add(i16tostr3rj(thermalManager.degHotend(extruder))); @@ -282,7 +282,7 @@ void MarlinUI::draw_status_message(const bool blink) { if (get_blink() || !thermalManager.heater_idle[thermalManager.idle_index_for_id(extruder)].timed_out) dwin_string.add(i16tostr3rj(thermalManager.degTargetHotend(extruder))); else - dwin_string.add(PSTR(" ")); + dwin_string.add(F(" ")); lcd_moveto(LCD_WIDTH - dwin_string.length, row); lcd_put_dwin_string(); @@ -540,11 +540,11 @@ void MarlinUI::draw_status_message(const bool blink) { lcd_put_u8str(ftostr52(lpos.y)); // Print plot position - dwin_string.set("("); + dwin_string.set('('); dwin_string.add(i8tostr3rj(x_plot)); - dwin_string.add(","); + dwin_string.add(','); dwin_string.add(i8tostr3rj(y_plot)); - dwin_string.add(")"); + dwin_string.add(')'); lcd_moveto( TERN(DWIN_MARLINUI_LANDSCAPE, ((x_offset + x_map_pixels) / MENU_FONT_WIDTH) + 2, LCD_WIDTH - dwin_string.length), TERN(DWIN_MARLINUI_LANDSCAPE, LCD_HEIGHT - 2, ((y_offset + y_map_pixels) / MENU_LINE_HEIGHT) + 1) @@ -556,7 +556,7 @@ void MarlinUI::draw_status_message(const bool blink) { if (!isnan(bedlevel.z_values[x_plot][y_plot])) dwin_string.add(ftostr43sign(bedlevel.z_values[x_plot][y_plot])); else - dwin_string.add(PSTR(" -----")); + dwin_string.add(F(" -----")); lcd_moveto( TERN(DWIN_MARLINUI_LANDSCAPE, ((x_offset + x_map_pixels) / MENU_FONT_WIDTH) + 2, LCD_WIDTH - dwin_string.length), TERN(DWIN_MARLINUI_LANDSCAPE, LCD_HEIGHT - 1, ((y_offset + y_map_pixels) / MENU_LINE_HEIGHT) + 2) diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp index edd8bb06f369..8024085ef734 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp @@ -88,7 +88,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const // For E_TOTAL there may be some characters to cover up if (BOTH(DWIN_MARLINUI_PORTRAIT, LCD_SHOW_E_TOTAL) && axis == X_AXIS) - dwin_string.add(" "); + dwin_string.add(F(" ")); DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + 32, S(dwin_string.string())); @@ -117,7 +117,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const // For E_TOTAL there may be some characters to cover up if (ENABLED(LCD_SHOW_E_TOTAL) && (!ui.did_first_redraw || ui.old_is_printing != print_job_timer.isRunning()) && axis == X_AXIS) - dwin_string.add(" "); + dwin_string.add(F(" ")); DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x + 32, y + 4, S(dwin_string.string())); @@ -133,7 +133,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const if (!ui.did_first_redraw) { // Extra spaces to erase previous value - dwin_string.set("E "); + dwin_string.set(F("E ")); DWIN_Draw_String(true, font16x32, Color_IconBlue, Color_Bg_Black, x + (4 * 14 / 2) - 7, y + 2, S(dwin_string.string())); } @@ -146,7 +146,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const #else // !DWIN_MARLINUI_PORTRAIT if (!ui.did_first_redraw || ui.old_is_printing != print_job_timer.isRunning()) { - dwin_string.set("E "); + dwin_string.set(F("E ")); DWIN_Draw_String(true, font16x32, Color_IconBlue, Color_Bg_Black, x, y, S(dwin_string.string())); } @@ -176,7 +176,7 @@ FORCE_INLINE void _draw_fan_status(const uint16_t x, const uint16_t y) { else { DWIN_ICON_AnimationControl(0x0000); // disable all icon animations (this is the only one) DWIN_ICON_Show(ICON, ICON_Fan0, x + fanx, y); - dwin_string.set(PSTR(" ")); + dwin_string.set(F(" ")); DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string())); } } @@ -289,7 +289,7 @@ FORCE_INLINE void _draw_feedrate_status(const char *value, uint16_t x, uint16_t } dwin_string.set(value); - dwin_string.add(PSTR("%")); + dwin_string.add('%'); DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x + 14, y, S(dwin_string.string())); } @@ -396,7 +396,7 @@ void MarlinUI::draw_status_screen() { // landscape mode shows both elapsed and remaining (if SHOW_REMAINING_TIME) time = print_job_timer.duration(); time.toDigital(buffer); - dwin_string.set(" "); + dwin_string.set(' '); dwin_string.add(buffer); DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, 230, 170, S(dwin_string.string())); @@ -405,7 +405,7 @@ void MarlinUI::draw_status_screen() { time = get_remaining_time(); DWIN_Draw_String(true, font14x28, Color_IconBlue, Color_Bg_Black, 336, 170, S(" R ")); if (print_job_timer.isPaused() && blink) - dwin_string.set(" "); + dwin_string.set(F(" ")); else { time.toDigital(buffer); dwin_string.set(buffer); @@ -413,7 +413,7 @@ void MarlinUI::draw_status_screen() { DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, 378, 170, S(dwin_string.string())); } else if (!ui.did_first_redraw || ui.old_is_printing != print_job_timer.isRunning()) { - dwin_string.set(" "); + dwin_string.set(F(" ")); DWIN_Draw_String(true, font14x28, Color_IconBlue, Color_Bg_Black, 336, 170, S(dwin_string.string())); } #endif @@ -449,7 +449,7 @@ void MarlinUI::draw_status_screen() { #if ENABLED(SHOW_SD_PERCENT) dwin_string.set(TERN(PRINT_PROGRESS_SHOW_DECIMALS, permyriadtostr4(progress), ui8tostr3rj(progress / (PROGRESS_SCALE)))); - dwin_string.add(PSTR("%")); + dwin_string.add('%'); DWIN_Draw_String( false, font16x32, Percent_Color, Color_Bg_Black, pb_left + (pb_width - dwin_string.length * 16) / 2, diff --git a/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp index dc872bff3b0e..88326466c092 100644 --- a/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp @@ -474,13 +474,8 @@ void DGUSScreenHandler::HandleManualExtrude(DGUS_VP_Variable &var, void *val_ptr void DGUSScreenHandler::HandleMotorLockUnlock(DGUS_VP_Variable &var, void *val_ptr) { DEBUG_ECHOLNPGM("HandleMotorLockUnlock"); - - char buf[4]; const int16_t lock = swap16(*(uint16_t*)val_ptr); - strcpy_P(buf, lock ? PSTR("M18") : PSTR("M17")); - - //DEBUG_ECHOPGM(" ", buf); - queue.enqueue_one_now(buf); + queue.enqueue_one_now(lock ? F("M18") : F("M17")); } void DGUSScreenHandler::HandleSettings(DGUS_VP_Variable &var, void *val_ptr) { @@ -552,23 +547,23 @@ void DGUSScreenHandler::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, vo #if HAS_HOTEND case VP_PID_AUTOTUNE_E0: // Autotune Extruder 0 sprintf_P(buf, PSTR("M303 E%d C5 S210 U1"), ExtUI::extruder_t::E0); + queue.enqueue_one_now(buf); break; #endif #if HAS_MULTI_HOTEND case VP_PID_AUTOTUNE_E1: sprintf_P(buf, PSTR("M303 E%d C5 S210 U1"), ExtUI::extruder_t::E1); + queue.enqueue_one_now(buf); break; #endif #endif #if ENABLED(PIDTEMPBED) case VP_PID_AUTOTUNE_BED: - strcpy_P(buf, PSTR("M303 E-1 C5 S70 U1")); + queue.enqueue_one_now(F("M303 E-1 C5 S70 U1")); break; #endif } - if (buf[0]) queue.enqueue_one_now(buf); - #if ENABLED(DGUS_UI_WAITING) sendinfoscreen(F("PID is autotuning"), F("please wait"), NUL_STR, NUL_STR, true, true, true, true); GotoScreen(DGUSLCD_SCREEN_WAITING); diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/printing_dialog_box.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/printing_dialog_box.cpp index 79a49c79a631..4af38dcb9df7 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/printing_dialog_box.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/printing_dialog_box.cpp @@ -32,12 +32,12 @@ using namespace Theme; #define GRID_COLS 2 #define GRID_ROWS 9 -void BioPrintingDialogBox::draw_status_message(draw_mode_t what, const char *message) { +void BioPrintingDialogBox::draw_status_message(draw_mode_t what, const char *cmsg) { if (what & BACKGROUND) { CommandProcessor cmd; cmd.cmd(COLOR_RGB(bg_text_enabled)) .tag(0); - draw_text_box(cmd, BTN_POS(1,2), BTN_SIZE(2,2), message, OPT_CENTER, font_large); + draw_text_box(cmd, BTN_POS(1,2), BTN_SIZE(2,2), cmsg, OPT_CENTER, font_large); } } @@ -105,26 +105,30 @@ bool BioPrintingDialogBox::onTouchEnd(uint8_t tag) { return true; } -void BioPrintingDialogBox::setStatusMessage(FSTR_P message) { - char buff[strlen_P(FTOP(message)) + 1]; - strcpy_P(buff, FTOP(message)); - setStatusMessage(buff); +void BioPrintingDialogBox::setStatusMessage(FSTR_P fmsg) { + #ifdef __AVR__ + char buff[strlen_P(FTOP(fmsg)) + 1]; + strcpy_P(buff, FTOP(fmsg)); + setStatusMessage(buff); + #else + setStatusMessage(FTOP(fmsg)); + #endif } -void BioPrintingDialogBox::setStatusMessage(const char *message) { +void BioPrintingDialogBox::setStatusMessage(const char *cmsg) { CommandProcessor cmd; cmd.cmd(CMD_DLSTART) .cmd(CLEAR_COLOR_RGB(bg_color)) .cmd(CLEAR(true,true,true)); - draw_status_message(BACKGROUND, message); + draw_status_message(BACKGROUND, cmsg); draw_progress(BACKGROUND); draw_time_remaining(BACKGROUND); draw_interaction_buttons(BACKGROUND); storeBackground(); #if ENABLED(TOUCH_UI_DEBUG) - SERIAL_ECHO_MSG("New status message: ", message); + SERIAL_ECHO_MSG("New status message: ", cmsg); #endif if (AT_SCREEN(BioPrintingDialogBox)) diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/status_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/status_screen.cpp index a6674bed90b6..9fb56bce11f7 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/status_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/status_screen.cpp @@ -122,7 +122,7 @@ void StatusScreen::draw_temperature(draw_mode_t what) { ui.bounds(POLY(bed_temp), x, y, h, v); cmd.text(x, y, h, v, str); - #endif + #endif } } @@ -354,8 +354,8 @@ bool StatusScreen::onTouchHeld(uint8_t tag) { return false; } -void StatusScreen::setStatusMessage(FSTR_P pstr) { - BioPrintingDialogBox::setStatusMessage(pstr); +void StatusScreen::setStatusMessage(FSTR_P fstr) { + BioPrintingDialogBox::setStatusMessage(fstr); } void StatusScreen::setStatusMessage(const char * const str) { diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_box.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_box.cpp index c75cdf18121a..d2f95d1f6e79 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_box.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_box.cpp @@ -136,9 +136,13 @@ namespace FTDI { } void draw_text_box(CommandProcessor& cmd, int x, int y, int w, int h, FSTR_P fstr, uint16_t options, uint8_t font) { - char str[strlen_P(FTOP(fstr)) + 1]; - strcpy_P(str, FTOP(fstr)); - draw_text_box(cmd, x, y, w, h, (const char*) str, options, font); + #ifdef __AVR__ + char str[strlen_P(FTOP(fstr)) + 1]; + strcpy_P(str, FTOP(fstr)); + draw_text_box(cmd, x, y, w, h, (const char*) str, options, font); + #else + draw_text_box(cmd, x, y, w, h, FTOP(fstr), options, font); + #endif } } // namespace FTDI diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/unicode.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/unicode.cpp index ab52a59b9acc..6f189155f5de 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/unicode.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/unicode.cpp @@ -192,9 +192,13 @@ } uint16_t FTDI::get_utf8_text_width(FSTR_P fstr, font_size_t fs) { - char str[strlen_P(FTOP(fstr)) + 1]; - strcpy_P(str, FTOP(fstr)); - return get_utf8_text_width(str, fs); + #ifdef __AVR__ + char str[strlen_P(FTOP(fstr)) + 1]; + strcpy_P(str, FTOP(fstr)); + return get_utf8_text_width(str, fs); + #else + return get_utf8_text_width(FTOP(fstr), fs); + #endif } /** diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/dialog_box_base_class.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/dialog_box_base_class.cpp index b6f69bc33e95..a006d30942d9 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/dialog_box_base_class.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/dialog_box_base_class.cpp @@ -32,7 +32,7 @@ using namespace Theme; #define GRID_ROWS 8 template -void DialogBoxBaseClass::drawMessage(T message, int16_t font) { +void DialogBoxBaseClass::drawMessage(T message, const int16_t font) { CommandProcessor cmd; cmd.cmd(CMD_DLSTART) .cmd(CLEAR_COLOR_RGB(bg_color)) @@ -43,8 +43,7 @@ void DialogBoxBaseClass::drawMessage(T message, int16_t font) { cmd.colors(normal_btn); } -template void DialogBoxBaseClass::drawMessage(const char *, int16_t font); -template void DialogBoxBaseClass::drawMessage(FSTR_P, int16_t font); +template void DialogBoxBaseClass::drawMessage(PGM_P const, const int16_t); void DialogBoxBaseClass::drawYesNoButtons(uint8_t default_btn) { CommandProcessor cmd; diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/dialog_box_base_class.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/dialog_box_base_class.h index c87640992866..fc05560b8cac 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/dialog_box_base_class.h +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/dialog_box_base_class.h @@ -27,12 +27,15 @@ class DialogBoxBaseClass : public BaseScreen { protected: - template static void drawMessage(T, int16_t font = 0); + template static void drawMessage(T, const int16_t font=0); + static void drawMessage(FSTR_P const fstr, const int16_t font=0) { drawMessage(FTOP(fstr), font); } + template static void drawButton(T); static void drawYesNoButtons(uint8_t default_btn = 0); static void drawOkayButton(); - static void onRedraw(draw_mode_t) {}; + static void onRedraw(draw_mode_t) {} + public: static bool onTouchEnd(uint8_t tag); static void onIdle(); diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/status_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/status_screen.cpp index 43f33fb3bf0b..f1c65357e017 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/status_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/status_screen.cpp @@ -332,10 +332,14 @@ void StatusScreen::draw_status_message(draw_mode_t what, const char *message) { } } -void StatusScreen::setStatusMessage(FSTR_P message) { - char buff[strlen_P(FTOP(message)) + 1]; - strcpy_P(buff, FTOP(message)); - setStatusMessage((const char *) buff); +void StatusScreen::setStatusMessage(FSTR_P fmsg) { + #ifdef __AVR__ + char buff[strlen_P(FTOP(fmsg)) + 1]; + strcpy_P(buff, FTOP(fmsg)); + setStatusMessage((const char *)buff); + #else + setStatusMessage(FTOP(fmsg)); + #endif } void StatusScreen::setStatusMessage(const char *message) { diff --git a/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp b/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp index c679751ebe90..00bb9833fc72 100644 --- a/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp +++ b/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp @@ -711,12 +711,16 @@ void disp_assets_update() { } void disp_assets_update_progress(FSTR_P const fmsg) { - static constexpr int buflen = 30; - char buf[buflen]; - memset(buf, ' ', buflen); - strncpy_P(buf, FTOP(fmsg), buflen - 1); - buf[buflen - 1] = '\0'; - disp_string(100, 165, buf, 0xFFFF, 0x0000); + #ifdef __AVR__ + static constexpr int buflen = 30; + char buf[buflen]; + memset(buf, ' ', buflen); + strncpy_P(buf, FTOP(fmsg), buflen - 1); + buf[buflen - 1] = '\0'; + disp_string(100, 165, buf, 0xFFFF, 0x0000); + #else + disp_string(100, 165, FTOP(fmsg), 0xFFFF, 0x0000); + #endif } #if BOTH(MKS_TEST, SDSUPPORT) diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index 143f240c2d53..68b0a81fe514 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -1112,15 +1112,23 @@ namespace ExtUI { // Simplest approach is to make an SRAM copy void onUserConfirmRequired(FSTR_P const fstr) { - char msg[strlen_P(FTOP(fstr)) + 1]; - strcpy_P(msg, FTOP(fstr)); - onUserConfirmRequired(msg); + #ifdef __AVR__ + char msg[strlen_P(FTOP(fstr)) + 1]; + strcpy_P(msg, FTOP(fstr)); + onUserConfirmRequired(msg); + #else + onUserConfirmRequired(FTOP(fstr)); + #endif } void onStatusChanged(FSTR_P const fstr) { - char msg[strlen_P(FTOP(fstr)) + 1]; - strcpy_P(msg, FTOP(fstr)); - onStatusChanged(msg); + #ifdef __AVR__ + char msg[strlen_P(FTOP(fstr)) + 1]; + strcpy_P(msg, FTOP(fstr)); + onStatusChanged(msg); + #else + onStatusChanged(FTOP(fstr)); + #endif } FileList::FileList() { refresh(); } diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index 3e88f68690a6..b65214f7b572 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -113,11 +113,15 @@ class MenuItem_confirm : public MenuItemBase { static void select_screen( FSTR_P const yes, FSTR_P const no, selectFunc_t yesFunc, selectFunc_t noFunc, - FSTR_P const pref, FSTR_P const string, FSTR_P const suff=nullptr + FSTR_P const pref, FSTR_P const fstr, FSTR_P const suff=nullptr ) { - char str[strlen_P(FTOP(string)) + 1]; - strcpy_P(str, FTOP(string)); - select_screen(yes, no, yesFunc, noFunc, pref, str, suff); + #ifdef __AVR__ + char str[strlen_P(FTOP(fstr)) + 1]; + strcpy_P(str, FTOP(fstr)); + select_screen(yes, no, yesFunc, noFunc, pref, str, suff); + #else + select_screen(yes, no, yesFunc, noFunc, pref, FTOP(fstr), suff); + #endif } // Shortcut for prompt with "NO"/ "YES" labels FORCE_INLINE static void confirm_screen(selectFunc_t yesFunc, selectFunc_t noFunc, FSTR_P const pref, const char * const string=nullptr, FSTR_P const suff=nullptr) { diff --git a/Marlin/src/lcd/tft/ui_1024x600.cpp b/Marlin/src/lcd/tft/ui_1024x600.cpp index a1b6ee69e3b2..15a51f56b8ec 100644 --- a/Marlin/src/lcd/tft/ui_1024x600.cpp +++ b/Marlin/src/lcd/tft/ui_1024x600.cpp @@ -271,19 +271,25 @@ void MarlinUI::draw_status_screen() { else { tft.add_text(200, 3, COLOR_AXIS_HOMED , "X"); const bool nhx = axis_should_home(X_AXIS); - tft_string.set(blink && nhx ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x))); + if (blink && nhx) + tft_string.set('?'); + else + tft_string.set(ftostr4sign(LOGICAL_X_POSITION(current_position.x))); tft.add_text(300 - tft_string.width(), 3, nhx ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string); tft.add_text(500, 3, COLOR_AXIS_HOMED , "Y"); const bool nhy = axis_should_home(Y_AXIS); - tft_string.set(blink && nhy ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y))); + if (blink && nhy) + tft_string.set('?'); + else + tft_string.set(ftostr4sign(LOGICAL_Y_POSITION(current_position.y))); tft.add_text(600 - tft_string.width(), 3, nhy ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string); } tft.add_text(800, 3, COLOR_AXIS_HOMED , "Z"); uint16_t offset = 32; const bool nhz = axis_should_home(Z_AXIS); if (blink && nhz) - tft_string.set("?"); + tft_string.set('?'); else { const float z = LOGICAL_Z_POSITION(current_position.z); tft_string.set(ftostr52sp((int16_t)z)); @@ -479,7 +485,7 @@ void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, con tft_string.add(' '); tft_string.add(i16tostr3rj(thermalManager.wholeDegHotend(extruder))); tft_string.add(LCD_STR_DEGREE); - tft_string.add(" / "); + tft_string.add(F(" / ")); tft_string.add(i16tostr3rj(thermalManager.degTargetHotend(extruder))); tft_string.add(LCD_STR_DEGREE); tft_string.trim(); @@ -607,19 +613,19 @@ static void quick_feedback() { #define CUR_STEP_VALUE_WIDTH 104 static void drawCurStepValue() { tft_string.set(ftostr52sp(motionAxisState.currentStepSize)); - tft_string.add("mm"); + tft_string.add(F("mm")); tft.canvas(motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT); tft.set_background(COLOR_BACKGROUND); tft.add_text(tft_string.center(CUR_STEP_VALUE_WIDTH), 0, COLOR_AXIS_HOMED, tft_string); } static void drawCurZSelection() { - tft_string.set("Z"); + tft_string.set('Z'); tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y, tft_string.width(), 34); tft.set_background(COLOR_BACKGROUND); tft.add_text(0, 0, Z_BTN_COLOR, tft_string); tft.queue.sync(); - tft_string.set("Offset"); + tft_string.set(F("Offset")); tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y + 34, tft_string.width(), 34); tft.set_background(COLOR_BACKGROUND); if (motionAxisState.z_selection == Z_SELECTION_Z_PROBE) { @@ -630,17 +636,19 @@ static void drawCurZSelection() { static void drawCurESelection() { tft.canvas(motionAxisState.eNamePos.x, motionAxisState.eNamePos.y, BTN_WIDTH, BTN_HEIGHT); tft.set_background(COLOR_BACKGROUND); - tft_string.set("E"); + tft_string.set('E'); tft.add_text(0, 0, E_BTN_COLOR , tft_string); tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection)); } -static void drawMessage(const char *msg) { +static void drawMessage(PGM_P const msg) { tft.canvas(X_MARGIN, TFT_HEIGHT - Y_MARGIN - 34, TFT_HEIGHT / 2, 34); tft.set_background(COLOR_BACKGROUND); tft.add_text(0, 0, COLOR_YELLOW, msg); } +static void drawMessage(FSTR_P const fmsg) { drawMessage(FTOP(fmsg)); } + static void drawAxisValue(const AxisEnum axis) { const float value = ( TERN_(HAS_BED_PROBE, axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE ? probe.offset.z :) @@ -666,7 +674,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { #if ENABLED(PREVENT_COLD_EXTRUSION) if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) { - drawMessage("Too cold"); + drawMessage(F("Too cold")); return; } #endif diff --git a/Marlin/src/lcd/tft/ui_320x240.cpp b/Marlin/src/lcd/tft/ui_320x240.cpp index 15031d0da2ec..a4fcc35bd039 100644 --- a/Marlin/src/lcd/tft/ui_320x240.cpp +++ b/Marlin/src/lcd/tft/ui_320x240.cpp @@ -282,7 +282,7 @@ void MarlinUI::draw_status_screen() { const bool nhz = axis_should_home(Z_AXIS); uint16_t offset = 25; if (blink && nhz) - tft_string.set("?"); + tft_string.set('?'); else { const float z = LOGICAL_Z_POSITION(current_position.z); tft_string.set(ftostr52sp((int16_t)z)); @@ -461,7 +461,7 @@ void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, con tft_string.add(' '); tft_string.add(i16tostr3rj(thermalManager.wholeDegHotend(extruder))); tft_string.add(LCD_STR_DEGREE); - tft_string.add(" / "); + tft_string.add(F(" / ")); tft_string.add(i16tostr3rj(thermalManager.degTargetHotend(extruder))); tft_string.add(LCD_STR_DEGREE); tft_string.trim(); @@ -593,19 +593,19 @@ static void drawCurStepValue() { tft.set_background(COLOR_BACKGROUND); tft.add_text(CUR_STEP_VALUE_WIDTH - tft_string.width(), 0, COLOR_AXIS_HOMED, tft_string); tft.queue.sync(); - tft_string.set("mm"); + tft_string.set(F("mm")); tft.canvas(motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y + 20, CUR_STEP_VALUE_WIDTH, 20); tft.set_background(COLOR_BACKGROUND); tft.add_text(CUR_STEP_VALUE_WIDTH - tft_string.width(), 0, COLOR_AXIS_HOMED, tft_string); } static void drawCurZSelection() { - tft_string.set("Z"); + tft_string.set('Z'); tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y, tft_string.width(), 20); tft.set_background(COLOR_BACKGROUND); tft.add_text(0, 0, Z_BTN_COLOR, tft_string); tft.queue.sync(); - tft_string.set("Offset"); + tft_string.set(F("Offset")); tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y + 34, tft_string.width(), 20); tft.set_background(COLOR_BACKGROUND); if (motionAxisState.z_selection == Z_SELECTION_Z_PROBE) { @@ -616,7 +616,7 @@ static void drawCurZSelection() { static void drawCurESelection() { tft.canvas(motionAxisState.eNamePos.x, motionAxisState.eNamePos.y, BTN_WIDTH, BTN_HEIGHT); tft.set_background(COLOR_BACKGROUND); - tft_string.set("E"); + tft_string.set('E'); tft.add_text(0, 0, E_BTN_COLOR , tft_string); tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection)); } @@ -627,6 +627,8 @@ static void drawMessage(PGM_P const msg) { tft.add_text(0, 0, COLOR_YELLOW, msg); } +static void drawMessage(FSTR_P const fmsg) { drawMessage(FTOP(fmsg)); } + static void drawAxisValue(const AxisEnum axis) { const float value = ( TERN_(HAS_BED_PROBE, axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE ? probe.offset.z :) @@ -652,7 +654,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { #if ENABLED(PREVENT_COLD_EXTRUSION) if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) { - drawMessage(PSTR("Too cold")); + drawMessage(F("Too cold")); return; } #endif @@ -679,18 +681,18 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { drawAxisValue(axis); } else { - drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS)); + drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS)); } #elif HAS_BED_PROBE // only change probe.offset.z probe.offset.z += diff; if (direction < 0 && current_position[axis] < Z_PROBE_OFFSET_RANGE_MIN) { current_position[axis] = Z_PROBE_OFFSET_RANGE_MIN; - drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS)); + drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS)); } else if (direction > 0 && current_position[axis] > Z_PROBE_OFFSET_RANGE_MAX) { current_position[axis] = Z_PROBE_OFFSET_RANGE_MAX; - drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS)); + drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS)); } else { drawMessage(NUL_STR); // clear the error @@ -752,7 +754,7 @@ static void z_minus() { moveAxis(Z_AXIS, -1); } static void do_home() { quick_feedback(); - drawMessage(GET_TEXT(MSG_LEVEL_BED_HOMING)); + drawMessage(GET_TEXT_F(MSG_LEVEL_BED_HOMING)); queue.inject_P(G28_STR); // Disable touch until home is done TERN_(HAS_TFT_XPT2046, touch.disable()); diff --git a/Marlin/src/lcd/tft/ui_480x320.cpp b/Marlin/src/lcd/tft/ui_480x320.cpp index 5a964525ecd1..8a5fa6335420 100644 --- a/Marlin/src/lcd/tft/ui_480x320.cpp +++ b/Marlin/src/lcd/tft/ui_480x320.cpp @@ -283,7 +283,7 @@ void MarlinUI::draw_status_screen() { uint16_t offset = 32; const bool nhz = axis_should_home(Z_AXIS); if (blink && nhz) - tft_string.set("?"); + tft_string.set('?'); else { const float z = LOGICAL_Z_POSITION(current_position.z); tft_string.set(ftostr52sp((int16_t)z)); @@ -466,7 +466,7 @@ void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, con tft_string.add(' '); tft_string.add(i16tostr3rj(thermalManager.wholeDegHotend(extruder))); tft_string.add(LCD_STR_DEGREE); - tft_string.add(" / "); + tft_string.add(F(" / ")); tft_string.add(i16tostr3rj(thermalManager.degTargetHotend(extruder))); tft_string.add(LCD_STR_DEGREE); tft_string.trim(); @@ -594,19 +594,19 @@ static void quick_feedback() { #define CUR_STEP_VALUE_WIDTH 104 static void drawCurStepValue() { tft_string.set(ftostr52sp(motionAxisState.currentStepSize)); - tft_string.add("mm"); + tft_string.add(F("mm")); tft.canvas(motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT); tft.set_background(COLOR_BACKGROUND); tft.add_text(tft_string.center(CUR_STEP_VALUE_WIDTH), 0, COLOR_AXIS_HOMED, tft_string); } static void drawCurZSelection() { - tft_string.set("Z"); + tft_string.set('Z'); tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y, tft_string.width(), 34); tft.set_background(COLOR_BACKGROUND); tft.add_text(0, 0, Z_BTN_COLOR, tft_string); tft.queue.sync(); - tft_string.set("Offset"); + tft_string.set(F("Offset")); tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y + 34, tft_string.width(), 34); tft.set_background(COLOR_BACKGROUND); if (motionAxisState.z_selection == Z_SELECTION_Z_PROBE) { @@ -617,7 +617,7 @@ static void drawCurZSelection() { static void drawCurESelection() { tft.canvas(motionAxisState.eNamePos.x, motionAxisState.eNamePos.y, BTN_WIDTH, BTN_HEIGHT); tft.set_background(COLOR_BACKGROUND); - tft_string.set("E"); + tft_string.set('E'); tft.add_text(0, 0, E_BTN_COLOR , tft_string); tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection)); } @@ -628,6 +628,8 @@ static void drawMessage(PGM_P const msg) { tft.add_text(0, 0, COLOR_YELLOW, msg); } +static void drawMessage(FSTR_P const fmsg) { drawMessage(FTOP(fmsg)); } + static void drawAxisValue(const AxisEnum axis) { const float value = ( TERN_(HAS_BED_PROBE, axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE ? probe.offset.z :) @@ -653,7 +655,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { #if ENABLED(PREVENT_COLD_EXTRUSION) if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) { - drawMessage(PSTR("Too cold")); + drawMessage(F("Too cold")); return; } #endif @@ -680,18 +682,18 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { drawAxisValue(axis); } else { - drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS)); + drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS)); } #elif HAS_BED_PROBE // only change probe.offset.z probe.offset.z += diff; if (direction < 0 && current_position[axis] < Z_PROBE_OFFSET_RANGE_MIN) { current_position[axis] = Z_PROBE_OFFSET_RANGE_MIN; - drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS)); + drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS)); } else if (direction > 0 && current_position[axis] > Z_PROBE_OFFSET_RANGE_MAX) { current_position[axis] = Z_PROBE_OFFSET_RANGE_MAX; - drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS)); + drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS)); } else { drawMessage(NUL_STR); // clear the error @@ -753,7 +755,7 @@ static void z_minus() { moveAxis(Z_AXIS, -1); } static void do_home() { quick_feedback(); - drawMessage(GET_TEXT(MSG_LEVEL_BED_HOMING)); + drawMessage(GET_TEXT_F(MSG_LEVEL_BED_HOMING)); queue.inject_P(G28_STR); // Disable touch until home is done TERN_(HAS_TFT_XPT2046, touch.disable()); From e1b22a5c75703910c426442640ef9fa06a842142 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Mon, 13 Jun 2022 19:04:49 -0700 Subject: [PATCH 166/241] =?UTF-8?q?=F0=9F=91=B7=20Use=20Biqu=20BX=20for=20?= =?UTF-8?q?CI=20test=20(#24331)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/tests/BTT_SKR_SE_BX | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/buildroot/tests/BTT_SKR_SE_BX b/buildroot/tests/BTT_SKR_SE_BX index b5d6f6de8398..199cff14b9b0 100755 --- a/buildroot/tests/BTT_SKR_SE_BX +++ b/buildroot/tests/BTT_SKR_SE_BX @@ -9,10 +9,8 @@ set -e # # Build with the default configurations # -restore_configs -opt_set MOTHERBOARD BOARD_BTT_SKR_SE_BX -opt_set SERIAL_PORT 1 -exec_test $1 $2 "Default Configuration" "$3" +use_example_configs BIQU/BX +exec_test $1 $2 "BIQU/BX" "$3" # clean up restore_configs From 873f6c0b6365688b3be79dd99dea5104dfef7c67 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 14 Jun 2022 06:05:52 +0000 Subject: [PATCH 167/241] [cron] Bump distribution date (2022-06-14) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 2613432af8b7..be61743b942a 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-06-11" +//#define STRING_DISTRIBUTION_DATE "2022-06-14" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 648cfdb4cfbf..98c92ca13957 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-06-11" + #define STRING_DISTRIBUTION_DATE "2022-06-14" #endif /** From 70eac0fe4faa4b56a700c562370f76dde56a9346 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Wed, 15 Jun 2022 20:02:32 +1200 Subject: [PATCH 168/241] =?UTF-8?q?=F0=9F=91=B7=20CI=20test=20without=20sr?= =?UTF-8?q?c=20filter=20(emulate=20Arduino)=20(#24335)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/bin/ci_src_filter | 14 ++++++++++++++ buildroot/tests/mega2560 | 8 ++++++++ 2 files changed, 22 insertions(+) create mode 100755 buildroot/bin/ci_src_filter diff --git a/buildroot/bin/ci_src_filter b/buildroot/bin/ci_src_filter new file mode 100755 index 000000000000..928f492e69fa --- /dev/null +++ b/buildroot/bin/ci_src_filter @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# exit on first failure +set -e + +SED=$(which gsed sed | head -n1) +FN="platformio.ini" + +if [[ $1 == "-n" ]]; then + "${SED}" -i "s/default_src_filter/org_src_filter/" $FN + "${SED}" -i "/org_src_filter/ s/^/default_src_filter = +\n/" $FN +else + git checkout $FN 2>/dev/null +fi diff --git a/buildroot/tests/mega2560 b/buildroot/tests/mega2560 index fc24cf212509..6871ce4a0cef 100755 --- a/buildroot/tests/mega2560 +++ b/buildroot/tests/mega2560 @@ -12,6 +12,14 @@ set -e #restore_configs #exec_test $1 $2 "Default Configuration" "$3" +# +# Build with no source filers +# +restore_configs +ci_src_filter -n +exec_test $1 $2 "Default Configuration | no source filtering" "$3" +ci_src_filter -y + # # Test a probeless build of AUTO_BED_LEVELING_UBL, with lots of extruders # From 0a3c42a87c24ff3b5b184f211d5b2549083b61a5 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Wed, 15 Jun 2022 12:07:28 +0000 Subject: [PATCH 169/241] [cron] Bump distribution date (2022-06-15) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index be61743b942a..57ed411fda57 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-06-14" +//#define STRING_DISTRIBUTION_DATE "2022-06-15" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 98c92ca13957..dbfd243013b4 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-06-14" + #define STRING_DISTRIBUTION_DATE "2022-06-15" #endif /** From 1a6a6043102dd27a6107a62993638b4d2b02a4e5 Mon Sep 17 00:00:00 2001 From: tombrazier <68918209+tombrazier@users.noreply.github.com> Date: Sat, 18 Jun 2022 05:17:12 +0100 Subject: [PATCH 170/241] =?UTF-8?q?=F0=9F=90=9B=20Fix=20G2/G3=20Arcs=20stu?= =?UTF-8?q?tter=20/=20JD=20speed=20(#24362)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/motion/G2_G3.cpp | 197 +++++++++++++++--------------- 1 file changed, 97 insertions(+), 100 deletions(-) diff --git a/Marlin/src/gcode/motion/G2_G3.cpp b/Marlin/src/gcode/motion/G2_G3.cpp index dd1c1d14708f..cd8225de6902 100644 --- a/Marlin/src/gcode/motion/G2_G3.cpp +++ b/Marlin/src/gcode/motion/G2_G3.cpp @@ -197,8 +197,8 @@ void plan_arc( // Feedrate for the move, scaled by the feedrate multiplier const feedRate_t scaled_fr_mm_s = MMS_SCALED(feedrate_mm_s); - // Get the nominal segment length based on settings - const float nominal_segment_mm = ( + // Get the ideal segment length for the move based on settings + const float ideal_segment_mm = ( #if ARC_SEGMENTS_PER_SEC // Length based on segments per second and feedrate constrain(scaled_fr_mm_s * RECIPROCAL(ARC_SEGMENTS_PER_SEC), MIN_ARC_SEGMENT_MM, MAX_ARC_SEGMENT_MM) #else @@ -206,19 +206,18 @@ void plan_arc( #endif ); - // Number of whole segments based on the nominal segment length - const float nominal_segments = _MAX(FLOOR(flat_mm / nominal_segment_mm), min_segments); + // Number of whole segments based on the ideal segment length + const float nominal_segments = _MAX(FLOOR(flat_mm / ideal_segment_mm), min_segments), + nominal_segment_mm = flat_mm / nominal_segments; - // A new segment length based on the required minimum - const float segment_mm = constrain(flat_mm / nominal_segments, MIN_ARC_SEGMENT_MM, MAX_ARC_SEGMENT_MM); + // The number of whole segments in the arc, with best attempt to honor MIN_ARC_SEGMENT_MM and MAX_ARC_SEGMENT_MM + const uint16_t segments = nominal_segment_mm > (MAX_ARC_SEGMENT_MM) ? CEIL(flat_mm / (MAX_ARC_SEGMENT_MM)) : + nominal_segment_mm < (MIN_ARC_SEGMENT_MM) ? _MAX(1, FLOOR(flat_mm / (MIN_ARC_SEGMENT_MM))) : + nominal_segments; - // The number of whole segments in the arc, ignoring the remainder - uint16_t segments = FLOOR(flat_mm / segment_mm); - - // Are the segments now too few to reach the destination? - const float segmented_length = segment_mm * segments; - const bool tooshort = segmented_length < flat_mm - 0.0001f; - const float proportion = tooshort ? segmented_length / flat_mm : 1.0f; + #if ENABLED(SCARA_FEEDRATE_SCALING) + const float inv_duration = (scaled_fr_mm_s / flat_mm) * segments; + #endif /** * Vector rotation by transformation matrix: r is the original vector, r_T is the rotated vector, @@ -246,108 +245,106 @@ void plan_arc( * a correction, the planner should have caught up to the lag caused by the initial plan_arc overhead. * This is important when there are successive arc motions. */ - // Vector rotation matrix values - xyze_pos_t raw; - const float theta_per_segment = proportion * angular_travel / segments, - sq_theta_per_segment = sq(theta_per_segment), - sin_T = theta_per_segment - sq_theta_per_segment * theta_per_segment / 6, - cos_T = 1 - 0.5f * sq_theta_per_segment; // Small angle approximation - - #if DISABLED(AUTO_BED_LEVELING_UBL) - ARC_LIJKUVW_CODE( - const float per_segment_L = proportion * travel_L / segments, - const float per_segment_I = proportion * travel_I / segments, - const float per_segment_J = proportion * travel_J / segments, - const float per_segment_K = proportion * travel_K / segments, - const float per_segment_U = proportion * travel_U / segments, - const float per_segment_V = proportion * travel_V / segments, - const float per_segment_W = proportion * travel_W / segments - ); - #endif - CODE_ITEM_E(const float extruder_per_segment = proportion * travel_E / segments); - - // For shortened segments, run all but the remainder in the loop - if (tooshort) segments++; + xyze_pos_t raw; - // Initialize all linear axes and E - ARC_LIJKUVWE_CODE( - raw[axis_l] = current_position[axis_l], - raw.i = current_position.i, - raw.j = current_position.j, - raw.k = current_position.k, - raw.u = current_position.u, - raw.v = current_position.v, - raw.w = current_position.w, - raw.e = current_position.e - ); + // do not calculate rotation parameters for trivial single-segment arcs + if (segments > 1) { + // Vector rotation matrix values + const float theta_per_segment = angular_travel / segments, + sq_theta_per_segment = sq(theta_per_segment), + sin_T = theta_per_segment - sq_theta_per_segment * theta_per_segment / 6, + cos_T = 1 - 0.5f * sq_theta_per_segment; // Small angle approximation + + #if DISABLED(AUTO_BED_LEVELING_UBL) + ARC_LIJKUVW_CODE( + const float per_segment_L = travel_L / segments, + const float per_segment_I = travel_I / segments, + const float per_segment_J = travel_J / segments, + const float per_segment_K = travel_K / segments, + const float per_segment_U = travel_U / segments, + const float per_segment_V = travel_V / segments, + const float per_segment_W = travel_W / segments + ); + #endif - #if ENABLED(SCARA_FEEDRATE_SCALING) - const float inv_duration = scaled_fr_mm_s / segment_mm; - #endif + CODE_ITEM_E(const float extruder_per_segment = travel_E / segments); - millis_t next_idle_ms = millis() + 200UL; + // Initialize all linear axes and E + ARC_LIJKUVWE_CODE( + raw[axis_l] = current_position[axis_l], + raw.i = current_position.i, + raw.j = current_position.j, + raw.k = current_position.k, + raw.u = current_position.u, + raw.v = current_position.v, + raw.w = current_position.w, + raw.e = current_position.e + ); - #if N_ARC_CORRECTION > 1 - int8_t arc_recalc_count = N_ARC_CORRECTION; - #endif + millis_t next_idle_ms = millis() + 200UL; - for (uint16_t i = 1; i < segments; i++) { // Iterate (segments-1) times + #if N_ARC_CORRECTION > 1 + int8_t arc_recalc_count = N_ARC_CORRECTION; + #endif - thermalManager.manage_heater(); - const millis_t ms = millis(); - if (ELAPSED(ms, next_idle_ms)) { - next_idle_ms = ms + 200UL; - idle(); - } + for (uint16_t i = 1; i < segments; i++) { // Iterate (segments-1) times - #if N_ARC_CORRECTION > 1 - if (--arc_recalc_count) { - // Apply vector rotation matrix to previous rvec.a / 1 - const float r_new_Y = rvec.a * sin_T + rvec.b * cos_T; - rvec.a = rvec.a * cos_T - rvec.b * sin_T; - rvec.b = r_new_Y; + thermalManager.manage_heater(); + const millis_t ms = millis(); + if (ELAPSED(ms, next_idle_ms)) { + next_idle_ms = ms + 200UL; + idle(); } - else - #endif - { + #if N_ARC_CORRECTION > 1 - arc_recalc_count = N_ARC_CORRECTION; + if (--arc_recalc_count) { + // Apply vector rotation matrix to previous rvec.a / 1 + const float r_new_Y = rvec.a * sin_T + rvec.b * cos_T; + rvec.a = rvec.a * cos_T - rvec.b * sin_T; + rvec.b = r_new_Y; + } + else #endif + { + #if N_ARC_CORRECTION > 1 + arc_recalc_count = N_ARC_CORRECTION; + #endif + + // Arc correction to radius vector. Computed only every N_ARC_CORRECTION increments. + // Compute exact location by applying transformation matrix from initial radius vector(=-offset). + // To reduce stuttering, the sin and cos could be computed at different times. + // For now, compute both at the same time. + const float cos_Ti = cos(i * theta_per_segment), sin_Ti = sin(i * theta_per_segment); + rvec.a = -offset[0] * cos_Ti + offset[1] * sin_Ti; + rvec.b = -offset[0] * sin_Ti - offset[1] * cos_Ti; + } - // Arc correction to radius vector. Computed only every N_ARC_CORRECTION increments. - // Compute exact location by applying transformation matrix from initial radius vector(=-offset). - // To reduce stuttering, the sin and cos could be computed at different times. - // For now, compute both at the same time. - const float cos_Ti = cos(i * theta_per_segment), sin_Ti = sin(i * theta_per_segment); - rvec.a = -offset[0] * cos_Ti + offset[1] * sin_Ti; - rvec.b = -offset[0] * sin_Ti - offset[1] * cos_Ti; - } - - // Update raw location - raw[axis_p] = center_P + rvec.a; - raw[axis_q] = center_Q + rvec.b; - ARC_LIJKUVWE_CODE( - #if ENABLED(AUTO_BED_LEVELING_UBL) - raw[axis_l] = start_L, - raw.i = start_I, raw.j = start_J, raw.k = start_K, - raw.u = start_U, raw.v = start_V, raw.w = start_V - #else - raw[axis_l] += per_segment_L, - raw.i += per_segment_I, raw.j += per_segment_J, raw.k += per_segment_K, - raw.u += per_segment_U, raw.v += per_segment_V, raw.w += per_segment_W - #endif - , raw.e += extruder_per_segment - ); + // Update raw location + raw[axis_p] = center_P + rvec.a; + raw[axis_q] = center_Q + rvec.b; + ARC_LIJKUVWE_CODE( + #if ENABLED(AUTO_BED_LEVELING_UBL) + raw[axis_l] = start_L, + raw.i = start_I, raw.j = start_J, raw.k = start_K, + raw.u = start_U, raw.v = start_V, raw.w = start_V + #else + raw[axis_l] += per_segment_L, + raw.i += per_segment_I, raw.j += per_segment_J, raw.k += per_segment_K, + raw.u += per_segment_U, raw.v += per_segment_V, raw.w += per_segment_W + #endif + , raw.e += extruder_per_segment + ); - apply_motion_limits(raw); + apply_motion_limits(raw); - #if HAS_LEVELING && !PLANNER_LEVELING - planner.apply_leveling(raw); - #endif + #if HAS_LEVELING && !PLANNER_LEVELING + planner.apply_leveling(raw); + #endif - if (!planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, 0 OPTARG(SCARA_FEEDRATE_SCALING, inv_duration))) - break; + if (!planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, 0 OPTARG(SCARA_FEEDRATE_SCALING, inv_duration))) + break; + } } // Ensure last segment arrives at target location. From a526c3d77ac204e97505c2df4bd8734d56db18cf Mon Sep 17 00:00:00 2001 From: luzpaz Date: Sat, 18 Jun 2022 00:19:01 -0400 Subject: [PATCH 171/241] =?UTF-8?q?=F0=9F=8C=90=20Fix=20LCD=20string,=20ty?= =?UTF-8?q?pos=20(#24324)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.h | 4 ++-- Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.h b/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.h index 9ec2304a36aa..bdcd248dd6cd 100644 --- a/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.h +++ b/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.h @@ -680,8 +680,8 @@ constexpr uint16_t SP_T_Bed_Set = 0x5040; constexpr uint16_t VP_EX_TEMP_INFO2_Dis = 0x5620; constexpr uint16_t VP_EX_TEMP_INFO3_Dis = 0x5630; constexpr uint16_t VP_LCD_BLK_Dis = 0x56A0; - constexpr uint16_t VP_Info_PrinfFinsh_1_Dis = 0x5C00; - constexpr uint16_t VP_Info_PrinfFinsh_2_Dis = 0x5C10; + constexpr uint16_t VP_Info_PrintFinish_1_Dis = 0x5C00; + constexpr uint16_t VP_Info_PrintFinish_2_Dis = 0x5C10; constexpr uint16_t VP_Length_Dis = 0x5B00; diff --git a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp index 739265e49636..18ac433b719a 100644 --- a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp @@ -564,7 +564,7 @@ void DGUSScreenHandlerMKS::MeshLevel(DGUS_VP_Variable &var, void *val_ptr) { queue.enqueue_now(F("G29S2")); mesh_point_count--; if (mks_language_index == MKS_English) { - const char level_buf_en2[] = "Level Finsh"; + const char level_buf_en2[] = "Leveling Done"; dgusdisplay.WriteVariable(VP_AutoLevel_1_Dis, level_buf_en2, 32, true); } else if (mks_language_index == MKS_SimpleChinese) { @@ -1709,8 +1709,8 @@ void DGUSScreenHandlerMKS::DGUS_LanguageDisplay(uint8_t var) { const char Info_EEPROM_2_buf_en[] = "Revert setting?"; dgusdisplay.WriteVariable(VP_Info_EEPROM_2_Dis, Info_EEPROM_2_buf_en, 32, true); - const char Info_PrinfFinsh_1_buf_en[] = "Print Done"; - dgusdisplay.WriteVariable(VP_Info_PrinfFinsh_1_Dis, Info_PrinfFinsh_1_buf_en, 32, true); + const char Info_PrintFinish_1_buf_en[] = "Print Done"; + dgusdisplay.WriteVariable(VP_Info_PrintFinish_1_Dis, Info_PrintFinish_1_buf_en, 32, true); const char TMC_X_Step_buf_en[] = "X_SenSitivity"; dgusdisplay.WriteVariable(VP_TMC_X_Step_Dis, TMC_X_Step_buf_en, 32, true); @@ -1973,8 +1973,8 @@ void DGUSScreenHandlerMKS::DGUS_LanguageDisplay(uint8_t var) { const uint16_t TMC_Z_Step_buf_ch[] = { 0x205A, 0xE9C1, 0xF4C3, 0xC8B6, 0x2000 }; dgusdisplay.WriteVariable(VP_TMC_Z_Step_Dis, TMC_Z_Step_buf_ch, 16, true); - const uint16_t Info_PrinfFinsh_1_buf_ch[] = { 0xF2B4, 0xA1D3, 0xEACD, 0xC9B3, 0x2000 }; - dgusdisplay.WriteVariable(VP_Info_PrinfFinsh_1_Dis, Info_PrinfFinsh_1_buf_ch, 32, true); + const uint16_t Info_PrintFinish_1_buf_ch[] = { 0xF2B4, 0xA1D3, 0xEACD, 0xC9B3, 0x2000 }; + dgusdisplay.WriteVariable(VP_Info_PrintFinish_1_Dis, Info_PrintFinish_1_buf_ch, 32, true); const uint16_t TMC_X_Current_buf_ch[] = { 0x2058, 0xE1D6, 0xE7B5, 0xF7C1, 0x2000 }; dgusdisplay.WriteVariable(VP_TMC_X_Current_Dis, TMC_X_Current_buf_ch, 16, true); From 76f1f9d3b3fe97d3dfcd01adf29679e2d9e6b2af Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 18 Jun 2022 06:07:14 +0000 Subject: [PATCH 172/241] [cron] Bump distribution date (2022-06-18) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 57ed411fda57..3e6cf237e4a3 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-06-15" +//#define STRING_DISTRIBUTION_DATE "2022-06-18" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index dbfd243013b4..f7a5a3efca2b 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-06-15" + #define STRING_DISTRIBUTION_DATE "2022-06-18" #endif /** From 751c88aa5b5612c526ce6c0f7edd6ecaa0d791da Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 20 Jun 2022 21:08:31 -0500 Subject: [PATCH 173/241] =?UTF-8?q?=F0=9F=A9=B9=20M919=209-axis=20update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/feature/trinamic/M919.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Marlin/src/gcode/feature/trinamic/M919.cpp b/Marlin/src/gcode/feature/trinamic/M919.cpp index fa349e7f163b..0e9343f6999d 100644 --- a/Marlin/src/gcode/feature/trinamic/M919.cpp +++ b/Marlin/src/gcode/feature/trinamic/M919.cpp @@ -169,6 +169,15 @@ void GcodeSuite::M919() { #if AXIS_IS_TMC(K) case K_AXIS: TMC_SET_CHOPPER_TIME(K); break; #endif + #if AXIS_IS_TMC(U) + case U_AXIS: TMC_SET_CHOPPER_TIME(U); break; + #endif + #if AXIS_IS_TMC(V) + case V_AXIS: TMC_SET_CHOPPER_TIME(V); break; + #endif + #if AXIS_IS_TMC(W) + case W_AXIS: TMC_SET_CHOPPER_TIME(W); break; + #endif #if HAS_E_CHOPPER case E_AXIS: { @@ -236,6 +245,15 @@ void GcodeSuite::M919() { #if AXIS_IS_TMC(K) TMC_SAY_CHOPPER_TIME(K); #endif + #if AXIS_IS_TMC(U) + TMC_SAY_CHOPPER_TIME(U); + #endif + #if AXIS_IS_TMC(V) + TMC_SAY_CHOPPER_TIME(V); + #endif + #if AXIS_IS_TMC(W) + TMC_SAY_CHOPPER_TIME(W); + #endif #if AXIS_IS_TMC(E0) TMC_SAY_CHOPPER_TIME(E0); #endif From 6cbd7a48d16789fd73ab6ebe4be00bc2beff5591 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 20 Jun 2022 21:15:57 -0500 Subject: [PATCH 174/241] =?UTF-8?q?=F0=9F=8E=A8=20Fix=20comments,=20format?= =?UTF-8?q?ting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/macros.h | 5 +- .../ftdi_eve_touch_ui/ftdi_eve_lib/compat.h | 4 +- Marlin/src/lcd/marlinui.cpp | 11 ++-- Marlin/src/module/planner.cpp | 54 ++++++++++--------- Marlin/src/module/stepper/trinamic.cpp | 12 ++--- 5 files changed, 41 insertions(+), 45 deletions(-) diff --git a/Marlin/src/core/macros.h b/Marlin/src/core/macros.h index b7d1ac916eee..09a616456841 100644 --- a/Marlin/src/core/macros.h +++ b/Marlin/src/core/macros.h @@ -644,8 +644,8 @@ #define IS_PROBE(V...) SECOND(V, 0) // Get the second item passed, or 0 #define PROBE() ~, 1 // Second item will be 1 if this is passed #define _NOT_0 PROBE() -#define NOT(x) IS_PROBE(_CAT(_NOT_, x)) // NOT('0') gets '1'. Anything else gets '0'. -#define _BOOL(x) NOT(NOT(x)) // NOT('0') gets '0'. Anything else gets '1'. +#define NOT(x) IS_PROBE(_CAT(_NOT_, x)) // NOT('0') gets '1'. Anything else gets '0'. +#define _BOOL(x) NOT(NOT(x)) // _BOOL('0') gets '0'. Anything else gets '1'. #define IF_ELSE(TF) _IF_ELSE(_BOOL(TF)) #define _IF_ELSE(TF) _CAT(_IF_, TF) @@ -659,7 +659,6 @@ #define HAS_ARGS(V...) _BOOL(FIRST(_END_OF_ARGUMENTS_ V)()) #define _END_OF_ARGUMENTS_() 0 - // Simple Inline IF Macros, friendly to use in other macro definitions #define IF(O, A, B) ((O) ? (A) : (B)) #define IF_0(O, A) IF(O, A, 0) diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/compat.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/compat.h index da911c772daa..6b2dc9eb4498 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/compat.h +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/compat.h @@ -240,8 +240,8 @@ #define IS_PROBE(V...) SECOND(V, 0) // Get the second item passed, or 0 #define PROBE() ~, 1 // Second item will be 1 if this is passed #define _NOT_0 PROBE() - #define NOT(x) IS_PROBE(_CAT(_NOT_, x)) // NOT('0') gets '1'. Anything else gets '0'. - #define _BOOL(x) NOT(NOT(x)) // NOT('0') gets '0'. Anything else gets '1'. + #define NOT(x) IS_PROBE(_CAT(_NOT_, x)) // NOT('0') gets '1'. Anything else gets '0'. + #define _BOOL(x) NOT(NOT(x)) // _BOOL('0') gets '0'. Anything else gets '1'. #define _DO_1(W,C,A) (_##W##_1(A)) #define _DO_2(W,C,A,B) (_##W##_1(A) C _##W##_1(B)) diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 3976c48dc76b..2e59183b04c7 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -489,13 +489,10 @@ void MarlinUI::init() { ui.manual_move.menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP; ui.encoderPosition = dir; switch (axis) { - case X_AXIS: { void lcd_move_x(); lcd_move_x(); } break; - #if HAS_Y_AXIS - case Y_AXIS: { void lcd_move_y(); lcd_move_y(); } break; - #endif - #if HAS_Z_AXIS - case Z_AXIS: { void lcd_move_z(); lcd_move_z(); } break; - #endif + case X_AXIS: + TERN_(HAS_Y_AXIS, case Y_AXIS:) + TERN_(HAS_Z_AXIS, case Z_AXIS:) + lcd_move_axis(axis); default: break; } } diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 6aa363890e44..950f11f86244 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -2049,9 +2049,9 @@ bool Planner::_populate_block(block_t * const block, bool split_move, #endif #elif ENABLED(MARKFORGED_XY) steps_dist_mm.a = (da - db) * mm_per_step[A_AXIS]; - steps_dist_mm.b = db * mm_per_step[B_AXIS]; + steps_dist_mm.b = db * mm_per_step[B_AXIS]; #elif ENABLED(MARKFORGED_YX) - steps_dist_mm.a = da * mm_per_step[A_AXIS]; + steps_dist_mm.a = da * mm_per_step[A_AXIS]; steps_dist_mm.b = (db - da) * mm_per_step[B_AXIS]; #else XYZ_CODE( @@ -2097,12 +2097,21 @@ bool Planner::_populate_block(block_t * const block, bool split_move, block->millimeters = millimeters; else { /** - * Distance for interpretation of feedrate in accordance with LinuxCNC (the successor of NIST - * RS274NGC interpreter - version 3) and its default CANON_XYZ feed reference mode. - * Assume that X, Y, Z are the primary linear axes and U, V, W are secondary linear axes and A, B, C are - * rotational axes. Then dX, dY, dZ are the displacements of the primary linear axes and dU, dV, dW are the displacements of linear axes and - * dA, dB, dC are the displacements of rotational axes. - * The time it takes to execute move command with feedrate F is t = D/F, where D is the total distance, calculated as follows: + * Distance for interpretation of feedrate in accordance with LinuxCNC (the successor of + * NIST RS274NGC interpreter - version 3) and its default CANON_XYZ feed reference mode. + * + * Assume: + * - X, Y, Z are the primary linear axes; + * - U, V, W are secondary linear axes; + * - A, B, C are rotational axes. + * + * Then: + * - dX, dY, dZ are the displacements of the primary linear axes; + * - dU, dV, dW are the displacements of linear axes; + * - dA, dB, dC are the displacements of rotational axes. + * + * The time it takes to execute move command with feedrate F is t = D/F, + * where D is the total distance, calculated as follows: * D^2 = dX^2 + dY^2 + dZ^2 * if D^2 == 0 (none of XYZ move but any secondary linear axes move, whether other axes are moved or not): * D^2 = dU^2 + dV^2 + dW^2 @@ -2111,8 +2120,9 @@ bool Planner::_populate_block(block_t * const block, bool split_move, */ float distance_sqr = ( #if ENABLED(ARTICULATED_ROBOT_ARM) - // For articulated robots, interpreting feedrate like LinuxCNC would require inverse kinematics. As a workaround, pretend that motors sit on n mutually orthogonal - // axes and assume that we could think of distance as magnitude of an n-vector in an n-dimensional Euclidian space. + // For articulated robots, interpreting feedrate like LinuxCNC would require inverse kinematics. As a workaround, + // assume that motors sit on a mutually-orthogonal axes and we can think of distance as magnitude of an n-vector + // in an n-dimensional Euclidian space. NUM_AXIS_GANG( sq(steps_dist_mm.x), + sq(steps_dist_mm.y), + sq(steps_dist_mm.z), + sq(steps_dist_mm.i), + sq(steps_dist_mm.j), + sq(steps_dist_mm.k), @@ -2120,8 +2130,8 @@ bool Planner::_populate_block(block_t * const block, bool split_move, ); #elif ENABLED(FOAMCUTTER_XYUV) #if HAS_J_AXIS - // Special 5 axis kinematics. Return the largest distance move from either X/Y or I/J plane - _MAX(sq(steps_dist_mm.x) + sq(steps_dist_mm.y), sq(steps_dist_mm.i) + sq(steps_dist_mm.j)) + // Special 5 axis kinematics. Return the largest distance move from either X/Y or I/J plane + _MAX(sq(steps_dist_mm.x) + sq(steps_dist_mm.y), sq(steps_dist_mm.i) + sq(steps_dist_mm.j)) #else // Foamcutter with only two axes (XY) sq(steps_dist_mm.x) + sq(steps_dist_mm.y) #endif @@ -2132,7 +2142,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, #elif CORE_IS_YZ XYZ_GANG(sq(steps_dist_mm.x), + sq(steps_dist_mm.head.y), + sq(steps_dist_mm.head.z)) #else - XYZ_GANG(sq(steps_dist_mm.x), + sq(steps_dist_mm.y), + sq(steps_dist_mm.z)) + XYZ_GANG(sq(steps_dist_mm.x), + sq(steps_dist_mm.y), + sq(steps_dist_mm.z)) #endif ); @@ -2165,9 +2175,9 @@ bool Planner::_populate_block(block_t * const block, bool split_move, /** * At this point at least one of the axes has more steps than - * MIN_STEPS_PER_SEGMENT, ensuring the segment won't get dropped as - * zero-length. It's important to not apply corrections - * to blocks that would get dropped! + * MIN_STEPS_PER_SEGMENT, ensuring the segment won't get dropped + * as zero-length. It's important to not apply corrections to blocks + * that would get dropped! * * A correction function is permitted to add steps to an axis, it * should *never* remove steps! @@ -2203,15 +2213,9 @@ bool Planner::_populate_block(block_t * const block, bool split_move, #if ENABLED(AUTO_POWER_CONTROL) if (NUM_AXIS_GANG( - block->steps.x, - || block->steps.y, - || block->steps.z, - || block->steps.i, - || block->steps.j, - || block->steps.k, - || block->steps.u, - || block->steps.v, - || block->steps.w + block->steps.x, || block->steps.y, || block->steps.z, + || block->steps.i, || block->steps.j, || block->steps.k, + || block->steps.u, || block->steps.v, || block->steps.w )) powerManager.power_on(); #endif diff --git a/Marlin/src/module/stepper/trinamic.cpp b/Marlin/src/module/stepper/trinamic.cpp index 76373515569e..bf36f83cd872 100644 --- a/Marlin/src/module/stepper/trinamic.cpp +++ b/Marlin/src/module/stepper/trinamic.cpp @@ -1030,10 +1030,8 @@ void reset_trinamic_drivers() { // Using a fixed-length character array for the port name allows this to be constexpr compatible. struct SanityHwSerialDetails { const char port[20]; uint32_t address; }; #define TMC_HW_DETAIL_ARGS(A) TERN(A##_HAS_HW_SERIAL, STRINGIFY(A##_HARDWARE_SERIAL), ""), TERN0(A##_HAS_HW_SERIAL, A##_SLAVE_ADDRESS) - #define TMC_HW_DETAIL(A) { TMC_HW_DETAIL_ARGS(A) }, - constexpr SanityHwSerialDetails sanity_tmc_hw_details[] = { - MAP(TMC_HW_DETAIL, ALL_AXIS_NAMES) - }; + #define TMC_HW_DETAIL(A) { TMC_HW_DETAIL_ARGS(A) } + constexpr SanityHwSerialDetails sanity_tmc_hw_details[] = { MAPLIST(TMC_HW_DETAIL, ALL_AXIS_NAMES) }; // constexpr compatible string comparison constexpr bool str_eq_ce(const char * a, const char * b) { @@ -1057,10 +1055,8 @@ void reset_trinamic_drivers() { #if ANY_AXIS_HAS(SW_SERIAL) struct SanitySwSerialDetails { int32_t txpin; int32_t rxpin; uint32_t address; }; #define TMC_SW_DETAIL_ARGS(A) TERN(A##_HAS_SW_SERIAL, A##_SERIAL_TX_PIN, -1), TERN(A##_HAS_SW_SERIAL, A##_SERIAL_RX_PIN, -1), TERN0(A##_HAS_SW_SERIAL, A##_SLAVE_ADDRESS) - #define TMC_SW_DETAIL(A) TMC_SW_DETAIL_ARGS(A), - constexpr SanitySwSerialDetails sanity_tmc_sw_details[] = { - MAP(TMC_SW_DETAIL, ALL_AXIS_NAMES) - }; + #define TMC_SW_DETAIL(A) { TMC_SW_DETAIL_ARGS(A) } + constexpr SanitySwSerialDetails sanity_tmc_sw_details[] = { MAPLIST(TMC_SW_DETAIL, ALL_AXIS_NAMES) }; constexpr bool sc_sw_done(size_t start, size_t end) { return start == end; } constexpr bool sc_sw_skip(int32_t txpin) { return txpin < 0; } From 432c87932849463db323e856d67c8d03ae0978c3 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 20 Jun 2022 21:17:29 -0500 Subject: [PATCH 175/241] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Fix?= =?UTF-8?q?=20STATIC=5FITEM=5FN=20arg=20order?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/menu/menu.h | 1 + Marlin/src/lcd/menu/menu_item.h | 4 ++-- Marlin/src/lcd/menu/menu_led.cpp | 4 ++-- Marlin/src/lcd/menu/menu_motion.cpp | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index b65214f7b572..6f5a9efb1516 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -214,6 +214,7 @@ void menu_move(); //////// Menu Item Helper Functions //////// //////////////////////////////////////////// +void lcd_move_axis(const AxisEnum); void lcd_move_z(); void _lcd_draw_homing(); diff --git a/Marlin/src/lcd/menu/menu_item.h b/Marlin/src/lcd/menu/menu_item.h index b48eaf9bae06..77e6bcab7b1b 100644 --- a/Marlin/src/lcd/menu/menu_item.h +++ b/Marlin/src/lcd/menu/menu_item.h @@ -357,7 +357,7 @@ class MenuItem_bool : public MenuEditItemBase { NEXT_ITEM(); \ } while(0) -#define STATIC_ITEM_N_F(FLABEL, N, V...) do{ \ +#define STATIC_ITEM_N_F(N, FLABEL, V...) do{ \ if (_menuLineNr == _thisItemNr) { \ MenuItemBase::init(N); \ STATIC_ITEM_INNER_F(FLABEL, ##V); \ @@ -380,7 +380,7 @@ class MenuItem_bool : public MenuEditItemBase { #define PSTRING_ITEM(LABEL, V...) PSTRING_ITEM_F(GET_TEXT_F(LABEL), ##V) #define STATIC_ITEM(LABEL, V...) STATIC_ITEM_F(GET_TEXT_F(LABEL), ##V) -#define STATIC_ITEM_N(LABEL, N, V...) STATIC_ITEM_N_F(GET_TEXT_F(LABEL), N, ##V) +#define STATIC_ITEM_N(N, LABEL, V...) STATIC_ITEM_N_F(N, GET_TEXT_F(LABEL), ##V) // Menu item with index and composed C-string substitution #define MENU_ITEM_N_S_F(TYPE, N, S, FLABEL, V...) _MENU_ITEM_N_S_F(TYPE, N, S, false, FLABEL, ##V) diff --git a/Marlin/src/lcd/menu/menu_led.cpp b/Marlin/src/lcd/menu/menu_led.cpp index 0c08f6fa944b..867e4dafa940 100644 --- a/Marlin/src/lcd/menu/menu_led.cpp +++ b/Marlin/src/lcd/menu/menu_led.cpp @@ -83,7 +83,7 @@ START_MENU(); BACK_ITEM(MSG_LED_CONTROL); #if ENABLED(NEOPIXEL2_SEPARATE) - STATIC_ITEM_N(MSG_LED_CHANNEL_N, 1, SS_DEFAULT|SS_INVERT); + STATIC_ITEM_N(1, MSG_LED_CHANNEL_N, SS_DEFAULT|SS_INVERT); #endif EDIT_ITEM(uint8, MSG_INTENSITY_R, &leds.color.r, 0, 255, leds.update, true); EDIT_ITEM(uint8, MSG_INTENSITY_G, &leds.color.g, 0, 255, leds.update, true); @@ -95,7 +95,7 @@ EDIT_ITEM(uint8, MSG_LED_BRIGHTNESS, &leds.color.i, 0, 255, leds.update, true); #endif #if ENABLED(NEOPIXEL2_SEPARATE) - STATIC_ITEM_N(MSG_LED_CHANNEL_N, 2, SS_DEFAULT|SS_INVERT); + STATIC_ITEM_N(2, MSG_LED_CHANNEL_N, SS_DEFAULT|SS_INVERT); EDIT_ITEM(uint8, MSG_INTENSITY_R, &leds2.color.r, 0, 255, leds2.update, true); EDIT_ITEM(uint8, MSG_INTENSITY_G, &leds2.color.g, 0, 255, leds2.update, true); EDIT_ITEM(uint8, MSG_INTENSITY_B, &leds2.color.b, 0, 255, leds2.update, true); diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index 90bd015efff4..8857ba9dee06 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -173,7 +173,7 @@ void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int START_MENU(); if (LCD_HEIGHT >= 4) { switch (axis) { - #define _CASE_MOVE(N) case N##_AXIS: STATIC_ITEM(MSG_MOVE_##N, SS_DEFAULT|SS_INVERT); break; + #define _CASE_MOVE(N) case N##_AXIS: STATIC_ITEM_N(N##_AXIS, MSG_MOVE_N, SS_DEFAULT|SS_INVERT); break; MAIN_AXIS_MAP(_CASE_MOVE) default: TERN_(MANUAL_E_MOVES_RELATIVE, manual_move_e_origin = current_position.e); From 4520a51bbecf9874dce563cf6cf2d2bdb649a917 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 20 Jun 2022 21:19:00 -0500 Subject: [PATCH 176/241] =?UTF-8?q?=F0=9F=8E=A8=20Use=20MAP=20for=20home?= =?UTF-8?q?=20axis=20items?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/menu/menu_motion.cpp | 54 +++-------------------------- 1 file changed, 4 insertions(+), 50 deletions(-) diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index 8857ba9dee06..151bd374c2cb 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -329,6 +329,8 @@ void menu_move() { END_MENU(); } +#define _HOME_ITEM(N) GCODES_ITEM_N(N##_AXIS, MSG_AUTO_HOME_A, F("G28X" STR_##N)); + #if ENABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU) // // "Motion" > "Homing" submenu @@ -338,31 +340,7 @@ void menu_move() { BACK_ITEM(MSG_MOTION); GCODES_ITEM(MSG_AUTO_HOME, FPSTR(G28_STR)); - GCODES_ITEM_N(X_AXIS, MSG_AUTO_HOME_A, F("G28X")); - #if HAS_Y_AXIS - GCODES_ITEM_N(Y_AXIS, MSG_AUTO_HOME_A, F("G28Y")); - #endif - #if HAS_Z_AXIS - GCODES_ITEM_N(Z_AXIS, MSG_AUTO_HOME_A, F("G28Z")); - #endif - #if HAS_I_AXIS - GCODES_ITEM_N(I_AXIS, MSG_AUTO_HOME_A, F("G28" STR_I)); - #endif - #if HAS_J_AXIS - GCODES_ITEM_N(J_AXIS, MSG_AUTO_HOME_A, F("G28" STR_J)); - #endif - #if HAS_K_AXIS - GCODES_ITEM_N(K_AXIS, MSG_AUTO_HOME_A, F("G28" STR_K)); - #endif - #if HAS_U_AXIS - GCODES_ITEM_N(U_AXIS, MSG_AUTO_HOME_A, F("G28" STR_U)); - #endif - #if HAS_V_AXIS - GCODES_ITEM_N(V_AXIS, MSG_AUTO_HOME_A, F("G28" STR_V)); - #endif - #if HAS_W_AXIS - GCODES_ITEM_N(W_AXIS, MSG_AUTO_HOME_A, F("G28" STR_W)); - #endif + MAIN_AXIS_MAP(_HOME_ITEM); END_MENU(); } @@ -400,31 +378,7 @@ void menu_motion() { #else GCODES_ITEM(MSG_AUTO_HOME, FPSTR(G28_STR)); #if ENABLED(INDIVIDUAL_AXIS_HOMING_MENU) - GCODES_ITEM_N(X_AXIS, MSG_AUTO_HOME_A, F("G28X")); - #if HAS_Y_AXIS - GCODES_ITEM_N(Y_AXIS, MSG_AUTO_HOME_A, F("G28Y")); - #endif - #if HAS_Z_AXIS - GCODES_ITEM_N(Z_AXIS, MSG_AUTO_HOME_A, F("G28Z")); - #endif - #if HAS_I_AXIS - GCODES_ITEM_N(I_AXIS, MSG_AUTO_HOME_A, F("G28" STR_I)); - #endif - #if HAS_J_AXIS - GCODES_ITEM_N(J_AXIS, MSG_AUTO_HOME_A, F("G28" STR_J)); - #endif - #if HAS_K_AXIS - GCODES_ITEM_N(K_AXIS, MSG_AUTO_HOME_A, F("G28" STR_K)); - #endif - #if HAS_U_AXIS - GCODES_ITEM_N(U_AXIS, MSG_AUTO_HOME_A, F("G28" STR_U)); - #endif - #if HAS_V_AXIS - GCODES_ITEM_N(V_AXIS, MSG_AUTO_HOME_A, F("G28" STR_V)); - #endif - #if HAS_W_AXIS - GCODES_ITEM_N(W_AXIS, MSG_AUTO_HOME_A, F("G28" STR_W)); - #endif + MAIN_AXIS_MAP(_HOME_ITEM); #endif #endif From 975c8f4b77ac91678ed102c75412a8868fc1689c Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 20 Jun 2022 21:19:41 -0500 Subject: [PATCH 177/241] =?UTF-8?q?=F0=9F=8E=A8=20Simplify=20move=20menus?= =?UTF-8?q?=20with=20substitution?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/menu/menu_advanced.cpp | 2 +- Marlin/src/lcd/menu/menu_motion.cpp | 79 ++++++++------------------- 2 files changed, 23 insertions(+), 58 deletions(-) diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index a6ebb104076d..5d86b97b5d3e 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -483,7 +483,7 @@ void menu_backlash(); // M204 T Travel Acceleration EDIT_ITEM_FAST(float5_25, MSG_A_TRAVEL, &planner.settings.travel_acceleration, 25, max_accel); - #define EDIT_AMAX(Q,L) EDIT_ITEM_FAST(long5_25, MSG_AMAX_##Q, &planner.settings.max_acceleration_mm_per_s2[_AXIS(Q)], L, max_accel_edit_scaled[_AXIS(Q)], []{ planner.reset_acceleration_rates(); }) + #define EDIT_AMAX(Q,L) EDIT_ITEM_FAST_N(long5_25, _AXIS(Q), MSG_AMAX_N, &planner.settings.max_acceleration_mm_per_s2[_AXIS(Q)], L, max_accel_edit_scaled[_AXIS(Q)], []{ planner.reset_acceleration_rates(); }) NUM_AXIS_CODE( EDIT_AMAX(A, 100), EDIT_AMAX(B, 100), EDIT_AMAX(C, 10), EDIT_AMAX(I, 10), EDIT_AMAX(J, 10), EDIT_AMAX(K, 10), diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index 151bd374c2cb..de16f90637ab 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -54,9 +54,7 @@ // "Motion" > "Move Axis" submenu // -// TODO: Use substitution here with MSG_MOVE_N - -static void _lcd_move_xyz(FSTR_P const name, const AxisEnum axis) { +static void _lcd_move_xyz(const AxisEnum axis) { if (ui.use_click()) return ui.goto_previous_screen_no_defer(); if (ui.encoderPosition && !ui.manual_move.processing) { // Get motion limit from software endstops, if any @@ -83,37 +81,20 @@ static void _lcd_move_xyz(FSTR_P const name, const AxisEnum axis) { const float pos = ui.manual_move.axis_value(axis); if (parser.using_inch_units()) { const float imp_pos = LINEAR_UNIT(pos); - MenuEditItemBase::draw_edit_screen(name, ftostr63(imp_pos)); + MenuEditItemBase::draw_edit_screen(GET_TEXT_F(MSG_MOVE_N), ftostr63(imp_pos)); } else - MenuEditItemBase::draw_edit_screen(name, ui.manual_move.menu_scale >= 0.1f ? (LARGE_AREA_TEST ? ftostr51sign(pos) : ftostr41sign(pos)) : ftostr63(pos)); + MenuEditItemBase::draw_edit_screen(GET_TEXT_F(MSG_MOVE_N), ui.manual_move.menu_scale >= 0.1f ? (LARGE_AREA_TEST ? ftostr51sign(pos) : ftostr41sign(pos)) : ftostr63(pos)); } } -void lcd_move_x() { _lcd_move_xyz(GET_TEXT_F(MSG_MOVE_X), X_AXIS); } -#if HAS_Y_AXIS - void lcd_move_y() { _lcd_move_xyz(GET_TEXT_F(MSG_MOVE_Y), Y_AXIS); } -#endif -#if HAS_Z_AXIS - void lcd_move_z() { _lcd_move_xyz(GET_TEXT_F(MSG_MOVE_Z), Z_AXIS); } -#endif -#if HAS_I_AXIS - void lcd_move_i() { _lcd_move_xyz(GET_TEXT_F(MSG_MOVE_I), I_AXIS); } -#endif -#if HAS_J_AXIS - void lcd_move_j() { _lcd_move_xyz(GET_TEXT_F(MSG_MOVE_J), J_AXIS); } -#endif -#if HAS_K_AXIS - void lcd_move_k() { _lcd_move_xyz(GET_TEXT_F(MSG_MOVE_K), K_AXIS); } -#endif -#if HAS_U_AXIS - void lcd_move_u() { _lcd_move_xyz(GET_TEXT_F(MSG_MOVE_U), U_AXIS); } -#endif -#if HAS_V_AXIS - void lcd_move_v() { _lcd_move_xyz(GET_TEXT_F(MSG_MOVE_V), V_AXIS); } -#endif -#if HAS_W_AXIS - void lcd_move_w() { _lcd_move_xyz(GET_TEXT_F(MSG_MOVE_W), W_AXIS); } -#endif + +void _lcd_move_axis_n() { _lcd_move_xyz(AxisEnum(MenuItemBase::itemIndex)); } + +// Move functions for non-menu code that hasn't set itemIndex (e.g., keypad) +void lcd_move_axis(const AxisEnum axis) { MenuEditItemBase::itemIndex = int8_t(axis); _lcd_move_axis_n(); } + +// Move Z easy accessor +void lcd_move_z() { lcd_move_axis(Z_AXIS); } #if E_MANUAL @@ -200,6 +181,8 @@ void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int END_MENU(); } +void _menu_move_n_distance() { _menu_move_distance(AxisEnum(MenuItemBase::itemIndex), _lcd_move_axis_n); } + #if E_MANUAL inline void _goto_menu_move_distance_e() { @@ -230,38 +213,20 @@ void menu_move() { EDIT_ITEM(bool, MSG_LCD_SOFT_ENDSTOPS, &soft_endstop._enabled); #endif + // Move submenu for each axis if (NONE(IS_KINEMATIC, NO_MOTION_BEFORE_HOMING) || all_axes_homed()) { if (TERN1(DELTA, current_position.z <= delta_clip_start_height)) { - SUBMENU(MSG_MOVE_X, []{ _menu_move_distance(X_AXIS, lcd_move_x); }); - #if HAS_Y_AXIS - SUBMENU(MSG_MOVE_Y, []{ _menu_move_distance(Y_AXIS, lcd_move_y); }); - #endif + for (uint8_t a = X_AXIS; a <= min(int(Y_AXIS), NUM_AXES - 1); a++) + SUBMENU_N(a, MSG_MOVE_N, _menu_move_n_distance); } - #if ENABLED(DELTA) - else + else { + #if ENABLED(DELTA) ACTION_ITEM(MSG_FREE_XY, []{ line_to_z(delta_clip_start_height); ui.synchronize(); }); - #endif - + #endif + } #if HAS_Z_AXIS - SUBMENU(MSG_MOVE_Z, []{ _menu_move_distance(Z_AXIS, lcd_move_z); }); - #endif - #if HAS_I_AXIS - SUBMENU(MSG_MOVE_I, []{ _menu_move_distance(I_AXIS, lcd_move_i); }); - #endif - #if HAS_J_AXIS - SUBMENU(MSG_MOVE_J, []{ _menu_move_distance(J_AXIS, lcd_move_j); }); - #endif - #if HAS_K_AXIS - SUBMENU(MSG_MOVE_K, []{ _menu_move_distance(K_AXIS, lcd_move_k); }); - #endif - #if HAS_U_AXIS - SUBMENU(MSG_MOVE_U, []{ _menu_move_distance(U_AXIS, lcd_move_u); }); - #endif - #if HAS_V_AXIS - SUBMENU(MSG_MOVE_V, []{ _menu_move_distance(V_AXIS, lcd_move_v); }); - #endif - #if HAS_W_AXIS - SUBMENU(MSG_MOVE_W, []{ _menu_move_distance(W_AXIS, lcd_move_w); }); + for (uint8_t a = Z_AXIS; a < NUM_AXES; a++) + SUBMENU_N(a, MSG_MOVE_N, _menu_move_n_distance); #endif } else From d0e9ff0e2924e631fa4560b47a984a2e1194d2f3 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 21 Jun 2022 06:05:48 +0000 Subject: [PATCH 178/241] [cron] Bump distribution date (2022-06-21) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 3e6cf237e4a3..e6864ea4f85d 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-06-18" +//#define STRING_DISTRIBUTION_DATE "2022-06-21" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index f7a5a3efca2b..45e2e25a908e 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-06-18" + #define STRING_DISTRIBUTION_DATE "2022-06-21" #endif /** From 22f0496c9b59d050b8e199ce6bdd31afe07c01d7 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Wed, 22 Jun 2022 10:33:25 +1200 Subject: [PATCH 179/241] =?UTF-8?q?=F0=9F=9A=91=EF=B8=8F=20Fix=20SD=20moun?= =?UTF-8?q?t=20bug=20(#24319)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/sd/cardreader.cpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index 5e03795692da..3fff79653933 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -495,12 +495,7 @@ void CardReader::manage_media() { // Try to mount the media (only later with SD_IGNORE_AT_STARTUP) if (TERN1(SD_IGNORE_AT_STARTUP, old_stat != 2)) mount(); - if (!isMounted()) { // Not mounted? - stat = 0; - #if HAS_SD_DETECT && DISABLED(SD_IGNORE_AT_STARTUP) - prev_stat = 0; - #endif - } + if (!isMounted()) stat = 0; // Not mounted? TERN_(RESET_STEPPERS_ON_MEDIA_INSERT, reset_stepper_drivers()); // Workaround for Cheetah bug } @@ -512,21 +507,13 @@ void CardReader::manage_media() { if (!stat) return; // Exit if no media is present - static bool did_first_insert = false; - if (did_first_insert) return; // Did a media insert already happen? - did_first_insert = true; // Definitely handling this media insert... + if (old_stat != 2) return; // First mount? DEBUG_ECHOLNPGM("First mount."); // Load settings the first time media is inserted (not just during init) TERN_(SDCARD_EEPROM_EMULATION, settings.first_load()); - #if HAS_USB_FLASH_DRIVE - const millis_t ms = millis(); - DEBUG_ECHOLNPGM("USB mount waiting time = ", ms); - if (ms > 5000) return; // Too late to be considered "already inserted"? - #endif - bool do_auto = true; UNUSED(do_auto); // Check for PLR file. From 90d9f1acc90408e49f32198d9bb4ab6194ae0ab5 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Wed, 22 Jun 2022 00:25:14 +0000 Subject: [PATCH 180/241] [cron] Bump distribution date (2022-06-22) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index e6864ea4f85d..97535c4216b0 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-06-21" +//#define STRING_DISTRIBUTION_DATE "2022-06-22" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 45e2e25a908e..a67b4ef83046 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-06-21" + #define STRING_DISTRIBUTION_DATE "2022-06-22" #endif /** From b06e378703d9046b01c24d73bfb647b08517a91f Mon Sep 17 00:00:00 2001 From: DerAndere <26200979+DerAndere1@users.noreply.github.com> Date: Wed, 22 Jun 2022 04:07:17 +0200 Subject: [PATCH 181/241] =?UTF-8?q?=E2=9C=A8=20FOAMCUTTER=5FXYUV=20(for=20?= =?UTF-8?q?RAMPS)=20(#24325)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/Configuration.h | 7 +++++++ Marlin/src/inc/SanityCheck.h | 4 ++-- Marlin/src/pins/ramps/pins_RAMPS.h | 29 ++++++++++++++++++++++++++++- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 6d38e833cc3d..15106a20a324 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -865,6 +865,13 @@ #define POLAR_SEGMENTS_PER_SECOND 5 #endif +// Enable for an articulated robot (robot arm). Joints are directly mapped to axes (no kinematics). +//#define ARTICULATED_ROBOT_ARM + +// For a hot wire cutter with parallel horizontal axes (X, I) where the heights of the two wire +// ends are controlled by parallel axes (Y, J). Joints are directly mapped to axes (no kinematics). +//#define FOAMCUTTER_XYUV + //=========================================================================== //============================== Endstop Settings =========================== //=========================================================================== diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 90516c932d9d..dce16561afe9 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1567,8 +1567,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS /** * Allow only one kinematic type to be defined */ -#if MANY(DELTA, MORGAN_SCARA, MP_SCARA, AXEL_TPARA, COREXY, COREXZ, COREYZ, COREYX, COREZX, COREZY, MARKFORGED_XY, MARKFORGED_YX, FOAMCUTTER_XYUV) - #error "Please enable only one of DELTA, MORGAN_SCARA, MP_SCARA, AXEL_TPARA, COREXY, COREXZ, COREYZ, COREYX, COREZX, COREZY, MARKFORGED_XY, MARKFORGED_YX, or FOAMCUTTER_XYUV." +#if MANY(DELTA, MORGAN_SCARA, MP_SCARA, AXEL_TPARA, COREXY, COREXZ, COREYZ, COREYX, COREZX, COREZY, MARKFORGED_XY, MARKFORGED_YX, ARTICULATED_ROBOT_ARM, FOAMCUTTER_XYUV) + #error "Please enable only one of DELTA, MORGAN_SCARA, MP_SCARA, AXEL_TPARA, COREXY, COREXZ, COREYZ, COREYX, COREZX, COREZY, MARKFORGED_XY, MARKFORGED_YX, ARTICULATED_ROBOT_ARM, or FOAMCUTTER_XYUV." #endif /** diff --git a/Marlin/src/pins/ramps/pins_RAMPS.h b/Marlin/src/pins/ramps/pins_RAMPS.h index 199be4a1c92a..d779372b1b84 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS.h +++ b/Marlin/src/pins/ramps/pins_RAMPS.h @@ -78,6 +78,31 @@ #define SERVO3_PIN 4 #endif +// +// Foam Cutter requirements +// + +#if ENABLED(FOAMCUTTER_XYUV) + #ifndef MOSFET_C_PIN + #define MOSFET_C_PIN -1 + #endif + #if HAS_CUTTER && !defined(SPINDLE_LASER_ENA_PIN) && NUM_SERVOS < 2 + #define SPINDLE_LASER_PWM_PIN 8 // Hardware PWM + #endif + #ifndef Z_MIN_PIN + #define Z_MIN_PIN -1 + #endif + #ifndef Z_MAX_PIN + #define Z_MAX_PIN -1 + #endif + #ifndef I_STOP_PIN + #define I_STOP_PIN 18 + #endif + #ifndef J_STOP_PIN + #define J_STOP_PIN 19 + #endif +#endif + // // Limit Switches // @@ -272,7 +297,9 @@ #if HAS_CUTTER && !defined(SPINDLE_LASER_ENA_PIN) #if NUM_SERVOS < 2 // Use servo connector if possible #define SPINDLE_LASER_ENA_PIN 4 // Pullup or pulldown! - #define SPINDLE_LASER_PWM_PIN 6 // Hardware PWM + #ifndef SPINDLE_LASER_PWM_PIN + #define SPINDLE_LASER_PWM_PIN 6 // Hardware PWM + #endif #define SPINDLE_DIR_PIN 5 #elif HAS_FREE_AUX2_PINS #define SPINDLE_LASER_ENA_PIN 40 // Pullup or pulldown! From 757d66e2c598e1a5644a59dd3116f219b2aee976 Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Tue, 21 Jun 2022 22:09:24 -0400 Subject: [PATCH 182/241] =?UTF-8?q?=F0=9F=90=9B=20Resolve=20DUE=20Servo=20?= =?UTF-8?q?pulse=20issue=20(#24305)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: sjasonsmith <20053467+sjasonsmith@users.noreply.github.com> Co-authored-by: Scott Lahteine --- Marlin/src/HAL/AVR/Servo.cpp | 200 ++++++++++++++------------ Marlin/src/HAL/DUE/Servo.cpp | 129 +++++++++-------- Marlin/src/HAL/DUE/ServoTimers.h | 2 +- Marlin/src/HAL/DUE/timers.cpp | 11 +- Marlin/src/HAL/DUE/timers.h | 3 +- Marlin/src/HAL/SAMD51/Servo.cpp | 43 +++--- Marlin/src/HAL/shared/servo_private.h | 4 +- Marlin/src/core/serial.cpp | 4 +- Marlin/src/core/types.h | 8 +- 9 files changed, 212 insertions(+), 192 deletions(-) diff --git a/Marlin/src/HAL/AVR/Servo.cpp b/Marlin/src/HAL/AVR/Servo.cpp index 6dc1e2fb0732..0a1ef5337ae9 100644 --- a/Marlin/src/HAL/AVR/Servo.cpp +++ b/Marlin/src/HAL/AVR/Servo.cpp @@ -67,26 +67,25 @@ static volatile int8_t Channel[_Nbr_16timers]; // counter for the s /************ static functions common to all instances ***********************/ static inline void handle_interrupts(const timer16_Sequence_t timer, volatile uint16_t* TCNTn, volatile uint16_t* OCRnA) { - if (Channel[timer] < 0) - *TCNTn = 0; // channel set to -1 indicated that refresh interval completed so reset the timer - else { - if (SERVO_INDEX(timer, Channel[timer]) < ServoCount && SERVO(timer, Channel[timer]).Pin.isActive) - extDigitalWrite(SERVO(timer, Channel[timer]).Pin.nbr, LOW); // pulse this channel low if activated - } - - Channel[timer]++; // increment to the next channel - if (SERVO_INDEX(timer, Channel[timer]) < ServoCount && Channel[timer] < SERVOS_PER_TIMER) { - *OCRnA = *TCNTn + SERVO(timer, Channel[timer]).ticks; - if (SERVO(timer, Channel[timer]).Pin.isActive) // check if activated - extDigitalWrite(SERVO(timer, Channel[timer]).Pin.nbr, HIGH); // it's an active channel so pulse it high + int8_t cho = Channel[timer]; // Handle the prior Channel[timer] first + if (cho < 0) // Channel -1 indicates the refresh interval completed... + *TCNTn = 0; // ...so reset the timer + else if (SERVO_INDEX(timer, cho) < ServoCount) // prior channel handled? + extDigitalWrite(SERVO(timer, cho).Pin.nbr, LOW); // pulse the prior channel LOW + + Channel[timer] = ++cho; // Handle the next channel (or 0) + if (cho < SERVOS_PER_TIMER && SERVO_INDEX(timer, cho) < ServoCount) { + *OCRnA = *TCNTn + SERVO(timer, cho).ticks; // set compare to current ticks plus duration + if (SERVO(timer, cho).Pin.isActive) // activated? + extDigitalWrite(SERVO(timer, cho).Pin.nbr, HIGH); // yes: pulse HIGH } else { // finished all channels so wait for the refresh period to expire before starting over - if (((unsigned)*TCNTn) + 4 < usToTicks(REFRESH_INTERVAL)) // allow a few ticks to ensure the next OCR1A not missed - *OCRnA = (unsigned int)usToTicks(REFRESH_INTERVAL); - else - *OCRnA = *TCNTn + 4; // at least REFRESH_INTERVAL has elapsed - Channel[timer] = -1; // this will get incremented at the end of the refresh period to start again at the first channel + const unsigned int cval = ((unsigned)*TCNTn) + 32 / (SERVO_TIMER_PRESCALER), // allow 32 cycles to ensure the next OCR1A not missed + ival = (unsigned int)usToTicks(REFRESH_INTERVAL); // at least REFRESH_INTERVAL has elapsed + *OCRnA = max(cval, ival); + + Channel[timer] = -1; // reset the timer counter to 0 on the next call } } @@ -123,91 +122,102 @@ static inline void handle_interrupts(const timer16_Sequence_t timer, volatile ui /****************** end of static functions ******************************/ -void initISR(timer16_Sequence_t timer) { - #ifdef _useTimer1 - if (timer == _timer1) { - TCCR1A = 0; // normal counting mode - TCCR1B = _BV(CS11); // set prescaler of 8 - TCNT1 = 0; // clear the timer count - #if defined(__AVR_ATmega8__) || defined(__AVR_ATmega128__) - SBI(TIFR, OCF1A); // clear any pending interrupts; - SBI(TIMSK, OCIE1A); // enable the output compare interrupt - #else - // here if not ATmega8 or ATmega128 - SBI(TIFR1, OCF1A); // clear any pending interrupts; - SBI(TIMSK1, OCIE1A); // enable the output compare interrupt - #endif - #ifdef WIRING - timerAttach(TIMER1OUTCOMPAREA_INT, Timer1Service); - #endif - } - #endif - - #ifdef _useTimer3 - if (timer == _timer3) { - TCCR3A = 0; // normal counting mode - TCCR3B = _BV(CS31); // set prescaler of 8 - TCNT3 = 0; // clear the timer count - #ifdef __AVR_ATmega128__ - SBI(TIFR, OCF3A); // clear any pending interrupts; - SBI(ETIMSK, OCIE3A); // enable the output compare interrupt - #else - SBI(TIFR3, OCF3A); // clear any pending interrupts; - SBI(TIMSK3, OCIE3A); // enable the output compare interrupt - #endif - #ifdef WIRING - timerAttach(TIMER3OUTCOMPAREA_INT, Timer3Service); // for Wiring platform only - #endif - } - #endif - - #ifdef _useTimer4 - if (timer == _timer4) { - TCCR4A = 0; // normal counting mode - TCCR4B = _BV(CS41); // set prescaler of 8 - TCNT4 = 0; // clear the timer count - TIFR4 = _BV(OCF4A); // clear any pending interrupts; - TIMSK4 = _BV(OCIE4A); // enable the output compare interrupt - } - #endif - - #ifdef _useTimer5 - if (timer == _timer5) { - TCCR5A = 0; // normal counting mode - TCCR5B = _BV(CS51); // set prescaler of 8 - TCNT5 = 0; // clear the timer count - TIFR5 = _BV(OCF5A); // clear any pending interrupts; - TIMSK5 = _BV(OCIE5A); // enable the output compare interrupt - } - #endif -} - -void finISR(timer16_Sequence_t timer) { - // Disable use of the given timer - #ifdef WIRING - if (timer == _timer1) { - CBI( - #if defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__) - TIMSK1 +void initISR(const timer16_Sequence_t timer_index) { + switch (timer_index) { + default: break; + + #ifdef _useTimer1 + case _timer1: + TCCR1A = 0; // normal counting mode + TCCR1B = _BV(CS11); // set prescaler of 8 + TCNT1 = 0; // clear the timer count + #if defined(__AVR_ATmega8__) || defined(__AVR_ATmega128__) + SBI(TIFR, OCF1A); // clear any pending interrupts; + SBI(TIMSK, OCIE1A); // enable the output compare interrupt #else - TIMSK + // here if not ATmega8 or ATmega128 + SBI(TIFR1, OCF1A); // clear any pending interrupts; + SBI(TIMSK1, OCIE1A); // enable the output compare interrupt #endif - , OCIE1A); // disable timer 1 output compare interrupt - timerDetach(TIMER1OUTCOMPAREA_INT); - } - else if (timer == _timer3) { - CBI( - #if defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__) - TIMSK3 + #ifdef WIRING + timerAttach(TIMER1OUTCOMPAREA_INT, Timer1Service); + #endif + break; + #endif + + #ifdef _useTimer3 + case _timer3: + TCCR3A = 0; // normal counting mode + TCCR3B = _BV(CS31); // set prescaler of 8 + TCNT3 = 0; // clear the timer count + #ifdef __AVR_ATmega128__ + SBI(TIFR, OCF3A); // clear any pending interrupts; + SBI(ETIMSK, OCIE3A); // enable the output compare interrupt #else - ETIMSK + SBI(TIFR3, OCF3A); // clear any pending interrupts; + SBI(TIMSK3, OCIE3A); // enable the output compare interrupt + #endif + #ifdef WIRING + timerAttach(TIMER3OUTCOMPAREA_INT, Timer3Service); // for Wiring platform only #endif - , OCIE3A); // disable the timer3 output compare A interrupt - timerDetach(TIMER3OUTCOMPAREA_INT); + break; + #endif + + #ifdef _useTimer4 + case _timer4: + TCCR4A = 0; // normal counting mode + TCCR4B = _BV(CS41); // set prescaler of 8 + TCNT4 = 0; // clear the timer count + TIFR4 = _BV(OCF4A); // clear any pending interrupts; + TIMSK4 = _BV(OCIE4A); // enable the output compare interrupt + break; + #endif + + #ifdef _useTimer5 + case _timer5: + TCCR5A = 0; // normal counting mode + TCCR5B = _BV(CS51); // set prescaler of 8 + TCNT5 = 0; // clear the timer count + TIFR5 = _BV(OCF5A); // clear any pending interrupts; + TIMSK5 = _BV(OCIE5A); // enable the output compare interrupt + break; + #endif + } +} + +void finISR(const timer16_Sequence_t timer_index) { + // Disable use of the given timer + #ifdef WIRING + switch (timer_index) { + default: break; + + case _timer1: + CBI( + #if defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__) + TIMSK1 + #else + TIMSK + #endif + , OCIE1A // disable timer 1 output compare interrupt + ); + timerDetach(TIMER1OUTCOMPAREA_INT); + break; + + case _timer3: + CBI( + #if defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__) + TIMSK3 + #else + ETIMSK + #endif + , OCIE3A // disable the timer3 output compare A interrupt + ); + timerDetach(TIMER3OUTCOMPAREA_INT); + break; } #else // !WIRING // For arduino - in future: call here to a currently undefined function to reset the timer - UNUSED(timer); + UNUSED(timer_index); #endif } diff --git a/Marlin/src/HAL/DUE/Servo.cpp b/Marlin/src/HAL/DUE/Servo.cpp index 72a7d649ef04..2dab88238dd6 100644 --- a/Marlin/src/HAL/DUE/Servo.cpp +++ b/Marlin/src/HAL/DUE/Servo.cpp @@ -47,7 +47,7 @@ #include "../shared/servo.h" #include "../shared/servo_private.h" -static volatile int8_t Channel[_Nbr_16timers]; // counter for the servo being pulsed for each timer (or -1 if refresh interval) +static Flags<_Nbr_16timers> DisablePending; // ISR should disable the timer at the next timer reset // ------------------------ /// Interrupt handler for the TC0 channel 1. @@ -71,82 +71,91 @@ void Servo_Handler(const timer16_Sequence_t, Tc*, const uint8_t); #endif void Servo_Handler(const timer16_Sequence_t timer, Tc *tc, const uint8_t channel) { - // clear interrupt - tc->TC_CHANNEL[channel].TC_SR; - if (Channel[timer] < 0) - tc->TC_CHANNEL[channel].TC_CCR |= TC_CCR_SWTRG; // channel set to -1 indicated that refresh interval completed so reset the timer - else if (SERVO_INDEX(timer, Channel[timer]) < ServoCount && SERVO(timer, Channel[timer]).Pin.isActive) - extDigitalWrite(SERVO(timer, Channel[timer]).Pin.nbr, LOW); // pulse this channel low if activated - - Channel[timer]++; // increment to the next channel - if (SERVO_INDEX(timer, Channel[timer]) < ServoCount && Channel[timer] < SERVOS_PER_TIMER) { - tc->TC_CHANNEL[channel].TC_RA = tc->TC_CHANNEL[channel].TC_CV + SERVO(timer,Channel[timer]).ticks; - if (SERVO(timer,Channel[timer]).Pin.isActive) // check if activated - extDigitalWrite(SERVO(timer, Channel[timer]).Pin.nbr, HIGH); // its an active channel so pulse it high + static int8_t Channel[_Nbr_16timers]; // Servo counters to pulse (or -1 for refresh interval) + int8_t cho = Channel[timer]; // Handle the prior Channel[timer] first + if (cho < 0) { // Channel -1 indicates the refresh interval completed... + tc->TC_CHANNEL[channel].TC_CCR |= TC_CCR_SWTRG; // ...so reset the timer + if (DisablePending[timer]) { + // Disabling only after the full servo period expires prevents + // pulses being too close together if immediately re-enabled. + DisablePending.clear(timer); + TC_Stop(tc, channel); + tc->TC_CHANNEL[channel].TC_SR; // clear interrupt + return; + } + } + else if (SERVO_INDEX(timer, cho) < ServoCount) // prior channel handled? + extDigitalWrite(SERVO(timer, cho).Pin.nbr, LOW); // pulse the prior channel LOW + + Channel[timer] = ++cho; // go to the next channel (or 0) + if (cho < SERVOS_PER_TIMER && SERVO_INDEX(timer, cho) < ServoCount) { + tc->TC_CHANNEL[channel].TC_RA = tc->TC_CHANNEL[channel].TC_CV + SERVO(timer, cho).ticks; + if (SERVO(timer, cho).Pin.isActive) // activated? + extDigitalWrite(SERVO(timer, cho).Pin.nbr, HIGH); // yes: pulse HIGH } else { // finished all channels so wait for the refresh period to expire before starting over - tc->TC_CHANNEL[channel].TC_RA = - tc->TC_CHANNEL[channel].TC_CV < usToTicks(REFRESH_INTERVAL) - 4 - ? (unsigned int)usToTicks(REFRESH_INTERVAL) // allow a few ticks to ensure the next OCR1A not missed - : tc->TC_CHANNEL[channel].TC_CV + 4; // at least REFRESH_INTERVAL has elapsed - Channel[timer] = -1; // this will get incremented at the end of the refresh period to start again at the first channel + const unsigned int cval = tc->TC_CHANNEL[channel].TC_CV + 128 / (SERVO_TIMER_PRESCALER), // allow 128 cycles to ensure the next CV not missed + ival = (unsigned int)usToTicks(REFRESH_INTERVAL); // at least REFRESH_INTERVAL has elapsed + tc->TC_CHANNEL[channel].TC_RA = max(cval, ival); + + Channel[timer] = -1; // reset the timer CCR on the next call } + + tc->TC_CHANNEL[channel].TC_SR; // clear interrupt } static void _initISR(Tc *tc, uint32_t channel, uint32_t id, IRQn_Type irqn) { pmc_enable_periph_clk(id); TC_Configure(tc, channel, - TC_CMR_TCCLKS_TIMER_CLOCK3 | // MCK/32 - TC_CMR_WAVE | // Waveform mode - TC_CMR_WAVSEL_UP_RC ); // Counter running up and reset when equals to RC - - /* 84MHz, MCK/32, for 1.5ms: 3937 */ - TC_SetRA(tc, channel, 2625); // 1ms - - /* Configure and enable interrupt */ + TC_CMR_WAVE // Waveform mode + | TC_CMR_WAVSEL_UP_RC // Counter running up and reset when equal to RC + | (SERVO_TIMER_PRESCALER == 2 ? TC_CMR_TCCLKS_TIMER_CLOCK1 : 0) // MCK/2 + | (SERVO_TIMER_PRESCALER == 8 ? TC_CMR_TCCLKS_TIMER_CLOCK2 : 0) // MCK/8 + | (SERVO_TIMER_PRESCALER == 32 ? TC_CMR_TCCLKS_TIMER_CLOCK3 : 0) // MCK/32 + | (SERVO_TIMER_PRESCALER == 128 ? TC_CMR_TCCLKS_TIMER_CLOCK4 : 0) // MCK/128 + ); + + // Wait 1ms before the first ISR + TC_SetRA(tc, channel, (F_CPU) / (SERVO_TIMER_PRESCALER) / 1000UL); // 1ms + + // Configure and enable interrupt NVIC_EnableIRQ(irqn); - // TC_IER_CPAS: RA Compare - tc->TC_CHANNEL[channel].TC_IER = TC_IER_CPAS; + tc->TC_CHANNEL[channel].TC_IER = TC_IER_CPAS; // TC_IER_CPAS: RA Compare // Enables the timer clock and performs a software reset to start the counting TC_Start(tc, channel); } -void initISR(const timer16_Sequence_t timer) { - #ifdef _useTimer1 - if (timer == _timer1) _initISR(TC_FOR_TIMER1, CHANNEL_FOR_TIMER1, ID_TC_FOR_TIMER1, IRQn_FOR_TIMER1); - #endif - #ifdef _useTimer2 - if (timer == _timer2) _initISR(TC_FOR_TIMER2, CHANNEL_FOR_TIMER2, ID_TC_FOR_TIMER2, IRQn_FOR_TIMER2); - #endif - #ifdef _useTimer3 - if (timer == _timer3) _initISR(TC_FOR_TIMER3, CHANNEL_FOR_TIMER3, ID_TC_FOR_TIMER3, IRQn_FOR_TIMER3); - #endif - #ifdef _useTimer4 - if (timer == _timer4) _initISR(TC_FOR_TIMER4, CHANNEL_FOR_TIMER4, ID_TC_FOR_TIMER4, IRQn_FOR_TIMER4); - #endif - #ifdef _useTimer5 - if (timer == _timer5) _initISR(TC_FOR_TIMER5, CHANNEL_FOR_TIMER5, ID_TC_FOR_TIMER5, IRQn_FOR_TIMER5); - #endif +void initISR(const timer16_Sequence_t timer_index) { + CRITICAL_SECTION_START(); + const bool disable_soon = DisablePending[timer_index]; + DisablePending.clear(timer_index); + CRITICAL_SECTION_END(); + + if (!disable_soon) switch (timer_index) { + default: break; + #ifdef _useTimer1 + case _timer1: return _initISR(TC_FOR_TIMER1, CHANNEL_FOR_TIMER1, ID_TC_FOR_TIMER1, IRQn_FOR_TIMER1); + #endif + #ifdef _useTimer2 + case _timer2: return _initISR(TC_FOR_TIMER2, CHANNEL_FOR_TIMER2, ID_TC_FOR_TIMER2, IRQn_FOR_TIMER2); + #endif + #ifdef _useTimer3 + case _timer3: return _initISR(TC_FOR_TIMER3, CHANNEL_FOR_TIMER3, ID_TC_FOR_TIMER3, IRQn_FOR_TIMER3); + #endif + #ifdef _useTimer4 + case _timer4: return _initISR(TC_FOR_TIMER4, CHANNEL_FOR_TIMER4, ID_TC_FOR_TIMER4, IRQn_FOR_TIMER4); + #endif + #ifdef _useTimer5 + case _timer5: return _initISR(TC_FOR_TIMER5, CHANNEL_FOR_TIMER5, ID_TC_FOR_TIMER5, IRQn_FOR_TIMER5); + #endif + } } -void finISR(timer16_Sequence_t) { - #ifdef _useTimer1 - TC_Stop(TC_FOR_TIMER1, CHANNEL_FOR_TIMER1); - #endif - #ifdef _useTimer2 - TC_Stop(TC_FOR_TIMER2, CHANNEL_FOR_TIMER2); - #endif - #ifdef _useTimer3 - TC_Stop(TC_FOR_TIMER3, CHANNEL_FOR_TIMER3); - #endif - #ifdef _useTimer4 - TC_Stop(TC_FOR_TIMER4, CHANNEL_FOR_TIMER4); - #endif - #ifdef _useTimer5 - TC_Stop(TC_FOR_TIMER5, CHANNEL_FOR_TIMER5); - #endif +void finISR(const timer16_Sequence_t timer_index) { + // Timer is disabled from the ISR, to ensure proper final pulse length. + DisablePending.set(timer_index); } #endif // HAS_SERVOS diff --git a/Marlin/src/HAL/DUE/ServoTimers.h b/Marlin/src/HAL/DUE/ServoTimers.h index c32c93825399..95bd404c8061 100644 --- a/Marlin/src/HAL/DUE/ServoTimers.h +++ b/Marlin/src/HAL/DUE/ServoTimers.h @@ -37,7 +37,7 @@ #define _useTimer5 #define TRIM_DURATION 2 // compensation ticks to trim adjust for digitalWrite delays -#define SERVO_TIMER_PRESCALER 32 // timer prescaler +#define SERVO_TIMER_PRESCALER 2 // timer prescaler /* TC0, chan 0 => TC0_Handler diff --git a/Marlin/src/HAL/DUE/timers.cpp b/Marlin/src/HAL/DUE/timers.cpp index a7bf7fbd6d85..e5647817b6f0 100644 --- a/Marlin/src/HAL/DUE/timers.cpp +++ b/Marlin/src/HAL/DUE/timers.cpp @@ -89,10 +89,17 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) { NVIC_SetPriority(irq, timer_config[timer_num].priority); // wave mode, reset counter on match with RC, - TC_Configure(tc, channel, TC_CMR_WAVE | TC_CMR_WAVSEL_UP_RC | TC_CMR_TCCLKS_TIMER_CLOCK1); + TC_Configure(tc, channel, + TC_CMR_WAVE + | TC_CMR_WAVSEL_UP_RC + | (HAL_TIMER_PRESCALER == 2 ? TC_CMR_TCCLKS_TIMER_CLOCK1 : 0) + | (HAL_TIMER_PRESCALER == 8 ? TC_CMR_TCCLKS_TIMER_CLOCK2 : 0) + | (HAL_TIMER_PRESCALER == 32 ? TC_CMR_TCCLKS_TIMER_CLOCK3 : 0) + | (HAL_TIMER_PRESCALER == 128 ? TC_CMR_TCCLKS_TIMER_CLOCK4 : 0) + ); // Set compare value - TC_SetRC(tc, channel, VARIANT_MCK / 2 / frequency); + TC_SetRC(tc, channel, VARIANT_MCK / (HAL_TIMER_PRESCALER) / frequency); // And start timer TC_Start(tc, channel); diff --git a/Marlin/src/HAL/DUE/timers.h b/Marlin/src/HAL/DUE/timers.h index bcfd07e268c5..dc35c77e6384 100644 --- a/Marlin/src/HAL/DUE/timers.h +++ b/Marlin/src/HAL/DUE/timers.h @@ -35,7 +35,8 @@ typedef uint32_t hal_timer_t; #define HAL_TIMER_TYPE_MAX 0xFFFFFFFF -#define HAL_TIMER_RATE ((F_CPU) / 2) // frequency of timers peripherals +#define HAL_TIMER_PRESCALER 2 +#define HAL_TIMER_RATE ((F_CPU) / (HAL_TIMER_PRESCALER)) // frequency of timers peripherals #ifndef MF_TIMER_STEP #define MF_TIMER_STEP 2 // Timer Index for Stepper diff --git a/Marlin/src/HAL/SAMD51/Servo.cpp b/Marlin/src/HAL/SAMD51/Servo.cpp index 04461653f94f..665322fe24bc 100644 --- a/Marlin/src/HAL/SAMD51/Servo.cpp +++ b/Marlin/src/HAL/SAMD51/Servo.cpp @@ -77,7 +77,8 @@ HAL_SERVO_TIMER_ISR() { ; const uint8_t tcChannel = TIMER_TCCHANNEL(timer); - if (currentServoIndex[timer] < 0) { + int8_t cho = currentServoIndex[timer]; // Handle the prior servo first + if (cho < 0) { // Servo -1 indicates the refresh interval completed... #if defined(_useTimer1) && defined(_useTimer2) if (currentServoIndex[timer ^ 1] >= 0) { // Wait for both channels @@ -86,41 +87,33 @@ HAL_SERVO_TIMER_ISR() { return; } #endif - tc->COUNT16.COUNT.reg = TC_COUNTER_START_VAL; + tc->COUNT16.COUNT.reg = TC_COUNTER_START_VAL; // ...so reset the timer SYNC(tc->COUNT16.SYNCBUSY.bit.COUNT); } - else if (SERVO_INDEX(timer, currentServoIndex[timer]) < ServoCount && SERVO(timer, currentServoIndex[timer]).Pin.isActive) - digitalWrite(SERVO(timer, currentServoIndex[timer]).Pin.nbr, LOW); // pulse this channel low if activated - - // Select the next servo controlled by this timer - currentServoIndex[timer]++; + else if (SERVO_INDEX(timer, cho) < ServoCount) // prior channel handled? + digitalWrite(SERVO(timer, cho).Pin.nbr, LOW); // pulse the prior channel LOW - if (SERVO_INDEX(timer, currentServoIndex[timer]) < ServoCount && currentServoIndex[timer] < SERVOS_PER_TIMER) { - if (SERVO(timer, currentServoIndex[timer]).Pin.isActive) // check if activated - digitalWrite(SERVO(timer, currentServoIndex[timer]).Pin.nbr, HIGH); // it's an active channel so pulse it high + currentServoIndex[timer] = ++cho; // go to the next channel (or 0) + if (cho < SERVOS_PER_TIMER && SERVO_INDEX(timer, cho) < ServoCount) { + if (SERVO(timer, cho).Pin.isActive) // activated? + digitalWrite(SERVO(timer, cho).Pin.nbr, HIGH); // yes: pulse HIGH - tc->COUNT16.CC[tcChannel].reg = getTimerCount() - (uint16_t)SERVO(timer, currentServoIndex[timer]).ticks; + tc->COUNT16.CC[tcChannel].reg = getTimerCount() - (uint16_t)SERVO(timer, cho).ticks; } else { // finished all channels so wait for the refresh period to expire before starting over - currentServoIndex[timer] = -1; // this will get incremented at the end of the refresh period to start again at the first channel - - const uint16_t tcCounterValue = getTimerCount(); - - if ((TC_COUNTER_START_VAL - tcCounterValue) + 4UL < usToTicks(REFRESH_INTERVAL)) // allow a few ticks to ensure the next OCR1A not missed - tc->COUNT16.CC[tcChannel].reg = TC_COUNTER_START_VAL - (uint16_t)usToTicks(REFRESH_INTERVAL); - else - tc->COUNT16.CC[tcChannel].reg = (uint16_t)(tcCounterValue - 4UL); // at least REFRESH_INTERVAL has elapsed + currentServoIndex[timer] = -1; // reset the timer COUNT.reg on the next call + const uint16_t cval = getTimerCount() - 256 / (SERVO_TIMER_PRESCALER), // allow 256 cycles to ensure the next CV not missed + ival = (TC_COUNTER_START_VAL) - (uint16_t)usToTicks(REFRESH_INTERVAL); // at least REFRESH_INTERVAL has elapsed + tc->COUNT16.CC[tcChannel].reg = min(cval, ival); } if (tcChannel == 0) { SYNC(tc->COUNT16.SYNCBUSY.bit.CC0); - // Clear the interrupt - tc->COUNT16.INTFLAG.reg = TC_INTFLAG_MC0; + tc->COUNT16.INTFLAG.reg = TC_INTFLAG_MC0; // Clear the interrupt } else { SYNC(tc->COUNT16.SYNCBUSY.bit.CC1); - // Clear the interrupt - tc->COUNT16.INTFLAG.reg = TC_INTFLAG_MC1; + tc->COUNT16.INTFLAG.reg = TC_INTFLAG_MC1; // Clear the interrupt } } @@ -201,9 +194,9 @@ void initISR(const timer16_Sequence_t timer) { } } -void finISR(const timer16_Sequence_t timer) { +void finISR(const timer16_Sequence_t timer_index) { Tc * const tc = timer_config[SERVO_TC].pTc; - const uint8_t tcChannel = TIMER_TCCHANNEL(timer); + const uint8_t tcChannel = TIMER_TCCHANNEL(timer_index); // Disable the match channel interrupt request tc->COUNT16.INTENCLR.reg = (tcChannel == 0) ? TC_INTENCLR_MC0 : TC_INTENCLR_MC1; diff --git a/Marlin/src/HAL/shared/servo_private.h b/Marlin/src/HAL/shared/servo_private.h index 021e0cb81d01..10cc5a198821 100644 --- a/Marlin/src/HAL/shared/servo_private.h +++ b/Marlin/src/HAL/shared/servo_private.h @@ -94,5 +94,5 @@ extern ServoInfo_t servo_info[MAX_SERVOS]; // Public functions -extern void initISR(const timer16_Sequence_t timer); -extern void finISR(const timer16_Sequence_t timer); +void initISR(const timer16_Sequence_t timer_index); +void finISR(const timer16_Sequence_t timer_index); diff --git a/Marlin/src/core/serial.cpp b/Marlin/src/core/serial.cpp index 49e792110efc..727b191d0404 100644 --- a/Marlin/src/core/serial.cpp +++ b/Marlin/src/core/serial.cpp @@ -72,8 +72,8 @@ void serial_print_P(PGM_P str) { while (const char c = pgm_read_byte(str++)) SERIAL_CHAR(c); } -void serial_echo_start() { static PGMSTR(echomagic, "echo:"); serial_print_P(echomagic); } -void serial_error_start() { static PGMSTR(errormagic, "Error:"); serial_print_P(errormagic); } +void serial_echo_start() { serial_print(F("echo:")); } +void serial_error_start() { serial_print(F("Error:")); } void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR(' '); } diff --git a/Marlin/src/core/types.h b/Marlin/src/core/types.h index fc3ef178b6df..335aa3a33449 100644 --- a/Marlin/src/core/types.h +++ b/Marlin/src/core/types.h @@ -99,8 +99,8 @@ struct Flags { void set(const int n) { b |= (bits_t)_BV(n); } void clear(const int n) { b &= ~(bits_t)_BV(n); } bool test(const int n) const { return TEST(b, n); } - bool operator[](const int n) { return test(n); } - bool operator[](const int n) const { return test(n); } + const bool operator[](const int n) { return test(n); } + const bool operator[](const int n) const { return test(n); } int size() const { return sizeof(b); } }; @@ -113,8 +113,8 @@ struct Flags<1> { void set(const int) { b = true; } void clear(const int) { b = false; } bool test(const int) const { return b; } - bool operator[](const int) { return b; } - bool operator[](const int) const { return b; } + bool& operator[](const int) { return b; } + bool operator[](const int) const { return b; } int size() const { return sizeof(b); } }; From 757156de727a4e593eb961ea6194ba2023352e3f Mon Sep 17 00:00:00 2001 From: tombrazier <68918209+tombrazier@users.noreply.github.com> Date: Wed, 22 Jun 2022 03:45:22 +0100 Subject: [PATCH 183/241] =?UTF-8?q?=F0=9F=A9=B9=20LCD=20strings=20followup?= =?UTF-8?q?,=20fix=20warning=20(#24328)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/menu/menu_x_twist.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Marlin/src/lcd/menu/menu_x_twist.cpp b/Marlin/src/lcd/menu/menu_x_twist.cpp index e46745e8b761..a069b427c6bf 100644 --- a/Marlin/src/lcd/menu/menu_x_twist.cpp +++ b/Marlin/src/lcd/menu/menu_x_twist.cpp @@ -99,12 +99,8 @@ void xatc_wizard_menu() { SUBMENU(MSG_MOVE_1MM, []{ _goto_manual_move_z( 1); }); SUBMENU(MSG_MOVE_01MM, []{ _goto_manual_move_z( 0.1f); }); - if ((FINE_MANUAL_MOVE) > 0.0f && (FINE_MANUAL_MOVE) < 0.1f) { - // Determine digits needed right of decimal - const uint8_t digs = !UNEAR_ZERO((FINE_MANUAL_MOVE) * 1000 - int((FINE_MANUAL_MOVE) * 1000)) ? 4 : - !UNEAR_ZERO((FINE_MANUAL_MOVE) * 100 - int((FINE_MANUAL_MOVE) * 100)) ? 3 : 2; + if ((FINE_MANUAL_MOVE) > 0.0f && (FINE_MANUAL_MOVE) < 0.1f) SUBMENU_f(F(STRINGIFY(FINE_MANUAL_MOVE)), MSG_MOVE_N_MM, []{ _goto_manual_move_z(float(FINE_MANUAL_MOVE)); }); - } ACTION_ITEM(MSG_BUTTON_DONE, xatc_wizard_set_offset_and_go_to_next_point); From 8c3ba69c9841c248882388d0a572deaf33e0f758 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Wed, 22 Jun 2022 16:13:18 +1200 Subject: [PATCH 184/241] =?UTF-8?q?=F0=9F=90=9B=20Fix=20M423=20invocation?= =?UTF-8?q?=20(#24360)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #23745 --- Marlin/src/gcode/gcode.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 5425fc701fcd..f4dac89b0e07 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -848,6 +848,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 421: M421(); break; // M421: Set a Mesh Bed Leveling Z coordinate #endif + #if ENABLED(X_AXIS_TWIST_COMPENSATION) + case 423: M423(); break; // M423: Reset, modify, or report X-Twist Compensation data + #endif + #if ENABLED(BACKLASH_GCODE) case 425: M425(); break; // M425: Tune backlash compensation #endif From 3c13be165b80a0a9191a5f40711d374010f69bc7 Mon Sep 17 00:00:00 2001 From: Victor Oliveira Date: Wed, 22 Jun 2022 05:33:03 -0300 Subject: [PATCH 185/241] =?UTF-8?q?=F0=9F=9A=91=EF=B8=8F=20Fix=20BIQU=20BX?= =?UTF-8?q?=20touch=20freeze=20(#24383)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/STM32/tft/gt911.cpp | 16 ++++++++++------ Marlin/src/HAL/STM32/tft/gt911.h | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Marlin/src/HAL/STM32/tft/gt911.cpp b/Marlin/src/HAL/STM32/tft/gt911.cpp index 92e14edb2057..180abc68b054 100644 --- a/Marlin/src/HAL/STM32/tft/gt911.cpp +++ b/Marlin/src/HAL/STM32/tft/gt911.cpp @@ -159,24 +159,28 @@ void GT911::read_reg(uint16_t reg, uint8_t reg_len, uint8_t* r_data, uint8_t r_l void GT911::Init() { OUT_WRITE(GT911_RST_PIN, LOW); OUT_WRITE(GT911_INT_PIN, LOW); - delay(20); + delay(11); + WRITE(GT911_INT_PIN, HIGH); + delayMicroseconds(110); WRITE(GT911_RST_PIN, HIGH); + delay(6); + WRITE(GT911_INT_PIN, LOW); + delay(55); SET_INPUT(GT911_INT_PIN); sw_iic.init(); - uint8_t clear_reg = 0x0000; - write_reg(0x814E, 2, &clear_reg, 2); // Reset to 0 for start + uint8_t clear_reg = 0x00; + write_reg(0x814E, 2, &clear_reg, 1); // Reset to 0 for start } bool GT911::getFirstTouchPoint(int16_t *x, int16_t *y) { read_reg(0x814E, 2, ®.REG.status, 1); - if (reg.REG.status & 0x80) { + if (reg.REG.status >= 0x80 && reg.REG.status <= 0x85) { + read_reg(0x8150, 2, reg.map + 2, 38); uint8_t clear_reg = 0x00; write_reg(0x814E, 2, &clear_reg, 1); // Reset to 0 for start - read_reg(0x8150, 2, reg.map + 2, 8 * (reg.REG.status & 0x0F)); - // First touch point *x = ((reg.REG.point[0].xh & 0x0F) << 8) | reg.REG.point[0].xl; *y = ((reg.REG.point[0].yh & 0x0F) << 8) | reg.REG.point[0].yl; diff --git a/Marlin/src/HAL/STM32/tft/gt911.h b/Marlin/src/HAL/STM32/tft/gt911.h index 752a554d98ed..6ecfe8b82ec7 100644 --- a/Marlin/src/HAL/STM32/tft/gt911.h +++ b/Marlin/src/HAL/STM32/tft/gt911.h @@ -23,7 +23,7 @@ #include "../../../inc/MarlinConfig.h" -#define GT911_SLAVE_ADDRESS 0xBA +#define GT911_SLAVE_ADDRESS 0x28 #if !PIN_EXISTS(GT911_RST) #error "GT911_RST_PIN is not defined." From 58d1b1be289a6e51a36f8a8b2d24baa59a99e9ff Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Wed, 22 Jun 2022 22:08:24 +1200 Subject: [PATCH 186/241] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20DGUS=20(MKS)=20com?= =?UTF-8?q?pile=20(#24378)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/pause.cpp | 10 +++++++--- Marlin/src/inc/Conditionals_LCD.h | 2 +- Marlin/src/inc/Conditionals_adv.h | 8 ++++---- .../lcd/extui/dgus/mks/DGUSScreenHandler.cpp | 19 +++++++++---------- Marlin/src/lcd/marlinui.h | 3 ++- 5 files changed, 23 insertions(+), 19 deletions(-) diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index ac5852f91a1a..e9cb2df594d2 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -711,9 +711,13 @@ void resume_print(const_float_t slow_load_length/*=0*/, const_float_t fast_load_ TERN_(HAS_FILAMENT_SENSOR, runout.reset()); - TERN(DWIN_LCD_PROUI, DWIN_Print_Resume(), ui.reset_status()); - TERN_(HAS_MARLINUI_MENU, ui.return_to_status()); - TERN_(DWIN_LCD_PROUI, HMI_ReturnScreen()); + #if ENABLED(DWIN_LCD_PROUI) + DWIN_Print_Resume(); + HMI_ReturnScreen(); + #else + ui.reset_status(); + ui.return_to_status(); + #endif } #endif // ADVANCED_PAUSE_FEATURE diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index adb65f5f7d7d..01f9c0237419 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -513,7 +513,7 @@ #define HAS_LCDPRINT 1 #endif -#if ANY(HAS_DISPLAY, HAS_DWIN_E3V2) +#if HAS_DISPLAY || HAS_DWIN_E3V2 #define HAS_STATUS_MESSAGE 1 #endif diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 130e68f61ee9..2a204c6cf3c2 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -1018,13 +1018,13 @@ * LCD_SERIAL_PORT must be defined ahead of HAL.h */ #ifndef LCD_SERIAL_PORT - #if HAS_DWIN_E3V2 || IS_DWIN_MARLINUI + #if HAS_DWIN_E3V2 || IS_DWIN_MARLINUI || HAS_DGUS_LCD #if MB(BTT_SKR_MINI_E3_V1_0, BTT_SKR_MINI_E3_V1_2, BTT_SKR_MINI_E3_V2_0, BTT_SKR_MINI_E3_V3_0, BTT_SKR_E3_TURBO) #define LCD_SERIAL_PORT 1 - #elif MB(CREALITY_V24S1_301, CREALITY_V24S1_301F4, CREALITY_V423) - #define LCD_SERIAL_PORT 2 // Creality Ender3S1 board + #elif MB(CREALITY_V24S1_301, CREALITY_V24S1_301F4, CREALITY_V423, MKS_ROBIN) + #define LCD_SERIAL_PORT 2 // Creality Ender3S1, MKS Robin #else - #define LCD_SERIAL_PORT 3 // Creality 4.x board + #define LCD_SERIAL_PORT 3 // Other boards #endif #endif #ifdef LCD_SERIAL_PORT diff --git a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp index 18ac433b719a..2d4fe2e29d3a 100644 --- a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp @@ -258,7 +258,7 @@ void DGUSScreenHandlerMKS::DGUSLCD_SendTMCStepValue(DGUS_VP_Variable &var) { ) filelist.refresh(); } - void DGUSScreenHandler::SDPrintingFinished() { + void DGUSScreenHandlerMKS::SDPrintingFinished() { if (DGUSAutoTurnOff) { queue.exhaust(); gcode.process_subcommands_now(F("M81")); @@ -416,15 +416,15 @@ void DGUSScreenHandlerMKS::LanguageChange(DGUS_VP_Variable &var, void *val_ptr) case MKS_SimpleChinese: DGUS_LanguageDisplay(MKS_SimpleChinese); mks_language_index = MKS_SimpleChinese; - dgusdisplay.WriteVariable(VP_LANGUAGE_CHANGE1, MKS_Language_Choose); - dgusdisplay.WriteVariable(VP_LANGUAGE_CHANGE2, MKS_Language_NoChoose); + dgusdisplay.WriteVariable(VP_LANGUAGE_CHANGE1, (uint8_t)MKS_Language_Choose); + dgusdisplay.WriteVariable(VP_LANGUAGE_CHANGE2, (uint8_t)MKS_Language_NoChoose); settings.save(); break; case MKS_English: DGUS_LanguageDisplay(MKS_English); mks_language_index = MKS_English; - dgusdisplay.WriteVariable(VP_LANGUAGE_CHANGE1, MKS_Language_NoChoose); - dgusdisplay.WriteVariable(VP_LANGUAGE_CHANGE2, MKS_Language_Choose); + dgusdisplay.WriteVariable(VP_LANGUAGE_CHANGE1, (uint8_t)MKS_Language_NoChoose); + dgusdisplay.WriteVariable(VP_LANGUAGE_CHANGE2, (uint8_t)MKS_Language_Choose); settings.save(); break; default: break; @@ -1125,7 +1125,6 @@ void DGUSScreenHandlerMKS::HandleAccChange(DGUS_VP_Variable &var, void *val_ptr) #if ENABLED(BABYSTEPPING) void DGUSScreenHandler::HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr) { DEBUG_ECHOLNPGM("HandleLiveAdjustZ"); - char babystep_buf[30]; float step = ZOffset_distance; uint16_t flag = swap16(*(uint16_t*)val_ptr); @@ -1446,12 +1445,12 @@ bool DGUSScreenHandlerMKS::loop() { void DGUSScreenHandlerMKS::LanguagePInit() { switch (mks_language_index) { case MKS_SimpleChinese: - dgusdisplay.WriteVariable(VP_LANGUAGE_CHANGE1, MKS_Language_Choose); - dgusdisplay.WriteVariable(VP_LANGUAGE_CHANGE2, MKS_Language_NoChoose); + dgusdisplay.WriteVariable(VP_LANGUAGE_CHANGE1, (uint8_t)MKS_Language_Choose); + dgusdisplay.WriteVariable(VP_LANGUAGE_CHANGE2, (uint8_t)MKS_Language_NoChoose); break; case MKS_English: - dgusdisplay.WriteVariable(VP_LANGUAGE_CHANGE1, MKS_Language_NoChoose); - dgusdisplay.WriteVariable(VP_LANGUAGE_CHANGE2, MKS_Language_Choose); + dgusdisplay.WriteVariable(VP_LANGUAGE_CHANGE1, (uint8_t)MKS_Language_NoChoose); + dgusdisplay.WriteVariable(VP_LANGUAGE_CHANGE2, (uint8_t)MKS_Language_Choose); break; default: break; diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index 66e5e0c26181..8ae8a8b7f5ce 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -502,7 +502,6 @@ class MarlinUI { #else // No LCD static void update() {} - static void return_to_status() {} static void kill_screen(FSTR_P const, FSTR_P const) {} #endif @@ -609,6 +608,8 @@ class MarlinUI { #else + static void return_to_status() {} + static constexpr bool on_status_screen() { return true; } #if HAS_WIRED_LCD From 6355798bfd60981555dcd5b1ab1779f9b5ae5805 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Thu, 23 Jun 2022 00:18:49 +0000 Subject: [PATCH 187/241] [cron] Bump distribution date (2022-06-23) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 97535c4216b0..c8032d34c0d9 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-06-22" +//#define STRING_DISTRIBUTION_DATE "2022-06-23" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index a67b4ef83046..c43930122643 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-06-22" + #define STRING_DISTRIBUTION_DATE "2022-06-23" #endif /** From 1a795376451ad4d2ae654f7e7ae1afdb052b6f56 Mon Sep 17 00:00:00 2001 From: Victor Oliveira Date: Thu, 23 Jun 2022 06:18:36 -0300 Subject: [PATCH 188/241] =?UTF-8?q?=E2=9C=A8=20Classic=20UI=20BIQU=20BX=20?= =?UTF-8?q?(#24387)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Conditionals_LCD.h | 3 +- Marlin/src/inc/SanityCheck.h | 4 +- Marlin/src/lcd/dogm/HAL_LCD_com_defines.h | 2 +- Marlin/src/lcd/touch/touch_buttons.cpp | 45 +++++++++++--------- Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h | 7 ++- 5 files changed, 35 insertions(+), 26 deletions(-) diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 01f9c0237419..e41bc0d48977 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -1463,7 +1463,8 @@ #elif ENABLED(TFT_RES_1024x600) #define TFT_WIDTH 1024 #define TFT_HEIGHT 600 - #define GRAPHICAL_TFT_UPSCALE 4 + #define GRAPHICAL_TFT_UPSCALE 6 + #define TFT_PIXEL_OFFSET_X 120 #endif // FSMC/SPI TFT Panels using standard HAL/tft/tft_(fsmc|spi|ltdc).h diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index dce16561afe9..1340ba89ef1b 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2923,8 +2923,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #endif #endif -#if defined(GRAPHICAL_TFT_UPSCALE) && !WITHIN(GRAPHICAL_TFT_UPSCALE, 2, 4) - #error "GRAPHICAL_TFT_UPSCALE must be 2, 3, or 4." +#if defined(GRAPHICAL_TFT_UPSCALE) && !WITHIN(GRAPHICAL_TFT_UPSCALE, 2, 6) + #error "GRAPHICAL_TFT_UPSCALE must be between 2 and 6." #endif #if BOTH(CHIRON_TFT_STANDARD, CHIRON_TFT_NEW) diff --git a/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h b/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h index e5c6524a9ec4..f38c9d76e3ba 100644 --- a/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h +++ b/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h @@ -124,7 +124,7 @@ #ifndef U8G_COM_SSD_I2C_HAL #define U8G_COM_SSD_I2C_HAL u8g_com_null_fn #endif -#if HAS_FSMC_GRAPHICAL_TFT || HAS_SPI_GRAPHICAL_TFT +#if HAS_FSMC_GRAPHICAL_TFT || HAS_SPI_GRAPHICAL_TFT || HAS_LTDC_GRAPHICAL_TFT uint8_t u8g_com_hal_tft_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); #define U8G_COM_HAL_TFT_FN u8g_com_hal_tft_fn #else diff --git a/Marlin/src/lcd/touch/touch_buttons.cpp b/Marlin/src/lcd/touch/touch_buttons.cpp index dcdc7def8667..604f366ed4f2 100644 --- a/Marlin/src/lcd/touch/touch_buttons.cpp +++ b/Marlin/src/lcd/touch/touch_buttons.cpp @@ -68,26 +68,31 @@ uint8_t TouchButtons::read_buttons() { #ifdef HAS_WIRED_LCD int16_t x, y; - const bool is_touched = (TERN(TOUCH_SCREEN_CALIBRATION, touch_calibration.calibration.orientation, TOUCH_ORIENTATION) == TOUCH_PORTRAIT ? touchIO.getRawPoint(&y, &x) : touchIO.getRawPoint(&x, &y)); - #if HAS_TOUCH_SLEEP - if (is_touched) - wakeUp(); - else if (!isSleeping() && ELAPSED(millis(), next_sleep_ms) && ui.on_status_screen()) - sleepTimeout(); - #endif - if (!is_touched) return 0; - - #if ENABLED(TOUCH_SCREEN_CALIBRATION) - const calibrationState state = touch_calibration.get_calibration_state(); - if (WITHIN(state, CALIBRATION_TOP_LEFT, CALIBRATION_BOTTOM_RIGHT)) { - if (touch_calibration.handleTouch(x, y)) ui.refresh(); - return 0; - } - x = int16_t((int32_t(x) * touch_calibration.calibration.x) >> 16) + touch_calibration.calibration.offset_x; - y = int16_t((int32_t(y) * touch_calibration.calibration.y) >> 16) + touch_calibration.calibration.offset_y; - #else - x = uint16_t((uint32_t(x) * TOUCH_CALIBRATION_X) >> 16) + TOUCH_OFFSET_X; - y = uint16_t((uint32_t(y) * TOUCH_CALIBRATION_Y) >> 16) + TOUCH_OFFSET_Y; + #if ENABLED(TFT_TOUCH_DEVICE_XPT2046) + const bool is_touched = (TERN(TOUCH_SCREEN_CALIBRATION, touch_calibration.calibration.orientation, TOUCH_ORIENTATION) == TOUCH_PORTRAIT ? touchIO.getRawPoint(&y, &x) : touchIO.getRawPoint(&x, &y)); + #if HAS_TOUCH_SLEEP + if (is_touched) + wakeUp(); + else if (!isSleeping() && ELAPSED(millis(), next_sleep_ms) && ui.on_status_screen()) + sleepTimeout(); + #endif + if (!is_touched) return 0; + + #if ENABLED(TOUCH_SCREEN_CALIBRATION) + const calibrationState state = touch_calibration.get_calibration_state(); + if (WITHIN(state, CALIBRATION_TOP_LEFT, CALIBRATION_BOTTOM_RIGHT)) { + if (touch_calibration.handleTouch(x, y)) ui.refresh(); + return 0; + } + x = int16_t((int32_t(x) * touch_calibration.calibration.x) >> 16) + touch_calibration.calibration.offset_x; + y = int16_t((int32_t(y) * touch_calibration.calibration.y) >> 16) + touch_calibration.calibration.offset_y; + #else + x = uint16_t((uint32_t(x) * TOUCH_CALIBRATION_X) >> 16) + TOUCH_OFFSET_X; + y = uint16_t((uint32_t(y) * TOUCH_CALIBRATION_Y) >> 16) + TOUCH_OFFSET_Y; + #endif + #elif ENABLED(TFT_TOUCH_DEVICE_GT911) + bool is_touched = (TOUCH_ORIENTATION == TOUCH_PORTRAIT ? touchIO.getPoint(&y, &x) : touchIO.getPoint(&x, &y)); + if (!is_touched) return 0; #endif // Touch within the button area simulates an encoder button diff --git a/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h b/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h index 5a772eb21b09..ddc0a202ea30 100644 --- a/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h +++ b/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h @@ -33,6 +33,7 @@ #define MARLIN_EEPROM_SIZE 0x1000 // 4K (24C32) #define HAS_OTG_USB_HOST_SUPPORT // USB Flash Drive support +//#define SWD_DEBUG // Use pins PA13 and PA14 on STM32H7 for the SWD debugger // // Limit Switches @@ -47,8 +48,10 @@ #define FIL_RUNOUT_PIN PD13 #define FIL_RUNOUT2_PIN PB13 -#define LED_PIN PA13 -#define BEEPER_PIN PA14 +#ifndef SWD_DEBUG + #define LED_PIN PA13 + #define BEEPER_PIN PA14 +#endif #define POWER_MONITOR_PIN PB0 #define RPI_POWER_PIN PE5 From 645c7dc370cdba8d3397aff78567084b170ca8fd Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 24 Jun 2022 00:21:33 +0000 Subject: [PATCH 189/241] [cron] Bump distribution date (2022-06-24) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index c8032d34c0d9..ccb7ee4995c8 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-06-23" +//#define STRING_DISTRIBUTION_DATE "2022-06-24" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index c43930122643..222b9a5415c9 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-06-23" + #define STRING_DISTRIBUTION_DATE "2022-06-24" #endif /** From 12a869e2ad3b36d6b965be2738308956963e2da4 Mon Sep 17 00:00:00 2001 From: Bob Kuhn Date: Thu, 23 Jun 2022 23:58:26 -0500 Subject: [PATCH 190/241] =?UTF-8?q?=F0=9F=90=9B=20Fix=20Lerdge=20build=20/?= =?UTF-8?q?=20encrypt=20(#24391)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- buildroot/share/PlatformIO/scripts/lerdge.py | 10 +-- buildroot/share/PlatformIO/scripts/marlin.py | 4 +- .../PlatformIO/scripts/offset_and_rename.py | 10 +-- ini/stm32f1.ini | 36 ++++----- ini/stm32f4.ini | 80 +++++++++---------- 5 files changed, 70 insertions(+), 70 deletions(-) diff --git a/buildroot/share/PlatformIO/scripts/lerdge.py b/buildroot/share/PlatformIO/scripts/lerdge.py index 505a935560a9..06e454393073 100644 --- a/buildroot/share/PlatformIO/scripts/lerdge.py +++ b/buildroot/share/PlatformIO/scripts/lerdge.py @@ -26,10 +26,10 @@ def encrypt_file(input, output_file, file_length): input_file[i] = encryptByte(input_file[i]) output_file.write(input_file) - # Encrypt ${PROGNAME}.bin and save it with the name given in build.encrypt + # Encrypt ${PROGNAME}.bin and save it with the name given in build.crypt_lerdge def encrypt(source, target, env): fwpath = target[0].path - enname = board.get("build.encrypt") + enname = board.get("build.crypt_lerdge") print("Encrypting %s to %s" % (fwpath, enname)) fwfile = open(fwpath, "rb") enfile = open(target[0].dir.path + "/" + enname, "wb") @@ -41,9 +41,9 @@ def encrypt(source, target, env): enfile.close() os.remove(fwpath) - if 'encrypt' in board.get("build").keys(): - if board.get("build.encrypt") != "": + if 'crypt_lerdge' in board.get("build").keys(): + if board.get("build.crypt_lerdge") != "": marlin.add_post_action(encrypt) else: - print("LERDGE builds require output file via board_build.encrypt = 'filename' parameter") + print("LERDGE builds require output file via board_build.crypt_lerdge = 'filename' parameter") exit(1) diff --git a/buildroot/share/PlatformIO/scripts/marlin.py b/buildroot/share/PlatformIO/scripts/marlin.py index 8ac36b7d59b5..580268c42324 100644 --- a/buildroot/share/PlatformIO/scripts/marlin.py +++ b/buildroot/share/PlatformIO/scripts/marlin.py @@ -41,8 +41,8 @@ def custom_ld_script(ldname): elif flag == "-T": env["LINKFLAGS"][i + 1] = apath -# Encrypt ${PROGNAME}.bin and save it with a new name -# Called by specific encrypt() functions, mostly for MKS boards +# Encrypt ${PROGNAME}.bin and save it with a new name. This applies (mostly) to MKS boards +# This PostAction is set up by offset_and_rename.py for envs with 'build.encrypt_mks'. def encrypt_mks(source, target, env, new_name): import sys diff --git a/buildroot/share/PlatformIO/scripts/offset_and_rename.py b/buildroot/share/PlatformIO/scripts/offset_and_rename.py index ddbb786fecd1..6f445246190f 100644 --- a/buildroot/share/PlatformIO/scripts/offset_and_rename.py +++ b/buildroot/share/PlatformIO/scripts/offset_and_rename.py @@ -39,15 +39,15 @@ env["LINKFLAGS"][i] = "-Wl,--defsym=LD_MAX_DATA_SIZE=" + str(maximum_ram_size - 40) # - # For build.encrypt rename and encode the firmware file. + # For build.encrypt_mks rename and encode the firmware file. # - if 'encrypt' in board_keys: + if 'encrypt_mks' in board_keys: - # Encrypt ${PROGNAME}.bin and save it with the name given in build.encrypt + # Encrypt ${PROGNAME}.bin and save it with the name given in build.encrypt_mks def encrypt(source, target, env): - marlin.encrypt_mks(source, target, env, board.get("build.encrypt")) + marlin.encrypt_mks(source, target, env, board.get("build.encrypt_mks")) - if board.get("build.encrypt") != "": + if board.get("build.encrypt_mks") != "": marlin.add_post_action(encrypt) # diff --git a/ini/stm32f1.ini b/ini/stm32f1.ini index 91005af2ff5a..8dc9bc3061b8 100644 --- a/ini/stm32f1.ini +++ b/ini/stm32f1.ini @@ -89,22 +89,22 @@ board_upload.offset_address = 0x08005000 # Uses HAL STM32 to support Marlin UI for TFT screen with optional touch panel # [env:mks_robin] -extends = stm32_variant -board = genericSTM32F103ZE -board_build.variant = MARLIN_F103Zx -board_build.encrypt = Robin.bin -board_build.offset = 0x7000 -build_flags = ${stm32_variant.build_flags} - -DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5 -build_unflags = ${stm32_variant.build_unflags} - -DUSBCON -DUSBD_USE_CDC +extends = stm32_variant +board = genericSTM32F103ZE +board_build.variant = MARLIN_F103Zx +board_build.encrypt_mks = Robin.bin +board_build.offset = 0x7000 +build_flags = ${stm32_variant.build_flags} + -DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5 +build_unflags = ${stm32_variant.build_unflags} + -DUSBCON -DUSBD_USE_CDC # # MKS Robin E3/E3D (STM32F103RCT6) with TMC2209 # [env:mks_robin_e3] extends = common_STM32F103RC_variant -board_build.encrypt = Robin_e3.bin +board_build.encrypt_mks = Robin_e3.bin board_build.offset = 0x5000 board_upload.offset_address = 0x08005000 build_flags = ${common_STM32F103RC_variant.build_flags} @@ -206,7 +206,7 @@ build_unflags = ${stm32_variant.build_unflags} -DUSBD_USE_CDC extends = stm32_variant board = genericSTM32F103VE board_build.variant = MARLIN_F103Vx -board_build.encrypt = Robin_mini.bin +board_build.encrypt_mks = Robin_mini.bin board_build.offset = 0x7000 board_upload.offset_address = 0x08007000 build_flags = ${stm32_variant.build_flags} @@ -222,7 +222,7 @@ build_unflags = ${stm32_variant.build_unflags} extends = stm32_variant board = genericSTM32F103VE board_build.variant = MARLIN_F103Vx -board_build.encrypt = Robin_nano35.bin +board_build.encrypt_mks = Robin_nano35.bin board_build.offset = 0x7000 board_upload.offset_address = 0x08007000 build_flags = ${stm32_variant.build_flags} @@ -275,7 +275,7 @@ build_flags = ${stm32_variant.build_flags} -DSS_TIMER=4 extends = stm32_variant board = genericSTM32F103VE board_build.variant = MARLIN_F103Vx -board_build.encrypt = Robin_mini.bin +board_build.encrypt_mks = Robin_mini.bin board_build.offset = 0x7000 board_upload.offset_address = 0x08007000 build_flags = ${stm32_variant.build_flags} @@ -288,7 +288,7 @@ build_flags = ${stm32_variant.build_flags} extends = stm32_variant board = genericSTM32F103RC board_build.variant = MARLIN_F103Rx -board_build.encrypt = mksLite.bin +board_build.encrypt_mks = mksLite.bin board_build.offset = 0x5000 board_upload.offset_address = 0x08005000 @@ -297,14 +297,14 @@ board_upload.offset_address = 0x08005000 # [env:mks_robin_lite3] extends = env:mks_robin_lite -board_build.encrypt = mksLite3.bin +board_build.encrypt_mks = mksLite3.bin # # MKS Robin Pro (STM32F103ZET6) # [env:mks_robin_pro] -extends = env:mks_robin -board_build.encrypt = Robin_pro.bin +extends = env:mks_robin +board_build.encrypt_mks = Robin_pro.bin # # MKS Robin E3p (STM32F103VET6) @@ -314,7 +314,7 @@ board_build.encrypt = Robin_pro.bin extends = stm32_variant board = genericSTM32F103VE board_build.variant = MARLIN_F103Vx -board_build.encrypt = Robin_e3p.bin +board_build.encrypt_mks = Robin_e3p.bin board_build.offset = 0x7000 board_upload.offset_address = 0x08007000 build_flags = ${stm32_variant.build_flags} diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 688cc1054736..8bcbb88d9444 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -113,7 +113,7 @@ extra_scripts = ${stm32_variant.extra_scripts} extends = stm32_variant board = marlin_STM32F407VGT6_CCM board_build.variant = MARLIN_F4x7Vx -board_build.encrypt = firmware.srec +board_build.encrypt_mks = firmware.srec board_build.offset = 0x10000 board_upload.offset_address = 0x08010000 build_flags = ${stm32_variant.build_flags} @@ -302,24 +302,24 @@ build_flags = ${stm_flash_drive.build_flags} # Lerdge base # [lerdge_common] -extends = stm32_variant -board = marlin_STM32F407ZGT6 -board_build.variant = MARLIN_LERDGE -board_build.offset = 0x10000 -build_flags = ${stm32_variant.build_flags} - -DSTM32F4 -DSTM32F4xx -DTARGET_STM32F4 - -DDISABLE_GENERIC_SERIALUSB -DARDUINO_ARCH_STM32 -DLERDGE_TFT35 -build_unflags = ${stm32_variant.build_unflags} -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483 -extra_scripts = ${common_stm32.extra_scripts} - pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py - buildroot/share/PlatformIO/scripts/lerdge.py +extends = stm32_variant +board = marlin_STM32F407ZGT6 +board_build.variant = MARLIN_LERDGE +board_build.crypt_lerdge = firmware.bin +board_build.offset = 0x10000 +build_flags = ${stm32_variant.build_flags} + -DSTM32F4 -DSTM32F4xx -DTARGET_STM32F4 + -DDISABLE_GENERIC_SERIALUSB -DARDUINO_ARCH_STM32 -DLERDGE_TFT35 +build_unflags = ${stm32_variant.build_unflags} -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483 +extra_scripts = ${stm32_variant.extra_scripts} + buildroot/share/PlatformIO/scripts/lerdge.py # # Lerdge X (STM32F407VE) # [env:LERDGEX] -extends = lerdge_common -board_build.encrypt = Lerdge_X_firmware_force.bin +extends = lerdge_common +board_build.crypt_lerdge = Lerdge_X_firmware_force.bin # # Lerdge X with USB Flash Drive Support @@ -333,8 +333,8 @@ build_flags = ${stm_flash_drive.build_flags} ${lerdge_common.build_flags} # Lerdge S (STM32F407ZG) # [env:LERDGES] -extends = lerdge_common -board_build.encrypt = Lerdge_firmware_force.bin +extends = lerdge_common +board_build.crypt_lerdge = Lerdge_firmware_force.bin # # Lerdge S with USB Flash Drive Support @@ -348,9 +348,9 @@ build_flags = ${stm_flash_drive.build_flags} ${lerdge_common.build_flags} # Lerdge K (STM32F407ZG) # [env:LERDGEK] -extends = lerdge_common -board_build.encrypt = Lerdge_K_firmware_force.bin -build_flags = ${lerdge_common.build_flags} -DLERDGEK +extends = lerdge_common +board_build.crypt_lerdge = Lerdge_K_firmware_force.bin +build_flags = ${lerdge_common.build_flags} -DLERDGEK # # Lerdge K with USB Flash Drive Support @@ -364,17 +364,17 @@ build_flags = ${stm_flash_drive.build_flags} ${lerdge_common.build_flags} # RUMBA32 # [env:rumba32] -extends = stm32_variant -board = rumba32_f446ve -board_build.variant = MARLIN_F446VE -board_build.offset = 0x0000 -build_flags = ${stm32_variant.build_flags} - -Os -DHAL_PCD_MODULE_ENABLED - -DDISABLE_GENERIC_SERIALUSB - -DHAL_UART_MODULE_ENABLED - -DTIMER_SERIAL=TIM9 -monitor_speed = 500000 -upload_protocol = dfu +extends = stm32_variant +board = rumba32_f446ve +board_build.variant = MARLIN_F446VE +board_build.offset = 0x0000 +build_flags = ${stm32_variant.build_flags} + -Os -DHAL_PCD_MODULE_ENABLED + -DDISABLE_GENERIC_SERIALUSB + -DHAL_UART_MODULE_ENABLED + -DTIMER_SERIAL=TIM9 +monitor_speed = 500000 +upload_protocol = dfu # # MKS Robin Pro V2 @@ -547,17 +547,17 @@ build_unflags = -DUSBD_USE_CDC # TH3D EZBoard v2.0 (STM32F405RGT6 ARM Cortex-M4) # [env:TH3D_EZBoard_V2] -extends = stm32_variant -board = genericSTM32F405RG -board_build.variant = MARLIN_TH3D_EZBOARD_V2 -board_build.encrypt = firmware.bin -board_build.offset = 0xC000 +extends = stm32_variant +board = genericSTM32F405RG +board_build.variant = MARLIN_TH3D_EZBOARD_V2 +board_build.encrypt_mks = firmware.bin +board_build.offset = 0xC000 board_upload.offset_address = 0x0800C000 -build_flags = ${stm32_variant.build_flags} -DHSE_VALUE=12000000U -O0 -debug_tool = stlink -upload_protocol = stlink -extra_scripts = ${stm32_variant.extra_scripts} - buildroot/share/PlatformIO/scripts/openblt.py +build_flags = ${stm32_variant.build_flags} -DHSE_VALUE=12000000U -O0 +debug_tool = stlink +upload_protocol = stlink +extra_scripts = ${stm32_variant.extra_scripts} + buildroot/share/PlatformIO/scripts/openblt.py # # BOARD_MKS_ROBIN_NANO_V1_3_F4 From 0aebcc4dedee349dce809df6d3c7a3727fa707c7 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 25 Jun 2022 00:22:43 +0000 Subject: [PATCH 191/241] [cron] Bump distribution date (2022-06-25) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index ccb7ee4995c8..a8818eb51737 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-06-24" +//#define STRING_DISTRIBUTION_DATE "2022-06-25" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 222b9a5415c9..49d026c4210d 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-06-24" + #define STRING_DISTRIBUTION_DATE "2022-06-25" #endif /** From 546b3066c3b45f0511e3a6c068d85f30a41e9d15 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 24 Jun 2022 22:07:06 -0500 Subject: [PATCH 192/241] =?UTF-8?q?=F0=9F=8C=90=20Drop=20unused=20delta=20?= =?UTF-8?q?strings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/language/language_cz.h | 2 -- Marlin/src/lcd/language/language_de.h | 2 -- Marlin/src/lcd/language/language_en.h | 2 -- Marlin/src/lcd/language/language_es.h | 2 -- Marlin/src/lcd/language/language_eu.h | 1 - Marlin/src/lcd/language/language_fr.h | 2 -- Marlin/src/lcd/language/language_gl.h | 2 -- Marlin/src/lcd/language/language_hu.h | 2 -- Marlin/src/lcd/language/language_it.h | 2 -- Marlin/src/lcd/language/language_nl.h | 2 +- Marlin/src/lcd/language/language_pl.h | 2 -- Marlin/src/lcd/language/language_pt_br.h | 2 -- Marlin/src/lcd/language/language_ro.h | 2 -- Marlin/src/lcd/language/language_ru.h | 6 ------ Marlin/src/lcd/language/language_sk.h | 2 -- Marlin/src/lcd/language/language_sv.h | 2 -- Marlin/src/lcd/language/language_tr.h | 2 -- Marlin/src/lcd/language/language_uk.h | 2 -- Marlin/src/lcd/language/language_vi.h | 2 -- Marlin/src/lcd/language/language_zh_CN.h | 2 -- Marlin/src/lcd/language/language_zh_TW.h | 2 -- 21 files changed, 1 insertion(+), 44 deletions(-) diff --git a/Marlin/src/lcd/language/language_cz.h b/Marlin/src/lcd/language/language_cz.h index d78b43f9a9e0..555fec1d20a2 100644 --- a/Marlin/src/lcd/language/language_cz.h +++ b/Marlin/src/lcd/language/language_cz.h @@ -432,8 +432,6 @@ namespace Language_cz { LSTR MSG_DELTA_CALIBRATE_CENTER = _UxGT("Kalibrovat Střed"); LSTR MSG_DELTA_SETTINGS = _UxGT("Delta nastavení"); LSTR MSG_DELTA_AUTO_CALIBRATE = _UxGT("Autokalibrace"); - LSTR MSG_DELTA_HEIGHT_CALIBRATE = _UxGT("Nast.výšku delty"); - LSTR MSG_DELTA_Z_OFFSET_CALIBRATE = _UxGT("Nast. Z-ofset"); LSTR MSG_DELTA_DIAG_ROD = _UxGT("Diag rameno"); LSTR MSG_DELTA_HEIGHT = _UxGT("Výška"); LSTR MSG_DELTA_RADIUS = _UxGT("Poloměr"); diff --git a/Marlin/src/lcd/language/language_de.h b/Marlin/src/lcd/language/language_de.h index 2b22319361aa..a9fa16c77cbe 100644 --- a/Marlin/src/lcd/language/language_de.h +++ b/Marlin/src/lcd/language/language_de.h @@ -544,8 +544,6 @@ namespace Language_de { LSTR MSG_DELTA_CALIBRATE_CENTER = _UxGT("Kalibriere Mitte"); LSTR MSG_DELTA_SETTINGS = _UxGT("Delta Einst. anzeig."); LSTR MSG_DELTA_AUTO_CALIBRATE = _UxGT("Autom. Kalibrierung"); - LSTR MSG_DELTA_HEIGHT_CALIBRATE = _UxGT("Delta Höhe setzen"); - LSTR MSG_DELTA_Z_OFFSET_CALIBRATE = _UxGT("Sondenversatz Z"); LSTR MSG_DELTA_DIAG_ROD = _UxGT("Diag Rod"); LSTR MSG_DELTA_HEIGHT = _UxGT("Höhe"); LSTR MSG_DELTA_RADIUS = _UxGT("Radius"); diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 81f30b61d8ef..6e6811d62b08 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -600,8 +600,6 @@ namespace Language_en { LSTR MSG_DELTA_CALIBRATE_CENTER = _UxGT("Calibrate Center"); LSTR MSG_DELTA_SETTINGS = _UxGT("Delta Settings"); LSTR MSG_DELTA_AUTO_CALIBRATE = _UxGT("Auto Calibration"); - LSTR MSG_DELTA_HEIGHT_CALIBRATE = _UxGT("Set Delta Height"); - LSTR MSG_DELTA_Z_OFFSET_CALIBRATE = _UxGT("Probe Z-offset"); LSTR MSG_DELTA_DIAG_ROD = _UxGT("Diag Rod"); LSTR MSG_DELTA_HEIGHT = _UxGT("Height"); LSTR MSG_DELTA_RADIUS = _UxGT("Radius"); diff --git a/Marlin/src/lcd/language/language_es.h b/Marlin/src/lcd/language/language_es.h index cc331efd4562..9cb86c5c3246 100644 --- a/Marlin/src/lcd/language/language_es.h +++ b/Marlin/src/lcd/language/language_es.h @@ -430,8 +430,6 @@ namespace Language_es { LSTR MSG_DELTA_CALIBRATE_CENTER = _UxGT("Calibrar Centro"); LSTR MSG_DELTA_SETTINGS = _UxGT("Configuración Delta"); LSTR MSG_DELTA_AUTO_CALIBRATE = _UxGT("Auto Calibración"); - LSTR MSG_DELTA_HEIGHT_CALIBRATE = _UxGT("Est. Altura Delta"); - LSTR MSG_DELTA_Z_OFFSET_CALIBRATE = _UxGT("Ajustar Sonda Z"); LSTR MSG_DELTA_DIAG_ROD = _UxGT("Barra Diagonal"); LSTR MSG_DELTA_HEIGHT = _UxGT("Altura"); LSTR MSG_DELTA_RADIUS = _UxGT("Radio"); diff --git a/Marlin/src/lcd/language/language_eu.h b/Marlin/src/lcd/language/language_eu.h index 09a0fbeb6ac6..5504d4da942e 100644 --- a/Marlin/src/lcd/language/language_eu.h +++ b/Marlin/src/lcd/language/language_eu.h @@ -257,7 +257,6 @@ namespace Language_eu { LSTR MSG_DELTA_CALIBRATE_CENTER = _UxGT("Kalibratu Zentrua"); LSTR MSG_DELTA_SETTINGS = _UxGT("Delta ezarpenak"); LSTR MSG_DELTA_AUTO_CALIBRATE = _UxGT("Auto Kalibraketa"); - LSTR MSG_DELTA_HEIGHT_CALIBRATE = _UxGT("Delta Alt. Ezar."); LSTR MSG_DELTA_DIAG_ROD = _UxGT("Barra diagonala"); LSTR MSG_DELTA_HEIGHT = _UxGT("Altuera"); LSTR MSG_DELTA_RADIUS = _UxGT("Erradioa"); diff --git a/Marlin/src/lcd/language/language_fr.h b/Marlin/src/lcd/language/language_fr.h index 6081234607f4..55b1b4e2e9c9 100644 --- a/Marlin/src/lcd/language/language_fr.h +++ b/Marlin/src/lcd/language/language_fr.h @@ -460,8 +460,6 @@ namespace Language_fr { LSTR MSG_DELTA_CALIBRATE_CENTER = _UxGT("Calibrer centre"); LSTR MSG_DELTA_SETTINGS = _UxGT("Réglages Delta"); LSTR MSG_DELTA_AUTO_CALIBRATE = _UxGT("Calibration Auto"); - LSTR MSG_DELTA_HEIGHT_CALIBRATE = _UxGT("Hauteur Delta"); - LSTR MSG_DELTA_Z_OFFSET_CALIBRATE = _UxGT("Delta Z sonde"); LSTR MSG_DELTA_DIAG_ROD = _UxGT("Diagonale"); LSTR MSG_DELTA_HEIGHT = _UxGT("Hauteur"); LSTR MSG_DELTA_RADIUS = _UxGT("Rayon"); diff --git a/Marlin/src/lcd/language/language_gl.h b/Marlin/src/lcd/language/language_gl.h index dabd35efcf9b..827130de6c46 100644 --- a/Marlin/src/lcd/language/language_gl.h +++ b/Marlin/src/lcd/language/language_gl.h @@ -445,8 +445,6 @@ namespace Language_gl { LSTR MSG_DELTA_CALIBRATE_CENTER = _UxGT("Calibrar Centro"); LSTR MSG_DELTA_SETTINGS = _UxGT("Configuración Delta"); LSTR MSG_DELTA_AUTO_CALIBRATE = _UxGT("Auto Calibración"); - LSTR MSG_DELTA_HEIGHT_CALIBRATE = _UxGT("Ax. Altura Delta"); - LSTR MSG_DELTA_Z_OFFSET_CALIBRATE = _UxGT("Axustar Sonda Z"); LSTR MSG_DELTA_DIAG_ROD = _UxGT("Barra Diagonal"); LSTR MSG_DELTA_HEIGHT = _UxGT("Altura"); LSTR MSG_DELTA_RADIUS = _UxGT("Radio"); diff --git a/Marlin/src/lcd/language/language_hu.h b/Marlin/src/lcd/language/language_hu.h index 81db96df1702..eebcb759e5e8 100644 --- a/Marlin/src/lcd/language/language_hu.h +++ b/Marlin/src/lcd/language/language_hu.h @@ -508,8 +508,6 @@ namespace Language_hu { LSTR MSG_DELTA_CALIBRATE_CENTER = _UxGT("Központ kalibrálás"); LSTR MSG_DELTA_SETTINGS = _UxGT("Delta beállítások"); LSTR MSG_DELTA_AUTO_CALIBRATE = _UxGT("Auto kalibráció"); - LSTR MSG_DELTA_HEIGHT_CALIBRATE = _UxGT("Delta magasság kalib."); - LSTR MSG_DELTA_Z_OFFSET_CALIBRATE = _UxGT("Z eltolás"); LSTR MSG_DELTA_DIAG_ROD = _UxGT("Diag rúd"); LSTR MSG_DELTA_HEIGHT = _UxGT("Magasság"); LSTR MSG_DELTA_RADIUS = _UxGT("Sugár"); diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index b043ac26e168..1a1179f2c7fc 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -554,8 +554,6 @@ namespace Language_it { LSTR MSG_DELTA_CALIBRATE_CENTER = _UxGT("Calibra centro"); LSTR MSG_DELTA_SETTINGS = _UxGT("Impostaz. Delta"); LSTR MSG_DELTA_AUTO_CALIBRATE = _UxGT("Auto calibrazione"); - LSTR MSG_DELTA_HEIGHT_CALIBRATE = _UxGT("Imp. altezza Delta"); - LSTR MSG_DELTA_Z_OFFSET_CALIBRATE = _UxGT("Offset sonda-Z"); LSTR MSG_DELTA_DIAG_ROD = _UxGT("Barra Diagonale"); LSTR MSG_DELTA_HEIGHT = _UxGT("Altezza"); LSTR MSG_DELTA_RADIUS = _UxGT("Raggio"); diff --git a/Marlin/src/lcd/language/language_nl.h b/Marlin/src/lcd/language/language_nl.h index 6b308ba48bac..ca51198034ea 100644 --- a/Marlin/src/lcd/language/language_nl.h +++ b/Marlin/src/lcd/language/language_nl.h @@ -173,8 +173,8 @@ namespace Language_nl { LSTR MSG_DELTA_CALIBRATE_Y = _UxGT("Kalibreer Y"); LSTR MSG_DELTA_CALIBRATE_Z = _UxGT("Kalibreer Z"); LSTR MSG_DELTA_CALIBRATE_CENTER = _UxGT("Kalibreer Midden"); + LSTR MSG_DELTA_SETTINGS = _UxGT("Delta conf"); LSTR MSG_DELTA_AUTO_CALIBRATE = _UxGT("Auto Calibratie"); - LSTR MSG_DELTA_HEIGHT_CALIBRATE = _UxGT("Zet Delta Hoogte"); LSTR MSG_CASE_LIGHT = _UxGT("Case licht"); diff --git a/Marlin/src/lcd/language/language_pl.h b/Marlin/src/lcd/language/language_pl.h index 630f94ab12df..34155f87fed8 100644 --- a/Marlin/src/lcd/language/language_pl.h +++ b/Marlin/src/lcd/language/language_pl.h @@ -400,8 +400,6 @@ namespace Language_pl { LSTR MSG_DELTA_CALIBRATE_CENTER = _UxGT("Kalibruj środek"); LSTR MSG_DELTA_SETTINGS = _UxGT("Ustawienia delty"); LSTR MSG_DELTA_AUTO_CALIBRATE = _UxGT("Auto kalibrowanie"); - LSTR MSG_DELTA_HEIGHT_CALIBRATE = _UxGT("Ustaw wysokość delty"); - LSTR MSG_DELTA_Z_OFFSET_CALIBRATE = _UxGT("Przesun. Z sondy"); LSTR MSG_DELTA_DIAG_ROD = _UxGT("Ukośne ramię"); LSTR MSG_DELTA_HEIGHT = _UxGT("Wysokość"); LSTR MSG_DELTA_RADIUS = _UxGT("Promień"); diff --git a/Marlin/src/lcd/language/language_pt_br.h b/Marlin/src/lcd/language/language_pt_br.h index 5b73d6df6def..0f0f8c5287c2 100644 --- a/Marlin/src/lcd/language/language_pt_br.h +++ b/Marlin/src/lcd/language/language_pt_br.h @@ -373,8 +373,6 @@ namespace Language_pt_br { LSTR MSG_DELTA_CALIBRATE_CENTER = _UxGT("Calibrar Centro"); LSTR MSG_DELTA_SETTINGS = _UxGT("Configuração Delta"); LSTR MSG_DELTA_AUTO_CALIBRATE = _UxGT("Auto-Calibração"); - LSTR MSG_DELTA_HEIGHT_CALIBRATE = _UxGT("Calibrar Altura"); - LSTR MSG_DELTA_Z_OFFSET_CALIBRATE = _UxGT("Desloc. Sonda Z"); LSTR MSG_DELTA_DIAG_ROD = _UxGT("Haste Diagonal"); LSTR MSG_DELTA_HEIGHT = _UxGT("Altura"); LSTR MSG_DELTA_RADIUS = _UxGT("Raio"); diff --git a/Marlin/src/lcd/language/language_ro.h b/Marlin/src/lcd/language/language_ro.h index 79160624e7a4..3bd15f18a492 100644 --- a/Marlin/src/lcd/language/language_ro.h +++ b/Marlin/src/lcd/language/language_ro.h @@ -452,8 +452,6 @@ namespace Language_ro { LSTR MSG_DELTA_CALIBRATE_CENTER = _UxGT("Calibrate Center"); LSTR MSG_DELTA_SETTINGS = _UxGT("Delta Settings"); LSTR MSG_DELTA_AUTO_CALIBRATE = _UxGT("Auto Calibration"); - LSTR MSG_DELTA_HEIGHT_CALIBRATE = _UxGT("Set Delta Height"); - LSTR MSG_DELTA_Z_OFFSET_CALIBRATE = _UxGT("Probe Z-offset"); LSTR MSG_DELTA_DIAG_ROD = _UxGT("Diag Rod"); LSTR MSG_DELTA_HEIGHT = _UxGT("Inaltime"); LSTR MSG_DELTA_RADIUS = _UxGT("Radius"); diff --git a/Marlin/src/lcd/language/language_ru.h b/Marlin/src/lcd/language/language_ru.h index 5f05f1d2beb3..c9b4683bb20d 100644 --- a/Marlin/src/lcd/language/language_ru.h +++ b/Marlin/src/lcd/language/language_ru.h @@ -628,12 +628,6 @@ namespace Language_ru { LSTR MSG_DELTA_CALIBRATE_CENTER = _UxGT("Калибровать центр"); LSTR MSG_DELTA_SETTINGS = _UxGT("Настройки Delta"); LSTR MSG_DELTA_AUTO_CALIBRATE = _UxGT("Авто калибровка"); - LSTR MSG_DELTA_HEIGHT_CALIBRATE = _UxGT("Высота Delta"); - #if LCD_WIDTH > 21 || HAS_DWIN_E3V2 - LSTR MSG_DELTA_Z_OFFSET_CALIBRATE = _UxGT("Зондировать Z-смещения"); - #else - LSTR MSG_DELTA_Z_OFFSET_CALIBRATE = _UxGT("Зондир. Z-смещения"); - #endif LSTR MSG_DELTA_DIAG_ROD = _UxGT("Стержень диаг."); LSTR MSG_DELTA_HEIGHT = _UxGT("Высота"); LSTR MSG_DELTA_RADIUS = _UxGT("Радиус"); diff --git a/Marlin/src/lcd/language/language_sk.h b/Marlin/src/lcd/language/language_sk.h index 124080de0b85..89203538984e 100644 --- a/Marlin/src/lcd/language/language_sk.h +++ b/Marlin/src/lcd/language/language_sk.h @@ -540,8 +540,6 @@ namespace Language_sk { LSTR MSG_DELTA_CALIBRATE_CENTER = _UxGT("Kalibrovať stred"); LSTR MSG_DELTA_SETTINGS = _UxGT("Delta nastavenia"); LSTR MSG_DELTA_AUTO_CALIBRATE = _UxGT("Auto-kalibrácia"); - LSTR MSG_DELTA_HEIGHT_CALIBRATE = _UxGT("Nast. výšku delty"); - LSTR MSG_DELTA_Z_OFFSET_CALIBRATE = _UxGT("Ofset sondy Z"); LSTR MSG_DELTA_DIAG_ROD = _UxGT("Diag. rameno"); LSTR MSG_DELTA_HEIGHT = _UxGT("Výška"); LSTR MSG_DELTA_RADIUS = _UxGT("Polomer"); diff --git a/Marlin/src/lcd/language/language_sv.h b/Marlin/src/lcd/language/language_sv.h index 6e6d3e11ecd0..6bfb7100f4ef 100644 --- a/Marlin/src/lcd/language/language_sv.h +++ b/Marlin/src/lcd/language/language_sv.h @@ -489,8 +489,6 @@ namespace Language_sv { LSTR MSG_DELTA_CALIBRATE_CENTER = _UxGT("Kalibrera Center"); LSTR MSG_DELTA_SETTINGS = _UxGT("Delta Inställningar"); LSTR MSG_DELTA_AUTO_CALIBRATE = _UxGT("Auto Kalibrering"); - LSTR MSG_DELTA_HEIGHT_CALIBRATE = _UxGT("Sätt Delta Höjd"); - LSTR MSG_DELTA_Z_OFFSET_CALIBRATE = _UxGT("Sond Z-offset"); LSTR MSG_DELTA_DIAG_ROD = _UxGT("Diag Rod"); LSTR MSG_DELTA_HEIGHT = _UxGT("Höjd"); LSTR MSG_DELTA_RADIUS = _UxGT("Radius"); diff --git a/Marlin/src/lcd/language/language_tr.h b/Marlin/src/lcd/language/language_tr.h index b981127ed1cd..c9967f72ec2d 100644 --- a/Marlin/src/lcd/language/language_tr.h +++ b/Marlin/src/lcd/language/language_tr.h @@ -426,8 +426,6 @@ namespace Language_tr { LSTR MSG_DELTA_CALIBRATE_CENTER = _UxGT("Ayarla Merkez"); LSTR MSG_DELTA_SETTINGS = _UxGT("Delta Ayarları"); LSTR MSG_DELTA_AUTO_CALIBRATE = _UxGT("Oto Kalibrasyon"); - LSTR MSG_DELTA_HEIGHT_CALIBRATE = _UxGT("Delta Yük. Ayarla"); - LSTR MSG_DELTA_Z_OFFSET_CALIBRATE = _UxGT("Z Prob Ofseti"); LSTR MSG_DELTA_DIAG_ROD = _UxGT("Çapral Mil"); LSTR MSG_DELTA_HEIGHT = _UxGT("Yükseklik"); LSTR MSG_DELTA_RADIUS = _UxGT("Yarıçap"); diff --git a/Marlin/src/lcd/language/language_uk.h b/Marlin/src/lcd/language/language_uk.h index 3c47ccada916..6170faedaeea 100644 --- a/Marlin/src/lcd/language/language_uk.h +++ b/Marlin/src/lcd/language/language_uk.h @@ -652,8 +652,6 @@ namespace Language_uk { LSTR MSG_DELTA_CALIBRATE_CENTER = _UxGT("Калібр. центр"); LSTR MSG_DELTA_SETTINGS = _UxGT("Параметри Delta"); LSTR MSG_DELTA_AUTO_CALIBRATE = _UxGT("Автокалібрування"); - LSTR MSG_DELTA_HEIGHT_CALIBRATE = _UxGT("Встан. Висоту Delta"); - LSTR MSG_DELTA_Z_OFFSET_CALIBRATE = _UxGT("Z-зміщення зонду"); LSTR MSG_DELTA_DIAG_ROD = _UxGT("Діагональ стрижня"); LSTR MSG_DELTA_HEIGHT = _UxGT("Висота"); LSTR MSG_DELTA_RADIUS = _UxGT("Радіус"); diff --git a/Marlin/src/lcd/language/language_vi.h b/Marlin/src/lcd/language/language_vi.h index f963e3e346bc..989a201d4d92 100644 --- a/Marlin/src/lcd/language/language_vi.h +++ b/Marlin/src/lcd/language/language_vi.h @@ -355,8 +355,6 @@ namespace Language_vi { LSTR MSG_DELTA_CALIBRATE_CENTER = _UxGT("Chỉnh Z Center"); // Calibrate Center LSTR MSG_DELTA_SETTINGS = _UxGT("Cài Đặt Delta"); // Delta Settings LSTR MSG_DELTA_AUTO_CALIBRATE = _UxGT("Cân Chỉnh Tự Động"); // Auto Calibration - LSTR MSG_DELTA_HEIGHT_CALIBRATE = _UxGT("Đặt Chiều Cao Delta"); // Set Delta Height - LSTR MSG_DELTA_Z_OFFSET_CALIBRATE = _UxGT("Đầu Dò Z-Bù Đắp"); // Probe Z-offset LSTR MSG_DELTA_DIAG_ROD = _UxGT("Gậy Chéo"); // Diag Rod LSTR MSG_DELTA_HEIGHT = _UxGT("Chiều Cao"); // Height LSTR MSG_DELTA_RADIUS = _UxGT("Bán Kính"); // Radius diff --git a/Marlin/src/lcd/language/language_zh_CN.h b/Marlin/src/lcd/language/language_zh_CN.h index a4816ff899c0..fc61b020ffc2 100644 --- a/Marlin/src/lcd/language/language_zh_CN.h +++ b/Marlin/src/lcd/language/language_zh_CN.h @@ -454,8 +454,6 @@ namespace Language_zh_CN { LSTR MSG_DELTA_CALIBRATE_CENTER = _UxGT("⊿校准中心"); // "Calibrate Center" LSTR MSG_DELTA_SETTINGS = _UxGT("⊿设置"); // "Delta Settings" LSTR MSG_DELTA_AUTO_CALIBRATE = _UxGT("⊿自动校准"); // "Auto Calibration" - LSTR MSG_DELTA_HEIGHT_CALIBRATE = _UxGT("设置⊿高度"); // "Set Delta Height" - LSTR MSG_DELTA_Z_OFFSET_CALIBRATE = _UxGT("探针Z偏移量"); LSTR MSG_DELTA_DIAG_ROD = _UxGT("⊿斜柱"); // "Diag Rod" LSTR MSG_DELTA_HEIGHT = _UxGT("⊿高度"); // "Height" LSTR MSG_DELTA_RADIUS = _UxGT("⊿半径"); // "Radius" diff --git a/Marlin/src/lcd/language/language_zh_TW.h b/Marlin/src/lcd/language/language_zh_TW.h index 5f7c85c8383d..b35a486e4f6a 100644 --- a/Marlin/src/lcd/language/language_zh_TW.h +++ b/Marlin/src/lcd/language/language_zh_TW.h @@ -403,8 +403,6 @@ namespace Language_zh_TW { LSTR MSG_DELTA_CALIBRATE_CENTER = _UxGT("⊿校準中心"); // "Calibrate Center" LSTR MSG_DELTA_SETTINGS = _UxGT("⊿設置"); // "Delta Settings" LSTR MSG_DELTA_AUTO_CALIBRATE = _UxGT("⊿自動校準"); // "Auto Calibration" - LSTR MSG_DELTA_HEIGHT_CALIBRATE = _UxGT("設置⊿高度"); // "Set Delta Height" - LSTR MSG_DELTA_Z_OFFSET_CALIBRATE = _UxGT("Z偏移"); LSTR MSG_DELTA_DIAG_ROD = _UxGT("⊿斜柱"); // "Diag Rod" LSTR MSG_DELTA_HEIGHT = _UxGT("⊿高度"); // "Height" LSTR MSG_DELTA_RADIUS = _UxGT("⊿半徑"); // "Radius" From a0125c85d4a7b943209cb109df4dca4180bf0378 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sun, 26 Jun 2022 00:26:54 +0000 Subject: [PATCH 193/241] [cron] Bump distribution date (2022-06-26) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index a8818eb51737..c889251d7250 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-06-25" +//#define STRING_DISTRIBUTION_DATE "2022-06-26" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 49d026c4210d..8e133f9d2286 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-06-25" + #define STRING_DISTRIBUTION_DATE "2022-06-26" #endif /** From 2266f1ad676b792c4cb368455f84e0540001dc27 Mon Sep 17 00:00:00 2001 From: tombrazier <68918209+tombrazier@users.noreply.github.com> Date: Sun, 26 Jun 2022 06:38:23 +0100 Subject: [PATCH 194/241] =?UTF-8?q?=E2=9C=A8=20MAX7219=20idle=20profiler?= =?UTF-8?q?=20(#24375)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 12 ++-- Marlin/src/MarlinCore.cpp | 4 ++ Marlin/src/feature/max7219.cpp | 104 +++++++++++++++++++++------------ Marlin/src/feature/max7219.h | 78 ++++++++++++++++++++++--- 4 files changed, 150 insertions(+), 48 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 96a3e04d0b77..b085ec7ec4a9 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -3595,7 +3595,7 @@ // ESP32: If SPINDLE_LASER_PWM_PIN is onboard then <=78125Hz. For I2S expander // the frequency determines the PWM resolution. 2500Hz = 0-100, 977Hz = 0-255, ... // (250000 / SPINDLE_LASER_FREQUENCY) = max value. -#endif + #endif //#define AIR_EVACUATION // Cutter Vacuum / Laser Blower motor control with G-codes M10-M11 #if ENABLED(AIR_EVACUATION) @@ -4289,7 +4289,8 @@ #define MAX7219_NUMBER_UNITS 1 // Number of Max7219 units in chain. #define MAX7219_ROTATE 0 // Rotate the display clockwise (in multiples of +/- 90°) // connector at: right=0 bottom=-90 top=90 left=180 - //#define MAX7219_REVERSE_ORDER // The individual LED matrix units may be in reversed order + //#define MAX7219_REVERSE_ORDER // The order of the LED matrix units may be reversed + //#define MAX7219_REVERSE_EACH // The LEDs in each matrix unit row may be reversed //#define MAX7219_SIDE_BY_SIDE // Big chip+matrix boards can be chained side-by-side /** @@ -4297,12 +4298,15 @@ * If you add more debug displays, be careful to avoid conflicts! */ #define MAX7219_DEBUG_PRINTER_ALIVE // Blink corner LED of 8x8 matrix to show that the firmware is functioning - #define MAX7219_DEBUG_PLANNER_HEAD 3 // Show the planner queue head position on this and the next LED matrix row - #define MAX7219_DEBUG_PLANNER_TAIL 5 // Show the planner queue tail position on this and the next LED matrix row + #define MAX7219_DEBUG_PLANNER_HEAD 2 // Show the planner queue head position on this and the next LED matrix row + #define MAX7219_DEBUG_PLANNER_TAIL 4 // Show the planner queue tail position on this and the next LED matrix row #define MAX7219_DEBUG_PLANNER_QUEUE 0 // Show the current planner queue depth on this and the next LED matrix row // If you experience stuttering, reboots, etc. this option can reveal how // tweaks made to the configuration are affecting the printer in real-time. + #define MAX7219_DEBUG_PROFILE 6 // Display the fraction of CPU time spent in profiled code on this LED matrix + // row. By default idle() is profiled so this shows how "idle" the processor is. + // See class CodeProfiler. #endif /** diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 67950299dbd4..2724006dd193 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -776,6 +776,10 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) { * - Handle Joystick jogging */ void idle(bool no_stepper_sleep/*=false*/) { + #ifdef MAX7219_DEBUG_PROFILE + CodeProfiler idle_profiler; + #endif + #if ENABLED(MARLIN_DEV_MODE) static uint16_t idle_depth = 0; if (++idle_depth > 5) SERIAL_ECHOLNPGM("idle() call depth: ", idle_depth); diff --git a/Marlin/src/feature/max7219.cpp b/Marlin/src/feature/max7219.cpp index 474933aa1946..6a4dbbec73d1 100644 --- a/Marlin/src/feature/max7219.cpp +++ b/Marlin/src/feature/max7219.cpp @@ -62,6 +62,15 @@ #error "MAX7219_ROTATE must be a multiple of +/- 90°." #endif +#ifdef MAX7219_DEBUG_PROFILE + CodeProfiler::Mode CodeProfiler::mode = ACCUMULATE_AVERAGE; + uint8_t CodeProfiler::instance_count = 0; + uint32_t CodeProfiler::last_calc_time = micros(); + uint8_t CodeProfiler::time_fraction = 0; + uint32_t CodeProfiler::total_time = 0; + uint16_t CodeProfiler::call_count = 0; +#endif + Max7219 max7219; uint8_t Max7219::led_line[MAX7219_LINES]; // = { 0 }; @@ -69,7 +78,7 @@ uint8_t Max7219::suspended; // = 0; #define LINE_REG(Q) (max7219_reg_digit0 + ((Q) & 0x7)) -#if _ROT == 0 || _ROT == 270 +#if (_ROT == 0 || _ROT == 270) == DISABLED(MAX7219_REVERSE_EACH) #define _LED_BIT(Q) (7 - ((Q) & 0x7)) #else #define _LED_BIT(Q) ((Q) & 0x7) @@ -266,26 +275,27 @@ void Max7219::set(const uint8_t line, const uint8_t bits) { #endif // MAX7219_NUMERIC // Modify a single LED bit and send the changed line -void Max7219::led_set(const uint8_t x, const uint8_t y, const bool on) { +void Max7219::led_set(const uint8_t x, const uint8_t y, const bool on, uint8_t * const rcm/*=nullptr*/) { if (x >= MAX7219_X_LEDS || y >= MAX7219_Y_LEDS) return error(F("led_set"), x, y); if (BIT_7219(x, y) == on) return; XOR_7219(x, y); refresh_unit_line(LED_IND(x, y)); + if (rcm != nullptr) *rcm |= _BV(LED_IND(x, y) & 0x07); } -void Max7219::led_on(const uint8_t x, const uint8_t y) { +void Max7219::led_on(const uint8_t x, const uint8_t y, uint8_t * const rcm/*=nullptr*/) { if (x >= MAX7219_X_LEDS || y >= MAX7219_Y_LEDS) return error(F("led_on"), x, y); - led_set(x, y, true); + led_set(x, y, true, rcm); } -void Max7219::led_off(const uint8_t x, const uint8_t y) { +void Max7219::led_off(const uint8_t x, const uint8_t y, uint8_t * const rcm/*=nullptr*/) { if (x >= MAX7219_X_LEDS || y >= MAX7219_Y_LEDS) return error(F("led_off"), x, y); - led_set(x, y, false); + led_set(x, y, false, rcm); } -void Max7219::led_toggle(const uint8_t x, const uint8_t y) { +void Max7219::led_toggle(const uint8_t x, const uint8_t y, uint8_t * const rcm/*=nullptr*/) { if (x >= MAX7219_X_LEDS || y >= MAX7219_Y_LEDS) return error(F("led_toggle"), x, y); - led_set(x, y, !BIT_7219(x, y)); + led_set(x, y, !BIT_7219(x, y), rcm); } void Max7219::send_row(const uint8_t row) { @@ -448,7 +458,7 @@ void Max7219::register_setup() { pulse_load(); // Tell the chips to load the clocked out data } -#ifdef MAX7219_INIT_TEST +#if MAX7219_INIT_TEST uint8_t test_mode = 0; millis_t next_patt_ms; @@ -536,13 +546,9 @@ void Max7219::init() { register_setup(); - LOOP_LE_N(i, 7) { // Empty registers to turn all LEDs off - led_line[i] = 0x00; - send(max7219_reg_digit0 + i, 0); - pulse_load(); // Tell the chips to load the clocked out data - } + clear(); - #ifdef MAX7219_INIT_TEST + #if MAX7219_INIT_TEST start_test_pattern(); #endif } @@ -554,41 +560,47 @@ void Max7219::init() { */ // Apply changes to update a marker -void Max7219::mark16(const uint8_t pos, const uint8_t v1, const uint8_t v2) { +void Max7219::mark16(const uint8_t pos, const uint8_t v1, const uint8_t v2, uint8_t * const rcm/*=nullptr*/) { #if MAX7219_X_LEDS > 8 // At least 16 LEDs on the X-Axis. Use single line. - led_off(v1 & 0xF, pos); - led_on(v2 & 0xF, pos); + led_off(v1 & 0xF, pos, rcm); + led_on(v2 & 0xF, pos, rcm); #elif MAX7219_Y_LEDS > 8 // At least 16 LEDs on the Y-Axis. Use a single column. - led_off(pos, v1 & 0xF); - led_on(pos, v2 & 0xF); + led_off(pos, v1 & 0xF, rcm); + led_on(pos, v2 & 0xF, rcm); #else // Single 8x8 LED matrix. Use two lines to get 16 LEDs. - led_off(v1 & 0x7, pos + (v1 >= 8)); - led_on(v2 & 0x7, pos + (v2 >= 8)); + led_off(v1 & 0x7, pos + (v1 >= 8), rcm); + led_on(v2 & 0x7, pos + (v2 >= 8), rcm); #endif } // Apply changes to update a tail-to-head range -void Max7219::range16(const uint8_t y, const uint8_t ot, const uint8_t nt, const uint8_t oh, const uint8_t nh) { +void Max7219::range16(const uint8_t y, const uint8_t ot, const uint8_t nt, const uint8_t oh, + const uint8_t nh, uint8_t * const rcm/*=nullptr*/) { #if MAX7219_X_LEDS > 8 // At least 16 LEDs on the X-Axis. Use single line. if (ot != nt) for (uint8_t n = ot & 0xF; n != (nt & 0xF) && n != (nh & 0xF); n = (n + 1) & 0xF) - led_off(n & 0xF, y); + led_off(n & 0xF, y, rcm); if (oh != nh) for (uint8_t n = (oh + 1) & 0xF; n != ((nh + 1) & 0xF); n = (n + 1) & 0xF) - led_on(n & 0xF, y); + led_on(n & 0xF, y, rcm); #elif MAX7219_Y_LEDS > 8 // At least 16 LEDs on the Y-Axis. Use a single column. if (ot != nt) for (uint8_t n = ot & 0xF; n != (nt & 0xF) && n != (nh & 0xF); n = (n + 1) & 0xF) - led_off(y, n & 0xF); + led_off(y, n & 0xF, rcm); if (oh != nh) for (uint8_t n = (oh + 1) & 0xF; n != ((nh + 1) & 0xF); n = (n + 1) & 0xF) - led_on(y, n & 0xF); + led_on(y, n & 0xF, rcm); #else // Single 8x8 LED matrix. Use two lines to get 16 LEDs. if (ot != nt) for (uint8_t n = ot & 0xF; n != (nt & 0xF) && n != (nh & 0xF); n = (n + 1) & 0xF) - led_off(n & 0x7, y + (n >= 8)); + led_off(n & 0x7, y + (n >= 8), rcm); if (oh != nh) for (uint8_t n = (oh + 1) & 0xF; n != ((nh + 1) & 0xF); n = (n + 1) & 0xF) - led_on(n & 0x7, y + (n >= 8)); + led_on(n & 0x7, y + (n >= 8), rcm); #endif } // Apply changes to update a quantity -void Max7219::quantity16(const uint8_t pos, const uint8_t ov, const uint8_t nv) { +void Max7219::quantity(const uint8_t pos, const uint8_t ov, const uint8_t nv, uint8_t * const rcm/*=nullptr*/) { + for (uint8_t i = _MIN(nv, ov); i < _MAX(nv, ov); i++) + led_set(i, pos, nv >= ov, rcm); +} + +void Max7219::quantity16(const uint8_t pos, const uint8_t ov, const uint8_t nv, uint8_t * const rcm/*=nullptr*/) { for (uint8_t i = _MIN(nv, ov); i < _MAX(nv, ov); i++) led_set( #if MAX7219_X_LEDS > 8 // At least 16 LEDs on the X-Axis. Use single line. @@ -599,6 +611,7 @@ void Max7219::quantity16(const uint8_t pos, const uint8_t ov, const uint8_t nv) i >> 1, pos + (i & 1) #endif , nv >= ov + , rcm ); } @@ -636,16 +649,20 @@ void Max7219::idle_tasks() { register_setup(); } - #ifdef MAX7219_INIT_TEST + #if MAX7219_INIT_TEST if (test_mode) { run_test_pattern(); return; } #endif + // suspend updates and record which lines have changed for batching later + suspended++; + uint8_t row_change_mask = 0x00; + #if ENABLED(MAX7219_DEBUG_PRINTER_ALIVE) if (do_blink) { - led_toggle(MAX7219_X_LEDS - 1, MAX7219_Y_LEDS - 1); + led_toggle(MAX7219_X_LEDS - 1, MAX7219_Y_LEDS - 1, &row_change_mask); next_blink = ms + 1000; } #endif @@ -655,7 +672,7 @@ void Max7219::idle_tasks() { static int16_t last_head_cnt = 0xF, last_tail_cnt = 0xF; if (last_head_cnt != head || last_tail_cnt != tail) { - range16(MAX7219_DEBUG_PLANNER_HEAD, last_tail_cnt, tail, last_head_cnt, head); + range16(MAX7219_DEBUG_PLANNER_HEAD, last_tail_cnt, tail, last_head_cnt, head, &row_change_mask); last_head_cnt = head; last_tail_cnt = tail; } @@ -665,7 +682,7 @@ void Max7219::idle_tasks() { #ifdef MAX7219_DEBUG_PLANNER_HEAD static int16_t last_head_cnt = 0x1; if (last_head_cnt != head) { - mark16(MAX7219_DEBUG_PLANNER_HEAD, last_head_cnt, head); + mark16(MAX7219_DEBUG_PLANNER_HEAD, last_head_cnt, head, &row_change_mask); last_head_cnt = head; } #endif @@ -673,7 +690,7 @@ void Max7219::idle_tasks() { #ifdef MAX7219_DEBUG_PLANNER_TAIL static int16_t last_tail_cnt = 0x1; if (last_tail_cnt != tail) { - mark16(MAX7219_DEBUG_PLANNER_TAIL, last_tail_cnt, tail); + mark16(MAX7219_DEBUG_PLANNER_TAIL, last_tail_cnt, tail, &row_change_mask); last_tail_cnt = tail; } #endif @@ -684,11 +701,26 @@ void Max7219::idle_tasks() { static int16_t last_depth = 0; const int16_t current_depth = (head - tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1) & 0xF; if (current_depth != last_depth) { - quantity16(MAX7219_DEBUG_PLANNER_QUEUE, last_depth, current_depth); + quantity16(MAX7219_DEBUG_PLANNER_QUEUE, last_depth, current_depth, &row_change_mask); last_depth = current_depth; } #endif + #ifdef MAX7219_DEBUG_PROFILE + static uint8_t last_time_fraction = 0; + const uint8_t current_time_fraction = (uint16_t(CodeProfiler::get_time_fraction()) * MAX7219_NUMBER_UNITS + 8) / 16; + if (current_time_fraction != last_time_fraction) { + quantity(MAX7219_DEBUG_PROFILE, last_time_fraction, current_time_fraction, &row_change_mask); + last_time_fraction = current_time_fraction; + } + #endif + + // batch line updates + suspended--; + if (!suspended) + LOOP_L_N(i, 8) if (row_change_mask & _BV(i)) + refresh_line(i); + // After resume() automatically do a refresh() if (suspended == 0x80) { suspended = 0; diff --git a/Marlin/src/feature/max7219.h b/Marlin/src/feature/max7219.h index 809bda6d4b35..3fae275499fd 100644 --- a/Marlin/src/feature/max7219.h +++ b/Marlin/src/feature/max7219.h @@ -73,6 +73,67 @@ #define max7219_reg_shutdown 0x0C #define max7219_reg_displayTest 0x0F +#ifdef MAX7219_DEBUG_PROFILE + // This class sums up the amount of time for which its instances exist. + // By default there is one instantiated for the duration of the idle() + // function. But an instance can be created in any code block to measure + // the time spent from the point of instantiation until the CPU leaves + // block. Be careful about having multiple instances of CodeProfiler as + // it does not guard against double counting. In general mixing ISR and + // non-ISR use will require critical sections but note that mode setting + // is atomic so the total or average times can safely be read if you set + // mode to FREEZE first. + class CodeProfiler { + public: + enum Mode : uint8_t { ACCUMULATE_AVERAGE, ACCUMULATE_TOTAL, FREEZE }; + + private: + static Mode mode; + static uint8_t instance_count; + static uint32_t last_calc_time; + static uint32_t total_time; + static uint8_t time_fraction; + static uint16_t call_count; + + uint32_t start_time; + + public: + CodeProfiler() : start_time(micros()) { instance_count++; } + ~CodeProfiler() { + instance_count--; + if (mode == FREEZE) return; + + call_count++; + + const uint32_t now = micros(); + total_time += now - start_time; + + if (mode == ACCUMULATE_TOTAL) return; + + // update time_fraction every hundred milliseconds + if (instance_count == 0 && ELAPSED(now, last_calc_time + 100000)) { + time_fraction = total_time * 128 / (now - last_calc_time); + last_calc_time = now; + total_time = 0; + } + } + + static void set_mode(Mode _mode) { mode = _mode; } + static void reset() { + time_fraction = 0; + last_calc_time = micros(); + total_time = 0; + call_count = 0; + } + // returns fraction of total time which was measured, scaled from 0 to 128 + static uint8_t get_time_fraction() { return time_fraction; } + // returns total time in microseconds + static uint32_t get_total_time() { return total_time; } + + static uint16_t get_call_count() { return call_count; } + }; +#endif + class Max7219 { public: static uint8_t led_line[MAX7219_LINES]; @@ -110,10 +171,10 @@ class Max7219 { #endif // Set a single LED by XY coordinate - static void led_set(const uint8_t x, const uint8_t y, const bool on); - static void led_on(const uint8_t x, const uint8_t y); - static void led_off(const uint8_t x, const uint8_t y); - static void led_toggle(const uint8_t x, const uint8_t y); + static void led_set(const uint8_t x, const uint8_t y, const bool on, uint8_t * const rcm=nullptr); + static void led_on(const uint8_t x, const uint8_t y, uint8_t * const rcm=nullptr); + static void led_off(const uint8_t x, const uint8_t y, uint8_t * const rcm=nullptr); + static void led_toggle(const uint8_t x, const uint8_t y, uint8_t * const rcm=nullptr); // Set all LEDs in a single column static void set_column(const uint8_t col, const uint32_t val); @@ -147,11 +208,12 @@ class Max7219 { static void set(const uint8_t line, const uint8_t bits); static void send_row(const uint8_t row); static void send_column(const uint8_t col); - static void mark16(const uint8_t y, const uint8_t v1, const uint8_t v2); - static void range16(const uint8_t y, const uint8_t ot, const uint8_t nt, const uint8_t oh, const uint8_t nh); - static void quantity16(const uint8_t y, const uint8_t ov, const uint8_t nv); + static void mark16(const uint8_t y, const uint8_t v1, const uint8_t v2, uint8_t * const rcm=nullptr); + static void range16(const uint8_t y, const uint8_t ot, const uint8_t nt, const uint8_t oh, const uint8_t nh, uint8_t * const rcm=nullptr); + static void quantity(const uint8_t y, const uint8_t ov, const uint8_t nv, uint8_t * const rcm=nullptr); + static void quantity16(const uint8_t y, const uint8_t ov, const uint8_t nv, uint8_t * const rcm=nullptr); - #ifdef MAX7219_INIT_TEST + #if MAX7219_INIT_TEST static void test_pattern(); static void run_test_pattern(); static void start_test_pattern(); From 1e66cc39c2b467d7abb65d5c012ca57c4b20b5e9 Mon Sep 17 00:00:00 2001 From: sgparry Date: Sun, 26 Jun 2022 07:49:57 +0100 Subject: [PATCH 195/241] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20LCD=20contrast=20w?= =?UTF-8?q?ith=20K8800=20board?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/ramps/pins_K8800.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/Marlin/src/pins/ramps/pins_K8800.h b/Marlin/src/pins/ramps/pins_K8800.h index f1362ec61d34..17bb59fdc9d0 100644 --- a/Marlin/src/pins/ramps/pins_K8800.h +++ b/Marlin/src/pins/ramps/pins_K8800.h @@ -105,9 +105,6 @@ #define LCD_PINS_D6 33 #define LCD_PINS_D7 31 - #define LCD_CONTRAST_MIN 0 - #define LCD_CONTRAST_MAX 100 - #define LCD_CONTRAST_INIT 30 //#define LCD_SCREEN_ROTATE 180 // 0, 90, 180, 270 #if IS_NEWPANEL From d976f291fd1096255fc6b00c0344cae764f3defc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Morav=C4=8D=C3=ADk?= Date: Sun, 26 Jun 2022 08:51:16 +0200 Subject: [PATCH 196/241] =?UTF-8?q?=F0=9F=8C=90=20Update=20Slovak=20langua?= =?UTF-8?q?ge=20(#24397)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/language/language_sk.h | 92 +++++++++++++++++++++++---- 1 file changed, 78 insertions(+), 14 deletions(-) diff --git a/Marlin/src/lcd/language/language_sk.h b/Marlin/src/lcd/language/language_sk.h index 89203538984e..ef1396e81ff3 100644 --- a/Marlin/src/lcd/language/language_sk.h +++ b/Marlin/src/lcd/language/language_sk.h @@ -50,7 +50,10 @@ namespace Language_sk { LSTR WELCOME_MSG = MACHINE_NAME _UxGT(" pripravená."); LSTR MSG_YES = _UxGT("ÁNO"); LSTR MSG_NO = _UxGT("NIE"); + LSTR MSG_HIGH = _UxGT("VYSOKÁ"); + LSTR MSG_LOW = _UxGT("NÍZKA"); LSTR MSG_BACK = _UxGT("Naspäť"); + LSTR MSG_ERROR = _UxGT("Chyba"); LSTR MSG_MEDIA_ABORTING = _UxGT("Ruším..."); LSTR MSG_MEDIA_INSERTED = _UxGT("Karta vložená"); LSTR MSG_MEDIA_REMOVED = _UxGT("Karta vybraná"); @@ -64,6 +67,8 @@ namespace Language_sk { LSTR MSG_LCD_SOFT_ENDSTOPS = _UxGT("Soft. endstopy"); LSTR MSG_MAIN = _UxGT("Hlavná ponuka"); LSTR MSG_ADVANCED_SETTINGS = _UxGT("Pokročilé nastav."); + LSTR MSG_TOOLBAR_SETUP = _UxGT("Panel nástrojov"); + LSTR MSG_OPTION_DISABLED = _UxGT("Možnosť vypnutá"); LSTR MSG_CONFIGURATION = _UxGT("Konfigurácia"); LSTR MSG_RUN_AUTO_FILES = _UxGT("Auto-štart"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Uvolniť motory"); @@ -77,6 +82,7 @@ namespace Language_sk { LSTR MSG_AUTO_HOME_Z = _UxGT("Domov os Z"); LSTR MSG_FILAMENT_SET = _UxGT("Nastav. filamentu"); LSTR MSG_FILAMENT_MAN = _UxGT("Správa filamentu"); + LSTR MSG_MANUAL_LEVELING = _UxGT("Ručné rovnanie"); LSTR MSG_LEVBED_FL = _UxGT("Ľavý predný"); LSTR MSG_LEVBED_FR = _UxGT("Pravý predný"); LSTR MSG_LEVBED_C = _UxGT("Stred"); @@ -109,7 +115,14 @@ namespace Language_sk { LSTR MSG_PREHEAT_1_ALL = _UxGT("Zahriať ") PREHEAT_1_LABEL _UxGT(" všetko"); LSTR MSG_PREHEAT_1_BEDONLY = _UxGT("Zahriať ") PREHEAT_1_LABEL _UxGT(" podlož"); LSTR MSG_PREHEAT_1_SETTINGS = _UxGT("Zahriať ") PREHEAT_1_LABEL _UxGT(" nast."); - + #ifdef PREHEAT_2_LABEL + LSTR MSG_PREHEAT_2 = _UxGT("Zahriať ") PREHEAT_2_LABEL; + LSTR MSG_PREHEAT_2_SETTINGS = _UxGT("Zahriať ") PREHEAT_2_LABEL _UxGT(" nast."); + #endif + #ifdef PREHEAT_3_LABEL + LSTR MSG_PREHEAT_3 = _UxGT("Zahriať ") PREHEAT_3_LABEL; + LSTR MSG_PREHEAT_3_SETTINGS = _UxGT("Zahriať ") PREHEAT_3_LABEL _UxGT(" nast."); + #endif LSTR MSG_PREHEAT_M = _UxGT("Zahriať $"); LSTR MSG_PREHEAT_M_H = _UxGT("Zahriať $ ~"); LSTR MSG_PREHEAT_M_END = _UxGT("Zahriať $ hotend"); @@ -144,7 +157,8 @@ namespace Language_sk { LSTR MSG_BED_LEVELING = _UxGT("Vyrovnanie podložky"); LSTR MSG_LEVEL_BED = _UxGT("Vyrovnať podložku"); LSTR MSG_BED_TRAMMING = _UxGT("Vyrovnať rohy"); - LSTR MSG_BED_TRAMMING_RAISE = _UxGT("Zdvyhnite podl., kým sa nezopne sonda"); + LSTR MSG_BED_TRAMMING_MANUAL = _UxGT("Ručné vyrovnanie"); + LSTR MSG_BED_TRAMMING_RAISE = _UxGT("Zdvihnite podl., kým sa nezopne sonda"); LSTR MSG_BED_TRAMMING_IN_RANGE = _UxGT("Rohy sú vrámci odchyl. Vyrovnajte podl."); LSTR MSG_BED_TRAMMING_GOOD_POINTS = _UxGT("Dobré body: "); LSTR MSG_BED_TRAMMING_LAST_Z = _UxGT("Posl. Z: "); @@ -155,10 +169,19 @@ namespace Language_sk { LSTR MSG_MESH_VIEW = _UxGT("Zobraz. sieť bodov"); LSTR MSG_EDITING_STOPPED = _UxGT("Koniec úprav siete"); LSTR MSG_NO_VALID_MESH = _UxGT("Neplatná sieť bodov"); + LSTR MSG_ACTIVATE_MESH = _UxGT("Zapnúť vyrovnanie"); LSTR MSG_PROBING_POINT = _UxGT("Skúšam bod"); LSTR MSG_MESH_X = _UxGT("Index X"); LSTR MSG_MESH_Y = _UxGT("Index Y"); + LSTR MSG_MESH_INSET = _UxGT("Vložiť sieť"); + LSTR MSG_MESH_MIN_X = _UxGT("Min. X sieťe"); + LSTR MSG_MESH_MAX_X = _UxGT("Max. X sieťe"); + LSTR MSG_MESH_MIN_Y = _UxGT("Min. Y sieťe"); + LSTR MSG_MESH_MAX_Y = _UxGT("Max. Y sieťe"); + LSTR MSG_MESH_AMAX = _UxGT("Maximál. oblasť"); + LSTR MSG_MESH_CENTER = _UxGT("Stredová oblasť"); LSTR MSG_MESH_EDIT_Z = _UxGT("Hodnota Z"); + LSTR MSG_MESH_CANCEL = _UxGT("Mriežka zrušená"); LSTR MSG_CUSTOM_COMMANDS = _UxGT("Vlastné príkazy"); LSTR MSG_M48_TEST = _UxGT("M48 Test sondy"); LSTR MSG_M48_POINT = _UxGT("M48 Bod"); @@ -177,6 +200,9 @@ namespace Language_sk { LSTR MSG_UBL_TOOLS = _UxGT("Nástroje UBL"); LSTR MSG_UBL_LEVEL_BED = _UxGT("UBL rovnanie"); LSTR MSG_LCD_TILTING_MESH = _UxGT("Vyrovnávam bod"); + LSTR MSG_UBL_TILT_MESH = _UxGT("Nakloniť sieť"); + LSTR MSG_UBL_TILTING_GRID = _UxGT("Veľkosť nakl. siete"); + LSTR MSG_UBL_MESH_TILTED = _UxGT("Sieť naklonená"); LSTR MSG_UBL_MANUAL_MESH = _UxGT("Manuálna sieť bodov"); LSTR MSG_UBL_MESH_WIZARD = _UxGT("Spriev. UBL rovnan."); LSTR MSG_UBL_BC_INSERT = _UxGT("Položte a zmerajte"); @@ -225,6 +251,7 @@ namespace Language_sk { LSTR MSG_UBL_MANUAL_FILLIN = _UxGT("Ručné vyplnenie"); LSTR MSG_UBL_SMART_FILLIN = _UxGT("Chytré vyplnenie"); LSTR MSG_UBL_FILLIN_MESH = _UxGT("Vyplniť mriežku"); + LSTR MSG_UBL_MESH_FILLED = _UxGT("Doplnené chýb. body"); LSTR MSG_UBL_INVALIDATE_ALL = _UxGT("Zrušiť všetko"); LSTR MSG_UBL_INVALIDATE_CLOSEST = _UxGT("Zrušiť najbližší"); LSTR MSG_UBL_FINE_TUNE_ALL = _UxGT("Upraviť všetky"); @@ -233,6 +260,7 @@ namespace Language_sk { LSTR MSG_UBL_STORAGE_SLOT = _UxGT("Pamäťový slot"); LSTR MSG_UBL_LOAD_MESH = _UxGT("Načítať sieť bodov"); LSTR MSG_UBL_SAVE_MESH = _UxGT("Uložiť sieť bodov"); + LSTR MSG_UBL_INVALID_SLOT = _UxGT("Najskôr zvol. slot siete"); LSTR MSG_MESH_LOADED = _UxGT("Sieť %i načítaná"); LSTR MSG_MESH_SAVED = _UxGT("Sieť %i uložená"); LSTR MSG_UBL_NO_STORAGE = _UxGT("Nedostatok miesta"); @@ -325,9 +353,21 @@ namespace Language_sk { LSTR MSG_PID_AUTOTUNE_E = _UxGT("Kalibrácia PID *"); LSTR MSG_PID_CYCLE = _UxGT("Cykly PID"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("Kal. PID dokončená"); + LSTR MSG_PID_AUTOTUNE_FAILED = _UxGT("Kal. PID zlyhala!"); + LSTR MSG_BAD_EXTRUDER_NUM = _UxGT("Zlý extrudér"); + LSTR MSG_TEMP_TOO_HIGH = _UxGT("Príliš vysoká tepl."); + LSTR MSG_TIMEOUT = _UxGT("Čas vypršal."); LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Auto-kal. zlyhala! Zlý extrúder."); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Auto-kal. zlyhala! Príliš vysoká tepl."); LSTR MSG_PID_TIMEOUT = _UxGT("Auto-kal. zlyhala! Čas vypršal."); + LSTR MSG_MPC_MEASURING_AMBIENT = _UxGT("Test. tepl. straty"); + LSTR MSG_MPC_AUTOTUNE = _UxGT("Auto-kal. MPC"); + LSTR MSG_MPC_EDIT = _UxGT("Upraviť * MPC"); + LSTR MSG_MPC_POWER_E = _UxGT("Výkon *"); + LSTR MSG_MPC_BLOCK_HEAT_CAPACITY_E = _UxGT("Blokovať C *"); + LSTR MSG_SENSOR_RESPONSIVENESS_E = _UxGT("Rozliš. senz. *"); + LSTR MSG_MPC_AMBIENT_XFER_COEFF_E = _UxGT("H okolia *"); + LSTR MSG_MPC_AMBIENT_XFER_COEFF_FAN_E = _UxGT("H vent. okolia *"); LSTR MSG_SELECT = _UxGT("Vybrať"); LSTR MSG_SELECT_E = _UxGT("Vybrať *"); LSTR MSG_ACC = _UxGT("Zrýchlenie"); @@ -379,6 +419,9 @@ namespace Language_sk { LSTR MSG_ADVANCE_K_E = _UxGT("K pre posun *"); LSTR MSG_CONTRAST = _UxGT("Kontrast LCD"); LSTR MSG_BRIGHTNESS = _UxGT("Jas LCD"); + LSTR MSG_LCD_TIMEOUT_SEC = _UxGT("Čas. limit LCD (s)"); + LSTR MSG_SCREEN_TIMEOUT = _UxGT("Čas. limit LCD (m)"); + LSTR MSG_BRIGHTNESS_OFF = _UxGT("Podsviet. vyp."); LSTR MSG_STORE_EEPROM = _UxGT("Uložiť nastavenie"); LSTR MSG_LOAD_EEPROM = _UxGT("Načítať nastavenie"); LSTR MSG_RESTORE_DEFAULTS = _UxGT("Obnoviť nastavenie"); @@ -391,6 +434,10 @@ namespace Language_sk { LSTR MSG_RESET_PRINTER = _UxGT("Reštart. tlačiar."); LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Obnoviť"); LSTR MSG_INFO_SCREEN = _UxGT("Info. obrazovka"); + LSTR MSG_INFO_MACHINENAME = _UxGT("Názov stroja"); + LSTR MSG_INFO_SIZE = _UxGT("Rozmer"); + LSTR MSG_INFO_FWVERSION = _UxGT("Verzia firmvéru"); + LSTR MSG_INFO_BUILD = _UxGT("Čas zostavenia"); LSTR MSG_PREPARE = _UxGT("Príprava tlače"); LSTR MSG_TUNE = _UxGT("Doladenie tlače"); LSTR MSG_POWER_MONITOR = _UxGT("Monitor napájania"); @@ -405,6 +452,8 @@ namespace Language_sk { LSTR MSG_BUTTON_RESET = _UxGT("Vynulovať"); LSTR MSG_BUTTON_IGNORE = _UxGT("Ignorovať"); LSTR MSG_BUTTON_CANCEL = _UxGT("Zrušiť"); + LSTR MSG_BUTTON_CONFIRM = _UxGT("Potvrdiť"); + LSTR MSG_BUTTON_CONTINUE = _UxGT("Pokračovať"); LSTR MSG_BUTTON_DONE = _UxGT("Hotovo"); LSTR MSG_BUTTON_BACK = _UxGT("Naspäť"); LSTR MSG_BUTTON_PROCEED = _UxGT("Pokračovať"); @@ -414,6 +463,8 @@ namespace Language_sk { LSTR MSG_BUTTON_PAUSE = _UxGT("Pauza"); LSTR MSG_BUTTON_RESUME = _UxGT("Obnoviť"); LSTR MSG_BUTTON_ADVANCED = _UxGT("Pokročilé"); + LSTR MSG_BUTTON_SAVE = _UxGT("Uložiť"); + LSTR MSG_BUTTON_PURGE = _UxGT("Vytlačiť"); LSTR MSG_PAUSING = _UxGT("Pozastavujem..."); LSTR MSG_PAUSE_PRINT = _UxGT("Pozastaviť tlač"); LSTR MSG_ADVANCED_PAUSE = _UxGT("Pokročil. pauza"); @@ -433,11 +484,15 @@ namespace Language_sk { LSTR MSG_PRINT_PAUSED = _UxGT("Tlač pozastavená"); LSTR MSG_PRINTING = _UxGT("Tlačím..."); LSTR MSG_STOPPING = _UxGT("Zastavujem..."); + LSTR MSG_REMAINING_TIME = _UxGT("Zostávajúci"); LSTR MSG_PRINT_ABORTED = _UxGT("Tlač zrušená"); LSTR MSG_PRINT_DONE = _UxGT("Tlač dokončená"); + LSTR MSG_PRINTER_KILLED = _UxGT("Tlačiareň zastavená!"); + LSTR MSG_TURN_OFF = _UxGT("Vypnite tlačiareň"); LSTR MSG_NO_MOVE = _UxGT("Žiadny pohyb."); LSTR MSG_KILLED = _UxGT("PRERUŠENÉ. "); LSTR MSG_STOPPED = _UxGT("ZASTAVENÉ. "); + LSTR MSG_FWRETRACT = _UxGT("Firmv. retrakcia"); LSTR MSG_CONTROL_RETRACT = _UxGT("Retrakt mm"); LSTR MSG_CONTROL_RETRACT_SWAP = _UxGT("Výmena Re.mm"); LSTR MSG_CONTROL_RETRACTF = _UxGT("Retraktovať V"); @@ -503,6 +558,9 @@ namespace Language_sk { LSTR MSG_ZPROBE_XOFFSET = _UxGT("X ofset"); LSTR MSG_ZPROBE_YOFFSET = _UxGT("Y ofset"); LSTR MSG_ZPROBE_ZOFFSET = _UxGT("Z ofset"); + LSTR MSG_ZPROBE_MARGIN = _UxGT("Hranica sondy"); + LSTR MSG_Z_FEED_RATE = _UxGT("Rýchl. posunu Z"); + LSTR MSG_ENABLE_HS_MODE = _UxGT("Povoliť rež. HS"); LSTR MSG_MOVE_NOZZLE_TO_BED = _UxGT("Pos. trysku k podl."); LSTR MSG_BABYSTEP_X = _UxGT("Babystep X"); LSTR MSG_BABYSTEP_Y = _UxGT("Babystep Y"); @@ -566,30 +624,32 @@ namespace Language_sk { LSTR MSG_CASE_LIGHT_BRIGHTNESS = _UxGT("Jas svetla"); LSTR MSG_KILL_EXPECTED_PRINTER = _UxGT("Nesprávna tlačiareň"); + LSTR MSG_COLORS_GET = _UxGT("Zvoliť farbu"); + LSTR MSG_COLORS_SELECT = _UxGT("Zvoliť farby"); + LSTR MSG_COLORS_APPLIED = _UxGT("Farby aplikované"); + LSTR MSG_COLORS_RED = _UxGT("Červená"); + LSTR MSG_COLORS_GREEN = _UxGT("Zelená"); + LSTR MSG_COLORS_BLUE = _UxGT("Modrá"); + LSTR MSG_COLORS_WHITE = _UxGT("Biela"); + LSTR MSG_UI_LANGUAGE = _UxGT("Jazyk rozhrania"); + LSTR MSG_SOUND_ENABLE = _UxGT("Povoliť zvuky"); + LSTR MSG_LOCKSCREEN = _UxGT("Uzamknúť obrazovku"); + LSTR MSG_LOCKSCREEN_LOCKED = _UxGT("Tlačiareň je uzamknutá,"); + LSTR MSG_LOCKSCREEN_UNLOCK = _UxGT("potiahnite pre odomknutie."); + LSTR MSG_PLEASE_WAIT_REBOOT = _UxGT("Prosím čakajte do reštartu."); + #if LCD_WIDTH >= 20 || HAS_DWIN_E3V2 LSTR MSG_MEDIA_NOT_INSERTED = _UxGT("Nie je vložená karta."); - LSTR MSG_REMAINING_TIME = _UxGT("Zostávajúci čas"); - LSTR MSG_PLEASE_WAIT_REBOOT = _UxGT("Prosím čakajte do reštartu. "); LSTR MSG_PLEASE_PREHEAT = _UxGT("Prosím zahrejte hotend."); LSTR MSG_INFO_PRINT_COUNT_RESET = _UxGT("Vynulovať počítadlo"); LSTR MSG_INFO_PRINT_COUNT = _UxGT("Počet tlačí"); LSTR MSG_INFO_PRINT_TIME = _UxGT("Celkový čas"); LSTR MSG_INFO_PRINT_LONGEST = _UxGT("Najdlhšia tlač"); LSTR MSG_INFO_PRINT_FILAMENT = _UxGT("Celkom vytlačené"); - LSTR MSG_COLORS_GET = _UxGT("Zvoliť farbu"); - LSTR MSG_COLORS_SELECT = _UxGT("Zvoliť farby"); - LSTR MSG_COLORS_APPLIED = _UxGT("Farby aplikované"); - LSTR MSG_COLORS_RED = _UxGT("Červená"); - LSTR MSG_COLORS_GREEN = _UxGT("Zelená"); - LSTR MSG_COLORS_BLUE = _UxGT("Modrá"); - LSTR MSG_UI_LANGUAGE = _UxGT("Jazyk rozhrania"); - LSTR MSG_SOUND_ENABLE = _UxGT("Povoliť zvuky"); - LSTR MSG_LOCKSCREEN = _UxGT("Uzamknúť obrazovku"); #else LSTR MSG_MEDIA_NOT_INSERTED = _UxGT("Žiadna karta"); LSTR MSG_PLEASE_PREHEAT = _UxGT("Prosím zahrejte"); LSTR MSG_INFO_PRINT_COUNT = _UxGT("Tlače"); - LSTR MSG_REMAINING_TIME = _UxGT("Zostávajúci"); LSTR MSG_INFO_PRINT_TIME = _UxGT("Čas"); LSTR MSG_INFO_PRINT_LONGEST = _UxGT("Najdlhšia"); LSTR MSG_INFO_PRINT_FILAMENT = _UxGT("Vytlačené"); @@ -610,10 +670,14 @@ namespace Language_sk { LSTR MSG_FILAMENT_CHANGE_OPTION_HEADER = _UxGT("MOŽNOSTI POKRAČ.:"); LSTR MSG_FILAMENT_CHANGE_OPTION_PURGE = _UxGT("Vytlačiť viacej"); LSTR MSG_FILAMENT_CHANGE_OPTION_RESUME = _UxGT("Obnoviť tlač"); + LSTR MSG_FILAMENT_CHANGE_PURGE_CONTINUE = _UxGT("Vytlač. alebo pokrač.?"); LSTR MSG_FILAMENT_CHANGE_NOZZLE = _UxGT(" Tryska: "); LSTR MSG_RUNOUT_SENSOR = _UxGT("Senzor filamentu"); LSTR MSG_RUNOUT_DISTANCE_MM = _UxGT("Vzd. mm fil. senz."); LSTR MSG_RUNOUT_ENABLE = _UxGT("Zapnúť senzor"); + LSTR MSG_RUNOUT_ACTIVE = _UxGT("Senz. fil. zapn."); + LSTR MSG_INVERT_EXTRUDER = _UxGT("Invert. extrudér"); + LSTR MSG_EXTRUDER_MIN_TEMP = _UxGT("Min. tepl. extrud."); LSTR MSG_FANCHECK = _UxGT("Kontrola rýchl."); LSTR MSG_KILL_HOMING_FAILED = _UxGT("Parkovanie zlyhalo"); LSTR MSG_LCD_PROBING_FAILED = _UxGT("Kalibrácia zlyhala"); From dc5c5bdf82c0d42465dc630d6ef3cc300ed5c504 Mon Sep 17 00:00:00 2001 From: Giuliano Zaro <3684609+GMagician@users.noreply.github.com> Date: Sun, 26 Jun 2022 08:52:19 +0200 Subject: [PATCH 197/241] =?UTF-8?q?=F0=9F=8C=90=20Update=20Italian=20langu?= =?UTF-8?q?age=20(#24398)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/language/language_it.h | 81 ++++++++++++++++++++++----- 1 file changed, 66 insertions(+), 15 deletions(-) diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index 1a1179f2c7fc..f0c21deb96cd 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -47,7 +47,10 @@ namespace Language_it { LSTR WELCOME_MSG = MACHINE_NAME _UxGT(" pronta."); LSTR MSG_YES = _UxGT("Si"); LSTR MSG_NO = _UxGT("No"); + LSTR MSG_HIGH = _UxGT("ALTO"); + LSTR MSG_LOW = _UxGT("BASSO"); LSTR MSG_BACK = _UxGT("Indietro"); + LSTR MSG_ERROR = _UxGT("Errore"); LSTR MSG_MEDIA_ABORTING = _UxGT("Annullando..."); LSTR MSG_MEDIA_INSERTED = _UxGT("Media inserito"); LSTR MSG_MEDIA_REMOVED = _UxGT("Media rimosso"); @@ -61,6 +64,8 @@ namespace Language_it { LSTR MSG_LCD_SOFT_ENDSTOPS = _UxGT("Finecorsa Soft"); LSTR MSG_MAIN = _UxGT("Menu principale"); LSTR MSG_ADVANCED_SETTINGS = _UxGT("Impostaz. avanzate"); + LSTR MSG_TOOLBAR_SETUP = _UxGT("Cnf barra strumenti"); + LSTR MSG_OPTION_DISABLED = _UxGT("Opzione disab."); LSTR MSG_CONFIGURATION = _UxGT("Configurazione"); LSTR MSG_RUN_AUTO_FILES = _UxGT("Esegui files auto"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Disabilita Motori"); @@ -74,6 +79,7 @@ namespace Language_it { LSTR MSG_AUTO_HOME_Z = _UxGT("Home Z"); LSTR MSG_FILAMENT_SET = _UxGT("Impostaz.filamento"); LSTR MSG_FILAMENT_MAN = _UxGT("Gestione filamento"); + LSTR MSG_MANUAL_LEVELING = _UxGT("Livel.manuale"); LSTR MSG_LEVBED_FL = _UxGT("Davanti Sinistra"); LSTR MSG_LEVBED_FR = _UxGT("Davanti Destra"); LSTR MSG_LEVBED_C = _UxGT("Centro"); @@ -106,7 +112,14 @@ namespace Language_it { LSTR MSG_PREHEAT_1_ALL = _UxGT("Preris.") PREHEAT_1_LABEL _UxGT(" Tutto"); LSTR MSG_PREHEAT_1_BEDONLY = _UxGT("Preris.") PREHEAT_1_LABEL _UxGT(" Piatto"); LSTR MSG_PREHEAT_1_SETTINGS = _UxGT("Preris.") PREHEAT_1_LABEL _UxGT(" conf"); - + #ifdef PREHEAT_2_LABEL + LSTR MSG_PREHEAT_2 = _UxGT("Preris.") PREHEAT_2_LABEL; + LSTR MSG_PREHEAT_2_SETTINGS = _UxGT("Preris.") PREHEAT_2_LABEL _UxGT(" conf"); + #endif + #ifdef PREHEAT_3_LABEL + LSTR MSG_PREHEAT_3 = _UxGT("Preris.") PREHEAT_3_LABEL; + LSTR MSG_PREHEAT_3_SETTINGS = _UxGT("Preris.") PREHEAT_3_LABEL _UxGT(" conf"); + #endif LSTR MSG_PREHEAT_M = _UxGT("Preriscalda $"); LSTR MSG_PREHEAT_M_H = _UxGT("Preriscalda $ ~"); LSTR MSG_PREHEAT_M_END = _UxGT("Preris.$ Ugello"); @@ -153,10 +166,19 @@ namespace Language_it { LSTR MSG_MESH_VIEW = _UxGT("Visualizza Mesh"); LSTR MSG_EDITING_STOPPED = _UxGT("Modif. Mesh Fermata"); LSTR MSG_NO_VALID_MESH = _UxGT("Mesh non valida"); + LSTR MSG_ACTIVATE_MESH = _UxGT("Attiva livellamento"); LSTR MSG_PROBING_POINT = _UxGT("Punto sondato"); LSTR MSG_MESH_X = _UxGT("Indice X"); LSTR MSG_MESH_Y = _UxGT("Indice Y"); + LSTR MSG_MESH_INSET = _UxGT("Mesh Inset"); + LSTR MSG_MESH_MIN_X = _UxGT("Mesh X minimo"); + LSTR MSG_MESH_MAX_X = _UxGT("Mesh X massimo"); + LSTR MSG_MESH_MIN_Y = _UxGT("Mesh Y minimo"); + LSTR MSG_MESH_MAX_Y = _UxGT("Mesh Y massimo"); + LSTR MSG_MESH_AMAX = _UxGT("Massimizza area"); + LSTR MSG_MESH_CENTER = _UxGT("Area centrale"); LSTR MSG_MESH_EDIT_Z = _UxGT("Valore di Z"); + LSTR MSG_MESH_CANCEL = _UxGT("Mesh cancellato"); LSTR MSG_CUSTOM_COMMANDS = _UxGT("Comandi personaliz."); LSTR MSG_M48_TEST = _UxGT("Test sonda M48"); LSTR MSG_M48_POINT = _UxGT("Punto M48"); @@ -175,6 +197,9 @@ namespace Language_it { LSTR MSG_UBL_TOOLS = _UxGT("Strumenti UBL"); LSTR MSG_UBL_LEVEL_BED = _UxGT("Livel.letto unificato"); LSTR MSG_LCD_TILTING_MESH = _UxGT("Punto inclinaz."); + LSTR MSG_UBL_TILT_MESH = _UxGT("Inclina Mesh"); + LSTR MSG_UBL_TILTING_GRID = _UxGT("Dim.griglia inclin."); + LSTR MSG_UBL_MESH_TILTED = _UxGT("Mesh inclinata"); LSTR MSG_UBL_MANUAL_MESH = _UxGT("Mesh Manuale"); LSTR MSG_UBL_MESH_WIZARD = _UxGT("Creaz.guid.mesh UBL"); LSTR MSG_UBL_BC_INSERT = _UxGT("Metti spes. e misura"); @@ -225,6 +250,7 @@ namespace Language_it { LSTR MSG_UBL_MANUAL_FILLIN = _UxGT("Riempimento Manuale"); LSTR MSG_UBL_SMART_FILLIN = _UxGT("Riempimento Smart"); LSTR MSG_UBL_FILLIN_MESH = _UxGT("Riempimento Mesh"); + LSTR MSG_UBL_MESH_FILLED = _UxGT("Pts mancanti riempiti"); LSTR MSG_UBL_INVALIDATE_ALL = _UxGT("Invalida Tutto"); LSTR MSG_UBL_INVALIDATE_CLOSEST = _UxGT("Invalid.Punto Vicino"); LSTR MSG_UBL_FINE_TUNE_ALL = _UxGT("Ritocca Tutto"); @@ -233,6 +259,7 @@ namespace Language_it { LSTR MSG_UBL_STORAGE_SLOT = _UxGT("Slot di memoria"); LSTR MSG_UBL_LOAD_MESH = _UxGT("Carica Mesh Piatto"); LSTR MSG_UBL_SAVE_MESH = _UxGT("Salva Mesh Piatto"); + LSTR MSG_UBL_INVALID_SLOT = _UxGT("Prima selez. uno slot Mesh"); LSTR MSG_MESH_LOADED = _UxGT("Mesh %i caricata"); LSTR MSG_MESH_SAVED = _UxGT("Mesh %i salvata"); LSTR MSG_UBL_NO_STORAGE = _UxGT("Nessuna memoria"); @@ -290,6 +317,7 @@ namespace Language_it { LSTR MSG_MOVE_001IN = _UxGT("Muovi di 0.01\""); LSTR MSG_MOVE_01IN = _UxGT("Muovi di 0.1\""); LSTR MSG_MOVE_1IN = _UxGT("Muovi di 1\""); + LSTR MSG_SPEED = _UxGT("Velocità"); LSTR MSG_BED_Z = _UxGT("Piatto Z"); LSTR MSG_NOZZLE = _UxGT("Ugello"); LSTR MSG_NOZZLE_N = _UxGT("Ugello ~"); @@ -324,6 +352,10 @@ namespace Language_it { LSTR MSG_PID_AUTOTUNE_E = _UxGT("Calib.PID *"); LSTR MSG_PID_CYCLE = _UxGT("Ciclo PID"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("Calibr.PID eseguita"); + LSTR MSG_PID_AUTOTUNE_FAILED = _UxGT("Calibr.PID fallito!"); + LSTR MSG_BAD_EXTRUDER_NUM = _UxGT("Estrusore invalido."); + LSTR MSG_TEMP_TOO_HIGH = _UxGT("Temp.troppo alta."); + LSTR MSG_TIMEOUT = _UxGT("Tempo scaduto."); LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Calibrazione fallita! Estrusore errato."); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Calibrazione fallita! Temperatura troppo alta."); LSTR MSG_PID_TIMEOUT = _UxGT("Calibrazione fallita! Tempo scaduto."); @@ -401,6 +433,10 @@ namespace Language_it { LSTR MSG_RESET_PRINTER = _UxGT("Resetta stampante"); LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Aggiorna"); LSTR MSG_INFO_SCREEN = _UxGT("Schermata info"); + LSTR MSG_INFO_MACHINENAME = _UxGT("Nome macchina"); + LSTR MSG_INFO_SIZE = _UxGT("Dimens."); + LSTR MSG_INFO_FWVERSION = _UxGT("Versione firmware"); + LSTR MSG_INFO_BUILD = _UxGT("Dataora compilaz."); LSTR MSG_PREPARE = _UxGT("Prepara"); LSTR MSG_TUNE = _UxGT("Regola"); LSTR MSG_POWER_MONITOR = _UxGT("Controllo aliment."); @@ -426,7 +462,8 @@ namespace Language_it { LSTR MSG_BUTTON_PAUSE = _UxGT("Pausa"); LSTR MSG_BUTTON_RESUME = _UxGT("Riprendi"); LSTR MSG_BUTTON_ADVANCED = _UxGT("Avanzato"); - LSTR MSG_BUTTON_SAVE = _UxGT("Save"); + LSTR MSG_BUTTON_SAVE = _UxGT("Memorizza"); + LSTR MSG_BUTTON_PURGE = _UxGT("Spurga"); LSTR MSG_PAUSING = _UxGT("Messa in pausa..."); LSTR MSG_PAUSE_PRINT = _UxGT("Pausa stampa"); LSTR MSG_ADVANCED_PAUSE = _UxGT("Pausa Avanzata"); @@ -449,9 +486,12 @@ namespace Language_it { LSTR MSG_REMAINING_TIME = _UxGT("Rimanente"); LSTR MSG_PRINT_ABORTED = _UxGT("Stampa Annullata"); LSTR MSG_PRINT_DONE = _UxGT("Stampa Eseguita"); + LSTR MSG_PRINTER_KILLED = _UxGT("Stampante uccisa!"); + LSTR MSG_TURN_OFF = _UxGT("Spegni stampante"); LSTR MSG_NO_MOVE = _UxGT("Nessun Movimento"); LSTR MSG_KILLED = _UxGT("UCCISO. "); LSTR MSG_STOPPED = _UxGT("ARRESTATO. "); + LSTR MSG_FWRETRACT = _UxGT("Ritraz.da firmware"); LSTR MSG_CONTROL_RETRACT = _UxGT("Ritrai mm"); LSTR MSG_CONTROL_RETRACT_SWAP = _UxGT("Scamb. Ritrai mm"); LSTR MSG_CONTROL_RETRACTF = _UxGT("Ritrai V"); @@ -517,6 +557,9 @@ namespace Language_it { LSTR MSG_ZPROBE_XOFFSET = _UxGT("Offset X sonda"); LSTR MSG_ZPROBE_YOFFSET = _UxGT("Offset Y sonda"); LSTR MSG_ZPROBE_ZOFFSET = _UxGT("Offset Z sonda"); + LSTR MSG_ZPROBE_MARGIN = _UxGT("Margine sonda"); + LSTR MSG_Z_FEED_RATE = _UxGT("Velocità Z"); + LSTR MSG_ENABLE_HS_MODE = _UxGT("Abilita modo HS"); LSTR MSG_MOVE_NOZZLE_TO_BED = _UxGT("Muovi ugel.su letto"); LSTR MSG_BABYSTEP_X = _UxGT("Babystep X"); LSTR MSG_BABYSTEP_Y = _UxGT("Babystep Y"); @@ -580,34 +623,38 @@ namespace Language_it { LSTR MSG_CASE_LIGHT_BRIGHTNESS = _UxGT("Luminosità Luci"); LSTR MSG_KILL_EXPECTED_PRINTER = _UxGT("STAMPANTE ERRATA"); + LSTR MSG_COLORS_GET = _UxGT("Ottieni colori"); + LSTR MSG_COLORS_SELECT = _UxGT("Selez.colori"); + LSTR MSG_COLORS_APPLIED = _UxGT("Colori applicati"); + LSTR MSG_COLORS_RED = _UxGT("Rosso"); + LSTR MSG_COLORS_GREEN = _UxGT("Verde"); + LSTR MSG_COLORS_BLUE = _UxGT("Blu"); + LSTR MSG_COLORS_WHITE = _UxGT("Bianco"); + LSTR MSG_UI_LANGUAGE = _UxGT("Lingua UI"); + LSTR MSG_SOUND_ENABLE = _UxGT("Abilita suono"); + LSTR MSG_LOCKSCREEN = _UxGT("Blocca Schermo"); + LSTR MSG_LOCKSCREEN_LOCKED = _UxGT("Stamp. bloccata,"); + LSTR MSG_LOCKSCREEN_UNLOCK = _UxGT("Scroll x sbloccare."); + LSTR MSG_PLEASE_WAIT_REBOOT = _UxGT("Attendere fino al riavvio."); + #if LCD_WIDTH >= 20 || HAS_DWIN_E3V2 LSTR MSG_MEDIA_NOT_INSERTED = _UxGT("Nessun supporto inserito."); - LSTR MSG_PLEASE_WAIT_REBOOT = _UxGT("Attendere fino al riavvio."); LSTR MSG_PLEASE_PREHEAT = _UxGT("Si prega di preriscaldare l'hot end."); LSTR MSG_INFO_PRINT_COUNT_RESET = _UxGT("Azzera contatori stampa"); LSTR MSG_INFO_PRINT_COUNT = _UxGT("Contatori stampa"); - LSTR MSG_INFO_COMPLETED_PRINTS = _UxGT("Completati"); LSTR MSG_INFO_PRINT_TIME = _UxGT("Tempo totale"); LSTR MSG_INFO_PRINT_LONGEST = _UxGT("Lavoro più lungo"); LSTR MSG_INFO_PRINT_FILAMENT = _UxGT("Totale estruso"); - LSTR MSG_COLORS_GET = _UxGT("Get Color"); - LSTR MSG_COLORS_SELECT = _UxGT("Seleziona colori"); - LSTR MSG_COLORS_APPLIED = _UxGT("Colori applicati"); - LSTR MSG_COLORS_RED = _UxGT("Rosso"); - LSTR MSG_COLORS_GREEN = _UxGT("Verde"); - LSTR MSG_COLORS_BLUE = _UxGT("Blu"); - LSTR MSG_COLORS_WHITE = _UxGT("Bianco"); - LSTR MSG_UI_LANGUAGE = _UxGT("Lingua UI"); - LSTR MSG_SOUND_ENABLE = _UxGT("Abilita suono"); - LSTR MSG_LOCKSCREEN = _UxGT("Blocca Schermo"); #else LSTR MSG_MEDIA_NOT_INSERTED = _UxGT("No Supporto"); + LSTR MSG_PLEASE_PREHEAT = _UxGT("Prerisc. hot end."); LSTR MSG_INFO_PRINT_COUNT = _UxGT("Stampe"); - LSTR MSG_INFO_COMPLETED_PRINTS = _UxGT("Completati"); LSTR MSG_INFO_PRINT_TIME = _UxGT("Durata"); LSTR MSG_INFO_PRINT_LONGEST = _UxGT("Più lungo"); LSTR MSG_INFO_PRINT_FILAMENT = _UxGT("Estruso"); #endif + + LSTR MSG_INFO_COMPLETED_PRINTS = _UxGT("Completate"); LSTR MSG_INFO_MIN_TEMP = _UxGT("Temp min"); LSTR MSG_INFO_MAX_TEMP = _UxGT("Temp max"); LSTR MSG_INFO_PSU = _UxGT("Alimentatore"); @@ -622,10 +669,14 @@ namespace Language_it { LSTR MSG_FILAMENT_CHANGE_OPTION_HEADER = _UxGT("OPZIONI RIPRESA:"); LSTR MSG_FILAMENT_CHANGE_OPTION_PURGE = _UxGT("Spurga di più"); LSTR MSG_FILAMENT_CHANGE_OPTION_RESUME = _UxGT("Riprendi stampa"); + LSTR MSG_FILAMENT_CHANGE_PURGE_CONTINUE = _UxGT("Spurga o continua?"); LSTR MSG_FILAMENT_CHANGE_NOZZLE = _UxGT(" Ugello: "); LSTR MSG_RUNOUT_SENSOR = _UxGT("Sens.filo termin."); // Max 17 characters LSTR MSG_RUNOUT_DISTANCE_MM = _UxGT("Dist mm filo term."); LSTR MSG_RUNOUT_ENABLE = _UxGT("Abil.filo termin."); + LSTR MSG_RUNOUT_ACTIVE = _UxGT("Filo termin. attivo"); + LSTR MSG_INVERT_EXTRUDER = _UxGT("Inverti estrusore"); + LSTR MSG_EXTRUDER_MIN_TEMP = _UxGT("Temp.min estrusore"); LSTR MSG_FANCHECK = _UxGT("Verif.tacho vent."); // Max 17 characters LSTR MSG_KILL_HOMING_FAILED = _UxGT("Home fallito"); LSTR MSG_LCD_PROBING_FAILED = _UxGT("Sondaggio fallito"); From b46191715dd324c8b256f76da19ad5c7349f807d Mon Sep 17 00:00:00 2001 From: Shlee Date: Sun, 26 Jun 2022 06:56:57 +0000 Subject: [PATCH 198/241] =?UTF-8?q?=F0=9F=93=9D=20Add=20STM32F4=20example,?= =?UTF-8?q?=20Ruby=20(#24399)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 13614828077b..f687ea6fc161 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ Marlin 2.0 introduces a layer of abstraction so that all the existing high-level [LPC1768](https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/lpc1700-cortex-m3/512-kb-flash-64-kb-sram-ethernet-usb-lqfp100-package:LPC1768FBD100)|ARM® Cortex-M3|MKS SBASE, Re-ARM, Selena Compact [LPC1769](https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/lpc1700-cortex-m3/512-kb-flash-64-kb-sram-ethernet-usb-lqfp100-package:LPC1769FBD100)|ARM® Cortex-M3|Smoothieboard, Azteeg X5 mini, TH3D EZBoard [STM32F103](https://www.st.com/en/microcontrollers-microprocessors/stm32f103.html)|ARM® Cortex-M3|Malyan M200, GTM32 Pro, MKS Robin, BTT SKR Mini - [STM32F401](https://www.st.com/en/microcontrollers-microprocessors/stm32f401.html)|ARM® Cortex-M4|ARMED, Rumba32, SKR Pro, Lerdge, FYSETC S6 + [STM32F401](https://www.st.com/en/microcontrollers-microprocessors/stm32f401.html)|ARM® Cortex-M4|ARMED, Rumba32, SKR Pro, Lerdge, FYSETC S6, Artillery Ruby [STM32F7x6](https://www.st.com/en/microcontrollers-microprocessors/stm32f7x6.html)|ARM® Cortex-M7|The Borg, RemRam V1 [SAMD51P20A](https://www.adafruit.com/product/4064)|ARM® Cortex-M4|Adafruit Grand Central M4 [Teensy 3.5](https://www.pjrc.com/store/teensy35.html)|ARM® Cortex-M4| From d8545551fed8498f1c420ec3b301d4d77d0de8b5 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 26 Jun 2022 05:47:18 -0500 Subject: [PATCH 199/241] =?UTF-8?q?=F0=9F=90=9B=20Fix=20Manual=20Move=20ax?= =?UTF-8?q?is=20selection=20(#24404)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 18 ++++---- Marlin/src/lcd/e3v2/marlinui/ui_common.cpp | 3 +- Marlin/src/lcd/language/language_en.h | 2 +- Marlin/src/lcd/marlinui.cpp | 9 ++-- Marlin/src/lcd/marlinui.h | 18 ++++---- Marlin/src/lcd/menu/menu_motion.cpp | 49 ++++++++-------------- Marlin/src/lcd/tft/ui_1024x600.cpp | 3 +- Marlin/src/lcd/tft/ui_320x240.cpp | 3 +- Marlin/src/lcd/tft/ui_480x320.cpp | 3 +- 9 files changed, 46 insertions(+), 62 deletions(-) diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 19155fd5e55d..5f1507feb332 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -283,7 +283,7 @@ CrealityDWINClass CrealityDWIN; #endif - void manual_move(bool zmove=false) { + void manual_mesh_move(const bool zmove=false) { if (zmove) { planner.synchronize(); current_position.z = goto_mesh_value ? bedlevel.z_values[mesh_x][mesh_y] : Z_CLEARANCE_BETWEEN_PROBES; @@ -3035,7 +3035,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ mesh_conf.goto_mesh_value = true; mesh_conf.mesh_x = mesh_conf.mesh_y = 0; Popup_Handler(MoveWait); - mesh_conf.manual_move(); + mesh_conf.manual_mesh_move(); Draw_Menu(UBLMesh); #endif #elif HAS_BED_PROBE @@ -3091,7 +3091,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ TERN_(HAS_HEATED_BED, thermalManager.wait_for_bed_heating()); #endif Popup_Handler(MoveWait); - mesh_conf.manual_move(); + mesh_conf.manual_mesh_move(); Draw_Menu(LevelManual); } break; @@ -3328,7 +3328,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ mesh_conf.mesh_x++; else mesh_conf.mesh_x--; - mesh_conf.manual_move(); + mesh_conf.manual_mesh_move(); } } break; @@ -3375,7 +3375,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ else { mesh_conf.goto_mesh_value = !mesh_conf.goto_mesh_value; current_position.z = 0; - mesh_conf.manual_move(true); + mesh_conf.manual_mesh_move(true); Draw_Checkbox(row, mesh_conf.goto_mesh_value); } break; @@ -3428,7 +3428,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ mesh_conf.mesh_x++; else mesh_conf.mesh_x--; - mesh_conf.manual_move(); + mesh_conf.manual_mesh_move(); } else { gcode.process_subcommands_now(F("G29 S")); @@ -3449,7 +3449,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ mesh_conf.mesh_x--; else mesh_conf.mesh_x++; - mesh_conf.manual_move(); + mesh_conf.manual_mesh_move(); } } break; @@ -4109,8 +4109,8 @@ void CrealityDWINClass::Value_Control() { planner.buffer_line(current_position, homing_feedrate(Z_AXIS), active_extruder); planner.synchronize(); break; - case UBLMesh: mesh_conf.manual_move(true); break; - case LevelManual: mesh_conf.manual_move(selection == LEVELING_M_OFFSET); break; + case UBLMesh: mesh_conf.manual_mesh_move(true); break; + case LevelManual: mesh_conf.manual_mesh_move(selection == LEVELING_M_OFFSET); break; #endif } if (valuepointer == &planner.flow_percentage[0]) diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp index ce1758f1da64..0727ab0b70ca 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp @@ -410,8 +410,7 @@ void MarlinUI::draw_status_message(const bool blink) { const dwin_coord_t by = (row * MENU_LINE_HEIGHT) + MENU_FONT_HEIGHT + EXTRA_ROW_HEIGHT / 2; DWIN_Draw_String(true, font16x32, Color_Yellow, Color_Bg_Black, (LCD_PIXEL_WIDTH - vallen * 16) / 2, by, S(dwin_string.string())); - extern screenFunc_t _manual_move_func_ptr; - if (ui.currentScreen != _manual_move_func_ptr && !ui.external_control) { + if (ui.can_show_slider()) { const dwin_coord_t slider_length = LCD_PIXEL_WIDTH - TERN(DWIN_MARLINUI_LANDSCAPE, 120, 20), slider_height = 16, diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 6e6811d62b08..f2a9cb0c0868 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -309,7 +309,7 @@ namespace Language_en { LSTR MSG_MOVE_Z = _UxGT("Move Z"); LSTR MSG_MOVE_N = _UxGT("Move @"); LSTR MSG_MOVE_E = _UxGT("Move Extruder"); - LSTR MSG_MOVE_EN = _UxGT("Move E*"); + LSTR MSG_MOVE_EN = _UxGT("Move *"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("Hotend too cold"); LSTR MSG_MOVE_N_MM = _UxGT("Move $mm"); LSTR MSG_MOVE_01MM = _UxGT("Move 0.1mm"); diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 2e59183b04c7..c1b600593457 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -763,6 +763,7 @@ void MarlinUI::init() { millis_t ManualMove::start_time = 0; float ManualMove::menu_scale = 1; + screenFunc_t ManualMove::screen_ptr; #if IS_KINEMATIC float ManualMove::offset = 0; xyze_pos_t ManualMove::all_axes_destination = { 0 }; @@ -772,6 +773,9 @@ void MarlinUI::init() { int8_t ManualMove::e_index = 0; #endif AxisEnum ManualMove::axis = NO_AXIS_ENUM; + #if ENABLED(MANUAL_E_MOVES_RELATIVE) + float ManualMove::e_origin = 0; + #endif /** * If a manual move has been posted and its time has arrived, and if the planner @@ -788,9 +792,6 @@ void MarlinUI::init() { * For kinematic machines: * - Set manual_move.offset to modify one axis and post the move. * This is used to achieve more rapid stepping on kinematic machines. - * - * Currently used by the _lcd_move_xyz function in menu_motion.cpp - * and the ubl_map_move_to_xy function in menu_ubl.cpp. */ void ManualMove::task() { @@ -861,7 +862,7 @@ void MarlinUI::init() { void MarlinUI::external_encoder() { if (external_control && encoderDiff) { - bedlevel.encoder_diff += encoderDiff; // Encoder for UBL G29 mesh editing + bedlevel.encoder_diff += encoderDiff; // Encoder for UBL G29 mesh editing encoderDiff = 0; // Hide encoder events from the screen handler refresh(LCDVIEW_REDRAW_NOW); // ...but keep the refresh. } diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index 8ae8a8b7f5ce..1c2c48432322 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -137,12 +137,16 @@ typedef bool (*statusResetFunc_t)(); static xyze_pos_t all_axes_destination; #endif public: + static screenFunc_t screen_ptr; static float menu_scale; #if IS_KINEMATIC static float offset; #endif + #if ENABLED(MANUAL_E_MOVES_RELATIVE) + static float e_origin; + #endif template - void set_destination(const T& dest) { + static void set_destination(const T& dest) { #if IS_KINEMATIC // Moves are segmented, so the entire move is not submitted at once. // Using a separate variable prevents corrupting the in-progress move. @@ -153,10 +157,10 @@ typedef bool (*statusResetFunc_t)(); current_position.set(dest); #endif } - float axis_value(const AxisEnum axis) { + static float axis_value(const AxisEnum axis) { return NATIVE_TO_LOGICAL(processing ? destination[axis] : SUM_TERN(IS_KINEMATIC, current_position[axis], offset), axis); } - bool apply_diff(const AxisEnum axis, const_float_t diff, const_float_t min, const_float_t max) { + static bool apply_diff(const AxisEnum axis, const_float_t diff, const_float_t min, const_float_t max) { #if IS_KINEMATIC float &valref = offset; const float rmin = min - current_position[axis], rmax = max - current_position[axis]; @@ -166,12 +170,7 @@ typedef bool (*statusResetFunc_t)(); #endif valref += diff; const float pre = valref; - if (min != max) { - if (diff < 0) - NOLESS(valref, rmin); - else - NOMORE(valref, rmax); - } + if (min != max) { if (diff < 0) NOLESS(valref, rmin); else NOMORE(valref, rmax); } return pre != valref; } #if IS_KINEMATIC @@ -552,6 +551,7 @@ class MarlinUI { // Manual Movement static ManualMove manual_move; + static bool can_show_slider() { return !external_control && currentScreen != manual_move.screen_ptr; } // Select Screen (modal NO/YES style dialog) static bool selection; diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index de16f90637ab..e6d3b8f4511a 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -46,15 +46,11 @@ #include "../../feature/bedlevel/bedlevel.h" #endif -#if ENABLED(MANUAL_E_MOVES_RELATIVE) - float manual_move_e_origin = 0; -#endif - // // "Motion" > "Move Axis" submenu // -static void _lcd_move_xyz(const AxisEnum axis) { +void lcd_move_axis(const AxisEnum axis) { if (ui.use_click()) return ui.goto_previous_screen_no_defer(); if (ui.encoderPosition && !ui.manual_move.processing) { // Get motion limit from software endstops, if any @@ -88,11 +84,6 @@ static void _lcd_move_xyz(const AxisEnum axis) { } } -void _lcd_move_axis_n() { _lcd_move_xyz(AxisEnum(MenuItemBase::itemIndex)); } - -// Move functions for non-menu code that hasn't set itemIndex (e.g., keypad) -void lcd_move_axis(const AxisEnum axis) { MenuEditItemBase::itemIndex = int8_t(axis); _lcd_move_axis_n(); } - // Move Z easy accessor void lcd_move_z() { lcd_move_axis(Z_AXIS); } @@ -115,7 +106,7 @@ void lcd_move_z() { lcd_move_axis(Z_AXIS); } GET_TEXT_F(TERN(MULTI_E_MANUAL, MSG_MOVE_EN, MSG_MOVE_E)), ftostr41sign(current_position.e PLUS_TERN0(IS_KINEMATIC, ui.manual_move.offset) - MINUS_TERN0(MANUAL_E_MOVES_RELATIVE, manual_move_e_origin) + MINUS_TERN0(MANUAL_E_MOVES_RELATIVE, ui.manual_move.e_origin) ) ); } // should_draw @@ -140,26 +131,22 @@ void lcd_move_z() { lcd_move_axis(Z_AXIS); } #define FINE_MANUAL_MOVE 0.025 #endif -screenFunc_t _manual_move_func_ptr; - void _goto_manual_move(const_float_t scale) { ui.defer_status_screen(); ui.manual_move.menu_scale = scale; - ui.goto_screen(_manual_move_func_ptr); + ui.goto_screen(ui.manual_move.screen_ptr); thermalManager.set_menu_cold_override(true); } void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int8_t eindex=active_extruder) { - _manual_move_func_ptr = func; + ui.manual_move.screen_ptr = func; START_MENU(); if (LCD_HEIGHT >= 4) { - switch (axis) { - #define _CASE_MOVE(N) case N##_AXIS: STATIC_ITEM_N(N##_AXIS, MSG_MOVE_N, SS_DEFAULT|SS_INVERT); break; - MAIN_AXIS_MAP(_CASE_MOVE) - default: - TERN_(MANUAL_E_MOVES_RELATIVE, manual_move_e_origin = current_position.e); - STATIC_ITEM(MSG_MOVE_E, SS_DEFAULT|SS_INVERT); - break; + if (axis < NUM_AXES) + STATIC_ITEM_N(axis, MSG_MOVE_N, SS_DEFAULT|SS_INVERT); + else { + TERN_(MANUAL_E_MOVES_RELATIVE, ui.manual_move.e_origin = current_position.e); + STATIC_ITEM_N(eindex, MSG_MOVE_EN, SS_DEFAULT|SS_INVERT); } } @@ -181,8 +168,6 @@ void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int END_MENU(); } -void _menu_move_n_distance() { _menu_move_distance(AxisEnum(MenuItemBase::itemIndex), _lcd_move_axis_n); } - #if E_MANUAL inline void _goto_menu_move_distance_e() { @@ -216,8 +201,10 @@ void menu_move() { // Move submenu for each axis if (NONE(IS_KINEMATIC, NO_MOTION_BEFORE_HOMING) || all_axes_homed()) { if (TERN1(DELTA, current_position.z <= delta_clip_start_height)) { - for (uint8_t a = X_AXIS; a <= min(int(Y_AXIS), NUM_AXES - 1); a++) - SUBMENU_N(a, MSG_MOVE_N, _menu_move_n_distance); + SUBMENU_N(X_AXIS, MSG_MOVE_N, []{ _menu_move_distance(X_AXIS, []{ lcd_move_axis(X_AXIS); }); }); + #if HAS_Y_AXIS + SUBMENU_N(Y_AXIS, MSG_MOVE_N, []{ _menu_move_distance(Y_AXIS, []{ lcd_move_axis(Y_AXIS); }); }); + #endif } else { #if ENABLED(DELTA) @@ -225,8 +212,8 @@ void menu_move() { #endif } #if HAS_Z_AXIS - for (uint8_t a = Z_AXIS; a < NUM_AXES; a++) - SUBMENU_N(a, MSG_MOVE_N, _menu_move_n_distance); + #define _AXIS_MOVE(N) SUBMENU_N(N, MSG_MOVE_N, []{ _menu_move_distance(AxisEnum(N), []{ lcd_move_axis(AxisEnum(N)); }); }); + REPEAT_S(2, NUM_AXES, _AXIS_MOVE); #endif } else @@ -271,9 +258,9 @@ void menu_move() { #if E_MANUAL // The current extruder - SUBMENU(MSG_MOVE_E, []{ _menu_move_distance_e_maybe(); }); + SUBMENU(MSG_MOVE_E, _menu_move_distance_e_maybe); - #define SUBMENU_MOVE_E(N) SUBMENU_N(N, MSG_MOVE_EN, []{ _menu_move_distance(E_AXIS, []{ lcd_move_e(MenuItemBase::itemIndex); }, MenuItemBase::itemIndex); }); + #define SUBMENU_MOVE_E(N) SUBMENU_N(N, MSG_MOVE_EN, []{ _menu_move_distance(E_AXIS, []{ lcd_move_e(N); }, N); }); #if EITHER(SWITCHING_EXTRUDER, SWITCHING_NOZZLE) @@ -285,7 +272,7 @@ void menu_move() { #elif MULTI_E_MANUAL // Independent extruders with one E stepper per hotend - LOOP_L_N(n, E_MANUAL) SUBMENU_MOVE_E(n); + REPEAT(E_MANUAL, SUBMENU_MOVE_E); #endif diff --git a/Marlin/src/lcd/tft/ui_1024x600.cpp b/Marlin/src/lcd/tft/ui_1024x600.cpp index 15a51f56b8ec..ad9f8111815a 100644 --- a/Marlin/src/lcd/tft/ui_1024x600.cpp +++ b/Marlin/src/lcd/tft/ui_1024x600.cpp @@ -394,8 +394,7 @@ void MenuEditItemBase::draw_edit_screen(FSTR_P const fstr, const char * const va } #endif - extern screenFunc_t _manual_move_func_ptr; - if (ui.currentScreen != _manual_move_func_ptr && !ui.external_control) { + if (ui.can_show_slider()) { #define SLIDER_LENGTH 600 #define SLIDER_Y_POSITION 200 diff --git a/Marlin/src/lcd/tft/ui_320x240.cpp b/Marlin/src/lcd/tft/ui_320x240.cpp index a4fcc35bd039..56887478f0a6 100644 --- a/Marlin/src/lcd/tft/ui_320x240.cpp +++ b/Marlin/src/lcd/tft/ui_320x240.cpp @@ -383,8 +383,7 @@ void MenuEditItemBase::draw_edit_screen(FSTR_P const fstr, const char * const va } #endif - extern screenFunc_t _manual_move_func_ptr; - if (ui.currentScreen != _manual_move_func_ptr && !ui.external_control) { + if (ui.can_show_slider()) { #define SLIDER_LENGTH 224 #define SLIDER_Y_POSITION 140 diff --git a/Marlin/src/lcd/tft/ui_480x320.cpp b/Marlin/src/lcd/tft/ui_480x320.cpp index 8a5fa6335420..d4a04d690080 100644 --- a/Marlin/src/lcd/tft/ui_480x320.cpp +++ b/Marlin/src/lcd/tft/ui_480x320.cpp @@ -388,8 +388,7 @@ void MenuEditItemBase::draw_edit_screen(FSTR_P const fstr, const char * const va } #endif - extern screenFunc_t _manual_move_func_ptr; - if (ui.currentScreen != _manual_move_func_ptr && !ui.external_control) { + if (ui.can_show_slider()) { #define SLIDER_LENGTH 336 #define SLIDER_Y_POSITION 186 From 76d784f75f0349259c747b74bcf11f4e2b366da1 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 26 Jun 2022 10:01:22 -0500 Subject: [PATCH 200/241] =?UTF-8?q?=F0=9F=8E=A8=20=20Misc.=20shorthand=20o?= =?UTF-8?q?perators?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/DUE/usb/compiler.h | 2 +- Marlin/src/HAL/LINUX/eeprom.cpp | 16 ++++++++-------- Marlin/src/HAL/LINUX/hardware/Heater.h | 4 ++-- Marlin/src/HAL/shared/backtrace/unwarmbytab.cpp | 4 ++-- Marlin/src/feature/power_monitor.h | 2 +- .../src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp | 4 ++-- Marlin/src/lcd/extui/mks_ui/wifi_module.cpp | 2 +- Marlin/src/lcd/tft/touch.cpp | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Marlin/src/HAL/DUE/usb/compiler.h b/Marlin/src/HAL/DUE/usb/compiler.h index f89e554c4562..633197914eef 100644 --- a/Marlin/src/HAL/DUE/usb/compiler.h +++ b/Marlin/src/HAL/DUE/usb/compiler.h @@ -1059,7 +1059,7 @@ static inline void convert_64_bit_to_byte_array(uint64_t value, uint8_t *data) while (val_index < 8) { data[val_index++] = value & 0xFF; - value = value >> 8; + value >>= 8; } } diff --git a/Marlin/src/HAL/LINUX/eeprom.cpp b/Marlin/src/HAL/LINUX/eeprom.cpp index 532f323c6edb..f878bba6a51b 100644 --- a/Marlin/src/HAL/LINUX/eeprom.cpp +++ b/Marlin/src/HAL/LINUX/eeprom.cpp @@ -69,12 +69,12 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui std::size_t bytes_written = 0; for (std::size_t i = 0; i < size; i++) { - buffer[pos+i] = value[i]; - bytes_written ++; + buffer[pos + i] = value[i]; + bytes_written++; } crc16(crc, value, size); - pos = pos + size; + pos += size; return (bytes_written != size); // return true for any error } @@ -82,21 +82,21 @@ bool PersistentStore::read_data(int &pos, uint8_t *value, const size_t size, uin std::size_t bytes_read = 0; if (writing) { for (std::size_t i = 0; i < size; i++) { - value[i] = buffer[pos+i]; - bytes_read ++; + value[i] = buffer[pos + i]; + bytes_read++; } crc16(crc, value, size); } else { uint8_t temp[size]; for (std::size_t i = 0; i < size; i++) { - temp[i] = buffer[pos+i]; - bytes_read ++; + temp[i] = buffer[pos + i]; + bytes_read++; } crc16(crc, temp, size); } - pos = pos + size; + pos += size; return bytes_read != size; // return true for any error } diff --git a/Marlin/src/HAL/LINUX/hardware/Heater.h b/Marlin/src/HAL/LINUX/hardware/Heater.h index b17078d0b739..6d590ce6c55e 100644 --- a/Marlin/src/HAL/LINUX/hardware/Heater.h +++ b/Marlin/src/HAL/LINUX/hardware/Heater.h @@ -26,8 +26,8 @@ struct LowpassFilter { uint64_t data_delay = 0; uint16_t update(uint16_t value) { - data_delay = data_delay - (data_delay >> 6) + value; - return (uint16_t)(data_delay >> 6); + data_delay += value - (data_delay >> 6); + return uint16_t(data_delay >> 6); } }; diff --git a/Marlin/src/HAL/shared/backtrace/unwarmbytab.cpp b/Marlin/src/HAL/shared/backtrace/unwarmbytab.cpp index f1ee81ed4acb..148927a19f52 100644 --- a/Marlin/src/HAL/shared/backtrace/unwarmbytab.cpp +++ b/Marlin/src/HAL/shared/backtrace/unwarmbytab.cpp @@ -135,11 +135,11 @@ static UnwResult UnwTabExecuteInstructions(const UnwindCallbacks *cb, UnwTabStat while ((instruction = UnwTabGetNextInstruction(cb, ucb)) != -1) { if ((instruction & 0xC0) == 0x00) { // ARM_EXIDX_CMD_DATA_POP - /* vsp = vsp + (xxxxxx << 2) + 4 */ + /* vsp += (xxxxxx << 2) + 4 */ ucb->vrs[13] += ((instruction & 0x3F) << 2) + 4; } else if ((instruction & 0xC0) == 0x40) { // ARM_EXIDX_CMD_DATA_PUSH - /* vsp = vsp - (xxxxxx << 2) - 4 */ + /* vsp -= (xxxxxx << 2) - 4 */ ucb->vrs[13] -= ((instruction & 0x3F) << 2) - 4; } else if ((instruction & 0xF0) == 0x80) { diff --git a/Marlin/src/feature/power_monitor.h b/Marlin/src/feature/power_monitor.h index f6e0b292e30c..fa0690905333 100644 --- a/Marlin/src/feature/power_monitor.h +++ b/Marlin/src/feature/power_monitor.h @@ -32,7 +32,7 @@ struct pm_lpf_t { uint32_t filter_buf; float value; void add_sample(const uint16_t sample) { - filter_buf = filter_buf - (filter_buf >> K_VALUE) + (uint32_t(sample) << K_SCALE); + filter_buf += (uint32_t(sample) << K_SCALE) - (filter_buf >> K_VALUE); } void capture() { value = filter_buf * (SCALE * (1.0f / (1UL << (PM_K_VALUE + PM_K_SCALE)))); diff --git a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp index 2d4fe2e29d3a..531788cc3f1f 100644 --- a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp @@ -1141,7 +1141,7 @@ void DGUSScreenHandlerMKS::HandleAccChange(DGUS_VP_Variable &var, void *val_ptr) else queue.inject(F("M290 Z-0.01")); - z_offset_add = z_offset_add - ZOffset_distance; + z_offset_add -= ZOffset_distance; break; case 1: @@ -1156,7 +1156,7 @@ void DGUSScreenHandlerMKS::HandleAccChange(DGUS_VP_Variable &var, void *val_ptr) else queue.inject(F("M290 Z-0.01")); - z_offset_add = z_offset_add + ZOffset_distance; + z_offset_add += ZOffset_distance; break; default: diff --git a/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp b/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp index 73a76323fd2b..23a39aabc469 100644 --- a/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp +++ b/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp @@ -1638,7 +1638,7 @@ void esp_data_parser(char *cmdRxBuf, int len) { esp_msg_index += cpyLen; - leftLen = leftLen - cpyLen; + leftLen -= cpyLen; tail_pos = charAtArray(esp_msg_buf, esp_msg_index, ESP_PROTOC_TAIL); if (tail_pos == -1) { diff --git a/Marlin/src/lcd/tft/touch.cpp b/Marlin/src/lcd/tft/touch.cpp index a152907a9dde..050b59f39f90 100644 --- a/Marlin/src/lcd/tft/touch.cpp +++ b/Marlin/src/lcd/tft/touch.cpp @@ -175,7 +175,7 @@ void Touch::touch(touch_control_t *control) { ui.refresh(); break; case PAGE_DOWN: - encoderTopLine = encoderTopLine + 2 * LCD_HEIGHT < screen_items ? encoderTopLine + LCD_HEIGHT : screen_items - LCD_HEIGHT; + encoderTopLine = (encoderTopLine + 2 * LCD_HEIGHT < screen_items) ? encoderTopLine + LCD_HEIGHT : screen_items - LCD_HEIGHT; ui.encoderPosition = ui.encoderPosition + LCD_HEIGHT < (uint32_t)screen_items ? ui.encoderPosition + LCD_HEIGHT : screen_items; ui.refresh(); break; From 95b70233f21a58382ca895b7918eb532daffcd23 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Mon, 27 Jun 2022 00:24:23 +0000 Subject: [PATCH 201/241] [cron] Bump distribution date (2022-06-27) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index c889251d7250..8c7a45b3bff5 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-06-26" +//#define STRING_DISTRIBUTION_DATE "2022-06-27" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 8e133f9d2286..96d5a9c6d741 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-06-26" + #define STRING_DISTRIBUTION_DATE "2022-06-27" #endif /** From 884f7c7db9dbe7a7044bb2e97e59d91946f4a071 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 26 Jun 2022 22:32:00 -0500 Subject: [PATCH 202/241] =?UTF-8?q?=F0=9F=93=9D=20=20Note=20about=20UBL=20?= =?UTF-8?q?bad=20splits?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp index e6eec0de63fd..9fa2257dc8a6 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp @@ -36,8 +36,18 @@ #include "../../../MarlinCore.h" #include +//#define DEBUG_UBL_MOTION +#define DEBUG_OUT ENABLED(DEBUG_UBL_MOTION) +#include "../../../core/debug_out.h" + #if !UBL_SEGMENTED + // TODO: The first and last parts of a move might result in very short segment(s) + // after getting split on the cell boundary, so moves like that should not + // get split. This will be most common for moves that start/end near the + // corners of cells. To fix the issue, simply check if the start/end of the line + // is very close to a cell boundary in advance and don't split the line there. + void unified_bed_leveling::line_to_destination_cartesian(const_feedRate_t scaled_fr_mm_s, const uint8_t extruder) { /** * Much of the nozzle movement will be within the same cell. So we will do as little computation @@ -176,7 +186,9 @@ dest.z += z0; planner.buffer_segment(dest, scaled_fr_mm_s, extruder); - } //else printf("FIRST MOVE PRUNED "); + } + else + DEBUG_ECHOLNPGM("[ubl] skip Y segment"); } // At the final destination? Usually not, but when on a Y Mesh Line it's completed. @@ -225,7 +237,9 @@ dest.z += z0; if (!planner.buffer_segment(dest, scaled_fr_mm_s, extruder)) break; - } //else printf("FIRST MOVE PRUNED "); + } + else + DEBUG_ECHOLNPGM("[ubl] skip Y segment"); } if (xy_pos_t(current_position) != xy_pos_t(end)) From 307dfb15ca88f424dcb4cf579e4542e77dfb0eaf Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 26 Jun 2022 22:24:59 -0500 Subject: [PATCH 203/241] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Planner=20flags=20?= =?UTF-8?q?refactor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/motion/G2_G3.cpp | 2 +- Marlin/src/gcode/motion/G6.cpp | 2 +- Marlin/src/gcode/temp/M106_M107.cpp | 4 +- Marlin/src/module/planner.cpp | 155 +++++++++++++--------------- Marlin/src/module/planner.h | 108 +++++++++++-------- Marlin/src/module/stepper.cpp | 21 ++-- Marlin/src/module/stepper.h | 3 +- 7 files changed, 153 insertions(+), 142 deletions(-) diff --git a/Marlin/src/gcode/motion/G2_G3.cpp b/Marlin/src/gcode/motion/G2_G3.cpp index cd8225de6902..d9458f61eb39 100644 --- a/Marlin/src/gcode/motion/G2_G3.cpp +++ b/Marlin/src/gcode/motion/G2_G3.cpp @@ -315,7 +315,7 @@ void plan_arc( // Compute exact location by applying transformation matrix from initial radius vector(=-offset). // To reduce stuttering, the sin and cos could be computed at different times. // For now, compute both at the same time. - const float cos_Ti = cos(i * theta_per_segment), sin_Ti = sin(i * theta_per_segment); + const float Ti = i * theta_per_segment, cos_Ti = cos(Ti), sin_Ti = sin(Ti); rvec.a = -offset[0] * cos_Ti + offset[1] * sin_Ti; rvec.b = -offset[0] * sin_Ti - offset[1] * cos_Ti; } diff --git a/Marlin/src/gcode/motion/G6.cpp b/Marlin/src/gcode/motion/G6.cpp index a57a293e06f8..fb6281707b45 100644 --- a/Marlin/src/gcode/motion/G6.cpp +++ b/Marlin/src/gcode/motion/G6.cpp @@ -50,7 +50,7 @@ void GcodeSuite::G6() { // No speed is set, can't schedule the move if (!planner.last_page_step_rate) return; - const page_idx_t page_idx = (page_idx_t) parser.value_ulong(); + const page_idx_t page_idx = (page_idx_t)parser.value_ulong(); uint16_t num_steps = DirectStepping::Config::TOTAL_STEPS; if (parser.seen('S')) num_steps = parser.value_ushort(); diff --git a/Marlin/src/gcode/temp/M106_M107.cpp b/Marlin/src/gcode/temp/M106_M107.cpp index 98e87c415de9..ae517c977b29 100644 --- a/Marlin/src/gcode/temp/M106_M107.cpp +++ b/Marlin/src/gcode/temp/M106_M107.cpp @@ -90,7 +90,7 @@ void GcodeSuite::M106() { // Set speed, with constraint thermalManager.set_fan_speed(pfan, speed); - TERN_(LASER_SYNCHRONOUS_M106_M107, planner.buffer_sync_block(BLOCK_FLAG_SYNC_FANS)); + TERN_(LASER_SYNCHRONOUS_M106_M107, planner.buffer_sync_block(BLOCK_BIT_SYNC_FANS)); if (TERN0(DUAL_X_CARRIAGE, idex_is_duplicating())) // pfan == 0 when duplicating thermalManager.set_fan_speed(1 - pfan, speed); @@ -111,7 +111,7 @@ void GcodeSuite::M107() { if (TERN0(DUAL_X_CARRIAGE, idex_is_duplicating())) // pfan == 0 when duplicating thermalManager.set_fan_speed(1 - pfan, 0); - TERN_(LASER_SYNCHRONOUS_M106_M107, planner.buffer_sync_block(BLOCK_FLAG_SYNC_FANS)); + TERN_(LASER_SYNCHRONOUS_M106_M107, planner.buffer_sync_block(BLOCK_BIT_SYNC_FANS)); } #endif // HAS_FAN diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 950f11f86244..d12fa5ed4b2e 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -739,7 +739,7 @@ block_t* Planner::get_current_block() { block_t * const block = &block_buffer[block_buffer_tail]; // No trapezoid calculated? Don't execute yet. - if (TEST(block->flag, BLOCK_BIT_RECALCULATE)) return nullptr; + if (block->flag.recalculate) return nullptr; // We can't be sure how long an active block will take, so don't count it. TERN_(HAS_WIRED_LCD, block_buffer_runtime_us -= block->segment_time_us); @@ -948,7 +948,7 @@ void Planner::reverse_pass_kernel(block_t * const current, const block_t * const // Compute maximum entry speed decelerating over the current block from its exit speed. // If not at the maximum entry speed, or the previous block entry speed changed - if (current->entry_speed_sqr != max_entry_speed_sqr || (next && TEST(next->flag, BLOCK_BIT_RECALCULATE))) { + if (current->entry_speed_sqr != max_entry_speed_sqr || (next && next->flag.recalculate)) { // If nominal length true, max junction speed is guaranteed to be reached. // If a block can de/ac-celerate from nominal speed to zero within the length of the block, then @@ -958,14 +958,14 @@ void Planner::reverse_pass_kernel(block_t * const current, const block_t * const // the reverse and forward planners, the corresponding block junction speed will always be at the // the maximum junction speed and may always be ignored for any speed reduction checks. - const float new_entry_speed_sqr = TEST(current->flag, BLOCK_BIT_NOMINAL_LENGTH) + const float new_entry_speed_sqr = current->flag.nominal_length ? max_entry_speed_sqr : _MIN(max_entry_speed_sqr, max_allowable_speed_sqr(-current->acceleration, next ? next->entry_speed_sqr : sq(float(MINIMUM_PLANNER_SPEED)), current->millimeters)); if (current->entry_speed_sqr != new_entry_speed_sqr) { // Need to recalculate the block speed - Mark it now, so the stepper // ISR does not consume the block before being recalculated - SBI(current->flag, BLOCK_BIT_RECALCULATE); + current->flag.recalculate = true; // But there is an inherent race condition here, as the block may have // become BUSY just before being marked RECALCULATE, so check for that! @@ -973,7 +973,7 @@ void Planner::reverse_pass_kernel(block_t * const current, const block_t * const // Block became busy. Clear the RECALCULATE flag (no point in // recalculating BUSY blocks). And don't set its speed, as it can't // be updated at this time. - CBI(current->flag, BLOCK_BIT_RECALCULATE); + current->flag.recalculate = false; } else { // Block is not BUSY so this is ahead of the Stepper ISR: @@ -1011,8 +1011,8 @@ void Planner::reverse_pass() { // Perform the reverse pass block_t *current = &block_buffer[block_index]; - // Only consider non sync-and-page blocks - if (!(current->flag & BLOCK_MASK_SYNC) && !IS_PAGE(current)) { + // Only process movement blocks + if (current->is_move()) { reverse_pass_kernel(current, next); next = current; } @@ -1041,8 +1041,7 @@ void Planner::forward_pass_kernel(const block_t * const previous, block_t * cons // change, adjust the entry speed accordingly. Entry speeds have already been reset, // maximized, and reverse-planned. If nominal length is set, max junction speed is // guaranteed to be reached. No need to recheck. - if (!TEST(previous->flag, BLOCK_BIT_NOMINAL_LENGTH) && - previous->entry_speed_sqr < current->entry_speed_sqr) { + if (!previous->flag.nominal_length && previous->entry_speed_sqr < current->entry_speed_sqr) { // Compute the maximum allowable speed const float new_entry_speed_sqr = max_allowable_speed_sqr(-previous->acceleration, previous->entry_speed_sqr, previous->millimeters); @@ -1052,7 +1051,7 @@ void Planner::forward_pass_kernel(const block_t * const previous, block_t * cons // Mark we need to recompute the trapezoidal shape, and do it now, // so the stepper ISR does not consume the block before being recalculated - SBI(current->flag, BLOCK_BIT_RECALCULATE); + current->flag.recalculate = true; // But there is an inherent race condition here, as the block maybe // became BUSY, just before it was marked as RECALCULATE, so check @@ -1061,7 +1060,7 @@ void Planner::forward_pass_kernel(const block_t * const previous, block_t * cons // Block became busy. Clear the RECALCULATE flag (no point in // recalculating BUSY blocks and don't set its speed, as it can't // be updated at this time. - CBI(current->flag, BLOCK_BIT_RECALCULATE); + current->flag.recalculate = false; } else { // Block is not BUSY, we won the race against the Stepper ISR: @@ -1106,8 +1105,8 @@ void Planner::forward_pass() { // Perform the forward pass block = &block_buffer[block_index]; - // Skip SYNC and page blocks - if (!(block->flag & BLOCK_MASK_SYNC) && !IS_PAGE(block)) { + // Only process movement blocks + if (block->is_move()) { // If there's no previous block or the previous block is not // BUSY (thus, modifiable) run the forward_pass_kernel. Otherwise, // the previous block became BUSY, so assume the current block's @@ -1131,9 +1130,10 @@ void Planner::recalculate_trapezoids() { // The tail may be changed by the ISR so get a local copy. uint8_t block_index = block_buffer_tail, head_block_index = block_buffer_head; - // Since there could be a sync block in the head of the queue, and the + + // Since there could be non-move blocks in the head of the queue, and the // next loop must not recalculate the head block (as it needs to be - // specially handled), scan backwards to the first non-SYNC block. + // specially handled), scan backwards to the first move block. while (head_block_index != block_index) { // Go back (head always point to the first free block) @@ -1142,8 +1142,8 @@ void Planner::recalculate_trapezoids() { // Get the pointer to the block block_t *prev = &block_buffer[prev_index]; - // If not dealing with a sync block, we are done. The last block is not a SYNC block - if (!(prev->flag & BLOCK_MASK_SYNC)) break; + // It the block is a move, we're done with this loop + if (prev->is_move()) break; // Examine the previous block. This and all following are SYNC blocks head_block_index = prev_index; @@ -1156,18 +1156,17 @@ void Planner::recalculate_trapezoids() { next = &block_buffer[block_index]; - // Skip sync and page blocks - if (!(next->flag & BLOCK_MASK_SYNC) && !IS_PAGE(next)) { + // Only process movement blocks + if (next->is_move()) { next_entry_speed = SQRT(next->entry_speed_sqr); if (block) { - // Recalculate if current block entry or exit junction speed has changed. - if (TEST(block->flag, BLOCK_BIT_RECALCULATE) || TEST(next->flag, BLOCK_BIT_RECALCULATE)) { - // Mark the current block as RECALCULATE, to protect it from the Stepper ISR running it. - // Note that due to the above condition, there's a chance the current block isn't marked as - // RECALCULATE yet, but the next one is. That's the reason for the following line. - SBI(block->flag, BLOCK_BIT_RECALCULATE); + // If the next block is marked to RECALCULATE, also mark the previously-fetched one + if (next->flag.recalculate) block->flag.recalculate = true; + + // Recalculate if current block entry or exit junction speed has changed. + if (block->flag.recalculate) { // But there is an inherent race condition here, as the block maybe // became BUSY, just before it was marked as RECALCULATE, so check @@ -1190,7 +1189,7 @@ void Planner::recalculate_trapezoids() { // Reset current only to ensure next trapezoid is computed - The // stepper is free to use the block from now on. - CBI(block->flag, BLOCK_BIT_RECALCULATE); + block->flag.recalculate = false; } } @@ -1204,10 +1203,10 @@ void Planner::recalculate_trapezoids() { // Last/newest block in buffer. Exit speed is set with MINIMUM_PLANNER_SPEED. Always recalculated. if (next) { - // Mark the next(last) block as RECALCULATE, to prevent the Stepper ISR running it. + // Mark the last block as RECALCULATE, to prevent the Stepper ISR running it. // As the last block is always recalculated here, there is a chance the block isn't // marked as RECALCULATE yet. That's the reason for the following line. - SBI(next->flag, BLOCK_BIT_RECALCULATE); + block->flag.recalculate = true; // But there is an inherent race condition here, as the block maybe // became BUSY, just before it was marked as RECALCULATE, so check @@ -1229,7 +1228,7 @@ void Planner::recalculate_trapezoids() { // Reset next only to ensure its trapezoid is computed - The stepper is free to use // the block from now on. - CBI(next->flag, BLOCK_BIT_RECALCULATE); + next->flag.recalculate = false; } } @@ -1460,7 +1459,7 @@ void Planner::check_axes_activity() { for (uint8_t b = block_buffer_tail; b != block_buffer_head; b = next_block_index(b)) { const block_t * const block = &block_buffer[b]; if (NUM_AXIS_GANG(block->steps.x, || block->steps.y, || block->steps.z, || block->steps.i, || block->steps.j, || block->steps.k, || block->steps.u, || block->steps.v, || block->steps.w)) { - const float se = (float)block->steps.e / block->step_event_count * SQRT(block->nominal_speed_sqr); // mm/sec; + const float se = (float)block->steps.e / block->step_event_count * SQRT(block->nominal_speed_sqr); // mm/sec NOLESS(high, se); } } @@ -1782,7 +1781,7 @@ void Planner::synchronize() { while (busy()) idle(); } bool Planner::_buffer_steps(const xyze_long_t &target OPTARG(HAS_POSITION_FLOAT, const xyze_pos_t &target_float) OPTARG(HAS_DIST_MM_ARG, const xyze_float_t &cart_dist_mm) - , feedRate_t fr_mm_s, const uint8_t extruder, const_float_t millimeters + , feedRate_t fr_mm_s, const uint8_t extruder, const_float_t millimeters/*=0.0*/ ) { // Wait for the next available block @@ -1796,10 +1795,11 @@ bool Planner::_buffer_steps(const xyze_long_t &target // Fill the block with the specified movement if (!_populate_block(block, false, target - OPTARG(HAS_POSITION_FLOAT, target_float) - OPTARG(HAS_DIST_MM_ARG, cart_dist_mm) - , fr_mm_s, extruder, millimeters - )) { + OPTARG(HAS_POSITION_FLOAT, target_float) + OPTARG(HAS_DIST_MM_ARG, cart_dist_mm) + , fr_mm_s, extruder, millimeters + ) + ) { // Movement was not queued, probably because it was too short. // Simply accept that as movement queued and done return true; @@ -1856,36 +1856,8 @@ bool Planner::_populate_block(block_t * const block, bool split_move, ); /* <-- add a slash to enable - SERIAL_ECHOLNPGM( - " _populate_block FR:", fr_mm_s, - " A:", target.a, " (", da, " steps)" - #if HAS_Y_AXIS - " B:", target.b, " (", db, " steps)" - #endif - #if HAS_Z_AXIS - " C:", target.c, " (", dc, " steps)" - #endif - #if HAS_I_AXIS - " " STR_I ":", target.i, " (", di, " steps)" - #endif - #if HAS_J_AXIS - " " STR_J ":", target.j, " (", dj, " steps)" - #endif - #if HAS_K_AXIS - " " STR_K ":", target.k, " (", dk, " steps)" - #endif - #if HAS_U_AXIS - " " STR_U ":", target.u, " (", du, " steps)" - #endif - #if HAS_V_AXIS - " " STR_V ":", target.v, " (", dv, " steps)" - #endif - #if HAS_W_AXIS - " " STR_W ":", target.w, " (", dw, " steps)" - #if HAS_EXTRUDERS - " E:", target.e, " (", de, " steps)" - #endif - ); + #define _ALINE(A) " " STR_##A ":", target[_AXIS(A)], " (", int32_t(target[_AXIS(A)] - position[_AXIS(A)]), " steps)" + SERIAL_ECHOLNPGM(" _populate_block FR:", fr_mm_s, LOGICAL_AXIS_MAP(_ALINE)); //*/ #if EITHER(PREVENT_COLD_EXTRUSION, PREVENT_LENGTHY_EXTRUDE) @@ -1978,7 +1950,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, #endif // Clear all flags, including the "busy" bit - block->flag = 0x00; + block->flag.clear(); // Set direction bits block->direction_bits = dm; @@ -2449,7 +2421,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, if (speed_factor < 1.0f) { current_speed *= speed_factor; block->nominal_rate *= speed_factor; - block->nominal_speed_sqr = block->nominal_speed_sqr * sq(speed_factor); + block->nominal_speed_sqr *= sq(speed_factor); } // Compute and limit the acceleration rate for the trapezoid generator. @@ -2651,14 +2623,15 @@ bool Planner::_populate_block(block_t * const block, bool split_move, vmax_junction_sqr = sq(float(MINIMUM_PLANNER_SPEED)); } else { - NOLESS(junction_cos_theta, -0.999999f); // Check for numerical round-off to avoid divide by zero. - // Convert delta vector to unit vector xyze_float_t junction_unit_vec = unit_vec - prev_unit_vec; normalize_junction_vector(junction_unit_vec); - const float junction_acceleration = limit_value_by_axis_maximum(block->acceleration, junction_unit_vec), - sin_theta_d2 = SQRT(0.5f * (1.0f - junction_cos_theta)); // Trig half angle identity. Always positive. + const float junction_acceleration = limit_value_by_axis_maximum(block->acceleration, junction_unit_vec); + + NOLESS(junction_cos_theta, -0.999999f); // Check for numerical round-off to avoid divide by zero. + + const float sin_theta_d2 = SQRT(0.5f * (1.0f - junction_cos_theta)); // Trig half angle identity. Always positive. vmax_junction_sqr = junction_acceleration * junction_deviation_mm * sin_theta_d2 / (1.0f - sin_theta_d2); @@ -2888,7 +2861,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, // block nominal speed limits both the current and next maximum junction speeds. Hence, in both // the reverse and forward planners, the corresponding block junction speed will always be at the // the maximum junction speed and may always be ignored for any speed reduction checks. - block->flag |= block->nominal_speed_sqr <= v_allowable_sqr ? BLOCK_FLAG_RECALCULATE | BLOCK_FLAG_NOMINAL_LENGTH : BLOCK_FLAG_RECALCULATE; + block->flag.set_nominal(block->nominal_speed_sqr <= v_allowable_sqr); // Update previous path unit_vector and nominal speed previous_speed = current_speed; @@ -2913,9 +2886,9 @@ bool Planner::_populate_block(block_t * const block, bool split_move, * Add a block to the buffer that just updates the position, * or in case of LASER_SYNCHRONOUS_M106_M107 the fan PWM */ -void Planner::buffer_sync_block(TERN_(LASER_SYNCHRONOUS_M106_M107, uint8_t sync_flag)) { +void Planner::buffer_sync_block(TERN_(LASER_SYNCHRONOUS_M106_M107, const BlockFlagBit sync_flag/*=BLOCK_BIT_SYNC_POSITION*/)) { #if DISABLED(LASER_SYNCHRONOUS_M106_M107) - constexpr uint8_t sync_flag = BLOCK_FLAG_SYNC_POSITION; + constexpr BlockFlagBit sync_flag = BLOCK_BIT_SYNC_POSITION; #endif // Wait for the next available block @@ -2925,7 +2898,7 @@ void Planner::buffer_sync_block(TERN_(LASER_SYNCHRONOUS_M106_M107, uint8_t sync_ // Clear block memset(block, 0, sizeof(block_t)); - block->flag = sync_flag; + block->flag.apply(sync_flag); block->position = position; #if ENABLED(BACKLASH_COMPENSATION) @@ -3073,8 +3046,8 @@ bool Planner::buffer_segment(const abce_pos_t &abce if (!_buffer_steps(target OPTARG(HAS_POSITION_FLOAT, target_float) OPTARG(HAS_DIST_MM_ARG, cart_dist_mm) - , fr_mm_s, extruder, millimeters) - ) return false; + , fr_mm_s, extruder, millimeters + )) return false; stepper.wake_up(); return true; @@ -3141,6 +3114,14 @@ bool Planner::buffer_line(const xyze_pos_t &cart, const_feedRate_t fr_mm_s, cons #if ENABLED(DIRECT_STEPPING) + /** + * @brief Add a direct stepping page block to the buffer + * and wake up the Stepper ISR to process it. + * + * @param page_idx Page index provided by G6 I + * @param extruder The extruder to use in the move + * @param num_steps Number of steps to process in the ISR + */ void Planner::buffer_page(const page_idx_t page_idx, const uint8_t extruder, const uint16_t num_steps) { if (!last_page_step_rate) { kill(GET_TEXT_F(MSG_BAD_PAGE_SPEED)); @@ -3150,7 +3131,7 @@ bool Planner::buffer_line(const xyze_pos_t &cart, const_feedRate_t fr_mm_s, cons uint8_t next_buffer_head; block_t * const block = get_next_free_block(next_buffer_head); - block->flag = BLOCK_FLAG_IS_PAGE; + block->flag.reset(BLOCK_BIT_PAGE); #if HAS_FAN FANS_LOOP(i) block->fan_speed[i] = thermalManager.fan_speed[i]; @@ -3238,6 +3219,12 @@ void Planner::set_machine_position_mm(const abce_pos_t &abce) { } } +/** + * @brief Set the Planner position in mm + * @details Set the Planner position from a native machine position in mm + * + * @param xyze A native (Cartesian) machine position + */ void Planner::set_position_mm(const xyze_pos_t &xyze) { xyze_pos_t machine = xyze; TERN_(HAS_POSITION_MODIFIERS, apply_modifiers(machine, true)); @@ -3273,7 +3260,13 @@ void Planner::set_position_mm(const xyze_pos_t &xyze) { #endif -// Recalculate the steps/s^2 acceleration rates, based on the mm/s^2 +/** + * @brief Recalculate the steps/s^2 acceleration rates, based on the mm/s^2 + * @details Update planner movement factors after a change to certain settings: + * - max_acceleration_steps_per_s2 from settings max_acceleration_mm_per_s2 * axis_steps_per_mm (M201, M92) + * - acceleration_long_cutoff based on the largest max_acceleration_steps_per_s2 (M201) + * - max_e_jerk for all extruders based on junction_deviation_mm (M205 J) + */ void Planner::reset_acceleration_rates() { uint32_t highest_rate = 1; LOOP_DISTINCT_AXES(i) { @@ -3286,8 +3279,8 @@ void Planner::reset_acceleration_rates() { } /** - * Recalculate 'position' and 'mm_per_step'. - * Must be called whenever settings.axis_steps_per_mm changes! + * @brief Recalculate 'position' and 'mm_per_step'. + * @details Required whenever settings.axis_steps_per_mm changes! */ void Planner::refresh_positioning() { LOOP_DISTINCT_AXES(i) mm_per_step[i] = 1.0f / settings.axis_steps_per_mm[i]; diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index bef381b5c7c4..d181b771c1bd 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -70,9 +70,6 @@ #if ENABLED(DIRECT_STEPPING) #include "../feature/direct_stepping.h" - #define IS_PAGE(B) TEST(B->flag, BLOCK_BIT_IS_PAGE) -#else - #define IS_PAGE(B) false #endif #if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER) @@ -92,7 +89,34 @@ #define HAS_DIST_MM_ARG 1 #endif -enum BlockFlagBit : char { +#if ENABLED(LASER_POWER_INLINE) + + typedef struct { + bool isPlanned:1; + bool isEnabled:1; + bool dir:1; + bool Reserved:6; + } power_status_t; + + typedef struct { + power_status_t status; // See planner settings for meaning + uint8_t power; // Ditto; When in trapezoid mode this is nominal power + #if ENABLED(LASER_POWER_INLINE_TRAPEZOID) + uint8_t power_entry; // Entry power for the laser + #if DISABLED(LASER_POWER_INLINE_TRAPEZOID_CONT) + uint8_t power_exit; // Exit power for the laser + uint32_t entry_per, // Steps per power increment (to avoid floats in stepper calcs) + exit_per; // Steps per power decrement + #endif + #endif + } block_laser_t; + +#endif + +/** + * Planner block flags as boolean bit fields + */ +enum BlockFlagBit { // Recalculate trapezoids on entry junction. For optimization. BLOCK_BIT_RECALCULATE, @@ -109,7 +133,7 @@ enum BlockFlagBit : char { // Direct stepping page #if ENABLED(DIRECT_STEPPING) - , BLOCK_BIT_IS_PAGE + , BLOCK_BIT_PAGE #endif // Sync the fan speeds from the block @@ -118,57 +142,55 @@ enum BlockFlagBit : char { #endif }; -enum BlockFlag : char { - BLOCK_FLAG_RECALCULATE = _BV(BLOCK_BIT_RECALCULATE) - , BLOCK_FLAG_NOMINAL_LENGTH = _BV(BLOCK_BIT_NOMINAL_LENGTH) - , BLOCK_FLAG_CONTINUED = _BV(BLOCK_BIT_CONTINUED) - , BLOCK_FLAG_SYNC_POSITION = _BV(BLOCK_BIT_SYNC_POSITION) - #if ENABLED(DIRECT_STEPPING) - , BLOCK_FLAG_IS_PAGE = _BV(BLOCK_BIT_IS_PAGE) - #endif - #if ENABLED(LASER_SYNCHRONOUS_M106_M107) - , BLOCK_FLAG_SYNC_FANS = _BV(BLOCK_BIT_SYNC_FANS) - #endif -}; +/** + * Planner block flags as boolean bit fields + */ +typedef struct { + union { + uint8_t bits; -#define BLOCK_MASK_SYNC ( BLOCK_FLAG_SYNC_POSITION | TERN0(LASER_SYNCHRONOUS_M106_M107, BLOCK_FLAG_SYNC_FANS) ) + struct { + bool recalculate:1; -#if ENABLED(LASER_POWER_INLINE) + bool nominal_length:1; - typedef struct { - bool isPlanned:1; - bool isEnabled:1; - bool dir:1; - bool Reserved:6; - } power_status_t; + bool continued:1; - typedef struct { - power_status_t status; // See planner settings for meaning - uint8_t power; // Ditto; When in trapezoid mode this is nominal power - #if ENABLED(LASER_POWER_INLINE_TRAPEZOID) - uint8_t power_entry; // Entry power for the laser - #if DISABLED(LASER_POWER_INLINE_TRAPEZOID_CONT) - uint8_t power_exit; // Exit power for the laser - uint32_t entry_per, // Steps per power increment (to avoid floats in stepper calcs) - exit_per; // Steps per power decrement + bool sync_position:1; + + #if ENABLED(DIRECT_STEPPING) + bool page:1; #endif - #endif - } block_laser_t; -#endif + #if ENABLED(LASER_SYNCHRONOUS_M106_M107) + bool sync_fans:1; + #endif + }; + }; + + void clear() volatile { bits = 0; } + void apply(const uint8_t f) volatile { bits |= f; } + void apply(const BlockFlagBit b) volatile { SBI(bits, b); } + void reset(const BlockFlagBit b) volatile { bits = _BV(b); } + void set_nominal(const bool n) volatile { recalculate = true; if (n) nominal_length = true; } + +} block_flags_t; /** - * struct block_t - * - * A single entry in the planner buffer. - * Tracks linear movement over multiple axes. + * A single entry in the planner buffer, used to set up and + * track a coordinated linear motion for one or more axes. * * The "nominal" values are as-specified by G-code, and * may never actually be reached due to acceleration limits. */ typedef struct block_t { - volatile uint8_t flag; // Block flags (See BlockFlag enum above) - Modified by ISR and main thread! + volatile block_flags_t flag; // Block flags + + volatile bool is_fan_sync() { return TERN0(LASER_SYNCHRONOUS_M106_M107, flag.sync_fans); } + volatile bool is_sync() { return flag.sync_position || is_fan_sync(); } + volatile bool is_page() { return TERN0(DIRECT_STEPPING, flag.page); } + volatile bool is_move() { return !(is_sync() || is_page()); } // Fields used by the motion planner to manage acceleration float nominal_speed_sqr, // The nominal speed for this block in (mm/sec)^2 @@ -759,7 +781,7 @@ class Planner { * case of LASER_SYNCHRONOUS_M106_M107 the fan pwm */ static void buffer_sync_block( - TERN_(LASER_SYNCHRONOUS_M106_M107, uint8_t sync_flag=BLOCK_FLAG_SYNC_POSITION) + TERN_(LASER_SYNCHRONOUS_M106_M107, const BlockFlagBit flag=BLOCK_BIT_SYNC_POSITION) ); #if IS_KINEMATIC diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 40cf7d02eaae..5dd1bd24b3fe 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -1699,7 +1699,7 @@ void Stepper::pulse_phase_isr() { }while(0) // Direct Stepping page? - const bool is_page = IS_PAGE(current_block); + const bool is_page = current_block->is_page(); #if ENABLED(DIRECT_STEPPING) // Direct stepping is currently not ready for HAS_I_AXIS @@ -1977,7 +1977,7 @@ uint32_t Stepper::block_phase_isr() { count_position[_AXIS(AXIS)] += page_step_state.bd[_AXIS(AXIS)] * count_direction[_AXIS(AXIS)]; #endif - if (IS_PAGE(current_block)) { + if (current_block->is_page()) { PAGE_SEGMENT_UPDATE_POS(X); PAGE_SEGMENT_UPDATE_POS(Y); PAGE_SEGMENT_UPDATE_POS(Z); @@ -2167,16 +2167,13 @@ uint32_t Stepper::block_phase_isr() { if ((current_block = planner.get_current_block())) { // Sync block? Sync the stepper counts or fan speeds and return - while (current_block->flag & BLOCK_MASK_SYNC) { + while (current_block->is_sync()) { - #if ENABLED(LASER_SYNCHRONOUS_M106_M107) - const bool is_sync_fans = TEST(current_block->flag, BLOCK_BIT_SYNC_FANS); - if (is_sync_fans) planner.sync_fan_speeds(current_block->fan_speed); - #else - constexpr bool is_sync_fans = false; - #endif - - if (!is_sync_fans) _set_position(current_block->position); + if (current_block->is_fan_sync()) { + TERN_(LASER_SYNCHRONOUS_M106_M107, planner.sync_fan_speeds(current_block->fan_speed)); + } + else + _set_position(current_block->position); discard_current_block(); @@ -2196,7 +2193,7 @@ uint32_t Stepper::block_phase_isr() { #endif #if ENABLED(DIRECT_STEPPING) - if (IS_PAGE(current_block)) { + if (current_block->is_page()) { page_step_state.segment_steps = 0; page_step_state.segment_idx = 0; page_step_state.page = page_manager.get_page(current_block->page_idx); diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h index 3b899e93e27c..c9a83caa7edb 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -524,8 +524,7 @@ class Stepper { // Discard current block and free any resources FORCE_INLINE static void discard_current_block() { #if ENABLED(DIRECT_STEPPING) - if (IS_PAGE(current_block)) - page_manager.free_page(current_block->page_idx); + if (current_block->is_page()) page_manager.free_page(current_block->page_idx); #endif current_block = nullptr; axis_did_move = 0; From 93ffd57383723c48a092e97364b6659c54b5c419 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 26 Jun 2022 22:30:05 -0500 Subject: [PATCH 204/241] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20=20reset=5Facceler?= =?UTF-8?q?ation=5Frates=20=3D>=20refresh=5F=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/calibrate/G28.cpp | 4 ++-- Marlin/src/lcd/menu/menu_advanced.cpp | 8 ++++---- Marlin/src/module/planner.cpp | 10 +++++----- Marlin/src/module/planner.h | 2 +- Marlin/src/module/settings.cpp | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index 27551fb10911..01c2b13dda53 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -169,7 +169,7 @@ motion_state.jerk_state = planner.max_jerk; planner.max_jerk.set(0, 0 OPTARG(DELTA, 0)); #endif - planner.reset_acceleration_rates(); + planner.refresh_acceleration_rates(); return motion_state; } @@ -178,7 +178,7 @@ planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = motion_state.acceleration.y; TERN_(DELTA, planner.settings.max_acceleration_mm_per_s2[Z_AXIS] = motion_state.acceleration.z); TERN_(HAS_CLASSIC_JERK, planner.max_jerk = motion_state.jerk_state); - planner.reset_acceleration_rates(); + planner.refresh_acceleration_rates(); } #endif // IMPROVE_HOMING_RELIABILITY diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 5d86b97b5d3e..f9f4116bc3a0 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -483,7 +483,7 @@ void menu_backlash(); // M204 T Travel Acceleration EDIT_ITEM_FAST(float5_25, MSG_A_TRAVEL, &planner.settings.travel_acceleration, 25, max_accel); - #define EDIT_AMAX(Q,L) EDIT_ITEM_FAST_N(long5_25, _AXIS(Q), MSG_AMAX_N, &planner.settings.max_acceleration_mm_per_s2[_AXIS(Q)], L, max_accel_edit_scaled[_AXIS(Q)], []{ planner.reset_acceleration_rates(); }) + #define EDIT_AMAX(Q,L) EDIT_ITEM_FAST_N(long5_25, _AXIS(Q), MSG_AMAX_N, &planner.settings.max_acceleration_mm_per_s2[_AXIS(Q)], L, max_accel_edit_scaled[_AXIS(Q)], []{ planner.refresh_acceleration_rates(); }) NUM_AXIS_CODE( EDIT_AMAX(A, 100), EDIT_AMAX(B, 100), EDIT_AMAX(C, 10), EDIT_AMAX(I, 10), EDIT_AMAX(J, 10), EDIT_AMAX(K, 10), @@ -491,14 +491,14 @@ void menu_backlash(); ); #if ENABLED(DISTINCT_E_FACTORS) - EDIT_ITEM_FAST(long5_25, MSG_AMAX_E, &planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(active_extruder)], 100, max_accel_edit_scaled.e, []{ planner.reset_acceleration_rates(); }); + EDIT_ITEM_FAST(long5_25, MSG_AMAX_E, &planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(active_extruder)], 100, max_accel_edit_scaled.e, []{ planner.refresh_acceleration_rates(); }); LOOP_L_N(n, E_STEPPERS) EDIT_ITEM_FAST_N(long5_25, n, MSG_AMAX_EN, &planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(n)], 100, max_accel_edit_scaled.e, []{ if (MenuItemBase::itemIndex == active_extruder) - planner.reset_acceleration_rates(); + planner.refresh_acceleration_rates(); }); #elif E_STEPPERS - EDIT_ITEM_FAST(long5_25, MSG_AMAX_E, &planner.settings.max_acceleration_mm_per_s2[E_AXIS], 100, max_accel_edit_scaled.e, []{ planner.reset_acceleration_rates(); }); + EDIT_ITEM_FAST(long5_25, MSG_AMAX_E, &planner.settings.max_acceleration_mm_per_s2[E_AXIS], 100, max_accel_edit_scaled.e, []{ planner.refresh_acceleration_rates(); }); #endif #ifdef XY_FREQUENCY_LIMIT diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index d12fa5ed4b2e..c3b1fdd72ab8 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1557,7 +1557,7 @@ void Planner::check_axes_activity() { TERN_(DELTA, settings.max_acceleration_mm_per_s2[Z_AXIS] = saved_motion_state.acceleration.z); TERN_(HAS_CLASSIC_JERK, max_jerk = saved_motion_state.jerk_state); } - reset_acceleration_rates(); + refresh_acceleration_rates(); } #endif @@ -3267,7 +3267,7 @@ void Planner::set_position_mm(const xyze_pos_t &xyze) { * - acceleration_long_cutoff based on the largest max_acceleration_steps_per_s2 (M201) * - max_e_jerk for all extruders based on junction_deviation_mm (M205 J) */ -void Planner::reset_acceleration_rates() { +void Planner::refresh_acceleration_rates() { uint32_t highest_rate = 1; LOOP_DISTINCT_AXES(i) { max_acceleration_steps_per_s2[i] = settings.max_acceleration_mm_per_s2[i] * settings.axis_steps_per_mm[i]; @@ -3285,7 +3285,7 @@ void Planner::reset_acceleration_rates() { void Planner::refresh_positioning() { LOOP_DISTINCT_AXES(i) mm_per_step[i] = 1.0f / settings.axis_steps_per_mm[i]; set_position_mm(current_position); - reset_acceleration_rates(); + refresh_acceleration_rates(); } // Apply limits to a variable and give a warning if the value was out of range @@ -3304,7 +3304,7 @@ inline void limit_and_warn(float &val, const AxisEnum axis, PGM_P const setting_ /** * For the specified 'axis' set the Maximum Acceleration to the given value (mm/s^2) * The value may be limited with warning feedback, if configured. - * Calls reset_acceleration_rates to precalculate planner terms in steps. + * Calls refresh_acceleration_rates to precalculate planner terms in steps. * * This hard limit is applied as a block is being added to the planner queue. */ @@ -3322,7 +3322,7 @@ void Planner::set_max_acceleration(const AxisEnum axis, float inMaxAccelMMS2) { settings.max_acceleration_mm_per_s2[axis] = inMaxAccelMMS2; // Update steps per s2 to agree with the units per s2 (since they are used in the planner) - reset_acceleration_rates(); + refresh_acceleration_rates(); } /** diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index d181b771c1bd..b8a108b4b3a9 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -514,7 +514,7 @@ class Planner { */ // Recalculate steps/s^2 accelerations based on mm/s^2 settings - static void reset_acceleration_rates(); + static void refresh_acceleration_rates(); /** * Recalculate 'position' and 'mm_per_step'. diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 149b1b6dc1e0..7ee3a87fce39 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -592,7 +592,7 @@ void MarlinSettings::postprocess() { xyze_pos_t oldpos = current_position; // steps per s2 needs to be updated to agree with units per s2 - planner.reset_acceleration_rates(); + planner.refresh_acceleration_rates(); // Make sure delta kinematics are updated before refreshing the // planner position so the stepper counts will be set correctly. From d6fc3d2b6963eccc7c1079cfa857a651c607795e Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 28 Jun 2022 06:05:50 +0000 Subject: [PATCH 205/241] [cron] Bump distribution date (2022-06-28) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 8c7a45b3bff5..31b741091421 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-06-27" +//#define STRING_DISTRIBUTION_DATE "2022-06-28" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 96d5a9c6d741..65457dbbf6cc 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-06-27" + #define STRING_DISTRIBUTION_DATE "2022-06-28" #endif /** From 31d286750c52a400fb645e94b4bc89531f4c5847 Mon Sep 17 00:00:00 2001 From: John Lagonikas <39417467+zeleps@users.noreply.github.com> Date: Wed, 29 Jun 2022 01:53:05 +0300 Subject: [PATCH 206/241] =?UTF-8?q?=F0=9F=90=9B=20Fix=20MAX31865=20PT1000?= =?UTF-8?q?=20normalization=20(#24407)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/libs/MAX31865.cpp | 65 +++++++++++++++++++++++------------- Marlin/src/libs/MAX31865.h | 13 ++------ 2 files changed, 45 insertions(+), 33 deletions(-) diff --git a/Marlin/src/libs/MAX31865.cpp b/Marlin/src/libs/MAX31865.cpp index c042504cf872..0d709b1b0b42 100644 --- a/Marlin/src/libs/MAX31865.cpp +++ b/Marlin/src/libs/MAX31865.cpp @@ -133,13 +133,13 @@ SPISettings MAX31865::spiConfig = SPISettings( /** * Initialize the SPI interface and set the number of RTD wires used * - * @param wires The number of wires in enum format. Can be MAX31865_2WIRE, MAX31865_3WIRE, or MAX31865_4WIRE. - * @param zero The resistance of the RTD at 0 degC, in ohms. - * @param ref The resistance of the reference resistor, in ohms. - * @param wire The resistance of the wire connecting the sensor to the RTD, in ohms. + * @param wires The number of wires as an enum: MAX31865_2WIRE, MAX31865_3WIRE, or MAX31865_4WIRE. + * @param zero_res The resistance of the RTD at 0°C, in ohms. + * @param ref_res The resistance of the reference resistor, in ohms. + * @param wire_res The resistance of the wire connecting the sensor to the RTD, in ohms. */ -void MAX31865::begin(max31865_numwires_t wires, float zero_res, float ref_res, float wire_res) { - zeroRes = zero_res; +void MAX31865::begin(max31865_numwires_t wires, const_float_t zero_res, const_float_t ref_res, const_float_t wire_res) { + resNormalizer = 100.0f / zero_res; // reciprocal of resistance, scaled by 100 refRes = ref_res; wireRes = wire_res; @@ -437,42 +437,61 @@ float MAX31865::temperature() { * * @return Temperature in C */ -float MAX31865::temperature(uint16_t adc_val) { +float MAX31865::temperature(const uint16_t adc_val) { return temperature(((adc_val) * RECIPROCAL(32768.0f)) * refRes - wireRes); } /** * Calculate the temperature in C from the RTD resistance. - * Uses the technique outlined in this PDF: - * http://www.analog.com/media/en/technical-documentation/application-notes/AN709_0.pdf * * @param rtd_res the resistance value in ohms - * @return the temperature in degC + * @return the temperature in °C */ float MAX31865::temperature(float rtd_res) { + + rtd_res *= resNormalizer; // normalize to 100 ohm + + // Constants for calculating temperature from the measured RTD resistance. + // http://www.analog.com/media/en/technical-documentation/application-notes/AN709_0.pdf + constexpr float RTD_Z1 = -0.0039083, + RTD_Z2 = +1.758480889e-5, + RTD_Z3 = -2.31e-8, + RTD_Z4 = -1.155e-6; + + // Callender-Van Dusen equation float temp = (RTD_Z1 + sqrt(RTD_Z2 + (RTD_Z3 * rtd_res))) * RECIPROCAL(RTD_Z4); - // From the PDF... // // The previous equation is valid only for temperatures of 0°C and above. // The equation for RRTD(t) that defines negative temperature behavior is a // fourth-order polynomial (after expanding the third term) and is quite // impractical to solve for a single expression of temperature as a function - // of resistance. + // of resistance. So here we use a Linear Approximation instead. // if (temp < 0) { - rtd_res = (rtd_res / zeroRes) * 100; // normalize to 100 ohm - float rpoly = rtd_res; + #ifndef MAX31865_APPROX + #define MAX31865_APPROX 5 + #endif + + constexpr float RTD_C[] = { + #if MAX31865_APPROX == 5 + -242.02, +2.2228, +2.5859e-3, -4.8260e-6, -2.8183e-8, +1.5243e-10 + #elif MAX31865_APPROX == 4 + -241.96, +2.2163, +2.8541e-3, -9.9121e-6, -1.7152e-8 + #elif MAX31865_APPROX == 3 + -242.09, +2.2276, +2.5178e-3, -5.8620e-6 + #else + -242.97, +2.2838, +1.4727e-3 + #endif + }; - temp = -242.02 + (2.2228 * rpoly); - rpoly *= rtd_res; // square - temp += 2.5859e-3 * rpoly; - rpoly *= rtd_res; // ^3 - temp -= 4.8260e-6 * rpoly; - rpoly *= rtd_res; // ^4 - temp -= 2.8183e-8 * rpoly; - rpoly *= rtd_res; // ^5 - temp += 1.5243e-10 * rpoly; + float rpoly = rtd_res; + temp = RTD_C[0]; + temp += rpoly * RTD_C[1]; + rpoly *= rtd_res; temp += rpoly * RTD_C[2]; + if (MAX31865_APPROX >= 3) rpoly *= rtd_res; temp += rpoly * RTD_C[3]; + if (MAX31865_APPROX >= 4) rpoly *= rtd_res; temp += rpoly * RTD_C[4]; + if (MAX31865_APPROX >= 5) rpoly *= rtd_res; temp += rpoly * RTD_C[5]; } return temp; diff --git a/Marlin/src/libs/MAX31865.h b/Marlin/src/libs/MAX31865.h index baea455485d4..95bde756cee7 100644 --- a/Marlin/src/libs/MAX31865.h +++ b/Marlin/src/libs/MAX31865.h @@ -73,13 +73,6 @@ #define MAX31865_FAULT_RTDINLOW 0x08 // D3 #define MAX31865_FAULT_OVUV 0x04 // D2 -// http://www.analog.com/media/en/technical-documentation/application-notes/AN709_0.pdf -// constants for calculating temperature from the measured RTD resistance. -#define RTD_Z1 -0.0039083 -#define RTD_Z2 0.00001758480889 -#define RTD_Z3 -0.0000000231 -#define RTD_Z4 -0.000001155 - typedef enum max31865_numwires { MAX31865_2WIRE = 0, MAX31865_3WIRE = 1, @@ -103,7 +96,7 @@ class MAX31865 { uint16_t spiDelay; - float zeroRes, refRes, wireRes; + float resNormalizer, refRes, wireRes; #if ENABLED(MAX31865_USE_READ_ERROR_DETECTION) millis_t lastReadStamp = 0; @@ -160,7 +153,7 @@ class MAX31865 { int8_t spi_clk); #endif - void begin(max31865_numwires_t wires, float zero_res, float ref_res, float wire_res); + void begin(max31865_numwires_t wires, const_float_t zero_res, const_float_t ref_res, const_float_t wire_res); uint8_t readFault(); void clearFault(); @@ -168,6 +161,6 @@ class MAX31865 { uint16_t readRaw(); float readResistance(); float temperature(); - float temperature(uint16_t adc_val); + float temperature(const uint16_t adc_val); float temperature(float rtd_res); }; From 914501f67e9ace9998092e334e6423767fc26c11 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Wed, 29 Jun 2022 00:21:53 +0000 Subject: [PATCH 207/241] [cron] Bump distribution date (2022-06-29) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 31b741091421..c9b48a93ec95 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-06-28" +//#define STRING_DISTRIBUTION_DATE "2022-06-29" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 65457dbbf6cc..c61da63346e0 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-06-28" + #define STRING_DISTRIBUTION_DATE "2022-06-29" #endif /** From cc51bc29e1fb4ddf962efcb0623c65affcac67e5 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Wed, 29 Jun 2022 06:24:22 -0700 Subject: [PATCH 208/241] =?UTF-8?q?=F0=9F=90=9B=20Fix=20Axis=20Homing=20(#?= =?UTF-8?q?24425)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to 4520a51 --- Marlin/src/lcd/menu/menu_motion.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index e6d3b8f4511a..cebc2eb31734 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -281,7 +281,7 @@ void menu_move() { END_MENU(); } -#define _HOME_ITEM(N) GCODES_ITEM_N(N##_AXIS, MSG_AUTO_HOME_A, F("G28X" STR_##N)); +#define _HOME_ITEM(N) GCODES_ITEM_N(N##_AXIS, MSG_AUTO_HOME_A, F("G28" STR_##N)); #if ENABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU) // From d9ec3795fbfa1c0c6de4774304eaa255794101fd Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 29 Jun 2022 17:14:23 -0500 Subject: [PATCH 209/241] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20memset=20block=20w?= =?UTF-8?q?arning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/planner.cpp | 2 +- Marlin/src/module/planner.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index c3b1fdd72ab8..129b9962d3f1 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -2896,7 +2896,7 @@ void Planner::buffer_sync_block(TERN_(LASER_SYNCHRONOUS_M106_M107, const BlockFl block_t * const block = get_next_free_block(next_buffer_head); // Clear block - memset(block, 0, sizeof(block_t)); + block->reset(); block->flag.apply(sync_flag); diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index b8a108b4b3a9..2d8a966ca033 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -274,6 +274,8 @@ typedef struct block_t { block_laser_t laser; #endif + void reset() { memset((char*)this, 0, sizeof(*this)); } + } block_t; #if ANY(LIN_ADVANCE, SCARA_FEEDRATE_SCALING, GRADIENT_MIX, LCD_SHOW_E_TOTAL, POWER_LOSS_RECOVERY) From 4fb1c42500f1e1e49fd3363fdf1e6159971fecc1 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Thu, 30 Jun 2022 00:21:32 +0000 Subject: [PATCH 210/241] [cron] Bump distribution date (2022-06-30) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index c9b48a93ec95..346e6cd9c888 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-06-29" +//#define STRING_DISTRIBUTION_DATE "2022-06-30" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index c61da63346e0..27b50136d5e9 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-06-29" + #define STRING_DISTRIBUTION_DATE "2022-06-30" #endif /** From f5488f96cc6dddb0f3c6034982de75849cc5461d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 29 Jun 2022 20:16:16 -0500 Subject: [PATCH 211/241] =?UTF-8?q?=F0=9F=93=9D=20Index=20Mobo=20Rev03=20?= =?UTF-8?q?=3D>=20Opulo=20Lumen=20Rev3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test-builds.yml | 2 +- Marlin/src/core/boards.h | 2 +- Marlin/src/pins/pins.h | 4 ++-- .../{pins_INDEX_REV03.h => pins_OPULO_LUMEN_REV3.h} | 8 ++++---- ...mobo_rev03.json => marlin_opulo_lumen_rev3.json} | 0 .../PlatformIO/scripts/generic_create_variant.py | 4 ++++ buildroot/tests/Index_Mobo_Rev03 | 13 ------------- buildroot/tests/Opulo_Lumen_REV3 | 13 +++++++++++++ ini/stm32f4.ini | 6 +++--- platformio.ini | 13 +++++++------ 10 files changed, 35 insertions(+), 30 deletions(-) rename Marlin/src/pins/stm32f4/{pins_INDEX_REV03.h => pins_OPULO_LUMEN_REV3.h} (97%) rename buildroot/share/PlatformIO/boards/{marlin_index_mobo_rev03.json => marlin_opulo_lumen_rev3.json} (100%) delete mode 100755 buildroot/tests/Index_Mobo_Rev03 create mode 100755 buildroot/tests/Opulo_Lumen_REV3 diff --git a/.github/workflows/test-builds.yml b/.github/workflows/test-builds.yml index 747095e07f96..e2418f38a6dd 100644 --- a/.github/workflows/test-builds.yml +++ b/.github/workflows/test-builds.yml @@ -100,7 +100,7 @@ jobs: - REMRAM_V1 - BTT_SKR_SE_BX - chitu_f103 - - Index_Mobo_Rev03 + - Opulo_Lumen_REV3 # Put lengthy tests last diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index ef750056d6fc..f6b30c6cffa5 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -413,7 +413,7 @@ #define BOARD_ANET_ET4P 4232 // ANET ET4P V1.x (STM32F407VG) #define BOARD_FYSETC_CHEETAH_V20 4233 // FYSETC Cheetah V2.0 #define BOARD_TH3D_EZBOARD_V2 4234 // TH3D EZBoard v2.0 -#define BOARD_INDEX_REV03 4235 // Index PnP Controller REV03 (STM32F407VE/VG) +#define BOARD_OPULO_LUMEN_REV3 4235 // Opulo Lumen PnP Controller REV3 (STM32F407VE/VG) #define BOARD_MKS_ROBIN_NANO_V1_3_F4 4236 // MKS Robin Nano V1.3 and MKS Robin Nano-S V1.3 (STM32F407VE) #define BOARD_MKS_EAGLE 4237 // MKS Eagle (STM32F407VE) #define BOARD_ARTILLERY_RUBY 4238 // Artillery Ruby (STM32F401RC) diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 40b0c714c6dd..f94de8363b93 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -687,8 +687,8 @@ #include "stm32f4/pins_MKS_MONSTER8.h" // STM32F4 env:mks_monster8 env:mks_monster8_usb_flash_drive env:mks_monster8_usb_flash_drive_msc #elif MB(TH3D_EZBOARD_V2) #include "stm32f4/pins_TH3D_EZBOARD_V2.h" // STM32F4 env:TH3D_EZBoard_V2 -#elif MB(INDEX_REV03) - #include "stm32f4/pins_INDEX_REV03.h" // STM32F4 env:Index_Mobo_Rev03 +#elif MB(OPULO_LUMEN_REV3) + #include "stm32f4/pins_OPULO_LUMEN_REV3.h" // STM32F4 env:Opulo_Lumen_REV3 #elif MB(MKS_ROBIN_NANO_V1_3_F4) #include "stm32f4/pins_MKS_ROBIN_NANO_V1_3_F4.h" // STM32F4 env:mks_robin_nano_v1_3_f4 #elif MB(MKS_EAGLE) diff --git a/Marlin/src/pins/stm32f4/pins_INDEX_REV03.h b/Marlin/src/pins/stm32f4/pins_OPULO_LUMEN_REV3.h similarity index 97% rename from Marlin/src/pins/stm32f4/pins_INDEX_REV03.h rename to Marlin/src/pins/stm32f4/pins_OPULO_LUMEN_REV3.h index ba3172aa8008..36dde8810525 100644 --- a/Marlin/src/pins/stm32f4/pins_INDEX_REV03.h +++ b/Marlin/src/pins/stm32f4/pins_OPULO_LUMEN_REV3.h @@ -22,15 +22,15 @@ #pragma once /** - * STM32F407VET6 on Index PnP Mobo Rev03 - * Website - https://indexmachines.io/ + * STM32F407VET6 on Opulo Lumen PnP Rev3 + * Website - https://opulo.io/ */ #define ALLOW_STM32DUINO #include "env_validate.h" -#define BOARD_INFO_NAME "Index Mobo Rev03" -#define DEFAULT_MACHINE_NAME "Index Pick and Place" +#define BOARD_INFO_NAME "Opulo Lumen REV3" +#define DEFAULT_MACHINE_NAME "Opulo Pick-and-Place" /** * By default, the extra stepper motor configuration is: diff --git a/buildroot/share/PlatformIO/boards/marlin_index_mobo_rev03.json b/buildroot/share/PlatformIO/boards/marlin_opulo_lumen_rev3.json similarity index 100% rename from buildroot/share/PlatformIO/boards/marlin_index_mobo_rev03.json rename to buildroot/share/PlatformIO/boards/marlin_opulo_lumen_rev3.json diff --git a/buildroot/share/PlatformIO/scripts/generic_create_variant.py b/buildroot/share/PlatformIO/scripts/generic_create_variant.py index d572873ad764..1bd77812f71c 100644 --- a/buildroot/share/PlatformIO/scripts/generic_create_variant.py +++ b/buildroot/share/PlatformIO/scripts/generic_create_variant.py @@ -21,6 +21,10 @@ from platformio.package.meta import PackageSpec platform_packages = env.GetProjectOption('platform_packages') + + # Remove all tool items from platform_packages + platform_packages = [x for x in platform_packages if not x.startswith("platformio/tool-")] + if len(platform_packages) == 0: framewords = { "Ststm32Platform": "framework-arduinoststm32", diff --git a/buildroot/tests/Index_Mobo_Rev03 b/buildroot/tests/Index_Mobo_Rev03 deleted file mode 100755 index 501386489df0..000000000000 --- a/buildroot/tests/Index_Mobo_Rev03 +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -# -# Build tests for Index_Mobo_Rev03 -# - -# exit on first failure -set -e - -use_example_configs Index/REV_03 -exec_test $1 $2 "Index REV03 Pick and Place" "$3" - -# cleanup -restore_configs diff --git a/buildroot/tests/Opulo_Lumen_REV3 b/buildroot/tests/Opulo_Lumen_REV3 new file mode 100755 index 000000000000..ddd8e1f3c9aa --- /dev/null +++ b/buildroot/tests/Opulo_Lumen_REV3 @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# +# Build tests for Opulo_Lumen_REV3 +# + +# exit on first failure +set -e + +use_example_configs Opulo/Lumen_REV3 +exec_test $1 $2 "Opulo Lumen REV3 Pick-and-Place" "$3" + +# cleanup +restore_configs diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 8bcbb88d9444..8da73f0f4088 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -94,11 +94,11 @@ build_flags = ${stm32_variant.build_flags} -DUSBD_USE_CDC_COMPOSITE -DUSE_USB_FS # -# STM32F407VET6 Index Mobo Rev 03 +# STM32F407VET6 Opulo Lumen REV3 # -[env:Index_Mobo_Rev03] +[env:Opulo_Lumen_REV3] extends = stm32_variant -board = marlin_index_mobo_rev03 +board = marlin_opulo_lumen_rev3 build_flags = ${stm32_variant.build_flags} -DARDUINO_BLACK_F407VE -DUSBD_USE_CDC_COMPOSITE -DUSE_USB_FS diff --git a/platformio.ini b/platformio.ini index ae50293e3f2b..3820e7019389 100644 --- a/platformio.ini +++ b/platformio.ini @@ -263,12 +263,13 @@ default_src_filter = + - - + # Default values apply to all 'env:' prefixed environments # [env] -framework = arduino -extra_scripts = ${common.extra_scripts} -build_flags = ${common.build_flags} -lib_deps = ${common.lib_deps} -monitor_speed = 250000 -monitor_flags = +framework = arduino +extra_scripts = ${common.extra_scripts} +build_flags = ${common.build_flags} +lib_deps = ${common.lib_deps} +platform_packages = platformio/tool-dfuutil@^1.11.0 +monitor_speed = 250000 +monitor_flags = --quiet --echo --eol From f76025b79c5851bc1f8175ed32186ec012b8062e Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 1 Jul 2022 00:25:21 +0000 Subject: [PATCH 212/241] [cron] Bump distribution date (2022-07-01) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 346e6cd9c888..5a4a9ec5e08f 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-06-30" +//#define STRING_DISTRIBUTION_DATE "2022-07-01" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 27b50136d5e9..2cb9093d7e1c 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-06-30" + #define STRING_DISTRIBUTION_DATE "2022-07-01" #endif /** From 71368b5fa5356fc127998b836328b37f5687dde0 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 30 Jun 2022 20:57:34 -0500 Subject: [PATCH 213/241] =?UTF-8?q?=E2=9C=85=20Update=20path=20to=20Ender-?= =?UTF-8?q?3=20S1=20configs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/bin/use_example_configs | 7 ++++--- buildroot/tests/STM32F103RE_creality | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/buildroot/bin/use_example_configs b/buildroot/bin/use_example_configs index bfd4aa612f0e..cb3c2424d61f 100755 --- a/buildroot/bin/use_example_configs +++ b/buildroot/bin/use_example_configs @@ -13,8 +13,8 @@ CURR=$(git branch 2>/dev/null | grep ^* | sed 's/\* //g') [[ $CURR == "bugfix-2.0.x" ]] && BRANCH=bugfix-2.0.x || BRANCH=bugfix-2.1.x IFS=: read -r PART1 PART2 <<< "$@" -[[ -n $PART2 ]] && { REPO="$PART1" ; RDIR="${PART2// /%20}" ; } \ - || { REPO=$BRANCH ; RDIR="${PART1// /%20}" ; } +[[ -n $PART2 ]] && { REPO="$PART1" ; UDIR="$PART2" ; } \ + || { REPO=$BRANCH ; UDIR="$PART1" ; } EXAMPLES="https://raw.githubusercontent.com/MarlinFirmware/Configurations/$REPO/config/examples" which curl >/dev/null && TOOL='curl -L -s -S -f -o wgot' @@ -24,7 +24,8 @@ restore_configs cd Marlin -echo "Fetching $RDIR configurations from $REPO..." +RDIR="${UDIR// /%20}" +echo "Fetching $UDIR configurations from $REPO..." $TOOL "$EXAMPLES/$RDIR/Configuration.h" >/dev/null 2>&1 && mv wgot Configuration.h $TOOL "$EXAMPLES/$RDIR/Configuration_adv.h" >/dev/null 2>&1 && mv wgot Configuration_adv.h diff --git a/buildroot/tests/STM32F103RE_creality b/buildroot/tests/STM32F103RE_creality index 5e6d5f044ac3..c8d92bc456b2 100755 --- a/buildroot/tests/STM32F103RE_creality +++ b/buildroot/tests/STM32F103RE_creality @@ -18,7 +18,7 @@ opt_disable DWIN_CREALITY_LCD opt_enable DWIN_CREALITY_LCD_JYERSUI AUTO_BED_LEVELING_BILINEAR PROBE_MANUALLY exec_test $1 $2 "Ender 3 v2 with JyersUI" "$3" -use_example_configs "Creality/Ender-3 S1" +use_example_configs "Creality/Ender-3 S1/STM32F4" opt_disable DWIN_CREALITY_LCD Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN AUTO_BED_LEVELING_BILINEAR CONFIGURATION_EMBEDDING CANCEL_OBJECTS FWRETRACT opt_enable DWIN_LCD_PROUI INDIVIDUAL_AXIS_HOMING_SUBMENU LCD_SET_PROGRESS_MANUALLY STATUS_MESSAGE_SCROLLING \ SOUND_MENU_ITEM PRINTCOUNTER NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE FILAMENT_RUNOUT_SENSOR \ From a811005ab2933ae14af314204aab95a8c201edf4 Mon Sep 17 00:00:00 2001 From: tombrazier <68918209+tombrazier@users.noreply.github.com> Date: Fri, 1 Jul 2022 03:07:36 +0100 Subject: [PATCH 214/241] =?UTF-8?q?=F0=9F=9A=B8=20Vertical=20Max7219::quan?= =?UTF-8?q?tity=20in=20portrait=20orientation=20(#24415)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/max7219.cpp | 11 ++++++++++- Marlin/src/feature/max7219.h | 1 - 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Marlin/src/feature/max7219.cpp b/Marlin/src/feature/max7219.cpp index 6a4dbbec73d1..285a86ca63f5 100644 --- a/Marlin/src/feature/max7219.cpp +++ b/Marlin/src/feature/max7219.cpp @@ -52,6 +52,7 @@ #define HAS_SIDE_BY_SIDE 1 #endif +#define _ROT ((MAX7219_ROTATE + 360) % 360) #if _ROT == 0 || _ROT == 180 #define MAX7219_X_LEDS TERN(HAS_SIDE_BY_SIDE, 8, MAX7219_LINES) #define MAX7219_Y_LEDS TERN(HAS_SIDE_BY_SIDE, MAX7219_LINES, 8) @@ -597,7 +598,15 @@ void Max7219::range16(const uint8_t y, const uint8_t ot, const uint8_t nt, const // Apply changes to update a quantity void Max7219::quantity(const uint8_t pos, const uint8_t ov, const uint8_t nv, uint8_t * const rcm/*=nullptr*/) { for (uint8_t i = _MIN(nv, ov); i < _MAX(nv, ov); i++) - led_set(i, pos, nv >= ov, rcm); + led_set( + #if MAX7219_X_LEDS >= MAX7219_Y_LEDS + i, pos // Single matrix or multiple matrices in Landscape + #else + pos, i // Multiple matrices in Portrait + #endif + , nv >= ov + , rcm + ); } void Max7219::quantity16(const uint8_t pos, const uint8_t ov, const uint8_t nv, uint8_t * const rcm/*=nullptr*/) { diff --git a/Marlin/src/feature/max7219.h b/Marlin/src/feature/max7219.h index 3fae275499fd..a6b110fdf4c9 100644 --- a/Marlin/src/feature/max7219.h +++ b/Marlin/src/feature/max7219.h @@ -47,7 +47,6 @@ #ifndef MAX7219_ROTATE #define MAX7219_ROTATE 0 #endif -#define _ROT ((MAX7219_ROTATE + 360) % 360) #ifndef MAX7219_NUMBER_UNITS #define MAX7219_NUMBER_UNITS 1 From c7923c03971e15c67f250d2ada6791a8225350c1 Mon Sep 17 00:00:00 2001 From: Moonglow Date: Fri, 1 Jul 2022 05:51:55 +0300 Subject: [PATCH 215/241] =?UTF-8?q?=F0=9F=90=9B=20Fix=20M149=20(#24430)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/units/M149.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/src/gcode/units/M149.cpp b/Marlin/src/gcode/units/M149.cpp index 3f1ea3654ec4..a04247cbcb17 100644 --- a/Marlin/src/gcode/units/M149.cpp +++ b/Marlin/src/gcode/units/M149.cpp @@ -30,9 +30,9 @@ * M149: Set temperature units */ void GcodeSuite::M149() { - if (parser.seenval('C')) parser.set_input_temp_units(TEMPUNIT_C); - else if (parser.seenval('K')) parser.set_input_temp_units(TEMPUNIT_K); - else if (parser.seenval('F')) parser.set_input_temp_units(TEMPUNIT_F); + if (parser.seen('C')) parser.set_input_temp_units(TEMPUNIT_C); + else if (parser.seen('K')) parser.set_input_temp_units(TEMPUNIT_K); + else if (parser.seen('F')) parser.set_input_temp_units(TEMPUNIT_F); else M149_report(); } From 35dbc286bd7b339f6fbc623536ff981e0507d6c1 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 1 Jul 2022 06:51:57 -0500 Subject: [PATCH 216/241] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20Creality=20test=20?= =?UTF-8?q?followup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/tests/STM32F103RE_creality | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildroot/tests/STM32F103RE_creality b/buildroot/tests/STM32F103RE_creality index c8d92bc456b2..f1478bc2c421 100755 --- a/buildroot/tests/STM32F103RE_creality +++ b/buildroot/tests/STM32F103RE_creality @@ -18,7 +18,7 @@ opt_disable DWIN_CREALITY_LCD opt_enable DWIN_CREALITY_LCD_JYERSUI AUTO_BED_LEVELING_BILINEAR PROBE_MANUALLY exec_test $1 $2 "Ender 3 v2 with JyersUI" "$3" -use_example_configs "Creality/Ender-3 S1/STM32F4" +use_example_configs "Creality/Ender-3 S1/STM32F1" opt_disable DWIN_CREALITY_LCD Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN AUTO_BED_LEVELING_BILINEAR CONFIGURATION_EMBEDDING CANCEL_OBJECTS FWRETRACT opt_enable DWIN_LCD_PROUI INDIVIDUAL_AXIS_HOMING_SUBMENU LCD_SET_PROGRESS_MANUALLY STATUS_MESSAGE_SCROLLING \ SOUND_MENU_ITEM PRINTCOUNTER NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE FILAMENT_RUNOUT_SENSOR \ From cb4a79173be3e8ed1ff45e7c346df1c28e744d5a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 1 Jul 2022 04:49:37 -0500 Subject: [PATCH 217/241] =?UTF-8?q?=F0=9F=A9=B9=20Remove=20poison=20wchar?= =?UTF-8?q?=5Ft=20macro?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/power_monitor.cpp | 6 +- Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp | 10 +- Marlin/src/lcd/HD44780/marlinui_HD44780.cpp | 138 +++++++++--------- Marlin/src/lcd/TFTGLCD/lcdprint_TFTGLCD.cpp | 10 +- Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp | 18 +-- Marlin/src/lcd/dogm/lcdprint_u8g.cpp | 2 +- Marlin/src/lcd/dogm/marlinui_DOGM.cpp | 36 ++--- Marlin/src/lcd/dogm/status_screen_DOGM.cpp | 44 +++--- Marlin/src/lcd/dogm/u8g_fontutf8.cpp | 24 +-- Marlin/src/lcd/dogm/u8g_fontutf8.h | 2 +- Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp | 28 ++-- Marlin/src/lcd/e3v2/marlinui/dwin_string.h | 8 +- .../src/lcd/e3v2/marlinui/lcdprint_dwin.cpp | 6 +- Marlin/src/lcd/e3v2/marlinui/ui_common.cpp | 8 +- Marlin/src/lcd/fontutils.h | 17 +-- Marlin/src/lcd/lcdprint.cpp | 18 +-- Marlin/src/lcd/lcdprint.h | 10 +- Marlin/src/lcd/marlinui.cpp | 12 +- Marlin/src/lcd/menu/menu_bed_corners.cpp | 2 +- Marlin/src/lcd/menu/menu_configuration.cpp | 2 +- Marlin/src/lcd/menu/menu_password.cpp | 6 +- Marlin/src/lcd/menu/menu_tune.cpp | 4 +- Marlin/src/lcd/tft/tft_string.cpp | 16 +- Marlin/src/lcd/tft/tft_string.h | 2 +- Marlin/src/lcd/tft/ui_common.cpp | 2 +- 25 files changed, 214 insertions(+), 217 deletions(-) diff --git a/Marlin/src/feature/power_monitor.cpp b/Marlin/src/feature/power_monitor.cpp index 504f1ea48e3b..5a9db1ec24a1 100644 --- a/Marlin/src/feature/power_monitor.cpp +++ b/Marlin/src/feature/power_monitor.cpp @@ -53,7 +53,7 @@ PowerMonitor power_monitor; // Single instance - this calls the constructor void PowerMonitor::draw_current() { const float amps = getAmps(); lcd_put_u8str(amps < 100 ? ftostr31ns(amps) : ui16tostr4rj((uint16_t)amps)); - lcd_put_wchar('A'); + lcd_put_lchar('A'); } #endif @@ -61,7 +61,7 @@ PowerMonitor power_monitor; // Single instance - this calls the constructor void PowerMonitor::draw_voltage() { const float volts = getVolts(); lcd_put_u8str(volts < 100 ? ftostr31ns(volts) : ui16tostr4rj((uint16_t)volts)); - lcd_put_wchar('V'); + lcd_put_lchar('V'); } #endif @@ -69,7 +69,7 @@ PowerMonitor power_monitor; // Single instance - this calls the constructor void PowerMonitor::draw_power() { const float power = getPower(); lcd_put_u8str(power < 100 ? ftostr31ns(power) : ui16tostr4rj((uint16_t)power)); - lcd_put_wchar('W'); + lcd_put_lchar('W'); } #endif diff --git a/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp b/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp index 1e82fe403d9f..191485c058b7 100644 --- a/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp +++ b/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp @@ -50,7 +50,7 @@ extern LCD_CLASS lcd; int lcd_glyph_height() { return 1; } typedef struct _hd44780_charmap_t { - wchar_t uchar; // the unicode char + lchar_t uchar; // the unicode char uint8_t idx; // the glyph of the char in the ROM uint8_t idx2; // the char used to be combined with the idx to simulate a single char } hd44780_charmap_t; @@ -992,7 +992,7 @@ void lcd_put_int(const int i) { lcd.print(i); } // return < 0 on error // return the advanced cols -int lcd_put_wchar_max(const wchar_t c, const pixel_len_t max_length) { +int lcd_put_lchar_max(const lchar_t &c, const pixel_len_t max_length) { // find the HD44780 internal ROM first int ret; @@ -1051,10 +1051,10 @@ static int lcd_put_u8str_max_cb(const char * utf8_str, read_byte_cb_t cb_read_by pixel_len_t ret = 0; const uint8_t *p = (uint8_t *)utf8_str; while (ret < max_length) { - wchar_t ch = 0; - p = get_utf8_value_cb(p, cb_read_byte, &ch); + lchar_t ch; + p = get_utf8_value_cb(p, cb_read_byte, ch); if (!ch) break; - ret += lcd_put_wchar_max(ch, max_length - ret); + ret += lcd_put_lchar_max(ch, max_length - ret); } return (int)ret; } diff --git a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp index da4db8b2d419..d8306dbf945d 100644 --- a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp +++ b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp @@ -405,7 +405,7 @@ void MarlinUI::clear_lcd() { lcd.clear(); } void lcd_erase_line(const lcd_uint_t line) { lcd_moveto(0, line); for (uint8_t i = LCD_WIDTH + 1; --i;) - lcd_put_wchar(' '); + lcd_put_lchar(' '); } // Scroll the PSTR 'text' in a 'len' wide field for 'time' milliseconds at position col,line @@ -413,7 +413,7 @@ void MarlinUI::clear_lcd() { lcd.clear(); } uint8_t slen = utf8_strlen(ftxt); if (slen < len) { lcd_put_u8str_max(col, line, ftxt, len); - for (; slen < len; ++slen) lcd_put_wchar(' '); + for (; slen < len; ++slen) lcd_put_lchar(' '); safe_delay(time); } else { @@ -425,7 +425,7 @@ void MarlinUI::clear_lcd() { lcd.clear(); } lcd_put_u8str_max_P(col, line, p, len); // Fill with spaces - for (uint8_t ix = slen - i; ix < len; ++ix) lcd_put_wchar(' '); + for (uint8_t ix = slen - i; ix < len; ++ix) lcd_put_lchar(' '); // Delay safe_delay(dly); @@ -439,9 +439,9 @@ void MarlinUI::clear_lcd() { lcd.clear(); } static void logo_lines(FSTR_P const extra) { int16_t indent = (LCD_WIDTH - 8 - utf8_strlen(extra)) / 2; - lcd_put_wchar(indent, 0, '\x00'); lcd_put_u8str(F( "------" )); lcd_put_wchar('\x01'); + lcd_put_lchar(indent, 0, '\x00'); lcd_put_u8str(F( "------" )); lcd_put_lchar('\x01'); lcd_put_u8str(indent, 1, F("|Marlin|")); lcd_put_u8str(extra); - lcd_put_wchar(indent, 2, '\x02'); lcd_put_u8str(F( "------" )); lcd_put_wchar('\x03'); + lcd_put_lchar(indent, 2, '\x02'); lcd_put_u8str(F( "------" )); lcd_put_lchar('\x03'); } void MarlinUI::show_bootscreen() { @@ -510,11 +510,11 @@ void MarlinUI::draw_kill_screen() { // Homed and known, display constantly. // FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink) { - lcd_put_wchar('X' + uint8_t(axis)); + lcd_put_lchar('X' + uint8_t(axis)); if (blink) lcd_put_u8str(value); else if (axis_should_home(axis)) - while (const char c = *value++) lcd_put_wchar(c <= '.' ? c : '?'); + while (const char c = *value++) lcd_put_lchar(c <= '.' ? c : '?'); else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis)) lcd_put_u8str(axis == Z_AXIS ? F(" ") : F(" ")); else @@ -531,27 +531,27 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char pr const celsius_t t1 = thermalManager.wholeDegHotend(heater_id), t2 = thermalManager.degTargetHotend(heater_id); #endif - if (prefix >= 0) lcd_put_wchar(prefix); + if (prefix >= 0) lcd_put_lchar(prefix); lcd_put_u8str(t1 < 0 ? "err" : i16tostr3rj(t1)); - lcd_put_wchar('/'); + lcd_put_lchar('/'); #if !HEATER_IDLE_HANDLER UNUSED(blink); #else if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) { - lcd_put_wchar(' '); - if (t2 >= 10) lcd_put_wchar(' '); - if (t2 >= 100) lcd_put_wchar(' '); + lcd_put_lchar(' '); + if (t2 >= 10) lcd_put_lchar(' '); + if (t2 >= 100) lcd_put_lchar(' '); } else #endif lcd_put_u8str(i16tostr3left(t2)); if (prefix >= 0) { - lcd_put_wchar(LCD_STR_DEGREE[0]); - lcd_put_wchar(' '); - if (t2 < 10) lcd_put_wchar(' '); + lcd_put_lchar(LCD_STR_DEGREE[0]); + lcd_put_lchar(' '); + if (t2 < 10) lcd_put_lchar(' '); } } @@ -559,27 +559,27 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char pr FORCE_INLINE void _draw_cooler_status(const char prefix, const bool blink) { const celsius_t t2 = thermalManager.degTargetCooler(); - if (prefix >= 0) lcd_put_wchar(prefix); + if (prefix >= 0) lcd_put_lchar(prefix); lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegCooler())); - lcd_put_wchar('/'); + lcd_put_lchar('/'); #if !HEATER_IDLE_HANDLER UNUSED(blink); #else if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) { - lcd_put_wchar(' '); - if (t2 >= 10) lcd_put_wchar(' '); - if (t2 >= 100) lcd_put_wchar(' '); + lcd_put_lchar(' '); + if (t2 >= 10) lcd_put_lchar(' '); + if (t2 >= 100) lcd_put_lchar(' '); } else #endif lcd_put_u8str(i16tostr3left(t2)); if (prefix >= 0) { - lcd_put_wchar(LCD_STR_DEGREE[0]); - lcd_put_wchar(' '); - if (t2 < 10) lcd_put_wchar(' '); + lcd_put_lchar(LCD_STR_DEGREE[0]); + lcd_put_lchar(' '); + if (t2 < 10) lcd_put_lchar(' '); } } #endif @@ -588,7 +588,7 @@ FORCE_INLINE void _draw_cooler_status(const char prefix, const bool blink) { FORCE_INLINE void _draw_flowmeter_status() { lcd_put_u8str("~"); lcd_put_u8str(ftostr11ns(cooler.flowrate)); - lcd_put_wchar('L'); + lcd_put_lchar('L'); } #endif @@ -602,7 +602,7 @@ FORCE_INLINE void _draw_cooler_status(const char prefix, const bool blink) { } else { lcd_put_u8str(ftostr12ns(ammeter.current)); - lcd_put_wchar('A'); + lcd_put_lchar('A'); } } #endif @@ -620,7 +620,7 @@ FORCE_INLINE void _draw_bed_status(const bool blink) { lcd_put_u8str(ui8tostr3rj(progress)); else lcd_put_u8str(F("---")); - lcd_put_wchar('%'); + lcd_put_lchar('%'); } #endif @@ -667,7 +667,7 @@ void MarlinUI::draw_status_message(const bool blink) { lcd_put_u8str(ftostr12ns(filwidth.measured_mm)); lcd_put_u8str(F(" V")); lcd_put_u8str(i16tostr3rj(planner.volumetric_percent(parser.volumetric_enabled))); - lcd_put_wchar('%'); + lcd_put_lchar('%'); return; } @@ -686,7 +686,7 @@ void MarlinUI::draw_status_message(const bool blink) { lcd_put_u8str(status_message); // Fill the rest with spaces - while (slen < LCD_WIDTH) { lcd_put_wchar(' '); ++slen; } + while (slen < LCD_WIDTH) { lcd_put_lchar(' '); ++slen; } } else { // String is larger than the available space in screen. @@ -700,11 +700,11 @@ void MarlinUI::draw_status_message(const bool blink) { // If the remaining string doesn't completely fill the screen if (rlen < LCD_WIDTH) { uint8_t chars = LCD_WIDTH - rlen; // Amount of space left in characters - lcd_put_wchar(' '); // Always at 1+ spaces left, draw a space + lcd_put_lchar(' '); // Always at 1+ spaces left, draw a space if (--chars) { // Draw a second space if there's room - lcd_put_wchar(' '); + lcd_put_lchar(' '); if (--chars) { // Draw a third space if there's room - lcd_put_wchar(' '); + lcd_put_lchar(' '); if (--chars) lcd_put_u8str_max(status_message, chars); // Print a second copy of the message } @@ -726,7 +726,7 @@ void MarlinUI::draw_status_message(const bool blink) { // Fill the rest with spaces if there are missing spaces while (slen < LCD_WIDTH) { - lcd_put_wchar(' '); + lcd_put_lchar(' '); ++slen; } #endif @@ -778,7 +778,7 @@ inline uint8_t draw_elapsed_or_remaining_time(uint8_t timepos, const bool blink) duration_t remaining = (progress > 0) ? ((elapsed * 25600 / progress) >> 8) - elapsed : 0; #endif timepos -= remaining.toDigital(buffer); - lcd_put_wchar(timepos, 2, 'R'); + lcd_put_lchar(timepos, 2, 'R'); } #else constexpr bool show_remain = false; @@ -787,7 +787,7 @@ inline uint8_t draw_elapsed_or_remaining_time(uint8_t timepos, const bool blink) if (!show_remain) { duration_t elapsed = print_job_timer.duration(); timepos -= elapsed.toDigital(buffer); - lcd_put_wchar(timepos, 2, LCD_STR_CLOCK[0]); + lcd_put_lchar(timepos, 2, LCD_STR_CLOCK[0]); } lcd_put_u8str(buffer); return timepos; @@ -912,7 +912,7 @@ void MarlinUI::draw_status_screen() { else { const xy_pos_t lpos = current_position.asLogical(); _draw_axis_value(X_AXIS, ftostr4sign(lpos.x), blink); - lcd_put_wchar(' '); + lcd_put_lchar(' '); _draw_axis_value(Y_AXIS, ftostr4sign(lpos.y), blink); } @@ -926,7 +926,7 @@ void MarlinUI::draw_status_screen() { _draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position.z)), blink); #if HAS_LEVELING && !HAS_HEATED_BED - lcd_put_wchar(planner.leveling_active || blink ? '_' : ' '); + lcd_put_lchar(planner.leveling_active || blink ? '_' : ' '); #endif #endif // LCD_HEIGHT > 2 @@ -935,9 +935,9 @@ void MarlinUI::draw_status_screen() { #if LCD_HEIGHT > 3 - lcd_put_wchar(0, 2, LCD_STR_FEEDRATE[0]); + lcd_put_lchar(0, 2, LCD_STR_FEEDRATE[0]); lcd_put_u8str(i16tostr3rj(feedrate_percentage)); - lcd_put_wchar('%'); + lcd_put_lchar('%'); const uint8_t timepos = draw_elapsed_or_remaining_time(LCD_WIDTH - 1, blink); @@ -969,9 +969,9 @@ void MarlinUI::draw_status_screen() { per = planner.flow_percentage[0]; #endif } - lcd_put_wchar(c); + lcd_put_lchar(c); lcd_put_u8str(i16tostr3rj(per)); - lcd_put_wchar('%'); + lcd_put_lchar('%'); #endif #endif @@ -993,7 +993,7 @@ void MarlinUI::draw_status_screen() { _draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position.z)), blink); #if HAS_LEVELING && (HAS_MULTI_HOTEND || !HAS_HEATED_BED) - lcd_put_wchar(LCD_WIDTH - 1, 0, planner.leveling_active || blink ? '_' : ' '); + lcd_put_lchar(LCD_WIDTH - 1, 0, planner.leveling_active || blink ? '_' : ' '); #endif // ========== Line 2 ========== @@ -1008,9 +1008,9 @@ void MarlinUI::draw_status_screen() { _draw_bed_status(blink); #endif - lcd_put_wchar(LCD_WIDTH - 9, 1, LCD_STR_FEEDRATE[0]); + lcd_put_lchar(LCD_WIDTH - 9, 1, LCD_STR_FEEDRATE[0]); lcd_put_u8str(i16tostr3rj(feedrate_percentage)); - lcd_put_wchar('%'); + lcd_put_lchar('%'); // ========== Line 3 ========== @@ -1075,29 +1075,29 @@ void MarlinUI::draw_status_screen() { vlen = vstr ? utf8_strlen(vstr) : 0; if (style & SS_CENTER) { int8_t pad = (LCD_WIDTH - plen - vlen) / 2; - while (--pad >= 0) { lcd_put_wchar(' '); n--; } + while (--pad >= 0) { lcd_put_lchar(' '); n--; } } if (plen) n = lcd_put_u8str(fstr, itemIndex, itemStringC, itemStringF, n); if (vlen) n -= lcd_put_u8str_max(vstr, n); - for (; n > 0; --n) lcd_put_wchar(' '); + for (; n > 0; --n) lcd_put_lchar(' '); } // Draw a generic menu item with pre_char (if selected) and post_char void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char pre_char, const char post_char) { - lcd_put_wchar(0, row, sel ? pre_char : ' '); + lcd_put_lchar(0, row, sel ? pre_char : ' '); uint8_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2); - for (; n; --n) lcd_put_wchar(' '); - lcd_put_wchar(post_char); + for (; n; --n) lcd_put_lchar(' '); + lcd_put_lchar(post_char); } // Draw a menu item with a (potentially) editable value void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char * const inStr, const bool pgm) { const uint8_t vlen = inStr ? (pgm ? utf8_strlen_P(inStr) : utf8_strlen(inStr)) : 0; - lcd_put_wchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' '); + lcd_put_lchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' '); uint8_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2 - vlen); if (vlen) { - lcd_put_wchar(':'); - for (; n; --n) lcd_put_wchar(' '); + lcd_put_lchar(':'); + for (; n; --n) lcd_put_lchar(' '); if (pgm) lcd_put_u8str_P(inStr); else lcd_put_u8str(inStr); } } @@ -1107,10 +1107,10 @@ void MarlinUI::draw_status_screen() { ui.encoder_direction_normal(); uint8_t n = lcd_put_u8str(0, 1, ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 1); if (value) { - lcd_put_wchar(':'); n--; + lcd_put_lchar(':'); n--; const uint8_t len = utf8_strlen(value) + 1; // Plus one for a leading space const lcd_uint_t valrow = n < len ? 2 : 1; // Value on the next row if it won't fit - lcd_put_wchar(LCD_WIDTH - len, valrow, ' '); // Right-justified, padded, leading space + lcd_put_lchar(LCD_WIDTH - len, valrow, ' '); // Right-justified, padded, leading space lcd_put_u8str(value); } } @@ -1120,22 +1120,22 @@ void MarlinUI::draw_status_screen() { ui.draw_select_screen_prompt(pref, string, suff); if (no) { SETCURSOR(0, LCD_HEIGHT - 1); - lcd_put_wchar(yesno ? ' ' : '['); lcd_put_u8str(no); lcd_put_wchar(yesno ? ' ' : ']'); + lcd_put_lchar(yesno ? ' ' : '['); lcd_put_u8str(no); lcd_put_lchar(yesno ? ' ' : ']'); } if (yes) { SETCURSOR_RJ(utf8_strlen(yes) + 2, LCD_HEIGHT - 1); - lcd_put_wchar(yesno ? '[' : ' '); lcd_put_u8str(yes); lcd_put_wchar(yesno ? ']' : ' '); + lcd_put_lchar(yesno ? '[' : ' '); lcd_put_u8str(yes); lcd_put_lchar(yesno ? ']' : ' '); } } #if ENABLED(SDSUPPORT) void MenuItem_sdbase::draw(const bool sel, const uint8_t row, FSTR_P const, CardReader &theCard, const bool isDir) { - lcd_put_wchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' '); + lcd_put_lchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' '); constexpr uint8_t maxlen = LCD_WIDTH - 2; uint8_t n = maxlen - lcd_put_u8str_max(ui.scrolled_filename(theCard, maxlen, row, sel), maxlen); - for (; n; --n) lcd_put_wchar(' '); - lcd_put_wchar(isDir ? LCD_STR_FOLDER[0] : ' '); + for (; n; --n) lcd_put_lchar(' '); + lcd_put_lchar(isDir ? LCD_STR_FOLDER[0] : ' '); } #endif @@ -1253,7 +1253,7 @@ void MarlinUI::draw_status_screen() { void prep_and_put_map_char(custom_char &chrdata, const coordinate &ul, const coordinate &lr, const coordinate &brc, const uint8_t cl, const char c, const lcd_uint_t x, const lcd_uint_t y) { add_edges_to_custom_char(chrdata, ul, lr, brc, cl); lcd.createChar(c, (uint8_t*)&chrdata); - lcd_put_wchar(x, y, c); + lcd_put_lchar(x, y, c); } void MarlinUI::ubl_plot(const uint8_t x_plot, const uint8_t y_plot) { @@ -1270,7 +1270,7 @@ void MarlinUI::draw_status_screen() { #define _LCD_W_POS 8 #define _PLOT_X 0 #define _MAP_X 1 - #define _LABEL(X,Y,C) lcd_put_wchar(X, Y, C) + #define _LABEL(X,Y,C) lcd_put_lchar(X, Y, C) #define _XLABEL(X,Y) _LABEL('X',X,Y) #define _YLABEL(X,Y) _LABEL('Y',X,Y) #define _ZLABEL(X,Y) _LABEL('Z',X,Y) @@ -1333,13 +1333,13 @@ void MarlinUI::draw_status_screen() { n_cols = right_edge / (HD44780_CHAR_WIDTH) + 1; for (i = 0; i < n_cols; i++) { - lcd_put_wchar(i, 0, CHAR_LINE_TOP); // Box Top line - lcd_put_wchar(i, n_rows - 1, CHAR_LINE_BOT); // Box Bottom line + lcd_put_lchar(i, 0, CHAR_LINE_TOP); // Box Top line + lcd_put_lchar(i, n_rows - 1, CHAR_LINE_BOT); // Box Bottom line } for (j = 0; j < n_rows; j++) { - lcd_put_wchar(0, j, CHAR_EDGE_L); // Box Left edge - lcd_put_wchar(n_cols - 1, j, CHAR_EDGE_R); // Box Right edge + lcd_put_lchar(0, j, CHAR_EDGE_L); // Box Left edge + lcd_put_lchar(n_cols - 1, j, CHAR_EDGE_R); // Box Right edge } /** @@ -1349,8 +1349,8 @@ void MarlinUI::draw_status_screen() { k = pixels_per_y_mesh_pnt * (GRID_MAX_POINTS_Y) + 2; l = (HD44780_CHAR_HEIGHT) * n_rows; if (l > k && l - k >= (HD44780_CHAR_HEIGHT) / 2) { - lcd_put_wchar(0, n_rows - 1, ' '); // Box Left edge - lcd_put_wchar(n_cols - 1, n_rows - 1, ' '); // Box Right edge + lcd_put_lchar(0, n_rows - 1, ' '); // Box Left edge + lcd_put_lchar(n_cols - 1, n_rows - 1, ' '); // Box Right edge } clear_custom_char(&new_char); @@ -1464,11 +1464,11 @@ void MarlinUI::draw_status_screen() { /** * Print plot position */ - lcd_put_wchar(_LCD_W_POS, 0, '('); + lcd_put_lchar(_LCD_W_POS, 0, '('); lcd_put_u8str(ui8tostr3rj(x_plot)); - lcd_put_wchar(','); + lcd_put_lchar(','); lcd_put_u8str(ui8tostr3rj(y_plot)); - lcd_put_wchar(')'); + lcd_put_lchar(')'); #if LCD_HEIGHT <= 3 // 16x2 or 20x2 display diff --git a/Marlin/src/lcd/TFTGLCD/lcdprint_TFTGLCD.cpp b/Marlin/src/lcd/TFTGLCD/lcdprint_TFTGLCD.cpp index 7b15b786055c..17f1e702a8ea 100644 --- a/Marlin/src/lcd/TFTGLCD/lcdprint_TFTGLCD.cpp +++ b/Marlin/src/lcd/TFTGLCD/lcdprint_TFTGLCD.cpp @@ -48,7 +48,7 @@ int lcd_glyph_height() { return 1; } typedef struct _TFTGLCD_charmap_t { - wchar_t uchar; // the unicode char + lchar_t uchar; // the unicode char uint8_t idx; // the glyph of the char in the ROM uint8_t idx2; // the char used to be combined with the idx to simulate a single char } TFTGLCD_charmap_t; @@ -991,7 +991,7 @@ void lcd_put_int(const int i) { // return < 0 on error // return the advanced cols -int lcd_put_wchar_max(const wchar_t c, const pixel_len_t max_length) { +int lcd_put_lchar_max(const lchar_t &c, const pixel_len_t max_length) { // find the HD44780 internal ROM first int ret; @@ -1049,10 +1049,10 @@ static int lcd_put_u8str_max_cb(const char * utf8_str, read_byte_cb_t cb_read_by pixel_len_t ret = 0; const uint8_t *p = (uint8_t *)utf8_str; while (ret < max_length) { - wchar_t ch = 0; - p = get_utf8_value_cb(p, cb_read_byte, &ch); + lchar_t ch; + p = get_utf8_value_cb(p, cb_read_byte, ch); if (!ch) break; - ret += lcd_put_wchar_max(ch, max_length - ret); + ret += lcd_put_lchar_max(ch, max_length - ret); } return (int)ret; } diff --git a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp index 46564bb1e6e2..f3d98ec55584 100644 --- a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp +++ b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp @@ -524,16 +524,16 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const UNUSED(blink); #else if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) { - lcd_put_wchar(' '); - if (t2 >= 10) lcd_put_wchar(' '); - if (t2 >= 100) lcd_put_wchar(' '); + lcd_put_lchar(' '); + if (t2 >= 10) lcd_put_lchar(' '); + if (t2 >= 100) lcd_put_lchar(' '); } else #endif lcd_put_u8str(i16tostr3left(t2)); - lcd_put_wchar(' '); - if (t2 < 10) lcd_put_wchar(' '); + lcd_put_lchar(' '); + if (t2 < 10) lcd_put_lchar(' '); if (t2) picBits |= ICON_TEMP1; else picBits &= ~ICON_TEMP1; @@ -545,7 +545,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const FORCE_INLINE void _draw_flowmeter_status() { lcd_moveto(5, 5); lcd_put_u8str(F("FLOW")); - lcd_moveto(7, 6); lcd_put_wchar('L'); + lcd_moveto(7, 6); lcd_put_lchar('L'); lcd_moveto(6, 7); lcd_put_u8str(ftostr11ns(cooler.flowrate)); if (cooler.flowrate) picBits |= ICON_FAN; @@ -564,7 +564,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const { lcd_put_u8str("mA"); lcd_moveto(10, 7); - lcd_put_wchar(' '); lcd_put_u8str(ui16tostr3rj(uint16_t(ammeter.current * 1000 + 0.5f))); + lcd_put_lchar(' '); lcd_put_u8str(ui16tostr3rj(uint16_t(ammeter.current * 1000 + 0.5f))); } else { lcd_put_u8str(" A"); @@ -585,9 +585,9 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const #if CUTTER_UNIT_IS(RPM) lcd_moveto(16, 6); lcd_put_u8str(F("RPM")); lcd_moveto(15, 7); lcd_put_u8str(ftostr31ns(float(cutter.unitPower) / 1000)); - lcd_put_wchar('K'); + lcd_put_lchar('K'); #elif CUTTER_UNIT_IS(PERCENT) - lcd_moveto(17, 6); lcd_put_wchar('%'); + lcd_moveto(17, 6); lcd_put_lchar('%'); lcd_moveto(18, 7); lcd_put_u8str(cutter_power2str(cutter.unitPower)); #else lcd_moveto(17, 7); lcd_put_u8str(cutter_power2str(cutter.unitPower)); diff --git a/Marlin/src/lcd/dogm/lcdprint_u8g.cpp b/Marlin/src/lcd/dogm/lcdprint_u8g.cpp index f5c13798f234..48b2e92a118d 100644 --- a/Marlin/src/lcd/dogm/lcdprint_u8g.cpp +++ b/Marlin/src/lcd/dogm/lcdprint_u8g.cpp @@ -28,7 +28,7 @@ void lcd_put_int(const int i) { u8g.print(i); } // return < 0 on error // return the advanced pixels -int lcd_put_wchar_max(const wchar_t c, const pixel_len_t max_length) { +int lcd_put_lchar_max(const lchar_t &c, const pixel_len_t max_length) { if (c < 256) { u8g.print((char)c); return u8g_GetFontBBXWidth(u8g.getU8g()); diff --git a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp index 3c661a44294a..e32715988d2f 100644 --- a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp +++ b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp @@ -371,11 +371,11 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop if (!PAGE_CONTAINS(y1 + 1, y2 + 2)) return; - lcd_put_wchar(LCD_PIXEL_WIDTH - 11 * (MENU_FONT_WIDTH), y2, 'E'); - lcd_put_wchar((char)('1' + extruder)); - lcd_put_wchar(' '); + lcd_put_lchar(LCD_PIXEL_WIDTH - 11 * (MENU_FONT_WIDTH), y2, 'E'); + lcd_put_lchar((char)('1' + extruder)); + lcd_put_lchar(' '); lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegHotend(extruder))); - lcd_put_wchar('/'); + lcd_put_lchar('/'); if (get_blink() || !thermalManager.heater_idle[extruder].timed_out) lcd_put_u8str(i16tostr3rj(thermalManager.degTargetHotend(extruder))); @@ -421,12 +421,12 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop vlen = vstr ? utf8_strlen(vstr) : 0; if (style & SS_CENTER) { int pad = (LCD_PIXEL_WIDTH - plen - vlen * MENU_FONT_WIDTH) / MENU_FONT_WIDTH / 2; - while (--pad >= 0) n -= lcd_put_wchar(' '); + while (--pad >= 0) n -= lcd_put_lchar(' '); } if (plen) n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, n / (MENU_FONT_WIDTH)) * (MENU_FONT_WIDTH); if (vlen) n -= lcd_put_u8str_max(vstr, n); - while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' '); + while (n > MENU_FONT_WIDTH) n -= lcd_put_lchar(' '); } } @@ -434,9 +434,9 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char, const char post_char) { if (mark_as_selected(row, sel)) { pixel_len_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 1) * (MENU_FONT_WIDTH); - while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' '); - lcd_put_wchar(LCD_PIXEL_WIDTH - (MENU_FONT_WIDTH), row_y2, post_char); - lcd_put_wchar(' '); + while (n > MENU_FONT_WIDTH) n -= lcd_put_lchar(' '); + lcd_put_lchar(LCD_PIXEL_WIDTH - (MENU_FONT_WIDTH), row_y2, post_char); + lcd_put_lchar(' '); } } @@ -449,8 +449,8 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop pixel_len_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2 - vallen * prop) * (MENU_FONT_WIDTH); if (vallen) { - lcd_put_wchar(':'); - while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' '); + lcd_put_lchar(':'); + while (n > MENU_FONT_WIDTH) n -= lcd_put_lchar(' '); lcd_moveto(LCD_PIXEL_WIDTH - _MAX((MENU_FONT_WIDTH) * vallen, pixelwidth + 2), row_y2); if (pgm) lcd_put_u8str_P(inStr); else lcd_put_u8str(inStr); } @@ -494,14 +494,14 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop // If a value is included, print a colon, then print the value right-justified if (value) { - lcd_put_wchar(':'); + lcd_put_lchar(':'); if (extra_row) { // Assume that value is numeric (with no descender) baseline += EDIT_FONT_ASCENT + 2; onpage = PAGE_CONTAINS(baseline - (EDIT_FONT_ASCENT - 1), baseline); } if (onpage) { - lcd_put_wchar(((lcd_chr_fit - 1) - (vallen * prop + 1)) * one_chr_width, baseline, ' '); // Right-justified, padded, add a leading space + lcd_put_lchar(((lcd_chr_fit - 1) - (vallen * prop + 1)) * one_chr_width, baseline, ' '); // Right-justified, padded, add a leading space lcd_put_u8str(value); } } @@ -533,10 +533,10 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop void MenuItem_sdbase::draw(const bool sel, const uint8_t row, FSTR_P const, CardReader &theCard, const bool isDir) { if (mark_as_selected(row, sel)) { const uint8_t maxlen = LCD_WIDTH - isDir; - if (isDir) lcd_put_wchar(LCD_STR_FOLDER[0]); + if (isDir) lcd_put_lchar(LCD_STR_FOLDER[0]); const pixel_len_t pixw = maxlen * (MENU_FONT_WIDTH); pixel_len_t n = pixw - lcd_put_u8str_max(ui.scrolled_filename(theCard, maxlen, row, sel), pixw); - while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' '); + while (n > MENU_FONT_WIDTH) n -= lcd_put_lchar(' '); } } @@ -611,11 +611,11 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop // Print plot position if (PAGE_CONTAINS(LCD_PIXEL_HEIGHT - (INFO_FONT_HEIGHT - 1), LCD_PIXEL_HEIGHT)) { - lcd_put_wchar(5, LCD_PIXEL_HEIGHT, '('); + lcd_put_lchar(5, LCD_PIXEL_HEIGHT, '('); u8g.print(x_plot); - lcd_put_wchar(','); + lcd_put_lchar(','); u8g.print(y_plot); - lcd_put_wchar(')'); + lcd_put_lchar(')'); // Show the location value lcd_put_u8str_P(74, LCD_PIXEL_HEIGHT, Z_LBL); diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp index 010a1397f620..858c6ea781fb 100644 --- a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp @@ -200,7 +200,7 @@ FORCE_INLINE void _draw_centered_temp(const celsius_t temp, const uint8_t tx, co const char *str = i16tostr3rj(temp); const uint8_t len = str[0] != ' ' ? 3 : str[1] != ' ' ? 2 : 1; lcd_put_u8str(tx - len * (INFO_FONT_WIDTH) / 2 + 1, ty, &str[3-len]); - lcd_put_wchar(LCD_STR_DEGREE[0]); + lcd_put_lchar(LCD_STR_DEGREE[0]); } } @@ -432,13 +432,13 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const const bool is_inch = parser.using_inch_units(); const AxisEnum a = TERN(LCD_SHOW_E_TOTAL, axis == E_AXIS ? X_AXIS : axis, axis); const uint8_t offs = a * (is_inch ? XYZ_SPACING_IN : XYZ_SPACING); - lcd_put_wchar((is_inch ? X_LABEL_POS_IN : X_LABEL_POS) + offs, XYZ_BASELINE, AXIS_CHAR(axis)); + lcd_put_lchar((is_inch ? X_LABEL_POS_IN : X_LABEL_POS) + offs, XYZ_BASELINE, AXIS_CHAR(axis)); lcd_moveto((is_inch ? X_VALUE_POS_IN : X_VALUE_POS) + offs, XYZ_BASELINE); if (blink) lcd_put_u8str(value); else if (axis_should_home(axis)) - while (const char c = *value++) lcd_put_wchar(c <= '.' ? c : '?'); + while (const char c = *value++) lcd_put_lchar(c <= '.' ? c : '?'); else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis)) lcd_put_u8str(axis == Z_AXIS ? F(" ") : F(" ")); else @@ -675,7 +675,7 @@ void MarlinUI::draw_status_screen() { lcd_put_u8str(STATUS_CUTTER_TEXT_X, STATUS_CUTTER_TEXT_Y, cutter_power2str(cutter.unitPower)); #elif CUTTER_UNIT_IS(RPM) lcd_put_u8str(STATUS_CUTTER_TEXT_X - 2, STATUS_CUTTER_TEXT_Y, ftostr61rj(float(cutter.unitPower) / 1000)); - lcd_put_wchar('K'); + lcd_put_lchar('K'); #else lcd_put_u8str(STATUS_CUTTER_TEXT_X, STATUS_CUTTER_TEXT_Y, cutter_power2str(cutter.unitPower)); #endif @@ -734,7 +734,7 @@ void MarlinUI::draw_status_screen() { } #endif lcd_put_u8str(STATUS_FAN_TEXT_X, STATUS_FAN_TEXT_Y, i16tostr3rj(thermalManager.pwmToPercent(spd))); - lcd_put_wchar(c); + lcd_put_lchar(c); } } #endif @@ -783,7 +783,7 @@ void MarlinUI::draw_status_screen() { if (progress_state == 0) { if (progress_string[0]) { lcd_put_u8str(progress_x_pos, EXTRAS_BASELINE, progress_string); - lcd_put_wchar('%'); + lcd_put_lchar('%'); } } else if (progress_state == 2 && estimation_string[0]) { @@ -804,7 +804,7 @@ void MarlinUI::draw_status_screen() { #if ENABLED(SHOW_SD_PERCENT) if (progress_string[0]) { lcd_put_u8str(55, EXTRAS_BASELINE, progress_string); // Percent complete - lcd_put_wchar('%'); + lcd_put_lchar('%'); } #endif @@ -814,7 +814,7 @@ void MarlinUI::draw_status_screen() { #if ENABLED(SHOW_REMAINING_TIME) if (blink && estimation_string[0]) { - lcd_put_wchar(estimation_x_pos, EXTRAS_BASELINE, 'R'); + lcd_put_lchar(estimation_x_pos, EXTRAS_BASELINE, 'R'); lcd_put_u8str(estimation_string); } else @@ -912,11 +912,11 @@ void MarlinUI::draw_status_screen() { if (PAGE_CONTAINS(EXTRAS_2_BASELINE - INFO_FONT_ASCENT, EXTRAS_2_BASELINE - 1)) { set_font(FONT_MENU); - lcd_put_wchar(3, EXTRAS_2_BASELINE, LCD_STR_FEEDRATE[0]); + lcd_put_lchar(3, EXTRAS_2_BASELINE, LCD_STR_FEEDRATE[0]); set_font(FONT_STATUSMENU); lcd_put_u8str(12, EXTRAS_2_BASELINE, i16tostr3rj(feedrate_percentage)); - lcd_put_wchar('%'); + lcd_put_lchar('%'); // // Filament sensor display if SD is disabled @@ -924,10 +924,10 @@ void MarlinUI::draw_status_screen() { #if ENABLED(FILAMENT_LCD_DISPLAY) && DISABLED(SDSUPPORT) lcd_put_u8str(56, EXTRAS_2_BASELINE, wstring); lcd_put_u8str(102, EXTRAS_2_BASELINE, mstring); - lcd_put_wchar('%'); + lcd_put_lchar('%'); set_font(FONT_MENU); - lcd_put_wchar(47, EXTRAS_2_BASELINE, LCD_STR_FILAM_DIA[0]); // lcd_put_u8str(F(LCD_STR_FILAM_DIA)); - lcd_put_wchar(93, EXTRAS_2_BASELINE, LCD_STR_FILAM_MUL[0]); + lcd_put_lchar(47, EXTRAS_2_BASELINE, LCD_STR_FILAM_DIA[0]); // lcd_put_u8str(F(LCD_STR_FILAM_DIA)); + lcd_put_lchar(93, EXTRAS_2_BASELINE, LCD_STR_FILAM_MUL[0]); #endif } @@ -941,12 +941,12 @@ void MarlinUI::draw_status_screen() { // Alternate Status message and Filament display if (ELAPSED(millis(), next_filament_display)) { lcd_put_u8str(F(LCD_STR_FILAM_DIA)); - lcd_put_wchar(':'); + lcd_put_lchar(':'); lcd_put_u8str(wstring); lcd_put_u8str(F(" " LCD_STR_FILAM_MUL)); - lcd_put_wchar(':'); + lcd_put_lchar(':'); lcd_put_u8str(mstring); - lcd_put_wchar('%'); + lcd_put_lchar('%'); return; } #endif @@ -979,7 +979,7 @@ void MarlinUI::draw_status_message(const bool blink) { if (slen <= lcd_width) { // The string fits within the line. Print with no scrolling lcd_put_u8str(status_message); - while (slen < lcd_width) { lcd_put_wchar(' '); ++slen; } + while (slen < lcd_width) { lcd_put_lchar(' '); ++slen; } } else { // String is longer than the available space @@ -997,14 +997,14 @@ void MarlinUI::draw_status_message(const bool blink) { // If the remaining string doesn't completely fill the screen if (rlen < lcd_width) { uint8_t chars = lcd_width - rlen; // Amount of space left in characters - lcd_put_wchar(' '); // Always at 1+ spaces left, draw a space + lcd_put_lchar(' '); // Always at 1+ spaces left, draw a space if (--chars) { // Draw a second space if there's room - lcd_put_wchar(' '); + lcd_put_lchar(' '); if (--chars) { // Draw a third space if there's room - lcd_put_wchar(' '); + lcd_put_lchar(' '); if (--chars) { // Print a second copy of the message lcd_put_u8str_max(status_message, pixel_width - (rlen + 2) * (MENU_FONT_WIDTH)); - lcd_put_wchar(' '); + lcd_put_lchar(' '); } } } @@ -1019,7 +1019,7 @@ void MarlinUI::draw_status_message(const bool blink) { lcd_put_u8str_max(status_message, pixel_width); // Fill the rest with spaces - for (; slen < lcd_width; ++slen) lcd_put_wchar(' '); + for (; slen < lcd_width; ++slen) lcd_put_lchar(' '); #endif // !STATUS_MESSAGE_SCROLLING diff --git a/Marlin/src/lcd/dogm/u8g_fontutf8.cpp b/Marlin/src/lcd/dogm/u8g_fontutf8.cpp index 8ba0e7d50a8b..b92210d9a73a 100644 --- a/Marlin/src/lcd/dogm/u8g_fontutf8.cpp +++ b/Marlin/src/lcd/dogm/u8g_fontutf8.cpp @@ -60,11 +60,11 @@ static int fontgroup_init(font_group_t * root, const uxg_fontinfo_t * fntinfo, i return 0; } -static const font_t* fontgroup_find(font_group_t * root, wchar_t val) { - uxg_fontinfo_t vcmp = {(uint16_t)(val / 128), (uint8_t)(val % 128 + 128), (uint8_t)(val % 128 + 128), 0, 0}; - size_t idx = 0; +static const font_t* fontgroup_find(font_group_t * root, const lchar_t &val) { + if (val <= 0xFF) return nullptr; - if (val < 256) return nullptr; + uxg_fontinfo_t vcmp = { uint16_t(val >> 7), uint8_t((val & 0x7F) + 0x80), uint8_t((val & 0x7F) + 0x80), 0, 0 }; + size_t idx = 0; if (pf_bsearch_r((void*)root->m_fntifo, root->m_fntinfo_num, pf_bsearch_cb_comp_fntifo_pgm, (void*)&vcmp, &idx) < 0) return nullptr; @@ -73,7 +73,7 @@ static const font_t* fontgroup_find(font_group_t * root, wchar_t val) { return vcmp.fntdata; } -static void fontgroup_drawwchar(font_group_t *group, const font_t *fnt_default, wchar_t val, void * userdata, fontgroup_cb_draw_t cb_draw_ram) { +static void fontgroup_drawwchar(font_group_t *group, const font_t *fnt_default, const lchar_t &val, void * userdata, fontgroup_cb_draw_t cb_draw_ram) { uint8_t buf[2] = {0, 0}; const font_t * fntpqm = (font_t*)fontgroup_find(group, val); if (!fntpqm) { @@ -106,10 +106,10 @@ static void fontgroup_drawwchar(font_group_t *group, const font_t *fnt_default, static void fontgroup_drawstring(font_group_t *group, const font_t *fnt_default, const char *utf8_msg, read_byte_cb_t cb_read_byte, void * userdata, fontgroup_cb_draw_t cb_draw_ram) { const uint8_t *p = (uint8_t*)utf8_msg; for (;;) { - wchar_t val = 0; - p = get_utf8_value_cb(p, cb_read_byte, &val); - if (!val) break; - fontgroup_drawwchar(group, fnt_default, val, userdata, cb_draw_ram); + lchar_t ch; + p = get_utf8_value_cb(p, cb_read_byte, ch); + if (!ch) break; + fontgroup_drawwchar(group, fnt_default, ch, userdata, cb_draw_ram); } } @@ -149,19 +149,19 @@ static int fontgroup_cb_draw_u8g(void *userdata, const font_t *fnt_current, cons } /** - * @brief Draw a wchar_t at the specified position + * @brief Draw a lchar_t at the specified position * * @param pu8g : U8G pointer * @param x : position x axis * @param y : position y axis - * @param ch : the wchar_t + * @param ch : the lchar_t * @param max_width : the pixel width of the string allowed * * @return number of pixels advanced * * Draw a UTF-8 string at the specified position */ -unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, wchar_t ch, pixel_len_t max_width) { +unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, const lchar_t &ch, pixel_len_t max_width) { struct _uxg_drawu8_data_t data; font_group_t *group = &g_fontgroup_root; const font_t *fnt_default = uxg_GetFont(pu8g); diff --git a/Marlin/src/lcd/dogm/u8g_fontutf8.h b/Marlin/src/lcd/dogm/u8g_fontutf8.h index 5933f027cc79..0109b6674cbe 100644 --- a/Marlin/src/lcd/dogm/u8g_fontutf8.h +++ b/Marlin/src/lcd/dogm/u8g_fontutf8.h @@ -26,7 +26,7 @@ typedef struct _uxg_fontinfo_t { int uxg_SetUtf8Fonts(const uxg_fontinfo_t * fntinfo, int number); // fntinfo is type of PROGMEM -unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, wchar_t ch, const pixel_len_t max_length); +unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, const lchar_t &ch, const pixel_len_t max_length); unsigned int uxg_DrawUtf8Str(u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, const pixel_len_t max_length); unsigned int uxg_DrawUtf8StrP(u8g_t *pu8g, unsigned int x, unsigned int y, PGM_P utf8_msg, const pixel_len_t max_length); diff --git a/Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp b/Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp index 30e86270c726..246f7ebb39c4 100644 --- a/Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp @@ -50,12 +50,12 @@ uint8_t read_byte(const uint8_t *byte) { return *byte; } * @ displays an axis name such as XYZUVW, or E for an extruder */ void DWIN_String::add(const char *tpl, const int8_t index, const char *cstr/*=nullptr*/, FSTR_P const fstr/*=nullptr*/) { - wchar_t wchar; + lchar_t ch; while (*tpl) { - tpl = get_utf8_value_cb(tpl, read_byte, &wchar); - if (wchar > 255) wchar |= 0x0080; - const uint8_t ch = uint8_t(wchar & 0x00FF); + tpl = get_utf8_value_cb(tpl, read_byte, ch); + if (ch > 255) ch |= 0x0080; + const uint8_t ch = uint8_t(ch & 0x00FF); if (ch == '=' || ch == '~' || ch == '*') { if (index >= 0) { @@ -80,32 +80,32 @@ void DWIN_String::add(const char *tpl, const int8_t index, const char *cstr/*=nu } void DWIN_String::add(const char *cstr, uint8_t max_len/*=MAX_STRING_LENGTH*/) { - wchar_t wchar; + lchar_t ch; while (*cstr && max_len) { - cstr = get_utf8_value_cb(cstr, read_byte, &wchar); + cstr = get_utf8_value_cb(cstr, read_byte, ch); /* - if (wchar > 255) wchar |= 0x0080; - uint8_t ch = uint8_t(wchar & 0x00FF); + if (ch > 255) ch |= 0x0080; + uint8_t ch = uint8_t(ch & 0x00FF); add_character(ch); */ - add(wchar); + add(ch); max_len--; } eol(); } -void DWIN_String::add(const wchar_t character) { +void DWIN_String::add(const lchar_t &ch) { int ret; size_t idx = 0; dwin_charmap_t pinval; dwin_charmap_t *copy_address = nullptr; - pinval.uchar = character; + pinval.uchar = ch; pinval.idx = -1; - // For 8-bit ASCII just print the single character + // For 8-bit ASCII just print the single ch char str[] = { '?', 0 }; - if (character < 255) { - str[0] = (char)character; + if (ch < 255) { + str[0] = (char)ch; } else { copy_address = nullptr; diff --git a/Marlin/src/lcd/e3v2/marlinui/dwin_string.h b/Marlin/src/lcd/e3v2/marlinui/dwin_string.h index c29777ae7b12..c7218817aac9 100644 --- a/Marlin/src/lcd/e3v2/marlinui/dwin_string.h +++ b/Marlin/src/lcd/e3v2/marlinui/dwin_string.h @@ -29,7 +29,7 @@ #include typedef struct _dwin_charmap_t { - wchar_t uchar; // the unicode char + lchar_t uchar; // the unicode char uint8_t idx; // the glyph of the char in the ROM uint8_t idx2; // the char used to be combined with the idx to simulate a single char } dwin_charmap_t; @@ -69,10 +69,10 @@ class DWIN_String { /** * @brief Append a UTF-8 character * - * @param character The UTF-8 character + * @param ch The UTF-8 character */ - static void add(wchar_t character); - static void set(wchar_t character) { set(); add(character); } + static void add(const lchar_t &ch); + static void set(const lchar_t &ch) { set(); add(ch); } /** * @brief Append / Set C-string diff --git a/Marlin/src/lcd/e3v2/marlinui/lcdprint_dwin.cpp b/Marlin/src/lcd/e3v2/marlinui/lcdprint_dwin.cpp index 278f17fac994..f6035370ad55 100644 --- a/Marlin/src/lcd/e3v2/marlinui/lcdprint_dwin.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/lcdprint_dwin.cpp @@ -63,7 +63,7 @@ int lcd_put_dwin_string() { // return < 0 on error // return the advanced cols -int lcd_put_wchar_max(const wchar_t c, const pixel_len_t max_length) { +int lcd_put_lchar_max(const lchar_t &c, const pixel_len_t max_length) { dwin_string.set(c); dwin_string.truncate(max_length); // Draw the char(s) at the cursor and advance the cursor @@ -87,8 +87,8 @@ static int lcd_put_u8str_max_cb(const char * utf8_str, read_byte_cb_t cb_read_by const uint8_t *p = (uint8_t *)utf8_str; dwin_string.set(); while (dwin_string.length < max_length) { - wchar_t ch = 0; - p = get_utf8_value_cb(p, cb_read_byte, &ch); + lchar_t ch; + p = get_utf8_value_cb(p, cb_read_byte, ch); if (!ch) break; dwin_string.add(ch); } diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp index 0727ab0b70ca..455fce272a1c 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp @@ -213,7 +213,7 @@ void MarlinUI::draw_status_message(const bool blink) { lcd_put_u8str(status_message); // Fill the rest with spaces - while (slen < max_status_chars) { lcd_put_wchar(' '); ++slen; } + while (slen < max_status_chars) { lcd_put_lchar(' '); ++slen; } } } else { @@ -227,10 +227,10 @@ void MarlinUI::draw_status_message(const bool blink) { // If the string doesn't completely fill the line... if (rlen < max_status_chars) { - lcd_put_wchar('.'); // Always at 1+ spaces left, draw a dot + lcd_put_lchar('.'); // Always at 1+ spaces left, draw a dot uint8_t chars = max_status_chars - rlen; // Amount of space left in characters if (--chars) { // Draw a second dot if there's space - lcd_put_wchar('.'); + lcd_put_lchar('.'); if (--chars) lcd_put_u8str_max(status_message, chars); // Print a second copy of the message } @@ -254,7 +254,7 @@ void MarlinUI::draw_status_message(const bool blink) { lcd_put_u8str_max(status_message, max_status_chars); // Fill the rest with spaces if there are missing spaces - while (slen < max_status_chars) { lcd_put_wchar(' '); ++slen; } + while (slen < max_status_chars) { lcd_put_lchar(' '); ++slen; } } #endif diff --git a/Marlin/src/lcd/fontutils.h b/Marlin/src/lcd/fontutils.h index e01962d7ad80..453db2a36c9d 100644 --- a/Marlin/src/lcd/fontutils.h +++ b/Marlin/src/lcd/fontutils.h @@ -31,36 +31,33 @@ #pragma once #include -#include // wchar_t #include // uint32_t #include "../HAL/shared/Marduino.h" #include "../core/macros.h" +#define MAX_UTF8_CHAR_SIZE 4 + // read a byte from ROM or RAM typedef uint8_t (*read_byte_cb_t)(const uint8_t * str); uint8_t read_byte_ram(const uint8_t *str); uint8_t read_byte_rom(const uint8_t *str); -// there's overflow of the wchar_t due to the 2-byte size in Arduino -// sizeof(wchar_t)=2; sizeof(size_t)=2; sizeof(uint32_t)=4; -// sizeof(int)=2; sizeof(long)=4; sizeof(unsigned)=2; -//#undef wchar_t -#define wchar_t uint32_t -//typedef uint32_t wchar_t; +// An extra long character type because wchar_t is only 2 bytes +typedef uint32_t lchar_t; typedef uint16_t pixel_len_t; #define PIXEL_LEN_NOLIMIT ((pixel_len_t)(-1)) /* Perform binary search */ -typedef int (* pf_bsearch_cb_comp_t)(void *userdata, size_t idx, void * data_pin); /*"data_list[idx] - *data_pin"*/ +typedef int (* pf_bsearch_cb_comp_t)(void *userdata, size_t idx, void * data_pin); int pf_bsearch_r(void *userdata, size_t num_data, pf_bsearch_cb_comp_t cb_comp, void *data_pinpoint, size_t *ret_idx); /* Get the character, decoding multibyte UTF8 characters and returning a pointer to the start of the next UTF8 character */ -const uint8_t* get_utf8_value_cb(const uint8_t *pstart, read_byte_cb_t cb_read_byte, wchar_t *pval); +const uint8_t* get_utf8_value_cb(const uint8_t *pstart, read_byte_cb_t cb_read_byte, lchar_t &pval); -inline const char* get_utf8_value_cb(const char *pstart, read_byte_cb_t cb_read_byte, wchar_t *pval) { +inline const char* get_utf8_value_cb(const char *pstart, read_byte_cb_t cb_read_byte, lchar_t &pval) { return (const char *)get_utf8_value_cb((const uint8_t *)pstart, cb_read_byte, pval); } diff --git a/Marlin/src/lcd/lcdprint.cpp b/Marlin/src/lcd/lcdprint.cpp index deec2b1778b8..c3b18ef78bbc 100644 --- a/Marlin/src/lcd/lcdprint.cpp +++ b/Marlin/src/lcd/lcdprint.cpp @@ -47,19 +47,19 @@ lcd_uint_t lcd_put_u8str_P(PGM_P const ptpl, const int8_t ind, const char *cstr/ const uint8_t *p = (uint8_t*)ptpl; int8_t n = maxlen; while (n > 0) { - wchar_t ch; - p = get_utf8_value_cb(p, read_byte_rom, &ch); + lchar_t ch; + p = get_utf8_value_cb(p, read_byte_rom, ch); if (!ch) break; if (ch == '=' || ch == '~' || ch == '*') { if (ind >= 0) { - if (ch == '*') { lcd_put_wchar('E'); n--; } + if (ch == '*') { lcd_put_lchar('E'); n--; } if (n) { int8_t inum = ind + ((ch == '=') ? 0 : LCD_FIRST_TOOL); if (inum >= 10) { - lcd_put_wchar('0' + (inum / 10)); n--; + lcd_put_lchar('0' + (inum / 10)); n--; inum %= 10; } - if (n) { lcd_put_wchar('0' + inum); n--; } + if (n) { lcd_put_lchar('0' + inum); n--; } } } else { @@ -78,11 +78,11 @@ lcd_uint_t lcd_put_u8str_P(PGM_P const ptpl, const int8_t ind, const char *cstr/ n -= lcd_put_u8str_max(cstr, n * (MENU_FONT_WIDTH)) / (MENU_FONT_WIDTH); } else if (ch == '@') { - lcd_put_wchar(AXIS_CHAR(ind)); + lcd_put_lchar(AXIS_CHAR(ind)); n--; } else { - lcd_put_wchar(ch); + lcd_put_lchar(ch); n -= ch > 255 ? prop : 1; } } @@ -97,8 +97,8 @@ int calculateWidth(PGM_P const pstr) { int n = 0; do { - wchar_t ch; - p = get_utf8_value_cb(p, read_byte_rom, &ch); + lchar_t ch; + p = get_utf8_value_cb(p, read_byte_rom, ch); if (!ch) break; n += (ch > 255) ? prop : 1; } while (1); diff --git a/Marlin/src/lcd/lcdprint.h b/Marlin/src/lcd/lcdprint.h index 2eb47c534b05..bcf85cb69396 100644 --- a/Marlin/src/lcd/lcdprint.h +++ b/Marlin/src/lcd/lcdprint.h @@ -138,7 +138,7 @@ int lcd_glyph_height(); * * @return the output width (in pixels on GLCD) */ -int lcd_put_wchar_max(const wchar_t c, const pixel_len_t max_length); +int lcd_put_lchar_max(const lchar_t &c, const pixel_len_t max_length); /** * @brief Draw a SRAM UTF-8 string @@ -267,17 +267,17 @@ inline int lcd_put_u8str(const lcd_uint_t col, const lcd_uint_t row, const char /** * @brief Draw a UTF-8 character with no width limit * - * @param c The wchar to draw + * @param c The lchar to draw * @return the output width (in pixels on GLCD) */ -inline int lcd_put_wchar(const wchar_t c) { return lcd_put_wchar_max(c, PIXEL_LEN_NOLIMIT); } +inline int lcd_put_lchar(const lchar_t &c) { return lcd_put_lchar_max(c, PIXEL_LEN_NOLIMIT); } /** * @param col * @param row */ -inline int lcd_put_wchar(const lcd_uint_t col, const lcd_uint_t row, const wchar_t c) { +inline int lcd_put_lchar(const lcd_uint_t col, const lcd_uint_t row, const lchar_t &c) { lcd_moveto(col, row); - return lcd_put_wchar(c); + return lcd_put_lchar(c); } /** diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index c1b600593457..4d80ca140548 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -417,14 +417,14 @@ void MarlinUI::init() { }; const uint8_t *p = (uint8_t*)string; - wchar_t ch; + lchar_t ch; if (wordwrap) { const uint8_t *wrd = nullptr; uint8_t c = 0; // find the end of the part for (;;) { if (!wrd) wrd = p; // Get word start /before/ advancing - p = get_utf8_value_cb(p, cb_read_byte, &ch); + p = get_utf8_value_cb(p, cb_read_byte, ch); const bool eol = !ch; // zero ends the string // End or a break between phrases? if (eol || ch == ' ' || ch == '-' || ch == '+' || ch == '.') { @@ -435,8 +435,8 @@ void MarlinUI::init() { col += c; // advance col to new position while (c) { // character countdown --c; // count down to zero - wrd = get_utf8_value_cb(wrd, cb_read_byte, &ch); // get characters again - lcd_put_wchar(ch); // character to the LCD + wrd = get_utf8_value_cb(wrd, cb_read_byte, ch); // get characters again + lcd_put_lchar(ch); // character to the LCD } if (eol) break; // all done! wrd = nullptr; // set up for next word @@ -446,9 +446,9 @@ void MarlinUI::init() { } else { for (;;) { - p = get_utf8_value_cb(p, cb_read_byte, &ch); + p = get_utf8_value_cb(p, cb_read_byte, ch); if (!ch) break; - lcd_put_wchar(ch); + lcd_put_lchar(ch); col++; if (col >= LCD_WIDTH) _newline(); } diff --git a/Marlin/src/lcd/menu/menu_bed_corners.cpp b/Marlin/src/lcd/menu/menu_bed_corners.cpp index 3fe0c582cb10..c4a63dafc6ac 100644 --- a/Marlin/src/lcd/menu/menu_bed_corners.cpp +++ b/Marlin/src/lcd/menu/menu_bed_corners.cpp @@ -178,7 +178,7 @@ static void _lcd_level_bed_corners_get_next_position() { lcd_put_u8str(GET_TEXT_F(MSG_BED_TRAMMING_GOOD_POINTS)); IF_ENABLED(TFT_COLOR_UI, lcd_moveto(12, cy)); lcd_put_u8str(GOOD_POINTS_TO_STR(good_points)); - lcd_put_wchar('/'); + lcd_put_lchar('/'); lcd_put_u8str(GOOD_POINTS_TO_STR(nr_edge_points)); } diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp index 8b6af33fd11e..1f2257a77fe3 100644 --- a/Marlin/src/lcd/menu/menu_configuration.cpp +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -79,7 +79,7 @@ void menu_advanced_settings(); LIMIT(bar_percent, 0, 100); ui.encoderPosition = 0; MenuItem_static::draw(0, GET_TEXT_F(MSG_PROGRESS_BAR_TEST), SS_DEFAULT|SS_INVERT); - lcd_put_int((LCD_WIDTH) / 2 - 2, LCD_HEIGHT - 2, bar_percent); lcd_put_wchar('%'); + lcd_put_int((LCD_WIDTH) / 2 - 2, LCD_HEIGHT - 2, bar_percent); lcd_put_lchar('%'); lcd_moveto(0, LCD_HEIGHT - 1); ui.draw_progress_bar(bar_percent); } diff --git a/Marlin/src/lcd/menu/menu_password.cpp b/Marlin/src/lcd/menu/menu_password.cpp index 89ea42d70477..d29b77311fd3 100644 --- a/Marlin/src/lcd/menu/menu_password.cpp +++ b/Marlin/src/lcd/menu/menu_password.cpp @@ -61,10 +61,10 @@ void Password::menu_password_entry() { FSTR_P const label = GET_TEXT_F(MSG_ENTER_DIGIT); EDIT_ITEM_F(uint8, label, &editable.uint8, 0, 9, digit_entered); MENU_ITEM_ADDON_START(utf8_strlen(label) + 1); - lcd_put_wchar(' '); - lcd_put_wchar('1' + digit_no); + lcd_put_lchar(' '); + lcd_put_lchar('1' + digit_no); SETCURSOR_X(LCD_WIDTH - 2); - lcd_put_wchar('>'); + lcd_put_lchar('>'); MENU_ITEM_ADDON_END(); ACTION_ITEM(MSG_START_OVER, start_over); diff --git a/Marlin/src/lcd/menu/menu_tune.cpp b/Marlin/src/lcd/menu/menu_tune.cpp index b13c55f80a3b..bc5200196717 100644 --- a/Marlin/src/lcd/menu/menu_tune.cpp +++ b/Marlin/src/lcd/menu/menu_tune.cpp @@ -76,12 +76,12 @@ #if ENABLED(TFT_COLOR_UI) lcd_moveto(4, 3); lcd_put_u8str(GET_TEXT_F(MSG_BABYSTEP_TOTAL)); - lcd_put_wchar(':'); + lcd_put_lchar(':'); lcd_moveto(10, 3); #else lcd_moveto(0, TERN(HAS_MARLINUI_U8GLIB, LCD_PIXEL_HEIGHT - MENU_FONT_DESCENT, LCD_HEIGHT - 1)); lcd_put_u8str(GET_TEXT_F(MSG_BABYSTEP_TOTAL)); - lcd_put_wchar(':'); + lcd_put_lchar(':'); #endif lcd_put_u8str(BABYSTEP_TO_STR(mps * babystep.axis_total[BS_TOTAL_IND(axis)])); } diff --git a/Marlin/src/lcd/tft/tft_string.cpp b/Marlin/src/lcd/tft/tft_string.cpp index d8c419d1a078..15bcf9f47b71 100644 --- a/Marlin/src/lcd/tft/tft_string.cpp +++ b/Marlin/src/lcd/tft/tft_string.cpp @@ -94,12 +94,12 @@ void TFT_String::set() { * @ displays an axis name such as XYZUVW, or E for an extruder */ void TFT_String::add(const char *tpl, const int8_t index, const char *cstr/*=nullptr*/, FSTR_P const fstr/*=nullptr*/) { - wchar_t wchar; + lchar_t ch; while (*tpl) { - tpl = get_utf8_value_cb(tpl, read_byte_ram, &wchar); - if (wchar > 255) wchar |= 0x0080; - const uint8_t ch = uint8_t(wchar & 0x00FF); + tpl = get_utf8_value_cb(tpl, read_byte_ram, ch); + if (ch > 255) ch |= 0x0080; + const uint8_t ch = uint8_t(ch & 0x00FF); if (ch == '=' || ch == '~' || ch == '*') { if (index >= 0) { @@ -124,11 +124,11 @@ void TFT_String::add(const char *tpl, const int8_t index, const char *cstr/*=nul } void TFT_String::add(const char *cstr, uint8_t max_len/*=MAX_STRING_LENGTH*/) { - wchar_t wchar; + lchar_t ch; while (*cstr && max_len) { - cstr = get_utf8_value_cb(cstr, read_byte_ram, &wchar); - if (wchar > 255) wchar |= 0x0080; - const uint8_t ch = uint8_t(wchar & 0x00FF); + cstr = get_utf8_value_cb(cstr, read_byte_ram, ch); + if (ch > 255) ch |= 0x0080; + const uint8_t ch = uint8_t(ch & 0x00FF); add_character(ch); max_len--; } diff --git a/Marlin/src/lcd/tft/tft_string.h b/Marlin/src/lcd/tft/tft_string.h index 5940a48ac98b..5a7f774cf473 100644 --- a/Marlin/src/lcd/tft/tft_string.h +++ b/Marlin/src/lcd/tft/tft_string.h @@ -97,7 +97,7 @@ class TFT_String { * @param character The ASCII character */ static void add(const char character) { add_character(character); eol(); } - static void set(wchar_t character) { set(); add(character); } + static void set(const lchar_t &character) { set(); add(character); } /** * @brief Append / Set C-string diff --git a/Marlin/src/lcd/tft/ui_common.cpp b/Marlin/src/lcd/tft/ui_common.cpp index c9e069dbbd6f..bb0578576632 100644 --- a/Marlin/src/lcd/tft/ui_common.cpp +++ b/Marlin/src/lcd/tft/ui_common.cpp @@ -96,7 +96,7 @@ void lcd_moveto(const lcd_uint_t col, const lcd_uint_t row) { lcd_gotopixel(int(col) * (TFT_COL_WIDTH), int(row) * MENU_LINE_HEIGHT); } -int lcd_put_wchar_max(const wchar_t c, const pixel_len_t max_length) { +int lcd_put_lchar_max(const lchar_t &c, const pixel_len_t max_length) { if (max_length < 1) return 0; tft_string.set(c); tft.add_text(MENU_TEXT_X_OFFSET, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); From b1bb307dabc5bbdcc541ec071ec2ce7ab57b4f5a Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 2 Jul 2022 00:24:49 +0000 Subject: [PATCH 218/241] [cron] Bump distribution date (2022-07-02) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 5a4a9ec5e08f..8630a92889f8 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-07-01" +//#define STRING_DISTRIBUTION_DATE "2022-07-02" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 2cb9093d7e1c..85544943c67c 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-07-01" + #define STRING_DISTRIBUTION_DATE "2022-07-02" #endif /** From 9c376f120c36687e4bd225c09db9d8c87fcd2a0c Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 1 Jul 2022 20:10:51 -0500 Subject: [PATCH 219/241] =?UTF-8?q?=F0=9F=A9=B9=20Remove=20obsolete=20spli?= =?UTF-8?q?t=5Fmove?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/planner.cpp | 30 ++++++++++++++++++------------ Marlin/src/module/planner.h | 23 ++++++++++++++--------- 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 129b9962d3f1..b80be01dea29 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1794,7 +1794,7 @@ bool Planner::_buffer_steps(const xyze_long_t &target if (cleaning_buffer_counter) return false; // Fill the block with the specified movement - if (!_populate_block(block, false, target + if (!_populate_block(block, target OPTARG(HAS_POSITION_FLOAT, target_float) OPTARG(HAS_DIST_MM_ARG, cart_dist_mm) , fr_mm_s, extruder, millimeters @@ -1826,17 +1826,24 @@ bool Planner::_buffer_steps(const xyze_long_t &target } /** - * Planner::_populate_block + * @brief Populate a block in preparation for insertion + * @details Populate the fields of a new linear movement block + * that will be added to the queue and processed soon + * by the Stepper ISR. * - * Fills a new linear movement in the block (in terms of steps). + * @param block A block to populate + * @param target Target position in steps units + * @param target_float Target position in native mm + * @param cart_dist_mm The pre-calculated move lengths for all axes, in mm + * @param fr_mm_s (target) speed of the move + * @param extruder target extruder + * @param millimeters A pre-calculated linear distance for the move, in mm, + * or 0.0 to have the distance calculated here. * - * target - target position in steps units - * fr_mm_s - (target) speed of the move - * extruder - target extruder - * - * Returns true if movement is acceptable, false otherwise + * @return true if movement is acceptable, false otherwise */ -bool Planner::_populate_block(block_t * const block, bool split_move, +bool Planner::_populate_block( + block_t * const block, const abce_long_t &target OPTARG(HAS_POSITION_FLOAT, const xyze_pos_t &target_float) OPTARG(HAS_DIST_MM_ARG, const xyze_float_t &cart_dist_mm) @@ -2849,9 +2856,8 @@ bool Planner::_populate_block(block_t * const block, bool split_move, // Initialize block entry speed. Compute based on deceleration to user-defined MINIMUM_PLANNER_SPEED. const float v_allowable_sqr = max_allowable_speed_sqr(-block->acceleration, sq(float(MINIMUM_PLANNER_SPEED)), block->millimeters); - // If we are trying to add a split block, start with the - // max. allowed speed to avoid an interrupted first move. - block->entry_speed_sqr = !split_move ? sq(float(MINIMUM_PLANNER_SPEED)) : _MIN(vmax_junction_sqr, v_allowable_sqr); + // Start with the minimum allowed speed + block->entry_speed_sqr = sq(float(MINIMUM_PLANNER_SPEED)); // Initialize planner efficiency flags // Set flag if block will always reach maximum junction speed regardless of entry/exit speeds. diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index 2d8a966ca033..a6f5bd5774d7 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -760,18 +760,23 @@ class Planner { ); /** - * Planner::_populate_block + * @brief Populate a block in preparation for insertion + * @details Populate the fields of a new linear movement block + * that will be added to the queue and processed soon + * by the Stepper ISR. * - * Fills a new linear movement in the block (in terms of steps). + * @param block A block to populate + * @param target Target position in steps units + * @param target_float Target position in native mm + * @param cart_dist_mm The pre-calculated move lengths for all axes, in mm + * @param fr_mm_s (target) speed of the move + * @param extruder target extruder + * @param millimeters A pre-calculated linear distance for the move, in mm, + * or 0.0 to have the distance calculated here. * - * target - target position in steps units - * fr_mm_s - (target) speed of the move - * extruder - target extruder - * millimeters - the length of the movement, if known - * - * Returns true is movement is acceptable, false otherwise + * @return true if movement is acceptable, false otherwise */ - static bool _populate_block(block_t * const block, bool split_move, const xyze_long_t &target + static bool _populate_block(block_t * const block, const xyze_long_t &target OPTARG(HAS_POSITION_FLOAT, const xyze_pos_t &target_float) OPTARG(HAS_DIST_MM_ARG, const xyze_float_t &cart_dist_mm) , feedRate_t fr_mm_s, const uint8_t extruder, const_float_t millimeters=0.0 From d956a6ba0075e1b6856a074a566db7574e3f3dcf Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 1 Jul 2022 21:14:28 -0500 Subject: [PATCH 220/241] =?UTF-8?q?=F0=9F=A9=B9=20Followup=20for=20lchar?= =?UTF-8?q?=5Ft?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/fontutils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/lcd/fontutils.cpp b/Marlin/src/lcd/fontutils.cpp index a97e63ac4d3a..c8560f541cf9 100644 --- a/Marlin/src/lcd/fontutils.cpp +++ b/Marlin/src/lcd/fontutils.cpp @@ -99,7 +99,7 @@ static inline bool utf8_is_start_byte_of_char(const uint8_t b) { /* This function gets the character at the pstart position, interpreting UTF8 multibyte sequences and returns the pointer to the next character */ -const uint8_t* get_utf8_value_cb(const uint8_t *pstart, read_byte_cb_t cb_read_byte, wchar_t *pval) { +const uint8_t* get_utf8_value_cb(const uint8_t *pstart, read_byte_cb_t cb_read_byte, lchar_t *pval) { uint32_t val = 0; const uint8_t *p = pstart; From 2b6ce3006ecad9573076e5fbac7b2a8dd03e74e7 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 2 Jul 2022 18:29:52 -0500 Subject: [PATCH 221/241] =?UTF-8?q?=F0=9F=A9=B9=20Followup=20for=20lchar?= =?UTF-8?q?=5Ft?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/fontutils.cpp | 4 ++-- Marlin/src/lcd/tft/tft_string.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Marlin/src/lcd/fontutils.cpp b/Marlin/src/lcd/fontutils.cpp index c8560f541cf9..863c553b5731 100644 --- a/Marlin/src/lcd/fontutils.cpp +++ b/Marlin/src/lcd/fontutils.cpp @@ -99,7 +99,7 @@ static inline bool utf8_is_start_byte_of_char(const uint8_t b) { /* This function gets the character at the pstart position, interpreting UTF8 multibyte sequences and returns the pointer to the next character */ -const uint8_t* get_utf8_value_cb(const uint8_t *pstart, read_byte_cb_t cb_read_byte, lchar_t *pval) { +const uint8_t* get_utf8_value_cb(const uint8_t *pstart, read_byte_cb_t cb_read_byte, lchar_t &pval) { uint32_t val = 0; const uint8_t *p = pstart; @@ -158,7 +158,7 @@ const uint8_t* get_utf8_value_cb(const uint8_t *pstart, read_byte_cb_t cb_read_b else for (; 0xFC < (0xFE & valcur); ) { p++; valcur = cb_read_byte(p); } - if (pval) *pval = val; + pval = val; return p; } diff --git a/Marlin/src/lcd/tft/tft_string.h b/Marlin/src/lcd/tft/tft_string.h index 5a7f774cf473..d43e0b0df2b4 100644 --- a/Marlin/src/lcd/tft/tft_string.h +++ b/Marlin/src/lcd/tft/tft_string.h @@ -25,6 +25,8 @@ #include +#include "../fontutils.h" + extern const uint8_t ISO10646_1_5x7[]; extern const uint8_t font10x20[]; From b8741a59df429435127f608c4265be583863ad06 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sun, 3 Jul 2022 00:24:56 +0000 Subject: [PATCH 222/241] [cron] Bump distribution date (2022-07-03) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 8630a92889f8..a27b62a2e871 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-07-02" +//#define STRING_DISTRIBUTION_DATE "2022-07-03" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 85544943c67c..56a5860231ac 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-07-02" + #define STRING_DISTRIBUTION_DATE "2022-07-03" #endif /** From 3826b13ab15ba6ad81258d850a18d1b0e5496d74 Mon Sep 17 00:00:00 2001 From: Victor Oliveira Date: Sat, 2 Jul 2022 21:31:27 -0300 Subject: [PATCH 223/241] =?UTF-8?q?=F0=9F=94=A8=20Disable=20stack=20protec?= =?UTF-8?q?tor=20on=20macOS=20simulator=20(#24443)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ini/native.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ini/native.ini b/ini/native.ini index e860a55958f2..693a985d4e92 100644 --- a/ini/native.ini +++ b/ini/native.ini @@ -78,7 +78,7 @@ build_flags = ${simulator_linux.build_flags} ${simulator_linux.release_flags} # If Xcode is installed be sure to run `xcode-select --install` first. # [simulator_macos] -build_unflags = -lGL +build_unflags = -lGL -fstack-protector-strong build_flags = -I/opt/local/include -I/opt/local/include/freetype2 @@ -87,6 +87,7 @@ build_flags = -Wl,-framework,OpenGl -Wl,-framework,CoreFoundation -lSDL2 + -fno-stack-protector [env:simulator_macos_debug] extends = env:simulator_linux_debug From 9baeeedd69085f97674d20ba8af1e5d716125534 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Sun, 3 Jul 2022 08:08:40 -0700 Subject: [PATCH 224/241] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20MKS=20TinyBee=20AD?= =?UTF-8?q?C=20Vref=20(#24432)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/esp32/pins_MKS_TINYBEE.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h b/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h index 3d5e3964f490..110c6f83ef85 100644 --- a/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h +++ b/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h @@ -115,7 +115,7 @@ // // ADC Reference Voltage // -#define ADC_REFERENCE_VOLTAGE 2.5 // 2.5V reference VDDA +#define ADC_REFERENCE_VOLTAGE 2.565 // 2.5V reference VDDA /** * ------ ------ From 54e7b933cdb6d0bf0d69fd661b585100d76e3c88 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 3 Jul 2022 10:32:47 -0500 Subject: [PATCH 225/241] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Encapsulate=20PID?= =?UTF-8?q?=20in=20class=20(#24389)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/MarlinCore.cpp | 2 +- Marlin/src/core/language.h | 4 - Marlin/src/core/utility.cpp | 4 +- Marlin/src/gcode/motion/G2_G3.cpp | 2 +- Marlin/src/gcode/queue.cpp | 2 +- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 12 +- Marlin/src/lcd/extui/ui_api.cpp | 2 +- Marlin/src/libs/buzzer.cpp | 2 +- Marlin/src/module/motion.cpp | 2 +- Marlin/src/module/planner_bezier.cpp | 2 +- Marlin/src/module/temperature.cpp | 462 +++++++----------- Marlin/src/module/temperature.h | 16 +- .../sd/usb_flashdrive/Sd2Card_FlashDrive.cpp | 2 +- 13 files changed, 216 insertions(+), 298 deletions(-) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 2724006dd193..c1bd973b4a1d 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -789,7 +789,7 @@ void idle(bool no_stepper_sleep/*=false*/) { manage_inactivity(no_stepper_sleep); // Manage Heaters (and Watchdog) - thermalManager.manage_heater(); + thermalManager.task(); // Max7219 heartbeat, animation, etc TERN_(MAX7219_DEBUG, max7219.idle_tasks()); diff --git a/Marlin/src/core/language.h b/Marlin/src/core/language.h index 16d7b1bf663e..157bd6918515 100644 --- a/Marlin/src/core/language.h +++ b/Marlin/src/core/language.h @@ -227,10 +227,6 @@ #define STR_PID_DEBUG " PID_DEBUG " #define STR_PID_DEBUG_INPUT ": Input " #define STR_PID_DEBUG_OUTPUT " Output " -#define STR_PID_DEBUG_PTERM " pTerm " -#define STR_PID_DEBUG_ITERM " iTerm " -#define STR_PID_DEBUG_DTERM " dTerm " -#define STR_PID_DEBUG_CTERM " cTerm " #define STR_INVALID_EXTRUDER_NUM " - Invalid extruder number !" #define STR_MPC_AUTOTUNE "MPC Autotune" #define STR_MPC_AUTOTUNE_START " start for " STR_E diff --git a/Marlin/src/core/utility.cpp b/Marlin/src/core/utility.cpp index 84e4c1f69696..9cdf8dec7bcf 100644 --- a/Marlin/src/core/utility.cpp +++ b/Marlin/src/core/utility.cpp @@ -29,10 +29,10 @@ void safe_delay(millis_t ms) { while (ms > 50) { ms -= 50; delay(50); - thermalManager.manage_heater(); + thermalManager.task(); } delay(ms); - thermalManager.manage_heater(); // This keeps us safe if too many small safe_delay() calls are made + thermalManager.task(); // This keeps us safe if too many small safe_delay() calls are made } // A delay to provide brittle hosts time to receive bytes diff --git a/Marlin/src/gcode/motion/G2_G3.cpp b/Marlin/src/gcode/motion/G2_G3.cpp index d9458f61eb39..14ef9ac2a6f4 100644 --- a/Marlin/src/gcode/motion/G2_G3.cpp +++ b/Marlin/src/gcode/motion/G2_G3.cpp @@ -290,7 +290,7 @@ void plan_arc( for (uint16_t i = 1; i < segments; i++) { // Iterate (segments-1) times - thermalManager.manage_heater(); + thermalManager.task(); const millis_t ms = millis(); if (ELAPSED(ms, next_idle_ms)) { next_idle_ms = ms + 200UL; diff --git a/Marlin/src/gcode/queue.cpp b/Marlin/src/gcode/queue.cpp index 454a009b8598..a390a46d8e31 100644 --- a/Marlin/src/gcode/queue.cpp +++ b/Marlin/src/gcode/queue.cpp @@ -384,7 +384,7 @@ inline bool process_line_done(uint8_t &sis, char (&buff)[MAX_CMD_SIZE], int &ind buff[ind] = '\0'; // Of course, I'm a Terminator. const bool is_empty = (ind == 0); // An empty line? if (is_empty) - thermalManager.manage_heater(); // Keep sensors satisfied + thermalManager.task(); // Keep sensors satisfied else ind = 0; // Start a new line return is_empty; // Inform the caller diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 5f1507feb332..285013d7504e 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -1202,7 +1202,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) Popup_Handler(ETemp); else { - if (thermalManager.temp_hotend[0].celsius < thermalManager.temp_hotend[0].target - 2) { + if (thermalManager.temp_hotend[0].is_below_target(-2)) { Popup_Handler(Heating); thermalManager.wait_for_hotend(0); } @@ -1345,7 +1345,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ Popup_Handler(ETemp); } else { - if (thermalManager.temp_hotend[0].celsius < thermalManager.temp_hotend[0].target - 2) { + if (thermalManager.temp_hotend[0].is_below_target(-2)) { Popup_Handler(Heating); thermalManager.wait_for_hotend(0); Redraw_Menu(); @@ -1732,7 +1732,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) Popup_Handler(ETemp); else { - if (thermalManager.temp_hotend[0].celsius < thermalManager.temp_hotend[0].target - 2) { + if (thermalManager.temp_hotend[0].is_below_target(-2)) { Popup_Handler(Heating); thermalManager.wait_for_hotend(0); } @@ -1751,7 +1751,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ Popup_Handler(ETemp); } else { - if (thermalManager.temp_hotend[0].celsius < thermalManager.temp_hotend[0].target - 2) { + if (thermalManager.temp_hotend[0].is_below_target(-2)) { Popup_Handler(Heating); thermalManager.wait_for_hotend(0); } @@ -1769,7 +1769,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) Popup_Handler(ETemp); else { - if (thermalManager.temp_hotend[0].celsius < thermalManager.temp_hotend[0].target - 2) { + if (thermalManager.temp_hotend[0].is_below_target(-2)) { Popup_Handler(Heating); thermalManager.wait_for_hotend(0); } @@ -4404,7 +4404,7 @@ void CrealityDWINClass::Popup_Control() { if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) Popup_Handler(ETemp); else { - if (thermalManager.temp_hotend[0].celsius < thermalManager.temp_hotend[0].target - 2) { + if (thermalManager.temp_hotend[0].is_below_target(-2)) { Popup_Handler(Heating); thermalManager.wait_for_hotend(0); } diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index 68b0a81fe514..57822279c530 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -169,7 +169,7 @@ namespace ExtUI { } void yield() { - if (!flags.printer_killed) thermalManager.manage_heater(); + if (!flags.printer_killed) thermalManager.task(); } void enableHeater(const extruder_t extruder) { diff --git a/Marlin/src/libs/buzzer.cpp b/Marlin/src/libs/buzzer.cpp index a3c838ebc0a3..1e2f23c5fdef 100644 --- a/Marlin/src/libs/buzzer.cpp +++ b/Marlin/src/libs/buzzer.cpp @@ -48,7 +48,7 @@ void Buzzer::tone(const uint16_t duration, const uint16_t frequency/*=0*/) { if (!ui.sound_on) return; while (buffer.isFull()) { tick(); - thermalManager.manage_heater(); + thermalManager.task(); } tone_t tone = { duration, frequency }; buffer.enqueue(tone); diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 36afdb2e485f..b3b607e677a8 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -966,7 +966,7 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) { next_idle_ms = ms + 200UL; return idle(); } - thermalManager.manage_heater(); // Returns immediately on most calls + thermalManager.task(); // Returns immediately on most calls } #if IS_KINEMATIC diff --git a/Marlin/src/module/planner_bezier.cpp b/Marlin/src/module/planner_bezier.cpp index fa7e16a387e6..93b118f33054 100644 --- a/Marlin/src/module/planner_bezier.cpp +++ b/Marlin/src/module/planner_bezier.cpp @@ -123,7 +123,7 @@ void cubic_b_spline( for (float t = 0; t < 1;) { - thermalManager.manage_heater(); + thermalManager.task(); millis_t now = millis(); if (ELAPSED(now, next_idle_ms)) { next_idle_ms = now + 200UL; diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 17ab08d4c20e..0de922d1a823 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -1318,104 +1318,101 @@ void Temperature::min_temp_error(const heater_id_t heater_id) { } #if ANY(PID_DEBUG, PID_BED_DEBUG, PID_CHAMBER_DEBUG) - bool Temperature::pid_debug_flag; // = 0 + #define HAS_PID_DEBUG 1 + bool Temperature::pid_debug_flag; // = false #endif -#if HAS_HOTEND +#if HAS_PID_HEATING - float Temperature::get_pid_output_hotend(const uint8_t E_NAME) { - const uint8_t ee = HOTEND_INDEX; - #if ENABLED(PIDTEMP) - #if DISABLED(PID_OPENLOOP) - static hotend_pid_t work_pid[HOTENDS]; - static float temp_iState[HOTENDS] = { 0 }, - temp_dState[HOTENDS] = { 0 }; - static Flags pid_reset; - const float pid_error = temp_hotend[ee].target - temp_hotend[ee].celsius; - - float pid_output; - - if (temp_hotend[ee].target == 0 - || pid_error < -(PID_FUNCTIONAL_RANGE) - || TERN0(HEATER_IDLE_HANDLER, heater_idle[ee].timed_out) - ) { - pid_output = 0; - pid_reset.set(ee); + template + class PIDRunner { + public: + TT &tempinfo; + __typeof__(TT::pid) work_pid{0}; + float temp_iState = 0, temp_dState = 0; + bool pid_reset = true; + + PIDRunner(TT &t) : tempinfo(t) { } + + float get_pid_output() { + + #if ENABLED(PID_OPENLOOP) + + return constrain(tempinfo.target, 0, MAX_POW); + + #else // !PID_OPENLOOP + + const float pid_error = tempinfo.target - tempinfo.celsius; + if (!tempinfo.target || pid_error < -(PID_FUNCTIONAL_RANGE)) { + pid_reset = true; + return 0; } else if (pid_error > PID_FUNCTIONAL_RANGE) { - pid_output = PID_MAX; - pid_reset.set(ee); + pid_reset = true; + return MAX_POW; } - else { - if (pid_reset[ee]) { - temp_iState[ee] = 0.0; - work_pid[ee].Kd = 0.0; - pid_reset.clear(ee); - } - work_pid[ee].Kd = work_pid[ee].Kd + PID_K2 * (PID_PARAM(Kd, ee) * (temp_dState[ee] - temp_hotend[ee].celsius) - work_pid[ee].Kd); - const float max_power_over_i_gain = float(PID_MAX) / PID_PARAM(Ki, ee) - float(MIN_POWER); - temp_iState[ee] = constrain(temp_iState[ee] + pid_error, 0, max_power_over_i_gain); - work_pid[ee].Kp = PID_PARAM(Kp, ee) * pid_error; - work_pid[ee].Ki = PID_PARAM(Ki, ee) * temp_iState[ee]; + if (pid_reset) { + pid_reset = false; + temp_iState = 0.0; + work_pid.Kd = 0.0; + } - pid_output = work_pid[ee].Kp + work_pid[ee].Ki + work_pid[ee].Kd + float(MIN_POWER); + const float max_power_over_i_gain = float(MAX_POW) / tempinfo.pid.Ki - float(MIN_POW); + temp_iState = constrain(temp_iState + pid_error, 0, max_power_over_i_gain); - #if ENABLED(PID_EXTRUSION_SCALING) - #if HOTENDS == 1 - constexpr bool this_hotend = true; - #else - const bool this_hotend = (ee == active_extruder); - #endif - work_pid[ee].Kc = 0; - if (this_hotend) { - const long e_position = stepper.position(E_AXIS); - if (e_position > pes_e_position) { - lpq[lpq_ptr] = e_position - pes_e_position; - pes_e_position = e_position; - } - else - lpq[lpq_ptr] = 0; + work_pid.Kp = tempinfo.pid.Kp * pid_error; + work_pid.Ki = tempinfo.pid.Ki * temp_iState; + work_pid.Kd = work_pid.Kd + PID_K2 * (tempinfo.pid.Kd * (temp_dState - tempinfo.celsius) - work_pid.Kd); - if (++lpq_ptr >= lpq_len) lpq_ptr = 0; - work_pid[ee].Kc = (lpq[lpq_ptr] * planner.mm_per_step[E_AXIS]) * PID_PARAM(Kc, ee); - pid_output += work_pid[ee].Kc; - } - #endif // PID_EXTRUSION_SCALING - #if ENABLED(PID_FAN_SCALING) - if (fan_speed[active_extruder] > PID_FAN_SCALING_MIN_SPEED) { - work_pid[ee].Kf = PID_PARAM(Kf, ee) + (PID_FAN_SCALING_LIN_FACTOR) * fan_speed[active_extruder]; - pid_output += work_pid[ee].Kf; - } - //pid_output -= work_pid[ee].Ki; - //pid_output += work_pid[ee].Ki * work_pid[ee].Kf - #endif // PID_FAN_SCALING - LIMIT(pid_output, 0, PID_MAX); - } - temp_dState[ee] = temp_hotend[ee].celsius; + temp_dState = tempinfo.celsius; - #else // PID_OPENLOOP + return constrain(work_pid.Kp + work_pid.Ki + work_pid.Kd + float(MIN_POW), 0, MAX_POW); - const float pid_output = constrain(temp_hotend[ee].target, 0, PID_MAX); + #endif // !PID_OPENLOOP + } - #endif // PID_OPENLOOP + FORCE_INLINE void debug(const_celsius_float_t c, const_float_t pid_out, FSTR_P const name=nullptr, const int8_t index=-1) { + if (TERN0(HAS_PID_DEBUG, thermalManager.pid_debug_flag)) { + SERIAL_ECHO_START(); + if (name) SERIAL_ECHOLNF(name); + if (index >= 0) SERIAL_ECHO(index); + SERIAL_ECHOLNPGM( + STR_PID_DEBUG_INPUT, c, + STR_PID_DEBUG_OUTPUT, pid_out + #if DISABLED(PID_OPENLOOP) + , "pTerm", work_pid.Kp, "iTerm", work_pid.Ki, "dTerm", work_pid.Kd + #endif + ); + } + } + }; + +#endif // HAS_PID_HEATING + +#if HAS_HOTEND + + float Temperature::get_pid_output_hotend(const uint8_t E_NAME) { + const uint8_t ee = HOTEND_INDEX; + + #if ENABLED(PIDTEMP) + + typedef PIDRunner PIDRunnerHotend; + + static PIDRunnerHotend hotend_pid[HOTENDS] = { + #define _HOTENDPID(E) temp_hotend[E], + REPEAT(HOTENDS, _HOTENDPID) + }; + + const float pid_output = hotend_pid[ee].get_pid_output(); #if ENABLED(PID_DEBUG) - if (ee == active_extruder && pid_debug_flag) { - SERIAL_ECHO_MSG(STR_PID_DEBUG, ee, STR_PID_DEBUG_INPUT, temp_hotend[ee].celsius, STR_PID_DEBUG_OUTPUT, pid_output - #if DISABLED(PID_OPENLOOP) - , STR_PID_DEBUG_PTERM, work_pid[ee].Kp - , STR_PID_DEBUG_ITERM, work_pid[ee].Ki - , STR_PID_DEBUG_DTERM, work_pid[ee].Kd - #if ENABLED(PID_EXTRUSION_SCALING) - , STR_PID_DEBUG_CTERM, work_pid[ee].Kc - #endif - #endif - ); - } + if (ee == active_extruder) + hotend_pid[ee].debug(temp_hotend[ee].celsius, pid_output, F("E"), ee); #endif #elif ENABLED(MPCTEMP) + MPCHeaterInfo &hotend = temp_hotend[ee]; MPC_t &constants = hotend.constants; @@ -1497,7 +1494,7 @@ void Temperature::min_temp_error(const heater_id_t heater_id) { #else // No PID or MPC enabled const bool is_idling = TERN0(HEATER_IDLE_HANDLER, heater_idle[ee].timed_out); - const float pid_output = (!is_idling && temp_hotend[ee].celsius < temp_hotend[ee].target) ? BANG_MAX : 0; + const float pid_output = (!is_idling && temp_hotend[ee].is_below_target()) ? BANG_MAX : 0; #endif @@ -1509,61 +1506,9 @@ void Temperature::min_temp_error(const heater_id_t heater_id) { #if ENABLED(PIDTEMPBED) float Temperature::get_pid_output_bed() { - - #if DISABLED(PID_OPENLOOP) - - static PID_t work_pid{0}; - static float temp_iState = 0, temp_dState = 0; - static bool pid_reset = true; - float pid_output = 0; - const float max_power_over_i_gain = float(MAX_BED_POWER) / temp_bed.pid.Ki - float(MIN_BED_POWER), - pid_error = temp_bed.target - temp_bed.celsius; - - if (!temp_bed.target || pid_error < -(PID_FUNCTIONAL_RANGE)) { - pid_output = 0; - pid_reset = true; - } - else if (pid_error > PID_FUNCTIONAL_RANGE) { - pid_output = MAX_BED_POWER; - pid_reset = true; - } - else { - if (pid_reset) { - temp_iState = 0.0; - work_pid.Kd = 0.0; - pid_reset = false; - } - - temp_iState = constrain(temp_iState + pid_error, 0, max_power_over_i_gain); - - work_pid.Kp = temp_bed.pid.Kp * pid_error; - work_pid.Ki = temp_bed.pid.Ki * temp_iState; - work_pid.Kd = work_pid.Kd + PID_K2 * (temp_bed.pid.Kd * (temp_dState - temp_bed.celsius) - work_pid.Kd); - - temp_dState = temp_bed.celsius; - - pid_output = constrain(work_pid.Kp + work_pid.Ki + work_pid.Kd + float(MIN_BED_POWER), 0, MAX_BED_POWER); - } - - #else // PID_OPENLOOP - - const float pid_output = constrain(temp_bed.target, 0, MAX_BED_POWER); - - #endif // PID_OPENLOOP - - #if ENABLED(PID_BED_DEBUG) - if (pid_debug_flag) { - SERIAL_ECHO_MSG( - " PID_BED_DEBUG : Input ", temp_bed.celsius, " Output ", pid_output - #if DISABLED(PID_OPENLOOP) - , STR_PID_DEBUG_PTERM, work_pid.Kp - , STR_PID_DEBUG_ITERM, work_pid.Ki - , STR_PID_DEBUG_DTERM, work_pid.Kd - #endif - ); - } - #endif - + static PIDRunner bed_pid(temp_bed); + const float pid_output = bed_pid.get_pid_output(); + TERN_(PID_BED_DEBUG, bed_pid.debug(temp_bed.celsius, pid_output, F("(Bed)"))); return pid_output; } @@ -1572,114 +1517,17 @@ void Temperature::min_temp_error(const heater_id_t heater_id) { #if ENABLED(PIDTEMPCHAMBER) float Temperature::get_pid_output_chamber() { - - #if DISABLED(PID_OPENLOOP) - - static PID_t work_pid{0}; - static float temp_iState = 0, temp_dState = 0; - static bool pid_reset = true; - float pid_output = 0; - const float max_power_over_i_gain = float(MAX_CHAMBER_POWER) / temp_chamber.pid.Ki - float(MIN_CHAMBER_POWER), - pid_error = temp_chamber.target - temp_chamber.celsius; - - if (!temp_chamber.target || pid_error < -(PID_FUNCTIONAL_RANGE)) { - pid_output = 0; - pid_reset = true; - } - else if (pid_error > PID_FUNCTIONAL_RANGE) { - pid_output = MAX_CHAMBER_POWER; - pid_reset = true; - } - else { - if (pid_reset) { - temp_iState = 0.0; - work_pid.Kd = 0.0; - pid_reset = false; - } - - temp_iState = constrain(temp_iState + pid_error, 0, max_power_over_i_gain); - - work_pid.Kp = temp_chamber.pid.Kp * pid_error; - work_pid.Ki = temp_chamber.pid.Ki * temp_iState; - work_pid.Kd = work_pid.Kd + PID_K2 * (temp_chamber.pid.Kd * (temp_dState - temp_chamber.celsius) - work_pid.Kd); - - temp_dState = temp_chamber.celsius; - - pid_output = constrain(work_pid.Kp + work_pid.Ki + work_pid.Kd + float(MIN_CHAMBER_POWER), 0, MAX_CHAMBER_POWER); - } - - #else // PID_OPENLOOP - - const float pid_output = constrain(temp_chamber.target, 0, MAX_CHAMBER_POWER); - - #endif // PID_OPENLOOP - - #if ENABLED(PID_CHAMBER_DEBUG) - { - SERIAL_ECHO_MSG( - " PID_CHAMBER_DEBUG : Input ", temp_chamber.celsius, " Output ", pid_output - #if DISABLED(PID_OPENLOOP) - , STR_PID_DEBUG_PTERM, work_pid.Kp - , STR_PID_DEBUG_ITERM, work_pid.Ki - , STR_PID_DEBUG_DTERM, work_pid.Kd - #endif - ); - } - #endif - + static PIDRunner chamber_pid(temp_chamber); + const float pid_output = chamber_pid.get_pid_output(); + TERN_(PID_CHAMBER_DEBUG, chamber_pid.debug(temp_chamber.celsius, pid_output, F("(Chamber)"))); return pid_output; } #endif // PIDTEMPCHAMBER -/** - * Manage heating activities for extruder hot-ends and a heated bed - * - Acquire updated temperature readings - * - Also resets the watchdog timer - * - Invoke thermal runaway protection - * - Manage extruder auto-fan - * - Apply filament width to the extrusion rate (may move) - * - Update the heated bed PID output value - */ -void Temperature::manage_heater() { - if (marlin_state == MF_INITIALIZING) return hal.watchdog_refresh(); // If Marlin isn't started, at least reset the watchdog! - - static bool no_reentry = false; // Prevent recursion - if (no_reentry) return; - REMEMBER(mh, no_reentry, true); - - #if ENABLED(EMERGENCY_PARSER) - if (emergency_parser.killed_by_M112) kill(FPSTR(M112_KILL_STR), nullptr, true); - - if (emergency_parser.quickstop_by_M410) { - emergency_parser.quickstop_by_M410 = false; // quickstop_stepper may call idle so clear this now! - quickstop_stepper(); - } - #endif - - if (!updateTemperaturesIfReady()) return; // Will also reset the watchdog if temperatures are ready - - #if DISABLED(IGNORE_THERMOCOUPLE_ERRORS) - #if TEMP_SENSOR_0_IS_MAX_TC - if (degHotend(0) > _MIN(HEATER_0_MAXTEMP, TEMP_SENSOR_0_MAX_TC_TMAX - 1.0)) max_temp_error(H_E0); - if (degHotend(0) < _MAX(HEATER_0_MINTEMP, TEMP_SENSOR_0_MAX_TC_TMIN + .01)) min_temp_error(H_E0); - #endif - #if TEMP_SENSOR_1_IS_MAX_TC - if (degHotend(1) > _MIN(HEATER_1_MAXTEMP, TEMP_SENSOR_1_MAX_TC_TMAX - 1.0)) max_temp_error(H_E1); - if (degHotend(1) < _MAX(HEATER_1_MINTEMP, TEMP_SENSOR_1_MAX_TC_TMIN + .01)) min_temp_error(H_E1); - #endif - #if TEMP_SENSOR_REDUNDANT_IS_MAX_TC - if (degRedundant() > TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX - 1.0) max_temp_error(H_REDUNDANT); - if (degRedundant() < TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN + .01) min_temp_error(H_REDUNDANT); - #endif - #else - #warning "Safety Alert! Disable IGNORE_THERMOCOUPLE_ERRORS for the final build!" - #endif - - millis_t ms = millis(); - - #if HAS_HOTEND +#if HAS_HOTEND + void Temperature::manage_hotends(const millis_t &ms) { HOTEND_LOOP() { #if ENABLED(THERMAL_PROTECTION_HOTENDS) if (degHotend(e) > temp_range[e].maxtemp) max_temp_error((heater_id_t)e); @@ -1707,25 +1555,13 @@ void Temperature::manage_heater() { #endif } // HOTEND_LOOP + } - #endif // HAS_HOTEND - - #if HAS_TEMP_REDUNDANT - // Make sure measured temperatures are close together - if (ABS(degRedundantTarget() - degRedundant()) > TEMP_SENSOR_REDUNDANT_MAX_DIFF) - _temp_error((heater_id_t)HEATER_ID(TEMP_SENSOR_REDUNDANT_TARGET), F(STR_REDUNDANCY), GET_TEXT_F(MSG_ERR_REDUNDANT_TEMP)); - #endif - - // Manage extruder auto fans and/or read fan tachometers - TERN_(HAS_FAN_LOGIC, manage_extruder_fans(ms)); +#endif // HAS_HOTEND - /** - * Dynamically set the volumetric multiplier based - * on the delayed Filament Width measurement. - */ - TERN_(FILAMENT_WIDTH_SENSOR, filwidth.update_volumetric()); +#if HAS_HEATED_BED - #if HAS_HEATED_BED + void Temperature::manage_heated_bed(const millis_t &ms) { #if ENABLED(THERMAL_PROTECTION_BED) if (degBed() > BED_MAXTEMP) max_temp_error(H_BED); @@ -1770,9 +1606,7 @@ void Temperature::manage_heater() { #if HEATER_IDLE_HANDLER if (heater_idle[IDLE_INDEX_BED].timed_out) { temp_bed.soft_pwm_amount = 0; - #if DISABLED(PIDTEMPBED) - WRITE_HEATER_BED(LOW); - #endif + if (DISABLED(PIDTEMPBED)) WRITE_HEATER_BED(LOW); } else #endif @@ -1785,10 +1619,10 @@ void Temperature::manage_heater() { #if ENABLED(BED_LIMIT_SWITCHING) if (temp_bed.celsius >= temp_bed.target + BED_HYSTERESIS) temp_bed.soft_pwm_amount = 0; - else if (temp_bed.celsius <= temp_bed.target - (BED_HYSTERESIS)) + else if (temp_bed.is_below_target(-(BED_HYSTERESIS) + 1)) temp_bed.soft_pwm_amount = MAX_BED_POWER >> 1; #else // !PIDTEMPBED && !BED_LIMIT_SWITCHING - temp_bed.soft_pwm_amount = temp_bed.celsius < temp_bed.target ? MAX_BED_POWER >> 1 : 0; + temp_bed.soft_pwm_amount = temp_bed.is_below_target() ? MAX_BED_POWER >> 1 : 0; #endif } else { @@ -1799,10 +1633,13 @@ void Temperature::manage_heater() { } } while (false); + } - #endif // HAS_HEATED_BED +#endif // HAS_HEATED_BED - #if HAS_HEATED_CHAMBER +#if HAS_HEATED_CHAMBER + + void Temperature::manage_heated_chamber(const millis_t &ms) { #ifndef CHAMBER_CHECK_INTERVAL #define CHAMBER_CHECK_INTERVAL 1000UL @@ -1897,17 +1734,17 @@ void Temperature::manage_heater() { if (flag_chamber_excess_heat) { temp_chamber.soft_pwm_amount = 0; #if ENABLED(CHAMBER_VENT) - if (!flag_chamber_off) servo[CHAMBER_VENT_SERVO_NR].move(temp_chamber.celsius <= temp_chamber.target ? 0 : 90); + if (!flag_chamber_off) servo[CHAMBER_VENT_SERVO_NR].move(temp_chamber.is_below_target() ? 0 : 90); #endif } else { #if ENABLED(CHAMBER_LIMIT_SWITCHING) if (temp_chamber.celsius >= temp_chamber.target + TEMP_CHAMBER_HYSTERESIS) temp_chamber.soft_pwm_amount = 0; - else if (temp_chamber.celsius <= temp_chamber.target - (TEMP_CHAMBER_HYSTERESIS)) + else if (temp_chamber.is_below_target(-(TEMP_CHAMBER_HYSTERESIS) + 1)) temp_chamber.soft_pwm_amount = (MAX_CHAMBER_POWER) >> 1; #else - temp_chamber.soft_pwm_amount = temp_chamber.celsius < temp_chamber.target ? (MAX_CHAMBER_POWER) >> 1 : 0; + temp_chamber.soft_pwm_amount = temp_chamber.is_below_target() ? (MAX_CHAMBER_POWER) >> 1 : 0; #endif #if ENABLED(CHAMBER_VENT) if (!flag_chamber_off) servo[CHAMBER_VENT_SERVO_NR].move(0); @@ -1923,10 +1760,13 @@ void Temperature::manage_heater() { tr_state_machine[RUNAWAY_IND_CHAMBER].run(temp_chamber.celsius, temp_chamber.target, H_CHAMBER, THERMAL_PROTECTION_CHAMBER_PERIOD, THERMAL_PROTECTION_CHAMBER_HYSTERESIS); #endif #endif + } - #endif // HAS_HEATED_CHAMBER +#endif // HAS_HEATED_CHAMBER - #if HAS_COOLER +#if HAS_COOLER + + void Temperature::manage_cooler(const millis_t &ms) { #ifndef COOLER_CHECK_INTERVAL #define COOLER_CHECK_INTERVAL 2000UL @@ -1984,8 +1824,82 @@ void Temperature::manage_heater() { #if ENABLED(THERMAL_PROTECTION_COOLER) tr_state_machine[RUNAWAY_IND_COOLER].run(temp_cooler.celsius, temp_cooler.target, H_COOLER, THERMAL_PROTECTION_COOLER_PERIOD, THERMAL_PROTECTION_COOLER_HYSTERESIS); #endif + } - #endif // HAS_COOLER +#endif // HAS_COOLER + +/** + * Manage heating activities for extruder hot-ends and a heated bed + * - Acquire updated temperature readings + * - Also resets the watchdog timer + * - Invoke thermal runaway protection + * - Manage extruder auto-fan + * - Apply filament width to the extrusion rate (may move) + * - Update the heated bed PID output value + */ +void Temperature::task() { + if (marlin_state == MF_INITIALIZING) return hal.watchdog_refresh(); // If Marlin isn't started, at least reset the watchdog! + + static bool no_reentry = false; // Prevent recursion + if (no_reentry) return; + REMEMBER(mh, no_reentry, true); + + #if ENABLED(EMERGENCY_PARSER) + if (emergency_parser.killed_by_M112) kill(FPSTR(M112_KILL_STR), nullptr, true); + + if (emergency_parser.quickstop_by_M410) { + emergency_parser.quickstop_by_M410 = false; // quickstop_stepper may call idle so clear this now! + quickstop_stepper(); + } + #endif + + if (!updateTemperaturesIfReady()) return; // Will also reset the watchdog if temperatures are ready + + #if DISABLED(IGNORE_THERMOCOUPLE_ERRORS) + #if TEMP_SENSOR_0_IS_MAX_TC + if (degHotend(0) > _MIN(HEATER_0_MAXTEMP, TEMP_SENSOR_0_MAX_TC_TMAX - 1.0)) max_temp_error(H_E0); + if (degHotend(0) < _MAX(HEATER_0_MINTEMP, TEMP_SENSOR_0_MAX_TC_TMIN + .01)) min_temp_error(H_E0); + #endif + #if TEMP_SENSOR_1_IS_MAX_TC + if (degHotend(1) > _MIN(HEATER_1_MAXTEMP, TEMP_SENSOR_1_MAX_TC_TMAX - 1.0)) max_temp_error(H_E1); + if (degHotend(1) < _MAX(HEATER_1_MINTEMP, TEMP_SENSOR_1_MAX_TC_TMIN + .01)) min_temp_error(H_E1); + #endif + #if TEMP_SENSOR_REDUNDANT_IS_MAX_TC + if (degRedundant() > TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX - 1.0) max_temp_error(H_REDUNDANT); + if (degRedundant() < TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN + .01) min_temp_error(H_REDUNDANT); + #endif + #else + #warning "Safety Alert! Disable IGNORE_THERMOCOUPLE_ERRORS for the final build!" + #endif + + const millis_t ms = millis(); + + // Handle Hotend Temp Errors, Heating Watch, etc. + TERN_(HAS_HOTEND, manage_hotends(ms)); + + #if HAS_TEMP_REDUNDANT + // Make sure measured temperatures are close together + if (ABS(degRedundantTarget() - degRedundant()) > TEMP_SENSOR_REDUNDANT_MAX_DIFF) + _temp_error((heater_id_t)HEATER_ID(TEMP_SENSOR_REDUNDANT_TARGET), F(STR_REDUNDANCY), GET_TEXT_F(MSG_ERR_REDUNDANT_TEMP)); + #endif + + // Manage extruder auto fans and/or read fan tachometers + TERN_(HAS_FAN_LOGIC, manage_extruder_fans(ms)); + + /** + * Dynamically set the volumetric multiplier based + * on the delayed Filament Width measurement. + */ + TERN_(FILAMENT_WIDTH_SENSOR, filwidth.update_volumetric()); + + // Handle Bed Temp Errors, Heating Watch, etc. + TERN_(HAS_HEATED_BED, manage_heated_bed(ms)); + + // Handle Heated Chamber Temp Errors, Heating Watch, etc. + TERN_(HAS_HEATED_CHAMBER, manage_heated_chamber(ms)); + + // Handle Cooler Temp Errors, Cooling Watch, etc. + TERN_(HAS_COOLER, manage_cooler(ms)); #if ENABLED(LASER_COOLANT_FLOW_METER) cooler.flowmeter_task(ms); @@ -2479,7 +2393,7 @@ void Temperature::updateTemperaturesFromRawValues() { /** * Initialize the temperature manager * - * The manager is implemented by periodic calls to manage_heater() + * The manager is implemented by periodic calls to task() * * - Init (and disable) SPI thermocouples like MAX6675 and MAX31865 * - Disable RUMBA JTAG to accommodate a thermocouple extension @@ -3111,7 +3025,7 @@ void Temperature::disable_all_heaters() { static millis_t next_max_tc_ms[MAX_TC_COUNT] = { 0 }; // Return last-read value between readings - millis_t ms = millis(); + const millis_t ms = millis(); if (PENDING(ms, next_max_tc_ms[hindex])) return THERMO_TEMP(hindex); @@ -3419,16 +3333,18 @@ void Temperature::isr() { _PWM_MOD(COOLER, soft_pwm_cooler, temp_cooler); #endif - #if BOTH(USE_CONTROLLER_FAN, FAN_SOFT_PWM) - WRITE(CONTROLLER_FAN_PIN, soft_pwm_controller.add(pwm_mask, soft_pwm_controller_speed)); - #endif - #if ENABLED(FAN_SOFT_PWM) + + #if ENABLED(USE_CONTROLLER_FAN) + WRITE(CONTROLLER_FAN_PIN, soft_pwm_controller.add(pwm_mask, soft_pwm_controller_speed)); + #endif + #define _FAN_PWM(N) do{ \ uint8_t &spcf = soft_pwm_count_fan[N]; \ spcf = (spcf & pwm_mask) + (soft_pwm_amount_fan[N] >> 1); \ WRITE_FAN(N, spcf > pwm_mask ? HIGH : LOW); \ }while(0) + #if HAS_FAN0 _FAN_PWM(0); #endif diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index c11c9d76defb..80d15ce39e4a 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -232,6 +232,7 @@ typedef struct TempInfo { typedef struct HeaterInfo : public TempInfo { celsius_t target; uint8_t soft_pwm_amount; + bool is_below_target(const celsius_t offs=0) const { return (celsius < (target + offs)); } } heater_info_t; // A heater with PID stabilization @@ -715,9 +716,9 @@ class Temperature { static void readings_ready(); /** - * Call periodically to manage heaters + * Call periodically to manage heaters and keep the watchdog fed */ - static void manage_heater() __O2; // __O2 added to work around a compiler error + static void task(); /** * Preheating hotends @@ -807,6 +808,8 @@ class Temperature { #endif } + static void manage_hotends(const millis_t &ms); + #endif // HAS_HOTEND #if HAS_HEATED_BED @@ -819,6 +822,9 @@ class Temperature { static celsius_t degTargetBed() { return temp_bed.target; } static bool isHeatingBed() { return temp_bed.target > temp_bed.celsius; } static bool isCoolingBed() { return temp_bed.target < temp_bed.celsius; } + static bool degBedNear(const celsius_t temp) { + return ABS(wholeDegBed() - temp) < (TEMP_BED_HYSTERESIS); + } // Start watching the Bed to make sure it's really heating up static void start_watching_bed() { TERN_(WATCH_BED, watch_bed.restart(degBed(), degTargetBed())); } @@ -835,9 +841,7 @@ class Temperature { static void wait_for_bed_heating(); - static bool degBedNear(const celsius_t temp) { - return ABS(wholeDegBed() - temp) < (TEMP_BED_HYSTERESIS); - } + static void manage_heated_bed(const millis_t &ms); #endif // HAS_HEATED_BED @@ -863,6 +867,7 @@ class Temperature { static bool isHeatingChamber() { return temp_chamber.target > temp_chamber.celsius; } static bool isCoolingChamber() { return temp_chamber.target < temp_chamber.celsius; } static bool wait_for_chamber(const bool no_wait_for_cooling=true); + static void manage_heated_chamber(const millis_t &ms); #endif #endif @@ -886,6 +891,7 @@ class Temperature { static bool isLaserHeating() { return temp_cooler.target > temp_cooler.celsius; } static bool isLaserCooling() { return temp_cooler.target < temp_cooler.celsius; } static bool wait_for_cooler(const bool no_wait_for_cooling=true); + static void manage_cooler(const millis_t &ms); #endif #endif diff --git a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp index a681af4efa63..7d698247e565 100644 --- a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp +++ b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp @@ -62,7 +62,7 @@ #define USB_HOST_MANUAL_POLL // Optimization to shut off IRQ automatically // Workarounds to keep Marlin's watchdog timer from barking... - void marlin_yield() { thermalManager.manage_heater(); } + void marlin_yield() { thermalManager.task(); } #define SYSTEM_OR_SPECIAL_YIELD(...) marlin_yield(); #define delay(x) safe_delay(x) From fc287b44da27d435e588f7d83ae61dcb4e929a5b Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Sun, 3 Jul 2022 09:08:43 -0700 Subject: [PATCH 226/241] =?UTF-8?q?=F0=9F=9A=B8=20MPCTEMP:=20Home=20before?= =?UTF-8?q?=20cooling=20(#24434)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/temperature.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 0de922d1a823..9bdc6eced71c 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -918,13 +918,13 @@ volatile bool Temperature::raw_temps_ready = false; MPC_t &constants = hotend.constants; // Move to center of bed, just above bed height and cool with max fan + gcode.home_all_axes(true); disable_all_heaters(); #if HAS_FAN zero_fan_speeds(); set_fan_speed(ANY(MPC_FAN_0_ALL_HOTENDS, MPC_FAN_0_ACTIVE_HOTEND) ? 0 : active_extruder, 255); planner.sync_fan_speeds(fan_speed); #endif - gcode.home_all_axes(true); const xyz_pos_t tuningpos = MPC_TUNING_POS; do_blocking_move_to(tuningpos); From 954b4493d23eaa849d0de4d9250aa10ec7ae527b Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Mon, 4 Jul 2022 00:26:42 +0000 Subject: [PATCH 227/241] [cron] Bump distribution date (2022-07-04) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index a27b62a2e871..97119203f6b5 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-07-03" +//#define STRING_DISTRIBUTION_DATE "2022-07-04" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 56a5860231ac..255a3bf46b7a 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-07-03" + #define STRING_DISTRIBUTION_DATE "2022-07-04" #endif /** From e94fa7d5dc41f26b82891b664b9a9812372747ba Mon Sep 17 00:00:00 2001 From: EvilGremlin <22657714+EvilGremlin@users.noreply.github.com> Date: Mon, 4 Jul 2022 04:49:23 +0300 Subject: [PATCH 228/241] =?UTF-8?q?=F0=9F=94=A8=20Fix=20OpenBLT=20encode;?= =?UTF-8?q?=20no-bootloader=20envs=20(#24446)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/pins.h | 6 +-- buildroot/share/PlatformIO/scripts/openblt.py | 6 +-- ini/stm32f4.ini | 46 ++++++++++++++----- 3 files changed, 40 insertions(+), 18 deletions(-) diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index f94de8363b93..bdebb25969e6 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -678,15 +678,15 @@ #elif MB(MKS_ROBIN_NANO_V3_1) #include "stm32f4/pins_MKS_ROBIN_NANO_V3.h" // STM32F4 env:mks_robin_nano_v3_1 env:mks_robin_nano_v3_1_usb_flash_drive env:mks_robin_nano_v3_1_usb_flash_drive_msc #elif MB(ANET_ET4) - #include "stm32f4/pins_ANET_ET4.h" // STM32F4 env:Anet_ET4_OpenBLT + #include "stm32f4/pins_ANET_ET4.h" // STM32F4 env:Anet_ET4_no_bootloader env:Anet_ET4_OpenBLT #elif MB(ANET_ET4P) - #include "stm32f4/pins_ANET_ET4P.h" // STM32F4 env:Anet_ET4_OpenBLT + #include "stm32f4/pins_ANET_ET4P.h" // STM32F4 env:Anet_ET4_no_bootloader env:Anet_ET4_OpenBLT #elif MB(FYSETC_CHEETAH_V20) #include "stm32f4/pins_FYSETC_CHEETAH_V20.h" // STM32F4 env:FYSETC_CHEETAH_V20 #elif MB(MKS_MONSTER8) #include "stm32f4/pins_MKS_MONSTER8.h" // STM32F4 env:mks_monster8 env:mks_monster8_usb_flash_drive env:mks_monster8_usb_flash_drive_msc #elif MB(TH3D_EZBOARD_V2) - #include "stm32f4/pins_TH3D_EZBOARD_V2.h" // STM32F4 env:TH3D_EZBoard_V2 + #include "stm32f4/pins_TH3D_EZBOARD_V2.h" // STM32F4 env:TH3D_EZBoard_V2_no_bootloader env:TH3D_EZBoard_V2_OpenBLT #elif MB(OPULO_LUMEN_REV3) #include "stm32f4/pins_OPULO_LUMEN_REV3.h" // STM32F4 env:Opulo_Lumen_REV3 #elif MB(MKS_ROBIN_NANO_V1_3_F4) diff --git a/buildroot/share/PlatformIO/scripts/openblt.py b/buildroot/share/PlatformIO/scripts/openblt.py index 61b38a5e87f7..33e82898f7b4 100644 --- a/buildroot/share/PlatformIO/scripts/openblt.py +++ b/buildroot/share/PlatformIO/scripts/openblt.py @@ -10,11 +10,11 @@ board = env.BoardConfig() board_keys = board.get("build").keys() - if 'encrypt' in board_keys: + if 'encode' in board_keys: env.AddPostAction( join("$BUILD_DIR", "${PROGNAME}.bin"), env.VerboseAction(" ".join([ "$OBJCOPY", "-O", "srec", - "\"$BUILD_DIR/${PROGNAME}.elf\"", "\"" + join("$BUILD_DIR", board.get("build.encrypt")) + "\"" - ]), "Building $TARGET") + "\"$BUILD_DIR/${PROGNAME}.elf\"", "\"" + join("$BUILD_DIR", board.get("build.encode")) + "\"" + ]), "Building " + board.get("build.encode")) ) diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 8da73f0f4088..ddb944e80f61 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -106,24 +106,34 @@ extra_scripts = ${stm32_variant.extra_scripts} # # Anet ET4-MB_V1.x/ET4P-MB_V1.x (STM32F407VGT6 ARM Cortex-M4) -# For use with with davidtgbe's OpenBLT bootloader https://github.com/davidtgbe/openblt/releases -# Comment out board_build.offset = 0x10000 if you don't plan to use OpenBLT/flashing directly to 0x08000000. # -[env:Anet_ET4_OpenBLT] +[Anet_ET4] extends = stm32_variant board = marlin_STM32F407VGT6_CCM board_build.variant = MARLIN_F4x7Vx -board_build.encrypt_mks = firmware.srec -board_build.offset = 0x10000 -board_upload.offset_address = 0x08010000 build_flags = ${stm32_variant.build_flags} -DHAL_SD_MODULE_ENABLED -DHAL_SRAM_MODULE_ENABLED build_unflags = ${stm32_variant.build_unflags} -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483 + +# +# Anet ET4 directly flashed via ST-Link +# +[env:Anet_ET4_no_bootloader] +extends = Anet_ET4 +debug_tool = stlink +upload_protocol = stlink + +# +# Anet ET4 with OpenBLT from https://github.com/davidtgbe/openblt/releases +# +[env:Anet_ET4_OpenBLT] +extends = Anet_ET4 +board_build.encode = firmware.srec +board_build.offset = 0x10000 +board_upload.offset_address = 0x08010000 extra_scripts = ${stm32_variant.extra_scripts} buildroot/share/PlatformIO/scripts/openblt.py -debug_tool = jlink -upload_protocol = jlink # # BigTreeTech SKR Pro (STM32F407ZGT6 ARM Cortex-M4) @@ -546,16 +556,28 @@ build_unflags = -DUSBD_USE_CDC # # TH3D EZBoard v2.0 (STM32F405RGT6 ARM Cortex-M4) # -[env:TH3D_EZBoard_V2] +[TH3D_EZBoard_V2] extends = stm32_variant board = genericSTM32F405RG board_build.variant = MARLIN_TH3D_EZBOARD_V2 -board_build.encrypt_mks = firmware.bin -board_build.offset = 0xC000 -board_upload.offset_address = 0x0800C000 build_flags = ${stm32_variant.build_flags} -DHSE_VALUE=12000000U -O0 + +# +# TH3D EZBoard v2.0 directly flashed via ST-Link +# +[env:TH3D_EZBoard_V2_no_bootloader] +extends = TH3D_EZBoard_V2 debug_tool = stlink upload_protocol = stlink + +# +# TH3D EZBoard v2.0 with OpenBLT from https://github.com/rhapsodyv/OpenBLT-STM32 +# +[env:TH3D_EZBoard_V2_OpenBLT] +extends = TH3D_EZBoard_V2 +board_build.encode = firmware.bin +board_build.offset = 0xC000 +board_upload.offset_address = 0x0800C000 extra_scripts = ${stm32_variant.extra_scripts} buildroot/share/PlatformIO/scripts/openblt.py From f39e2bc1e428e540e5b031577dce683fb6811cea Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 3 Jul 2022 23:44:06 -0500 Subject: [PATCH 229/241] =?UTF-8?q?=F0=9F=A9=B9=20Followup=20for=20lchar?= =?UTF-8?q?=5Ft?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp | 8 ++--- Marlin/src/lcd/TFTGLCD/lcdprint_TFTGLCD.cpp | 8 ++--- Marlin/src/lcd/dogm/u8g_fontutf8.cpp | 14 ++++----- Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp | 28 ++++++++--------- Marlin/src/lcd/e3v2/marlinui/dwin_string.h | 6 ++-- .../src/lcd/e3v2/marlinui/lcdprint_dwin.cpp | 8 ++--- Marlin/src/lcd/fontutils.cpp | 2 -- Marlin/src/lcd/fontutils.h | 14 +++++++-- Marlin/src/lcd/lcdprint.cpp | 30 +++++++++---------- Marlin/src/lcd/marlinui.cpp | 20 ++++++------- Marlin/src/lcd/tft/tft_string.cpp | 16 +++++----- 11 files changed, 80 insertions(+), 74 deletions(-) diff --git a/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp b/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp index 191485c058b7..fe31c21e3959 100644 --- a/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp +++ b/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp @@ -1051,10 +1051,10 @@ static int lcd_put_u8str_max_cb(const char * utf8_str, read_byte_cb_t cb_read_by pixel_len_t ret = 0; const uint8_t *p = (uint8_t *)utf8_str; while (ret < max_length) { - lchar_t ch; - p = get_utf8_value_cb(p, cb_read_byte, ch); - if (!ch) break; - ret += lcd_put_lchar_max(ch, max_length - ret); + lchar_t wc; + p = get_utf8_value_cb(p, cb_read_byte, wc); + if (!wc) break; + ret += lcd_put_lchar_max(wc, max_length - ret); } return (int)ret; } diff --git a/Marlin/src/lcd/TFTGLCD/lcdprint_TFTGLCD.cpp b/Marlin/src/lcd/TFTGLCD/lcdprint_TFTGLCD.cpp index 17f1e702a8ea..e681ff0a9170 100644 --- a/Marlin/src/lcd/TFTGLCD/lcdprint_TFTGLCD.cpp +++ b/Marlin/src/lcd/TFTGLCD/lcdprint_TFTGLCD.cpp @@ -1049,10 +1049,10 @@ static int lcd_put_u8str_max_cb(const char * utf8_str, read_byte_cb_t cb_read_by pixel_len_t ret = 0; const uint8_t *p = (uint8_t *)utf8_str; while (ret < max_length) { - lchar_t ch; - p = get_utf8_value_cb(p, cb_read_byte, ch); - if (!ch) break; - ret += lcd_put_lchar_max(ch, max_length - ret); + lchar_t wc; + p = get_utf8_value_cb(p, cb_read_byte, wc); + if (!wc) break; + ret += lcd_put_lchar_max(wc, max_length - ret); } return (int)ret; } diff --git a/Marlin/src/lcd/dogm/u8g_fontutf8.cpp b/Marlin/src/lcd/dogm/u8g_fontutf8.cpp index b92210d9a73a..d5e0e5bafff3 100644 --- a/Marlin/src/lcd/dogm/u8g_fontutf8.cpp +++ b/Marlin/src/lcd/dogm/u8g_fontutf8.cpp @@ -106,10 +106,10 @@ static void fontgroup_drawwchar(font_group_t *group, const font_t *fnt_default, static void fontgroup_drawstring(font_group_t *group, const font_t *fnt_default, const char *utf8_msg, read_byte_cb_t cb_read_byte, void * userdata, fontgroup_cb_draw_t cb_draw_ram) { const uint8_t *p = (uint8_t*)utf8_msg; for (;;) { - lchar_t ch; - p = get_utf8_value_cb(p, cb_read_byte, ch); - if (!ch) break; - fontgroup_drawwchar(group, fnt_default, ch, userdata, cb_draw_ram); + lchar_t wc; + p = get_utf8_value_cb(p, cb_read_byte, wc); + if (!wc) break; + fontgroup_drawwchar(group, fnt_default, wc, userdata, cb_draw_ram); } } @@ -154,14 +154,14 @@ static int fontgroup_cb_draw_u8g(void *userdata, const font_t *fnt_current, cons * @param pu8g : U8G pointer * @param x : position x axis * @param y : position y axis - * @param ch : the lchar_t + * @param wc : the lchar_t * @param max_width : the pixel width of the string allowed * * @return number of pixels advanced * * Draw a UTF-8 string at the specified position */ -unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, const lchar_t &ch, pixel_len_t max_width) { +unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, const lchar_t &wc, pixel_len_t max_width) { struct _uxg_drawu8_data_t data; font_group_t *group = &g_fontgroup_root; const font_t *fnt_default = uxg_GetFont(pu8g); @@ -176,7 +176,7 @@ unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, const lc data.adv = 0; data.max_width = max_width; data.fnt_prev = nullptr; - fontgroup_drawwchar(group, fnt_default, ch, (void*)&data, fontgroup_cb_draw_u8g); + fontgroup_drawwchar(group, fnt_default, wc, (void*)&data, fontgroup_cb_draw_u8g); u8g_SetFont(pu8g, (const u8g_fntpgm_uint8_t*)fnt_default); return data.adv; diff --git a/Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp b/Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp index 246f7ebb39c4..38a8eafe2366 100644 --- a/Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp @@ -50,12 +50,12 @@ uint8_t read_byte(const uint8_t *byte) { return *byte; } * @ displays an axis name such as XYZUVW, or E for an extruder */ void DWIN_String::add(const char *tpl, const int8_t index, const char *cstr/*=nullptr*/, FSTR_P const fstr/*=nullptr*/) { - lchar_t ch; + lchar_t wc; while (*tpl) { - tpl = get_utf8_value_cb(tpl, read_byte, ch); - if (ch > 255) ch |= 0x0080; - const uint8_t ch = uint8_t(ch & 0x00FF); + tpl = get_utf8_value_cb(tpl, read_byte, wc); + if (wc > 255) wc |= 0x0080; + const uint8_t ch = uint8_t(wc & 0x00FF); if (ch == '=' || ch == '~' || ch == '*') { if (index >= 0) { @@ -80,32 +80,32 @@ void DWIN_String::add(const char *tpl, const int8_t index, const char *cstr/*=nu } void DWIN_String::add(const char *cstr, uint8_t max_len/*=MAX_STRING_LENGTH*/) { - lchar_t ch; + lchar_t wc; while (*cstr && max_len) { - cstr = get_utf8_value_cb(cstr, read_byte, ch); + cstr = get_utf8_value_cb(cstr, read_byte, wc); /* - if (ch > 255) ch |= 0x0080; - uint8_t ch = uint8_t(ch & 0x00FF); + if (wc > 255) wc |= 0x0080; + const uint8_t ch = uint8_t(wc & 0x00FF); add_character(ch); */ - add(ch); + add(wc); max_len--; } eol(); } -void DWIN_String::add(const lchar_t &ch) { +void DWIN_String::add(const lchar_t &wc) { int ret; size_t idx = 0; dwin_charmap_t pinval; dwin_charmap_t *copy_address = nullptr; - pinval.uchar = ch; + pinval.uchar = wc; pinval.idx = -1; - // For 8-bit ASCII just print the single ch + // For 8-bit ASCII just print the single character char str[] = { '?', 0 }; - if (ch < 255) { - str[0] = (char)ch; + if (wc < 255) { + str[0] = (char)wc; } else { copy_address = nullptr; diff --git a/Marlin/src/lcd/e3v2/marlinui/dwin_string.h b/Marlin/src/lcd/e3v2/marlinui/dwin_string.h index c7218817aac9..686b1aa2b17a 100644 --- a/Marlin/src/lcd/e3v2/marlinui/dwin_string.h +++ b/Marlin/src/lcd/e3v2/marlinui/dwin_string.h @@ -69,10 +69,10 @@ class DWIN_String { /** * @brief Append a UTF-8 character * - * @param ch The UTF-8 character + * @param wc The UTF-8 character */ - static void add(const lchar_t &ch); - static void set(const lchar_t &ch) { set(); add(ch); } + static void add(const lchar_t &wc); + static void set(const lchar_t &wc) { set(); add(wc); } /** * @brief Append / Set C-string diff --git a/Marlin/src/lcd/e3v2/marlinui/lcdprint_dwin.cpp b/Marlin/src/lcd/e3v2/marlinui/lcdprint_dwin.cpp index f6035370ad55..e603882e0cfd 100644 --- a/Marlin/src/lcd/e3v2/marlinui/lcdprint_dwin.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/lcdprint_dwin.cpp @@ -87,10 +87,10 @@ static int lcd_put_u8str_max_cb(const char * utf8_str, read_byte_cb_t cb_read_by const uint8_t *p = (uint8_t *)utf8_str; dwin_string.set(); while (dwin_string.length < max_length) { - lchar_t ch; - p = get_utf8_value_cb(p, cb_read_byte, ch); - if (!ch) break; - dwin_string.add(ch); + lchar_t wc; + p = get_utf8_value_cb(p, cb_read_byte, wc); + if (!wc) break; + dwin_string.add(wc); } DWIN_Draw_String(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, dwin_string.string()); lcd_advance_cursor(dwin_string.length); diff --git a/Marlin/src/lcd/fontutils.cpp b/Marlin/src/lcd/fontutils.cpp index 863c553b5731..46329fd4be62 100644 --- a/Marlin/src/lcd/fontutils.cpp +++ b/Marlin/src/lcd/fontutils.cpp @@ -31,8 +31,6 @@ #include "../inc/MarlinConfig.h" -#define MAX_UTF8_CHAR_SIZE 4 - #if HAS_WIRED_LCD #include "marlinui.h" #include "../MarlinCore.h" diff --git a/Marlin/src/lcd/fontutils.h b/Marlin/src/lcd/fontutils.h index 453db2a36c9d..69edf1a0c839 100644 --- a/Marlin/src/lcd/fontutils.h +++ b/Marlin/src/lcd/fontutils.h @@ -38,15 +38,23 @@ #define MAX_UTF8_CHAR_SIZE 4 +// Use a longer character type (if needed) because wchar_t is only 16 bits wide +#ifdef MAX_UTF8_CHAR_SIZE + #if MAX_UTF8_CHAR_SIZE > 2 + typedef uint32_t lchar_t; + #else + typedef wchar_t lchar_t; + #endif +#else + #define wchar_t uint32_t +#endif + // read a byte from ROM or RAM typedef uint8_t (*read_byte_cb_t)(const uint8_t * str); uint8_t read_byte_ram(const uint8_t *str); uint8_t read_byte_rom(const uint8_t *str); -// An extra long character type because wchar_t is only 2 bytes -typedef uint32_t lchar_t; - typedef uint16_t pixel_len_t; #define PIXEL_LEN_NOLIMIT ((pixel_len_t)(-1)) diff --git a/Marlin/src/lcd/lcdprint.cpp b/Marlin/src/lcd/lcdprint.cpp index c3b18ef78bbc..7757379ac9d2 100644 --- a/Marlin/src/lcd/lcdprint.cpp +++ b/Marlin/src/lcd/lcdprint.cpp @@ -47,14 +47,14 @@ lcd_uint_t lcd_put_u8str_P(PGM_P const ptpl, const int8_t ind, const char *cstr/ const uint8_t *p = (uint8_t*)ptpl; int8_t n = maxlen; while (n > 0) { - lchar_t ch; - p = get_utf8_value_cb(p, read_byte_rom, ch); - if (!ch) break; - if (ch == '=' || ch == '~' || ch == '*') { + lchar_t wc; + p = get_utf8_value_cb(p, read_byte_rom, wc); + if (!wc) break; + if (wc == '=' || wc == '~' || wc == '*') { if (ind >= 0) { - if (ch == '*') { lcd_put_lchar('E'); n--; } + if (wc == '*') { lcd_put_lchar('E'); n--; } if (n) { - int8_t inum = ind + ((ch == '=') ? 0 : LCD_FIRST_TOOL); + int8_t inum = ind + ((wc == '=') ? 0 : LCD_FIRST_TOOL); if (inum >= 10) { lcd_put_lchar('0' + (inum / 10)); n--; inum %= 10; @@ -71,19 +71,19 @@ lcd_uint_t lcd_put_u8str_P(PGM_P const ptpl, const int8_t ind, const char *cstr/ break; } } - else if (ch == '$' && fstr) { + else if (wc == '$' && fstr) { n -= lcd_put_u8str_max_P(FTOP(fstr), n * (MENU_FONT_WIDTH)) / (MENU_FONT_WIDTH); } - else if (ch == '$' && cstr) { + else if (wc == '$' && cstr) { n -= lcd_put_u8str_max(cstr, n * (MENU_FONT_WIDTH)) / (MENU_FONT_WIDTH); } - else if (ch == '@') { + else if (wc == '@') { lcd_put_lchar(AXIS_CHAR(ind)); n--; } else { - lcd_put_lchar(ch); - n -= ch > 255 ? prop : 1; + lcd_put_lchar(wc); + n -= wc > 255 ? prop : 1; } } return n; @@ -97,10 +97,10 @@ int calculateWidth(PGM_P const pstr) { int n = 0; do { - lchar_t ch; - p = get_utf8_value_cb(p, read_byte_rom, ch); - if (!ch) break; - n += (ch > 255) ? prop : 1; + lchar_t wc; + p = get_utf8_value_cb(p, read_byte_rom, wc); + if (!wc) break; + n += (wc > 255) ? prop : 1; } while (1); return n * MENU_FONT_WIDTH; diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 4d80ca140548..7d9cb1b679d6 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -417,26 +417,26 @@ void MarlinUI::init() { }; const uint8_t *p = (uint8_t*)string; - lchar_t ch; + lchar_t wc; if (wordwrap) { const uint8_t *wrd = nullptr; uint8_t c = 0; // find the end of the part for (;;) { if (!wrd) wrd = p; // Get word start /before/ advancing - p = get_utf8_value_cb(p, cb_read_byte, ch); - const bool eol = !ch; // zero ends the string + p = get_utf8_value_cb(p, cb_read_byte, wc); + const bool eol = !wc; // zero ends the string // End or a break between phrases? - if (eol || ch == ' ' || ch == '-' || ch == '+' || ch == '.') { - if (!c && ch == ' ') { if (wrd) wrd++; continue; } // collapse extra spaces + if (eol || wc == ' ' || wc == '-' || wc == '+' || wc == '.') { + if (!c && wc == ' ') { if (wrd) wrd++; continue; } // collapse extra spaces // Past the right and the word is not too long? if (col + c > LCD_WIDTH && col >= (LCD_WIDTH) / 4) _newline(); // should it wrap? c += !eol; // +1 so the space will be printed col += c; // advance col to new position while (c) { // character countdown --c; // count down to zero - wrd = get_utf8_value_cb(wrd, cb_read_byte, ch); // get characters again - lcd_put_lchar(ch); // character to the LCD + wrd = get_utf8_value_cb(wrd, cb_read_byte, wc); // get characters again + lcd_put_lchar(wc); // character to the LCD } if (eol) break; // all done! wrd = nullptr; // set up for next word @@ -446,9 +446,9 @@ void MarlinUI::init() { } else { for (;;) { - p = get_utf8_value_cb(p, cb_read_byte, ch); - if (!ch) break; - lcd_put_lchar(ch); + p = get_utf8_value_cb(p, cb_read_byte, wc); + if (!wc) break; + lcd_put_lchar(wc); col++; if (col >= LCD_WIDTH) _newline(); } diff --git a/Marlin/src/lcd/tft/tft_string.cpp b/Marlin/src/lcd/tft/tft_string.cpp index 15bcf9f47b71..d589b0465b7f 100644 --- a/Marlin/src/lcd/tft/tft_string.cpp +++ b/Marlin/src/lcd/tft/tft_string.cpp @@ -94,12 +94,12 @@ void TFT_String::set() { * @ displays an axis name such as XYZUVW, or E for an extruder */ void TFT_String::add(const char *tpl, const int8_t index, const char *cstr/*=nullptr*/, FSTR_P const fstr/*=nullptr*/) { - lchar_t ch; + lchar_t wc; while (*tpl) { - tpl = get_utf8_value_cb(tpl, read_byte_ram, ch); - if (ch > 255) ch |= 0x0080; - const uint8_t ch = uint8_t(ch & 0x00FF); + tpl = get_utf8_value_cb(tpl, read_byte_ram, wc); + if (wc > 255) wc |= 0x0080; + const uint8_t ch = uint8_t(wc & 0x00FF); if (ch == '=' || ch == '~' || ch == '*') { if (index >= 0) { @@ -124,11 +124,11 @@ void TFT_String::add(const char *tpl, const int8_t index, const char *cstr/*=nul } void TFT_String::add(const char *cstr, uint8_t max_len/*=MAX_STRING_LENGTH*/) { - lchar_t ch; + lchar_t wc; while (*cstr && max_len) { - cstr = get_utf8_value_cb(cstr, read_byte_ram, ch); - if (ch > 255) ch |= 0x0080; - const uint8_t ch = uint8_t(ch & 0x00FF); + cstr = get_utf8_value_cb(cstr, read_byte_ram, wc); + if (wc > 255) wc |= 0x0080; + const uint8_t ch = uint8_t(wc & 0x00FF); add_character(ch); max_len--; } From e08b293b544f3f2add2bc1fbe6ac75dfe4a4af04 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Sun, 3 Jul 2022 22:31:06 -0700 Subject: [PATCH 230/241] =?UTF-8?q?=E2=9C=A8=20BigTreeTech=20SKR=20SE=20BX?= =?UTF-8?q?=20V3.0=20(#24449)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SKR SE BX V3.0 removes the Reverse Driver Protection feature. --- Marlin/src/core/boards.h | 7 +++-- Marlin/src/pins/pins.h | 10 +++++-- .../src/pins/stm32h7/pins_BTT_SKR_SE_BX_V2.h | 28 +++++++++++++++++++ .../src/pins/stm32h7/pins_BTT_SKR_SE_BX_V3.h | 26 +++++++++++++++++ ...KR_SE_BX.h => pins_BTT_SKR_SE_BX_common.h} | 4 +-- ini/stm32h7.ini | 2 +- 6 files changed, 68 insertions(+), 9 deletions(-) create mode 100644 Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX_V2.h create mode 100644 Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX_V3.h rename Marlin/src/pins/stm32h7/{pins_BTT_SKR_SE_BX.h => pins_BTT_SKR_SE_BX_common.h} (98%) diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index f6b30c6cffa5..72c7e22541f5 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -428,9 +428,10 @@ #define BOARD_TEENSY41 5001 // Teensy 4.1 #define BOARD_T41U5XBB 5002 // T41U5XBB Teensy 4.1 breakout board #define BOARD_NUCLEO_F767ZI 5003 // ST NUCLEO-F767ZI Dev Board -#define BOARD_BTT_SKR_SE_BX 5004 // BigTreeTech SKR SE BX (STM32H743II) -#define BOARD_BTT_SKR_V3_0 5005 // BigTreeTech SKR V3.0 (STM32H743VG) -#define BOARD_BTT_SKR_V3_0_EZ 5006 // BigTreeTech SKR V3.0 EZ (STM32H743VG) +#define BOARD_BTT_SKR_SE_BX_V2 5004 // BigTreeTech SKR SE BX V2.0 (STM32H743II) +#define BOARD_BTT_SKR_SE_BX_V3 5005 // BigTreeTech SKR SE BX V3.0 (STM32H743II) +#define BOARD_BTT_SKR_V3_0 5006 // BigTreeTech SKR V3.0 (STM32H743VG) +#define BOARD_BTT_SKR_V3_0_EZ 5007 // BigTreeTech SKR V3.0 EZ (STM32H743VG) // // Espressif ESP32 WiFi diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index bdebb25969e6..2a29c66d8acc 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -706,8 +706,10 @@ #include "stm32f7/pins_REMRAM_V1.h" // STM32F7 env:REMRAM_V1 #elif MB(NUCLEO_F767ZI) #include "stm32f7/pins_NUCLEO_F767ZI.h" // STM32F7 env:NUCLEO_F767ZI -#elif MB(BTT_SKR_SE_BX) - #include "stm32h7/pins_BTT_SKR_SE_BX.h" // STM32H7 env:BTT_SKR_SE_BX +#elif MB(BTT_SKR_SE_BX_V2) + #include "stm32h7/pins_BTT_SKR_SE_BX_V2.h" // STM32H7 env:BTT_SKR_SE_BX +#elif MB(BTT_SKR_SE_BX_V3) + #include "stm32h7/pins_BTT_SKR_SE_BX_V3.h" // STM32H7 env:BTT_SKR_SE_BX #elif MB(BTT_SKR_V3_0) #include "stm32h7/pins_BTT_SKR_V3_0.h" // STM32H7 env:STM32H743Vx_btt #elif MB(BTT_SKR_V3_0_EZ) @@ -797,6 +799,7 @@ #define BOARD_RAMPS_LONGER3D_LK4PRO 99921 #define BOARD_BTT_SKR_V2_0 99922 #define BOARD_TH3D_EZBOARD_LITE_V2 99923 + #define BOARD_BTT_SKR_SE_BX 99924 #if MB(MKS_13) #error "BOARD_MKS_13 has been renamed BOARD_MKS_GEN_13. Please update your configuration." @@ -848,6 +851,8 @@ #error "BOARD_BTT_SKR_V2_0 is now BOARD_BTT_SKR_V2_0_REV_A or BOARD_BTT_SKR_V2_0_REV_B. See https://bit.ly/3t5d9JQ for more information. Please update your configuration." #elif MB(TH3D_EZBOARD_LITE_V2) #error "BOARD_TH3D_EZBOARD_LITE_V2 is now BOARD_TH3D_EZBOARD_V2. Please update your configuration." + #elif MB(BTT_SKR_SE_BX) + #error "BOARD_BTT_SKR_SE_BX is now BOARD_BTT_SKR_SE_BX_V2 or BOARD_BTT_SKR_SE_BX_V3. Please update your configuration." #elif defined(MOTHERBOARD) #error "Unknown MOTHERBOARD value set in Configuration.h." #else @@ -878,6 +883,7 @@ #undef BOARD_RAMPS_LONGER3D_LK4PRO #undef BOARD_BTT_SKR_V2_0 #undef BOARD_TH3D_EZBOARD_LITE_V2 + #undef BOARD_BTT_SKR_SE_BX #endif diff --git a/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX_V2.h b/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX_V2.h new file mode 100644 index 000000000000..8be6dadee43b --- /dev/null +++ b/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX_V2.h @@ -0,0 +1,28 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +#define BOARD_INFO_NAME "BTT SKR SE BX V2.0" + +#define SAFE_POWER_PIN PI11 + +#include "pins_BTT_SKR_SE_BX_common.h" diff --git a/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX_V3.h b/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX_V3.h new file mode 100644 index 000000000000..8d8143ee622b --- /dev/null +++ b/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX_V3.h @@ -0,0 +1,26 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +#define BOARD_INFO_NAME "BTT SKR SE BX V3.0" + +#include "pins_BTT_SKR_SE_BX_common.h" diff --git a/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h b/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX_common.h similarity index 98% rename from Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h rename to Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX_common.h index ddc0a202ea30..1ee7846c9315 100644 --- a/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h +++ b/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX_common.h @@ -25,8 +25,7 @@ #error "Oops! Select an STM32H7 board in 'Tools > Board.'" #endif -#define BOARD_INFO_NAME "BTT SKR SE BX" -#define DEFAULT_MACHINE_NAME "BIQU-BX" +#define DEFAULT_MACHINE_NAME "Biqu BX" // Onboard I2C EEPROM #define I2C_EEPROM @@ -56,7 +55,6 @@ #define POWER_MONITOR_PIN PB0 #define RPI_POWER_PIN PE5 -#define SAFE_POWER_PIN PI11 #define SERVO0_PIN PA2 // diff --git a/ini/stm32h7.ini b/ini/stm32h7.ini index c5d7d6299a1e..fb898d1b72b1 100644 --- a/ini/stm32h7.ini +++ b/ini/stm32h7.ini @@ -20,7 +20,7 @@ ################################# # -# BigTreeTech SKR SE BX (STM32H743IIT6 ARM Cortex-M7) +# BigTreeTech SKR SE BX V2.0 / V3.0 (STM32H743IIT6 ARM Cortex-M7) # [env:BTT_SKR_SE_BX] extends = stm32_variant From 132c37a6511c89306a60c7663265aef257b007f5 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 5 Jul 2022 00:21:32 +0000 Subject: [PATCH 231/241] [cron] Bump distribution date (2022-07-05) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 97119203f6b5..5cf727a48f81 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-07-04" +//#define STRING_DISTRIBUTION_DATE "2022-07-05" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 255a3bf46b7a..d073ed5b232e 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-07-04" + #define STRING_DISTRIBUTION_DATE "2022-07-05" #endif /** From 6a67ad4e4aacf7e7314f9e15fd8fe8489b73742b Mon Sep 17 00:00:00 2001 From: Mike La Spina Date: Wed, 6 Jul 2022 07:46:39 -0500 Subject: [PATCH 232/241] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Fix=20and=20improv?= =?UTF-8?q?e=20Inline=20Laser=20Power=20(#22690)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 104 ++----- Marlin/src/feature/spindle_laser.cpp | 88 +++--- Marlin/src/feature/spindle_laser.h | 333 ++++++++++----------- Marlin/src/feature/spindle_laser_types.h | 6 +- Marlin/src/gcode/calibrate/G28.cpp | 9 +- Marlin/src/gcode/control/M3-M5.cpp | 134 +++++---- Marlin/src/gcode/gcode.cpp | 37 ++- Marlin/src/inc/SanityCheck.h | 45 +-- Marlin/src/lcd/dogm/status_screen_DOGM.cpp | 2 +- Marlin/src/lcd/menu/menu_item.h | 5 + Marlin/src/lcd/menu/menu_spindle_laser.cpp | 18 +- Marlin/src/module/planner.cpp | 286 ++++++++++-------- Marlin/src/module/planner.h | 92 +++--- Marlin/src/module/stepper.cpp | 236 +++++++-------- Marlin/src/module/stepper.h | 19 -- Marlin/src/module/temperature.cpp | 5 +- buildroot/tests/mega2560 | 4 +- docs/Cutter.md | 137 +++++++++ 18 files changed, 848 insertions(+), 712 deletions(-) create mode 100644 docs/Cutter.md diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index b085ec7ec4a9..db664477f44c 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -3668,8 +3668,11 @@ #endif // Define the minimum and maximum test pulse time values for a laser test fire function - #define LASER_TEST_PULSE_MIN 1 // Used with Laser Control Menu - #define LASER_TEST_PULSE_MAX 999 // Caution: Menu may not show more than 3 characters + #define LASER_TEST_PULSE_MIN 1 // (ms) Used with Laser Control Menu + #define LASER_TEST_PULSE_MAX 999 // (ms) Caution: Menu may not show more than 3 characters + + #define SPINDLE_LASER_POWERUP_DELAY 50 // (ms) Delay to allow the spindle/laser to come up to speed/power + #define SPINDLE_LASER_POWERDOWN_DELAY 50 // (ms) Delay to allow the spindle to stop /** * Laser Safety Timeout @@ -3682,79 +3685,38 @@ #define LASER_SAFETY_TIMEOUT_MS 1000 // (ms) /** - * Enable inline laser power to be handled in the planner / stepper routines. - * Inline power is specified by the I (inline) flag in an M3 command (e.g., M3 S20 I) - * or by the 'S' parameter in G0/G1/G2/G3 moves (see LASER_MOVE_POWER). + * Any M3 or G1/2/3/5 command with the 'I' parameter enables continuous inline power mode. + * + * e.g., 'M3 I' enables continuous inline power which is processed by the planner. + * Power is stored in move blocks and applied when blocks are processed by the Stepper ISR. + * + * 'M4 I' sets dynamic mode which uses the current feedrate to calculate a laser power OCR value. * - * This allows the laser to keep in perfect sync with the planner and removes - * the powerup/down delay since lasers require negligible time. + * Any move in dynamic mode will use the current feedrate to calculate the laser power. + * Feed rates are set by the F parameter of a move command e.g. G1 X0 Y10 F6000 + * Laser power would be calculated by bit shifting off 8 LSB's. In binary this is div 256. + * The calculation gives us ocr values from 0 to 255, values over F65535 will be set as 255 . + * More refined power control such as compesation for accell/decell will be addressed in future releases. + * + * M5 I clears inline mode and set power to 0, M5 sets the power output to 0 but leaves inline mode on. */ - //#define LASER_POWER_INLINE - - #if ENABLED(LASER_POWER_INLINE) - /** - * Scale the laser's power in proportion to the movement rate. - * - * - Sets the entry power proportional to the entry speed over the nominal speed. - * - Ramps the power up every N steps to approximate the speed trapezoid. - * - Due to the limited power resolution this is only approximate. - */ - #define LASER_POWER_INLINE_TRAPEZOID - - /** - * Continuously calculate the current power (nominal_power * current_rate / nominal_rate). - * Required for accurate power with non-trapezoidal acceleration (e.g., S_CURVE_ACCELERATION). - * This is a costly calculation so this option is discouraged on 8-bit AVR boards. - * - * LASER_POWER_INLINE_TRAPEZOID_CONT_PER defines how many step cycles there are between power updates. If your - * board isn't able to generate steps fast enough (and you are using LASER_POWER_INLINE_TRAPEZOID_CONT), increase this. - * Note that when this is zero it means it occurs every cycle; 1 means a delay wait one cycle then run, etc. - */ - //#define LASER_POWER_INLINE_TRAPEZOID_CONT - - /** - * Stepper iterations between power updates. Increase this value if the board - * can't keep up with the processing demands of LASER_POWER_INLINE_TRAPEZOID_CONT. - * Disable (or set to 0) to recalculate power on every stepper iteration. - */ - //#define LASER_POWER_INLINE_TRAPEZOID_CONT_PER 10 - - /** - * Include laser power in G0/G1/G2/G3/G5 commands with the 'S' parameter - */ - //#define LASER_MOVE_POWER - - #if ENABLED(LASER_MOVE_POWER) - // Turn off the laser on G0 moves with no power parameter. - // If a power parameter is provided, use that instead. - //#define LASER_MOVE_G0_OFF - // Turn off the laser on G28 homing. - //#define LASER_MOVE_G28_OFF - #endif - - /** - * Inline flag inverted - * - * WARNING: M5 will NOT turn off the laser unless another move - * is done (so G-code files must end with 'M5 I'). - */ - //#define LASER_POWER_INLINE_INVERT - - /** - * Continuously apply inline power. ('M3 S3' == 'G1 S3' == 'M3 S3 I') - * - * The laser might do some weird things, so only enable this - * feature if you understand the implications. - */ - //#define LASER_POWER_INLINE_CONTINUOUS - - #else - - #define SPINDLE_LASER_POWERUP_DELAY 50 // (ms) Delay to allow the spindle/laser to come up to speed/power - #define SPINDLE_LASER_POWERDOWN_DELAY 50 // (ms) Delay to allow the spindle to stop + /** + * Enable M3 commands for laser mode inline power planner syncing. + * This feature enables any M3 S-value to be injected into the block buffers while in + * CUTTER_MODE_CONTINUOUS. The option allows M3 laser power to be commited without waiting + * for a planner syncronization + */ + //#define LASER_POWER_SYNC - #endif + /** + * Scale the laser's power in proportion to the movement rate. + * + * - Sets the entry power proportional to the entry speed over the nominal speed. + * - Ramps the power up every N steps to approximate the speed trapezoid. + * - Due to the limited power resolution this is only approximate. + */ + //#define LASER_POWER_TRAP // // Laser I2C Ammeter (High precision INA226 low/high side module) diff --git a/Marlin/src/feature/spindle_laser.cpp b/Marlin/src/feature/spindle_laser.cpp index 4f8f4d49dc2f..da38646a3674 100644 --- a/Marlin/src/feature/spindle_laser.cpp +++ b/Marlin/src/feature/spindle_laser.cpp @@ -39,18 +39,26 @@ #endif SpindleLaser cutter; -uint8_t SpindleLaser::power, +bool SpindleLaser::enable_state; // Virtual enable state, controls enable pin if present and or apply power if > 0 +uint8_t SpindleLaser::power, // Actual power output 0-255 ocr or "0 = off" > 0 = "on" SpindleLaser::last_power_applied; // = 0 // Basic power state tracking + #if ENABLED(LASER_FEATURE) - cutter_test_pulse_t SpindleLaser::testPulse = 50; // Test fire Pulse time ms value. + cutter_test_pulse_t SpindleLaser::testPulse = 50; // (ms) Test fire pulse default duration + uint8_t SpindleLaser::last_block_power; // = 0 // Track power changes for dynamic inline power + feedRate_t SpindleLaser::feedrate_mm_m = 1500, + SpindleLaser::last_feedrate_mm_m; // = 0 // (mm/min) Track feedrate changes for dynamic power #endif -bool SpindleLaser::isReady; // Ready to apply power setting from the UI to OCR -cutter_power_t SpindleLaser::menuPower, // Power set via LCD menu in PWM, PERCENT, or RPM - SpindleLaser::unitPower; // LCD status power in PWM, PERCENT, or RPM -#if ENABLED(MARLIN_DEV_MODE) - cutter_frequency_t SpindleLaser::frequency; // PWM frequency setting; range: 2K - 50K -#endif +bool SpindleLaser::isReadyForUI = false; // Ready to apply power setting from the UI to OCR +CutterMode SpindleLaser::cutter_mode = CUTTER_MODE_STANDARD; // Default is standard mode + +constexpr cutter_cpower_t SpindleLaser::power_floor; +cutter_power_t SpindleLaser::menuPower = 0, // Power value via LCD menu in PWM, PERCENT, or RPM based on configured format set by CUTTER_POWER_UNIT. + SpindleLaser::unitPower = 0; // Unit power is in PWM, PERCENT, or RPM based on CUTTER_POWER_UNIT. + +cutter_frequency_t SpindleLaser::frequency; // PWM frequency setting; range: 2K - 50K + #define SPINDLE_LASER_PWM_OFF TERN(SPINDLE_LASER_PWM_INVERT, 255, 0) /** @@ -65,14 +73,14 @@ void SpindleLaser::init() { #if ENABLED(SPINDLE_CHANGE_DIR) OUT_WRITE(SPINDLE_DIR_PIN, SPINDLE_INVERT_DIR); // Init rotation to clockwise (M3) #endif + #if ENABLED(HAL_CAN_SET_PWM_FREQ) && SPINDLE_LASER_FREQUENCY + frequency = SPINDLE_LASER_FREQUENCY; + hal.set_pwm_frequency(pin_t(SPINDLE_LASER_PWM_PIN), SPINDLE_LASER_FREQUENCY); + #endif #if ENABLED(SPINDLE_LASER_USE_PWM) SET_PWM(SPINDLE_LASER_PWM_PIN); hal.set_pwm_duty(pin_t(SPINDLE_LASER_PWM_PIN), SPINDLE_LASER_PWM_OFF); // Set to lowest speed #endif - #if ENABLED(HAL_CAN_SET_PWM_FREQ) && SPINDLE_LASER_FREQUENCY - hal.set_pwm_frequency(pin_t(SPINDLE_LASER_PWM_PIN), SPINDLE_LASER_FREQUENCY); - TERN_(MARLIN_DEV_MODE, frequency = SPINDLE_LASER_FREQUENCY); - #endif #if ENABLED(AIR_EVACUATION) OUT_WRITE(AIR_EVACUATION_PIN, !AIR_EVACUATION_ACTIVE); // Init Vacuum/Blower OFF #endif @@ -90,7 +98,7 @@ void SpindleLaser::init() { */ void SpindleLaser::_set_ocr(const uint8_t ocr) { #if ENABLED(HAL_CAN_SET_PWM_FREQ) && SPINDLE_LASER_FREQUENCY - hal.set_pwm_frequency(pin_t(SPINDLE_LASER_PWM_PIN), TERN(MARLIN_DEV_MODE, frequency, SPINDLE_LASER_FREQUENCY)); + hal.set_pwm_frequency(pin_t(SPINDLE_LASER_PWM_PIN), frequency); #endif hal.set_pwm_duty(pin_t(SPINDLE_LASER_PWM_PIN), ocr ^ SPINDLE_LASER_PWM_OFF); } @@ -107,35 +115,41 @@ void SpindleLaser::init() { #endif // SPINDLE_LASER_USE_PWM /** - * Apply power for laser/spindle + * Apply power for Laser or Spindle * * Apply cutter power value for PWM, Servo, and on/off pin. * - * @param opwr Power value. Range 0 to MAX. When 0 disable spindle/laser. + * @param opwr Power value. Range 0 to MAX. */ void SpindleLaser::apply_power(const uint8_t opwr) { - if (opwr == last_power_applied) return; - last_power_applied = opwr; - power = opwr; - #if ENABLED(SPINDLE_LASER_USE_PWM) - if (cutter.unitPower == 0 && CUTTER_UNIT_IS(RPM)) { - ocr_off(); - isReady = false; - } - else if (ENABLED(CUTTER_POWER_RELATIVE) || enabled()) { - set_ocr(power); - isReady = true; - } - else { - ocr_off(); - isReady = false; - } - #elif ENABLED(SPINDLE_SERVO) - servo[SPINDLE_SERVO_NR].move(power); - #else - WRITE(SPINDLE_LASER_ENA_PIN, enabled() ? SPINDLE_LASER_ACTIVE_STATE : !SPINDLE_LASER_ACTIVE_STATE); - isReady = true; - #endif + if (enabled() || opwr == 0) { // 0 check allows us to disable where no ENA pin exists + // Test and set the last power used to improve performance + if (opwr == last_power_applied) return; + last_power_applied = opwr; + // Handle PWM driven or just simple on/off + #if ENABLED(SPINDLE_LASER_USE_PWM) + if (CUTTER_UNIT_IS(RPM) && unitPower == 0) + ocr_off(); + else if (ENABLED(CUTTER_POWER_RELATIVE) || enabled() || opwr == 0) { + set_ocr(opwr); + isReadyForUI = true; + } + else + ocr_off(); + #elif ENABLED(SPINDLE_SERVO) + MOVE_SERVO(SPINDLE_SERVO_NR, power); + #else + WRITE(SPINDLE_LASER_ENA_PIN, enabled() ? SPINDLE_LASER_ACTIVE_STATE : !SPINDLE_LASER_ACTIVE_STATE); + isReadyForUI = true; + #endif + } + else { + #if PIN_EXISTS(SPINDLE_LASER_ENA) + WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ACTIVE_STATE); + #endif + isReadyForUI = false; // Only used for UI display updates. + TERN_(SPINDLE_LASER_USE_PWM, ocr_off()); + } } #if ENABLED(SPINDLE_CHANGE_DIR) diff --git a/Marlin/src/feature/spindle_laser.h b/Marlin/src/feature/spindle_laser.h index 808fa634e162..b945032d8ea2 100644 --- a/Marlin/src/feature/spindle_laser.h +++ b/Marlin/src/feature/spindle_laser.h @@ -34,85 +34,98 @@ #include "../libs/buzzer.h" #endif -#if ENABLED(LASER_POWER_INLINE) - #include "../module/planner.h" -#endif +// Inline laser power +#include "../module/planner.h" #define PCT_TO_PWM(X) ((X) * 255 / 100) #define PCT_TO_SERVO(X) ((X) * 180 / 100) + +// Laser/Cutter operation mode +enum CutterMode : int8_t { + CUTTER_MODE_ERROR = -1, + CUTTER_MODE_STANDARD, // M3 power is applied directly and waits for planner moves to sync. + CUTTER_MODE_CONTINUOUS, // M3 or G1/2/3 move power is controlled within planner blocks, set with 'M3 I', cleared with 'M5 I'. + CUTTER_MODE_DYNAMIC // M4 laser power is proportional to the feed rate, set with 'M4 I', cleared with 'M5 I'. +}; + class SpindleLaser { public: - static const inline uint8_t pct_to_ocr(const_float_t pct) { return uint8_t(PCT_TO_PWM(pct)); } + static CutterMode cutter_mode; - // cpower = configured values (e.g., SPEED_POWER_MAX) + static constexpr uint8_t pct_to_ocr(const_float_t pct) { return uint8_t(PCT_TO_PWM(pct)); } + // cpower = configured values (e.g., SPEED_POWER_MAX) // Convert configured power range to a percentage - static const inline uint8_t cpwr_to_pct(const cutter_cpower_t cpwr) { - constexpr cutter_cpower_t power_floor = TERN(CUTTER_POWER_RELATIVE, SPEED_POWER_MIN, 0), - power_range = SPEED_POWER_MAX - power_floor; - return cpwr ? round(100.0f * (cpwr - power_floor) / power_range) : 0; + static constexpr cutter_cpower_t power_floor = TERN(CUTTER_POWER_RELATIVE, SPEED_POWER_MIN, 0); + static constexpr uint8_t cpwr_to_pct(const cutter_cpower_t cpwr) { + return cpwr ? round(100.0f * (cpwr - power_floor) / (SPEED_POWER_MAX - power_floor)) : 0; } - // Convert a cpower (e.g., SPEED_POWER_STARTUP) to unit power (upwr, upower), - // which can be PWM, Percent, Servo angle, or RPM (rel/abs). - static const inline cutter_power_t cpwr_to_upwr(const cutter_cpower_t cpwr) { // STARTUP power to Unit power - const cutter_power_t upwr = ( + // Convert config defines from RPM to %, angle or PWM when in Spindle mode + // and convert from PERCENT to PWM when in Laser mode + static constexpr cutter_power_t cpwr_to_upwr(const cutter_cpower_t cpwr) { // STARTUP power to Unit power + return ( #if ENABLED(SPINDLE_FEATURE) - // Spindle configured values are in RPM + // Spindle configured define values are in RPM #if CUTTER_UNIT_IS(RPM) - cpwr // to RPM - #elif CUTTER_UNIT_IS(PERCENT) // to PCT - cpwr_to_pct(cpwr) - #elif CUTTER_UNIT_IS(SERVO) // to SERVO angle - PCT_TO_SERVO(cpwr_to_pct(cpwr)) - #else // to PWM - PCT_TO_PWM(cpwr_to_pct(cpwr)) + cpwr // to same + #elif CUTTER_UNIT_IS(PERCENT) + cpwr_to_pct(cpwr) // to Percent + #elif CUTTER_UNIT_IS(SERVO) + PCT_TO_SERVO(cpwr_to_pct(cpwr)) // to SERVO angle + #else + PCT_TO_PWM(cpwr_to_pct(cpwr)) // to PWM #endif #else - // Laser configured values are in PCT + // Laser configured define values are in Percent #if CUTTER_UNIT_IS(PWM255) - PCT_TO_PWM(cpwr) + PCT_TO_PWM(cpwr) // to PWM #else - cpwr // to RPM/PCT + cpwr // to same #endif #endif ); - return upwr; } - static const cutter_power_t mpower_min() { return cpwr_to_upwr(SPEED_POWER_MIN); } - static const cutter_power_t mpower_max() { return cpwr_to_upwr(SPEED_POWER_MAX); } + static constexpr cutter_power_t mpower_min() { return cpwr_to_upwr(SPEED_POWER_MIN); } + static constexpr cutter_power_t mpower_max() { return cpwr_to_upwr(SPEED_POWER_MAX); } #if ENABLED(LASER_FEATURE) - static cutter_test_pulse_t testPulse; // Test fire Pulse ms value + static cutter_test_pulse_t testPulse; // (ms) Test fire pulse duration + static uint8_t last_block_power; // Track power changes for dynamic power + + static feedRate_t feedrate_mm_m, last_feedrate_mm_m; // (mm/min) Track feedrate changes for dynamic power + static bool laser_feedrate_changed() { + const bool changed = last_feedrate_mm_m != feedrate_mm_m; + if (changed) last_feedrate_mm_m = feedrate_mm_m; + return changed; + } #endif - static bool isReady; // Ready to apply power setting from the UI to OCR + static bool isReadyForUI; // Ready to apply power setting from the UI to OCR + static bool enable_state; static uint8_t power, last_power_applied; // Basic power state tracking - #if ENABLED(MARLIN_DEV_MODE) - static cutter_frequency_t frequency; // Set PWM frequency; range: 2K-50K - #endif + static cutter_frequency_t frequency; // Set PWM frequency; range: 2K-50K static cutter_power_t menuPower, // Power as set via LCD menu in PWM, Percentage or RPM unitPower; // Power as displayed status in PWM, Percentage or RPM static void init(); - #if ENABLED(MARLIN_DEV_MODE) + #if ENABLED(HAL_CAN_SET_PWM_FREQ) && SPINDLE_LASER_FREQUENCY static void refresh_frequency() { hal.set_pwm_frequency(pin_t(SPINDLE_LASER_PWM_PIN), frequency); } #endif // Modifying this function should update everywhere static bool enabled(const cutter_power_t opwr) { return opwr > 0; } - static bool enabled() { return enabled(power); } + static bool enabled() { return enable_state; } static void apply_power(const uint8_t inpow); FORCE_INLINE static void refresh() { apply_power(power); } - FORCE_INLINE static void set_power(const uint8_t upwr) { power = upwr; refresh(); } #if ENABLED(SPINDLE_LASER_USE_PWM) @@ -123,7 +136,6 @@ class SpindleLaser { public: static void set_ocr(const uint8_t ocr); - static void ocr_set_power(const uint8_t ocr) { power = ocr; set_ocr(ocr); } static void ocr_off(); /** @@ -141,78 +153,76 @@ class SpindleLaser { ); } - /** - * Correct power to configured range - */ - static cutter_power_t power_to_range(const cutter_power_t pwr) { - return power_to_range(pwr, _CUTTER_POWER(CUTTER_POWER_UNIT)); - } - - static cutter_power_t power_to_range(const cutter_power_t pwr, const uint8_t pwrUnit) { - static constexpr float - min_pct = TERN(CUTTER_POWER_RELATIVE, 0, TERN(SPINDLE_FEATURE, round(100.0f * (SPEED_POWER_MIN) / (SPEED_POWER_MAX)), SPEED_POWER_MIN)), - max_pct = TERN(SPINDLE_FEATURE, 100, SPEED_POWER_MAX); - if (pwr <= 0) return 0; - cutter_power_t upwr; - switch (pwrUnit) { - case _CUTTER_POWER_PWM255: - upwr = cutter_power_t( - (pwr < pct_to_ocr(min_pct)) ? pct_to_ocr(min_pct) // Use minimum if set below - : (pwr > pct_to_ocr(max_pct)) ? pct_to_ocr(max_pct) // Use maximum if set above - : pwr - ); - break; - case _CUTTER_POWER_PERCENT: - upwr = cutter_power_t( - (pwr < min_pct) ? min_pct // Use minimum if set below - : (pwr > max_pct) ? max_pct // Use maximum if set above - : pwr // PCT - ); - break; - case _CUTTER_POWER_RPM: - upwr = cutter_power_t( - (pwr < SPEED_POWER_MIN) ? SPEED_POWER_MIN // Use minimum if set below - : (pwr > SPEED_POWER_MAX) ? SPEED_POWER_MAX // Use maximum if set above - : pwr // Calculate OCR value - ); - break; - default: break; - } - return upwr; - } - #endif // SPINDLE_LASER_USE_PWM /** - * Enable/Disable spindle/laser - * @param enable true = enable; false = disable + * Correct power to configured range */ - static void set_enabled(const bool enable) { - uint8_t value = 0; - if (enable) { - #if ENABLED(SPINDLE_LASER_USE_PWM) - if (power) - value = power; - else if (unitPower) - value = upower_to_ocr(cpwr_to_upwr(SPEED_POWER_STARTUP)); - #else - value = 255; - #endif + static cutter_power_t power_to_range(const cutter_power_t pwr, const uint8_t pwrUnit=_CUTTER_POWER(CUTTER_POWER_UNIT)) { + static constexpr float + min_pct = TERN(CUTTER_POWER_RELATIVE, 0, TERN(SPINDLE_FEATURE, round(100.0f * (SPEED_POWER_MIN) / (SPEED_POWER_MAX)), SPEED_POWER_MIN)), + max_pct = TERN(SPINDLE_FEATURE, 100, SPEED_POWER_MAX); + if (pwr <= 0) return 0; + cutter_power_t upwr; + switch (pwrUnit) { + case _CUTTER_POWER_PWM255: { // PWM + const uint8_t pmin = pct_to_ocr(min_pct), pmax = pct_to_ocr(max_pct); + upwr = cutter_power_t(constrain(pwr, pmin, pmax)); + } break; + case _CUTTER_POWER_PERCENT: // Percent + upwr = cutter_power_t(constrain(pwr, min_pct, max_pct)); + break; + case _CUTTER_POWER_RPM: // Calculate OCR value + upwr = cutter_power_t(constrain(pwr, SPEED_POWER_MIN, SPEED_POWER_MAX)); + break; + default: break; } - set_power(value); + return upwr; } - static void disable() { isReady = false; set_enabled(false); } - /** - * Wait for spindle to spin up or spin down + * Enable Laser or Spindle output. + * It's important to prevent changing the power output value during inline cutter operation. + * Inline power is adjusted in the planner to support LASER_TRAP_POWER and CUTTER_MODE_DYNAMIC mode. + * + * This method accepts one of the following control states: + * + * - For CUTTER_MODE_STANDARD the cutter power is either full on/off or ocr-based and it will apply + * SPEED_POWER_STARTUP if no value is assigned. * - * @param on true = state to on; false = state to off. + * - For CUTTER_MODE_CONTINUOUS inline and power remains where last set and the cutter output enable flag is set. + * + * - CUTTER_MODE_DYNAMIC is also inline-based and it just sets the enable output flag. + * + * - For CUTTER_MODE_ERROR set the output enable_state flag directly and set power to 0 for any mode. + * This mode allows a global power shutdown action to occur. */ - static void power_delay(const bool on) { - #if DISABLED(LASER_POWER_INLINE) - safe_delay(on ? SPINDLE_LASER_POWERUP_DELAY : SPINDLE_LASER_POWERDOWN_DELAY); + static void set_enabled(const bool enable) { + switch (cutter_mode) { + case CUTTER_MODE_STANDARD: + apply_power(enable ? TERN(SPINDLE_LASER_USE_PWM, (power ?: (unitPower ? upower_to_ocr(cpwr_to_upwr(SPEED_POWER_STARTUP)) : 0)), 255) : 0); + break; + case CUTTER_MODE_CONTINUOUS: + TERN_(LASER_FEATURE, set_inline_enabled(enable)); + break; + case CUTTER_MODE_DYNAMIC: + TERN_(LASER_FEATURE, set_inline_enabled(enable)); + break; + case CUTTER_MODE_ERROR: // Error mode, no enable and kill power. + enable_state = false; + apply_power(0); + } + #if SPINDLE_LASER_ENA_PIN + WRITE(SPINDLE_LASER_ENA_PIN, enable ? SPINDLE_LASER_ACTIVE_STATE : !SPINDLE_LASER_ACTIVE_STATE); #endif + enable_state = enable; + } + + static void disable() { isReadyForUI = false; set_enabled(false); } + + // Wait for spindle/laser to startup or shutdown + static void power_delay(const bool on) { + safe_delay(on ? SPINDLE_LASER_POWERUP_DELAY : SPINDLE_LASER_POWERDOWN_DELAY); } #if ENABLED(SPINDLE_CHANGE_DIR) @@ -224,47 +234,60 @@ class SpindleLaser { #endif #if ENABLED(AIR_EVACUATION) - static void air_evac_enable(); // Turn On Cutter Vacuum or Laser Blower motor - static void air_evac_disable(); // Turn Off Cutter Vacuum or Laser Blower motor - static void air_evac_toggle(); // Toggle Cutter Vacuum or Laser Blower motor - static bool air_evac_state() { // Get current state + static void air_evac_enable(); // Turn On Cutter Vacuum or Laser Blower motor + static void air_evac_disable(); // Turn Off Cutter Vacuum or Laser Blower motor + static void air_evac_toggle(); // Toggle Cutter Vacuum or Laser Blower motor + static bool air_evac_state() { // Get current state return (READ(AIR_EVACUATION_PIN) == AIR_EVACUATION_ACTIVE); } #endif #if ENABLED(AIR_ASSIST) - static void air_assist_enable(); // Turn on air assist - static void air_assist_disable(); // Turn off air assist - static void air_assist_toggle(); // Toggle air assist - static bool air_assist_state() { // Get current state + static void air_assist_enable(); // Turn on air assist + static void air_assist_disable(); // Turn off air assist + static void air_assist_toggle(); // Toggle air assist + static bool air_assist_state() { // Get current state return (READ(AIR_ASSIST_PIN) == AIR_ASSIST_ACTIVE); } #endif #if HAS_MARLINUI_MENU - static void enable_with_dir(const bool reverse) { - isReady = true; - const uint8_t ocr = TERN(SPINDLE_LASER_USE_PWM, upower_to_ocr(menuPower), 255); - if (menuPower) - power = ocr; - else - menuPower = cpwr_to_upwr(SPEED_POWER_STARTUP); - unitPower = menuPower; - set_reverse(reverse); - set_enabled(true); - } - FORCE_INLINE static void enable_forward() { enable_with_dir(false); } - FORCE_INLINE static void enable_reverse() { enable_with_dir(true); } - FORCE_INLINE static void enable_same_dir() { enable_with_dir(is_reverse()); } + + #if ENABLED(SPINDLE_FEATURE) + static void enable_with_dir(const bool reverse) { + isReadyForUI = true; + const uint8_t ocr = TERN(SPINDLE_LASER_USE_PWM, upower_to_ocr(menuPower), 255); + if (menuPower) + power = ocr; + else + menuPower = cpwr_to_upwr(SPEED_POWER_STARTUP); + unitPower = menuPower; + set_reverse(reverse); + set_enabled(true); + } + FORCE_INLINE static void enable_forward() { enable_with_dir(false); } + FORCE_INLINE static void enable_reverse() { enable_with_dir(true); } + FORCE_INLINE static void enable_same_dir() { enable_with_dir(is_reverse()); } + #endif // SPINDLE_FEATURE #if ENABLED(SPINDLE_LASER_USE_PWM) static void update_from_mpower() { - if (isReady) power = upower_to_ocr(menuPower); + if (isReadyForUI) power = upower_to_ocr(menuPower); unitPower = menuPower; } #endif #if ENABLED(LASER_FEATURE) + // Toggle the laser on/off with menuPower. Apply SPEED_POWER_STARTUP if it was 0 on entry. + static void laser_menu_toggle(const bool state) { + set_enabled(state); + if (state) { + if (!menuPower) menuPower = cpwr_to_upwr(SPEED_POWER_STARTUP); + power = upower_to_ocr(menuPower); + apply_power(power); + } + } + /** * Test fire the laser using the testPulse ms duration * Also fires with any PWM power that was previous set @@ -272,74 +295,36 @@ class SpindleLaser { */ static void test_fire_pulse() { TERN_(HAS_BEEPER, buzzer.tone(30, 3000)); - enable_forward(); // Turn Laser on (Spindle speak but same funct) + cutter_mode = CUTTER_MODE_STANDARD;// Menu needs standard mode. + laser_menu_toggle(true); // Laser On delay(testPulse); // Delay for time set by user in pulse ms menu screen. - disable(); // Turn laser off + laser_menu_toggle(false); // Laser Off } - #endif + #endif // LASER_FEATURE #endif // HAS_MARLINUI_MENU - #if ENABLED(LASER_POWER_INLINE) - /** - * Inline power adds extra fields to the planner block - * to handle laser power and scale to movement speed. - */ + #if ENABLED(LASER_FEATURE) - // Force disengage planner power control - static void inline_disable() { - isReady = false; - unitPower = 0; - planner.laser_inline.status.isPlanned = false; - planner.laser_inline.status.isEnabled = false; - planner.laser_inline.power = 0; + // Dynamic mode rate calculation + static uint8_t calc_dynamic_power() { + if (feedrate_mm_m > 65535) return 255; // Too fast, go always on + uint16_t rate = uint16_t(feedrate_mm_m); // 16 bits from the G-code parser float input + rate >>= 8; // Take the G-code input e.g. F40000 and shift off the lower bits to get an OCR value from 1-255 + return uint8_t(rate); } // Inline modes of all other functions; all enable planner inline power control - static void set_inline_enabled(const bool enable) { - if (enable) - inline_power(255); - else { - isReady = false; - unitPower = menuPower = 0; - planner.laser_inline.status.isPlanned = false; - TERN(SPINDLE_LASER_USE_PWM, inline_ocr_power, inline_power)(0); - } - } + static void set_inline_enabled(const bool enable) { planner.laser_inline.status.isEnabled = enable;} // Set the power for subsequent movement blocks - static void inline_power(const cutter_power_t upwr) { - unitPower = menuPower = upwr; - #if ENABLED(SPINDLE_LASER_USE_PWM) - #if ENABLED(SPEED_POWER_RELATIVE) && !CUTTER_UNIT_IS(RPM) // relative mode does not turn laser off at 0, except for RPM - planner.laser_inline.status.isEnabled = true; - planner.laser_inline.power = upower_to_ocr(upwr); - isReady = true; - #else - inline_ocr_power(upower_to_ocr(upwr)); - #endif - #else - planner.laser_inline.status.isEnabled = enabled(upwr); - planner.laser_inline.power = upwr; - isReady = enabled(upwr); - #endif + static void inline_power(const cutter_power_t cpwr) { + TERN(SPINDLE_LASER_USE_PWM, power = planner.laser_inline.power = cpwr, planner.laser_inline.power = cpwr > 0 ? 255 : 0); } - static void inline_direction(const bool) { /* never */ } - - #if ENABLED(SPINDLE_LASER_USE_PWM) - static void inline_ocr_power(const uint8_t ocrpwr) { - isReady = ocrpwr > 0; - planner.laser_inline.status.isEnabled = ocrpwr > 0; - planner.laser_inline.power = ocrpwr; - } - #endif - #endif // LASER_POWER_INLINE + #endif // LASER_FEATURE - static void kill() { - TERN_(LASER_POWER_INLINE, inline_disable()); - disable(); - } + static void kill() { disable(); } }; extern SpindleLaser cutter; diff --git a/Marlin/src/feature/spindle_laser_types.h b/Marlin/src/feature/spindle_laser_types.h index d249a20e7531..2f36a68a1a32 100644 --- a/Marlin/src/feature/spindle_laser_types.h +++ b/Marlin/src/feature/spindle_laser_types.h @@ -74,12 +74,10 @@ typedef IF<(SPEED_POWER_MAX > 255), uint16_t, uint8_t>::type cutter_cpower_t; #endif #endif +typedef uint16_t cutter_frequency_t; + #if ENABLED(LASER_FEATURE) typedef uint16_t cutter_test_pulse_t; #define CUTTER_MENU_PULSE_TYPE uint16_3 -#endif - -#if ENABLED(MARLIN_DEV_MODE) - typedef uint16_t cutter_frequency_t; #define CUTTER_MENU_FREQUENCY_TYPE uint16_5 #endif diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index 01c2b13dda53..384fc7210c42 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -59,7 +59,7 @@ #include "../../libs/L64XX/L64XX_Marlin.h" #endif -#if ENABLED(LASER_MOVE_G28_OFF) +#if ENABLED(LASER_FEATURE) #include "../../feature/spindle_laser.h" #endif @@ -205,7 +205,12 @@ void GcodeSuite::G28() { DEBUG_SECTION(log_G28, "G28", DEBUGGING(LEVELING)); if (DEBUGGING(LEVELING)) log_machine_info(); - TERN_(LASER_MOVE_G28_OFF, cutter.set_inline_enabled(false)); // turn off laser + /* + * Set the laser power to false to stop the planner from processing the current power setting. + */ + #if ENABLED(LASER_FEATURE) + planner.laser_inline.status.isPowered = false; + #endif #if ENABLED(DUAL_X_CARRIAGE) bool IDEX_saved_duplication_state = extruder_duplication_enabled; diff --git a/Marlin/src/gcode/control/M3-M5.cpp b/Marlin/src/gcode/control/M3-M5.cpp index 817ed4fcb4d9..3c51de6f6f94 100644 --- a/Marlin/src/gcode/control/M3-M5.cpp +++ b/Marlin/src/gcode/control/M3-M5.cpp @@ -31,17 +31,27 @@ /** * Laser: * M3 - Laser ON/Power (Ramped power) - * M4 - Laser ON/Power (Continuous power) + * M4 - Laser ON/Power (Ramped power) + * M5 - Set power output to 0 (leaving inline mode unchanged). + * + * M3I - Enable continuous inline power to be processed by the planner, with power + * calculated and set in the planner blocks, processed inline during stepping. + * Within inline mode M3 S-Values will set the power for the next moves e.g. G1 X10 Y10 powers on with the last S-Value. + * M3I must be set before using planner-synced M3 inline S-Values (LASER_POWER_SYNC). + * + * M4I - Set dynamic mode which calculates laser power OCR based on the current feedrate. + * + * M5I - Clear inline mode and set power to 0. * * Spindle: * M3 - Spindle ON (Clockwise) * M4 - Spindle ON (Counter-clockwise) + * M5 - Spindle OFF * * Parameters: - * S - Set power. S0 will turn the spindle/laser off, except in relative mode. - * O - Set power and OCR (oscillator count register) + * S - Set power. S0 will turn the spindle/laser off. * - * If no PWM pin is defined then M3/M4 just turns it on. + * If no PWM pin is defined then M3/M4 just turns it on or off. * * At least 12.8kHz (50Hz * 256) is needed for Spindle PWM. * Hardware PWM is required on AVR. ISRs are too slow. @@ -70,77 +80,77 @@ void GcodeSuite::M3_M4(const bool is_M4) { reset_stepper_timeout(); // Reset timeout to allow subsequent G-code to power the laser (imm.) #endif - #if EITHER(SPINDLE_LASER_USE_PWM, SPINDLE_SERVO) - auto get_s_power = [] { - if (parser.seenval('S')) { - const float spwr = parser.value_float(); - #if ENABLED(SPINDLE_SERVO) - cutter.unitPower = spwr; - #else - cutter.unitPower = TERN(SPINDLE_LASER_USE_PWM, - cutter.power_to_range(cutter_power_t(round(spwr))), - spwr > 0 ? 255 : 0); - #endif - } - else - cutter.unitPower = cutter.cpwr_to_upwr(SPEED_POWER_STARTUP); - return cutter.unitPower; - }; - #endif + if (cutter.cutter_mode == CUTTER_MODE_STANDARD) + planner.synchronize(); // Wait for previous movement commands (G0/G1/G2/G3) to complete before changing power - #if ENABLED(LASER_POWER_INLINE) - if (parser.seen('I') == DISABLED(LASER_POWER_INLINE_INVERT)) { - // Laser power in inline mode - cutter.inline_direction(is_M4); // Should always be unused - #if ENABLED(SPINDLE_LASER_USE_PWM) - if (parser.seenval('O')) { - cutter.unitPower = cutter.power_to_range(parser.value_byte(), 0); - cutter.inline_ocr_power(cutter.unitPower); // The OCR is a value from 0 to 255 (uint8_t) - } - else - cutter.inline_power(cutter.upower_to_ocr(get_s_power())); - #else - cutter.set_inline_enabled(true); - #endif - return; + #if ENABLED(LASER_FEATURE) + if (parser.seen_test('I')) { + cutter.cutter_mode = is_M4 ? CUTTER_MODE_DYNAMIC : CUTTER_MODE_CONTINUOUS; + cutter.inline_power(0); + cutter.set_enabled(true); } - // Non-inline, standard case - cutter.inline_disable(); // Prevent future blocks re-setting the power #endif - planner.synchronize(); // Wait for previous movement commands (G0/G0/G2/G3) to complete before changing power - cutter.set_reverse(is_M4); - - #if ENABLED(SPINDLE_LASER_USE_PWM) - if (parser.seenval('O')) { - cutter.unitPower = cutter.power_to_range(parser.value_byte(), 0); - cutter.ocr_set_power(cutter.unitPower); // The OCR is a value from 0 to 255 (uint8_t) + auto get_s_power = [] { + float u; + if (parser.seenval('S')) { + const float v = parser.value_float(); + u = TERN(LASER_POWER_TRAP, v, cutter.power_to_range(v)); } - else - cutter.set_power(cutter.upower_to_ocr(get_s_power())); - #elif ENABLED(SPINDLE_SERVO) - cutter.set_power(get_s_power()); - #else + else if (cutter.cutter_mode == CUTTER_MODE_STANDARD) + u = cutter.cpwr_to_upwr(SPEED_POWER_STARTUP); + + cutter.menuPower = cutter.unitPower = u; + + // PWM not implied, power converted to OCR from unit definition and on/off if not PWM. + cutter.power = TERN(SPINDLE_LASER_USE_PWM, cutter.upower_to_ocr(u), u > 0 ? 255 : 0); + return u; + }; + + if (cutter.cutter_mode == CUTTER_MODE_CONTINUOUS || cutter.cutter_mode == CUTTER_MODE_DYNAMIC) { // Laser power in inline mode + #if ENABLED(LASER_FEATURE) + planner.laser_inline.status.isPowered = true; // M3 or M4 is powered either way + get_s_power(); // Update cutter.power if seen + #if ENABLED(LASER_POWER_SYNC) + // With power sync we only set power so it does not effect queued inline power sets + planner.buffer_sync_block(BLOCK_BIT_LASER_PWR); // Send the flag, queueing inline power + #else + planner.synchronize(); + cutter.inline_power(cutter.power); + #endif + #endif + } + else { cutter.set_enabled(true); - #endif - cutter.menuPower = cutter.unitPower; + get_s_power(); + cutter.apply_power( + #if ENABLED(SPINDLE_SERVO) + cutter.unitPower + #elif ENABLED(SPINDLE_LASER_USE_PWM) + cutter.upower_to_ocr(cutter.unitPower) + #else + cutter.unitPower > 0 ? 255 : 0 + #endif + ); + TERN_(SPINDLE_CHANGE_DIR, cutter.set_reverse(is_M4)); + } } /** * M5 - Cutter OFF (when moves are complete) */ void GcodeSuite::M5() { - #if ENABLED(LASER_POWER_INLINE) - if (parser.seen('I') == DISABLED(LASER_POWER_INLINE_INVERT)) { - cutter.set_inline_enabled(false); // Laser power in inline mode - return; - } - // Non-inline, standard case - cutter.inline_disable(); // Prevent future blocks re-setting the power - #endif planner.synchronize(); - cutter.set_enabled(false); - cutter.menuPower = cutter.unitPower; + cutter.power = 0; + cutter.apply_power(0); // M5 just kills power, leaving inline mode unchanged + if (cutter.cutter_mode != CUTTER_MODE_STANDARD) { + if (parser.seen_test('I')) { + TERN_(LASER_FEATURE, cutter.inline_power(cutter.power)); + cutter.set_enabled(false); // Needs to happen while we are in inline mode to clear inline power. + cutter.cutter_mode = CUTTER_MODE_STANDARD; // Switch from inline to standard mode. + } + } + cutter.set_enabled(false); // Disable enable output setting } #endif // HAS_CUTTER diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index f4dac89b0e07..a13940afc326 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -53,7 +53,7 @@ GcodeSuite gcode; #include "../feature/cancel_object.h" #endif -#if ENABLED(LASER_MOVE_POWER) +#if ENABLED(LASER_FEATURE) #include "../feature/spindle_laser.h" #endif @@ -210,8 +210,11 @@ void GcodeSuite::get_destination_from_command() { recovery.save(); #endif - if (parser.floatval('F') > 0) + if (parser.floatval('F') > 0) { feedrate_mm_s = parser.value_feedrate(); + // Update the cutter feed rate for use by M4 I set inline moves. + TERN_(LASER_FEATURE, cutter.feedrate_mm_m = MMS_TO_MMM(feedrate_mm_s)); + } #if BOTH(PRINTCOUNTER, HAS_EXTRUDERS) if (!DEBUGGING(DRYRUN) && !skip_move) @@ -223,15 +226,29 @@ void GcodeSuite::get_destination_from_command() { M165(); #endif - #if ENABLED(LASER_MOVE_POWER) - // Set the laser power in the planner to configure this move - if (parser.seen('S')) { - const float spwr = parser.value_float(); - cutter.inline_power(TERN(SPINDLE_LASER_USE_PWM, cutter.power_to_range(cutter_power_t(round(spwr))), spwr > 0 ? 255 : 0)); + #if ENABLED(LASER_FEATURE) + if (cutter.cutter_mode == CUTTER_MODE_CONTINUOUS || cutter.cutter_mode == CUTTER_MODE_DYNAMIC) { + // Set the cutter power in the planner to configure this move + cutter.last_feedrate_mm_m = 0; + if (WITHIN(parser.codenum, 1, TERN(ARC_SUPPORT, 3, 1)) || TERN0(BEZIER_CURVE_SUPPORT, parser.codenum == 5)) { + planner.laser_inline.status.isPowered = true; + if (parser.seen('I')) cutter.set_enabled(true); // This is set for backward LightBurn compatibility. + if (parser.seen('S')) { + const float v = parser.value_float(), + u = TERN(LASER_POWER_TRAP, v, cutter.power_to_range(v)); + cutter.menuPower = cutter.unitPower = u; + cutter.inline_power(TERN(SPINDLE_LASER_USE_PWM, cutter.upower_to_ocr(u), u > 0 ? 255 : 0)); + } + } + else if (parser.codenum == 0) { + // For dynamic mode we need to flag isPowered off, dynamic power is calculated in the stepper based on feedrate. + if (cutter.cutter_mode == CUTTER_MODE_DYNAMIC) planner.laser_inline.status.isPowered = false; + cutter.inline_power(0); // This is planner-based so only set power and do not disable inline control flags. + } } - else if (ENABLED(LASER_MOVE_G0_OFF) && parser.codenum == 0) // G0 - cutter.set_inline_enabled(false); - #endif + else if (parser.codenum == 0) + cutter.apply_power(0); + #endif // LASER_FEATURE } /** diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 1340ba89ef1b..a967f0109457 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -447,6 +447,16 @@ #error "SPINDLE_LASER_ACTIVE_HIGH is now SPINDLE_LASER_ACTIVE_STATE." #elif defined(SPINDLE_LASER_ENABLE_INVERT) #error "SPINDLE_LASER_ENABLE_INVERT is now SPINDLE_LASER_ACTIVE_STATE." +#elif defined(LASER_POWER_INLINE) + #error "LASER_POWER_INLINE is not required, inline mode is enabled with 'M3 I' and disabled with 'M5 I'." +#elif defined(LASER_POWER_INLINE_TRAPEZOID) + #error "LASER_POWER_INLINE_TRAPEZOID is now LASER_POWER_TRAP." +#elif defined(LASER_POWER_INLINE_TRAPEZOID_CONT) + #error "LASER_POWER_INLINE_TRAPEZOID_CONT is replaced with LASER_POWER_TRAP." +#elif defined(LASER_POWER_INLINE_TRAPEZOID_PER) + #error "LASER_POWER_INLINE_TRAPEZOID_CONT_PER replaced with LASER_POWER_TRAP." +#elif defined(LASER_POWER_INLINE_CONTINUOUS) + #error "LASER_POWER_INLINE_CONTINUOUS is not required, inline mode is enabled with 'M3 I' and disabled with 'M5 I'." #elif defined(CUTTER_POWER_DISPLAY) #error "CUTTER_POWER_DISPLAY is now CUTTER_POWER_UNIT." #elif defined(CHAMBER_HEATER_PIN) @@ -595,6 +605,8 @@ #error "ARC_SUPPORT no longer uses ARC_SEGMENTS_PER_R." #elif ENABLED(ARC_SUPPORT) && (!defined(MIN_ARC_SEGMENT_MM) || !defined(MAX_ARC_SEGMENT_MM)) #error "ARC_SUPPORT now requires MIN_ARC_SEGMENT_MM and MAX_ARC_SEGMENT_MM." +#elif defined(LASER_POWER_INLINE) + #error "LASER_POWER_INLINE is obsolete." #elif defined(SPINDLE_LASER_PWM) #error "SPINDLE_LASER_PWM (true) is now set with SPINDLE_LASER_USE_PWM (enabled)." #elif ANY(IS_RAMPS_EEB, IS_RAMPS_EEF, IS_RAMPS_EFB, IS_RAMPS_EFF, IS_RAMPS_SF) @@ -3841,37 +3853,26 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive."); #error "CUTTER_POWER_UNIT must be PWM255, PERCENT, RPM, or SERVO." #endif - #if ENABLED(LASER_POWER_INLINE) + #if ENABLED(LASER_FEATURE) #if ENABLED(SPINDLE_CHANGE_DIR) - #error "SPINDLE_CHANGE_DIR and LASER_POWER_INLINE are incompatible." - #elif ENABLED(LASER_MOVE_G0_OFF) && DISABLED(LASER_MOVE_POWER) - #error "LASER_MOVE_G0_OFF requires LASER_MOVE_POWER." + #error "SPINDLE_CHANGE_DIR and LASER_FEATURE are incompatible." + #elif ENABLED(LASER_MOVE_G0_OFF) + #error "LASER_MOVE_G0_OFF is no longer required, G0 and G28 cannot apply power." + #elif ENABLED(LASER_MOVE_G28_OFF) + #error "LASER_MOVE_G0_OFF is no longer required, G0 and G28 cannot apply power." + #elif ENABLED(LASER_MOVE_POWER) + #error "LASER_MOVE_POWER is no longer applicable." #endif - #if ENABLED(LASER_POWER_INLINE_TRAPEZOID) + #if ENABLED(LASER_POWER_TRAP) #if DISABLED(SPINDLE_LASER_USE_PWM) - #error "LASER_POWER_INLINE_TRAPEZOID requires SPINDLE_LASER_USE_PWM to function." - #elif ENABLED(S_CURVE_ACCELERATION) - //#ifndef LASER_POWER_INLINE_S_CURVE_ACCELERATION_WARN - // #define LASER_POWER_INLINE_S_CURVE_ACCELERATION_WARN - // #warning "Combining LASER_POWER_INLINE_TRAPEZOID with S_CURVE_ACCELERATION may result in unintended behavior." - //#endif + #error "LASER_POWER_TRAP requires SPINDLE_LASER_USE_PWM to function." #endif #endif - #if ENABLED(LASER_POWER_INLINE_INVERT) - //#ifndef LASER_POWER_INLINE_INVERT_WARN - // #define LASER_POWER_INLINE_INVERT_WARN - // #warning "Enabling LASER_POWER_INLINE_INVERT means that `M5` won't kill the laser immediately; use `M5 I` instead." - //#endif - #endif #else #if SPINDLE_LASER_POWERUP_DELAY < 1 #error "SPINDLE_LASER_POWERUP_DELAY must be greater than 0." #elif SPINDLE_LASER_POWERDOWN_DELAY < 1 #error "SPINDLE_LASER_POWERDOWN_DELAY must be greater than 0." - #elif ENABLED(LASER_MOVE_POWER) - #error "LASER_MOVE_POWER requires LASER_POWER_INLINE." - #elif ANY(LASER_POWER_INLINE_TRAPEZOID, LASER_POWER_INLINE_INVERT, LASER_MOVE_G0_OFF, LASER_MOVE_POWER) - #error "Enabled an inline laser feature without inline laser power being enabled." #endif #endif @@ -3889,7 +3890,7 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive."); #error "SPINDLE_LASER_PWM_PIN not assigned to a PWM pin." #elif !defined(SPINDLE_LASER_PWM_INVERT) #error "SPINDLE_LASER_PWM_INVERT is required for (SPINDLE|LASER)_FEATURE." - #elif !(defined(SPEED_POWER_INTERCEPT) && defined(SPEED_POWER_MIN) && defined(SPEED_POWER_MAX) && defined(SPEED_POWER_STARTUP)) + #elif !(defined(SPEED_POWER_MIN) && defined(SPEED_POWER_MAX) && defined(SPEED_POWER_STARTUP)) #error "SPINDLE_LASER_USE_PWM equation constant(s) missing." #elif _PIN_CONFLICT(X_MIN) #error "SPINDLE_LASER_USE_PWM pin conflicts with X_MIN_PIN." diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp index 858c6ea781fb..67039d52de7b 100644 --- a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp @@ -670,7 +670,7 @@ void MarlinUI::draw_status_screen() { // Laser / Spindle #if DO_DRAW_CUTTER - if (cutter.isReady && PAGE_CONTAINS(STATUS_CUTTER_TEXT_Y - INFO_FONT_ASCENT, STATUS_CUTTER_TEXT_Y - 1)) { + if (cutter.isReadyForUI && PAGE_CONTAINS(STATUS_CUTTER_TEXT_Y - INFO_FONT_ASCENT, STATUS_CUTTER_TEXT_Y - 1)) { #if CUTTER_UNIT_IS(PERCENT) lcd_put_u8str(STATUS_CUTTER_TEXT_X, STATUS_CUTTER_TEXT_Y, cutter_power2str(cutter.unitPower)); #elif CUTTER_UNIT_IS(RPM) diff --git a/Marlin/src/lcd/menu/menu_item.h b/Marlin/src/lcd/menu/menu_item.h index 77e6bcab7b1b..3e1733ee1c90 100644 --- a/Marlin/src/lcd/menu/menu_item.h +++ b/Marlin/src/lcd/menu/menu_item.h @@ -27,6 +27,10 @@ #include "../../inc/MarlinConfigPre.h" +#if ENABLED(LASER_SYNCHRONOUS_M106_M107) + #include "../../module/planner.h" +#endif + void lcd_move_z(); //////////////////////////////////////////// @@ -538,6 +542,7 @@ class MenuItem_bool : public MenuEditItemBase { inline void on_fan_update() { thermalManager.set_fan_speed(MenuItemBase::itemIndex, editable.uint8); + TERN_(LASER_SYNCHRONOUS_M106_M107, planner.buffer_sync_block(BLOCK_FLAG_SYNC_FANS)); } #if ENABLED(EXTRA_FAN_SPEED) diff --git a/Marlin/src/lcd/menu/menu_spindle_laser.cpp b/Marlin/src/lcd/menu/menu_spindle_laser.cpp index 9efd68ca005d..bef86a6db8a9 100644 --- a/Marlin/src/lcd/menu/menu_spindle_laser.cpp +++ b/Marlin/src/lcd/menu/menu_spindle_laser.cpp @@ -33,7 +33,7 @@ #include "../../feature/spindle_laser.h" void menu_spindle_laser() { - bool is_enabled = cutter.enabled() && cutter.isReady; + bool is_enabled = cutter.enabled(); #if ENABLED(SPINDLE_CHANGE_DIR) bool is_rev = cutter.is_reverse(); #endif @@ -49,7 +49,13 @@ #endif editable.state = is_enabled; - EDIT_ITEM(bool, MSG_CUTTER(TOGGLE), &is_enabled, []{ if (editable.state) cutter.disable(); else cutter.enable_same_dir(); }); + EDIT_ITEM(bool, MSG_CUTTER(TOGGLE), &is_enabled, []{ + #if ENABLED(SPINDLE_FEATURE) + if (editable.state) cutter.disable(); else cutter.enable_same_dir(); + #else + cutter.laser_menu_toggle(!editable.state); + #endif + }); #if ENABLED(AIR_EVACUATION) bool evac_state = cutter.air_evac_state(); @@ -72,12 +78,10 @@ // Setup and fire a test pulse using the current PWM power level for for a duration of test_pulse_min to test_pulse_max ms. EDIT_ITEM_FAST(CUTTER_MENU_PULSE_TYPE, MSG_LASER_PULSE_MS, &cutter.testPulse, LASER_TEST_PULSE_MIN, LASER_TEST_PULSE_MAX); ACTION_ITEM(MSG_LASER_FIRE_PULSE, cutter.test_fire_pulse); + #if ENABLED(HAL_CAN_SET_PWM_FREQ) && SPINDLE_LASER_FREQUENCY + EDIT_ITEM_FAST(CUTTER_MENU_FREQUENCY_TYPE, MSG_CUTTER_FREQUENCY, &cutter.frequency, 2000, 80000, cutter.refresh_frequency); + #endif #endif - - #if BOTH(MARLIN_DEV_MODE, HAL_CAN_SET_PWM_FREQ) && SPINDLE_LASER_FREQUENCY - EDIT_ITEM_FAST(CUTTER_MENU_FREQUENCY_TYPE, MSG_CUTTER_FREQUENCY, &cutter.frequency, 2000, 80000, cutter.refresh_frequency); - #endif - END_MENU(); } diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index b80be01dea29..bc5bfd3dfcc4 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -128,8 +128,13 @@ uint8_t Planner::delay_before_delivering; // This counter delays delivery planner_settings_t Planner::settings; // Initialized by settings.load() -#if ENABLED(LASER_POWER_INLINE) +/** + * Set up inline block variables + * Set laser_power_floor based on SPEED_POWER_MIN to pevent a zero power output state with LASER_POWER_TRAP + */ +#if ENABLED(LASER_FEATURE) laser_state_t Planner::laser_inline; // Current state for blocks + const uint8_t laser_power_floor = cutter.pct_to_ocr(SPEED_POWER_MIN); #endif uint32_t Planner::max_acceleration_steps_per_s2[DISTINCT_AXES]; // (steps/s^2) Derived from mm_per_s2 @@ -799,6 +804,7 @@ void Planner::calculate_trapezoid_for_block(block_t * const block, const_float_t if (plateau_steps < 0) { const float accelerate_steps_float = CEIL(intersection_distance(initial_rate, final_rate, accel, block->step_event_count)); accelerate_steps = _MIN(uint32_t(_MAX(accelerate_steps_float, 0)), block->step_event_count); + decelerate_steps = block->step_event_count - accelerate_steps; plateau_steps = 0; #if ENABLED(S_CURVE_ACCELERATION) @@ -822,7 +828,7 @@ void Planner::calculate_trapezoid_for_block(block_t * const block, const_float_t // Store new block parameters block->accelerate_until = accelerate_steps; - block->decelerate_after = accelerate_steps + plateau_steps; + block->decelerate_after = block->step_event_count - decelerate_steps; block->initial_rate = initial_rate; #if ENABLED(S_CURVE_ACCELERATION) block->acceleration_time = acceleration_time; @@ -833,46 +839,52 @@ void Planner::calculate_trapezoid_for_block(block_t * const block, const_float_t #endif block->final_rate = final_rate; - /** - * Laser trapezoid calculations - * - * Approximate the trapezoid with the laser, incrementing the power every `entry_per` while accelerating - * and decrementing it every `exit_power_per` while decelerating, thus ensuring power is related to feedrate. - * - * LASER_POWER_INLINE_TRAPEZOID_CONT doesn't need this as it continuously approximates - * - * Note this may behave unreliably when running with S_CURVE_ACCELERATION - */ - #if ENABLED(LASER_POWER_INLINE_TRAPEZOID) - if (block->laser.power > 0) { // No need to care if power == 0 - const uint8_t entry_power = block->laser.power * entry_factor; // Power on block entry - #if DISABLED(LASER_POWER_INLINE_TRAPEZOID_CONT) - // Speedup power - const uint8_t entry_power_diff = block->laser.power - entry_power; - if (entry_power_diff) { - block->laser.entry_per = accelerate_steps / entry_power_diff; - block->laser.power_entry = entry_power; - } - else { - block->laser.entry_per = 0; - block->laser.power_entry = block->laser.power; - } - // Slowdown power - const uint8_t exit_power = block->laser.power * exit_factor, // Power on block entry - exit_power_diff = block->laser.power - exit_power; - if (exit_power_diff) { - block->laser.exit_per = (block->step_event_count - block->decelerate_after) / exit_power_diff; - block->laser.power_exit = exit_power; + #if ENABLED(LASER_POWER_TRAP) + /** + * Laser Trapezoid Calculations + * + * Approximate the trapezoid with the laser, incrementing the power every `trap_ramp_entry_incr` steps while accelerating, + * and decrementing the power every `trap_ramp_exit_decr` while decelerating, to keep power proportional to feedrate. + * Laser power trap will reduce the initial power to no less than the laser_power_floor value. Based on the number + * of calculated accel/decel steps the power is distributed over the trapezoid entry- and exit-ramp steps. + * + * trap_ramp_active_pwr - The active power is initially set at a reduced level factor of initial power / accel steps and + * will be additively incremented using a trap_ramp_entry_incr value for each accel step processed later in the stepper code. + * The trap_ramp_exit_decr value is calculated as power / decel steps and is also adjusted to no less than the power floor. + * + * If the power == 0 the inline mode variables need to be set to zero to prevent stepper processing. The method allows + * for simpler non-powered moves like G0 or G28. + * + * Laser Trap Power works for all Jerk and Curve modes; however Arc-based moves will have issues since the segments are + * usually too small. + */ + if (cutter.cutter_mode == CUTTER_MODE_CONTINUOUS) { + if (planner.laser_inline.status.isPowered && planner.laser_inline.status.isEnabled) { + if (block->laser.power > 0) { + NOLESS(block->laser.power, laser_power_floor); + block->laser.trap_ramp_active_pwr = (block->laser.power - laser_power_floor) * (initial_rate / float(block->nominal_rate)) + laser_power_floor; + block->laser.trap_ramp_entry_incr = (block->laser.power - block->laser.trap_ramp_active_pwr) / accelerate_steps; + float laser_pwr = block->laser.power * (final_rate / float(block->nominal_rate)); + NOLESS(laser_pwr, laser_power_floor); + block->laser.trap_ramp_exit_decr = (block->laser.power - laser_pwr) / decelerate_steps; + #if ENABLED(DEBUG_LASER_TRAP) + SERIAL_ECHO_MSG("lp:",block->laser.power); + SERIAL_ECHO_MSG("as:",accelerate_steps); + SERIAL_ECHO_MSG("ds:",decelerate_steps); + SERIAL_ECHO_MSG("p.trap:",block->laser.trap_ramp_active_pwr); + SERIAL_ECHO_MSG("p.incr:",block->laser.trap_ramp_entry_incr); + SERIAL_ECHO_MSG("p.decr:",block->laser.trap_ramp_exit_decr); + #endif } else { - block->laser.exit_per = 0; - block->laser.power_exit = block->laser.power; + block->laser.trap_ramp_active_pwr = 0; + block->laser.trap_ramp_entry_incr = 0; + block->laser.trap_ramp_exit_decr = 0; } - #else - block->laser.power_entry = entry_power; - #endif + + } } - #endif + #endif // LASER_POWER_TRAP } /* PLANNER SPEED DEFINITION @@ -1130,10 +1142,9 @@ void Planner::recalculate_trapezoids() { // The tail may be changed by the ISR so get a local copy. uint8_t block_index = block_buffer_tail, head_block_index = block_buffer_head; - - // Since there could be non-move blocks in the head of the queue, and the + // Since there could be a sync block in the head of the queue, and the // next loop must not recalculate the head block (as it needs to be - // specially handled), scan backwards to the first move block. + // specially handled), scan backwards to the first non-SYNC block. while (head_block_index != block_index) { // Go back (head always point to the first free block) @@ -1203,7 +1214,7 @@ void Planner::recalculate_trapezoids() { // Last/newest block in buffer. Exit speed is set with MINIMUM_PLANNER_SPEED. Always recalculated. if (next) { - // Mark the last block as RECALCULATE, to prevent the Stepper ISR running it. + // Mark the next(last) block as RECALCULATE, to prevent the Stepper ISR running it. // As the last block is always recalculated here, there is a chance the block isn't // marked as RECALCULATE yet. That's the reason for the following line. block->flag.recalculate = true; @@ -1295,7 +1306,7 @@ void Planner::recalculate() { #endif // HAS_FAN /** - * Maintain fans, paste extruder pressure, + * Maintain fans, paste extruder pressure, spindle/laser power */ void Planner::check_axes_activity() { @@ -1359,7 +1370,7 @@ void Planner::check_axes_activity() { } else { - TERN_(HAS_CUTTER, cutter.refresh()); + TERN_(HAS_CUTTER, if (cutter.cutter_mode == CUTTER_MODE_STANDARD) cutter.refresh()); #if HAS_TAIL_FAN_SPEED FANS_LOOP(i) { @@ -1459,7 +1470,7 @@ void Planner::check_axes_activity() { for (uint8_t b = block_buffer_tail; b != block_buffer_head; b = next_block_index(b)) { const block_t * const block = &block_buffer[b]; if (NUM_AXIS_GANG(block->steps.x, || block->steps.y, || block->steps.z, || block->steps.i, || block->steps.j, || block->steps.k, || block->steps.u, || block->steps.v, || block->steps.w)) { - const float se = (float)block->steps.e / block->step_event_count * SQRT(block->nominal_speed_sqr); // mm/sec + const float se = (float)block->steps.e / block->step_event_count * SQRT(block->nominal_speed_sqr); // mm/sec; NOLESS(high, se); } } @@ -1781,7 +1792,7 @@ void Planner::synchronize() { while (busy()) idle(); } bool Planner::_buffer_steps(const xyze_long_t &target OPTARG(HAS_POSITION_FLOAT, const xyze_pos_t &target_float) OPTARG(HAS_DIST_MM_ARG, const xyze_float_t &cart_dist_mm) - , feedRate_t fr_mm_s, const uint8_t extruder, const_float_t millimeters/*=0.0*/ + , feedRate_t fr_mm_s, const uint8_t extruder, const_float_t millimeters ) { // Wait for the next available block @@ -1863,8 +1874,36 @@ bool Planner::_populate_block( ); /* <-- add a slash to enable - #define _ALINE(A) " " STR_##A ":", target[_AXIS(A)], " (", int32_t(target[_AXIS(A)] - position[_AXIS(A)]), " steps)" - SERIAL_ECHOLNPGM(" _populate_block FR:", fr_mm_s, LOGICAL_AXIS_MAP(_ALINE)); + SERIAL_ECHOLNPGM( + " _populate_block FR:", fr_mm_s, + " A:", target.a, " (", da, " steps)" + #if HAS_Y_AXIS + " B:", target.b, " (", db, " steps)" + #endif + #if HAS_Z_AXIS + " C:", target.c, " (", dc, " steps)" + #endif + #if HAS_I_AXIS + " " STR_I ":", target.i, " (", di, " steps)" + #endif + #if HAS_J_AXIS + " " STR_J ":", target.j, " (", dj, " steps)" + #endif + #if HAS_K_AXIS + " " STR_K ":", target.k, " (", dk, " steps)" + #endif + #if HAS_U_AXIS + " " STR_U ":", target.u, " (", du, " steps)" + #endif + #if HAS_V_AXIS + " " STR_V ":", target.v, " (", dv, " steps)" + #endif + #if HAS_W_AXIS + " " STR_W ":", target.w, " (", dw, " steps)" + #if HAS_EXTRUDERS + " E:", target.e, " (", de, " steps)" + #endif + ); //*/ #if EITHER(PREVENT_COLD_EXTRUSION, PREVENT_LENGTHY_EXTRUDE) @@ -1962,11 +2001,34 @@ bool Planner::_populate_block( // Set direction bits block->direction_bits = dm; - // Update block laser power - #if ENABLED(LASER_POWER_INLINE) - laser_inline.status.isPlanned = true; - block->laser.status = laser_inline.status; - block->laser.power = laser_inline.power; + /** + * Update block laser power + * For standard mode get the cutter.power value for processing, since it's + * only set by apply_power(). + */ + #if HAS_CUTTER + switch (cutter.cutter_mode) { + default: break; + + case CUTTER_MODE_STANDARD: block->cutter_power = cutter.power; break; + + #if ENABLED(LASER_FEATURE) + /** + * For inline mode get the laser_inline variables, including power and status. + * Dynamic mode only needs to update if the feedrate has changed, since it's + * calculated from the current feedrate and power level. + */ + case CUTTER_MODE_CONTINUOUS: + block->laser.power = laser_inline.power; + block->laser.status = laser_inline.status; + break; + + case CUTTER_MODE_DYNAMIC: + if (cutter.laser_feedrate_changed()) // Only process changes in rate + block->laser.power = laser_inline.power = cutter.calc_dynamic_power(); + break; + #endif + } #endif // Number of steps for each axis @@ -2028,9 +2090,9 @@ bool Planner::_populate_block( #endif #elif ENABLED(MARKFORGED_XY) steps_dist_mm.a = (da - db) * mm_per_step[A_AXIS]; - steps_dist_mm.b = db * mm_per_step[B_AXIS]; + steps_dist_mm.b = db * mm_per_step[B_AXIS]; #elif ENABLED(MARKFORGED_YX) - steps_dist_mm.a = da * mm_per_step[A_AXIS]; + steps_dist_mm.a = da * mm_per_step[A_AXIS]; steps_dist_mm.b = (db - da) * mm_per_step[B_AXIS]; #else XYZ_CODE( @@ -2076,21 +2138,12 @@ bool Planner::_populate_block( block->millimeters = millimeters; else { /** - * Distance for interpretation of feedrate in accordance with LinuxCNC (the successor of - * NIST RS274NGC interpreter - version 3) and its default CANON_XYZ feed reference mode. - * - * Assume: - * - X, Y, Z are the primary linear axes; - * - U, V, W are secondary linear axes; - * - A, B, C are rotational axes. - * - * Then: - * - dX, dY, dZ are the displacements of the primary linear axes; - * - dU, dV, dW are the displacements of linear axes; - * - dA, dB, dC are the displacements of rotational axes. - * - * The time it takes to execute move command with feedrate F is t = D/F, - * where D is the total distance, calculated as follows: + * Distance for interpretation of feedrate in accordance with LinuxCNC (the successor of NIST + * RS274NGC interpreter - version 3) and its default CANON_XYZ feed reference mode. + * Assume that X, Y, Z are the primary linear axes and U, V, W are secondary linear axes and A, B, C are + * rotational axes. Then dX, dY, dZ are the displacements of the primary linear axes and dU, dV, dW are the displacements of linear axes and + * dA, dB, dC are the displacements of rotational axes. + * The time it takes to execute move command with feedrate F is t = D/F, where D is the total distance, calculated as follows: * D^2 = dX^2 + dY^2 + dZ^2 * if D^2 == 0 (none of XYZ move but any secondary linear axes move, whether other axes are moved or not): * D^2 = dU^2 + dV^2 + dW^2 @@ -2099,9 +2152,8 @@ bool Planner::_populate_block( */ float distance_sqr = ( #if ENABLED(ARTICULATED_ROBOT_ARM) - // For articulated robots, interpreting feedrate like LinuxCNC would require inverse kinematics. As a workaround, - // assume that motors sit on a mutually-orthogonal axes and we can think of distance as magnitude of an n-vector - // in an n-dimensional Euclidian space. + // For articulated robots, interpreting feedrate like LinuxCNC would require inverse kinematics. As a workaround, pretend that motors sit on n mutually orthogonal + // axes and assume that we could think of distance as magnitude of an n-vector in an n-dimensional Euclidian space. NUM_AXIS_GANG( sq(steps_dist_mm.x), + sq(steps_dist_mm.y), + sq(steps_dist_mm.z), + sq(steps_dist_mm.i), + sq(steps_dist_mm.j), + sq(steps_dist_mm.k), @@ -2121,7 +2173,7 @@ bool Planner::_populate_block( #elif CORE_IS_YZ XYZ_GANG(sq(steps_dist_mm.x), + sq(steps_dist_mm.head.y), + sq(steps_dist_mm.head.z)) #else - XYZ_GANG(sq(steps_dist_mm.x), + sq(steps_dist_mm.y), + sq(steps_dist_mm.z)) + XYZ_GANG(sq(steps_dist_mm.x), + sq(steps_dist_mm.y), + sq(steps_dist_mm.z)) #endif ); @@ -2154,9 +2206,9 @@ bool Planner::_populate_block( /** * At this point at least one of the axes has more steps than - * MIN_STEPS_PER_SEGMENT, ensuring the segment won't get dropped - * as zero-length. It's important to not apply corrections to blocks - * that would get dropped! + * MIN_STEPS_PER_SEGMENT, ensuring the segment won't get dropped as + * zero-length. It's important to not apply corrections + * to blocks that would get dropped! * * A correction function is permitted to add steps to an axis, it * should *never* remove steps! @@ -2177,7 +2229,6 @@ bool Planner::_populate_block( TERN_(MIXING_EXTRUDER, mixer.populate_block(block->b_color)); - TERN_(HAS_CUTTER, block->cutter_power = cutter.power); #if HAS_FAN FANS_LOOP(i) block->fan_speed[i] = thermalManager.fan_speed[i]; @@ -2192,9 +2243,15 @@ bool Planner::_populate_block( #if ENABLED(AUTO_POWER_CONTROL) if (NUM_AXIS_GANG( - block->steps.x, || block->steps.y, || block->steps.z, - || block->steps.i, || block->steps.j, || block->steps.k, - || block->steps.u, || block->steps.v, || block->steps.w + block->steps.x, + || block->steps.y, + || block->steps.z, + || block->steps.i, + || block->steps.j, + || block->steps.k, + || block->steps.u, + || block->steps.v, + || block->steps.w )) powerManager.power_on(); #endif @@ -2428,7 +2485,7 @@ bool Planner::_populate_block( if (speed_factor < 1.0f) { current_speed *= speed_factor; block->nominal_rate *= speed_factor; - block->nominal_speed_sqr *= sq(speed_factor); + block->nominal_speed_sqr = block->nominal_speed_sqr * sq(speed_factor); } // Compute and limit the acceleration rate for the trapezoid generator. @@ -2630,15 +2687,14 @@ bool Planner::_populate_block( vmax_junction_sqr = sq(float(MINIMUM_PLANNER_SPEED)); } else { + NOLESS(junction_cos_theta, -0.999999f); // Check for numerical round-off to avoid divide by zero. + // Convert delta vector to unit vector xyze_float_t junction_unit_vec = unit_vec - prev_unit_vec; normalize_junction_vector(junction_unit_vec); - const float junction_acceleration = limit_value_by_axis_maximum(block->acceleration, junction_unit_vec); - - NOLESS(junction_cos_theta, -0.999999f); // Check for numerical round-off to avoid divide by zero. - - const float sin_theta_d2 = SQRT(0.5f * (1.0f - junction_cos_theta)); // Trig half angle identity. Always positive. + const float junction_acceleration = limit_value_by_axis_maximum(block->acceleration, junction_unit_vec), + sin_theta_d2 = SQRT(0.5f * (1.0f - junction_cos_theta)); // Trig half angle identity. Always positive. vmax_junction_sqr = junction_acceleration * junction_deviation_mm * sin_theta_d2 / (1.0f - sin_theta_d2); @@ -2889,21 +2945,19 @@ bool Planner::_populate_block( /** * Planner::buffer_sync_block - * Add a block to the buffer that just updates the position, - * or in case of LASER_SYNCHRONOUS_M106_M107 the fan PWM + * Add a block to the buffer that just updates the position + * @param sync_flag BLOCK_FLAG_SYNC_FANS & BLOCK_FLAG_LASER_PWR + * Supports LASER_SYNCHRONOUS_M106_M107 and LASER_POWER_SYNC power sync block buffer queueing. */ -void Planner::buffer_sync_block(TERN_(LASER_SYNCHRONOUS_M106_M107, const BlockFlagBit sync_flag/*=BLOCK_BIT_SYNC_POSITION*/)) { - #if DISABLED(LASER_SYNCHRONOUS_M106_M107) - constexpr BlockFlagBit sync_flag = BLOCK_BIT_SYNC_POSITION; - #endif + +void Planner::buffer_sync_block(const BlockFlagBit sync_flag/*=BLOCK_BIT_SYNC_POSITION*/) { // Wait for the next available block uint8_t next_buffer_head; block_t * const block = get_next_free_block(next_buffer_head); // Clear block - block->reset(); - + memset(block, 0, sizeof(block_t)); block->flag.apply(sync_flag); block->position = position; @@ -2915,6 +2969,12 @@ void Planner::buffer_sync_block(TERN_(LASER_SYNCHRONOUS_M106_M107, const BlockFl FANS_LOOP(i) block->fan_speed[i] = thermalManager.fan_speed[i]; #endif + /** + * M3-based power setting can be processed inline with a laser power sync block. + * During active moves cutter.power is processed immediately, otherwise on the next move. + */ + TERN_(LASER_POWER_SYNC, block->laser.power = cutter.power); + // If this is the first added movement, reload the delay, otherwise, cancel it. if (block_buffer_head == block_buffer_tail) { // If it was the first queued block, restart the 1st block delivery delay, to @@ -3052,8 +3112,8 @@ bool Planner::buffer_segment(const abce_pos_t &abce if (!_buffer_steps(target OPTARG(HAS_POSITION_FLOAT, target_float) OPTARG(HAS_DIST_MM_ARG, cart_dist_mm) - , fr_mm_s, extruder, millimeters - )) return false; + , fr_mm_s, extruder, millimeters) + ) return false; stepper.wake_up(); return true; @@ -3099,7 +3159,7 @@ bool Planner::buffer_line(const xyze_pos_t &cart, const_feedRate_t fr_mm_s, cons inverse_kinematics(machine); #if ENABLED(SCARA_FEEDRATE_SCALING) - // For SCARA scale the feed rate from mm/s to degrees/s + // For SCARA scale the feedrate from mm/s to degrees/s // i.e., Complete the angular vector in the given time. const float duration_recip = inv_duration ?: fr_mm_s / mm; const xyz_pos_t diff = delta - position_float; @@ -3120,14 +3180,6 @@ bool Planner::buffer_line(const xyze_pos_t &cart, const_feedRate_t fr_mm_s, cons #if ENABLED(DIRECT_STEPPING) - /** - * @brief Add a direct stepping page block to the buffer - * and wake up the Stepper ISR to process it. - * - * @param page_idx Page index provided by G6 I - * @param extruder The extruder to use in the move - * @param num_steps Number of steps to process in the ISR - */ void Planner::buffer_page(const page_idx_t page_idx, const uint8_t extruder, const uint16_t num_steps) { if (!last_page_step_rate) { kill(GET_TEXT_F(MSG_BAD_PAGE_SPEED)); @@ -3212,7 +3264,7 @@ void Planner::set_machine_position_mm(const abce_pos_t &abce) { if (has_blocks_queued()) { //previous_nominal_speed_sqr = 0.0; // Reset planner junction speeds. Assume start from rest. //previous_speed.reset(); - buffer_sync_block(); + buffer_sync_block(BLOCK_BIT_SYNC_POSITION); } else { #if ENABLED(BACKLASH_COMPENSATION) @@ -3225,12 +3277,6 @@ void Planner::set_machine_position_mm(const abce_pos_t &abce) { } } -/** - * @brief Set the Planner position in mm - * @details Set the Planner position from a native machine position in mm - * - * @param xyze A native (Cartesian) machine position - */ void Planner::set_position_mm(const xyze_pos_t &xyze) { xyze_pos_t machine = xyze; TERN_(HAS_POSITION_MODIFIERS, apply_modifiers(machine, true)); @@ -3259,20 +3305,14 @@ void Planner::set_position_mm(const xyze_pos_t &xyze) { TERN_(IS_KINEMATIC, TERN_(HAS_EXTRUDERS, position_cart.e = e)); if (has_blocks_queued()) - buffer_sync_block(); + buffer_sync_block(BLOCK_BIT_SYNC_POSITION); else stepper.set_axis_position(E_AXIS, position.e); } #endif -/** - * @brief Recalculate the steps/s^2 acceleration rates, based on the mm/s^2 - * @details Update planner movement factors after a change to certain settings: - * - max_acceleration_steps_per_s2 from settings max_acceleration_mm_per_s2 * axis_steps_per_mm (M201, M92) - * - acceleration_long_cutoff based on the largest max_acceleration_steps_per_s2 (M201) - * - max_e_jerk for all extruders based on junction_deviation_mm (M205 J) - */ +// Recalculate the steps/s^2 acceleration rates, based on the mm/s^2 void Planner::refresh_acceleration_rates() { uint32_t highest_rate = 1; LOOP_DISTINCT_AXES(i) { @@ -3285,8 +3325,8 @@ void Planner::refresh_acceleration_rates() { } /** - * @brief Recalculate 'position' and 'mm_per_step'. - * @details Required whenever settings.axis_steps_per_mm changes! + * Recalculate 'position' and 'mm_per_step'. + * Must be called whenever settings.axis_steps_per_mm changes! */ void Planner::refresh_positioning() { LOOP_DISTINCT_AXES(i) mm_per_step[i] = 1.0f / settings.axis_steps_per_mm[i]; diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index a6f5bd5774d7..e0aa89ab7228 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -89,30 +89,6 @@ #define HAS_DIST_MM_ARG 1 #endif -#if ENABLED(LASER_POWER_INLINE) - - typedef struct { - bool isPlanned:1; - bool isEnabled:1; - bool dir:1; - bool Reserved:6; - } power_status_t; - - typedef struct { - power_status_t status; // See planner settings for meaning - uint8_t power; // Ditto; When in trapezoid mode this is nominal power - #if ENABLED(LASER_POWER_INLINE_TRAPEZOID) - uint8_t power_entry; // Entry power for the laser - #if DISABLED(LASER_POWER_INLINE_TRAPEZOID_CONT) - uint8_t power_exit; // Exit power for the laser - uint32_t entry_per, // Steps per power increment (to avoid floats in stepper calcs) - exit_per; // Steps per power decrement - #endif - #endif - } block_laser_t; - -#endif - /** * Planner block flags as boolean bit fields */ @@ -132,14 +108,14 @@ enum BlockFlagBit { BLOCK_BIT_SYNC_POSITION // Direct stepping page - #if ENABLED(DIRECT_STEPPING) - , BLOCK_BIT_PAGE - #endif + OPTARG(DIRECT_STEPPING, BLOCK_BIT_PAGE) + // Sync the fan speeds from the block - #if ENABLED(LASER_SYNCHRONOUS_M106_M107) - , BLOCK_BIT_SYNC_FANS - #endif + OPTARG(LASER_SYNCHRONOUS_M106_M107, BLOCK_BIT_SYNC_FANS) + + // Sync laser power from a queued block + OPTARG(LASER_POWER_SYNC, BLOCK_BIT_LASER_PWR) }; /** @@ -165,6 +141,10 @@ typedef struct { #if ENABLED(LASER_SYNCHRONOUS_M106_M107) bool sync_fans:1; #endif + + #if ENABLED(LASER_POWER_SYNC) + bool sync_laser_pwr:1; + #endif }; }; @@ -176,9 +156,34 @@ typedef struct { } block_flags_t; +#if ENABLED(LASER_FEATURE) + + typedef struct { + bool isEnabled:1; // Set to engage the inline laser power output. + bool dir:1; + bool isPowered:1; // Set on any parsed G1, G2, G3, or G5 powered move, cleared on G0 and G28. + bool isSyncPower:1; // Set on a M3 sync based set laser power, used to determine active trap power + bool Reserved:4; + } power_status_t; + + typedef struct { + power_status_t status; // See planner settings for meaning + uint8_t power; // Ditto; When in trapezoid mode this is nominal power + + #if ENABLED(LASER_POWER_TRAP) + float trap_ramp_active_pwr; // Laser power level during active trapezoid smoothing + float trap_ramp_entry_incr; // Acceleration per step laser power increment (trap entry) + float trap_ramp_exit_decr; // Deceleration per step laser power decrement (trap exit) + #endif + } block_laser_t; + +#endif + /** - * A single entry in the planner buffer, used to set up and - * track a coordinated linear motion for one or more axes. + * struct block_t + * + * A single entry in the planner buffer. + * Tracks linear movement over multiple axes. * * The "nominal" values are as-specified by G-code, and * may never actually be reached due to acceleration limits. @@ -188,7 +193,8 @@ typedef struct block_t { volatile block_flags_t flag; // Block flags volatile bool is_fan_sync() { return TERN0(LASER_SYNCHRONOUS_M106_M107, flag.sync_fans); } - volatile bool is_sync() { return flag.sync_position || is_fan_sync(); } + volatile bool is_pwr_sync() { return TERN0(LASER_POWER_SYNC, flag.sync_laser_pwr); } + volatile bool is_sync() { return flag.sync_position || is_fan_sync() || is_pwr_sync(); } volatile bool is_page() { return TERN0(DIRECT_STEPPING, flag.page); } volatile bool is_move() { return !(is_sync() || is_page()); } @@ -270,12 +276,10 @@ typedef struct block_t { xyze_pos_t start_position; #endif - #if ENABLED(LASER_POWER_INLINE) + #if ENABLED(LASER_FEATURE) block_laser_t laser; #endif - void reset() { memset((char*)this, 0, sizeof(*this)); } - } block_t; #if ANY(LIN_ADVANCE, SCARA_FEEDRATE_SCALING, GRADIENT_MIX, LCD_SHOW_E_TOTAL, POWER_LOSS_RECOVERY) @@ -284,7 +288,7 @@ typedef struct block_t { #define BLOCK_MOD(n) ((n)&(BLOCK_BUFFER_SIZE-1)) -#if ENABLED(LASER_POWER_INLINE) +#if ENABLED(LASER_FEATURE) typedef struct { /** * Laser status flags @@ -293,11 +297,10 @@ typedef struct block_t { /** * Laser power: 0 or 255 in case of PWM-less laser, * or the OCR (oscillator count register) value; - * * Using OCR instead of raw power, because it avoids * floating point operations during the move loop. */ - uint8_t power; + volatile uint8_t power; } laser_state_t; #endif @@ -399,7 +402,7 @@ class Planner { static planner_settings_t settings; - #if ENABLED(LASER_POWER_INLINE) + #if ENABLED(LASER_FEATURE) static laser_state_t laser_inline; #endif @@ -784,12 +787,11 @@ class Planner { /** * Planner::buffer_sync_block - * Add a block to the buffer that just updates the position or in - * case of LASER_SYNCHRONOUS_M106_M107 the fan pwm + * Add a block to the buffer that just updates the position + * @param sync_flag sets a condition bit to process additional items + * such as sync fan pwm or sync M3/M4 laser power into a queued block */ - static void buffer_sync_block( - TERN_(LASER_SYNCHRONOUS_M106_M107, const BlockFlagBit flag=BLOCK_BIT_SYNC_POSITION) - ); + static void buffer_sync_block(const BlockFlagBit flag=BLOCK_BIT_SYNC_POSITION); #if IS_KINEMATIC private: diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 5dd1bd24b3fe..4832220abd75 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -253,20 +253,6 @@ xyz_long_t Stepper::endstops_trigsteps; xyze_long_t Stepper::count_position{0}; xyze_int8_t Stepper::count_direction{0}; -#if ENABLED(LASER_POWER_INLINE_TRAPEZOID) - Stepper::stepper_laser_t Stepper::laser_trap = { - .enabled = false, - .cur_power = 0, - .cruise_set = false, - #if DISABLED(LASER_POWER_INLINE_TRAPEZOID_CONT) - .last_step_count = 0, - .acc_step_count = 0 - #else - .till_update = 0 - #endif - }; -#endif - #define MINDIR(A) (count_direction[_AXIS(A)] < 0) #define MAXDIR(A) (count_direction[_AXIS(A)] > 0) @@ -1964,7 +1950,6 @@ uint32_t Stepper::block_phase_isr() { // If there is a current block if (current_block) { - // If current block is finished, reset pointer and finalize state if (step_events_completed >= step_event_count) { #if ENABLED(DIRECT_STEPPING) @@ -2017,32 +2002,28 @@ uint32_t Stepper::block_phase_isr() { else if (LA_steps) nextAdvanceISR = 0; #endif - // Update laser - Accelerating - #if ENABLED(LASER_POWER_INLINE_TRAPEZOID) - if (laser_trap.enabled) { - #if DISABLED(LASER_POWER_INLINE_TRAPEZOID_CONT) - if (current_block->laser.entry_per) { - laser_trap.acc_step_count -= step_events_completed - laser_trap.last_step_count; - laser_trap.last_step_count = step_events_completed; - - // Should be faster than a divide, since this should trip just once - if (laser_trap.acc_step_count < 0) { - while (laser_trap.acc_step_count < 0) { - laser_trap.acc_step_count += current_block->laser.entry_per; - if (laser_trap.cur_power < current_block->laser.power) laser_trap.cur_power++; - } - cutter.ocr_set_power(laser_trap.cur_power); - } - } - #else - if (laser_trap.till_update) - laser_trap.till_update--; - else { - laser_trap.till_update = LASER_POWER_INLINE_TRAPEZOID_CONT_PER; - laser_trap.cur_power = (current_block->laser.power * acc_step_rate) / current_block->nominal_rate; - cutter.ocr_set_power(laser_trap.cur_power); // Cycle efficiency is irrelevant it the last line was many cycles + /* + * Adjust Laser Power - Accelerating + * isPowered - True when a move is powered. + * isEnabled - laser power is active. + * Laser power variables are calulated and stored in this block by the planner code. + * + * trap_ramp_active_pwr - the active power in this block across accel or decel trap steps. + * trap_ramp_entry_incr - holds the precalculated value to increase the current power per accel step. + * + * Apply the starting active power and then increase power per step by the trap_ramp_entry_incr value if positive. + */ + + #if ENABLED(LASER_POWER_TRAP) + if (cutter.cutter_mode == CUTTER_MODE_CONTINUOUS) { + if (planner.laser_inline.status.isPowered && planner.laser_inline.status.isEnabled) { + if (current_block->laser.trap_ramp_entry_incr > 0) { + cutter.apply_power(current_block->laser.trap_ramp_active_pwr); + current_block->laser.trap_ramp_active_pwr += current_block->laser.trap_ramp_entry_incr; } - #endif + } + // Not a powered move. + else cutter.apply_power(0); } #endif } @@ -2066,7 +2047,6 @@ uint32_t Stepper::block_phase_isr() { : current_block->final_rate; } #else - // Using the old trapezoidal control step_rate = STEP_MULTIPLY(deceleration_time, current_block->acceleration_rate); if (step_rate < acc_step_rate) { // Still decelerating? @@ -2094,37 +2074,25 @@ uint32_t Stepper::block_phase_isr() { else if (LA_steps) nextAdvanceISR = 0; #endif // LIN_ADVANCE - // Update laser - Decelerating - #if ENABLED(LASER_POWER_INLINE_TRAPEZOID) - if (laser_trap.enabled) { - #if DISABLED(LASER_POWER_INLINE_TRAPEZOID_CONT) - if (current_block->laser.exit_per) { - laser_trap.acc_step_count -= step_events_completed - laser_trap.last_step_count; - laser_trap.last_step_count = step_events_completed; - - // Should be faster than a divide, since this should trip just once - if (laser_trap.acc_step_count < 0) { - while (laser_trap.acc_step_count < 0) { - laser_trap.acc_step_count += current_block->laser.exit_per; - if (laser_trap.cur_power > current_block->laser.power_exit) laser_trap.cur_power--; - } - cutter.ocr_set_power(laser_trap.cur_power); - } - } - #else - if (laser_trap.till_update) - laser_trap.till_update--; - else { - laser_trap.till_update = LASER_POWER_INLINE_TRAPEZOID_CONT_PER; - laser_trap.cur_power = (current_block->laser.power * step_rate) / current_block->nominal_rate; - cutter.ocr_set_power(laser_trap.cur_power); // Cycle efficiency isn't relevant when the last line was many cycles + /* + * Adjust Laser Power - Decelerating + * trap_ramp_entry_decr - holds the precalculated value to decrease the current power per decel step. + */ + #if ENABLED(LASER_POWER_TRAP) + if (cutter.cutter_mode == CUTTER_MODE_CONTINUOUS) { + if (planner.laser_inline.status.isPowered && planner.laser_inline.status.isEnabled) { + if (current_block->laser.trap_ramp_exit_decr > 0) { + current_block->laser.trap_ramp_active_pwr -= current_block->laser.trap_ramp_exit_decr; + cutter.apply_power(current_block->laser.trap_ramp_active_pwr); } - #endif + // Not a powered move. + else cutter.apply_power(0); + } } #endif + } - // Must be in cruise phase otherwise - else { + else { // Must be in cruise phase otherwise #if ENABLED(LIN_ADVANCE) // If there are any esteps, fire the next advance_isr "now" @@ -2139,24 +2107,50 @@ uint32_t Stepper::block_phase_isr() { // The timer interval is just the nominal value for the nominal speed interval = ticks_nominal; + } - // Update laser - Cruising - #if ENABLED(LASER_POWER_INLINE_TRAPEZOID) - if (laser_trap.enabled) { - if (!laser_trap.cruise_set) { - laser_trap.cur_power = current_block->laser.power; - cutter.ocr_set_power(laser_trap.cur_power); - laser_trap.cruise_set = true; + /* Adjust Laser Power - Cruise + * power - direct or floor adjusted active laser power. + */ + + #if ENABLED(LASER_POWER_TRAP) + if (cutter.cutter_mode == CUTTER_MODE_CONTINUOUS) { + if (step_events_completed + 1 == accelerate_until) { + if (planner.laser_inline.status.isPowered && planner.laser_inline.status.isEnabled) { + if (current_block->laser.trap_ramp_entry_incr > 0) { + current_block->laser.trap_ramp_active_pwr = current_block->laser.power; + cutter.apply_power(current_block->laser.power); + } } - #if ENABLED(LASER_POWER_INLINE_TRAPEZOID_CONT) - laser_trap.till_update = LASER_POWER_INLINE_TRAPEZOID_CONT_PER; - #else - laser_trap.last_step_count = step_events_completed; - #endif + // Not a powered move. + else cutter.apply_power(0); } - #endif - } + } + #endif } + + #if ENABLED(LASER_FEATURE) + /* + * CUTTER_MODE_DYNAMIC is experimental and developing. + * Super-fast method to dynamically adjust the laser power OCR value based on the input feedrate in mm-per-minute. + * TODO: Set up Min/Max OCR offsets to allow tuning and scaling of various lasers. + * TODO: Integrate accel/decel +-rate into the dynamic laser power calc. + */ + if (cutter.cutter_mode == CUTTER_MODE_DYNAMIC + && planner.laser_inline.status.isPowered // isPowered flag set on any parsed G1, G2, G3, or G5 move; cleared on any others. + && cutter.last_block_power != current_block->laser.power // Prevent constant update without change + ) { + cutter.apply_power(current_block->laser.power); + cutter.last_block_power = current_block->laser.power; + } + #endif + } + else { // !current_block + #if ENABLED(LASER_FEATURE) + if (cutter.cutter_mode == CUTTER_MODE_DYNAMIC) { + cutter.apply_power(0); // No movement in dynamic mode so turn Laser off + } + #endif } // If there is no current block at this point, attempt to pop one from the buffer @@ -2169,11 +2163,18 @@ uint32_t Stepper::block_phase_isr() { // Sync block? Sync the stepper counts or fan speeds and return while (current_block->is_sync()) { - if (current_block->is_fan_sync()) { - TERN_(LASER_SYNCHRONOUS_M106_M107, planner.sync_fan_speeds(current_block->fan_speed)); - } - else - _set_position(current_block->position); + #if ENABLED(LASER_POWER_SYNC) + if (cutter.cutter_mode == CUTTER_MODE_CONTINUOUS) { + if (current_block->is_pwr_sync()) { + planner.laser_inline.status.isSyncPower = true; + cutter.apply_power(current_block->laser.power); + } + } + #endif + + TERN_(LASER_SYNCHRONOUS_M106_M107, if (current_block->is_fan_sync()) planner.sync_fan_speeds(current_block->fan_speed)); + + if (!(current_block->is_fan_sync() || current_block->is_pwr_sync())) _set_position(current_block->position); discard_current_block(); @@ -2183,8 +2184,10 @@ uint32_t Stepper::block_phase_isr() { } // For non-inline cutter, grossly apply power - #if ENABLED(LASER_FEATURE) && DISABLED(LASER_POWER_INLINE) - cutter.apply_power(current_block->cutter_power); + #if HAS_CUTTER + if (cutter.cutter_mode == CUTTER_MODE_STANDARD) { + cutter.apply_power(current_block->cutter_power); + } #endif #if ENABLED(POWER_LOSS_RECOVERY) @@ -2357,36 +2360,22 @@ uint32_t Stepper::block_phase_isr() { set_directions(current_block->direction_bits); } - #if ENABLED(LASER_POWER_INLINE) - const power_status_t stat = current_block->laser.status; - #if ENABLED(LASER_POWER_INLINE_TRAPEZOID) - laser_trap.enabled = stat.isPlanned && stat.isEnabled; - laser_trap.cur_power = current_block->laser.power_entry; // RESET STATE - laser_trap.cruise_set = false; - #if DISABLED(LASER_POWER_INLINE_TRAPEZOID_CONT) - laser_trap.last_step_count = 0; - laser_trap.acc_step_count = current_block->laser.entry_per / 2; - #else - laser_trap.till_update = 0; - #endif - // Always have PWM in this case - if (stat.isPlanned) { // Planner controls the laser - cutter.ocr_set_power( - stat.isEnabled ? laser_trap.cur_power : 0 // ON with power or OFF - ); - } - #else - if (stat.isPlanned) { // Planner controls the laser - #if ENABLED(SPINDLE_LASER_USE_PWM) - cutter.ocr_set_power( - stat.isEnabled ? current_block->laser.power : 0 // ON with power or OFF - ); + #if ENABLED(LASER_FEATURE) + if (cutter.cutter_mode == CUTTER_MODE_CONTINUOUS) { // Planner controls the laser + if (planner.laser_inline.status.isSyncPower) + // If the previous block was a M3 sync power then skip the trap power init otherwise it will 0 the sync power. + planner.laser_inline.status.isSyncPower = false; // Clear the flag to process subsequent trap calc's. + else if (current_block->laser.status.isEnabled) { + #if ENABLED(LASER_POWER_TRAP) + TERN_(DEBUG_LASER_TRAP, SERIAL_ECHO_MSG("InitTrapPwr:",current_block->laser.trap_ramp_active_pwr)); + cutter.apply_power(current_block->laser.status.isPowered ? current_block->laser.trap_ramp_active_pwr : 0); #else - cutter.set_enabled(stat.isEnabled); + TERN_(DEBUG_CUTTER_POWER, SERIAL_ECHO_MSG("InlinePwr:",current_block->laser.power)); + cutter.apply_power(current_block->laser.status.isPowered ? current_block->laser.power : 0); #endif } - #endif - #endif // LASER_POWER_INLINE + } + #endif // LASER_FEATURE // If the endstop is already pressed, endstop interrupts won't invoke // endstop_triggered and the move will grind. So check here for a @@ -2416,21 +2405,6 @@ uint32_t Stepper::block_phase_isr() { // Calculate the initial timer interval interval = calc_timer_interval(current_block->initial_rate, &steps_per_isr); } - #if ENABLED(LASER_POWER_INLINE_CONTINUOUS) - else { // No new block found; so apply inline laser parameters - // This should mean ending file with 'M5 I' will stop the laser; thus the inline flag isn't needed - const power_status_t stat = planner.laser_inline.status; - if (stat.isPlanned) { // Planner controls the laser - #if ENABLED(SPINDLE_LASER_USE_PWM) - cutter.ocr_set_power( - stat.isEnabled ? planner.laser_inline.power : 0 // ON with power or OFF - ); - #else - cutter.set_enabled(stat.isEnabled); - #endif - } - } - #endif } // Return the interval to wait diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h index c9a83caa7edb..787599ce3115 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -444,25 +444,6 @@ class Stepper { // Current stepper motor directions (+1 or -1) static xyze_int8_t count_direction; - #if ENABLED(LASER_POWER_INLINE_TRAPEZOID) - - typedef struct { - bool enabled; // Trapezoid needed flag (i.e., laser on, planner in control) - uint8_t cur_power; // Current laser power - bool cruise_set; // Power set up for cruising? - - #if ENABLED(LASER_POWER_INLINE_TRAPEZOID_CONT) - uint16_t till_update; // Countdown to the next update - #else - uint32_t last_step_count, // Step count from the last update - acc_step_count; // Bresenham counter for laser accel/decel - #endif - } stepper_laser_t; - - static stepper_laser_t laser_trap; - - #endif - public: // Initialize stepper hardware static void init(); diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 9bdc6eced71c..65b79d8bc464 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -1904,9 +1904,10 @@ void Temperature::task() { #if ENABLED(LASER_COOLANT_FLOW_METER) cooler.flowmeter_task(ms); #if ENABLED(FLOWMETER_SAFETY) - if (cutter.enabled() && cooler.check_flow_too_low()) { + if (cooler.check_flow_too_low()) { + TERN_(HAS_DISPLAY, if (cutter.enabled()) ui.flow_fault()); cutter.disable(); - TERN_(HAS_DISPLAY, ui.flow_fault()); + cutter.cutter_mode = CUTTER_MODE_ERROR; // Immediately kill stepper inline power output } #endif #endif diff --git a/buildroot/tests/mega2560 b/buildroot/tests/mega2560 index 6871ce4a0cef..969b3b14ccbc 100755 --- a/buildroot/tests/mega2560 +++ b/buildroot/tests/mega2560 @@ -189,7 +189,7 @@ opt_set MOTHERBOARD BOARD_RAMPS_14_EFB EXTRUDERS 0 LCD_LANGUAGE en TEMP_SENSOR_C AXIS_RELATIVE_MODES '{ false, false, false }' opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER SDSUPPORT EEPROM_SETTINGS EEPROM_BOOT_SILENT EEPROM_AUTO_INIT MEATPACK_ON_SERIAL_PORT_1 \ LASER_FEATURE LASER_SAFETY_TIMEOUT_MS LASER_COOLANT_FLOW_METER AIR_EVACUATION AIR_EVACUATION_PIN AIR_ASSIST AIR_ASSIST_PIN -exec_test $1 $2 "MEGA2560 RAMPS | Laser Feature | Air Evacuation | Air Assist | Cooler | Flowmeter | 12864 LCD | meatpack | SERIAL_PORT_2 " "$3" +exec_test $1 $2 "MEGA2560 RAMPS | Laser Feature | Air Evacuation | Air Assist | Cooler | Flowmeter | 12864 LCD | meatpack | Laser Safety Timeout | M3 Power Sync | Trap Power Smoothing | SERIAL_PORT_2 " "$3" # # Test Laser features with 44780 LCD @@ -203,7 +203,7 @@ opt_set MOTHERBOARD BOARD_RAMPS_14_EFB EXTRUDERS 0 LCD_LANGUAGE en TEMP_SENSOR_C AXIS_RELATIVE_MODES '{ false, false, false }' opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT EEPROM_SETTINGS EEPROM_BOOT_SILENT EEPROM_AUTO_INIT PRINTCOUNTER I2C_AMMETER \ LASER_FEATURE LASER_SAFETY_TIMEOUT_MS LASER_COOLANT_FLOW_METER AIR_EVACUATION AIR_EVACUATION_PIN AIR_ASSIST AIR_ASSIST_PIN -exec_test $1 $2 "MEGA2560 RAMPS | Laser Feature | Air Evacuation | Air Assist | Cooler | Flowmeter | 44780 LCD " "$3" +exec_test $1 $2 "MEGA2560 RAMPS | Laser Feature | Air Evacuation | Air Assist | Cooler | Laser Safety Timeout | Flowmeter | 44780 LCD " "$3" # # Test redundant temperature sensors + MAX TC diff --git a/docs/Cutter.md b/docs/Cutter.md new file mode 100644 index 000000000000..c78b0551a0ac --- /dev/null +++ b/docs/Cutter.md @@ -0,0 +1,137 @@ +### Introduction + +With Marlin version 2.0.9.x or higher, Laser improvements were introduced that enhance inline functionality. Previously the inline feature option was not operational without enabling and recompiling the source. Also with inline enabled the base features are not functional. With v2.0.9.x new functionality is added which allows the standard and inline modes to be G-Code selectable and also compatible with each other. Additionally an experimental dynamic mode is also available. Spindle operational features are available with defines and recompiling. + +### Architecture + +Laser selectable feature capability is defined through 4 global mode flags within gcode ,laser/spindle, planner and stepper routines. The default mode maintains the standard laser function. G-Codes are received, processed and parsed to determine what mode to set through M3, M4 and M5 commands. When the inline mode parameter set is detected, laser power processing will be driven through the planner and stepper routines. Handling of the initial power values and settings are performed by G-Code parsing and the laser/spindle routines. + +Inline power feeds from the block->inline_power variable into the planner's laser.power when in continuous power mode. Further power adjustment will be applied if the laser power trap feature is active otherwise laser.power is used as set in the stepper for the entire block. When laser power trap is active the power levels are step incremented during acceleration and step decremented during deceleration. + +Two additional power sets are fed in the planner by features laser power sync and laser fan power sync. Both of these power sets are done with planner sync block bit flags. With laser power sync, when the bit flag is matched the global block laser.power value is updated from laser/spindle standard M3 S-Value power sets. For laser fan sync, power values are updated into the planner block->fan_speed[i] variable from fan G-Code S-Value sets. + +With dynamic inline power mode, F-Value feedrate sets are processed with cutter.calc_dynamic_power() and fed into the planner laser.power value. + +Irrespective of what laser power value source is used, the final laser output pin is always updated using the laser/spindle code. Specifically the apply_power(value) call is used to set the laser or spindle output. This call permits safe power control in the event that a sensor fault occurs. + +Note: Spindle operation is not selectable with G-Codes at this time. + +The following flow charts depict the flow control logic for spindle and laser operations in the code base. + +#### Spindle Mode Logic: + + ┌──────────┐ ┌───────────┐ ┌───────────┐ + │M3 S-Value│ │Dir !same ?│ │Stepper │ + │Spindle │ │stop & wait│ │processes │ + ┌──┤Clockwise ├──┤ & start ├──┤moves │ + ┌─────┐ │ │ │ │spindle │ │ │ + │GCode│ │ └──────────┘ └───────────┘ └───────────┘ + │Send ├──┤ ┌──────────┐ ┌───────────┐ ┌───────────┐ + └─────┘ │ │M4 S-Value│ │Dir !same ?│ │Stepper │ + ├──┤Spindle ├──┤stop & wait├──┤processes │ + │ │Counter │ │& start │ │moves │ + │ │Clockwise │ │spindle │ │ │ + │ └──────────┘ └───────────┘ └───────────┘ + │ ┌──────────┐ ┌────────┐ + │ │M5 │ │Wait for│ + │ │Spindle ├──┤move & │ + └──┤Stop │ │disable │ + └──────────┘ └────────┘ + ┌──────────┐ ┌──────────┐ + Sensors─────┤Fault ├──┤Disable │ + └──────────┘ │power │ + └──────────┘ + +#### Laser Mode Logic: + + ┌──────────┐ ┌─────────────┐ ┌───────────┐ + │M3,M4,M5 I│ │Set power │ │Stepper │ + ┌──┤Standard ├──┤Immediately &├──┤processes │ + │ │Default │ │wait for move│ │moves │ + │ │ │ │completion │ │ │ + │ └──────────┘ └─────────────┘ └───────────┘ + │ ┌──────────┐ ┌───────────┐ ┌───────────┐ ┌────────────┐ ┌────────────┐ ┌────────────┐ ┌───────────┐ + ┌─────┐ │ │M3 I │ │G0,G1,G2,G4│ │Planner │ │Planner │ │Planner fan │ │Planner │ │Stepper │ + │GCode│ │ │Continuous│ │M3 receive │ │sets block │ │sync power ?│ │sync power ?│ │trap power ?│ │uses block │ + │Send ├──┼──┤Inline ├──┤power from ├──┤power using├──┤process M3 ├──┤process fan ├──┤adjusts for ├──┤values to │ + └─────┘ │ │ │ │S-Value │ │Gx S-Value │ │power inline│ │power inline│ │accel/decel │ │apply power│ + │ └──────────┘ └───────────┘ └───────────┘ └────────────┘ └────────────┘ └────────────┘ └───────────┘ + │ ┌──────────┐ ┌───────────┐ ┌────────────────┐ ┌───────────┐ + │ │M4 I │ │Gx F-Value │ │Planner │ │Stepper │ + │ │Dynamic │ │set power │ │Calc & set block│ │uses block │ + └──┤Inline ├──┤or use ├──┤block power ├──┤values to │ + │ │ │default │ │using F-Value │ │apply power│ + └──────────┘ └───────────┘ └────────────────┘ └───────────┘ + ┌──────────┐ ┌──────────┐ + Sensors─────┤Fault ├──┤Disable │ + └──────────┘ │Power │ + └──────────┘ + + + +### Continuous Inline Trap Power Calculations + +When LASER_FEATURE and LASER_POWER_TRAP are defined, planner calculations are performed and applied to the incoming laser power S-Value. The power will be factored and distributed across trapezoid acceleration and deceleration movements. + +When the laser.power > 0 + +We set a minimum power if defined in SPEED_POWER_MIN it's fed into the planner block as laser_power_floor. + +A reduced entry laser power factor is based on the entry step rate to cruise step rate ratio for acceleration. + + block entry laser power = laser power * ( entry step rate / cruise step rate ) + +The initial power will be set to no less than the laser_power_floor or the inital power calculation. + +The reduced final power factor is based on the final step rate to cruise step rate ratio for deceleration. + + block exit laser power = laser power * ( exit step rate / cruise step rate ) + +Once the entry and exit power values are determined, the values are divided into step increments to be applied in the stepper. + + trap step power incr_decr = ( cruize power - entry_exit ) / accel_decel_steps + +The trap steps are incremented or decremented during each accel or decel step until the block is complete. +Step power is either cumulatively added or subtracted during trapeziod ramp progressions. + +#### Planner Code: + + ``` + if (block->laser.power > 0) { + NOLESS(block->laser.power, laser_power_floor); + block->laser.trap_ramp_active_pwr = (block->laser.power - laser_power_floor) * (initial_rate / float(block->nominal_rate)) + laser_power_floor; + block->laser.trap_ramp_entry_incr = (block->laser.power - block->laser.trap_ramp_active_pwr) / accelerate_steps; + float laser_pwr = block->laser.power * (final_rate / float(block->nominal_rate)); + NOLESS(laser_pwr, laser_power_floor); + block->laser.trap_ramp_exit_decr = (block->laser.power - laser_pwr) / decelerate_steps; + ``` + +#### Stepper Code: + + ``` + if (current_block->laser.trap_ramp_entry_incr > 0) { + cutter.apply_power(current_block->laser.trap_ramp_active_pwr); + current_block->laser.trap_ramp_active_pwr += current_block->laser.trap_ramp_entry_incr; + ``` + + ``` + if (current_block->laser.trap_ramp_exit_decr > 0) { + current_block->laser.trap_ramp_active_pwr -= current_block->laser.trap_ramp_exit_decr; + cutter.apply_power(current_block->laser.trap_ramp_active_pwr); + ``` + +### Dynamic Inline Calculations + +Dynamic mode will calculate laser power based on the F-Value feedrate. The method uses bit shifting to set a power level from 0 to 255. It's simple and fast and we can use a scaler to shift the laser power output to center on a given power level. + +#### Spindle/Laser Code: + +``` + // Dynamic mode rate calculation + static inline uint8_t calc_dynamic_power() { + if (feedrate_mm_m > 65535) return 255; // Too fast, go always on + uint16_t rate = uint16_t(feedrate_mm_m); // 16 bits from the G-code parser float input + rate >>= 8; // Take the G-code input e.g. F40000 and shift off the lower bits to get an OCR value from 1-255 + return uint8_t(rate); + } +``` From 55417b28fe9f74ec94e625358454f7a1e2652622 Mon Sep 17 00:00:00 2001 From: Eduard Sukharev Date: Wed, 6 Jul 2022 16:30:47 +0300 Subject: [PATCH 233/241] =?UTF-8?q?=F0=9F=90=9B=20Fix=20MKS=20TinyBee=20co?= =?UTF-8?q?mpile=20(#24454)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/ESP32/HAL.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/HAL/ESP32/HAL.h b/Marlin/src/HAL/ESP32/HAL.h index 600ca8f5ee37..ddfedf92eed9 100644 --- a/Marlin/src/HAL/ESP32/HAL.h +++ b/Marlin/src/HAL/ESP32/HAL.h @@ -60,8 +60,8 @@ #endif #endif -#define CRITICAL_SECTION_START() portENTER_CRITICAL(&spinlock) -#define CRITICAL_SECTION_END() portEXIT_CRITICAL(&spinlock) +#define CRITICAL_SECTION_START() portENTER_CRITICAL(&hal.spinlock) +#define CRITICAL_SECTION_END() portEXIT_CRITICAL(&hal.spinlock) #define HAL_CAN_SET_PWM_FREQ // This HAL supports PWM Frequency adjustment #define PWM_FREQUENCY 1000u // Default PWM frequency when set_pwm_duty() is called without set_pwm_frequency() From a88e8472954cf57dab1008f6e80a103347e3731e Mon Sep 17 00:00:00 2001 From: Bob Kuhn Date: Wed, 6 Jul 2022 08:35:08 -0500 Subject: [PATCH 234/241] =?UTF-8?q?=F0=9F=90=9B=20Fix=20Sensorless=20Probi?= =?UTF-8?q?ng=20compile=20(#24455)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/delta.cpp | 4 -- Marlin/src/module/delta.h | 4 -- Marlin/src/module/probe.cpp | 83 +++++++++++-------------------------- Marlin/src/module/probe.h | 12 +++--- 4 files changed, 30 insertions(+), 73 deletions(-) diff --git a/Marlin/src/module/delta.cpp b/Marlin/src/module/delta.cpp index 8207dacaf700..ce2a6f4adad0 100644 --- a/Marlin/src/module/delta.cpp +++ b/Marlin/src/module/delta.cpp @@ -60,10 +60,6 @@ xy_float_t delta_tower[ABC]; abc_float_t delta_diagonal_rod_2_tower; float delta_clip_start_height = Z_MAX_POS; abc_float_t delta_diagonal_rod_trim; -#if HAS_DELTA_SENSORLESS_PROBING - abc_float_t offset_sensorless_adj{0}; - float largest_sensorless_adj = 0; -#endif float delta_safe_distance_from_top(); diff --git a/Marlin/src/module/delta.h b/Marlin/src/module/delta.h index f7067ef9c713..0a0c6124eecf 100644 --- a/Marlin/src/module/delta.h +++ b/Marlin/src/module/delta.h @@ -38,10 +38,6 @@ extern xy_float_t delta_tower[ABC]; extern abc_float_t delta_diagonal_rod_2_tower; extern float delta_clip_start_height; extern abc_float_t delta_diagonal_rod_trim; -#if HAS_DELTA_SENSORLESS_PROBING - extern abc_float_t offset_sensorless_adj; - extern float largest_sensorless_adj; -#endif /** * Recalculate factors used for delta kinematics whenever diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 2649aa41b634..ed8d4a1429a7 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -48,6 +48,11 @@ #include "delta.h" #endif +#if ENABLED(SENSORLESS_PROBING) + abc_float_t offset_sensorless_adj{0}; + float largest_sensorless_adj = 0; +#endif + #if ANY(HAS_QUIET_PROBING, USE_SENSORLESS) #include "stepper/indirection.h" #if BOTH(HAS_QUIET_PROBING, PROBING_ESTEPPERS_OFF) @@ -867,76 +872,38 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai #endif // HAS_Z_SERVO_PROBE -#if USE_SENSORLESS - - sensorless_t stealth_states { false }; - - /** - * Disable stealthChop if used. Enable diag1 pin on driver. - */ - void Probe::enable_stallguard_diag1() { - #if ENABLED(SENSORLESS_PROBING) - #if HAS_DELTA_SENSORLESS_PROBING - stealth_states.x = tmc_enable_stallguard(stepperX); - stealth_states.y = tmc_enable_stallguard(stepperY); - #endif - stealth_states.z = tmc_enable_stallguard(stepperZ); - endstops.enable(true); - #endif - } - - /** - * Re-enable stealthChop if used. Disable diag1 pin on driver. - */ - void Probe::disable_stallguard_diag1() { - #if ENABLED(SENSORLESS_PROBING) - endstops.not_homing(); - #if HAS_DELTA_SENSORLESS_PROBING - tmc_disable_stallguard(stepperX, stealth_states.x); - tmc_disable_stallguard(stepperY, stealth_states.y); - #endif - tmc_disable_stallguard(stepperZ, stealth_states.z); - #endif - } +#if HAS_DELTA_SENSORLESS_PROBING /** * Set the sensorless Z offset */ void Probe::set_offset_sensorless_adj(const_float_t sz) { - #if ENABLED(SENSORLESS_PROBING) - DEBUG_SECTION(pso, "Probe::set_offset_sensorless_adj", true); - #if HAS_DELTA_SENSORLESS_PROBING - if (test_sensitivity.x) offset_sensorless_adj.a = sz; - if (test_sensitivity.y) offset_sensorless_adj.b = sz; - #endif - if (test_sensitivity.z) offset_sensorless_adj.c = sz; - #endif + DEBUG_SECTION(pso, "Probe::set_offset_sensorless_adj", true); + if (test_sensitivity.x) offset_sensorless_adj.a = sz; + if (test_sensitivity.y) offset_sensorless_adj.b = sz; + if (test_sensitivity.z) offset_sensorless_adj.c = sz; } /** * Refresh largest_sensorless_adj based on triggered endstops */ void Probe::refresh_largest_sensorless_adj() { - #if ENABLED(SENSORLESS_PROBING) - DEBUG_SECTION(rso, "Probe::refresh_largest_sensorless_adj", true); - largest_sensorless_adj = -3; // A reference away from any real probe height - #if HAS_DELTA_SENSORLESS_PROBING - if (TEST(endstops.state(), X_MAX)) { - NOLESS(largest_sensorless_adj, offset_sensorless_adj.a); - DEBUG_ECHOLNPGM("Endstop_X: ", largest_sensorless_adj, " TowerX"); - } - if (TEST(endstops.state(), Y_MAX)) { - NOLESS(largest_sensorless_adj, offset_sensorless_adj.b); - DEBUG_ECHOLNPGM("Endstop_Y: ", largest_sensorless_adj, " TowerY"); - } - #endif - if (TEST(endstops.state(), Z_MAX)) { - NOLESS(largest_sensorless_adj, offset_sensorless_adj.c); - DEBUG_ECHOLNPGM("Endstop_Z: ", largest_sensorless_adj, " TowerZ"); - } - #endif + DEBUG_SECTION(rso, "Probe::refresh_largest_sensorless_adj", true); + largest_sensorless_adj = -3; // A reference away from any real probe height + if (TEST(endstops.state(), X_MAX)) { + NOLESS(largest_sensorless_adj, offset_sensorless_adj.a); + DEBUG_ECHOLNPGM("Endstop_X: ", largest_sensorless_adj, " TowerX"); + } + if (TEST(endstops.state(), Y_MAX)) { + NOLESS(largest_sensorless_adj, offset_sensorless_adj.b); + DEBUG_ECHOLNPGM("Endstop_Y: ", largest_sensorless_adj, " TowerY"); + } + if (TEST(endstops.state(), Z_MAX)) { + NOLESS(largest_sensorless_adj, offset_sensorless_adj.c); + DEBUG_ECHOLNPGM("Endstop_Z: ", largest_sensorless_adj, " TowerZ"); + } } -#endif // SENSORLESS_PROBING || SENSORLESS_HOMING +#endif #endif // HAS_BED_PROBE diff --git a/Marlin/src/module/probe.h b/Marlin/src/module/probe.h index ca596e896977..1bcbc6564241 100644 --- a/Marlin/src/module/probe.h +++ b/Marlin/src/module/probe.h @@ -62,16 +62,16 @@ #endif #endif +#if ENABLED(SENSORLESS_PROBING) + extern abc_float_t offset_sensorless_adj; +#endif + class Probe { public: #if ENABLED(SENSORLESS_PROBING) typedef struct { - #if HAS_DELTA_SENSORLESS_PROBING bool x:1, y:1, z:1; - #else - bool z; - #endif } sense_bool_t; static sense_bool_t test_sensitivity; #endif @@ -302,9 +302,7 @@ class Probe { #endif // Basic functions for Sensorless Homing and Probing - #if USE_SENSORLESS - static void enable_stallguard_diag1(); - static void disable_stallguard_diag1(); + #if HAS_DELTA_SENSORLESS_PROBING static void set_offset_sensorless_adj(const_float_t sz); static void refresh_largest_sensorless_adj(); #endif From 9805d2bc38ded62827ed40c0bf2d343abd98864d Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Wed, 6 Jul 2022 18:05:37 +0000 Subject: [PATCH 235/241] [cron] Bump distribution date (2022-07-06) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 5cf727a48f81..50b33e1bef4f 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-07-05" +//#define STRING_DISTRIBUTION_DATE "2022-07-06" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index d073ed5b232e..e1bc53e53200 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-07-05" + #define STRING_DISTRIBUTION_DATE "2022-07-06" #endif /** From 58048e7748568a77d64832e0c9ce2eada1e3873a Mon Sep 17 00:00:00 2001 From: Christophe Huriaux Date: Wed, 6 Jul 2022 22:43:38 +0200 Subject: [PATCH 236/241] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20ST7565=20LCD=20con?= =?UTF-8?q?trast=20init=20(#24457)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 6 ++++++ Marlin/src/inc/Conditionals_LCD.h | 5 ++++- Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp | 8 +++++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 15106a20a324..ce2b8fcd6f56 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -2631,6 +2631,12 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// eMotion Tech LCD with SD +// https://www.reprap-france.com/produit/1234568748-ecran-graphique-128-x-64-points-2-1 +// +//#define EMOTION_TECH_LCD + //============================================================================= //============================== OLED Displays ============================== //============================================================================= diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index e41bc0d48977..8d29b177dd56 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -99,7 +99,7 @@ #define IS_ULTIPANEL 1 #define STD_ENCODER_PULSES_PER_STEP 2 -#elif ANY(miniVIKI, VIKI2, WYH_L12864, ELB_FULL_GRAPHIC_CONTROLLER, AZSMZ_12864) +#elif ANY(miniVIKI, VIKI2, WYH_L12864, ELB_FULL_GRAPHIC_CONTROLLER, AZSMZ_12864, EMOTION_TECH_LCD) #define DOGLCD #define IS_DOGM_12864 1 @@ -116,6 +116,9 @@ #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) diff --git a/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp b/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp index bfd44d08dfbb..63e7b2e2b8b5 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp @@ -74,7 +74,6 @@ #define ST7565_ON(N) ((N) ? 0xAF : 0xAE) #define ST7565_OUT_MODE(N) ((N) ? 0xC8 : 0xC0) #define ST7565_POWER_CONTROL(N) (0x28 | (N)) -#define ST7565_V0_RATIO(N) (0x10 | ((N) & 0x7)) #define ST7565_V5_RATIO(N) (0x20 | ((N) & 0x7)) #define ST7565_CONTRAST(N) (0x81), (N) @@ -106,11 +105,14 @@ static const uint8_t u8g_dev_st7565_64128n_HAL_init_seq[] PROGMEM = { ST7565_POWER_CONTROL(0x7), // power control: turn on voltage follower U8G_ESC_DLY(50), // delay 50 ms - ST7565_V0_RATIO(0), // Set V0 voltage resistor ratio. Setting for controlling brightness of Displaytech 64128N + #ifdef ST7565_VOLTAGE_DIVIDER_VALUE + // Set V5 voltage resistor ratio. Affects brightness of Displaytech 64128N + ST7565_V5_RATIO(ST7565_VOLTAGE_DIVIDER_VALUE), + #endif ST7565_INVERTED(0), // display normal, bit val 0: LCD pixel off. - ST7565_CONTRAST(0x1E), // Contrast value. Setting for controlling brightness of Displaytech 64128N + ST7565_CONTRAST(0x1E), // Contrast value for Displaytech 64128N ST7565_ON(1), // display on From 509dfe92d0c2227ddece025fb97875582ca47aed Mon Sep 17 00:00:00 2001 From: Meilleur Gars <98503100+LCh-77@users.noreply.github.com> Date: Wed, 6 Jul 2022 13:46:11 -0700 Subject: [PATCH 237/241] =?UTF-8?q?=F0=9F=9A=B8=20JyersUI=20updates=20(#24?= =?UTF-8?q?451)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/bedlevel/abl/G29.cpp | 2 + Marlin/src/gcode/config/M575.cpp | 9 +- Marlin/src/gcode/control/M997.cpp | 3 + Marlin/src/gcode/lcd/M0_M1.cpp | 4 + Marlin/src/gcode/probe/G30.cpp | 10 +- Marlin/src/gcode/stats/M75-M78.cpp | 16 +- Marlin/src/gcode/temp/M303.cpp | 3 + Marlin/src/inc/Conditionals_LCD.h | 9 +- Marlin/src/inc/Conditionals_post.h | 2 +- Marlin/src/inc/SanityCheck.h | 2 +- Marlin/src/lcd/e3v2/common/dwin_api.cpp | 10 +- Marlin/src/lcd/e3v2/jyersui/base64.hpp | 208 ++ Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 3090 ++++++++++++----- Marlin/src/lcd/e3v2/jyersui/dwin.h | 230 +- Marlin/src/lcd/e3v2/jyersui/dwin_defines.h | 131 + Marlin/src/lcd/e3v2/jyersui/dwin_lcd.cpp | 33 +- Marlin/src/lcd/e3v2/jyersui/dwin_lcd.h | 8 + Marlin/src/lcd/e3v2/jyersui/dwinui.cpp | 340 ++ Marlin/src/lcd/e3v2/jyersui/dwinui.h | 527 +++ Marlin/src/lcd/e3v2/jyersui/endstop_diag.cpp | 111 + Marlin/src/lcd/e3v2/jyersui/endstop_diag.h | 39 + Marlin/src/lcd/e3v2/jyersui/gcode_preview.cpp | 244 ++ Marlin/src/lcd/e3v2/jyersui/gcode_preview.h | 34 + Marlin/src/lcd/e3v2/jyersui/lockscreen.cpp | 83 + Marlin/src/lcd/e3v2/jyersui/lockscreen.h | 49 + Marlin/src/lcd/e3v2/jyersui/plot.cpp | 86 + Marlin/src/lcd/e3v2/jyersui/plot.h | 41 + Marlin/src/lcd/e3v2/proui/base64.hpp | 6 +- Marlin/src/lcd/e3v2/proui/gcode_preview.cpp | 6 +- Marlin/src/lcd/e3v2/proui/gcode_preview.h | 2 +- Marlin/src/module/settings.cpp | 6 +- Marlin/src/module/temperature.cpp | 8 + 32 files changed, 4352 insertions(+), 1000 deletions(-) create mode 100644 Marlin/src/lcd/e3v2/jyersui/base64.hpp create mode 100644 Marlin/src/lcd/e3v2/jyersui/dwin_defines.h create mode 100644 Marlin/src/lcd/e3v2/jyersui/dwinui.cpp create mode 100644 Marlin/src/lcd/e3v2/jyersui/dwinui.h create mode 100644 Marlin/src/lcd/e3v2/jyersui/endstop_diag.cpp create mode 100644 Marlin/src/lcd/e3v2/jyersui/endstop_diag.h create mode 100644 Marlin/src/lcd/e3v2/jyersui/gcode_preview.cpp create mode 100644 Marlin/src/lcd/e3v2/jyersui/gcode_preview.h create mode 100644 Marlin/src/lcd/e3v2/jyersui/lockscreen.cpp create mode 100644 Marlin/src/lcd/e3v2/jyersui/lockscreen.h create mode 100644 Marlin/src/lcd/e3v2/jyersui/plot.cpp create mode 100644 Marlin/src/lcd/e3v2/jyersui/plot.h diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index a2c53b5ab253..e8c9c4a1857c 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -51,6 +51,8 @@ #include "../../../lcd/e3v2/creality/dwin.h" #elif ENABLED(DWIN_LCD_PROUI) #include "../../../lcd/e3v2/proui/dwin.h" +#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) + #include "../../../lcd/e3v2/jyersui/dwin.h" #endif #if HAS_MULTI_HOTEND diff --git a/Marlin/src/gcode/config/M575.cpp b/Marlin/src/gcode/config/M575.cpp index 2c12428d982a..f96bca8a3ee3 100644 --- a/Marlin/src/gcode/config/M575.cpp +++ b/Marlin/src/gcode/config/M575.cpp @@ -26,6 +26,10 @@ #include "../gcode.h" +#if ENABLED(DWIN_CREALITY_LCD_JYERSUI) + #include "../../lcd/e3v2/jyersui/dwin.h" +#endif + /** * M575 - Change serial baud rate * @@ -65,7 +69,10 @@ void GcodeSuite::M575() { SERIAL_FLUSH(); - if (set1) { MYSERIAL1.end(); MYSERIAL1.begin(baud); } + if (set1) { + MYSERIAL1.end(); MYSERIAL1.begin(baud); + TERN_(DWIN_CREALITY_LCD_JYERSUI, eeprom_settings.Baud115k = (baud == 115200)); + } #if HAS_MULTI_SERIAL if (set2) { MYSERIAL2.end(); MYSERIAL2.begin(baud); } #ifdef SERIAL_PORT_3 diff --git a/Marlin/src/gcode/control/M997.cpp b/Marlin/src/gcode/control/M997.cpp index 74ed8b0d073e..66a0256c44ef 100644 --- a/Marlin/src/gcode/control/M997.cpp +++ b/Marlin/src/gcode/control/M997.cpp @@ -26,6 +26,8 @@ #if ENABLED(DWIN_LCD_PROUI) #include "../../lcd/e3v2/proui/dwin.h" +#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) + #include "../../lcd/e3v2/jyersui/dwin.h" #endif /** @@ -34,6 +36,7 @@ void GcodeSuite::M997() { TERN_(DWIN_LCD_PROUI, DWIN_RebootScreen()); + TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWIN.DWIN_RebootScreen()); flashFirmware(parser.intval('S')); diff --git a/Marlin/src/gcode/lcd/M0_M1.cpp b/Marlin/src/gcode/lcd/M0_M1.cpp index af03fcb0b1a1..b6d2131555c6 100644 --- a/Marlin/src/gcode/lcd/M0_M1.cpp +++ b/Marlin/src/gcode/lcd/M0_M1.cpp @@ -38,6 +38,8 @@ #elif ENABLED(DWIN_LCD_PROUI) #include "../../lcd/e3v2/proui/dwin_popup.h" #include "../../lcd/e3v2/proui/dwin.h" +#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) + #include "../../lcd/e3v2/jyersui/dwin.h" #endif #if ENABLED(HOST_PROMPT_SUPPORT) @@ -76,6 +78,8 @@ void GcodeSuite::M0_M1() { DWIN_Popup_Confirm(ICON_BLTouch, parser.string_arg, GET_TEXT_F(MSG_USERWAIT)); else DWIN_Popup_Confirm(ICON_BLTouch, GET_TEXT_F(MSG_STOPPED), GET_TEXT_F(MSG_USERWAIT)); + #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) + CrealityDWIN.Confirm_Handler(UserInput, parser.string_arg == nullptr); #else if (parser.string_arg) { diff --git a/Marlin/src/gcode/probe/G30.cpp b/Marlin/src/gcode/probe/G30.cpp index a16853bdf894..b22ec6eb7f7f 100644 --- a/Marlin/src/gcode/probe/G30.cpp +++ b/Marlin/src/gcode/probe/G30.cpp @@ -33,7 +33,7 @@ #include "../../feature/probe_temp_comp.h" #endif -#if ENABLED(DWIN_LCD_PROUI) +#if EITHER(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) #include "../../lcd/marlinui.h" #endif @@ -53,7 +53,7 @@ void GcodeSuite::G30() { parser.linearval('Y', current_position.y + probe.offset_xy.y) }; if (!probe.can_reach(pos)) { - #if ENABLED(DWIN_LCD_PROUI) + #if EITHER(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) SERIAL_ECHOLNF(GET_EN_TEXT_F(MSG_ZPROBE_OUT)); LCD_MESSAGE(MSG_ZPROBE_OUT); #endif @@ -65,7 +65,9 @@ void GcodeSuite::G30() { remember_feedrate_scaling_off(); - TERN_(DWIN_LCD_PROUI, process_subcommands_now(F("G28O"))); + #if EITHER(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) + process_subcommands_now(F("G28O")); + #endif const ProbePtRaise raise_after = parser.boolval('E', true) ? PROBE_PT_STOW : PROBE_PT_NONE; @@ -74,7 +76,7 @@ void GcodeSuite::G30() { TERN_(HAS_PTC, ptc.set_enabled(true)); if (!isnan(measured_z)) { SERIAL_ECHOLNPGM("Bed X: ", pos.x, " Y: ", pos.y, " Z: ", measured_z); - #if ENABLED(DWIN_LCD_PROUI) + #if EITHER(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) char msg[31], str_1[6], str_2[6], str_3[6]; sprintf_P(msg, PSTR("X:%s, Y:%s, Z:%s"), dtostrf(pos.x, 1, 1, str_1), diff --git a/Marlin/src/gcode/stats/M75-M78.cpp b/Marlin/src/gcode/stats/M75-M78.cpp index 0ed1e6693013..13a593bc30f1 100644 --- a/Marlin/src/gcode/stats/M75-M78.cpp +++ b/Marlin/src/gcode/stats/M75-M78.cpp @@ -33,15 +33,23 @@ #include "../../lcd/e3v2/proui/dwin.h" #endif +#if ENABLED(DWIN_CREALITY_LCD_JYERSUI) + #include "../../lcd/e3v2/jyersui/dwin.h" +#endif + /** * M75: Start print timer */ void GcodeSuite::M75() { startOrResumeJob(); - #if ENABLED(DWIN_LCD_PROUI) - DWIN_Print_Started(false); - if (!IS_SD_PRINTING()) DWIN_Print_Header(parser.string_arg && parser.string_arg[0] ? parser.string_arg : GET_TEXT(MSG_HOST_START_PRINT)); - #endif + TERN_(DWIN_LCD_PROUI, DWIN_Print_Started(false)); + if (!IS_SD_PRINTING()) { + #if ENABLED(DWIN_LCD_PROUI) + DWIN_Print_Header(parser.string_arg && parser.string_arg[0] ? parser.string_arg : GET_TEXT(MSG_HOST_START_PRINT)); + #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) + CrealityDWIN.Update_Print_Filename(parser.string_arg && parser.string_arg[0] ? parser.string_arg : GET_TEXT(MSG_HOST_START_PRINT)); + #endif + } } /** diff --git a/Marlin/src/gcode/temp/M303.cpp b/Marlin/src/gcode/temp/M303.cpp index ce362984a6ca..2bd05f75373c 100644 --- a/Marlin/src/gcode/temp/M303.cpp +++ b/Marlin/src/gcode/temp/M303.cpp @@ -32,6 +32,8 @@ #include "../../lcd/extui/ui_api.h" #elif ENABLED(DWIN_LCD_PROUI) #include "../../lcd/e3v2/proui/dwin.h" +#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) + #include "../../lcd/e3v2/jyersui/dwin.h" #endif /** @@ -75,6 +77,7 @@ void GcodeSuite::M303() { SERIAL_ECHOLNPGM(STR_PID_BAD_HEATER_ID); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_BAD_EXTRUDER_NUM)); TERN_(DWIN_LCD_PROUI, DWIN_PidTuning(PID_BAD_EXTRUDER_NUM)); + TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWINClass::DWIN_PidTuning(PID_BAD_EXTRUDER_NUM)); return; } diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 8d29b177dd56..bf8d5e122a5e 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -1256,6 +1256,8 @@ #endif #if ANY(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_3POINT) #define HAS_ABL_NOT_UBL 1 +#else + #undef PROBE_MANUALLY #endif #if ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_UBL, MESH_BED_LEVELING) #define HAS_MESH 1 @@ -1274,14 +1276,11 @@ #if DISABLED(AUTO_BED_LEVELING_UBL) #define PLANNER_LEVELING 1 #endif -#endif -#if !HAS_LEVELING +#else #undef RESTORE_LEVELING_AFTER_G28 #undef ENABLE_LEVELING_AFTER_G28 #undef G29_RETRY_AND_RECOVER -#endif -#if !HAS_LEVELING || EITHER(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL) - #undef PROBE_MANUALLY + #undef PREHEAT_BEFORE_LEVELING #endif #if ANY(HAS_BED_PROBE, PROBE_MANUALLY, MESH_BED_LEVELING) #define PROBE_SELECTED 1 diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 9edcd6f1aa9a..0f4cf1381a7f 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -3541,7 +3541,7 @@ #ifndef MESH_MAX_Y #define MESH_MAX_Y _MESH_MAX_Y #endif -#else +#elif DISABLED(DWIN_CREALITY_LCD_JYERSUI) #undef MESH_MIN_X #undef MESH_MIN_Y #undef MESH_MAX_X diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index a967f0109457..8ef8a3d2d64a 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -3671,7 +3671,7 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive."); #error "A very large BLOCK_BUFFER_SIZE is not needed and takes longer to drain the buffer on pause / cancel." #endif -#if ENABLED(LED_CONTROL_MENU) && NONE(HAS_MARLINUI_MENU, DWIN_LCD_PROUI) +#if ENABLED(LED_CONTROL_MENU) && NONE(HAS_MARLINUI_MENU, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) #error "LED_CONTROL_MENU requires an LCD controller that implements the menu." #endif diff --git a/Marlin/src/lcd/e3v2/common/dwin_api.cpp b/Marlin/src/lcd/e3v2/common/dwin_api.cpp index 3f699465a9c8..79998219a95e 100644 --- a/Marlin/src/lcd/e3v2/common/dwin_api.cpp +++ b/Marlin/src/lcd/e3v2/common/dwin_api.cpp @@ -234,7 +234,7 @@ void DWIN_Frame_AreaMove(uint8_t mode, uint8_t dir, uint16_t dis, // *string: The string // rlimit: To limit the drawn string length void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const char * const string, uint16_t rlimit/*=0xFFFF*/) { - #if DISABLED(DWIN_LCD_PROUI) + #if NONE(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) DWIN_Draw_Rectangle(1, bColor, x, y, x + (fontWidth(size) * strlen_P(string)), y + fontHeight(size)); #endif constexpr uint8_t widthAdjust = 0; @@ -266,7 +266,9 @@ void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, void DWIN_Draw_IntValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, uint32_t value) { size_t i = 0; - DWIN_Draw_Rectangle(1, bColor, x, y, x + fontWidth(size) * iNum + 1, y + fontHeight(size)); + #if DISABLED(DWIN_CREALITY_LCD_JYERSUI) + DWIN_Draw_Rectangle(1, bColor, x, y, x + fontWidth(size) * iNum + 1, y + fontHeight(size)); + #endif DWIN_Byte(i, 0x14); // Bit 7: bshow // Bit 6: 1 = signed; 0 = unsigned number; @@ -314,7 +316,9 @@ void DWIN_Draw_FloatValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_ uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, int32_t value) { //uint8_t *fvalue = (uint8_t*)&value; size_t i = 0; - DWIN_Draw_Rectangle(1, bColor, x, y, x + fontWidth(size) * (iNum+fNum+1), y + fontHeight(size)); + #if DISABLED(DWIN_CREALITY_LCD_JYERSUI) + DWIN_Draw_Rectangle(1, bColor, x, y, x + fontWidth(size) * (iNum+fNum+1), y + fontHeight(size)); + #endif DWIN_Byte(i, 0x14); DWIN_Byte(i, (bShow * 0x80) | (zeroFill * 0x20) | (zeroMode * 0x10) | size); DWIN_Word(i, color); diff --git a/Marlin/src/lcd/e3v2/jyersui/base64.hpp b/Marlin/src/lcd/e3v2/jyersui/base64.hpp new file mode 100644 index 000000000000..7a933df321b8 --- /dev/null +++ b/Marlin/src/lcd/e3v2/jyersui/base64.hpp @@ -0,0 +1,208 @@ +/** + * Base64 encoder/decoder for arduino repo + * Uses common web conventions - '+' for 62, '/' for 63, '=' for padding. + * Note that invalid base64 characters are interpreted as padding. + * Author: Densaugeo + * Maintainer: Densaugeo + * Version: 1.2.1.1 + * Changed unsigned int to uint16_t for use in the professional Ender 3V2/S1 firmware + * Url: https://www.arduino.cc/reference/en/libraries/base64/ + */ + +#ifndef BASE64_H_INCLUDED +#define BASE64_H_INCLUDED + +/* binary_to_base64: + * Description: + * Converts a single byte from a binary value to the corresponding base64 character + * Parameters: + * v - Byte to convert + * Returns: + * ascii code of base64 character. If byte is >= 64, then there is not corresponding base64 character + * and 255 is returned + */ +unsigned char binary_to_base64(unsigned char v); + +/* base64_to_binary: + * Description: + * Converts a single byte from a base64 character to the corresponding binary value + * Parameters: + * c - Base64 character (as ascii code) + * Returns: + * 6-bit binary value + */ +unsigned char base64_to_binary(unsigned char c); + +/* encode_base64_length: + * Description: + * Calculates length of base64 string needed for a given number of binary bytes + * Parameters: + * input_length - Amount of binary data in bytes + * Returns: + * Number of base64 characters needed to encode input_length bytes of binary data + */ +uint16_t encode_base64_length(uint16_t input_length); + +/* decode_base64_length: + * Description: + * Calculates number of bytes of binary data in a base64 string + * Variant that does not use input_length no longer used within library, retained for API compatibility + * Parameters: + * input - Base64-encoded null-terminated string + * input_length (optional) - Number of bytes to read from input pointer + * Returns: + * Number of bytes of binary data in input + */ +uint16_t decode_base64_length(unsigned char input[]); +uint16_t decode_base64_length(unsigned char input[], uint16_t input_length); + +/* encode_base64: + * Description: + * Converts an array of bytes to a base64 null-terminated string + * Parameters: + * input - Pointer to input data + * input_length - Number of bytes to read from input pointer + * output - Pointer to output string. Null terminator will be added automatically + * Returns: + * Length of encoded string in bytes (not including null terminator) + */ +uint16_t encode_base64(unsigned char input[], uint16_t input_length, unsigned char output[]); + +/* decode_base64: + * Description: + * Converts a base64 null-terminated string to an array of bytes + * Parameters: + * input - Pointer to input string + * input_length (optional) - Number of bytes to read from input pointer + * output - Pointer to output array + * Returns: + * Number of bytes in the decoded binary + */ +uint16_t decode_base64(unsigned char input[], unsigned char output[]); +uint16_t decode_base64(unsigned char input[], uint16_t input_length, unsigned char output[]); + +unsigned char binary_to_base64(unsigned char v) { + // Capital letters - 'A' is ascii 65 and base64 0 + if (v < 26) return v + 'A'; + + // Lowercase letters - 'a' is ascii 97 and base64 26 + if (v < 52) return v + 71; + + // Digits - '0' is ascii 48 and base64 52 + if (v < 62) return v - 4; + + // '+' is ascii 43 and base64 62 + if (v == 62) return '+'; + + // '/' is ascii 47 and base64 63 + if (v == 63) return '/'; + + return 64; +} + +unsigned char base64_to_binary(unsigned char c) { + // Capital letters - 'A' is ascii 65 and base64 0 + if ('A' <= c && c <= 'Z') return c - 'A'; + + // Lowercase letters - 'a' is ascii 97 and base64 26 + if ('a' <= c && c <= 'z') return c - 71; + + // Digits - '0' is ascii 48 and base64 52 + if ('0' <= c && c <= '9') return c + 4; + + // '+' is ascii 43 and base64 62 + if (c == '+') return 62; + + // '/' is ascii 47 and base64 63 + if (c == '/') return 63; + + return 255; +} + +uint16_t encode_base64_length(uint16_t input_length) { + return (input_length + 2)/3*4; +} + +uint16_t decode_base64_length(unsigned char input[]) { + return decode_base64_length(input, -1); +} + +uint16_t decode_base64_length(unsigned char input[], uint16_t input_length) { + unsigned char *start = input; + + while (base64_to_binary(input[0]) < 64 && (unsigned char)(input - start) < input_length) { + ++input; + } + + input_length = input - start; + return input_length/4*3 + (input_length % 4 ? input_length % 4 - 1 : 0); +} + +uint16_t encode_base64(unsigned char input[], uint16_t input_length, unsigned char output[]) { + uint16_t full_sets = input_length/3; + + // While there are still full sets of 24 bits... + for (uint16_t i = 0; i < full_sets; ++i) { + output[0] = binary_to_base64( input[0] >> 2); + output[1] = binary_to_base64((input[0] & 0x03) << 4 | input[1] >> 4); + output[2] = binary_to_base64((input[1] & 0x0F) << 2 | input[2] >> 6); + output[3] = binary_to_base64( input[2] & 0x3F); + + input += 3; + output += 4; + } + + switch (input_length % 3) { + case 0: + output[0] = '\0'; + break; + case 1: + output[0] = binary_to_base64( input[0] >> 2); + output[1] = binary_to_base64((input[0] & 0x03) << 4); + output[2] = '='; + output[3] = '='; + output[4] = '\0'; + break; + case 2: + output[0] = binary_to_base64( input[0] >> 2); + output[1] = binary_to_base64((input[0] & 0x03) << 4 | input[1] >> 4); + output[2] = binary_to_base64((input[1] & 0x0F) << 2); + output[3] = '='; + output[4] = '\0'; + break; + } + + return encode_base64_length(input_length); +} + +uint16_t decode_base64(unsigned char input[], unsigned char output[]) { + return decode_base64(input, -1, output); +} + +uint16_t decode_base64(unsigned char input[], uint16_t input_length, unsigned char output[]) { + uint16_t output_length = decode_base64_length(input, input_length); + + // While there are still full sets of 24 bits... + for (uint16_t i = 2; i < output_length; i += 3) { + output[0] = base64_to_binary(input[0]) << 2 | base64_to_binary(input[1]) >> 4; + output[1] = base64_to_binary(input[1]) << 4 | base64_to_binary(input[2]) >> 2; + output[2] = base64_to_binary(input[2]) << 6 | base64_to_binary(input[3]); + + input += 4; + output += 3; + } + + switch (output_length % 3) { + case 1: + output[0] = base64_to_binary(input[0]) << 2 | base64_to_binary(input[1]) >> 4; + break; + case 2: + output[0] = base64_to_binary(input[0]) << 2 | base64_to_binary(input[1]) >> 4; + output[1] = base64_to_binary(input[1]) << 4 | base64_to_binary(input[2]) >> 2; + break; + } + + return output_length; +} + +#endif // BASE64_H_INCLUDED diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 285013d7504e..e62bb04a43a2 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -22,23 +22,30 @@ /** * lcd/e3v2/jyersui/dwin.cpp + * JYERSUI Author: Jacob Myers + * + * JYERSUI Enhanced by LCH-77 + * Version: 1.9 + * Date: Jun 16, 2022 */ #include "../../../inc/MarlinConfigPre.h" #if ENABLED(DWIN_CREALITY_LCD_JYERSUI) +#include "dwin_defines.h" #include "dwin.h" +#include "dwinui.h" #include "../../marlinui.h" #include "../../../MarlinCore.h" - #include "../../../gcode/gcode.h" #include "../../../module/temperature.h" #include "../../../module/planner.h" #include "../../../module/settings.h" #include "../../../libs/buzzer.h" #include "../../../inc/Conditionals_post.h" +#include "../common/encoder.h" //#define DEBUG_OUT 1 #include "../../../core/debug_out.h" @@ -67,6 +74,10 @@ #include "../../../feature/bedlevel/bedlevel.h" #endif +#ifdef BLTOUCH_HS_MODE + #include "../../../feature/bltouch.h" +#endif + #if ENABLED(AUTO_BED_LEVELING_UBL) #include "../../../libs/least_squares_fit.h" #include "../../../libs/vector_3.h" @@ -80,21 +91,40 @@ #include "../../../feature/powerloss.h" #endif -#define MACHINE_SIZE STRINGIFY(X_BED_SIZE) "x" STRINGIFY(Y_BED_SIZE) "x" STRINGIFY(Z_MAX_POS) +#if HAS_ESDIAG + #include "endstop_diag.h" +#endif + +#if HAS_LOCKSCREEN + #include "lockscreen.h" +#endif -#define DWIN_FONT_MENU font8x16 -#define DWIN_FONT_STAT font10x20 -#define DWIN_FONT_HEAD font10x20 +#if ENABLED(CASE_LIGHT_MENU) + #include "../../../feature/caselight.h" +#endif + +#if ENABLED(LED_CONTROL_MENU) + #include "../../../feature/leds/leds.h" +#endif + +#if HAS_PIDPLOT + #include "plot.h" +#endif +#if HAS_GCODE_PREVIEW + #include "gcode_preview.h" +#endif + +#define MACHINE_SIZE STRINGIFY(X_BED_SIZE) "x" STRINGIFY(Y_BED_SIZE) "x" STRINGIFY(Z_MAX_POS) -#define MENU_CHAR_LIMIT 24 -#define STATUS_Y 352 +#define MENU_CHAR_LIMIT 24 +#define STATUS_CHAR_LIMIT 30 -#define MAX_PRINT_SPEED 500 -#define MIN_PRINT_SPEED 10 +#define MAX_PRINT_SPEED 500 +#define MIN_PRINT_SPEED 10 #if HAS_FAN - #define MAX_FAN_SPEED 255 - #define MIN_FAN_SPEED 0 + #define MAX_FAN_SPEED 255 + #define MIN_FAN_SPEED 0 #endif #define MAX_XY_OFFSET 100 @@ -109,16 +139,21 @@ #endif #if HAS_HOTEND - #define MAX_FLOW_RATE 200 - #define MIN_FLOW_RATE 10 + #define MAX_FLOW_RATE 200 + #define MIN_FLOW_RATE 10 - #define MAX_E_TEMP (HEATER_0_MAXTEMP - HOTEND_OVERSHOOT) - #define MIN_E_TEMP 0 + #define MAX_E_TEMP (HEATER_0_MAXTEMP - HOTEND_OVERSHOOT) + #define MIN_E_TEMP 0 #endif #if HAS_HEATED_BED - #define MAX_BED_TEMP BED_MAXTEMP - #define MIN_BED_TEMP 0 + #define MAX_BED_TEMP BED_MAXTEMP + #define MIN_BED_TEMP 0 +#endif + +#if HAS_JUNCTION_DEVIATION + #define MIN_JD_MM 0.01 + #define MAX_JD_MM 0.3 #endif /** @@ -141,19 +176,11 @@ #endif #endif -constexpr uint16_t TROWS = 6, MROWS = TROWS - 1, - TITLE_HEIGHT = 30, - MLINE = 53, - LBLX = 60, - MENU_CHR_W = 8, MENU_CHR_H = 16, STAT_CHR_W = 10; - -#define MBASE(L) (49 + MLINE * (L)) - -constexpr float default_max_feedrate[] = DEFAULT_MAX_FEEDRATE; -constexpr float default_max_acceleration[] = DEFAULT_MAX_ACCELERATION; -constexpr float default_steps[] = DEFAULT_AXIS_STEPS_PER_UNIT; +constexpr float default_max_feedrate[] = DEFAULT_MAX_FEEDRATE; +constexpr float default_max_acceleration[] = DEFAULT_MAX_ACCELERATION; +constexpr float default_steps[] = DEFAULT_AXIS_STEPS_PER_UNIT; #if HAS_CLASSIC_JERK - constexpr float default_max_jerk[] = { DEFAULT_XJERK, DEFAULT_YJERK, DEFAULT_ZJERK, DEFAULT_EJERK }; + constexpr float default_max_jerk[] = { DEFAULT_XJERK, DEFAULT_YJERK, DEFAULT_ZJERK, DEFAULT_EJERK }; #endif enum SelectItem : uint8_t { @@ -169,8 +196,10 @@ enum SelectItem : uint8_t { PRINT_COUNT }; +eeprom_settings_t eeprom_settings = {0}; +temp_val_t temp_val = {0}; uint8_t active_menu = MainMenu, last_menu = MainMenu; -uint8_t selection = 0, last_selection = 0; +uint8_t selection = 0, last_selection = 0, last_pos_selection = 0; uint8_t scrollpos = 0; uint8_t process = Main, last_process = Main; PopupID popup, last_popup; @@ -183,24 +212,22 @@ float valuemax; uint8_t valueunit; uint8_t valuetype; -char cmd[MAX_CMD_SIZE+16], str_1[16], str_2[16], str_3[16]; +char cmd[MAX_CMD_SIZE + 16], str_1[16], str_2[16], str_3[16]; char statusmsg[64]; char filename[LONG_FILENAME_LENGTH]; -bool printing = false; -bool paused = false; -bool sdprint = false; -int16_t pausetemp, pausebed, pausefan; - -bool livemove = false; -bool liveadjust = false; -uint8_t preheatmode = 0; -float zoffsetvalue = 0; -uint8_t gridpoint; -float corner_avg; -float corner_pos; - -bool probe_deployed = false; +#if HAS_HOSTACTION_MENUS + #define KEY_WIDTH 26 + #define KEY_HEIGHT 30 + #define KEY_INSET 5 + #define KEY_PADDING 3 + #define KEY_Y_START DWIN_HEIGHT - (4 * (KEY_HEIGHT) + 2 * (KEY_INSET + 1)) + + bool keyboard_restrict, reset_keyboard, numeric_keyboard = false; + uint8_t maxstringlen; + char *stringpointer = nullptr; + char action1[9], action2[9], action3[9]; +#endif CrealityDWINClass CrealityDWIN; @@ -215,6 +242,7 @@ CrealityDWINClass CrealityDWIN; uint8_t mesh_y = 0; #if ENABLED(AUTO_BED_LEVELING_UBL) + uint8_t tilt_grid = 1; void manual_value_update(bool undefined=false) { @@ -330,13 +358,13 @@ CrealityDWINClass CrealityDWIN; const float v_max = abs(get_max_value()), v_min = abs(get_min_value()), range = _MAX(v_min, v_max); // Clear background from previous selection and select new square - DWIN_Draw_Rectangle(1, Color_Bg_Black, _MAX(0, padding_x - gridline_width), _MAX(0, padding_y_top - gridline_width), padding_x + total_width_px, padding_y_top + total_width_px); + DWIN_Draw_Rectangle(1, Def_Background_Color, _MAX(0, padding_x - gridline_width), _MAX(0, padding_y_top - gridline_width), padding_x + total_width_px, padding_y_top + total_width_px); if (selected >= 0) { const auto selected_y = selected / (GRID_MAX_POINTS_X); const auto selected_x = selected - (GRID_MAX_POINTS_X) * selected_y; const auto start_y_px = padding_y_top + selected_y * cell_height_px; const auto start_x_px = padding_x + selected_x * cell_width_px; - DWIN_Draw_Rectangle(1, Color_White, _MAX(0, start_x_px - gridline_width), _MAX(0, start_y_px - gridline_width), start_x_px + cell_width_px, start_y_px + cell_height_px); + DWIN_Draw_Rectangle(1, Def_Highlight_Color, _MAX(0, start_x_px - gridline_width), _MAX(0, start_y_px - gridline_width), start_x_px + cell_width_px, start_y_px + cell_height_px); } // Draw value square grid @@ -362,7 +390,7 @@ CrealityDWINClass CrealityDWIN; if (viewer_print_value) { int8_t offset_x, offset_y = cell_height_px / 2 - 6; if (isnan(bedlevel.z_values[x][y])) { // undefined - DWIN_Draw_String(false, font6x12, Color_White, Color_Bg_Blue, start_x_px + cell_width_px / 2 - 5, start_y_px + offset_y, F("X")); + DWINUI::Draw_String(font6x12, Def_Text_Color, Color_Bg_Blue, start_x_px + cell_width_px / 2 - 5, start_y_px + offset_y, F("X")); } else { // has value if (GRID_MAX_POINTS_X < 10) @@ -371,8 +399,8 @@ CrealityDWINClass CrealityDWIN; sprintf_P(buf, PSTR("%02i"), (uint16_t)(abs(bedlevel.z_values[x][y] - (int16_t)bedlevel.z_values[x][y]) * 100)); offset_x = cell_width_px / 2 - 3 * (strlen(buf)) - 2; if (!(GRID_MAX_POINTS_X < 10)) - DWIN_Draw_String(false, font6x12, Color_White, Color_Bg_Blue, start_x_px - 2 + offset_x, start_y_px + offset_y /*+ square / 2 - 6*/, F(".")); - DWIN_Draw_String(false, font6x12, Color_White, Color_Bg_Blue, start_x_px + 1 + offset_x, start_y_px + offset_y /*+ square / 2 - 6*/, buf); + DWINUI::Draw_String(font6x12, Def_Text_Color, Color_Bg_Blue, start_x_px - 2 + offset_x, start_y_px + offset_y /*+ square / 2 - 6*/, F(".")); + DWINUI::Draw_String(font6x12, Def_Text_Color, Color_Bg_Blue, start_x_px + 1 + offset_x, start_y_px + offset_y /*+ square / 2 - 6*/, buf); } safe_delay(10); LCD_SERIAL.flushTX(); @@ -405,10 +433,12 @@ CrealityDWINClass CrealityDWIN; #endif // HAS_MESH /* General Display Functions */ - -struct CrealityDWINClass::EEPROM_Settings CrealityDWINClass::eeprom_settings{0}; constexpr const char * const CrealityDWINClass::color_names[11]; constexpr const char * const CrealityDWINClass::preheat_modes[3]; +constexpr const char * const CrealityDWINClass::zoffset_modes[3]; +#if ENABLED(PREHEAT_BEFORE_LEVELING) + constexpr const char * const CrealityDWINClass::preheat_levmodes[4]; +#endif // Clear a part of the screen // 4=Entire screen @@ -416,98 +446,119 @@ constexpr const char * const CrealityDWINClass::preheat_modes[3]; // 2=Menu area // 1=Title bar void CrealityDWINClass::Clear_Screen(uint8_t e/*=3*/) { - if (e == 1 || e == 3 || e == 4) DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.menu_top_bg, Color_Bg_Blue, false), 0, 0, DWIN_WIDTH, TITLE_HEIGHT); // Clear Title Bar - if (e == 2 || e == 3) DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, 31, DWIN_WIDTH, STATUS_Y); // Clear Menu Area - if (e == 4) DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, 31, DWIN_WIDTH, DWIN_HEIGHT); // Clear Popup Area + if (e == 1 || e == 3 || e == 4) DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.menu_top_bg, Def_TitleBg_color, false), 0, 0, DWIN_WIDTH, TITLE_HEIGHT); // Clear Title Bar + if (e == 2 || e == 3) DWIN_Draw_Rectangle(1, Def_Background_Color, 0, 31, DWIN_WIDTH, STATUS_Y); // Clear Menu Area + if (e == 4) DWIN_Draw_Rectangle(1, Def_Background_Color, 0, 31, DWIN_WIDTH, DWIN_HEIGHT); // Clear Popup Area } void CrealityDWINClass::Draw_Float(float value, uint8_t row, bool selected/*=false*/, uint8_t minunit/*=10*/) { const uint8_t digits = (uint8_t)floor(log10(abs(value))) + log10(minunit) + (minunit > 1); - const uint16_t bColor = (selected) ? Select_Color : Color_Bg_Black; + const uint16_t bColor = (selected) ? Def_Selected_Color : Def_Background_Color; const uint16_t xpos = 240 - (digits * 8); - DWIN_Draw_Rectangle(1, Color_Bg_Black, 194, MBASE(row), 234 - (digits * 8), MBASE(row) + 16); + DWIN_Draw_Rectangle(1, Def_Background_Color, 194, MBASE(row), 234 - (digits * 8), MBASE(row) + 16); if (isnan(value)) - DWIN_Draw_String(true, DWIN_FONT_MENU, Color_White, bColor, xpos - 8, MBASE(row), F(" NaN")); + DWINUI::Draw_String(Def_Text_Color, bColor, xpos - 8, MBASE(row), F(" NaN")); else { - DWIN_Draw_FloatValue(true, true, 0, DWIN_FONT_MENU, Color_White, bColor, digits - log10(minunit) + 1, log10(minunit), xpos, MBASE(row), (value < 0 ? -value : value)); - DWIN_Draw_String(true, DWIN_FONT_MENU, Color_White, bColor, xpos - 8, MBASE(row), value < 0 ? F("-") : F(" ")); + DWIN_Draw_FloatValue(true, true, 0, DWIN_FONT_MENU, Def_Text_Color, bColor, digits - log10(minunit) + 1, log10(minunit), xpos, MBASE(row), (value < 0 ? -value : value)); + DWINUI::Draw_String(Def_Text_Color, bColor, xpos - 8, MBASE(row), value < 0 ? F("-") : F(" ")); } } void CrealityDWINClass::Draw_Option(uint8_t value, const char * const * options, uint8_t row, bool selected/*=false*/, bool color/*=false*/) { - uint16_t bColor = (selected) ? Select_Color : Color_Bg_Black, - tColor = (color) ? GetColor(value, Color_White, false) : Color_White; + uint16_t bColor = (selected) ? Def_Selected_Color : Def_Background_Color, + tColor = (color) ? GetColor(value, Def_Text_Color, false) : Def_Text_Color; DWIN_Draw_Rectangle(1, bColor, 202, MBASE(row) + 14, 258, MBASE(row) - 2); - DWIN_Draw_String(false, DWIN_FONT_MENU, tColor, bColor, 202, MBASE(row) - 1, options[value]); + DWINUI::Draw_String(tColor, bColor, 202, MBASE(row) - 1, options[value]); } +#if HAS_HOSTACTION_MENUS + + void CrealityDWINClass::Draw_String(char * string, uint8_t row, bool selected/*=false*/, bool below/*=false*/) { + if (!string) string[0] = '\0'; + const uint8_t offset_x = DWIN_WIDTH - strlen(string) * 8 - 20; + const uint8_t offset_y = (below) ? MENU_CHR_H * 3 / 5 : 0; + DWIN_Draw_Rectangle(1, Def_Background_Color, offset_x - 10, MBASE(row) + offset_y - 1, offset_x, MBASE(row) + 16 + offset_y); + DWINUI::Draw_String(Def_Text_Color, (selected) ? Def_Selected_Color : Def_Background_Color, offset_x, MBASE(row) - 1 + offset_y, string); + } + + const uint64_t CrealityDWINClass::Encode_String(const char * string) { + const char table[65] = "-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"; + uint64_t output = 0; + LOOP_L_N(i, strlen(string)) { + uint8_t upper_bound = 63, lower_bound = 0; + uint8_t midpoint; + LOOP_L_N(x, 6) { + midpoint = (uint8_t)(0.5 * (upper_bound + lower_bound)); + if (string[i] == table[midpoint]) break; + if (string[i] > table[midpoint]) + lower_bound = midpoint; + else + upper_bound = midpoint; + } + output += midpoint * pow(64, i); + } + return output; + } + + void CrealityDWINClass::Decode_String(uint64_t num, char * string) { + const char table[65] = "-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"; + LOOP_L_N(i, 30) { + string[i] = table[num % 64]; + num /= 64; + if (num == 0) { + string[i + 1] = '\0'; + break; + } + } + } + +#endif // HAS_HOSTACTION_MENUS + uint16_t CrealityDWINClass::GetColor(uint8_t color, uint16_t original, bool light/*=false*/) { switch (color) { - case Default: - return original; - break; - case White: - return (light) ? Color_Light_White : Color_White; - break; - case Green: - return (light) ? Color_Light_Green : Color_Green; - break; - case Cyan: - return (light) ? Color_Light_Cyan : Color_Cyan; - break; - case Blue: - return (light) ? Color_Light_Blue : Color_Blue; - break; - case Magenta: - return (light) ? Color_Light_Magenta : Color_Magenta; - break; - case Red: - return (light) ? Color_Light_Red : Color_Red; - break; - case Orange: - return (light) ? Color_Light_Orange : Color_Orange; - break; - case Yellow: - return (light) ? Color_Light_Yellow : Color_Yellow; - break; - case Brown: - return (light) ? Color_Light_Brown : Color_Brown; - break; - case Black: - return Color_Black; - break; + case Default: return original; + case White: return (light) ? Color_Light_White : Color_White; + case Green: return (light) ? Color_Light_Green : Color_Green; + case Cyan: return (light) ? Color_Light_Cyan : Color_Cyan; + case Blue: return (light) ? Color_Light_Blue : Color_Blue; + case Magenta: return (light) ? Color_Light_Magenta : Color_Magenta; + case Red: return (light) ? Color_Light_Red : Color_Red; + case Orange: return (light) ? Color_Light_Orange : Color_Orange; + case Yellow: return (light) ? Color_Light_Yellow : Color_Yellow; + case Brown: return (light) ? Color_Light_Brown : Color_Brown; + case Black: return Color_Black; } return Color_White; } void CrealityDWINClass::Draw_Title(const char * ctitle) { - DWIN_Draw_String(false, DWIN_FONT_HEAD, GetColor(eeprom_settings.menu_top_txt, Color_White, false), Color_Bg_Blue, (DWIN_WIDTH - strlen(ctitle) * STAT_CHR_W) / 2, 5, ctitle); + DWINUI::Draw_CenteredString((uint8_t)DWIN_FONT_HEAD, GetColor(eeprom_settings.menu_top_txt, Def_TitleTxt_color, false), 5, ctitle); } void CrealityDWINClass::Draw_Title(FSTR_P const ftitle) { - DWIN_Draw_String(false, DWIN_FONT_HEAD, GetColor(eeprom_settings.menu_top_txt, Color_White, false), Color_Bg_Blue, (DWIN_WIDTH - strlen_P(FTOP(ftitle)) * STAT_CHR_W) / 2, 5, ftitle); + DWINUI::Draw_CenteredString((uint8_t)DWIN_FONT_HEAD, GetColor(eeprom_settings.menu_top_txt, Def_TitleTxt_color, false), 5, ftitle); } void _Decorate_Menu_Item(uint8_t row, uint8_t icon, bool more) { if (icon) DWIN_ICON_Show(ICON, icon, 26, MBASE(row) - 3); //Draw Menu Icon if (more) DWIN_ICON_Show(ICON, ICON_More, 226, MBASE(row) - 3); // Draw More Arrow - DWIN_Draw_Line(CrealityDWIN.GetColor(CrealityDWIN.eeprom_settings.menu_split_line, Line_Color, true), 16, MBASE(row) + 33, 256, MBASE(row) + 33); // Draw Menu Line + DWIN_Draw_HLine(CrealityDWIN.GetColor(eeprom_settings.menu_split_line, Def_SplitLine_Color, true), 16, MBASE(row) + 33, 240); // Draw Menu Line } void CrealityDWINClass::Draw_Menu_Item(uint8_t row, uint8_t icon/*=0*/, const char * label1, const char * label2, bool more/*=false*/, bool centered/*=false*/) { - const uint8_t label_offset_y = (label1 || label2) ? MENU_CHR_H * 3 / 5 : 0, - label1_offset_x = !centered ? LBLX : LBLX * 4/5 + _MAX(LBLX * 1U/5, (DWIN_WIDTH - LBLX - (label1 ? strlen(label1) : 0) * MENU_CHR_W) / 2), - label2_offset_x = !centered ? LBLX : LBLX * 4/5 + _MAX(LBLX * 1U/5, (DWIN_WIDTH - LBLX - (label2 ? strlen(label2) : 0) * MENU_CHR_W) / 2); - if (label1) DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, label1_offset_x, MBASE(row) - 1 - label_offset_y, label1); // Draw Label - if (label2) DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, label2_offset_x, MBASE(row) - 1 + label_offset_y, label2); // Draw Label + const uint8_t label_offset_y = (label1 && label2) ? MENU_CHR_H * 3 / 5 : 0, + label1_offset_x = !centered ? LBLX : LBLX * 4/5 + _MAX(LBLX * 1/5U, (DWIN_WIDTH - LBLX - (label1 ? strlen(label1) : 0) * MENU_CHR_W) / 2), + label2_offset_x = !centered ? LBLX : LBLX * 4/5 + _MAX(LBLX * 1/5U, (DWIN_WIDTH - LBLX - (label2 ? strlen(label2) : 0) * MENU_CHR_W) / 2); + if (label1) DWINUI::Draw_String(label1_offset_x, MBASE(row) - 1 - label_offset_y, label1); // Draw Label + if (label2) DWINUI::Draw_String(label2_offset_x, MBASE(row) - 1 + label_offset_y, label2); // Draw Label _Decorate_Menu_Item(row, icon, more); } void CrealityDWINClass::Draw_Menu_Item(uint8_t row, uint8_t icon/*=0*/, FSTR_P const flabel1, FSTR_P const flabel2, bool more/*=false*/, bool centered/*=false*/) { - const uint8_t label_offset_y = (flabel1 || flabel2) ? MENU_CHR_H * 3 / 5 : 0, - label1_offset_x = !centered ? LBLX : LBLX * 4/5 + _MAX(LBLX * 1U/5, (DWIN_WIDTH - LBLX - (flabel1 ? strlen_P(FTOP(flabel1)) : 0) * MENU_CHR_W) / 2), - label2_offset_x = !centered ? LBLX : LBLX * 4/5 + _MAX(LBLX * 1U/5, (DWIN_WIDTH - LBLX - (flabel2 ? strlen_P(FTOP(flabel2)) : 0) * MENU_CHR_W) / 2); - if (flabel1) DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, label1_offset_x, MBASE(row) - 1 - label_offset_y, flabel1); // Draw Label - if (flabel2) DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, label2_offset_x, MBASE(row) - 1 + label_offset_y, flabel2); // Draw Label + const uint8_t label_offset_y = (flabel1 && flabel2) ? MENU_CHR_H * 3 / 5 : 0, + label1_offset_x = !centered ? LBLX : LBLX * 4/5 + _MAX(LBLX * 1/5U, (DWIN_WIDTH - LBLX - (flabel1 ? strlen_P(FTOP(flabel1)) : 0) * MENU_CHR_W) / 2), + label2_offset_x = !centered ? LBLX : LBLX * 4/5 + _MAX(LBLX * 1/5U, (DWIN_WIDTH - LBLX - (flabel2 ? strlen_P(FTOP(flabel2)) : 0) * MENU_CHR_W) / 2); + if (flabel1) DWINUI::Draw_String(label1_offset_x, MBASE(row) - 1 - label_offset_y, flabel1); // Draw Label + if (flabel2) DWINUI::Draw_String(label2_offset_x, MBASE(row) - 1 + label_offset_y, flabel2); // Draw Label _Decorate_Menu_Item(row, icon, more); } @@ -515,8 +566,8 @@ void CrealityDWINClass::Draw_Checkbox(uint8_t row, bool value) { #if ENABLED(DWIN_CREALITY_LCD_CUSTOM_ICONS) // Draw appropriate checkbox icon DWIN_ICON_Show(ICON, (value ? ICON_Checkbox_T : ICON_Checkbox_F), 226, MBASE(row) - 3); #else // Draw a basic checkbox using rectangles and lines - DWIN_Draw_Rectangle(1, Color_Bg_Black, 226, MBASE(row) - 3, 226 + 20, MBASE(row) - 3 + 20); - DWIN_Draw_Rectangle(0, Color_White, 226, MBASE(row) - 3, 226 + 20, MBASE(row) - 3 + 20); + DWIN_Draw_Rectangle(1, Def_Background_Color, 226, MBASE(row) - 3, 226 + 20, MBASE(row) - 3 + 20); + DWIN_Draw_Rectangle(0, Def_Text_Color, 226, MBASE(row) - 3, 226 + 20, MBASE(row) - 3 + 20); if (value) { DWIN_Draw_Line(Check_Color, 227, MBASE(row) - 3 + 11, 226 + 8, MBASE(row) - 3 + 17); DWIN_Draw_Line(Check_Color, 227 + 8, MBASE(row) - 3 + 17, 226 + 19, MBASE(row) - 3 + 1); @@ -542,7 +593,7 @@ void CrealityDWINClass::Draw_Menu(uint8_t menu, uint8_t select/*=0*/, uint8_t sc Clear_Screen(); Draw_Title(Get_Menu_Title(menu)); LOOP_L_N(i, TROWS) Menu_Item_Handler(menu, i + scrollpos); - DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.cursor_color, Rectangle_Color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); + DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.cursor_color, Def_Cursor_color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); } void CrealityDWINClass::Redraw_Menu(bool lastprocess/*=true*/, bool lastselection/*=false*/, bool lastmenu/*=false*/) { @@ -558,7 +609,8 @@ void CrealityDWINClass::Redraw_Menu(bool lastprocess/*=true*/, bool lastselectio } void CrealityDWINClass::Redraw_Screen() { - Redraw_Menu(false); + if (printingIsActive()) Draw_Print_Screen(); + else Redraw_Menu(false); Draw_Status_Area(true); Update_Status_Bar(true); } @@ -566,53 +618,56 @@ void CrealityDWINClass::Redraw_Screen() { /* Primary Menus and Screen Elements */ void CrealityDWINClass::Main_Menu_Icons() { + if (selection == 0) { - DWIN_ICON_Show(ICON, ICON_Print_1, 17, 130); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Color_White), 17, 130, 126, 229); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 52, 200, F("Print")); - } - else { - DWIN_ICON_Show(ICON, ICON_Print_0, 17, 130); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 52, 200, F("Print")); + DWINUI::DRAW_IconWB(ICON, ICON_Print_1, 17, 110); + DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Def_Highlight_Color), 17, 110, 126, 209); } + else + DWINUI::DRAW_IconWB(ICON, ICON_Print_0, 17, 110); + + DWINUI::Draw_String(52, 180, GET_TEXT_F(MSG_BUTTON_PRINT)); + if (selection == 1) { - DWIN_ICON_Show(ICON, ICON_Prepare_1, 145, 130); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Color_White), 145, 130, 254, 229); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 170, 200, F("Prepare")); - } - else { - DWIN_ICON_Show(ICON, ICON_Prepare_0, 145, 130); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 170, 200, F("Prepare")); + DWINUI::DRAW_IconWB(ICON, ICON_Prepare_1, 145, 110); + DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Def_Highlight_Color), 145, 110, 254, 209); } + else + DWINUI::DRAW_IconWB(ICON, ICON_Prepare_0, 145, 110); + + DWINUI::Draw_String(170, 180, GET_TEXT_F(MSG_PREPARE)); + if (selection == 2) { - DWIN_ICON_Show(ICON, ICON_Control_1, 17, 246); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Color_White), 17, 246, 126, 345); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 43, 317, F("Control")); - } - else { - DWIN_ICON_Show(ICON, ICON_Control_0, 17, 246); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 43, 317, F("Control")); + DWINUI::DRAW_IconWB(ICON, ICON_Control_1, 17, 226); + DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Def_Highlight_Color), 17, 226, 126, 325); } + else + DWINUI::DRAW_IconWB(ICON, ICON_Control_0, 17, 226); + + DWINUI::Draw_String(43, 297, GET_TEXT_F(MSG_CONTROL)); + #if HAS_ABL_OR_UBL + if (selection == 3) { - DWIN_ICON_Show(ICON, ICON_Leveling_1, 145, 246); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Color_White), 145, 246, 254, 345); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 179, 317, F("Level")); - } - else { - DWIN_ICON_Show(ICON, ICON_Leveling_0, 145, 246); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 179, 317, F("Level")); + DWINUI::DRAW_IconWB(ICON, ICON_Leveling_1, 145, 226); + DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Def_Highlight_Color), 145, 226, 254, 325); } + else + DWINUI::DRAW_IconWB(ICON, ICON_Leveling_0, 145, 226); + + DWINUI::Draw_String(179, 297, GET_TEXT_F(MSG_BUTTON_LEVEL)); + #else + if (selection == 3) { - DWIN_ICON_Show(ICON, ICON_Info_1, 145, 246); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Color_White), 145, 246, 254, 345); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 181, 317, F("Info")); - } - else { - DWIN_ICON_Show(ICON, ICON_Info_0, 145, 246); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 181, 317, F("Info")); + DWINUI::DRAW_IconWB(ICON, ICON_Info_1, 145, 226); + DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Def_Highlight_Color), 145, 226, 254, 325); } + else + DWINUI::DRAW_IconWB(ICON, ICON_Info_0, 145, 226); + + DWINUI::Draw_String(181, 297, GET_TEXT_F(MSG_BUTTON_INFO)); + #endif } @@ -623,50 +678,48 @@ void CrealityDWINClass::Draw_Main_Menu(uint8_t select/*=0*/) { Clear_Screen(); Draw_Title(Get_Menu_Title(MainMenu)); SERIAL_ECHOPGM("\nDWIN handshake "); - DWIN_ICON_Show(ICON, ICON_LOGO, 71, 72); + DWIN_ICON_Show(ICON, ICON_LOGO, 71, 62); Main_Menu_Icons(); } void CrealityDWINClass::Print_Screen_Icons() { if (selection == 0) { - DWIN_ICON_Show(ICON, ICON_Setup_1, 8, 252); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Color_White), 8, 252, 87, 351); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 30, 322, F("Tune")); - } - else { - DWIN_ICON_Show(ICON, ICON_Setup_0, 8, 252); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 30, 322, F("Tune")); + DWINUI::DRAW_IconWB(ICON, ICON_Setup_1, 8, 252); + DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Def_Highlight_Color), 8, 252, 87, 351); } + else + DWINUI::DRAW_IconWB(ICON, ICON_Setup_0, 8, 252); + + DWINUI::Draw_String(30, 322, GET_TEXT_F(MSG_TUNE)); + if (selection == 2) { - DWIN_ICON_Show(ICON, ICON_Stop_1, 184, 252); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Color_White), 184, 252, 263, 351); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 205, 322, F("Stop")); + DWINUI::DRAW_IconWB(ICON, ICON_Stop_1, 184, 252); + DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Def_Highlight_Color), 184, 252, 263, 351); } - else { - DWIN_ICON_Show(ICON, ICON_Stop_0, 184, 252); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 205, 322, F("Stop")); - } - if (paused) { + else + DWINUI::DRAW_IconWB(ICON, ICON_Stop_0, 184, 252); + + DWINUI::Draw_String(205, 322, GET_TEXT_F(MSG_BUTTON_STOP)); + + if (temp_val.paused) { if (selection == 1) { - DWIN_ICON_Show(ICON, ICON_Continue_1, 96, 252); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Color_White), 96, 252, 175, 351); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 114, 322, F("Print")); - } - else { - DWIN_ICON_Show(ICON, ICON_Continue_0, 96, 252); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 114, 322, F("Print")); + DWINUI::DRAW_IconWB(ICON, ICON_Continue_1, 96, 252); + DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Def_Highlight_Color), 96, 252, 175, 351); } + else + DWINUI::DRAW_IconWB(ICON, ICON_Continue_0, 96, 252); + + DWINUI::Draw_String(114, 322, GET_TEXT_F(MSG_BUTTON_RESUME)); } else { if (selection == 1) { - DWIN_ICON_Show(ICON, ICON_Pause_1, 96, 252); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Color_White), 96, 252, 175, 351); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 114, 322, F("Pause")); - } - else { - DWIN_ICON_Show(ICON, ICON_Pause_0, 96, 252); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 114, 322, F("Pause")); + DWINUI::DRAW_IconWB(ICON, ICON_Pause_1, 96, 252); + DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Def_Highlight_Color), 96, 252, 175, 351); } + else + DWINUI::DRAW_IconWB(ICON, ICON_Pause_0, 96, 252); + + DWINUI::Draw_String(114, 322, GET_TEXT_F(MSG_BUTTON_PAUSE)); } } @@ -674,13 +727,13 @@ void CrealityDWINClass::Draw_Print_Screen() { process = Print; selection = 0; Clear_Screen(); - DWIN_Draw_Rectangle(1, Color_Bg_Black, 8, 352, DWIN_WIDTH - 8, 376); - Draw_Title("Printing..."); + DWIN_Draw_Rectangle(1, Def_Background_Color, 8, 352, DWIN_WIDTH - 8, 376); + Draw_Title(GET_TEXT(MSG_PRINTING)); Print_Screen_Icons(); DWIN_ICON_Show(ICON, ICON_PrintTime, 14, 171); DWIN_ICON_Show(ICON, ICON_RemainTime, 147, 169); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, 41, 163, F("Elapsed")); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, 176, 163, F("Remaining")); + DWINUI::Draw_String(Def_PercentTxt_Color, 41, 163, GET_TEXT_F(MSG_INFO_PRINT_TIME)); + DWINUI::Draw_String(Def_PercentTxt_Color, 176, 163, GET_TEXT_F(MSG_REMAINING_TIME)); Update_Status_Bar(true); Draw_Print_ProgressBar(); Draw_Print_ProgressElapsed(); @@ -692,83 +745,91 @@ void CrealityDWINClass::Draw_Print_Filename(const bool reset/*=false*/) { static uint8_t namescrl = 0; if (reset) namescrl = 0; if (process == Print) { - constexpr int8_t maxlen = 30; - char *outstr = filename; - size_t slen = strlen(filename); - int8_t outlen = slen; - if (slen > maxlen) { - char dispname[maxlen + 1]; - int8_t pos = slen - namescrl, len = maxlen; + size_t len = strlen(filename); + int8_t pos = len; + if (pos > STATUS_CHAR_LIMIT) { + pos -= namescrl; + len = _MIN((size_t)pos, (size_t)STATUS_CHAR_LIMIT); + char dispname[len + 1]; if (pos >= 0) { - NOMORE(len, pos); LOOP_L_N(i, len) dispname[i] = filename[i + namescrl]; } else { - const int8_t mp = maxlen + pos; - LOOP_L_N(i, mp) dispname[i] = ' '; - LOOP_S_L_N(i, mp, maxlen) dispname[i] = filename[i - mp]; - if (mp <= 0) namescrl = 0; + LOOP_L_N(i, STATUS_CHAR_LIMIT + pos) dispname[i] = ' '; + LOOP_S_L_N(i, STATUS_CHAR_LIMIT + pos, STATUS_CHAR_LIMIT) dispname[i] = filename[i - (STATUS_CHAR_LIMIT + pos)]; } dispname[len] = '\0'; - outstr = dispname; - outlen = maxlen; + DWIN_Draw_Rectangle(1, Def_Background_Color, 8, 50, DWIN_WIDTH - 8, 80); + const int8_t npos = (DWIN_WIDTH - STATUS_CHAR_LIMIT * MENU_CHR_W) / 2; + DWINUI::Draw_String(npos, 60, dispname); + if (-pos >= STATUS_CHAR_LIMIT) namescrl = 0; namescrl++; } - DWIN_Draw_Rectangle(1, Color_Bg_Black, 8, 50, DWIN_WIDTH - 8, 80); - const int8_t npos = (DWIN_WIDTH - outlen * MENU_CHR_W) / 2; - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, npos, 60, outstr); + else { + DWIN_Draw_Rectangle(1, Def_Background_Color, 8, 50, DWIN_WIDTH - 8, 80); + const int8_t npos = (DWIN_WIDTH - strlen(filename) * MENU_CHR_W) / 2; + DWINUI::Draw_String(npos, 60, filename); + } } } void CrealityDWINClass::Draw_Print_ProgressBar() { - uint8_t printpercent = sdprint ? card.percentDone() : (ui._get_progress() / 100); - DWIN_ICON_Show(ICON, ICON_Bar, 15, 93); - DWIN_Draw_Rectangle(1, BarFill_Color, 16 + printpercent * 240 / 100, 93, 256, 113); - DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_percent, Percent_Color), Color_Bg_Black, 3, 109, 133, printpercent); - DWIN_Draw_String(false, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_percent, Percent_Color), Color_Bg_Black, 133, 133, F("%")); + uint8_t printpercent = temp_val.sdprint ? card.percentDone() : (ui._get_progress() / 100); + DWINUI::DRAW_IconWB(ICON, ICON_Bar, 15, 93); + DWIN_Draw_Rectangle(1, Def_Barfill_Color, 16 + printpercent * 240 / 100, 93, 256, 113); + DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_percent, Def_PercentTxt_Color), Def_Background_Color, 3, 109, 133, printpercent); + DWINUI::Draw_String(GetColor(eeprom_settings.progress_percent, Def_PercentTxt_Color), Def_Background_Color, 134, 133, F("%")); } #if ENABLED(USE_M73_REMAINING_TIME) void CrealityDWINClass::Draw_Print_ProgressRemain() { uint16_t remainingtime = ui.get_remaining_time(); - DWIN_Draw_IntValue(true, true, 1, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 2, 176, 187, remainingtime / 3600); - DWIN_Draw_IntValue(true, true, 1, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 2, 200, 187, (remainingtime % 3600) / 60); + DWIN_Draw_IntValue(true, true, 1, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Def_PercentTxt_Color), Def_Background_Color, 2, 176, 187, remainingtime / 3600); + DWIN_Draw_IntValue(true, true, 1, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Def_PercentTxt_Color), Def_Background_Color, 2, 201, 187, (remainingtime % 3600) / 60); if (eeprom_settings.time_format_textual) { - DWIN_Draw_String(false, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 192, 187, F("h")); - DWIN_Draw_String(false, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 216, 187, F("m")); + DWINUI::Draw_String(GetColor(eeprom_settings.progress_time, Def_PercentTxt_Color), Def_Background_Color, 193, 187, F("h")); + DWINUI::Draw_String(GetColor(eeprom_settings.progress_time, Def_PercentTxt_Color), Def_Background_Color, 217, 187, F("m")); } else - DWIN_Draw_String(false, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 192, 187, F(":")); + DWINUI::Draw_String(GetColor(eeprom_settings.progress_time, Def_PercentTxt_Color), Def_Background_Color, 193, 187, F(":")); } #endif void CrealityDWINClass::Draw_Print_ProgressElapsed() { duration_t elapsed = print_job_timer.duration(); - DWIN_Draw_IntValue(true, true, 1, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 2, 42, 187, elapsed.value / 3600); - DWIN_Draw_IntValue(true, true, 1, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 2, 66, 187, (elapsed.value % 3600) / 60); + DWIN_Draw_IntValue(true, true, 1, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Def_PercentTxt_Color), Def_Background_Color, 2, 42, 187, elapsed.value / 3600); + DWIN_Draw_IntValue(true, true, 1, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Def_PercentTxt_Color), Def_Background_Color, 2, 67, 187, (elapsed.value % 3600) / 60); if (eeprom_settings.time_format_textual) { - DWIN_Draw_String(false, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 58, 187, F("h")); - DWIN_Draw_String(false, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 82, 187, F("m")); + DWINUI::Draw_String(GetColor(eeprom_settings.progress_time, Def_PercentTxt_Color), Def_Background_Color, 59, 187, F("h")); + DWINUI::Draw_String(GetColor(eeprom_settings.progress_time, Def_PercentTxt_Color), Def_Background_Color, 83, 187, F("m")); } else - DWIN_Draw_String(false, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 58, 187, F(":")); + DWINUI::Draw_String(GetColor(eeprom_settings.progress_time, Def_PercentTxt_Color), Def_Background_Color, 59, 187, F(":")); } -void CrealityDWINClass::Draw_Print_confirm() { - Draw_Print_Screen(); +void CrealityDWINClass::Draw_PrintDone_confirm() { process = Confirm; popup = Complete; - DWIN_Draw_Rectangle(1, Color_Bg_Black, 8, 252, 263, 351); - DWIN_ICON_Show(ICON, ICON_Confirm_E, 87, 283); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Color_White), 86, 282, 187, 321); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Color_White), 85, 281, 188, 322); + if (TERN0(HAS_GCODE_PREVIEW, Preview_Valid())) { + Clear_Screen(); + Draw_Title(GET_TEXT(MSG_PRINT_DONE)); + DWIN_ICON_Show(0, 0, 1, 21, 100, 0x00); + DWINUI::Draw_Button(BTN_Continue, 87, 300); + } + else { + Draw_Print_Screen(); + DWIN_Draw_Rectangle(1, Def_Background_Color, 8, 252, 263, 351); + DWINUI::Draw_Button(BTN_Continue, 87, 283); + DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Def_Highlight_Color), 86, 282, 187, 321); + DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Def_Highlight_Color), 85, 281, 188, 322); + } } void CrealityDWINClass::Draw_SD_Item(uint8_t item, uint8_t row) { if (item == 0) - Draw_Menu_Item(0, ICON_Back, card.flag.workDirIsRoot ? F("Back") : F("..")); + Draw_Menu_Item(0, ICON_Back, card.flag.workDirIsRoot ? GET_TEXT_F(MSG_BACK) : F("..")); else { card.getfilename_sorted(SD_ORDER(item - 1, card.get_num_Files())); char * const filename = card.longest_filename(); @@ -777,11 +838,10 @@ void CrealityDWINClass::Draw_SD_Item(uint8_t item, uint8_t row) { if (!card.flag.filenameIsDir) while (pos && filename[pos] != '.') pos--; len = pos; - if (len > max) len = max; + NOMORE(len, max); char name[len + 1]; - LOOP_L_N(i, len) name[i] = filename[i]; - if (pos > max) - LOOP_S_L_N(i, len - 3, len) name[i] = '.'; + memcpy(name, filename, len); + if (pos > max) LOOP_S_L_N(i, len - 3, len) name[i] = '.'; name[len] = '\0'; Draw_Menu_Item(row, card.flag.filenameIsDir ? ICON_More : ICON_File, name); } @@ -798,16 +858,16 @@ void CrealityDWINClass::Draw_SD_List(bool removed/*=false*/) { Draw_SD_Item(i, i); } else { - Draw_Menu_Item(0, ICON_Back, F("Back")); - DWIN_Draw_Rectangle(1, Color_Bg_Red, 10, MBASE(3) - 10, DWIN_WIDTH - 10, MBASE(4)); - DWIN_Draw_String(false, font16x32, Color_Yellow, Color_Bg_Red, ((DWIN_WIDTH) - 8 * 16) / 2, MBASE(3), F("No Media")); + Draw_Menu_Item(0, ICON_Back, GET_TEXT_F(MSG_BACK)); + DWIN_Draw_Rectangle(1, Def_AlertBg_Color, 10, MBASE(3) - 10, DWIN_WIDTH - 10, MBASE(4)); + DWINUI::Draw_String(font16x32, Def_AlertTxt_Color, Def_AlertBg_Color, ((DWIN_WIDTH) - 8 * 16) / 2, MBASE(3), GET_TEXT_F(MSG_NO_MEDIA)); } - DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.cursor_color, Rectangle_Color), 0, MBASE(0) - 18, 14, MBASE(0) + 33); + DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.cursor_color, Def_Cursor_color), 0, MBASE(0) - 18, 14, MBASE(0) + 33); } void CrealityDWINClass::Draw_Status_Area(bool icons/*=false*/) { - if (icons) DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, STATUS_Y, DWIN_WIDTH, DWIN_HEIGHT - 1); + if (icons) DWIN_Draw_Rectangle(1, Def_Background_Color, 0, STATUS_Y, DWIN_WIDTH, DWIN_HEIGHT - 1); #if HAS_HOTEND static float hotend = -1; @@ -816,26 +876,26 @@ void CrealityDWINClass::Draw_Status_Area(bool icons/*=false*/) { hotend = -1; hotendtarget = -1; DWIN_ICON_Show(ICON, ICON_HotendTemp, 10, 383); - DWIN_Draw_String(false, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 384, F("/")); + DWINUI::Draw_String(DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), Def_Background_Color, 25 + 3 * STAT_CHR_W + 5, 384, F("/")); } if (thermalManager.temp_hotend[0].celsius != hotend) { hotend = thermalManager.temp_hotend[0].celsius; - DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 28, 384, thermalManager.temp_hotend[0].celsius); - DWIN_Draw_DegreeSymbol(GetColor(eeprom_settings.status_area_text, Color_White), 25 + 3 * STAT_CHR_W + 5, 386); + DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), Def_Background_Color, 3, 28, 384, thermalManager.temp_hotend[0].celsius); + DWIN_Draw_DegreeSymbol(GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), 25 + 3 * STAT_CHR_W + 5, 386); } if (thermalManager.temp_hotend[0].target != hotendtarget) { hotendtarget = thermalManager.temp_hotend[0].target; - DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 25 + 4 * STAT_CHR_W + 6, 384, thermalManager.temp_hotend[0].target); - DWIN_Draw_DegreeSymbol(GetColor(eeprom_settings.status_area_text, Color_White), 25 + 4 * STAT_CHR_W + 39, 386); + DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), Def_Background_Color, 3, 25 + 4 * STAT_CHR_W + 6, 384, thermalManager.temp_hotend[0].target); + DWIN_Draw_DegreeSymbol(GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), 25 + 4 * STAT_CHR_W + 39, 386); } if (icons) { flow = -1; DWIN_ICON_Show(ICON, ICON_StepE, 112, 417); - DWIN_Draw_String(false, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 116 + 5 * STAT_CHR_W + 2, 417, F("%")); + DWINUI::Draw_String(DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), Def_Background_Color, 116 + 5 * STAT_CHR_W + 2, 417, F("%")); } if (planner.flow_percentage[0] != flow) { flow = planner.flow_percentage[0]; - DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 116 + 2 * STAT_CHR_W, 417, planner.flow_percentage[0]); + DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), Def_Background_Color, 3, 116 + 2 * STAT_CHR_W, 417, planner.flow_percentage[0]); } #endif @@ -846,17 +906,17 @@ void CrealityDWINClass::Draw_Status_Area(bool icons/*=false*/) { bed = -1; bedtarget = -1; DWIN_ICON_Show(ICON, ICON_BedTemp, 10, 416); - DWIN_Draw_String(false, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 417, F("/")); + DWINUI::Draw_String(DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), Def_Background_Color, 25 + 3 * STAT_CHR_W + 5, 417, F("/")); } if (thermalManager.temp_bed.celsius != bed) { bed = thermalManager.temp_bed.celsius; - DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 28, 417, thermalManager.temp_bed.celsius); - DWIN_Draw_DegreeSymbol(GetColor(eeprom_settings.status_area_text, Color_White), 25 + 3 * STAT_CHR_W + 5, 419); + DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), Def_Background_Color, 3, 28, 417, thermalManager.temp_bed.celsius); + DWIN_Draw_DegreeSymbol(GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), 25 + 3 * STAT_CHR_W + 5, 419); } if (thermalManager.temp_bed.target != bedtarget) { bedtarget = thermalManager.temp_bed.target; - DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 25 + 4 * STAT_CHR_W + 6, 417, thermalManager.temp_bed.target); - DWIN_Draw_DegreeSymbol(GetColor(eeprom_settings.status_area_text, Color_White), 25 + 4 * STAT_CHR_W + 39, 419); + DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), Def_Background_Color, 3, 25 + 4 * STAT_CHR_W + 6, 417, thermalManager.temp_bed.target); + DWIN_Draw_DegreeSymbol(GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), 25 + 4 * STAT_CHR_W + 39, 419); } #endif @@ -868,21 +928,37 @@ void CrealityDWINClass::Draw_Status_Area(bool icons/*=false*/) { } if (thermalManager.fan_speed[0] != fan) { fan = thermalManager.fan_speed[0]; - DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 195 + 2 * STAT_CHR_W, 384, thermalManager.fan_speed[0]); + DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), Def_Background_Color, 3, 195 + 2 * STAT_CHR_W, 384, thermalManager.fan_speed[0]); } #endif #if HAS_ZOFFSET_ITEM static float offset = -1; - if (icons) { - offset = -1; + #if HAS_MESH + static bool _leveling_active = false, + _printing_leveling_active = false; + if (printingIsActive()) { + _printing_leveling_active = ((planner.leveling_active && planner.leveling_active_at_z(current_position.z)) || _printing_leveling_active ); + if ((_printing_leveling_active = (planner.leveling_active && planner.leveling_active_at_z(current_position.z)) && ui.get_blink())) + DWIN_Draw_Rectangle(1, Def_SplitLine_Color, 186, 415, 205, 436); + else + DWIN_Draw_Rectangle(1, Def_Background_Color, 186, 415, 205, 436); + } + else { + _leveling_active = (planner.leveling_active || _leveling_active); + if ((_leveling_active = planner.leveling_active && ui.get_blink())) + DWIN_Draw_Rectangle(1, Def_SplitLine_Color, 186, 415, 205, 436); + else + DWIN_Draw_Rectangle(1, Def_Background_Color, 186, 415, 205, 436); + } DWIN_ICON_Show(ICON, ICON_Zoffset, 187, 416); - } - if (zoffsetvalue != offset) { - offset = zoffsetvalue; - DWIN_Draw_FloatValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 2, 2, 207, 417, (zoffsetvalue < 0 ? -zoffsetvalue : zoffsetvalue)); - DWIN_Draw_String(true, DWIN_FONT_MENU, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 205, 419, zoffsetvalue < 0 ? F("-") : F(" ")); + #else + if (icons) DWIN_ICON_Show(ICON, ICON_Zoffset, 187, 416); + #endif + if (temp_val.zoffsetvalue != offset || icons) { + offset = temp_val.zoffsetvalue; + DWINUI::Draw_Signed_Float(DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Def_Indicator_Color),Def_Background_Color, 1, 2, 202, 417, temp_val.zoffsetvalue); } #endif @@ -890,11 +966,11 @@ void CrealityDWINClass::Draw_Status_Area(bool icons/*=false*/) { if (icons) { feedrate = -1; DWIN_ICON_Show(ICON, ICON_Speed, 113, 383); - DWIN_Draw_String(false, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 116 + 5 * STAT_CHR_W + 2, 384, F("%")); + DWINUI::Draw_String(DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), Def_Background_Color, 116 + 5 * STAT_CHR_W + 2, 384, F("%")); } if (feedrate_percentage != feedrate) { feedrate = feedrate_percentage; - DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 116 + 2 * STAT_CHR_W, 384, feedrate_percentage); + DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), Def_Background_Color, 3, 116 + 2 * STAT_CHR_W, 384, feedrate_percentage); } static float x = -1, y = -1, z = -1; @@ -904,7 +980,7 @@ void CrealityDWINClass::Draw_Status_Area(bool icons/*=false*/) { update_z = (current_position.z != z || axis_should_home(Z_AXIS) || update_z); if (icons) { x = y = z = -1; - DWIN_Draw_Line(GetColor(eeprom_settings.coordinates_split_line, Line_Color, true), 16, 450, 256, 450); + DWIN_Draw_Line(GetColor(eeprom_settings.coordinates_split_line, Def_SplitLine_Color, true), 16, 450, 256, 450); DWIN_ICON_Show(ICON, ICON_MaxSpeedX, 10, 456); DWIN_ICON_Show(ICON, ICON_MaxSpeedY, 95, 456); DWIN_ICON_Show(ICON, ICON_MaxSpeedZ, 180, 456); @@ -912,60 +988,59 @@ void CrealityDWINClass::Draw_Status_Area(bool icons/*=false*/) { if (update_x) { x = current_position.x; if ((update_x = axis_should_home(X_AXIS) && ui.get_blink())) - DWIN_Draw_String(true, DWIN_FONT_MENU, GetColor(eeprom_settings.coordinates_text, Color_White), Color_Bg_Black, 35, 459, F(" -?- ")); + DWINUI::Draw_String(GetColor(eeprom_settings.coordinates_text, Def_Coordinate_Color), Def_Background_Color, 39, 459, F(" -?- ")); else - DWIN_Draw_FloatValue(true, true, 0, DWIN_FONT_MENU, GetColor(eeprom_settings.coordinates_text, Color_White), Color_Bg_Black, 3, 1, 35, 459, current_position.x); + DWINUI::Draw_Signed_Float(DWIN_FONT_MENU, GetColor(eeprom_settings.coordinates_text, Def_Coordinate_Color), Def_Background_Color, 3, 1, 31, 459, current_position.x); } if (update_y) { y = current_position.y; if ((update_y = axis_should_home(Y_AXIS) && ui.get_blink())) - DWIN_Draw_String(true, DWIN_FONT_MENU, GetColor(eeprom_settings.coordinates_text, Color_White), Color_Bg_Black, 120, 459, F(" -?- ")); + DWINUI::Draw_String(GetColor(eeprom_settings.coordinates_text, Def_Coordinate_Color), Def_Background_Color, 124, 459, F(" -?- ")); else - DWIN_Draw_FloatValue(true, true, 0, DWIN_FONT_MENU, GetColor(eeprom_settings.coordinates_text, Color_White), Color_Bg_Black, 3, 1, 120, 459, current_position.y); + DWINUI::Draw_Signed_Float(DWIN_FONT_MENU, GetColor(eeprom_settings.coordinates_text, Def_Coordinate_Color), Def_Background_Color, 3, 1, 116, 459, current_position.y); } if (update_z) { z = current_position.z; if ((update_z = axis_should_home(Z_AXIS) && ui.get_blink())) - DWIN_Draw_String(true, DWIN_FONT_MENU, GetColor(eeprom_settings.coordinates_text, Color_White), Color_Bg_Black, 205, 459, F(" -?- ")); + DWINUI::Draw_String(GetColor(eeprom_settings.coordinates_text, Def_Coordinate_Color), Def_Background_Color, 205, 459, F(" -?- ")); else - DWIN_Draw_FloatValue(true, true, 0, DWIN_FONT_MENU, GetColor(eeprom_settings.coordinates_text, Color_White), Color_Bg_Black, 3, 2, 205, 459, (current_position.z>=0) ? current_position.z : 0); + DWINUI::Draw_Signed_Float(DWIN_FONT_MENU, GetColor(eeprom_settings.coordinates_text, Def_Coordinate_Color), Def_Background_Color, 3, 2, 197, 459, current_position.z); } DWIN_UpdateLCD(); } void CrealityDWINClass::Draw_Popup(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, uint8_t mode, uint8_t icon/*=0*/) { - if (process != Confirm && process != Popup && process != Wait) last_process = process; + if (process != Confirm && process != Popup && process != Wait && process != Cancel) last_process = process; if ((process == Menu || process == Wait) && mode == Popup) last_selection = selection; process = mode; - Clear_Screen(); - DWIN_Draw_Rectangle(0, Color_White, 13, 59, 259, 351); - DWIN_Draw_Rectangle(1, Color_Bg_Window, 14, 60, 258, 350); - const uint8_t ypos = (mode == Popup || mode == Confirm) ? 150 : 230; + if (popup != PrintConfirm) { + Clear_Screen(); + DWIN_Draw_Rectangle(0, Def_Highlight_Color, 13, 59, 259, 346); + DWIN_Draw_Rectangle(1, Def_PopupBg_color, 14, 60, 258, 345); + } + else DWIN_Draw_Rectangle(1, Def_Background_Color, 0, 0, DWIN_WIDTH, STATUS_Y - 1); + const uint8_t ypos = (mode == Popup || mode == Confirm) ? 150 : (mode == Cancel) ? 200 : 230; if (icon > 0) DWIN_ICON_Show(ICON, icon, 101, 105); - DWIN_Draw_String(true, DWIN_FONT_MENU, Popup_Text_Color, Color_Bg_Window, (272 - 8 * strlen_P(FTOP(line1))) / 2, ypos, line1); - DWIN_Draw_String(true, DWIN_FONT_MENU, Popup_Text_Color, Color_Bg_Window, (272 - 8 * strlen_P(FTOP(line2))) / 2, ypos + 30, line2); - DWIN_Draw_String(true, DWIN_FONT_MENU, Popup_Text_Color, Color_Bg_Window, (272 - 8 * strlen_P(FTOP(line3))) / 2, ypos + 60, line3); + if (line1) DWINUI::Draw_String(Def_PopupTxt_Color, (272 - 8 * strlen_P(FTOP(line1))) / 2, ypos, line1); + if (line2) DWINUI::Draw_String(Def_PopupTxt_Color, (272 - 8 * strlen_P(FTOP(line2))) / 2, ypos + 30, line2); + if (line3) DWINUI::Draw_String(Def_PopupTxt_Color, (272 - 8 * strlen_P(FTOP(line3))) / 2, ypos + 60, line3); if (mode == Popup) { selection = 0; - DWIN_Draw_Rectangle(1, Confirm_Color, 26, 280, 125, 317); - DWIN_Draw_Rectangle(1, Cancel_Color, 146, 280, 245, 317); - DWIN_Draw_String(false, DWIN_FONT_STAT, Color_White, Color_Bg_Window, 39, 290, F("Confirm")); - DWIN_Draw_String(false, DWIN_FONT_STAT, Color_White, Color_Bg_Window, 165, 290, F("Cancel")); + DWINUI::Draw_Button(BTN_Confirm, 26, 280); + DWINUI::Draw_Button(BTN_Cancel, 146, 280); Popup_Select(); } - else if (mode == Confirm) { - DWIN_Draw_Rectangle(1, Confirm_Color, 87, 280, 186, 317); - DWIN_Draw_String(false, DWIN_FONT_STAT, Color_White, Color_Bg_Window, 96, 290, F("Continue")); - } + else if (mode == Confirm) DWINUI::Draw_Button(BTN_Continue, 87, 280); + else if (mode == Cancel) DWINUI::Draw_Button(BTN_Cancel, 87, 280); } void MarlinUI::kill_screen(FSTR_P const error, FSTR_P const) { - CrealityDWIN.Draw_Popup(F("Printer Kill Reason:"), error, F("Restart Required"), Wait, ICON_BLTouch); + CrealityDWIN.Draw_Popup(GET_TEXT_F(MSG_KILLED), error, GET_TEXT_F(MSG_SWITCH_PS_OFF), Wait, ICON_BLTouch); } void CrealityDWINClass::Popup_Select() { - const uint16_t c1 = (selection == 0) ? GetColor(eeprom_settings.highlight_box, Color_White) : Color_Bg_Window, - c2 = (selection == 0) ? Color_Bg_Window : GetColor(eeprom_settings.highlight_box, Color_White); + const uint16_t c1 = (selection == 0) ? GetColor(eeprom_settings.highlight_box, Def_Highlight_Color) : Def_Background_Color, + c2 = (selection == 0) ? Def_Background_Color : GetColor(eeprom_settings.highlight_box, Def_Highlight_Color); DWIN_Draw_Rectangle(0, c1, 25, 279, 126, 318); DWIN_Draw_Rectangle(0, c1, 24, 278, 127, 319); DWIN_Draw_Rectangle(0, c2, 145, 279, 246, 318); @@ -975,7 +1050,7 @@ void CrealityDWINClass::Popup_Select() { void CrealityDWINClass::Update_Status_Bar(bool refresh/*=false*/) { static bool new_msg; static uint8_t msgscrl = 0; - static char lastmsg[64]; + static char lastmsg[128]; if (strcmp(lastmsg, statusmsg) != 0 || refresh) { strcpy(lastmsg, statusmsg); msgscrl = 0; @@ -983,50 +1058,162 @@ void CrealityDWINClass::Update_Status_Bar(bool refresh/*=false*/) { } size_t len = strlen(statusmsg); int8_t pos = len; - if (pos > 30) { + if (pos > STATUS_CHAR_LIMIT) { pos -= msgscrl; - len = pos; - if (len > 30) - len = 30; + len = _MIN((size_t)pos, (size_t)STATUS_CHAR_LIMIT); char dispmsg[len + 1]; if (pos >= 0) { LOOP_L_N(i, len) dispmsg[i] = statusmsg[i + msgscrl]; } else { - LOOP_L_N(i, 30 + pos) dispmsg[i] = ' '; - LOOP_S_L_N(i, 30 + pos, 30) dispmsg[i] = statusmsg[i - (30 + pos)]; + LOOP_L_N(i, STATUS_CHAR_LIMIT + pos) dispmsg[i] = ' '; + LOOP_S_L_N(i, STATUS_CHAR_LIMIT + pos, STATUS_CHAR_LIMIT) dispmsg[i] = statusmsg[i - (STATUS_CHAR_LIMIT + pos)]; } dispmsg[len] = '\0'; if (process == Print) { - DWIN_Draw_Rectangle(1, Color_Grey, 8, 214, DWIN_WIDTH - 8, 238); - const int8_t npos = (DWIN_WIDTH - 30 * MENU_CHR_W) / 2; - DWIN_Draw_String(false, DWIN_FONT_MENU, GetColor(eeprom_settings.status_bar_text, Color_White), Color_Bg_Black, npos, 219, dispmsg); + DWIN_Draw_Rectangle(1, Def_StatusBg_Color, 8, 214, DWIN_WIDTH - 8, 238); + const int8_t npos = (DWIN_WIDTH - STATUS_CHAR_LIMIT * MENU_CHR_W) / 2; + DWINUI::Draw_String(GetColor(eeprom_settings.status_bar_text, Def_StatusTxt_Color), Def_StatusBg_Color, npos, 219, dispmsg); } else { - DWIN_Draw_Rectangle(1, Color_Bg_Black, 8, 352, DWIN_WIDTH - 8, 376); - const int8_t npos = (DWIN_WIDTH - 30 * MENU_CHR_W) / 2; - DWIN_Draw_String(false, DWIN_FONT_MENU, GetColor(eeprom_settings.status_bar_text, Color_White), Color_Bg_Black, npos, 357, dispmsg); + DWIN_Draw_Rectangle(1, Def_StatusBg_Color, 8, 352, DWIN_WIDTH - 8, 376); + const int8_t npos = (DWIN_WIDTH - STATUS_CHAR_LIMIT * MENU_CHR_W) / 2; + DWINUI::Draw_String(GetColor(eeprom_settings.status_bar_text, Def_StatusTxt_Color), Def_StatusBg_Color, npos, 357, dispmsg); } - if (-pos >= 30) msgscrl = 0; + if (-pos >= STATUS_CHAR_LIMIT) msgscrl = 0; msgscrl++; } else { if (new_msg) { new_msg = false; if (process == Print) { - DWIN_Draw_Rectangle(1, Color_Grey, 8, 214, DWIN_WIDTH - 8, 238); + DWIN_Draw_Rectangle(1, Def_StatusBg_Color, 8, 214, DWIN_WIDTH - 8, 238); const int8_t npos = (DWIN_WIDTH - strlen(statusmsg) * MENU_CHR_W) / 2; - DWIN_Draw_String(false, DWIN_FONT_MENU, GetColor(eeprom_settings.status_bar_text, Color_White), Color_Bg_Black, npos, 219, statusmsg); + DWINUI::Draw_String(GetColor(eeprom_settings.status_bar_text, Def_StatusTxt_Color), Def_StatusBg_Color, npos, 219, statusmsg); } else { - DWIN_Draw_Rectangle(1, Color_Bg_Black, 8, 352, DWIN_WIDTH - 8, 376); + DWIN_Draw_Rectangle(1, Def_StatusBg_Color, 8, 352, DWIN_WIDTH - 8, 376); const int8_t npos = (DWIN_WIDTH - strlen(statusmsg) * MENU_CHR_W) / 2; - DWIN_Draw_String(false, DWIN_FONT_MENU, GetColor(eeprom_settings.status_bar_text, Color_White), Color_Bg_Black, npos, 357, statusmsg); + DWINUI::Draw_String(GetColor(eeprom_settings.status_bar_text, Def_StatusTxt_Color), Def_StatusBg_Color, npos, 357, statusmsg); } } } } +#if HAS_HOSTACTION_MENUS + + void CrealityDWINClass::Draw_Keyboard(bool restrict, bool numeric, uint8_t selected, bool uppercase/*=false*/, bool lock/*=false*/) { + process = Keyboard; + keyboard_restrict = restrict; + numeric_keyboard = numeric; + DWIN_Draw_Rectangle(0, Def_SplitLine_Color, 0, KEY_Y_START, DWIN_WIDTH-2, DWIN_HEIGHT-2); + DWIN_Draw_Rectangle(1, Def_Background_Color, 1, KEY_Y_START+1, DWIN_WIDTH-3, DWIN_HEIGHT-3); + LOOP_L_N(i, 36) Draw_Keys(i, (i == selected), uppercase, lock); + } + + void CrealityDWINClass::Draw_Keys(uint8_t index, bool selected, bool uppercase/*=false*/, bool lock/*=false*/) { + const char *keys; + if (numeric_keyboard) keys = "1234567890&<>() {}[]*\"\':;!?"; + else keys = (uppercase) ? "QWERTYUIOPASDFGHJKLZXCVBNM" : "qwertyuiopasdfghjklzxcvbnm"; + #define KEY_X1(x) x*KEY_WIDTH+KEY_INSET+KEY_PADDING + #define KEY_X2(x) (x+1) * KEY_WIDTH+KEY_INSET-KEY_PADDING + #define KEY_Y1(y) KEY_Y_START+KEY_INSET+KEY_PADDING+y*KEY_HEIGHT + #define KEY_Y2(y) KEY_Y_START+KEY_INSET-KEY_PADDING+(y+1) * KEY_HEIGHT + + const uint8_t rowCount[3] = { 10, 9, 7 }; + const float xOffset[3] = { 0, 0.5f * KEY_WIDTH, 1.5f * KEY_WIDTH }; + + if (index < 28) { + if (index == 19) { + DWIN_Draw_Rectangle(0, Color_Light_Blue, KEY_X1(0), KEY_Y1(2), KEY_X2(0) + xOffset[1], KEY_Y2(2)); + DWIN_Draw_Rectangle(0, (selected) ? Def_Selected_Color : Def_Background_Color, KEY_X1(0) + 1, KEY_Y1(2) + 1, KEY_X2(0) + xOffset[1] - 1, KEY_Y2(2) - 1); + if (!numeric_keyboard) { + if (lock) { + DWIN_Draw_Line(Def_Selected_Color, KEY_X1(0) + 17, KEY_Y1(2) + 16, KEY_X1(0) + 25, KEY_Y1(2) + 8); + DWIN_Draw_Line(Def_Selected_Color, KEY_X1(0) + 17, KEY_Y1(2) + 16, KEY_X1(0) + 9, KEY_Y1(2) + 8); + } + else { + DWIN_Draw_Line((uppercase) ? Def_Selected_Color : Def_Text_Color, KEY_X1(0) + 17, KEY_Y1(2) + 8, KEY_X1(0) + 25, KEY_Y1(2) + 16); + DWIN_Draw_Line((uppercase) ? Def_Selected_Color : Def_Text_Color, KEY_X1(0) + 17, KEY_Y1(2) + 8, KEY_X1(0) + 9, KEY_Y1(2) + 16); + } + } + } + else if (index == 27) { + DWIN_Draw_Rectangle(0, Color_Light_Blue, KEY_X1(7) + xOffset[2], KEY_Y1(2), KEY_X2(9), KEY_Y2(2)); + DWIN_Draw_Rectangle(0, (selected) ? Def_Selected_Color : Def_Background_Color, KEY_X1(7) + xOffset[2] + 1, KEY_Y1(2) + 1, KEY_X2(9) - 1, KEY_Y2(2) - 1); + DWINUI::Draw_String(Color_Red, KEY_X1(7) + xOffset[2] + 3, KEY_Y1(2) + 5, F("<--")); + } + else { + if (index > 19) index--; + if (index > 27) index--; + uint8_t y, x; + if (index < rowCount[0]) y = 0, x = index; + else if (index < (rowCount[0] + rowCount[1])) y = 1, x = index-rowCount[0]; + else y = 2, x = index-(rowCount[0] + rowCount[1]); + const char keyStr[2] = {keys[(y > 0) * rowCount[0] + (y > 1) * rowCount[1] + x], '\0'}; + DWIN_Draw_Rectangle(0, Color_Light_Blue, KEY_X1(x) + xOffset[y], KEY_Y1(y), KEY_X2(x) + xOffset[y], KEY_Y2(y)); + DWIN_Draw_Rectangle(0, (selected) ? Def_Selected_Color : Def_Background_Color, KEY_X1(x) + xOffset[y] + 1, KEY_Y1(y) + 1, KEY_X2(x) + xOffset[y] - 1, KEY_Y2(y) - 1); + DWINUI::Draw_String(KEY_X1(x) + xOffset[y] + 5, KEY_Y1(y) + 5, keyStr); + if (keyboard_restrict && numeric_keyboard && index > 9) { + DWIN_Draw_Line(Color_Light_Red, KEY_X1(x) + xOffset[y] + 1, KEY_Y1(y) + 1, KEY_X2(x) + xOffset[y] - 1, KEY_Y2(y) - 1); + DWIN_Draw_Line(Color_Light_Red, KEY_X1(x) + xOffset[y] + 1, KEY_Y2(y) - 1, KEY_X2(x) + xOffset[y] - 1, KEY_Y1(y) + 1); + } + } + } + else { + switch (index) { + case 28: + DWIN_Draw_Rectangle(0, Color_Light_Blue, KEY_X1(0), KEY_Y1(3), KEY_X2(0) + xOffset[1], KEY_Y2(3)); + DWIN_Draw_Rectangle(0, (selected) ? Def_Selected_Color : Def_Background_Color, KEY_X1(0) + 1, KEY_Y1(3) + 1, KEY_X2(0) + xOffset[1] - 1, KEY_Y2(3) - 1); + DWINUI::Draw_String(KEY_X1(0) - 1, KEY_Y1(3) + 5, F("?123")); + break; + case 29: + DWIN_Draw_Rectangle(0, Color_Light_Blue, KEY_X1(1) + xOffset[1], KEY_Y1(3), KEY_X2(1) + xOffset[1], KEY_Y2(3)); + DWIN_Draw_Rectangle(0, (selected) ? Def_Selected_Color : Def_Background_Color, KEY_X1(1) + xOffset[1] + 1, KEY_Y1(3) + 1, KEY_X2(1) + xOffset[1] - 1, KEY_Y2(3) - 1); + DWINUI::Draw_String(KEY_X1(1) + xOffset[1] + 5, KEY_Y1(3) + 5, F("-")); + break; + case 30: + DWIN_Draw_Rectangle(0, Color_Light_Blue, KEY_X1(2) + xOffset[1], KEY_Y1(3), KEY_X2(2) + xOffset[1], KEY_Y2(3)); + DWIN_Draw_Rectangle(0, (selected) ? Def_Selected_Color : Def_Background_Color, KEY_X1(2) + xOffset[1] + 1, KEY_Y1(3) + 1, KEY_X2(2) + xOffset[1] - 1, KEY_Y2(3) - 1); + DWINUI::Draw_String(KEY_X1(2) + xOffset[1] + 5, KEY_Y1(3) + 5, F("_")); + break; + case 31: + DWIN_Draw_Rectangle(0, Color_Light_Blue, KEY_X1(3) + xOffset[1], KEY_Y1(3), KEY_X2(5) + xOffset[1], KEY_Y2(3)); + DWIN_Draw_Rectangle(0, (selected) ? Def_Selected_Color : Def_Background_Color, KEY_X1(3) + xOffset[1] + 1, KEY_Y1(3) + 1, KEY_X2(5) + xOffset[1] - 1, KEY_Y2(3) - 1); + DWINUI::Draw_String(KEY_X1(3) + xOffset[1] + 14, KEY_Y1(3) + 5, F("Space")); + if (keyboard_restrict) { + DWIN_Draw_Line(Color_Light_Red, KEY_X1(3) + xOffset[1] + 1, KEY_Y1(3) + 1, KEY_X2(5) + xOffset[1] - 1, KEY_Y2(3) - 1); + DWIN_Draw_Line(Color_Light_Red, KEY_X1(3) + xOffset[1] + 1, KEY_Y2(3) - 1, KEY_X2(5) + xOffset[1] - 1, KEY_Y1(3) + 1); + } + break; + case 32: + DWIN_Draw_Rectangle(0, Color_Light_Blue, KEY_X1(6) + xOffset[1], KEY_Y1(3), KEY_X2(6) + xOffset[1], KEY_Y2(3)); + DWIN_Draw_Rectangle(0, (selected) ? Def_Selected_Color : Def_Background_Color, KEY_X1(6) + xOffset[1] + 1, KEY_Y1(3) + 1, KEY_X2(6) + xOffset[1] - 1, KEY_Y2(3) - 1); + DWINUI::Draw_String(KEY_X1(6) + xOffset[1] + 7, KEY_Y1(3) + 5, F(".")); + if (keyboard_restrict) { + DWIN_Draw_Line(Color_Light_Red, KEY_X1(6) + xOffset[1] + 1, KEY_Y1(3) + 1, KEY_X2(6) + xOffset[1] - 1, KEY_Y2(3) - 1); + DWIN_Draw_Line(Color_Light_Red, KEY_X1(6) + xOffset[1] + 1, KEY_Y2(3) - 1, KEY_X2(6) + xOffset[1] - 1, KEY_Y1(3) + 1); + } + break; + case 33: + DWIN_Draw_Rectangle(0, Color_Light_Blue, KEY_X1(7) + xOffset[1], KEY_Y1(3), KEY_X2(7) + xOffset[1], KEY_Y2(3)); + DWIN_Draw_Rectangle(0, (selected) ? Def_Selected_Color : Def_Background_Color, KEY_X1(7) + xOffset[1] + 1, KEY_Y1(3) + 1, KEY_X2(7) + xOffset[1] - 1, KEY_Y2(3) - 1); + DWINUI::Draw_String(KEY_X1(7) + xOffset[1] + 4, KEY_Y1(3) + 5, F("/")); + if (keyboard_restrict) { + DWIN_Draw_Line(Color_Light_Red, KEY_X1(7) + xOffset[1] + 1, KEY_Y1(3) + 1, KEY_X2(7) + xOffset[1] - 1, KEY_Y2(3) - 1); + DWIN_Draw_Line(Color_Light_Red, KEY_X1(7) + xOffset[1] + 1, KEY_Y2(3) - 1, KEY_X2(7) + xOffset[1] - 1, KEY_Y1(3) + 1); + } + break; + case 34: + DWIN_Draw_Rectangle(0, Color_Light_Blue, KEY_X1(7) + xOffset[2], KEY_Y1(3), KEY_X2(9), KEY_Y2(3)); + DWIN_Draw_Rectangle(0, (selected) ? Def_Selected_Color : Def_Background_Color, KEY_X1(7) + xOffset[2] + 1, KEY_Y1(3) + 1, KEY_X2(9) - 1, KEY_Y2(3) - 1); + DWINUI::Draw_String(Color_Cyan, KEY_X1(7) + xOffset[2] + 3, KEY_Y1(3) + 5, F("-->")); + break; + } + } + } +#endif // HAS_HOSTACTION_MENUS + /* Menu Item Config */ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/*=true*/) { @@ -1047,7 +1234,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case PREHEAT_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); else Draw_Menu(TempMenu, sel); break; @@ -1074,7 +1261,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_FAN case PREHEAT_SUBMENU_FAN: if (draw) { - Draw_Menu_Item(row, ICON_FanSpeed, F("Fan")); + Draw_Menu_Item(row, ICON_FanSpeed, GET_TEXT_F(MSG_FAN_SPEED)); Draw_Float(ui.material_preset[index].fan_speed, row, false, 1); } else @@ -1098,37 +1285,38 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #define PREPARE_PREHEAT (PREPARE_ZOFFSET + ENABLED(HAS_PREHEAT)) #define PREPARE_COOLDOWN (PREPARE_PREHEAT + EITHER(HAS_HOTEND, HAS_HEATED_BED)) #define PREPARE_CHANGEFIL (PREPARE_COOLDOWN + ENABLED(ADVANCED_PAUSE_FEATURE)) - #define PREPARE_CUSTOM_MENU (PREPARE_CHANGEFIL + ENABLED(HAS_CUSTOM_MENU)) - #define PREPARE_TOTAL PREPARE_CUSTOM_MENU + #define PREPARE_ACTIONCOMMANDS (PREPARE_CHANGEFIL + ENABLED(HAS_HOSTACTION_MENUS)) + #define PREPARE_CUSTOM_MENU (PREPARE_ACTIONCOMMANDS + ENABLED(HAS_CUSTOM_MENU)) + #define PREPARE_TOTAL PREPARE_ACTIONCOMMANDS switch (item) { case PREPARE_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); else Draw_Main_Menu(1); break; case PREPARE_MOVE: if (draw) - Draw_Menu_Item(row, ICON_Axis, F("Move"), nullptr, true); + Draw_Menu_Item(row, ICON_Axis, GET_TEXT_F(MSG_MOVE_AXIS), nullptr, true); else Draw_Menu(Move); break; case PREPARE_DISABLE: if (draw) - Draw_Menu_Item(row, ICON_CloseMotor, F("Disable Stepper")); + Draw_Menu_Item(row, ICON_CloseMotor, GET_TEXT_F(MSG_DISABLE_STEPPERS)); else queue.inject(F("M84")); break; case PREPARE_HOME: if (draw) - Draw_Menu_Item(row, ICON_SetHome, F("Homing"), nullptr, true); + Draw_Menu_Item(row, ICON_SetHome, GET_TEXT_F(MSG_HOMING), nullptr, true); else Draw_Menu(HomeMenu); break; case PREPARE_MANUALLEVEL: if (draw) - Draw_Menu_Item(row, ICON_PrintSize, F("Manual Leveling"), nullptr, true); + Draw_Menu_Item(row, ICON_PrintSize, GET_TEXT_F(MSG_BED_TRAMMING_MANUAL), nullptr, true); else { if (axes_should_home()) { Popup_Handler(Home); @@ -1168,12 +1356,23 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_HOTEND || HAS_HEATED_BED case PREPARE_COOLDOWN: if (draw) - Draw_Menu_Item(row, ICON_Cool, F("Cooldown")); - else + Draw_Menu_Item(row, ICON_Cool, GET_TEXT_F(MSG_COOLDOWN)); + else { thermalManager.cooldown(); + Update_Status(GET_TEXT(MSG_COOLDOWN)); + } break; #endif + #if HAS_HOSTACTION_MENUS + case PREPARE_ACTIONCOMMANDS: + if (draw) + Draw_Menu_Item(row, ICON_SetHome, F("Host Actions"), nullptr, true); + else + Draw_Menu(HostActions); + break; + #endif + #if HAS_CUSTOM_MENU case PREPARE_CUSTOM_MENU: #ifndef CUSTOM_MENU_CONFIG_TITLE @@ -1189,7 +1388,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if ENABLED(ADVANCED_PAUSE_FEATURE) case PREPARE_CHANGEFIL: if (draw) { - Draw_Menu_Item(row, ICON_ResumeEEPROM, F("Change Filament") + Draw_Menu_Item(row, ICON_ResumeEEPROM, GET_TEXT_F(MSG_FILAMENTCHANGE) #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) , nullptr, true #endif @@ -1230,13 +1429,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case HOME_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); else Draw_Menu(Prepare, PREPARE_HOME); break; case HOME_ALL: if (draw) - Draw_Menu_Item(row, ICON_Homing, F("Home All")); + Draw_Menu_Item(row, ICON_Homing, GET_TEXT_F(MSG_AUTO_HOME)); else { Popup_Handler(Home); gcode.home_all_axes(true); @@ -1245,7 +1444,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case HOME_X: if (draw) - Draw_Menu_Item(row, ICON_MoveX, F("Home X")); + Draw_Menu_Item(row, ICON_MoveX, GET_TEXT_F(MSG_AUTO_HOME_X)); else { Popup_Handler(Home); gcode.process_subcommands_now(F("G28 X")); @@ -1255,7 +1454,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case HOME_Y: if (draw) - Draw_Menu_Item(row, ICON_MoveY, F("Home Y")); + Draw_Menu_Item(row, ICON_MoveY, GET_TEXT_F(MSG_AUTO_HOME_Y)); else { Popup_Handler(Home); gcode.process_subcommands_now(F("G28 Y")); @@ -1265,7 +1464,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case HOME_Z: if (draw) - Draw_Menu_Item(row, ICON_MoveZ, F("Home Z")); + Draw_Menu_Item(row, ICON_MoveZ, GET_TEXT_F(MSG_AUTO_HOME_Z)); else { Popup_Handler(Home); gcode.process_subcommands_now(F("G28 Z")); @@ -1275,7 +1474,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case HOME_SET: if (draw) - Draw_Menu_Item(row, ICON_SetHome, F("Set Home Position")); + Draw_Menu_Item(row, ICON_SetHome, GET_TEXT_F(MSG_SET_HOME_OFFSETS)); else { gcode.process_subcommands_now(F("G92X0Y0Z0")); AudioFeedback(); @@ -1298,18 +1497,18 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case MOVE_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); else { #if HAS_BED_PROBE - probe_deployed = false; - probe.set_deployed(probe_deployed); + temp_val.probe_deployed = false; + probe.set_deployed(temp_val.probe_deployed); #endif Draw_Menu(Prepare, PREPARE_MOVE); } break; case MOVE_X: if (draw) { - Draw_Menu_Item(row, ICON_MoveX, F("Move X")); + Draw_Menu_Item(row, ICON_MoveX, GET_TEXT_F(MSG_MOVE_X)); Draw_Float(current_position.x, row, false); } else @@ -1317,7 +1516,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case MOVE_Y: if (draw) { - Draw_Menu_Item(row, ICON_MoveY, F("Move Y")); + Draw_Menu_Item(row, ICON_MoveY, GET_TEXT_F(MSG_MOVE_Y)); Draw_Float(current_position.y, row); } else @@ -1325,7 +1524,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case MOVE_Z: if (draw) { - Draw_Menu_Item(row, ICON_MoveZ, F("Move Z")); + Draw_Menu_Item(row, ICON_MoveZ, GET_TEXT_F(MSG_MOVE_Z)); Draw_Float(current_position.z, row); } else @@ -1335,15 +1534,14 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_HOTEND case MOVE_E: if (draw) { - Draw_Menu_Item(row, ICON_Extruder, F("Extruder")); + Draw_Menu_Item(row, ICON_Extruder, GET_TEXT_F(MSG_MOVE_E)); current_position.e = 0; sync_plan_position(); Draw_Float(current_position.e, row); } else { - if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) { + if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) Popup_Handler(ETemp); - } else { if (thermalManager.temp_hotend[0].is_below_target(-2)) { Popup_Handler(Heating); @@ -1361,13 +1559,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_BED_PROBE case MOVE_P: if (draw) { - Draw_Menu_Item(row, ICON_StockConfiguration, F("Probe")); - Draw_Checkbox(row, probe_deployed); + Draw_Menu_Item(row, ICON_ProbeDeploy, GET_TEXT_F(MSG_MANUAL_DEPLOY)); + Draw_Checkbox(row, temp_val.probe_deployed); } else { - probe_deployed = !probe_deployed; - probe.set_deployed(probe_deployed); - Draw_Checkbox(row, probe_deployed); + temp_val.probe_deployed = !temp_val.probe_deployed; + probe.set_deployed(temp_val.probe_deployed); + Draw_Checkbox(row, temp_val.probe_deployed); } break; #endif @@ -1375,11 +1573,11 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ case MOVE_LIVE: if (draw) { Draw_Menu_Item(row, ICON_Axis, F("Live Movement")); - Draw_Checkbox(row, livemove); + Draw_Checkbox(row, temp_val.livemove); } else { - livemove = !livemove; - Draw_Checkbox(row, livemove); + temp_val.livemove = !temp_val.livemove; + Draw_Checkbox(row, temp_val.livemove); } break; } @@ -1388,11 +1586,11 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #define MLEVEL_BACK 0 #define MLEVEL_PROBE (MLEVEL_BACK + ENABLED(HAS_BED_PROBE)) - #define MLEVEL_BL (MLEVEL_PROBE + 1) - #define MLEVEL_TL (MLEVEL_BL + 1) - #define MLEVEL_TR (MLEVEL_TL + 1) - #define MLEVEL_BR (MLEVEL_TR + 1) - #define MLEVEL_C (MLEVEL_BR + 1) + #define MLEVEL_FL (MLEVEL_PROBE + 1) + #define MLEVEL_BL (MLEVEL_FL + 1) + #define MLEVEL_BR (MLEVEL_BL + 1) + #define MLEVEL_FR (MLEVEL_BR + 1) + #define MLEVEL_C (MLEVEL_FR + 1) #define MLEVEL_ZPOS (MLEVEL_C + 1) #define MLEVEL_TOTAL MLEVEL_ZPOS @@ -1402,7 +1600,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case MLEVEL_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); else { TERN_(HAS_LEVELING, set_bed_leveling_enabled(level_state)); Draw_Menu(Prepare, PREPARE_MANUALLEVEL); @@ -1419,24 +1617,46 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ Draw_Checkbox(row, use_probe); if (use_probe) { Popup_Handler(Level); - corner_avg = 0; - #define PROBE_X_MIN _MAX(0 + corner_pos, X_MIN_POS + probe.offset.x, X_MIN_POS + PROBING_MARGIN) - probe.offset.x - #define PROBE_X_MAX _MIN((X_BED_SIZE + X_MIN_POS) - corner_pos, X_MAX_POS + probe.offset.x, X_MAX_POS - PROBING_MARGIN) - probe.offset.x - #define PROBE_Y_MIN _MAX(0 + corner_pos, Y_MIN_POS + probe.offset.y, Y_MIN_POS + PROBING_MARGIN) - probe.offset.y - #define PROBE_Y_MAX _MIN((Y_BED_SIZE + Y_MIN_POS) - corner_pos, Y_MAX_POS + probe.offset.y, Y_MAX_POS - PROBING_MARGIN) - probe.offset.y - corner_avg += probe.probe_at_point(PROBE_X_MIN, PROBE_Y_MIN, PROBE_PT_RAISE, 0, false); - corner_avg += probe.probe_at_point(PROBE_X_MIN, PROBE_Y_MAX, PROBE_PT_RAISE, 0, false); - corner_avg += probe.probe_at_point(PROBE_X_MAX, PROBE_Y_MAX, PROBE_PT_RAISE, 0, false); - corner_avg += probe.probe_at_point(PROBE_X_MAX, PROBE_Y_MIN, PROBE_PT_STOW, 0, false); - corner_avg /= 4; + do_z_clearance(Z_HOMING_HEIGHT); + temp_val.corner_avg = 0; + #define PROBE_X_MIN _MAX(temp_val.corner_pos, PROBING_MARGIN, MESH_MIN_X) - probe.offset.x + #define PROBE_X_MAX _MIN(X_BED_SIZE - temp_val.corner_pos, X_BED_SIZE - PROBING_MARGIN, MESH_MAX_X) - probe.offset.x + #define PROBE_Y_MIN _MAX(temp_val.corner_pos, PROBING_MARGIN, MESH_MIN_Y) - probe.offset.y + #define PROBE_Y_MAX _MIN(Y_BED_SIZE - temp_val.corner_pos, Y_BED_SIZE - PROBING_MARGIN, MESH_MAX_Y) - probe.offset.y + temp_val.zval = probe.probe_at_point(PROBE_X_MIN, PROBE_Y_MIN, PROBE_PT_RAISE, 0, false); + const char * MSG_UNREACHABLE = "Position unreachable. Check Probe Offsets and Bed Screw Inset."; + if (isnan(temp_val.zval)) { + Update_Status(MSG_UNREACHABLE); + Redraw_Menu(); + } + temp_val.corner_avg += temp_val.zval; + temp_val.zval = probe.probe_at_point(PROBE_X_MIN, PROBE_Y_MAX, PROBE_PT_RAISE, 0, false); + if (isnan(temp_val.zval)) { + Update_Status(MSG_UNREACHABLE); + Redraw_Menu(); + } + temp_val.corner_avg += temp_val.zval; + temp_val.zval = probe.probe_at_point(PROBE_X_MAX, PROBE_Y_MAX, PROBE_PT_RAISE, 0, false); + if (isnan(temp_val.zval)) { + Update_Status(MSG_UNREACHABLE); + Redraw_Menu(); + } + temp_val.corner_avg += temp_val.zval; + temp_val.zval = probe.probe_at_point(PROBE_X_MAX, PROBE_Y_MIN, PROBE_PT_STOW, 0, false); + if (isnan(temp_val.zval)) { + Update_Status(MSG_UNREACHABLE); + Redraw_Menu(); + } + temp_val.corner_avg += temp_val.zval; + temp_val.corner_avg /= 4; Redraw_Menu(); } } break; #endif - case MLEVEL_BL: + case MLEVEL_FL: if (draw) - Draw_Menu_Item(row, ICON_AxisBL, F("Bottom Left")); + Draw_Menu_Item(row, ICON_AxisBL, GET_TEXT_F(MSG_LEVBED_FL)); else { Popup_Handler(MoveWait); if (use_probe) { @@ -1448,16 +1668,16 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #endif } else { - sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s\nG0 F300 Z%s"), dtostrf(corner_pos, 1, 3, str_1), dtostrf(corner_pos, 1, 3, str_2), dtostrf(mlev_z_pos, 1, 3, str_3)); + sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s\nG0 F300 Z%s"), dtostrf(temp_val.corner_pos, 1, 3, str_1), dtostrf(temp_val.corner_pos, 1, 3, str_2), dtostrf(mlev_z_pos, 1, 3, str_3)); gcode.process_subcommands_now(cmd); planner.synchronize(); Redraw_Menu(); } } break; - case MLEVEL_TL: + case MLEVEL_BL: if (draw) - Draw_Menu_Item(row, ICON_AxisTL, F("Top Left")); + Draw_Menu_Item(row, ICON_AxisTL, GET_TEXT_F(MSG_LEVBED_BL)); else { Popup_Handler(MoveWait); if (use_probe) { @@ -1469,16 +1689,16 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #endif } else { - sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s\nG0 F300 Z%s"), dtostrf(corner_pos, 1, 3, str_1), dtostrf((Y_BED_SIZE + Y_MIN_POS) - corner_pos, 1, 3, str_2), dtostrf(mlev_z_pos, 1, 3, str_3)); + sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s\nG0 F300 Z%s"), dtostrf(temp_val.corner_pos, 1, 3, str_1), dtostrf(Y_BED_SIZE - temp_val.corner_pos, 1, 3, str_2), dtostrf(mlev_z_pos, 1, 3, str_3)); gcode.process_subcommands_now(cmd); planner.synchronize(); Redraw_Menu(); } } break; - case MLEVEL_TR: + case MLEVEL_BR: if (draw) - Draw_Menu_Item(row, ICON_AxisTR, F("Top Right")); + Draw_Menu_Item(row, ICON_AxisTR, GET_TEXT_F(MSG_LEVBED_BR)); else { Popup_Handler(MoveWait); if (use_probe) { @@ -1490,16 +1710,16 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #endif } else { - sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s\nG0 F300 Z%s"), dtostrf((X_BED_SIZE + X_MIN_POS) - corner_pos, 1, 3, str_1), dtostrf((Y_BED_SIZE + Y_MIN_POS) - corner_pos, 1, 3, str_2), dtostrf(mlev_z_pos, 1, 3, str_3)); + sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s\nG0 F300 Z%s"), dtostrf(X_BED_SIZE - temp_val.corner_pos, 1, 3, str_1), dtostrf(Y_BED_SIZE - temp_val.corner_pos, 1, 3, str_2), dtostrf(mlev_z_pos, 1, 3, str_3)); gcode.process_subcommands_now(cmd); planner.synchronize(); Redraw_Menu(); } } break; - case MLEVEL_BR: + case MLEVEL_FR: if (draw) - Draw_Menu_Item(row, ICON_AxisBR, F("Bottom Right")); + Draw_Menu_Item(row, ICON_AxisBR, GET_TEXT_F(MSG_LEVBED_FR)); else { Popup_Handler(MoveWait); if (use_probe) { @@ -1511,7 +1731,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #endif } else { - sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s\nG0 F300 Z%s"), dtostrf((X_BED_SIZE + X_MIN_POS) - corner_pos, 1, 3, str_1), dtostrf(corner_pos, 1, 3, str_2), dtostrf(mlev_z_pos, 1, 3, str_3)); + sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s\nG0 F300 Z%s"), dtostrf(X_BED_SIZE - temp_val.corner_pos, 1, 3, str_1), dtostrf(temp_val.corner_pos, 1, 3, str_2), dtostrf(mlev_z_pos, 1, 3, str_3)); gcode.process_subcommands_now(cmd); planner.synchronize(); Redraw_Menu(); @@ -1520,19 +1740,19 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case MLEVEL_C: if (draw) - Draw_Menu_Item(row, ICON_AxisC, F("Center")); + Draw_Menu_Item(row, ICON_AxisC, GET_TEXT_F(MSG_LEVBED_C)); else { Popup_Handler(MoveWait); if (use_probe) { #if HAS_BED_PROBE - sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s"), dtostrf(X_MAX_POS / 2.0f - probe.offset.x, 1, 3, str_1), dtostrf(Y_MAX_POS / 2.0f - probe.offset.y, 1, 3, str_2)); + sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s"), dtostrf((PROBE_X_MIN + PROBE_X_MAX) / 2.0f, 1, 3, str_1), dtostrf((PROBE_Y_MIN + PROBE_Y_MAX) / 2.0f, 1, 3, str_2)); gcode.process_subcommands_now(cmd); planner.synchronize(); Popup_Handler(ManualProbing); #endif } else { - sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s\nG0 F300 Z%s"), dtostrf((X_BED_SIZE + X_MIN_POS) / 2.0f, 1, 3, str_1), dtostrf((Y_BED_SIZE + Y_MIN_POS) / 2.0f, 1, 3, str_2), dtostrf(mlev_z_pos, 1, 3, str_3)); + sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s\nG0 F300 Z%s"), dtostrf(X_BED_SIZE / 2.0f, 1, 3, str_1), dtostrf(Y_BED_SIZE / 2.0f, 1, 3, str_2), dtostrf(mlev_z_pos, 1, 3, str_3)); gcode.process_subcommands_now(cmd); planner.synchronize(); Redraw_Menu(); @@ -1541,7 +1761,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case MLEVEL_ZPOS: if (draw) { - Draw_Menu_Item(row, ICON_SetZOffset, F("Z Position")); + Draw_Menu_Item(row, ICON_SetZOffset, GET_TEXT_F(MSG_MOVE_Z)); Draw_Float(mlev_z_pos, row, false, 100); } else @@ -1564,16 +1784,19 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case ZOFFSET_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); else { - liveadjust = false; + temp_val.zoffsetmode = 0; + #if !HAS_BED_PROBE + gcode.process_subcommands_now(F("M211 S1")); // Soft end-stops + #endif TERN_(HAS_LEVELING, set_bed_leveling_enabled(level_state)); Draw_Menu(Prepare, PREPARE_ZOFFSET); } break; case ZOFFSET_HOME: if (draw) - Draw_Menu_Item(row, ICON_Homing, F("Home Z Axis")); + Draw_Menu_Item(row, ICON_Homing, GET_TEXT_F(MSG_AUTO_HOME_Z)); else { Popup_Handler(Home); gcode.process_subcommands_now(F("G28 Z")); @@ -1583,7 +1806,8 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ sprintf_P(cmd, PSTR("G0 F4000 X%s Y%s"), dtostrf(Z_SAFE_HOMING_X_POINT, 1, 3, str_1), dtostrf(Z_SAFE_HOMING_Y_POINT, 1, 3, str_2)); gcode.process_subcommands_now(cmd); #else - gcode.process_subcommands_now(F("G0 F4000 X117.5 Y117.5")); + sprintf_P(cmd, PSTR("G0 F4000 X%s Y%s"), dtostrf((X_BED_SIZE + X_MIN_POS) / 2.0f, 1, 3, str_1), dtostrf((Y_BED_SIZE + Y_MIN_POS) / 2.0f, 1, 3, str_2)); + gcode.process_subcommands_now(cmd); #endif gcode.process_subcommands_now(F("G0 F300 Z0")); planner.synchronize(); @@ -1593,49 +1817,30 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ case ZOFFSET_MODE: if (draw) { Draw_Menu_Item(row, ICON_Zoffset, F("Live Adjustment")); - Draw_Checkbox(row, liveadjust); - } - else { - if (!liveadjust) { - if (axes_should_home()) { - Popup_Handler(Home); - gcode.home_all_axes(true); - } - Popup_Handler(MoveWait); - #if ENABLED(Z_SAFE_HOMING) - planner.synchronize(); - sprintf_P(cmd, PSTR("G0 F4000 X%s Y%s"), dtostrf(Z_SAFE_HOMING_X_POINT, 1, 3, str_1), dtostrf(Z_SAFE_HOMING_Y_POINT, 1, 3, str_2)); - gcode.process_subcommands_now(cmd); - #else - gcode.process_subcommands_now(F("G0 F4000 X117.5 Y117.5")); - #endif - gcode.process_subcommands_now(F("G0 F300 Z0")); - planner.synchronize(); - Redraw_Menu(); - } - liveadjust = !liveadjust; - Draw_Checkbox(row, liveadjust); + Draw_Option(temp_val.zoffsetmode, zoffset_modes, row); } + else + Modify_Option(temp_val.zoffsetmode, zoffset_modes, 2); break; case ZOFFSET_OFFSET: if (draw) { Draw_Menu_Item(row, ICON_SetZOffset, F("Z Offset")); - Draw_Float(zoffsetvalue, row, false, 100); + Draw_Float(temp_val.zoffsetvalue, row, false, 100); } else - Modify_Value(zoffsetvalue, MIN_Z_OFFSET, MAX_Z_OFFSET, 100); + Modify_Value(temp_val.zoffsetvalue, MIN_Z_OFFSET, MAX_Z_OFFSET, 100); break; case ZOFFSET_UP: if (draw) Draw_Menu_Item(row, ICON_Axis, F("Microstep Up")); else { - if (zoffsetvalue < MAX_Z_OFFSET) { - if (liveadjust) { + if (temp_val.zoffsetvalue < MAX_Z_OFFSET) { + if (temp_val.zoffsetmode != 0) { gcode.process_subcommands_now(F("M290 Z0.01")); planner.synchronize(); } - zoffsetvalue += 0.01; - Draw_Float(zoffsetvalue, row - 1, false, 100); + temp_val.zoffsetvalue += 0.01; + Draw_Float(temp_val.zoffsetvalue, row - 1, false, 100); } } break; @@ -1643,20 +1848,20 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ if (draw) Draw_Menu_Item(row, ICON_AxisD, F("Microstep Down")); else { - if (zoffsetvalue > MIN_Z_OFFSET) { - if (liveadjust) { + if (temp_val.zoffsetvalue > MIN_Z_OFFSET) { + if (temp_val.zoffsetmode != 0) { gcode.process_subcommands_now(F("M290 Z-0.01")); planner.synchronize(); } - zoffsetvalue -= 0.01; - Draw_Float(zoffsetvalue, row - 2, false, 100); + temp_val.zoffsetvalue -= 0.01; + Draw_Float(temp_val.zoffsetvalue, row - 2, false, 100); } } break; #if ENABLED(EEPROM_SETTINGS) case ZOFFSET_SAVE: if (draw) - Draw_Menu_Item(row, ICON_WriteEEPROM, F("Save")); + Draw_Menu_Item(row, ICON_WriteEEPROM, GET_TEXT_F(MSG_BUTTON_SAVE)); else AudioFeedback(settings.save()); break; @@ -1677,25 +1882,25 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ auto do_preheat = [](const uint8_t m) { thermalManager.cooldown(); - if (preheatmode == 0 || preheatmode == 1) { ui.preheat_hotend_and_fan(m); } - if (preheatmode == 0 || preheatmode == 2) ui.preheat_bed(m); + if (temp_val.preheatmode == 0 || temp_val.preheatmode == 1) { ui.preheat_hotend_and_fan(m); } + if (temp_val.preheatmode == 0 || temp_val.preheatmode == 2) ui.preheat_bed(m); }; switch (item) { case PREHEAT_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); else Draw_Menu(Prepare, PREPARE_PREHEAT); break; case PREHEAT_MODE: if (draw) { - Draw_Menu_Item(row, ICON_Homing, F("Preheat Mode")); - Draw_Option(preheatmode, preheat_modes, row); + Draw_Menu_Item(row, ICON_Homing, GET_TEXT_F(MSG_CONFIGURATION)); + Draw_Option(temp_val.preheatmode, preheat_modes, row); } else - Modify_Option(preheatmode, preheat_modes, 2); + Modify_Option(temp_val.preheatmode, preheat_modes, 2); break; #define _PREHEAT_CASE(N) \ @@ -1713,7 +1918,8 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ case ChangeFilament: #define CHANGEFIL_BACK 0 - #define CHANGEFIL_LOAD (CHANGEFIL_BACK + 1) + #define CHANGEFIL_PARKHEAD (CHANGEFIL_BACK + 1) + #define CHANGEFIL_LOAD (CHANGEFIL_PARKHEAD + 1) #define CHANGEFIL_UNLOAD (CHANGEFIL_LOAD + 1) #define CHANGEFIL_CHANGE (CHANGEFIL_UNLOAD + 1) #define CHANGEFIL_TOTAL CHANGEFIL_CHANGE @@ -1721,13 +1927,25 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case CHANGEFIL_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); else Draw_Menu(Prepare, PREPARE_CHANGEFIL); break; + case CHANGEFIL_PARKHEAD: + if (draw) + Draw_Menu_Item(row, ICON_Park, GET_TEXT_F(MSG_FILAMENT_PARK_ENABLED)); + else { + #if ENABLED(NOZZLE_PARK_FEATURE) + queue.inject(F("G28O\nG27 P2")); + #else + sprintf_P(cmd, PSTR("G28O\nG0 F4000 X%i Y%i\nG0 F3000 Z%i"), 0 , 0, 20); + queue.inject(cmd); + #endif + } + break; case CHANGEFIL_LOAD: if (draw) - Draw_Menu_Item(row, ICON_WriteEEPROM, F("Load Filament")); + Draw_Menu_Item(row, ICON_WriteEEPROM, GET_TEXT_F(MSG_FILAMENTLOAD)); else { if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) Popup_Handler(ETemp); @@ -1745,7 +1963,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case CHANGEFIL_UNLOAD: if (draw) - Draw_Menu_Item(row, ICON_ReadEEPROM, F("Unload Filament")); + Draw_Menu_Item(row, ICON_ReadEEPROM, GET_TEXT_F(MSG_FILAMENTUNLOAD)); else { if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) { Popup_Handler(ETemp); @@ -1764,7 +1982,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case CHANGEFIL_CHANGE: if (draw) - Draw_Menu_Item(row, ICON_ResumeEEPROM, F("Change Filament")); + Draw_Menu_Item(row, ICON_ResumeEEPROM, GET_TEXT_F(MSG_FILAMENTCHANGE)); else { if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) Popup_Handler(ETemp); @@ -1783,6 +2001,44 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; #endif // FILAMENT_LOAD_UNLOAD_GCODES + #if HAS_HOSTACTION_MENUS + case HostActions: + + #define HOSTACTIONS_BACK 0 + #define HOSTACTIONS_1 (HOSTACTIONS_BACK + 1) + #define HOSTACTIONS_2 (HOSTACTIONS_1 + 1) + #define HOSTACTIONS_3 (HOSTACTIONS_2 + 1) + #define HOSTACTIONS_TOTAL HOSTACTIONS_3 + + switch (item) { + case HOSTACTIONS_BACK: + if (draw) + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); + else { + if (temp_val.flag_tune) { + temp_val.flag_tune = false; + Redraw_Menu(false, true, true); + } + else + Draw_Menu(Prepare, PREPARE_ACTIONCOMMANDS); + } + break; + case HOSTACTIONS_1: + if (draw) Draw_Menu_Item(row, ICON_File, action1); + else if (!strcmp(action1, "-") == 0) hostui.action(F(action1)); + break; + case HOSTACTIONS_2: + if (draw) Draw_Menu_Item(row, ICON_File, action2); + else if (!strcmp(action2, "-") == 0) hostui.action(F(action2)); + break; + case HOSTACTIONS_3: + if (draw) Draw_Menu_Item(row, ICON_File, action3); + else if (!strcmp(action3, "-") == 0) hostui.action(F(action3)); + break; + } + break; + #endif + #if HAS_CUSTOM_MENU case MenuCustom: @@ -1908,70 +2164,104 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #define CONTROL_BACK 0 #define CONTROL_TEMP (CONTROL_BACK + 1) #define CONTROL_MOTION (CONTROL_TEMP + 1) - #define CONTROL_VISUAL (CONTROL_MOTION + 1) - #define CONTROL_ADVANCED (CONTROL_VISUAL + 1) + #define CONTROL_FWRETRACT (CONTROL_MOTION + ENABLED(FWRETRACT)) + #define CONTROL_LEDS (CONTROL_FWRETRACT + ANY(CASE_LIGHT_MENU, LED_CONTROL_MENU)) + #define CONTROL_VISUAL (CONTROL_LEDS + 1) + #define CONTROL_HOSTSETTINGS (CONTROL_VISUAL + ENABLED(HAS_HOSTACTION_MENUS)) + #define CONTROL_ADVANCED (CONTROL_HOSTSETTINGS + 1) #define CONTROL_SAVE (CONTROL_ADVANCED + ENABLED(EEPROM_SETTINGS)) #define CONTROL_RESTORE (CONTROL_SAVE + ENABLED(EEPROM_SETTINGS)) #define CONTROL_RESET (CONTROL_RESTORE + ENABLED(EEPROM_SETTINGS)) - #define CONTROL_INFO (CONTROL_RESET + 1) + #define CONTROL_REBOOT (CONTROL_RESET + 1) + #define CONTROL_INFO (CONTROL_REBOOT + 1) #define CONTROL_TOTAL CONTROL_INFO switch (item) { case CONTROL_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); else Draw_Main_Menu(2); break; case CONTROL_TEMP: if (draw) - Draw_Menu_Item(row, ICON_Temperature, F("Temperature"), nullptr, true); + Draw_Menu_Item(row, ICON_Temperature, GET_TEXT_F(MSG_TEMPERATURE), nullptr, true); else Draw_Menu(TempMenu); break; case CONTROL_MOTION: if (draw) - Draw_Menu_Item(row, ICON_Motion, F("Motion"), nullptr, true); + Draw_Menu_Item(row, ICON_Motion, GET_TEXT_F(MSG_MOTION), nullptr, true); else Draw_Menu(Motion); break; + #if ENABLED(FWRETRACT) + case CONTROL_FWRETRACT: + if (draw) + Draw_Menu_Item(row, ICON_StepE, GET_TEXT_F(MSG_AUTORETRACT), nullptr, true); + else + Draw_Menu(FwRetraction); + break; + #endif + #if ANY(CASE_LIGHT_MENU, LED_CONTROL_MENU) + case CONTROL_LEDS: + if (draw) + Draw_Menu_Item(row, ICON_LedControl, GET_TEXT_F(MSG_LEDS), nullptr, true); + else + Draw_Menu(Ledsmenu); + break; + #endif case CONTROL_VISUAL: if (draw) Draw_Menu_Item(row, ICON_PrintSize, F("Visual"), nullptr, true); else Draw_Menu(Visual); break; + #if HAS_HOSTACTION_MENUS + case CONTROL_HOSTSETTINGS: + if (draw) + Draw_Menu_Item(row, ICON_Contact, F("Host Settings"), nullptr, true); + else + Draw_Menu(HostSettings); + break; + #endif case CONTROL_ADVANCED: if (draw) - Draw_Menu_Item(row, ICON_Version, F("Advanced"), nullptr, true); + Draw_Menu_Item(row, ICON_Version, GET_TEXT_F(MSG_ADVANCED_SETTINGS), nullptr, true); else Draw_Menu(Advanced); break; #if ENABLED(EEPROM_SETTINGS) case CONTROL_SAVE: if (draw) - Draw_Menu_Item(row, ICON_WriteEEPROM, F("Store Settings")); + Draw_Menu_Item(row, ICON_WriteEEPROM, GET_TEXT_F(MSG_STORE_EEPROM)); else AudioFeedback(settings.save()); break; case CONTROL_RESTORE: if (draw) - Draw_Menu_Item(row, ICON_ReadEEPROM, F("Restore Settings")); + Draw_Menu_Item(row, ICON_ReadEEPROM, GET_TEXT_F(MSG_LOAD_EEPROM)); else AudioFeedback(settings.load()); break; case CONTROL_RESET: if (draw) - Draw_Menu_Item(row, ICON_Temperature, F("Reset to Defaults")); + Draw_Menu_Item(row, ICON_Temperature, GET_TEXT_F(MSG_RESTORE_DEFAULTS)); else { settings.reset(); AudioFeedback(); } break; #endif + case CONTROL_REBOOT: + if (draw) + Draw_Menu_Item(row, ICON_Reboot, GET_TEXT_F(MSG_RESET_PRINTER)); + else + RebootPrinter(); + break; case CONTROL_INFO: if (draw) - Draw_Menu_Item(row, ICON_Info, F("Info")); + Draw_Menu_Item(row, ICON_Info, GET_TEXT_F(MSG_INFO_SCREEN)); else Draw_Menu(Info); break; @@ -1995,7 +2285,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case TEMP_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); else Draw_Menu(Control, CONTROL_TEMP); break; @@ -2022,7 +2312,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_FAN case TEMP_FAN: if (draw) { - Draw_Menu_Item(row, ICON_FanSpeed, F("Fan")); + Draw_Menu_Item(row, ICON_FanSpeed, GET_TEXT_F(MSG_FAN_SPEED)); Draw_Float(thermalManager.fan_speed[0], row, false, 1); } else @@ -2062,14 +2352,14 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case PID_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); else Draw_Menu(TempMenu, TEMP_PID); break; #if HAS_HOTEND case PID_HOTEND: if (draw) - Draw_Menu_Item(row, ICON_HotendTemp, F("Hotend"), nullptr, true); + Draw_Menu_Item(row, ICON_HotendTemp, F(STR_HOTEND_PID), nullptr, true); else Draw_Menu(HotendPID); break; @@ -2077,14 +2367,14 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_HEATED_BED case PID_BED: if (draw) - Draw_Menu_Item(row, ICON_BedTemp, F("Bed"), nullptr, true); + Draw_Menu_Item(row, ICON_BedTemp, F(STR_BED_PID), nullptr, true); else Draw_Menu(BedPID); break; #endif case PID_CYCLES: if (draw) { - Draw_Menu_Item(row, ICON_FanSpeed, F("Cycles")); + Draw_Menu_Item(row, ICON_FanSpeed, GET_TEXT_F(MSG_PID_CYCLE)); Draw_Float(PID_cycles, row, false, 1); } else @@ -2105,21 +2395,19 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #define HOTENDPID_KD (HOTENDPID_KI + 1) #define HOTENDPID_TOTAL HOTENDPID_KD - static uint16_t PID_e_temp = 180; - switch (item) { case HOTENDPID_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); else Draw_Menu(PID, PID_HOTEND); break; case HOTENDPID_TUNE: if (draw) - Draw_Menu_Item(row, ICON_HotendTemp, F("Autotune")); + Draw_Menu_Item(row, ICON_HotendTemp, GET_TEXT_F(MSG_PID_AUTOTUNE)); else { Popup_Handler(PIDWait); - sprintf_P(cmd, PSTR("M303 E0 C%i S%i U1"), PID_cycles, PID_e_temp); + sprintf_P(cmd, PSTR("M303 E0 C%i S%i U1"), PID_cycles, temp_val.PID_e_temp); gcode.process_subcommands_now(cmd); planner.synchronize(); Redraw_Menu(); @@ -2127,11 +2415,11 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case HOTENDPID_TEMP: if (draw) { - Draw_Menu_Item(row, ICON_Temperature, F("Temperature")); - Draw_Float(PID_e_temp, row, false, 1); + Draw_Menu_Item(row, ICON_Temperature, GET_TEXT_F(MSG_TEMPERATURE)); + Draw_Float(temp_val.PID_e_temp, row, false, 1); } else - Modify_Value(PID_e_temp, MIN_E_TEMP, MAX_E_TEMP, 1); + Modify_Value(temp_val.PID_e_temp, MIN_E_TEMP, MAX_E_TEMP, 1); break; case HOTENDPID_KP: if (draw) { @@ -2172,21 +2460,19 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #define BEDPID_KD (BEDPID_KI + 1) #define BEDPID_TOTAL BEDPID_KD - static uint16_t PID_bed_temp = 60; - switch (item) { case BEDPID_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); else Draw_Menu(PID, PID_BED); break; case BEDPID_TUNE: if (draw) - Draw_Menu_Item(row, ICON_HotendTemp, F("Autotune")); + Draw_Menu_Item(row, ICON_HotendTemp, GET_TEXT_F(MSG_PID_AUTOTUNE)); else { Popup_Handler(PIDWait); - sprintf_P(cmd, PSTR("M303 E-1 C%i S%i U1"), PID_cycles, PID_bed_temp); + sprintf_P(cmd, PSTR("M303 E-1 C%i S%i U1"), PID_cycles, temp_val.PID_bed_temp); gcode.process_subcommands_now(cmd); planner.synchronize(); Redraw_Menu(); @@ -2194,20 +2480,19 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case BEDPID_TEMP: if (draw) { - Draw_Menu_Item(row, ICON_Temperature, F("Temperature")); - Draw_Float(PID_bed_temp, row, false, 1); + Draw_Menu_Item(row, ICON_Temperature, GET_TEXT_F(MSG_TEMPERATURE)); + Draw_Float(temp_val.PID_bed_temp, row, false, 1); } else - Modify_Value(PID_bed_temp, MIN_BED_TEMP, MAX_BED_TEMP, 1); + Modify_Value(temp_val.PID_bed_temp, MIN_BED_TEMP, MAX_BED_TEMP, 1); break; case BEDPID_KP: if (draw) { Draw_Menu_Item(row, ICON_Version, F("Kp Value")); Draw_Float(thermalManager.temp_bed.pid.Kp, row, false, 100); } - else { + else Modify_Value(thermalManager.temp_bed.pid.Kp, 0, 5000, 100, thermalManager.updatePID); - } break; case BEDPID_KI: if (draw) { @@ -2241,53 +2526,62 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #define MOTION_SPEED (MOTION_HOMEOFFSETS + 1) #define MOTION_ACCEL (MOTION_SPEED + 1) #define MOTION_JERK (MOTION_ACCEL + ENABLED(HAS_CLASSIC_JERK)) - #define MOTION_STEPS (MOTION_JERK + 1) + #define MOTION_JD (MOTION_JERK + ENABLED(HAS_JUNCTION_DEVIATION)) + #define MOTION_STEPS (MOTION_JD + 1) #define MOTION_FLOW (MOTION_STEPS + ENABLED(HAS_HOTEND)) #define MOTION_TOTAL MOTION_FLOW switch (item) { case MOTION_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); else Draw_Menu(Control, CONTROL_MOTION); break; case MOTION_HOMEOFFSETS: if (draw) - Draw_Menu_Item(row, ICON_SetHome, F("Home Offsets"), nullptr, true); + Draw_Menu_Item(row, ICON_SetHome, GET_TEXT_F(MSG_SET_HOME_OFFSETS), nullptr, true); else Draw_Menu(HomeOffsets); break; case MOTION_SPEED: if (draw) - Draw_Menu_Item(row, ICON_MaxSpeed, F("Max Speed"), nullptr, true); + Draw_Menu_Item(row, ICON_MaxSpeed, GET_TEXT_F(MSG_MAX_SPEED), nullptr, true); else Draw_Menu(MaxSpeed); break; case MOTION_ACCEL: if (draw) - Draw_Menu_Item(row, ICON_MaxAccelerated, F("Max Acceleration"), nullptr, true); + Draw_Menu_Item(row, ICON_MaxAccelerated, GET_TEXT_F(MSG_AMAX_EN), nullptr, true); else Draw_Menu(MaxAcceleration); break; #if HAS_CLASSIC_JERK case MOTION_JERK: if (draw) - Draw_Menu_Item(row, ICON_MaxJerk, F("Max Jerk"), nullptr, true); + Draw_Menu_Item(row, ICON_MaxJerk, GET_TEXT_F(MSG_JERK), nullptr, true); else Draw_Menu(MaxJerk); break; #endif + #if HAS_JUNCTION_DEVIATION + case MOTION_JD: + if (draw) + Draw_Menu_Item(row, ICON_MaxJerk, GET_TEXT_F(MSG_JUNCTION_DEVIATION), nullptr, true); + else + Draw_Menu(JDmenu); + break; + #endif case MOTION_STEPS: if (draw) - Draw_Menu_Item(row, ICON_Step, F("Steps/mm"), nullptr, true); + Draw_Menu_Item(row, ICON_Step, GET_TEXT_F(MSG_STEPS_PER_MM), nullptr, true); else Draw_Menu(Steps); break; #if HAS_HOTEND case MOTION_FLOW: if (draw) { - Draw_Menu_Item(row, ICON_Speed, F("Flow Rate")); + Draw_Menu_Item(row, ICON_Speed, GET_TEXT_F(MSG_FLOW)); Draw_Float(planner.flow_percentage[0], row, false, 1); } else @@ -2297,31 +2591,124 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ } break; - case HomeOffsets: + #if ENABLED(FWRETRACT) + case FwRetraction: - #define HOMEOFFSETS_BACK 0 - #define HOMEOFFSETS_XOFFSET (HOMEOFFSETS_BACK + 1) - #define HOMEOFFSETS_YOFFSET (HOMEOFFSETS_XOFFSET + 1) - #define HOMEOFFSETS_TOTAL HOMEOFFSETS_YOFFSET + #define FWR_BACK 0 + #define FWR_RET_AUTO (FWR_BACK + 1) + #define FWR_RET_LENGTH (FWR_RET_AUTO + 1) + #define FWR_RET_SPEED (FWR_RET_LENGTH + 1) + #define FWR_ZLIFT (FWR_RET_SPEED + 1) + #define FWR_REC_EXT_LENGTH (FWR_ZLIFT + 1) + #define FWR_REC_SPEED (FWR_REC_EXT_LENGTH + 1) + #define FWR_RESET (FWR_REC_SPEED + 1) + #define FWR_TOTAL FWR_RESET - switch (item) { - case HOMEOFFSETS_BACK: + switch (item) { + + case FWR_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); - else - Draw_Menu(Motion, MOTION_HOMEOFFSETS); - break; - case HOMEOFFSETS_XOFFSET: - if (draw) { - Draw_Menu_Item(row, ICON_StepX, F("X Offset")); - Draw_Float(home_offset.x, row, false, 100); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); + else { + if (temp_val.flag_tune) { + temp_val.flag_tune = false; + Redraw_Menu(false, true, true); + } + else + Draw_Menu(Control, CONTROL_FWRETRACT); } - else - Modify_Value(home_offset.x, -MAX_XY_OFFSET, MAX_XY_OFFSET, 100); + break; + case FWR_RET_AUTO: + if (draw) { + temp_val.auto_fw_retract = fwretract.autoretract_enabled; + Draw_Menu_Item(row, ICON_StepE, GET_TEXT_F(MSG_AUTORETRACT)); + Draw_Checkbox(row, temp_val.auto_fw_retract); + } + else { + if (MIN_AUTORETRACT <= MAX_AUTORETRACT) { + temp_val.auto_fw_retract = !temp_val.auto_fw_retract; + fwretract.enable_autoretract(temp_val.auto_fw_retract); + Draw_Checkbox(row, temp_val.auto_fw_retract); + } + } + break; + case FWR_RET_LENGTH: + if (draw) { + Draw_Menu_Item(row, ICON_FWRetLength, GET_TEXT_F(MSG_CONTROL_RETRACT)); + Draw_Float(fwretract.settings.retract_length, row, false, 10); + } + else + Modify_Value(fwretract.settings.retract_length, 0, 10, 10); + break; + case FWR_RET_SPEED: + if (draw) { + Draw_Menu_Item(row, ICON_FWRetSpeed, GET_TEXT_F(MSG_SINGLENOZZLE_RETRACT_SPEED)); + Draw_Float(fwretract.settings.retract_feedrate_mm_s, row, false, 10); + } + else + Modify_Value(fwretract.settings.retract_feedrate_mm_s, 1, 90, 10); + break; + case FWR_ZLIFT: + if (draw) { + Draw_Menu_Item(row, ICON_FWRetZRaise, GET_TEXT_F(MSG_CONTROL_RETRACT_ZHOP)); + Draw_Float(fwretract.settings.retract_zraise, row, false, 100); + } + else + Modify_Value(fwretract.settings.retract_zraise, 0, 10, 100); + break; + case FWR_REC_EXT_LENGTH: + if (draw) { + Draw_Menu_Item(row, ICON_FWRecExtLength, GET_TEXT_F(MSG_CONTROL_RETRACT_RECOVER)); + Draw_Float(fwretract.settings.retract_recover_extra, row, false, 10); + } + else + Modify_Value(fwretract.settings.retract_recover_extra, -10, 10, 10); + break; + case FWR_REC_SPEED: + if (draw) { + Draw_Menu_Item(row, ICON_FWRecSpeed, GET_TEXT_F(MSG_SINGLENOZZLE_UNRETRACT_SPEED)); + Draw_Float(fwretract.settings.retract_recover_feedrate_mm_s, row, false, 10); + } + else + Modify_Value(fwretract.settings.retract_recover_feedrate_mm_s, 1, 90, 10); + break; + case FWR_RESET: + if (draw) + Draw_Menu_Item(row, ICON_StepE, GET_TEXT_F(MSG_BUTTON_RESET)); + else { + fwretract.reset(); + Draw_Menu(FwRetraction); + } + break; + } + break; + #endif + + case HomeOffsets: + + #define HOMEOFFSETS_BACK 0 + #define HOMEOFFSETS_XOFFSET (HOMEOFFSETS_BACK + 1) + #define HOMEOFFSETS_YOFFSET (HOMEOFFSETS_XOFFSET + 1) + #define HOMEOFFSETS_TOTAL HOMEOFFSETS_YOFFSET + + switch (item) { + case HOMEOFFSETS_BACK: + if (draw) + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); + else + Draw_Menu(Motion, MOTION_HOMEOFFSETS); + break; + case HOMEOFFSETS_XOFFSET: + if (draw) { + Draw_Menu_Item(row, ICON_StepX, GET_TEXT_F(MSG_HOME_OFFSET_X)); + Draw_Float(home_offset.x, row, false, 100); + } + else + Modify_Value(home_offset.x, -MAX_XY_OFFSET, MAX_XY_OFFSET, 100); break; case HOMEOFFSETS_YOFFSET: if (draw) { - Draw_Menu_Item(row, ICON_StepY, F("Y Offset")); + Draw_Menu_Item(row, ICON_StepY, GET_TEXT_F(MSG_HOME_OFFSET_Y)); Draw_Float(home_offset.y, row, false, 100); } else @@ -2341,13 +2728,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case SPEED_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); else Draw_Menu(Motion, MOTION_SPEED); break; case SPEED_X: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedX, F("X Axis")); + Draw_Menu_Item(row, ICON_MaxSpeedX, GET_TEXT_F(MSG_VMAX_A)); Draw_Float(planner.settings.max_feedrate_mm_s[X_AXIS], row, false, 1); } else @@ -2357,7 +2744,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_Y_AXIS case SPEED_Y: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedY, F("Y Axis")); + Draw_Menu_Item(row, ICON_MaxSpeedY, GET_TEXT_F(MSG_VMAX_B)); Draw_Float(planner.settings.max_feedrate_mm_s[Y_AXIS], row, false, 1); } else @@ -2368,7 +2755,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_Z_AXIS case SPEED_Z: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedZ, F("Z Axis")); + Draw_Menu_Item(row, ICON_MaxSpeedZ, GET_TEXT_F(MSG_VMAX_C)); Draw_Float(planner.settings.max_feedrate_mm_s[Z_AXIS], row, false, 1); } else @@ -2379,7 +2766,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_HOTEND case SPEED_E: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedE, F("Extruder")); + Draw_Menu_Item(row, ICON_MaxSpeedE, GET_TEXT_F(MSG_VMAX_E)); Draw_Float(planner.settings.max_feedrate_mm_s[E_AXIS], row, false, 1); } else @@ -2401,13 +2788,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case ACCEL_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); else Draw_Menu(Motion, MOTION_ACCEL); break; case ACCEL_X: if (draw) { - Draw_Menu_Item(row, ICON_MaxAccX, F("X Axis")); + Draw_Menu_Item(row, ICON_MaxAccX, GET_TEXT_F(MSG_AMAX_A)); Draw_Float(planner.settings.max_acceleration_mm_per_s2[X_AXIS], row, false, 1); } else @@ -2415,7 +2802,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case ACCEL_Y: if (draw) { - Draw_Menu_Item(row, ICON_MaxAccY, F("Y Axis")); + Draw_Menu_Item(row, ICON_MaxAccY, GET_TEXT_F(MSG_AMAX_B)); Draw_Float(planner.settings.max_acceleration_mm_per_s2[Y_AXIS], row, false, 1); } else @@ -2423,7 +2810,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case ACCEL_Z: if (draw) { - Draw_Menu_Item(row, ICON_MaxAccZ, F("Z Axis")); + Draw_Menu_Item(row, ICON_MaxAccZ, GET_TEXT_F(MSG_AMAX_C)); Draw_Float(planner.settings.max_acceleration_mm_per_s2[Z_AXIS], row, false, 1); } else @@ -2432,7 +2819,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_HOTEND case ACCEL_E: if (draw) { - Draw_Menu_Item(row, ICON_MaxAccE, F("Extruder")); + Draw_Menu_Item(row, ICON_MaxAccE, GET_TEXT_F(MSG_AMAX_E)); Draw_Float(planner.settings.max_acceleration_mm_per_s2[E_AXIS], row, false, 1); } else @@ -2454,13 +2841,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case JERK_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); else Draw_Menu(Motion, MOTION_JERK); break; case JERK_X: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedJerkX, F("X Axis")); + Draw_Menu_Item(row, ICON_MaxSpeedJerkX, GET_TEXT_F(MSG_VA_JERK)); Draw_Float(planner.max_jerk[X_AXIS], row, false, 10); } else @@ -2468,7 +2855,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case JERK_Y: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedJerkY, F("Y Axis")); + Draw_Menu_Item(row, ICON_MaxSpeedJerkY, GET_TEXT_F(MSG_VB_JERK)); Draw_Float(planner.max_jerk[Y_AXIS], row, false, 10); } else @@ -2476,7 +2863,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case JERK_Z: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedJerkZ, F("Z Axis")); + Draw_Menu_Item(row, ICON_MaxSpeedJerkZ, GET_TEXT_F(MSG_VC_JERK)); Draw_Float(planner.max_jerk[Z_AXIS], row, false, 10); } else @@ -2485,7 +2872,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_HOTEND case JERK_E: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedJerkE, F("Extruder")); + Draw_Menu_Item(row, ICON_MaxSpeedJerkE, GET_TEXT_F(MSG_VE_JERK)); Draw_Float(planner.max_jerk[E_AXIS], row, false, 10); } else @@ -2495,6 +2882,33 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ } break; #endif + #if HAS_JUNCTION_DEVIATION + case JDmenu: + + #define JD_BACK 0 + #define JD_SETTING_JD_MM (JD_BACK + ENABLED(HAS_HOTEND)) + #define JD_TOTAL JD_SETTING_JD_MM + + switch (item) { + case JD_BACK: + if (draw) + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); + else + Draw_Menu(Motion, MOTION_JD); + break; + #if HAS_HOTEND + case JD_SETTING_JD_MM: + if (draw) { + Draw_Menu_Item(row, ICON_MaxJerk, GET_TEXT_F(MSG_JUNCTION_DEVIATION)); + Draw_Float(planner.junction_deviation_mm, row, false, 100); + } + else + Modify_Value(planner.junction_deviation_mm, MIN_JD_MM, MAX_JD_MM, 100); + break; + #endif + } + break; + #endif case Steps: #define STEPS_BACK 0 @@ -2507,13 +2921,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case STEPS_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); else Draw_Menu(Motion, MOTION_STEPS); break; case STEPS_X: if (draw) { - Draw_Menu_Item(row, ICON_StepX, F("X Axis")); + Draw_Menu_Item(row, ICON_StepX, GET_TEXT_F(MSG_A_STEPS)); Draw_Float(planner.settings.axis_steps_per_mm[X_AXIS], row, false, 10); } else @@ -2521,7 +2935,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case STEPS_Y: if (draw) { - Draw_Menu_Item(row, ICON_StepY, F("Y Axis")); + Draw_Menu_Item(row, ICON_StepY, GET_TEXT_F(MSG_B_STEPS)); Draw_Float(planner.settings.axis_steps_per_mm[Y_AXIS], row, false, 10); } else @@ -2529,7 +2943,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case STEPS_Z: if (draw) { - Draw_Menu_Item(row, ICON_StepZ, F("Z Axis")); + Draw_Menu_Item(row, ICON_StepZ, GET_TEXT_F(MSG_C_STEPS)); Draw_Float(planner.settings.axis_steps_per_mm[Z_AXIS], row, false, 10); } else @@ -2538,7 +2952,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_HOTEND case STEPS_E: if (draw) { - Draw_Menu_Item(row, ICON_StepE, F("Extruder")); + Draw_Menu_Item(row, ICON_StepE, GET_TEXT_F(MSG_E_STEPS)); Draw_Float(planner.settings.axis_steps_per_mm[E_AXIS], row, false, 10); } else @@ -2548,6 +2962,235 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ } break; + #if ANY(CASE_LIGHT_MENU, LED_CONTROL_MENU) + case Ledsmenu: + + #define LEDS_BACK 0 + #define LEDS_CASELIGHT (LEDS_BACK + ENABLED(CASE_LIGHT_MENU)) + #define LEDS_LED_CONTROL_MENU (LEDS_CASELIGHT + ENABLED(LED_CONTROL_MENU)) + #define LEDS_TOTAL LEDS_LED_CONTROL_MENU + + switch (item) { + + case LEDS_BACK: + if (draw) + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); + else + Draw_Menu(Control, CONTROL_LEDS); + break; + #if ENABLED(CASE_LIGHT_MENU) + case LEDS_CASELIGHT: + if (draw) { + #if ENABLED(CASELIGHT_USES_BRIGHTNESS) + Draw_Menu_Item(row, ICON_CaseLight, GET_TEXT_F(MSG_CASE_LIGHT), nullptr, true); + #else + Draw_Menu_Item(row, ICON_CaseLight, GET_TEXT_F(MSG_CASE_LIGHT)); + Draw_Checkbox(row, caselight.on); + #endif + } + else { + #if ENABLED(CASELIGHT_USES_BRIGHTNESS) + Draw_Menu(CaseLightmenu); + #else + caselight.on = !caselight.on; + caselight.update_enabled(); + Draw_Checkbox(row, caselight.on); + DWIN_UpdateLCD(); + #endif + } + break; + #endif + #if ENABLED(LED_CONTROL_MENU) + case LEDS_LED_CONTROL_MENU: + if (draw) + Draw_Menu_Item(row, ICON_LedControl, GET_TEXT_F(MSG_LED_CONTROL), nullptr, true); + else + Draw_Menu(LedControlmenu); + break; + #endif + } + break; + #endif + + #if ENABLED(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS) + case CaseLightmenu: + + #define CASE_LIGHT_BACK 0 + #define CASE_LIGHT_ON (CASE_LIGHT_BACK + 1) + #define CASE_LIGHT_USES_BRIGHT (CASE_LIGHT_ON + 1) + #define CASE_LIGHT_TOTAL CASE_LIGHT_USES_BRIGHT + + switch (item) { + + case CASE_LIGHT_BACK: + if (draw) + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); + else + Draw_Menu(Ledsmenu, LEDS_CASELIGHT); + break; + case CASE_LIGHT_ON: + if (draw) { + Draw_Menu_Item(row, ICON_CaseLight, GET_TEXT_F(MSG_CASE_LIGHT)); + Draw_Checkbox(row, caselight.on); + } + else { + caselight.on = !caselight.on; + caselight.update_enabled(); + Draw_Checkbox(row, caselight.on); + DWIN_UpdateLCD(); + } + break; + case CASE_LIGHT_USES_BRIGHT: + if (draw) { + Draw_Menu_Item(row, ICON_Brightness, GET_TEXT_F(MSG_CASE_LIGHT_BRIGHTNESS)); + Draw_Float(caselight.brightness, row); + } + else + Modify_Value(caselight.brightness, 0, 255, 1); + break; + } + break; + #endif + + #if ENABLED(LED_CONTROL_MENU) + case LedControlmenu: + + #define LEDCONTROL_BACK 0 + #define LEDCONTROL_LIGHTON (LEDCONTROL_BACK + !BOTH(CASE_LIGHT_MENU, CASE_LIGHT_USE_NEOPIXEL)) + #define LEDCONTROL_PRESETS_MENU (LEDCONTROL_LIGHTON + BOTH(HAS_COLOR_LEDS, LED_COLOR_PRESETS)) + #define LEDCONTROL_CUSTOM_MENU (LEDCONTROL_PRESETS_MENU + ENABLED(HAS_COLOR_LEDS) - DISABLED(LED_COLOR_PRESETS)) + #define LEDCONTROL_TOTAL LEDCONTROL_CUSTOM_MENU + + switch (item) { + case LEDCONTROL_BACK: + if (draw) + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); + else + Draw_Menu(Ledsmenu, LEDS_LED_CONTROL_MENU); + break; + #if !BOTH(CASE_LIGHT_MENU, CASE_LIGHT_USE_NEOPIXEL) + case LEDCONTROL_LIGHTON: + if (draw) { + Draw_Menu_Item(row, ICON_LedControl, GET_TEXT_F(MSG_LEDS)); + Draw_Checkbox(row, leds.lights_on); + } + else { + leds.toggle(); + Draw_Checkbox(row, leds.lights_on); + DWIN_UpdateLCD(); + } + break; + #endif + #if HAS_COLOR_LEDS + #if ENABLED(LED_COLOR_PRESETS) + case LEDCONTROL_PRESETS_MENU: + if (draw) + Draw_Menu_Item(row, ICON_LedControl, GET_TEXT_F(MSG_LED_PRESETS)); + else + Draw_Menu(LedControlpresets); + break; + #else + case LEDCONTROL_CUSTOM_MENU: + if (draw) + Draw_Menu_Item(row, ICON_LedControl, GET_TEXT_F(MSG_CUSTOM_LEDS)); + else + Draw_Menu(LedControlcustom); + break; + #endif + #endif + } + break; + + #if HAS_COLOR_LEDS + #if ENABLED(LED_COLOR_PRESETS) + case LedControlpresets: + + #define LEDCONTROL_PRESETS_BACK 0 + #define LEDCONTROL_PRESETS_WHITE (LEDCONTROL_PRESETS_BACK + 1) + #define LEDCONTROL_PRESETS_RED (LEDCONTROL_PRESETS_WHITE + 1) + #define LEDCONTROL_PRESETS_ORANGE (LEDCONTROL_PRESETS_RED + 1) + #define LEDCONTROL_PRESETS_YELLOW (LEDCONTROL_PRESETS_ORANGE + 1) + #define LEDCONTROL_PRESETS_GREEN (LEDCONTROL_PRESETS_YELLOW + 1) + #define LEDCONTROL_PRESETS_BLUE (LEDCONTROL_PRESETS_GREEN + 1) + #define LEDCONTROL_PRESETS_INDIGO (LEDCONTROL_PRESETS_BLUE + 1) + #define LEDCONTROL_PRESETS_VIOLET (LEDCONTROL_PRESETS_INDIGO + 1) + #define LEDCONTROL_PRESETS_TOTAL LEDCONTROL_PRESETS_VIOLET + + #define LEDCOLORITEM(MSG,FUNC) if (draw) Draw_Menu_Item(row, ICON_LedControl, GET_TEXT_F(MSG)); else FUNC; break; + + switch (item) { + case LEDCONTROL_PRESETS_BACK: + if (draw) + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); + else + Draw_Menu(LedControlmenu, LEDCONTROL_PRESETS_MENU); + break; + case LEDCONTROL_PRESETS_WHITE: LEDCOLORITEM(MSG_SET_LEDS_WHITE, leds.set_white()); + case LEDCONTROL_PRESETS_RED: LEDCOLORITEM(MSG_SET_LEDS_RED, leds.set_red()); + case LEDCONTROL_PRESETS_ORANGE: LEDCOLORITEM(MSG_SET_LEDS_ORANGE, leds.set_orange()); + case LEDCONTROL_PRESETS_YELLOW: LEDCOLORITEM(MSG_SET_LEDS_YELLOW, leds.set_yellow()); + case LEDCONTROL_PRESETS_GREEN: LEDCOLORITEM(MSG_SET_LEDS_GREEN, leds.set_green()); + case LEDCONTROL_PRESETS_BLUE: LEDCOLORITEM(MSG_SET_LEDS_BLUE, leds.set_blue()); + case LEDCONTROL_PRESETS_INDIGO: LEDCOLORITEM(MSG_SET_LEDS_INDIGO, leds.set_indigo()); + case LEDCONTROL_PRESETS_VIOLET: LEDCOLORITEM(MSG_SET_LEDS_VIOLET, leds.set_violet()); + } + break; + #else + case LedControlcustom: + + #define LEDCONTROL_CUSTOM_BACK 0 + #define LEDCONTROL_CUSTOM_RED (LEDCONTROL_CUSTOM_BACK + 1) + #define LEDCONTROL_CUSTOM_GREEN (LEDCONTROL_CUSTOM_RED + 1) + #define LEDCONTROL_CUSTOM_BLUE (LEDCONTROL_CUSTOM_GREEN + 1) + #define LEDCONTROL_CUSTOM_WHITE (LEDCONTROL_CUSTOM_BLUE + ENABLED(HAS_WHITE_LED)) + #define LEDCONTROL_CUSTOM_TOTAL LEDCONTROL_CUSTOM_WHITE + + switch (item) { + case LEDCONTROL_PRESETS_BACK: + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); + else + Draw_Menu(LedControlmenu, LEDCONTROL_CUSTOM_MENU); + break; + case LEDCONTROL_CUSTOM_RED: + if (draw) { + Draw_Menu_Item(row, ICON_LedControl, GET_TEXT_F(MSG_INTENSITY_R)); + Draw_Float(leds.color.r, row); + } + else + Modify_Value(leds.color.r, 0, 255, 1); + break; + case LEDCONTROL_CUSTOM_GREEN: + if (draw) { + Draw_Menu_Item(row, ICON_LedControl, GET_TEXT_F(MSG_INTENSITY_G)); + Draw_Float(leds.color.g, row); + } + else + Modify_Value(leds.color.g, 0, 255, 1); + break; + case LEDCONTROL_CUSTOM_BLUE: + if (draw) { + Draw_Menu_Item(row, ICON_LedControl, GET_TEXT_F(MSG_INTENSITY_B)); + Draw_Float(leds.color.b, row); + } + else + Modify_Value(leds.color.b, 0, 255, 1); + break; + #if HAS_WHITE_LED + case case LEDCONTROL_CUSTOM_WHITE: + if (draw) { + Draw_Menu_Item(row, ICON_LedControl, GET_TEXT_F(MSG_INTENSITY_W)); + Draw_Float(leds.color.w, row); + } + else + Modify_Value(leds.color.w, 0, 255, 1); + break; + #endif + } + break; + #endif + #endif + #endif + case Visual: #define VISUAL_BACK 0 @@ -2560,19 +3203,19 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case VISUAL_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); else Draw_Menu(Control, CONTROL_VISUAL); break; case VISUAL_BACKLIGHT: if (draw) - Draw_Menu_Item(row, ICON_Brightness, F("Display Off")); + Draw_Menu_Item(row, ICON_Brightness, GET_TEXT_F(MSG_BRIGHTNESS_OFF)); else ui.set_brightness(0); break; case VISUAL_BRIGHTNESS: if (draw) { - Draw_Menu_Item(row, ICON_Brightness, F("LCD Brightness")); + Draw_Menu_Item(row, ICON_Brightness, GET_TEXT_F(MSG_BRIGHTNESS)); Draw_Float(ui.brightness, row, false, 1); } else @@ -2590,7 +3233,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case VISUAL_COLOR_THEMES: if (draw) - Draw_Menu_Item(row, ICON_MaxSpeed, F("UI Color Settings"), nullptr, true); + Draw_Menu_Item(row, ICON_MaxSpeed, GET_TEXT_F(MSG_COLORS_SELECT), nullptr, true); else Draw_Menu(ColorSettings); break; @@ -2616,7 +3259,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case COLORSETTINGS_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); else Draw_Menu(Visual, VISUAL_COLOR_THEMES); break; @@ -2711,6 +3354,70 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ } // switch (item) break; + #if HAS_HOSTACTION_MENUS + case HostSettings: + + #define HOSTSETTINGS_BACK 0 + #define HOSTSETTINGS_ACTIONCOMMANDS (HOSTSETTINGS_BACK + 1) + #define HOSTSETTINGS_TOTAL HOSTSETTINGS_ACTIONCOMMANDS + + switch (item) { + case HOSTSETTINGS_BACK: + if (draw) + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); + else + Draw_Menu(Control, CONTROL_HOSTSETTINGS); + break; + case HOSTSETTINGS_ACTIONCOMMANDS: + if (draw) Draw_Menu_Item(row, ICON_File, F("Host Actions")); + else Draw_Menu(ActionCommands); + break; + } + break; + + case ActionCommands: + + #define ACTIONCOMMANDS_BACK 0 + #define ACTIONCOMMANDS_1 (ACTIONCOMMANDS_BACK + 1) + #define ACTIONCOMMANDS_2 (ACTIONCOMMANDS_1 + 1) + #define ACTIONCOMMANDS_3 (ACTIONCOMMANDS_2 + 1) + #define ACTIONCOMMANDS_TOTAL ACTIONCOMMANDS_3 + + switch (item) { + case ACTIONCOMMANDS_BACK: + if (draw) + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); + else + Draw_Menu(HostSettings, HOSTSETTINGS_ACTIONCOMMANDS); + break; + case ACTIONCOMMANDS_1: + if (draw) { + Draw_Menu_Item(row, ICON_File, F("Action #1")); + Draw_String(action1, row); + } + else + Modify_String(action1, 8, true); + break; + case ACTIONCOMMANDS_2: + if (draw) { + Draw_Menu_Item(row, ICON_File, F("Action #2")); + Draw_String(action2, row); + } + else + Modify_String(action2, 8, true); + break; + case ACTIONCOMMANDS_3: + if (draw) { + Draw_Menu_Item(row, ICON_File, F("Action #3")); + Draw_String(action3, row); + } + else + Modify_String(action3, 8, true); + break; + } + break; + #endif + case Advanced: #define ADVANCED_BACK 0 @@ -2724,12 +3431,15 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #define ADVANCED_FILSENSORENABLED (ADVANCED_COLD_EXTRUDE + ENABLED(FILAMENT_RUNOUT_SENSOR)) #define ADVANCED_FILSENSORDISTANCE (ADVANCED_FILSENSORENABLED + ENABLED(HAS_FILAMENT_RUNOUT_DISTANCE)) #define ADVANCED_POWER_LOSS (ADVANCED_FILSENSORDISTANCE + ENABLED(POWER_LOSS_RECOVERY)) - #define ADVANCED_TOTAL ADVANCED_POWER_LOSS + #define ADVANCED_BAUDRATE_MODE (ADVANCED_POWER_LOSS + ENABLED(BAUD_RATE_GCODE)) + #define ADVANCED_ESDIAG (ADVANCED_BAUDRATE_MODE + ENABLED(HAS_ESDIAG)) + #define ADVANCED_LOCKSCREEN (ADVANCED_ESDIAG + ENABLED(HAS_LOCKSCREEN)) + #define ADVANCED_TOTAL ADVANCED_LOCKSCREEN switch (item) { case ADVANCED_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); else Draw_Menu(Control, CONTROL_ADVANCED); break; @@ -2737,7 +3447,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if ENABLED(SOUND_MENU_ITEM) case ADVANCED_BEEPER: if (draw) { - Draw_Menu_Item(row, ICON_Version, F("LCD Beeper")); + Draw_Menu_Item(row, ICON_Sound, GET_TEXT_F(MSG_SOUND_ENABLE)); Draw_Checkbox(row, ui.sound_on); } else { @@ -2750,7 +3460,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_BED_PROBE case ADVANCED_PROBE: if (draw) - Draw_Menu_Item(row, ICON_StepX, F("Probe"), nullptr, true); + Draw_Menu_Item(row, ICON_ProbeSet, GET_TEXT_F(MSG_ZPROBE_SETTINGS), nullptr, true); else Draw_Menu(ProbeMenu); break; @@ -2759,16 +3469,16 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ case ADVANCED_CORNER: if (draw) { Draw_Menu_Item(row, ICON_MaxAccelerated, F("Bed Screw Inset")); - Draw_Float(corner_pos, row, false, 10); + Draw_Float(temp_val.corner_pos, row, false, 10); } else - Modify_Value(corner_pos, 1, 100, 10); + Modify_Value(temp_val.corner_pos, 1, 100, 10); break; #if ENABLED(LIN_ADVANCE) case ADVANCED_LA: if (draw) { - Draw_Menu_Item(row, ICON_MaxAccelerated, F("Lin Advance Kp")); + Draw_Menu_Item(row, ICON_MaxAccelerated, GET_TEXT_F(MSG_ADVANCE_K_E)); Draw_Float(planner.extruder_advance_K[0], row, false, 100); } else @@ -2779,7 +3489,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if ENABLED(ADVANCED_PAUSE_FEATURE) case ADVANCED_LOAD: if (draw) { - Draw_Menu_Item(row, ICON_WriteEEPROM, F("Load Length")); + Draw_Menu_Item(row, ICON_WriteEEPROM, GET_TEXT_F(MSG_FILAMENT_LOAD)); Draw_Float(fc_settings[0].load_length, row, false, 1); } else @@ -2787,7 +3497,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case ADVANCED_UNLOAD: if (draw) { - Draw_Menu_Item(row, ICON_ReadEEPROM, F("Unload Length")); + Draw_Menu_Item(row, ICON_ReadEEPROM, GET_TEXT_F(MSG_FILAMENT_UNLOAD)); Draw_Float(fc_settings[0].unload_length, row, false, 1); } else @@ -2811,7 +3521,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if ENABLED(FILAMENT_RUNOUT_SENSOR) case ADVANCED_FILSENSORENABLED: if (draw) { - Draw_Menu_Item(row, ICON_Extruder, F("Filament Sensor")); + Draw_Menu_Item(row, ICON_Extruder, GET_TEXT_F(MSG_RUNOUT_ENABLE)); Draw_Checkbox(row, runout.enabled); } else { @@ -2823,7 +3533,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if ENABLED(HAS_FILAMENT_RUNOUT_DISTANCE) case ADVANCED_FILSENSORDISTANCE: if (draw) { - Draw_Menu_Item(row, ICON_MaxAccE, F("Runout Distance")); + Draw_Menu_Item(row, ICON_MaxAccE, GET_TEXT_F(MSG_RUNOUT_DISTANCE_MM)); Draw_Float(runout.runout_distance(), row, false, 10); } else @@ -2835,7 +3545,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if ENABLED(POWER_LOSS_RECOVERY) case ADVANCED_POWER_LOSS: if (draw) { - Draw_Menu_Item(row, ICON_Motion, F("Power-loss recovery")); + Draw_Menu_Item(row, ICON_Motion, GET_TEXT_F(MSG_OUTAGE_RECOVERY)); Draw_Checkbox(row, recovery.enabled); } else { @@ -2844,6 +3554,34 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ } break; #endif + #if ENABLED(BAUD_RATE_GCODE) + case ADVANCED_BAUDRATE_MODE: + if (draw) { + Draw_Menu_Item(row, ICON_Setspeed, F("115k Baud")); + Draw_Checkbox(row, eeprom_settings.Baud115k); + } + else { + eeprom_settings.Baud115k = !eeprom_settings.Baud115k; + queue.inject(eeprom_settings.Baud115k ? F("M575 P0 B115200") : F("M575 P0 B250000")); + } + break; + #endif + #if HAS_ESDIAG + case ADVANCED_ESDIAG: + if (draw) + Draw_Menu_Item(row, ICON_ESDiag, F("End-stops diagnostic")); + else + DWIN_EndstopsDiag(); + break; + #endif + #if HAS_LOCKSCREEN + case ADVANCED_LOCKSCREEN: + if (draw) + Draw_Menu_Item(row, ICON_Lock, GET_TEXT_F(MSG_LOCKSCREEN)); + else + DWIN_LockScreen(); + break; + #endif } break; @@ -2853,7 +3591,12 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #define PROBE_BACK 0 #define PROBE_XOFFSET (PROBE_BACK + 1) #define PROBE_YOFFSET (PROBE_XOFFSET + 1) - #define PROBE_TEST (PROBE_YOFFSET + 1) + #define PROBE_ZOFFSET (PROBE_YOFFSET + 1) + #define PROBE_HSMODE (PROBE_ZOFFSET + ENABLED(BLTOUCH)) + #define PROBE_ALARMR (PROBE_HSMODE + ENABLED(BLTOUCH)) + #define PROBE_SELFTEST (PROBE_ALARMR + ENABLED(BLTOUCH)) + #define PROBE_MOVEP (PROBE_SELFTEST + ENABLED(BLTOUCH)) + #define PROBE_TEST (PROBE_MOVEP + 1) #define PROBE_TEST_COUNT (PROBE_TEST + 1) #define PROBE_TOTAL PROBE_TEST_COUNT @@ -2862,43 +3605,91 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case PROBE_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); else Draw_Menu(Advanced, ADVANCED_PROBE); break; - - case PROBE_XOFFSET: + case PROBE_XOFFSET: + if (draw) { + Draw_Menu_Item(row, ICON_StepX, GET_TEXT_F(MSG_ZPROBE_XOFFSET)); + Draw_Float(probe.offset.x, row, false, 10); + } + else + Modify_Value(probe.offset.x, -MAX_XY_OFFSET, MAX_XY_OFFSET, 10); + break; + case PROBE_YOFFSET: + if (draw) { + Draw_Menu_Item(row, ICON_StepY, GET_TEXT_F(MSG_ZPROBE_YOFFSET)); + Draw_Float(probe.offset.y, row, false, 10); + } + else + Modify_Value(probe.offset.y, -MAX_XY_OFFSET, MAX_XY_OFFSET, 10); + break; + case PROBE_ZOFFSET: + if (draw) { + Draw_Menu_Item(row, ICON_StepZ, GET_TEXT_F(MSG_ZPROBE_ZOFFSET)); + Draw_Float(probe.offset.z, row, false, 100); + } + else + Modify_Value(probe.offset.z, MIN_Z_OFFSET, MAX_Z_OFFSET, 100); + break; + #if ENABLED(BLTOUCH) + case PROBE_HSMODE: if (draw) { - Draw_Menu_Item(row, ICON_StepX, F("Probe X Offset")); - Draw_Float(probe.offset.x, row, false, 10); + Draw_Menu_Item(row, ICON_HSMode, GET_TEXT(MSG_BLTOUCH_SPEED_MODE)); + Draw_Checkbox(row, bltouch.high_speed_mode); + } + else { + bltouch.high_speed_mode = !bltouch.high_speed_mode; + Draw_Checkbox(row, bltouch.high_speed_mode); } - else - Modify_Value(probe.offset.x, -MAX_XY_OFFSET, MAX_XY_OFFSET, 10); break; - case PROBE_YOFFSET: - if (draw) { - Draw_Menu_Item(row, ICON_StepY, F("Probe Y Offset")); - Draw_Float(probe.offset.y, row, false, 10); + case PROBE_ALARMR: + if (draw) + Draw_Menu_Item(row, ICON_ProbeAlarm, GET_TEXT_F(MSG_BLTOUCH_RESET)); + else { + gcode.process_subcommands_now(F("M280 P0 S160")); + AudioFeedback(); } - else - Modify_Value(probe.offset.y, -MAX_XY_OFFSET, MAX_XY_OFFSET, 10); break; - case PROBE_TEST: + case PROBE_SELFTEST: if (draw) - Draw_Menu_Item(row, ICON_StepY, F("M48 Probe Test")); + Draw_Menu_Item(row, ICON_ProbeSelfTest, GET_TEXT_F(MSG_BLTOUCH_SELFTEST)); else { - sprintf_P(cmd, PSTR("G28O\nM48 X%s Y%s P%i"), dtostrf((X_BED_SIZE + X_MIN_POS) / 2.0f, 1, 3, str_1), dtostrf((Y_BED_SIZE + Y_MIN_POS) / 2.0f, 1, 3, str_2), testcount); - gcode.process_subcommands_now(cmd); + gcode.process_subcommands_now(F("M280 P0 S120\nG4 P1000\nM280 P0 S160")); + planner.synchronize(); + AudioFeedback(); } break; - case PROBE_TEST_COUNT: + case PROBE_MOVEP: if (draw) { - Draw_Menu_Item(row, ICON_StepY, F("Probe Test Count")); - Draw_Float(testcount, row, false, 1); + Draw_Menu_Item(row, ICON_ProbeDeploy, GET_TEXT_F(MSG_BLTOUCH_DEPLOY)); + Draw_Checkbox(row, temp_val.probe_deployed); + } + else { + temp_val.probe_deployed = !temp_val.probe_deployed; + if (temp_val.probe_deployed == true) gcode.process_subcommands_now(F("M280 P0 S10")); + else gcode.process_subcommands_now(F("M280 P0 S90")); + Draw_Checkbox(row, temp_val.probe_deployed); } - else - Modify_Value(testcount, 4, 50, 1); break; + #endif + case PROBE_TEST: + if (draw) + Draw_Menu_Item(row, ICON_ProbeTest, GET_TEXT_F(MSG_M48_TEST)); + else { + sprintf_P(cmd, PSTR("G28O\nM48 X%s Y%s P%i"), dtostrf((X_BED_SIZE + X_MIN_POS) / 2.0f, 1, 3, str_1), dtostrf((Y_BED_SIZE + Y_MIN_POS) / 2.0f, 1, 3, str_2), testcount); + gcode.process_subcommands_now(cmd); + } + break; + case PROBE_TEST_COUNT: + if (draw) { + Draw_Menu_Item(row, ICON_ProbeTestCount, F("Probe Test Count")); + Draw_Float(testcount, row, false, 1); + } + else + Modify_Value(testcount, 4, 50, 1); + break; } break; #endif @@ -2917,7 +3708,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case INFO_BACK: if (draw) { - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); #if ENABLED(PRINTCOUNTER) char row1[50], row2[50], buf[32]; @@ -2966,22 +3757,19 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case LEVELING_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); else Draw_Main_Menu(3); break; case LEVELING_ACTIVE: if (draw) { - Draw_Menu_Item(row, ICON_StockConfiguration, F("Leveling Active")); + Draw_Menu_Item(row, ICON_MeshActive, GET_TEXT_F(MSG_MESH_LEVELING)); Draw_Checkbox(row, planner.leveling_active); } else { if (!planner.leveling_active) { set_bed_leveling_enabled(!planner.leveling_active); - if (!planner.leveling_active) { - Confirm_Handler(LevelError); - break; - } + if (!planner.leveling_active) { Confirm_Handler(LevelError); break; } } else set_bed_leveling_enabled(!planner.leveling_active); @@ -2993,10 +3781,8 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ if (draw) Draw_Menu_Item(row, ICON_Tilt, F("Autotilt Current Mesh")); else { - if (bedlevel.storage_slot < 0) { - Popup_Handler(MeshSlot); - break; - } + if (bedlevel.storage_slot < 0) { Popup_Handler(MeshSlot); break; } + PreheatBefore(); Popup_Handler(Home); gcode.home_all_axes(true); Popup_Handler(Level); @@ -3013,21 +3799,21 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #endif case LEVELING_GET_MESH: if (draw) - Draw_Menu_Item(row, ICON_Mesh, F("Create New Mesh")); + Draw_Menu_Item(row, ICON_Mesh, GET_TEXT_F(MSG_UBL_BUILD_MESH_MENU)); else { + #if ENABLED(AUTO_BED_LEVELING_UBL) + if (bedlevel.storage_slot < 0) { Popup_Handler(MeshSlot, true); break; } + #endif + PreheatBefore(); Popup_Handler(Home); gcode.home_all_axes(true); #if ENABLED(AUTO_BED_LEVELING_UBL) - #if ENABLED(PREHEAT_BEFORE_LEVELING) - Popup_Handler(Heating); - probe.preheat_for_probing(LEVELING_NOZZLE_TEMP, LEVELING_BED_TEMP); - #endif #if HAS_BED_PROBE Popup_Handler(Level); - gcode.process_subcommands_now(F("G29 P0\nG29 P1")); + gcode.process_subcommands_now(F("G29 P1")); gcode.process_subcommands_now(F("G29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nM420 S1")); planner.synchronize(); - Update_Status("Probed all reachable points"); + Update_Status(GET_TEXT_F(MSG_MESH_DONE)); Popup_Handler(SaveLevel); #else level_state = planner.leveling_active; @@ -3042,13 +3828,14 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ Popup_Handler(Level); gcode.process_subcommands_now(F("G29")); planner.synchronize(); + Update_Status(GET_TEXT_F(MSG_MESH_DONE)); Popup_Handler(SaveLevel); #else level_state = planner.leveling_active; set_bed_leveling_enabled(false); - gridpoint = 1; + temp_val.gridpoint = 1; Popup_Handler(MoveWait); - gcode.process_subcommands_now(F("G29")); + gcode.process_subcommands_now(F("M211 S0\nG29")); planner.synchronize(); Draw_Menu(ManualMesh); #endif @@ -3056,42 +3843,22 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case LEVELING_MANUAL: if (draw) - Draw_Menu_Item(row, ICON_Mesh, F("Manual Tuning"), nullptr, true); + Draw_Menu_Item(row, ICON_Mesh, GET_TEXT_F(MSG_UBL_MESH_EDIT), nullptr, true); else { #if ENABLED(AUTO_BED_LEVELING_BILINEAR) - if (!leveling_is_valid()) { - Confirm_Handler(InvalidMesh); - break; - } + if (!leveling_is_valid()) { Confirm_Handler(InvalidMesh); break; } #endif #if ENABLED(AUTO_BED_LEVELING_UBL) - if (bedlevel.storage_slot < 0) { - Popup_Handler(MeshSlot); - break; - } + if (bedlevel.storage_slot < 0) { Popup_Handler(MeshSlot); break; } #endif - if (axes_should_home()) { - Popup_Handler(Home); - gcode.home_all_axes(true); - } + PreheatBefore(); + if (axes_should_home()) { Popup_Handler(Home); gcode.home_all_axes(true); } level_state = planner.leveling_active; set_bed_leveling_enabled(false); mesh_conf.goto_mesh_value = false; - #if ENABLED(PREHEAT_BEFORE_LEVELING) - Popup_Handler(Heating); - #if HAS_HOTEND - if (thermalManager.degTargetHotend(0) < LEVELING_NOZZLE_TEMP) - thermalManager.setTargetHotend(LEVELING_NOZZLE_TEMP, 0); - #endif - #if HAS_HEATED_BED - if (thermalManager.degTargetBed() < LEVELING_BED_TEMP) - thermalManager.setTargetBed(LEVELING_BED_TEMP); - #endif - TERN_(HAS_HOTEND, thermalManager.wait_for_hotend(0)); - TERN_(HAS_HEATED_BED, thermalManager.wait_for_bed_heating()); - #endif Popup_Handler(MoveWait); mesh_conf.manual_mesh_move(); + gcode.process_subcommands_now(F("M211 S0")); Draw_Menu(LevelManual); } break; @@ -3100,24 +3867,21 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ Draw_Menu_Item(row, ICON_Mesh, GET_TEXT_F(MSG_MESH_VIEW), nullptr, true); else { #if ENABLED(AUTO_BED_LEVELING_UBL) - if (bedlevel.storage_slot < 0) { - Popup_Handler(MeshSlot); - break; - } + if (bedlevel.storage_slot < 0) { Popup_Handler(MeshSlot); break; } #endif Draw_Menu(LevelView); } break; case LEVELING_SETTINGS: if (draw) - Draw_Menu_Item(row, ICON_Step, F("Leveling Settings"), nullptr, true); + Draw_Menu_Item(row, ICON_Step, GET_TEXT_F(MSG_ADVANCED_SETTINGS), nullptr, true); else Draw_Menu(LevelSettings); break; #if ENABLED(AUTO_BED_LEVELING_UBL) case LEVELING_SLOT: if (draw) { - Draw_Menu_Item(row, ICON_PrintSize, F("Mesh Slot")); + Draw_Menu_Item(row, ICON_PrintSize, GET_TEXT_F(MSG_UBL_STORAGE_SLOT)); Draw_Float(bedlevel.storage_slot, row, false, 1); } else @@ -3125,12 +3889,9 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case LEVELING_LOAD: if (draw) - Draw_Menu_Item(row, ICON_ReadEEPROM, F("Load Mesh")); + Draw_Menu_Item(row, ICON_ReadEEPROM, GET_TEXT_F(MSG_UBL_LOAD_MESH)); else { - if (bedlevel.storage_slot < 0) { - Popup_Handler(MeshSlot); - break; - } + if (bedlevel.storage_slot < 0) { Popup_Handler(MeshSlot); break; } gcode.process_subcommands_now(F("G29 L")); planner.synchronize(); AudioFeedback(true); @@ -3138,12 +3899,9 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case LEVELING_SAVE: if (draw) - Draw_Menu_Item(row, ICON_WriteEEPROM, F("Save Mesh")); + Draw_Menu_Item(row, ICON_WriteEEPROM, GET_TEXT_F(MSG_UBL_SAVE_MESH)); else { - if (bedlevel.storage_slot < 0) { - Popup_Handler(MeshSlot); - break; - } + if (bedlevel.storage_slot < 0) { Popup_Handler(MeshSlot); break; } gcode.process_subcommands_now(F("G29 S")); planner.synchronize(); AudioFeedback(true); @@ -3164,7 +3922,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case LEVELING_VIEW_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); else Draw_Menu(Leveling, LEVELING_VIEW); break; @@ -3200,7 +3958,10 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ case LevelSettings: #define LEVELING_SETTINGS_BACK 0 - #define LEVELING_SETTINGS_FADE (LEVELING_SETTINGS_BACK + 1) + #define LEVELING_SETTINGS_LEVELTEMP_MODE (LEVELING_SETTINGS_BACK + ENABLED(PREHEAT_BEFORE_LEVELING)) + #define LEVELING_SETTINGS_HOTENDTEMP (LEVELING_SETTINGS_LEVELTEMP_MODE + ENABLED(PREHEAT_BEFORE_LEVELING)) + #define LEVELING_SETTINGS_BEDTEMP (LEVELING_SETTINGS_HOTENDTEMP + ENABLED(PREHEAT_BEFORE_LEVELING)) + #define LEVELING_SETTINGS_FADE (LEVELING_SETTINGS_BEDTEMP + 1) #define LEVELING_SETTINGS_TILT (LEVELING_SETTINGS_FADE + ENABLED(AUTO_BED_LEVELING_UBL)) #define LEVELING_SETTINGS_PLANE (LEVELING_SETTINGS_TILT + ENABLED(AUTO_BED_LEVELING_UBL)) #define LEVELING_SETTINGS_ZERO (LEVELING_SETTINGS_PLANE + ENABLED(AUTO_BED_LEVELING_UBL)) @@ -3210,31 +3971,59 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case LEVELING_SETTINGS_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); else Draw_Menu(Leveling, LEVELING_SETTINGS); break; - case LEVELING_SETTINGS_FADE: + #if ENABLED(PREHEAT_BEFORE_LEVELING) + case LEVELING_SETTINGS_LEVELTEMP_MODE: + if (draw) { + Draw_Menu_Item(row, ICON_Homing, F("Preheat Mode")); + Draw_Option(temp_val.LevelingTempmode, preheat_levmodes, row); + } + else + Modify_Option(temp_val.LevelingTempmode, preheat_levmodes, 3); + break; + case LEVELING_SETTINGS_HOTENDTEMP: if (draw) { - Draw_Menu_Item(row, ICON_Fade, F("Fade Mesh within")); - Draw_Float(planner.z_fade_height, row, false, 1); - } - else { - Modify_Value(planner.z_fade_height, 0, Z_MAX_POS, 1); - planner.z_fade_height = -1; - set_z_fade_height(planner.z_fade_height); + Draw_Menu_Item(row, ICON_SetEndTemp, F("Preheat Hotend")); + Draw_Float(eeprom_settings.hotend_levtemp, row, false, 1); } + else + Modify_Value(eeprom_settings.hotend_levtemp, MIN_E_TEMP, MAX_E_TEMP, 1); break; + case LEVELING_SETTINGS_BEDTEMP: + if (draw) { + Draw_Menu_Item(row, ICON_SetBedTemp, F("Preheat Bed")); + Draw_Float(eeprom_settings.bed_levtemp, row, false, 1); + } + else + Modify_Value(eeprom_settings.bed_levtemp, MIN_BED_TEMP, MAX_BED_TEMP, 1); + break; + #endif + case LEVELING_SETTINGS_FADE: + if (draw) { + Draw_Menu_Item(row, ICON_Fade, GET_TEXT_F(MSG_Z_FADE_HEIGHT)); + Draw_Float(planner.z_fade_height, row, false, 1); + } + else { + Modify_Value(planner.z_fade_height, 0, Z_MAX_POS, 1); + planner.z_fade_height = -1; + set_z_fade_height(planner.z_fade_height); + } + break; #if ENABLED(AUTO_BED_LEVELING_UBL) + case LEVELING_SETTINGS_TILT: if (draw) { - Draw_Menu_Item(row, ICON_Tilt, F("Tilting Grid Size")); + Draw_Menu_Item(row, ICON_Tilt, F("Tilting Grid")); Draw_Float(mesh_conf.tilt_grid, row, false, 1); } else Modify_Value(mesh_conf.tilt_grid, 1, 8, 1); break; + case LEVELING_SETTINGS_PLANE: if (draw) Draw_Menu_Item(row, ICON_ResumeEEPROM, F("Convert Mesh to Plane")); @@ -3245,18 +4034,21 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ AudioFeedback(true); } break; + case LEVELING_SETTINGS_ZERO: if (draw) Draw_Menu_Item(row, ICON_Mesh, F("Zero Current Mesh")); else ZERO(bedlevel.z_values); break; + case LEVELING_SETTINGS_UNDEF: if (draw) Draw_Menu_Item(row, ICON_Mesh, F("Clear Current Mesh")); else bedlevel.invalidate(); break; + #endif // AUTO_BED_LEVELING_UBL } break; @@ -3267,7 +4059,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ if (item == MESHVIEW_BACK) { if (draw) { - Draw_Menu_Item(0, ICON_Back, F("Back")); + Draw_Menu_Item(0, ICON_Back, GET_TEXT_F(MSG_BACK)); mesh_conf.Draw_Bed_Mesh(); mesh_conf.Set_Mesh_Viewer_Status(); } @@ -3294,7 +4086,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case LEVELING_M_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); else { set_bed_leveling_enabled(level_state); TERN_(AUTO_BED_LEVELING_BILINEAR, bedlevel.refresh_bed_level()); @@ -3303,7 +4095,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case LEVELING_M_X: if (draw) { - Draw_Menu_Item(row, ICON_MoveX, F("Mesh Point X")); + Draw_Menu_Item(row, ICON_MoveX, GET_TEXT_F(MSG_MESH_X)); Draw_Float(mesh_conf.mesh_x, row, 0, 1); } else @@ -3311,7 +4103,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case LEVELING_M_Y: if (draw) { - Draw_Menu_Item(row, ICON_MoveY, F("Mesh Point Y")); + Draw_Menu_Item(row, ICON_MoveY, GET_TEXT_F(MSG_MESH_Y)); Draw_Float(mesh_conf.mesh_y, row, 0, 1); } else @@ -3319,15 +4111,15 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case LEVELING_M_NEXT: if (draw) - Draw_Menu_Item(row, ICON_More, F("Next Point")); + Draw_Menu_Item(row, ICON_More, GET_TEXT_F(MSG_LEVEL_BED_NEXT_POINT)); else { if (mesh_conf.mesh_x != (GRID_MAX_POINTS_X - 1) || mesh_conf.mesh_y != (GRID_MAX_POINTS_Y - 1)) { - if ((mesh_conf.mesh_x == (GRID_MAX_POINTS_X - 1) && mesh_conf.mesh_y % 2 == 0) || (mesh_conf.mesh_x == 0 && mesh_conf.mesh_y % 2 == 1)) + if ((mesh_conf.mesh_x == (GRID_MAX_POINTS_X - 1) && !(mesh_conf.mesh_y & 1)) || (!mesh_conf.mesh_x && (mesh_conf.mesh_y & 1))) mesh_conf.mesh_y++; - else if (mesh_conf.mesh_y % 2 == 0) - mesh_conf.mesh_x++; - else + else if (mesh_conf.mesh_y & 1) mesh_conf.mesh_x--; + else + mesh_conf.mesh_x++; mesh_conf.manual_mesh_move(); } } @@ -3407,7 +4199,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case UBL_M_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); else { set_bed_leveling_enabled(level_state); Draw_Menu(Leveling, LEVELING_GET_MESH); @@ -3416,18 +4208,18 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ case UBL_M_NEXT: if (draw) { if (mesh_conf.mesh_x != (GRID_MAX_POINTS_X - 1) || mesh_conf.mesh_y != (GRID_MAX_POINTS_Y - 1)) - Draw_Menu_Item(row, ICON_More, F("Next Point")); + Draw_Menu_Item(row, ICON_More, GET_TEXT_F(MSG_LEVEL_BED_NEXT_POINT)); else - Draw_Menu_Item(row, ICON_More, F("Save Mesh")); + Draw_Menu_Item(row, ICON_More, GET_TEXT_F(MSG_UBL_SAVE_MESH)); } else { if (mesh_conf.mesh_x != (GRID_MAX_POINTS_X - 1) || mesh_conf.mesh_y != (GRID_MAX_POINTS_Y - 1)) { - if ((mesh_conf.mesh_x == (GRID_MAX_POINTS_X - 1) && mesh_conf.mesh_y % 2 == 0) || (mesh_conf.mesh_x == 0 && mesh_conf.mesh_y % 2 == 1)) + if ((mesh_conf.mesh_x == (GRID_MAX_POINTS_X - 1) && !(mesh_conf.mesh_y & 1)) || (!mesh_conf.mesh_x && (mesh_conf.mesh_y & 1))) mesh_conf.mesh_y++; - else if (mesh_conf.mesh_y % 2 == 0) - mesh_conf.mesh_x++; - else + else if (mesh_conf.mesh_y & 1) mesh_conf.mesh_x--; + else + mesh_conf.mesh_x++; mesh_conf.manual_mesh_move(); } else { @@ -3443,12 +4235,12 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ Draw_Menu_Item(row, ICON_More, F("Previous Point")); else { if (mesh_conf.mesh_x != 0 || mesh_conf.mesh_y != 0) { - if ((mesh_conf.mesh_x == (GRID_MAX_POINTS_X - 1) && mesh_conf.mesh_y % 2 == 1) || (mesh_conf.mesh_x == 0 && mesh_conf.mesh_y % 2 == 0)) + if ((mesh_conf.mesh_x == (GRID_MAX_POINTS_X - 1) && (mesh_conf.mesh_y & 1)) || (!mesh_conf.mesh_x && !(mesh_conf.mesh_y & 1))) mesh_conf.mesh_y--; - else if (mesh_conf.mesh_y % 2 == 0) - mesh_conf.mesh_x--; - else + else if (mesh_conf.mesh_y & 1) mesh_conf.mesh_x++; + else + mesh_conf.mesh_x--; mesh_conf.manual_mesh_move(); } } @@ -3506,7 +4298,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case MMESH_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Cancel")); + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BUTTON_CANCEL)); else { gcode.process_subcommands_now(F("G29 A")); planner.synchronize(); @@ -3516,16 +4308,16 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case MMESH_NEXT: if (draw) { - if (gridpoint < GRID_MAX_POINTS) - Draw_Menu_Item(row, ICON_More, F("Next Point")); + if (temp_val.gridpoint < GRID_MAX_POINTS) + Draw_Menu_Item(row, ICON_More, GET_TEXT_F(MSG_LEVEL_BED_NEXT_POINT)); else - Draw_Menu_Item(row, ICON_More, F("Save Mesh")); + Draw_Menu_Item(row, ICON_More, GET_TEXT_F(MSG_UBL_SAVE_MESH)); } - else if (gridpoint < GRID_MAX_POINTS) { + else if (temp_val.gridpoint < GRID_MAX_POINTS) { Popup_Handler(MoveWait); gcode.process_subcommands_now(F("G29")); planner.synchronize(); - gridpoint++; + temp_val.gridpoint++; Redraw_Menu(); } else { @@ -3569,16 +4361,16 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ case MMESH_OLD: uint8_t mesh_x, mesh_y; // 0,0 -> 1,0 -> 2,0 -> 2,1 -> 1,1 -> 0,1 -> 0,2 -> 1,2 -> 2,2 - mesh_y = (gridpoint - 1) / (GRID_MAX_POINTS_Y); - mesh_x = (gridpoint - 1) % (GRID_MAX_POINTS_X); + mesh_y = (temp_val.gridpoint - 1) / (GRID_MAX_POINTS_Y); + mesh_x = (temp_val.gridpoint - 1) % (GRID_MAX_POINTS_X); - if (mesh_y % 2 == 1) + if (mesh_y & 1) mesh_x = (GRID_MAX_POINTS_X) - mesh_x - 1; const float currval = bedlevel.z_values[mesh_x][mesh_y]; if (draw) { - Draw_Menu_Item(row, ICON_Zoffset, F("Goto Mesh Value")); + Draw_Menu_Item(row, ICON_Zoffset, GET_TEXT_F(MSG_MESH_EDIT_Z)); Draw_Float(currval, row, false, 100); } else if (!isnan(currval)) { @@ -3604,22 +4396,25 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #define TUNE_ZOFFSET (TUNE_FAN + ENABLED(HAS_ZOFFSET_ITEM)) #define TUNE_ZUP (TUNE_ZOFFSET + ENABLED(HAS_ZOFFSET_ITEM)) #define TUNE_ZDOWN (TUNE_ZUP + ENABLED(HAS_ZOFFSET_ITEM)) - #define TUNE_CHANGEFIL (TUNE_ZDOWN + ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)) + #define TUNE_FWRETRACT (TUNE_ZDOWN + ENABLED(FWRETRACT)) + #define TUNE_HOSTACTIONS (TUNE_FWRETRACT + ENABLED(HAS_HOSTACTION_MENUS)) + #define TUNE_CHANGEFIL (TUNE_HOSTACTIONS + ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)) #define TUNE_FILSENSORENABLED (TUNE_CHANGEFIL + ENABLED(FILAMENT_RUNOUT_SENSOR)) #define TUNE_BACKLIGHT_OFF (TUNE_FILSENSORENABLED + 1) #define TUNE_BACKLIGHT (TUNE_BACKLIGHT_OFF + 1) - #define TUNE_TOTAL TUNE_BACKLIGHT + #define TUNE_CASELIGHT (TUNE_BACKLIGHT + ENABLED(CASE_LIGHT_MENU)) + #define TUNE_LEDCONTROL (TUNE_CASELIGHT + (ENABLED(LED_CONTROL_MENU) && DISABLED(CASE_LIGHT_USE_NEOPIXEL))) + #define TUNE_LOCKSCREEN (TUNE_LEDCONTROL + ENABLED(HAS_LOCKSCREEN)) + #define TUNE_TOTAL TUNE_LOCKSCREEN switch (item) { case TUNE_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); - else - Draw_Print_Screen(); + if (draw) Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); + else Draw_Print_Screen(); break; case TUNE_SPEED: if (draw) { - Draw_Menu_Item(row, ICON_Speed, F("Print Speed")); + Draw_Menu_Item(row, ICON_Speed, GET_TEXT_F(MSG_SPEED)); Draw_Float(feedrate_percentage, row, false, 1); } else @@ -3629,7 +4424,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_HOTEND case TUNE_FLOW: if (draw) { - Draw_Menu_Item(row, ICON_Speed, F("Flow Rate")); + Draw_Menu_Item(row, ICON_Speed, GET_TEXT_F(MSG_FLOW)); Draw_Float(planner.flow_percentage[0], row, false, 1); } else @@ -3659,7 +4454,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_FAN case TUNE_FAN: if (draw) { - Draw_Menu_Item(row, ICON_FanSpeed, F("Fan")); + Draw_Menu_Item(row, ICON_FanSpeed, GET_TEXT_F(MSG_FAN_SPEED)); Draw_Float(thermalManager.fan_speed[0], row, false, 1); } else @@ -3671,44 +4466,66 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ case TUNE_ZOFFSET: if (draw) { Draw_Menu_Item(row, ICON_FanSpeed, F("Z-Offset")); - Draw_Float(zoffsetvalue, row, false, 100); + Draw_Float(temp_val.zoffsetvalue, row, false, 100); } else - Modify_Value(zoffsetvalue, MIN_Z_OFFSET, MAX_Z_OFFSET, 100); + Modify_Value(temp_val.zoffsetvalue, MIN_Z_OFFSET, MAX_Z_OFFSET, 100); break; case TUNE_ZUP: if (draw) - Draw_Menu_Item(row, ICON_Axis, F("Z-Offset Up")); - else if (zoffsetvalue < MAX_Z_OFFSET) { - gcode.process_subcommands_now(F("M290 Z0.01")); - zoffsetvalue += 0.01; - Draw_Float(zoffsetvalue, row - 1, false, 100); + Draw_Menu_Item(row, ICON_Axis, F("Z-Offset Up")); + else if (temp_val.zoffsetvalue < MAX_Z_OFFSET) { + gcode.process_subcommands_now(F("M290 Z0.01")); + temp_val.zoffsetvalue += 0.01; + Draw_Float(temp_val.zoffsetvalue, row - 1, false, 100); + } + break; + case TUNE_ZDOWN: + if (draw) + Draw_Menu_Item(row, ICON_AxisD, F("Z-Offset Down")); + else if (temp_val.zoffsetvalue > MIN_Z_OFFSET) { + gcode.process_subcommands_now(F("M290 Z-0.01")); + temp_val.zoffsetvalue -= 0.01; + Draw_Float(temp_val.zoffsetvalue, row - 2, false, 100); + } + break; + #endif + + #if ENABLED(FWRETRACT) + case TUNE_FWRETRACT: + if (draw) + Draw_Menu_Item(row, ICON_StepE, GET_TEXT_F(MSG_AUTORETRACT), nullptr, true); + else { + temp_val.flag_tune = true; + last_pos_selection = selection; + Draw_Menu(FwRetraction); } break; - case TUNE_ZDOWN: + #endif + + #if HAS_HOSTACTION_MENUS + case TUNE_HOSTACTIONS: if (draw) - Draw_Menu_Item(row, ICON_AxisD, F("Z-Offset Down")); - else if (zoffsetvalue > MIN_Z_OFFSET) { - gcode.process_subcommands_now(F("M290 Z-0.01")); - zoffsetvalue -= 0.01; - Draw_Float(zoffsetvalue, row - 2, false, 100); + Draw_Menu_Item(row, ICON_SetHome, F("Host Actions"), nullptr, true); + else { + temp_val.flag_tune = true; + last_pos_selection = selection; + Draw_Menu(HostActions); } break; #endif #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) case TUNE_CHANGEFIL: - if (draw) - Draw_Menu_Item(row, ICON_ResumeEEPROM, F("Change Filament")); - else - Popup_Handler(ConfFilChange); + if (draw) Draw_Menu_Item(row, ICON_ResumeEEPROM, GET_TEXT_F(MSG_FILAMENTCHANGE)); + else Popup_Handler(ConfFilChange); break; #endif #if ENABLED(FILAMENT_RUNOUT_SENSOR) case TUNE_FILSENSORENABLED: if (draw) { - Draw_Menu_Item(row, ICON_Extruder, F("Filament Sensor")); + Draw_Menu_Item(row, ICON_Extruder, GET_TEXT_F(MSG_RUNOUT_SENSOR)); Draw_Checkbox(row, runout.enabled); } else { @@ -3719,106 +4536,138 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #endif case TUNE_BACKLIGHT_OFF: - if (draw) - Draw_Menu_Item(row, ICON_Brightness, F("Display Off")); - else - ui.set_brightness(0); + if (draw) Draw_Menu_Item(row, ICON_Brightness, GET_TEXT_F(MSG_BRIGHTNESS_OFF)); + else ui.set_brightness(0); break; case TUNE_BACKLIGHT: if (draw) { - Draw_Menu_Item(row, ICON_Brightness, F("LCD Brightness")); + Draw_Menu_Item(row, ICON_Brightness, GET_TEXT_F(MSG_BRIGHTNESS)); Draw_Float(ui.brightness, row, false, 1); } else Modify_Value(ui.brightness, LCD_BRIGHTNESS_MIN, LCD_BRIGHTNESS_MAX, 1, ui.refresh_brightness); break; - } - break; - - #if HAS_PREHEAT && HAS_HOTEND - - case PreheatHotend: - - #define PREHEATHOTEND_BACK 0 - #define PREHEATHOTEND_CONTINUE (PREHEATHOTEND_BACK + 1) - #define PREHEATHOTEND_1 (PREHEATHOTEND_CONTINUE + (PREHEAT_COUNT >= 1)) - #define PREHEATHOTEND_2 (PREHEATHOTEND_1 + (PREHEAT_COUNT >= 2)) - #define PREHEATHOTEND_3 (PREHEATHOTEND_2 + (PREHEAT_COUNT >= 3)) - #define PREHEATHOTEND_4 (PREHEATHOTEND_3 + (PREHEAT_COUNT >= 4)) - #define PREHEATHOTEND_5 (PREHEATHOTEND_4 + (PREHEAT_COUNT >= 5)) - #define PREHEATHOTEND_CUSTOM (PREHEATHOTEND_5 + 1) - #define PREHEATHOTEND_TOTAL PREHEATHOTEND_CUSTOM - - switch (item) { - case PREHEATHOTEND_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, F("Cancel")); + #if ENABLED(CASE_LIGHT_MENU) + case TUNE_CASELIGHT: + if (draw) { + Draw_Menu_Item(row, ICON_CaseLight, GET_TEXT_F(MSG_CASE_LIGHT)); + Draw_Checkbox(row, caselight.on); + } else { - thermalManager.setTargetHotend(0, 0); - thermalManager.set_fan_speed(0, 0); - Redraw_Menu(false, true, true); + caselight.on = !caselight.on; + caselight.update_enabled(); + Draw_Checkbox(row, caselight.on); } break; - case PREHEATHOTEND_CONTINUE: - if (draw) - Draw_Menu_Item(row, ICON_SetEndTemp, F("Continue")); + #endif + #if ENABLED(LED_CONTROL_MENU) && DISABLED(CASE_LIGHT_USE_NEOPIXEL) + case TUNE_LEDCONTROL: + if (draw) { + Draw_Menu_Item(row, ICON_LedControl, GET_TEXT_F(MSG_LEDS)); + Draw_Checkbox(row, leds.lights_on); + } else { - Popup_Handler(Heating); - thermalManager.wait_for_hotend(0); - switch (last_menu) { - case Prepare: - Popup_Handler(FilChange); - sprintf_P(cmd, PSTR("M600 B1 R%i"), thermalManager.temp_hotend[0].target); - gcode.process_subcommands_now(cmd); - break; - #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - case ChangeFilament: - switch (last_selection) { - case CHANGEFIL_LOAD: - Popup_Handler(FilLoad); - gcode.process_subcommands_now(F("M701")); - planner.synchronize(); - Redraw_Menu(true, true, true); - break; - case CHANGEFIL_UNLOAD: - Popup_Handler(FilLoad, true); - gcode.process_subcommands_now(F("M702")); - planner.synchronize(); - Redraw_Menu(true, true, true); - break; - case CHANGEFIL_CHANGE: - Popup_Handler(FilChange); - sprintf_P(cmd, PSTR("M600 B1 R%i"), thermalManager.temp_hotend[0].target); - gcode.process_subcommands_now(cmd); - break; - } - break; - #endif - default: - Redraw_Menu(true, true, true); - break; - } + leds.toggle(); + Draw_Checkbox(row, leds.lights_on); } break; + #endif + #if HAS_LOCKSCREEN + case TUNE_LOCKSCREEN: + if (draw) Draw_Menu_Item(row, ICON_Lock, GET_TEXT_F(MSG_LOCKSCREEN)); + else DWIN_LockScreen(); + break; + #endif + } + break; + #if HAS_PREHEAT && HAS_HOTEND + case PreheatHotend: - #define _PREHEAT_HOTEND_CASE(N) \ - case PREHEATHOTEND_##N: \ - if (draw) Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_## N ##_LABEL)); \ - else ui.preheat_hotend_and_fan((N) - 1); \ + #define PREHEATHOTEND_BACK 0 + #define PREHEATHOTEND_CONTINUE (PREHEATHOTEND_BACK + 1) + #define PREHEATHOTEND_1 (PREHEATHOTEND_CONTINUE + (PREHEAT_COUNT >= 1)) + #define PREHEATHOTEND_2 (PREHEATHOTEND_1 + (PREHEAT_COUNT >= 2)) + #define PREHEATHOTEND_3 (PREHEATHOTEND_2 + (PREHEAT_COUNT >= 3)) + #define PREHEATHOTEND_4 (PREHEATHOTEND_3 + (PREHEAT_COUNT >= 4)) + #define PREHEATHOTEND_5 (PREHEATHOTEND_4 + (PREHEAT_COUNT >= 5)) + #define PREHEATHOTEND_CUSTOM (PREHEATHOTEND_5 + 1) + #define PREHEATHOTEND_TOTAL PREHEATHOTEND_CUSTOM + + switch (item) { + case PREHEATHOTEND_BACK: + if (draw) + Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BUTTON_CANCEL)); + else { + thermalManager.setTargetHotend(0, 0); + thermalManager.set_fan_speed(0, 0); + Redraw_Menu(false, true, true); + } + break; + case PREHEATHOTEND_CONTINUE: + if (draw) + Draw_Menu_Item(row, ICON_SetEndTemp, GET_TEXT_F(MSG_BUTTON_CONTINUE)); + else { + Popup_Handler(Heating); + thermalManager.wait_for_hotend(0); + switch (last_menu) { + case Prepare: + Popup_Handler(FilChange); + sprintf_P(cmd, PSTR("M600 B1 R%i"), thermalManager.temp_hotend[0].target); + gcode.process_subcommands_now(cmd); + Draw_Menu(Prepare, PREPARE_CHANGEFIL); + break; + #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) + case ChangeFilament: + switch (last_selection) { + case CHANGEFIL_LOAD: + Popup_Handler(FilLoad); + Update_Status(GET_TEXT(MSG_FILAMENTLOAD)); + gcode.process_subcommands_now(F("M701")); + planner.synchronize(); + Draw_Menu(ChangeFilament, CHANGEFIL_LOAD); + break; + case CHANGEFIL_UNLOAD: + Popup_Handler(FilLoad, true); + Update_Status(GET_TEXT(MSG_FILAMENTUNLOAD)); + gcode.process_subcommands_now(F("M702")); + planner.synchronize(); + Draw_Menu(ChangeFilament, CHANGEFIL_UNLOAD); + break; + case CHANGEFIL_CHANGE: + Popup_Handler(FilChange); + Update_Status(GET_TEXT(MSG_FILAMENTCHANGE)); + sprintf_P(cmd, PSTR("M600 B1 R%i"), thermalManager.temp_hotend[0].target); + gcode.process_subcommands_now(cmd); + Draw_Menu(ChangeFilament, CHANGEFIL_CHANGE); + break; + } + break; + #endif + default: + Redraw_Menu(true, true, true); + break; + } + } break; - REPEAT_1(PREHEAT_COUNT, _PREHEAT_HOTEND_CASE) + #define _PREHEAT_HOTEND_CASE(N) \ + case PREHEATHOTEND_##N: \ + if (draw) Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_## N ##_LABEL)); \ + else ui.preheat_hotend_and_fan((N) - 1); \ + break; - case PREHEATHOTEND_CUSTOM: - if (draw) { - Draw_Menu_Item(row, ICON_Temperature, F("Custom")); - Draw_Float(thermalManager.temp_hotend[0].target, row, false, 1); - } - else - Modify_Value(thermalManager.temp_hotend[0].target, EXTRUDE_MINTEMP, MAX_E_TEMP, 1); - break; - } + REPEAT_1(PREHEAT_COUNT, _PREHEAT_HOTEND_CASE) + + case PREHEATHOTEND_CUSTOM: + if (draw) { + Draw_Menu_Item(row, ICON_Temperature, GET_TEXT_F(MSG_PREHEAT_CUSTOM)); + Draw_Float(thermalManager.temp_hotend[0].target, row, false, 1); + } + else + Modify_Value(thermalManager.temp_hotend[0].target, EXTRUDE_MINTEMP, MAX_E_TEMP, 1); + break; + } break; #endif // HAS_PREHEAT && HAS_HOTEND @@ -3827,11 +4676,11 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ FSTR_P CrealityDWINClass::Get_Menu_Title(uint8_t menu) { switch (menu) { - case MainMenu: return F("Main Menu"); - case Prepare: return F("Prepare"); - case HomeMenu: return F("Homing Menu"); - case Move: return F("Move"); - case ManualLevel: return F("Manual Leveling"); + case MainMenu: return GET_TEXT_F(MSG_MAIN); + case Prepare: return GET_TEXT_F(MSG_PREPARE); + case HomeMenu: return GET_TEXT_F(MSG_HOMING); + case Move: return GET_TEXT_F(MSG_MOVE_AXIS); + case ManualLevel: return GET_TEXT_F(MSG_BED_TRAMMING_MANUAL); #if HAS_ZOFFSET_ITEM case ZOffset: return F("Z Offset"); #endif @@ -3839,7 +4688,10 @@ FSTR_P CrealityDWINClass::Get_Menu_Title(uint8_t menu) { case Preheat: return F("Preheat"); #endif #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - case ChangeFilament: return F("Change Filament"); + case ChangeFilament: return GET_TEXT_F(MSG_FILAMENTCHANGE); + #endif + #if HAS_HOSTACTION_MENUS + case HostActions: return F("Host Actions"); #endif #if HAS_CUSTOM_MENU case MenuCustom: @@ -3849,8 +4701,8 @@ FSTR_P CrealityDWINClass::Get_Menu_Title(uint8_t menu) { return F("Custom Commands"); #endif #endif - case Control: return F("Control"); - case TempMenu: return F("Temperature"); + case Control: return GET_TEXT_F(MSG_CONTROL); + case TempMenu: return GET_TEXT_F(MSG_TEMPERATURE); #if HAS_HOTEND || HAS_HEATED_BED case PID: return F("PID Menu"); #endif @@ -3865,36 +4717,62 @@ FSTR_P CrealityDWINClass::Get_Menu_Title(uint8_t menu) { REPEAT_1(PREHEAT_COUNT, _PREHEAT_TITLE_CASE) #endif case Motion: return F("Motion Settings"); - case HomeOffsets: return F("Home Offsets"); - case MaxSpeed: return F("Max Speed"); - case MaxAcceleration: return F("Max Acceleration"); + #if ENABLED(FWRETRACT) + case FwRetraction: return F("Firmware Retract"); + #endif + case HomeOffsets: return GET_TEXT_F(MSG_SET_HOME_OFFSETS); + case MaxSpeed: return GET_TEXT_F(MSG_SPEED); + case MaxAcceleration: return GET_TEXT_F(MSG_ACCELERATION); #if HAS_CLASSIC_JERK - case MaxJerk: return F("Max Jerk"); + case MaxJerk: return GET_TEXT_F(MSG_JERK); + #endif + #if HAS_JUNCTION_DEVIATION + case JDmenu: return GET_TEXT_F(MSG_JUNCTION_DEVIATION); #endif - case Steps: return F("Steps/mm"); + case Steps: return GET_TEXT_F(MSG_STEPS_PER_MM); case Visual: return F("Visual Settings"); - case Advanced: return F("Advanced Settings"); + #if HAS_HOSTACTION_MENUS + case HostSettings: return F("Host Settings"); + case ActionCommands: return F("Host Actions"); + #endif + case Advanced: return GET_TEXT_F(MSG_ADVANCED_SETTINGS); #if HAS_BED_PROBE - case ProbeMenu: return F("Probe Menu"); + case ProbeMenu: return GET_TEXT_F(MSG_ZPROBE_SETTINGS); #endif case ColorSettings: return F("UI Color Settings"); - case Info: return F("Info"); - case InfoMain: return F("Info"); + case Info: + case InfoMain: return GET_TEXT_F(MSG_INFO_SCREEN); #if HAS_MESH - case Leveling: return F("Leveling"); + case Leveling: return GET_TEXT_F(MSG_BED_LEVELING); case LevelView: return GET_TEXT_F(MSG_MESH_VIEW); case LevelSettings: return F("Leveling Settings"); case MeshViewer: return GET_TEXT_F(MSG_MESH_VIEW); - case LevelManual: return F("Manual Tuning"); + case LevelManual: return GET_TEXT_F(MSG_UBL_FINE_TUNE_MESH); #endif #if ENABLED(AUTO_BED_LEVELING_UBL) && !HAS_BED_PROBE - case UBLMesh: return F("UBL Bed Leveling"); + case UBLMesh: return GET_TEXT_F(MSG_UBL_LEVEL_BED); #endif #if ENABLED(PROBE_MANUALLY) - case ManualMesh: return F("Mesh Bed Leveling"); + case ManualMesh: return GET_TEXT_F(MSG_MESH_LEVELING); #endif - case Tune: return F("Tune"); + case Tune: return GET_TEXT_F(MSG_TUNE); case PreheatHotend: return F("Preheat Hotend"); + #if ANY(CASE_LIGHT_MENU, LED_CONTROL_MENU) + case Ledsmenu: return F("Light Settings"); + #if ENABLED(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS) + case CaseLightmenu: return GET_TEXT_F(MSG_CASE_LIGHT); + #endif + #if ENABLED(LED_CONTROL_MENU) + case LedControlmenu: return GET_TEXT_F(MSG_LED_CONTROL); + #if HAS_COLOR_LEDS + #if ENABLED(LED_COLOR_PRESETS) + case LedControlpresets: return GET_TEXT_F(MSG_LED_PRESETS); + #else + case LedControlcustom: return GET_TEXT_F(MSG_CUSTOM_LEDS); + #endif + #endif + #endif + #endif } return F(""); } @@ -3914,6 +4792,9 @@ uint8_t CrealityDWINClass::Get_Menu_Size(uint8_t menu) { #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) case ChangeFilament: return CHANGEFIL_TOTAL; #endif + #if HAS_HOSTACTION_MENUS + case HostActions: return HOSTACTIONS_TOTAL; + #endif #if HAS_CUSTOM_MENU case MenuCustom: return CUSTOM_MENU_TOTAL; #endif @@ -3933,14 +4814,24 @@ uint8_t CrealityDWINClass::Get_Menu_Size(uint8_t menu) { return PREHEAT_SUBMENU_TOTAL; #endif case Motion: return MOTION_TOTAL; + #if ENABLED(FWRETRACT) + case FwRetraction: return FWR_TOTAL; + #endif case HomeOffsets: return HOMEOFFSETS_TOTAL; case MaxSpeed: return SPEED_TOTAL; case MaxAcceleration: return ACCEL_TOTAL; #if HAS_CLASSIC_JERK case MaxJerk: return JERK_TOTAL; #endif + #if HAS_JUNCTION_DEVIATION + case JDmenu: return JD_TOTAL; + #endif case Steps: return STEPS_TOTAL; case Visual: return VISUAL_TOTAL; + #if HAS_HOSTACTION_MENUS + case HostSettings: return HOSTSETTINGS_TOTAL; + case ActionCommands: return ACTIONCOMMANDS_TOTAL; + #endif case Advanced: return ADVANCED_TOTAL; #if HAS_BED_PROBE case ProbeMenu: return PROBE_TOTAL; @@ -3967,6 +4858,22 @@ uint8_t CrealityDWINClass::Get_Menu_Size(uint8_t menu) { #endif case ColorSettings: return COLORSETTINGS_TOTAL; + #if ANY(CASE_LIGHT_MENU, LED_CONTROL_MENU) + case Ledsmenu: return LEDS_TOTAL; + #if ENABLED(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS) + case CaseLightmenu: return CASE_LIGHT_TOTAL; + #endif + #if ENABLED(LED_CONTROL_MENU) + case LedControlmenu: return LEDCONTROL_TOTAL; + #if HAS_COLOR_LEDS + #if ENABLED(LED_COLOR_PRESETS) + case LedControlpresets: return LEDCONTROL_PRESETS_TOTAL; + #else + case LedControlcustom: return LEDCONTROL_CUSTOM_TOTAL; + #endif + #endif + #endif + #endif } return 0; } @@ -3976,36 +4883,42 @@ uint8_t CrealityDWINClass::Get_Menu_Size(uint8_t menu) { void CrealityDWINClass::Popup_Handler(PopupID popupid, bool option/*=false*/) { popup = last_popup = popupid; switch (popupid) { - case Pause: Draw_Popup(F("Pause Print"), F(""), F(""), Popup); break; - case Stop: Draw_Popup(F("Stop Print"), F(""), F(""), Popup); break; - case Resume: Draw_Popup(F("Resume Print?"), F("Looks Like the last"), F("print was interrupted."), Popup); break; + case Pause: Draw_Popup(GET_TEXT_F(MSG_PAUSE_PRINT), F(""), F(""), Popup); break; + case Stop: Draw_Popup(GET_TEXT_F(MSG_STOP_PRINT), F(""), F(""), Popup); break; + case Resume: Draw_Popup(GET_TEXT_F(MSG_RESUME_PRINT), F("Looks Like the last"), F("print was interrupted."), Popup); break; case ConfFilChange: Draw_Popup(F("Confirm Filament Change"), F(""), F(""), Popup); break; case PurgeMore: Draw_Popup(F("Purge more filament?"), F("(Cancel to finish process)"), F(""), Popup); break; case SaveLevel: Draw_Popup(F("Leveling Complete"), F("Save to EEPROM?"), F(""), Popup); break; case MeshSlot: Draw_Popup(F("Mesh slot not selected"), F("(Confirm to select slot 0)"), F(""), Popup); break; - case ETemp: Draw_Popup(F("Nozzle is too cold"), F("Open Preheat Menu?"), F(""), Popup); break; + case ETemp: Draw_Popup(GET_TEXT_F(MSG_HOTEND_TOO_COLD), GET_TEXT_F(MSG_PLEASE_PREHEAT), F(""), Popup); break; case ManualProbing: Draw_Popup(F("Manual Probing"), F("(Confirm to probe)"), F("(cancel to exit)"), Popup); break; - case Level: Draw_Popup(F("Auto Bed Leveling"), F("Please wait until done."), F(""), Wait, ICON_AutoLeveling); break; - case Home: Draw_Popup(option ? F("Parking") : F("Homing"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break; - case MoveWait: Draw_Popup(F("Moving to Point"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break; - case Heating: Draw_Popup(F("Heating"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break; - case FilLoad: Draw_Popup(option ? F("Unloading Filament") : F("Loading Filament"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break; + case Level: Draw_Popup(F("Auto Bed Leveling"), GET_TEXT_F(MSG_PLEASE_WAIT), F(""), Wait, ICON_AutoLeveling); break; + case Home: Draw_Popup(option ? GET_TEXT_F(MSG_PAUSE_PRINT_PARKING) : GET_TEXT_F(MSG_HOMING), GET_TEXT_F(MSG_PLEASE_WAIT), F(""), Wait, ICON_BLTouch); break; + case MoveWait: Draw_Popup(GET_TEXT_F(MSG_MOVING), GET_TEXT_F(MSG_PLEASE_WAIT), F(""), Wait, ICON_BLTouch); break; + case Heating: Draw_Popup(GET_TEXT_F(MSG_HEATING), GET_TEXT_F(MSG_PLEASE_WAIT), F(""), Wait, ICON_BLTouch); break; + case FilLoad: Draw_Popup(option ? F("Unloading Filament") : F("Loading Filament"), GET_TEXT_F(MSG_PLEASE_WAIT), F(""), Wait, ICON_BLTouch); break; case FilChange: Draw_Popup(F("Filament Change"), F("Please wait for prompt."), F(""), Wait, ICON_BLTouch); break; - case TempWarn: Draw_Popup(option ? F("Nozzle temp too low!") : F("Nozzle temp too high!"), F(""), F(""), Wait, option ? ICON_TempTooLow : ICON_TempTooHigh); break; + case TempWarn: Draw_Popup(option ? GET_TEXT_F(MSG_HOTEND_TOO_COLD) : F("Nozzle temp too high!"), F(""), F(""), Wait, option ? ICON_TempTooLow : ICON_TempTooHigh); break; case Runout: Draw_Popup(F("Filament Runout"), F(""), F(""), Wait, ICON_BLTouch); break; - case PIDWait: Draw_Popup(F("PID Autotune"), F("in process"), F("Please wait until done."), Wait, ICON_BLTouch); break; - case Resuming: Draw_Popup(F("Resuming Print"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break; - case Custom: Draw_Popup(F("Running Custom GCode"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break; + #if !HAS_PIDPLOT + case PIDWait: Draw_Popup(F("PID Autotune"), F("in process"), GET_TEXT_F(MSG_PLEASE_WAIT), Wait, ICON_BLTouch); break; + #endif + case Resuming: Draw_Popup(F("Resuming Print"), GET_TEXT_F(MSG_PLEASE_WAIT), F(""), Wait, ICON_BLTouch); break; + #if HAS_CUSTOM_MENU + case Custom: Draw_Popup(F("Running Custom GCode"), GET_TEXT_F(MSG_PLEASE_WAIT), F(""), Wait, ICON_BLTouch); break; + #endif + case PrintConfirm: Draw_Popup(option ? F("") : F("Print file?"), F(""), F(""), Popup); break; default: break; } } -void CrealityDWINClass::Confirm_Handler(PopupID popupid) { +void CrealityDWINClass::Confirm_Handler(PopupID popupid, bool option/*=false*/) { popup = popupid; switch (popupid) { case FilInsert: Draw_Popup(F("Insert Filament"), F("Press to Continue"), F(""), Confirm); break; - case HeaterTime: Draw_Popup(F("Heater Timed Out"), F("Press to Reheat"), F(""), Confirm); break; - case UserInput: Draw_Popup(F("Waiting for Input"), F("Press to Continue"), F(""), Confirm); break; + case HeaterTime: Draw_Popup(GET_TEXT_F(MSG_HEATER_TIMEOUT), GET_TEXT_F(MSG_FILAMENT_CHANGE_HEAT), F(""), Confirm); break; + case UserInput: Draw_Popup(option ? GET_TEXT_F(MSG_STOPPED) : F("Waiting for Input"), GET_TEXT_F(MSG_ADVANCED_PAUSE_WAITING), F(""), Confirm); break; + case Level: Draw_Popup(F("Bed Leveling"), GET_TEXT_F(MSG_PLEASE_WAIT), F(""), Cancel, ICON_AutoLeveling); break; case LevelError: Draw_Popup(F("Couldn't enable Leveling"), F("(Valid mesh must exist)"), F(""), Confirm); break; case InvalidMesh: Draw_Popup(F("Valid mesh must exist"), F("before tuning can be"), F("performed"), Confirm); break; default: break; @@ -4039,24 +4952,24 @@ void CrealityDWINClass::Menu_Control() { EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; if (encoder_diffState == ENCODER_DIFF_CW && selection < Get_Menu_Size(active_menu)) { - DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); + DWIN_Draw_Rectangle(1, Def_Background_Color, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); selection++; // Select Down if (selection > scrollpos+MROWS) { scrollpos++; - DWIN_Frame_AreaMove(1, 2, MLINE, Color_Bg_Black, 0, 31, DWIN_WIDTH, 349); + DWIN_Frame_AreaMove(1, 2, MLINE, Def_Background_Color, 0, 31, DWIN_WIDTH, 349); Menu_Item_Handler(active_menu, selection); } - DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.cursor_color, Rectangle_Color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); + DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.cursor_color, Def_Cursor_color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); } else if (encoder_diffState == ENCODER_DIFF_CCW && selection > 0) { - DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); + DWIN_Draw_Rectangle(1, Def_Background_Color, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); selection--; // Select Up if (selection < scrollpos) { scrollpos--; - DWIN_Frame_AreaMove(1, 3, MLINE, Color_Bg_Black, 0, 31, DWIN_WIDTH, 349); + DWIN_Frame_AreaMove(1, 3, MLINE, Def_Background_Color, 0, 31, DWIN_WIDTH, 349); Menu_Item_Handler(active_menu, selection); } - DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.cursor_color, Rectangle_Color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); + DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.cursor_color, Def_Cursor_color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); } else if (encoder_diffState == ENCODER_DIFF_ENTER) Menu_Item_Handler(active_menu, selection, false); @@ -4065,25 +4978,32 @@ void CrealityDWINClass::Menu_Control() { void CrealityDWINClass::Value_Control() { EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); + float difvalue = 0; if (encoder_diffState == ENCODER_DIFF_NO) return; - if (encoder_diffState == ENCODER_DIFF_CW) + if (encoder_diffState == ENCODER_DIFF_CW) { tempvalue += EncoderRate.encoderMoveValue; - else if (encoder_diffState == ENCODER_DIFF_CCW) + difvalue = EncoderRate.encoderMoveValue; + } + else if (encoder_diffState == ENCODER_DIFF_CCW) { tempvalue -= EncoderRate.encoderMoveValue; + difvalue = - EncoderRate.encoderMoveValue; + } else if (encoder_diffState == ENCODER_DIFF_ENTER) { process = Menu; EncoderRate.enabled = false; Draw_Float(tempvalue / valueunit, selection - scrollpos, false, valueunit); DWIN_UpdateLCD(); - if (active_menu == ZOffset && liveadjust) { + if (active_menu == ZOffset && temp_val.zoffsetmode != 0) { planner.synchronize(); - current_position.z += (tempvalue / valueunit - zoffsetvalue); - planner.buffer_line(current_position, homing_feedrate(Z_AXIS), active_extruder); + if (temp_val.zoffsetmode == 1) { + current_position.z += (tempvalue / valueunit - temp_val.zoffsetvalue); + planner.buffer_line(current_position, homing_feedrate(Z_AXIS), active_extruder); + } current_position.z = 0; sync_plan_position(); } else if (active_menu == Tune && selection == TUNE_ZOFFSET) { - sprintf_P(cmd, PSTR("M290 Z%s"), dtostrf((tempvalue / valueunit - zoffsetvalue), 1, 3, str_1)); + sprintf_P(cmd, PSTR("M290 Z%s"), dtostrf((tempvalue / valueunit - temp_val.zoffsetvalue), 1, 3, str_1)); gcode.process_subcommands_now(cmd); } if (TERN0(HAS_HOTEND, valuepointer == &thermalManager.temp_hotend[0].pid.Ki) || TERN0(HAS_HEATED_BED, valuepointer == &thermalManager.temp_bed.pid.Ki)) @@ -4104,17 +5024,33 @@ void CrealityDWINClass::Value_Control() { planner.buffer_line(current_position, manual_feedrate_mm_s[selection - 1], active_extruder); break; #if HAS_MESH - case ManualMesh: - planner.synchronize(); - planner.buffer_line(current_position, homing_feedrate(Z_AXIS), active_extruder); - planner.synchronize(); - break; - case UBLMesh: mesh_conf.manual_mesh_move(true); break; + #if ENABLED(PROBE_MANUALLY) + case ManualMesh: + planner.synchronize(); + planner.buffer_line(current_position, homing_feedrate(Z_AXIS), active_extruder); + planner.synchronize(); + break; + #endif + #if ENABLED(AUTO_BED_LEVELING_UBL) && !HAS_BED_PROBE + case UBLMesh: mesh_conf.manual_mesh_move(true); break; + #endif case LevelManual: mesh_conf.manual_mesh_move(selection == LEVELING_M_OFFSET); break; #endif } if (valuepointer == &planner.flow_percentage[0]) planner.refresh_e_factor(0); + #if ENABLED(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS) + if (valuepointer == &caselight.brightness) + caselight.update_brightness(); + #endif + #if HAS_COLOR_LEDS + if ((valuepointer == &leds.color.r) || (valuepointer == &leds.color.g) || (valuepointer == &leds.color.b)) + ApplyLEDColor(); + #if HAS_WHITE_LED + if (valuepointer == &leds.color.w) ApplyLEDColor(); + #endif + #endif + if (funcpointer) funcpointer(); return; } @@ -4122,9 +5058,48 @@ void CrealityDWINClass::Value_Control() { NOMORE(tempvalue, (valuemax * valueunit)); Draw_Float(tempvalue / valueunit, selection - scrollpos, true, valueunit); DWIN_UpdateLCD(); - if (active_menu == Move && livemove) { - *(float*)valuepointer = tempvalue / valueunit; - planner.buffer_line(current_position, manual_feedrate_mm_s[selection - 1], active_extruder); + + if (valuepointer == &ui.brightness) { + *(uint8_t*)valuepointer = tempvalue / valueunit; + ui.refresh_brightness(); + } + + switch (active_menu) { + case Move: + if (temp_val.livemove) { + *(float*)valuepointer = tempvalue / valueunit; + planner.buffer_line(current_position, manual_feedrate_mm_s[selection - 1], active_extruder); + } + break; + case ZOffset: + if (temp_val.zoffsetmode == 2) { + planner.synchronize(); + sprintf_P(cmd, PSTR("M290 Z%s"), dtostrf((difvalue / valueunit), 1, 3, str_1)); + gcode.process_subcommands_now(cmd); + planner.synchronize(); + } + break; + case Tune: + if (selection == TUNE_ZOFFSET) { + planner.synchronize(); + sprintf_P(cmd, PSTR("M290 Z%s"), dtostrf((difvalue / valueunit), 1, 3, str_1)); + gcode.process_subcommands_now(cmd); + planner.synchronize(); + } + break; + #if ENABLED(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS) + case CaseLightmenu: + *(uint8_t*)valuepointer = tempvalue / valueunit; + caselight.update_brightness(); + break; + #endif + #if ENABLED(LED_CONTROL_MENU, HAS_COLOR_LEDS) + case LedControlmenu: + *(uint8_t*)valuepointer = tempvalue / valueunit; + leds.update(); + break; + #endif + default : break; } } @@ -4155,7 +5130,37 @@ void CrealityDWINClass::Option_Control() { Redraw_Screen(); } else if (valuepointer == &preheat_modes) - preheatmode = tempvalue; + temp_val.preheatmode = tempvalue; + #if ENABLED(PREHEAT_BEFORE_LEVELING) + else if (valuepointer == &preheat_levmodes) { + temp_val.LevelingTempmode = tempvalue; + eeprom_settings.ena_hotend_levtemp = false; + eeprom_settings.ena_bed_levtemp = false; + if (temp_val.LevelingTempmode == 0 || temp_val.LevelingTempmode == 1) eeprom_settings.ena_hotend_levtemp = true; + if (temp_val.LevelingTempmode == 0 || temp_val.LevelingTempmode == 2) eeprom_settings.ena_bed_levtemp = true; + } + #endif + else if (valuepointer == &zoffset_modes) { + temp_val.zoffsetmode = tempvalue; + if (temp_val.zoffsetmode == 1 || temp_val.zoffsetmode == 2) { + if (axes_should_home()) { + Popup_Handler(Home); + gcode.home_all_axes(true); + } + Popup_Handler(MoveWait); + #if ENABLED(Z_SAFE_HOMING) + planner.synchronize(); + sprintf_P(cmd, PSTR("G0 F4000 X%s Y%s"), dtostrf(Z_SAFE_HOMING_X_POINT, 1, 3, str_1), dtostrf(Z_SAFE_HOMING_Y_POINT, 1, 3, str_2)); + gcode.process_subcommands_now(cmd); + #else + sprintf_P(cmd, PSTR("G0 F4000 X%s Y%s"), dtostrf((X_BED_SIZE + X_MIN_POS) / 2.0f, 1, 3, str_1), dtostrf((Y_BED_SIZE + Y_MIN_POS) / 2.0f, 1, 3, str_2)); + gcode.process_subcommands_now(cmd); + #endif + gcode.process_subcommands_now(F("G0 F300 Z0")); + planner.synchronize(); + Redraw_Menu(); + } + } Draw_Option(tempvalue, static_cast(valuepointer), selection - scrollpos, false, (valuepointer == &color_names)); DWIN_UpdateLCD(); @@ -4193,7 +5198,7 @@ void CrealityDWINClass::File_Control() { LOOP_S_L_N(i, MENU_CHAR_LIMIT + pos, MENU_CHAR_LIMIT) name[i] = filename[i - (MENU_CHAR_LIMIT + pos)]; } name[len] = '\0'; - DWIN_Draw_Rectangle(1, Color_Bg_Black, LBLX, MBASE(selection - scrollpos) - 14, 271, MBASE(selection - scrollpos) + 28); + DWIN_Draw_Rectangle(1, Def_Background_Color, LBLX, MBASE(selection - scrollpos) - 14, 271, MBASE(selection - scrollpos) + 28); Draw_Menu_Item(selection - scrollpos, card.flag.filenameIsDir ? ICON_More : ICON_File, name); if (-pos >= MENU_CHAR_LIMIT) filescrl = 0; filescrl++; @@ -4203,32 +5208,32 @@ void CrealityDWINClass::File_Control() { return; } if (encoder_diffState == ENCODER_DIFF_CW && selection < card.get_num_Files()) { - DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); + DWIN_Draw_Rectangle(1, Def_Background_Color, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); if (selection > 0) { - DWIN_Draw_Rectangle(1, Color_Bg_Black, LBLX, MBASE(selection - scrollpos) - 14, 271, MBASE(selection - scrollpos) + 28); + DWIN_Draw_Rectangle(1, Def_Background_Color, LBLX, MBASE(selection - scrollpos) - 14, 271, MBASE(selection - scrollpos) + 28); Draw_SD_Item(selection, selection - scrollpos); } filescrl = 0; selection++; // Select Down if (selection > scrollpos + MROWS) { scrollpos++; - DWIN_Frame_AreaMove(1, 2, MLINE, Color_Bg_Black, 0, 31, DWIN_WIDTH, 349); + DWIN_Frame_AreaMove(1, 2, MLINE, Def_Background_Color, 0, 31, DWIN_WIDTH, 349); Draw_SD_Item(selection, selection - scrollpos); } - DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.cursor_color, Rectangle_Color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); + DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.cursor_color, Def_Cursor_color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); } else if (encoder_diffState == ENCODER_DIFF_CCW && selection > 0) { - DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); - DWIN_Draw_Rectangle(1, Color_Bg_Black, LBLX, MBASE(selection - scrollpos) - 14, 271, MBASE(selection - scrollpos) + 28); + DWIN_Draw_Rectangle(1, Def_Background_Color, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); + DWIN_Draw_Rectangle(1, Def_Background_Color, LBLX, MBASE(selection - scrollpos) - 14, 271, MBASE(selection - scrollpos) + 28); Draw_SD_Item(selection, selection - scrollpos); filescrl = 0; selection--; // Select Up if (selection < scrollpos) { scrollpos--; - DWIN_Frame_AreaMove(1, 3, MLINE, Color_Bg_Black, 0, 31, DWIN_WIDTH, 349); + DWIN_Frame_AreaMove(1, 3, MLINE, Def_Background_Color, 0, 31, DWIN_WIDTH, 349); Draw_SD_Item(selection, selection - scrollpos); } - DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.cursor_color, Rectangle_Color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); + DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.cursor_color, Def_Cursor_color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); } else if (encoder_diffState == ENCODER_DIFF_ENTER) { if (selection == 0) { @@ -4248,7 +5253,11 @@ void CrealityDWINClass::File_Control() { Draw_SD_List(); } else { - card.openAndPrintFile(card.filename); + #if HAS_GCODE_PREVIEW + Preview_DrawFromSD(); + #else + card.openAndPrintFile(card.filename); + #endif } } } @@ -4273,8 +5282,8 @@ void CrealityDWINClass::Print_Screen_Control() { Update_Status_Bar(true); break; case PRINT_PAUSE_RESUME: - if (paused) { - if (sdprint) { + if (temp_val.paused) { + if (temp_val.sdprint) { wait_for_user = false; #if ENABLED(PARK_HEAD_ON_PAUSE) card.startOrResumeFilePrinting(); @@ -4282,14 +5291,14 @@ void CrealityDWINClass::Print_Screen_Control() { #else char cmd[20]; #if HAS_HEATED_BED - sprintf_P(cmd, PSTR("M140 S%i"), pausebed); + sprintf_P(cmd, PSTR("M140 S%i"), temp_val.pausebed); gcode.process_subcommands_now(cmd); #endif #if HAS_EXTRUDERS - sprintf_P(cmd, PSTR("M109 S%i"), pausetemp); + sprintf_P(cmd, PSTR("M109 S%i"), temp_val.pausetemp); gcode.process_subcommands_now(cmd); #endif - TERN_(HAS_FAN, thermalManager.fan_speed[0] = pausefan); + TERN_(HAS_FAN, thermalManager.fan_speed[0] = temp_val.pausefan); planner.synchronize(); TERN_(SDSUPPORT, queue.inject(F("M24"))); #endif @@ -4323,7 +5332,7 @@ void CrealityDWINClass::Popup_Control() { switch (popup) { case Pause: if (selection == 0) { - if (sdprint) { + if (temp_val.sdprint) { #if ENABLED(POWER_LOSS_RECOVERY) if (recovery.enabled) recovery.save(true); #endif @@ -4337,9 +5346,9 @@ void CrealityDWINClass::Popup_Control() { planner.synchronize(); #else queue.inject(F("M25")); - TERN_(HAS_HOTEND, pausetemp = thermalManager.temp_hotend[0].target); - TERN_(HAS_HEATED_BED, pausebed = thermalManager.temp_bed.target); - TERN_(HAS_FAN, pausefan = thermalManager.fan_speed[0]); + TERN_(HAS_HOTEND, temp_val.pausetemp = thermalManager.temp_hotend[0].target); + TERN_(HAS_HEATED_BED, temp_val.pausebed = thermalManager.temp_bed.target); + TERN_(HAS_FAN, temp_val.pausefan = thermalManager.fan_speed[0]); thermalManager.cooldown(); #endif } @@ -4351,7 +5360,7 @@ void CrealityDWINClass::Popup_Control() { break; case Stop: if (selection == 0) { - if (sdprint) { + if (temp_val.sdprint) { ui.abort_print(); thermalManager.cooldown(); } @@ -4387,7 +5396,7 @@ void CrealityDWINClass::Popup_Control() { case ManualProbing: if (selection == 0) { char buf[80]; - const float dif = probe.probe_at_point(current_position.x, current_position.y, PROBE_PT_STOW, 0, false) - corner_avg; + const float dif = probe.probe_at_point(current_position.x, current_position.y, PROBE_PT_STOW, 0, false) - temp_val.corner_avg; sprintf_P(buf, dif > 0 ? PSTR("Corner is %smm high") : PSTR("Corner is %smm low"), dtostrf(abs(dif), 1, 3, str_1)); Update_Status(buf); } @@ -4423,12 +5432,20 @@ void CrealityDWINClass::Popup_Control() { } else { pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT; - if (printing) Popup_Handler(Resuming); + if (temp_val.printing) Popup_Handler(Resuming); else Redraw_Menu(true, true, (active_menu==PreheatHotend)); } break; #endif // ADVANCED_PAUSE_FEATURE + case PrintConfirm: + if (selection==0) { + card.openAndPrintFile(card.filename);} + else{ + Redraw_Menu(true, true, true); + gcode.process_subcommands_now(F("M117"));} + break; + #if HAS_MESH case SaveLevel: if (selection == 0) { @@ -4470,8 +5487,15 @@ void CrealityDWINClass::Confirm_Control() { break; case HeaterTime: Popup_Handler(Heating); + Update_Status(GET_TEXT_F(MSG_HEATING)); wait_for_user = false; break; + #if HAS_ESDIAG + case ESDiagPopup: + wait_for_user = false; + Redraw_Menu(true, true, false); + break; + #endif default: Redraw_Menu(true, true, false); wait_for_user = false; @@ -4481,6 +5505,126 @@ void CrealityDWINClass::Confirm_Control() { DWIN_UpdateLCD(); } +#if HAS_HOSTACTION_MENUS + + void CrealityDWINClass::Keyboard_Control() { + const uint8_t keyboard_size = 34; + static uint8_t key_selection = 0, cursor = 0; + static char string[31]; + static bool uppercase = false, locked = false; + if (reset_keyboard) { + if (strcmp(stringpointer, "-") == 0) stringpointer[0] = '\0'; + key_selection = 0, cursor = strlen(stringpointer); + uppercase = false, locked = false; + reset_keyboard = false; + strcpy(string, stringpointer); + } + EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); + if (encoder_diffState == ENCODER_DIFF_NO) return; + if (encoder_diffState == ENCODER_DIFF_CW && key_selection < keyboard_size) { + Draw_Keys(key_selection, false, uppercase, locked); + key_selection++; + Draw_Keys(key_selection, true, uppercase, locked); + } + else if (encoder_diffState == ENCODER_DIFF_CCW && key_selection > 0) { + Draw_Keys(key_selection, false, uppercase, locked); + key_selection--; + Draw_Keys(key_selection, true, uppercase, locked); + } + else if (encoder_diffState == ENCODER_DIFF_ENTER) { + if (key_selection < 28) { + if (key_selection == 19) { + if (!numeric_keyboard) { + if (locked) { + uppercase = false, locked = false; + Draw_Keyboard(keyboard_restrict, false, key_selection, uppercase, locked); + } else if (uppercase) { + locked = true; + Draw_Keyboard(keyboard_restrict, false, key_selection, uppercase, locked); + } + else { + uppercase = true; + Draw_Keyboard(keyboard_restrict, false, key_selection, uppercase, locked); + } + } + } + else if (key_selection == 27) { + cursor--; + string[cursor] = '\0'; + } + else { + uint8_t index = key_selection; + if (index > 19) index--; + if (index > 27) index--; + const char *keys; + if (numeric_keyboard) keys = "1234567890&<>() {}[]*\"\':;!?"; + else keys = (uppercase) ? "QWERTYUIOPASDFGHJKLZXCVBNM" : "qwertyuiopasdfghjklzxcvbnm"; + if (!(keyboard_restrict && numeric_keyboard && index > 9)) { + string[cursor] = keys[index]; + cursor++; + string[cursor] = '\0'; + } + if (!locked && uppercase) { + uppercase = false; + Draw_Keyboard(keyboard_restrict, false, key_selection, uppercase, locked); + } + } + } + else { + switch (key_selection) { + case 28: + if (!numeric_keyboard) uppercase = false, locked = false; + Draw_Keyboard(keyboard_restrict, !numeric_keyboard, key_selection, uppercase, locked); + break; + case 29: + string[cursor] = '-'; + cursor++; + string[cursor] = '\0'; + break; + case 30: + string[cursor] = '_'; + cursor++; + string[cursor] = '\0'; + break; + case 31: + if (!keyboard_restrict) { + string[cursor] = ' '; + cursor++; + string[cursor] = '\0'; + } + break; + case 32: + if (!keyboard_restrict) { + string[cursor] = '.'; + cursor++; + string[cursor] = '\0'; + } + break; + case 33: + if (!keyboard_restrict) { + string[cursor] = '/'; + cursor++; + string[cursor] = '\0'; + } + break; + case 34: + if (string[0] == '\0') strcpy(string, "-"); + strcpy(stringpointer, string); + process = Menu; + DWIN_Draw_Rectangle(1, Def_Background_Color, 0, KEY_Y_START, DWIN_WIDTH-2, DWIN_HEIGHT-2); + Draw_Status_Area(true); + Update_Status_Bar(true); + break; + } + } + if (strlen(string) > maxstringlen) string[maxstringlen] = '\0', cursor = maxstringlen; + Draw_String(string, selection, (process==Keyboard), (maxstringlen > 10)); + } + DWIN_UpdateLCD(); + } + +#endif // HAS_HOSTACTION_MENUS + /* In-Menu Value Modification */ void CrealityDWINClass::Setup_Value(float value, float min, float max, float unit, uint8_t type) { @@ -4540,24 +5684,37 @@ void CrealityDWINClass::Modify_Option(uint8_t value, const char * const * option Draw_Option(value, options, selection - scrollpos, true); } +#if HAS_HOSTACTION_MENUS + void CrealityDWINClass::Modify_String(char * string, uint8_t maxlength, bool restrict) { + stringpointer = string; + maxstringlen = maxlength; + reset_keyboard = true; + Draw_Keyboard(restrict, false); + Draw_String(string, selection, true, (maxstringlen > 10)); + } +#endif + /* Main Functions */ +void CrealityDWINClass::Update_Print_Filename(const char * const text) { + LOOP_L_N(i, _MIN((size_t)LONG_FILENAME_LENGTH, strlen(text))) filename[i] = text[i]; + filename[_MIN((size_t)LONG_FILENAME_LENGTH - 1, strlen(text))] = '\0'; + Draw_Print_Filename(true); +} + void CrealityDWINClass::Update_Status(const char * const text) { - if (strncmp_P(text, PSTR(""), 3) == 0) { - LOOP_L_N(i, _MIN((size_t)LONG_FILENAME_LENGTH, strlen(text))) filename[i] = text[i + 3]; - filename[_MIN((size_t)LONG_FILENAME_LENGTH - 1, strlen(text))] = '\0'; - Draw_Print_Filename(true); - } - else { - LOOP_L_N(i, _MIN((size_t)64, strlen(text))) statusmsg[i] = text[i]; - statusmsg[_MIN((size_t)64, strlen(text))] = '\0'; - } + LOOP_L_N(i, _MIN((size_t)64, strlen(text))) statusmsg[i] = text[i]; + statusmsg[_MIN((size_t)64, strlen(text))] = '\0'; +} + +void CrealityDWINClass::Update_Status(FSTR_P text) { + Update_Status(FTOP(text)); } void CrealityDWINClass::Start_Print(bool sd) { - sdprint = sd; - if (!printing) { - printing = true; + temp_val.sdprint = sd; + if (!temp_val.printing) { + temp_val.printing = true; statusmsg[0] = '\0'; if (sd) { #if ENABLED(POWER_LOSS_RECOVERY) @@ -4569,8 +5726,6 @@ void CrealityDWINClass::Start_Print(bool sd) { #endif strcpy(filename, card.longest_filename()); } - else - strcpy_P(filename, PSTR("Host Print")); TERN_(LCD_SET_PROGRESS_MANUALLY, ui.set_progress(0)); TERN_(USE_M73_REMAINING_TIME, ui.set_remaining_time(0)); Draw_Print_Screen(); @@ -4578,12 +5733,13 @@ void CrealityDWINClass::Start_Print(bool sd) { } void CrealityDWINClass::Stop_Print() { - printing = false; - sdprint = false; + temp_val.printing = false; + temp_val.sdprint = false; thermalManager.cooldown(); TERN_(LCD_SET_PROGRESS_MANUALLY, ui.set_progress(100 * (PROGRESS_SCALE))); TERN_(USE_M73_REMAINING_TIME, ui.set_remaining_time(0)); - Draw_Print_confirm(); + Draw_PrintDone_confirm(); + filename[0] = '\0'; } void CrealityDWINClass::Update() { @@ -4598,6 +5754,13 @@ void CrealityDWINClass::Update() { case Print: Print_Screen_Control(); break; case Popup: Popup_Control(); break; case Confirm: Confirm_Control(); break; + #if HAS_HOSTACTION_MENUS + case Keyboard: Keyboard_Control(); break; + #endif + case Cancel: Confirm_Control(); break; + #if HAS_LOCKSCREEN + case Locked: HMI_LockScreen(); break; + #endif } } @@ -4608,14 +5771,14 @@ void MarlinUI::update() { CrealityDWIN.Update(); } #endif void CrealityDWINClass::State_Update() { - if ((print_job_timer.isRunning() || print_job_timer.isPaused()) != printing) { - if (!printing) Start_Print(card.isFileOpen() || TERN0(POWER_LOSS_RECOVERY, recovery.valid())); + if ((print_job_timer.isRunning() || print_job_timer.isPaused()) != temp_val.printing) { + if (!temp_val.printing) Start_Print(card.isFileOpen() || TERN0(POWER_LOSS_RECOVERY, recovery.valid())); else Stop_Print(); } - if (print_job_timer.isPaused() != paused) { - paused = print_job_timer.isPaused(); + if (print_job_timer.isPaused() != temp_val.paused) { + temp_val.paused = print_job_timer.isPaused(); if (process == Print) Print_Screen_Icons(); - if (process == Wait && !paused) Redraw_Menu(true, true); + if (process == Wait && !temp_val.paused) Redraw_Menu(true, true); } if (wait_for_user && !(process == Confirm) && !print_job_timer.isPaused()) Confirm_Handler(UserInput); @@ -4624,7 +5787,7 @@ void CrealityDWINClass::State_Update() { if (pause_menu_response == PAUSE_RESPONSE_EXTRUDE_MORE) Popup_Handler(FilChange); else if (pause_menu_response == PAUSE_RESPONSE_RESUME_PRINT) { - if (printing) Popup_Handler(Resuming); + if (temp_val.printing) Popup_Handler(Resuming); else Redraw_Menu(true, true, (active_menu==PreheatHotend)); } } @@ -4643,14 +5806,20 @@ void CrealityDWINClass::Screen_Update() { static millis_t scrltime = 0; if (ELAPSED(ms, scrltime)) { scrltime = ms + 200; - Update_Status_Bar(); + if (process != Keyboard) Update_Status_Bar(); if (process == Print) Draw_Print_Filename(); } static millis_t statustime = 0; - if (ELAPSED(ms, statustime)) { + if (ELAPSED(ms, statustime) && process != Keyboard) { statustime = ms + 500; Draw_Status_Area(); + #if HAS_ESDIAG + if (process == Confirm && popup == ESDiagPopup) ESDiag.Update(); + #endif + #if HAS_PIDPLOT + if (process == Wait && (popup == PIDWaitH || popup == PIDWaitB)) Plot.Update((popup == PIDWaitH) ? thermalManager.wholeDegHotend(0) : thermalManager.wholeDegBed()); + #endif } static millis_t printtime = 0; @@ -4681,22 +5850,22 @@ void CrealityDWINClass::Screen_Update() { #endif #if HAS_ZOFFSET_ITEM - static float lastzoffset = zoffsetvalue; - if (zoffsetvalue != lastzoffset) { - lastzoffset = zoffsetvalue; + static float lastzoffset = temp_val.zoffsetvalue; + if (temp_val.zoffsetvalue != lastzoffset) { + lastzoffset = temp_val.zoffsetvalue; #if HAS_BED_PROBE - probe.offset.z = zoffsetvalue; + probe.offset.z = temp_val.zoffsetvalue; #else - set_home_offset(Z_AXIS, -zoffsetvalue); + set_home_offset(Z_AXIS, -temp_val.zoffsetvalue); #endif } #if HAS_BED_PROBE if (probe.offset.z != lastzoffset) - zoffsetvalue = lastzoffset = probe.offset.z; + temp_val.zoffsetvalue = lastzoffset = probe.offset.z; #else if (-home_offset.z != lastzoffset) - zoffsetvalue = lastzoffset = -home_offset.z; + temp_val.zoffsetvalue = lastzoffset = -home_offset.z; #endif #endif // HAS_ZOFFSET_ITEM @@ -4772,8 +5941,15 @@ void CrealityDWINClass::AudioFeedback(const bool success/*=true*/) { } void CrealityDWINClass::Save_Settings(char *buff) { + TERN_(DEBUG_DWIN, SERIAL_ECHOLNPGM("Save_Settings")); TERN_(AUTO_BED_LEVELING_UBL, eeprom_settings.tilt_grid_size = mesh_conf.tilt_grid - 1); - eeprom_settings.corner_pos = corner_pos * 10; + eeprom_settings.corner_pos = temp_val.corner_pos * 10; + #if HAS_HOSTACTION_MENUS + eeprom_settings.host_action_label_1 = Encode_String(action1); + eeprom_settings.host_action_label_2 = Encode_String(action2); + eeprom_settings.host_action_label_3 = Encode_String(action3); + #endif + TERN_(DEBUG_DWIN, SERIAL_ECHOLNPGM("eeprom_settings size: ", sizeof(eeprom_settings_t))); memcpy(buff, &eeprom_settings, _MIN(sizeof(eeprom_settings), eeprom_data_size)); } @@ -4781,7 +5957,29 @@ void CrealityDWINClass::Load_Settings(const char *buff) { memcpy(&eeprom_settings, buff, _MIN(sizeof(eeprom_settings), eeprom_data_size)); TERN_(AUTO_BED_LEVELING_UBL, mesh_conf.tilt_grid = eeprom_settings.tilt_grid_size + 1); if (eeprom_settings.corner_pos == 0) eeprom_settings.corner_pos = 325; - corner_pos = eeprom_settings.corner_pos / 10.0f; + temp_val.corner_pos = eeprom_settings.corner_pos / 10.0f; + #if ENABLED(BAUD_RATE_GCODE) + if (eeprom_settings.Baud115k) queue.inject(F("M575 P0 B115200")); + #endif + #if ENABLED(FWRETRACT) + temp_val.auto_fw_retract = fwretract.autoretract_enabled; + #endif + #if ENABLED(PREHEAT_BEFORE_LEVELING) + temp_val.LevelingTempmode = 2 * !eeprom_settings.ena_hotend_levtemp + !eeprom_settings.ena_bed_levtemp; + #endif + #if ENABLED(LED_CONTROL_MENU, HAS_COLOR_LEDS) + leds.set_color( + (temp_val.LED_Color >> 16) & 0xFF, + (temp_val.LED_Color >> 8) & 0xFF, + (temp_val.LED_Color >> 0) & 0xFF + OPTARG(HAS_WHITE_LED, (temp_val.LED_Color >> 24) & 0xFF) + ); + #endif + #if HAS_HOSTACTION_MENUS + Decode_String(eeprom_settings.host_action_label_1, action1); + Decode_String(eeprom_settings.host_action_label_2, action2); + Decode_String(eeprom_settings.host_action_label_3, action3); + #endif Redraw_Screen(); #if ENABLED(POWER_LOSS_RECOVERY) static bool init = true; @@ -4808,26 +6006,69 @@ void CrealityDWINClass::Reset_Settings() { eeprom_settings.coordinates_text = 0; eeprom_settings.coordinates_split_line = 0; TERN_(AUTO_BED_LEVELING_UBL, mesh_conf.tilt_grid = eeprom_settings.tilt_grid_size + 1); - corner_pos = eeprom_settings.corner_pos / 10.0f; + temp_val.corner_pos = eeprom_settings.corner_pos / 10.0f; TERN_(SOUND_MENU_ITEM, ui.sound_on = ENABLED(SOUND_ON_DEFAULT)); + TERN_(BAUD_RATE_GCODE, eeprom_settings.Baud115k = false); + TERN_(FWRETRACT, temp_val.auto_fw_retract = fwretract.autoretract_enabled); + #if ENABLED(PREHEAT_BEFORE_LEVELING) + eeprom_settings.ena_hotend_levtemp = true; + eeprom_settings.ena_bed_levtemp = true; + eeprom_settings.hotend_levtemp = LEVELING_NOZZLE_TEMP; + eeprom_settings.bed_levtemp = LEVELING_BED_TEMP; + #endif + #if ENABLED(LED_CONTROL_MENU, HAS_COLOR_LEDS) + leds.setup(); + #if ENABLED(LED_COLOR_PRESETS) + leds.set_default(); + #endif + temp_val.LED_Color = Def_Leds_Color; + leds.set_color( + (temp_val.LED_Color >> 16) & 0xFF, + (temp_val.LED_Color >> 8) & 0xFF, + (temp_val.LED_Color >> 0) & 0xFF + OPTARG(HAS_WHITE_LED, (temp_val.LED_Color >> 24) & 0xFF) + ); + #endif + #if HAS_HOSTACTION_MENUS + eeprom_settings.host_action_label_1 = 0; + eeprom_settings.host_action_label_2 = 0; + eeprom_settings.host_action_label_3 = 0; + action1[0] = action2[0] = action3[0] = '-'; + #endif Redraw_Screen(); } +void CrealityDWINClass::PreheatBefore() { + #if ENABLED(PREHEAT_BEFORE_LEVELING) + Popup_Handler(Heating); + #if HAS_BED_PROBE + probe.preheat_for_probing(eeprom_settings.ena_hotend_levtemp, eeprom_settings.ena_bed_levtemp); + #else + #if HAS_HOTEND + if (thermalManager.degTargetHotend(0) < eeprom_settings.hotend_levtemp && (eeprom_settings.ena_hotend_levtemp)) + thermalManager.setTargetHotend(eeprom_settings.hotend_levtemp, 0); + #endif + #if HAS_HEATED_BED + if (thermalManager.degTargetBed() < eeprom_settings.bed_levtemp && (eeprom_settings.ena_bed_levtemp)) + thermalManager.setTargetBed(eeprom_settings.bed_levtemp); + #endif + TERN_(HAS_HOTEND, if (eeprom_settings.ena_hotend_levtemp) thermalManager.wait_for_hotend(0)); + TERN_(HAS_HEATED_BED, if (eeprom_settings.ena_bed_levtemp) thermalManager.wait_for_bed_heating()); + #endif + Update_Status(""); + #endif +} + void MarlinUI::init_lcd() { - delay(800); - SERIAL_ECHOPGM("\nDWIN handshake "); - if (DWIN_Handshake()) SERIAL_ECHOLNPGM("ok."); else SERIAL_ECHOLNPGM("error."); - DWIN_Frame_SetDir(1); // Orientation 90° - DWIN_UpdateLCD(); // Show bootscreen (first image) + DWINUI::init(); Encoder_Configuration(); + DWIN_JPG_ShowAndCache(0); for (uint16_t t = 0; t <= 100; t += 2) { - DWIN_ICON_Show(ICON, ICON_Bar, 15, 260); - DWIN_Draw_Rectangle(1, Color_Bg_Black, 15 + t * 242 / 100, 260, 257, 280); + DWINUI::DRAW_IconWB(ICON, ICON_Bar, 15, 260); + DWIN_Draw_Rectangle(1, Def_Background_Color, 15 + t * 242 / 100, 260, 257, 280); DWIN_UpdateLCD(); delay(20); } - - DWIN_JPG_ShowAndCache(3); DWIN_JPG_CacheTo1(Language_English); CrealityDWIN.Redraw_Screen(); } @@ -4836,8 +6077,8 @@ void MarlinUI::init_lcd() { void MarlinUI::pause_show_message(const PauseMessage message, const PauseMode mode/*=PAUSE_MODE_SAME*/, const uint8_t extruder/*=active_extruder*/) { switch (message) { case PAUSE_MESSAGE_INSERT: CrealityDWIN.Confirm_Handler(FilInsert); break; - case PAUSE_MESSAGE_PURGE: - case PAUSE_MESSAGE_OPTION: CrealityDWIN.Popup_Handler(PurgeMore); break; + case PAUSE_MESSAGE_PURGE: break; + case PAUSE_MESSAGE_OPTION: pause_menu_response = PAUSE_RESPONSE_WAIT_FOR; CrealityDWIN.Popup_Handler(PurgeMore); break; case PAUSE_MESSAGE_HEAT: CrealityDWIN.Confirm_Handler(HeaterTime); break; case PAUSE_MESSAGE_WAITING: CrealityDWIN.Draw_Print_Screen(); break; default: break; @@ -4845,4 +6086,109 @@ void MarlinUI::init_lcd() { } #endif +// End-stops diagnostic from DWIN PROUI +#if HAS_ESDIAG + void CrealityDWINClass::DWIN_EndstopsDiag() { + last_process = process; + last_selection = selection; + process = Confirm; + popup = ESDiagPopup; + ESDiag.Draw(); + } +#endif + +// Lock screen from DWIN PROUI +#if HAS_LOCKSCREEN + void CrealityDWINClass::DWIN_LockScreen() { + if (process != Locked) { + lockScreen.rprocess = process; + process = Locked; + lockScreen.init(); + } + } + + void CrealityDWINClass::DWIN_UnLockScreen() { + if (process == Locked) { + process = lockScreen.rprocess; + if (!temp_val.printing) Draw_Main_Menu(); else Draw_Print_Screen(); + } + } + + void CrealityDWINClass::HMI_LockScreen() { + EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); + if (encoder_diffState == ENCODER_DIFF_NO) return; + lockScreen.onEncoder(encoder_diffState); + if (lockScreen.isUnlocked()) DWIN_UnLockScreen(); + } +#endif + +// Reboot screen from DWIN PROUI +void CrealityDWINClass::DWIN_RebootScreen() { + DWIN_Frame_Clear(Def_Background_Color); + DWIN_JPG_ShowAndCache(0); + DWINUI::Draw_CenteredString(Def_Text_Color, 220, GET_TEXT_F(MSG_PLEASE_WAIT_REBOOT)); + DWIN_UpdateLCD(); + delay(500); +} + +// Reboot Printer from DWIN PROUI +void CrealityDWINClass::RebootPrinter() { + wait_for_heatup = wait_for_user = false; // Stop waiting for heating/user + thermalManager.disable_all_heaters(); + planner.finish_and_disable(); + DWIN_RebootScreen(); + hal.reboot(); +} + +#if ENABLED(LED_CONTROL_MENU, HAS_COLOR_LEDS) + void CrealityDWINClass::ApplyLEDColor() { + temp_val.LED_Color = TERN0(HAS_WHITE_LED,(leds.color.w << 24)) | (leds.color.r << 16) | (leds.color.g << 8) | (leds.color.b); + } +#endif + +#if HAS_PIDPLOT + void CrealityDWINClass::DWIN_Draw_PIDPopup(const pidresult_t pidresult) { + frame_rect_t gfrm = {40, 160, DWIN_WIDTH - 80, 150}; + DWINUI::ClearMainArea(); + DWIN_Draw_Rectangle(1, Def_PopupBg_color, 14, 60, 258, 330); + DWIN_Draw_Rectangle(0, Def_Highlight_Color, 14, 60, 258, 330); + DWINUI::Draw_CenteredString(Def_PopupTxt_Color, 80, GET_TEXT_F(MSG_PID_AUTOTUNE)); + DWINUI::Draw_String(Def_PopupTxt_Color, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("PID target: Celsius")); + switch (pidresult) { + case PID_EXTR_START: + DWINUI::Draw_CenteredString(Def_PopupTxt_Color, 100, F("for Nozzle is running.")); + Plot.Draw(gfrm, thermalManager.hotend_maxtemp[0], temp_val.PID_e_temp); + DWINUI::Draw_Int(Def_PopupTxt_Color, 3, gfrm.x + 90, gfrm.y - DWINUI::fontHeight() - 4, temp_val.PID_e_temp); + break; + case PID_BED_START: + DWINUI::Draw_CenteredString(Def_PopupTxt_Color, 100, F("for BED is running.")); + Plot.Draw(gfrm, BED_MAXTEMP, temp_val.PID_bed_temp); + DWINUI::Draw_Int(Def_PopupTxt_Color, 3, gfrm.x + 90, gfrm.y - DWINUI::fontHeight() - 4, temp_val.PID_bed_temp); + break; + default: + break; + } + } +#endif + +#if HAS_PID_HEATING + void CrealityDWINClass::DWIN_PidTuning(const pidresult_t pidresult) { + switch (pidresult) { + case PID_STARTED: break; + #if HAS_PIDPLOT + case PID_EXTR_START: last_process = process; last_selection = selection; process = Wait; popup = PIDWaitH; DWIN_Draw_PIDPopup(pidresult); break; + case PID_BED_START: last_process = process; last_selection = selection; process = Wait; popup = PIDWaitB; DWIN_Draw_PIDPopup(pidresult); break; + #else + case PID_EXTR_START: Popup_Handler(PIDWait); break; + case PID_BED_START: Popup_Handler(PIDWait, true); break; + #endif + case PID_BAD_EXTRUDER_NUM: Confirm_Handler(BadextruderNumber); break; + case PID_TEMP_TOO_HIGH: Confirm_Handler(TempTooHigh); break; + case PID_TUNING_TIMEOUT: Confirm_Handler(PIDTimeout); break; + case PID_DONE: Confirm_Handler(PIDDone); break; + default: break; + } + } +#endif + #endif // DWIN_CREALITY_LCD_JYERSUI diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.h b/Marlin/src/lcd/e3v2/jyersui/dwin.h index 8985647cd131..c42c0677dce1 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.h +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.h @@ -23,27 +23,26 @@ /** * lcd/e3v2/jyersui/dwin.h + * JYERSUI Author: Jacob Myers + * + * JYERSUI Enhanced by LCH-77 + * Version: 1.9 + * Date: Jun 16, 2022 */ -#include "dwin_lcd.h" -#include "../common/dwin_set.h" -#include "../common/dwin_font.h" -#include "../common/dwin_color.h" -#include "../common/encoder.h" -#include "../../../libs/BL24CXX.h" - -#include "../../../inc/MarlinConfigPre.h" +#include "dwin_defines.h" -//#define DWIN_CREALITY_LCD_CUSTOM_ICONS +#include "../../../inc/MarlinConfig.h" enum processID : uint8_t { - Main, Print, Menu, Value, Option, File, Popup, Confirm, Wait + Main, Print, Menu, Value, Option, File, Popup, Confirm, Wait, Locked, Cancel, Keyboard }; enum PopupID : uint8_t { Pause, Stop, Resume, SaveLevel, ETemp, ConfFilChange, PurgeMore, MeshSlot, - Level, Home, MoveWait, Heating, FilLoad, FilChange, TempWarn, Runout, PIDWait, Resuming, ManualProbing, - FilInsert, HeaterTime, UserInput, LevelError, InvalidMesh, UI, Complete, Custom + Level, Home, MoveWait, Heating, FilLoad, FilChange, TempWarn, Runout, Resuming, ManualProbing, + FilInsert, HeaterTime, UserInput, LevelError, InvalidMesh, UI, Complete, Custom, ESDiagPopup, PrintConfirm, + PIDWait, PIDWaitH, PIDWaitB, BadextruderNumber, TempTooHigh, PIDTimeout, PIDDone }; enum menuID : uint8_t { @@ -55,6 +54,7 @@ enum menuID : uint8_t { ZOffset, Preheat, ChangeFilament, + HostActions, MenuCustom, Control, TempMenu, @@ -69,105 +69,108 @@ enum menuID : uint8_t { HomeOffsets, MaxSpeed, MaxAcceleration, - MaxJerk, + #if HAS_CLASSIC_JERK + MaxJerk, + #endif + #if HAS_JUNCTION_DEVIATION + JDmenu, + #endif Steps, + #if ENABLED(FWRETRACT) + FwRetraction, + #endif Visual, ColorSettings, + HostSettings, + ActionCommands, Advanced, - ProbeMenu, + #if HAS_BED_PROBE + ProbeMenu, + #endif Info, - Leveling, - LevelManual, - LevelView, - MeshViewer, - LevelSettings, - ManualMesh, - UBLMesh, + #if HAS_MESH + Leveling, + LevelManual, + LevelView, + MeshViewer, + LevelSettings, + #if ENABLED(PROBE_MANUALLY) + ManualMesh, + #endif + #if ENABLED(AUTO_BED_LEVELING_UBL) && !HAS_BED_PROBE + UBLMesh, + #endif + #endif InfoMain, Tune, - PreheatHotend + PreheatHotend, + #if ANY(CASE_LIGHT_MENU, LED_CONTROL_MENU) + Ledsmenu, + #if BOTH(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS) + CaseLightmenu, + #endif + #if ENABLED(LED_CONTROL_MENU) + LedControlmenu, + #if HAS_COLOR_LEDS + #if ENABLED(LED_COLOR_PRESETS) + LedControlpresets, + #else + LedControlcustom, + #endif + #endif + #endif + #endif }; -// Custom icons -#if ENABLED(DWIN_CREALITY_LCD_CUSTOM_ICONS) - // index of every custom icon should be >= CUSTOM_ICON_START - #define CUSTOM_ICON_START ICON_Checkbox_F - #define ICON_Checkbox_F 200 - #define ICON_Checkbox_T 201 - #define ICON_Fade 202 - #define ICON_Mesh 203 - #define ICON_Tilt 204 - #define ICON_Brightness 205 - #define ICON_AxisD 249 - #define ICON_AxisBR 250 - #define ICON_AxisTR 251 - #define ICON_AxisBL 252 - #define ICON_AxisTL 253 - #define ICON_AxisC 254 -#else - #define ICON_Fade ICON_Version - #define ICON_Mesh ICON_Version - #define ICON_Tilt ICON_Version - #define ICON_Brightness ICON_Version - #define ICON_AxisD ICON_Axis - #define ICON_AxisBR ICON_Axis - #define ICON_AxisTR ICON_Axis - #define ICON_AxisBL ICON_Axis - #define ICON_AxisTL ICON_Axis - #define ICON_AxisC ICON_Axis -#endif +typedef struct { + // Flags + bool flag_tune = false; + bool auto_fw_retract = false; + bool printing = false; + bool paused = false; + bool sdprint = false; + bool livemove = false; + bool liveadjust = false; + bool probe_deployed = false; + // Auxiliary values + AxisEnum axis = X_AXIS; // Axis Select + int16_t pausetemp = 0; + int16_t pausebed = 0; + int16_t pausefan = 0; + uint8_t preheatmode = 0; + uint8_t zoffsetmode = 0; + float zoffsetvalue = 0; + uint8_t gridpoint; + float corner_avg; + float corner_pos; + float zval; + #if ENABLED(PREHEAT_BEFORE_LEVELING) + uint8_t LevelingTempmode = 0; + #endif + #if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS) + uint32_t LED_Color = Def_Leds_Color; + #endif + #if HAS_PID_HEATING + uint16_t PID_e_temp = 180; + uint16_t PID_bed_temp = 60; + #endif +} temp_val_t; +extern temp_val_t temp_val; +#define Custom_Colors 10 enum colorID : uint8_t { Default, White, Green, Cyan, Blue, Magenta, Red, Orange, Yellow, Brown, Black }; - -#define Custom_Colors 10 -#define Color_Aqua RGB(0x00,0x3F,0x1F) -#define Color_Light_White 0xBDD7 -#define Color_Green RGB(0x00,0x3F,0x00) -#define Color_Light_Green 0x3460 -#define Color_Cyan 0x07FF -#define Color_Light_Cyan 0x04F3 -#define Color_Blue 0x015F -#define Color_Light_Blue 0x3A6A -#define Color_Magenta 0xF81F -#define Color_Light_Magenta 0x9813 -#define Color_Light_Red 0x8800 -#define Color_Orange 0xFA20 -#define Color_Light_Orange 0xFBC0 -#define Color_Light_Yellow 0x8BE0 -#define Color_Brown 0xCC27 -#define Color_Light_Brown 0x6204 -#define Color_Black 0x0000 -#define Color_Grey 0x18E3 -#define Check_Color 0x4E5C // Check-box check color -#define Confirm_Color 0x34B9 -#define Cancel_Color 0x3186 +enum pidresult_t : uint8_t { PID_STARTED, PID_EXTR_START, PID_BED_START, PID_BAD_EXTRUDER_NUM, PID_TEMP_TOO_HIGH, PID_TUNING_TIMEOUT, PID_DONE }; class CrealityDWINClass { public: - static constexpr size_t eeprom_data_size = 48; - static struct EEPROM_Settings { // use bit fields to save space, max 48 bytes - bool time_format_textual : 1; - #if ENABLED(AUTO_BED_LEVELING_UBL) - uint8_t tilt_grid_size : 3; - #endif - uint16_t corner_pos : 10; - uint8_t cursor_color : 4; - uint8_t menu_split_line : 4; - uint8_t menu_top_bg : 4; - uint8_t menu_top_txt : 4; - uint8_t highlight_box : 4; - uint8_t progress_percent : 4; - uint8_t progress_time : 4; - uint8_t status_bar_text : 4; - uint8_t status_area_text : 4; - uint8_t coordinates_text : 4; - uint8_t coordinates_split_line : 4; - } eeprom_settings; - static constexpr const char * const color_names[11] = { "Default", "White", "Green", "Cyan", "Blue", "Magenta", "Red", "Orange", "Yellow", "Brown", "Black" }; static constexpr const char * const preheat_modes[3] = { "Both", "Hotend", "Bed" }; + static constexpr const char * const zoffset_modes[3] = { "No Live" , "OnClick", " Live" }; + #if ENABLED(PREHEAT_BEFORE_LEVELING) + static constexpr const char * const preheat_levmodes[4] = { " Both", " Hotend", " Bed", " None" }; + #endif static void Clear_Screen(uint8_t e=3); static void Draw_Float(float value, uint8_t row, bool selected=false, uint8_t minunit=10); @@ -192,7 +195,7 @@ class CrealityDWINClass { static void Draw_Print_ProgressRemain(); #endif static void Draw_Print_ProgressElapsed(); - static void Draw_Print_confirm(); + static void Draw_PrintDone_confirm(); static void Draw_SD_Item(uint8_t item, uint8_t row); static void Draw_SD_List(bool removed=false); static void Draw_Status_Area(bool icons=false); @@ -209,8 +212,8 @@ class CrealityDWINClass { static uint8_t Get_Menu_Size(uint8_t menu); static void Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw=true); - static void Popup_Handler(PopupID popupid, bool option = false); - static void Confirm_Handler(PopupID popupid); + static void Popup_Handler(PopupID popupid, bool option=false); + static void Confirm_Handler(PopupID popupid, bool option=false); static void Main_Menu_Control(); static void Menu_Control(); @@ -231,6 +234,7 @@ class CrealityDWINClass { static void Modify_Option(uint8_t value, const char * const * options, uint8_t max); static void Update_Status(const char * const text); + static void Update_Status(FSTR_P text); static void Start_Print(bool sd); static void Stop_Print(); static void Update(); @@ -240,6 +244,40 @@ class CrealityDWINClass { static void Save_Settings(char *buff); static void Load_Settings(const char *buff); static void Reset_Settings(); + static void PreheatBefore(); + + #if HAS_ESDIAG + static void DWIN_EndstopsDiag(); + #endif + #if HAS_LOCKSCREEN + static void DWIN_LockScreen(); + static void DWIN_UnLockScreen(); + static void HMI_LockScreen(); + #endif + static void DWIN_RebootScreen(); + static void RebootPrinter(); + static void Update_Print_Filename(const char * const text); + #if ENABLED(LED_CONTROL_MENU, HAS_COLOR_LEDS) + static void ApplyLEDColor(); + #endif + + #if HAS_HOSTACTION_MENUS + static void Draw_String(char * string, uint8_t row, bool selected=false, bool below=false); + static const uint64_t Encode_String(const char * string); + static void Decode_String(uint64_t num, char * string); + static void Draw_Keyboard(bool restrict, bool numeric, uint8_t selected=0, bool uppercase=false, bool lock=false); + static void Draw_Keys(uint8_t index, bool selected, bool uppercase=false, bool lock=false); + static void Modify_String(char * string, uint8_t maxlength, bool restrict); + static void Keyboard_Control(); + #endif + + #if HAS_PIDPLOT + static void DWIN_Draw_PIDPopup(const pidresult_t pidresult); + #endif + + #if HAS_PID_HEATING + static void DWIN_PidTuning(const pidresult_t pidresult); + #endif }; extern CrealityDWINClass CrealityDWIN; diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin_defines.h b/Marlin/src/lcd/e3v2/jyersui/dwin_defines.h new file mode 100644 index 000000000000..72d428448899 --- /dev/null +++ b/Marlin/src/lcd/e3v2/jyersui/dwin_defines.h @@ -0,0 +1,131 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * DWIN general defines and data structs for PRO UI + * Author: Miguel A. Risco-Castillo (MRISCOC) + * Version: 3.11.2 + * Date: 2022/02/28 + * + * Modded for JYERSUI by LCH-77 + * Version: 1.9 + * Date: Jun 16, 2022 + */ + +#include "../../../inc/MarlinConfigPre.h" + +#define HAS_ESDIAG 1 +#define HAS_LOCKSCREEN 1 +#define HAS_PIDPLOT 1 +#define HAS_GCODE_PREVIEW 1 +//#define DEBUG_DWIN 1 +//#define NEED_HEX_PRINT 1 + +#if ENABLED(HOST_ACTION_COMMANDS) + #define HAS_HOSTACTION_MENUS 1 +#endif + +#include "../../../core/types.h" +#include "../common/dwin_color.h" + +// Default UI Colors +#define Def_Background_Color RGB(4,4,0) +#define Def_Cursor_color RGB(24,24,0) +#define Def_TitleBg_color RGB(12,12,0) +#define Def_TitleTxt_color Color_White +#define Def_Text_Color Color_White +#define Def_Selected_Color RGB(24,24,0) +#define Def_SplitLine_Color RGB(24,24,0) +#define Def_Highlight_Color RGB(31,40,0) +#define Def_StatusBg_Color RGB(12,12,0) +#define Def_StatusTxt_Color Color_White +#define Def_PopupBg_color Color_Bg_Window +#define Def_PopupTxt_Color Popup_Text_Color +#define Def_AlertBg_Color Color_Bg_Red +#define Def_AlertTxt_Color Color_Yellow +#define Def_PercentTxt_Color RGB(31,48,8) +#define Def_Barfill_Color RGB(12,12,0) +#define Def_Indicator_Color RGB(31,48,8) +#define Def_Coordinate_Color Color_White +#define Def_Button_Color RGB(12,12,0) + +#if ENABLED(LED_CONTROL_MENU, HAS_COLOR_LEDS) + #define Def_Leds_Color 0xFFFFFFFF +#endif +#if ENABLED(CASELIGHT_USES_BRIGHTNESS) + #define Def_CaseLight_Brightness 255 +#endif + +#if HAS_MESH + #ifndef MESH_INSET + #define MESH_INSET 25 + #endif + #ifndef MESH_MIN_X + #define MESH_MIN_X MESH_INSET + #endif + #ifndef MESH_MIN_Y + #define MESH_MIN_Y MESH_INSET + #endif + #ifndef MESH_MAX_X + #define MESH_MAX_X X_BED_SIZE - (MESH_INSET) + #endif + #ifndef MESH_MAX_Y + #define MESH_MAX_Y X_BED_SIZE - (MESH_INSET) + #endif +#endif + +typedef struct { + bool time_format_textual : 1; + #if ENABLED(AUTO_BED_LEVELING_UBL) + uint8_t tilt_grid_size : 3; + #endif + uint16_t corner_pos : 10; + uint8_t cursor_color : 4; + uint8_t menu_split_line : 4; + uint8_t menu_top_bg : 4; + uint8_t menu_top_txt : 4; + uint8_t highlight_box : 4; + uint8_t progress_percent : 4; + uint8_t progress_time : 4; + uint8_t status_bar_text : 4; + uint8_t status_area_text : 4; + uint8_t coordinates_text : 4; + uint8_t coordinates_split_line : 4; + #if ENABLED(BAUD_RATE_GCODE) + bool Baud115k : 1; + #endif + #if ENABLED(PREHEAT_BEFORE_LEVELING) + bool ena_hotend_levtemp : 1; + bool ena_bed_levtemp : 1; + celsius_t hotend_levtemp = LEVELING_NOZZLE_TEMP; + celsius_t bed_levtemp = LEVELING_BED_TEMP; + #endif + #if HAS_HOSTACTION_MENUS + uint64_t host_action_label_1 : 48; + uint64_t host_action_label_2 : 48; + uint64_t host_action_label_3 : 48; + #endif +} eeprom_settings_t; + +static constexpr size_t eeprom_data_size = 48; +extern eeprom_settings_t eeprom_settings; diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin_lcd.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin_lcd.cpp index 04889e92b038..24d55272a3e9 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin_lcd.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin_lcd.cpp @@ -53,12 +53,41 @@ void DWIN_Draw_DegreeSymbol(uint16_t Color, uint16_t x, uint16_t y) { /*---------------------------------------- Picture related functions ----------------------------------------*/ -// Draw an Icon +// Draw an Icon with transparent background // libID: Icon library ID // picID: Icon ID // x/y: Upper-left point void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) { - DWIN_ICON_Show(true, false, false, libID, picID, x, y); + DWIN_ICON_Show(false, false, true, libID, picID, x, y); +} + +// From DWIN Enhanced implementation for PRO UI v3.10.1 +// Write buffer data to the SRAM or Flash +// mem: 0x5A=32KB SRAM, 0xA5=16KB Flash +// addr: start address +// length: Bytes to write +// data: address of the buffer with data +void DWIN_WriteToMem(uint8_t mem, uint16_t addr, uint16_t length, uint8_t *data) { + const uint8_t max_size = 128; + uint16_t pending = length; + uint16_t to_send; + uint16_t indx; + uint8_t block = 0; + + while (pending > 0) { + indx = block * max_size; + to_send = _MIN(pending, max_size); + size_t i = 0; + DWIN_Byte(i, 0x31); + DWIN_Byte(i, mem); + DWIN_Word(i, addr + indx); // start address of the data block + ++i; + LOOP_L_N(j, i) { LCD_SERIAL.write(DWIN_SendBuf[j]); delayMicroseconds(1); } // Buf header + for (uint16_t j = indx; j <= indx + to_send - 1; j++) LCD_SERIAL.write(*(data + j)); delayMicroseconds(1); // write block of data + LOOP_L_N(j, 4) { LCD_SERIAL.write(DWIN_BufTail[j]); delayMicroseconds(1); } + block++; + pending -= to_send; + } } #endif // DWIN_CREALITY_LCD_JYERSUI diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin_lcd.h b/Marlin/src/lcd/e3v2/jyersui/dwin_lcd.h index f76cfb5d3e5f..b1aeadbbc51b 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin_lcd.h +++ b/Marlin/src/lcd/e3v2/jyersui/dwin_lcd.h @@ -32,3 +32,11 @@ // Color: color // x/y: Upper-left coordinate of the first pixel void DWIN_Draw_DegreeSymbol(uint16_t Color, uint16_t x, uint16_t y); + +// From DWIN Enhanced implementation for PRO UI v3.10.1 +// Write buffer data to the SRAM or Flash +// mem: 0x5A=32KB SRAM, 0xA5=16KB Flash +// addr: start address +// length: Bytes to write +// data: address of the buffer with data +void DWIN_WriteToMem(uint8_t mem, uint16_t addr, uint16_t length, uint8_t *data); diff --git a/Marlin/src/lcd/e3v2/jyersui/dwinui.cpp b/Marlin/src/lcd/e3v2/jyersui/dwinui.cpp new file mode 100644 index 000000000000..1573bff552d9 --- /dev/null +++ b/Marlin/src/lcd/e3v2/jyersui/dwinui.cpp @@ -0,0 +1,340 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * DWIN Enhanced implementation for PRO UI + * Author: Miguel A. Risco-Castillo (MRISCOC) + * Version: 3.17.1 + * Date: 2022/04/12 + * + * Modded for JYERSUI by LCH-77 + * Version: 1.9 + * Date: Jun 16, 2022 + */ + +#include "../../../inc/MarlinConfigPre.h" + +#if ENABLED(DWIN_CREALITY_LCD_JYERSUI) + +#include "../../../inc/MarlinConfig.h" +#include "dwin_lcd.h" +#include "dwinui.h" +#include "dwin_defines.h" + +//#define DEBUG_OUT 1 +#include "../../../core/debug_out.h" + +xy_int_t DWINUI::cursor = { 0 }; +uint16_t DWINUI::pencolor = Color_White; +uint16_t DWINUI::textcolor = Def_Text_Color; +uint16_t DWINUI::backcolor = Def_Background_Color; +uint16_t DWINUI::buttoncolor = Def_Button_Color; +uint8_t DWINUI::font = font8x16; +FSTR_P const DWINUI::Author = F(STRING_CONFIG_H_AUTHOR); + +void DWINUI::init() { + delay(750); // Delay for wait to wakeup screen + const bool hs = DWIN_Handshake(); UNUSED(hs); + #if ENABLED(DEBUG_DWIN) + SERIAL_ECHOPGM("DWIN_Handshake "); + SERIAL_ECHOLNF(hs ? F("ok.") : F("error.")); + #endif + DWIN_Frame_SetDir(1); + cursor.reset(); + pencolor = Color_White; + textcolor = Def_Text_Color; + backcolor = Def_Background_Color; + buttoncolor = Def_Button_Color; + font = font8x16; +} + +// Set text/number font +void DWINUI::setFont(uint8_t cfont) { + font = cfont; +} + +// Get font character width +uint8_t DWINUI::fontWidth(uint8_t cfont) { + switch (cfont) { + case font6x12 : return 6; + case font8x16 : return 8; + case font10x20: return 10; + case font12x24: return 12; + case font14x28: return 14; + case font16x32: return 16; + case font20x40: return 20; + case font24x48: return 24; + case font28x56: return 28; + case font32x64: return 32; + default: return 0; + } +} + +// Get font character height +uint8_t DWINUI::fontHeight(uint8_t cfont) { + switch (cfont) { + case font6x12 : return 12; + case font8x16 : return 16; + case font10x20: return 20; + case font12x24: return 24; + case font14x28: return 28; + case font16x32: return 32; + case font20x40: return 40; + case font24x48: return 48; + case font28x56: return 56; + case font32x64: return 64; + default: return 0; + } +} + +// Get screen x coordinates from text column +uint16_t DWINUI::ColToX(uint8_t col) { + return col * fontWidth(font); +} + +// Get screen y coordinates from text row +uint16_t DWINUI::RowToY(uint8_t row) { + return row * fontHeight(font); +} + +// Set text/number color +void DWINUI::SetColors(uint16_t fgcolor, uint16_t bgcolor, uint16_t alcolor) { + textcolor = fgcolor; + backcolor = bgcolor; + buttoncolor = alcolor; +} +void DWINUI::SetTextColor(uint16_t fgcolor) { + textcolor = fgcolor; +} +void DWINUI::SetBackgroundColor(uint16_t bgcolor) { + backcolor = bgcolor; +} + +// Moves cursor to point +// x: abscissa of the display +// y: ordinate of the display +// point: xy coordinate +void DWINUI::MoveTo(int16_t x, int16_t y) { + cursor.x = x; + cursor.y = y; +} +void DWINUI::MoveTo(xy_int_t point) { + cursor = point; +} + +// Moves cursor relative to the actual position +// x: abscissa of the display +// y: ordinate of the display +// point: xy coordinate +void DWINUI::MoveBy(int16_t x, int16_t y) { + cursor.x += x; + cursor.y += y; +} +void DWINUI::MoveBy(xy_int_t point) { + cursor += point; +} + +// Draw a Centered string using arbitrary x1 and x2 margins +void DWINUI::Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string) { + const uint16_t x = _MAX(0U, x2 + x1 - strlen_P(string) * fontWidth(size)) / 2 - 1; + DWIN_Draw_String(bShow, size, color, bColor, x, y, string); +} + +// Draw a char +// color: Character color +// x: abscissa of the display +// y: ordinate of the display +// c: ASCII code of char +void DWINUI::Draw_Char(uint16_t color, uint16_t x, uint16_t y, const char c) { + const char string[2] = { c, 0}; + DWIN_Draw_String(false, font, color, backcolor, x, y, string, 1); +} + +// Draw a char at cursor position and increment cursor +void DWINUI::Draw_Char(uint16_t color, const char c) { + Draw_Char(color, cursor.x, cursor.y, c); + MoveBy(fontWidth(font), 0); +} + +// Draw a string at cursor position +// color: Character color +// *string: The string +// rlimit: For draw less chars than string length use rlimit +void DWINUI::Draw_String(const char * const string, uint16_t rlimit) { + DWIN_Draw_String(false, font, textcolor, backcolor, cursor.x, cursor.y, string, rlimit); + MoveBy(strlen(string) * fontWidth(font), 0); +} +void DWINUI::Draw_String(uint16_t color, const char * const string, uint16_t rlimit) { + DWIN_Draw_String(false, font, color, backcolor, cursor.x, cursor.y, string, rlimit); + MoveBy(strlen(string) * fontWidth(font), 0); +} + +// Draw a numeric integer value +// bShow: true=display background color; false=don't display background color +// signedMode: 1=signed; 0=unsigned +// size: Font size +// color: Character color +// bColor: Background color +// iNum: Number of digits +// x/y: Upper-left coordinate +// value: Integer value +void DWINUI::Draw_Int(uint8_t bShow, bool signedMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value) { + char nstr[10]; + sprintf_P(nstr, PSTR("%*li"), (signedMode ? iNum + 1 : iNum), value); + DWIN_Draw_String(bShow, size, color, bColor, x, y, nstr); +} + +// Draw a numeric float value +// bShow: true=display background color; false=don't display background color +// signedMode: 1=signed; 0=unsigned +// size: Font size +// color: Character color +// bColor: Background color +// iNum: Number of digits +// fNum: Number of decimal digits +// x/y: Upper-left coordinate +// value: float value +void DWINUI::Draw_Float(uint8_t bShow, bool signedMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + char nstr[10]; + DWIN_Draw_String(bShow, size, color, bColor, x, y, dtostrf(value, iNum + (signedMode ? 2:1) + fNum, fNum, nstr)); +} + +// ------------------------- Buttons ------------------------------// + +void DWINUI::Draw_Button(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char * const caption) { + DWIN_Draw_Rectangle(1, bcolor, x1, y1, x2, y2); + Draw_CenteredString(0, font, color, bcolor, x1, x2, (y2 + y1 - fontHeight())/2, caption); +} + +void DWINUI::Draw_Button(uint8_t id, uint16_t x, uint16_t y) { + switch (id) { + case BTN_Cancel : Draw_Button(GET_TEXT_F(MSG_BUTTON_CANCEL), x, y); break; + case BTN_Confirm : Draw_Button(GET_TEXT_F(MSG_BUTTON_CONFIRM), x, y); break; + case BTN_Continue: Draw_Button(GET_TEXT_F(MSG_BUTTON_CONTINUE), x, y); break; + case BTN_Print : Draw_Button(GET_TEXT_F(MSG_BUTTON_PRINT), x, y); break; + case BTN_Save : Draw_Button(GET_TEXT_F(MSG_BUTTON_SAVE), x, y); break; + case BTN_Purge : Draw_Button(GET_TEXT_F(MSG_BUTTON_PURGE), x, y); break; + default: break; + } +} + +// -------------------------- Extra -------------------------------// + +// Draw a circle +// color: circle color +// x: the abscissa of the center of the circle +// y: ordinate of the center of the circle +// r: circle radius +void DWINUI::Draw_Circle(uint16_t color, uint16_t x, uint16_t y, uint8_t r) { + int a = 0, b = 0; + while (a <= b) { + b = SQRT(sq(r) - sq(a)); + if (a == 0) b--; + DWIN_Draw_Point(color, 1, 1, x + a, y + b); // Draw some sector 1 + DWIN_Draw_Point(color, 1, 1, x + b, y + a); // Draw some sector 2 + DWIN_Draw_Point(color, 1, 1, x + b, y - a); // Draw some sector 3 + DWIN_Draw_Point(color, 1, 1, x + a, y - b); // Draw some sector 4 + DWIN_Draw_Point(color, 1, 1, x - a, y - b); // Draw some sector 5 + DWIN_Draw_Point(color, 1, 1, x - b, y - a); // Draw some sector 6 + DWIN_Draw_Point(color, 1, 1, x - b, y + a); // Draw some sector 7 + DWIN_Draw_Point(color, 1, 1, x - a, y + b); // Draw some sector 8 + a++; + } +} + +// Draw a circle filled with color +// bcolor: fill color +// x: the abscissa of the center of the circle +// y: ordinate of the center of the circle +// r: circle radius +void DWINUI::Draw_FillCircle(uint16_t bcolor, uint16_t x,uint16_t y,uint8_t r) { + int a = 0, b = 0; + while (a <= b) { + b = SQRT(sq(r) - sq(a)); // b=sqrt(r*r-a*a); + if (a == 0) b--; + DWIN_Draw_Line(bcolor, x-b,y-a,x+b,y-a); + DWIN_Draw_Line(bcolor, x-a,y-b,x+a,y-b); + DWIN_Draw_Line(bcolor, x-b,y+a,x+b,y+a); + DWIN_Draw_Line(bcolor, x-a,y+b,x+a,y+b); + a++; + } +} + +// Color Interpolator +// val : Interpolator minv..maxv +// minv : Minimum value +// maxv : Maximum value +// color1 : Start color +// color2 : End color +uint16_t DWINUI::ColorInt(int16_t val, int16_t minv, int16_t maxv, uint16_t color1, uint16_t color2) { + uint8_t B, G, R; + const float n = (float)(val - minv) / (maxv - minv); + R = (1 - n) * GetRColor(color1) + n * GetRColor(color2); + G = (1 - n) * GetGColor(color1) + n * GetGColor(color2); + B = (1 - n) * GetBColor(color1) + n * GetBColor(color2); + return RGB(R, G, B); +} + +// Color Interpolator through Red->Yellow->Green->Blue (Pro UI) +// val : Interpolator minv..maxv +// minv : Minimum value +// maxv : Maximum value +uint16_t DWINUI::RainbowInt(int16_t val, int16_t minv, int16_t maxv) { + uint8_t B, G, R; + const uint8_t maxB = 28, maxR = 28, maxG = 38; + const int16_t limv = _MAX(abs(minv), abs(maxv)); + float n = minv >= 0 ? (float)(val - minv) / (maxv - minv) : (float)val / limv; + LIMIT(n, -1, 1); + if (n < 0) { + R = 0; + G = (1 + n) * maxG; + B = (-n) * maxB; + } + else if (n < 0.5) { + R = maxR * n * 2; + G = maxG; + B = 0; + } + else { + R = maxR; + G = maxG * (1 - n); + B = 0; + } + return RGB(R, G, B); +} + +// Draw a checkbox +// Color: frame color +// bColor: Background color +// x/y: Upper-left point +// mode : 0 : unchecked, 1 : checked +void DWINUI::Draw_Checkbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t y, bool checked=false) { + DWIN_Draw_String(true, font8x16, color, bcolor, x + 4, y, checked ? F("x") : F(" ")); + DWIN_Draw_Rectangle(0, color, x + 2, y + 2, x + 17, y + 17); +} + +// Clear Menu by filling the menu area with background color +void DWINUI::ClearMainArea() { + DWIN_Draw_Rectangle(1, backcolor, 0, TITLE_HEIGHT, DWIN_WIDTH - 1, STATUS_Y - 1); +} + +#endif // DWIN_CREALITY_LCD_JYERSUI diff --git a/Marlin/src/lcd/e3v2/jyersui/dwinui.h b/Marlin/src/lcd/e3v2/jyersui/dwinui.h new file mode 100644 index 000000000000..779e6270a128 --- /dev/null +++ b/Marlin/src/lcd/e3v2/jyersui/dwinui.h @@ -0,0 +1,527 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * DWIN Enhanced implementation for PRO UI + * Author: Miguel A. Risco-Castillo (MRISCOC) + * Version: 3.17.1 + * Date: 2022/04/12 + * + * Modded for JYERSUI by LCH-77 + * Version: 1.9 + * Date: Jun 16, 2022 + */ + +#include "dwin_lcd.h" +#include "../common/dwin_set.h" +#include "../common/dwin_font.h" +#include "../common/dwin_color.h" +#include "../common/dwin_api.h" + +// Custom icons +//#define DWIN_CREALITY_LCD_CUSTOM_ICONS +#if ENABLED(DWIN_CREALITY_LCD_CUSTOM_ICONS) + // index of every custom icon should be >= CUSTOM_ICON_START + #define CUSTOM_ICON_START ICON_Checkbox_F + #define ICON_Checkbox_F 200 + #define ICON_Checkbox_T 201 + #define ICON_Fade 202 + #define ICON_Mesh 203 + #define ICON_Tilt 204 + #define ICON_Brightness 205 + #define ICON_AxisD 249 + #define ICON_AxisBR 250 + #define ICON_AxisTR 251 + #define ICON_AxisBL 252 + #define ICON_AxisTL 253 + #define ICON_AxisC 254 +#else + #define ICON_Fade ICON_Version + #define ICON_Mesh ICON_Version + #define ICON_Tilt ICON_Version + #define ICON_Brightness ICON_Version + #define ICON_AxisD ICON_Axis + #define ICON_AxisBR ICON_Axis + #define ICON_AxisTR ICON_Axis + #define ICON_AxisBL ICON_Axis + #define ICON_AxisTL ICON_Axis + #define ICON_AxisC ICON_Axis + #define ICON_ESDiag ICON_Info + #define ICON_Lock ICON_Cool + #define ICON_Reboot ICON_ResumeEEPROM + #define ICON_ProbeAlarm ICON_SetEndTemp + #define ICON_ProbeMargin ICON_PrintSize + #define ICON_ProbeSelfTest ICON_SetEndTemp + #define ICON_ProbeSet ICON_SetEndTemp + #define ICON_ProbeDeploy ICON_SetEndTemp + #define ICON_ProbeTest ICON_SetEndTemp + #define ICON_ProbeTestCount ICON_SetEndTemp + #define ICON_ProbeZSpeed ICON_MaxSpeedZ + #define ICON_FWRetLength ICON_StepE + #define ICON_FWRetSpeed ICON_Setspeed + #define ICON_FWRetZRaise ICON_MoveZ + #define ICON_FWRecExtLength ICON_StepE + #define ICON_FWRecSpeed ICON_Setspeed + #define ICON_HSMode ICON_StockConfiguration + #define ICON_Sound ICON_Cool + #define ICON_CaseLight ICON_Motion + #define ICON_LedControl ICON_Motion + #define ICON_MeshActive ICON_HotendTemp + #define ICON_Park ICON_Motion +#endif + +// Buttons +#define BTN_Continue 85 +#define BTN_Cancel 87 +#define BTN_Confirm 89 +#define BTN_Print 90 +#define BTN_Save 91 +#define BTN_Purge 92 + +// Extended UI Colors +#define Color_Aqua RGB(0,63,31) +#define Color_Light_White 0xBDD7 +#define Color_Green RGB(0,63,0) +#define Color_Light_Green 0x3460 +#define Color_Cyan 0x07FF +#define Color_Light_Cyan 0x04F3 +#define Color_Blue RGB(0,0,31) +#define Color_Light_Blue 0x3A6A +#define Color_Magenta 0xF81F +#define Color_Light_Magenta 0x9813 +#define Color_Light_Red 0x8800 +#define Color_Orange 0xFA20 +#define Color_Light_Orange 0xFBC0 +#define Color_Light_Yellow 0x8BE0 +#define Color_Brown 0xCC27 +#define Color_Light_Brown 0x6204 +#define Color_Black 0x0000 +#define Color_Grey 0x18E3 +#define Check_Color 0x4E5C +#define Confirm_Color 0x34B9 +#define Cancel_Color 0x3186 + +// UI element defines and constants +#define DWIN_FONT_MENU font8x16 +#define DWIN_FONT_STAT font10x20 +#define DWIN_FONT_HEAD font10x20 +#define DWIN_FONT_ALERT font10x20 +#define STATUS_Y 354 +#define LCD_WIDTH (DWIN_WIDTH / 8) // only if the default font is font8x16 + +// Minimum unit (0.1) : multiple (10) +#define UNITFDIGITS 1 +#define MINUNITMULT POW(10, UNITFDIGITS) + +constexpr uint8_t TITLE_HEIGHT = 30, // Title bar height + MLINE = 53, // Menu line height + TROWS = (STATUS_Y - TITLE_HEIGHT) / MLINE, // Total rows + MROWS = TROWS - 1, // Other-than-Back + ICOX = 26, // Menu item icon X position + LBLX = 60, // Menu item label X position + VALX = 210, // Menu item value X position + MENU_CHR_W = 8, MENU_CHR_H = 16, // Menu font 8x16 + STAT_CHR_W = 10; + +// Menuitem Y position +#define MYPOS(L) (TITLE_HEIGHT + MLINE * (L)) + +// Menuitem caption Offset +#define CAPOFF ((MLINE - MENU_CHR_H) / 2) + +// Menuitem caption Y position +#define MBASE(L) (MYPOS(L) + CAPOFF) + +typedef struct { uint16_t left, top, right, bottom; } rect_t; +typedef struct { uint16_t x, y, w, h; } frame_rect_t; + +namespace DWINUI { + extern xy_int_t cursor; + extern uint16_t pencolor; + extern uint16_t textcolor; + extern uint16_t backcolor; + extern uint16_t buttoncolor; + extern uint8_t font; + extern FSTR_P const Author; + + // DWIN LCD Initialization + void init(); + + // Set text/number font + void setFont(uint8_t cfont); + + // Get font character width + uint8_t fontWidth(uint8_t cfont); + inline uint8_t fontWidth() { return fontWidth(font); }; + + // Get font character height + uint8_t fontHeight(uint8_t cfont); + inline uint8_t fontHeight() { return fontHeight(font); }; + + // Get screen x coordinates from text column + uint16_t ColToX(uint8_t col); + + // Get screen y coordinates from text row + uint16_t RowToY(uint8_t row); + + // Set text/number color + void SetColors(uint16_t fgcolor, uint16_t bgcolor, uint16_t alcolor); + void SetTextColor(uint16_t fgcolor); + void SetBackgroundColor(uint16_t bgcolor); + + // Moves cursor to point + // x: abscissa of the display + // y: ordinate of the display + // point: xy coordinate + void MoveTo(int16_t x, int16_t y); + void MoveTo(xy_int_t point); + + // Moves cursor relative to the actual position + // x: abscissa of the display + // y: ordinate of the display + // point: xy coordinate + void MoveBy(int16_t x, int16_t y); + void MoveBy(xy_int_t point); + + // Draw a line from the cursor to xy position + // color: Line segment color + // x/y: End point + inline void LineTo(uint16_t color, uint16_t x, uint16_t y) { + DWIN_Draw_Line(color, cursor.x, cursor.y, x, y); + } + inline void LineTo(uint16_t x, uint16_t y) { + DWIN_Draw_Line(pencolor, cursor.x, cursor.y, x, y); + } + + // Extend a frame box + // v: value to extend + inline frame_rect_t ExtendFrame(frame_rect_t frame, uint8_t v) { + frame_rect_t t; + t.x = frame.x - v; + t.y = frame.y - v; + t.w = frame.w + 2 * v; + t.h = frame.h + 2 * v; + return t; + } + + // Draw an Icon with transparent background from the library ICON + // icon: Icon ID + // x/y: Upper-left point + inline void Draw_Icon(uint8_t icon, uint16_t x, uint16_t y) { + DWIN_ICON_Show(ICON, icon, x, y); + } + + // Draw an Icon from the library ICON with its background + // icon: Icon ID + // x/y: Upper-left point + inline void Draw_IconWB(uint8_t icon, uint16_t x, uint16_t y) { + DWIN_ICON_Show(true, false, false, ICON, icon, x, y); + } + inline void DRAW_IconWB(uint8_t libID, uint8_t icon, uint16_t x, uint16_t y) { + DWIN_ICON_Show(true, false, false, libID, icon, x, y); + } + + // Draw a numeric integer value + // bShow: true=display background color; false=don't display background color + // signedMode: 1=signed; 0=unsigned + // size: Font size + // color: Character color + // bColor: Background color + // iNum: Number of digits + // x/y: Upper-left coordinate + // value: Integer value + void Draw_Int(uint8_t bShow, bool signedMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value); + + // Draw a positive integer + inline void Draw_Int(uint8_t bShow, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { + Draw_Int(bShow, 0, size, color, bColor, iNum, x, y, value); + } + inline void Draw_Int(uint8_t iNum, long value) { + Draw_Int(false, 0, font, textcolor, backcolor, iNum, cursor.x, cursor.y, value); + MoveBy(iNum * fontWidth(font), 0); + } + inline void Draw_Int(uint8_t iNum, uint16_t x, uint16_t y, long value) { + Draw_Int(false, 0, font, textcolor, backcolor, iNum, x, y, value); + } + inline void Draw_Int(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) { + Draw_Int(false, 0, font, color, backcolor, iNum, x, y, value); + } + inline void Draw_Int(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { + Draw_Int(true, 0, font, color, bColor, iNum, x, y, value); + } + inline void Draw_Int(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { + Draw_Int(true, 0, size, color, bColor, iNum, x, y, value); + } + + // Draw a signed integer + inline void Draw_Signed_Int(uint8_t bShow, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { + Draw_Int(bShow, 1, size, color, bColor, iNum, x, y, value); + } + inline void Draw_Signed_Int(uint8_t iNum, long value) { + Draw_Int(false, 1, font, textcolor, backcolor, iNum, cursor.x, cursor.y, value); + MoveBy(iNum * fontWidth(font), 0); + } + inline void Draw_Signed_Int(uint8_t iNum, uint16_t x, uint16_t y, long value) { + Draw_Int(false, 1, font, textcolor, backcolor, iNum, x, y, value); + } + inline void Draw_Signed_Int(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) { + Draw_Int(false, 1, font, color, backcolor, iNum, x, y, value); + } + inline void Draw_Signed_Int(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { + Draw_Int(true, 1, font, color, bColor, iNum, x, y, value); + } + inline void Draw_Signed_Int(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { + Draw_Int(true, 1, size, color, bColor, iNum, x, y, value); + } + + // Draw a numeric float value + // bShow: true=display background color; false=don't display background color + // signedMode: 1=signed; 0=unsigned + // size: Font size + // color: Character color + // bColor: Background color + // iNum: Number of digits + // fNum: Number of decimal digits + // x/y: Upper-left coordinate + // value: float value + void Draw_Float(uint8_t bShow, bool signedMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value); + + // Draw a positive floating point number + inline void Draw_Float(uint8_t bShow, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + Draw_Float(bShow, 0, size, color, bColor, iNum, fNum, x, y, value); + } + inline void Draw_Float(uint8_t iNum, uint8_t fNum, float value) { + Draw_Float(false, 0, font, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value); + MoveBy((iNum + fNum + 1) * fontWidth(font), 0); + } + inline void Draw_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + Draw_Float(false, 0, font, textcolor, backcolor, iNum, fNum, x, y, value); + } + inline void Draw_Float(uint8_t size, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + Draw_Float(false, 0, size, textcolor, backcolor, iNum, fNum, x, y, value); + } + inline void Draw_Float(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + Draw_Float(true, 0, font, color, bColor, iNum, fNum, x, y, value); + } + inline void Draw_Float(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + Draw_Float(true, 0, size, color, bColor, iNum, fNum, x, y, value); + } + + // Draw a signed floating point number + inline void Draw_Signed_Float(uint8_t bShow, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + Draw_Float(bShow, 1, size, color, bColor, iNum, fNum, x, y, value); + } + inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, float value) { + Draw_Float(false, 1, font, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value); + MoveBy((iNum + fNum + 1) * fontWidth(font), 0); + } + inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + Draw_Float(false, 1, font, textcolor, backcolor, iNum, fNum, x, y, value); + } + inline void Draw_Signed_Float(uint8_t size, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + Draw_Float(false, 1, size, textcolor, backcolor, iNum, fNum, x, y, value); + } + inline void Draw_Signed_Float(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + Draw_Float(true, 1, font, color, bColor, iNum, fNum, x, y, value); + } + inline void Draw_Signed_Float(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + Draw_Float(true, 1, size, color, bColor, iNum, fNum, x, y, value); + } + + // Draw a char + // color: Character color + // x: abscissa of the display + // y: ordinate of the display + // c: ASCII code of char + void Draw_Char(uint16_t color, uint16_t x, uint16_t y, const char c); + inline void Draw_Char(uint16_t x, uint16_t y, const char c) { Draw_Char(textcolor, x, y, c); }; + // Draw a char at cursor position and increment cursor + void Draw_Char(uint16_t color, const char c); + inline void Draw_Char(const char c) { Draw_Char(textcolor, c); } + + // Draw a string at cursor position + // color: Character color + // *string: The string + // rlimit: For draw less chars than string length use rlimit + void Draw_String(const char * const string, uint16_t rlimit = 0xFFFF); + void Draw_String(uint16_t color, const char * const string, uint16_t rlimit = 0xFFFF); + inline void Draw_String(FSTR_P string, uint16_t rlimit = 0xFFFF) { + Draw_String(FTOP(string), rlimit); + } + inline void Draw_String(uint16_t color, FSTR_P string, uint16_t rlimit = 0xFFFF) { + Draw_String(color, FTOP(string), rlimit); + } + + // Draw a string + // size: Font size + // color: Character color + // bColor: Background color + // x/y: Upper-left coordinate of the string + // *string: The string + inline void Draw_String(uint16_t x, uint16_t y, const char * const string) { + DWIN_Draw_String(false, font, textcolor, backcolor, x, y, string); + } + inline void Draw_String(uint16_t x, uint16_t y, FSTR_P title) { + DWIN_Draw_String(false, font, textcolor, backcolor, x, y, FTOP(title)); + } + inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, const char * const string) { + DWIN_Draw_String(false, font, color, backcolor, x, y, string); + } + inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, FSTR_P title) { + DWIN_Draw_String(false, font, color, backcolor, x, y, title); + } + inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) { + DWIN_Draw_String(true, font, color, bgcolor, x, y, string); + } + inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) { + DWIN_Draw_String(true, font, color, bgcolor, x, y, title); + } + inline void Draw_String(uint8_t size, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) { + DWIN_Draw_String(true, size, color, bgcolor, x, y, string); + } + inline void Draw_String(uint8_t size, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) { + DWIN_Draw_String(true, size, color, bgcolor, x, y, title); + } + + // Draw a centered string using DWIN_WIDTH + // bShow: true=display background color; false=don't display background color + // size: Font size + // color: Character color + // bColor: Background color + // y: Upper coordinate of the string + // *string: The string + void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string); + inline void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, const char * const string) { + Draw_CenteredString(bShow, size, color, bColor, 0, DWIN_WIDTH, y, string); + } + inline void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, FSTR_P string) { + Draw_CenteredString(bShow, size, color, bColor, y, FTOP(string)); + } + inline void Draw_CenteredString(uint16_t color, uint16_t bcolor, uint16_t y, const char * const string) { + Draw_CenteredString(true, font, color, bcolor, y, string); + } + inline void Draw_CenteredString(uint8_t size, uint16_t color, uint16_t y, const char * const string) { + Draw_CenteredString(false, size, color, backcolor, y, string); + } + inline void Draw_CenteredString(uint8_t size, uint16_t color, uint16_t y, FSTR_P title) { + Draw_CenteredString(false, size, color, backcolor, y, title); + } + inline void Draw_CenteredString(uint16_t color, uint16_t y, const char * const string) { + Draw_CenteredString(false, font, color, backcolor, y, string); + } + inline void Draw_CenteredString(uint16_t color, uint16_t y, FSTR_P title) { + Draw_CenteredString(false, font, color, backcolor, y, title); + } + inline void Draw_CenteredString(uint16_t y, const char * const string) { + Draw_CenteredString(false, font, textcolor, backcolor, y, string); + } + inline void Draw_CenteredString(uint16_t y, FSTR_P title) { + Draw_CenteredString(false, font, textcolor, backcolor, y, title); + } + + // Draw a box + // mode: 0=frame, 1=fill, 2=XOR fill + // color: Rectangle color + // frame: Box coordinates and size + inline void Draw_Box(uint8_t mode, uint16_t color, frame_rect_t frame) { + DWIN_Draw_Box(mode, color, frame.x, frame.y, frame.w, frame.h); + } + + // Draw a circle + // Color: circle color + // x: abscissa of the center of the circle + // y: ordinate of the center of the circle + // r: circle radius + void Draw_Circle(uint16_t color, uint16_t x,uint16_t y,uint8_t r); + inline void Draw_Circle(uint16_t color, uint8_t r) { + Draw_Circle(color, cursor.x, cursor.y, r); + } + + // Draw a checkbox + // Color: frame color + // bColor: Background color + // x/y: Upper-left point + // checked : 0 : unchecked, 1 : checked + void Draw_Checkbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t y, bool checked); + inline void Draw_Checkbox(uint16_t x, uint16_t y, bool checked=false) { + Draw_Checkbox(textcolor, backcolor, x, y, checked); + } + + // Color Interpolator + // val : Interpolator minv..maxv + // minv : Minimum value + // maxv : Maximum value + // color1 : Start color + // color2 : End color + uint16_t ColorInt(int16_t val, int16_t minv, int16_t maxv, uint16_t color1, uint16_t color2); + + // ------------------------- Buttons ------------------------------// + + void Draw_Button(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char * const caption); + inline void Draw_Button(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, FSTR_P caption) { + Draw_Button(color, bcolor, x1, y1, x2, y2, FTOP(caption)); + } + inline void Draw_Button(FSTR_P caption, uint16_t x, uint16_t y) { + Draw_Button(textcolor, buttoncolor, x, y, x + 99, y + 37, caption); + } + void Draw_Button(uint8_t id, uint16_t x, uint16_t y); + + // -------------------------- Extra -------------------------------// + + // Draw a circle filled with color + // bcolor: fill color + // x: abscissa of the center of the circle + // y: ordinate of the center of the circle + // r: circle radius + void Draw_FillCircle(uint16_t bcolor, uint16_t x,uint16_t y,uint8_t r); + inline void Draw_FillCircle(uint16_t bcolor, uint8_t r) { + Draw_FillCircle(bcolor, cursor.x, cursor.y, r); + } + + // Color Interpolator through Red->Yellow->Green->Blue + // val : Interpolator minv..maxv + // minv : Minimum value + // maxv : Maximum value + uint16_t RainbowInt(int16_t val, int16_t minv, int16_t maxv); + + // Write buffer data to the SRAM + // addr: SRAM start address 0x0000-0x7FFF + // length: Bytes to write + // data: address of the buffer with data + inline void WriteToSRAM(uint16_t addr, uint16_t length, uint8_t *data) { + DWIN_WriteToMem(0x5A, addr, length, data); + } + + // Write buffer data to the Flash + // addr: Flash start address 0x0000-0x3FFF + // length: Bytes to write + // data: address of the buffer with data + inline void WriteToFlash(uint16_t addr, uint16_t length, uint8_t *data) { + DWIN_WriteToMem(0xA5, addr, length, data); + } + + // Clear by filling the area with background color + // Area (0, TITLE_HEIGHT, DWIN_WIDTH, STATUS_Y - 1) + void ClearMainArea(); + +}; diff --git a/Marlin/src/lcd/e3v2/jyersui/endstop_diag.cpp b/Marlin/src/lcd/e3v2/jyersui/endstop_diag.cpp new file mode 100644 index 000000000000..5c4549619fb1 --- /dev/null +++ b/Marlin/src/lcd/e3v2/jyersui/endstop_diag.cpp @@ -0,0 +1,111 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * DWIN End Stops diagnostic page + * Author: Miguel A. Risco-Castillo + * Version: 1.0 + * Date: 2021/11/06 + * + * Modded for JYERSUI by LCH-77 + */ + +#include "../../../inc/MarlinConfigPre.h" + +#if ENABLED(DWIN_CREALITY_LCD_JYERSUI) + +#include "dwin_defines.h" + +#if HAS_ESDIAG + +#include "endstop_diag.h" +#include "dwinui.h" +#include "dwin.h" + +#if HAS_FILAMENT_SENSOR + #include "../../../feature/runout.h" +#endif + +#if HAS_BED_PROBE + #include "../../../module/probe.h" +#endif + +ESDiagClass ESDiag; + +void draw_es_label(FSTR_P const flabel=nullptr) { + DWINUI::cursor.x = 40; + if (flabel) DWINUI::Draw_String(F(flabel)); + DWINUI::Draw_String(F(": ")); + DWINUI::MoveBy(0, 25); +} + +void draw_es_state(const bool is_hit) { + const uint8_t LM = 130; + DWINUI::cursor.x = LM; + DWIN_Draw_Rectangle(1, Color_Bg_Window, LM, DWINUI::cursor.y, LM + 100, DWINUI::cursor.y + 20); + is_hit ? DWINUI::Draw_String(RGB(31,31,16), F(STR_ENDSTOP_HIT)) : DWINUI::Draw_String(RGB(16,63,16), F(STR_ENDSTOP_OPEN)); + DWINUI::MoveBy(0, 25); +} + +void ESDiagClass::Draw() { + CrealityDWINClass::Clear_Screen(1); + CrealityDWINClass::Draw_Title(F("End-stops Diagnostic")); + DWINUI::ClearMainArea(); + DWIN_Draw_Rectangle(0, Color_White, 14, 60, 258, 330); + DWINUI::Draw_Button(BTN_Continue, 86, 250); + DWINUI::cursor.y = 80; + #define ES_LABEL(S) draw_es_label(F(STR_##S)) + #if HAS_X_MIN + ES_LABEL(X_MIN); + #endif + #if HAS_Y_MIN + ES_LABEL(Y_MIN); + #endif + #if HAS_Z_MIN + ES_LABEL(Z_MIN); + #endif + #if HAS_FILAMENT_SENSOR + draw_es_label(F(STR_FILAMENT)); + #endif + Update(); +} + +void ESDiagClass::Update() { + DWINUI::cursor.y = 80; + #define ES_REPORT(S) draw_es_state(READ(S##_PIN) != S##_ENDSTOP_INVERTING) + #if HAS_X_MIN + ES_REPORT(X_MIN); + #endif + #if HAS_Y_MIN + ES_REPORT(Y_MIN); + #endif + #if HAS_Z_MIN + ES_REPORT(Z_MIN); + #endif + #if HAS_FILAMENT_SENSOR + draw_es_state(READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE); + #endif + DWIN_UpdateLCD(); +} + +#endif // HAS_ES_DIAG +#endif // DWIN_CREALITY_LCD_JYERSUI diff --git a/Marlin/src/lcd/e3v2/jyersui/endstop_diag.h b/Marlin/src/lcd/e3v2/jyersui/endstop_diag.h new file mode 100644 index 000000000000..59509739d047 --- /dev/null +++ b/Marlin/src/lcd/e3v2/jyersui/endstop_diag.h @@ -0,0 +1,39 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * DWIN End Stops diagnostic page + * Author: Miguel A. Risco-Castillo + * Version: 1.0 + * Date: 2021/11/06 + * + * Modded for JYERSUI by LCH-77 + */ + +class ESDiagClass { +public: + void Draw(); + void Update(); +}; + +extern ESDiagClass ESDiag; diff --git a/Marlin/src/lcd/e3v2/jyersui/gcode_preview.cpp b/Marlin/src/lcd/e3v2/jyersui/gcode_preview.cpp new file mode 100644 index 000000000000..26037a9ce9ba --- /dev/null +++ b/Marlin/src/lcd/e3v2/jyersui/gcode_preview.cpp @@ -0,0 +1,244 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * DWIN G-code thumbnail preview + * Author: Miguel A. Risco-Castillo + * version: 2.1 + * Date: 2021/06/19 + * + * Modded for JYERSUI by LCH-77 + */ + +#include "../../../inc/MarlinConfigPre.h" +#if ENABLED(DWIN_CREALITY_LCD_JYERSUI) + +#include "dwin_defines.h" + +#if HAS_GCODE_PREVIEW + +#include "../../../core/types.h" +#include "../../marlinui.h" +#include "../../../sd/cardreader.h" +#include "../../../MarlinCore.h" // for wait_for_user +#include "dwin_lcd.h" +#include "dwinui.h" +#include "dwin.h" +#include "base64.hpp" +#include "gcode_preview.h" + +typedef struct { + char name[13] = ""; //8.3 + null + uint32_t thumbstart = 0; + int thumbsize = 0; + int thumbheight = 0; + int thumbwidth = 0; + uint8_t *thumbdata = nullptr; + float time = 0; + float filament = 0; + float layer = 0; + float width = 0; + float height = 0; + float length = 0; + void setname(const char * const fn); + void clear(); +} fileprop_t; +fileprop_t fileprop; + +void fileprop_t::setname(const char * const fn) { + const uint8_t len = _MIN(sizeof(name) - 1, strlen(fn)); + memcpy(&name[0], fn, len); + name[len] = '\0'; +} + +void fileprop_t::clear() { + fileprop.name[0] = '\0'; + fileprop.thumbstart = 0; + fileprop.thumbsize = 0; + fileprop.thumbheight = 0; + fileprop.thumbwidth = 0; + fileprop.thumbdata = nullptr; + fileprop.time = 0; + fileprop.filament = 0; + fileprop.layer = 0; + fileprop.height = 0; + fileprop.width = 0; + fileprop.length = 0; +} + +void Get_Value(char *buf, const char * const key, float &value) { + char num[10] = ""; + char * posptr = 0; + uint8_t i = 0; + if (!!value) return; + posptr = strstr(buf, key); + if (posptr != nullptr) { + while (i < sizeof(num)) { + char c = posptr[0]; + if (!ISEOL(c) && (c != 0)) { + if ((c > 47 && c < 58) || (c == '.')) num[i++] = c; + posptr++; + } + else { + num[i] = '\0'; + value = atof(num); + return; + } + } + } +} + +bool Has_Preview() { + const char * tbstart = "; thumbnail begin 230x180"; + char * posptr = 0; + uint8_t nbyte = 1; + uint32_t indx = 0; + char buf[256]; + float tmp = 0; + + fileprop.clear(); + fileprop.setname(card.filename); + + card.openFileRead(fileprop.name); + + while ((nbyte > 0) && (indx < 4 * sizeof(buf)) && !fileprop.thumbstart) { + nbyte = card.read(buf, sizeof(buf) - 1); + if (nbyte > 0) { + buf[nbyte] = '\0'; + Get_Value(buf, ";TIME:", fileprop.time); + Get_Value(buf, ";Filament used:", fileprop.filament); + Get_Value(buf, ";Layer height:", fileprop.layer); + Get_Value(buf, ";MINX:", tmp); + Get_Value(buf, ";MAXX:", fileprop.width); + fileprop.width -= tmp; + tmp = 0; + Get_Value(buf, ";MINY:", tmp); + Get_Value(buf, ";MAXY:", fileprop.length); + fileprop.length -= tmp; + tmp = 0; + Get_Value(buf, ";MINZ:", tmp); + Get_Value(buf, ";MAXZ:", fileprop.height); + fileprop.height -= tmp; + posptr = strstr(buf, tbstart); + if (posptr != NULL) { + fileprop.thumbstart = indx + (posptr - &buf[0]); + } + else { + indx += _MAX(10, nbyte - (signed)strlen(tbstart)); + card.setIndex(indx); + } + } + } + + if (!fileprop.thumbstart) { + card.closefile(); + LCD_MESSAGE_F("Thumbnail not found"); + return 0; + } + + // Get the size of the thumbnail + card.setIndex(fileprop.thumbstart + strlen(tbstart)); + for (uint8_t i = 0; i < 16; i++) { + char c = card.get(); + if (!ISEOL(c)) { + buf[i] = c; + } + else { + buf[i] = '\0'; + break; + } + } + fileprop.thumbsize = atoi(buf); + + // Exit if there isn't a thumbnail + if (!fileprop.thumbsize) { + card.closefile(); + LCD_MESSAGE_F("Invalid Thumbnail Size"); + return 0; + } + + uint16_t readed = 0; + uint8_t buf64[fileprop.thumbsize]; + + fileprop.thumbdata = new uint8_t[3 + 3 * (fileprop.thumbsize / 4)]; // Reserve space for the JPEG thumbnail + + while (readed < fileprop.thumbsize) { + uint8_t c = card.get(); + if (!ISEOL(c) && (c != ';') && (c != ' ')) { + buf64[readed] = c; + readed++; + } + } + card.closefile(); + buf64[readed] = 0; + + fileprop.thumbsize = decode_base64(buf64, fileprop.thumbdata); card.closefile(); + DWINUI::WriteToSRAM(0x00, fileprop.thumbsize, fileprop.thumbdata); + delete[] fileprop.thumbdata; + return true; +} + +void Preview_DrawFromSD() { + bool _has_preview = Has_Preview(); + CrealityDWIN.Popup_Handler(PrintConfirm, _has_preview); + if (_has_preview) { + char buf[46]; + char str_1[6] = "", str_2[6] = "", str_3[6] = ""; + // DWIN_Draw_Rectangle(1, Def_Background_Color, 0, 0, DWIN_WIDTH, STATUS_Y - 1); + if (fileprop.time) { + sprintf_P(buf, PSTR("Estimated time: %i:%02i"), (uint16_t)fileprop.time / 3600, ((uint16_t)fileprop.time % 3600) / 60); + DWINUI::Draw_String(20, 10, buf); + } + if (fileprop.filament) { + sprintf_P(buf, PSTR("Filament used: %s m"), dtostrf(fileprop.filament, 1, 2, str_1)); + DWINUI::Draw_String(20, 30, buf); + } + if (fileprop.layer) { + sprintf_P(buf, PSTR("Layer height: %s mm"), dtostrf(fileprop.layer, 1, 2, str_1)); + DWINUI::Draw_String(20, 50, buf); + } + if (fileprop.width) { + sprintf_P(buf, PSTR("Volume: %sx%sx%s mm"), dtostrf(fileprop.width, 1, 1, str_1), dtostrf(fileprop.length, 1, 1, str_2), dtostrf(fileprop.height, 1, 1, str_3)); + DWINUI::Draw_String(20, 70, buf); + } + // DWINUI::Draw_Button(BTN_Print, 26, 290); + // DWINUI::Draw_Button(BTN_Cancel, 146, 290); + DWIN_ICON_Show(0, 0, 1, 21, 90, 0x00); + // Draw_Select_Highlight(true, 290); + DWIN_UpdateLCD(); + } + // else { + // HMI_flag.select_flag = 1; + // wait_for_user = false; + // } +} + +bool Preview_Valid() { + return !!fileprop.thumbstart; +} + +void Preview_Reset() { + fileprop.thumbsize = 0; +} + +#endif // HAS_GCODE_PREVIEW +#endif // DWIN_LCD_PROUI diff --git a/Marlin/src/lcd/e3v2/jyersui/gcode_preview.h b/Marlin/src/lcd/e3v2/jyersui/gcode_preview.h new file mode 100644 index 000000000000..d10663e08bb0 --- /dev/null +++ b/Marlin/src/lcd/e3v2/jyersui/gcode_preview.h @@ -0,0 +1,34 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * DWIN G-code thumbnail preview + * Author: Miguel A. Risco-Castillo + * version: 2.1 + * Date: 2021/06/19 + */ + +#pragma once + +void Preview_DrawFromSD(); +bool Preview_Valid(); +void Preview_Reset(); diff --git a/Marlin/src/lcd/e3v2/jyersui/lockscreen.cpp b/Marlin/src/lcd/e3v2/jyersui/lockscreen.cpp new file mode 100644 index 000000000000..5ed6dd3317b1 --- /dev/null +++ b/Marlin/src/lcd/e3v2/jyersui/lockscreen.cpp @@ -0,0 +1,83 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * Lock screen implementation for PRO UI + * Author: Miguel A. Risco-Castillo (MRISCOC) + * Version: 2.2.0 + * Date: 2022/04/11 + * + * Modded for JYERSUI by LCH-77 + */ + +#include "../../../inc/MarlinConfigPre.h" + +#if ENABLED(DWIN_CREALITY_LCD_JYERSUI) + +#include "dwin_defines.h" + +#if HAS_LOCKSCREEN + +#include "../common/dwin_color.h" +#include "dwinui.h" +#include "dwin.h" +#include "lockscreen.h" + +LockScreenClass lockScreen; + +uint8_t LockScreenClass::lock_pos = 0; +bool LockScreenClass::unlocked = false; +uint8_t LockScreenClass::rprocess = 0; + +void LockScreenClass::init() { + lock_pos = 0; + unlocked = false; + draw(); +} + +void LockScreenClass::draw() { + CrealityDWINClass::Clear_Screen(1); + CrealityDWINClass::Draw_Title(GET_TEXT_F(MSG_LOCKSCREEN)); + DWINUI::ClearMainArea(); + DWINUI::Draw_Icon(ICON_LOGO, 71, 120); // CREALITY logo + DWINUI::Draw_CenteredString(Color_White, 180, GET_TEXT_F(MSG_LOCKSCREEN_LOCKED)); + DWINUI::Draw_CenteredString(Color_White, 200, GET_TEXT_F(MSG_LOCKSCREEN_UNLOCK)); + DWINUI::Draw_CenteredString(Color_White, 240, F("-> | <-")); + DWIN_Draw_Box(1, BarFill_Color, 0, 260, DWIN_WIDTH, 20); + DWIN_Draw_VLine(Color_Yellow, lock_pos * DWIN_WIDTH / 255, 260, 20); + DWIN_UpdateLCD(); +} + +void LockScreenClass::onEncoder(EncoderState encoder_diffState) { + switch (encoder_diffState) { + case ENCODER_DIFF_CW: lock_pos += 8; break; + case ENCODER_DIFF_CCW: lock_pos -= 8; break; + case ENCODER_DIFF_ENTER: unlocked = (lock_pos == 128); break; + default: break; + } + DWIN_Draw_Box(1, BarFill_Color, 0, 260, DWIN_WIDTH, 20); + DWIN_Draw_VLine(Color_Yellow, lock_pos * DWIN_WIDTH / 255, 260, 20); + DWIN_UpdateLCD(); +} + +#endif // HAS_LOCKSCREEN +#endif // DWIN_CREALITY_LCD_JYERSUI diff --git a/Marlin/src/lcd/e3v2/jyersui/lockscreen.h b/Marlin/src/lcd/e3v2/jyersui/lockscreen.h new file mode 100644 index 000000000000..99c22a37da23 --- /dev/null +++ b/Marlin/src/lcd/e3v2/jyersui/lockscreen.h @@ -0,0 +1,49 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * Lock screen implementation for PRO UI + * Author: Miguel A. Risco-Castillo (MRISCOC) + * Version: 2.2.0 + * Date: 2022/04/11 + * + * Modded for JYERSUI by LCH-77 + */ + +#include "../../../core/types.h" +#include "../common/encoder.h" +#include + +class LockScreenClass { +private: + static bool unlocked; + static uint8_t lock_pos; +public: + static uint8_t rprocess; + static void init(); + static void onEncoder(EncoderState encoder_diffState); + static void draw(); + static bool isUnlocked() { return unlocked; } +}; + +extern LockScreenClass lockScreen; diff --git a/Marlin/src/lcd/e3v2/jyersui/plot.cpp b/Marlin/src/lcd/e3v2/jyersui/plot.cpp new file mode 100644 index 000000000000..c0c283f5c0be --- /dev/null +++ b/Marlin/src/lcd/e3v2/jyersui/plot.cpp @@ -0,0 +1,86 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * DWIN Single var plot + * Author: Miguel A. Risco-Castillo + * Version: 2.0 + * Date: 2022/01/31 + * + * Modded for JYERSUI by LCH-77 + */ + +#include "../../../inc/MarlinConfigPre.h" + +#ifdef DWIN_CREALITY_LCD_JYERSUI + +#include "dwin_defines.h" + +#ifdef HAS_PIDPLOT + +#include "plot.h" + +#include "../../../core/types.h" +#include "../../marlinui.h" +#include "dwin_lcd.h" +#include "dwinui.h" +#include "dwin.h" + +#define Plot_Bg_Color RGB( 1, 12, 8) + +PlotClass Plot; + +uint16_t grphpoints, r, x2, y2 = 0; +frame_rect_t grphframe = {0}; +float scale = 0; + +void PlotClass::Draw(const frame_rect_t frame, const float max, const float ref) { + grphframe = frame; + grphpoints = 0; + scale = frame.h / max; + x2 = frame.x + frame.w - 1; + y2 = frame.y + frame.h - 1; + r = round((y2) - ref * scale); + DWINUI::Draw_Box(1, Plot_Bg_Color, frame); + for (uint8_t i = 1; i < 4; i++) if (i*50 < frame.w) DWIN_Draw_VLine(Line_Color, i*50 + frame.x, frame.y, frame.h); + DWINUI::Draw_Box(0, Color_White, DWINUI::ExtendFrame(frame, 1)); + DWIN_Draw_HLine(Color_Red, frame.x, r, frame.w); +} + +void PlotClass::Update(const float value) { + if (!scale) return; + uint16_t y = round((y2) - value * scale); + if (grphpoints < grphframe.w) { + DWIN_Draw_Point(Color_Yellow, 1, 1, grphpoints + grphframe.x, y); + } + else { + DWIN_Frame_AreaMove(1, 0, 1, Plot_Bg_Color, grphframe.x, grphframe.y, x2, y2); + if ((grphpoints % 50) == 0) DWIN_Draw_VLine(Line_Color, x2 - 1, grphframe.y + 1, grphframe.h - 2); + DWIN_Draw_Point(Color_Red, 1, 1, x2 - 1, r); + DWIN_Draw_Point(Color_Yellow, 1, 1, x2 - 1, y); + } + grphpoints++; +} + +#endif // HAS_PIDPLOT + +#endif // DWIN_CREALITY_LCD_JYERSUI diff --git a/Marlin/src/lcd/e3v2/jyersui/plot.h b/Marlin/src/lcd/e3v2/jyersui/plot.h new file mode 100644 index 000000000000..1f97eafb71ba --- /dev/null +++ b/Marlin/src/lcd/e3v2/jyersui/plot.h @@ -0,0 +1,41 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * DWIN Single var plot + * Author: Miguel A. Risco-Castillo + * Version: 1.0 + * Date: 2022/01/30 + * + * Modded for JYERSUI by LCH-77 + */ + +#include "dwinui.h" + +class PlotClass { +public: + void Draw(frame_rect_t frame, float max, float ref = 0); + void Update(float value); +}; + +extern PlotClass Plot; diff --git a/Marlin/src/lcd/e3v2/proui/base64.hpp b/Marlin/src/lcd/e3v2/proui/base64.hpp index d82d0b27e8ac..7a933df321b8 100644 --- a/Marlin/src/lcd/e3v2/proui/base64.hpp +++ b/Marlin/src/lcd/e3v2/proui/base64.hpp @@ -152,7 +152,7 @@ uint16_t encode_base64(unsigned char input[], uint16_t input_length, unsigned ch output += 4; } - switch(input_length % 3) { + switch (input_length % 3) { case 0: output[0] = '\0'; break; @@ -192,7 +192,7 @@ uint16_t decode_base64(unsigned char input[], uint16_t input_length, unsigned ch output += 3; } - switch(output_length % 3) { + switch (output_length % 3) { case 1: output[0] = base64_to_binary(input[0]) << 2 | base64_to_binary(input[1]) >> 4; break; @@ -205,4 +205,4 @@ uint16_t decode_base64(unsigned char input[], uint16_t input_length, unsigned ch return output_length; } -#endif // ifndef +#endif // BASE64_H_INCLUDED diff --git a/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp b/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp index adb23a96646b..4257728f73e3 100644 --- a/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp +++ b/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp @@ -21,7 +21,7 @@ */ /** - * DWIN g-code thumbnail preview + * DWIN G-code thumbnail preview * Author: Miguel A. Risco-Castillo * version: 2.1 * Date: 2021/06/19 @@ -214,9 +214,7 @@ bool Has_Preview() { void Preview_DrawFromSD() { if (Has_Preview()) { char buf[46]; - char str_1[6] = ""; - char str_2[6] = ""; - char str_3[6] = ""; + char str_1[6] = "", str_2[6] = "", str_3[6] = ""; DWIN_Draw_Rectangle(1, HMI_data.Background_Color, 0, 0, DWIN_WIDTH, STATUS_Y - 1); if (fileprop.time) { sprintf_P(buf, PSTR("Estimated time: %i:%02i"), (uint16_t)fileprop.time / 3600, ((uint16_t)fileprop.time % 3600) / 60); diff --git a/Marlin/src/lcd/e3v2/proui/gcode_preview.h b/Marlin/src/lcd/e3v2/proui/gcode_preview.h index 4417084a242d..97cf7fe5ac9d 100644 --- a/Marlin/src/lcd/e3v2/proui/gcode_preview.h +++ b/Marlin/src/lcd/e3v2/proui/gcode_preview.h @@ -1,5 +1,5 @@ /** - * DWIN g-code thumbnail preview + * DWIN G-code thumbnail preview * Author: Miguel A. Risco-Castillo * version: 2.1 * Date: 2021/06/19 diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 7ee3a87fce39..3d6e14b5f7f1 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -503,7 +503,7 @@ typedef struct SettingsDataStruct { #if ENABLED(DWIN_LCD_PROUI) uint8_t dwin_data[eeprom_data_size]; #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) - uint8_t dwin_settings[CrealityDWIN.eeprom_data_size]; + uint8_t dwin_settings[eeprom_data_size]; #endif // @@ -1525,7 +1525,7 @@ void MarlinSettings::postprocess() { #if ENABLED(DWIN_CREALITY_LCD_JYERSUI) { _FIELD_TEST(dwin_settings); - char dwin_settings[CrealityDWIN.eeprom_data_size] = { 0 }; + char dwin_settings[eeprom_data_size] = { 0 }; CrealityDWIN.Save_Settings(dwin_settings); EEPROM_WRITE(dwin_settings); } @@ -2497,7 +2497,7 @@ void MarlinSettings::postprocess() { } #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) { - const char dwin_settings[CrealityDWIN.eeprom_data_size] = { 0 }; + const char dwin_settings[eeprom_data_size] = { 0 }; _FIELD_TEST(dwin_settings); EEPROM_READ(dwin_settings); if (!validating) CrealityDWIN.Load_Settings(dwin_settings); diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 65b79d8bc464..f03213be1fb2 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -53,6 +53,8 @@ #include "../lcd/e3v2/creality/dwin.h" #elif ENABLED(DWIN_LCD_PROUI) #include "../lcd/e3v2/proui/dwin.h" +#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) + #include "../lcd/e3v2/jyersui/dwin.h" #endif #if ENABLED(EXTENSIBLE_UI) @@ -644,12 +646,14 @@ volatile bool Temperature::raw_temps_ready = false; TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_STARTED)); TERN_(DWIN_LCD_PROUI, DWIN_PidTuning(isbed ? PID_BED_START : PID_EXTR_START)); + TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWINClass::DWIN_PidTuning(isbed ? PID_BED_START : PID_EXTR_START)); if (target > GHV(CHAMBER_MAX_TARGET, BED_MAX_TARGET, temp_range[heater_id].maxtemp - (HOTEND_OVERSHOOT))) { SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH)); TERN_(DWIN_LCD_PROUI, DWIN_PidTuning(PID_TEMP_TOO_HIGH)); + TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWINClass::DWIN_PidTuning(PID_TEMP_TOO_HIGH)); TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH))); return; } @@ -744,6 +748,7 @@ volatile bool Temperature::raw_temps_ready = false; SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH)); TERN_(DWIN_LCD_PROUI, DWIN_PidTuning(PID_TEMP_TOO_HIGH)); + TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWINClass::DWIN_PidTuning(PID_TEMP_TOO_HIGH)); TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH))); break; } @@ -782,6 +787,7 @@ volatile bool Temperature::raw_temps_ready = false; TERN_(DWIN_CREALITY_LCD, DWIN_Popup_Temperature(0)); TERN_(DWIN_LCD_PROUI, DWIN_PidTuning(PID_TUNING_TIMEOUT)); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TUNING_TIMEOUT)); + TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWINClass::DWIN_PidTuning(PID_TUNING_TIMEOUT)); TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TIMEOUT))); SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_TIMEOUT); @@ -839,6 +845,7 @@ volatile bool Temperature::raw_temps_ready = false; TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_DONE)); TERN_(DWIN_LCD_PROUI, DWIN_PidTuning(PID_DONE)); + TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWINClass::DWIN_PidTuning(PID_DONE)); goto EXIT_M303; } @@ -857,6 +864,7 @@ volatile bool Temperature::raw_temps_ready = false; TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_DONE)); TERN_(DWIN_LCD_PROUI, DWIN_PidTuning(PID_DONE)); + TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWINClass::DWIN_PidTuning(PID_DONE)); EXIT_M303: TERN_(NO_FAN_SLOWING_IN_PID_TUNING, adaptive_fan_slowing = true); From 64aff274b4d0034a1914bb303e681fe8b1e07506 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Thu, 7 Jul 2022 00:25:23 +0000 Subject: [PATCH 238/241] [cron] Bump distribution date (2022-07-07) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 50b33e1bef4f..0c966a2f3846 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-07-06" +//#define STRING_DISTRIBUTION_DATE "2022-07-07" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index e1bc53e53200..108f0225bb72 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-07-06" + #define STRING_DISTRIBUTION_DATE "2022-07-07" #endif /** From 1497c40379185c14a93dbd0e7405baf366c8e20d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 6 Jul 2022 19:29:07 -0500 Subject: [PATCH 239/241] =?UTF-8?q?=F0=9F=93=9D=20Configurations=200201010?= =?UTF-8?q?0=20(#24458)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 177 ++++++++++++++++++++++++++++++++--- Marlin/Configuration_adv.h | 2 +- Marlin/src/inc/Version.h | 2 +- buildroot/share/git/mfconfig | 46 +-------- 4 files changed, 168 insertions(+), 59 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index ce2b8fcd6f56..88b92e1837f4 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -35,7 +35,7 @@ * * Advanced settings can be found in Configuration_adv.h */ -#define CONFIGURATION_H_VERSION 02010000 +#define CONFIGURATION_H_VERSION 02010100 //=========================================================================== //============================= Getting Started ============================= @@ -57,15 +57,6 @@ * https://www.thingiverse.com/thing:1278865 */ -//=========================================================================== -//========================== DELTA / SCARA / TPARA ========================== -//=========================================================================== -// -// Download configurations from the link above and customize for your machine. -// Examples are located in config/examples/delta, .../SCARA, and .../TPARA. -// -//=========================================================================== - // @section info // Author info of this build printed to the host during boot and M115 @@ -865,7 +856,135 @@ #define POLAR_SEGMENTS_PER_SECOND 5 #endif -// Enable for an articulated robot (robot arm). Joints are directly mapped to axes (no kinematics). +// Enable for DELTA kinematics and configure below +//#define DELTA +#if ENABLED(DELTA) + + // Make delta curves from many straight lines (linear interpolation). + // This is a trade-off between visible corners (not enough segments) + // and processor overload (too many expensive sqrt calls). + #define DELTA_SEGMENTS_PER_SECOND 200 + + // After homing move down to a height where XY movement is unconstrained + //#define DELTA_HOME_TO_SAFE_ZONE + + // Delta calibration menu + // uncomment to add three points calibration menu option. + // See http://minow.blogspot.com/index.html#4918805519571907051 + //#define DELTA_CALIBRATION_MENU + + // uncomment to add G33 Delta Auto-Calibration (Enable EEPROM_SETTINGS to store results) + //#define DELTA_AUTO_CALIBRATION + + // NOTE NB all values for DELTA_* values MUST be floating point, so always have a decimal point in them + + #if ENABLED(DELTA_AUTO_CALIBRATION) + // set the default number of probe points : n*n (1 -> 7) + #define DELTA_CALIBRATION_DEFAULT_POINTS 4 + #endif + + #if EITHER(DELTA_AUTO_CALIBRATION, DELTA_CALIBRATION_MENU) + // Set the steprate for papertest probing + #define PROBE_MANUALLY_STEP 0.05 // (mm) + #endif + + // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). + #define DELTA_PRINTABLE_RADIUS 140.0 // (mm) + + // Maximum reachable area + #define DELTA_MAX_RADIUS 140.0 // (mm) + + // Center-to-center distance of the holes in the diagonal push rods. + #define DELTA_DIAGONAL_ROD 250.0 // (mm) + + // Distance between bed and nozzle Z home position + #define DELTA_HEIGHT 250.00 // (mm) Get this value from G33 auto calibrate + + #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate + + // Horizontal distance bridged by diagonal push rods when effector is centered. + #define DELTA_RADIUS 124.0 // (mm) Get this value from G33 auto calibrate + + // Trim adjustments for individual towers + // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 + // measured in degrees anticlockwise looking from above the printer + #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate + + // Delta radius and diagonal rod adjustments (mm) + //#define DELTA_RADIUS_TRIM_TOWER { 0.0, 0.0, 0.0 } + //#define DELTA_DIAGONAL_ROD_TRIM_TOWER { 0.0, 0.0, 0.0 } +#endif + +/** + * MORGAN_SCARA was developed by QHARLEY in South Africa in 2012-2013. + * Implemented and slightly reworked by JCERNY in June, 2014. + * + * Mostly Printed SCARA is an open source design by Tyler Williams. See: + * https://www.thingiverse.com/thing:2487048 + * https://www.thingiverse.com/thing:1241491 + */ +//#define MORGAN_SCARA +//#define MP_SCARA +#if EITHER(MORGAN_SCARA, MP_SCARA) + // If movement is choppy try lowering this value + #define SCARA_SEGMENTS_PER_SECOND 200 + + // Length of inner and outer support arms. Measure arm lengths precisely. + #define SCARA_LINKAGE_1 150 // (mm) + #define SCARA_LINKAGE_2 150 // (mm) + + // SCARA tower offset (position of Tower relative to bed zero position) + // This needs to be reasonably accurate as it defines the printbed position in the SCARA space. + #define SCARA_OFFSET_X 100 // (mm) + #define SCARA_OFFSET_Y -56 // (mm) + + #if ENABLED(MORGAN_SCARA) + + //#define DEBUG_SCARA_KINEMATICS + #define SCARA_FEEDRATE_SCALING // Convert XY feedrate from mm/s to degrees/s on the fly + + // Radius around the center where the arm cannot reach + #define MIDDLE_DEAD_ZONE_R 0 // (mm) + + #define THETA_HOMING_OFFSET 0 // Calculated from Calibration Guide and M360 / M114. See http://reprap.harleystudio.co.za/?page_id=1073 + #define PSI_HOMING_OFFSET 0 // Calculated from Calibration Guide and M364 / M114. See http://reprap.harleystudio.co.za/?page_id=1073 + + #elif ENABLED(MP_SCARA) + + #define SCARA_OFFSET_THETA1 12 // degrees + #define SCARA_OFFSET_THETA2 131 // degrees + + #endif + +#endif + +// Enable for TPARA kinematics and configure below +//#define AXEL_TPARA +#if ENABLED(AXEL_TPARA) + #define DEBUG_ROBOT_KINEMATICS + #define ROBOT_SEGMENTS_PER_SECOND 200 + + // Length of inner and outer support arms. Measure arm lengths precisely. + #define ROBOT_LINKAGE_1 120 // (mm) + #define ROBOT_LINKAGE_2 120 // (mm) + + // SCARA tower offset (position of Tower relative to bed zero position) + // This needs to be reasonably accurate as it defines the printbed position in the SCARA space. + #define ROBOT_OFFSET_X 0 // (mm) + #define ROBOT_OFFSET_Y 0 // (mm) + #define ROBOT_OFFSET_Z 0 // (mm) + + #define SCARA_FEEDRATE_SCALING // Convert XY feedrate from mm/s to degrees/s on the fly + + // Radius around the center where the arm cannot reach + #define MIDDLE_DEAD_ZONE_R 0 // (mm) + + // Calculated from Calibration Guide and M360 / M114. See http://reprap.harleystudio.co.za/?page_id=1073 + #define THETA_HOMING_OFFSET 0 + #define PSI_HOMING_OFFSET 0 +#endif + +// Articulated robot (arm). Joints are directly mapped to axes with no kinematics. //#define ARTICULATED_ROBOT_ARM // For a hot wire cutter with parallel horizontal axes (X, I) where the heights of the two wire @@ -1239,9 +1358,37 @@ */ //#define SENSORLESS_PROBING -// -// For Z_PROBE_ALLEN_KEY see the Delta example configurations. -// +/** + * Allen key retractable z-probe as seen on many Kossel delta printers - https://reprap.org/wiki/Kossel#Automatic_bed_leveling_probe + * Deploys by touching z-axis belt. Retracts by pushing the probe down. + */ +//#define Z_PROBE_ALLEN_KEY +#if ENABLED(Z_PROBE_ALLEN_KEY) + // 2 or 3 sets of coordinates for deploying and retracting the spring loaded touch probe on G29, + // if servo actuated touch probe is not defined. Uncomment as appropriate for your printer/probe. + + #define Z_PROBE_ALLEN_KEY_DEPLOY_1 { 30.0, DELTA_PRINTABLE_RADIUS, 100.0 } + #define Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE XY_PROBE_FEEDRATE + + #define Z_PROBE_ALLEN_KEY_DEPLOY_2 { 0.0, DELTA_PRINTABLE_RADIUS, 100.0 } + #define Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE (XY_PROBE_FEEDRATE)/10 + + #define Z_PROBE_ALLEN_KEY_DEPLOY_3 { 0.0, (DELTA_PRINTABLE_RADIUS) * 0.75, 100.0 } + #define Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE XY_PROBE_FEEDRATE + + #define Z_PROBE_ALLEN_KEY_STOW_1 { -64.0, 56.0, 23.0 } // Move the probe into position + #define Z_PROBE_ALLEN_KEY_STOW_1_FEEDRATE XY_PROBE_FEEDRATE + + #define Z_PROBE_ALLEN_KEY_STOW_2 { -64.0, 56.0, 3.0 } // Push it down + #define Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE (XY_PROBE_FEEDRATE)/10 + + #define Z_PROBE_ALLEN_KEY_STOW_3 { -64.0, 56.0, 50.0 } // Move it up to clear + #define Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE XY_PROBE_FEEDRATE + + #define Z_PROBE_ALLEN_KEY_STOW_4 { 0.0, 0.0, 50.0 } + #define Z_PROBE_ALLEN_KEY_STOW_4_FEEDRATE XY_PROBE_FEEDRATE + +#endif // Z_PROBE_ALLEN_KEY /** * Nozzle-to-Probe offsets { X, Y, Z } @@ -1816,7 +1963,7 @@ //#define LCD_BED_TRAMMING #if ENABLED(LCD_BED_TRAMMING) - #define BED_TRAMMING_INSET_LFRB { 30, 30, 30, 30 } // (mm) Left, Front, Right, Back insets + #define BED_TRAMMING_INSET_LFRB { 30, 30, 30, 30 } // (mm) Left, Front, Right, Back insets #define BED_TRAMMING_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points #define BED_TRAMMING_Z_HOP 4.0 // (mm) Z height of nozzle between leveling points //#define BED_TRAMMING_INCLUDE_CENTER // Move to the center after the last corner diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index db664477f44c..63c3730364a9 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -30,7 +30,7 @@ * * Basic settings can be found in Configuration.h */ -#define CONFIGURATION_ADV_H_VERSION 02010000 +#define CONFIGURATION_ADV_H_VERSION 02010100 //=========================================================================== //============================= Thermal Settings ============================ diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 108f0225bb72..14152da26bef 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -52,7 +52,7 @@ * to alert users to major changes. */ -#define MARLIN_HEX_VERSION 02010000 +#define MARLIN_HEX_VERSION 02010100 #ifndef REQUIRED_CONFIGURATION_H_VERSION #define REQUIRED_CONFIGURATION_H_VERSION MARLIN_HEX_VERSION #endif diff --git a/buildroot/share/git/mfconfig b/buildroot/share/git/mfconfig index 7092bc822002..b379317d9866 100755 --- a/buildroot/share/git/mfconfig +++ b/buildroot/share/git/mfconfig @@ -110,53 +110,15 @@ if [[ $ACTION == "init" ]]; then ((COMMIT_STEPS)) && git add . >/dev/null && git commit -m "Commit for comparison" >/dev/null # Init Cartesian/SCARA/TPARA configurations to default - echo "- Initializing Cartesian/SCARA/TPARA configs to default state..." + echo "- Initializing configs to default state..." - find "$CEXA" -name $BC ! -path */delta/* -print0 \ + find "$CEXA" -name $BC -print0 \ | while read -d $'\0' F ; do cp "$CDEF/$BC" "$F" ; done - find "$CEXA" -name $AC ! -path */delta/* -print0 \ + find "$CEXA" -name $AC -print0 \ | while read -d $'\0' F ; do cp "$CDEF/$AC" "$F" ; done # DEBUG: Commit the reset for review - ((COMMIT_STEPS)) && git add . >/dev/null && git commit -m "Reset Cartesian/SCARA/TPARA configs..." >/dev/null - - # Create base Delta configurations - cp "$CDEF"/* "$CEXA/delta/generic" - - # DEBUG: Commit the reset for review - ((COMMIT_STEPS)) && git add . >/dev/null && git commit -m "Reset Generic Delta..." >/dev/null - - cp -R "$TEMP/$CEXA/delta/generic"/Conf* "$CEXA/delta/generic" - - # DEBUG: Commit Generic Delta changes for review - ((COMMIT_STEPS)) && git add . >/dev/null && git commit -m "Apply Generic Delta..." >/dev/null - - # Reset all Delta configs to the generic version - find "$CEXA/delta" -name $BC ! -path */generic/* -print0 \ - | while read -d $'\0' F ; do cp "$CEXA/delta/generic/$BC" "$F" ; done - find "$CEXA/delta" -name $AC ! -path */generic/* -print0 \ - | while read -d $'\0' F ; do cp "$CEXA/delta/generic/$AC" "$F" ; done - - # DEBUG: Commit the Delta reset for review - ((COMMIT_STEPS)) && git add . >/dev/null && git commit -m "Reset Delta configs..." >/dev/null - - # Reset all SCARA configs to the default cartesian - find "$CEXA/SCARA" -name $BC \ - | while read -d $'\0' F ; do cp "$CDEF/$BC" "$F" ; done - find "$CEXA/SCARA" -name $AC \ - | while read -d $'\0' F ; do cp "$CDEF/$AC" "$F" ; done - - # DEBUG: Commit the SCARA reset for review - ((COMMIT_STEPS)) && git add . >/dev/null && git commit -m "Reset SCARA..." >/dev/null - - # Reset all TPARA configs to the default cartesian - find "$CEXA/TPARA" -name $BC \ - | while read -d $'\0' F ; do cp "$CDEF/$BC" "$F" ; done - find "$CEXA/TPARA" -name $AC \ - | while read -d $'\0' F ; do cp "$CDEF/$AC" "$F" ; done - - # DEBUG: Commit the TPARA reset for review - ((COMMIT_STEPS)) && git add . >/dev/null && git commit -m "Reset TPARA..." >/dev/null + ((COMMIT_STEPS)) && git add . >/dev/null && git commit -m "Reset configs..." >/dev/null # Update the %VERSION% in the README.md file VERS=$( echo $EXPORT | $SED 's/release-//' ) From f73fad1b2fa6e70b3d632969ecf2773bee826643 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 6 Jul 2022 19:34:45 -0500 Subject: [PATCH 240/241] =?UTF-8?q?=F0=9F=94=A5=20Remove=20JyersUI=20(#244?= =?UTF-8?q?59)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 1 - Marlin/Configuration_adv.h | 2 +- Marlin/src/MarlinCore.cpp | 2 - Marlin/src/gcode/bedlevel/abl/G29.cpp | 2 - Marlin/src/gcode/config/M575.cpp | 9 +- Marlin/src/gcode/control/M997.cpp | 3 - Marlin/src/gcode/feature/powerloss/M1000.cpp | 4 - Marlin/src/gcode/lcd/M0_M1.cpp | 4 - Marlin/src/gcode/probe/G30.cpp | 10 +- Marlin/src/gcode/stats/M75-M78.cpp | 16 +- Marlin/src/gcode/temp/M303.cpp | 3 - Marlin/src/inc/Conditionals_LCD.h | 15 +- Marlin/src/inc/Conditionals_post.h | 4 +- Marlin/src/inc/SanityCheck.h | 6 +- Marlin/src/lcd/e3v2/common/dwin_api.cpp | 10 +- Marlin/src/lcd/e3v2/jyersui/README.md | 7 - Marlin/src/lcd/e3v2/jyersui/base64.hpp | 208 - Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 6194 ----------------- Marlin/src/lcd/e3v2/jyersui/dwin.h | 283 - Marlin/src/lcd/e3v2/jyersui/dwin_defines.h | 131 - Marlin/src/lcd/e3v2/jyersui/dwin_lcd.cpp | 93 - Marlin/src/lcd/e3v2/jyersui/dwin_lcd.h | 42 - Marlin/src/lcd/e3v2/jyersui/dwinui.cpp | 340 - Marlin/src/lcd/e3v2/jyersui/dwinui.h | 527 -- Marlin/src/lcd/e3v2/jyersui/endstop_diag.cpp | 111 - Marlin/src/lcd/e3v2/jyersui/endstop_diag.h | 39 - Marlin/src/lcd/e3v2/jyersui/gcode_preview.cpp | 244 - Marlin/src/lcd/e3v2/jyersui/gcode_preview.h | 34 - Marlin/src/lcd/e3v2/jyersui/lockscreen.cpp | 83 - Marlin/src/lcd/e3v2/jyersui/lockscreen.h | 49 - Marlin/src/lcd/e3v2/jyersui/plot.cpp | 86 - Marlin/src/lcd/e3v2/jyersui/plot.h | 41 - Marlin/src/lcd/e3v2/proui/base64.hpp | 6 +- Marlin/src/lcd/e3v2/proui/gcode_preview.cpp | 6 +- Marlin/src/lcd/e3v2/proui/gcode_preview.h | 2 +- Marlin/src/lcd/extui/ui_api.h | 2 +- Marlin/src/lcd/marlinui.cpp | 5 +- Marlin/src/lcd/marlinui.h | 10 +- Marlin/src/module/settings.cpp | 22 - Marlin/src/module/temperature.cpp | 8 - buildroot/tests/STM32F103RE_creality | 5 - ini/features.ini | 1 - 42 files changed, 39 insertions(+), 8631 deletions(-) delete mode 100644 Marlin/src/lcd/e3v2/jyersui/README.md delete mode 100644 Marlin/src/lcd/e3v2/jyersui/base64.hpp delete mode 100644 Marlin/src/lcd/e3v2/jyersui/dwin.cpp delete mode 100644 Marlin/src/lcd/e3v2/jyersui/dwin.h delete mode 100644 Marlin/src/lcd/e3v2/jyersui/dwin_defines.h delete mode 100644 Marlin/src/lcd/e3v2/jyersui/dwin_lcd.cpp delete mode 100644 Marlin/src/lcd/e3v2/jyersui/dwin_lcd.h delete mode 100644 Marlin/src/lcd/e3v2/jyersui/dwinui.cpp delete mode 100644 Marlin/src/lcd/e3v2/jyersui/dwinui.h delete mode 100644 Marlin/src/lcd/e3v2/jyersui/endstop_diag.cpp delete mode 100644 Marlin/src/lcd/e3v2/jyersui/endstop_diag.h delete mode 100644 Marlin/src/lcd/e3v2/jyersui/gcode_preview.cpp delete mode 100644 Marlin/src/lcd/e3v2/jyersui/gcode_preview.h delete mode 100644 Marlin/src/lcd/e3v2/jyersui/lockscreen.cpp delete mode 100644 Marlin/src/lcd/e3v2/jyersui/lockscreen.h delete mode 100644 Marlin/src/lcd/e3v2/jyersui/plot.cpp delete mode 100644 Marlin/src/lcd/e3v2/jyersui/plot.h diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 88b92e1837f4..788bd6407553 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -3064,7 +3064,6 @@ // //#define DWIN_CREALITY_LCD // Creality UI //#define DWIN_LCD_PROUI // Pro UI by MRiscoC -//#define DWIN_CREALITY_LCD_JYERSUI // Jyers UI by Jacob Myers //#define DWIN_MARLINUI_PORTRAIT // MarlinUI (portrait orientation) //#define DWIN_MARLINUI_LANDSCAPE // MarlinUI (landscape orientation) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 63c3730364a9..b4627a9830a0 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1335,7 +1335,7 @@ #endif // HAS_MARLINUI_MENU -#if ANY(HAS_DISPLAY, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) +#if EITHER(HAS_DISPLAY, DWIN_LCD_PROUI) //#define SOUND_MENU_ITEM // Add a mute option to the LCD menu #define SOUND_ON_DEFAULT // Buzzer/speaker default enabled state #endif diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index c1bd973b4a1d..7a835da4979c 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -76,8 +76,6 @@ #include "lcd/e3v2/creality/dwin.h" #elif ENABLED(DWIN_LCD_PROUI) #include "lcd/e3v2/proui/dwin.h" - #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) - #include "lcd/e3v2/jyersui/dwin.h" #endif #endif diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index e8c9c4a1857c..a2c53b5ab253 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -51,8 +51,6 @@ #include "../../../lcd/e3v2/creality/dwin.h" #elif ENABLED(DWIN_LCD_PROUI) #include "../../../lcd/e3v2/proui/dwin.h" -#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) - #include "../../../lcd/e3v2/jyersui/dwin.h" #endif #if HAS_MULTI_HOTEND diff --git a/Marlin/src/gcode/config/M575.cpp b/Marlin/src/gcode/config/M575.cpp index f96bca8a3ee3..2c12428d982a 100644 --- a/Marlin/src/gcode/config/M575.cpp +++ b/Marlin/src/gcode/config/M575.cpp @@ -26,10 +26,6 @@ #include "../gcode.h" -#if ENABLED(DWIN_CREALITY_LCD_JYERSUI) - #include "../../lcd/e3v2/jyersui/dwin.h" -#endif - /** * M575 - Change serial baud rate * @@ -69,10 +65,7 @@ void GcodeSuite::M575() { SERIAL_FLUSH(); - if (set1) { - MYSERIAL1.end(); MYSERIAL1.begin(baud); - TERN_(DWIN_CREALITY_LCD_JYERSUI, eeprom_settings.Baud115k = (baud == 115200)); - } + if (set1) { MYSERIAL1.end(); MYSERIAL1.begin(baud); } #if HAS_MULTI_SERIAL if (set2) { MYSERIAL2.end(); MYSERIAL2.begin(baud); } #ifdef SERIAL_PORT_3 diff --git a/Marlin/src/gcode/control/M997.cpp b/Marlin/src/gcode/control/M997.cpp index 66a0256c44ef..74ed8b0d073e 100644 --- a/Marlin/src/gcode/control/M997.cpp +++ b/Marlin/src/gcode/control/M997.cpp @@ -26,8 +26,6 @@ #if ENABLED(DWIN_LCD_PROUI) #include "../../lcd/e3v2/proui/dwin.h" -#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) - #include "../../lcd/e3v2/jyersui/dwin.h" #endif /** @@ -36,7 +34,6 @@ void GcodeSuite::M997() { TERN_(DWIN_LCD_PROUI, DWIN_RebootScreen()); - TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWIN.DWIN_RebootScreen()); flashFirmware(parser.intval('S')); diff --git a/Marlin/src/gcode/feature/powerloss/M1000.cpp b/Marlin/src/gcode/feature/powerloss/M1000.cpp index 1629a154bce3..5466b6e127d6 100644 --- a/Marlin/src/gcode/feature/powerloss/M1000.cpp +++ b/Marlin/src/gcode/feature/powerloss/M1000.cpp @@ -35,8 +35,6 @@ #include "../../../lcd/e3v2/creality/dwin.h" #elif ENABLED(DWIN_LCD_PROUI) #include "../../../lcd/e3v2/proui/dwin.h" -#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) - #include "../../../lcd/e3v2/jyersui/dwin.h" // Temporary fix until it can be better implemented #endif #define DEBUG_OUT ENABLED(DEBUG_POWER_LOSS_RECOVERY) @@ -71,8 +69,6 @@ void GcodeSuite::M1000() { ui.goto_screen(menu_job_recovery); #elif HAS_DWIN_E3V2_BASIC recovery.dwin_flag = true; - #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) // Temporary fix until it can be better implemented - CrealityDWIN.Popup_Handler(Resume); #elif ENABLED(EXTENSIBLE_UI) ExtUI::onPowerLossResume(); #else diff --git a/Marlin/src/gcode/lcd/M0_M1.cpp b/Marlin/src/gcode/lcd/M0_M1.cpp index b6d2131555c6..af03fcb0b1a1 100644 --- a/Marlin/src/gcode/lcd/M0_M1.cpp +++ b/Marlin/src/gcode/lcd/M0_M1.cpp @@ -38,8 +38,6 @@ #elif ENABLED(DWIN_LCD_PROUI) #include "../../lcd/e3v2/proui/dwin_popup.h" #include "../../lcd/e3v2/proui/dwin.h" -#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) - #include "../../lcd/e3v2/jyersui/dwin.h" #endif #if ENABLED(HOST_PROMPT_SUPPORT) @@ -78,8 +76,6 @@ void GcodeSuite::M0_M1() { DWIN_Popup_Confirm(ICON_BLTouch, parser.string_arg, GET_TEXT_F(MSG_USERWAIT)); else DWIN_Popup_Confirm(ICON_BLTouch, GET_TEXT_F(MSG_STOPPED), GET_TEXT_F(MSG_USERWAIT)); - #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) - CrealityDWIN.Confirm_Handler(UserInput, parser.string_arg == nullptr); #else if (parser.string_arg) { diff --git a/Marlin/src/gcode/probe/G30.cpp b/Marlin/src/gcode/probe/G30.cpp index b22ec6eb7f7f..a16853bdf894 100644 --- a/Marlin/src/gcode/probe/G30.cpp +++ b/Marlin/src/gcode/probe/G30.cpp @@ -33,7 +33,7 @@ #include "../../feature/probe_temp_comp.h" #endif -#if EITHER(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) +#if ENABLED(DWIN_LCD_PROUI) #include "../../lcd/marlinui.h" #endif @@ -53,7 +53,7 @@ void GcodeSuite::G30() { parser.linearval('Y', current_position.y + probe.offset_xy.y) }; if (!probe.can_reach(pos)) { - #if EITHER(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) + #if ENABLED(DWIN_LCD_PROUI) SERIAL_ECHOLNF(GET_EN_TEXT_F(MSG_ZPROBE_OUT)); LCD_MESSAGE(MSG_ZPROBE_OUT); #endif @@ -65,9 +65,7 @@ void GcodeSuite::G30() { remember_feedrate_scaling_off(); - #if EITHER(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) - process_subcommands_now(F("G28O")); - #endif + TERN_(DWIN_LCD_PROUI, process_subcommands_now(F("G28O"))); const ProbePtRaise raise_after = parser.boolval('E', true) ? PROBE_PT_STOW : PROBE_PT_NONE; @@ -76,7 +74,7 @@ void GcodeSuite::G30() { TERN_(HAS_PTC, ptc.set_enabled(true)); if (!isnan(measured_z)) { SERIAL_ECHOLNPGM("Bed X: ", pos.x, " Y: ", pos.y, " Z: ", measured_z); - #if EITHER(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) + #if ENABLED(DWIN_LCD_PROUI) char msg[31], str_1[6], str_2[6], str_3[6]; sprintf_P(msg, PSTR("X:%s, Y:%s, Z:%s"), dtostrf(pos.x, 1, 1, str_1), diff --git a/Marlin/src/gcode/stats/M75-M78.cpp b/Marlin/src/gcode/stats/M75-M78.cpp index 13a593bc30f1..0ed1e6693013 100644 --- a/Marlin/src/gcode/stats/M75-M78.cpp +++ b/Marlin/src/gcode/stats/M75-M78.cpp @@ -33,23 +33,15 @@ #include "../../lcd/e3v2/proui/dwin.h" #endif -#if ENABLED(DWIN_CREALITY_LCD_JYERSUI) - #include "../../lcd/e3v2/jyersui/dwin.h" -#endif - /** * M75: Start print timer */ void GcodeSuite::M75() { startOrResumeJob(); - TERN_(DWIN_LCD_PROUI, DWIN_Print_Started(false)); - if (!IS_SD_PRINTING()) { - #if ENABLED(DWIN_LCD_PROUI) - DWIN_Print_Header(parser.string_arg && parser.string_arg[0] ? parser.string_arg : GET_TEXT(MSG_HOST_START_PRINT)); - #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) - CrealityDWIN.Update_Print_Filename(parser.string_arg && parser.string_arg[0] ? parser.string_arg : GET_TEXT(MSG_HOST_START_PRINT)); - #endif - } + #if ENABLED(DWIN_LCD_PROUI) + DWIN_Print_Started(false); + if (!IS_SD_PRINTING()) DWIN_Print_Header(parser.string_arg && parser.string_arg[0] ? parser.string_arg : GET_TEXT(MSG_HOST_START_PRINT)); + #endif } /** diff --git a/Marlin/src/gcode/temp/M303.cpp b/Marlin/src/gcode/temp/M303.cpp index 2bd05f75373c..ce362984a6ca 100644 --- a/Marlin/src/gcode/temp/M303.cpp +++ b/Marlin/src/gcode/temp/M303.cpp @@ -32,8 +32,6 @@ #include "../../lcd/extui/ui_api.h" #elif ENABLED(DWIN_LCD_PROUI) #include "../../lcd/e3v2/proui/dwin.h" -#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) - #include "../../lcd/e3v2/jyersui/dwin.h" #endif /** @@ -77,7 +75,6 @@ void GcodeSuite::M303() { SERIAL_ECHOLNPGM(STR_PID_BAD_HEATER_ID); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_BAD_EXTRUDER_NUM)); TERN_(DWIN_LCD_PROUI, DWIN_PidTuning(PID_BAD_EXTRUDER_NUM)); - TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWINClass::DWIN_PidTuning(PID_BAD_EXTRUDER_NUM)); return; } diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index bf8d5e122a5e..b8cf66c8c41a 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -477,8 +477,6 @@ // Aliases for LCD features #if EITHER(DWIN_CREALITY_LCD, DWIN_LCD_PROUI) #define HAS_DWIN_E3V2_BASIC 1 -#endif -#if EITHER(HAS_DWIN_E3V2_BASIC, DWIN_CREALITY_LCD_JYERSUI) #define HAS_DWIN_E3V2 1 #endif #if ENABLED(DWIN_LCD_PROUI) @@ -508,7 +506,7 @@ #endif #endif -#if ANY(HAS_WIRED_LCD, EXTENSIBLE_UI, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) +#if ANY(HAS_WIRED_LCD, EXTENSIBLE_UI, DWIN_LCD_PROUI) #define HAS_DISPLAY 1 #endif @@ -528,7 +526,7 @@ #define HAS_MANUAL_MOVE_MENU 1 #endif -#if ANY(HAS_MARLINUI_U8GLIB, EXTENSIBLE_UI, HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL, IS_DWIN_MARLINUI, DWIN_CREALITY_LCD_JYERSUI) +#if ANY(HAS_MARLINUI_U8GLIB, EXTENSIBLE_UI, HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL, IS_DWIN_MARLINUI) #define CAN_SHOW_REMAINING_TIME 1 #endif @@ -1256,8 +1254,6 @@ #endif #if ANY(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_3POINT) #define HAS_ABL_NOT_UBL 1 -#else - #undef PROBE_MANUALLY #endif #if ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_UBL, MESH_BED_LEVELING) #define HAS_MESH 1 @@ -1276,11 +1272,14 @@ #if DISABLED(AUTO_BED_LEVELING_UBL) #define PLANNER_LEVELING 1 #endif -#else +#endif +#if !HAS_LEVELING #undef RESTORE_LEVELING_AFTER_G28 #undef ENABLE_LEVELING_AFTER_G28 #undef G29_RETRY_AND_RECOVER - #undef PREHEAT_BEFORE_LEVELING +#endif +#if !HAS_LEVELING || EITHER(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL) + #undef PROBE_MANUALLY #endif #if ANY(HAS_BED_PROBE, PROBE_MANUALLY, MESH_BED_LEVELING) #define PROBE_SELECTED 1 diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 0f4cf1381a7f..dfccd9b8f5c5 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -3428,7 +3428,7 @@ * Advanced Pause - Filament Change */ #if ENABLED(ADVANCED_PAUSE_FEATURE) - #if ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) || BOTH(EMERGENCY_PARSER, HOST_PROMPT_SUPPORT) + #if ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI, DWIN_LCD_PROUI) || BOTH(EMERGENCY_PARSER, HOST_PROMPT_SUPPORT) #define M600_PURGE_MORE_RESUMABLE 1 #endif #ifndef FILAMENT_CHANGE_SLOW_LOAD_LENGTH @@ -3541,7 +3541,7 @@ #ifndef MESH_MAX_Y #define MESH_MAX_Y _MESH_MAX_Y #endif -#elif DISABLED(DWIN_CREALITY_LCD_JYERSUI) +#else #undef MESH_MIN_X #undef MESH_MIN_Y #undef MESH_MAX_X diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 8ef8a3d2d64a..f75a59b9b4c1 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -873,7 +873,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "PROGRESS_MSG_EXPIRE must be greater than or equal to 0." #endif #elif ENABLED(LCD_SET_PROGRESS_MANUALLY) && NONE(HAS_MARLINUI_U8GLIB, HAS_GRAPHICAL_TFT, HAS_MARLINUI_HD44780, EXTENSIBLE_UI, HAS_DWIN_E3V2, IS_DWIN_MARLINUI) - #error "LCD_SET_PROGRESS_MANUALLY requires LCD_PROGRESS_BAR, Character LCD, Graphical LCD, TFT, DWIN_CREALITY_LCD, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI, DWIN_MARLINUI_*, OR EXTENSIBLE_UI." + #error "LCD_SET_PROGRESS_MANUALLY requires LCD_PROGRESS_BAR, Character LCD, Graphical LCD, TFT, DWIN_CREALITY_LCD, DWIN_LCD_PROUI, DWIN_MARLINUI_*, OR EXTENSIBLE_UI." #endif #if ENABLED(USE_M73_REMAINING_TIME) && DISABLED(LCD_SET_PROGRESS_MANUALLY) @@ -2846,7 +2846,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS + COUNT_ENABLED(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, ANYCUBIC_TFT35) \ + COUNT_ENABLED(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY, DGUS_LCD_UI_MKS, DGUS_LCD_UI_RELOADED) \ + COUNT_ENABLED(ENDER2_STOCKDISPLAY, CR10_STOCKDISPLAY) \ - + COUNT_ENABLED(DWIN_CREALITY_LCD, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI, DWIN_MARLINUI_PORTRAIT, DWIN_MARLINUI_LANDSCAPE) \ + + COUNT_ENABLED(DWIN_CREALITY_LCD, DWIN_LCD_PROUI, DWIN_MARLINUI_PORTRAIT, DWIN_MARLINUI_LANDSCAPE) \ + COUNT_ENABLED(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_GENERIC_12864_1_1) \ + COUNT_ENABLED(LCD_SAINSMART_I2C_1602, LCD_SAINSMART_I2C_2004) \ + COUNT_ENABLED(MKS_12864OLED, MKS_12864OLED_SSD1306) \ @@ -3671,7 +3671,7 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive."); #error "A very large BLOCK_BUFFER_SIZE is not needed and takes longer to drain the buffer on pause / cancel." #endif -#if ENABLED(LED_CONTROL_MENU) && NONE(HAS_MARLINUI_MENU, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) +#if ENABLED(LED_CONTROL_MENU) && NONE(HAS_MARLINUI_MENU, DWIN_LCD_PROUI) #error "LED_CONTROL_MENU requires an LCD controller that implements the menu." #endif diff --git a/Marlin/src/lcd/e3v2/common/dwin_api.cpp b/Marlin/src/lcd/e3v2/common/dwin_api.cpp index 79998219a95e..3f699465a9c8 100644 --- a/Marlin/src/lcd/e3v2/common/dwin_api.cpp +++ b/Marlin/src/lcd/e3v2/common/dwin_api.cpp @@ -234,7 +234,7 @@ void DWIN_Frame_AreaMove(uint8_t mode, uint8_t dir, uint16_t dis, // *string: The string // rlimit: To limit the drawn string length void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const char * const string, uint16_t rlimit/*=0xFFFF*/) { - #if NONE(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) + #if DISABLED(DWIN_LCD_PROUI) DWIN_Draw_Rectangle(1, bColor, x, y, x + (fontWidth(size) * strlen_P(string)), y + fontHeight(size)); #endif constexpr uint8_t widthAdjust = 0; @@ -266,9 +266,7 @@ void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, void DWIN_Draw_IntValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, uint32_t value) { size_t i = 0; - #if DISABLED(DWIN_CREALITY_LCD_JYERSUI) - DWIN_Draw_Rectangle(1, bColor, x, y, x + fontWidth(size) * iNum + 1, y + fontHeight(size)); - #endif + DWIN_Draw_Rectangle(1, bColor, x, y, x + fontWidth(size) * iNum + 1, y + fontHeight(size)); DWIN_Byte(i, 0x14); // Bit 7: bshow // Bit 6: 1 = signed; 0 = unsigned number; @@ -316,9 +314,7 @@ void DWIN_Draw_FloatValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_ uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, int32_t value) { //uint8_t *fvalue = (uint8_t*)&value; size_t i = 0; - #if DISABLED(DWIN_CREALITY_LCD_JYERSUI) - DWIN_Draw_Rectangle(1, bColor, x, y, x + fontWidth(size) * (iNum+fNum+1), y + fontHeight(size)); - #endif + DWIN_Draw_Rectangle(1, bColor, x, y, x + fontWidth(size) * (iNum+fNum+1), y + fontHeight(size)); DWIN_Byte(i, 0x14); DWIN_Byte(i, (bShow * 0x80) | (zeroFill * 0x20) | (zeroMode * 0x10) | size); DWIN_Word(i, color); diff --git a/Marlin/src/lcd/e3v2/jyersui/README.md b/Marlin/src/lcd/e3v2/jyersui/README.md deleted file mode 100644 index 91f25e2433bf..000000000000 --- a/Marlin/src/lcd/e3v2/jyersui/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# DWIN for Creality Ender 3 v2 - -Marlin's Ender 3 v2 support requires the `DWIN_SET` included with the Ender 3 V2 [example configuration](https://github.com/MarlinFirmware/Configurations/tree/bugfix-2.1.x/config/examples/Creality/Ender-3%20V2). - -## Easy Install - -Copy the `DWIN_SET` folder onto a Micro-SD card and insert the card into the slot on the DWIN screen. Cycle the machine and wait for the screen to go from blue to orange. Turn the machine off and remove the SD card. When you turn on the machine the screen will display a "Creality" loading screen. diff --git a/Marlin/src/lcd/e3v2/jyersui/base64.hpp b/Marlin/src/lcd/e3v2/jyersui/base64.hpp deleted file mode 100644 index 7a933df321b8..000000000000 --- a/Marlin/src/lcd/e3v2/jyersui/base64.hpp +++ /dev/null @@ -1,208 +0,0 @@ -/** - * Base64 encoder/decoder for arduino repo - * Uses common web conventions - '+' for 62, '/' for 63, '=' for padding. - * Note that invalid base64 characters are interpreted as padding. - * Author: Densaugeo - * Maintainer: Densaugeo - * Version: 1.2.1.1 - * Changed unsigned int to uint16_t for use in the professional Ender 3V2/S1 firmware - * Url: https://www.arduino.cc/reference/en/libraries/base64/ - */ - -#ifndef BASE64_H_INCLUDED -#define BASE64_H_INCLUDED - -/* binary_to_base64: - * Description: - * Converts a single byte from a binary value to the corresponding base64 character - * Parameters: - * v - Byte to convert - * Returns: - * ascii code of base64 character. If byte is >= 64, then there is not corresponding base64 character - * and 255 is returned - */ -unsigned char binary_to_base64(unsigned char v); - -/* base64_to_binary: - * Description: - * Converts a single byte from a base64 character to the corresponding binary value - * Parameters: - * c - Base64 character (as ascii code) - * Returns: - * 6-bit binary value - */ -unsigned char base64_to_binary(unsigned char c); - -/* encode_base64_length: - * Description: - * Calculates length of base64 string needed for a given number of binary bytes - * Parameters: - * input_length - Amount of binary data in bytes - * Returns: - * Number of base64 characters needed to encode input_length bytes of binary data - */ -uint16_t encode_base64_length(uint16_t input_length); - -/* decode_base64_length: - * Description: - * Calculates number of bytes of binary data in a base64 string - * Variant that does not use input_length no longer used within library, retained for API compatibility - * Parameters: - * input - Base64-encoded null-terminated string - * input_length (optional) - Number of bytes to read from input pointer - * Returns: - * Number of bytes of binary data in input - */ -uint16_t decode_base64_length(unsigned char input[]); -uint16_t decode_base64_length(unsigned char input[], uint16_t input_length); - -/* encode_base64: - * Description: - * Converts an array of bytes to a base64 null-terminated string - * Parameters: - * input - Pointer to input data - * input_length - Number of bytes to read from input pointer - * output - Pointer to output string. Null terminator will be added automatically - * Returns: - * Length of encoded string in bytes (not including null terminator) - */ -uint16_t encode_base64(unsigned char input[], uint16_t input_length, unsigned char output[]); - -/* decode_base64: - * Description: - * Converts a base64 null-terminated string to an array of bytes - * Parameters: - * input - Pointer to input string - * input_length (optional) - Number of bytes to read from input pointer - * output - Pointer to output array - * Returns: - * Number of bytes in the decoded binary - */ -uint16_t decode_base64(unsigned char input[], unsigned char output[]); -uint16_t decode_base64(unsigned char input[], uint16_t input_length, unsigned char output[]); - -unsigned char binary_to_base64(unsigned char v) { - // Capital letters - 'A' is ascii 65 and base64 0 - if (v < 26) return v + 'A'; - - // Lowercase letters - 'a' is ascii 97 and base64 26 - if (v < 52) return v + 71; - - // Digits - '0' is ascii 48 and base64 52 - if (v < 62) return v - 4; - - // '+' is ascii 43 and base64 62 - if (v == 62) return '+'; - - // '/' is ascii 47 and base64 63 - if (v == 63) return '/'; - - return 64; -} - -unsigned char base64_to_binary(unsigned char c) { - // Capital letters - 'A' is ascii 65 and base64 0 - if ('A' <= c && c <= 'Z') return c - 'A'; - - // Lowercase letters - 'a' is ascii 97 and base64 26 - if ('a' <= c && c <= 'z') return c - 71; - - // Digits - '0' is ascii 48 and base64 52 - if ('0' <= c && c <= '9') return c + 4; - - // '+' is ascii 43 and base64 62 - if (c == '+') return 62; - - // '/' is ascii 47 and base64 63 - if (c == '/') return 63; - - return 255; -} - -uint16_t encode_base64_length(uint16_t input_length) { - return (input_length + 2)/3*4; -} - -uint16_t decode_base64_length(unsigned char input[]) { - return decode_base64_length(input, -1); -} - -uint16_t decode_base64_length(unsigned char input[], uint16_t input_length) { - unsigned char *start = input; - - while (base64_to_binary(input[0]) < 64 && (unsigned char)(input - start) < input_length) { - ++input; - } - - input_length = input - start; - return input_length/4*3 + (input_length % 4 ? input_length % 4 - 1 : 0); -} - -uint16_t encode_base64(unsigned char input[], uint16_t input_length, unsigned char output[]) { - uint16_t full_sets = input_length/3; - - // While there are still full sets of 24 bits... - for (uint16_t i = 0; i < full_sets; ++i) { - output[0] = binary_to_base64( input[0] >> 2); - output[1] = binary_to_base64((input[0] & 0x03) << 4 | input[1] >> 4); - output[2] = binary_to_base64((input[1] & 0x0F) << 2 | input[2] >> 6); - output[3] = binary_to_base64( input[2] & 0x3F); - - input += 3; - output += 4; - } - - switch (input_length % 3) { - case 0: - output[0] = '\0'; - break; - case 1: - output[0] = binary_to_base64( input[0] >> 2); - output[1] = binary_to_base64((input[0] & 0x03) << 4); - output[2] = '='; - output[3] = '='; - output[4] = '\0'; - break; - case 2: - output[0] = binary_to_base64( input[0] >> 2); - output[1] = binary_to_base64((input[0] & 0x03) << 4 | input[1] >> 4); - output[2] = binary_to_base64((input[1] & 0x0F) << 2); - output[3] = '='; - output[4] = '\0'; - break; - } - - return encode_base64_length(input_length); -} - -uint16_t decode_base64(unsigned char input[], unsigned char output[]) { - return decode_base64(input, -1, output); -} - -uint16_t decode_base64(unsigned char input[], uint16_t input_length, unsigned char output[]) { - uint16_t output_length = decode_base64_length(input, input_length); - - // While there are still full sets of 24 bits... - for (uint16_t i = 2; i < output_length; i += 3) { - output[0] = base64_to_binary(input[0]) << 2 | base64_to_binary(input[1]) >> 4; - output[1] = base64_to_binary(input[1]) << 4 | base64_to_binary(input[2]) >> 2; - output[2] = base64_to_binary(input[2]) << 6 | base64_to_binary(input[3]); - - input += 4; - output += 3; - } - - switch (output_length % 3) { - case 1: - output[0] = base64_to_binary(input[0]) << 2 | base64_to_binary(input[1]) >> 4; - break; - case 2: - output[0] = base64_to_binary(input[0]) << 2 | base64_to_binary(input[1]) >> 4; - output[1] = base64_to_binary(input[1]) << 4 | base64_to_binary(input[2]) >> 2; - break; - } - - return output_length; -} - -#endif // BASE64_H_INCLUDED diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp deleted file mode 100644 index e62bb04a43a2..000000000000 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ /dev/null @@ -1,6194 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -/** - * lcd/e3v2/jyersui/dwin.cpp - * JYERSUI Author: Jacob Myers - * - * JYERSUI Enhanced by LCH-77 - * Version: 1.9 - * Date: Jun 16, 2022 - */ - -#include "../../../inc/MarlinConfigPre.h" - -#if ENABLED(DWIN_CREALITY_LCD_JYERSUI) - -#include "dwin_defines.h" -#include "dwin.h" -#include "dwinui.h" - -#include "../../marlinui.h" -#include "../../../MarlinCore.h" -#include "../../../gcode/gcode.h" -#include "../../../module/temperature.h" -#include "../../../module/planner.h" -#include "../../../module/settings.h" -#include "../../../libs/buzzer.h" -#include "../../../inc/Conditionals_post.h" -#include "../common/encoder.h" - -//#define DEBUG_OUT 1 -#include "../../../core/debug_out.h" - -#if ENABLED(ADVANCED_PAUSE_FEATURE) - #include "../../../feature/pause.h" -#endif - -#if ENABLED(FILAMENT_RUNOUT_SENSOR) - #include "../../../feature/runout.h" -#endif - -#if ENABLED(HOST_ACTION_COMMANDS) - #include "../../../feature/host_actions.h" -#endif - -#if ANY(BABYSTEPPING, HAS_BED_PROBE, HAS_WORKSPACE_OFFSET) - #define HAS_ZOFFSET_ITEM 1 -#endif - -#ifndef strcasecmp_P - #define strcasecmp_P(a, b) strcasecmp((a), (b)) -#endif - -#if HAS_LEVELING - #include "../../../feature/bedlevel/bedlevel.h" -#endif - -#ifdef BLTOUCH_HS_MODE - #include "../../../feature/bltouch.h" -#endif - -#if ENABLED(AUTO_BED_LEVELING_UBL) - #include "../../../libs/least_squares_fit.h" - #include "../../../libs/vector_3.h" -#endif - -#if HAS_BED_PROBE - #include "../../../module/probe.h" -#endif - -#if ENABLED(POWER_LOSS_RECOVERY) - #include "../../../feature/powerloss.h" -#endif - -#if HAS_ESDIAG - #include "endstop_diag.h" -#endif - -#if HAS_LOCKSCREEN - #include "lockscreen.h" -#endif - -#if ENABLED(CASE_LIGHT_MENU) - #include "../../../feature/caselight.h" -#endif - -#if ENABLED(LED_CONTROL_MENU) - #include "../../../feature/leds/leds.h" -#endif - -#if HAS_PIDPLOT - #include "plot.h" -#endif -#if HAS_GCODE_PREVIEW - #include "gcode_preview.h" -#endif - -#define MACHINE_SIZE STRINGIFY(X_BED_SIZE) "x" STRINGIFY(Y_BED_SIZE) "x" STRINGIFY(Z_MAX_POS) - -#define MENU_CHAR_LIMIT 24 -#define STATUS_CHAR_LIMIT 30 - -#define MAX_PRINT_SPEED 500 -#define MIN_PRINT_SPEED 10 - -#if HAS_FAN - #define MAX_FAN_SPEED 255 - #define MIN_FAN_SPEED 0 -#endif - -#define MAX_XY_OFFSET 100 - -#if HAS_ZOFFSET_ITEM - #define MAX_Z_OFFSET 9.99 - #if HAS_BED_PROBE - #define MIN_Z_OFFSET -9.99 - #else - #define MIN_Z_OFFSET -1 - #endif -#endif - -#if HAS_HOTEND - #define MAX_FLOW_RATE 200 - #define MIN_FLOW_RATE 10 - - #define MAX_E_TEMP (HEATER_0_MAXTEMP - HOTEND_OVERSHOOT) - #define MIN_E_TEMP 0 -#endif - -#if HAS_HEATED_BED - #define MAX_BED_TEMP BED_MAXTEMP - #define MIN_BED_TEMP 0 -#endif - -#if HAS_JUNCTION_DEVIATION - #define MIN_JD_MM 0.01 - #define MAX_JD_MM 0.3 -#endif - -/** - * Custom menu items with jyersLCD - */ -#if ENABLED(CUSTOM_MENU_CONFIG) - #ifdef CONFIG_MENU_ITEM_5_DESC - #define CUSTOM_MENU_COUNT 5 - #elif defined(CONFIG_MENU_ITEM_4_DESC) - #define CUSTOM_MENU_COUNT 4 - #elif defined(CONFIG_MENU_ITEM_3_DESC) - #define CUSTOM_MENU_COUNT 3 - #elif defined(CONFIG_MENU_ITEM_2_DESC) - #define CUSTOM_MENU_COUNT 2 - #elif defined(CONFIG_MENU_ITEM_1_DESC) - #define CUSTOM_MENU_COUNT 1 - #endif - #if CUSTOM_MENU_COUNT - #define HAS_CUSTOM_MENU 1 - #endif -#endif - -constexpr float default_max_feedrate[] = DEFAULT_MAX_FEEDRATE; -constexpr float default_max_acceleration[] = DEFAULT_MAX_ACCELERATION; -constexpr float default_steps[] = DEFAULT_AXIS_STEPS_PER_UNIT; -#if HAS_CLASSIC_JERK - constexpr float default_max_jerk[] = { DEFAULT_XJERK, DEFAULT_YJERK, DEFAULT_ZJERK, DEFAULT_EJERK }; -#endif - -enum SelectItem : uint8_t { - PAGE_PRINT = 0, - PAGE_PREPARE, - PAGE_CONTROL, - PAGE_INFO_LEVELING, - PAGE_COUNT, - - PRINT_SETUP = 0, - PRINT_PAUSE_RESUME, - PRINT_STOP, - PRINT_COUNT -}; - -eeprom_settings_t eeprom_settings = {0}; -temp_val_t temp_val = {0}; -uint8_t active_menu = MainMenu, last_menu = MainMenu; -uint8_t selection = 0, last_selection = 0, last_pos_selection = 0; -uint8_t scrollpos = 0; -uint8_t process = Main, last_process = Main; -PopupID popup, last_popup; - -void (*funcpointer)() = nullptr; -void *valuepointer = nullptr; -float tempvalue; -float valuemin; -float valuemax; -uint8_t valueunit; -uint8_t valuetype; - -char cmd[MAX_CMD_SIZE + 16], str_1[16], str_2[16], str_3[16]; -char statusmsg[64]; -char filename[LONG_FILENAME_LENGTH]; - -#if HAS_HOSTACTION_MENUS - #define KEY_WIDTH 26 - #define KEY_HEIGHT 30 - #define KEY_INSET 5 - #define KEY_PADDING 3 - #define KEY_Y_START DWIN_HEIGHT - (4 * (KEY_HEIGHT) + 2 * (KEY_INSET + 1)) - - bool keyboard_restrict, reset_keyboard, numeric_keyboard = false; - uint8_t maxstringlen; - char *stringpointer = nullptr; - char action1[9], action2[9], action3[9]; -#endif - -CrealityDWINClass CrealityDWIN; - -#if HAS_MESH - - struct Mesh_Settings { - bool viewer_asymmetric_range = false; - bool viewer_print_value = false; - bool goto_mesh_value = false; - bool drawing_mesh = false; - uint8_t mesh_x = 0; - uint8_t mesh_y = 0; - - #if ENABLED(AUTO_BED_LEVELING_UBL) - - uint8_t tilt_grid = 1; - - void manual_value_update(bool undefined=false) { - sprintf_P(cmd, PSTR("M421 I%i J%i Z%s %s"), mesh_x, mesh_y, dtostrf(current_position.z, 1, 3, str_1), undefined ? "N" : ""); - gcode.process_subcommands_now(cmd); - planner.synchronize(); - } - - bool create_plane_from_mesh() { - struct linear_fit_data lsf_results; - incremental_LSF_reset(&lsf_results); - GRID_LOOP(x, y) { - if (!isnan(bedlevel.z_values[x][y])) { - xy_pos_t rpos = { bedlevel.get_mesh_x(x), bedlevel.get_mesh_y(y) }; - incremental_LSF(&lsf_results, rpos, bedlevel.z_values[x][y]); - } - } - - if (finish_incremental_LSF(&lsf_results)) { - SERIAL_ECHOPGM("Could not complete LSF!"); - return true; - } - - bedlevel.set_all_mesh_points_to_value(0); - - matrix_3x3 rotation = matrix_3x3::create_look_at(vector_3(lsf_results.A, lsf_results.B, 1)); - GRID_LOOP(i, j) { - float mx = bedlevel.get_mesh_x(i), - my = bedlevel.get_mesh_y(j), - mz = bedlevel.z_values[i][j]; - - if (DEBUGGING(LEVELING)) { - DEBUG_ECHOPAIR_F("before rotation = [", mx, 7); - DEBUG_CHAR(','); - DEBUG_ECHO_F(my, 7); - DEBUG_CHAR(','); - DEBUG_ECHO_F(mz, 7); - DEBUG_ECHOPGM("] ---> "); - DEBUG_DELAY(20); - } - - rotation.apply_rotation_xyz(mx, my, mz); - - if (DEBUGGING(LEVELING)) { - DEBUG_ECHOPAIR_F("after rotation = [", mx, 7); - DEBUG_CHAR(','); - DEBUG_ECHO_F(my, 7); - DEBUG_CHAR(','); - DEBUG_ECHO_F(mz, 7); - DEBUG_ECHOLNPGM("]"); - DEBUG_DELAY(20); - } - - bedlevel.z_values[i][j] = mz - lsf_results.D; - } - return false; - } - - #else - - void manual_value_update() { - sprintf_P(cmd, PSTR("G29 I%i J%i Z%s"), mesh_x, mesh_y, dtostrf(current_position.z, 1, 3, str_1)); - gcode.process_subcommands_now(cmd); - planner.synchronize(); - } - - #endif - - void manual_mesh_move(const bool zmove=false) { - if (zmove) { - planner.synchronize(); - current_position.z = goto_mesh_value ? bedlevel.z_values[mesh_x][mesh_y] : Z_CLEARANCE_BETWEEN_PROBES; - planner.buffer_line(current_position, homing_feedrate(Z_AXIS), active_extruder); - planner.synchronize(); - } - else { - CrealityDWIN.Popup_Handler(MoveWait); - sprintf_P(cmd, PSTR("G0 F300 Z%s"), dtostrf(Z_CLEARANCE_BETWEEN_PROBES, 1, 3, str_1)); - gcode.process_subcommands_now(cmd); - sprintf_P(cmd, PSTR("G42 F4000 I%i J%i"), mesh_x, mesh_y); - gcode.process_subcommands_now(cmd); - planner.synchronize(); - current_position.z = goto_mesh_value ? bedlevel.z_values[mesh_x][mesh_y] : Z_CLEARANCE_BETWEEN_PROBES; - planner.buffer_line(current_position, homing_feedrate(Z_AXIS), active_extruder); - planner.synchronize(); - CrealityDWIN.Redraw_Menu(); - } - } - - float get_max_value() { - float max = __FLT_MIN__; - GRID_LOOP(x, y) { - if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] > max) - max = bedlevel.z_values[x][y]; - } - return max; - } - - float get_min_value() { - float min = __FLT_MAX__; - GRID_LOOP(x, y) { - if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] < min) - min = bedlevel.z_values[x][y]; - } - return min; - } - - void Draw_Bed_Mesh(int16_t selected = -1, uint8_t gridline_width = 1, uint16_t padding_x = 8, uint16_t padding_y_top = 40 + 53 - 7) { - drawing_mesh = true; - const uint16_t total_width_px = DWIN_WIDTH - padding_x - padding_x, - cell_width_px = total_width_px / (GRID_MAX_POINTS_X), - cell_height_px = total_width_px / (GRID_MAX_POINTS_Y); - const float v_max = abs(get_max_value()), v_min = abs(get_min_value()), range = _MAX(v_min, v_max); - - // Clear background from previous selection and select new square - DWIN_Draw_Rectangle(1, Def_Background_Color, _MAX(0, padding_x - gridline_width), _MAX(0, padding_y_top - gridline_width), padding_x + total_width_px, padding_y_top + total_width_px); - if (selected >= 0) { - const auto selected_y = selected / (GRID_MAX_POINTS_X); - const auto selected_x = selected - (GRID_MAX_POINTS_X) * selected_y; - const auto start_y_px = padding_y_top + selected_y * cell_height_px; - const auto start_x_px = padding_x + selected_x * cell_width_px; - DWIN_Draw_Rectangle(1, Def_Highlight_Color, _MAX(0, start_x_px - gridline_width), _MAX(0, start_y_px - gridline_width), start_x_px + cell_width_px, start_y_px + cell_height_px); - } - - // Draw value square grid - char buf[8]; - GRID_LOOP(x, y) { - const auto start_x_px = padding_x + x * cell_width_px; - const auto end_x_px = start_x_px + cell_width_px - 1 - gridline_width; - const auto start_y_px = padding_y_top + (GRID_MAX_POINTS_Y - y - 1) * cell_height_px; - const auto end_y_px = start_y_px + cell_height_px - 1 - gridline_width; - DWIN_Draw_Rectangle(1, // RGB565 colors: http://www.barth-dev.de/online/rgb565-color-picker/ - isnan(bedlevel.z_values[x][y]) ? Color_Grey : ( // gray if undefined - (bedlevel.z_values[x][y] < 0 ? - (uint16_t)round(0x1F * -bedlevel.z_values[x][y] / (!viewer_asymmetric_range ? range : v_min)) << 11 : // red if mesh point value is negative - (uint16_t)round(0x3F * bedlevel.z_values[x][y] / (!viewer_asymmetric_range ? range : v_max)) << 5) | // green if mesh point value is positive - _MIN(0x1F, (((uint8_t)abs(bedlevel.z_values[x][y]) / 10) * 4))), // + blue stepping for every mm - start_x_px, start_y_px, end_x_px, end_y_px - ); - - safe_delay(10); - LCD_SERIAL.flushTX(); - - // Draw value text on - if (viewer_print_value) { - int8_t offset_x, offset_y = cell_height_px / 2 - 6; - if (isnan(bedlevel.z_values[x][y])) { // undefined - DWINUI::Draw_String(font6x12, Def_Text_Color, Color_Bg_Blue, start_x_px + cell_width_px / 2 - 5, start_y_px + offset_y, F("X")); - } - else { // has value - if (GRID_MAX_POINTS_X < 10) - sprintf_P(buf, PSTR("%s"), dtostrf(abs(bedlevel.z_values[x][y]), 1, 2, str_1)); - else - sprintf_P(buf, PSTR("%02i"), (uint16_t)(abs(bedlevel.z_values[x][y] - (int16_t)bedlevel.z_values[x][y]) * 100)); - offset_x = cell_width_px / 2 - 3 * (strlen(buf)) - 2; - if (!(GRID_MAX_POINTS_X < 10)) - DWINUI::Draw_String(font6x12, Def_Text_Color, Color_Bg_Blue, start_x_px - 2 + offset_x, start_y_px + offset_y /*+ square / 2 - 6*/, F(".")); - DWINUI::Draw_String(font6x12, Def_Text_Color, Color_Bg_Blue, start_x_px + 1 + offset_x, start_y_px + offset_y /*+ square / 2 - 6*/, buf); - } - safe_delay(10); - LCD_SERIAL.flushTX(); - } - } - } - - void Set_Mesh_Viewer_Status() { // TODO: draw gradient with values as a legend instead - float v_max = abs(get_max_value()), v_min = abs(get_min_value()), range = _MAX(v_min, v_max); - if (v_min > 3e+10F) v_min = 0.0000001; - if (v_max > 3e+10F) v_max = 0.0000001; - if (range > 3e+10F) range = 0.0000001; - char msg[46]; - if (viewer_asymmetric_range) { - dtostrf(-v_min, 1, 3, str_1); - dtostrf( v_max, 1, 3, str_2); - } - else { - dtostrf(-range, 1, 3, str_1); - dtostrf( range, 1, 3, str_2); - } - sprintf_P(msg, PSTR("Red %s..0..%s Green"), str_1, str_2); - CrealityDWIN.Update_Status(msg); - drawing_mesh = false; - } - - }; - Mesh_Settings mesh_conf; - -#endif // HAS_MESH - -/* General Display Functions */ -constexpr const char * const CrealityDWINClass::color_names[11]; -constexpr const char * const CrealityDWINClass::preheat_modes[3]; -constexpr const char * const CrealityDWINClass::zoffset_modes[3]; -#if ENABLED(PREHEAT_BEFORE_LEVELING) - constexpr const char * const CrealityDWINClass::preheat_levmodes[4]; -#endif - -// Clear a part of the screen -// 4=Entire screen -// 3=Title bar and Menu area (default) -// 2=Menu area -// 1=Title bar -void CrealityDWINClass::Clear_Screen(uint8_t e/*=3*/) { - if (e == 1 || e == 3 || e == 4) DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.menu_top_bg, Def_TitleBg_color, false), 0, 0, DWIN_WIDTH, TITLE_HEIGHT); // Clear Title Bar - if (e == 2 || e == 3) DWIN_Draw_Rectangle(1, Def_Background_Color, 0, 31, DWIN_WIDTH, STATUS_Y); // Clear Menu Area - if (e == 4) DWIN_Draw_Rectangle(1, Def_Background_Color, 0, 31, DWIN_WIDTH, DWIN_HEIGHT); // Clear Popup Area -} - -void CrealityDWINClass::Draw_Float(float value, uint8_t row, bool selected/*=false*/, uint8_t minunit/*=10*/) { - const uint8_t digits = (uint8_t)floor(log10(abs(value))) + log10(minunit) + (minunit > 1); - const uint16_t bColor = (selected) ? Def_Selected_Color : Def_Background_Color; - const uint16_t xpos = 240 - (digits * 8); - DWIN_Draw_Rectangle(1, Def_Background_Color, 194, MBASE(row), 234 - (digits * 8), MBASE(row) + 16); - if (isnan(value)) - DWINUI::Draw_String(Def_Text_Color, bColor, xpos - 8, MBASE(row), F(" NaN")); - else { - DWIN_Draw_FloatValue(true, true, 0, DWIN_FONT_MENU, Def_Text_Color, bColor, digits - log10(minunit) + 1, log10(minunit), xpos, MBASE(row), (value < 0 ? -value : value)); - DWINUI::Draw_String(Def_Text_Color, bColor, xpos - 8, MBASE(row), value < 0 ? F("-") : F(" ")); - } -} - -void CrealityDWINClass::Draw_Option(uint8_t value, const char * const * options, uint8_t row, bool selected/*=false*/, bool color/*=false*/) { - uint16_t bColor = (selected) ? Def_Selected_Color : Def_Background_Color, - tColor = (color) ? GetColor(value, Def_Text_Color, false) : Def_Text_Color; - DWIN_Draw_Rectangle(1, bColor, 202, MBASE(row) + 14, 258, MBASE(row) - 2); - DWINUI::Draw_String(tColor, bColor, 202, MBASE(row) - 1, options[value]); -} - -#if HAS_HOSTACTION_MENUS - - void CrealityDWINClass::Draw_String(char * string, uint8_t row, bool selected/*=false*/, bool below/*=false*/) { - if (!string) string[0] = '\0'; - const uint8_t offset_x = DWIN_WIDTH - strlen(string) * 8 - 20; - const uint8_t offset_y = (below) ? MENU_CHR_H * 3 / 5 : 0; - DWIN_Draw_Rectangle(1, Def_Background_Color, offset_x - 10, MBASE(row) + offset_y - 1, offset_x, MBASE(row) + 16 + offset_y); - DWINUI::Draw_String(Def_Text_Color, (selected) ? Def_Selected_Color : Def_Background_Color, offset_x, MBASE(row) - 1 + offset_y, string); - } - - const uint64_t CrealityDWINClass::Encode_String(const char * string) { - const char table[65] = "-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"; - uint64_t output = 0; - LOOP_L_N(i, strlen(string)) { - uint8_t upper_bound = 63, lower_bound = 0; - uint8_t midpoint; - LOOP_L_N(x, 6) { - midpoint = (uint8_t)(0.5 * (upper_bound + lower_bound)); - if (string[i] == table[midpoint]) break; - if (string[i] > table[midpoint]) - lower_bound = midpoint; - else - upper_bound = midpoint; - } - output += midpoint * pow(64, i); - } - return output; - } - - void CrealityDWINClass::Decode_String(uint64_t num, char * string) { - const char table[65] = "-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"; - LOOP_L_N(i, 30) { - string[i] = table[num % 64]; - num /= 64; - if (num == 0) { - string[i + 1] = '\0'; - break; - } - } - } - -#endif // HAS_HOSTACTION_MENUS - -uint16_t CrealityDWINClass::GetColor(uint8_t color, uint16_t original, bool light/*=false*/) { - switch (color) { - case Default: return original; - case White: return (light) ? Color_Light_White : Color_White; - case Green: return (light) ? Color_Light_Green : Color_Green; - case Cyan: return (light) ? Color_Light_Cyan : Color_Cyan; - case Blue: return (light) ? Color_Light_Blue : Color_Blue; - case Magenta: return (light) ? Color_Light_Magenta : Color_Magenta; - case Red: return (light) ? Color_Light_Red : Color_Red; - case Orange: return (light) ? Color_Light_Orange : Color_Orange; - case Yellow: return (light) ? Color_Light_Yellow : Color_Yellow; - case Brown: return (light) ? Color_Light_Brown : Color_Brown; - case Black: return Color_Black; - } - return Color_White; -} - -void CrealityDWINClass::Draw_Title(const char * ctitle) { - DWINUI::Draw_CenteredString((uint8_t)DWIN_FONT_HEAD, GetColor(eeprom_settings.menu_top_txt, Def_TitleTxt_color, false), 5, ctitle); -} -void CrealityDWINClass::Draw_Title(FSTR_P const ftitle) { - DWINUI::Draw_CenteredString((uint8_t)DWIN_FONT_HEAD, GetColor(eeprom_settings.menu_top_txt, Def_TitleTxt_color, false), 5, ftitle); -} - -void _Decorate_Menu_Item(uint8_t row, uint8_t icon, bool more) { - if (icon) DWIN_ICON_Show(ICON, icon, 26, MBASE(row) - 3); //Draw Menu Icon - if (more) DWIN_ICON_Show(ICON, ICON_More, 226, MBASE(row) - 3); // Draw More Arrow - DWIN_Draw_HLine(CrealityDWIN.GetColor(eeprom_settings.menu_split_line, Def_SplitLine_Color, true), 16, MBASE(row) + 33, 240); // Draw Menu Line -} - -void CrealityDWINClass::Draw_Menu_Item(uint8_t row, uint8_t icon/*=0*/, const char * label1, const char * label2, bool more/*=false*/, bool centered/*=false*/) { - const uint8_t label_offset_y = (label1 && label2) ? MENU_CHR_H * 3 / 5 : 0, - label1_offset_x = !centered ? LBLX : LBLX * 4/5 + _MAX(LBLX * 1/5U, (DWIN_WIDTH - LBLX - (label1 ? strlen(label1) : 0) * MENU_CHR_W) / 2), - label2_offset_x = !centered ? LBLX : LBLX * 4/5 + _MAX(LBLX * 1/5U, (DWIN_WIDTH - LBLX - (label2 ? strlen(label2) : 0) * MENU_CHR_W) / 2); - if (label1) DWINUI::Draw_String(label1_offset_x, MBASE(row) - 1 - label_offset_y, label1); // Draw Label - if (label2) DWINUI::Draw_String(label2_offset_x, MBASE(row) - 1 + label_offset_y, label2); // Draw Label - _Decorate_Menu_Item(row, icon, more); -} - -void CrealityDWINClass::Draw_Menu_Item(uint8_t row, uint8_t icon/*=0*/, FSTR_P const flabel1, FSTR_P const flabel2, bool more/*=false*/, bool centered/*=false*/) { - const uint8_t label_offset_y = (flabel1 && flabel2) ? MENU_CHR_H * 3 / 5 : 0, - label1_offset_x = !centered ? LBLX : LBLX * 4/5 + _MAX(LBLX * 1/5U, (DWIN_WIDTH - LBLX - (flabel1 ? strlen_P(FTOP(flabel1)) : 0) * MENU_CHR_W) / 2), - label2_offset_x = !centered ? LBLX : LBLX * 4/5 + _MAX(LBLX * 1/5U, (DWIN_WIDTH - LBLX - (flabel2 ? strlen_P(FTOP(flabel2)) : 0) * MENU_CHR_W) / 2); - if (flabel1) DWINUI::Draw_String(label1_offset_x, MBASE(row) - 1 - label_offset_y, flabel1); // Draw Label - if (flabel2) DWINUI::Draw_String(label2_offset_x, MBASE(row) - 1 + label_offset_y, flabel2); // Draw Label - _Decorate_Menu_Item(row, icon, more); -} - -void CrealityDWINClass::Draw_Checkbox(uint8_t row, bool value) { - #if ENABLED(DWIN_CREALITY_LCD_CUSTOM_ICONS) // Draw appropriate checkbox icon - DWIN_ICON_Show(ICON, (value ? ICON_Checkbox_T : ICON_Checkbox_F), 226, MBASE(row) - 3); - #else // Draw a basic checkbox using rectangles and lines - DWIN_Draw_Rectangle(1, Def_Background_Color, 226, MBASE(row) - 3, 226 + 20, MBASE(row) - 3 + 20); - DWIN_Draw_Rectangle(0, Def_Text_Color, 226, MBASE(row) - 3, 226 + 20, MBASE(row) - 3 + 20); - if (value) { - DWIN_Draw_Line(Check_Color, 227, MBASE(row) - 3 + 11, 226 + 8, MBASE(row) - 3 + 17); - DWIN_Draw_Line(Check_Color, 227 + 8, MBASE(row) - 3 + 17, 226 + 19, MBASE(row) - 3 + 1); - DWIN_Draw_Line(Check_Color, 227, MBASE(row) - 3 + 12, 226 + 8, MBASE(row) - 3 + 18); - DWIN_Draw_Line(Check_Color, 227 + 8, MBASE(row) - 3 + 18, 226 + 19, MBASE(row) - 3 + 2); - DWIN_Draw_Line(Check_Color, 227, MBASE(row) - 3 + 13, 226 + 8, MBASE(row) - 3 + 19); - DWIN_Draw_Line(Check_Color, 227 + 8, MBASE(row) - 3 + 19, 226 + 19, MBASE(row) - 3 + 3); - } - #endif -} - -void CrealityDWINClass::Draw_Menu(uint8_t menu, uint8_t select/*=0*/, uint8_t scroll/*=0*/) { - if (active_menu != menu) { - last_menu = active_menu; - if (process == Menu) last_selection = selection; - } - selection = _MIN(select, Get_Menu_Size(menu)); - scrollpos = scroll; - if (selection - scrollpos > MROWS) - scrollpos = selection - MROWS; - process = Menu; - active_menu = menu; - Clear_Screen(); - Draw_Title(Get_Menu_Title(menu)); - LOOP_L_N(i, TROWS) Menu_Item_Handler(menu, i + scrollpos); - DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.cursor_color, Def_Cursor_color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); -} - -void CrealityDWINClass::Redraw_Menu(bool lastprocess/*=true*/, bool lastselection/*=false*/, bool lastmenu/*=false*/) { - switch ((lastprocess) ? last_process : process) { - case Menu: - Draw_Menu((lastmenu) ? last_menu : active_menu, (lastselection) ? last_selection : selection, (lastmenu) ? 0 : scrollpos); - break; - case Main: Draw_Main_Menu((lastselection) ? last_selection : selection); break; - case Print: Draw_Print_Screen(); break; - case File: Draw_SD_List(); break; - default: break; - } -} - -void CrealityDWINClass::Redraw_Screen() { - if (printingIsActive()) Draw_Print_Screen(); - else Redraw_Menu(false); - Draw_Status_Area(true); - Update_Status_Bar(true); -} - -/* Primary Menus and Screen Elements */ - -void CrealityDWINClass::Main_Menu_Icons() { - - if (selection == 0) { - DWINUI::DRAW_IconWB(ICON, ICON_Print_1, 17, 110); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Def_Highlight_Color), 17, 110, 126, 209); - } - else - DWINUI::DRAW_IconWB(ICON, ICON_Print_0, 17, 110); - - DWINUI::Draw_String(52, 180, GET_TEXT_F(MSG_BUTTON_PRINT)); - - if (selection == 1) { - DWINUI::DRAW_IconWB(ICON, ICON_Prepare_1, 145, 110); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Def_Highlight_Color), 145, 110, 254, 209); - } - else - DWINUI::DRAW_IconWB(ICON, ICON_Prepare_0, 145, 110); - - DWINUI::Draw_String(170, 180, GET_TEXT_F(MSG_PREPARE)); - - if (selection == 2) { - DWINUI::DRAW_IconWB(ICON, ICON_Control_1, 17, 226); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Def_Highlight_Color), 17, 226, 126, 325); - } - else - DWINUI::DRAW_IconWB(ICON, ICON_Control_0, 17, 226); - - DWINUI::Draw_String(43, 297, GET_TEXT_F(MSG_CONTROL)); - - #if HAS_ABL_OR_UBL - - if (selection == 3) { - DWINUI::DRAW_IconWB(ICON, ICON_Leveling_1, 145, 226); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Def_Highlight_Color), 145, 226, 254, 325); - } - else - DWINUI::DRAW_IconWB(ICON, ICON_Leveling_0, 145, 226); - - DWINUI::Draw_String(179, 297, GET_TEXT_F(MSG_BUTTON_LEVEL)); - - #else - - if (selection == 3) { - DWINUI::DRAW_IconWB(ICON, ICON_Info_1, 145, 226); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Def_Highlight_Color), 145, 226, 254, 325); - } - else - DWINUI::DRAW_IconWB(ICON, ICON_Info_0, 145, 226); - - DWINUI::Draw_String(181, 297, GET_TEXT_F(MSG_BUTTON_INFO)); - - #endif -} - -void CrealityDWINClass::Draw_Main_Menu(uint8_t select/*=0*/) { - process = Main; - active_menu = MainMenu; - selection = select; - Clear_Screen(); - Draw_Title(Get_Menu_Title(MainMenu)); - SERIAL_ECHOPGM("\nDWIN handshake "); - DWIN_ICON_Show(ICON, ICON_LOGO, 71, 62); - Main_Menu_Icons(); -} - -void CrealityDWINClass::Print_Screen_Icons() { - if (selection == 0) { - DWINUI::DRAW_IconWB(ICON, ICON_Setup_1, 8, 252); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Def_Highlight_Color), 8, 252, 87, 351); - } - else - DWINUI::DRAW_IconWB(ICON, ICON_Setup_0, 8, 252); - - DWINUI::Draw_String(30, 322, GET_TEXT_F(MSG_TUNE)); - - if (selection == 2) { - DWINUI::DRAW_IconWB(ICON, ICON_Stop_1, 184, 252); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Def_Highlight_Color), 184, 252, 263, 351); - } - else - DWINUI::DRAW_IconWB(ICON, ICON_Stop_0, 184, 252); - - DWINUI::Draw_String(205, 322, GET_TEXT_F(MSG_BUTTON_STOP)); - - if (temp_val.paused) { - if (selection == 1) { - DWINUI::DRAW_IconWB(ICON, ICON_Continue_1, 96, 252); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Def_Highlight_Color), 96, 252, 175, 351); - } - else - DWINUI::DRAW_IconWB(ICON, ICON_Continue_0, 96, 252); - - DWINUI::Draw_String(114, 322, GET_TEXT_F(MSG_BUTTON_RESUME)); - } - else { - if (selection == 1) { - DWINUI::DRAW_IconWB(ICON, ICON_Pause_1, 96, 252); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Def_Highlight_Color), 96, 252, 175, 351); - } - else - DWINUI::DRAW_IconWB(ICON, ICON_Pause_0, 96, 252); - - DWINUI::Draw_String(114, 322, GET_TEXT_F(MSG_BUTTON_PAUSE)); - } -} - -void CrealityDWINClass::Draw_Print_Screen() { - process = Print; - selection = 0; - Clear_Screen(); - DWIN_Draw_Rectangle(1, Def_Background_Color, 8, 352, DWIN_WIDTH - 8, 376); - Draw_Title(GET_TEXT(MSG_PRINTING)); - Print_Screen_Icons(); - DWIN_ICON_Show(ICON, ICON_PrintTime, 14, 171); - DWIN_ICON_Show(ICON, ICON_RemainTime, 147, 169); - DWINUI::Draw_String(Def_PercentTxt_Color, 41, 163, GET_TEXT_F(MSG_INFO_PRINT_TIME)); - DWINUI::Draw_String(Def_PercentTxt_Color, 176, 163, GET_TEXT_F(MSG_REMAINING_TIME)); - Update_Status_Bar(true); - Draw_Print_ProgressBar(); - Draw_Print_ProgressElapsed(); - TERN_(USE_M73_REMAINING_TIME, Draw_Print_ProgressRemain()); - Draw_Print_Filename(true); -} - -void CrealityDWINClass::Draw_Print_Filename(const bool reset/*=false*/) { - static uint8_t namescrl = 0; - if (reset) namescrl = 0; - if (process == Print) { - size_t len = strlen(filename); - int8_t pos = len; - if (pos > STATUS_CHAR_LIMIT) { - pos -= namescrl; - len = _MIN((size_t)pos, (size_t)STATUS_CHAR_LIMIT); - char dispname[len + 1]; - if (pos >= 0) { - LOOP_L_N(i, len) dispname[i] = filename[i + namescrl]; - } - else { - LOOP_L_N(i, STATUS_CHAR_LIMIT + pos) dispname[i] = ' '; - LOOP_S_L_N(i, STATUS_CHAR_LIMIT + pos, STATUS_CHAR_LIMIT) dispname[i] = filename[i - (STATUS_CHAR_LIMIT + pos)]; - } - dispname[len] = '\0'; - DWIN_Draw_Rectangle(1, Def_Background_Color, 8, 50, DWIN_WIDTH - 8, 80); - const int8_t npos = (DWIN_WIDTH - STATUS_CHAR_LIMIT * MENU_CHR_W) / 2; - DWINUI::Draw_String(npos, 60, dispname); - if (-pos >= STATUS_CHAR_LIMIT) namescrl = 0; - namescrl++; - } - else { - DWIN_Draw_Rectangle(1, Def_Background_Color, 8, 50, DWIN_WIDTH - 8, 80); - const int8_t npos = (DWIN_WIDTH - strlen(filename) * MENU_CHR_W) / 2; - DWINUI::Draw_String(npos, 60, filename); - } - } -} - -void CrealityDWINClass::Draw_Print_ProgressBar() { - uint8_t printpercent = temp_val.sdprint ? card.percentDone() : (ui._get_progress() / 100); - DWINUI::DRAW_IconWB(ICON, ICON_Bar, 15, 93); - DWIN_Draw_Rectangle(1, Def_Barfill_Color, 16 + printpercent * 240 / 100, 93, 256, 113); - DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_percent, Def_PercentTxt_Color), Def_Background_Color, 3, 109, 133, printpercent); - DWINUI::Draw_String(GetColor(eeprom_settings.progress_percent, Def_PercentTxt_Color), Def_Background_Color, 134, 133, F("%")); -} - -#if ENABLED(USE_M73_REMAINING_TIME) - - void CrealityDWINClass::Draw_Print_ProgressRemain() { - uint16_t remainingtime = ui.get_remaining_time(); - DWIN_Draw_IntValue(true, true, 1, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Def_PercentTxt_Color), Def_Background_Color, 2, 176, 187, remainingtime / 3600); - DWIN_Draw_IntValue(true, true, 1, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Def_PercentTxt_Color), Def_Background_Color, 2, 201, 187, (remainingtime % 3600) / 60); - if (eeprom_settings.time_format_textual) { - DWINUI::Draw_String(GetColor(eeprom_settings.progress_time, Def_PercentTxt_Color), Def_Background_Color, 193, 187, F("h")); - DWINUI::Draw_String(GetColor(eeprom_settings.progress_time, Def_PercentTxt_Color), Def_Background_Color, 217, 187, F("m")); - } - else - DWINUI::Draw_String(GetColor(eeprom_settings.progress_time, Def_PercentTxt_Color), Def_Background_Color, 193, 187, F(":")); - } - -#endif - -void CrealityDWINClass::Draw_Print_ProgressElapsed() { - duration_t elapsed = print_job_timer.duration(); - DWIN_Draw_IntValue(true, true, 1, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Def_PercentTxt_Color), Def_Background_Color, 2, 42, 187, elapsed.value / 3600); - DWIN_Draw_IntValue(true, true, 1, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Def_PercentTxt_Color), Def_Background_Color, 2, 67, 187, (elapsed.value % 3600) / 60); - if (eeprom_settings.time_format_textual) { - DWINUI::Draw_String(GetColor(eeprom_settings.progress_time, Def_PercentTxt_Color), Def_Background_Color, 59, 187, F("h")); - DWINUI::Draw_String(GetColor(eeprom_settings.progress_time, Def_PercentTxt_Color), Def_Background_Color, 83, 187, F("m")); - } - else - DWINUI::Draw_String(GetColor(eeprom_settings.progress_time, Def_PercentTxt_Color), Def_Background_Color, 59, 187, F(":")); -} - -void CrealityDWINClass::Draw_PrintDone_confirm() { - process = Confirm; - popup = Complete; - if (TERN0(HAS_GCODE_PREVIEW, Preview_Valid())) { - Clear_Screen(); - Draw_Title(GET_TEXT(MSG_PRINT_DONE)); - DWIN_ICON_Show(0, 0, 1, 21, 100, 0x00); - DWINUI::Draw_Button(BTN_Continue, 87, 300); - } - else { - Draw_Print_Screen(); - DWIN_Draw_Rectangle(1, Def_Background_Color, 8, 252, 263, 351); - DWINUI::Draw_Button(BTN_Continue, 87, 283); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Def_Highlight_Color), 86, 282, 187, 321); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Def_Highlight_Color), 85, 281, 188, 322); - } -} - -void CrealityDWINClass::Draw_SD_Item(uint8_t item, uint8_t row) { - if (item == 0) - Draw_Menu_Item(0, ICON_Back, card.flag.workDirIsRoot ? GET_TEXT_F(MSG_BACK) : F("..")); - else { - card.getfilename_sorted(SD_ORDER(item - 1, card.get_num_Files())); - char * const filename = card.longest_filename(); - size_t max = MENU_CHAR_LIMIT; - size_t pos = strlen(filename), len = pos; - if (!card.flag.filenameIsDir) - while (pos && filename[pos] != '.') pos--; - len = pos; - NOMORE(len, max); - char name[len + 1]; - memcpy(name, filename, len); - if (pos > max) LOOP_S_L_N(i, len - 3, len) name[i] = '.'; - name[len] = '\0'; - Draw_Menu_Item(row, card.flag.filenameIsDir ? ICON_More : ICON_File, name); - } -} - -void CrealityDWINClass::Draw_SD_List(bool removed/*=false*/) { - Clear_Screen(); - Draw_Title("Select File"); - selection = 0; - scrollpos = 0; - process = File; - if (card.isMounted() && !removed) { - LOOP_L_N(i, _MIN(card.get_num_Files() + 1, TROWS)) - Draw_SD_Item(i, i); - } - else { - Draw_Menu_Item(0, ICON_Back, GET_TEXT_F(MSG_BACK)); - DWIN_Draw_Rectangle(1, Def_AlertBg_Color, 10, MBASE(3) - 10, DWIN_WIDTH - 10, MBASE(4)); - DWINUI::Draw_String(font16x32, Def_AlertTxt_Color, Def_AlertBg_Color, ((DWIN_WIDTH) - 8 * 16) / 2, MBASE(3), GET_TEXT_F(MSG_NO_MEDIA)); - } - DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.cursor_color, Def_Cursor_color), 0, MBASE(0) - 18, 14, MBASE(0) + 33); -} - -void CrealityDWINClass::Draw_Status_Area(bool icons/*=false*/) { - - if (icons) DWIN_Draw_Rectangle(1, Def_Background_Color, 0, STATUS_Y, DWIN_WIDTH, DWIN_HEIGHT - 1); - - #if HAS_HOTEND - static float hotend = -1; - static int16_t hotendtarget = -1, flow = -1; - if (icons) { - hotend = -1; - hotendtarget = -1; - DWIN_ICON_Show(ICON, ICON_HotendTemp, 10, 383); - DWINUI::Draw_String(DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), Def_Background_Color, 25 + 3 * STAT_CHR_W + 5, 384, F("/")); - } - if (thermalManager.temp_hotend[0].celsius != hotend) { - hotend = thermalManager.temp_hotend[0].celsius; - DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), Def_Background_Color, 3, 28, 384, thermalManager.temp_hotend[0].celsius); - DWIN_Draw_DegreeSymbol(GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), 25 + 3 * STAT_CHR_W + 5, 386); - } - if (thermalManager.temp_hotend[0].target != hotendtarget) { - hotendtarget = thermalManager.temp_hotend[0].target; - DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), Def_Background_Color, 3, 25 + 4 * STAT_CHR_W + 6, 384, thermalManager.temp_hotend[0].target); - DWIN_Draw_DegreeSymbol(GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), 25 + 4 * STAT_CHR_W + 39, 386); - } - if (icons) { - flow = -1; - DWIN_ICON_Show(ICON, ICON_StepE, 112, 417); - DWINUI::Draw_String(DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), Def_Background_Color, 116 + 5 * STAT_CHR_W + 2, 417, F("%")); - } - if (planner.flow_percentage[0] != flow) { - flow = planner.flow_percentage[0]; - DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), Def_Background_Color, 3, 116 + 2 * STAT_CHR_W, 417, planner.flow_percentage[0]); - } - #endif - - #if HAS_HEATED_BED - static float bed = -1; - static int16_t bedtarget = -1; - if (icons) { - bed = -1; - bedtarget = -1; - DWIN_ICON_Show(ICON, ICON_BedTemp, 10, 416); - DWINUI::Draw_String(DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), Def_Background_Color, 25 + 3 * STAT_CHR_W + 5, 417, F("/")); - } - if (thermalManager.temp_bed.celsius != bed) { - bed = thermalManager.temp_bed.celsius; - DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), Def_Background_Color, 3, 28, 417, thermalManager.temp_bed.celsius); - DWIN_Draw_DegreeSymbol(GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), 25 + 3 * STAT_CHR_W + 5, 419); - } - if (thermalManager.temp_bed.target != bedtarget) { - bedtarget = thermalManager.temp_bed.target; - DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), Def_Background_Color, 3, 25 + 4 * STAT_CHR_W + 6, 417, thermalManager.temp_bed.target); - DWIN_Draw_DegreeSymbol(GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), 25 + 4 * STAT_CHR_W + 39, 419); - } - #endif - - #if HAS_FAN - static uint8_t fan = -1; - if (icons) { - fan = -1; - DWIN_ICON_Show(ICON, ICON_FanSpeed, 187, 383); - } - if (thermalManager.fan_speed[0] != fan) { - fan = thermalManager.fan_speed[0]; - DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), Def_Background_Color, 3, 195 + 2 * STAT_CHR_W, 384, thermalManager.fan_speed[0]); - } - #endif - - #if HAS_ZOFFSET_ITEM - static float offset = -1; - - #if HAS_MESH - static bool _leveling_active = false, - _printing_leveling_active = false; - if (printingIsActive()) { - _printing_leveling_active = ((planner.leveling_active && planner.leveling_active_at_z(current_position.z)) || _printing_leveling_active ); - if ((_printing_leveling_active = (planner.leveling_active && planner.leveling_active_at_z(current_position.z)) && ui.get_blink())) - DWIN_Draw_Rectangle(1, Def_SplitLine_Color, 186, 415, 205, 436); - else - DWIN_Draw_Rectangle(1, Def_Background_Color, 186, 415, 205, 436); - } - else { - _leveling_active = (planner.leveling_active || _leveling_active); - if ((_leveling_active = planner.leveling_active && ui.get_blink())) - DWIN_Draw_Rectangle(1, Def_SplitLine_Color, 186, 415, 205, 436); - else - DWIN_Draw_Rectangle(1, Def_Background_Color, 186, 415, 205, 436); - } - DWIN_ICON_Show(ICON, ICON_Zoffset, 187, 416); - #else - if (icons) DWIN_ICON_Show(ICON, ICON_Zoffset, 187, 416); - #endif - if (temp_val.zoffsetvalue != offset || icons) { - offset = temp_val.zoffsetvalue; - DWINUI::Draw_Signed_Float(DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Def_Indicator_Color),Def_Background_Color, 1, 2, 202, 417, temp_val.zoffsetvalue); - } - #endif - - static int16_t feedrate = -1; - if (icons) { - feedrate = -1; - DWIN_ICON_Show(ICON, ICON_Speed, 113, 383); - DWINUI::Draw_String(DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), Def_Background_Color, 116 + 5 * STAT_CHR_W + 2, 384, F("%")); - } - if (feedrate_percentage != feedrate) { - feedrate = feedrate_percentage; - DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Def_Indicator_Color), Def_Background_Color, 3, 116 + 2 * STAT_CHR_W, 384, feedrate_percentage); - } - - static float x = -1, y = -1, z = -1; - static bool update_x = false, update_y = false, update_z = false; - update_x = (current_position.x != x || axis_should_home(X_AXIS) || update_x); - update_y = (current_position.y != y || axis_should_home(Y_AXIS) || update_y); - update_z = (current_position.z != z || axis_should_home(Z_AXIS) || update_z); - if (icons) { - x = y = z = -1; - DWIN_Draw_Line(GetColor(eeprom_settings.coordinates_split_line, Def_SplitLine_Color, true), 16, 450, 256, 450); - DWIN_ICON_Show(ICON, ICON_MaxSpeedX, 10, 456); - DWIN_ICON_Show(ICON, ICON_MaxSpeedY, 95, 456); - DWIN_ICON_Show(ICON, ICON_MaxSpeedZ, 180, 456); - } - if (update_x) { - x = current_position.x; - if ((update_x = axis_should_home(X_AXIS) && ui.get_blink())) - DWINUI::Draw_String(GetColor(eeprom_settings.coordinates_text, Def_Coordinate_Color), Def_Background_Color, 39, 459, F(" -?- ")); - else - DWINUI::Draw_Signed_Float(DWIN_FONT_MENU, GetColor(eeprom_settings.coordinates_text, Def_Coordinate_Color), Def_Background_Color, 3, 1, 31, 459, current_position.x); - } - if (update_y) { - y = current_position.y; - if ((update_y = axis_should_home(Y_AXIS) && ui.get_blink())) - DWINUI::Draw_String(GetColor(eeprom_settings.coordinates_text, Def_Coordinate_Color), Def_Background_Color, 124, 459, F(" -?- ")); - else - DWINUI::Draw_Signed_Float(DWIN_FONT_MENU, GetColor(eeprom_settings.coordinates_text, Def_Coordinate_Color), Def_Background_Color, 3, 1, 116, 459, current_position.y); - } - if (update_z) { - z = current_position.z; - if ((update_z = axis_should_home(Z_AXIS) && ui.get_blink())) - DWINUI::Draw_String(GetColor(eeprom_settings.coordinates_text, Def_Coordinate_Color), Def_Background_Color, 205, 459, F(" -?- ")); - else - DWINUI::Draw_Signed_Float(DWIN_FONT_MENU, GetColor(eeprom_settings.coordinates_text, Def_Coordinate_Color), Def_Background_Color, 3, 2, 197, 459, current_position.z); - } - DWIN_UpdateLCD(); -} - -void CrealityDWINClass::Draw_Popup(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, uint8_t mode, uint8_t icon/*=0*/) { - if (process != Confirm && process != Popup && process != Wait && process != Cancel) last_process = process; - if ((process == Menu || process == Wait) && mode == Popup) last_selection = selection; - process = mode; - if (popup != PrintConfirm) { - Clear_Screen(); - DWIN_Draw_Rectangle(0, Def_Highlight_Color, 13, 59, 259, 346); - DWIN_Draw_Rectangle(1, Def_PopupBg_color, 14, 60, 258, 345); - } - else DWIN_Draw_Rectangle(1, Def_Background_Color, 0, 0, DWIN_WIDTH, STATUS_Y - 1); - const uint8_t ypos = (mode == Popup || mode == Confirm) ? 150 : (mode == Cancel) ? 200 : 230; - if (icon > 0) DWIN_ICON_Show(ICON, icon, 101, 105); - if (line1) DWINUI::Draw_String(Def_PopupTxt_Color, (272 - 8 * strlen_P(FTOP(line1))) / 2, ypos, line1); - if (line2) DWINUI::Draw_String(Def_PopupTxt_Color, (272 - 8 * strlen_P(FTOP(line2))) / 2, ypos + 30, line2); - if (line3) DWINUI::Draw_String(Def_PopupTxt_Color, (272 - 8 * strlen_P(FTOP(line3))) / 2, ypos + 60, line3); - if (mode == Popup) { - selection = 0; - DWINUI::Draw_Button(BTN_Confirm, 26, 280); - DWINUI::Draw_Button(BTN_Cancel, 146, 280); - Popup_Select(); - } - else if (mode == Confirm) DWINUI::Draw_Button(BTN_Continue, 87, 280); - else if (mode == Cancel) DWINUI::Draw_Button(BTN_Cancel, 87, 280); -} - -void MarlinUI::kill_screen(FSTR_P const error, FSTR_P const) { - CrealityDWIN.Draw_Popup(GET_TEXT_F(MSG_KILLED), error, GET_TEXT_F(MSG_SWITCH_PS_OFF), Wait, ICON_BLTouch); -} - -void CrealityDWINClass::Popup_Select() { - const uint16_t c1 = (selection == 0) ? GetColor(eeprom_settings.highlight_box, Def_Highlight_Color) : Def_Background_Color, - c2 = (selection == 0) ? Def_Background_Color : GetColor(eeprom_settings.highlight_box, Def_Highlight_Color); - DWIN_Draw_Rectangle(0, c1, 25, 279, 126, 318); - DWIN_Draw_Rectangle(0, c1, 24, 278, 127, 319); - DWIN_Draw_Rectangle(0, c2, 145, 279, 246, 318); - DWIN_Draw_Rectangle(0, c2, 144, 278, 247, 319); -} - -void CrealityDWINClass::Update_Status_Bar(bool refresh/*=false*/) { - static bool new_msg; - static uint8_t msgscrl = 0; - static char lastmsg[128]; - if (strcmp(lastmsg, statusmsg) != 0 || refresh) { - strcpy(lastmsg, statusmsg); - msgscrl = 0; - new_msg = true; - } - size_t len = strlen(statusmsg); - int8_t pos = len; - if (pos > STATUS_CHAR_LIMIT) { - pos -= msgscrl; - len = _MIN((size_t)pos, (size_t)STATUS_CHAR_LIMIT); - char dispmsg[len + 1]; - if (pos >= 0) { - LOOP_L_N(i, len) dispmsg[i] = statusmsg[i + msgscrl]; - } - else { - LOOP_L_N(i, STATUS_CHAR_LIMIT + pos) dispmsg[i] = ' '; - LOOP_S_L_N(i, STATUS_CHAR_LIMIT + pos, STATUS_CHAR_LIMIT) dispmsg[i] = statusmsg[i - (STATUS_CHAR_LIMIT + pos)]; - } - dispmsg[len] = '\0'; - if (process == Print) { - DWIN_Draw_Rectangle(1, Def_StatusBg_Color, 8, 214, DWIN_WIDTH - 8, 238); - const int8_t npos = (DWIN_WIDTH - STATUS_CHAR_LIMIT * MENU_CHR_W) / 2; - DWINUI::Draw_String(GetColor(eeprom_settings.status_bar_text, Def_StatusTxt_Color), Def_StatusBg_Color, npos, 219, dispmsg); - } - else { - DWIN_Draw_Rectangle(1, Def_StatusBg_Color, 8, 352, DWIN_WIDTH - 8, 376); - const int8_t npos = (DWIN_WIDTH - STATUS_CHAR_LIMIT * MENU_CHR_W) / 2; - DWINUI::Draw_String(GetColor(eeprom_settings.status_bar_text, Def_StatusTxt_Color), Def_StatusBg_Color, npos, 357, dispmsg); - } - if (-pos >= STATUS_CHAR_LIMIT) msgscrl = 0; - msgscrl++; - } - else { - if (new_msg) { - new_msg = false; - if (process == Print) { - DWIN_Draw_Rectangle(1, Def_StatusBg_Color, 8, 214, DWIN_WIDTH - 8, 238); - const int8_t npos = (DWIN_WIDTH - strlen(statusmsg) * MENU_CHR_W) / 2; - DWINUI::Draw_String(GetColor(eeprom_settings.status_bar_text, Def_StatusTxt_Color), Def_StatusBg_Color, npos, 219, statusmsg); - } - else { - DWIN_Draw_Rectangle(1, Def_StatusBg_Color, 8, 352, DWIN_WIDTH - 8, 376); - const int8_t npos = (DWIN_WIDTH - strlen(statusmsg) * MENU_CHR_W) / 2; - DWINUI::Draw_String(GetColor(eeprom_settings.status_bar_text, Def_StatusTxt_Color), Def_StatusBg_Color, npos, 357, statusmsg); - } - } - } -} - -#if HAS_HOSTACTION_MENUS - - void CrealityDWINClass::Draw_Keyboard(bool restrict, bool numeric, uint8_t selected, bool uppercase/*=false*/, bool lock/*=false*/) { - process = Keyboard; - keyboard_restrict = restrict; - numeric_keyboard = numeric; - DWIN_Draw_Rectangle(0, Def_SplitLine_Color, 0, KEY_Y_START, DWIN_WIDTH-2, DWIN_HEIGHT-2); - DWIN_Draw_Rectangle(1, Def_Background_Color, 1, KEY_Y_START+1, DWIN_WIDTH-3, DWIN_HEIGHT-3); - LOOP_L_N(i, 36) Draw_Keys(i, (i == selected), uppercase, lock); - } - - void CrealityDWINClass::Draw_Keys(uint8_t index, bool selected, bool uppercase/*=false*/, bool lock/*=false*/) { - const char *keys; - if (numeric_keyboard) keys = "1234567890&<>() {}[]*\"\':;!?"; - else keys = (uppercase) ? "QWERTYUIOPASDFGHJKLZXCVBNM" : "qwertyuiopasdfghjklzxcvbnm"; - #define KEY_X1(x) x*KEY_WIDTH+KEY_INSET+KEY_PADDING - #define KEY_X2(x) (x+1) * KEY_WIDTH+KEY_INSET-KEY_PADDING - #define KEY_Y1(y) KEY_Y_START+KEY_INSET+KEY_PADDING+y*KEY_HEIGHT - #define KEY_Y2(y) KEY_Y_START+KEY_INSET-KEY_PADDING+(y+1) * KEY_HEIGHT - - const uint8_t rowCount[3] = { 10, 9, 7 }; - const float xOffset[3] = { 0, 0.5f * KEY_WIDTH, 1.5f * KEY_WIDTH }; - - if (index < 28) { - if (index == 19) { - DWIN_Draw_Rectangle(0, Color_Light_Blue, KEY_X1(0), KEY_Y1(2), KEY_X2(0) + xOffset[1], KEY_Y2(2)); - DWIN_Draw_Rectangle(0, (selected) ? Def_Selected_Color : Def_Background_Color, KEY_X1(0) + 1, KEY_Y1(2) + 1, KEY_X2(0) + xOffset[1] - 1, KEY_Y2(2) - 1); - if (!numeric_keyboard) { - if (lock) { - DWIN_Draw_Line(Def_Selected_Color, KEY_X1(0) + 17, KEY_Y1(2) + 16, KEY_X1(0) + 25, KEY_Y1(2) + 8); - DWIN_Draw_Line(Def_Selected_Color, KEY_X1(0) + 17, KEY_Y1(2) + 16, KEY_X1(0) + 9, KEY_Y1(2) + 8); - } - else { - DWIN_Draw_Line((uppercase) ? Def_Selected_Color : Def_Text_Color, KEY_X1(0) + 17, KEY_Y1(2) + 8, KEY_X1(0) + 25, KEY_Y1(2) + 16); - DWIN_Draw_Line((uppercase) ? Def_Selected_Color : Def_Text_Color, KEY_X1(0) + 17, KEY_Y1(2) + 8, KEY_X1(0) + 9, KEY_Y1(2) + 16); - } - } - } - else if (index == 27) { - DWIN_Draw_Rectangle(0, Color_Light_Blue, KEY_X1(7) + xOffset[2], KEY_Y1(2), KEY_X2(9), KEY_Y2(2)); - DWIN_Draw_Rectangle(0, (selected) ? Def_Selected_Color : Def_Background_Color, KEY_X1(7) + xOffset[2] + 1, KEY_Y1(2) + 1, KEY_X2(9) - 1, KEY_Y2(2) - 1); - DWINUI::Draw_String(Color_Red, KEY_X1(7) + xOffset[2] + 3, KEY_Y1(2) + 5, F("<--")); - } - else { - if (index > 19) index--; - if (index > 27) index--; - uint8_t y, x; - if (index < rowCount[0]) y = 0, x = index; - else if (index < (rowCount[0] + rowCount[1])) y = 1, x = index-rowCount[0]; - else y = 2, x = index-(rowCount[0] + rowCount[1]); - const char keyStr[2] = {keys[(y > 0) * rowCount[0] + (y > 1) * rowCount[1] + x], '\0'}; - DWIN_Draw_Rectangle(0, Color_Light_Blue, KEY_X1(x) + xOffset[y], KEY_Y1(y), KEY_X2(x) + xOffset[y], KEY_Y2(y)); - DWIN_Draw_Rectangle(0, (selected) ? Def_Selected_Color : Def_Background_Color, KEY_X1(x) + xOffset[y] + 1, KEY_Y1(y) + 1, KEY_X2(x) + xOffset[y] - 1, KEY_Y2(y) - 1); - DWINUI::Draw_String(KEY_X1(x) + xOffset[y] + 5, KEY_Y1(y) + 5, keyStr); - if (keyboard_restrict && numeric_keyboard && index > 9) { - DWIN_Draw_Line(Color_Light_Red, KEY_X1(x) + xOffset[y] + 1, KEY_Y1(y) + 1, KEY_X2(x) + xOffset[y] - 1, KEY_Y2(y) - 1); - DWIN_Draw_Line(Color_Light_Red, KEY_X1(x) + xOffset[y] + 1, KEY_Y2(y) - 1, KEY_X2(x) + xOffset[y] - 1, KEY_Y1(y) + 1); - } - } - } - else { - switch (index) { - case 28: - DWIN_Draw_Rectangle(0, Color_Light_Blue, KEY_X1(0), KEY_Y1(3), KEY_X2(0) + xOffset[1], KEY_Y2(3)); - DWIN_Draw_Rectangle(0, (selected) ? Def_Selected_Color : Def_Background_Color, KEY_X1(0) + 1, KEY_Y1(3) + 1, KEY_X2(0) + xOffset[1] - 1, KEY_Y2(3) - 1); - DWINUI::Draw_String(KEY_X1(0) - 1, KEY_Y1(3) + 5, F("?123")); - break; - case 29: - DWIN_Draw_Rectangle(0, Color_Light_Blue, KEY_X1(1) + xOffset[1], KEY_Y1(3), KEY_X2(1) + xOffset[1], KEY_Y2(3)); - DWIN_Draw_Rectangle(0, (selected) ? Def_Selected_Color : Def_Background_Color, KEY_X1(1) + xOffset[1] + 1, KEY_Y1(3) + 1, KEY_X2(1) + xOffset[1] - 1, KEY_Y2(3) - 1); - DWINUI::Draw_String(KEY_X1(1) + xOffset[1] + 5, KEY_Y1(3) + 5, F("-")); - break; - case 30: - DWIN_Draw_Rectangle(0, Color_Light_Blue, KEY_X1(2) + xOffset[1], KEY_Y1(3), KEY_X2(2) + xOffset[1], KEY_Y2(3)); - DWIN_Draw_Rectangle(0, (selected) ? Def_Selected_Color : Def_Background_Color, KEY_X1(2) + xOffset[1] + 1, KEY_Y1(3) + 1, KEY_X2(2) + xOffset[1] - 1, KEY_Y2(3) - 1); - DWINUI::Draw_String(KEY_X1(2) + xOffset[1] + 5, KEY_Y1(3) + 5, F("_")); - break; - case 31: - DWIN_Draw_Rectangle(0, Color_Light_Blue, KEY_X1(3) + xOffset[1], KEY_Y1(3), KEY_X2(5) + xOffset[1], KEY_Y2(3)); - DWIN_Draw_Rectangle(0, (selected) ? Def_Selected_Color : Def_Background_Color, KEY_X1(3) + xOffset[1] + 1, KEY_Y1(3) + 1, KEY_X2(5) + xOffset[1] - 1, KEY_Y2(3) - 1); - DWINUI::Draw_String(KEY_X1(3) + xOffset[1] + 14, KEY_Y1(3) + 5, F("Space")); - if (keyboard_restrict) { - DWIN_Draw_Line(Color_Light_Red, KEY_X1(3) + xOffset[1] + 1, KEY_Y1(3) + 1, KEY_X2(5) + xOffset[1] - 1, KEY_Y2(3) - 1); - DWIN_Draw_Line(Color_Light_Red, KEY_X1(3) + xOffset[1] + 1, KEY_Y2(3) - 1, KEY_X2(5) + xOffset[1] - 1, KEY_Y1(3) + 1); - } - break; - case 32: - DWIN_Draw_Rectangle(0, Color_Light_Blue, KEY_X1(6) + xOffset[1], KEY_Y1(3), KEY_X2(6) + xOffset[1], KEY_Y2(3)); - DWIN_Draw_Rectangle(0, (selected) ? Def_Selected_Color : Def_Background_Color, KEY_X1(6) + xOffset[1] + 1, KEY_Y1(3) + 1, KEY_X2(6) + xOffset[1] - 1, KEY_Y2(3) - 1); - DWINUI::Draw_String(KEY_X1(6) + xOffset[1] + 7, KEY_Y1(3) + 5, F(".")); - if (keyboard_restrict) { - DWIN_Draw_Line(Color_Light_Red, KEY_X1(6) + xOffset[1] + 1, KEY_Y1(3) + 1, KEY_X2(6) + xOffset[1] - 1, KEY_Y2(3) - 1); - DWIN_Draw_Line(Color_Light_Red, KEY_X1(6) + xOffset[1] + 1, KEY_Y2(3) - 1, KEY_X2(6) + xOffset[1] - 1, KEY_Y1(3) + 1); - } - break; - case 33: - DWIN_Draw_Rectangle(0, Color_Light_Blue, KEY_X1(7) + xOffset[1], KEY_Y1(3), KEY_X2(7) + xOffset[1], KEY_Y2(3)); - DWIN_Draw_Rectangle(0, (selected) ? Def_Selected_Color : Def_Background_Color, KEY_X1(7) + xOffset[1] + 1, KEY_Y1(3) + 1, KEY_X2(7) + xOffset[1] - 1, KEY_Y2(3) - 1); - DWINUI::Draw_String(KEY_X1(7) + xOffset[1] + 4, KEY_Y1(3) + 5, F("/")); - if (keyboard_restrict) { - DWIN_Draw_Line(Color_Light_Red, KEY_X1(7) + xOffset[1] + 1, KEY_Y1(3) + 1, KEY_X2(7) + xOffset[1] - 1, KEY_Y2(3) - 1); - DWIN_Draw_Line(Color_Light_Red, KEY_X1(7) + xOffset[1] + 1, KEY_Y2(3) - 1, KEY_X2(7) + xOffset[1] - 1, KEY_Y1(3) + 1); - } - break; - case 34: - DWIN_Draw_Rectangle(0, Color_Light_Blue, KEY_X1(7) + xOffset[2], KEY_Y1(3), KEY_X2(9), KEY_Y2(3)); - DWIN_Draw_Rectangle(0, (selected) ? Def_Selected_Color : Def_Background_Color, KEY_X1(7) + xOffset[2] + 1, KEY_Y1(3) + 1, KEY_X2(9) - 1, KEY_Y2(3) - 1); - DWINUI::Draw_String(Color_Cyan, KEY_X1(7) + xOffset[2] + 3, KEY_Y1(3) + 5, F("-->")); - break; - } - } - } -#endif // HAS_HOSTACTION_MENUS - -/* Menu Item Config */ - -void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/*=true*/) { - const uint8_t row = item - scrollpos; - #if HAS_LEVELING - static bool level_state; - #endif - - #if HAS_PREHEAT - - #define PREHEAT_BACK 0 - #define PREHEAT_SUBMENU_HOTEND (PREHEAT_BACK + ENABLED(HAS_HOTEND)) - #define PREHEAT_SUBMENU_BED (PREHEAT_SUBMENU_HOTEND + ENABLED(HAS_HEATED_BED)) - #define PREHEAT_SUBMENU_FAN (PREHEAT_SUBMENU_BED + ENABLED(HAS_FAN)) - #define PREHEAT_SUBMENU_TOTAL PREHEAT_SUBMENU_FAN - - auto preheat_submenu = [&](const int index, const uint8_t item, const uint8_t sel) { - switch (item) { - case PREHEAT_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(TempMenu, sel); - break; - #if HAS_HOTEND - case PREHEAT_SUBMENU_HOTEND: - if (draw) { - Draw_Menu_Item(row, ICON_SetEndTemp, F("Hotend")); - Draw_Float(ui.material_preset[index].hotend_temp, row, false, 1); - } - else - Modify_Value(ui.material_preset[index].hotend_temp, MIN_E_TEMP, MAX_E_TEMP, 1); - break; - #endif - #if HAS_HEATED_BED - case PREHEAT_SUBMENU_BED: - if (draw) { - Draw_Menu_Item(row, ICON_SetBedTemp, F("Bed")); - Draw_Float(ui.material_preset[index].bed_temp, row, false, 1); - } - else - Modify_Value(ui.material_preset[index].bed_temp, MIN_BED_TEMP, MAX_BED_TEMP, 1); - break; - #endif - #if HAS_FAN - case PREHEAT_SUBMENU_FAN: - if (draw) { - Draw_Menu_Item(row, ICON_FanSpeed, GET_TEXT_F(MSG_FAN_SPEED)); - Draw_Float(ui.material_preset[index].fan_speed, row, false, 1); - } - else - Modify_Value(ui.material_preset[index].fan_speed, MIN_FAN_SPEED, MAX_FAN_SPEED, 1); - break; - #endif - } - }; - - #endif - - switch (menu) { - case Prepare: - - #define PREPARE_BACK 0 - #define PREPARE_MOVE (PREPARE_BACK + 1) - #define PREPARE_DISABLE (PREPARE_MOVE + 1) - #define PREPARE_HOME (PREPARE_DISABLE + 1) - #define PREPARE_MANUALLEVEL (PREPARE_HOME + 1) - #define PREPARE_ZOFFSET (PREPARE_MANUALLEVEL + ENABLED(HAS_ZOFFSET_ITEM)) - #define PREPARE_PREHEAT (PREPARE_ZOFFSET + ENABLED(HAS_PREHEAT)) - #define PREPARE_COOLDOWN (PREPARE_PREHEAT + EITHER(HAS_HOTEND, HAS_HEATED_BED)) - #define PREPARE_CHANGEFIL (PREPARE_COOLDOWN + ENABLED(ADVANCED_PAUSE_FEATURE)) - #define PREPARE_ACTIONCOMMANDS (PREPARE_CHANGEFIL + ENABLED(HAS_HOSTACTION_MENUS)) - #define PREPARE_CUSTOM_MENU (PREPARE_ACTIONCOMMANDS + ENABLED(HAS_CUSTOM_MENU)) - #define PREPARE_TOTAL PREPARE_ACTIONCOMMANDS - - switch (item) { - case PREPARE_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Main_Menu(1); - break; - case PREPARE_MOVE: - if (draw) - Draw_Menu_Item(row, ICON_Axis, GET_TEXT_F(MSG_MOVE_AXIS), nullptr, true); - else - Draw_Menu(Move); - break; - case PREPARE_DISABLE: - if (draw) - Draw_Menu_Item(row, ICON_CloseMotor, GET_TEXT_F(MSG_DISABLE_STEPPERS)); - else - queue.inject(F("M84")); - break; - case PREPARE_HOME: - if (draw) - Draw_Menu_Item(row, ICON_SetHome, GET_TEXT_F(MSG_HOMING), nullptr, true); - else - Draw_Menu(HomeMenu); - break; - case PREPARE_MANUALLEVEL: - if (draw) - Draw_Menu_Item(row, ICON_PrintSize, GET_TEXT_F(MSG_BED_TRAMMING_MANUAL), nullptr, true); - else { - if (axes_should_home()) { - Popup_Handler(Home); - gcode.home_all_axes(true); - } - #if HAS_LEVELING - level_state = planner.leveling_active; - set_bed_leveling_enabled(false); - #endif - Draw_Menu(ManualLevel); - } - break; - - #if HAS_ZOFFSET_ITEM - case PREPARE_ZOFFSET: - if (draw) - Draw_Menu_Item(row, ICON_Zoffset, F("Z-Offset"), nullptr, true); - else { - #if HAS_LEVELING - level_state = planner.leveling_active; - set_bed_leveling_enabled(false); - #endif - Draw_Menu(ZOffset); - } - break; - #endif - - #if HAS_PREHEAT - case PREPARE_PREHEAT: - if (draw) - Draw_Menu_Item(row, ICON_Temperature, F("Preheat"), nullptr, true); - else - Draw_Menu(Preheat); - break; - #endif - - #if HAS_HOTEND || HAS_HEATED_BED - case PREPARE_COOLDOWN: - if (draw) - Draw_Menu_Item(row, ICON_Cool, GET_TEXT_F(MSG_COOLDOWN)); - else { - thermalManager.cooldown(); - Update_Status(GET_TEXT(MSG_COOLDOWN)); - } - break; - #endif - - #if HAS_HOSTACTION_MENUS - case PREPARE_ACTIONCOMMANDS: - if (draw) - Draw_Menu_Item(row, ICON_SetHome, F("Host Actions"), nullptr, true); - else - Draw_Menu(HostActions); - break; - #endif - - #if HAS_CUSTOM_MENU - case PREPARE_CUSTOM_MENU: - #ifndef CUSTOM_MENU_CONFIG_TITLE - #define CUSTOM_MENU_CONFIG_TITLE "Custom Commands" - #endif - if (draw) - Draw_Menu_Item(row, ICON_Version, F(CUSTOM_MENU_CONFIG_TITLE)); - else - Draw_Menu(MenuCustom); - break; - #endif - - #if ENABLED(ADVANCED_PAUSE_FEATURE) - case PREPARE_CHANGEFIL: - if (draw) { - Draw_Menu_Item(row, ICON_ResumeEEPROM, GET_TEXT_F(MSG_FILAMENTCHANGE) - #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - , nullptr, true - #endif - ); - } - else { - #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - Draw_Menu(ChangeFilament); - #else - if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) - Popup_Handler(ETemp); - else { - if (thermalManager.temp_hotend[0].is_below_target(-2)) { - Popup_Handler(Heating); - thermalManager.wait_for_hotend(0); - } - Popup_Handler(FilChange); - sprintf_P(cmd, PSTR("M600 B1 R%i"), thermalManager.temp_hotend[0].target); - gcode.process_subcommands_now(cmd); - } - #endif - } - break; - #endif - } - break; - - case HomeMenu: - - #define HOME_BACK 0 - #define HOME_ALL (HOME_BACK + 1) - #define HOME_X (HOME_ALL + 1) - #define HOME_Y (HOME_X + 1) - #define HOME_Z (HOME_Y + 1) - #define HOME_SET (HOME_Z + 1) - #define HOME_TOTAL HOME_SET - - switch (item) { - case HOME_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(Prepare, PREPARE_HOME); - break; - case HOME_ALL: - if (draw) - Draw_Menu_Item(row, ICON_Homing, GET_TEXT_F(MSG_AUTO_HOME)); - else { - Popup_Handler(Home); - gcode.home_all_axes(true); - Redraw_Menu(); - } - break; - case HOME_X: - if (draw) - Draw_Menu_Item(row, ICON_MoveX, GET_TEXT_F(MSG_AUTO_HOME_X)); - else { - Popup_Handler(Home); - gcode.process_subcommands_now(F("G28 X")); - planner.synchronize(); - Redraw_Menu(); - } - break; - case HOME_Y: - if (draw) - Draw_Menu_Item(row, ICON_MoveY, GET_TEXT_F(MSG_AUTO_HOME_Y)); - else { - Popup_Handler(Home); - gcode.process_subcommands_now(F("G28 Y")); - planner.synchronize(); - Redraw_Menu(); - } - break; - case HOME_Z: - if (draw) - Draw_Menu_Item(row, ICON_MoveZ, GET_TEXT_F(MSG_AUTO_HOME_Z)); - else { - Popup_Handler(Home); - gcode.process_subcommands_now(F("G28 Z")); - planner.synchronize(); - Redraw_Menu(); - } - break; - case HOME_SET: - if (draw) - Draw_Menu_Item(row, ICON_SetHome, GET_TEXT_F(MSG_SET_HOME_OFFSETS)); - else { - gcode.process_subcommands_now(F("G92X0Y0Z0")); - AudioFeedback(); - } - break; - } - break; - - case Move: - - #define MOVE_BACK 0 - #define MOVE_X (MOVE_BACK + 1) - #define MOVE_Y (MOVE_X + 1) - #define MOVE_Z (MOVE_Y + 1) - #define MOVE_E (MOVE_Z + ENABLED(HAS_HOTEND)) - #define MOVE_P (MOVE_E + ENABLED(HAS_BED_PROBE)) - #define MOVE_LIVE (MOVE_P + 1) - #define MOVE_TOTAL MOVE_LIVE - - switch (item) { - case MOVE_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else { - #if HAS_BED_PROBE - temp_val.probe_deployed = false; - probe.set_deployed(temp_val.probe_deployed); - #endif - Draw_Menu(Prepare, PREPARE_MOVE); - } - break; - case MOVE_X: - if (draw) { - Draw_Menu_Item(row, ICON_MoveX, GET_TEXT_F(MSG_MOVE_X)); - Draw_Float(current_position.x, row, false); - } - else - Modify_Value(current_position.x, X_MIN_POS, X_MAX_POS, 10); - break; - case MOVE_Y: - if (draw) { - Draw_Menu_Item(row, ICON_MoveY, GET_TEXT_F(MSG_MOVE_Y)); - Draw_Float(current_position.y, row); - } - else - Modify_Value(current_position.y, Y_MIN_POS, Y_MAX_POS, 10); - break; - case MOVE_Z: - if (draw) { - Draw_Menu_Item(row, ICON_MoveZ, GET_TEXT_F(MSG_MOVE_Z)); - Draw_Float(current_position.z, row); - } - else - Modify_Value(current_position.z, Z_MIN_POS, Z_MAX_POS, 10); - break; - - #if HAS_HOTEND - case MOVE_E: - if (draw) { - Draw_Menu_Item(row, ICON_Extruder, GET_TEXT_F(MSG_MOVE_E)); - current_position.e = 0; - sync_plan_position(); - Draw_Float(current_position.e, row); - } - else { - if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) - Popup_Handler(ETemp); - else { - if (thermalManager.temp_hotend[0].is_below_target(-2)) { - Popup_Handler(Heating); - thermalManager.wait_for_hotend(0); - Redraw_Menu(); - } - current_position.e = 0; - sync_plan_position(); - Modify_Value(current_position.e, -500, 500, 10); - } - } - break; - #endif // HAS_HOTEND - - #if HAS_BED_PROBE - case MOVE_P: - if (draw) { - Draw_Menu_Item(row, ICON_ProbeDeploy, GET_TEXT_F(MSG_MANUAL_DEPLOY)); - Draw_Checkbox(row, temp_val.probe_deployed); - } - else { - temp_val.probe_deployed = !temp_val.probe_deployed; - probe.set_deployed(temp_val.probe_deployed); - Draw_Checkbox(row, temp_val.probe_deployed); - } - break; - #endif - - case MOVE_LIVE: - if (draw) { - Draw_Menu_Item(row, ICON_Axis, F("Live Movement")); - Draw_Checkbox(row, temp_val.livemove); - } - else { - temp_val.livemove = !temp_val.livemove; - Draw_Checkbox(row, temp_val.livemove); - } - break; - } - break; - case ManualLevel: - - #define MLEVEL_BACK 0 - #define MLEVEL_PROBE (MLEVEL_BACK + ENABLED(HAS_BED_PROBE)) - #define MLEVEL_FL (MLEVEL_PROBE + 1) - #define MLEVEL_BL (MLEVEL_FL + 1) - #define MLEVEL_BR (MLEVEL_BL + 1) - #define MLEVEL_FR (MLEVEL_BR + 1) - #define MLEVEL_C (MLEVEL_FR + 1) - #define MLEVEL_ZPOS (MLEVEL_C + 1) - #define MLEVEL_TOTAL MLEVEL_ZPOS - - static float mlev_z_pos = 0; - static bool use_probe = false; - - switch (item) { - case MLEVEL_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else { - TERN_(HAS_LEVELING, set_bed_leveling_enabled(level_state)); - Draw_Menu(Prepare, PREPARE_MANUALLEVEL); - } - break; - #if HAS_BED_PROBE - case MLEVEL_PROBE: - if (draw) { - Draw_Menu_Item(row, ICON_Zoffset, F("Use Probe")); - Draw_Checkbox(row, use_probe); - } - else { - use_probe = !use_probe; - Draw_Checkbox(row, use_probe); - if (use_probe) { - Popup_Handler(Level); - do_z_clearance(Z_HOMING_HEIGHT); - temp_val.corner_avg = 0; - #define PROBE_X_MIN _MAX(temp_val.corner_pos, PROBING_MARGIN, MESH_MIN_X) - probe.offset.x - #define PROBE_X_MAX _MIN(X_BED_SIZE - temp_val.corner_pos, X_BED_SIZE - PROBING_MARGIN, MESH_MAX_X) - probe.offset.x - #define PROBE_Y_MIN _MAX(temp_val.corner_pos, PROBING_MARGIN, MESH_MIN_Y) - probe.offset.y - #define PROBE_Y_MAX _MIN(Y_BED_SIZE - temp_val.corner_pos, Y_BED_SIZE - PROBING_MARGIN, MESH_MAX_Y) - probe.offset.y - temp_val.zval = probe.probe_at_point(PROBE_X_MIN, PROBE_Y_MIN, PROBE_PT_RAISE, 0, false); - const char * MSG_UNREACHABLE = "Position unreachable. Check Probe Offsets and Bed Screw Inset."; - if (isnan(temp_val.zval)) { - Update_Status(MSG_UNREACHABLE); - Redraw_Menu(); - } - temp_val.corner_avg += temp_val.zval; - temp_val.zval = probe.probe_at_point(PROBE_X_MIN, PROBE_Y_MAX, PROBE_PT_RAISE, 0, false); - if (isnan(temp_val.zval)) { - Update_Status(MSG_UNREACHABLE); - Redraw_Menu(); - } - temp_val.corner_avg += temp_val.zval; - temp_val.zval = probe.probe_at_point(PROBE_X_MAX, PROBE_Y_MAX, PROBE_PT_RAISE, 0, false); - if (isnan(temp_val.zval)) { - Update_Status(MSG_UNREACHABLE); - Redraw_Menu(); - } - temp_val.corner_avg += temp_val.zval; - temp_val.zval = probe.probe_at_point(PROBE_X_MAX, PROBE_Y_MIN, PROBE_PT_STOW, 0, false); - if (isnan(temp_val.zval)) { - Update_Status(MSG_UNREACHABLE); - Redraw_Menu(); - } - temp_val.corner_avg += temp_val.zval; - temp_val.corner_avg /= 4; - Redraw_Menu(); - } - } - break; - #endif - case MLEVEL_FL: - if (draw) - Draw_Menu_Item(row, ICON_AxisBL, GET_TEXT_F(MSG_LEVBED_FL)); - else { - Popup_Handler(MoveWait); - if (use_probe) { - #if HAS_BED_PROBE - sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s"), dtostrf(PROBE_X_MIN, 1, 3, str_1), dtostrf(PROBE_Y_MIN, 1, 3, str_2)); - gcode.process_subcommands_now(cmd); - planner.synchronize(); - Popup_Handler(ManualProbing); - #endif - } - else { - sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s\nG0 F300 Z%s"), dtostrf(temp_val.corner_pos, 1, 3, str_1), dtostrf(temp_val.corner_pos, 1, 3, str_2), dtostrf(mlev_z_pos, 1, 3, str_3)); - gcode.process_subcommands_now(cmd); - planner.synchronize(); - Redraw_Menu(); - } - } - break; - case MLEVEL_BL: - if (draw) - Draw_Menu_Item(row, ICON_AxisTL, GET_TEXT_F(MSG_LEVBED_BL)); - else { - Popup_Handler(MoveWait); - if (use_probe) { - #if HAS_BED_PROBE - sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s"), dtostrf(PROBE_X_MIN, 1, 3, str_1), dtostrf(PROBE_Y_MAX, 1, 3, str_2)); - gcode.process_subcommands_now(cmd); - planner.synchronize(); - Popup_Handler(ManualProbing); - #endif - } - else { - sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s\nG0 F300 Z%s"), dtostrf(temp_val.corner_pos, 1, 3, str_1), dtostrf(Y_BED_SIZE - temp_val.corner_pos, 1, 3, str_2), dtostrf(mlev_z_pos, 1, 3, str_3)); - gcode.process_subcommands_now(cmd); - planner.synchronize(); - Redraw_Menu(); - } - } - break; - case MLEVEL_BR: - if (draw) - Draw_Menu_Item(row, ICON_AxisTR, GET_TEXT_F(MSG_LEVBED_BR)); - else { - Popup_Handler(MoveWait); - if (use_probe) { - #if HAS_BED_PROBE - sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s"), dtostrf(PROBE_X_MAX, 1, 3, str_1), dtostrf(PROBE_Y_MAX, 1, 3, str_2)); - gcode.process_subcommands_now(cmd); - planner.synchronize(); - Popup_Handler(ManualProbing); - #endif - } - else { - sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s\nG0 F300 Z%s"), dtostrf(X_BED_SIZE - temp_val.corner_pos, 1, 3, str_1), dtostrf(Y_BED_SIZE - temp_val.corner_pos, 1, 3, str_2), dtostrf(mlev_z_pos, 1, 3, str_3)); - gcode.process_subcommands_now(cmd); - planner.synchronize(); - Redraw_Menu(); - } - } - break; - case MLEVEL_FR: - if (draw) - Draw_Menu_Item(row, ICON_AxisBR, GET_TEXT_F(MSG_LEVBED_FR)); - else { - Popup_Handler(MoveWait); - if (use_probe) { - #if HAS_BED_PROBE - sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s"), dtostrf(PROBE_X_MAX, 1, 3, str_1), dtostrf(PROBE_Y_MIN, 1, 3, str_2)); - gcode.process_subcommands_now(cmd); - planner.synchronize(); - Popup_Handler(ManualProbing); - #endif - } - else { - sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s\nG0 F300 Z%s"), dtostrf(X_BED_SIZE - temp_val.corner_pos, 1, 3, str_1), dtostrf(temp_val.corner_pos, 1, 3, str_2), dtostrf(mlev_z_pos, 1, 3, str_3)); - gcode.process_subcommands_now(cmd); - planner.synchronize(); - Redraw_Menu(); - } - } - break; - case MLEVEL_C: - if (draw) - Draw_Menu_Item(row, ICON_AxisC, GET_TEXT_F(MSG_LEVBED_C)); - else { - Popup_Handler(MoveWait); - if (use_probe) { - #if HAS_BED_PROBE - sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s"), dtostrf((PROBE_X_MIN + PROBE_X_MAX) / 2.0f, 1, 3, str_1), dtostrf((PROBE_Y_MIN + PROBE_Y_MAX) / 2.0f, 1, 3, str_2)); - gcode.process_subcommands_now(cmd); - planner.synchronize(); - Popup_Handler(ManualProbing); - #endif - } - else { - sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s\nG0 F300 Z%s"), dtostrf(X_BED_SIZE / 2.0f, 1, 3, str_1), dtostrf(Y_BED_SIZE / 2.0f, 1, 3, str_2), dtostrf(mlev_z_pos, 1, 3, str_3)); - gcode.process_subcommands_now(cmd); - planner.synchronize(); - Redraw_Menu(); - } - } - break; - case MLEVEL_ZPOS: - if (draw) { - Draw_Menu_Item(row, ICON_SetZOffset, GET_TEXT_F(MSG_MOVE_Z)); - Draw_Float(mlev_z_pos, row, false, 100); - } - else - Modify_Value(mlev_z_pos, 0, MAX_Z_OFFSET, 100); - break; - } - break; - #if HAS_ZOFFSET_ITEM - case ZOffset: - - #define ZOFFSET_BACK 0 - #define ZOFFSET_HOME (ZOFFSET_BACK + 1) - #define ZOFFSET_MODE (ZOFFSET_HOME + 1) - #define ZOFFSET_OFFSET (ZOFFSET_MODE + 1) - #define ZOFFSET_UP (ZOFFSET_OFFSET + 1) - #define ZOFFSET_DOWN (ZOFFSET_UP + 1) - #define ZOFFSET_SAVE (ZOFFSET_DOWN + ENABLED(EEPROM_SETTINGS)) - #define ZOFFSET_TOTAL ZOFFSET_SAVE - - switch (item) { - case ZOFFSET_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else { - temp_val.zoffsetmode = 0; - #if !HAS_BED_PROBE - gcode.process_subcommands_now(F("M211 S1")); // Soft end-stops - #endif - TERN_(HAS_LEVELING, set_bed_leveling_enabled(level_state)); - Draw_Menu(Prepare, PREPARE_ZOFFSET); - } - break; - case ZOFFSET_HOME: - if (draw) - Draw_Menu_Item(row, ICON_Homing, GET_TEXT_F(MSG_AUTO_HOME_Z)); - else { - Popup_Handler(Home); - gcode.process_subcommands_now(F("G28 Z")); - Popup_Handler(MoveWait); - #if ENABLED(Z_SAFE_HOMING) - planner.synchronize(); - sprintf_P(cmd, PSTR("G0 F4000 X%s Y%s"), dtostrf(Z_SAFE_HOMING_X_POINT, 1, 3, str_1), dtostrf(Z_SAFE_HOMING_Y_POINT, 1, 3, str_2)); - gcode.process_subcommands_now(cmd); - #else - sprintf_P(cmd, PSTR("G0 F4000 X%s Y%s"), dtostrf((X_BED_SIZE + X_MIN_POS) / 2.0f, 1, 3, str_1), dtostrf((Y_BED_SIZE + Y_MIN_POS) / 2.0f, 1, 3, str_2)); - gcode.process_subcommands_now(cmd); - #endif - gcode.process_subcommands_now(F("G0 F300 Z0")); - planner.synchronize(); - Redraw_Menu(); - } - break; - case ZOFFSET_MODE: - if (draw) { - Draw_Menu_Item(row, ICON_Zoffset, F("Live Adjustment")); - Draw_Option(temp_val.zoffsetmode, zoffset_modes, row); - } - else - Modify_Option(temp_val.zoffsetmode, zoffset_modes, 2); - break; - case ZOFFSET_OFFSET: - if (draw) { - Draw_Menu_Item(row, ICON_SetZOffset, F("Z Offset")); - Draw_Float(temp_val.zoffsetvalue, row, false, 100); - } - else - Modify_Value(temp_val.zoffsetvalue, MIN_Z_OFFSET, MAX_Z_OFFSET, 100); - break; - case ZOFFSET_UP: - if (draw) - Draw_Menu_Item(row, ICON_Axis, F("Microstep Up")); - else { - if (temp_val.zoffsetvalue < MAX_Z_OFFSET) { - if (temp_val.zoffsetmode != 0) { - gcode.process_subcommands_now(F("M290 Z0.01")); - planner.synchronize(); - } - temp_val.zoffsetvalue += 0.01; - Draw_Float(temp_val.zoffsetvalue, row - 1, false, 100); - } - } - break; - case ZOFFSET_DOWN: - if (draw) - Draw_Menu_Item(row, ICON_AxisD, F("Microstep Down")); - else { - if (temp_val.zoffsetvalue > MIN_Z_OFFSET) { - if (temp_val.zoffsetmode != 0) { - gcode.process_subcommands_now(F("M290 Z-0.01")); - planner.synchronize(); - } - temp_val.zoffsetvalue -= 0.01; - Draw_Float(temp_val.zoffsetvalue, row - 2, false, 100); - } - } - break; - #if ENABLED(EEPROM_SETTINGS) - case ZOFFSET_SAVE: - if (draw) - Draw_Menu_Item(row, ICON_WriteEEPROM, GET_TEXT_F(MSG_BUTTON_SAVE)); - else - AudioFeedback(settings.save()); - break; - #endif - } - break; - #endif - - #if HAS_PREHEAT - case Preheat: { - #define PREHEAT_MODE (PREHEAT_BACK + 1) - #define PREHEAT_1 (PREHEAT_MODE + 1) - #define PREHEAT_2 (PREHEAT_1 + (PREHEAT_COUNT >= 2)) - #define PREHEAT_3 (PREHEAT_2 + (PREHEAT_COUNT >= 3)) - #define PREHEAT_4 (PREHEAT_3 + (PREHEAT_COUNT >= 4)) - #define PREHEAT_5 (PREHEAT_4 + (PREHEAT_COUNT >= 5)) - #define PREHEAT_TOTAL PREHEAT_5 - - auto do_preheat = [](const uint8_t m) { - thermalManager.cooldown(); - if (temp_val.preheatmode == 0 || temp_val.preheatmode == 1) { ui.preheat_hotend_and_fan(m); } - if (temp_val.preheatmode == 0 || temp_val.preheatmode == 2) ui.preheat_bed(m); - }; - - switch (item) { - case PREHEAT_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(Prepare, PREPARE_PREHEAT); - break; - - case PREHEAT_MODE: - if (draw) { - Draw_Menu_Item(row, ICON_Homing, GET_TEXT_F(MSG_CONFIGURATION)); - Draw_Option(temp_val.preheatmode, preheat_modes, row); - } - else - Modify_Option(temp_val.preheatmode, preheat_modes, 2); - break; - - #define _PREHEAT_CASE(N) \ - case PREHEAT_##N: { \ - if (draw) Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_## N ##_LABEL)); \ - else do_preheat(N - 1); \ - } break; - - REPEAT_1(PREHEAT_COUNT, _PREHEAT_CASE) - } - } break; - #endif // HAS_PREHEAT - - #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - case ChangeFilament: - - #define CHANGEFIL_BACK 0 - #define CHANGEFIL_PARKHEAD (CHANGEFIL_BACK + 1) - #define CHANGEFIL_LOAD (CHANGEFIL_PARKHEAD + 1) - #define CHANGEFIL_UNLOAD (CHANGEFIL_LOAD + 1) - #define CHANGEFIL_CHANGE (CHANGEFIL_UNLOAD + 1) - #define CHANGEFIL_TOTAL CHANGEFIL_CHANGE - - switch (item) { - case CHANGEFIL_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(Prepare, PREPARE_CHANGEFIL); - break; - case CHANGEFIL_PARKHEAD: - if (draw) - Draw_Menu_Item(row, ICON_Park, GET_TEXT_F(MSG_FILAMENT_PARK_ENABLED)); - else { - #if ENABLED(NOZZLE_PARK_FEATURE) - queue.inject(F("G28O\nG27 P2")); - #else - sprintf_P(cmd, PSTR("G28O\nG0 F4000 X%i Y%i\nG0 F3000 Z%i"), 0 , 0, 20); - queue.inject(cmd); - #endif - } - break; - case CHANGEFIL_LOAD: - if (draw) - Draw_Menu_Item(row, ICON_WriteEEPROM, GET_TEXT_F(MSG_FILAMENTLOAD)); - else { - if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) - Popup_Handler(ETemp); - else { - if (thermalManager.temp_hotend[0].is_below_target(-2)) { - Popup_Handler(Heating); - thermalManager.wait_for_hotend(0); - } - Popup_Handler(FilLoad); - gcode.process_subcommands_now(F("M701")); - planner.synchronize(); - Redraw_Menu(); - } - } - break; - case CHANGEFIL_UNLOAD: - if (draw) - Draw_Menu_Item(row, ICON_ReadEEPROM, GET_TEXT_F(MSG_FILAMENTUNLOAD)); - else { - if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) { - Popup_Handler(ETemp); - } - else { - if (thermalManager.temp_hotend[0].is_below_target(-2)) { - Popup_Handler(Heating); - thermalManager.wait_for_hotend(0); - } - Popup_Handler(FilLoad, true); - gcode.process_subcommands_now(F("M702")); - planner.synchronize(); - Redraw_Menu(); - } - } - break; - case CHANGEFIL_CHANGE: - if (draw) - Draw_Menu_Item(row, ICON_ResumeEEPROM, GET_TEXT_F(MSG_FILAMENTCHANGE)); - else { - if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) - Popup_Handler(ETemp); - else { - if (thermalManager.temp_hotend[0].is_below_target(-2)) { - Popup_Handler(Heating); - thermalManager.wait_for_hotend(0); - } - Popup_Handler(FilChange); - sprintf_P(cmd, PSTR("M600 B1 R%i"), thermalManager.temp_hotend[0].target); - gcode.process_subcommands_now(cmd); - } - } - break; - } - break; - #endif // FILAMENT_LOAD_UNLOAD_GCODES - - #if HAS_HOSTACTION_MENUS - case HostActions: - - #define HOSTACTIONS_BACK 0 - #define HOSTACTIONS_1 (HOSTACTIONS_BACK + 1) - #define HOSTACTIONS_2 (HOSTACTIONS_1 + 1) - #define HOSTACTIONS_3 (HOSTACTIONS_2 + 1) - #define HOSTACTIONS_TOTAL HOSTACTIONS_3 - - switch (item) { - case HOSTACTIONS_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else { - if (temp_val.flag_tune) { - temp_val.flag_tune = false; - Redraw_Menu(false, true, true); - } - else - Draw_Menu(Prepare, PREPARE_ACTIONCOMMANDS); - } - break; - case HOSTACTIONS_1: - if (draw) Draw_Menu_Item(row, ICON_File, action1); - else if (!strcmp(action1, "-") == 0) hostui.action(F(action1)); - break; - case HOSTACTIONS_2: - if (draw) Draw_Menu_Item(row, ICON_File, action2); - else if (!strcmp(action2, "-") == 0) hostui.action(F(action2)); - break; - case HOSTACTIONS_3: - if (draw) Draw_Menu_Item(row, ICON_File, action3); - else if (!strcmp(action3, "-") == 0) hostui.action(F(action3)); - break; - } - break; - #endif - - #if HAS_CUSTOM_MENU - - case MenuCustom: - - #define CUSTOM_MENU_BACK 0 - #define CUSTOM_MENU_1 1 - #define CUSTOM_MENU_2 2 - #define CUSTOM_MENU_3 3 - #define CUSTOM_MENU_4 4 - #define CUSTOM_MENU_5 5 - #define CUSTOM_MENU_TOTAL CUSTOM_MENU_COUNT - - switch (item) { - case CUSTOM_MENU_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); - else - Draw_Menu(Prepare, PREPARE_CUSTOM_MENU); - break; - - #if CUSTOM_MENU_COUNT >= 1 - case CUSTOM_MENU_1: - if (draw) - Draw_Menu_Item(row, ICON_Info, F(CONFIG_MENU_ITEM_1_DESC)); - else { - Popup_Handler(Custom); - //queue.inject(F(CONFIG_MENU_ITEM_1_GCODE)); // Old code - gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_1_GCODE)); - planner.synchronize(); - Redraw_Menu(); - #if ENABLED(CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK) - AudioFeedback(); - #endif - #ifdef CUSTOM_MENU_CONFIG_SCRIPT_RETURN - queue.inject(F(CUSTOM_MENU_CONFIG_SCRIPT_DONE)); - #endif - } - break; - #endif - - #if CUSTOM_MENU_COUNT >= 2 - case CUSTOM_MENU_2: - if (draw) - Draw_Menu_Item(row, ICON_Info, F(CONFIG_MENU_ITEM_2_DESC)); - else { - Popup_Handler(Custom); - gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_2_GCODE)); - planner.synchronize(); - Redraw_Menu(); - #if ENABLED(CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK) - AudioFeedback(); - #endif - #ifdef CUSTOM_MENU_CONFIG_SCRIPT_RETURN - queue.inject(F(CUSTOM_MENU_CONFIG_SCRIPT_DONE)); - #endif - } - break; - #endif - - #if CUSTOM_MENU_COUNT >= 3 - case CUSTOM_MENU_3: - if (draw) - Draw_Menu_Item(row, ICON_Info, F(CONFIG_MENU_ITEM_3_DESC)); - else { - Popup_Handler(Custom); - gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_3_GCODE)); - planner.synchronize(); - Redraw_Menu(); - #if ENABLED(CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK) - AudioFeedback(); - #endif - #ifdef CUSTOM_MENU_CONFIG_SCRIPT_RETURN - queue.inject(F(CUSTOM_MENU_CONFIG_SCRIPT_DONE)); - #endif - } - break; - #endif - - #if CUSTOM_MENU_COUNT >= 4 - case CUSTOM_MENU_4: - if (draw) - Draw_Menu_Item(row, ICON_Info, F(CONFIG_MENU_ITEM_4_DESC)); - else { - Popup_Handler(Custom); - gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_4_GCODE)); - planner.synchronize(); - Redraw_Menu(); - #if ENABLED(CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK) - AudioFeedback(); - #endif - #ifdef CUSTOM_MENU_CONFIG_SCRIPT_RETURN - queue.inject(F(CUSTOM_MENU_CONFIG_SCRIPT_DONE)); - #endif - } - break; - #endif - - #if CUSTOM_MENU_COUNT >= 5 - case CUSTOM_MENU_5: - if (draw) - Draw_Menu_Item(row, ICON_Info, F(CONFIG_MENU_ITEM_5_DESC)); - else { - Popup_Handler(Custom); - gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_5_GCODE)); - planner.synchronize(); - Redraw_Menu(); - #if ENABLED(CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK) - AudioFeedback(); - #endif - #ifdef CUSTOM_MENU_CONFIG_SCRIPT_RETURN - queue.inject(F(CUSTOM_MENU_CONFIG_SCRIPT_DONE)); - #endif - } - break; - #endif // Custom Menu - } - break; - - #endif // HAS_CUSTOM_MENU - - case Control: - - #define CONTROL_BACK 0 - #define CONTROL_TEMP (CONTROL_BACK + 1) - #define CONTROL_MOTION (CONTROL_TEMP + 1) - #define CONTROL_FWRETRACT (CONTROL_MOTION + ENABLED(FWRETRACT)) - #define CONTROL_LEDS (CONTROL_FWRETRACT + ANY(CASE_LIGHT_MENU, LED_CONTROL_MENU)) - #define CONTROL_VISUAL (CONTROL_LEDS + 1) - #define CONTROL_HOSTSETTINGS (CONTROL_VISUAL + ENABLED(HAS_HOSTACTION_MENUS)) - #define CONTROL_ADVANCED (CONTROL_HOSTSETTINGS + 1) - #define CONTROL_SAVE (CONTROL_ADVANCED + ENABLED(EEPROM_SETTINGS)) - #define CONTROL_RESTORE (CONTROL_SAVE + ENABLED(EEPROM_SETTINGS)) - #define CONTROL_RESET (CONTROL_RESTORE + ENABLED(EEPROM_SETTINGS)) - #define CONTROL_REBOOT (CONTROL_RESET + 1) - #define CONTROL_INFO (CONTROL_REBOOT + 1) - #define CONTROL_TOTAL CONTROL_INFO - - switch (item) { - case CONTROL_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Main_Menu(2); - break; - case CONTROL_TEMP: - if (draw) - Draw_Menu_Item(row, ICON_Temperature, GET_TEXT_F(MSG_TEMPERATURE), nullptr, true); - else - Draw_Menu(TempMenu); - break; - case CONTROL_MOTION: - if (draw) - Draw_Menu_Item(row, ICON_Motion, GET_TEXT_F(MSG_MOTION), nullptr, true); - else - Draw_Menu(Motion); - break; - #if ENABLED(FWRETRACT) - case CONTROL_FWRETRACT: - if (draw) - Draw_Menu_Item(row, ICON_StepE, GET_TEXT_F(MSG_AUTORETRACT), nullptr, true); - else - Draw_Menu(FwRetraction); - break; - #endif - #if ANY(CASE_LIGHT_MENU, LED_CONTROL_MENU) - case CONTROL_LEDS: - if (draw) - Draw_Menu_Item(row, ICON_LedControl, GET_TEXT_F(MSG_LEDS), nullptr, true); - else - Draw_Menu(Ledsmenu); - break; - #endif - case CONTROL_VISUAL: - if (draw) - Draw_Menu_Item(row, ICON_PrintSize, F("Visual"), nullptr, true); - else - Draw_Menu(Visual); - break; - #if HAS_HOSTACTION_MENUS - case CONTROL_HOSTSETTINGS: - if (draw) - Draw_Menu_Item(row, ICON_Contact, F("Host Settings"), nullptr, true); - else - Draw_Menu(HostSettings); - break; - #endif - case CONTROL_ADVANCED: - if (draw) - Draw_Menu_Item(row, ICON_Version, GET_TEXT_F(MSG_ADVANCED_SETTINGS), nullptr, true); - else - Draw_Menu(Advanced); - break; - #if ENABLED(EEPROM_SETTINGS) - case CONTROL_SAVE: - if (draw) - Draw_Menu_Item(row, ICON_WriteEEPROM, GET_TEXT_F(MSG_STORE_EEPROM)); - else - AudioFeedback(settings.save()); - break; - case CONTROL_RESTORE: - if (draw) - Draw_Menu_Item(row, ICON_ReadEEPROM, GET_TEXT_F(MSG_LOAD_EEPROM)); - else - AudioFeedback(settings.load()); - break; - case CONTROL_RESET: - if (draw) - Draw_Menu_Item(row, ICON_Temperature, GET_TEXT_F(MSG_RESTORE_DEFAULTS)); - else { - settings.reset(); - AudioFeedback(); - } - break; - #endif - case CONTROL_REBOOT: - if (draw) - Draw_Menu_Item(row, ICON_Reboot, GET_TEXT_F(MSG_RESET_PRINTER)); - else - RebootPrinter(); - break; - case CONTROL_INFO: - if (draw) - Draw_Menu_Item(row, ICON_Info, GET_TEXT_F(MSG_INFO_SCREEN)); - else - Draw_Menu(Info); - break; - } - break; - - case TempMenu: - - #define TEMP_BACK 0 - #define TEMP_HOTEND (TEMP_BACK + ENABLED(HAS_HOTEND)) - #define TEMP_BED (TEMP_HOTEND + ENABLED(HAS_HEATED_BED)) - #define TEMP_FAN (TEMP_BED + ENABLED(HAS_FAN)) - #define TEMP_PID (TEMP_FAN + ANY(HAS_HOTEND, HAS_HEATED_BED)) - #define TEMP_PREHEAT1 (TEMP_PID + (PREHEAT_COUNT >= 1)) - #define TEMP_PREHEAT2 (TEMP_PREHEAT1 + (PREHEAT_COUNT >= 2)) - #define TEMP_PREHEAT3 (TEMP_PREHEAT2 + (PREHEAT_COUNT >= 3)) - #define TEMP_PREHEAT4 (TEMP_PREHEAT3 + (PREHEAT_COUNT >= 4)) - #define TEMP_PREHEAT5 (TEMP_PREHEAT4 + (PREHEAT_COUNT >= 5)) - #define TEMP_TOTAL TEMP_PREHEAT5 - - switch (item) { - case TEMP_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(Control, CONTROL_TEMP); - break; - #if HAS_HOTEND - case TEMP_HOTEND: - if (draw) { - Draw_Menu_Item(row, ICON_SetEndTemp, F("Hotend")); - Draw_Float(thermalManager.temp_hotend[0].target, row, false, 1); - } - else - Modify_Value(thermalManager.temp_hotend[0].target, MIN_E_TEMP, MAX_E_TEMP, 1); - break; - #endif - #if HAS_HEATED_BED - case TEMP_BED: - if (draw) { - Draw_Menu_Item(row, ICON_SetBedTemp, F("Bed")); - Draw_Float(thermalManager.temp_bed.target, row, false, 1); - } - else - Modify_Value(thermalManager.temp_bed.target, MIN_BED_TEMP, MAX_BED_TEMP, 1); - break; - #endif - #if HAS_FAN - case TEMP_FAN: - if (draw) { - Draw_Menu_Item(row, ICON_FanSpeed, GET_TEXT_F(MSG_FAN_SPEED)); - Draw_Float(thermalManager.fan_speed[0], row, false, 1); - } - else - Modify_Value(thermalManager.fan_speed[0], MIN_FAN_SPEED, MAX_FAN_SPEED, 1); - break; - #endif - #if HAS_HOTEND || HAS_HEATED_BED - case TEMP_PID: - if (draw) - Draw_Menu_Item(row, ICON_Step, F("PID"), nullptr, true); - else - Draw_Menu(PID); - break; - #endif - - #define _TEMP_PREHEAT_CASE(N) \ - case TEMP_PREHEAT##N: { \ - if (draw) Draw_Menu_Item(row, ICON_Step, F(PREHEAT_## N ##_LABEL), nullptr, true); \ - else Draw_Menu(Preheat##N); \ - } break; - - REPEAT_1(PREHEAT_COUNT, _TEMP_PREHEAT_CASE) - } - break; - - #if HAS_HOTEND || HAS_HEATED_BED - case PID: - - #define PID_BACK 0 - #define PID_HOTEND (PID_BACK + ENABLED(HAS_HOTEND)) - #define PID_BED (PID_HOTEND + ENABLED(HAS_HEATED_BED)) - #define PID_CYCLES (PID_BED + 1) - #define PID_TOTAL PID_CYCLES - - static uint8_t PID_cycles = 5; - - switch (item) { - case PID_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(TempMenu, TEMP_PID); - break; - #if HAS_HOTEND - case PID_HOTEND: - if (draw) - Draw_Menu_Item(row, ICON_HotendTemp, F(STR_HOTEND_PID), nullptr, true); - else - Draw_Menu(HotendPID); - break; - #endif - #if HAS_HEATED_BED - case PID_BED: - if (draw) - Draw_Menu_Item(row, ICON_BedTemp, F(STR_BED_PID), nullptr, true); - else - Draw_Menu(BedPID); - break; - #endif - case PID_CYCLES: - if (draw) { - Draw_Menu_Item(row, ICON_FanSpeed, GET_TEXT_F(MSG_PID_CYCLE)); - Draw_Float(PID_cycles, row, false, 1); - } - else - Modify_Value(PID_cycles, 3, 50, 1); - break; - } - break; - #endif // HAS_HOTEND || HAS_HEATED_BED - - #if HAS_HOTEND - case HotendPID: - - #define HOTENDPID_BACK 0 - #define HOTENDPID_TUNE (HOTENDPID_BACK + 1) - #define HOTENDPID_TEMP (HOTENDPID_TUNE + 1) - #define HOTENDPID_KP (HOTENDPID_TEMP + 1) - #define HOTENDPID_KI (HOTENDPID_KP + 1) - #define HOTENDPID_KD (HOTENDPID_KI + 1) - #define HOTENDPID_TOTAL HOTENDPID_KD - - switch (item) { - case HOTENDPID_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(PID, PID_HOTEND); - break; - case HOTENDPID_TUNE: - if (draw) - Draw_Menu_Item(row, ICON_HotendTemp, GET_TEXT_F(MSG_PID_AUTOTUNE)); - else { - Popup_Handler(PIDWait); - sprintf_P(cmd, PSTR("M303 E0 C%i S%i U1"), PID_cycles, temp_val.PID_e_temp); - gcode.process_subcommands_now(cmd); - planner.synchronize(); - Redraw_Menu(); - } - break; - case HOTENDPID_TEMP: - if (draw) { - Draw_Menu_Item(row, ICON_Temperature, GET_TEXT_F(MSG_TEMPERATURE)); - Draw_Float(temp_val.PID_e_temp, row, false, 1); - } - else - Modify_Value(temp_val.PID_e_temp, MIN_E_TEMP, MAX_E_TEMP, 1); - break; - case HOTENDPID_KP: - if (draw) { - Draw_Menu_Item(row, ICON_Version, F("Kp Value")); - Draw_Float(thermalManager.temp_hotend[0].pid.Kp, row, false, 100); - } - else - Modify_Value(thermalManager.temp_hotend[0].pid.Kp, 0, 5000, 100, thermalManager.updatePID); - break; - case HOTENDPID_KI: - if (draw) { - Draw_Menu_Item(row, ICON_Version, F("Ki Value")); - Draw_Float(unscalePID_i(thermalManager.temp_hotend[0].pid.Ki), row, false, 100); - } - else - Modify_Value(thermalManager.temp_hotend[0].pid.Ki, 0, 5000, 100, thermalManager.updatePID); - break; - case HOTENDPID_KD: - if (draw) { - Draw_Menu_Item(row, ICON_Version, F("Kd Value")); - Draw_Float(unscalePID_d(thermalManager.temp_hotend[0].pid.Kd), row, false, 100); - } - else - Modify_Value(thermalManager.temp_hotend[0].pid.Kd, 0, 5000, 100, thermalManager.updatePID); - break; - } - break; - #endif // HAS_HOTEND - - #if HAS_HEATED_BED - case BedPID: - - #define BEDPID_BACK 0 - #define BEDPID_TUNE (BEDPID_BACK + 1) - #define BEDPID_TEMP (BEDPID_TUNE + 1) - #define BEDPID_KP (BEDPID_TEMP + 1) - #define BEDPID_KI (BEDPID_KP + 1) - #define BEDPID_KD (BEDPID_KI + 1) - #define BEDPID_TOTAL BEDPID_KD - - switch (item) { - case BEDPID_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(PID, PID_BED); - break; - case BEDPID_TUNE: - if (draw) - Draw_Menu_Item(row, ICON_HotendTemp, GET_TEXT_F(MSG_PID_AUTOTUNE)); - else { - Popup_Handler(PIDWait); - sprintf_P(cmd, PSTR("M303 E-1 C%i S%i U1"), PID_cycles, temp_val.PID_bed_temp); - gcode.process_subcommands_now(cmd); - planner.synchronize(); - Redraw_Menu(); - } - break; - case BEDPID_TEMP: - if (draw) { - Draw_Menu_Item(row, ICON_Temperature, GET_TEXT_F(MSG_TEMPERATURE)); - Draw_Float(temp_val.PID_bed_temp, row, false, 1); - } - else - Modify_Value(temp_val.PID_bed_temp, MIN_BED_TEMP, MAX_BED_TEMP, 1); - break; - case BEDPID_KP: - if (draw) { - Draw_Menu_Item(row, ICON_Version, F("Kp Value")); - Draw_Float(thermalManager.temp_bed.pid.Kp, row, false, 100); - } - else - Modify_Value(thermalManager.temp_bed.pid.Kp, 0, 5000, 100, thermalManager.updatePID); - break; - case BEDPID_KI: - if (draw) { - Draw_Menu_Item(row, ICON_Version, F("Ki Value")); - Draw_Float(unscalePID_i(thermalManager.temp_bed.pid.Ki), row, false, 100); - } - else - Modify_Value(thermalManager.temp_bed.pid.Ki, 0, 5000, 100, thermalManager.updatePID); - break; - case BEDPID_KD: - if (draw) { - Draw_Menu_Item(row, ICON_Version, F("Kd Value")); - Draw_Float(unscalePID_d(thermalManager.temp_bed.pid.Kd), row, false, 100); - } - else - Modify_Value(thermalManager.temp_bed.pid.Kd, 0, 5000, 100, thermalManager.updatePID); - break; - } - break; - #endif // HAS_HEATED_BED - - #if HAS_PREHEAT - #define _PREHEAT_SUBMENU_CASE(N) case Preheat##N: preheat_submenu((N) - 1, item, TEMP_PREHEAT##N); break; - REPEAT_1(PREHEAT_COUNT, _PREHEAT_SUBMENU_CASE) - #endif - - case Motion: - - #define MOTION_BACK 0 - #define MOTION_HOMEOFFSETS (MOTION_BACK + 1) - #define MOTION_SPEED (MOTION_HOMEOFFSETS + 1) - #define MOTION_ACCEL (MOTION_SPEED + 1) - #define MOTION_JERK (MOTION_ACCEL + ENABLED(HAS_CLASSIC_JERK)) - #define MOTION_JD (MOTION_JERK + ENABLED(HAS_JUNCTION_DEVIATION)) - #define MOTION_STEPS (MOTION_JD + 1) - #define MOTION_FLOW (MOTION_STEPS + ENABLED(HAS_HOTEND)) - #define MOTION_TOTAL MOTION_FLOW - - switch (item) { - case MOTION_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(Control, CONTROL_MOTION); - break; - case MOTION_HOMEOFFSETS: - if (draw) - Draw_Menu_Item(row, ICON_SetHome, GET_TEXT_F(MSG_SET_HOME_OFFSETS), nullptr, true); - else - Draw_Menu(HomeOffsets); - break; - case MOTION_SPEED: - if (draw) - Draw_Menu_Item(row, ICON_MaxSpeed, GET_TEXT_F(MSG_MAX_SPEED), nullptr, true); - else - Draw_Menu(MaxSpeed); - break; - case MOTION_ACCEL: - if (draw) - Draw_Menu_Item(row, ICON_MaxAccelerated, GET_TEXT_F(MSG_AMAX_EN), nullptr, true); - else - Draw_Menu(MaxAcceleration); - break; - #if HAS_CLASSIC_JERK - case MOTION_JERK: - if (draw) - Draw_Menu_Item(row, ICON_MaxJerk, GET_TEXT_F(MSG_JERK), nullptr, true); - else - Draw_Menu(MaxJerk); - break; - #endif - #if HAS_JUNCTION_DEVIATION - case MOTION_JD: - if (draw) - Draw_Menu_Item(row, ICON_MaxJerk, GET_TEXT_F(MSG_JUNCTION_DEVIATION), nullptr, true); - else - Draw_Menu(JDmenu); - break; - #endif - case MOTION_STEPS: - if (draw) - Draw_Menu_Item(row, ICON_Step, GET_TEXT_F(MSG_STEPS_PER_MM), nullptr, true); - else - Draw_Menu(Steps); - break; - #if HAS_HOTEND - case MOTION_FLOW: - if (draw) { - Draw_Menu_Item(row, ICON_Speed, GET_TEXT_F(MSG_FLOW)); - Draw_Float(planner.flow_percentage[0], row, false, 1); - } - else - Modify_Value(planner.flow_percentage[0], MIN_FLOW_RATE, MAX_FLOW_RATE, 1); - break; - #endif - } - break; - - #if ENABLED(FWRETRACT) - case FwRetraction: - - #define FWR_BACK 0 - #define FWR_RET_AUTO (FWR_BACK + 1) - #define FWR_RET_LENGTH (FWR_RET_AUTO + 1) - #define FWR_RET_SPEED (FWR_RET_LENGTH + 1) - #define FWR_ZLIFT (FWR_RET_SPEED + 1) - #define FWR_REC_EXT_LENGTH (FWR_ZLIFT + 1) - #define FWR_REC_SPEED (FWR_REC_EXT_LENGTH + 1) - #define FWR_RESET (FWR_REC_SPEED + 1) - #define FWR_TOTAL FWR_RESET - - switch (item) { - - case FWR_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else { - if (temp_val.flag_tune) { - temp_val.flag_tune = false; - Redraw_Menu(false, true, true); - } - else - Draw_Menu(Control, CONTROL_FWRETRACT); - } - break; - case FWR_RET_AUTO: - if (draw) { - temp_val.auto_fw_retract = fwretract.autoretract_enabled; - Draw_Menu_Item(row, ICON_StepE, GET_TEXT_F(MSG_AUTORETRACT)); - Draw_Checkbox(row, temp_val.auto_fw_retract); - } - else { - if (MIN_AUTORETRACT <= MAX_AUTORETRACT) { - temp_val.auto_fw_retract = !temp_val.auto_fw_retract; - fwretract.enable_autoretract(temp_val.auto_fw_retract); - Draw_Checkbox(row, temp_val.auto_fw_retract); - } - } - break; - case FWR_RET_LENGTH: - if (draw) { - Draw_Menu_Item(row, ICON_FWRetLength, GET_TEXT_F(MSG_CONTROL_RETRACT)); - Draw_Float(fwretract.settings.retract_length, row, false, 10); - } - else - Modify_Value(fwretract.settings.retract_length, 0, 10, 10); - break; - case FWR_RET_SPEED: - if (draw) { - Draw_Menu_Item(row, ICON_FWRetSpeed, GET_TEXT_F(MSG_SINGLENOZZLE_RETRACT_SPEED)); - Draw_Float(fwretract.settings.retract_feedrate_mm_s, row, false, 10); - } - else - Modify_Value(fwretract.settings.retract_feedrate_mm_s, 1, 90, 10); - break; - case FWR_ZLIFT: - if (draw) { - Draw_Menu_Item(row, ICON_FWRetZRaise, GET_TEXT_F(MSG_CONTROL_RETRACT_ZHOP)); - Draw_Float(fwretract.settings.retract_zraise, row, false, 100); - } - else - Modify_Value(fwretract.settings.retract_zraise, 0, 10, 100); - break; - case FWR_REC_EXT_LENGTH: - if (draw) { - Draw_Menu_Item(row, ICON_FWRecExtLength, GET_TEXT_F(MSG_CONTROL_RETRACT_RECOVER)); - Draw_Float(fwretract.settings.retract_recover_extra, row, false, 10); - } - else - Modify_Value(fwretract.settings.retract_recover_extra, -10, 10, 10); - break; - case FWR_REC_SPEED: - if (draw) { - Draw_Menu_Item(row, ICON_FWRecSpeed, GET_TEXT_F(MSG_SINGLENOZZLE_UNRETRACT_SPEED)); - Draw_Float(fwretract.settings.retract_recover_feedrate_mm_s, row, false, 10); - } - else - Modify_Value(fwretract.settings.retract_recover_feedrate_mm_s, 1, 90, 10); - break; - case FWR_RESET: - if (draw) - Draw_Menu_Item(row, ICON_StepE, GET_TEXT_F(MSG_BUTTON_RESET)); - else { - fwretract.reset(); - Draw_Menu(FwRetraction); - } - break; - } - break; - #endif - - case HomeOffsets: - - #define HOMEOFFSETS_BACK 0 - #define HOMEOFFSETS_XOFFSET (HOMEOFFSETS_BACK + 1) - #define HOMEOFFSETS_YOFFSET (HOMEOFFSETS_XOFFSET + 1) - #define HOMEOFFSETS_TOTAL HOMEOFFSETS_YOFFSET - - switch (item) { - case HOMEOFFSETS_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(Motion, MOTION_HOMEOFFSETS); - break; - case HOMEOFFSETS_XOFFSET: - if (draw) { - Draw_Menu_Item(row, ICON_StepX, GET_TEXT_F(MSG_HOME_OFFSET_X)); - Draw_Float(home_offset.x, row, false, 100); - } - else - Modify_Value(home_offset.x, -MAX_XY_OFFSET, MAX_XY_OFFSET, 100); - break; - case HOMEOFFSETS_YOFFSET: - if (draw) { - Draw_Menu_Item(row, ICON_StepY, GET_TEXT_F(MSG_HOME_OFFSET_Y)); - Draw_Float(home_offset.y, row, false, 100); - } - else - Modify_Value(home_offset.y, -MAX_XY_OFFSET, MAX_XY_OFFSET, 100); - break; - } - break; - case MaxSpeed: - - #define SPEED_BACK 0 - #define SPEED_X (SPEED_BACK + 1) - #define SPEED_Y (SPEED_X + 1) - #define SPEED_Z (SPEED_Y + 1) - #define SPEED_E (SPEED_Z + ENABLED(HAS_HOTEND)) - #define SPEED_TOTAL SPEED_E - - switch (item) { - case SPEED_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(Motion, MOTION_SPEED); - break; - case SPEED_X: - if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedX, GET_TEXT_F(MSG_VMAX_A)); - Draw_Float(planner.settings.max_feedrate_mm_s[X_AXIS], row, false, 1); - } - else - Modify_Value(planner.settings.max_feedrate_mm_s[X_AXIS], 0, default_max_feedrate[X_AXIS] * 2, 1); - break; - - #if HAS_Y_AXIS - case SPEED_Y: - if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedY, GET_TEXT_F(MSG_VMAX_B)); - Draw_Float(planner.settings.max_feedrate_mm_s[Y_AXIS], row, false, 1); - } - else - Modify_Value(planner.settings.max_feedrate_mm_s[Y_AXIS], 0, default_max_feedrate[Y_AXIS] * 2, 1); - break; - #endif - - #if HAS_Z_AXIS - case SPEED_Z: - if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedZ, GET_TEXT_F(MSG_VMAX_C)); - Draw_Float(planner.settings.max_feedrate_mm_s[Z_AXIS], row, false, 1); - } - else - Modify_Value(planner.settings.max_feedrate_mm_s[Z_AXIS], 0, default_max_feedrate[Z_AXIS] * 2, 1); - break; - #endif - - #if HAS_HOTEND - case SPEED_E: - if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedE, GET_TEXT_F(MSG_VMAX_E)); - Draw_Float(planner.settings.max_feedrate_mm_s[E_AXIS], row, false, 1); - } - else - Modify_Value(planner.settings.max_feedrate_mm_s[E_AXIS], 0, default_max_feedrate[E_AXIS] * 2, 1); - break; - #endif - } - break; - - case MaxAcceleration: - - #define ACCEL_BACK 0 - #define ACCEL_X (ACCEL_BACK + 1) - #define ACCEL_Y (ACCEL_X + 1) - #define ACCEL_Z (ACCEL_Y + 1) - #define ACCEL_E (ACCEL_Z + ENABLED(HAS_HOTEND)) - #define ACCEL_TOTAL ACCEL_E - - switch (item) { - case ACCEL_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(Motion, MOTION_ACCEL); - break; - case ACCEL_X: - if (draw) { - Draw_Menu_Item(row, ICON_MaxAccX, GET_TEXT_F(MSG_AMAX_A)); - Draw_Float(planner.settings.max_acceleration_mm_per_s2[X_AXIS], row, false, 1); - } - else - Modify_Value(planner.settings.max_acceleration_mm_per_s2[X_AXIS], 0, default_max_acceleration[X_AXIS] * 2, 1); - break; - case ACCEL_Y: - if (draw) { - Draw_Menu_Item(row, ICON_MaxAccY, GET_TEXT_F(MSG_AMAX_B)); - Draw_Float(planner.settings.max_acceleration_mm_per_s2[Y_AXIS], row, false, 1); - } - else - Modify_Value(planner.settings.max_acceleration_mm_per_s2[Y_AXIS], 0, default_max_acceleration[Y_AXIS] * 2, 1); - break; - case ACCEL_Z: - if (draw) { - Draw_Menu_Item(row, ICON_MaxAccZ, GET_TEXT_F(MSG_AMAX_C)); - Draw_Float(planner.settings.max_acceleration_mm_per_s2[Z_AXIS], row, false, 1); - } - else - Modify_Value(planner.settings.max_acceleration_mm_per_s2[Z_AXIS], 0, default_max_acceleration[Z_AXIS] * 2, 1); - break; - #if HAS_HOTEND - case ACCEL_E: - if (draw) { - Draw_Menu_Item(row, ICON_MaxAccE, GET_TEXT_F(MSG_AMAX_E)); - Draw_Float(planner.settings.max_acceleration_mm_per_s2[E_AXIS], row, false, 1); - } - else - Modify_Value(planner.settings.max_acceleration_mm_per_s2[E_AXIS], 0, default_max_acceleration[E_AXIS] * 2, 1); - break; - #endif - } - break; - #if HAS_CLASSIC_JERK - case MaxJerk: - - #define JERK_BACK 0 - #define JERK_X (JERK_BACK + 1) - #define JERK_Y (JERK_X + 1) - #define JERK_Z (JERK_Y + 1) - #define JERK_E (JERK_Z + ENABLED(HAS_HOTEND)) - #define JERK_TOTAL JERK_E - - switch (item) { - case JERK_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(Motion, MOTION_JERK); - break; - case JERK_X: - if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedJerkX, GET_TEXT_F(MSG_VA_JERK)); - Draw_Float(planner.max_jerk[X_AXIS], row, false, 10); - } - else - Modify_Value(planner.max_jerk[X_AXIS], 0, default_max_jerk[X_AXIS] * 2, 10); - break; - case JERK_Y: - if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedJerkY, GET_TEXT_F(MSG_VB_JERK)); - Draw_Float(planner.max_jerk[Y_AXIS], row, false, 10); - } - else - Modify_Value(planner.max_jerk[Y_AXIS], 0, default_max_jerk[Y_AXIS] * 2, 10); - break; - case JERK_Z: - if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedJerkZ, GET_TEXT_F(MSG_VC_JERK)); - Draw_Float(planner.max_jerk[Z_AXIS], row, false, 10); - } - else - Modify_Value(planner.max_jerk[Z_AXIS], 0, default_max_jerk[Z_AXIS] * 2, 10); - break; - #if HAS_HOTEND - case JERK_E: - if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedJerkE, GET_TEXT_F(MSG_VE_JERK)); - Draw_Float(planner.max_jerk[E_AXIS], row, false, 10); - } - else - Modify_Value(planner.max_jerk[E_AXIS], 0, default_max_jerk[E_AXIS] * 2, 10); - break; - #endif - } - break; - #endif - #if HAS_JUNCTION_DEVIATION - case JDmenu: - - #define JD_BACK 0 - #define JD_SETTING_JD_MM (JD_BACK + ENABLED(HAS_HOTEND)) - #define JD_TOTAL JD_SETTING_JD_MM - - switch (item) { - case JD_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(Motion, MOTION_JD); - break; - #if HAS_HOTEND - case JD_SETTING_JD_MM: - if (draw) { - Draw_Menu_Item(row, ICON_MaxJerk, GET_TEXT_F(MSG_JUNCTION_DEVIATION)); - Draw_Float(planner.junction_deviation_mm, row, false, 100); - } - else - Modify_Value(planner.junction_deviation_mm, MIN_JD_MM, MAX_JD_MM, 100); - break; - #endif - } - break; - #endif - case Steps: - - #define STEPS_BACK 0 - #define STEPS_X (STEPS_BACK + 1) - #define STEPS_Y (STEPS_X + 1) - #define STEPS_Z (STEPS_Y + 1) - #define STEPS_E (STEPS_Z + ENABLED(HAS_HOTEND)) - #define STEPS_TOTAL STEPS_E - - switch (item) { - case STEPS_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(Motion, MOTION_STEPS); - break; - case STEPS_X: - if (draw) { - Draw_Menu_Item(row, ICON_StepX, GET_TEXT_F(MSG_A_STEPS)); - Draw_Float(planner.settings.axis_steps_per_mm[X_AXIS], row, false, 10); - } - else - Modify_Value(planner.settings.axis_steps_per_mm[X_AXIS], 0, default_steps[X_AXIS] * 2, 10); - break; - case STEPS_Y: - if (draw) { - Draw_Menu_Item(row, ICON_StepY, GET_TEXT_F(MSG_B_STEPS)); - Draw_Float(planner.settings.axis_steps_per_mm[Y_AXIS], row, false, 10); - } - else - Modify_Value(planner.settings.axis_steps_per_mm[Y_AXIS], 0, default_steps[Y_AXIS] * 2, 10); - break; - case STEPS_Z: - if (draw) { - Draw_Menu_Item(row, ICON_StepZ, GET_TEXT_F(MSG_C_STEPS)); - Draw_Float(planner.settings.axis_steps_per_mm[Z_AXIS], row, false, 10); - } - else - Modify_Value(planner.settings.axis_steps_per_mm[Z_AXIS], 0, default_steps[Z_AXIS] * 2, 10); - break; - #if HAS_HOTEND - case STEPS_E: - if (draw) { - Draw_Menu_Item(row, ICON_StepE, GET_TEXT_F(MSG_E_STEPS)); - Draw_Float(planner.settings.axis_steps_per_mm[E_AXIS], row, false, 10); - } - else - Modify_Value(planner.settings.axis_steps_per_mm[E_AXIS], 0, 1000, 10); - break; - #endif - } - break; - - #if ANY(CASE_LIGHT_MENU, LED_CONTROL_MENU) - case Ledsmenu: - - #define LEDS_BACK 0 - #define LEDS_CASELIGHT (LEDS_BACK + ENABLED(CASE_LIGHT_MENU)) - #define LEDS_LED_CONTROL_MENU (LEDS_CASELIGHT + ENABLED(LED_CONTROL_MENU)) - #define LEDS_TOTAL LEDS_LED_CONTROL_MENU - - switch (item) { - - case LEDS_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(Control, CONTROL_LEDS); - break; - #if ENABLED(CASE_LIGHT_MENU) - case LEDS_CASELIGHT: - if (draw) { - #if ENABLED(CASELIGHT_USES_BRIGHTNESS) - Draw_Menu_Item(row, ICON_CaseLight, GET_TEXT_F(MSG_CASE_LIGHT), nullptr, true); - #else - Draw_Menu_Item(row, ICON_CaseLight, GET_TEXT_F(MSG_CASE_LIGHT)); - Draw_Checkbox(row, caselight.on); - #endif - } - else { - #if ENABLED(CASELIGHT_USES_BRIGHTNESS) - Draw_Menu(CaseLightmenu); - #else - caselight.on = !caselight.on; - caselight.update_enabled(); - Draw_Checkbox(row, caselight.on); - DWIN_UpdateLCD(); - #endif - } - break; - #endif - #if ENABLED(LED_CONTROL_MENU) - case LEDS_LED_CONTROL_MENU: - if (draw) - Draw_Menu_Item(row, ICON_LedControl, GET_TEXT_F(MSG_LED_CONTROL), nullptr, true); - else - Draw_Menu(LedControlmenu); - break; - #endif - } - break; - #endif - - #if ENABLED(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS) - case CaseLightmenu: - - #define CASE_LIGHT_BACK 0 - #define CASE_LIGHT_ON (CASE_LIGHT_BACK + 1) - #define CASE_LIGHT_USES_BRIGHT (CASE_LIGHT_ON + 1) - #define CASE_LIGHT_TOTAL CASE_LIGHT_USES_BRIGHT - - switch (item) { - - case CASE_LIGHT_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(Ledsmenu, LEDS_CASELIGHT); - break; - case CASE_LIGHT_ON: - if (draw) { - Draw_Menu_Item(row, ICON_CaseLight, GET_TEXT_F(MSG_CASE_LIGHT)); - Draw_Checkbox(row, caselight.on); - } - else { - caselight.on = !caselight.on; - caselight.update_enabled(); - Draw_Checkbox(row, caselight.on); - DWIN_UpdateLCD(); - } - break; - case CASE_LIGHT_USES_BRIGHT: - if (draw) { - Draw_Menu_Item(row, ICON_Brightness, GET_TEXT_F(MSG_CASE_LIGHT_BRIGHTNESS)); - Draw_Float(caselight.brightness, row); - } - else - Modify_Value(caselight.brightness, 0, 255, 1); - break; - } - break; - #endif - - #if ENABLED(LED_CONTROL_MENU) - case LedControlmenu: - - #define LEDCONTROL_BACK 0 - #define LEDCONTROL_LIGHTON (LEDCONTROL_BACK + !BOTH(CASE_LIGHT_MENU, CASE_LIGHT_USE_NEOPIXEL)) - #define LEDCONTROL_PRESETS_MENU (LEDCONTROL_LIGHTON + BOTH(HAS_COLOR_LEDS, LED_COLOR_PRESETS)) - #define LEDCONTROL_CUSTOM_MENU (LEDCONTROL_PRESETS_MENU + ENABLED(HAS_COLOR_LEDS) - DISABLED(LED_COLOR_PRESETS)) - #define LEDCONTROL_TOTAL LEDCONTROL_CUSTOM_MENU - - switch (item) { - case LEDCONTROL_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(Ledsmenu, LEDS_LED_CONTROL_MENU); - break; - #if !BOTH(CASE_LIGHT_MENU, CASE_LIGHT_USE_NEOPIXEL) - case LEDCONTROL_LIGHTON: - if (draw) { - Draw_Menu_Item(row, ICON_LedControl, GET_TEXT_F(MSG_LEDS)); - Draw_Checkbox(row, leds.lights_on); - } - else { - leds.toggle(); - Draw_Checkbox(row, leds.lights_on); - DWIN_UpdateLCD(); - } - break; - #endif - #if HAS_COLOR_LEDS - #if ENABLED(LED_COLOR_PRESETS) - case LEDCONTROL_PRESETS_MENU: - if (draw) - Draw_Menu_Item(row, ICON_LedControl, GET_TEXT_F(MSG_LED_PRESETS)); - else - Draw_Menu(LedControlpresets); - break; - #else - case LEDCONTROL_CUSTOM_MENU: - if (draw) - Draw_Menu_Item(row, ICON_LedControl, GET_TEXT_F(MSG_CUSTOM_LEDS)); - else - Draw_Menu(LedControlcustom); - break; - #endif - #endif - } - break; - - #if HAS_COLOR_LEDS - #if ENABLED(LED_COLOR_PRESETS) - case LedControlpresets: - - #define LEDCONTROL_PRESETS_BACK 0 - #define LEDCONTROL_PRESETS_WHITE (LEDCONTROL_PRESETS_BACK + 1) - #define LEDCONTROL_PRESETS_RED (LEDCONTROL_PRESETS_WHITE + 1) - #define LEDCONTROL_PRESETS_ORANGE (LEDCONTROL_PRESETS_RED + 1) - #define LEDCONTROL_PRESETS_YELLOW (LEDCONTROL_PRESETS_ORANGE + 1) - #define LEDCONTROL_PRESETS_GREEN (LEDCONTROL_PRESETS_YELLOW + 1) - #define LEDCONTROL_PRESETS_BLUE (LEDCONTROL_PRESETS_GREEN + 1) - #define LEDCONTROL_PRESETS_INDIGO (LEDCONTROL_PRESETS_BLUE + 1) - #define LEDCONTROL_PRESETS_VIOLET (LEDCONTROL_PRESETS_INDIGO + 1) - #define LEDCONTROL_PRESETS_TOTAL LEDCONTROL_PRESETS_VIOLET - - #define LEDCOLORITEM(MSG,FUNC) if (draw) Draw_Menu_Item(row, ICON_LedControl, GET_TEXT_F(MSG)); else FUNC; break; - - switch (item) { - case LEDCONTROL_PRESETS_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(LedControlmenu, LEDCONTROL_PRESETS_MENU); - break; - case LEDCONTROL_PRESETS_WHITE: LEDCOLORITEM(MSG_SET_LEDS_WHITE, leds.set_white()); - case LEDCONTROL_PRESETS_RED: LEDCOLORITEM(MSG_SET_LEDS_RED, leds.set_red()); - case LEDCONTROL_PRESETS_ORANGE: LEDCOLORITEM(MSG_SET_LEDS_ORANGE, leds.set_orange()); - case LEDCONTROL_PRESETS_YELLOW: LEDCOLORITEM(MSG_SET_LEDS_YELLOW, leds.set_yellow()); - case LEDCONTROL_PRESETS_GREEN: LEDCOLORITEM(MSG_SET_LEDS_GREEN, leds.set_green()); - case LEDCONTROL_PRESETS_BLUE: LEDCOLORITEM(MSG_SET_LEDS_BLUE, leds.set_blue()); - case LEDCONTROL_PRESETS_INDIGO: LEDCOLORITEM(MSG_SET_LEDS_INDIGO, leds.set_indigo()); - case LEDCONTROL_PRESETS_VIOLET: LEDCOLORITEM(MSG_SET_LEDS_VIOLET, leds.set_violet()); - } - break; - #else - case LedControlcustom: - - #define LEDCONTROL_CUSTOM_BACK 0 - #define LEDCONTROL_CUSTOM_RED (LEDCONTROL_CUSTOM_BACK + 1) - #define LEDCONTROL_CUSTOM_GREEN (LEDCONTROL_CUSTOM_RED + 1) - #define LEDCONTROL_CUSTOM_BLUE (LEDCONTROL_CUSTOM_GREEN + 1) - #define LEDCONTROL_CUSTOM_WHITE (LEDCONTROL_CUSTOM_BLUE + ENABLED(HAS_WHITE_LED)) - #define LEDCONTROL_CUSTOM_TOTAL LEDCONTROL_CUSTOM_WHITE - - switch (item) { - case LEDCONTROL_PRESETS_BACK: - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(LedControlmenu, LEDCONTROL_CUSTOM_MENU); - break; - case LEDCONTROL_CUSTOM_RED: - if (draw) { - Draw_Menu_Item(row, ICON_LedControl, GET_TEXT_F(MSG_INTENSITY_R)); - Draw_Float(leds.color.r, row); - } - else - Modify_Value(leds.color.r, 0, 255, 1); - break; - case LEDCONTROL_CUSTOM_GREEN: - if (draw) { - Draw_Menu_Item(row, ICON_LedControl, GET_TEXT_F(MSG_INTENSITY_G)); - Draw_Float(leds.color.g, row); - } - else - Modify_Value(leds.color.g, 0, 255, 1); - break; - case LEDCONTROL_CUSTOM_BLUE: - if (draw) { - Draw_Menu_Item(row, ICON_LedControl, GET_TEXT_F(MSG_INTENSITY_B)); - Draw_Float(leds.color.b, row); - } - else - Modify_Value(leds.color.b, 0, 255, 1); - break; - #if HAS_WHITE_LED - case case LEDCONTROL_CUSTOM_WHITE: - if (draw) { - Draw_Menu_Item(row, ICON_LedControl, GET_TEXT_F(MSG_INTENSITY_W)); - Draw_Float(leds.color.w, row); - } - else - Modify_Value(leds.color.w, 0, 255, 1); - break; - #endif - } - break; - #endif - #endif - #endif - - case Visual: - - #define VISUAL_BACK 0 - #define VISUAL_BACKLIGHT (VISUAL_BACK + 1) - #define VISUAL_BRIGHTNESS (VISUAL_BACKLIGHT + 1) - #define VISUAL_TIME_FORMAT (VISUAL_BRIGHTNESS + 1) - #define VISUAL_COLOR_THEMES (VISUAL_TIME_FORMAT + 1) - #define VISUAL_TOTAL VISUAL_COLOR_THEMES - - switch (item) { - case VISUAL_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(Control, CONTROL_VISUAL); - break; - case VISUAL_BACKLIGHT: - if (draw) - Draw_Menu_Item(row, ICON_Brightness, GET_TEXT_F(MSG_BRIGHTNESS_OFF)); - else - ui.set_brightness(0); - break; - case VISUAL_BRIGHTNESS: - if (draw) { - Draw_Menu_Item(row, ICON_Brightness, GET_TEXT_F(MSG_BRIGHTNESS)); - Draw_Float(ui.brightness, row, false, 1); - } - else - Modify_Value(ui.brightness, LCD_BRIGHTNESS_MIN, LCD_BRIGHTNESS_MAX, 1, ui.refresh_brightness); - break; - case VISUAL_TIME_FORMAT: - if (draw) { - Draw_Menu_Item(row, ICON_PrintTime, F("Progress as __h__m")); - Draw_Checkbox(row, eeprom_settings.time_format_textual); - } - else { - eeprom_settings.time_format_textual = !eeprom_settings.time_format_textual; - Draw_Checkbox(row, eeprom_settings.time_format_textual); - } - break; - case VISUAL_COLOR_THEMES: - if (draw) - Draw_Menu_Item(row, ICON_MaxSpeed, GET_TEXT_F(MSG_COLORS_SELECT), nullptr, true); - else - Draw_Menu(ColorSettings); - break; - } - break; - - case ColorSettings: - - #define COLORSETTINGS_BACK 0 - #define COLORSETTINGS_CURSOR (COLORSETTINGS_BACK + 1) - #define COLORSETTINGS_SPLIT_LINE (COLORSETTINGS_CURSOR + 1) - #define COLORSETTINGS_MENU_TOP_TXT (COLORSETTINGS_SPLIT_LINE + 1) - #define COLORSETTINGS_MENU_TOP_BG (COLORSETTINGS_MENU_TOP_TXT + 1) - #define COLORSETTINGS_HIGHLIGHT_BORDER (COLORSETTINGS_MENU_TOP_BG + 1) - #define COLORSETTINGS_PROGRESS_PERCENT (COLORSETTINGS_HIGHLIGHT_BORDER + 1) - #define COLORSETTINGS_PROGRESS_TIME (COLORSETTINGS_PROGRESS_PERCENT + 1) - #define COLORSETTINGS_PROGRESS_STATUS_BAR (COLORSETTINGS_PROGRESS_TIME + 1) - #define COLORSETTINGS_PROGRESS_STATUS_AREA (COLORSETTINGS_PROGRESS_STATUS_BAR + 1) - #define COLORSETTINGS_PROGRESS_COORDINATES (COLORSETTINGS_PROGRESS_STATUS_AREA + 1) - #define COLORSETTINGS_PROGRESS_COORDINATES_LINE (COLORSETTINGS_PROGRESS_COORDINATES + 1) - #define COLORSETTINGS_TOTAL COLORSETTINGS_PROGRESS_COORDINATES_LINE - - switch (item) { - case COLORSETTINGS_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(Visual, VISUAL_COLOR_THEMES); - break; - case COLORSETTINGS_CURSOR: - if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, F("Cursor")); - Draw_Option(eeprom_settings.cursor_color, color_names, row, false, true); - } - else - Modify_Option(eeprom_settings.cursor_color, color_names, Custom_Colors); - break; - case COLORSETTINGS_SPLIT_LINE: - if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, F("Menu Split Line")); - Draw_Option(eeprom_settings.menu_split_line, color_names, row, false, true); - } - else - Modify_Option(eeprom_settings.menu_split_line, color_names, Custom_Colors); - break; - case COLORSETTINGS_MENU_TOP_TXT: - if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, F("Menu Header Text")); - Draw_Option(eeprom_settings.menu_top_txt, color_names, row, false, true); - } - else - Modify_Option(eeprom_settings.menu_top_txt, color_names, Custom_Colors); - break; - case COLORSETTINGS_MENU_TOP_BG: - if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, F("Menu Header Bg")); - Draw_Option(eeprom_settings.menu_top_bg, color_names, row, false, true); - } - else - Modify_Option(eeprom_settings.menu_top_bg, color_names, Custom_Colors); - break; - case COLORSETTINGS_HIGHLIGHT_BORDER: - if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, F("Highlight Box")); - Draw_Option(eeprom_settings.highlight_box, color_names, row, false, true); - } - else - Modify_Option(eeprom_settings.highlight_box, color_names, Custom_Colors); - break; - case COLORSETTINGS_PROGRESS_PERCENT: - if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, F("Progress Percent")); - Draw_Option(eeprom_settings.progress_percent, color_names, row, false, true); - } - else - Modify_Option(eeprom_settings.progress_percent, color_names, Custom_Colors); - break; - case COLORSETTINGS_PROGRESS_TIME: - if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, F("Progress Time")); - Draw_Option(eeprom_settings.progress_time, color_names, row, false, true); - } - else - Modify_Option(eeprom_settings.progress_time, color_names, Custom_Colors); - break; - case COLORSETTINGS_PROGRESS_STATUS_BAR: - if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, F("Status Bar Text")); - Draw_Option(eeprom_settings.status_bar_text, color_names, row, false, true); - } - else - Modify_Option(eeprom_settings.status_bar_text, color_names, Custom_Colors); - break; - case COLORSETTINGS_PROGRESS_STATUS_AREA: - if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, F("Status Area Text")); - Draw_Option(eeprom_settings.status_area_text, color_names, row, false, true); - } - else - Modify_Option(eeprom_settings.status_area_text, color_names, Custom_Colors); - break; - case COLORSETTINGS_PROGRESS_COORDINATES: - if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, F("Coordinates Text")); - Draw_Option(eeprom_settings.coordinates_text, color_names, row, false, true); - } - else - Modify_Option(eeprom_settings.coordinates_text, color_names, Custom_Colors); - break; - case COLORSETTINGS_PROGRESS_COORDINATES_LINE: - if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, F("Coordinates Line")); - Draw_Option(eeprom_settings.coordinates_split_line, color_names, row, false, true); - } - else - Modify_Option(eeprom_settings.coordinates_split_line, color_names, Custom_Colors); - break; - } // switch (item) - break; - - #if HAS_HOSTACTION_MENUS - case HostSettings: - - #define HOSTSETTINGS_BACK 0 - #define HOSTSETTINGS_ACTIONCOMMANDS (HOSTSETTINGS_BACK + 1) - #define HOSTSETTINGS_TOTAL HOSTSETTINGS_ACTIONCOMMANDS - - switch (item) { - case HOSTSETTINGS_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(Control, CONTROL_HOSTSETTINGS); - break; - case HOSTSETTINGS_ACTIONCOMMANDS: - if (draw) Draw_Menu_Item(row, ICON_File, F("Host Actions")); - else Draw_Menu(ActionCommands); - break; - } - break; - - case ActionCommands: - - #define ACTIONCOMMANDS_BACK 0 - #define ACTIONCOMMANDS_1 (ACTIONCOMMANDS_BACK + 1) - #define ACTIONCOMMANDS_2 (ACTIONCOMMANDS_1 + 1) - #define ACTIONCOMMANDS_3 (ACTIONCOMMANDS_2 + 1) - #define ACTIONCOMMANDS_TOTAL ACTIONCOMMANDS_3 - - switch (item) { - case ACTIONCOMMANDS_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(HostSettings, HOSTSETTINGS_ACTIONCOMMANDS); - break; - case ACTIONCOMMANDS_1: - if (draw) { - Draw_Menu_Item(row, ICON_File, F("Action #1")); - Draw_String(action1, row); - } - else - Modify_String(action1, 8, true); - break; - case ACTIONCOMMANDS_2: - if (draw) { - Draw_Menu_Item(row, ICON_File, F("Action #2")); - Draw_String(action2, row); - } - else - Modify_String(action2, 8, true); - break; - case ACTIONCOMMANDS_3: - if (draw) { - Draw_Menu_Item(row, ICON_File, F("Action #3")); - Draw_String(action3, row); - } - else - Modify_String(action3, 8, true); - break; - } - break; - #endif - - case Advanced: - - #define ADVANCED_BACK 0 - #define ADVANCED_BEEPER (ADVANCED_BACK + ENABLED(SOUND_MENU_ITEM)) - #define ADVANCED_PROBE (ADVANCED_BEEPER + ENABLED(HAS_BED_PROBE)) - #define ADVANCED_CORNER (ADVANCED_PROBE + 1) - #define ADVANCED_LA (ADVANCED_CORNER + ENABLED(LIN_ADVANCE)) - #define ADVANCED_LOAD (ADVANCED_LA + ENABLED(ADVANCED_PAUSE_FEATURE)) - #define ADVANCED_UNLOAD (ADVANCED_LOAD + ENABLED(ADVANCED_PAUSE_FEATURE)) - #define ADVANCED_COLD_EXTRUDE (ADVANCED_UNLOAD + ENABLED(PREVENT_COLD_EXTRUSION)) - #define ADVANCED_FILSENSORENABLED (ADVANCED_COLD_EXTRUDE + ENABLED(FILAMENT_RUNOUT_SENSOR)) - #define ADVANCED_FILSENSORDISTANCE (ADVANCED_FILSENSORENABLED + ENABLED(HAS_FILAMENT_RUNOUT_DISTANCE)) - #define ADVANCED_POWER_LOSS (ADVANCED_FILSENSORDISTANCE + ENABLED(POWER_LOSS_RECOVERY)) - #define ADVANCED_BAUDRATE_MODE (ADVANCED_POWER_LOSS + ENABLED(BAUD_RATE_GCODE)) - #define ADVANCED_ESDIAG (ADVANCED_BAUDRATE_MODE + ENABLED(HAS_ESDIAG)) - #define ADVANCED_LOCKSCREEN (ADVANCED_ESDIAG + ENABLED(HAS_LOCKSCREEN)) - #define ADVANCED_TOTAL ADVANCED_LOCKSCREEN - - switch (item) { - case ADVANCED_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(Control, CONTROL_ADVANCED); - break; - - #if ENABLED(SOUND_MENU_ITEM) - case ADVANCED_BEEPER: - if (draw) { - Draw_Menu_Item(row, ICON_Sound, GET_TEXT_F(MSG_SOUND_ENABLE)); - Draw_Checkbox(row, ui.sound_on); - } - else { - ui.sound_on = !ui.sound_on; - Draw_Checkbox(row, ui.sound_on); - } - break; - #endif - - #if HAS_BED_PROBE - case ADVANCED_PROBE: - if (draw) - Draw_Menu_Item(row, ICON_ProbeSet, GET_TEXT_F(MSG_ZPROBE_SETTINGS), nullptr, true); - else - Draw_Menu(ProbeMenu); - break; - #endif - - case ADVANCED_CORNER: - if (draw) { - Draw_Menu_Item(row, ICON_MaxAccelerated, F("Bed Screw Inset")); - Draw_Float(temp_val.corner_pos, row, false, 10); - } - else - Modify_Value(temp_val.corner_pos, 1, 100, 10); - break; - - #if ENABLED(LIN_ADVANCE) - case ADVANCED_LA: - if (draw) { - Draw_Menu_Item(row, ICON_MaxAccelerated, GET_TEXT_F(MSG_ADVANCE_K_E)); - Draw_Float(planner.extruder_advance_K[0], row, false, 100); - } - else - Modify_Value(planner.extruder_advance_K[0], 0, 10, 100); - break; - #endif - - #if ENABLED(ADVANCED_PAUSE_FEATURE) - case ADVANCED_LOAD: - if (draw) { - Draw_Menu_Item(row, ICON_WriteEEPROM, GET_TEXT_F(MSG_FILAMENT_LOAD)); - Draw_Float(fc_settings[0].load_length, row, false, 1); - } - else - Modify_Value(fc_settings[0].load_length, 0, EXTRUDE_MAXLENGTH, 1); - break; - case ADVANCED_UNLOAD: - if (draw) { - Draw_Menu_Item(row, ICON_ReadEEPROM, GET_TEXT_F(MSG_FILAMENT_UNLOAD)); - Draw_Float(fc_settings[0].unload_length, row, false, 1); - } - else - Modify_Value(fc_settings[0].unload_length, 0, EXTRUDE_MAXLENGTH, 1); - break; - #endif // ADVANCED_PAUSE_FEATURE - - #if ENABLED(PREVENT_COLD_EXTRUSION) - case ADVANCED_COLD_EXTRUDE: - if (draw) { - Draw_Menu_Item(row, ICON_Cool, F("Min Extrusion T")); - Draw_Float(thermalManager.extrude_min_temp, row, false, 1); - } - else { - Modify_Value(thermalManager.extrude_min_temp, 0, MAX_E_TEMP, 1); - thermalManager.allow_cold_extrude = (thermalManager.extrude_min_temp == 0); - } - break; - #endif - - #if ENABLED(FILAMENT_RUNOUT_SENSOR) - case ADVANCED_FILSENSORENABLED: - if (draw) { - Draw_Menu_Item(row, ICON_Extruder, GET_TEXT_F(MSG_RUNOUT_ENABLE)); - Draw_Checkbox(row, runout.enabled); - } - else { - runout.enabled = !runout.enabled; - Draw_Checkbox(row, runout.enabled); - } - break; - - #if ENABLED(HAS_FILAMENT_RUNOUT_DISTANCE) - case ADVANCED_FILSENSORDISTANCE: - if (draw) { - Draw_Menu_Item(row, ICON_MaxAccE, GET_TEXT_F(MSG_RUNOUT_DISTANCE_MM)); - Draw_Float(runout.runout_distance(), row, false, 10); - } - else - Modify_Value(runout.runout_distance(), 0, 999, 10); - break; - #endif - #endif // FILAMENT_RUNOUT_SENSOR - - #if ENABLED(POWER_LOSS_RECOVERY) - case ADVANCED_POWER_LOSS: - if (draw) { - Draw_Menu_Item(row, ICON_Motion, GET_TEXT_F(MSG_OUTAGE_RECOVERY)); - Draw_Checkbox(row, recovery.enabled); - } - else { - recovery.enable(!recovery.enabled); - Draw_Checkbox(row, recovery.enabled); - } - break; - #endif - #if ENABLED(BAUD_RATE_GCODE) - case ADVANCED_BAUDRATE_MODE: - if (draw) { - Draw_Menu_Item(row, ICON_Setspeed, F("115k Baud")); - Draw_Checkbox(row, eeprom_settings.Baud115k); - } - else { - eeprom_settings.Baud115k = !eeprom_settings.Baud115k; - queue.inject(eeprom_settings.Baud115k ? F("M575 P0 B115200") : F("M575 P0 B250000")); - } - break; - #endif - #if HAS_ESDIAG - case ADVANCED_ESDIAG: - if (draw) - Draw_Menu_Item(row, ICON_ESDiag, F("End-stops diagnostic")); - else - DWIN_EndstopsDiag(); - break; - #endif - #if HAS_LOCKSCREEN - case ADVANCED_LOCKSCREEN: - if (draw) - Draw_Menu_Item(row, ICON_Lock, GET_TEXT_F(MSG_LOCKSCREEN)); - else - DWIN_LockScreen(); - break; - #endif - } - break; - - #if HAS_BED_PROBE - case ProbeMenu: - - #define PROBE_BACK 0 - #define PROBE_XOFFSET (PROBE_BACK + 1) - #define PROBE_YOFFSET (PROBE_XOFFSET + 1) - #define PROBE_ZOFFSET (PROBE_YOFFSET + 1) - #define PROBE_HSMODE (PROBE_ZOFFSET + ENABLED(BLTOUCH)) - #define PROBE_ALARMR (PROBE_HSMODE + ENABLED(BLTOUCH)) - #define PROBE_SELFTEST (PROBE_ALARMR + ENABLED(BLTOUCH)) - #define PROBE_MOVEP (PROBE_SELFTEST + ENABLED(BLTOUCH)) - #define PROBE_TEST (PROBE_MOVEP + 1) - #define PROBE_TEST_COUNT (PROBE_TEST + 1) - #define PROBE_TOTAL PROBE_TEST_COUNT - - static uint8_t testcount = 4; - - switch (item) { - case PROBE_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(Advanced, ADVANCED_PROBE); - break; - case PROBE_XOFFSET: - if (draw) { - Draw_Menu_Item(row, ICON_StepX, GET_TEXT_F(MSG_ZPROBE_XOFFSET)); - Draw_Float(probe.offset.x, row, false, 10); - } - else - Modify_Value(probe.offset.x, -MAX_XY_OFFSET, MAX_XY_OFFSET, 10); - break; - case PROBE_YOFFSET: - if (draw) { - Draw_Menu_Item(row, ICON_StepY, GET_TEXT_F(MSG_ZPROBE_YOFFSET)); - Draw_Float(probe.offset.y, row, false, 10); - } - else - Modify_Value(probe.offset.y, -MAX_XY_OFFSET, MAX_XY_OFFSET, 10); - break; - case PROBE_ZOFFSET: - if (draw) { - Draw_Menu_Item(row, ICON_StepZ, GET_TEXT_F(MSG_ZPROBE_ZOFFSET)); - Draw_Float(probe.offset.z, row, false, 100); - } - else - Modify_Value(probe.offset.z, MIN_Z_OFFSET, MAX_Z_OFFSET, 100); - break; - #if ENABLED(BLTOUCH) - case PROBE_HSMODE: - if (draw) { - Draw_Menu_Item(row, ICON_HSMode, GET_TEXT(MSG_BLTOUCH_SPEED_MODE)); - Draw_Checkbox(row, bltouch.high_speed_mode); - } - else { - bltouch.high_speed_mode = !bltouch.high_speed_mode; - Draw_Checkbox(row, bltouch.high_speed_mode); - } - break; - case PROBE_ALARMR: - if (draw) - Draw_Menu_Item(row, ICON_ProbeAlarm, GET_TEXT_F(MSG_BLTOUCH_RESET)); - else { - gcode.process_subcommands_now(F("M280 P0 S160")); - AudioFeedback(); - } - break; - case PROBE_SELFTEST: - if (draw) - Draw_Menu_Item(row, ICON_ProbeSelfTest, GET_TEXT_F(MSG_BLTOUCH_SELFTEST)); - else { - gcode.process_subcommands_now(F("M280 P0 S120\nG4 P1000\nM280 P0 S160")); - planner.synchronize(); - AudioFeedback(); - } - break; - case PROBE_MOVEP: - if (draw) { - Draw_Menu_Item(row, ICON_ProbeDeploy, GET_TEXT_F(MSG_BLTOUCH_DEPLOY)); - Draw_Checkbox(row, temp_val.probe_deployed); - } - else { - temp_val.probe_deployed = !temp_val.probe_deployed; - if (temp_val.probe_deployed == true) gcode.process_subcommands_now(F("M280 P0 S10")); - else gcode.process_subcommands_now(F("M280 P0 S90")); - Draw_Checkbox(row, temp_val.probe_deployed); - } - break; - #endif - case PROBE_TEST: - if (draw) - Draw_Menu_Item(row, ICON_ProbeTest, GET_TEXT_F(MSG_M48_TEST)); - else { - sprintf_P(cmd, PSTR("G28O\nM48 X%s Y%s P%i"), dtostrf((X_BED_SIZE + X_MIN_POS) / 2.0f, 1, 3, str_1), dtostrf((Y_BED_SIZE + Y_MIN_POS) / 2.0f, 1, 3, str_2), testcount); - gcode.process_subcommands_now(cmd); - } - break; - case PROBE_TEST_COUNT: - if (draw) { - Draw_Menu_Item(row, ICON_ProbeTestCount, F("Probe Test Count")); - Draw_Float(testcount, row, false, 1); - } - else - Modify_Value(testcount, 4, 50, 1); - break; - } - break; - #endif - - case InfoMain: - case Info: - - #define INFO_BACK 0 - #define INFO_PRINTCOUNT (INFO_BACK + ENABLED(PRINTCOUNTER)) - #define INFO_PRINTTIME (INFO_PRINTCOUNT + ENABLED(PRINTCOUNTER)) - #define INFO_SIZE (INFO_PRINTTIME + 1) - #define INFO_VERSION (INFO_SIZE + 1) - #define INFO_CONTACT (INFO_VERSION + 1) - #define INFO_TOTAL INFO_BACK - - switch (item) { - case INFO_BACK: - if (draw) { - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - - #if ENABLED(PRINTCOUNTER) - char row1[50], row2[50], buf[32]; - printStatistics ps = print_job_timer.getStats(); - - sprintf_P(row1, PSTR("%i prints, %i finished"), ps.totalPrints, ps.finishedPrints); - sprintf_P(row2, PSTR("%s m filament used"), dtostrf(ps.filamentUsed / 1000, 1, 2, str_1)); - Draw_Menu_Item(INFO_PRINTCOUNT, ICON_HotendTemp, row1, row2, false, true); - - duration_t(print_job_timer.getStats().printTime).toString(buf); - sprintf_P(row1, PSTR("Printed: %s"), buf); - duration_t(print_job_timer.getStats().longestPrint).toString(buf); - sprintf_P(row2, PSTR("Longest: %s"), buf); - Draw_Menu_Item(INFO_PRINTTIME, ICON_PrintTime, row1, row2, false, true); - #endif - - Draw_Menu_Item(INFO_SIZE, ICON_PrintSize, F(MACHINE_SIZE), nullptr, false, true); - Draw_Menu_Item(INFO_VERSION, ICON_Version, F(SHORT_BUILD_VERSION), nullptr, false, true); - Draw_Menu_Item(INFO_CONTACT, ICON_Contact, F(CORP_WEBSITE), nullptr, false, true); - } - else { - if (menu == Info) - Draw_Menu(Control, CONTROL_INFO); - else - Draw_Main_Menu(3); - } - break; - } - break; - - #if HAS_MESH - case Leveling: - - #define LEVELING_BACK 0 - #define LEVELING_ACTIVE (LEVELING_BACK + 1) - #define LEVELING_GET_TILT (LEVELING_ACTIVE + BOTH(HAS_BED_PROBE, AUTO_BED_LEVELING_UBL)) - #define LEVELING_GET_MESH (LEVELING_GET_TILT + 1) - #define LEVELING_MANUAL (LEVELING_GET_MESH + 1) - #define LEVELING_VIEW (LEVELING_MANUAL + 1) - #define LEVELING_SETTINGS (LEVELING_VIEW + 1) - #define LEVELING_SLOT (LEVELING_SETTINGS + ENABLED(AUTO_BED_LEVELING_UBL)) - #define LEVELING_LOAD (LEVELING_SLOT + ENABLED(AUTO_BED_LEVELING_UBL)) - #define LEVELING_SAVE (LEVELING_LOAD + ENABLED(AUTO_BED_LEVELING_UBL)) - #define LEVELING_TOTAL LEVELING_SAVE - - switch (item) { - case LEVELING_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Main_Menu(3); - break; - case LEVELING_ACTIVE: - if (draw) { - Draw_Menu_Item(row, ICON_MeshActive, GET_TEXT_F(MSG_MESH_LEVELING)); - Draw_Checkbox(row, planner.leveling_active); - } - else { - if (!planner.leveling_active) { - set_bed_leveling_enabled(!planner.leveling_active); - if (!planner.leveling_active) { Confirm_Handler(LevelError); break; } - } - else - set_bed_leveling_enabled(!planner.leveling_active); - Draw_Checkbox(row, planner.leveling_active); - } - break; - #if BOTH(HAS_BED_PROBE, AUTO_BED_LEVELING_UBL) - case LEVELING_GET_TILT: - if (draw) - Draw_Menu_Item(row, ICON_Tilt, F("Autotilt Current Mesh")); - else { - if (bedlevel.storage_slot < 0) { Popup_Handler(MeshSlot); break; } - PreheatBefore(); - Popup_Handler(Home); - gcode.home_all_axes(true); - Popup_Handler(Level); - if (mesh_conf.tilt_grid > 1) { - sprintf_P(cmd, PSTR("G29 J%i"), mesh_conf.tilt_grid); - gcode.process_subcommands_now(cmd); - } - else - gcode.process_subcommands_now(F("G29 J")); - planner.synchronize(); - Redraw_Menu(); - } - break; - #endif - case LEVELING_GET_MESH: - if (draw) - Draw_Menu_Item(row, ICON_Mesh, GET_TEXT_F(MSG_UBL_BUILD_MESH_MENU)); - else { - #if ENABLED(AUTO_BED_LEVELING_UBL) - if (bedlevel.storage_slot < 0) { Popup_Handler(MeshSlot, true); break; } - #endif - PreheatBefore(); - Popup_Handler(Home); - gcode.home_all_axes(true); - #if ENABLED(AUTO_BED_LEVELING_UBL) - #if HAS_BED_PROBE - Popup_Handler(Level); - gcode.process_subcommands_now(F("G29 P1")); - gcode.process_subcommands_now(F("G29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nM420 S1")); - planner.synchronize(); - Update_Status(GET_TEXT_F(MSG_MESH_DONE)); - Popup_Handler(SaveLevel); - #else - level_state = planner.leveling_active; - set_bed_leveling_enabled(false); - mesh_conf.goto_mesh_value = true; - mesh_conf.mesh_x = mesh_conf.mesh_y = 0; - Popup_Handler(MoveWait); - mesh_conf.manual_mesh_move(); - Draw_Menu(UBLMesh); - #endif - #elif HAS_BED_PROBE - Popup_Handler(Level); - gcode.process_subcommands_now(F("G29")); - planner.synchronize(); - Update_Status(GET_TEXT_F(MSG_MESH_DONE)); - Popup_Handler(SaveLevel); - #else - level_state = planner.leveling_active; - set_bed_leveling_enabled(false); - temp_val.gridpoint = 1; - Popup_Handler(MoveWait); - gcode.process_subcommands_now(F("M211 S0\nG29")); - planner.synchronize(); - Draw_Menu(ManualMesh); - #endif - } - break; - case LEVELING_MANUAL: - if (draw) - Draw_Menu_Item(row, ICON_Mesh, GET_TEXT_F(MSG_UBL_MESH_EDIT), nullptr, true); - else { - #if ENABLED(AUTO_BED_LEVELING_BILINEAR) - if (!leveling_is_valid()) { Confirm_Handler(InvalidMesh); break; } - #endif - #if ENABLED(AUTO_BED_LEVELING_UBL) - if (bedlevel.storage_slot < 0) { Popup_Handler(MeshSlot); break; } - #endif - PreheatBefore(); - if (axes_should_home()) { Popup_Handler(Home); gcode.home_all_axes(true); } - level_state = planner.leveling_active; - set_bed_leveling_enabled(false); - mesh_conf.goto_mesh_value = false; - Popup_Handler(MoveWait); - mesh_conf.manual_mesh_move(); - gcode.process_subcommands_now(F("M211 S0")); - Draw_Menu(LevelManual); - } - break; - case LEVELING_VIEW: - if (draw) - Draw_Menu_Item(row, ICON_Mesh, GET_TEXT_F(MSG_MESH_VIEW), nullptr, true); - else { - #if ENABLED(AUTO_BED_LEVELING_UBL) - if (bedlevel.storage_slot < 0) { Popup_Handler(MeshSlot); break; } - #endif - Draw_Menu(LevelView); - } - break; - case LEVELING_SETTINGS: - if (draw) - Draw_Menu_Item(row, ICON_Step, GET_TEXT_F(MSG_ADVANCED_SETTINGS), nullptr, true); - else - Draw_Menu(LevelSettings); - break; - #if ENABLED(AUTO_BED_LEVELING_UBL) - case LEVELING_SLOT: - if (draw) { - Draw_Menu_Item(row, ICON_PrintSize, GET_TEXT_F(MSG_UBL_STORAGE_SLOT)); - Draw_Float(bedlevel.storage_slot, row, false, 1); - } - else - Modify_Value(bedlevel.storage_slot, 0, settings.calc_num_meshes() - 1, 1); - break; - case LEVELING_LOAD: - if (draw) - Draw_Menu_Item(row, ICON_ReadEEPROM, GET_TEXT_F(MSG_UBL_LOAD_MESH)); - else { - if (bedlevel.storage_slot < 0) { Popup_Handler(MeshSlot); break; } - gcode.process_subcommands_now(F("G29 L")); - planner.synchronize(); - AudioFeedback(true); - } - break; - case LEVELING_SAVE: - if (draw) - Draw_Menu_Item(row, ICON_WriteEEPROM, GET_TEXT_F(MSG_UBL_SAVE_MESH)); - else { - if (bedlevel.storage_slot < 0) { Popup_Handler(MeshSlot); break; } - gcode.process_subcommands_now(F("G29 S")); - planner.synchronize(); - AudioFeedback(true); - } - break; - #endif - } - break; - - case LevelView: - - #define LEVELING_VIEW_BACK 0 - #define LEVELING_VIEW_MESH (LEVELING_VIEW_BACK + 1) - #define LEVELING_VIEW_TEXT (LEVELING_VIEW_MESH + 1) - #define LEVELING_VIEW_ASYMMETRIC (LEVELING_VIEW_TEXT + 1) - #define LEVELING_VIEW_TOTAL LEVELING_VIEW_ASYMMETRIC - - switch (item) { - case LEVELING_VIEW_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(Leveling, LEVELING_VIEW); - break; - case LEVELING_VIEW_MESH: - if (draw) - Draw_Menu_Item(row, ICON_PrintSize, GET_TEXT_F(MSG_MESH_VIEW), nullptr, true); - else - Draw_Menu(MeshViewer); - break; - case LEVELING_VIEW_TEXT: - if (draw) { - Draw_Menu_Item(row, ICON_Contact, F("Viewer Show Values")); - Draw_Checkbox(row, mesh_conf.viewer_print_value); - } - else { - mesh_conf.viewer_print_value = !mesh_conf.viewer_print_value; - Draw_Checkbox(row, mesh_conf.viewer_print_value); - } - break; - case LEVELING_VIEW_ASYMMETRIC: - if (draw) { - Draw_Menu_Item(row, ICON_Axis, F("Viewer Asymmetric")); - Draw_Checkbox(row, mesh_conf.viewer_asymmetric_range); - } - else { - mesh_conf.viewer_asymmetric_range = !mesh_conf.viewer_asymmetric_range; - Draw_Checkbox(row, mesh_conf.viewer_asymmetric_range); - } - break; - } - break; - - case LevelSettings: - - #define LEVELING_SETTINGS_BACK 0 - #define LEVELING_SETTINGS_LEVELTEMP_MODE (LEVELING_SETTINGS_BACK + ENABLED(PREHEAT_BEFORE_LEVELING)) - #define LEVELING_SETTINGS_HOTENDTEMP (LEVELING_SETTINGS_LEVELTEMP_MODE + ENABLED(PREHEAT_BEFORE_LEVELING)) - #define LEVELING_SETTINGS_BEDTEMP (LEVELING_SETTINGS_HOTENDTEMP + ENABLED(PREHEAT_BEFORE_LEVELING)) - #define LEVELING_SETTINGS_FADE (LEVELING_SETTINGS_BEDTEMP + 1) - #define LEVELING_SETTINGS_TILT (LEVELING_SETTINGS_FADE + ENABLED(AUTO_BED_LEVELING_UBL)) - #define LEVELING_SETTINGS_PLANE (LEVELING_SETTINGS_TILT + ENABLED(AUTO_BED_LEVELING_UBL)) - #define LEVELING_SETTINGS_ZERO (LEVELING_SETTINGS_PLANE + ENABLED(AUTO_BED_LEVELING_UBL)) - #define LEVELING_SETTINGS_UNDEF (LEVELING_SETTINGS_ZERO + ENABLED(AUTO_BED_LEVELING_UBL)) - #define LEVELING_SETTINGS_TOTAL LEVELING_SETTINGS_UNDEF - - switch (item) { - case LEVELING_SETTINGS_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else - Draw_Menu(Leveling, LEVELING_SETTINGS); - break; - #if ENABLED(PREHEAT_BEFORE_LEVELING) - case LEVELING_SETTINGS_LEVELTEMP_MODE: - if (draw) { - Draw_Menu_Item(row, ICON_Homing, F("Preheat Mode")); - Draw_Option(temp_val.LevelingTempmode, preheat_levmodes, row); - } - else - Modify_Option(temp_val.LevelingTempmode, preheat_levmodes, 3); - break; - case LEVELING_SETTINGS_HOTENDTEMP: - if (draw) { - Draw_Menu_Item(row, ICON_SetEndTemp, F("Preheat Hotend")); - Draw_Float(eeprom_settings.hotend_levtemp, row, false, 1); - } - else - Modify_Value(eeprom_settings.hotend_levtemp, MIN_E_TEMP, MAX_E_TEMP, 1); - break; - case LEVELING_SETTINGS_BEDTEMP: - if (draw) { - Draw_Menu_Item(row, ICON_SetBedTemp, F("Preheat Bed")); - Draw_Float(eeprom_settings.bed_levtemp, row, false, 1); - } - else - Modify_Value(eeprom_settings.bed_levtemp, MIN_BED_TEMP, MAX_BED_TEMP, 1); - break; - #endif - case LEVELING_SETTINGS_FADE: - if (draw) { - Draw_Menu_Item(row, ICON_Fade, GET_TEXT_F(MSG_Z_FADE_HEIGHT)); - Draw_Float(planner.z_fade_height, row, false, 1); - } - else { - Modify_Value(planner.z_fade_height, 0, Z_MAX_POS, 1); - planner.z_fade_height = -1; - set_z_fade_height(planner.z_fade_height); - } - break; - - #if ENABLED(AUTO_BED_LEVELING_UBL) - - case LEVELING_SETTINGS_TILT: - if (draw) { - Draw_Menu_Item(row, ICON_Tilt, F("Tilting Grid")); - Draw_Float(mesh_conf.tilt_grid, row, false, 1); - } - else - Modify_Value(mesh_conf.tilt_grid, 1, 8, 1); - break; - - case LEVELING_SETTINGS_PLANE: - if (draw) - Draw_Menu_Item(row, ICON_ResumeEEPROM, F("Convert Mesh to Plane")); - else { - if (mesh_conf.create_plane_from_mesh()) break; - gcode.process_subcommands_now(F("M420 S1")); - planner.synchronize(); - AudioFeedback(true); - } - break; - - case LEVELING_SETTINGS_ZERO: - if (draw) - Draw_Menu_Item(row, ICON_Mesh, F("Zero Current Mesh")); - else - ZERO(bedlevel.z_values); - break; - - case LEVELING_SETTINGS_UNDEF: - if (draw) - Draw_Menu_Item(row, ICON_Mesh, F("Clear Current Mesh")); - else - bedlevel.invalidate(); - break; - - #endif // AUTO_BED_LEVELING_UBL - } - break; - - case MeshViewer: - #define MESHVIEW_BACK 0 - #define MESHVIEW_TOTAL MESHVIEW_BACK - - if (item == MESHVIEW_BACK) { - if (draw) { - Draw_Menu_Item(0, ICON_Back, GET_TEXT_F(MSG_BACK)); - mesh_conf.Draw_Bed_Mesh(); - mesh_conf.Set_Mesh_Viewer_Status(); - } - else if (!mesh_conf.drawing_mesh) { - Draw_Menu(LevelView, LEVELING_VIEW_MESH); - Update_Status(""); - } - } - break; - - case LevelManual: - - #define LEVELING_M_BACK 0 - #define LEVELING_M_X (LEVELING_M_BACK + 1) - #define LEVELING_M_Y (LEVELING_M_X + 1) - #define LEVELING_M_NEXT (LEVELING_M_Y + 1) - #define LEVELING_M_OFFSET (LEVELING_M_NEXT + 1) - #define LEVELING_M_UP (LEVELING_M_OFFSET + 1) - #define LEVELING_M_DOWN (LEVELING_M_UP + 1) - #define LEVELING_M_GOTO_VALUE (LEVELING_M_DOWN + 1) - #define LEVELING_M_UNDEF (LEVELING_M_GOTO_VALUE + ENABLED(AUTO_BED_LEVELING_UBL)) - #define LEVELING_M_TOTAL LEVELING_M_UNDEF - - switch (item) { - case LEVELING_M_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else { - set_bed_leveling_enabled(level_state); - TERN_(AUTO_BED_LEVELING_BILINEAR, bedlevel.refresh_bed_level()); - Draw_Menu(Leveling, LEVELING_MANUAL); - } - break; - case LEVELING_M_X: - if (draw) { - Draw_Menu_Item(row, ICON_MoveX, GET_TEXT_F(MSG_MESH_X)); - Draw_Float(mesh_conf.mesh_x, row, 0, 1); - } - else - Modify_Value(mesh_conf.mesh_x, 0, GRID_MAX_POINTS_X - 1, 1); - break; - case LEVELING_M_Y: - if (draw) { - Draw_Menu_Item(row, ICON_MoveY, GET_TEXT_F(MSG_MESH_Y)); - Draw_Float(mesh_conf.mesh_y, row, 0, 1); - } - else - Modify_Value(mesh_conf.mesh_y, 0, GRID_MAX_POINTS_Y - 1, 1); - break; - case LEVELING_M_NEXT: - if (draw) - Draw_Menu_Item(row, ICON_More, GET_TEXT_F(MSG_LEVEL_BED_NEXT_POINT)); - else { - if (mesh_conf.mesh_x != (GRID_MAX_POINTS_X - 1) || mesh_conf.mesh_y != (GRID_MAX_POINTS_Y - 1)) { - if ((mesh_conf.mesh_x == (GRID_MAX_POINTS_X - 1) && !(mesh_conf.mesh_y & 1)) || (!mesh_conf.mesh_x && (mesh_conf.mesh_y & 1))) - mesh_conf.mesh_y++; - else if (mesh_conf.mesh_y & 1) - mesh_conf.mesh_x--; - else - mesh_conf.mesh_x++; - mesh_conf.manual_mesh_move(); - } - } - break; - case LEVELING_M_OFFSET: - if (draw) { - Draw_Menu_Item(row, ICON_SetZOffset, F("Point Z Offset")); - Draw_Float(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], row, false, 100); - } - else { - if (isnan(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y])) - bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] = 0; - Modify_Value(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], MIN_Z_OFFSET, MAX_Z_OFFSET, 100); - } - break; - case LEVELING_M_UP: - if (draw) - Draw_Menu_Item(row, ICON_Axis, F("Microstep Up")); - else if (bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] < MAX_Z_OFFSET) { - bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] += 0.01; - gcode.process_subcommands_now(F("M290 Z0.01")); - planner.synchronize(); - current_position.z += 0.01f; - sync_plan_position(); - Draw_Float(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], row - 1, false, 100); - } - break; - case LEVELING_M_DOWN: - if (draw) - Draw_Menu_Item(row, ICON_AxisD, F("Microstep Down")); - else if (bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] > MIN_Z_OFFSET) { - bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] -= 0.01; - gcode.process_subcommands_now(F("M290 Z-0.01")); - planner.synchronize(); - current_position.z -= 0.01f; - sync_plan_position(); - Draw_Float(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], row - 2, false, 100); - } - break; - case LEVELING_M_GOTO_VALUE: - if (draw) { - Draw_Menu_Item(row, ICON_StockConfiguration, F("Go to Mesh Z Value")); - Draw_Checkbox(row, mesh_conf.goto_mesh_value); - } - else { - mesh_conf.goto_mesh_value = !mesh_conf.goto_mesh_value; - current_position.z = 0; - mesh_conf.manual_mesh_move(true); - Draw_Checkbox(row, mesh_conf.goto_mesh_value); - } - break; - #if ENABLED(AUTO_BED_LEVELING_UBL) - case LEVELING_M_UNDEF: - if (draw) - Draw_Menu_Item(row, ICON_ResumeEEPROM, F("Clear Point Value")); - else { - mesh_conf.manual_value_update(true); - Redraw_Menu(false); - } - break; - #endif - } - break; - #endif // HAS_MESH - - #if ENABLED(AUTO_BED_LEVELING_UBL) && !HAS_BED_PROBE - case UBLMesh: - - #define UBL_M_BACK 0 - #define UBL_M_NEXT (UBL_M_BACK + 1) - #define UBL_M_PREV (UBL_M_NEXT + 1) - #define UBL_M_OFFSET (UBL_M_PREV + 1) - #define UBL_M_UP (UBL_M_OFFSET + 1) - #define UBL_M_DOWN (UBL_M_UP + 1) - #define UBL_M_TOTAL UBL_M_DOWN - - switch (item) { - case UBL_M_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else { - set_bed_leveling_enabled(level_state); - Draw_Menu(Leveling, LEVELING_GET_MESH); - } - break; - case UBL_M_NEXT: - if (draw) { - if (mesh_conf.mesh_x != (GRID_MAX_POINTS_X - 1) || mesh_conf.mesh_y != (GRID_MAX_POINTS_Y - 1)) - Draw_Menu_Item(row, ICON_More, GET_TEXT_F(MSG_LEVEL_BED_NEXT_POINT)); - else - Draw_Menu_Item(row, ICON_More, GET_TEXT_F(MSG_UBL_SAVE_MESH)); - } - else { - if (mesh_conf.mesh_x != (GRID_MAX_POINTS_X - 1) || mesh_conf.mesh_y != (GRID_MAX_POINTS_Y - 1)) { - if ((mesh_conf.mesh_x == (GRID_MAX_POINTS_X - 1) && !(mesh_conf.mesh_y & 1)) || (!mesh_conf.mesh_x && (mesh_conf.mesh_y & 1))) - mesh_conf.mesh_y++; - else if (mesh_conf.mesh_y & 1) - mesh_conf.mesh_x--; - else - mesh_conf.mesh_x++; - mesh_conf.manual_mesh_move(); - } - else { - gcode.process_subcommands_now(F("G29 S")); - planner.synchronize(); - AudioFeedback(true); - Draw_Menu(Leveling, LEVELING_GET_MESH); - } - } - break; - case UBL_M_PREV: - if (draw) - Draw_Menu_Item(row, ICON_More, F("Previous Point")); - else { - if (mesh_conf.mesh_x != 0 || mesh_conf.mesh_y != 0) { - if ((mesh_conf.mesh_x == (GRID_MAX_POINTS_X - 1) && (mesh_conf.mesh_y & 1)) || (!mesh_conf.mesh_x && !(mesh_conf.mesh_y & 1))) - mesh_conf.mesh_y--; - else if (mesh_conf.mesh_y & 1) - mesh_conf.mesh_x++; - else - mesh_conf.mesh_x--; - mesh_conf.manual_mesh_move(); - } - } - break; - case UBL_M_OFFSET: - if (draw) { - Draw_Menu_Item(row, ICON_SetZOffset, F("Point Z Offset")); - Draw_Float(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], row, false, 100); - } - else { - if (isnan(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y])) - bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] = 0; - Modify_Value(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], MIN_Z_OFFSET, MAX_Z_OFFSET, 100); - } - break; - case UBL_M_UP: - if (draw) - Draw_Menu_Item(row, ICON_Axis, F("Microstep Up")); - else if (bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] < MAX_Z_OFFSET) { - bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] += 0.01; - gcode.process_subcommands_now(F("M290 Z0.01")); - planner.synchronize(); - current_position.z += 0.01f; - sync_plan_position(); - Draw_Float(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], row - 1, false, 100); - } - break; - case UBL_M_DOWN: - if (draw) - Draw_Menu_Item(row, ICON_Axis, F("Microstep Down")); - else if (bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] > MIN_Z_OFFSET) { - bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] -= 0.01; - gcode.process_subcommands_now(F("M290 Z-0.01")); - planner.synchronize(); - current_position.z -= 0.01f; - sync_plan_position(); - Draw_Float(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], row - 2, false, 100); - } - break; - } - break; - #endif // AUTO_BED_LEVELING_UBL && !HAS_BED_PROBE - - #if ENABLED(PROBE_MANUALLY) - case ManualMesh: - - #define MMESH_BACK 0 - #define MMESH_NEXT (MMESH_BACK + 1) - #define MMESH_OFFSET (MMESH_NEXT + 1) - #define MMESH_UP (MMESH_OFFSET + 1) - #define MMESH_DOWN (MMESH_UP + 1) - #define MMESH_OLD (MMESH_DOWN + 1) - #define MMESH_TOTAL MMESH_OLD - - switch (item) { - case MMESH_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BUTTON_CANCEL)); - else { - gcode.process_subcommands_now(F("G29 A")); - planner.synchronize(); - set_bed_leveling_enabled(level_state); - Draw_Menu(Leveling, LEVELING_GET_MESH); - } - break; - case MMESH_NEXT: - if (draw) { - if (temp_val.gridpoint < GRID_MAX_POINTS) - Draw_Menu_Item(row, ICON_More, GET_TEXT_F(MSG_LEVEL_BED_NEXT_POINT)); - else - Draw_Menu_Item(row, ICON_More, GET_TEXT_F(MSG_UBL_SAVE_MESH)); - } - else if (temp_val.gridpoint < GRID_MAX_POINTS) { - Popup_Handler(MoveWait); - gcode.process_subcommands_now(F("G29")); - planner.synchronize(); - temp_val.gridpoint++; - Redraw_Menu(); - } - else { - gcode.process_subcommands_now(F("G29")); - planner.synchronize(); - AudioFeedback(settings.save()); - Draw_Menu(Leveling, LEVELING_GET_MESH); - } - break; - case MMESH_OFFSET: - if (draw) { - Draw_Menu_Item(row, ICON_SetZOffset, F("Z Position")); - current_position.z = MANUAL_PROBE_START_Z; - Draw_Float(current_position.z, row, false, 100); - } - else - Modify_Value(current_position.z, MIN_Z_OFFSET, MAX_Z_OFFSET, 100); - break; - case MMESH_UP: - if (draw) - Draw_Menu_Item(row, ICON_Axis, F("Microstep Up")); - else if (current_position.z < MAX_Z_OFFSET) { - gcode.process_subcommands_now(F("M290 Z0.01")); - planner.synchronize(); - current_position.z += 0.01f; - sync_plan_position(); - Draw_Float(current_position.z, row - 1, false, 100); - } - break; - case MMESH_DOWN: - if (draw) - Draw_Menu_Item(row, ICON_AxisD, F("Microstep Down")); - else if (current_position.z > MIN_Z_OFFSET) { - gcode.process_subcommands_now(F("M290 Z-0.01")); - planner.synchronize(); - current_position.z -= 0.01f; - sync_plan_position(); - Draw_Float(current_position.z, row - 2, false, 100); - } - break; - case MMESH_OLD: - uint8_t mesh_x, mesh_y; - // 0,0 -> 1,0 -> 2,0 -> 2,1 -> 1,1 -> 0,1 -> 0,2 -> 1,2 -> 2,2 - mesh_y = (temp_val.gridpoint - 1) / (GRID_MAX_POINTS_Y); - mesh_x = (temp_val.gridpoint - 1) % (GRID_MAX_POINTS_X); - - if (mesh_y & 1) - mesh_x = (GRID_MAX_POINTS_X) - mesh_x - 1; - - const float currval = bedlevel.z_values[mesh_x][mesh_y]; - - if (draw) { - Draw_Menu_Item(row, ICON_Zoffset, GET_TEXT_F(MSG_MESH_EDIT_Z)); - Draw_Float(currval, row, false, 100); - } - else if (!isnan(currval)) { - current_position.z = currval; - planner.synchronize(); - planner.buffer_line(current_position, homing_feedrate(Z_AXIS), active_extruder); - planner.synchronize(); - Draw_Float(current_position.z, row - 3, false, 100); - } - break; - } - break; - #endif // PROBE_MANUALLY - - case Tune: - - #define TUNE_BACK 0 - #define TUNE_SPEED (TUNE_BACK + 1) - #define TUNE_FLOW (TUNE_SPEED + ENABLED(HAS_HOTEND)) - #define TUNE_HOTEND (TUNE_FLOW + ENABLED(HAS_HOTEND)) - #define TUNE_BED (TUNE_HOTEND + ENABLED(HAS_HEATED_BED)) - #define TUNE_FAN (TUNE_BED + ENABLED(HAS_FAN)) - #define TUNE_ZOFFSET (TUNE_FAN + ENABLED(HAS_ZOFFSET_ITEM)) - #define TUNE_ZUP (TUNE_ZOFFSET + ENABLED(HAS_ZOFFSET_ITEM)) - #define TUNE_ZDOWN (TUNE_ZUP + ENABLED(HAS_ZOFFSET_ITEM)) - #define TUNE_FWRETRACT (TUNE_ZDOWN + ENABLED(FWRETRACT)) - #define TUNE_HOSTACTIONS (TUNE_FWRETRACT + ENABLED(HAS_HOSTACTION_MENUS)) - #define TUNE_CHANGEFIL (TUNE_HOSTACTIONS + ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)) - #define TUNE_FILSENSORENABLED (TUNE_CHANGEFIL + ENABLED(FILAMENT_RUNOUT_SENSOR)) - #define TUNE_BACKLIGHT_OFF (TUNE_FILSENSORENABLED + 1) - #define TUNE_BACKLIGHT (TUNE_BACKLIGHT_OFF + 1) - #define TUNE_CASELIGHT (TUNE_BACKLIGHT + ENABLED(CASE_LIGHT_MENU)) - #define TUNE_LEDCONTROL (TUNE_CASELIGHT + (ENABLED(LED_CONTROL_MENU) && DISABLED(CASE_LIGHT_USE_NEOPIXEL))) - #define TUNE_LOCKSCREEN (TUNE_LEDCONTROL + ENABLED(HAS_LOCKSCREEN)) - #define TUNE_TOTAL TUNE_LOCKSCREEN - - switch (item) { - case TUNE_BACK: - if (draw) Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BACK)); - else Draw_Print_Screen(); - break; - case TUNE_SPEED: - if (draw) { - Draw_Menu_Item(row, ICON_Speed, GET_TEXT_F(MSG_SPEED)); - Draw_Float(feedrate_percentage, row, false, 1); - } - else - Modify_Value(feedrate_percentage, MIN_PRINT_SPEED, MAX_PRINT_SPEED, 1); - break; - - #if HAS_HOTEND - case TUNE_FLOW: - if (draw) { - Draw_Menu_Item(row, ICON_Speed, GET_TEXT_F(MSG_FLOW)); - Draw_Float(planner.flow_percentage[0], row, false, 1); - } - else - Modify_Value(planner.flow_percentage[0], MIN_FLOW_RATE, MAX_FLOW_RATE, 1); - break; - case TUNE_HOTEND: - if (draw) { - Draw_Menu_Item(row, ICON_SetEndTemp, F("Hotend")); - Draw_Float(thermalManager.temp_hotend[0].target, row, false, 1); - } - else - Modify_Value(thermalManager.temp_hotend[0].target, MIN_E_TEMP, MAX_E_TEMP, 1); - break; - #endif - - #if HAS_HEATED_BED - case TUNE_BED: - if (draw) { - Draw_Menu_Item(row, ICON_SetBedTemp, F("Bed")); - Draw_Float(thermalManager.temp_bed.target, row, false, 1); - } - else - Modify_Value(thermalManager.temp_bed.target, MIN_BED_TEMP, MAX_BED_TEMP, 1); - break; - #endif - - #if HAS_FAN - case TUNE_FAN: - if (draw) { - Draw_Menu_Item(row, ICON_FanSpeed, GET_TEXT_F(MSG_FAN_SPEED)); - Draw_Float(thermalManager.fan_speed[0], row, false, 1); - } - else - Modify_Value(thermalManager.fan_speed[0], MIN_FAN_SPEED, MAX_FAN_SPEED, 1); - break; - #endif - - #if HAS_ZOFFSET_ITEM - case TUNE_ZOFFSET: - if (draw) { - Draw_Menu_Item(row, ICON_FanSpeed, F("Z-Offset")); - Draw_Float(temp_val.zoffsetvalue, row, false, 100); - } - else - Modify_Value(temp_val.zoffsetvalue, MIN_Z_OFFSET, MAX_Z_OFFSET, 100); - break; - case TUNE_ZUP: - if (draw) - Draw_Menu_Item(row, ICON_Axis, F("Z-Offset Up")); - else if (temp_val.zoffsetvalue < MAX_Z_OFFSET) { - gcode.process_subcommands_now(F("M290 Z0.01")); - temp_val.zoffsetvalue += 0.01; - Draw_Float(temp_val.zoffsetvalue, row - 1, false, 100); - } - break; - case TUNE_ZDOWN: - if (draw) - Draw_Menu_Item(row, ICON_AxisD, F("Z-Offset Down")); - else if (temp_val.zoffsetvalue > MIN_Z_OFFSET) { - gcode.process_subcommands_now(F("M290 Z-0.01")); - temp_val.zoffsetvalue -= 0.01; - Draw_Float(temp_val.zoffsetvalue, row - 2, false, 100); - } - break; - #endif - - #if ENABLED(FWRETRACT) - case TUNE_FWRETRACT: - if (draw) - Draw_Menu_Item(row, ICON_StepE, GET_TEXT_F(MSG_AUTORETRACT), nullptr, true); - else { - temp_val.flag_tune = true; - last_pos_selection = selection; - Draw_Menu(FwRetraction); - } - break; - #endif - - #if HAS_HOSTACTION_MENUS - case TUNE_HOSTACTIONS: - if (draw) - Draw_Menu_Item(row, ICON_SetHome, F("Host Actions"), nullptr, true); - else { - temp_val.flag_tune = true; - last_pos_selection = selection; - Draw_Menu(HostActions); - } - break; - #endif - - #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - case TUNE_CHANGEFIL: - if (draw) Draw_Menu_Item(row, ICON_ResumeEEPROM, GET_TEXT_F(MSG_FILAMENTCHANGE)); - else Popup_Handler(ConfFilChange); - break; - #endif - - #if ENABLED(FILAMENT_RUNOUT_SENSOR) - case TUNE_FILSENSORENABLED: - if (draw) { - Draw_Menu_Item(row, ICON_Extruder, GET_TEXT_F(MSG_RUNOUT_SENSOR)); - Draw_Checkbox(row, runout.enabled); - } - else { - runout.enabled = !runout.enabled; - Draw_Checkbox(row, runout.enabled); - } - break; - #endif - - case TUNE_BACKLIGHT_OFF: - if (draw) Draw_Menu_Item(row, ICON_Brightness, GET_TEXT_F(MSG_BRIGHTNESS_OFF)); - else ui.set_brightness(0); - break; - case TUNE_BACKLIGHT: - if (draw) { - Draw_Menu_Item(row, ICON_Brightness, GET_TEXT_F(MSG_BRIGHTNESS)); - Draw_Float(ui.brightness, row, false, 1); - } - else - Modify_Value(ui.brightness, LCD_BRIGHTNESS_MIN, LCD_BRIGHTNESS_MAX, 1, ui.refresh_brightness); - break; - #if ENABLED(CASE_LIGHT_MENU) - case TUNE_CASELIGHT: - if (draw) { - Draw_Menu_Item(row, ICON_CaseLight, GET_TEXT_F(MSG_CASE_LIGHT)); - Draw_Checkbox(row, caselight.on); - } - else { - caselight.on = !caselight.on; - caselight.update_enabled(); - Draw_Checkbox(row, caselight.on); - } - break; - #endif - #if ENABLED(LED_CONTROL_MENU) && DISABLED(CASE_LIGHT_USE_NEOPIXEL) - case TUNE_LEDCONTROL: - if (draw) { - Draw_Menu_Item(row, ICON_LedControl, GET_TEXT_F(MSG_LEDS)); - Draw_Checkbox(row, leds.lights_on); - } - else { - leds.toggle(); - Draw_Checkbox(row, leds.lights_on); - } - break; - #endif - #if HAS_LOCKSCREEN - case TUNE_LOCKSCREEN: - if (draw) Draw_Menu_Item(row, ICON_Lock, GET_TEXT_F(MSG_LOCKSCREEN)); - else DWIN_LockScreen(); - break; - #endif - } - break; - - #if HAS_PREHEAT && HAS_HOTEND - case PreheatHotend: - - #define PREHEATHOTEND_BACK 0 - #define PREHEATHOTEND_CONTINUE (PREHEATHOTEND_BACK + 1) - #define PREHEATHOTEND_1 (PREHEATHOTEND_CONTINUE + (PREHEAT_COUNT >= 1)) - #define PREHEATHOTEND_2 (PREHEATHOTEND_1 + (PREHEAT_COUNT >= 2)) - #define PREHEATHOTEND_3 (PREHEATHOTEND_2 + (PREHEAT_COUNT >= 3)) - #define PREHEATHOTEND_4 (PREHEATHOTEND_3 + (PREHEAT_COUNT >= 4)) - #define PREHEATHOTEND_5 (PREHEATHOTEND_4 + (PREHEAT_COUNT >= 5)) - #define PREHEATHOTEND_CUSTOM (PREHEATHOTEND_5 + 1) - #define PREHEATHOTEND_TOTAL PREHEATHOTEND_CUSTOM - - switch (item) { - case PREHEATHOTEND_BACK: - if (draw) - Draw_Menu_Item(row, ICON_Back, GET_TEXT_F(MSG_BUTTON_CANCEL)); - else { - thermalManager.setTargetHotend(0, 0); - thermalManager.set_fan_speed(0, 0); - Redraw_Menu(false, true, true); - } - break; - case PREHEATHOTEND_CONTINUE: - if (draw) - Draw_Menu_Item(row, ICON_SetEndTemp, GET_TEXT_F(MSG_BUTTON_CONTINUE)); - else { - Popup_Handler(Heating); - thermalManager.wait_for_hotend(0); - switch (last_menu) { - case Prepare: - Popup_Handler(FilChange); - sprintf_P(cmd, PSTR("M600 B1 R%i"), thermalManager.temp_hotend[0].target); - gcode.process_subcommands_now(cmd); - Draw_Menu(Prepare, PREPARE_CHANGEFIL); - break; - #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - case ChangeFilament: - switch (last_selection) { - case CHANGEFIL_LOAD: - Popup_Handler(FilLoad); - Update_Status(GET_TEXT(MSG_FILAMENTLOAD)); - gcode.process_subcommands_now(F("M701")); - planner.synchronize(); - Draw_Menu(ChangeFilament, CHANGEFIL_LOAD); - break; - case CHANGEFIL_UNLOAD: - Popup_Handler(FilLoad, true); - Update_Status(GET_TEXT(MSG_FILAMENTUNLOAD)); - gcode.process_subcommands_now(F("M702")); - planner.synchronize(); - Draw_Menu(ChangeFilament, CHANGEFIL_UNLOAD); - break; - case CHANGEFIL_CHANGE: - Popup_Handler(FilChange); - Update_Status(GET_TEXT(MSG_FILAMENTCHANGE)); - sprintf_P(cmd, PSTR("M600 B1 R%i"), thermalManager.temp_hotend[0].target); - gcode.process_subcommands_now(cmd); - Draw_Menu(ChangeFilament, CHANGEFIL_CHANGE); - break; - } - break; - #endif - default: - Redraw_Menu(true, true, true); - break; - } - } - break; - - #define _PREHEAT_HOTEND_CASE(N) \ - case PREHEATHOTEND_##N: \ - if (draw) Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_## N ##_LABEL)); \ - else ui.preheat_hotend_and_fan((N) - 1); \ - break; - - REPEAT_1(PREHEAT_COUNT, _PREHEAT_HOTEND_CASE) - - case PREHEATHOTEND_CUSTOM: - if (draw) { - Draw_Menu_Item(row, ICON_Temperature, GET_TEXT_F(MSG_PREHEAT_CUSTOM)); - Draw_Float(thermalManager.temp_hotend[0].target, row, false, 1); - } - else - Modify_Value(thermalManager.temp_hotend[0].target, EXTRUDE_MINTEMP, MAX_E_TEMP, 1); - break; - } - break; - - #endif // HAS_PREHEAT && HAS_HOTEND - } -} - -FSTR_P CrealityDWINClass::Get_Menu_Title(uint8_t menu) { - switch (menu) { - case MainMenu: return GET_TEXT_F(MSG_MAIN); - case Prepare: return GET_TEXT_F(MSG_PREPARE); - case HomeMenu: return GET_TEXT_F(MSG_HOMING); - case Move: return GET_TEXT_F(MSG_MOVE_AXIS); - case ManualLevel: return GET_TEXT_F(MSG_BED_TRAMMING_MANUAL); - #if HAS_ZOFFSET_ITEM - case ZOffset: return F("Z Offset"); - #endif - #if HAS_PREHEAT - case Preheat: return F("Preheat"); - #endif - #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - case ChangeFilament: return GET_TEXT_F(MSG_FILAMENTCHANGE); - #endif - #if HAS_HOSTACTION_MENUS - case HostActions: return F("Host Actions"); - #endif - #if HAS_CUSTOM_MENU - case MenuCustom: - #ifdef CUSTOM_MENU_CONFIG_TITLE - return F(CUSTOM_MENU_CONFIG_TITLE); - #else - return F("Custom Commands"); - #endif - #endif - case Control: return GET_TEXT_F(MSG_CONTROL); - case TempMenu: return GET_TEXT_F(MSG_TEMPERATURE); - #if HAS_HOTEND || HAS_HEATED_BED - case PID: return F("PID Menu"); - #endif - #if HAS_HOTEND - case HotendPID: return F("Hotend PID Settings"); - #endif - #if HAS_HEATED_BED - case BedPID: return F("Bed PID Settings"); - #endif - #if HAS_PREHEAT - #define _PREHEAT_TITLE_CASE(N) case Preheat##N: return F(PREHEAT_## N ##_LABEL " Settings"); - REPEAT_1(PREHEAT_COUNT, _PREHEAT_TITLE_CASE) - #endif - case Motion: return F("Motion Settings"); - #if ENABLED(FWRETRACT) - case FwRetraction: return F("Firmware Retract"); - #endif - case HomeOffsets: return GET_TEXT_F(MSG_SET_HOME_OFFSETS); - case MaxSpeed: return GET_TEXT_F(MSG_SPEED); - case MaxAcceleration: return GET_TEXT_F(MSG_ACCELERATION); - #if HAS_CLASSIC_JERK - case MaxJerk: return GET_TEXT_F(MSG_JERK); - #endif - #if HAS_JUNCTION_DEVIATION - case JDmenu: return GET_TEXT_F(MSG_JUNCTION_DEVIATION); - #endif - case Steps: return GET_TEXT_F(MSG_STEPS_PER_MM); - case Visual: return F("Visual Settings"); - #if HAS_HOSTACTION_MENUS - case HostSettings: return F("Host Settings"); - case ActionCommands: return F("Host Actions"); - #endif - case Advanced: return GET_TEXT_F(MSG_ADVANCED_SETTINGS); - #if HAS_BED_PROBE - case ProbeMenu: return GET_TEXT_F(MSG_ZPROBE_SETTINGS); - #endif - case ColorSettings: return F("UI Color Settings"); - case Info: - case InfoMain: return GET_TEXT_F(MSG_INFO_SCREEN); - #if HAS_MESH - case Leveling: return GET_TEXT_F(MSG_BED_LEVELING); - case LevelView: return GET_TEXT_F(MSG_MESH_VIEW); - case LevelSettings: return F("Leveling Settings"); - case MeshViewer: return GET_TEXT_F(MSG_MESH_VIEW); - case LevelManual: return GET_TEXT_F(MSG_UBL_FINE_TUNE_MESH); - #endif - #if ENABLED(AUTO_BED_LEVELING_UBL) && !HAS_BED_PROBE - case UBLMesh: return GET_TEXT_F(MSG_UBL_LEVEL_BED); - #endif - #if ENABLED(PROBE_MANUALLY) - case ManualMesh: return GET_TEXT_F(MSG_MESH_LEVELING); - #endif - case Tune: return GET_TEXT_F(MSG_TUNE); - case PreheatHotend: return F("Preheat Hotend"); - #if ANY(CASE_LIGHT_MENU, LED_CONTROL_MENU) - case Ledsmenu: return F("Light Settings"); - #if ENABLED(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS) - case CaseLightmenu: return GET_TEXT_F(MSG_CASE_LIGHT); - #endif - #if ENABLED(LED_CONTROL_MENU) - case LedControlmenu: return GET_TEXT_F(MSG_LED_CONTROL); - #if HAS_COLOR_LEDS - #if ENABLED(LED_COLOR_PRESETS) - case LedControlpresets: return GET_TEXT_F(MSG_LED_PRESETS); - #else - case LedControlcustom: return GET_TEXT_F(MSG_CUSTOM_LEDS); - #endif - #endif - #endif - #endif - } - return F(""); -} - -uint8_t CrealityDWINClass::Get_Menu_Size(uint8_t menu) { - switch (menu) { - case Prepare: return PREPARE_TOTAL; - case HomeMenu: return HOME_TOTAL; - case Move: return MOVE_TOTAL; - case ManualLevel: return MLEVEL_TOTAL; - #if HAS_ZOFFSET_ITEM - case ZOffset: return ZOFFSET_TOTAL; - #endif - #if HAS_PREHEAT - case Preheat: return PREHEAT_TOTAL; - #endif - #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - case ChangeFilament: return CHANGEFIL_TOTAL; - #endif - #if HAS_HOSTACTION_MENUS - case HostActions: return HOSTACTIONS_TOTAL; - #endif - #if HAS_CUSTOM_MENU - case MenuCustom: return CUSTOM_MENU_TOTAL; - #endif - case Control: return CONTROL_TOTAL; - case TempMenu: return TEMP_TOTAL; - #if HAS_HOTEND || HAS_HEATED_BED - case PID: return PID_TOTAL; - #endif - #if HAS_HOTEND - case HotendPID: return HOTENDPID_TOTAL; - #endif - #if HAS_HEATED_BED - case BedPID: return BEDPID_TOTAL; - #endif - #if HAS_PREHEAT - case Preheat1 ... CAT(Preheat, PREHEAT_COUNT): - return PREHEAT_SUBMENU_TOTAL; - #endif - case Motion: return MOTION_TOTAL; - #if ENABLED(FWRETRACT) - case FwRetraction: return FWR_TOTAL; - #endif - case HomeOffsets: return HOMEOFFSETS_TOTAL; - case MaxSpeed: return SPEED_TOTAL; - case MaxAcceleration: return ACCEL_TOTAL; - #if HAS_CLASSIC_JERK - case MaxJerk: return JERK_TOTAL; - #endif - #if HAS_JUNCTION_DEVIATION - case JDmenu: return JD_TOTAL; - #endif - case Steps: return STEPS_TOTAL; - case Visual: return VISUAL_TOTAL; - #if HAS_HOSTACTION_MENUS - case HostSettings: return HOSTSETTINGS_TOTAL; - case ActionCommands: return ACTIONCOMMANDS_TOTAL; - #endif - case Advanced: return ADVANCED_TOTAL; - #if HAS_BED_PROBE - case ProbeMenu: return PROBE_TOTAL; - #endif - case Info: return INFO_TOTAL; - case InfoMain: return INFO_TOTAL; - #if ENABLED(AUTO_BED_LEVELING_UBL) && !HAS_BED_PROBE - case UBLMesh: return UBL_M_TOTAL; - #endif - #if ENABLED(PROBE_MANUALLY) - case ManualMesh: return MMESH_TOTAL; - #endif - #if HAS_MESH - case Leveling: return LEVELING_TOTAL; - case LevelView: return LEVELING_VIEW_TOTAL; - case LevelSettings: return LEVELING_SETTINGS_TOTAL; - case MeshViewer: return MESHVIEW_TOTAL; - case LevelManual: return LEVELING_M_TOTAL; - #endif - case Tune: return TUNE_TOTAL; - - #if HAS_PREHEAT && HAS_HOTEND - case PreheatHotend: return PREHEATHOTEND_TOTAL; - #endif - - case ColorSettings: return COLORSETTINGS_TOTAL; - #if ANY(CASE_LIGHT_MENU, LED_CONTROL_MENU) - case Ledsmenu: return LEDS_TOTAL; - #if ENABLED(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS) - case CaseLightmenu: return CASE_LIGHT_TOTAL; - #endif - #if ENABLED(LED_CONTROL_MENU) - case LedControlmenu: return LEDCONTROL_TOTAL; - #if HAS_COLOR_LEDS - #if ENABLED(LED_COLOR_PRESETS) - case LedControlpresets: return LEDCONTROL_PRESETS_TOTAL; - #else - case LedControlcustom: return LEDCONTROL_CUSTOM_TOTAL; - #endif - #endif - #endif - #endif - } - return 0; -} - -/* Popup Config */ - -void CrealityDWINClass::Popup_Handler(PopupID popupid, bool option/*=false*/) { - popup = last_popup = popupid; - switch (popupid) { - case Pause: Draw_Popup(GET_TEXT_F(MSG_PAUSE_PRINT), F(""), F(""), Popup); break; - case Stop: Draw_Popup(GET_TEXT_F(MSG_STOP_PRINT), F(""), F(""), Popup); break; - case Resume: Draw_Popup(GET_TEXT_F(MSG_RESUME_PRINT), F("Looks Like the last"), F("print was interrupted."), Popup); break; - case ConfFilChange: Draw_Popup(F("Confirm Filament Change"), F(""), F(""), Popup); break; - case PurgeMore: Draw_Popup(F("Purge more filament?"), F("(Cancel to finish process)"), F(""), Popup); break; - case SaveLevel: Draw_Popup(F("Leveling Complete"), F("Save to EEPROM?"), F(""), Popup); break; - case MeshSlot: Draw_Popup(F("Mesh slot not selected"), F("(Confirm to select slot 0)"), F(""), Popup); break; - case ETemp: Draw_Popup(GET_TEXT_F(MSG_HOTEND_TOO_COLD), GET_TEXT_F(MSG_PLEASE_PREHEAT), F(""), Popup); break; - case ManualProbing: Draw_Popup(F("Manual Probing"), F("(Confirm to probe)"), F("(cancel to exit)"), Popup); break; - case Level: Draw_Popup(F("Auto Bed Leveling"), GET_TEXT_F(MSG_PLEASE_WAIT), F(""), Wait, ICON_AutoLeveling); break; - case Home: Draw_Popup(option ? GET_TEXT_F(MSG_PAUSE_PRINT_PARKING) : GET_TEXT_F(MSG_HOMING), GET_TEXT_F(MSG_PLEASE_WAIT), F(""), Wait, ICON_BLTouch); break; - case MoveWait: Draw_Popup(GET_TEXT_F(MSG_MOVING), GET_TEXT_F(MSG_PLEASE_WAIT), F(""), Wait, ICON_BLTouch); break; - case Heating: Draw_Popup(GET_TEXT_F(MSG_HEATING), GET_TEXT_F(MSG_PLEASE_WAIT), F(""), Wait, ICON_BLTouch); break; - case FilLoad: Draw_Popup(option ? F("Unloading Filament") : F("Loading Filament"), GET_TEXT_F(MSG_PLEASE_WAIT), F(""), Wait, ICON_BLTouch); break; - case FilChange: Draw_Popup(F("Filament Change"), F("Please wait for prompt."), F(""), Wait, ICON_BLTouch); break; - case TempWarn: Draw_Popup(option ? GET_TEXT_F(MSG_HOTEND_TOO_COLD) : F("Nozzle temp too high!"), F(""), F(""), Wait, option ? ICON_TempTooLow : ICON_TempTooHigh); break; - case Runout: Draw_Popup(F("Filament Runout"), F(""), F(""), Wait, ICON_BLTouch); break; - #if !HAS_PIDPLOT - case PIDWait: Draw_Popup(F("PID Autotune"), F("in process"), GET_TEXT_F(MSG_PLEASE_WAIT), Wait, ICON_BLTouch); break; - #endif - case Resuming: Draw_Popup(F("Resuming Print"), GET_TEXT_F(MSG_PLEASE_WAIT), F(""), Wait, ICON_BLTouch); break; - #if HAS_CUSTOM_MENU - case Custom: Draw_Popup(F("Running Custom GCode"), GET_TEXT_F(MSG_PLEASE_WAIT), F(""), Wait, ICON_BLTouch); break; - #endif - case PrintConfirm: Draw_Popup(option ? F("") : F("Print file?"), F(""), F(""), Popup); break; - default: break; - } -} - -void CrealityDWINClass::Confirm_Handler(PopupID popupid, bool option/*=false*/) { - popup = popupid; - switch (popupid) { - case FilInsert: Draw_Popup(F("Insert Filament"), F("Press to Continue"), F(""), Confirm); break; - case HeaterTime: Draw_Popup(GET_TEXT_F(MSG_HEATER_TIMEOUT), GET_TEXT_F(MSG_FILAMENT_CHANGE_HEAT), F(""), Confirm); break; - case UserInput: Draw_Popup(option ? GET_TEXT_F(MSG_STOPPED) : F("Waiting for Input"), GET_TEXT_F(MSG_ADVANCED_PAUSE_WAITING), F(""), Confirm); break; - case Level: Draw_Popup(F("Bed Leveling"), GET_TEXT_F(MSG_PLEASE_WAIT), F(""), Cancel, ICON_AutoLeveling); break; - case LevelError: Draw_Popup(F("Couldn't enable Leveling"), F("(Valid mesh must exist)"), F(""), Confirm); break; - case InvalidMesh: Draw_Popup(F("Valid mesh must exist"), F("before tuning can be"), F("performed"), Confirm); break; - default: break; - } -} - -/* Navigation and Control */ - -void CrealityDWINClass::Main_Menu_Control() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); - if (encoder_diffState == ENCODER_DIFF_NO) return; - if (encoder_diffState == ENCODER_DIFF_CW && selection < PAGE_COUNT - 1) { - selection++; // Select Down - Main_Menu_Icons(); - } - else if (encoder_diffState == ENCODER_DIFF_CCW && selection > 0) { - selection--; // Select Up - Main_Menu_Icons(); - } - else if (encoder_diffState == ENCODER_DIFF_ENTER) - switch (selection) { - case PAGE_PRINT: card.mount(); Draw_SD_List(); break; - case PAGE_PREPARE: Draw_Menu(Prepare); break; - case PAGE_CONTROL: Draw_Menu(Control); break; - case PAGE_INFO_LEVELING: Draw_Menu(TERN(HAS_MESH, Leveling, InfoMain)); break; - } - DWIN_UpdateLCD(); -} - -void CrealityDWINClass::Menu_Control() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); - if (encoder_diffState == ENCODER_DIFF_NO) return; - if (encoder_diffState == ENCODER_DIFF_CW && selection < Get_Menu_Size(active_menu)) { - DWIN_Draw_Rectangle(1, Def_Background_Color, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); - selection++; // Select Down - if (selection > scrollpos+MROWS) { - scrollpos++; - DWIN_Frame_AreaMove(1, 2, MLINE, Def_Background_Color, 0, 31, DWIN_WIDTH, 349); - Menu_Item_Handler(active_menu, selection); - } - DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.cursor_color, Def_Cursor_color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); - } - else if (encoder_diffState == ENCODER_DIFF_CCW && selection > 0) { - DWIN_Draw_Rectangle(1, Def_Background_Color, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); - selection--; // Select Up - if (selection < scrollpos) { - scrollpos--; - DWIN_Frame_AreaMove(1, 3, MLINE, Def_Background_Color, 0, 31, DWIN_WIDTH, 349); - Menu_Item_Handler(active_menu, selection); - } - DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.cursor_color, Def_Cursor_color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); - } - else if (encoder_diffState == ENCODER_DIFF_ENTER) - Menu_Item_Handler(active_menu, selection, false); - DWIN_UpdateLCD(); -} - -void CrealityDWINClass::Value_Control() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); - float difvalue = 0; - if (encoder_diffState == ENCODER_DIFF_NO) return; - if (encoder_diffState == ENCODER_DIFF_CW) { - tempvalue += EncoderRate.encoderMoveValue; - difvalue = EncoderRate.encoderMoveValue; - } - else if (encoder_diffState == ENCODER_DIFF_CCW) { - tempvalue -= EncoderRate.encoderMoveValue; - difvalue = - EncoderRate.encoderMoveValue; - } - else if (encoder_diffState == ENCODER_DIFF_ENTER) { - process = Menu; - EncoderRate.enabled = false; - Draw_Float(tempvalue / valueunit, selection - scrollpos, false, valueunit); - DWIN_UpdateLCD(); - if (active_menu == ZOffset && temp_val.zoffsetmode != 0) { - planner.synchronize(); - if (temp_val.zoffsetmode == 1) { - current_position.z += (tempvalue / valueunit - temp_val.zoffsetvalue); - planner.buffer_line(current_position, homing_feedrate(Z_AXIS), active_extruder); - } - current_position.z = 0; - sync_plan_position(); - } - else if (active_menu == Tune && selection == TUNE_ZOFFSET) { - sprintf_P(cmd, PSTR("M290 Z%s"), dtostrf((tempvalue / valueunit - temp_val.zoffsetvalue), 1, 3, str_1)); - gcode.process_subcommands_now(cmd); - } - if (TERN0(HAS_HOTEND, valuepointer == &thermalManager.temp_hotend[0].pid.Ki) || TERN0(HAS_HEATED_BED, valuepointer == &thermalManager.temp_bed.pid.Ki)) - tempvalue = scalePID_i(tempvalue); - if (TERN0(HAS_HOTEND, valuepointer == &thermalManager.temp_hotend[0].pid.Kd) || TERN0(HAS_HEATED_BED, valuepointer == &thermalManager.temp_bed.pid.Kd)) - tempvalue = scalePID_d(tempvalue); - switch (valuetype) { - case 0: *(float*)valuepointer = tempvalue / valueunit; break; - case 1: *(uint8_t*)valuepointer = tempvalue / valueunit; break; - case 2: *(uint16_t*)valuepointer = tempvalue / valueunit; break; - case 3: *(int16_t*)valuepointer = tempvalue / valueunit; break; - case 4: *(uint32_t*)valuepointer = tempvalue / valueunit; break; - case 5: *(int8_t*)valuepointer = tempvalue / valueunit; break; - } - switch (active_menu) { - case Move: - planner.synchronize(); - planner.buffer_line(current_position, manual_feedrate_mm_s[selection - 1], active_extruder); - break; - #if HAS_MESH - #if ENABLED(PROBE_MANUALLY) - case ManualMesh: - planner.synchronize(); - planner.buffer_line(current_position, homing_feedrate(Z_AXIS), active_extruder); - planner.synchronize(); - break; - #endif - #if ENABLED(AUTO_BED_LEVELING_UBL) && !HAS_BED_PROBE - case UBLMesh: mesh_conf.manual_mesh_move(true); break; - #endif - case LevelManual: mesh_conf.manual_mesh_move(selection == LEVELING_M_OFFSET); break; - #endif - } - if (valuepointer == &planner.flow_percentage[0]) - planner.refresh_e_factor(0); - #if ENABLED(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS) - if (valuepointer == &caselight.brightness) - caselight.update_brightness(); - #endif - #if HAS_COLOR_LEDS - if ((valuepointer == &leds.color.r) || (valuepointer == &leds.color.g) || (valuepointer == &leds.color.b)) - ApplyLEDColor(); - #if HAS_WHITE_LED - if (valuepointer == &leds.color.w) ApplyLEDColor(); - #endif - #endif - - if (funcpointer) funcpointer(); - return; - } - NOLESS(tempvalue, (valuemin * valueunit)); - NOMORE(tempvalue, (valuemax * valueunit)); - Draw_Float(tempvalue / valueunit, selection - scrollpos, true, valueunit); - DWIN_UpdateLCD(); - - if (valuepointer == &ui.brightness) { - *(uint8_t*)valuepointer = tempvalue / valueunit; - ui.refresh_brightness(); - } - - switch (active_menu) { - case Move: - if (temp_val.livemove) { - *(float*)valuepointer = tempvalue / valueunit; - planner.buffer_line(current_position, manual_feedrate_mm_s[selection - 1], active_extruder); - } - break; - case ZOffset: - if (temp_val.zoffsetmode == 2) { - planner.synchronize(); - sprintf_P(cmd, PSTR("M290 Z%s"), dtostrf((difvalue / valueunit), 1, 3, str_1)); - gcode.process_subcommands_now(cmd); - planner.synchronize(); - } - break; - case Tune: - if (selection == TUNE_ZOFFSET) { - planner.synchronize(); - sprintf_P(cmd, PSTR("M290 Z%s"), dtostrf((difvalue / valueunit), 1, 3, str_1)); - gcode.process_subcommands_now(cmd); - planner.synchronize(); - } - break; - #if ENABLED(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS) - case CaseLightmenu: - *(uint8_t*)valuepointer = tempvalue / valueunit; - caselight.update_brightness(); - break; - #endif - #if ENABLED(LED_CONTROL_MENU, HAS_COLOR_LEDS) - case LedControlmenu: - *(uint8_t*)valuepointer = tempvalue / valueunit; - leds.update(); - break; - #endif - default : break; - } -} - -void CrealityDWINClass::Option_Control() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); - if (encoder_diffState == ENCODER_DIFF_NO) return; - if (encoder_diffState == ENCODER_DIFF_CW) - tempvalue += EncoderRate.encoderMoveValue; - else if (encoder_diffState == ENCODER_DIFF_CCW) - tempvalue -= EncoderRate.encoderMoveValue; - else if (encoder_diffState == ENCODER_DIFF_ENTER) { - process = Menu; - EncoderRate.enabled = false; - if (valuepointer == &color_names) { - switch (selection) { - case COLORSETTINGS_CURSOR: eeprom_settings.cursor_color = tempvalue; break; - case COLORSETTINGS_SPLIT_LINE: eeprom_settings.menu_split_line = tempvalue; break; - case COLORSETTINGS_MENU_TOP_BG: eeprom_settings.menu_top_bg = tempvalue; break; - case COLORSETTINGS_MENU_TOP_TXT: eeprom_settings.menu_top_txt = tempvalue; break; - case COLORSETTINGS_HIGHLIGHT_BORDER: eeprom_settings.highlight_box = tempvalue; break; - case COLORSETTINGS_PROGRESS_PERCENT: eeprom_settings.progress_percent = tempvalue; break; - case COLORSETTINGS_PROGRESS_TIME: eeprom_settings.progress_time = tempvalue; break; - case COLORSETTINGS_PROGRESS_STATUS_BAR: eeprom_settings.status_bar_text = tempvalue; break; - case COLORSETTINGS_PROGRESS_STATUS_AREA: eeprom_settings.status_area_text = tempvalue; break; - case COLORSETTINGS_PROGRESS_COORDINATES: eeprom_settings.coordinates_text = tempvalue; break; - case COLORSETTINGS_PROGRESS_COORDINATES_LINE: eeprom_settings.coordinates_split_line = tempvalue; break; - } - Redraw_Screen(); - } - else if (valuepointer == &preheat_modes) - temp_val.preheatmode = tempvalue; - #if ENABLED(PREHEAT_BEFORE_LEVELING) - else if (valuepointer == &preheat_levmodes) { - temp_val.LevelingTempmode = tempvalue; - eeprom_settings.ena_hotend_levtemp = false; - eeprom_settings.ena_bed_levtemp = false; - if (temp_val.LevelingTempmode == 0 || temp_val.LevelingTempmode == 1) eeprom_settings.ena_hotend_levtemp = true; - if (temp_val.LevelingTempmode == 0 || temp_val.LevelingTempmode == 2) eeprom_settings.ena_bed_levtemp = true; - } - #endif - else if (valuepointer == &zoffset_modes) { - temp_val.zoffsetmode = tempvalue; - if (temp_val.zoffsetmode == 1 || temp_val.zoffsetmode == 2) { - if (axes_should_home()) { - Popup_Handler(Home); - gcode.home_all_axes(true); - } - Popup_Handler(MoveWait); - #if ENABLED(Z_SAFE_HOMING) - planner.synchronize(); - sprintf_P(cmd, PSTR("G0 F4000 X%s Y%s"), dtostrf(Z_SAFE_HOMING_X_POINT, 1, 3, str_1), dtostrf(Z_SAFE_HOMING_Y_POINT, 1, 3, str_2)); - gcode.process_subcommands_now(cmd); - #else - sprintf_P(cmd, PSTR("G0 F4000 X%s Y%s"), dtostrf((X_BED_SIZE + X_MIN_POS) / 2.0f, 1, 3, str_1), dtostrf((Y_BED_SIZE + Y_MIN_POS) / 2.0f, 1, 3, str_2)); - gcode.process_subcommands_now(cmd); - #endif - gcode.process_subcommands_now(F("G0 F300 Z0")); - planner.synchronize(); - Redraw_Menu(); - } - } - - Draw_Option(tempvalue, static_cast(valuepointer), selection - scrollpos, false, (valuepointer == &color_names)); - DWIN_UpdateLCD(); - return; - } - NOLESS(tempvalue, valuemin); - NOMORE(tempvalue, valuemax); - Draw_Option(tempvalue, static_cast(valuepointer), selection - scrollpos, true); - DWIN_UpdateLCD(); -} - -void CrealityDWINClass::File_Control() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); - static uint8_t filescrl = 0; - if (encoder_diffState == ENCODER_DIFF_NO) { - if (selection > 0) { - card.getfilename_sorted(SD_ORDER(selection - 1, card.get_num_Files())); - char * const filename = card.longest_filename(); - size_t len = strlen(filename); - int8_t pos = len; - if (!card.flag.filenameIsDir) - while (pos && filename[pos] != '.') pos--; - if (pos > MENU_CHAR_LIMIT) { - static millis_t time = 0; - if (PENDING(millis(), time)) return; - time = millis() + 200; - pos -= filescrl; - len = _MIN(pos, MENU_CHAR_LIMIT); - char name[len + 1]; - if (pos >= 0) { - LOOP_L_N(i, len) name[i] = filename[i + filescrl]; - } - else { - LOOP_L_N(i, MENU_CHAR_LIMIT + pos) name[i] = ' '; - LOOP_S_L_N(i, MENU_CHAR_LIMIT + pos, MENU_CHAR_LIMIT) name[i] = filename[i - (MENU_CHAR_LIMIT + pos)]; - } - name[len] = '\0'; - DWIN_Draw_Rectangle(1, Def_Background_Color, LBLX, MBASE(selection - scrollpos) - 14, 271, MBASE(selection - scrollpos) + 28); - Draw_Menu_Item(selection - scrollpos, card.flag.filenameIsDir ? ICON_More : ICON_File, name); - if (-pos >= MENU_CHAR_LIMIT) filescrl = 0; - filescrl++; - DWIN_UpdateLCD(); - } - } - return; - } - if (encoder_diffState == ENCODER_DIFF_CW && selection < card.get_num_Files()) { - DWIN_Draw_Rectangle(1, Def_Background_Color, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); - if (selection > 0) { - DWIN_Draw_Rectangle(1, Def_Background_Color, LBLX, MBASE(selection - scrollpos) - 14, 271, MBASE(selection - scrollpos) + 28); - Draw_SD_Item(selection, selection - scrollpos); - } - filescrl = 0; - selection++; // Select Down - if (selection > scrollpos + MROWS) { - scrollpos++; - DWIN_Frame_AreaMove(1, 2, MLINE, Def_Background_Color, 0, 31, DWIN_WIDTH, 349); - Draw_SD_Item(selection, selection - scrollpos); - } - DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.cursor_color, Def_Cursor_color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); - } - else if (encoder_diffState == ENCODER_DIFF_CCW && selection > 0) { - DWIN_Draw_Rectangle(1, Def_Background_Color, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); - DWIN_Draw_Rectangle(1, Def_Background_Color, LBLX, MBASE(selection - scrollpos) - 14, 271, MBASE(selection - scrollpos) + 28); - Draw_SD_Item(selection, selection - scrollpos); - filescrl = 0; - selection--; // Select Up - if (selection < scrollpos) { - scrollpos--; - DWIN_Frame_AreaMove(1, 3, MLINE, Def_Background_Color, 0, 31, DWIN_WIDTH, 349); - Draw_SD_Item(selection, selection - scrollpos); - } - DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.cursor_color, Def_Cursor_color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); - } - else if (encoder_diffState == ENCODER_DIFF_ENTER) { - if (selection == 0) { - if (card.flag.workDirIsRoot) { - process = Main; - Draw_Main_Menu(); - } - else { - card.cdup(); - Draw_SD_List(); - } - } - else { - card.getfilename_sorted(SD_ORDER(selection - 1, card.get_num_Files())); - if (card.flag.filenameIsDir) { - card.cd(card.filename); - Draw_SD_List(); - } - else { - #if HAS_GCODE_PREVIEW - Preview_DrawFromSD(); - #else - card.openAndPrintFile(card.filename); - #endif - } - } - } - DWIN_UpdateLCD(); -} - -void CrealityDWINClass::Print_Screen_Control() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); - if (encoder_diffState == ENCODER_DIFF_NO) return; - if (encoder_diffState == ENCODER_DIFF_CW && selection < PRINT_COUNT - 1) { - selection++; // Select Down - Print_Screen_Icons(); - } - else if (encoder_diffState == ENCODER_DIFF_CCW && selection > 0) { - selection--; // Select Up - Print_Screen_Icons(); - } - else if (encoder_diffState == ENCODER_DIFF_ENTER) { - switch (selection) { - case PRINT_SETUP: - Draw_Menu(Tune); - Update_Status_Bar(true); - break; - case PRINT_PAUSE_RESUME: - if (temp_val.paused) { - if (temp_val.sdprint) { - wait_for_user = false; - #if ENABLED(PARK_HEAD_ON_PAUSE) - card.startOrResumeFilePrinting(); - TERN_(POWER_LOSS_RECOVERY, recovery.prepare()); - #else - char cmd[20]; - #if HAS_HEATED_BED - sprintf_P(cmd, PSTR("M140 S%i"), temp_val.pausebed); - gcode.process_subcommands_now(cmd); - #endif - #if HAS_EXTRUDERS - sprintf_P(cmd, PSTR("M109 S%i"), temp_val.pausetemp); - gcode.process_subcommands_now(cmd); - #endif - TERN_(HAS_FAN, thermalManager.fan_speed[0] = temp_val.pausefan); - planner.synchronize(); - TERN_(SDSUPPORT, queue.inject(F("M24"))); - #endif - } - else { - TERN_(HOST_ACTION_COMMANDS, hostui.resume()); - } - Draw_Print_Screen(); - } - else - Popup_Handler(Pause); - break; - case PRINT_STOP: Popup_Handler(Stop); break; - } - } - DWIN_UpdateLCD(); -} - -void CrealityDWINClass::Popup_Control() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); - if (encoder_diffState == ENCODER_DIFF_NO) return; - if (encoder_diffState == ENCODER_DIFF_CW && selection < 1) { - selection++; - Popup_Select(); - } - else if (encoder_diffState == ENCODER_DIFF_CCW && selection > 0) { - selection--; - Popup_Select(); - } - else if (encoder_diffState == ENCODER_DIFF_ENTER) { - switch (popup) { - case Pause: - if (selection == 0) { - if (temp_val.sdprint) { - #if ENABLED(POWER_LOSS_RECOVERY) - if (recovery.enabled) recovery.save(true); - #endif - #if ENABLED(PARK_HEAD_ON_PAUSE) - Popup_Handler(Home, true); - #if ENABLED(SDSUPPORT) - if (IS_SD_PRINTING()) card.pauseSDPrint(); - #endif - planner.synchronize(); - queue.inject(F("M125")); - planner.synchronize(); - #else - queue.inject(F("M25")); - TERN_(HAS_HOTEND, temp_val.pausetemp = thermalManager.temp_hotend[0].target); - TERN_(HAS_HEATED_BED, temp_val.pausebed = thermalManager.temp_bed.target); - TERN_(HAS_FAN, temp_val.pausefan = thermalManager.fan_speed[0]); - thermalManager.cooldown(); - #endif - } - else { - TERN_(HOST_ACTION_COMMANDS, hostui.pause()); - } - } - Draw_Print_Screen(); - break; - case Stop: - if (selection == 0) { - if (temp_val.sdprint) { - ui.abort_print(); - thermalManager.cooldown(); - } - else { - TERN_(HOST_ACTION_COMMANDS, hostui.cancel()); - } - } - else - Draw_Print_Screen(); - break; - case Resume: - if (selection == 0) - queue.inject(F("M1000")); - else { - queue.inject(F("M1000 C")); - Draw_Main_Menu(); - } - break; - - #if HAS_HOTEND - case ETemp: - if (selection == 0) { - thermalManager.setTargetHotend(EXTRUDE_MINTEMP, 0); - thermalManager.set_fan_speed(0, MAX_FAN_SPEED); - Draw_Menu(PreheatHotend); - } - else - Redraw_Menu(true, true, false); - break; - #endif - - #if HAS_BED_PROBE - case ManualProbing: - if (selection == 0) { - char buf[80]; - const float dif = probe.probe_at_point(current_position.x, current_position.y, PROBE_PT_STOW, 0, false) - temp_val.corner_avg; - sprintf_P(buf, dif > 0 ? PSTR("Corner is %smm high") : PSTR("Corner is %smm low"), dtostrf(abs(dif), 1, 3, str_1)); - Update_Status(buf); - } - else { - Redraw_Menu(true, true, false); - Update_Status(""); - } - break; - #endif - - #if ENABLED(ADVANCED_PAUSE_FEATURE) - case ConfFilChange: - if (selection == 0) { - if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) - Popup_Handler(ETemp); - else { - if (thermalManager.temp_hotend[0].is_below_target(-2)) { - Popup_Handler(Heating); - thermalManager.wait_for_hotend(0); - } - Popup_Handler(FilChange); - sprintf_P(cmd, PSTR("M600 B1 R%i"), thermalManager.temp_hotend[0].target); - gcode.process_subcommands_now(cmd); - } - } - else - Redraw_Menu(true, true, false); - break; - case PurgeMore: - if (selection == 0) { - pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE; - Popup_Handler(FilChange); - } - else { - pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT; - if (temp_val.printing) Popup_Handler(Resuming); - else Redraw_Menu(true, true, (active_menu==PreheatHotend)); - } - break; - #endif // ADVANCED_PAUSE_FEATURE - - case PrintConfirm: - if (selection==0) { - card.openAndPrintFile(card.filename);} - else{ - Redraw_Menu(true, true, true); - gcode.process_subcommands_now(F("M117"));} - break; - - #if HAS_MESH - case SaveLevel: - if (selection == 0) { - #if ENABLED(AUTO_BED_LEVELING_UBL) - gcode.process_subcommands_now(F("G29 S")); - planner.synchronize(); - AudioFeedback(true); - #else - AudioFeedback(settings.save()); - #endif - } - Draw_Menu(Leveling, LEVELING_GET_MESH); - break; - #endif - - #if ENABLED(AUTO_BED_LEVELING_UBL) - case MeshSlot: - if (selection == 0) bedlevel.storage_slot = 0; - Redraw_Menu(true, true); - break; - #endif - default: break; - } - } - DWIN_UpdateLCD(); -} - -void CrealityDWINClass::Confirm_Control() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); - if (encoder_diffState == ENCODER_DIFF_NO) return; - if (encoder_diffState == ENCODER_DIFF_ENTER) { - switch (popup) { - case Complete: - Draw_Main_Menu(); - break; - case FilInsert: - Popup_Handler(FilChange); - wait_for_user = false; - break; - case HeaterTime: - Popup_Handler(Heating); - Update_Status(GET_TEXT_F(MSG_HEATING)); - wait_for_user = false; - break; - #if HAS_ESDIAG - case ESDiagPopup: - wait_for_user = false; - Redraw_Menu(true, true, false); - break; - #endif - default: - Redraw_Menu(true, true, false); - wait_for_user = false; - break; - } - } - DWIN_UpdateLCD(); -} - -#if HAS_HOSTACTION_MENUS - - void CrealityDWINClass::Keyboard_Control() { - const uint8_t keyboard_size = 34; - static uint8_t key_selection = 0, cursor = 0; - static char string[31]; - static bool uppercase = false, locked = false; - if (reset_keyboard) { - if (strcmp(stringpointer, "-") == 0) stringpointer[0] = '\0'; - key_selection = 0, cursor = strlen(stringpointer); - uppercase = false, locked = false; - reset_keyboard = false; - strcpy(string, stringpointer); - } - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); - if (encoder_diffState == ENCODER_DIFF_NO) return; - if (encoder_diffState == ENCODER_DIFF_CW && key_selection < keyboard_size) { - Draw_Keys(key_selection, false, uppercase, locked); - key_selection++; - Draw_Keys(key_selection, true, uppercase, locked); - } - else if (encoder_diffState == ENCODER_DIFF_CCW && key_selection > 0) { - Draw_Keys(key_selection, false, uppercase, locked); - key_selection--; - Draw_Keys(key_selection, true, uppercase, locked); - } - else if (encoder_diffState == ENCODER_DIFF_ENTER) { - if (key_selection < 28) { - if (key_selection == 19) { - if (!numeric_keyboard) { - if (locked) { - uppercase = false, locked = false; - Draw_Keyboard(keyboard_restrict, false, key_selection, uppercase, locked); - } else if (uppercase) { - locked = true; - Draw_Keyboard(keyboard_restrict, false, key_selection, uppercase, locked); - } - else { - uppercase = true; - Draw_Keyboard(keyboard_restrict, false, key_selection, uppercase, locked); - } - } - } - else if (key_selection == 27) { - cursor--; - string[cursor] = '\0'; - } - else { - uint8_t index = key_selection; - if (index > 19) index--; - if (index > 27) index--; - const char *keys; - if (numeric_keyboard) keys = "1234567890&<>() {}[]*\"\':;!?"; - else keys = (uppercase) ? "QWERTYUIOPASDFGHJKLZXCVBNM" : "qwertyuiopasdfghjklzxcvbnm"; - if (!(keyboard_restrict && numeric_keyboard && index > 9)) { - string[cursor] = keys[index]; - cursor++; - string[cursor] = '\0'; - } - if (!locked && uppercase) { - uppercase = false; - Draw_Keyboard(keyboard_restrict, false, key_selection, uppercase, locked); - } - } - } - else { - switch (key_selection) { - case 28: - if (!numeric_keyboard) uppercase = false, locked = false; - Draw_Keyboard(keyboard_restrict, !numeric_keyboard, key_selection, uppercase, locked); - break; - case 29: - string[cursor] = '-'; - cursor++; - string[cursor] = '\0'; - break; - case 30: - string[cursor] = '_'; - cursor++; - string[cursor] = '\0'; - break; - case 31: - if (!keyboard_restrict) { - string[cursor] = ' '; - cursor++; - string[cursor] = '\0'; - } - break; - case 32: - if (!keyboard_restrict) { - string[cursor] = '.'; - cursor++; - string[cursor] = '\0'; - } - break; - case 33: - if (!keyboard_restrict) { - string[cursor] = '/'; - cursor++; - string[cursor] = '\0'; - } - break; - case 34: - if (string[0] == '\0') strcpy(string, "-"); - strcpy(stringpointer, string); - process = Menu; - DWIN_Draw_Rectangle(1, Def_Background_Color, 0, KEY_Y_START, DWIN_WIDTH-2, DWIN_HEIGHT-2); - Draw_Status_Area(true); - Update_Status_Bar(true); - break; - } - } - if (strlen(string) > maxstringlen) string[maxstringlen] = '\0', cursor = maxstringlen; - Draw_String(string, selection, (process==Keyboard), (maxstringlen > 10)); - } - DWIN_UpdateLCD(); - } - -#endif // HAS_HOSTACTION_MENUS - -/* In-Menu Value Modification */ - -void CrealityDWINClass::Setup_Value(float value, float min, float max, float unit, uint8_t type) { - if (TERN0(HAS_HOTEND, valuepointer == &thermalManager.temp_hotend[0].pid.Ki) || TERN0(HAS_HEATED_BED, valuepointer == &thermalManager.temp_bed.pid.Ki)) - tempvalue = unscalePID_i(value) * unit; - else if (TERN0(HAS_HOTEND, valuepointer == &thermalManager.temp_hotend[0].pid.Kd) || TERN0(HAS_HEATED_BED, valuepointer == &thermalManager.temp_bed.pid.Kd)) - tempvalue = unscalePID_d(value) * unit; - else - tempvalue = value * unit; - valuemin = min; - valuemax = max; - valueunit = unit; - valuetype = type; - process = Value; - EncoderRate.enabled = true; - Draw_Float(tempvalue / unit, selection - scrollpos, true, valueunit); -} - -void CrealityDWINClass::Modify_Value(float &value, float min, float max, float unit, void (*f)()/*=nullptr*/) { - valuepointer = &value; - funcpointer = f; - Setup_Value((float)value, min, max, unit, 0); -} -void CrealityDWINClass::Modify_Value(uint8_t &value, float min, float max, float unit, void (*f)()/*=nullptr*/) { - valuepointer = &value; - funcpointer = f; - Setup_Value((float)value, min, max, unit, 1); -} -void CrealityDWINClass::Modify_Value(uint16_t &value, float min, float max, float unit, void (*f)()/*=nullptr*/) { - valuepointer = &value; - funcpointer = f; - Setup_Value((float)value, min, max, unit, 2); -} -void CrealityDWINClass::Modify_Value(int16_t &value, float min, float max, float unit, void (*f)()/*=nullptr*/) { - valuepointer = &value; - funcpointer = f; - Setup_Value((float)value, min, max, unit, 3); -} -void CrealityDWINClass::Modify_Value(uint32_t &value, float min, float max, float unit, void (*f)()/*=nullptr*/) { - valuepointer = &value; - funcpointer = f; - Setup_Value((float)value, min, max, unit, 4); -} -void CrealityDWINClass::Modify_Value(int8_t &value, float min, float max, float unit, void (*f)()/*=nullptr*/) { - valuepointer = &value; - funcpointer = f; - Setup_Value((float)value, min, max, unit, 5); -} - -void CrealityDWINClass::Modify_Option(uint8_t value, const char * const * options, uint8_t max) { - tempvalue = value; - valuepointer = const_cast(options); - valuemin = 0; - valuemax = max; - process = Option; - EncoderRate.enabled = true; - Draw_Option(value, options, selection - scrollpos, true); -} - -#if HAS_HOSTACTION_MENUS - void CrealityDWINClass::Modify_String(char * string, uint8_t maxlength, bool restrict) { - stringpointer = string; - maxstringlen = maxlength; - reset_keyboard = true; - Draw_Keyboard(restrict, false); - Draw_String(string, selection, true, (maxstringlen > 10)); - } -#endif - -/* Main Functions */ - -void CrealityDWINClass::Update_Print_Filename(const char * const text) { - LOOP_L_N(i, _MIN((size_t)LONG_FILENAME_LENGTH, strlen(text))) filename[i] = text[i]; - filename[_MIN((size_t)LONG_FILENAME_LENGTH - 1, strlen(text))] = '\0'; - Draw_Print_Filename(true); -} - -void CrealityDWINClass::Update_Status(const char * const text) { - LOOP_L_N(i, _MIN((size_t)64, strlen(text))) statusmsg[i] = text[i]; - statusmsg[_MIN((size_t)64, strlen(text))] = '\0'; -} - -void CrealityDWINClass::Update_Status(FSTR_P text) { - Update_Status(FTOP(text)); -} - -void CrealityDWINClass::Start_Print(bool sd) { - temp_val.sdprint = sd; - if (!temp_val.printing) { - temp_val.printing = true; - statusmsg[0] = '\0'; - if (sd) { - #if ENABLED(POWER_LOSS_RECOVERY) - if (recovery.valid()) { - SdFile *diveDir = nullptr; - const char * const fname = card.diveToFile(true, diveDir, recovery.info.sd_filename); - card.selectFileByName(fname); - } - #endif - strcpy(filename, card.longest_filename()); - } - TERN_(LCD_SET_PROGRESS_MANUALLY, ui.set_progress(0)); - TERN_(USE_M73_REMAINING_TIME, ui.set_remaining_time(0)); - Draw_Print_Screen(); - } -} - -void CrealityDWINClass::Stop_Print() { - temp_val.printing = false; - temp_val.sdprint = false; - thermalManager.cooldown(); - TERN_(LCD_SET_PROGRESS_MANUALLY, ui.set_progress(100 * (PROGRESS_SCALE))); - TERN_(USE_M73_REMAINING_TIME, ui.set_remaining_time(0)); - Draw_PrintDone_confirm(); - filename[0] = '\0'; -} - -void CrealityDWINClass::Update() { - State_Update(); - Screen_Update(); - switch (process) { - case Main: Main_Menu_Control(); break; - case Menu: Menu_Control(); break; - case Value: Value_Control(); break; - case Option: Option_Control(); break; - case File: File_Control(); break; - case Print: Print_Screen_Control(); break; - case Popup: Popup_Control(); break; - case Confirm: Confirm_Control(); break; - #if HAS_HOSTACTION_MENUS - case Keyboard: Keyboard_Control(); break; - #endif - case Cancel: Confirm_Control(); break; - #if HAS_LOCKSCREEN - case Locked: HMI_LockScreen(); break; - #endif - } -} - -void MarlinUI::update() { CrealityDWIN.Update(); } - -#if HAS_LCD_BRIGHTNESS - void MarlinUI::_set_brightness() { DWIN_LCD_Brightness(backlight ? brightness : 0); } -#endif - -void CrealityDWINClass::State_Update() { - if ((print_job_timer.isRunning() || print_job_timer.isPaused()) != temp_val.printing) { - if (!temp_val.printing) Start_Print(card.isFileOpen() || TERN0(POWER_LOSS_RECOVERY, recovery.valid())); - else Stop_Print(); - } - if (print_job_timer.isPaused() != temp_val.paused) { - temp_val.paused = print_job_timer.isPaused(); - if (process == Print) Print_Screen_Icons(); - if (process == Wait && !temp_val.paused) Redraw_Menu(true, true); - } - if (wait_for_user && !(process == Confirm) && !print_job_timer.isPaused()) - Confirm_Handler(UserInput); - #if ENABLED(ADVANCED_PAUSE_FEATURE) - if (process == Popup && popup == PurgeMore) { - if (pause_menu_response == PAUSE_RESPONSE_EXTRUDE_MORE) - Popup_Handler(FilChange); - else if (pause_menu_response == PAUSE_RESPONSE_RESUME_PRINT) { - if (temp_val.printing) Popup_Handler(Resuming); - else Redraw_Menu(true, true, (active_menu==PreheatHotend)); - } - } - #endif - #if ENABLED(FILAMENT_RUNOUT_SENSOR) - static bool ranout = false; - if (runout.filament_ran_out != ranout) { - ranout = runout.filament_ran_out; - if (ranout) Popup_Handler(Runout); - } - #endif -} - -void CrealityDWINClass::Screen_Update() { - const millis_t ms = millis(); - static millis_t scrltime = 0; - if (ELAPSED(ms, scrltime)) { - scrltime = ms + 200; - if (process != Keyboard) Update_Status_Bar(); - if (process == Print) Draw_Print_Filename(); - } - - static millis_t statustime = 0; - if (ELAPSED(ms, statustime) && process != Keyboard) { - statustime = ms + 500; - Draw_Status_Area(); - #if HAS_ESDIAG - if (process == Confirm && popup == ESDiagPopup) ESDiag.Update(); - #endif - #if HAS_PIDPLOT - if (process == Wait && (popup == PIDWaitH || popup == PIDWaitB)) Plot.Update((popup == PIDWaitH) ? thermalManager.wholeDegHotend(0) : thermalManager.wholeDegBed()); - #endif - } - - static millis_t printtime = 0; - if (ELAPSED(ms, printtime)) { - printtime = ms + 1000; - if (process == Print) { - Draw_Print_ProgressBar(); - Draw_Print_ProgressElapsed(); - TERN_(USE_M73_REMAINING_TIME, Draw_Print_ProgressRemain()); - } - } - - static bool mounted = card.isMounted(); - if (mounted != card.isMounted()) { - mounted = card.isMounted(); - if (process == File) - Draw_SD_List(); - } - - #if HAS_HOTEND - static int16_t hotendtarget = -1; - #endif - #if HAS_HEATED_BED - static int16_t bedtarget = -1; - #endif - #if HAS_FAN - static int16_t fanspeed = -1; - #endif - - #if HAS_ZOFFSET_ITEM - static float lastzoffset = temp_val.zoffsetvalue; - if (temp_val.zoffsetvalue != lastzoffset) { - lastzoffset = temp_val.zoffsetvalue; - #if HAS_BED_PROBE - probe.offset.z = temp_val.zoffsetvalue; - #else - set_home_offset(Z_AXIS, -temp_val.zoffsetvalue); - #endif - } - - #if HAS_BED_PROBE - if (probe.offset.z != lastzoffset) - temp_val.zoffsetvalue = lastzoffset = probe.offset.z; - #else - if (-home_offset.z != lastzoffset) - temp_val.zoffsetvalue = lastzoffset = -home_offset.z; - #endif - #endif // HAS_ZOFFSET_ITEM - - if (process == Menu || process == Value) { - switch (active_menu) { - case TempMenu: - #if HAS_HOTEND - if (thermalManager.temp_hotend[0].target != hotendtarget) { - hotendtarget = thermalManager.temp_hotend[0].target; - if (scrollpos <= TEMP_HOTEND && TEMP_HOTEND <= scrollpos + MROWS) { - if (process != Value || selection != TEMP_HOTEND - scrollpos) - Draw_Float(thermalManager.temp_hotend[0].target, TEMP_HOTEND - scrollpos, false, 1); - } - } - #endif - #if HAS_HEATED_BED - if (thermalManager.temp_bed.target != bedtarget) { - bedtarget = thermalManager.temp_bed.target; - if (scrollpos <= TEMP_BED && TEMP_BED <= scrollpos + MROWS) { - if (process != Value || selection != TEMP_HOTEND - scrollpos) - Draw_Float(thermalManager.temp_bed.target, TEMP_BED - scrollpos, false, 1); - } - } - #endif - #if HAS_FAN - if (thermalManager.fan_speed[0] != fanspeed) { - fanspeed = thermalManager.fan_speed[0]; - if (scrollpos <= TEMP_FAN && TEMP_FAN <= scrollpos + MROWS) { - if (process != Value || selection != TEMP_HOTEND - scrollpos) - Draw_Float(thermalManager.fan_speed[0], TEMP_FAN - scrollpos, false, 1); - } - } - #endif - break; - case Tune: - #if HAS_HOTEND - if (thermalManager.temp_hotend[0].target != hotendtarget) { - hotendtarget = thermalManager.temp_hotend[0].target; - if (scrollpos <= TUNE_HOTEND && TUNE_HOTEND <= scrollpos + MROWS) { - if (process != Value || selection != TEMP_HOTEND - scrollpos) - Draw_Float(thermalManager.temp_hotend[0].target, TUNE_HOTEND - scrollpos, false, 1); - } - } - #endif - #if HAS_HEATED_BED - if (thermalManager.temp_bed.target != bedtarget) { - bedtarget = thermalManager.temp_bed.target; - if (scrollpos <= TUNE_BED && TUNE_BED <= scrollpos + MROWS) { - if (process != Value || selection != TEMP_HOTEND - scrollpos) - Draw_Float(thermalManager.temp_bed.target, TUNE_BED - scrollpos, false, 1); - } - } - #endif - #if HAS_FAN - if (thermalManager.fan_speed[0] != fanspeed) { - fanspeed = thermalManager.fan_speed[0]; - if (scrollpos <= TUNE_FAN && TUNE_FAN <= scrollpos + MROWS) { - if (process != Value || selection != TEMP_HOTEND - scrollpos) - Draw_Float(thermalManager.fan_speed[0], TUNE_FAN - scrollpos, false, 1); - } - } - #endif - break; - } - } -} - -void CrealityDWINClass::AudioFeedback(const bool success/*=true*/) { - if (ui.sound_on) - DONE_BUZZ(success); - else - Update_Status(success ? "Success" : "Failed"); -} - -void CrealityDWINClass::Save_Settings(char *buff) { - TERN_(DEBUG_DWIN, SERIAL_ECHOLNPGM("Save_Settings")); - TERN_(AUTO_BED_LEVELING_UBL, eeprom_settings.tilt_grid_size = mesh_conf.tilt_grid - 1); - eeprom_settings.corner_pos = temp_val.corner_pos * 10; - #if HAS_HOSTACTION_MENUS - eeprom_settings.host_action_label_1 = Encode_String(action1); - eeprom_settings.host_action_label_2 = Encode_String(action2); - eeprom_settings.host_action_label_3 = Encode_String(action3); - #endif - TERN_(DEBUG_DWIN, SERIAL_ECHOLNPGM("eeprom_settings size: ", sizeof(eeprom_settings_t))); - memcpy(buff, &eeprom_settings, _MIN(sizeof(eeprom_settings), eeprom_data_size)); -} - -void CrealityDWINClass::Load_Settings(const char *buff) { - memcpy(&eeprom_settings, buff, _MIN(sizeof(eeprom_settings), eeprom_data_size)); - TERN_(AUTO_BED_LEVELING_UBL, mesh_conf.tilt_grid = eeprom_settings.tilt_grid_size + 1); - if (eeprom_settings.corner_pos == 0) eeprom_settings.corner_pos = 325; - temp_val.corner_pos = eeprom_settings.corner_pos / 10.0f; - #if ENABLED(BAUD_RATE_GCODE) - if (eeprom_settings.Baud115k) queue.inject(F("M575 P0 B115200")); - #endif - #if ENABLED(FWRETRACT) - temp_val.auto_fw_retract = fwretract.autoretract_enabled; - #endif - #if ENABLED(PREHEAT_BEFORE_LEVELING) - temp_val.LevelingTempmode = 2 * !eeprom_settings.ena_hotend_levtemp + !eeprom_settings.ena_bed_levtemp; - #endif - #if ENABLED(LED_CONTROL_MENU, HAS_COLOR_LEDS) - leds.set_color( - (temp_val.LED_Color >> 16) & 0xFF, - (temp_val.LED_Color >> 8) & 0xFF, - (temp_val.LED_Color >> 0) & 0xFF - OPTARG(HAS_WHITE_LED, (temp_val.LED_Color >> 24) & 0xFF) - ); - #endif - #if HAS_HOSTACTION_MENUS - Decode_String(eeprom_settings.host_action_label_1, action1); - Decode_String(eeprom_settings.host_action_label_2, action2); - Decode_String(eeprom_settings.host_action_label_3, action3); - #endif - Redraw_Screen(); - #if ENABLED(POWER_LOSS_RECOVERY) - static bool init = true; - if (init) { - init = false; - queue.inject(F("M1000 S")); - } - #endif -} - -void CrealityDWINClass::Reset_Settings() { - eeprom_settings.time_format_textual = false; - TERN_(AUTO_BED_LEVELING_UBL, eeprom_settings.tilt_grid_size = 0); - eeprom_settings.corner_pos = 325; - eeprom_settings.cursor_color = 0; - eeprom_settings.menu_split_line = 0; - eeprom_settings.menu_top_bg = 0; - eeprom_settings.menu_top_txt = 0; - eeprom_settings.highlight_box = 0; - eeprom_settings.progress_percent = 0; - eeprom_settings.progress_time = 0; - eeprom_settings.status_bar_text = 0; - eeprom_settings.status_area_text = 0; - eeprom_settings.coordinates_text = 0; - eeprom_settings.coordinates_split_line = 0; - TERN_(AUTO_BED_LEVELING_UBL, mesh_conf.tilt_grid = eeprom_settings.tilt_grid_size + 1); - temp_val.corner_pos = eeprom_settings.corner_pos / 10.0f; - TERN_(SOUND_MENU_ITEM, ui.sound_on = ENABLED(SOUND_ON_DEFAULT)); - TERN_(BAUD_RATE_GCODE, eeprom_settings.Baud115k = false); - TERN_(FWRETRACT, temp_val.auto_fw_retract = fwretract.autoretract_enabled); - #if ENABLED(PREHEAT_BEFORE_LEVELING) - eeprom_settings.ena_hotend_levtemp = true; - eeprom_settings.ena_bed_levtemp = true; - eeprom_settings.hotend_levtemp = LEVELING_NOZZLE_TEMP; - eeprom_settings.bed_levtemp = LEVELING_BED_TEMP; - #endif - #if ENABLED(LED_CONTROL_MENU, HAS_COLOR_LEDS) - leds.setup(); - #if ENABLED(LED_COLOR_PRESETS) - leds.set_default(); - #endif - temp_val.LED_Color = Def_Leds_Color; - leds.set_color( - (temp_val.LED_Color >> 16) & 0xFF, - (temp_val.LED_Color >> 8) & 0xFF, - (temp_val.LED_Color >> 0) & 0xFF - OPTARG(HAS_WHITE_LED, (temp_val.LED_Color >> 24) & 0xFF) - ); - #endif - #if HAS_HOSTACTION_MENUS - eeprom_settings.host_action_label_1 = 0; - eeprom_settings.host_action_label_2 = 0; - eeprom_settings.host_action_label_3 = 0; - action1[0] = action2[0] = action3[0] = '-'; - #endif - Redraw_Screen(); -} - -void CrealityDWINClass::PreheatBefore() { - #if ENABLED(PREHEAT_BEFORE_LEVELING) - Popup_Handler(Heating); - #if HAS_BED_PROBE - probe.preheat_for_probing(eeprom_settings.ena_hotend_levtemp, eeprom_settings.ena_bed_levtemp); - #else - #if HAS_HOTEND - if (thermalManager.degTargetHotend(0) < eeprom_settings.hotend_levtemp && (eeprom_settings.ena_hotend_levtemp)) - thermalManager.setTargetHotend(eeprom_settings.hotend_levtemp, 0); - #endif - #if HAS_HEATED_BED - if (thermalManager.degTargetBed() < eeprom_settings.bed_levtemp && (eeprom_settings.ena_bed_levtemp)) - thermalManager.setTargetBed(eeprom_settings.bed_levtemp); - #endif - TERN_(HAS_HOTEND, if (eeprom_settings.ena_hotend_levtemp) thermalManager.wait_for_hotend(0)); - TERN_(HAS_HEATED_BED, if (eeprom_settings.ena_bed_levtemp) thermalManager.wait_for_bed_heating()); - #endif - Update_Status(""); - #endif -} - -void MarlinUI::init_lcd() { - DWINUI::init(); - Encoder_Configuration(); - DWIN_JPG_ShowAndCache(0); - for (uint16_t t = 0; t <= 100; t += 2) { - DWINUI::DRAW_IconWB(ICON, ICON_Bar, 15, 260); - DWIN_Draw_Rectangle(1, Def_Background_Color, 15 + t * 242 / 100, 260, 257, 280); - DWIN_UpdateLCD(); - delay(20); - } - DWIN_JPG_CacheTo1(Language_English); - CrealityDWIN.Redraw_Screen(); -} - -#if ENABLED(ADVANCED_PAUSE_FEATURE) - void MarlinUI::pause_show_message(const PauseMessage message, const PauseMode mode/*=PAUSE_MODE_SAME*/, const uint8_t extruder/*=active_extruder*/) { - switch (message) { - case PAUSE_MESSAGE_INSERT: CrealityDWIN.Confirm_Handler(FilInsert); break; - case PAUSE_MESSAGE_PURGE: break; - case PAUSE_MESSAGE_OPTION: pause_menu_response = PAUSE_RESPONSE_WAIT_FOR; CrealityDWIN.Popup_Handler(PurgeMore); break; - case PAUSE_MESSAGE_HEAT: CrealityDWIN.Confirm_Handler(HeaterTime); break; - case PAUSE_MESSAGE_WAITING: CrealityDWIN.Draw_Print_Screen(); break; - default: break; - } - } -#endif - -// End-stops diagnostic from DWIN PROUI -#if HAS_ESDIAG - void CrealityDWINClass::DWIN_EndstopsDiag() { - last_process = process; - last_selection = selection; - process = Confirm; - popup = ESDiagPopup; - ESDiag.Draw(); - } -#endif - -// Lock screen from DWIN PROUI -#if HAS_LOCKSCREEN - void CrealityDWINClass::DWIN_LockScreen() { - if (process != Locked) { - lockScreen.rprocess = process; - process = Locked; - lockScreen.init(); - } - } - - void CrealityDWINClass::DWIN_UnLockScreen() { - if (process == Locked) { - process = lockScreen.rprocess; - if (!temp_val.printing) Draw_Main_Menu(); else Draw_Print_Screen(); - } - } - - void CrealityDWINClass::HMI_LockScreen() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); - if (encoder_diffState == ENCODER_DIFF_NO) return; - lockScreen.onEncoder(encoder_diffState); - if (lockScreen.isUnlocked()) DWIN_UnLockScreen(); - } -#endif - -// Reboot screen from DWIN PROUI -void CrealityDWINClass::DWIN_RebootScreen() { - DWIN_Frame_Clear(Def_Background_Color); - DWIN_JPG_ShowAndCache(0); - DWINUI::Draw_CenteredString(Def_Text_Color, 220, GET_TEXT_F(MSG_PLEASE_WAIT_REBOOT)); - DWIN_UpdateLCD(); - delay(500); -} - -// Reboot Printer from DWIN PROUI -void CrealityDWINClass::RebootPrinter() { - wait_for_heatup = wait_for_user = false; // Stop waiting for heating/user - thermalManager.disable_all_heaters(); - planner.finish_and_disable(); - DWIN_RebootScreen(); - hal.reboot(); -} - -#if ENABLED(LED_CONTROL_MENU, HAS_COLOR_LEDS) - void CrealityDWINClass::ApplyLEDColor() { - temp_val.LED_Color = TERN0(HAS_WHITE_LED,(leds.color.w << 24)) | (leds.color.r << 16) | (leds.color.g << 8) | (leds.color.b); - } -#endif - -#if HAS_PIDPLOT - void CrealityDWINClass::DWIN_Draw_PIDPopup(const pidresult_t pidresult) { - frame_rect_t gfrm = {40, 160, DWIN_WIDTH - 80, 150}; - DWINUI::ClearMainArea(); - DWIN_Draw_Rectangle(1, Def_PopupBg_color, 14, 60, 258, 330); - DWIN_Draw_Rectangle(0, Def_Highlight_Color, 14, 60, 258, 330); - DWINUI::Draw_CenteredString(Def_PopupTxt_Color, 80, GET_TEXT_F(MSG_PID_AUTOTUNE)); - DWINUI::Draw_String(Def_PopupTxt_Color, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("PID target: Celsius")); - switch (pidresult) { - case PID_EXTR_START: - DWINUI::Draw_CenteredString(Def_PopupTxt_Color, 100, F("for Nozzle is running.")); - Plot.Draw(gfrm, thermalManager.hotend_maxtemp[0], temp_val.PID_e_temp); - DWINUI::Draw_Int(Def_PopupTxt_Color, 3, gfrm.x + 90, gfrm.y - DWINUI::fontHeight() - 4, temp_val.PID_e_temp); - break; - case PID_BED_START: - DWINUI::Draw_CenteredString(Def_PopupTxt_Color, 100, F("for BED is running.")); - Plot.Draw(gfrm, BED_MAXTEMP, temp_val.PID_bed_temp); - DWINUI::Draw_Int(Def_PopupTxt_Color, 3, gfrm.x + 90, gfrm.y - DWINUI::fontHeight() - 4, temp_val.PID_bed_temp); - break; - default: - break; - } - } -#endif - -#if HAS_PID_HEATING - void CrealityDWINClass::DWIN_PidTuning(const pidresult_t pidresult) { - switch (pidresult) { - case PID_STARTED: break; - #if HAS_PIDPLOT - case PID_EXTR_START: last_process = process; last_selection = selection; process = Wait; popup = PIDWaitH; DWIN_Draw_PIDPopup(pidresult); break; - case PID_BED_START: last_process = process; last_selection = selection; process = Wait; popup = PIDWaitB; DWIN_Draw_PIDPopup(pidresult); break; - #else - case PID_EXTR_START: Popup_Handler(PIDWait); break; - case PID_BED_START: Popup_Handler(PIDWait, true); break; - #endif - case PID_BAD_EXTRUDER_NUM: Confirm_Handler(BadextruderNumber); break; - case PID_TEMP_TOO_HIGH: Confirm_Handler(TempTooHigh); break; - case PID_TUNING_TIMEOUT: Confirm_Handler(PIDTimeout); break; - case PID_DONE: Confirm_Handler(PIDDone); break; - default: break; - } - } -#endif - -#endif // DWIN_CREALITY_LCD_JYERSUI diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.h b/Marlin/src/lcd/e3v2/jyersui/dwin.h deleted file mode 100644 index c42c0677dce1..000000000000 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.h +++ /dev/null @@ -1,283 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#pragma once - -/** - * lcd/e3v2/jyersui/dwin.h - * JYERSUI Author: Jacob Myers - * - * JYERSUI Enhanced by LCH-77 - * Version: 1.9 - * Date: Jun 16, 2022 - */ - -#include "dwin_defines.h" - -#include "../../../inc/MarlinConfig.h" - -enum processID : uint8_t { - Main, Print, Menu, Value, Option, File, Popup, Confirm, Wait, Locked, Cancel, Keyboard -}; - -enum PopupID : uint8_t { - Pause, Stop, Resume, SaveLevel, ETemp, ConfFilChange, PurgeMore, MeshSlot, - Level, Home, MoveWait, Heating, FilLoad, FilChange, TempWarn, Runout, Resuming, ManualProbing, - FilInsert, HeaterTime, UserInput, LevelError, InvalidMesh, UI, Complete, Custom, ESDiagPopup, PrintConfirm, - PIDWait, PIDWaitH, PIDWaitB, BadextruderNumber, TempTooHigh, PIDTimeout, PIDDone -}; - -enum menuID : uint8_t { - MainMenu, - Prepare, - Move, - HomeMenu, - ManualLevel, - ZOffset, - Preheat, - ChangeFilament, - HostActions, - MenuCustom, - Control, - TempMenu, - PID, - HotendPID, - BedPID, - #if HAS_PREHEAT - #define _PREHEAT_ID(N) Preheat##N, - REPEAT_1(PREHEAT_COUNT, _PREHEAT_ID) - #endif - Motion, - HomeOffsets, - MaxSpeed, - MaxAcceleration, - #if HAS_CLASSIC_JERK - MaxJerk, - #endif - #if HAS_JUNCTION_DEVIATION - JDmenu, - #endif - Steps, - #if ENABLED(FWRETRACT) - FwRetraction, - #endif - Visual, - ColorSettings, - HostSettings, - ActionCommands, - Advanced, - #if HAS_BED_PROBE - ProbeMenu, - #endif - Info, - #if HAS_MESH - Leveling, - LevelManual, - LevelView, - MeshViewer, - LevelSettings, - #if ENABLED(PROBE_MANUALLY) - ManualMesh, - #endif - #if ENABLED(AUTO_BED_LEVELING_UBL) && !HAS_BED_PROBE - UBLMesh, - #endif - #endif - InfoMain, - Tune, - PreheatHotend, - #if ANY(CASE_LIGHT_MENU, LED_CONTROL_MENU) - Ledsmenu, - #if BOTH(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS) - CaseLightmenu, - #endif - #if ENABLED(LED_CONTROL_MENU) - LedControlmenu, - #if HAS_COLOR_LEDS - #if ENABLED(LED_COLOR_PRESETS) - LedControlpresets, - #else - LedControlcustom, - #endif - #endif - #endif - #endif -}; - -typedef struct { - // Flags - bool flag_tune = false; - bool auto_fw_retract = false; - bool printing = false; - bool paused = false; - bool sdprint = false; - bool livemove = false; - bool liveadjust = false; - bool probe_deployed = false; - // Auxiliary values - AxisEnum axis = X_AXIS; // Axis Select - int16_t pausetemp = 0; - int16_t pausebed = 0; - int16_t pausefan = 0; - uint8_t preheatmode = 0; - uint8_t zoffsetmode = 0; - float zoffsetvalue = 0; - uint8_t gridpoint; - float corner_avg; - float corner_pos; - float zval; - #if ENABLED(PREHEAT_BEFORE_LEVELING) - uint8_t LevelingTempmode = 0; - #endif - #if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS) - uint32_t LED_Color = Def_Leds_Color; - #endif - #if HAS_PID_HEATING - uint16_t PID_e_temp = 180; - uint16_t PID_bed_temp = 60; - #endif -} temp_val_t; -extern temp_val_t temp_val; - -#define Custom_Colors 10 -enum colorID : uint8_t { - Default, White, Green, Cyan, Blue, Magenta, Red, Orange, Yellow, Brown, Black -}; -enum pidresult_t : uint8_t { PID_STARTED, PID_EXTR_START, PID_BED_START, PID_BAD_EXTRUDER_NUM, PID_TEMP_TOO_HIGH, PID_TUNING_TIMEOUT, PID_DONE }; - -class CrealityDWINClass { -public: - static constexpr const char * const color_names[11] = { "Default", "White", "Green", "Cyan", "Blue", "Magenta", "Red", "Orange", "Yellow", "Brown", "Black" }; - static constexpr const char * const preheat_modes[3] = { "Both", "Hotend", "Bed" }; - static constexpr const char * const zoffset_modes[3] = { "No Live" , "OnClick", " Live" }; - #if ENABLED(PREHEAT_BEFORE_LEVELING) - static constexpr const char * const preheat_levmodes[4] = { " Both", " Hotend", " Bed", " None" }; - #endif - - static void Clear_Screen(uint8_t e=3); - static void Draw_Float(float value, uint8_t row, bool selected=false, uint8_t minunit=10); - static void Draw_Option(uint8_t value, const char * const * options, uint8_t row, bool selected=false, bool color=false); - static uint16_t GetColor(uint8_t color, uint16_t original, bool light=false); - static void Draw_Checkbox(uint8_t row, bool value); - static void Draw_Title(const char * title); - static void Draw_Title(FSTR_P const title); - static void Draw_Menu_Item(uint8_t row, uint8_t icon=0, const char * const label1=nullptr, const char * const label2=nullptr, bool more=false, bool centered=false); - static void Draw_Menu_Item(uint8_t row, uint8_t icon=0, FSTR_P const flabel1=nullptr, FSTR_P const flabel2=nullptr, bool more=false, bool centered=false); - static void Draw_Menu(uint8_t menu, uint8_t select=0, uint8_t scroll=0); - static void Redraw_Menu(bool lastprocess=true, bool lastselection=false, bool lastmenu=false); - static void Redraw_Screen(); - - static void Main_Menu_Icons(); - static void Draw_Main_Menu(uint8_t select=0); - static void Print_Screen_Icons(); - static void Draw_Print_Screen(); - static void Draw_Print_Filename(const bool reset=false); - static void Draw_Print_ProgressBar(); - #if ENABLED(USE_M73_REMAINING_TIME) - static void Draw_Print_ProgressRemain(); - #endif - static void Draw_Print_ProgressElapsed(); - static void Draw_PrintDone_confirm(); - static void Draw_SD_Item(uint8_t item, uint8_t row); - static void Draw_SD_List(bool removed=false); - static void Draw_Status_Area(bool icons=false); - static void Draw_Popup(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, uint8_t mode, uint8_t icon=0); - static void Popup_Select(); - static void Update_Status_Bar(bool refresh=false); - - #if ENABLED(AUTO_BED_LEVELING_UBL) - static void Draw_Bed_Mesh(int16_t selected = -1, uint8_t gridline_width = 1, uint16_t padding_x = 8, uint16_t padding_y_top = 40 + 53 - 7); - static void Set_Mesh_Viewer_Status(); - #endif - - static FSTR_P Get_Menu_Title(uint8_t menu); - static uint8_t Get_Menu_Size(uint8_t menu); - static void Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw=true); - - static void Popup_Handler(PopupID popupid, bool option=false); - static void Confirm_Handler(PopupID popupid, bool option=false); - - static void Main_Menu_Control(); - static void Menu_Control(); - static void Value_Control(); - static void Option_Control(); - static void File_Control(); - static void Print_Screen_Control(); - static void Popup_Control(); - static void Confirm_Control(); - - static void Setup_Value(float value, float min, float max, float unit, uint8_t type); - static void Modify_Value(float &value, float min, float max, float unit, void (*f)()=nullptr); - static void Modify_Value(uint8_t &value, float min, float max, float unit, void (*f)()=nullptr); - static void Modify_Value(uint16_t &value, float min, float max, float unit, void (*f)()=nullptr); - static void Modify_Value(int16_t &value, float min, float max, float unit, void (*f)()=nullptr); - static void Modify_Value(uint32_t &value, float min, float max, float unit, void (*f)()=nullptr); - static void Modify_Value(int8_t &value, float min, float max, float unit, void (*f)()=nullptr); - static void Modify_Option(uint8_t value, const char * const * options, uint8_t max); - - static void Update_Status(const char * const text); - static void Update_Status(FSTR_P text); - static void Start_Print(bool sd); - static void Stop_Print(); - static void Update(); - static void State_Update(); - static void Screen_Update(); - static void AudioFeedback(const bool success=true); - static void Save_Settings(char *buff); - static void Load_Settings(const char *buff); - static void Reset_Settings(); - static void PreheatBefore(); - - #if HAS_ESDIAG - static void DWIN_EndstopsDiag(); - #endif - #if HAS_LOCKSCREEN - static void DWIN_LockScreen(); - static void DWIN_UnLockScreen(); - static void HMI_LockScreen(); - #endif - static void DWIN_RebootScreen(); - static void RebootPrinter(); - static void Update_Print_Filename(const char * const text); - #if ENABLED(LED_CONTROL_MENU, HAS_COLOR_LEDS) - static void ApplyLEDColor(); - #endif - - #if HAS_HOSTACTION_MENUS - static void Draw_String(char * string, uint8_t row, bool selected=false, bool below=false); - static const uint64_t Encode_String(const char * string); - static void Decode_String(uint64_t num, char * string); - static void Draw_Keyboard(bool restrict, bool numeric, uint8_t selected=0, bool uppercase=false, bool lock=false); - static void Draw_Keys(uint8_t index, bool selected, bool uppercase=false, bool lock=false); - static void Modify_String(char * string, uint8_t maxlength, bool restrict); - static void Keyboard_Control(); - #endif - - #if HAS_PIDPLOT - static void DWIN_Draw_PIDPopup(const pidresult_t pidresult); - #endif - - #if HAS_PID_HEATING - static void DWIN_PidTuning(const pidresult_t pidresult); - #endif -}; - -extern CrealityDWINClass CrealityDWIN; diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin_defines.h b/Marlin/src/lcd/e3v2/jyersui/dwin_defines.h deleted file mode 100644 index 72d428448899..000000000000 --- a/Marlin/src/lcd/e3v2/jyersui/dwin_defines.h +++ /dev/null @@ -1,131 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#pragma once - -/** - * DWIN general defines and data structs for PRO UI - * Author: Miguel A. Risco-Castillo (MRISCOC) - * Version: 3.11.2 - * Date: 2022/02/28 - * - * Modded for JYERSUI by LCH-77 - * Version: 1.9 - * Date: Jun 16, 2022 - */ - -#include "../../../inc/MarlinConfigPre.h" - -#define HAS_ESDIAG 1 -#define HAS_LOCKSCREEN 1 -#define HAS_PIDPLOT 1 -#define HAS_GCODE_PREVIEW 1 -//#define DEBUG_DWIN 1 -//#define NEED_HEX_PRINT 1 - -#if ENABLED(HOST_ACTION_COMMANDS) - #define HAS_HOSTACTION_MENUS 1 -#endif - -#include "../../../core/types.h" -#include "../common/dwin_color.h" - -// Default UI Colors -#define Def_Background_Color RGB(4,4,0) -#define Def_Cursor_color RGB(24,24,0) -#define Def_TitleBg_color RGB(12,12,0) -#define Def_TitleTxt_color Color_White -#define Def_Text_Color Color_White -#define Def_Selected_Color RGB(24,24,0) -#define Def_SplitLine_Color RGB(24,24,0) -#define Def_Highlight_Color RGB(31,40,0) -#define Def_StatusBg_Color RGB(12,12,0) -#define Def_StatusTxt_Color Color_White -#define Def_PopupBg_color Color_Bg_Window -#define Def_PopupTxt_Color Popup_Text_Color -#define Def_AlertBg_Color Color_Bg_Red -#define Def_AlertTxt_Color Color_Yellow -#define Def_PercentTxt_Color RGB(31,48,8) -#define Def_Barfill_Color RGB(12,12,0) -#define Def_Indicator_Color RGB(31,48,8) -#define Def_Coordinate_Color Color_White -#define Def_Button_Color RGB(12,12,0) - -#if ENABLED(LED_CONTROL_MENU, HAS_COLOR_LEDS) - #define Def_Leds_Color 0xFFFFFFFF -#endif -#if ENABLED(CASELIGHT_USES_BRIGHTNESS) - #define Def_CaseLight_Brightness 255 -#endif - -#if HAS_MESH - #ifndef MESH_INSET - #define MESH_INSET 25 - #endif - #ifndef MESH_MIN_X - #define MESH_MIN_X MESH_INSET - #endif - #ifndef MESH_MIN_Y - #define MESH_MIN_Y MESH_INSET - #endif - #ifndef MESH_MAX_X - #define MESH_MAX_X X_BED_SIZE - (MESH_INSET) - #endif - #ifndef MESH_MAX_Y - #define MESH_MAX_Y X_BED_SIZE - (MESH_INSET) - #endif -#endif - -typedef struct { - bool time_format_textual : 1; - #if ENABLED(AUTO_BED_LEVELING_UBL) - uint8_t tilt_grid_size : 3; - #endif - uint16_t corner_pos : 10; - uint8_t cursor_color : 4; - uint8_t menu_split_line : 4; - uint8_t menu_top_bg : 4; - uint8_t menu_top_txt : 4; - uint8_t highlight_box : 4; - uint8_t progress_percent : 4; - uint8_t progress_time : 4; - uint8_t status_bar_text : 4; - uint8_t status_area_text : 4; - uint8_t coordinates_text : 4; - uint8_t coordinates_split_line : 4; - #if ENABLED(BAUD_RATE_GCODE) - bool Baud115k : 1; - #endif - #if ENABLED(PREHEAT_BEFORE_LEVELING) - bool ena_hotend_levtemp : 1; - bool ena_bed_levtemp : 1; - celsius_t hotend_levtemp = LEVELING_NOZZLE_TEMP; - celsius_t bed_levtemp = LEVELING_BED_TEMP; - #endif - #if HAS_HOSTACTION_MENUS - uint64_t host_action_label_1 : 48; - uint64_t host_action_label_2 : 48; - uint64_t host_action_label_3 : 48; - #endif -} eeprom_settings_t; - -static constexpr size_t eeprom_data_size = 48; -extern eeprom_settings_t eeprom_settings; diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin_lcd.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin_lcd.cpp deleted file mode 100644 index 24d55272a3e9..000000000000 --- a/Marlin/src/lcd/e3v2/jyersui/dwin_lcd.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -/******************************************************************************** - * @file lcd/e3v2/jyersui/dwin_lcd.cpp - * @brief DWIN screen control functions - ********************************************************************************/ - -#include "../../../inc/MarlinConfigPre.h" - -#if ENABLED(DWIN_CREALITY_LCD_JYERSUI) - -#include "dwin_lcd.h" - -/*-------------------------------------- System variable function --------------------------------------*/ - -void DWIN_Startup() {} - -/*---------------------------------------- Drawing functions ----------------------------------------*/ - -// Draw the degree (°) symbol -// Color: color -// x/y: Upper-left coordinate of the first pixel -void DWIN_Draw_DegreeSymbol(uint16_t Color, uint16_t x, uint16_t y) { - DWIN_Draw_Point(Color, 1, 1, x + 1, y); - DWIN_Draw_Point(Color, 1, 1, x + 2, y); - DWIN_Draw_Point(Color, 1, 1, x, y + 1); - DWIN_Draw_Point(Color, 1, 1, x + 3, y + 1); - DWIN_Draw_Point(Color, 1, 1, x, y + 2); - DWIN_Draw_Point(Color, 1, 1, x + 3, y + 2); - DWIN_Draw_Point(Color, 1, 1, x + 1, y + 3); - DWIN_Draw_Point(Color, 1, 1, x + 2, y + 3); -} - -/*---------------------------------------- Picture related functions ----------------------------------------*/ - -// Draw an Icon with transparent background -// libID: Icon library ID -// picID: Icon ID -// x/y: Upper-left point -void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) { - DWIN_ICON_Show(false, false, true, libID, picID, x, y); -} - -// From DWIN Enhanced implementation for PRO UI v3.10.1 -// Write buffer data to the SRAM or Flash -// mem: 0x5A=32KB SRAM, 0xA5=16KB Flash -// addr: start address -// length: Bytes to write -// data: address of the buffer with data -void DWIN_WriteToMem(uint8_t mem, uint16_t addr, uint16_t length, uint8_t *data) { - const uint8_t max_size = 128; - uint16_t pending = length; - uint16_t to_send; - uint16_t indx; - uint8_t block = 0; - - while (pending > 0) { - indx = block * max_size; - to_send = _MIN(pending, max_size); - size_t i = 0; - DWIN_Byte(i, 0x31); - DWIN_Byte(i, mem); - DWIN_Word(i, addr + indx); // start address of the data block - ++i; - LOOP_L_N(j, i) { LCD_SERIAL.write(DWIN_SendBuf[j]); delayMicroseconds(1); } // Buf header - for (uint16_t j = indx; j <= indx + to_send - 1; j++) LCD_SERIAL.write(*(data + j)); delayMicroseconds(1); // write block of data - LOOP_L_N(j, 4) { LCD_SERIAL.write(DWIN_BufTail[j]); delayMicroseconds(1); } - block++; - pending -= to_send; - } -} - -#endif // DWIN_CREALITY_LCD_JYERSUI diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin_lcd.h b/Marlin/src/lcd/e3v2/jyersui/dwin_lcd.h deleted file mode 100644 index b1aeadbbc51b..000000000000 --- a/Marlin/src/lcd/e3v2/jyersui/dwin_lcd.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#pragma once - -/******************************************************************************** - * @file lcd/e3v2/jyersui/dwin_lcd.h - * @brief DWIN screen control functions - ********************************************************************************/ - -#include "../common/dwin_api.h" - -// Draw the degree (°) symbol -// Color: color -// x/y: Upper-left coordinate of the first pixel -void DWIN_Draw_DegreeSymbol(uint16_t Color, uint16_t x, uint16_t y); - -// From DWIN Enhanced implementation for PRO UI v3.10.1 -// Write buffer data to the SRAM or Flash -// mem: 0x5A=32KB SRAM, 0xA5=16KB Flash -// addr: start address -// length: Bytes to write -// data: address of the buffer with data -void DWIN_WriteToMem(uint8_t mem, uint16_t addr, uint16_t length, uint8_t *data); diff --git a/Marlin/src/lcd/e3v2/jyersui/dwinui.cpp b/Marlin/src/lcd/e3v2/jyersui/dwinui.cpp deleted file mode 100644 index 1573bff552d9..000000000000 --- a/Marlin/src/lcd/e3v2/jyersui/dwinui.cpp +++ /dev/null @@ -1,340 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -/** - * DWIN Enhanced implementation for PRO UI - * Author: Miguel A. Risco-Castillo (MRISCOC) - * Version: 3.17.1 - * Date: 2022/04/12 - * - * Modded for JYERSUI by LCH-77 - * Version: 1.9 - * Date: Jun 16, 2022 - */ - -#include "../../../inc/MarlinConfigPre.h" - -#if ENABLED(DWIN_CREALITY_LCD_JYERSUI) - -#include "../../../inc/MarlinConfig.h" -#include "dwin_lcd.h" -#include "dwinui.h" -#include "dwin_defines.h" - -//#define DEBUG_OUT 1 -#include "../../../core/debug_out.h" - -xy_int_t DWINUI::cursor = { 0 }; -uint16_t DWINUI::pencolor = Color_White; -uint16_t DWINUI::textcolor = Def_Text_Color; -uint16_t DWINUI::backcolor = Def_Background_Color; -uint16_t DWINUI::buttoncolor = Def_Button_Color; -uint8_t DWINUI::font = font8x16; -FSTR_P const DWINUI::Author = F(STRING_CONFIG_H_AUTHOR); - -void DWINUI::init() { - delay(750); // Delay for wait to wakeup screen - const bool hs = DWIN_Handshake(); UNUSED(hs); - #if ENABLED(DEBUG_DWIN) - SERIAL_ECHOPGM("DWIN_Handshake "); - SERIAL_ECHOLNF(hs ? F("ok.") : F("error.")); - #endif - DWIN_Frame_SetDir(1); - cursor.reset(); - pencolor = Color_White; - textcolor = Def_Text_Color; - backcolor = Def_Background_Color; - buttoncolor = Def_Button_Color; - font = font8x16; -} - -// Set text/number font -void DWINUI::setFont(uint8_t cfont) { - font = cfont; -} - -// Get font character width -uint8_t DWINUI::fontWidth(uint8_t cfont) { - switch (cfont) { - case font6x12 : return 6; - case font8x16 : return 8; - case font10x20: return 10; - case font12x24: return 12; - case font14x28: return 14; - case font16x32: return 16; - case font20x40: return 20; - case font24x48: return 24; - case font28x56: return 28; - case font32x64: return 32; - default: return 0; - } -} - -// Get font character height -uint8_t DWINUI::fontHeight(uint8_t cfont) { - switch (cfont) { - case font6x12 : return 12; - case font8x16 : return 16; - case font10x20: return 20; - case font12x24: return 24; - case font14x28: return 28; - case font16x32: return 32; - case font20x40: return 40; - case font24x48: return 48; - case font28x56: return 56; - case font32x64: return 64; - default: return 0; - } -} - -// Get screen x coordinates from text column -uint16_t DWINUI::ColToX(uint8_t col) { - return col * fontWidth(font); -} - -// Get screen y coordinates from text row -uint16_t DWINUI::RowToY(uint8_t row) { - return row * fontHeight(font); -} - -// Set text/number color -void DWINUI::SetColors(uint16_t fgcolor, uint16_t bgcolor, uint16_t alcolor) { - textcolor = fgcolor; - backcolor = bgcolor; - buttoncolor = alcolor; -} -void DWINUI::SetTextColor(uint16_t fgcolor) { - textcolor = fgcolor; -} -void DWINUI::SetBackgroundColor(uint16_t bgcolor) { - backcolor = bgcolor; -} - -// Moves cursor to point -// x: abscissa of the display -// y: ordinate of the display -// point: xy coordinate -void DWINUI::MoveTo(int16_t x, int16_t y) { - cursor.x = x; - cursor.y = y; -} -void DWINUI::MoveTo(xy_int_t point) { - cursor = point; -} - -// Moves cursor relative to the actual position -// x: abscissa of the display -// y: ordinate of the display -// point: xy coordinate -void DWINUI::MoveBy(int16_t x, int16_t y) { - cursor.x += x; - cursor.y += y; -} -void DWINUI::MoveBy(xy_int_t point) { - cursor += point; -} - -// Draw a Centered string using arbitrary x1 and x2 margins -void DWINUI::Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string) { - const uint16_t x = _MAX(0U, x2 + x1 - strlen_P(string) * fontWidth(size)) / 2 - 1; - DWIN_Draw_String(bShow, size, color, bColor, x, y, string); -} - -// Draw a char -// color: Character color -// x: abscissa of the display -// y: ordinate of the display -// c: ASCII code of char -void DWINUI::Draw_Char(uint16_t color, uint16_t x, uint16_t y, const char c) { - const char string[2] = { c, 0}; - DWIN_Draw_String(false, font, color, backcolor, x, y, string, 1); -} - -// Draw a char at cursor position and increment cursor -void DWINUI::Draw_Char(uint16_t color, const char c) { - Draw_Char(color, cursor.x, cursor.y, c); - MoveBy(fontWidth(font), 0); -} - -// Draw a string at cursor position -// color: Character color -// *string: The string -// rlimit: For draw less chars than string length use rlimit -void DWINUI::Draw_String(const char * const string, uint16_t rlimit) { - DWIN_Draw_String(false, font, textcolor, backcolor, cursor.x, cursor.y, string, rlimit); - MoveBy(strlen(string) * fontWidth(font), 0); -} -void DWINUI::Draw_String(uint16_t color, const char * const string, uint16_t rlimit) { - DWIN_Draw_String(false, font, color, backcolor, cursor.x, cursor.y, string, rlimit); - MoveBy(strlen(string) * fontWidth(font), 0); -} - -// Draw a numeric integer value -// bShow: true=display background color; false=don't display background color -// signedMode: 1=signed; 0=unsigned -// size: Font size -// color: Character color -// bColor: Background color -// iNum: Number of digits -// x/y: Upper-left coordinate -// value: Integer value -void DWINUI::Draw_Int(uint8_t bShow, bool signedMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value) { - char nstr[10]; - sprintf_P(nstr, PSTR("%*li"), (signedMode ? iNum + 1 : iNum), value); - DWIN_Draw_String(bShow, size, color, bColor, x, y, nstr); -} - -// Draw a numeric float value -// bShow: true=display background color; false=don't display background color -// signedMode: 1=signed; 0=unsigned -// size: Font size -// color: Character color -// bColor: Background color -// iNum: Number of digits -// fNum: Number of decimal digits -// x/y: Upper-left coordinate -// value: float value -void DWINUI::Draw_Float(uint8_t bShow, bool signedMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - char nstr[10]; - DWIN_Draw_String(bShow, size, color, bColor, x, y, dtostrf(value, iNum + (signedMode ? 2:1) + fNum, fNum, nstr)); -} - -// ------------------------- Buttons ------------------------------// - -void DWINUI::Draw_Button(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char * const caption) { - DWIN_Draw_Rectangle(1, bcolor, x1, y1, x2, y2); - Draw_CenteredString(0, font, color, bcolor, x1, x2, (y2 + y1 - fontHeight())/2, caption); -} - -void DWINUI::Draw_Button(uint8_t id, uint16_t x, uint16_t y) { - switch (id) { - case BTN_Cancel : Draw_Button(GET_TEXT_F(MSG_BUTTON_CANCEL), x, y); break; - case BTN_Confirm : Draw_Button(GET_TEXT_F(MSG_BUTTON_CONFIRM), x, y); break; - case BTN_Continue: Draw_Button(GET_TEXT_F(MSG_BUTTON_CONTINUE), x, y); break; - case BTN_Print : Draw_Button(GET_TEXT_F(MSG_BUTTON_PRINT), x, y); break; - case BTN_Save : Draw_Button(GET_TEXT_F(MSG_BUTTON_SAVE), x, y); break; - case BTN_Purge : Draw_Button(GET_TEXT_F(MSG_BUTTON_PURGE), x, y); break; - default: break; - } -} - -// -------------------------- Extra -------------------------------// - -// Draw a circle -// color: circle color -// x: the abscissa of the center of the circle -// y: ordinate of the center of the circle -// r: circle radius -void DWINUI::Draw_Circle(uint16_t color, uint16_t x, uint16_t y, uint8_t r) { - int a = 0, b = 0; - while (a <= b) { - b = SQRT(sq(r) - sq(a)); - if (a == 0) b--; - DWIN_Draw_Point(color, 1, 1, x + a, y + b); // Draw some sector 1 - DWIN_Draw_Point(color, 1, 1, x + b, y + a); // Draw some sector 2 - DWIN_Draw_Point(color, 1, 1, x + b, y - a); // Draw some sector 3 - DWIN_Draw_Point(color, 1, 1, x + a, y - b); // Draw some sector 4 - DWIN_Draw_Point(color, 1, 1, x - a, y - b); // Draw some sector 5 - DWIN_Draw_Point(color, 1, 1, x - b, y - a); // Draw some sector 6 - DWIN_Draw_Point(color, 1, 1, x - b, y + a); // Draw some sector 7 - DWIN_Draw_Point(color, 1, 1, x - a, y + b); // Draw some sector 8 - a++; - } -} - -// Draw a circle filled with color -// bcolor: fill color -// x: the abscissa of the center of the circle -// y: ordinate of the center of the circle -// r: circle radius -void DWINUI::Draw_FillCircle(uint16_t bcolor, uint16_t x,uint16_t y,uint8_t r) { - int a = 0, b = 0; - while (a <= b) { - b = SQRT(sq(r) - sq(a)); // b=sqrt(r*r-a*a); - if (a == 0) b--; - DWIN_Draw_Line(bcolor, x-b,y-a,x+b,y-a); - DWIN_Draw_Line(bcolor, x-a,y-b,x+a,y-b); - DWIN_Draw_Line(bcolor, x-b,y+a,x+b,y+a); - DWIN_Draw_Line(bcolor, x-a,y+b,x+a,y+b); - a++; - } -} - -// Color Interpolator -// val : Interpolator minv..maxv -// minv : Minimum value -// maxv : Maximum value -// color1 : Start color -// color2 : End color -uint16_t DWINUI::ColorInt(int16_t val, int16_t minv, int16_t maxv, uint16_t color1, uint16_t color2) { - uint8_t B, G, R; - const float n = (float)(val - minv) / (maxv - minv); - R = (1 - n) * GetRColor(color1) + n * GetRColor(color2); - G = (1 - n) * GetGColor(color1) + n * GetGColor(color2); - B = (1 - n) * GetBColor(color1) + n * GetBColor(color2); - return RGB(R, G, B); -} - -// Color Interpolator through Red->Yellow->Green->Blue (Pro UI) -// val : Interpolator minv..maxv -// minv : Minimum value -// maxv : Maximum value -uint16_t DWINUI::RainbowInt(int16_t val, int16_t minv, int16_t maxv) { - uint8_t B, G, R; - const uint8_t maxB = 28, maxR = 28, maxG = 38; - const int16_t limv = _MAX(abs(minv), abs(maxv)); - float n = minv >= 0 ? (float)(val - minv) / (maxv - minv) : (float)val / limv; - LIMIT(n, -1, 1); - if (n < 0) { - R = 0; - G = (1 + n) * maxG; - B = (-n) * maxB; - } - else if (n < 0.5) { - R = maxR * n * 2; - G = maxG; - B = 0; - } - else { - R = maxR; - G = maxG * (1 - n); - B = 0; - } - return RGB(R, G, B); -} - -// Draw a checkbox -// Color: frame color -// bColor: Background color -// x/y: Upper-left point -// mode : 0 : unchecked, 1 : checked -void DWINUI::Draw_Checkbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t y, bool checked=false) { - DWIN_Draw_String(true, font8x16, color, bcolor, x + 4, y, checked ? F("x") : F(" ")); - DWIN_Draw_Rectangle(0, color, x + 2, y + 2, x + 17, y + 17); -} - -// Clear Menu by filling the menu area with background color -void DWINUI::ClearMainArea() { - DWIN_Draw_Rectangle(1, backcolor, 0, TITLE_HEIGHT, DWIN_WIDTH - 1, STATUS_Y - 1); -} - -#endif // DWIN_CREALITY_LCD_JYERSUI diff --git a/Marlin/src/lcd/e3v2/jyersui/dwinui.h b/Marlin/src/lcd/e3v2/jyersui/dwinui.h deleted file mode 100644 index 779e6270a128..000000000000 --- a/Marlin/src/lcd/e3v2/jyersui/dwinui.h +++ /dev/null @@ -1,527 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#pragma once - -/** - * DWIN Enhanced implementation for PRO UI - * Author: Miguel A. Risco-Castillo (MRISCOC) - * Version: 3.17.1 - * Date: 2022/04/12 - * - * Modded for JYERSUI by LCH-77 - * Version: 1.9 - * Date: Jun 16, 2022 - */ - -#include "dwin_lcd.h" -#include "../common/dwin_set.h" -#include "../common/dwin_font.h" -#include "../common/dwin_color.h" -#include "../common/dwin_api.h" - -// Custom icons -//#define DWIN_CREALITY_LCD_CUSTOM_ICONS -#if ENABLED(DWIN_CREALITY_LCD_CUSTOM_ICONS) - // index of every custom icon should be >= CUSTOM_ICON_START - #define CUSTOM_ICON_START ICON_Checkbox_F - #define ICON_Checkbox_F 200 - #define ICON_Checkbox_T 201 - #define ICON_Fade 202 - #define ICON_Mesh 203 - #define ICON_Tilt 204 - #define ICON_Brightness 205 - #define ICON_AxisD 249 - #define ICON_AxisBR 250 - #define ICON_AxisTR 251 - #define ICON_AxisBL 252 - #define ICON_AxisTL 253 - #define ICON_AxisC 254 -#else - #define ICON_Fade ICON_Version - #define ICON_Mesh ICON_Version - #define ICON_Tilt ICON_Version - #define ICON_Brightness ICON_Version - #define ICON_AxisD ICON_Axis - #define ICON_AxisBR ICON_Axis - #define ICON_AxisTR ICON_Axis - #define ICON_AxisBL ICON_Axis - #define ICON_AxisTL ICON_Axis - #define ICON_AxisC ICON_Axis - #define ICON_ESDiag ICON_Info - #define ICON_Lock ICON_Cool - #define ICON_Reboot ICON_ResumeEEPROM - #define ICON_ProbeAlarm ICON_SetEndTemp - #define ICON_ProbeMargin ICON_PrintSize - #define ICON_ProbeSelfTest ICON_SetEndTemp - #define ICON_ProbeSet ICON_SetEndTemp - #define ICON_ProbeDeploy ICON_SetEndTemp - #define ICON_ProbeTest ICON_SetEndTemp - #define ICON_ProbeTestCount ICON_SetEndTemp - #define ICON_ProbeZSpeed ICON_MaxSpeedZ - #define ICON_FWRetLength ICON_StepE - #define ICON_FWRetSpeed ICON_Setspeed - #define ICON_FWRetZRaise ICON_MoveZ - #define ICON_FWRecExtLength ICON_StepE - #define ICON_FWRecSpeed ICON_Setspeed - #define ICON_HSMode ICON_StockConfiguration - #define ICON_Sound ICON_Cool - #define ICON_CaseLight ICON_Motion - #define ICON_LedControl ICON_Motion - #define ICON_MeshActive ICON_HotendTemp - #define ICON_Park ICON_Motion -#endif - -// Buttons -#define BTN_Continue 85 -#define BTN_Cancel 87 -#define BTN_Confirm 89 -#define BTN_Print 90 -#define BTN_Save 91 -#define BTN_Purge 92 - -// Extended UI Colors -#define Color_Aqua RGB(0,63,31) -#define Color_Light_White 0xBDD7 -#define Color_Green RGB(0,63,0) -#define Color_Light_Green 0x3460 -#define Color_Cyan 0x07FF -#define Color_Light_Cyan 0x04F3 -#define Color_Blue RGB(0,0,31) -#define Color_Light_Blue 0x3A6A -#define Color_Magenta 0xF81F -#define Color_Light_Magenta 0x9813 -#define Color_Light_Red 0x8800 -#define Color_Orange 0xFA20 -#define Color_Light_Orange 0xFBC0 -#define Color_Light_Yellow 0x8BE0 -#define Color_Brown 0xCC27 -#define Color_Light_Brown 0x6204 -#define Color_Black 0x0000 -#define Color_Grey 0x18E3 -#define Check_Color 0x4E5C -#define Confirm_Color 0x34B9 -#define Cancel_Color 0x3186 - -// UI element defines and constants -#define DWIN_FONT_MENU font8x16 -#define DWIN_FONT_STAT font10x20 -#define DWIN_FONT_HEAD font10x20 -#define DWIN_FONT_ALERT font10x20 -#define STATUS_Y 354 -#define LCD_WIDTH (DWIN_WIDTH / 8) // only if the default font is font8x16 - -// Minimum unit (0.1) : multiple (10) -#define UNITFDIGITS 1 -#define MINUNITMULT POW(10, UNITFDIGITS) - -constexpr uint8_t TITLE_HEIGHT = 30, // Title bar height - MLINE = 53, // Menu line height - TROWS = (STATUS_Y - TITLE_HEIGHT) / MLINE, // Total rows - MROWS = TROWS - 1, // Other-than-Back - ICOX = 26, // Menu item icon X position - LBLX = 60, // Menu item label X position - VALX = 210, // Menu item value X position - MENU_CHR_W = 8, MENU_CHR_H = 16, // Menu font 8x16 - STAT_CHR_W = 10; - -// Menuitem Y position -#define MYPOS(L) (TITLE_HEIGHT + MLINE * (L)) - -// Menuitem caption Offset -#define CAPOFF ((MLINE - MENU_CHR_H) / 2) - -// Menuitem caption Y position -#define MBASE(L) (MYPOS(L) + CAPOFF) - -typedef struct { uint16_t left, top, right, bottom; } rect_t; -typedef struct { uint16_t x, y, w, h; } frame_rect_t; - -namespace DWINUI { - extern xy_int_t cursor; - extern uint16_t pencolor; - extern uint16_t textcolor; - extern uint16_t backcolor; - extern uint16_t buttoncolor; - extern uint8_t font; - extern FSTR_P const Author; - - // DWIN LCD Initialization - void init(); - - // Set text/number font - void setFont(uint8_t cfont); - - // Get font character width - uint8_t fontWidth(uint8_t cfont); - inline uint8_t fontWidth() { return fontWidth(font); }; - - // Get font character height - uint8_t fontHeight(uint8_t cfont); - inline uint8_t fontHeight() { return fontHeight(font); }; - - // Get screen x coordinates from text column - uint16_t ColToX(uint8_t col); - - // Get screen y coordinates from text row - uint16_t RowToY(uint8_t row); - - // Set text/number color - void SetColors(uint16_t fgcolor, uint16_t bgcolor, uint16_t alcolor); - void SetTextColor(uint16_t fgcolor); - void SetBackgroundColor(uint16_t bgcolor); - - // Moves cursor to point - // x: abscissa of the display - // y: ordinate of the display - // point: xy coordinate - void MoveTo(int16_t x, int16_t y); - void MoveTo(xy_int_t point); - - // Moves cursor relative to the actual position - // x: abscissa of the display - // y: ordinate of the display - // point: xy coordinate - void MoveBy(int16_t x, int16_t y); - void MoveBy(xy_int_t point); - - // Draw a line from the cursor to xy position - // color: Line segment color - // x/y: End point - inline void LineTo(uint16_t color, uint16_t x, uint16_t y) { - DWIN_Draw_Line(color, cursor.x, cursor.y, x, y); - } - inline void LineTo(uint16_t x, uint16_t y) { - DWIN_Draw_Line(pencolor, cursor.x, cursor.y, x, y); - } - - // Extend a frame box - // v: value to extend - inline frame_rect_t ExtendFrame(frame_rect_t frame, uint8_t v) { - frame_rect_t t; - t.x = frame.x - v; - t.y = frame.y - v; - t.w = frame.w + 2 * v; - t.h = frame.h + 2 * v; - return t; - } - - // Draw an Icon with transparent background from the library ICON - // icon: Icon ID - // x/y: Upper-left point - inline void Draw_Icon(uint8_t icon, uint16_t x, uint16_t y) { - DWIN_ICON_Show(ICON, icon, x, y); - } - - // Draw an Icon from the library ICON with its background - // icon: Icon ID - // x/y: Upper-left point - inline void Draw_IconWB(uint8_t icon, uint16_t x, uint16_t y) { - DWIN_ICON_Show(true, false, false, ICON, icon, x, y); - } - inline void DRAW_IconWB(uint8_t libID, uint8_t icon, uint16_t x, uint16_t y) { - DWIN_ICON_Show(true, false, false, libID, icon, x, y); - } - - // Draw a numeric integer value - // bShow: true=display background color; false=don't display background color - // signedMode: 1=signed; 0=unsigned - // size: Font size - // color: Character color - // bColor: Background color - // iNum: Number of digits - // x/y: Upper-left coordinate - // value: Integer value - void Draw_Int(uint8_t bShow, bool signedMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value); - - // Draw a positive integer - inline void Draw_Int(uint8_t bShow, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(bShow, 0, size, color, bColor, iNum, x, y, value); - } - inline void Draw_Int(uint8_t iNum, long value) { - Draw_Int(false, 0, font, textcolor, backcolor, iNum, cursor.x, cursor.y, value); - MoveBy(iNum * fontWidth(font), 0); - } - inline void Draw_Int(uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(false, 0, font, textcolor, backcolor, iNum, x, y, value); - } - inline void Draw_Int(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(false, 0, font, color, backcolor, iNum, x, y, value); - } - inline void Draw_Int(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(true, 0, font, color, bColor, iNum, x, y, value); - } - inline void Draw_Int(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(true, 0, size, color, bColor, iNum, x, y, value); - } - - // Draw a signed integer - inline void Draw_Signed_Int(uint8_t bShow, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(bShow, 1, size, color, bColor, iNum, x, y, value); - } - inline void Draw_Signed_Int(uint8_t iNum, long value) { - Draw_Int(false, 1, font, textcolor, backcolor, iNum, cursor.x, cursor.y, value); - MoveBy(iNum * fontWidth(font), 0); - } - inline void Draw_Signed_Int(uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(false, 1, font, textcolor, backcolor, iNum, x, y, value); - } - inline void Draw_Signed_Int(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(false, 1, font, color, backcolor, iNum, x, y, value); - } - inline void Draw_Signed_Int(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(true, 1, font, color, bColor, iNum, x, y, value); - } - inline void Draw_Signed_Int(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(true, 1, size, color, bColor, iNum, x, y, value); - } - - // Draw a numeric float value - // bShow: true=display background color; false=don't display background color - // signedMode: 1=signed; 0=unsigned - // size: Font size - // color: Character color - // bColor: Background color - // iNum: Number of digits - // fNum: Number of decimal digits - // x/y: Upper-left coordinate - // value: float value - void Draw_Float(uint8_t bShow, bool signedMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value); - - // Draw a positive floating point number - inline void Draw_Float(uint8_t bShow, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(bShow, 0, size, color, bColor, iNum, fNum, x, y, value); - } - inline void Draw_Float(uint8_t iNum, uint8_t fNum, float value) { - Draw_Float(false, 0, font, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value); - MoveBy((iNum + fNum + 1) * fontWidth(font), 0); - } - inline void Draw_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(false, 0, font, textcolor, backcolor, iNum, fNum, x, y, value); - } - inline void Draw_Float(uint8_t size, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(false, 0, size, textcolor, backcolor, iNum, fNum, x, y, value); - } - inline void Draw_Float(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(true, 0, font, color, bColor, iNum, fNum, x, y, value); - } - inline void Draw_Float(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(true, 0, size, color, bColor, iNum, fNum, x, y, value); - } - - // Draw a signed floating point number - inline void Draw_Signed_Float(uint8_t bShow, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(bShow, 1, size, color, bColor, iNum, fNum, x, y, value); - } - inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, float value) { - Draw_Float(false, 1, font, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value); - MoveBy((iNum + fNum + 1) * fontWidth(font), 0); - } - inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(false, 1, font, textcolor, backcolor, iNum, fNum, x, y, value); - } - inline void Draw_Signed_Float(uint8_t size, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(false, 1, size, textcolor, backcolor, iNum, fNum, x, y, value); - } - inline void Draw_Signed_Float(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(true, 1, font, color, bColor, iNum, fNum, x, y, value); - } - inline void Draw_Signed_Float(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(true, 1, size, color, bColor, iNum, fNum, x, y, value); - } - - // Draw a char - // color: Character color - // x: abscissa of the display - // y: ordinate of the display - // c: ASCII code of char - void Draw_Char(uint16_t color, uint16_t x, uint16_t y, const char c); - inline void Draw_Char(uint16_t x, uint16_t y, const char c) { Draw_Char(textcolor, x, y, c); }; - // Draw a char at cursor position and increment cursor - void Draw_Char(uint16_t color, const char c); - inline void Draw_Char(const char c) { Draw_Char(textcolor, c); } - - // Draw a string at cursor position - // color: Character color - // *string: The string - // rlimit: For draw less chars than string length use rlimit - void Draw_String(const char * const string, uint16_t rlimit = 0xFFFF); - void Draw_String(uint16_t color, const char * const string, uint16_t rlimit = 0xFFFF); - inline void Draw_String(FSTR_P string, uint16_t rlimit = 0xFFFF) { - Draw_String(FTOP(string), rlimit); - } - inline void Draw_String(uint16_t color, FSTR_P string, uint16_t rlimit = 0xFFFF) { - Draw_String(color, FTOP(string), rlimit); - } - - // Draw a string - // size: Font size - // color: Character color - // bColor: Background color - // x/y: Upper-left coordinate of the string - // *string: The string - inline void Draw_String(uint16_t x, uint16_t y, const char * const string) { - DWIN_Draw_String(false, font, textcolor, backcolor, x, y, string); - } - inline void Draw_String(uint16_t x, uint16_t y, FSTR_P title) { - DWIN_Draw_String(false, font, textcolor, backcolor, x, y, FTOP(title)); - } - inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, const char * const string) { - DWIN_Draw_String(false, font, color, backcolor, x, y, string); - } - inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, FSTR_P title) { - DWIN_Draw_String(false, font, color, backcolor, x, y, title); - } - inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) { - DWIN_Draw_String(true, font, color, bgcolor, x, y, string); - } - inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) { - DWIN_Draw_String(true, font, color, bgcolor, x, y, title); - } - inline void Draw_String(uint8_t size, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) { - DWIN_Draw_String(true, size, color, bgcolor, x, y, string); - } - inline void Draw_String(uint8_t size, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) { - DWIN_Draw_String(true, size, color, bgcolor, x, y, title); - } - - // Draw a centered string using DWIN_WIDTH - // bShow: true=display background color; false=don't display background color - // size: Font size - // color: Character color - // bColor: Background color - // y: Upper coordinate of the string - // *string: The string - void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string); - inline void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, const char * const string) { - Draw_CenteredString(bShow, size, color, bColor, 0, DWIN_WIDTH, y, string); - } - inline void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, FSTR_P string) { - Draw_CenteredString(bShow, size, color, bColor, y, FTOP(string)); - } - inline void Draw_CenteredString(uint16_t color, uint16_t bcolor, uint16_t y, const char * const string) { - Draw_CenteredString(true, font, color, bcolor, y, string); - } - inline void Draw_CenteredString(uint8_t size, uint16_t color, uint16_t y, const char * const string) { - Draw_CenteredString(false, size, color, backcolor, y, string); - } - inline void Draw_CenteredString(uint8_t size, uint16_t color, uint16_t y, FSTR_P title) { - Draw_CenteredString(false, size, color, backcolor, y, title); - } - inline void Draw_CenteredString(uint16_t color, uint16_t y, const char * const string) { - Draw_CenteredString(false, font, color, backcolor, y, string); - } - inline void Draw_CenteredString(uint16_t color, uint16_t y, FSTR_P title) { - Draw_CenteredString(false, font, color, backcolor, y, title); - } - inline void Draw_CenteredString(uint16_t y, const char * const string) { - Draw_CenteredString(false, font, textcolor, backcolor, y, string); - } - inline void Draw_CenteredString(uint16_t y, FSTR_P title) { - Draw_CenteredString(false, font, textcolor, backcolor, y, title); - } - - // Draw a box - // mode: 0=frame, 1=fill, 2=XOR fill - // color: Rectangle color - // frame: Box coordinates and size - inline void Draw_Box(uint8_t mode, uint16_t color, frame_rect_t frame) { - DWIN_Draw_Box(mode, color, frame.x, frame.y, frame.w, frame.h); - } - - // Draw a circle - // Color: circle color - // x: abscissa of the center of the circle - // y: ordinate of the center of the circle - // r: circle radius - void Draw_Circle(uint16_t color, uint16_t x,uint16_t y,uint8_t r); - inline void Draw_Circle(uint16_t color, uint8_t r) { - Draw_Circle(color, cursor.x, cursor.y, r); - } - - // Draw a checkbox - // Color: frame color - // bColor: Background color - // x/y: Upper-left point - // checked : 0 : unchecked, 1 : checked - void Draw_Checkbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t y, bool checked); - inline void Draw_Checkbox(uint16_t x, uint16_t y, bool checked=false) { - Draw_Checkbox(textcolor, backcolor, x, y, checked); - } - - // Color Interpolator - // val : Interpolator minv..maxv - // minv : Minimum value - // maxv : Maximum value - // color1 : Start color - // color2 : End color - uint16_t ColorInt(int16_t val, int16_t minv, int16_t maxv, uint16_t color1, uint16_t color2); - - // ------------------------- Buttons ------------------------------// - - void Draw_Button(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char * const caption); - inline void Draw_Button(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, FSTR_P caption) { - Draw_Button(color, bcolor, x1, y1, x2, y2, FTOP(caption)); - } - inline void Draw_Button(FSTR_P caption, uint16_t x, uint16_t y) { - Draw_Button(textcolor, buttoncolor, x, y, x + 99, y + 37, caption); - } - void Draw_Button(uint8_t id, uint16_t x, uint16_t y); - - // -------------------------- Extra -------------------------------// - - // Draw a circle filled with color - // bcolor: fill color - // x: abscissa of the center of the circle - // y: ordinate of the center of the circle - // r: circle radius - void Draw_FillCircle(uint16_t bcolor, uint16_t x,uint16_t y,uint8_t r); - inline void Draw_FillCircle(uint16_t bcolor, uint8_t r) { - Draw_FillCircle(bcolor, cursor.x, cursor.y, r); - } - - // Color Interpolator through Red->Yellow->Green->Blue - // val : Interpolator minv..maxv - // minv : Minimum value - // maxv : Maximum value - uint16_t RainbowInt(int16_t val, int16_t minv, int16_t maxv); - - // Write buffer data to the SRAM - // addr: SRAM start address 0x0000-0x7FFF - // length: Bytes to write - // data: address of the buffer with data - inline void WriteToSRAM(uint16_t addr, uint16_t length, uint8_t *data) { - DWIN_WriteToMem(0x5A, addr, length, data); - } - - // Write buffer data to the Flash - // addr: Flash start address 0x0000-0x3FFF - // length: Bytes to write - // data: address of the buffer with data - inline void WriteToFlash(uint16_t addr, uint16_t length, uint8_t *data) { - DWIN_WriteToMem(0xA5, addr, length, data); - } - - // Clear by filling the area with background color - // Area (0, TITLE_HEIGHT, DWIN_WIDTH, STATUS_Y - 1) - void ClearMainArea(); - -}; diff --git a/Marlin/src/lcd/e3v2/jyersui/endstop_diag.cpp b/Marlin/src/lcd/e3v2/jyersui/endstop_diag.cpp deleted file mode 100644 index 5c4549619fb1..000000000000 --- a/Marlin/src/lcd/e3v2/jyersui/endstop_diag.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -/** - * DWIN End Stops diagnostic page - * Author: Miguel A. Risco-Castillo - * Version: 1.0 - * Date: 2021/11/06 - * - * Modded for JYERSUI by LCH-77 - */ - -#include "../../../inc/MarlinConfigPre.h" - -#if ENABLED(DWIN_CREALITY_LCD_JYERSUI) - -#include "dwin_defines.h" - -#if HAS_ESDIAG - -#include "endstop_diag.h" -#include "dwinui.h" -#include "dwin.h" - -#if HAS_FILAMENT_SENSOR - #include "../../../feature/runout.h" -#endif - -#if HAS_BED_PROBE - #include "../../../module/probe.h" -#endif - -ESDiagClass ESDiag; - -void draw_es_label(FSTR_P const flabel=nullptr) { - DWINUI::cursor.x = 40; - if (flabel) DWINUI::Draw_String(F(flabel)); - DWINUI::Draw_String(F(": ")); - DWINUI::MoveBy(0, 25); -} - -void draw_es_state(const bool is_hit) { - const uint8_t LM = 130; - DWINUI::cursor.x = LM; - DWIN_Draw_Rectangle(1, Color_Bg_Window, LM, DWINUI::cursor.y, LM + 100, DWINUI::cursor.y + 20); - is_hit ? DWINUI::Draw_String(RGB(31,31,16), F(STR_ENDSTOP_HIT)) : DWINUI::Draw_String(RGB(16,63,16), F(STR_ENDSTOP_OPEN)); - DWINUI::MoveBy(0, 25); -} - -void ESDiagClass::Draw() { - CrealityDWINClass::Clear_Screen(1); - CrealityDWINClass::Draw_Title(F("End-stops Diagnostic")); - DWINUI::ClearMainArea(); - DWIN_Draw_Rectangle(0, Color_White, 14, 60, 258, 330); - DWINUI::Draw_Button(BTN_Continue, 86, 250); - DWINUI::cursor.y = 80; - #define ES_LABEL(S) draw_es_label(F(STR_##S)) - #if HAS_X_MIN - ES_LABEL(X_MIN); - #endif - #if HAS_Y_MIN - ES_LABEL(Y_MIN); - #endif - #if HAS_Z_MIN - ES_LABEL(Z_MIN); - #endif - #if HAS_FILAMENT_SENSOR - draw_es_label(F(STR_FILAMENT)); - #endif - Update(); -} - -void ESDiagClass::Update() { - DWINUI::cursor.y = 80; - #define ES_REPORT(S) draw_es_state(READ(S##_PIN) != S##_ENDSTOP_INVERTING) - #if HAS_X_MIN - ES_REPORT(X_MIN); - #endif - #if HAS_Y_MIN - ES_REPORT(Y_MIN); - #endif - #if HAS_Z_MIN - ES_REPORT(Z_MIN); - #endif - #if HAS_FILAMENT_SENSOR - draw_es_state(READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE); - #endif - DWIN_UpdateLCD(); -} - -#endif // HAS_ES_DIAG -#endif // DWIN_CREALITY_LCD_JYERSUI diff --git a/Marlin/src/lcd/e3v2/jyersui/endstop_diag.h b/Marlin/src/lcd/e3v2/jyersui/endstop_diag.h deleted file mode 100644 index 59509739d047..000000000000 --- a/Marlin/src/lcd/e3v2/jyersui/endstop_diag.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#pragma once - -/** - * DWIN End Stops diagnostic page - * Author: Miguel A. Risco-Castillo - * Version: 1.0 - * Date: 2021/11/06 - * - * Modded for JYERSUI by LCH-77 - */ - -class ESDiagClass { -public: - void Draw(); - void Update(); -}; - -extern ESDiagClass ESDiag; diff --git a/Marlin/src/lcd/e3v2/jyersui/gcode_preview.cpp b/Marlin/src/lcd/e3v2/jyersui/gcode_preview.cpp deleted file mode 100644 index 26037a9ce9ba..000000000000 --- a/Marlin/src/lcd/e3v2/jyersui/gcode_preview.cpp +++ /dev/null @@ -1,244 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -/** - * DWIN G-code thumbnail preview - * Author: Miguel A. Risco-Castillo - * version: 2.1 - * Date: 2021/06/19 - * - * Modded for JYERSUI by LCH-77 - */ - -#include "../../../inc/MarlinConfigPre.h" -#if ENABLED(DWIN_CREALITY_LCD_JYERSUI) - -#include "dwin_defines.h" - -#if HAS_GCODE_PREVIEW - -#include "../../../core/types.h" -#include "../../marlinui.h" -#include "../../../sd/cardreader.h" -#include "../../../MarlinCore.h" // for wait_for_user -#include "dwin_lcd.h" -#include "dwinui.h" -#include "dwin.h" -#include "base64.hpp" -#include "gcode_preview.h" - -typedef struct { - char name[13] = ""; //8.3 + null - uint32_t thumbstart = 0; - int thumbsize = 0; - int thumbheight = 0; - int thumbwidth = 0; - uint8_t *thumbdata = nullptr; - float time = 0; - float filament = 0; - float layer = 0; - float width = 0; - float height = 0; - float length = 0; - void setname(const char * const fn); - void clear(); -} fileprop_t; -fileprop_t fileprop; - -void fileprop_t::setname(const char * const fn) { - const uint8_t len = _MIN(sizeof(name) - 1, strlen(fn)); - memcpy(&name[0], fn, len); - name[len] = '\0'; -} - -void fileprop_t::clear() { - fileprop.name[0] = '\0'; - fileprop.thumbstart = 0; - fileprop.thumbsize = 0; - fileprop.thumbheight = 0; - fileprop.thumbwidth = 0; - fileprop.thumbdata = nullptr; - fileprop.time = 0; - fileprop.filament = 0; - fileprop.layer = 0; - fileprop.height = 0; - fileprop.width = 0; - fileprop.length = 0; -} - -void Get_Value(char *buf, const char * const key, float &value) { - char num[10] = ""; - char * posptr = 0; - uint8_t i = 0; - if (!!value) return; - posptr = strstr(buf, key); - if (posptr != nullptr) { - while (i < sizeof(num)) { - char c = posptr[0]; - if (!ISEOL(c) && (c != 0)) { - if ((c > 47 && c < 58) || (c == '.')) num[i++] = c; - posptr++; - } - else { - num[i] = '\0'; - value = atof(num); - return; - } - } - } -} - -bool Has_Preview() { - const char * tbstart = "; thumbnail begin 230x180"; - char * posptr = 0; - uint8_t nbyte = 1; - uint32_t indx = 0; - char buf[256]; - float tmp = 0; - - fileprop.clear(); - fileprop.setname(card.filename); - - card.openFileRead(fileprop.name); - - while ((nbyte > 0) && (indx < 4 * sizeof(buf)) && !fileprop.thumbstart) { - nbyte = card.read(buf, sizeof(buf) - 1); - if (nbyte > 0) { - buf[nbyte] = '\0'; - Get_Value(buf, ";TIME:", fileprop.time); - Get_Value(buf, ";Filament used:", fileprop.filament); - Get_Value(buf, ";Layer height:", fileprop.layer); - Get_Value(buf, ";MINX:", tmp); - Get_Value(buf, ";MAXX:", fileprop.width); - fileprop.width -= tmp; - tmp = 0; - Get_Value(buf, ";MINY:", tmp); - Get_Value(buf, ";MAXY:", fileprop.length); - fileprop.length -= tmp; - tmp = 0; - Get_Value(buf, ";MINZ:", tmp); - Get_Value(buf, ";MAXZ:", fileprop.height); - fileprop.height -= tmp; - posptr = strstr(buf, tbstart); - if (posptr != NULL) { - fileprop.thumbstart = indx + (posptr - &buf[0]); - } - else { - indx += _MAX(10, nbyte - (signed)strlen(tbstart)); - card.setIndex(indx); - } - } - } - - if (!fileprop.thumbstart) { - card.closefile(); - LCD_MESSAGE_F("Thumbnail not found"); - return 0; - } - - // Get the size of the thumbnail - card.setIndex(fileprop.thumbstart + strlen(tbstart)); - for (uint8_t i = 0; i < 16; i++) { - char c = card.get(); - if (!ISEOL(c)) { - buf[i] = c; - } - else { - buf[i] = '\0'; - break; - } - } - fileprop.thumbsize = atoi(buf); - - // Exit if there isn't a thumbnail - if (!fileprop.thumbsize) { - card.closefile(); - LCD_MESSAGE_F("Invalid Thumbnail Size"); - return 0; - } - - uint16_t readed = 0; - uint8_t buf64[fileprop.thumbsize]; - - fileprop.thumbdata = new uint8_t[3 + 3 * (fileprop.thumbsize / 4)]; // Reserve space for the JPEG thumbnail - - while (readed < fileprop.thumbsize) { - uint8_t c = card.get(); - if (!ISEOL(c) && (c != ';') && (c != ' ')) { - buf64[readed] = c; - readed++; - } - } - card.closefile(); - buf64[readed] = 0; - - fileprop.thumbsize = decode_base64(buf64, fileprop.thumbdata); card.closefile(); - DWINUI::WriteToSRAM(0x00, fileprop.thumbsize, fileprop.thumbdata); - delete[] fileprop.thumbdata; - return true; -} - -void Preview_DrawFromSD() { - bool _has_preview = Has_Preview(); - CrealityDWIN.Popup_Handler(PrintConfirm, _has_preview); - if (_has_preview) { - char buf[46]; - char str_1[6] = "", str_2[6] = "", str_3[6] = ""; - // DWIN_Draw_Rectangle(1, Def_Background_Color, 0, 0, DWIN_WIDTH, STATUS_Y - 1); - if (fileprop.time) { - sprintf_P(buf, PSTR("Estimated time: %i:%02i"), (uint16_t)fileprop.time / 3600, ((uint16_t)fileprop.time % 3600) / 60); - DWINUI::Draw_String(20, 10, buf); - } - if (fileprop.filament) { - sprintf_P(buf, PSTR("Filament used: %s m"), dtostrf(fileprop.filament, 1, 2, str_1)); - DWINUI::Draw_String(20, 30, buf); - } - if (fileprop.layer) { - sprintf_P(buf, PSTR("Layer height: %s mm"), dtostrf(fileprop.layer, 1, 2, str_1)); - DWINUI::Draw_String(20, 50, buf); - } - if (fileprop.width) { - sprintf_P(buf, PSTR("Volume: %sx%sx%s mm"), dtostrf(fileprop.width, 1, 1, str_1), dtostrf(fileprop.length, 1, 1, str_2), dtostrf(fileprop.height, 1, 1, str_3)); - DWINUI::Draw_String(20, 70, buf); - } - // DWINUI::Draw_Button(BTN_Print, 26, 290); - // DWINUI::Draw_Button(BTN_Cancel, 146, 290); - DWIN_ICON_Show(0, 0, 1, 21, 90, 0x00); - // Draw_Select_Highlight(true, 290); - DWIN_UpdateLCD(); - } - // else { - // HMI_flag.select_flag = 1; - // wait_for_user = false; - // } -} - -bool Preview_Valid() { - return !!fileprop.thumbstart; -} - -void Preview_Reset() { - fileprop.thumbsize = 0; -} - -#endif // HAS_GCODE_PREVIEW -#endif // DWIN_LCD_PROUI diff --git a/Marlin/src/lcd/e3v2/jyersui/gcode_preview.h b/Marlin/src/lcd/e3v2/jyersui/gcode_preview.h deleted file mode 100644 index d10663e08bb0..000000000000 --- a/Marlin/src/lcd/e3v2/jyersui/gcode_preview.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -/** - * DWIN G-code thumbnail preview - * Author: Miguel A. Risco-Castillo - * version: 2.1 - * Date: 2021/06/19 - */ - -#pragma once - -void Preview_DrawFromSD(); -bool Preview_Valid(); -void Preview_Reset(); diff --git a/Marlin/src/lcd/e3v2/jyersui/lockscreen.cpp b/Marlin/src/lcd/e3v2/jyersui/lockscreen.cpp deleted file mode 100644 index 5ed6dd3317b1..000000000000 --- a/Marlin/src/lcd/e3v2/jyersui/lockscreen.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -/** - * Lock screen implementation for PRO UI - * Author: Miguel A. Risco-Castillo (MRISCOC) - * Version: 2.2.0 - * Date: 2022/04/11 - * - * Modded for JYERSUI by LCH-77 - */ - -#include "../../../inc/MarlinConfigPre.h" - -#if ENABLED(DWIN_CREALITY_LCD_JYERSUI) - -#include "dwin_defines.h" - -#if HAS_LOCKSCREEN - -#include "../common/dwin_color.h" -#include "dwinui.h" -#include "dwin.h" -#include "lockscreen.h" - -LockScreenClass lockScreen; - -uint8_t LockScreenClass::lock_pos = 0; -bool LockScreenClass::unlocked = false; -uint8_t LockScreenClass::rprocess = 0; - -void LockScreenClass::init() { - lock_pos = 0; - unlocked = false; - draw(); -} - -void LockScreenClass::draw() { - CrealityDWINClass::Clear_Screen(1); - CrealityDWINClass::Draw_Title(GET_TEXT_F(MSG_LOCKSCREEN)); - DWINUI::ClearMainArea(); - DWINUI::Draw_Icon(ICON_LOGO, 71, 120); // CREALITY logo - DWINUI::Draw_CenteredString(Color_White, 180, GET_TEXT_F(MSG_LOCKSCREEN_LOCKED)); - DWINUI::Draw_CenteredString(Color_White, 200, GET_TEXT_F(MSG_LOCKSCREEN_UNLOCK)); - DWINUI::Draw_CenteredString(Color_White, 240, F("-> | <-")); - DWIN_Draw_Box(1, BarFill_Color, 0, 260, DWIN_WIDTH, 20); - DWIN_Draw_VLine(Color_Yellow, lock_pos * DWIN_WIDTH / 255, 260, 20); - DWIN_UpdateLCD(); -} - -void LockScreenClass::onEncoder(EncoderState encoder_diffState) { - switch (encoder_diffState) { - case ENCODER_DIFF_CW: lock_pos += 8; break; - case ENCODER_DIFF_CCW: lock_pos -= 8; break; - case ENCODER_DIFF_ENTER: unlocked = (lock_pos == 128); break; - default: break; - } - DWIN_Draw_Box(1, BarFill_Color, 0, 260, DWIN_WIDTH, 20); - DWIN_Draw_VLine(Color_Yellow, lock_pos * DWIN_WIDTH / 255, 260, 20); - DWIN_UpdateLCD(); -} - -#endif // HAS_LOCKSCREEN -#endif // DWIN_CREALITY_LCD_JYERSUI diff --git a/Marlin/src/lcd/e3v2/jyersui/lockscreen.h b/Marlin/src/lcd/e3v2/jyersui/lockscreen.h deleted file mode 100644 index 99c22a37da23..000000000000 --- a/Marlin/src/lcd/e3v2/jyersui/lockscreen.h +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#pragma once - -/** - * Lock screen implementation for PRO UI - * Author: Miguel A. Risco-Castillo (MRISCOC) - * Version: 2.2.0 - * Date: 2022/04/11 - * - * Modded for JYERSUI by LCH-77 - */ - -#include "../../../core/types.h" -#include "../common/encoder.h" -#include - -class LockScreenClass { -private: - static bool unlocked; - static uint8_t lock_pos; -public: - static uint8_t rprocess; - static void init(); - static void onEncoder(EncoderState encoder_diffState); - static void draw(); - static bool isUnlocked() { return unlocked; } -}; - -extern LockScreenClass lockScreen; diff --git a/Marlin/src/lcd/e3v2/jyersui/plot.cpp b/Marlin/src/lcd/e3v2/jyersui/plot.cpp deleted file mode 100644 index c0c283f5c0be..000000000000 --- a/Marlin/src/lcd/e3v2/jyersui/plot.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -/** - * DWIN Single var plot - * Author: Miguel A. Risco-Castillo - * Version: 2.0 - * Date: 2022/01/31 - * - * Modded for JYERSUI by LCH-77 - */ - -#include "../../../inc/MarlinConfigPre.h" - -#ifdef DWIN_CREALITY_LCD_JYERSUI - -#include "dwin_defines.h" - -#ifdef HAS_PIDPLOT - -#include "plot.h" - -#include "../../../core/types.h" -#include "../../marlinui.h" -#include "dwin_lcd.h" -#include "dwinui.h" -#include "dwin.h" - -#define Plot_Bg_Color RGB( 1, 12, 8) - -PlotClass Plot; - -uint16_t grphpoints, r, x2, y2 = 0; -frame_rect_t grphframe = {0}; -float scale = 0; - -void PlotClass::Draw(const frame_rect_t frame, const float max, const float ref) { - grphframe = frame; - grphpoints = 0; - scale = frame.h / max; - x2 = frame.x + frame.w - 1; - y2 = frame.y + frame.h - 1; - r = round((y2) - ref * scale); - DWINUI::Draw_Box(1, Plot_Bg_Color, frame); - for (uint8_t i = 1; i < 4; i++) if (i*50 < frame.w) DWIN_Draw_VLine(Line_Color, i*50 + frame.x, frame.y, frame.h); - DWINUI::Draw_Box(0, Color_White, DWINUI::ExtendFrame(frame, 1)); - DWIN_Draw_HLine(Color_Red, frame.x, r, frame.w); -} - -void PlotClass::Update(const float value) { - if (!scale) return; - uint16_t y = round((y2) - value * scale); - if (grphpoints < grphframe.w) { - DWIN_Draw_Point(Color_Yellow, 1, 1, grphpoints + grphframe.x, y); - } - else { - DWIN_Frame_AreaMove(1, 0, 1, Plot_Bg_Color, grphframe.x, grphframe.y, x2, y2); - if ((grphpoints % 50) == 0) DWIN_Draw_VLine(Line_Color, x2 - 1, grphframe.y + 1, grphframe.h - 2); - DWIN_Draw_Point(Color_Red, 1, 1, x2 - 1, r); - DWIN_Draw_Point(Color_Yellow, 1, 1, x2 - 1, y); - } - grphpoints++; -} - -#endif // HAS_PIDPLOT - -#endif // DWIN_CREALITY_LCD_JYERSUI diff --git a/Marlin/src/lcd/e3v2/jyersui/plot.h b/Marlin/src/lcd/e3v2/jyersui/plot.h deleted file mode 100644 index 1f97eafb71ba..000000000000 --- a/Marlin/src/lcd/e3v2/jyersui/plot.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#pragma once - -/** - * DWIN Single var plot - * Author: Miguel A. Risco-Castillo - * Version: 1.0 - * Date: 2022/01/30 - * - * Modded for JYERSUI by LCH-77 - */ - -#include "dwinui.h" - -class PlotClass { -public: - void Draw(frame_rect_t frame, float max, float ref = 0); - void Update(float value); -}; - -extern PlotClass Plot; diff --git a/Marlin/src/lcd/e3v2/proui/base64.hpp b/Marlin/src/lcd/e3v2/proui/base64.hpp index 7a933df321b8..d82d0b27e8ac 100644 --- a/Marlin/src/lcd/e3v2/proui/base64.hpp +++ b/Marlin/src/lcd/e3v2/proui/base64.hpp @@ -152,7 +152,7 @@ uint16_t encode_base64(unsigned char input[], uint16_t input_length, unsigned ch output += 4; } - switch (input_length % 3) { + switch(input_length % 3) { case 0: output[0] = '\0'; break; @@ -192,7 +192,7 @@ uint16_t decode_base64(unsigned char input[], uint16_t input_length, unsigned ch output += 3; } - switch (output_length % 3) { + switch(output_length % 3) { case 1: output[0] = base64_to_binary(input[0]) << 2 | base64_to_binary(input[1]) >> 4; break; @@ -205,4 +205,4 @@ uint16_t decode_base64(unsigned char input[], uint16_t input_length, unsigned ch return output_length; } -#endif // BASE64_H_INCLUDED +#endif // ifndef diff --git a/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp b/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp index 4257728f73e3..adb23a96646b 100644 --- a/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp +++ b/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp @@ -21,7 +21,7 @@ */ /** - * DWIN G-code thumbnail preview + * DWIN g-code thumbnail preview * Author: Miguel A. Risco-Castillo * version: 2.1 * Date: 2021/06/19 @@ -214,7 +214,9 @@ bool Has_Preview() { void Preview_DrawFromSD() { if (Has_Preview()) { char buf[46]; - char str_1[6] = "", str_2[6] = "", str_3[6] = ""; + char str_1[6] = ""; + char str_2[6] = ""; + char str_3[6] = ""; DWIN_Draw_Rectangle(1, HMI_data.Background_Color, 0, 0, DWIN_WIDTH, STATUS_Y - 1); if (fileprop.time) { sprintf_P(buf, PSTR("Estimated time: %i:%02i"), (uint16_t)fileprop.time / 3600, ((uint16_t)fileprop.time % 3600) / 60); diff --git a/Marlin/src/lcd/e3v2/proui/gcode_preview.h b/Marlin/src/lcd/e3v2/proui/gcode_preview.h index 97cf7fe5ac9d..4417084a242d 100644 --- a/Marlin/src/lcd/e3v2/proui/gcode_preview.h +++ b/Marlin/src/lcd/e3v2/proui/gcode_preview.h @@ -1,5 +1,5 @@ /** - * DWIN G-code thumbnail preview + * DWIN g-code thumbnail preview * Author: Miguel A. Risco-Castillo * version: 2.1 * Date: 2021/06/19 diff --git a/Marlin/src/lcd/extui/ui_api.h b/Marlin/src/lcd/extui/ui_api.h index 84555187677a..933f6a568ee4 100644 --- a/Marlin/src/lcd/extui/ui_api.h +++ b/Marlin/src/lcd/extui/ui_api.h @@ -199,7 +199,7 @@ namespace ExtUI { #endif inline void simulateUserClick() { - #if ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI, DWIN_CREALITY_LCD_JYERSUI) + #if EITHER(HAS_MARLINUI_MENU, EXTENSIBLE_UI) ui.lcd_clicked = true; #endif } diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 7d9cb1b679d6..7707cbb05201 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -49,8 +49,6 @@ MarlinUI ui; #include "e3v2/creality/dwin.h" #elif ENABLED(DWIN_LCD_PROUI) #include "e3v2/proui/dwin.h" -#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) - #include "e3v2/jyersui/dwin.h" #endif #if ENABLED(LCD_PROGRESS_BAR) && !IS_TFTGLCD_PANEL @@ -161,7 +159,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; bool MarlinUI::lcd_clicked; #endif -#if EITHER(HAS_WIRED_LCD, DWIN_CREALITY_LCD_JYERSUI) +#if HAS_WIRED_LCD bool MarlinUI::get_blink() { static uint8_t blink = 0; @@ -1575,7 +1573,6 @@ void MarlinUI::init() { TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged(status_message)); TERN_(DWIN_CREALITY_LCD, DWIN_StatusChanged(status_message)); TERN_(DWIN_LCD_PROUI, DWIN_CheckStatusMessage()); - TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWIN.Update_Status(status_message)); } #if ENABLED(STATUS_MESSAGE_SCROLLING) diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index 1c2c48432322..82b8d78a022c 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -87,11 +87,9 @@ typedef bool (*statusResetFunc_t)(); #endif // HAS_MARLINUI_MENU -#endif // HAS_WIRED_LCD - -#if EITHER(HAS_WIRED_LCD, DWIN_CREALITY_LCD_JYERSUI) #define LCD_UPDATE_INTERVAL TERN(HAS_TOUCH_BUTTONS, 50, 100) -#endif + +#endif // HAS_WIRED_LCD #if HAS_MARLINUI_U8GLIB enum MarlinFont : uint8_t { @@ -393,7 +391,7 @@ class MarlinUI { static void poweroff(); #endif - #if EITHER(HAS_WIRED_LCD, DWIN_CREALITY_LCD_JYERSUI) + #if HAS_WIRED_LCD static bool get_blink(); #endif @@ -630,7 +628,7 @@ class MarlinUI { static bool use_click() { return false; } #endif - #if ENABLED(ADVANCED_PAUSE_FEATURE) && ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) + #if ENABLED(ADVANCED_PAUSE_FEATURE) && ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI, DWIN_LCD_PROUI) static void pause_show_message(const PauseMessage message, const PauseMode mode=PAUSE_MODE_SAME, const uint8_t extruder=active_extruder); #else static void _pause_show_message() {} diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 3d6e14b5f7f1..d21dc92c67c4 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -76,8 +76,6 @@ #include "../lcd/extui/ui_api.h" #elif ENABLED(DWIN_LCD_PROUI) #include "../lcd/e3v2/proui/dwin.h" -#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) - #include "../lcd/e3v2/jyersui/dwin.h" #endif #if ENABLED(HOST_PROMPT_SUPPORT) @@ -502,8 +500,6 @@ typedef struct SettingsDataStruct { // #if ENABLED(DWIN_LCD_PROUI) uint8_t dwin_data[eeprom_data_size]; - #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) - uint8_t dwin_settings[eeprom_data_size]; #endif // @@ -1522,15 +1518,6 @@ void MarlinSettings::postprocess() { } #endif - #if ENABLED(DWIN_CREALITY_LCD_JYERSUI) - { - _FIELD_TEST(dwin_settings); - char dwin_settings[eeprom_data_size] = { 0 }; - CrealityDWIN.Save_Settings(dwin_settings); - EEPROM_WRITE(dwin_settings); - } - #endif - // // Case Light Brightness // @@ -2495,13 +2482,6 @@ void MarlinSettings::postprocess() { EEPROM_READ(dwin_data); if (!validating) DWIN_CopySettingsFrom(dwin_data); } - #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) - { - const char dwin_settings[eeprom_data_size] = { 0 }; - _FIELD_TEST(dwin_settings); - EEPROM_READ(dwin_settings); - if (!validating) CrealityDWIN.Load_Settings(dwin_settings); - } #endif // @@ -2929,8 +2909,6 @@ void MarlinSettings::reset() { #endif #endif - TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWIN.Reset_Settings()); - // // Case Light Brightness // diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index f03213be1fb2..65b79d8bc464 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -53,8 +53,6 @@ #include "../lcd/e3v2/creality/dwin.h" #elif ENABLED(DWIN_LCD_PROUI) #include "../lcd/e3v2/proui/dwin.h" -#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) - #include "../lcd/e3v2/jyersui/dwin.h" #endif #if ENABLED(EXTENSIBLE_UI) @@ -646,14 +644,12 @@ volatile bool Temperature::raw_temps_ready = false; TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_STARTED)); TERN_(DWIN_LCD_PROUI, DWIN_PidTuning(isbed ? PID_BED_START : PID_EXTR_START)); - TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWINClass::DWIN_PidTuning(isbed ? PID_BED_START : PID_EXTR_START)); if (target > GHV(CHAMBER_MAX_TARGET, BED_MAX_TARGET, temp_range[heater_id].maxtemp - (HOTEND_OVERSHOOT))) { SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH)); TERN_(DWIN_LCD_PROUI, DWIN_PidTuning(PID_TEMP_TOO_HIGH)); - TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWINClass::DWIN_PidTuning(PID_TEMP_TOO_HIGH)); TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH))); return; } @@ -748,7 +744,6 @@ volatile bool Temperature::raw_temps_ready = false; SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH)); TERN_(DWIN_LCD_PROUI, DWIN_PidTuning(PID_TEMP_TOO_HIGH)); - TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWINClass::DWIN_PidTuning(PID_TEMP_TOO_HIGH)); TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH))); break; } @@ -787,7 +782,6 @@ volatile bool Temperature::raw_temps_ready = false; TERN_(DWIN_CREALITY_LCD, DWIN_Popup_Temperature(0)); TERN_(DWIN_LCD_PROUI, DWIN_PidTuning(PID_TUNING_TIMEOUT)); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TUNING_TIMEOUT)); - TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWINClass::DWIN_PidTuning(PID_TUNING_TIMEOUT)); TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TIMEOUT))); SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_TIMEOUT); @@ -845,7 +839,6 @@ volatile bool Temperature::raw_temps_ready = false; TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_DONE)); TERN_(DWIN_LCD_PROUI, DWIN_PidTuning(PID_DONE)); - TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWINClass::DWIN_PidTuning(PID_DONE)); goto EXIT_M303; } @@ -864,7 +857,6 @@ volatile bool Temperature::raw_temps_ready = false; TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_DONE)); TERN_(DWIN_LCD_PROUI, DWIN_PidTuning(PID_DONE)); - TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWINClass::DWIN_PidTuning(PID_DONE)); EXIT_M303: TERN_(NO_FAN_SLOWING_IN_PID_TUNING, adaptive_fan_slowing = true); diff --git a/buildroot/tests/STM32F103RE_creality b/buildroot/tests/STM32F103RE_creality index f1478bc2c421..bf1634544937 100755 --- a/buildroot/tests/STM32F103RE_creality +++ b/buildroot/tests/STM32F103RE_creality @@ -13,11 +13,6 @@ use_example_configs "Creality/Ender-3 V2/CrealityV422/CrealityUI" opt_enable MARLIN_DEV_MODE BUFFER_MONITORING BLTOUCH AUTO_BED_LEVELING_BILINEAR Z_SAFE_HOMING exec_test $1 $2 "Ender 3 v2 with CrealityUI" "$3" -use_example_configs "Creality/Ender-3 V2/CrealityV422/CrealityUI" -opt_disable DWIN_CREALITY_LCD -opt_enable DWIN_CREALITY_LCD_JYERSUI AUTO_BED_LEVELING_BILINEAR PROBE_MANUALLY -exec_test $1 $2 "Ender 3 v2 with JyersUI" "$3" - use_example_configs "Creality/Ender-3 S1/STM32F1" opt_disable DWIN_CREALITY_LCD Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN AUTO_BED_LEVELING_BILINEAR CONFIGURATION_EMBEDDING CANCEL_OBJECTS FWRETRACT opt_enable DWIN_LCD_PROUI INDIVIDUAL_AXIS_HOMING_SUBMENU LCD_SET_PROGRESS_MANUALLY STATUS_MESSAGE_SCROLLING \ diff --git a/ini/features.ini b/ini/features.ini index 355544029e0c..6fd8a7950bae 100644 --- a/ini/features.ini +++ b/ini/features.ini @@ -49,7 +49,6 @@ SPI_EEPROM = src_filter=+ DWIN_CREALITY_LCD = src_filter=+ DWIN_LCD_PROUI = src_filter=+ -DWIN_CREALITY_LCD_JYERSUI = src_filter=+ IS_DWIN_MARLINUI = src_filter=+ HAS_GRAPHICAL_TFT = src_filter=+ IS_TFTGLCD_PANEL = src_filter=+ From 5979aab1c7cf96d91b89775ae988e59e3ff40106 Mon Sep 17 00:00:00 2001 From: Farva42 <100859196+Farva42@users.noreply.github.com> Date: Wed, 6 Jul 2022 19:40:09 -0600 Subject: [PATCH 241/241] =?UTF-8?q?=E2=9C=A8=20MAG=5FMOUNTED=5FPROBE=20(#2?= =?UTF-8?q?4420)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Scott Lahteine --- Marlin/Configuration.h | 21 +++++++++++ Marlin/Configuration_adv.h | 3 ++ Marlin/src/inc/Conditionals_LCD.h | 11 +++--- Marlin/src/inc/Conditionals_adv.h | 4 +++ Marlin/src/inc/SanityCheck.h | 13 +++++-- Marlin/src/lcd/menu/menu_motion.cpp | 8 +++++ Marlin/src/module/probe.cpp | 54 +++++++++++++++++++++++++++-- 7 files changed, 105 insertions(+), 9 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 788bd6407553..e05428ad08d8 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1343,6 +1343,27 @@ #define Z_PROBE_RETRACT_X X_MAX_POS #endif +/** + * Magnetically Mounted Probe + * For probes such as Euclid, Klicky, Klackender, etc. + */ +//#define MAG_MOUNTED_PROBE +#if ENABLED(MAG_MOUNTED_PROBE) + #define PROBE_DEPLOY_FEEDRATE (133*60) // (mm/min) Probe deploy speed + #define PROBE_STOW_FEEDRATE (133*60) // (mm/min) Probe stow speed + + #define MAG_MOUNTED_DEPLOY_1 { PROBE_DEPLOY_FEEDRATE, { 245, 114, 30 } } // Move to side Dock & Attach probe + #define MAG_MOUNTED_DEPLOY_2 { PROBE_DEPLOY_FEEDRATE, { 210, 114, 30 } } // Move probe off dock + #define MAG_MOUNTED_DEPLOY_3 { PROBE_DEPLOY_FEEDRATE, { 0, 0, 0 } } // Extra move if needed + #define MAG_MOUNTED_DEPLOY_4 { PROBE_DEPLOY_FEEDRATE, { 0, 0, 0 } } // Extra move if needed + #define MAG_MOUNTED_DEPLOY_5 { PROBE_DEPLOY_FEEDRATE, { 0, 0, 0 } } // Extra move if needed + #define MAG_MOUNTED_STOW_1 { PROBE_STOW_FEEDRATE, { 245, 114, 20 } } // Move to dock + #define MAG_MOUNTED_STOW_2 { PROBE_STOW_FEEDRATE, { 245, 114, 0 } } // Place probe beside remover + #define MAG_MOUNTED_STOW_3 { PROBE_STOW_FEEDRATE, { 230, 114, 0 } } // Side move to remove probe + #define MAG_MOUNTED_STOW_4 { PROBE_STOW_FEEDRATE, { 210, 114, 20 } } // Side move to remove probe + #define MAG_MOUNTED_STOW_5 { PROBE_STOW_FEEDRATE, { 0, 0, 0 } } // Extra move if needed +#endif + // Duet Smart Effector (for delta printers) - https://bit.ly/2ul5U7J // When the pin is defined you can use M672 to set/reset the probe sensitivity. //#define DUET_SMART_EFFECTOR diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index b4627a9830a0..7f85b241a2ea 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1319,6 +1319,9 @@ #define XATC_Y_POSITION Y_CENTER // (mm) Y position to probe #define XATC_Z_OFFSETS { 0, 0, 0 } // Z offsets for X axis sample points #endif + + // Show Deploy / Stow Probe options in the Motion menu. + #define PROBE_DEPLOY_STOW_MENU #endif // Include a page of printer information in the LCD Main Menu diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index b8cf66c8c41a..fc66f5359ccd 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -1047,9 +1047,12 @@ #endif /** - * Set a flag for any type of bed probe, including the paper-test + * Set flags for any form of bed probe */ -#if ANY(HAS_Z_SERVO_PROBE, FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE, TOUCH_MI_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, SOLENOID_PROBE, SENSORLESS_PROBING, RACK_AND_PINION_PROBE, MAGLEV4) +#if ANY(TOUCH_MI_PROBE, Z_PROBE_ALLEN_KEY, SOLENOID_PROBE, Z_PROBE_SLED, RACK_AND_PINION_PROBE, SENSORLESS_PROBING, MAGLEV4, MAG_MOUNTED_PROBE) + #define HAS_STOWABLE_PROBE 1 +#endif +#if ANY(HAS_STOWABLE_PROBE, HAS_Z_SERVO_PROBE, FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE) #define HAS_BED_PROBE 1 #endif @@ -1207,13 +1210,13 @@ #if NONE(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN, HAS_DELTA_SENSORLESS_PROBING) #define USES_Z_MIN_PROBE_PIN 1 #endif - #if Z_HOME_TO_MIN && TERN1(USES_Z_MIN_PROBE_PIN, ENABLED(USE_PROBE_FOR_Z_HOMING)) + #if Z_HOME_TO_MIN && (DISABLED(USES_Z_MIN_PROBE_PIN) || USE_PROBE_FOR_Z_HOMING) #define HOMING_Z_WITH_PROBE 1 #endif #ifndef Z_PROBE_LOW_POINT #define Z_PROBE_LOW_POINT -5 #endif - #if ENABLED(Z_PROBE_ALLEN_KEY) + #if EITHER(Z_PROBE_ALLEN_KEY, MAG_MOUNTED_PROBE) #define PROBE_TRIGGERED_WHEN_STOWED_TEST 1 // Extra test for Allen Key Probe #endif #if MULTIPLE_PROBING > 1 diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 2a204c6cf3c2..9931409976b6 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -79,6 +79,10 @@ #define SERVO_DELAY { 50 } #endif +#if !HAS_STOWABLE_PROBE + #undef PROBE_DEPLOY_STOW_MENU +#endif + #if !HAS_EXTRUDERS #define NO_VOLUMETRICS #undef TEMP_SENSOR_0 diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index f75a59b9b4c1..4412fbb41e5e 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1627,8 +1627,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS */ #if 1 < 0 \ + (DISABLED(BLTOUCH) && HAS_Z_SERVO_PROBE) \ - + COUNT_ENABLED(PROBE_MANUALLY, BLTOUCH, FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE, TOUCH_MI_PROBE, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, RACK_AND_PINION_PROBE, SENSORLESS_PROBING, MAGLEV4) - #error "Please enable only one probe option: PROBE_MANUALLY, SENSORLESS_PROBING, BLTOUCH, FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE, TOUCH_MI_PROBE, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, MAGLEV4, or Z Servo." + + COUNT_ENABLED(PROBE_MANUALLY, BLTOUCH, FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE, TOUCH_MI_PROBE, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, RACK_AND_PINION_PROBE, SENSORLESS_PROBING, MAGLEV4, MAG_MOUNTED_PROBE) + #error "Please enable only one probe option: PROBE_MANUALLY, SENSORLESS_PROBING, BLTOUCH, FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE, TOUCH_MI_PROBE, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, MAGLEV4, MAG_MOUNTED_PROBE or Z Servo." #endif #if HAS_BED_PROBE @@ -1734,13 +1734,20 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #endif #endif + /** + * Mag mounted probe requirements + */ + #if BOTH(MAG_MOUNTED_PROBE, USE_PROBE_FOR_Z_HOMING) && DISABLED(Z_SAFE_HOMING) + #error "MAG_MOUNTED_PROBE requires Z_SAFE_HOMING if it's being used to home Z." + #endif + /** * MagLev V4 probe requirements */ #if ENABLED(MAGLEV4) #if !PIN_EXISTS(MAGLEV_TRIGGER) #error "MAGLEV4 requires MAGLEV_TRIGGER_PIN to be defined." - #elif DISABLED(Z_SAFE_HOMING) + #elif ENABLED(HOMING_Z_WITH_PROBE) && DISABLED(Z_SAFE_HOMING) #error "MAGLEV4 requires Z_SAFE_HOMING." #elif MAGLEV_TRIGGER_DELAY != 15 #error "MAGLEV_TRIGGER_DELAY should not be changed. Comment out this line to continue." diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index cebc2eb31734..3765fe1e4a47 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -348,6 +348,14 @@ void menu_motion() { GCODES_ITEM(MSG_AUTO_Z_ALIGN, F("G34")); #endif + // + // Probe Deploy/Stow + // + #if ENABLED(PROBE_DEPLOY_STOW_MENU) + GCODES_ITEM(MSG_MANUAL_DEPLOY, F("M401")); + GCODES_ITEM(MSG_MANUAL_STOW, F("M402")); + #endif + // // Assisted Bed Tramming // diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index ed8d4a1429a7..afe5ba7a7416 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -264,7 +264,57 @@ xyz_pos_t Probe::offset; // Initialized by settings.load() #endif } -#endif // Z_PROBE_ALLEN_KEY +#elif ENABLED(MAG_MOUNTED_PROBE) + + typedef struct { float fr_mm_min; xyz_pos_t where; } mag_probe_move_t; + + inline void run_deploy_moves_script() { + #ifdef MAG_MOUNTED_DEPLOY_1 + constexpr mag_probe_move_t deploy_1 = MAG_MOUNTED_DEPLOY_1; + do_blocking_move_to(deploy_1.where, MMM_TO_MMS(deploy_1.fr_mm_min)); + #endif + #ifdef MAG_MOUNTED_DEPLOY_2 + constexpr mag_probe_move_t deploy_2 = MAG_MOUNTED_DEPLOY_2; + do_blocking_move_to(deploy_2.where, MMM_TO_MMS(deploy_2.fr_mm_min)); + #endif + #ifdef MAG_MOUNTED_DEPLOY_3 + constexpr mag_probe_move_t deploy_3 = MAG_MOUNTED_DEPLOY_3; + do_blocking_move_to(deploy_3.where, MMM_TO_MMS(deploy_3.fr_mm_min)); + #endif + #ifdef MAG_MOUNTED_DEPLOY_4 + constexpr mag_probe_move_t deploy_4 = MAG_MOUNTED_DEPLOY_4; + do_blocking_move_to(deploy_4.where, MMM_TO_MMS(deploy_4.fr_mm_min)); + #endif + #ifdef MAG_MOUNTED_DEPLOY_5 + constexpr mag_probe_move_t deploy_5 = MAG_MOUNTED_DEPLOY_5; + do_blocking_move_to(deploy_5.where, MMM_TO_MMS(deploy_5.fr_mm_min)); + #endif + } + + inline void run_stow_moves_script() { + #ifdef MAG_MOUNTED_STOW_1 + constexpr mag_probe_move_t stow_1 = MAG_MOUNTED_STOW_1; + do_blocking_move_to(stow_1.where, MMM_TO_MMS(stow_1.fr_mm_min)); + #endif + #ifdef MAG_MOUNTED_STOW_2 + constexpr mag_probe_move_t stow_2 = MAG_MOUNTED_STOW_2; + do_blocking_move_to(stow_2.where, MMM_TO_MMS(stow_2.fr_mm_min)); + #endif + #ifdef MAG_MOUNTED_STOW_3 + constexpr mag_probe_move_t stow_3 = MAG_MOUNTED_STOW_3; + do_blocking_move_to(stow_3.where, MMM_TO_MMS(stow_3.fr_mm_min)); + #endif + #ifdef MAG_MOUNTED_STOW_4 + constexpr mag_probe_move_t stow_4 = MAG_MOUNTED_STOW_4; + do_blocking_move_to(stow_4.where, MMM_TO_MMS(stow_4.fr_mm_min)); + #endif + #ifdef MAG_MOUNTED_STOW_5 + constexpr mag_probe_move_t stow_5 = MAG_MOUNTED_STOW_5; + do_blocking_move_to(stow_5.where, MMM_TO_MMS(stow_5.fr_mm_min)); + #endif + } + +#endif // MAG_MOUNTED_PROBE #if HAS_QUIET_PROBING @@ -350,7 +400,7 @@ FORCE_INLINE void probe_specific_action(const bool deploy) { servo[Z_PROBE_SERVO_NR].move(servo_angles[Z_PROBE_SERVO_NR][deploy ? 0 : 1]); - #elif EITHER(TOUCH_MI_PROBE, Z_PROBE_ALLEN_KEY) + #elif ANY(TOUCH_MI_PROBE, Z_PROBE_ALLEN_KEY, MAG_MOUNTED_PROBE) deploy ? run_deploy_moves_script() : run_stow_moves_script();