From 7707cbf338436d7e0331fc95bc82ead06ca50f90 Mon Sep 17 00:00:00 2001 From: Chris Bagwell Date: Wed, 10 May 2023 05:59:28 -0500 Subject: [PATCH 001/100] =?UTF-8?q?=F0=9F=94=A7=20Fix=20SHAPING=5FMIN=5FFR?= =?UTF-8?q?EQ=20check=20(#25358)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/SanityCheck.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 6e3b4e177d47b..9c54208c538fd 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -4008,13 +4008,13 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive." #endif #endif + #ifdef SHAPING_MIN_FREQ + static_assert((SHAPING_MIN_FREQ) > 0, "SHAPING_MIN_FREQ must be > 0."); + #else + TERN_(INPUT_SHAPING_X, static_assert((SHAPING_FREQ_X) > 0, "SHAPING_FREQ_X must be > 0 or SHAPING_MIN_FREQ must be set.")); + TERN_(INPUT_SHAPING_Y, static_assert((SHAPING_FREQ_Y) > 0, "SHAPING_FREQ_Y must be > 0 or SHAPING_MIN_FREQ must be set.")); + #endif #ifdef __AVR__ - #ifdef SHAPING_MIN_FREQ - static_assert((SHAPING_MIN_FREQ) > 0, "SHAPING_MIN_FREQ must be > 0."); - #else - TERN_(INPUT_SHAPING_X, static_assert((SHAPING_FREQ_X) > 0, "SHAPING_FREQ_X must be > 0 or SHAPING_MIN_FREQ must be set.")); - TERN_(INPUT_SHAPING_Y, static_assert((SHAPING_FREQ_Y) > 0, "SHAPING_FREQ_Y must be > 0 or SHAPING_MIN_FREQ must be set.")); - #endif #if ENABLED(INPUT_SHAPING_X) #if F_CPU > 16000000 static_assert((SHAPING_FREQ_X) == 0 || (SHAPING_FREQ_X) * 2 * 0x10000 >= (STEPPER_TIMER_RATE), "SHAPING_FREQ_X is below the minimum (20) for AVR 20MHz."); From a07b7161e9acac0bb334e31f06b91725ac1106c1 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Thu, 11 May 2023 00:20:08 +0000 Subject: [PATCH 002/100] [cron] Bump distribution date (2023-05-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 759b345647727..5c696db45c390 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 "2023-05-10" +//#define STRING_DISTRIBUTION_DATE "2023-05-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 6e50663215081..8ab8e76ed761b 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 "2023-05-10" + #define STRING_DISTRIBUTION_DATE "2023-05-11" #endif /** From 8fb9b5804e1ff91c4f5d94493db8924a063b0659 Mon Sep 17 00:00:00 2001 From: Muhammad Arslan <55940958+arslan437@users.noreply.github.com> Date: Thu, 11 May 2023 18:18:24 +0500 Subject: [PATCH 003/100] =?UTF-8?q?=E2=9C=A8=20Blackpill-based=20custom=20?= =?UTF-8?q?board=20(#25152)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: striker --- Marlin/src/core/boards.h | 1 + Marlin/src/pins/pins.h | 2 + Marlin/src/pins/stm32f1/pins_CREALITY_V4.h | 8 - .../src/pins/stm32f4/pins_BLACKPILL_CUSTOM.h | 140 ++++++++++++++++++ Marlin/src/pins/stm32f4/pins_TRONXY_V10.h | 7 - ini/stm32f4.ini | 10 ++ 6 files changed, 153 insertions(+), 15 deletions(-) create mode 100644 Marlin/src/pins/stm32f4/pins_BLACKPILL_CUSTOM.h diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 691b03ed0acc5..3820ef8a07cf6 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -451,6 +451,7 @@ #define BOARD_MKS_SKIPR_V1 5244 // MKS SKIPR v1.0 all-in-one board (STM32F407VE) #define BOARD_TRONXY_V10 5245 // TRONXY V10 (STM32F446ZE) #define BOARD_CREALITY_F401RE 5246 // Creality CR4NS200141C13 (STM32F401RE) as found in the Ender-5 S1 +#define BOARD_BLACKPILL_CUSTOM 5247 // Custom board based on STM32F401CDU6. // // ARM Cortex-M7 diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 5bf3b08810088..369506a748738 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -792,6 +792,8 @@ #include "stm32f4/pins_TRONXY_V10.h" // STM32F4 env:STM32F446_tronxy #elif MB(CREALITY_F401RE) #include "stm32f4/pins_CREALITY_F401.h" // STM32F4 env:STM32F401RE_creality +#elif MB(BLACKPILL_CUSTOM) + #include "stm32f4/pins_BLACKPILL_CUSTOM.h" // STM32F4 env:STM32F401CD_blackpill_stlink // // ARM Cortex M7 diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h index 6cb4d48d58c14..3d0a1885af75c 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h @@ -299,11 +299,3 @@ #define UART4_RX_PIN PC11 // default uses sdcard SDIO_D3 #define UART5_TX_PIN PC12 // default uses sdcard SDIO_CK #define UART5_RX_PIN PD2 // default uses sdcard SDIO_CMD - -// SDIO pins -#define SDIO_D0_PIN PC8 -#define SDIO_D1_PIN PC9 -#define SDIO_D2_PIN PC10 -#define SDIO_D3_PIN PC11 -#define SDIO_CK_PIN PC12 -#define SDIO_CMD_PIN PD2 diff --git a/Marlin/src/pins/stm32f4/pins_BLACKPILL_CUSTOM.h b/Marlin/src/pins/stm32f4/pins_BLACKPILL_CUSTOM.h new file mode 100644 index 0000000000000..9049a553fb49b --- /dev/null +++ b/Marlin/src/pins/stm32f4/pins_BLACKPILL_CUSTOM.h @@ -0,0 +1,140 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 "env_validate.h" + +#ifndef BOARD_INFO_NAME + #define BOARD_INFO_NAME "Custom Blackpill" +#endif + +#ifndef DEFAULT_MACHINE_NAME + #define DEFAULT_MACHINE_NAME "SLA Printer" +#endif + +#define DISABLE_DEBUG false // DISABLE_(DEBUG|JTAG) is not supported for STM32F4. +#define ALLOW_STM32F4 +#define BOARD_NO_NATIVE_USB + +// +// EEPROM +// +#if NO_EEPROM_SELECTED + #define IIC_BL24CXX_EEPROM // EEPROM on I2C-0 + //#define SDCARD_EEPROM_EMULATION +#endif + +// +// Servos +// +#if !defined(SERVO0_PIN) && !defined(HAS_PIN_27_BOARD) + #define SERVO0_PIN PC13 // BLTouch OUT +#endif + +#define LED_PIN PC13 + +// +// Limit Switches +// +#define Z_STOP_PIN PA15 +#define X_STOP_PIN PA11 +#define Y_STOP_PIN PA12 + +// +// Filament Runout Sensor +// +#define FIL_RUNOUT_PIN PB15 // "Pulled-high" + +// +// Steppers +// +#define X_STEP_PIN PB0 +#define X_DIR_PIN PB1 +#define X_ENABLE_PIN PB2 // Shared + +#define Y_STEP_PIN PB3 +#define Y_DIR_PIN PB4 +#define Y_ENABLE_PIN X_ENABLE_PIN + +#define Z_STEP_PIN PB8 +#define Z_DIR_PIN PB5 +#define Z_ENABLE_PIN X_ENABLE_PIN + +#define E0_STEP_PIN PB9 +#define E0_DIR_PIN PB10 +#define E0_ENABLE_PIN X_ENABLE_PIN + +// +// Temperature Sensors +// +#define TEMP_0_PIN PA0 // TH1 +#define TEMP_BED_PIN PA1 // TB1 + +// +// Heaters / Fans +// +#define HEATER_BED_PIN PA2 // HOT BED +#define FAN1_PIN PA8 // extruder fan +#define HEATER_0_PIN PA3 // HEATER1 + +// +// Encoder pins +// +#if ENABLED(OLED_PANEL_TINYBOY2) +#define BTN_EN1 PB12 +#define BTN_EN2 PB13 +#define BTN_ENC PB14 +#define BEEPER_PIN PC15 +#endif + +// +// SD Card +// +#define ONBOARD_SPI_DEVICE 1 +// #define ONBOARD_SD_CS_PIN PA4 // SDSS + +#define SD_DETECT_PIN -1 +#define SDCARD_CONNECTION ONBOARD +//#define SDIO_SUPPORT +#define NO_SD_HOST_DRIVE // This board's SD is only seen by the printer + +#if SD_CONNECTION_IS(ONBOARD) + #define SDSS PA4 + #define SD_SCK_PIN PA5 + #define SD_MISO_PIN PA6 + #define SD_MOSI_PIN PA7 +#endif + +// Pins for documentation and sanity checks only. +// Changing these will not change the pin they are on. + +// Hardware UART pins +#define UART1_TX_PIN PA9 // default uses CH340 RX +#define UART1_RX_PIN PA10 // default uses CH340 TX +#define UART2_TX_PIN PA2 // default uses HEATER_BED_PIN +#define UART2_RX_PIN PA3 // not connected +#define UART3_TX_PIN PB10 // default uses LCD connector +#define UART3_RX_PIN PB11 // default uses LCD connector +#define UART4_TX_PIN PC10 // default uses sdcard SDIO_D2 +#define UART4_RX_PIN PC11 // default uses sdcard SDIO_D3 +#define UART5_TX_PIN PC12 // default uses sdcard SDIO_CK +#define UART5_RX_PIN PD2 // default uses sdcard SDIO_CMD diff --git a/Marlin/src/pins/stm32f4/pins_TRONXY_V10.h b/Marlin/src/pins/stm32f4/pins_TRONXY_V10.h index 1677b45697bc7..d5752e43dccf5 100644 --- a/Marlin/src/pins/stm32f4/pins_TRONXY_V10.h +++ b/Marlin/src/pins/stm32f4/pins_TRONXY_V10.h @@ -255,10 +255,3 @@ #define SD_DETECT_PIN -1 // PF0, but not connected #define SDIO_CLOCK 4500000 #define SDIO_READ_RETRIES 16 - -#define SDIO_D0_PIN PC8 -#define SDIO_D1_PIN PC9 -#define SDIO_D2_PIN PC10 -#define SDIO_D3_PIN PC11 -#define SDIO_CK_PIN PC12 -#define SDIO_CMD_PIN PD2 diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 29c3f5b9597af..7dfffe47646bc 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -772,3 +772,13 @@ build_flags = ${stm32_variant.build_flags} -DSTM32F4xx build_unflags = ${stm32_variant.build_unflags} -fno-rtti -DUSBCON -DUSBD_USE_CDC + +# +# Blackpill +# +[env:STM32F401CD_blackpill_stlink] +platform = ${common_stm32.platform} +extends = common_stm32 +board = blackpill_f401cc +upload_protocol = stlink +monitor_speed = 115200 From 01f5bd333055e919677d95e05bec1f5f067374a4 Mon Sep 17 00:00:00 2001 From: StevilKnevil Date: Fri, 12 May 2023 01:09:02 +0100 Subject: [PATCH 004/100] =?UTF-8?q?=F0=9F=9A=B8=20Improved=20MPCTEMP=20aut?= =?UTF-8?q?otune=20(#25503)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 56 ++-- Marlin/src/core/millis_t.h | 1 + Marlin/src/gcode/temp/M306.cpp | 14 +- Marlin/src/module/temperature.cpp | 430 +++++++++++++++++++----------- Marlin/src/module/temperature.h | 67 ++++- 5 files changed, 386 insertions(+), 182 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 8818b04a84f2f..fee89898a3754 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -650,14 +650,18 @@ // @section hotend temp -// Enable PIDTEMP for PID control or MPCTEMP for Predictive Model. -// temperature control. Disable both for bang-bang heating. -#define PIDTEMP // See the PID Tuning Guide at https://reprap.org/wiki/PID_Tuning -//#define MPCTEMP // ** EXPERIMENTAL ** +/** + * Temperature Control + * + * (NONE) : Bang-bang heating + * PIDTEMP : PID temperature control (~4.1K) + * MPCTEMP : Predictive Model temperature control. (~1.8K without auto-tune) + */ +#define PIDTEMP // See the PID Tuning Guide at https://reprap.org/wiki/PID_Tuning +//#define MPCTEMP // ** EXPERIMENTAL ** See https://marlinfw.org/docs/features/model_predictive_control.html -#define BANG_MAX 255 // Limits current to nozzle while in bang-bang mode; 255=full current -#define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current -#define PID_K1 0.95 // Smoothing factor within any PID loop +#define PID_MAX 255 // Limit hotend current while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current +#define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) //#define PID_DEBUG // Print PID debug data to the serial port. Use 'M303 D' to toggle activation. @@ -675,6 +679,8 @@ #define DEFAULT_Ki 1.08 #define DEFAULT_Kd 114.00 #endif +#else + #define BANG_MAX 255 // Limit hotend current while in bang-bang mode; 255=full current #endif /** @@ -686,11 +692,11 @@ * @section mpctemp */ #if ENABLED(MPCTEMP) - //#define MPC_AUTOTUNE // Include a method to do MPC auto-tuning (~5664-5882 bytes of flash) - //#define MPC_EDIT_MENU // Add MPC editing to the "Advanced Settings" menu. (~1300 bytes of flash) + //#define MPC_AUTOTUNE // Include a method to do MPC auto-tuning (~6.3K bytes of flash) + //#define MPC_EDIT_MENU // Add MPC editing to the "Advanced Settings" menu. (~1.3K bytes of flash) //#define MPC_AUTOTUNE_MENU // Add MPC auto-tuning to the "Advanced Settings" menu. (~350 bytes of flash) - #define MPC_MAX BANG_MAX // (0..255) Current to nozzle while MPC is active. + #define MPC_MAX 255 // (0..255) Current to nozzle while MPC is active. #define MPC_HEATER_POWER { 40.0f } // (W) Heat cartridge powers. #define MPC_INCLUDE_FAN // Model the fan speed? @@ -725,32 +731,30 @@ //====================== PID > Bed Temperature Control ====================== //=========================================================================== +// @section bed temp + +/** + * Max Bed Power + * Applies to all forms of bed control (PID, bang-bang, and bang-bang with hysteresis). + * When set to any value below 255, enables a form of PWM to the bed that acts like a divider + * so don't use it unless you are OK with PWM on your bed. (See the comment on enabling PIDTEMPBED) + */ +#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current + /** * PID Bed Heating * - * If this option is enabled set PID constants below. - * If this option is disabled, bang-bang will be used and BED_LIMIT_SWITCHING will enable hysteresis. - * * The PID frequency will be the same as the extruder PWM. * If PID_dT is the default, and correct for the hardware/configuration, that means 7.689Hz, * which is fine for driving a square wave into a resistive load and does not significantly * impact FET heating. This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W * heater. If your configuration is significantly different than this and you don't understand * the issues involved, don't use bed PID until someone else verifies that your hardware works. - * @section bed temp + * + * With this option disabled, bang-bang will be used. BED_LIMIT_SWITCHING enables hysteresis. */ //#define PIDTEMPBED -//#define BED_LIMIT_SWITCHING - -/** - * Max Bed Power - * Applies to all forms of bed control (PID, bang-bang, and bang-bang with hysteresis). - * When set to any value below 255, enables a form of PWM to the bed that acts like a divider - * so don't use it unless you are OK with PWM on your bed. (See the comment on enabling PIDTEMPBED) - */ -#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current - #if ENABLED(PIDTEMPBED) //#define MIN_BED_POWER 0 //#define PID_BED_DEBUG // Print Bed PID debug data to the serial port. @@ -762,7 +766,9 @@ #define DEFAULT_bedKd 305.4 // FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. -#endif // PIDTEMPBED +#else + //#define BED_LIMIT_SWITCHING // Keep the bed temperature within BED_HYSTERESIS of the target +#endif //=========================================================================== //==================== PID > Chamber Temperature Control ==================== diff --git a/Marlin/src/core/millis_t.h b/Marlin/src/core/millis_t.h index 95bc40e1ecbbe..e7032a2e55791 100644 --- a/Marlin/src/core/millis_t.h +++ b/Marlin/src/core/millis_t.h @@ -28,6 +28,7 @@ typedef uint32_t millis_t; #define SEC_TO_MS(N) millis_t((N)*1000UL) #define MIN_TO_MS(N) SEC_TO_MS((N)*60UL) #define MS_TO_SEC(N) millis_t((N)/1000UL) +#define MS_TO_SEC_PRECISE(N) (float(N)/1000.0f) #define PENDING(NOW,SOON) ((int32_t)(NOW-(SOON))<0) #define ELAPSED(NOW,SOON) (!PENDING(NOW,SOON)) diff --git a/Marlin/src/gcode/temp/M306.cpp b/Marlin/src/gcode/temp/M306.cpp index d0c005ea4eb1b..7d2d94952ff08 100644 --- a/Marlin/src/gcode/temp/M306.cpp +++ b/Marlin/src/gcode/temp/M306.cpp @@ -42,7 +42,10 @@ * R Sensor responsiveness (= transfer coefficient / heat capcity). * * With MPC_AUTOTUNE: - * T Autotune the specified or active extruder. + * T Autotune the extruder specified with 'E' or the active extruder. + * S0 : Autotuning method AUTO (default) + * S1 : Autotuning method DIFFERENTIAL + * S2 : Autotuning method ASYMPTOTIC */ void GcodeSuite::M306() { @@ -54,8 +57,15 @@ void GcodeSuite::M306() { #if ENABLED(MPC_AUTOTUNE) if (parser.seen_test('T')) { + Temperature::MPCTuningType tuning_type; + const uint8_t type = parser.byteval('S', 0); + switch (type) { + case 1: tuning_type = Temperature::MPCTuningType::FORCE_DIFFERENTIAL; break; + case 2: tuning_type = Temperature::MPCTuningType::FORCE_ASYMPTOTIC; break; + default: tuning_type = Temperature::MPCTuningType::AUTO; break; + } LCD_MESSAGE(MSG_MPC_AUTOTUNE); - thermalManager.MPC_autotune(e); + thermalManager.MPC_autotune(e, tuning_type); ui.reset_status(); return; } diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index a92d070183190..8bcaf5d83fc51 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -722,16 +722,14 @@ volatile bool Temperature::raw_temps_ready = false; TERN_(DWIN_PID_TUNE, DWIN_PidTuning(isbed ? PIDTEMPBED_START : PIDTEMP_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); + 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_PID_TUNE, DWIN_PidTuning(PID_TEMP_TOO_HIGH)); TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH))); return; } - SERIAL_ECHOPGM(STR_PID_AUTOTUNE); - SERIAL_ECHOLNPGM(STR_PID_AUTOTUNE_START); + SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_AUTOTUNE_START); disable_all_heaters(); TERN_(AUTO_POWER_CONTROL, powerManager.power_on()); @@ -816,8 +814,7 @@ volatile bool Temperature::raw_temps_ready = false; #define MAX_OVERSHOOT_PID_AUTOTUNE 30 #endif if (current_temp > target + MAX_OVERSHOOT_PID_AUTOTUNE) { - SERIAL_ECHOPGM(STR_PID_AUTOTUNE); - SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH); + 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_PID_TUNE, DWIN_PidTuning(PID_TEMP_TOO_HIGH)); TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH))); @@ -859,14 +856,12 @@ volatile bool Temperature::raw_temps_ready = false; TERN_(DWIN_PID_TUNE, DWIN_PidTuning(PID_TUNING_TIMEOUT)); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::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); + SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_TIMEOUT); break; } if (cycles > ncycles && cycles > 2) { - SERIAL_ECHOPGM(STR_PID_AUTOTUNE); - SERIAL_ECHOLNPGM(STR_PID_AUTOTUNE_FINISHED); + SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_AUTOTUNE_FINISHED); TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_AUTOTUNE_DONE))); #if EITHER(PIDTEMPBED, PIDTEMPCHAMBER) @@ -944,166 +939,175 @@ volatile bool Temperature::raw_temps_ready = false; #define SINGLEFAN 1 #endif - void Temperature::MPC_autotune(const uint8_t e) { - auto housekeeping = [] (millis_t &ms, const uint8_t e, celsius_float_t ¤t_temp, millis_t &next_report_ms) { - ms = millis(); + #define DEBUG_MPC_AUTOTUNE 1 - if (updateTemperaturesIfReady()) { // temp sample ready - current_temp = degHotend(e); - TERN_(HAS_FAN_LOGIC, manage_extruder_fans(ms)); - } + millis_t Temperature::MPC_autotuner::curr_time_ms, Temperature::MPC_autotuner::next_report_ms; - if (ELAPSED(ms, next_report_ms)) { - next_report_ms += 1000UL; + celsius_float_t Temperature::MPC_autotuner::temp_samples[16]; + uint8_t Temperature::MPC_autotuner::sample_count; + uint16_t Temperature::MPC_autotuner::sample_distance; - print_heater_states(e); - SERIAL_EOL(); - } + // Parameters from differential analysis + celsius_float_t Temperature::MPC_autotuner::temp_fastest; - hal.idletask(); - TERN(DWIN_CREALITY_LCD, DWIN_Update(), ui.update()); - - if (!wait_for_heatup) { - SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_INTERRUPTED); - TERN_(DWIN_LCD_PROUI, DWIN_MPCTuning(MPC_INTERRUPTED)); - return true; - } - - return false; - }; - - struct OnExit { - uint8_t e; - OnExit(const uint8_t _e) { this->e = _e; } - ~OnExit() { - wait_for_heatup = false; - - ui.reset_status(); - - temp_hotend[e].target = 0.0f; - temp_hotend[e].soft_pwm_amount = 0; - #if HAS_FAN - set_fan_speed(TERN(SINGLEFAN, 0, e), 0); - planner.sync_fan_speeds(fan_speed); - #endif - - do_z_clearance(MPC_TUNING_END_Z, false); + #if HAS_FAN + float Temperature::MPC_autotuner::power_fan255; + #endif - TERN_(TEMP_TUNING_MAINTAIN_FAN, adaptive_fan_slowing = true); - } - } on_exit(e); + Temperature::MPC_autotuner::MPC_autotuner(const uint8_t extruderIdx) : e(extruderIdx) { + TERN_(TEMP_TUNING_MAINTAIN_FAN, adaptive_fan_slowing = false); + } - SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_START, e); - MPCHeaterInfo &hotend = temp_hotend[e]; - MPC_t &mpc = hotend.mpc; + Temperature::MPC_autotuner::~MPC_autotuner() { + wait_for_heatup = false; - TERN_(TEMP_TUNING_MAINTAIN_FAN, adaptive_fan_slowing = false); + ui.reset_status(); - // Move to center of bed, just above bed height and cool with max fan - gcode.home_all_axes(true); - disable_all_heaters(); + temp_hotend[e].target = 0.0f; + temp_hotend[e].soft_pwm_amount = 0; #if HAS_FAN - zero_fan_speeds(); - set_fan_speed(TERN(SINGLEFAN, 0, e), 255); + set_fan_speed(TERN(SINGLEFAN, 0, e), 0); planner.sync_fan_speeds(fan_speed); #endif - do_blocking_move_to(xyz_pos_t(MPC_TUNING_POS)); - SERIAL_ECHOLNPGM(STR_MPC_COOLING_TO_AMBIENT); - #if ENABLED(DWIN_LCD_PROUI) - DWIN_MPCTuning(MPCTEMP_START); - LCD_ALERTMESSAGE(MSG_MPC_COOLING_TO_AMBIENT); - #else - LCD_MESSAGE(MSG_COOLING); - #endif + do_z_clearance(MPC_TUNING_END_Z, false); - millis_t ms = millis(), next_report_ms = ms, next_test_ms = ms + 10000UL; - celsius_float_t current_temp = degHotend(e), - ambient_temp = current_temp; + TERN_(TEMP_TUNING_MAINTAIN_FAN, adaptive_fan_slowing = true); + } + Temperature::MPC_autotuner::MeasurementState Temperature::MPC_autotuner::measure_ambient_temp() { + init_timers(); + const millis_t test_interval_ms = 10000UL; + millis_t next_test_ms = curr_time_ms + test_interval_ms; + ambient_temp = current_temp = degHotend(e); wait_for_heatup = true; + for (;;) { // Can be interrupted with M108 - if (housekeeping(ms, e, current_temp, next_report_ms)) return; + if (housekeeping() == CANCELLED) return CANCELLED; - if (ELAPSED(ms, next_test_ms)) { + if (ELAPSED(curr_time_ms, next_test_ms)) { if (current_temp >= ambient_temp) { ambient_temp = (ambient_temp + current_temp) / 2.0f; break; } ambient_temp = current_temp; - next_test_ms += 10000UL; + next_test_ms += test_interval_ms; } } wait_for_heatup = false; - #if HAS_FAN - set_fan_speed(TERN(SINGLEFAN, 0, e), 0); - planner.sync_fan_speeds(fan_speed); + #if ENABLED(DEBUG_MPC_AUTOTUNE) + SERIAL_ECHOLNPGM("MPC_autotuner::measure_ambient_temp() Completed"); + SERIAL_ECHOLNPGM("====="); + SERIAL_ECHOLNPGM("ambient_temp ", get_ambient_temp()); #endif - hotend.modeled_ambient_temp = ambient_temp; + return SUCCESS; + } + + Temperature::MPC_autotuner::MeasurementState Temperature::MPC_autotuner::measure_heatup() { + init_timers(); + constexpr millis_t test_interval_ms = 1000UL; + millis_t next_test_time_ms = curr_time_ms + test_interval_ms; + MPCHeaterInfo &hotend = temp_hotend[e]; + + current_temp = degHotend(e); + millis_t heat_start_time_ms = curr_time_ms; + sample_count = 0; + sample_distance = 1; + t1_time = 0; - SERIAL_ECHOLNPGM(STR_MPC_HEATING_PAST_200); - TERN(DWIN_LCD_PROUI, LCD_ALERTMESSAGE(MSG_MPC_HEATING_PAST_200), LCD_MESSAGE(MSG_HEATING)); hotend.target = 200.0f; // So M105 looks nice hotend.soft_pwm_amount = (MPC_MAX) >> 1; - const millis_t heat_start_time = next_test_ms = ms; - celsius_float_t temp_samples[16]; - uint8_t sample_count = 0; - uint16_t sample_distance = 1; - float t1_time = 0; + + // Initialise rate of change to to steady state at current time + temp_samples[0] = temp_samples[1] = temp_samples[2] = current_temp; + time_fastest = rate_fastest = 0; wait_for_heatup = true; for (;;) { // Can be interrupted with M108 - if (housekeeping(ms, e, current_temp, next_report_ms)) return; + if (housekeeping() == CANCELLED) return CANCELLED; + + if (ELAPSED(curr_time_ms, next_test_time_ms)) { + if (current_temp < 100.0f) { + // Initial regime (below 100deg): Measure rate of change of heating for differential tuning + + // Update the buffer of previous readings + temp_samples[0] = temp_samples[1]; + temp_samples[1] = temp_samples[2]; + temp_samples[2] = current_temp; + + // Measure the rate of change of temperature, https://en.wikipedia.org/wiki/Symmetric_derivative + const float h = MS_TO_SEC_PRECISE(test_interval_ms), + curr_rate = (temp_samples[2] - temp_samples[0]) / 2 * h; + if (curr_rate > rate_fastest) { + // Update fastest values + rate_fastest = curr_rate; + temp_fastest = temp_samples[1]; + time_fastest = get_elapsed_heating_time(); + } + + next_test_time_ms += test_interval_ms; + + } + else if (current_temp < 200.0f) { + // Second regime (after 100deg) measure 3 points to determine asymptotic temperature - if (ELAPSED(ms, next_test_ms)) { - // Record samples between 100C and 200C - if (current_temp >= 100.0f) { // If there are too many samples, space them more widely if (sample_count == COUNT(temp_samples)) { for (uint8_t i = 0; i < COUNT(temp_samples) / 2; i++) - temp_samples[i] = temp_samples[i*2]; + temp_samples[i] = temp_samples[i * 2]; sample_count /= 2; sample_distance *= 2; } - if (sample_count == 0) t1_time = float(ms - heat_start_time) / 1000.0f; + if (sample_count == 0) t1_time = MS_TO_SEC_PRECISE(curr_time_ms - heat_start_time_ms); temp_samples[sample_count++] = current_temp; - } - if (current_temp >= 200.0f) break; + if (current_temp >= 200.0f) break; + + next_test_time_ms += test_interval_ms * sample_distance; - next_test_ms += 1000UL * sample_distance; + } + else { + // Third regime (after 200deg) finished gathering data so finish + break; + } } } wait_for_heatup = false; hotend.soft_pwm_amount = 0; - // Calculate physical constants from three equally-spaced samples - sample_count = (sample_count + 1) / 2 * 2 - 1; - const float t1 = temp_samples[0], - t2 = temp_samples[(sample_count - 1) >> 1], - t3 = temp_samples[sample_count - 1]; - 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)); + elapsed_heating_time = MS_TO_SEC_PRECISE(curr_time_ms - heat_start_time_ms); - mpc.ambient_xfer_coeff_fan0 = mpc.heater_power * (MPC_MAX) / 255 / (asymp_temp - ambient_temp); - mpc.block_heat_capacity = mpc.ambient_xfer_coeff_fan0 / block_responsiveness; - mpc.sensor_responsiveness = block_responsiveness / (1.0f - (ambient_temp - asymp_temp) * exp(-block_responsiveness * t1_time) / (t1 - asymp_temp)); - TERN_(MPC_INCLUDE_FAN, mpc.fan255_adjustment = 0.0f); + // Ensure sample count is odd so that we have 3 equally spaced samples + if (sample_count == 0) return FAILED; + if (sample_count % 2 == 0) sample_count--; - hotend.modeled_block_temp = asymp_temp + (ambient_temp - asymp_temp) * exp(-block_responsiveness * (ms - heat_start_time) / 1000.0f); - hotend.modeled_sensor_temp = current_temp; + #if ENABLED(DEBUG_MPC_AUTOTUNE) + SERIAL_ECHOLNPGM("MPC_autotuner::measure_heatup() Completed"); + SERIAL_ECHOLNPGM("====="); + SERIAL_ECHOLNPGM("t1_time ", t1_time); + SERIAL_ECHOLNPGM("sample_count ", sample_count); + SERIAL_ECHOLNPGM("sample_distance ", sample_distance); + for (uint8_t i = 0; i < sample_count; i++) + SERIAL_ECHOLNPGM("sample ", i, " : ", temp_samples[i]); + SERIAL_ECHOLNPGM("t1 ", get_sample_1_temp(), " t2 ", get_sample_2_temp(), " t3 ", get_sample_3_temp()); + #endif + + return SUCCESS; + } + + Temperature::MPC_autotuner::MeasurementState Temperature::MPC_autotuner::measure_transfer() { + init_timers(); + const millis_t test_interval_ms = SEC_TO_MS(MPC_dT); + millis_t next_test_ms = curr_time_ms + test_interval_ms; + MPCHeaterInfo &hotend = temp_hotend[e]; + MPC_t &mpc = hotend.mpc; - // Allow the system to stabilize under MPC, then get a better measure of ambient loss with and without fan - SERIAL_ECHOLNPGM(STR_MPC_MEASURING_AMBIENT, hotend.modeled_block_temp); - TERN(DWIN_LCD_PROUI, LCD_ALERTMESSAGE(MSG_MPC_MEASURING_AMBIENT), LCD_MESSAGE(MSG_MPC_MEASURING_AMBIENT)); - hotend.target = hotend.modeled_block_temp; - next_test_ms = ms + MPC_dT * 1000; constexpr millis_t settle_time = 20000UL, test_duration = 20000UL; - millis_t settle_end_ms = ms + settle_time, + millis_t settle_end_ms = curr_time_ms + settle_time, test_end_ms = settle_end_ms + test_duration; float total_energy_fan0 = 0.0f; #if HAS_FAN @@ -1114,67 +1118,193 @@ volatile bool Temperature::raw_temps_ready = false; wait_for_heatup = true; for (;;) { // Can be interrupted with M108 - if (housekeeping(ms, e, current_temp, next_report_ms)) return; + if (housekeeping() == CANCELLED) return CANCELLED; - if (ELAPSED(ms, next_test_ms)) { + if (ELAPSED(curr_time_ms, next_test_ms)) { hotend.soft_pwm_amount = (int)get_pid_output_hotend(e) >> 1; - if (ELAPSED(ms, settle_end_ms) && !ELAPSED(ms, test_end_ms) && TERN1(HAS_FAN, !fan0_done)) + if (ELAPSED(curr_time_ms, settle_end_ms) && !ELAPSED(curr_time_ms, test_end_ms) && TERN1(HAS_FAN, !fan0_done)) total_energy_fan0 += mpc.heater_power * hotend.soft_pwm_amount / 127 * MPC_dT + (last_temp - current_temp) * mpc.block_heat_capacity; #if HAS_FAN - else if (ELAPSED(ms, test_end_ms) && !fan0_done) { + else if (ELAPSED(curr_time_ms, test_end_ms) && !fan0_done) { set_fan_speed(TERN(SINGLEFAN, 0, e), 255); planner.sync_fan_speeds(fan_speed); - settle_end_ms = ms + settle_time; + settle_end_ms = curr_time_ms + settle_time; test_end_ms = settle_end_ms + test_duration; fan0_done = true; } - else if (ELAPSED(ms, settle_end_ms) && !ELAPSED(ms, test_end_ms)) + else if (ELAPSED(curr_time_ms, settle_end_ms) && !ELAPSED(curr_time_ms, test_end_ms)) total_energy_fan255 += mpc.heater_power * hotend.soft_pwm_amount / 127 * MPC_dT + (last_temp - current_temp) * mpc.block_heat_capacity; #endif - else if (ELAPSED(ms, test_end_ms)) break; + else if (ELAPSED(curr_time_ms, test_end_ms)) break; last_temp = current_temp; - next_test_ms += MPC_dT * 1000; + next_test_ms += test_interval_ms; } - if (!WITHIN(current_temp, t3 - 15.0f, hotend.target + 15.0f)) { + // Ensure we don't drift too far from the window between the last sampled temp and the target temperature + if (!WITHIN(current_temp, get_sample_3_temp() - 15.0f, hotend.target + 15.0f)) { SERIAL_ECHOLNPGM(STR_MPC_TEMPERATURE_ERROR); TERN_(DWIN_LCD_PROUI, DWIN_MPCTuning(MPC_TEMP_ERROR)); - break; + wait_for_heatup = false; + return FAILED; } } wait_for_heatup = false; - const float power_fan0 = total_energy_fan0 * 1000 / test_duration; - mpc.ambient_xfer_coeff_fan0 = power_fan0 / (hotend.target - ambient_temp); + power_fan0 = total_energy_fan0 / MS_TO_SEC_PRECISE(test_duration); + TERN_(HAS_FAN, power_fan255 = (total_energy_fan255 * 1000) / test_duration); + + #if ENABLED(DEBUG_MPC_AUTOTUNE) + SERIAL_ECHOLNPGM("MPC_autotuner::measure_transfer() Completed"); + SERIAL_ECHOLNPGM("====="); + SERIAL_ECHOLNPGM("power_fan0 ", power_fan0); + TERN_(HAS_FAN, SERIAL_ECHOLNPGM("power_fan255 ", power_fan255)); + #endif + + return SUCCESS; + } + + Temperature::MPC_autotuner::MeasurementState Temperature::MPC_autotuner::housekeeping() { + const millis_t report_interval_ms = 1000UL; + curr_time_ms = millis(); + + if (updateTemperaturesIfReady()) { // temp sample ready + current_temp = degHotend(e); + TERN_(HAS_FAN_LOGIC, manage_extruder_fans(curr_time_ms)); + } + + if (ELAPSED(curr_time_ms, next_report_ms)) { + next_report_ms += report_interval_ms; + print_heater_states(e); + SERIAL_EOL(); + } + + hal.idletask(); + TERN(DWIN_CREALITY_LCD, DWIN_Update(), ui.update()); + + if (!wait_for_heatup) { + SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_INTERRUPTED); + TERN_(DWIN_LCD_PROUI, DWIN_MPCTuning(MPC_INTERRUPTED)); + return MeasurementState::CANCELLED; + } + + return MeasurementState::SUCCESS; + } + + void Temperature::MPC_autotune(const uint8_t e, MPCTuningType tuning_type=AUTO) { + SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_START, e); + + MPC_autotuner tuner(e); + + MPCHeaterInfo &hotend = temp_hotend[e]; + MPC_t &mpc = hotend.mpc; + // 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 - const float power_fan255 = total_energy_fan255 * 1000 / test_duration, - ambient_xfer_coeff_fan255 = power_fan255 / (hotend.target - ambient_temp); - mpc.applyFanAdjustment(ambient_xfer_coeff_fan255); + zero_fan_speeds(); + set_fan_speed(TERN(SINGLEFAN, 0, e), 255); + planner.sync_fan_speeds(fan_speed); #endif + do_blocking_move_to(xyz_pos_t(MPC_TUNING_POS)); - // Calculate a new and better asymptotic temperature and re-evaluate the other constants - asymp_temp = ambient_temp + mpc.heater_power * (MPC_MAX) / 255 / mpc.ambient_xfer_coeff_fan0; - block_responsiveness = -log((t2 - asymp_temp) / (t1 - asymp_temp)) / (sample_distance * (sample_count >> 1)); - mpc.block_heat_capacity = mpc.ambient_xfer_coeff_fan0 / block_responsiveness; - mpc.sensor_responsiveness = block_responsiveness / (1.0f - (ambient_temp - asymp_temp) * exp(-block_responsiveness * t1_time) / (t1 - asymp_temp)); + // Determine ambient temperature. + SERIAL_ECHOLNPGM(STR_MPC_COOLING_TO_AMBIENT); + #if ENABLED(DWIN_LCD_PROUI) + DWIN_MPCTuning(MPCTEMP_START); + LCD_ALERTMESSAGE(MSG_MPC_COOLING_TO_AMBIENT); + #else + LCD_MESSAGE(MSG_COOLING); + #endif - SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_FINISHED); - TERN_(DWIN_LCD_PROUI, DWIN_MPCTuning(MPC_DONE)); + if (tuner.measure_ambient_temp() != MPC_autotuner::MeasurementState::SUCCESS) return; + hotend.modeled_ambient_temp = tuner.get_ambient_temp(); - #if 0 - SERIAL_ECHOLNPGM("t1_time ", t1_time); - SERIAL_ECHOLNPGM("sample_count ", sample_count); - SERIAL_ECHOLNPGM("sample_distance ", sample_distance); - for (uint8_t i = 0; i < sample_count; i++) - SERIAL_ECHOLNPGM("sample ", i, " : ", temp_samples[i]); - SERIAL_ECHOLNPGM("t1 ", t1, " t2 ", t2, " t3 ", t3); + #if HAS_FAN + set_fan_speed(TERN(SINGLEFAN, 0, e), 0); + planner.sync_fan_speeds(fan_speed); + #endif + + // Heat to 200 degrees + SERIAL_ECHOLNPGM(STR_MPC_HEATING_PAST_200); + TERN(DWIN_LCD_PROUI, LCD_ALERTMESSAGE(MSG_MPC_HEATING_PAST_200), LCD_MESSAGE(MSG_HEATING)); + + if (tuner.measure_heatup() != MPC_autotuner::MeasurementState::SUCCESS) return; + + // Calculate physical constants from three equally-spaced samples + const float t1 = tuner.get_sample_1_temp(), + t2 = tuner.get_sample_2_temp(), + t3 = tuner.get_sample_3_temp(); + float asymp_temp = (t2 * t2 - t1 * t3) / (2 * t2 - t1 - t3), + block_responsiveness = -log((t2 - asymp_temp) / (t1 - asymp_temp)) / tuner.get_sample_interval(); + + #if ENABLED(DEBUG_MPC_AUTOTUNE) SERIAL_ECHOLNPGM("asymp_temp ", asymp_temp); SERIAL_ECHOLNPAIR_F("block_responsiveness ", block_responsiveness, 4); #endif + // Make initial guess at transfer coefficients + mpc.ambient_xfer_coeff_fan0 = mpc.heater_power * (MPC_MAX) / 255 / (asymp_temp - tuner.get_ambient_temp()); + TERN_(MPC_INCLUDE_FAN, mpc.fan255_adjustment = 0.0f); + + if (tuning_type == AUTO || tuning_type == FORCE_ASYMPTOTIC) { + // Analytic tuning + mpc.block_heat_capacity = mpc.ambient_xfer_coeff_fan0 / block_responsiveness; + mpc.sensor_responsiveness = block_responsiveness / (1.0f - (tuner.get_ambient_temp() - asymp_temp) * exp(-block_responsiveness * tuner.get_sample_1_time()) / (t1 - asymp_temp)); + } + + // If analytic tuning fails, fall back to differential tuning + if (tuning_type == AUTO) { + if (mpc.sensor_responsiveness <= 0 || mpc.block_heat_capacity <= 0) + tuning_type = FORCE_DIFFERENTIAL; + } + + if (tuning_type == FORCE_DIFFERENTIAL) { + // Differential tuning + mpc.block_heat_capacity = mpc.heater_power / tuner.get_rate_fastest(); + mpc.sensor_responsiveness = tuner.get_rate_fastest() / (tuner.get_rate_fastest() * tuner.get_time_fastest() + tuner.get_ambient_temp() - tuner.get_time_fastest()); + } + + hotend.modeled_block_temp = asymp_temp + (tuner.get_ambient_temp() - asymp_temp) * exp(-block_responsiveness * tuner.get_elapsed_heating_time()); + hotend.modeled_sensor_temp = tuner.get_last_measured_temp(); + + // Allow the system to stabilize under MPC, then get a better measure of ambient loss with and without fan + SERIAL_ECHOLNPGM(STR_MPC_MEASURING_AMBIENT, hotend.modeled_block_temp); + TERN(DWIN_LCD_PROUI, LCD_ALERTMESSAGE(MSG_MPC_MEASURING_AMBIENT), LCD_MESSAGE(MSG_MPC_MEASURING_AMBIENT)); + + // Use the estimated overshoot of the temperature as the target to achieve. + hotend.target = hotend.modeled_block_temp; + if (tuner.measure_transfer() != MPC_autotuner::MeasurementState::SUCCESS) return; + + // Update the transfer coefficients + mpc.ambient_xfer_coeff_fan0 = tuner.get_power_fan0() / (hotend.target - tuner.get_ambient_temp()); + #if HAS_FAN + const float ambient_xfer_coeff_fan255 = tuner.get_power_fan255() / (hotend.target - tuner.get_ambient_temp()); + mpc.applyFanAdjustment(ambient_xfer_coeff_fan255); + #endif + + if (tuning_type == AUTO || tuning_type == FORCE_ASYMPTOTIC) { + // Calculate a new and better asymptotic temperature and re-evaluate the other constants + asymp_temp = tuner.get_ambient_temp() + mpc.heater_power * (MPC_MAX) / 255 / mpc.ambient_xfer_coeff_fan0; + block_responsiveness = -log((t2 - asymp_temp) / (t1 - asymp_temp)) / tuner.get_sample_interval(); + + #if ENABLED(DEBUG_MPC_AUTOTUNE) + SERIAL_ECHOLN("Refining estimates for:"); + SERIAL_ECHOLNPGM("asymp_temp ", asymp_temp); + SERIAL_ECHOLNPAIR_F("block_responsiveness ", block_responsiveness, 4); + #endif + + // Update analytic tuning values based on the above + mpc.block_heat_capacity = mpc.ambient_xfer_coeff_fan0 / block_responsiveness; + mpc.sensor_responsiveness = block_responsiveness / (1.0f - (tuner.get_ambient_temp() - asymp_temp) * exp(-block_responsiveness * tuner.get_sample_1_time()) / (t1 - asymp_temp)); + + } + + SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_FINISHED); + TERN_(DWIN_LCD_PROUI, DWIN_MPCTuning(MPC_DONE)); + SERIAL_ECHOLNPGM("MPC_BLOCK_HEAT_CAPACITY ", mpc.block_heat_capacity); SERIAL_ECHOLNPAIR_F("MPC_SENSOR_RESPONSIVENESS ", mpc.sensor_responsiveness, 4); SERIAL_ECHOLNPAIR_F("MPC_AMBIENT_XFER_COEFF ", mpc.ambient_xfer_coeff_fan0, 4); @@ -1702,9 +1832,9 @@ void Temperature::mintemp_error(const heater_id_t heater_id) { // Check if temperature is within the correct band if (WITHIN(temp_bed.celsius, BED_MINTEMP, BED_MAXTEMP)) { #if ENABLED(BED_LIMIT_SWITCHING) - if (temp_bed.is_above_target((BED_HYSTERESIS) - 1)) + if (temp_bed.is_above_target(BED_HYSTERESIS)) temp_bed.soft_pwm_amount = 0; - else if (temp_bed.is_below_target((BED_HYSTERESIS) - 1)) + else if (temp_bed.is_below_target(BED_HYSTERESIS)) temp_bed.soft_pwm_amount = MAX_BED_POWER >> 1; #else // !PIDTEMPBED && !BED_LIMIT_SWITCHING temp_bed.soft_pwm_amount = temp_bed.is_below_target() ? MAX_BED_POWER >> 1 : 0; @@ -1778,7 +1908,7 @@ void Temperature::mintemp_error(const heater_id_t heater_id) { #ifndef MIN_COOLING_SLOPE_DEG_CHAMBER_VENT #define MIN_COOLING_SLOPE_DEG_CHAMBER_VENT 1.5 #endif - if (!flag_chamber_excess_heat && temp_chamber.is_above_target((HIGH_EXCESS_HEAT_LIMIT) - 1)) { + if (!flag_chamber_excess_heat && temp_chamber.is_above_target(HIGH_EXCESS_HEAT_LIMIT)) { // Open vent after MIN_COOLING_SLOPE_TIME_CHAMBER_VENT seconds if the // temperature didn't drop at least MIN_COOLING_SLOPE_DEG_CHAMBER_VENT if (next_cool_check_ms == 0 || ELAPSED(ms, next_cool_check_ms)) { @@ -1792,7 +1922,7 @@ void Temperature::mintemp_error(const heater_id_t heater_id) { next_cool_check_ms = 0; old_temp = 9999; } - if (flag_chamber_excess_heat && temp_chamber.is_above_target((LOW_EXCESS_HEAT_LIMIT) - 1)) + if (flag_chamber_excess_heat && temp_chamber.is_above_target(LOW_EXCESS_HEAT_LIMIT)) flag_chamber_excess_heat = false; #endif } @@ -1824,9 +1954,9 @@ void Temperature::mintemp_error(const heater_id_t heater_id) { } else { #if ENABLED(CHAMBER_LIMIT_SWITCHING) - if (temp_chamber.is_above_target((TEMP_CHAMBER_HYSTERESIS) - 1)) + if (temp_chamber.is_above_target(TEMP_CHAMBER_HYSTERESIS)) temp_chamber.soft_pwm_amount = 0; - else if (temp_chamber.is_below_target((TEMP_CHAMBER_HYSTERESIS) - 1)) + else if (temp_chamber.is_below_target(TEMP_CHAMBER_HYSTERESIS)) temp_chamber.soft_pwm_amount = (MAX_CHAMBER_POWER) >> 1; #else temp_chamber.soft_pwm_amount = temp_chamber.is_below_target() ? (MAX_CHAMBER_POWER) >> 1 : 0; diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index 27aef11c7eea1..4bd185c4251be 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -150,7 +150,7 @@ typedef struct { float p, i, d, c, f; } raw_pidcf_t; #if HAS_PID_HEATING - #define PID_K2 (1-float(PID_K1)) + #define PID_K2 (1.0f - float(PID_K1)) #define PID_dT ((OVERSAMPLENR * float(ACTUAL_ADC_SAMPLES)) / (TEMP_TIMER_FREQUENCY)) // Apply the scale factors to the PID values @@ -231,7 +231,7 @@ typedef struct { float p, i, d, c, f; } raw_pidcf_t; }; -#endif +#endif // HAS_PID_HEATING #if ENABLED(PIDTEMP) @@ -1215,11 +1215,68 @@ class Temperature { } #endif - #endif + #endif // HAS_PID_HEATING #if ENABLED(MPC_AUTOTUNE) - void MPC_autotune(const uint8_t e); - #endif + + // Utility class to perform MPCTEMP auto tuning measurements + class MPC_autotuner { + public: + enum MeasurementState { CANCELLED, FAILED, SUCCESS }; + MPC_autotuner(const uint8_t extruderIdx); + ~MPC_autotuner(); + MeasurementState measure_ambient_temp(); + MeasurementState measure_heatup(); + MeasurementState measure_transfer(); + + celsius_float_t get_ambient_temp() { return ambient_temp; } + celsius_float_t get_last_measured_temp() { return current_temp; } + + float get_elapsed_heating_time() { return elapsed_heating_time; } + float get_sample_1_time() { return t1_time; } + static float get_sample_1_temp() { return temp_samples[0]; } + static float get_sample_2_temp() { return temp_samples[(sample_count - 1) >> 1]; } + static float get_sample_3_temp() { return temp_samples[sample_count - 1]; } + static float get_sample_interval() { return sample_distance * (sample_count >> 1); } + + static celsius_float_t get_temp_fastest() { return temp_fastest; } + float get_time_fastest() { return time_fastest; } + float get_rate_fastest() { return rate_fastest; } + + float get_power_fan0() { return power_fan0; } + #if HAS_FAN + static float get_power_fan255() { return power_fan255; } + #endif + + protected: + static void init_timers() { curr_time_ms = next_report_ms = millis(); } + MeasurementState housekeeping(); + + uint8_t e; + + float elapsed_heating_time; + celsius_float_t ambient_temp, current_temp; + float t1_time; + + static millis_t curr_time_ms, next_report_ms; + static celsius_float_t temp_samples[16]; + static uint8_t sample_count; + static uint16_t sample_distance; + + // Parameters from differential analysis + static celsius_float_t temp_fastest; + float time_fastest, rate_fastest; + + float power_fan0; + #if HAS_FAN + static float power_fan255; + #endif + }; + + enum MPCTuningType { AUTO, FORCE_ASYMPTOTIC, FORCE_DIFFERENTIAL }; + static void MPC_autotune(const uint8_t e, MPCTuningType tuning_type); + + #endif // MPC_AUTOTUNE #if ENABLED(PROBING_HEATERS_OFF) static void pause_heaters(const bool p); From 5f89ef99e962a0c8bed7115c87ae4e545ca143ad Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 12 May 2023 00:25:57 +0000 Subject: [PATCH 005/100] [cron] Bump distribution date (2023-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 5c696db45c390..9a13c5ce3e14b 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 "2023-05-11" +//#define STRING_DISTRIBUTION_DATE "2023-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 8ab8e76ed761b..e4eb143c3ddf8 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 "2023-05-11" + #define STRING_DISTRIBUTION_DATE "2023-05-12" #endif /** From 79b0f3158556933699cab4c5ed4e8e798b4ef4d8 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 11 May 2023 19:39:30 -0500 Subject: [PATCH 006/100] =?UTF-8?q?=F0=9F=94=A8=20Use=20'build=5Fsrc=5Ffil?= =?UTF-8?q?ter'=20(#25810)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PlatformIO/scripts/common-dependencies.py | 22 +- ini/features.ini | 466 +++++++++--------- 2 files changed, 244 insertions(+), 244 deletions(-) diff --git a/buildroot/share/PlatformIO/scripts/common-dependencies.py b/buildroot/share/PlatformIO/scripts/common-dependencies.py index 58d9cfcb4d747..aa531be296854 100644 --- a/buildroot/share/PlatformIO/scripts/common-dependencies.py +++ b/buildroot/share/PlatformIO/scripts/common-dependencies.py @@ -62,7 +62,7 @@ def add_to_feat_cnf(feature, flines): for line in atoms: parts = line.split('=') name = parts.pop(0) - if name in ['build_flags', 'extra_scripts', 'src_filter', 'lib_ignore']: + if name in ['build_flags', 'extra_scripts', 'build_src_filter', 'lib_ignore']: feat[name] = '='.join(parts) blab("[%s] %s=%s" % (feature, name, feat[name]), 3) else: @@ -130,7 +130,7 @@ def force_ignore_unused_libs(): def apply_features_config(): load_features() blab("========== Apply enabled features...") - build_filters = ' '.join(env.GetProjectOption('src_filter')) + build_filters = ' '.join(env.GetProjectOption('build_src_filter')) for feature in FEATURE_CONFIG: if not env.MarlinHas(feature): continue @@ -175,9 +175,9 @@ def apply_features_config(): blab("Running extra_scripts for %s... " % feature, 2) env.SConscript(feat['extra_scripts'], exports="env") - if 'src_filter' in feat: + if 'build_src_filter' in feat: blab("========== Adding build_src_filter for %s... " % feature, 2) - build_filters = build_filters + ' ' + feat['src_filter'] + build_filters = build_filters + ' ' + feat['build_src_filter'] # Just append the filter in the order that the build environment specifies. # Important here is the order of entries in the "features.ini" file. @@ -186,7 +186,7 @@ def apply_features_config(): lib_ignore = env.GetProjectOption('lib_ignore') + [feat['lib_ignore']] set_env_field('lib_ignore', lib_ignore) - src_filter = "" + build_src_filter = "" if True: # Build the actual equivalent build_src_filter list based on the inclusions by the features. # PlatformIO doesn't do it this way, but maybe in the future.... @@ -247,16 +247,16 @@ def filt(x): cur_srcs = set(filter(filt, cur_srcs)) # Transform the resulting set into a string. for x in cur_srcs: - if len(src_filter) > 0: src_filter += ' ' - src_filter += "+<" + x + ">" + if len(build_src_filter) > 0: build_src_filter += ' ' + build_src_filter += "+<" + x + ">" - #blab("Final src_filter: " + src_filter) + #blab("Final build_src_filter: " + build_src_filter) else: - src_filter = build_filters + build_src_filter = build_filters # Update in PlatformIO - set_env_field('build_src_filter', [src_filter]) - env.Replace(SRC_FILTER=src_filter) + set_env_field('build_src_filter', [build_src_filter]) + env.Replace(SRC_FILTER=build_src_filter) # # Use the compiler to get a list of all enabled features diff --git a/ini/features.ini b/ini/features.ini index c8a3cf2908a23..17d2ece04a052 100644 --- a/ini/features.ini +++ b/ini/features.ini @@ -14,254 +14,254 @@ [features] YHCB2004 = red-scorp/LiquidCrystal_AIP31068@^1.0.4, red-scorp/SoftSPIB@^1.1.1 HAS_TFT_LVGL_UI = lvgl=https://github.com/makerbase-mks/LVGL-6.1.1-MKS/archive/master.zip - src_filter=+ + build_src_filter=+ extra_scripts=download_mks_assets.py -MARLIN_TEST_BUILD = src_filter=+ -POSTMORTEM_DEBUGGING = src_filter=+ + +MARLIN_TEST_BUILD = build_src_filter=+ +POSTMORTEM_DEBUGGING = build_src_filter=+ + build_flags=-funwind-tables MKS_WIFI_MODULE = QRCode=https://github.com/makerbase-mks/QRCode/archive/master.zip HAS_TRINAMIC_CONFIG = TMCStepper@~0.7.3 - src_filter=+ + + + + -HAS_T(RINAMIC_CONFIG|MC_SPI) = src_filter=+ -HAS_STEALTHCHOP = src_filter=+ + build_src_filter=+ + + + + +HAS_T(RINAMIC_CONFIG|MC_SPI) = build_src_filter=+ +HAS_STEALTHCHOP = build_src_filter=+ SR_LCD_3W_NL = SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip -HAS_MOTOR_CURRENT_(I2C|DAC|SPI|PWM) = src_filter=+ +HAS_MOTOR_CURRENT_(I2C|DAC|SPI|PWM) = build_src_filter=+ HAS_MOTOR_CURRENT_I2C = SlowSoftI2CMaster - src_filter=+ + build_src_filter=+ HAS_TMC26X = TMC26XStepper=https://github.com/MarlinFirmware/TMC26XStepper/archive/master.zip - src_filter=+ -LIB_INTERNAL_MAX31865 = src_filter=+ + build_src_filter=+ +LIB_INTERNAL_MAX31865 = build_src_filter=+ NEOPIXEL_LED = adafruit/Adafruit NeoPixel@~1.8.0 - src_filter=+ + build_src_filter=+ I2C_AMMETER = peterus/INA226Lib@1.1.2 - src_filter=+ + build_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 -HAS_LCDPRINT = src_filter=+ -HAS_MARLINUI_HD44780 = src_filter=+ +HAS_LCDPRINT = build_src_filter=+ +HAS_MARLINUI_HD44780 = build_src_filter=+ HAS_MARLINUI_U8GLIB = marlinfirmware/U8glib-HAL@~0.5.2 - src_filter=+ -HAS_(FSMC|SPI|LTDC)_TFT = src_filter=+ -HAS_LTDC_TFT = src_filter=+ -HAS_FSMC_TFT = src_filter=+ + -HAS_SPI_TFT = src_filter=+ + + -HAS_TFT_XPT2046 = src_filter=+ + + -TFT_TOUCH_DEVICE_GT911 = src_filter=+ -I2C_EEPROM = src_filter=+ + build_src_filter=+ +HAS_(FSMC|SPI|LTDC)_TFT = build_src_filter=+ +HAS_LTDC_TFT = build_src_filter=+ +HAS_FSMC_TFT = build_src_filter=+ + +HAS_SPI_TFT = build_src_filter=+ + + +HAS_TFT_XPT2046 = build_src_filter=+ + + +TFT_TOUCH_DEVICE_GT911 = build_src_filter=+ +I2C_EEPROM = build_src_filter=+ SOFT_I2C_EEPROM = SlowSoftI2CMaster, SlowSoftWire=https://github.com/felias-fogg/SlowSoftWire/archive/master.zip -SPI_EEPROM = src_filter=+ -HAS_DWIN_E3V2|IS_DWIN_MARLINUI = 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=+ - -TFT_FONT_HELVETICA = src_filter=+ -TFT_FONT_NOTOSANS = src_filter=+ -TFT_FONT_UNIFONT = src_filter=+ -IS_TFTGLCD_PANEL = src_filter=+ -HAS_TOUCH_BUTTONS = src_filter=+ -HAS_MARLINUI_MENU = src_filter=+ - -HAS_GAMES = src_filter=+ -MARLIN_BRICKOUT = src_filter=+ -MARLIN_INVADERS = src_filter=+ -MARLIN_MAZE = src_filter=+ -MARLIN_SNAKE = src_filter=+ -HAS_MENU_BACKLASH = src_filter=+ -LCD_BED_LEVELING = src_filter=+ -HAS_MENU_BED_TRAMMING = src_filter=+ -HAS_MENU_CANCELOBJECT = src_filter=+ -HAS_MENU_DELTA_CALIBRATE = src_filter=+ -HAS_MENU_FILAMENT = src_filter=+ -LCD_INFO_MENU = src_filter=+ -HAS_MENU_JOB_RECOVERY = src_filter=+ -HAS_MENU_MULTI_LANGUAGE = src_filter=+ -HAS_MENU_LED = src_filter=+ -HAS_MENU_MEDIA = src_filter=+ -HAS_MENU_MIXER = src_filter=+ -HAS_MENU_MMU2 = src_filter=+ -HAS_MENU_PASSWORD = src_filter=+ -HAS_MENU_POWER_MONITOR = src_filter=+ -HAS_MENU_CUTTER = src_filter=+ -HAS_MENU_TEMPERATURE = src_filter=+ -HAS_MENU_TMC = src_filter=+ -HAS_MENU_TOUCH_SCREEN = src_filter=+ -HAS_MENU_TRAMMING_WIZARD = src_filter=+ -HAS_MENU_UBL = src_filter=+ -EXTENSIBLE_UI = src_filter=+ -ANYCUBIC_LCD_(CHIRON|VYPER) = src_filter=+ -ANYCUBIC_LCD_CHIRON = src_filter=+ -ANYCUBIC_LCD_VYPER = src_filter=+ -ANYCUBIC_LCD_I3MEGA = src_filter=+ -HAS_DGUS_LCD_CLASSIC = src_filter=+ -DGUS_LCD_UI_RELOADED = src_filter=+ -DGUS_LCD_UI_FYSETC = src_filter=+ -DGUS_LCD_UI_HIPRECY = src_filter=+ -DGUS_LCD_UI_MKS = src_filter=+ -DGUS_LCD_UI_ORIGIN = src_filter=+ -DGUS_LCD_UI_IA_CREALITY = src_filter=+ -EXTUI_EXAMPLE = src_filter=+ -TOUCH_UI_FTDI_EVE = src_filter=+ -MALYAN_LCD = src_filter=+ -NEXTION_TFT = src_filter=+ -USE_UHS2_USB = src_filter=+ -USE_UHS3_USB = src_filter=+ -USB_FLASH_DRIVE_SUPPORT = src_filter=+ -HAS_MCP3426_ADC = src_filter=+ + -AUTO_BED_LEVELING_BILINEAR = src_filter=+ -AUTO_BED_LEVELING_(3POINT|(BI)?LINEAR) = src_filter=+ -X_AXIS_TWIST_COMPENSATION = src_filter=+ + + +SPI_EEPROM = build_src_filter=+ +HAS_DWIN_E3V2|IS_DWIN_MARLINUI = build_src_filter=+ +DWIN_CREALITY_LCD = build_src_filter=+ +DWIN_LCD_PROUI = build_src_filter=+ +DWIN_CREALITY_LCD_JYERSUI = build_src_filter=+ +IS_DWIN_MARLINUI = build_src_filter=+ +HAS_GRAPHICAL_TFT = build_src_filter=+ - +TFT_FONT_HELVETICA = build_src_filter=+ +TFT_FONT_NOTOSANS = build_src_filter=+ +TFT_FONT_UNIFONT = build_src_filter=+ +IS_TFTGLCD_PANEL = build_src_filter=+ +HAS_TOUCH_BUTTONS = build_src_filter=+ +HAS_MARLINUI_MENU = build_src_filter=+ - +HAS_GAMES = build_src_filter=+ +MARLIN_BRICKOUT = build_src_filter=+ +MARLIN_INVADERS = build_src_filter=+ +MARLIN_MAZE = build_src_filter=+ +MARLIN_SNAKE = build_src_filter=+ +HAS_MENU_BACKLASH = build_src_filter=+ +LCD_BED_LEVELING = build_src_filter=+ +HAS_MENU_BED_TRAMMING = build_src_filter=+ +HAS_MENU_CANCELOBJECT = build_src_filter=+ +HAS_MENU_DELTA_CALIBRATE = build_src_filter=+ +HAS_MENU_FILAMENT = build_src_filter=+ +LCD_INFO_MENU = build_src_filter=+ +HAS_MENU_JOB_RECOVERY = build_src_filter=+ +HAS_MENU_MULTI_LANGUAGE = build_src_filter=+ +HAS_MENU_LED = build_src_filter=+ +HAS_MENU_MEDIA = build_src_filter=+ +HAS_MENU_MIXER = build_src_filter=+ +HAS_MENU_MMU2 = build_src_filter=+ +HAS_MENU_PASSWORD = build_src_filter=+ +HAS_MENU_POWER_MONITOR = build_src_filter=+ +HAS_MENU_CUTTER = build_src_filter=+ +HAS_MENU_TEMPERATURE = build_src_filter=+ +HAS_MENU_TMC = build_src_filter=+ +HAS_MENU_TOUCH_SCREEN = build_src_filter=+ +HAS_MENU_TRAMMING_WIZARD = build_src_filter=+ +HAS_MENU_UBL = build_src_filter=+ +EXTENSIBLE_UI = build_src_filter=+ +ANYCUBIC_LCD_(CHIRON|VYPER) = build_src_filter=+ +ANYCUBIC_LCD_CHIRON = build_src_filter=+ +ANYCUBIC_LCD_VYPER = build_src_filter=+ +ANYCUBIC_LCD_I3MEGA = build_src_filter=+ +HAS_DGUS_LCD_CLASSIC = build_src_filter=+ +DGUS_LCD_UI_RELOADED = build_src_filter=+ +DGUS_LCD_UI_FYSETC = build_src_filter=+ +DGUS_LCD_UI_HIPRECY = build_src_filter=+ +DGUS_LCD_UI_MKS = build_src_filter=+ +DGUS_LCD_UI_ORIGIN = build_src_filter=+ +DGUS_LCD_UI_IA_CREALITY = build_src_filter=+ +EXTUI_EXAMPLE = build_src_filter=+ +TOUCH_UI_FTDI_EVE = build_src_filter=+ +MALYAN_LCD = build_src_filter=+ +NEXTION_TFT = build_src_filter=+ +USE_UHS2_USB = build_src_filter=+ +USE_UHS3_USB = build_src_filter=+ +USB_FLASH_DRIVE_SUPPORT = build_src_filter=+ +HAS_MCP3426_ADC = build_src_filter=+ + +AUTO_BED_LEVELING_BILINEAR = build_src_filter=+ +AUTO_BED_LEVELING_(3POINT|(BI)?LINEAR) = build_src_filter=+ +X_AXIS_TWIST_COMPENSATION = build_src_filter=+ + + BD_SENSOR = markyue/Panda_SoftMasterI2C - src_filter=+ + -MESH_BED_LEVELING = src_filter=+ + -AUTO_BED_LEVELING_UBL = src_filter=+ + -UBL_HILBERT_CURVE = src_filter=+ -BACKLASH_COMPENSATION = src_filter=+ -BARICUDA = src_filter=+ + -BINARY_FILE_TRANSFER = src_filter=+ + -BLTOUCH = src_filter=+ -CANCEL_OBJECTS = src_filter=+ + -CASE_LIGHT_ENABLE = src_filter=+ + -EXTERNAL_CLOSED_LOOP_CONTROLLER = src_filter=+ + -USE_CONTROLLER_FAN = src_filter=+ -HAS_COOLER|LASER_COOLANT_FLOW_METER = src_filter=+ -HAS_MOTOR_CURRENT_DAC = src_filter=+ -DIRECT_STEPPING = src_filter=+ + -EMERGENCY_PARSER = src_filter=+ - -EASYTHREED_UI = src_filter=+ -I2C_POSITION_ENCODERS = src_filter=+ -IIC_BL24CXX_EEPROM = src_filter=+ -SPI_FLASH = src_filter=+ -HAS_ETHERNET = src_filter=+ + -HAS_FANCHECK = src_filter=+ + -HAS_FANMUX = src_filter=+ -FILAMENT_WIDTH_SENSOR = src_filter=+ + -FWRETRACT = src_filter=+ + -HOST_ACTION_COMMANDS = src_filter=+ -HOTEND_IDLE_TIMEOUT = src_filter=+ -JOYSTICK = src_filter=+ -BLINKM = src_filter=+ -HAS_COLOR_LEDS = src_filter=+ + -PCA9533 = src_filter=+ -PCA9632 = src_filter=+ -PRINTER_EVENT_LEDS = src_filter=+ -TEMP_STAT_LEDS = src_filter=+ -MAX7219_DEBUG = src_filter=+ + -HAS_MEATPACK = src_filter=+ -MIXING_EXTRUDER = src_filter=+ + -HAS_PRUSA_MMU1 = src_filter=+ -HAS_PRUSA_MMU2 = src_filter=+ + -PASSWORD_FEATURE = src_filter=+ + -ADVANCED_PAUSE_FEATURE = src_filter=+ + + -PSU_CONTROL = src_filter=+ -HAS_POWER_MONITOR = src_filter=+ + -POWER_LOSS_RECOVERY = src_filter=+ + -HAS_PTC = src_filter=+ + -HAS_FILAMENT_SENSOR = src_filter=+ + -(EXT|MANUAL)_SOLENOID.* = src_filter=+ + -MK2_MULTIPLEXER = src_filter=+ -HAS_CUTTER = src_filter=+ + -HAS_DRIVER_SAFE_POWER_PROTECT = src_filter=+ -EXPERIMENTAL_I2CBUS = src_filter=+ + -G26_MESH_VALIDATION = src_filter=+ -ASSISTED_TRAMMING = src_filter=+ + -HAS_MESH = src_filter=+ -HAS_LEVELING = src_filter=+ + -MECHANICAL_GANTRY_CAL.+ = src_filter=+ -Z_MULTI_ENDSTOPS|Z_STEPPER_AUTO_ALIGN = src_filter=+ -Z_STEPPER_AUTO_ALIGN = src_filter=+ -DELTA_AUTO_CALIBRATION = src_filter=+ -CALIBRATION_GCODE = src_filter=+ -Z_MIN_PROBE_REPEATABILITY_TEST = src_filter=+ -M100_FREE_MEMORY_WATCHER = src_filter=+ -BACKLASH_GCODE = src_filter=+ -IS_KINEMATIC = src_filter=+ -HAS_EXTRA_ENDSTOPS = src_filter=+ -SKEW_CORRECTION_GCODE = src_filter=+ -DIRECT_PIN_CONTROL = src_filter=+ + -PINS_DEBUGGING = src_filter=+ -HAS_MULTI_EXTRUDER = src_filter=+ -HAS_HOTEND_OFFSET = src_filter=+ -EDITABLE_SERVO_ANGLES = src_filter=+ -PIDTEMP = src_filter=+ -PREVENT_COLD_EXTRUSION = src_filter=+ -PIDTEMPBED = src_filter=+ -HAS_USER_THERMISTORS = src_filter=+ -PIDTEMPCHAMBER = src_filter=+ -SD_ABORT_ON_ENDSTOP_HIT = src_filter=+ -BAUD_RATE_GCODE = src_filter=+ -HAS_SMART_EFF_MOD = src_filter=+ -COOLANT_CONTROL|AIR_ASSIST = src_filter=+ -AIR_EVACUATION = src_filter=+ -HAS_SOFTWARE_ENDSTOPS = src_filter=+ -SERVO_DETACH_GCODE = src_filter=+ -HAS_DUPLICATION_MODE = src_filter=+ -SPI_FLASH_BACKUP = src_filter=+ -PLATFORM_M997_SUPPORT = src_filter=+ -FT_MOTION = src_filter=+ + -LIN_ADVANCE = src_filter=+ -PHOTO_GCODE = src_filter=+ -CONTROLLER_FAN_EDITABLE = src_filter=+ -HAS_ZV_SHAPING = src_filter=+ -GCODE_MACROS = src_filter=+ -GRADIENT_MIX = src_filter=+ -OTA_FIRMWARE_UPDATE = src_filter=+ -HAS_SAVED_POSITIONS = src_filter=+ + -PARK_HEAD_ON_PAUSE = src_filter=+ -FILAMENT_LOAD_UNLOAD_GCODES = src_filter=+ -CNC_WORKSPACE_PLANES = src_filter=+ -CNC_COORDINATE_SYSTEMS = src_filter=+ -HAS_M206_COMMAND = src_filter=+ -EXPECTED_PRINTER_CHECK = src_filter=+ -HOST_KEEPALIVE_FEATURE = src_filter=+ -AUTO_REPORT_POSITION = src_filter=+ -REPETIER_GCODE_M360 = src_filter=+ -HAS_GCODE_M876 = src_filter=+ -HAS_RESUME_CONTINUE = src_filter=+ -SET_PROGRESS_MANUALLY = src_filter=+ -HAS_STATUS_MESSAGE = src_filter=+ -HAS_PREHEAT = src_filter=+ -HAS_LCD_CONTRAST = src_filter=+ -HAS_GCODE_M255 = src_filter=+ -HAS_LCD_BRIGHTNESS = src_filter=+ -HAS_SOUND = src_filter=+ -HAS_MULTI_LANGUAGE = src_filter=+ -TOUCH_SCREEN_CALIBRATION = src_filter=+ -ARC_SUPPORT = src_filter=+ -GCODE_MOTION_MODES = src_filter=+ -BABYSTEPPING = src_filter=+ + -Z_PROBE_SLED = src_filter=+ -G38_PROBE_TARGET = src_filter=+ -MAGNETIC_PARKING_EXTRUDER = src_filter=+ -HAS_MEDIA = src_filter=+ + + + + + + -HAS_MEDIA_SUBCALLS = src_filter=+ -GCODE_REPEAT_MARKERS = src_filter=+ + -HAS_EXTRUDERS = src_filter=+ + -HAS_HOTEND = src_filter=+ -HAS_FAN = src_filter=+ -HAS_HEATED_BED = src_filter=+ -HAS_HEATED_CHAMBER = src_filter=+ -HAS_COOLER = src_filter=+ -AUTO_REPORT_TEMPERATURES = src_filter=+ -HAS_TEMP_PROBE = src_filter=+ -HAS_PID_HEATING = src_filter=+ -MPCTEMP = src_filter=+ -INCH_MODE_SUPPORT = src_filter=+ -TEMPERATURE_UNITS_SUPPORT = src_filter=+ -NEED_HEX_PRINT = src_filter=+ -NEED_LSF = src_filter=+ -NOZZLE_PARK_FEATURE = src_filter=+ + -NOZZLE_CLEAN_FEATURE = src_filter=+ + -DELTA = src_filter=+ + -POLARGRAPH = src_filter=+ -BEZIER_CURVE_SUPPORT = src_filter=+ + -PRINTCOUNTER = src_filter=+ -HAS_BED_PROBE = src_filter=+ + + + -IS_SCARA = src_filter=+ -HAS_SERVOS = src_filter=+ + -MORGAN_SCARA = src_filter=+ -HAS_MICROSTEPS = src_filter=+ + build_src_filter=+ + +MESH_BED_LEVELING = build_src_filter=+ + +AUTO_BED_LEVELING_UBL = build_src_filter=+ + +UBL_HILBERT_CURVE = build_src_filter=+ +BACKLASH_COMPENSATION = build_src_filter=+ +BARICUDA = build_src_filter=+ + +BINARY_FILE_TRANSFER = build_src_filter=+ + +BLTOUCH = build_src_filter=+ +CANCEL_OBJECTS = build_src_filter=+ + +CASE_LIGHT_ENABLE = build_src_filter=+ + +EXTERNAL_CLOSED_LOOP_CONTROLLER = build_src_filter=+ + +USE_CONTROLLER_FAN = build_src_filter=+ +HAS_COOLER|LASER_COOLANT_FLOW_METER = build_src_filter=+ +HAS_MOTOR_CURRENT_DAC = build_src_filter=+ +DIRECT_STEPPING = build_src_filter=+ + +EMERGENCY_PARSER = build_src_filter=+ - +EASYTHREED_UI = build_src_filter=+ +I2C_POSITION_ENCODERS = build_src_filter=+ +IIC_BL24CXX_EEPROM = build_src_filter=+ +SPI_FLASH = build_src_filter=+ +HAS_ETHERNET = build_src_filter=+ + +HAS_FANCHECK = build_src_filter=+ + +HAS_FANMUX = build_src_filter=+ +FILAMENT_WIDTH_SENSOR = build_src_filter=+ + +FWRETRACT = build_src_filter=+ + +HOST_ACTION_COMMANDS = build_src_filter=+ +HOTEND_IDLE_TIMEOUT = build_src_filter=+ +JOYSTICK = build_src_filter=+ +BLINKM = build_src_filter=+ +HAS_COLOR_LEDS = build_src_filter=+ + +PCA9533 = build_src_filter=+ +PCA9632 = build_src_filter=+ +PRINTER_EVENT_LEDS = build_src_filter=+ +TEMP_STAT_LEDS = build_src_filter=+ +MAX7219_DEBUG = build_src_filter=+ + +HAS_MEATPACK = build_src_filter=+ +MIXING_EXTRUDER = build_src_filter=+ + +HAS_PRUSA_MMU1 = build_src_filter=+ +HAS_PRUSA_MMU2 = build_src_filter=+ + +PASSWORD_FEATURE = build_src_filter=+ + +ADVANCED_PAUSE_FEATURE = build_src_filter=+ + + +PSU_CONTROL = build_src_filter=+ +HAS_POWER_MONITOR = build_src_filter=+ + +POWER_LOSS_RECOVERY = build_src_filter=+ + +HAS_PTC = build_src_filter=+ + +HAS_FILAMENT_SENSOR = build_src_filter=+ + +(EXT|MANUAL)_SOLENOID.* = build_src_filter=+ + +MK2_MULTIPLEXER = build_src_filter=+ +HAS_CUTTER = build_src_filter=+ + +HAS_DRIVER_SAFE_POWER_PROTECT = build_src_filter=+ +EXPERIMENTAL_I2CBUS = build_src_filter=+ + +G26_MESH_VALIDATION = build_src_filter=+ +ASSISTED_TRAMMING = build_src_filter=+ + +HAS_MESH = build_src_filter=+ +HAS_LEVELING = build_src_filter=+ + +MECHANICAL_GANTRY_CAL.+ = build_src_filter=+ +Z_MULTI_ENDSTOPS|Z_STEPPER_AUTO_ALIGN = build_src_filter=+ +Z_STEPPER_AUTO_ALIGN = build_src_filter=+ +DELTA_AUTO_CALIBRATION = build_src_filter=+ +CALIBRATION_GCODE = build_src_filter=+ +Z_MIN_PROBE_REPEATABILITY_TEST = build_src_filter=+ +M100_FREE_MEMORY_WATCHER = build_src_filter=+ +BACKLASH_GCODE = build_src_filter=+ +IS_KINEMATIC = build_src_filter=+ +HAS_EXTRA_ENDSTOPS = build_src_filter=+ +SKEW_CORRECTION_GCODE = build_src_filter=+ +DIRECT_PIN_CONTROL = build_src_filter=+ + +PINS_DEBUGGING = build_src_filter=+ +HAS_MULTI_EXTRUDER = build_src_filter=+ +HAS_HOTEND_OFFSET = build_src_filter=+ +EDITABLE_SERVO_ANGLES = build_src_filter=+ +PIDTEMP = build_src_filter=+ +PREVENT_COLD_EXTRUSION = build_src_filter=+ +PIDTEMPBED = build_src_filter=+ +HAS_USER_THERMISTORS = build_src_filter=+ +PIDTEMPCHAMBER = build_src_filter=+ +SD_ABORT_ON_ENDSTOP_HIT = build_src_filter=+ +BAUD_RATE_GCODE = build_src_filter=+ +HAS_SMART_EFF_MOD = build_src_filter=+ +COOLANT_CONTROL|AIR_ASSIST = build_src_filter=+ +AIR_EVACUATION = build_src_filter=+ +HAS_SOFTWARE_ENDSTOPS = build_src_filter=+ +SERVO_DETACH_GCODE = build_src_filter=+ +HAS_DUPLICATION_MODE = build_src_filter=+ +SPI_FLASH_BACKUP = build_src_filter=+ +PLATFORM_M997_SUPPORT = build_src_filter=+ +FT_MOTION = build_src_filter=+ + +LIN_ADVANCE = build_src_filter=+ +PHOTO_GCODE = build_src_filter=+ +CONTROLLER_FAN_EDITABLE = build_src_filter=+ +HAS_ZV_SHAPING = build_src_filter=+ +GCODE_MACROS = build_src_filter=+ +GRADIENT_MIX = build_src_filter=+ +OTA_FIRMWARE_UPDATE = build_src_filter=+ +HAS_SAVED_POSITIONS = build_src_filter=+ + +PARK_HEAD_ON_PAUSE = build_src_filter=+ +FILAMENT_LOAD_UNLOAD_GCODES = build_src_filter=+ +CNC_WORKSPACE_PLANES = build_src_filter=+ +CNC_COORDINATE_SYSTEMS = build_src_filter=+ +HAS_M206_COMMAND = build_src_filter=+ +EXPECTED_PRINTER_CHECK = build_src_filter=+ +HOST_KEEPALIVE_FEATURE = build_src_filter=+ +AUTO_REPORT_POSITION = build_src_filter=+ +REPETIER_GCODE_M360 = build_src_filter=+ +HAS_GCODE_M876 = build_src_filter=+ +HAS_RESUME_CONTINUE = build_src_filter=+ +SET_PROGRESS_MANUALLY = build_src_filter=+ +HAS_STATUS_MESSAGE = build_src_filter=+ +HAS_PREHEAT = build_src_filter=+ +HAS_LCD_CONTRAST = build_src_filter=+ +HAS_GCODE_M255 = build_src_filter=+ +HAS_LCD_BRIGHTNESS = build_src_filter=+ +HAS_SOUND = build_src_filter=+ +HAS_MULTI_LANGUAGE = build_src_filter=+ +TOUCH_SCREEN_CALIBRATION = build_src_filter=+ +ARC_SUPPORT = build_src_filter=+ +GCODE_MOTION_MODES = build_src_filter=+ +BABYSTEPPING = build_src_filter=+ + +Z_PROBE_SLED = build_src_filter=+ +G38_PROBE_TARGET = build_src_filter=+ +MAGNETIC_PARKING_EXTRUDER = build_src_filter=+ +HAS_MEDIA = build_src_filter=+ + + + + + + +HAS_MEDIA_SUBCALLS = build_src_filter=+ +GCODE_REPEAT_MARKERS = build_src_filter=+ + +HAS_EXTRUDERS = build_src_filter=+ + +HAS_HOTEND = build_src_filter=+ +HAS_FAN = build_src_filter=+ +HAS_HEATED_BED = build_src_filter=+ +HAS_HEATED_CHAMBER = build_src_filter=+ +HAS_COOLER = build_src_filter=+ +AUTO_REPORT_TEMPERATURES = build_src_filter=+ +HAS_TEMP_PROBE = build_src_filter=+ +HAS_PID_HEATING = build_src_filter=+ +MPCTEMP = build_src_filter=+ +INCH_MODE_SUPPORT = build_src_filter=+ +TEMPERATURE_UNITS_SUPPORT = build_src_filter=+ +NEED_HEX_PRINT = build_src_filter=+ +NEED_LSF = build_src_filter=+ +NOZZLE_PARK_FEATURE = build_src_filter=+ + +NOZZLE_CLEAN_FEATURE = build_src_filter=+ + +DELTA = build_src_filter=+ + +POLARGRAPH = build_src_filter=+ +BEZIER_CURVE_SUPPORT = build_src_filter=+ + +PRINTCOUNTER = build_src_filter=+ +HAS_BED_PROBE = build_src_filter=+ + + + +IS_SCARA = build_src_filter=+ +HAS_SERVOS = build_src_filter=+ + +MORGAN_SCARA = build_src_filter=+ +HAS_MICROSTEPS = build_src_filter=+ (ESP3D_)?WIFISUPPORT = AsyncTCP, ESP Async WebServer ESP3DLib=https://github.com/luc-github/ESP3DLib/archive/master.zip arduinoWebSockets=links2004/WebSockets@2.3.4 From e7de3b92c9952e160c0b46479437cf5de0e993e8 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 13 May 2023 00:19:22 +0000 Subject: [PATCH 007/100] [cron] Bump distribution date (2023-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 9a13c5ce3e14b..f2258b55e74f4 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 "2023-05-12" +//#define STRING_DISTRIBUTION_DATE "2023-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 e4eb143c3ddf8..3f3032fe33d2c 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 "2023-05-12" + #define STRING_DISTRIBUTION_DATE "2023-05-13" #endif /** From e41dc273c9d9ee05947ecd66c44c7c7a91868545 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 12 May 2023 20:13:12 -0500 Subject: [PATCH 008/100] =?UTF-8?q?=F0=9F=94=A7=20Update=20config.ini=20an?= =?UTF-8?q?d=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/config.ini | 10 +++++----- .../share/PlatformIO/scripts/configuration.py | 20 ++++++++++++++----- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Marlin/config.ini b/Marlin/config.ini index 6d2a49c2edf8d..17ff3bec7efb7 100644 --- a/Marlin/config.ini +++ b/Marlin/config.ini @@ -42,7 +42,7 @@ preheat_1_temp_hotend = 180 bang_max = 255 pidtemp = on pid_k1 = 0.95 -pid_max = BANG_MAX +pid_max = 255 pid_functional_range = 10 default_kp = 22.20 @@ -96,10 +96,10 @@ step_state_x = HIGH step_state_y = HIGH step_state_z = HIGH -disable_x = false -disable_y = false -disable_z = false -disable_e = false +disable_x = off +disable_y = off +disable_z = off +disable_e = off proportional_font_ratio = 1.0 default_nominal_filament_dia = 1.75 diff --git a/buildroot/share/PlatformIO/scripts/configuration.py b/buildroot/share/PlatformIO/scripts/configuration.py index 3fc43ed6d89a6..250d9bbd7f11b 100644 --- a/buildroot/share/PlatformIO/scripts/configuration.py +++ b/buildroot/share/PlatformIO/scripts/configuration.py @@ -18,7 +18,16 @@ def apply_opt(name, val, conf=None): if name == "lcd": name, val = val, "on" # Create a regex to match the option and capture parts of the line - regex = re.compile(rf'^(\s*)(//\s*)?(#define\s+)({name}\b)(\s*)(.*?)(\s*)(//.*)?$', re.IGNORECASE) + # 1: Indentation + # 2: Comment + # 3: #define and whitespace + # 4: Option name + # 5: First space after name + # 6: Remaining spaces between name and value + # 7: Option value + # 8: Whitespace after value + # 9: End comment + regex = re.compile(rf'^(\s*)(//\s*)?(#define\s+)({name}\b)(\s?)(\s*)(.*?)(\s*)(//.*)?$', re.IGNORECASE) # Find and enable and/or update all matches for file in ("Configuration.h", "Configuration_adv.h"): @@ -37,10 +46,11 @@ def apply_opt(name, val, conf=None): newline = re.sub(r'^(\s*)(#define)(\s{1,3})?(\s*)', r'\1//\2 \4', line) else: # For options with values, enable and set the value - newline = match[1] + match[3] + match[4] + match[5] + val - if match[8]: - sp = match[7] if match[7] else ' ' - newline += sp + match[8] + addsp = '' if match[5] else ' ' + newline = match[1] + match[3] + match[4] + match[5] + addsp + val + match[6] + if match[9]: + sp = match[8] if match[8] else ' ' + newline += sp + match[9] lines[i] = newline blab(f"Set {name} to {val}") From 18005cb91e6d731b332b0baa29902bdd46a14313 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 13 May 2023 16:12:59 -0500 Subject: [PATCH 009/100] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Con?= =?UTF-8?q?stexpr=20types.h=20operators=20(#25811)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/types.h | 491 ++++++++++++++++++---------------------- 1 file changed, 225 insertions(+), 266 deletions(-) diff --git a/Marlin/src/core/types.h b/Marlin/src/core/types.h index 20f589d60a0ca..4c7ebc884fb67 100644 --- a/Marlin/src/core/types.h +++ b/Marlin/src/core/types.h @@ -78,14 +78,34 @@ template struct IF { typedef L type; }; #define LOGICAL_AXIS_MAP(F) MAP(F, LOGICAL_AXIS_NAMES) #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) - #define SECONDARY_AXIS_GANG(V...) GANG_N(SECONDARY_AXES, V) #define SECONDARY_AXIS_CODE(V...) CODE_N(SECONDARY_AXES, V) #define SECONDARY_AXIS_LIST(V...) LIST_N(SECONDARY_AXES, V) #define SECONDARY_AXIS_ARGS(T) SECONDARY_AXIS_LIST(T i, T j, T k, T u, T v, T w) +// Just the XY or XYZ elements +#if HAS_Z_AXIS + #define XYZ_COUNT 3 + #define XY_COUNT 2 +#elif HAS_Y_AXIS + #define XY_COUNT 2 +#elif HAS_X_AXIS + #define XY_COUNT 1 +#else + #define XY_COUNT 0 +#endif +#ifndef XYZ_COUNT + #define XYZ_COUNT XY_COUNT +#endif +#define XY_LIST(V...) LIST_N(XY_COUNT, V) +#define XY_ARRAY(V...) ARRAY_N(XY_COUNT, V) +#define XY_CODE(V...) CODE_N(XY_COUNT, V) +#define XY_GANG(V...) GANG_N(XY_COUNT, V) +#define XYZ_LIST(V...) LIST_N(XYZ_COUNT, V) +#define XYZ_ARRAY(V...) ARRAY_N(XYZ_COUNT, V) +#define XYZ_CODE(V...) CODE_N(XYZ_COUNT, V) +#define XYZ_GANG(V...) GANG_N(XYZ_COUNT, V) + #if HAS_ROTATIONAL_AXES #define ROTATIONAL_AXIS_GANG(V...) GANG_N(ROTATIONAL_AXES, V) #endif @@ -110,8 +130,10 @@ template struct IF { typedef L type; }; // Helpers #define _RECIP(N) ((N) ? 1.0f / static_cast(N) : 0.0f) #define _ABS(N) ((N) < 0 ? -(N) : (N)) -#define _LS(N) (N = (T)(uint32_t(N) << p)) -#define _RS(N) (N = (T)(uint32_t(N) >> p)) +#define _LS(N) T(uint32_t(N) << p) +#define _RS(N) T(uint32_t(N) >> p) +#define _LSE(N) N = T(uint32_t(N) << p) +#define _RSE(N) N = T(uint32_t(N) >> p) #define FI FORCE_INLINE // Define types based on largest bit width stored value required @@ -345,6 +367,7 @@ void toNative(xyze_pos_t &lpos); // // Paired XY coordinates, counters, flags, etc. +// Always has XY elements regardless of the number of configured axes. // template struct XYval { @@ -355,138 +378,116 @@ struct XYval { }; // Set all to 0 - FI void reset() { x = y = 0; } + FI void reset() { x = y = 0; } // Setters taking struct types and arrays #if HAS_X_AXIS - FI void set(const T px) { x = px; } + FI void set(const T px) { x = px; } #endif #if HAS_Y_AXIS - FI void set(const T px, const T py) { x = px; y = py; } - FI void set(const T (&arr)[XY]) { x = arr[0]; y = arr[1]; } + FI void set(const T px, const T py) { x = px; y = py; } + FI void set(const T (&arr)[XY]) { x = arr[0]; y = arr[1]; } #endif #if NUM_AXES > XY - FI void set(const T (&arr)[NUM_AXES]) { x = arr[0]; y = arr[1]; } + FI void set(const T (&arr)[NUM_AXES]) { x = arr[0]; y = arr[1]; } #endif #if LOGICAL_AXES > NUM_AXES - FI void set(const T (&arr)[LOGICAL_AXES]) { x = arr[0]; y = arr[1]; } + FI void set(const T (&arr)[LOGICAL_AXES]) { x = arr[0]; y = arr[1]; } #if DISTINCT_AXES > LOGICAL_AXES - FI void set(const T (&arr)[DISTINCT_AXES]) { x = arr[0]; y = arr[1]; } + FI void set(const T (&arr)[DISTINCT_AXES]) { x = arr[0]; y = arr[1]; } #endif #endif // Length reduced to one dimension - FI T magnitude() const { return (T)sqrtf(x*x + y*y); } + FI constexpr T magnitude() const { return (T)sqrtf(x*x + y*y); } // Pointer to the data as a simple array - FI operator T* () { return pos; } + FI operator T* () { return pos; } // If any element is true then it's true - FI operator bool() { return x || y; } + FI constexpr operator bool() const { return x || y; } // Smallest element - FI T small() const { return _MIN(x, y); } + FI constexpr T small() const { return _MIN(x, y); } // Largest element - FI T large() const { return _MAX(x, y); } + FI constexpr T large() const { return _MAX(x, y); } // Explicit copy and copies with conversion - FI XYval copy() const { return *this; } - FI XYval ABS() const { return { T(_ABS(x)), T(_ABS(y)) }; } - FI XYval asInt() { return { int16_t(x), int16_t(y) }; } - FI XYval asInt() const { return { int16_t(x), int16_t(y) }; } - FI XYval asLong() { return { int32_t(x), int32_t(y) }; } - FI XYval asLong() const { return { int32_t(x), int32_t(y) }; } - FI XYval ROUNDL() { return { int32_t(LROUND(x)), int32_t(LROUND(y)) }; } - FI XYval ROUNDL() const { return { int32_t(LROUND(x)), int32_t(LROUND(y)) }; } - FI XYval asFloat() { return { static_cast(x), static_cast(y) }; } - FI XYval asFloat() const { return { static_cast(x), static_cast(y) }; } - FI XYval reciprocal() const { return { _RECIP(x), _RECIP(y) }; } + FI constexpr XYval copy() const { return *this; } + FI constexpr XYval ABS() const { return { T(_ABS(x)), T(_ABS(y)) }; } + FI constexpr XYval asInt() const { return { int16_t(x), int16_t(y) }; } + FI constexpr XYval asLong() const { return { int32_t(x), int32_t(y) }; } + FI constexpr XYval ROUNDL() const { return { int32_t(LROUND(x)), int32_t(LROUND(y)) }; } + FI constexpr XYval asFloat() const { return { static_cast(x), static_cast(y) }; } + FI constexpr XYval reciprocal() const { return { _RECIP(x), _RECIP(y) }; } // Marlin workspace shifting is done with G92 and M206 - FI XYval asLogical() const { XYval o = asFloat(); toLogical(o); return o; } - FI XYval asNative() const { XYval o = asFloat(); toNative(o); return o; } + FI XYval asLogical() const { XYval o = asFloat(); toLogical(o); return o; } + FI XYval asNative() const { XYval o = asFloat(); toNative(o); return o; } // Cast to a type with more fields by making a new object - FI operator XYZval() { return { x, y }; } - FI operator XYZval() const { return { x, y }; } - FI operator XYZEval() { return { x, y }; } - FI operator XYZEval() const { return { x, y }; } + FI constexpr operator XYZval() const { return { x, y }; } + FI constexpr operator XYZEval() const { return { x, y }; } // Accessor via an AxisEnum (or any integer) [index] - FI T& operator[](const int n) { return pos[n]; } - FI const T& operator[](const int n) const { return pos[n]; } + FI T& operator[](const int n) { return pos[n]; } + FI const T& operator[](const int n) const { return pos[n]; } // Assignment operator overrides do the expected thing - FI XYval& operator= (const T v) { set(v, v ); return *this; } - FI XYval& operator= (const XYZval &rs) { set(rs.x, rs.y); return *this; } - FI XYval& operator= (const XYZEval &rs) { set(rs.x, rs.y); return *this; } + FI XYval& operator= (const T v) { set(v, v); return *this; } + FI XYval& operator= (const XYZval &rs) { set(XY_LIST(rs.x, rs.y)); return *this; } + FI XYval& operator= (const XYZEval &rs) { set(XY_LIST(rs.x, rs.y)); return *this; } // Override other operators to get intuitive behaviors - FI XYval operator+ (const XYval &rs) const { XYval ls = *this; ls.x += rs.x; ls.y += rs.y; return ls; } - FI XYval operator+ (const XYval &rs) { XYval ls = *this; ls.x += rs.x; ls.y += rs.y; return ls; } - FI XYval operator- (const XYval &rs) const { XYval ls = *this; ls.x -= rs.x; ls.y -= rs.y; return ls; } - FI XYval operator- (const XYval &rs) { XYval ls = *this; ls.x -= rs.x; ls.y -= rs.y; return ls; } - FI XYval operator* (const XYval &rs) const { XYval ls = *this; ls.x *= rs.x; ls.y *= rs.y; return ls; } - FI XYval operator* (const XYval &rs) { XYval ls = *this; ls.x *= rs.x; ls.y *= rs.y; return ls; } - FI XYval operator/ (const XYval &rs) const { XYval ls = *this; ls.x /= rs.x; ls.y /= rs.y; return ls; } - FI XYval operator/ (const XYval &rs) { XYval ls = *this; ls.x /= rs.x; ls.y /= rs.y; return ls; } - FI XYval operator+ (const XYZval &rs) const { XYval ls = *this; ls.x += rs.x; ls.y += rs.y; return ls; } - FI XYval operator+ (const XYZval &rs) { XYval ls = *this; ls.x += rs.x; ls.y += rs.y; return ls; } - FI XYval operator- (const XYZval &rs) const { XYval ls = *this; ls.x -= rs.x; ls.y -= rs.y; return ls; } - FI XYval operator- (const XYZval &rs) { XYval ls = *this; ls.x -= rs.x; ls.y -= rs.y; return ls; } - FI XYval operator* (const XYZval &rs) const { XYval ls = *this; ls.x *= rs.x; ls.y *= rs.y; return ls; } - FI XYval operator* (const XYZval &rs) { XYval ls = *this; ls.x *= rs.x; ls.y *= rs.y; return ls; } - FI XYval operator/ (const XYZval &rs) const { XYval ls = *this; ls.x /= rs.x; ls.y /= rs.y; return ls; } - FI XYval operator/ (const XYZval &rs) { XYval ls = *this; ls.x /= rs.x; ls.y /= rs.y; return ls; } - FI XYval operator+ (const XYZEval &rs) const { XYval ls = *this; ls.x += rs.x; ls.y += rs.y; return ls; } - FI XYval operator+ (const XYZEval &rs) { XYval ls = *this; ls.x += rs.x; ls.y += rs.y; return ls; } - FI XYval operator- (const XYZEval &rs) const { XYval ls = *this; ls.x -= rs.x; ls.y -= rs.y; return ls; } - FI XYval operator- (const XYZEval &rs) { XYval ls = *this; ls.x -= rs.x; ls.y -= rs.y; return ls; } - FI XYval operator* (const XYZEval &rs) const { XYval ls = *this; ls.x *= rs.x; ls.y *= rs.y; return ls; } - FI XYval operator* (const XYZEval &rs) { XYval ls = *this; ls.x *= rs.x; ls.y *= rs.y; return ls; } - FI XYval operator/ (const XYZEval &rs) const { XYval ls = *this; ls.x /= rs.x; ls.y /= rs.y; return ls; } - FI XYval operator/ (const XYZEval &rs) { XYval ls = *this; ls.x /= rs.x; ls.y /= rs.y; return ls; } - FI XYval operator* (const float &p) const { XYval ls = *this; ls.x *= p; ls.y *= p; return ls; } - FI XYval operator* (const float &p) { XYval ls = *this; ls.x *= p; ls.y *= p; return ls; } - FI XYval operator* (const int &p) const { XYval ls = *this; ls.x *= p; ls.y *= p; return ls; } - FI XYval operator* (const int &p) { XYval ls = *this; ls.x *= p; ls.y *= p; return ls; } - FI XYval operator/ (const float &p) const { XYval ls = *this; ls.x /= p; ls.y /= p; return ls; } - FI XYval operator/ (const float &p) { XYval ls = *this; ls.x /= p; ls.y /= p; return ls; } - FI XYval operator/ (const int &p) const { XYval ls = *this; ls.x /= p; ls.y /= p; return ls; } - FI XYval operator/ (const int &p) { XYval ls = *this; ls.x /= p; ls.y /= p; return ls; } - FI XYval operator>>(const int &p) const { XYval ls = *this; _RS(ls.x); _RS(ls.y); return ls; } - FI XYval operator>>(const int &p) { XYval ls = *this; _RS(ls.x); _RS(ls.y); return ls; } - FI XYval operator<<(const int &p) const { XYval ls = *this; _LS(ls.x); _LS(ls.y); return ls; } - FI XYval operator<<(const int &p) { XYval ls = *this; _LS(ls.x); _LS(ls.y); return ls; } - FI const XYval operator-() const { XYval o = *this; o.x = -x; o.y = -y; return o; } - FI XYval operator-() { XYval o = *this; o.x = -x; o.y = -y; return o; } + #define XY_OP(OP) { x TERN_(HAS_X_AXIS, OP rs.x), y TERN_(HAS_Y_AXIS, OP rs.y) } + FI constexpr XYval operator+ (const XYval &rs) const { return { x + rs.x, y + rs.y }; } + FI constexpr XYval operator- (const XYval &rs) const { return { x - rs.x, y - rs.y }; } + FI constexpr XYval operator* (const XYval &rs) const { return { x * rs.x, y * rs.y }; } + FI constexpr XYval operator/ (const XYval &rs) const { return { x / rs.x, y / rs.y }; } + FI constexpr XYval operator+ (const XYZval &rs) const { return { XY_OP(+) }; } + FI constexpr XYval operator- (const XYZval &rs) const { return { XY_OP(-) }; } + FI constexpr XYval operator* (const XYZval &rs) const { return { XY_OP(*) }; } + FI constexpr XYval operator/ (const XYZval &rs) const { return { XY_OP(/) }; } + FI constexpr XYval operator+ (const XYZEval &rs) const { return { XY_OP(+) }; } + FI constexpr XYval operator- (const XYZEval &rs) const { return { XY_OP(-) }; } + FI constexpr XYval operator* (const XYZEval &rs) const { return { XY_OP(*) }; } + FI constexpr XYval operator/ (const XYZEval &rs) const { return { XY_OP(/) }; } + FI constexpr XYval operator* (const float &p) const { return { x * p, y * p }; } + FI constexpr XYval operator* (const int &p) const { return { x * p, y * p }; } + FI constexpr XYval operator/ (const float &p) const { return { x / p, y / p }; } + FI constexpr XYval operator/ (const int &p) const { return { x / p, y / p }; } + FI constexpr XYval operator>>(const int &p) const { return { _RS(x), _RS(y) }; } + FI constexpr XYval operator<<(const int &p) const { return { _LS(x), _LS(y) }; } + FI constexpr XYval operator-() const { return { -x, -y }; } + #undef XY_OP // Modifier operators - FI XYval& operator+=(const XYval &rs) { x += rs.x; y += rs.y; return *this; } - FI XYval& operator-=(const XYval &rs) { x -= rs.x; y -= rs.y; return *this; } - FI XYval& operator*=(const XYval &rs) { x *= rs.x; y *= rs.y; return *this; } - FI XYval& operator/=(const XYval &rs) { x /= rs.x; y /= rs.y; return *this; } - FI XYval& operator+=(const XYZval &rs) { NUM_AXIS_CODE(x += rs.x, y += rs.y,,,,,,, ); return *this; } - FI XYval& operator-=(const XYZval &rs) { NUM_AXIS_CODE(x -= rs.x, y -= rs.y,,,,,,, ); return *this; } - FI XYval& operator*=(const XYZval &rs) { NUM_AXIS_CODE(x *= rs.x, y *= rs.y,,,,,,, ); return *this; } - FI XYval& operator/=(const XYZval &rs) { NUM_AXIS_CODE(x /= rs.x, y /= rs.y,,,,,,, ); return *this; } - FI XYval& operator+=(const XYZEval &rs) { NUM_AXIS_CODE(x += rs.x, y += rs.y,,,,,,, ); return *this; } - FI XYval& operator-=(const XYZEval &rs) { NUM_AXIS_CODE(x -= rs.x, y -= rs.y,,,,,,, ); return *this; } - FI XYval& operator*=(const XYZEval &rs) { NUM_AXIS_CODE(x *= rs.x, y *= rs.y,,,,,,, ); return *this; } - FI XYval& operator/=(const XYZEval &rs) { NUM_AXIS_CODE(x /= rs.x, y /= rs.y,,,,,,, ); return *this; } - FI XYval& operator*=(const float &p) { x *= p; y *= p; return *this; } - FI XYval& operator*=(const int &p) { x *= p; y *= p; return *this; } - FI XYval& operator>>=(const int &p) { _RS(x); _RS(y); return *this; } - FI XYval& operator<<=(const int &p) { _LS(x); _LS(y); return *this; } + FI XYval& operator+=(const XYval &rs) { x += rs.x; y += rs.y; return *this; } + FI XYval& operator-=(const XYval &rs) { x -= rs.x; y -= rs.y; return *this; } + FI XYval& operator*=(const XYval &rs) { x *= rs.x; y *= rs.y; return *this; } + FI XYval& operator/=(const XYval &rs) { x /= rs.x; y /= rs.y; return *this; } + FI XYval& operator+=(const XYZval &rs) { XY_CODE(x += rs.x, y += rs.y); return *this; } + FI XYval& operator-=(const XYZval &rs) { XY_CODE(x -= rs.x, y -= rs.y); return *this; } + FI XYval& operator*=(const XYZval &rs) { XY_CODE(x *= rs.x, y *= rs.y); return *this; } + FI XYval& operator/=(const XYZval &rs) { XY_CODE(x /= rs.x, y /= rs.y); return *this; } + FI XYval& operator+=(const XYZEval &rs) { XY_CODE(x += rs.x, y += rs.y); return *this; } + FI XYval& operator-=(const XYZEval &rs) { XY_CODE(x -= rs.x, y -= rs.y); return *this; } + FI XYval& operator*=(const XYZEval &rs) { XY_CODE(x *= rs.x, y *= rs.y); return *this; } + FI XYval& operator/=(const XYZEval &rs) { XY_CODE(x /= rs.x, y /= rs.y); return *this; } + FI XYval& operator*=(const float &p) { x *= p; y *= p; return *this; } + FI XYval& operator*=(const int &p) { x *= p; y *= p; return *this; } + FI XYval& operator>>=(const int &p) { _RSE(x); _RSE(y); return *this; } + FI XYval& operator<<=(const int &p) { _LSE(x); _LSE(y); return *this; } // Exact comparisons. For floats a "NEAR" operation may be better. - FI bool operator==(const XYval &rs) const { return true NUM_AXIS_GANG(&& x == rs.x, && y == rs.y,,,,,,, ); } - FI bool operator==(const XYZval &rs) const { return true NUM_AXIS_GANG(&& x == rs.x, && y == rs.y,,,,,,, ); } - FI bool operator==(const XYZEval &rs) const { return true NUM_AXIS_GANG(&& x == rs.x, && y == rs.y,,,,,,, ); } - FI bool operator!=(const XYval &rs) const { return !operator==(rs); } - FI bool operator!=(const XYZval &rs) const { return !operator==(rs); } - FI bool operator!=(const XYZEval &rs) const { return !operator==(rs); } + FI bool operator==(const XYval &rs) const { return x == rs.x && y == rs.y; } + FI bool operator==(const XYZval &rs) const { return ENABLED(HAS_X_AXIS) XY_GANG(&& x == rs.x, && y == rs.y); } + FI bool operator==(const XYZEval &rs) const { return ENABLED(HAS_X_AXIS) XY_GANG(&& x == rs.x, && y == rs.y); } + FI bool operator!=(const XYval &rs) const { return !operator==(rs); } + FI bool operator!=(const XYZval &rs) const { return !operator==(rs); } + FI bool operator!=(const XYZEval &rs) const { return !operator==(rs); } }; // // Linear Axes coordinates, counters, flags, etc. +// May have any number of axes according to configuration, including zero axes. // template struct XYZval { @@ -502,12 +503,12 @@ struct XYZval { FI void reset() { NUM_AXIS_CODE(x = 0, y = 0, z = 0, i = 0, j = 0, k = 0, u = 0, v = 0, w = 0); } // Setters taking struct types and arrays - FI void set(const XYval pxy) { NUM_AXIS_CODE(x = pxy.x, y = pxy.y,,,,,,,); } - FI void set(const XYval pxy, const T pz) { NUM_AXIS_CODE(x = pxy.x, y = pxy.y, z = pz,,,,,,); } + FI void set(const XYval pxy) { XY_CODE(x = pxy.x, y = pxy.y); } + FI void set(const XYval pxy, const T pz) { XYZ_CODE(x = pxy.x, y = pxy.y, z = pz); } FI void set(const T (&arr)[NUM_AXES]) { NUM_AXIS_CODE(x = arr[0], y = arr[1], z = arr[2], i = arr[3], j = arr[4], k = arr[5], u = arr[6], v = arr[7], w = arr[8]); } #if LOGICAL_AXES > NUM_AXES FI void set(const T (&arr)[LOGICAL_AXES]) { NUM_AXIS_CODE(x = arr[0], y = arr[1], z = arr[2], i = arr[3], j = arr[4], k = arr[5], u = arr[6], v = arr[7], w = arr[8]); } - FI void set(LOGICAL_AXIS_ARGS(const T)) { NUM_AXIS_CODE(a = x, b = y, c = z, _i = i, _j = j, _k = k, _u = u, _v = v, _w = w ); } + FI void set(LOGICAL_AXIS_ARGS(const T)) { NUM_AXIS_CODE(a = x, b = y, c = z, _i = i, _j = j, _k = k, _u = u, _v = v, _w = w); } #if DISTINCT_AXES > LOGICAL_AXES FI void set(const T (&arr)[DISTINCT_AXES]) { NUM_AXIS_CODE(x = arr[0], y = arr[1], z = arr[2], i = arr[3], j = arr[4], k = arr[5], u = arr[6], v = arr[7], w = arr[8]); } #endif @@ -543,114 +544,93 @@ struct XYZval { #endif // Length reduced to one dimension - FI T magnitude() const { return (T)TERN(HAS_X_AXIS, sqrtf(NUM_AXIS_GANG(x*x, + y*y, + z*z, + i*i, + j*j, + k*k, + u*u, + v*v, + w*w)), 0); } + FI constexpr T magnitude() const { return (T)TERN(HAS_X_AXIS, sqrtf(NUM_AXIS_GANG(x*x, + y*y, + z*z, + i*i, + j*j, + k*k, + u*u, + v*v, + w*w)), 0); } // Pointer to the data as a simple array - FI operator T* () { return (T*)this; } + FI operator T* () { return pos; } // If any element is true then it's true - FI operator bool() { return 0 NUM_AXIS_GANG(|| x, || y, || z, || i, || j, || k, || u, || v, || w); } + FI constexpr operator bool() const { return 0 NUM_AXIS_GANG(|| x, || y, || z, || i, || j, || k, || u, || v, || w); } // Smallest element - FI T small() const { return TERN(HAS_X_AXIS,_MIN(NUM_AXIS_LIST(x, y, z, i, j, k, u, v, w));,0;) } + FI constexpr T small() const { return TERN(HAS_X_AXIS, _MIN(NUM_AXIS_LIST(x, y, z, i, j, k, u, v, w)), 0); } // Largest element - FI T large() const { return TERN(HAS_X_AXIS,_MAX(NUM_AXIS_LIST(x, y, z, i, j, k, u, v, w));,0;) } + FI constexpr T large() const { return TERN(HAS_X_AXIS, _MAX(NUM_AXIS_LIST(x, y, z, i, j, k, u, v, w)), 0); } // Explicit copy and copies with conversion - FI XYZval copy() const { XYZval o = *this; return o; } - FI XYZval ABS() const { return NUM_AXIS_ARRAY(T(_ABS(x)), T(_ABS(y)), T(_ABS(z)), T(_ABS(i)), T(_ABS(j)), T(_ABS(k)), T(_ABS(u)), T(_ABS(v)), T(_ABS(w))); } - FI XYZval asInt() { return NUM_AXIS_ARRAY(int16_t(x), int16_t(y), int16_t(z), int16_t(i), int16_t(j), int16_t(k), int16_t(u), int16_t(v), int16_t(w)); } - FI XYZval asInt() const { return NUM_AXIS_ARRAY(int16_t(x), int16_t(y), int16_t(z), int16_t(i), int16_t(j), int16_t(k), int16_t(u), int16_t(v), int16_t(w)); } - FI XYZval asLong() { return NUM_AXIS_ARRAY(int32_t(x), int32_t(y), int32_t(z), int32_t(i), int32_t(j), int32_t(k), int32_t(u), int32_t(v), int32_t(w)); } - FI XYZval asLong() const { return NUM_AXIS_ARRAY(int32_t(x), int32_t(y), int32_t(z), int32_t(i), int32_t(j), int32_t(k), int32_t(u), int32_t(v), int32_t(w)); } - FI XYZval ROUNDL() { return NUM_AXIS_ARRAY(int32_t(LROUND(x)), int32_t(LROUND(y)), int32_t(LROUND(z)), int32_t(LROUND(i)), int32_t(LROUND(j)), int32_t(LROUND(k)), int32_t(LROUND(u)), int32_t(LROUND(v)), int32_t(LROUND(w))); } - FI XYZval ROUNDL() const { return NUM_AXIS_ARRAY(int32_t(LROUND(x)), int32_t(LROUND(y)), int32_t(LROUND(z)), int32_t(LROUND(i)), int32_t(LROUND(j)), int32_t(LROUND(k)), int32_t(LROUND(u)), int32_t(LROUND(v)), int32_t(LROUND(w))); } - FI XYZval asFloat() { return NUM_AXIS_ARRAY(static_cast(x), static_cast(y), static_cast(z), static_cast(i), static_cast(j), static_cast(k), static_cast(u), static_cast(v), static_cast(w)); } - FI XYZval asFloat() const { return NUM_AXIS_ARRAY(static_cast(x), static_cast(y), static_cast(z), static_cast(i), static_cast(j), static_cast(k), static_cast(u), static_cast(v), static_cast(w)); } - FI XYZval reciprocal() const { return NUM_AXIS_ARRAY(_RECIP(x), _RECIP(y), _RECIP(z), _RECIP(i), _RECIP(j), _RECIP(k), _RECIP(u), _RECIP(v), _RECIP(w)); } + FI constexpr XYZval copy() const { XYZval o = *this; return o; } + FI constexpr XYZval ABS() const { return NUM_AXIS_ARRAY(T(_ABS(x)), T(_ABS(y)), T(_ABS(z)), T(_ABS(i)), T(_ABS(j)), T(_ABS(k)), T(_ABS(u)), T(_ABS(v)), T(_ABS(w))); } + FI constexpr XYZval asInt() const { return NUM_AXIS_ARRAY(int16_t(x), int16_t(y), int16_t(z), int16_t(i), int16_t(j), int16_t(k), int16_t(u), int16_t(v), int16_t(w)); } + FI constexpr XYZval asLong() const { return NUM_AXIS_ARRAY(int32_t(x), int32_t(y), int32_t(z), int32_t(i), int32_t(j), int32_t(k), int32_t(u), int32_t(v), int32_t(w)); } + FI constexpr XYZval ROUNDL() const { return NUM_AXIS_ARRAY(int32_t(LROUND(x)), int32_t(LROUND(y)), int32_t(LROUND(z)), int32_t(LROUND(i)), int32_t(LROUND(j)), int32_t(LROUND(k)), int32_t(LROUND(u)), int32_t(LROUND(v)), int32_t(LROUND(w))); } + FI constexpr XYZval asFloat() const { return NUM_AXIS_ARRAY(static_cast(x), static_cast(y), static_cast(z), static_cast(i), static_cast(j), static_cast(k), static_cast(u), static_cast(v), static_cast(w)); } + FI constexpr XYZval reciprocal() const { return NUM_AXIS_ARRAY(_RECIP(x), _RECIP(y), _RECIP(z), _RECIP(i), _RECIP(j), _RECIP(k), _RECIP(u), _RECIP(v), _RECIP(w)); } // Marlin workspace shifting is done with G92 and M206 - FI XYZval asLogical() const { XYZval o = asFloat(); toLogical(o); return o; } - FI XYZval asNative() const { XYZval o = asFloat(); toNative(o); return o; } + FI XYZval asLogical() const { XYZval o = asFloat(); toLogical(o); return o; } + FI XYZval asNative() const { XYZval o = asFloat(); toNative(o); return o; } // In-place cast to types having fewer fields - FI operator XYval&() { return *(XYval*)this; } - FI operator const XYval&() const { return *(const XYval*)this; } + FI operator XYval&() { return *(XYval*)this; } + FI operator const XYval&() const { return *(const XYval*)this; } // Cast to a type with more fields by making a new object - FI operator XYZEval() const { return NUM_AXIS_ARRAY(x, y, z, i, j, k, u, v, w); } + FI constexpr operator XYZEval() const { return NUM_AXIS_ARRAY(x, y, z, i, j, k, u, v, w); } // Accessor via an AxisEnum (or any integer) [index] - FI T& operator[](const int n) { return pos[n]; } - FI const T& operator[](const int n) const { return pos[n]; } + FI T& operator[](const int n) { return pos[n]; } + FI const T& operator[](const int n) const { return pos[n]; } // Assignment operator overrides do the expected thing - FI XYZval& operator= (const T v) { set(ARRAY_N_1(NUM_AXES, v)); return *this; } - FI XYZval& operator= (const XYval &rs) { set(rs.x, rs.y ); return *this; } - FI XYZval& operator= (const XYZEval &rs) { set(NUM_AXIS_ELEM(rs)); return *this; } + FI XYZval& operator= (const T v) { set(ARRAY_N_1(NUM_AXES, v)); return *this; } + FI XYZval& operator= (const XYval &rs) { set(rs.x, rs.y); return *this; } + FI XYZval& operator= (const XYZEval &rs) { set(NUM_AXIS_ELEM(rs)); return *this; } // Override other operators to get intuitive behaviors - FI XYZval operator+ (const XYval &rs) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x += rs.x, ls.y += rs.y,,,,,,, ); return ls; } - FI XYZval operator+ (const XYval &rs) { XYZval ls = *this; NUM_AXIS_CODE(ls.x += rs.x, ls.y += rs.y,,,,,,, ); return ls; } - FI XYZval operator- (const XYval &rs) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x -= rs.x, ls.y -= rs.y,,,,,,, ); return ls; } - FI XYZval operator- (const XYval &rs) { XYZval ls = *this; NUM_AXIS_CODE(ls.x -= rs.x, ls.y -= rs.y,,,,,,, ); return ls; } - FI XYZval operator* (const XYval &rs) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x *= rs.x, ls.y *= rs.y,,,,,,, ); return ls; } - FI XYZval operator* (const XYval &rs) { XYZval ls = *this; NUM_AXIS_CODE(ls.x *= rs.x, ls.y *= rs.y,,,,,,, ); return ls; } - FI XYZval operator/ (const XYval &rs) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x /= rs.x, ls.y /= rs.y,,,,,,, ); return ls; } - FI XYZval operator/ (const XYval &rs) { XYZval ls = *this; NUM_AXIS_CODE(ls.x /= rs.x, ls.y /= rs.y,,,,,,, ); return ls; } - FI XYZval operator+ (const XYZval &rs) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x += rs.x, ls.y += rs.y, ls.z += rs.z, ls.i += rs.i, ls.j += rs.j, ls.k += rs.k, ls.u += rs.u, ls.v += rs.v, ls.w += rs.w); return ls; } - FI XYZval operator+ (const XYZval &rs) { XYZval ls = *this; NUM_AXIS_CODE(ls.x += rs.x, ls.y += rs.y, ls.z += rs.z, ls.i += rs.i, ls.j += rs.j, ls.k += rs.k, ls.u += rs.u, ls.v += rs.v, ls.w += rs.w); return ls; } - FI XYZval operator- (const XYZval &rs) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x -= rs.x, ls.y -= rs.y, ls.z -= rs.z, ls.i -= rs.i, ls.j -= rs.j, ls.k -= rs.k, ls.u -= rs.u, ls.v -= rs.v, ls.w -= rs.w); return ls; } - FI XYZval operator- (const XYZval &rs) { XYZval ls = *this; NUM_AXIS_CODE(ls.x -= rs.x, ls.y -= rs.y, ls.z -= rs.z, ls.i -= rs.i, ls.j -= rs.j, ls.k -= rs.k, ls.u -= rs.u, ls.v -= rs.v, ls.w -= rs.w); return ls; } - FI XYZval operator* (const XYZval &rs) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x *= rs.x, ls.y *= rs.y, ls.z *= rs.z, ls.i *= rs.i, ls.j *= rs.j, ls.k *= rs.k, ls.u *= rs.u, ls.v *= rs.v, ls.w *= rs.w); return ls; } - FI XYZval operator* (const XYZval &rs) { XYZval ls = *this; NUM_AXIS_CODE(ls.x *= rs.x, ls.y *= rs.y, ls.z *= rs.z, ls.i *= rs.i, ls.j *= rs.j, ls.k *= rs.k, ls.u *= rs.u, ls.v *= rs.v, ls.w *= rs.w); return ls; } - FI XYZval operator/ (const XYZval &rs) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x /= rs.x, ls.y /= rs.y, ls.z /= rs.z, ls.i /= rs.i, ls.j /= rs.j, ls.k /= rs.k, ls.u /= rs.u, ls.v /= rs.v, ls.w /= rs.w); return ls; } - FI XYZval operator/ (const XYZval &rs) { XYZval ls = *this; NUM_AXIS_CODE(ls.x /= rs.x, ls.y /= rs.y, ls.z /= rs.z, ls.i /= rs.i, ls.j /= rs.j, ls.k /= rs.k, ls.u /= rs.u, ls.v /= rs.v, ls.w /= rs.w); return ls; } - FI XYZval operator+ (const XYZEval &rs) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x += rs.x, ls.y += rs.y, ls.z += rs.z, ls.i += rs.i, ls.j += rs.j, ls.k += rs.k, ls.u += rs.u, ls.v += rs.v, ls.w += rs.w); return ls; } - FI XYZval operator+ (const XYZEval &rs) { XYZval ls = *this; NUM_AXIS_CODE(ls.x += rs.x, ls.y += rs.y, ls.z += rs.z, ls.i += rs.i, ls.j += rs.j, ls.k += rs.k, ls.u += rs.u, ls.v += rs.v, ls.w += rs.w); return ls; } - FI XYZval operator- (const XYZEval &rs) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x -= rs.x, ls.y -= rs.y, ls.z -= rs.z, ls.i -= rs.i, ls.j -= rs.j, ls.k -= rs.k, ls.u -= rs.u, ls.v -= rs.v, ls.w -= rs.w); return ls; } - FI XYZval operator- (const XYZEval &rs) { XYZval ls = *this; NUM_AXIS_CODE(ls.x -= rs.x, ls.y -= rs.y, ls.z -= rs.z, ls.i -= rs.i, ls.j -= rs.j, ls.k -= rs.k, ls.u -= rs.u, ls.v -= rs.v, ls.w -= rs.w); return ls; } - FI XYZval operator* (const XYZEval &rs) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x *= rs.x, ls.y *= rs.y, ls.z *= rs.z, ls.i *= rs.i, ls.j *= rs.j, ls.k *= rs.k, ls.u *= rs.u, ls.v *= rs.v, ls.w *= rs.w); return ls; } - FI XYZval operator* (const XYZEval &rs) { XYZval ls = *this; NUM_AXIS_CODE(ls.x *= rs.x, ls.y *= rs.y, ls.z *= rs.z, ls.i *= rs.i, ls.j *= rs.j, ls.k *= rs.k, ls.u *= rs.u, ls.v *= rs.v, ls.w *= rs.w); return ls; } - FI XYZval operator/ (const XYZEval &rs) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x /= rs.x, ls.y /= rs.y, ls.z /= rs.z, ls.i /= rs.i, ls.j /= rs.j, ls.k /= rs.k, ls.u /= rs.u, ls.v /= rs.v, ls.w /= rs.w); return ls; } - FI XYZval operator/ (const XYZEval &rs) { XYZval ls = *this; NUM_AXIS_CODE(ls.x /= rs.x, ls.y /= rs.y, ls.z /= rs.z, ls.i /= rs.i, ls.j /= rs.j, ls.k /= rs.k, ls.u /= rs.u, ls.v /= rs.v, ls.w /= rs.w); return ls; } - FI XYZval operator* (const float &p) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x *= p, ls.y *= p, ls.z *= p, ls.i *= p, ls.j *= p, ls.k *= p, ls.u *= p, ls.v *= p, ls.w *= p ); return ls; } - FI XYZval operator* (const float &p) { XYZval ls = *this; NUM_AXIS_CODE(ls.x *= p, ls.y *= p, ls.z *= p, ls.i *= p, ls.j *= p, ls.k *= p, ls.u *= p, ls.v *= p, ls.w *= p ); return ls; } - FI XYZval operator* (const int &p) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x *= p, ls.y *= p, ls.z *= p, ls.i *= p, ls.j *= p, ls.k *= p, ls.u *= p, ls.v *= p, ls.w *= p ); return ls; } - FI XYZval operator* (const int &p) { XYZval ls = *this; NUM_AXIS_CODE(ls.x *= p, ls.y *= p, ls.z *= p, ls.i *= p, ls.j *= p, ls.k *= p, ls.u *= p, ls.v *= p, ls.w *= p ); return ls; } - FI XYZval operator/ (const float &p) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x /= p, ls.y /= p, ls.z /= p, ls.i /= p, ls.j /= p, ls.k /= p, ls.u /= p, ls.v /= p, ls.w /= p ); return ls; } - FI XYZval operator/ (const float &p) { XYZval ls = *this; NUM_AXIS_CODE(ls.x /= p, ls.y /= p, ls.z /= p, ls.i /= p, ls.j /= p, ls.k /= p, ls.u /= p, ls.v /= p, ls.w /= p ); return ls; } - FI XYZval operator/ (const int &p) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x /= p, ls.y /= p, ls.z /= p, ls.i /= p, ls.j /= p, ls.k /= p, ls.u /= p, ls.v /= p, ls.w /= p ); return ls; } - FI XYZval operator/ (const int &p) { XYZval ls = *this; NUM_AXIS_CODE(ls.x /= p, ls.y /= p, ls.z /= p, ls.i /= p, ls.j /= p, ls.k /= p, ls.u /= p, ls.v /= p, ls.w /= p ); return ls; } - FI XYZval operator>>(const int &p) const { XYZval ls = *this; NUM_AXIS_CODE(_RS(ls.x), _RS(ls.y), _RS(ls.z), _RS(ls.i), _RS(ls.j), _RS(ls.k), _RS(ls.u), _RS(ls.v), _RS(ls.w) ); return ls; } - FI XYZval operator>>(const int &p) { XYZval ls = *this; NUM_AXIS_CODE(_RS(ls.x), _RS(ls.y), _RS(ls.z), _RS(ls.i), _RS(ls.j), _RS(ls.k), _RS(ls.u), _RS(ls.v), _RS(ls.w) ); return ls; } - FI XYZval operator<<(const int &p) const { XYZval ls = *this; NUM_AXIS_CODE(_LS(ls.x), _LS(ls.y), _LS(ls.z), _LS(ls.i), _LS(ls.j), _LS(ls.k), _LS(ls.u), _LS(ls.v), _LS(ls.w) ); return ls; } - FI XYZval operator<<(const int &p) { XYZval ls = *this; NUM_AXIS_CODE(_LS(ls.x), _LS(ls.y), _LS(ls.z), _LS(ls.i), _LS(ls.j), _LS(ls.k), _LS(ls.u), _LS(ls.v), _LS(ls.w) ); return ls; } - FI const XYZval operator-() const { XYZval o = *this; NUM_AXIS_CODE(o.x = -x, o.y = -y, o.z = -z, o.i = -i, o.j = -j, o.k = -k, o.u = -u, o.v = -v, o.w = -w); return o; } - FI XYZval operator-() { XYZval o = *this; NUM_AXIS_CODE(o.x = -x, o.y = -y, o.z = -z, o.i = -i, o.j = -j, o.k = -k, o.u = -u, o.v = -v, o.w = -w); return o; } + FI constexpr XYZval operator+ (const XYval &rs) const { return NUM_AXIS_ARRAY(x + rs.x, y + rs.y, z, i, j, k, u, v, w ); } + FI constexpr XYZval operator- (const XYval &rs) const { return NUM_AXIS_ARRAY(x - rs.x, y - rs.y, z, i, j, k, u, v, w ); } + FI constexpr XYZval operator* (const XYval &rs) const { return NUM_AXIS_ARRAY(x * rs.x, y * rs.y, z, i, j, k, u, v, w ); } + FI constexpr XYZval operator/ (const XYval &rs) const { return NUM_AXIS_ARRAY(x / rs.x, y / rs.y, z, i, j, k, u, v, w ); } + FI constexpr XYZval operator+ (const XYZval &rs) const { return NUM_AXIS_ARRAY(x + rs.x, y + rs.y, z + rs.z, i + rs.i, j + rs.j, k + rs.k, u + rs.u, v + rs.v, w + rs.w ); } + FI constexpr XYZval operator- (const XYZval &rs) const { return NUM_AXIS_ARRAY(x - rs.x, y - rs.y, z - rs.z, i - rs.i, j - rs.j, k - rs.k, u - rs.u, v - rs.v, w - rs.w ); } + FI constexpr XYZval operator* (const XYZval &rs) const { return NUM_AXIS_ARRAY(x * rs.x, y * rs.y, z * rs.z, i * rs.i, j * rs.j, k * rs.k, u * rs.u, v * rs.v, w * rs.w ); } + FI constexpr XYZval operator/ (const XYZval &rs) const { return NUM_AXIS_ARRAY(x / rs.x, y / rs.y, z / rs.z, i / rs.i, j / rs.j, k / rs.k, u / rs.u, v / rs.v, w / rs.w ); } + FI constexpr XYZval operator+ (const XYZEval &rs) const { return NUM_AXIS_ARRAY(x + rs.x, y + rs.y, z + rs.z, i + rs.i, j + rs.j, k + rs.k, u + rs.u, v + rs.v, w + rs.w ); } + FI constexpr XYZval operator- (const XYZEval &rs) const { return NUM_AXIS_ARRAY(x - rs.x, y - rs.y, z - rs.z, i - rs.i, j - rs.j, k - rs.k, u - rs.u, v - rs.v, w - rs.w ); } + FI constexpr XYZval operator* (const XYZEval &rs) const { return NUM_AXIS_ARRAY(x * rs.x, y * rs.y, z * rs.z, i * rs.i, j * rs.j, k * rs.k, u * rs.u, v * rs.v, w * rs.w ); } + FI constexpr XYZval operator/ (const XYZEval &rs) const { return NUM_AXIS_ARRAY(x / rs.x, y / rs.y, z / rs.z, i / rs.i, j / rs.j, k / rs.k, u / rs.u, v / rs.v, w / rs.w ); } + FI constexpr XYZval operator* (const float &p) const { return NUM_AXIS_ARRAY(x * p, y * p, z * p, i * p, j * p, k * p, u * p, v * p, w * p); } + FI constexpr XYZval operator* (const int &p) const { return NUM_AXIS_ARRAY(x * p, y * p, z * p, i * p, j * p, k * p, u * p, v * p, w * p); } + FI constexpr XYZval operator/ (const float &p) const { return NUM_AXIS_ARRAY(x / p, y / p, z / p, i / p, j / p, k / p, u / p, v / p, w / p); } + FI constexpr XYZval operator/ (const int &p) const { return NUM_AXIS_ARRAY(x / p, y / p, z / p, i / p, j / p, k / p, u / p, v / p, w / p); } + FI constexpr XYZval operator>>(const int &p) const { return NUM_AXIS_ARRAY(_RS(x), _RS(y), _RS(z), _RS(i), _RS(j), _RS(k), _RS(u), _RS(v), _RS(w)); } + FI constexpr XYZval operator<<(const int &p) const { return NUM_AXIS_ARRAY(_LS(x), _LS(y), _LS(z), _LS(i), _LS(j), _LS(k), _LS(u), _LS(v), _LS(w)); } + FI constexpr XYZval operator-() const { return NUM_AXIS_ARRAY(-x, -y, -z, -i, -j, -k, -u, -v, -w); } // Modifier operators - FI XYZval& operator+=(const XYval &rs) { NUM_AXIS_CODE(x += rs.x, y += rs.y,,,,,,, ); return *this; } - FI XYZval& operator-=(const XYval &rs) { NUM_AXIS_CODE(x -= rs.x, y -= rs.y,,,,,,, ); return *this; } - FI XYZval& operator*=(const XYval &rs) { NUM_AXIS_CODE(x *= rs.x, y *= rs.y,,,,,,, ); return *this; } - FI XYZval& operator/=(const XYval &rs) { NUM_AXIS_CODE(x /= rs.x, y /= rs.y,,,,,,, ); return *this; } - FI XYZval& operator+=(const XYZval &rs) { NUM_AXIS_CODE(x += rs.x, y += rs.y, z += rs.z, i += rs.i, j += rs.j, k += rs.k, u += rs.u, v += rs.v, w += rs.w); return *this; } - FI XYZval& operator-=(const XYZval &rs) { NUM_AXIS_CODE(x -= rs.x, y -= rs.y, z -= rs.z, i -= rs.i, j -= rs.j, k -= rs.k, u -= rs.u, v -= rs.v, w -= rs.w); return *this; } - FI XYZval& operator*=(const XYZval &rs) { NUM_AXIS_CODE(x *= rs.x, y *= rs.y, z *= rs.z, i *= rs.i, j *= rs.j, k *= rs.k, u *= rs.u, v *= rs.v, w *= rs.w); return *this; } - FI XYZval& operator/=(const XYZval &rs) { NUM_AXIS_CODE(x /= rs.x, y /= rs.y, z /= rs.z, i /= rs.i, j /= rs.j, k /= rs.k, u /= rs.u, v /= rs.v, w /= rs.w); return *this; } - FI XYZval& operator+=(const XYZEval &rs) { NUM_AXIS_CODE(x += rs.x, y += rs.y, z += rs.z, i += rs.i, j += rs.j, k += rs.k, u += rs.u, v += rs.v, w += rs.w); return *this; } - FI XYZval& operator-=(const XYZEval &rs) { NUM_AXIS_CODE(x -= rs.x, y -= rs.y, z -= rs.z, i -= rs.i, j -= rs.j, k -= rs.k, u -= rs.u, v -= rs.v, w -= rs.w); return *this; } - FI XYZval& operator*=(const XYZEval &rs) { NUM_AXIS_CODE(x *= rs.x, y *= rs.y, z *= rs.z, i *= rs.i, j *= rs.j, k *= rs.k, u *= rs.u, v *= rs.v, w *= rs.w); return *this; } - FI XYZval& operator/=(const XYZEval &rs) { NUM_AXIS_CODE(x /= rs.x, y /= rs.y, z /= rs.z, i /= rs.i, j /= rs.j, k /= rs.k, u /= rs.u, v /= rs.v, w /= rs.w); return *this; } - FI XYZval& operator*=(const float &p) { NUM_AXIS_CODE(x *= p, y *= p, z *= p, i *= p, j *= p, k *= p, u *= p, v *= p, w *= p); return *this; } - FI XYZval& operator*=(const int &p) { NUM_AXIS_CODE(x *= p, y *= p, z *= p, i *= p, j *= p, k *= p, u *= p, v *= p, w *= p); return *this; } - FI XYZval& operator>>=(const int &p) { NUM_AXIS_CODE(_RS(x), _RS(y), _RS(z), _RS(i), _RS(j), _RS(k), _RS(u), _RS(v), _RS(w)); return *this; } - FI XYZval& operator<<=(const int &p) { NUM_AXIS_CODE(_LS(x), _LS(y), _LS(z), _LS(i), _LS(j), _LS(k), _LS(u), _LS(v), _LS(w)); return *this; } + FI XYZval& operator+=(const XYval &rs) { XY_CODE(x += rs.x, y += rs.y); return *this; } + FI XYZval& operator-=(const XYval &rs) { XY_CODE(x -= rs.x, y -= rs.y); return *this; } + FI XYZval& operator*=(const XYval &rs) { XY_CODE(x *= rs.x, y *= rs.y); return *this; } + FI XYZval& operator/=(const XYval &rs) { XY_CODE(x /= rs.x, y /= rs.y); return *this; } + FI XYZval& operator+=(const XYZval &rs) { NUM_AXIS_CODE(x += rs.x, y += rs.y, z += rs.z, i += rs.i, j += rs.j, k += rs.k, u += rs.u, v += rs.v, w += rs.w); return *this; } + FI XYZval& operator-=(const XYZval &rs) { NUM_AXIS_CODE(x -= rs.x, y -= rs.y, z -= rs.z, i -= rs.i, j -= rs.j, k -= rs.k, u -= rs.u, v -= rs.v, w -= rs.w); return *this; } + FI XYZval& operator*=(const XYZval &rs) { NUM_AXIS_CODE(x *= rs.x, y *= rs.y, z *= rs.z, i *= rs.i, j *= rs.j, k *= rs.k, u *= rs.u, v *= rs.v, w *= rs.w); return *this; } + FI XYZval& operator/=(const XYZval &rs) { NUM_AXIS_CODE(x /= rs.x, y /= rs.y, z /= rs.z, i /= rs.i, j /= rs.j, k /= rs.k, u /= rs.u, v /= rs.v, w /= rs.w); return *this; } + FI XYZval& operator+=(const XYZEval &rs) { NUM_AXIS_CODE(x += rs.x, y += rs.y, z += rs.z, i += rs.i, j += rs.j, k += rs.k, u += rs.u, v += rs.v, w += rs.w); return *this; } + FI XYZval& operator-=(const XYZEval &rs) { NUM_AXIS_CODE(x -= rs.x, y -= rs.y, z -= rs.z, i -= rs.i, j -= rs.j, k -= rs.k, u -= rs.u, v -= rs.v, w -= rs.w); return *this; } + FI XYZval& operator*=(const XYZEval &rs) { NUM_AXIS_CODE(x *= rs.x, y *= rs.y, z *= rs.z, i *= rs.i, j *= rs.j, k *= rs.k, u *= rs.u, v *= rs.v, w *= rs.w); return *this; } + FI XYZval& operator/=(const XYZEval &rs) { NUM_AXIS_CODE(x /= rs.x, y /= rs.y, z /= rs.z, i /= rs.i, j /= rs.j, k /= rs.k, u /= rs.u, v /= rs.v, w /= rs.w); return *this; } + FI XYZval& operator*=(const float &p) { NUM_AXIS_CODE(x *= p, y *= p, z *= p, i *= p, j *= p, k *= p, u *= p, v *= p, w *= p); return *this; } + FI XYZval& operator*=(const int &p) { NUM_AXIS_CODE(x *= p, y *= p, z *= p, i *= p, j *= p, k *= p, u *= p, v *= p, w *= p); return *this; } + FI XYZval& operator>>=(const int &p) { NUM_AXIS_CODE(_RSE(x), _RSE(y), _RSE(z), _RSE(i), _RSE(j), _RSE(k), _RSE(u), _RSE(v), _RSE(w)); return *this; } + FI XYZval& operator<<=(const int &p) { NUM_AXIS_CODE(_LSE(x), _LSE(y), _LSE(z), _LSE(i), _LSE(j), _LSE(k), _LSE(u), _LSE(v), _LSE(w)); return *this; } // Exact comparisons. For floats a "NEAR" operation may be better. - FI bool operator==(const XYZEval &rs) const { return true NUM_AXIS_GANG(&& x == rs.x, && y == rs.y, && z == rs.z, && i == rs.i, && j == rs.j, && k == rs.k, && u == rs.u, && v == rs.v, && w == rs.w); } - FI bool operator!=(const XYZEval &rs) const { return !operator==(rs); } + FI bool operator==(const XYZEval &rs) const { return true NUM_AXIS_GANG(&& x == rs.x, && y == rs.y, && z == rs.z, && i == rs.i, && j == rs.j, && k == rs.k, && u == rs.u, && v == rs.v, && w == rs.w); } + FI bool operator!=(const XYZEval &rs) const { return !operator==(rs); } }; // // Logical Axes coordinates, counters, etc. +// May have any number of axes according to configuration, including zero axes. +// When there is no extruder, essentially identical to XYZval. // template struct XYZEval { @@ -663,9 +643,9 @@ struct XYZEval { FI void reset() { LOGICAL_AXIS_GANG(e =, x =, y =, z =, i =, j =, k =, u =, v =, w =) 0; } // Setters taking struct types and arrays - FI void set(const XYval pxy) { OPTCODE(HAS_X_AXIS, x = pxy.x) OPTCODE(HAS_Y_AXIS, y = pxy.y) } + FI void set(const XYval pxy) { XY_CODE(x = pxy.x, y = pxy.y); } + FI void set(const XYval pxy, const T pz) { XYZ_CODE(x = pxy.x, y = pxy.y, z = pz); } FI void set(const XYZval pxyz) { set(NUM_AXIS_ELEM(pxyz)); } - FI void set(const XYval pxy, const T pz) { set(pxy); TERN_(HAS_Z_AXIS, z = pz); } FI void set(const T (&arr)[NUM_AXES]) { NUM_AXIS_CODE(x = arr[0], y = arr[1], z = arr[2], i = arr[3], j = arr[4], k = arr[5], u = arr[6], v = arr[7], w = arr[8]); } #if LOGICAL_AXES > NUM_AXES FI void set(const T (&arr)[LOGICAL_AXES]) { LOGICAL_AXIS_CODE(e = arr[LOGICAL_AXES-1], x = arr[0], y = arr[1], z = arr[2], i = arr[3], j = arr[4], k = arr[5], u = arr[6], v = arr[7], w = arr[8]); } @@ -707,32 +687,28 @@ struct XYZEval { #endif // Length reduced to one dimension - FI T magnitude() const { return (T)sqrtf(LOGICAL_AXIS_GANG(+ e*e, + x*x, + y*y, + z*z, + i*i, + j*j, + k*k, + u*u, + v*v, + w*w)); } + FI constexpr T magnitude() const { return (T)sqrtf(LOGICAL_AXIS_GANG(+ e*e, + x*x, + y*y, + z*z, + i*i, + j*j, + k*k, + u*u, + v*v, + w*w)); } // Pointer to the data as a simple array - FI operator T* () { return pos; } + FI operator T* () { return pos; } // If any element is true then it's true - FI operator bool() { return 0 LOGICAL_AXIS_GANG(|| e, || x, || y, || z, || i, || j, || k, || u, || v, || w); } + FI constexpr operator bool() const { return 0 LOGICAL_AXIS_GANG(|| e, || x, || y, || z, || i, || j, || k, || u, || v, || w); } // Smallest element - FI T small() const { return _MIN(LOGICAL_AXIS_LIST(e, x, y, z, i, j, k, u, v, w)); } + FI constexpr T small() const { return _MIN(LOGICAL_AXIS_LIST(e, x, y, z, i, j, k, u, v, w)); } // Largest element - FI T large() const { return _MAX(LOGICAL_AXIS_LIST(e, x, y, z, i, j, k, u, v, w)); } + FI constexpr T large() const { return _MAX(LOGICAL_AXIS_LIST(e, x, y, z, i, j, k, u, v, w)); } // Explicit copy and copies with conversion - FI XYZEval copy() const { XYZEval v = *this; return v; } - FI XYZEval ABS() const { return LOGICAL_AXIS_ARRAY(T(_ABS(e)), T(_ABS(x)), T(_ABS(y)), T(_ABS(z)), T(_ABS(i)), T(_ABS(j)), T(_ABS(k)), T(_ABS(u)), T(_ABS(v)), T(_ABS(w))); } - FI XYZEval asInt() { return LOGICAL_AXIS_ARRAY(int16_t(e), int16_t(x), int16_t(y), int16_t(z), int16_t(i), int16_t(j), int16_t(k), int16_t(u), int16_t(v), int16_t(w)); } - FI XYZEval asInt() const { return LOGICAL_AXIS_ARRAY(int16_t(e), int16_t(x), int16_t(y), int16_t(z), int16_t(i), int16_t(j), int16_t(k), int16_t(u), int16_t(v), int16_t(w)); } - FI XYZEval asLong() { return LOGICAL_AXIS_ARRAY(int32_t(e), int32_t(x), int32_t(y), int32_t(z), int32_t(i), int32_t(j), int32_t(k), int32_t(u), int32_t(v), int32_t(w)); } - FI XYZEval asLong() const { return LOGICAL_AXIS_ARRAY(int32_t(e), int32_t(x), int32_t(y), int32_t(z), int32_t(i), int32_t(j), int32_t(k), int32_t(u), int32_t(v), int32_t(w)); } - FI XYZEval ROUNDL() { return LOGICAL_AXIS_ARRAY(int32_t(LROUND(e)), int32_t(LROUND(x)), int32_t(LROUND(y)), int32_t(LROUND(z)), int32_t(LROUND(i)), int32_t(LROUND(j)), int32_t(LROUND(k)), int32_t(LROUND(u)), int32_t(LROUND(v)), int32_t(LROUND(w))); } - FI XYZEval ROUNDL() const { return LOGICAL_AXIS_ARRAY(int32_t(LROUND(e)), int32_t(LROUND(x)), int32_t(LROUND(y)), int32_t(LROUND(z)), int32_t(LROUND(i)), int32_t(LROUND(j)), int32_t(LROUND(k)), int32_t(LROUND(u)), int32_t(LROUND(v)), int32_t(LROUND(w))); } - FI XYZEval asFloat() { return LOGICAL_AXIS_ARRAY(static_cast(e), static_cast(x), static_cast(y), static_cast(z), static_cast(i), static_cast(j), static_cast(k), static_cast(u), static_cast(v), static_cast(w)); } - FI XYZEval asFloat() const { return LOGICAL_AXIS_ARRAY(static_cast(e), static_cast(x), static_cast(y), static_cast(z), static_cast(i), static_cast(j), static_cast(k), static_cast(u), static_cast(v), static_cast(w)); } - FI XYZEval reciprocal() const { return LOGICAL_AXIS_ARRAY(_RECIP(e), _RECIP(x), _RECIP(y), _RECIP(z), _RECIP(i), _RECIP(j), _RECIP(k), _RECIP(u), _RECIP(v), _RECIP(w)); } + FI constexpr XYZEval copy() const { XYZEval v = *this; return v; } + FI constexpr XYZEval ABS() const { return LOGICAL_AXIS_ARRAY(T(_ABS(e)), T(_ABS(x)), T(_ABS(y)), T(_ABS(z)), T(_ABS(i)), T(_ABS(j)), T(_ABS(k)), T(_ABS(u)), T(_ABS(v)), T(_ABS(w))); } + FI constexpr XYZEval asInt() const { return LOGICAL_AXIS_ARRAY(int16_t(e), int16_t(x), int16_t(y), int16_t(z), int16_t(i), int16_t(j), int16_t(k), int16_t(u), int16_t(v), int16_t(w)); } + FI constexpr XYZEval asLong() const { return LOGICAL_AXIS_ARRAY(int32_t(e), int32_t(x), int32_t(y), int32_t(z), int32_t(i), int32_t(j), int32_t(k), int32_t(u), int32_t(v), int32_t(w)); } + FI constexpr XYZEval ROUNDL() const { return LOGICAL_AXIS_ARRAY(int32_t(LROUND(e)), int32_t(LROUND(x)), int32_t(LROUND(y)), int32_t(LROUND(z)), int32_t(LROUND(i)), int32_t(LROUND(j)), int32_t(LROUND(k)), int32_t(LROUND(u)), int32_t(LROUND(v)), int32_t(LROUND(w))); } + FI constexpr XYZEval asFloat() const { return LOGICAL_AXIS_ARRAY(static_cast(e), static_cast(x), static_cast(y), static_cast(z), static_cast(i), static_cast(j), static_cast(k), static_cast(u), static_cast(v), static_cast(w)); } + FI constexpr XYZEval reciprocal() const { return LOGICAL_AXIS_ARRAY(_RECIP(e), _RECIP(x), _RECIP(y), _RECIP(z), _RECIP(i), _RECIP(j), _RECIP(k), _RECIP(u), _RECIP(v), _RECIP(w)); } // Marlin workspace shifting is done with G92 and M206 - FI XYZEval asLogical() const { XYZEval o = asFloat(); toLogical(o); return o; } - FI XYZEval asNative() const { XYZEval o = asFloat(); toNative(o); return o; } + FI XYZEval asLogical() const { XYZEval o = asFloat(); toLogical(o); return o; } + FI XYZEval asNative() const { XYZEval o = asFloat(); toNative(o); return o; } // In-place cast to types having fewer fields FI operator XYval&() { return *(XYval*)this; } @@ -741,76 +717,57 @@ struct XYZEval { FI operator const XYZval&() const { return *(const XYZval*)this; } // Accessor via an AxisEnum (or any integer) [index] - FI T& operator[](const int n) { return pos[n]; } - FI const T& operator[](const int n) const { return pos[n]; } + FI T& operator[](const int n) { return pos[n]; } + FI const T& operator[](const int n) const { return pos[n]; } // Assignment operator overrides do the expected thing - FI XYZEval& operator= (const T v) { set(LOGICAL_AXIS_LIST_1(v)); return *this; } - FI XYZEval& operator= (const XYval &rs) { set(rs.x, rs.y); return *this; } - FI XYZEval& operator= (const XYZval &rs) { set(NUM_AXIS_ELEM(rs)); return *this; } + FI XYZEval& operator= (const T v) { set(LOGICAL_AXIS_LIST_1(v)); return *this; } + FI XYZEval& operator= (const XYval &rs) { set(rs.x, rs.y); return *this; } + FI XYZEval& operator= (const XYZval &rs) { set(NUM_AXIS_ELEM(rs)); return *this; } // Override other operators to get intuitive behaviors - FI XYZEval operator+ (const XYval &rs) const { XYZEval ls = *this; ls.x += rs.x; ls.y += rs.y; return ls; } - FI XYZEval operator+ (const XYval &rs) { XYZEval ls = *this; ls.x += rs.x; ls.y += rs.y; return ls; } - FI XYZEval operator- (const XYval &rs) const { XYZEval ls = *this; ls.x -= rs.x; ls.y -= rs.y; return ls; } - FI XYZEval operator- (const XYval &rs) { XYZEval ls = *this; ls.x -= rs.x; ls.y -= rs.y; return ls; } - FI XYZEval operator* (const XYval &rs) const { XYZEval ls = *this; ls.x *= rs.x; ls.y *= rs.y; return ls; } - FI XYZEval operator* (const XYval &rs) { XYZEval ls = *this; ls.x *= rs.x; ls.y *= rs.y; return ls; } - FI XYZEval operator/ (const XYval &rs) const { XYZEval ls = *this; ls.x /= rs.x; ls.y /= rs.y; return ls; } - FI XYZEval operator/ (const XYval &rs) { XYZEval ls = *this; ls.x /= rs.x; ls.y /= rs.y; return ls; } - FI XYZEval operator+ (const XYZval &rs) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x += rs.x, ls.y += rs.y, ls.z += rs.z, ls.i += rs.i, ls.j += rs.j, ls.k += rs.k, ls.u += rs.u, ls.v += rs.v, ls.w += rs.w); return ls; } - FI XYZEval operator+ (const XYZval &rs) { XYZval ls = *this; NUM_AXIS_CODE(ls.x += rs.x, ls.y += rs.y, ls.z += rs.z, ls.i += rs.i, ls.j += rs.j, ls.k += rs.k, ls.u += rs.u, ls.v += rs.v, ls.w += rs.w); return ls; } - FI XYZEval operator- (const XYZval &rs) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x -= rs.x, ls.y -= rs.y, ls.z -= rs.z, ls.i -= rs.i, ls.j -= rs.j, ls.k -= rs.k, ls.u -= rs.u, ls.v -= rs.v, ls.w -= rs.w); return ls; } - FI XYZEval operator- (const XYZval &rs) { XYZval ls = *this; NUM_AXIS_CODE(ls.x -= rs.x, ls.y -= rs.y, ls.z -= rs.z, ls.i -= rs.i, ls.j -= rs.j, ls.k -= rs.k, ls.u -= rs.u, ls.v -= rs.v, ls.w -= rs.w); return ls; } - FI XYZEval operator* (const XYZval &rs) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x *= rs.x, ls.y *= rs.y, ls.z *= rs.z, ls.i *= rs.i, ls.j *= rs.j, ls.k *= rs.k, ls.u *= rs.u, ls.v *= rs.v, ls.w *= rs.w); return ls; } - FI XYZEval operator* (const XYZval &rs) { XYZval ls = *this; NUM_AXIS_CODE(ls.x *= rs.x, ls.y *= rs.y, ls.z *= rs.z, ls.i *= rs.i, ls.j *= rs.j, ls.k *= rs.k, ls.u *= rs.u, ls.v *= rs.v, ls.w *= rs.w); return ls; } - FI XYZEval operator/ (const XYZval &rs) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x /= rs.x, ls.y /= rs.y, ls.z /= rs.z, ls.i /= rs.i, ls.j /= rs.j, ls.k /= rs.k, ls.u /= rs.u, ls.v /= rs.v, ls.w /= rs.w); return ls; } - FI XYZEval operator/ (const XYZval &rs) { XYZval ls = *this; NUM_AXIS_CODE(ls.x /= rs.x, ls.y /= rs.y, ls.z /= rs.z, ls.i /= rs.i, ls.j /= rs.j, ls.k /= rs.k, ls.u /= rs.u, ls.v /= rs.v, ls.w /= rs.w); return ls; } - FI XYZEval operator+ (const XYZEval &rs) const { XYZEval ls = *this; LOGICAL_AXIS_CODE(ls.e += rs.e, ls.x += rs.x, ls.y += rs.y, ls.z += rs.z, ls.i += rs.i, ls.j += rs.j, ls.k += rs.k, ls.u += rs.u, ls.v += rs.v, ls.w += rs.w); return ls; } - FI XYZEval operator+ (const XYZEval &rs) { XYZEval ls = *this; LOGICAL_AXIS_CODE(ls.e += rs.e, ls.x += rs.x, ls.y += rs.y, ls.z += rs.z, ls.i += rs.i, ls.j += rs.j, ls.k += rs.k, ls.u += rs.u, ls.v += rs.v, ls.w += rs.w); return ls; } - FI XYZEval operator- (const XYZEval &rs) const { XYZEval ls = *this; LOGICAL_AXIS_CODE(ls.e -= rs.e, ls.x -= rs.x, ls.y -= rs.y, ls.z -= rs.z, ls.i -= rs.i, ls.j -= rs.j, ls.k -= rs.k, ls.u -= rs.u, ls.v -= rs.v, ls.w -= rs.w); return ls; } - FI XYZEval operator- (const XYZEval &rs) { XYZEval ls = *this; LOGICAL_AXIS_CODE(ls.e -= rs.e, ls.x -= rs.x, ls.y -= rs.y, ls.z -= rs.z, ls.i -= rs.i, ls.j -= rs.j, ls.k -= rs.k, ls.u -= rs.u, ls.v -= rs.v, ls.w -= rs.w); return ls; } - FI XYZEval operator* (const XYZEval &rs) const { XYZEval ls = *this; LOGICAL_AXIS_CODE(ls.e *= rs.e, ls.x *= rs.x, ls.y *= rs.y, ls.z *= rs.z, ls.i *= rs.i, ls.j *= rs.j, ls.k *= rs.k, ls.u *= rs.u, ls.v *= rs.v, ls.w *= rs.w); return ls; } - FI XYZEval operator* (const XYZEval &rs) { XYZEval ls = *this; LOGICAL_AXIS_CODE(ls.e *= rs.e, ls.x *= rs.x, ls.y *= rs.y, ls.z *= rs.z, ls.i *= rs.i, ls.j *= rs.j, ls.k *= rs.k, ls.u *= rs.u, ls.v *= rs.v, ls.w *= rs.w); return ls; } - FI XYZEval operator/ (const XYZEval &rs) const { XYZEval ls = *this; LOGICAL_AXIS_CODE(ls.e /= rs.e, ls.x /= rs.x, ls.y /= rs.y, ls.z /= rs.z, ls.i /= rs.i, ls.j /= rs.j, ls.k /= rs.k, ls.u /= rs.u, ls.v /= rs.v, ls.w /= rs.w); return ls; } - FI XYZEval operator/ (const XYZEval &rs) { XYZEval ls = *this; LOGICAL_AXIS_CODE(ls.e /= rs.e, ls.x /= rs.x, ls.y /= rs.y, ls.z /= rs.z, ls.i /= rs.i, ls.j /= rs.j, ls.k /= rs.k, ls.u /= rs.u, ls.v /= rs.v, ls.w /= rs.w); return ls; } - FI XYZEval operator* (const float &p) const { XYZEval ls = *this; LOGICAL_AXIS_CODE(ls.e *= p, ls.x *= p, ls.y *= p, ls.z *= p, ls.i *= p, ls.j *= p, ls.k *= p, ls.u *= p, ls.v *= p, ls.w *= p ); return ls; } - FI XYZEval operator* (const float &p) { XYZEval ls = *this; LOGICAL_AXIS_CODE(ls.e *= p, ls.x *= p, ls.y *= p, ls.z *= p, ls.i *= p, ls.j *= p, ls.k *= p, ls.u *= p, ls.v *= p, ls.w *= p ); return ls; } - FI XYZEval operator* (const int &p) const { XYZEval ls = *this; LOGICAL_AXIS_CODE(ls.e *= p, ls.x *= p, ls.y *= p, ls.z *= p, ls.i *= p, ls.j *= p, ls.k *= p, ls.u *= p, ls.v *= p, ls.w *= p ); return ls; } - FI XYZEval operator* (const int &p) { XYZEval ls = *this; LOGICAL_AXIS_CODE(ls.e *= p, ls.x *= p, ls.y *= p, ls.z *= p, ls.i *= p, ls.j *= p, ls.k *= p, ls.u *= p, ls.v *= p, ls.w *= p ); return ls; } - FI XYZEval operator/ (const float &p) const { XYZEval ls = *this; LOGICAL_AXIS_CODE(ls.e /= p, ls.x /= p, ls.y /= p, ls.z /= p, ls.i /= p, ls.j /= p, ls.k /= p, ls.u /= p, ls.v /= p, ls.w /= p ); return ls; } - FI XYZEval operator/ (const float &p) { XYZEval ls = *this; LOGICAL_AXIS_CODE(ls.e /= p, ls.x /= p, ls.y /= p, ls.z /= p, ls.i /= p, ls.j /= p, ls.k /= p, ls.u /= p, ls.v /= p, ls.w /= p ); return ls; } - FI XYZEval operator/ (const int &p) const { XYZEval ls = *this; LOGICAL_AXIS_CODE(ls.e /= p, ls.x /= p, ls.y /= p, ls.z /= p, ls.i /= p, ls.j /= p, ls.k /= p, ls.u /= p, ls.v /= p, ls.w /= p ); return ls; } - FI XYZEval operator/ (const int &p) { XYZEval ls = *this; LOGICAL_AXIS_CODE(ls.e /= p, ls.x /= p, ls.y /= p, ls.z /= p, ls.i /= p, ls.j /= p, ls.k /= p, ls.u /= p, ls.v /= p, ls.w /= p ); return ls; } - FI XYZEval operator>>(const int &p) const { XYZEval ls = *this; LOGICAL_AXIS_CODE(_RS(ls.e), _RS(ls.x), _RS(ls.y), _RS(ls.z), _RS(ls.i), _RS(ls.j), _RS(ls.k), _RS(ls.u), _RS(ls.v), _RS(ls.w) ); return ls; } - FI XYZEval operator>>(const int &p) { XYZEval ls = *this; LOGICAL_AXIS_CODE(_RS(ls.e), _RS(ls.x), _RS(ls.y), _RS(ls.z), _RS(ls.i), _RS(ls.j), _RS(ls.k), _RS(ls.u), _RS(ls.v), _RS(ls.w) ); return ls; } - FI XYZEval operator<<(const int &p) const { XYZEval ls = *this; LOGICAL_AXIS_CODE(_LS(ls.e), _LS(ls.x), _LS(ls.y), _LS(ls.z), _LS(ls.i), _LS(ls.j), _LS(ls.k), _LS(ls.u), _LS(ls.v), _LS(ls.w) ); return ls; } - FI XYZEval operator<<(const int &p) { XYZEval ls = *this; LOGICAL_AXIS_CODE(_LS(ls.e), _LS(ls.x), _LS(ls.y), _LS(ls.z), _LS(ls.i), _LS(ls.j), _LS(ls.k), _LS(ls.u), _LS(ls.v), _LS(ls.w) ); return ls; } - FI const XYZEval operator-() const { return LOGICAL_AXIS_ARRAY(-e, -x, -y, -z, -i, -j, -k, -u, -v, -w); } - FI XYZEval operator-() { return LOGICAL_AXIS_ARRAY(-e, -x, -y, -z, -i, -j, -k, -u, -v, -w); } + FI constexpr XYZEval operator+ (const XYval &rs) const { return LOGICAL_AXIS_ARRAY(e, x + rs.x, y + rs.y, z, i, j, k, u, v, w); } + FI constexpr XYZEval operator- (const XYval &rs) const { return LOGICAL_AXIS_ARRAY(e, x - rs.x, y - rs.y, z, i, j, k, u, v, w); } + FI constexpr XYZEval operator* (const XYval &rs) const { return LOGICAL_AXIS_ARRAY(e, x * rs.x, y * rs.y, z, i, j, k, u, v, w); } + FI constexpr XYZEval operator/ (const XYval &rs) const { return LOGICAL_AXIS_ARRAY(e, x / rs.x, y / rs.y, z, i, j, k, u, v, w); } + FI constexpr XYZEval operator+ (const XYZval &rs) const { return LOGICAL_AXIS_ARRAY(e, x + rs.x, y + rs.y, z + rs.z, i + rs.i, j + rs.j, k + rs.k, u + rs.u, v + rs.v, w + rs.w); } + FI constexpr XYZEval operator- (const XYZval &rs) const { return LOGICAL_AXIS_ARRAY(e, x - rs.x, y - rs.y, z - rs.z, i - rs.i, j - rs.j, k - rs.k, u - rs.u, v - rs.v, w - rs.w); } + FI constexpr XYZEval operator* (const XYZval &rs) const { return LOGICAL_AXIS_ARRAY(e, x * rs.x, y * rs.y, z * rs.z, i * rs.i, j * rs.j, k * rs.k, u * rs.u, v * rs.v, w * rs.w); } + FI constexpr XYZEval operator/ (const XYZval &rs) const { return LOGICAL_AXIS_ARRAY(e, x / rs.x, y / rs.y, z / rs.z, i / rs.i, j / rs.j, k / rs.k, u / rs.u, v / rs.v, w / rs.w); } + FI constexpr XYZEval operator+ (const XYZEval &rs) const { return LOGICAL_AXIS_ARRAY(e + rs.e, x + rs.x, y + rs.y, z + rs.z, i + rs.i, j + rs.j, k + rs.k, u + rs.u, v + rs.v, w + rs.w); } + FI constexpr XYZEval operator- (const XYZEval &rs) const { return LOGICAL_AXIS_ARRAY(e - rs.e, x - rs.x, y - rs.y, z - rs.z, i - rs.i, j - rs.j, k - rs.k, u - rs.u, v - rs.v, w - rs.w); } + FI constexpr XYZEval operator* (const XYZEval &rs) const { return LOGICAL_AXIS_ARRAY(e * rs.e, x * rs.x, y * rs.y, z * rs.z, i * rs.i, j * rs.j, k * rs.k, u * rs.u, v * rs.v, w * rs.w); } + FI constexpr XYZEval operator/ (const XYZEval &rs) const { return LOGICAL_AXIS_ARRAY(e / rs.e, x / rs.x, y / rs.y, z / rs.z, i / rs.i, j / rs.j, k / rs.k, u / rs.u, v / rs.v, w / rs.w); } + FI constexpr XYZEval operator* (const float &p) const { return LOGICAL_AXIS_ARRAY(e * p, x * p, y * p, z * p, i * p, j * p, k * p, u * p, v * p, w * p); } + FI constexpr XYZEval operator* (const int &p) const { return LOGICAL_AXIS_ARRAY(e * p, x * p, y * p, z * p, i * p, j * p, k * p, u * p, v * p, w * p); } + FI constexpr XYZEval operator/ (const float &p) const { return LOGICAL_AXIS_ARRAY(e / p, x / p, y / p, z / p, i / p, j / p, k / p, u / p, v / p, w / p); } + FI constexpr XYZEval operator/ (const int &p) const { return LOGICAL_AXIS_ARRAY(e / p, x / p, y / p, z / p, i / p, j / p, k / p, u / p, v / p, w / p); } + FI constexpr XYZEval operator>>(const int &p) const { return LOGICAL_AXIS_ARRAY(_RS(e), _RS(x), _RS(y), _RS(z), _RS(i), _RS(j), _RS(k), _RS(u), _RS(v), _RS(w)); } + FI constexpr XYZEval operator<<(const int &p) const { return LOGICAL_AXIS_ARRAY(_LS(e), _LS(x), _LS(y), _LS(z), _LS(i), _LS(j), _LS(k), _LS(u), _LS(v), _LS(w)); } + FI constexpr XYZEval operator-() const { return LOGICAL_AXIS_ARRAY(-e, -x, -y, -z, -i, -j, -k, -u, -v, -w); } // Modifier operators - FI XYZEval& operator+=(const XYval &rs) { NUM_AXIS_CODE(x += rs.x, y += rs.y,,,,,,, ); return *this; } - FI XYZEval& operator-=(const XYval &rs) { NUM_AXIS_CODE(x -= rs.x, y -= rs.y,,,,,,, ); return *this; } - FI XYZEval& operator*=(const XYval &rs) { NUM_AXIS_CODE(x *= rs.x, y *= rs.y,,,,,,, ); return *this; } - FI XYZEval& operator/=(const XYval &rs) { NUM_AXIS_CODE(x /= rs.x, y /= rs.y,,,,,,, ); return *this; } - FI XYZEval& operator+=(const XYZval &rs) { NUM_AXIS_CODE(x += rs.x, y += rs.y, z += rs.z, i += rs.i, j += rs.j, k += rs.k, u += rs.u, v += rs.v, w += rs.w); return *this; } - FI XYZEval& operator-=(const XYZval &rs) { NUM_AXIS_CODE(x -= rs.x, y -= rs.y, z -= rs.z, i -= rs.i, j -= rs.j, k -= rs.k, u -= rs.u, v -= rs.v, w -= rs.w); return *this; } - FI XYZEval& operator*=(const XYZval &rs) { NUM_AXIS_CODE(x *= rs.x, y *= rs.y, z *= rs.z, i *= rs.i, j *= rs.j, k *= rs.k, u *= rs.u, v *= rs.v, w *= rs.w); return *this; } - FI XYZEval& operator/=(const XYZval &rs) { NUM_AXIS_CODE(x /= rs.x, y /= rs.y, z /= rs.z, i /= rs.i, j /= rs.j, k /= rs.k, u /= rs.u, v /= rs.v, w /= rs.w); return *this; } - FI XYZEval& operator+=(const XYZEval &rs) { LOGICAL_AXIS_CODE(e += rs.e, x += rs.x, y += rs.y, z += rs.z, i += rs.i, j += rs.j, k += rs.k, u += rs.u, v += rs.v, w += rs.w); return *this; } - FI XYZEval& operator-=(const XYZEval &rs) { LOGICAL_AXIS_CODE(e -= rs.e, x -= rs.x, y -= rs.y, z -= rs.z, i -= rs.i, j -= rs.j, k -= rs.k, u -= rs.u, v -= rs.v, w -= rs.w); return *this; } - FI XYZEval& operator*=(const XYZEval &rs) { LOGICAL_AXIS_CODE(e *= rs.e, x *= rs.x, y *= rs.y, z *= rs.z, i *= rs.i, j *= rs.j, k *= rs.k, u *= rs.u, v *= rs.v, w *= rs.w); return *this; } - FI XYZEval& operator/=(const XYZEval &rs) { LOGICAL_AXIS_CODE(e /= rs.e, x /= rs.x, y /= rs.y, z /= rs.z, i /= rs.i, j /= rs.j, k /= rs.k, u /= rs.u, v /= rs.v, w /= rs.w); return *this; } - FI XYZEval& operator*=(const T &p) { LOGICAL_AXIS_CODE(e *= p, x *= p, y *= p, z *= p, i *= p, j *= p, k *= p, u *= p, v *= p, w *= p); return *this; } - FI XYZEval& operator>>=(const int &p) { LOGICAL_AXIS_CODE(_RS(e), _RS(x), _RS(y), _RS(z), _RS(i), _RS(j), _RS(k), _RS(u), _RS(v), _RS(w)); return *this; } - FI XYZEval& operator<<=(const int &p) { LOGICAL_AXIS_CODE(_LS(e), _LS(x), _LS(y), _LS(z), _LS(i), _LS(j), _LS(k), _LS(u), _LS(v), _LS(w)); return *this; } + FI XYZEval& operator+=(const XYval &rs) { XY_CODE(x += rs.x, y += rs.y); return *this; } + FI XYZEval& operator-=(const XYval &rs) { XY_CODE(x -= rs.x, y -= rs.y); return *this; } + FI XYZEval& operator*=(const XYval &rs) { XY_CODE(x *= rs.x, y *= rs.y); return *this; } + FI XYZEval& operator/=(const XYval &rs) { XY_CODE(x /= rs.x, y /= rs.y); return *this; } + FI XYZEval& operator+=(const XYZval &rs) { NUM_AXIS_CODE(x += rs.x, y += rs.y, z += rs.z, i += rs.i, j += rs.j, k += rs.k, u += rs.u, v += rs.v, w += rs.w); return *this; } + FI XYZEval& operator-=(const XYZval &rs) { NUM_AXIS_CODE(x -= rs.x, y -= rs.y, z -= rs.z, i -= rs.i, j -= rs.j, k -= rs.k, u -= rs.u, v -= rs.v, w -= rs.w); return *this; } + FI XYZEval& operator*=(const XYZval &rs) { NUM_AXIS_CODE(x *= rs.x, y *= rs.y, z *= rs.z, i *= rs.i, j *= rs.j, k *= rs.k, u *= rs.u, v *= rs.v, w *= rs.w); return *this; } + FI XYZEval& operator/=(const XYZval &rs) { NUM_AXIS_CODE(x /= rs.x, y /= rs.y, z /= rs.z, i /= rs.i, j /= rs.j, k /= rs.k, u /= rs.u, v /= rs.v, w /= rs.w); return *this; } + FI XYZEval& operator+=(const XYZEval &rs) { LOGICAL_AXIS_CODE(e += rs.e, x += rs.x, y += rs.y, z += rs.z, i += rs.i, j += rs.j, k += rs.k, u += rs.u, v += rs.v, w += rs.w); return *this; } + FI XYZEval& operator-=(const XYZEval &rs) { LOGICAL_AXIS_CODE(e -= rs.e, x -= rs.x, y -= rs.y, z -= rs.z, i -= rs.i, j -= rs.j, k -= rs.k, u -= rs.u, v -= rs.v, w -= rs.w); return *this; } + FI XYZEval& operator*=(const XYZEval &rs) { LOGICAL_AXIS_CODE(e *= rs.e, x *= rs.x, y *= rs.y, z *= rs.z, i *= rs.i, j *= rs.j, k *= rs.k, u *= rs.u, v *= rs.v, w *= rs.w); return *this; } + FI XYZEval& operator/=(const XYZEval &rs) { LOGICAL_AXIS_CODE(e /= rs.e, x /= rs.x, y /= rs.y, z /= rs.z, i /= rs.i, j /= rs.j, k /= rs.k, u /= rs.u, v /= rs.v, w /= rs.w); return *this; } + FI XYZEval& operator*=(const T &p) { LOGICAL_AXIS_CODE(e *= p, x *= p, y *= p, z *= p, i *= p, j *= p, k *= p, u *= p, v *= p, w *= p); return *this; } + FI XYZEval& operator>>=(const int &p) { LOGICAL_AXIS_CODE(_RSE(e), _RSE(x), _RSE(y), _RSE(z), _RSE(i), _RSE(j), _RSE(k), _RSE(u), _RSE(v), _RSE(w)); return *this; } + FI XYZEval& operator<<=(const int &p) { LOGICAL_AXIS_CODE(_LSE(e), _LSE(x), _LSE(y), _LSE(z), _LSE(i), _LSE(j), _LSE(k), _LSE(u), _LSE(v), _LSE(w)); return *this; } // Exact comparisons. For floats a "NEAR" operation may be better. - FI bool operator==(const XYZval &rs) const { return true NUM_AXIS_GANG(&& x == rs.x, && y == rs.y, && z == rs.z, && i == rs.i, && j == rs.j, && k == rs.k, && u == rs.u, && v == rs.v, && w == rs.w); } - FI bool operator==(const XYZEval &rs) const { return true LOGICAL_AXIS_GANG(&& e == rs.e, && x == rs.x, && y == rs.y, && z == rs.z, && i == rs.i, && j == rs.j, && k == rs.k, && u == rs.u, && v == rs.v, && w == rs.w); } - FI bool operator!=(const XYZval &rs) const { return !operator==(rs); } - FI bool operator!=(const XYZEval &rs) const { return !operator==(rs); } + FI bool operator==(const XYZval &rs) const { return true NUM_AXIS_GANG(&& x == rs.x, && y == rs.y, && z == rs.z, && i == rs.i, && j == rs.j, && k == rs.k, && u == rs.u, && v == rs.v, && w == rs.w); } + FI bool operator==(const XYZEval &rs) const { return true LOGICAL_AXIS_GANG(&& e == rs.e, && x == rs.x, && y == rs.y, && z == rs.z, && i == rs.i, && j == rs.j, && k == rs.k, && u == rs.u, && v == rs.v, && w == rs.w); } + FI bool operator!=(const XYZval &rs) const { return !operator==(rs); } + FI bool operator!=(const XYZEval &rs) const { return !operator==(rs); } }; #include // for memset @@ -1001,4 +958,6 @@ class AxisBits { #undef _ABS #undef _LS #undef _RS +#undef _LSE +#undef _RSE #undef FI From 06aed792c08ee2e105b034601a4ea773d0869dfd Mon Sep 17 00:00:00 2001 From: Giuliano Zaro <3684609+GMagician@users.noreply.github.com> Date: Sat, 13 May 2023 23:23:23 +0200 Subject: [PATCH 010/100] =?UTF-8?q?=F0=9F=A9=B9=20MMU2=20unload=20followup?= =?UTF-8?q?=20(#25825)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #20147 --- Marlin/src/lcd/menu/menu_mmu2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/lcd/menu/menu_mmu2.cpp b/Marlin/src/lcd/menu/menu_mmu2.cpp index a6ce14702449b..ca3627ce10028 100644 --- a/Marlin/src/lcd/menu/menu_mmu2.cpp +++ b/Marlin/src/lcd/menu/menu_mmu2.cpp @@ -47,7 +47,7 @@ void _mmu2_load_to_feeder(const uint8_t index) { } void action_mmu2_load_all() { - EXTRUDER_LOOP() _mmu2_load_filament(e); + EXTRUDER_LOOP() _mmu2_load_to_feeder(e); ui.return_to_status(); } From d5fdbb89ea55a19815c6997d47f1268a96d2cac9 Mon Sep 17 00:00:00 2001 From: "Alexey D. Filimonov" Date: Sun, 14 May 2023 00:25:36 +0300 Subject: [PATCH 011/100] =?UTF-8?q?=F0=9F=9A=B8=20TFT=20optional=20axes/ex?= =?UTF-8?q?truder=20(#25624)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/lcd/tft/touch.cpp | 22 +- Marlin/src/lcd/tft/ui_1024x600.cpp | 336 ++++++++++++---------- Marlin/src/lcd/tft/ui_320x240.cpp | 429 ++++++++++++++++------------- Marlin/src/lcd/tft/ui_480x320.cpp | 354 ++++++++++++++---------- 4 files changed, 658 insertions(+), 483 deletions(-) diff --git a/Marlin/src/lcd/tft/touch.cpp b/Marlin/src/lcd/tft/touch.cpp index 17784ff527573..1765ae0a8e09f 100644 --- a/Marlin/src/lcd/tft/touch.cpp +++ b/Marlin/src/lcd/tft/touch.cpp @@ -222,15 +222,19 @@ void Touch::touch(touch_control_t *control) { ui.clear_lcd(); 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(GET_TEXT_F(MSG_FLOW), &planner.flow_percentage[MenuItemBase::itemIndex], 10, 999, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); }); - #else - MenuItem_int3::action(GET_TEXT_F(MSG_FLOW_N), &planner.flow_percentage[MenuItemBase::itemIndex], 10, 999, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); }); - #endif - break; + + #if HAS_EXTRUDERS + case FLOWRATE: + ui.clear_lcd(); + MenuItemBase::itemIndex = control->data; + #if EXTRUDERS == 1 + MenuItem_int3::action(GET_TEXT_F(MSG_FLOW), &planner.flow_percentage[MenuItemBase::itemIndex], 10, 999, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); }); + #else + MenuItem_int3::action(GET_TEXT_F(MSG_FLOW_N), &planner.flow_percentage[MenuItemBase::itemIndex], 10, 999, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); }); + #endif + break; + #endif + case STOP: ui.goto_screen([]{ MenuItem_confirm::select_screen(GET_TEXT_F(MSG_BUTTON_STOP), diff --git a/Marlin/src/lcd/tft/ui_1024x600.cpp b/Marlin/src/lcd/tft/ui_1024x600.cpp index cf5911cdc1c4c..460f3a345b552 100644 --- a/Marlin/src/lcd/tft/ui_1024x600.cpp +++ b/Marlin/src/lcd/tft/ui_1024x600.cpp @@ -124,8 +124,12 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) { celsius_t currentTemperature, targetTemperature; if (Heater >= 0) { // HotEnd - currentTemperature = thermalManager.wholeDegHotend(Heater); - targetTemperature = thermalManager.degTargetHotend(Heater); + #if HAS_EXTRUDERS + currentTemperature = thermalManager.wholeDegHotend(Heater); + targetTemperature = thermalManager.degTargetHotend(Heater); + #else + return; + #endif } #if HAS_HEATED_BED else if (Heater == H_BED) { @@ -270,37 +274,45 @@ void MarlinUI::draw_status_screen() { #endif } else { - tft.add_text(200, 3, COLOR_AXIS_HOMED , "X"); - const bool nhx = axis_should_home(X_AXIS); - 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); + #if HAS_X_AXIS + tft.add_text(200, 3, COLOR_AXIS_HOMED , "X"); + const bool nhx = axis_should_home(X_AXIS); + 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); + #endif - tft.add_text(500, 3, COLOR_AXIS_HOMED , "Y"); - const bool nhy = axis_should_home(Y_AXIS); - 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); + #if HAS_Y_AXIS + tft.add_text(500, 3, COLOR_AXIS_HOMED , "Y"); + const bool nhy = axis_should_home(Y_AXIS); + 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); + #endif } - 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('?'); - else { - const float z = LOGICAL_Z_POSITION(current_position.z); - tft_string.set(ftostr52sp((int16_t)z)); - tft_string.rtrim(); - offset += tft_string.width(); - tft_string.set(ftostr52sp(z)); - offset -= tft_string.width(); - } - tft.add_text(900 - tft_string.width() - offset, 3, nhz ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string); + #if HAS_Z_AXIS + 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('?'); + else { + const float z = LOGICAL_Z_POSITION(current_position.z); + tft_string.set(ftostr52sp((int16_t)z)); + tft_string.rtrim(); + offset += tft_string.width(); + + tft_string.set(ftostr52sp(z)); + offset -= tft_string.width(); + } + tft.add_text(900 - tft_string.width() - offset, 3, nhz ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string); + #endif // HAS_Z_AXIS + TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 4, y, TFT_WIDTH - 8, FONT_LINE_HEIGHT)); y += 100; @@ -314,15 +326,17 @@ void MarlinUI::draw_status_screen() { tft.add_text(36, 1, color , tft_string); TERN_(TOUCH_SCREEN, touch.add_control(FEEDRATE, 274, y, 128, 32)); - // flow rate - tft.canvas(650, y, 128, 32); - tft.set_background(COLOR_BACKGROUND); - color = planner.flow_percentage[0] == 100 ? COLOR_RATE_100 : COLOR_RATE_ALTERED; - tft.add_image(0, 0, imgFlowRate, color); - tft_string.set(i16tostr3rj(planner.flow_percentage[active_extruder])); - tft_string.add('%'); - tft.add_text(36, 1, color , tft_string); - TERN_(TOUCH_SCREEN, touch.add_control(FLOWRATE, 650, y, 128, 32, active_extruder)); + // Flow rate + #if HAS_EXTRUDERS + tft.canvas(650, y, 128, 32); + tft.set_background(COLOR_BACKGROUND); + color = planner.flow_percentage[0] == 100 ? COLOR_RATE_100 : COLOR_RATE_ALTERED; + tft.add_image(0, 0, imgFlowRate, color); + tft_string.set(i16tostr3rj(planner.flow_percentage[active_extruder])); + tft_string.add('%'); + tft.add_text(36, 1, color , tft_string); + TERN_(TOUCH_SCREEN, touch.add_control(FLOWRATE, 650, y, 128, 32, active_extruder)); + #endif #if ENABLED(TOUCH_SCREEN) add_control(900, y, menu_main, imgSettings); @@ -584,16 +598,26 @@ void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, con #define Z_SELECTION_Z 1 #define Z_SELECTION_Z_PROBE -1 -struct MotionAxisState { - xy_int_t xValuePos, yValuePos, zValuePos, eValuePos, stepValuePos, zTypePos, eNamePos; +struct { + #if HAS_X_AXIS + xy_int_t xValuePos; + #endif + #if HAS_Y_AXIS + xy_int_t yValuePos; + #endif + #if HAS_Z_AXIS + xy_int_t zValuePos, zTypePos; + int z_selection = Z_SELECTION_Z; + #endif + #if HAS_EXTRUDERS + xy_int_t eValuePos, eNamePos; + uint8_t e_selection = 0; + #endif + xy_int_t stepValuePos; float currentStepSize = 10.0; - int z_selection = Z_SELECTION_Z; - uint8_t e_selection = 0; bool blocked = false; char message[32]; -}; - -MotionAxisState motionAxisState; +} motionAxisState; #define BTN_WIDTH 64 #define BTN_HEIGHT 52 @@ -620,27 +644,30 @@ static void drawCurStepValue() { tft.add_text(tft_string.center(CUR_STEP_VALUE_WIDTH), 0, COLOR_AXIS_HOMED, tft_string); } -static void drawCurZSelection() { - 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(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) { +#if HAS_Z_AXIS + static void drawCurZSelection() { + 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(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) + tft.add_text(0, 0, Z_BTN_COLOR, tft_string); } -} +#endif -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.add_text(0, 0, E_BTN_COLOR , tft_string); - tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection)); -} +#if HAS_EXTRUDERS + 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.add_text(0, 0, E_BTN_COLOR , tft_string); + tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection)); + } +#endif static void drawMessage(PGM_P const msg) { tft.canvas(X_MARGIN, TFT_HEIGHT - Y_MARGIN - 34, TFT_HEIGHT / 2, 34); @@ -658,10 +685,18 @@ static void drawAxisValue(const AxisEnum axis) { xy_int_t pos; uint16_t color; switch (axis) { - case X_AXIS: pos = motionAxisState.xValuePos; color = X_BTN_COLOR; break; - case Y_AXIS: pos = motionAxisState.yValuePos; color = Y_BTN_COLOR; break; - case Z_AXIS: pos = motionAxisState.zValuePos; color = Z_BTN_COLOR; break; - case E_AXIS: pos = motionAxisState.eValuePos; color = E_BTN_COLOR; break; + #if HAS_X_AXIS + case X_AXIS: pos = motionAxisState.xValuePos; color = X_BTN_COLOR; break; + #endif + #if HAS_Y_AXIS + case Y_AXIS: pos = motionAxisState.yValuePos; color = Y_BTN_COLOR; break; + #endif + #if HAS_Z_AXIS + case Z_AXIS: pos = motionAxisState.zValuePos; color = Z_BTN_COLOR; break; + #endif + #if HAS_EXTRUDERS + case E_AXIS: pos = motionAxisState.eValuePos; color = E_BTN_COLOR; break; + #endif default: return; } tft.canvas(pos.x, pos.y, BTN_WIDTH + X_MARGIN, BTN_HEIGHT); @@ -673,53 +708,57 @@ static void drawAxisValue(const AxisEnum axis) { static void moveAxis(const AxisEnum axis, const int8_t direction) { quick_feedback(); - if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) { - drawMessage(F("Too cold")); - return; - } + #if HAS_EXTRUDERS + if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) { + drawMessage(F("Too cold")); + return; + } + #endif const float diff = motionAxisState.currentStepSize * direction; - if (axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE) { - #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - const int16_t babystep_increment = direction * BABYSTEP_SIZE_Z; - const bool do_probe = DISABLED(BABYSTEP_HOTEND_Z_OFFSET) || active_extruder == 0; - const float bsDiff = planner.mm_per_step[Z_AXIS] * babystep_increment, - new_probe_offset = probe.offset.z + bsDiff, - new_offs = TERN(BABYSTEP_HOTEND_Z_OFFSET - , do_probe ? new_probe_offset : hotend_offset[active_extruder].z - bsDiff - , new_probe_offset - ); - if (WITHIN(new_offs, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { - babystep.add_steps(Z_AXIS, babystep_increment); - if (do_probe) - probe.offset.z = new_offs; + #if HAS_Z_AXIS + if (axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE) { + #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + const int16_t babystep_increment = direction * BABYSTEP_SIZE_Z; + const bool do_probe = DISABLED(BABYSTEP_HOTEND_Z_OFFSET) || active_extruder == 0; + const float bsDiff = planner.mm_per_step[Z_AXIS] * babystep_increment, + new_probe_offset = probe.offset.z + bsDiff, + new_offs = TERN(BABYSTEP_HOTEND_Z_OFFSET + , do_probe ? new_probe_offset : hotend_offset[active_extruder].z - bsDiff + , new_probe_offset + ); + if (WITHIN(new_offs, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { + babystep.add_steps(Z_AXIS, babystep_increment); + if (do_probe) + probe.offset.z = new_offs; + else + TERN(BABYSTEP_HOTEND_Z_OFFSET, hotend_offset[active_extruder].z = new_offs, NOOP); + drawMessage(F("")); // clear the error + drawAxisValue(axis); + } else - TERN(BABYSTEP_HOTEND_Z_OFFSET, hotend_offset[active_extruder].z = new_offs, NOOP); - drawMessage(F("")); // clear the error - drawAxisValue(axis); - } - else - 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_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_F(MSG_LCD_SOFT_ENDSTOPS)); - } - else - drawMessage(F("")); // clear the error + 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_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_F(MSG_LCD_SOFT_ENDSTOPS)); + } + else + drawMessage(F("")); // clear the error - drawAxisValue(axis); - #endif - return; - } + drawAxisValue(axis); + #endif + return; + } + #endif // HAS_Z_AXIS if (!ui.manual_move.processing) { // Get motion limit from software endstops, if any @@ -729,7 +768,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { // Delta limits XY based on the current offset from center // This assumes the center is 0,0 #if ENABLED(DELTA) - if (axis != Z_AXIS && axis != E_AXIS) { + if (axis != Z_AXIS && TERN1(HAS_EXTRUDERS, axis != E_AXIS)) { max = SQRT(sq(float(PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis])); // (Y_AXIS - axis) == the other axis min = -max; } @@ -750,35 +789,44 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { drawAxisValue(axis); } -static void e_plus() { moveAxis(E_AXIS, 1); } -static void e_minus() { moveAxis(E_AXIS, -1); } -static void x_minus() { moveAxis(X_AXIS, -1); } -static void x_plus() { moveAxis(X_AXIS, 1); } -static void y_plus() { moveAxis(Y_AXIS, 1); } -static void y_minus() { moveAxis(Y_AXIS, -1); } -static void z_plus() { moveAxis(Z_AXIS, 1); } -static void z_minus() { moveAxis(Z_AXIS, -1); } +#if HAS_EXTRUDERS + static void e_plus() { moveAxis(E_AXIS, 1); } + static void e_minus() { moveAxis(E_AXIS, -1); } +#endif +#if HAS_X_AXIS + static void x_minus() { moveAxis(X_AXIS, -1); } + static void x_plus() { moveAxis(X_AXIS, 1); } +#endif +#if HAS_Y_AXIS + static void y_plus() { moveAxis(Y_AXIS, 1); } + static void y_minus() { moveAxis(Y_AXIS, -1); } +#endif +#if HAS_Z_AXIS + static void z_plus() { moveAxis(Z_AXIS, 1); } + static void z_minus() { moveAxis(Z_AXIS, -1); } +#endif #if ENABLED(TOUCH_SCREEN) - static void e_select() { - if (++motionAxisState.e_selection >= EXTRUDERS) - motionAxisState.e_selection = 0; - - quick_feedback(); - drawCurESelection(); - drawAxisValue(E_AXIS); - } + #if HAS_EXTRUDERS + static void e_select() { + if (++motionAxisState.e_selection >= EXTRUDERS) + motionAxisState.e_selection = 0; + quick_feedback(); + drawCurESelection(); + drawAxisValue(E_AXIS); + } + #endif static void do_home() { quick_feedback(); drawMessage(GET_TEXT_F(MSG_LEVEL_BED_HOMING)); queue.inject_P(G28_STR); // Disable touch until home is done - TERN_(TOUCH_SCREEN, touch.disable()); - drawAxisValue(E_AXIS); - drawAxisValue(X_AXIS); - drawAxisValue(Y_AXIS); - drawAxisValue(Z_AXIS); + touch.disable(); + TERN_(HAS_EXTRUDERS, drawAxisValue(E_AXIS)); + TERN_(HAS_X_AXIS, drawAxisValue(X_AXIS)); + TERN_(HAS_Y_AXIS, drawAxisValue(Y_AXIS)); + TERN_(HAS_Z_AXIS, drawAxisValue(Z_AXIS)); } static void step_size() { @@ -845,7 +893,7 @@ void MarlinUI::move_axis_screen() { // ROW 1 -> E- Y- CurY Z+ int x = X_MARGIN, y = Y_MARGIN, spacing = 0; - drawBtn(x, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy); + TERN_(HAS_EXTRUDERS, drawBtn(x, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy)); spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2; x += BTN_WIDTH + spacing; @@ -858,7 +906,9 @@ void MarlinUI::move_axis_screen() { drawAxisValue(Y_AXIS); x += spacing; - drawBtn(x, y, "Z+", (intptr_t)z_plus, imgUp, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step + #if HAS_Z_AXIS + drawBtn(x, y, "Z+", (intptr_t)z_plus, imgUp, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step + #endif // ROW 2 -> "Ex" X- HOME X+ "Z" y += BTN_HEIGHT + (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3; @@ -867,8 +917,10 @@ void MarlinUI::move_axis_screen() { motionAxisState.eNamePos.x = x; motionAxisState.eNamePos.y = y; - drawCurESelection(); - TERN_(TOUCH_SCREEN, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select)); + #if HAS_EXTRUDERS + drawCurESelection(); + TERN_(TOUCH_SCREEN, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select)); + #endif x += BTN_WIDTH + spacing; drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy); @@ -883,7 +935,7 @@ void MarlinUI::move_axis_screen() { x += BTN_WIDTH + spacing; motionAxisState.zTypePos.x = x; motionAxisState.zTypePos.y = y; - drawCurZSelection(); + TERN_(HAS_Z_AXIS, drawCurZSelection()); #if BOTH(HAS_BED_PROBE, TOUCH_SCREEN) if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select); #endif @@ -893,12 +945,12 @@ void MarlinUI::move_axis_screen() { x = X_MARGIN; spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2; - drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy); + TERN_(HAS_EXTRUDERS, drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy)); // Cur E motionAxisState.eValuePos.x = x; motionAxisState.eValuePos.y = y + BTN_HEIGHT + 2; - drawAxisValue(E_AXIS); + TERN_(HAS_EXTRUDERS, drawAxisValue(E_AXIS)); // Cur X motionAxisState.xValuePos.x = BTN_WIDTH + (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4; //X- pos @@ -909,12 +961,14 @@ void MarlinUI::move_axis_screen() { drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy); x += BTN_WIDTH + spacing; - drawBtn(x, y, "Z-", (intptr_t)z_minus, imgDown, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step + #if HAS_Z_AXIS + drawBtn(x, y, "Z-", (intptr_t)z_minus, imgDown, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step + #endif // Cur Z motionAxisState.zValuePos.x = x; motionAxisState.zValuePos.y = y + BTN_HEIGHT + 2; - drawAxisValue(Z_AXIS); + TERN_(HAS_Z_AXIS, drawAxisValue(Z_AXIS)); // ROW 4 -> step_size disable steppers back y = TFT_HEIGHT - Y_MARGIN - 32; // diff --git a/Marlin/src/lcd/tft/ui_320x240.cpp b/Marlin/src/lcd/tft/ui_320x240.cpp index bac7586a25eb3..c2918711f47b9 100644 --- a/Marlin/src/lcd/tft/ui_320x240.cpp +++ b/Marlin/src/lcd/tft/ui_320x240.cpp @@ -126,8 +126,12 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) { celsius_t currentTemperature, targetTemperature; if (Heater >= 0) { // HotEnd - currentTemperature = thermalManager.wholeDegHotend(Heater); - targetTemperature = thermalManager.degTargetHotend(Heater); + #if HAS_EXTRUDERS + currentTemperature = thermalManager.wholeDegHotend(Heater); + targetTemperature = thermalManager.degTargetHotend(Heater); + #else + return; + #endif } #if HAS_HEATED_BED else if (Heater == H_BED) { @@ -283,52 +287,59 @@ void MarlinUI::draw_status_screen() { #endif } else { - tft.add_text(TERN(TFT_COLOR_UI_PORTRAIT, 32, 10), tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED , "X"); - const bool nhx = axis_should_home(X_AXIS); - tft_string.set(blink && nhx ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x))); - tft.add_text( - #if ENABLED(TFT_COLOR_UI_PORTRAIT) - 32 - tft_string.width() / 2, FONT_LINE_HEIGHT + tft_string.vcenter(FONT_LINE_HEIGHT), - #else - 68 - tft_string.width(), tft_string.vcenter(FONT_LINE_HEIGHT), - #endif - nhx ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string - ); + #if HAS_X_AXIS + tft.add_text(TERN(TFT_COLOR_UI_PORTRAIT, 32, 10), tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED , "X"); + const bool nhx = axis_should_home(X_AXIS); + tft_string.set(blink && nhx ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x))); + tft.add_text( + #if ENABLED(TFT_COLOR_UI_PORTRAIT) + 32 - tft_string.width() / 2, FONT_LINE_HEIGHT + tft_string.vcenter(FONT_LINE_HEIGHT), + #else + 68 - tft_string.width(), tft_string.vcenter(FONT_LINE_HEIGHT), + #endif + nhx ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string + ); + #endif + + #if HAS_Y_AXIS + tft.add_text(TERN(TFT_COLOR_UI_PORTRAIT, 110, 127), tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED , "Y"); + const bool nhy = axis_should_home(Y_AXIS); + tft_string.set(blink && nhy ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y))); + tft.add_text( + #if ENABLED(TFT_COLOR_UI_PORTRAIT) + 110 - tft_string.width() / 2, FONT_LINE_HEIGHT + tft_string.vcenter(FONT_LINE_HEIGHT), + #else + 185 - tft_string.width(), tft_string.vcenter(FONT_LINE_HEIGHT), + #endif + nhy ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string + ); + #endif + } - tft.add_text(TERN(TFT_COLOR_UI_PORTRAIT, 110, 127), tft_string.vcenter(FONT_LINE_HEIGHT), 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 HAS_Z_AXIS + tft.add_text(TERN(TFT_COLOR_UI_PORTRAIT, 192, 219), tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED , "Z"); + const bool nhz = axis_should_home(Z_AXIS); + uint16_t offset = 25; + if (blink && nhz) + tft_string.set('?'); + else { + const float z = LOGICAL_Z_POSITION(current_position.z); + tft_string.set(ftostr52sp((int16_t)z)); + tft_string.rtrim(); + offset += tft_string.width(); + + tft_string.set(ftostr52sp(z)); + offset -= tft_string.width(); + } tft.add_text( #if ENABLED(TFT_COLOR_UI_PORTRAIT) - 110 - tft_string.width() / 2, FONT_LINE_HEIGHT + tft_string.vcenter(FONT_LINE_HEIGHT), + 192 - tft_string.width() / 2, FONT_LINE_HEIGHT + tft_string.vcenter(FONT_LINE_HEIGHT), #else - 185 - tft_string.width(), tft_string.vcenter(FONT_LINE_HEIGHT), + 301 - tft_string.width() - offset, tft_string.vcenter(FONT_LINE_HEIGHT), #endif - nhy ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string - ); - } - - tft.add_text(TERN(TFT_COLOR_UI_PORTRAIT, 192, 219), tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED , "Z"); - const bool nhz = axis_should_home(Z_AXIS); - uint16_t offset = 25; - if (blink && nhz) - tft_string.set('?'); - else { - const float z = LOGICAL_Z_POSITION(current_position.z); - tft_string.set(ftostr52sp((int16_t)z)); - tft_string.rtrim(); - offset += tft_string.width(); + nhz ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string); + #endif - tft_string.set(ftostr52sp(z)); - offset -= tft_string.width(); - } - tft.add_text( - #if ENABLED(TFT_COLOR_UI_PORTRAIT) - 192 - tft_string.width() / 2, FONT_LINE_HEIGHT + tft_string.vcenter(FONT_LINE_HEIGHT), - #else - 301 - tft_string.width() - offset, tft_string.vcenter(FONT_LINE_HEIGHT), - #endif - nhz ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string); TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 0, 103, #if ENABLED(TFT_COLOR_UI_PORTRAIT) 232, FONT_LINE_HEIGHT * 2 @@ -361,29 +372,31 @@ void MarlinUI::draw_status_screen() { , 32 )); - // flow rate - tft.canvas( - #if ENABLED(TFT_COLOR_UI_PORTRAIT) - 140, 172, 80 - #else - 170, 136, 84 - #endif - , 32 - ); - tft.set_background(COLOR_BACKGROUND); - color = planner.flow_percentage[0] == 100 ? COLOR_RATE_100 : COLOR_RATE_ALTERED; - tft.add_image(0, 0, imgFlowRate, color); - tft_string.set(i16tostr3rj(planner.flow_percentage[active_extruder])); - tft_string.add('%'); - tft.add_text(32, tft_string.vcenter(30), color , tft_string); - TERN_(TOUCH_SCREEN, touch.add_control(FLOWRATE, - #if ENABLED(TFT_COLOR_UI_PORTRAIT) - 140, 172, 80 - #else - 170, 136, 84 - #endif - , 32, active_extruder - )); + // Flow rate + #if HAS_EXTRUDERS + tft.canvas( + #if ENABLED(TFT_COLOR_UI_PORTRAIT) + 140, 172, 80 + #else + 170, 136, 84 + #endif + , 32 + ); + tft.set_background(COLOR_BACKGROUND); + color = planner.flow_percentage[0] == 100 ? COLOR_RATE_100 : COLOR_RATE_ALTERED; + tft.add_image(0, 0, imgFlowRate, color); + tft_string.set(i16tostr3rj(planner.flow_percentage[active_extruder])); + tft_string.add('%'); + tft.add_text(32, tft_string.vcenter(30), color , tft_string); + TERN_(TOUCH_SCREEN, touch.add_control(FLOWRATE, + #if ENABLED(TFT_COLOR_UI_PORTRAIT) + 140, 172, 80 + #else + 170, 136, 84 + #endif + , 32, active_extruder + )); + #endif // HAS_EXTRUDERS // print duration char buffer[14]; @@ -666,16 +679,26 @@ void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, con #define Z_SELECTION_Z 1 #define Z_SELECTION_Z_PROBE -1 -struct MotionAxisState { - xy_int_t xValuePos, yValuePos, zValuePos, eValuePos, stepValuePos, zTypePos, eNamePos; +struct { + #if HAS_X_AXIS + xy_int_t xValuePos; + #endif + #if HAS_Y_AXIS + xy_int_t yValuePos; + #endif + #if HAS_Z_AXIS + xy_int_t zValuePos, zTypePos; + int z_selection = Z_SELECTION_Z; + #endif + #if HAS_EXTRUDERS + xy_int_t eValuePos, eNamePos; + uint8_t e_selection = 0; + #endif + xy_int_t stepValuePos; float currentStepSize = 10.0; - int z_selection = Z_SELECTION_Z; - uint8_t e_selection = 0; bool blocked = false; char message[32]; -}; - -MotionAxisState motionAxisState; +} motionAxisState; #define BTN_WIDTH 48 #define BTN_HEIGHT 39 @@ -706,27 +729,30 @@ static void drawCurStepValue() { tft.add_text(CUR_STEP_VALUE_WIDTH - tft_string.width(), 0, COLOR_AXIS_HOMED, tft_string); } -static void drawCurZSelection() { - 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(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) { +#if HAS_Z_AXIS + static void drawCurZSelection() { + 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(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) + tft.add_text(0, 0, Z_BTN_COLOR, tft_string); } -} +#endif -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.add_text(0, 0, E_BTN_COLOR , tft_string); - tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection)); -} +#if HAS_EXTRUDERS + 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.add_text(0, 0, E_BTN_COLOR , tft_string); + tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection)); + } +#endif static void drawMessage(PGM_P const msg) { tft.canvas(X_MARGIN, @@ -751,10 +777,18 @@ static void drawAxisValue(const AxisEnum axis) { xy_int_t pos; uint16_t color; switch (axis) { - case X_AXIS: pos = motionAxisState.xValuePos; color = X_BTN_COLOR; break; - case Y_AXIS: pos = motionAxisState.yValuePos; color = Y_BTN_COLOR; break; - case Z_AXIS: pos = motionAxisState.zValuePos; color = Z_BTN_COLOR; break; - case E_AXIS: pos = motionAxisState.eValuePos; color = E_BTN_COLOR; break; + #if HAS_X_AXIS + case X_AXIS: pos = motionAxisState.xValuePos; color = X_BTN_COLOR; break; + #endif + #if HAS_Y_AXIS + case Y_AXIS: pos = motionAxisState.yValuePos; color = Y_BTN_COLOR; break; + #endif + #if HAS_Z_AXIS + case Z_AXIS: pos = motionAxisState.zValuePos; color = Z_BTN_COLOR; break; + #endif + #if HAS_EXTRUDERS + case E_AXIS: pos = motionAxisState.eValuePos; color = E_BTN_COLOR; break; + #endif default: return; } tft.canvas(pos.x, pos.y, BTN_WIDTH + X_MARGIN, FONT_LINE_HEIGHT); @@ -766,53 +800,57 @@ static void drawAxisValue(const AxisEnum axis) { static void moveAxis(const AxisEnum axis, const int8_t direction) { quick_feedback(); - if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) { - drawMessage(F("Too cold")); - return; - } + #if HAS_EXTRUDERS + if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) { + drawMessage(F("Too cold")); + return; + } + #endif const float diff = motionAxisState.currentStepSize * direction; - if (axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE) { - #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - const int16_t babystep_increment = direction * BABYSTEP_SIZE_Z; - const bool do_probe = DISABLED(BABYSTEP_HOTEND_Z_OFFSET) || active_extruder == 0; - const float bsDiff = planner.mm_per_step[Z_AXIS] * babystep_increment, - new_probe_offset = probe.offset.z + bsDiff, - new_offs = TERN(BABYSTEP_HOTEND_Z_OFFSET - , do_probe ? new_probe_offset : hotend_offset[active_extruder].z - bsDiff - , new_probe_offset - ); - if (WITHIN(new_offs, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { - babystep.add_steps(Z_AXIS, babystep_increment); - if (do_probe) - probe.offset.z = new_offs; - else - TERN(BABYSTEP_HOTEND_Z_OFFSET, hotend_offset[active_extruder].z = new_offs, NOOP); - drawMessage(NUL_STR); // clear the error + #if HAS_Z_AXIS + if (axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE) { + #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + const int16_t babystep_increment = direction * BABYSTEP_SIZE_Z; + const bool do_probe = DISABLED(BABYSTEP_HOTEND_Z_OFFSET) || active_extruder == 0; + const float bsDiff = planner.mm_per_step[Z_AXIS] * babystep_increment, + new_probe_offset = probe.offset.z + bsDiff, + new_offs = TERN(BABYSTEP_HOTEND_Z_OFFSET + , do_probe ? new_probe_offset : hotend_offset[active_extruder].z - bsDiff + , new_probe_offset + ); + if (WITHIN(new_offs, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { + babystep.add_steps(Z_AXIS, babystep_increment); + if (do_probe) + probe.offset.z = new_offs; + else + TERN(BABYSTEP_HOTEND_Z_OFFSET, hotend_offset[active_extruder].z = new_offs, NOOP); + drawMessage(NUL_STR); // clear the error + drawAxisValue(axis); + } + else { + 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_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_F(MSG_LCD_SOFT_ENDSTOPS)); + } + else { + drawMessage(NUL_STR); // clear the error + } drawAxisValue(axis); - } - else { - 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_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_F(MSG_LCD_SOFT_ENDSTOPS)); - } - else { - drawMessage(NUL_STR); // clear the error - } - drawAxisValue(axis); - #endif - return; - } + #endif + return; + } + #endif // HAS_Z_AXIS if (!ui.manual_move.processing) { // Get motion limit from software endstops, if any @@ -822,7 +860,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { // Delta limits XY based on the current offset from center // This assumes the center is 0,0 #if ENABLED(DELTA) - if (axis != Z_AXIS && axis != E_AXIS) { + if (axis != Z_AXIS && TERN1(HAS_EXTRUDERS, axis != E_AXIS)) { max = SQRT(sq(float(PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis])); // (Y_AXIS - axis) == the other axis min = -max; } @@ -843,35 +881,44 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { drawAxisValue(axis); } -static void e_plus() { moveAxis(E_AXIS, 1); } -static void e_minus() { moveAxis(E_AXIS, -1); } -static void x_minus() { moveAxis(X_AXIS, -1); } -static void x_plus() { moveAxis(X_AXIS, 1); } -static void y_plus() { moveAxis(Y_AXIS, 1); } -static void y_minus() { moveAxis(Y_AXIS, -1); } -static void z_plus() { moveAxis(Z_AXIS, 1); } -static void z_minus() { moveAxis(Z_AXIS, -1); } +#if HAS_EXTRUDERS + static void e_plus() { moveAxis(E_AXIS, 1); } + static void e_minus() { moveAxis(E_AXIS, -1); } +#endif +#if HAS_X_AXIS + static void x_minus() { moveAxis(X_AXIS, -1); } + static void x_plus() { moveAxis(X_AXIS, 1); } +#endif +#if HAS_Y_AXIS + static void y_plus() { moveAxis(Y_AXIS, 1); } + static void y_minus() { moveAxis(Y_AXIS, -1); } +#endif +#if HAS_Z_AXIS + static void z_plus() { moveAxis(Z_AXIS, 1); } + static void z_minus() { moveAxis(Z_AXIS, -1); } +#endif #if ENABLED(TOUCH_SCREEN) - static void e_select() { - if (++motionAxisState.e_selection >= EXTRUDERS) - motionAxisState.e_selection = 0; - - quick_feedback(); - drawCurESelection(); - drawAxisValue(E_AXIS); - } + #if HAS_EXTRUDERS + static void e_select() { + if (++motionAxisState.e_selection >= EXTRUDERS) + motionAxisState.e_selection = 0; + quick_feedback(); + drawCurESelection(); + drawAxisValue(E_AXIS); + } + #endif static void do_home() { quick_feedback(); 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()); - drawAxisValue(E_AXIS); - drawAxisValue(X_AXIS); - drawAxisValue(Y_AXIS); - drawAxisValue(Z_AXIS); + touch.disable(); + TERN_(HAS_EXTRUDERS, drawAxisValue(E_AXIS)); + TERN_(HAS_X_AXIS, drawAxisValue(X_AXIS)); + TERN_(HAS_Y_AXIS, drawAxisValue(Y_AXIS)); + TERN_(HAS_Z_AXIS, drawAxisValue(Z_AXIS)); } static void step_size() { @@ -916,14 +963,14 @@ static void drawBtn(int x, int y, const char *label, intptr_t data, MarlinImage else tft.add_image(0, 0, img, bgColor, COLOR_BACKGROUND, COLOR_DARKGREY); - TERN_(HAS_TFT_XPT2046, if (enabled) touch.add_control(BUTTON, x, y, width, height, data)); + TERN_(TOUCH_SCREEN, if (enabled) touch.add_control(BUTTON, x, y, width, height, data)); } void MarlinUI::move_axis_screen() { // Reset defer_status_screen(true); motionAxisState.blocked = false; - TERN_(HAS_TFT_XPT2046, touch.enable()); + TERN_(TOUCH_SCREEN, touch.enable()); ui.clear_lcd(); @@ -949,7 +996,9 @@ void MarlinUI::move_axis_screen() { x += BTN_WIDTH + spacing; uint16_t zplus_x = x; - drawBtn(x, y, "Z+", (intptr_t)z_plus, imgUp, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step + #if HAS_Z_AXIS + drawBtn(x, y, "Z+", (intptr_t)z_plus, imgUp, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step + #endif // ROW 2 -> "Ex" CurY "Z" x = X_MARGIN; @@ -957,8 +1006,10 @@ void MarlinUI::move_axis_screen() { motionAxisState.eNamePos.x = x; motionAxisState.eNamePos.y = y; - drawCurESelection(); - TERN_(HAS_TFT_XPT2046, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select)); + #if HAS_EXTRUDERS + drawCurESelection(); + TERN_(TOUCH_SCREEN, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select)); + #endif motionAxisState.yValuePos.x = yplus_x; motionAxisState.yValuePos.y = y; @@ -966,7 +1017,7 @@ void MarlinUI::move_axis_screen() { motionAxisState.zTypePos.x = zplus_x; motionAxisState.zTypePos.y = y; - drawCurZSelection(); + TERN_(HAS_Z_AXIS, drawCurZSelection()); // ROW 3 -> X- HOME X+ y += (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3 - 2; @@ -974,7 +1025,7 @@ void MarlinUI::move_axis_screen() { drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy); - TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy)); + TERN_(TOUCH_SCREEN, add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy)); drawBtn(zplus_x, y, "X+", (intptr_t)x_plus, imgRight, X_BTN_COLOR, !busy); @@ -993,23 +1044,27 @@ void MarlinUI::move_axis_screen() { y += (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3 - 2; x = X_MARGIN; - drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy); + #if HAS_EXTRUDERS + drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy); + #endif // Cur E motionAxisState.eValuePos.x = x; motionAxisState.eValuePos.y = y + BTN_HEIGHT + 2; - drawAxisValue(E_AXIS); + TERN_(HAS_EXTRUDERS, drawAxisValue(E_AXIS)); x += BTN_WIDTH + spacing; drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy); x += BTN_WIDTH + spacing; - drawBtn(x, y, "Z-", (intptr_t)z_minus, imgDown, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step + #if HAS_Z_AXIS + drawBtn(x, y, "Z-", (intptr_t)z_minus, imgDown, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step + #endif // Cur Z motionAxisState.zValuePos.x = x; motionAxisState.zValuePos.y = y + BTN_HEIGHT + 2; - drawAxisValue(Z_AXIS); + TERN_(HAS_Z_AXIS, drawAxisValue(Z_AXIS)); // ROW 6 -> step_size disable steppers back y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT; // @@ -1019,7 +1074,7 @@ void MarlinUI::move_axis_screen() { if (!busy) { drawCurStepValue(); - TERN_(HAS_TFT_XPT2046, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size)); + TERN_(TOUCH_SCREEN, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size)); } // aligned with x+ @@ -1030,7 +1085,7 @@ void MarlinUI::move_axis_screen() { // ROW 1 -> E+ Y+ CurY Z+ int x = X_MARGIN, y = Y_MARGIN, spacing = 0; - drawBtn(x, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy); + TERN_(HAS_EXTRUDERS, drawBtn(x, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy)); spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2; x += BTN_WIDTH + spacing; @@ -1044,7 +1099,9 @@ void MarlinUI::move_axis_screen() { drawAxisValue(Y_AXIS); x += spacing; - drawBtn(x, y, "Z+", (intptr_t)z_plus, imgUp, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step + #if HAS_Z_AXIS + drawBtn(x, y, "Z+", (intptr_t)z_plus, imgUp, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step + #endif // ROW 2 -> "Ex" X- HOME X+ "Z" y += BTN_HEIGHT + (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3; @@ -1053,14 +1110,16 @@ void MarlinUI::move_axis_screen() { motionAxisState.eNamePos.x = x; motionAxisState.eNamePos.y = y; - drawCurESelection(); - TERN_(HAS_TFT_XPT2046, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select)); + #if HAS_EXTRUDERS + drawCurESelection(); + TERN_(TOUCH_SCREEN, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select)); + #endif x += BTN_WIDTH + spacing; drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy); x += BTN_WIDTH + spacing; //imgHome is 64x64 - TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy)); + TERN_(TOUCH_SCREEN, add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy)); x += BTN_WIDTH + spacing; uint16_t xplus_x = x; @@ -1069,9 +1128,9 @@ void MarlinUI::move_axis_screen() { x += BTN_WIDTH + spacing; motionAxisState.zTypePos.x = x; motionAxisState.zTypePos.y = y; - drawCurZSelection(); + TERN_(HAS_Z_AXIS, drawCurZSelection()); #if BOTH(HAS_BED_PROBE, TOUCH_SCREEN) - if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select); + if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select); #endif // ROW 3 -> E- CurX Y- Z- @@ -1079,12 +1138,12 @@ void MarlinUI::move_axis_screen() { x = X_MARGIN; spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2; - drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy); + TERN_(HAS_EXTRUDERS, drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy)); // Cur E motionAxisState.eValuePos.x = x; motionAxisState.eValuePos.y = y + BTN_HEIGHT + 2; - drawAxisValue(E_AXIS); + TERN_(HAS_EXTRUDERS, drawAxisValue(E_AXIS)); // Cur X motionAxisState.xValuePos.x = BTN_WIDTH + (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4; //X- pos @@ -1095,12 +1154,14 @@ void MarlinUI::move_axis_screen() { drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy); x += BTN_WIDTH + spacing; - drawBtn(x, y, "Z-", (intptr_t)z_minus, imgDown, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step + #if HAS_Z_AXIS + drawBtn(x, y, "Z-", (intptr_t)z_minus, imgDown, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step + #endif // Cur Z motionAxisState.zValuePos.x = x; motionAxisState.zValuePos.y = y + BTN_HEIGHT + 2; - drawAxisValue(Z_AXIS); + TERN_(HAS_Z_AXIS, drawAxisValue(Z_AXIS)); // ROW 4 -> step_size disable steppers back y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT; // @@ -1109,7 +1170,7 @@ void MarlinUI::move_axis_screen() { motionAxisState.stepValuePos.y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT; if (!busy) { drawCurStepValue(); - TERN_(HAS_TFT_XPT2046, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size)); + TERN_(TOUCH_SCREEN, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size)); } // aligned with x+ @@ -1117,7 +1178,7 @@ void MarlinUI::move_axis_screen() { #endif // !TFT_COLOR_UI_PORTRAIT - TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack)); + TERN_(TOUCH_SCREEN, add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack)); } #endif // HAS_UI_320x240 diff --git a/Marlin/src/lcd/tft/ui_480x320.cpp b/Marlin/src/lcd/tft/ui_480x320.cpp index bc4ea0e5e223d..e1ddfe5e1ab11 100644 --- a/Marlin/src/lcd/tft/ui_480x320.cpp +++ b/Marlin/src/lcd/tft/ui_480x320.cpp @@ -124,8 +124,12 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) { celsius_t currentTemperature, targetTemperature; if (Heater >= 0) { // HotEnd - currentTemperature = thermalManager.wholeDegHotend(Heater); - targetTemperature = thermalManager.degTargetHotend(Heater); + #if HAS_EXTRUDERS + currentTemperature = thermalManager.wholeDegHotend(Heater); + targetTemperature = thermalManager.degTargetHotend(Heater); + #else + return; + #endif } #if HAS_HEATED_BED else if (Heater == H_BED) { @@ -271,31 +275,37 @@ void MarlinUI::draw_status_screen() { } else { // Coords in mask "X____Y____Z____" - tft_string.set("X"); - tft.add_text(coords_width / 30 - tft_string.width() / 2, tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED, tft_string); - - const bool nhx = axis_should_home(X_AXIS); - tft_string.set(blink && nhx ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x))); - tft_string.ltrim(); - tft.add_text(coords_width / 5 - tft_string.width() / 2, tft_string.vcenter(FONT_LINE_HEIGHT), nhx ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string); + #if HAS_X_AXIS + tft_string.set("X"); + tft.add_text(coords_width / 30 - tft_string.width() / 2, tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED, tft_string); + + const bool nhx = axis_should_home(X_AXIS); + tft_string.set(blink && nhx ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x))); + tft_string.ltrim(); + tft.add_text(coords_width / 5 - tft_string.width() / 2, tft_string.vcenter(FONT_LINE_HEIGHT), nhx ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string); + #endif - tft_string.set("Y"); - tft.add_text(11 * coords_width / 30 - tft_string.width() / 2, tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED, tft_string); + #if HAS_Y_AXIS + tft_string.set("Y"); + tft.add_text(11 * coords_width / 30 - tft_string.width() / 2, tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED, tft_string); - const bool nhy = axis_should_home(Y_AXIS); - tft_string.set(blink && nhy ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y))); - tft_string.ltrim(); - tft.add_text(8 * coords_width / 15 - tft_string.width() / 2, tft_string.vcenter(FONT_LINE_HEIGHT), nhy ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string); + const bool nhy = axis_should_home(Y_AXIS); + tft_string.set(blink && nhy ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y))); + tft_string.ltrim(); + tft.add_text(8 * coords_width / 15 - tft_string.width() / 2, tft_string.vcenter(FONT_LINE_HEIGHT), nhy ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string); + #endif } - tft_string.set("Z"); - tft.add_text(7 * coords_width / 10 - tft_string.width() / 2, tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED, tft_string); + #if HAS_Z_AXIS + tft_string.set("Z"); + tft.add_text(7 * coords_width / 10 - tft_string.width() / 2, tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED, tft_string); - const bool nhz = axis_should_home(Z_AXIS); - tft_string.set(blink && nhz ? "?" : ftostr52sp(LOGICAL_Z_POSITION(current_position.z))); - tft_string.ltrim(); - tft_string.rtrim(); - tft.add_text(13 * coords_width / 15 - tft_string.width() / 2, tft_string.vcenter(FONT_LINE_HEIGHT), nhz ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string); + const bool nhz = axis_should_home(Z_AXIS); + tft_string.set(blink && nhz ? "?" : ftostr52sp(LOGICAL_Z_POSITION(current_position.z))); + tft_string.ltrim(); + tft_string.rtrim(); + tft.add_text(13 * coords_width / 15 - tft_string.width() / 2, tft_string.vcenter(FONT_LINE_HEIGHT), nhz ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string); + #endif TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 4, y, TFT_WIDTH - 8, FONT_LINE_HEIGHT)); @@ -315,19 +325,21 @@ void MarlinUI::draw_status_screen() { tft.add_text(36, tft_string.vcenter(30), color , tft_string); TERN_(TOUCH_SCREEN, touch.add_control(FEEDRATE, x, y, component_width, 32)); - // Flow rate (preparing) - tft_string.set(i16tostr3rj(planner.flow_percentage[active_extruder])); - tft_string.add('%'); - component_width = 36 + tft_string.width(); - color = planner.flow_percentage[0] == 100 ? COLOR_RATE_100 : COLOR_RATE_ALTERED; - x = FLOWRATE_X(component_width); + #if HAS_EXTRUDERS + // Flow rate (preparing) + tft_string.set(i16tostr3rj(planner.flow_percentage[active_extruder])); + tft_string.add('%'); + component_width = 36 + tft_string.width(); + color = planner.flow_percentage[0] == 100 ? COLOR_RATE_100 : COLOR_RATE_ALTERED; + x = FLOWRATE_X(component_width); - // Flow rate (drawing) - tft.canvas(x, y, component_width, 32); - tft.set_background(COLOR_BACKGROUND); - tft.add_image(0, 0, imgFlowRate, color); - tft.add_text(36, tft_string.vcenter(30), color , tft_string); - TERN_(TOUCH_SCREEN, touch.add_control(FLOWRATE, x, y, component_width, 32, active_extruder)); + // Flow rate (drawing) + tft.canvas(x, y, component_width, 32); + tft.set_background(COLOR_BACKGROUND); + tft.add_image(0, 0, imgFlowRate, color); + tft.add_text(36, tft_string.vcenter(30), color , tft_string); + TERN_(TOUCH_SCREEN, touch.add_control(FLOWRATE, x, y, component_width, 32, active_extruder)); + #endif #if TFT_COLOR_UI_PORTRAIT || DISABLED(TOUCH_SCREEN) y += STATUS_MARGIN_SIZE + 32; @@ -586,16 +598,26 @@ void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, con #define Z_SELECTION_Z 1 #define Z_SELECTION_Z_PROBE -1 -struct MotionAxisState { - xy_int_t xValuePos, yValuePos, zValuePos, eValuePos, stepValuePos, zTypePos, eNamePos; +struct { + #if HAS_X_AXIS + xy_int_t xValuePos; + #endif + #if HAS_Y_AXIS + xy_int_t yValuePos; + #endif + #if HAS_Z_AXIS + xy_int_t zValuePos, zTypePos; + int z_selection = Z_SELECTION_Z; + #endif + #if HAS_EXTRUDERS + xy_int_t eValuePos, eNamePos; + uint8_t e_selection = 0; + #endif + xy_int_t stepValuePos; float currentStepSize = 10.0; - int z_selection = Z_SELECTION_Z; - uint8_t e_selection = 0; bool blocked = false; char message[32]; -}; - -MotionAxisState motionAxisState; +} motionAxisState; #define BTN_WIDTH 64 #define BTN_HEIGHT 52 @@ -622,27 +644,30 @@ static void drawCurStepValue() { tft.add_text(tft_string.center(CUR_STEP_VALUE_WIDTH), 0, COLOR_AXIS_HOMED, tft_string); } -static void drawCurZSelection() { - 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(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) { +#if HAS_Z_AXIS + static void drawCurZSelection() { + 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(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) + tft.add_text(0, 0, Z_BTN_COLOR, tft_string); } -} +#endif -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.add_text(0, 0, E_BTN_COLOR , tft_string); - tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection)); -} +#if HAS_EXTRUDERS + 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.add_text(0, 0, E_BTN_COLOR , tft_string); + tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection)); + } +#endif static void drawMessage(PGM_P const msg) { tft.canvas(X_MARGIN, TFT_HEIGHT - Y_MARGIN - 34, TFT_HEIGHT / 2, 34); @@ -660,10 +685,18 @@ static void drawAxisValue(const AxisEnum axis) { xy_int_t pos; uint16_t color; switch (axis) { - case X_AXIS: pos = motionAxisState.xValuePos; color = X_BTN_COLOR; break; - case Y_AXIS: pos = motionAxisState.yValuePos; color = Y_BTN_COLOR; break; - case Z_AXIS: pos = motionAxisState.zValuePos; color = Z_BTN_COLOR; break; - case E_AXIS: pos = motionAxisState.eValuePos; color = E_BTN_COLOR; break; + #if HAS_X_AXIS + case X_AXIS: pos = motionAxisState.xValuePos; color = X_BTN_COLOR; break; + #endif + #if HAS_Y_AXIS + case Y_AXIS: pos = motionAxisState.yValuePos; color = Y_BTN_COLOR; break; + #endif + #if HAS_Z_AXIS + case Z_AXIS: pos = motionAxisState.zValuePos; color = Z_BTN_COLOR; break; + #endif + #if HAS_EXTRUDERS + case E_AXIS: pos = motionAxisState.eValuePos; color = E_BTN_COLOR; break; + #endif default: return; } tft.canvas(pos.x, pos.y, BTN_WIDTH + X_MARGIN, BTN_HEIGHT); @@ -675,53 +708,57 @@ static void drawAxisValue(const AxisEnum axis) { static void moveAxis(const AxisEnum axis, const int8_t direction) { quick_feedback(); - if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) { - drawMessage(F("Too cold")); - return; - } + #if HAS_EXTRUDERS + if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) { + drawMessage(F("Too cold")); + return; + } + #endif const float diff = motionAxisState.currentStepSize * direction; - if (axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE) { - #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - const int16_t babystep_increment = direction * BABYSTEP_SIZE_Z; - const bool do_probe = DISABLED(BABYSTEP_HOTEND_Z_OFFSET) || active_extruder == 0; - const float bsDiff = planner.mm_per_step[Z_AXIS] * babystep_increment, - new_probe_offset = probe.offset.z + bsDiff, - new_offs = TERN(BABYSTEP_HOTEND_Z_OFFSET - , do_probe ? new_probe_offset : hotend_offset[active_extruder].z - bsDiff - , new_probe_offset - ); - if (WITHIN(new_offs, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { - babystep.add_steps(Z_AXIS, babystep_increment); - if (do_probe) - probe.offset.z = new_offs; - else - TERN(BABYSTEP_HOTEND_Z_OFFSET, hotend_offset[active_extruder].z = new_offs, NOOP); - drawMessage(NUL_STR); // clear the error + #if HAS_Z_AXIS + if (axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE) { + #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + const int16_t babystep_increment = direction * BABYSTEP_SIZE_Z; + const bool do_probe = DISABLED(BABYSTEP_HOTEND_Z_OFFSET) || active_extruder == 0; + const float bsDiff = planner.mm_per_step[Z_AXIS] * babystep_increment, + new_probe_offset = probe.offset.z + bsDiff, + new_offs = TERN(BABYSTEP_HOTEND_Z_OFFSET + , do_probe ? new_probe_offset : hotend_offset[active_extruder].z - bsDiff + , new_probe_offset + ); + if (WITHIN(new_offs, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { + babystep.add_steps(Z_AXIS, babystep_increment); + if (do_probe) + probe.offset.z = new_offs; + else + TERN(BABYSTEP_HOTEND_Z_OFFSET, hotend_offset[active_extruder].z = new_offs, NOOP); + drawMessage(NUL_STR); // clear the error + drawAxisValue(axis); + } + else { + 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_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_F(MSG_LCD_SOFT_ENDSTOPS)); + } + else { + drawMessage(NUL_STR); // clear the error + } drawAxisValue(axis); - } - else { - 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_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_F(MSG_LCD_SOFT_ENDSTOPS)); - } - else { - drawMessage(NUL_STR); // clear the error - } - drawAxisValue(axis); - #endif - return; - } + #endif + return; + } + #endif // HAS_Z_AXIS if (!ui.manual_move.processing) { // Get motion limit from software endstops, if any @@ -731,7 +768,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { // Delta limits XY based on the current offset from center // This assumes the center is 0,0 #if ENABLED(DELTA) - if (axis != Z_AXIS && axis != E_AXIS) { + if (axis != Z_AXIS && TERN1(HAS_EXTRUDERS, axis != E_AXIS)) { max = SQRT(sq(float(PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis])); // (Y_AXIS - axis) == the other axis min = -max; } @@ -752,35 +789,44 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { drawAxisValue(axis); } -static void e_plus() { moveAxis(E_AXIS, 1); } -static void e_minus() { moveAxis(E_AXIS, -1); } -static void x_minus() { moveAxis(X_AXIS, -1); } -static void x_plus() { moveAxis(X_AXIS, 1); } -static void y_plus() { moveAxis(Y_AXIS, 1); } -static void y_minus() { moveAxis(Y_AXIS, -1); } -static void z_plus() { moveAxis(Z_AXIS, 1); } -static void z_minus() { moveAxis(Z_AXIS, -1); } +#if HAS_EXTRUDERS + static void e_plus() { moveAxis(E_AXIS, 1); } + static void e_minus() { moveAxis(E_AXIS, -1); } +#endif +#if HAS_X_AXIS + static void x_minus() { moveAxis(X_AXIS, -1); } + static void x_plus() { moveAxis(X_AXIS, 1); } +#endif +#if HAS_Y_AXIS + static void y_plus() { moveAxis(Y_AXIS, 1); } + static void y_minus() { moveAxis(Y_AXIS, -1); } +#endif +#if HAS_Z_AXIS + static void z_plus() { moveAxis(Z_AXIS, 1); } + static void z_minus() { moveAxis(Z_AXIS, -1); } +#endif #if ENABLED(TOUCH_SCREEN) - static void e_select() { - if (++motionAxisState.e_selection >= EXTRUDERS) - motionAxisState.e_selection = 0; - - quick_feedback(); - drawCurESelection(); - drawAxisValue(E_AXIS); - } + #if HAS_EXTRUDERS + static void e_select() { + if (++motionAxisState.e_selection >= EXTRUDERS) + motionAxisState.e_selection = 0; + quick_feedback(); + drawCurESelection(); + drawAxisValue(E_AXIS); + } + #endif static void do_home() { quick_feedback(); 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()); - drawAxisValue(E_AXIS); - drawAxisValue(X_AXIS); - drawAxisValue(Y_AXIS); - drawAxisValue(Z_AXIS); + touch.disable(); + TERN_(HAS_EXTRUDERS, drawAxisValue(E_AXIS)); + TERN_(HAS_X_AXIS, drawAxisValue(X_AXIS)); + TERN_(HAS_Y_AXIS, drawAxisValue(Y_AXIS)); + TERN_(HAS_Z_AXIS, drawAxisValue(Z_AXIS)); } static void step_size() { @@ -789,7 +835,7 @@ static void z_minus() { moveAxis(Z_AXIS, -1); } quick_feedback(); drawCurStepValue(); } -#endif +#endif // TOUCH_SCREEN #if BOTH(HAS_BED_PROBE, TOUCH_SCREEN) static void z_select() { @@ -825,14 +871,14 @@ static void drawBtn(int x, int y, const char *label, intptr_t data, MarlinImage tft.add_image(0, 0, img, bgColor, COLOR_BACKGROUND, COLOR_DARKGREY); } - TERN_(HAS_TFT_XPT2046, if (enabled) touch.add_control(BUTTON, x, y, width, height, data)); + TERN_(TOUCH_SCREEN, if (enabled) touch.add_control(BUTTON, x, y, width, height, data)); } void MarlinUI::move_axis_screen() { // Reset defer_status_screen(true); motionAxisState.blocked = false; - TERN_(HAS_TFT_XPT2046, touch.enable()); + TERN_(TOUCH_SCREEN, touch.enable()); ui.clear_lcd(); @@ -842,25 +888,31 @@ void MarlinUI::move_axis_screen() { // Babysteps during printing? Select babystep for Z probe offset if (busy && ENABLED(BABYSTEP_ZPROBE_OFFSET)) - motionAxisState.z_selection = Z_SELECTION_Z_PROBE; + + TERN_(HAS_Z_AXIS, motionAxisState.z_selection = Z_SELECTION_Z_PROBE); // ROW 1 -> E- Y- CurY Z+ int x = X_MARGIN, y = Y_MARGIN, spacing = 0; - drawBtn(x, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy); + TERN_(HAS_EXTRUDERS, drawBtn(x, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy)); spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2; x += BTN_WIDTH + spacing; - drawBtn(x, y, "Y+", (intptr_t)y_plus, imgUp, Y_BTN_COLOR, !busy); + + TERN_(HAS_Y_AXIS, drawBtn(x, y, "Y+", (intptr_t)y_plus, imgUp, Y_BTN_COLOR, !busy)); // Cur Y x += BTN_WIDTH; - motionAxisState.yValuePos.x = x + 2; - motionAxisState.yValuePos.y = y; - drawAxisValue(Y_AXIS); + #if HAS_Y_AXIS + motionAxisState.yValuePos.x = x + 2; + motionAxisState.yValuePos.y = y; + drawAxisValue(Y_AXIS); + #endif x += spacing; - drawBtn(x, y, "Z+", (intptr_t)z_plus, imgUp, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step + #if HAS_Z_AXIS + drawBtn(x, y, "Z+", (intptr_t)z_plus, imgUp, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step + #endif // ROW 2 -> "Ex" X- HOME X+ "Z" y += BTN_HEIGHT + (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3; @@ -869,14 +921,16 @@ void MarlinUI::move_axis_screen() { motionAxisState.eNamePos.x = x; motionAxisState.eNamePos.y = y; - drawCurESelection(); - TERN_(HAS_TFT_XPT2046, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select)); + #if HAS_EXTRUDERS + drawCurESelection(); + TERN_(TOUCH_SCREEN, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select)); + #endif x += BTN_WIDTH + spacing; drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy); x += BTN_WIDTH + spacing; //imgHome is 64x64 - TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy)); + TERN_(TOUCH_SCREEN, add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy)); x += BTN_WIDTH + spacing; uint16_t xplus_x = x; @@ -885,7 +939,7 @@ void MarlinUI::move_axis_screen() { x += BTN_WIDTH + spacing; motionAxisState.zTypePos.x = x; motionAxisState.zTypePos.y = y; - drawCurZSelection(); + TERN_(HAS_Z_AXIS, drawCurZSelection()); #if BOTH(HAS_BED_PROBE, TOUCH_SCREEN) if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select); #endif @@ -895,28 +949,30 @@ void MarlinUI::move_axis_screen() { x = X_MARGIN; spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2; - drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy); + TERN_(HAS_EXTRUDERS, drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy)); // Cur E motionAxisState.eValuePos.x = x; motionAxisState.eValuePos.y = y + BTN_HEIGHT + 2; - drawAxisValue(E_AXIS); + TERN_(HAS_EXTRUDERS, drawAxisValue(E_AXIS)); // Cur X motionAxisState.xValuePos.x = BTN_WIDTH + (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4; //X- pos motionAxisState.xValuePos.y = y - 10; - drawAxisValue(X_AXIS); + TERN_(HAS_X_AXIS, drawAxisValue(X_AXIS)); x += BTN_WIDTH + spacing; drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy); x += BTN_WIDTH + spacing; - drawBtn(x, y, "Z-", (intptr_t)z_minus, imgDown, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step + #if HAS_Z_AXIS + drawBtn(x, y, "Z-", (intptr_t)z_minus, imgDown, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step + #endif // Cur Z motionAxisState.zValuePos.x = x; motionAxisState.zValuePos.y = y + BTN_HEIGHT + 2; - drawAxisValue(Z_AXIS); + TERN_(HAS_Z_AXIS, drawAxisValue(Z_AXIS)); // ROW 4 -> step_size disable steppers back y = TFT_HEIGHT - Y_MARGIN - 32; @@ -925,13 +981,13 @@ void MarlinUI::move_axis_screen() { motionAxisState.stepValuePos.y = y; if (!busy) { drawCurStepValue(); - TERN_(HAS_TFT_XPT2046, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size)); + TERN_(TOUCH_SCREEN, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size)); } // aligned with x+ drawBtn(xplus_x, TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT, "off", (intptr_t)disable_steppers, imgCancel, COLOR_WHITE, !busy); - TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack)); + TERN_(TOUCH_SCREEN, add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack)); } #endif // HAS_UI_480x320 From 30c3daf03165c2df9966b69ce70ed5e5a75b1fdc Mon Sep 17 00:00:00 2001 From: Giuliano Zaro <3684609+GMagician@users.noreply.github.com> Date: Sat, 13 May 2023 23:28:17 +0200 Subject: [PATCH 012/100] =?UTF-8?q?=F0=9F=94=A7=20No=20DISABLE=5FOTHER=5FE?= =?UTF-8?q?XTRUDERS=20if=20<=202=20steppers=20(#25818)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Conditionals_LCD.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 7c67916765ba4..5b643386622aa 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -681,8 +681,8 @@ #endif -// No inactive extruders with SWITCHING_NOZZLE or Průša MMU1 -#if HAS_SWITCHING_NOZZLE || HAS_PRUSA_MMU1 +// No inactive extruders with SWITCHING_NOZZLE or Průša MMU1 or just 1 E stepper exists +#if HAS_SWITCHING_NOZZLE || HAS_PRUSA_MMU1 || E_STEPPERS < 2 #undef DISABLE_OTHER_EXTRUDERS #endif From de78b60252d83bcf96435c53f1bb2a6c0593c9fd Mon Sep 17 00:00:00 2001 From: Giuliano Zaro <3684609+GMagician@users.noreply.github.com> Date: Sat, 13 May 2023 23:31:31 +0200 Subject: [PATCH 013/100] =?UTF-8?q?=F0=9F=A9=B9=20Remove=20extraneous=20MP?= =?UTF-8?q?C=20temp=20check=20(#25816)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/temperature.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 8bcaf5d83fc51..09c5ef0cdfe7e 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -1064,8 +1064,6 @@ volatile bool Temperature::raw_temps_ready = false; if (sample_count == 0) t1_time = MS_TO_SEC_PRECISE(curr_time_ms - heat_start_time_ms); temp_samples[sample_count++] = current_temp; - if (current_temp >= 200.0f) break; - next_test_time_ms += test_interval_ms * sample_distance; } From e89e67fde0d3d745d7d468e5972456f7484f9027 Mon Sep 17 00:00:00 2001 From: Giuliano Zaro <3684609+GMagician@users.noreply.github.com> Date: Sat, 13 May 2023 23:36:23 +0200 Subject: [PATCH 014/100] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Ass?= =?UTF-8?q?ume=20Auto=20Fans=20<=20HOTENDS=20(#25815)?= 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 09c5ef0cdfe7e..fa960443caf0f 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -1428,7 +1428,7 @@ int16_t Temperature::getHeaterPower(const heater_id_t heater_id) { #define AUTOFAN_CASE(N) TERN(HAS_AUTO_FAN_##N, _AUTOFAN_CASE, _AUTOFAN_NOT)(N) switch (f) { - REPEAT(8, AUTOFAN_CASE) + REPEAT(HOTENDS, AUTOFAN_CASE) #if HAS_AUTO_CHAMBER_FAN && !AUTO_CHAMBER_IS_E case CHAMBER_FAN_INDEX: _UPDATE_AUTO_FAN(CHAMBER, fan_on, CHAMBER_AUTO_FAN_SPEED); break; #endif From 40aa39828598108d519a536d6735354a500a31c6 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sun, 14 May 2023 09:43:57 +1200 Subject: [PATCH 015/100] =?UTF-8?q?=F0=9F=90=9B=20Fix=20large=20edit=20val?= =?UTF-8?q?ue=20to=20encoder=20conversion=20(#25812)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/menu/menu.cpp | 2 +- Marlin/src/lcd/menu/menu.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp index 5c4dc12d26511..911a35d482bd7 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -138,7 +138,7 @@ void MenuEditItemBase::goto_edit_screen( void * const ev, // Edit value pointer const int32_t minv, // Encoder minimum const int32_t maxv, // Encoder maximum - const uint16_t ep, // Initial encoder value + const uint32_t ep, // Initial encoder value const screenFunc_t cs, // MenuItem_type::draw_edit_screen => MenuEditItemBase::edit() const screenFunc_t cb, // Callback after edit const bool le // Flag to call cb() during editing diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index 9d824e2a4cb1e..5a70ddd3a2f92 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -168,7 +168,7 @@ class MenuEditItemBase : public MenuItemBase { void * const ev, // Edit value pointer const int32_t minv, // Encoder minimum const int32_t maxv, // Encoder maximum - const uint16_t ep, // Initial encoder value + const uint32_t ep, // Initial encoder value const screenFunc_t cs, // MenuItem_type::draw_edit_screen => MenuEditItemBase::edit() const screenFunc_t cb, // Callback after edit const bool le // Flag to call cb() during editing From 5859ff0280b51b3130e1d13740bfae79eff4d23e Mon Sep 17 00:00:00 2001 From: Vert <45634861+Vertabreak@users.noreply.github.com> Date: Sat, 13 May 2023 17:51:12 -0400 Subject: [PATCH 016/100] =?UTF-8?q?=E2=9C=A8=20NUM=5FREDUNDANT=5FFANS=20(#?= =?UTF-8?q?25808)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/Configuration_adv.h | 7 +++++-- Marlin/src/gcode/temp/M106_M107.cpp | 8 ++------ Marlin/src/inc/Conditionals_adv.h | 5 +++++ Marlin/src/inc/SanityCheck.h | 6 ++++-- Marlin/src/lcd/menu/menu_item.h | 4 ++-- Marlin/src/lcd/menu/menu_temperature.cpp | 18 +++++++++--------- Marlin/src/lcd/menu/menu_tune.cpp | 18 +++++++++--------- Marlin/src/module/temperature.cpp | 8 ++++++-- Marlin/src/module/temperature.h | 11 +++++++++++ 9 files changed, 53 insertions(+), 32 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 262e1a81ca9e6..9090eb5a61cd5 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -660,9 +660,12 @@ #endif /** - * Use one of the PWM fans as a redundant part-cooling fan + * Assign more PWM fans for part cooling, synchronized with Fan 0 */ -//#define REDUNDANT_PART_COOLING_FAN 2 // Index of the fan to sync with FAN 0. +//#define REDUNDANT_PART_COOLING_FAN 1 // Index of the first fan to synchronize with Fan 0 +#ifdef REDUNDANT_PART_COOLING_FAN + //#define NUM_REDUNDANT_FANS 1 // Number of sequential fans to synchronize with Fan 0 +#endif // @section extruder diff --git a/Marlin/src/gcode/temp/M106_M107.cpp b/Marlin/src/gcode/temp/M106_M107.cpp index 6ba64cd7ba3dd..afa2ebfc5669a 100644 --- a/Marlin/src/gcode/temp/M106_M107.cpp +++ b/Marlin/src/gcode/temp/M106_M107.cpp @@ -61,9 +61,7 @@ void GcodeSuite::M106() { const uint8_t pfan = parser.byteval('P', _ALT_P); if (pfan >= _CNT_P) return; - #if REDUNDANT_PART_COOLING_FAN - if (pfan == REDUNDANT_PART_COOLING_FAN) return; - #endif + if (FAN_IS_REDUNDANT(pfan)) return; #if ENABLED(EXTRA_FAN_SPEED) const uint16_t t = parser.intval('T'); @@ -102,9 +100,7 @@ void GcodeSuite::M106() { void GcodeSuite::M107() { const uint8_t pfan = parser.byteval('P', _ALT_P); if (pfan >= _CNT_P) return; - #if REDUNDANT_PART_COOLING_FAN - if (pfan == REDUNDANT_PART_COOLING_FAN) return; - #endif + if (FAN_IS_REDUNDANT(pfan)) return; thermalManager.set_fan_speed(pfan, 0); diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index d715b1bd12685..70644ddf0d1ba 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -1280,3 +1280,8 @@ #define MULTISTEPPING_LIMIT 128 #define MULTISTEPPING_LIMIT_WARNING 1 #endif + +// One redundant cooling fan by default +#if defined(REDUNDANT_PART_COOLING_FAN) && !defined(NUM_REDUNDANT_FANS) + #define NUM_REDUNDANT_FANS 1 +#endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 9c54208c538fd..53333d8727828 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1843,8 +1843,10 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #ifdef REDUNDANT_PART_COOLING_FAN #if FAN_COUNT < 2 #error "REDUNDANT_PART_COOLING_FAN requires a board with at least two PWM fans." - #else - static_assert(WITHIN(REDUNDANT_PART_COOLING_FAN, 1, FAN_COUNT - 1), "REDUNDANT_PART_COOLING_FAN must be between 1 and " STRINGIFY(DECREMENT(FAN_COUNT)) "."); + #elif !WITHIN(REDUNDANT_PART_COOLING_FAN, 1, FAN_COUNT - 1) + static_assert(false, "REDUNDANT_PART_COOLING_FAN must be between 1 and " STRINGIFY(DECREMENT(FAN_COUNT)) "."); + #elif !WITHIN(REDUNDANT_PART_COOLING_FAN + NUM_REDUNDANT_FANS - 1, 1, FAN_COUNT - 1) + #error "Not enough fans available for NUM_REDUNDANT_FANS." #endif #endif diff --git a/Marlin/src/lcd/menu/menu_item.h b/Marlin/src/lcd/menu/menu_item.h index 805caa1d90d86..2005be8b5411c 100644 --- a/Marlin/src/lcd/menu/menu_item.h +++ b/Marlin/src/lcd/menu/menu_item.h @@ -580,10 +580,10 @@ class MenuItem_bool : public MenuEditItemBase { }while(0) #if FAN_COUNT > 1 - #define FAN_EDIT_ITEMS(F) _FAN_EDIT_ITEMS(F,FAN_SPEED_N) + #define FAN_EDIT_ITEMS(F) _FAN_EDIT_ITEMS(F, FAN_SPEED_N) #endif - #define SNFAN(N) (ENABLED(SINGLENOZZLE_STANDBY_FAN) && !HAS_FAN##N && EXTRUDERS > N) + #define SNFAN(N) (ENABLED(SINGLENOZZLE_STANDBY_FAN) && !HAS_FAN##N && (N) < EXTRUDERS) #if SNFAN(1) || SNFAN(2) || SNFAN(3) || SNFAN(4) || SNFAN(5) || SNFAN(6) || SNFAN(7) #define DEFINE_SINGLENOZZLE_ITEM() \ diff --git a/Marlin/src/lcd/menu/menu_temperature.cpp b/Marlin/src/lcd/menu/menu_temperature.cpp index ec6d49c16f39a..c534597690765 100644 --- a/Marlin/src/lcd/menu/menu_temperature.cpp +++ b/Marlin/src/lcd/menu/menu_temperature.cpp @@ -221,40 +221,40 @@ void menu_temperature() { DEFINE_SINGLENOZZLE_ITEM(); - #if HAS_FAN0 - _FAN_EDIT_ITEMS(0,FIRST_FAN_SPEED); + #if FAN_IS_M106ABLE(0) + _FAN_EDIT_ITEMS(0, FIRST_FAN_SPEED); #endif - #if HAS_FAN1 && REDUNDANT_PART_COOLING_FAN != 1 + #if FAN_IS_M106ABLE(1) FAN_EDIT_ITEMS(1); #elif SNFAN(1) singlenozzle_item(1); #endif - #if HAS_FAN2 && REDUNDANT_PART_COOLING_FAN != 2 + #if FAN_IS_M106ABLE(2) FAN_EDIT_ITEMS(2); #elif SNFAN(2) singlenozzle_item(2); #endif - #if HAS_FAN3 && REDUNDANT_PART_COOLING_FAN != 3 + #if FAN_IS_M106ABLE(3) FAN_EDIT_ITEMS(3); #elif SNFAN(3) singlenozzle_item(3); #endif - #if HAS_FAN4 && REDUNDANT_PART_COOLING_FAN != 4 + #if FAN_IS_M106ABLE(4) FAN_EDIT_ITEMS(4); #elif SNFAN(4) singlenozzle_item(4); #endif - #if HAS_FAN5 && REDUNDANT_PART_COOLING_FAN != 5 + #if FAN_IS_M106ABLE(5) FAN_EDIT_ITEMS(5); #elif SNFAN(5) singlenozzle_item(5); #endif - #if HAS_FAN6 && REDUNDANT_PART_COOLING_FAN != 6 + #if FAN_IS_M106ABLE(6) FAN_EDIT_ITEMS(6); #elif SNFAN(6) singlenozzle_item(6); #endif - #if HAS_FAN7 && REDUNDANT_PART_COOLING_FAN != 7 + #if FAN_IS_M106ABLE(7) FAN_EDIT_ITEMS(7); #elif SNFAN(7) singlenozzle_item(7); diff --git a/Marlin/src/lcd/menu/menu_tune.cpp b/Marlin/src/lcd/menu/menu_tune.cpp index 8a2636ba5ddbb..081b9f58a02d5 100644 --- a/Marlin/src/lcd/menu/menu_tune.cpp +++ b/Marlin/src/lcd/menu/menu_tune.cpp @@ -153,40 +153,40 @@ void menu_tune() { DEFINE_SINGLENOZZLE_ITEM(); - #if HAS_FAN0 - _FAN_EDIT_ITEMS(0,FIRST_FAN_SPEED); + #if FAN_IS_M106ABLE(0) + _FAN_EDIT_ITEMS(0, FIRST_FAN_SPEED); #endif - #if HAS_FAN1 && REDUNDANT_PART_COOLING_FAN != 1 + #if FAN_IS_M106ABLE(1) FAN_EDIT_ITEMS(1); #elif SNFAN(1) singlenozzle_item(1); #endif - #if HAS_FAN2 && REDUNDANT_PART_COOLING_FAN != 2 + #if FAN_IS_M106ABLE(2) FAN_EDIT_ITEMS(2); #elif SNFAN(2) singlenozzle_item(2); #endif - #if HAS_FAN3 && REDUNDANT_PART_COOLING_FAN != 3 + #if FAN_IS_M106ABLE(3) FAN_EDIT_ITEMS(3); #elif SNFAN(3) singlenozzle_item(3); #endif - #if HAS_FAN4 && REDUNDANT_PART_COOLING_FAN != 4 + #if FAN_IS_M106ABLE(4) FAN_EDIT_ITEMS(4); #elif SNFAN(4) singlenozzle_item(4); #endif - #if HAS_FAN5 && REDUNDANT_PART_COOLING_FAN != 5 + #if FAN_IS_M106ABLE(5) FAN_EDIT_ITEMS(5); #elif SNFAN(5) singlenozzle_item(5); #endif - #if HAS_FAN6 && REDUNDANT_PART_COOLING_FAN != 6 + #if FAN_IS_M106ABLE(6) FAN_EDIT_ITEMS(6); #elif SNFAN(6) singlenozzle_item(6); #endif - #if HAS_FAN7 && REDUNDANT_PART_COOLING_FAN != 7 + #if FAN_IS_M106ABLE(7) FAN_EDIT_ITEMS(7); #elif SNFAN(7) singlenozzle_item(7); diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index fa960443caf0f..d84b475765f2f 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -467,8 +467,12 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED); if (fan >= FAN_COUNT) return; fan_speed[fan] = speed; - #if REDUNDANT_PART_COOLING_FAN - if (fan == 0) fan_speed[REDUNDANT_PART_COOLING_FAN] = speed; + + #if NUM_REDUNDANT_FANS + if (fan == 0) { + for (uint8_t f = REDUNDANT_PART_COOLING_FAN; f < REDUNDANT_PART_COOLING_FAN + NUM_REDUNDANT_FANS; ++f) + thermalManager.set_fan_speed(f, 0); + } #endif TERN_(REPORT_FAN_CHANGE, report_fan_speed(fan)); diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index 4bd185c4251be..c4dae4c6e5a73 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -44,6 +44,17 @@ #define HOTEND_INDEX TERN(HAS_MULTI_HOTEND, e, 0) #define E_NAME TERN_(HAS_MULTI_HOTEND, e) +#if HAS_FAN + #if NUM_REDUNDANT_FANS + #define FAN_IS_REDUNDANT(Q) WITHIN(Q, REDUNDANT_PART_COOLING_FAN, REDUNDANT_PART_COOLING_FAN + NUM_REDUNDANT_FANS - 1) + #else + #define FAN_IS_REDUNDANT(Q) false + #endif + #define FAN_IS_M106ABLE(Q) (HAS_FAN##Q && !FAN_IS_REDUNDANT(Q)) +#else + #define FAN_IS_M106ABLE(Q) false +#endif + // Element identifiers. Positive values are hotends. Negative values are other heaters or coolers. typedef enum : int_fast8_t { H_REDUNDANT = HID_REDUNDANT, From 4e1bfc4e0de1cbb09cdca0c2d72d92381688e108 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 23 Apr 2022 09:31:38 -0500 Subject: [PATCH 017/100] =?UTF-8?q?=F0=9F=8E=A8=20Misc.=20tweaks=20to=20HA?= =?UTF-8?q?Ls?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/AVR/pinsDebug.h | 72 ++++++++++------------ Marlin/src/HAL/AVR/pinsDebug_Teensyduino.h | 9 +-- Marlin/src/HAL/DUE/pinsDebug.h | 3 +- Marlin/src/HAL/LINUX/HAL.cpp | 3 +- Marlin/src/HAL/LINUX/pinsDebug.h | 31 +++++----- Marlin/src/HAL/LPC1768/pinsDebug.h | 9 +-- Marlin/src/HAL/NATIVE_SIM/pinsDebug.h | 30 ++++----- Marlin/src/HAL/STM32/pinsDebug.h | 3 +- Marlin/src/HAL/STM32F1/pinsDebug.h | 26 ++++---- Marlin/src/HAL/TEENSY35_36/pinsDebug.h | 8 +-- Marlin/src/HAL/TEENSY40_41/pinsDebug.h | 18 +++--- Marlin/src/pins/pinsDebug.h | 4 +- buildroot/tests/at90usb1286_cdc | 2 +- buildroot/tests/at90usb1286_dfu | 2 +- 14 files changed, 101 insertions(+), 119 deletions(-) diff --git a/Marlin/src/HAL/AVR/pinsDebug.h b/Marlin/src/HAL/AVR/pinsDebug.h index 3fe877cd0083e..accd3c663f71b 100644 --- a/Marlin/src/HAL/AVR/pinsDebug.h +++ b/Marlin/src/HAL/AVR/pinsDebug.h @@ -109,7 +109,7 @@ void PRINT_ARRAY_NAME(uint8_t x) { * Print a pin's PWM status. * Return true if it's currently a PWM pin. */ -static bool pwm_status(uint8_t pin) { +bool pwm_status(uint8_t pin) { char buffer[20]; // for the sprintf statements switch (digitalPinToTimer_DEBUG(pin)) { @@ -232,12 +232,12 @@ const volatile uint8_t* const PWM_OCR[][3] PROGMEM = { #define OCR_VAL(T, L) pgm_read_word(&PWM_OCR[T][L]) -static void err_is_counter() { SERIAL_ECHOPGM(" non-standard PWM mode"); } -static void err_is_interrupt() { SERIAL_ECHOPGM(" compare interrupt enabled"); } -static void err_prob_interrupt() { SERIAL_ECHOPGM(" overflow interrupt enabled"); } -static void print_is_also_tied() { SERIAL_ECHOPGM(" is also tied to this pin"); SERIAL_ECHO_SP(14); } +void err_is_counter() { SERIAL_ECHOPGM(" non-standard PWM mode"); } +void err_is_interrupt() { SERIAL_ECHOPGM(" compare interrupt enabled"); } +void err_prob_interrupt() { SERIAL_ECHOPGM(" overflow interrupt enabled"); } +void print_is_also_tied() { SERIAL_ECHOPGM(" is also tied to this pin"); SERIAL_ECHO_SP(14); } -inline void com_print(const uint8_t N, const uint8_t Z) { +void com_print(const uint8_t N, const uint8_t Z) { const uint8_t *TCCRA = (uint8_t*)TCCR_A(N); SERIAL_ECHOPGM(" COM", AS_DIGIT(N)); SERIAL_CHAR(Z); @@ -279,7 +279,7 @@ void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm N - if (TEST(*TMSK, TOIE)) err_prob_interrupt(); } -static void pwm_details(uint8_t pin) { +void pwm_details(uint8_t pin) { switch (digitalPinToTimer_DEBUG(pin)) { #if ABTEST(0) @@ -353,47 +353,41 @@ static void pwm_details(uint8_t pin) { } // pwm_details #ifndef digitalRead_mod // Use Teensyduino's version of digitalRead - it doesn't disable the PWMs - int digitalRead_mod(const int8_t pin) { // same as digitalRead except the PWM stop section has been removed + int digitalRead_mod(const pin_t pin) { // same as digitalRead except the PWM stop section has been removed const uint8_t port = digitalPinToPort_DEBUG(pin); return (port != NOT_A_PIN) && (*portInputRegister(port) & digitalPinToBitMask_DEBUG(pin)) ? HIGH : LOW; } #endif -#ifndef PRINT_PORT - - void print_port(int8_t pin) { // print port number - #ifdef digitalPinToPort_DEBUG - uint8_t x; - SERIAL_ECHOPGM(" Port: "); - #if AVR_AT90USB1286_FAMILY - x = (pin == 46 || pin == 47) ? 'E' : digitalPinToPort_DEBUG(pin) + 64; - #else - x = digitalPinToPort_DEBUG(pin) + 64; - #endif - SERIAL_CHAR(x); - - #if AVR_AT90USB1286_FAMILY - if (pin == 46) - x = '2'; - else if (pin == 47) - x = '3'; - else { - uint8_t temp = digitalPinToBitMask_DEBUG(pin); - for (x = '0'; x < '9' && temp != 1; x++) temp >>= 1; - } - #else +void print_port(const pin_t pin) { // print port number + #ifdef digitalPinToPort_DEBUG + uint8_t x; + SERIAL_ECHOPGM(" Port: "); + #if AVR_AT90USB1286_FAMILY + x = (pin == 46 || pin == 47) ? 'E' : digitalPinToPort_DEBUG(pin) + 64; + #else + x = digitalPinToPort_DEBUG(pin) + 64; + #endif + SERIAL_CHAR(x); + + #if AVR_AT90USB1286_FAMILY + if (pin == 46) + x = '2'; + else if (pin == 47) + x = '3'; + else { uint8_t temp = digitalPinToBitMask_DEBUG(pin); for (x = '0'; x < '9' && temp != 1; x++) temp >>= 1; - #endif - SERIAL_CHAR(x); + } #else - SERIAL_ECHO_SP(10); + uint8_t temp = digitalPinToBitMask_DEBUG(pin); + for (x = '0'; x < '9' && temp != 1; x++) temp >>= 1; #endif - } - - #define PRINT_PORT(p) print_port(p) - -#endif + SERIAL_CHAR(x); + #else + SERIAL_ECHO_SP(10); + #endif +} #define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0) #define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0) diff --git a/Marlin/src/HAL/AVR/pinsDebug_Teensyduino.h b/Marlin/src/HAL/AVR/pinsDebug_Teensyduino.h index 582ae79ba7872..c812d4fb1131b 100644 --- a/Marlin/src/HAL/AVR/pinsDebug_Teensyduino.h +++ b/Marlin/src/HAL/AVR/pinsDebug_Teensyduino.h @@ -22,11 +22,10 @@ #pragma once // -// some of the pin mapping functions of the Teensduino extension to the Arduino IDE -// do not function the same as the other Arduino extensions +// Some of the pin mapping functions of the Arduino IDE Teensduino extension +// function differently from other Arduino extensions. // - #define TEENSYDUINO_IDE //digitalPinToTimer(pin) function works like Arduino but Timers are not defined @@ -48,8 +47,6 @@ #define PE 5 #define PF 6 -#undef digitalPinToPort - const uint8_t PROGMEM digital_pin_to_port_PGM[] = { PD, // 0 - PD0 - INT0 - PWM PD, // 1 - PD1 - INT1 - PWM @@ -101,7 +98,7 @@ const uint8_t PROGMEM digital_pin_to_port_PGM[] = { PE, // 47 - PE3 (not defined in teensyduino) }; -#define digitalPinToPort(P) ( pgm_read_byte( digital_pin_to_port_PGM + (P) ) ) +#define digitalPinToPort(P) pgm_read_byte(digital_pin_to_port_PGM[P]) // digitalPinToBitMask(pin) is OK diff --git a/Marlin/src/HAL/DUE/pinsDebug.h b/Marlin/src/HAL/DUE/pinsDebug.h index 2aafe9be0c56f..1544853553f05 100644 --- a/Marlin/src/HAL/DUE/pinsDebug.h +++ b/Marlin/src/HAL/DUE/pinsDebug.h @@ -64,7 +64,6 @@ #define NUMBER_PINS_TOTAL PINS_COUNT #define digitalRead_mod(p) extDigitalRead(p) // AVR digitalRead disabled PWM before it read the pin -#define PRINT_PORT(p) #define PRINT_ARRAY_NAME(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0) #define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%02d"), p); SERIAL_ECHO(buffer); }while(0) #define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0) @@ -93,6 +92,8 @@ void pwm_details(int32_t pin) { } } +void print_port(const pin_t) {} + /** * DUE Board pin | PORT | Label * ----------------+--------+------- diff --git a/Marlin/src/HAL/LINUX/HAL.cpp b/Marlin/src/HAL/LINUX/HAL.cpp index db43f42eaafd3..6a767c76e7b71 100644 --- a/Marlin/src/HAL/LINUX/HAL.cpp +++ b/Marlin/src/HAL/LINUX/HAL.cpp @@ -52,8 +52,7 @@ uint8_t MarlinHAL::active_ch = 0; uint16_t MarlinHAL::adc_value() { const pin_t pin = analogInputToDigitalPin(active_ch); if (!VALID_PIN(pin)) return 0; - const uint16_t data = ((Gpio::get(pin) >> 2) & 0x3FF); - return data; // return 10bit value as Marlin expects + return uint16_t((Gpio::get(pin) >> 2) & 0x3FF); // return 10bit value as Marlin expects } void MarlinHAL::reboot() { /* Reset the application state and GPIO */ } diff --git a/Marlin/src/HAL/LINUX/pinsDebug.h b/Marlin/src/HAL/LINUX/pinsDebug.h index 7bfd97d024f73..e4ee27e8dd012 100644 --- a/Marlin/src/HAL/LINUX/pinsDebug.h +++ b/Marlin/src/HAL/LINUX/pinsDebug.h @@ -28,36 +28,33 @@ * Translation of routines & variables used by pinsDebug.h */ -#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS -#define pwm_details(pin) NOOP // (do nothing) -#define pwm_status(pin) false // Print a pin's PWM status. Return true if it's currently a PWM pin. +#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS #define IS_ANALOG(P) (DIGITAL_PIN_TO_ANALOG_PIN(P) >= 0 ? 1 : 0) #define digitalRead_mod(p) digitalRead(p) -#define PRINT_PORT(p) #define GET_ARRAY_PIN(p) pin_array[p].pin #define PRINT_ARRAY_NAME(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0) #define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0) #define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0) -#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin +#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin // active ADC function/mode/code values for PINSEL registers -constexpr int8_t ADC_pin_mode(pin_t pin) { - return (-1); -} +constexpr int8_t ADC_pin_mode(pin_t pin) { return -1; } -int8_t get_pin_mode(pin_t pin) { - if (!VALID_PIN(pin)) return -1; - return 0; -} +int8_t get_pin_mode(const pin_t pin) { return VALID_PIN(pin) ? 0 : -1; } -bool GET_PINMODE(pin_t pin) { - int8_t pin_mode = get_pin_mode(pin); - if (pin_mode == -1 || pin_mode == ADC_pin_mode(pin)) // found an invalid pin or active analog pin +bool GET_PINMODE(const pin_t pin) { + const int8_t pin_mode = get_pin_mode(pin); + if (pin_mode == -1 || pin_mode == ADC_pin_mode(pin)) // Invalid pin or active analog pin return false; - return (Gpio::getMode(pin) != 0); //input/output state + return (Gpio::getMode(pin) != 0); // Input/output state } -bool GET_ARRAY_IS_DIGITAL(pin_t pin) { +bool GET_ARRAY_IS_DIGITAL(const pin_t pin) { return (!IS_ANALOG(pin) || get_pin_mode(pin) != ADC_pin_mode(pin)); } + +void pwm_details(const pin_t pin) {} +bool pwm_status(const pin_t) { return false; } + +void print_port(const pin_t) {} diff --git a/Marlin/src/HAL/LPC1768/pinsDebug.h b/Marlin/src/HAL/LPC1768/pinsDebug.h index a2f5c123a260a..975511be9a94b 100644 --- a/Marlin/src/HAL/LPC1768/pinsDebug.h +++ b/Marlin/src/HAL/LPC1768/pinsDebug.h @@ -29,11 +29,8 @@ */ #define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS -#define pwm_details(pin) pin = pin // do nothing // print PWM details -#define pwm_status(pin) false //Print a pin's PWM status. Return true if it's currently a PWM pin. #define IS_ANALOG(P) (DIGITAL_PIN_TO_ANALOG_PIN(P) >= 0 ? 1 : 0) #define digitalRead_mod(p) extDigitalRead(p) -#define PRINT_PORT(p) #define GET_ARRAY_PIN(p) pin_array[p].pin #define PRINT_ARRAY_NAME(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0) #define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("P%d_%02d"), LPC176x::pin_port(p), LPC176x::pin_bit(p)); SERIAL_ECHO(buffer); }while(0) @@ -46,10 +43,14 @@ #endif bool GET_PINMODE(const pin_t pin) { - if (!LPC176x::pin_is_valid(pin) || LPC176x::pin_adc_enabled(pin)) // found an invalid pin or active analog pin + if (!LPC176x::pin_is_valid(pin) || LPC176x::pin_adc_enabled(pin)) // Invalid pin or active analog pin return false; return LPC176x::gpio_direction(pin); } #define GET_ARRAY_IS_DIGITAL(x) ((bool) pin_array[x].is_digital) + +void print_port(const pin_t) {} +void pwm_details(const pin_t) {} +bool pwm_status(const pin_t) { return false; } diff --git a/Marlin/src/HAL/NATIVE_SIM/pinsDebug.h b/Marlin/src/HAL/NATIVE_SIM/pinsDebug.h index aa90eb39a3305..eeb8245641b40 100644 --- a/Marlin/src/HAL/NATIVE_SIM/pinsDebug.h +++ b/Marlin/src/HAL/NATIVE_SIM/pinsDebug.h @@ -27,35 +27,31 @@ */ #define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS -#define pwm_details(pin) pin = pin // do nothing // print PWM details -#define pwm_status(pin) false //Print a pin's PWM status. Return true if it's currently a PWM pin. #define IS_ANALOG(P) (DIGITAL_PIN_TO_ANALOG_PIN(P) >= 0 ? 1 : 0) #define digitalRead_mod(p) digitalRead(p) -#define PRINT_PORT(p) #define GET_ARRAY_PIN(p) pin_array[p].pin #define PRINT_ARRAY_NAME(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0) #define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0) #define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0) #define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin -// active ADC function/mode/code values for PINSEL registers -inline constexpr int8_t ADC_pin_mode(pin_t pin) { - return (-1); -} +// Active ADC function/mode/code values for PINSEL registers +constexpr int8_t ADC_pin_mode(pin_t pin) { return -1; } -inline int8_t get_pin_mode(pin_t pin) { - if (!VALID_PIN(pin)) return -1; - return 0; -} +int8_t get_pin_mode(const pin_t pin) { return VALID_PIN(pin) 0 : -1; } -inline bool GET_PINMODE(pin_t pin) { - int8_t pin_mode = get_pin_mode(pin); - if (pin_mode == -1 || pin_mode == ADC_pin_mode(pin)) // found an invalid pin or active analog pin +bool GET_PINMODE(const pin_t pin) { + const int8_t pin_mode = get_pin_mode(pin); + if (pin_mode == -1 || pin_mode == ADC_pin_mode(pin)) // Invalid pin or active analog pin return false; - return (Gpio::getMode(pin) != 0); //input/output state + return (Gpio::getMode(pin) != 0); // Input/output state } -inline bool GET_ARRAY_IS_DIGITAL(pin_t pin) { - return (!IS_ANALOG(pin) || get_pin_mode(pin) != ADC_pin_mode(pin)); +bool GET_ARRAY_IS_DIGITAL(const pin_t pin) { + return !IS_ANALOG(pin) || get_pin_mode(pin) != ADC_pin_mode(pin); } + +void print_port(const pin_t) {} +void pwm_details(const pin_t) {} +bool pwm_status(const pin_t) { return false; } diff --git a/Marlin/src/HAL/STM32/pinsDebug.h b/Marlin/src/HAL/STM32/pinsDebug.h index b12d621e98893..13990a69f5ef7 100644 --- a/Marlin/src/HAL/STM32/pinsDebug.h +++ b/Marlin/src/HAL/STM32/pinsDebug.h @@ -119,7 +119,6 @@ const XrefInfo pin_xref[] PROGMEM = { #define digitalRead_mod(Ard_num) extDigitalRead(Ard_num) // must use Arduino pin numbers when doing reads #define PRINT_PIN(Q) #define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0) -#define PRINT_PORT(ANUM) port_print(ANUM) #define DIGITAL_PIN_TO_ANALOG_PIN(ANUM) -1 // will report analog pin number in the print port routine // x is a variable used to search pin_array @@ -187,7 +186,7 @@ bool is_digital(const pin_t Ard_num) { return pin_mode == MODE_PIN_INPUT || pin_mode == MODE_PIN_OUTPUT; } -void port_print(const pin_t Ard_num) { +void print_port(const pin_t Ard_num) { char buffer[16]; pin_t Index; for (Index = 0; Index < NUMBER_PINS_TOTAL; Index++) diff --git a/Marlin/src/HAL/STM32F1/pinsDebug.h b/Marlin/src/HAL/STM32F1/pinsDebug.h index 7828479658a9e..2142f0ebac62b 100644 --- a/Marlin/src/HAL/STM32F1/pinsDebug.h +++ b/Marlin/src/HAL/STM32F1/pinsDebug.h @@ -41,11 +41,9 @@ extern const stm32_pin_info PIN_MAP[BOARD_NR_GPIO_PINS]; #define NUMBER_PINS_TOTAL BOARD_NR_GPIO_PINS #define VALID_PIN(pin) (pin >= 0 && pin < BOARD_NR_GPIO_PINS) #define GET_ARRAY_PIN(p) pin_t(pin_array[p].pin) -#define pwm_status(pin) PWM_PIN(pin) #define digitalRead_mod(p) extDigitalRead(p) #define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%3hd "), int16_t(p)); SERIAL_ECHO(buffer); }while(0) #define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0) -#define PRINT_PORT(p) print_port(p) #define PRINT_ARRAY_NAME(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0) #define MULTI_NAME_PAD 21 // space needed to be pretty if not first name assigned to a pin @@ -54,20 +52,18 @@ extern const stm32_pin_info PIN_MAP[BOARD_NR_GPIO_PINS]; #define M43_NEVER_TOUCH(Q) (Q >= 9 && Q <= 12) // SERIAL/USB pins PA9(TX) PA10(RX) #endif -static int8_t get_pin_mode(pin_t pin) { - return VALID_PIN(pin) ? _GET_MODE(pin) : -1; -} +int8_t get_pin_mode(const pin_t pin) { return VALID_PIN(pin) ? _GET_MODE(pin) : -1; } -static pin_t DIGITAL_PIN_TO_ANALOG_PIN(pin_t pin) { +pin_t DIGITAL_PIN_TO_ANALOG_PIN(const pin_t pin) { if (!VALID_PIN(pin)) return -1; - int8_t adc_channel = int8_t(PIN_MAP[pin].adc_channel); + pin_t adc_channel = pin_t(PIN_MAP[pin].adc_channel); #ifdef NUM_ANALOG_INPUTS - if (adc_channel >= NUM_ANALOG_INPUTS) adc_channel = ADCx; + if (adc_channel >= NUM_ANALOG_INPUTS) adc_channel = (pin_t)ADCx; #endif - return pin_t(adc_channel); + return adc_channel; } -static bool IS_ANALOG(pin_t pin) { +bool IS_ANALOG(const pin_t pin) { if (!VALID_PIN(pin)) return false; if (PIN_MAP[pin].adc_channel != ADCx) { #ifdef NUM_ANALOG_INPUTS @@ -78,11 +74,11 @@ static bool IS_ANALOG(pin_t pin) { return false; } -static bool GET_PINMODE(const pin_t pin) { +bool GET_PINMODE(const pin_t pin) { return VALID_PIN(pin) && !IS_INPUT(pin); } -static bool GET_ARRAY_IS_DIGITAL(const int16_t array_pin) { +bool GET_ARRAY_IS_DIGITAL(const int16_t array_pin) { const pin_t pin = GET_ARRAY_PIN(array_pin); return (!IS_ANALOG(pin) #ifdef NUM_ANALOG_INPUTS @@ -93,7 +89,7 @@ static bool GET_ARRAY_IS_DIGITAL(const int16_t array_pin) { #include "../../inc/MarlinConfig.h" // Allow pins/pins.h to set density -static void pwm_details(const pin_t pin) { +void pwm_details(const pin_t pin) { if (PWM_PIN(pin)) { timer_dev * const tdev = PIN_MAP[pin].timer_device; const uint8_t channel = PIN_MAP[pin].timer_channel; @@ -113,7 +109,9 @@ static void pwm_details(const pin_t pin) { } } -static void print_port(pin_t pin) { +bool pwm_status(const pin_t pin) { return PWM_PIN(pin); } + +void print_port(const pin_t pin) { const char port = 'A' + char(pin >> 4); // pin div 16 const int16_t gbit = PIN_MAP[pin].gpio_bit; char buffer[8]; diff --git a/Marlin/src/HAL/TEENSY35_36/pinsDebug.h b/Marlin/src/HAL/TEENSY35_36/pinsDebug.h index 235c0e4a4871a..8526febf10e33 100644 --- a/Marlin/src/HAL/TEENSY35_36/pinsDebug.h +++ b/Marlin/src/HAL/TEENSY35_36/pinsDebug.h @@ -55,12 +55,12 @@ #define IS_ANALOG(P) ((P) >= analogInputToDigitalPin(0) && (P) <= analogInputToDigitalPin(9)) || ((P) >= analogInputToDigitalPin(12) && (P) <= analogInputToDigitalPin(20)) -void HAL_print_analog_pin(char buffer[], int8_t pin) { +void print_analog_pin(char buffer[], int8_t pin) { if (pin <= 23) sprintf_P(buffer, PSTR("(A%2d) "), int(pin - 14)); else if (pin <= 39) sprintf_P(buffer, PSTR("(A%2d) "), int(pin - 19)); } -void HAL_analog_pin_state(char buffer[], int8_t pin) { +void analog_pin_state(char buffer[], int8_t pin) { if (pin <= 23) sprintf_P(buffer, PSTR("Analog in =% 5d"), analogRead(pin - 14)); else if (pin <= 39) sprintf_P(buffer, PSTR("Analog in =% 5d"), analogRead(pin - 19)); } @@ -77,7 +77,7 @@ void HAL_analog_pin_state(char buffer[], int8_t pin) { * Print a pin's PWM status. * Return true if it's currently a PWM pin. */ -bool HAL_pwm_status(const int8_t pin) { +bool pwm_status(int8_t pin) { char buffer[20]; // for the sprintf statements switch (pin) { FTM_CASE(0,0); @@ -108,4 +108,4 @@ bool HAL_pwm_status(const int8_t pin) { SERIAL_ECHOPGM(" "); } -static void HAL_pwm_details(uint8_t pin) { /* TODO */ } +void pwm_details(uint8_t pin) { /* TODO */ } diff --git a/Marlin/src/HAL/TEENSY40_41/pinsDebug.h b/Marlin/src/HAL/TEENSY40_41/pinsDebug.h index c85a88c9ae676..54f3cb5885a3b 100644 --- a/Marlin/src/HAL/TEENSY40_41/pinsDebug.h +++ b/Marlin/src/HAL/TEENSY40_41/pinsDebug.h @@ -30,7 +30,6 @@ #define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS #define digitalRead_mod(p) extDigitalRead(p) // AVR digitalRead disabled PWM before it read the pin -#define PRINT_PORT(p) #define PRINT_ARRAY_NAME(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0) #define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%02d"), p); SERIAL_ECHO(buffer); }while(0) #define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0) @@ -39,7 +38,6 @@ #define VALID_PIN(pin) (pin >= 0 && pin < int8_t(NUMBER_PINS_TOTAL)) #define DIGITAL_PIN_TO_ANALOG_PIN(p) int(p - analogInputToDigitalPin(0)) #define IS_ANALOG(P) ((P) >= analogInputToDigitalPin(0) && (P) <= analogInputToDigitalPin(13)) || ((P) >= analogInputToDigitalPin(14) && (P) <= analogInputToDigitalPin(17)) -#define pwm_status(pin) HAL_pwm_status(pin) #define GET_PINMODE(PIN) (VALID_PIN(pin) && IS_OUTPUT(pin)) #define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin @@ -120,12 +118,12 @@ const struct pwm_pin_info_struct pwm_pin_info[] = { #endif }; -void HAL_print_analog_pin(char buffer[], int8_t pin) { +void print_analog_pin(char buffer[], const pin_t pin) { if (pin <= 23) sprintf_P(buffer, PSTR("(A%2d) "), int(pin - 14)); else if (pin <= 41) sprintf_P(buffer, PSTR("(A%2d) "), int(pin - 24)); } -void HAL_analog_pin_state(char buffer[], int8_t pin) { +void analog_pin_state(char buffer[], const pin_t pin) { if (pin <= 23) sprintf_P(buffer, PSTR("Analog in =% 5d"), analogRead(pin - 14)); else if (pin <= 41) sprintf_P(buffer, PSTR("Analog in =% 5d"), analogRead(pin - 24)); } @@ -136,14 +134,14 @@ void HAL_analog_pin_state(char buffer[], int8_t pin) { * Print a pin's PWM status. * Return true if it's currently a PWM pin. */ -bool HAL_pwm_status(const int8_t pin) { +bool pwm_status(const pin_t pin) { char buffer[20]; // for the sprintf statements const struct pwm_pin_info_struct *info; - if (pin >= CORE_NUM_DIGITAL) return 0; - info = pwm_pin_info + pin; + if (pin >= CORE_NUM_DIGITAL) return false; - if (info->type == 0) return 0; + info = pwm_pin_info + pin; + if (info->type == 0) return false; /* TODO decode pwm value from timers */ // for now just indicate if output is set as pwm @@ -151,4 +149,6 @@ bool HAL_pwm_status(const int8_t pin) { return (*(portConfigRegister(pin)) == info->muxval); } -static void pwm_details(uint8_t pin) { /* TODO */ } +void pwm_details(const pin_t) { /* TODO */ } + +void print_port(const pin_t) {} diff --git a/Marlin/src/pins/pinsDebug.h b/Marlin/src/pins/pinsDebug.h index 25b883eee67ca..4a8928c1e561a 100644 --- a/Marlin/src/pins/pinsDebug.h +++ b/Marlin/src/pins/pinsDebug.h @@ -206,7 +206,7 @@ inline void report_pin_state_extended(pin_t pin, const bool ignore, const bool e if (start_string) SERIAL_ECHOF(start_string); SERIAL_ECHOPGM("PIN: "); PRINT_PIN(pin); - PRINT_PORT(pin); + print_port(pin); if (int8_t(DIGITAL_PIN_TO_ANALOG_PIN(pin)) >= 0) PRINT_PIN_ANALOG(pin); // analog pin number else SERIAL_ECHO_SP(8); // add padding if not an analog pin } @@ -254,7 +254,7 @@ inline void report_pin_state_extended(pin_t pin, const bool ignore, const bool e if (start_string) SERIAL_ECHOF(start_string); SERIAL_ECHOPGM("PIN: "); PRINT_PIN(pin); - PRINT_PORT(pin); + print_port(pin); if (int8_t(DIGITAL_PIN_TO_ANALOG_PIN(pin)) >= 0) PRINT_PIN_ANALOG(pin); // analog pin number else SERIAL_ECHO_SP(8); // add padding if not an analog pin SERIAL_ECHOPGM(""); diff --git a/buildroot/tests/at90usb1286_cdc b/buildroot/tests/at90usb1286_cdc index 01d752db8b4c4..7dcf8d541ab5a 100755 --- a/buildroot/tests/at90usb1286_cdc +++ b/buildroot/tests/at90usb1286_cdc @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# Build tests for AT90USB1286 ARMED +# Build tests for AT90USB1286 (CDC) # # exit on first failure diff --git a/buildroot/tests/at90usb1286_dfu b/buildroot/tests/at90usb1286_dfu index 75672a6a51507..a753097694c43 100755 --- a/buildroot/tests/at90usb1286_dfu +++ b/buildroot/tests/at90usb1286_dfu @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# Build tests for AT90USB1286 ARMED +# Build tests for AT90USB1286 (DFU) # # exit on first failure From f97a813a2ac315cd925c3651bd7c32d609e6d70f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 13 May 2023 18:09:48 -0500 Subject: [PATCH 018/100] =?UTF-8?q?=E2=9C=A8=20NUM=5FREDUNDANT=5FFANS=20to?= =?UTF-8?q?o?= 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 d84b475765f2f..685f5dab2f59c 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -471,7 +471,7 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED); #if NUM_REDUNDANT_FANS if (fan == 0) { for (uint8_t f = REDUNDANT_PART_COOLING_FAN; f < REDUNDANT_PART_COOLING_FAN + NUM_REDUNDANT_FANS; ++f) - thermalManager.set_fan_speed(f, 0); + thermalManager.set_fan_speed(f, speed); } #endif From 4a2db0f7060bc95151eb8512266adaa013c57782 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 2 May 2023 18:15:23 -0500 Subject: [PATCH 019/100] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20ftd?= =?UTF-8?q?i=5Flanguage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/lcd/extui/ftdi_eve_touch_ui/generic/language_menu.cpp | 2 +- Marlin/src/lcd/extui/ftdi_eve_touch_ui/language/language.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/language_menu.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/language_menu.cpp index 499f741540ab2..5d797f44df311 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/language_menu.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/language_menu.cpp @@ -56,7 +56,7 @@ void LanguageMenu::onRedraw(draw_mode_t) { bool LanguageMenu::onTouchEnd(uint8_t tag) { if (tag > 0 && tag <= NUM_LANGUAGES) { - lang = tag - 1; + ftdi_language = tag - 1; GOTO_SCREEN(StatusScreen); return true; } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/language/language.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/language/language.cpp index bf684e43f9176..9ff738e45c19e 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/language/language.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/language/language.cpp @@ -23,5 +23,5 @@ #include "../../../../MarlinCore.h" #if ENABLED(TOUCH_UI_FTDI_EVE) #include "language.h" - uint8_t lang = 0; + uint8_t ftdi_language = 0; #endif From 18e63ad880cefc210e4a92657bef389ebef67d49 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sun, 14 May 2023 00:39:01 +0000 Subject: [PATCH 020/100] [cron] Bump distribution date (2023-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 f2258b55e74f4..64e5a6a99d3e3 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 "2023-05-13" +//#define STRING_DISTRIBUTION_DATE "2023-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 3f3032fe33d2c..bcddf2dbd121e 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 "2023-05-13" + #define STRING_DISTRIBUTION_DATE "2023-05-14" #endif /** From 5201869a55ae838a24afe7b05cc028e1b4fdd532 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 2 May 2023 18:26:06 -0500 Subject: [PATCH 021/100] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20IA?= =?UTF-8?q?=20RTS=20refactor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lcd/extui/ia_creality/FileNavigator.cpp | 26 +- .../lcd/extui/ia_creality/creality_extui.cpp | 2094 ----------------- .../extui/ia_creality/ia_creality_extui.cpp | 2094 +++++++++++++++++ .../lcd/extui/ia_creality/ia_creality_extui.h | 214 +- 4 files changed, 2210 insertions(+), 2218 deletions(-) delete mode 100644 Marlin/src/lcd/extui/ia_creality/creality_extui.cpp create mode 100644 Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp diff --git a/Marlin/src/lcd/extui/ia_creality/FileNavigator.cpp b/Marlin/src/lcd/extui/ia_creality/FileNavigator.cpp index 4e2d294a9b259..6aa9b7c7c8885 100644 --- a/Marlin/src/lcd/extui/ia_creality/FileNavigator.cpp +++ b/Marlin/src/lcd/extui/ia_creality/FileNavigator.cpp @@ -95,23 +95,23 @@ void FileNavigator::getFiles(uint16_t index) { // Clear currently drawn screen for (int i = 0; i < DISPLAY_FILES; i++) { for (int j = 0; j < 20; j++) - rtscheck.RTS_SndData(0, SDFILE_ADDR + (i * 20) + j); + rts.sendData(0, SDFILE_ADDR + (i * 20) + j); } for (int j = 0; j < 10; j++) { - rtscheck.RTS_SndData(0, Printfilename + j); // clear screen. - rtscheck.RTS_SndData(0, Choosefilename + j); // clear filename + rts.sendData(0, Printfilename + j); // clear screen. + rts.sendData(0, Choosefilename + j); // clear filename } for (int j = 0; j < 8; j++) - rtscheck.RTS_SndData(0, FilenameCount + j); + rts.sendData(0, FilenameCount + j); for (int j = 1; j <= DISPLAY_FILES; j++) { - rtscheck.RTS_SndData(10, FilenameIcon + j); - rtscheck.RTS_SndData(10, FilenameIcon1 + j); + rts.sendData(10, FilenameIcon + j); + rts.sendData(10, FilenameIcon1 + j); } if (currentindex == 0 && folderdepth > 0) { // Add a link to go up a folder files--; - rtscheck.RTS_SndData("Up Directory", SDFILE_ADDR); + rts.sendData("Up Directory", SDFILE_ADDR); fcnt++; } else if (currentindex == DISPLAY_FILES && folderdepth > 0) @@ -123,18 +123,18 @@ void FileNavigator::getFiles(uint16_t index) { if (filelen > 20) { char *buf = (char *)filelist.filename(); buf[18] = '\0'; // cutoff at screen edge - rtscheck.RTS_SndData(buf, (SDFILE_ADDR + (fcnt * 20))); + rts.sendData(buf, (SDFILE_ADDR + (fcnt * 20))); } else - rtscheck.RTS_SndData(filelist.filename(), (SDFILE_ADDR + (fcnt * 20))); + rts.sendData(filelist.filename(), (SDFILE_ADDR + (fcnt * 20))); if (filelist.isDir()) { - rtscheck.RTS_SndData((uint8_t)4, FilenameIcon + (fcnt+1)); - rtscheck.RTS_SndData((unsigned long)0x041F, (FilenameNature + ((1+fcnt) * 16))); // Change BG of selected line to Blue + rts.sendData((uint8_t)4, FilenameIcon + (fcnt+1)); + rts.sendData((unsigned long)0x041F, (FilenameNature + ((1+fcnt) * 16))); // Change BG of selected line to Blue } else { - rtscheck.RTS_SndData((uint8_t)0, FilenameIcon + (fcnt+1)); - rtscheck.RTS_SndData((unsigned long)0xFFFF, (FilenameNature + ((1+fcnt) * 16))); // white + rts.sendData((uint8_t)0, FilenameIcon + (fcnt+1)); + rts.sendData((unsigned long)0xFFFF, (FilenameNature + ((1+fcnt) * 16))); // white } SERIAL_ECHOLNPGM("-", seek, " '", filelist.filename(), "' '", currentfoldername, "", filelist.shortFilename(), "'\n"); fcnt++; diff --git a/Marlin/src/lcd/extui/ia_creality/creality_extui.cpp b/Marlin/src/lcd/extui/ia_creality/creality_extui.cpp deleted file mode 100644 index 3ba8322f00850..0000000000000 --- a/Marlin/src/lcd/extui/ia_creality/creality_extui.cpp +++ /dev/null @@ -1,2094 +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 . - * - */ - -/* **************************************** - * lcd/extui/ia_creality/creality_extui.cpp - * **************************************** - * Extensible_UI implementation for Creality DWIN - * 10SPro, Max, CRX, and others - * Based original Creality release, ported to ExtUI for Marlin 2.0 - * Written by Insanity Automation, sponsored by Tiny Machines 3D - * - * ***************************************/ - -#include "../../../inc/MarlinConfigPre.h" - -#if DGUS_LCD_UI_IA_CREALITY - -#include "ia_creality_extui.h" -#include "FileNavigator.h" - -namespace ExtUI { - static uint16_t fileIndex = 0; - uint8_t recordcount = 0; - uint8_t waitway_lock = 0; - const float manual_feedrate_mm_m[] = MANUAL_FEEDRATE; - uint8_t startprogress = 0; - - char waitway = 0; - int16_t recnum = 0; - float ChangeMaterialbuf[2] = {0}; - - char NozzleTempStatus[3] = {0}; - - char PrinterStatusKey[2] = {0}; // PrinterStatusKey[1] value: 0 represents to keep temperature, 1 represents to heating , 2 stands for cooling , 3 stands for printing - // PrinterStatusKey[0] value: 0 reprensents 3D printer ready - - uint8_t AxisPagenum = 0; // 0 for 10mm, 1 for 1mm, 2 for 0.1mm - bool InforShowStatus = true; - bool TPShowStatus = false; // true for only opening time and percentage, false for closing time and percentage. - bool AutohomeKey = false; - uint8_t AutoHomeIconNum; - int16_t userConfValidation = 0; - - uint8_t lastPauseMsgState = 0; - - creality_dwin_settings_t Settings; - uint8_t dwin_settings_version = 1; - - bool reEntryPrevent = false; - uint8_t reEntryCount = 0; - uint16_t idleThrottling = 0; - - bool pause_resume_selected = false; - - #if HAS_PID_HEATING - uint16_t pid_hotendAutoTemp = 150; - uint16_t pid_bedAutoTemp = 70; - #endif - - #ifndef CUSTOM_MACHINE_NAME - #define CUSTOM_MACHINE_NAME MACHINE_NAME - #endif - #ifndef IA_CREALITY_BOOT_DELAY - #define IA_CREALITY_BOOT_DELAY 500 - #endif - - void onStartup() { - DWIN_SERIAL.begin(115200); - rtscheck.recdat.head[0] = rtscheck.snddat.head[0] = FHONE; - rtscheck.recdat.head[1] = rtscheck.snddat.head[1] = FHTWO; - ZERO(rtscheck.databuf); - - delay_ms(IA_CREALITY_BOOT_DELAY); // Delay to allow screen startup - SetTouchScreenConfiguration(); - rtscheck.RTS_SndData(StartSoundSet, SoundAddr); - delay_ms(400); // Delay to allow screen to configure - - onStatusChanged(CUSTOM_MACHINE_NAME " Ready"); - - rtscheck.RTS_SndData(100, FeedrateDisplay); - - /***************turn off motor*****************/ - rtscheck.RTS_SndData(11, FilenameIcon); - - /***************transmit temperature to screen*****************/ - rtscheck.RTS_SndData(0, NozzlePreheat); - rtscheck.RTS_SndData(0, BedPreheat); - rtscheck.RTS_SndData(getActualTemp_celsius(H0), NozzleTemp); - rtscheck.RTS_SndData(TERN0(HAS_MULTI_HOTEND, getActualTemp_celsius(H1)), e2Temp); - rtscheck.RTS_SndData(getActualTemp_celsius(BED), Bedtemp); - /***************transmit Fan speed to screen*****************/ - rtscheck.RTS_SndData(getActualFan_percent((fan_t)getActiveTool()), FanKeyIcon); - - /***************transmit Printer information to screen*****************/ - for (int16_t j = 0; j < 20; j++) // clean filename - rtscheck.RTS_SndData(0, MacVersion + j); - char sizebuf[20] = {0}; - sprintf(sizebuf, "%d X %d X %d", Y_BED_SIZE, X_BED_SIZE, Z_MAX_POS); - rtscheck.RTS_SndData(CUSTOM_MACHINE_NAME, MacVersion); - rtscheck.RTS_SndData(SHORT_BUILD_VERSION, SoftVersion); - rtscheck.RTS_SndData(sizebuf, PrinterSize); - rtscheck.RTS_SndData(WEBSITE_URL, CorpWebsite); - - /**************************some info init*******************************/ - rtscheck.RTS_SndData(0, PrintscheduleIcon); - rtscheck.RTS_SndData(0, PrintscheduleIcon + 1); - - /************************clean screen*******************************/ - for (int16_t i = 0; i < MaxFileNumber; i++) - for (int16_t j = 0; j < 10; j++) rtscheck.RTS_SndData(0, SDFILE_ADDR + i * 10 + j); - - for (int16_t j = 0; j < 10; j++) { - rtscheck.RTS_SndData(0, Printfilename + j); // clean screen. - rtscheck.RTS_SndData(0, Choosefilename + j); // clean filename - } - for (int16_t j = 0; j < 8; j++) rtscheck.RTS_SndData(0, FilenameCount + j); - for (int16_t j = 1; j <= MaxFileNumber; j++) { - rtscheck.RTS_SndData(10, FilenameIcon + j); - rtscheck.RTS_SndData(10, FilenameIcon1 + j); - } - } - - void onIdle() { - - while (rtscheck.RTS_RecData() > 0 && (rtscheck.recdat.data[0] != 0 || rtscheck.recdat.addr != 0)) rtscheck.RTS_HandleData(); - - if (reEntryPrevent && reEntryCount < 120) { - reEntryCount++; - return; - } - reEntryCount = 0; - - if (idleThrottling++ < 750) return; - - // Always send temperature data - rtscheck.RTS_SndData(getActualTemp_celsius(getActiveTool()), NozzleTemp); - rtscheck.RTS_SndData(getActualTemp_celsius(BED), Bedtemp); - rtscheck.RTS_SndData(getTargetTemp_celsius(getActiveTool()), NozzlePreheat); - rtscheck.RTS_SndData(getTargetTemp_celsius(BED), BedPreheat); - rtscheck.RTS_SndData(TERN0(HAS_MULTI_HOTEND, getActualTemp_celsius(H1)), e2Temp); - rtscheck.RTS_SndData(TERN0(HAS_MULTI_HOTEND, getTargetTemp_celsius(H1)), e2Preheat); - TERN_(HAS_MULTI_HOTEND, rtscheck.RTS_SndData(uint8_t(getActiveTool() + 1), ActiveToolVP)); - - if (awaitingUserConfirm() && (lastPauseMsgState != ExtUI::pauseModeStatus || userConfValidation > 99)) { - switch (ExtUI::pauseModeStatus) { - case PAUSE_MESSAGE_PARKING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_PAUSE_PRINT_PARKING)); break; - case PAUSE_MESSAGE_CHANGING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_INIT)); break; - case PAUSE_MESSAGE_UNLOAD: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_UNLOAD)); break; - case PAUSE_MESSAGE_WAITING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_ADVANCED_PAUSE_WAITING)); break; - case PAUSE_MESSAGE_INSERT: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_INSERT)); break; - case PAUSE_MESSAGE_LOAD: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD)); break; - case PAUSE_MESSAGE_PURGE: ExtUI::onUserConfirmRequired(GET_TEXT_F(TERN(ADVANCED_PAUSE_CONTINUOUS_PURGE, MSG_FILAMENT_CHANGE_CONT_PURGE, MSG_FILAMENT_CHANGE_PURGE))); break; - case PAUSE_MESSAGE_RESUME: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_RESUME)); break; - case PAUSE_MESSAGE_HEAT: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEAT)); break; - case PAUSE_MESSAGE_HEATING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEATING)); break; - case PAUSE_MESSAGE_OPTION: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_OPTION_HEADER)); break; - case PAUSE_MESSAGE_STATUS: break; - default: onUserConfirmRequired(PSTR("Confirm Continue")); break; - } - userConfValidation = 0; - } - else if (pause_resume_selected && !awaitingUserConfirm()) { - rtscheck.RTS_SndData(ExchangePageBase + 53, ExchangepageAddr); - pause_resume_selected = false; - userConfValidation = 0; - } - else if (awaitingUserConfirm()) { - if (pause_resume_selected) { - pause_resume_selected = false; - userConfValidation = 100; - } - else - userConfValidation++; - } - - reEntryPrevent = true; - idleThrottling = 0; - if (waitway && !commandsInQueue()) - waitway_lock++; - else - waitway_lock = 0; - - if (waitway_lock > 100) { - waitway_lock = 0; - waitway = 0; // clear waitway if nothing is going on - } - - switch (waitway) { - case 1: - if (isPositionKnown()) { - InforShowStatus = true; - rtscheck.RTS_SndData(ExchangePageBase + 54, ExchangepageAddr); - waitway = 0; - } - break; - - case 2: - if (isPositionKnown() && !commandsInQueue()) waitway = 0; - break; - - case 3: - //if(isPositionKnown() && (getActualTemp_celsius(BED) >= (getTargetTemp_celsius(BED)-1))) { - rtscheck.RTS_SndData(ExchangePageBase + 64, ExchangepageAddr); - waitway = 7; - //return; - //} - break; - - case 4: - if (AutohomeKey && isPositionKnown() && !commandsInQueue()) { // Manual Move Home Done - //rtscheck.RTS_SndData(ExchangePageBase + 71 + AxisPagenum, ExchangepageAddr); - AutohomeKey = false; - waitway = 0; - } - break; - case 5: - if (isPositionKnown() && !commandsInQueue()) { - InforShowStatus = true; - waitway = 0; - rtscheck.RTS_SndData(ExchangePageBase + 78, ExchangepageAddr); // exchange to 78 page - } - break; - case 6: - if (!commandsInQueue()) { - setAxisPosition_mm(BED_TRAMMING_HEIGHT, axis_t(Z)); - waitway = 0; - } - break; - case 7: - if (!commandsInQueue()) waitway = 0; - break; - } - - TERN_(HAS_MESH, rtscheck.RTS_SndData(getLevelingActive() ? 3 : 2, AutoLevelIcon)); - TERN_(HAS_FILAMENT_SENSOR, rtscheck.RTS_SndData(getFilamentRunoutEnabled() ? 3 : 2, RunoutToggle)); - TERN_(CASE_LIGHT_ENABLE, rtscheck.RTS_SndData(getCaseLightState() ? 3 : 2, LedToggle)); - TERN_(POWER_LOSS_RECOVERY, rtscheck.RTS_SndData(getPowerLossRecoveryEnabled() ? 3 : 2, PowerLossToggle)); - - if (startprogress == 0) { - startprogress += 25; - delay_ms(3000); // Delay to show bootscreen - } - else if (startprogress < 250) { - if (isMediaInserted()) // Re init media as it happens too early on STM32 boards often - onMediaInserted(); - else - injectCommands(F("M22\nM21")); - startprogress = 254; - InforShowStatus = true; - TPShowStatus = false; - rtscheck.RTS_SndData(ExchangePageBase + 45, ExchangepageAddr); - reEntryPrevent = false; - return; - } - if (startprogress <= 100) - rtscheck.RTS_SndData(startprogress, StartIcon); - else - rtscheck.RTS_SndData(startprogress - 100, StartIcon + 1); - - //rtscheck.RTS_SndData((startprogress++) % 5, ExchFlmntIcon); - - if (isPrinting()) { - rtscheck.RTS_SndData(getActualFan_percent((fan_t)getActiveTool()), FanKeyIcon); - rtscheck.RTS_SndData(getProgress_seconds_elapsed() / 3600, Timehour); - rtscheck.RTS_SndData((getProgress_seconds_elapsed() % 3600) / 60, Timemin); - if (getProgress_percent() > 0) { - const uint16_t perc = getProgress_percent() + 1; - if (perc <= 50) { - rtscheck.RTS_SndData(uint16_t(perc) * 2, PrintscheduleIcon); - rtscheck.RTS_SndData(0, PrintscheduleIcon + 1); - } - else { - rtscheck.RTS_SndData(100, PrintscheduleIcon); - rtscheck.RTS_SndData(uint16_t(perc) * 2 - 100, PrintscheduleIcon + 1); - } - } - else { - rtscheck.RTS_SndData(0, PrintscheduleIcon); - rtscheck.RTS_SndData(0, PrintscheduleIcon + 1); - } - rtscheck.RTS_SndData(uint16_t(getProgress_percent()), Percentage); - } - else { // Not printing settings - rtscheck.RTS_SndData(map(constrain(Settings.display_volume, 0, 255), 0, 255, 0, 100), VolumeDisplay); - rtscheck.RTS_SndData(Settings.screen_brightness, DisplayBrightness); - rtscheck.RTS_SndData(Settings.standby_screen_brightness, DisplayStandbyBrightness); - rtscheck.RTS_SndData(Settings.standby_time_seconds, DisplayStandbySeconds); - if (Settings.display_standby) - rtscheck.RTS_SndData(3, DisplayStandbyEnableIndicator); - else - rtscheck.RTS_SndData(2, DisplayStandbyEnableIndicator); - - rtscheck.RTS_SndData(getAxisSteps_per_mm(X) * 10, StepMM_X); - rtscheck.RTS_SndData(getAxisSteps_per_mm(Y) * 10, StepMM_Y); - rtscheck.RTS_SndData(getAxisSteps_per_mm(Z) * 10, StepMM_Z); - rtscheck.RTS_SndData(getAxisSteps_per_mm(E0) * 10, StepMM_E); - - rtscheck.RTS_SndData(getAxisMaxAcceleration_mm_s2(X) / 100, Accel_X); - rtscheck.RTS_SndData(getAxisMaxAcceleration_mm_s2(Y) / 100, Accel_Y); - rtscheck.RTS_SndData(getAxisMaxAcceleration_mm_s2(Z) / 10, Accel_Z); - rtscheck.RTS_SndData(getAxisMaxAcceleration_mm_s2(E0), Accel_E); - - rtscheck.RTS_SndData(getAxisMaxFeedrate_mm_s(X), Feed_X); - rtscheck.RTS_SndData(getAxisMaxFeedrate_mm_s(Y), Feed_Y); - rtscheck.RTS_SndData(getAxisMaxFeedrate_mm_s(Z), Feed_Z); - rtscheck.RTS_SndData(getAxisMaxFeedrate_mm_s(E0), Feed_E); - - rtscheck.RTS_SndData(getAxisMaxJerk_mm_s(X) * 100, Jerk_X); - rtscheck.RTS_SndData(getAxisMaxJerk_mm_s(Y) * 100, Jerk_Y); - rtscheck.RTS_SndData(getAxisMaxJerk_mm_s(Z) * 100, Jerk_Z); - rtscheck.RTS_SndData(getAxisMaxJerk_mm_s(E0) * 100, Jerk_E); - - #if HAS_HOTEND_OFFSET - rtscheck.RTS_SndData(getNozzleOffset_mm(X, E1) * 10, T2Offset_X); - rtscheck.RTS_SndData(getNozzleOffset_mm(Y, E1) * 10, T2Offset_Y); - rtscheck.RTS_SndData(getNozzleOffset_mm(Z, E1) * 10, T2Offset_Z); - rtscheck.RTS_SndData(getAxisSteps_per_mm(E1) * 10, T2StepMM_E); - #endif - - #if HAS_BED_PROBE - rtscheck.RTS_SndData(getProbeOffset_mm(X) * 100, ProbeOffset_X); - rtscheck.RTS_SndData(getProbeOffset_mm(Y) * 100, ProbeOffset_Y); - #endif - - #if HAS_PID_HEATING - rtscheck.RTS_SndData(pid_hotendAutoTemp, HotendPID_AutoTmp); - rtscheck.RTS_SndData(pid_bedAutoTemp, BedPID_AutoTmp); - rtscheck.RTS_SndData(getPID_Kp(E0) * 10, HotendPID_P); - rtscheck.RTS_SndData(getPID_Ki(E0) * 10, HotendPID_I); - rtscheck.RTS_SndData(getPID_Kd(E0) * 10, HotendPID_D); - #if ENABLED(PIDTEMPBED) - rtscheck.RTS_SndData(getBedPID_Kp() * 10, BedPID_P); - rtscheck.RTS_SndData(getBedPID_Ki() * 10, BedPID_I); - rtscheck.RTS_SndData(getBedPID_Kd() * 10, BedPID_D); - #endif - #endif - } - - rtscheck.RTS_SndData(getZOffset_mm() * 100, ProbeOffset_Z); - rtscheck.RTS_SndData(uint16_t(getFlow_percent(E0)), Flowrate); - - if (NozzleTempStatus[0] || NozzleTempStatus[2]) { // statuse of loadfilament and unloadfinement when temperature is less than - uint16_t IconTemp = getActualTemp_celsius(getActiveTool()) * 100 / getTargetTemp_celsius(getActiveTool()); - NOMORE(IconTemp, 100U); - rtscheck.RTS_SndData(IconTemp, HeatPercentIcon); - if (getActualTemp_celsius(getActiveTool()) > EXTRUDE_MINTEMP && NozzleTempStatus[0] != 0) { - NozzleTempStatus[0] = 0; - rtscheck.RTS_SndData(10 * ChangeMaterialbuf[0], FilamentUnit1); - rtscheck.RTS_SndData(10 * ChangeMaterialbuf[1], FilamentUnit2); - rtscheck.RTS_SndData(ExchangePageBase + 65, ExchangepageAddr); - } - else if (getActualTemp_celsius(getActiveTool()) >= getTargetTemp_celsius(getActiveTool()) && NozzleTempStatus[2]) { - NozzleTempStatus[2] = 0; - TPShowStatus = true; - rtscheck.RTS_SndData(4, ExchFlmntIcon); - rtscheck.RTS_SndData(ExchangePageBase + 83, ExchangepageAddr); - } - else if (NozzleTempStatus[2]) { - //rtscheck.RTS_SndData((startprogress++) % 5, ExchFlmntIcon); - } - } - - if (AutohomeKey) { - rtscheck.RTS_SndData(AutoHomeIconNum, AutoZeroIcon); - if (++AutoHomeIconNum > 9) AutoHomeIconNum = 0; - } - - if (isMediaInserted()) { - const uint16_t currPage = fileIndex == 0 ? 1 : CEIL(float(fileIndex) / float(DISPLAY_FILES)) + 1, - maxPageAdd = filenavigator.folderdepth ? 1 : 0, - maxPages = CEIL(float(filenavigator.maxFiles() + maxPageAdd) / float(DISPLAY_FILES) ); - - rtscheck.RTS_SndData(currPage, FilesCurentPage); - rtscheck.RTS_SndData(maxPages, FilesMaxPage); - } - else { - rtscheck.RTS_SndData(0, FilesCurentPage); - rtscheck.RTS_SndData(0, FilesMaxPage); - } - - if (rtscheck.recdat.addr != DisplayZaxis && rtscheck.recdat.addr != DisplayYaxis && rtscheck.recdat.addr != DisplayZaxis) { - rtscheck.RTS_SndData(10 * getAxisPosition_mm(axis_t(X)), DisplayXaxis); - rtscheck.RTS_SndData(10 * getAxisPosition_mm(axis_t(Y)), DisplayYaxis); - rtscheck.RTS_SndData(10 * getAxisPosition_mm(axis_t(Z)), DisplayZaxis); - } - reEntryPrevent = false; - } - - rx_datagram_state_t RTSSHOW::rx_datagram_state = DGUS_IDLE; - uint8_t RTSSHOW::rx_datagram_len = 0; - bool RTSSHOW::Initialized = false; - RTSSHOW::RTSSHOW() { - recdat.head[0] = snddat.head[0] = FHONE; - recdat.head[1] = snddat.head[1] = FHTWO; - ZERO(databuf); - } - - int16_t RTSSHOW::RTS_RecData() { - uint8_t receivedbyte; - while (DWIN_SERIAL.available()) - switch (rx_datagram_state) { - - case DGUS_IDLE: // Waiting for the first header byte - receivedbyte = DWIN_SERIAL.read(); - if (FHONE == receivedbyte) rx_datagram_state = DGUS_HEADER1_SEEN; - break; - - case DGUS_HEADER1_SEEN: // Waiting for the second header byte - receivedbyte = DWIN_SERIAL.read(); - rx_datagram_state = (FHTWO == receivedbyte) ? DGUS_HEADER2_SEEN : DGUS_IDLE; - break; - - case DGUS_HEADER2_SEEN: // Waiting for the length byte - rx_datagram_len = DWIN_SERIAL.read(); - //DEBUGLCDCOMM_ECHOPGM(" (", rx_datagram_len, ") "); - - // Telegram min len is 3 (command and one word of payload) - rx_datagram_state = WITHIN(rx_datagram_len, 3, DGUS_RX_BUFFER_SIZE) ? DGUS_WAIT_TELEGRAM : DGUS_IDLE; - break; - - case DGUS_WAIT_TELEGRAM: // wait for complete datagram to arrive. - if (DWIN_SERIAL.available() < rx_datagram_len) return -1; - - Initialized = true; // We've talked to it, so we defined it as initialized. - uint8_t command = DWIN_SERIAL.read(); - - //DEBUGLCDCOMM_ECHOPGM("# ", command); - - uint8_t readlen = rx_datagram_len - 1; // command is part of len. - uint8_t tmp[rx_datagram_len - 1]; - uint8_t *ptmp = tmp; - while (readlen--) { - receivedbyte = DWIN_SERIAL.read(); - //DEBUGLCDCOMM_ECHOPGM(" ", receivedbyte); - *ptmp++ = receivedbyte; - } - //DEBUGLCDCOMM_ECHOPGM(" # "); - // mostly we'll get this: 5A A5 03 82 4F 4B -- ACK on 0x82, so discard it. - if (command == VarAddr_W && 'O' == tmp[0] && 'K' == tmp[1]) { - rx_datagram_state = DGUS_IDLE; - break; - } - - /* AutoUpload, (and answer to) Command 0x83 : - | tmp[0 1 2 3 4 ... ] - | Example 5A A5 06 83 20 01 01 78 01 …… - | / / | | \ / | \ \ - | Header | | | | \_____\_ DATA (Words!) - | DatagramLen / VPAdr | - | Command DataLen (in Words) */ - if (command == VarAddr_R) { - const uint16_t vp = tmp[0] << 8 | tmp[1]; - - const uint8_t dlen = tmp[2] << 1; // Convert to Bytes. (Display works with words) - recdat.addr = vp; - recdat.len = tmp[2]; - for (uint16_t i = 0; i < dlen; i += 2) { - recdat.data[i / 2] = tmp[3 + i]; - recdat.data[i / 2] = (recdat.data[i / 2] << 8 ) | tmp[4 + i]; - } - - rx_datagram_state = DGUS_IDLE; - return 2; - break; - } - - // discard anything else - rx_datagram_state = DGUS_IDLE; - } - return -1; - } - - void RTSSHOW::RTS_SndData() { - if (snddat.head[0] == FHONE && snddat.head[1] == FHTWO && snddat.len >= 3) { - databuf[0] = snddat.head[0]; - databuf[1] = snddat.head[1]; - databuf[2] = snddat.len; - databuf[3] = snddat.command; - if (snddat.command == 0x80) { // to write data to the register - databuf[4] = snddat.addr; - for (int16_t i = 0; i < (snddat.len - 2); i++) databuf[5 + i] = snddat.data[i]; - } - else if (snddat.len == 3 && (snddat.command == 0x81)) { // to read data from the register - databuf[4] = snddat.addr; - databuf[5] = snddat.bytelen; - } - else if (snddat.command == 0x82) { // to write data to the variate - databuf[4] = snddat.addr >> 8; - databuf[5] = snddat.addr & 0xFF; - for (int16_t i = 0; i < (snddat.len - 3); i += 2) { - databuf[6 + i] = snddat.data[i / 2] >> 8; - databuf[7 + i] = snddat.data[i / 2] & 0xFF; - } - } - else if (snddat.len == 4 && (snddat.command == 0x83)) { // to read data from the variate - databuf[4] = snddat.addr >> 8; - databuf[5] = snddat.addr & 0xFF; - databuf[6] = snddat.bytelen; - } - for (int16_t i = 0; i < (snddat.len + 3); i++) { - DWIN_SERIAL.write(databuf[i]); - delay_us(1); - } - - memset(&snddat, 0, sizeof(snddat)); - ZERO(databuf); - snddat.head[0] = FHONE; - snddat.head[1] = FHTWO; - } - } - - void RTSSHOW::RTS_SndData(const String &s, uint32_t addr, uint8_t cmd/*=VarAddr_W*/) { - if (s.length() < 1) return; - RTS_SndData(s.c_str(), addr, cmd); - } - - void RTSSHOW::RTS_SndData(const char *str, uint32_t addr, uint8_t cmd/*=VarAddr_W*/) { - int16_t len = strlen(str); - constexpr int16_t maxlen = SizeofDatabuf - 6; - if (len > 0) { - if (len > maxlen) len = maxlen; - databuf[0] = FHONE; - databuf[1] = FHTWO; - databuf[2] = 3 + len; - databuf[3] = cmd; - databuf[4] = addr >> 8; - databuf[5] = addr & 0x00FF; - for (int16_t i = 0; i < len; i++) databuf[6 + i] = str[i]; - - for (int16_t i = 0; i < (len + 6); i++) { - DWIN_SERIAL.write(databuf[i]); - delay_us(1); - } - ZERO(databuf); - } - } - - void RTSSHOW::RTS_SndData(const char c, const uint32_t addr, const uint8_t cmd/*=VarAddr_W*/) { - snddat.command = cmd; - snddat.addr = addr; - snddat.data[0] = uint32_t(uint16_t(c) << 8); - snddat.len = 5; - RTS_SndData(); - } - - void RTSSHOW::RTS_SndData(const_float_t f, const uint32_t addr, const uint8_t cmd/*=VarAddr_W*/) { - int16_t n = f; - if (cmd == VarAddr_W) { - snddat.data[0] = n; - snddat.len = 5; - } - else if (cmd == RegAddr_W) { - snddat.data[0] = n; - snddat.len = 3; - } - else if (cmd == VarAddr_R) { - snddat.bytelen = n; - snddat.len = 4; - } - snddat.command = cmd; - snddat.addr = addr; - RTS_SndData(); - } - - void RTSSHOW::RTS_SndData(const int n, const uint32_t addr, const uint8_t cmd/*=VarAddr_W*/) { - if (cmd == VarAddr_W) { - if ((unsigned int)n > 0xFFFF) { - snddat.data[0] = n >> 16; - snddat.data[1] = n & 0xFFFF; - snddat.len = 7; - } - else { - snddat.data[0] = n; - snddat.len = 5; - } - } - else if (cmd == RegAddr_W) { - snddat.data[0] = n; - snddat.len = 3; - } - else if (cmd == VarAddr_R) { - snddat.bytelen = n; - snddat.len = 4; - } - snddat.command = cmd; - snddat.addr = addr; - RTS_SndData(); - } - - void RTSSHOW::RTS_SndData(const unsigned long n, uint32_t addr, uint8_t cmd/*=VarAddr_W*/) { - if (cmd == VarAddr_W) { - if (n > 0xFFFF) { - snddat.data[0] = n >> 16; - snddat.data[1] = n & 0xFFFF; - //snddat.data[0] = n >> 24; - //snddat.data[1] = n >> 16; - //snddat.data[2] = n >> 8; - //snddat.data[3] = n; - snddat.len = 7; - } - else { - snddat.data[0] = n; - snddat.len = 5; - } - } - else if (cmd == VarAddr_R) { - snddat.bytelen = n; - snddat.len = 4; - } - snddat.command = cmd; - snddat.addr = addr; - RTS_SndData(); - } - - void RTSSHOW::RTS_HandleData() { - int16_t Checkkey = -1; - if (waitway > 0) { // for waiting - memset(&recdat, 0, sizeof(recdat)); - recdat.head[0] = FHONE; - recdat.head[1] = FHTWO; - return; - } - for (int16_t i = 0; Addrbuf[i] != 0; i++) - if (recdat.addr == Addrbuf[i]) { - if (Addrbuf[i] == NzBdSet || Addrbuf[i] == NozzlePreheat || Addrbuf[i] == BedPreheat || Addrbuf[i] == Flowrate) - Checkkey = ManualSetTemp; - else if (WITHIN(Addrbuf[i], Stopprint, Resumeprint)) - Checkkey = PrintChoice; - else if (WITHIN(Addrbuf[i], AutoZero, DisplayZaxis)) - Checkkey = XYZEaxis; - else if (WITHIN(Addrbuf[i], FilamentUnit1, FilamentUnit2)) - Checkkey = Filament; - else - Checkkey = i; - break; - } - - switch (recdat.addr) { - case Flowrate: - case StepMM_X ... StepMM_E: - case ProbeOffset_X ... ProbeOffset_Y: - case HotendPID_AutoTmp ... BedPID_AutoTmp: - case HotendPID_P ... HotendPID_D: - case BedPID_P ... BedPID_D: - case T2Offset_X ... T2StepMM_E: - case Accel_X ... Accel_E: - case Feed_X ... Feed_E: - case Jerk_X ... Jerk_E: - case RunoutToggle: - case PowerLossToggle: - case FanKeyIcon: - case LedToggle: - case e2Preheat: Checkkey = ManualSetTemp; break; - case ProbeOffset_Z: Checkkey = Zoffset_Value; break; - case VolumeDisplay: Checkkey = VolumeDisplay; break; - case DisplayBrightness: Checkkey = DisplayBrightness; break; - case DisplayStandbyBrightness: Checkkey = DisplayStandbyBrightness; break; - case DisplayStandbySeconds: Checkkey = DisplayStandbySeconds; break; - default: - if (WITHIN(recdat.addr, AutolevelVal, 4400)) // (int16_t(AutolevelVal) + GRID_MAX_POINTS * 2) = 4400 with 5x5 mesh - Checkkey = AutolevelVal; - else if (WITHIN(recdat.addr, SDFILE_ADDR, SDFILE_ADDR + 10 * (FileNum + 1))) - Checkkey = Filename; - break; - } - - if (Checkkey < 0) { - memset(&recdat, 0, sizeof(recdat)); - recdat.head[0] = FHONE; - recdat.head[1] = FHTWO; - return; - } - - constexpr float lfrb[4] = BED_TRAMMING_INSET_LFRB; - - switch (Checkkey) { - case Printfile: - if (recdat.data[0] == 1) { // card - InforShowStatus = false; - filenavigator.getFiles(0); - fileIndex = 0; - recordcount = 0; - RTS_SndData(ExchangePageBase + 46, ExchangepageAddr); - } - else if (recdat.data[0] == 2) { // return after printing result. - InforShowStatus = true; - TPShowStatus = false; - stopPrint(); - injectCommands(F("M84")); - RTS_SndData(11, FilenameIcon); - RTS_SndData(0, PrintscheduleIcon); - RTS_SndData(0, PrintscheduleIcon + 1); - RTS_SndData(0, Percentage); - delay_ms(2); - RTS_SndData(0, Timehour); - RTS_SndData(0, Timemin); - - RTS_SndData(ExchangePageBase + 45, ExchangepageAddr); // exchange to 45 page - } - else if (recdat.data[0] == 3) { // Temperature control - InforShowStatus = true; - TPShowStatus = false; - if (getTargetFan_percent((fan_t)getActiveTool()) == 0) - RTS_SndData(ExchangePageBase + 58, ExchangepageAddr); // exchange to 58 page, the fans off - else - RTS_SndData(ExchangePageBase + 57, ExchangepageAddr); // exchange to 57 page, the fans on - } - else if (recdat.data[0] == 4) { // Settings - InforShowStatus = false; - } - break; - - case Adjust: - if (recdat.data[0] == 1) { - InforShowStatus = false; - } - else if (recdat.data[0] == 2) { - InforShowStatus = true; - if (PrinterStatusKey[1] == 3) // during heating - RTS_SndData(ExchangePageBase + 53, ExchangepageAddr); - else if (PrinterStatusKey[1] == 4) - RTS_SndData(ExchangePageBase + 54, ExchangepageAddr); - else - RTS_SndData(ExchangePageBase + 53, ExchangepageAddr); - } - else if (recdat.data[0] == 3) - setTargetFan_percent(getTargetFan_percent((fan_t)getActiveTool()) != 0 ? 100 : 0, FAN0); - - break; - - case Feedrate: - setFeedrate_percent(recdat.data[0]); - break; - - case PrintChoice: - if (recdat.addr == Stopprint) { - if (recdat.data[0] == 240) { // no - RTS_SndData(ExchangePageBase + 53, ExchangepageAddr); - } - else { - RTS_SndData(ExchangePageBase + 45, ExchangepageAddr); - RTS_SndData(0, Timehour); - RTS_SndData(0, Timemin); - stopPrint(); - } - } - else if (recdat.addr == Pauseprint) { - if (recdat.data[0] != 0xF1) - break; - - RTS_SndData(ExchangePageBase + 54, ExchangepageAddr); - pausePrint(); - } - else if (recdat.addr == Resumeprint && recdat.data[0] == 1) { - resumePrint(); - - PrinterStatusKey[1] = 0; - InforShowStatus = true; - - RTS_SndData(ExchangePageBase + 53, ExchangepageAddr); - } - if (recdat.addr == Resumeprint && recdat.data[0] == 2) { // warming - resumePrint(); - NozzleTempStatus[2] = 1; - PrinterStatusKey[1] = 0; - InforShowStatus = true; - RTS_SndData(ExchangePageBase + 82, ExchangepageAddr); - } - break; - - case Zoffset: - float tmp_zprobe_offset; - if (recdat.data[0] >= 32768) - tmp_zprobe_offset = (float(recdat.data[0]) - 65536) / 100; - else - tmp_zprobe_offset = float(recdat.data[0]) / 100; - if (WITHIN((tmp_zprobe_offset), Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { - int16_t tmpSteps = mmToWholeSteps(getZOffset_mm() - tmp_zprobe_offset, axis_t(Z)); - if (tmpSteps == 0) tmpSteps = getZOffset_mm() < tmp_zprobe_offset ? 1 : -1; - smartAdjustAxis_steps(-tmpSteps, axis_t(Z), false); - char zOffs[20], tmp1[11]; - sprintf_P(zOffs, PSTR("Z Offset : %s"), dtostrf(getZOffset_mm(), 1, 3, tmp1)); - onStatusChanged(zOffs); - } - else { - onStatusChanged(F("Requested Offset Beyond Limits")); - } - - rtscheck.RTS_SndData(getZOffset_mm() * 100, ProbeOffset_Z); - break; - - case TempControl: - if (recdat.data[0] == 0) { - InforShowStatus = true; - TPShowStatus = false; - } - else if (recdat.data[0] == 1) { - if (getTargetFan_percent((fan_t)getActiveTool()) == 0) - RTS_SndData(ExchangePageBase + 60, ExchangepageAddr); // exchange to 60 page, the fans off - else - RTS_SndData(ExchangePageBase + 59, ExchangepageAddr); // exchange to 59 page, the fans on - } - else if (recdat.data[0] == 2) { - InforShowStatus = true; - } - else if (recdat.data[0] == 3) { - if (getTargetFan_percent((fan_t)getActiveTool()) == 0) { // turn on the fan - setTargetFan_percent(100, FAN0); - RTS_SndData(ExchangePageBase + 57, ExchangepageAddr); // exchange to 57 page, the fans on - } - else { // turn off the fan - setTargetFan_percent(0, FAN0); - RTS_SndData(ExchangePageBase + 58, ExchangepageAddr); // exchange to 58 page, the fans on - } - } - else if (recdat.data[0] == 5) { // PLA mode - setTargetTemp_celsius(PREHEAT_1_TEMP_HOTEND, getActiveTool()); - setTargetTemp_celsius(PREHEAT_1_TEMP_BED, BED); - RTS_SndData(PREHEAT_1_TEMP_HOTEND, NozzlePreheat); - RTS_SndData(PREHEAT_1_TEMP_BED, BedPreheat); - } - else if (recdat.data[0] == 6) { // ABS mode - setTargetTemp_celsius(PREHEAT_2_TEMP_HOTEND, getActiveTool()); - setTargetTemp_celsius(PREHEAT_2_TEMP_BED, BED); - RTS_SndData(PREHEAT_2_TEMP_HOTEND, NozzlePreheat); - RTS_SndData(PREHEAT_2_TEMP_BED, BedPreheat); - } - else if (recdat.data[0] == 0xF1) { - //InforShowStatus = true; - #if FAN_COUNT > 0 - for (uint8_t i = 0; i < FAN_COUNT; i++) setTargetFan_percent(0, (fan_t)i); - #endif - setTargetTemp_celsius(0.0, H0); - TERN_(HAS_MULTI_HOTEND, setTargetTemp_celsius(0.0, H1)); - setTargetTemp_celsius(0.0, BED); - RTS_SndData(0, NozzlePreheat); delay_ms(1); - RTS_SndData(0, BedPreheat); delay_ms(1); - RTS_SndData(ExchangePageBase + 57, ExchangepageAddr); - PrinterStatusKey[1] = 2; - } - break; - - case ManualSetTemp: - if (recdat.addr == NzBdSet) { - if (recdat.data[0] == 0) { - if (getTargetFan_percent((fan_t)getActiveTool()) == 0) - RTS_SndData(ExchangePageBase + 58, ExchangepageAddr); // exchange to 58 page, the fans off - else - RTS_SndData(ExchangePageBase + 57, ExchangepageAddr); // exchange to 57 page, the fans on - } - else if (recdat.data[0] == 1) { - setTargetTemp_celsius(0.0, getActiveTool()); - RTS_SndData(0, NozzlePreheat); - } - else if (recdat.data[0] == 2) { - setTargetTemp_celsius(0.0, BED); - RTS_SndData(0, BedPreheat); - } - } - else if (recdat.addr == NozzlePreheat) { - setTargetTemp_celsius(float(recdat.data[0]), H0); - } - #if HAS_MULTI_HOTEND - else if (recdat.addr == e2Preheat) { - setTargetTemp_celsius(float(recdat.data[0]), H1); - } - #endif - else if (recdat.addr == BedPreheat) { - setTargetTemp_celsius(float(recdat.data[0]), BED); - } - else if (recdat.addr == Flowrate) { - setFlow_percent(int16_t(recdat.data[0]), getActiveTool()); - } - - #if HAS_PID_HEATING - else if (recdat.addr == HotendPID_AutoTmp) { - pid_hotendAutoTemp = uint16_t(recdat.data[0]); - } - else if (recdat.addr == BedPID_AutoTmp) { - pid_bedAutoTemp = uint16_t(recdat.data[0]); - } - #endif - - else if (recdat.addr == Accel_X) { - setAxisMaxAcceleration_mm_s2(uint16_t(recdat.data[0]) * 100, X); - } - else if (recdat.addr == Accel_Y) { - setAxisMaxAcceleration_mm_s2(uint16_t(recdat.data[0]) * 100, Y); - } - else if (recdat.addr == Accel_Z) { - setAxisMaxAcceleration_mm_s2(uint16_t(recdat.data[0]) * 10, Z); - } - else if (recdat.addr == Accel_E) { - setAxisMaxAcceleration_mm_s2(uint16_t(recdat.data[0]), E0); - setAxisMaxAcceleration_mm_s2(uint16_t(recdat.data[0]), E1); - } - - else if (recdat.addr == Feed_X) { - setAxisMaxFeedrate_mm_s(uint16_t(recdat.data[0]), X); - } - else if (recdat.addr == Feed_Y) { - setAxisMaxFeedrate_mm_s(uint16_t(recdat.data[0]), Y); - } - else if (recdat.addr == Feed_Z) { - setAxisMaxFeedrate_mm_s(uint16_t(recdat.data[0]), Z); - } - else if (recdat.addr == Feed_E) { - setAxisMaxFeedrate_mm_s(uint16_t(recdat.data[0]), E0); - setAxisMaxFeedrate_mm_s(uint16_t(recdat.data[0]), E1); - } - else if (recdat.addr == FanKeyIcon) { - setTargetFan_percent(uint16_t(recdat.data[0]), (fan_t)getActiveTool()); - } - else { - float tmp_float_handling; - if (recdat.data[0] >= 32768) - tmp_float_handling = (float(recdat.data[0]) - 65536) / 100; - else - tmp_float_handling = float(recdat.data[0]) / 100; - if (recdat.addr == StepMM_X) { - setAxisSteps_per_mm(tmp_float_handling * 10, X); - } - else if (recdat.addr == StepMM_Y) { - setAxisSteps_per_mm(tmp_float_handling * 10, Y); - } - else if (recdat.addr == StepMM_Z) { - setAxisSteps_per_mm(tmp_float_handling * 10, Z); - } - else if (recdat.addr == StepMM_E) { - setAxisSteps_per_mm(tmp_float_handling * 10, E0); - #if DISABLED(DUAL_X_CARRIAGE) - setAxisSteps_per_mm(tmp_float_handling * 10, E1); - #endif - } - #if ENABLED(DUAL_X_CARRIAGE) - else if (recdat.addr == T2StepMM_E) { - setAxisSteps_per_mm(tmp_float_handling * 10, E1); - } - else if (recdat.addr == T2Offset_X) { - setNozzleOffset_mm(tmp_float_handling * 10, X, E1); - } - else if (recdat.addr == T2Offset_Y) { - setNozzleOffset_mm(tmp_float_handling * 10, Y, E1); - } - else if (recdat.addr == T2Offset_Z) { - setNozzleOffset_mm(tmp_float_handling * 10, Z, E1); - } - #endif - #if HAS_BED_PROBE - else if (recdat.addr == ProbeOffset_X) { - setProbeOffset_mm(tmp_float_handling, X); - } - else if (recdat.addr == ProbeOffset_Y) { - setProbeOffset_mm(tmp_float_handling, Y); - } - else if (recdat.addr == ProbeOffset_Z) { - setProbeOffset_mm(tmp_float_handling, Z); - } - #endif - - #if ENABLED(CLASSIC_JERK) - else if (recdat.addr == Jerk_X) { - setAxisMaxJerk_mm_s(tmp_float_handling, X); - } - else if (recdat.addr == Jerk_Y) { - setAxisMaxJerk_mm_s(tmp_float_handling, Y); - } - else if (recdat.addr == Jerk_Z) { - setAxisMaxJerk_mm_s(tmp_float_handling, Z); - } - else if (recdat.addr == Jerk_E) { - setAxisMaxJerk_mm_s(tmp_float_handling, E0); - setAxisMaxJerk_mm_s(tmp_float_handling, E1); - } - #endif - - #if HAS_FILAMENT_SENSOR - else if (recdat.addr == RunoutToggle) { - setFilamentRunoutEnabled(!getFilamentRunoutEnabled()); - } - #endif - - #if ENABLED(POWER_LOSS_RECOVERY) - else if (recdat.addr == PowerLossToggle) { - setPowerLossRecoveryEnabled(!getPowerLossRecoveryEnabled()); - } - #endif - - #if ENABLED(CASE_LIGHT_ENABLE) - else if (recdat.addr == LedToggle) { - setCaseLightState(!getCaseLightState()); - } - #endif - - #if HAS_PID_HEATING - else if (recdat.addr == HotendPID_P) { - setPID(tmp_float_handling * 10, getPID_Ki(getActiveTool()), getPID_Kd(getActiveTool()), getActiveTool()); - } - else if (recdat.addr == HotendPID_I) { - setPID(getPID_Kp(getActiveTool()), tmp_float_handling * 10, getPID_Kd(getActiveTool()), getActiveTool()); - } - else if (recdat.addr == HotendPID_D) { - setPID(getPID_Kp(getActiveTool()), getPID_Ki(getActiveTool()), tmp_float_handling * 10, getActiveTool()); - } - #if ENABLED(PIDTEMPBED) - else if (recdat.addr == BedPID_P) { - setBedPID(tmp_float_handling * 10, getBedPID_Ki(), getBedPID_Kd()); - } - else if (recdat.addr == BedPID_I) { - setBedPID(getBedPID_Kp(), tmp_float_handling * 10, getBedPID_Kd()); - } - else if (recdat.addr == BedPID_D) { - setBedPID(getBedPID_Kp(), getBedPID_Ki(), tmp_float_handling * 10); - } - #endif - #endif // HAS_PID_HEATING - } - break; - - case Setting: - if (recdat.data[0] == 0) { // return to main page - InforShowStatus = true; - TPShowStatus = false; - } - else if (recdat.data[0] == 1) { // Bed Autoleveling - #if HAS_MESH - RTS_SndData(getLevelingActive() ? 3 : 2, AutoLevelIcon); - - if (ExtUI::getMeshValid()) { - uint8_t abl_probe_index = 0; - for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) - for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) { - const bool zig = outer & 1; - const xy_uint8_t point = { uint8_t(zig ? (GRID_MAX_POINTS_X - 1) - inner : inner), outer }; - rtscheck.RTS_SndData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + abl_probe_index * 2); - ++abl_probe_index; - } - } - #endif - RTS_SndData(10, FilenameIcon); // Motor Icon - injectCommands(isPositionKnown() ? F("G1F1000Z0.0") : F("G28\nG1F1000Z0.0")); - waitway = 2; - RTS_SndData(ExchangePageBase + 64, ExchangepageAddr); - } - else if (recdat.data[0] == 2) { // Exchange filament - InforShowStatus = true; - TPShowStatus = false; - ZERO(ChangeMaterialbuf); - ChangeMaterialbuf[1] = ChangeMaterialbuf[0] = 10; - RTS_SndData(10 * ChangeMaterialbuf[0], FilamentUnit1); // It's ChangeMaterialbuf for show, instead of current_position.e in them. - RTS_SndData(10 * ChangeMaterialbuf[1], FilamentUnit2); - RTS_SndData(getActualTemp_celsius(H0), NozzleTemp); - RTS_SndData(getTargetTemp_celsius(H0), NozzlePreheat); - rtscheck.RTS_SndData(TERN0(HAS_MULTI_HOTEND, getActualTemp_celsius(H1)), e2Temp); - rtscheck.RTS_SndData(TERN0(HAS_MULTI_HOTEND, getTargetTemp_celsius(H1)), e2Preheat); - delay_ms(2); - RTS_SndData(ExchangePageBase + 65, ExchangepageAddr); - } - else if (recdat.data[0] == 3) { // Move - AxisPagenum = 0; - RTS_SndData(ExchangePageBase + 71, ExchangepageAddr); - } - else if (recdat.data[0] == 4) { // Language - // Just loads language screen, now used for tools - } - else if (recdat.data[0] == 5) { // Printer Information - RTS_SndData(WEBSITE_URL, CorpWebsite); - } - else if (recdat.data[0] == 6) { // Diabalestepper - injectCommands(F("M84")); - RTS_SndData(11, FilenameIcon); - } - break; - - case ReturnBack: - if (recdat.data[0] == 1) { // return to the tool page - InforShowStatus = false; - RTS_SndData(ExchangePageBase + 63, ExchangepageAddr); - } - if (recdat.data[0] == 2) // return to the Level mode page - RTS_SndData(ExchangePageBase + 64, ExchangepageAddr); - break; - - case Bedlevel: - switch (recdat.data[0]) { - case 1: { // Z-axis to home - // Disallow Z homing if X or Y are unknown - injectCommands(isAxisPositionKnown(axis_t(X)) && isAxisPositionKnown(axis_t(Y)) ? F("G28Z\nG1F1500Z0.0") : F("G28\nG1F1500Z0.0")); - RTS_SndData(getZOffset_mm() * 100, ProbeOffset_Z); - break; - } - case 2: { // Z-axis to Up - if (WITHIN((getZOffset_mm() + 0.1), Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { - smartAdjustAxis_steps(getAxisSteps_per_mm(Z) / 10, axis_t(Z), false); - //setZOffset_mm(getZOffset_mm() + 0.1); - RTS_SndData(getZOffset_mm() * 100, ProbeOffset_Z); - char zOffs[20], tmp1[11]; - sprintf_P(zOffs, PSTR("Z Offset : %s"), dtostrf(getZOffset_mm(), 1, 3, tmp1)); - onStatusChanged(zOffs); - } - break; - } - case 3: { // Z-axis to Down - if (WITHIN((getZOffset_mm() - 0.1), Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { - smartAdjustAxis_steps(-getAxisSteps_per_mm(Z) / 10, axis_t(Z), false); - //babystepAxis_steps(int16_t(-getAxisSteps_per_mm(Z)) / 10, axis_t(Z)); - //setZOffset_mm(getZOffset_mm() - 0.1); - RTS_SndData(getZOffset_mm() * 100, ProbeOffset_Z); - char zOffs[20], tmp1[11]; - sprintf_P(zOffs, PSTR("Z Offset : %s"), dtostrf(getZOffset_mm(), 1, 3, tmp1)); - onStatusChanged(zOffs); - } - break; - } - case 4: { // Assistant Level - TERN_(HAS_MESH, setLevelingActive(false)); - injectCommands(isPositionKnown() ? F("G1 F1000 Z0.0") : F("G28\nG1 F1000 Z0.0")); - waitway = 2; - RTS_SndData(ExchangePageBase + 84, ExchangepageAddr); - break; - } - case 5: { // AutoLevel "Measuring" Button - #if ENABLED(MESH_BED_LEVELING) - RTS_SndData(ExchangePageBase + 93, ExchangepageAddr); - #else - waitway = 3; // only for prohibiting to receive massage - RTS_SndData(3, AutolevelIcon); - uint8_t abl_probe_index = 0; - while (abl_probe_index < 25) { - rtscheck.RTS_SndData(0, AutolevelVal + abl_probe_index * 2); - ++abl_probe_index; - } - RTS_SndData(ExchangePageBase + 64, ExchangepageAddr); - injectCommands(F(MEASURING_GCODE)); - #endif - break; - } - - case 6: { // Assitant Level , Centre 1 - setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z)); - setAxisPosition_mm(X_CENTER, axis_t(X)); - setAxisPosition_mm(Y_CENTER, axis_t(Y)); - waitway = 6; - break; - } - case 7: { // Assitant Level , Front Left 2 - setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z)); - setAxisPosition_mm(X_MIN_BED + lfrb[0], axis_t(X)); - setAxisPosition_mm(Y_MIN_BED + lfrb[1], axis_t(Y)); - waitway = 6; - break; - } - case 8: { // Assitant Level , Front Right 3 - setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z)); - setAxisPosition_mm(X_MAX_BED - lfrb[2], axis_t(X)); - setAxisPosition_mm(Y_MIN_BED + lfrb[1], axis_t(Y)); - waitway = 6; - break; - } - case 9: { // Assitant Level , Back Right 4 - setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z)); - setAxisPosition_mm(X_MAX_BED - lfrb[2], axis_t(X)); - setAxisPosition_mm(Y_MAX_BED - lfrb[3], axis_t(Y)); - waitway = 6; - break; - } - case 10: { // Assitant Level , Back Left 5 - setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z)); - setAxisPosition_mm(X_MIN_BED + lfrb[0], axis_t(X)); - setAxisPosition_mm(Y_MAX_BED - lfrb[3], axis_t(Y)); - waitway = 6; - break; - } - case 11: { // Autolevel switch - #if HAS_MESH - const bool gla = !getLevelingActive(); - setLevelingActive(gla); - RTS_SndData(gla ? 3 : 2, AutoLevelIcon); - #endif - RTS_SndData(getZOffset_mm() * 100, ProbeOffset_Z); - break; - } - case 12: { - injectCommands(F("G26R255")); - onStatusChanged(F("Beginning G26.. Heating")); - break; - } - case 13: { - injectCommands(F("G29S1")); - onStatusChanged(F("Begin Manual Mesh")); - break; - } - case 14: { - injectCommands(F("G29S2")); - onStatusChanged(F("Moving to Next Mesh Point")); - break; - } - case 15: { - injectCommands(F("M211S0\nG91\nG1Z-0.025\nG90\nM211S1")); - onStatusChanged(F("Moved down 0.025")); - break; - } - case 16: { - injectCommands(F("M211S0\nG91\nG1Z0.025\nG90\nM211S1")); - onStatusChanged(F("Moved up 0.025")); - break; - } - case 17: { - Settings.display_volume = 0; - Settings.display_sound = false; - SetTouchScreenConfiguration(); - break; - } - case 18: { - Settings.display_volume = 255; - Settings.display_sound = true; - SetTouchScreenConfiguration(); - break; - } - case 19: { - Settings.screen_brightness = 10; - SetTouchScreenConfiguration(); - break; - } - case 20: { - Settings.screen_brightness = 100; - SetTouchScreenConfiguration(); - break; - } - case 21: { - Settings.display_standby ^= true; - SetTouchScreenConfiguration(); - break; - } - case 22: { - Settings.screen_rotation = Settings.screen_rotation == 10 ? 0 : 10; - SetTouchScreenConfiguration(); - break; - } - case 23: { // Set IDEX Autopark - injectCommands(F("M605S1\nG28X\nG1X0")); - break; - } - case 24: { // Set IDEX Duplication - injectCommands(F("M605S1\nT0\nG28\nM605S2\nG28X\nG1X0")); - break; - } - case 25: { // Set IDEX Mirrored Duplication - injectCommands(F("M605S1\nT0\nG28\nM605S2\nG28X\nG1X0\nM605S3")); - break; - } - case 26: { // Set IDEX Full Control - injectCommands(F("M605S0\nG28X")); - break; - } - case 27: { // Change Tool - setActiveTool(getActiveTool() == E0 ? E1 : E0, !isAxisPositionKnown(X)); - break; - } - default: break; - } - - RTS_SndData(10, FilenameIcon); - break; - - case XYZEaxis: { - axis_t axis = X; - float min = 0.0f, max = 0.0f; - waitway = 4; - if (recdat.addr == DisplayXaxis) { - axis = X; - min = X_MIN_POS; - max = X_MAX_POS; - } - else if (recdat.addr == DisplayYaxis) { - axis = Y; - min = Y_MIN_POS; - max = Y_MAX_POS; - } - else if (recdat.addr == DisplayZaxis) { - axis = Z; - min = Z_MIN_POS; - max = Z_MAX_POS; - } - else if (recdat.addr == AutoZero) { - if (recdat.data[0] == 3) { // autohome - waitway = 4; - injectCommands(F("G28\nG1 F1000 Z10")); - InforShowStatus = AutohomeKey = true; - AutoHomeIconNum = 0; - RTS_SndData(10, FilenameIcon); - } - else { - AxisPagenum = recdat.data[0]; - waitway = 0; - } - break; - } - - float targetPos = float(recdat.data[0]) / 10; - LIMIT(targetPos, min, max); - setAxisPosition_mm(targetPos, axis); - waitway = 0; - RTS_SndData(10, FilenameIcon); - break; - } - - case Filament: - - uint16_t IconTemp; - if (recdat.addr == Exchfilament) { - if (getActualTemp_celsius(getActiveTool()) < EXTRUDE_MINTEMP && recdat.data[0] < 5) { - RTS_SndData(int16_t(EXTRUDE_MINTEMP), 0x1020); - delay_ms(5); - RTS_SndData(ExchangePageBase + 66, ExchangepageAddr); - break; - } - - switch (recdat.data[0]) { - case 1: { // Unload filament1 - setAxisPosition_mm(getAxisPosition_mm(E0) - ChangeMaterialbuf[0], E0); - break; - } - case 2: { // Load filament1 - setAxisPosition_mm(getAxisPosition_mm(E0) + ChangeMaterialbuf[0], E0); - break; - } - case 3: { // Unload filament2 - setAxisPosition_mm(getAxisPosition_mm(E1) - ChangeMaterialbuf[1], E1); - break; - } - case 4: { // Load filament2 - setAxisPosition_mm(getAxisPosition_mm(E1) + ChangeMaterialbuf[1], E1); - break; - } - case 5: { // sure to heat - NozzleTempStatus[0] = 1; - - setTargetTemp_celsius((PREHEAT_1_TEMP_HOTEND + 10), getActiveTool()); - IconTemp = getActualTemp_celsius(getActiveTool()) * 100 / getTargetTemp_celsius(getActiveTool()); - NOMORE(IconTemp, 100U); - RTS_SndData(IconTemp, HeatPercentIcon); - - RTS_SndData(getActualTemp_celsius(H0), NozzleTemp); - RTS_SndData(getTargetTemp_celsius(H0), NozzlePreheat); - rtscheck.RTS_SndData(TERN0(HAS_MULTI_HOTEND, getActualTemp_celsius(H1)), e2Temp); - rtscheck.RTS_SndData(TERN0(HAS_MULTI_HOTEND, getTargetTemp_celsius(H1)), e2Preheat); - delay_ms(5); - RTS_SndData(ExchangePageBase + 68, ExchangepageAddr); - break; - } - case 6: { // cancel to heat - RTS_SndData(ExchangePageBase + 65, ExchangepageAddr); - break; - } - case 0xF1: { // Sure to cancel heating - NozzleTempStatus[0] = 0; - delay_ms(1); - RTS_SndData(ExchangePageBase + 65, ExchangepageAddr); - break; - } - case 0xF0: // not to cancel heating - break; - } - RTS_SndData(10 * ChangeMaterialbuf[0], FilamentUnit1); // It's ChangeMaterialbuf for show, instead of current_position.e in them. - RTS_SndData(10 * ChangeMaterialbuf[1], FilamentUnit2); - } - else if (recdat.addr == FilamentUnit1) { - ChangeMaterialbuf[0] = float(recdat.data[0]) / 10; - } - else if (recdat.addr == FilamentUnit2) { - ChangeMaterialbuf[1] = float(recdat.data[0]) / 10; - } - break; - - case LanguageChoice: - - //if (recdat.data[0] == 1) settings.save(); else injectCommands(F("M300")); - - // may at some point use language change screens to save eeprom explicitly - switch (recdat.data[0]) { - case 0: { - injectCommands(F("M500")); - break; - } - case 1: { - RTS_SndData(ExchangePageBase + 94, ExchangepageAddr); - break; - } - - #if ENABLED(PIDTEMP) - case 2: { - onStatusChanged(F("Hotend PID Started")); - startPIDTune(static_cast(pid_hotendAutoTemp), getActiveTool()); - break; - } - #endif - - case 3: { - injectCommands(F("M502\nM500")); - break; - } - case 4: { - injectCommands(F("M999\nM280P0S160")); - break; - } - - case 5: { - #if ENABLED(PIDTEMPBED) - onStatusChanged(F("Bed PID Started")); - startBedPIDTune(static_cast(pid_bedAutoTemp)); - #endif - break; - } - case 6: { - injectCommands(F("M500")); - break; - } - default: break; - } - break; - - case No_Filament: - if (recdat.data[0] == 1) { // Filament is out, resume / resume selected on screen - if (ExtUI::pauseModeStatus != PAUSE_MESSAGE_PURGE && ExtUI::pauseModeStatus != PAUSE_MESSAGE_OPTION) { - // setPauseMenuResponse(PAUSE_RESPONSE_RESUME_PRINT); - setUserConfirmed(); - // PrinterStatusKey[1] = 3; - // pause_resume_selected = true; - } - else { - #if ENABLED(FILAMENT_RUNOUT_SENSOR) - bool runouton = false; - if (getFilamentRunoutState()) { - #if NUM_RUNOUT_SENSORS > 1 - if ((runouton = getFilamentRunoutEnabled(getActiveTool()))) - ExtUI::setFilamentRunoutEnabled(false, getActiveTool()); - #else - if ((runouton = getFilamentRunoutEnabled())) - ExtUI::setFilamentRunoutEnabled(false); - #endif - } - #else - constexpr bool runouton = false; - #endif - if (!runouton) { - setPauseMenuResponse(PAUSE_RESPONSE_RESUME_PRINT); - setUserConfirmed(); - PrinterStatusKey[1] = 3; - pause_resume_selected = true; - } - } - } - else if (recdat.data[0] == 0) { // Filamet is out, Cancel Selected - if (ExtUI::pauseModeStatus == PAUSE_MESSAGE_PURGE || ExtUI::pauseModeStatus == PAUSE_MESSAGE_OPTION) { - setPauseMenuResponse(PAUSE_RESPONSE_EXTRUDE_MORE); - setUserConfirmed(); - } - } - break; - - #if ENABLED(POWER_LOSS_RECOVERY) - case PwrOffNoF: - if (recdat.data[0] == 1) // Yes: continue to print the 3Dmode during power-off. - injectCommands(F("M1000")); - else if (recdat.data[0] == 2) // No - injectCommands(F("M1000C")); - break; - #endif - - case Volume: - if (recdat.data[0] < 0) - Settings.display_volume = 0; - else if (recdat.data[0] > 255) - Settings.display_volume = 0xFF; - else - Settings.display_volume = recdat.data[0]; - - if (Settings.display_volume == 0) { - RTS_SndData(0, VolumeIcon); - RTS_SndData(9, SoundIcon); - } - else { - RTS_SndData((Settings.display_volume + 1) / 32 - 1, VolumeIcon); - RTS_SndData(8, SoundIcon); - } - RTS_SndData(Settings.display_volume << 8, SoundAddr + 1); - break; - - case Filename: - if (isMediaInserted() && recdat.addr == FilenameChs) { - - recordcount = recdat.data[0] - 1; - if (filenavigator.currentindex == 0 && filenavigator.folderdepth > 0 && (fileIndex + recordcount) == 0) { - filenavigator.upDIR(); - filenavigator.getFiles(0); - fileIndex = 0; - return; - } - - if (filenavigator.currentindex == 0 && filenavigator.folderdepth > 0) - recordcount = recordcount - 1; // account for return dir link in file index - - for (int16_t j = 1; j <= 4; j++) { // Clear filename BG Color and Frame - RTS_SndData(0xFFFFUL, FilenameNature + j * 16); // white - RTS_SndData(10, FilenameIcon1 + j); // clean - } - for (int16_t j = 0; j < 10; j++) // clear current filename - RTS_SndData(0, Choosefilename + j); - - if (filenavigator.getIndexisDir(fileIndex + recordcount)) { - filenavigator.changeDIR((char *)filenavigator.getIndexName(fileIndex + recordcount)); - filenavigator.getFiles(0); - fileIndex = 0; - return; - } - else { - RTS_SndData(filenavigator.getIndexName(fileIndex + recordcount), Choosefilename); - RTS_SndData(0x87F0UL, FilenameNature + recdat.data[0] * 16); // Change BG of selected line to Light Green - RTS_SndData(6, FilenameIcon1 + recdat.data[0]); // show frame - } - } - else if (recdat.addr == FilenamePlay) { - if (recdat.data[0] == 1 && isMediaInserted()) { // for sure - printFile(filenavigator.getIndexName(fileIndex + recordcount)); - - for (int16_t j = 0; j < 10; j++) // clean screen. - RTS_SndData(0, Printfilename + j); - - RTS_SndData(filenavigator.getIndexName(fileIndex + recordcount), Printfilename); - - delay_ms(4); - - RTS_SndData(ExchangePageBase + 53, ExchangepageAddr); - - TPShowStatus = InforShowStatus = true; - PrinterStatusKey[0] = 1; - PrinterStatusKey[1] = 3; - fileIndex = 0; - recordcount = 0; - } - else if (recdat.data[0] == 2) { // Page Down - if ((fileIndex + DISPLAY_FILES) < (filenavigator.maxFiles() + (filenavigator.folderdepth != 0))) { - fileIndex = fileIndex + DISPLAY_FILES; - // if(filenavigator.folderdepth!=0 && fileIndex!=0) //Shift to acknowledge Return DIR button on first page - // filenavigator.getFiles(fileIndex-1); - // else - filenavigator.getFiles(fileIndex); - // filenavigator.getFiles(filenavigator.currentindex+1); - } - } - else if (recdat.data[0] == 3) { // Page Up - if (fileIndex >= DISPLAY_FILES) { - fileIndex = fileIndex - DISPLAY_FILES; - // if(filenavigator.folderdepth!=0 && fileIndex!=0) //Shift to acknowledge Return DIR button on first page - // filenavigator.getFiles(filenavigator.currentindex-DISPLAY_FILES); - // else - filenavigator.getFiles(fileIndex); - } - } - else if (recdat.data[0] == 4) { // Page Up - injectCommands(F("M22\nM21")); - } - else if (recdat.data[0] == 0) { // return to main page - InforShowStatus = true; - TPShowStatus = false; - } - } - break; - - case VolumeDisplay: { - if (recdat.data[0] == 0) { - Settings.display_volume = 0; - Settings.display_sound = false; - } - else if (recdat.data[0] > 100) { - Settings.display_volume = 255; - Settings.display_sound = true; - } - else { - Settings.display_volume = (uint8_t)map(constrain(recdat.data[0], 0, 100), 0, 100, 0, 255); - Settings.display_sound = true; - } - SetTouchScreenConfiguration(); - break; - } - - case DisplayBrightness: { - if (recdat.data[0] < 10) - Settings.screen_brightness = 10; - else if (recdat.data[0] > 100) - Settings.screen_brightness = 100; - else - Settings.screen_brightness = (uint8_t)recdat.data[0]; - SetTouchScreenConfiguration(); - break; - } - - case DisplayStandbyBrightness: { - if (recdat.data[0] < 10) - Settings.standby_screen_brightness = 10; - else if (recdat.data[0] > 100) - Settings.standby_screen_brightness = 100; - else - Settings.standby_screen_brightness = (uint8_t)recdat.data[0]; - SetTouchScreenConfiguration(); - break; - } - - case DisplayStandbySeconds: { - if (recdat.data[0] < 5) - Settings.standby_time_seconds = 5; - else if (recdat.data[0] > 100) - Settings.standby_time_seconds = 100; - else - Settings.standby_time_seconds = (uint8_t)recdat.data[0]; - SetTouchScreenConfiguration(); - break; - } - - case AutolevelVal: { - uint8_t meshPoint = (recdat.addr - AutolevelVal) / 2, - yPnt = floor(meshPoint / GRID_MAX_POINTS_X), - xPnt = meshPoint - (yPnt * GRID_MAX_POINTS_X); - if (yPnt % 2 != 0) xPnt = (GRID_MAX_POINTS_X - 1) - xPnt; // zag row - - float meshVal = float(recdat.data[0] - (recdat.data[0] >= 32768 ? 65536 : 0)) / 1000; - - LIMIT(meshVal, Z_PROBE_LOW_POINT, Z_CLEARANCE_BETWEEN_PROBES); - xy_uint8_t point = { xPnt, yPnt }; - setMeshPoint(point, meshVal); - rtscheck.RTS_SndData(meshVal * 1000, recdat.addr); - break; - } - - default: break; - } - - memset(&recdat, 0, sizeof(recdat)); - recdat.head[0] = FHONE; - recdat.head[1] = FHTWO; - } - - void WriteVariable(uint16_t adr, const void* values, uint8_t valueslen, bool isstr=false, char fillChar=' ') { - const char* myvalues = static_cast(values); - bool strend = !myvalues; - DWIN_SERIAL.write(FHONE); - DWIN_SERIAL.write(FHTWO); - DWIN_SERIAL.write(valueslen + 3); - DWIN_SERIAL.write(0x82); - DWIN_SERIAL.write(adr >> 8); - DWIN_SERIAL.write(adr & 0xFF); - while (valueslen--) { - char x; - if (!strend) x = *myvalues++; - if ((isstr && !x) || strend) { - strend = true; - x = fillChar; - } - DWIN_SERIAL.write(x); - } - } - - void SetTouchScreenConfiguration() { - // Main configuration (System_Config) - LIMIT(Settings.screen_brightness, 10, 100); // Prevent a possible all-dark screen - LIMIT(Settings.standby_time_seconds, 10, 655); // Prevent a possible all-dark screen for standby, yet also don't go higher than the DWIN limitation - - uint8_t cfg_bits = 0x0 - | _BV(7) // 7: Enable Control ... TERN0(DWINOS_4, _BV(7)) - | _BV(5) // 5: load 22 touch file - | _BV(4) // 4: auto-upload should always be enabled - | (Settings.display_sound ? _BV(3) : 0) // 3: audio - | (Settings.display_standby ? _BV(2) : 0) // 2: backlight on standby - | (Settings.screen_rotation == 10 ? _BV(1) : 0) // 1 & 0: Inversion - #if LCD_SCREEN_ROTATE == 90 - | _BV(0) // Portrait Mode or 800x480 display has 0 point rotated 90deg from 480x272 display - #elif LCD_SCREEN_ROTATE - #error "Only 90° rotation is supported for the selected LCD." - #endif - ; - - const uint8_t config_set[] = { 0x5A, 0x00, TERN(DWINOS_4, 0x00, 0xFF), cfg_bits }; - WriteVariable(0x80 /*System_Config*/, config_set, sizeof(config_set)); - - // Standby brightness (LED_Config) - uint16_t dwinStandbyTimeSeconds = 100 * Settings.standby_time_seconds; /* milliseconds, but divided by 10 (not 5 like the docs say) */ - const uint8_t brightness_set[] = { - Settings.screen_brightness /*% active*/, - Settings.standby_screen_brightness /*% standby*/, - static_cast(dwinStandbyTimeSeconds >> 8), - static_cast(dwinStandbyTimeSeconds) - }; - WriteVariable(0x82 /*LED_Config*/, brightness_set, sizeof(brightness_set)); - - if (!Settings.display_sound) { - rtscheck.RTS_SndData(0, VolumeIcon); - rtscheck.RTS_SndData(9, SoundIcon); - } - else { - rtscheck.RTS_SndData((Settings.display_volume + 1) / 32 - 1, VolumeIcon); - rtscheck.RTS_SndData(8, SoundIcon); - } - rtscheck.RTS_SndData(Settings.display_volume, VolumeIcon - 2); - rtscheck.RTS_SndData(Settings.display_volume << 8, SoundAddr + 1); - rtscheck.RTS_SndData(map(constrain(Settings.display_volume, 0, 255), 0, 255, 0, 100), VolumeDisplay); - rtscheck.RTS_SndData(Settings.screen_brightness, DisplayBrightness); - rtscheck.RTS_SndData(Settings.standby_screen_brightness, DisplayStandbyBrightness); - rtscheck.RTS_SndData(Settings.standby_time_seconds, DisplayStandbySeconds); - if (Settings.display_standby) - rtscheck.RTS_SndData(3, DisplayStandbyEnableIndicator); - else - rtscheck.RTS_SndData(2, DisplayStandbyEnableIndicator); - } - - void onPrinterKilled(FSTR_P const error, FSTR_P const component) { - rtscheck.RTS_SndData(ExchangePageBase + 88, ExchangepageAddr); - int16_t j = 0; - char outmsg[40]; - char killMsg[strlen_P(FTOP(error)) + strlen_P(FTOP(component)) + 3]; - sprintf_P(killMsg, PSTR(S_FMT ": " S_FMT), FTOP(error), FTOP(component)); - while (j < 4) { - outmsg[j] = '*'; - j++; - } - while (const char c = killMsg[j - 4]) { - outmsg[j] = c; - j++; - } - while (j < 40) { - outmsg[j] = '*'; - j++; - } - rtscheck.RTS_SndData(outmsg, MacVersion); - delay_ms(10); - } - - void onMediaInserted() { - filenavigator.reset(); - filenavigator.getFiles(0); - fileIndex = 0; - recordcount = 0; - } - - void onMediaError() { - filenavigator.reset(); - for (int16_t i = 0; i < MaxFileNumber; i++) - for (int16_t j = 0; j < 10; j++) rtscheck.RTS_SndData(0, SDFILE_ADDR + i * 10 + j); - - for (int16_t j = 0; j < 10; j++) { - rtscheck.RTS_SndData(0, Printfilename + j); // clean screen. - rtscheck.RTS_SndData(0, Choosefilename + j); // clean filename - } - for (int16_t j = 0; j < 8; j++) rtscheck.RTS_SndData(0, FilenameCount + j); - for (int16_t j = 1; j <= MaxFileNumber; j++) { - rtscheck.RTS_SndData(10, FilenameIcon + j); - rtscheck.RTS_SndData(10, FilenameIcon1 + j); - } - } - - void onMediaRemoved() { - filenavigator.reset(); - for (int16_t i = 0; i < MaxFileNumber; i++) - for (int16_t j = 0; j < 10; j++) rtscheck.RTS_SndData(0, SDFILE_ADDR + i * 10 + j); - - for (int16_t j = 0; j < 10; j++) { - rtscheck.RTS_SndData(0, Printfilename + j); // clean screen. - rtscheck.RTS_SndData(0, Choosefilename + j); // clean filename - } - for (int16_t j = 0; j < 8; j++) rtscheck.RTS_SndData(0, FilenameCount + j); - for (int16_t j = 1; j <= MaxFileNumber; j++) { - rtscheck.RTS_SndData(10, FilenameIcon + j); - rtscheck.RTS_SndData(10, FilenameIcon1 + j); - } - } - - void onPlayTone(const uint16_t frequency, const uint16_t duration) { - rtscheck.RTS_SndData(StartSoundSet, SoundAddr); - } - - void onPrintTimerStarted() { - if (waitway == 7) return; - PrinterStatusKey[1] = 3; - InforShowStatus = true; - delay_ms(1); - rtscheck.RTS_SndData(ExchangePageBase + 53, ExchangepageAddr); - } - - void onPrintTimerPaused() { - rtscheck.RTS_SndData(ExchangePageBase + 78, ExchangepageAddr); // Display Pause Screen - onStatusChanged(F("Pausing...")); - } - void onPrintTimerStopped() { - if (waitway == 3) return; - - #if FAN_COUNT > 0 - for (uint8_t i = 0; i < FAN_COUNT; i++) setTargetFan_percent(FanOff, (fan_t)i); - #endif - - PrinterStatusKey[0] = 0; - InforShowStatus = true; - TPShowStatus = false; - rtscheck.RTS_SndData(ExchangePageBase + 51, ExchangepageAddr); - } - - void onFilamentRunout() { - PrinterStatusKey[1] = 4; - TPShowStatus = false; - rtscheck.RTS_SndData(ExchangePageBase + 78, ExchangepageAddr); - } - void onFilamentRunout(extruder_t extruder) { - PrinterStatusKey[1] = 4; - TPShowStatus = false; - rtscheck.RTS_SndData(ExchangePageBase + 78, ExchangepageAddr); - } - void onUserConfirmRequired(const char *const msg) { - PrinterStatusKey[1] = 4; - TPShowStatus = false; - if (lastPauseMsgState == ExtUI::pauseModeStatus && msg == (const char*)GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD)) - return; - - switch (ExtUI::pauseModeStatus) { - case PAUSE_MESSAGE_WAITING: { - rtscheck.RTS_SndData(ExchangePageBase + 78, ExchangepageAddr); - onStatusChanged(F("Press Yes to Continue")); - break; - } - case PAUSE_MESSAGE_INSERT: { - rtscheck.RTS_SndData(ExchangePageBase + 78, ExchangepageAddr); - onStatusChanged(F("Load Filament to Continue")); - break; - } - case PAUSE_MESSAGE_HEAT: { - rtscheck.RTS_SndData(ExchangePageBase + 78, ExchangepageAddr); - onStatusChanged(F("Add Filament and Press Yes to Reheat")); - break; - } - - #if DISABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE) - case PAUSE_MESSAGE_PURGE: { - rtscheck.RTS_SndData(ExchangePageBase + 78, ExchangepageAddr); - char newMsg[40] = "Yes to "; - strcat_P(newMsg, TERN1(FILAMENT_RUNOUT_SENSOR, !ExtUI::getFilamentRunoutState() && getFilamentRunoutEnabled()) ? PSTR("Continue") : PSTR("Disable ")); - strcat_P(newMsg, PSTR(" No to Purge")); - onStatusChanged(newMsg); - break; - } - #endif - - case PAUSE_MESSAGE_OPTION: { - rtscheck.RTS_SndData(ExchangePageBase + 78, ExchangepageAddr); - char newMsg[40] = "Yes to "; - strcat_P(newMsg, TERN1(FILAMENT_RUNOUT_SENSOR, !ExtUI::getFilamentRunoutState() && getFilamentRunoutEnabled()) ? PSTR("Continue") : PSTR("Disable ")); - strcat_P(newMsg, PSTR(" No to Purge")); - onStatusChanged(newMsg); - break; - } - - case PAUSE_MESSAGE_PARKING: { - rtscheck.RTS_SndData(ExchangePageBase + 78, ExchangepageAddr); - onStatusChanged(F("Parking...")); - break; - } - case PAUSE_MESSAGE_CHANGING: { - rtscheck.RTS_SndData(ExchangePageBase + 78, ExchangepageAddr); - onStatusChanged(F("Beginning Filament Change")); - break; - } - case PAUSE_MESSAGE_UNLOAD: { - rtscheck.RTS_SndData(ExchangePageBase + 78, ExchangepageAddr); - onStatusChanged(F("Unloading...")); - break; - } - case PAUSE_MESSAGE_LOAD: { - rtscheck.RTS_SndData(ExchangePageBase + 78, ExchangepageAddr); - onStatusChanged(F("Reloading...")); - break; - } - case PAUSE_MESSAGE_RESUME: - #if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE) - case PAUSE_MESSAGE_PURGE: { - rtscheck.RTS_SndData(ExchangePageBase + 78, ExchangepageAddr); - onStatusChanged(F("Press Yes to Stop Purge")); - break; - } - #endif - - case PAUSE_MESSAGE_HEATING: { - rtscheck.RTS_SndData(ExchangePageBase + 68, ExchangepageAddr); - onStatusChanged(F("Reheating")); - break; - } - - case PAUSE_MESSAGE_STATUS: - default: { - setPauseMenuResponse(PAUSE_RESPONSE_RESUME_PRINT); - setUserConfirmed(); - break; - } - } - lastPauseMsgState = ExtUI::pauseModeStatus; - } - - void onStatusChanged(const char *const statMsg) { - for (int16_t j = 0; j < 20; j++) // Clear old message - rtscheck.RTS_SndData(' ', StatusMessageString + j); - rtscheck.RTS_SndData(statMsg, StatusMessageString); - } - void onFactoryReset() { - Settings.settings_size = sizeof(creality_dwin_settings_t); - Settings.settings_version = dwin_settings_version; - Settings.display_standby = true; - Settings.display_sound = true; - Settings.display_volume = 32; - Settings.standby_screen_brightness = 15; - Settings.screen_brightness = 100; - Settings.standby_time_seconds = 60; - Settings.screen_rotation = 0; - onStartup(); - startprogress = 0; - InforShowStatus = true; - } - - void onMeshUpdate(const int8_t xpos, const int8_t ypos, probe_state_t state) {} - - void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) { - if (waitway == 3) - if (isPositionKnown() && (getActualTemp_celsius(BED) >= (getTargetTemp_celsius(BED) - 1))) - rtscheck.RTS_SndData(ExchangePageBase + 64, ExchangepageAddr); - #if HAS_MESH - uint8_t abl_probe_index = 0; - for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) - for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) { - const bool zig = outer & 1; // != ((PR_OUTER_END) & 1); - const xy_uint8_t point = { uint8_t(zig ? (GRID_MAX_POINTS_X - 1) - inner : inner), outer }; - if (point.x == xpos && outer == ypos) - rtscheck.RTS_SndData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + (abl_probe_index * 2)); - ++abl_probe_index; - } - #endif - } - - void onStoreSettings(char *buff) { - static_assert( - ExtUI::eeprom_data_size >= sizeof(creality_dwin_settings_t), - "Insufficient space in EEPROM for UI parameters" - ); - - // Write to buffer - memcpy(buff, &Settings, sizeof(creality_dwin_settings_t)); - } - - void onLoadSettings(const char *buff) { - static_assert( - ExtUI::eeprom_data_size >= sizeof(creality_dwin_settings_t), - "Insufficient space in EEPROM for UI parameters" - ); - - creality_dwin_settings_t eepromSettings; - memcpy(&eepromSettings, buff, sizeof(creality_dwin_settings_t)); - - // If size is not the same, discard settings - if (eepromSettings.settings_size != sizeof(creality_dwin_settings_t)) { - onFactoryReset(); - return; - } - - if (eepromSettings.settings_version != dwin_settings_version) { - onFactoryReset(); - return; - } - - // Copy into final location - memcpy(&Settings, &eepromSettings, sizeof(creality_dwin_settings_t)); - - SetTouchScreenConfiguration(); - } - - void onSettingsStored(const bool success) { - // This is called after the entire EEPROM has been written, - // whether successful or not. - } - - void onSettingsLoaded(const bool success) { - #if HAS_MESH - if (ExtUI::getMeshValid()) { - uint8_t abl_probe_index = 0; - for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) - for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) { - const bool zig = outer & 1; - const xy_uint8_t point = { uint8_t(zig ? (GRID_MAX_POINTS_X - 1) - inner : inner), outer }; - rtscheck.RTS_SndData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + (abl_probe_index * 2)); - ++abl_probe_index; - } - - rtscheck.RTS_SndData(3, AutoLevelIcon); // 2=On, 3=Off - setLevelingActive(true); - } - else { - rtscheck.RTS_SndData(2, AutoLevelIcon); /*Off*/ - setLevelingActive(false); - } - #endif - - rtscheck.RTS_SndData(getZOffset_mm() * 100, ProbeOffset_Z); - SetTouchScreenConfiguration(); - } - - #if ENABLED(POWER_LOSS_RECOVERY) - void onSetPowerLoss(const bool onoff) { - // Called when power-loss is enabled/disabled - } - void onPowerLoss() { - // Called when power-loss state is detected - } - void onPowerLossResume() { - startprogress = 254; - InforShowStatus = true; - TPShowStatus = false; - reEntryPrevent = false; - rtscheck.RTS_SndData(ExchangePageBase + 76, ExchangepageAddr); - } - #endif - - #if HAS_PID_HEATING - void onPidTuning(const result_t rst) { - // Called for temperature PID tuning result - rtscheck.RTS_SndData(pid_hotendAutoTemp, HotendPID_AutoTmp); - rtscheck.RTS_SndData(pid_bedAutoTemp, BedPID_AutoTmp); - rtscheck.RTS_SndData(uint16_t(getPID_Kp(E0)) * 10, HotendPID_P); - rtscheck.RTS_SndData(uint16_t(getPID_Ki(E0)) * 10, HotendPID_I); - rtscheck.RTS_SndData(uint16_t(getPID_Kd(E0)) * 10, HotendPID_D); - #if ENABLED(PIDTEMPBED) - rtscheck.RTS_SndData(uint16_t(getBedPID_Kp()) * 10, BedPID_P); - rtscheck.RTS_SndData(uint16_t(getBedPID_Ki()) * 10, BedPID_I); - rtscheck.RTS_SndData(uint16_t(getBedPID_Kd()) * 10, BedPID_D); - #endif - onStatusChanged(F("PID Tune Finished")); - } - #endif - - void onLevelingStart() {} - - void onLevelingDone() { - #if HAS_MESH - if (ExtUI::getMeshValid()) { - uint8_t abl_probe_index = 0; - for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) - for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) { - const bool zig = outer & 1; - const xy_uint8_t point = { uint8_t(zig ? (GRID_MAX_POINTS_X - 1) - inner : inner), outer }; - rtscheck.RTS_SndData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + abl_probe_index * 2); - ++abl_probe_index; - } - - rtscheck.RTS_SndData(3, AutoLevelIcon); // 2=On, 3=Off - setLevelingActive(true); - } - else { - rtscheck.RTS_SndData(2, AutoLevelIcon); /*Off*/ - setLevelingActive(false); - } - #endif - } - - void onSteppersEnabled() {} - void onPrintDone() {} - void onHomingStart() {} - void onHomingDone() {} - void onSteppersDisabled() {} - void onPostprocessSettings() {} - -} // namespace ExtUI - -#endif // DGUS_LCD_UI_IA_CREALITY diff --git a/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp b/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp new file mode 100644 index 0000000000000..51180206db36e --- /dev/null +++ b/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp @@ -0,0 +1,2094 @@ +/** + * 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 . + * + */ + +/* **************************************** + * lcd/extui/ia_creality/ia_creality_extui.cpp + * **************************************** + * Extensible_UI implementation for Creality DWIN + * 10SPro, Max, CRX, and others + * Based original Creality release, ported to ExtUI for Marlin 2.0 + * Written by Insanity Automation, sponsored by Tiny Machines 3D + * + * ***************************************/ + +#include "../../../inc/MarlinConfigPre.h" + +#if DGUS_LCD_UI_IA_CREALITY + +#include "ia_creality_extui.h" +#include "FileNavigator.h" + +// Singleton instance +RTS rts; + +// Static data +DB RTS::recdat, RTS::snddat; +uint8_t RTS::databuf[DATA_BUF_SIZE]; +rx_datagram_state_t RTS::rx_datagram_state = DGUS_IDLE; +uint8_t RTS::rx_datagram_len = 0; + +// Local data +uint16_t fileIndex = 0; +uint8_t recordcount = 0; +uint8_t waitway_lock = 0; +const float manual_feedrate_mm_m[] = MANUAL_FEEDRATE; +uint8_t startprogress = 0; + +char waitway = 0; +int16_t recnum = 0; +float ChangeMaterialbuf[2] = { 0 }; + +char NozzleTempStatus[3] = { 0 }; + +char PrinterStatusKey[2] = { 0 }; // PrinterStatusKey[1] 0:keep temperature, 1:heating, 2:cooling, 3:printing + // PrinterStatusKey[0] 0:ready + +uint8_t AxisPagenum = 0; // 0 for 10mm, 1 for 1mm, 2 for 0.1mm +bool InforShowStatus = true; +bool TPShowStatus = false; // true for only opening time and percentage, false for closing time and percentage. +bool AutohomeKey = false; +uint8_t AutoHomeIconNum; +int16_t userConfValidation = 0; + +uint8_t lastPauseMsgState = 0; + +creality_dwin_settings_t Settings; +uint8_t dwin_settings_version = 1; + +bool reEntryPrevent = false; +uint8_t reEntryCount = 0; +uint16_t idleThrottling = 0; + +bool pause_resume_selected = false; + +#if HAS_PID_HEATING + uint16_t pid_hotendAutoTemp = 150; + uint16_t pid_bedAutoTemp = 70; +#endif + +#ifndef IA_CREALITY_BOOT_DELAY + #define IA_CREALITY_BOOT_DELAY 500 +#endif + +void RTS::onStartup() { + DWIN_SERIAL.begin(115200); + recdat.head[0] = snddat.head[0] = FHONE; + recdat.head[1] = snddat.head[1] = FHTWO; + ZERO(databuf); + + delay_ms(IA_CREALITY_BOOT_DELAY); // Delay to allow screen startup + setTouchScreenConfiguration(); + sendData(StartSoundSet, SoundAddr); + delay_ms(400); // Delay to allow screen to configure + + onStatusChanged(MACHINE_NAME " Ready"); + + sendData(100, FeedrateDisplay); + + /***************turn off motor*****************/ + sendData(11, FilenameIcon); + + /***************transmit temperature to screen*****************/ + sendData(0, NozzlePreheat); + sendData(0, BedPreheat); + sendData(getActualTemp_celsius(H0), NozzleTemp); + sendData(TERN0(HAS_MULTI_HOTEND, getActualTemp_celsius(H1)), e2Temp); + sendData(getActualTemp_celsius(BED), Bedtemp); + /***************transmit Fan speed to screen*****************/ + sendData(getActualFan_percent((fan_t)getActiveTool()), FanKeyIcon); + + /***************transmit Printer information to screen*****************/ + for (int16_t j = 0; j < 20; j++) // clean filename + sendData(0, MacVersion + j); + char sizebuf[20] = {0}; + sprintf(sizebuf, "%d X %d X %d", Y_BED_SIZE, X_BED_SIZE, Z_MAX_POS); + sendData(MACHINE_NAME, MacVersion); + sendData(SHORT_BUILD_VERSION, SoftVersion); + sendData(sizebuf, PrinterSize); + sendData(WEBSITE_URL, CorpWebsite); + + /**************************some info init*******************************/ + sendData(0, PrintscheduleIcon); + sendData(0, PrintscheduleIcon + 1); + + /************************clean screen*******************************/ + for (int16_t i = 0; i < MaxFileNumber; i++) + for (int16_t j = 0; j < 10; j++) sendData(0, SDFILE_ADDR + i * 10 + j); + + for (int16_t j = 0; j < 10; j++) { + sendData(0, Printfilename + j); // clean screen. + sendData(0, Choosefilename + j); // clean filename + } + for (int16_t j = 0; j < 8; j++) sendData(0, FilenameCount + j); + for (int16_t j = 1; j <= MaxFileNumber; j++) { + sendData(10, FilenameIcon + j); + sendData(10, FilenameIcon1 + j); + } +} + +void RTS::onIdle() { + while (rts.receiveData() > 0 && (rts.recdat.data[0] != 0 || rts.recdat.addr != 0)) + rts.handleData(); + + if (reEntryPrevent && reEntryCount < 120) { reEntryCount++; return; } + reEntryCount = 0; + + if (idleThrottling++ < 750) return; + + // Always send temperature data + rts.sendData(getActualTemp_celsius(getActiveTool()), NozzleTemp); + rts.sendData(getActualTemp_celsius(BED), Bedtemp); + rts.sendData(getTargetTemp_celsius(getActiveTool()), NozzlePreheat); + rts.sendData(getTargetTemp_celsius(BED), BedPreheat); + rts.sendData(TERN0(HAS_MULTI_HOTEND, getActualTemp_celsius(H1)), e2Temp); + rts.sendData(TERN0(HAS_MULTI_HOTEND, getTargetTemp_celsius(H1)), e2Preheat); + TERN_(HAS_MULTI_HOTEND, rts.sendData(uint8_t(getActiveTool() + 1), ActiveToolVP)); + + if (awaitingUserConfirm() && (lastPauseMsgState != ExtUI::pauseModeStatus || userConfValidation > 99)) { + switch (ExtUI::pauseModeStatus) { + case PAUSE_MESSAGE_PARKING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_PAUSE_PRINT_PARKING)); break; + case PAUSE_MESSAGE_CHANGING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_INIT)); break; + case PAUSE_MESSAGE_UNLOAD: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_UNLOAD)); break; + case PAUSE_MESSAGE_WAITING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_ADVANCED_PAUSE_WAITING)); break; + case PAUSE_MESSAGE_INSERT: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_INSERT)); break; + case PAUSE_MESSAGE_LOAD: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD)); break; + case PAUSE_MESSAGE_PURGE: ExtUI::onUserConfirmRequired(GET_TEXT_F(TERN(ADVANCED_PAUSE_CONTINUOUS_PURGE, MSG_FILAMENT_CHANGE_CONT_PURGE, MSG_FILAMENT_CHANGE_PURGE))); break; + case PAUSE_MESSAGE_RESUME: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_RESUME)); break; + case PAUSE_MESSAGE_HEAT: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEAT)); break; + case PAUSE_MESSAGE_HEATING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEATING)); break; + case PAUSE_MESSAGE_OPTION: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_OPTION_HEADER)); break; + case PAUSE_MESSAGE_STATUS: break; + default: onUserConfirmRequired(PSTR("Confirm Continue")); break; + } + userConfValidation = 0; + } + else if (pause_resume_selected && !awaitingUserConfirm()) { + rts.sendData(ExchangePageBase + 53, ExchangepageAddr); + pause_resume_selected = false; + userConfValidation = 0; + } + else if (awaitingUserConfirm()) { + if (pause_resume_selected) { + pause_resume_selected = false; + userConfValidation = 100; + } + else + userConfValidation++; + } + + reEntryPrevent = true; + idleThrottling = 0; + if (waitway && !commandsInQueue()) + waitway_lock++; + else + waitway_lock = 0; + + if (waitway_lock > 100) { + waitway_lock = 0; + waitway = 0; // clear waitway if nothing is going on + } + + switch (waitway) { + case 1: + if (isPositionKnown()) { + InforShowStatus = true; + rts.sendData(ExchangePageBase + 54, ExchangepageAddr); + waitway = 0; + } + break; + + case 2: + if (isPositionKnown() && !commandsInQueue()) waitway = 0; + break; + + case 3: + //if(isPositionKnown() && (getActualTemp_celsius(BED) >= (getTargetTemp_celsius(BED)-1))) { + rts.sendData(ExchangePageBase + 64, ExchangepageAddr); + waitway = 7; + //return; + //} + break; + + case 4: + if (AutohomeKey && isPositionKnown() && !commandsInQueue()) { // Manual Move Home Done + //rts.sendData(ExchangePageBase + 71 + AxisPagenum, ExchangepageAddr); + AutohomeKey = false; + waitway = 0; + } + break; + case 5: + if (isPositionKnown() && !commandsInQueue()) { + InforShowStatus = true; + waitway = 0; + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); // exchange to 78 page + } + break; + case 6: + if (!commandsInQueue()) { + setAxisPosition_mm(BED_TRAMMING_HEIGHT, axis_t(Z)); + waitway = 0; + } + break; + case 7: + if (!commandsInQueue()) waitway = 0; + break; + } + + TERN_(HAS_MESH, rts.sendData(getLevelingActive() ? 3 : 2, AutoLevelIcon)); + TERN_(HAS_FILAMENT_SENSOR, rts.sendData(getFilamentRunoutEnabled() ? 3 : 2, RunoutToggle)); + TERN_(CASE_LIGHT_ENABLE, rts.sendData(getCaseLightState() ? 3 : 2, LedToggle)); + TERN_(POWER_LOSS_RECOVERY, rts.sendData(getPowerLossRecoveryEnabled() ? 3 : 2, PowerLossToggle)); + + if (startprogress == 0) { + startprogress += 25; + delay_ms(3000); // Delay to show bootscreen + } + else if (startprogress < 250) { + if (isMediaInserted()) // Re init media as it happens too early on STM32 boards often + onMediaInserted(); + else + injectCommands(F("M22\nM21")); + startprogress = 254; + InforShowStatus = true; + TPShowStatus = false; + rts.sendData(ExchangePageBase + 45, ExchangepageAddr); + reEntryPrevent = false; + return; + } + if (startprogress <= 100) + rts.sendData(startprogress, StartIcon); + else + rts.sendData(startprogress - 100, StartIcon + 1); + + //rts.sendData((startprogress++) % 5, ExchFlmntIcon); + + if (isPrinting()) { + rts.sendData(getActualFan_percent((fan_t)getActiveTool()), FanKeyIcon); + rts.sendData(getProgress_seconds_elapsed() / 3600, Timehour); + rts.sendData((getProgress_seconds_elapsed() % 3600) / 60, Timemin); + if (getProgress_percent() > 0) { + const uint16_t perc = getProgress_percent() + 1; + if (perc <= 50) { + rts.sendData(uint16_t(perc) * 2, PrintscheduleIcon); + rts.sendData(0, PrintscheduleIcon + 1); + } + else { + rts.sendData(100, PrintscheduleIcon); + rts.sendData(uint16_t(perc) * 2 - 100, PrintscheduleIcon + 1); + } + } + else { + rts.sendData(0, PrintscheduleIcon); + rts.sendData(0, PrintscheduleIcon + 1); + } + rts.sendData(uint16_t(getProgress_percent()), Percentage); + } + else { // Not printing settings + rts.sendData(map(constrain(Settings.display_volume, 0, 255), 0, 255, 0, 100), VolumeDisplay); + rts.sendData(Settings.screen_brightness, DisplayBrightness); + rts.sendData(Settings.standby_screen_brightness, DisplayStandbyBrightness); + rts.sendData(Settings.standby_time_seconds, DisplayStandbySeconds); + if (Settings.display_standby) + rts.sendData(3, DisplayStandbyEnableIndicator); + else + rts.sendData(2, DisplayStandbyEnableIndicator); + + rts.sendData(getAxisSteps_per_mm(X) * 10, StepMM_X); + rts.sendData(getAxisSteps_per_mm(Y) * 10, StepMM_Y); + rts.sendData(getAxisSteps_per_mm(Z) * 10, StepMM_Z); + rts.sendData(getAxisSteps_per_mm(E0) * 10, StepMM_E); + + rts.sendData(getAxisMaxAcceleration_mm_s2(X) / 100, Accel_X); + rts.sendData(getAxisMaxAcceleration_mm_s2(Y) / 100, Accel_Y); + rts.sendData(getAxisMaxAcceleration_mm_s2(Z) / 10, Accel_Z); + rts.sendData(getAxisMaxAcceleration_mm_s2(E0), Accel_E); + + rts.sendData(getAxisMaxFeedrate_mm_s(X), Feed_X); + rts.sendData(getAxisMaxFeedrate_mm_s(Y), Feed_Y); + rts.sendData(getAxisMaxFeedrate_mm_s(Z), Feed_Z); + rts.sendData(getAxisMaxFeedrate_mm_s(E0), Feed_E); + + rts.sendData(getAxisMaxJerk_mm_s(X) * 100, Jerk_X); + rts.sendData(getAxisMaxJerk_mm_s(Y) * 100, Jerk_Y); + rts.sendData(getAxisMaxJerk_mm_s(Z) * 100, Jerk_Z); + rts.sendData(getAxisMaxJerk_mm_s(E0) * 100, Jerk_E); + + #if HAS_HOTEND_OFFSET + rts.sendData(getNozzleOffset_mm(X, E1) * 10, T2Offset_X); + rts.sendData(getNozzleOffset_mm(Y, E1) * 10, T2Offset_Y); + rts.sendData(getNozzleOffset_mm(Z, E1) * 10, T2Offset_Z); + rts.sendData(getAxisSteps_per_mm(E1) * 10, T2StepMM_E); + #endif + + #if HAS_BED_PROBE + rts.sendData(getProbeOffset_mm(X) * 100, ProbeOffset_X); + rts.sendData(getProbeOffset_mm(Y) * 100, ProbeOffset_Y); + #endif + + #if HAS_PID_HEATING + rts.sendData(pid_hotendAutoTemp, HotendPID_AutoTmp); + rts.sendData(pid_bedAutoTemp, BedPID_AutoTmp); + rts.sendData(getPID_Kp(E0) * 10, HotendPID_P); + rts.sendData(getPID_Ki(E0) * 10, HotendPID_I); + rts.sendData(getPID_Kd(E0) * 10, HotendPID_D); + #if ENABLED(PIDTEMPBED) + rts.sendData(getBedPID_Kp() * 10, BedPID_P); + rts.sendData(getBedPID_Ki() * 10, BedPID_I); + rts.sendData(getBedPID_Kd() * 10, BedPID_D); + #endif + #endif + } + + rts.sendData(getZOffset_mm() * 100, ProbeOffset_Z); + rts.sendData(uint16_t(getFlow_percent(E0)), Flowrate); + + if (NozzleTempStatus[0] || NozzleTempStatus[2]) { // statuse of loadfilament and unloadfinement when temperature is less than + uint16_t IconTemp = getActualTemp_celsius(getActiveTool()) * 100 / getTargetTemp_celsius(getActiveTool()); + NOMORE(IconTemp, 100U); + rts.sendData(IconTemp, HeatPercentIcon); + if (getActualTemp_celsius(getActiveTool()) > EXTRUDE_MINTEMP && NozzleTempStatus[0] != 0) { + NozzleTempStatus[0] = 0; + rts.sendData(10 * ChangeMaterialbuf[0], FilamentUnit1); + rts.sendData(10 * ChangeMaterialbuf[1], FilamentUnit2); + rts.sendData(ExchangePageBase + 65, ExchangepageAddr); + } + else if (getActualTemp_celsius(getActiveTool()) >= getTargetTemp_celsius(getActiveTool()) && NozzleTempStatus[2]) { + NozzleTempStatus[2] = 0; + TPShowStatus = true; + rts.sendData(4, ExchFlmntIcon); + rts.sendData(ExchangePageBase + 83, ExchangepageAddr); + } + else if (NozzleTempStatus[2]) { + //rts.sendData((startprogress++) % 5, ExchFlmntIcon); + } + } + + if (AutohomeKey) { + rts.sendData(AutoHomeIconNum, AutoZeroIcon); + if (++AutoHomeIconNum > 9) AutoHomeIconNum = 0; + } + + if (isMediaInserted()) { + const uint16_t currPage = fileIndex == 0 ? 1 : CEIL(float(fileIndex) / float(DISPLAY_FILES)) + 1, + maxPageAdd = filenavigator.folderdepth ? 1 : 0, + maxPages = CEIL(float(filenavigator.maxFiles() + maxPageAdd) / float(DISPLAY_FILES) ); + + rts.sendData(currPage, FilesCurentPage); + rts.sendData(maxPages, FilesMaxPage); + } + else { + rts.sendData(0, FilesCurentPage); + rts.sendData(0, FilesMaxPage); + } + + if (rts.recdat.addr != DisplayZaxis && rts.recdat.addr != DisplayYaxis && rts.recdat.addr != DisplayZaxis) { + rts.sendData(10 * getAxisPosition_mm(axis_t(X)), DisplayXaxis); + rts.sendData(10 * getAxisPosition_mm(axis_t(Y)), DisplayYaxis); + rts.sendData(10 * getAxisPosition_mm(axis_t(Z)), DisplayZaxis); + } + reEntryPrevent = false; +} + +RTS::RTS() { + recdat.head[0] = snddat.head[0] = FHONE; + recdat.head[1] = snddat.head[1] = FHTWO; + ZERO(databuf); +} + +int16_t RTS::receiveData() { + uint8_t receivedbyte; + while (DWIN_SERIAL.available()) + switch (rx_datagram_state) { + + case DGUS_IDLE: // Waiting for the first header byte + receivedbyte = DWIN_SERIAL.read(); + if (FHONE == receivedbyte) rx_datagram_state = DGUS_HEADER1_SEEN; + break; + + case DGUS_HEADER1_SEEN: // Waiting for the second header byte + receivedbyte = DWIN_SERIAL.read(); + rx_datagram_state = (FHTWO == receivedbyte) ? DGUS_HEADER2_SEEN : DGUS_IDLE; + break; + + case DGUS_HEADER2_SEEN: // Waiting for the length byte + rx_datagram_len = DWIN_SERIAL.read(); + //DEBUGLCDCOMM_ECHOPGM(" (", rx_datagram_len, ") "); + + // Telegram min len is 3 (command and one word of payload) + rx_datagram_state = WITHIN(rx_datagram_len, 3, DGUS_RX_BUFFER_SIZE) ? DGUS_WAIT_TELEGRAM : DGUS_IDLE; + break; + + case DGUS_WAIT_TELEGRAM: // wait for complete datagram to arrive. + if (DWIN_SERIAL.available() < rx_datagram_len) return -1; + + uint8_t command = DWIN_SERIAL.read(); + + //DEBUGLCDCOMM_ECHOPGM("# ", command); + + uint8_t readlen = rx_datagram_len - 1; // command is part of len. + uint8_t tmp[rx_datagram_len - 1]; + uint8_t *ptmp = tmp; + while (readlen--) { + receivedbyte = DWIN_SERIAL.read(); + //DEBUGLCDCOMM_ECHOPGM(" ", receivedbyte); + *ptmp++ = receivedbyte; + } + //DEBUGLCDCOMM_ECHOPGM(" # "); + // mostly we'll get this: 5A A5 03 82 4F 4B -- ACK on 0x82, so discard it. + if (command == VarAddr_W && 'O' == tmp[0] && 'K' == tmp[1]) { + rx_datagram_state = DGUS_IDLE; + break; + } + + /* AutoUpload, (and answer to) Command 0x83 : + | tmp[0 1 2 3 4 ... ] + | Example 5A A5 06 83 20 01 01 78 01 …… + | / / | | \ / | \ \ + | Header | | | | \_____\_ DATA (Words!) + | DatagramLen / VPAdr | + | Command DataLen (in Words) */ + if (command == VarAddr_R) { + const uint16_t vp = tmp[0] << 8 | tmp[1]; + + const uint8_t dlen = tmp[2] << 1; // Convert to Bytes. (Display works with words) + recdat.addr = vp; + recdat.len = tmp[2]; + for (uint16_t i = 0; i < dlen; i += 2) { + recdat.data[i / 2] = tmp[3 + i]; + recdat.data[i / 2] = (recdat.data[i / 2] << 8 ) | tmp[4 + i]; + } + + rx_datagram_state = DGUS_IDLE; + return 2; + break; + } + + // discard anything else + rx_datagram_state = DGUS_IDLE; + } + return -1; +} + +void RTS::sendData() { + if (snddat.head[0] == FHONE && snddat.head[1] == FHTWO && snddat.len >= 3) { + databuf[0] = snddat.head[0]; + databuf[1] = snddat.head[1]; + databuf[2] = snddat.len; + databuf[3] = snddat.command; + if (snddat.command == 0x80) { // to write data to the register + databuf[4] = snddat.addr; + for (int16_t i = 0; i < (snddat.len - 2); i++) databuf[5 + i] = snddat.data[i]; + } + else if (snddat.len == 3 && (snddat.command == 0x81)) { // to read data from the register + databuf[4] = snddat.addr; + databuf[5] = snddat.bytelen; + } + else if (snddat.command == 0x82) { // to write data to the variate + databuf[4] = snddat.addr >> 8; + databuf[5] = snddat.addr & 0xFF; + for (int16_t i = 0; i < (snddat.len - 3); i += 2) { + databuf[6 + i] = snddat.data[i / 2] >> 8; + databuf[7 + i] = snddat.data[i / 2] & 0xFF; + } + } + else if (snddat.len == 4 && (snddat.command == 0x83)) { // to read data from the variate + databuf[4] = snddat.addr >> 8; + databuf[5] = snddat.addr & 0xFF; + databuf[6] = snddat.bytelen; + } + for (int16_t i = 0; i < (snddat.len + 3); i++) { + DWIN_SERIAL.write(databuf[i]); + delay_us(1); + } + + memset(&snddat, 0, sizeof(snddat)); + ZERO(databuf); + snddat.head[0] = FHONE; + snddat.head[1] = FHTWO; + } +} + +void RTS::sendData(const String &s, uint32_t addr, uint8_t cmd/*=VarAddr_W*/) { + if (s.length() < 1) return; + sendData(s.c_str(), addr, cmd); +} + +void RTS::sendData(const char *str, uint32_t addr, uint8_t cmd/*=VarAddr_W*/) { + int16_t len = strlen(str); + constexpr int16_t maxlen = DATA_BUF_SIZE - 6; + if (len > 0) { + if (len > maxlen) len = maxlen; + databuf[0] = FHONE; + databuf[1] = FHTWO; + databuf[2] = 3 + len; + databuf[3] = cmd; + databuf[4] = addr >> 8; + databuf[5] = addr & 0x00FF; + for (int16_t i = 0; i < len; i++) databuf[6 + i] = str[i]; + + for (int16_t i = 0; i < (len + 6); i++) { + DWIN_SERIAL.write(databuf[i]); + delay_us(1); + } + ZERO(databuf); + } +} + +void RTS::sendData(const char c, const uint32_t addr, const uint8_t cmd/*=VarAddr_W*/) { + snddat.command = cmd; + snddat.addr = addr; + snddat.data[0] = uint32_t(uint16_t(c) << 8); + snddat.len = 5; + sendData(); +} + +void RTS::sendData(const_float_t f, const uint32_t addr, const uint8_t cmd/*=VarAddr_W*/) { + int16_t n = f; + if (cmd == VarAddr_W) { + snddat.data[0] = n; + snddat.len = 5; + } + else if (cmd == RegAddr_W) { + snddat.data[0] = n; + snddat.len = 3; + } + else if (cmd == VarAddr_R) { + snddat.bytelen = n; + snddat.len = 4; + } + snddat.command = cmd; + snddat.addr = addr; + sendData(); +} + +void RTS::sendData(const int n, const uint32_t addr, const uint8_t cmd/*=VarAddr_W*/) { + if (cmd == VarAddr_W) { + if ((unsigned int)n > 0xFFFF) { + snddat.data[0] = n >> 16; + snddat.data[1] = n & 0xFFFF; + snddat.len = 7; + } + else { + snddat.data[0] = n; + snddat.len = 5; + } + } + else if (cmd == RegAddr_W) { + snddat.data[0] = n; + snddat.len = 3; + } + else if (cmd == VarAddr_R) { + snddat.bytelen = n; + snddat.len = 4; + } + snddat.command = cmd; + snddat.addr = addr; + sendData(); +} + +void RTS::sendData(const unsigned long n, uint32_t addr, uint8_t cmd/*=VarAddr_W*/) { + if (cmd == VarAddr_W) { + if (n > 0xFFFF) { + snddat.data[0] = n >> 16; + snddat.data[1] = n & 0xFFFF; + //snddat.data[0] = n >> 24; + //snddat.data[1] = n >> 16; + //snddat.data[2] = n >> 8; + //snddat.data[3] = n; + snddat.len = 7; + } + else { + snddat.data[0] = n; + snddat.len = 5; + } + } + else if (cmd == VarAddr_R) { + snddat.bytelen = n; + snddat.len = 4; + } + snddat.command = cmd; + snddat.addr = addr; + sendData(); +} + +void RTS::handleData() { + int16_t Checkkey = -1; + if (waitway > 0) { // for waiting + memset(&recdat, 0, sizeof(recdat)); + recdat.head[0] = FHONE; + recdat.head[1] = FHTWO; + return; + } + for (int16_t i = 0; Addrbuf[i] != 0; i++) + if (recdat.addr == Addrbuf[i]) { + if (Addrbuf[i] == NzBdSet || Addrbuf[i] == NozzlePreheat || Addrbuf[i] == BedPreheat || Addrbuf[i] == Flowrate) + Checkkey = ManualSetTemp; + else if (WITHIN(Addrbuf[i], Stopprint, Resumeprint)) + Checkkey = PrintChoice; + else if (WITHIN(Addrbuf[i], AutoZero, DisplayZaxis)) + Checkkey = XYZEaxis; + else if (WITHIN(Addrbuf[i], FilamentUnit1, FilamentUnit2)) + Checkkey = Filament; + else + Checkkey = i; + break; + } + + switch (recdat.addr) { + case Flowrate: + case StepMM_X ... StepMM_E: + case ProbeOffset_X ... ProbeOffset_Y: + case HotendPID_AutoTmp ... BedPID_AutoTmp: + case HotendPID_P ... HotendPID_D: + case BedPID_P ... BedPID_D: + case T2Offset_X ... T2StepMM_E: + case Accel_X ... Accel_E: + case Feed_X ... Feed_E: + case Jerk_X ... Jerk_E: + case RunoutToggle: + case PowerLossToggle: + case FanKeyIcon: + case LedToggle: + case e2Preheat: Checkkey = ManualSetTemp; break; + case ProbeOffset_Z: Checkkey = Zoffset_Value; break; + case VolumeDisplay: Checkkey = VolumeDisplay; break; + case DisplayBrightness: Checkkey = DisplayBrightness; break; + case DisplayStandbyBrightness: Checkkey = DisplayStandbyBrightness; break; + case DisplayStandbySeconds: Checkkey = DisplayStandbySeconds; break; + default: + if (WITHIN(recdat.addr, AutolevelVal, 4400)) // (int16_t(AutolevelVal) + GRID_MAX_POINTS * 2) = 4400 with 5x5 mesh + Checkkey = AutolevelVal; + else if (WITHIN(recdat.addr, SDFILE_ADDR, SDFILE_ADDR + 10 * (FileNum + 1))) + Checkkey = Filename; + break; + } + + if (Checkkey < 0) { + memset(&recdat, 0, sizeof(recdat)); + recdat.head[0] = FHONE; + recdat.head[1] = FHTWO; + return; + } + + constexpr float lfrb[4] = BED_TRAMMING_INSET_LFRB; + + switch (Checkkey) { + case Printfile: + if (recdat.data[0] == 1) { // card + InforShowStatus = false; + filenavigator.getFiles(0); + fileIndex = 0; + recordcount = 0; + sendData(ExchangePageBase + 46, ExchangepageAddr); + } + else if (recdat.data[0] == 2) { // return after printing result. + InforShowStatus = true; + TPShowStatus = false; + stopPrint(); + injectCommands(F("M84")); + sendData(11, FilenameIcon); + sendData(0, PrintscheduleIcon); + sendData(0, PrintscheduleIcon + 1); + sendData(0, Percentage); + delay_ms(2); + sendData(0, Timehour); + sendData(0, Timemin); + + sendData(ExchangePageBase + 45, ExchangepageAddr); // exchange to 45 page + } + else if (recdat.data[0] == 3) { // Temperature control + InforShowStatus = true; + TPShowStatus = false; + if (getTargetFan_percent((fan_t)getActiveTool()) == 0) + sendData(ExchangePageBase + 58, ExchangepageAddr); // exchange to 58 page, the fans off + else + sendData(ExchangePageBase + 57, ExchangepageAddr); // exchange to 57 page, the fans on + } + else if (recdat.data[0] == 4) { // Settings + InforShowStatus = false; + } + break; + + case Adjust: + if (recdat.data[0] == 1) { + InforShowStatus = false; + } + else if (recdat.data[0] == 2) { + InforShowStatus = true; + if (PrinterStatusKey[1] == 3) // during heating + sendData(ExchangePageBase + 53, ExchangepageAddr); + else if (PrinterStatusKey[1] == 4) + sendData(ExchangePageBase + 54, ExchangepageAddr); + else + sendData(ExchangePageBase + 53, ExchangepageAddr); + } + else if (recdat.data[0] == 3) + setTargetFan_percent(getTargetFan_percent((fan_t)getActiveTool()) != 0 ? 100 : 0, FAN0); + + break; + + case Feedrate: + setFeedrate_percent(recdat.data[0]); + break; + + case PrintChoice: + if (recdat.addr == Stopprint) { + if (recdat.data[0] == 240) { // no + sendData(ExchangePageBase + 53, ExchangepageAddr); + } + else { + sendData(ExchangePageBase + 45, ExchangepageAddr); + sendData(0, Timehour); + sendData(0, Timemin); + stopPrint(); + } + } + else if (recdat.addr == Pauseprint) { + if (recdat.data[0] != 0xF1) + break; + + sendData(ExchangePageBase + 54, ExchangepageAddr); + pausePrint(); + } + else if (recdat.addr == Resumeprint && recdat.data[0] == 1) { + resumePrint(); + + PrinterStatusKey[1] = 0; + InforShowStatus = true; + + sendData(ExchangePageBase + 53, ExchangepageAddr); + } + if (recdat.addr == Resumeprint && recdat.data[0] == 2) { // warming + resumePrint(); + NozzleTempStatus[2] = 1; + PrinterStatusKey[1] = 0; + InforShowStatus = true; + sendData(ExchangePageBase + 82, ExchangepageAddr); + } + break; + + case Zoffset: + float tmp_zprobe_offset; + if (recdat.data[0] >= 32768) + tmp_zprobe_offset = (float(recdat.data[0]) - 65536) / 100; + else + tmp_zprobe_offset = float(recdat.data[0]) / 100; + if (WITHIN((tmp_zprobe_offset), Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { + int16_t tmpSteps = mmToWholeSteps(getZOffset_mm() - tmp_zprobe_offset, axis_t(Z)); + if (tmpSteps == 0) tmpSteps = getZOffset_mm() < tmp_zprobe_offset ? 1 : -1; + smartAdjustAxis_steps(-tmpSteps, axis_t(Z), false); + char zOffs[20], tmp1[11]; + sprintf_P(zOffs, PSTR("Z Offset : %s"), dtostrf(getZOffset_mm(), 1, 3, tmp1)); + onStatusChanged(zOffs); + } + else { + onStatusChanged(F("Requested Offset Beyond Limits")); + } + + sendData(getZOffset_mm() * 100, ProbeOffset_Z); + break; + + case TempControl: + if (recdat.data[0] == 0) { + InforShowStatus = true; + TPShowStatus = false; + } + else if (recdat.data[0] == 1) { + if (getTargetFan_percent((fan_t)getActiveTool()) == 0) + sendData(ExchangePageBase + 60, ExchangepageAddr); // exchange to 60 page, the fans off + else + sendData(ExchangePageBase + 59, ExchangepageAddr); // exchange to 59 page, the fans on + } + else if (recdat.data[0] == 2) { + InforShowStatus = true; + } + else if (recdat.data[0] == 3) { + if (getTargetFan_percent((fan_t)getActiveTool()) == 0) { // turn on the fan + setTargetFan_percent(100, FAN0); + sendData(ExchangePageBase + 57, ExchangepageAddr); // exchange to 57 page, the fans on + } + else { // turn off the fan + setTargetFan_percent(0, FAN0); + sendData(ExchangePageBase + 58, ExchangepageAddr); // exchange to 58 page, the fans on + } + } + else if (recdat.data[0] == 5) { // PLA mode + setTargetTemp_celsius(PREHEAT_1_TEMP_HOTEND, getActiveTool()); + setTargetTemp_celsius(PREHEAT_1_TEMP_BED, BED); + sendData(PREHEAT_1_TEMP_HOTEND, NozzlePreheat); + sendData(PREHEAT_1_TEMP_BED, BedPreheat); + } + else if (recdat.data[0] == 6) { // ABS mode + setTargetTemp_celsius(PREHEAT_2_TEMP_HOTEND, getActiveTool()); + setTargetTemp_celsius(PREHEAT_2_TEMP_BED, BED); + sendData(PREHEAT_2_TEMP_HOTEND, NozzlePreheat); + sendData(PREHEAT_2_TEMP_BED, BedPreheat); + } + else if (recdat.data[0] == 0xF1) { + //InforShowStatus = true; + #if FAN_COUNT > 0 + for (uint8_t i = 0; i < FAN_COUNT; i++) setTargetFan_percent(0, (fan_t)i); + #endif + setTargetTemp_celsius(0.0, H0); + TERN_(HAS_MULTI_HOTEND, setTargetTemp_celsius(0.0, H1)); + setTargetTemp_celsius(0.0, BED); + sendData(0, NozzlePreheat); delay_ms(1); + sendData(0, BedPreheat); delay_ms(1); + sendData(ExchangePageBase + 57, ExchangepageAddr); + PrinterStatusKey[1] = 2; + } + break; + + case ManualSetTemp: + if (recdat.addr == NzBdSet) { + if (recdat.data[0] == 0) { + if (getTargetFan_percent((fan_t)getActiveTool()) == 0) + sendData(ExchangePageBase + 58, ExchangepageAddr); // exchange to 58 page, the fans off + else + sendData(ExchangePageBase + 57, ExchangepageAddr); // exchange to 57 page, the fans on + } + else if (recdat.data[0] == 1) { + setTargetTemp_celsius(0.0, getActiveTool()); + sendData(0, NozzlePreheat); + } + else if (recdat.data[0] == 2) { + setTargetTemp_celsius(0.0, BED); + sendData(0, BedPreheat); + } + } + else if (recdat.addr == NozzlePreheat) { + setTargetTemp_celsius(float(recdat.data[0]), H0); + } + #if HAS_MULTI_HOTEND + else if (recdat.addr == e2Preheat) { + setTargetTemp_celsius(float(recdat.data[0]), H1); + } + #endif + else if (recdat.addr == BedPreheat) { + setTargetTemp_celsius(float(recdat.data[0]), BED); + } + else if (recdat.addr == Flowrate) { + setFlow_percent(int16_t(recdat.data[0]), getActiveTool()); + } + + #if HAS_PID_HEATING + else if (recdat.addr == HotendPID_AutoTmp) { + pid_hotendAutoTemp = uint16_t(recdat.data[0]); + } + else if (recdat.addr == BedPID_AutoTmp) { + pid_bedAutoTemp = uint16_t(recdat.data[0]); + } + #endif + + else if (recdat.addr == Accel_X) { + setAxisMaxAcceleration_mm_s2(uint16_t(recdat.data[0]) * 100, X); + } + else if (recdat.addr == Accel_Y) { + setAxisMaxAcceleration_mm_s2(uint16_t(recdat.data[0]) * 100, Y); + } + else if (recdat.addr == Accel_Z) { + setAxisMaxAcceleration_mm_s2(uint16_t(recdat.data[0]) * 10, Z); + } + else if (recdat.addr == Accel_E) { + setAxisMaxAcceleration_mm_s2(uint16_t(recdat.data[0]), E0); + setAxisMaxAcceleration_mm_s2(uint16_t(recdat.data[0]), E1); + } + + else if (recdat.addr == Feed_X) { + setAxisMaxFeedrate_mm_s(uint16_t(recdat.data[0]), X); + } + else if (recdat.addr == Feed_Y) { + setAxisMaxFeedrate_mm_s(uint16_t(recdat.data[0]), Y); + } + else if (recdat.addr == Feed_Z) { + setAxisMaxFeedrate_mm_s(uint16_t(recdat.data[0]), Z); + } + else if (recdat.addr == Feed_E) { + setAxisMaxFeedrate_mm_s(uint16_t(recdat.data[0]), E0); + setAxisMaxFeedrate_mm_s(uint16_t(recdat.data[0]), E1); + } + else if (recdat.addr == FanKeyIcon) { + setTargetFan_percent(uint16_t(recdat.data[0]), (fan_t)getActiveTool()); + } + else { + float tmp_float_handling; + if (recdat.data[0] >= 32768) + tmp_float_handling = (float(recdat.data[0]) - 65536) / 100; + else + tmp_float_handling = float(recdat.data[0]) / 100; + if (recdat.addr == StepMM_X) { + setAxisSteps_per_mm(tmp_float_handling * 10, X); + } + else if (recdat.addr == StepMM_Y) { + setAxisSteps_per_mm(tmp_float_handling * 10, Y); + } + else if (recdat.addr == StepMM_Z) { + setAxisSteps_per_mm(tmp_float_handling * 10, Z); + } + else if (recdat.addr == StepMM_E) { + setAxisSteps_per_mm(tmp_float_handling * 10, E0); + #if DISABLED(DUAL_X_CARRIAGE) + setAxisSteps_per_mm(tmp_float_handling * 10, E1); + #endif + } + #if ENABLED(DUAL_X_CARRIAGE) + else if (recdat.addr == T2StepMM_E) { + setAxisSteps_per_mm(tmp_float_handling * 10, E1); + } + else if (recdat.addr == T2Offset_X) { + setNozzleOffset_mm(tmp_float_handling * 10, X, E1); + } + else if (recdat.addr == T2Offset_Y) { + setNozzleOffset_mm(tmp_float_handling * 10, Y, E1); + } + else if (recdat.addr == T2Offset_Z) { + setNozzleOffset_mm(tmp_float_handling * 10, Z, E1); + } + #endif + #if HAS_BED_PROBE + else if (recdat.addr == ProbeOffset_X) { + setProbeOffset_mm(tmp_float_handling, X); + } + else if (recdat.addr == ProbeOffset_Y) { + setProbeOffset_mm(tmp_float_handling, Y); + } + else if (recdat.addr == ProbeOffset_Z) { + setProbeOffset_mm(tmp_float_handling, Z); + } + #endif + + #if ENABLED(CLASSIC_JERK) + else if (recdat.addr == Jerk_X) { + setAxisMaxJerk_mm_s(tmp_float_handling, X); + } + else if (recdat.addr == Jerk_Y) { + setAxisMaxJerk_mm_s(tmp_float_handling, Y); + } + else if (recdat.addr == Jerk_Z) { + setAxisMaxJerk_mm_s(tmp_float_handling, Z); + } + else if (recdat.addr == Jerk_E) { + setAxisMaxJerk_mm_s(tmp_float_handling, E0); + setAxisMaxJerk_mm_s(tmp_float_handling, E1); + } + #endif + + #if HAS_FILAMENT_SENSOR + else if (recdat.addr == RunoutToggle) { + setFilamentRunoutEnabled(!getFilamentRunoutEnabled()); + } + #endif + + #if ENABLED(POWER_LOSS_RECOVERY) + else if (recdat.addr == PowerLossToggle) { + setPowerLossRecoveryEnabled(!getPowerLossRecoveryEnabled()); + } + #endif + + #if ENABLED(CASE_LIGHT_ENABLE) + else if (recdat.addr == LedToggle) { + setCaseLightState(!getCaseLightState()); + } + #endif + + #if HAS_PID_HEATING + else if (recdat.addr == HotendPID_P) { + setPID(tmp_float_handling * 10, getPID_Ki(getActiveTool()), getPID_Kd(getActiveTool()), getActiveTool()); + } + else if (recdat.addr == HotendPID_I) { + setPID(getPID_Kp(getActiveTool()), tmp_float_handling * 10, getPID_Kd(getActiveTool()), getActiveTool()); + } + else if (recdat.addr == HotendPID_D) { + setPID(getPID_Kp(getActiveTool()), getPID_Ki(getActiveTool()), tmp_float_handling * 10, getActiveTool()); + } + #if ENABLED(PIDTEMPBED) + else if (recdat.addr == BedPID_P) { + setBedPID(tmp_float_handling * 10, getBedPID_Ki(), getBedPID_Kd()); + } + else if (recdat.addr == BedPID_I) { + setBedPID(getBedPID_Kp(), tmp_float_handling * 10, getBedPID_Kd()); + } + else if (recdat.addr == BedPID_D) { + setBedPID(getBedPID_Kp(), getBedPID_Ki(), tmp_float_handling * 10); + } + #endif + #endif // HAS_PID_HEATING + } + break; + + case Setting: + if (recdat.data[0] == 0) { // return to main page + InforShowStatus = true; + TPShowStatus = false; + } + else if (recdat.data[0] == 1) { // Bed Autoleveling + #if HAS_MESH + sendData(getLevelingActive() ? 3 : 2, AutoLevelIcon); + + if (ExtUI::getMeshValid()) { + uint8_t abl_probe_index = 0; + for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) + for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) { + const bool zig = outer & 1; + const xy_uint8_t point = { uint8_t(zig ? (GRID_MAX_POINTS_X - 1) - inner : inner), outer }; + sendData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + abl_probe_index * 2); + ++abl_probe_index; + } + } + #endif + sendData(10, FilenameIcon); // Motor Icon + injectCommands(isPositionKnown() ? F("G1F1000Z0.0") : F("G28\nG1F1000Z0.0")); + waitway = 2; + sendData(ExchangePageBase + 64, ExchangepageAddr); + } + else if (recdat.data[0] == 2) { // Exchange filament + InforShowStatus = true; + TPShowStatus = false; + ZERO(ChangeMaterialbuf); + ChangeMaterialbuf[1] = ChangeMaterialbuf[0] = 10; + sendData(10 * ChangeMaterialbuf[0], FilamentUnit1); // It's ChangeMaterialbuf for show, instead of current_position.e in them. + sendData(10 * ChangeMaterialbuf[1], FilamentUnit2); + sendData(getActualTemp_celsius(H0), NozzleTemp); + sendData(getTargetTemp_celsius(H0), NozzlePreheat); + sendData(TERN0(HAS_MULTI_HOTEND, getActualTemp_celsius(H1)), e2Temp); + sendData(TERN0(HAS_MULTI_HOTEND, getTargetTemp_celsius(H1)), e2Preheat); + delay_ms(2); + sendData(ExchangePageBase + 65, ExchangepageAddr); + } + else if (recdat.data[0] == 3) { // Move + AxisPagenum = 0; + sendData(ExchangePageBase + 71, ExchangepageAddr); + } + else if (recdat.data[0] == 4) { // Language + // Just loads language screen, now used for tools + } + else if (recdat.data[0] == 5) { // Printer Information + sendData(WEBSITE_URL, CorpWebsite); + } + else if (recdat.data[0] == 6) { // Diabalestepper + injectCommands(F("M84")); + sendData(11, FilenameIcon); + } + break; + + case ReturnBack: + if (recdat.data[0] == 1) { // return to the tool page + InforShowStatus = false; + sendData(ExchangePageBase + 63, ExchangepageAddr); + } + if (recdat.data[0] == 2) // return to the Level mode page + sendData(ExchangePageBase + 64, ExchangepageAddr); + break; + + case Bedlevel: + switch (recdat.data[0]) { + case 1: { // Z-axis to home + // Disallow Z homing if X or Y are unknown + injectCommands(isAxisPositionKnown(axis_t(X)) && isAxisPositionKnown(axis_t(Y)) ? F("G28Z\nG1F1500Z0.0") : F("G28\nG1F1500Z0.0")); + sendData(getZOffset_mm() * 100, ProbeOffset_Z); + break; + } + case 2: { // Z-axis to Up + if (WITHIN((getZOffset_mm() + 0.1), Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { + smartAdjustAxis_steps(getAxisSteps_per_mm(Z) / 10, axis_t(Z), false); + //setZOffset_mm(getZOffset_mm() + 0.1); + sendData(getZOffset_mm() * 100, ProbeOffset_Z); + char zOffs[20], tmp1[11]; + sprintf_P(zOffs, PSTR("Z Offset : %s"), dtostrf(getZOffset_mm(), 1, 3, tmp1)); + onStatusChanged(zOffs); + } + break; + } + case 3: { // Z-axis to Down + if (WITHIN((getZOffset_mm() - 0.1), Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { + smartAdjustAxis_steps(-getAxisSteps_per_mm(Z) / 10, axis_t(Z), false); + //babystepAxis_steps(int16_t(-getAxisSteps_per_mm(Z)) / 10, axis_t(Z)); + //setZOffset_mm(getZOffset_mm() - 0.1); + sendData(getZOffset_mm() * 100, ProbeOffset_Z); + char zOffs[20], tmp1[11]; + sprintf_P(zOffs, PSTR("Z Offset : %s"), dtostrf(getZOffset_mm(), 1, 3, tmp1)); + onStatusChanged(zOffs); + } + break; + } + case 4: { // Assistant Level + TERN_(HAS_MESH, setLevelingActive(false)); + injectCommands(isPositionKnown() ? F("G1 F1000 Z0.0") : F("G28\nG1 F1000 Z0.0")); + waitway = 2; + sendData(ExchangePageBase + 84, ExchangepageAddr); + break; + } + case 5: { // AutoLevel "Measuring" Button + #if ENABLED(MESH_BED_LEVELING) + sendData(ExchangePageBase + 93, ExchangepageAddr); + #else + waitway = 3; // only for prohibiting to receive massage + sendData(3, AutolevelIcon); + uint8_t abl_probe_index = 0; + while (abl_probe_index < 25) { + sendData(0, AutolevelVal + abl_probe_index * 2); + ++abl_probe_index; + } + sendData(ExchangePageBase + 64, ExchangepageAddr); + injectCommands(F(MEASURING_GCODE)); + #endif + break; + } + + case 6: { // Assitant Level , Centre 1 + setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z)); + setAxisPosition_mm(X_CENTER, axis_t(X)); + setAxisPosition_mm(Y_CENTER, axis_t(Y)); + waitway = 6; + break; + } + case 7: { // Assitant Level , Front Left 2 + setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z)); + setAxisPosition_mm(X_MIN_BED + lfrb[0], axis_t(X)); + setAxisPosition_mm(Y_MIN_BED + lfrb[1], axis_t(Y)); + waitway = 6; + break; + } + case 8: { // Assitant Level , Front Right 3 + setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z)); + setAxisPosition_mm(X_MAX_BED - lfrb[2], axis_t(X)); + setAxisPosition_mm(Y_MIN_BED + lfrb[1], axis_t(Y)); + waitway = 6; + break; + } + case 9: { // Assitant Level , Back Right 4 + setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z)); + setAxisPosition_mm(X_MAX_BED - lfrb[2], axis_t(X)); + setAxisPosition_mm(Y_MAX_BED - lfrb[3], axis_t(Y)); + waitway = 6; + break; + } + case 10: { // Assitant Level , Back Left 5 + setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z)); + setAxisPosition_mm(X_MIN_BED + lfrb[0], axis_t(X)); + setAxisPosition_mm(Y_MAX_BED - lfrb[3], axis_t(Y)); + waitway = 6; + break; + } + case 11: { // Autolevel switch + #if HAS_MESH + const bool gla = !getLevelingActive(); + setLevelingActive(gla); + sendData(gla ? 3 : 2, AutoLevelIcon); + #endif + sendData(getZOffset_mm() * 100, ProbeOffset_Z); + break; + } + case 12: { + injectCommands(F("G26R255")); + onStatusChanged(F("Beginning G26.. Heating")); + break; + } + case 13: { + injectCommands(F("G29S1")); + onStatusChanged(F("Begin Manual Mesh")); + break; + } + case 14: { + injectCommands(F("G29S2")); + onStatusChanged(F("Moving to Next Mesh Point")); + break; + } + case 15: { + injectCommands(F("M211S0\nG91\nG1Z-0.025\nG90\nM211S1")); + onStatusChanged(F("Moved down 0.025")); + break; + } + case 16: { + injectCommands(F("M211S0\nG91\nG1Z0.025\nG90\nM211S1")); + onStatusChanged(F("Moved up 0.025")); + break; + } + case 17: { + Settings.display_volume = 0; + Settings.display_sound = false; + setTouchScreenConfiguration(); + break; + } + case 18: { + Settings.display_volume = 255; + Settings.display_sound = true; + setTouchScreenConfiguration(); + break; + } + case 19: { + Settings.screen_brightness = 10; + setTouchScreenConfiguration(); + break; + } + case 20: { + Settings.screen_brightness = 100; + setTouchScreenConfiguration(); + break; + } + case 21: { + Settings.display_standby ^= true; + setTouchScreenConfiguration(); + break; + } + case 22: { + Settings.screen_rotation = Settings.screen_rotation == 10 ? 0 : 10; + setTouchScreenConfiguration(); + break; + } + case 23: { // Set IDEX Autopark + injectCommands(F("M605S1\nG28X\nG1X0")); + break; + } + case 24: { // Set IDEX Duplication + injectCommands(F("M605S1\nT0\nG28\nM605S2\nG28X\nG1X0")); + break; + } + case 25: { // Set IDEX Mirrored Duplication + injectCommands(F("M605S1\nT0\nG28\nM605S2\nG28X\nG1X0\nM605S3")); + break; + } + case 26: { // Set IDEX Full Control + injectCommands(F("M605S0\nG28X")); + break; + } + case 27: { // Change Tool + setActiveTool(getActiveTool() == E0 ? E1 : E0, !isAxisPositionKnown(X)); + break; + } + default: break; + } + + sendData(10, FilenameIcon); + break; + + case XYZEaxis: { + axis_t axis = X; + float min = 0.0f, max = 0.0f; + waitway = 4; + if (recdat.addr == DisplayXaxis) { + axis = X; + min = X_MIN_POS; + max = X_MAX_POS; + } + else if (recdat.addr == DisplayYaxis) { + axis = Y; + min = Y_MIN_POS; + max = Y_MAX_POS; + } + else if (recdat.addr == DisplayZaxis) { + axis = Z; + min = Z_MIN_POS; + max = Z_MAX_POS; + } + else if (recdat.addr == AutoZero) { + if (recdat.data[0] == 3) { // autohome + waitway = 4; + injectCommands(F("G28\nG1 F1000 Z10")); + InforShowStatus = AutohomeKey = true; + AutoHomeIconNum = 0; + sendData(10, FilenameIcon); + } + else { + AxisPagenum = recdat.data[0]; + waitway = 0; + } + break; + } + + float targetPos = float(recdat.data[0]) / 10; + LIMIT(targetPos, min, max); + setAxisPosition_mm(targetPos, axis); + waitway = 0; + sendData(10, FilenameIcon); + break; + } + + case Filament: + + uint16_t IconTemp; + if (recdat.addr == Exchfilament) { + if (getActualTemp_celsius(getActiveTool()) < EXTRUDE_MINTEMP && recdat.data[0] < 5) { + sendData(int16_t(EXTRUDE_MINTEMP), 0x1020); + delay_ms(5); + sendData(ExchangePageBase + 66, ExchangepageAddr); + break; + } + + switch (recdat.data[0]) { + case 1: { // Unload filament1 + setAxisPosition_mm(getAxisPosition_mm(E0) - ChangeMaterialbuf[0], E0); + break; + } + case 2: { // Load filament1 + setAxisPosition_mm(getAxisPosition_mm(E0) + ChangeMaterialbuf[0], E0); + break; + } + case 3: { // Unload filament2 + setAxisPosition_mm(getAxisPosition_mm(E1) - ChangeMaterialbuf[1], E1); + break; + } + case 4: { // Load filament2 + setAxisPosition_mm(getAxisPosition_mm(E1) + ChangeMaterialbuf[1], E1); + break; + } + case 5: { // sure to heat + NozzleTempStatus[0] = 1; + + setTargetTemp_celsius((PREHEAT_1_TEMP_HOTEND + 10), getActiveTool()); + IconTemp = getActualTemp_celsius(getActiveTool()) * 100 / getTargetTemp_celsius(getActiveTool()); + NOMORE(IconTemp, 100U); + sendData(IconTemp, HeatPercentIcon); + + sendData(getActualTemp_celsius(H0), NozzleTemp); + sendData(getTargetTemp_celsius(H0), NozzlePreheat); + sendData(TERN0(HAS_MULTI_HOTEND, getActualTemp_celsius(H1)), e2Temp); + sendData(TERN0(HAS_MULTI_HOTEND, getTargetTemp_celsius(H1)), e2Preheat); + delay_ms(5); + sendData(ExchangePageBase + 68, ExchangepageAddr); + break; + } + case 6: { // cancel to heat + sendData(ExchangePageBase + 65, ExchangepageAddr); + break; + } + case 0xF1: { // Sure to cancel heating + NozzleTempStatus[0] = 0; + delay_ms(1); + sendData(ExchangePageBase + 65, ExchangepageAddr); + break; + } + case 0xF0: // not to cancel heating + break; + } + sendData(10 * ChangeMaterialbuf[0], FilamentUnit1); // It's ChangeMaterialbuf for show, instead of current_position.e in them. + sendData(10 * ChangeMaterialbuf[1], FilamentUnit2); + } + else if (recdat.addr == FilamentUnit1) { + ChangeMaterialbuf[0] = float(recdat.data[0]) / 10; + } + else if (recdat.addr == FilamentUnit2) { + ChangeMaterialbuf[1] = float(recdat.data[0]) / 10; + } + break; + + case LanguageChoice: + + //if (recdat.data[0] == 1) settings.save(); else injectCommands(F("M300")); + + // may at some point use language change screens to save eeprom explicitly + switch (recdat.data[0]) { + case 0: { + injectCommands(F("M500")); + break; + } + case 1: { + sendData(ExchangePageBase + 94, ExchangepageAddr); + break; + } + + #if ENABLED(PIDTEMP) + case 2: { + onStatusChanged(F("Hotend PID Started")); + startPIDTune(static_cast(pid_hotendAutoTemp), getActiveTool()); + break; + } + #endif + + case 3: { + injectCommands(F("M502\nM500")); + break; + } + case 4: { + injectCommands(F("M999\nM280P0S160")); + break; + } + + case 5: { + #if ENABLED(PIDTEMPBED) + onStatusChanged(F("Bed PID Started")); + startBedPIDTune(static_cast(pid_bedAutoTemp)); + #endif + break; + } + case 6: { + injectCommands(F("M500")); + break; + } + default: break; + } + break; + + case No_Filament: + if (recdat.data[0] == 1) { // Filament is out, resume / resume selected on screen + if (ExtUI::pauseModeStatus != PAUSE_MESSAGE_PURGE && ExtUI::pauseModeStatus != PAUSE_MESSAGE_OPTION) { + // setPauseMenuResponse(PAUSE_RESPONSE_RESUME_PRINT); + setUserConfirmed(); + // PrinterStatusKey[1] = 3; + // pause_resume_selected = true; + } + else { + #if ENABLED(FILAMENT_RUNOUT_SENSOR) + bool runouton = false; + if (getFilamentRunoutState()) { + #if NUM_RUNOUT_SENSORS > 1 + if ((runouton = getFilamentRunoutEnabled(getActiveTool()))) + ExtUI::setFilamentRunoutEnabled(false, getActiveTool()); + #else + if ((runouton = getFilamentRunoutEnabled())) + ExtUI::setFilamentRunoutEnabled(false); + #endif + } + #else + constexpr bool runouton = false; + #endif + if (!runouton) { + setPauseMenuResponse(PAUSE_RESPONSE_RESUME_PRINT); + setUserConfirmed(); + PrinterStatusKey[1] = 3; + pause_resume_selected = true; + } + } + } + else if (recdat.data[0] == 0) { // Filamet is out, Cancel Selected + if (ExtUI::pauseModeStatus == PAUSE_MESSAGE_PURGE || ExtUI::pauseModeStatus == PAUSE_MESSAGE_OPTION) { + setPauseMenuResponse(PAUSE_RESPONSE_EXTRUDE_MORE); + setUserConfirmed(); + } + } + break; + + #if ENABLED(POWER_LOSS_RECOVERY) + case PwrOffNoF: + if (recdat.data[0] == 1) // Yes: continue to print the 3Dmode during power-off. + injectCommands(F("M1000")); + else if (recdat.data[0] == 2) // No + injectCommands(F("M1000C")); + break; + #endif + + case Volume: + if (recdat.data[0] < 0) + Settings.display_volume = 0; + else if (recdat.data[0] > 255) + Settings.display_volume = 0xFF; + else + Settings.display_volume = recdat.data[0]; + + if (Settings.display_volume == 0) { + sendData(0, VolumeIcon); + sendData(9, SoundIcon); + } + else { + sendData((Settings.display_volume + 1) / 32 - 1, VolumeIcon); + sendData(8, SoundIcon); + } + sendData(Settings.display_volume << 8, SoundAddr + 1); + break; + + case Filename: + if (isMediaInserted() && recdat.addr == FilenameChs) { + + recordcount = recdat.data[0] - 1; + if (filenavigator.currentindex == 0 && filenavigator.folderdepth > 0 && (fileIndex + recordcount) == 0) { + filenavigator.upDIR(); + filenavigator.getFiles(0); + fileIndex = 0; + return; + } + + if (filenavigator.currentindex == 0 && filenavigator.folderdepth > 0) + recordcount = recordcount - 1; // account for return dir link in file index + + for (int16_t j = 1; j <= 4; j++) { // Clear filename BG Color and Frame + sendData(0xFFFFUL, FilenameNature + j * 16); // white + sendData(10, FilenameIcon1 + j); // clean + } + for (int16_t j = 0; j < 10; j++) // clear current filename + sendData(0, Choosefilename + j); + + if (filenavigator.getIndexisDir(fileIndex + recordcount)) { + filenavigator.changeDIR((char *)filenavigator.getIndexName(fileIndex + recordcount)); + filenavigator.getFiles(0); + fileIndex = 0; + return; + } + else { + sendData(filenavigator.getIndexName(fileIndex + recordcount), Choosefilename); + sendData(0x87F0UL, FilenameNature + recdat.data[0] * 16); // Change BG of selected line to Light Green + sendData(6, FilenameIcon1 + recdat.data[0]); // show frame + } + } + else if (recdat.addr == FilenamePlay) { + if (recdat.data[0] == 1 && isMediaInserted()) { // for sure + printFile(filenavigator.getIndexName(fileIndex + recordcount)); + + for (int16_t j = 0; j < 10; j++) // clean screen. + sendData(0, Printfilename + j); + + sendData(filenavigator.getIndexName(fileIndex + recordcount), Printfilename); + + delay_ms(4); + + sendData(ExchangePageBase + 53, ExchangepageAddr); + + TPShowStatus = InforShowStatus = true; + PrinterStatusKey[0] = 1; + PrinterStatusKey[1] = 3; + fileIndex = 0; + recordcount = 0; + } + else if (recdat.data[0] == 2) { // Page Down + if ((fileIndex + DISPLAY_FILES) < (filenavigator.maxFiles() + (filenavigator.folderdepth != 0))) { + fileIndex = fileIndex + DISPLAY_FILES; + // if(filenavigator.folderdepth!=0 && fileIndex!=0) //Shift to acknowledge Return DIR button on first page + // filenavigator.getFiles(fileIndex-1); + // else + filenavigator.getFiles(fileIndex); + // filenavigator.getFiles(filenavigator.currentindex+1); + } + } + else if (recdat.data[0] == 3) { // Page Up + if (fileIndex >= DISPLAY_FILES) { + fileIndex = fileIndex - DISPLAY_FILES; + // if(filenavigator.folderdepth!=0 && fileIndex!=0) //Shift to acknowledge Return DIR button on first page + // filenavigator.getFiles(filenavigator.currentindex-DISPLAY_FILES); + // else + filenavigator.getFiles(fileIndex); + } + } + else if (recdat.data[0] == 4) { // Page Up + injectCommands(F("M22\nM21")); + } + else if (recdat.data[0] == 0) { // return to main page + InforShowStatus = true; + TPShowStatus = false; + } + } + break; + + case VolumeDisplay: { + if (recdat.data[0] == 0) { + Settings.display_volume = 0; + Settings.display_sound = false; + } + else if (recdat.data[0] > 100) { + Settings.display_volume = 255; + Settings.display_sound = true; + } + else { + Settings.display_volume = (uint8_t)map(constrain(recdat.data[0], 0, 100), 0, 100, 0, 255); + Settings.display_sound = true; + } + setTouchScreenConfiguration(); + break; + } + + case DisplayBrightness: { + if (recdat.data[0] < 10) + Settings.screen_brightness = 10; + else if (recdat.data[0] > 100) + Settings.screen_brightness = 100; + else + Settings.screen_brightness = (uint8_t)recdat.data[0]; + setTouchScreenConfiguration(); + break; + } + + case DisplayStandbyBrightness: { + if (recdat.data[0] < 10) + Settings.standby_screen_brightness = 10; + else if (recdat.data[0] > 100) + Settings.standby_screen_brightness = 100; + else + Settings.standby_screen_brightness = (uint8_t)recdat.data[0]; + setTouchScreenConfiguration(); + break; + } + + case DisplayStandbySeconds: { + if (recdat.data[0] < 5) + Settings.standby_time_seconds = 5; + else if (recdat.data[0] > 100) + Settings.standby_time_seconds = 100; + else + Settings.standby_time_seconds = (uint8_t)recdat.data[0]; + setTouchScreenConfiguration(); + break; + } + + case AutolevelVal: { + uint8_t meshPoint = (recdat.addr - AutolevelVal) / 2, + yPnt = floor(meshPoint / GRID_MAX_POINTS_X), + xPnt = meshPoint - (yPnt * GRID_MAX_POINTS_X); + if (yPnt % 2 != 0) xPnt = (GRID_MAX_POINTS_X - 1) - xPnt; // zag row + + float meshVal = float(recdat.data[0] - (recdat.data[0] >= 32768 ? 65536 : 0)) / 1000; + + LIMIT(meshVal, Z_PROBE_LOW_POINT, Z_CLEARANCE_BETWEEN_PROBES); + xy_uint8_t point = { xPnt, yPnt }; + setMeshPoint(point, meshVal); + sendData(meshVal * 1000, recdat.addr); + break; + } + + default: break; + } + + memset(&recdat, 0, sizeof(recdat)); + recdat.head[0] = FHONE; + recdat.head[1] = FHTWO; +} + +void RTS::writeVariable(const uint16_t adr, const void * const values, uint8_t valueslen, const bool isstr/*=false*/, const char fillChar/*=' '*/) { + const char* myvalues = static_cast(values); + bool strend = !myvalues; + DWIN_SERIAL.write(FHONE); + DWIN_SERIAL.write(FHTWO); + DWIN_SERIAL.write(valueslen + 3); + DWIN_SERIAL.write(0x82); + DWIN_SERIAL.write(adr >> 8); + DWIN_SERIAL.write(adr & 0xFF); + while (valueslen--) { + char x; + if (!strend) x = *myvalues++; + if ((isstr && !x) || strend) { + strend = true; + x = fillChar; + } + DWIN_SERIAL.write(x); + } +} + +void RTS::setTouchScreenConfiguration() { + // Main configuration (System_Config) + LIMIT(Settings.screen_brightness, 10, 100); // Prevent a possible all-dark screen + LIMIT(Settings.standby_time_seconds, 10, 655); // Prevent a possible all-dark screen for standby, yet also don't go higher than the DWIN limitation + + uint8_t cfg_bits = (0x0 + | _BV(7) // 7: Enable Control ... TERN0(DWINOS_4, _BV(7)) + | _BV(5) // 5: load 22 touch file + | _BV(4) // 4: auto-upload should always be enabled + | (Settings.display_sound ? _BV(3) : 0) // 3: audio + | (Settings.display_standby ? _BV(2) : 0) // 2: backlight on standby + | (Settings.screen_rotation == 10 ? _BV(1) : 0) // 1 & 0: Inversion + #if LCD_SCREEN_ROTATE == 90 + | _BV(0) // Portrait Mode or 800x480 display has 0 point rotated 90deg from 480x272 display + #elif LCD_SCREEN_ROTATE + #error "Only 90° rotation is supported for the selected LCD." + #endif + ); + + const uint8_t config_set[] = { 0x5A, 0x00, TERN(DWINOS_4, 0x00, 0xFF), cfg_bits }; + writeVariable(0x80 /*System_Config*/, config_set, sizeof(config_set)); + + // Standby brightness (LED_Config) + uint16_t dwinStandbyTimeSeconds = 100 * Settings.standby_time_seconds; /* milliseconds, but divided by 10 (not 5 like the docs say) */ + const uint8_t brightness_set[] = { + Settings.screen_brightness /*% active*/, + Settings.standby_screen_brightness /*% standby*/, + static_cast(dwinStandbyTimeSeconds >> 8), + static_cast(dwinStandbyTimeSeconds) + }; + writeVariable(0x82 /*LED_Config*/, brightness_set, sizeof(brightness_set)); + + if (!Settings.display_sound) { + sendData(0, VolumeIcon); + sendData(9, SoundIcon); + } + else { + sendData((Settings.display_volume + 1) / 32 - 1, VolumeIcon); + sendData(8, SoundIcon); + } + sendData(Settings.display_volume, VolumeIcon - 2); + sendData(Settings.display_volume << 8, SoundAddr + 1); + sendData(map(constrain(Settings.display_volume, 0, 255), 0, 255, 0, 100), VolumeDisplay); + sendData(Settings.screen_brightness, DisplayBrightness); + sendData(Settings.standby_screen_brightness, DisplayStandbyBrightness); + sendData(Settings.standby_time_seconds, DisplayStandbySeconds); + if (Settings.display_standby) + sendData(3, DisplayStandbyEnableIndicator); + else + sendData(2, DisplayStandbyEnableIndicator); +} + +namespace ExtUI { + + void onStartup() { rts.onStartup(); } + + void onIdle() { rts.onIdle(); } + + void onPrinterKilled(FSTR_P const error, FSTR_P const component) { + rts.sendData(ExchangePageBase + 88, ExchangepageAddr); + int16_t j = 0; + char outmsg[40]; + char killMsg[strlen_P(FTOP(error)) + strlen_P(FTOP(component)) + 3]; + sprintf_P(killMsg, PSTR(S_FMT ": " S_FMT), FTOP(error), FTOP(component)); + while (j < 4) outmsg[j++] = '*'; + while (const char c = killMsg[j - 4]) outmsg[j++] = c; + while (j < 40) outmsg[j++] = '*'; + rts.sendData(outmsg, MacVersion); + delay_ms(10); + } + + void onMediaInserted() { + filenavigator.reset(); + filenavigator.getFiles(0); + fileIndex = 0; + recordcount = 0; + } + + void onMediaError() { + filenavigator.reset(); + for (int16_t i = 0; i < MaxFileNumber; i++) + for (int16_t j = 0; j < 10; j++) rts.sendData(0, SDFILE_ADDR + i * 10 + j); + + for (int16_t j = 0; j < 10; j++) { + rts.sendData(0, Printfilename + j); // clean screen. + rts.sendData(0, Choosefilename + j); // clean filename + } + for (int16_t j = 0; j < 8; j++) rts.sendData(0, FilenameCount + j); + for (int16_t j = 1; j <= MaxFileNumber; j++) { + rts.sendData(10, FilenameIcon + j); + rts.sendData(10, FilenameIcon1 + j); + } + } + + void onMediaRemoved() { + filenavigator.reset(); + for (int16_t i = 0; i < MaxFileNumber; i++) + for (int16_t j = 0; j < 10; j++) rts.sendData(0, SDFILE_ADDR + i * 10 + j); + + for (int16_t j = 0; j < 10; j++) { + rts.sendData(0, Printfilename + j); // clean screen. + rts.sendData(0, Choosefilename + j); // clean filename + } + for (int16_t j = 0; j < 8; j++) rts.sendData(0, FilenameCount + j); + for (int16_t j = 1; j <= MaxFileNumber; j++) { + rts.sendData(10, FilenameIcon + j); + rts.sendData(10, FilenameIcon1 + j); + } + } + + void onPlayTone(const uint16_t frequency, const uint16_t duration) { + rts.sendData(StartSoundSet, SoundAddr); + } + + void onPrintTimerStarted() { + if (waitway == 7) return; + PrinterStatusKey[1] = 3; + InforShowStatus = true; + delay_ms(1); + rts.sendData(ExchangePageBase + 53, ExchangepageAddr); + } + + void onPrintTimerPaused() { + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); // Display Pause Screen + onStatusChanged(F("Pausing...")); + } + + void onPrintTimerStopped() { + if (waitway == 3) return; + + #if FAN_COUNT > 0 + for (uint8_t i = 0; i < FAN_COUNT; i++) setTargetFan_percent(FanOff, (fan_t)i); + #endif + + PrinterStatusKey[0] = 0; + InforShowStatus = true; + TPShowStatus = false; + rts.sendData(ExchangePageBase + 51, ExchangepageAddr); + } + + void onFilamentRunout() { + PrinterStatusKey[1] = 4; + TPShowStatus = false; + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); + } + + void onFilamentRunout(extruder_t extruder) { + PrinterStatusKey[1] = 4; + TPShowStatus = false; + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); + } + + void onUserConfirmRequired(const char *const msg) { + PrinterStatusKey[1] = 4; + TPShowStatus = false; + if (lastPauseMsgState == ExtUI::pauseModeStatus && msg == (const char*)GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD)) + return; + + switch (ExtUI::pauseModeStatus) { + case PAUSE_MESSAGE_WAITING: { + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); + onStatusChanged(F("Press Yes to Continue")); + break; + } + case PAUSE_MESSAGE_INSERT: { + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); + onStatusChanged(F("Load Filament to Continue")); + break; + } + case PAUSE_MESSAGE_HEAT: { + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); + onStatusChanged(F("Add Filament and Press Yes to Reheat")); + break; + } + + #if DISABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE) + case PAUSE_MESSAGE_PURGE: { + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); + char newMsg[40] = "Yes to "; + strcat_P(newMsg, TERN1(FILAMENT_RUNOUT_SENSOR, !ExtUI::getFilamentRunoutState() && getFilamentRunoutEnabled()) ? PSTR("Continue") : PSTR("Disable ")); + strcat_P(newMsg, PSTR(" No to Purge")); + onStatusChanged(newMsg); + break; + } + #endif + + case PAUSE_MESSAGE_OPTION: { + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); + char newMsg[40] = "Yes to "; + strcat_P(newMsg, TERN1(FILAMENT_RUNOUT_SENSOR, !ExtUI::getFilamentRunoutState() && getFilamentRunoutEnabled()) ? PSTR("Continue") : PSTR("Disable ")); + strcat_P(newMsg, PSTR(" No to Purge")); + onStatusChanged(newMsg); + break; + } + + case PAUSE_MESSAGE_PARKING: { + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); + onStatusChanged(F("Parking...")); + break; + } + case PAUSE_MESSAGE_CHANGING: { + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); + onStatusChanged(F("Beginning Filament Change")); + break; + } + case PAUSE_MESSAGE_UNLOAD: { + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); + onStatusChanged(F("Unloading...")); + break; + } + case PAUSE_MESSAGE_LOAD: { + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); + onStatusChanged(F("Reloading...")); + break; + } + case PAUSE_MESSAGE_RESUME: + #if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE) + case PAUSE_MESSAGE_PURGE: { + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); + onStatusChanged(F("Press Yes to Stop Purge")); + break; + } + #endif + + case PAUSE_MESSAGE_HEATING: { + rts.sendData(ExchangePageBase + 68, ExchangepageAddr); + onStatusChanged(F("Reheating")); + break; + } + + case PAUSE_MESSAGE_STATUS: + default: { + setPauseMenuResponse(PAUSE_RESPONSE_RESUME_PRINT); + setUserConfirmed(); + break; + } + } + lastPauseMsgState = ExtUI::pauseModeStatus; + } + + void onStatusChanged(const char *const statMsg) { + for (int16_t j = 0; j < 20; j++) // Clear old message + rts.sendData(' ', StatusMessageString + j); + rts.sendData(statMsg, StatusMessageString); + } + + void onFactoryReset() { + Settings.settings_size = sizeof(creality_dwin_settings_t); + Settings.settings_version = dwin_settings_version; + Settings.display_standby = true; + Settings.display_sound = true; + Settings.display_volume = 32; + Settings.standby_screen_brightness = 15; + Settings.screen_brightness = 100; + Settings.standby_time_seconds = 60; + Settings.screen_rotation = 0; + onStartup(); + startprogress = 0; + InforShowStatus = true; + } + + void onMeshUpdate(const int8_t xpos, const int8_t ypos, probe_state_t state) {} + + void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) { + if (waitway == 3) + if (isPositionKnown() && (getActualTemp_celsius(BED) >= (getTargetTemp_celsius(BED) - 1))) + rts.sendData(ExchangePageBase + 64, ExchangepageAddr); + #if HAS_MESH + uint8_t abl_probe_index = 0; + for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) + for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) { + const bool zig = outer & 1; // != ((PR_OUTER_END) & 1); + const xy_uint8_t point = { uint8_t(zig ? (GRID_MAX_POINTS_X - 1) - inner : inner), outer }; + if (point.x == xpos && outer == ypos) + rts.sendData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + (abl_probe_index * 2)); + ++abl_probe_index; + } + #endif + } + + void onStoreSettings(char *buff) { + static_assert( + ExtUI::eeprom_data_size >= sizeof(creality_dwin_settings_t), + "Insufficient space in EEPROM for UI parameters" + ); + + // Write to buffer + memcpy(buff, &Settings, sizeof(creality_dwin_settings_t)); + } + + void onLoadSettings(const char *buff) { + static_assert( + ExtUI::eeprom_data_size >= sizeof(creality_dwin_settings_t), + "Insufficient space in EEPROM for UI parameters" + ); + + creality_dwin_settings_t eepromSettings; + memcpy(&eepromSettings, buff, sizeof(creality_dwin_settings_t)); + + // If size is not the same, discard settings + if (eepromSettings.settings_size != sizeof(creality_dwin_settings_t)) { + onFactoryReset(); + return; + } + + if (eepromSettings.settings_version != dwin_settings_version) { + onFactoryReset(); + return; + } + + // Copy into final location + memcpy(&Settings, &eepromSettings, sizeof(creality_dwin_settings_t)); + + rts.setTouchScreenConfiguration(); + } + + void onSettingsStored(const bool success) { + // This is called after the entire EEPROM has been written, + // whether successful or not. + } + + void onSettingsLoaded(const bool success) { + #if HAS_MESH + if (ExtUI::getMeshValid()) { + uint8_t abl_probe_index = 0; + for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) + for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) { + const bool zig = outer & 1; + const xy_uint8_t point = { uint8_t(zig ? (GRID_MAX_POINTS_X - 1) - inner : inner), outer }; + rts.sendData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + (abl_probe_index * 2)); + ++abl_probe_index; + } + + rts.sendData(3, AutoLevelIcon); // 2=On, 3=Off + setLevelingActive(true); + } + else { + rts.sendData(2, AutoLevelIcon); /*Off*/ + setLevelingActive(false); + } + #endif + + rts.sendData(getZOffset_mm() * 100, ProbeOffset_Z); + rts.setTouchScreenConfiguration(); + } + + #if ENABLED(POWER_LOSS_RECOVERY) + void onSetPowerLoss(const bool onoff) { + // Called when power-loss is enabled/disabled + } + void onPowerLoss() { + // Called when power-loss state is detected + } + void onPowerLossResume() { + startprogress = 254; + InforShowStatus = true; + TPShowStatus = false; + reEntryPrevent = false; + rts.sendData(ExchangePageBase + 76, ExchangepageAddr); + } + #endif + + #if HAS_PID_HEATING + void onPidTuning(const result_t rst) { + // Called for temperature PID tuning result + rts.sendData(pid_hotendAutoTemp, HotendPID_AutoTmp); + rts.sendData(pid_bedAutoTemp, BedPID_AutoTmp); + rts.sendData(uint16_t(getPID_Kp(E0)) * 10, HotendPID_P); + rts.sendData(uint16_t(getPID_Ki(E0)) * 10, HotendPID_I); + rts.sendData(uint16_t(getPID_Kd(E0)) * 10, HotendPID_D); + #if ENABLED(PIDTEMPBED) + rts.sendData(uint16_t(getBedPID_Kp()) * 10, BedPID_P); + rts.sendData(uint16_t(getBedPID_Ki()) * 10, BedPID_I); + rts.sendData(uint16_t(getBedPID_Kd()) * 10, BedPID_D); + #endif + onStatusChanged(F("PID Tune Finished")); + } + #endif + + void onLevelingStart() {} + + void onLevelingDone() { + #if HAS_MESH + if (ExtUI::getMeshValid()) { + uint8_t abl_probe_index = 0; + for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) + for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) { + const bool zig = outer & 1; + const xy_uint8_t point = { uint8_t(zig ? (GRID_MAX_POINTS_X - 1) - inner : inner), outer }; + rts.sendData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + abl_probe_index * 2); + ++abl_probe_index; + } + + rts.sendData(3, AutoLevelIcon); // 2=On, 3=Off + setLevelingActive(true); + } + else { + rts.sendData(2, AutoLevelIcon); /*Off*/ + setLevelingActive(false); + } + #endif + } + + void onSteppersEnabled() {} + void onPrintDone() {} + void onHomingStart() {} + void onHomingDone() {} + void onSteppersDisabled() {} + void onPostprocessSettings() {} + +} // namespace ExtUI + +#endif // DGUS_LCD_UI_IA_CREALITY diff --git a/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.h b/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.h index ba5df4fe77cdb..af3824e904855 100644 --- a/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.h +++ b/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.h @@ -47,7 +47,7 @@ #define FileNum MaxFileNumber #define FileNameLen TEXTBYTELEN -#define SizeofDatabuf 46 +#define DATA_BUF_SIZE 46 //#define FONT_EEPROM 90 //#define AutoLeve_EEPROM 100 @@ -177,122 +177,114 @@ #define StatusMessageString 0x2064 +// TODO: Use LCD_SERIAL 1 or 3 (?) by configuration, not overriding here #ifdef TARGET_STM32F4 #define DWIN_SERIAL Serial1 #else #define DWIN_SERIAL LCD_SERIAL #endif -namespace ExtUI { - - /************struct**************/ - - typedef enum : uint8_t { - DGUS_IDLE, //< waiting for DGUS_HEADER1. - DGUS_HEADER1_SEEN, //< DGUS_HEADER1 received - DGUS_HEADER2_SEEN, //< DGUS_HEADER2 received - DGUS_WAIT_TELEGRAM, //< LEN received, Waiting for to receive all bytes. - } rx_datagram_state_t; - - typedef struct DataBuf { - uint8_t len; - uint8_t head[2]; - uint8_t command; - uint32_t addr; - uint32_t bytelen; - uint16_t data[32]; - uint8_t reserv[4]; - } DB; - - struct creality_dwin_settings_t { - size_t settings_size; - uint8_t settings_version; - - bool display_standby; - bool display_sound; - int8_t screen_rotation; - int16_t display_volume; - uint8_t standby_screen_brightness; - uint8_t screen_brightness; - int16_t standby_time_seconds; - }; - - void SetTouchScreenConfiguration(); - - class RTSSHOW { - public: - RTSSHOW(); - int16_t RTS_RecData(); - void RTS_SDCardInit(); - void RTS_SDCardUpate(bool, bool); - int16_t RTS_CheckFilament(int16_t); - void RTS_SndData(); - void RTS_SndData(const String&, const uint32_t, const uint8_t=VarAddr_W); - void RTS_SndData(const char[], const uint32_t, const uint8_t=VarAddr_W); - void RTS_SndData(char, const uint32_t, const uint8_t=VarAddr_W); - void RTS_SndData(int, const uint32_t, const uint8_t=VarAddr_W); - void RTS_SndData(unsigned long, const uint32_t, const uint8_t=VarAddr_W); - void RTS_SndData(const_float_t, const uint32_t, const uint8_t=VarAddr_W); - - void RTS_SndData(uint8_t * const str, const uint32_t addr, const uint8_t cmd=VarAddr_W) { RTS_SndData((char *)str, addr, cmd); } - void RTS_SndData(const unsigned int n, uint32_t addr, const uint8_t cmd=VarAddr_W) { RTS_SndData(int(n), addr, cmd); } - void RTS_SndData(const long n, const uint32_t addr, const uint8_t cmd=VarAddr_W) { RTS_SndData((unsigned long)n, addr, cmd); } - - void RTS_SDcard_Stop(); - void RTS_HandleData(); - void RTS_Init(); - - DB recdat; - DB snddat; - uint8_t databuf[SizeofDatabuf]; - - static rx_datagram_state_t rx_datagram_state; - static uint8_t rx_datagram_len; - static bool Initialized; - }; - - static RTSSHOW rtscheck; - - #define Addvalue 3 - #define PrintChoice_Value (0 + Addvalue) - #define Zoffset_Value (3 + Addvalue) - #define Setting_Value (8 + Addvalue) - #define XYZEaxis_Value (12 + Addvalue) - #define Filament_Value (15 + Addvalue) - #define Language_Value (18 + Addvalue) - #define Filename_Value (22 + Addvalue) - - enum PROC_COM { - Printfile = 0, - Adjust, - Feedrate, - PrintChoice = PrintChoice_Value, - Zoffset = Zoffset_Value, - TempControl, - ManualSetTemp, - Setting = Setting_Value, - ReturnBack, - Bedlevel, - Autohome, - XYZEaxis = XYZEaxis_Value, - Filament = Filament_Value, - LanguageChoice = Language_Value, - No_Filament, - PwrOffNoF, - Volume, - Filename = Filename_Value - }; - - const uint16_t Addrbuf[] = { - 0x1002, 0x1004, 0x1006, 0x1008, 0x100A, 0x100C, 0x1026, 0x1030, 0x1032, 0x1034, 0x103A, - 0x103E, 0x1040, 0x1044, 0x1046, 0x1048, 0x104A, 0x104C, 0x1054, 0x1056, 0x1058, - 0x105C, 0x105E, 0x105F, 0x1088, 0 - }; - - void RTSUpdate(); - void RTSInit(); - -} // ExtUI +/************struct**************/ + +typedef enum : uint8_t { + DGUS_IDLE, //< waiting for DGUS_HEADER1. + DGUS_HEADER1_SEEN, //< DGUS_HEADER1 received + DGUS_HEADER2_SEEN, //< DGUS_HEADER2 received + DGUS_WAIT_TELEGRAM, //< LEN received, Waiting for to receive all bytes. +} rx_datagram_state_t; + +typedef struct DataBuf { + uint8_t len; + uint8_t head[2]; + uint8_t command; + uint32_t addr; + uint32_t bytelen; + uint16_t data[32]; + uint8_t reserv[4]; +} DB; + +struct creality_dwin_settings_t { + size_t settings_size; + uint8_t settings_version; + + bool display_standby; + bool display_sound; + int8_t screen_rotation; + int16_t display_volume; + uint8_t standby_screen_brightness; + uint8_t screen_brightness; + int16_t standby_time_seconds; +}; + +class RTS { + public: + RTS(); + static void onStartup(); + static void onIdle(); + static int16_t receiveData(); + static void sendData(); + static void sendData(const String&, const uint32_t, const uint8_t=VarAddr_W); + static void sendData(const char[], const uint32_t, const uint8_t=VarAddr_W); + static void sendData(char, const uint32_t, const uint8_t=VarAddr_W); + static void sendData(int, const uint32_t, const uint8_t=VarAddr_W); + static void sendData(unsigned long, const uint32_t, const uint8_t=VarAddr_W); + static void sendData(const_float_t, const uint32_t, const uint8_t=VarAddr_W); + + static void sendData(uint8_t * const str, const uint32_t addr, const uint8_t cmd=VarAddr_W) { sendData((char *)str, addr, cmd); } + static void sendData(const unsigned int n, uint32_t addr, const uint8_t cmd=VarAddr_W) { sendData(int(n), addr, cmd); } + static void sendData(const long n, const uint32_t addr, const uint8_t cmd=VarAddr_W) { sendData((unsigned long)n, addr, cmd); } + + static void handleData(); + + static void writeVariable(const uint16_t adr, const void * const values, uint8_t valueslen, const bool isstr=false, const char fillChar=' '); + static void setTouchScreenConfiguration(); + + static DB recdat, snddat; + static uint8_t databuf[DATA_BUF_SIZE]; + + static rx_datagram_state_t rx_datagram_state; + static uint8_t rx_datagram_len; +}; + +extern RTS rts; + +#define Addvalue 3 +#define PrintChoice_Value (0 + Addvalue) +#define Zoffset_Value (3 + Addvalue) +#define Setting_Value (8 + Addvalue) +#define XYZEaxis_Value (12 + Addvalue) +#define Filament_Value (15 + Addvalue) +#define Language_Value (18 + Addvalue) +#define Filename_Value (22 + Addvalue) + +enum PROC_COM { + Printfile = 0, + Adjust, + Feedrate, + PrintChoice = PrintChoice_Value, + Zoffset = Zoffset_Value, + TempControl, + ManualSetTemp, + Setting = Setting_Value, + ReturnBack, + Bedlevel, + Autohome, + XYZEaxis = XYZEaxis_Value, + Filament = Filament_Value, + LanguageChoice = Language_Value, + No_Filament, + PwrOffNoF, + Volume, + Filename = Filename_Value +}; + +const uint16_t Addrbuf[] = { + 0x1002, 0x1004, 0x1006, 0x1008, 0x100A, 0x100C, 0x1026, 0x1030, 0x1032, 0x1034, 0x103A, + 0x103E, 0x1040, 0x1044, 0x1046, 0x1048, 0x104A, 0x104C, 0x1054, 0x1056, 0x1058, + 0x105C, 0x105E, 0x105F, 0x1088, 0 +}; + +void RTS_Update(); #ifndef MAIN_MENU_ITEM_1_GCODE #if ENABLED(AUTO_BED_LEVELING_BILINEAR) From e66cd41654a3ca299acd2111daefe50c255f67ac Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Mon, 15 May 2023 09:29:35 +1200 Subject: [PATCH 022/100] =?UTF-8?q?=F0=9F=90=9B=20Safe=20Delay=20for=20Pro?= =?UTF-8?q?UI=20startup=20animation=20(#25827)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Warnings.cpp | 4 ++++ Marlin/src/lcd/e3v2/proui/dwin.cpp | 2 +- buildroot/tests/STM32F103RE_creality | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Marlin/src/inc/Warnings.cpp b/Marlin/src/inc/Warnings.cpp index cf75f3dd28a8a..f760920854654 100644 --- a/Marlin/src/inc/Warnings.cpp +++ b/Marlin/src/inc/Warnings.cpp @@ -760,3 +760,7 @@ #ifdef STM32F4_UPDATE_FOLDER #warning "Place the firmware bin file in a folder named 'STM32F4_UPDATE' on the SD card. Install with 'M936 V2'." #endif + +#if ENABLED(DWIN_LCD_PROUI) && BOOTSCREEN_TIMEOUT > 2000 + #warning "For ProUI the original BOOTSCREEN_TIMEOUT of 1100 is recommended." +#endif diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index f3a23ae1e40a0..8bd0a67b9b84a 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -1235,7 +1235,7 @@ void HMI_Init() { DWINUI::Draw_Icon(ICON_Bar, 15, 260); DWIN_Draw_Rectangle(1, HMI_data.Background_Color, t, 260, 257, 280); DWIN_UpdateLCD(); - delay((BOOTSCREEN_TIMEOUT) / 22); + safe_delay((BOOTSCREEN_TIMEOUT) / 22); } #endif HMI_SetLanguage(); diff --git a/buildroot/tests/STM32F103RE_creality b/buildroot/tests/STM32F103RE_creality index 834580fac8e38..bf56e12d7de6e 100755 --- a/buildroot/tests/STM32F103RE_creality +++ b/buildroot/tests/STM32F103RE_creality @@ -29,7 +29,7 @@ opt_enable DWIN_LCD_PROUI INDIVIDUAL_AXIS_HOMING_SUBMENU SET_PROGRESS_MANUALLY S 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 +opt_set PREHEAT_3_LABEL '"CUSTOM"' PREHEAT_3_TEMP_HOTEND 240 PREHEAT_3_TEMP_BED 60 PREHEAT_3_FAN_SPEED 128 BOOTSCREEN_TIMEOUT 1100 exec_test $1 $2 "Ender-3 S1 - ProUI (PIDTEMP)" "$3" restore_configs From 1c5426d4af5f5a51f814459f54185c64643a2067 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Mon, 15 May 2023 00:22:01 +0000 Subject: [PATCH 023/100] [cron] Bump distribution date (2023-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 64e5a6a99d3e3..1628f16bd2b90 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 "2023-05-14" +//#define STRING_DISTRIBUTION_DATE "2023-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 bcddf2dbd121e..d8d693d9c4d32 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 "2023-05-14" + #define STRING_DISTRIBUTION_DATE "2023-05-15" #endif /** From b364e44716d8ba0d08d01c2d61067dd8602271d2 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 14 May 2023 18:08:33 -0500 Subject: [PATCH 024/100] =?UTF-8?q?=F0=9F=93=8C=20TH3D=20EZBoard=20SD=5FDE?= =?UTF-8?q?TECT=5FPIN=2027?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Conditionals_post.h | 2 +- Marlin/src/pins/lpc1769/pins_TH3D_EZBOARD.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 8ad4a6161e318..d137e1d9c198a 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -526,7 +526,7 @@ */ #if HAS_MEDIA - #if HAS_SD_HOST_DRIVE && SD_CONNECTION_IS(ONBOARD) + #if HAS_SD_HOST_DRIVE && SD_CONNECTION_IS(ONBOARD) && DISABLED(KEEP_SD_DETECT) // // The external SD card is not used. Hardware SPI is used to access the card. // When sharing the SD card with a PC we want the menu options to diff --git a/Marlin/src/pins/lpc1769/pins_TH3D_EZBOARD.h b/Marlin/src/pins/lpc1769/pins_TH3D_EZBOARD.h index 11fa2c9468d17..1982652af6c59 100644 --- a/Marlin/src/pins/lpc1769/pins_TH3D_EZBOARD.h +++ b/Marlin/src/pins/lpc1769/pins_TH3D_EZBOARD.h @@ -141,7 +141,7 @@ #define SDCARD_CONNECTION ONBOARD -//#define SD_DETECT_PIN P0_25 // SD_CD +#define SD_DETECT_PIN P0_27 // SD_CD #define SD_SCK_PIN P0_07 #define SD_MISO_PIN P0_08 #define SD_MOSI_PIN P0_09 From d17d86d6a5a29e29e4d8e811d9bd6e6a030b7597 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 14 May 2023 18:32:59 -0500 Subject: [PATCH 025/100] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20M43?= =?UTF-8?q?=20updates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/config/M43.cpp | 6 +++--- Marlin/src/pins/pinsDebug.h | 20 ++++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Marlin/src/gcode/config/M43.cpp b/Marlin/src/gcode/config/M43.cpp index c427fe7a31e89..6bd78c68ff243 100644 --- a/Marlin/src/gcode/config/M43.cpp +++ b/Marlin/src/gcode/config/M43.cpp @@ -372,7 +372,7 @@ void GcodeSuite::M43() { for (;;) { LOOP_S_LE_N(i, first_pin, last_pin) { - pin_t pin = GET_PIN_MAP_PIN_M43(i); + const pin_t pin = GET_PIN_MAP_PIN_M43(i); if (!VALID_PIN(pin)) continue; if (M43_NEVER_TOUCH(i) || (!ignore_protection && pin_is_protected(pin))) continue; const byte val = @@ -383,7 +383,7 @@ void GcodeSuite::M43() { //*/ extDigitalRead(pin); if (val != pin_state[i - first_pin]) { - report_pin_state_extended(pin, ignore_protection, false); + report_pin_state_extended(pin, ignore_protection, true); pin_state[i - first_pin] = val; } } @@ -401,7 +401,7 @@ void GcodeSuite::M43() { else { // Report current state of selected pin(s) LOOP_S_LE_N(i, first_pin, last_pin) { - pin_t pin = GET_PIN_MAP_PIN_M43(i); + const pin_t pin = GET_PIN_MAP_PIN_M43(i); if (VALID_PIN(pin)) report_pin_state_extended(pin, ignore_protection, true); } } diff --git a/Marlin/src/pins/pinsDebug.h b/Marlin/src/pins/pinsDebug.h index 4a8928c1e561a..cce3799981a42 100644 --- a/Marlin/src/pins/pinsDebug.h +++ b/Marlin/src/pins/pinsDebug.h @@ -175,11 +175,15 @@ const PinInfo pin_array[] PROGMEM = { #endif static void print_input_or_output(const bool isout) { - SERIAL_ECHOPGM_P(isout ? PSTR("Output = ") : PSTR("Input = ")); + SERIAL_ECHOF(isout ? F("Output ") : F("Input ")); +} + +static void print_pin_state(const bool state) { + SERIAL_ECHOF(state ? F("HIGH") : F("LOW")); } // pretty report with PWM info -inline void report_pin_state_extended(pin_t pin, const bool ignore, const bool extended=false, FSTR_P const start_string=nullptr) { +inline void report_pin_state_extended(const pin_t pin, const bool ignore, const bool extended=false, FSTR_P const start_string=nullptr) { char buffer[MAX_NAME_LENGTH + 1]; // for the sprintf statements bool found = false, multi_name_pin = false; @@ -188,12 +192,12 @@ inline void report_pin_state_extended(pin_t pin, const bool ignore, const bool e // Use FastIO for pins Teensy doesn't expose if (pin == 46) { print_input_or_output(IS_OUTPUT(46)); - SERIAL_CHAR('0' + READ(46)); + print_pin_state(READ(46)); return false; } else if (pin == 47) { print_input_or_output(IS_OUTPUT(47)); - SERIAL_CHAR('0' + READ(47)); + print_pin_state(READ(47)); return false; } #endif @@ -230,14 +234,14 @@ inline void report_pin_state_extended(pin_t pin, const bool ignore, const bool e // because this could interfere with inductive/capacitive // sensors (high impedance voltage divider) and with Pt100 amplifier print_input_or_output(false); - SERIAL_ECHO(digitalRead_mod(pin)); + print_pin_state(digitalRead_mod(pin)); } else if (pwm_status(pin)) { // do nothing } else { print_input_or_output(true); - SERIAL_ECHO(digitalRead_mod(pin)); + print_pin_state(digitalRead_mod(pin)); } } if (!multi_name_pin && extended) pwm_details(pin); // report PWM capabilities only on the first pass & only if doing an extended report @@ -267,7 +271,7 @@ inline void report_pin_state_extended(pin_t pin, const bool ignore, const bool e else if (GET_PINMODE(pin)) { SERIAL_ECHO_SP(MAX_NAME_LENGTH - 16); print_input_or_output(true); - SERIAL_ECHO(digitalRead_mod(pin)); + print_pin_state(digitalRead_mod(pin)); } else { if (IS_ANALOG(pin)) { @@ -279,7 +283,7 @@ inline void report_pin_state_extended(pin_t pin, const bool ignore, const bool e SERIAL_ECHO_SP(MAX_NAME_LENGTH - 16); // add padding if not an analog pin print_input_or_output(false); - SERIAL_ECHO(digitalRead_mod(pin)); + print_pin_state(digitalRead_mod(pin)); } //if (!pwm_status(pin)) SERIAL_CHAR(' '); // add padding if it's not a PWM pin if (extended) { From 2e24637bd66d725dc07a560cda81b40f67fd1d4a Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Mon, 15 May 2023 13:48:55 +1200 Subject: [PATCH 026/100] "One Click" Print newest file (#25781) Co-authored-by: Scott Lahteine --- Marlin/Configuration_adv.h | 1 + Marlin/src/inc/SanityCheck.h | 13 +++ Marlin/src/lcd/marlinui.cpp | 2 +- Marlin/src/lcd/menu/menu.h | 4 + Marlin/src/lcd/menu/menu_media.cpp | 7 +- Marlin/src/lcd/menu/menu_one_click_print.cpp | 44 +++++++ Marlin/src/sd/cardreader.cpp | 107 ++++++++++++++++-- Marlin/src/sd/cardreader.h | 6 + .../PlatformIO/scripts/common-dependencies.h | 3 + buildroot/tests/mks_tinybee | 4 +- ini/features.ini | 1 + 11 files changed, 174 insertions(+), 18 deletions(-) create mode 100644 Marlin/src/lcd/menu/menu_one_click_print.cpp diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 9090eb5a61cd5..278853ac609e4 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1675,6 +1675,7 @@ //#define NO_SD_AUTOSTART // Remove auto#.g file support completely to save some Flash, SRAM //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + //#define ONE_CLICK_PRINT // Prompt to print the newest file on inserted media //#define BROWSE_MEDIA_ON_INSERT // Open the file browser when media is inserted //#define MEDIA_MENU_AT_TOP // Force the media menu to be listed on the top of the main menu diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 53333d8727828..2a9fdde2dc02c 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -4044,6 +4044,19 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive." // Multi-Stepping Limit static_assert(WITHIN(MULTISTEPPING_LIMIT, 1, 128) && IS_POWER_OF_2(MULTISTEPPING_LIMIT), "MULTISTEPPING_LIMIT must be 1, 2, 4, 8, 16, 32, 64, or 128."); +// One Click Print +#if ENABLED(ONE_CLICK_PRINT) + #if !HAS_MEDIA + #error "SD Card or Flash Drive is required for ONE_CLICK_PRINT." + #elif ENABLED(BROWSE_MEDIA_ON_INSERT) + #error "ONE_CLICK_PRINT is incompatible with BROWSE_MEDIA_ON_INSERT." + #elif DISABLED(NO_SD_AUTOSTART) + #error "NO_SD_AUTOSTART must be enabled for ONE_CLICK_PRINT." + #elif !defined(HAS_MARLINUI_MENU) + #error "ONE_CLICK_PRINT needs a display that has Marlin UI menus." + #endif +#endif + // Misc. Cleanup #undef _TEST_PWM #undef _NUM_AXES_STR diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 638a133184f34..e8956ab9e1500 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -424,7 +424,7 @@ void MarlinUI::init() { #if !HAS_GRAPHICAL_TFT - void _wrap_string(uint8_t &col, uint8_t &row, const char * const string, read_byte_cb_t cb_read_byte, bool wordwrap/*=false*/) { + void _wrap_string(uint8_t &col, uint8_t &row, const char * const string, read_byte_cb_t cb_read_byte, const bool wordwrap/*=false*/) { SETCURSOR(col, row); if (!string) return; diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index 5a70ddd3a2f92..1face4774bf5f 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -259,6 +259,10 @@ void _lcd_draw_homing(); void touch_screen_calibration(); #endif +#if ENABLED(ONE_CLICK_PRINT) + void one_click_print(); +#endif + extern uint8_t screen_history_depth; inline void clear_menu_history() { screen_history_depth = 0; } diff --git a/Marlin/src/lcd/menu/menu_media.cpp b/Marlin/src/lcd/menu/menu_media.cpp index e32f41a9a6e17..795ac2052b414 100644 --- a/Marlin/src/lcd/menu/menu_media.cpp +++ b/Marlin/src/lcd/menu/menu_media.cpp @@ -73,14 +73,11 @@ class MenuItem_sdfile : public MenuItem_sdbase { #endif #if ENABLED(SD_MENU_CONFIRM_START) MenuItem_submenu::action(fstr, []{ - char * const longest = card.longest_filename(); - char buffer[strlen(longest) + 2]; - buffer[0] = ' '; - strcpy(buffer + 1, longest); + char * const filename = card.longest_filename(); MenuItem_confirm::select_screen( GET_TEXT_F(MSG_BUTTON_PRINT), GET_TEXT_F(MSG_BUTTON_CANCEL), sdcard_start_selected_file, nullptr, - GET_TEXT_F(MSG_START_PRINT), buffer, F("?") + GET_TEXT_F(MSG_START_PRINT), filename, F("?") ); }); #else diff --git a/Marlin/src/lcd/menu/menu_one_click_print.cpp b/Marlin/src/lcd/menu/menu_one_click_print.cpp new file mode 100644 index 0000000000000..f1ed92d0d5925 --- /dev/null +++ b/Marlin/src/lcd/menu/menu_one_click_print.cpp @@ -0,0 +1,44 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 "../../inc/MarlinConfigPre.h" + +#if ENABLED(ONE_CLICK_PRINT) + +#include "menu.h" + +void one_click_print() { + ui.goto_screen([]{ + char * const filename = card.longest_filename(); + MenuItem_confirm::select_screen( + GET_TEXT_F(MSG_BUTTON_PRINT), GET_TEXT_F(MSG_BUTTON_CANCEL), + []{ + card.openAndPrintFile(card.filename); + ui.return_to_status(); + ui.reset_status(); + }, nullptr, + GET_TEXT_F(MSG_START_PRINT), filename, F("?") + ); + }); +} + +#endif // ONE_CLICK_PRINT diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index 4e864e5672734..cd3d1d2cd603a 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -56,6 +56,10 @@ #include "../feature/pause.h" #endif +#if ENABLED(ONE_CLICK_PRINT) + #include "../../src/lcd/menu/menu.h" +#endif + #define DEBUG_OUT EITHER(DEBUG_CARDREADER, MARLIN_DEV_MODE) #include "../core/debug_out.h" #include "../libs/hex_print.h" @@ -290,7 +294,7 @@ void CardReader::printListing(MediaFile parent, const char * const prepend, cons while (parent.readDir(&p, longFilename) > 0) { if (DIR_IS_SUBDIR(&p)) { - size_t lenPrepend = prepend ? strlen(prepend) + 1 : 0; + const size_t lenPrepend = prepend ? strlen(prepend) + 1 : 0; // Allocate enough stack space for the full path including / separator char path[lenPrepend + FILENAME_LENGTH]; if (prepend) { strcpy(path, prepend); path[lenPrepend - 1] = '/'; } @@ -545,20 +549,28 @@ void CardReader::manage_media() { if (!stat) return; // Exit if no media is present - if (old_stat != 2) return; // First mount? + bool do_auto = true; UNUSED(do_auto); - DEBUG_ECHOLNPGM("First mount."); + // First mount on boot? Load emulated EEPROM and look for PLR file. + if (old_stat == 2) { + DEBUG_ECHOLNPGM("First mount."); - // Load settings the first time media is inserted (not just during init) - TERN_(SDCARD_EEPROM_EMULATION, settings.first_load()); + // Load settings the first time media is inserted (not just during init) + TERN_(SDCARD_EEPROM_EMULATION, settings.first_load()); - bool do_auto = true; UNUSED(do_auto); + // Check for PLR file. Skip One-Click and auto#.g if found + TERN_(POWER_LOSS_RECOVERY, if (recovery.check()) do_auto = false); + } - // Check for PLR file. - TERN_(POWER_LOSS_RECOVERY, if (recovery.check()) do_auto = false); + // Find the newest file and prompt to print it. + TERN_(ONE_CLICK_PRINT, if (do_auto && one_click_check()) do_auto = false); - // Look for auto0.g on the next idle() - IF_DISABLED(NO_SD_AUTOSTART, if (do_auto) autofile_begin()); + // Also for the first mount run auto#.g for machine init. + // (Skip if PLR or One-Click Print was invoked.) + if (old_stat == 2) { + // Look for auto0.g on the next idle() + IF_DISABLED(NO_SD_AUTOSTART, if (do_auto) autofile_begin()); + } } /** @@ -887,6 +899,81 @@ void CardReader::write_command(char * const buf) { } #endif +#if ENABLED(ONE_CLICK_PRINT) + + /** + * Select the newest file and ask the user if they want to print it. + */ + bool CardReader::one_click_check() { + const bool found = selectNewestFile(); + if (found) { + //SERIAL_ECHO_MSG(" OCP File: ", longest_filename(), "\n"); + //ui.init(); + one_click_print(); + } + return found; + } + + /** + * Recurse the entire directory to find the newest file. + * This may take a very long time so watch out for watchdog reset. + * It may be best to only look at root for reasonable boot and mount times. + */ + void CardReader::diveToNewestFile(MediaFile parent, uint32_t &compareDateTime, MediaFile &outdir, char * const outname) { + // Iterate the given parent dir + parent.rewind(); + for (dir_t p; parent.readDir(&p, longFilename) > 0;) { + + // If the item is a dir, recurse into it + if (DIR_IS_SUBDIR(&p)) { + // Get the name of the dir for opening + char dirname[FILENAME_LENGTH]; + createFilename(dirname, p); + + // Open the item in a new MediaFile + MediaFile child; // child.close() in destructor + if (child.open(&parent, dirname, O_READ)) + diveToNewestFile(child, compareDateTime, outdir, outname); + } + else if (is_visible_entity(p)) { + // Get the newer of the modified/created date and time + const uint32_t modDateTime = uint32_t(p.lastWriteDate) << 16 | p.lastWriteTime, + createDateTime = uint32_t(p.creationDate) << 16 | p.creationTime, + newerDateTime = _MAX(modDateTime, createDateTime); + // If a newer item is found overwrite the outdir and outname + if (newerDateTime > compareDateTime) { + compareDateTime = newerDateTime; + outdir = parent; + createFilename(outname, p); + } + } + } + } + + /** + * Recurse the entire directory to find the newest file. + * Make the found file the current selection. + */ + bool CardReader::selectNewestFile() { + uint32_t dateTimeStorage = 0; + MediaFile foundDir; + char foundName[FILENAME_LENGTH]; + foundName[0] = '\0'; + + diveToNewestFile(root, dateTimeStorage, foundDir, foundName); + + if (foundName[0]) { + workDir = foundDir; + workDir.rewind(); + selectByName(workDir, foundName); + //workDir.close(); // Not needed? + return true; + } + return false; + } + +#endif // ONE_CLICK_PRINT + void CardReader::closefile(const bool store_location/*=false*/) { file.sync(); file.close(); diff --git a/Marlin/src/sd/cardreader.h b/Marlin/src/sd/cardreader.h index 3b7b7debcf6cd..4baaa73e1a4a4 100644 --- a/Marlin/src/sd/cardreader.h +++ b/Marlin/src/sd/cardreader.h @@ -128,6 +128,12 @@ class CardReader { static void autofile_cancel() { autofile_index = 0; } #endif + #if ENABLED(ONE_CLICK_PRINT) + static bool one_click_check(); // Check for the newest file and prompt to run it. + static void diveToNewestFile(MediaFile parent, uint32_t &compareDateTime, MediaFile &outdir, char * const outname); + static bool selectNewestFile(); + #endif + // Basic file ops static void openFileRead(const char * const path, const uint8_t subcall=0); static void openFileWrite(const char * const path); diff --git a/buildroot/share/PlatformIO/scripts/common-dependencies.h b/buildroot/share/PlatformIO/scripts/common-dependencies.h index 4438b4efe1892..c75d9a3d675a9 100644 --- a/buildroot/share/PlatformIO/scripts/common-dependencies.h +++ b/buildroot/share/PlatformIO/scripts/common-dependencies.h @@ -104,6 +104,9 @@ #if ENABLED(AUTO_BED_LEVELING_UBL) #define HAS_MENU_UBL #endif + #if ENABLED(ONE_CLICK_PRINT) + #define HAS_MENU_ONE_CLICK_PRINT + #endif #endif #if HAS_GRAPHICAL_TFT diff --git a/buildroot/tests/mks_tinybee b/buildroot/tests/mks_tinybee index 9dcc33ede7c51..0351946d0aea6 100755 --- a/buildroot/tests/mks_tinybee +++ b/buildroot/tests/mks_tinybee @@ -25,8 +25,8 @@ opt_set MOTHERBOARD BOARD_MKS_TINYBEE \ LCD_INFO_SCREEN_STYLE 0 \ DISPLAY_CHARSET_HD44780 WESTERN \ NEOPIXEL_TYPE NEO_RGB -opt_enable FYSETC_MINI_12864_2_1 SDSUPPORT -opt_enable LED_CONTROL_MENU LED_USER_PRESET_STARTUP LED_COLOR_PRESETS NEOPIXEL_LED +opt_enable FYSETC_MINI_12864_2_1 SDSUPPORT ONE_CLICK_PRINT NO_SD_AUTOSTART \ + NEOPIXEL_LED LED_CONTROL_MENU LED_USER_PRESET_STARTUP LED_COLOR_PRESETS exec_test $1 $2 "MKS TinyBee with NeoPixel LCD, SD and Speaker" "$3" # cleanup diff --git a/ini/features.ini b/ini/features.ini index 17d2ece04a052..86e7d2e396bd9 100644 --- a/ini/features.ini +++ b/ini/features.ini @@ -81,6 +81,7 @@ HAS_MENU_LED = build_src_filter=+ HAS_MENU_MIXER = build_src_filter=+ HAS_MENU_MMU2 = build_src_filter=+ +HAS_MENU_ONE_CLICK_PRINT = build_src_filter=+ HAS_MENU_PASSWORD = build_src_filter=+ HAS_MENU_POWER_MONITOR = build_src_filter=+ HAS_MENU_CUTTER = build_src_filter=+ From 46e8b9cad918aa24595983d49df8498d5f7b794c Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 14 May 2023 23:58:31 -0500 Subject: [PATCH 027/100] =?UTF-8?q?=F0=9F=94=A7=20Disable=20FT=20Motion=20?= =?UTF-8?q?by=20default?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 278853ac609e4..587a368301dcc 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1112,7 +1112,7 @@ */ //#define FT_MOTION #if ENABLED(FT_MOTION) - #define FTM_DEFAULT_MODE ftMotionMode_ENABLED // Default mode of fixed time control. (Enums in ft_types.h) + #define FTM_DEFAULT_MODE ftMotionMode_DISABLED // Default mode of fixed time control. (Enums in ft_types.h) #define FTM_DEFAULT_DYNFREQ_MODE dynFreqMode_DISABLED // Default mode of dynamic frequency calculation. (Enums in ft_types.h) #define FTM_SHAPING_DEFAULT_X_FREQ 37.0f // (Hz) Default peak frequency used by input shapers. #define FTM_SHAPING_DEFAULT_Y_FREQ 37.0f // (Hz) Default peak frequency used by input shapers. @@ -1124,26 +1124,26 @@ /** * Advanced configuration */ - #define FTM_BATCH_SIZE 100 // Batch size for trajectory generation; + #define FTM_BATCH_SIZE 100 // Batch size for trajectory generation; // half the window size for Ulendo FBS. - #define FTM_FS 1000 // (Hz) Frequency for trajectory generation. (1 / FTM_TS) - #define FTM_TS 0.001f // (s) Time step for trajectory generation. (1 / FTM_FS) - #define FTM_STEPPER_FS 20000 // (Hz) Frequency for stepper I/O update. + #define FTM_FS 1000 // (Hz) Frequency for trajectory generation. (1 / FTM_TS) + #define FTM_TS 0.001f // (s) Time step for trajectory generation. (1 / FTM_FS) + #define FTM_STEPPER_FS 20000 // (Hz) Frequency for stepper I/O update. #define FTM_MIN_TICKS ((STEPPER_TIMER_RATE) / (FTM_STEPPER_FS)) // Minimum stepper ticks between steps. - #define FTM_MIN_SHAPE_FREQ 10 // Minimum shaping frequency. - #define FTM_ZMAX 100 // Maximum delays for shaping functions (even numbers only!). + #define FTM_MIN_SHAPE_FREQ 10 // Minimum shaping frequency. + #define FTM_ZMAX 100 // Maximum delays for shaping functions (even numbers only!). // Calculate as: // 1/2 * (FTM_FS / FTM_MIN_SHAPE_FREQ) for ZV. // (FTM_FS / FTM_MIN_SHAPE_FREQ) for ZVD, MZV. // 3/2 * (FTM_FS / FTM_MIN_SHAPE_FREQ) for 2HEI. // 2 * (FTM_FS / FTM_MIN_SHAPE_FREQ) for 3HEI. - #define FTM_STEPS_PER_UNIT_TIME 20 // Interpolated stepper commands per unit time. + #define FTM_STEPS_PER_UNIT_TIME 20 // Interpolated stepper commands per unit time. // Calculate as (FTM_STEPPER_FS / FTM_FS). - #define FTM_CTS_COMPARE_VAL 10 // Comparison value used in interpolation algorithm. + #define FTM_CTS_COMPARE_VAL 10 // Comparison value used in interpolation algorithm. // Calculate as (FTM_STEPS_PER_UNIT_TIME / 2). // These values may be configured to adjust duration of loop(). - #define FTM_STEPS_PER_LOOP 60 // Number of stepper commands to generate each loop(). - #define FTM_POINTS_PER_LOOP 100 // Number of trajectory points to generate each loop(). + #define FTM_STEPS_PER_LOOP 60 // Number of stepper commands to generate each loop(). + #define FTM_POINTS_PER_LOOP 100 // Number of trajectory points to generate each loop(). // This value may be configured to adjust duration to consume the command buffer. // Try increasing this value if stepper motion is not smooth. From 99e38c40be66e6e36d05580d80d1bcaf43f71ee6 Mon Sep 17 00:00:00 2001 From: Andrew <18502096+classicrocker883@users.noreply.github.com> Date: Mon, 15 May 2023 17:24:36 -0400 Subject: [PATCH 028/100] =?UTF-8?q?=F0=9F=A9=B9=20Ensure=20pin=5Fis=5Fprot?= =?UTF-8?q?ected=20is=20defined=20(#25829)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/config/M43.cpp | 2 +- Marlin/src/gcode/control/M42.cpp | 3 ++- Marlin/src/pins/pinsDebug.h | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Marlin/src/gcode/config/M43.cpp b/Marlin/src/gcode/config/M43.cpp index 6bd78c68ff243..91db87a1d245b 100644 --- a/Marlin/src/gcode/config/M43.cpp +++ b/Marlin/src/gcode/config/M43.cpp @@ -25,7 +25,7 @@ #if ENABLED(PINS_DEBUGGING) #include "../gcode.h" -#include "../../MarlinCore.h" // for pin_is_protected +#include "../../MarlinCore.h" // for pin_is_protected, wait_for_user #include "../../pins/pinsDebug.h" #include "../../module/endstops.h" diff --git a/Marlin/src/gcode/control/M42.cpp b/Marlin/src/gcode/control/M42.cpp index cf2c218e9259e..6e75ffd4e75c7 100644 --- a/Marlin/src/gcode/control/M42.cpp +++ b/Marlin/src/gcode/control/M42.cpp @@ -25,7 +25,6 @@ #if ENABLED(DIRECT_PIN_CONTROL) #include "../gcode.h" -#include "../../MarlinCore.h" // for pin_is_protected #if HAS_FAN #include "../../module/temperature.h" @@ -38,6 +37,8 @@ #define OUTPUT_OPEN_DRAIN OUTPUT_OPEN_DRAIN #endif +bool pin_is_protected(const pin_t pin); + void protected_pin_err() { SERIAL_ERROR_MSG(STR_ERR_PROTECTED_PIN); } diff --git a/Marlin/src/pins/pinsDebug.h b/Marlin/src/pins/pinsDebug.h index cce3799981a42..3219b1b7a2432 100644 --- a/Marlin/src/pins/pinsDebug.h +++ b/Marlin/src/pins/pinsDebug.h @@ -174,6 +174,8 @@ const PinInfo pin_array[] PROGMEM = { #define M43_NEVER_TOUCH(Q) false #endif +bool pin_is_protected(const pin_t pin); + static void print_input_or_output(const bool isout) { SERIAL_ECHOF(isout ? F("Output ") : F("Input ")); } From dd184cf3c28748b607ba06a6117c4e8425a74e46 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 16 May 2023 00:20:38 +0000 Subject: [PATCH 029/100] [cron] Bump distribution date (2023-05-16) --- 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 1628f16bd2b90..153a4c3be2394 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 "2023-05-15" +//#define STRING_DISTRIBUTION_DATE "2023-05-16" /** * 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 d8d693d9c4d32..22e56dd2f4cbf 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 "2023-05-15" + #define STRING_DISTRIBUTION_DATE "2023-05-16" #endif /** From 6e5f41fe6b996e074b042c6ac521475b8e8aab91 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 15 May 2023 19:48:30 -0500 Subject: [PATCH 030/100] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Ser?= =?UTF-8?q?ial=20ternary=20args,=20etc.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/serial.h | 4 ++-- Marlin/src/feature/bedlevel/ubl/ubl.cpp | 2 +- Marlin/src/feature/encoder_i2c.cpp | 2 +- Marlin/src/gcode/config/M43.cpp | 2 +- Marlin/src/gcode/feature/trinamic/M906.cpp | 1 - Marlin/src/gcode/host/M114.cpp | 8 ++------ Marlin/src/lcd/e3v2/proui/dwin_defines.h | 1 - Marlin/src/module/planner.cpp | 1 + Marlin/src/module/temperature.cpp | 2 +- 9 files changed, 9 insertions(+), 14 deletions(-) diff --git a/Marlin/src/core/serial.h b/Marlin/src/core/serial.h index 475761216c692..62e1294e04686 100644 --- a/Marlin/src/core/serial.h +++ b/Marlin/src/core/serial.h @@ -292,7 +292,7 @@ inline void SERIAL_ECHO_F(EnsureDouble x, int digit=2) { SERIAL_IMPL.print(x, di #define SERIAL_ECHO_SP(C) serial_spaces(C) -#define SERIAL_ECHO_TERNARY(TF, PRE, ON, OFF, POST) serial_ternary(TF, F(PRE), F(ON), F(OFF), F(POST)) +#define SERIAL_ECHO_TERNARY(TF, PRE, ON, OFF, POST) serial_ternary(F(PRE), TF, F(ON), F(OFF), F(POST)) #if SERIAL_FLOAT_PRECISION #define SERIAL_DECIMAL(V) SERIAL_PRINT(V, SERIAL_FLOAT_PRECISION) @@ -327,7 +327,7 @@ inline void serial_echolnpair(FSTR_P const fstr, T v) { serial_echolnpair_P(FTOP void serial_echo_start(); void serial_error_start(); -inline void serial_ternary(const bool onoff, FSTR_P const pre, FSTR_P const on, FSTR_P const off, FSTR_P const post=nullptr) { +inline void serial_ternary(FSTR_P const pre, const bool onoff, FSTR_P const on, FSTR_P const off, FSTR_P const post=nullptr) { if (pre) serial_print(pre); if (onoff && on) serial_print(on); if (!onoff && off) serial_print(off); diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.cpp b/Marlin/src/feature/bedlevel/ubl/ubl.cpp index b7ee6aeef8a26..ca519f86b49d2 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl.cpp @@ -59,7 +59,7 @@ void unified_bed_leveling::report_current_mesh() { void unified_bed_leveling::report_state() { echo_name(); - serial_ternary(planner.leveling_active, F(" System v" UBL_VERSION " "), nullptr, F("in"), F("active\n")); + serial_ternary(F(" System v" UBL_VERSION " "), planner.leveling_active, nullptr, F("in"), F("active\n")); serial_delay(50); } diff --git a/Marlin/src/feature/encoder_i2c.cpp b/Marlin/src/feature/encoder_i2c.cpp index 092ce0f8b8520..b1ff21cf92c7d 100644 --- a/Marlin/src/feature/encoder_i2c.cpp +++ b/Marlin/src/feature/encoder_i2c.cpp @@ -232,7 +232,7 @@ bool I2CPositionEncoder::passes_test(const bool report) { if (report) { if (H != I2CPE_MAG_SIG_GOOD) SERIAL_ECHOPGM("Warning. "); SERIAL_CHAR(AXIS_CHAR(encoderAxis)); - serial_ternary(H == I2CPE_MAG_SIG_BAD, F(" axis "), F("magnetic strip "), F("encoder ")); + serial_ternary(F(" axis "), H == I2CPE_MAG_SIG_BAD, F("magnetic strip "), F("encoder ")); switch (H) { case I2CPE_MAG_SIG_GOOD: case I2CPE_MAG_SIG_MID: diff --git a/Marlin/src/gcode/config/M43.cpp b/Marlin/src/gcode/config/M43.cpp index 91db87a1d245b..3b95ccd3bb1c1 100644 --- a/Marlin/src/gcode/config/M43.cpp +++ b/Marlin/src/gcode/config/M43.cpp @@ -149,7 +149,7 @@ inline void servo_probe_test() { #endif SERIAL_ECHOLNPGM(". Probe " _PROBE_PREF "_PIN: ", PROBE_TEST_PIN); - serial_ternary(probe_hit_state, F(". " _PROBE_PREF "_ENDSTOP_HIT_STATE: "), F("HIGH"), F("LOW")); + serial_ternary(F(". " _PROBE_PREF "_ENDSTOP_HIT_STATE: "), probe_hit_state, F("HIGH"), F("LOW")); SERIAL_EOL(); SET_INPUT_PULLUP(PROBE_TEST_PIN); diff --git a/Marlin/src/gcode/feature/trinamic/M906.cpp b/Marlin/src/gcode/feature/trinamic/M906.cpp index b2cab135531c2..b949200ad7797 100644 --- a/Marlin/src/gcode/feature/trinamic/M906.cpp +++ b/Marlin/src/gcode/feature/trinamic/M906.cpp @@ -328,7 +328,6 @@ void GcodeSuite::M906_report(const bool forReplay/*=true*/) { say_M906(forReplay); SERIAL_ECHOLNPGM(" T7 E", stepperE7.getMilliamps()); #endif - SERIAL_EOL(); } #endif // HAS_TRINAMIC_CONFIG diff --git a/Marlin/src/gcode/host/M114.cpp b/Marlin/src/gcode/host/M114.cpp index e6e83ba6e5981..3a75e687b8461 100644 --- a/Marlin/src/gcode/host/M114.cpp +++ b/Marlin/src/gcode/host/M114.cpp @@ -128,9 +128,7 @@ void GcodeSuite::M114() { #if ENABLED(M114_DETAIL) if (parser.seen_test('D')) { - #if DISABLED(M114_LEGACY) - planner.synchronize(); - #endif + IF_DISABLED(M114_LEGACY, planner.synchronize()); report_current_position(); report_current_position_detail(); return; @@ -143,9 +141,7 @@ void GcodeSuite::M114() { #endif #endif - #if ENABLED(M114_REALTIME) - if (parser.seen_test('R')) { report_real_position(); return; } - #endif + TERN_(M114_REALTIME, if (parser.seen_test('R')) return report_real_position()); TERN_(M114_LEGACY, planner.synchronize()); report_current_position_projected(); diff --git a/Marlin/src/lcd/e3v2/proui/dwin_defines.h b/Marlin/src/lcd/e3v2/proui/dwin_defines.h index e87aedf311791..164fd00fe6daf 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_defines.h +++ b/Marlin/src/lcd/e3v2/proui/dwin_defines.h @@ -29,7 +29,6 @@ */ //#define DEBUG_DWIN 1 -//#define NEED_HEX_PRINT 1 #if defined(__STM32F1__) || defined(STM32F1) #define DASH_REDRAW 1 diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index a9da48df01883..a2d7e6843beba 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1929,6 +1929,7 @@ bool Planner::_populate_block( #endif #if HAS_W_AXIS " " STR_W ":", target.w, " (", dw, " steps)" + #endif #if HAS_EXTRUDERS " E:", target.e, " (", de, " steps)" #endif diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 685f5dab2f59c..f785a683eb4a4 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -3145,7 +3145,7 @@ void Temperature::init() { if (TERN0(REPORT_ADAPTIVE_FAN_SLOWING, DEBUGGING(INFO))) { const uint8_t fss7 = fan_speed_scaler[fan_index] & 0x80; if (fss7 ^ (scale & 0x80)) - serial_ternary(fss7, F("Adaptive Fan Slowing "), nullptr, F("de"), F("activated.\n")); + serial_ternary(F("Adaptive Fan Slowing "), fss7, nullptr, F("de"), F("activated.\n")); } fan_speed_scaler[fan_index] = scale; From 48496dfec14588e646788f5a7099b55093d90ad1 Mon Sep 17 00:00:00 2001 From: lukasradek Date: Tue, 16 May 2023 03:49:45 +0200 Subject: [PATCH 031/100] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20Fix=20pin=20debug?= =?UTF-8?q?=20ternary=20(#25832)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/NATIVE_SIM/pinsDebug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/HAL/NATIVE_SIM/pinsDebug.h b/Marlin/src/HAL/NATIVE_SIM/pinsDebug.h index eeb8245641b40..9c53b4b0d9c9a 100644 --- a/Marlin/src/HAL/NATIVE_SIM/pinsDebug.h +++ b/Marlin/src/HAL/NATIVE_SIM/pinsDebug.h @@ -38,7 +38,7 @@ // Active ADC function/mode/code values for PINSEL registers constexpr int8_t ADC_pin_mode(pin_t pin) { return -1; } -int8_t get_pin_mode(const pin_t pin) { return VALID_PIN(pin) 0 : -1; } +int8_t get_pin_mode(const pin_t pin) { return VALID_PIN(pin) ? 0 : -1; } bool GET_PINMODE(const pin_t pin) { const int8_t pin_mode = get_pin_mode(pin); From 25ddde0394361c23194c0f4a8f9777d389040af3 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 15 May 2023 22:00:15 -0500 Subject: [PATCH 032/100] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Cha?= =?UTF-8?q?nge=20Marlin=20DIR=20bits:=201=3DForward,=200=3DReverse=20(#257?= =?UTF-8?q?91)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/backlash.cpp | 10 +- Marlin/src/feature/runout.h | 2 +- Marlin/src/gcode/feature/ft_motion/M493.cpp | 13 +- Marlin/src/gcode/motion/G6.cpp | 11 +- Marlin/src/inc/SanityCheck.h | 8 +- Marlin/src/module/endstops.cpp | 18 +- Marlin/src/module/ft_motion.cpp | 57 ++--- Marlin/src/module/planner.cpp | 251 ++++++++------------ Marlin/src/module/planner.h | 2 +- Marlin/src/module/stepper.cpp | 222 ++++++++--------- Marlin/src/module/stepper.h | 2 +- 11 files changed, 266 insertions(+), 330 deletions(-) diff --git a/Marlin/src/feature/backlash.cpp b/Marlin/src/feature/backlash.cpp index 256488762a7d2..8d180c7a4a3e5 100644 --- a/Marlin/src/feature/backlash.cpp +++ b/Marlin/src/feature/backlash.cpp @@ -99,15 +99,15 @@ void Backlash::add_correction_steps(const int32_t &da, const int32_t &db, const LOOP_NUM_AXES(axis) { if (distance_mm[axis]) { - const bool reverse = dm[axis]; + const bool forward = dm[axis]; // When an axis changes direction, add axis backlash to the residual error if (changed_dir[axis]) - residual_error[axis] += (reverse ? -f_corr : f_corr) * distance_mm[axis] * planner.settings.axis_steps_per_mm[axis]; + residual_error[axis] += (forward ? f_corr : -f_corr) * distance_mm[axis] * planner.settings.axis_steps_per_mm[axis]; // Decide how much of the residual error to correct in this segment int32_t error_correction = residual_error[axis]; - if (reverse != (error_correction < 0)) + if (forward == (error_correction < 0)) error_correction = 0; // Don't take up any backlash in this segment, as it would subtract steps #ifdef BACKLASH_SMOOTHING_MM @@ -147,14 +147,14 @@ void Backlash::add_correction_steps(const int32_t &da, const int32_t &db, const int32_t Backlash::get_applied_steps(const AxisEnum axis) { if (axis >= NUM_AXES) return 0; - const bool reverse = last_direction_bits[axis]; + const bool forward = last_direction_bits[axis]; const int32_t residual_error_axis = residual_error[axis]; // At startup it is assumed the last move was forwards. So the applied // steps will always be a non-positive number. - if (!reverse) return -residual_error_axis; + if (forward) return -residual_error_axis; const float f_corr = float(correction) / all_on; const int32_t full_error_axis = -f_corr * distance_mm[axis] * planner.settings.axis_steps_per_mm[axis]; diff --git a/Marlin/src/feature/runout.h b/Marlin/src/feature/runout.h index e6ca9f78cdd9f..e160f889050d7 100644 --- a/Marlin/src/feature/runout.h +++ b/Marlin/src/feature/runout.h @@ -411,7 +411,7 @@ class FilamentSensorBase { // Only trigger on extrusion with XYZ movement to allow filament change and retract/recover. const uint8_t e = b->extruder; const int32_t steps = b->steps.e; - const float mm = (b->direction_bits.e ? -steps : steps) * planner.mm_per_step[E_AXIS_N(e)]; + const float mm = (b->direction_bits.e ? steps : -steps) * planner.mm_per_step[E_AXIS_N(e)]; if (e < NUM_RUNOUT_SENSORS) mm_countdown.runout[e] -= mm; #if ENABLED(FILAMENT_SWITCH_AND_MOTION) if (e < NUM_MOTION_SENSORS) mm_countdown.motion[e] -= mm; diff --git a/Marlin/src/gcode/feature/ft_motion/M493.cpp b/Marlin/src/gcode/feature/ft_motion/M493.cpp index 31e16a194d7ac..f7b8f1e752cf6 100644 --- a/Marlin/src/gcode/feature/ft_motion/M493.cpp +++ b/Marlin/src/gcode/feature/ft_motion/M493.cpp @@ -102,8 +102,10 @@ void GcodeSuite::M493() { } switch (val) { - case ftMotionMode_ENABLED: fxdTiCtrl.reset(); break; #if HAS_X_AXIS + //case ftMotionMode_ULENDO_FBS: + //case ftMotionMode_DISCTF: + // break; case ftMotionMode_ZV: case ftMotionMode_ZVD: case ftMotionMode_EI: @@ -114,9 +116,10 @@ void GcodeSuite::M493() { fxdTiCtrl.updateShapingA(); fxdTiCtrl.reset(); break; - //case ftMotionMode_ULENDO_FBS: - //case ftMotionMode_DISCTF: #endif + case ftMotionMode_ENABLED: + fxdTiCtrl.reset(); + break; default: break; } } @@ -195,7 +198,7 @@ void GcodeSuite::M493() { fxdTiCtrl.reset(); if (fxdTiCtrl.cfg_dynFreqMode) { SERIAL_ECHOPGM("Compensator base dynamic frequency (X/A axis) set to:"); } else { SERIAL_ECHOPGM("Compensator static frequency (X/A axis) set to: "); } - SERIAL_ECHO_F( fxdTiCtrl.cfg_baseFreq[0], 2 ); + SERIAL_ECHO_F(fxdTiCtrl.cfg_baseFreq[0], 2); SERIAL_ECHOLNPGM("."); } else { // Frequency out of range. @@ -243,7 +246,7 @@ void GcodeSuite::M493() { fxdTiCtrl.reset(); if (fxdTiCtrl.cfg_dynFreqMode) { SERIAL_ECHOPGM("Compensator base dynamic frequency (Y/B axis) set to:"); } else { SERIAL_ECHOPGM("Compensator static frequency (Y/B axis) set to: "); } - SERIAL_ECHO_F( fxdTiCtrl.cfg_baseFreq[1], 2 ); + SERIAL_ECHO_F(fxdTiCtrl.cfg_baseFreq[1], 2); SERIAL_ECHOLNPGM("."); } else { // Frequency out of range. diff --git a/Marlin/src/gcode/motion/G6.cpp b/Marlin/src/gcode/motion/G6.cpp index fb6281707b453..342741e6341b7 100644 --- a/Marlin/src/gcode/motion/G6.cpp +++ b/Marlin/src/gcode/motion/G6.cpp @@ -38,10 +38,13 @@ void GcodeSuite::G6() { planner.last_page_step_rate = parser.value_ulong(); if (!DirectStepping::Config::DIRECTIONAL) { - if (parser.seen('X')) planner.last_page_dir.x = !!parser.value_byte(); - if (parser.seen('Y')) planner.last_page_dir.y = !!parser.value_byte(); - if (parser.seen('Z')) planner.last_page_dir.z = !!parser.value_byte(); - if (parser.seen('E')) planner.last_page_dir.e = !!parser.value_byte(); + #define PAGE_DIR_SET(N,A) do{ if (parser.seen(N)) planner.last_page_dir.A = !!parser.value_byte(); } while(0) + LOGICAL_AXIS_CODE( + PAGE_DIR_SET('E',E), + PAGE_DIR_SET('X',X), PAGE_DIR_SET('Y',Y), PAGE_DIR_SET('Z',Z), + PAGE_DIR_SET(AXIS4_NAME,I), PAGE_DIR_SET(AXIS5_NAME,J), PAGE_DIR_SET(AXIS6_NAME,K), + PAGE_DIR_SET(AXIS5_NAME,U), PAGE_DIR_SET(AXIS6_NAME,V), PAGE_DIR_SET(AXIS7_NAME,W) + ); } // No index means we just set the state diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 2a9fdde2dc02c..67d11d93e0762 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -4037,8 +4037,12 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive." /** * Fixed-Time Motion limitations */ -#if ENABLED(FT_MOTION) && (NUM_AXES > 3 || E_STEPPERS > 1 || NUM_Z_STEPPERS > 1 || ANY(DUAL_X_CARRIAGE, HAS_SYNCED_X_STEPPERS, HAS_SYNCED_Y_STEPPERS, HAS_MULTI_EXTRUDER, MIXING_EXTRUDER)) - #error "FT_MOTION is currently limited to machines with 3 linear axes and a single extruder." +#if ENABLED(FT_MOTION) + #if NUM_AXES > 3 + #error "FT_MOTION is currently limited to machines with 3 linear axes." + #elif ENABLED(MIXING_EXTRUDER) + #error "FT_MOTION is incompatible with MIXING_EXTRUDER." + #endif #endif // Multi-Stepping Limit diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index 0a12e1041df90..a22c4f03817ba 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -872,7 +872,7 @@ void Endstops::update() { #if HAS_X_AXIS if (stepper.axis_is_moving(X_AXIS)) { - if (stepper.motor_direction(X_AXIS_HEAD)) { // -direction + if (!stepper.motor_direction(X_AXIS_HEAD)) { // -direction #if USE_X_MIN || (X_SPI_SENSORLESS && X_HOME_TO_MIN) PROCESS_ENDSTOP_X(MIN); #if CORE_DIAG(XY, Y, MIN) @@ -905,7 +905,7 @@ void Endstops::update() { #if HAS_Y_AXIS if (stepper.axis_is_moving(Y_AXIS)) { - if (stepper.motor_direction(Y_AXIS_HEAD)) { // -direction + if (!stepper.motor_direction(Y_AXIS_HEAD)) { // -direction #if USE_Y_MIN || (Y_SPI_SENSORLESS && Y_HOME_TO_MIN) PROCESS_ENDSTOP_Y(MIN); #if CORE_DIAG(XY, X, MIN) @@ -938,7 +938,7 @@ void Endstops::update() { #if HAS_Z_AXIS if (stepper.axis_is_moving(Z_AXIS)) { - if (stepper.motor_direction(Z_AXIS_HEAD)) { // Z -direction. Gantry down, bed up. + if (!stepper.motor_direction(Z_AXIS_HEAD)) { // Z -direction. Gantry down, bed up. #if USE_Z_MIN || (Z_SPI_SENSORLESS && Z_HOME_TO_MIN) if ( TERN1(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN, z_probe_enabled) @@ -983,7 +983,7 @@ void Endstops::update() { #if HAS_I_AXIS if (stepper.axis_is_moving(I_AXIS)) { - if (stepper.motor_direction(I_AXIS_HEAD)) { // -direction + if (!stepper.motor_direction(I_AXIS_HEAD)) { // -direction #if USE_I_MIN || (I_SPI_SENSORLESS && I_HOME_TO_MIN) PROCESS_ENDSTOP(I, MIN); #endif @@ -998,7 +998,7 @@ void Endstops::update() { #if HAS_J_AXIS if (stepper.axis_is_moving(J_AXIS)) { - if (stepper.motor_direction(J_AXIS_HEAD)) { // -direction + if (!stepper.motor_direction(J_AXIS_HEAD)) { // -direction #if USE_J_MIN || (J_SPI_SENSORLESS && J_HOME_TO_MIN) PROCESS_ENDSTOP(J, MIN); #endif @@ -1013,7 +1013,7 @@ void Endstops::update() { #if HAS_K_AXIS if (stepper.axis_is_moving(K_AXIS)) { - if (stepper.motor_direction(K_AXIS_HEAD)) { // -direction + if (!stepper.motor_direction(K_AXIS_HEAD)) { // -direction #if USE_K_MIN || (K_SPI_SENSORLESS && K_HOME_TO_MIN) PROCESS_ENDSTOP(K, MIN); #endif @@ -1028,7 +1028,7 @@ void Endstops::update() { #if HAS_U_AXIS if (stepper.axis_is_moving(U_AXIS)) { - if (stepper.motor_direction(U_AXIS_HEAD)) { // -direction + if (!stepper.motor_direction(U_AXIS_HEAD)) { // -direction #if USE_U_MIN || (U_SPI_SENSORLESS && U_HOME_TO_MIN) PROCESS_ENDSTOP(U, MIN); #endif @@ -1043,7 +1043,7 @@ void Endstops::update() { #if HAS_V_AXIS if (stepper.axis_is_moving(V_AXIS)) { - if (stepper.motor_direction(V_AXIS_HEAD)) { // -direction + if (!stepper.motor_direction(V_AXIS_HEAD)) { // -direction #if USE_V_MIN || (V_SPI_SENSORLESS && V_HOME_TO_MIN) PROCESS_ENDSTOP(V, MIN); #endif @@ -1058,7 +1058,7 @@ void Endstops::update() { #if HAS_W_AXIS if (stepper.axis_is_moving(W_AXIS)) { - if (stepper.motor_direction(W_AXIS_HEAD)) { // -direction + if (!stepper.motor_direction(W_AXIS_HEAD)) { // -direction #if USE_W_MIN || (W_SPI_SENSORLESS && W_HOME_TO_MIN) PROCESS_ENDSTOP(W, MIN); #endif diff --git a/Marlin/src/module/ft_motion.cpp b/Marlin/src/module/ft_motion.cpp index 97dae881f8891..407296f0303dd 100644 --- a/Marlin/src/module/ft_motion.cpp +++ b/Marlin/src/module/ft_motion.cpp @@ -422,9 +422,9 @@ void FxdTiCtrl::reset() { stepperCmdBuff_produceIdx = stepperCmdBuff_consumeIdx = 0; for (uint32_t i = 0U; i < (FTM_BATCH_SIZE); i++) { // Reset trajectory history - TERN_(HAS_X_AXIS, xd[i] = 0.0f); - TERN_(HAS_Y_AXIS, yd[i] = 0.0f); - TERN_(HAS_Z_AXIS, zd[i] = 0.0f); + TERN_(HAS_X_AXIS, xd[i] = 0.0f); + TERN_(HAS_Y_AXIS, yd[i] = 0.0f); + TERN_(HAS_Z_AXIS, zd[i] = 0.0f); TERN_(HAS_EXTRUDERS, ed[i] = 0.0f); } @@ -432,23 +432,26 @@ void FxdTiCtrl::reset() { batchRdy = batchRdyForInterp = false; runoutEna = false; - TERN_(HAS_X_AXIS, x_endPosn_prevBlock = 0.0f); - TERN_(HAS_Y_AXIS, y_endPosn_prevBlock = 0.0f); - TERN_(HAS_Z_AXIS, z_endPosn_prevBlock = 0.0f); + TERN_(HAS_X_AXIS, x_endPosn_prevBlock = 0.0f); + TERN_(HAS_Y_AXIS, y_endPosn_prevBlock = 0.0f); + TERN_(HAS_Z_AXIS, z_endPosn_prevBlock = 0.0f); TERN_(HAS_EXTRUDERS, e_endPosn_prevBlock = 0.0f); makeVector_idx = makeVector_idx_z1 = 0; makeVector_batchIdx = FTM_BATCH_SIZE; - TERN_(HAS_X_AXIS, x_steps = 0); - TERN_(HAS_Y_AXIS, y_steps = 0); - TERN_(HAS_Z_AXIS, z_steps = 0); + TERN_(HAS_X_AXIS, x_steps = 0); + TERN_(HAS_Y_AXIS, y_steps = 0); + TERN_(HAS_Z_AXIS, z_steps = 0); TERN_(HAS_EXTRUDERS, e_steps = 0); + interpIdx = interpIdx_z1 = 0; - TERN_(HAS_X_AXIS, x_dirState = stepDirState_NOT_SET); - TERN_(HAS_Y_AXIS, y_dirState = stepDirState_NOT_SET); - TERN_(HAS_Z_AXIS, z_dirState = stepDirState_NOT_SET); + + TERN_(HAS_X_AXIS, x_dirState = stepDirState_NOT_SET); + TERN_(HAS_Y_AXIS, y_dirState = stepDirState_NOT_SET); + TERN_(HAS_Z_AXIS, z_dirState = stepDirState_NOT_SET); TERN_(HAS_EXTRUDERS, e_dirState = stepDirState_NOT_SET); + nextStepTicks = FTM_MIN_TICKS; #if HAS_X_AXIS @@ -486,28 +489,28 @@ void FxdTiCtrl::loadBlockData(block_t * const current_block) { #if HAS_X_AXIS x_startPosn = x_endPosn_prevBlock; float x_moveDist = current_block->steps.a / planner.settings.axis_steps_per_mm[X_AXIS]; - if (direction.x) x_moveDist *= -1.0f; + if (!direction.x) x_moveDist *= -1.0f; x_Ratio = x_moveDist * oneOverLength; #endif #if HAS_Y_AXIS y_startPosn = y_endPosn_prevBlock; float y_moveDist = current_block->steps.b / planner.settings.axis_steps_per_mm[Y_AXIS]; - if (direction.y) y_moveDist *= -1.0f; + if (!direction.y) y_moveDist *= -1.0f; y_Ratio = y_moveDist * oneOverLength; #endif #if HAS_Z_AXIS z_startPosn = z_endPosn_prevBlock; float z_moveDist = current_block->steps.c / planner.settings.axis_steps_per_mm[Z_AXIS]; - if (direction.z) z_moveDist *= -1.0f; + if (!direction.z) z_moveDist *= -1.0f; z_Ratio = z_moveDist * oneOverLength; #endif #if HAS_EXTRUDERS e_startPosn = e_endPosn_prevBlock; float extrusion = current_block->steps.e / planner.settings.axis_steps_per_mm[E_AXIS_N(current_block->extruder)]; - if (direction.e) extrusion *= -1.0f; + if (!direction.e) extrusion *= -1.0f; e_Ratio = extrusion * oneOverLength; #endif @@ -568,31 +571,31 @@ void FxdTiCtrl::loadBlockData(block_t * const current_block) { // One less than (Accel + Coasting + Decel) datapoints max_intervals = N1 + N2 + N3 - 1U; - TERN_(HAS_X_AXIS, x_endPosn_prevBlock += x_moveDist); - TERN_(HAS_Y_AXIS, y_endPosn_prevBlock += y_moveDist); - TERN_(HAS_Z_AXIS, z_endPosn_prevBlock += z_moveDist); + TERN_(HAS_X_AXIS, x_endPosn_prevBlock += x_moveDist); + TERN_(HAS_Y_AXIS, y_endPosn_prevBlock += y_moveDist); + TERN_(HAS_Z_AXIS, z_endPosn_prevBlock += z_moveDist); TERN_(HAS_EXTRUDERS, e_endPosn_prevBlock += extrusion); } // Generate data points of the trajectory. void FxdTiCtrl::makeVector() { - float accel_k = 0.0f; // (mm/s^2) Acceleration K factor - float tau = (makeVector_idx + 1) * (FTM_TS); // (s) Time since start of block - float dist = 0.0f; // (mm) Distance traveled + float accel_k = 0.0f; // (mm/s^2) Acceleration K factor + float tau = (makeVector_idx + 1) * (FTM_TS); // (s) Time since start of block + float dist = 0.0f; // (mm) Distance traveled if (makeVector_idx < N1) { // Acceleration phase - dist = (f_s * tau) + (0.5f * accel_P * sq(tau)); // (mm) Distance traveled for acceleration phase - accel_k = accel_P; // (mm/s^2) Acceleration K factor from Accel phase + dist = (f_s * tau) + (0.5f * accel_P * sq(tau)); // (mm) Distance traveled for acceleration phase + accel_k = accel_P; // (mm/s^2) Acceleration K factor from Accel phase } else if (makeVector_idx >= N1 && makeVector_idx < (N1 + N2)) { // Coasting phase - dist = s_1e + F_P * (tau - N1 * (FTM_TS)); // (mm) Distance traveled for coasting phase + dist = s_1e + F_P * (tau - N1 * (FTM_TS)); // (mm) Distance traveled for coasting phase //accel_k = 0.0f; } else { // Deceleration phase - const float tau_ = tau - (N1 + N2) * (FTM_TS); // (s) Time since start of decel phase + const float tau_ = tau - (N1 + N2) * (FTM_TS); // (s) Time since start of decel phase dist = s_2e + F_P * tau_ + 0.5f * decel_P * sq(tau_); // (mm) Distance traveled for deceleration phase accel_k = decel_P; // (mm/s^2) Acceleration K factor from Decel phase } @@ -614,7 +617,7 @@ void FxdTiCtrl::makeVector() { } else { ed[makeVector_batchIdx] = new_raw_z1; - // Alternatively: coordArray_e[makeVector_batchIdx] = e_startDist + extrusion / (N1 + N2 + N3); + // Alternatively: ed[makeVector_batchIdx] = e_startPosn + (e_Ratio * dist) / (N1 + N2 + N3); } #endif diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index a2d7e6843beba..b0d0b3e353c26 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -169,7 +169,7 @@ float Planner::mm_per_step[DISTINCT_AXES]; // (mm) Millimeters per step #if ENABLED(DIRECT_STEPPING) uint32_t Planner::last_page_step_rate = 0; - xyze_bool_t Planner::last_page_dir{0}; + AxisBits Planner::last_page_dir; // = 0 #endif #if HAS_EXTRUDERS @@ -1887,67 +1887,56 @@ bool Planner::_populate_block( OPTARG(HAS_DIST_MM_ARG, const xyze_float_t &cart_dist_mm) , feedRate_t fr_mm_s, const uint8_t extruder, const PlannerHints &hints ) { - int32_t LOGICAL_AXIS_LIST( - de = target.e - position.e, - da = target.a - position.a, - db = target.b - position.b, - dc = target.c - position.c, - di = target.i - position.i, - dj = target.j - position.j, - dk = target.k - position.k, - du = target.u - position.u, - dv = target.v - position.v, - dw = target.w - position.w - ); + xyze_long_t dist = target - position; /* <-- add a slash to enable SERIAL_ECHOLNPGM( " _populate_block FR:", fr_mm_s, #if HAS_X_AXIS - " A:", target.a, " (", da, " steps)" + " A:", target.a, " (", dist.a, " steps)" #endif #if HAS_Y_AXIS - " B:", target.b, " (", db, " steps)" + " B:", target.b, " (", dist.b, " steps)" #endif #if HAS_Z_AXIS - " C:", target.c, " (", dc, " steps)" + " C:", target.c, " (", dist.c, " steps)" #endif #if HAS_I_AXIS - " " STR_I ":", target.i, " (", di, " steps)" + " " STR_I ":", target.i, " (", dist.i, " steps)" #endif #if HAS_J_AXIS - " " STR_J ":", target.j, " (", dj, " steps)" + " " STR_J ":", target.j, " (", dist.j, " steps)" #endif #if HAS_K_AXIS - " " STR_K ":", target.k, " (", dk, " steps)" + " " STR_K ":", target.k, " (", dist.k, " steps)" #endif #if HAS_U_AXIS - " " STR_U ":", target.u, " (", du, " steps)" + " " STR_U ":", target.u, " (", dist.u, " steps)" #endif #if HAS_V_AXIS - " " STR_V ":", target.v, " (", dv, " steps)" + " " STR_V ":", target.v, " (", dist.v, " steps)" #endif #if HAS_W_AXIS - " " STR_W ":", target.w, " (", dw, " steps)" + " " STR_W ":", target.w, " (", dist.w, " steps)" #endif #if HAS_EXTRUDERS - " E:", target.e, " (", de, " steps)" + " E:", target.e, " (", dist.e, " steps)" #endif ); //*/ #if EITHER(PREVENT_COLD_EXTRUSION, PREVENT_LENGTHY_EXTRUDE) - if (de) { + if (dist.e) { #if ENABLED(PREVENT_COLD_EXTRUSION) if (thermalManager.tooColdToExtrude(extruder)) { position.e = target.e; // Behave as if the move really took place, but ignore E part TERN_(HAS_POSITION_FLOAT, position_float.e = target_float.e); - de = 0; // no difference + dist.e = 0; // no difference SERIAL_ECHO_MSG(STR_ERR_COLD_EXTRUDE_STOP); } #endif // PREVENT_COLD_EXTRUSION #if ENABLED(PREVENT_LENGTHY_EXTRUDE) - const float e_steps = ABS(de * e_factor[extruder]); + const float e_steps = ABS(dist.e * e_factor[extruder]); const float max_e_steps = settings.axis_steps_per_mm[E_AXIS_N(extruder)] * (EXTRUDE_MAXLENGTH); if (e_steps > max_e_steps) { #if ENABLED(MIXING_EXTRUDER) @@ -1962,7 +1951,7 @@ bool Planner::_populate_block( if (ignore_e) { position.e = target.e; // Behave as if the move really took place, but ignore E part TERN_(HAS_POSITION_FLOAT, position_float.e = target_float.e); - de = 0; // no difference + dist.e = 0; // no difference SERIAL_ECHO_MSG(STR_ERR_LONG_EXTRUDE_STOP); } } @@ -1973,49 +1962,49 @@ bool Planner::_populate_block( // Compute direction bit-mask for this block AxisBits dm; #if ANY(CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX) - dm.hx = (da < 0); // Save the toolhead's true direction in X - dm.hy = (db < 0); // ...and Y - TERN_(HAS_Z_AXIS, dm.z = (dc < 0)); + dm.hx = (dist.a > 0); // Save the toolhead's true direction in X + dm.hy = (dist.b > 0); // ...and Y + TERN_(HAS_Z_AXIS, dm.z = (dist.c > 0)); #endif #if IS_CORE #if CORE_IS_XY - dm.a = (da + db < 0); // Motor A direction - dm.b = (CORESIGN(da - db) < 0); // Motor B direction + dm.a = (dist.a + dist.b > 0); // Motor A direction + dm.b = (CORESIGN(dist.a - dist.b) > 0); // Motor B direction #elif CORE_IS_XZ - dm.hx = (da < 0); // Save the toolhead's true direction in X - dm.y = (db < 0); - dm.hz = (dc < 0); // ...and Z - dm.a = (da + dc < 0); // Motor A direction - dm.c = (CORESIGN(da - dc) < 0); // Motor C direction + dm.hx = (dist.a > 0); // Save the toolhead's true direction in X + dm.y = (dist.b > 0); + dm.hz = (dist.c > 0); // ...and Z + dm.a = (dist.a + dist.c > 0); // Motor A direction + dm.c = (CORESIGN(dist.a - dist.c) > 0); // Motor C direction #elif CORE_IS_YZ - dm.x = (da < 0); - dm.hy = (db < 0); // Save the toolhead's true direction in Y - dm.hz = (dc < 0); // ...and Z - dm.b = (db + dc < 0); // Motor B direction - dm.c = (CORESIGN(db - dc) < 0); // Motor C direction + dm.x = (dist.a > 0); + dm.hy = (dist.b > 0); // Save the toolhead's true direction in Y + dm.hz = (dist.c > 0); // ...and Z + dm.b = (dist.b + dist.c > 0); // Motor B direction + dm.c = (CORESIGN(dist.b - dist.c) > 0); // Motor C direction #endif #elif ENABLED(MARKFORGED_XY) - dm.a = (da + db < 0); // Motor A direction - dm.b = (db < 0); // Motor B direction + dm.a = (dist.a + dist.b > 0); // Motor A direction + dm.b = (dist.b > 0); // Motor B direction #elif ENABLED(MARKFORGED_YX) - dm.a = (da < 0); // Motor A direction - dm.b = (db + da < 0); // Motor B direction + dm.a = (dist.a > 0); // Motor A direction + dm.b = (dist.b + dist.a > 0); // Motor B direction #else XYZ_CODE( - dm.x = (da < 0), - dm.y = (db < 0), - dm.z = (dc < 0) + dm.x = (dist.a > 0), + dm.y = (dist.b > 0), + dm.z = (dist.c > 0) ); #endif SECONDARY_AXIS_CODE( - dm.i = (di < 0), dm.j = (dj < 0), dm.k = (dk < 0), - dm.u = (du < 0), dm.v = (dv < 0), dm.w = (dw < 0) + dm.i = (dist.i > 0), dm.j = (dist.j > 0), dm.k = (dist.k > 0), + dm.u = (dist.u > 0), dm.v = (dist.v > 0), dm.w = (dist.w > 0) ); #if HAS_EXTRUDERS - dm.e = (de < 0); - const float esteps_float = de * e_factor[extruder]; + dm.e = (dist.e > 0); + const float esteps_float = dist.e * e_factor[extruder]; const uint32_t esteps = ABS(esteps_float) + 0.5f; #else constexpr uint32_t esteps = 0; @@ -2061,21 +2050,21 @@ bool Planner::_populate_block( // See https://www.corexy.com/theory.html block->steps.set(NUM_AXIS_LIST( #if CORE_IS_XY - ABS(da + db), ABS(da - db), ABS(dc) + ABS(dist.a + dist.b), ABS(dist.a - dist.b), ABS(dist.c) #elif CORE_IS_XZ - ABS(da + dc), ABS(db), ABS(da - dc) + ABS(dist.a + dist.c), ABS(dist.b), ABS(dist.a - dist.c) #elif CORE_IS_YZ - ABS(da), ABS(db + dc), ABS(db - dc) + ABS(dist.a), ABS(dist.b + dist.c), ABS(dist.b - dist.c) #elif ENABLED(MARKFORGED_XY) - ABS(da + db), ABS(db), ABS(dc) + ABS(dist.a + dist.b), ABS(dist.b), ABS(dist.c) #elif ENABLED(MARKFORGED_YX) - ABS(da), ABS(db + da), ABS(dc) + ABS(dist.a), ABS(dist.b + dist.a), ABS(dist.c) #elif IS_SCARA - ABS(da), ABS(db), ABS(dc) + ABS(dist.a), ABS(dist.b), ABS(dist.c) #else // default non-h-bot planning - ABS(da), ABS(db), ABS(dc) + ABS(dist.a), ABS(dist.b), ABS(dist.c) #endif - , ABS(di), ABS(dj), ABS(dk), ABS(du), ABS(dv), ABS(dw) + , ABS(dist.i), ABS(dist.j), ABS(dist.k), ABS(dist.u), ABS(dist.v), ABS(dist.w) )); /** @@ -2090,104 +2079,82 @@ bool Planner::_populate_block( #if ANY(IS_CORE, MARKFORGED_XY, MARKFORGED_YX) struct { float x, y, z; } head; #endif - } steps_dist_mm; + } dist_mm; #if ANY(CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX) - steps_dist_mm.head.x = da * mm_per_step[A_AXIS]; - steps_dist_mm.head.y = db * mm_per_step[B_AXIS]; - TERN_(HAS_Z_AXIS, steps_dist_mm.z = dc * mm_per_step[Z_AXIS]); + dist_mm.head.x = dist.a * mm_per_step[A_AXIS]; + dist_mm.head.y = dist.b * mm_per_step[B_AXIS]; + TERN_(HAS_Z_AXIS, dist_mm.z = dist.c * mm_per_step[Z_AXIS]); #endif #if IS_CORE #if CORE_IS_XY - steps_dist_mm.a = (da + db) * mm_per_step[A_AXIS]; - steps_dist_mm.b = CORESIGN(da - db) * mm_per_step[B_AXIS]; + dist_mm.a = (dist.a + dist.b) * mm_per_step[A_AXIS]; + dist_mm.b = CORESIGN(dist.a - dist.b) * mm_per_step[B_AXIS]; #elif CORE_IS_XZ - steps_dist_mm.head.x = da * mm_per_step[A_AXIS]; - steps_dist_mm.y = db * mm_per_step[Y_AXIS]; - steps_dist_mm.head.z = dc * mm_per_step[C_AXIS]; - steps_dist_mm.a = (da + dc) * mm_per_step[A_AXIS]; - steps_dist_mm.c = CORESIGN(da - dc) * mm_per_step[C_AXIS]; + dist_mm.head.x = dist.a * mm_per_step[A_AXIS]; + dist_mm.y = dist.b * mm_per_step[Y_AXIS]; + dist_mm.head.z = dist.c * mm_per_step[C_AXIS]; + dist_mm.a = (dist.a + dist.c) * mm_per_step[A_AXIS]; + dist_mm.c = CORESIGN(dist.a - dist.c) * mm_per_step[C_AXIS]; #elif CORE_IS_YZ - steps_dist_mm.x = da * mm_per_step[X_AXIS]; - steps_dist_mm.head.y = db * mm_per_step[B_AXIS]; - steps_dist_mm.head.z = dc * mm_per_step[C_AXIS]; - steps_dist_mm.b = (db + dc) * mm_per_step[B_AXIS]; - steps_dist_mm.c = CORESIGN(db - dc) * mm_per_step[C_AXIS]; + dist_mm.x = dist.a * mm_per_step[X_AXIS]; + dist_mm.head.y = dist.b * mm_per_step[B_AXIS]; + dist_mm.head.z = dist.c * mm_per_step[C_AXIS]; + dist_mm.b = (dist.b + dist.c) * mm_per_step[B_AXIS]; + dist_mm.c = CORESIGN(dist.b - dist.c) * mm_per_step[C_AXIS]; #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]; + dist_mm.a = (dist.a - dist.b) * mm_per_step[A_AXIS]; + dist_mm.b = dist.b * mm_per_step[B_AXIS]; #elif ENABLED(MARKFORGED_YX) - steps_dist_mm.a = da * mm_per_step[A_AXIS]; - steps_dist_mm.b = (db - da) * mm_per_step[B_AXIS]; + dist_mm.a = dist.a * mm_per_step[A_AXIS]; + dist_mm.b = (dist.b - dist.a) * mm_per_step[B_AXIS]; #else XYZ_CODE( - steps_dist_mm.a = da * mm_per_step[A_AXIS], - steps_dist_mm.b = db * mm_per_step[B_AXIS], - steps_dist_mm.c = dc * mm_per_step[C_AXIS] + dist_mm.a = dist.a * mm_per_step[A_AXIS], + dist_mm.b = dist.b * mm_per_step[B_AXIS], + dist_mm.c = dist.c * mm_per_step[C_AXIS] ); #endif SECONDARY_AXIS_CODE( - steps_dist_mm.i = di * mm_per_step[I_AXIS], - steps_dist_mm.j = dj * mm_per_step[J_AXIS], - steps_dist_mm.k = dk * mm_per_step[K_AXIS], - steps_dist_mm.u = du * mm_per_step[U_AXIS], - steps_dist_mm.v = dv * mm_per_step[V_AXIS], - steps_dist_mm.w = dw * mm_per_step[W_AXIS] + dist_mm.i = dist.i * mm_per_step[I_AXIS], dist_mm.j = dist.j * mm_per_step[J_AXIS], dist_mm.k = dist.k * mm_per_step[K_AXIS], + dist_mm.u = dist.u * mm_per_step[U_AXIS], dist_mm.v = dist.v * mm_per_step[V_AXIS], dist_mm.w = dist.w * mm_per_step[W_AXIS] ); - TERN_(HAS_EXTRUDERS, steps_dist_mm.e = esteps_float * mm_per_step[E_AXIS_N(extruder)]); + TERN_(HAS_EXTRUDERS, dist_mm.e = esteps_float * mm_per_step[E_AXIS_N(extruder)]); - TERN_(LCD_SHOW_E_TOTAL, e_move_accumulator += steps_dist_mm.e); + TERN_(LCD_SHOW_E_TOTAL, e_move_accumulator += dist_mm.e); #if HAS_ROTATIONAL_AXES bool cartesian_move = hints.cartesian_move; #endif if (true NUM_AXIS_GANG( - && block->steps.a < MIN_STEPS_PER_SEGMENT, - && block->steps.b < MIN_STEPS_PER_SEGMENT, - && block->steps.c < MIN_STEPS_PER_SEGMENT, - && block->steps.i < MIN_STEPS_PER_SEGMENT, - && block->steps.j < MIN_STEPS_PER_SEGMENT, - && block->steps.k < MIN_STEPS_PER_SEGMENT, - && block->steps.u < MIN_STEPS_PER_SEGMENT, - && block->steps.v < MIN_STEPS_PER_SEGMENT, - && block->steps.w < MIN_STEPS_PER_SEGMENT + && block->steps.a < MIN_STEPS_PER_SEGMENT, && block->steps.b < MIN_STEPS_PER_SEGMENT, && block->steps.c < MIN_STEPS_PER_SEGMENT, + && block->steps.i < MIN_STEPS_PER_SEGMENT, && block->steps.j < MIN_STEPS_PER_SEGMENT, && block->steps.k < MIN_STEPS_PER_SEGMENT, + && block->steps.u < MIN_STEPS_PER_SEGMENT, && block->steps.v < MIN_STEPS_PER_SEGMENT, && block->steps.w < MIN_STEPS_PER_SEGMENT ) ) { - block->millimeters = TERN0(HAS_EXTRUDERS, ABS(steps_dist_mm.e)); + block->millimeters = TERN0(HAS_EXTRUDERS, ABS(dist_mm.e)); } else { if (hints.millimeters) block->millimeters = hints.millimeters; else { const xyze_pos_t displacement = LOGICAL_AXIS_ARRAY( - steps_dist_mm.e, + dist_mm.e, #if ANY(CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX) - steps_dist_mm.head.x, - steps_dist_mm.head.y, - steps_dist_mm.z, + dist_mm.head.x, dist_mm.head.y, dist_mm.z, #elif CORE_IS_XZ - steps_dist_mm.head.x, - steps_dist_mm.y, - steps_dist_mm.head.z, + dist_mm.head.x, dist_mm.y, dist_mm.head.z, #elif CORE_IS_YZ - steps_dist_mm.x, - steps_dist_mm.head.y, - steps_dist_mm.head.z, + dist_mm.x, dist_mm.head.y, dist_mm.head.z, #else - steps_dist_mm.x, - steps_dist_mm.y, - steps_dist_mm.z, + dist_mm.x, dist_mm.y, dist_mm.z, #endif - steps_dist_mm.i, - steps_dist_mm.j, - steps_dist_mm.k, - steps_dist_mm.u, - steps_dist_mm.v, - steps_dist_mm.w + dist_mm.i, dist_mm.j, dist_mm.k, + dist_mm.u, dist_mm.v, dist_mm.w ); block->millimeters = get_move_distance(displacement OPTARG(HAS_ROTATIONAL_AXES, cartesian_move)); @@ -2202,7 +2169,7 @@ bool Planner::_populate_block( * A correction function is permitted to add steps to an axis, it * should *never* remove steps! */ - TERN_(BACKLASH_COMPENSATION, backlash.add_correction_steps(da, db, dc, dm, block)); + TERN_(BACKLASH_COMPENSATION, backlash.add_correction_steps(dist.a, dist.b, dist.c, dm, block)); } TERN_(HAS_EXTRUDERS, block->steps.e = esteps); @@ -2279,12 +2246,9 @@ bool Planner::_populate_block( #endif #if ANY(CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX) SECONDARY_AXIS_CODE( - if (block->steps.i) stepper.enable_axis(I_AXIS), - if (block->steps.j) stepper.enable_axis(J_AXIS), - if (block->steps.k) stepper.enable_axis(K_AXIS), - if (block->steps.u) stepper.enable_axis(U_AXIS), - if (block->steps.v) stepper.enable_axis(V_AXIS), - if (block->steps.w) stepper.enable_axis(W_AXIS) + if (block->steps.i) stepper.enable_axis(I_AXIS), if (block->steps.j) stepper.enable_axis(J_AXIS), + if (block->steps.k) stepper.enable_axis(K_AXIS), if (block->steps.u) stepper.enable_axis(U_AXIS), + if (block->steps.v) stepper.enable_axis(V_AXIS), if (block->steps.w) stepper.enable_axis(W_AXIS) ); #endif @@ -2383,7 +2347,7 @@ bool Planner::_populate_block( #if ENABLED(FILAMENT_WIDTH_SENSOR) if (extruder == FILAMENT_SENSOR_EXTRUDER_NUM) // Only for extruder with filament sensor - filwidth.advance_e(steps_dist_mm.e); + filwidth.advance_e(dist_mm.e); #endif // Calculate and limit speed in mm/sec (linear) or degrees/sec (rotational) @@ -2393,7 +2357,7 @@ bool Planner::_populate_block( // Linear axes first with less logic LOOP_NUM_AXES(i) { - current_speed[i] = steps_dist_mm[i] * inverse_secs; + current_speed[i] = dist_mm[i] * inverse_secs; const feedRate_t cs = ABS(current_speed[i]), max_fr = settings.max_feedrate_mm_s[i]; if (cs > max_fr) NOMORE(speed_factor, max_fr / cs); @@ -2402,7 +2366,7 @@ bool Planner::_populate_block( // Limit speed on extruders, if any #if HAS_EXTRUDERS { - current_speed.e = steps_dist_mm.e * inverse_secs; + current_speed.e = dist_mm.e * inverse_secs; #if HAS_MIXER_SYNC_CHANNEL // Move all mixing extruders at the specified rate if (mixer.get_current_vtool() == MIXER_AUTORETRACT_TOOL) @@ -2519,9 +2483,9 @@ bool Planner::_populate_block( * * extruder_advance_K[extruder] : There is an advance factor set for this extruder. * - * de > 0 : Extruder is running forward (e.g., for "Wipe while retracting" (Slic3r) or "Combing" (Cura) moves) + * dist.e > 0 : Extruder is running forward (e.g., for "Wipe while retracting" (Slic3r) or "Combing" (Cura) moves) */ - use_advance_lead = esteps && extruder_advance_K[E_INDEX_N(extruder)] && de > 0; + use_advance_lead = esteps && extruder_advance_K[E_INDEX_N(extruder)] && dist.e > 0; if (use_advance_lead) { float e_D_ratio = (target_float.e - position_float.e) / @@ -2632,10 +2596,10 @@ bool Planner::_populate_block( #if HAS_DIST_MM_ARG cart_dist_mm #else - LOGICAL_AXIS_ARRAY(steps_dist_mm.e, - steps_dist_mm.x, steps_dist_mm.y, steps_dist_mm.z, - steps_dist_mm.i, steps_dist_mm.j, steps_dist_mm.k, - steps_dist_mm.u, steps_dist_mm.v, steps_dist_mm.w) + LOGICAL_AXIS_ARRAY(dist_mm.e, + dist_mm.x, dist_mm.y, dist_mm.z, + dist_mm.i, dist_mm.j, dist_mm.k, + dist_mm.u, dist_mm.v, dist_mm.w) #endif ; @@ -2804,7 +2768,7 @@ bool Planner::_populate_block( #ifndef TRAVEL_EXTRA_XYJERK #define TRAVEL_EXTRA_XYJERK 0 #endif - const float extra_xyjerk = TERN0(HAS_EXTRUDERS, de <= 0) ? TRAVEL_EXTRA_XYJERK : 0; + const float extra_xyjerk = TERN0(HAS_EXTRUDERS, dist.e <= 0) ? TRAVEL_EXTRA_XYJERK : 0; uint8_t limited = 0; TERN(HAS_LINEAR_E_JERK, LOOP_NUM_AXES, LOOP_LOGICAL_AXES)(i) { @@ -3239,16 +3203,11 @@ bool Planner::buffer_line(const xyze_pos_t &cart, const_feedRate_t fr_mm_s block->decelerate_after = block->step_event_count; // Will be set to last direction later if directional format. - block->direction_bits = 0; - - #define PAGE_UPDATE_DIR(AXIS) \ - if (!last_page_dir[_AXIS(AXIS)]) SBI(block->direction_bits, _AXIS(AXIS)); + block->direction_bits.reset(); if (!DirectStepping::Config::DIRECTIONAL) { - PAGE_UPDATE_DIR(X); - PAGE_UPDATE_DIR(Y); - PAGE_UPDATE_DIR(Z); - PAGE_UPDATE_DIR(E); + #define PAGE_UPDATE_DIR(AXIS) do{ if (last_page_dir.AXIS) block->direction_bits.AXIS = true; }while(0); + LOGICAL_AXIS_MAP(PAGE_UPDATE_DIR); } // If this is the first added movement, reload the delay, otherwise, cancel it. diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index eb0f072f4bf07..4b68c5f656344 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -417,7 +417,7 @@ class Planner { #if ENABLED(DIRECT_STEPPING) static uint32_t last_page_step_rate; // Last page step rate given - static xyze_bool_t last_page_dir; // Last page direction given + static AxisBits last_page_dir; // Last page direction given, where 1 represents forward or positive motion #endif #if HAS_EXTRUDERS diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index c811bf5e38c8d..b23667b820152 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -383,111 +383,114 @@ xyze_int8_t Stepper::count_direction{0}; } #if HAS_SYNCED_X_STEPPERS - #define X_APPLY_DIR(v,Q) do{ X_DIR_WRITE(v); X2_DIR_WRITE(INVERT_DIR(X2_VS_X, v)); }while(0) + #define X_APPLY_DIR(FWD,Q) do{ X_DIR_WRITE(FWD); X2_DIR_WRITE(INVERT_DIR(X2_VS_X, FWD)); }while(0) #if ENABLED(X_DUAL_ENDSTOPS) - #define X_APPLY_STEP(v,Q) DUAL_ENDSTOP_APPLY_STEP(X,v) + #define X_APPLY_STEP(FWD,Q) DUAL_ENDSTOP_APPLY_STEP(X,FWD) #else - #define X_APPLY_STEP(v,Q) do{ X_STEP_WRITE(v); X2_STEP_WRITE(v); }while(0) + #define X_APPLY_STEP(FWD,Q) do{ X_STEP_WRITE(FWD); X2_STEP_WRITE(FWD); }while(0) #endif #elif ENABLED(DUAL_X_CARRIAGE) - #define X_APPLY_DIR(v,ALWAYS) do{ \ - if (extruder_duplication_enabled || ALWAYS) { X_DIR_WRITE(v); X2_DIR_WRITE((v) ^ idex_mirrored_mode); } \ - else if (last_moved_extruder) X2_DIR_WRITE(v); else X_DIR_WRITE(v); \ + #define X_APPLY_DIR(FWD,ALWAYS) do{ \ + if (extruder_duplication_enabled || ALWAYS) { X_DIR_WRITE(FWD); X2_DIR_WRITE((FWD) ^ idex_mirrored_mode); } \ + else if (last_moved_extruder) X2_DIR_WRITE(FWD); else X_DIR_WRITE(FWD); \ }while(0) - #define X_APPLY_STEP(v,ALWAYS) do{ \ - if (extruder_duplication_enabled || ALWAYS) { X_STEP_WRITE(v); X2_STEP_WRITE(v); } \ - else if (last_moved_extruder) X2_STEP_WRITE(v); else X_STEP_WRITE(v); \ + #define X_APPLY_STEP(FWD,ALWAYS) do{ \ + if (extruder_duplication_enabled || ALWAYS) { X_STEP_WRITE(FWD); X2_STEP_WRITE(FWD); } \ + else if (last_moved_extruder) X2_STEP_WRITE(FWD); else X_STEP_WRITE(FWD); \ }while(0) #elif HAS_X_AXIS - #define X_APPLY_DIR(v,Q) X_DIR_WRITE(v) - #define X_APPLY_STEP(v,Q) X_STEP_WRITE(v) + #define X_APPLY_DIR(FWD,Q) X_DIR_WRITE(FWD) + #define X_APPLY_STEP(FWD,Q) X_STEP_WRITE(FWD) #endif #if HAS_SYNCED_Y_STEPPERS - #define Y_APPLY_DIR(v,Q) do{ Y_DIR_WRITE(v); Y2_DIR_WRITE(INVERT_DIR(Y2_VS_Y, v)); }while(0) + #define Y_APPLY_DIR(FWD,Q) do{ Y_DIR_WRITE(FWD); Y2_DIR_WRITE(INVERT_DIR(Y2_VS_Y, FWD)); }while(0) #if ENABLED(Y_DUAL_ENDSTOPS) - #define Y_APPLY_STEP(v,Q) DUAL_ENDSTOP_APPLY_STEP(Y,v) + #define Y_APPLY_STEP(FWD,Q) DUAL_ENDSTOP_APPLY_STEP(Y,FWD) #else - #define Y_APPLY_STEP(v,Q) do{ Y_STEP_WRITE(v); Y2_STEP_WRITE(v); }while(0) + #define Y_APPLY_STEP(FWD,Q) do{ Y_STEP_WRITE(FWD); Y2_STEP_WRITE(FWD); }while(0) #endif #elif HAS_Y_AXIS - #define Y_APPLY_DIR(v,Q) Y_DIR_WRITE(v) - #define Y_APPLY_STEP(v,Q) Y_STEP_WRITE(v) + #define Y_APPLY_DIR(FWD,Q) Y_DIR_WRITE(FWD) + #define Y_APPLY_STEP(FWD,Q) Y_STEP_WRITE(FWD) #endif #if NUM_Z_STEPPERS == 4 - #define Z_APPLY_DIR(v,Q) do{ \ - Z_DIR_WRITE(v); Z2_DIR_WRITE(INVERT_DIR(Z2_VS_Z, v)); \ - Z3_DIR_WRITE(INVERT_DIR(Z3_VS_Z, v)); Z4_DIR_WRITE(INVERT_DIR(Z4_VS_Z, v)); \ + #define Z_APPLY_DIR(FWD,Q) do{ \ + Z_DIR_WRITE(FWD); Z2_DIR_WRITE(INVERT_DIR(Z2_VS_Z, FWD)); \ + Z3_DIR_WRITE(INVERT_DIR(Z3_VS_Z, FWD)); Z4_DIR_WRITE(INVERT_DIR(Z4_VS_Z, FWD)); \ }while(0) #if ENABLED(Z_MULTI_ENDSTOPS) - #define Z_APPLY_STEP(v,Q) QUAD_ENDSTOP_APPLY_STEP(Z,v) + #define Z_APPLY_STEP(FWD,Q) QUAD_ENDSTOP_APPLY_STEP(Z,FWD) #elif ENABLED(Z_STEPPER_AUTO_ALIGN) - #define Z_APPLY_STEP(v,Q) QUAD_SEPARATE_APPLY_STEP(Z,v) + #define Z_APPLY_STEP(FWD,Q) QUAD_SEPARATE_APPLY_STEP(Z,FWD) #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) + #define Z_APPLY_STEP(FWD,Q) do{ Z_STEP_WRITE(FWD); Z2_STEP_WRITE(FWD); Z3_STEP_WRITE(FWD); Z4_STEP_WRITE(FWD); }while(0) #endif #elif NUM_Z_STEPPERS == 3 - #define Z_APPLY_DIR(v,Q) do{ \ - Z_DIR_WRITE(v); Z2_DIR_WRITE(INVERT_DIR(Z2_VS_Z, v)); Z3_DIR_WRITE(INVERT_DIR(Z3_VS_Z, v)); \ + #define Z_APPLY_DIR(FWD,Q) do{ \ + Z_DIR_WRITE(FWD); Z2_DIR_WRITE(INVERT_DIR(Z2_VS_Z, FWD)); Z3_DIR_WRITE(INVERT_DIR(Z3_VS_Z, FWD)); \ }while(0) #if ENABLED(Z_MULTI_ENDSTOPS) - #define Z_APPLY_STEP(v,Q) TRIPLE_ENDSTOP_APPLY_STEP(Z,v) + #define Z_APPLY_STEP(FWD,Q) TRIPLE_ENDSTOP_APPLY_STEP(Z,FWD) #elif ENABLED(Z_STEPPER_AUTO_ALIGN) - #define Z_APPLY_STEP(v,Q) TRIPLE_SEPARATE_APPLY_STEP(Z,v) + #define Z_APPLY_STEP(FWD,Q) TRIPLE_SEPARATE_APPLY_STEP(Z,FWD) #else - #define Z_APPLY_STEP(v,Q) do{ Z_STEP_WRITE(v); Z2_STEP_WRITE(v); Z3_STEP_WRITE(v); }while(0) + #define Z_APPLY_STEP(FWD,Q) do{ Z_STEP_WRITE(FWD); Z2_STEP_WRITE(FWD); Z3_STEP_WRITE(FWD); }while(0) #endif #elif NUM_Z_STEPPERS == 2 - #define Z_APPLY_DIR(v,Q) do{ Z_DIR_WRITE(v); Z2_DIR_WRITE(INVERT_DIR(Z2_VS_Z, v)); }while(0) + #define Z_APPLY_DIR(FWD,Q) do{ Z_DIR_WRITE(FWD); Z2_DIR_WRITE(INVERT_DIR(Z2_VS_Z, FWD)); }while(0) #if ENABLED(Z_MULTI_ENDSTOPS) - #define Z_APPLY_STEP(v,Q) DUAL_ENDSTOP_APPLY_STEP(Z,v) + #define Z_APPLY_STEP(FWD,Q) DUAL_ENDSTOP_APPLY_STEP(Z,FWD) #elif ENABLED(Z_STEPPER_AUTO_ALIGN) - #define Z_APPLY_STEP(v,Q) DUAL_SEPARATE_APPLY_STEP(Z,v) + #define Z_APPLY_STEP(FWD,Q) DUAL_SEPARATE_APPLY_STEP(Z,FWD) #else - #define Z_APPLY_STEP(v,Q) do{ Z_STEP_WRITE(v); Z2_STEP_WRITE(v); }while(0) + #define Z_APPLY_STEP(FWD,Q) do{ Z_STEP_WRITE(FWD); Z2_STEP_WRITE(FWD); }while(0) #endif #elif HAS_Z_AXIS - #define Z_APPLY_DIR(v,Q) Z_DIR_WRITE(v) - #define Z_APPLY_STEP(v,Q) Z_STEP_WRITE(v) + #define Z_APPLY_DIR(FWD,Q) Z_DIR_WRITE(FWD) + #define Z_APPLY_STEP(FWD,Q) Z_STEP_WRITE(FWD) #endif #if HAS_I_AXIS - #define I_APPLY_DIR(v,Q) I_DIR_WRITE(v) - #define I_APPLY_STEP(v,Q) I_STEP_WRITE(v) + #define I_APPLY_DIR(FWD,Q) I_DIR_WRITE(FWD) + #define I_APPLY_STEP(FWD,Q) I_STEP_WRITE(FWD) #endif #if HAS_J_AXIS - #define J_APPLY_DIR(v,Q) J_DIR_WRITE(v) - #define J_APPLY_STEP(v,Q) J_STEP_WRITE(v) + #define J_APPLY_DIR(FWD,Q) J_DIR_WRITE(FWD) + #define J_APPLY_STEP(FWD,Q) J_STEP_WRITE(FWD) #endif #if HAS_K_AXIS - #define K_APPLY_DIR(v,Q) K_DIR_WRITE(v) - #define K_APPLY_STEP(v,Q) K_STEP_WRITE(v) + #define K_APPLY_DIR(FWD,Q) K_DIR_WRITE(FWD) + #define K_APPLY_STEP(FWD,Q) K_STEP_WRITE(FWD) #endif #if HAS_U_AXIS - #define U_APPLY_DIR(v,Q) U_DIR_WRITE(v) - #define U_APPLY_STEP(v,Q) U_STEP_WRITE(v) + #define U_APPLY_DIR(FWD,Q) U_DIR_WRITE(FWD) + #define U_APPLY_STEP(FWD,Q) U_STEP_WRITE(FWD) #endif #if HAS_V_AXIS - #define V_APPLY_DIR(v,Q) V_DIR_WRITE(v) - #define V_APPLY_STEP(v,Q) V_STEP_WRITE(v) + #define V_APPLY_DIR(FWD,Q) V_DIR_WRITE(FWD) + #define V_APPLY_STEP(FWD,Q) V_STEP_WRITE(FWD) #endif #if HAS_W_AXIS - #define W_APPLY_DIR(v,Q) W_DIR_WRITE(v) - #define W_APPLY_STEP(v,Q) W_STEP_WRITE(v) + #define W_APPLY_DIR(FWD,Q) W_DIR_WRITE(FWD) + #define W_APPLY_STEP(FWD,Q) W_STEP_WRITE(FWD) #endif -#define E0_APPLY_DIR(REV) do{ (REV) ? FWD_E_DIR(0) : REV_E_DIR(0); }while(0) -#define E1_APPLY_DIR(REV) do{ (REV) ? FWD_E_DIR(1) : REV_E_DIR(1); }while(0) -#define E2_APPLY_DIR(REV) do{ (REV) ? FWD_E_DIR(2) : REV_E_DIR(2); }while(0) -#define E3_APPLY_DIR(REV) do{ (REV) ? FWD_E_DIR(3) : REV_E_DIR(3); }while(0) -#define E4_APPLY_DIR(REV) do{ (REV) ? FWD_E_DIR(4) : REV_E_DIR(4); }while(0) -#define E5_APPLY_DIR(REV) do{ (REV) ? FWD_E_DIR(5) : REV_E_DIR(5); }while(0) -#define E6_APPLY_DIR(REV) do{ (REV) ? FWD_E_DIR(6) : REV_E_DIR(6); }while(0) -#define E7_APPLY_DIR(REV) do{ (REV) ? FWD_E_DIR(7) : REV_E_DIR(7); }while(0) - -#if DISABLED(MIXING_EXTRUDER) - #define E_APPLY_STEP(v,Q) E_STEP_WRITE(stepper_extruder, v) +//#define E0_APPLY_DIR(FWD) do{ (FWD) ? FWD_E_DIR(0) : REV_E_DIR(0); }while(0) +//#define E1_APPLY_DIR(FWD) do{ (FWD) ? FWD_E_DIR(1) : REV_E_DIR(1); }while(0) +//#define E2_APPLY_DIR(FWD) do{ (FWD) ? FWD_E_DIR(2) : REV_E_DIR(2); }while(0) +//#define E3_APPLY_DIR(FWD) do{ (FWD) ? FWD_E_DIR(3) : REV_E_DIR(3); }while(0) +//#define E4_APPLY_DIR(FWD) do{ (FWD) ? FWD_E_DIR(4) : REV_E_DIR(4); }while(0) +//#define E5_APPLY_DIR(FWD) do{ (FWD) ? FWD_E_DIR(5) : REV_E_DIR(5); }while(0) +//#define E6_APPLY_DIR(FWD) do{ (FWD) ? FWD_E_DIR(6) : REV_E_DIR(6); }while(0) +//#define E7_APPLY_DIR(FWD) do{ (FWD) ? FWD_E_DIR(7) : REV_E_DIR(7); }while(0) + +#if ENABLED(MIXING_EXTRUDER) + #define E_APPLY_DIR(FWD,Q) do{ if (FWD) { MIXER_STEPPER_LOOP(j) FWD_E_DIR(j); } else { MIXER_STEPPER_LOOP(j) REV_E_DIR(j); } }while(0) +#else + #define E_APPLY_STEP(FWD,Q) E_STEP_WRITE(stepper_extruder, FWD) + #define E_APPLY_DIR(FWD,Q) do{ if (FWD) { FWD_E_DIR(stepper_extruder); } else { REV_E_DIR(stepper_extruder); } }while(0) #endif #define CYCLES_TO_NS(CYC) (1000UL * (CYC) / ((F_CPU) / 1000000)) @@ -602,16 +605,12 @@ void Stepper::disable_all_steppers() { } // Set a single axis direction based on the last set flags. -// A direction bit of "1" indicates reverse or negative motion. -#define SET_STEP_DIR(A) \ - if (motor_direction(_AXIS(A))) { \ - A##_APPLY_DIR(LOW, false); \ - count_direction[_AXIS(A)] = -1; \ - } \ - else { \ - A##_APPLY_DIR(HIGH, false); \ - count_direction[_AXIS(A)] = 1; \ - } +// A direction bit of "1" indicates forward or positive motion. +#define SET_STEP_DIR(A) do{ \ + const bool fwd = motor_direction(_AXIS(A)); \ + A##_APPLY_DIR(fwd, false); \ + count_direction[_AXIS(A)] = fwd ? 1 : -1; \ + }while(0) /** * Set the stepper direction of each axis @@ -621,36 +620,15 @@ void Stepper::disable_all_steppers() { * COREYZ: Y_AXIS=B_AXIS and Z_AXIS=C_AXIS */ void Stepper::apply_directions() { - DIR_WAIT_BEFORE(); - NUM_AXIS_CODE( + LOGICAL_AXIS_CODE( + SET_STEP_DIR(E), SET_STEP_DIR(X), SET_STEP_DIR(Y), SET_STEP_DIR(Z), // ABC SET_STEP_DIR(I), SET_STEP_DIR(J), SET_STEP_DIR(K), SET_STEP_DIR(U), SET_STEP_DIR(V), SET_STEP_DIR(W) ); - #if HAS_EXTRUDERS - // Because this is valid for the whole block we don't know - // what E steppers will step. Likely all. Set all. - if (motor_direction(E_AXIS)) { - #if ENABLED(MIXING_EXTRUDER) - MIXER_STEPPER_LOOP(j) REV_E_DIR(j); - #else - REV_E_DIR(stepper_extruder); - #endif - count_direction.e = -1; - } - else { - #if ENABLED(MIXING_EXTRUDER) - MIXER_STEPPER_LOOP(j) FWD_E_DIR(j); - #else - FWD_E_DIR(stepper_extruder); - #endif - count_direction.e = 1; - } - #endif // HAS_EXTRUDERS - DIR_WAIT_AFTER(); } @@ -1858,8 +1836,8 @@ void Stepper::pulse_phase_isr() { #if STEPPER_PAGE_FORMAT == SP_4x4D_128 #define PAGE_SEGMENT_UPDATE(AXIS, VALUE) do{ \ - if ((VALUE) < 7) dm[_AXIS(AXIS)] = true; \ - else if ((VALUE) > 7) dm[_AXIS(AXIS)] = false; \ + if ((VALUE) < 7) dm[_AXIS(AXIS)] = false; \ + else if ((VALUE) > 7) dm[_AXIS(AXIS)] = true; \ page_step_state.sd[_AXIS(AXIS)] = VALUE; \ page_step_state.bd[_AXIS(AXIS)] += VALUE; \ }while(0) @@ -1884,8 +1862,7 @@ void Stepper::pulse_phase_isr() { PAGE_SEGMENT_UPDATE(Z, high >> 4); PAGE_SEGMENT_UPDATE(E, high & 0xF); - if (dm != last_direction_bits) - set_directions(dm); + if (dm != last_direction_bits) set_directions(dm); } break; @@ -2409,29 +2386,16 @@ hal_timer_t Stepper::block_phase_isr() { if (la_active) { const uint32_t la_step_rate = la_advance_steps > current_block->final_adv_steps ? current_block->la_advance_rate : 0; if (la_step_rate != step_rate) { - const bool reverse_e = la_step_rate > step_rate; - la_interval = calc_timer_interval((reverse_e ? la_step_rate - step_rate : step_rate - la_step_rate) >> current_block->la_scaling); + const bool forward_e = la_step_rate < step_rate; + la_interval = calc_timer_interval((forward_e ? step_rate - la_step_rate : la_step_rate - step_rate) >> current_block->la_scaling); - if (reverse_e != motor_direction(E_AXIS)) { + if (forward_e != motor_direction(E_AXIS)) { last_direction_bits.toggle(E_AXIS); count_direction.e = -count_direction.e; DIR_WAIT_BEFORE(); - if (reverse_e) { - #if ENABLED(MIXING_EXTRUDER) - MIXER_STEPPER_LOOP(j) REV_E_DIR(j); - #else - REV_E_DIR(stepper_extruder); - #endif - } - else { - #if ENABLED(MIXING_EXTRUDER) - MIXER_STEPPER_LOOP(j) FWD_E_DIR(j); - #else - FWD_E_DIR(stepper_extruder); - #endif - } + E_APPLY_DIR(forward_e, false); DIR_WAIT_AFTER(); } @@ -2688,13 +2652,13 @@ hal_timer_t Stepper::block_phase_isr() { #if ENABLED(INPUT_SHAPING_X) if (shaping_x.enabled) { - const int64_t steps = current_block->direction_bits.x ? -int64_t(current_block->steps.x) : int64_t(current_block->steps.x); + const int64_t steps = current_block->direction_bits.x ? int64_t(current_block->steps.x) : -int64_t(current_block->steps.x); shaping_x.last_block_end_pos += steps; // If there are any remaining echos unprocessed, then direction change must // be delayed and processed in PULSE_PREP_SHAPING. This will cause half a step // to be missed, which will need recovering and this can be done through shaping_x.remainder. - shaping_x.forward = !current_block->direction_bits.x; + shaping_x.forward = current_block->direction_bits.x; if (!ShapingQueue::empty_x()) current_block->direction_bits.x = last_direction_bits.x; } #endif @@ -2702,9 +2666,9 @@ hal_timer_t Stepper::block_phase_isr() { // Y follows the same logic as X (but the comments aren't repeated) #if ENABLED(INPUT_SHAPING_Y) if (shaping_y.enabled) { - const int64_t steps = current_block->direction_bits.y ? -int64_t(current_block->steps.y) : int64_t(current_block->steps.y); + const int64_t steps = current_block->direction_bits.y ? int64_t(current_block->steps.y) : -int64_t(current_block->steps.y); shaping_y.last_block_end_pos += steps; - shaping_y.forward = !current_block->direction_bits.y; + shaping_y.forward = current_block->direction_bits.y; if (!ShapingQueue::empty_y()) current_block->direction_bits.y = last_direction_bits.y; } #endif @@ -3450,36 +3414,36 @@ void Stepper::report_positions() { #if HAS_Z_AXIS // Z is handled differently to update the stepper // counts (needed by Marlin for bed level probing). - const bool z_dir = TEST(command, FT_BIT_DIR_Z), + const bool z_fwd = TEST(command, FT_BIT_DIR_Z), z_step = TEST(command, FT_BIT_STEP_Z); #endif if (applyDir) { - TERN_(HAS_X_AXIS, X_DIR_WRITE(TEST(command, FT_BIT_DIR_X))); - TERN_(HAS_Y_AXIS, Y_DIR_WRITE(TEST(command, FT_BIT_DIR_Y))); - TERN_(HAS_Z_AXIS, Z_DIR_WRITE(z_dir)); - TERN_(HAS_EXTRUDERS, E0_DIR_WRITE(TEST(command, FT_BIT_DIR_E))); + TERN_(HAS_X_AXIS, X_APPLY_DIR(TEST(command, FT_BIT_DIR_X), false)); + TERN_(HAS_Y_AXIS, Y_APPLY_DIR(TEST(command, FT_BIT_DIR_Y), false)); + TERN_(HAS_Z_AXIS, Z_APPLY_DIR(z_fwd, false)); + TERN_(HAS_EXTRUDERS, E_APPLY_DIR(TEST(command, FT_BIT_DIR_E), false)); DIR_WAIT_AFTER(); } - TERN_(HAS_X_AXIS, X_STEP_WRITE(TEST(command, FT_BIT_STEP_X))); - TERN_(HAS_Y_AXIS, Y_STEP_WRITE(TEST(command, FT_BIT_STEP_Y))); - TERN_(HAS_Z_AXIS, Z_STEP_WRITE(z_step)); - TERN_(HAS_EXTRUDERS, E0_STEP_WRITE(TEST(command, FT_BIT_STEP_E))); + TERN_(HAS_X_AXIS, X_APPLY_STEP(TEST(command, FT_BIT_STEP_X), false)); + TERN_(HAS_Y_AXIS, Y_APPLY_STEP(TEST(command, FT_BIT_STEP_Y), false)); + TERN_(HAS_Z_AXIS, Z_APPLY_STEP(z_step, false)); + TERN_(HAS_EXTRUDERS, E_APPLY_STEP(TEST(command, FT_BIT_STEP_E), false)); START_TIMED_PULSE(); #if HAS_Z_AXIS // Update step counts - if (z_step) count_position.z += z_dir ? 1 : -1; + if (z_step) count_position.z += z_fwd ? 1 : -1; #endif AWAIT_HIGH_PULSE(); - X_STEP_WRITE(0); - TERN_(HAS_Y_AXIS, Y_STEP_WRITE(0)); - TERN_(HAS_Z_AXIS, Z_STEP_WRITE(0)); - TERN_(HAS_EXTRUDERS, E0_STEP_WRITE(0)); + TERN_(HAS_X_AXIS, X_APPLY_STEP(0, false)); + TERN_(HAS_Y_AXIS, Y_APPLY_STEP(0, false)); + TERN_(HAS_Z_AXIS, Z_APPLY_STEP(0, false)); + TERN_(HAS_EXTRUDERS, E_APPLY_STEP(0, false)); } // Stepper::fxdTiCtrl_stepper @@ -3565,7 +3529,7 @@ void Stepper::report_positions() { #define _ENABLE_AXIS(A) enable_axis(_AXIS(A)) #define _READ_DIR(AXIS) AXIS ##_DIR_READ() - #define _APPLY_DIR(AXIS, INVERT) AXIS ##_APPLY_DIR(INVERT, true) + #define _APPLY_DIR(AXIS, FWD) AXIS ##_APPLY_DIR(FWD, true) #if MINIMUM_STEPPER_PULSE #define STEP_PULSE_CYCLES ((MINIMUM_STEPPER_PULSE) * CYCLES_PER_MICROSECOND) diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h index 134bee7ac657b..a2c9861abc6bc 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -524,7 +524,7 @@ class Stepper { // Quickly stop all steppers FORCE_INLINE static void quick_stop() { abort_current_block = true; } - // The direction of a single motor. A true result indicates reversed or negative motion. + // The direction of a single motor. A true result indicates forward or positive motion. FORCE_INLINE static bool motor_direction(const AxisEnum axis) { return last_direction_bits[axis]; } // The last movement direction was not null on the specified axis. Note that motor direction is not necessarily the same. From fadd60441e020e9dcdd53cb592a089e1a06d3189 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 16 May 2023 01:28:04 -0500 Subject: [PATCH 033/100] =?UTF-8?q?=F0=9F=A9=B9=20Improve=20edit=20menu=20?= =?UTF-8?q?rounding?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/menu/menu_item.h | 73 +++++++++++++++++---------------- Marlin/src/libs/numtostr.h | 2 +- 2 files changed, 38 insertions(+), 37 deletions(-) diff --git a/Marlin/src/lcd/menu/menu_item.h b/Marlin/src/lcd/menu/menu_item.h index 2005be8b5411c..ecc1ac4047a79 100644 --- a/Marlin/src/lcd/menu/menu_item.h +++ b/Marlin/src/lcd/menu/menu_item.h @@ -79,10 +79,10 @@ template class TMenuEditItem : MenuEditItemBase { private: typedef typename NAME::type_t type_t; - static float scale(const_float_t value) { return NAME::scale(value); } - static float unscale(const_float_t value) { return NAME::unscale(value); } - 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); } + static int32_t scaleToEncoder(const type_t &value) { return NAME::scaleToEncoder(value); } + static type_t unscaleEncoder(const int32_t value) { return NAME::unscaleEncoder(value); } + static const char* to_string(const int32_t value) { return NAME::strfunc(unscaleEncoder(value)); } + static void load(void *ptr, const int32_t value) { *((type_t*)ptr) = unscaleEncoder(value); } public: 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))); @@ -101,9 +101,9 @@ class TMenuEditItem : MenuEditItemBase { const bool live=false // Callback during editing ) { // 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(fstr, ptr, minv, maxv - minv, scale(*ptr) - minv, + const int32_t minv = _MAX(scaleToEncoder(minValue), INT32_MIN), + maxv = _MIN(scaleToEncoder(maxValue), INT32_MAX); + goto_edit_screen(fstr, ptr, minv, maxv - minv, scaleToEncoder(*ptr) - minv, edit_screen, callback, live); } }; @@ -119,9 +119,9 @@ class TMenuEditItem : MenuEditItemBase { * * struct MenuEditItemInfo_percent { * typedef uint8_t type_t; - * static float scale(const_float_t value) { return value * (100.f/255.f) +0.5f; } - * static float unscale(const_float_t value) { return value / (100.f/255.f) +0.5f; } - * static const char* strfunc(const_float_t value) { return ui8tostr4pctrj(_DOFIX(uint8_t,value)); } + * static int32_t scaleToEncoder(const type_t &value) { return value * (100.f/255.f) +0.5f; } + * static type_t unscaleEncoder(const int32_t value) { return type_t(value) / (100.f/255.f) +0.5f; } + * static const char* strfunc(const type_t &value) { return ui8tostr4pctrj(_DOFIX(uint8_t,value)); } * }; * typedef TMenuEditItem MenuItem_percent */ @@ -130,36 +130,37 @@ class TMenuEditItem : MenuEditItemBase { #define DEFINE_MENU_EDIT_ITEM_TYPE(NAME, TYPE, STRFUNC, SCALE, ETC...) \ struct MenuEditItemInfo_##NAME { \ typedef TYPE type_t; \ - static float scale(const_float_t value) { return value * (SCALE) ETC; } \ - static float unscale(const_float_t value) { return value / (SCALE) ETC; } \ - static const char* strfunc(const_float_t value) { return STRFUNC(_DOFIX(TYPE,value)); } \ + /* scale the given value to the encoder */ \ + static int32_t scaleToEncoder(const type_t &value) { return value * (SCALE) ETC; } \ + static type_t unscaleEncoder(const int32_t value) { return type_t(value) / (SCALE) ETC; } \ + static const char* strfunc(const type_t &value) { return STRFUNC(_DOFIX(TYPE,value)); } \ }; \ typedef TMenuEditItem MenuItem_##NAME // NAME TYPE STRFUNC SCALE ROUND -DEFINE_MENU_EDIT_ITEM_TYPE(percent ,uint8_t ,ui8tostr4pctrj , 100.f/255.f, +0.5f); // 100% right-justified -DEFINE_MENU_EDIT_ITEM_TYPE(percent_3 ,uint8_t ,pcttostrpctrj , 1 ); // 100% right-justified -DEFINE_MENU_EDIT_ITEM_TYPE(int3 ,int16_t ,i16tostr3rj , 1 ); // 123, -12 right-justified -DEFINE_MENU_EDIT_ITEM_TYPE(int4 ,int16_t ,i16tostr4signrj , 1 ); // 1234, -123 right-justified -DEFINE_MENU_EDIT_ITEM_TYPE(int8 ,int8_t ,i8tostr3rj , 1 ); // 123, -12 right-justified -DEFINE_MENU_EDIT_ITEM_TYPE(uint8 ,uint8_t ,ui8tostr3rj , 1 ); // 123 right-justified -DEFINE_MENU_EDIT_ITEM_TYPE(uint16_3 ,uint16_t ,ui16tostr3rj , 1 ); // 123 right-justified -DEFINE_MENU_EDIT_ITEM_TYPE(uint16_4 ,uint16_t ,ui16tostr4rj , 0.1f ); // 1234 right-justified -DEFINE_MENU_EDIT_ITEM_TYPE(uint16_5 ,uint16_t ,ui16tostr5rj , 0.01f ); // 12345 right-justified -DEFINE_MENU_EDIT_ITEM_TYPE(float3 ,float ,ftostr3 , 1 ); // 123 right-justified -DEFINE_MENU_EDIT_ITEM_TYPE(float42_52 ,float ,ftostr42_52 , 100 ); // _2.34, 12.34, -2.34 or 123.45, -23.45 -DEFINE_MENU_EDIT_ITEM_TYPE(float43 ,float ,ftostr43sign ,1000 ); // -1.234, _1.234, +1.234 -DEFINE_MENU_EDIT_ITEM_TYPE(float4 ,float ,ftostr4sign , 1 ); // 1234 right-justified -DEFINE_MENU_EDIT_ITEM_TYPE(float5 ,float ,ftostr5rj , 1 ); // 12345 right-justified -DEFINE_MENU_EDIT_ITEM_TYPE(float5_25 ,float ,ftostr5rj , 0.04f ); // 12345 right-justified (25 increment) -DEFINE_MENU_EDIT_ITEM_TYPE(float61 ,float ,ftostr61rj , 10 ); // 12345.6 right-justified -DEFINE_MENU_EDIT_ITEM_TYPE(float72 ,float ,ftostr72rj , 100 ); // 12345.67 right-justified -DEFINE_MENU_EDIT_ITEM_TYPE(float31sign ,float ,ftostr31sign , 10 ); // +12.3 -DEFINE_MENU_EDIT_ITEM_TYPE(float41sign ,float ,ftostr41sign , 10 ); // +123.4 -DEFINE_MENU_EDIT_ITEM_TYPE(float51sign ,float ,ftostr51sign , 10 ); // +1234.5 -DEFINE_MENU_EDIT_ITEM_TYPE(float52sign ,float ,ftostr52sign , 100 ); // +123.45 -DEFINE_MENU_EDIT_ITEM_TYPE(long5 ,uint32_t ,ftostr5rj , 0.01f ); // 12345 right-justified -DEFINE_MENU_EDIT_ITEM_TYPE(long5_25 ,uint32_t ,ftostr5rj , 0.04f ); // 12345 right-justified (25 increment) +DEFINE_MENU_EDIT_ITEM_TYPE(percent ,uint8_t ,ui8tostr4pctrj , 100.f/255.f, + 0.5f ); // 100% right-justified +DEFINE_MENU_EDIT_ITEM_TYPE(percent_3 ,uint8_t ,pcttostrpctrj , 1 ); // 100% right-justified +DEFINE_MENU_EDIT_ITEM_TYPE(int3 ,int16_t ,i16tostr3rj , 1 ); // 123, -12 right-justified +DEFINE_MENU_EDIT_ITEM_TYPE(int4 ,int16_t ,i16tostr4signrj , 1 ); // 1234, -123 right-justified +DEFINE_MENU_EDIT_ITEM_TYPE(int8 ,int8_t ,i8tostr3rj , 1 ); // 123, -12 right-justified +DEFINE_MENU_EDIT_ITEM_TYPE(uint8 ,uint8_t ,ui8tostr3rj , 1 ); // 123 right-justified +DEFINE_MENU_EDIT_ITEM_TYPE(uint16_3 ,uint16_t ,ui16tostr3rj , 1 ); // 123 right-justified +DEFINE_MENU_EDIT_ITEM_TYPE(uint16_4 ,uint16_t ,ui16tostr4rj , 0.1f ); // 1234 right-justified +DEFINE_MENU_EDIT_ITEM_TYPE(uint16_5 ,uint16_t ,ui16tostr5rj , 0.01f ); // 12345 right-justified +DEFINE_MENU_EDIT_ITEM_TYPE(float3 ,float ,ftostr3rj , 1 ); // 123 right-justified +DEFINE_MENU_EDIT_ITEM_TYPE(float42_52 ,float ,ftostr42_52 , 100 , + 0.001f ); // _2.34, 12.34, -2.34 or 123.45, -23.45 +DEFINE_MENU_EDIT_ITEM_TYPE(float43 ,float ,ftostr43sign ,1000 , + 0.0001f); // -1.234, _1.234, +1.234 +DEFINE_MENU_EDIT_ITEM_TYPE(float4 ,float ,ftostr4sign , 1 ); // 1234 right-justified +DEFINE_MENU_EDIT_ITEM_TYPE(float5 ,float ,ftostr5rj , 1 ); // 12345 right-justified +DEFINE_MENU_EDIT_ITEM_TYPE(float5_25 ,float ,ftostr5rj , 0.04f ); // 12345 right-justified (25 increment) +DEFINE_MENU_EDIT_ITEM_TYPE(float61 ,float ,ftostr61rj , 10 , + 0.01f ); // 12345.6 right-justified +DEFINE_MENU_EDIT_ITEM_TYPE(float72 ,float ,ftostr72rj , 100 , + 0.001f ); // 12345.67 right-justified +DEFINE_MENU_EDIT_ITEM_TYPE(float31sign ,float ,ftostr31sign , 10 , + 0.01f ); // +12.3 +DEFINE_MENU_EDIT_ITEM_TYPE(float41sign ,float ,ftostr41sign , 10 , + 0.01f ); // +123.4 +DEFINE_MENU_EDIT_ITEM_TYPE(float51sign ,float ,ftostr51sign , 10 , + 0.01f ); // +1234.5 +DEFINE_MENU_EDIT_ITEM_TYPE(float52sign ,float ,ftostr52sign , 100 , + 0.001f ); // +123.45 +DEFINE_MENU_EDIT_ITEM_TYPE(long5 ,uint32_t ,ftostr5rj , 0.01f ); // 12345 right-justified +DEFINE_MENU_EDIT_ITEM_TYPE(long5_25 ,uint32_t ,ftostr5rj , 0.04f ); // 12345 right-justified (25 increment) #if HAS_BED_PROBE #if Z_PROBE_OFFSET_RANGE_MIN >= -9 && Z_PROBE_OFFSET_RANGE_MAX <= 9 diff --git a/Marlin/src/libs/numtostr.h b/Marlin/src/libs/numtostr.h index 31e8db0048845..f8af09ebeeca6 100644 --- a/Marlin/src/libs/numtostr.h +++ b/Marlin/src/libs/numtostr.h @@ -120,7 +120,7 @@ const char* ftostr61rj(const_float_t x); const char* ftostr72rj(const_float_t x); // Convert float to rj string with 123 or -12 format -FORCE_INLINE const char* ftostr3(const_float_t x) { return i16tostr3rj(int16_t(x + (x < 0 ? -0.5f : 0.5f))); } +FORCE_INLINE const char* ftostr3rj(const_float_t x) { return i16tostr3rj(int16_t(x + (x < 0 ? -0.5f : 0.5f))); } #if ENABLED(LCD_DECIMAL_SMALL_XY) // Convert float to rj string with 1234, _123, 12.3, _1.2, -123, _-12, or -1.2 format From ed66f498eb713f59f14d000f8bfa550b34ce8528 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 16 May 2023 02:38:24 -0500 Subject: [PATCH 034/100] =?UTF-8?q?=F0=9F=9A=B8=20Fixed-Time=20Motion=20EE?= =?UTF-8?q?PROM=20and=20Menu=20(#25835)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 2 + Marlin/src/core/language.h | 1 + Marlin/src/gcode/feature/ft_motion/M493.cpp | 290 +++++++++++------- Marlin/src/gcode/gcode.h | 1 + .../ftdi_eve_touch_ui/language/language_en.h | 1 - Marlin/src/lcd/language/language_en.h | 17 + Marlin/src/lcd/menu/menu_motion.cpp | 136 ++++++++ Marlin/src/module/ft_motion.cpp | 66 ++-- Marlin/src/module/ft_motion.h | 68 +++- Marlin/src/module/ft_types.h | 4 +- Marlin/src/module/planner.cpp | 8 +- Marlin/src/module/settings.cpp | 47 ++- Marlin/src/module/stepper.cpp | 2 +- buildroot/tests/STM32F103RC_btt | 2 +- 14 files changed, 473 insertions(+), 172 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 587a368301dcc..b68557cb289f8 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1148,6 +1148,8 @@ // This value may be configured to adjust duration to consume the command buffer. // Try increasing this value if stepper motion is not smooth. #define FTM_STEPPERCMD_BUFF_SIZE 1000 // Size of the stepper command buffers. + + //#define FT_MOTION_MENU // Provide a MarlinUI menu to set M493 parameters. #endif /** diff --git a/Marlin/src/core/language.h b/Marlin/src/core/language.h index c951012b6df2e..388e7cd820e11 100644 --- a/Marlin/src/core/language.h +++ b/Marlin/src/core/language.h @@ -277,6 +277,7 @@ // Settings Report Strings #define STR_Z_AUTO_ALIGN "Z Auto-Align" #define STR_BACKLASH_COMPENSATION "Backlash compensation" +#define STR_FT_MOTION "Fixed-Time Motion" #define STR_S_SEG_PER_SEC "S" #define STR_DELTA_SETTINGS "Delta (L R H S XYZ ABC)" #define STR_SCARA_SETTINGS "SCARA" diff --git a/Marlin/src/gcode/feature/ft_motion/M493.cpp b/Marlin/src/gcode/feature/ft_motion/M493.cpp index f7b8f1e752cf6..83c6a9a5dacbd 100644 --- a/Marlin/src/gcode/feature/ft_motion/M493.cpp +++ b/Marlin/src/gcode/feature/ft_motion/M493.cpp @@ -28,26 +28,109 @@ #include "../../../module/ft_motion.h" void say_shaping() { - SERIAL_ECHO_TERNARY(fxdTiCtrl.cfg_mode, "Fixed time controller ", "en", "dis", "abled"); - if (fxdTiCtrl.cfg_mode == ftMotionMode_DISABLED || fxdTiCtrl.cfg_mode == ftMotionMode_ENABLED) { - SERIAL_ECHOLNPGM("."); - return; - } + // FT Enabled + SERIAL_ECHO_TERNARY(fxdTiCtrl.cfg.mode, "Fixed-Time Motion ", "en", "dis", "abled"); + + // FT Shaping #if HAS_X_AXIS - SERIAL_ECHOPGM(" with "); - switch (fxdTiCtrl.cfg_mode) { - default: break; - //case ftMotionMode_ULENDO_FBS: SERIAL_ECHOLNPGM("Ulendo FBS."); return; - case ftMotionMode_ZV: SERIAL_ECHOLNPGM("ZV"); break; - case ftMotionMode_ZVD: SERIAL_ECHOLNPGM("ZVD"); break; - case ftMotionMode_EI: SERIAL_ECHOLNPGM("EI"); break; - case ftMotionMode_2HEI: SERIAL_ECHOLNPGM("2 Hump EI"); break; - case ftMotionMode_3HEI: SERIAL_ECHOLNPGM("3 Hump EI"); break; - case ftMotionMode_MZV: SERIAL_ECHOLNPGM("MZV"); break; - //case ftMotionMode_DISCTF: SERIAL_ECHOLNPGM("discrete transfer functions"); break; + if (fxdTiCtrl.cfg.mode > ftMotionMode_ENABLED) { + SERIAL_ECHOPGM(" with "); + switch (fxdTiCtrl.cfg.mode) { + default: break; + case ftMotionMode_ZV: SERIAL_ECHOPGM("ZV"); break; + case ftMotionMode_ZVD: SERIAL_ECHOPGM("ZVD"); break; + case ftMotionMode_EI: SERIAL_ECHOPGM("EI"); break; + case ftMotionMode_2HEI: SERIAL_ECHOPGM("2 Hump EI"); break; + case ftMotionMode_3HEI: SERIAL_ECHOPGM("3 Hump EI"); break; + case ftMotionMode_MZV: SERIAL_ECHOPGM("MZV"); break; + //case ftMotionMode_DISCTF: SERIAL_ECHOPGM("discrete transfer functions"); break; + //case ftMotionMode_ULENDO_FBS: SERIAL_ECHOPGM("Ulendo FBS."); return; + } + SERIAL_ECHOPGM(" shaping"); } - SERIAL_ECHOLNPGM(" shaping."); #endif + SERIAL_ECHOLNPGM("."); + + const bool z_based = TERN0(HAS_DYNAMIC_FREQ_MM, fxdTiCtrl.cfg.dynFreqMode == dynFreqMode_Z_BASED), + g_based = TERN0(HAS_DYNAMIC_FREQ_G, fxdTiCtrl.cfg.dynFreqMode == dynFreqMode_MASS_BASED), + dynamic = z_based || g_based; + + // FT Dynamic Frequency Mode + if (fxdTiCtrl.cfg.modeHasShaper()) { + #if HAS_DYNAMIC_FREQ + SERIAL_ECHOPGM("Dynamic Frequency Mode "); + switch (fxdTiCtrl.cfg.dynFreqMode) { + default: + case dynFreqMode_DISABLED: SERIAL_ECHOPGM("disabled"); break; + #if HAS_DYNAMIC_FREQ_MM + case dynFreqMode_Z_BASED: SERIAL_ECHOPGM("Z-based"); break; + #endif + #if HAS_DYNAMIC_FREQ_G + case dynFreqMode_MASS_BASED: SERIAL_ECHOPGM("Mass-based"); break; + #endif + } + SERIAL_ECHOLNPGM("."); + #endif + + #if HAS_X_AXIS + SERIAL_ECHO_TERNARY(dynamic, "X/A ", "base dynamic", "static", " compensator frequency: "); + SERIAL_ECHO_F(fxdTiCtrl.cfg.baseFreq[X_AXIS], 2); + SERIAL_ECHOPGM("Hz"); + #if HAS_DYNAMIC_FREQ + if (dynamic) { + SERIAL_ECHOPGM(" scaling: "); + SERIAL_ECHO_F(fxdTiCtrl.cfg.dynFreqK[X_AXIS], 8); + serial_ternary(F("Hz/"), z_based, F("mm"), F("g")); + } + #endif + SERIAL_EOL(); + #endif + + #if HAS_Y_AXIS + SERIAL_ECHO_TERNARY(dynamic, "Y/B ", "base dynamic", "static", " compensator frequency: "); + SERIAL_ECHO_F(fxdTiCtrl.cfg.baseFreq[Y_AXIS], 2); + SERIAL_ECHOLNPGM(" Hz"); + #if HAS_DYNAMIC_FREQ + if (dynamic) { + SERIAL_ECHOPGM(" scaling: "); + SERIAL_ECHO_F(fxdTiCtrl.cfg.dynFreqK[Y_AXIS], 8); + serial_ternary(F("Hz/"), z_based, F("mm"), F("g")); + } + #endif + SERIAL_EOL(); + #endif + } + + #if HAS_EXTRUDERS + SERIAL_ECHO_TERNARY(fxdTiCtrl.cfg.linearAdvEna, "Linear Advance ", "en", "dis", "abled"); + SERIAL_ECHOLNPGM(". Gain: "); SERIAL_ECHO_F(fxdTiCtrl.cfg.linearAdvK, 5); + #endif + +} + +void GcodeSuite::M493_report(const bool forReplay/*=true*/) { + report_heading_etc(forReplay, F(STR_FT_MOTION)); + const ft_config_t &c = fxdTiCtrl.cfg; + SERIAL_ECHOPGM(" M493 S", c.mode); + #if HAS_X_AXIS + SERIAL_ECHOPGM(" A", c.baseFreq[X_AXIS]); + #if HAS_Y_AXIS + SERIAL_ECHOPGM(" B", c.baseFreq[Y_AXIS]); + #endif + #endif + #if HAS_DYNAMIC_FREQ + SERIAL_ECHOPGM(" D", c.dynFreqMode); + #if HAS_X_AXIS + SERIAL_ECHOPGM(" F", c.dynFreqK[X_AXIS]); + #if HAS_Y_AXIS + SERIAL_ECHOPGM(" H", c.dynFreqK[Y_AXIS]); + #endif + #endif + #endif + #if HAS_EXTRUDERS + SERIAL_ECHOPGM(" P", c.linearAdvEna, " K", c.linearAdvK); + #endif + SERIAL_EOL(); } /** @@ -79,29 +162,36 @@ void say_shaping() { * H Set frequency scaling for the Y axis */ void GcodeSuite::M493() { + struct { bool update_n:1, update_a:1, reset_ft:1, report_h:1; } flag = { false }; + + if (!parser.seen_any()) flag.report_h = true; + // Parse 'S' mode parameter. if (parser.seenval('S')) { - const ftMotionMode_t val = (ftMotionMode_t)parser.value_byte(); - switch (val) { - case ftMotionMode_DISABLED: - case ftMotionMode_ENABLED: + const ftMotionMode_t oldmm = fxdTiCtrl.cfg.mode, + newmm = (ftMotionMode_t)parser.value_byte(); + switch (newmm) { #if HAS_X_AXIS + case ftMotionMode_ZV: case ftMotionMode_ZVD: case ftMotionMode_2HEI: case ftMotionMode_3HEI: case ftMotionMode_MZV: //case ftMotionMode_ULENDO_FBS: //case ftMotionMode_DISCTF: - fxdTiCtrl.cfg_mode = val; - say_shaping(); - break; #endif + case ftMotionMode_DISABLED: + case ftMotionMode_ENABLED: + fxdTiCtrl.cfg.mode = newmm; + flag.report_h = true; + break; default: SERIAL_ECHOLNPGM("?Invalid control mode [M] value."); return; } - switch (val) { + if (fxdTiCtrl.cfg.mode != oldmm) switch (newmm) { + default: break; #if HAS_X_AXIS //case ftMotionMode_ULENDO_FBS: //case ftMotionMode_DISCTF: @@ -112,15 +202,11 @@ void GcodeSuite::M493() { case ftMotionMode_2HEI: case ftMotionMode_3HEI: case ftMotionMode_MZV: - fxdTiCtrl.updateShapingN(fxdTiCtrl.cfg_baseFreq[0] OPTARG(HAS_Y_AXIS, fxdTiCtrl.cfg_baseFreq[1])); - fxdTiCtrl.updateShapingA(); - fxdTiCtrl.reset(); - break; + flag.update_n = flag.update_a = true; #endif case ftMotionMode_ENABLED: - fxdTiCtrl.reset(); + flag.reset_ft = true; break; - default: break; } } @@ -129,47 +215,44 @@ void GcodeSuite::M493() { // Pressure control (linear advance) parameter. if (parser.seen('P')) { const bool val = parser.value_bool(); - fxdTiCtrl.cfg_linearAdvEna = val; - SERIAL_ECHO_TERNARY(val, "Pressure control: Linear Advance ", "en", "dis", "abled.\n"); + fxdTiCtrl.cfg.linearAdvEna = val; + SERIAL_ECHO_TERNARY(val, "Linear Advance ", "en", "dis", "abled.\n"); } // Pressure control (linear advance) gain parameter. if (parser.seenval('K')) { const float val = parser.value_float(); if (val >= 0.0f) { - fxdTiCtrl.cfg_linearAdvK = val; - SERIAL_ECHOPGM("Pressure control: Linear Advance gain set to: "); - SERIAL_ECHO_F(val, 5); - SERIAL_ECHOLNPGM("."); - } - else { // Value out of range. - SERIAL_ECHOLNPGM("Pressure control: Linear Advance gain out of range."); + fxdTiCtrl.cfg.linearAdvK = val; + flag.report_h = true; } + else // Value out of range. + SERIAL_ECHOLNPGM("Linear Advance gain out of range."); } #endif // HAS_EXTRUDERS - #if HAS_Z_AXIS || HAS_EXTRUDERS + #if HAS_DYNAMIC_FREQ // Dynamic frequency mode parameter. if (parser.seenval('D')) { - if (WITHIN(fxdTiCtrl.cfg_mode, 10U, 19U)) { + if (fxdTiCtrl.cfg.modeHasShaper()) { const dynFreqMode_t val = dynFreqMode_t(parser.value_byte()); switch (val) { case dynFreqMode_DISABLED: - fxdTiCtrl.cfg_dynFreqMode = val; - SERIAL_ECHOLNPGM("Dynamic frequency mode disabled."); + fxdTiCtrl.cfg.dynFreqMode = val; + flag.report_h = true; break; - #if HAS_Z_AXIS + #if HAS_DYNAMIC_FREQ_MM case dynFreqMode_Z_BASED: - fxdTiCtrl.cfg_dynFreqMode = val; - SERIAL_ECHOLNPGM("Z-based Dynamic Frequency Mode."); + fxdTiCtrl.cfg.dynFreqMode = val; + flag.report_h = true; break; #endif - #if HAS_EXTRUDERS + #if HAS_DYNAMIC_FREQ_G case dynFreqMode_MASS_BASED: - fxdTiCtrl.cfg_dynFreqMode = val; - SERIAL_ECHOLNPGM("Mass-based Dynamic Frequency Mode."); + fxdTiCtrl.cfg.dynFreqMode = val; + flag.report_h = true; break; #endif default: @@ -178,58 +261,46 @@ void GcodeSuite::M493() { } } else { - SERIAL_ECHOLNPGM("Incompatible shaper for [D] Dynamic Frequency mode."); + SERIAL_ECHOLNPGM("?Wrong shaper for [D] Dynamic Frequency mode."); } } - #endif // HAS_Z_AXIS || HAS_EXTRUDERS + const bool modeUsesDynFreq = ( + TERN0(HAS_DYNAMIC_FREQ_MM, fxdTiCtrl.cfg.dynFreqMode == dynFreqMode_Z_BASED) + || TERN0(HAS_DYNAMIC_FREQ_G, fxdTiCtrl.cfg.dynFreqMode == dynFreqMode_MASS_BASED) + ); + + #endif // HAS_DYNAMIC_FREQ #if HAS_X_AXIS // Parse frequency parameter (X axis). if (parser.seenval('A')) { - if (WITHIN(fxdTiCtrl.cfg_mode, 10U, 19U)) { + if (fxdTiCtrl.cfg.modeHasShaper()) { const float val = parser.value_float(); - const bool frequencyInRange = WITHIN(val, FTM_MIN_SHAPE_FREQ, (FTM_FS) / 2); // TODO: Frequency minimum is dependent on the shaper used; the above check isn't always correct. - if (frequencyInRange) { - fxdTiCtrl.cfg_baseFreq[0] = val; - fxdTiCtrl.updateShapingN(fxdTiCtrl.cfg_baseFreq[0] OPTARG(HAS_Y_AXIS, fxdTiCtrl.cfg_baseFreq[1])); - fxdTiCtrl.reset(); - if (fxdTiCtrl.cfg_dynFreqMode) { SERIAL_ECHOPGM("Compensator base dynamic frequency (X/A axis) set to:"); } - else { SERIAL_ECHOPGM("Compensator static frequency (X/A axis) set to: "); } - SERIAL_ECHO_F(fxdTiCtrl.cfg_baseFreq[0], 2); - SERIAL_ECHOLNPGM("."); + if (WITHIN(val, FTM_MIN_SHAPE_FREQ, (FTM_FS) / 2)) { + fxdTiCtrl.cfg.baseFreq[X_AXIS] = val; + flag.update_n = flag.reset_ft = flag.report_h = true; } - else { // Frequency out of range. - SERIAL_ECHOLNPGM("Invalid [A] frequency value."); - } - } - else { // Mode doesn't use frequency. - SERIAL_ECHOLNPGM("Incompatible mode for [A] frequency."); + else // Frequency out of range. + SERIAL_ECHOLNPGM("Invalid [", AS_CHAR('A'), "] frequency value."); } + else // Mode doesn't use frequency. + SERIAL_ECHOLNPGM("Wrong mode for [", AS_CHAR('A'), "] frequency."); } - #if HAS_Z_AXIS || HAS_EXTRUDERS + #if HAS_DYNAMIC_FREQ // Parse frequency scaling parameter (X axis). if (parser.seenval('F')) { - const bool modeUsesDynFreq = ( - TERN0(HAS_Z_AXIS, fxdTiCtrl.cfg_dynFreqMode == dynFreqMode_Z_BASED) - || TERN0(HAS_EXTRUDERS, fxdTiCtrl.cfg_dynFreqMode == dynFreqMode_MASS_BASED) - ); - if (modeUsesDynFreq) { - const float val = parser.value_float(); - fxdTiCtrl.cfg_dynFreqK[0] = val; - SERIAL_ECHOPGM("Frequency scaling (X/A axis) set to: "); - SERIAL_ECHO_F(fxdTiCtrl.cfg_dynFreqK[0], 8); - SERIAL_ECHOLNPGM("."); - } - else { - SERIAL_ECHOLNPGM("Incompatible mode for [F] frequency scaling."); + fxdTiCtrl.cfg.dynFreqK[X_AXIS] = parser.value_float(); + flag.report_h = true; } + else + SERIAL_ECHOLNPGM("Wrong mode for [", AS_CHAR('F'), "] frequency scaling."); } - #endif // HAS_Z_AXIS || HAS_EXTRUDERS + #endif #endif // HAS_X_AXIS @@ -237,49 +308,40 @@ void GcodeSuite::M493() { // Parse frequency parameter (Y axis). if (parser.seenval('B')) { - if (WITHIN(fxdTiCtrl.cfg_mode, 10U, 19U)) { + if (fxdTiCtrl.cfg.modeHasShaper()) { const float val = parser.value_float(); - const bool frequencyInRange = WITHIN(val, FTM_MIN_SHAPE_FREQ, (FTM_FS) / 2); - if (frequencyInRange) { - fxdTiCtrl.cfg_baseFreq[1] = val; - fxdTiCtrl.updateShapingN(fxdTiCtrl.cfg_baseFreq[0] OPTARG(HAS_Y_AXIS, fxdTiCtrl.cfg_baseFreq[1])); - fxdTiCtrl.reset(); - if (fxdTiCtrl.cfg_dynFreqMode) { SERIAL_ECHOPGM("Compensator base dynamic frequency (Y/B axis) set to:"); } - else { SERIAL_ECHOPGM("Compensator static frequency (Y/B axis) set to: "); } - SERIAL_ECHO_F(fxdTiCtrl.cfg_baseFreq[1], 2); - SERIAL_ECHOLNPGM("."); - } - else { // Frequency out of range. - SERIAL_ECHOLNPGM("Invalid frequency [B] value."); + if (WITHIN(val, FTM_MIN_SHAPE_FREQ, (FTM_FS) / 2)) { + fxdTiCtrl.cfg.baseFreq[Y_AXIS] = val; + flag.update_n = flag.reset_ft = flag.report_h = true; } + else // Frequency out of range. + SERIAL_ECHOLNPGM("Invalid frequency [", AS_CHAR('B'), "] value."); } - else { // Mode doesn't use frequency. - SERIAL_ECHOLNPGM("Incompatible mode for [B] frequency."); - } + else // Mode doesn't use frequency. + SERIAL_ECHOLNPGM("Wrong mode for [", AS_CHAR('B'), "] frequency."); } - #if HAS_Z_AXIS || HAS_EXTRUDERS + #if HAS_DYNAMIC_FREQ // Parse frequency scaling parameter (Y axis). if (parser.seenval('H')) { - const bool modeUsesDynFreq = ( - TERN0(HAS_Z_AXIS, fxdTiCtrl.cfg_dynFreqMode == dynFreqMode_Z_BASED) - || TERN0(HAS_EXTRUDERS, fxdTiCtrl.cfg_dynFreqMode == dynFreqMode_MASS_BASED) - ); - if (modeUsesDynFreq) { - const float val = parser.value_float(); - fxdTiCtrl.cfg_dynFreqK[1] = val; - SERIAL_ECHOPGM("Frequency scaling (Y/B axis) set to: "); - SERIAL_ECHO_F(val, 8); - SERIAL_ECHOLNPGM("."); - } - else { - SERIAL_ECHOLNPGM("Incompatible mode for [H] frequency scaling."); + fxdTiCtrl.cfg.dynFreqK[Y_AXIS] = parser.value_float(); + flag.report_h = true; } + else + SERIAL_ECHOLNPGM("Wrong mode for [", AS_CHAR('H'), "] frequency scaling."); } - #endif // HAS_Z_AXIS || HAS_EXTRUDERS + #endif #endif // HAS_Y_AXIS + + #if HAS_X_AXIS + if (flag.update_n) fxdTiCtrl.refreshShapingN(); + if (flag.update_a) fxdTiCtrl.updateShapingA(); + #endif + if (flag.reset_ft) fxdTiCtrl.reset(); + if (flag.report_h) say_shaping(); + } #endif // FT_MOTION diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index eb465ea7c39dc..9283a92e39653 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -1047,6 +1047,7 @@ class GcodeSuite { #if ENABLED(FT_MOTION) static void M493(); + static void M493_report(const bool forReplay=true); #endif static void M500(); 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 05e625842ad98..9c069d9d246e3 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 @@ -91,7 +91,6 @@ namespace Language_en { 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"; diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 0cfd2f8beaeca..bc97407fc22be 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -446,6 +446,7 @@ namespace Language_en { LSTR MSG_DRAW_MIN_Y = _UxGT("Draw Min Y"); LSTR MSG_DRAW_MAX_Y = _UxGT("Draw Max Y"); LSTR MSG_MAX_BELT_LEN = _UxGT("Max Belt Len"); + LSTR MSG_LINEAR_ADVANCE = _UxGT("Linear Advance"); LSTR MSG_ADVANCE_K = _UxGT("Advance K"); LSTR MSG_ADVANCE_K_E = _UxGT("Advance K *"); LSTR MSG_CONTRAST = _UxGT("LCD Contrast"); @@ -836,6 +837,22 @@ namespace Language_en { LSTR MSG_BACKLASH_CORRECTION = _UxGT("Correction"); LSTR MSG_BACKLASH_SMOOTHING = _UxGT("Smoothing"); + LSTR MSG_FIXED_TIME_MOTION = _UxGT("Fixed-Time Motion"); + LSTR MSG_FTM_MODE = _UxGT("Motion Mode:"); + LSTR MSG_FTM_ZV = _UxGT("ZV"); + LSTR MSG_FTM_ZVD = _UxGT("ZVD"); + LSTR MSG_FTM_EI = _UxGT("EI"); + LSTR MSG_FTM_2HEI = _UxGT("2HEI"); + LSTR MSG_FTM_3HEI = _UxGT("3HEI"); + LSTR MSG_FTM_MZV = _UxGT("MZV"); + //LSTR MSG_FTM_ULENDO_FBS = _UxGT("Ulendo FBS"); + //LSTR MSG_FTM_DISCTF = _UxGT("DISCTF"); + LSTR MSG_FTM_DYN_MODE = _UxGT("DF Mode:"); + LSTR MSG_FTM_Z_BASED = _UxGT("Z-based"); + LSTR MSG_FTM_MASS_BASED = _UxGT("Mass-based"); + LSTR MSG_FTM_BASE_FREQ_N = _UxGT("@ Base Freq."); + LSTR MSG_FTM_DFREQ_K_N = _UxGT("@ Dyn. Freq."); + LSTR MSG_LEVEL_X_AXIS = _UxGT("Level X Axis"); LSTR MSG_AUTO_CALIBRATE = _UxGT("Auto Calibrate"); #if ENABLED(TOUCH_UI_FTDI_EVE) diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index 8caa1e5264032..bab03db606273 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -313,7 +313,136 @@ void menu_move() { void goto_tramming_wizard(); #endif +#if ENABLED(FT_MOTION_MENU) + + #include "../../module/ft_motion.h" + #include "../../gcode/gcode.h" + + void _M493_S(const ftMotionMode_t s) { + char cmd[10]; + sprintf_P(cmd, PSTR("M493S%i"), int(s)); + gcode.process_subcommands_now(cmd); + ui.go_back(); + } + + inline void menu_ftm_mode() { + const ftMotionMode_t mode = fxdTiCtrl.cfg.mode; + + START_MENU(); + BACK_ITEM(MSG_FIXED_TIME_MOTION); + + if (mode != ftMotionMode_DISABLED) ACTION_ITEM(MSG_LCD_OFF, []{ _M493_S(ftMotionMode_DISABLED); }); + if (mode != ftMotionMode_ENABLED) ACTION_ITEM(MSG_LCD_ON, []{ _M493_S(ftMotionMode_ENABLED); }); + #if HAS_X_AXIS + if (mode != ftMotionMode_ZV) ACTION_ITEM(MSG_FTM_ZV, []{ _M493_S(ftMotionMode_ZV); }); + if (mode != ftMotionMode_ZVD) ACTION_ITEM(MSG_FTM_ZVD, []{ _M493_S(ftMotionMode_ZVD); }); + if (mode != ftMotionMode_EI) ACTION_ITEM(MSG_FTM_EI, []{ _M493_S(ftMotionMode_EI); }); + if (mode != ftMotionMode_2HEI) ACTION_ITEM(MSG_FTM_2HEI, []{ _M493_S(ftMotionMode_2HEI); }); + if (mode != ftMotionMode_3HEI) ACTION_ITEM(MSG_FTM_3HEI, []{ _M493_S(ftMotionMode_3HEI); }); + if (mode != ftMotionMode_MZV) ACTION_ITEM(MSG_FTM_MZV, []{ _M493_S(ftMotionMode_MZV); }); + //if (mode != ftMotionMode_ULENDO_FBS) ACTION_ITEM(MSG_FTM_ULENDO_FBS, []{ _M493_S(ftMotionMode_ULENDO_FBS); }); + //if (mode != ftMotionMode_DISCTF) ACTION_ITEM(MSG_FTM_DISCTF, []{ _M493_S(ftMotionMode_DISCTF); }); + #endif + + END_MENU(); + } + + #if HAS_DYNAMIC_FREQ + + void _M493_D(const dynFreqMode_t d) { + char cmd[10]; + sprintf_P(cmd, PSTR("M493D%i"), int(d)); + gcode.process_subcommands_now(cmd); + ui.go_back(); + } + + inline void menu_ftm_dyn_mode() { + const dynFreqMode_t dmode = fxdTiCtrl.cfg.dynFreqMode; + + START_MENU(); + BACK_ITEM(MSG_FIXED_TIME_MOTION); + + if (dmode != dynFreqMode_DISABLED) ACTION_ITEM(MSG_LCD_OFF, []{ _M493_D(dynFreqMode_DISABLED); }); + #if HAS_DYNAMIC_FREQ_MM + if (dmode != dynFreqMode_Z_BASED) ACTION_ITEM(MSG_FTM_Z_BASED, []{ _M493_D(dynFreqMode_Z_BASED); }); + #endif + #if HAS_DYNAMIC_FREQ_G + if (dmode != dynFreqMode_MASS_BASED) ACTION_ITEM(MSG_FTM_MASS_BASED, []{ _M493_D(dynFreqMode_MASS_BASED); }); + #endif + + END_MENU(); + } + + #endif // HAS_DYNAMIC_FREQ + + void menu_ft_motion() { + ft_config_t &c = fxdTiCtrl.cfg; + + FSTR_P ftmode; + switch (c.mode) { + default: + case ftMotionMode_DISABLED: ftmode = GET_TEXT_F(MSG_LCD_OFF); break; + case ftMotionMode_ENABLED: ftmode = GET_TEXT_F(MSG_LCD_ON); break; + case ftMotionMode_ZV: ftmode = GET_TEXT_F(MSG_FTM_ZV); break; + case ftMotionMode_ZVD: ftmode = GET_TEXT_F(MSG_FTM_ZVD); break; + case ftMotionMode_EI: ftmode = GET_TEXT_F(MSG_FTM_EI); break; + case ftMotionMode_2HEI: ftmode = GET_TEXT_F(MSG_FTM_2HEI); break; + case ftMotionMode_3HEI: ftmode = GET_TEXT_F(MSG_FTM_3HEI); break; + case ftMotionMode_MZV: ftmode = GET_TEXT_F(MSG_FTM_MZV); break; + //case ftMotionMode_ULENDO_FBS: ftmode = GET_TEXT_F(MSG_FTM_ULENDO_FBS); break; + //case ftMotionMode_DISCTF: ftmode = GET_TEXT_F(MSG_FTM_DISCTF); break; + } + + #if HAS_DYNAMIC_FREQ + FSTR_P dmode; + switch (c.dynFreqMode) { + default: + case dynFreqMode_DISABLED: dmode = GET_TEXT_F(MSG_LCD_OFF); break; + case dynFreqMode_Z_BASED: dmode = GET_TEXT_F(MSG_FTM_Z_BASED); break; + case dynFreqMode_MASS_BASED: dmode = GET_TEXT_F(MSG_FTM_MASS_BASED); break; + } + #endif + + START_MENU(); + BACK_ITEM(MSG_ADVANCED_SETTINGS); + + SUBMENU(MSG_FTM_MODE, menu_ftm_mode); + MENU_ITEM_ADDON_START_RJ(5); lcd_put_u8str(ftmode); MENU_ITEM_ADDON_END(); + + #if HAS_X_AXIS + EDIT_ITEM_FAST_N(float42_52, X_AXIS, MSG_FTM_BASE_FREQ_N, &c.baseFreq[X_AXIS], FTM_MIN_SHAPE_FREQ, (FTM_FS) / 2, fxdTiCtrl.refreshShapingN); + #endif + #if HAS_Y_AXIS + EDIT_ITEM_FAST_N(float42_52, Y_AXIS, MSG_FTM_BASE_FREQ_N, &c.baseFreq[Y_AXIS], FTM_MIN_SHAPE_FREQ, (FTM_FS) / 2, fxdTiCtrl.refreshShapingN); + #endif + + #if HAS_DYNAMIC_FREQ + if (c.modeHasShaper()) { + SUBMENU(MSG_FTM_DYN_MODE, menu_ftm_dyn_mode); + MENU_ITEM_ADDON_START_RJ(11); lcd_put_u8str(dmode); MENU_ITEM_ADDON_END(); + #if HAS_X_AXIS + EDIT_ITEM_FAST_N(float42_52, X_AXIS, MSG_FTM_DFREQ_K_N, &c.dynFreqK[X_AXIS], 0.0f, 20.0f); + #endif + #if HAS_Y_AXIS + EDIT_ITEM_FAST_N(float42_52, Y_AXIS, MSG_FTM_DFREQ_K_N, &c.dynFreqK[Y_AXIS], 0.0f, 20.0f); + #endif + } + #endif + #if HAS_EXTRUDERS + EDIT_ITEM(bool, MSG_LINEAR_ADVANCE, &c.linearAdvEna); + EDIT_ITEM(float42_52, MSG_ADVANCE_K, &c.linearAdvK, 0, 10); + #endif + + END_MENU(); + } + +#endif // FT_MOTION_MENU + void menu_motion() { + #if ENABLED(FT_MOTION_MENU) + const bool is_busy = printer_busy(); + #endif + START_MENU(); // @@ -339,6 +468,13 @@ void menu_motion() { #endif #endif + // + // M493 - Fixed-Time Motion + // + #if ENABLED(FT_MOTION_MENU) + if (!is_busy) SUBMENU(MSG_FIXED_TIME_MOTION, menu_ft_motion); + #endif + // // Pen up/down menu // diff --git a/Marlin/src/module/ft_motion.cpp b/Marlin/src/module/ft_motion.cpp index 407296f0303dd..d6c834cbc481f 100644 --- a/Marlin/src/module/ft_motion.cpp +++ b/Marlin/src/module/ft_motion.cpp @@ -29,32 +29,28 @@ FxdTiCtrl fxdTiCtrl; -//-----------------------------------------------------------------// -// Variables. -//-----------------------------------------------------------------// - -// Public variables. -ftMotionMode_t FxdTiCtrl::cfg_mode = FTM_DEFAULT_MODE; // Mode / active compensation mode configuration. - -#if HAS_EXTRUDERS - bool FxdTiCtrl::cfg_linearAdvEna = FTM_LINEAR_ADV_DEFAULT_ENA; // Linear advance enable configuration. - float FxdTiCtrl::cfg_linearAdvK = FTM_LINEAR_ADV_DEFAULT_K; // Linear advance gain. +#if !HAS_X_AXIS + static_assert(FTM_DEFAULT_MODE == ftMotionMode_ZV, "ftMotionMode_ZV requires at least one linear axis."); + static_assert(FTM_DEFAULT_MODE == ftMotionMode_ZVD, "ftMotionMode_ZVD requires at least one linear axis."); + static_assert(FTM_DEFAULT_MODE == ftMotionMode_EI, "ftMotionMode_EI requires at least one linear axis."); + static_assert(FTM_DEFAULT_MODE == ftMotionMode_2HEI, "ftMotionMode_2HEI requires at least one linear axis."); + static_assert(FTM_DEFAULT_MODE == ftMotionMode_3HEI, "ftMotionMode_3HEI requires at least one linear axis."); + static_assert(FTM_DEFAULT_MODE == ftMotionMode_MZV, "ftMotionMode_MZV requires at least one linear axis."); #endif - -dynFreqMode_t FxdTiCtrl::cfg_dynFreqMode = FTM_DEFAULT_DYNFREQ_MODE; // Dynamic frequency mode configuration. -#if !HAS_Z_AXIS +#if !HAS_DYNAMIC_FREQ_MM static_assert(FTM_DEFAULT_DYNFREQ_MODE != dynFreqMode_Z_BASED, "dynFreqMode_Z_BASED requires a Z axis."); #endif -#if !(HAS_X_AXIS && HAS_EXTRUDERS) +#if !HAS_DYNAMIC_FREQ_G static_assert(FTM_DEFAULT_DYNFREQ_MODE != dynFreqMode_MASS_BASED, "dynFreqMode_MASS_BASED requires an X axis and an extruder."); #endif -#if HAS_X_AXIS - float FxdTiCtrl::cfg_baseFreq[] = { FTM_SHAPING_DEFAULT_X_FREQ // Base frequency. [Hz] - OPTARG(HAS_Y_AXIS, FTM_SHAPING_DEFAULT_Y_FREQ) }; - float FxdTiCtrl::cfg_dynFreqK[] = { 0.0f OPTARG(HAS_Y_AXIS, 0.0f) }; // Scaling / gain for dynamic frequency. [Hz/mm] or [Hz/g] -#endif +//-----------------------------------------------------------------// +// Variables. +//-----------------------------------------------------------------// +// Public variables. + +ft_config_t FxdTiCtrl::cfg; ft_command_t FxdTiCtrl::stepperCmdBuff[FTM_STEPPERCMD_BUFF_SIZE] = {0U}; // Buffer of stepper commands. hal_timer_t FxdTiCtrl::stepperCmdBuff_StepRelativeTi[FTM_STEPPERCMD_BUFF_SIZE] = {0U}; // Buffer of the stepper command timing. uint8_t FxdTiCtrl::stepperCmdBuff_ApplyDir[FTM_STEPPERCMD_DIR_SIZE] = {0U}; // Buffer of whether DIR needs to be updated. @@ -209,7 +205,7 @@ void FxdTiCtrl::runoutBlock() { // Controller main, to be invoked from non-isr task. void FxdTiCtrl::loop() { - if (!cfg_mode) return; + if (!cfg.mode) return; // Handle block abort with the following sequence: // 1. Zero out commands in stepper ISR. @@ -291,7 +287,7 @@ void FxdTiCtrl::loop() { const float K = exp( -zeta * M_PI / sqrt(1.0f - sq(zeta)) ), K2 = sq(K); - switch (cfg_mode) { + switch (cfg.mode) { case ftMotionMode_ZV: xy_max_i = 1U; @@ -363,7 +359,7 @@ void FxdTiCtrl::loop() { const float df = sqrt(1.0f - sq(zeta)); - switch (cfg_mode) { + switch (cfg.mode) { case ftMotionMode_ZV: x_Ni[1] = round((0.5f / xf / df) * (FTM_FS)); #if HAS_Y_AXIS @@ -472,8 +468,8 @@ uint32_t FxdTiCtrl::stepperCmdBuffItems() { // Initializes storage variables before startup. void FxdTiCtrl::init() { #if HAS_X_AXIS - updateShapingN(cfg_baseFreq[0] OPTARG(HAS_Y_AXIS, cfg_baseFreq[1])); - updateShapingA(FTM_SHAPING_ZETA, FTM_SHAPING_V_TOL); + refreshShapingN(); + updateShapingA(); #endif reset(); // Precautionary. } @@ -606,9 +602,9 @@ void FxdTiCtrl::makeVector() { #if HAS_EXTRUDERS const float new_raw_z1 = e_startPosn + e_Ratio * dist; - if (cfg_linearAdvEna) { + if (cfg.linearAdvEna) { float dedt_adj = (new_raw_z1 - e_raw_z1) * (FTM_FS); - if (e_Ratio > 0.0f) dedt_adj += accel_k * cfg_linearAdvK; + if (e_Ratio > 0.0f) dedt_adj += accel_k * cfg.linearAdvK; e_advanced_z1 += dedt_adj * (FTM_TS); ed[makeVector_batchIdx] = e_advanced_z1; @@ -622,28 +618,28 @@ void FxdTiCtrl::makeVector() { #endif // Update shaping parameters if needed. - #if HAS_Z_AXIS + #if HAS_DYNAMIC_FREQ_MM static float zd_z1 = 0.0f; #endif - switch (cfg_dynFreqMode) { + switch (cfg.dynFreqMode) { - #if HAS_Z_AXIS + #if HAS_DYNAMIC_FREQ_MM case dynFreqMode_Z_BASED: if (zd[makeVector_batchIdx] != zd_z1) { // Only update if Z changed. - const float xf = cfg_baseFreq[0] + cfg_dynFreqK[0] * zd[makeVector_batchIdx], - yf = cfg_baseFreq[1] + cfg_dynFreqK[1] * zd[makeVector_batchIdx]; + const float xf = cfg.baseFreq[X_AXIS] + cfg.dynFreqK[X_AXIS] * zd[makeVector_batchIdx], + yf = cfg.baseFreq[Y_AXIS] + cfg.dynFreqK[Y_AXIS] * zd[makeVector_batchIdx]; updateShapingN(_MAX(xf, FTM_MIN_SHAPE_FREQ), _MAX(yf, FTM_MIN_SHAPE_FREQ)); zd_z1 = zd[makeVector_batchIdx]; } break; #endif - #if HAS_X_AXIS && HAS_EXTRUDERS + #if HAS_DYNAMIC_FREQ_G case dynFreqMode_MASS_BASED: // Update constantly. The optimization done for Z value makes // less sense for E, as E is expected to constantly change. - updateShapingN( cfg_baseFreq[0] + cfg_dynFreqK[0] * ed[makeVector_batchIdx] - OPTARG(HAS_Y_AXIS, cfg_baseFreq[1] + cfg_dynFreqK[1] * ed[makeVector_batchIdx]) ); + updateShapingN( cfg.baseFreq[X_AXIS] + cfg.dynFreqK[X_AXIS] * ed[makeVector_batchIdx] + OPTARG(HAS_Y_AXIS, cfg.baseFreq[Y_AXIS] + cfg.dynFreqK[Y_AXIS] * ed[makeVector_batchIdx]) ); break; #endif @@ -652,7 +648,7 @@ void FxdTiCtrl::makeVector() { // Apply shaping if in mode. #if HAS_X_AXIS - if (WITHIN(cfg_mode, 10U, 19U)) { + if (WITHIN(cfg.mode, 10U, 19U)) { xd_zi[xy_zi_idx] = xd[makeVector_batchIdx]; xd[makeVector_batchIdx] *= x_Ai[0]; #if HAS_Y_AXIS diff --git a/Marlin/src/module/ft_motion.h b/Marlin/src/module/ft_motion.h index a277f3ac26e6c..232d191cda698 100644 --- a/Marlin/src/module/ft_motion.h +++ b/Marlin/src/module/ft_motion.h @@ -28,20 +28,69 @@ #define FTM_STEPPERCMD_DIR_SIZE ((FTM_STEPPERCMD_BUFF_SIZE + 7) / 8) +#if HAS_X_AXIS && (HAS_Z_AXIS || HAS_EXTRUDERS) + #define HAS_DYNAMIC_FREQ 1 + #if HAS_Z_AXIS + #define HAS_DYNAMIC_FREQ_MM 1 + #endif + #if HAS_EXTRUDERS + #define HAS_DYNAMIC_FREQ_G 1 + #endif +#endif + +typedef struct FTConfig { + ftMotionMode_t mode = FTM_DEFAULT_MODE; // Mode / active compensation mode configuration. + + bool modeHasShaper() { return WITHIN(mode, 10U, 19U); } + + #if HAS_X_AXIS + float baseFreq[1 + ENABLED(HAS_Y_AXIS)] = // Base frequency. [Hz] + { FTM_SHAPING_DEFAULT_X_FREQ OPTARG(HAS_Y_AXIS, FTM_SHAPING_DEFAULT_Y_FREQ) }; + #endif + + #if HAS_DYNAMIC_FREQ + dynFreqMode_t dynFreqMode = FTM_DEFAULT_DYNFREQ_MODE; // Dynamic frequency mode configuration. + float dynFreqK[1 + ENABLED(HAS_Y_AXIS)] = { 0.0f }; // Scaling / gain for dynamic frequency. [Hz/mm] or [Hz/g] + #else + static constexpr dynFreqMode_t dynFreqMode = dynFreqMode_DISABLED; + #endif + + #if HAS_EXTRUDERS + bool linearAdvEna = FTM_LINEAR_ADV_DEFAULT_ENA; // Linear advance enable configuration. + float linearAdvK = FTM_LINEAR_ADV_DEFAULT_K; // Linear advance gain. + #endif +} ft_config_t; + class FxdTiCtrl { public: // Public variables - static ftMotionMode_t cfg_mode; // Mode / active compensation mode configuration. - static bool cfg_linearAdvEna; // Linear advance enable configuration. - static float cfg_linearAdvK; // Linear advance gain. - static dynFreqMode_t cfg_dynFreqMode; // Dynamic frequency mode configuration. + static ft_config_t cfg; - #if HAS_X_AXIS - static float cfg_baseFreq[1 + ENABLED(HAS_Y_AXIS)]; // Base frequency. [Hz] - static float cfg_dynFreqK[1 + ENABLED(HAS_Y_AXIS)]; // Scaling / gain for dynamic frequency. [Hz/mm] or [Hz/g] - #endif + static void set_defaults() { + cfg.mode = FTM_DEFAULT_MODE; + + TERN_(HAS_X_AXIS, cfg.baseFreq[X_AXIS] = FTM_SHAPING_DEFAULT_X_FREQ); + TERN_(HAS_Y_AXIS, cfg.baseFreq[Y_AXIS] = FTM_SHAPING_DEFAULT_Y_FREQ); + + #if HAS_DYNAMIC_FREQ + cfg.dynFreqMode = FTM_DEFAULT_DYNFREQ_MODE; + cfg.dynFreqK[X_AXIS] = TERN_(HAS_Y_AXIS, cfg.dynFreqK[Y_AXIS]) = 0.0f; + #endif + + #if HAS_EXTRUDERS + cfg.linearAdvEna = FTM_LINEAR_ADV_DEFAULT_ENA; + cfg.linearAdvK = FTM_LINEAR_ADV_DEFAULT_K; + #endif + + #if HAS_X_AXIS + refreshShapingN(); + updateShapingA(); + #endif + + reset(); + } static ft_command_t stepperCmdBuff[FTM_STEPPERCMD_BUFF_SIZE]; // Buffer of stepper commands. static hal_timer_t stepperCmdBuff_StepRelativeTi[FTM_STEPPERCMD_BUFF_SIZE]; // Buffer of the stepper command timing. @@ -68,6 +117,9 @@ class FxdTiCtrl { // Refresh the indices used by shaping functions. // To be called when frequencies change. static void updateShapingN(const_float_t xf OPTARG(HAS_Y_AXIS, const_float_t yf), const_float_t zeta=FTM_SHAPING_ZETA); + + static void refreshShapingN() { updateShapingN(cfg.baseFreq[X_AXIS] OPTARG(HAS_Y_AXIS, cfg.baseFreq[Y_AXIS])); } + #endif static void reset(); // Resets all states of the fixed time conversion to defaults. diff --git a/Marlin/src/module/ft_types.h b/Marlin/src/module/ft_types.h index 613e177a3915f..a3239a9246437 100644 --- a/Marlin/src/module/ft_types.h +++ b/Marlin/src/module/ft_types.h @@ -26,14 +26,14 @@ typedef enum FXDTICtrlMode : uint8_t { ftMotionMode_DISABLED = 0U, ftMotionMode_ENABLED = 1U, - ftMotionMode_ULENDO_FBS = 2U, + //ftMotionMode_ULENDO_FBS = 2U, ftMotionMode_ZV = 10U, ftMotionMode_ZVD = 11U, ftMotionMode_EI = 12U, ftMotionMode_2HEI = 13U, ftMotionMode_3HEI = 14U, ftMotionMode_MZV = 15U, - ftMotionMode_DISCTF = 20U + //ftMotionMode_DISCTF = 20U } ftMotionMode_t; enum dynFreqMode_t : uint8_t { diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index b0d0b3e353c26..02a7d05cae3ad 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1692,7 +1692,7 @@ void Planner::quick_stop() { // Restart the block delay for the first movement - As the queue was // forced to empty, there's no risk the ISR will touch this. - delay_before_delivering = TERN_(FT_MOTION, fxdTiCtrl.cfg_mode ? BLOCK_DELAY_NONE :) BLOCK_DELAY_FOR_1ST_MOVE; + delay_before_delivering = TERN_(FT_MOTION, fxdTiCtrl.cfg.mode ? BLOCK_DELAY_NONE :) BLOCK_DELAY_FOR_1ST_MOVE; TERN_(HAS_WIRED_LCD, clear_block_buffer_runtime()); // Clear the accumulated runtime @@ -1851,7 +1851,7 @@ bool Planner::_buffer_steps(const xyze_long_t &target // As there are no queued movements, the Stepper ISR will not touch this // variable, so there is no risk setting this here (but it MUST be done // before the following line!!) - delay_before_delivering = TERN_(FT_MOTION, fxdTiCtrl.cfg_mode ? BLOCK_DELAY_NONE :) BLOCK_DELAY_FOR_1ST_MOVE; + delay_before_delivering = TERN_(FT_MOTION, fxdTiCtrl.cfg.mode ? BLOCK_DELAY_NONE :) BLOCK_DELAY_FOR_1ST_MOVE; } // Move buffer head @@ -2924,7 +2924,7 @@ void Planner::buffer_sync_block(const BlockFlagBit sync_flag/*=BLOCK_BIT_SYNC_PO // As there are no queued movements, the Stepper ISR will not touch this // variable, so there is no risk setting this here (but it MUST be done // before the following line!!) - delay_before_delivering = TERN_(FT_MOTION, fxdTiCtrl.cfg_mode ? BLOCK_DELAY_NONE :) BLOCK_DELAY_FOR_1ST_MOVE; + delay_before_delivering = TERN_(FT_MOTION, fxdTiCtrl.cfg.mode ? BLOCK_DELAY_NONE :) BLOCK_DELAY_FOR_1ST_MOVE; } block_buffer_head = next_buffer_head; @@ -3217,7 +3217,7 @@ bool Planner::buffer_line(const xyze_pos_t &cart, const_feedRate_t fr_mm_s // As there are no queued movements, the Stepper ISR will not touch this // variable, so there is no risk setting this here (but it MUST be done // before the following line!!) - delay_before_delivering = TERN_(FT_MOTION, fxdTiCtrl.cfg_mode ? BLOCK_DELAY_NONE :) BLOCK_DELAY_FOR_1ST_MOVE; + delay_before_delivering = TERN_(FT_MOTION, fxdTiCtrl.cfg.mode ? BLOCK_DELAY_NONE :) BLOCK_DELAY_FOR_1ST_MOVE; } // Move buffer head diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 53e98a4626599..b6e605e853e44 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -111,6 +111,10 @@ #include "../feature/backlash.h" #endif +#if ENABLED(FT_MOTION) + #include "../module/ft_motion.h" +#endif + #if HAS_FILAMENT_SENSOR #include "../feature/runout.h" #ifndef FIL_RUNOUT_ENABLED_DEFAULT @@ -594,16 +598,23 @@ typedef struct SettingsDataStruct { MPC_t mpc_constants[HOTENDS]; // M306 #endif + // + // Fixed-Time Motion + // + #if ENABLED(FT_MOTION) + ft_config_t fxdTiCtrl_cfg; // M493 + #endif + // // Input Shaping // #if ENABLED(INPUT_SHAPING_X) - float shaping_x_frequency, // M593 X F - shaping_x_zeta; // M593 X D + float shaping_x_frequency, // M593 X F + shaping_x_zeta; // M593 X D #endif #if ENABLED(INPUT_SHAPING_Y) - float shaping_y_frequency, // M593 Y F - shaping_y_zeta; // M593 Y D + float shaping_y_frequency, // M593 Y F + shaping_y_zeta; // M593 Y D #endif } SettingsData; @@ -1648,6 +1659,14 @@ void MarlinSettings::postprocess() { HOTEND_LOOP() EEPROM_WRITE(thermalManager.temp_hotend[e].mpc); #endif + // + // Fixed-Time Motion + // + #if ENABLED(FT_MOTION) + _FIELD_TEST(fxdTiCtrl_cfg); + EEPROM_WRITE(fxdTiCtrl.cfg); + #endif + // // Input Shaping /// @@ -2646,9 +2665,15 @@ void MarlinSettings::postprocess() { // Model predictive control // #if ENABLED(MPCTEMP) - { HOTEND_LOOP() EEPROM_READ(thermalManager.temp_hotend[e].mpc); - } + #endif + + // + // Fixed-Time Motion + // + #if ENABLED(FT_MOTION) + _FIELD_TEST(fxdTiCtrl_cfg); + EEPROM_READ(fxdTiCtrl.cfg); #endif // @@ -3445,6 +3470,11 @@ void MarlinSettings::reset() { } #endif + // + // Fixed-Time Motion + // + TERN_(FT_MOTION, fxdTiCtrl.set_defaults()); + // // Input Shaping // @@ -3706,6 +3736,11 @@ void MarlinSettings::reset() { // TERN_(HAS_STEALTHCHOP, gcode.M569_report(forReplay)); + // + // Fixed-Time Motion + // + TERN_(FT_MOTION, gcode.M493_report(forReplay)); + // // Input Shaping // diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index b23667b820152..3188f77da8bb0 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -1497,7 +1497,7 @@ void Stepper::isr() { #if ENABLED(FT_MOTION) // NOTE STEPPER_TIMER_RATE is equal to 2000000, not what VSCode shows - const bool using_fxtictrl = fxdTiCtrl.cfg_mode; + const bool using_fxtictrl = fxdTiCtrl.cfg.mode; if (using_fxtictrl) { if (!nextMainISR) { if (abort_current_block) { diff --git a/buildroot/tests/STM32F103RC_btt b/buildroot/tests/STM32F103RC_btt index 95a18c615ff87..d0da6305e5378 100755 --- a/buildroot/tests/STM32F103RC_btt +++ b/buildroot/tests/STM32F103RC_btt @@ -12,7 +12,7 @@ set -e restore_configs opt_set MOTHERBOARD BOARD_BTT_SKR_MINI_E3_V1_0 SERIAL_PORT 1 SERIAL_PORT_2 -1 \ X_DRIVER_TYPE TMC2209 Y_DRIVER_TYPE TMC2209 Z_DRIVER_TYPE TMC2209 E0_DRIVER_TYPE TMC2209 -opt_enable PINS_DEBUGGING Z_IDLE_HEIGHT FT_MOTION +opt_enable CR10_STOCKDISPLAY PINS_DEBUGGING Z_IDLE_HEIGHT FT_MOTION FT_MOTION_MENU exec_test $1 $2 "BigTreeTech SKR Mini E3 1.0 - TMC2209 HW Serial, FT_MOTION" "$3" # clean up From df078cac92b3abe774a11f12b609fa8d952f8f9e Mon Sep 17 00:00:00 2001 From: Giuliano Zaro <3684609+GMagician@users.noreply.github.com> Date: Tue, 16 May 2023 09:39:50 +0200 Subject: [PATCH 035/100] =?UTF-8?q?=F0=9F=94=A7=20TMC=20Config=20Inheritan?= =?UTF-8?q?ce=20followup=20(#25783)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index b68557cb289f8..c66745d8bf55b 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -2862,7 +2862,7 @@ #if AXIS_IS_TMC_CONFIG(X2) #define X2_CURRENT X_CURRENT - #define X2_CURRENT_HOME X2_CURRENT + #define X2_CURRENT_HOME X_CURRENT_HOME #define X2_MICROSTEPS X_MICROSTEPS #define X2_RSENSE X_RSENSE #define X2_CHAIN_POS -1 @@ -2882,7 +2882,7 @@ #if AXIS_IS_TMC_CONFIG(Y2) #define Y2_CURRENT Y_CURRENT - #define Y2_CURRENT_HOME Y2_CURRENT + #define Y2_CURRENT_HOME Y_CURRENT_HOME #define Y2_MICROSTEPS Y_MICROSTEPS #define Y2_RSENSE Y_RSENSE #define Y2_CHAIN_POS -1 @@ -2902,7 +2902,7 @@ #if AXIS_IS_TMC_CONFIG(Z2) #define Z2_CURRENT Z_CURRENT - #define Z2_CURRENT_HOME Z2_CURRENT + #define Z2_CURRENT_HOME Z_CURRENT_HOME #define Z2_MICROSTEPS Z_MICROSTEPS #define Z2_RSENSE Z_RSENSE #define Z2_CHAIN_POS -1 @@ -2912,7 +2912,7 @@ #if AXIS_IS_TMC_CONFIG(Z3) #define Z3_CURRENT Z_CURRENT - #define Z3_CURRENT_HOME Z3_CURRENT + #define Z3_CURRENT_HOME Z_CURRENT_HOME #define Z3_MICROSTEPS Z_MICROSTEPS #define Z3_RSENSE Z_RSENSE #define Z3_CHAIN_POS -1 @@ -2922,7 +2922,7 @@ #if AXIS_IS_TMC_CONFIG(Z4) #define Z4_CURRENT Z_CURRENT - #define Z4_CURRENT_HOME Z4_CURRENT + #define Z4_CURRENT_HOME Z_CURRENT_HOME #define Z4_MICROSTEPS Z_MICROSTEPS #define Z4_RSENSE Z_RSENSE #define Z4_CHAIN_POS -1 From 060ddf5e950b104b00f5d20adf858a9ad00ab72e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 16 May 2023 02:52:52 -0500 Subject: [PATCH 036/100] =?UTF-8?q?=F0=9F=9A=B8=20Support=20Bed=20Leveling?= =?UTF-8?q?=20Mesh=20>=2016x16?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: raTmole --- Marlin/src/core/types.h | 3 +++ Marlin/src/feature/bedlevel/ubl/ubl.h | 4 ++-- Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 8 ++++---- Marlin/src/gcode/bedlevel/G26.cpp | 2 +- Marlin/src/gcode/bedlevel/abl/G29.cpp | 14 +++++++------- Marlin/src/gcode/bedlevel/mbl/G29.cpp | 2 +- Marlin/src/inc/SanityCheck.h | 6 ++++-- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 2 +- Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp | 4 ++-- .../src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp | 2 +- .../generic/bed_mesh_view_screen.h | 2 +- Marlin/src/lcd/menu/menu_bed_leveling.cpp | 2 +- Marlin/src/module/settings.cpp | 4 ++-- 13 files changed, 30 insertions(+), 25 deletions(-) diff --git a/Marlin/src/core/types.h b/Marlin/src/core/types.h index 4c7ebc884fb67..958155860414b 100644 --- a/Marlin/src/core/types.h +++ b/Marlin/src/core/types.h @@ -276,6 +276,9 @@ typedef float celsius_float_t; typedef const_float_t const_feedRate_t; typedef const_float_t const_celsius_float_t; +// Type large enough to count leveling grid points +typedef IF 255)), uint16_t, uint8_t>::type grid_count_t; + // Conversion macros #define MMM_TO_MMS(MM_M) feedRate_t(static_cast(MM_M) / 60.0f) #define MMS_TO_MMM(MM_S) (static_cast(MM_S) * 60.0f) diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.h b/Marlin/src/feature/bedlevel/ubl/ubl.h index 05a937c9853d1..785cb5d883aa5 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.h +++ b/Marlin/src/feature/bedlevel/ubl/ubl.h @@ -48,8 +48,8 @@ struct mesh_index_pair; typedef struct { bool C_seen; int8_t KLS_storage_slot; - uint8_t R_repetition, - V_verbosity, + grid_count_t R_repetition; + uint8_t V_verbosity, P_phase, T_map_type; float B_shim_thickness, diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index 2fbd3bfbebeae..ecbf76ec6ed62 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -351,7 +351,7 @@ void unified_bed_leveling::G29() { // Invalidate one or more nearby mesh points, possibly all. if (parser.seen('I')) { - uint8_t count = parser.has_value() ? parser.value_byte() : 1; + grid_count_t count = parser.has_value() ? parser.value_ushort() : 1; bool invalidate_all = count >= GRID_MAX_POINTS; if (!invalidate_all) { while (count--) { @@ -760,14 +760,14 @@ void unified_bed_leveling::shift_mesh_height() { 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; + grid_count_t count = GRID_MAX_POINTS; mesh_index_pair best; TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(best.pos, ExtUI::G29_START)); do { if (do_ubl_mesh_map) display_map(param.T_map_type); - const uint8_t point_num = (GRID_MAX_POINTS - count) + 1; + const grid_count_t point_num = (GRID_MAX_POINTS - count) + 1; SERIAL_ECHOLNPGM("Probing mesh point ", point_num, "/", GRID_MAX_POINTS, "."); TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_POINT), point_num, int(GRID_MAX_POINTS))); @@ -1135,7 +1135,7 @@ bool unified_bed_leveling::G29_parse_parameters() { param.R_repetition = 0; if (parser.seen('R')) { - param.R_repetition = parser.has_value() ? parser.value_byte() : GRID_MAX_POINTS; + param.R_repetition = parser.has_value() ? parser.value_ushort() : GRID_MAX_POINTS; NOMORE(param.R_repetition, GRID_MAX_POINTS); if (param.R_repetition < 1) { SERIAL_ECHOLNPGM("?(R)epetition count invalid (1+).\n"); diff --git a/Marlin/src/gcode/bedlevel/G26.cpp b/Marlin/src/gcode/bedlevel/G26.cpp index fe20423b8d8bd..1b55bdb4286c7 100644 --- a/Marlin/src/gcode/bedlevel/G26.cpp +++ b/Marlin/src/gcode/bedlevel/G26.cpp @@ -628,7 +628,7 @@ void GcodeSuite::G26() { } // Get repeat from 'R', otherwise do one full circuit - int16_t g26_repeats; + grid_count_t g26_repeats; #if HAS_MARLINUI_MENU g26_repeats = parser.intval('R', GRID_MAX_POINTS + 1); #else diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index dd325284af388..1fe4a31bee483 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -102,11 +102,11 @@ class G29_State { #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) - int abl_points; + grid_count_t abl_points; #elif ENABLED(AUTO_BED_LEVELING_3POINT) - static constexpr int abl_points = 3; + static constexpr grid_count_t abl_points = 3; #elif ABL_USES_GRID - static constexpr int abl_points = GRID_MAX_POINTS; + static constexpr grid_count_t abl_points = GRID_MAX_POINTS; #endif #if ABL_USES_GRID @@ -132,8 +132,8 @@ class G29_State { #if ENABLED(AUTO_BED_LEVELING_LINEAR) int indexIntoAB[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; - float eqnAMatrix[(GRID_MAX_POINTS) * 3], // "A" matrix of the linear system of equations - eqnBVector[GRID_MAX_POINTS], // "B" vector of Z points + float eqnAMatrix[GRID_MAX_POINTS * 3], // "A" matrix of the linear system of equations + eqnBVector[GRID_MAX_POINTS], // "B" vector of Z points mean; #endif #endif @@ -141,7 +141,7 @@ class G29_State { #if ABL_USES_GRID && EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_BILINEAR) constexpr xy_uint8_t G29_State::grid_points; - constexpr int G29_State::abl_points; + constexpr grid_count_t G29_State::abl_points; #endif /** @@ -677,7 +677,7 @@ G29_TYPE GcodeSuite::G29() { zig ^= true; // zag // An index to print current state - uint8_t pt_index = (PR_OUTER_VAR) * (PR_INNER_SIZE) + 1; + grid_count_t pt_index = (PR_OUTER_VAR) * (PR_INNER_SIZE) + 1; // Inner loop is Y with PROBE_Y_FIRST enabled // Inner loop is X with PROBE_Y_FIRST disabled diff --git a/Marlin/src/gcode/bedlevel/mbl/G29.cpp b/Marlin/src/gcode/bedlevel/mbl/G29.cpp index 9f902141fb241..4bc9ba777a09f 100644 --- a/Marlin/src/gcode/bedlevel/mbl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/mbl/G29.cpp @@ -173,7 +173,7 @@ void GcodeSuite::G29() { SET_SOFT_ENDSTOP_LOOSE(false); } // If there's another point to sample, move there with optional lift. - if (mbl_probe_index < (GRID_MAX_POINTS)) { + if (mbl_probe_index < GRID_MAX_POINTS) { // 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); diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 67d11d93e0762..f77bf7afeb7b8 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1498,8 +1498,8 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #error "AUTO_BED_LEVELING_UBL does not yet support POLAR printers." #elif DISABLED(EEPROM_SETTINGS) #error "AUTO_BED_LEVELING_UBL requires EEPROM_SETTINGS." - #elif !WITHIN(GRID_MAX_POINTS_X, 3, 15) || !WITHIN(GRID_MAX_POINTS_Y, 3, 15) - #error "GRID_MAX_POINTS_[XY] must be a whole number between 3 and 15." + #elif !WITHIN(GRID_MAX_POINTS_X, 3, 255) || !WITHIN(GRID_MAX_POINTS_Y, 3, 255) + #error "GRID_MAX_POINTS_[XY] must be between 3 and 255." #endif #elif HAS_ABL_NOT_UBL @@ -1513,6 +1513,8 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L */ #if IS_SCARA && DISABLED(AUTO_BED_LEVELING_BILINEAR) #error "SCARA machines can only use the AUTO_BED_LEVELING_BILINEAR leveling option." + #elif ABL_USES_GRID && !(WITHIN(GRID_MAX_POINTS_X, 3, 255) && WITHIN(GRID_MAX_POINTS_Y, 3, 255)) + #error "GRID_MAX_POINTS_[XY] must be between 3 and 255." #endif #elif ENABLED(MESH_BED_LEVELING) diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index e7f15792f3467..f430f6d1a9005 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -202,7 +202,7 @@ bool livemove = false; bool liveadjust = false; uint8_t preheatmode = 0; float zoffsetvalue = 0; -uint8_t gridpoint; +grid_count_t gridpoint; float corner_avg; float corner_pos; diff --git a/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp index 387557f2afec7..e846d65a1faf7 100644 --- a/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp +++ b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp @@ -549,7 +549,7 @@ namespace Anycubic { bool msg_matched = false; #if HAS_LEVELING - static uint8_t probe_cnt = 0; + static grid_count_t probe_cnt = 0; #endif // The only way to get printer status is to parse messages @@ -564,7 +564,7 @@ namespace Anycubic { // If probing completes ok save the mesh and park // Ignore the custom machine name if (strcmp_P(msg + strlen(MACHINE_NAME), MARLIN_msg_ready) == 0) { - if (probe_cnt == GRID_MAX_POINTS_X * GRID_MAX_POINTS_Y) { + if (probe_cnt == GRID_MAX_POINTS) { probe_cnt = 0; injectCommands(F("M500")); // G27 park nozzle //ChangePageOfTFT(PAGE_PreLEVEL); diff --git a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp index c06971fb10543..f882ba33d0141 100644 --- a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp @@ -415,7 +415,7 @@ void DGUSScreenHandlerMKS::LanguageChange(DGUS_VP_Variable &var, void *val_ptr) } #if ENABLED(MESH_BED_LEVELING) - uint8_t mesh_point_count = GRID_MAX_POINTS; + grid_count_t mesh_point_count = GRID_MAX_POINTS; #endif void DGUSScreenHandlerMKS::Level_Ctrl(DGUS_VP_Variable &var, void *val_ptr) { diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/bed_mesh_view_screen.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/bed_mesh_view_screen.h index b9791fff7a15c..3ec8e06adfaae 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/bed_mesh_view_screen.h +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/bed_mesh_view_screen.h @@ -26,7 +26,7 @@ struct BedMeshViewScreenData { FSTR_P message; - uint8_t count; + grid_count_t count; xy_uint8_t highlight; }; diff --git a/Marlin/src/lcd/menu/menu_bed_leveling.cpp b/Marlin/src/lcd/menu/menu_bed_leveling.cpp index 3d6af0012dd8c..dcf77cb3eb3a0 100644 --- a/Marlin/src/lcd/menu/menu_bed_leveling.cpp +++ b/Marlin/src/lcd/menu/menu_bed_leveling.cpp @@ -53,7 +53,7 @@ // // LCD probed points are from defaults - constexpr uint8_t total_probe_points = TERN(AUTO_BED_LEVELING_3POINT, 3, GRID_MAX_POINTS); + constexpr grid_count_t total_probe_points = TERN(AUTO_BED_LEVELING_3POINT, 3, GRID_MAX_POINTS); // // Bed leveling is done. Wait for G29 to complete. diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index b6e605e853e44..58e00b7fb0e81 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -901,7 +901,7 @@ void MarlinSettings::postprocess() { { #if ENABLED(MESH_BED_LEVELING) static_assert( - sizeof(bedlevel.z_values) == (GRID_MAX_POINTS) * sizeof(bedlevel.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 @@ -955,7 +955,7 @@ void MarlinSettings::postprocess() { { #if ENABLED(AUTO_BED_LEVELING_BILINEAR) static_assert( - sizeof(bedlevel.z_values) == (GRID_MAX_POINTS) * sizeof(bedlevel.z_values[0][0]), + sizeof(bedlevel.z_values) == GRID_MAX_POINTS * sizeof(bedlevel.z_values[0][0]), "Bilinear Z array is the wrong size." ); #endif From 3136435c19d2e06253f01010c2d5ca740a78a79e Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Wed, 17 May 2023 06:50:57 +1200 Subject: [PATCH 037/100] =?UTF-8?q?=F0=9F=90=9B=20Fix=20MKS=20Robin=20Nano?= =?UTF-8?q?=201.3=20F4=20pin=20collision=20(#25838)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V1_3_F4.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V1_3_F4.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V1_3_F4.h index 3cba69a7b30aa..a0a711647b7b0 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V1_3_F4.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V1_3_F4.h @@ -40,6 +40,4 @@ //#define FLASH_EEPROM_EMULATION // Use Flash-based EEPROM emulation #endif -#define LED_PIN PB1 - #include "../stm32f1/pins_MKS_ROBIN_NANO_common.h" From 3b2341fb6127f51dd6b150ea49297b60c364d865 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Wed, 17 May 2023 00:22:49 +0000 Subject: [PATCH 038/100] [cron] Bump distribution date (2023-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 153a4c3be2394..1c01b9cc32d4d 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 "2023-05-16" +//#define STRING_DISTRIBUTION_DATE "2023-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 22e56dd2f4cbf..f3e8162cc82ea 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 "2023-05-16" + #define STRING_DISTRIBUTION_DATE "2023-05-17" #endif /** From b2f372b20f375852e3e009d490260307e399792c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20B=C5=82a=C5=BCewicz?= Date: Thu, 18 May 2023 07:38:21 +0200 Subject: [PATCH 039/100] =?UTF-8?q?=F0=9F=9A=B8=20Unify=20edit=20limits=20?= =?UTF-8?q?for=20some=20E3V2=20LCDs=20(#25045)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/lcd/e3v2/common/limits.h | 94 +++++++ Marlin/src/lcd/e3v2/creality/dwin.cpp | 29 +- Marlin/src/lcd/e3v2/creality/dwin.h | 1 + Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 162 ++++++----- Marlin/src/lcd/e3v2/jyersui/dwin.h | 1 + Marlin/src/lcd/e3v2/proui/dwin.cpp | 382 +++++++++++++++----------- Marlin/src/lcd/e3v2/proui/dwin.h | 1 + 7 files changed, 410 insertions(+), 260 deletions(-) create mode 100644 Marlin/src/lcd/e3v2/common/limits.h diff --git a/Marlin/src/lcd/e3v2/common/limits.h b/Marlin/src/lcd/e3v2/common/limits.h new file mode 100644 index 0000000000000..4ac97b82bbef6 --- /dev/null +++ b/Marlin/src/lcd/e3v2/common/limits.h @@ -0,0 +1,94 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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/common/limits.h + * @brief Limits for UI values + ****************************************************************************/ + +#include "../../../inc/MarlinConfig.h" + +// If max edit values are not specified use default * DEFAULT_MAX_MULTIPLIER +#define DEFAULT_MAX_MULTIPLIER 2 + +// +// Feedrate limits +// +#define MIN_FEEDRATE_EDIT_VALUE 1 + +constexpr xyze_float_t min_feedrate_edit_values = LOGICAL_AXIS_ARRAY_1(MIN_FEEDRATE_EDIT_VALUE), + default_max_feedrate = DEFAULT_MAX_FEEDRATE, + max_feedrate_edit_values = + #ifdef MAX_FEEDRATE_EDIT_VALUES + MAX_FEEDRATE_EDIT_VALUES + #else + default_max_feedrate * float(DEFAULT_MAX_MULTIPLIER) + #endif + ; + +// +// Acceleration limits +// +#define MIN_ACCELERATION_EDIT_VALUE 1 + +constexpr xyze_float_t min_acceleration_edit_values = LOGICAL_AXIS_ARRAY_1(MIN_ACCELERATION_EDIT_VALUE), + default_max_acceleration = DEFAULT_MAX_ACCELERATION, + max_acceleration_edit_values = + #ifdef MAX_ACCEL_EDIT_VALUES + MAX_ACCEL_EDIT_VALUES + #else + default_max_acceleration * float(DEFAULT_MAX_MULTIPLIER) + #endif + ; + +// +// Max jerk limits +// +#define MIN_JERK_EDIT_VALUE 0.1 +#define DEFAULT_MAX_JERK_MULTIPLIER 2 + +#if HAS_CLASSIC_JERK + constexpr xyze_float_t min_jerk_edit_values = LOGICAL_AXIS_ARRAY_1(MIN_JERK_EDIT_VALUE), + default_jerk = LOGICAL_AXIS_ARRAY( + DEFAULT_EJERK, + DEFAULT_XJERK, DEFAULT_YJERK, DEFAULT_ZJERK, + DEFAULT_IJERK, DEFAULT_JJERK, DEFAULT_KJERK, + DEFAULT_UJERK, DEFAULT_VJERK, DEFAULT_WJERK + ), + max_jerk_edit_values = + #ifdef MAX_JERK_EDIT_VALUES + MAX_JERK_EDIT_VALUES + #else + default_jerk * float(DEFAULT_MAX_JERK_MULTIPLIER) + #endif + ; +#endif + +// +// Steps per mm limits +// +#define MIN_STEPS_EDIT_VALUE 1 + +constexpr xyze_float_t min_steps_edit_values = LOGICAL_AXIS_ARRAY_1(MIN_STEPS_EDIT_VALUE), + default_steps = DEFAULT_AXIS_STEPS_PER_UNIT, + max_steps_edit_values = default_steps * float(DEFAULT_MAX_MULTIPLIER); diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index 73621851df400..9ae1cf1e0626d 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp @@ -101,12 +101,6 @@ #define MIN_PRINT_SPEED 10 #define MAX_PRINT_SPEED 999 -// Feedspeed limit (max feedspeed = DEFAULT_MAX_FEEDRATE * 2) -#define MIN_MAXFEEDSPEED 1 -#define MIN_MAXACCELERATION 1 -#define MIN_MAXJERK 0.1 -#define MIN_STEP 1 - #define FEEDRATE_E (60) // Minimum unit (0.1) : multiple (10) @@ -181,13 +175,6 @@ uint8_t index_file = MROWS, bool dwin_abort_flag = false; // Flag to reset feedrate, return to Home -constexpr float default_max_feedrate[] = DEFAULT_MAX_FEEDRATE; -constexpr float default_max_acceleration[] = DEFAULT_MAX_ACCELERATION; - -#if HAS_CLASSIC_JERK - constexpr float default_max_jerk[] = { DEFAULT_XJERK, DEFAULT_YJERK, DEFAULT_ZJERK, DEFAULT_EJERK }; -#endif - static uint8_t _card_percent = 0; static uint16_t _remain_time = 0; @@ -1568,8 +1555,7 @@ void HMI_MaxFeedspeedXYZE() { } // MaxFeedspeed limit if (WITHIN(HMI_flag.feedspeed_axis, X_AXIS, LAST_AXIS)) - NOMORE(HMI_ValueStruct.Max_Feedspeed, default_max_feedrate[HMI_flag.feedspeed_axis] * 2); - if (HMI_ValueStruct.Max_Feedspeed < MIN_MAXFEEDSPEED) HMI_ValueStruct.Max_Feedspeed = MIN_MAXFEEDSPEED; + LIMIT(HMI_ValueStruct.Max_Feedspeed, min_feedrate_edit_values[HMI_flag.feedspeed_axis], max_feedrate_edit_values[HMI_flag.feedspeed_axis]); // MaxFeedspeed value Draw_Edit_Integer4(select_speed.now, HMI_ValueStruct.Max_Feedspeed, true); } @@ -1587,8 +1573,7 @@ void HMI_MaxAccelerationXYZE() { } // MaxAcceleration limit if (WITHIN(HMI_flag.acc_axis, X_AXIS, LAST_AXIS)) - NOMORE(HMI_ValueStruct.Max_Acceleration, default_max_acceleration[HMI_flag.acc_axis] * 2); - if (HMI_ValueStruct.Max_Acceleration < MIN_MAXACCELERATION) HMI_ValueStruct.Max_Acceleration = MIN_MAXACCELERATION; + LIMIT(HMI_ValueStruct.Max_Acceleration, min_acceleration_edit_values[HMI_flag.acc_axis], max_acceleration_edit_values[HMI_flag.acc_axis]); // MaxAcceleration value Draw_Edit_Integer4(select_acc.now, HMI_ValueStruct.Max_Acceleration, true); } @@ -1602,14 +1587,13 @@ void HMI_MaxAccelerationXYZE() { checkkey = MaxJerk; EncoderRate.enabled = false; if (WITHIN(HMI_flag.jerk_axis, X_AXIS, LAST_AXIS)) - planner.set_max_jerk(HMI_flag.jerk_axis, HMI_ValueStruct.Max_Jerk_scaled / 10); + planner.set_max_jerk(HMI_flag.jerk_axis, HMI_ValueStruct.Max_Jerk_scaled / MINUNITMULT); Draw_Edit_Float3(select_jerk.now, HMI_ValueStruct.Max_Jerk_scaled); return; } // MaxJerk limit if (WITHIN(HMI_flag.jerk_axis, X_AXIS, LAST_AXIS)) - NOMORE(HMI_ValueStruct.Max_Jerk_scaled, default_max_jerk[HMI_flag.jerk_axis] * 2 * MINUNITMULT); - NOLESS(HMI_ValueStruct.Max_Jerk_scaled, (MIN_MAXJERK) * MINUNITMULT); + LIMIT(HMI_ValueStruct.Max_Jerk_scaled, min_jerk_edit_values[HMI_flag.jerk_axis] * MINUNITMULT, max_jerk_edit_values[HMI_flag.jerk_axis] * MINUNITMULT); // MaxJerk value Draw_Edit_Float3(select_jerk.now, HMI_ValueStruct.Max_Jerk_scaled, true); } @@ -1623,14 +1607,13 @@ void HMI_StepXYZE() { checkkey = Step; EncoderRate.enabled = false; if (WITHIN(HMI_flag.step_axis, X_AXIS, LAST_AXIS)) - planner.settings.axis_steps_per_mm[HMI_flag.step_axis] = HMI_ValueStruct.Max_Step_scaled / 10; + planner.settings.axis_steps_per_mm[HMI_flag.step_axis] = HMI_ValueStruct.Max_Step_scaled / MINUNITMULT; Draw_Edit_Float3(select_step.now, HMI_ValueStruct.Max_Step_scaled); return; } // Step limit if (WITHIN(HMI_flag.step_axis, X_AXIS, LAST_AXIS)) - NOMORE(HMI_ValueStruct.Max_Step_scaled, 999.9 * MINUNITMULT); - NOLESS(HMI_ValueStruct.Max_Step_scaled, MIN_STEP); + LIMIT(HMI_ValueStruct.Max_Step_scaled, min_steps_edit_values[HMI_flag.step_axis] * MINUNITMULT, max_steps_edit_values[HMI_flag.step_axis] * MINUNITMULT); // Step value Draw_Edit_Float3(select_step.now, HMI_ValueStruct.Max_Step_scaled, true); } diff --git a/Marlin/src/lcd/e3v2/creality/dwin.h b/Marlin/src/lcd/e3v2/creality/dwin.h index 487f309ed996b..854a011c5e3f1 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.h +++ b/Marlin/src/lcd/e3v2/creality/dwin.h @@ -27,6 +27,7 @@ #include "dwin_lcd.h" #include "../common/encoder.h" +#include "../common/limits.h" #include "../../../libs/BL24CXX.h" #include "../../../inc/MarlinConfigPre.h" diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index f430f6d1a9005..ceaf147c3ba1a 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -127,6 +127,11 @@ #define MIN_BED_TEMP 0 #endif +#define FEEDRATE_UNIT 1 +#define ACCELERATION_UNIT 1 +#define JERK_UNIT 10 +#define STEPS_UNIT 10 + /** * Custom menu items with jyersLCD */ @@ -155,13 +160,6 @@ constexpr uint16_t TROWS = 6, MROWS = TROWS - 1, #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; -#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, @@ -2369,10 +2367,10 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item case SPEED_X: if (draw) { Draw_Menu_Item(row, ICON_MaxSpeedX, F("X Axis")); - Draw_Float(planner.settings.max_feedrate_mm_s[X_AXIS], row, false, 1); + Draw_Float(planner.settings.max_feedrate_mm_s[X_AXIS], row, false, FEEDRATE_UNIT); } else - Modify_Value(planner.settings.max_feedrate_mm_s[X_AXIS], 0, default_max_feedrate[X_AXIS] * 2, 1); + Modify_Value(planner.settings.max_feedrate_mm_s[X_AXIS], min_feedrate_edit_values.x, max_feedrate_edit_values.x, FEEDRATE_UNIT); break; #endif @@ -2380,10 +2378,10 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item case SPEED_Y: if (draw) { Draw_Menu_Item(row, ICON_MaxSpeedY, F("Y Axis")); - Draw_Float(planner.settings.max_feedrate_mm_s[Y_AXIS], row, false, 1); + Draw_Float(planner.settings.max_feedrate_mm_s[Y_AXIS], row, false, FEEDRATE_UNIT); } else - Modify_Value(planner.settings.max_feedrate_mm_s[Y_AXIS], 0, default_max_feedrate[Y_AXIS] * 2, 1); + Modify_Value(planner.settings.max_feedrate_mm_s[Y_AXIS], min_feedrate_edit_values.y, max_feedrate_edit_values.y, FEEDRATE_UNIT); break; #endif @@ -2391,10 +2389,10 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item case SPEED_Z: if (draw) { Draw_Menu_Item(row, ICON_MaxSpeedZ, F("Z Axis")); - Draw_Float(planner.settings.max_feedrate_mm_s[Z_AXIS], row, false, 1); + Draw_Float(planner.settings.max_feedrate_mm_s[Z_AXIS], row, false, FEEDRATE_UNIT); } else - Modify_Value(planner.settings.max_feedrate_mm_s[Z_AXIS], 0, default_max_feedrate[Z_AXIS] * 2, 1); + Modify_Value(planner.settings.max_feedrate_mm_s[Z_AXIS], min_feedrate_edit_values.z, max_feedrate_edit_values.z, FEEDRATE_UNIT); break; #endif @@ -2402,10 +2400,10 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item case SPEED_E: if (draw) { Draw_Menu_Item(row, ICON_MaxSpeedE, F("Extruder")); - Draw_Float(planner.settings.max_feedrate_mm_s[E_AXIS], row, false, 1); + Draw_Float(planner.settings.max_feedrate_mm_s[E_AXIS], row, false, FEEDRATE_UNIT); } else - Modify_Value(planner.settings.max_feedrate_mm_s[E_AXIS], 0, default_max_feedrate[E_AXIS] * 2, 1); + Modify_Value(planner.settings.max_feedrate_mm_s[E_AXIS], min_feedrate_edit_values.e, max_feedrate_edit_values.e, FEEDRATE_UNIT); break; #endif } @@ -2430,35 +2428,35 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item case ACCEL_X: if (draw) { Draw_Menu_Item(row, ICON_MaxAccX, F("X Axis")); - Draw_Float(planner.settings.max_acceleration_mm_per_s2[X_AXIS], row, false, 1); + Draw_Float(planner.settings.max_acceleration_mm_per_s2[X_AXIS], row, false, ACCELERATION_UNIT); } else - Modify_Value(planner.settings.max_acceleration_mm_per_s2[X_AXIS], 0, default_max_acceleration[X_AXIS] * 2, 1); + Modify_Value(planner.settings.max_acceleration_mm_per_s2[X_AXIS], min_acceleration_edit_values.x, max_acceleration_edit_values.x, ACCELERATION_UNIT); break; case ACCEL_Y: if (draw) { Draw_Menu_Item(row, ICON_MaxAccY, F("Y Axis")); - Draw_Float(planner.settings.max_acceleration_mm_per_s2[Y_AXIS], row, false, 1); + Draw_Float(planner.settings.max_acceleration_mm_per_s2[Y_AXIS], row, false, ACCELERATION_UNIT); } else - Modify_Value(planner.settings.max_acceleration_mm_per_s2[Y_AXIS], 0, default_max_acceleration[Y_AXIS] * 2, 1); + Modify_Value(planner.settings.max_acceleration_mm_per_s2[Y_AXIS], min_acceleration_edit_values.y, max_acceleration_edit_values.y, ACCELERATION_UNIT); break; case ACCEL_Z: if (draw) { Draw_Menu_Item(row, ICON_MaxAccZ, F("Z Axis")); - Draw_Float(planner.settings.max_acceleration_mm_per_s2[Z_AXIS], row, false, 1); + Draw_Float(planner.settings.max_acceleration_mm_per_s2[Z_AXIS], row, false, ACCELERATION_UNIT); } else - Modify_Value(planner.settings.max_acceleration_mm_per_s2[Z_AXIS], 0, default_max_acceleration[Z_AXIS] * 2, 1); + Modify_Value(planner.settings.max_acceleration_mm_per_s2[Z_AXIS], min_acceleration_edit_values.z, max_acceleration_edit_values.z, ACCELERATION_UNIT); break; #if HAS_HOTEND case ACCEL_E: if (draw) { Draw_Menu_Item(row, ICON_MaxAccE, F("Extruder")); - Draw_Float(planner.settings.max_acceleration_mm_per_s2[E_AXIS], row, false, 1); + Draw_Float(planner.settings.max_acceleration_mm_per_s2[E_AXIS], row, false, ACCELERATION_UNIT); } else - Modify_Value(planner.settings.max_acceleration_mm_per_s2[E_AXIS], 0, default_max_acceleration[E_AXIS] * 2, 1); + Modify_Value(planner.settings.max_acceleration_mm_per_s2[E_AXIS], min_acceleration_edit_values.e, max_acceleration_edit_values.e, ACCELERATION_UNIT); break; #endif } @@ -2480,38 +2478,44 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item else Draw_Menu(Motion, MOTION_JERK); break; - case JERK_X: - if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedJerkX, F("X Axis")); - Draw_Float(planner.max_jerk.x, row, false, 10); - } - else - Modify_Value(planner.max_jerk.x, 0, default_max_jerk[X_AXIS] * 2, 10); - break; - case JERK_Y: - if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedJerkY, F("Y Axis")); - Draw_Float(planner.max_jerk.y, row, false, 10); - } - else - Modify_Value(planner.max_jerk.y, 0, default_max_jerk[Y_AXIS] * 2, 10); - break; - case JERK_Z: - if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedJerkZ, F("Z Axis")); - Draw_Float(planner.max_jerk.z, row, false, 10); - } - else - Modify_Value(planner.max_jerk.z, 0, default_max_jerk[Z_AXIS] * 2, 10); - break; + #if HAS_X_AXIS + case JERK_X: + if (draw) { + Draw_Menu_Item(row, ICON_MaxSpeedJerkX, F("X Axis")); + Draw_Float(planner.max_jerk.x, row, false, JERK_UNIT); + } + else + Modify_Value(planner.max_jerk.x, min_jerk_edit_values.x, max_jerk_edit_values.x, JERK_UNIT); + break; + #endif + #if HAS_Y_AXIS + case JERK_Y: + if (draw) { + Draw_Menu_Item(row, ICON_MaxSpeedJerkY, F("Y Axis")); + Draw_Float(planner.max_jerk.y, row, false, JERK_UNIT); + } + else + Modify_Value(planner.max_jerk.y, min_jerk_edit_values.y, max_jerk_edit_values.y, JERK_UNIT); + break; + #endif + #if HAS_Z_AXIS + case JERK_Z: + if (draw) { + Draw_Menu_Item(row, ICON_MaxSpeedJerkZ, F("Z Axis")); + Draw_Float(planner.max_jerk.z, row, false, JERK_UNIT); + } + else + Modify_Value(planner.max_jerk.z, min_jerk_edit_values.z, max_jerk_edit_values.z, JERK_UNIT); + break; + #endif #if HAS_HOTEND case JERK_E: if (draw) { Draw_Menu_Item(row, ICON_MaxSpeedJerkE, F("Extruder")); - Draw_Float(planner.max_jerk.e, row, false, 10); + Draw_Float(planner.max_jerk.e, row, false, JERK_UNIT); } else - Modify_Value(planner.max_jerk.e, 0, default_max_jerk[E_AXIS] * 2, 10); + Modify_Value(planner.max_jerk.e, min_jerk_edit_values.e, max_jerk_edit_values.e, JERK_UNIT); break; #endif } @@ -2532,39 +2536,45 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Menu(Motion, MOTION_STEPS); - break; - case STEPS_X: - if (draw) { - Draw_Menu_Item(row, ICON_StepX, F("X Axis")); - 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, F("Y Axis")); - 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, F("Z Axis")); - 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; + break; + #if HAS_X_AXIS + case STEPS_X: + if (draw) { + Draw_Menu_Item(row, ICON_StepX, F("X Axis")); + Draw_Float(planner.settings.axis_steps_per_mm[X_AXIS], row, false, STEPS_UNIT); + } + else + Modify_Value(planner.settings.axis_steps_per_mm[X_AXIS], min_steps_edit_values.x, max_steps_edit_values.x, STEPS_UNIT); + break; + #endif + #if HAS_Y_AXIS + case STEPS_Y: + if (draw) { + Draw_Menu_Item(row, ICON_StepY, F("Y Axis")); + Draw_Float(planner.settings.axis_steps_per_mm[Y_AXIS], row, false, STEPS_UNIT); + } + else + Modify_Value(planner.settings.axis_steps_per_mm[Y_AXIS], min_steps_edit_values.y, max_steps_edit_values.y, STEPS_UNIT); + break; + #endif + #if HAS_Z_AXIS + case STEPS_Z: + if (draw) { + Draw_Menu_Item(row, ICON_StepZ, F("Z Axis")); + Draw_Float(planner.settings.axis_steps_per_mm[Z_AXIS], row, false, STEPS_UNIT); + } + else + Modify_Value(planner.settings.axis_steps_per_mm[Z_AXIS], min_steps_edit_values.z, max_steps_edit_values.z, STEPS_UNIT); + break; + #endif #if HAS_HOTEND case STEPS_E: if (draw) { Draw_Menu_Item(row, ICON_StepE, F("Extruder")); - Draw_Float(planner.settings.axis_steps_per_mm[E_AXIS], row, false, 10); + Draw_Float(planner.settings.axis_steps_per_mm[E_AXIS], row, false, STEPS_UNIT); } else - Modify_Value(planner.settings.axis_steps_per_mm[E_AXIS], 0, 1000, 10); + Modify_Value(planner.settings.axis_steps_per_mm[E_AXIS], min_steps_edit_values.e, max_steps_edit_values.e, STEPS_UNIT); break; #endif } diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.h b/Marlin/src/lcd/e3v2/jyersui/dwin.h index 71db445aa8691..2f5369d4a6488 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.h +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.h @@ -30,6 +30,7 @@ #include "../common/dwin_font.h" #include "../common/dwin_color.h" #include "../common/encoder.h" +#include "../common/limits.h" #include "../../../libs/BL24CXX.h" #include "../../../inc/MarlinConfigPre.h" diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 8bd0a67b9b84a..6730c026c59a7 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -143,13 +143,6 @@ // Load and Unload limits #define MAX_LOAD_UNLOAD 500 -// 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 - // Editable temperature limits #define MIN_ETEMP 0 #define MAX_ETEMP (thermalManager.hotend_maxtemp[0] - (HOTEND_OVERSHOOT)) @@ -195,32 +188,6 @@ typedef struct { } select_t; select_t select_page{0}, select_print{0}; -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[] = - #ifdef MAX_JERK_EDIT_VALUES - MAX_JERK_EDIT_VALUES - #else - { DEFAULT_XJERK * 2, DEFAULT_YJERK * 2, DEFAULT_ZJERK * 2, DEFAULT_EJERK * 2 } - #endif - ; -#endif - #if HAS_HOTEND float last_E = 0; #define E_MIN_POS (last_E - (EXTRUDE_MAXLENGTH)) @@ -1301,8 +1268,8 @@ void EachMomentUpdate() { if (card.isPrinting() && !HMI_flag.percent_flag) { uint8_t percentDone = card.percentDone(); if (_percent_done != percentDone) { // print percent - _percent_done = percentDone; - Draw_Print_ProgressBar(); + _percent_done = percentDone; + Draw_Print_ProgressBar(); } // Estimate remaining time every 20 seconds @@ -2537,36 +2504,60 @@ void TramC () { Tram(4); } #endif void ApplyMaxSpeed() { planner.set_max_feedrate(HMI_value.axis, MenuData.Value / MINUNITMULT); } -void SetMaxSpeedX() { HMI_value.axis = X_AXIS, SetFloatOnClick(MIN_MAXFEEDSPEED, max_feedrate_edit_values[X_AXIS], UNITFDIGITS, planner.settings.max_feedrate_mm_s[X_AXIS], ApplyMaxSpeed); } -void SetMaxSpeedY() { HMI_value.axis = Y_AXIS, SetFloatOnClick(MIN_MAXFEEDSPEED, max_feedrate_edit_values[Y_AXIS], UNITFDIGITS, planner.settings.max_feedrate_mm_s[Y_AXIS], ApplyMaxSpeed); } -void SetMaxSpeedZ() { HMI_value.axis = Z_AXIS, SetFloatOnClick(MIN_MAXFEEDSPEED, max_feedrate_edit_values[Z_AXIS], UNITFDIGITS, planner.settings.max_feedrate_mm_s[Z_AXIS], ApplyMaxSpeed); } +#if HAS_X_AXIS + void SetMaxSpeedX() { HMI_value.axis = X_AXIS, SetFloatOnClick(min_feedrate_edit_values.x, max_feedrate_edit_values.x, UNITFDIGITS, planner.settings.max_feedrate_mm_s[X_AXIS], ApplyMaxSpeed); } +#endif +#if HAS_Y_AXIS + void SetMaxSpeedY() { HMI_value.axis = Y_AXIS, SetFloatOnClick(min_feedrate_edit_values.y, max_feedrate_edit_values.y, UNITFDIGITS, planner.settings.max_feedrate_mm_s[Y_AXIS], ApplyMaxSpeed); } +#endif +#if HAS_Z_AXIS + void SetMaxSpeedZ() { HMI_value.axis = Z_AXIS, SetFloatOnClick(min_feedrate_edit_values.z, max_feedrate_edit_values.z, UNITFDIGITS, planner.settings.max_feedrate_mm_s[Z_AXIS], ApplyMaxSpeed); } +#endif #if HAS_HOTEND - void SetMaxSpeedE() { HMI_value.axis = E_AXIS; SetFloatOnClick(MIN_MAXFEEDSPEED, max_feedrate_edit_values[E_AXIS], UNITFDIGITS, planner.settings.max_feedrate_mm_s[E_AXIS], ApplyMaxSpeed); } + void SetMaxSpeedE() { HMI_value.axis = E_AXIS; SetFloatOnClick(min_feedrate_edit_values.e, max_feedrate_edit_values.e, UNITFDIGITS, planner.settings.max_feedrate_mm_s[E_AXIS], ApplyMaxSpeed); } #endif void ApplyMaxAccel() { planner.set_max_acceleration(HMI_value.axis, MenuData.Value); } -void SetMaxAccelX() { HMI_value.axis = X_AXIS, SetIntOnClick(MIN_MAXACCELERATION, max_acceleration_edit_values[X_AXIS], planner.settings.max_acceleration_mm_per_s2[X_AXIS], ApplyMaxAccel); } -void SetMaxAccelY() { HMI_value.axis = Y_AXIS, SetIntOnClick(MIN_MAXACCELERATION, max_acceleration_edit_values[Y_AXIS], planner.settings.max_acceleration_mm_per_s2[Y_AXIS], ApplyMaxAccel); } -void SetMaxAccelZ() { HMI_value.axis = Z_AXIS, SetIntOnClick(MIN_MAXACCELERATION, max_acceleration_edit_values[Z_AXIS], planner.settings.max_acceleration_mm_per_s2[Z_AXIS], ApplyMaxAccel); } +#if HAS_X_AXIS + void SetMaxAccelX() { HMI_value.axis = X_AXIS, SetIntOnClick(min_acceleration_edit_values.x, max_acceleration_edit_values.x, planner.settings.max_acceleration_mm_per_s2[X_AXIS], ApplyMaxAccel); } +#endif +#if HAS_Y_AXIS + void SetMaxAccelY() { HMI_value.axis = Y_AXIS, SetIntOnClick(min_acceleration_edit_values.y, max_acceleration_edit_values.y, planner.settings.max_acceleration_mm_per_s2[Y_AXIS], ApplyMaxAccel); } +#endif +#if HAS_Z_AXIS + void SetMaxAccelZ() { HMI_value.axis = Z_AXIS, SetIntOnClick(min_acceleration_edit_values.z, max_acceleration_edit_values.z, planner.settings.max_acceleration_mm_per_s2[Z_AXIS], ApplyMaxAccel); } +#endif #if HAS_HOTEND - void SetMaxAccelE() { HMI_value.axis = E_AXIS; SetIntOnClick(MIN_MAXACCELERATION, max_acceleration_edit_values[E_AXIS], planner.settings.max_acceleration_mm_per_s2[E_AXIS], ApplyMaxAccel); } + void SetMaxAccelE() { HMI_value.axis = E_AXIS; SetIntOnClick(min_acceleration_edit_values.e, max_acceleration_edit_values.e, planner.settings.max_acceleration_mm_per_s2[E_AXIS], ApplyMaxAccel); } #endif #if HAS_CLASSIC_JERK void ApplyMaxJerk() { planner.set_max_jerk(HMI_value.axis, MenuData.Value / MINUNITMULT); } - void SetMaxJerkX() { HMI_value.axis = X_AXIS, SetFloatOnClick(MIN_MAXJERK, max_jerk_edit_values[X_AXIS], UNITFDIGITS, planner.max_jerk.x, ApplyMaxJerk); } - void SetMaxJerkY() { HMI_value.axis = Y_AXIS, SetFloatOnClick(MIN_MAXJERK, max_jerk_edit_values[Y_AXIS], UNITFDIGITS, planner.max_jerk.y, ApplyMaxJerk); } - void SetMaxJerkZ() { HMI_value.axis = Z_AXIS, SetFloatOnClick(MIN_MAXJERK, max_jerk_edit_values[Z_AXIS], UNITFDIGITS, planner.max_jerk.z, ApplyMaxJerk); } + #if HAS_X_AXIS + void SetMaxJerkX() { HMI_value.axis = X_AXIS, SetFloatOnClick(min_jerk_edit_values.x, max_jerk_edit_values.x, UNITFDIGITS, planner.max_jerk.x, ApplyMaxJerk); } + #endif + #if HAS_Y_AXIS + void SetMaxJerkY() { HMI_value.axis = Y_AXIS, SetFloatOnClick(min_jerk_edit_values.y, max_jerk_edit_values.y, UNITFDIGITS, planner.max_jerk.y, ApplyMaxJerk); } + #endif + #if HAS_Z_AXIS + void SetMaxJerkZ() { HMI_value.axis = Z_AXIS, SetFloatOnClick(min_jerk_edit_values.z, max_jerk_edit_values.z, UNITFDIGITS, planner.max_jerk.z, ApplyMaxJerk); } + #endif #if HAS_HOTEND - void SetMaxJerkE() { HMI_value.axis = E_AXIS; SetFloatOnClick(MIN_MAXJERK, max_jerk_edit_values[E_AXIS], UNITFDIGITS, planner.max_jerk.e, ApplyMaxJerk); } + void SetMaxJerkE() { HMI_value.axis = E_AXIS; SetFloatOnClick(min_jerk_edit_values.e, max_jerk_edit_values.e, UNITFDIGITS, planner.max_jerk.e, ApplyMaxJerk); } #endif #endif -void SetStepsX() { HMI_value.axis = X_AXIS, SetPFloatOnClick( MIN_STEP, MAX_STEP, UNITFDIGITS); } -void SetStepsY() { HMI_value.axis = Y_AXIS, SetPFloatOnClick( MIN_STEP, MAX_STEP, UNITFDIGITS); } -void SetStepsZ() { HMI_value.axis = Z_AXIS, SetPFloatOnClick( MIN_STEP, MAX_STEP, UNITFDIGITS); } +#if HAS_X_AXIS + void SetStepsX() { HMI_value.axis = X_AXIS, SetPFloatOnClick( min_steps_edit_values.x, max_steps_edit_values.x, UNITFDIGITS); } +#endif +#if HAS_Y_AXIS + void SetStepsY() { HMI_value.axis = Y_AXIS, SetPFloatOnClick( min_steps_edit_values.y, max_steps_edit_values.y, UNITFDIGITS); } +#endif +#if HAS_Z_AXIS + void SetStepsZ() { HMI_value.axis = Z_AXIS, SetPFloatOnClick( min_steps_edit_values.z, max_steps_edit_values.z, UNITFDIGITS); } +#endif #if HAS_HOTEND - void SetStepsE() { HMI_value.axis = E_AXIS; SetPFloatOnClick( MIN_STEP, MAX_STEP, UNITFDIGITS); } + void SetStepsE() { HMI_value.axis = E_AXIS; SetPFloatOnClick( min_steps_edit_values.e, max_steps_edit_values.e, UNITFDIGITS); } #if ENABLED(PIDTEMP) void SetHotendPidT() { SetPIntOnClick(MIN_ETEMP, MAX_ETEMP); } #endif @@ -2816,29 +2807,35 @@ void onDrawSpeed(MenuItemClass* menuitem, int8_t line) { onDrawSubMenu(menuitem, line); } -void onDrawMaxSpeedX(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 228, 147); - DWIN_Frame_AreaCopy(1, 229, 133, 236, 147, LBLX + 58, MBASE(line)); // X +#if HAS_X_AXIS + void onDrawMaxSpeedX(MenuItemClass* menuitem, int8_t line) { + if (HMI_IsChinese()) { + menuitem->SetFrame(1, 173, 133, 228, 147); + DWIN_Frame_AreaCopy(1, 229, 133, 236, 147, LBLX + 58, MBASE(line)); // X + } + onDrawPFloatMenu(menuitem, line); } - onDrawPFloatMenu(menuitem, line); -} +#endif -void onDrawMaxSpeedY(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 228, 147); - DWIN_Frame_AreaCopy(1, 1, 150, 7, 160, LBLX + 58, MBASE(line)); // Y +#if HAS_Y_AXIS + void onDrawMaxSpeedY(MenuItemClass* menuitem, int8_t line) { + if (HMI_IsChinese()) { + menuitem->SetFrame(1, 173, 133, 228, 147); + DWIN_Frame_AreaCopy(1, 1, 150, 7, 160, LBLX + 58, MBASE(line)); // Y + } + onDrawPFloatMenu(menuitem, line); } - onDrawPFloatMenu(menuitem, line); -} +#endif -void onDrawMaxSpeedZ(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 228, 147); - DWIN_Frame_AreaCopy(1, 9, 150, 16, 160, LBLX + 58, MBASE(line) + 3); // Z +#if HAS_Z_AXIS + void onDrawMaxSpeedZ(MenuItemClass* menuitem, int8_t line) { + if (HMI_IsChinese()) { + menuitem->SetFrame(1, 173, 133, 228, 147); + DWIN_Frame_AreaCopy(1, 9, 150, 16, 160, LBLX + 58, MBASE(line) + 3); // Z + } + onDrawPFloatMenu(menuitem, line); } - onDrawPFloatMenu(menuitem, line); -} +#endif #if HAS_HOTEND void onDrawMaxSpeedE(MenuItemClass* menuitem, int8_t line) { @@ -2858,32 +2855,38 @@ void onDrawAcc(MenuItemClass* menuitem, int8_t line) { onDrawSubMenu(menuitem, line); } -void onDrawMaxAccelX(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 200, 147); - DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line)); - DWIN_Frame_AreaCopy(1, 229, 133, 236, 147, LBLX + 71, MBASE(line)); // X +#if HAS_X_AXIS + void onDrawMaxAccelX(MenuItemClass* menuitem, int8_t line) { + if (HMI_IsChinese()) { + menuitem->SetFrame(1, 173, 133, 200, 147); + DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line)); + DWIN_Frame_AreaCopy(1, 229, 133, 236, 147, LBLX + 71, MBASE(line)); // X + } + onDrawPInt32Menu(menuitem, line); } - onDrawPInt32Menu(menuitem, line); -} +#endif -void onDrawMaxAccelY(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 200, 147); - DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line)); - DWIN_Frame_AreaCopy(1, 1, 150, 7, 160, LBLX + 71, MBASE(line)); // Y +#if HAS_Y_AXIS + void onDrawMaxAccelY(MenuItemClass* menuitem, int8_t line) { + if (HMI_IsChinese()) { + menuitem->SetFrame(1, 173, 133, 200, 147); + DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line)); + DWIN_Frame_AreaCopy(1, 1, 150, 7, 160, LBLX + 71, MBASE(line)); // Y + } + onDrawPInt32Menu(menuitem, line); } - onDrawPInt32Menu(menuitem, line); -} +#endif -void onDrawMaxAccelZ(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 200, 147); - DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line)); - DWIN_Frame_AreaCopy(1, 9, 150, 16, 160, LBLX + 71, MBASE(line)); // Z +#if HAS_Z_AXIS + void onDrawMaxAccelZ(MenuItemClass* menuitem, int8_t line) { + if (HMI_IsChinese()) { + menuitem->SetFrame(1, 173, 133, 200, 147); + DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line)); + DWIN_Frame_AreaCopy(1, 9, 150, 16, 160, LBLX + 71, MBASE(line)); // Z + } + onDrawPInt32Menu(menuitem, line); } - onDrawPInt32Menu(menuitem, line); -} +#endif #if HAS_HOTEND void onDrawMaxAccelE(MenuItemClass* menuitem, int8_t line) { @@ -2907,35 +2910,41 @@ void onDrawMaxAccelZ(MenuItemClass* menuitem, int8_t line) { onDrawSubMenu(menuitem, line); } - void onDrawMaxJerkX(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 200, 147); - DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line)); - DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(line)); - DWIN_Frame_AreaCopy(1, 229, 133, 236, 147, LBLX + 83, MBASE(line)); + #if HAS_X_AXIS + void onDrawMaxJerkX(MenuItemClass* menuitem, int8_t line) { + if (HMI_IsChinese()) { + menuitem->SetFrame(1, 173, 133, 200, 147); + DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line)); + DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(line)); + DWIN_Frame_AreaCopy(1, 229, 133, 236, 147, LBLX + 83, MBASE(line)); + } + onDrawPFloatMenu(menuitem, line); } - onDrawPFloatMenu(menuitem, line); - } + #endif - void onDrawMaxJerkY(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 200, 147); - DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line)); - DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(line)); - DWIN_Frame_AreaCopy(1, 1, 150, 7, 160, LBLX + 83, MBASE(line)); + #if HAS_Y_AXIS + void onDrawMaxJerkY(MenuItemClass* menuitem, int8_t line) { + if (HMI_IsChinese()) { + menuitem->SetFrame(1, 173, 133, 200, 147); + DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line)); + DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(line)); + DWIN_Frame_AreaCopy(1, 1, 150, 7, 160, LBLX + 83, MBASE(line)); + } + onDrawPFloatMenu(menuitem, line); } - onDrawPFloatMenu(menuitem, line); - } + #endif - void onDrawMaxJerkZ(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 200, 147); - DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line)); - DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(line)); - DWIN_Frame_AreaCopy(1, 9, 150, 16, 160, LBLX + 83, MBASE(line)); + #if HAS_Z_AXIS + void onDrawMaxJerkZ(MenuItemClass* menuitem, int8_t line) { + if (HMI_IsChinese()) { + menuitem->SetFrame(1, 173, 133, 200, 147); + DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line)); + DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(line)); + DWIN_Frame_AreaCopy(1, 9, 150, 16, 160, LBLX + 83, MBASE(line)); + } + onDrawPFloatMenu(menuitem, line); } - onDrawPFloatMenu(menuitem, line); - } + #endif #if HAS_HOTEND @@ -2953,29 +2962,35 @@ void onDrawMaxAccelZ(MenuItemClass* menuitem, int8_t line) { #endif // HAS_CLASSIC_JERK -void onDrawStepsX(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 153, 148, 194, 161); - DWIN_Frame_AreaCopy(1, 229, 133, 236, 147, LBLX + 44, MBASE(line)); // X +#if HAS_X_AXIS + void onDrawStepsX(MenuItemClass* menuitem, int8_t line) { + if (HMI_IsChinese()) { + menuitem->SetFrame(1, 153, 148, 194, 161); + DWIN_Frame_AreaCopy(1, 229, 133, 236, 147, LBLX + 44, MBASE(line)); // X + } + onDrawPFloatMenu(menuitem, line); } - onDrawPFloatMenu(menuitem, line); -} +#endif -void onDrawStepsY(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 153, 148, 194, 161); - DWIN_Frame_AreaCopy(1, 1, 150, 7, 160, LBLX + 44, MBASE(line)); // Y +#if HAS_Y_AXIS + void onDrawStepsY(MenuItemClass* menuitem, int8_t line) { + if (HMI_IsChinese()) { + menuitem->SetFrame(1, 153, 148, 194, 161); + DWIN_Frame_AreaCopy(1, 1, 150, 7, 160, LBLX + 44, MBASE(line)); // Y + } + onDrawPFloatMenu(menuitem, line); } - onDrawPFloatMenu(menuitem, line); -} +#endif -void onDrawStepsZ(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 153, 148, 194, 161); - DWIN_Frame_AreaCopy(1, 9, 150, 16, 160, LBLX + 44, MBASE(line)); // Z +#if HAS_Z_AXIS + void onDrawStepsZ(MenuItemClass* menuitem, int8_t line) { + if (HMI_IsChinese()) { + menuitem->SetFrame(1, 153, 148, 194, 161); + DWIN_Frame_AreaCopy(1, 9, 150, 16, 160, LBLX + 44, MBASE(line)); // Z + } + onDrawPFloatMenu(menuitem, line); } - onDrawPFloatMenu(menuitem, line); -} +#endif #if HAS_HOTEND @@ -2996,10 +3011,7 @@ void onDrawStepsZ(MenuItemClass* menuitem, int8_t line) { // Menu Creation and Drawing functions ====================================================== frame_rect_t selrect(frame_rect_t) { - if (HMI_IsChinese()) - return {133, 1, 28, 13}; - else - return{0}; + return HMI_IsChinese() ? frame_rect_t({ 133, 1, 28, 13 }) : frame_rect_t({ 0 }); } void Draw_Prepare_Menu() { @@ -3147,9 +3159,15 @@ void Draw_Move_Menu() { if (SET_MENU_R(MoveMenu, selrect({192, 1, 42, 14}), MSG_MOVE_AXIS, 6)) { BACK_ITEM(Draw_Prepare_Menu); EDIT_ITEM(ICON_Axis, MSG_LIVE_MOVE, onDrawChkbMenu, SetLiveMove, &EnableLiveMove); - EDIT_ITEM(ICON_MoveX, MSG_MOVE_X, onDrawMoveX, SetMoveX, ¤t_position.x); - EDIT_ITEM(ICON_MoveY, MSG_MOVE_Y, onDrawMoveY, SetMoveY, ¤t_position.y); - EDIT_ITEM(ICON_MoveZ, MSG_MOVE_Z, onDrawMoveZ, SetMoveZ, ¤t_position.z); + #if HAS_X_AXIS + EDIT_ITEM(ICON_MoveX, MSG_MOVE_X, onDrawMoveX, SetMoveX, ¤t_position.x); + #endif + #if HAS_Y_AXIS + EDIT_ITEM(ICON_MoveY, MSG_MOVE_Y, onDrawMoveY, SetMoveY, ¤t_position.y); + #endif + #if HAS_Z_AXIS + EDIT_ITEM(ICON_MoveZ, MSG_MOVE_Z, onDrawMoveZ, SetMoveZ, ¤t_position.z); + #endif #if HAS_HOTEND gcode.process_subcommands_now(F("G92E0")); // reset extruder position EDIT_ITEM(ICON_Extruder, MSG_MOVE_E, onDrawMoveE, SetMoveE, ¤t_position.e); @@ -3165,9 +3183,15 @@ void Draw_Move_Menu() { checkkey = Menu; if (SET_MENU(HomeOffMenu, MSG_SET_HOME_OFFSETS, 4)) { BACK_ITEM(Draw_PhySet_Menu); - EDIT_ITEM(ICON_HomeOffsetX, MSG_HOME_OFFSET_X, onDrawPFloatMenu, SetHomeOffsetX, &home_offset.x); - EDIT_ITEM(ICON_HomeOffsetY, MSG_HOME_OFFSET_Y, onDrawPFloatMenu, SetHomeOffsetY, &home_offset.y); - EDIT_ITEM(ICON_HomeOffsetZ, MSG_HOME_OFFSET_Z, onDrawPFloatMenu, SetHomeOffsetZ, &home_offset.z); + #if HAS_X_AXIS + EDIT_ITEM(ICON_HomeOffsetX, MSG_HOME_OFFSET_X, onDrawPFloatMenu, SetHomeOffsetX, &home_offset.x); + #endif + #if HAS_Y_AXIS + EDIT_ITEM(ICON_HomeOffsetY, MSG_HOME_OFFSET_Y, onDrawPFloatMenu, SetHomeOffsetY, &home_offset.y); + #endif + #if HAS_Z_AXIS + EDIT_ITEM(ICON_HomeOffsetZ, MSG_HOME_OFFSET_Z, onDrawPFloatMenu, SetHomeOffsetZ, &home_offset.z); + #endif } UpdateMenu(HomeOffMenu); } @@ -3180,9 +3204,15 @@ void Draw_Move_Menu() { checkkey = Menu; if (SET_MENU(ProbeSetMenu, MSG_ZPROBE_SETTINGS, 9)) { BACK_ITEM(Draw_AdvancedSettings_Menu); - EDIT_ITEM(ICON_ProbeOffsetX, MSG_ZPROBE_XOFFSET, onDrawPFloatMenu, SetProbeOffsetX, &probe.offset.x); - EDIT_ITEM(ICON_ProbeOffsetY, MSG_ZPROBE_YOFFSET, onDrawPFloatMenu, SetProbeOffsetY, &probe.offset.y); - EDIT_ITEM(ICON_ProbeOffsetZ, MSG_ZPROBE_ZOFFSET, onDrawPFloat2Menu, SetProbeOffsetZ, &probe.offset.z); + #if HAS_X_AXIS + EDIT_ITEM(ICON_ProbeOffsetX, MSG_ZPROBE_XOFFSET, onDrawPFloatMenu, SetProbeOffsetX, &probe.offset.x); + #endif + #if HAS_Y_AXIS + EDIT_ITEM(ICON_ProbeOffsetY, MSG_ZPROBE_YOFFSET, onDrawPFloatMenu, SetProbeOffsetY, &probe.offset.y); + #endif + #if HAS_Z_AXIS + EDIT_ITEM(ICON_ProbeOffsetZ, MSG_ZPROBE_ZOFFSET, onDrawPFloat2Menu, SetProbeOffsetZ, &probe.offset.z); + #endif #if ENABLED(BLTOUCH) MENU_ITEM(ICON_ProbeStow, MSG_MANUAL_STOW, onDrawMenuItem, ProbeStow); MENU_ITEM(ICON_ProbeDeploy, MSG_MANUAL_DEPLOY, onDrawMenuItem, ProbeDeploy); @@ -3431,7 +3461,7 @@ void Draw_Motion_Menu() { #define _Preheat_Menu(N) \ void Draw_Preheat## N ##_Menu() { \ - HMI_value.Select = N-1; \ + HMI_value.Select = (N) - 1; \ Draw_Preheat_Menu(SET_MENU(PreheatMenu, MSG_PREHEAT_## N ##_SETTINGS, 5)); \ } REPEAT_1(PREHEAT_COUNT, _Preheat_Menu) @@ -3463,9 +3493,15 @@ void Draw_MaxSpeed_Menu() { checkkey = Menu; if (SET_MENU_R(MaxSpeedMenu, selrect({1, 16, 28, 13}), MSG_MAX_SPEED, 5)) { BACK_ITEM(Draw_Motion_Menu); - EDIT_ITEM(ICON_MaxSpeedX, MSG_VMAX_A, onDrawMaxSpeedX, SetMaxSpeedX, &planner.settings.max_feedrate_mm_s[X_AXIS]); - EDIT_ITEM(ICON_MaxSpeedY, MSG_VMAX_B, onDrawMaxSpeedY, SetMaxSpeedY, &planner.settings.max_feedrate_mm_s[Y_AXIS]); - EDIT_ITEM(ICON_MaxSpeedZ, MSG_VMAX_C, onDrawMaxSpeedZ, SetMaxSpeedZ, &planner.settings.max_feedrate_mm_s[Z_AXIS]); + #if HAS_X_AXIS + EDIT_ITEM(ICON_MaxSpeedX, MSG_VMAX_A, onDrawMaxSpeedX, SetMaxSpeedX, &planner.settings.max_feedrate_mm_s[X_AXIS]); + #endif + #if HAS_Y_AXIS + EDIT_ITEM(ICON_MaxSpeedY, MSG_VMAX_B, onDrawMaxSpeedY, SetMaxSpeedY, &planner.settings.max_feedrate_mm_s[Y_AXIS]); + #endif + #if HAS_Z_AXIS + EDIT_ITEM(ICON_MaxSpeedZ, MSG_VMAX_C, onDrawMaxSpeedZ, SetMaxSpeedZ, &planner.settings.max_feedrate_mm_s[Z_AXIS]); + #endif #if HAS_HOTEND EDIT_ITEM(ICON_MaxSpeedE, MSG_VMAX_E, onDrawMaxSpeedE, SetMaxSpeedE, &planner.settings.max_feedrate_mm_s[E_AXIS]); #endif @@ -3477,9 +3513,15 @@ void Draw_MaxAccel_Menu() { checkkey = Menu; if (SET_MENU_R(MaxAccelMenu, selrect({1, 16, 28, 13}), MSG_AMAX_EN, 5)) { BACK_ITEM(Draw_Motion_Menu); - EDIT_ITEM(ICON_MaxAccX, MSG_AMAX_A, onDrawMaxAccelX, SetMaxAccelX, &planner.settings.max_acceleration_mm_per_s2[X_AXIS]); - EDIT_ITEM(ICON_MaxAccY, MSG_AMAX_B, onDrawMaxAccelY, SetMaxAccelY, &planner.settings.max_acceleration_mm_per_s2[Y_AXIS]); - EDIT_ITEM(ICON_MaxAccZ, MSG_AMAX_C, onDrawMaxAccelZ, SetMaxAccelZ, &planner.settings.max_acceleration_mm_per_s2[Z_AXIS]); + #if HAS_X_AXIS + EDIT_ITEM(ICON_MaxAccX, MSG_AMAX_A, onDrawMaxAccelX, SetMaxAccelX, &planner.settings.max_acceleration_mm_per_s2[X_AXIS]); + #endif + #if HAS_Y_AXIS + EDIT_ITEM(ICON_MaxAccY, MSG_AMAX_B, onDrawMaxAccelY, SetMaxAccelY, &planner.settings.max_acceleration_mm_per_s2[Y_AXIS]); + #endif + #if HAS_Z_AXIS + EDIT_ITEM(ICON_MaxAccZ, MSG_AMAX_C, onDrawMaxAccelZ, SetMaxAccelZ, &planner.settings.max_acceleration_mm_per_s2[Z_AXIS]); + #endif #if HAS_HOTEND EDIT_ITEM(ICON_MaxAccE, MSG_AMAX_E, onDrawMaxAccelE, SetMaxAccelE, &planner.settings.max_acceleration_mm_per_s2[E_AXIS]); #endif @@ -3493,9 +3535,15 @@ void Draw_MaxAccel_Menu() { checkkey = Menu; if (SET_MENU_R(MaxJerkMenu, selrect({1, 16, 28, 13}), MSG_JERK, 5)) { BACK_ITEM(Draw_Motion_Menu); - EDIT_ITEM(ICON_MaxSpeedJerkX, MSG_VA_JERK, onDrawMaxJerkX, SetMaxJerkX, &planner.max_jerk.x); - EDIT_ITEM(ICON_MaxSpeedJerkY, MSG_VB_JERK, onDrawMaxJerkY, SetMaxJerkY, &planner.max_jerk.y); - EDIT_ITEM(ICON_MaxSpeedJerkZ, MSG_VC_JERK, onDrawMaxJerkZ, SetMaxJerkZ, &planner.max_jerk.z); + #if HAS_X_AXIS + EDIT_ITEM(ICON_MaxSpeedJerkX, MSG_VA_JERK, onDrawMaxJerkX, SetMaxJerkX, &planner.max_jerk.x); + #endif + #if HAS_Y_AXIS + EDIT_ITEM(ICON_MaxSpeedJerkY, MSG_VB_JERK, onDrawMaxJerkY, SetMaxJerkY, &planner.max_jerk.y); + #endif + #if HAS_Z_AXIS + EDIT_ITEM(ICON_MaxSpeedJerkZ, MSG_VC_JERK, onDrawMaxJerkZ, SetMaxJerkZ, &planner.max_jerk.z); + #endif #if HAS_HOTEND EDIT_ITEM(ICON_MaxSpeedJerkE, MSG_VE_JERK, onDrawMaxJerkE, SetMaxJerkE, &planner.max_jerk.e); #endif @@ -3509,9 +3557,15 @@ void Draw_Steps_Menu() { checkkey = Menu; if (SET_MENU_R(StepsMenu, selrect({1, 16, 28, 13}), MSG_STEPS_PER_MM, 5)) { BACK_ITEM(Draw_Motion_Menu); - EDIT_ITEM(ICON_StepX, MSG_A_STEPS, onDrawStepsX, SetStepsX, &planner.settings.axis_steps_per_mm[X_AXIS]); - EDIT_ITEM(ICON_StepY, MSG_B_STEPS, onDrawStepsY, SetStepsY, &planner.settings.axis_steps_per_mm[Y_AXIS]); - EDIT_ITEM(ICON_StepZ, MSG_C_STEPS, onDrawStepsZ, SetStepsZ, &planner.settings.axis_steps_per_mm[Z_AXIS]); + #if HAS_X_AXIS + EDIT_ITEM(ICON_StepX, MSG_A_STEPS, onDrawStepsX, SetStepsX, &planner.settings.axis_steps_per_mm[X_AXIS]); + #endif + #if HAS_Y_AXIS + EDIT_ITEM(ICON_StepY, MSG_B_STEPS, onDrawStepsY, SetStepsY, &planner.settings.axis_steps_per_mm[Y_AXIS]); + #endif + #if HAS_Z_AXIS + EDIT_ITEM(ICON_StepZ, MSG_C_STEPS, onDrawStepsZ, SetStepsZ, &planner.settings.axis_steps_per_mm[Z_AXIS]); + #endif #if HAS_HOTEND EDIT_ITEM(ICON_StepE, MSG_E_STEPS, onDrawStepsE, SetStepsE, &planner.settings.axis_steps_per_mm[E_AXIS]); #endif @@ -3624,9 +3678,15 @@ void Draw_Steps_Menu() { if (SET_MENU(HomingMenu, MSG_HOMING, 6)) { BACK_ITEM(Draw_Prepare_Menu); MENU_ITEM(ICON_Homing, MSG_AUTO_HOME, onDrawMenuItem, AutoHome); - MENU_ITEM(ICON_HomeX, MSG_AUTO_HOME_X, onDrawMenuItem, HomeX); - MENU_ITEM(ICON_HomeY, MSG_AUTO_HOME_Y, onDrawMenuItem, HomeY); - MENU_ITEM(ICON_HomeZ, MSG_AUTO_HOME_Z, onDrawMenuItem, HomeZ); + #if HAS_X_AXIS + MENU_ITEM(ICON_HomeX, MSG_AUTO_HOME_X, onDrawMenuItem, HomeX); + #endif + #if HAS_Y_AXIS + MENU_ITEM(ICON_HomeY, MSG_AUTO_HOME_Y, onDrawMenuItem, HomeY); + #endif + #if HAS_Z_AXIS + MENU_ITEM(ICON_HomeZ, MSG_AUTO_HOME_Z, onDrawMenuItem, HomeZ); + #endif #if ENABLED(MESH_BED_LEVELING) EDIT_ITEM(ICON_ZAfterHome, MSG_Z_AFTER_HOME, onDrawPInt8Menu, SetZAfterHoming, &HMI_data.z_after_homing); #endif diff --git a/Marlin/src/lcd/e3v2/proui/dwin.h b/Marlin/src/lcd/e3v2/proui/dwin.h index 26b77da5fb139..0057a8639234f 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.h +++ b/Marlin/src/lcd/e3v2/proui/dwin.h @@ -33,6 +33,7 @@ #include "dwin_defines.h" #include "dwinui.h" #include "../common/encoder.h" +#include "../common/limits.h" #include "../../../libs/BL24CXX.h" #if EITHER(BABYSTEPPING, HAS_BED_PROBE) From 51fbe03016ffab690c336f814ff39ad0cb3b2164 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Thu, 18 May 2023 06:06:02 +0000 Subject: [PATCH 040/100] [cron] Bump distribution date (2023-05-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 1c01b9cc32d4d..d750fb9fa42ea 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 "2023-05-17" +//#define STRING_DISTRIBUTION_DATE "2023-05-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 f3e8162cc82ea..f1b231143e38f 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 "2023-05-17" + #define STRING_DISTRIBUTION_DATE "2023-05-18" #endif /** From 74a6f5961bc82ef5887ddb7407a8798dc282b2c5 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 18 May 2023 03:03:54 -0500 Subject: [PATCH 041/100] =?UTF-8?q?=F0=9F=94=A8=20Fix=20Windows=20path=20b?= =?UTF-8?q?ackslash=20treated=20as=20escape?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Luc <8822552+luc-github@users.noreply.github.com> --- .../share/PlatformIO/scripts/common-dependencies.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/buildroot/share/PlatformIO/scripts/common-dependencies.py b/buildroot/share/PlatformIO/scripts/common-dependencies.py index aa531be296854..e90ba24dd3498 100644 --- a/buildroot/share/PlatformIO/scripts/common-dependencies.py +++ b/buildroot/share/PlatformIO/scripts/common-dependencies.py @@ -55,10 +55,11 @@ def add_to_feat_cnf(feature, flines): # Get a reference to the FEATURE_CONFIG under construction feat = FEATURE_CONFIG[feature] - # Split up passed lines on commas or newlines and iterate - # Add common options to the features config under construction - # For lib_deps replace a previous instance of the same library - atoms = re.sub(r',\s*', '\n', flines).strip().split('\n') + # Split up passed lines on commas or newlines and iterate. + # Take care to convert Windows '\' paths to Unix-style '/'. + # Add common options to the features config under construction. + # For lib_deps replace a previous instance of the same library. + atoms = re.sub(r',\s*', '\n', flines.replace('\\', '/')).strip().split('\n') for line in atoms: parts = line.split('=') name = parts.pop(0) From a886906f01d44e56d249de1f37a11342697b465c Mon Sep 17 00:00:00 2001 From: I3DBeeTech <129617321+I3DBeeTech@users.noreply.github.com> Date: Thu, 18 May 2023 13:53:29 +0530 Subject: [PATCH 042/100] =?UTF-8?q?=E2=9C=A8=20I3DBEEZ9=20board=20(#25614)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test-builds.yml | 3 +- Marlin/src/core/boards.h | 1 + Marlin/src/pins/pins.h | 2 + Marlin/src/pins/stm32f4/pins_I3DBEEZ9.h | 626 ++++++++++++++++++ .../PlatformIO/boards/marlin_I3DBEEZ9.json | 46 ++ .../variants/MARLIN_I3DBEEZ9/PeripheralPins.c | 370 +++++++++++ .../variants/MARLIN_I3DBEEZ9/PinNamesVar.h | 50 ++ .../variants/MARLIN_I3DBEEZ9/hal_conf_extra.h | 52 ++ .../variants/MARLIN_I3DBEEZ9/ldscript.ld | 204 ++++++ .../variants/MARLIN_I3DBEEZ9/variant.cpp | 260 ++++++++ .../variants/MARLIN_I3DBEEZ9/variant.h | 323 +++++++++ buildroot/tests/I3DBEEZ9_V1 | 33 + ini/stm32f4.ini | 11 + 13 files changed, 1980 insertions(+), 1 deletion(-) create mode 100644 Marlin/src/pins/stm32f4/pins_I3DBEEZ9.h create mode 100644 buildroot/share/PlatformIO/boards/marlin_I3DBEEZ9.json create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_I3DBEEZ9/PeripheralPins.c create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_I3DBEEZ9/PinNamesVar.h create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_I3DBEEZ9/hal_conf_extra.h create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_I3DBEEZ9/ldscript.ld create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_I3DBEEZ9/variant.cpp create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_I3DBEEZ9/variant.h create mode 100755 buildroot/tests/I3DBEEZ9_V1 diff --git a/.github/workflows/test-builds.yml b/.github/workflows/test-builds.yml index fcda1111cbe64..dea1a4e176161 100644 --- a/.github/workflows/test-builds.yml +++ b/.github/workflows/test-builds.yml @@ -39,11 +39,11 @@ jobs: # AVR - mega2560 + - mega1280 - at90usb1286_dfu # AVR Extended - FYSETC_F6 - - mega1280 - melzi_optiboot - rambo - sanguino1284p @@ -109,6 +109,7 @@ jobs: - rumba32 - STM32F401RC_creality - STM32F407VE_black + - I3DBEEZ9_V1 # STM32F7 - NUCLEO_F767ZI diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 3820ef8a07cf6..742cf8f236fcb 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -452,6 +452,7 @@ #define BOARD_TRONXY_V10 5245 // TRONXY V10 (STM32F446ZE) #define BOARD_CREALITY_F401RE 5246 // Creality CR4NS200141C13 (STM32F401RE) as found in the Ender-5 S1 #define BOARD_BLACKPILL_CUSTOM 5247 // Custom board based on STM32F401CDU6. +#define BOARD_I3DBEEZ9_V1 5248 // I3DBEEZ9 V1 (STM32F407ZG) // // ARM Cortex-M7 diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 369506a748738..511870053324b 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -794,6 +794,8 @@ #include "stm32f4/pins_CREALITY_F401.h" // STM32F4 env:STM32F401RE_creality #elif MB(BLACKPILL_CUSTOM) #include "stm32f4/pins_BLACKPILL_CUSTOM.h" // STM32F4 env:STM32F401CD_blackpill_stlink +#elif MB(I3DBEEZ9_V1) + #include "stm32f4/pins_I3DBEEZ9.h" // STM32F4 env:I3DBEEZ9_V1 // // ARM Cortex M7 diff --git a/Marlin/src/pins/stm32f4/pins_I3DBEEZ9.h b/Marlin/src/pins/stm32f4/pins_I3DBEEZ9.h new file mode 100644 index 0000000000000..a7ad18c8dccae --- /dev/null +++ b/Marlin/src/pins/stm32f4/pins_I3DBEEZ9.h @@ -0,0 +1,626 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 "env_validate.h" + +#if HOTENDS > 3 || E_STEPPERS > 3 + #error "I3DBEEZ9 supports up to 3 hotends / E-steppers." +#endif + +#define BOARD_INFO_NAME "3DBEE_Z9 V1.0" + +#define USES_DIAG_JUMPERS + +//#define MOTOR_EXPANSION + +#if BOTH(HAS_WIRED_LCD, 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 + +// Use one of these or SDCard-based Emulation will be used +#if NO_EEPROM_SELECTED + //#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation + #define FLASH_EEPROM_EMULATION // Use Flash-based EEPROM emulation +#endif + +#if ENABLED(FLASH_EEPROM_EMULATION) + // Decrease delays and flash wear by spreading writes across the + // 128 kB sector allocated for EEPROM emulation. + #define FLASH_EEPROM_LEVELING +#endif + +#define HAS_OTG_USB_HOST_SUPPORT // USB Flash Drive support + +// +// Servos +// +#define SERVO0_PIN PA1 +#define SERVO1_PIN PC9 + +// +// Trinamic Stallguard pins +// +#define X_DIAG_PIN PB10 // X- +#define Y_DIAG_PIN PE12 // Y- +#define Z_DIAG_PIN PG8 // Z- +#define E0_DIAG_PIN PE15 // E0 +#define E1_DIAG_PIN PE10 // E1 +#define E2_DIAG_PIN PG5 // E2 +#define E3_DIAG_PIN PD0 // E3 +#define E4_DIAG_PIN PD6 // E4 +#define E5_DIAG_PIN PD1 // E5 + +// +// Limit Switches +// +#ifdef X_STALL_SENSITIVITY + #define X_STOP_PIN X_DIAG_PIN + #if X_HOME_TO_MIN + #define X_MAX_PIN PE15 // E0 + #else + #define X_MIN_PIN PE15 // E0 + #endif +#else + #define X_MIN_PIN PB10 // X- + #define X_MAX_PIN PE15 // E0 +#endif + +#ifdef Y_STALL_SENSITIVITY + #define Y_STOP_PIN Y_DIAG_PIN + #if Y_HOME_TO_MIN + #define Y_MAX_PIN PE10 // E1 + #else + #define Y_MIN_PIN PE10 // E1 + #endif +#else + #define Y_MIN_PIN PE12 // Y- + #define Y_MAX_PIN PE10 // E1 +#endif + +#ifdef Z_STALL_SENSITIVITY + #define Z_STOP_PIN Z_DIAG_PIN + #if Z_HOME_TO_MIN + #define Z_MAX_PIN PG5 // E2 + #else + #define Z_MIN_PIN PG5 // E2 + #endif +#else + #define Z_MIN_PIN PG8 // Z- + #define Z_MAX_PIN PG5 // E2 +#endif + +#ifdef Z2_STALL_SENSITIVITY + #define Z2_STOP_PIN E1_DIAG_PIN + #if Z2_HOME_TO_MIN + #define Z2_MAX_PIN PD0 // E3 + #else + #define Z2_MIN_PIN PD0 // E3 + #endif +#else + #define Z2_MIN_PIN PD0 // Z2- [E3] + #define Z2_MAX_PIN PD6 // E4 +#endif + +// +// Z Probe must be this pin +// +#ifndef Z_MIN_PROBE_PIN + #define Z_MIN_PROBE_PIN PA2 +#endif + +// +// Filament Runout Sensor +// +#ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN PE15 +#endif +#ifndef FIL_RUNOUT2_PIN + #define FIL_RUNOUT2_PIN PE10 +#endif +#ifndef FIL_RUNOUT3_PIN + #define FIL_RUNOUT3_PIN PG5 +#endif +#ifndef FIL_RUNOUT4_PIN + #define FIL_RUNOUT4_PIN PD0 +#endif +#ifndef FIL_RUNOUT5_PIN + #define FIL_RUNOUT5_PIN PD6 +#endif +#ifndef FIL_RUNOUT6_PIN + #define FIL_RUNOUT6_PIN PD1 +#endif + +// +// Steppers +// +#define X_STEP_PIN PE9 +#define X_DIR_PIN PF1 +#define X_ENABLE_PIN PF2 +#ifndef X_CS_PIN + #define X_CS_PIN PA15 +#endif + +#define Y_STEP_PIN PE11 +#define Y_DIR_PIN PE1 +#define Y_ENABLE_PIN PD7 +#ifndef Y_CS_PIN + #define Y_CS_PIN PB8 +#endif + +#define Z_STEP_PIN PE13 +#define Z_DIR_PIN PC2 +#define Z_ENABLE_PIN PC0 +#ifndef Z_CS_PIN + #define Z_CS_PIN PB9 +#endif + +#define E0_STEP_PIN PE14 +#define E0_DIR_PIN PA0 +#define E0_ENABLE_PIN PC3 +#ifndef E0_CS_PIN + #define E0_CS_PIN PB3 +#endif + +#define E1_STEP_PIN PD15 +#define E1_DIR_PIN PE7 +#define E1_ENABLE_PIN PA3 +#ifndef E1_CS_PIN + #define E1_CS_PIN PG15 +#endif + +#define E2_STEP_PIN PD13 +#define E2_DIR_PIN PG9 +#define E2_ENABLE_PIN PF0 +#ifndef E2_CS_PIN + #define E2_CS_PIN PG12 +#endif + +#define E3_STEP_PIN PE4 +#define E3_DIR_PIN PE3 +#define E3_ENABLE_PIN PC13 +#ifndef E3_CS_PIN + #define E3_CS_PIN PE2 +#endif + +#define E4_STEP_PIN PG14 +#define E4_DIR_PIN PG13 +#define E4_ENABLE_PIN PE0 +#ifndef E4_CS_PIN + #define E4_CS_PIN PG11 +#endif + +#define E5_STEP_PIN PD4 +#define E5_DIR_PIN PD3 +#define E5_ENABLE_PIN PD5 +#ifndef E5_CS_PIN + #define E5_CS_PIN PD2 +#endif + +// +// SPI pins for TMC2130 stepper drivers +// +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PC12 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PC11 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PC10 +#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 + + #define X_SERIAL_TX_PIN PA15 + #define X_SERIAL_RX_PIN X_SERIAL_TX_PIN + + #define Y_SERIAL_TX_PIN PB8 + #define Y_SERIAL_RX_PIN Y_SERIAL_TX_PIN + + #define Z_SERIAL_TX_PIN PB9 + #define Z_SERIAL_RX_PIN Z_SERIAL_TX_PIN + + #define E0_SERIAL_TX_PIN PB3 + #define E0_SERIAL_RX_PIN E0_SERIAL_TX_PIN + + #define E1_SERIAL_TX_PIN PG15 + #define E1_SERIAL_RX_PIN E1_SERIAL_TX_PIN + + #define E2_SERIAL_TX_PIN PG12 + #define E2_SERIAL_RX_PIN E2_SERIAL_TX_PIN + + #define E3_SERIAL_TX_PIN PE2 + #define E3_SERIAL_RX_PIN E3_SERIAL_TX_PIN + + #define E4_SERIAL_TX_PIN PG11 + #define E4_SERIAL_RX_PIN E4_SERIAL_TX_PIN + + #define E5_SERIAL_TX_PIN PD2 + #define E5_SERIAL_RX_PIN E5_SERIAL_TX_PIN + + // Reduce baud rate to improve software serial reliability + #define TMC_BAUD_RATE 19200 +#endif + +// +// Temperature Sensors +// Use ADC pins without pullup for sensors that don't need a pullup. +// +#if TEMP_SENSOR_0_IS_AD8495 || TEMP_SENSOR_0 == 20 + #define TEMP_0_PIN PF8 +#else + #define TEMP_0_PIN PF4 // T1 <-> E0 +#endif +#if TEMP_SENSOR_1_IS_AD8495 || TEMP_SENSOR_1 == 20 + #define TEMP_1_PIN PF9 +#else + #define TEMP_1_PIN PF5 // T2 <-> E1 +#endif +#if TEMP_SENSOR_2_IS_AD8495 || TEMP_SENSOR_2 == 20 + #define TEMP_2_PIN PF10 +#else + #define TEMP_2_PIN PF6 // T3 <-> E2 +#endif +#if TEMP_SENSOR_BED_IS_AD8495 || TEMP_SENSOR_BED == 20 + #define TEMP_BED_PIN PF7 +#else + #define TEMP_BED_PIN PF3 // T0 <-> Bed +#endif + +#if TEMP_SENSOR_PROBE && !defined(TEMP_PROBE_PIN) + #if TEMP_SENSOR_PROBE_IS_AD8495 || TEMP_SENSOR_PROBE == 20 + #if HOTENDS == 2 + #define TEMP_PROBE_PIN PF10 + #elif HOTENDS < 2 + #define TEMP_PROBE_PIN PF9 + #endif + #else + #if HOTENDS == 2 + #define TEMP_PROBE_PIN TEMP_2_PIN + #elif HOTENDS < 2 + #define TEMP_PROBE_PIN TEMP_1_PIN + #endif + #endif +#endif + +#if TEMP_SENSOR_CHAMBER && !defined(TEMP_CHAMBER_PIN) + #if TEMP_SENSOR_CHAMBER_IS_AD8495 || TEMP_SENSOR_CHAMBER == 20 + #define TEMP_CHAMBER_PIN PF10 + #else + #define TEMP_CHAMBER_PIN TEMP_2_PIN + #endif +#endif + +// +// Heaters +// +#define HEATER_0_PIN PB1 // Heater0 +#define HEATER_1_PIN PD14 // Heater1 +#if TEMP_SENSOR_CHAMBER && HOTENDS < 3 + #define HEATER_CHAMBER_PIN PB0 // Heater2 +#else + #define HEATER_2_PIN PB0 // Heater2 +#endif +#define HEATER_BED_PIN PD12 // Hotbed + +// +// Fans +// +#define FAN0_PIN PC8 // Fan0 +#define FAN1_PIN PE5 // Fan1 + +#ifndef E0_AUTO_FAN_PIN + #define E0_AUTO_FAN_PIN FAN1_PIN +#endif + +#if !defined(CONTROLLER_FAN_PIN) && ENABLED(USE_CONTROLLER_FAN) && HOTENDS < 2 + #define CONTROLLER_FAN_PIN PE6 // Fan2 +#else + #define FAN2_PIN PE6 // Fan2 +#endif + +// +// Misc. Functions +// + +#ifndef SDCARD_CONNECTION + #define SDCARD_CONNECTION ONBOARD +#endif + +/** ------ ------ + * (BEEPER) PG4 | 1 2 | PA8 (BTN_ENC) (MISO) PB14 | 1 2 | PB13 (SCK) + * (LCD_EN) PD11 | 3 4 | PD10 (LCD_RS) (BTN_EN1) PG10 | 3 4 | PB12 (SD_SS) + * (LCD_D4) PG2 5 6 | PG3 (LCD_D5) (BTN_EN2) PF11 5 6 | PB15 (MOSI) + * (LCD_D6) PG6 | 7 8 | PG7 (LCD_D7) (SD_DETECT) PF12 | 7 8 | RESET + * GND | 9 10 | 5V GND | 9 10 | -- + * ------ ------ + * EXP1 EXP2 + */ +#define EXP1_01_PIN PG4 +#define EXP1_02_PIN PA8 +#define EXP1_03_PIN PD11 +#define EXP1_04_PIN PD10 +#define EXP1_05_PIN PG2 +#define EXP1_06_PIN PG3 +#define EXP1_07_PIN PG6 +#define EXP1_08_PIN PG7 + +#define EXP2_01_PIN PB14 +#define EXP2_02_PIN PB13 +#define EXP2_03_PIN PG10 +#define EXP2_04_PIN PB12 +#define EXP2_05_PIN PF11 +#define EXP2_06_PIN PB15 +#define EXP2_07_PIN PF12 +#define EXP2_08_PIN -1 + +// +// 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 SD_DETECT_PIN EXP2_07_PIN + #define SDSS EXP2_04_PIN + +#elif SD_CONNECTION_IS(ONBOARD) + + // The I3DBEEZ9's ONBOARD SD interface is on SPI1. + // Due to a pull resistor on the clock line, it needs to use SPI Data Mode 3 to + // function with Hardware SPI. This is not currently configurable in the HAL, + // so force Software SPI to work around this issue. + #define SOFTWARE_SPI + #define SDSS PA4 + #define SD_SCK_PIN PA5 + #define SD_MISO_PIN PA6 + #define SD_MOSI_PIN PB5 + #define SD_DETECT_PIN PB11 + +#elif SD_CONNECTION_IS(CUSTOM_CABLE) + #error "CUSTOM_CABLE is not a supported SDCARD_CONNECTION for this board" +#endif + +#if ENABLED(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 E6_STEP_PIN EXP2_06_PIN + #define E6_DIR_PIN EXP2_05_PIN + #define E6_ENABLE_PIN EXP2_07_PIN + #if !EXP_MOT_USE_EXP2_ONLY + #define E6_DIAG_PIN EXP1_05_PIN + #define E6_CS_PIN EXP1_06_PIN + #if HAS_TMC_UART + #define E6_SERIAL_TX_PIN EXP1_06_PIN + #define E6_SERIAL_RX_PIN EXP1_06_PIN + #endif + #endif + + // M2 on Driver Expansion Module + #define E7_STEP_PIN EXP2_03_PIN + #define E7_DIR_PIN EXP2_04_PIN + #if !EXP_MOT_USE_EXP2_ONLY + #define E7_ENABLE_PIN EXP1_08_PIN + #define E7_DIAG_PIN EXP1_03_PIN + #define E7_CS_PIN EXP1_04_PIN + #if HAS_TMC_UART + #define E7_SERIAL_TX_PIN EXP1_04_PIN + #define E7_SERIAL_RX_PIN EXP1_04_PIN + #endif + #else + #define E7_ENABLE_PIN EXP2_07_PIN + #endif + + // M3 on Driver Expansion Module + #define E8_STEP_PIN EXP2_01_PIN + #define E8_DIR_PIN EXP2_02_PIN + #if !EXP_MOT_USE_EXP2_ONLY + #define E8_ENABLE_PIN EXP1_07_PIN + #define E8_DIAG_PIN EXP1_01_PIN + #define E8_CS_PIN EXP1_02_PIN + #if HAS_TMC_UART + #define E8_SERIAL_TX_PIN EXP1_02_PIN + #define E8_SERIAL_RX_PIN EXP1_02_PIN + #endif + #else + #define E8_ENABLE_PIN EXP2_07_PIN + #endif + +#endif + +// +// LCDs and Controllers +// +#if IS_TFTGLCD_PANEL + + #if ENABLED(TFTGLCD_PANEL_SPI) + #define TFTGLCD_CS EXP2_03_PIN + #endif + +#elif HAS_WIRED_LCD + + #define BEEPER_PIN EXP1_01_PIN + #define BTN_ENC EXP1_02_PIN + + #if ENABLED(CR10_STOCKDISPLAY) + + #define LCD_PINS_RS EXP1_07_PIN + + #define BTN_EN1 EXP1_03_PIN + #define BTN_EN2 EXP1_05_PIN + + #define LCD_PINS_EN EXP1_08_PIN + #define LCD_PINS_D4 EXP1_06_PIN + + #elif ENABLED(MKS_MINI_12864) + + #define DOGLCD_A0 EXP1_07_PIN + #define DOGLCD_CS EXP1_06_PIN + #define BTN_EN1 EXP2_03_PIN + #define BTN_EN2 EXP2_05_PIN + + #elif ENABLED(WYH_L12864) + + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! WYH_L12864 requires wiring modifications. See 'pins_I3DBEEZ9.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. + * 2. Swap the LCD's +5V (Pin2) and GND (Pin1) wires. + * + * !!! If you are unsure, ask for help! Your motherboard may be damaged in some circumstances !!! + * + * The WYH_L12864 connector plug: + * + * BEFORE AFTER + * ------ ------ + * -- | 1 2 | MOSI -- | 1 2 | MOSI + * BTN_ENC | 3 4 | SCK BTN_ENC | 3 4 | SCK + * BTN_EN1 | 5 6 SID BTN_EN1 | 5 6 SID + * BTN_EN2 | 7 8 | CS BTN_EN2 | 7 8 | CS + * 5V | 9 10 | GND GND | 9 10 | 5V + * ------ ------ + * LCD LCD + */ + #undef BEEPER_PIN + #undef BTN_ENC + #define BTN_EN1 EXP1_05_PIN + #define BTN_EN2 EXP1_07_PIN + #define BTN_ENC EXP1_03_PIN + #define DOGLCD_CS EXP1_08_PIN + #define DOGLCD_A0 EXP1_06_PIN + #define DOGLCD_SCK EXP1_04_PIN + #define DOGLCD_MOSI EXP1_02_PIN + #define LCD_BACKLIGHT_PIN -1 + + #else + + #define LCD_PINS_RS EXP1_04_PIN + + #define BTN_EN1 EXP2_03_PIN + #define BTN_EN2 EXP2_05_PIN + + #define LCD_PINS_EN EXP1_03_PIN + #define LCD_PINS_D4 EXP1_05_PIN + + #if ENABLED(FYSETC_MINI_12864) + #define DOGLCD_CS EXP1_03_PIN + #define DOGLCD_A0 EXP1_04_PIN + //#define LCD_BACKLIGHT_PIN -1 + #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 EXP1_06_PIN + #endif + #ifndef RGB_LED_G_PIN + #define RGB_LED_G_PIN EXP1_07_PIN + #endif + #ifndef RGB_LED_B_PIN + #define RGB_LED_B_PIN EXP1_08_PIN + #endif + #elif ENABLED(FYSETC_MINI_12864_2_1) + #define NEOPIXEL_PIN EXP1_06_PIN + #endif + #endif // !FYSETC_MINI_12864 + + #if IS_ULTIPANEL + #define LCD_PINS_D5 EXP1_06_PIN + #define LCD_PINS_D6 EXP1_07_PIN + #define LCD_PINS_D7 EXP1_08_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 125 + #endif + #ifndef BOARD_ST7920_DELAY_2 + #define BOARD_ST7920_DELAY_2 90 + #endif + #ifndef BOARD_ST7920_DELAY_3 + #define BOARD_ST7920_DELAY_3 600 + #endif +#endif + +#if ENABLED(WIFISUPPORT) + // + // WIFI + // + + /** + * ------ + * RX | 8 7 | 3.3V GPIO0 PF14 ... Leave as unused (ESP3D software configures this with a pullup so OK to leave as floating) + * GPIO0 | 6 5 | Reset GPIO2 PF15 ... must be high (ESP3D software configures this with a pullup so OK to leave as floating) + * GPIO2 | 4 3 | Enable Reset PG0 ... active low, probably OK to leave floating + * GND | 2 1 | TX Enable PG1 ... Must be high for module to run + * ------ + * W1 + */ + #define ESP_WIFI_MODULE_COM 6 // 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 PG0 + #define ESP_WIFI_MODULE_ENABLE_PIN PG1 + #define ESP_WIFI_MODULE_GPIO0_PIN PF14 + #define ESP_WIFI_MODULE_GPIO2_PIN PF15 +#endif diff --git a/buildroot/share/PlatformIO/boards/marlin_I3DBEEZ9.json b/buildroot/share/PlatformIO/boards/marlin_I3DBEEZ9.json new file mode 100644 index 0000000000000..0f0927d28ea26 --- /dev/null +++ b/buildroot/share/PlatformIO/boards/marlin_I3DBEEZ9.json @@ -0,0 +1,46 @@ +{ + "build": { + "core": "stm32", + "cpu": "cortex-m4", + "extra_flags": "-DSTM32F4 -DSTM32F407xx -DSTM32F40_41xxx", + "f_cpu": "168000000L", + "hwids": [ + [ + "0x1EAF", + "0x0003" + ], + [ + "0x0483", + "0x3748" + ] + ], + "mcu": "stm32f407zgt6", + "variant": "MARLIN_I3DBEEZ9" + }, + "debug": { + "jlink_device": "STM32F407ZG", + "openocd_target": "stm32f4x", + "svd_path": "STM32F40x.svd" + }, + "frameworks": [ + "arduino" + ], + "name": "STM32F407ZG (192k RAM. 1024k Flash)", + "upload": { + "disable_flushing": false, + "maximum_ram_size": 196608, + "maximum_size": 1048576, + "protocol": "stlink", + "protocols": [ + "stlink", + "dfu", + "jlink" + ], + "offset_address": "0x8008000", + "require_upload_port": true, + "use_1200bps_touch": false, + "wait_for_upload_port": false + }, + "url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f407zg.html", + "vendor": "Generic" +} diff --git a/buildroot/share/PlatformIO/variants/MARLIN_I3DBEEZ9/PeripheralPins.c b/buildroot/share/PlatformIO/variants/MARLIN_I3DBEEZ9/PeripheralPins.c new file mode 100644 index 0000000000000..4ea275d4cf7e0 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_I3DBEEZ9/PeripheralPins.c @@ -0,0 +1,370 @@ +/* + ******************************************************************************* + * 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 STM32F407Z(E-G)Tx.xml + */ +#include +#include + +/* ===== + * Note: Commented lines are alternative possibilities which are not used by default. + * If you change them, you should know what you're doing first. + * ===== + */ + +//*** ADC *** + +#ifdef HAL_ADC_MODULE_ENABLED +const PinMap PinMap_ADC[] = { + {PA_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC1_IN0 E0_DIR + {PA_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC1_IN1 BLTOUCH_2 + {PA_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_IN2 BLTOUCH_4 + {PA_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_IN3 E1_EN + {PA_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_IN4 TF_SS + {PA_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC1_IN5 TF_SCLK + {PA_6, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC1_IN6 TF_MISO + {PA_7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC1_IN7 LED + {PB_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_IN8 HEATER2 + {PB_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_IN9 HEATER0 + {PC_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_IN10 Z_EN + {PC_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC1_IN11 EXP_14 + {PC_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC1_IN12 Z_DIR + {PC_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC1_IN13 E0_EN + {PC_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC1_IN14 EXP_8 + {PC_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC1_IN15 EXP_7 + + #if STM32F4X_PIN_NUM >= 144 //144 pins mcu, 114 gpio, 24 ADC + {PF_3, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC3_IN9 TH_0 + {PF_4, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC3_IN14 TH_1 + {PF_5, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC3_IN15 TH_2 + {PF_6, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC3_IN4 TH_3 + {PF_7, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC3_IN5 EXP_13 + {PF_8, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC3_IN6 EXP_3 + {PF_9, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC3_IN7 EXP_6 + {PF_10, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC3_IN8 EXP_5 + #endif + {NC, NP, 0} +}; +#endif + +//*** DAC *** + +#ifdef HAL_DAC_MODULE_ENABLED +const PinMap PinMap_DAC[] = { + {PA_4, DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // DAC_OUT1 + {PA_5, DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // DAC_OUT2 + {NC, NP, 0} +}; +#endif + +//*** I2C *** + +#ifdef HAL_I2C_MODULE_ENABLED +const PinMap PinMap_I2C_SDA[] = { + {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)}, + {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)}, + #if STM32F4X_PIN_NUM >= 144 // 144 pins mcu, 114 gpio + #if STM32F4X_PIN_NUM >= 176 + {PH_5, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + {PH_8, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, + #else + {PF_0, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + #endif + #endif + {NC, NP, 0} +}; + +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)}, + #if STM32F4X_PIN_NUM >= 144 // 144 pins mcu, 114 gpio + #if STM32F4X_PIN_NUM >= 176 + //{PF_1, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + {PH_4, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + {PH_7, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, + #else + {PF_1, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + #endif + #endif + {NC, NP, 0} +}; +#endif + +//*** PWM *** + +#ifdef HAL_TIM_MODULE_ENABLED +const PinMap PinMap_PWM[] = { + {PB_1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 HEATER0 + {PD_14, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3 HEATER1 + {PB_0, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 HEATER2 + {PD_12, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1 BED + {PC_8, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 0)}, // TIM8_CH3 FAN0 + {PE_5, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 1, 0)}, // TIM9_CH1 FAN1 + {PE_6, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 2, 0)}, // TIM9_CH2 FAN2 + {PC_9, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 4, 0)}, // TIM8_CH4 EXTENSION1-4 + {PA_1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)}, // TIM5_CH2 BL-TOUCH-SERVO + + // These pins have been defined for something else on the board but they MIGHT be + // used by the user as PWM pins if they aren't used for their primary purpose. + {PC_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 ESP8266 connector. Available if 8266 isn't used + {PC_7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 ESP8266 connector. Available if 8266 isn't used + {PB_7, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2 I2C connector, SDA pin. Available if I2C isn't used. + // TIM5_CH1 is used by the Servo Library + {PA_2, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 3, 0)}, // TIM5_CH3 BL-TOUCH port. Available if Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN + + /** + * Unused by specifications on SKR-Pro. + * Uncomment the corresponding line if you want to have HardwarePWM on some pins. + * WARNING: check timers' usage first to avoid conflicts. + * If you don't know what you're doing leave things as they are or you WILL break something (including hardware) + * If you alter this section DO NOT report bugs to Marlin team since they are most likely caused by you. Thank you. + */ + //{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 BLTOUCH is a "servo" + //{PA_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 BLTOUCH is a "servo" + //{PA_1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)}, // TIM5_CH2 + //{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_5, 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, 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, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + //{PA_7, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 1)}, // TIM8_CH1N + //{PA_7, 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, 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, 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_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_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, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)}, // TIM8_CH2N + //{PB_14, TIM12, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_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, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 1)}, // TIM8_CH3N + //{PB_15, TIM12, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM12, 2, 0)}, // TIM12_CH2 + //{PC_6, 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, 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_9, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 + //{PD_13, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2 + //{PD_15, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4 + //{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 + #if STM32F4X_PIN_NUM >= 144 //144 pins mcu, 114 gpio + //{PF_6, TIM10, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM10, 1, 0)}, // TIM10_CH1 + //{PF_7, TIM11, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM11, 1, 0)}, // TIM11_CH1 + //{PF_8, TIM13, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM13, 1, 0)}, // TIM13_CH1 + //{PF_9, TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM14, 1, 0)}, // TIM14_CH1 + #endif + #if STM32F4X_PIN_NUM >= 176 //176 pins mcu, 140 gpio + {PH_10, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 1, 0)}, // TIM5_CH1 + {PH_6, TIM12, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM12, 1, 0)}, // TIM12_CH1 + //{PH_11, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)}, // TIM5_CH2 + {PI_5, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 0)}, // TIM8_CH1 + {PI_6, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 0)}, // TIM8_CH2 + #endif + {NC, NP, 0} +}; +#endif + +//*** SERIAL *** + +#ifdef HAL_UART_MODULE_ENABLED +const PinMap PinMap_UART_TX[] = { + {PA_9, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PD_8, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PC_6, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + #if STM32F4X_PIN_NUM >= 144 //144 pins mcu, 114 gpio + //{PG_14, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + #endif + //{PB_6, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + //{PA_2, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + //{PD_5, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + //{PB_10, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + //{PC_10, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + //{PA_0, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + //{PC_10, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + //{PC_12, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)}, + {NC, NP, 0} +}; + +const PinMap PinMap_UART_RX[] = { + {PA_10, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PD_9, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PC_7, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + //{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)}, + //{PB_7, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + //{PB_11, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + //{PC_11, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + //{PC_11, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + //{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)}, + #if STM32F4X_PIN_NUM >= 144 //144 pins mcu, 114 gpio + //{PG_9, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + #endif + {NC, NP, 0} +}; + +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)}, + //{PB_14, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + //{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)}, + #if STM32F4X_PIN_NUM >= 144 //144 pins mcu, 114 gpio + //{PG_8, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + //{PG_12, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + #endif + {NC, NP, 0} +}; + +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)}, + //{PB_13, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + //{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)}, + #if STM32F4X_PIN_NUM >= 144 //144 pins mcu, 114 gpio + //{PG_13, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + //{PG_15, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + #endif + {NC, NP, 0} +}; +#endif + +//*** SPI *** + +#ifdef HAL_SPI_MODULE_ENABLED +const PinMap PinMap_SPI_MOSI[] = { + {PB_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_SPI1)}, + {PB_15, 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} +}; + +const PinMap PinMap_SPI_MISO[] = { + {PA_6, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_SPI1)}, + {PB_14, 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} +}; + +const PinMap PinMap_SPI_SCLK[] = { + {PA_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_SPI1)}, + {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} +}; + +const PinMap PinMap_SPI_SSEL[] = { + {PA_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_SPI1)}, + {PB_12, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PA_15, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {NC, NP, 0} +}; +#endif + +//*** CAN *** + +#ifdef HAL_CAN_MODULE_ENABLED +#error "CAN bus isn't available on this board. Driver should be disabled." +#endif + +//*** ETHERNET *** +#ifdef HAL_ETH_MODULE_ENABLED +#error "Ethernet port isn't available on this board. Driver should be disabled." +#endif + +//*** No QUADSPI *** + +//*** USB *** +#ifdef HAL_PCD_MODULE_ENABLED +const PinMap PinMap_USB_OTG_FS[] = { + //{PA_8, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_SOF used by LCD + //{PA_9, USB_OTG_FS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, GPIO_AF_NONE)}, // USB_OTG_FS_VBUS available on wifi port, if empty + //{PA_10, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_ID available on UART1_RX if not used + {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} +}; + +const PinMap PinMap_USB_OTG_HS[] = { /* + #ifdef USE_USB_HS_IN_FS + {PB_12, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF12_OTG_HS_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_OTG_HS_FS)}, // USB_OTG_HS_DM + {PB_15, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_OTG_HS_FS)}, // USB_OTG_HS_DP + #else + #error "USB in HS mode isn't supported by the board" + {PA_3, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D0 + {PB_0, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D1 + {PB_1, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D2 + {PB_5, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D7 + {PB_10, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D3 + {PB_12, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D5 + {PB_13, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D6 + {PC_0, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_STP + {PC_2, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_DIR + {PC_3, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_NXT + #endif // USE_USB_HS_IN_FS + */ + {NC, NP, 0} +}; +#endif diff --git a/buildroot/share/PlatformIO/variants/MARLIN_I3DBEEZ9/PinNamesVar.h b/buildroot/share/PlatformIO/variants/MARLIN_I3DBEEZ9/PinNamesVar.h new file mode 100644 index 0000000000000..b4bb9d45f8ac5 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_I3DBEEZ9/PinNamesVar.h @@ -0,0 +1,50 @@ +/* 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, + USB_OTG_HS_ULPI_D0 = PA_3, + USB_OTG_HS_SOF = PA_4, + USB_OTG_HS_ULPI_CK = PA_5, + USB_OTG_HS_ULPI_D1 = PB_0, + USB_OTG_HS_ULPI_D2 = PB_1, + USB_OTG_HS_ULPI_D7 = PB_5, + USB_OTG_HS_ULPI_D3 = PB_10, + USB_OTG_HS_ULPI_D4 = PB_11, + USB_OTG_HS_ID = PB_12, + USB_OTG_HS_ULPI_D5 = PB_12, + USB_OTG_HS_ULPI_D6 = PB_13, + USB_OTG_HS_VBUS = PB_13, + USB_OTG_HS_DM = PB_14, + USB_OTG_HS_DP = PB_15, + USB_OTG_HS_ULPI_STP = PC_0, + USB_OTG_HS_ULPI_DIR = PC_2, + USB_OTG_HS_ULPI_NXT = PC_3, +#endif diff --git a/buildroot/share/PlatformIO/variants/MARLIN_I3DBEEZ9/hal_conf_extra.h b/buildroot/share/PlatformIO/variants/MARLIN_I3DBEEZ9/hal_conf_extra.h new file mode 100644 index 0000000000000..ef621d57bf29c --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_I3DBEEZ9/hal_conf_extra.h @@ -0,0 +1,52 @@ +#pragma once + +#define HAL_MODULE_ENABLED +#define HAL_ADC_MODULE_ENABLED +#define HAL_CRC_MODULE_ENABLED +#define HAL_DMA_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED // Needed for Endstop (and other external) Interrupts +#define HAL_GPIO_MODULE_ENABLED +#define HAL_I2C_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED +#define HAL_RCC_MODULE_ENABLED +//#define HAL_RTC_MODULE_ENABLED // Real Time Clock...do we use it? +#define HAL_SPI_MODULE_ENABLED +#define HAL_TIM_MODULE_ENABLED +#define HAL_USART_MODULE_ENABLED +#define HAL_CORTEX_MODULE_ENABLED +//#define HAL_UART_MODULE_ENABLED // by default +//#define HAL_PCD_MODULE_ENABLED // Automatically added if any type of USB is enabled, as in Arduino IDE. (STM32 v3.10700.191028) + +//#define HAL_SD_MODULE_ENABLED +//#define HAL_DAC_MODULE_ENABLED +//#define HAL_FLASH_MODULE_ENABLED +//#define HAL_CAN_MODULE_ENABLED +//#define HAL_CAN_LEGACY_MODULE_ENABLED +//#define HAL_CEC_MODULE_ENABLED +//#define HAL_CRYP_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_SMBUS_MODULE_ENABLED +//#define HAL_I2S_MODULE_ENABLED +//#define HAL_IWDG_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_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 diff --git a/buildroot/share/PlatformIO/variants/MARLIN_I3DBEEZ9/ldscript.ld b/buildroot/share/PlatformIO/variants/MARLIN_I3DBEEZ9/ldscript.ld new file mode 100644 index 0000000000000..f7e09b8ef0e73 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_I3DBEEZ9/ldscript.ld @@ -0,0 +1,204 @@ +/* +***************************************************************************** +** + +** File : LinkerScript.ld +** +** Abstract : Linker script for STM32F407ZGTx Device with +** 1024KByte FLASH, 128KByte 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 = 0x20020000; /* 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 = 0x8008000, LENGTH = 1024K +RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K +CCMRAM (rw) : ORIGIN = 0x10000000, 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): + { + . = 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 + + _siccmram = LOADADDR(.ccmram); + + /* CCM-RAM section + * + * IMPORTANT NOTE! + * If initialized variables will be placed in this section, + * the startup code needs to be modified to copy the init-values. + */ + .ccmram : + { + . = ALIGN(4); + _sccmram = .; /* create a global symbol at ccmram start */ + *(.ccmram) + *(.ccmram*) + + . = ALIGN(4); + _eccmram = .; /* create a global symbol at ccmram end */ + } >CCMRAM AT> FLASH + + + /* Uninitialized data section */ + . = 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 + + /* User_heap_stack section, used to check that there is enough RAM left */ + ._user_heap_stack : + { + . = ALIGN(4); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(4); + } >RAM + + /* Remove information from the standard libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } +} diff --git a/buildroot/share/PlatformIO/variants/MARLIN_I3DBEEZ9/variant.cpp b/buildroot/share/PlatformIO/variants/MARLIN_I3DBEEZ9/variant.cpp new file mode 100644 index 0000000000000..1486b21830a17 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_I3DBEEZ9/variant.cpp @@ -0,0 +1,260 @@ +/* + ******************************************************************************* + * Copyright (c) 2017, 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. + ******************************************************************************* + */ + +#include "pins_arduino.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Pin number +// This array allows to wrap Arduino pin number(Dx or x) +// to STM32 PinName (PX_n) +const PinName digitalPin[] = { +#if STM32F4X_PIN_NUM >= 64 //64 pins mcu, 51 gpio + PC_13, //D0 + PC_14, //D1 - OSC32_IN + PC_15, //D2 - OSC32_OUT + PH_0, //D3 - OSC_IN + PH_1, //D4 - OSC_OUT + PB_2, //D5 - BOOT1 + PB_10, //D6 - 1:SPI2_SCK / I2C2_SCL / USART3_TX / TIM2_CH3 + PB_11, //D7 - 1:I2C2_SDA / USART3_RX / TIM2_CH4 + PB_12, //D8 - 1:SPI2_NSS / OTG_HS_ID + PB_13, //D9 - 1:SPI2_SCK 2:OTG_HS_VBUS + PB_14, //D10 - 1:SPI2_MISO / TIM12_CH1 / OTG_HS_DM + PB_15, //D11 - SPI2_MOSI / TIM12_CH2 / OTG_HS_DP + PC_6, //D12 - 1:TIM8_CH1 / SDIO_D6 / USART6_TX / TIM3_CH1 + PC_7, //D13 - 1:TIM8_CH2 / SDIO_D7 / USART6_RX / TIM3_CH2 + PC_8, //D14 - 1:TIM8_CH3 / SDIO_D0 / TIM3_CH3 + PC_9, //D15 - 1:TIM8_CH4 / SDIO_D1 / TIM3_CH4 + PA_8, //D16 - 1:TIM1_CH1 / I2C3_SCL / OTG_FS_SOF + PA_9, //D17 - 1:USART1_TX / TIM1_CH2 2:OTG_FS_VBUS + PA_10, //D18 - 1:USART1_RX / TIM1_CH3 / OTG_FS_ID + PA_11, //D19 - 1:TIM1_CH4 / OTG_FS_DM + PA_12, //D20 - 1:OTG_FS_DP + PA_13, //D21 - 0:JTMS-SWDIO + PA_14, //D22 - 0:JTCK-SWCLK + PA_15, //D23 - 0:JTDI 1:SPI3_NSS / SPI1_NSS + PC_10, //D24 - 1:UART4_TX / SPI3_SCK / SDIO_D2 / USART3_TX + PC_11, //D25 - 1:UART4_RX / SPI3_MISO / SDIO_D3 / USART3_RX + PC_12, //D26 - 1:UART5_TX / SPI3_MOSI / SDIO_CK + PD_2, //D27 - 1:UART5_RX / SDIO_CMD + PB_3, //D28 - 0:JTDO 1:SPI3_SCK / TIM2_CH2 / SPI1_SCK + PB_4, //D29 - 0:NJTRST 1:SPI3_MISO / TIM3_CH1 / SPI1_MISO + PB_5, //D30 - 1:TIM3_CH2 / SPI1_MOSI / SPI3_MOSI + PB_6, //D31 - 1:I2C1_SCL / TIM4_CH1 / USART1_TX + PB_7, //D32 - 1:I2C1_SDA / TIM4_CH2 / USART1_RX + PB_8, //D33 - 1:I2C1_SCL / TIM4_CH3 / SDIO_D4 / TIM10_CH1 + PB_9, //D34 - 1:I2C1_SDA / TIM4_CH4 / SDIO_D5 / TIM11_CH1 / SPI2_NSS + PA_0, //D35/A0 - 1:UART4_TX / TIM5_CH1 2:ADC123_IN0 + PA_1, //D36/A1 - 1:UART4_RX / TIM5_CH2 / TIM2_CH2 2:ADC123_IN1 + PA_2, //D37/A2 - 1:USART2_TX /TIM5_CH3 / TIM9_CH1 / TIM2_CH3 2:ADC123_IN2 + PA_3, //D38/A3 - 1:USART2_RX /TIM5_CH4 / TIM9_CH2 / TIM2_CH4 2:ADC123_IN3 + PA_4, //D39/A4 - NOT FT 1:SPI1_NSS / SPI3_NSS / USART2_CK 2:ADC12_IN4 / DAC_OUT1 + PA_5, //D40/A5 - NOT FT 1:SPI1_SCK 2:ADC12_IN5 / DAC_OUT2 + PA_6, //D41/A6 - 1:SPI1_MISO / TIM13_CH1 / TIM3_CH1 2:ADC12_IN6 + PA_7, //D42/A7 - 1:SPI1_MOSI / TIM14_CH1 / TIM3_CH2 2:ADC12_IN7 + PB_0, //D43/A8 - 1:TIM3_CH3 2:ADC12_IN8 + PB_1, //D44/A9 - 1:TIM3_CH4 2:ADC12_IN9 + PC_0, //D45/A10 - 1: 2:ADC123_IN10 + PC_1, //D46/A11 - 1: 2:ADC123_IN11 + PC_2, //D47/A12 - 1:SPI2_MISO 2:ADC123_IN12 + PC_3, //D48/A13 - 1:SPI2_MOSI 2:ADC123_IN13 + PC_4, //D49/A14 - 1: 2:ADC12_IN14 + PC_5, //D50/A15 - 1: 2:ADC12_IN15 + #if STM32F4X_PIN_NUM >= 144 + PF_3, //D51/A16 - 1:FSMC_A3 2:ADC3_IN9 + PF_4, //D52/A17 - 1:FSMC_A4 2:ADC3_IN14 + PF_5, //D53/A18 - 1:FSMC_A5 2:ADC3_IN15 + PF_6, //D54/A19 - 1:TIM10_CH1 2:ADC3_IN4 + PF_7, //D55/A20 - 1:TIM11_CH1 2:ADC3_IN5 + PF_8, //D56/A21 - 1:TIM13_CH1 2:ADC3_IN6 + PF_9, //D57/A22 - 1;TIM14_CH1 2:ADC3_IN7 + PF_10, //D58/A23 - 2:ADC3_IN8 + #endif +#endif +#if STM32F4X_PIN_NUM >= 100 //100 pins mcu, 82 gpio + PE_2, //D59 - 1:FSMC_A23 + PE_3, //D60 - 1:FSMC_A19 + PE_4, //D61 - 1:FSMC_A20 + PE_5, //D62 - 1:FSMC_A21 + PE_6, //D63 - 1:FSMC_A22 + PE_7, //D64 - 1:FSMC_D4 + PE_8, //D65 - 1:FSMC_D5 + PE_9, //D66 - 1:FSMC_D6 / TIM1_CH1 + PE_10, //D67 - 1:FSMC_D7 + PE_11, //D68 - 1:FSMC_D8 / TIM1_CH2 + PE_12, //D69 - 1:FSMC_D9 + PE_13, //D70 - 1:FSMC_D10 / TIM1_CH3 + PE_14, //D71 - 1:FSMC_D11 / TIM1_CH4 + PE_15, //D72 - 1:FSMC_D12 + PD_8, //D73 - 1:FSMC_D13 / USART3_TX + PD_9, //D74 - 1:FSMC_D14 / USART3_RX + PD_10, //D75 - 1:FSMC_D15 + PD_11, //D76 - 1:FSMC_A16 + PD_12, //D77 - 1:FSMC_A17 / TIM4_CH1 + PD_13, //D78 - 1:FSMC_A18 / TIM4_CH2 + PD_14, //D79 - 1:FSMC_D0 / TIM4_CH3 + PD_15, //D80 - 1:FSMC_D1 / TIM4_CH4 + PD_0, //D81 - 1:FSMC_D2 + PD_1, //D82 - 1:FSMC_D3 + PD_3, //D83 - 1:FSMC_CLK + PD_4, //D84 - 1:FSMC_NOE + PD_5, //D85 - 1:USART2_TX + PD_6, //D86 - 1:USART2_RX + PD_7, //D87 + PE_0, //D88 + PE_1, //D89 +#endif +#if STM32F4X_PIN_NUM >= 144 //144 pins mcu, 114 gpio + PF_0, //D90 - 1:FSMC_A0 / I2C2_SDA + PF_1, //D91 - 1:FSMC_A1 / I2C2_SCL + PF_2, //D92 - 1:FSMC_A2 + PF_11, //D93 + PF_12, //D94 - 1:FSMC_A6 + PF_13, //D95 - 1:FSMC_A7 + PF_14, //D96 - 1:FSMC_A8 + PF_15, //D97 - 1:FSMC_A9 + PG_0, //D98 - 1:FSMC_A10 + PG_1, //D99 - 1:FSMC_A11 + PG_2, //D100 - 1:FSMC_A12 + PG_3, //D101 - 1:FSMC_A13 + PG_4, //D102 - 1:FSMC_A14 + PG_5, //D103 - 1:FSMC_A15 + PG_6, //D104 + PG_7, //D105 + PG_8, //D106 + PG_9, //D107 - 1:USART6_RX + PG_10, //D108 - 1:FSMC_NE3 + PG_11, //D109 + PG_12, //D110 - 1:FSMC_NE4 + PG_13, //D111 - 1:FSMC_A24 + PG_14, //D112 - 1:FSMC_A25 / USART6_TX + PG_15, //D113 +#endif +#if STM32F4X_PIN_NUM >= 176 //176 pins mcu, 140 gpio + PI_8, //D114 + PI_9, //D115 + PI_10, //D116 + PI_11, //D117 + PH_2, //D118 + PH_3, //D119 + PH_4, //D120 - 1:I2C2_SCL + PH_5, //D121 - 1:I2C2_SDA + PH_6, //D122 - 1:TIM12_CH1 + PH_7, //D123 - 1:I2C3_SCL + PH_8, //D124 - 1:I2C3_SDA + PH_9, //D125 - 1:TIM12_CH2 + PH_10, //D126 - 1:TIM5_CH1 + PH_11, //D127 - 1:TIM5_CH2 + PH_12, //D128 - 1:TIM5_CH3 + PH_13, //D129 + PH_14, //D130 + PH_15, //D131 + PI_0, //D132 - 1:TIM5_CH4 / SPI2_NSS + PI_1, //D133 - 1:SPI2_SCK + PI_2, //D134 - 1:TIM8_CH4 /SPI2_MISO + PI_3, //D135 - 1:SPI2_MOS + PI_4, //D136 + PI_5, //D137 - 1:TIM8_CH1 + PI_6, //D138 - 1:TIM8_CH2 + PI_7, //D139 - 1:TIM8_CH3 +#endif +}; + +#ifdef __cplusplus +} +#endif + +// ------------------------ + +#ifdef __cplusplus +extern "C" { +#endif + + /** + * @brief System Clock Configuration + * @param None + * @retval None + */ +WEAK void SystemClock_Config() { + + RCC_OscInitTypeDef RCC_OscInitStruct; + RCC_ClkInitTypeDef RCC_ClkInitStruct; + + /**Configure the main internal regulator output voltage + */ + __HAL_RCC_PWR_CLK_ENABLE(); + + __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); + + /**Initializes the CPU, AHB and APB busses clocks + */ + 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 = 8; + RCC_OscInitStruct.PLL.PLLN = 336; + RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; + RCC_OscInitStruct.PLL.PLLQ = 7; + if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { + _Error_Handler(__FILE__, __LINE__); + } + + /**Initializes the CPU, AHB and APB busses clocks + */ + RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK + | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2; + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; + RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; + RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4; + RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2; + + if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) { + _Error_Handler(__FILE__, __LINE__); + } + + /**Configure the Systick interrupt time + */ + HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000); + + /**Configure the Systick + */ + HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK); + + /* SysTick_IRQn interrupt configuration */ + HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0); +} + +#ifdef __cplusplus +} +#endif diff --git a/buildroot/share/PlatformIO/variants/MARLIN_I3DBEEZ9/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_I3DBEEZ9/variant.h new file mode 100644 index 0000000000000..cdb0dc2677c4f --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_I3DBEEZ9/variant.h @@ -0,0 +1,323 @@ +/* + ******************************************************************************* + * Copyright (c) 2017, 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. + ******************************************************************************* + */ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +/*---------------------------------------------------------------------------- + * Pins + *----------------------------------------------------------------------------*/ + +#ifdef STM32F405RX + #define STM32F4X_PIN_NUM 64 //64 pins mcu, 51 gpio + #define STM32F4X_GPIO_NUM 51 + #define STM32F4X_ADC_NUM 16 +#elif defined(STM32F407_5VX) + #define STM32F4X_PIN_NUM 100 //100 pins mcu, 82 gpio + #define STM32F4X_GPIO_NUM 82 + #define STM32F4X_ADC_NUM 16 +#elif defined(STM32F407_5ZX) + #define STM32F4X_PIN_NUM 144 //144 pins mcu, 114 gpio + #define STM32F4X_GPIO_NUM 114 + #define STM32F4X_ADC_NUM 24 +#elif defined(STM32F407IX) + #define STM32F4X_PIN_NUM 176 //176 pins mcu, 140 gpio + #define STM32F4X_GPIO_NUM 140 + #define STM32F4X_ADC_NUM 24 +#else + #error "no match MCU defined" +#endif + +#if STM32F4X_PIN_NUM >= 64 //64 pins mcu, 51 gpio + #define PC13 0 + #define PC14 1 //OSC32_IN + #define PC15 2 //OSC32_OUT + #define PH0 3 //OSC_IN + #define PH1 4 //OSC_OUT + #define PB2 5 //BOOT1 + #define PB10 6 //1:SPI2_SCK / I2C2_SCL / USART3_TX / TIM2_CH3 + #define PB11 7 //1:I2C2_SDA / USART3_RX / TIM2_CH4 + #define PB12 8 //1:SPI2_NSS / OTG_HS_ID + #define PB13 9 //1:SPI2_SCK 2:OTG_HS_VBUS + #define PB14 10 //1:SPI2_MISO / TIM12_CH1 / OTG_HS_DM + #define PB15 11 //SPI2_MOSI / TIM12_CH2 / OTG_HS_DP + #define PC6 12 //1:TIM8_CH1 / SDIO_D6 / USART6_TX / TIM3_CH1 + #define PC7 13 //1:TIM8_CH2 / SDIO_D7 / USART6_RX / TIM3_CH2 + #define PC8 14 //1:TIM8_CH3 / SDIO_D0 / TIM3_CH3 + #define PC9 15 //1:TIM8_CH4 / SDIO_D1 / TIM3_CH4 + #define PA8 16 //1:TIM1_CH1 / I2C3_SCL / OTG_FS_SOF + #define PA9 17 //1:USART1_TX / TIM1_CH2 2:OTG_FS_VBUS + #define PA10 18 //1:USART1_RX / TIM1_CH3 / OTG_FS_ID + #define PA11 19 //1:TIM1_CH4 / OTG_FS_DM + #define PA12 20 //1:OTG_FS_DP + #define PA13 21 //0:JTMS-SWDIO + #define PA14 22 //0:JTCK-SWCLK + #define PA15 23 //0:JTDI 1:SPI3_NSS / SPI1_NSS + #define PC10 24 //1:UART4_TX / SPI3_SCK / SDIO_D2 / USART3_TX + #define PC11 25 //1:UART4_RX / SPI3_MISO / SDIO_D3 / USART3_RX + #define PC12 26 //1:UART5_TX / SPI3_MOSI / SDIO_CK + #define PD2 27 //1:UART5_RX / SDIO_CMD + #define PB3 28 //0:JTDO 1:SPI3_SCK / TIM2_CH2 / SPI1_SCK + #define PB4 29 //0:NJTRST 1:SPI3_MISO / TIM3_CH1 / SPI1_MISO + #define PB5 30 //1:TIM3_CH2 / SPI1_MOSI / SPI3_MOSI + #define PB6 31 //1:I2C1_SCL / TIM4_CH1 / USART1_TX + #define PB7 32 //1:I2C1_SDA / TIM4_CH2 / USART1_RX + #define PB8 33 //1:I2C1_SCL / TIM4_CH3 / SDIO_D4 / TIM10_CH1 + #define PB9 34 //1:I2C1_SDA / TIM4_CH4 / SDIO_D5 / TIM11_CH1 / SPI2_NSS + #define PA0 35 //1:UART4_TX / TIM5_CH1 2:ADC123_IN0 + #define PA1 36 //1:UART4_RX / TIM5_CH2 / TIM2_CH2 2:ADC123_IN1 + #define PA2 37 //1:USART2_TX /TIM5_CH3 / TIM9_CH1 / TIM2_CH3 2:ADC123_IN2 + #define PA3 38 //1:USART2_RX /TIM5_CH4 / TIM9_CH2 / TIM2_CH4 2:ADC123_IN3 + #define PA4 39 //NOT FT 1:SPI1_NSS / SPI3_NSS / USART2_CK 2:ADC12_IN4 / DAC_OUT1 + #define PA5 40 //NOT FT 1:SPI1_SCK 2:ADC12_IN5 / DAC_OUT2 + #define PA6 41 //1:SPI1_MISO / TIM13_CH1 / TIM3_CH1 2:ADC12_IN6 + #define PA7 42 //1:SPI1_MOSI / TIM14_CH1 / TIM3_CH2 2:ADC12_IN7 + #define PB0 43 //1:TIM3_CH3 2:ADC12_IN8 + #define PB1 44 //1:TIM3_CH4 2:ADC12_IN9 + #define PC0 45 //1: 2:ADC123_IN10 + #define PC1 46 //1: 2:ADC123_IN11 + #define PC2 47 //1:SPI2_MISO 2:ADC123_IN12 + #define PC3 48 //1:SPI2_MOSI 2:ADC123_IN13 + #define PC4 49 //1: 2:ADC12_IN14 + #define PC5 50 //1: 2:ADC12_IN15 + #if STM32F4X_PIN_NUM >= 144 + #define PF3 51 //1:FSMC_A3 2:ADC3_IN9 + #define PF4 52 //1:FSMC_A4 2:ADC3_IN14 + #define PF5 53 //1:FSMC_A5 2:ADC3_IN15 + #define PF6 54 //1:TIM10_CH1 2:ADC3_IN4 + #define PF7 55 //1:TIM11_CH1 2:ADC3_IN5 + #define PF8 56 //1:TIM13_CH1 2:ADC3_IN6 + #define PF9 57 //1;TIM14_CH1 2:ADC3_IN7 + #define PF10 58 //2:ADC3_IN8 + #endif +#endif +#if STM32F4X_PIN_NUM >= 100 //100 pins mcu, 82 gpio + #define PE2 (35+STM32F4X_ADC_NUM) //1:FSMC_A23 + #define PE3 (36+STM32F4X_ADC_NUM) //1:FSMC_A19 + #define PE4 (37+STM32F4X_ADC_NUM) //1:FSMC_A20 + #define PE5 (38+STM32F4X_ADC_NUM) //1:FSMC_A21 + #define PE6 (39+STM32F4X_ADC_NUM) //1:FSMC_A22 + #define PE7 (40+STM32F4X_ADC_NUM) //1:FSMC_D4 + #define PE8 (41+STM32F4X_ADC_NUM) //1:FSMC_D5 + #define PE9 (42+STM32F4X_ADC_NUM) //1:FSMC_D6 / TIM1_CH1 + #define PE10 (43+STM32F4X_ADC_NUM) //1:FSMC_D7 + #define PE11 (44+STM32F4X_ADC_NUM) //1:FSMC_D8 / TIM1_CH2 + #define PE12 (45+STM32F4X_ADC_NUM) //1:FSMC_D9 + #define PE13 (46+STM32F4X_ADC_NUM) //1:FSMC_D10 / TIM1_CH3 + #define PE14 (47+STM32F4X_ADC_NUM) //1:FSMC_D11 / TIM1_CH4 + #define PE15 (48+STM32F4X_ADC_NUM) //1:FSMC_D12 + #define PD8 (49+STM32F4X_ADC_NUM) //1:FSMC_D13 / USART3_TX + #define PD9 (50+STM32F4X_ADC_NUM) //1:FSMC_D14 / USART3_RX + #define PD10 (51+STM32F4X_ADC_NUM) //1:FSMC_D15 + #define PD11 (52+STM32F4X_ADC_NUM) //1:FSMC_A16 + #define PD12 (53+STM32F4X_ADC_NUM) //1:FSMC_A17 / TIM4_CH1 + #define PD13 (54+STM32F4X_ADC_NUM) //1:FSMC_A18 / TIM4_CH2 + #define PD14 (55+STM32F4X_ADC_NUM) //1:FSMC_D0 / TIM4_CH3 + #define PD15 (56+STM32F4X_ADC_NUM) //1:FSMC_D1 / TIM4_CH4 + #define PD0 (57+STM32F4X_ADC_NUM) //1:FSMC_D2 + #define PD1 (58+STM32F4X_ADC_NUM) //1:FSMC_D3 + #define PD3 (59+STM32F4X_ADC_NUM) //1:FSMC_CLK + #define PD4 (60+STM32F4X_ADC_NUM) //1:FSMC_NOE + #define PD5 (61+STM32F4X_ADC_NUM) //1:USART2_TX + #define PD6 (62+STM32F4X_ADC_NUM) //1:USART2_RX + #define PD7 (63+STM32F4X_ADC_NUM) + #define PE0 (64+STM32F4X_ADC_NUM) + #define PE1 (65+STM32F4X_ADC_NUM) +#endif +#if STM32F4X_PIN_NUM >= 144 //144 pins mcu, 114 gpio + #define PF0 (66+STM32F4X_ADC_NUM) //1:FSMC_A0 / I2C2_SDA + #define PF1 (67+STM32F4X_ADC_NUM) //1:FSMC_A1 / I2C2_SCL + #define PF2 (68+STM32F4X_ADC_NUM) //1:FSMC_A2 + #define PF11 (69+STM32F4X_ADC_NUM) + #define PF12 (70+STM32F4X_ADC_NUM) //1:FSMC_A6 + #define PF13 (71+STM32F4X_ADC_NUM) //1:FSMC_A7 + #define PF14 (72+STM32F4X_ADC_NUM) //1:FSMC_A8 + #define PF15 (73+STM32F4X_ADC_NUM) //1:FSMC_A9 + #define PG0 (74+STM32F4X_ADC_NUM) //1:FSMC_A10 + #define PG1 (75+STM32F4X_ADC_NUM) //1:FSMC_A11 + #define PG2 (76+STM32F4X_ADC_NUM) //1:FSMC_A12 + #define PG3 (77+STM32F4X_ADC_NUM) //1:FSMC_A13 + #define PG4 (78+STM32F4X_ADC_NUM) //1:FSMC_A14 + #define PG5 (79+STM32F4X_ADC_NUM) //1:FSMC_A15 + #define PG6 (80+STM32F4X_ADC_NUM) + #define PG7 (81+STM32F4X_ADC_NUM) + #define PG8 (82+STM32F4X_ADC_NUM) + #define PG9 (83+STM32F4X_ADC_NUM) //1:USART6_RX + #define PG10 (84+STM32F4X_ADC_NUM) //1:FSMC_NE3 + #define PG11 (85+STM32F4X_ADC_NUM) + #define PG12 (86+STM32F4X_ADC_NUM) //1:FSMC_NE4 + #define PG13 (87+STM32F4X_ADC_NUM) //1:FSMC_A24 + #define PG14 (88+STM32F4X_ADC_NUM) //1:FSMC_A25 / USART6_TX + #define PG15 (89+STM32F4X_ADC_NUM) +#endif +#if STM32F4X_PIN_NUM >= 176 //176 pins mcu, 140 gpio + #define PI8 (90+STM32F4X_ADC_NUM) + #define PI9 (91+STM32F4X_ADC_NUM) + #define PI10 (92+STM32F4X_ADC_NUM) + #define PI11 (93+STM32F4X_ADC_NUM) + #define PH2 (94+STM32F4X_ADC_NUM) + #define PH3 (95+STM32F4X_ADC_NUM) + #define PH4 (96+STM32F4X_ADC_NUM) //1:I2C2_SCL + #define PH5 (97+STM32F4X_ADC_NUM) //1:I2C2_SDA + #define PH6 (98+STM32F4X_ADC_NUM) //1:TIM12_CH1 + #define PH7 (99+STM32F4X_ADC_NUM) //1:I2C3_SCL + #define PH8 (100+STM32F4X_ADC_NUM) //1:I2C3_SDA + #define PH9 (101+STM32F4X_ADC_NUM) //1:TIM12_CH2 + #define PH10 (102+STM32F4X_ADC_NUM) //1:TIM5_CH1 + #define PH11 (103+STM32F4X_ADC_NUM) //1:TIM5_CH2 + #define PH12 (104+STM32F4X_ADC_NUM) //1:TIM5_CH3 + #define PH13 (105+STM32F4X_ADC_NUM) + #define PH14 (106+STM32F4X_ADC_NUM) + #define PH15 (107+STM32F4X_ADC_NUM) + #define PI0 (108+STM32F4X_ADC_NUM) //1:TIM5_CH4 / SPI2_NSS + #define PI1 (109+STM32F4X_ADC_NUM) //1:SPI2_SCK + #define PI2 (110+STM32F4X_ADC_NUM) //1:TIM8_CH4 /SPI2_MISO + #define PI3 (111+STM32F4X_ADC_NUM) //1:SPI2_MOS + #define PI4 (112+STM32F4X_ADC_NUM) + #define PI5 (113+STM32F4X_ADC_NUM) //1:TIM8_CH1 + #define PI6 (114+STM32F4X_ADC_NUM) //1:TIM8_CH2 + #define PI7 (115+STM32F4X_ADC_NUM) //1:TIM8_CH3 +#endif + + +// This must be a literal +#define NUM_DIGITAL_PINS (STM32F4X_GPIO_NUM) +// This must be a literal with a value less than or equal to MAX_ANALOG_INPUTS +#define NUM_ANALOG_INPUTS (STM32F4X_ADC_NUM) +#define NUM_ANALOG_FIRST 35 + +// Below ADC, DAC and PWM definitions already done in the core +// Could be redefined here if needed +// ADC resolution is 12bits +//#define ADC_RESOLUTION 12 +//#define DACC_RESOLUTION 12 + +// PWM resolution +/* + * BEWARE: + * Changing this value from the default (1000) will affect the PWM output value of analogWrite (to a PWM pin) + * Since the pin is toggled on capture, if you change the frequency of the timer you have to adapt the compare value (analogWrite thinks you did) + */ +//#define PWM_FREQUENCY 20000 +//The bottom values are the default and don't need to be redefined +//#define PWM_RESOLUTION 8 +//#define PWM_MAX_DUTY_CYCLE 255 + +// On-board LED pin number +#define LED_BUILTIN PA7 +#define LED_GREEN LED_BUILTIN + +// Below SPI and I2C definitions already done in the core +// Could be redefined here if differs from the default one +// SPI Definitions +#define PIN_SPI_MOSI PB15 +#define PIN_SPI_MISO PB14 +#define PIN_SPI_SCK PB13 +#define PIN_SPI_SS PB12 + +// I2C Definitions +#if STM32F4X_PIN_NUM >= 176 + #define PIN_WIRE_SDA PH5 + #define PIN_WIRE_SCL PH4 +#else + #define PIN_WIRE_SDA PB7 + #define PIN_WIRE_SCL PB6 +#endif + +// Timer Definitions +// Do not use timer used by PWM pins when possible. See PinMap_PWM in PeripheralPins.c +#define TIMER_TONE TIM2 // TIMER_TONE must be defined in this file +#define TIMER_SERVO TIM5 // Only 1 Servo PIN on BEEZ9, so use the same timer as defined in PeripheralPins +#define TIMER_SERIAL TIM7 // TIMER_SERIAL must be defined in this file + +// UART Definitions +//#define ENABLE_HWSERIAL1 done automatically by the #define SERIAL_UART_INSTANCE below +#define ENABLE_HWSERIAL3 +#define ENABLE_HWSERIAL6 + +// 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) + +// DEBUG_UART could be redefined to print on another instance than 'Serial' +//#define DEBUG_UART ((USART_TypeDef *) U(S)ARTX) // ex: USART3 +// DEBUG_UART baudrate, default: 9600 if not defined +//#define DEBUG_UART_BAUDRATE x +// DEBUG_UART Tx pin name, default: the first one found in PinMap_UART_TX for DEBUG_UART +//#define DEBUG_PINNAME_TX PX_n // PinName used for TX + +// Default pin used for 'Serial' instance (ex: ST-Link) +// Mandatory for Firmata +#define PIN_SERIAL_RX PA10 +#define PIN_SERIAL_TX PA9 + +// Optional PIN_SERIALn_RX and PIN_SERIALn_TX where 'n' is the U(S)ART number +// Used when user instantiate 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_SERIAL3_RX PD9 +#define PIN_SERIAL3_TX PD8 +#define PIN_SERIAL6_RX PC7 +#define PIN_SERIAL6_TX PC6 +//#define PIN_SERIALLP1_RX x // For LPUART1 RX +//#define PIN_SERIALLP1_TX x // For LPUART1 TX + +#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 Serial3 +#define SERIAL_PORT_HARDWARE_OPEN1 Serial6 +#endif diff --git a/buildroot/tests/I3DBEEZ9_V1 b/buildroot/tests/I3DBEEZ9_V1 new file mode 100755 index 0000000000000..7c11d2e6c8795 --- /dev/null +++ b/buildroot/tests/I3DBEEZ9_V1 @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# +# Build tests for STM32F407ZG I3DBEEZ9 Board +# + +# exit on first failure +set -e + +# +# Build with the default configurations +# +restore_configs +opt_set MOTHERBOARD BOARD_I3DBEEZ9_V1 SERIAL_PORT 1 +exec_test $1 $2 "I3DBEE Z9 Board | Default Configuration" "$3" + +restore_configs +opt_set MOTHERBOARD BOARD_I3DBEEZ9_V1 SERIAL_PORT -1 \ + EXTRUDERS 3 TEMP_SENSOR_1 1 TEMP_SENSOR_2 1 \ + E0_AUTO_FAN_PIN PC10 E1_AUTO_FAN_PIN PC11 E2_AUTO_FAN_PIN PC12 \ + X_DRIVER_TYPE TMC2209 Y_DRIVER_TYPE TMC2130 +opt_enable BLTOUCH EEPROM_SETTINGS AUTO_BED_LEVELING_3POINT Z_SAFE_HOMING PINS_DEBUGGING +exec_test $1 $2 "I3DBEE Z9 Board | 3 Extruders | Auto-Fan | BLTOUCH | Mixed TMC" "$3" + +restore_configs +opt_set MOTHERBOARD BOARD_I3DBEEZ9_V1 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 LASER_SAFETY_TIMEOUT_MS REPRAP_DISCOUNT_SMART_CONTROLLER +exec_test $1 $2 "I3DBEE Z9 Board | HD44780 | Laser (Percent) | Cooling | LCD" "$3" + +# clean up +restore_configs diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 7dfffe47646bc..2889a88863cd7 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -782,3 +782,14 @@ extends = common_stm32 board = blackpill_f401cc upload_protocol = stlink monitor_speed = 115200 + +# +# I3Dbeez9 (STM32F407ZGT6 ARM Cortex-M4) +# +[env:I3DBEEZ9_V1] +extends = stm32_variant +board = marlin_I3DBEEZ9 +board_build.offset = 0x8000 +build_flags = ${stm32_variant.build_flags} -DSTM32F407_5ZX +debug_tool = stlink +upload_protocol = stlink From 7249c3c46ffb3d6ae00236691b3c7ff4123424d4 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 18 May 2023 15:44:04 -0500 Subject: [PATCH 043/100] =?UTF-8?q?=F0=9F=A9=B9=20M493=20report=20followup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/feature/ft_motion/M493.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Marlin/src/gcode/feature/ft_motion/M493.cpp b/Marlin/src/gcode/feature/ft_motion/M493.cpp index 83c6a9a5dacbd..9469f1575b612 100644 --- a/Marlin/src/gcode/feature/ft_motion/M493.cpp +++ b/Marlin/src/gcode/feature/ft_motion/M493.cpp @@ -103,7 +103,8 @@ void say_shaping() { #if HAS_EXTRUDERS SERIAL_ECHO_TERNARY(fxdTiCtrl.cfg.linearAdvEna, "Linear Advance ", "en", "dis", "abled"); - SERIAL_ECHOLNPGM(". Gain: "); SERIAL_ECHO_F(fxdTiCtrl.cfg.linearAdvK, 5); + SERIAL_ECHOPGM(". Gain: "); SERIAL_ECHO_F(fxdTiCtrl.cfg.linearAdvK, 5); + SERIAL_EOL(); #endif } From 48c14f110998e066e0db3b82956fcc0b3af1f1f7 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 19 May 2023 00:20:49 +0000 Subject: [PATCH 044/100] [cron] Bump distribution date (2023-05-19) --- 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 d750fb9fa42ea..20d39cad456d1 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 "2023-05-18" +//#define STRING_DISTRIBUTION_DATE "2023-05-19" /** * 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 f1b231143e38f..ae6f5a88cc15e 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 "2023-05-18" + #define STRING_DISTRIBUTION_DATE "2023-05-19" #endif /** From 7d5bd4dfbc029c1be10a3de42c0eb6508965a22d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 19 May 2023 04:48:11 -0500 Subject: [PATCH 045/100] =?UTF-8?q?=F0=9F=8E=A8=20Cutter=20pins=20cleanup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/tmc_util.cpp | 2 +- Marlin/src/module/motion.h | 2 +- Marlin/src/pins/linux/pins_RAMPS_LINUX.h | 4 ++-- Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h | 2 +- Marlin/src/pins/lpc1769/pins_COHESION3D_REMIX.h | 2 +- Marlin/src/pins/mega/pins_HJC2560C_REV2.h | 4 ++-- Marlin/src/pins/mega/pins_MEGACONTROLLER.h | 8 +++++--- Marlin/src/pins/mega/pins_MEGATRONICS.h | 8 +++++--- Marlin/src/pins/mega/pins_MEGATRONICS_2.h | 8 +++++--- Marlin/src/pins/mega/pins_MINITRONICS.h | 2 +- Marlin/src/pins/rambo/pins_EINSY_RAMBO.h | 10 ++++++---- Marlin/src/pins/rambo/pins_EINSY_RETRO.h | 10 ++++++---- Marlin/src/pins/rambo/pins_MINIRAMBO.h | 10 ++++++---- Marlin/src/pins/rambo/pins_RAMBO.h | 8 +++++--- Marlin/src/pins/ramps/pins_BAM_DICE_DUE.h | 8 +++++--- Marlin/src/pins/ramps/pins_BQ_ZUM_MEGA_3D.h | 8 +++++--- Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR2.h | 4 ++-- Marlin/src/pins/ramps/pins_RAMPS.h | 2 +- Marlin/src/pins/ramps/pins_RAMPS_OLD.h | 8 +++++--- Marlin/src/pins/ramps/pins_RAMPS_S_12.h | 2 +- Marlin/src/pins/ramps/pins_TT_OSCAR.h | 4 ++-- Marlin/src/pins/ramps/pins_ULTIMAIN_2.h | 4 ++-- Marlin/src/pins/ramps/pins_ULTIMAKER.h | 8 +++++--- Marlin/src/pins/ramps/pins_ULTIMAKER_OLD.h | 6 +++--- Marlin/src/pins/ramps/pins_Z_BOLT_X_SERIES.h | 4 ++-- Marlin/src/pins/sam/pins_RAMPS_FD_V1.h | 2 +- Marlin/src/pins/samd/pins_RAMPS_144.h | 2 +- Marlin/src/pins/sanguino/pins_GEN6.h | 8 +++++--- Marlin/src/pins/sanguino/pins_GEN7_14.h | 8 +++++--- Marlin/src/pins/sanguino/pins_GEN7_CUSTOM.h | 8 +++++--- Marlin/src/pins/sanguino/pins_SANGUINOLOLU_11.h | 2 +- Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h | 2 +- Marlin/src/pins/teensy2/pins_TEENSY2.h | 8 +++++--- Marlin/src/pins/teensy2/pins_TEENSYLU.h | 8 +++++--- 34 files changed, 109 insertions(+), 77 deletions(-) diff --git a/Marlin/src/feature/tmc_util.cpp b/Marlin/src/feature/tmc_util.cpp index cc99f34c5b5a0..095e14fe15588 100644 --- a/Marlin/src/feature/tmc_util.cpp +++ b/Marlin/src/feature/tmc_util.cpp @@ -1236,7 +1236,7 @@ static bool test_connection(TMC &st) { void test_tmc_connection(LOGICAL_AXIS_ARGS(const bool)) { uint8_t axis_connection = 0; - if (TERN0(HAS_X_AXIS, x)) { + if (TERN0(HAS_X_AXIS, x)) { #if AXIS_IS_TMC(X) axis_connection += test_connection(stepperX); #endif diff --git a/Marlin/src/module/motion.h b/Marlin/src/module/motion.h index ae0976b44c94f..71d80f954e419 100644 --- a/Marlin/src/module/motion.h +++ b/Marlin/src/module/motion.h @@ -358,7 +358,7 @@ void do_blocking_move_to(const xyz_pos_t &raw, const_feedRate_t fr_mm_s=0.0f); void do_blocking_move_to(const xyze_pos_t &raw, const_feedRate_t fr_mm_s=0.0f); #if HAS_X_AXIS - void do_blocking_move_to_x(const_float_t rx, const_feedRate_t fr_mm_s=0.0f); + void do_blocking_move_to_x(const_float_t rx, const_feedRate_t fr_mm_s=0.0f); #endif #if HAS_Y_AXIS void do_blocking_move_to_y(const_float_t ry, const_feedRate_t fr_mm_s=0.0f); diff --git a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h b/Marlin/src/pins/linux/pins_RAMPS_LINUX.h index e322af8fec22d..950eb8d88f073 100644 --- a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h +++ b/Marlin/src/pins/linux/pins_RAMPS_LINUX.h @@ -221,12 +221,12 @@ // #if HAS_CUTTER && !PIN_EXISTS(SPINDLE_LASER_ENA) #if !defined(NUM_SERVOS) || NUM_SERVOS == 0 // Prefer the servo connector - #define SPINDLE_LASER_ENA_PIN 4 // Pullup or pulldown! #define SPINDLE_LASER_PWM_PIN 6 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 4 // Pullup or pulldown! #define SPINDLE_DIR_PIN 5 #elif HAS_FREE_AUX2_PINS // try to use AUX 2 - #define SPINDLE_LASER_ENA_PIN 40 // Pullup or pulldown! #define SPINDLE_LASER_PWM_PIN 44 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 40 // Pullup or pulldown! #define SPINDLE_DIR_PIN 65 #endif #endif diff --git a/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h b/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h index f5d288fce426a..a6341ec5295dc 100644 --- a/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h +++ b/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h @@ -252,8 +252,8 @@ #error "LASER_FEATURE requires 3 free servo pins." #endif #endif - #define SPINDLE_LASER_ENA_PIN SERVO1_PIN // (6) Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN SERVO3_PIN // (4) MUST BE HARDWARE PWM + #define SPINDLE_LASER_ENA_PIN SERVO1_PIN // (6) Pin should have a pullup/pulldown! #define SPINDLE_DIR_PIN SERVO2_PIN // (5) #endif diff --git a/Marlin/src/pins/lpc1769/pins_COHESION3D_REMIX.h b/Marlin/src/pins/lpc1769/pins_COHESION3D_REMIX.h index 4dc275eee7f04..f86cd5d3c6950 100644 --- a/Marlin/src/pins/lpc1769/pins_COHESION3D_REMIX.h +++ b/Marlin/src/pins/lpc1769/pins_COHESION3D_REMIX.h @@ -153,8 +153,8 @@ #undef HEATER_0_PIN #undef HEATER_BED_PIN #undef FAN0_PIN - #define SPINDLE_LASER_ENA_PIN P2_07 // FET 1 #define SPINDLE_LASER_PWM_PIN P2_05 // Bed FET + #define SPINDLE_LASER_ENA_PIN P2_07 // FET 1 #define SPINDLE_DIR_PIN P2_06 // FET 4 #endif diff --git a/Marlin/src/pins/mega/pins_HJC2560C_REV2.h b/Marlin/src/pins/mega/pins_HJC2560C_REV2.h index 79eef14366133..512da028348bd 100644 --- a/Marlin/src/pins/mega/pins_HJC2560C_REV2.h +++ b/Marlin/src/pins/mega/pins_HJC2560C_REV2.h @@ -114,9 +114,9 @@ // M3/M4/M5 - Spindle/Laser Control // #if HAS_CUTTER - #define SPINDLE_DIR_PIN 16 - #define SPINDLE_LASER_ENA_PIN 17 // Pin should have a pullup! #define SPINDLE_LASER_PWM_PIN 9 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 17 // Pin should have a pullup! + #define SPINDLE_DIR_PIN 16 #endif // diff --git a/Marlin/src/pins/mega/pins_MEGACONTROLLER.h b/Marlin/src/pins/mega/pins_MEGACONTROLLER.h index 19808817c93d3..049917b6b6896 100644 --- a/Marlin/src/pins/mega/pins_MEGACONTROLLER.h +++ b/Marlin/src/pins/mega/pins_MEGACONTROLLER.h @@ -162,6 +162,8 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_PWM_PIN 6 // Hardware PWM -#define SPINDLE_LASER_ENA_PIN 7 // Pullup! -#define SPINDLE_DIR_PIN 8 +#if HAS_CUTTER + #define SPINDLE_LASER_PWM_PIN 6 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 7 // Pullup! + #define SPINDLE_DIR_PIN 8 +#endif diff --git a/Marlin/src/pins/mega/pins_MEGATRONICS.h b/Marlin/src/pins/mega/pins_MEGATRONICS.h index 0e2ac291b2a4e..066b577c629b0 100644 --- a/Marlin/src/pins/mega/pins_MEGATRONICS.h +++ b/Marlin/src/pins/mega/pins_MEGATRONICS.h @@ -130,6 +130,8 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_PWM_PIN 3 // Hardware PWM -#define SPINDLE_LASER_ENA_PIN 4 // Pullup! -#define SPINDLE_DIR_PIN 11 +#if HAS_CUTTER + #define SPINDLE_LASER_PWM_PIN 3 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 4 // Pullup! + #define SPINDLE_DIR_PIN 11 +#endif diff --git a/Marlin/src/pins/mega/pins_MEGATRONICS_2.h b/Marlin/src/pins/mega/pins_MEGATRONICS_2.h index d6840de8d0b37..ff118e7323158 100644 --- a/Marlin/src/pins/mega/pins_MEGATRONICS_2.h +++ b/Marlin/src/pins/mega/pins_MEGATRONICS_2.h @@ -122,9 +122,11 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_PWM_PIN 3 // Hardware PWM -#define SPINDLE_LASER_ENA_PIN 16 // Pullup! -#define SPINDLE_DIR_PIN 11 +#if HAS_CUTTER + #define SPINDLE_LASER_PWM_PIN 3 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 16 // Pullup! + #define SPINDLE_DIR_PIN 11 +#endif // // LCD / Controller diff --git a/Marlin/src/pins/mega/pins_MINITRONICS.h b/Marlin/src/pins/mega/pins_MINITRONICS.h index 6d0309c4c191d..c8828faea7abd 100644 --- a/Marlin/src/pins/mega/pins_MINITRONICS.h +++ b/Marlin/src/pins/mega/pins_MINITRONICS.h @@ -141,7 +141,7 @@ #define HEATER_BED_PIN 4 // won't compile #define TEMP_BED_PIN 50 #define TEMP_0_PIN 51 - #define SPINDLE_LASER_ENA_PIN 52 // using A6 because it already has a pullup #define SPINDLE_LASER_PWM_PIN 3 // WARNING - LED & resistor pull up to +12/+24V stepper voltage + #define SPINDLE_LASER_ENA_PIN 52 // using A6 because it already has a pullup #define SPINDLE_DIR_PIN 53 #endif diff --git a/Marlin/src/pins/rambo/pins_EINSY_RAMBO.h b/Marlin/src/pins/rambo/pins_EINSY_RAMBO.h index 531739ca16b87..d73092c2f68a8 100644 --- a/Marlin/src/pins/rambo/pins_EINSY_RAMBO.h +++ b/Marlin/src/pins/rambo/pins_EINSY_RAMBO.h @@ -189,10 +189,12 @@ // // M3/M4/M5 - Spindle/Laser Control // -// use P1 connector for spindle pins -#define SPINDLE_LASER_PWM_PIN EXP1_02_PIN // Hardware PWM -#define SPINDLE_LASER_ENA_PIN 18 // Pullup! -#define SPINDLE_DIR_PIN 19 +#if HAS_CUTTER + // Use P1 connector for spindle pins + #define SPINDLE_LASER_PWM_PIN EXP1_02_PIN // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 18 // Pullup! + #define SPINDLE_DIR_PIN 19 +#endif // // Průša i3 MK2 Multiplexer Support diff --git a/Marlin/src/pins/rambo/pins_EINSY_RETRO.h b/Marlin/src/pins/rambo/pins_EINSY_RETRO.h index 10736d34a9943..b4f09b7136b15 100644 --- a/Marlin/src/pins/rambo/pins_EINSY_RETRO.h +++ b/Marlin/src/pins/rambo/pins_EINSY_RETRO.h @@ -153,10 +153,12 @@ // // M3/M4/M5 - Spindle/Laser Control // -// use P1 connector for spindle pins -#define SPINDLE_LASER_PWM_PIN 9 // Hardware PWM -#define SPINDLE_LASER_ENA_PIN 18 // Pullup! -#define SPINDLE_DIR_PIN 19 +#if HAS_CUTTER + // Use P1 connector for spindle pins + #define SPINDLE_LASER_PWM_PIN 9 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 18 // Pullup! + #define SPINDLE_DIR_PIN 19 +#endif // // Průša i3 MK2 Multiplexer Support diff --git a/Marlin/src/pins/rambo/pins_MINIRAMBO.h b/Marlin/src/pins/rambo/pins_MINIRAMBO.h index 6e1a4608381e1..32a74515d9838 100644 --- a/Marlin/src/pins/rambo/pins_MINIRAMBO.h +++ b/Marlin/src/pins/rambo/pins_MINIRAMBO.h @@ -126,10 +126,12 @@ // // M3/M4/M5 - Spindle/Laser Control // -// use P1 connector for spindle pins -#define SPINDLE_LASER_PWM_PIN 9 // Hardware PWM -#define SPINDLE_LASER_ENA_PIN 18 // Pullup! -#define SPINDLE_DIR_PIN 19 +#if HAS_CUTTER + // Use P1 connector for spindle pins + #define SPINDLE_LASER_PWM_PIN 9 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 18 // Pullup! + #define SPINDLE_DIR_PIN 19 +#endif // // Průša i3 MK2 Multiplexer Support diff --git a/Marlin/src/pins/rambo/pins_RAMBO.h b/Marlin/src/pins/rambo/pins_RAMBO.h index 1e9b9938a5aaf..e1ddf972d9959 100644 --- a/Marlin/src/pins/rambo/pins_RAMBO.h +++ b/Marlin/src/pins/rambo/pins_RAMBO.h @@ -168,9 +168,11 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_PWM_PIN 45 // Hardware PWM -#define SPINDLE_LASER_ENA_PIN 31 // Pullup! -#define SPINDLE_DIR_PIN 32 +#if HAS_CUTTER + #define SPINDLE_LASER_PWM_PIN 45 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 31 // Pullup! + #define SPINDLE_DIR_PIN 32 +#endif // // SPI for MAX Thermocouple diff --git a/Marlin/src/pins/ramps/pins_BAM_DICE_DUE.h b/Marlin/src/pins/ramps/pins_BAM_DICE_DUE.h index f3439aa6bbba5..cf237fb9c11eb 100644 --- a/Marlin/src/pins/ramps/pins_BAM_DICE_DUE.h +++ b/Marlin/src/pins/ramps/pins_BAM_DICE_DUE.h @@ -37,9 +37,11 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_ENA_PIN 66 // Pullup or pulldown! -#define SPINDLE_DIR_PIN 67 -#define SPINDLE_LASER_PWM_PIN 44 // Hardware PWM +#if HAS_CUTTER + #define SPINDLE_LASER_PWM_PIN 44 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 66 // Pullup or pulldown! + #define SPINDLE_DIR_PIN 67 +#endif // // Temperature Sensors diff --git a/Marlin/src/pins/ramps/pins_BQ_ZUM_MEGA_3D.h b/Marlin/src/pins/ramps/pins_BQ_ZUM_MEGA_3D.h index efedb8ffaf54e..08d4492ccb5e2 100644 --- a/Marlin/src/pins/ramps/pins_BQ_ZUM_MEGA_3D.h +++ b/Marlin/src/pins/ramps/pins_BQ_ZUM_MEGA_3D.h @@ -95,9 +95,11 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_ENA_PIN 40 // Pullup or pulldown! -#define SPINDLE_LASER_PWM_PIN 44 // Hardware PWM -#define SPINDLE_DIR_PIN 42 +#if HAS_CUTTER + #define SPINDLE_LASER_PWM_PIN 44 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 40 // Pullup or pulldown! + #define SPINDLE_DIR_PIN 42 +#endif // // Misc. Functions diff --git a/Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR2.h b/Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR2.h index d79eb8041cbec..65828fd4fb622 100644 --- a/Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR2.h +++ b/Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR2.h @@ -44,12 +44,12 @@ // #if HAS_CUTTER && !PIN_EXISTS(SPINDLE_LASER_ENA) #if !NUM_SERVOS // Try to use servo connector first - #define SPINDLE_LASER_ENA_PIN 6 // Pullup or pulldown! #define SPINDLE_LASER_PWM_PIN 4 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 6 // Pullup or pulldown! #define SPINDLE_DIR_PIN 5 #elif !GREEDY_PANEL // Try to use AUX2 - #define SPINDLE_LASER_ENA_PIN 4 // Pullup or pulldown! #define SPINDLE_LASER_PWM_PIN 44 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 4 // Pullup or pulldown! #define SPINDLE_DIR_PIN 65 #endif #endif diff --git a/Marlin/src/pins/ramps/pins_RAMPS.h b/Marlin/src/pins/ramps/pins_RAMPS.h index 73207593fc412..422991aba4c1a 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS.h +++ b/Marlin/src/pins/ramps/pins_RAMPS.h @@ -309,8 +309,8 @@ #endif #define SPINDLE_DIR_PIN 5 #elif HAS_FREE_AUX2_PINS - #define SPINDLE_LASER_ENA_PIN 40 // Pullup or pulldown! #define SPINDLE_LASER_PWM_PIN 44 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 40 // Pullup or pulldown! #define SPINDLE_DIR_PIN 65 #else #error "No auto-assignable Spindle/Laser pins available." diff --git a/Marlin/src/pins/ramps/pins_RAMPS_OLD.h b/Marlin/src/pins/ramps/pins_RAMPS_OLD.h index 19b048ec81a9e..df24a7f19e7fa 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS_OLD.h +++ b/Marlin/src/pins/ramps/pins_RAMPS_OLD.h @@ -113,6 +113,8 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_ENA_PIN 41 // Pullup or pulldown! -#define SPINDLE_LASER_PWM_PIN 45 // Hardware PWM -#define SPINDLE_DIR_PIN 43 +#if HAS_CUTTER + #define SPINDLE_LASER_PWM_PIN 45 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 41 // Pullup or pulldown! + #define SPINDLE_DIR_PIN 43 +#endif diff --git a/Marlin/src/pins/ramps/pins_RAMPS_S_12.h b/Marlin/src/pins/ramps/pins_RAMPS_S_12.h index 87535a7de8867..542b3cb816427 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS_S_12.h +++ b/Marlin/src/pins/ramps/pins_RAMPS_S_12.h @@ -211,8 +211,8 @@ // M3/M4/M5 - Spindle/Laser Control // #if HAS_CUTTER && !defined(SPINDLE_LASER_ENA_PIN) - #define SPINDLE_LASER_ENA_PIN 4 // Pullup or pulldown! #define SPINDLE_LASER_PWM_PIN 6 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 4 // Pullup or pulldown! #define SPINDLE_DIR_PIN 5 #endif diff --git a/Marlin/src/pins/ramps/pins_TT_OSCAR.h b/Marlin/src/pins/ramps/pins_TT_OSCAR.h index 7078b11b6b62a..d9c79f5da8ebe 100644 --- a/Marlin/src/pins/ramps/pins_TT_OSCAR.h +++ b/Marlin/src/pins/ramps/pins_TT_OSCAR.h @@ -228,12 +228,12 @@ // #if HAS_CUTTER && !PIN_EXISTS(SPINDLE_LASER_ENA) #if !NUM_SERVOS // Prefer the servo connector - #define SPINDLE_LASER_ENA_PIN 4 // Pullup or pulldown! #define SPINDLE_LASER_PWM_PIN 6 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 4 // Pullup or pulldown! #define SPINDLE_DIR_PIN 5 #elif HAS_FREE_AUX2_PINS // Try to use AUX 2 - #define SPINDLE_LASER_ENA_PIN 40 // Pullup or pulldown! #define SPINDLE_LASER_PWM_PIN 44 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 40 // Pullup or pulldown! #define SPINDLE_DIR_PIN 65 #endif #endif diff --git a/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h b/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h index dc06963289071..049e8bc5d80ce 100644 --- a/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h +++ b/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h @@ -151,9 +151,9 @@ // #if HAS_CUTTER // use the LED_PIN for spindle speed control or case light #undef LED_PIN - #define SPINDLE_DIR_PIN 16 - #define SPINDLE_LASER_ENA_PIN 17 // Pullup! #define SPINDLE_LASER_PWM_PIN 8 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 17 // Pullup! + #define SPINDLE_DIR_PIN 16 #else #undef LED_PIN #define CASE_LIGHT_PIN 8 diff --git a/Marlin/src/pins/ramps/pins_ULTIMAKER.h b/Marlin/src/pins/ramps/pins_ULTIMAKER.h index c822a62faf82f..10adeb18917df 100644 --- a/Marlin/src/pins/ramps/pins_ULTIMAKER.h +++ b/Marlin/src/pins/ramps/pins_ULTIMAKER.h @@ -162,6 +162,8 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_PWM_PIN 9 // Hardware PWM -#define SPINDLE_LASER_ENA_PIN 10 // Pullup! -#define SPINDLE_DIR_PIN 11 // use the EXP3 PWM header +#if HAS_CUTTER + #define SPINDLE_LASER_PWM_PIN 9 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 10 // Pullup! + #define SPINDLE_DIR_PIN 11 // use the EXP3 PWM header +#endif diff --git a/Marlin/src/pins/ramps/pins_ULTIMAKER_OLD.h b/Marlin/src/pins/ramps/pins_ULTIMAKER_OLD.h index 5f5cb6cb1244c..a1b02aa06c738 100644 --- a/Marlin/src/pins/ramps/pins_ULTIMAKER_OLD.h +++ b/Marlin/src/pins/ramps/pins_ULTIMAKER_OLD.h @@ -226,9 +226,9 @@ // #if HAS_CUTTER #if EITHER(BOARD_REV_1_0, BOARD_REV_1_5) // Use the last three SW positions - #define SPINDLE_DIR_PIN 10 // 1.0: SW4 1.5: EXP3-6 ("10") #define SPINDLE_LASER_PWM_PIN 9 // 1.0: SW5 1.5: EXP3-7 ( "9") .. MUST BE HARDWARE PWM #define SPINDLE_LASER_ENA_PIN 8 // 1.0: SW6 1.5: EXP3-8 ( "8") .. Pin should have a pullup! + #define SPINDLE_DIR_PIN 10 // 1.0: SW4 1.5: EXP3-6 ("10") #elif ENABLED(BOARD_REV_1_1_TO_1_3) /** * Only four hardware PWMs physically connected to anything on these boards: @@ -242,14 +242,14 @@ * They have an LED and resistor pullup to +24V which could damage 3.3V-5V ICs. */ #if EXTRUDERS == 1 - #define SPINDLE_DIR_PIN 43 #define SPINDLE_LASER_PWM_PIN 45 // Hardware PWM #define SPINDLE_LASER_ENA_PIN 41 // Pullup! + #define SPINDLE_DIR_PIN 43 #elif TEMP_SENSOR_BED == 0 // Can't use E0 so see if HEATER_BED_PIN is available #undef HEATER_BED_PIN - #define SPINDLE_DIR_PIN 38 // Probably pin 4 on 10 pin connector closest to the E0 socket #define SPINDLE_LASER_PWM_PIN 4 // Hardware PWM - Special precautions usually needed. #define SPINDLE_LASER_ENA_PIN 40 // Pullup! (Probably pin 6 on the 10-pin + #define SPINDLE_DIR_PIN 38 // Probably pin 4 on 10 pin connector closest to the E0 socket // connector closest to the E0 socket) #endif #endif 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 e4603591d12a9..f63ca83723f35 100644 --- a/Marlin/src/pins/ramps/pins_Z_BOLT_X_SERIES.h +++ b/Marlin/src/pins/ramps/pins_Z_BOLT_X_SERIES.h @@ -170,12 +170,12 @@ // #if HAS_CUTTER && !PIN_EXISTS(SPINDLE_LASER_ENA) #if !defined(NUM_SERVOS) || NUM_SERVOS == 0 // Prefer the servo connector - #define SPINDLE_LASER_ENA_PIN 4 // Pullup or pulldown! #define SPINDLE_LASER_PWM_PIN 6 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 4 // Pullup or pulldown! #define SPINDLE_DIR_PIN 5 #elif HAS_FREE_AUX2_PINS - #define SPINDLE_LASER_ENA_PIN 40 // Pullup or pulldown! #define SPINDLE_LASER_PWM_PIN 44 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 40 // Pullup or pulldown! #define SPINDLE_DIR_PIN 65 #endif #endif diff --git a/Marlin/src/pins/sam/pins_RAMPS_FD_V1.h b/Marlin/src/pins/sam/pins_RAMPS_FD_V1.h index c84d84105c3be..8f206d9f876b4 100644 --- a/Marlin/src/pins/sam/pins_RAMPS_FD_V1.h +++ b/Marlin/src/pins/sam/pins_RAMPS_FD_V1.h @@ -260,7 +260,7 @@ // M3/M4/M5 - Spindle/Laser Control // #if HOTENDS < 3 && HAS_CUTTER && !PIN_EXISTS(SPINDLE_LASER_ENA) - #define SPINDLE_LASER_ENA_PIN 45 // Use E2 ENA #define SPINDLE_LASER_PWM_PIN 12 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 45 // Use E2 ENA #define SPINDLE_DIR_PIN 47 // Use E2 DIR #endif diff --git a/Marlin/src/pins/samd/pins_RAMPS_144.h b/Marlin/src/pins/samd/pins_RAMPS_144.h index aa262f5a60f66..a762d3cdbdccf 100644 --- a/Marlin/src/pins/samd/pins_RAMPS_144.h +++ b/Marlin/src/pins/samd/pins_RAMPS_144.h @@ -155,8 +155,8 @@ // #if HAS_CUTTER && !defined(SPINDLE_LASER_ENA_PIN) #if !NUM_SERVOS // Use servo connector if possible - #define SPINDLE_LASER_ENA_PIN 4 // Pullup or pulldown! #define SPINDLE_LASER_PWM_PIN 6 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 4 // Pullup or pulldown! #define SPINDLE_DIR_PIN 5 #else #error "No auto-assignable Spindle/Laser pins available." diff --git a/Marlin/src/pins/sanguino/pins_GEN6.h b/Marlin/src/pins/sanguino/pins_GEN6.h index 75138845f402f..4a6136e0810a7 100644 --- a/Marlin/src/pins/sanguino/pins_GEN6.h +++ b/Marlin/src/pins/sanguino/pins_GEN6.h @@ -117,6 +117,8 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_ENA_PIN 5 // Pullup or pulldown! -#define SPINDLE_LASER_PWM_PIN 16 // Hardware PWM -#define SPINDLE_DIR_PIN 6 +#if HAS_CUTTER + #define SPINDLE_LASER_PWM_PIN 16 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 5 // Pullup or pulldown! + #define SPINDLE_DIR_PIN 6 +#endif diff --git a/Marlin/src/pins/sanguino/pins_GEN7_14.h b/Marlin/src/pins/sanguino/pins_GEN7_14.h index 698bd066066a9..db80c45eeefea 100644 --- a/Marlin/src/pins/sanguino/pins_GEN7_14.h +++ b/Marlin/src/pins/sanguino/pins_GEN7_14.h @@ -118,6 +118,8 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_ENA_PIN 20 // Pullup or pulldown! -#define SPINDLE_LASER_PWM_PIN 16 // Hardware PWM -#define SPINDLE_DIR_PIN 21 +#if HAS_CUTTER + #define SPINDLE_LASER_PWM_PIN 16 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 20 // Pullup or pulldown! + #define SPINDLE_DIR_PIN 21 +#endif diff --git a/Marlin/src/pins/sanguino/pins_GEN7_CUSTOM.h b/Marlin/src/pins/sanguino/pins_GEN7_CUSTOM.h index 3927250b15b50..154e26725f20d 100644 --- a/Marlin/src/pins/sanguino/pins_GEN7_CUSTOM.h +++ b/Marlin/src/pins/sanguino/pins_GEN7_CUSTOM.h @@ -134,6 +134,8 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_ENA_PIN 5 // Pullup or pulldown! -#define SPINDLE_LASER_PWM_PIN 16 // Hardware PWM -#define SPINDLE_DIR_PIN 6 +#if HAS_CUTTER + #define SPINDLE_LASER_PWM_PIN 16 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 5 // Pullup or pulldown! + #define SPINDLE_DIR_PIN 6 +#endif diff --git a/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_11.h b/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_11.h index 45b326e74e8f2..9a80ca2e63aa5 100644 --- a/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_11.h +++ b/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_11.h @@ -272,8 +272,8 @@ #if HAS_CUTTER #if !MB(AZTEEG_X1) && ENABLED(SANGUINOLOLU_V_1_2) && !BOTH(HAS_WIRED_LCD, IS_NEWPANEL) // try to use IO Header - #define SPINDLE_LASER_ENA_PIN 10 // Pullup or pulldown! #define SPINDLE_LASER_PWM_PIN 4 // Hardware PWM + #define SPINDLE_LASER_ENA_PIN 10 // Pullup or pulldown! #define SPINDLE_DIR_PIN 11 #elif !MB(MELZI) // use X stepper motor socket diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h index f2450ffcb4e73..af9a6d891e31f 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h @@ -86,8 +86,8 @@ //#define HEATER_0_PIN -1 //#define HEATER_BED_PIN -1 #define FAN0_PIN -1 - #define SPINDLE_LASER_ENA_PIN PC0 // FET 1 #define SPINDLE_LASER_PWM_PIN PC0 // Bed FET + #define SPINDLE_LASER_ENA_PIN PC0 // FET 1 #define SPINDLE_DIR_PIN PC0 // FET 4 #define LASER_SOFT_PWM_PIN PC0 #endif diff --git a/Marlin/src/pins/teensy2/pins_TEENSY2.h b/Marlin/src/pins/teensy2/pins_TEENSY2.h index 2b65f17bc5ea3..9c8c6ce628b63 100644 --- a/Marlin/src/pins/teensy2/pins_TEENSY2.h +++ b/Marlin/src/pins/teensy2/pins_TEENSY2.h @@ -182,6 +182,8 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_ENA_PIN 5 // D5 Pin should have a pullup! -#define SPINDLE_LASER_PWM_PIN 0 // D0 PWM0B MUST BE HARDWARE PWM -#define SPINDLE_DIR_PIN 7 // D7 +#if HAS_CUTTER + #define SPINDLE_LASER_PWM_PIN 0 // D0 PWM0B MUST BE HARDWARE PWM + #define SPINDLE_LASER_ENA_PIN 5 // D5 Pin should have a pullup! + #define SPINDLE_DIR_PIN 7 // D7 +#endif diff --git a/Marlin/src/pins/teensy2/pins_TEENSYLU.h b/Marlin/src/pins/teensy2/pins_TEENSYLU.h index 81bb56349fb16..deeffe9038cf8 100644 --- a/Marlin/src/pins/teensy2/pins_TEENSYLU.h +++ b/Marlin/src/pins/teensy2/pins_TEENSYLU.h @@ -167,6 +167,8 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_PWM_PIN 24 // B4 IO-3 PWM2A - MUST BE HARDWARE PWM -#define SPINDLE_LASER_ENA_PIN 39 // F1 IO-11 - Pin should have a pullup! -#define SPINDLE_DIR_PIN 40 // F2 IO-9 +#if HAS_CUTTER + #define SPINDLE_LASER_PWM_PIN 24 // B4 IO-3 PWM2A - MUST BE HARDWARE PWM + #define SPINDLE_LASER_ENA_PIN 39 // F1 IO-11 - Pin should have a pullup! + #define SPINDLE_DIR_PIN 40 // F2 IO-9 +#endif From 26dfbd0660c10328847698b021e8ac9101810056 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 20 May 2023 00:19:33 +0000 Subject: [PATCH 046/100] [cron] Bump distribution date (2023-05-20) --- 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 20d39cad456d1..8ea8917f48dc3 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 "2023-05-19" +//#define STRING_DISTRIBUTION_DATE "2023-05-20" /** * 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 ae6f5a88cc15e..8d6d94c448795 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 "2023-05-19" + #define STRING_DISTRIBUTION_DATE "2023-05-20" #endif /** From 5bc84bf08cb47741537fe705dbfe19eee5396d4e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 19 May 2023 23:30:48 -0500 Subject: [PATCH 047/100] =?UTF-8?q?=F0=9F=9A=B8=20Improve=20EEPROM=20valid?= =?UTF-8?q?ation=20(#25860)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/language.h | 1 + Marlin/src/lcd/language/language_de.h | 2 +- Marlin/src/lcd/language/language_en.h | 7 +- Marlin/src/lcd/language/language_es.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_ro.h | 6 +- Marlin/src/lcd/language/language_ru.h | 2 +- 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_zh_CN.h | 6 +- Marlin/src/lcd/language/language_zh_TW.h | 4 +- Marlin/src/lcd/marlinui.cpp | 24 +-- Marlin/src/lcd/marlinui.h | 11 +- Marlin/src/module/settings.cpp | 213 +++++++++++++++++------ Marlin/src/module/settings.h | 19 +- 19 files changed, 210 insertions(+), 101 deletions(-) diff --git a/Marlin/src/core/language.h b/Marlin/src/core/language.h index 388e7cd820e11..521fcfca3ec97 100644 --- a/Marlin/src/core/language.h +++ b/Marlin/src/core/language.h @@ -193,6 +193,7 @@ #define STR_ERR_LONG_EXTRUDE_STOP " too long extrusion prevented" #define STR_ERR_HOTEND_TOO_COLD "Hotend too cold" #define STR_ERR_EEPROM_WRITE "Error writing to EEPROM!" +#define STR_ERR_EEPROM_CORRUPT "EEPROM Corrupt" #define STR_FILAMENT_CHANGE_HEAT_LCD "Press button to heat nozzle" #define STR_FILAMENT_CHANGE_INSERT_LCD "Insert filament and press button" diff --git a/Marlin/src/lcd/language/language_de.h b/Marlin/src/lcd/language/language_de.h index 534d49ade9e9f..359afd8ad2ae0 100644 --- a/Marlin/src/lcd/language/language_de.h +++ b/Marlin/src/lcd/language/language_de.h @@ -414,7 +414,7 @@ namespace Language_de { LSTR MSG_RESTORE_DEFAULTS = _UxGT("Standardwerte laden"); LSTR MSG_INIT_EEPROM = _UxGT("Werkseinstellungen"); LSTR MSG_ERR_EEPROM_CRC = _UxGT("EEPROM CRC Fehler"); - LSTR MSG_ERR_EEPROM_INDEX = _UxGT("EEPROM Index Fehler"); + LSTR MSG_ERR_EEPROM_SIZE = _UxGT("EEPROM Größe Fehler"); LSTR MSG_ERR_EEPROM_VERSION = _UxGT("EEPROM Version Fehler"); LSTR MSG_SETTINGS_STORED = _UxGT("Einstell. gespei."); LSTR MSG_MEDIA_UPDATE = _UxGT("FW Update vom Medium"); diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index bc97407fc22be..568ad49df0b12 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -457,9 +457,10 @@ namespace Language_en { LSTR MSG_LOAD_EEPROM = _UxGT("Load Settings"); LSTR MSG_RESTORE_DEFAULTS = _UxGT("Restore Defaults"); LSTR MSG_INIT_EEPROM = _UxGT("Initialize EEPROM"); - LSTR MSG_ERR_EEPROM_CRC = _UxGT("EEPROM CRC Error"); - LSTR MSG_ERR_EEPROM_INDEX = _UxGT("EEPROM Index Error"); - LSTR MSG_ERR_EEPROM_VERSION = _UxGT("EEPROM Version Error"); + LSTR MSG_ERR_EEPROM_CRC = _UxGT("Err: EEPROM CRC"); + LSTR MSG_ERR_EEPROM_SIZE = _UxGT("Err: EEPROM Size"); + LSTR MSG_ERR_EEPROM_VERSION = _UxGT("Err: EEPROM Version"); + LSTR MSG_ERR_EEPROM_CORRUPT = _UxGT("Err: EEPROM Corrupt"); LSTR MSG_SETTINGS_STORED = _UxGT("Settings Stored"); LSTR MSG_MEDIA_UPDATE = MEDIA_TYPE_EN _UxGT(" Update"); LSTR MSG_RESET_PRINTER = _UxGT("Reset Printer"); diff --git a/Marlin/src/lcd/language/language_es.h b/Marlin/src/lcd/language/language_es.h index f3d6fc577d51e..b2e5af70f5262 100644 --- a/Marlin/src/lcd/language/language_es.h +++ b/Marlin/src/lcd/language/language_es.h @@ -315,7 +315,7 @@ namespace Language_es { LSTR MSG_RESTORE_DEFAULTS = _UxGT("Rest. fábrica"); LSTR MSG_INIT_EEPROM = _UxGT("Inicializar EEPROM"); LSTR MSG_ERR_EEPROM_CRC = _UxGT("Err: EEPROM CRC"); - LSTR MSG_ERR_EEPROM_INDEX = _UxGT("Err: Índice EEPROM"); + LSTR MSG_ERR_EEPROM_SIZE = _UxGT("Err: EEPROM Tamaño"); LSTR MSG_ERR_EEPROM_VERSION = _UxGT("Err: Versión EEPROM"); LSTR MSG_MEDIA_UPDATE = _UxGT("Actualizar SD/FD"); LSTR MSG_RESET_PRINTER = _UxGT("Resetear Impresora"); diff --git a/Marlin/src/lcd/language/language_gl.h b/Marlin/src/lcd/language/language_gl.h index 83855dd56d8a9..fcdee2405c418 100644 --- a/Marlin/src/lcd/language/language_gl.h +++ b/Marlin/src/lcd/language/language_gl.h @@ -317,7 +317,7 @@ namespace Language_gl { LSTR MSG_RESTORE_DEFAULTS = _UxGT("Rest. Defecto"); LSTR MSG_INIT_EEPROM = _UxGT("Inicializar EEPROM"); LSTR MSG_ERR_EEPROM_CRC = _UxGT("Erro: CRC EEPROM"); - LSTR MSG_ERR_EEPROM_INDEX = _UxGT("Erro: Índice EEPROM"); + LSTR MSG_ERR_EEPROM_SIZE = _UxGT("Erro: Tamaño EEPROM"); LSTR MSG_ERR_EEPROM_VERSION = _UxGT("Erro: Versión EEPROM"); LSTR MSG_SETTINGS_STORED = _UxGT("Config Gardada"); LSTR MSG_MEDIA_UPDATE = _UxGT("Actualizar SD/FD"); diff --git a/Marlin/src/lcd/language/language_hu.h b/Marlin/src/lcd/language/language_hu.h index 99062ca5c3425..8a6f66f9941a2 100644 --- a/Marlin/src/lcd/language/language_hu.h +++ b/Marlin/src/lcd/language/language_hu.h @@ -363,7 +363,7 @@ namespace Language_hu { LSTR MSG_RESTORE_DEFAULTS = _UxGT("Alapértelmezett"); LSTR MSG_INIT_EEPROM = _UxGT("EEPROM inicializálás"); LSTR MSG_ERR_EEPROM_CRC = _UxGT("Hiba: EEPROM CRC"); - LSTR MSG_ERR_EEPROM_INDEX = _UxGT("Hiba: EEPROM index"); + LSTR MSG_ERR_EEPROM_SIZE = _UxGT("Hiba: EEPROM mérete"); LSTR MSG_ERR_EEPROM_VERSION = _UxGT("Hiba: EEPROM verzió"); LSTR MSG_SETTINGS_STORED = _UxGT("Beállítások mentve"); LSTR MSG_MEDIA_UPDATE = _UxGT("Tároló frissítés"); diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index bd0d2f22576a5..96c1499f558e9 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -451,7 +451,7 @@ namespace Language_it { LSTR MSG_RESTORE_DEFAULTS = _UxGT("Ripristina imp."); LSTR MSG_INIT_EEPROM = _UxGT("Inizializza EEPROM"); LSTR MSG_ERR_EEPROM_CRC = _UxGT("Err: CRC EEPROM"); - LSTR MSG_ERR_EEPROM_INDEX = _UxGT("Err: Indice EEPROM"); + LSTR MSG_ERR_EEPROM_SIZE = _UxGT("Err: Taglia EEPROM"); LSTR MSG_ERR_EEPROM_VERSION = _UxGT("Err: Versione EEPROM"); LSTR MSG_SETTINGS_STORED = _UxGT("Impostazioni mem."); LSTR MSG_MEDIA_UPDATE = _UxGT("Aggiorna media"); diff --git a/Marlin/src/lcd/language/language_ro.h b/Marlin/src/lcd/language/language_ro.h index 327ba7ad814a6..75f27c1ecf9b1 100644 --- a/Marlin/src/lcd/language/language_ro.h +++ b/Marlin/src/lcd/language/language_ro.h @@ -317,9 +317,9 @@ namespace Language_ro { LSTR MSG_LOAD_EEPROM = _UxGT("Load Settings"); LSTR MSG_RESTORE_DEFAULTS = _UxGT("Restore Defaults"); LSTR MSG_INIT_EEPROM = _UxGT("Initialize EEPROM"); - LSTR MSG_ERR_EEPROM_CRC = _UxGT("EEPROM CRC Error"); - LSTR MSG_ERR_EEPROM_INDEX = _UxGT("EEPROM Index Error"); - LSTR MSG_ERR_EEPROM_VERSION = _UxGT("EEPROM Version Error"); + LSTR MSG_ERR_EEPROM_CRC = _UxGT("Err: EEPROM CRC"); + LSTR MSG_ERR_EEPROM_SIZE = _UxGT("Err: Mărimea EEPROM"); + LSTR MSG_ERR_EEPROM_VERSION = _UxGT("Err: Versiunea EEPROM"); LSTR MSG_SETTINGS_STORED = _UxGT("Settings Stored"); LSTR MSG_MEDIA_UPDATE = _UxGT("Media Update"); LSTR MSG_RESET_PRINTER = _UxGT("Reset Imprimanta"); diff --git a/Marlin/src/lcd/language/language_ru.h b/Marlin/src/lcd/language/language_ru.h index b5815be1bd2ed..25f62173f3504 100644 --- a/Marlin/src/lcd/language/language_ru.h +++ b/Marlin/src/lcd/language/language_ru.h @@ -452,7 +452,7 @@ namespace Language_ru { LSTR MSG_INIT_EEPROM = _UxGT("Инициализ. EEPROM"); #endif LSTR MSG_ERR_EEPROM_CRC = _UxGT("Сбой EEPROM: CRC"); - LSTR MSG_ERR_EEPROM_INDEX = _UxGT("Сбой EEPROM: индекс"); + LSTR MSG_ERR_EEPROM_SIZE = _UxGT("Сбой EEPROM: размер"); LSTR MSG_ERR_EEPROM_VERSION = _UxGT("Сбой EEPROM: версия"); LSTR MSG_SETTINGS_STORED = _UxGT("Параметры сохранены"); LSTR MSG_MEDIA_UPDATE = _UxGT("Обновление прошивки"); diff --git a/Marlin/src/lcd/language/language_sk.h b/Marlin/src/lcd/language/language_sk.h index 907b865bd9e6e..572e7fe9eaf82 100644 --- a/Marlin/src/lcd/language/language_sk.h +++ b/Marlin/src/lcd/language/language_sk.h @@ -452,7 +452,7 @@ namespace Language_sk { LSTR MSG_RESTORE_DEFAULTS = _UxGT("Obnoviť nastavenie"); LSTR MSG_INIT_EEPROM = _UxGT("Inicializ. EEPROM"); LSTR MSG_ERR_EEPROM_CRC = _UxGT("Chyba: EEPROM CRC"); - LSTR MSG_ERR_EEPROM_INDEX = _UxGT("Chyba: EEPROM Index"); + LSTR MSG_ERR_EEPROM_SIZE = _UxGT("Chyba: Veľkosť EEPROM"); LSTR MSG_ERR_EEPROM_VERSION = _UxGT("Chyba: Verzia EEPROM"); LSTR MSG_SETTINGS_STORED = _UxGT("Nastavenie uložené"); LSTR MSG_MEDIA_UPDATE = _UxGT("Aktualiz. z karty"); diff --git a/Marlin/src/lcd/language/language_sv.h b/Marlin/src/lcd/language/language_sv.h index 570bc3df8dab7..d264c1e6e2897 100644 --- a/Marlin/src/lcd/language/language_sv.h +++ b/Marlin/src/lcd/language/language_sv.h @@ -348,7 +348,7 @@ namespace Language_sv { LSTR MSG_RESTORE_DEFAULTS = _UxGT("Återställ Standard"); LSTR MSG_INIT_EEPROM = _UxGT("Initiera EEPROM"); LSTR MSG_ERR_EEPROM_CRC = _UxGT("EEPROM CRC Fel"); - LSTR MSG_ERR_EEPROM_INDEX = _UxGT("EEPROM Index Fel"); + LSTR MSG_ERR_EEPROM_SIZE = _UxGT("EEPROM Storlek Fel"); LSTR MSG_ERR_EEPROM_VERSION = _UxGT("EEPROM Version Fel"); LSTR MSG_SETTINGS_STORED = _UxGT("Inställningar Lagrad"); LSTR MSG_MEDIA_UPDATE = _UxGT("Media Uppdatera"); diff --git a/Marlin/src/lcd/language/language_tr.h b/Marlin/src/lcd/language/language_tr.h index 105413723032b..5fc78758d4f13 100644 --- a/Marlin/src/lcd/language/language_tr.h +++ b/Marlin/src/lcd/language/language_tr.h @@ -431,7 +431,7 @@ namespace Language_tr { LSTR MSG_RESTORE_DEFAULTS = _UxGT("Fabrika Ayarları"); LSTR MSG_INIT_EEPROM = _UxGT("EEPROM'u başlat"); LSTR MSG_ERR_EEPROM_CRC = _UxGT("Hata: EEPROM CRC"); - LSTR MSG_ERR_EEPROM_INDEX = _UxGT("Hata: EEPROM Indeks"); + LSTR MSG_ERR_EEPROM_SIZE = _UxGT("Hata: EEPROM Boyutu"); LSTR MSG_ERR_EEPROM_VERSION = _UxGT("Hata: EEPROM Sürümü"); LSTR MSG_SETTINGS_STORED = _UxGT("Ayarlar Kaydedildi"); LSTR MSG_MEDIA_UPDATE = _UxGT("SD Güncellemesi"); diff --git a/Marlin/src/lcd/language/language_uk.h b/Marlin/src/lcd/language/language_uk.h index 4ee32fe4bc6ad..3a644a0b34c91 100644 --- a/Marlin/src/lcd/language/language_uk.h +++ b/Marlin/src/lcd/language/language_uk.h @@ -465,7 +465,7 @@ namespace Language_uk { LSTR MSG_INIT_EEPROM = _UxGT("Ініціаліз. EEPROM"); #endif LSTR MSG_ERR_EEPROM_CRC = _UxGT("Збій EEPROM: CRC"); - LSTR MSG_ERR_EEPROM_INDEX = _UxGT("Збій EEPROM: індекс"); + LSTR MSG_ERR_EEPROM_SIZE = _UxGT("Збій EEPROM: розмір"); LSTR MSG_ERR_EEPROM_VERSION = _UxGT("Збій EEPROM: версія"); LSTR MSG_SETTINGS_STORED = _UxGT("Параметри збережені"); LSTR MSG_MEDIA_UPDATE = _UxGT("Оновити SD-картку"); diff --git a/Marlin/src/lcd/language/language_zh_CN.h b/Marlin/src/lcd/language/language_zh_CN.h index 27f2a597c6dfd..7acd0d8e8f494 100644 --- a/Marlin/src/lcd/language/language_zh_CN.h +++ b/Marlin/src/lcd/language/language_zh_CN.h @@ -317,9 +317,9 @@ namespace Language_zh_CN { LSTR MSG_LOAD_EEPROM = _UxGT("装载设置"); // "Load memory" LSTR MSG_RESTORE_DEFAULTS = _UxGT("恢复安全值"); // "Restore Defaults" LSTR MSG_INIT_EEPROM = _UxGT("初始化设置"); // "Initialize EEPROM" - LSTR MSG_ERR_EEPROM_CRC = _UxGT("EEPROM CRC 错误"); - LSTR MSG_ERR_EEPROM_INDEX = _UxGT("EEPROM Index 错误"); - LSTR MSG_ERR_EEPROM_VERSION = _UxGT("EEPROM Version 错误"); + LSTR MSG_ERR_EEPROM_CRC = _UxGT("EEPROM 校验和 错误"); + LSTR MSG_ERR_EEPROM_SIZE = _UxGT("EEPROM 尺寸 错误"); + LSTR MSG_ERR_EEPROM_VERSION = _UxGT("EEPROM 版本 错误"); LSTR MSG_SETTINGS_STORED = _UxGT("设置已保存"); LSTR MSG_MEDIA_UPDATE = _UxGT("存储器更新"); LSTR MSG_RESET_PRINTER = _UxGT("复位打印机"); diff --git a/Marlin/src/lcd/language/language_zh_TW.h b/Marlin/src/lcd/language/language_zh_TW.h index 570dc292c5879..9365225cae85f 100644 --- a/Marlin/src/lcd/language/language_zh_TW.h +++ b/Marlin/src/lcd/language/language_zh_TW.h @@ -299,8 +299,8 @@ namespace Language_zh_TW { LSTR MSG_RESTORE_DEFAULTS = _UxGT("恢復安全值"); // "Restore failsafe" LSTR MSG_INIT_EEPROM = _UxGT("初始化設置"); // "Initialize EEPROM" LSTR MSG_ERR_EEPROM_CRC = _UxGT("錯誤: EEPROM CRC"); // "Err: EEPROM CRC" - LSTR MSG_ERR_EEPROM_INDEX = _UxGT("錯誤: EEPROM Index"); // "Err: EEPROM Index" - LSTR MSG_ERR_EEPROM_VERSION = _UxGT("錯誤: EEPROM Version"); // "EEPROM Version" + LSTR MSG_ERR_EEPROM_SIZE = _UxGT("錯誤: EEPROM 尺寸"); // "Err: EEPROM Index" + LSTR MSG_ERR_EEPROM_VERSION = _UxGT("錯誤: EEPROM 版本"); // "EEPROM Version" LSTR MSG_MEDIA_UPDATE = _UxGT("媒體更新"); // "Media Update" LSTR MSG_RESET_PRINTER = _UxGT("重置打印機"); // "Reset Printer LSTR MSG_REFRESH = _UxGT("刷新"); // "Refresh" diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index e8956ab9e1500..1c4bbe5fa93bc 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -1913,18 +1913,22 @@ void MarlinUI::init() { #if DISABLED(EEPROM_AUTO_INIT) - static inline FSTR_P eeprom_err(const uint8_t msgid) { - switch (msgid) { - default: - 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); + static inline FSTR_P eeprom_err(const EEPROM_Error err) { + switch (err) { + case ERR_EEPROM_VERSION: return GET_TEXT_F(MSG_ERR_EEPROM_VERSION); + case ERR_EEPROM_SIZE: return GET_TEXT_F(MSG_ERR_EEPROM_SIZE); + case ERR_EEPROM_CRC: return GET_TEXT_F(MSG_ERR_EEPROM_CRC); + case ERR_EEPROM_CORRUPT: return GET_TEXT_F(MSG_ERR_EEPROM_CORRUPT); + default: return nullptr; } } - void MarlinUI::eeprom_alert(const uint8_t msgid) { + void MarlinUI::eeprom_alert(const EEPROM_Error err) { + FSTR_P const err_msg = eeprom_err(err); + set_status(err_msg); + TERN_(HOST_PROMPT_SUPPORT, hostui.notify(err_msg)); #if HAS_MARLINUI_MENU - editable.uint8 = msgid; + editable.uint8 = err; goto_screen([]{ FSTR_P const restore_msg = GET_TEXT_F(MSG_INIT_EEPROM); char msg[utf8_strlen(restore_msg) + 1]; @@ -1932,11 +1936,9 @@ void MarlinUI::init() { MenuItem_confirm::select_screen( GET_TEXT_F(MSG_BUTTON_RESET), GET_TEXT_F(MSG_BUTTON_IGNORE), init_eeprom, return_to_status, - eeprom_err(editable.uint8), msg, F("?") + eeprom_err((EEPROM_Error)editable.uint8), msg, F("?") ); }); - #else - set_status(eeprom_err(msgid)); #endif } diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index 9c5e192fb2707..ccdbd64322809 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -27,6 +27,10 @@ #include "../libs/buzzer.h" #include "buttons.h" +#if ENABLED(EEPROM_SETTINGS) + #include "../module/settings.h" +#endif + #if ENABLED(TOUCH_SCREEN_CALIBRATION) #include "tft_io/touch_calibration.h" #endif @@ -674,12 +678,7 @@ class MarlinUI { static void load_settings(); static void store_settings(); #endif - #if DISABLED(EEPROM_AUTO_INIT) - static void eeprom_alert(const uint8_t msgid); - static void eeprom_alert_crc() { eeprom_alert(0); } - static void eeprom_alert_index() { eeprom_alert(1); } - static void eeprom_alert_version() { eeprom_alert(2); } - #endif + static void eeprom_alert(const EEPROM_Error) TERN_(EEPROM_AUTO_INIT, {}); #endif // diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 58e00b7fb0e81..28eee57c086f3 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -36,12 +36,13 @@ */ // Change EEPROM version if the structure changes -#define EEPROM_VERSION "V87" +#define EEPROM_VERSION "V88" #define EEPROM_OFFSET 100 // Check the integrity of data offsets. // Can be disabled for production build. //#define DEBUG_EEPROM_READWRITE +//#define DEBUG_EEPROM_OBSERVE #include "settings.h" @@ -211,7 +212,8 @@ typedef struct SettingsDataStruct { #if ENABLED(EEPROM_INIT_NOW) uint32_t build_hash; // Unique build hash #endif - uint16_t crc; // Data Checksum + uint16_t crc; // Data Checksum for validation + uint16_t data_size; // Data Size for validation // // DISTINCT_E_FACTORS @@ -264,6 +266,7 @@ typedef struct SettingsDataStruct { // float mbl_z_offset; // bedlevel.z_offset uint8_t mesh_num_x, mesh_num_y; // GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y + uint16_t mesh_check; // Hash to check against X/Y 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)]; @@ -283,6 +286,7 @@ typedef struct SettingsDataStruct { // AUTO_BED_LEVELING_BILINEAR // uint8_t grid_max_x, grid_max_y; // GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y + uint16_t grid_check; // Hash to check against X/Y xy_pos_t bilinear_grid_spacing, bilinear_start; // G29 L F #if ENABLED(AUTO_BED_LEVELING_BILINEAR) bed_mesh_t z_values; // G29 @@ -744,10 +748,13 @@ void MarlinSettings::postprocess() { #if ENABLED(EEPROM_SETTINGS) - #define EEPROM_ASSERT(TST,ERR) do{ if (!(TST)) { SERIAL_ERROR_MSG(ERR); eeprom_error = true; } }while(0) + #define EEPROM_ASSERT(TST,ERR) do{ if (!(TST)) { SERIAL_ERROR_MSG(ERR); eeprom_error = ERR_EEPROM_SIZE; } }while(0) + + #define TWO_BYTE_HASH(A,B) uint16_t((uint16_t(A ^ 0xC3) << 4) ^ (uint16_t(B ^ 0xC3) << 12)) #if ENABLED(DEBUG_EEPROM_READWRITE) #define _FIELD_TEST(FIELD) \ + SERIAL_ECHOLNPGM("Field: " STRINGIFY(FIELD)); \ EEPROM_ASSERT( \ eeprom_error || eeprom_index == offsetof(SettingsData, FIELD) + EEPROM_OFFSET, \ "Field " STRINGIFY(FIELD) " mismatch." \ @@ -756,6 +763,14 @@ void MarlinSettings::postprocess() { #define _FIELD_TEST(FIELD) NOOP #endif + #if ENABLED(DEBUG_EEPROM_OBSERVE) + #define EEPROM_READ(V...) do{ SERIAL_ECHOLNPGM("READ: ", F(STRINGIFY(FIRST(V)))); EEPROM_READ_(V); }while(0) + #define EEPROM_READ_ALWAYS(V...) do{ SERIAL_ECHOLNPGM("READ: ", F(STRINGIFY(FIRST(V)))); EEPROM_READ_ALWAYS_(V); }while(0) + #else + #define EEPROM_READ(V...) EEPROM_READ_(V) + #define EEPROM_READ_ALWAYS(V...) EEPROM_READ_ALWAYS_(V) + #endif + const char version[4] = EEPROM_VERSION; #if ENABLED(EEPROM_INIT_NOW) @@ -765,20 +780,20 @@ void MarlinSettings::postprocess() { constexpr uint32_t build_hash = strhash32(__DATE__ __TIME__); #endif - bool MarlinSettings::eeprom_error, MarlinSettings::validating; + bool MarlinSettings::validating; int MarlinSettings::eeprom_index; uint16_t MarlinSettings::working_crc; - bool MarlinSettings::size_error(const uint16_t size) { + EEPROM_Error MarlinSettings::size_error(const uint16_t size) { if (size != datasize()) { DEBUG_ERROR_MSG("EEPROM datasize error." #if ENABLED(MARLIN_DEV_MODE) " (Actual:", size, " Expected:", datasize(), ")" #endif ); - return true; + return ERR_EEPROM_SIZE; } - return false; + return ERR_EEPROM_NOERR; } /** @@ -790,18 +805,25 @@ void MarlinSettings::postprocess() { if (!EEPROM_START(EEPROM_OFFSET)) return false; - eeprom_error = false; + EEPROM_Error eeprom_error = ERR_EEPROM_NOERR; // Write or Skip version. (Flash doesn't allow rewrite without erase.) TERN(FLASH_EEPROM_EMULATION, EEPROM_SKIP, EEPROM_WRITE)(ver); #if ENABLED(EEPROM_INIT_NOW) - EEPROM_SKIP(build_hash); // Skip the hash slot + EEPROM_SKIP(build_hash); // Skip the hash slot which will be written later #endif EEPROM_SKIP(working_crc); // Skip the checksum slot - working_crc = 0; // clear before first "real data" + // + // Clear after skipping CRC and before writing the CRC'ed data + // + working_crc = 0; + + // Write the size of the data structure for use in validation + const uint16_t data_size = datasize(); + EEPROM_WRITE(data_size); const uint8_t e_factors = DISTINCT_AXES - (NUM_AXES); _FIELD_TEST(e_factors); @@ -915,6 +937,10 @@ void MarlinSettings::postprocess() { EEPROM_WRITE(mesh_num_x); EEPROM_WRITE(mesh_num_y); + // Check value for the X/Y values + const uint16_t mesh_check = TWO_BYTE_HASH(mesh_num_x, mesh_num_y); + EEPROM_WRITE(mesh_check); + #if ENABLED(MESH_BED_LEVELING) EEPROM_WRITE(bedlevel.z_values); #else @@ -964,6 +990,11 @@ void MarlinSettings::postprocess() { grid_max_y = TERN(AUTO_BED_LEVELING_BILINEAR, GRID_MAX_POINTS_Y, 3); EEPROM_WRITE(grid_max_x); EEPROM_WRITE(grid_max_y); + + // Check value for the X/Y values + const uint16_t grid_check = TWO_BYTE_HASH(grid_max_x, grid_max_y); + EEPROM_WRITE(grid_check); + #if ENABLED(AUTO_BED_LEVELING_BILINEAR) EEPROM_WRITE(bedlevel.grid_spacing); EEPROM_WRITE(bedlevel.grid_start); @@ -1684,7 +1715,7 @@ void MarlinSettings::postprocess() { // // Report final CRC and Data Size // - if (!eeprom_error) { + if (eeprom_error == ERR_EEPROM_NOERR) { const uint16_t eeprom_size = eeprom_index - (EEPROM_OFFSET), final_crc = working_crc; @@ -1700,7 +1731,7 @@ void MarlinSettings::postprocess() { // Report storage size DEBUG_ECHO_MSG("Settings Stored (", eeprom_size, " bytes; crc ", (uint32_t)final_crc, ")"); - eeprom_error |= size_error(eeprom_size); + eeprom_error = size_error(eeprom_size); } EEPROM_FINISH(); @@ -1712,56 +1743,82 @@ void MarlinSettings::postprocess() { store_mesh(bedlevel.storage_slot); #endif - if (!eeprom_error) { + const bool success = (eeprom_error == ERR_EEPROM_NOERR); + if (success) { LCD_MESSAGE(MSG_SETTINGS_STORED); TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_SETTINGS_STORED))); } - TERN_(EXTENSIBLE_UI, ExtUI::onSettingsStored(!eeprom_error)); + TERN_(EXTENSIBLE_UI, ExtUI::onSettingsStored(success)); - return !eeprom_error; + return success; } /** * M501 - Retrieve Configuration */ - bool MarlinSettings::_load() { - if (!EEPROM_START(EEPROM_OFFSET)) return false; + EEPROM_Error MarlinSettings::_load() { + EEPROM_Error eeprom_error = ERR_EEPROM_NOERR; + + if (!EEPROM_START(EEPROM_OFFSET)) return eeprom_error; char stored_ver[4]; EEPROM_READ_ALWAYS(stored_ver); - // Version has to match or defaults are used - if (strncmp(version, stored_ver, 3) != 0) { - if (stored_ver[3] != '\0') { - stored_ver[0] = '?'; - stored_ver[1] = '\0'; - } - DEBUG_ECHO_MSG("EEPROM version mismatch (EEPROM=", stored_ver, " Marlin=" EEPROM_VERSION ")"); - LCD_MESSAGE(MSG_ERR_EEPROM_VERSION); - TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_ERR_EEPROM_VERSION))); + uint16_t stored_crc; - IF_DISABLED(EEPROM_AUTO_INIT, ui.eeprom_alert_version()); - eeprom_error = true; - } - else { + do { // A block to break out of on error + + // Version has to match or defaults are used + if (strncmp(version, stored_ver, 3) != 0) { + if (stored_ver[3] != '\0') { + stored_ver[0] = '?'; + stored_ver[1] = '\0'; + } + DEBUG_ECHO_MSG("EEPROM version mismatch (EEPROM=", stored_ver, " Marlin=" EEPROM_VERSION ")"); + eeprom_error = ERR_EEPROM_VERSION; + break; + } - // Optionally reset on the first boot after flashing + // + // Optionally reset on first boot after flashing + // #if ENABLED(EEPROM_INIT_NOW) uint32_t stored_hash; EEPROM_READ_ALWAYS(stored_hash); - if (stored_hash != build_hash) { EEPROM_FINISH(); return false; } + if (stored_hash != build_hash) { + eeprom_error = ERR_EEPROM_CORRUPT; + break; + } #endif - uint16_t stored_crc; + // + // Get the stored CRC to compare at the end + // EEPROM_READ_ALWAYS(stored_crc); + // + // A temporary float for safe storage + // float dummyf = 0; - working_crc = 0; // Init to 0. Accumulated by EEPROM_READ - _FIELD_TEST(e_factors); + // + // Init to 0. Accumulated by EEPROM_READ + // + working_crc = 0; + // + // Validate the stored size against the current data structure size + // + uint16_t stored_size; + EEPROM_READ_ALWAYS(stored_size); + if ((eeprom_error = size_error(stored_size))) break; + + // + // Extruder Parameter Count // Number of e_factors may change + // + _FIELD_TEST(e_factors); uint8_t e_factors; EEPROM_READ_ALWAYS(e_factors); @@ -1872,16 +1929,28 @@ void MarlinSettings::postprocess() { // { uint8_t mesh_num_x, mesh_num_y; + uint16_t mesh_check; EEPROM_READ(dummyf); EEPROM_READ_ALWAYS(mesh_num_x); EEPROM_READ_ALWAYS(mesh_num_y); + // Check value must correspond to the X/Y values + EEPROM_READ_ALWAYS(mesh_check); + if (mesh_check != TWO_BYTE_HASH(mesh_num_x, mesh_num_y)) { + eeprom_error = ERR_EEPROM_CORRUPT; + break; + } + #if ENABLED(MESH_BED_LEVELING) 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(bedlevel.z_values); } + else if (mesh_num_x > (GRID_MAX_POINTS_X) || mesh_num_y > (GRID_MAX_POINTS_Y)) { + eeprom_error = ERR_EEPROM_CORRUPT; + break; + } else { // EEPROM data is stale if (!validating) bedlevel.reset(); @@ -1926,6 +1995,15 @@ void MarlinSettings::postprocess() { uint8_t grid_max_x, grid_max_y; EEPROM_READ_ALWAYS(grid_max_x); // 1 byte EEPROM_READ_ALWAYS(grid_max_y); // 1 byte + + // Check value must correspond to the X/Y values + uint16_t grid_check; + EEPROM_READ_ALWAYS(grid_check); + if (grid_check != TWO_BYTE_HASH(grid_max_x, grid_max_y)) { + eeprom_error = ERR_EEPROM_CORRUPT; + break; + } + xy_pos_t spacing, start; EEPROM_READ(spacing); // 2 ints EEPROM_READ(start); // 2 ints @@ -1935,6 +2013,10 @@ void MarlinSettings::postprocess() { bedlevel.set_grid(spacing, start); EEPROM_READ(bedlevel.z_values); // 9 to 256 floats } + else if (grid_max_x > (GRID_MAX_POINTS_X) || grid_max_y > (GRID_MAX_POINTS_Y)) { + eeprom_error = ERR_EEPROM_CORRUPT; + break; + } else // EEPROM data is stale #endif // AUTO_BED_LEVELING_BILINEAR { @@ -2700,27 +2782,22 @@ void MarlinSettings::postprocess() { // // Validate Final Size and CRC // - eeprom_error = size_error(eeprom_index - (EEPROM_OFFSET)); - if (eeprom_error) { - DEBUG_ECHO_MSG("Index: ", eeprom_index - (EEPROM_OFFSET), " Size: ", datasize()); - IF_DISABLED(EEPROM_AUTO_INIT, ui.eeprom_alert_index()); + const uint16_t eeprom_total = eeprom_index - (EEPROM_OFFSET); + if ((eeprom_error = size_error(eeprom_total))) { + // Handle below and on return + break; } else if (working_crc != stored_crc) { - eeprom_error = true; - DEBUG_ERROR_MSG("EEPROM CRC mismatch - (stored) ", stored_crc, " != ", working_crc, " (calculated)!"); - LCD_MESSAGE(MSG_ERR_EEPROM_CRC); - TERN_(HOST_EEPROM_CHITCHAT, hostui.notify(GET_TEXT_F(MSG_ERR_EEPROM_CRC))); - IF_DISABLED(EEPROM_AUTO_INIT, ui.eeprom_alert_crc()); + eeprom_error = ERR_EEPROM_CRC; + break; } else if (!validating) { DEBUG_ECHO_START(); DEBUG_ECHO(version); - DEBUG_ECHOLNPGM(" stored settings retrieved (", eeprom_index - (EEPROM_OFFSET), " bytes; crc ", (uint32_t)working_crc, ")"); + DEBUG_ECHOLNPGM(" stored settings retrieved (", eeprom_total, " bytes; crc ", working_crc, ")"); TERN_(HOST_EEPROM_CHITCHAT, hostui.notify(F("Stored settings retrieved"))); } - if (!validating && !eeprom_error) postprocess(); - #if ENABLED(AUTO_BED_LEVELING_UBL) if (!validating) { bedlevel.report_state(); @@ -2732,7 +2809,7 @@ void MarlinSettings::postprocess() { #endif } else { - eeprom_error = true; + eeprom_error = ERR_EEPROM_CORRUPT; #if BOTH(EEPROM_CHITCHAT, DEBUG_LEVELING_FEATURE) DEBUG_ECHOPGM("?Can't enable "); bedlevel.echo_name(); @@ -2751,6 +2828,26 @@ void MarlinSettings::postprocess() { } } #endif + + } while(0); + + EEPROM_FINISH(); + + switch (eeprom_error) { + case ERR_EEPROM_NOERR: + if (!validating) postprocess(); + break; + case ERR_EEPROM_SIZE: + DEBUG_ECHO_MSG("Index: ", eeprom_index - (EEPROM_OFFSET), " Size: ", datasize()); + break; + case ERR_EEPROM_CORRUPT: + DEBUG_ERROR_MSG(STR_ERR_EEPROM_CORRUPT); + break; + case ERR_EEPROM_CRC: + DEBUG_ERROR_MSG("EEPROM CRC mismatch - (stored) ", stored_crc, " != ", working_crc, " (calculated)!"); + TERN_(HOST_EEPROM_CHITCHAT, hostui.notify(GET_TEXT_F(MSG_ERR_EEPROM_CRC))); + break; + default: break; } #if ENABLED(EEPROM_CHITCHAT) && DISABLED(DISABLE_M503) @@ -2758,9 +2855,7 @@ void MarlinSettings::postprocess() { if (!validating && TERN1(EEPROM_BOOT_SILENT, IsRunning())) report(); #endif - EEPROM_FINISH(); - - return !eeprom_error; + return eeprom_error; } #ifdef ARCHIM2_SPI_FLASH_EEPROM_BACKUP_SIZE @@ -2770,21 +2865,25 @@ void MarlinSettings::postprocess() { bool MarlinSettings::validate() { validating = true; #ifdef ARCHIM2_SPI_FLASH_EEPROM_BACKUP_SIZE - bool success = _load(); - if (!success && restoreEEPROM()) { + EEPROM_Error err = _load(); + if (err != ERR_EEPROM_NOERR && restoreEEPROM()) { SERIAL_ECHOLNPGM("Recovered backup EEPROM settings from SPI Flash"); - success = _load(); + err = _load(); } #else - const bool success = _load(); + const EEPROM_Error err = _load(); #endif validating = false; - return success; + + if (err) ui.eeprom_alert(err); + + return (err == ERR_EEPROM_NOERR); } bool MarlinSettings::load() { if (validate()) { - const bool success = _load(); + const EEPROM_Error err = _load(); + const bool success = (err == ERR_EEPROM_NOERR); TERN_(EXTENSIBLE_UI, ExtUI::onSettingsLoaded(success)); return success; } diff --git a/Marlin/src/module/settings.h b/Marlin/src/module/settings.h index a8fca60baa12a..b7c5210db5b2f 100644 --- a/Marlin/src/module/settings.h +++ b/Marlin/src/module/settings.h @@ -29,6 +29,13 @@ #if ENABLED(EEPROM_SETTINGS) #include "../HAL/shared/eeprom_api.h" + enum EEPROM_Error : uint8_t { + ERR_EEPROM_NOERR, + ERR_EEPROM_VERSION, + ERR_EEPROM_SIZE, + ERR_EEPROM_CRC, + ERR_EEPROM_CORRUPT + }; #endif class MarlinSettings { @@ -98,7 +105,7 @@ class MarlinSettings { #if ENABLED(EEPROM_SETTINGS) - static bool eeprom_error, validating; + static bool validating; #if ENABLED(AUTO_BED_LEVELING_UBL) // Eventually make these available if any leveling system // That can store is enabled @@ -106,8 +113,8 @@ class MarlinSettings { // live at the very end of the eeprom #endif - static bool _load(); - static bool size_error(const uint16_t size); + static EEPROM_Error _load(); + static EEPROM_Error size_error(const uint16_t size); static int eeprom_index; static uint16_t working_crc; @@ -130,16 +137,16 @@ class MarlinSettings { } template - static void EEPROM_READ(T &VAR) { + static void EEPROM_READ_(T &VAR) { persistentStore.read_data(eeprom_index, (uint8_t *) &VAR, sizeof(VAR), &working_crc, !validating); } - static void EEPROM_READ(uint8_t *VAR, size_t sizeof_VAR) { + static void EEPROM_READ_(uint8_t *VAR, size_t sizeof_VAR) { persistentStore.read_data(eeprom_index, VAR, sizeof_VAR, &working_crc, !validating); } template - static void EEPROM_READ_ALWAYS(T &VAR) { + static void EEPROM_READ_ALWAYS_(T &VAR) { persistentStore.read_data(eeprom_index, (uint8_t *) &VAR, sizeof(VAR), &working_crc); } From 5ed307ceb807e745441da4c23888a6c7f53f934b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 20 May 2023 04:28:33 -0500 Subject: [PATCH 048/100] =?UTF-8?q?=F0=9F=93=9D=20MKS=20TinyBee=20pins=20h?= =?UTF-8?q?eader?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/esp32/pins_MKS_TINYBEE.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h b/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h index cfb682df54249..546fa82c0d9f8 100644 --- a/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h +++ b/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h @@ -22,10 +22,8 @@ #pragma once /** - * MRR ESPE pin assignments - * MRR ESPE is a 3D printer control board based on the ESP32 microcontroller. - * Supports 5 stepper drivers (using I2S stepper stream), heated bed, - * single hotend, and LCD controller. + * MKS TinyBee pin assignments + * https://github.com/makerbase-mks/MKS-TinyBee */ #include "env_validate.h" From 06b1f85514d9e738fa19d406f7cbc2a6c7240429 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sun, 21 May 2023 00:23:00 +0000 Subject: [PATCH 049/100] [cron] Bump distribution date (2023-05-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 8ea8917f48dc3..1986b74a024de 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 "2023-05-20" +//#define STRING_DISTRIBUTION_DATE "2023-05-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 8d6d94c448795..8c1880c6ff362 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 "2023-05-20" + #define STRING_DISTRIBUTION_DATE "2023-05-21" #endif /** From ea63ac8f4d2a5fc9d0501ebf979d115adcd42910 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 21 May 2023 08:38:42 -0500 Subject: [PATCH 050/100] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20TFT=20LVGL=20compi?= =?UTF-8?q?le=20error=20(#25865)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes regression from #24302 --- .github/workflows/test-builds.yml | 1 + Marlin/src/inc/SanityCheck.h | 6 +- .../extui/mks_ui/tft_lvgl_configuration.cpp | 5 +- Marlin/src/pins/gd32f1/pins_TRIGORILLA_V006.h | 2 +- Marlin/src/pins/linux/pins_RAMPS_LINUX.h | 8 +- .../src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h | 2 +- Marlin/src/pins/stm32f1/pins_CHITU3D_common.h | 16 ++-- Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h | 16 ++-- Marlin/src/pins/stm32f1/pins_FLY_MINI.h | 2 +- .../pins/stm32f1/pins_KEDI_CONTROLLER_V1_2.h | 2 +- Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h | 92 +++++++++---------- .../pins/stm32f1/pins_MINGDA_MPX_ARM_MINI.h | 2 +- Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h | 6 +- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h | 8 +- .../pins/stm32f1/pins_MKS_ROBIN_E3_common.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 | 6 +- .../src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h | 8 +- .../pins/stm32f1/pins_MKS_ROBIN_NANO_common.h | 6 +- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h | 14 +-- Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h | 2 +- .../stm32f4/pins_MKS_ROBIN_NANO_V3_common.h | 11 +-- .../src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h | 14 +-- Marlin/src/pins/stm32f4/pins_TRONXY_V10.h | 4 +- .../PlatformIO/scripts/download_mks_assets.py | 4 +- buildroot/tests/mks_robin_pro2 | 20 ++++ 27 files changed, 144 insertions(+), 119 deletions(-) create mode 100755 buildroot/tests/mks_robin_pro2 diff --git a/.github/workflows/test-builds.yml b/.github/workflows/test-builds.yml index dea1a4e176161..7ebbcd0066982 100644 --- a/.github/workflows/test-builds.yml +++ b/.github/workflows/test-builds.yml @@ -105,6 +105,7 @@ jobs: - FYSETC_S6 - LERDGEK - LERDGEX + - mks_robin_pro2 - Opulo_Lumen_REV3 - rumba32 - STM32F401RC_creality diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index f77bf7afeb7b8..78630051b67d9 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2629,10 +2629,8 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #if ENABLED(TFT_GENERIC) && NONE(TFT_INTERFACE_FSMC, TFT_INTERFACE_SPI) #error "TFT_GENERIC requires either TFT_INTERFACE_FSMC or TFT_INTERFACE_SPI interface." -#endif - -#if BOTH(TFT_INTERFACE_FSMC, TFT_INTERFACE_SPI) - #error "Please enable only one of TFT_INTERFACE_SPI or TFT_INTERFACE_SPI." +#elif BOTH(TFT_INTERFACE_FSMC, TFT_INTERFACE_SPI) + #error "Please enable only one of TFT_INTERFACE_FSMC or TFT_INTERFACE_SPI." #endif #if defined(LCD_SCREEN_ROTATE) && LCD_SCREEN_ROTATE != 0 && LCD_SCREEN_ROTATE != 90 && LCD_SCREEN_ROTATE != 180 && LCD_SCREEN_ROTATE != 270 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 94c3517e3a92b..be4682f68f1b3 100644 --- a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp +++ b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp @@ -138,7 +138,10 @@ void tft_lvgl_init() { uint16_t usb_flash_loop = 1000; #if ENABLED(MULTI_VOLUME) && !HAS_SD_HOST_DRIVE SET_INPUT_PULLUP(SD_DETECT_PIN); - card.changeMedia(IS_SD_INSERTED() ? &card.media_driver_sdcard : &card.media_driver_usbFlash); + if (IS_SD_INSERTED()) + card.changeMedia(&card.media_driver_sdcard); + else + card.changeMedia(&card.media_driver_usbFlash); #endif do { card.media_driver_usbFlash.idle(); diff --git a/Marlin/src/pins/gd32f1/pins_TRIGORILLA_V006.h b/Marlin/src/pins/gd32f1/pins_TRIGORILLA_V006.h index ee4376c50a9ac..abdd35f058078 100644 --- a/Marlin/src/pins/gd32f1/pins_TRIGORILLA_V006.h +++ b/Marlin/src/pins/gd32f1/pins_TRIGORILLA_V006.h @@ -122,7 +122,7 @@ // // SPI // - #define SPI_DEVICE -1 + #define SPI_DEVICE -1 // Maple #define SCK_PIN -1 #define MISO_PIN -1 #define MOSI_PIN -1 diff --git a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h b/Marlin/src/pins/linux/pins_RAMPS_LINUX.h index 950eb8d88f073..4f32304dde9d2 100644 --- a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h +++ b/Marlin/src/pins/linux/pins_RAMPS_LINUX.h @@ -381,8 +381,8 @@ #define TFT_CS_PIN 49 #define TFT_DC_PIN 43 #define TFT_SCK_PIN SD_SCK_PIN - #define TFT_MOSI_PIN SD_MOSI_PIN #define TFT_MISO_PIN SD_MISO_PIN + #define TFT_MOSI_PIN SD_MOSI_PIN #define LCD_USE_DMA_SPI #define BTN_EN1 40 @@ -396,12 +396,12 @@ #define SPI_FLASH #if ENABLED(SPI_FLASH) - #define SPI_DEVICE 1 + #define SPI_DEVICE 1 // Maple #define SPI_FLASH_SIZE 0x1000000 // 16MB #define SPI_FLASH_CS_PIN 31 - #define SPI_FLASH_MOSI_PIN SD_MOSI_PIN - #define SPI_FLASH_MISO_PIN SD_MISO_PIN #define SPI_FLASH_SCK_PIN SD_SCK_PIN + #define SPI_FLASH_MISO_PIN SD_MISO_PIN + #define SPI_FLASH_MOSI_PIN SD_MOSI_PIN #endif #define TFT_BUFFER_SIZE 0xFFFF 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 44a98e5af70ef..851eee8296b2d 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 @@ -273,7 +273,7 @@ #endif #if SD_CONNECTION_IS(LCD) - #define SPI_DEVICE 3 + #define SPI_DEVICE 3 // Maple #define SD_DETECT_PIN EXP2_07_PIN #define SD_SCK_PIN EXP2_02_PIN #define SD_MISO_PIN EXP2_01_PIN diff --git a/Marlin/src/pins/stm32f1/pins_CHITU3D_common.h b/Marlin/src/pins/stm32f1/pins_CHITU3D_common.h index 22f78350cf659..7452562c83fa3 100644 --- a/Marlin/src/pins/stm32f1/pins_CHITU3D_common.h +++ b/Marlin/src/pins/stm32f1/pins_CHITU3D_common.h @@ -113,18 +113,18 @@ #define FIL_RUNOUT_PIN PA15 // MT_DET #endif -// SPI Flash +// +// SPI Flash (SPI 2) +// #define SPI_FLASH #if ENABLED(SPI_FLASH) #define SPI_FLASH_SIZE 0x200000 // 2MB + #define SPI_FLASH_CS_PIN PB12 + #define SPI_FLASH_SCK_PIN PB13 + #define SPI_FLASH_MISO_PIN PB14 + #define SPI_FLASH_MOSI_PIN PB15 #endif -// SPI 2 -#define SPI_FLASH_CS_PIN PB12 -#define SPI_FLASH_MOSI_PIN PB15 -#define SPI_FLASH_MISO_PIN PB14 -#define SPI_FLASH_SCK_PIN PB13 - // // TFT with FSMC interface // @@ -160,7 +160,7 @@ // SPI1(PA7)=LCD & SPI3(PB5)=STUFF, are not available // so SPI2 is required. -#define SPI_DEVICE 2 +#define SPI_DEVICE 2 // Maple #define SD_SCK_PIN PB13 #define SD_MISO_PIN PB14 #define SD_MOSI_PIN PB15 diff --git a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h index fd6609f0fc70a..bdfe24cad0109 100644 --- a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h +++ b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h @@ -60,22 +60,26 @@ // // SPI -// Note: FLSun Hispeed (clone MKS_Robin_miniV2) board is using SPI2 interface. +// +#define SPI_DEVICE 2 // Maple + +// +// SD Card SPI // #define SD_SCK_PIN PB13 // SPI2 #define SD_MISO_PIN PB14 // SPI2 #define SD_MOSI_PIN PB15 // SPI2 -#define SPI_DEVICE 2 +// // SPI Flash +// #define SPI_FLASH #if ENABLED(SPI_FLASH) - // SPI 2 + #define SPI_FLASH_SIZE 0x1000000 // 16MB #define SPI_FLASH_CS_PIN PB12 // SPI2_NSS / Flash chip-select - #define SPI_FLASH_MOSI_PIN PB15 - #define SPI_FLASH_MISO_PIN PB14 #define SPI_FLASH_SCK_PIN PB13 - #define SPI_FLASH_SIZE 0x1000000 // 16MB + #define SPI_FLASH_MISO_PIN PB14 + #define SPI_FLASH_MOSI_PIN PB15 #endif // diff --git a/Marlin/src/pins/stm32f1/pins_FLY_MINI.h b/Marlin/src/pins/stm32f1/pins_FLY_MINI.h index e723845a2ae63..f7ef25419fd14 100644 --- a/Marlin/src/pins/stm32f1/pins_FLY_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_FLY_MINI.h @@ -152,7 +152,7 @@ // #if HAS_WIRED_LCD - #define SPI_DEVICE 2 + #define SPI_DEVICE 2 // Maple #define SD_SS_PIN EXP2_04_PIN #define SD_SCK_PIN EXP2_02_PIN #define SD_MISO_PIN EXP2_01_PIN diff --git a/Marlin/src/pins/stm32f1/pins_KEDI_CONTROLLER_V1_2.h b/Marlin/src/pins/stm32f1/pins_KEDI_CONTROLLER_V1_2.h index 9ea36e2f25003..494af83f59e17 100644 --- a/Marlin/src/pins/stm32f1/pins_KEDI_CONTROLLER_V1_2.h +++ b/Marlin/src/pins/stm32f1/pins_KEDI_CONTROLLER_V1_2.h @@ -280,7 +280,7 @@ #endif #if SD_CONNECTION_IS(LCD) - #define SPI_DEVICE 3 + #define SPI_DEVICE 3 // Maple #define SD_DETECT_PIN EXP2_04_PIN #define SD_SCK_PIN EXP2_09_PIN #define SD_MISO_PIN EXP2_10_PIN diff --git a/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h b/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h index 168317d8b57bb..d4f0ea7fd282b 100644 --- a/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h +++ b/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h @@ -35,18 +35,18 @@ #define BOARD_NO_NATIVE_USB -//#define DISABLE_DEBUG // We still want to debug with STLINK... -#define DISABLE_JTAG // We free the jtag pins (PA15) but keep STLINK - // Release PB4 (STEP_X_PIN) from JTAG NRST role. +//#define DISABLE_DEBUG // Allow debug with STLINK... +#define DISABLE_JTAG // We free the JTAG pins (PA15) but keep STLINK + // Release PB4 (STEP_X_PIN) from JTAG NRST role. // // Limit Switches // -#define X_MIN_PIN PC1 // pin 16 -#define X_MAX_PIN PC0 // pin 15 (Filament sensor on Alfawise setup) -#define Y_MIN_PIN PC15 // pin 9 -#define Y_MAX_PIN PC14 // pin 8 (Unused in stock Alfawise setup) -#define Z_MIN_PIN PE6 // pin 5 Standard Endstop or Z_Probe endstop function -#define Z_MAX_PIN PE5 // pin 4 (Unused in stock Alfawise setup) +#define X_MIN_PIN PC1 +#define X_MAX_PIN PC0 // (Filament sensor on Alfawise setup) +#define Y_MIN_PIN PC15 +#define Y_MAX_PIN PC14 // (Unused in stock Alfawise setup) +#define Z_MIN_PIN PE6 // Standard Endstop or Z_Probe endstop function +#define Z_MAX_PIN PE5 // (Unused in stock Alfawise setup) // May be used for BLTouch Servo function on older variants (<= V08) #define ONBOARD_ENDSTOPPULLUPS @@ -60,35 +60,35 @@ // // Steppers // -#define X_ENABLE_PIN PB5 // pin 91 -#define X_STEP_PIN PB4 // pin 90 -#define X_DIR_PIN PB3 // pin 89 +#define X_ENABLE_PIN PB5 +#define X_STEP_PIN PB4 +#define X_DIR_PIN PB3 -#define Y_ENABLE_PIN PB8 // pin 95 -#define Y_STEP_PIN PB7 // pin 93 -#define Y_DIR_PIN PB6 // pin 92 +#define Y_ENABLE_PIN PB8 +#define Y_STEP_PIN PB7 +#define Y_DIR_PIN PB6 -#define Z_ENABLE_PIN PE1 // pin 98 -#define Z_STEP_PIN PE0 // pin 97 -#define Z_DIR_PIN PB9 // pin 96 +#define Z_ENABLE_PIN PE1 +#define Z_STEP_PIN PE0 +#define Z_DIR_PIN PB9 -#define E0_ENABLE_PIN PE4 // pin 3 -#define E0_STEP_PIN PE3 // pin 2 -#define E0_DIR_PIN PE2 // pin 1 +#define E0_ENABLE_PIN PE4 +#define E0_STEP_PIN PE3 +#define E0_DIR_PIN PE2 // // Temperature Sensors // -#define TEMP_0_PIN PA0 // pin 23 (Nozzle 100K/3950 thermistor) -#define TEMP_BED_PIN PA1 // pin 24 (Hot Bed 100K/3950 thermistor) +#define TEMP_0_PIN PA0 // (Nozzle 100K/3950 thermistor) +#define TEMP_BED_PIN PA1 // (Hot Bed 100K/3950 thermistor) // // Heaters / Fans // -#define HEATER_0_PIN PD3 // pin 84 (Nozzle Heat Mosfet) -#define HEATER_BED_PIN PA8 // pin 67 (Hot Bed Mosfet) +#define HEATER_0_PIN PD3 // (Nozzle Heat Mosfet) +#define HEATER_BED_PIN PA8 // (Hot Bed Mosfet) -#define FAN0_PIN PA15 // pin 77 (4cm Fan) +#define FAN0_PIN PA15 // (4cm Fan) #if TERN(MAPLE_STM32F1, ENABLED(FAN_SOFT_PWM), ENABLED(FAST_PWM_FAN)) && FAN_MIN_PWM < 5 // Required to avoid issues with heating or STLink #error "FAN_MIN_PWM must be 5 or higher." // Fan will not start in 1-30 range @@ -104,10 +104,10 @@ #endif #endif -//#define BEEPER_PIN PD13 // pin 60 (Servo PWM output 5V/GND on Board V0G+) made for BL-Touch sensor +//#define BEEPER_PIN PD13 // (Servo PWM output 5V/GND on Board V0G+) made for BL-Touch sensor // Can drive a PC Buzzer, if connected between PWM and 5V pins -#define LED_PIN PC2 // pin 17 +#define LED_PIN PC2 // Longer3D board mosfets are passing by default // Avoid nozzle heat and fan start before serial init @@ -136,14 +136,14 @@ // #if HAS_FSMC_TFT #define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT - #define FSMC_CS_PIN PD7 // pin 88 = FSMC_NE1 - #define FSMC_RS_PIN PD11 // pin 58 A16 Register. Only one address needed + #define FSMC_CS_PIN PD7 // FSMC_NE1 + #define FSMC_RS_PIN PD11 // A16 Register. Only one address needed #define TFT_CS_PIN FSMC_CS_PIN #define TFT_RS_PIN FSMC_RS_PIN - #define TFT_RESET_PIN PC4 // pin 33 - #define TFT_BACKLIGHT_PIN PD12 // pin 59 + #define TFT_RESET_PIN PC4 + #define TFT_BACKLIGHT_PIN PD12 #define TFT_BACKLIGHT_PWM 150 // Brightness with alt. TIM4 chan 1 (1-255) #define DOGLCD_MOSI -1 // Prevent auto-define by Conditionals_post.h @@ -168,11 +168,11 @@ * declared below. */ #if NEED_TOUCH_PINS - #define TOUCH_CS_PIN PB12 // pin 51 SPI2_NSS - #define TOUCH_SCK_PIN PB13 // pin 52 - #define TOUCH_MOSI_PIN PB14 // pin 53 (Inverted MOSI/MISO = No HW SPI2) - #define TOUCH_MISO_PIN PB15 // pin 54 - #define TOUCH_INT_PIN PC6 // pin 63 (PenIRQ coming from ADS7843) + #define TOUCH_CS_PIN PB12 // SPI2_NSS + #define TOUCH_SCK_PIN PB13 + #define TOUCH_MISO_PIN PB15 // (Swapped MOSI/MISO = No HW SPI2) + #define TOUCH_MOSI_PIN PB14 + #define TOUCH_INT_PIN PC6 // (PenIRQ coming from ADS7843) #endif // @@ -181,25 +181,25 @@ // #if NO_EEPROM_SELECTED //#define SPI_EEPROM - //#define SPI_FLASH // need MARLIN_DEV_MODE for M993/M994 EEPROM backup tests + //#define SPI_FLASH // Use MARLIN_DEV_MODE for M993/M994 EEPROM backup tests #define FLASH_EEPROM_EMULATION #endif #if ENABLED(SPI_EEPROM) // SPI1 EEPROM Winbond W25Q64 (8MB/64Mbits) #define SPI_CHAN_EEPROM1 1 - #define SPI_EEPROM1_CS_PIN PC5 // pin 34 - #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 SPI_EEPROM1_CS_PIN PC5 + #define EEPROM_SCK_PIN BOARD_SPI1_SCK_PIN // PA5 + #define EEPROM_MISO_PIN BOARD_SPI1_MISO_PIN // PA6 + #define EEPROM_MOSI_PIN BOARD_SPI1_MOSI_PIN // PA7 #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(SPI_FLASH) - #define SPI_FLASH_SIZE 0x40000U // limit to 256K (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 + #define SPI_FLASH_MISO_PIN PA6 + #define SPI_FLASH_MOSI_PIN PA7 #elif ENABLED(FLASH_EEPROM_EMULATION) // SoC Flash (framework-arduinoststm32-maple/STM32F1/libraries/EEPROM/EEPROM.h) #define EEPROM_PAGE_SIZE (0x800U) // 2K 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 a7fc323ba0da7..c86552ba12add 100644 --- a/Marlin/src/pins/stm32f1/pins_MINGDA_MPX_ARM_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_MINGDA_MPX_ARM_MINI.h @@ -58,7 +58,7 @@ #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2K #endif -#define SPI_DEVICE 2 +#define SPI_DEVICE 2 // Maple // // Limit Switches diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h index e53ffa008bc7d..d456974e9ea03 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h @@ -195,7 +195,7 @@ // SPI2 is shared by LCD touch driver and flash // SPI1(PA7) & SPI3(PB5) not available -#define SPI_DEVICE 2 +#define SPI_DEVICE 2 // Maple #define ONBOARD_SDIO #define SDIO_CLOCK 4500000 @@ -274,7 +274,7 @@ #if ENABLED(SPI_FLASH) #define SPI_FLASH_SIZE 0x800000 // 8MB #define SPI_FLASH_CS_PIN PG9 - #define SPI_FLASH_MOSI_PIN PB15 - #define SPI_FLASH_MISO_PIN PB14 #define SPI_FLASH_SCK_PIN PB13 + #define SPI_FLASH_MISO_PIN PB14 + #define SPI_FLASH_MOSI_PIN PB15 #endif diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h index 5cf209e533156..6892655e468f8 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h @@ -58,9 +58,9 @@ #endif // -// Note: MKS Robin board is using SPI2 interface. +// SPI // -#define SPI_DEVICE 2 +#define SPI_DEVICE 2 // Maple // // Servos @@ -382,9 +382,9 @@ #if ENABLED(SPI_FLASH) #define SPI_FLASH_SIZE 0x1000000 // 16MB #define SPI_FLASH_CS_PIN PB12 - #define SPI_FLASH_MOSI_PIN PB15 - #define SPI_FLASH_MISO_PIN PB14 #define SPI_FLASH_SCK_PIN PB13 + #define SPI_FLASH_MISO_PIN PB14 + #define SPI_FLASH_MOSI_PIN PB15 #endif #ifndef BEEPER_PIN 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 f257ea3bbb313..a8583e92d7e69 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h @@ -253,7 +253,7 @@ // SD Card // #define SDCARD_CONNECTION ONBOARD -#define SPI_DEVICE 2 +#define SPI_DEVICE 2 // Maple #define ONBOARD_SPI_DEVICE 2 #define SDSS SD_SS_PIN #define ONBOARD_SD_CS_PIN SD_SS_PIN diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE.h index af4e121100436..53f31c278459f 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE.h @@ -156,7 +156,7 @@ // // SPI // -#define SPI_DEVICE 2 +#define SPI_DEVICE 2 // Maple #define SD_SCK_PIN PB13 #define SD_MISO_PIN PB14 #define SD_MOSI_PIN PB15 diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE3.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE3.h index 6835ec3b56585..0651bcebf2831 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE3.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE3.h @@ -152,7 +152,7 @@ // // SPI // -#define SPI_DEVICE 2 +#define SPI_DEVICE 2 // Maple #define SD_SCK_PIN PB13 #define SD_MISO_PIN PB14 #define SD_MOSI_PIN PB15 diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h index 3a50465a9abf1..372da38c628ad 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h @@ -50,7 +50,7 @@ #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2K #endif -#define SPI_DEVICE 2 +#define SPI_DEVICE 2 // Maple // // Servos @@ -199,7 +199,7 @@ #if ENABLED(SPI_FLASH) #define SPI_FLASH_SIZE 0x1000000 // 16MB #define SPI_FLASH_CS_PIN PB12 // Flash chip-select - #define SPI_FLASH_MOSI_PIN PB15 - #define SPI_FLASH_MISO_PIN PB14 #define SPI_FLASH_SCK_PIN PB13 + #define SPI_FLASH_MISO_PIN PB14 + #define SPI_FLASH_MOSI_PIN PB15 #endif 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 d92ea01aa380f..956e9dc72ef1e 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h @@ -60,9 +60,9 @@ #endif // -// Note: MKS Robin board is using SPI2 interface. +// SPI // -#define SPI_DEVICE 2 +#define SPI_DEVICE 2 // Maple // // Servos @@ -384,9 +384,9 @@ #if ENABLED(SPI_FLASH) #define SPI_FLASH_SIZE 0x1000000 // 16MB #define SPI_FLASH_CS_PIN PB12 - #define SPI_FLASH_MOSI_PIN PB15 - #define SPI_FLASH_MISO_PIN PB14 #define SPI_FLASH_SCK_PIN PB13 + #define SPI_FLASH_MISO_PIN PB14 + #define SPI_FLASH_MOSI_PIN PB15 #endif #ifndef BEEPER_PIN 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 a329b8a4bbdd5..69eee63007c50 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h @@ -49,7 +49,7 @@ #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2K #endif -#define SPI_DEVICE 2 +#define SPI_DEVICE 2 // Maple // // Servos @@ -210,7 +210,7 @@ #if ENABLED(SPI_FLASH) #define SPI_FLASH_SIZE 0x1000000 // 16MB #define SPI_FLASH_CS_PIN PB12 - #define SPI_FLASH_MOSI_PIN PB15 - #define SPI_FLASH_MISO_PIN PB14 #define SPI_FLASH_SCK_PIN PB13 + #define SPI_FLASH_MISO_PIN PB14 + #define SPI_FLASH_MOSI_PIN PB15 #endif diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h index 922caa556ea1b..114c224b1e33f 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h @@ -41,9 +41,9 @@ #define DISABLE_DEBUG // -// Note: MKS Robin board is using SPI2 interface. +// SPI // -#define SPI_DEVICE 2 +#define SPI_DEVICE 2 // Maple // // Servos @@ -167,9 +167,9 @@ #define HEATER_BED_PIN PA0 // +HOT-BED- #define FAN0_PIN PB1 // +FAN- -/** - * Note: MKS Robin Pro board is using SPI2 interface. Make sure your stm32duino library is configured accordingly - */ +// +// Note: Using SPI2 interface. Make sure stm32duino is configured accordingly +// //#define TEMP_0_CS_PIN PE5 // TC1 - CS1 //#define TEMP_0_CS_PIN PF11 // TC2 - CS2 @@ -308,7 +308,7 @@ #if ENABLED(SPI_FLASH) #define SPI_FLASH_SIZE 0x1000000 // 16MB #define SPI_FLASH_CS_PIN PB12 // Flash chip-select - #define SPI_FLASH_MOSI_PIN PB15 - #define SPI_FLASH_MISO_PIN PB14 #define SPI_FLASH_SCK_PIN PB13 + #define SPI_FLASH_MISO_PIN PB14 + #define SPI_FLASH_MOSI_PIN PB15 #endif diff --git a/Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h b/Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h index ff2bf5fd8e86c..d6a5ef3c178bc 100644 --- a/Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h +++ b/Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h @@ -184,7 +184,7 @@ #endif // SPI1(PA7) & SPI3(PB5) not available -#define SPI_DEVICE 2 +#define SPI_DEVICE 2 // Maple #if ENABLED(ONBOARD_SDIO) #define SD_SCK_PIN PB13 // SPI2 ok 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 01f2b00b585a9..04c40095295d1 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 @@ -213,8 +213,8 @@ // // Onboard SD card +// Detect pin doesn't work when ONBOARD and NO_SD_HOST_DRIVE disabled // -// detect pin doesn't work when ONBOARD and NO_SD_HOST_DRIVE disabled #if SD_CONNECTION_IS(ONBOARD) #define ENABLE_SPI3 #define SD_SS_PIN -1 @@ -227,13 +227,12 @@ #define SPI_FLASH #if ENABLED(SPI_FLASH) - #define SPI_FLASH - #define SPI_DEVICE 2 - #define SPI_FLASH_SIZE 0x1000000 + #define SPI_DEVICE 2 // Maple + #define SPI_FLASH_SIZE 0x1000000 // 16MB #define SPI_FLASH_CS_PIN PB12 - #define SPI_FLASH_MOSI_PIN PC3 - #define SPI_FLASH_MISO_PIN PC2 #define SPI_FLASH_SCK_PIN PB13 + #define SPI_FLASH_MISO_PIN PC2 + #define SPI_FLASH_MOSI_PIN PC3 #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 952a8e1ec070f..60fe6fa66d62c 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h @@ -271,19 +271,19 @@ #endif */ -// -// LCD / Controller -#define SPI_FLASH #define SPI_FLASH -#define SPI_DEVICE 2 -#define SPI_FLASH_SIZE 0x1000000 #if ENABLED(SPI_FLASH) + #define SPI_DEVICE 2 // Maple + #define SPI_FLASH_SIZE 0x1000000 // 16MB #define SPI_FLASH_CS_PIN PB12 - #define SPI_FLASH_MOSI_PIN PB15 - #define SPI_FLASH_MISO_PIN PB14 #define SPI_FLASH_SCK_PIN PB13 + #define SPI_FLASH_MISO_PIN PB14 + #define SPI_FLASH_MOSI_PIN PB15 #endif +// +// LCD / Controller +// #if ANY(TFT_COLOR_UI, TFT_LVGL_UI, TFT_CLASSIC_UI) #ifndef TOUCH_CALIBRATION_X #define TOUCH_CALIBRATION_X -17253 diff --git a/Marlin/src/pins/stm32f4/pins_TRONXY_V10.h b/Marlin/src/pins/stm32f4/pins_TRONXY_V10.h index d5752e43dccf5..dbf8ddc5d51f0 100644 --- a/Marlin/src/pins/stm32f4/pins_TRONXY_V10.h +++ b/Marlin/src/pins/stm32f4/pins_TRONXY_V10.h @@ -73,9 +73,9 @@ #if ENABLED(SPI_FLASH) #define SPI_FLASH_SIZE 0x200000 // 2MB #define SPI_FLASH_CS_PIN PG15 // SPI2 - #define SPI_FLASH_MOSI_PIN PB5 - #define SPI_FLASH_MISO_PIN PB4 #define SPI_FLASH_SCK_PIN PB3 + #define SPI_FLASH_MISO_PIN PB4 + #define SPI_FLASH_MOSI_PIN PB5 #endif // diff --git a/buildroot/share/PlatformIO/scripts/download_mks_assets.py b/buildroot/share/PlatformIO/scripts/download_mks_assets.py index 661fb2e438e41..0186f59896ea4 100644 --- a/buildroot/share/PlatformIO/scripts/download_mks_assets.py +++ b/buildroot/share/PlatformIO/scripts/download_mks_assets.py @@ -14,7 +14,7 @@ assets_path = Path(env.Dictionary("PROJECT_BUILD_DIR"), env.Dictionary("PIOENV"), "assets") def download_mks_assets(): - print("Downloading MKS Assets") + print("Downloading MKS Assets for TFT_LVGL_UI") r = requests.get(url, stream=True) # the user may have a very clean workspace, # so create the PROJECT_LIBDEPS_DIR directory if not exits @@ -25,7 +25,7 @@ def download_mks_assets(): fd.write(chunk) def copy_mks_assets(): - print("Copying MKS Assets") + print("Copying MKS Assets for TFT_LVGL_UI") output_path = Path(tempfile.mkdtemp()) zip_obj = zipfile.ZipFile(zip_path, 'r') zip_obj.extractall(output_path) diff --git a/buildroot/tests/mks_robin_pro2 b/buildroot/tests/mks_robin_pro2 new file mode 100755 index 0000000000000..391943743378b --- /dev/null +++ b/buildroot/tests/mks_robin_pro2 @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# +# Build tests for mks_robin_pro2 (STM32F407VE) +# + +# exit on first failure +set -e + +# +# Robin Pro v2 with LVGL TFT +# +restore_configs +opt_set MOTHERBOARD BOARD_MKS_ROBIN_PRO_V2 SERIAL_PORT 1 +opt_enable SDSUPPORT USB_FLASH_DRIVE_SUPPORT USE_OTG_USB_HOST MULTI_VOLUME \ + TFT_GENERIC TFT_INTERFACE_SPI TFT_RES_480x320 TFT_LVGL_UI TOUCH_SCREEN \ + BLTOUCH Z_SAFE_HOMING LCD_BED_TRAMMING BED_TRAMMING_USE_PROBE +exec_test $1 $2 "MKS Robin Pro v2 | TFT_LVGL_UI | SD/FD Multi-Volume" "$3" + +# cleanup +restore_configs From d22ce55cd5b88d50dd67818c5e44db91575e4d60 Mon Sep 17 00:00:00 2001 From: Andrew <18502096+classicrocker883@users.noreply.github.com> Date: Sun, 21 May 2023 18:34:19 -0400 Subject: [PATCH 051/100] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20ProUI=20Manual=20M?= =?UTF-8?q?esh=20/=20UBL=20Viewer=20(#25858)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/e3v2/proui/meshviewer.cpp | 2 +- Marlin/src/module/motion.cpp | 4 ---- Marlin/src/module/motion.h | 4 ++++ 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Marlin/src/lcd/e3v2/proui/meshviewer.cpp b/Marlin/src/lcd/e3v2/proui/meshviewer.cpp index 18cdffd00d626..69d21c044ce95 100644 --- a/Marlin/src/lcd/e3v2/proui/meshviewer.cpp +++ b/Marlin/src/lcd/e3v2/proui/meshviewer.cpp @@ -40,7 +40,7 @@ #include "../../../feature/bedlevel/bedlevel.h" #include "meshviewer.h" -#if ENABLED(AUTO_BED_LEVELING_UBL) +#if ENABLED(USE_UBL_VIEWER) #include "bedlevel_tools.h" #endif diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index a15cfe0796109..e6df20a99843e 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -38,10 +38,6 @@ #include "../lcd/marlinui.h" #endif -#if ALL(DWIN_LCD_PROUI, INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) - #include "../lcd/e3v2/proui/dwin.h" -#endif - #if ENABLED(POLAR) #include "polar.h" #endif diff --git a/Marlin/src/module/motion.h b/Marlin/src/module/motion.h index 71d80f954e419..b7e37f6b70437 100644 --- a/Marlin/src/module/motion.h +++ b/Marlin/src/module/motion.h @@ -30,6 +30,10 @@ #include "../inc/MarlinConfig.h" +#if ALL(DWIN_LCD_PROUI, INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) + #include "../lcd/e3v2/proui/dwin.h" +#endif + #if IS_SCARA #include "scara.h" #elif ENABLED(POLAR) From ae3b00db74c63e51e6e73e4a452468dda9abab1f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 21 May 2023 17:35:41 -0500 Subject: [PATCH 052/100] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Fal?= =?UTF-8?q?l=20back=20to=20SPI0=20with=20YHCB2004=20(#25856)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/AVR/fastio/fastio_1280.h | 49 +++++++++---------- Marlin/src/HAL/AVR/fastio/fastio_1281.h | 35 ++++++------- Marlin/src/HAL/AVR/fastio/fastio_168.h | 26 +++++----- Marlin/src/HAL/AVR/fastio/fastio_644.h | 38 +++++++------- Marlin/src/HAL/AVR/fastio/fastio_AT90USB.h | 11 ++--- Marlin/src/HAL/DUE/fastio.h | 8 +-- Marlin/src/lcd/HD44780/marlinui_HD44780.cpp | 18 ++++++- Marlin/src/pins/mega/pins_GT2560_V3.h | 16 ++---- Marlin/src/pins/mega/pins_GT2560_V3_A20.h | 14 ++++-- Marlin/src/pins/mega/pins_GT2560_V4_A20.h | 14 ++++-- Marlin/src/pins/pins.h | 2 +- .../src/pins/stm32f4/pins_BLACKPILL_CUSTOM.h | 2 +- 12 files changed, 118 insertions(+), 115 deletions(-) diff --git a/Marlin/src/HAL/AVR/fastio/fastio_1280.h b/Marlin/src/HAL/AVR/fastio/fastio_1280.h index 6f074cf91124f..633774dda9161 100644 --- a/Marlin/src/HAL/AVR/fastio/fastio_1280.h +++ b/Marlin/src/HAL/AVR/fastio/fastio_1280.h @@ -35,39 +35,36 @@ #include "../fastio.h" -// change for your board -#define DEBUG_LED DIO21 - // UART -#define RXD DIO0 -#define TXD DIO1 +#define RXD 0 +#define TXD 1 // SPI -#define SCK DIO52 -#define MISO DIO50 -#define MOSI DIO51 -#define SS DIO53 +#define MISO 50 +#define MOSI 51 +#define SCK 52 +#define SS 53 // TWI (I2C) -#define SCL DIO21 -#define SDA DIO20 +#define SCL 21 +#define SDA 20 // Timers and PWM -#define OC0A DIO13 -#define OC0B DIO4 -#define OC1A DIO11 -#define OC1B DIO12 -#define OC2A DIO10 -#define OC2B DIO9 -#define OC3A DIO5 -#define OC3B DIO2 -#define OC3C DIO3 -#define OC4A DIO6 -#define OC4B DIO7 -#define OC4C DIO8 -#define OC5A DIO46 -#define OC5B DIO45 -#define OC5C DIO44 +#define OC0A 13 +#define OC0B 4 +#define OC1A 11 +#define OC1B 12 +#define OC2A 10 +#define OC2B 9 +#define OC3A 5 +#define OC3B 2 +#define OC3C 3 +#define OC4A 6 +#define OC4B 7 +#define OC4C 8 +#define OC5A 46 +#define OC5B 45 +#define OC5C 44 // Digital I/O diff --git a/Marlin/src/HAL/AVR/fastio/fastio_1281.h b/Marlin/src/HAL/AVR/fastio/fastio_1281.h index 812586225d173..6067248978aee 100644 --- a/Marlin/src/HAL/AVR/fastio/fastio_1281.h +++ b/Marlin/src/HAL/AVR/fastio/fastio_1281.h @@ -33,32 +33,29 @@ #include "../fastio.h" -// change for your board -#define DEBUG_LED DIO46 - // UART -#define RXD DIO0 -#define TXD DIO1 +#define RXD 0 +#define TXD 1 // SPI -#define SCK DIO10 -#define MISO DIO12 -#define MOSI DIO11 -#define SS DIO16 +#define SCK 10 +#define MISO 12 +#define MOSI 11 +#define SS 16 // TWI (I2C) -#define SCL DIO17 -#define SDA DIO18 +#define SCL 17 +#define SDA 18 // Timers and PWM -#define OC0A DIO9 -#define OC0B DIO4 -#define OC1A DIO7 -#define OC1B DIO8 -#define OC2A DIO6 -#define OC3A DIO5 -#define OC3B DIO2 -#define OC3C DIO3 +#define OC0A 9 +#define OC0B 4 +#define OC1A 7 +#define OC1B 8 +#define OC2A 6 +#define OC3A 5 +#define OC3B 2 +#define OC3C 3 // Digital I/O diff --git a/Marlin/src/HAL/AVR/fastio/fastio_168.h b/Marlin/src/HAL/AVR/fastio/fastio_168.h index 4f591b37b9012..cc559797408be 100644 --- a/Marlin/src/HAL/AVR/fastio/fastio_168.h +++ b/Marlin/src/HAL/AVR/fastio/fastio_168.h @@ -33,29 +33,27 @@ #include "../fastio.h" -#define DEBUG_LED AIO5 - // UART -#define RXD DIO0 -#define TXD DIO1 +#define RXD 0 +#define TXD 1 // SPI -#define SCK DIO13 -#define MISO DIO12 -#define MOSI DIO11 -#define SS DIO10 +#define SS 10 +#define MOSI 11 +#define MISO 12 +#define SCK 13 // TWI (I2C) #define SCL AIO5 #define SDA AIO4 // Timers and PWM -#define OC0A DIO6 -#define OC0B DIO5 -#define OC1A DIO9 -#define OC1B DIO10 -#define OC2A DIO11 -#define OC2B DIO3 +#define OC0A 6 +#define OC0B 5 +#define OC1A 9 +#define OC1B 10 +#define OC2A 11 +#define OC2B 3 // Digital I/O diff --git a/Marlin/src/HAL/AVR/fastio/fastio_644.h b/Marlin/src/HAL/AVR/fastio/fastio_644.h index 16bdc6a23da20..94b322a8190da 100644 --- a/Marlin/src/HAL/AVR/fastio/fastio_644.h +++ b/Marlin/src/HAL/AVR/fastio/fastio_644.h @@ -59,34 +59,32 @@ #include "../fastio.h" -#define DEBUG_LED DIO0 - // UART -#define RXD DIO8 -#define TXD DIO9 -#define RXD0 DIO8 -#define TXD0 DIO9 +#define RXD 8 +#define TXD 9 +#define RXD0 8 +#define TXD0 9 -#define RXD1 DIO10 -#define TXD1 DIO11 +#define RXD1 10 +#define TXD1 11 // SPI -#define SCK DIO7 -#define MISO DIO6 -#define MOSI DIO5 -#define SS DIO4 +#define SS 4 +#define MOSI 5 +#define MISO 6 +#define SCK 7 // TWI (I2C) -#define SCL DIO16 -#define SDA DIO17 +#define SCL 16 +#define SDA 17 // Timers and PWM -#define OC0A DIO3 -#define OC0B DIO4 -#define OC1A DIO13 -#define OC1B DIO12 -#define OC2A DIO15 -#define OC2B DIO14 +#define OC0A 3 +#define OC0B 4 +#define OC1A 13 +#define OC1B 12 +#define OC2A 15 +#define OC2B 14 // Digital I/O diff --git a/Marlin/src/HAL/AVR/fastio/fastio_AT90USB.h b/Marlin/src/HAL/AVR/fastio/fastio_AT90USB.h index d2a8aca6f38c7..0c434b157c784 100644 --- a/Marlin/src/HAL/AVR/fastio/fastio_AT90USB.h +++ b/Marlin/src/HAL/AVR/fastio/fastio_AT90USB.h @@ -34,14 +34,11 @@ #include "../fastio.h" -// change for your board -#define DEBUG_LED DIO31 /* led D5 red */ - // SPI -#define SCK DIO21 // 9 -#define MISO DIO23 // 11 -#define MOSI DIO22 // 10 -#define SS DIO20 // 8 +#define SS 20 // 8 +#define SCK 21 // 9 +#define MOSI 22 // 10 +#define MISO 23 // 11 // Digital I/O diff --git a/Marlin/src/HAL/DUE/fastio.h b/Marlin/src/HAL/DUE/fastio.h index a609210d81304..77bc1911d8dfe 100644 --- a/Marlin/src/HAL/DUE/fastio.h +++ b/Marlin/src/HAL/DUE/fastio.h @@ -189,12 +189,12 @@ */ // UART -#define RXD DIO0 -#define TXD DIO1 +#define RXD 0 +#define TXD 1 // TWI (I2C) -#define SCL DIO21 -#define SDA DIO20 +#define SCL 21 +#define SDA 20 /** * pins diff --git a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp index a0cf5fe46bda0..b03ff8a9f5335 100644 --- a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp +++ b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp @@ -103,7 +103,23 @@ #elif ENABLED(YHCB2004) - LCD_CLASS lcd(YHCB2004_CLK, 20, 4, YHCB2004_MOSI, YHCB2004_MISO); // CLK, cols, rows, MOSI, MISO + #ifndef YHCB2004_SS_PIN + #define YHCB2004_SS_PIN SS + #endif + #ifndef YHCB2004_SCK_PIN + #define YHCB2004_SCK_PIN SCK + #endif + #ifndef YHCB2004_MOSI_PIN + #define YHCB2004_MOSI_PIN MOSI + #endif + #ifndef YHCB2004_MISO_PIN + #define YHCB2004_MISO_PIN MISO + #endif + #if !PINS_EXIST(YHCB2004_SS, YHCB2004_SCK, YHCB2004_MOSI, YHCB2004_MISO) + #error "YHCB2004 display requires YHCB2004_SS_PIN, YHCB2004_SCK_PIN, YHCB2004_MOSI_PIN, and YHCB2004_MISO_PIN." + #endif + + LCD_CLASS lcd(YHCB2004_SS_PIN, 20, 4, YHCB2004_SCK_PIN, YHCB2004_MOSI_PIN, YHCB2004_MISO_PIN); // SS, cols, rows, SCK, MOSI, MISO #else diff --git a/Marlin/src/pins/mega/pins_GT2560_V3.h b/Marlin/src/pins/mega/pins_GT2560_V3.h index 61f30fc7d4f4a..0c588e6516ee9 100644 --- a/Marlin/src/pins/mega/pins_GT2560_V3.h +++ b/Marlin/src/pins/mega/pins_GT2560_V3.h @@ -168,18 +168,10 @@ #define BEEPER_PIN 18 #if ENABLED(YHCB2004) - #ifndef YHCB2004_CLK - #define YHCB2004_CLK 5 - #define DIO52 YHCB2004_CLK - #endif - #ifndef YHCB2004_MOSI - #define YHCB2004_MOSI 21 - #define DIO50 YHCB2004_MOSI - #endif - #ifndef YHCB2004_MISO - #define YHCB2004_MISO 36 - #define DIO51 YHCB2004_MISO - #endif + #define YHCB2004_MOSI_PIN 21 + #define YHCB2004_MISO_PIN 36 + #define YHCB2004_SCK_PIN 5 + #define YHCB2004_SS_PIN SS #elif HAS_WIRED_LCD #ifndef LCD_PINS_RS #define LCD_PINS_RS 20 diff --git a/Marlin/src/pins/mega/pins_GT2560_V3_A20.h b/Marlin/src/pins/mega/pins_GT2560_V3_A20.h index 772a45a9186ae..2422dfdd73e54 100644 --- a/Marlin/src/pins/mega/pins_GT2560_V3_A20.h +++ b/Marlin/src/pins/mega/pins_GT2560_V3_A20.h @@ -26,12 +26,16 @@ * ATmega2560 */ -#define LCD_PINS_RS 5 -#define LCD_PINS_EN 36 -#define LCD_PINS_D4 21 -#define LCD_PINS_D7 6 +#if HAS_WIRED_LCD + #define LCD_PINS_RS 5 + #define LCD_PINS_EN 36 + #define LCD_PINS_D4 21 + #define LCD_PINS_D7 6 +#endif -#define SPEAKER // The speaker can produce tones +#ifndef SPEAKER + #define SPEAKER // The speaker can produce tones +#endif #if IS_NEWPANEL #define BTN_EN1 16 diff --git a/Marlin/src/pins/mega/pins_GT2560_V4_A20.h b/Marlin/src/pins/mega/pins_GT2560_V4_A20.h index 3b3a80caa83f3..405a3aba5bf81 100644 --- a/Marlin/src/pins/mega/pins_GT2560_V4_A20.h +++ b/Marlin/src/pins/mega/pins_GT2560_V4_A20.h @@ -28,12 +28,16 @@ #define BOARD_INFO_NAME "GT2560 4.x" -#define LCD_PINS_RS 5 -#define LCD_PINS_EN 36 -#define LCD_PINS_D4 21 -#define LCD_PINS_D7 6 +#if HAS_WIRED_LCD + #define LCD_PINS_RS 5 + #define LCD_PINS_EN 36 + #define LCD_PINS_D4 21 + #define LCD_PINS_D7 6 +#endif -#define SPEAKER // The speaker can produce tones +#ifndef SPEAKER + #define SPEAKER // The speaker can produce tones +#endif #if IS_NEWPANEL #define BTN_EN1 16 diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 511870053324b..6ee6401badfc2 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -795,7 +795,7 @@ #elif MB(BLACKPILL_CUSTOM) #include "stm32f4/pins_BLACKPILL_CUSTOM.h" // STM32F4 env:STM32F401CD_blackpill_stlink #elif MB(I3DBEEZ9_V1) - #include "stm32f4/pins_I3DBEEZ9.h" // STM32F4 env:I3DBEEZ9_V1 + #include "stm32f4/pins_I3DBEEZ9.h" // STM32F4 env:I3DBEEZ9_V1 // // ARM Cortex M7 diff --git a/Marlin/src/pins/stm32f4/pins_BLACKPILL_CUSTOM.h b/Marlin/src/pins/stm32f4/pins_BLACKPILL_CUSTOM.h index 9049a553fb49b..039333adfa91b 100644 --- a/Marlin/src/pins/stm32f4/pins_BLACKPILL_CUSTOM.h +++ b/Marlin/src/pins/stm32f4/pins_BLACKPILL_CUSTOM.h @@ -117,7 +117,7 @@ //#define SDIO_SUPPORT #define NO_SD_HOST_DRIVE // This board's SD is only seen by the printer -#if SD_CONNECTION_IS(ONBOARD) +#if SD_CONNECTION_IS(ONBOARD) #define SDSS PA4 #define SD_SCK_PIN PA5 #define SD_MISO_PIN PA6 From 8cd2b0976a0c021a87af07876cedde9101682f0e Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Mon, 22 May 2023 00:27:46 +0000 Subject: [PATCH 053/100] [cron] Bump distribution date (2023-05-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 1986b74a024de..6c3f8122f5cd0 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 "2023-05-21" +//#define STRING_DISTRIBUTION_DATE "2023-05-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 8c1880c6ff362..64baed6a417c3 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 "2023-05-21" + #define STRING_DISTRIBUTION_DATE "2023-05-22" #endif /** From 9ceecefae222e624039eea67dcb478130cb0273c Mon Sep 17 00:00:00 2001 From: alextrical <35117191+alextrical@users.noreply.github.com> Date: Mon, 22 May 2023 02:38:28 +0100 Subject: [PATCH 054/100] =?UTF-8?q?=F0=9F=94=A8=20Fix=20BTT=20EBB42=20V1.1?= =?UTF-8?q?=20compile=20with=20-flto=20(#25849)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/stm32g0/pins_BTT_EBB42_V1_1.h | 3 ++- ini/stm32g0.ini | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Marlin/src/pins/stm32g0/pins_BTT_EBB42_V1_1.h b/Marlin/src/pins/stm32g0/pins_BTT_EBB42_V1_1.h index 21f27e452d8c5..07c68dc780d50 100644 --- a/Marlin/src/pins/stm32g0/pins_BTT_EBB42_V1_1.h +++ b/Marlin/src/pins/stm32g0/pins_BTT_EBB42_V1_1.h @@ -125,7 +125,8 @@ // // Heaters / Fans // -#define HEATER_0_PIN PA2 // "HE" +#define HEATER_0_PIN PA2 // "HE" V1.1 +#define HEATER_1_PIN PB13 // "HE" V1.2 #define FAN0_PIN PA0 // "FAN0" #define FAN1_PIN PA1 // "FAN1" diff --git a/ini/stm32g0.ini b/ini/stm32g0.ini index 8d9353f0af894..17403292b70b4 100644 --- a/ini/stm32g0.ini +++ b/ini/stm32g0.ini @@ -33,6 +33,7 @@ build_flags = -DPIN_WIRE_SCL=PB3 -DPIN_WIRE_SDA=PB4 extends = stm32_variant platform = ststm32@~14.1.0 platform_packages = framework-arduinoststm32@https://github.com/stm32duino/Arduino_Core_STM32/archive/main.zip + toolchain-gccarmnoneeabi@1.100301.220327 board = marlin_BTT_EBB42_V1_1 board_build.offset = 0x0000 board_upload.offset_address = 0x08000000 From e82ec734d9a102ca21cfd0f8ad47a7e988579aed Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 23 May 2023 00:21:34 +0000 Subject: [PATCH 055/100] [cron] Bump distribution date (2023-05-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 6c3f8122f5cd0..d1fe945715af9 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 "2023-05-22" +//#define STRING_DISTRIBUTION_DATE "2023-05-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 64baed6a417c3..5c35e0550f2d9 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 "2023-05-22" + #define STRING_DISTRIBUTION_DATE "2023-05-23" #endif /** From e7a5d4d4169dfd55bc1f0c6e34a527c3f4c17e7a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 23 May 2023 03:15:02 -0500 Subject: [PATCH 056/100] =?UTF-8?q?=E2=9C=85=20Update=20checkout=20actions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/bump-date.yml | 4 ++-- .github/workflows/clean-closed.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/bump-date.yml b/.github/workflows/bump-date.yml index 482fbbbb40850..a08eeea561d77 100644 --- a/.github/workflows/bump-date.yml +++ b/.github/workflows/bump-date.yml @@ -19,7 +19,7 @@ jobs: steps: - name: Check out bugfix-2.0.x - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: ref: bugfix-2.0.x @@ -39,7 +39,7 @@ jobs: exit 0 - name: Check out bugfix-2.1.x - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: ref: bugfix-2.1.x diff --git a/.github/workflows/clean-closed.yml b/.github/workflows/clean-closed.yml index befec4498f257..2eab285aeeabc 100644 --- a/.github/workflows/clean-closed.yml +++ b/.github/workflows/clean-closed.yml @@ -31,7 +31,7 @@ jobs: - "Needs: Work" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Remove Labels uses: actions-ecosystem/action-remove-labels@v1 with: From 9036cec562a4ae1b8d54a31c9cf296fdbb5a5cba Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Wed, 24 May 2023 00:21:21 +0000 Subject: [PATCH 057/100] [cron] Bump distribution date (2023-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 d1fe945715af9..5b26bfa8ab4fa 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 "2023-05-23" +//#define STRING_DISTRIBUTION_DATE "2023-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 5c35e0550f2d9..2864463068aeb 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 "2023-05-23" + #define STRING_DISTRIBUTION_DATE "2023-05-24" #endif /** From 37d0f49a82cd2e4d91dce4e62671b266924eb2a7 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 24 May 2023 01:05:55 -0500 Subject: [PATCH 058/100] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Mis?= =?UTF-8?q?c.=20ExtUI=20LCD=20cleanup=20(#25872)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/AVR/HAL.h | 2 +- Marlin/src/HAL/LPC1768/HAL.h | 2 +- Marlin/src/HAL/STM32/HAL.h | 2 +- Marlin/src/HAL/STM32F1/HAL.h | 2 +- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 2 +- .../extui/anycubic_chiron/FileNavigator.cpp | 30 +- .../lcd/extui/anycubic_chiron/FileNavigator.h | 4 +- .../extui/anycubic_chiron/chiron_extui.cpp | 26 +- .../lcd/extui/anycubic_chiron/chiron_tft.cpp | 310 +-- .../lcd/extui/anycubic_chiron/chiron_tft.h | 48 +- .../extui/anycubic_i3mega/anycubic_extui.cpp | 22 +- .../anycubic_i3mega/anycubic_i3mega_lcd.cpp | 1074 ++++---- .../anycubic_i3mega/anycubic_i3mega_lcd.h | 69 +- .../extui/anycubic_vyper/FileNavigator.cpp | 22 +- .../lcd/extui/anycubic_vyper/FileNavigator.h | 4 +- .../src/lcd/extui/anycubic_vyper/dgus_tft.cpp | 271 +- .../src/lcd/extui/anycubic_vyper/dgus_tft.h | 38 +- .../lcd/extui/anycubic_vyper/vyper_extui.cpp | 26 +- Marlin/src/lcd/extui/dgus/DGUSDisplay.cpp | 2 +- .../extui/dgus/fysetc/DGUSScreenHandler.cpp | 6 +- .../extui/dgus/hiprecy/DGUSScreenHandler.cpp | 6 +- .../lcd/extui/dgus/mks/DGUSScreenHandler.cpp | 6 +- .../extui/dgus/origin/DGUSScreenHandler.cpp | 6 +- .../lcd/extui/dgus_reloaded/DGUSRxHandler.cpp | 2 +- .../lcd/extui/dgus_reloaded/DGUSRxHandler.h | 2 +- .../extui/dgus_reloaded/DGUSScreenHandler.cpp | 4 +- .../extui/dgus_reloaded/DGUSScreenHandler.h | 4 +- .../dgus_reloaded/definition/DGUS_VPList.cpp | 2 +- .../dgus_reloaded/dgus_reloaded_extui.cpp | 4 +- .../lcd/extui/ia_creality/FileNavigator.cpp | 24 +- .../src/lcd/extui/ia_creality/FileNavigator.h | 11 +- .../extui/ia_creality/ia_creality_extui.cpp | 2261 +++-------------- .../lcd/extui/ia_creality/ia_creality_rts.cpp | 1730 +++++++++++++ ...{ia_creality_extui.h => ia_creality_rts.h} | 26 +- .../extui/mks_ui/tft_lvgl_configuration.cpp | 1 - .../src/lcd/extui/nextion/FileNavigator.cpp | 62 +- Marlin/src/lcd/extui/nextion/FileNavigator.h | 4 +- .../src/lcd/extui/nextion/nextion_extui.cpp | 12 +- Marlin/src/lcd/extui/nextion/nextion_tft.cpp | 46 +- Marlin/src/lcd/extui/nextion/nextion_tft.h | 26 +- .../src/lcd/extui/nextion/nextion_tft_defs.h | 14 +- Marlin/src/lcd/language/language_en.h | 6 +- 42 files changed, 3097 insertions(+), 3124 deletions(-) create mode 100644 Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp rename Marlin/src/lcd/extui/ia_creality/{ia_creality_extui.h => ia_creality_rts.h} (92%) diff --git a/Marlin/src/HAL/AVR/HAL.h b/Marlin/src/HAL/AVR/HAL.h index d458790979fff..6d98dff08020e 100644 --- a/Marlin/src/HAL/AVR/HAL.h +++ b/Marlin/src/HAL/AVR/HAL.h @@ -140,7 +140,7 @@ typedef Servo hal_servo_t; #endif #define LCD_SERIAL lcdSerial #if HAS_DGUS_LCD - #define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.get_tx_buffer_free() + #define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.get_tx_buffer_free() #endif #endif diff --git a/Marlin/src/HAL/LPC1768/HAL.h b/Marlin/src/HAL/LPC1768/HAL.h index 6d5824f7a151c..be4d59ada7371 100644 --- a/Marlin/src/HAL/LPC1768/HAL.h +++ b/Marlin/src/HAL/LPC1768/HAL.h @@ -101,7 +101,7 @@ extern DefaultSerial1 USBSerial; #error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB." #endif #if HAS_DGUS_LCD - #define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.available() + #define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.available() #endif #endif diff --git a/Marlin/src/HAL/STM32/HAL.h b/Marlin/src/HAL/STM32/HAL.h index 54359c5b09875..dc36cc1eca337 100644 --- a/Marlin/src/HAL/STM32/HAL.h +++ b/Marlin/src/HAL/STM32/HAL.h @@ -114,7 +114,7 @@ #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() + #define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite() #endif #endif diff --git a/Marlin/src/HAL/STM32F1/HAL.h b/Marlin/src/HAL/STM32F1/HAL.h index 954281a4be3e6..8ed525bfb71bd 100644 --- a/Marlin/src/HAL/STM32F1/HAL.h +++ b/Marlin/src/HAL/STM32F1/HAL.h @@ -140,7 +140,7 @@ static_assert(false, "LCD_SERIAL_PORT must be from 1 to " STRINGIFY(NUM_UARTS) ". You can also use -1 if the board supports Native USB.") #endif #if HAS_DGUS_LCD - #define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite() + #define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite() #endif #endif diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index ceaf147c3ba1a..53e4466bf811a 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -2536,7 +2536,7 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Menu(Motion, MOTION_STEPS); - break; + break; #if HAS_X_AXIS case STEPS_X: if (draw) { diff --git a/Marlin/src/lcd/extui/anycubic_chiron/FileNavigator.cpp b/Marlin/src/lcd/extui/anycubic_chiron/FileNavigator.cpp index 6e77b2b2fda62..ffc485a3dc2f6 100644 --- a/Marlin/src/lcd/extui/anycubic_chiron/FileNavigator.cpp +++ b/Marlin/src/lcd/extui/anycubic_chiron/FileNavigator.cpp @@ -60,21 +60,21 @@ using namespace ExtUI; namespace Anycubic { FileNavigator filenavigator; -FileList FileNavigator::filelist; // Instance of the Marlin file API +FileList FileNavigator::filelist; // ExtUI file API uint16_t FileNavigator::lastpanelindex; uint16_t FileNavigator::currentindex; // override the panel request uint8_t FileNavigator::folderdepth; -uint16_t FileNavigator::currentfolderindex[MAX_FOLDER_DEPTH]; // track folder pos for iteration -char FileNavigator::currentfoldername[MAX_PATH_LEN + 1]; // Current folder path +uint16_t FileNavigator::currentDirIndex[MAX_FOLDER_DEPTH]; // track folder pos for iteration +char FileNavigator::currentDirPath[MAX_PATH_LEN + 1]; // Current folder path FileNavigator::FileNavigator() { reset(); } void FileNavigator::reset() { - currentfoldername[0] = '\0'; + currentDirPath[0] = '\0'; folderdepth = 0; currentindex = 0; lastpanelindex = 0; - ZERO(currentfolderindex); + ZERO(currentDirIndex); // Start at root folder while (!filelist.isAtRootDir()) filelist.upDir(); @@ -85,9 +85,9 @@ void FileNavigator::refresh() { filelist.refresh(); } void FileNavigator::changeDIR(const char *folder) { if (folderdepth >= MAX_FOLDER_DEPTH) return; // limit the folder depth - currentfolderindex[folderdepth] = currentindex; - strcat(currentfoldername, folder); - strcat(currentfoldername, "/"); + currentDirIndex[folderdepth] = currentindex; + strcat(currentDirPath, folder); + strcat(currentDirPath, "/"); filelist.changeDir(folder); folderdepth++; currentindex = 0; @@ -97,15 +97,15 @@ void FileNavigator::upDIR() { if (!filelist.isAtRootDir()) { filelist.upDir(); folderdepth--; - currentindex = currentfolderindex[folderdepth]; // restore last position in the folder + currentindex = currentDirIndex[folderdepth]; // restore last position in the folder filelist.seek(currentindex); // restore file information } // Remove the child folder from the stored path if (folderdepth == 0) - currentfoldername[0] = '\0'; + currentDirPath[0] = '\0'; else { - char * const pos = strchr(currentfoldername, '/'); + char * const pos = strchr(currentDirPath, '/'); *(pos + 1) = '\0'; } } @@ -151,7 +151,7 @@ void FileNavigator::skiptofileindex(uint16_t skip) { // The new panel ignores entries that don't end in .GCO or .gcode so add and pad them. if (paneltype <= AC_panel_new) { TFTSer.println("<<.GCO"); - Chiron.SendtoTFTLN(F(".. .gcode")); + chiron.tftSendLn(F(".. .gcode")); } else { TFTSer.println("<<"); @@ -186,7 +186,7 @@ void FileNavigator::skiptofileindex(uint16_t skip) { } else { // Not DIR TFTSer.write('/'); - if (folderdepth > 0) TFTSer.print(currentfoldername); + if (folderdepth > 0) TFTSer.print(currentDirPath); TFTSer.println(filelist.shortFilename()); TFTSer.print(filelist.longFilename()); @@ -233,9 +233,9 @@ void FileNavigator::skiptofileindex(uint16_t skip) { void FileNavigator::sendFile(panel_type_t paneltype) { TFTSer.write('/'); - if (folderdepth > 0) TFTSer.print(currentfoldername); + if (folderdepth > 0) TFTSer.print(currentDirPath); TFTSer.println(filelist.shortFilename()); - if (folderdepth > 0) TFTSer.print(currentfoldername); + if (folderdepth > 0) TFTSer.print(currentDirPath); TFTSer.println(filelist.longFilename()); } diff --git a/Marlin/src/lcd/extui/anycubic_chiron/FileNavigator.h b/Marlin/src/lcd/extui/anycubic_chiron/FileNavigator.h index 71236c4df9575..f4fad96653142 100644 --- a/Marlin/src/lcd/extui/anycubic_chiron/FileNavigator.h +++ b/Marlin/src/lcd/extui/anycubic_chiron/FileNavigator.h @@ -52,8 +52,8 @@ namespace Anycubic { static uint16_t lastpanelindex; static uint16_t currentindex; static uint8_t folderdepth; - static uint16_t currentfolderindex[MAX_FOLDER_DEPTH]; - static char currentfoldername[MAX_PATH_LEN + 1]; + static uint16_t currentDirIndex[MAX_FOLDER_DEPTH]; + static char currentDirPath[MAX_PATH_LEN + 1]; }; extern FileNavigator filenavigator; diff --git a/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp b/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp index 520ca587e3356..27ee4689ba122 100644 --- a/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp +++ b/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp @@ -37,17 +37,17 @@ using namespace Anycubic; namespace ExtUI { - void onStartup() { Chiron.Startup(); } + void onStartup() { chiron.startup(); } - void onIdle() { Chiron.IdleLoop(); } + void onIdle() { chiron.idleLoop(); } void onPrinterKilled(FSTR_P const error, FSTR_P const component) { - Chiron.PrinterKilled(error, component); + chiron.printerKilled(error, component); } - void onMediaInserted() { Chiron.MediaEvent(AC_media_inserted); } - void onMediaError() { Chiron.MediaEvent(AC_media_error); } - void onMediaRemoved() { Chiron.MediaEvent(AC_media_removed); } + void onMediaInserted() { chiron.mediaEvent(AC_media_inserted); } + void onMediaError() { chiron.mediaEvent(AC_media_error); } + void onMediaRemoved() { chiron.mediaEvent(AC_media_removed); } void onPlayTone(const uint16_t frequency, const uint16_t duration) { #if ENABLED(SPEAKER) @@ -55,15 +55,15 @@ namespace ExtUI { #endif } - void onPrintTimerStarted() { Chiron.TimerEvent(AC_timer_started); } - void onPrintTimerPaused() { Chiron.TimerEvent(AC_timer_paused); } - void onPrintTimerStopped() { Chiron.TimerEvent(AC_timer_stopped); } + void onPrintTimerStarted() { chiron.timerEvent(AC_timer_started); } + void onPrintTimerPaused() { chiron.timerEvent(AC_timer_paused); } + void onPrintTimerStopped() { chiron.timerEvent(AC_timer_stopped); } void onPrintDone() {} - void onFilamentRunout(const extruder_t) { Chiron.FilamentRunout(); } + void onFilamentRunout(const extruder_t) { chiron.filamentRunout(); } - void onUserConfirmRequired(const char * const msg) { Chiron.ConfirmationRequest(msg); } - void onStatusChanged(const char * const msg) { Chiron.StatusChange(msg); } + void onUserConfirmRequired(const char * const msg) { chiron.confirmationRequest(msg); } + void onStatusChanged(const char * const msg) { chiron.statusChange(msg); } void onHomingStart() {} void onHomingDone() {} @@ -127,7 +127,7 @@ namespace ExtUI { // Called when power-loss state is detected } // Called on resume from power-loss - void onPowerLossResume() { Chiron.PowerLossRecovery(); } + void onPowerLossResume() { chiron.powerLossRecovery(); } #endif #if HAS_PID_HEATING diff --git a/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp b/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp index f3bc64a02498e..bcf78746a2407 100644 --- a/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp +++ b/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp @@ -42,9 +42,13 @@ #include "../../../libs/numtostr.h" #include "../../../MarlinCore.h" +#define DEBUG_OUT ACDEBUGLEVEL +#include "../../../core/debug_out.h" + namespace Anycubic { -ChironTFT Chiron; +ChironTFT chiron; + #if AUTO_DETECT_CHIRON_TFT panel_type_t ChironTFT::panel_type = AC_panel_unknown; #endif @@ -60,7 +64,7 @@ uint8_t ChironTFT::command_len; float ChironTFT::live_Zoffset; file_menu_t ChironTFT::file_menu; -void ChironTFT::Startup() { +void ChironTFT::startup() { selectedfile[0] = '\0'; panel_command[0] = '\0'; command_len = 0; @@ -92,73 +96,73 @@ void ChironTFT::Startup() { break; default: SERIAL_ECHOLNF(AC_msg_auto_panel_detection); - DetectPanelType(); + detectPanelType(); break; } // Signal Board has reset - SendtoTFTLN(AC_msg_main_board_has_reset); + tftSendLn(AC_msg_main_board_has_reset); // Enable leveling and Disable end stops during print // as Z home places nozzle above the bed so we need to allow it past the end stops injectCommands(AC_cmnd_enable_leveling); - // Startup tunes are defined in Tunes.h + // startup tunes are defined in Tunes.h PlayTune(TERN(AC_DEFAULT_STARTUP_TUNE, Anycubic_PowerOn, GB_PowerOn)); #if ACDEBUGLEVEL - SERIAL_ECHOLNPGM("AC Debug Level ", ACDEBUGLEVEL); + DEBUG_ECHOLNPGM("AC Debug Level ", ACDEBUGLEVEL); #endif - SendtoTFTLN(AC_msg_ready); + tftSendLn(AC_msg_ready); } -void ChironTFT::DetectPanelType() { +void ChironTFT::detectPanelType() { #if AUTO_DETECT_CHIRON_TFT // Send a query to the TFT - SendtoTFTLN(AC_Test_for_OldPanel); // The panel will respond with 'SXY 480 320' - SendtoTFTLN(AC_Test_for_NewPanel); // the panel will respond with '[0]=0 ' to '[19]=0 ' + tftSendLn(AC_Test_for_OldPanel); // The panel will respond with 'SXY 480 320' + tftSendLn(AC_Test_for_NewPanel); // the panel will respond with '[0]=0 ' to '[19]=0 ' #endif } -void ChironTFT::IdleLoop() { - if (ReadTFTCommand()) { - ProcessPanelRequest(); +void ChironTFT::idleLoop() { + if (readTFTCommand()) { + processPanelRequest(); command_len = 0; } - CheckHeaters(); + checkHeaters(); } -void ChironTFT::PrinterKilled(FSTR_P const error, FSTR_P const component) { - SendtoTFTLN(AC_msg_kill_lcd); +void ChironTFT::printerKilled(FSTR_P const error, FSTR_P const component) { + tftSendLn(AC_msg_kill_lcd); #if ACDEBUG(AC_MARLIN) - SERIAL_ECHOLNPGM("PrinterKilled()\nerror: ", error , "\ncomponent: ", component); + DEBUG_ECHOLNPGM("printerKilled()\nerror: ", error , "\ncomponent: ", component); #endif } -void ChironTFT::MediaEvent(media_event_t event) { +void ChironTFT::mediaEvent(media_event_t event) { #if ACDEBUG(AC_MARLIN) - SERIAL_ECHOLNPGM("ProcessMediaStatus() ", event); + DEBUG_ECHOLNPGM("ProcessMediaStatus() ", event); #endif switch (event) { case AC_media_inserted: - SendtoTFTLN(AC_msg_sd_card_inserted); + tftSendLn(AC_msg_sd_card_inserted); break; case AC_media_removed: - SendtoTFTLN(AC_msg_sd_card_removed); + tftSendLn(AC_msg_sd_card_removed); break; case AC_media_error: last_error = AC_error_noSD; - SendtoTFTLN(AC_msg_no_sd_card); + tftSendLn(AC_msg_no_sd_card); break; } } -void ChironTFT::TimerEvent(timer_event_t event) { +void ChironTFT::timerEvent(timer_event_t event) { #if ACDEBUG(AC_MARLIN) - SERIAL_ECHOLNPGM("TimerEvent() ", event); - SERIAL_ECHOLNPGM("Printer State: ", printer_state); + DEBUG_ECHOLNPGM("timerEvent() ", event); + DEBUG_ECHOLNPGM("Printer State: ", printer_state); #endif switch (event) { @@ -166,44 +170,44 @@ void ChironTFT::TimerEvent(timer_event_t event) { live_Zoffset = 0.0; // reset print offset setSoftEndstopState(false); // disable endstops to print printer_state = AC_printer_printing; - SendtoTFTLN(AC_msg_print_from_sd_card); + tftSendLn(AC_msg_print_from_sd_card); } break; case AC_timer_paused: { printer_state = AC_printer_paused; pause_state = AC_paused_idle; - SendtoTFTLN(AC_msg_paused); + tftSendLn(AC_msg_paused); } break; case AC_timer_stopped: { if (printer_state != AC_printer_idle) { printer_state = AC_printer_stopping; - SendtoTFTLN(AC_msg_print_complete); + tftSendLn(AC_msg_print_complete); } setSoftEndstopState(true); // enable endstops } break; } } -void ChironTFT::FilamentRunout() { +void ChironTFT::filamentRunout() { #if ACDEBUG(AC_MARLIN) - SERIAL_ECHOLNPGM("FilamentRunout() printer_state ", printer_state); + DEBUG_ECHOLNPGM("filamentRunout() printer_state ", printer_state); #endif // 1 Signal filament out last_error = AC_error_filament_runout; - SendtoTFTLN(isPrintingFromMedia() ? AC_msg_filament_out_alert : AC_msg_filament_out_block); + tftSendLn(isPrintingFromMedia() ? AC_msg_filament_out_alert : AC_msg_filament_out_block); PlayTune(FilamentOut); } -void ChironTFT::ConfirmationRequest(const char * const msg) { +void ChironTFT::confirmationRequest(const char * const msg) { // M108 continue #if ACDEBUG(AC_MARLIN) - SERIAL_ECHOLNPGM("ConfirmationRequest() ", msg, " printer_state:", printer_state); + DEBUG_ECHOLNPGM("confirmationRequest() ", msg, " printer_state:", printer_state); #endif switch (printer_state) { case AC_printer_pausing: { if (strcmp_P(msg, MARLIN_msg_print_paused) == 0 || strcmp_P(msg, MARLIN_msg_nozzle_parked) == 0) { - SendtoTFTLN(AC_msg_paused); // enable continue button + tftSendLn(AC_msg_paused); // enable continue button printer_state = AC_printer_paused; } } break; @@ -214,18 +218,18 @@ void ChironTFT::ConfirmationRequest(const char * const msg) { // Heater timeout, send acknowledgement if (strcmp_P(msg, MARLIN_msg_heater_timeout) == 0) { pause_state = AC_paused_heater_timed_out; - SendtoTFTLN(AC_msg_paused); // enable continue button + tftSendLn(AC_msg_paused); // enable continue button PlayTune(HeaterTimeout); } // Reheat finished, send acknowledgement else if (strcmp_P(msg, MARLIN_msg_reheat_done) == 0) { pause_state = AC_paused_idle; - SendtoTFTLN(AC_msg_paused); // enable continue button + tftSendLn(AC_msg_paused); // enable continue button } // Filament Purging, send acknowledgement enter run mode else if (strcmp_P(msg, MARLIN_msg_filament_purging) == 0) { pause_state = AC_paused_purging_filament; - SendtoTFTLN(AC_msg_paused); // enable continue button + tftSendLn(AC_msg_paused); // enable continue button } } break; default: @@ -233,10 +237,10 @@ void ChironTFT::ConfirmationRequest(const char * const msg) { } } -void ChironTFT::StatusChange(const char * const msg) { +void ChironTFT::statusChange(const char * const msg) { #if ACDEBUG(AC_MARLIN) - SERIAL_ECHOLNPGM("StatusChange() ", msg); - SERIAL_ECHOLNPGM("printer_state:", printer_state); + DEBUG_ECHOLNPGM("statusChange() ", msg); + DEBUG_ECHOLNPGM("printer_state:", printer_state); #endif bool msg_matched = false; // The only way to get printer status is to parse messages @@ -247,7 +251,7 @@ void ChironTFT::StatusChange(const char * const msg) { // Ignore the custom machine name if (strcmp_P(msg + strlen(MACHINE_NAME), MARLIN_msg_ready) == 0) { injectCommands(F("M500\nG27")); - SendtoTFTLN(AC_msg_probing_complete); + tftSendLn(AC_msg_probing_complete); printer_state = AC_printer_idle; msg_matched = true; } @@ -255,7 +259,7 @@ void ChironTFT::StatusChange(const char * const msg) { if (strcmp_P(msg, MARLIN_msg_probing_failed) == 0) { PlayTune(BeepBeepBeeep); injectCommands(F("G1 Z50 F500")); - SendtoTFTLN(AC_msg_probing_complete); + tftSendLn(AC_msg_probing_complete); printer_state = AC_printer_idle; msg_matched = true; } @@ -263,14 +267,14 @@ void ChironTFT::StatusChange(const char * const msg) { case AC_printer_printing: { if (strcmp_P(msg, MARLIN_msg_reheating) == 0) { - SendtoTFTLN(AC_msg_paused); // enable continue button + tftSendLn(AC_msg_paused); // enable continue button msg_matched = true; } } break; case AC_printer_pausing: { if (strcmp_P(msg, MARLIN_msg_print_paused) == 0) { - SendtoTFTLN(AC_msg_paused); + tftSendLn(AC_msg_paused); printer_state = AC_printer_paused; pause_state = AC_paused_idle; msg_matched = true; @@ -279,7 +283,7 @@ void ChironTFT::StatusChange(const char * const msg) { case AC_printer_stopping: { if (strcmp_P(msg, MARLIN_msg_print_aborted) == 0) { - SendtoTFTLN(AC_msg_stop); + tftSendLn(AC_msg_stop); printer_state = AC_printer_idle; msg_matched = true; } @@ -291,11 +295,11 @@ void ChironTFT::StatusChange(const char * const msg) { // If not matched earlier see if this was a heater message if (!msg_matched) { if (strcmp_P(msg, MARLIN_msg_extruder_heating) == 0) { - SendtoTFTLN(AC_msg_nozzle_heating); + tftSendLn(AC_msg_nozzle_heating); hotend_state = AC_heater_temp_set; } else if (strcmp_P(msg, MARLIN_msg_bed_heating) == 0) { - SendtoTFTLN(AC_msg_bed_heating); + tftSendLn(AC_msg_bed_heating); hotbed_state = AC_heater_temp_set; } else if (strcmp_P(msg, MARLIN_msg_EEPROM_version) == 0) { @@ -304,33 +308,33 @@ void ChironTFT::StatusChange(const char * const msg) { } } -void ChironTFT::PowerLossRecovery() { +void ChironTFT::powerLossRecovery() { printer_state = AC_printer_resuming_from_power_outage; // Play tune to notify user we can recover. last_error = AC_error_powerloss; PlayTune(SOS); SERIAL_ECHOLNF(AC_msg_powerloss_recovery); } -void ChironTFT::PrintComplete() { - SendtoTFT(AC_msg_print_complete); +void ChironTFT::printComplete() { + tftSend(AC_msg_print_complete); printer_state = AC_printer_idle; setSoftEndstopState(true); // enable endstops } -void ChironTFT::SendtoTFT(FSTR_P const fstr/*=nullptr*/) { // A helper to print PROGMEM string to the panel +void ChironTFT::tftSend(FSTR_P const fstr/*=nullptr*/) { // A helper to print PROGMEM string to the panel #if ACDEBUG(AC_SOME) - SERIAL_ECHOF(fstr); + DEBUG_ECHOF(fstr); #endif PGM_P str = FTOP(fstr); while (const char c = pgm_read_byte(str++)) TFTSer.write(c); } -void ChironTFT::SendtoTFTLN(FSTR_P const fstr/*=nullptr*/) { +void ChironTFT::tftSendLn(FSTR_P const fstr/*=nullptr*/) { if (fstr) { #if ACDEBUG(AC_SOME) - SERIAL_ECHOPGM("> "); + DEBUG_ECHOPGM("> "); #endif - SendtoTFT(fstr); + tftSend(fstr); #if ACDEBUG(AC_SOME) SERIAL_EOL(); #endif @@ -338,7 +342,7 @@ void ChironTFT::SendtoTFTLN(FSTR_P const fstr/*=nullptr*/) { TFTSer.println(); } -bool ChironTFT::ReadTFTCommand() { +bool ChironTFT::readTFTCommand() { bool command_ready = false; while (TFTSer.available() > 0 && command_len < MAX_CMND_LEN) { panel_command[command_len] = TFTSer.read(); @@ -352,29 +356,29 @@ bool ChironTFT::ReadTFTCommand() { if (command_ready || command_len == MAX_CMND_LEN) { panel_command[command_len] = '\0'; #if ACDEBUG(AC_ALL) - SERIAL_ECHOLNPGM("len(",command_len,") < ", panel_command); + DEBUG_ECHOLNPGM("len(",command_len,") < ", panel_command); #endif command_ready = true; } return command_ready; } -int8_t ChironTFT::FindToken(char c) { +int8_t ChironTFT::findToken(char c) { for (int8_t pos = 0; pos < command_len; pos++) { if (panel_command[pos] == c) { #if ACDEBUG(AC_INFO) - SERIAL_ECHOLNPGM("Tpos:", pos, " ", c); + DEBUG_ECHOLNPGM("Tpos:", pos, " ", c); #endif return pos; } } #if ACDEBUG(AC_INFO) - SERIAL_ECHOLNPGM("Not found: ", c); + DEBUG_ECHOLNPGM("Not found: ", c); #endif return -1; } -void ChironTFT::CheckHeaters() { +void ChironTFT::checkHeaters() { uint8_t faultDuration = 0; // if the hotend temp is abnormal, confirm state before signalling panel @@ -382,7 +386,7 @@ void ChironTFT::CheckHeaters() { while (!WITHIN(temp, HEATER_0_MINTEMP, HEATER_0_MAXTEMP)) { faultDuration++; if (faultDuration >= AC_HEATER_FAULT_VALIDATION_TIME) { - SendtoTFTLN(AC_msg_nozzle_temp_abnormal); + tftSendLn(AC_msg_nozzle_temp_abnormal); last_error = AC_error_abnormal_temp_t0; SERIAL_ECHOLNPGM("Extruder temp abnormal! : ", temp); break; @@ -397,7 +401,7 @@ void ChironTFT::CheckHeaters() { while (!WITHIN(temp, BED_MINTEMP, BED_MAXTEMP)) { faultDuration++; if (faultDuration >= AC_HEATER_FAULT_VALIDATION_TIME) { - SendtoTFTLN(AC_msg_nozzle_temp_abnormal); + tftSendLn(AC_msg_nozzle_temp_abnormal); last_error = AC_error_abnormal_temp_bed; SERIAL_ECHOLNPGM("Bed temp abnormal! : ", temp); break; @@ -409,7 +413,7 @@ void ChironTFT::CheckHeaters() { // Update panel with hotend heater status if (hotend_state != AC_heater_temp_reached) { if (WITHIN(getActualTemp_celsius(E0) - getTargetTemp_celsius(E0), -(TEMP_WINDOW), TEMP_WINDOW)) { - SendtoTFTLN(AC_msg_nozzle_heating_done); + tftSendLn(AC_msg_nozzle_heating_done); hotend_state = AC_heater_temp_reached; } } @@ -417,23 +421,23 @@ void ChironTFT::CheckHeaters() { // Update panel with bed heater status if (hotbed_state != AC_heater_temp_reached) { if (WITHIN(getActualTemp_celsius(BED) - getTargetTemp_celsius(BED), -(TEMP_BED_WINDOW), TEMP_BED_WINDOW)) { - SendtoTFTLN(AC_msg_bed_heating_done); + tftSendLn(AC_msg_bed_heating_done); hotbed_state = AC_heater_temp_reached; } } } -void ChironTFT::SendFileList(int8_t startindex) { +void ChironTFT::sendFileList(int8_t startindex) { // Respond to panel request for 4 files starting at index #if ACDEBUG(AC_INFO) - SERIAL_ECHOLNPGM("## SendFileList ## ", startindex); + DEBUG_ECHOLNPGM("## sendFileList ## ", startindex); #endif - SendtoTFTLN(F("FN ")); + tftSendLn(F("FN ")); filenavigator.getFiles(startindex, panel_type, 4); - SendtoTFTLN(F("END")); + tftSendLn(F("END")); } -void ChironTFT::SelectFile() { +void ChironTFT::selectFile() { if (panel_type <= AC_panel_new) { strncpy(selectedfile, panel_command + 4, command_len - 3); selectedfile[command_len - 4] = '\0'; @@ -443,50 +447,50 @@ void ChironTFT::SelectFile() { selectedfile[command_len - 5] = '\0'; } #if ACDEBUG(AC_FILE) - SERIAL_ECHOLNPGM(" Selected File: ",selectedfile); + DEBUG_ECHOLNPGM(" Selected File: ",selectedfile); #endif switch (selectedfile[0]) { case '/': // Valid file selected - SendtoTFTLN(AC_msg_sd_file_open_success); + tftSendLn(AC_msg_sd_file_open_success); break; case '<': // .. (go up folder level) filenavigator.upDIR(); - SendtoTFTLN(AC_msg_sd_file_open_failed); - SendFileList( 0 ); + tftSendLn(AC_msg_sd_file_open_failed); + sendFileList( 0 ); break; default: // enter sub folder // for new panel remove the '.GCO' tag that was added to the end of the path if (panel_type <= AC_panel_new) selectedfile[strlen(selectedfile) - 4] = '\0'; filenavigator.changeDIR(selectedfile); - SendtoTFTLN(AC_msg_sd_file_open_failed); - SendFileList( 0 ); + tftSendLn(AC_msg_sd_file_open_failed); + sendFileList( 0 ); break; } } -void ChironTFT::ProcessPanelRequest() { +void ChironTFT::processPanelRequest() { // Break these up into logical blocks // as its easier to navigate than one huge switch case! - int8_t tpos = FindToken('A'); + int8_t tpos = findToken('A'); // Panel request are 'A0' - 'A36' if (tpos >= 0) { const int8_t req = atoi(&panel_command[tpos + 1]); // Information requests A0 - A8 and A33 - if (req <= 8 || req == 33) PanelInfo(req); + if (req <= 8 || req == 33) panelInfo(req); // Simple Actions A9 - A28 - else if (req <= 28) PanelAction(req); + else if (req <= 28) panelAction(req); // Process Initiation - else if (req <= 36) PanelProcess(req); + else if (req <= 36) panelProcess(req); } else { #if AUTO_DETECT_CHIRON_TFT // This may be a response to a panel type detection query if (panel_type == AC_panel_unknown) { - tpos = FindToken('S'); // old panel will respond to 'SIZE' with 'SXY 480 320' + tpos = findToken('S'); // old panel will respond to 'SIZE' with 'SXY 480 320' if (tpos >= 0) { if (panel_command[tpos + 1] == 'X' && panel_command[tpos + 2] =='Y') { panel_type = AC_panel_standard; @@ -496,7 +500,7 @@ void ChironTFT::ProcessPanelRequest() { else { // new panel will respond to 'J200' with '[0]=0' // it seems only after a power cycle so detection assumes a new panel - tpos = FindToken('['); + tpos = findToken('['); if (tpos >= 0) { if (panel_command[tpos + 1] == '0' && panel_command[tpos + 2] ==']') { panel_type = AC_panel_new; @@ -508,94 +512,94 @@ void ChironTFT::ProcessPanelRequest() { } #endif - SendtoTFTLN(); // Ignore unknown requests + tftSendLn(); // Ignore unknown requests } } -void ChironTFT::PanelInfo(uint8_t req) { +void ChironTFT::panelInfo(uint8_t req) { // information requests A0-A8 and A33 switch (req) { case 0: // A0 Get HOTEND Temp - SendtoTFT(F("A0V ")); + tftSend(F("A0V ")); TFTSer.println(getActualTemp_celsius(E0)); break; case 1: // A1 Get HOTEND Target Temp - SendtoTFT(F("A1V ")); + tftSend(F("A1V ")); TFTSer.println(getTargetTemp_celsius(E0)); break; case 2: // A2 Get BED Temp - SendtoTFT(F("A2V ")); + tftSend(F("A2V ")); TFTSer.println(getActualTemp_celsius(BED)); break; case 3: // A3 Get BED Target Temp - SendtoTFT(F("A3V ")); + tftSend(F("A3V ")); TFTSer.println(getTargetTemp_celsius(BED)); break; case 4: // A4 Get FAN Speed - SendtoTFT(F("A4V ")); + tftSend(F("A4V ")); TFTSer.println(getActualFan_percent(FAN0)); break; case 5: // A5 Get Current Coordinates - SendtoTFT(F("A5V X: ")); + tftSend(F("A5V X: ")); TFTSer.print(getAxisPosition_mm(X)); - SendtoTFT(F(" Y: ")); + tftSend(F(" Y: ")); TFTSer.print(getAxisPosition_mm(Y)); - SendtoTFT(F(" Z: ")); + tftSend(F(" Z: ")); TFTSer.println(getAxisPosition_mm(Z)); break; case 6: // A6 Get printing progress if (isPrintingFromMedia()) { - SendtoTFT(F("A6V ")); + tftSend(F("A6V ")); TFTSer.println(ui8tostr2(getProgress_percent())); } else - SendtoTFTLN(F("A6V ---")); + tftSendLn(F("A6V ---")); break; case 7: { // A7 Get Printing Time uint32_t time = getProgress_seconds_elapsed() / 60; - SendtoTFT(F("A7V ")); + tftSend(F("A7V ")); TFTSer.print(ui8tostr2(time / 60)); - SendtoTFT(F(" H ")); + tftSend(F(" H ")); TFTSer.print(ui8tostr2(time % 60)); - SendtoTFT(F(" M")); + tftSend(F(" M")); #if ACDEBUG(AC_ALL) - SERIAL_ECHOLNPGM("Print time ", ui8tostr2(time / 60), ":", ui8tostr2(time % 60)); + DEBUG_ECHOLNPGM("Print time ", ui8tostr2(time / 60), ":", ui8tostr2(time % 60)); #endif } break; case 8: // A8 Get SD Card list A8 S0 if (!isMediaInserted()) safe_delay(500); if (!isMediaInserted()) // Make sure the card is removed - SendtoTFTLN(AC_msg_no_sd_card); + tftSendLn(AC_msg_no_sd_card); else if (panel_command[3] == 'S') - SendFileList( atoi( &panel_command[4] ) ); + sendFileList( atoi( &panel_command[4] ) ); break; case 33: // A33 Get firmware info - SendtoTFT(F("J33 ")); + tftSend(F("J33 ")); // If there is an error recorded, show that instead of the FW version - if (!GetLastError()) SendtoTFTLN(F(SHORT_BUILD_VERSION)); + if (!getLastError()) tftSendLn(F(SHORT_BUILD_VERSION)); break; } } -void ChironTFT::PanelAction(uint8_t req) { +void ChironTFT::panelAction(uint8_t req) { switch (req) { case 9: // A9 Pause SD print if (isPrintingFromMedia()) { - SendtoTFTLN(AC_msg_pause); + tftSendLn(AC_msg_pause); pausePrint(); printer_state = AC_printer_pausing; } else - SendtoTFTLN(AC_msg_stop); + tftSendLn(AC_msg_stop); break; case 10: // A10 Resume SD Print @@ -613,7 +617,7 @@ void ChironTFT::PanelAction(uint8_t req) { else { if (printer_state == AC_printer_resuming_from_power_outage) injectCommands(F("M1000 C")); // Cancel recovery - SendtoTFTLN(AC_msg_stop); + tftSendLn(AC_msg_stop); printer_state = AC_printer_idle; } break; @@ -623,7 +627,7 @@ void ChironTFT::PanelAction(uint8_t req) { break; case 13: // A13 Select file - SelectFile(); + selectFile(); break; case 14: // A14 Start Printing @@ -632,11 +636,9 @@ void ChironTFT::PanelAction(uint8_t req) { injectCommands(F("M1000 C")); // Cancel recovery printer_state = AC_printer_idle; } - #if ACDebugLevel >= 1 - SERIAL_ECHOLNPGM("Print: ", selectedfile); - #endif + DEBUG_ECHOLNPGM("Print: ", selectedfile); printFile(selectedfile); - SendtoTFTLN(AC_msg_print_from_sd_card); + tftSendLn(AC_msg_print_from_sd_card); break; case 15: // A15 Resuming from outage @@ -671,7 +673,7 @@ void ChironTFT::PanelAction(uint8_t req) { case 19: // A19 Motors off if (!isPrinting()) { stepper.disable_all_steppers(); - SendtoTFTLN(AC_msg_ready); + tftSendLn(AC_msg_ready); } break; @@ -679,7 +681,7 @@ void ChironTFT::PanelAction(uint8_t req) { if (panel_command[4] == 'S') setFeedrate_percent(atoi(&panel_command[5])); else { - SendtoTFT(F("A20V ")); + tftSend(F("A20V ")); TFTSer.println(getFeedrate_percent()); } break; @@ -707,7 +709,7 @@ void ChironTFT::PanelAction(uint8_t req) { char MoveCmnd[30]; sprintf_P(MoveCmnd, PSTR("G91\nG0%s\nG90"), panel_command + 3); #if ACDEBUG(AC_ACTION) - SERIAL_ECHOLNPGM("Move: ", MoveCmnd); + DEBUG_ECHOLNPGM("Move: ", MoveCmnd); #endif setSoftEndstopState(true); // enable endstops injectCommands(MoveCmnd); @@ -720,7 +722,7 @@ void ChironTFT::PanelAction(uint8_t req) { // Temps defined in configuration.h setTargetTemp_celsius(PREHEAT_1_TEMP_BED, BED); setTargetTemp_celsius(PREHEAT_1_TEMP_HOTEND, E0); - SendtoTFTLN(); + tftSendLn(); hotbed_state = AC_heater_temp_set; hotend_state = AC_heater_temp_set; } @@ -731,7 +733,7 @@ void ChironTFT::PanelAction(uint8_t req) { if (!isPrinting()) { setTargetTemp_celsius(PREHEAT_2_TEMP_BED, BED); setTargetTemp_celsius(PREHEAT_2_TEMP_HOTEND, E0); - SendtoTFTLN(); + tftSendLn(); hotbed_state = AC_heater_temp_set; hotend_state = AC_heater_temp_set; } @@ -742,7 +744,7 @@ void ChironTFT::PanelAction(uint8_t req) { if (!isPrinting()) { setTargetTemp_celsius(0, E0); setTargetTemp_celsius(0, BED); - SendtoTFTLN(AC_msg_ready); + tftSendLn(AC_msg_ready); hotbed_state = AC_heater_off; hotend_state = AC_heater_off; } @@ -761,21 +763,21 @@ void ChironTFT::PanelAction(uint8_t req) { case 28: // A28 Filament set A28 O/C // Ignore request if printing if (isPrinting()) break; - SendtoTFTLN(); + tftSendLn(); break; } } -void ChironTFT::PanelProcess(uint8_t req) { +void ChironTFT::panelProcess(uint8_t req) { switch (req) { case 29: { // A29 Read Mesh Point A29 X1 Y1 xy_uint8_t pos; float pos_z; - pos.x = atoi(&panel_command[FindToken('X')+1]); - pos.y = atoi(&panel_command[FindToken('Y')+1]); + pos.x = atoi(&panel_command[findToken('X')+1]); + pos.y = atoi(&panel_command[findToken('Y')+1]); pos_z = getMeshPoint(pos); - SendtoTFT(F("A29V ")); + tftSend(F("A29V ")); TFTSer.println(pos_z * 100); if (!isPrinting()) { setSoftEndstopState(true); // disable endstops @@ -786,7 +788,7 @@ void ChironTFT::PanelProcess(uint8_t req) { if (isPositionKnown()) { #if ACDEBUG(AC_INFO) - SERIAL_ECHOLNPGM("Moving to mesh point at x: ", pos.x, " y: ", pos.y, " z: ", pos_z); + DEBUG_ECHOLNPGM("Moving to mesh point at x: ", pos.x, " y: ", pos.y, " z: ", pos_z); #endif // Go up before moving setAxisPosition_mm(3.0,Z); @@ -795,7 +797,7 @@ void ChironTFT::PanelProcess(uint8_t req) { setAxisPosition_mm(20 + (93 * pos.y), Y); setAxisPosition_mm(0.0, Z); #if ACDEBUG(AC_INFO) - SERIAL_ECHOLNPGM("Current Z: ", getAxisPosition_mm(Z)); + DEBUG_ECHOLNPGM("Current Z: ", getAxisPosition_mm(Z)); #endif } } @@ -805,24 +807,24 @@ void ChironTFT::PanelProcess(uint8_t req) { } break; case 30: // A30 Auto leveling - if (FindToken('S') >= 0) { // Start probing New panel adds spaces.. + if (findToken('S') >= 0) { // Start probing New panel adds spaces.. // Ignore request if printing if (isPrinting()) - SendtoTFTLN(AC_msg_probing_not_allowed); // forbid auto leveling + tftSendLn(AC_msg_probing_not_allowed); // forbid auto leveling else { - SendtoTFTLN(AC_msg_start_probing); + tftSendLn(AC_msg_start_probing); injectCommands(F("G28\nG29")); printer_state = AC_printer_probing; } } else - SendtoTFTLN(AC_msg_start_probing); // Just enter levelling menu + tftSendLn(AC_msg_start_probing); // Just enter levelling menu break; case 31: // A31 Adjust all Probe Points // The tokens can occur in different places on the new panel so we need to find it. - if (FindToken('C') >= 0) { // Restore and apply original offsets + if (findToken('C') >= 0) { // Restore and apply original offsets if (!isPrinting()) { injectCommands(F("M501\nM420 S1")); selectedmeshpoint.x = selectedmeshpoint.y = 99; @@ -830,7 +832,7 @@ void ChironTFT::PanelProcess(uint8_t req) { } } - else if (FindToken('D') >= 0) { // Save Z Offset tables and restore leveling state + else if (findToken('D') >= 0) { // Save Z Offset tables and restore leveling state if (!isPrinting()) { setAxisPosition_mm(1.0,Z); // Lift nozzle before any further movements are made injectCommands(F("M500")); @@ -839,8 +841,8 @@ void ChironTFT::PanelProcess(uint8_t req) { } } - else if (FindToken('G') >= 0) { // Get current offset - SendtoTFT(F("A31V ")); + else if (findToken('G') >= 0) { // Get current offset + tftSend(F("A31V ")); // When printing use the live z Offset position // we will use babystepping to move the print head if (isPrinting()) @@ -852,7 +854,7 @@ void ChironTFT::PanelProcess(uint8_t req) { } else { - int8_t tokenpos = FindToken('S'); + int8_t tokenpos = findToken('S'); if (tokenpos >= 0) { // Set offset (adjusts all points by value) float Zshift = atof(&panel_command[tokenpos+1]); setSoftEndstopState(false); // disable endstops @@ -860,22 +862,22 @@ void ChironTFT::PanelProcess(uint8_t req) { // From the leveling panel use the all points UI to adjust the print pos. if (isPrinting()) { #if ACDEBUG(AC_INFO) - SERIAL_ECHOLNPGM("Change Zoffset from:", live_Zoffset, " to ", live_Zoffset + Zshift); + DEBUG_ECHOLNPGM("Change Zoffset from:", live_Zoffset, " to ", live_Zoffset + Zshift); #endif if (isAxisPositionKnown(Z)) { #if ACDEBUG(AC_INFO) const float currZpos = getAxisPosition_mm(Z); - SERIAL_ECHOLNPGM("Nudge Z pos from ", currZpos, " to ", currZpos + constrain(Zshift, -0.05, 0.05)); + DEBUG_ECHOLNPGM("Nudge Z pos from ", currZpos, " to ", currZpos + constrain(Zshift, -0.05, 0.05)); #endif // Use babystepping to adjust the head position int16_t steps = mmToWholeSteps(constrain(Zshift,-0.05,0.05), Z); #if ACDEBUG(AC_INFO) - SERIAL_ECHOLNPGM("Steps to move Z: ", steps); + DEBUG_ECHOLNPGM("Steps to move Z: ", steps); #endif babystepAxis_steps(steps, Z); live_Zoffset += Zshift; } - SendtoTFT(F("A31V ")); + tftSend(F("A31V ")); TFTSer.println(live_Zoffset); } else { @@ -884,23 +886,23 @@ void ChironTFT::PanelProcess(uint8_t req) { const float currval = getMeshPoint(pos); setMeshPoint(pos, constrain(currval + Zshift, AC_LOWEST_MESHPOINT_VAL, 2)); #if ACDEBUG(AC_INFO) - SERIAL_ECHOLNPGM("Change mesh point X", x," Y",y ," from ", currval, " to ", getMeshPoint(pos) ); + DEBUG_ECHOLNPGM("Change mesh point X", x," Y",y ," from ", currval, " to ", getMeshPoint(pos) ); #endif } const float currZOffset = getZOffset_mm(); #if ACDEBUG(AC_INFO) - SERIAL_ECHOLNPGM("Change probe offset from ", currZOffset, " to ", currZOffset + Zshift); + DEBUG_ECHOLNPGM("Change probe offset from ", currZOffset, " to ", currZOffset + Zshift); #endif setZOffset_mm(currZOffset + Zshift); - SendtoTFT(F("A31V ")); + tftSend(F("A31V ")); TFTSer.println(getZOffset_mm()); if (isAxisPositionKnown(Z)) { // Move Z axis const float currZpos = getAxisPosition_mm(Z); #if ACDEBUG(AC_INFO) - SERIAL_ECHOLNPGM("Move Z pos from ", currZpos, " to ", currZpos + constrain(Zshift, -0.05, 0.05)); + DEBUG_ECHOLNPGM("Move Z pos from ", currZpos, " to ", currZpos + constrain(Zshift, -0.05, 0.05)); #endif setAxisPosition_mm(currZpos+constrain(Zshift,-0.05,0.05),Z); } @@ -916,7 +918,7 @@ void ChironTFT::PanelProcess(uint8_t req) { //TFTSer.println(); break; - // A33 firmware info request see PanelInfo() + // A33 firmware info request see panelInfo() case 34: // A34 Adjust single mesh point A34 C/S X1 Y1 V123 if (panel_command[3] == 'C') { // Restore original offsets @@ -932,8 +934,8 @@ void ChironTFT::PanelProcess(uint8_t req) { float currmesh = getMeshPoint(pos); float newval = atof(&panel_command[11])/100; #if ACDEBUG(AC_INFO) - SERIAL_ECHOLNPGM("Change mesh point x:", pos.x, " y:", pos.y); - SERIAL_ECHOLNPGM("from ", currmesh, " to ", newval); + DEBUG_ECHOLNPGM("Change mesh point x:", pos.x, " y:", pos.y); + DEBUG_ECHOLNPGM("from ", currmesh, " to ", newval); #endif // Update Meshpoint setMeshPoint(pos,newval); @@ -944,7 +946,7 @@ void ChironTFT::PanelProcess(uint8_t req) { setSoftEndstopState(false); float currZpos = getAxisPosition_mm(Z); #if ACDEBUG(AC_INFO) - SERIAL_ECHOLNPGM("Move Z pos from ", currZpos, " to ", currZpos + constrain(newval - currmesh, -0.05, 0.05)); + DEBUG_ECHOLNPGM("Move Z pos from ", currZpos, " to ", currZpos + constrain(newval - currmesh, -0.05, 0.05)); #endif setAxisPosition_mm(currZpos + constrain(newval - currmesh, -0.05, 0.05), Z); } @@ -953,19 +955,19 @@ void ChironTFT::PanelProcess(uint8_t req) { break; case 36: // A36 Auto leveling for new TFT bet that was a typo in the panel code! - SendtoTFTLN(AC_msg_start_probing); + tftSendLn(AC_msg_start_probing); break; } } -bool ChironTFT::GetLastError() { +bool ChironTFT::getLastError() { switch (last_error) { - case AC_error_abnormal_temp_bed: SendtoTFTLN(AC_msg_error_bed_temp); break; - case AC_error_abnormal_temp_t0: SendtoTFTLN(AC_msg_error_hotend_temp); break; - case AC_error_noSD: SendtoTFTLN(AC_msg_error_sd_card); break; - case AC_error_powerloss: SendtoTFTLN(AC_msg_power_loss); break; - case AC_error_EEPROM: SendtoTFTLN(AC_msg_eeprom_version); break; - case AC_error_filament_runout: SendtoTFTLN(AC_msg_filament_out); break; + case AC_error_abnormal_temp_bed: tftSendLn(AC_msg_error_bed_temp); break; + case AC_error_abnormal_temp_t0: tftSendLn(AC_msg_error_hotend_temp); break; + case AC_error_noSD: tftSendLn(AC_msg_error_sd_card); break; + case AC_error_powerloss: tftSendLn(AC_msg_power_loss); break; + case AC_error_EEPROM: tftSendLn(AC_msg_eeprom_version); break; + case AC_error_filament_runout: tftSendLn(AC_msg_filament_out); break; default: return false; } last_error = AC_error_none; diff --git a/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.h b/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.h index e0517ec640e0b..25b8145b135b7 100644 --- a/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.h +++ b/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.h @@ -57,32 +57,32 @@ class ChironTFT { static float live_Zoffset; static file_menu_t file_menu; public: - static void Startup(); - static void IdleLoop(); - static void PrinterKilled(FSTR_P, FSTR_P); - static void MediaEvent(media_event_t); - static void TimerEvent(timer_event_t); - static void FilamentRunout(); - static void ConfirmationRequest(const char * const); - static void StatusChange(const char * const); - static void PowerLossRecovery(); - static void PrintComplete(); - static void SendtoTFT(FSTR_P const=nullptr); - static void SendtoTFTLN(FSTR_P const=nullptr); + static void startup(); + static void idleLoop(); + static void printerKilled(FSTR_P, FSTR_P); + static void mediaEvent(media_event_t); + static void timerEvent(timer_event_t); + static void filamentRunout(); + static void confirmationRequest(const char * const); + static void statusChange(const char * const); + static void powerLossRecovery(); + static void printComplete(); + static void tftSend(FSTR_P const=nullptr); + static void tftSendLn(FSTR_P const=nullptr); private: - static void DetectPanelType(); - static bool ReadTFTCommand(); - static int8_t FindToken(char); - static void CheckHeaters(); - static void SendFileList(int8_t); - static void SelectFile(); - static void ProcessPanelRequest(); - static void PanelInfo(uint8_t); - static void PanelAction(uint8_t); - static void PanelProcess(uint8_t); - static bool GetLastError(); + static void detectPanelType(); + static bool readTFTCommand(); + static int8_t findToken(char); + static void checkHeaters(); + static void sendFileList(int8_t); + static void selectFile(); + static void processPanelRequest(); + static void panelInfo(uint8_t); + static void panelAction(uint8_t); + static void panelProcess(uint8_t); + static bool getLastError(); }; -extern ChironTFT Chiron; +extern ChironTFT chiron; } // Anycubic namespace diff --git a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp index a2ad678ac62e2..0df3bde89d50c 100644 --- a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp +++ b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp @@ -35,20 +35,20 @@ namespace ExtUI { - void onStartup() { AnycubicTFT.OnSetup(); } - void onIdle() { AnycubicTFT.OnCommandScan(); } - void onPrinterKilled(FSTR_P const error, FSTR_P const component) { AnycubicTFT.OnKillTFT(); } - void onMediaInserted() { AnycubicTFT.OnSDCardStateChange(true); } - void onMediaError() { AnycubicTFT.OnSDCardError(); } - void onMediaRemoved() { AnycubicTFT.OnSDCardStateChange(false); } + void onStartup() { anycubicTFT.onSetup(); } + void onIdle() { anycubicTFT.onCommandScan(); } + void onPrinterKilled(FSTR_P const error, FSTR_P const component) { anycubicTFT.onKillTFT(); } + void onMediaInserted() { anycubicTFT.onSDCardStateChange(true); } + void onMediaError() { anycubicTFT.onSDCardError(); } + void onMediaRemoved() { anycubicTFT.onSDCardStateChange(false); } void onPlayTone(const uint16_t frequency, const uint16_t duration) { TERN_(SPEAKER, ::tone(BEEPER_PIN, frequency, duration)); } - void onPrintTimerStarted() { AnycubicTFT.OnPrintTimerStarted(); } - void onPrintTimerPaused() { AnycubicTFT.OnPrintTimerPaused(); } - void onPrintTimerStopped() { AnycubicTFT.OnPrintTimerStopped(); } - void onFilamentRunout(const extruder_t extruder) { AnycubicTFT.OnFilamentRunout(); } - void onUserConfirmRequired(const char * const msg) { AnycubicTFT.OnUserConfirmRequired(msg); } + void onPrintTimerStarted() { anycubicTFT.onPrintTimerStarted(); } + void onPrintTimerPaused() { anycubicTFT.onPrintTimerPaused(); } + void onPrintTimerStopped() { anycubicTFT.onPrintTimerStopped(); } + void onFilamentRunout(const extruder_t extruder) { anycubicTFT.onFilamentRunout(); } + void onUserConfirmRequired(const char * const msg) { anycubicTFT.onUserConfirmRequired(msg); } void onStatusChanged(const char * const msg) {} void onHomingStart() {} 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 36b24861fe3ba..dca0f2e85da47 100644 --- a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp +++ b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp @@ -24,6 +24,8 @@ #if ENABLED(ANYCUBIC_LCD_I3MEGA) //#define ANYCUBIC_LCD_DEBUG +#define DEBUG_OUT ANYCUBIC_LCD_DEBUG +#include "../../../core/debug_out.h" #include "anycubic_i3mega_lcd.h" #include "../ui_api.h" @@ -40,13 +42,8 @@ #define SEND_PGM_VAL(x,y) (send_P(PSTR(x)), sendLine(i16tostr3rj(y))) #define SEND(x) send(x) #define SENDLINE(x) sendLine(x) -#if ENABLED(ANYCUBIC_LCD_DEBUG) - #define SENDLINE_DBG_PGM(x,y) do{ sendLine_P(PSTR(x)); SERIAL_ECHOLNPGM(y); }while(0) - #define SENDLINE_DBG_PGM_VAL(x,y,z) do{ sendLine_P(PSTR(x)); SERIAL_ECHOLNPGM(y, z); }while(0) -#else - #define SENDLINE_DBG_PGM(x,y) sendLine_P(PSTR(x)) - #define SENDLINE_DBG_PGM_VAL(x,y,z) sendLine_P(PSTR(x)) -#endif +#define SENDLINE_DBG_PGM(x,y) do{ sendLine_P(PSTR(x)); DEBUG_ECHOLNPGM(y); }while(0) +#define SENDLINE_DBG_PGM_VAL(x,y,z) do{ sendLine_P(PSTR(x)); DEBUG_ECHOLNPGM(y, z); }while(0) // Append ".gcode" to filename, if requested. Used for some DGUS-clone displays with built-in filter. // Filenames are limited to 26 characters, so the actual name for the FILENAME can be 20 characters at most. @@ -54,21 +51,20 @@ #define SPECIAL_MENU_FILENAME(A) A TERN_(ANYCUBIC_LCD_GCODE_EXT, ".gcode") #define SPECIAL_MENU_ALTNAME(A, B) TERN(ANYCUBIC_LCD_GCODE_EXT, A ".gcode", B) -AnycubicTFTClass AnycubicTFT; +AnycubicTFTClass anycubicTFT; -char AnycubicTFTClass::TFTcmdbuffer[TFTBUFSIZE][TFT_MAX_CMD_SIZE]; -int AnycubicTFTClass::TFTbuflen = 0, - AnycubicTFTClass::TFTbufindr = 0, - AnycubicTFTClass::TFTbufindw = 0; +char AnycubicTFTClass::tftCommands[TFTBUFSIZE][TFT_MAX_CMD_SIZE]; +int AnycubicTFTClass::tftBufLen = 0, + AnycubicTFTClass::tftBufIndR = 0, + AnycubicTFTClass::tftBufIndW = 0; char AnycubicTFTClass::serial3_char; -int AnycubicTFTClass::serial3_count = 0; -char* AnycubicTFTClass::TFTstrchr_pointer; -uint8_t AnycubicTFTClass::SpecialMenu = false; +char* AnycubicTFTClass::tftStrchrPtr; +uint8_t AnycubicTFTClass::specialMenu = false; AnycubicMediaPrintState AnycubicTFTClass::mediaPrintingState = AMPRINTSTATE_NOT_PRINTING; AnycubicMediaPauseState AnycubicTFTClass::mediaPauseState = AMPAUSESTATE_NOT_PAUSED; -char AnycubicTFTClass::SelectedDirectory[30]; -char AnycubicTFTClass::SelectedFile[FILENAME_LENGTH]; +char AnycubicTFTClass::selectedDirectory[30]; +char AnycubicTFTClass::selectedFile[FILENAME_LENGTH]; // Serial helpers static void sendNewLine() { LCD_SERIAL.write('\r'); LCD_SERIAL.write('\n'); } @@ -84,7 +80,7 @@ using namespace ExtUI; AnycubicTFTClass::AnycubicTFTClass() {} -void AnycubicTFTClass::OnSetup() { +void AnycubicTFTClass::onSetup() { #ifndef LCD_BAUDRATE #define LCD_BAUDRATE 115200 #endif @@ -94,9 +90,6 @@ void AnycubicTFTClass::OnSetup() { delay_ms(10); // Init the state of the key pins running on the TFT - #if BOTH(HAS_MEDIA, HAS_SD_DETECT) - SET_INPUT_PULLUP(SD_DETECT_PIN); - #endif #if ENABLED(FILAMENT_RUNOUT_SENSOR) SET_INPUT_PULLUP(FIL_RUNOUT1_PIN); #endif @@ -104,30 +97,26 @@ void AnycubicTFTClass::OnSetup() { mediaPrintingState = AMPRINTSTATE_NOT_PRINTING; mediaPauseState = AMPAUSESTATE_NOT_PAUSED; - // DoSDCardStateCheck(); + // doSDCardStateCheck(); SENDLINE_DBG_PGM("J12", "TFT Serial Debug: Ready... J12"); // J12 Ready delay_ms(10); - DoFilamentRunoutCheck(); - SelectedFile[0] = 0; + doFilamentRunoutCheck(); + selectedFile[0] = 0; #if ENABLED(STARTUP_CHIME) injectCommands(F("M300 P250 S554\nM300 P250 S554\nM300 P250 S740\nM300 P250 S554\nM300 P250 S740\nM300 P250 S554\nM300 P500 S831")); #endif - #if ENABLED(ANYCUBIC_LCD_DEBUG) - SERIAL_ECHOLNPGM("TFT Serial Debug: Finished startup"); - #endif + DEBUG_ECHOLNPGM("TFT Serial Debug: Finished startup"); } -void AnycubicTFTClass::OnCommandScan() { +void AnycubicTFTClass::onCommandScan() { static millis_t nextStopCheck = 0; // used to slow the stopped print check down to reasonable times const millis_t ms = millis(); if (ELAPSED(ms, nextStopCheck)) { nextStopCheck = ms + 1000UL; - if (mediaPrintingState == AMPRINTSTATE_STOP_REQUESTED && IsNozzleHomed()) { - #if ENABLED(ANYCUBIC_LCD_DEBUG) - SERIAL_ECHOLNPGM("TFT Serial Debug: Finished stopping print, releasing motors ..."); - #endif + if (mediaPrintingState == AMPRINTSTATE_STOP_REQUESTED && isNozzleHomed()) { + DEBUG_ECHOLNPGM("TFT Serial Debug: Finished stopping print, releasing motors ..."); mediaPrintingState = AMPRINTSTATE_NOT_PRINTING; mediaPauseState = AMPAUSESTATE_NOT_PAUSED; injectCommands(F("M84\nM27")); // disable stepper motors and force report of SD status @@ -137,44 +126,36 @@ void AnycubicTFTClass::OnCommandScan() { } } - if (TFTbuflen < (TFTBUFSIZE - 1)) - GetCommandFromTFT(); + if (tftBufLen < (TFTBUFSIZE) - 1) + getCommandFromTFT(); - if (TFTbuflen) { - TFTbuflen = (TFTbuflen - 1); - TFTbufindr = (TFTbufindr + 1) % TFTBUFSIZE; + if (tftBufLen) { + --tftBufLen; + tftBufIndR = (tftBufIndR + 1) % (TFTBUFSIZE); } } -void AnycubicTFTClass::OnKillTFT() { +void AnycubicTFTClass::onKillTFT() { SENDLINE_DBG_PGM("J11", "TFT Serial Debug: Kill command... J11"); } -void AnycubicTFTClass::OnSDCardStateChange(bool isInserted) { - #if ENABLED(ANYCUBIC_LCD_DEBUG) - SERIAL_ECHOLNPGM("TFT Serial Debug: OnSDCardStateChange event triggered...", isInserted); - #endif - DoSDCardStateCheck(); +void AnycubicTFTClass::onSDCardStateChange(bool isInserted) { + DEBUG_ECHOLNPGM("TFT Serial Debug: onSDCardStateChange event triggered...", isInserted); + doSDCardStateCheck(); } -void AnycubicTFTClass::OnSDCardError() { - #if ENABLED(ANYCUBIC_LCD_DEBUG) - SERIAL_ECHOLNPGM("TFT Serial Debug: OnSDCardError event triggered..."); - #endif +void AnycubicTFTClass::onSDCardError() { + DEBUG_ECHOLNPGM("TFT Serial Debug: onSDCardError event triggered..."); SENDLINE_DBG_PGM("J21", "TFT Serial Debug: On SD Card Error ... J21"); } -void AnycubicTFTClass::OnFilamentRunout() { - #if ENABLED(ANYCUBIC_LCD_DEBUG) - SERIAL_ECHOLNPGM("TFT Serial Debug: FilamentRunout triggered..."); - #endif - DoFilamentRunoutCheck(); +void AnycubicTFTClass::onFilamentRunout() { + DEBUG_ECHOLNPGM("TFT Serial Debug: onFilamentRunout triggered..."); + doFilamentRunoutCheck(); } -void AnycubicTFTClass::OnUserConfirmRequired(const char * const msg) { - #if ENABLED(ANYCUBIC_LCD_DEBUG) - SERIAL_ECHOLNPGM("TFT Serial Debug: OnUserConfirmRequired triggered... ", msg); - #endif +void AnycubicTFTClass::onUserConfirmRequired(const char * const msg) { + DEBUG_ECHOLNPGM("TFT Serial Debug: onUserConfirmRequired triggered... ", msg); #if HAS_MEDIA /** @@ -225,190 +206,188 @@ void AnycubicTFTClass::OnUserConfirmRequired(const char * const msg) { #endif } -float AnycubicTFTClass::CodeValue() { - return (strtod(&TFTcmdbuffer[TFTbufindr][TFTstrchr_pointer - TFTcmdbuffer[TFTbufindr] + 1], nullptr)); +float AnycubicTFTClass::codeValue() { + return (strtod(&tftCommands[tftBufIndR][tftStrchrPtr - tftCommands[tftBufIndR] + 1], nullptr)); } -bool AnycubicTFTClass::CodeSeen(char code) { - TFTstrchr_pointer = strchr(TFTcmdbuffer[TFTbufindr], code); - return !!TFTstrchr_pointer; // Return True if a character was found +bool AnycubicTFTClass::codeSeen(char code) { + tftStrchrPtr = strchr(tftCommands[tftBufIndR], code); + return !!tftStrchrPtr; // Return True if a character was found } -bool AnycubicTFTClass::IsNozzleHomed() { +bool AnycubicTFTClass::isNozzleHomed() { const float xPosition = getAxisPosition_mm((axis_t) X); const float yPosition = getAxisPosition_mm((axis_t) Y); return WITHIN(xPosition, X_MIN_POS - 0.1, X_MIN_POS + 0.1) && WITHIN(yPosition, Y_MIN_POS - 0.1, Y_MIN_POS + 0.1); } -void AnycubicTFTClass::HandleSpecialMenu() { +void AnycubicTFTClass::handleSpecialMenu() { /** * NOTE: that the file selection command actual lowercases the entire selected file/foldername, so charracter comparisons need to be lowercase. */ - if (SelectedDirectory[0] == '<') { - switch (SelectedDirectory[1]) { - case 'e': // "" - SpecialMenu = false; - return; + if (selectedDirectory[0] != '<') { + DEBUG_ECHOLNPGM("TFT Serial Debug: Attempted to handleSpecialMenu on non-special menu... ", selectedDirectory); + return; + } + + switch (selectedDirectory[1]) { + default: break; + + case 'e': specialMenu = false; return; // "" + + #if ENABLED(PROBE_MANUALLY) + + case '0': + switch (selectedDirectory[2]) { + default: break; + + case '1': // "<01ZUp0.1>" + SERIAL_ECHOLNPGM("Special Menu: ", F("Z Up 0.1")); + injectCommands(F("G91\nG1 Z+0.1\nG90")); + break; + + case '2': // "<02ZUp0.02>" + SERIAL_ECHOLNPGM("Special Menu: ", F("Z Up 0.02")); + injectCommands(F("G91\nG1 Z+0.02\nG90")); + break; + + case '3': // "<03ZDn0.02>" + SERIAL_ECHOLNPGM("Special Menu: ", F("Z Down 0.02")); + injectCommands(F("G91\nG1 Z-0.02\nG90")); + break; + + case '4': // "<04ZDn0.1>" + SERIAL_ECHOLNPGM("Special Menu: ", F("Z Down 0.1")); + injectCommands(F("G91\nG1 Z-0.1\nG90")); + break; + + case '5': // "<05PrehtBed>" + SERIAL_ECHOLNPGM("Special Menu: ", F("Preheat Bed")); + injectCommands(F("M140 S65")); + break; + + case '6': // "<06SMeshLvl>" + SERIAL_ECHOLNPGM("Special Menu: ", F("Start Mesh Leveling")); + injectCommands(F("G29S1")); + break; + + case '7': // "<07MeshNPnt>" + SERIAL_ECHOLNPGM("Special Menu: ", F("Next Mesh Point")); + injectCommands(F("G29S2")); + break; + + case '8': // "<08HtEndPID>" + SERIAL_ECHOLNPGM("Special Menu: ", F("Auto Tune Hotend PID")); + // need to dwell for half a second to give the fan a chance to start before the pid tuning starts + injectCommands(F("M106 S204\nG4 P500\nM303 E0 S215 C15 U1")); + break; + + case '9': // "<09HtBedPID>" + SERIAL_ECHOLNPGM("Special Menu: ", F("Auto Tune Hotbed Pid")); + injectCommands(F("M303 E-1 S65 C6 U1")); + break; + } break; - #if ENABLED(PROBE_MANUALLY) - case '0': - switch (SelectedDirectory[2]) { - case '1': // "<01ZUp0.1>" - SERIAL_ECHOLNPGM("Special Menu: Z Up 0.1"); - injectCommands(F("G91\nG1 Z+0.1\nG90")); - break; - - case '2': // "<02ZUp0.02>" - SERIAL_ECHOLNPGM("Special Menu: Z Up 0.02"); - injectCommands(F("G91\nG1 Z+0.02\nG90")); - break; - - case '3': // "<03ZDn0.02>" - SERIAL_ECHOLNPGM("Special Menu: Z Down 0.02"); - injectCommands(F("G91\nG1 Z-0.02\nG90")); - break; - - case '4': // "<04ZDn0.1>" - SERIAL_ECHOLNPGM("Special Menu: Z Down 0.1"); - injectCommands(F("G91\nG1 Z-0.1\nG90")); - break; - - case '5': // "<05PrehtBed>" - SERIAL_ECHOLNPGM("Special Menu: Preheat Bed"); - injectCommands(F("M140 S65")); - break; - - case '6': // "<06SMeshLvl>" - SERIAL_ECHOLNPGM("Special Menu: Start Mesh Leveling"); - injectCommands(F("G29S1")); - break; - - case '7': // "<07MeshNPnt>" - SERIAL_ECHOLNPGM("Special Menu: Next Mesh Point"); - injectCommands(F("G29S2")); - break; - - case '8': // "<08HtEndPID>" - SERIAL_ECHOLNPGM("Special Menu: Auto Tune Hotend PID"); - // need to dwell for half a second to give the fan a chance to start before the pid tuning starts - injectCommands(F("M106 S204\nG4 P500\nM303 E0 S215 C15 U1")); - break; - - case '9': // "<09HtBedPID>" - SERIAL_ECHOLNPGM("Special Menu: Auto Tune Hotbed Pid"); - injectCommands(F("M303 E-1 S65 C6 U1")); - break; - - default: - break; - } + case '1': + switch (selectedDirectory[2]) { + default: break; + + case '0': // "<10FWDeflts>" + SERIAL_ECHOLNPGM("Special Menu: ", F("Load FW Defaults")); + injectCommands(F("M502\nM300 P105 S1661\nM300 P210 S1108")); + break; + + case '1': // "<11SvEEPROM>" + SERIAL_ECHOLNPGM("Special Menu: ", F("Save EEPROM")); + injectCommands(F("M500\nM300 P105 S1108\nM300 P210 S1661")); break; + } + break; - case '1': - switch (SelectedDirectory[2]) { - case '0': // "<10FWDeflts>" - SERIAL_ECHOLNPGM("Special Menu: Load FW Defaults"); - injectCommands(F("M502\nM300 P105 S1661\nM300 P210 S1108")); - break; + #else // !PROBE_MANUALLY - case '1': // "<11SvEEPROM>" - SERIAL_ECHOLNPGM("Special Menu: Save EEPROM"); - injectCommands(F("M500\nM300 P105 S1108\nM300 P210 S1661")); - break; + case '0': + switch (selectedDirectory[2]) { + default: break; - default: - break; - } + case '1': // "<01PrehtBed>" + SERIAL_ECHOLNPGM("Special Menu: ", F("Preheat Bed")); + injectCommands(F("M140 S65")); break; - #else // if ENABLED(PROBE_MANUALLY) - case '0': - switch (SelectedDirectory[2]) { - case '1': // "<01PrehtBed>" - SERIAL_ECHOLNPGM("Special Menu: Preheat Bed"); - injectCommands(F("M140 S65")); - break; - - case '2': // "<02ABL>" - SERIAL_ECHOLNPGM("Special Menu: Auto Bed Leveling"); - injectCommands(F("G29N")); - break; - - case '3': // "<03HtendPID>" - SERIAL_ECHOLNPGM("Special Menu: Auto Tune Hotend PID"); - // need to dwell for half a second to give the fan a chance to start before the pid tuning starts - injectCommands(F("M106 S204\nG4 P500\nM303 E0 S215 C15 U1")); - break; - - case '4': // "<04HtbedPID>" - SERIAL_ECHOLNPGM("Special Menu: Auto Tune Hotbed Pid"); - injectCommands(F("M303 E-1 S65 C6 U1")); - break; - - case '5': // "<05FWDeflts>" - SERIAL_ECHOLNPGM("Special Menu: Load FW Defaults"); - injectCommands(F("M502\nM300 P105 S1661\nM300 P210 S1108")); - break; - - case '6': // "<06SvEEPROM>" - SERIAL_ECHOLNPGM("Special Menu: Save EEPROM"); - injectCommands(F("M500\nM300 P105 S1108\nM300 P210 S1661")); - break; - - case '7': // <07SendM108> - SERIAL_ECHOLNPGM("Special Menu: Send User Confirmation"); - injectCommands(F("M108")); - break; - - default: - break; - } + + case '2': // "<02ABL>" + SERIAL_ECHOLNPGM("Special Menu: ", F("Auto Bed Leveling")); + injectCommands(F("G29N")); break; - #endif // PROBE_MANUALLY - default: + case '3': // "<03HtendPID>" + SERIAL_ECHOLNPGM("Special Menu: ", F("Auto Tune Hotend PID")); + // need to dwell for half a second to give the fan a chance to start before the pid tuning starts + injectCommands(F("M106 S204\nG4 P500\nM303 E0 S215 C15 U1")); break; - } - #if ENABLED(ANYCUBIC_LCD_DEBUG) - } - else { - SERIAL_ECHOPGM("TFT Serial Debug: Attempted to HandleSpecialMenu on non-special menu... "); - SERIAL_ECHOLN(SelectedDirectory); - #endif + + case '4': // "<04HtbedPID>" + SERIAL_ECHOLNPGM("Special Menu: ", F("Auto Tune Hotbed Pid")); + injectCommands(F("M303 E-1 S65 C6 U1")); + break; + + case '5': // "<05FWDeflts>" + SERIAL_ECHOLNPGM("Special Menu: ", F("Load FW Defaults")); + injectCommands(F("M502\nM300 P105 S1661\nM300 P210 S1108")); + break; + + case '6': // "<06SvEEPROM>" + SERIAL_ECHOLNPGM("Special Menu: ", F("Save EEPROM")); + injectCommands(F("M500\nM300 P105 S1108\nM300 P210 S1661")); + break; + + case '7': // <07SendM108> + SERIAL_ECHOLNPGM("Special Menu: ", F("Send User Confirmation")); + injectCommands(F("M108")); + break; + } + break; + + #endif // !PROBE_MANUALLY } + } -void AnycubicTFTClass::RenderCurrentFileList() { +void AnycubicTFTClass::renderCurrentFileList() { #if HAS_MEDIA uint16_t selectedNumber = 0; - SelectedDirectory[0] = 0; - SelectedFile[0] = 0; + selectedDirectory[0] = 0; + selectedFile[0] = 0; FileList currentFileList; SENDLINE_PGM("FN "); // Filelist start - if (!isMediaInserted() && !SpecialMenu) { + if (!isMediaInserted() && !specialMenu) { SENDLINE_DBG_PGM("J02", "TFT Serial Debug: No SD Card mounted to render Current File List... J02"); SENDLINE_PGM("")); } else { - if (CodeSeen('S')) - selectedNumber = CodeValue(); + if (codeSeen('S')) + selectedNumber = codeValue(); - if (SpecialMenu) - RenderSpecialMenu(selectedNumber); + if (specialMenu) + renderSpecialMenu(selectedNumber); else if (selectedNumber <= currentFileList.count()) - RenderCurrentFolder(selectedNumber); + renderCurrentFolder(selectedNumber); } SENDLINE_PGM("END"); // Filelist stop #endif // HAS_MEDIA } -void AnycubicTFTClass::RenderSpecialMenu(uint16_t selectedNumber) { +void AnycubicTFTClass::renderSpecialMenu(uint16_t selectedNumber) { + switch (selectedNumber) { + default: break; + #if ENABLED(PROBE_MANUALLY) case 0: // First Page SENDLINE_PGM("<01ZUP~1.GCO"); @@ -442,7 +421,9 @@ void AnycubicTFTClass::RenderSpecialMenu(uint16_t selectedNumber) { SENDLINE_PGM("")); break; - #else + + #else // !PROBE_MANUALLY + case 0: // First Page SENDLINE_PGM("<01PRE~1.GCO"); SENDLINE_PGM(SPECIAL_MENU_FILENAME("")); @@ -465,25 +446,16 @@ void AnycubicTFTClass::RenderSpecialMenu(uint16_t selectedNumber) { SENDLINE_PGM(SPECIAL_MENU_FILENAME("")); break; - #endif // PROBE_MANUALLY - - default: - break; + #endif // !PROBE_MANUALLY } } -void AnycubicTFTClass::RenderCurrentFolder(uint16_t selectedNumber) { +void AnycubicTFTClass::renderCurrentFolder(uint16_t selectedNumber) { FileList currentFileList; - uint16_t cnt = selectedNumber; - uint16_t max_files; - uint16_t dir_files = currentFileList.count(); - - if ((dir_files - selectedNumber) < 4) - max_files = dir_files; - else - max_files = selectedNumber + 3; + const uint16_t dir_files = currentFileList.count(), + max_files = (dir_files - selectedNumber) < 4 ? dir_files : selectedNumber + 3; - for (cnt = selectedNumber; cnt <= max_files; cnt++) { + for (uint16_t cnt = selectedNumber; cnt <= max_files; cnt++) { if (cnt == 0) { // Special Entry if (currentFileList.isAtRootDir()) { SENDLINE_PGM(" 0 && TFTbuflen < TFTBUFSIZE) { - serial3_char = LCD_SERIAL.read(); - if (serial3_char == '\n' || - serial3_char == '\r' || - serial3_char == ':' || - serial3_count >= (TFT_MAX_CMD_SIZE - 1) - ) { - - if (!serial3_count) return; // if empty line - - TFTcmdbuffer[TFTbufindw][serial3_count] = 0; // terminate string - - if ((strchr(TFTcmdbuffer[TFTbufindw], 'A') != nullptr)) { - int16_t a_command; - TFTstrchr_pointer = strchr(TFTcmdbuffer[TFTbufindw], 'A'); - a_command = ((int)((strtod(&TFTcmdbuffer[TFTbufindw][TFTstrchr_pointer - TFTcmdbuffer[TFTbufindw] + 1], nullptr)))); - - #if ENABLED(ANYCUBIC_LCD_DEBUG) - if ((a_command > 7) && (a_command != 20)) // No debugging of status polls, please! - SERIAL_ECHOLNPGM("TFT Serial Command: ", TFTcmdbuffer[TFTbufindw]); - #endif - - switch (a_command) { - case 0: { // A0 GET HOTEND TEMP - const celsius_float_t hotendActualTemp = getActualTemp_celsius(E0); - SEND_PGM_VAL("A0V ", ROUND(hotendActualTemp)); - } - break; + while (LCD_SERIAL.available() > 0 && tftBufLen < (TFTBUFSIZE)) { + char c = LCD_SERIAL.read(); + if (c != '\n' && c != '\r' && c != ':' && serial_count < (TFT_MAX_CMD_SIZE - 1)) { + tftCommands[tftBufIndW][serial_count++] = c; + continue; + } - case 1: { // A1 GET HOTEND TARGET TEMP - const celsius_float_t hotendTargetTemp = getTargetTemp_celsius(E0); - SEND_PGM_VAL("A1V ", ROUND(hotendTargetTemp)); - } - break; + if (!serial_count) return; // if empty line - case 2: { // A2 GET HOTBED TEMP - const celsius_float_t heatedBedActualTemp = getActualTemp_celsius(BED); - SEND_PGM_VAL("A2V ", ROUND(heatedBedActualTemp)); - } - break; + tftCommands[tftBufIndW][serial_count] = 0; // terminate string - case 3: { // A3 GET HOTBED TARGET TEMP - const celsius_float_t heatedBedTargetTemp = getTargetTemp_celsius(BED); - SEND_PGM_VAL("A3V ", ROUND(heatedBedTargetTemp)); - } break; - - case 4: { // A4 GET FAN SPEED - SEND_PGM_VAL("A4V ", int(getActualFan_percent(FAN0))); - } break; - - case 5: { // A5 GET CURRENT COORDINATE - const float xPosition = getAxisPosition_mm(X), - yPosition = getAxisPosition_mm(Y), - zPosition = getAxisPosition_mm(Z); - SEND_PGM("A5V X: "); LCD_SERIAL.print(xPosition); - SEND_PGM( " Y: "); LCD_SERIAL.print(yPosition); - SEND_PGM( " Z: "); LCD_SERIAL.print(zPosition); - SENDLINE_PGM(""); - } break; - - case 6: // A6 GET SD CARD PRINTING STATUS - #if HAS_MEDIA - if (isPrintingFromMedia()) { - SEND_PGM("A6V "); - if (isMediaInserted()) - SENDLINE(ui8tostr3rj(getProgress_percent())); - else - SENDLINE_DBG_PGM("J02", "TFT Serial Debug: No SD Card mounted to return printing status... J02"); - } - else - SENDLINE_PGM("A6V ---"); - #endif - break; + if ((strchr(tftCommands[tftBufIndW], 'A') != nullptr)) { + int16_t a_command; + tftStrchrPtr = strchr(tftCommands[tftBufIndW], 'A'); + a_command = ((int)((strtod(&tftCommands[tftBufIndW][tftStrchrPtr - tftCommands[tftBufIndW] + 1], nullptr)))); + + if (a_command > 7 && a_command != 20) { // No debugging of status polls, please! + DEBUG_ECHOLNPGM("TFT Serial Command: ", tftCommands[tftBufIndW]); + } + + switch (a_command) { + case 0: { // A0 GET HOTEND TEMP + const celsius_float_t hotendActualTemp = getActualTemp_celsius(E0); + SEND_PGM_VAL("A0V ", ROUND(hotendActualTemp)); + } + break; + + case 1: { // A1 GET HOTEND TARGET TEMP + const celsius_float_t hotendTargetTemp = getTargetTemp_celsius(E0); + SEND_PGM_VAL("A1V ", ROUND(hotendTargetTemp)); + } + break; + + case 2: { // A2 GET HOTBED TEMP + const celsius_float_t heatedBedActualTemp = getActualTemp_celsius(BED); + SEND_PGM_VAL("A2V ", ROUND(heatedBedActualTemp)); + } + break; - case 7: { // A7 GET PRINTING TIME - const uint32_t elapsedSeconds = getProgress_seconds_elapsed(); - SEND_PGM("A7V "); - if (elapsedSeconds != 0) { // print time - const uint32_t elapsedMinutes = elapsedSeconds / 60; - SEND(ui8tostr2(elapsedMinutes / 60)); - SEND_PGM(" H "); - SEND(ui8tostr2(elapsedMinutes % 60)); - SENDLINE_PGM(" M"); + case 3: { // A3 GET HOTBED TARGET TEMP + const celsius_float_t heatedBedTargetTemp = getTargetTemp_celsius(BED); + SEND_PGM_VAL("A3V ", ROUND(heatedBedTargetTemp)); + } break; + + case 4: { // A4 GET FAN SPEED + SEND_PGM_VAL("A4V ", int(getActualFan_percent(FAN0))); + } break; + + case 5: { // A5 GET CURRENT COORDINATE + const float xPosition = getAxisPosition_mm(X), + yPosition = getAxisPosition_mm(Y), + zPosition = getAxisPosition_mm(Z); + SEND_PGM("A5V X: "); LCD_SERIAL.print(xPosition); + SEND_PGM( " Y: "); LCD_SERIAL.print(yPosition); + SEND_PGM( " Z: "); LCD_SERIAL.print(zPosition); + SENDLINE_PGM(""); + } break; + + case 6: // A6 GET SD CARD PRINTING STATUS + #if HAS_MEDIA + if (isPrintingFromMedia()) { + SEND_PGM("A6V "); + if (isMediaInserted()) + SENDLINE(ui8tostr3rj(getProgress_percent())); + else + SENDLINE_DBG_PGM("J02", "TFT Serial Debug: No SD Card mounted to return printing status... J02"); } else - SENDLINE_PGM(" 999:999"); - } + SENDLINE_PGM("A6V ---"); + #endif break; - case 8: // A8 GET SD LIST - #if HAS_MEDIA - SelectedFile[0] = 0; - RenderCurrentFileList(); - #endif - break; - - case 9: // A9 pause sd print - #if HAS_MEDIA - if (isPrintingFromMedia()) - PausePrint(); - #endif - break; + case 7: { // A7 GET PRINTING TIME + const uint32_t elapsedSeconds = getProgress_seconds_elapsed(); + SEND_PGM("A7V "); + if (elapsedSeconds != 0) { // print time + const uint32_t elapsedMinutes = elapsedSeconds / 60; + SEND(ui8tostr2(elapsedMinutes / 60)); + SEND_PGM(" H "); + SEND(ui8tostr2(elapsedMinutes % 60)); + SENDLINE_PGM(" M"); + } + else + SENDLINE_PGM(" 999:999"); + } + break; - case 10: // A10 resume sd print - #if HAS_MEDIA - if (isPrintingFromMediaPaused()) - ResumePrint(); - #endif - break; + case 8: // A8 GET SD LIST + #if HAS_MEDIA + selectedFile[0] = 0; + renderCurrentFileList(); + #endif + break; - case 11: // A11 STOP SD PRINT - TERN_(HAS_MEDIA, StopPrint()); - break; + case 9: // A9 pause sd print + TERN_(HAS_MEDIA, if (isPrintingFromMedia()) pausePrint()); + break; - case 12: // A12 kill - kill(F(STR_ERR_KILLED)); - break; + case 10: // A10 resume sd print + #if HAS_MEDIA + if (isPrintingFromMediaPaused()) + resumePrint(); + #endif + break; - case 13: // A13 SELECTION FILE - #if HAS_MEDIA - if (isMediaInserted()) { - starpos = (strchr(TFTstrchr_pointer + 4, '*')); - if (TFTstrchr_pointer[4] == '/') { - strcpy(SelectedDirectory, TFTstrchr_pointer + 5); - SelectedFile[0] = 0; - SENDLINE_DBG_PGM("J21", "TFT Serial Debug: Clear file selection... J21 "); // J21 Not File Selected - SENDLINE_PGM(""); - } - else if (TFTstrchr_pointer[4] == '<') { - strcpy(SelectedDirectory, TFTstrchr_pointer + 4); - SpecialMenu = true; - SelectedFile[0] = 0; - SENDLINE_DBG_PGM("J21", "TFT Serial Debug: Clear file selection... J21 "); // J21 Not File Selected - SENDLINE_PGM(""); - } - else { - SelectedDirectory[0] = 0; + case 11: // A11 STOP SD PRINT + TERN_(HAS_MEDIA, stopPrint()); + break; - if (starpos) *(starpos - 1) = '\0'; + case 12: // A12 kill + kill(F(STR_ERR_KILLED)); + break; - strcpy(SelectedFile, TFTstrchr_pointer + 4); - SENDLINE_DBG_PGM_VAL("J20", "TFT Serial Debug: File Selected... J20 ", SelectedFile); // J20 File Selected - } + case 13: // A13 SELECTION FILE + #if HAS_MEDIA + if (isMediaInserted()) { + starpos = (strchr(tftStrchrPtr + 4, '*')); + if (tftStrchrPtr[4] == '/') { + strcpy(selectedDirectory, tftStrchrPtr + 5); + selectedFile[0] = 0; + SENDLINE_DBG_PGM("J21", "TFT Serial Debug: Clear file selection... J21 "); // J21 Not File Selected + SENDLINE_PGM(""); } - #endif - break; - - case 14: // A14 START PRINTING - #if HAS_MEDIA - if (!isPrinting() && strlen(SelectedFile) > 0) - StartPrint(); - #endif - break; + else if (tftStrchrPtr[4] == '<') { + strcpy(selectedDirectory, tftStrchrPtr + 4); + specialMenu = true; + selectedFile[0] = 0; + SENDLINE_DBG_PGM("J21", "TFT Serial Debug: Clear file selection... J21 "); // J21 Not File Selected + SENDLINE_PGM(""); + } + else { + selectedDirectory[0] = 0; - case 15: // A15 RESUMING FROM OUTAGE - // TODO: JBA implement resume form outage - break; + if (starpos) *(starpos - 1) = '\0'; - case 16: { // A16 set hotend temp - uint16_t tempvalue; - if (CodeSeen('S')) { - tempvalue = constrain(CodeValue(), 0, 275); - setTargetTemp_celsius(tempvalue, (extruder_t)E0); - } - else if (CodeSeen('C') && !isPrinting()) { - if (getAxisPosition_mm(Z) < 10) - injectCommands(F("G1 Z10")); // RASE Z AXIS - tempvalue = constrain(CodeValue(), 0, 275); - setTargetTemp_celsius(tempvalue, (extruder_t)E0); + strcpy(selectedFile, tftStrchrPtr + 4); + SENDLINE_DBG_PGM_VAL("J20", "TFT Serial Debug: File Selected... J20 ", selectedFile); // J20 File Selected + } } - } + #endif break; - case 17: { // A17 set heated bed temp - uint16_t tempbed; - if (CodeSeen('S')) { - tempbed = constrain(CodeValue(), 0, 100); - setTargetTemp_celsius(tempbed, (heater_t)BED); - } - } + case 14: // A14 START PRINTING + #if HAS_MEDIA + if (!isPrinting() && strlen(selectedFile) > 0) + startPrint(); + #endif break; - case 18: { // A18 set fan speed - float fanPercent; - if (CodeSeen('S')) { - fanPercent = CodeValue(); - fanPercent = constrain(fanPercent, 0, 100); - setTargetFan_percent(fanPercent, FAN0); - } - else - fanPercent = 100; + case 15: // A15 RESUMING FROM OUTAGE + // TODO: JBA implement resume form outage + break; + case 16: { // A16 set hotend temp + uint16_t tempvalue; + if (codeSeen('S')) { + tempvalue = constrain(codeValue(), 0, 275); + setTargetTemp_celsius(tempvalue, (extruder_t)E0); + } + else if (codeSeen('C') && !isPrinting()) { + if (getAxisPosition_mm(Z) < 10) + injectCommands(F("G1 Z10")); // RASE Z AXIS + tempvalue = constrain(codeValue(), 0, 275); + setTargetTemp_celsius(tempvalue, (extruder_t)E0); + } + } + break; + + case 17: { // A17 set heated bed temp + uint16_t tempbed; + if (codeSeen('S')) { + tempbed = constrain(codeValue(), 0, 100); + setTargetTemp_celsius(tempbed, (heater_t)BED); + } + } + break; + + case 18: { // A18 set fan speed + float fanPercent; + if (codeSeen('S')) { + fanPercent = codeValue(); + fanPercent = constrain(fanPercent, 0, 100); setTargetFan_percent(fanPercent, FAN0); - SENDLINE_PGM(""); } - break; + else + fanPercent = 100; - case 19: // A19 stop stepper drivers - sent on stop extrude command and on turn motors off command - if (!isPrinting()) { - quickstop_stepper(); - stepper.disable_all_steppers(); - } + setTargetFan_percent(fanPercent, FAN0); + SENDLINE_PGM(""); + } + break; - SENDLINE_PGM(""); - break; + case 19: // A19 stop stepper drivers - sent on stop extrude command and on turn motors off command + if (!isPrinting()) { + quickstop_stepper(); + stepper.disable_all_steppers(); + } - case 20: // A20 read printing speed - if (CodeSeen('S')) - feedrate_percentage = constrain(CodeValue(), 40, 999); - else - SEND_PGM_VAL("A20V ", feedrate_percentage); - break; + SENDLINE_PGM(""); + break; - case 21: // A21 all home - if (!isPrinting() && !isPrintingFromMediaPaused()) { - if (CodeSeen('X') || CodeSeen('Y') || CodeSeen('Z')) { - if (CodeSeen('X')) - injectCommands(F("G28X")); - if (CodeSeen('Y')) - injectCommands(F("G28Y")); - if (CodeSeen('Z')) - injectCommands(F("G28Z")); - } - else if (CodeSeen('C')) { - injectCommands_P(G28_STR); - } + case 20: // A20 read printing speed + if (codeSeen('S')) + feedrate_percentage = constrain(codeValue(), 40, 999); + else + SEND_PGM_VAL("A20V ", feedrate_percentage); + break; + + case 21: // A21 all home + if (!isPrinting() && !isPrintingFromMediaPaused()) { + if (codeSeen('X') || codeSeen('Y') || codeSeen('Z')) { + if (codeSeen('X')) + injectCommands(F("G28X")); + if (codeSeen('Y')) + injectCommands(F("G28Y")); + if (codeSeen('Z')) + injectCommands(F("G28Z")); } - break; + else if (codeSeen('C')) { + injectCommands_P(G28_STR); + } + } + break; - case 22: // A22 move X/Y/Z or extrude - if (!isPrinting()) { - float coorvalue; - uint16_t movespeed = 0; - char commandStr[30]; - char fullCommandStr[38]; - - commandStr[0] = 0; // empty string - if (CodeSeen('F')) // Set feedrate - movespeed = CodeValue(); - - if (CodeSeen('X')) { // Move in X direction - coorvalue = CodeValue(); - if ((coorvalue <= 0.2) && coorvalue > 0) - sprintf_P(commandStr, PSTR("G1 X0.1F%i"), movespeed); - else if ((coorvalue <= -0.1) && coorvalue > -1) - sprintf_P(commandStr, PSTR("G1 X-0.1F%i"), movespeed); - else - sprintf_P(commandStr, PSTR("G1 X%iF%i"), int(coorvalue), movespeed); - } - else if (CodeSeen('Y')) { // Move in Y direction - coorvalue = CodeValue(); - if ((coorvalue <= 0.2) && coorvalue > 0) - sprintf_P(commandStr, PSTR("G1 Y0.1F%i"), movespeed); - else if ((coorvalue <= -0.1) && coorvalue > -1) - sprintf_P(commandStr, PSTR("G1 Y-0.1F%i"), movespeed); - else - sprintf_P(commandStr, PSTR("G1 Y%iF%i"), int(coorvalue), movespeed); - } - else if (CodeSeen('Z')) { // Move in Z direction - coorvalue = CodeValue(); - if ((coorvalue <= 0.2) && coorvalue > 0) - sprintf_P(commandStr, PSTR("G1 Z0.1F%i"), movespeed); - else if ((coorvalue <= -0.1) && coorvalue > -1) - sprintf_P(commandStr, PSTR("G1 Z-0.1F%i"), movespeed); - else - sprintf_P(commandStr, PSTR("G1 Z%iF%i"), int(coorvalue), movespeed); - } - else if (CodeSeen('E')) { // Extrude - coorvalue = CodeValue(); - if ((coorvalue <= 0.2) && coorvalue > 0) - sprintf_P(commandStr, PSTR("G1 E0.1F%i"), movespeed); - else if ((coorvalue <= -0.1) && coorvalue > -1) - sprintf_P(commandStr, PSTR("G1 E-0.1F%i"), movespeed); - else - sprintf_P(commandStr, PSTR("G1 E%iF500"), int(coorvalue)); - } + case 22: // A22 move X/Y/Z or extrude + if (!isPrinting()) { + float coorvalue; + uint16_t movespeed = 0; + char commandStr[30]; + char fullCommandStr[38]; + + commandStr[0] = 0; // empty string + if (codeSeen('F')) // Set feedrate + movespeed = codeValue(); + + if (codeSeen('X')) { // Move in X direction + coorvalue = codeValue(); + if ((coorvalue <= 0.2) && coorvalue > 0) + sprintf_P(commandStr, PSTR("G1 X0.1F%i"), movespeed); + else if ((coorvalue <= -0.1) && coorvalue > -1) + sprintf_P(commandStr, PSTR("G1 X-0.1F%i"), movespeed); + else + sprintf_P(commandStr, PSTR("G1 X%iF%i"), int(coorvalue), movespeed); + } + else if (codeSeen('Y')) { // Move in Y direction + coorvalue = codeValue(); + if ((coorvalue <= 0.2) && coorvalue > 0) + sprintf_P(commandStr, PSTR("G1 Y0.1F%i"), movespeed); + else if ((coorvalue <= -0.1) && coorvalue > -1) + sprintf_P(commandStr, PSTR("G1 Y-0.1F%i"), movespeed); + else + sprintf_P(commandStr, PSTR("G1 Y%iF%i"), int(coorvalue), movespeed); + } + else if (codeSeen('Z')) { // Move in Z direction + coorvalue = codeValue(); + if ((coorvalue <= 0.2) && coorvalue > 0) + sprintf_P(commandStr, PSTR("G1 Z0.1F%i"), movespeed); + else if ((coorvalue <= -0.1) && coorvalue > -1) + sprintf_P(commandStr, PSTR("G1 Z-0.1F%i"), movespeed); + else + sprintf_P(commandStr, PSTR("G1 Z%iF%i"), int(coorvalue), movespeed); + } + else if (codeSeen('E')) { // Extrude + coorvalue = codeValue(); + if ((coorvalue <= 0.2) && coorvalue > 0) + sprintf_P(commandStr, PSTR("G1 E0.1F%i"), movespeed); + else if ((coorvalue <= -0.1) && coorvalue > -1) + sprintf_P(commandStr, PSTR("G1 E-0.1F%i"), movespeed); + else + sprintf_P(commandStr, PSTR("G1 E%iF500"), int(coorvalue)); + } - if (strlen(commandStr) > 0) { - sprintf_P(fullCommandStr, PSTR("G91\n%s\nG90"), commandStr); - #if ENABLED(ANYCUBIC_LCD_DEBUG) - SERIAL_ECHOPGM("TFT Serial Debug: A22 Move final request with gcode... "); - SERIAL_ECHOLN(fullCommandStr); - #endif - injectCommands(fullCommandStr); - } + if (strlen(commandStr) > 0) { + sprintf_P(fullCommandStr, PSTR("G91\n%s\nG90"), commandStr); + DEBUG_ECHOPGM("TFT Serial Debug: A22 Move final request with gcode... "); + DEBUG_ECHOLN(fullCommandStr); + injectCommands(fullCommandStr); } - SENDLINE_PGM(""); - break; + } + SENDLINE_PGM(""); + break; - case 23: // A23 preheat pla - if (!isPrinting()) { - if (getAxisPosition_mm(Z) < 10) - injectCommands(F("G1 Z10")); // RASE Z AXIS + case 23: // A23 preheat pla + if (!isPrinting()) { + if (getAxisPosition_mm(Z) < 10) + injectCommands(F("G1 Z10")); // RASE Z AXIS - setTargetTemp_celsius(PREHEAT_1_TEMP_BED, (heater_t)BED); - setTargetTemp_celsius(PREHEAT_1_TEMP_HOTEND, (extruder_t)E0); - SENDLINE_PGM("OK"); - } - break; + setTargetTemp_celsius(PREHEAT_1_TEMP_BED, (heater_t)BED); + setTargetTemp_celsius(PREHEAT_1_TEMP_HOTEND, (extruder_t)E0); + SENDLINE_PGM("OK"); + } + break; - case 24:// A24 preheat abs - if (!isPrinting()) { - if (getAxisPosition_mm(Z) < 10) - injectCommands(F("G1 Z10")); // RASE Z AXIS + case 24:// A24 preheat abs + if (!isPrinting()) { + if (getAxisPosition_mm(Z) < 10) + injectCommands(F("G1 Z10")); // RASE Z AXIS - setTargetTemp_celsius(PREHEAT_2_TEMP_BED, (heater_t)BED); - setTargetTemp_celsius(PREHEAT_2_TEMP_HOTEND, (extruder_t)E0); - SENDLINE_PGM("OK"); - } - break; + setTargetTemp_celsius(PREHEAT_2_TEMP_BED, (heater_t)BED); + setTargetTemp_celsius(PREHEAT_2_TEMP_HOTEND, (extruder_t)E0); + SENDLINE_PGM("OK"); + } + break; - case 25: // A25 cool down - if (!isPrinting()) { - setTargetTemp_celsius(0, (heater_t) BED); - setTargetTemp_celsius(0, (extruder_t) E0); + case 25: // A25 cool down + if (!isPrinting()) { + setTargetTemp_celsius(0, (heater_t) BED); + setTargetTemp_celsius(0, (extruder_t) E0); - SENDLINE_DBG_PGM("J12", "TFT Serial Debug: Cooling down... J12"); // J12 cool down - } - break; + SENDLINE_DBG_PGM("J12", "TFT Serial Debug: Cooling down... J12"); // J12 cool down + } + break; - case 26: // A26 refresh SD - #if HAS_MEDIA - if (isMediaInserted()) { - if (strlen(SelectedDirectory) > 0) { - FileList currentFileList; - if ((SelectedDirectory[0] == '.') && (SelectedDirectory[1] == '.')) { - currentFileList.upDir(); - } - else { - if (SelectedDirectory[0] == '<') - HandleSpecialMenu(); - else - currentFileList.changeDir(SelectedDirectory); - } + case 26: // A26 refresh SD + #if HAS_MEDIA + if (isMediaInserted()) { + if (strlen(selectedDirectory) > 0) { + FileList currentFileList; + if ((selectedDirectory[0] == '.') && (selectedDirectory[1] == '.')) { + currentFileList.upDir(); + } + else { + if (selectedDirectory[0] == '<') + handleSpecialMenu(); + else + currentFileList.changeDir(selectedDirectory); } } - else { - SENDLINE_DBG_PGM("J02", "TFT Serial Debug: No SD Card mounted to refresh SD A26... J02"); - } + } + else { + SENDLINE_DBG_PGM("J02", "TFT Serial Debug: No SD Card mounted to refresh SD A26... J02"); + } - SelectedDirectory[0] = 0; - #endif - break; + selectedDirectory[0] = 0; + #endif + break; - #if ENABLED(SERVO_ENDSTOPS) - case 27: break; // A27 servos angles adjust - #endif + #if ENABLED(SERVO_ENDSTOPS) + case 27: break; // A27 servos angles adjust + #endif - case 28: // A28 filament test - if (CodeSeen('O')) - NOOP; - else if (CodeSeen('C')) - NOOP; - SENDLINE_PGM(""); - break; + case 28: // A28 filament test + if (codeSeen('O')) + NOOP; + else if (codeSeen('C')) + NOOP; + SENDLINE_PGM(""); + break; - case 33: // A33 get version info - SEND_PGM("J33 "); - SENDLINE_PGM(DETAILED_BUILD_VERSION); - break; + case 33: // A33 get version info + SEND_PGM("J33 "); + SENDLINE_PGM(DETAILED_BUILD_VERSION); + break; - default: - break; - } + default: + break; } - - TFTbufindw = (TFTbufindw + 1) % TFTBUFSIZE; - TFTbuflen += 1; - serial3_count = 0; // clear buffer - } - else { - TFTcmdbuffer[TFTbufindw][serial3_count++] = serial3_char; } - } + + tftBufIndW = (tftBufIndW + 1) % (TFTBUFSIZE); + tftBufLen++; + serial_count = 0; // clear buffer + + } // while } -void AnycubicTFTClass::DoSDCardStateCheck() { +void AnycubicTFTClass::doSDCardStateCheck() { #if BOTH(HAS_MEDIA, HAS_SD_DETECT) bool isInserted = isMediaInserted(); if (isInserted) @@ -934,7 +895,7 @@ void AnycubicTFTClass::DoSDCardStateCheck() { #endif } -void AnycubicTFTClass::DoFilamentRunoutCheck() { +void AnycubicTFTClass::doFilamentRunoutCheck() { #if ENABLED(FILAMENT_RUNOUT_SENSOR) // NOTE: getFilamentRunoutState() only returns the runout state if the job is printing // we want to actually check the status of the pin here, regardless of printstate @@ -953,23 +914,18 @@ void AnycubicTFTClass::DoFilamentRunoutCheck() { #endif // FILAMENT_RUNOUT_SENSOR } -void AnycubicTFTClass::StartPrint() { +void AnycubicTFTClass::startPrint() { #if HAS_MEDIA - if (!isPrinting() && strlen(SelectedFile) > 0) { - #if ENABLED(ANYCUBIC_LCD_DEBUG) - SERIAL_ECHOPGM("TFT Serial Debug: About to print file ... "); - SERIAL_ECHO(isPrinting()); - SERIAL_ECHOPGM(" "); - SERIAL_ECHOLN(SelectedFile); - #endif + if (!isPrinting() && strlen(selectedFile) > 0) { + DEBUG_ECHOLNPGM("TFT Serial Debug: About to print file ... ", isPrinting(), " ", selectedFile); mediaPrintingState = AMPRINTSTATE_PRINTING; mediaPauseState = AMPAUSESTATE_NOT_PAUSED; - printFile(SelectedFile); + printFile(selectedFile); } #endif // SDUPPORT } -void AnycubicTFTClass::PausePrint() { +void AnycubicTFTClass::pausePrint() { #if HAS_MEDIA if (isPrintingFromMedia() && mediaPrintingState != AMPRINTSTATE_STOP_REQUESTED && mediaPauseState == AMPAUSESTATE_NOT_PAUSED) { mediaPrintingState = AMPRINTSTATE_PAUSE_REQUESTED; @@ -983,16 +939,14 @@ void AnycubicTFTClass::PausePrint() { #endif } -void AnycubicTFTClass::ResumePrint() { +void AnycubicTFTClass::resumePrint() { #if HAS_MEDIA #if ENABLED(FILAMENT_RUNOUT_SENSOR) if (READ(FIL_RUNOUT1_PIN)) { - #if ENABLED(ANYCUBIC_LCD_DEBUG) - SERIAL_ECHOLNPGM("TFT Serial Debug: Resume Print with filament sensor still tripped... "); - #endif + DEBUG_ECHOLNPGM("TFT Serial Debug: Resume Print with filament sensor still tripped... "); // trigger the user message box - DoFilamentRunoutCheck(); + doFilamentRunoutCheck(); // re-enable the continue button SENDLINE_DBG_PGM("J18", "TFT Serial Debug: Resume Print with filament sensor still tripped... J18"); @@ -1019,7 +973,7 @@ void AnycubicTFTClass::ResumePrint() { #endif } -void AnycubicTFTClass::StopPrint() { +void AnycubicTFTClass::stopPrint() { #if HAS_MEDIA mediaPrintingState = AMPRINTSTATE_STOP_REQUESTED; mediaPauseState = AMPAUSESTATE_NOT_PAUSED; diff --git a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.h b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.h index 8fcadc1553fd9..7316c5fc04fce 100644 --- a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.h +++ b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.h @@ -48,48 +48,45 @@ enum AnycubicMediaPauseState { class AnycubicTFTClass { public: AnycubicTFTClass(); - static void OnSetup(); - static void OnCommandScan(); - static void OnKillTFT(); - static void OnSDCardStateChange(bool); - static void OnSDCardError(); - static void OnFilamentRunout(); - static void OnUserConfirmRequired(const char *); - static void OnPrintTimerStarted(); - static void OnPrintTimerPaused(); - static void OnPrintTimerStopped(); + static void onSetup(); + static void onCommandScan(); + static void onKillTFT(); + static void onSDCardStateChange(bool); + static void onSDCardError(); + static void onFilamentRunout(); + static void onUserConfirmRequired(const char *); + static void onPrintTimerStarted(); + static void onPrintTimerPaused(); + static void onPrintTimerStopped(); private: - static char TFTcmdbuffer[TFTBUFSIZE][TFT_MAX_CMD_SIZE]; - static int TFTbuflen, TFTbufindr, TFTbufindw; - static char serial3_char; - static int serial3_count; - static char *TFTstrchr_pointer; - static uint8_t SpecialMenu; + static char tftCommands[TFTBUFSIZE][TFT_MAX_CMD_SIZE]; + static int tftBufLen, tftBufIndR, tftBufIndW; + static char *tftStrchrPtr; + static uint8_t specialMenu; static AnycubicMediaPrintState mediaPrintingState; static AnycubicMediaPauseState mediaPauseState; - static float CodeValue(); - static bool CodeSeen(char); - static bool IsNozzleHomed(); - static void RenderCurrentFileList(); - static void RenderSpecialMenu(uint16_t); - static void RenderCurrentFolder(uint16_t); - static void GetCommandFromTFT(); - static void CheckSDCardChange(); - static void CheckPauseState(); - static void CheckPrintCompletion(); - static void HandleSpecialMenu(); - static void DoSDCardStateCheck(); - static void DoFilamentRunoutCheck(); - static void StartPrint(); - static void PausePrint(); - static void ResumePrint(); - static void StopPrint(); + static float codeValue(); + static bool codeSeen(char); + static bool isNozzleHomed(); + static void renderCurrentFileList(); + static void renderSpecialMenu(uint16_t); + static void renderCurrentFolder(uint16_t); + static void getCommandFromTFT(); + static void checkSDCardChange(); + static void checkPauseState(); + static void handleSpecialMenu(); + static void doSDCardStateCheck(); + static void doFilamentRunoutCheck(); + static void startPrint(); + static void pausePrint(); + static void resumePrint(); + static void stopPrint(); - static char SelectedDirectory[30]; - static char SelectedFile[FILENAME_LENGTH]; + static char selectedDirectory[30]; + static char selectedFile[FILENAME_LENGTH]; }; -extern AnycubicTFTClass AnycubicTFT; +extern AnycubicTFTClass anycubicTFT; extern const char G28_STR[]; diff --git a/Marlin/src/lcd/extui/anycubic_vyper/FileNavigator.cpp b/Marlin/src/lcd/extui/anycubic_vyper/FileNavigator.cpp index 03eba4c5b355a..da88acc725c16 100644 --- a/Marlin/src/lcd/extui/anycubic_vyper/FileNavigator.cpp +++ b/Marlin/src/lcd/extui/anycubic_vyper/FileNavigator.cpp @@ -40,8 +40,8 @@ using namespace ExtUI; namespace Anycubic { - FileList FileNavigator::filelist; // Instance of the Marlin file API - char FileNavigator::currentfoldername[MAX_PATH_LEN + 1]; // Current folder path + FileList FileNavigator::filelist; // ExtUI file API + char FileNavigator::currentDirPath[MAX_PATH_LEN + 1]; // Current folder path uint16_t FileNavigator::lastindex; uint8_t FileNavigator::folderdepth; uint16_t FileNavigator::currentindex; // override the panel request @@ -51,7 +51,7 @@ namespace Anycubic { FileNavigator::FileNavigator() { reset(); } void FileNavigator::reset() { - currentfoldername[0] = '\0'; + currentDirPath[0] = '\0'; folderdepth = 0; currentindex = 0; lastindex = 0; @@ -94,7 +94,7 @@ namespace Anycubic { DgusTFT::SendTxtToTFT(filelist.longFilename(), TXT_FILE_0 + file_num*0x30); #if ACDEBUG(AC_FILE) - SERIAL_ECHOLNPGM("seek: ", _seek, " '", filelist.longFilename(), "' '", currentfoldername, "", filelist.shortFilename(), "'\n"); + SERIAL_ECHOLNPGM("seek: ", _seek, " '", filelist.longFilename(), "' '", currentDirPath, "", filelist.shortFilename(), "'\n"); #endif } else { @@ -120,11 +120,11 @@ namespace Anycubic { void FileNavigator::changeDIR(char *folder) { #if ACDEBUG(AC_FILE) - SERIAL_ECHOLNPGM("currentfolder: ", currentfoldername, " New: ", folder); + SERIAL_ECHOLNPGM("currentfolder: ", currentDirPath, " New: ", folder); #endif if (folderdepth >= MAX_FOLDER_DEPTH) return; // limit the folder depth - strcat(currentfoldername, folder); - strcat(currentfoldername, "/"); + strcat(currentDirPath, folder); + strcat(currentDirPath, "/"); filelist.changeDir(folder); refresh(); folderdepth++; @@ -138,22 +138,22 @@ namespace Anycubic { currentindex = 0; // Remove the last child folder from the stored path if (folderdepth == 0) { - currentfoldername[0] = '\0'; + currentDirPath[0] = '\0'; reset(); } else { char *pos = nullptr; for (uint8_t f = 0; f < folderdepth; f++) - pos = strchr(currentfoldername, '/'); + pos = strchr(currentDirPath, '/'); *(pos + 1) = '\0'; } #if ACDEBUG(AC_FILE) - SERIAL_ECHOLNPGM("depth: ", folderdepth, " currentfoldername: ", currentfoldername); + SERIAL_ECHOLNPGM("depth: ", folderdepth, " currentDirPath: ", currentDirPath); #endif } - char* FileNavigator::getCurrentFolderName() { return currentfoldername; } + char* FileNavigator::getCurrentDirPath() { return currentDirPath; } uint16_t FileNavigator::getFileNum() { return filelist.count(); } } diff --git a/Marlin/src/lcd/extui/anycubic_vyper/FileNavigator.h b/Marlin/src/lcd/extui/anycubic_vyper/FileNavigator.h index dd4b0b0f7481f..2505ae7c4cd92 100644 --- a/Marlin/src/lcd/extui/anycubic_vyper/FileNavigator.h +++ b/Marlin/src/lcd/extui/anycubic_vyper/FileNavigator.h @@ -43,13 +43,13 @@ namespace Anycubic { static void changeDIR(char *); static void sendFile(); static void refresh(); - static char* getCurrentFolderName(); + static char* getCurrentDirPath(); static uint16_t getFileNum(); private: static uint16_t lastindex; static uint16_t currentindex; static uint8_t folderdepth; - static char currentfoldername[MAX_PATH_LEN + 1]; + static char currentDirPath[MAX_PATH_LEN + 1]; }; extern FileNavigator filenavigator; diff --git a/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp index e846d65a1faf7..49609ada329a5 100644 --- a/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp +++ b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp @@ -111,10 +111,10 @@ namespace Anycubic { uint8_t pop_up_index_saved; uint32_t key_value_saved; - void DEBUG_PRINT_PAUSED_STATE(FSTR_P const msg, paused_state_t state); - void DEBUG_PRINT_PRINTER_STATE(FSTR_P const msg, printer_state_t state); - void DEBUG_PRINT_TIMER_EVENT(FSTR_P const msg, timer_event_t event); - void DEBUG_PRINT_MEDIA_EVENT(FSTR_P const msg, media_event_t event); + void DEBUG_PRINT_PAUSED_STATE(const paused_state_t state, FSTR_P const msg=nullptr); + void DEBUG_PRINT_PRINTER_STATE(const printer_state_t state, FSTR_P const msg=nullptr); + void DEBUG_PRINT_TIMER_EVENT(const timer_event_t event, FSTR_P const msg=nullptr); + void DEBUG_PRINT_MEDIA_EVENT(const media_event_t event, FSTR_P const msg=nullptr); DgusTFT Dgus; @@ -127,9 +127,9 @@ namespace Anycubic { feedrate_back = -1; } - void DgusTFT::Startup() { + void DgusTFT::startup() { #if ACDEBUG(AC_MARLIN) - DEBUG_ECHOLNPGM("DgusTFT::Startup()"); + DEBUG_ECHOLNPGM("DgusTFT::startup()"); #endif selectedfile[0] = '\0'; panel_command[0] = '\0'; @@ -148,16 +148,16 @@ namespace Anycubic { TFTSer.begin(115200); // Signal Board has reset - SendtoTFTLN(AC_msg_main_board_has_reset); + tftSendLn(AC_msg_main_board_has_reset); // Enable levelling and Disable end stops during print // as Z home places nozzle above the bed so we need to allow it past the end stops injectCommands(AC_cmnd_enable_leveling); #if ACDEBUGLEVEL - DEBUG_ECHOLNPGM("Startup AC Debug Level ", ACDEBUGLEVEL); + DEBUG_ECHOLNPGM("startup AC Debug Level ", ACDEBUGLEVEL); #endif - SendtoTFTLN(AC_msg_ready); + tftSendLn(AC_msg_ready); } void DgusTFT::ParamInit() { @@ -188,15 +188,15 @@ namespace Anycubic { RequestValueFromTFT(0x14); // get page ID } - void DgusTFT::IdleLoop() { - if (ReadTFTCommand()) { - ProcessPanelRequest(); + void DgusTFT::idleLoop() { + if (readTFTCommand()) { + processPanelRequest(); command_len = 0; } #if ACDEBUG(AC_MARLIN) if (key_value) { - DEBUG_ECHOLNPGM("IdleLoop page: ", page_index_now); + DEBUG_ECHOLNPGM("idleLoop page: ", page_index_now); DEBUG_ECHOLNPGM("key: ", key_value); } #endif @@ -266,7 +266,7 @@ namespace Anycubic { pop_up_manager(); key_value = 0; - CheckHeaters(); + checkHeaters(); } uint8_t FSHlength(FSTR_P FSHinput) { @@ -276,7 +276,7 @@ namespace Anycubic { return stringLength; } - void DgusTFT::PrinterKilled(FSTR_P error_p, FSTR_P component_p) { + void DgusTFT::printerKilled(FSTR_P error_p, FSTR_P component_p) { // copy string in FLASH to RAM for strcmp_P @@ -288,9 +288,9 @@ namespace Anycubic { char component[FSHlength(component_p) + 1]; memcpy_P(component, component_p, textLength + 1); // +1 for the null terminator - SendtoTFTLN(AC_msg_kill_lcd); + tftSendLn(AC_msg_kill_lcd); #if ACDEBUG(AC_MARLIN) - DEBUG_ECHOLNPGM("PrinterKilled()\nerror: ", error, "\ncomponent: ", component); + DEBUG_ECHOLNPGM("printerKilled()\nerror: ", error, "\ncomponent: ", component); #endif if (strcmp_P(error, PSTR("Heating Failed")) == 0) { @@ -364,9 +364,9 @@ namespace Anycubic { SendColorToTFT(color, TXT_DESCRIPT_0 + 0x30 * (index - 1)); } - void DgusTFT::MediaEvent(media_event_t event) { + void DgusTFT::mediaEvent(media_event_t event) { #if ACDEBUG(AC_MARLIN) - DEBUG_PRINT_MEDIA_EVENT(F("ProcessMediaStatus() "), event); + DEBUG_PRINT_MEDIA_EVENT(event); #endif switch (event) { case AC_media_inserted: @@ -379,12 +379,12 @@ namespace Anycubic { lcd_txtbox_index = 0; } - SendFileList(lcd_txtbox_index); + sendFileList(lcd_txtbox_index); break; case AC_media_removed: - SendtoTFTLN(AC_msg_sd_card_removed); + tftSendLn(AC_msg_sd_card_removed); filenavigator.reset(); @@ -394,33 +394,33 @@ namespace Anycubic { lcd_txtbox_index = 0; } - SendFileList(lcd_txtbox_index); + sendFileList(lcd_txtbox_index); break; case AC_media_error: - SendtoTFTLN(AC_msg_no_sd_card); + tftSendLn(AC_msg_no_sd_card); break; } } - void DgusTFT::TimerEvent(timer_event_t event) { + void DgusTFT::timerEvent(timer_event_t event) { #if ACDEBUG(AC_MARLIN) - DEBUG_PRINT_TIMER_EVENT(F("TimerEvent() "), event); - DEBUG_PRINT_PRINTER_STATE(F("Printer State: "), printer_state); + DEBUG_PRINT_TIMER_EVENT(event); + DEBUG_PRINT_PRINTER_STATE(printer_state); #endif switch (event) { case AC_timer_started: setSoftEndstopState(false); // disable endstops to print printer_state = AC_printer_printing; - SendtoTFTLN(AC_msg_print_from_sd_card); + tftSendLn(AC_msg_print_from_sd_card); break; case AC_timer_paused: //printer_state = AC_printer_paused; //pause_state = AC_paused_idle; - SendtoTFTLN(AC_msg_paused); + tftSendLn(AC_msg_paused); break; case AC_timer_stopped: @@ -438,7 +438,7 @@ namespace Anycubic { sprintf(str_buf + strlen(str_buf), "%s M", utostr3(time % 60)); SendTxtToTFT(str_buf, TXT_FINISH_TIME); ChangePageOfTFT(PAGE_PRINT_FINISH); - SendtoTFTLN(AC_msg_print_complete); + tftSendLn(AC_msg_print_complete); pop_up_index = 100; } } @@ -449,12 +449,12 @@ namespace Anycubic { #if ENABLED(FILAMENT_RUNOUT_SENSOR) - void DgusTFT::FilamentRunout() { + void DgusTFT::filamentRunout() { #if ACDEBUG(AC_MARLIN) - DEBUG_PRINT_PRINTER_STATE(F("FilamentRunout() printer_state "), printer_state); + DEBUG_PRINT_PRINTER_STATE(printer_state, F("filamentRunout() ")); // 1 Signal filament out - SendtoTFTLN(isPrintingFromMedia() ? AC_msg_filament_out_alert : AC_msg_filament_out_block); + tftSendLn(isPrintingFromMedia() ? AC_msg_filament_out_alert : AC_msg_filament_out_block); //printer_state = AC_printer_filament_out; DEBUG_ECHOLNPGM("getFilamentRunoutState: ", getFilamentRunoutState()); @@ -477,13 +477,13 @@ namespace Anycubic { #endif // FILAMENT_RUNOUT_SENSOR - void DgusTFT::ConfirmationRequest(const char * const msg) { + void DgusTFT::confirmationRequest(const char * const msg) { // M108 continue #if ACDEBUG(AC_MARLIN) DEBUG_ECHOLNPGM("HomingComplete, line: ", __LINE__); - DEBUG_ECHOLNPGM("ConfirmationRequest() ", msg); - DEBUG_PRINT_PRINTER_STATE(F("printer_state: " ), printer_state); - DEBUG_PRINT_PAUSED_STATE(F("pause_state: "), pause_state); + DEBUG_ECHOLNPGM("confirmationRequest() ", msg); + DEBUG_PRINT_PRINTER_STATE(printer_state); + DEBUG_PRINT_PAUSED_STATE(pause_state); #endif switch (printer_state) { @@ -504,7 +504,7 @@ namespace Anycubic { // Heater timout, send acknowledgement if (strcmp_P(msg, MARLIN_msg_heater_timeout) == 0) { pause_state = AC_paused_heater_timed_out; - SendtoTFTLN(AC_msg_paused); // enable continue button + tftSendLn(AC_msg_paused); // enable continue button PlayTune(HeaterTimeout); } // Reheat finished, send acknowledgement @@ -517,12 +517,12 @@ namespace Anycubic { if (pause_state != AC_paused_filament_lack) pause_state = AC_paused_idle; - SendtoTFTLN(AC_msg_paused); // enable continue button + tftSendLn(AC_msg_paused); // enable continue button } // Filament Purging, send acknowledgement enter run mode else if (strcmp_P(msg, MARLIN_msg_filament_purging) == 0) { pause_state = AC_paused_purging_filament; - SendtoTFTLN(AC_msg_paused); // enable continue button + tftSendLn(AC_msg_paused); // enable continue button } else if (strcmp_P(msg, MARLIN_msg_nozzle_parked) == 0) { #if ACDEBUG(AC_MARLIN) @@ -540,11 +540,11 @@ namespace Anycubic { } } - void DgusTFT::StatusChange(const char * const msg) { + void DgusTFT::statusChange(const char * const msg) { #if ACDEBUG(AC_MARLIN) - DEBUG_ECHOLNPGM("StatusChange() ", msg); - DEBUG_PRINT_PRINTER_STATE(F("printer_state: "), printer_state); - DEBUG_PRINT_PAUSED_STATE(F("pause_state: "), pause_state); + DEBUG_ECHOLNPGM("statusChange() ", msg); + DEBUG_PRINT_PRINTER_STATE(printer_state); + DEBUG_PRINT_PAUSED_STATE(pause_state); #endif bool msg_matched = false; @@ -579,7 +579,7 @@ namespace Anycubic { PlayTune(BeepBeepBeeep); injectCommands(F("G1 Z50 F500")); ChangePageOfTFT(PAGE_CHS_ABNORMAL_LEVELING_SENSOR); - SendtoTFTLN(AC_msg_probing_complete); + tftSendLn(AC_msg_probing_complete); printer_state = AC_printer_idle; msg_matched = true; } @@ -595,7 +595,7 @@ namespace Anycubic { case AC_printer_printing: if (strcmp_P(msg, MARLIN_msg_reheating) == 0) { - SendtoTFTLN(AC_msg_paused); // enable continue button + tftSendLn(AC_msg_paused); // enable continue button ChangePageOfTFT(PAGE_STATUS2); msg_matched = true; } @@ -652,14 +652,14 @@ namespace Anycubic { if (!msg_matched) { #if HAS_HOTEND if (strcmp_P(msg, MARLIN_msg_extruder_heating) == 0) { - SendtoTFTLN(AC_msg_nozzle_heating); + tftSendLn(AC_msg_nozzle_heating); hotend_state = AC_heater_temp_set; return; } #endif #if HAS_HEATED_BED if (strcmp_P(msg, MARLIN_msg_bed_heating) == 0) { - SendtoTFTLN(AC_msg_bed_heating); + tftSendLn(AC_msg_bed_heating); hotbed_state = AC_heater_temp_set; } #endif @@ -675,7 +675,7 @@ namespace Anycubic { LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]); } - void DgusTFT::PowerLossRecovery() { + void DgusTFT::powerLossRecovery() { printer_state = AC_printer_resuming_from_power_outage; // Play tune to notify user we can recover. } @@ -699,7 +699,7 @@ namespace Anycubic { ChangePageOfTFT(page_index_last); } - void DgusTFT::SendtoTFT(FSTR_P const fstr/*=nullptr*/) { // A helper to print PROGMEM string to the panel + void DgusTFT::tftSend(FSTR_P const fstr/*=nullptr*/) { // A helper to print PROGMEM string to the panel #if ACDEBUG(AC_SOME) DEBUG_ECHOF(fstr); #endif @@ -707,12 +707,12 @@ namespace Anycubic { while (const char c = pgm_read_byte(str++)) TFTSer.write(c); } - void DgusTFT::SendtoTFTLN(FSTR_P const fstr/*=nullptr*/) { + void DgusTFT::tftSendLn(FSTR_P const fstr/*=nullptr*/) { if (fstr) { #if ACDEBUG(AC_SOME) DEBUG_ECHOPGM("> "); #endif - SendtoTFT(fstr); + tftSend(fstr); #if ACDEBUG(AC_SOME) SERIAL_EOL(); #endif @@ -804,7 +804,7 @@ namespace Anycubic { LOOP_L_N(i, 10) TFTSer.write(data[i]); } - bool DgusTFT::ReadTFTCommand() { + bool DgusTFT::readTFTCommand() { static uint8_t length = 0, cnt = 0, tft_receive_steps = 0; uint8_t data; @@ -858,7 +858,7 @@ namespace Anycubic { #if 0 { - //SERIAL_ECHOLNPGM("ReadTFTCommand: ", millis()); + //SERIAL_ECHOLNPGM("readTFTCommand: ", millis()); //return -1; bool command_ready = false; @@ -888,7 +888,7 @@ namespace Anycubic { uint8_t req = atoi(&panel_command[1]); if (req > 7 && req != 20) { DEBUG_ECHOLNPGM("> ", panel_command); - DEBUG_PRINT_PRINTER_STATE(F("printer_state: "), printer_state); + DEBUG_PRINT_PRINTER_STATE(printer_state); } #endif } @@ -902,7 +902,7 @@ namespace Anycubic { return -1; } - void DgusTFT::CheckHeaters() { + void DgusTFT::checkHeaters() { static uint32_t time_last = 0; if (PENDING(millis(), time_last)) return; time_last = millis() + 500; @@ -916,7 +916,7 @@ namespace Anycubic { if (!WITHIN(temp, HEATER_0_MINTEMP, HEATER_0_MAXTEMP)) { faultE0Duration++; if (faultE0Duration >= AC_HEATER_FAULT_VALIDATION_TIME) { - SendtoTFTLN(AC_msg_nozzle_temp_abnormal); + tftSendLn(AC_msg_nozzle_temp_abnormal); #if ACDEBUG(AC_MARLIN) DEBUG_ECHOLNPGM("Extruder temp abnormal! : ", temp); #endif @@ -931,7 +931,7 @@ namespace Anycubic { if (!WITHIN(temp, BED_MINTEMP, BED_MAXTEMP)) { faultBedDuration++; if (faultBedDuration >= AC_HEATER_FAULT_VALIDATION_TIME) { - SendtoTFTLN(AC_msg_bed_temp_abnormal); + tftSendLn(AC_msg_bed_temp_abnormal); #if ACDEBUG(AC_MARLIN) DEBUG_ECHOLNPGM("Bed temp abnormal! : ", temp); #endif @@ -944,7 +944,7 @@ namespace Anycubic { // Update panel with hotend heater status if (hotend_state != AC_heater_temp_reached) { if (WITHIN(getActualTemp_celsius(E0) - getTargetTemp_celsius(E0), -1, 1)) { - SendtoTFTLN(AC_msg_nozzle_heating_done); + tftSendLn(AC_msg_nozzle_heating_done); hotend_state = AC_heater_temp_reached; } } @@ -952,22 +952,22 @@ namespace Anycubic { // Update panel with bed heater status if (hotbed_state != AC_heater_temp_reached) { if (WITHIN(getActualTemp_celsius(BED) - getTargetTemp_celsius(BED), -0.5, 0.5)) { - SendtoTFTLN(AC_msg_bed_heating_done); + tftSendLn(AC_msg_bed_heating_done); hotbed_state = AC_heater_temp_reached; } } #endif } - void DgusTFT::SendFileList(int8_t startindex) { + void DgusTFT::sendFileList(int8_t startindex) { // Respond to panel request for 4 files starting at index #if ACDEBUG(AC_INFO) - DEBUG_ECHOLNPGM("## SendFileList ## ", startindex); + DEBUG_ECHOLNPGM("## sendFileList ## ", startindex); #endif filenavigator.getFiles(startindex); } - void DgusTFT::SelectFile() { + void DgusTFT::selectFile() { strncpy(selectedfile, panel_command + 4, command_len - 4); selectedfile[command_len - 5] = '\0'; #if ACDEBUG(AC_FILE) @@ -975,22 +975,22 @@ namespace Anycubic { #endif switch (selectedfile[0]) { case '/': // Valid file selected - SendtoTFTLN(AC_msg_sd_file_open_success); + tftSendLn(AC_msg_sd_file_open_success); break; case '<': // .. (go up folder level) filenavigator.upDIR(); - SendtoTFTLN(AC_msg_sd_file_open_failed); - SendFileList(0); + tftSendLn(AC_msg_sd_file_open_failed); + sendFileList(0); break; default: // enter sub folder filenavigator.changeDIR(selectedfile); - SendtoTFTLN(AC_msg_sd_file_open_failed); - SendFileList(0); + tftSendLn(AC_msg_sd_file_open_failed); + sendFileList(0); break; } } - void DgusTFT::ProcessPanelRequest() { + void DgusTFT::processPanelRequest() { uint16_t control_index = 0; uint32_t control_value; uint16_t temp; @@ -1080,7 +1080,7 @@ namespace Anycubic { } else if (control_value == 0x010000) { // startup first gif - // Startup tunes are defined in Tunes.h + // startup tunes are defined in Tunes.h PlayTune(Anycubic_PowerOn); // takes 3500 ms } } @@ -1112,15 +1112,15 @@ namespace Anycubic { int8_t req = atoi(&panel_command[1]); // Information requests A0 - A8 and A33 - if (req <= 8 || req == 33) PanelInfo(req); + if (req <= 8 || req == 33) panelInfo(req); // Simple Actions A9 - A28 - else if (req <= 28) PanelAction(req); + else if (req <= 28) panelAction(req); // Process Initiation - else if (req <= 34) PanelProcess(req); + else if (req <= 34) panelProcess(req); - else SendtoTFTLN(); + else tftSendLn(); } #endif @@ -1187,7 +1187,7 @@ namespace Anycubic { lcd_txtbox_index = 0; } ChangePageOfTFT(PAGE_FILE); - SendFileList(0); + sendFileList(0); } break; case 2: { // tool @@ -1249,7 +1249,7 @@ namespace Anycubic { set_descript_color(COLOR_BLUE); lcd_txtbox_index = 0; - SendFileList(lcd_txtbox_page * 5); + sendFileList(lcd_txtbox_page * 5); } break; @@ -1260,7 +1260,7 @@ namespace Anycubic { set_descript_color(COLOR_BLUE); lcd_txtbox_index = 0; - SendFileList(lcd_txtbox_page * 5); + sendFileList(lcd_txtbox_page * 5); } break; @@ -1274,12 +1274,12 @@ namespace Anycubic { set_descript_color(COLOR_BLUE); lcd_txtbox_index = 0; } - SendFileList(lcd_txtbox_index); + sendFileList(lcd_txtbox_index); break; case 5: // resume of outage(last power off) #if ACDEBUG(AC_MARLIN) - DEBUG_PRINT_PRINTER_STATE(F("printer_state: "), printer_state); + DEBUG_PRINT_PRINTER_STATE(printer_state); #endif if (lcd_txtbox_index > 0 && lcd_txtbox_index < 6) { // 1~5 @@ -1398,8 +1398,8 @@ namespace Anycubic { case 2: // resume print #if ACDEBUG(AC_MARLIN) - DEBUG_PRINT_PRINTER_STATE(F("printer_state: "), printer_state); - DEBUG_PRINT_PAUSED_STATE(F("pause_state :"), pause_state); + DEBUG_PRINT_PRINTER_STATE(printer_state); + DEBUG_PRINT_PAUSED_STATE(pause_state); #endif if ( pause_state == AC_paused_idle || pause_state == AC_paused_filament_lack @@ -2418,8 +2418,8 @@ namespace Anycubic { case 1: // return #if ACDEBUG(AC_MARLIN) - DEBUG_PRINT_PRINTER_STATE(F("printer_state: "), printer_state); - DEBUG_PRINT_PAUSED_STATE(F("pause_state: "), pause_state); + DEBUG_PRINT_PRINTER_STATE(printer_state); + DEBUG_PRINT_PAUSED_STATE(pause_state); #endif if (AC_printer_printing == printer_state) ChangePageOfTFT(PAGE_STATUS2); // show pause @@ -3179,6 +3179,7 @@ namespace Anycubic { break; case 15: // filament lack + case 23: if (page_index_now != PAGE_FILAMENT_LACK) ChangePageOfTFT(PAGE_FILAMENT_LACK); pop_up_index = 100; @@ -3194,12 +3195,6 @@ namespace Anycubic { pop_up_index = 100; break; - case 23: // - if (page_index_now != PAGE_FILAMENT_LACK) - ChangePageOfTFT(PAGE_FILAMENT_LACK); - pop_up_index = 100; - break; - case 24: { // uint32_t time = getProgress_seconds_elapsed() / 60; char str_buf[20]; @@ -3207,7 +3202,7 @@ namespace Anycubic { sprintf(str_buf + strlen(str_buf), "%s M", utostr3(time % 60)); SendTxtToTFT(str_buf, TXT_FINISH_TIME); ChangePageOfTFT(PAGE_PRINT_FINISH); - //SendtoTFTLN(AC_msg_print_complete); // no idea why this causes a compile error + //tftSendLn(AC_msg_print_complete); // no idea why this causes a compile error pop_up_index = 100; } break; @@ -3218,84 +3213,56 @@ namespace Anycubic { } } - void DEBUG_PRINT_PAUSED_STATE(FSTR_P const msg, paused_state_t state) { - DEBUG_ECHOPGM(msg, state); + void DEBUG_PRINT_PAUSED_STATE(const paused_state_t state, FSTR_P const msg/*=nullptr*/) { + if (msg) DEBUG_ECHOF(msg); + DEBUG_ECHOPGM("Paused state: ", state, " "); switch (state) { - case AC_paused_heater_timed_out: - DEBUG_ECHOLNPGM(" AC_paused_heater_timed_out"); - break; - case AC_paused_filament_lack: - DEBUG_ECHOLNPGM(" AC_paused_filament_lack"); - break; - case AC_paused_purging_filament: - DEBUG_ECHOLNPGM(" AC_paused_purging_filament"); - break; - case AC_paused_idle: - DEBUG_ECHOLNPGM(" AC_paused_idle"); - break; + case AC_paused_heater_timed_out: DEBUG_ECHOPGM("AC_paused_heater_timed_out"); break; + case AC_paused_filament_lack: DEBUG_ECHOPGM("AC_paused_filament_lack"); break; + case AC_paused_purging_filament: DEBUG_ECHOPGM("AC_paused_purging_filament"); break; + case AC_paused_idle: DEBUG_ECHOPGM("AC_paused_idle"); break; } + DEBUG_EOL(); } -// routines to make the debug outputs human readable + // Human-readable debugging - void DEBUG_PRINT_PRINTER_STATE(FSTR_P const msg, printer_state_t state) { - DEBUG_ECHOPGM(msg, state); + void DEBUG_PRINT_PRINTER_STATE(const printer_state_t state, FSTR_P const msg/*=nullptr*/) { + if (msg) DEBUG_ECHOF(msg); + DEBUG_ECHOPGM("Printer State: ", state, " "); switch (state) { - case AC_printer_idle: - DEBUG_ECHOLNPGM(" AC_printer_idle"); - break; - case AC_printer_probing: - DEBUG_ECHOLNPGM(" AC_printer_probing"); - break; - case AC_printer_printing: - DEBUG_ECHOLNPGM(" AC_printer_printing"); - break; - case AC_printer_pausing: - DEBUG_ECHOLNPGM(" AC_printer_pausing"); - break; - case AC_printer_paused: - DEBUG_ECHOLNPGM(" AC_printer_paused"); - break; - case AC_printer_stopping: - DEBUG_ECHOLNPGM(" AC_printer_stopping"); - break; - case AC_printer_stopping_from_media_remove: - DEBUG_ECHOLNPGM(" AC_printer_stopping_from_media_remove"); - break; - case AC_printer_resuming_from_power_outage: - DEBUG_ECHOLNPGM(" AC_printer_resuming_from_power_outage"); - break; + case AC_printer_idle: DEBUG_ECHOPGM("AC_printer_idle"); break; + case AC_printer_probing: DEBUG_ECHOPGM("AC_printer_probing"); break; + case AC_printer_printing: DEBUG_ECHOPGM("AC_printer_printing"); break; + case AC_printer_pausing: DEBUG_ECHOPGM("AC_printer_pausing"); break; + case AC_printer_paused: DEBUG_ECHOPGM("AC_printer_paused"); break; + case AC_printer_stopping: DEBUG_ECHOPGM("AC_printer_stopping"); break; + case AC_printer_stopping_from_media_remove: DEBUG_ECHOPGM("AC_printer_stopping_from_media_remove"); break; + case AC_printer_resuming_from_power_outage: DEBUG_ECHOPGM("AC_printer_resuming_from_power_outage"); break; } + DEBUG_EOL(); } - void DEBUG_PRINT_TIMER_EVENT(FSTR_P const msg, timer_event_t event) { - DEBUG_ECHOPGM(msg, event); + void DEBUG_PRINT_TIMER_EVENT(const timer_event_t event, FSTR_P const msg/*=nullptr*/) { + if (msg) DEBUG_ECHOPGM(msg, event); + DEBUG_ECHOPGM("timerEvent() ", event, " "); switch (event) { - case AC_timer_started: - DEBUG_ECHOLNPGM(" AC_timer_started"); - break; - case AC_timer_paused: - DEBUG_ECHOLNPGM(" AC_timer_paused"); - break; - case AC_timer_stopped: - DEBUG_ECHOLNPGM(" AC_timer_stopped"); - break; + case AC_timer_started: DEBUG_ECHOPGM("AC_timer_started"); break; + case AC_timer_paused: DEBUG_ECHOPGM("AC_timer_paused"); break; + case AC_timer_stopped: DEBUG_ECHOPGM("AC_timer_stopped"); break; } + DEBUG_EOL(); } - void DEBUG_PRINT_MEDIA_EVENT(FSTR_P const msg, media_event_t event) { - DEBUG_ECHOPGM(msg, event); + void DEBUG_PRINT_MEDIA_EVENT(const media_event_t event, FSTR_P const msg/*=nullptr*/) { + if (msg) DEBUG_ECHOPGM(msg, event); + DEBUG_ECHOPGM("ProcessMediaStatus() ", event, " "); switch (event) { - case AC_media_inserted: - DEBUG_ECHOLNPGM(" AC_media_inserted"); - break; - case AC_media_removed: - DEBUG_ECHOLNPGM(" AC_media_removed"); - break; - case AC_media_error: - DEBUG_ECHOLNPGM(" AC_media_error"); - break; + case AC_media_inserted: DEBUG_ECHOPGM("AC_media_inserted"); break; + case AC_media_removed: DEBUG_ECHOPGM("AC_media_removed"); break; + case AC_media_error: DEBUG_ECHOPGM("AC_media_error"); break; } + DEBUG_EOL(); } } // namespace diff --git a/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.h b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.h index 1903fa1183360..747193dd77f5f 100644 --- a/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.h +++ b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.h @@ -356,17 +356,17 @@ namespace Anycubic { static lcd_info_t lcd_info, lcd_info_back; static uint16_t page_index_now; - static void Startup(); + static void startup(); static void ParamInit(); - static void IdleLoop(); - static void PrinterKilled(FSTR_P,FSTR_P); - static void MediaEvent(media_event_t); - static void TimerEvent(timer_event_t); - static void FilamentRunout(); - static void ConfirmationRequest(const char * const); - static void StatusChange(const char * const); + static void idleLoop(); + static void printerKilled(FSTR_P,FSTR_P); + static void mediaEvent(media_event_t); + static void timerEvent(timer_event_t); + static void filamentRunout(); + static void confirmationRequest(const char * const); + static void statusChange(const char * const); static void PowerLoss(); - static void PowerLossRecovery(); + static void powerLossRecovery(); static void HomingStart(); static void HomingComplete(); @@ -450,17 +450,17 @@ namespace Anycubic { static void pop_up_manager(); - static void SendtoTFT(FSTR_P const=nullptr); - static void SendtoTFTLN(FSTR_P const=nullptr); - static bool ReadTFTCommand(); + static void tftSend(FSTR_P const=nullptr); + static void tftSendLn(FSTR_P const=nullptr); + static bool readTFTCommand(); static int8_t Findcmndpos(const char *, const char); - static void CheckHeaters(); - static void SendFileList(int8_t); - static void SelectFile(); - static void ProcessPanelRequest(); - static void PanelInfo(uint8_t); - static void PanelAction(uint8_t); - static void PanelProcess(uint8_t); + static void checkHeaters(); + static void sendFileList(int8_t); + static void selectFile(); + static void processPanelRequest(); + static void panelInfo(uint8_t); + static void panelAction(uint8_t); + static void panelProcess(uint8_t); static void SendValueToTFT(const uint16_t value, const uint16_t address); static void RequestValueFromTFT(const uint16_t address); diff --git a/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp b/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp index 142f438861b4f..80e1746a2f9f7 100644 --- a/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp +++ b/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp @@ -37,17 +37,17 @@ using namespace Anycubic; namespace ExtUI { - void onStartup() { Dgus.Startup(); } + void onStartup() { Dgus.startup(); } - void onIdle() { Dgus.IdleLoop(); } + void onIdle() { Dgus.idleLoop(); } void onPrinterKilled(FSTR_P const error, FSTR_P const component) { - Dgus.PrinterKilled(error, component); + Dgus.printerKilled(error, component); } - void onMediaInserted() { Dgus.MediaEvent(AC_media_inserted); } - void onMediaError() { Dgus.MediaEvent(AC_media_error); } - void onMediaRemoved() { Dgus.MediaEvent(AC_media_removed); } + void onMediaInserted() { Dgus.mediaEvent(AC_media_inserted); } + void onMediaError() { Dgus.mediaEvent(AC_media_error); } + void onMediaRemoved() { Dgus.mediaEvent(AC_media_removed); } void onPlayTone(const uint16_t frequency, const uint16_t duration) { #if ENABLED(SPEAKER) @@ -55,15 +55,15 @@ namespace ExtUI { #endif } - void onPrintTimerStarted() { Dgus.TimerEvent(AC_timer_started); } - void onPrintTimerPaused() { Dgus.TimerEvent(AC_timer_paused); } - void onPrintTimerStopped() { Dgus.TimerEvent(AC_timer_stopped); } + void onPrintTimerStarted() { Dgus.timerEvent(AC_timer_started); } + void onPrintTimerPaused() { Dgus.timerEvent(AC_timer_paused); } + void onPrintTimerStopped() { Dgus.timerEvent(AC_timer_stopped); } void onPrintDone() {} - void onFilamentRunout(const extruder_t) { Dgus.FilamentRunout(); } + void onFilamentRunout(const extruder_t) { Dgus.filamentRunout(); } - void onUserConfirmRequired(const char * const msg) { Dgus.ConfirmationRequest(msg); } - void onStatusChanged(const char * const msg) { Dgus.StatusChange(msg); } + void onUserConfirmRequired(const char * const msg) { Dgus.confirmationRequest(msg); } + void onStatusChanged(const char * const msg) { Dgus.statusChange(msg); } void onHomingStart() { Dgus.HomingStart(); } void onHomingDone() { Dgus.HomingComplete(); } @@ -129,7 +129,7 @@ namespace ExtUI { // Called when power-loss state is detected void onPowerLoss() { /* handled internally */ } // Called on resume from power-loss - void onPowerLossResume() { Dgus.PowerLossRecovery(); } + void onPowerLossResume() { Dgus.powerLossRecovery(); } #endif #if HAS_PID_HEATING diff --git a/Marlin/src/lcd/extui/dgus/DGUSDisplay.cpp b/Marlin/src/lcd/extui/dgus/DGUSDisplay.cpp index 2a7d635c6d780..876a88891875b 100644 --- a/Marlin/src/lcd/extui/dgus/DGUSDisplay.cpp +++ b/Marlin/src/lcd/extui/dgus/DGUSDisplay.cpp @@ -220,7 +220,7 @@ void DGUSDisplay::ProcessRx() { } } -size_t DGUSDisplay::GetFreeTxBuffer() { return SERIAL_GET_TX_BUFFER_FREE(); } +size_t DGUSDisplay::GetFreeTxBuffer() { return LCD_SERIAL_TX_BUFFER_FREE(); } void DGUSDisplay::WriteHeader(uint16_t adr, uint8_t cmd, uint8_t payloadlen) { LCD_SERIAL.write(DGUS_HEADER1); diff --git a/Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.cpp index bdfea5d147207..aa83ee2a4ee28 100644 --- a/Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.cpp @@ -157,7 +157,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { } #endif char axiscode; - uint16_t speed = manual_feedrate_mm_m[X_AXIS]; // Default feedrate for manual moves + uint16_t speed = manual_feedrate_mm_m.x; // Default feedrate for manual moves switch (var.VP) { default: return; @@ -172,7 +172,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { #if HAS_Y_AXIS case VP_MOVE_Y: axiscode = 'Y'; - speed = manual_feedrate_mm_m[Y_AXIS]; + speed = manual_feedrate_mm_m.y; if (!ExtUI::canMove(ExtUI::axis_t::Y)) goto cannotmove; break; #endif @@ -180,7 +180,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { #if HAS_Z_AXIS case VP_MOVE_Z: axiscode = 'Z'; - speed = manual_feedrate_mm_m[Z_AXIS]; + speed = manual_feedrate_mm_m.z; if (!ExtUI::canMove(ExtUI::axis_t::Z)) goto cannotmove; break; #endif diff --git a/Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.cpp index e37718e0a7428..d0119d494f4be 100644 --- a/Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.cpp @@ -157,7 +157,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { } #endif char axiscode; - uint16_t speed = manual_feedrate_mm_m[X_AXIS]; // Default feedrate for manual moves + uint16_t speed = manual_feedrate_mm_m.x; // Default feedrate for manual moves switch (var.VP) { default: return; @@ -172,7 +172,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { #if HAS_Y_AXIS case VP_MOVE_Y: axiscode = 'Y'; - speed = manual_feedrate_mm_m[Y_AXIS]; + speed = manual_feedrate_mm_m.y; if (!ExtUI::canMove(ExtUI::axis_t::Y)) goto cannotmove; break; #endif @@ -180,7 +180,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { #if HAS_Z_AXIS case VP_MOVE_Z: axiscode = 'Z'; - speed = manual_feedrate_mm_m[Z_AXIS]; + speed = manual_feedrate_mm_m.z; if (!ExtUI::canMove(ExtUI::axis_t::Z)) goto cannotmove; break; #endif diff --git a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp index f882ba33d0141..ad89a715c3626 100644 --- a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp @@ -739,7 +739,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { return; char axiscode; - uint16_t speed = manual_feedrate_mm_m[X_AXIS]; // Default feedrate for manual moves + uint16_t speed = manual_feedrate_mm_m.x; // Default feedrate for manual moves switch (var.VP) { // switch X Y Z or Home default: return; @@ -753,7 +753,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { #if HAS_Y_AXIS case VP_MOVE_Y: axiscode = 'Y'; - speed = manual_feedrate_mm_m[Y_AXIS]; + speed = manual_feedrate_mm_m.y; if (!ExtUI::canMove(ExtUI::axis_t::Y)) goto cannotmove; break; #endif @@ -761,7 +761,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { #if HAS_Z_AXIS case VP_MOVE_Z: axiscode = 'Z'; - speed = manual_feedrate_mm_m[Z_AXIS]; + speed = manual_feedrate_mm_m.z; if (!ExtUI::canMove(ExtUI::axis_t::Z)) goto cannotmove; break; #endif diff --git a/Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.cpp index c274d7b431e39..44f4a95cad2ac 100644 --- a/Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.cpp @@ -157,7 +157,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { } #endif char axiscode; - uint16_t speed = manual_feedrate_mm_m[X_AXIS]; // Default feedrate for manual moves + uint16_t speed = manual_feedrate_mm_m.x; // Default feedrate for manual moves switch (var.VP) { default: return; @@ -172,7 +172,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { #if HAS_Y_AXIS case VP_MOVE_Y: axiscode = 'Y'; - speed = manual_feedrate_mm_m[Y_AXIS]; + speed = manual_feedrate_mm_m.y; if (!ExtUI::canMove(ExtUI::axis_t::Y)) goto cannotmove; break; #endif @@ -180,7 +180,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { #if HAS_Z_AXIS case VP_MOVE_Z: axiscode = 'Z'; - speed = manual_feedrate_mm_m[Z_AXIS]; + speed = manual_feedrate_mm_m.z; if (!ExtUI::canMove(ExtUI::axis_t::Z)) goto cannotmove; break; #endif diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp index 40f3bbf1d513a..97ae7638c9414 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp @@ -111,7 +111,7 @@ void DGUSRxHandler::ScreenChange(DGUS_VP &vp, void *data_ptr) { dgus_screen_handler.TriggerFullUpdate(); } - void DGUSRxHandler::SelectFile(DGUS_VP &vp, void *data_ptr) { + void DGUSRxHandler::selectFile(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); const uint8_t index = ((uint8_t*)data_ptr)[1]; diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.h b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.h index d6d5855b9d8b2..b81b142d8411d 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.h @@ -30,7 +30,7 @@ namespace DGUSRxHandler { #if HAS_MEDIA void Scroll(DGUS_VP &, void *); - void SelectFile(DGUS_VP &, void *); + void selectFile(DGUS_VP &, void *); void PrintFile(DGUS_VP &, void *); #endif diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp index e8c23b3226a27..6a430e74a6d0f 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp @@ -148,7 +148,7 @@ void DGUSScreenHandler::Loop() { dgus_display.Loop(); } -void DGUSScreenHandler::PrinterKilled(FSTR_P const error, FSTR_P const component) { +void DGUSScreenHandler::printerKilled(FSTR_P const error, FSTR_P const component) { SetMessageLine(error, 1); SetMessageLine(component, 2); SetMessageLinePGM(NUL_STR, 3); @@ -271,7 +271,7 @@ void DGUSScreenHandler::PrintTimerStopped() { TriggerScreenChange(DGUS_Screen::PRINT_FINISHED); } -void DGUSScreenHandler::FilamentRunout(const ExtUI::extruder_t extruder) { +void DGUSScreenHandler::filamentRunout(const ExtUI::extruder_t extruder) { char buffer[21]; snprintf_P(buffer, sizeof(buffer), GET_TEXT(DGUS_MSG_FILAMENT_RUNOUT), extruder); diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h index 0f71ebdc3d46f..2ecf7192fe41b 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h @@ -37,7 +37,7 @@ class DGUSScreenHandler { static void Ready(); static void Loop(); - static void PrinterKilled(FSTR_P const error, FSTR_P const component); + static void printerKilled(FSTR_P const error, FSTR_P const component); static void UserConfirmRequired(const char * const msg); static void SettingsReset(); static void StoreSettings(char *buff); @@ -50,7 +50,7 @@ class DGUSScreenHandler { static void PrintTimerStarted(); static void PrintTimerPaused(); static void PrintTimerStopped(); - static void FilamentRunout(const ExtUI::extruder_t extruder); + static void filamentRunout(const ExtUI::extruder_t extruder); #if HAS_MEDIA /// Marlin informed us that a new SD has been inserted. diff --git a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.cpp b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.cpp index cd5408e190a39..69f792c45d1bb 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.cpp @@ -81,7 +81,7 @@ const struct DGUS_VP vp_list[] PROGMEM = { VP_HELPER_RX(DGUS_Addr::SCREENCHANGE_Printing, &DGUSRxHandler::ScreenChange), #if HAS_MEDIA - VP_HELPER_RX(DGUS_Addr::SD_SelectFile, &DGUSRxHandler::SelectFile), + VP_HELPER_RX(DGUS_Addr::SD_SelectFile, &DGUSRxHandler::selectFile), VP_HELPER_RX(DGUS_Addr::SD_Scroll, &DGUSRxHandler::Scroll), VP_HELPER_RX_NODATA(DGUS_Addr::SD_Print, &DGUSRxHandler::PrintFile), #endif diff --git a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp index 75ef5f5d6627a..73dead1b56f6d 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp @@ -47,7 +47,7 @@ namespace ExtUI { } void onPrinterKilled(FSTR_P const error, FSTR_P const component) { - dgus_screen_handler.PrinterKilled(error, component); + dgus_screen_handler.printerKilled(error, component); } void onMediaInserted() { TERN_(HAS_MEDIA, dgus_screen_handler.SDCardInserted()); } @@ -71,7 +71,7 @@ namespace ExtUI { } void onFilamentRunout(const extruder_t extruder) { - dgus_screen_handler.FilamentRunout(extruder); + dgus_screen_handler.filamentRunout(extruder); } void onUserConfirmRequired(const char * const msg) { diff --git a/Marlin/src/lcd/extui/ia_creality/FileNavigator.cpp b/Marlin/src/lcd/extui/ia_creality/FileNavigator.cpp index 6aa9b7c7c8885..f16bdde29aae8 100644 --- a/Marlin/src/lcd/extui/ia_creality/FileNavigator.cpp +++ b/Marlin/src/lcd/extui/ia_creality/FileNavigator.cpp @@ -33,23 +33,23 @@ #if DGUS_LCD_UI_IA_CREALITY -#include "ia_creality_extui.h" +#include "ia_creality_rts.h" #include "FileNavigator.h" -using namespace ExtUI; +#include -FileList FileNavigator::filelist; // Instance of the Marlin file API -char FileNavigator::currentfoldername[MAX_PATH_LEN]; // Current folder path +ExtUI::FileList FileNavigator::filelist; // ExtUI file API +char FileNavigator::currentDirPath[MAX_PATH_LEN]; // Current folder path uint16_t FileNavigator::lastindex; uint8_t FileNavigator::folderdepth; -uint16_t FileNavigator::currentindex; // override the panel request +uint16_t FileNavigator::currentindex; // override the panel request FileNavigator filenavigator; FileNavigator::FileNavigator() { reset(); } void FileNavigator::reset() { - currentfoldername[0] = '\0'; + currentDirPath[0] = '\0'; folderdepth = 0; currentindex = 0; lastindex = 0; @@ -136,7 +136,7 @@ void FileNavigator::getFiles(uint16_t index) { rts.sendData((uint8_t)0, FilenameIcon + (fcnt+1)); rts.sendData((unsigned long)0xFFFF, (FilenameNature + ((1+fcnt) * 16))); // white } - SERIAL_ECHOLNPGM("-", seek, " '", filelist.filename(), "' '", currentfoldername, "", filelist.shortFilename(), "'\n"); + SERIAL_ECHOLNPGM("-", seek, " '", filelist.filename(), "' '", currentDirPath, "", filelist.shortFilename(), "'\n"); fcnt++; } } @@ -144,8 +144,8 @@ void FileNavigator::getFiles(uint16_t index) { void FileNavigator::changeDIR(char *folder) { if (folderdepth >= MAX_FOLDER_DEPTH) return; // limit the folder depth - strcat(currentfoldername, folder); - strcat(currentfoldername, "/"); + strcat(currentDirPath, folder); + strcat(currentDirPath, "/"); filelist.changeDir(folder); refresh(); folderdepth++; @@ -159,17 +159,17 @@ void FileNavigator::upDIR() { currentindex = 0; // Remove the last child folder from the stored path if (folderdepth == 0) { - currentfoldername[0] = '\0'; + currentDirPath[0] = '\0'; reset(); } else { char *pos = nullptr; for (uint8_t f = 0; f < folderdepth; f++) - pos = strchr(currentfoldername, '/'); + pos = strchr(currentDirPath, '/'); pos[1] = '\0'; } } -char* FileNavigator::getCurrentFolderName() { return currentfoldername; } +char* FileNavigator::getCurrentDirPath() { return currentDirPath; } #endif // DGUS_LCD_UI_IA_CREALITY diff --git a/Marlin/src/lcd/extui/ia_creality/FileNavigator.h b/Marlin/src/lcd/extui/ia_creality/FileNavigator.h index 28d97c67469d3..af98210a9f69e 100644 --- a/Marlin/src/lcd/extui/ia_creality/FileNavigator.h +++ b/Marlin/src/lcd/extui/ia_creality/FileNavigator.h @@ -30,13 +30,12 @@ * Written by Insanity Automation * ***************************************/ +#include "../ui_api.h" + #define MAX_FOLDER_DEPTH 4 // Limit folder depth TFT has a limit for the file path -#define MAX_CMND_LEN 16 * MAX_FOLDER_DEPTH // Maximum Length for a Panel command #define MAX_PATH_LEN 16 * MAX_FOLDER_DEPTH // Maximum number of characters in a SD file path #define DISPLAY_FILES 4 -using namespace ExtUI; - class FileNavigator { public: FileNavigator(); @@ -45,15 +44,15 @@ class FileNavigator { static void upDIR(); static void changeDIR(char *); static void refresh(); - static char* getCurrentFolderName(); + static char* getCurrentDirPath(); static uint8_t folderdepth; static uint16_t currentindex; static bool getIndexisDir(uint16_t); const char *getIndexName(uint16_t); static uint16_t maxFiles(); private: - static FileList filelist; - static char currentfoldername[MAX_PATH_LEN]; + static ExtUI::FileList filelist; + static char currentDirPath[MAX_PATH_LEN]; static uint16_t lastindex; }; diff --git a/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp b/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp index 51180206db36e..4bfdfc6ec3c90 100644 --- a/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp +++ b/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp @@ -25,7 +25,7 @@ * **************************************** * Extensible_UI implementation for Creality DWIN * 10SPro, Max, CRX, and others - * Based original Creality release, ported to ExtUI for Marlin 2.0 + * Based original Creality release, ported to Marlin ExtUI * Written by Insanity Automation, sponsored by Tiny Machines 3D * * ***************************************/ @@ -34,2060 +34,369 @@ #if DGUS_LCD_UI_IA_CREALITY -#include "ia_creality_extui.h" +#include "ia_creality_rts.h" #include "FileNavigator.h" +#include "../ui_api.h" -// Singleton instance -RTS rts; - -// Static data -DB RTS::recdat, RTS::snddat; -uint8_t RTS::databuf[DATA_BUF_SIZE]; -rx_datagram_state_t RTS::rx_datagram_state = DGUS_IDLE; -uint8_t RTS::rx_datagram_len = 0; - -// Local data -uint16_t fileIndex = 0; -uint8_t recordcount = 0; -uint8_t waitway_lock = 0; -const float manual_feedrate_mm_m[] = MANUAL_FEEDRATE; -uint8_t startprogress = 0; - -char waitway = 0; -int16_t recnum = 0; -float ChangeMaterialbuf[2] = { 0 }; - -char NozzleTempStatus[3] = { 0 }; - -char PrinterStatusKey[2] = { 0 }; // PrinterStatusKey[1] 0:keep temperature, 1:heating, 2:cooling, 3:printing - // PrinterStatusKey[0] 0:ready - -uint8_t AxisPagenum = 0; // 0 for 10mm, 1 for 1mm, 2 for 0.1mm -bool InforShowStatus = true; -bool TPShowStatus = false; // true for only opening time and percentage, false for closing time and percentage. -bool AutohomeKey = false; -uint8_t AutoHomeIconNum; -int16_t userConfValidation = 0; - -uint8_t lastPauseMsgState = 0; - -creality_dwin_settings_t Settings; -uint8_t dwin_settings_version = 1; - -bool reEntryPrevent = false; -uint8_t reEntryCount = 0; -uint16_t idleThrottling = 0; - -bool pause_resume_selected = false; - -#if HAS_PID_HEATING - uint16_t pid_hotendAutoTemp = 150; - uint16_t pid_bedAutoTemp = 70; -#endif - -#ifndef IA_CREALITY_BOOT_DELAY - #define IA_CREALITY_BOOT_DELAY 500 -#endif - -void RTS::onStartup() { - DWIN_SERIAL.begin(115200); - recdat.head[0] = snddat.head[0] = FHONE; - recdat.head[1] = snddat.head[1] = FHTWO; - ZERO(databuf); - - delay_ms(IA_CREALITY_BOOT_DELAY); // Delay to allow screen startup - setTouchScreenConfiguration(); - sendData(StartSoundSet, SoundAddr); - delay_ms(400); // Delay to allow screen to configure - - onStatusChanged(MACHINE_NAME " Ready"); - - sendData(100, FeedrateDisplay); - - /***************turn off motor*****************/ - sendData(11, FilenameIcon); - - /***************transmit temperature to screen*****************/ - sendData(0, NozzlePreheat); - sendData(0, BedPreheat); - sendData(getActualTemp_celsius(H0), NozzleTemp); - sendData(TERN0(HAS_MULTI_HOTEND, getActualTemp_celsius(H1)), e2Temp); - sendData(getActualTemp_celsius(BED), Bedtemp); - /***************transmit Fan speed to screen*****************/ - sendData(getActualFan_percent((fan_t)getActiveTool()), FanKeyIcon); - - /***************transmit Printer information to screen*****************/ - for (int16_t j = 0; j < 20; j++) // clean filename - sendData(0, MacVersion + j); - char sizebuf[20] = {0}; - sprintf(sizebuf, "%d X %d X %d", Y_BED_SIZE, X_BED_SIZE, Z_MAX_POS); - sendData(MACHINE_NAME, MacVersion); - sendData(SHORT_BUILD_VERSION, SoftVersion); - sendData(sizebuf, PrinterSize); - sendData(WEBSITE_URL, CorpWebsite); - - /**************************some info init*******************************/ - sendData(0, PrintscheduleIcon); - sendData(0, PrintscheduleIcon + 1); - - /************************clean screen*******************************/ - for (int16_t i = 0; i < MaxFileNumber; i++) - for (int16_t j = 0; j < 10; j++) sendData(0, SDFILE_ADDR + i * 10 + j); - - for (int16_t j = 0; j < 10; j++) { - sendData(0, Printfilename + j); // clean screen. - sendData(0, Choosefilename + j); // clean filename - } - for (int16_t j = 0; j < 8; j++) sendData(0, FilenameCount + j); - for (int16_t j = 1; j <= MaxFileNumber; j++) { - sendData(10, FilenameIcon + j); - sendData(10, FilenameIcon1 + j); - } -} - -void RTS::onIdle() { - while (rts.receiveData() > 0 && (rts.recdat.data[0] != 0 || rts.recdat.addr != 0)) - rts.handleData(); - - if (reEntryPrevent && reEntryCount < 120) { reEntryCount++; return; } - reEntryCount = 0; - - if (idleThrottling++ < 750) return; - - // Always send temperature data - rts.sendData(getActualTemp_celsius(getActiveTool()), NozzleTemp); - rts.sendData(getActualTemp_celsius(BED), Bedtemp); - rts.sendData(getTargetTemp_celsius(getActiveTool()), NozzlePreheat); - rts.sendData(getTargetTemp_celsius(BED), BedPreheat); - rts.sendData(TERN0(HAS_MULTI_HOTEND, getActualTemp_celsius(H1)), e2Temp); - rts.sendData(TERN0(HAS_MULTI_HOTEND, getTargetTemp_celsius(H1)), e2Preheat); - TERN_(HAS_MULTI_HOTEND, rts.sendData(uint8_t(getActiveTool() + 1), ActiveToolVP)); - - if (awaitingUserConfirm() && (lastPauseMsgState != ExtUI::pauseModeStatus || userConfValidation > 99)) { - switch (ExtUI::pauseModeStatus) { - case PAUSE_MESSAGE_PARKING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_PAUSE_PRINT_PARKING)); break; - case PAUSE_MESSAGE_CHANGING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_INIT)); break; - case PAUSE_MESSAGE_UNLOAD: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_UNLOAD)); break; - case PAUSE_MESSAGE_WAITING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_ADVANCED_PAUSE_WAITING)); break; - case PAUSE_MESSAGE_INSERT: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_INSERT)); break; - case PAUSE_MESSAGE_LOAD: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD)); break; - case PAUSE_MESSAGE_PURGE: ExtUI::onUserConfirmRequired(GET_TEXT_F(TERN(ADVANCED_PAUSE_CONTINUOUS_PURGE, MSG_FILAMENT_CHANGE_CONT_PURGE, MSG_FILAMENT_CHANGE_PURGE))); break; - case PAUSE_MESSAGE_RESUME: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_RESUME)); break; - case PAUSE_MESSAGE_HEAT: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEAT)); break; - case PAUSE_MESSAGE_HEATING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEATING)); break; - case PAUSE_MESSAGE_OPTION: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_OPTION_HEADER)); break; - case PAUSE_MESSAGE_STATUS: break; - default: onUserConfirmRequired(PSTR("Confirm Continue")); break; - } - userConfValidation = 0; - } - else if (pause_resume_selected && !awaitingUserConfirm()) { - rts.sendData(ExchangePageBase + 53, ExchangepageAddr); - pause_resume_selected = false; - userConfValidation = 0; - } - else if (awaitingUserConfirm()) { - if (pause_resume_selected) { - pause_resume_selected = false; - userConfValidation = 100; - } - else - userConfValidation++; - } - - reEntryPrevent = true; - idleThrottling = 0; - if (waitway && !commandsInQueue()) - waitway_lock++; - else - waitway_lock = 0; - - if (waitway_lock > 100) { - waitway_lock = 0; - waitway = 0; // clear waitway if nothing is going on - } - - switch (waitway) { - case 1: - if (isPositionKnown()) { - InforShowStatus = true; - rts.sendData(ExchangePageBase + 54, ExchangepageAddr); - waitway = 0; - } - break; - - case 2: - if (isPositionKnown() && !commandsInQueue()) waitway = 0; - break; - - case 3: - //if(isPositionKnown() && (getActualTemp_celsius(BED) >= (getTargetTemp_celsius(BED)-1))) { - rts.sendData(ExchangePageBase + 64, ExchangepageAddr); - waitway = 7; - //return; - //} - break; - - case 4: - if (AutohomeKey && isPositionKnown() && !commandsInQueue()) { // Manual Move Home Done - //rts.sendData(ExchangePageBase + 71 + AxisPagenum, ExchangepageAddr); - AutohomeKey = false; - waitway = 0; - } - break; - case 5: - if (isPositionKnown() && !commandsInQueue()) { - InforShowStatus = true; - waitway = 0; - rts.sendData(ExchangePageBase + 78, ExchangepageAddr); // exchange to 78 page - } - break; - case 6: - if (!commandsInQueue()) { - setAxisPosition_mm(BED_TRAMMING_HEIGHT, axis_t(Z)); - waitway = 0; - } - break; - case 7: - if (!commandsInQueue()) waitway = 0; - break; - } - - TERN_(HAS_MESH, rts.sendData(getLevelingActive() ? 3 : 2, AutoLevelIcon)); - TERN_(HAS_FILAMENT_SENSOR, rts.sendData(getFilamentRunoutEnabled() ? 3 : 2, RunoutToggle)); - TERN_(CASE_LIGHT_ENABLE, rts.sendData(getCaseLightState() ? 3 : 2, LedToggle)); - TERN_(POWER_LOSS_RECOVERY, rts.sendData(getPowerLossRecoveryEnabled() ? 3 : 2, PowerLossToggle)); - - if (startprogress == 0) { - startprogress += 25; - delay_ms(3000); // Delay to show bootscreen - } - else if (startprogress < 250) { - if (isMediaInserted()) // Re init media as it happens too early on STM32 boards often - onMediaInserted(); - else - injectCommands(F("M22\nM21")); - startprogress = 254; - InforShowStatus = true; - TPShowStatus = false; - rts.sendData(ExchangePageBase + 45, ExchangepageAddr); - reEntryPrevent = false; - return; - } - if (startprogress <= 100) - rts.sendData(startprogress, StartIcon); - else - rts.sendData(startprogress - 100, StartIcon + 1); - - //rts.sendData((startprogress++) % 5, ExchFlmntIcon); - - if (isPrinting()) { - rts.sendData(getActualFan_percent((fan_t)getActiveTool()), FanKeyIcon); - rts.sendData(getProgress_seconds_elapsed() / 3600, Timehour); - rts.sendData((getProgress_seconds_elapsed() % 3600) / 60, Timemin); - if (getProgress_percent() > 0) { - const uint16_t perc = getProgress_percent() + 1; - if (perc <= 50) { - rts.sendData(uint16_t(perc) * 2, PrintscheduleIcon); - rts.sendData(0, PrintscheduleIcon + 1); - } - else { - rts.sendData(100, PrintscheduleIcon); - rts.sendData(uint16_t(perc) * 2 - 100, PrintscheduleIcon + 1); - } - } - else { - rts.sendData(0, PrintscheduleIcon); - rts.sendData(0, PrintscheduleIcon + 1); - } - rts.sendData(uint16_t(getProgress_percent()), Percentage); - } - else { // Not printing settings - rts.sendData(map(constrain(Settings.display_volume, 0, 255), 0, 255, 0, 100), VolumeDisplay); - rts.sendData(Settings.screen_brightness, DisplayBrightness); - rts.sendData(Settings.standby_screen_brightness, DisplayStandbyBrightness); - rts.sendData(Settings.standby_time_seconds, DisplayStandbySeconds); - if (Settings.display_standby) - rts.sendData(3, DisplayStandbyEnableIndicator); - else - rts.sendData(2, DisplayStandbyEnableIndicator); - - rts.sendData(getAxisSteps_per_mm(X) * 10, StepMM_X); - rts.sendData(getAxisSteps_per_mm(Y) * 10, StepMM_Y); - rts.sendData(getAxisSteps_per_mm(Z) * 10, StepMM_Z); - rts.sendData(getAxisSteps_per_mm(E0) * 10, StepMM_E); - - rts.sendData(getAxisMaxAcceleration_mm_s2(X) / 100, Accel_X); - rts.sendData(getAxisMaxAcceleration_mm_s2(Y) / 100, Accel_Y); - rts.sendData(getAxisMaxAcceleration_mm_s2(Z) / 10, Accel_Z); - rts.sendData(getAxisMaxAcceleration_mm_s2(E0), Accel_E); - - rts.sendData(getAxisMaxFeedrate_mm_s(X), Feed_X); - rts.sendData(getAxisMaxFeedrate_mm_s(Y), Feed_Y); - rts.sendData(getAxisMaxFeedrate_mm_s(Z), Feed_Z); - rts.sendData(getAxisMaxFeedrate_mm_s(E0), Feed_E); - - rts.sendData(getAxisMaxJerk_mm_s(X) * 100, Jerk_X); - rts.sendData(getAxisMaxJerk_mm_s(Y) * 100, Jerk_Y); - rts.sendData(getAxisMaxJerk_mm_s(Z) * 100, Jerk_Z); - rts.sendData(getAxisMaxJerk_mm_s(E0) * 100, Jerk_E); - - #if HAS_HOTEND_OFFSET - rts.sendData(getNozzleOffset_mm(X, E1) * 10, T2Offset_X); - rts.sendData(getNozzleOffset_mm(Y, E1) * 10, T2Offset_Y); - rts.sendData(getNozzleOffset_mm(Z, E1) * 10, T2Offset_Z); - rts.sendData(getAxisSteps_per_mm(E1) * 10, T2StepMM_E); - #endif - - #if HAS_BED_PROBE - rts.sendData(getProbeOffset_mm(X) * 100, ProbeOffset_X); - rts.sendData(getProbeOffset_mm(Y) * 100, ProbeOffset_Y); - #endif - - #if HAS_PID_HEATING - rts.sendData(pid_hotendAutoTemp, HotendPID_AutoTmp); - rts.sendData(pid_bedAutoTemp, BedPID_AutoTmp); - rts.sendData(getPID_Kp(E0) * 10, HotendPID_P); - rts.sendData(getPID_Ki(E0) * 10, HotendPID_I); - rts.sendData(getPID_Kd(E0) * 10, HotendPID_D); - #if ENABLED(PIDTEMPBED) - rts.sendData(getBedPID_Kp() * 10, BedPID_P); - rts.sendData(getBedPID_Ki() * 10, BedPID_I); - rts.sendData(getBedPID_Kd() * 10, BedPID_D); - #endif - #endif - } - - rts.sendData(getZOffset_mm() * 100, ProbeOffset_Z); - rts.sendData(uint16_t(getFlow_percent(E0)), Flowrate); - - if (NozzleTempStatus[0] || NozzleTempStatus[2]) { // statuse of loadfilament and unloadfinement when temperature is less than - uint16_t IconTemp = getActualTemp_celsius(getActiveTool()) * 100 / getTargetTemp_celsius(getActiveTool()); - NOMORE(IconTemp, 100U); - rts.sendData(IconTemp, HeatPercentIcon); - if (getActualTemp_celsius(getActiveTool()) > EXTRUDE_MINTEMP && NozzleTempStatus[0] != 0) { - NozzleTempStatus[0] = 0; - rts.sendData(10 * ChangeMaterialbuf[0], FilamentUnit1); - rts.sendData(10 * ChangeMaterialbuf[1], FilamentUnit2); - rts.sendData(ExchangePageBase + 65, ExchangepageAddr); - } - else if (getActualTemp_celsius(getActiveTool()) >= getTargetTemp_celsius(getActiveTool()) && NozzleTempStatus[2]) { - NozzleTempStatus[2] = 0; - TPShowStatus = true; - rts.sendData(4, ExchFlmntIcon); - rts.sendData(ExchangePageBase + 83, ExchangepageAddr); - } - else if (NozzleTempStatus[2]) { - //rts.sendData((startprogress++) % 5, ExchFlmntIcon); - } - } - - if (AutohomeKey) { - rts.sendData(AutoHomeIconNum, AutoZeroIcon); - if (++AutoHomeIconNum > 9) AutoHomeIconNum = 0; - } - - if (isMediaInserted()) { - const uint16_t currPage = fileIndex == 0 ? 1 : CEIL(float(fileIndex) / float(DISPLAY_FILES)) + 1, - maxPageAdd = filenavigator.folderdepth ? 1 : 0, - maxPages = CEIL(float(filenavigator.maxFiles() + maxPageAdd) / float(DISPLAY_FILES) ); - - rts.sendData(currPage, FilesCurentPage); - rts.sendData(maxPages, FilesMaxPage); - } - else { - rts.sendData(0, FilesCurentPage); - rts.sendData(0, FilesMaxPage); - } - - if (rts.recdat.addr != DisplayZaxis && rts.recdat.addr != DisplayYaxis && rts.recdat.addr != DisplayZaxis) { - rts.sendData(10 * getAxisPosition_mm(axis_t(X)), DisplayXaxis); - rts.sendData(10 * getAxisPosition_mm(axis_t(Y)), DisplayYaxis); - rts.sendData(10 * getAxisPosition_mm(axis_t(Z)), DisplayZaxis); - } - reEntryPrevent = false; -} - -RTS::RTS() { - recdat.head[0] = snddat.head[0] = FHONE; - recdat.head[1] = snddat.head[1] = FHTWO; - ZERO(databuf); -} - -int16_t RTS::receiveData() { - uint8_t receivedbyte; - while (DWIN_SERIAL.available()) - switch (rx_datagram_state) { - - case DGUS_IDLE: // Waiting for the first header byte - receivedbyte = DWIN_SERIAL.read(); - if (FHONE == receivedbyte) rx_datagram_state = DGUS_HEADER1_SEEN; - break; - - case DGUS_HEADER1_SEEN: // Waiting for the second header byte - receivedbyte = DWIN_SERIAL.read(); - rx_datagram_state = (FHTWO == receivedbyte) ? DGUS_HEADER2_SEEN : DGUS_IDLE; - break; - - case DGUS_HEADER2_SEEN: // Waiting for the length byte - rx_datagram_len = DWIN_SERIAL.read(); - //DEBUGLCDCOMM_ECHOPGM(" (", rx_datagram_len, ") "); - - // Telegram min len is 3 (command and one word of payload) - rx_datagram_state = WITHIN(rx_datagram_len, 3, DGUS_RX_BUFFER_SIZE) ? DGUS_WAIT_TELEGRAM : DGUS_IDLE; - break; - - case DGUS_WAIT_TELEGRAM: // wait for complete datagram to arrive. - if (DWIN_SERIAL.available() < rx_datagram_len) return -1; - - uint8_t command = DWIN_SERIAL.read(); - - //DEBUGLCDCOMM_ECHOPGM("# ", command); - - uint8_t readlen = rx_datagram_len - 1; // command is part of len. - uint8_t tmp[rx_datagram_len - 1]; - uint8_t *ptmp = tmp; - while (readlen--) { - receivedbyte = DWIN_SERIAL.read(); - //DEBUGLCDCOMM_ECHOPGM(" ", receivedbyte); - *ptmp++ = receivedbyte; - } - //DEBUGLCDCOMM_ECHOPGM(" # "); - // mostly we'll get this: 5A A5 03 82 4F 4B -- ACK on 0x82, so discard it. - if (command == VarAddr_W && 'O' == tmp[0] && 'K' == tmp[1]) { - rx_datagram_state = DGUS_IDLE; - break; - } - - /* AutoUpload, (and answer to) Command 0x83 : - | tmp[0 1 2 3 4 ... ] - | Example 5A A5 06 83 20 01 01 78 01 …… - | / / | | \ / | \ \ - | Header | | | | \_____\_ DATA (Words!) - | DatagramLen / VPAdr | - | Command DataLen (in Words) */ - if (command == VarAddr_R) { - const uint16_t vp = tmp[0] << 8 | tmp[1]; - - const uint8_t dlen = tmp[2] << 1; // Convert to Bytes. (Display works with words) - recdat.addr = vp; - recdat.len = tmp[2]; - for (uint16_t i = 0; i < dlen; i += 2) { - recdat.data[i / 2] = tmp[3 + i]; - recdat.data[i / 2] = (recdat.data[i / 2] << 8 ) | tmp[4 + i]; - } - - rx_datagram_state = DGUS_IDLE; - return 2; - break; - } - - // discard anything else - rx_datagram_state = DGUS_IDLE; - } - return -1; -} - -void RTS::sendData() { - if (snddat.head[0] == FHONE && snddat.head[1] == FHTWO && snddat.len >= 3) { - databuf[0] = snddat.head[0]; - databuf[1] = snddat.head[1]; - databuf[2] = snddat.len; - databuf[3] = snddat.command; - if (snddat.command == 0x80) { // to write data to the register - databuf[4] = snddat.addr; - for (int16_t i = 0; i < (snddat.len - 2); i++) databuf[5 + i] = snddat.data[i]; - } - else if (snddat.len == 3 && (snddat.command == 0x81)) { // to read data from the register - databuf[4] = snddat.addr; - databuf[5] = snddat.bytelen; - } - else if (snddat.command == 0x82) { // to write data to the variate - databuf[4] = snddat.addr >> 8; - databuf[5] = snddat.addr & 0xFF; - for (int16_t i = 0; i < (snddat.len - 3); i += 2) { - databuf[6 + i] = snddat.data[i / 2] >> 8; - databuf[7 + i] = snddat.data[i / 2] & 0xFF; - } - } - else if (snddat.len == 4 && (snddat.command == 0x83)) { // to read data from the variate - databuf[4] = snddat.addr >> 8; - databuf[5] = snddat.addr & 0xFF; - databuf[6] = snddat.bytelen; - } - for (int16_t i = 0; i < (snddat.len + 3); i++) { - DWIN_SERIAL.write(databuf[i]); - delay_us(1); - } - - memset(&snddat, 0, sizeof(snddat)); - ZERO(databuf); - snddat.head[0] = FHONE; - snddat.head[1] = FHTWO; - } -} - -void RTS::sendData(const String &s, uint32_t addr, uint8_t cmd/*=VarAddr_W*/) { - if (s.length() < 1) return; - sendData(s.c_str(), addr, cmd); -} - -void RTS::sendData(const char *str, uint32_t addr, uint8_t cmd/*=VarAddr_W*/) { - int16_t len = strlen(str); - constexpr int16_t maxlen = DATA_BUF_SIZE - 6; - if (len > 0) { - if (len > maxlen) len = maxlen; - databuf[0] = FHONE; - databuf[1] = FHTWO; - databuf[2] = 3 + len; - databuf[3] = cmd; - databuf[4] = addr >> 8; - databuf[5] = addr & 0x00FF; - for (int16_t i = 0; i < len; i++) databuf[6 + i] = str[i]; - - for (int16_t i = 0; i < (len + 6); i++) { - DWIN_SERIAL.write(databuf[i]); - delay_us(1); - } - ZERO(databuf); - } -} - -void RTS::sendData(const char c, const uint32_t addr, const uint8_t cmd/*=VarAddr_W*/) { - snddat.command = cmd; - snddat.addr = addr; - snddat.data[0] = uint32_t(uint16_t(c) << 8); - snddat.len = 5; - sendData(); -} - -void RTS::sendData(const_float_t f, const uint32_t addr, const uint8_t cmd/*=VarAddr_W*/) { - int16_t n = f; - if (cmd == VarAddr_W) { - snddat.data[0] = n; - snddat.len = 5; - } - else if (cmd == RegAddr_W) { - snddat.data[0] = n; - snddat.len = 3; - } - else if (cmd == VarAddr_R) { - snddat.bytelen = n; - snddat.len = 4; - } - snddat.command = cmd; - snddat.addr = addr; - sendData(); -} - -void RTS::sendData(const int n, const uint32_t addr, const uint8_t cmd/*=VarAddr_W*/) { - if (cmd == VarAddr_W) { - if ((unsigned int)n > 0xFFFF) { - snddat.data[0] = n >> 16; - snddat.data[1] = n & 0xFFFF; - snddat.len = 7; - } - else { - snddat.data[0] = n; - snddat.len = 5; - } - } - else if (cmd == RegAddr_W) { - snddat.data[0] = n; - snddat.len = 3; - } - else if (cmd == VarAddr_R) { - snddat.bytelen = n; - snddat.len = 4; - } - snddat.command = cmd; - snddat.addr = addr; - sendData(); -} - -void RTS::sendData(const unsigned long n, uint32_t addr, uint8_t cmd/*=VarAddr_W*/) { - if (cmd == VarAddr_W) { - if (n > 0xFFFF) { - snddat.data[0] = n >> 16; - snddat.data[1] = n & 0xFFFF; - //snddat.data[0] = n >> 24; - //snddat.data[1] = n >> 16; - //snddat.data[2] = n >> 8; - //snddat.data[3] = n; - snddat.len = 7; - } - else { - snddat.data[0] = n; - snddat.len = 5; - } - } - else if (cmd == VarAddr_R) { - snddat.bytelen = n; - snddat.len = 4; - } - snddat.command = cmd; - snddat.addr = addr; - sendData(); -} - -void RTS::handleData() { - int16_t Checkkey = -1; - if (waitway > 0) { // for waiting - memset(&recdat, 0, sizeof(recdat)); - recdat.head[0] = FHONE; - recdat.head[1] = FHTWO; - return; - } - for (int16_t i = 0; Addrbuf[i] != 0; i++) - if (recdat.addr == Addrbuf[i]) { - if (Addrbuf[i] == NzBdSet || Addrbuf[i] == NozzlePreheat || Addrbuf[i] == BedPreheat || Addrbuf[i] == Flowrate) - Checkkey = ManualSetTemp; - else if (WITHIN(Addrbuf[i], Stopprint, Resumeprint)) - Checkkey = PrintChoice; - else if (WITHIN(Addrbuf[i], AutoZero, DisplayZaxis)) - Checkkey = XYZEaxis; - else if (WITHIN(Addrbuf[i], FilamentUnit1, FilamentUnit2)) - Checkkey = Filament; - else - Checkkey = i; - break; - } - - switch (recdat.addr) { - case Flowrate: - case StepMM_X ... StepMM_E: - case ProbeOffset_X ... ProbeOffset_Y: - case HotendPID_AutoTmp ... BedPID_AutoTmp: - case HotendPID_P ... HotendPID_D: - case BedPID_P ... BedPID_D: - case T2Offset_X ... T2StepMM_E: - case Accel_X ... Accel_E: - case Feed_X ... Feed_E: - case Jerk_X ... Jerk_E: - case RunoutToggle: - case PowerLossToggle: - case FanKeyIcon: - case LedToggle: - case e2Preheat: Checkkey = ManualSetTemp; break; - case ProbeOffset_Z: Checkkey = Zoffset_Value; break; - case VolumeDisplay: Checkkey = VolumeDisplay; break; - case DisplayBrightness: Checkkey = DisplayBrightness; break; - case DisplayStandbyBrightness: Checkkey = DisplayStandbyBrightness; break; - case DisplayStandbySeconds: Checkkey = DisplayStandbySeconds; break; - default: - if (WITHIN(recdat.addr, AutolevelVal, 4400)) // (int16_t(AutolevelVal) + GRID_MAX_POINTS * 2) = 4400 with 5x5 mesh - Checkkey = AutolevelVal; - else if (WITHIN(recdat.addr, SDFILE_ADDR, SDFILE_ADDR + 10 * (FileNum + 1))) - Checkkey = Filename; - break; - } - - if (Checkkey < 0) { - memset(&recdat, 0, sizeof(recdat)); - recdat.head[0] = FHONE; - recdat.head[1] = FHTWO; - return; - } - - constexpr float lfrb[4] = BED_TRAMMING_INSET_LFRB; - - switch (Checkkey) { - case Printfile: - if (recdat.data[0] == 1) { // card - InforShowStatus = false; - filenavigator.getFiles(0); - fileIndex = 0; - recordcount = 0; - sendData(ExchangePageBase + 46, ExchangepageAddr); - } - else if (recdat.data[0] == 2) { // return after printing result. - InforShowStatus = true; - TPShowStatus = false; - stopPrint(); - injectCommands(F("M84")); - sendData(11, FilenameIcon); - sendData(0, PrintscheduleIcon); - sendData(0, PrintscheduleIcon + 1); - sendData(0, Percentage); - delay_ms(2); - sendData(0, Timehour); - sendData(0, Timemin); - - sendData(ExchangePageBase + 45, ExchangepageAddr); // exchange to 45 page - } - else if (recdat.data[0] == 3) { // Temperature control - InforShowStatus = true; - TPShowStatus = false; - if (getTargetFan_percent((fan_t)getActiveTool()) == 0) - sendData(ExchangePageBase + 58, ExchangepageAddr); // exchange to 58 page, the fans off - else - sendData(ExchangePageBase + 57, ExchangepageAddr); // exchange to 57 page, the fans on - } - else if (recdat.data[0] == 4) { // Settings - InforShowStatus = false; - } - break; - - case Adjust: - if (recdat.data[0] == 1) { - InforShowStatus = false; - } - else if (recdat.data[0] == 2) { - InforShowStatus = true; - if (PrinterStatusKey[1] == 3) // during heating - sendData(ExchangePageBase + 53, ExchangepageAddr); - else if (PrinterStatusKey[1] == 4) - sendData(ExchangePageBase + 54, ExchangepageAddr); - else - sendData(ExchangePageBase + 53, ExchangepageAddr); - } - else if (recdat.data[0] == 3) - setTargetFan_percent(getTargetFan_percent((fan_t)getActiveTool()) != 0 ? 100 : 0, FAN0); - - break; - - case Feedrate: - setFeedrate_percent(recdat.data[0]); - break; - - case PrintChoice: - if (recdat.addr == Stopprint) { - if (recdat.data[0] == 240) { // no - sendData(ExchangePageBase + 53, ExchangepageAddr); - } - else { - sendData(ExchangePageBase + 45, ExchangepageAddr); - sendData(0, Timehour); - sendData(0, Timemin); - stopPrint(); - } - } - else if (recdat.addr == Pauseprint) { - if (recdat.data[0] != 0xF1) - break; - - sendData(ExchangePageBase + 54, ExchangepageAddr); - pausePrint(); - } - else if (recdat.addr == Resumeprint && recdat.data[0] == 1) { - resumePrint(); - - PrinterStatusKey[1] = 0; - InforShowStatus = true; - - sendData(ExchangePageBase + 53, ExchangepageAddr); - } - if (recdat.addr == Resumeprint && recdat.data[0] == 2) { // warming - resumePrint(); - NozzleTempStatus[2] = 1; - PrinterStatusKey[1] = 0; - InforShowStatus = true; - sendData(ExchangePageBase + 82, ExchangepageAddr); - } - break; - - case Zoffset: - float tmp_zprobe_offset; - if (recdat.data[0] >= 32768) - tmp_zprobe_offset = (float(recdat.data[0]) - 65536) / 100; - else - tmp_zprobe_offset = float(recdat.data[0]) / 100; - if (WITHIN((tmp_zprobe_offset), Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { - int16_t tmpSteps = mmToWholeSteps(getZOffset_mm() - tmp_zprobe_offset, axis_t(Z)); - if (tmpSteps == 0) tmpSteps = getZOffset_mm() < tmp_zprobe_offset ? 1 : -1; - smartAdjustAxis_steps(-tmpSteps, axis_t(Z), false); - char zOffs[20], tmp1[11]; - sprintf_P(zOffs, PSTR("Z Offset : %s"), dtostrf(getZOffset_mm(), 1, 3, tmp1)); - onStatusChanged(zOffs); - } - else { - onStatusChanged(F("Requested Offset Beyond Limits")); - } - - sendData(getZOffset_mm() * 100, ProbeOffset_Z); - break; - - case TempControl: - if (recdat.data[0] == 0) { - InforShowStatus = true; - TPShowStatus = false; - } - else if (recdat.data[0] == 1) { - if (getTargetFan_percent((fan_t)getActiveTool()) == 0) - sendData(ExchangePageBase + 60, ExchangepageAddr); // exchange to 60 page, the fans off - else - sendData(ExchangePageBase + 59, ExchangepageAddr); // exchange to 59 page, the fans on - } - else if (recdat.data[0] == 2) { - InforShowStatus = true; - } - else if (recdat.data[0] == 3) { - if (getTargetFan_percent((fan_t)getActiveTool()) == 0) { // turn on the fan - setTargetFan_percent(100, FAN0); - sendData(ExchangePageBase + 57, ExchangepageAddr); // exchange to 57 page, the fans on - } - else { // turn off the fan - setTargetFan_percent(0, FAN0); - sendData(ExchangePageBase + 58, ExchangepageAddr); // exchange to 58 page, the fans on - } - } - else if (recdat.data[0] == 5) { // PLA mode - setTargetTemp_celsius(PREHEAT_1_TEMP_HOTEND, getActiveTool()); - setTargetTemp_celsius(PREHEAT_1_TEMP_BED, BED); - sendData(PREHEAT_1_TEMP_HOTEND, NozzlePreheat); - sendData(PREHEAT_1_TEMP_BED, BedPreheat); - } - else if (recdat.data[0] == 6) { // ABS mode - setTargetTemp_celsius(PREHEAT_2_TEMP_HOTEND, getActiveTool()); - setTargetTemp_celsius(PREHEAT_2_TEMP_BED, BED); - sendData(PREHEAT_2_TEMP_HOTEND, NozzlePreheat); - sendData(PREHEAT_2_TEMP_BED, BedPreheat); - } - else if (recdat.data[0] == 0xF1) { - //InforShowStatus = true; - #if FAN_COUNT > 0 - for (uint8_t i = 0; i < FAN_COUNT; i++) setTargetFan_percent(0, (fan_t)i); - #endif - setTargetTemp_celsius(0.0, H0); - TERN_(HAS_MULTI_HOTEND, setTargetTemp_celsius(0.0, H1)); - setTargetTemp_celsius(0.0, BED); - sendData(0, NozzlePreheat); delay_ms(1); - sendData(0, BedPreheat); delay_ms(1); - sendData(ExchangePageBase + 57, ExchangepageAddr); - PrinterStatusKey[1] = 2; - } - break; - - case ManualSetTemp: - if (recdat.addr == NzBdSet) { - if (recdat.data[0] == 0) { - if (getTargetFan_percent((fan_t)getActiveTool()) == 0) - sendData(ExchangePageBase + 58, ExchangepageAddr); // exchange to 58 page, the fans off - else - sendData(ExchangePageBase + 57, ExchangepageAddr); // exchange to 57 page, the fans on - } - else if (recdat.data[0] == 1) { - setTargetTemp_celsius(0.0, getActiveTool()); - sendData(0, NozzlePreheat); - } - else if (recdat.data[0] == 2) { - setTargetTemp_celsius(0.0, BED); - sendData(0, BedPreheat); - } - } - else if (recdat.addr == NozzlePreheat) { - setTargetTemp_celsius(float(recdat.data[0]), H0); - } - #if HAS_MULTI_HOTEND - else if (recdat.addr == e2Preheat) { - setTargetTemp_celsius(float(recdat.data[0]), H1); - } - #endif - else if (recdat.addr == BedPreheat) { - setTargetTemp_celsius(float(recdat.data[0]), BED); - } - else if (recdat.addr == Flowrate) { - setFlow_percent(int16_t(recdat.data[0]), getActiveTool()); - } - - #if HAS_PID_HEATING - else if (recdat.addr == HotendPID_AutoTmp) { - pid_hotendAutoTemp = uint16_t(recdat.data[0]); - } - else if (recdat.addr == BedPID_AutoTmp) { - pid_bedAutoTemp = uint16_t(recdat.data[0]); - } - #endif - - else if (recdat.addr == Accel_X) { - setAxisMaxAcceleration_mm_s2(uint16_t(recdat.data[0]) * 100, X); - } - else if (recdat.addr == Accel_Y) { - setAxisMaxAcceleration_mm_s2(uint16_t(recdat.data[0]) * 100, Y); - } - else if (recdat.addr == Accel_Z) { - setAxisMaxAcceleration_mm_s2(uint16_t(recdat.data[0]) * 10, Z); - } - else if (recdat.addr == Accel_E) { - setAxisMaxAcceleration_mm_s2(uint16_t(recdat.data[0]), E0); - setAxisMaxAcceleration_mm_s2(uint16_t(recdat.data[0]), E1); - } - - else if (recdat.addr == Feed_X) { - setAxisMaxFeedrate_mm_s(uint16_t(recdat.data[0]), X); - } - else if (recdat.addr == Feed_Y) { - setAxisMaxFeedrate_mm_s(uint16_t(recdat.data[0]), Y); - } - else if (recdat.addr == Feed_Z) { - setAxisMaxFeedrate_mm_s(uint16_t(recdat.data[0]), Z); - } - else if (recdat.addr == Feed_E) { - setAxisMaxFeedrate_mm_s(uint16_t(recdat.data[0]), E0); - setAxisMaxFeedrate_mm_s(uint16_t(recdat.data[0]), E1); - } - else if (recdat.addr == FanKeyIcon) { - setTargetFan_percent(uint16_t(recdat.data[0]), (fan_t)getActiveTool()); - } - else { - float tmp_float_handling; - if (recdat.data[0] >= 32768) - tmp_float_handling = (float(recdat.data[0]) - 65536) / 100; - else - tmp_float_handling = float(recdat.data[0]) / 100; - if (recdat.addr == StepMM_X) { - setAxisSteps_per_mm(tmp_float_handling * 10, X); - } - else if (recdat.addr == StepMM_Y) { - setAxisSteps_per_mm(tmp_float_handling * 10, Y); - } - else if (recdat.addr == StepMM_Z) { - setAxisSteps_per_mm(tmp_float_handling * 10, Z); - } - else if (recdat.addr == StepMM_E) { - setAxisSteps_per_mm(tmp_float_handling * 10, E0); - #if DISABLED(DUAL_X_CARRIAGE) - setAxisSteps_per_mm(tmp_float_handling * 10, E1); - #endif - } - #if ENABLED(DUAL_X_CARRIAGE) - else if (recdat.addr == T2StepMM_E) { - setAxisSteps_per_mm(tmp_float_handling * 10, E1); - } - else if (recdat.addr == T2Offset_X) { - setNozzleOffset_mm(tmp_float_handling * 10, X, E1); - } - else if (recdat.addr == T2Offset_Y) { - setNozzleOffset_mm(tmp_float_handling * 10, Y, E1); - } - else if (recdat.addr == T2Offset_Z) { - setNozzleOffset_mm(tmp_float_handling * 10, Z, E1); - } - #endif - #if HAS_BED_PROBE - else if (recdat.addr == ProbeOffset_X) { - setProbeOffset_mm(tmp_float_handling, X); - } - else if (recdat.addr == ProbeOffset_Y) { - setProbeOffset_mm(tmp_float_handling, Y); - } - else if (recdat.addr == ProbeOffset_Z) { - setProbeOffset_mm(tmp_float_handling, Z); - } - #endif - - #if ENABLED(CLASSIC_JERK) - else if (recdat.addr == Jerk_X) { - setAxisMaxJerk_mm_s(tmp_float_handling, X); - } - else if (recdat.addr == Jerk_Y) { - setAxisMaxJerk_mm_s(tmp_float_handling, Y); - } - else if (recdat.addr == Jerk_Z) { - setAxisMaxJerk_mm_s(tmp_float_handling, Z); - } - else if (recdat.addr == Jerk_E) { - setAxisMaxJerk_mm_s(tmp_float_handling, E0); - setAxisMaxJerk_mm_s(tmp_float_handling, E1); - } - #endif - - #if HAS_FILAMENT_SENSOR - else if (recdat.addr == RunoutToggle) { - setFilamentRunoutEnabled(!getFilamentRunoutEnabled()); - } - #endif - - #if ENABLED(POWER_LOSS_RECOVERY) - else if (recdat.addr == PowerLossToggle) { - setPowerLossRecoveryEnabled(!getPowerLossRecoveryEnabled()); - } - #endif - - #if ENABLED(CASE_LIGHT_ENABLE) - else if (recdat.addr == LedToggle) { - setCaseLightState(!getCaseLightState()); - } - #endif - - #if HAS_PID_HEATING - else if (recdat.addr == HotendPID_P) { - setPID(tmp_float_handling * 10, getPID_Ki(getActiveTool()), getPID_Kd(getActiveTool()), getActiveTool()); - } - else if (recdat.addr == HotendPID_I) { - setPID(getPID_Kp(getActiveTool()), tmp_float_handling * 10, getPID_Kd(getActiveTool()), getActiveTool()); - } - else if (recdat.addr == HotendPID_D) { - setPID(getPID_Kp(getActiveTool()), getPID_Ki(getActiveTool()), tmp_float_handling * 10, getActiveTool()); - } - #if ENABLED(PIDTEMPBED) - else if (recdat.addr == BedPID_P) { - setBedPID(tmp_float_handling * 10, getBedPID_Ki(), getBedPID_Kd()); - } - else if (recdat.addr == BedPID_I) { - setBedPID(getBedPID_Kp(), tmp_float_handling * 10, getBedPID_Kd()); - } - else if (recdat.addr == BedPID_D) { - setBedPID(getBedPID_Kp(), getBedPID_Ki(), tmp_float_handling * 10); - } - #endif - #endif // HAS_PID_HEATING - } - break; - - case Setting: - if (recdat.data[0] == 0) { // return to main page - InforShowStatus = true; - TPShowStatus = false; - } - else if (recdat.data[0] == 1) { // Bed Autoleveling - #if HAS_MESH - sendData(getLevelingActive() ? 3 : 2, AutoLevelIcon); - - if (ExtUI::getMeshValid()) { - uint8_t abl_probe_index = 0; - for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) - for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) { - const bool zig = outer & 1; - const xy_uint8_t point = { uint8_t(zig ? (GRID_MAX_POINTS_X - 1) - inner : inner), outer }; - sendData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + abl_probe_index * 2); - ++abl_probe_index; - } - } - #endif - sendData(10, FilenameIcon); // Motor Icon - injectCommands(isPositionKnown() ? F("G1F1000Z0.0") : F("G28\nG1F1000Z0.0")); - waitway = 2; - sendData(ExchangePageBase + 64, ExchangepageAddr); - } - else if (recdat.data[0] == 2) { // Exchange filament - InforShowStatus = true; - TPShowStatus = false; - ZERO(ChangeMaterialbuf); - ChangeMaterialbuf[1] = ChangeMaterialbuf[0] = 10; - sendData(10 * ChangeMaterialbuf[0], FilamentUnit1); // It's ChangeMaterialbuf for show, instead of current_position.e in them. - sendData(10 * ChangeMaterialbuf[1], FilamentUnit2); - sendData(getActualTemp_celsius(H0), NozzleTemp); - sendData(getTargetTemp_celsius(H0), NozzlePreheat); - sendData(TERN0(HAS_MULTI_HOTEND, getActualTemp_celsius(H1)), e2Temp); - sendData(TERN0(HAS_MULTI_HOTEND, getTargetTemp_celsius(H1)), e2Preheat); - delay_ms(2); - sendData(ExchangePageBase + 65, ExchangepageAddr); - } - else if (recdat.data[0] == 3) { // Move - AxisPagenum = 0; - sendData(ExchangePageBase + 71, ExchangepageAddr); - } - else if (recdat.data[0] == 4) { // Language - // Just loads language screen, now used for tools - } - else if (recdat.data[0] == 5) { // Printer Information - sendData(WEBSITE_URL, CorpWebsite); - } - else if (recdat.data[0] == 6) { // Diabalestepper - injectCommands(F("M84")); - sendData(11, FilenameIcon); - } - break; - - case ReturnBack: - if (recdat.data[0] == 1) { // return to the tool page - InforShowStatus = false; - sendData(ExchangePageBase + 63, ExchangepageAddr); - } - if (recdat.data[0] == 2) // return to the Level mode page - sendData(ExchangePageBase + 64, ExchangepageAddr); - break; - - case Bedlevel: - switch (recdat.data[0]) { - case 1: { // Z-axis to home - // Disallow Z homing if X or Y are unknown - injectCommands(isAxisPositionKnown(axis_t(X)) && isAxisPositionKnown(axis_t(Y)) ? F("G28Z\nG1F1500Z0.0") : F("G28\nG1F1500Z0.0")); - sendData(getZOffset_mm() * 100, ProbeOffset_Z); - break; - } - case 2: { // Z-axis to Up - if (WITHIN((getZOffset_mm() + 0.1), Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { - smartAdjustAxis_steps(getAxisSteps_per_mm(Z) / 10, axis_t(Z), false); - //setZOffset_mm(getZOffset_mm() + 0.1); - sendData(getZOffset_mm() * 100, ProbeOffset_Z); - char zOffs[20], tmp1[11]; - sprintf_P(zOffs, PSTR("Z Offset : %s"), dtostrf(getZOffset_mm(), 1, 3, tmp1)); - onStatusChanged(zOffs); - } - break; - } - case 3: { // Z-axis to Down - if (WITHIN((getZOffset_mm() - 0.1), Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { - smartAdjustAxis_steps(-getAxisSteps_per_mm(Z) / 10, axis_t(Z), false); - //babystepAxis_steps(int16_t(-getAxisSteps_per_mm(Z)) / 10, axis_t(Z)); - //setZOffset_mm(getZOffset_mm() - 0.1); - sendData(getZOffset_mm() * 100, ProbeOffset_Z); - char zOffs[20], tmp1[11]; - sprintf_P(zOffs, PSTR("Z Offset : %s"), dtostrf(getZOffset_mm(), 1, 3, tmp1)); - onStatusChanged(zOffs); - } - break; - } - case 4: { // Assistant Level - TERN_(HAS_MESH, setLevelingActive(false)); - injectCommands(isPositionKnown() ? F("G1 F1000 Z0.0") : F("G28\nG1 F1000 Z0.0")); - waitway = 2; - sendData(ExchangePageBase + 84, ExchangepageAddr); - break; - } - case 5: { // AutoLevel "Measuring" Button - #if ENABLED(MESH_BED_LEVELING) - sendData(ExchangePageBase + 93, ExchangepageAddr); - #else - waitway = 3; // only for prohibiting to receive massage - sendData(3, AutolevelIcon); - uint8_t abl_probe_index = 0; - while (abl_probe_index < 25) { - sendData(0, AutolevelVal + abl_probe_index * 2); - ++abl_probe_index; - } - sendData(ExchangePageBase + 64, ExchangepageAddr); - injectCommands(F(MEASURING_GCODE)); - #endif - break; - } - - case 6: { // Assitant Level , Centre 1 - setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z)); - setAxisPosition_mm(X_CENTER, axis_t(X)); - setAxisPosition_mm(Y_CENTER, axis_t(Y)); - waitway = 6; - break; - } - case 7: { // Assitant Level , Front Left 2 - setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z)); - setAxisPosition_mm(X_MIN_BED + lfrb[0], axis_t(X)); - setAxisPosition_mm(Y_MIN_BED + lfrb[1], axis_t(Y)); - waitway = 6; - break; - } - case 8: { // Assitant Level , Front Right 3 - setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z)); - setAxisPosition_mm(X_MAX_BED - lfrb[2], axis_t(X)); - setAxisPosition_mm(Y_MIN_BED + lfrb[1], axis_t(Y)); - waitway = 6; - break; - } - case 9: { // Assitant Level , Back Right 4 - setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z)); - setAxisPosition_mm(X_MAX_BED - lfrb[2], axis_t(X)); - setAxisPosition_mm(Y_MAX_BED - lfrb[3], axis_t(Y)); - waitway = 6; - break; - } - case 10: { // Assitant Level , Back Left 5 - setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z)); - setAxisPosition_mm(X_MIN_BED + lfrb[0], axis_t(X)); - setAxisPosition_mm(Y_MAX_BED - lfrb[3], axis_t(Y)); - waitway = 6; - break; - } - case 11: { // Autolevel switch - #if HAS_MESH - const bool gla = !getLevelingActive(); - setLevelingActive(gla); - sendData(gla ? 3 : 2, AutoLevelIcon); - #endif - sendData(getZOffset_mm() * 100, ProbeOffset_Z); - break; - } - case 12: { - injectCommands(F("G26R255")); - onStatusChanged(F("Beginning G26.. Heating")); - break; - } - case 13: { - injectCommands(F("G29S1")); - onStatusChanged(F("Begin Manual Mesh")); - break; - } - case 14: { - injectCommands(F("G29S2")); - onStatusChanged(F("Moving to Next Mesh Point")); - break; - } - case 15: { - injectCommands(F("M211S0\nG91\nG1Z-0.025\nG90\nM211S1")); - onStatusChanged(F("Moved down 0.025")); - break; - } - case 16: { - injectCommands(F("M211S0\nG91\nG1Z0.025\nG90\nM211S1")); - onStatusChanged(F("Moved up 0.025")); - break; - } - case 17: { - Settings.display_volume = 0; - Settings.display_sound = false; - setTouchScreenConfiguration(); - break; - } - case 18: { - Settings.display_volume = 255; - Settings.display_sound = true; - setTouchScreenConfiguration(); - break; - } - case 19: { - Settings.screen_brightness = 10; - setTouchScreenConfiguration(); - break; - } - case 20: { - Settings.screen_brightness = 100; - setTouchScreenConfiguration(); - break; - } - case 21: { - Settings.display_standby ^= true; - setTouchScreenConfiguration(); - break; - } - case 22: { - Settings.screen_rotation = Settings.screen_rotation == 10 ? 0 : 10; - setTouchScreenConfiguration(); - break; - } - case 23: { // Set IDEX Autopark - injectCommands(F("M605S1\nG28X\nG1X0")); - break; - } - case 24: { // Set IDEX Duplication - injectCommands(F("M605S1\nT0\nG28\nM605S2\nG28X\nG1X0")); - break; - } - case 25: { // Set IDEX Mirrored Duplication - injectCommands(F("M605S1\nT0\nG28\nM605S2\nG28X\nG1X0\nM605S3")); - break; - } - case 26: { // Set IDEX Full Control - injectCommands(F("M605S0\nG28X")); - break; - } - case 27: { // Change Tool - setActiveTool(getActiveTool() == E0 ? E1 : E0, !isAxisPositionKnown(X)); - break; - } - default: break; - } - - sendData(10, FilenameIcon); - break; +namespace ExtUI { - case XYZEaxis: { - axis_t axis = X; - float min = 0.0f, max = 0.0f; - waitway = 4; - if (recdat.addr == DisplayXaxis) { - axis = X; - min = X_MIN_POS; - max = X_MAX_POS; - } - else if (recdat.addr == DisplayYaxis) { - axis = Y; - min = Y_MIN_POS; - max = Y_MAX_POS; - } - else if (recdat.addr == DisplayZaxis) { - axis = Z; - min = Z_MIN_POS; - max = Z_MAX_POS; - } - else if (recdat.addr == AutoZero) { - if (recdat.data[0] == 3) { // autohome - waitway = 4; - injectCommands(F("G28\nG1 F1000 Z10")); - InforShowStatus = AutohomeKey = true; - AutoHomeIconNum = 0; - sendData(10, FilenameIcon); - } - else { - AxisPagenum = recdat.data[0]; - waitway = 0; - } - break; - } +uint8_t dwin_settings_version = 1; - float targetPos = float(recdat.data[0]) / 10; - LIMIT(targetPos, min, max); - setAxisPosition_mm(targetPos, axis); - waitway = 0; - sendData(10, FilenameIcon); - break; - } +void onStartup() { rts.onStartup(); } + +void onIdle() { rts.onIdle(); } + +void onPrinterKilled(FSTR_P const error, FSTR_P const component) { + rts.sendData(ExchangePageBase + 88, ExchangepageAddr); + int16_t j = 0; + char outmsg[40]; + char killMsg[strlen_P(FTOP(error)) + strlen_P(FTOP(component)) + 3]; + sprintf_P(killMsg, PSTR(S_FMT ": " S_FMT), FTOP(error), FTOP(component)); + while (j < 4) outmsg[j++] = '*'; + while (const char c = killMsg[j - 4]) outmsg[j++] = c; + while (j < 40) outmsg[j++] = '*'; + rts.sendData(outmsg, MacVersion); + delay_ms(10); +} - case Filament: +void onMediaInserted() { + filenavigator.reset(); + filenavigator.getFiles(0); + fileIndex = 0; + recordcount = 0; +} - uint16_t IconTemp; - if (recdat.addr == Exchfilament) { - if (getActualTemp_celsius(getActiveTool()) < EXTRUDE_MINTEMP && recdat.data[0] < 5) { - sendData(int16_t(EXTRUDE_MINTEMP), 0x1020); - delay_ms(5); - sendData(ExchangePageBase + 66, ExchangepageAddr); - break; - } +void onMediaError() { + filenavigator.reset(); + for (int16_t i = 0; i < MaxFileNumber; i++) + for (int16_t j = 0; j < 10; j++) rts.sendData(0, SDFILE_ADDR + i * 10 + j); - switch (recdat.data[0]) { - case 1: { // Unload filament1 - setAxisPosition_mm(getAxisPosition_mm(E0) - ChangeMaterialbuf[0], E0); - break; - } - case 2: { // Load filament1 - setAxisPosition_mm(getAxisPosition_mm(E0) + ChangeMaterialbuf[0], E0); - break; - } - case 3: { // Unload filament2 - setAxisPosition_mm(getAxisPosition_mm(E1) - ChangeMaterialbuf[1], E1); - break; - } - case 4: { // Load filament2 - setAxisPosition_mm(getAxisPosition_mm(E1) + ChangeMaterialbuf[1], E1); - break; - } - case 5: { // sure to heat - NozzleTempStatus[0] = 1; + for (int16_t j = 0; j < 10; j++) { + rts.sendData(0, Printfilename + j); // clean screen. + rts.sendData(0, Choosefilename + j); // clean filename + } + for (int16_t j = 0; j < 8; j++) rts.sendData(0, FilenameCount + j); + for (int16_t j = 1; j <= MaxFileNumber; j++) { + rts.sendData(10, FilenameIcon + j); + rts.sendData(10, FilenameIcon1 + j); + } +} - setTargetTemp_celsius((PREHEAT_1_TEMP_HOTEND + 10), getActiveTool()); - IconTemp = getActualTemp_celsius(getActiveTool()) * 100 / getTargetTemp_celsius(getActiveTool()); - NOMORE(IconTemp, 100U); - sendData(IconTemp, HeatPercentIcon); +void onMediaRemoved() { + filenavigator.reset(); + for (int16_t i = 0; i < MaxFileNumber; i++) + for (int16_t j = 0; j < 10; j++) rts.sendData(0, SDFILE_ADDR + i * 10 + j); - sendData(getActualTemp_celsius(H0), NozzleTemp); - sendData(getTargetTemp_celsius(H0), NozzlePreheat); - sendData(TERN0(HAS_MULTI_HOTEND, getActualTemp_celsius(H1)), e2Temp); - sendData(TERN0(HAS_MULTI_HOTEND, getTargetTemp_celsius(H1)), e2Preheat); - delay_ms(5); - sendData(ExchangePageBase + 68, ExchangepageAddr); - break; - } - case 6: { // cancel to heat - sendData(ExchangePageBase + 65, ExchangepageAddr); - break; - } - case 0xF1: { // Sure to cancel heating - NozzleTempStatus[0] = 0; - delay_ms(1); - sendData(ExchangePageBase + 65, ExchangepageAddr); - break; - } - case 0xF0: // not to cancel heating - break; - } - sendData(10 * ChangeMaterialbuf[0], FilamentUnit1); // It's ChangeMaterialbuf for show, instead of current_position.e in them. - sendData(10 * ChangeMaterialbuf[1], FilamentUnit2); - } - else if (recdat.addr == FilamentUnit1) { - ChangeMaterialbuf[0] = float(recdat.data[0]) / 10; - } - else if (recdat.addr == FilamentUnit2) { - ChangeMaterialbuf[1] = float(recdat.data[0]) / 10; - } - break; + for (int16_t j = 0; j < 10; j++) { + rts.sendData(0, Printfilename + j); // clean screen. + rts.sendData(0, Choosefilename + j); // clean filename + } + for (int16_t j = 0; j < 8; j++) rts.sendData(0, FilenameCount + j); + for (int16_t j = 1; j <= MaxFileNumber; j++) { + rts.sendData(10, FilenameIcon + j); + rts.sendData(10, FilenameIcon1 + j); + } +} - case LanguageChoice: +void onPlayTone(const uint16_t frequency, const uint16_t duration) { + rts.sendData(StartSoundSet, SoundAddr); +} - //if (recdat.data[0] == 1) settings.save(); else injectCommands(F("M300")); +void onPrintTimerStarted() { + if (waitway == 7) return; + printerStatusKey[1] = 3; + show_status = true; + delay_ms(1); + rts.sendData(ExchangePageBase + 53, ExchangepageAddr); +} - // may at some point use language change screens to save eeprom explicitly - switch (recdat.data[0]) { - case 0: { - injectCommands(F("M500")); - break; - } - case 1: { - sendData(ExchangePageBase + 94, ExchangepageAddr); - break; - } +void onPrintTimerPaused() { + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); // Display Pause Screen + onStatusChanged(F("Pausing...")); +} - #if ENABLED(PIDTEMP) - case 2: { - onStatusChanged(F("Hotend PID Started")); - startPIDTune(static_cast(pid_hotendAutoTemp), getActiveTool()); - break; - } - #endif +void onPrintTimerStopped() { + if (waitway == 3) return; - case 3: { - injectCommands(F("M502\nM500")); - break; - } - case 4: { - injectCommands(F("M999\nM280P0S160")); - break; - } + #if FAN_COUNT > 0 + for (uint8_t i = 0; i < FAN_COUNT; i++) setTargetFan_percent(FanOff, (fan_t)i); + #endif - case 5: { - #if ENABLED(PIDTEMPBED) - onStatusChanged(F("Bed PID Started")); - startBedPIDTune(static_cast(pid_bedAutoTemp)); - #endif - break; - } - case 6: { - injectCommands(F("M500")); - break; - } - default: break; - } - break; + printerStatusKey[0] = 0; + show_status = true; + tpShowStatus = false; + rts.sendData(ExchangePageBase + 51, ExchangepageAddr); +} - case No_Filament: - if (recdat.data[0] == 1) { // Filament is out, resume / resume selected on screen - if (ExtUI::pauseModeStatus != PAUSE_MESSAGE_PURGE && ExtUI::pauseModeStatus != PAUSE_MESSAGE_OPTION) { - // setPauseMenuResponse(PAUSE_RESPONSE_RESUME_PRINT); - setUserConfirmed(); - // PrinterStatusKey[1] = 3; - // pause_resume_selected = true; - } - else { - #if ENABLED(FILAMENT_RUNOUT_SENSOR) - bool runouton = false; - if (getFilamentRunoutState()) { - #if NUM_RUNOUT_SENSORS > 1 - if ((runouton = getFilamentRunoutEnabled(getActiveTool()))) - ExtUI::setFilamentRunoutEnabled(false, getActiveTool()); - #else - if ((runouton = getFilamentRunoutEnabled())) - ExtUI::setFilamentRunoutEnabled(false); - #endif - } - #else - constexpr bool runouton = false; - #endif - if (!runouton) { - setPauseMenuResponse(PAUSE_RESPONSE_RESUME_PRINT); - setUserConfirmed(); - PrinterStatusKey[1] = 3; - pause_resume_selected = true; - } - } - } - else if (recdat.data[0] == 0) { // Filamet is out, Cancel Selected - if (ExtUI::pauseModeStatus == PAUSE_MESSAGE_PURGE || ExtUI::pauseModeStatus == PAUSE_MESSAGE_OPTION) { - setPauseMenuResponse(PAUSE_RESPONSE_EXTRUDE_MORE); - setUserConfirmed(); - } - } - break; +void onFilamentRunout() { + printerStatusKey[1] = 4; + tpShowStatus = false; + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); +} - #if ENABLED(POWER_LOSS_RECOVERY) - case PwrOffNoF: - if (recdat.data[0] == 1) // Yes: continue to print the 3Dmode during power-off. - injectCommands(F("M1000")); - else if (recdat.data[0] == 2) // No - injectCommands(F("M1000C")); - break; - #endif +void onFilamentRunout(extruder_t extruder) { + printerStatusKey[1] = 4; + tpShowStatus = false; + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); +} - case Volume: - if (recdat.data[0] < 0) - Settings.display_volume = 0; - else if (recdat.data[0] > 255) - Settings.display_volume = 0xFF; - else - Settings.display_volume = recdat.data[0]; +void onUserConfirmRequired(const char *const msg) { + printerStatusKey[1] = 4; + tpShowStatus = false; + if (lastPauseMsgState == ExtUI::pauseModeStatus && msg == (const char*)GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD)) + return; - if (Settings.display_volume == 0) { - sendData(0, VolumeIcon); - sendData(9, SoundIcon); - } - else { - sendData((Settings.display_volume + 1) / 32 - 1, VolumeIcon); - sendData(8, SoundIcon); - } - sendData(Settings.display_volume << 8, SoundAddr + 1); + switch (ExtUI::pauseModeStatus) { + case PAUSE_MESSAGE_WAITING: { + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); + onStatusChanged(F("Press Yes to Continue")); break; + } + case PAUSE_MESSAGE_INSERT: { + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); + onStatusChanged(F("Load Filament to Continue")); + break; + } + case PAUSE_MESSAGE_HEAT: { + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); + onStatusChanged(F("Add Filament and Press Yes to Reheat")); + break; + } - case Filename: - if (isMediaInserted() && recdat.addr == FilenameChs) { - - recordcount = recdat.data[0] - 1; - if (filenavigator.currentindex == 0 && filenavigator.folderdepth > 0 && (fileIndex + recordcount) == 0) { - filenavigator.upDIR(); - filenavigator.getFiles(0); - fileIndex = 0; - return; - } - - if (filenavigator.currentindex == 0 && filenavigator.folderdepth > 0) - recordcount = recordcount - 1; // account for return dir link in file index - - for (int16_t j = 1; j <= 4; j++) { // Clear filename BG Color and Frame - sendData(0xFFFFUL, FilenameNature + j * 16); // white - sendData(10, FilenameIcon1 + j); // clean - } - for (int16_t j = 0; j < 10; j++) // clear current filename - sendData(0, Choosefilename + j); - - if (filenavigator.getIndexisDir(fileIndex + recordcount)) { - filenavigator.changeDIR((char *)filenavigator.getIndexName(fileIndex + recordcount)); - filenavigator.getFiles(0); - fileIndex = 0; - return; - } - else { - sendData(filenavigator.getIndexName(fileIndex + recordcount), Choosefilename); - sendData(0x87F0UL, FilenameNature + recdat.data[0] * 16); // Change BG of selected line to Light Green - sendData(6, FilenameIcon1 + recdat.data[0]); // show frame - } + #if DISABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE) + case PAUSE_MESSAGE_PURGE: { + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); + char newMsg[40] = "Yes to "; + strcat_P(newMsg, TERN1(FILAMENT_RUNOUT_SENSOR, !ExtUI::getFilamentRunoutState() && getFilamentRunoutEnabled()) ? PSTR("Continue") : PSTR("Disable ")); + strcat_P(newMsg, PSTR(" No to Purge")); + onStatusChanged(newMsg); + break; } - else if (recdat.addr == FilenamePlay) { - if (recdat.data[0] == 1 && isMediaInserted()) { // for sure - printFile(filenavigator.getIndexName(fileIndex + recordcount)); - - for (int16_t j = 0; j < 10; j++) // clean screen. - sendData(0, Printfilename + j); - - sendData(filenavigator.getIndexName(fileIndex + recordcount), Printfilename); - - delay_ms(4); - - sendData(ExchangePageBase + 53, ExchangepageAddr); + #endif - TPShowStatus = InforShowStatus = true; - PrinterStatusKey[0] = 1; - PrinterStatusKey[1] = 3; - fileIndex = 0; - recordcount = 0; - } - else if (recdat.data[0] == 2) { // Page Down - if ((fileIndex + DISPLAY_FILES) < (filenavigator.maxFiles() + (filenavigator.folderdepth != 0))) { - fileIndex = fileIndex + DISPLAY_FILES; - // if(filenavigator.folderdepth!=0 && fileIndex!=0) //Shift to acknowledge Return DIR button on first page - // filenavigator.getFiles(fileIndex-1); - // else - filenavigator.getFiles(fileIndex); - // filenavigator.getFiles(filenavigator.currentindex+1); - } - } - else if (recdat.data[0] == 3) { // Page Up - if (fileIndex >= DISPLAY_FILES) { - fileIndex = fileIndex - DISPLAY_FILES; - // if(filenavigator.folderdepth!=0 && fileIndex!=0) //Shift to acknowledge Return DIR button on first page - // filenavigator.getFiles(filenavigator.currentindex-DISPLAY_FILES); - // else - filenavigator.getFiles(fileIndex); - } - } - else if (recdat.data[0] == 4) { // Page Up - injectCommands(F("M22\nM21")); - } - else if (recdat.data[0] == 0) { // return to main page - InforShowStatus = true; - TPShowStatus = false; - } - } + case PAUSE_MESSAGE_OPTION: { + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); + char newMsg[40] = "Yes to "; + strcat_P(newMsg, TERN1(FILAMENT_RUNOUT_SENSOR, !ExtUI::getFilamentRunoutState() && getFilamentRunoutEnabled()) ? PSTR("Continue") : PSTR("Disable ")); + strcat_P(newMsg, PSTR(" No to Purge")); + onStatusChanged(newMsg); break; + } - case VolumeDisplay: { - if (recdat.data[0] == 0) { - Settings.display_volume = 0; - Settings.display_sound = false; - } - else if (recdat.data[0] > 100) { - Settings.display_volume = 255; - Settings.display_sound = true; - } - else { - Settings.display_volume = (uint8_t)map(constrain(recdat.data[0], 0, 100), 0, 100, 0, 255); - Settings.display_sound = true; - } - setTouchScreenConfiguration(); + case PAUSE_MESSAGE_PARKING: { + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); + onStatusChanged(F("Parking...")); break; } - - case DisplayBrightness: { - if (recdat.data[0] < 10) - Settings.screen_brightness = 10; - else if (recdat.data[0] > 100) - Settings.screen_brightness = 100; - else - Settings.screen_brightness = (uint8_t)recdat.data[0]; - setTouchScreenConfiguration(); + case PAUSE_MESSAGE_CHANGING: { + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); + onStatusChanged(F("Beginning Filament Change")); break; } - - case DisplayStandbyBrightness: { - if (recdat.data[0] < 10) - Settings.standby_screen_brightness = 10; - else if (recdat.data[0] > 100) - Settings.standby_screen_brightness = 100; - else - Settings.standby_screen_brightness = (uint8_t)recdat.data[0]; - setTouchScreenConfiguration(); + case PAUSE_MESSAGE_UNLOAD: { + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); + onStatusChanged(F("Unloading...")); break; } - - case DisplayStandbySeconds: { - if (recdat.data[0] < 5) - Settings.standby_time_seconds = 5; - else if (recdat.data[0] > 100) - Settings.standby_time_seconds = 100; - else - Settings.standby_time_seconds = (uint8_t)recdat.data[0]; - setTouchScreenConfiguration(); + case PAUSE_MESSAGE_LOAD: { + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); + onStatusChanged(F("Reloading...")); break; } + case PAUSE_MESSAGE_RESUME: + #if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE) + case PAUSE_MESSAGE_PURGE: { + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); + onStatusChanged(F("Press Yes to Stop Purge")); + break; + } + #endif - case AutolevelVal: { - uint8_t meshPoint = (recdat.addr - AutolevelVal) / 2, - yPnt = floor(meshPoint / GRID_MAX_POINTS_X), - xPnt = meshPoint - (yPnt * GRID_MAX_POINTS_X); - if (yPnt % 2 != 0) xPnt = (GRID_MAX_POINTS_X - 1) - xPnt; // zag row - - float meshVal = float(recdat.data[0] - (recdat.data[0] >= 32768 ? 65536 : 0)) / 1000; - - LIMIT(meshVal, Z_PROBE_LOW_POINT, Z_CLEARANCE_BETWEEN_PROBES); - xy_uint8_t point = { xPnt, yPnt }; - setMeshPoint(point, meshVal); - sendData(meshVal * 1000, recdat.addr); + case PAUSE_MESSAGE_HEATING: { + rts.sendData(ExchangePageBase + 68, ExchangepageAddr); + onStatusChanged(F("Reheating")); break; } - default: break; + case PAUSE_MESSAGE_STATUS: + default: { + setPauseMenuResponse(PAUSE_RESPONSE_RESUME_PRINT); + setUserConfirmed(); + break; + } } - - memset(&recdat, 0, sizeof(recdat)); - recdat.head[0] = FHONE; - recdat.head[1] = FHTWO; + lastPauseMsgState = ExtUI::pauseModeStatus; } -void RTS::writeVariable(const uint16_t adr, const void * const values, uint8_t valueslen, const bool isstr/*=false*/, const char fillChar/*=' '*/) { - const char* myvalues = static_cast(values); - bool strend = !myvalues; - DWIN_SERIAL.write(FHONE); - DWIN_SERIAL.write(FHTWO); - DWIN_SERIAL.write(valueslen + 3); - DWIN_SERIAL.write(0x82); - DWIN_SERIAL.write(adr >> 8); - DWIN_SERIAL.write(adr & 0xFF); - while (valueslen--) { - char x; - if (!strend) x = *myvalues++; - if ((isstr && !x) || strend) { - strend = true; - x = fillChar; - } - DWIN_SERIAL.write(x); - } +void onStatusChanged(const char *const statMsg) { + for (int16_t j = 0; j < 20; j++) // Clear old message + rts.sendData(' ', StatusMessageString + j); + rts.sendData(statMsg, StatusMessageString); } -void RTS::setTouchScreenConfiguration() { - // Main configuration (System_Config) - LIMIT(Settings.screen_brightness, 10, 100); // Prevent a possible all-dark screen - LIMIT(Settings.standby_time_seconds, 10, 655); // Prevent a possible all-dark screen for standby, yet also don't go higher than the DWIN limitation +void onFactoryReset() { + dwin_settings.settings_size = sizeof(creality_dwin_settings_t); + dwin_settings.settings_version = dwin_settings_version; + dwin_settings.display_standby = true; + dwin_settings.display_sound = true; + dwin_settings.display_volume = 32; + dwin_settings.standby_brightness = 15; + dwin_settings.screen_brightness = 100; + dwin_settings.standby_time_seconds = 60; + dwin_settings.screen_rotation = 0; + onStartup(); + startprogress = 0; + show_status = true; +} - uint8_t cfg_bits = (0x0 - | _BV(7) // 7: Enable Control ... TERN0(DWINOS_4, _BV(7)) - | _BV(5) // 5: load 22 touch file - | _BV(4) // 4: auto-upload should always be enabled - | (Settings.display_sound ? _BV(3) : 0) // 3: audio - | (Settings.display_standby ? _BV(2) : 0) // 2: backlight on standby - | (Settings.screen_rotation == 10 ? _BV(1) : 0) // 1 & 0: Inversion - #if LCD_SCREEN_ROTATE == 90 - | _BV(0) // Portrait Mode or 800x480 display has 0 point rotated 90deg from 480x272 display - #elif LCD_SCREEN_ROTATE - #error "Only 90° rotation is supported for the selected LCD." - #endif - ); +void onMeshUpdate(const int8_t xpos, const int8_t ypos, probe_state_t state) {} - const uint8_t config_set[] = { 0x5A, 0x00, TERN(DWINOS_4, 0x00, 0xFF), cfg_bits }; - writeVariable(0x80 /*System_Config*/, config_set, sizeof(config_set)); +void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) { + if (waitway == 3) + if (isPositionKnown() && (getActualTemp_celsius(BED) >= (getTargetTemp_celsius(BED) - 1))) + rts.sendData(ExchangePageBase + 64, ExchangepageAddr); + #if HAS_MESH + uint8_t abl_probe_index = 0; + for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) + for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) { + const bool zig = outer & 1; // != ((PR_OUTER_END) & 1); + const xy_uint8_t point = { uint8_t(zig ? (GRID_MAX_POINTS_X - 1) - inner : inner), outer }; + if (point.x == xpos && outer == ypos) + rts.sendData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + (abl_probe_index * 2)); + ++abl_probe_index; + } + #endif +} - // Standby brightness (LED_Config) - uint16_t dwinStandbyTimeSeconds = 100 * Settings.standby_time_seconds; /* milliseconds, but divided by 10 (not 5 like the docs say) */ - const uint8_t brightness_set[] = { - Settings.screen_brightness /*% active*/, - Settings.standby_screen_brightness /*% standby*/, - static_cast(dwinStandbyTimeSeconds >> 8), - static_cast(dwinStandbyTimeSeconds) - }; - writeVariable(0x82 /*LED_Config*/, brightness_set, sizeof(brightness_set)); +void onStoreSettings(char *buff) { + static_assert( + ExtUI::eeprom_data_size >= sizeof(creality_dwin_settings_t), + "Insufficient space in EEPROM for UI parameters" + ); - if (!Settings.display_sound) { - sendData(0, VolumeIcon); - sendData(9, SoundIcon); - } - else { - sendData((Settings.display_volume + 1) / 32 - 1, VolumeIcon); - sendData(8, SoundIcon); - } - sendData(Settings.display_volume, VolumeIcon - 2); - sendData(Settings.display_volume << 8, SoundAddr + 1); - sendData(map(constrain(Settings.display_volume, 0, 255), 0, 255, 0, 100), VolumeDisplay); - sendData(Settings.screen_brightness, DisplayBrightness); - sendData(Settings.standby_screen_brightness, DisplayStandbyBrightness); - sendData(Settings.standby_time_seconds, DisplayStandbySeconds); - if (Settings.display_standby) - sendData(3, DisplayStandbyEnableIndicator); - else - sendData(2, DisplayStandbyEnableIndicator); + // Write to buffer + memcpy(buff, &dwin_settings, sizeof(creality_dwin_settings_t)); } -namespace ExtUI { - - void onStartup() { rts.onStartup(); } +void onLoadSettings(const char *buff) { + static_assert( + ExtUI::eeprom_data_size >= sizeof(creality_dwin_settings_t), + "Insufficient space in EEPROM for UI parameters" + ); - void onIdle() { rts.onIdle(); } + creality_dwin_settings_t eepromSettings; + memcpy(&eepromSettings, buff, sizeof(creality_dwin_settings_t)); - void onPrinterKilled(FSTR_P const error, FSTR_P const component) { - rts.sendData(ExchangePageBase + 88, ExchangepageAddr); - int16_t j = 0; - char outmsg[40]; - char killMsg[strlen_P(FTOP(error)) + strlen_P(FTOP(component)) + 3]; - sprintf_P(killMsg, PSTR(S_FMT ": " S_FMT), FTOP(error), FTOP(component)); - while (j < 4) outmsg[j++] = '*'; - while (const char c = killMsg[j - 4]) outmsg[j++] = c; - while (j < 40) outmsg[j++] = '*'; - rts.sendData(outmsg, MacVersion); - delay_ms(10); + // If size is not the same, discard settings + if (eepromSettings.settings_size != sizeof(creality_dwin_settings_t)) { + onFactoryReset(); + return; } - void onMediaInserted() { - filenavigator.reset(); - filenavigator.getFiles(0); - fileIndex = 0; - recordcount = 0; + if (eepromSettings.settings_version != dwin_settings_version) { + onFactoryReset(); + return; } - void onMediaError() { - filenavigator.reset(); - for (int16_t i = 0; i < MaxFileNumber; i++) - for (int16_t j = 0; j < 10; j++) rts.sendData(0, SDFILE_ADDR + i * 10 + j); + // Copy into final location + memcpy(&dwin_settings, &eepromSettings, sizeof(creality_dwin_settings_t)); - for (int16_t j = 0; j < 10; j++) { - rts.sendData(0, Printfilename + j); // clean screen. - rts.sendData(0, Choosefilename + j); // clean filename - } - for (int16_t j = 0; j < 8; j++) rts.sendData(0, FilenameCount + j); - for (int16_t j = 1; j <= MaxFileNumber; j++) { - rts.sendData(10, FilenameIcon + j); - rts.sendData(10, FilenameIcon1 + j); - } - } + rts.setTouchScreenConfiguration(); +} + +void onSettingsStored(const bool success) { + // This is called after the entire EEPROM has been written, + // whether successful or not. +} - void onMediaRemoved() { - filenavigator.reset(); - for (int16_t i = 0; i < MaxFileNumber; i++) - for (int16_t j = 0; j < 10; j++) rts.sendData(0, SDFILE_ADDR + i * 10 + j); +void onSettingsLoaded(const bool success) { + #if HAS_MESH + if (ExtUI::getMeshValid()) { + uint8_t abl_probe_index = 0; + for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) + for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) { + const bool zig = outer & 1; + const xy_uint8_t point = { uint8_t(zig ? (GRID_MAX_POINTS_X - 1) - inner : inner), outer }; + rts.sendData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + (abl_probe_index * 2)); + ++abl_probe_index; + } - for (int16_t j = 0; j < 10; j++) { - rts.sendData(0, Printfilename + j); // clean screen. - rts.sendData(0, Choosefilename + j); // clean filename + rts.sendData(3, AutoLevelIcon); // 2=On, 3=Off + setLevelingActive(true); } - for (int16_t j = 0; j < 8; j++) rts.sendData(0, FilenameCount + j); - for (int16_t j = 1; j <= MaxFileNumber; j++) { - rts.sendData(10, FilenameIcon + j); - rts.sendData(10, FilenameIcon1 + j); + else { + rts.sendData(2, AutoLevelIcon); /*Off*/ + setLevelingActive(false); } - } - - void onPlayTone(const uint16_t frequency, const uint16_t duration) { - rts.sendData(StartSoundSet, SoundAddr); - } - - void onPrintTimerStarted() { - if (waitway == 7) return; - PrinterStatusKey[1] = 3; - InforShowStatus = true; - delay_ms(1); - rts.sendData(ExchangePageBase + 53, ExchangepageAddr); - } - - void onPrintTimerPaused() { - rts.sendData(ExchangePageBase + 78, ExchangepageAddr); // Display Pause Screen - onStatusChanged(F("Pausing...")); - } - - void onPrintTimerStopped() { - if (waitway == 3) return; - - #if FAN_COUNT > 0 - for (uint8_t i = 0; i < FAN_COUNT; i++) setTargetFan_percent(FanOff, (fan_t)i); - #endif - - PrinterStatusKey[0] = 0; - InforShowStatus = true; - TPShowStatus = false; - rts.sendData(ExchangePageBase + 51, ExchangepageAddr); - } + #endif - void onFilamentRunout() { - PrinterStatusKey[1] = 4; - TPShowStatus = false; - rts.sendData(ExchangePageBase + 78, ExchangepageAddr); - } + rts.sendData(getZOffset_mm() * 100, ProbeOffset_Z); + rts.setTouchScreenConfiguration(); +} - void onFilamentRunout(extruder_t extruder) { - PrinterStatusKey[1] = 4; - TPShowStatus = false; - rts.sendData(ExchangePageBase + 78, ExchangepageAddr); +#if ENABLED(POWER_LOSS_RECOVERY) + void onSetPowerLoss(const bool onoff) { + // Called when power-loss is enabled/disabled } - - void onUserConfirmRequired(const char *const msg) { - PrinterStatusKey[1] = 4; - TPShowStatus = false; - if (lastPauseMsgState == ExtUI::pauseModeStatus && msg == (const char*)GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD)) - return; - - switch (ExtUI::pauseModeStatus) { - case PAUSE_MESSAGE_WAITING: { - rts.sendData(ExchangePageBase + 78, ExchangepageAddr); - onStatusChanged(F("Press Yes to Continue")); - break; - } - case PAUSE_MESSAGE_INSERT: { - rts.sendData(ExchangePageBase + 78, ExchangepageAddr); - onStatusChanged(F("Load Filament to Continue")); - break; - } - case PAUSE_MESSAGE_HEAT: { - rts.sendData(ExchangePageBase + 78, ExchangepageAddr); - onStatusChanged(F("Add Filament and Press Yes to Reheat")); - break; - } - - #if DISABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE) - case PAUSE_MESSAGE_PURGE: { - rts.sendData(ExchangePageBase + 78, ExchangepageAddr); - char newMsg[40] = "Yes to "; - strcat_P(newMsg, TERN1(FILAMENT_RUNOUT_SENSOR, !ExtUI::getFilamentRunoutState() && getFilamentRunoutEnabled()) ? PSTR("Continue") : PSTR("Disable ")); - strcat_P(newMsg, PSTR(" No to Purge")); - onStatusChanged(newMsg); - break; - } - #endif - - case PAUSE_MESSAGE_OPTION: { - rts.sendData(ExchangePageBase + 78, ExchangepageAddr); - char newMsg[40] = "Yes to "; - strcat_P(newMsg, TERN1(FILAMENT_RUNOUT_SENSOR, !ExtUI::getFilamentRunoutState() && getFilamentRunoutEnabled()) ? PSTR("Continue") : PSTR("Disable ")); - strcat_P(newMsg, PSTR(" No to Purge")); - onStatusChanged(newMsg); - break; - } - - case PAUSE_MESSAGE_PARKING: { - rts.sendData(ExchangePageBase + 78, ExchangepageAddr); - onStatusChanged(F("Parking...")); - break; - } - case PAUSE_MESSAGE_CHANGING: { - rts.sendData(ExchangePageBase + 78, ExchangepageAddr); - onStatusChanged(F("Beginning Filament Change")); - break; - } - case PAUSE_MESSAGE_UNLOAD: { - rts.sendData(ExchangePageBase + 78, ExchangepageAddr); - onStatusChanged(F("Unloading...")); - break; - } - case PAUSE_MESSAGE_LOAD: { - rts.sendData(ExchangePageBase + 78, ExchangepageAddr); - onStatusChanged(F("Reloading...")); - break; - } - case PAUSE_MESSAGE_RESUME: - #if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE) - case PAUSE_MESSAGE_PURGE: { - rts.sendData(ExchangePageBase + 78, ExchangepageAddr); - onStatusChanged(F("Press Yes to Stop Purge")); - break; - } - #endif - - case PAUSE_MESSAGE_HEATING: { - rts.sendData(ExchangePageBase + 68, ExchangepageAddr); - onStatusChanged(F("Reheating")); - break; - } - - case PAUSE_MESSAGE_STATUS: - default: { - setPauseMenuResponse(PAUSE_RESPONSE_RESUME_PRINT); - setUserConfirmed(); - break; - } - } - lastPauseMsgState = ExtUI::pauseModeStatus; + void onPowerLoss() { + // Called when power-loss state is detected } - - void onStatusChanged(const char *const statMsg) { - for (int16_t j = 0; j < 20; j++) // Clear old message - rts.sendData(' ', StatusMessageString + j); - rts.sendData(statMsg, StatusMessageString); + void onPowerLossResume() { + startprogress = 254; + show_status = true; + tpShowStatus = false; + no_reentry = false; + rts.sendData(ExchangePageBase + 76, ExchangepageAddr); } +#endif - void onFactoryReset() { - Settings.settings_size = sizeof(creality_dwin_settings_t); - Settings.settings_version = dwin_settings_version; - Settings.display_standby = true; - Settings.display_sound = true; - Settings.display_volume = 32; - Settings.standby_screen_brightness = 15; - Settings.screen_brightness = 100; - Settings.standby_time_seconds = 60; - Settings.screen_rotation = 0; - onStartup(); - startprogress = 0; - InforShowStatus = true; +#if HAS_PID_HEATING + void onPidTuning(const result_t rst) { + // Called for temperature PID tuning result + rts.sendData(pid_hotendAutoTemp, HotendPID_AutoTmp); + rts.sendData(pid_bedAutoTemp, BedPID_AutoTmp); + rts.sendData(uint16_t(getPID_Kp(E0)) * 10, HotendPID_P); + rts.sendData(uint16_t(getPID_Ki(E0)) * 10, HotendPID_I); + rts.sendData(uint16_t(getPID_Kd(E0)) * 10, HotendPID_D); + #if ENABLED(PIDTEMPBED) + rts.sendData(uint16_t(getBedPID_Kp()) * 10, BedPID_P); + rts.sendData(uint16_t(getBedPID_Ki()) * 10, BedPID_I); + rts.sendData(uint16_t(getBedPID_Kd()) * 10, BedPID_D); + #endif + onStatusChanged(F("PID Tune Finished")); } +#endif - void onMeshUpdate(const int8_t xpos, const int8_t ypos, probe_state_t state) {} +void onLevelingStart() {} - void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) { - if (waitway == 3) - if (isPositionKnown() && (getActualTemp_celsius(BED) >= (getTargetTemp_celsius(BED) - 1))) - rts.sendData(ExchangePageBase + 64, ExchangepageAddr); - #if HAS_MESH +void onLevelingDone() { + #if HAS_MESH + if (ExtUI::getMeshValid()) { uint8_t abl_probe_index = 0; for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) { - const bool zig = outer & 1; // != ((PR_OUTER_END) & 1); + const bool zig = outer & 1; const xy_uint8_t point = { uint8_t(zig ? (GRID_MAX_POINTS_X - 1) - inner : inner), outer }; - if (point.x == xpos && outer == ypos) - rts.sendData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + (abl_probe_index * 2)); + rts.sendData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + abl_probe_index * 2); ++abl_probe_index; } - #endif - } - - void onStoreSettings(char *buff) { - static_assert( - ExtUI::eeprom_data_size >= sizeof(creality_dwin_settings_t), - "Insufficient space in EEPROM for UI parameters" - ); - - // Write to buffer - memcpy(buff, &Settings, sizeof(creality_dwin_settings_t)); - } - void onLoadSettings(const char *buff) { - static_assert( - ExtUI::eeprom_data_size >= sizeof(creality_dwin_settings_t), - "Insufficient space in EEPROM for UI parameters" - ); - - creality_dwin_settings_t eepromSettings; - memcpy(&eepromSettings, buff, sizeof(creality_dwin_settings_t)); - - // If size is not the same, discard settings - if (eepromSettings.settings_size != sizeof(creality_dwin_settings_t)) { - onFactoryReset(); - return; - } - - if (eepromSettings.settings_version != dwin_settings_version) { - onFactoryReset(); - return; - } - - // Copy into final location - memcpy(&Settings, &eepromSettings, sizeof(creality_dwin_settings_t)); - - rts.setTouchScreenConfiguration(); - } - - void onSettingsStored(const bool success) { - // This is called after the entire EEPROM has been written, - // whether successful or not. - } - - void onSettingsLoaded(const bool success) { - #if HAS_MESH - if (ExtUI::getMeshValid()) { - uint8_t abl_probe_index = 0; - for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) - for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) { - const bool zig = outer & 1; - const xy_uint8_t point = { uint8_t(zig ? (GRID_MAX_POINTS_X - 1) - inner : inner), outer }; - rts.sendData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + (abl_probe_index * 2)); - ++abl_probe_index; - } - - rts.sendData(3, AutoLevelIcon); // 2=On, 3=Off - setLevelingActive(true); - } - else { - rts.sendData(2, AutoLevelIcon); /*Off*/ - setLevelingActive(false); - } - #endif - - rts.sendData(getZOffset_mm() * 100, ProbeOffset_Z); - rts.setTouchScreenConfiguration(); - } - - #if ENABLED(POWER_LOSS_RECOVERY) - void onSetPowerLoss(const bool onoff) { - // Called when power-loss is enabled/disabled - } - void onPowerLoss() { - // Called when power-loss state is detected - } - void onPowerLossResume() { - startprogress = 254; - InforShowStatus = true; - TPShowStatus = false; - reEntryPrevent = false; - rts.sendData(ExchangePageBase + 76, ExchangepageAddr); + rts.sendData(3, AutoLevelIcon); // 2=On, 3=Off + setLevelingActive(true); } - #endif - - #if HAS_PID_HEATING - void onPidTuning(const result_t rst) { - // Called for temperature PID tuning result - rts.sendData(pid_hotendAutoTemp, HotendPID_AutoTmp); - rts.sendData(pid_bedAutoTemp, BedPID_AutoTmp); - rts.sendData(uint16_t(getPID_Kp(E0)) * 10, HotendPID_P); - rts.sendData(uint16_t(getPID_Ki(E0)) * 10, HotendPID_I); - rts.sendData(uint16_t(getPID_Kd(E0)) * 10, HotendPID_D); - #if ENABLED(PIDTEMPBED) - rts.sendData(uint16_t(getBedPID_Kp()) * 10, BedPID_P); - rts.sendData(uint16_t(getBedPID_Ki()) * 10, BedPID_I); - rts.sendData(uint16_t(getBedPID_Kd()) * 10, BedPID_D); - #endif - onStatusChanged(F("PID Tune Finished")); + else { + rts.sendData(2, AutoLevelIcon); /*Off*/ + setLevelingActive(false); } #endif +} - void onLevelingStart() {} - - void onLevelingDone() { - #if HAS_MESH - if (ExtUI::getMeshValid()) { - uint8_t abl_probe_index = 0; - for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) - for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) { - const bool zig = outer & 1; - const xy_uint8_t point = { uint8_t(zig ? (GRID_MAX_POINTS_X - 1) - inner : inner), outer }; - rts.sendData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + abl_probe_index * 2); - ++abl_probe_index; - } - - rts.sendData(3, AutoLevelIcon); // 2=On, 3=Off - setLevelingActive(true); - } - else { - rts.sendData(2, AutoLevelIcon); /*Off*/ - setLevelingActive(false); - } - #endif - } - - void onSteppersEnabled() {} - void onPrintDone() {} - void onHomingStart() {} - void onHomingDone() {} - void onSteppersDisabled() {} - void onPostprocessSettings() {} +void onSteppersEnabled() {} +void onPrintDone() {} +void onHomingStart() {} +void onHomingDone() {} +void onSteppersDisabled() {} +void onPostprocessSettings() {} } // namespace ExtUI diff --git a/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp b/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp new file mode 100644 index 0000000000000..37ba539ff1026 --- /dev/null +++ b/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp @@ -0,0 +1,1730 @@ +/** + * 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 . + * + */ + +/* **************************************** + * lcd/extui/ia_creality/ia_creality_rts.cpp + * **************************************** + * Creality DWIN Resistive Touch Screen + * 10SPro, Max, CRX, and others + * Based original Creality release + * Written by Insanity Automation, sponsored by Tiny Machines 3D + * + * ***************************************/ + +#include "../../../inc/MarlinConfigPre.h" + +#if DGUS_LCD_UI_IA_CREALITY + +#include "ia_creality_rts.h" +#include "FileNavigator.h" +#include "../ui_api.h" + +using namespace ExtUI; + +#include // for memset + +// Singleton instance +RTS rts; + +// Static data +DB RTS::recdat, RTS::snddat; +uint8_t RTS::databuf[DATA_BUF_SIZE]; +rx_datagram_state_t RTS::rx_datagram_state = DGUS_IDLE; +uint8_t RTS::rx_datagram_len = 0; + +// Local data +uint16_t fileIndex = 0; +uint8_t recordcount = 0; +uint8_t waitway_lock = 0; +uint8_t startprogress = 0; + +char waitway = 0; +int16_t recnum = 0; +float changeMaterialBuf[2] = { 0 }; +char nozzleTempStatus[3] = { 0 }; +char printerStatusKey[2] = { 0 }; + +uint8_t axisPageNum = 0; // 0 for 10mm, 1 for 1mm, 2 for 0.1mm +bool show_status = true; +bool tpShowStatus = false; // true for only opening time and percentage, false for closing time and percentage. +bool autoHomeKey = false; +uint8_t autoHomeIconNum; +int16_t userConfValidation = 0; +uint8_t lastPauseMsgState = 0; + +creality_dwin_settings_t dwin_settings; + +bool no_reentry = false; +uint8_t reentryCount = 0; +uint16_t idleThrottling = 0; + +bool pause_resume_selected = false; + +#if HAS_PID_HEATING + uint16_t pid_hotendAutoTemp = 150; + uint16_t pid_bedAutoTemp = 70; +#endif + +#ifndef IA_CREALITY_BOOT_DELAY + #define IA_CREALITY_BOOT_DELAY 500 +#endif + +void RTS::onStartup() { + DWIN_SERIAL.begin(115200); + recdat.head[0] = snddat.head[0] = FHONE; + recdat.head[1] = snddat.head[1] = FHTWO; + ZERO(databuf); + + delay_ms(IA_CREALITY_BOOT_DELAY); // Delay to allow screen startup + setTouchScreenConfiguration(); + sendData(StartSoundSet, SoundAddr); + delay_ms(400); // Delay to allow screen to configure + + onStatusChanged(MACHINE_NAME " Ready"); + + sendData(100, FeedrateDisplay); + + /***************turn off motor*****************/ + sendData(11, FilenameIcon); + + /***************transmit temperature to screen*****************/ + sendData(0, NozzlePreheat); + sendData(0, BedPreheat); + sendData(getActualTemp_celsius(H0), NozzleTemp); + sendData(TERN0(HAS_MULTI_HOTEND, getActualTemp_celsius(H1)), e2Temp); + sendData(getActualTemp_celsius(BED), Bedtemp); + /***************transmit Fan speed to screen*****************/ + sendData(getActualFan_percent((fan_t)getActiveTool()), FanKeyIcon); + + /***************transmit Printer information to screen*****************/ + for (int16_t j = 0; j < 20; j++) // clean filename + sendData(0, MacVersion + j); + char sizebuf[20] = {0}; + sprintf(sizebuf, "%d X %d X %d", Y_BED_SIZE, X_BED_SIZE, Z_MAX_POS); + sendData(MACHINE_NAME, MacVersion); + sendData(SHORT_BUILD_VERSION, SoftVersion); + sendData(sizebuf, PrinterSize); + sendData(WEBSITE_URL, CorpWebsite); + + /**************************some info init*******************************/ + sendData(0, PrintscheduleIcon); + sendData(0, PrintscheduleIcon + 1); + + /************************clean screen*******************************/ + for (int16_t i = 0; i < MaxFileNumber; i++) + for (int16_t j = 0; j < 10; j++) sendData(0, SDFILE_ADDR + i * 10 + j); + + for (int16_t j = 0; j < 10; j++) { + sendData(0, Printfilename + j); // clean screen. + sendData(0, Choosefilename + j); // clean filename + } + for (int16_t j = 0; j < 8; j++) sendData(0, FilenameCount + j); + for (int16_t j = 1; j <= MaxFileNumber; j++) { + sendData(10, FilenameIcon + j); + sendData(10, FilenameIcon1 + j); + } +} + +void RTS::onIdle() { + while (rts.receiveData() > 0 && (rts.recdat.data[0] != 0 || rts.recdat.addr != 0)) + rts.handleData(); + + if (no_reentry && reentryCount < 120) { reentryCount++; return; } + reentryCount = 0; + + if (idleThrottling++ < 750) return; + + // Always send temperature data + rts.sendData(getActualTemp_celsius(getActiveTool()), NozzleTemp); + rts.sendData(getActualTemp_celsius(BED), Bedtemp); + rts.sendData(getTargetTemp_celsius(getActiveTool()), NozzlePreheat); + rts.sendData(getTargetTemp_celsius(BED), BedPreheat); + rts.sendData(TERN0(HAS_MULTI_HOTEND, getActualTemp_celsius(H1)), e2Temp); + rts.sendData(TERN0(HAS_MULTI_HOTEND, getTargetTemp_celsius(H1)), e2Preheat); + TERN_(HAS_MULTI_HOTEND, rts.sendData(uint8_t(getActiveTool() + 1), ActiveToolVP)); + + if (awaitingUserConfirm() && (lastPauseMsgState != ExtUI::pauseModeStatus || userConfValidation > 99)) { + switch (ExtUI::pauseModeStatus) { + case PAUSE_MESSAGE_PARKING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_PAUSE_PRINT_PARKING)); break; + case PAUSE_MESSAGE_CHANGING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_INIT)); break; + case PAUSE_MESSAGE_UNLOAD: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_UNLOAD)); break; + case PAUSE_MESSAGE_WAITING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_ADVANCED_PAUSE_WAITING)); break; + case PAUSE_MESSAGE_INSERT: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_INSERT)); break; + case PAUSE_MESSAGE_LOAD: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD)); break; + case PAUSE_MESSAGE_PURGE: ExtUI::onUserConfirmRequired(GET_TEXT_F(TERN(ADVANCED_PAUSE_CONTINUOUS_PURGE, MSG_FILAMENT_CHANGE_CONT_PURGE, MSG_FILAMENT_CHANGE_PURGE))); break; + case PAUSE_MESSAGE_RESUME: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_RESUME)); break; + case PAUSE_MESSAGE_HEAT: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEAT)); break; + case PAUSE_MESSAGE_HEATING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEATING)); break; + case PAUSE_MESSAGE_OPTION: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_OPTION_HEADER)); break; + case PAUSE_MESSAGE_STATUS: break; + default: onUserConfirmRequired(PSTR("Confirm Continue")); break; + } + userConfValidation = 0; + } + else if (pause_resume_selected && !awaitingUserConfirm()) { + rts.sendData(ExchangePageBase + 53, ExchangepageAddr); + pause_resume_selected = false; + userConfValidation = 0; + } + else if (awaitingUserConfirm()) { + if (pause_resume_selected) { + pause_resume_selected = false; + userConfValidation = 100; + } + else + userConfValidation++; + } + + no_reentry = true; + idleThrottling = 0; + if (waitway && !commandsInQueue()) + waitway_lock++; + else + waitway_lock = 0; + + if (waitway_lock > 100) { + waitway_lock = 0; + waitway = 0; // clear waitway if nothing is going on + } + + switch (waitway) { + case 1: + if (isPositionKnown()) { + show_status = true; + rts.sendData(ExchangePageBase + 54, ExchangepageAddr); + waitway = 0; + } + break; + + case 2: + if (isPositionKnown() && !commandsInQueue()) waitway = 0; + break; + + case 3: + //if(isPositionKnown() && (getActualTemp_celsius(BED) >= (getTargetTemp_celsius(BED)-1))) { + rts.sendData(ExchangePageBase + 64, ExchangepageAddr); + waitway = 7; + //return; + //} + break; + + case 4: + if (autoHomeKey && isPositionKnown() && !commandsInQueue()) { // Manual Move Home Done + //rts.sendData(ExchangePageBase + 71 + axisPageNum, ExchangepageAddr); + autoHomeKey = false; + waitway = 0; + } + break; + case 5: + if (isPositionKnown() && !commandsInQueue()) { + show_status = true; + waitway = 0; + rts.sendData(ExchangePageBase + 78, ExchangepageAddr); // exchange to 78 page + } + break; + case 6: + if (!commandsInQueue()) { + setAxisPosition_mm(BED_TRAMMING_HEIGHT, axis_t(Z)); + waitway = 0; + } + break; + case 7: + if (!commandsInQueue()) waitway = 0; + break; + } + + TERN_(HAS_MESH, rts.sendData(getLevelingActive() ? 3 : 2, AutoLevelIcon)); + TERN_(HAS_FILAMENT_SENSOR, rts.sendData(getFilamentRunoutEnabled() ? 3 : 2, RunoutToggle)); + TERN_(CASE_LIGHT_ENABLE, rts.sendData(getCaseLightState() ? 3 : 2, LedToggle)); + TERN_(POWER_LOSS_RECOVERY, rts.sendData(getPowerLossRecoveryEnabled() ? 3 : 2, PowerLossToggle)); + + if (startprogress == 0) { + startprogress += 25; + delay_ms(3000); // Delay to show bootscreen + } + else if (startprogress < 250) { + if (isMediaInserted()) // Re init media as it happens too early on STM32 boards often + onMediaInserted(); + else + injectCommands(F("M22\nM21")); + startprogress = 254; + show_status = true; + tpShowStatus = false; + rts.sendData(ExchangePageBase + 45, ExchangepageAddr); + no_reentry = false; + return; + } + if (startprogress <= 100) + rts.sendData(startprogress, StartIcon); + else + rts.sendData(startprogress - 100, StartIcon + 1); + + //rts.sendData((startprogress++) % 5, ExchFlmntIcon); + + if (isPrinting()) { + rts.sendData(getActualFan_percent((fan_t)getActiveTool()), FanKeyIcon); + rts.sendData(getProgress_seconds_elapsed() / 3600, Timehour); + rts.sendData((getProgress_seconds_elapsed() % 3600) / 60, Timemin); + if (getProgress_percent() > 0) { + const uint16_t perc = getProgress_percent() + 1; + if (perc <= 50) { + rts.sendData(uint16_t(perc) * 2, PrintscheduleIcon); + rts.sendData(0, PrintscheduleIcon + 1); + } + else { + rts.sendData(100, PrintscheduleIcon); + rts.sendData(uint16_t(perc) * 2 - 100, PrintscheduleIcon + 1); + } + } + else { + rts.sendData(0, PrintscheduleIcon); + rts.sendData(0, PrintscheduleIcon + 1); + } + rts.sendData(uint16_t(getProgress_percent()), Percentage); + } + else { // Not printing settings + rts.sendData(map(constrain(dwin_settings.display_volume, 0, 255), 0, 255, 0, 100), VolumeDisplay); + rts.sendData(dwin_settings.screen_brightness, DisplayBrightness); + rts.sendData(dwin_settings.standby_brightness, DisplayStandbyBrightness); + rts.sendData(dwin_settings.standby_time_seconds, DisplayStandbySeconds); + if (dwin_settings.display_standby) + rts.sendData(3, DisplayStandbyEnableIndicator); + else + rts.sendData(2, DisplayStandbyEnableIndicator); + + rts.sendData(getAxisSteps_per_mm(X) * 10, StepMM_X); + rts.sendData(getAxisSteps_per_mm(Y) * 10, StepMM_Y); + rts.sendData(getAxisSteps_per_mm(Z) * 10, StepMM_Z); + rts.sendData(getAxisSteps_per_mm(E0) * 10, StepMM_E); + + rts.sendData(getAxisMaxAcceleration_mm_s2(X) / 100, Accel_X); + rts.sendData(getAxisMaxAcceleration_mm_s2(Y) / 100, Accel_Y); + rts.sendData(getAxisMaxAcceleration_mm_s2(Z) / 10, Accel_Z); + rts.sendData(getAxisMaxAcceleration_mm_s2(E0), Accel_E); + + rts.sendData(getAxisMaxFeedrate_mm_s(X), Feed_X); + rts.sendData(getAxisMaxFeedrate_mm_s(Y), Feed_Y); + rts.sendData(getAxisMaxFeedrate_mm_s(Z), Feed_Z); + rts.sendData(getAxisMaxFeedrate_mm_s(E0), Feed_E); + + rts.sendData(getAxisMaxJerk_mm_s(X) * 100, Jerk_X); + rts.sendData(getAxisMaxJerk_mm_s(Y) * 100, Jerk_Y); + rts.sendData(getAxisMaxJerk_mm_s(Z) * 100, Jerk_Z); + rts.sendData(getAxisMaxJerk_mm_s(E0) * 100, Jerk_E); + + #if HAS_HOTEND_OFFSET + rts.sendData(getNozzleOffset_mm(X, E1) * 10, T2Offset_X); + rts.sendData(getNozzleOffset_mm(Y, E1) * 10, T2Offset_Y); + rts.sendData(getNozzleOffset_mm(Z, E1) * 10, T2Offset_Z); + rts.sendData(getAxisSteps_per_mm(E1) * 10, T2StepMM_E); + #endif + + #if HAS_BED_PROBE + rts.sendData(getProbeOffset_mm(X) * 100, ProbeOffset_X); + rts.sendData(getProbeOffset_mm(Y) * 100, ProbeOffset_Y); + #endif + + #if HAS_PID_HEATING + rts.sendData(pid_hotendAutoTemp, HotendPID_AutoTmp); + rts.sendData(pid_bedAutoTemp, BedPID_AutoTmp); + rts.sendData(getPID_Kp(E0) * 10, HotendPID_P); + rts.sendData(getPID_Ki(E0) * 10, HotendPID_I); + rts.sendData(getPID_Kd(E0) * 10, HotendPID_D); + #if ENABLED(PIDTEMPBED) + rts.sendData(getBedPID_Kp() * 10, BedPID_P); + rts.sendData(getBedPID_Ki() * 10, BedPID_I); + rts.sendData(getBedPID_Kd() * 10, BedPID_D); + #endif + #endif + } + + rts.sendData(getZOffset_mm() * 100, ProbeOffset_Z); + rts.sendData(uint16_t(getFlow_percent(E0)), Flowrate); + + if (nozzleTempStatus[0] || nozzleTempStatus[2]) { // statuse of loadfilament and unloadfinement when temperature is less than + uint16_t IconTemp = getActualTemp_celsius(getActiveTool()) * 100 / getTargetTemp_celsius(getActiveTool()); + NOMORE(IconTemp, 100U); + rts.sendData(IconTemp, HeatPercentIcon); + if (getActualTemp_celsius(getActiveTool()) > EXTRUDE_MINTEMP && nozzleTempStatus[0] != 0) { + nozzleTempStatus[0] = 0; + rts.sendData(10 * changeMaterialBuf[0], FilamentUnit1); + rts.sendData(10 * changeMaterialBuf[1], FilamentUnit2); + rts.sendData(ExchangePageBase + 65, ExchangepageAddr); + } + else if (getActualTemp_celsius(getActiveTool()) >= getTargetTemp_celsius(getActiveTool()) && nozzleTempStatus[2]) { + nozzleTempStatus[2] = 0; + tpShowStatus = true; + rts.sendData(4, ExchFlmntIcon); + rts.sendData(ExchangePageBase + 83, ExchangepageAddr); + } + else if (nozzleTempStatus[2]) { + //rts.sendData((startprogress++) % 5, ExchFlmntIcon); + } + } + + if (autoHomeKey) { + rts.sendData(autoHomeIconNum, AutoZeroIcon); + if (++autoHomeIconNum > 9) autoHomeIconNum = 0; + } + + if (isMediaInserted()) { + const uint16_t currPage = fileIndex == 0 ? 1 : CEIL(float(fileIndex) / float(DISPLAY_FILES)) + 1, + maxPageAdd = filenavigator.folderdepth ? 1 : 0, + maxPages = CEIL(float(filenavigator.maxFiles() + maxPageAdd) / float(DISPLAY_FILES) ); + + rts.sendData(currPage, FilesCurentPage); + rts.sendData(maxPages, FilesMaxPage); + } + else { + rts.sendData(0, FilesCurentPage); + rts.sendData(0, FilesMaxPage); + } + + if (rts.recdat.addr != DisplayZaxis && rts.recdat.addr != DisplayYaxis && rts.recdat.addr != DisplayZaxis) { + rts.sendData(10 * getAxisPosition_mm(axis_t(X)), DisplayXaxis); + rts.sendData(10 * getAxisPosition_mm(axis_t(Y)), DisplayYaxis); + rts.sendData(10 * getAxisPosition_mm(axis_t(Z)), DisplayZaxis); + } + no_reentry = false; +} + +RTS::RTS() { + recdat.head[0] = snddat.head[0] = FHONE; + recdat.head[1] = snddat.head[1] = FHTWO; + ZERO(databuf); +} + +int16_t RTS::receiveData() { + uint8_t receivedbyte; + while (DWIN_SERIAL.available()) + switch (rx_datagram_state) { + + case DGUS_IDLE: // Waiting for the first header byte + receivedbyte = DWIN_SERIAL.read(); + if (FHONE == receivedbyte) rx_datagram_state = DGUS_HEADER1_SEEN; + break; + + case DGUS_HEADER1_SEEN: // Waiting for the second header byte + receivedbyte = DWIN_SERIAL.read(); + rx_datagram_state = (FHTWO == receivedbyte) ? DGUS_HEADER2_SEEN : DGUS_IDLE; + break; + + case DGUS_HEADER2_SEEN: // Waiting for the length byte + rx_datagram_len = DWIN_SERIAL.read(); + //DEBUGLCDCOMM_ECHOPGM(" (", rx_datagram_len, ") "); + + // Telegram min len is 3 (command and one word of payload) + rx_datagram_state = WITHIN(rx_datagram_len, 3, DGUS_RX_BUFFER_SIZE) ? DGUS_WAIT_TELEGRAM : DGUS_IDLE; + break; + + case DGUS_WAIT_TELEGRAM: // wait for complete datagram to arrive. + if (DWIN_SERIAL.available() < rx_datagram_len) return -1; + + uint8_t command = DWIN_SERIAL.read(); + + //DEBUGLCDCOMM_ECHOPGM("# ", command); + + uint8_t readlen = rx_datagram_len - 1; // command is part of len. + uint8_t tmp[rx_datagram_len - 1]; + uint8_t *ptmp = tmp; + while (readlen--) { + receivedbyte = DWIN_SERIAL.read(); + //DEBUGLCDCOMM_ECHOPGM(" ", receivedbyte); + *ptmp++ = receivedbyte; + } + //DEBUGLCDCOMM_ECHOPGM(" # "); + // mostly we'll get this: 5A A5 03 82 4F 4B -- ACK on 0x82, so discard it. + if (command == VarAddr_W && 'O' == tmp[0] && 'K' == tmp[1]) { + rx_datagram_state = DGUS_IDLE; + break; + } + + /* AutoUpload, (and answer to) Command 0x83 : + | tmp[0 1 2 3 4 ... ] + | Example 5A A5 06 83 20 01 01 78 01 …… + | / / | | \ / | \ \ + | Header | | | | \_____\_ DATA (Words!) + | DatagramLen / VPAdr | + | Command DataLen (in Words) */ + if (command == VarAddr_R) { + const uint16_t vp = tmp[0] << 8 | tmp[1]; + + const uint8_t dlen = tmp[2] << 1; // Convert to Bytes. (Display works with words) + recdat.addr = vp; + recdat.len = tmp[2]; + for (uint16_t i = 0; i < dlen; i += 2) { + recdat.data[i / 2] = tmp[3 + i]; + recdat.data[i / 2] = (recdat.data[i / 2] << 8 ) | tmp[4 + i]; + } + + rx_datagram_state = DGUS_IDLE; + return 2; + break; + } + + // discard anything else + rx_datagram_state = DGUS_IDLE; + } + return -1; +} + +void RTS::sendData() { + if (snddat.head[0] == FHONE && snddat.head[1] == FHTWO && snddat.len >= 3) { + databuf[0] = snddat.head[0]; + databuf[1] = snddat.head[1]; + databuf[2] = snddat.len; + databuf[3] = snddat.command; + if (snddat.command == 0x80) { // to write data to the register + databuf[4] = snddat.addr; + for (int16_t i = 0; i < (snddat.len - 2); i++) databuf[5 + i] = snddat.data[i]; + } + else if (snddat.len == 3 && (snddat.command == 0x81)) { // to read data from the register + databuf[4] = snddat.addr; + databuf[5] = snddat.bytelen; + } + else if (snddat.command == 0x82) { // to write data to the variate + databuf[4] = snddat.addr >> 8; + databuf[5] = snddat.addr & 0xFF; + for (int16_t i = 0; i < (snddat.len - 3); i += 2) { + databuf[6 + i] = snddat.data[i / 2] >> 8; + databuf[7 + i] = snddat.data[i / 2] & 0xFF; + } + } + else if (snddat.len == 4 && (snddat.command == 0x83)) { // to read data from the variate + databuf[4] = snddat.addr >> 8; + databuf[5] = snddat.addr & 0xFF; + databuf[6] = snddat.bytelen; + } + for (int16_t i = 0; i < (snddat.len + 3); i++) { + DWIN_SERIAL.write(databuf[i]); + delay_us(1); + } + + memset(&snddat, 0, sizeof(snddat)); + ZERO(databuf); + snddat.head[0] = FHONE; + snddat.head[1] = FHTWO; + } +} + +void RTS::sendData(const String &s, uint32_t addr, uint8_t cmd/*=VarAddr_W*/) { + if (s.length() < 1) return; + sendData(s.c_str(), addr, cmd); +} + +void RTS::sendData(const char *str, uint32_t addr, uint8_t cmd/*=VarAddr_W*/) { + int16_t len = strlen(str); + constexpr int16_t maxlen = DATA_BUF_SIZE - 6; + if (len > 0) { + if (len > maxlen) len = maxlen; + databuf[0] = FHONE; + databuf[1] = FHTWO; + databuf[2] = 3 + len; + databuf[3] = cmd; + databuf[4] = addr >> 8; + databuf[5] = addr & 0x00FF; + for (int16_t i = 0; i < len; i++) databuf[6 + i] = str[i]; + + for (int16_t i = 0; i < (len + 6); i++) { + DWIN_SERIAL.write(databuf[i]); + delay_us(1); + } + ZERO(databuf); + } +} + +void RTS::sendData(const char c, const uint32_t addr, const uint8_t cmd/*=VarAddr_W*/) { + snddat.command = cmd; + snddat.addr = addr; + snddat.data[0] = uint32_t(uint16_t(c) << 8); + snddat.len = 5; + sendData(); +} + +void RTS::sendData(const_float_t f, const uint32_t addr, const uint8_t cmd/*=VarAddr_W*/) { + int16_t n = f; + if (cmd == VarAddr_W) { + snddat.data[0] = n; + snddat.len = 5; + } + else if (cmd == RegAddr_W) { + snddat.data[0] = n; + snddat.len = 3; + } + else if (cmd == VarAddr_R) { + snddat.bytelen = n; + snddat.len = 4; + } + snddat.command = cmd; + snddat.addr = addr; + sendData(); +} + +void RTS::sendData(const int n, const uint32_t addr, const uint8_t cmd/*=VarAddr_W*/) { + if (cmd == VarAddr_W) { + if ((unsigned int)n > 0xFFFF) { + snddat.data[0] = n >> 16; + snddat.data[1] = n & 0xFFFF; + snddat.len = 7; + } + else { + snddat.data[0] = n; + snddat.len = 5; + } + } + else if (cmd == RegAddr_W) { + snddat.data[0] = n; + snddat.len = 3; + } + else if (cmd == VarAddr_R) { + snddat.bytelen = n; + snddat.len = 4; + } + snddat.command = cmd; + snddat.addr = addr; + sendData(); +} + +void RTS::sendData(const unsigned long n, uint32_t addr, uint8_t cmd/*=VarAddr_W*/) { + if (cmd == VarAddr_W) { + if (n > 0xFFFF) { + snddat.data[0] = n >> 16; + snddat.data[1] = n & 0xFFFF; + //snddat.data[0] = n >> 24; + //snddat.data[1] = n >> 16; + //snddat.data[2] = n >> 8; + //snddat.data[3] = n; + snddat.len = 7; + } + else { + snddat.data[0] = n; + snddat.len = 5; + } + } + else if (cmd == VarAddr_R) { + snddat.bytelen = n; + snddat.len = 4; + } + snddat.command = cmd; + snddat.addr = addr; + sendData(); +} + +void RTS::handleData() { + int16_t Checkkey = -1; + if (waitway > 0) { // for waiting + memset(&recdat, 0, sizeof(recdat)); + recdat.head[0] = FHONE; + recdat.head[1] = FHTWO; + return; + } + for (int16_t i = 0; Addrbuf[i] != 0; i++) + if (recdat.addr == Addrbuf[i]) { + if (Addrbuf[i] == NzBdSet || Addrbuf[i] == NozzlePreheat || Addrbuf[i] == BedPreheat || Addrbuf[i] == Flowrate) + Checkkey = ManualSetTemp; + else if (WITHIN(Addrbuf[i], Stopprint, Resumeprint)) + Checkkey = PrintChoice; + else if (WITHIN(Addrbuf[i], AutoZero, DisplayZaxis)) + Checkkey = XYZEaxis; + else if (WITHIN(Addrbuf[i], FilamentUnit1, FilamentUnit2)) + Checkkey = Filament; + else + Checkkey = i; + break; + } + + switch (recdat.addr) { + case Flowrate: + case StepMM_X ... StepMM_E: + case ProbeOffset_X ... ProbeOffset_Y: + case HotendPID_AutoTmp ... BedPID_AutoTmp: + case HotendPID_P ... HotendPID_D: + case BedPID_P ... BedPID_D: + case T2Offset_X ... T2StepMM_E: + case Accel_X ... Accel_E: + case Feed_X ... Feed_E: + case Jerk_X ... Jerk_E: + case RunoutToggle: + case PowerLossToggle: + case FanKeyIcon: + case LedToggle: + case e2Preheat: Checkkey = ManualSetTemp; break; + case ProbeOffset_Z: Checkkey = Zoffset_Value; break; + case VolumeDisplay: Checkkey = VolumeDisplay; break; + case DisplayBrightness: Checkkey = DisplayBrightness; break; + case DisplayStandbyBrightness: Checkkey = DisplayStandbyBrightness; break; + case DisplayStandbySeconds: Checkkey = DisplayStandbySeconds; break; + default: + if (WITHIN(recdat.addr, AutolevelVal, 4400)) // (int16_t(AutolevelVal) + GRID_MAX_POINTS * 2) = 4400 with 5x5 mesh + Checkkey = AutolevelVal; + else if (WITHIN(recdat.addr, SDFILE_ADDR, SDFILE_ADDR + 10 * (FileNum + 1))) + Checkkey = Filename; + break; + } + + if (Checkkey < 0) { + memset(&recdat, 0, sizeof(recdat)); + recdat.head[0] = FHONE; + recdat.head[1] = FHTWO; + return; + } + + constexpr float lfrb[4] = BED_TRAMMING_INSET_LFRB; + + switch (Checkkey) { + case Printfile: + if (recdat.data[0] == 1) { // card + show_status = false; + filenavigator.getFiles(0); + fileIndex = 0; + recordcount = 0; + sendData(ExchangePageBase + 46, ExchangepageAddr); + } + else if (recdat.data[0] == 2) { // return after printing result. + show_status = true; + tpShowStatus = false; + stopPrint(); + injectCommands(F("M84")); + sendData(11, FilenameIcon); + sendData(0, PrintscheduleIcon); + sendData(0, PrintscheduleIcon + 1); + sendData(0, Percentage); + delay_ms(2); + sendData(0, Timehour); + sendData(0, Timemin); + + sendData(ExchangePageBase + 45, ExchangepageAddr); // exchange to 45 page + } + else if (recdat.data[0] == 3) { // Temperature control + show_status = true; + tpShowStatus = false; + if (getTargetFan_percent((fan_t)getActiveTool()) == 0) + sendData(ExchangePageBase + 58, ExchangepageAddr); // exchange to 58 page, the fans off + else + sendData(ExchangePageBase + 57, ExchangepageAddr); // exchange to 57 page, the fans on + } + else if (recdat.data[0] == 4) { // Settings + show_status = false; + } + break; + + case Adjust: + if (recdat.data[0] == 1) { + show_status = false; + } + else if (recdat.data[0] == 2) { + show_status = true; + if (printerStatusKey[1] == 3) // during heating + sendData(ExchangePageBase + 53, ExchangepageAddr); + else if (printerStatusKey[1] == 4) + sendData(ExchangePageBase + 54, ExchangepageAddr); + else + sendData(ExchangePageBase + 53, ExchangepageAddr); + } + else if (recdat.data[0] == 3) + setTargetFan_percent(getTargetFan_percent((fan_t)getActiveTool()) != 0 ? 100 : 0, FAN0); + + break; + + case Feedrate: + setFeedrate_percent(recdat.data[0]); + break; + + case PrintChoice: + if (recdat.addr == Stopprint) { + if (recdat.data[0] == 240) { // no + sendData(ExchangePageBase + 53, ExchangepageAddr); + } + else { + sendData(ExchangePageBase + 45, ExchangepageAddr); + sendData(0, Timehour); + sendData(0, Timemin); + stopPrint(); + } + } + else if (recdat.addr == Pauseprint) { + if (recdat.data[0] != 0xF1) + break; + + sendData(ExchangePageBase + 54, ExchangepageAddr); + pausePrint(); + } + else if (recdat.addr == Resumeprint && recdat.data[0] == 1) { + resumePrint(); + + printerStatusKey[1] = 0; + show_status = true; + + sendData(ExchangePageBase + 53, ExchangepageAddr); + } + if (recdat.addr == Resumeprint && recdat.data[0] == 2) { // warming + resumePrint(); + nozzleTempStatus[2] = 1; + printerStatusKey[1] = 0; + show_status = true; + sendData(ExchangePageBase + 82, ExchangepageAddr); + } + break; + + case Zoffset: + float tmp_zprobe_offset; + if (recdat.data[0] >= 32768) + tmp_zprobe_offset = (float(recdat.data[0]) - 65536) / 100; + else + tmp_zprobe_offset = float(recdat.data[0]) / 100; + if (WITHIN((tmp_zprobe_offset), Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { + int16_t tmpSteps = mmToWholeSteps(getZOffset_mm() - tmp_zprobe_offset, axis_t(Z)); + if (tmpSteps == 0) tmpSteps = getZOffset_mm() < tmp_zprobe_offset ? 1 : -1; + smartAdjustAxis_steps(-tmpSteps, axis_t(Z), false); + char zOffs[20], tmp1[11]; + sprintf_P(zOffs, PSTR("Z Offset : %s"), dtostrf(getZOffset_mm(), 1, 3, tmp1)); + onStatusChanged(zOffs); + } + else { + onStatusChanged(F("Requested Offset Beyond Limits")); + } + + sendData(getZOffset_mm() * 100, ProbeOffset_Z); + break; + + case TempControl: + if (recdat.data[0] == 0) { + show_status = true; + tpShowStatus = false; + } + else if (recdat.data[0] == 1) { + if (getTargetFan_percent((fan_t)getActiveTool()) == 0) + sendData(ExchangePageBase + 60, ExchangepageAddr); // exchange to 60 page, the fans off + else + sendData(ExchangePageBase + 59, ExchangepageAddr); // exchange to 59 page, the fans on + } + else if (recdat.data[0] == 2) { + show_status = true; + } + else if (recdat.data[0] == 3) { + if (getTargetFan_percent((fan_t)getActiveTool()) == 0) { // turn on the fan + setTargetFan_percent(100, FAN0); + sendData(ExchangePageBase + 57, ExchangepageAddr); // exchange to 57 page, the fans on + } + else { // turn off the fan + setTargetFan_percent(0, FAN0); + sendData(ExchangePageBase + 58, ExchangepageAddr); // exchange to 58 page, the fans on + } + } + else if (recdat.data[0] == 5) { // PLA mode + setTargetTemp_celsius(PREHEAT_1_TEMP_HOTEND, getActiveTool()); + setTargetTemp_celsius(PREHEAT_1_TEMP_BED, BED); + sendData(PREHEAT_1_TEMP_HOTEND, NozzlePreheat); + sendData(PREHEAT_1_TEMP_BED, BedPreheat); + } + else if (recdat.data[0] == 6) { // ABS mode + setTargetTemp_celsius(PREHEAT_2_TEMP_HOTEND, getActiveTool()); + setTargetTemp_celsius(PREHEAT_2_TEMP_BED, BED); + sendData(PREHEAT_2_TEMP_HOTEND, NozzlePreheat); + sendData(PREHEAT_2_TEMP_BED, BedPreheat); + } + else if (recdat.data[0] == 0xF1) { + //show_status = true; + #if FAN_COUNT > 0 + for (uint8_t i = 0; i < FAN_COUNT; i++) setTargetFan_percent(0, (fan_t)i); + #endif + setTargetTemp_celsius(0.0, H0); + TERN_(HAS_MULTI_HOTEND, setTargetTemp_celsius(0.0, H1)); + setTargetTemp_celsius(0.0, BED); + sendData(0, NozzlePreheat); delay_ms(1); + sendData(0, BedPreheat); delay_ms(1); + sendData(ExchangePageBase + 57, ExchangepageAddr); + printerStatusKey[1] = 2; + } + break; + + case ManualSetTemp: + if (recdat.addr == NzBdSet) { + if (recdat.data[0] == 0) { + if (getTargetFan_percent((fan_t)getActiveTool()) == 0) + sendData(ExchangePageBase + 58, ExchangepageAddr); // exchange to 58 page, the fans off + else + sendData(ExchangePageBase + 57, ExchangepageAddr); // exchange to 57 page, the fans on + } + else if (recdat.data[0] == 1) { + setTargetTemp_celsius(0.0, getActiveTool()); + sendData(0, NozzlePreheat); + } + else if (recdat.data[0] == 2) { + setTargetTemp_celsius(0.0, BED); + sendData(0, BedPreheat); + } + } + else if (recdat.addr == NozzlePreheat) { + setTargetTemp_celsius(float(recdat.data[0]), H0); + } + #if HAS_MULTI_HOTEND + else if (recdat.addr == e2Preheat) { + setTargetTemp_celsius(float(recdat.data[0]), H1); + } + #endif + else if (recdat.addr == BedPreheat) { + setTargetTemp_celsius(float(recdat.data[0]), BED); + } + else if (recdat.addr == Flowrate) { + setFlow_percent(int16_t(recdat.data[0]), getActiveTool()); + } + + #if HAS_PID_HEATING + else if (recdat.addr == HotendPID_AutoTmp) { + pid_hotendAutoTemp = uint16_t(recdat.data[0]); + } + else if (recdat.addr == BedPID_AutoTmp) { + pid_bedAutoTemp = uint16_t(recdat.data[0]); + } + #endif + + else if (recdat.addr == Accel_X) { + setAxisMaxAcceleration_mm_s2(uint16_t(recdat.data[0]) * 100, X); + } + else if (recdat.addr == Accel_Y) { + setAxisMaxAcceleration_mm_s2(uint16_t(recdat.data[0]) * 100, Y); + } + else if (recdat.addr == Accel_Z) { + setAxisMaxAcceleration_mm_s2(uint16_t(recdat.data[0]) * 10, Z); + } + else if (recdat.addr == Accel_E) { + setAxisMaxAcceleration_mm_s2(uint16_t(recdat.data[0]), E0); + setAxisMaxAcceleration_mm_s2(uint16_t(recdat.data[0]), E1); + } + + else if (recdat.addr == Feed_X) { + setAxisMaxFeedrate_mm_s(uint16_t(recdat.data[0]), X); + } + else if (recdat.addr == Feed_Y) { + setAxisMaxFeedrate_mm_s(uint16_t(recdat.data[0]), Y); + } + else if (recdat.addr == Feed_Z) { + setAxisMaxFeedrate_mm_s(uint16_t(recdat.data[0]), Z); + } + else if (recdat.addr == Feed_E) { + setAxisMaxFeedrate_mm_s(uint16_t(recdat.data[0]), E0); + setAxisMaxFeedrate_mm_s(uint16_t(recdat.data[0]), E1); + } + else if (recdat.addr == FanKeyIcon) { + setTargetFan_percent(uint16_t(recdat.data[0]), (fan_t)getActiveTool()); + } + else { + float tmp_float_handling; + if (recdat.data[0] >= 32768) + tmp_float_handling = (float(recdat.data[0]) - 65536) / 100; + else + tmp_float_handling = float(recdat.data[0]) / 100; + if (recdat.addr == StepMM_X) { + setAxisSteps_per_mm(tmp_float_handling * 10, X); + } + else if (recdat.addr == StepMM_Y) { + setAxisSteps_per_mm(tmp_float_handling * 10, Y); + } + else if (recdat.addr == StepMM_Z) { + setAxisSteps_per_mm(tmp_float_handling * 10, Z); + } + else if (recdat.addr == StepMM_E) { + setAxisSteps_per_mm(tmp_float_handling * 10, E0); + #if DISABLED(DUAL_X_CARRIAGE) + setAxisSteps_per_mm(tmp_float_handling * 10, E1); + #endif + } + #if ENABLED(DUAL_X_CARRIAGE) + else if (recdat.addr == T2StepMM_E) { + setAxisSteps_per_mm(tmp_float_handling * 10, E1); + } + else if (recdat.addr == T2Offset_X) { + setNozzleOffset_mm(tmp_float_handling * 10, X, E1); + } + else if (recdat.addr == T2Offset_Y) { + setNozzleOffset_mm(tmp_float_handling * 10, Y, E1); + } + else if (recdat.addr == T2Offset_Z) { + setNozzleOffset_mm(tmp_float_handling * 10, Z, E1); + } + #endif + #if HAS_BED_PROBE + else if (recdat.addr == ProbeOffset_X) { + setProbeOffset_mm(tmp_float_handling, X); + } + else if (recdat.addr == ProbeOffset_Y) { + setProbeOffset_mm(tmp_float_handling, Y); + } + else if (recdat.addr == ProbeOffset_Z) { + setProbeOffset_mm(tmp_float_handling, Z); + } + #endif + + #if ENABLED(CLASSIC_JERK) + else if (recdat.addr == Jerk_X) { + setAxisMaxJerk_mm_s(tmp_float_handling, X); + } + else if (recdat.addr == Jerk_Y) { + setAxisMaxJerk_mm_s(tmp_float_handling, Y); + } + else if (recdat.addr == Jerk_Z) { + setAxisMaxJerk_mm_s(tmp_float_handling, Z); + } + else if (recdat.addr == Jerk_E) { + setAxisMaxJerk_mm_s(tmp_float_handling, E0); + setAxisMaxJerk_mm_s(tmp_float_handling, E1); + } + #endif + + #if HAS_FILAMENT_SENSOR + else if (recdat.addr == RunoutToggle) { + setFilamentRunoutEnabled(!getFilamentRunoutEnabled()); + } + #endif + + #if ENABLED(POWER_LOSS_RECOVERY) + else if (recdat.addr == PowerLossToggle) { + setPowerLossRecoveryEnabled(!getPowerLossRecoveryEnabled()); + } + #endif + + #if ENABLED(CASE_LIGHT_ENABLE) + else if (recdat.addr == LedToggle) { + setCaseLightState(!getCaseLightState()); + } + #endif + + #if HAS_PID_HEATING + else if (recdat.addr == HotendPID_P) { + setPID(tmp_float_handling * 10, getPID_Ki(getActiveTool()), getPID_Kd(getActiveTool()), getActiveTool()); + } + else if (recdat.addr == HotendPID_I) { + setPID(getPID_Kp(getActiveTool()), tmp_float_handling * 10, getPID_Kd(getActiveTool()), getActiveTool()); + } + else if (recdat.addr == HotendPID_D) { + setPID(getPID_Kp(getActiveTool()), getPID_Ki(getActiveTool()), tmp_float_handling * 10, getActiveTool()); + } + #if ENABLED(PIDTEMPBED) + else if (recdat.addr == BedPID_P) { + setBedPID(tmp_float_handling * 10, getBedPID_Ki(), getBedPID_Kd()); + } + else if (recdat.addr == BedPID_I) { + setBedPID(getBedPID_Kp(), tmp_float_handling * 10, getBedPID_Kd()); + } + else if (recdat.addr == BedPID_D) { + setBedPID(getBedPID_Kp(), getBedPID_Ki(), tmp_float_handling * 10); + } + #endif + #endif // HAS_PID_HEATING + } + break; + + case Setting: + if (recdat.data[0] == 0) { // return to main page + show_status = true; + tpShowStatus = false; + } + else if (recdat.data[0] == 1) { // Bed Autoleveling + #if HAS_MESH + sendData(getLevelingActive() ? 3 : 2, AutoLevelIcon); + + if (ExtUI::getMeshValid()) { + uint8_t abl_probe_index = 0; + for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) + for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) { + const bool zig = outer & 1; + const xy_uint8_t point = { uint8_t(zig ? (GRID_MAX_POINTS_X - 1) - inner : inner), outer }; + sendData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + abl_probe_index * 2); + ++abl_probe_index; + } + } + #endif + sendData(10, FilenameIcon); // Motor Icon + injectCommands(isPositionKnown() ? F("G1F1000Z0.0") : F("G28\nG1F1000Z0.0")); + waitway = 2; + sendData(ExchangePageBase + 64, ExchangepageAddr); + } + else if (recdat.data[0] == 2) { // Exchange filament + show_status = true; + tpShowStatus = false; + ZERO(changeMaterialBuf); + changeMaterialBuf[1] = changeMaterialBuf[0] = 10; + sendData(10 * changeMaterialBuf[0], FilamentUnit1); // It's changeMaterialBuf for show, instead of current_position.e in them. + sendData(10 * changeMaterialBuf[1], FilamentUnit2); + sendData(getActualTemp_celsius(H0), NozzleTemp); + sendData(getTargetTemp_celsius(H0), NozzlePreheat); + sendData(TERN0(HAS_MULTI_HOTEND, getActualTemp_celsius(H1)), e2Temp); + sendData(TERN0(HAS_MULTI_HOTEND, getTargetTemp_celsius(H1)), e2Preheat); + delay_ms(2); + sendData(ExchangePageBase + 65, ExchangepageAddr); + } + else if (recdat.data[0] == 3) { // Move + axisPageNum = 0; + sendData(ExchangePageBase + 71, ExchangepageAddr); + } + else if (recdat.data[0] == 4) { // Language + // Just loads language screen, now used for tools + } + else if (recdat.data[0] == 5) { // Printer Information + sendData(WEBSITE_URL, CorpWebsite); + } + else if (recdat.data[0] == 6) { // Diabalestepper + injectCommands(F("M84")); + sendData(11, FilenameIcon); + } + break; + + case ReturnBack: + if (recdat.data[0] == 1) { // return to the tool page + show_status = false; + sendData(ExchangePageBase + 63, ExchangepageAddr); + } + if (recdat.data[0] == 2) // return to the Level mode page + sendData(ExchangePageBase + 64, ExchangepageAddr); + break; + + case Bedlevel: + switch (recdat.data[0]) { + case 1: { // Z-axis to home + // Disallow Z homing if X or Y are unknown + injectCommands(isAxisPositionKnown(axis_t(X)) && isAxisPositionKnown(axis_t(Y)) ? F("G28Z\nG1F1500Z0.0") : F("G28\nG1F1500Z0.0")); + sendData(getZOffset_mm() * 100, ProbeOffset_Z); + break; + } + case 2: { // Z-axis to Up + if (WITHIN((getZOffset_mm() + 0.1), Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { + smartAdjustAxis_steps(getAxisSteps_per_mm(Z) / 10, axis_t(Z), false); + //setZOffset_mm(getZOffset_mm() + 0.1); + sendData(getZOffset_mm() * 100, ProbeOffset_Z); + char zOffs[20], tmp1[11]; + sprintf_P(zOffs, PSTR("Z Offset : %s"), dtostrf(getZOffset_mm(), 1, 3, tmp1)); + onStatusChanged(zOffs); + } + break; + } + case 3: { // Z-axis to Down + if (WITHIN((getZOffset_mm() - 0.1), Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { + smartAdjustAxis_steps(-getAxisSteps_per_mm(Z) / 10, axis_t(Z), false); + //babystepAxis_steps(int16_t(-getAxisSteps_per_mm(Z)) / 10, axis_t(Z)); + //setZOffset_mm(getZOffset_mm() - 0.1); + sendData(getZOffset_mm() * 100, ProbeOffset_Z); + char zOffs[20], tmp1[11]; + sprintf_P(zOffs, PSTR("Z Offset : %s"), dtostrf(getZOffset_mm(), 1, 3, tmp1)); + onStatusChanged(zOffs); + } + break; + } + case 4: { // Assistant Level + TERN_(HAS_MESH, setLevelingActive(false)); + injectCommands(isPositionKnown() ? F("G1 F1000 Z0.0") : F("G28\nG1 F1000 Z0.0")); + waitway = 2; + sendData(ExchangePageBase + 84, ExchangepageAddr); + break; + } + case 5: { // AutoLevel "Measuring" Button + #if ENABLED(MESH_BED_LEVELING) + sendData(ExchangePageBase + 93, ExchangepageAddr); + #else + waitway = 3; // only for prohibiting to receive massage + sendData(3, AutolevelIcon); + uint8_t abl_probe_index = 0; + while (abl_probe_index < 25) { + sendData(0, AutolevelVal + abl_probe_index * 2); + ++abl_probe_index; + } + sendData(ExchangePageBase + 64, ExchangepageAddr); + injectCommands(F(MEASURING_GCODE)); + #endif + break; + } + + case 6: { // Assitant Level , Centre 1 + setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z)); + setAxisPosition_mm(X_CENTER, axis_t(X)); + setAxisPosition_mm(Y_CENTER, axis_t(Y)); + waitway = 6; + break; + } + case 7: { // Assitant Level , Front Left 2 + setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z)); + setAxisPosition_mm(X_MIN_BED + lfrb[0], axis_t(X)); + setAxisPosition_mm(Y_MIN_BED + lfrb[1], axis_t(Y)); + waitway = 6; + break; + } + case 8: { // Assitant Level , Front Right 3 + setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z)); + setAxisPosition_mm(X_MAX_BED - lfrb[2], axis_t(X)); + setAxisPosition_mm(Y_MIN_BED + lfrb[1], axis_t(Y)); + waitway = 6; + break; + } + case 9: { // Assitant Level , Back Right 4 + setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z)); + setAxisPosition_mm(X_MAX_BED - lfrb[2], axis_t(X)); + setAxisPosition_mm(Y_MAX_BED - lfrb[3], axis_t(Y)); + waitway = 6; + break; + } + case 10: { // Assitant Level , Back Left 5 + setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z)); + setAxisPosition_mm(X_MIN_BED + lfrb[0], axis_t(X)); + setAxisPosition_mm(Y_MAX_BED - lfrb[3], axis_t(Y)); + waitway = 6; + break; + } + case 11: { // Autolevel switch + #if HAS_MESH + const bool gla = !getLevelingActive(); + setLevelingActive(gla); + sendData(gla ? 3 : 2, AutoLevelIcon); + #endif + sendData(getZOffset_mm() * 100, ProbeOffset_Z); + break; + } + case 12: { + injectCommands(F("G26R255")); + onStatusChanged(F("Beginning G26.. Heating")); + break; + } + case 13: { + injectCommands(F("G29S1")); + onStatusChanged(F("Begin Manual Mesh")); + break; + } + case 14: { + injectCommands(F("G29S2")); + onStatusChanged(F("Moving to Next Mesh Point")); + break; + } + case 15: { + injectCommands(F("M211S0\nG91\nG1Z-0.025\nG90\nM211S1")); + onStatusChanged(F("Moved down 0.025")); + break; + } + case 16: { + injectCommands(F("M211S0\nG91\nG1Z0.025\nG90\nM211S1")); + onStatusChanged(F("Moved up 0.025")); + break; + } + case 17: { + dwin_settings.display_volume = 0; + dwin_settings.display_sound = false; + setTouchScreenConfiguration(); + break; + } + case 18: { + dwin_settings.display_volume = 255; + dwin_settings.display_sound = true; + setTouchScreenConfiguration(); + break; + } + case 19: { + dwin_settings.screen_brightness = 10; + setTouchScreenConfiguration(); + break; + } + case 20: { + dwin_settings.screen_brightness = 100; + setTouchScreenConfiguration(); + break; + } + case 21: { + dwin_settings.display_standby ^= true; + setTouchScreenConfiguration(); + break; + } + case 22: { + dwin_settings.screen_rotation = dwin_settings.screen_rotation == 10 ? 0 : 10; + setTouchScreenConfiguration(); + break; + } + case 23: { // Set IDEX Autopark + injectCommands(F("M605S1\nG28X\nG1X0")); + break; + } + case 24: { // Set IDEX Duplication + injectCommands(F("M605S1\nT0\nG28\nM605S2\nG28X\nG1X0")); + break; + } + case 25: { // Set IDEX Mirrored Duplication + injectCommands(F("M605S1\nT0\nG28\nM605S2\nG28X\nG1X0\nM605S3")); + break; + } + case 26: { // Set IDEX Full Control + injectCommands(F("M605S0\nG28X")); + break; + } + case 27: { // Change Tool + setActiveTool(getActiveTool() == E0 ? E1 : E0, !isAxisPositionKnown(X)); + break; + } + default: break; + } + + sendData(10, FilenameIcon); + break; + + case XYZEaxis: { + axis_t axis = X; + float min = 0.0f, max = 0.0f; + waitway = 4; + if (recdat.addr == DisplayXaxis) { + axis = X; + min = X_MIN_POS; + max = X_MAX_POS; + } + else if (recdat.addr == DisplayYaxis) { + axis = Y; + min = Y_MIN_POS; + max = Y_MAX_POS; + } + else if (recdat.addr == DisplayZaxis) { + axis = Z; + min = Z_MIN_POS; + max = Z_MAX_POS; + } + else if (recdat.addr == AutoZero) { + if (recdat.data[0] == 3) { // autohome + waitway = 4; + injectCommands(F("G28\nG1 F1000 Z10")); + show_status = autoHomeKey = true; + autoHomeIconNum = 0; + sendData(10, FilenameIcon); + } + else { + axisPageNum = recdat.data[0]; + waitway = 0; + } + break; + } + + float targetPos = float(recdat.data[0]) / 10; + LIMIT(targetPos, min, max); + setAxisPosition_mm(targetPos, axis); + waitway = 0; + sendData(10, FilenameIcon); + break; + } + + case Filament: + + uint16_t IconTemp; + if (recdat.addr == Exchfilament) { + if (getActualTemp_celsius(getActiveTool()) < EXTRUDE_MINTEMP && recdat.data[0] < 5) { + sendData(int16_t(EXTRUDE_MINTEMP), 0x1020); + delay_ms(5); + sendData(ExchangePageBase + 66, ExchangepageAddr); + break; + } + + switch (recdat.data[0]) { + case 1: { // Unload filament1 + setAxisPosition_mm(getAxisPosition_mm(E0) - changeMaterialBuf[0], E0); + break; + } + case 2: { // Load filament1 + setAxisPosition_mm(getAxisPosition_mm(E0) + changeMaterialBuf[0], E0); + break; + } + case 3: { // Unload filament2 + setAxisPosition_mm(getAxisPosition_mm(E1) - changeMaterialBuf[1], E1); + break; + } + case 4: { // Load filament2 + setAxisPosition_mm(getAxisPosition_mm(E1) + changeMaterialBuf[1], E1); + break; + } + case 5: { // sure to heat + nozzleTempStatus[0] = 1; + + setTargetTemp_celsius((PREHEAT_1_TEMP_HOTEND + 10), getActiveTool()); + IconTemp = getActualTemp_celsius(getActiveTool()) * 100 / getTargetTemp_celsius(getActiveTool()); + NOMORE(IconTemp, 100U); + sendData(IconTemp, HeatPercentIcon); + + sendData(getActualTemp_celsius(H0), NozzleTemp); + sendData(getTargetTemp_celsius(H0), NozzlePreheat); + sendData(TERN0(HAS_MULTI_HOTEND, getActualTemp_celsius(H1)), e2Temp); + sendData(TERN0(HAS_MULTI_HOTEND, getTargetTemp_celsius(H1)), e2Preheat); + delay_ms(5); + sendData(ExchangePageBase + 68, ExchangepageAddr); + break; + } + case 6: { // cancel to heat + sendData(ExchangePageBase + 65, ExchangepageAddr); + break; + } + case 0xF1: { // Sure to cancel heating + nozzleTempStatus[0] = 0; + delay_ms(1); + sendData(ExchangePageBase + 65, ExchangepageAddr); + break; + } + case 0xF0: // not to cancel heating + break; + } + sendData(10 * changeMaterialBuf[0], FilamentUnit1); // It's changeMaterialBuf for show, instead of current_position.e in them. + sendData(10 * changeMaterialBuf[1], FilamentUnit2); + } + else if (recdat.addr == FilamentUnit1) { + changeMaterialBuf[0] = float(recdat.data[0]) / 10; + } + else if (recdat.addr == FilamentUnit2) { + changeMaterialBuf[1] = float(recdat.data[0]) / 10; + } + break; + + case LanguageChoice: + + //if (recdat.data[0] == 1) settings.save(); else injectCommands(F("M300")); + + // may at some point use language change screens to save eeprom explicitly + switch (recdat.data[0]) { + case 0: { + injectCommands(F("M500")); + break; + } + case 1: { + sendData(ExchangePageBase + 94, ExchangepageAddr); + break; + } + + #if ENABLED(PIDTEMP) + case 2: { + onStatusChanged(F("Hotend PID Started")); + startPIDTune(static_cast(pid_hotendAutoTemp), getActiveTool()); + break; + } + #endif + + case 3: { + injectCommands(F("M502\nM500")); + break; + } + case 4: { + injectCommands(F("M999\nM280P0S160")); + break; + } + + case 5: { + #if ENABLED(PIDTEMPBED) + onStatusChanged(F("Bed PID Started")); + startBedPIDTune(static_cast(pid_bedAutoTemp)); + #endif + break; + } + case 6: { + injectCommands(F("M500")); + break; + } + default: break; + } + break; + + case No_Filament: + if (recdat.data[0] == 1) { // Filament is out, resume / resume selected on screen + if (ExtUI::pauseModeStatus != PAUSE_MESSAGE_PURGE && ExtUI::pauseModeStatus != PAUSE_MESSAGE_OPTION) { + // setPauseMenuResponse(PAUSE_RESPONSE_RESUME_PRINT); + setUserConfirmed(); + // printerStatusKey[1] = 3; + // pause_resume_selected = true; + } + else { + #if ENABLED(FILAMENT_RUNOUT_SENSOR) + bool runouton = false; + if (getFilamentRunoutState()) { + #if NUM_RUNOUT_SENSORS > 1 + if ((runouton = getFilamentRunoutEnabled(getActiveTool()))) + ExtUI::setFilamentRunoutEnabled(false, getActiveTool()); + #else + if ((runouton = getFilamentRunoutEnabled())) + ExtUI::setFilamentRunoutEnabled(false); + #endif + } + #else + constexpr bool runouton = false; + #endif + if (!runouton) { + setPauseMenuResponse(PAUSE_RESPONSE_RESUME_PRINT); + setUserConfirmed(); + printerStatusKey[1] = 3; + pause_resume_selected = true; + } + } + } + else if (recdat.data[0] == 0) { // Filamet is out, Cancel Selected + if (ExtUI::pauseModeStatus == PAUSE_MESSAGE_PURGE || ExtUI::pauseModeStatus == PAUSE_MESSAGE_OPTION) { + setPauseMenuResponse(PAUSE_RESPONSE_EXTRUDE_MORE); + setUserConfirmed(); + } + } + break; + + #if ENABLED(POWER_LOSS_RECOVERY) + case PwrOffNoF: + if (recdat.data[0] == 1) // Yes: continue to print the 3Dmode during power-off. + injectCommands(F("M1000")); + else if (recdat.data[0] == 2) // No + injectCommands(F("M1000C")); + break; + #endif + + case Volume: + if (recdat.data[0] < 0) + dwin_settings.display_volume = 0; + else if (recdat.data[0] > 255) + dwin_settings.display_volume = 0xFF; + else + dwin_settings.display_volume = recdat.data[0]; + + if (dwin_settings.display_volume == 0) { + sendData(0, VolumeIcon); + sendData(9, SoundIcon); + } + else { + sendData((dwin_settings.display_volume + 1) / 32 - 1, VolumeIcon); + sendData(8, SoundIcon); + } + sendData(dwin_settings.display_volume << 8, SoundAddr + 1); + break; + + case Filename: + if (isMediaInserted() && recdat.addr == FilenameChs) { + + recordcount = recdat.data[0] - 1; + if (filenavigator.currentindex == 0 && filenavigator.folderdepth > 0 && (fileIndex + recordcount) == 0) { + filenavigator.upDIR(); + filenavigator.getFiles(0); + fileIndex = 0; + return; + } + + if (filenavigator.currentindex == 0 && filenavigator.folderdepth > 0) + recordcount = recordcount - 1; // account for return dir link in file index + + for (int16_t j = 1; j <= 4; j++) { // Clear filename BG Color and Frame + sendData(0xFFFFUL, FilenameNature + j * 16); // white + sendData(10, FilenameIcon1 + j); // clean + } + for (int16_t j = 0; j < 10; j++) // clear current filename + sendData(0, Choosefilename + j); + + if (filenavigator.getIndexisDir(fileIndex + recordcount)) { + filenavigator.changeDIR((char *)filenavigator.getIndexName(fileIndex + recordcount)); + filenavigator.getFiles(0); + fileIndex = 0; + return; + } + else { + sendData(filenavigator.getIndexName(fileIndex + recordcount), Choosefilename); + sendData(0x87F0UL, FilenameNature + recdat.data[0] * 16); // Change BG of selected line to Light Green + sendData(6, FilenameIcon1 + recdat.data[0]); // show frame + } + } + else if (recdat.addr == FilenamePlay) { + if (recdat.data[0] == 1 && isMediaInserted()) { // for sure + printFile(filenavigator.getIndexName(fileIndex + recordcount)); + + for (int16_t j = 0; j < 10; j++) // clean screen. + sendData(0, Printfilename + j); + + sendData(filenavigator.getIndexName(fileIndex + recordcount), Printfilename); + + delay_ms(4); + + sendData(ExchangePageBase + 53, ExchangepageAddr); + + tpShowStatus = show_status = true; + printerStatusKey[0] = 1; + printerStatusKey[1] = 3; + fileIndex = 0; + recordcount = 0; + } + else if (recdat.data[0] == 2) { // Page Down + if ((fileIndex + DISPLAY_FILES) < (filenavigator.maxFiles() + (filenavigator.folderdepth != 0))) { + fileIndex = fileIndex + DISPLAY_FILES; + // if(filenavigator.folderdepth!=0 && fileIndex!=0) //Shift to acknowledge Return DIR button on first page + // filenavigator.getFiles(fileIndex-1); + // else + filenavigator.getFiles(fileIndex); + // filenavigator.getFiles(filenavigator.currentindex+1); + } + } + else if (recdat.data[0] == 3) { // Page Up + if (fileIndex >= DISPLAY_FILES) { + fileIndex = fileIndex - DISPLAY_FILES; + // if(filenavigator.folderdepth!=0 && fileIndex!=0) //Shift to acknowledge Return DIR button on first page + // filenavigator.getFiles(filenavigator.currentindex-DISPLAY_FILES); + // else + filenavigator.getFiles(fileIndex); + } + } + else if (recdat.data[0] == 4) { // Page Up + injectCommands(F("M22\nM21")); + } + else if (recdat.data[0] == 0) { // return to main page + show_status = true; + tpShowStatus = false; + } + } + break; + + case VolumeDisplay: { + if (recdat.data[0] == 0) { + dwin_settings.display_volume = 0; + dwin_settings.display_sound = false; + } + else if (recdat.data[0] > 100) { + dwin_settings.display_volume = 255; + dwin_settings.display_sound = true; + } + else { + dwin_settings.display_volume = (uint8_t)map(constrain(recdat.data[0], 0, 100), 0, 100, 0, 255); + dwin_settings.display_sound = true; + } + setTouchScreenConfiguration(); + break; + } + + case DisplayBrightness: { + if (recdat.data[0] < 10) + dwin_settings.screen_brightness = 10; + else if (recdat.data[0] > 100) + dwin_settings.screen_brightness = 100; + else + dwin_settings.screen_brightness = (uint8_t)recdat.data[0]; + setTouchScreenConfiguration(); + break; + } + + case DisplayStandbyBrightness: { + if (recdat.data[0] < 10) + dwin_settings.standby_brightness = 10; + else if (recdat.data[0] > 100) + dwin_settings.standby_brightness = 100; + else + dwin_settings.standby_brightness = (uint8_t)recdat.data[0]; + setTouchScreenConfiguration(); + break; + } + + case DisplayStandbySeconds: { + if (recdat.data[0] < 5) + dwin_settings.standby_time_seconds = 5; + else if (recdat.data[0] > 100) + dwin_settings.standby_time_seconds = 100; + else + dwin_settings.standby_time_seconds = (uint8_t)recdat.data[0]; + setTouchScreenConfiguration(); + break; + } + + case AutolevelVal: { + uint8_t meshPoint = (recdat.addr - AutolevelVal) / 2, + yPnt = floor(meshPoint / GRID_MAX_POINTS_X), + xPnt = meshPoint - (yPnt * GRID_MAX_POINTS_X); + if (yPnt % 2 != 0) xPnt = (GRID_MAX_POINTS_X - 1) - xPnt; // zag row + + float meshVal = float(recdat.data[0] - (recdat.data[0] >= 32768 ? 65536 : 0)) / 1000; + + LIMIT(meshVal, Z_PROBE_LOW_POINT, Z_CLEARANCE_BETWEEN_PROBES); + xy_uint8_t point = { xPnt, yPnt }; + setMeshPoint(point, meshVal); + sendData(meshVal * 1000, recdat.addr); + break; + } + + default: break; + } + + memset(&recdat, 0, sizeof(recdat)); + recdat.head[0] = FHONE; + recdat.head[1] = FHTWO; +} + +void RTS::writeVariable(const uint16_t adr, const void * const values, uint8_t valueslen, const bool isstr/*=false*/, const char fillChar/*=' '*/) { + const char* myvalues = static_cast(values); + bool strend = !myvalues; + DWIN_SERIAL.write(FHONE); + DWIN_SERIAL.write(FHTWO); + DWIN_SERIAL.write(valueslen + 3); + DWIN_SERIAL.write(0x82); + DWIN_SERIAL.write(adr >> 8); + DWIN_SERIAL.write(adr & 0xFF); + while (valueslen--) { + char x; + if (!strend) x = *myvalues++; + if ((isstr && !x) || strend) { + strend = true; + x = fillChar; + } + DWIN_SERIAL.write(x); + } +} + +void RTS::setTouchScreenConfiguration() { + // Main configuration (System_Config) + LIMIT(dwin_settings.screen_brightness, 10, 100); // Prevent a possible all-dark screen + LIMIT(dwin_settings.standby_time_seconds, 10, 655); // Prevent a possible all-dark screen for standby, yet also don't go higher than the DWIN limitation + + uint8_t cfg_bits = (0x0 + | _BV(7) // 7: Enable Control ... TERN0(DWINOS_4, _BV(7)) + | _BV(5) // 5: load 22 touch file + | _BV(4) // 4: auto-upload should always be enabled + | (dwin_settings.display_sound ? _BV(3) : 0) // 3: audio + | (dwin_settings.display_standby ? _BV(2) : 0) // 2: backlight on standby + | (dwin_settings.screen_rotation == 10 ? _BV(1) : 0) // 1 & 0: Inversion + #if LCD_SCREEN_ROTATE == 90 + | _BV(0) // Portrait Mode or 800x480 display has 0 point rotated 90deg from 480x272 display + #elif LCD_SCREEN_ROTATE + #error "Only 90° rotation is supported for the selected LCD." + #endif + ); + + const uint8_t config_set[] = { 0x5A, 0x00, TERN(DWINOS_4, 0x00, 0xFF), cfg_bits }; + writeVariable(0x80 /*System_Config*/, config_set, sizeof(config_set)); + + // Standby brightness (LED_Config) + uint16_t dwinStandbyTimeSeconds = 100 * dwin_settings.standby_time_seconds; /* milliseconds, but divided by 10 (not 5 like the docs say) */ + const uint8_t brightness_set[] = { + dwin_settings.screen_brightness /*% active*/, + dwin_settings.standby_brightness /*% standby*/, + static_cast(dwinStandbyTimeSeconds >> 8), + static_cast(dwinStandbyTimeSeconds) + }; + writeVariable(0x82 /*LED_Config*/, brightness_set, sizeof(brightness_set)); + + if (!dwin_settings.display_sound) { + sendData(0, VolumeIcon); + sendData(9, SoundIcon); + } + else { + sendData((dwin_settings.display_volume + 1) / 32 - 1, VolumeIcon); + sendData(8, SoundIcon); + } + sendData(dwin_settings.display_volume, VolumeIcon - 2); + sendData(dwin_settings.display_volume << 8, SoundAddr + 1); + sendData(map(constrain(dwin_settings.display_volume, 0, 255), 0, 255, 0, 100), VolumeDisplay); + sendData(dwin_settings.screen_brightness, DisplayBrightness); + sendData(dwin_settings.standby_brightness, DisplayStandbyBrightness); + sendData(dwin_settings.standby_time_seconds, DisplayStandbySeconds); + sendData(dwin_settings.display_standby ? 3 : 2, DisplayStandbyEnableIndicator); +} + +#endif // DGUS_LCD_UI_IA_CREALITY diff --git a/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.h b/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.h similarity index 92% rename from Marlin/src/lcd/extui/ia_creality/ia_creality_extui.h rename to Marlin/src/lcd/extui/ia_creality/ia_creality_rts.h index af3824e904855..9ec7d7872f96d 100644 --- a/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.h +++ b/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.h @@ -22,18 +22,18 @@ #pragma once /* **************************************** - * lcd/extui/ia_creality/ia_creality_extui.h + * lcd/extui/ia_creality/ia_creality_rts.h * **************************************** * Extensible_UI implementation for Creality DWIN * 10SPro, Max, CRX, and others - * Based original Creality release, ported to ExtUI for Marlin 2.0 + * Based original Creality release * Written by Insanity Automation, sponsored by Tiny Machines 3D * * ***************************************/ -#include "../ui_api.h" +#include "../../../inc/MarlinConfig.h" -#include +#include /*********************************/ #define FHONE (0x5A) @@ -211,7 +211,7 @@ struct creality_dwin_settings_t { bool display_sound; int8_t screen_rotation; int16_t display_volume; - uint8_t standby_screen_brightness; + uint8_t standby_brightness; uint8_t screen_brightness; int16_t standby_time_seconds; }; @@ -297,3 +297,19 @@ void RTS_Update(); #else #define MEASURING_GCODE MAIN_MENU_ITEM_1_GCODE #endif + +// Data shared by RTS and ExtUI +extern uint16_t fileIndex; +extern uint8_t recordcount; +extern uint8_t startprogress; +extern char waitway; +extern char printerStatusKey[2]; // [0] = 0:ready [1] = 0:keep temperature, 1:heating, 2:cooling, 3:printing +extern bool show_status; +extern bool tpShowStatus; // true: opening time/percentage, false: closing time/percentage +extern uint8_t lastPauseMsgState; +extern creality_dwin_settings_t dwin_settings; +extern bool no_reentry; +#if HAS_PID_HEATING + extern uint16_t pid_hotendAutoTemp; + extern uint16_t pid_bedAutoTemp; +#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 be4682f68f1b3..71f4166ca89ea 100644 --- a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp +++ b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp @@ -137,7 +137,6 @@ void tft_lvgl_init() { #if ENABLED(USB_FLASH_DRIVE_SUPPORT) uint16_t usb_flash_loop = 1000; #if ENABLED(MULTI_VOLUME) && !HAS_SD_HOST_DRIVE - SET_INPUT_PULLUP(SD_DETECT_PIN); if (IS_SD_INSERTED()) card.changeMedia(&card.media_driver_sdcard); else diff --git a/Marlin/src/lcd/extui/nextion/FileNavigator.cpp b/Marlin/src/lcd/extui/nextion/FileNavigator.cpp index 6730370a94e2f..c00ccb4e36903 100644 --- a/Marlin/src/lcd/extui/nextion/FileNavigator.cpp +++ b/Marlin/src/lcd/extui/nextion/FileNavigator.cpp @@ -39,18 +39,18 @@ using namespace ExtUI; #define DEBUG_OUT NEXDEBUGLEVEL #include "../../../core/debug_out.h" -FileList FileNavigator::filelist; // Instance of the Marlin file API -char FileNavigator::currentfoldername[MAX_PATH_LEN]; // Current folder path +FileList FileNavigator::filelist; // ExtUI file API +char FileNavigator::currentDirPath[MAX_PATH_LEN]; // Current folder path uint16_t FileNavigator::lastindex; uint8_t FileNavigator::folderdepth; -uint16_t FileNavigator::currentindex; // override the panel request +uint16_t FileNavigator::currentindex; // override the panel request FileNavigator filenavigator; FileNavigator::FileNavigator() { reset(); } void FileNavigator::reset() { - currentfoldername[0] = '\0'; + currentDirPath[0] = '\0'; folderdepth = 0; currentindex = 0; lastindex = 0; @@ -83,51 +83,51 @@ void FileNavigator::getFiles(uint16_t index) { #endif if (currentindex == 0 && folderdepth > 0) { // Add a link to go up a folder - nextion.SendtoTFT(F("vis p0,1")); - nextion.SendtoTFT(F("\xFF\xFF\xFF")); + nextion.tftSend(F("vis p0,1")); + nextion.tftSend(F("\xFF\xFF\xFF")); SEND_VAL("tmpUP", "0"); files--; } else { - nextion.SendtoTFT(F("vis p0,0")); - nextion.SendtoTFT(F("\xFF\xFF\xFF")); + nextion.tftSend(F("vis p0,0")); + nextion.tftSend(F("\xFF\xFF\xFF")); } for (uint16_t seek = currentindex; seek < currentindex + files; seek++) { if (filelist.seek(seek)) { - nextion.SendtoTFT(F("s")); + nextion.tftSend(F("s")); LCD_SERIAL.print(fcnt); - nextion.SendtoTFT(F(".txt=\"")); + nextion.tftSend(F(".txt=\"")); if (filelist.isDir()) { LCD_SERIAL.print(filelist.shortFilename()); - nextion.SendtoTFT(F("/\"")); - nextion.SendtoTFT(F("\xFF\xFF\xFF")); + nextion.tftSend(F("/\"")); + nextion.tftSend(F("\xFF\xFF\xFF")); - nextion.SendtoTFT(F("l")); + nextion.tftSend(F("l")); LCD_SERIAL.print(fcnt); - nextion.SendtoTFT(F(".txt=\"")); + nextion.tftSend(F(".txt=\"")); LCD_SERIAL.print(filelist.filename()); - nextion.SendtoTFT(F("\"")); - nextion.SendtoTFT(F("\xFF\xFF\xFF")); + nextion.tftSend(F("\"")); + nextion.tftSend(F("\xFF\xFF\xFF")); SEND_PCO2("l", fcnt, "1055"); } else { - LCD_SERIAL.print(currentfoldername); + LCD_SERIAL.print(currentDirPath); LCD_SERIAL.print(filelist.shortFilename()); - nextion.SendtoTFT(F("\"")); - nextion.SendtoTFT(F("\xFF\xFF\xFF")); + nextion.tftSend(F("\"")); + nextion.tftSend(F("\xFF\xFF\xFF")); - nextion.SendtoTFT(F("l")); + nextion.tftSend(F("l")); LCD_SERIAL.print(fcnt); - nextion.SendtoTFT(F(".txt=\"")); + nextion.tftSend(F(".txt=\"")); LCD_SERIAL.print(filelist.longFilename()); - nextion.SendtoTFT(F("\"")); - nextion.SendtoTFT(F("\xFF\xFF\xFF")); + nextion.tftSend(F("\"")); + nextion.tftSend(F("\xFF\xFF\xFF")); } fcnt++; fseek = seek; #if NEXDEBUG(AC_FILE) - DEBUG_ECHOLNPGM("-", seek, " '", filelist.longFilename(), "' '", currentfoldername, "", filelist.shortFilename(), "'\n"); + DEBUG_ECHOLNPGM("-", seek, " '", filelist.longFilename(), "' '", currentDirPath, "", filelist.shortFilename(), "'\n"); #endif } } @@ -137,11 +137,11 @@ void FileNavigator::getFiles(uint16_t index) { void FileNavigator::changeDIR(char *folder) { #if NEXDEBUG(AC_FILE) - DEBUG_ECHOLNPGM("currentfolder: ", currentfoldername, " New: ", folder); + DEBUG_ECHOLNPGM("currentfolder: ", currentDirPath, " New: ", folder); #endif if (folderdepth >= MAX_FOLDER_DEPTH) return; // limit the folder depth - strcat(currentfoldername, folder); - strcat(currentfoldername, "/"); + strcat(currentDirPath, folder); + strcat(currentDirPath, "/"); filelist.changeDir(folder); refresh(); folderdepth++; @@ -155,20 +155,20 @@ void FileNavigator::upDIR() { currentindex = 0; // Remove the last child folder from the stored path if (folderdepth == 0) { - currentfoldername[0] = '\0'; + currentDirPath[0] = '\0'; reset(); } else { char *pos = nullptr; for (uint8_t f = 0; f < folderdepth; f++) - pos = strchr(currentfoldername, '/'); + pos = strchr(currentDirPath, '/'); pos[1] = '\0'; } #if NEXDEBUG(AC_FILE) - DEBUG_ECHOLNPGM("depth: ", folderdepth, " currentfoldername: ", currentfoldername); + DEBUG_ECHOLNPGM("depth: ", folderdepth, " currentDirPath: ", currentDirPath); #endif } -char* FileNavigator::getCurrentFolderName() { return currentfoldername; } +char* FileNavigator::getCurrentDirPath() { return currentDirPath; } #endif // NEXTION_TFT diff --git a/Marlin/src/lcd/extui/nextion/FileNavigator.h b/Marlin/src/lcd/extui/nextion/FileNavigator.h index fd29bceadea70..57773fab5e512 100644 --- a/Marlin/src/lcd/extui/nextion/FileNavigator.h +++ b/Marlin/src/lcd/extui/nextion/FileNavigator.h @@ -41,10 +41,10 @@ class FileNavigator { static void upDIR(); static void changeDIR(char *); static void refresh(); - static char* getCurrentFolderName(); + static char* getCurrentDirPath(); private: static FileList filelist; - static char currentfoldername[MAX_PATH_LEN]; + static char currentDirPath[MAX_PATH_LEN]; static uint16_t lastindex; static uint8_t folderdepth; static uint16_t currentindex; diff --git a/Marlin/src/lcd/extui/nextion/nextion_extui.cpp b/Marlin/src/lcd/extui/nextion/nextion_extui.cpp index bf40fe97ac718..da3e344a35aab 100644 --- a/Marlin/src/lcd/extui/nextion/nextion_extui.cpp +++ b/Marlin/src/lcd/extui/nextion/nextion_extui.cpp @@ -35,9 +35,9 @@ namespace ExtUI { - void onStartup() { nextion.Startup(); } - void onIdle() { nextion.IdleLoop(); } - void onPrinterKilled(FSTR_P const error, FSTR_P const component) { nextion.PrinterKilled(error, component); } + 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() {} @@ -46,8 +46,8 @@ namespace ExtUI { void onPrintTimerPaused() {} void onPrintTimerStopped() {} void onFilamentRunout(const extruder_t) {} - void onUserConfirmRequired(const char * const msg) { nextion.ConfirmationRequest(msg); } - void onStatusChanged(const char * const msg) { nextion.StatusChange(msg); } + void onUserConfirmRequired(const char * const msg) { nextion.confirmationRequest(msg); } + void onStatusChanged(const char * const msg) { nextion.statusChange(msg); } void onHomingStart() {} void onHomingDone() {} @@ -117,7 +117,7 @@ namespace ExtUI { #if HAS_PID_HEATING void onPidTuning(const result_t rst) { // Called for temperature PID tuning result - nextion.PanelInfo(37); + nextion.panelInfo(37); } #endif diff --git a/Marlin/src/lcd/extui/nextion/nextion_tft.cpp b/Marlin/src/lcd/extui/nextion/nextion_tft.cpp index 788be5ac651b5..15c384808f89d 100644 --- a/Marlin/src/lcd/extui/nextion/nextion_tft.cpp +++ b/Marlin/src/lcd/extui/nextion/nextion_tft.cpp @@ -53,7 +53,7 @@ NextionTFT nextion; NextionTFT::NextionTFT() {} -void NextionTFT::Startup() { +void NextionTFT::startup() { selectedfile[0] = '\0'; nextion_command[0] = '\0'; command_len = 0; @@ -76,15 +76,15 @@ void NextionTFT::Startup() { DEBUG_ECHOLNPGM("Nextion Debug Level ", NEXDEBUGLEVEL); } -void NextionTFT::IdleLoop() { - if (ReadTFTCommand()) { - ProcessPanelRequest(); +void NextionTFT::idleLoop() { + if (readTFTCommand()) { + processPanelRequest(); command_len = 0; } UpdateOnChange(); } -void NextionTFT::PrinterKilled(FSTR_P const error, FSTR_P const component) { +void NextionTFT::printerKilled(FSTR_P const error, FSTR_P const component) { SEND_TXT_END("page error"); SEND_TXT_F("t3", F("Error")); SEND_TXT_F("t4", component); @@ -96,21 +96,21 @@ void NextionTFT::PrintFinished() { SEND_TXT_END("page printfinished"); } -void NextionTFT::ConfirmationRequest(const char * const msg) { +void NextionTFT::confirmationRequest(const char * const msg) { SEND_VALasTXT("tmppage.M117", msg); #if NEXDEBUG(N_MARLIN) - DEBUG_ECHOLNPGM("ConfirmationRequest() ", msg, " printer_state:", printer_state); + DEBUG_ECHOLNPGM("confirmationRequest() ", msg, " printer_state:", printer_state); #endif } -void NextionTFT::StatusChange(const char * const msg) { +void NextionTFT::statusChange(const char * const msg) { #if NEXDEBUG(N_MARLIN) - DEBUG_ECHOLNPGM("StatusChange() ", msg, "\nprinter_state:", printer_state); + DEBUG_ECHOLNPGM("statusChange() ", msg, "\nprinter_state:", printer_state); #endif SEND_VALasTXT("tmppage.M117", msg); } -void NextionTFT::SendtoTFT(FSTR_P const fstr/*=nullptr*/) { // A helper to print PROGMEM string to the panel +void NextionTFT::tftSend(FSTR_P const fstr/*=nullptr*/) { // A helper to print PROGMEM string to the panel #if NEXDEBUG(N_SOME) DEBUG_ECHOF(fstr); #endif @@ -118,7 +118,7 @@ void NextionTFT::SendtoTFT(FSTR_P const fstr/*=nullptr*/) { // A helper to print while (const char c = pgm_read_byte(str++)) LCD_SERIAL.write(c); } -bool NextionTFT::ReadTFTCommand() { +bool NextionTFT::readTFTCommand() { bool command_ready = false; while ((LCD_SERIAL.available() > 0) && (command_len < MAX_CMND_LEN)) { nextion_command[command_len] = LCD_SERIAL.read(); @@ -149,15 +149,15 @@ bool NextionTFT::ReadTFTCommand() { return command_ready; } -void NextionTFT::SendFileList(int8_t startindex) { +void NextionTFT::sendFileList(int8_t startindex) { // respond to panel request for 7 files starting at index #if NEXDEBUG(N_INFO) - DEBUG_ECHOLNPGM("## SendFileList ## ", startindex); + DEBUG_ECHOLNPGM("## sendFileList ## ", startindex); #endif filenavigator.getFiles(startindex); } -void NextionTFT::SelectFile() { +void NextionTFT::selectFile() { strncpy(selectedfile, nextion_command + 4, command_len - 4); selectedfile[command_len - 5] = '\0'; #if NEXDEBUG(N_FILE) @@ -169,11 +169,11 @@ void NextionTFT::SelectFile() { break; case '<': // .. (go up folder level) filenavigator.upDIR(); - SendFileList(0); + sendFileList(0); break; default: // enter sub folder filenavigator.changeDIR(selectedfile); - SendFileList(0); + sendFileList(0); break; } } @@ -188,24 +188,24 @@ void NextionTFT::_format_time(char *outstr, uint32_t time) { sprintf_P(outstr, PSTR("%02d:%02ds"), min, sec); } -void NextionTFT::ProcessPanelRequest() { +void NextionTFT::processPanelRequest() { // Break these up into logical blocks as its easier to navigate than one huge switch case! if (nextion_command[0] == 'X') { int8_t req = atoi(&nextion_command[1]); // Information requests if (req <= 49) - PanelInfo(req); + panelInfo(req); // Simple Actions else if (req >= 50) - PanelAction(req); + panelAction(req); } } #define SEND_NA(A) SEND_TXT(A, "n/a") -void NextionTFT::PanelInfo(uint8_t req) { +void NextionTFT::panelInfo(uint8_t req) { switch (req) { case 0: break; @@ -216,7 +216,7 @@ void NextionTFT::PanelInfo(uint8_t req) { //SEND_TXT("tmppage.M117", msg_no_sd_card); } else if (nextion_command[3] == 'S') - SendFileList(atoi(&nextion_command[4])); + sendFileList(atoi(&nextion_command[4])); } break; @@ -488,7 +488,7 @@ void NextionTFT::PanelInfo(uint8_t req) { } } -void NextionTFT::PanelAction(uint8_t req) { +void NextionTFT::panelAction(uint8_t req) { switch (req) { case 50: // Pause SD print @@ -512,7 +512,7 @@ void NextionTFT::PanelAction(uint8_t req) { break; case 54: // A13 Select file - SelectFile(); + selectFile(); break; case 65: // Cool Down diff --git a/Marlin/src/lcd/extui/nextion/nextion_tft.h b/Marlin/src/lcd/extui/nextion/nextion_tft.h index 806630485cd25..9e085b0f72192 100644 --- a/Marlin/src/lcd/extui/nextion/nextion_tft.h +++ b/Marlin/src/lcd/extui/nextion/nextion_tft.h @@ -40,23 +40,23 @@ class NextionTFT { public: NextionTFT(); - static void Startup(); - static void IdleLoop(); - static void PrinterKilled(FSTR_P const, FSTR_P const); - static void ConfirmationRequest(const char * const); - static void StatusChange(const char * const); - static void SendtoTFT(FSTR_P const=nullptr); - //static void SendtoTFTLN(FSTR_P const=nullptr); + static void startup(); + static void idleLoop(); + static void printerKilled(FSTR_P const, FSTR_P const); + static void confirmationRequest(const char * const); + static void statusChange(const char * const); + static void tftSend(FSTR_P const=nullptr); + //static void tftSendLn(FSTR_P const=nullptr); static void UpdateOnChange(); static void PrintFinished(); - static void PanelInfo(uint8_t); + static void panelInfo(uint8_t); private: - static bool ReadTFTCommand(); - static void SendFileList(int8_t); - static void SelectFile(); - static void ProcessPanelRequest(); - static void PanelAction(uint8_t); + static bool readTFTCommand(); + static void sendFileList(int8_t); + static void selectFile(); + static void processPanelRequest(); + static void panelAction(uint8_t); static void _format_time(char *, uint32_t); }; diff --git a/Marlin/src/lcd/extui/nextion/nextion_tft_defs.h b/Marlin/src/lcd/extui/nextion/nextion_tft_defs.h index cdd91bf2a3c95..061d29559c0a3 100644 --- a/Marlin/src/lcd/extui/nextion/nextion_tft_defs.h +++ b/Marlin/src/lcd/extui/nextion/nextion_tft_defs.h @@ -54,10 +54,10 @@ // TFT panel commands #define msg_welcome MACHINE_NAME " Ready." -#define SEND_TEMP(x,y,t,z) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".txt=\"")), LCD_SERIAL.print(y), nextion.SendtoTFT(F(t)), LCD_SERIAL.print(z), nextion.SendtoTFT(F("\"\xFF\xFF\xFF"))) -#define SEND_VAL(x,y) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".val=")), LCD_SERIAL.print(y), nextion.SendtoTFT(F("\xFF\xFF\xFF"))) -#define SEND_TXT(x,y) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".txt=\"")), nextion.SendtoTFT(F(y)), nextion.SendtoTFT(F("\"\xFF\xFF\xFF"))) -#define SEND_TXT_F(x,y) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".txt=\"")), nextion.SendtoTFT(y), nextion.SendtoTFT(F("\"\xFF\xFF\xFF"))) -#define SEND_VALasTXT(x,y) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F(".txt=\"")), LCD_SERIAL.print(y), nextion.SendtoTFT(F("\"\xFF\xFF\xFF"))) -#define SEND_TXT_END(x) (nextion.SendtoTFT(F(x)), nextion.SendtoTFT(F("\xFF\xFF\xFF"))) -#define SEND_PCO2(x,y,z) (nextion.SendtoTFT(F(x)), LCD_SERIAL.print(y), nextion.SendtoTFT(F(".pco=")), nextion.SendtoTFT(F(z)), nextion.SendtoTFT(F("\xFF\xFF\xFF"))) +#define SEND_TEMP(x,y,t,z) (nextion.tftSend(F(x)), nextion.tftSend(F(".txt=\"")), LCD_SERIAL.print(y), nextion.tftSend(F(t)), LCD_SERIAL.print(z), nextion.tftSend(F("\"\xFF\xFF\xFF"))) +#define SEND_VAL(x,y) (nextion.tftSend(F(x)), nextion.tftSend(F(".val=")), LCD_SERIAL.print(y), nextion.tftSend(F("\xFF\xFF\xFF"))) +#define SEND_TXT(x,y) (nextion.tftSend(F(x)), nextion.tftSend(F(".txt=\"")), nextion.tftSend(F(y)), nextion.tftSend(F("\"\xFF\xFF\xFF"))) +#define SEND_TXT_F(x,y) (nextion.tftSend(F(x)), nextion.tftSend(F(".txt=\"")), nextion.tftSend(y), nextion.tftSend(F("\"\xFF\xFF\xFF"))) +#define SEND_VALasTXT(x,y) (nextion.tftSend(F(x)), nextion.tftSend(F(".txt=\"")), LCD_SERIAL.print(y), nextion.tftSend(F("\"\xFF\xFF\xFF"))) +#define SEND_TXT_END(x) (nextion.tftSend(F(x)), nextion.tftSend(F("\xFF\xFF\xFF"))) +#define SEND_PCO2(x,y,z) (nextion.tftSend(F(x)), LCD_SERIAL.print(y), nextion.tftSend(F(".pco=")), nextion.tftSend(F(z)), nextion.tftSend(F("\xFF\xFF\xFF"))) diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 568ad49df0b12..f74e24e93a1c0 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -748,9 +748,9 @@ namespace Language_en { LSTR MSG_MMU2_EJECT_FILAMENT = _UxGT("MMU Eject"); LSTR MSG_MMU2_EJECT_FILAMENT_N = _UxGT("MMU Eject ~"); LSTR MSG_MMU2_UNLOAD_FILAMENT = _UxGT("MMU Unload"); - LSTR MSG_MMU2_LOADING_FILAMENT = _UxGT("Loading Fil. %i..."); - LSTR MSG_MMU2_EJECTING_FILAMENT = _UxGT("Ejecting Fil. ..."); - LSTR MSG_MMU2_UNLOADING_FILAMENT = _UxGT("Unloading Fil...."); + LSTR MSG_MMU2_LOADING_FILAMENT = _UxGT("Filament %i Load..."); + LSTR MSG_MMU2_EJECTING_FILAMENT = _UxGT("Filament Eject..."); + LSTR MSG_MMU2_UNLOADING_FILAMENT = _UxGT("Filament Unload..."); LSTR MSG_MMU2_ALL = _UxGT("All"); LSTR MSG_MMU2_FILAMENT_N = _UxGT("Filament ~"); LSTR MSG_MMU2_RESET = _UxGT("Reset MMU"); From 317450af3226cc4a1647404cbe31a6ab82cc318e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 24 May 2023 02:53:12 -0500 Subject: [PATCH 059/100] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Upd?= =?UTF-8?q?ated=20toolchain=20for=20ststm32@~14.1.0=20(#25846)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ini/stm32f4.ini | 1 + ini/stm32g0.ini | 20 +++++++++++--------- ini/stm32h7.ini | 26 +++++++++++++------------- 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 2889a88863cd7..34a5c4d607bde 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -733,6 +733,7 @@ upload_protocol = stlink extends = stm32_variant platform = ststm32@~14.1.0 platform_packages = framework-arduinoststm32@https://github.com/stm32duino/Arduino_Core_STM32/archive/main.zip + toolchain-gccarmnoneeabi@1.100301.220327 board = marlin_STM32F401RC board_build.offset = 0x4000 board_upload.offset_address = 0x08004000 diff --git a/ini/stm32g0.ini b/ini/stm32g0.ini index 17403292b70b4..f67002fa5c3cf 100644 --- a/ini/stm32g0.ini +++ b/ini/stm32g0.ini @@ -49,14 +49,15 @@ upload_command = dfu-util -a 0 -s 0x08000000:leave -D "$SOURCE" extends = stm32_variant platform = ststm32@~14.1.0 platform_packages = framework-arduinoststm32@https://github.com/stm32duino/Arduino_Core_STM32/archive/main.zip + toolchain-gccarmnoneeabi@1.100301.220327 board = marlin_STM32G0B1RE board_build.offset = 0x2000 board_upload.offset_address = 0x08002000 build_flags = ${stm32_variant.build_flags} - -DPIN_SERIAL4_RX=PC_11 -DPIN_SERIAL4_TX=PC_10 - -DSERIAL_RX_BUFFER_SIZE=1024 -DSERIAL_TX_BUFFER_SIZE=1024 - -DTIMER_SERVO=TIM3 -DTIMER_TONE=TIM4 - -DSTEP_TIMER_IRQ_PRIO=0 + -DPIN_SERIAL4_RX=PC_11 -DPIN_SERIAL4_TX=PC_10 + -DSERIAL_RX_BUFFER_SIZE=1024 -DSERIAL_TX_BUFFER_SIZE=1024 + -DTIMER_SERVO=TIM3 -DTIMER_TONE=TIM4 + -DSTEP_TIMER_IRQ_PRIO=0 upload_protocol = stlink debug_tool = stlink @@ -103,15 +104,16 @@ upload_protocol = custom extends = stm32_variant platform = ststm32@~14.1.0 platform_packages = framework-arduinoststm32@https://github.com/stm32duino/Arduino_Core_STM32/archive/main.zip + toolchain-gccarmnoneeabi@1.100301.220327 board = marlin_STM32G0B1VE board_build.offset = 0x2000 board_upload.offset_address = 0x08002000 build_flags = ${stm32_variant.build_flags} - -DPIN_SERIAL4_RX=PE_9 -DPIN_SERIAL4_TX=PE_8 - -DPIN_SERIAL5_RX=PE_11 -DPIN_SERIAL5_TX=PE_10 - -DSERIAL_RX_BUFFER_SIZE=1024 -DSERIAL_TX_BUFFER_SIZE=1024 - -DTIMER_SERVO=TIM3 -DTIMER_TONE=TIM4 - -DSTEP_TIMER_IRQ_PRIO=0 + -DPIN_SERIAL4_RX=PE_9 -DPIN_SERIAL4_TX=PE_8 + -DPIN_SERIAL5_RX=PE_11 -DPIN_SERIAL5_TX=PE_10 + -DSERIAL_RX_BUFFER_SIZE=1024 -DSERIAL_TX_BUFFER_SIZE=1024 + -DTIMER_SERVO=TIM3 -DTIMER_TONE=TIM4 + -DSTEP_TIMER_IRQ_PRIO=0 upload_protocol = stlink debug_tool = stlink diff --git a/ini/stm32h7.ini b/ini/stm32h7.ini index 5733d35bf0fdc..e7617b1c965d0 100644 --- a/ini/stm32h7.ini +++ b/ini/stm32h7.ini @@ -50,9 +50,9 @@ 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 + -DPIN_SERIAL1_TX=PA_9 -DPIN_SERIAL1_RX=PA_10 + -DPIN_SERIAL3_TX=PD_8 -DPIN_SERIAL3_RX=PD_9 + -DPIN_SERIAL4_TX=PA_0 -DPIN_SERIAL4_RX=PA_1 -DSERIAL_RX_BUFFER_SIZE=1024 -DSERIAL_TX_BUFFER_SIZE=1024 -DTIMER_SERVO=TIM5 -DTIMER_TONE=TIM2 -DSTEP_TIMER_IRQ_PRIO=0 @@ -72,11 +72,11 @@ board = marlin_STM32H723Vx 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_SERIAL2_RX=PD_6 -DPIN_SERIAL2_TX=PD_5 - -DPIN_SERIAL3_RX=PD_9 -DPIN_SERIAL3_TX=PD_8 - -DPIN_SERIAL4_RX=PA_1 -DPIN_SERIAL4_TX=PA_0 - -DPIN_SERIAL7_RX=PE_7 -DPIN_SERIAL7_TX=PE_8 + -DPIN_SERIAL1_TX=PA_9 -DPIN_SERIAL1_RX=PA_10 + -DPIN_SERIAL2_TX=PD_5 -DPIN_SERIAL2_RX=PD_6 + -DPIN_SERIAL3_TX=PD_8 -DPIN_SERIAL3_RX=PD_9 + -DPIN_SERIAL4_TX=PA_0 -DPIN_SERIAL4_RX=PA_1 + -DPIN_SERIAL7_TX=PE_8 -DPIN_SERIAL7_RX=PE_7 -DSERIAL_RX_BUFFER_SIZE=1024 -DSERIAL_TX_BUFFER_SIZE=1024 -DTIMER_SERVO=TIM5 -DTIMER_TONE=TIM2 -DSTEP_TIMER_IRQ_PRIO=0 @@ -98,11 +98,11 @@ board = marlin_STM32H723Zx 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_SERIAL2_RX=PD_6 -DPIN_SERIAL2_TX=PD_5 - -DPIN_SERIAL3_RX=PD_9 -DPIN_SERIAL3_TX=PD_8 - -DPIN_SERIAL4_RX=PA_1 -DPIN_SERIAL4_TX=PA_0 - -DPIN_SERIAL7_RX=PE_7 -DPIN_SERIAL7_TX=PE_8 + -DPIN_SERIAL1_TX=PA_9 -DPIN_SERIAL1_RX=PA_10 + -DPIN_SERIAL2_TX=PD_5 -DPIN_SERIAL2_RX=PD_6 + -DPIN_SERIAL3_TX=PD_8 -DPIN_SERIAL3_RX=PD_9 + -DPIN_SERIAL4_TX=PA_0 -DPIN_SERIAL4_RX=PA_1 + -DPIN_SERIAL7_TX=PE_8 -DPIN_SERIAL7_RX=PE_7 -DSERIAL_RX_BUFFER_SIZE=1024 -DSERIAL_TX_BUFFER_SIZE=1024 -DTIMER_SERVO=TIM5 -DTIMER_TONE=TIM2 -DSTEP_TIMER_IRQ_PRIO=0 From eb439b93a57ca6676c02635f6395fd9e733d0afe Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Wed, 24 May 2023 19:58:11 +1200 Subject: [PATCH 060/100] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20ESP32=20compile=20?= =?UTF-8?q?error=20(#25873)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/bedlevel/hilbert_curve.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/feature/bedlevel/hilbert_curve.cpp b/Marlin/src/feature/bedlevel/hilbert_curve.cpp index 7474123e3fe17..57cbdfb34ddd2 100644 --- a/Marlin/src/feature/bedlevel/hilbert_curve.cpp +++ b/Marlin/src/feature/bedlevel/hilbert_curve.cpp @@ -28,8 +28,8 @@ constexpr int8_t to_fix(int8_t v) { return v * 2; } constexpr int8_t to_int(int8_t v) { return v / 2; } -constexpr uint8_t log2(uint8_t n) { return (n > 1) ? 1 + log2(n >> 1) : 0; } -constexpr uint8_t order(uint8_t n) { return uint8_t(log2(n - 1)) + 1; } +constexpr uint8_t log2(uint8_t n) { return (n > 1) ? 1 + log2(uint8_t(n >> 1)) : 0; } +constexpr uint8_t order(uint8_t n) { return uint8_t(log2(uint8_t(n - 1))) + 1; } constexpr uint8_t ord = order(_MAX(GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y)); constexpr uint8_t dim = _BV(ord); From e2a724990762dab554ce5bab092327eb604d3d83 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Thu, 25 May 2023 00:20:08 +0000 Subject: [PATCH 061/100] [cron] Bump distribution date (2023-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 5b26bfa8ab4fa..4a4d913781393 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 "2023-05-24" +//#define STRING_DISTRIBUTION_DATE "2023-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 2864463068aeb..be7fa433757e8 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 "2023-05-24" + #define STRING_DISTRIBUTION_DATE "2023-05-25" #endif /** From 1a4e208c6901cf3727940e98f12748aa14a52f5d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 24 May 2023 21:22:54 -0500 Subject: [PATCH 062/100] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20card.ls=20call=20(?= =?UTF-8?q?in=20easythreed=5Fui)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix regression in #24679 --- Marlin/src/sd/SdBaseFile.cpp | 4 ++-- Marlin/src/sd/SdBaseFile.h | 2 +- Marlin/src/sd/cardreader.cpp | 2 +- Marlin/src/sd/cardreader.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Marlin/src/sd/SdBaseFile.cpp b/Marlin/src/sd/SdBaseFile.cpp index cf403d4b3aae7..98cbe9ba9d1cb 100644 --- a/Marlin/src/sd/SdBaseFile.cpp +++ b/Marlin/src/sd/SdBaseFile.cpp @@ -322,12 +322,12 @@ void SdBaseFile::getpos(filepos_t * const pos) { * \param[in] indent Amount of space before file name. Used for recursive * list to indicate subdirectory level. */ -void SdBaseFile::ls(uint8_t flags, uint8_t indent) { +void SdBaseFile::ls(const uint8_t flags/*=0*/, const uint8_t indent/*=0*/) { rewind(); int8_t status; while ((status = lsPrintNext(flags, indent))) { if (status > 1 && (flags & LS_R)) { - uint16_t index = curPosition() / 32 - 1; + const uint16_t index = curPosition() / 32 - 1; SdBaseFile s; if (s.open(this, index, O_READ)) s.ls(flags, indent + 2); seekSet(32 * (index + 1)); diff --git a/Marlin/src/sd/SdBaseFile.h b/Marlin/src/sd/SdBaseFile.h index 3ac23138b154b..b806a3cd7021d 100644 --- a/Marlin/src/sd/SdBaseFile.h +++ b/Marlin/src/sd/SdBaseFile.h @@ -283,7 +283,7 @@ class SdBaseFile { bool isRoot() const { return type_ == FAT_FILE_TYPE_ROOT_FIXED || type_ == FAT_FILE_TYPE_ROOT32; } bool getDosName(char * const name); - void ls(uint8_t flags=0, uint8_t indent=0); + void ls(const uint8_t flags=0, const uint8_t indent=0); bool mkdir(SdBaseFile *parent, const char *path, const bool pFlag=true); bool open(SdBaseFile * const dirFile, uint16_t index, const uint8_t oflag); diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index cd3d1d2cd603a..a4a10b316986b 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -353,7 +353,7 @@ void CardReader::printListing(MediaFile parent, const char * const prepend, cons // // List all files on the SD card // -void CardReader::ls(const uint8_t lsflags) { +void CardReader::ls(const uint8_t lsflags/*=0*/) { if (flag.mounted) { root.rewind(); printListing(root, nullptr, lsflags); diff --git a/Marlin/src/sd/cardreader.h b/Marlin/src/sd/cardreader.h index 4baaa73e1a4a4..832d79efe4eed 100644 --- a/Marlin/src/sd/cardreader.h +++ b/Marlin/src/sd/cardreader.h @@ -209,7 +209,7 @@ class CardReader { } #endif - static void ls(const uint8_t lsflags); + static void ls(const uint8_t lsflags=0); #if ENABLED(POWER_LOSS_RECOVERY) static bool jobRecoverFileExists(); From 772e19aab988b5d6466bdf2e8948c8c7eee3cafd Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 24 May 2023 22:10:40 -0500 Subject: [PATCH 063/100] =?UTF-8?q?=E2=9C=A8=20EP=5FBABYSTEPPING=20(#25869?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 7 +- Marlin/src/MarlinCore.cpp | 9 ++ Marlin/src/feature/babystep.cpp | 12 +- Marlin/src/feature/babystep.h | 19 ++++ Marlin/src/feature/e_parser.cpp | 185 ++++++++++++++++++++++++++++++- Marlin/src/feature/e_parser.h | 165 +-------------------------- Marlin/src/gcode/gcode.cpp | 4 + Marlin/src/gcode/gcode.h | 4 + Marlin/src/gcode/host/M115.cpp | 6 + Marlin/src/gcode/motion/M290.cpp | 6 + Marlin/src/inc/Warnings.cpp | 7 ++ Marlin/src/lcd/menu/menu.h | 11 -- Marlin/src/module/planner.h | 12 ++ buildroot/tests/LPC1768 | 2 +- buildroot/tests/mega2560 | 2 +- ini/native.ini | 2 +- 16 files changed, 273 insertions(+), 180 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index c66745d8bf55b..a635e4a3022ce 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1543,7 +1543,7 @@ */ #define SHOW_BOOTSCREEN // Show the Marlin bootscreen on startup. ** ENABLE FOR PRODUCTION ** #if ENABLED(SHOW_BOOTSCREEN) - #define BOOTSCREEN_TIMEOUT 4000 // (ms) Total Duration to display the boot screen(s) + #define BOOTSCREEN_TIMEOUT 3000 // (ms) Total Duration to display the boot screen(s) #if EITHER(HAS_MARLINUI_U8GLIB, TFT_COLOR_UI) #define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving lots of flash) #endif @@ -2190,9 +2190,10 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define INTEGRATED_BABYSTEPPING // EXPERIMENTAL integration of babystepping into the Stepper ISR + //#define INTEGRATED_BABYSTEPPING // Integration of babystepping into the Stepper ISR + //#define EP_BABYSTEPPING // M293/M294 babystepping with EMERGENCY_PARSER support //#define BABYSTEP_WITHOUT_HOMING - //#define BABYSTEP_ALWAYS_AVAILABLE // Allow babystepping at all times (not just during movement). + //#define BABYSTEP_ALWAYS_AVAILABLE // Allow babystepping at all times (not just during movement) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! //#define BABYSTEP_INVERT_Z // Enable if Z babysteps should go the other way //#define BABYSTEP_MILLIMETER_UNITS // Specify BABYSTEP_MULTIPLICATOR_(XY|Z) in mm instead of micro-steps diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 08c69aa5b7c64..f1d43e7b6093c 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -726,6 +726,10 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) { #endif } +#if BOTH(EP_BABYSTEPPING, EMERGENCY_PARSER) + #include "feature/babystep.h" +#endif + /** * Standard idle routine keeps the machine alive: * - Core Marlin activities @@ -848,6 +852,11 @@ void idle(const bool no_stepper_sleep/*=false*/) { // Handle Joystick jogging TERN_(POLL_JOG, joystick.inject_jog_moves()); + // Async Babystepping via the Emergency Parser + #if BOTH(EP_BABYSTEPPING, EMERGENCY_PARSER) + babystep.do_ep_steps(); + #endif + // Direct Stepping TERN_(DIRECT_STEPPING, page_manager.write_responses()); diff --git a/Marlin/src/feature/babystep.cpp b/Marlin/src/feature/babystep.cpp index 2e3d6a9fd20b4..c8c1d42f886b0 100644 --- a/Marlin/src/feature/babystep.cpp +++ b/Marlin/src/feature/babystep.cpp @@ -26,7 +26,7 @@ #include "babystep.h" #include "../MarlinCore.h" -#include "../module/motion.h" // for axes_should_home() +#include "../module/motion.h" // for axes_should_home(), BABYSTEP_ALLOWED #include "../module/planner.h" // for axis_steps_per_mm[] #include "../module/stepper.h" @@ -42,6 +42,10 @@ volatile int16_t Babystep::steps[BS_AXIS_IND(Z_AXIS) + 1]; #endif int16_t Babystep::accum; +#if BOTH(EP_BABYSTEPPING, EMERGENCY_PARSER) + int16_t Babystep::ep_babysteps; +#endif + void Babystep::step_axis(const AxisEnum axis) { const int16_t curTodo = steps[BS_AXIS_IND(axis)]; // get rid of volatile for performance if (curTodo) { @@ -76,4 +80,10 @@ void Babystep::add_steps(const AxisEnum axis, const int16_t distance) { TERN_(INTEGRATED_BABYSTEPPING, if (has_steps()) stepper.initiateBabystepping()); } +#if ENABLED(EP_BABYSTEPPING) + // Step Z for M293 / M294 + void Babystep::z_up() { if (BABYSTEP_ALLOWED()) add_steps(Z_AXIS, +BABYSTEP_SIZE_Z); } + void Babystep::z_down() { if (BABYSTEP_ALLOWED()) add_steps(Z_AXIS, -BABYSTEP_SIZE_Z); } +#endif + #endif // BABYSTEPPING diff --git a/Marlin/src/feature/babystep.h b/Marlin/src/feature/babystep.h index bbf0c5a26060e..1e319ec5446d3 100644 --- a/Marlin/src/feature/babystep.h +++ b/Marlin/src/feature/babystep.h @@ -52,6 +52,10 @@ class Babystep { static volatile int16_t steps[BS_AXIS_IND(Z_AXIS) + 1]; static int16_t accum; // Total babysteps in current edit + #if BOTH(EP_BABYSTEPPING, EMERGENCY_PARSER) + static int16_t ep_babysteps; + #endif + #if ENABLED(BABYSTEP_DISPLAY_TOTAL) static int16_t axis_total[BS_TOTAL_IND(Z_AXIS) + 1]; // Total babysteps since G28 static void reset_total(const AxisEnum axis) { @@ -63,6 +67,21 @@ class Babystep { static void add_steps(const AxisEnum axis, const int16_t distance); static void add_mm(const AxisEnum axis, const_float_t mm); + #if ENABLED(EP_BABYSTEPPING) + // Step Z for M293 / M294 + static void z_up(); + static void z_down(); + #if ENABLED(EMERGENCY_PARSER) + // Step Z according to steps accumulated by the EP + FORCE_INLINE static void do_ep_steps() { + if (ep_babysteps) { + if (ep_babysteps > 0) { z_up(); ep_babysteps--; } + else { z_down(); ep_babysteps++; } + } + } + #endif + #endif // EP_BABYSTEPPING + #if ENABLED(BD_SENSOR) static void set_mm(const AxisEnum axis, const_float_t mm); #endif diff --git a/Marlin/src/feature/e_parser.cpp b/Marlin/src/feature/e_parser.cpp index b50a12d1af180..da193ed30aba9 100644 --- a/Marlin/src/feature/e_parser.cpp +++ b/Marlin/src/feature/e_parser.cpp @@ -24,7 +24,7 @@ * e_parser.cpp - Intercept special commands directly in the serial stream */ -#include "../inc/MarlinConfigPre.h" +#include "../inc/MarlinConfig.h" #if ENABLED(EMERGENCY_PARSER) @@ -39,10 +39,193 @@ bool EmergencyParser::killed_by_M112, // = false EmergencyParser::enabled; #if ENABLED(HOST_PROMPT_SUPPORT) + #include "host_actions.h" uint8_t EmergencyParser::M876_reason; // = 0 #endif // Global instance EmergencyParser emergency_parser; +// External references +extern bool wait_for_user, wait_for_heatup; + +#if ENABLED(EP_BABYSTEPPING) + #include "babystep.h" +#endif + +#if ENABLED(REALTIME_REPORTING_COMMANDS) + // From motion.h, which cannot be included here + void report_current_position_moving(); + void quickpause_stepper(); + void quickresume_stepper(); +#endif + +void EmergencyParser::update(EmergencyParser::State &state, const uint8_t c) { + switch (state) { + case EP_RESET: + switch (c) { + case ' ': case '\n': case '\r': break; + case 'N': state = EP_N; break; + case 'M': state = EP_M; break; + #if ENABLED(REALTIME_REPORTING_COMMANDS) + case 'S': state = EP_S; break; + case 'P': state = EP_P; break; + case 'R': state = EP_R; break; + #endif + #if ENABLED(SOFT_RESET_VIA_SERIAL) + case '^': state = EP_ctrl; break; + case 'K': state = EP_K; break; + #endif + default: state = EP_IGNORE; + } + break; + + case EP_N: + switch (c) { + case '0' ... '9': + case '-': case ' ': break; + case 'M': state = EP_M; break; + #if ENABLED(REALTIME_REPORTING_COMMANDS) + case 'S': state = EP_S; break; + case 'P': state = EP_P; break; + case 'R': state = EP_R; break; + #endif + default: state = EP_IGNORE; + } + break; + + #if ENABLED(REALTIME_REPORTING_COMMANDS) + case EP_S: state = (c == '0') ? EP_S0 : EP_IGNORE; break; + case EP_S0: state = (c == '0') ? EP_S00 : EP_IGNORE; break; + case EP_S00: state = (c == '0') ? EP_GRBL_STATUS : EP_IGNORE; break; + + case EP_R: state = (c == '0') ? EP_R0 : EP_IGNORE; break; + case EP_R0: state = (c == '0') ? EP_R00 : EP_IGNORE; break; + case EP_R00: state = (c == '0') ? EP_GRBL_RESUME : EP_IGNORE; break; + + case EP_P: state = (c == '0') ? EP_P0 : EP_IGNORE; break; + case EP_P0: state = (c == '0') ? EP_P00 : EP_IGNORE; break; + case EP_P00: state = (c == '0') ? EP_GRBL_PAUSE : EP_IGNORE; break; + #endif + + #if ENABLED(SOFT_RESET_VIA_SERIAL) + case EP_ctrl: state = (c == 'X') ? EP_KILL : EP_IGNORE; break; + case EP_K: state = (c == 'I') ? EP_KI : EP_IGNORE; break; + case EP_KI: state = (c == 'L') ? EP_KIL : EP_IGNORE; break; + case EP_KIL: state = (c == 'L') ? EP_KILL : EP_IGNORE; break; + #endif + + case EP_M: + switch (c) { + case ' ': break; + case '1': state = EP_M1; break; + #if ENABLED(EP_BABYSTEPPING) + case '2': state = EP_M2; break; + #endif + case '4': state = EP_M4; break; + #if HAS_MEDIA + case '5': state = EP_M5; break; + #endif + #if ENABLED(HOST_PROMPT_SUPPORT) + case '8': state = EP_M8; break; + #endif + default: state = EP_IGNORE; + } + break; + + case EP_M1: + switch (c) { + case '0': state = EP_M10; break; + case '1': state = EP_M11; break; + default: state = EP_IGNORE; + } + break; + + case EP_M10: state = (c == '8') ? EP_M108 : EP_IGNORE; break; + case EP_M11: state = (c == '2') ? EP_M112 : EP_IGNORE; break; + case EP_M4: state = (c == '1') ? EP_M41 : EP_IGNORE; break; + case EP_M41: state = (c == '0') ? EP_M410 : EP_IGNORE; break; + + #if HAS_MEDIA + case EP_M5: state = (c == '2') ? EP_M52 : EP_IGNORE; break; + case EP_M52: state = (c == '4') ? EP_M524 : EP_IGNORE; break; + #endif + + #if ENABLED(EP_BABYSTEPPING) + case EP_M2: + switch (c) { + case '9': state = EP_M29; break; + default: state = EP_IGNORE; + } + break; + + case EP_M29: + switch (c) { + case '3': state = EP_M293; break; + case '4': state = EP_M294; break; + default: state = EP_IGNORE; + } + break; + #endif + + #if ENABLED(HOST_PROMPT_SUPPORT) + + case EP_M8: state = (c == '7') ? EP_M87 : EP_IGNORE; break; + case EP_M87: state = (c == '6') ? EP_M876 : EP_IGNORE; break; + + case EP_M876: + switch (c) { + case ' ': break; + case 'S': state = EP_M876S; break; + default: state = EP_IGNORE; break; + } + break; + + case EP_M876S: + switch (c) { + case ' ': break; + case '0' ... '9': + state = EP_M876SN; + M876_reason = uint8_t(c - '0'); + break; + } + break; + + #endif + + case EP_IGNORE: + if (ISEOL(c)) state = EP_RESET; + break; + + default: + if (ISEOL(c)) { + if (enabled) switch (state) { + case EP_M108: wait_for_user = wait_for_heatup = false; break; + case EP_M112: killed_by_M112 = true; break; + case EP_M410: quickstop_by_M410 = true; break; + #if ENABLED(EP_BABYSTEPPING) + case EP_M293: babystep.ep_babysteps++; break; + case EP_M294: babystep.ep_babysteps--; break; + #endif + #if HAS_MEDIA + case EP_M524: sd_abort_by_M524 = true; break; + #endif + #if ENABLED(HOST_PROMPT_SUPPORT) + case EP_M876SN: hostui.handle_response(M876_reason); break; + #endif + #if ENABLED(REALTIME_REPORTING_COMMANDS) + case EP_GRBL_STATUS: report_current_position_moving(); break; + case EP_GRBL_PAUSE: quickpause_stepper(); break; + case EP_GRBL_RESUME: quickresume_stepper(); break; + #endif + #if ENABLED(SOFT_RESET_VIA_SERIAL) + case EP_KILL: hal.reboot(); break; + #endif + default: break; + } + state = EP_RESET; + } + } +} + #endif // EMERGENCY_PARSER diff --git a/Marlin/src/feature/e_parser.h b/Marlin/src/feature/e_parser.h index df4456d8d3cac..8dacb0581c126 100644 --- a/Marlin/src/feature/e_parser.h +++ b/Marlin/src/feature/e_parser.h @@ -27,24 +27,6 @@ #include "../inc/MarlinConfigPre.h" -#if ENABLED(HOST_PROMPT_SUPPORT) - #include "host_actions.h" -#endif - -// External references -extern bool wait_for_user, wait_for_heatup; - -#if ENABLED(REALTIME_REPORTING_COMMANDS) - // From motion.h, which cannot be included here - void report_current_position_moving(); - void quickpause_stepper(); - void quickresume_stepper(); -#endif - -#if ENABLED(SOFT_RESET_VIA_SERIAL) - void HAL_reboot(); -#endif - class EmergencyParser { public: @@ -61,6 +43,9 @@ class EmergencyParser { #if HAS_MEDIA EP_M5, EP_M52, EP_M524, #endif + #if ENABLED(EP_BABYSTEPPING) + EP_M2, EP_M29, EP_M293, EP_M294, + #endif #if ENABLED(HOST_PROMPT_SUPPORT) EP_M8, EP_M87, EP_M876, EP_M876S, EP_M876SN, #endif @@ -92,149 +77,7 @@ class EmergencyParser { FORCE_INLINE static void enable() { enabled = true; } FORCE_INLINE static void disable() { enabled = false; } - FORCE_INLINE static void update(State &state, const uint8_t c) { - switch (state) { - case EP_RESET: - switch (c) { - case ' ': case '\n': case '\r': break; - case 'N': state = EP_N; break; - case 'M': state = EP_M; break; - #if ENABLED(REALTIME_REPORTING_COMMANDS) - case 'S': state = EP_S; break; - case 'P': state = EP_P; break; - case 'R': state = EP_R; break; - #endif - #if ENABLED(SOFT_RESET_VIA_SERIAL) - case '^': state = EP_ctrl; break; - case 'K': state = EP_K; break; - #endif - default: state = EP_IGNORE; - } - break; - - case EP_N: - switch (c) { - case '0' ... '9': - case '-': case ' ': break; - case 'M': state = EP_M; break; - #if ENABLED(REALTIME_REPORTING_COMMANDS) - case 'S': state = EP_S; break; - case 'P': state = EP_P; break; - case 'R': state = EP_R; break; - #endif - default: state = EP_IGNORE; - } - break; - - #if ENABLED(REALTIME_REPORTING_COMMANDS) - case EP_S: state = (c == '0') ? EP_S0 : EP_IGNORE; break; - case EP_S0: state = (c == '0') ? EP_S00 : EP_IGNORE; break; - case EP_S00: state = (c == '0') ? EP_GRBL_STATUS : EP_IGNORE; break; - - case EP_R: state = (c == '0') ? EP_R0 : EP_IGNORE; break; - case EP_R0: state = (c == '0') ? EP_R00 : EP_IGNORE; break; - case EP_R00: state = (c == '0') ? EP_GRBL_RESUME : EP_IGNORE; break; - - case EP_P: state = (c == '0') ? EP_P0 : EP_IGNORE; break; - case EP_P0: state = (c == '0') ? EP_P00 : EP_IGNORE; break; - case EP_P00: state = (c == '0') ? EP_GRBL_PAUSE : EP_IGNORE; break; - #endif - - #if ENABLED(SOFT_RESET_VIA_SERIAL) - case EP_ctrl: state = (c == 'X') ? EP_KILL : EP_IGNORE; break; - case EP_K: state = (c == 'I') ? EP_KI : EP_IGNORE; break; - case EP_KI: state = (c == 'L') ? EP_KIL : EP_IGNORE; break; - case EP_KIL: state = (c == 'L') ? EP_KILL : EP_IGNORE; break; - #endif - - case EP_M: - switch (c) { - case ' ': break; - case '1': state = EP_M1; break; - case '4': state = EP_M4; break; - #if HAS_MEDIA - case '5': state = EP_M5; break; - #endif - #if ENABLED(HOST_PROMPT_SUPPORT) - case '8': state = EP_M8; break; - #endif - default: state = EP_IGNORE; - } - break; - - case EP_M1: - switch (c) { - case '0': state = EP_M10; break; - case '1': state = EP_M11; break; - default: state = EP_IGNORE; - } - break; - - case EP_M10: state = (c == '8') ? EP_M108 : EP_IGNORE; break; - case EP_M11: state = (c == '2') ? EP_M112 : EP_IGNORE; break; - case EP_M4: state = (c == '1') ? EP_M41 : EP_IGNORE; break; - case EP_M41: state = (c == '0') ? EP_M410 : EP_IGNORE; break; - - #if HAS_MEDIA - case EP_M5: state = (c == '2') ? EP_M52 : EP_IGNORE; break; - case EP_M52: state = (c == '4') ? EP_M524 : EP_IGNORE; break; - #endif - - #if ENABLED(HOST_PROMPT_SUPPORT) - - case EP_M8: state = (c == '7') ? EP_M87 : EP_IGNORE; break; - case EP_M87: state = (c == '6') ? EP_M876 : EP_IGNORE; break; - - case EP_M876: - switch (c) { - case ' ': break; - case 'S': state = EP_M876S; break; - default: state = EP_IGNORE; break; - } - break; - - case EP_M876S: - switch (c) { - case ' ': break; - case '0' ... '9': - state = EP_M876SN; - M876_reason = uint8_t(c - '0'); - break; - } - break; - - #endif - - case EP_IGNORE: - if (ISEOL(c)) state = EP_RESET; - break; - - default: - if (ISEOL(c)) { - if (enabled) switch (state) { - case EP_M108: wait_for_user = wait_for_heatup = false; break; - case EP_M112: killed_by_M112 = true; break; - case EP_M410: quickstop_by_M410 = true; break; - #if HAS_MEDIA - case EP_M524: sd_abort_by_M524 = true; break; - #endif - #if ENABLED(HOST_PROMPT_SUPPORT) - case EP_M876SN: hostui.handle_response(M876_reason); break; - #endif - #if ENABLED(REALTIME_REPORTING_COMMANDS) - case EP_GRBL_STATUS: report_current_position_moving(); break; - case EP_GRBL_PAUSE: quickpause_stepper(); break; - case EP_GRBL_RESUME: quickresume_stepper(); break; - #endif - #if ENABLED(SOFT_RESET_VIA_SERIAL) - case EP_KILL: HAL_reboot(); break; - #endif - default: break; - } - state = EP_RESET; - } - } - } + static void update(State &state, const uint8_t c); private: static bool enabled; diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 2313bbf78f923..530cde7901a2d 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -757,6 +757,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { #if ENABLED(BABYSTEPPING) case 290: M290(); break; // M290: Babystepping + #if ENABLED(EP_BABYSTEPPING) + case 293: IF_DISABLED(EMERGENCY_PARSER, M293()); break; // M293: Babystep up + case 294: IF_DISABLED(EMERGENCY_PARSER, M294()); break; // M294: Babystep down + #endif #endif #if HAS_SOUND diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 9283a92e39653..52e8fbf8025e5 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -930,6 +930,10 @@ class GcodeSuite { #if ENABLED(BABYSTEPPING) static void M290(); + #if ENABLED(EP_BABYSTEPPING) + static void M293(); + static void M294(); + #endif #endif #if HAS_SOUND diff --git a/Marlin/src/gcode/host/M115.cpp b/Marlin/src/gcode/host/M115.cpp index 239407816b93d..8ca6d07ce2699 100644 --- a/Marlin/src/gcode/host/M115.cpp +++ b/Marlin/src/gcode/host/M115.cpp @@ -54,6 +54,9 @@ * M115: Capabilities string and extended capabilities report * If a capability is not reported, hosts should assume * the capability is not present. + * + * NOTE: Always make sure to add new capabilities to the RepRap Wiki + * at https://reprap.org/wiki/Firmware_Capabilities_Protocol */ void GcodeSuite::M115() { SERIAL_ECHOPGM("FIRMWARE_NAME:Marlin" @@ -201,6 +204,9 @@ void GcodeSuite::M115() { // BABYSTEPPING (M290) cap_line(F("BABYSTEPPING"), ENABLED(BABYSTEPPING)); + // EP_BABYSTEP (M293, M294) + cap_line(F("EP_BABYSTEP"), ENABLED(EP_BABYSTEPPING)); + // CHAMBER_TEMPERATURE (M141, M191) cap_line(F("CHAMBER_TEMPERATURE"), ENABLED(HAS_HEATED_CHAMBER)); diff --git a/Marlin/src/gcode/motion/M290.cpp b/Marlin/src/gcode/motion/M290.cpp index 4fe83ccd4079d..d10f9ee73caae 100644 --- a/Marlin/src/gcode/motion/M290.cpp +++ b/Marlin/src/gcode/motion/M290.cpp @@ -131,4 +131,10 @@ void GcodeSuite::M290() { } } +#if ENABLED(EP_BABYSTEPPING) && DISABLED(EMERGENCY_PARSER) + // Without Emergency Parser M293/M294 will be added to the queue + void GcodeSuite::M293() { babystep.z_up(); } + void GcodeSuite::M294() { babystep.z_down(); } +#endif + #endif // BABYSTEPPING diff --git a/Marlin/src/inc/Warnings.cpp b/Marlin/src/inc/Warnings.cpp index f760920854654..5c6297ba60191 100644 --- a/Marlin/src/inc/Warnings.cpp +++ b/Marlin/src/inc/Warnings.cpp @@ -729,6 +729,13 @@ #warning "BABYSTEPPING is recommended with BD_SENSOR." #endif +/** + * EP Babystepping works best with EMERGENCY_PARSER + */ +#if ENABLED(EP_BABYSTEPPING) && DISABLED(EMERGENCY_PARSER) + #warning "EMERGENCY_PARSER is recommended for EP_BABYSTEPPING." +#endif + /** * POLAR warnings */ diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index 1face4774bf5f..d4cbfd7a73d52 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -242,17 +242,6 @@ void _lcd_draw_homing(); #else void lcd_babystep_z(); #endif - - #if ENABLED(BABYSTEP_MILLIMETER_UNITS) - #define BABYSTEP_SIZE_X int32_t((BABYSTEP_MULTIPLICATOR_XY) * planner.settings.axis_steps_per_mm[X_AXIS]) - #define BABYSTEP_SIZE_Y int32_t((BABYSTEP_MULTIPLICATOR_XY) * planner.settings.axis_steps_per_mm[Y_AXIS]) - #define BABYSTEP_SIZE_Z int32_t((BABYSTEP_MULTIPLICATOR_Z) * planner.settings.axis_steps_per_mm[Z_AXIS]) - #else - #define BABYSTEP_SIZE_X BABYSTEP_MULTIPLICATOR_XY - #define BABYSTEP_SIZE_Y BABYSTEP_MULTIPLICATOR_XY - #define BABYSTEP_SIZE_Z BABYSTEP_MULTIPLICATOR_Z - #endif - #endif #if ENABLED(TOUCH_SCREEN_CALIBRATION) diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index 4b68c5f656344..ee79c913af529 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -88,6 +88,18 @@ MMM_TO_MMS(manual_feedrate_mm_m.u), MMM_TO_MMS(manual_feedrate_mm_m.v), MMM_TO_MMS(manual_feedrate_mm_m.w)); #endif +#if ENABLED(BABYSTEPPING) + #if ENABLED(BABYSTEP_MILLIMETER_UNITS) + #define BABYSTEP_SIZE_X int32_t((BABYSTEP_MULTIPLICATOR_XY) * planner.settings.axis_steps_per_mm[X_AXIS]) + #define BABYSTEP_SIZE_Y int32_t((BABYSTEP_MULTIPLICATOR_XY) * planner.settings.axis_steps_per_mm[Y_AXIS]) + #define BABYSTEP_SIZE_Z int32_t((BABYSTEP_MULTIPLICATOR_Z) * planner.settings.axis_steps_per_mm[Z_AXIS]) + #else + #define BABYSTEP_SIZE_X BABYSTEP_MULTIPLICATOR_XY + #define BABYSTEP_SIZE_Y BABYSTEP_MULTIPLICATOR_XY + #define BABYSTEP_SIZE_Z BABYSTEP_MULTIPLICATOR_Z + #endif +#endif + #if IS_KINEMATIC && HAS_JUNCTION_DEVIATION #define HAS_DIST_MM_ARG 1 #endif diff --git a/buildroot/tests/LPC1768 b/buildroot/tests/LPC1768 index ee01bb621fcf3..d616f7f48f826 100755 --- a/buildroot/tests/LPC1768 +++ b/buildroot/tests/LPC1768 @@ -44,7 +44,7 @@ opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER ADAPTIVE_FAN_SLOWING TE FILAMENT_WIDTH_SENSOR FILAMENT_LCD_DISPLAY PID_EXTRUSION_SCALING SOUND_MENU_ITEM \ NOZZLE_AS_PROBE AUTO_BED_LEVELING_BILINEAR PREHEAT_BEFORE_LEVELING G29_RETRY_AND_RECOVER Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \ ASSISTED_TRAMMING ASSISTED_TRAMMING_WIZARD REPORT_TRAMMING_MM ASSISTED_TRAMMING_WAIT_POSITION \ - BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET BABYSTEP_GFX_OVERLAY \ + BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET EP_BABYSTEPPING BABYSTEP_GFX_OVERLAY \ 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 \ HOST_KEEPALIVE_FEATURE HOST_ACTION_COMMANDS HOST_PROMPT_SUPPORT \ diff --git a/buildroot/tests/mega2560 b/buildroot/tests/mega2560 index ad9763451f479..1490c9e4aaa4c 100755 --- a/buildroot/tests/mega2560 +++ b/buildroot/tests/mega2560 @@ -30,7 +30,7 @@ opt_enable AUTO_BED_LEVELING_UBL AVOID_OBSTACLES RESTORE_LEVELING_AFTER_G28 DEBU REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER LIGHTWEIGHT_UI STATUS_MESSAGE_SCROLLING SHOW_CUSTOM_BOOTSCREEN BOOT_MARLIN_LOGO_SMALL \ SDSUPPORT SDCARD_SORT_ALPHA USB_FLASH_DRIVE_SUPPORT AUTO_REPORT_SD_STATUS SCROLL_LONG_FILENAMES MEDIA_MENU_AT_TOP \ EEPROM_SETTINGS EEPROM_CHITCHAT GCODE_MACROS CUSTOM_MENU_MAIN FREEZE_FEATURE CANCEL_OBJECTS SOUND_MENU_ITEM \ - MULTI_NOZZLE_DUPLICATION CLASSIC_JERK LIN_ADVANCE ADVANCE_K_EXTRA QUICK_HOME \ + EMERGENCY_PARSER MULTI_NOZZLE_DUPLICATION CLASSIC_JERK LIN_ADVANCE ADVANCE_K_EXTRA QUICK_HOME \ SET_PROGRESS_MANUALLY SET_PROGRESS_PERCENT PRINT_PROGRESS_SHOW_DECIMALS SHOW_REMAINING_TIME \ ENCODER_NOISE_FILTER BABYSTEPPING BABYSTEP_XY NANODLP_Z_SYNC I2C_POSITION_ENCODERS M114_DETAIL exec_test $1 $2 "Azteeg X3 Pro | EXTRUDERS 5 | RRDFGSC | UBL | LIN_ADVANCE ..." "$3" diff --git a/ini/native.ini b/ini/native.ini index 481dac1777bd4..03c6c59265e96 100644 --- a/ini/native.ini +++ b/ini/native.ini @@ -43,7 +43,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/refs/heads/bugfix-2.1.x.zip + MarlinSimUI=https://github.com/p3p/MarlinSimUI/archive/bugfix-2.1.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 a3eace117ced5ad72227046465a6d878f66261d9 Mon Sep 17 00:00:00 2001 From: EvilGremlin <22657714+EvilGremlin@users.noreply.github.com> Date: Thu, 25 May 2023 10:32:04 +0300 Subject: [PATCH 064/100] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Imp?= =?UTF-8?q?rove=20missing=20translations=20script=20(#25841)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- .../share/scripts/findMissingTranslations.sh | 69 +++++++++++++++++-- 1 file changed, 63 insertions(+), 6 deletions(-) diff --git a/buildroot/share/scripts/findMissingTranslations.sh b/buildroot/share/scripts/findMissingTranslations.sh index 24a2a910a21cc..ece3a1fe59b1f 100755 --- a/buildroot/share/scripts/findMissingTranslations.sh +++ b/buildroot/share/scripts/findMissingTranslations.sh @@ -9,6 +9,29 @@ # If no language codes are specified then all languages will be checked # +langname() { + case "$1" in + an ) echo "Aragonese" ;; bg ) echo "Bulgarian" ;; + ca ) echo "Catalan" ;; cz ) echo "Czech" ;; + da ) echo "Danish" ;; de ) echo "German" ;; + el ) echo "Greek" ;; el_CY ) echo "Greek (Cyprus)" ;; + el_gr) echo "Greek (Greece)" ;; en ) echo "English" ;; + es ) echo "Spanish" ;; eu ) echo "Basque-Euskera" ;; + fi ) echo "Finnish" ;; fr ) echo "French" ;; + fr_na) echo "French (no accent)" ;; gl ) echo "Galician" ;; + hr ) echo "Croatian (Hrvatski)" ;; hu ) echo "Hungarian / Magyar" ;; + it ) echo "Italian" ;; jp_kana) echo "Japanese (Kana)" ;; + ko_KR) echo "Korean" ;; nl ) echo "Dutch" ;; + pl ) echo "Polish" ;; pt ) echo "Portuguese" ;; + pt_br) echo "Portuguese (Brazil)" ;; ru ) echo "Russian" ;; + sk ) echo "Slovak" ;; sv ) echo "Swedish" ;; + test ) echo "TEST" ;; tr ) echo "Turkish" ;; + uk ) echo "Ukrainian" ;; vi ) echo "Vietnamese" ;; + zh_CN) echo "Simplified Chinese" ;; zh_TW ) echo "Traditional Chinese" ;; + * ) echo "" ;; + esac +} + LANGHOME="Marlin/src/lcd/language" [ -d $LANGHOME ] && cd $LANGHOME @@ -20,7 +43,7 @@ TEST_LANGS="" if [[ -n $@ ]]; then for K in "$@"; do for F in $FILES; do - [[ "$F" != "${F%$K*}" ]] && TEST_LANGS+="$F " + [[ $F == $K ]] && TEST_LANGS+="$F " done done [[ -z $TEST_LANGS ]] && { echo "No languages matching $@." ; exit 0 ; } @@ -28,20 +51,54 @@ else TEST_LANGS=$FILES fi -echo "Missing strings for $TEST_LANGS..." +echo "Finding all missing strings for $TEST_LANGS..." + +WORD_LINES=() # Complete lines for all words (or, grep out of en at the end instead) +ALL_MISSING=() # All missing languages for each missing word +#NEED_WORDS=() # All missing words across all specified languages + +WORD_COUNT=0 +# Go through all strings in the English language file +# For each word, query all specified languages for the word +# If the word is missing, add its language to the list for WORD in $(awk '/LSTR/{print $2}' language_en.h); do + # Skip MSG_MARLIN [[ $WORD == "MSG_MARLIN" ]] && break - LANG_LIST="" + + ((WORD_COUNT++)) + + # Find all selected languages that lack the string + LANG_MISSING=" " for LANG in $TEST_LANGS; do if [[ $(grep -c -E "^ *LSTR +$WORD\b" language_${LANG}.h) -eq 0 ]]; then INHERIT=$(awk '/using namespace/{print $3}' language_${LANG}.h | sed -E 's/Language_([a-zA-Z_]+)\s*;/\1/') if [[ -z $INHERIT || $INHERIT == "en" ]]; then - LANG_LIST+=" $LANG" + LANG_MISSING+="$LANG " elif [[ $(grep -c -E "^ *LSTR +$WORD\b" language_${INHERIT}.h) -eq 0 ]]; then - LANG_LIST+=" $LANG" + LANG_MISSING+="$LANG " fi fi done - [[ -n $LANG_LIST ]] && printf "%-38s :%s\n" "$WORD" "$LANG_LIST" + # For each word store all the missing languages + if [[ $LANG_MISSING != " " ]]; then + WORD_LINES+=("$(grep -m 1 -E "$WORD\b" language_en.h)") + ALL_MISSING+=("$LANG_MISSING") + #NEED_WORDS+=($WORD) + fi +done + +echo +echo "${#WORD_LINES[@]} out of $WORD_COUNT LCD strings need translation" + +for LANG in $TEST_LANGS; do + HED=0 ; IND=0 + for WORDLANGS in "${ALL_MISSING[@]}"; do + # If the current word is missing from the current language then print it + if [[ $WORDLANGS =~ " $LANG " ]]; then + [[ $HED == 0 ]] && { echo ; echo "Missing strings for language_$LANG.h ($(langname $LANG)):" ; HED=1 ; } + echo "${WORD_LINES[$IND]}" + fi + ((IND++)) + done done From d20ce5ff0a4d45e2ac7091832c86d4441f0356a9 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 26 May 2023 00:21:31 +0000 Subject: [PATCH 065/100] [cron] Bump distribution date (2023-05-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 4a4d913781393..bb0da06648856 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 "2023-05-25" +//#define STRING_DISTRIBUTION_DATE "2023-05-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 be7fa433757e8..a203e9267c89e 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 "2023-05-25" + #define STRING_DISTRIBUTION_DATE "2023-05-26" #endif /** From f73fe76b6c5f9088222265e47494611e9d8bc379 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 26 May 2023 17:50:42 -0500 Subject: [PATCH 066/100] =?UTF-8?q?=F0=9F=8C=90=20Language=20export=20to?= =?UTF-8?q?=20CSV?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 + Marlin/src/lcd/language/language_el_gr.h | 2 +- buildroot/share/scripts/exportTranslations.py | 193 ++++++++++++++++++ .../share/scripts/findMissingTranslations.sh | 6 +- 4 files changed, 199 insertions(+), 4 deletions(-) create mode 100755 buildroot/share/scripts/exportTranslations.py diff --git a/.gitignore b/.gitignore index a7f8a091aa4a2..cff637d36e792 100755 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,8 @@ bdf2u8g.exe genpages.exe marlin_config.json mczip.h +language*.csv +csv-out/ *.gen *.sublime-workspace diff --git a/Marlin/src/lcd/language/language_el_gr.h b/Marlin/src/lcd/language/language_el_gr.h index d4eabb70cea20..696b1d055df64 100644 --- a/Marlin/src/lcd/language/language_el_gr.h +++ b/Marlin/src/lcd/language/language_el_gr.h @@ -147,7 +147,7 @@ namespace Language_el_gr { LSTR MSG_STORE_EEPROM = _UxGT("Αποθήκευση"); LSTR MSG_LOAD_EEPROM = _UxGT("Φόρτωση"); LSTR MSG_RESTORE_DEFAULTS = _UxGT("Επαναφορά ασφαλούς αντιγράφου"); - LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Ανανέωση"); + LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Ανανέωση"); LSTR MSG_INFO_SCREEN = _UxGT("Οθόνη πληροφόρησης"); LSTR MSG_PREPARE = _UxGT("Προετοιμασία"); LSTR MSG_TUNE = _UxGT("Συντονισμός"); diff --git a/buildroot/share/scripts/exportTranslations.py b/buildroot/share/scripts/exportTranslations.py new file mode 100755 index 0000000000000..620c2e77b1c27 --- /dev/null +++ b/buildroot/share/scripts/exportTranslations.py @@ -0,0 +1,193 @@ +#!/usr/bin/env python3 +# +# exportTranslations.py +# +# Export LCD language strings to CSV files for easier translation. +# Use importTranslations.py to import CSV into the language files. +# + +import re +from pathlib import Path + +# Write multiple sheets if true, otherwise write one giant sheet +MULTISHEET = True + +# Where to look for the language files +LANGHOME = "Marlin/src/lcd/language" + +# Check for the path to the language files +if not Path(LANGHOME).is_dir(): + print("Error: Couldn't find the '%s' directory." % LANGHOME) + print("Edit LANGHOME or cd to the root of the repo before running.") + exit(1) + +# A dictionary to contain language names +LANGNAME = { + 'an': "Aragonese", + 'bg': "Bulgarian", + 'ca': "Catalan", + 'cz': "Czech", + 'da': "Danish", + 'de': "German", + 'el': "Greek", 'el_CY': "Greek (Cyprus)", 'el_gr': "Greek (Greece)", + 'en': "English", + 'es': "Spanish", + 'eu': "Basque-Euskera", + 'fi': "Finnish", + 'fr': "French", 'fr_na': "French (no accent)", + 'gl': "Galician", + 'hr': "Croatian (Hrvatski)", + 'hu': "Hungarian / Magyar", + 'it': "Italian", + 'jp_kana': "Japanese (Kana)", + 'ko_KR': "Korean", + 'nl': "Dutch", + 'pl': "Polish", + 'pt': "Portuguese", 'pt_br': "Portuguese (Brazil)", + 'ro': "Romanian", + 'ru': "Russian", + 'sk': "Slovak", + 'sv': "Swedish", + 'tr': "Turkish", + 'uk': "Ukrainian", + 'vi': "Vietnamese", + 'zh_CN': "Simplified Chinese", 'zh_TW': "Traditional Chinese" +} + +# A limit just for testing +LIMIT = 0 + +# A dictionary to contain strings for each language. +# Init with 'en' so English will always be first. +language_strings = { 'en': 0 } + +# A dictionary to contain all distinct LCD string names +names = {} + +# Get all "language_*.h" files +langfiles = sorted(list(Path(LANGHOME).glob('language_*.h'))) + +# Read each language file +for langfile in langfiles: + # Get the language code from the filename + langcode = langfile.name.replace('language_', '').replace('.h', '') + + # Skip 'test' and any others that we don't want + if langcode in ['test']: continue + + # Open the file + f = open(langfile, 'r', encoding='utf-8') + if not f: continue + + # Flags to indicate a wide or tall section + wideflag = False + tallflag = False + # A counter for the number of strings in the file + stringcount = 0 + # A dictionary to hold all the strings + strings = { 'narrow': {}, 'wide': {}, 'tall': {} } + # Read each line in the file + for line in f: + # Clean up the line for easier parsing + line = line.split("//")[0].strip() + if line.endswith(';'): line = line[:-1].strip() + + # Check for wide or tall sections, assume no complicated nesting + if line.startswith("#endif") or line.startswith("#else"): + wideflag = False + tallflag = False + elif re.match(r'#if.*WIDTH\s*>=?\s*2[01].*', line): wideflag = True + elif re.match(r'#if.*LCD_HEIGHT\s*>=?\s*4.*', line): tallflag = True + + # For string-defining lines capture the string data + match = re.match(r'LSTR\s+([A-Z0-9_]+)\s*=\s*(.+)\s*', line) + if match: + # The name is the first captured group + name = match.group(1) + # The value is the second captured group + value = match.group(2) + # Replace escaped quotes temporarily + value = value.replace('\\"', '__Q__') + + # Remove all _UxGT wrappers from the value in a non-greedy way + value = re.sub(r'_UxGT\((".*?")\)', r'\1', value) + + # Multi-line strings will get one or more bars | for identification + multiline = 0 + multimatch = re.match(r'.*MSG_(\d)_LINE\s*\(\s*(.+?)\s*\).*', value) + if multimatch: + multiline = int(multimatch.group(1)) + value = '|' + re.sub(r'"\s*,\s*"', '|', multimatch.group(2)) + + # Wrap inline defines in parentheses + value = re.sub(r' *([A-Z0-9]+_[A-Z0-9_]+) *', r'(\1)', value) + # Remove quotes around strings + value = re.sub(r'"(.*?)"', r'\1', value).replace('__Q__', '"') + # Store all unique names as dictionary keys + names[name] = 1 + # Store the string as narrow or wide + strings['tall' if tallflag else 'wide' if wideflag else 'narrow'][name] = value + + # Increment the string counter + stringcount += 1 + # Break for testing + if LIMIT and stringcount >= LIMIT: break + + # Close the file + f.close() + # Store the array in the dict + language_strings[langcode] = strings + +# Get the language codes from the dictionary +langcodes = list(language_strings.keys()) + +# Print the array +#print(language_strings) + +# Write a single language entry to the CSV file with narrow, wide, and tall strings +def write_csv_lang(f, strings, name): + f.write(',') + if name in strings['narrow']: f.write('"%s"' % strings['narrow'][name]) + f.write(',') + if name in strings['wide']: f.write('"%s"' % strings['wide'][name]) + f.write(',') + if name in strings['tall']: f.write('"%s"' % strings['tall'][name]) + +if MULTISHEET: + # + # Export a separate sheet for each language + # + OUTDIR = 'csv-out' + Path.mkdir(Path(OUTDIR), exist_ok=True) + + for lang in langcodes: + f = open("%s/language_%s.csv" % (OUTDIR, lang), 'w', encoding='utf-8') + if not f: continue + + lname = lang + ' ' + LANGNAME[lang] + header = ['name', lname, lname + ' (wide)', lname + ' (tall)'] + f.write('"' + '","'.join(header) + '"\n') + + for name in names.keys(): + f.write('"' + name + '"') + write_csv_lang(f, language_strings[lang], name) + f.write('\n') + f.close() + +else: + # + # Export one large sheet containing all languages + # + f = open("languages.csv", 'w', encoding='utf-8') + if f: + header = ['name'] + for lang in langcodes: + lname = lang + ' ' + LANGNAME[lang] + header += [lname, lname + ' (wide)', lname + ' (tall)'] + f.write('"' + '","'.join(header) + '"\n') + + for name in names.keys(): + f.write('"' + name + '"') + for lang in langcodes: write_csv_lang(f, language_strings[lang], name) + f.write('\n') + f.close() diff --git a/buildroot/share/scripts/findMissingTranslations.sh b/buildroot/share/scripts/findMissingTranslations.sh index ece3a1fe59b1f..366075d5b9691 100755 --- a/buildroot/share/scripts/findMissingTranslations.sh +++ b/buildroot/share/scripts/findMissingTranslations.sh @@ -23,9 +23,9 @@ langname() { it ) echo "Italian" ;; jp_kana) echo "Japanese (Kana)" ;; ko_KR) echo "Korean" ;; nl ) echo "Dutch" ;; pl ) echo "Polish" ;; pt ) echo "Portuguese" ;; - pt_br) echo "Portuguese (Brazil)" ;; ru ) echo "Russian" ;; - sk ) echo "Slovak" ;; sv ) echo "Swedish" ;; - test ) echo "TEST" ;; tr ) echo "Turkish" ;; + pt_br) echo "Portuguese (Brazil)" ;; ro ) echo "Romanian" ;; + ru ) echo "Russian" ;; sk ) echo "Slovak" ;; + sv ) echo "Swedish" ;; tr ) echo "Turkish" ;; uk ) echo "Ukrainian" ;; vi ) echo "Vietnamese" ;; zh_CN) echo "Simplified Chinese" ;; zh_TW ) echo "Traditional Chinese" ;; * ) echo "" ;; From 154e48ba22ceedb01e9058a7f8da9457a445ee19 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 26 May 2023 18:54:50 -0500 Subject: [PATCH 067/100] =?UTF-8?q?=F0=9F=8E=A8=20Misc.=20spacing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/language/language_ca.h | 2 +- Marlin/src/lcd/language/language_da.h | 8 +- Marlin/src/lcd/language/language_de.h | 2 +- Marlin/src/lcd/language/language_el.h | 14 +- Marlin/src/lcd/language/language_es.h | 2 +- Marlin/src/lcd/language/language_eu.h | 2 +- Marlin/src/lcd/language/language_fi.h | 2 +- Marlin/src/lcd/language/language_fr.h | 2 +- Marlin/src/lcd/language/language_fr_na.h | 2 +- Marlin/src/lcd/language/language_gl.h | 2 +- Marlin/src/lcd/language/language_hr.h | 2 +- Marlin/src/lcd/language/language_hu.h | 2 +- Marlin/src/lcd/language/language_it.h | 16 +- Marlin/src/lcd/language/language_jp_kana.h | 328 ++++---- Marlin/src/lcd/language/language_ko_KR.h | 2 +- Marlin/src/lcd/language/language_nl.h | 10 +- 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_sk.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 | 341 ++++---- Marlin/src/lcd/language/language_zh_CN.h | 606 +++++++------- Marlin/src/lcd/language/language_zh_TW.h | 768 +++++++++--------- .../pins/stm32f1/pins_KEDI_CONTROLLER_V1_2.h | 10 +- 26 files changed, 1068 insertions(+), 1067 deletions(-) diff --git a/Marlin/src/lcd/language/language_ca.h b/Marlin/src/lcd/language/language_ca.h index ac6d4388e1ad3..b750ff155125c 100644 --- a/Marlin/src/lcd/language/language_ca.h +++ b/Marlin/src/lcd/language/language_ca.h @@ -122,7 +122,7 @@ namespace Language_ca { LSTR MSG_STORE_EEPROM = _UxGT("Desa memoria"); LSTR MSG_LOAD_EEPROM = _UxGT("Carrega memoria"); LSTR MSG_RESTORE_DEFAULTS = _UxGT("Restaura valors"); - LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Actualitza"); + LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Actualitza"); LSTR MSG_INFO_SCREEN = _UxGT("Pantalla Info."); LSTR MSG_PREPARE = _UxGT("Prepara"); LSTR MSG_TUNE = _UxGT("Ajusta"); diff --git a/Marlin/src/lcd/language/language_da.h b/Marlin/src/lcd/language/language_da.h index a424883000b90..91dc3513f7fc8 100644 --- a/Marlin/src/lcd/language/language_da.h +++ b/Marlin/src/lcd/language/language_da.h @@ -92,9 +92,9 @@ namespace Language_da { LSTR MSG_FAN_SPEED = _UxGT("Blæser hastighed"); LSTR MSG_FAN_SPEED_N = _UxGT("Blæser hastighed ~"); LSTR MSG_CONTROL = _UxGT("Kontrol"); - LSTR MSG_MIN = _UxGT(" \002 Min"); - LSTR MSG_MAX = _UxGT(" \002 Max"); - LSTR MSG_FACTOR = _UxGT(" \002 Fact"); + LSTR MSG_MIN = " " LCD_STR_THERMOMETER _UxGT(" Min"); + LSTR MSG_MAX = " " LCD_STR_THERMOMETER _UxGT(" Max"); + LSTR MSG_FACTOR = " " LCD_STR_THERMOMETER _UxGT(" Fact"); LSTR MSG_AUTOTEMP = _UxGT("Autotemp"); LSTR MSG_LCD_ON = _UxGT("Til"); LSTR MSG_LCD_OFF = _UxGT("Fra"); @@ -111,7 +111,7 @@ namespace Language_da { LSTR MSG_STORE_EEPROM = _UxGT("Gem i EEPROM"); LSTR MSG_LOAD_EEPROM = _UxGT("Hent fra EEPROM"); LSTR MSG_RESTORE_DEFAULTS = _UxGT("Gendan Defaults"); - LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Genopfrisk"); + LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Genopfrisk"); LSTR MSG_INFO_SCREEN = _UxGT("Info skærm"); LSTR MSG_PREPARE = _UxGT("Forbered"); LSTR MSG_PAUSE_PRINT = _UxGT("Pause printet"); diff --git a/Marlin/src/lcd/language/language_de.h b/Marlin/src/lcd/language/language_de.h index 359afd8ad2ae0..2e75c2668b90b 100644 --- a/Marlin/src/lcd/language/language_de.h +++ b/Marlin/src/lcd/language/language_de.h @@ -513,7 +513,7 @@ namespace Language_de { LSTR MSG_FILAMENTUNLOAD = _UxGT("Filament entladen"); LSTR MSG_FILAMENTUNLOAD_E = _UxGT("Filament entladen *"); LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("Alles entladen"); - LSTR MSG_ATTACH_MEDIA = _UxGT("Medium initial."); // Manually initialize the SD-card via user interface + LSTR MSG_ATTACH_MEDIA = _UxGT("Medium initial."); // Manually initialize the SD-card via user interface LSTR MSG_CHANGE_MEDIA = _UxGT("Medium getauscht"); // SD-card changed by user. For machines with no autocarddetect. Both send "M21" LSTR MSG_RELEASE_MEDIA = _UxGT("Medium freigeben"); // if Marlin gets confused - M22 LSTR MSG_ZPROBE_OUT = _UxGT("Z-Sonde außerhalb"); diff --git a/Marlin/src/lcd/language/language_el.h b/Marlin/src/lcd/language/language_el.h index e18bda4edfc36..aab74cc494f4f 100644 --- a/Marlin/src/lcd/language/language_el.h +++ b/Marlin/src/lcd/language/language_el.h @@ -70,16 +70,16 @@ namespace Language_el { LSTR MSG_PREHEAT_1_END = _UxGT("Προθέρμανση ") PREHEAT_1_LABEL _UxGT(" End"); LSTR MSG_PREHEAT_1_END_E = _UxGT("Προθέρμανση ") PREHEAT_1_LABEL _UxGT(" End ~"); LSTR MSG_PREHEAT_1_ALL = _UxGT("Προθέρμανση ") PREHEAT_1_LABEL _UxGT(" όλα"); - LSTR MSG_PREHEAT_1_BEDONLY = _UxGT("Προθέρμανση ") PREHEAT_1_LABEL _UxGT(" bed"); //SHORTEN - LSTR MSG_PREHEAT_1_SETTINGS = _UxGT("Προθέρμανση ") PREHEAT_1_LABEL _UxGT(" επιβεβαίωση"); //SHORTEN + LSTR MSG_PREHEAT_1_BEDONLY = _UxGT("Προθέρμανση ") PREHEAT_1_LABEL _UxGT(" bed"); // SHORTEN + LSTR MSG_PREHEAT_1_SETTINGS = _UxGT("Προθέρμανση ") PREHEAT_1_LABEL _UxGT(" επιβεβαίωση"); // SHORTEN LSTR MSG_PREHEAT_M = _UxGT("Προθέρμανση $"); LSTR MSG_PREHEAT_M_H = _UxGT("Προθέρμανση $ ~"); LSTR MSG_PREHEAT_M_END = _UxGT("Προθέρμανση $ End"); LSTR MSG_PREHEAT_M_END_E = _UxGT("Προθέρμανση $ End ~"); LSTR MSG_PREHEAT_M_ALL = _UxGT("Προθέρμανση $ όλα"); - LSTR MSG_PREHEAT_M_BEDONLY = _UxGT("Προθέρμανση $ bed"); //SHORTEN - LSTR MSG_PREHEAT_M_SETTINGS = _UxGT("Προθέρμανση $ επιβεβαίωση"); //SHORTEN + LSTR MSG_PREHEAT_M_BEDONLY = _UxGT("Προθέρμανση $ bed"); // SHORTEN + LSTR MSG_PREHEAT_M_SETTINGS = _UxGT("Προθέρμανση $ επιβεβαίωση"); // SHORTEN #endif LSTR MSG_COOLDOWN = _UxGT("Αποθέρμανση"); LSTR MSG_SWITCH_PS_ON = _UxGT("Ενεργοποίηση"); @@ -157,7 +157,7 @@ namespace Language_el { LSTR MSG_STORE_EEPROM = _UxGT("Αποθήκευση σε EEPROM"); LSTR MSG_LOAD_EEPROM = _UxGT("Φόρτωση από EEPROM"); LSTR MSG_RESTORE_DEFAULTS = _UxGT("Επαναφορά προεπιλογών"); - LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Ανανέωση"); + LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Ανανέωση"); LSTR MSG_INFO_SCREEN = _UxGT("Οθόνη πληροφόρησης"); LSTR MSG_PREPARE = _UxGT("Προετοιμασία"); LSTR MSG_TUNE = _UxGT("Συντονισμός"); @@ -173,7 +173,7 @@ namespace Language_el { LSTR MSG_KILLED = _UxGT("ΤΕΡΜΑΤΙΣΜΟΣ. "); LSTR MSG_STOPPED = _UxGT("ΔΙΑΚΟΠΗ. "); LSTR MSG_CONTROL_RETRACT = _UxGT("Ανάσυρση μμ"); - LSTR MSG_CONTROL_RETRACT_SWAP = _UxGT("Εναλλαγή ανάσυρσης mm"); //SHORTEN + LSTR MSG_CONTROL_RETRACT_SWAP = _UxGT("Εναλλαγή ανάσυρσης mm"); // SHORTEN LSTR MSG_CONTROL_RETRACTF = _UxGT("Ανάσυρση V"); LSTR MSG_CONTROL_RETRACT_ZHOP = _UxGT("Μεταπήδηση mm"); LSTR MSG_CONTROL_RETRACT_RECOVER = _UxGT("Unretr. mm"); @@ -184,7 +184,7 @@ namespace Language_el { LSTR MSG_FILAMENTCHANGE_E = _UxGT("Αλλαγή νήματος *"); LSTR MSG_ATTACH_MEDIA = _UxGT("Προετοιμασία SD"); LSTR MSG_CHANGE_MEDIA = _UxGT("Αλλαγή κάρτας SD"); - LSTR MSG_ZPROBE_OUT = _UxGT("Διερεύνηση Z εκτός Επ.Εκτύπωσης"); //SHORTEN + LSTR MSG_ZPROBE_OUT = _UxGT("Διερεύνηση Z εκτός Επ.Εκτύπωσης"); // SHORTEN LSTR MSG_YX_UNHOMED = _UxGT("Επαναφορά Χ/Υ πρώτα"); LSTR MSG_XYZ_UNHOMED = _UxGT("Επαναφορά ΧΥΖ πρώτα"); LSTR MSG_ZPROBE_ZOFFSET = _UxGT("Μετατόπιση Ζ"); diff --git a/Marlin/src/lcd/language/language_es.h b/Marlin/src/lcd/language/language_es.h index b2e5af70f5262..a487c7d289184 100644 --- a/Marlin/src/lcd/language/language_es.h +++ b/Marlin/src/lcd/language/language_es.h @@ -319,7 +319,7 @@ namespace Language_es { LSTR MSG_ERR_EEPROM_VERSION = _UxGT("Err: Versión EEPROM"); LSTR MSG_MEDIA_UPDATE = _UxGT("Actualizar SD/FD"); LSTR MSG_RESET_PRINTER = _UxGT("Resetear Impresora"); - LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Recargar"); + LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Recargar"); LSTR MSG_INFO_SCREEN = _UxGT("Pantalla de Inf."); LSTR MSG_PREPARE = _UxGT("Preparar"); LSTR MSG_TUNE = _UxGT("Ajustar"); diff --git a/Marlin/src/lcd/language/language_eu.h b/Marlin/src/lcd/language/language_eu.h index 9b969762d5509..6433fde99fbac 100644 --- a/Marlin/src/lcd/language/language_eu.h +++ b/Marlin/src/lcd/language/language_eu.h @@ -194,7 +194,7 @@ namespace Language_eu { LSTR MSG_LOAD_EEPROM = _UxGT("Kargatu memoria"); LSTR MSG_RESTORE_DEFAULTS = _UxGT("Larri. berriz."); LSTR MSG_INIT_EEPROM = _UxGT("EEPROM-a hasieratu"); - LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Berriz kargatu"); + LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Berriz kargatu"); LSTR MSG_INFO_SCREEN = _UxGT("Pantaila info"); LSTR MSG_PREPARE = _UxGT("Prestatu"); LSTR MSG_TUNE = _UxGT("Doitu"); diff --git a/Marlin/src/lcd/language/language_fi.h b/Marlin/src/lcd/language/language_fi.h index 57fc0a7c21b5c..8d5e4c7143091 100644 --- a/Marlin/src/lcd/language/language_fi.h +++ b/Marlin/src/lcd/language/language_fi.h @@ -102,7 +102,7 @@ namespace Language_fi { LSTR MSG_STORE_EEPROM = _UxGT("Tallenna muistiin"); LSTR MSG_LOAD_EEPROM = _UxGT("Lataa muistista"); LSTR MSG_RESTORE_DEFAULTS = _UxGT("Palauta oletus"); - LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Päivitä"); + LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Päivitä"); LSTR MSG_INFO_SCREEN = _UxGT("Seuraa"); LSTR MSG_PREPARE = _UxGT("Valmistele"); LSTR MSG_TUNE = _UxGT("Säädä"); diff --git a/Marlin/src/lcd/language/language_fr.h b/Marlin/src/lcd/language/language_fr.h index 01422f5c76e76..4f04345252646 100644 --- a/Marlin/src/lcd/language/language_fr.h +++ b/Marlin/src/lcd/language/language_fr.h @@ -331,7 +331,7 @@ namespace Language_fr { LSTR MSG_SETTINGS_STORED = _UxGT("Config. enregistrée"); LSTR MSG_MEDIA_UPDATE = _UxGT("MaJ Firmware SD"); LSTR MSG_RESET_PRINTER = _UxGT("RaZ imprimante"); - LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Actualiser"); + LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Actualiser"); LSTR MSG_INFO_SCREEN = _UxGT("Surveiller"); LSTR MSG_PREPARE = _UxGT("Préparer"); LSTR MSG_TUNE = _UxGT("Régler"); diff --git a/Marlin/src/lcd/language/language_fr_na.h b/Marlin/src/lcd/language/language_fr_na.h index 12fa0295eaa0d..4441a7970a2e4 100644 --- a/Marlin/src/lcd/language/language_fr_na.h +++ b/Marlin/src/lcd/language/language_fr_na.h @@ -331,7 +331,7 @@ namespace Language_fr_na { LSTR MSG_SETTINGS_STORED = _UxGT("Config. enregistree"); LSTR MSG_MEDIA_UPDATE = _UxGT("MaJ Firmware SD"); LSTR MSG_RESET_PRINTER = _UxGT("RaZ imprimante"); - LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Actualiser"); + LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Actualiser"); LSTR MSG_INFO_SCREEN = _UxGT("Surveiller"); LSTR MSG_PREPARE = _UxGT("Preparer"); LSTR MSG_TUNE = _UxGT("Regler"); diff --git a/Marlin/src/lcd/language/language_gl.h b/Marlin/src/lcd/language/language_gl.h index fcdee2405c418..25b30f71eb0ac 100644 --- a/Marlin/src/lcd/language/language_gl.h +++ b/Marlin/src/lcd/language/language_gl.h @@ -322,7 +322,7 @@ namespace Language_gl { LSTR MSG_SETTINGS_STORED = _UxGT("Config Gardada"); LSTR MSG_MEDIA_UPDATE = _UxGT("Actualizar SD/FD"); LSTR MSG_RESET_PRINTER = _UxGT("Reiniciar Impresora"); - LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Recargar"); + LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Recargar"); LSTR MSG_INFO_SCREEN = _UxGT("Información"); LSTR MSG_PREPARE = _UxGT("Preparar"); LSTR MSG_TUNE = _UxGT("Axustar"); diff --git a/Marlin/src/lcd/language/language_hr.h b/Marlin/src/lcd/language/language_hr.h index 1f51c5c539b00..a857fb3619965 100644 --- a/Marlin/src/lcd/language/language_hr.h +++ b/Marlin/src/lcd/language/language_hr.h @@ -105,7 +105,7 @@ namespace Language_hr { LSTR MSG_STORE_EEPROM = _UxGT("Pohrani u memoriju"); LSTR MSG_LOAD_EEPROM = _UxGT("Učitaj memoriju"); LSTR MSG_RESTORE_DEFAULTS = _UxGT("Učitaj Defaults"); - LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Osvježi"); + LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Osvježi"); LSTR MSG_INFO_SCREEN = _UxGT("Info screen"); LSTR MSG_PREPARE = _UxGT("Pripremi"); LSTR MSG_PAUSE_PRINT = _UxGT("Pauziraj print"); diff --git a/Marlin/src/lcd/language/language_hu.h b/Marlin/src/lcd/language/language_hu.h index 8a6f66f9941a2..f3880a31a6f84 100644 --- a/Marlin/src/lcd/language/language_hu.h +++ b/Marlin/src/lcd/language/language_hu.h @@ -368,7 +368,7 @@ namespace Language_hu { LSTR MSG_SETTINGS_STORED = _UxGT("Beállítások mentve"); LSTR MSG_MEDIA_UPDATE = _UxGT("Tároló frissítés"); LSTR MSG_RESET_PRINTER = _UxGT("Nyomtató újraindítása"); - LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Frissítés"); + LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Frissítés"); LSTR MSG_INFO_SCREEN = _UxGT(""); LSTR MSG_PREPARE = _UxGT("Vezérlés"); LSTR MSG_TUNE = _UxGT("Hangolás"); diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index 96c1499f558e9..a6b48b0d0a1b7 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -338,11 +338,11 @@ namespace Language_it { LSTR MSG_FLOWMETER_SAFETY = _UxGT("Sicurezza flusso"); LSTR MSG_CUTTER = _UxGT("Taglio"); LSTR MSG_LASER = _UxGT("Laser"); - LSTR MSG_FAN_SPEED = _UxGT("Vel. ventola"); // Max 15 characters - LSTR MSG_FAN_SPEED_N = _UxGT("Vel. ventola ~"); // Max 15 characters - LSTR MSG_STORED_FAN_N = _UxGT("Ventola mem. ~"); // Max 15 characters - LSTR MSG_EXTRA_FAN_SPEED = _UxGT("Extra vel.vent."); // Max 15 characters - LSTR MSG_EXTRA_FAN_SPEED_N = _UxGT("Extra v.vent. ~"); // Max 15 characters + LSTR MSG_FAN_SPEED = _UxGT("Vel. ventola"); // Max 15 characters + LSTR MSG_FAN_SPEED_N = _UxGT("Vel. ventola ~"); // Max 15 characters + LSTR MSG_STORED_FAN_N = _UxGT("Ventola mem. ~"); // Max 15 characters + LSTR MSG_EXTRA_FAN_SPEED = _UxGT("Extra vel.vent."); // Max 15 characters + LSTR MSG_EXTRA_FAN_SPEED_N = _UxGT("Extra v.vent. ~"); // Max 15 characters LSTR MSG_CONTROLLER_FAN = _UxGT("Controller vent."); LSTR MSG_CONTROLLER_FAN_IDLE_SPEED = _UxGT("Vel. inattivo"); LSTR MSG_CONTROLLER_FAN_AUTO_ON = _UxGT("Modo autom."); @@ -597,7 +597,7 @@ namespace Language_it { 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 + LSTR MSG_HEATING_FAILED_LCD = _UxGT("Risc.Fallito"); // Max 12 characters LSTR MSG_ERR_REDUNDANT_TEMP = _UxGT("Err: TEMP RIDONDANTE"); LSTR MSG_THERMAL_RUNAWAY = _UxGT("TEMP FUORI CONTROLLO"); LSTR MSG_TEMP_MALFUNCTION = _UxGT("MALFUNZIONAMENTO TEMP"); @@ -702,13 +702,13 @@ namespace Language_it { 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_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_FANCHECK = _UxGT("Verif.tacho vent."); // Max 17 characters LSTR MSG_KILL_HOMING_FAILED = _UxGT("Home fallito"); LSTR MSG_LCD_PROBING_FAILED = _UxGT("Sondaggio fallito"); diff --git a/Marlin/src/lcd/language/language_jp_kana.h b/Marlin/src/lcd/language/language_jp_kana.h index 75707108381a0..950ddcb5e5a2a 100644 --- a/Marlin/src/lcd/language/language_jp_kana.h +++ b/Marlin/src/lcd/language/language_jp_kana.h @@ -42,188 +42,188 @@ namespace Language_jp_kana { // 片仮名表示定義 LSTR WELCOME_MSG = MACHINE_NAME _UxGT(" ジュンビカンリョウ"); - LSTR MSG_MEDIA_INSERTED = _UxGT("メディアガソウニュウサレマシタ"); // "Card inserted" - LSTR MSG_MEDIA_REMOVED = _UxGT("メディアガアリマセン"); // "Card removed" + LSTR MSG_MEDIA_INSERTED = _UxGT("メディアガソウニュウサレマシタ"); // "Card inserted" + LSTR MSG_MEDIA_REMOVED = _UxGT("メディアガアリマセン"); // "Card removed" LSTR MSG_RELEASE_MEDIA = _UxGT("メディアノトリダシ"); - LSTR MSG_LCD_ENDSTOPS = _UxGT("エンドストップ"); // "Endstops" // Max length 8 characters - LSTR MSG_MAIN_MENU = _UxGT("メイン"); // "Main" - LSTR MSG_RUN_AUTO_FILES = _UxGT("ジドウカイシ"); // "Autostart" - LSTR MSG_DISABLE_STEPPERS = _UxGT("モーターデンゲン オフ"); // "Disable steppers" - LSTR MSG_DEBUG_MENU = _UxGT("デバッグメニュー"); // "Debug Menu" - LSTR MSG_PROGRESS_BAR_TEST = _UxGT("プログレスバー テスト"); // "Progress Bar Test" - LSTR MSG_AUTO_HOME = _UxGT("ゲンテンフッキ"); // "Auto home" - LSTR MSG_AUTO_HOME_X = _UxGT("Xジク ゲンテンフッキ"); // "Home X" - LSTR MSG_AUTO_HOME_Y = _UxGT("Yジク ゲンテンフッキ"); // "Home Y" - LSTR MSG_AUTO_HOME_Z = _UxGT("Zジク ゲンテンフッキ"); // "Home Z" - LSTR MSG_LEVEL_BED_HOMING = _UxGT("ゲンテンフッキチュウ"); // "Homing XYZ" - LSTR MSG_LEVEL_BED_WAITING = _UxGT("レベリングカイシ"); // "Click to Begin" - LSTR MSG_LEVEL_BED_NEXT_POINT = _UxGT("ツギノソクテイテンヘ"); // "Next Point" - 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_LCD_ENDSTOPS = _UxGT("エンドストップ"); // "Endstops" // Max length 8 characters + LSTR MSG_MAIN_MENU = _UxGT("メイン"); // "Main" + LSTR MSG_RUN_AUTO_FILES = _UxGT("ジドウカイシ"); // "Autostart" + LSTR MSG_DISABLE_STEPPERS = _UxGT("モーターデンゲン オフ"); // "Disable steppers" + LSTR MSG_DEBUG_MENU = _UxGT("デバッグメニュー"); // "Debug Menu" + LSTR MSG_PROGRESS_BAR_TEST = _UxGT("プログレスバー テスト"); // "Progress Bar Test" + LSTR MSG_AUTO_HOME = _UxGT("ゲンテンフッキ"); // "Auto home" + LSTR MSG_AUTO_HOME_X = _UxGT("Xジク ゲンテンフッキ"); // "Home X" + LSTR MSG_AUTO_HOME_Y = _UxGT("Yジク ゲンテンフッキ"); // "Home Y" + LSTR MSG_AUTO_HOME_Z = _UxGT("Zジク ゲンテンフッキ"); // "Home Z" + LSTR MSG_LEVEL_BED_HOMING = _UxGT("ゲンテンフッキチュウ"); // "Homing XYZ" + LSTR MSG_LEVEL_BED_WAITING = _UxGT("レベリングカイシ"); // "Click to Begin" + LSTR MSG_LEVEL_BED_NEXT_POINT = _UxGT("ツギノソクテイテンヘ"); // "Next Point" + 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" #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 - LSTR MSG_PREHEAT_1_END = PREHEAT_1_LABEL _UxGT(" ヨネツノズル"); // " Nozzle" - LSTR MSG_PREHEAT_1_END_E = PREHEAT_1_LABEL _UxGT(" ヨネツノズル ~"); // " Nozzle" - LSTR MSG_PREHEAT_1_ALL = PREHEAT_1_LABEL _UxGT(" スベテヨネツ"); // " All" - LSTR MSG_PREHEAT_1_BEDONLY = PREHEAT_1_LABEL _UxGT(" ベッドヨネツ"); // " Bed" - LSTR MSG_PREHEAT_1_SETTINGS = PREHEAT_1_LABEL _UxGT(" ヨネツセッテイ"); // " conf" + 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 + LSTR MSG_PREHEAT_1_END = PREHEAT_1_LABEL _UxGT(" ヨネツノズル"); // " Nozzle" + LSTR MSG_PREHEAT_1_END_E = PREHEAT_1_LABEL _UxGT(" ヨネツノズル ~"); // " Nozzle" + LSTR MSG_PREHEAT_1_ALL = PREHEAT_1_LABEL _UxGT(" スベテヨネツ"); // " All" + LSTR MSG_PREHEAT_1_BEDONLY = PREHEAT_1_LABEL _UxGT(" ベッドヨネツ"); // " Bed" + LSTR MSG_PREHEAT_1_SETTINGS = PREHEAT_1_LABEL _UxGT(" ヨネツセッテイ"); // " conf" - LSTR MSG_PREHEAT_M = _UxGT("$ ヨネツ"); // "Preheat " PREHEAT_1_LABEL - LSTR MSG_PREHEAT_M_H = _UxGT("$ ヨネツ ~"); // "Preheat " PREHEAT_1_LABEL - LSTR MSG_PREHEAT_M_END = _UxGT("$ ヨネツノズル"); // " Nozzle" - LSTR MSG_PREHEAT_M_END_E = _UxGT("$ ヨネツノズル ~"); // " Nozzle" - LSTR MSG_PREHEAT_M_ALL = _UxGT("$ スベテヨネツ"); // " All" - LSTR MSG_PREHEAT_M_BEDONLY = _UxGT("$ ベッドヨネツ"); // " Bed" - LSTR MSG_PREHEAT_M_SETTINGS = _UxGT("$ ヨネツセッテイ"); // " conf" + LSTR MSG_PREHEAT_M = _UxGT("$ ヨネツ"); // "Preheat " PREHEAT_1_LABEL + LSTR MSG_PREHEAT_M_H = _UxGT("$ ヨネツ ~"); // "Preheat " PREHEAT_1_LABEL + LSTR MSG_PREHEAT_M_END = _UxGT("$ ヨネツノズル"); // " Nozzle" + LSTR MSG_PREHEAT_M_END_E = _UxGT("$ ヨネツノズル ~"); // " Nozzle" + LSTR MSG_PREHEAT_M_ALL = _UxGT("$ スベテヨネツ"); // " All" + LSTR MSG_PREHEAT_M_BEDONLY = _UxGT("$ ベッドヨネツ"); // " Bed" + LSTR MSG_PREHEAT_M_SETTINGS = _UxGT("$ ヨネツセッテイ"); // " conf" #endif - LSTR MSG_COOLDOWN = _UxGT("カネツテイシ"); // "Cooldown" - LSTR MSG_SWITCH_PS_ON = _UxGT("デンゲン オン"); // "Switch power on" - LSTR MSG_SWITCH_PS_OFF = _UxGT("デンゲン オフ"); // "Switch power off" - LSTR MSG_EXTRUDE = _UxGT("オシダシ"); // "Extrude" - LSTR MSG_RETRACT = _UxGT("ヒキコミセッテイ"); // "Retract" - LSTR MSG_MOVE_AXIS = _UxGT("ジクイドウ"); // "Move axis" - LSTR MSG_BED_LEVELING = _UxGT("ベッドレベリング"); // "Bed leveling" - LSTR MSG_LEVEL_BED = _UxGT("ベッドレベリング"); // "Level bed" + LSTR MSG_COOLDOWN = _UxGT("カネツテイシ"); // "Cooldown" + LSTR MSG_SWITCH_PS_ON = _UxGT("デンゲン オン"); // "Switch power on" + LSTR MSG_SWITCH_PS_OFF = _UxGT("デンゲン オフ"); // "Switch power off" + LSTR MSG_EXTRUDE = _UxGT("オシダシ"); // "Extrude" + LSTR MSG_RETRACT = _UxGT("ヒキコミセッテイ"); // "Retract" + LSTR MSG_MOVE_AXIS = _UxGT("ジクイドウ"); // "Move axis" + LSTR MSG_BED_LEVELING = _UxGT("ベッドレベリング"); // "Bed leveling" + LSTR MSG_LEVEL_BED = _UxGT("ベッドレベリング"); // "Level bed" - LSTR MSG_MOVING = _UxGT("イドウチュウ"); // "Moving..." - LSTR MSG_FREE_XY = _UxGT("XYジク カイホウ"); // "Free XY" - LSTR MSG_MOVE_X = _UxGT("Xジク イドウ"); // "Move X" - LSTR MSG_MOVE_Y = _UxGT("Yジク イドウ"); // "Move Y" - LSTR MSG_MOVE_Z = _UxGT("Zジク イドウ"); // "Move Z" - LSTR MSG_MOVE_N = _UxGT("@ジク イドウ"); // "Move @" - LSTR MSG_MOVE_E = _UxGT("エクストルーダー"); // "Extruder" - LSTR MSG_MOVE_EN = _UxGT("* エクストルーダー"); // "En" - 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" - LSTR MSG_MOVE_50MM = _UxGT(" 50mm イドウ"); // "Move 50mm" - LSTR MSG_MOVE_100MM = _UxGT(" 100mm イドウ"); // "Move 100mm" - LSTR MSG_SPEED = _UxGT("ソクド"); // "Speed" - LSTR MSG_MESH_Z_OFFSET = _UxGT("Zオフセット"); // "Bed Z" - LSTR MSG_NOZZLE = _UxGT("ノズル"); // "Nozzle" - LSTR MSG_BED = _UxGT("ベッド"); // "Bed" - LSTR MSG_FAN_SPEED = _UxGT("ファンソクド"); // "Fan speed" - LSTR MSG_FLOW = _UxGT("トシュツリョウ"); // "Flow" - LSTR MSG_CONTROL = _UxGT("セイギョ"); // "Control" + LSTR MSG_MOVING = _UxGT("イドウチュウ"); // "Moving..." + LSTR MSG_FREE_XY = _UxGT("XYジク カイホウ"); // "Free XY" + LSTR MSG_MOVE_X = _UxGT("Xジク イドウ"); // "Move X" + LSTR MSG_MOVE_Y = _UxGT("Yジク イドウ"); // "Move Y" + LSTR MSG_MOVE_Z = _UxGT("Zジク イドウ"); // "Move Z" + LSTR MSG_MOVE_N = _UxGT("@ジク イドウ"); // "Move @" + LSTR MSG_MOVE_E = _UxGT("エクストルーダー"); // "Extruder" + LSTR MSG_MOVE_EN = _UxGT("* エクストルーダー"); // "En" + 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" + LSTR MSG_MOVE_50MM = _UxGT(" 50mm イドウ"); // "Move 50mm" + LSTR MSG_MOVE_100MM = _UxGT(" 100mm イドウ"); // "Move 100mm" + LSTR MSG_SPEED = _UxGT("ソクド"); // "Speed" + LSTR MSG_MESH_Z_OFFSET = _UxGT("Zオフセット"); // "Bed Z" + LSTR MSG_NOZZLE = _UxGT("ノズル"); // "Nozzle" + LSTR MSG_BED = _UxGT("ベッド"); // "Bed" + LSTR MSG_FAN_SPEED = _UxGT("ファンソクド"); // "Fan speed" + LSTR MSG_FLOW = _UxGT("トシュツリョウ"); // "Flow" + LSTR MSG_CONTROL = _UxGT("セイギョ"); // "Control" LSTR MSG_MIN = " " LCD_STR_THERMOMETER _UxGT(" サイテイ"); // " Min" LSTR MSG_MAX = " " LCD_STR_THERMOMETER _UxGT(" サイコウ"); // " Max" LSTR MSG_FACTOR = " " LCD_STR_THERMOMETER _UxGT(" ファクター"); // " Fact" - LSTR MSG_AUTOTEMP = _UxGT("ジドウオンドセイギョ"); // "Autotemp" - LSTR MSG_LCD_ON = _UxGT("オン"); // "On" - LSTR MSG_LCD_OFF = _UxGT("オフ"); // "Off" + LSTR MSG_AUTOTEMP = _UxGT("ジドウオンドセイギョ"); // "Autotemp" + LSTR MSG_LCD_ON = _UxGT("オン"); // "On" + LSTR MSG_LCD_OFF = _UxGT("オフ"); // "Off" LSTR MSG_SELECT_E = _UxGT("センタク *"); - LSTR MSG_ACC = _UxGT("カソクド mm/s") SUPERSCRIPT_TWO; // "Accel" - LSTR MSG_JERK = _UxGT("ヤクドウ mm/s"); // "Jerk" - 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_VN_JERK = _UxGT("ジク ヤクドウ mm/s@"); // "V@-jerk" + LSTR MSG_ACC = _UxGT("カソクド mm/s") SUPERSCRIPT_TWO; // "Accel" + LSTR MSG_JERK = _UxGT("ヤクドウ mm/s"); // "Jerk" + 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_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_E = _UxGT("サイダイオクリソクド E"); // "Vmax E" - LSTR MSG_VMAX_EN = _UxGT("サイダイオクリソクド *"); // "Vmax E1" - LSTR MSG_VMIN = _UxGT("サイショウオクリソクド"); // "Vmin" - LSTR MSG_VTRAV_MIN = _UxGT("サイショウイドウソクド"); // "VTrav min" - LSTR MSG_ACCELERATION = _UxGT("カソクド mm/s") SUPERSCRIPT_TWO; // "Accel" - LSTR MSG_A_RETRACT = _UxGT("ヒキコミカソクド"); // "A-retract" - LSTR MSG_A_TRAVEL = _UxGT("イドウカソクド"); // "A-travel" - LSTR MSG_TEMPERATURE = _UxGT("オンド"); // "Temperature" - LSTR MSG_MOTION = _UxGT("ウゴキセッテイ"); // "Motion" - LSTR MSG_FILAMENT = _UxGT("フィラメント"); // "Filament" + 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_E = _UxGT("サイダイオクリソクド E"); // "Vmax E" + LSTR MSG_VMAX_EN = _UxGT("サイダイオクリソクド *"); // "Vmax E1" + LSTR MSG_VMIN = _UxGT("サイショウオクリソクド"); // "Vmin" + LSTR MSG_VTRAV_MIN = _UxGT("サイショウイドウソクド"); // "VTrav min" + LSTR MSG_ACCELERATION = _UxGT("カソクド mm/s") SUPERSCRIPT_TWO; // "Accel" + LSTR MSG_A_RETRACT = _UxGT("ヒキコミカソクド"); // "A-retract" + LSTR MSG_A_TRAVEL = _UxGT("イドウカソクド"); // "A-travel" + LSTR MSG_TEMPERATURE = _UxGT("オンド"); // "Temperature" + LSTR MSG_MOTION = _UxGT("ウゴキセッテイ"); // "Motion" + LSTR MSG_FILAMENT = _UxGT("フィラメント"); // "Filament" LSTR MSG_VOLUMETRIC_ENABLED = _UxGT("E in mm") SUPERSCRIPT_THREE; - LSTR MSG_FILAMENT_DIAM = _UxGT("フィラメントチョッケイ"); // "Fil. Dia." + LSTR MSG_FILAMENT_DIAM = _UxGT("フィラメントチョッケイ"); // "Fil. Dia." LSTR MSG_FILAMENT_DIAM_E = _UxGT("フィラメントチョッケイ *"); - LSTR MSG_CONTRAST = _UxGT("LCDコントラスト"); // "LCD contrast" - LSTR MSG_STORE_EEPROM = _UxGT("EEPROMヘホゾン"); // "Store memory" - LSTR MSG_LOAD_EEPROM = _UxGT("EEPROMカラヨミコミ"); // "Load memory" - LSTR MSG_RESTORE_DEFAULTS = _UxGT("セッテイリセット"); // "Restore Defaults" - LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("リフレッシュ"); // "Refresh" - LSTR MSG_INFO_SCREEN = _UxGT("ジョウホウガメン"); // "Info screen" - LSTR MSG_PREPARE = _UxGT("ジュンビセッテイ"); // "Prepare" - LSTR MSG_TUNE = _UxGT("チョウセイ"); // "Tune" - LSTR MSG_PAUSE_PRINT = _UxGT("イチジテイシ"); // "Pause print" - LSTR MSG_RESUME_PRINT = _UxGT("プリントサイカイ"); // "Resume print" - LSTR MSG_STOP_PRINT = _UxGT("プリントテイシ"); // "Stop print" - LSTR MSG_MEDIA_MENU = _UxGT("メディアカラプリント"); // "Print from SD" - LSTR MSG_NO_MEDIA = _UxGT("メディアガアリマセン"); // "Card removed" - LSTR MSG_DWELL = _UxGT("キュウシ"); // "Sleep..." - LSTR MSG_USERWAIT = _UxGT("ツヅケルニハクリックシテクダサイ"); // "Wait for user..." - LSTR MSG_PRINT_ABORTED = _UxGT("プリントガチュウシサレマシタ"); // "Print aborted" - LSTR MSG_NO_MOVE = _UxGT("ウゴキマセン"); // "No move." - LSTR MSG_KILLED = _UxGT("ヒジョウテイシ"); // "KILLED. " - LSTR MSG_STOPPED = _UxGT("テイシシマシタ"); // "STOPPED. " - LSTR MSG_CONTROL_RETRACT = _UxGT("ヒキコミリョウ mm"); // "Retract mm" - LSTR MSG_CONTROL_RETRACT_SWAP = _UxGT("ヒキコミリョウS mm"); // "Swap Re.mm" - LSTR MSG_CONTROL_RETRACTF = _UxGT("ヒキコミソクド mm/s"); // "Retract V" - LSTR MSG_CONTROL_RETRACT_ZHOP = _UxGT("ノズルタイヒ mm"); // "Hop mm" - LSTR MSG_CONTROL_RETRACT_RECOVER = _UxGT("ホショウリョウ mm"); // "Unretr. mm" - LSTR MSG_CONTROL_RETRACT_RECOVER_SWAP = _UxGT("ホショウリョウS mm"); // "S Unretr. mm" - LSTR MSG_CONTROL_RETRACT_RECOVERF = _UxGT("ホショウソクド mm/s"); // "Unretract V" - LSTR MSG_AUTORETRACT = _UxGT("ジドウヒキコミ"); // "Auto-Retract" - LSTR MSG_FILAMENTCHANGE = _UxGT("フィラメントコウカン"); // "Change filament" - LSTR MSG_ATTACH_MEDIA = _UxGT("メディアサイヨミコミ"); // "Init. SD card" - LSTR MSG_CHANGE_MEDIA = _UxGT("メディアコウカン"); // "Change SD card" - LSTR MSG_ZPROBE_OUT = _UxGT("Zプローブ ベッドガイ"); // "Z probe out. bed" - LSTR MSG_BLTOUCH_SELFTEST = _UxGT("BLTouch ジコシンダン"); // "BLTouch Self-Test" - LSTR MSG_BLTOUCH_RESET = _UxGT("BLTouch リセット"); // "Reset BLTouch" + LSTR MSG_CONTRAST = _UxGT("LCDコントラスト"); // "LCD contrast" + LSTR MSG_STORE_EEPROM = _UxGT("EEPROMヘホゾン"); // "Store memory" + LSTR MSG_LOAD_EEPROM = _UxGT("EEPROMカラヨミコミ"); // "Load memory" + LSTR MSG_RESTORE_DEFAULTS = _UxGT("セッテイリセット"); // "Restore Defaults" + LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("リフレッシュ"); // "Refresh" + LSTR MSG_INFO_SCREEN = _UxGT("ジョウホウガメン"); // "Info screen" + LSTR MSG_PREPARE = _UxGT("ジュンビセッテイ"); // "Prepare" + LSTR MSG_TUNE = _UxGT("チョウセイ"); // "Tune" + LSTR MSG_PAUSE_PRINT = _UxGT("イチジテイシ"); // "Pause print" + LSTR MSG_RESUME_PRINT = _UxGT("プリントサイカイ"); // "Resume print" + LSTR MSG_STOP_PRINT = _UxGT("プリントテイシ"); // "Stop print" + LSTR MSG_MEDIA_MENU = _UxGT("メディアカラプリント"); // "Print from SD" + LSTR MSG_NO_MEDIA = _UxGT("メディアガアリマセン"); // "Card removed" + LSTR MSG_DWELL = _UxGT("キュウシ"); // "Sleep..." + LSTR MSG_USERWAIT = _UxGT("ツヅケルニハクリックシテクダサイ"); // "Wait for user..." + LSTR MSG_PRINT_ABORTED = _UxGT("プリントガチュウシサレマシタ"); // "Print aborted" + LSTR MSG_NO_MOVE = _UxGT("ウゴキマセン"); // "No move." + LSTR MSG_KILLED = _UxGT("ヒジョウテイシ"); // "KILLED. " + LSTR MSG_STOPPED = _UxGT("テイシシマシタ"); // "STOPPED. " + LSTR MSG_CONTROL_RETRACT = _UxGT("ヒキコミリョウ mm"); // "Retract mm" + LSTR MSG_CONTROL_RETRACT_SWAP = _UxGT("ヒキコミリョウS mm"); // "Swap Re.mm" + LSTR MSG_CONTROL_RETRACTF = _UxGT("ヒキコミソクド mm/s"); // "Retract V" + LSTR MSG_CONTROL_RETRACT_ZHOP = _UxGT("ノズルタイヒ mm"); // "Hop mm" + LSTR MSG_CONTROL_RETRACT_RECOVER = _UxGT("ホショウリョウ mm"); // "Unretr. mm" + LSTR MSG_CONTROL_RETRACT_RECOVER_SWAP = _UxGT("ホショウリョウS mm"); // "S Unretr. mm" + LSTR MSG_CONTROL_RETRACT_RECOVERF = _UxGT("ホショウソクド mm/s"); // "Unretract V" + LSTR MSG_AUTORETRACT = _UxGT("ジドウヒキコミ"); // "Auto-Retract" + LSTR MSG_FILAMENTCHANGE = _UxGT("フィラメントコウカン"); // "Change filament" + LSTR MSG_ATTACH_MEDIA = _UxGT("メディアサイヨミコミ"); // "Init. SD card" + LSTR MSG_CHANGE_MEDIA = _UxGT("メディアコウカン"); // "Change SD card" + LSTR MSG_ZPROBE_OUT = _UxGT("Zプローブ ベッドガイ"); // "Z probe out. bed" + LSTR MSG_BLTOUCH_SELFTEST = _UxGT("BLTouch ジコシンダン"); // "BLTouch Self-Test" + LSTR MSG_BLTOUCH_RESET = _UxGT("BLTouch リセット"); // "Reset BLTouch" LSTR MSG_HOME_FIRST = _UxGT("サキニ %s ヲフッキサセテクダサイ"); // "Home ... first" - LSTR MSG_ZPROBE_ZOFFSET = _UxGT("Zオフセット"); // "Z Offset" - LSTR MSG_BABYSTEP_X = _UxGT("Xジク ビドウ"); // "Babystep X" - LSTR MSG_BABYSTEP_Y = _UxGT("Yジク ビドウ"); // "Babystep Y" - LSTR MSG_BABYSTEP_Z = _UxGT("Zジク ビドウ"); // "Babystep Z" - LSTR MSG_ENDSTOP_ABORT = _UxGT("イドウゲンカイケンチキノウ"); // "Endstop abort" - LSTR MSG_HEATING_FAILED_LCD = _UxGT("カネツシッパイ"); // "Heating failed" - LSTR MSG_ERR_REDUNDANT_TEMP = _UxGT("エラー:ジョウチョウサーミスターキノウ"); // "Err: REDUNDANT TEMP" - LSTR MSG_THERMAL_RUNAWAY = _UxGT("ネツボウソウ"); // "THERMAL RUNAWAY" - LSTR MSG_ERR_MAXTEMP = _UxGT("エラー:サイコウオンチョウカ"); // "Err: MAXTEMP" - LSTR MSG_ERR_MINTEMP = _UxGT("エラー:サイテイオンミマン"); // "Err: MINTEMP" - LSTR MSG_HALTED = _UxGT("プリンターハテイシシマシタ"); // "PRINTER HALTED" - LSTR MSG_PLEASE_RESET = _UxGT("リセットシテクダサイ"); // "Please reset" - LSTR MSG_HEATING = _UxGT("カネツチュウ"); // "Heating..." - LSTR MSG_BED_HEATING = _UxGT("ベッド カネツチュウ"); // "Bed Heating..." - LSTR MSG_DELTA_CALIBRATE = _UxGT("デルタ コウセイ"); // "Delta Calibration" - LSTR MSG_DELTA_CALIBRATE_X = _UxGT("Xジク コウセイ"); // "Calibrate X" - LSTR MSG_DELTA_CALIBRATE_Y = _UxGT("Yジク コウセイ"); // "Calibrate Y" - LSTR MSG_DELTA_CALIBRATE_Z = _UxGT("Zジク コウセイ"); // "Calibrate Z" - LSTR MSG_DELTA_CALIBRATE_CENTER = _UxGT("チュウシン コウセイ"); // "Calibrate Center" - LSTR MSG_INFO_MENU = _UxGT("コノプリンターニツイテ"); // "About Printer" - LSTR MSG_INFO_PRINTER_MENU = _UxGT("プリンタージョウホウ"); // "Printer Info" - LSTR MSG_INFO_STATS_MENU = _UxGT("プリントジョウキョウ"); // "Printer Stats" - LSTR MSG_INFO_BOARD_MENU = _UxGT("セイギョケイジョウホウ"); // "Board Info" - LSTR MSG_INFO_THERMISTOR_MENU = _UxGT("サーミスター"); // "Thermistors" - LSTR MSG_INFO_EXTRUDERS = _UxGT("エクストルーダースウ"); // "Extruders" - LSTR MSG_INFO_BAUDRATE = _UxGT("ボーレート"); // "Baud" - LSTR MSG_INFO_PROTOCOL = _UxGT("プロトコル"); // "Protocol" - LSTR MSG_CASE_LIGHT = _UxGT("キョウタイナイショウメイ"); // "Case light" - LSTR MSG_INFO_PRINT_COUNT = _UxGT("プリントスウ "); // "Print Count" - LSTR MSG_INFO_COMPLETED_PRINTS = _UxGT("カンリョウスウ"); // "Completed" - LSTR MSG_INFO_PRINT_TIME = _UxGT("プリントジカンルイケイ"); // "Total print time" - LSTR MSG_INFO_PRINT_LONGEST = _UxGT("サイチョウプリントジカン"); // "Longest job time" - LSTR MSG_INFO_PRINT_FILAMENT = _UxGT("フィラメントシヨウリョウルイケイ"); // "Extruded total" - LSTR MSG_INFO_MIN_TEMP = _UxGT("セッテイサイテイオン"); // "Min Temp" - 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_N = _UxGT("@ DACシュツリョク %"); // "@ Driver %" - LSTR MSG_DAC_EEPROM_WRITE = _UxGT("EEPROMヘホゾン"); // "Store memory" + LSTR MSG_ZPROBE_ZOFFSET = _UxGT("Zオフセット"); // "Z Offset" + LSTR MSG_BABYSTEP_X = _UxGT("Xジク ビドウ"); // "Babystep X" + LSTR MSG_BABYSTEP_Y = _UxGT("Yジク ビドウ"); // "Babystep Y" + LSTR MSG_BABYSTEP_Z = _UxGT("Zジク ビドウ"); // "Babystep Z" + LSTR MSG_ENDSTOP_ABORT = _UxGT("イドウゲンカイケンチキノウ"); // "Endstop abort" + LSTR MSG_HEATING_FAILED_LCD = _UxGT("カネツシッパイ"); // "Heating failed" + LSTR MSG_ERR_REDUNDANT_TEMP = _UxGT("エラー:ジョウチョウサーミスターキノウ"); // "Err: REDUNDANT TEMP" + LSTR MSG_THERMAL_RUNAWAY = _UxGT("ネツボウソウ"); // "THERMAL RUNAWAY" + LSTR MSG_ERR_MAXTEMP = _UxGT("エラー:サイコウオンチョウカ"); // "Err: MAXTEMP" + LSTR MSG_ERR_MINTEMP = _UxGT("エラー:サイテイオンミマン"); // "Err: MINTEMP" + LSTR MSG_HALTED = _UxGT("プリンターハテイシシマシタ"); // "PRINTER HALTED" + LSTR MSG_PLEASE_RESET = _UxGT("リセットシテクダサイ"); // "Please reset" + LSTR MSG_HEATING = _UxGT("カネツチュウ"); // "Heating..." + LSTR MSG_BED_HEATING = _UxGT("ベッド カネツチュウ"); // "Bed Heating..." + LSTR MSG_DELTA_CALIBRATE = _UxGT("デルタ コウセイ"); // "Delta Calibration" + LSTR MSG_DELTA_CALIBRATE_X = _UxGT("Xジク コウセイ"); // "Calibrate X" + LSTR MSG_DELTA_CALIBRATE_Y = _UxGT("Yジク コウセイ"); // "Calibrate Y" + LSTR MSG_DELTA_CALIBRATE_Z = _UxGT("Zジク コウセイ"); // "Calibrate Z" + LSTR MSG_DELTA_CALIBRATE_CENTER = _UxGT("チュウシン コウセイ"); // "Calibrate Center" + LSTR MSG_INFO_MENU = _UxGT("コノプリンターニツイテ"); // "About Printer" + LSTR MSG_INFO_PRINTER_MENU = _UxGT("プリンタージョウホウ"); // "Printer Info" + LSTR MSG_INFO_STATS_MENU = _UxGT("プリントジョウキョウ"); // "Printer Stats" + LSTR MSG_INFO_BOARD_MENU = _UxGT("セイギョケイジョウホウ"); // "Board Info" + LSTR MSG_INFO_THERMISTOR_MENU = _UxGT("サーミスター"); // "Thermistors" + LSTR MSG_INFO_EXTRUDERS = _UxGT("エクストルーダースウ"); // "Extruders" + LSTR MSG_INFO_BAUDRATE = _UxGT("ボーレート"); // "Baud" + LSTR MSG_INFO_PROTOCOL = _UxGT("プロトコル"); // "Protocol" + LSTR MSG_CASE_LIGHT = _UxGT("キョウタイナイショウメイ"); // "Case light" + LSTR MSG_INFO_PRINT_COUNT = _UxGT("プリントスウ "); // "Print Count" + LSTR MSG_INFO_COMPLETED_PRINTS = _UxGT("カンリョウスウ"); // "Completed" + LSTR MSG_INFO_PRINT_TIME = _UxGT("プリントジカンルイケイ"); // "Total print time" + LSTR MSG_INFO_PRINT_LONGEST = _UxGT("サイチョウプリントジカン"); // "Longest job time" + LSTR MSG_INFO_PRINT_FILAMENT = _UxGT("フィラメントシヨウリョウルイケイ"); // "Extruded total" + LSTR MSG_INFO_MIN_TEMP = _UxGT("セッテイサイテイオン"); // "Min Temp" + 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_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" - LSTR MSG_FILAMENT_CHANGE_INIT = _UxGT(MSG_2_LINE("コウカンヲカイシシマス", "シバラクオマチクダサイ")); // "Wait for start of the filament" - LSTR MSG_FILAMENT_CHANGE_UNLOAD = _UxGT(MSG_2_LINE("フィラメントヌキダシチュウ", "シバラクオマチクダサイ")); // "Wait for filament unload" - LSTR MSG_FILAMENT_CHANGE_INSERT = _UxGT(MSG_2_LINE("フィラメントヲソウニュウシ,", "クリックスルトゾッコウシマス")); // "Insert filament and press button" - LSTR MSG_FILAMENT_CHANGE_LOAD = _UxGT(MSG_2_LINE("フィラメントソウテンチュウ", "シバラクオマチクダサイ")); // "Wait for filament load" - LSTR MSG_FILAMENT_CHANGE_RESUME = _UxGT(MSG_2_LINE("プリントヲサイカイシマス", "シバラクオマチクダサイ")); // "Wait for print to resume" + LSTR MSG_FILAMENT_CHANGE_OPTION_RESUME = _UxGT("プリントサイカイ"); // "Resume print" + LSTR MSG_FILAMENT_CHANGE_INIT = _UxGT(MSG_2_LINE("コウカンヲカイシシマス", "シバラクオマチクダサイ")); // "Wait for start of the filament" + LSTR MSG_FILAMENT_CHANGE_UNLOAD = _UxGT(MSG_2_LINE("フィラメントヌキダシチュウ", "シバラクオマチクダサイ")); // "Wait for filament unload" + LSTR MSG_FILAMENT_CHANGE_INSERT = _UxGT(MSG_2_LINE("フィラメントヲソウニュウシ,", "クリックスルトゾッコウシマス")); // "Insert filament and press button" + LSTR MSG_FILAMENT_CHANGE_LOAD = _UxGT(MSG_2_LINE("フィラメントソウテンチュウ", "シバラクオマチクダサイ")); // "Wait for filament load" + LSTR MSG_FILAMENT_CHANGE_RESUME = _UxGT(MSG_2_LINE("プリントヲサイカイシマス", "シバラクオマチクダサイ")); // "Wait for print to resume" - LSTR MSG_KILL_EXPECTED_PRINTER = _UxGT("マチガッタプリンター"); // "Wrong printer" + LSTR MSG_KILL_EXPECTED_PRINTER = _UxGT("マチガッタプリンター"); // "Wrong printer" LSTR MSG_CONFIGURATION = _UxGT("セッテイカンリ"); LSTR MSG_ADVANCED_SETTINGS = _UxGT("ショウサイセッテイ"); diff --git a/Marlin/src/lcd/language/language_ko_KR.h b/Marlin/src/lcd/language/language_ko_KR.h index e52ced2dad6f5..27be03734492a 100644 --- a/Marlin/src/lcd/language/language_ko_KR.h +++ b/Marlin/src/lcd/language/language_ko_KR.h @@ -88,7 +88,7 @@ namespace Language_ko_KR { LSTR MSG_LOAD_EEPROM = _UxGT("설정 읽어오기"); LSTR MSG_RESTORE_DEFAULTS = _UxGT("설정 되돌리기"); LSTR MSG_INIT_EEPROM = _UxGT("EEPROM 초기화"); - LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("새로고침"); + LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("새로고침"); LSTR MSG_INFO_SCREEN = _UxGT("처음으로"); LSTR MSG_PREPARE = _UxGT("준비하기"); LSTR MSG_PAUSE_PRINT = _UxGT("일시정지"); diff --git a/Marlin/src/lcd/language/language_nl.h b/Marlin/src/lcd/language/language_nl.h index d708135fac0a3..bc60d19946bd1 100644 --- a/Marlin/src/lcd/language/language_nl.h +++ b/Marlin/src/lcd/language/language_nl.h @@ -113,7 +113,7 @@ namespace Language_nl { LSTR MSG_TEMPERATURE = _UxGT("Temperatuur"); LSTR MSG_MOTION = _UxGT("Beweging"); LSTR MSG_FILAMENT = _UxGT("Filament"); - LSTR MSG_ADVANCE_K = _UxGT("Advance K"); // accepted english dutch + LSTR MSG_ADVANCE_K = _UxGT("Advance K"); // accepted english dutch LSTR MSG_ADVANCE_K_E = _UxGT("Advance K *"); // accepted english dutch LSTR MSG_VOLUMETRIC_ENABLED = _UxGT("E in mm") SUPERSCRIPT_THREE; LSTR MSG_FILAMENT_DIAM = _UxGT("Fil. Dia."); @@ -122,7 +122,7 @@ namespace Language_nl { LSTR MSG_STORE_EEPROM = _UxGT("Geheugen opslaan"); LSTR MSG_LOAD_EEPROM = _UxGT("Geheugen laden"); LSTR MSG_RESTORE_DEFAULTS = _UxGT("Noodstop reset"); - LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Ververs"); + LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Ververs"); LSTR MSG_INFO_SCREEN = _UxGT("Info scherm"); LSTR MSG_PREPARE = _UxGT("Voorbereiden"); LSTR MSG_TUNE = _UxGT("Afstellen"); @@ -137,7 +137,7 @@ namespace Language_nl { LSTR MSG_NO_MOVE = _UxGT("Geen beweging."); LSTR MSG_KILLED = _UxGT("Afgebroken. "); LSTR MSG_STOPPED = _UxGT("Gestopt. "); - LSTR MSG_CONTROL_RETRACT = _UxGT("Retract mm"); // accepted English term in Dutch + LSTR MSG_CONTROL_RETRACT = _UxGT("Retract mm"); // accepted English term in Dutch LSTR MSG_CONTROL_RETRACT_SWAP = _UxGT("Ruil Retract mm"); LSTR MSG_CONTROL_RETRACTF = _UxGT("Retract F"); LSTR MSG_CONTROL_RETRACT_ZHOP = _UxGT("Hop mm"); @@ -153,7 +153,7 @@ namespace Language_nl { LSTR MSG_BLTOUCH_SELFTEST = _UxGT("BLTouch Zelf-Test"); LSTR MSG_BLTOUCH_RESET = _UxGT("Reset BLTouch"); LSTR MSG_HOME_FIRST = _UxGT("Home %s Eerst"); - LSTR MSG_ZPROBE_ZOFFSET = _UxGT("Z Offset"); // accepted English term in Dutch + LSTR MSG_ZPROBE_ZOFFSET = _UxGT("Z Offset"); // accepted English term in Dutch LSTR MSG_BABYSTEP_X = _UxGT("Babystap X"); LSTR MSG_BABYSTEP_Y = _UxGT("Babystap Y"); LSTR MSG_BABYSTEP_Z = _UxGT("Babystap Z"); @@ -196,7 +196,7 @@ namespace Language_nl { LSTR MSG_INFO_MIN_TEMP = _UxGT("Min Temp"); LSTR MSG_INFO_MAX_TEMP = _UxGT("Max Temp"); - LSTR MSG_INFO_PSU = _UxGT("PSU"); // accepted English term in Dutch + LSTR MSG_INFO_PSU = _UxGT("PSU"); // accepted English term in Dutch LSTR MSG_DRIVE_STRENGTH = _UxGT("Motorstroom"); diff --git a/Marlin/src/lcd/language/language_pl.h b/Marlin/src/lcd/language/language_pl.h index 855a1e3bd167c..8aa12d903d211 100644 --- a/Marlin/src/lcd/language/language_pl.h +++ b/Marlin/src/lcd/language/language_pl.h @@ -306,7 +306,7 @@ namespace Language_pl { LSTR MSG_INIT_EEPROM = _UxGT("Initializuj EEPROM"); LSTR MSG_MEDIA_UPDATE = _UxGT("Uaktualnij kartę"); LSTR MSG_RESET_PRINTER = _UxGT("Resetuj drukarkę"); - LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Odswież"); + LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Odswież"); LSTR MSG_INFO_SCREEN = _UxGT("Ekran główny"); LSTR MSG_PREPARE = _UxGT("Przygotuj"); LSTR MSG_TUNE = _UxGT("Strojenie"); diff --git a/Marlin/src/lcd/language/language_pt_br.h b/Marlin/src/lcd/language/language_pt_br.h index 4ace61e11691c..81344b60c4a65 100644 --- a/Marlin/src/lcd/language/language_pt_br.h +++ b/Marlin/src/lcd/language/language_pt_br.h @@ -274,7 +274,7 @@ namespace Language_pt_br { LSTR MSG_INIT_EEPROM = _UxGT("Iniciar EEPROM"); LSTR MSG_MEDIA_UPDATE = _UxGT("Atualiz. SD"); LSTR MSG_RESET_PRINTER = _UxGT("Resetar Impressora"); - LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Atualização"); + LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Atualização"); LSTR MSG_INFO_SCREEN = _UxGT("Informações"); LSTR MSG_PREPARE = _UxGT("Preparar"); LSTR MSG_TUNE = _UxGT("Ajustar"); diff --git a/Marlin/src/lcd/language/language_ro.h b/Marlin/src/lcd/language/language_ro.h index 75f27c1ecf9b1..b4f7550a7fa51 100644 --- a/Marlin/src/lcd/language/language_ro.h +++ b/Marlin/src/lcd/language/language_ro.h @@ -323,7 +323,7 @@ namespace Language_ro { LSTR MSG_SETTINGS_STORED = _UxGT("Settings Stored"); LSTR MSG_MEDIA_UPDATE = _UxGT("Media Update"); LSTR MSG_RESET_PRINTER = _UxGT("Reset Imprimanta"); - LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Refresh"); + LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Refresh"); LSTR MSG_INFO_SCREEN = _UxGT("Info Screen"); LSTR MSG_PREPARE = _UxGT("Prepare"); LSTR MSG_TUNE = _UxGT("Tune"); diff --git a/Marlin/src/lcd/language/language_sk.h b/Marlin/src/lcd/language/language_sk.h index 572e7fe9eaf82..c7b2cef0d10c5 100644 --- a/Marlin/src/lcd/language/language_sk.h +++ b/Marlin/src/lcd/language/language_sk.h @@ -457,7 +457,7 @@ namespace Language_sk { LSTR MSG_SETTINGS_STORED = _UxGT("Nastavenie uložené"); LSTR MSG_MEDIA_UPDATE = _UxGT("Aktualiz. z karty"); LSTR MSG_RESET_PRINTER = _UxGT("Reštart. tlačiar."); - LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Obnoviť"); + 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"); diff --git a/Marlin/src/lcd/language/language_tr.h b/Marlin/src/lcd/language/language_tr.h index 5fc78758d4f13..5be21c9c565f8 100644 --- a/Marlin/src/lcd/language/language_tr.h +++ b/Marlin/src/lcd/language/language_tr.h @@ -436,7 +436,7 @@ namespace Language_tr { LSTR MSG_SETTINGS_STORED = _UxGT("Ayarlar Kaydedildi"); LSTR MSG_MEDIA_UPDATE = _UxGT("SD Güncellemesi"); LSTR MSG_RESET_PRINTER = _UxGT("Yazıcıyı Resetle"); - LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Yenile"); + LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Yenile"); LSTR MSG_INFO_SCREEN = _UxGT("Bilgi Ekranı"); LSTR MSG_INFO_MACHINENAME = _UxGT("Makine Adı"); LSTR MSG_INFO_SIZE = _UxGT("Boyut"); diff --git a/Marlin/src/lcd/language/language_uk.h b/Marlin/src/lcd/language/language_uk.h index 3a644a0b34c91..7a7f4a5f44458 100644 --- a/Marlin/src/lcd/language/language_uk.h +++ b/Marlin/src/lcd/language/language_uk.h @@ -480,7 +480,7 @@ namespace Language_uk { LSTR MSG_POWER = _UxGT("Потужність"); LSTR MSG_START_PRINT = _UxGT("Почати друк"); - LSTR MSG_BUTTON_NEXT = _UxGT("Далі"); //short text for buttons + LSTR MSG_BUTTON_NEXT = _UxGT("Далі"); //short text for buttons LSTR MSG_BUTTON_INIT = _UxGT("Ініц-я"); LSTR MSG_BUTTON_STOP = _UxGT("Зупинка"); LSTR MSG_BUTTON_PRINT = _UxGT("Друк"); diff --git a/Marlin/src/lcd/language/language_vi.h b/Marlin/src/lcd/language/language_vi.h index 5795c58a1ea76..2ce22961ca73f 100644 --- a/Marlin/src/lcd/language/language_vi.h +++ b/Marlin/src/lcd/language/language_vi.h @@ -43,7 +43,7 @@ namespace Language_vi { LSTR MSG_MEDIA_USB_REMOVED = _UxGT("USB được rút ra"); LSTR MSG_MEDIA_USB_FAILED = _UxGT("USB khởi thất bại"); LSTR MSG_LCD_ENDSTOPS = _UxGT("Công tắc"); // Endstops - công tắc hành trình - LSTR MSG_LCD_SOFT_ENDSTOPS = _UxGT("Công tắc mềm"); // soft Endstops + LSTR MSG_LCD_SOFT_ENDSTOPS = _UxGT("Công tắc mềm"); // Soft Endstops LSTR MSG_MAIN_MENU = _UxGT("Chính"); // Main LSTR MSG_ADVANCED_SETTINGS = _UxGT("Thiết lập cấp cao"); // Advanced Settings LSTR MSG_CONFIGURATION = _UxGT("Cấu hình"); // Configuration @@ -52,9 +52,9 @@ namespace Language_vi { LSTR MSG_DEBUG_MENU = _UxGT("Menu gỡ lỗi"); // Debug Menu LSTR MSG_PROGRESS_BAR_TEST = _UxGT("Kiểm tra tiến độ"); // Progress bar test LSTR MSG_AUTO_HOME = _UxGT("Về nhà tự động"); // Auto home - LSTR MSG_AUTO_HOME_X = _UxGT("Về nhà X"); // home X - LSTR MSG_AUTO_HOME_Y = _UxGT("Về nhà Y"); // home Y - LSTR MSG_AUTO_HOME_Z = _UxGT("Về nhà Z"); // home Z + LSTR MSG_AUTO_HOME_X = _UxGT("Về nhà X"); // Home X + LSTR MSG_AUTO_HOME_Y = _UxGT("Về nhà Y"); // Home Y + LSTR MSG_AUTO_HOME_Z = _UxGT("Về nhà Z"); // Home Z LSTR MSG_AUTO_Z_ALIGN = _UxGT("Chỉnh canh Z tự động"); LSTR MSG_LEVEL_BED_HOMING = _UxGT("Đang về nhà XYZ"); // Homing XYZ LSTR MSG_LEVEL_BED_WAITING = _UxGT("Nhấn để bắt đầu"); // Click to Begin @@ -68,17 +68,17 @@ namespace Language_vi { LSTR MSG_PREHEAT_1_H = _UxGT("Làm nóng ") PREHEAT_1_LABEL _UxGT(" trước ~"); // Preheat LSTR MSG_PREHEAT_1_END = _UxGT("Làm nóng ") PREHEAT_1_LABEL _UxGT(" Đầu"); LSTR MSG_PREHEAT_1_END_E = _UxGT("Làm nóng ") PREHEAT_1_LABEL _UxGT(" Đầu ~"); - LSTR MSG_PREHEAT_1_ALL = _UxGT("Làm nóng ") PREHEAT_1_LABEL _UxGT(" Tất cả"); // all - LSTR MSG_PREHEAT_1_BEDONLY = _UxGT("Làm nóng ") PREHEAT_1_LABEL _UxGT(" Bàn"); // bed -- using vietnamese term for 'table' instead - LSTR MSG_PREHEAT_1_SETTINGS = _UxGT("Làm nóng ") PREHEAT_1_LABEL _UxGT(" Cấu hình"); // conf + LSTR MSG_PREHEAT_1_ALL = _UxGT("Làm nóng ") PREHEAT_1_LABEL _UxGT(" Tất cả"); // All + LSTR MSG_PREHEAT_1_BEDONLY = _UxGT("Làm nóng ") PREHEAT_1_LABEL _UxGT(" Bàn"); // Bed -- using vietnamese term for 'table' instead + LSTR MSG_PREHEAT_1_SETTINGS = _UxGT("Làm nóng ") PREHEAT_1_LABEL _UxGT(" Cấu hình"); // Conf - LSTR MSG_PREHEAT_M = _UxGT("Làm nóng $ trước"); // Preheat - LSTR MSG_PREHEAT_M_H = _UxGT("Làm nóng $ trước ~"); // Preheat + LSTR MSG_PREHEAT_M = _UxGT("Làm nóng $ trước"); // Preheat + LSTR MSG_PREHEAT_M_H = _UxGT("Làm nóng $ trước ~"); // Preheat LSTR MSG_PREHEAT_M_END = _UxGT("Làm nóng $ Đầu"); LSTR MSG_PREHEAT_M_END_E = _UxGT("Làm nóng $ Đầu ~"); - LSTR MSG_PREHEAT_M_ALL = _UxGT("Làm nóng $ Tất cả"); // all - LSTR MSG_PREHEAT_M_BEDONLY = _UxGT("Làm nóng $ Bàn"); // bed -- using vietnamese term for 'table' instead - LSTR MSG_PREHEAT_M_SETTINGS = _UxGT("Làm nóng $ Cấu hình"); // conf + LSTR MSG_PREHEAT_M_ALL = _UxGT("Làm nóng $ Tất cả"); // All + LSTR MSG_PREHEAT_M_BEDONLY = _UxGT("Làm nóng $ Bàn"); // Bed -- using vietnamese term for 'table' instead + LSTR MSG_PREHEAT_M_SETTINGS = _UxGT("Làm nóng $ Cấu hình"); // Conf #endif LSTR MSG_PREHEAT_CUSTOM = _UxGT("Sự nóng trước tự chọn"); // Preheat Custom LSTR MSG_COOLDOWN = _UxGT("Nguội xuống"); // Cooldown @@ -112,7 +112,7 @@ namespace Language_vi { LSTR MSG_UBL_BC_INSERT = _UxGT("Đặt chêm và đo"); // Place shim & measure LSTR MSG_UBL_BC_INSERT2 = _UxGT("Đo"); // Measure LSTR MSG_UBL_BC_REMOVE = _UxGT("Tháo và đo bàn"); // Remove & measure bed - LSTR MSG_UBL_MOVING_TO_NEXT = _UxGT("Chuyển sang tiếp theo"); // moving to next + LSTR MSG_UBL_MOVING_TO_NEXT = _UxGT("Chuyển sang tiếp theo"); // Moving to next LSTR MSG_UBL_ACTIVATE_MESH = _UxGT("Bật UBL"); LSTR MSG_UBL_DEACTIVATE_MESH = _UxGT("Tắt UBL"); LSTR MSG_UBL_SET_TEMP_BED = _UxGT("Nhiệt độ bàn"); // Bed Temp @@ -133,7 +133,7 @@ namespace Language_vi { LSTR MSG_UBL_MESH_HEIGHT_ADJUST = _UxGT("Điều chỉnh chiều cao lưới"); // Adjust Mesh Height LSTR MSG_UBL_MESH_HEIGHT_AMOUNT = _UxGT("Số lượng chiều cao"); // Height Amount LSTR MSG_UBL_VALIDATE_MESH_MENU = _UxGT("Thẩm tra lưới"); // Validate Mesh - LSTR MSG_UBL_VALIDATE_CUSTOM_MESH = _UxGT("Thẩm tra lưới tự chọn"); // validate custom mesh + LSTR MSG_UBL_VALIDATE_CUSTOM_MESH = _UxGT("Thẩm tra lưới tự chọn"); // Validate custom mesh LSTR MSG_UBL_CONTINUE_MESH = _UxGT("Tiếp tục xây lưới bàn"); // Continue Bed Mesh LSTR MSG_UBL_MESH_LEVELING = _UxGT("Đang san lấp lưới"); // Mesh Leveling LSTR MSG_UBL_3POINT_MESH_LEVELING = _UxGT("Đang san lấp 3-điểm"); // 3-Point Leveling @@ -210,20 +210,20 @@ namespace Language_vi { LSTR MSG_MESH_Z_OFFSET = _UxGT("Z Bàn"); LSTR MSG_NOZZLE = _UxGT("Đầu phun"); // Nozzle LSTR MSG_NOZZLE_N = _UxGT("Đầu phun ~"); - LSTR MSG_BED = _UxGT("Bàn"); // bed - LSTR MSG_FAN_SPEED = _UxGT("Tốc độ quạt"); // fan speed + LSTR MSG_BED = _UxGT("Bàn"); // Bed + LSTR MSG_FAN_SPEED = _UxGT("Tốc độ quạt"); // Fan speed LSTR MSG_FAN_SPEED_N = _UxGT("Tốc độ quạt ~"); LSTR MSG_EXTRA_FAN_SPEED = _UxGT("Tốc độ quạt phụ"); // Extra fan speed LSTR MSG_EXTRA_FAN_SPEED_N = _UxGT("Tốc độ quạt phụ ~"); LSTR MSG_FLOW = _UxGT("Lưu Lượng"); LSTR MSG_FLOW_N = _UxGT("Lưu Lượng ~"); LSTR MSG_CONTROL = _UxGT("Điều khiển"); // Control - LSTR MSG_MIN = " " LCD_STR_THERMOMETER _UxGT(" Đa"); // min - LSTR MSG_MAX = " " LCD_STR_THERMOMETER _UxGT(" Thiểu"); - LSTR MSG_FACTOR = " " LCD_STR_THERMOMETER _UxGT(" Hệ Số"); // factor + LSTR MSG_MIN = " " LCD_STR_THERMOMETER _UxGT(" Đa"); // Min + LSTR MSG_MAX = " " LCD_STR_THERMOMETER _UxGT(" Thiểu"); // Max + LSTR MSG_FACTOR = " " LCD_STR_THERMOMETER _UxGT(" Hệ Số"); // Factor LSTR MSG_AUTOTEMP = _UxGT("Nhiệt độ tự động"); // Autotemp - LSTR MSG_LCD_ON = _UxGT("Bật"); // on - LSTR MSG_LCD_OFF = _UxGT("Tắt"); // off + LSTR MSG_LCD_ON = _UxGT("Bật"); // On + LSTR MSG_LCD_OFF = _UxGT("Tắt"); // Off LSTR MSG_SELECT_E = _UxGT("Lựa *"); LSTR MSG_ACC = _UxGT("Tăng Tốc"); LSTR MSG_JERK = _UxGT("Giật"); @@ -233,8 +233,8 @@ namespace Language_vi { 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_MAX_SPEED = _UxGT("Vận tốc"); // velocity - LSTR MSG_VMAX_A = _UxGT("Vđa") STR_A; // Vmax + 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_N = _UxGT("Vđa@"); @@ -243,162 +243,162 @@ namespace Language_vi { LSTR MSG_VMIN = _UxGT("Vthiểu"); // Vmin LSTR MSG_VTRAV_MIN = _UxGT("Vchuyển thiểu"); // VTrav min LSTR MSG_ACCELERATION = _UxGT("Sự tăng tốc"); // Acceleration - LSTR MSG_AMAX_A = _UxGT("Tăng tốc ca") STR_A; // Amax + 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_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 - LSTR MSG_STEPS_PER_MM = _UxGT("Bước/mm"); // Steps - LSTR MSG_A_STEPS = _UxGT("Bước") STR_A _UxGT("/mm"); // Steps/mm + LSTR MSG_A_RETRACT = _UxGT("TT-Rút"); // A-retract + LSTR MSG_A_TRAVEL = _UxGT("TT-Chuyển"); // A-travel + LSTR MSG_STEPS_PER_MM = _UxGT("Bước/mm"); // Steps + 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_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 - LSTR MSG_MOTION = _UxGT("Chuyển động"); // Motion - LSTR MSG_FILAMENT = _UxGT("Vật liệu in"); // dây nhựa - LSTR MSG_VOLUMETRIC_ENABLED = _UxGT("E bằng mm") SUPERSCRIPT_THREE; // E in mm - LSTR MSG_FILAMENT_DIAM = _UxGT("Đường kính nhựa"); // Fil. Dai. + LSTR MSG_TEMPERATURE = _UxGT("Nhiệt độ"); // Temperature + LSTR MSG_MOTION = _UxGT("Chuyển động"); // Motion + LSTR MSG_FILAMENT = _UxGT("Vật liệu in"); // Dây nhựa + LSTR MSG_VOLUMETRIC_ENABLED = _UxGT("E bằng mm") SUPERSCRIPT_THREE; // E in mm + LSTR MSG_FILAMENT_DIAM = _UxGT("Đường kính nhựa"); // Fil. Dai. LSTR MSG_FILAMENT_DIAM_E = _UxGT("Đường kính nhựa *"); - LSTR MSG_FILAMENT_UNLOAD = _UxGT("Dỡ mm"); // unload mm + LSTR MSG_FILAMENT_UNLOAD = _UxGT("Dỡ mm"); // Unload mm LSTR MSG_FILAMENT_LOAD = _UxGT("Nạp mm"); - LSTR MSG_ADVANCE_K = _UxGT("K Cấp Cao"); // Advance K - LSTR MSG_ADVANCE_K_E = _UxGT("K Cấp Cao *"); // Advance K - LSTR MSG_CONTRAST = _UxGT("Độ tương phản LCD"); // LCD contrast - LSTR MSG_STORE_EEPROM = _UxGT("Lưu các thiết lập"); // Store settings - LSTR MSG_LOAD_EEPROM = _UxGT("Tải các cài đặt"); // Load settings - LSTR MSG_RESTORE_DEFAULTS = _UxGT("Khôi phục phòng hư"); // Restore Defaults - LSTR MSG_INIT_EEPROM = _UxGT("Khởi Tạo EEPROM"); // Initialize EEPROM - LSTR MSG_MEDIA_UPDATE = _UxGT("Cập Nhật phương tiện"); // Update media + LSTR MSG_ADVANCE_K = _UxGT("K Cấp Cao"); // Advance K + LSTR MSG_ADVANCE_K_E = _UxGT("K Cấp Cao *"); // Advance K + LSTR MSG_CONTRAST = _UxGT("Độ tương phản LCD"); // LCD contrast + LSTR MSG_STORE_EEPROM = _UxGT("Lưu các thiết lập"); // Store settings + LSTR MSG_LOAD_EEPROM = _UxGT("Tải các cài đặt"); // Load settings + LSTR MSG_RESTORE_DEFAULTS = _UxGT("Khôi phục phòng hư"); // Restore Defaults + LSTR MSG_INIT_EEPROM = _UxGT("Khởi Tạo EEPROM"); // Initialize EEPROM + LSTR MSG_MEDIA_UPDATE = _UxGT("Cập Nhật phương tiện"); // Update media LSTR MSG_RESET_PRINTER = _UxGT("Bặt Lại Máy In"); - LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Cập Nhật"); // Refresh - LSTR MSG_INFO_SCREEN = _UxGT("Màn Hình Thông Tin"); // Info screen - LSTR MSG_PREPARE = _UxGT("Chuẩn bị"); // Prepare - LSTR MSG_TUNE = _UxGT("Điều Chỉnh"); // Tune - LSTR MSG_PAUSE_PRINT = _UxGT("Tạm dừng in"); // Pause print - LSTR MSG_RESUME_PRINT = _UxGT("Tiếp tục in"); // Resume print - LSTR MSG_STOP_PRINT = _UxGT("Ngừng in"); // Stop print - LSTR MSG_OUTAGE_RECOVERY = _UxGT("Phục Hồi Mất Điện"); // Outage Recovery - LSTR MSG_MEDIA_MENU = _UxGT("In từ phương tiện"); // Print from media - LSTR MSG_NO_MEDIA = _UxGT("Không có phương tiện"); // No media - LSTR MSG_DWELL = _UxGT("Ngủ..."); // Sleep - LSTR MSG_USERWAIT = _UxGT("Nhấn để tiếp tục..."); // Click to resume (same as 'continue') - LSTR MSG_PRINT_PAUSED = _UxGT("In tạm dừng"); // print paused - LSTR MSG_PRINTING = _UxGT("Đang in..."); // printing - LSTR MSG_PRINT_ABORTED = _UxGT("In đã hủy bỏ"); // Print aborted - LSTR MSG_NO_MOVE = _UxGT("Không di chuyển."); // No move. + LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Cập Nhật"); // Refresh + LSTR MSG_INFO_SCREEN = _UxGT("Màn Hình Thông Tin"); // Info screen + LSTR MSG_PREPARE = _UxGT("Chuẩn bị"); // Prepare + LSTR MSG_TUNE = _UxGT("Điều Chỉnh"); // Tune + LSTR MSG_PAUSE_PRINT = _UxGT("Tạm dừng in"); // Pause print + LSTR MSG_RESUME_PRINT = _UxGT("Tiếp tục in"); // Resume print + LSTR MSG_STOP_PRINT = _UxGT("Ngừng in"); // Stop print + LSTR MSG_OUTAGE_RECOVERY = _UxGT("Phục Hồi Mất Điện"); // Outage Recovery + LSTR MSG_MEDIA_MENU = _UxGT("In từ phương tiện"); // Print from media + LSTR MSG_NO_MEDIA = _UxGT("Không có phương tiện"); // No media + LSTR MSG_DWELL = _UxGT("Ngủ..."); // Sleep + LSTR MSG_USERWAIT = _UxGT("Nhấn để tiếp tục..."); // Click to resume (same as 'continue') + LSTR MSG_PRINT_PAUSED = _UxGT("In tạm dừng"); // Print paused + LSTR MSG_PRINTING = _UxGT("Đang in..."); // Printing + LSTR MSG_PRINT_ABORTED = _UxGT("In đã hủy bỏ"); // Print aborted + LSTR MSG_NO_MOVE = _UxGT("Không di chuyển."); // No move. LSTR MSG_KILLED = _UxGT("ĐÃ CHẾT. "); LSTR MSG_STOPPED = _UxGT("ĐÃ NGỪNG. "); - LSTR MSG_CONTROL_RETRACT = _UxGT("Rút mm"); // Retract mm - LSTR MSG_CONTROL_RETRACT_SWAP = _UxGT("Rút Trao.mm"); // Swap Re.mm + LSTR MSG_CONTROL_RETRACT = _UxGT("Rút mm"); // Retract mm + LSTR MSG_CONTROL_RETRACT_SWAP = _UxGT("Rút Trao.mm"); // Swap Re.mm LSTR MSG_CONTROL_RETRACTF = _UxGT("Rút V"); - LSTR MSG_CONTROL_RETRACT_ZHOP = _UxGT("Nhảy mm"); // hop - LSTR MSG_CONTROL_RETRACT_RECOVER = _UxGT("BỏRút mm"); // Unretr. mm - LSTR MSG_CONTROL_RETRACT_RECOVER_SWAP = _UxGT("BỏRút T mm"); // S Unretr. mm - LSTR MSG_CONTROL_RETRACT_RECOVERF = _UxGT("BỏRút V"); // UnRet V - LSTR MSG_CONTROL_RETRACT_RECOVER_SWAPF = _UxGT("BỏRút T V"); // S UnRet V - LSTR MSG_AUTORETRACT = _UxGT("RútTựĐộng"); // Auto-Retract - LSTR MSG_FILAMENT_SWAP_LENGTH = _UxGT("Khoảng Cách Rút"); // Retract Distance - LSTR MSG_TOOL_CHANGE = _UxGT("Thay Đổi Công Cụ"); // Tool Change - LSTR MSG_TOOL_CHANGE_ZLIFT = _UxGT("Đưa Lên Z"); // Z Raise - LSTR MSG_SINGLENOZZLE_PRIME_SPEED = _UxGT("Tốc Độ Tuôn Ra"); // Prime Speed - LSTR MSG_SINGLENOZZLE_RETRACT_SPEED = _UxGT("Tốc Độ Rút Lại"); // Retract Speed - LSTR MSG_FILAMENTCHANGE = _UxGT("Thay dây nhựa"); // change filament - LSTR MSG_FILAMENTCHANGE_E = _UxGT("Thay dây nhựa *"); // change filament - LSTR MSG_FILAMENTLOAD = _UxGT("Nạp dây nhựa"); // load filament - LSTR MSG_FILAMENTLOAD_E = _UxGT("Nạp dây nhựa *"); // load filament - LSTR MSG_FILAMENTUNLOAD = _UxGT("Dỡ dây nhựa"); // unload filament - LSTR MSG_FILAMENTUNLOAD_E = _UxGT("Dỡ dây nhựa *"); // unload filament - LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("Dỡ tất cả"); // Unload All - LSTR MSG_ATTACH_MEDIA = _UxGT("Khởi tạo phương tiện"); // Attach media - LSTR MSG_CHANGE_MEDIA = _UxGT("Thay phương tiện"); // Change midea + LSTR MSG_CONTROL_RETRACT_ZHOP = _UxGT("Nhảy mm"); // Hop + LSTR MSG_CONTROL_RETRACT_RECOVER = _UxGT("BỏRút mm"); // Unretr. mm + LSTR MSG_CONTROL_RETRACT_RECOVER_SWAP = _UxGT("BỏRút T mm"); // S Unretr. mm + LSTR MSG_CONTROL_RETRACT_RECOVERF = _UxGT("BỏRút V"); // UnRet V + LSTR MSG_CONTROL_RETRACT_RECOVER_SWAPF = _UxGT("BỏRút T V"); // S UnRet V + LSTR MSG_AUTORETRACT = _UxGT("RútTựĐộng"); // Auto-Retract + LSTR MSG_FILAMENT_SWAP_LENGTH = _UxGT("Khoảng Cách Rút"); // Retract Distance + LSTR MSG_TOOL_CHANGE = _UxGT("Thay Đổi Công Cụ"); // Tool Change + LSTR MSG_TOOL_CHANGE_ZLIFT = _UxGT("Đưa Lên Z"); // Z Raise + LSTR MSG_SINGLENOZZLE_PRIME_SPEED = _UxGT("Tốc Độ Tuôn Ra"); // Prime Speed + LSTR MSG_SINGLENOZZLE_RETRACT_SPEED = _UxGT("Tốc Độ Rút Lại"); // Retract Speed + LSTR MSG_FILAMENTCHANGE = _UxGT("Thay dây nhựa"); // Change filament + LSTR MSG_FILAMENTCHANGE_E = _UxGT("Thay dây nhựa *"); // Change filament + LSTR MSG_FILAMENTLOAD = _UxGT("Nạp dây nhựa"); // Load filament + LSTR MSG_FILAMENTLOAD_E = _UxGT("Nạp dây nhựa *"); // Load filament + LSTR MSG_FILAMENTUNLOAD = _UxGT("Dỡ dây nhựa"); // Unload filament + LSTR MSG_FILAMENTUNLOAD_E = _UxGT("Dỡ dây nhựa *"); // Unload filament + LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("Dỡ tất cả"); // Unload All + LSTR MSG_ATTACH_MEDIA = _UxGT("Khởi tạo phương tiện"); // Attach media + LSTR MSG_CHANGE_MEDIA = _UxGT("Thay phương tiện"); // Change midea LSTR MSG_RELEASE_MEDIA = _UxGT("Phát hành phương tiện"); - LSTR MSG_ZPROBE_OUT = _UxGT("Đầu Dò Z qua bàn"); // Z Probe past bed - LSTR MSG_SKEW_FACTOR = _UxGT("Hệ số nghiêng"); // Skew Factor - LSTR MSG_BLTOUCH = _UxGT("BLTOUCH"); // BLTouch - LSTR MSG_BLTOUCH_SELFTEST = _UxGT("Tự kiểm tra BLTOUCH "); // BLTouch Self-Test - LSTR MSG_BLTOUCH_RESET = _UxGT("Bặt lại BLTouch"); // Reset BLTouch - LSTR MSG_BLTOUCH_DEPLOY = _UxGT("Đem BLTouch"); // Deploy BLTouch - LSTR MSG_BLTOUCH_STOW = _UxGT("Cất BLTouch"); // Stow BLTouch - LSTR MSG_MANUAL_DEPLOY = _UxGT("Đem Đầu Dò-Z"); // Deploy Z-Probe - LSTR MSG_MANUAL_STOW = _UxGT("Cất Đầu Dò-Z"); // Stow Z-Probe + LSTR MSG_ZPROBE_OUT = _UxGT("Đầu Dò Z qua bàn"); // Z Probe past bed + LSTR MSG_SKEW_FACTOR = _UxGT("Hệ số nghiêng"); // Skew Factor + LSTR MSG_BLTOUCH = _UxGT("BLTOUCH"); // BLTouch + LSTR MSG_BLTOUCH_SELFTEST = _UxGT("Tự kiểm tra BLTOUCH "); // BLTouch Self-Test + LSTR MSG_BLTOUCH_RESET = _UxGT("Bặt lại BLTouch"); // Reset BLTouch + LSTR MSG_BLTOUCH_DEPLOY = _UxGT("Đem BLTouch"); // Deploy BLTouch + LSTR MSG_BLTOUCH_STOW = _UxGT("Cất BLTouch"); // Stow BLTouch + LSTR MSG_MANUAL_DEPLOY = _UxGT("Đem Đầu Dò-Z"); // Deploy Z-Probe + LSTR MSG_MANUAL_STOW = _UxGT("Cất Đầu Dò-Z"); // Stow Z-Probe LSTR MSG_HOME_FIRST = _UxGT("Về nhà %s Trước"); - LSTR MSG_ZPROBE_ZOFFSET = _UxGT("Đầu Dò Bù Đắp Z"); // Probe Z Offset - LSTR MSG_BABYSTEP_X = _UxGT("Nhít X"); // Babystep X + LSTR MSG_ZPROBE_ZOFFSET = _UxGT("Đầu Dò Bù Đắp Z"); // Probe Z Offset + 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 - LSTR MSG_THERMAL_RUNAWAY = _UxGT("Vấn đề nhiệt"); // THERMAL RUNAWAY | problem - LSTR MSG_THERMAL_RUNAWAY_BED = _UxGT("Vấn đề nhiệt bàn"); // BED THERMAL RUNAWAY - LSTR MSG_ERR_MAXTEMP = _UxGT("Điều sai: nhiệt độ tối đa"); // Err: MAXTEMP - LSTR MSG_ERR_MINTEMP = _UxGT("Điều sai: nhiệt độ tối thiểu"); // Err: MINTEMP - LSTR MSG_HALTED = _UxGT("MÁY IN ĐÃ DỪNG LẠI"); // PRINTER HALTED - LSTR MSG_PLEASE_RESET = _UxGT("Xin bặt lại"); // Please reset - LSTR MSG_HEATING = _UxGT("Đang sưởi nóng..."); // heating - LSTR MSG_COOLING = _UxGT("Đang làm nguội..."); // cooling - LSTR MSG_BED_HEATING = _UxGT("Đang sưởi nong bàn..."); // bed heating - LSTR MSG_BED_COOLING = _UxGT("Đang làm nguội bàn..."); // bed cooling - LSTR MSG_DELTA_CALIBRATE = _UxGT("Cân Chỉnh Delta"); // Delta calibration + 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 + LSTR MSG_THERMAL_RUNAWAY = _UxGT("Vấn đề nhiệt"); // THERMAL RUNAWAY | problem + LSTR MSG_THERMAL_RUNAWAY_BED = _UxGT("Vấn đề nhiệt bàn"); // BED THERMAL RUNAWAY + LSTR MSG_ERR_MAXTEMP = _UxGT("Điều sai: nhiệt độ tối đa"); // Err: MAXTEMP + LSTR MSG_ERR_MINTEMP = _UxGT("Điều sai: nhiệt độ tối thiểu"); // Err: MINTEMP + LSTR MSG_HALTED = _UxGT("MÁY IN ĐÃ DỪNG LẠI"); // PRINTER HALTED + LSTR MSG_PLEASE_RESET = _UxGT("Xin bặt lại"); // Please reset + LSTR MSG_HEATING = _UxGT("Đang sưởi nóng..."); // Heating + LSTR MSG_COOLING = _UxGT("Đang làm nguội..."); // Cooling + LSTR MSG_BED_HEATING = _UxGT("Đang sưởi nong bàn..."); // Bed heating + LSTR MSG_BED_COOLING = _UxGT("Đang làm nguội bàn..."); // Bed cooling + LSTR MSG_DELTA_CALIBRATE = _UxGT("Cân Chỉnh Delta"); // Delta calibration LSTR MSG_DELTA_CALIBRATE_X = _UxGT("Chỉnh X lại"); LSTR MSG_DELTA_CALIBRATE_Y = _UxGT("Chỉnh Y lại"); LSTR MSG_DELTA_CALIBRATE_Z = _UxGT("Chỉnh Z lại"); - 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_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 + 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_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 LSTR MSG_INFO_MENU = _UxGT("Về Máy In"); - LSTR MSG_INFO_PRINTER_MENU = _UxGT("Thông Tin Máy In"); // Printer Info - LSTR MSG_3POINT_LEVELING = _UxGT("San lấp 3-Điểm"); // 3-Point Leveling - LSTR MSG_LINEAR_LEVELING = _UxGT("San Lấp Tuyến Tính"); // Linear Leveling - LSTR MSG_BILINEAR_LEVELING = _UxGT("San Lấp Song Tuyến"); // Bilinear Leveling - LSTR MSG_UBL_LEVELING = _UxGT("San Lấp Bàn Thống Nhất"); // Unified Bed Leveling - LSTR MSG_MESH_LEVELING = _UxGT("Lưới San Lấp"); // Mesh Leveling - LSTR MSG_INFO_STATS_MENU = _UxGT("Thống Kê Máy In"); // Printer Stats - LSTR MSG_INFO_BOARD_MENU = _UxGT("Thông Tin Bo Mạch"); // Board Info - LSTR MSG_INFO_THERMISTOR_MENU = _UxGT("Điện Trở Nhiệt"); // Thermistors - LSTR MSG_INFO_EXTRUDERS = _UxGT("Máy đùn"); // Extruders - LSTR MSG_INFO_BAUDRATE = _UxGT("Baud"); // Baud - LSTR MSG_INFO_PROTOCOL = _UxGT("Giao Thức"); // Protocol - LSTR MSG_CASE_LIGHT = _UxGT("Đèn Khuông"); // Case light - LSTR MSG_CASE_LIGHT_BRIGHTNESS = _UxGT("Độ Sáng"); // Light Brightness + LSTR MSG_INFO_PRINTER_MENU = _UxGT("Thông Tin Máy In"); // Printer Info + LSTR MSG_3POINT_LEVELING = _UxGT("San lấp 3-Điểm"); // 3-Point Leveling + LSTR MSG_LINEAR_LEVELING = _UxGT("San Lấp Tuyến Tính"); // Linear Leveling + LSTR MSG_BILINEAR_LEVELING = _UxGT("San Lấp Song Tuyến"); // Bilinear Leveling + LSTR MSG_UBL_LEVELING = _UxGT("San Lấp Bàn Thống Nhất"); // Unified Bed Leveling + LSTR MSG_MESH_LEVELING = _UxGT("Lưới San Lấp"); // Mesh Leveling + LSTR MSG_INFO_STATS_MENU = _UxGT("Thống Kê Máy In"); // Printer Stats + LSTR MSG_INFO_BOARD_MENU = _UxGT("Thông Tin Bo Mạch"); // Board Info + LSTR MSG_INFO_THERMISTOR_MENU = _UxGT("Điện Trở Nhiệt"); // Thermistors + LSTR MSG_INFO_EXTRUDERS = _UxGT("Máy đùn"); // Extruders + LSTR MSG_INFO_BAUDRATE = _UxGT("Baud"); // Baud + LSTR MSG_INFO_PROTOCOL = _UxGT("Giao Thức"); // Protocol + LSTR MSG_CASE_LIGHT = _UxGT("Đèn Khuông"); // Case light + LSTR MSG_CASE_LIGHT_BRIGHTNESS = _UxGT("Độ Sáng"); // Light Brightness #if LCD_WIDTH >= 20 || HAS_DWIN_E3V2 - LSTR MSG_INFO_PRINT_COUNT = _UxGT("Số In"); // Print Count + LSTR MSG_INFO_PRINT_COUNT = _UxGT("Số In"); // Print Count LSTR MSG_INFO_COMPLETED_PRINTS = _UxGT("Đã hoàn thành"); - LSTR MSG_INFO_PRINT_TIME = _UxGT("Tổng số thời gian in"); // Total print time - LSTR MSG_INFO_PRINT_LONGEST = _UxGT("Thời gian việc lâu nhất"); // Longest job time - LSTR MSG_INFO_PRINT_FILAMENT = _UxGT("Tổng số đùn"); // Extruded total + LSTR MSG_INFO_PRINT_TIME = _UxGT("Tổng số thời gian in"); // Total print time + LSTR MSG_INFO_PRINT_LONGEST = _UxGT("Thời gian việc lâu nhất"); // Longest job time + LSTR MSG_INFO_PRINT_FILAMENT = _UxGT("Tổng số đùn"); // Extruded total #else - LSTR MSG_INFO_PRINT_COUNT = _UxGT("In"); // prints - LSTR MSG_INFO_COMPLETED_PRINTS = _UxGT("Đã hoàn thành"); // Completed - LSTR MSG_INFO_PRINT_TIME = _UxGT("Tổng số"); // total - LSTR MSG_INFO_PRINT_LONGEST = _UxGT("Dài nhất"); // Longest + LSTR MSG_INFO_PRINT_COUNT = _UxGT("In"); // Prints + LSTR MSG_INFO_COMPLETED_PRINTS = _UxGT("Đã hoàn thành"); // Completed + LSTR MSG_INFO_PRINT_TIME = _UxGT("Tổng số"); // Total + LSTR MSG_INFO_PRINT_LONGEST = _UxGT("Dài nhất"); // Longest LSTR MSG_INFO_PRINT_FILAMENT = _UxGT("Đã ép đùn"); #endif - LSTR MSG_INFO_MIN_TEMP = _UxGT("Nhiệt độ tối thiểu"); // Min Temp - 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_INFO_MIN_TEMP = _UxGT("Nhiệt độ tối thiểu"); // Min Temp + 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_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_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"); - LSTR MSG_FILAMENT_CHANGE_HEADER_UNLOAD = _UxGT("Dỡ dây nhựa"); // unload filament - LSTR MSG_FILAMENT_CHANGE_OPTION_HEADER = _UxGT("Tùy chọn hồi phục:"); // RESUME OPTIONS - LSTR MSG_FILAMENT_CHANGE_OPTION_PURGE = _UxGT("Xả thêm"); // Purge more - LSTR MSG_FILAMENT_CHANGE_OPTION_RESUME = _UxGT("Tiếp tục"); // continue - LSTR MSG_FILAMENT_CHANGE_NOZZLE = _UxGT(" Đầu Phun: "); // Nozzle - LSTR MSG_RUNOUT_SENSOR_ENABLE = _UxGT("Cảm Biến Hết"); // Runout Sensor - LSTR MSG_KILL_HOMING_FAILED = _UxGT("Sự nhà không thành công"); // Homing failed - LSTR MSG_LCD_PROBING_FAILED = _UxGT(" không thành công"); // Probing failed + LSTR MSG_FILAMENT_CHANGE_HEADER_UNLOAD = _UxGT("Dỡ dây nhựa"); // Unload filament + LSTR MSG_FILAMENT_CHANGE_OPTION_HEADER = _UxGT("Tùy chọn hồi phục:"); // RESUME OPTIONS + LSTR MSG_FILAMENT_CHANGE_OPTION_PURGE = _UxGT("Xả thêm"); // Purge more + LSTR MSG_FILAMENT_CHANGE_OPTION_RESUME = _UxGT("Tiếp tục"); // Continue + LSTR MSG_FILAMENT_CHANGE_NOZZLE = _UxGT(" Đầu Phun: "); // Nozzle + LSTR MSG_RUNOUT_SENSOR_ENABLE = _UxGT("Cảm Biến Hết"); // Runout Sensor + LSTR MSG_KILL_HOMING_FAILED = _UxGT("Sự nhà không thành công"); // Homing failed + LSTR MSG_LCD_PROBING_FAILED = _UxGT(" không thành công"); // Probing failed // // Filament Change screens show up to 3 lines on a 4-line display @@ -406,36 +406,37 @@ namespace Language_vi { // #if LCD_HEIGHT >= 4 LSTR MSG_ADVANCED_PAUSE_WAITING = _UxGT(MSG_2_LINE("Nhấn nút", "để tiếp tục in")); // Press button to resume print - LSTR MSG_FILAMENT_CHANGE_INIT = _UxGT(MSG_3_LINE("Chờ cho sự", "thay đổi dây nhựa", "bắt đầu")); // wait for filament change to start - LSTR MSG_FILAMENT_CHANGE_INSERT = _UxGT(MSG_3_LINE("Đút dây nhựa vào", "và nhấn nút", "để tiếp tục")); // insert filament and press button to continue // + LSTR MSG_FILAMENT_CHANGE_INIT = _UxGT(MSG_3_LINE("Chờ cho sự", "thay đổi dây nhựa", "bắt đầu")); // Wait for filament change to start + LSTR MSG_FILAMENT_CHANGE_INSERT = _UxGT(MSG_3_LINE("Đút dây nhựa vào", "và nhấn nút", "để tiếp tục")); // Insert filament and press button to continue // LSTR MSG_FILAMENT_CHANGE_HEAT = _UxGT(MSG_2_LINE("Nhấn nút", "để làm nóng đầu phun")); // Press button to heat nozzle LSTR MSG_FILAMENT_CHANGE_HEATING = _UxGT(MSG_2_LINE("Đầu phun đang nóng lên", "Xin chờ...")); // Nozzle heating Please wait - LSTR MSG_FILAMENT_CHANGE_UNLOAD = _UxGT(MSG_2_LINE("Chờ tro", "dây nhựa ra")); // Wait for filament unload - LSTR MSG_FILAMENT_CHANGE_LOAD = _UxGT(MSG_2_LINE("Chờ tro", "dây nhựa vào")); // Wait for filament load - LSTR MSG_FILAMENT_CHANGE_PURGE = _UxGT(MSG_2_LINE("Chờ tro", "xả dây nhựa")); // wait for filament purge + LSTR MSG_FILAMENT_CHANGE_UNLOAD = _UxGT(MSG_2_LINE("Chờ tro", "dây nhựa ra")); // Wait for filament unload + LSTR MSG_FILAMENT_CHANGE_LOAD = _UxGT(MSG_2_LINE("Chờ tro", "dây nhựa vào")); // Wait for filament load + LSTR MSG_FILAMENT_CHANGE_PURGE = _UxGT(MSG_2_LINE("Chờ tro", "xả dây nhựa")); // Wait for filament purge LSTR MSG_FILAMENT_CHANGE_CONT_PURGE = _UxGT(MSG_2_LINE("Nhấn nút để kết thúc", "xả dây nhựa")); // Click to finish dây nhựa purge LSTR MSG_FILAMENT_CHANGE_RESUME = _UxGT(MSG_2_LINE("Chờ tro in", "tiếp tục...")); // Wait for print to resume #else // LCD_HEIGHT < 4 - LSTR MSG_ADVANCED_PAUSE_WAITING = _UxGT(MSG_1_LINE("Nhấn nút để tiếp tục")); // Click to continue + LSTR MSG_ADVANCED_PAUSE_WAITING = _UxGT(MSG_1_LINE("Nhấn nút để tiếp tục")); // Click to continue LSTR MSG_FILAMENT_CHANGE_INIT = _UxGT(MSG_1_LINE("Xin chờ...")); - LSTR MSG_FILAMENT_CHANGE_INSERT = _UxGT(MSG_1_LINE("Chèn và nhấn")); // Insert and Click - LSTR MSG_FILAMENT_CHANGE_HEAT = _UxGT(MSG_1_LINE("Nhấn để sưởi")); // Click to heat - LSTR MSG_FILAMENT_CHANGE_HEATING = _UxGT(MSG_1_LINE("Đang sưởi nóng")); // Heating - LSTR MSG_FILAMENT_CHANGE_UNLOAD = _UxGT(MSG_1_LINE("Đang dỡ ra...")); // Ejecting - LSTR MSG_FILAMENT_CHANGE_LOAD = _UxGT(MSG_1_LINE("Đang nạp...")); // Loading - LSTR MSG_FILAMENT_CHANGE_PURGE = _UxGT(MSG_1_LINE("Đang xả...")); // Purging - LSTR MSG_FILAMENT_CHANGE_CONT_PURGE = _UxGT(MSG_1_LINE("Nhấn nút để kết thúc")); // Click to finish - LSTR MSG_FILAMENT_CHANGE_RESUME = _UxGT(MSG_1_LINE("Đang tiếp tục...")); // Resuming + LSTR MSG_FILAMENT_CHANGE_INSERT = _UxGT(MSG_1_LINE("Chèn và nhấn")); // Insert and Click + LSTR MSG_FILAMENT_CHANGE_HEAT = _UxGT(MSG_1_LINE("Nhấn để sưởi")); // Click to heat + LSTR MSG_FILAMENT_CHANGE_HEATING = _UxGT(MSG_1_LINE("Đang sưởi nóng")); // Heating + LSTR MSG_FILAMENT_CHANGE_UNLOAD = _UxGT(MSG_1_LINE("Đang dỡ ra...")); // Ejecting + LSTR MSG_FILAMENT_CHANGE_LOAD = _UxGT(MSG_1_LINE("Đang nạp...")); // Loading + LSTR MSG_FILAMENT_CHANGE_PURGE = _UxGT(MSG_1_LINE("Đang xả...")); // Purging + LSTR MSG_FILAMENT_CHANGE_CONT_PURGE = _UxGT(MSG_1_LINE("Nhấn nút để kết thúc")); // Click to finish + LSTR MSG_FILAMENT_CHANGE_RESUME = _UxGT(MSG_1_LINE("Đang tiếp tục...")); // Resuming #endif // LCD_HEIGHT < 4 - LSTR MSG_TMC_DRIVERS = _UxGT("Trình điều khiển TMC"); // TMC drivers - LSTR MSG_TMC_CURRENT = _UxGT("Dòng điện trình điều khiển"); // Driver current - LSTR MSG_TMC_HYBRID_THRS = _UxGT("Ngưỡng Hỗn Hợp"); // Hybrid threshold - LSTR MSG_TMC_HOMING_THRS = _UxGT("Vô cảm biến"); // Sensorless homing - LSTR MSG_TMC_STEPPING_MODE = _UxGT("Chế độ từng bước"); // Stepping mode - LSTR MSG_TMC_STEALTH_ENABLED = _UxGT("CắtTàngHình được kích hoạt"); // StealthChop enabled + LSTR MSG_TMC_DRIVERS = _UxGT("Trình điều khiển TMC"); // TMC drivers + LSTR MSG_TMC_CURRENT = _UxGT("Dòng điện trình điều khiển"); // Driver current + LSTR MSG_TMC_HYBRID_THRS = _UxGT("Ngưỡng Hỗn Hợp"); // Hybrid threshold + LSTR MSG_TMC_HOMING_THRS = _UxGT("Vô cảm biến"); // Sensorless homing + LSTR MSG_TMC_STEPPING_MODE = _UxGT("Chế độ từng bước"); // Stepping mode + LSTR MSG_TMC_STEALTH_ENABLED = _UxGT("CắtTàngHình được kích hoạt"); // StealthChop enabled - LSTR MSG_SHORT_DAY = _UxGT("n"); // d - ngày - One character only - LSTR MSG_SHORT_HOUR = _UxGT("g"); // h - giờ - One character only - LSTR MSG_SHORT_MINUTE = _UxGT("p"); // m - phút - One character only + LSTR MSG_SHORT_DAY = _UxGT("n"); // d - ngày - One character only + LSTR MSG_SHORT_HOUR = _UxGT("g"); // h - giờ - One character only + LSTR MSG_SHORT_MINUTE = _UxGT("p"); // m - phút - One character only + LSTR MSG_SHORT_MINUTE = _UxGT("p"); // M - phút - One character only } diff --git a/Marlin/src/lcd/language/language_zh_CN.h b/Marlin/src/lcd/language/language_zh_CN.h index 7acd0d8e8f494..03c8d80bca74b 100644 --- a/Marlin/src/lcd/language/language_zh_CN.h +++ b/Marlin/src/lcd/language/language_zh_CN.h @@ -28,88 +28,88 @@ * See also https://marlinfw.org/docs/development/lcd_language.html */ namespace Language_zh_CN { - using namespace Language_en; // Inherit undefined strings from English + using namespace Language_en; // Inherit undefined strings from English constexpr uint8_t CHARSIZE = 3; LSTR LANGUAGE = _UxGT("Simplified Chinese"); - LSTR WELCOME_MSG = MACHINE_NAME _UxGT("已就绪."); // " ready." + LSTR WELCOME_MSG = MACHINE_NAME _UxGT("已就绪."); // " ready." LSTR MSG_MARLIN = _UxGT("马林"); LSTR MSG_YES = _UxGT("是"); LSTR MSG_NO = _UxGT("否"); - LSTR MSG_BACK = _UxGT("返回"); // ”Back“ + LSTR MSG_BACK = _UxGT("返回"); // ”Back“ LSTR MSG_MEDIA_ABORTING = _UxGT("放弃中..."); - LSTR MSG_MEDIA_INSERTED = _UxGT("存储卡已插入"); // "Card inserted" - LSTR MSG_MEDIA_REMOVED = _UxGT("存储卡被拔出"); // "Card removed" + LSTR MSG_MEDIA_INSERTED = _UxGT("存储卡已插入"); // "Card inserted" + LSTR MSG_MEDIA_REMOVED = _UxGT("存储卡被拔出"); // "Card removed" LSTR MSG_MEDIA_WAITING = _UxGT("等待存储器"); LSTR MSG_MEDIA_READ_ERROR = _UxGT("存储器读取错误"); LSTR MSG_MEDIA_USB_REMOVED = _UxGT("USB设备已弹出"); LSTR MSG_MEDIA_USB_FAILED = _UxGT("USB启动错误"); LSTR MSG_KILL_SUBCALL_OVERFLOW = _UxGT("子响应溢出"); - LSTR MSG_LCD_ENDSTOPS = _UxGT("挡块"); // "Endstops" // Max length 8 characters + LSTR MSG_LCD_ENDSTOPS = _UxGT("挡块"); // "Endstops" // Max length 8 characters LSTR MSG_LCD_SOFT_ENDSTOPS = _UxGT("软挡块"); - LSTR MSG_MAIN_MENU = _UxGT("主菜单"); // "Main" + LSTR MSG_MAIN_MENU = _UxGT("主菜单"); // "Main" LSTR MSG_ADVANCED_SETTINGS = _UxGT("高级设置"); LSTR MSG_CONFIGURATION = _UxGT("配置"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("自动开始"); // "Autostart" - LSTR MSG_DISABLE_STEPPERS = _UxGT("关闭步进电机"); // "Disable steppers" - LSTR MSG_DEBUG_MENU = _UxGT("调试菜单"); // "Debug Menu" - LSTR MSG_PROGRESS_BAR_TEST = _UxGT("进度条测试"); // "Progress Bar Test" + LSTR MSG_RUN_AUTO_FILES = _UxGT("自动开始"); // "Autostart" + LSTR MSG_DISABLE_STEPPERS = _UxGT("关闭步进电机"); // "Disable steppers" + LSTR MSG_DEBUG_MENU = _UxGT("调试菜单"); // "Debug Menu" + LSTR MSG_PROGRESS_BAR_TEST = _UxGT("进度条测试"); // "Progress Bar Test" LSTR MSG_HOMING = _UxGT("回原点"); - LSTR MSG_AUTO_HOME = _UxGT("自动回原点"); // "Auto home" - LSTR MSG_AUTO_HOME_X = _UxGT("回X原位"); // "Home X" - LSTR MSG_AUTO_HOME_Y = _UxGT("回Y原位"); // "Home Y" - LSTR MSG_AUTO_HOME_Z = _UxGT("回Z原位"); // "Home Z" + LSTR MSG_AUTO_HOME = _UxGT("自动回原点"); // "Auto home" + LSTR MSG_AUTO_HOME_X = _UxGT("回X原位"); // "Home X" + LSTR MSG_AUTO_HOME_Y = _UxGT("回Y原位"); // "Home Y" + LSTR MSG_AUTO_HOME_Z = _UxGT("回Z原位"); // "Home Z" LSTR MSG_AUTO_Z_ALIGN = _UxGT("自动Z对齐"); - LSTR MSG_LEVEL_BED_HOMING = _UxGT("平台调平XYZ归原位"); // "Homing XYZ" - LSTR MSG_LEVEL_BED_WAITING = _UxGT("单击开始热床调平"); // "Click to Begin" - LSTR MSG_LEVEL_BED_NEXT_POINT = _UxGT("下个热床调平点"); // "Next Point" - LSTR MSG_LEVEL_BED_DONE = _UxGT("完成热床调平"); // "Leveling Done!" - 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_LEVEL_BED_HOMING = _UxGT("平台调平XYZ归原位"); // "Homing XYZ" + LSTR MSG_LEVEL_BED_WAITING = _UxGT("单击开始热床调平"); // "Click to Begin" + LSTR MSG_LEVEL_BED_NEXT_POINT = _UxGT("下个热床调平点"); // "Next Point" + LSTR MSG_LEVEL_BED_DONE = _UxGT("完成热床调平"); // "Leveling Done!" + 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" #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" - LSTR MSG_PREHEAT_1_END = _UxGT("预热 ") PREHEAT_1_LABEL _UxGT(" 喷嘴"); //MSG_PREHEAT_1 " " - LSTR MSG_PREHEAT_1_END_E = _UxGT("预热 ") PREHEAT_1_LABEL _UxGT(" 喷嘴 ~"); //MSG_PREHEAT_1 " " - LSTR MSG_PREHEAT_1_ALL = _UxGT("预热 ") PREHEAT_1_LABEL _UxGT(" 全部"); //MSG_PREHEAT_1 " All" - LSTR MSG_PREHEAT_1_BEDONLY = _UxGT("预热 ") PREHEAT_1_LABEL _UxGT(" 热床"); //MSG_PREHEAT_1 " Bed" - LSTR MSG_PREHEAT_1_SETTINGS = _UxGT("预热 ") PREHEAT_1_LABEL _UxGT(" 设置"); //MSG_PREHEAT_1 " conf" + 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" + LSTR MSG_PREHEAT_1_END = _UxGT("预热 ") PREHEAT_1_LABEL _UxGT(" 喷嘴"); //MSG_PREHEAT_1 " " + LSTR MSG_PREHEAT_1_END_E = _UxGT("预热 ") PREHEAT_1_LABEL _UxGT(" 喷嘴 ~"); //MSG_PREHEAT_1 " " + LSTR MSG_PREHEAT_1_ALL = _UxGT("预热 ") PREHEAT_1_LABEL _UxGT(" 全部"); //MSG_PREHEAT_1 " All" + LSTR MSG_PREHEAT_1_BEDONLY = _UxGT("预热 ") PREHEAT_1_LABEL _UxGT(" 热床"); //MSG_PREHEAT_1 " Bed" + LSTR MSG_PREHEAT_1_SETTINGS = _UxGT("预热 ") PREHEAT_1_LABEL _UxGT(" 设置"); //MSG_PREHEAT_1 " conf" - LSTR MSG_PREHEAT_M = _UxGT("预热 $"); // "Preheat PREHEAT_2_LABEL" - LSTR MSG_PREHEAT_M_H = _UxGT("预热 $ ~"); // "Preheat PREHEAT_2_LABEL" - LSTR MSG_PREHEAT_M_END = _UxGT("预热 $ 喷嘴"); //MSG_PREHEAT_1 " " - LSTR MSG_PREHEAT_M_END_E = _UxGT("预热 $ 喷嘴 ~"); //MSG_PREHEAT_1 " " - LSTR MSG_PREHEAT_M_ALL = _UxGT("预热 $ 全部"); //MSG_PREHEAT_1 " All" - LSTR MSG_PREHEAT_M_BEDONLY = _UxGT("预热 $ 热床"); //MSG_PREHEAT_1 " Bed" - LSTR MSG_PREHEAT_M_SETTINGS = _UxGT("预热 $ 设置"); //MSG_PREHEAT_1 " conf" + LSTR MSG_PREHEAT_M = _UxGT("预热 $"); // "Preheat PREHEAT_2_LABEL" + LSTR MSG_PREHEAT_M_H = _UxGT("预热 $ ~"); // "Preheat PREHEAT_2_LABEL" + LSTR MSG_PREHEAT_M_END = _UxGT("预热 $ 喷嘴"); //MSG_PREHEAT_1 " " + LSTR MSG_PREHEAT_M_END_E = _UxGT("预热 $ 喷嘴 ~"); //MSG_PREHEAT_1 " " + LSTR MSG_PREHEAT_M_ALL = _UxGT("预热 $ 全部"); //MSG_PREHEAT_1 " All" + LSTR MSG_PREHEAT_M_BEDONLY = _UxGT("预热 $ 热床"); //MSG_PREHEAT_1 " Bed" + LSTR MSG_PREHEAT_M_SETTINGS = _UxGT("预热 $ 设置"); //MSG_PREHEAT_1 " conf" #endif LSTR MSG_PREHEAT_CUSTOM = _UxGT("预热自定义"); - LSTR MSG_COOLDOWN = _UxGT("降温"); // "Cooldown" + LSTR MSG_COOLDOWN = _UxGT("降温"); // "Cooldown" LSTR MSG_CUTTER_FREQUENCY = _UxGT("切割频率"); LSTR MSG_LASER_MENU = _UxGT("激光控制"); LSTR MSG_LASER_POWER = _UxGT("激光电源"); LSTR MSG_SPINDLE_MENU = _UxGT("主轴控制"); LSTR MSG_SPINDLE_POWER = _UxGT("主轴电源"); LSTR MSG_SPINDLE_REVERSE = _UxGT("主轴反转"); - LSTR MSG_SWITCH_PS_ON = _UxGT("开启电源"); // "Switch power on" - LSTR MSG_SWITCH_PS_OFF = _UxGT("关闭电源"); // "Switch power off" - LSTR MSG_EXTRUDE = _UxGT("挤出"); // "Extrude" - LSTR MSG_RETRACT = _UxGT("回抽"); // "Retract" - LSTR MSG_MOVE_AXIS = _UxGT("移动轴"); // "Move axis" - LSTR MSG_BED_LEVELING = _UxGT("调平热床"); // "Bed leveling" - LSTR MSG_LEVEL_BED = _UxGT("调平热床"); // "Level bed" - LSTR MSG_BED_TRAMMING = _UxGT("调平边角"); // "Bed Tramming" - LSTR MSG_NEXT_CORNER = _UxGT("下个边角"); // "Next corner" + LSTR MSG_SWITCH_PS_ON = _UxGT("开启电源"); // "Switch power on" + LSTR MSG_SWITCH_PS_OFF = _UxGT("关闭电源"); // "Switch power off" + LSTR MSG_EXTRUDE = _UxGT("挤出"); // "Extrude" + LSTR MSG_RETRACT = _UxGT("回抽"); // "Retract" + LSTR MSG_MOVE_AXIS = _UxGT("移动轴"); // "Move axis" + LSTR MSG_BED_LEVELING = _UxGT("调平热床"); // "Bed leveling" + LSTR MSG_LEVEL_BED = _UxGT("调平热床"); // "Level bed" + LSTR MSG_BED_TRAMMING = _UxGT("调平边角"); // "Bed Tramming" + LSTR MSG_NEXT_CORNER = _UxGT("下个边角"); // "Next corner" LSTR MSG_MESH_EDITOR = _UxGT("网格编辑器"); - LSTR MSG_EDIT_MESH = _UxGT("编辑网格"); // "Edit Mesh" - LSTR MSG_EDITING_STOPPED = _UxGT("网格编辑已停止"); // "Mesh Editing Stopped" + LSTR MSG_EDIT_MESH = _UxGT("编辑网格"); // "Edit Mesh" + LSTR MSG_EDITING_STOPPED = _UxGT("网格编辑已停止"); // "Mesh Editing Stopped" LSTR MSG_PROBING_POINT = _UxGT("探测点"); LSTR MSG_MESH_X = _UxGT("索引X"); LSTR MSG_MESH_Y = _UxGT("索引Y"); LSTR MSG_MESH_EDIT_Z = _UxGT("Z 值"); - LSTR MSG_CUSTOM_COMMANDS = _UxGT("定制命令"); // "Custom Commands" + LSTR MSG_CUSTOM_COMMANDS = _UxGT("定制命令"); // "Custom Commands" LSTR MSG_M48_TEST = _UxGT("M48探测"); LSTR MSG_M48_POINT = _UxGT("M48点"); LSTR MSG_M48_DEVIATION = _UxGT("M48偏差"); @@ -121,36 +121,36 @@ namespace Language_zh_CN { LSTR MSG_IDEX_MODE_FULL_CTRL = _UxGT("完全控制"); LSTR MSG_HOTEND_OFFSET_Z = _UxGT("第二喷头是Z"); LSTR MSG_HOTEND_OFFSET_A = _UxGT("第二喷头是@"); - LSTR MSG_UBL_DOING_G29 = _UxGT("执行G29"); // "Doing G29" - LSTR MSG_UBL_TOOLS = _UxGT("UBL工具"); // "UBL Tools" - LSTR MSG_UBL_LEVEL_BED = _UxGT("统一热床调平(UBL)"); // "Unified Bed Leveling" + LSTR MSG_UBL_DOING_G29 = _UxGT("执行G29"); // "Doing G29" + LSTR MSG_UBL_TOOLS = _UxGT("UBL工具"); // "UBL Tools" + LSTR MSG_UBL_LEVEL_BED = _UxGT("统一热床调平(UBL)"); // "Unified Bed Leveling" LSTR MSG_LCD_TILTING_MESH = _UxGT("倾斜點"); - LSTR MSG_UBL_MANUAL_MESH = _UxGT("手工创设网格"); // "Manually Build Mesh" - LSTR MSG_UBL_BC_INSERT = _UxGT("放置垫片并测量"); // "Place shim & measure" - LSTR MSG_UBL_BC_INSERT2 = _UxGT("测量"); // "Measure" - LSTR MSG_UBL_BC_REMOVE = _UxGT("移除并测量热床"); // "Remove & measure bed" - LSTR MSG_UBL_MOVING_TO_NEXT = _UxGT("移动到下一个"); // "Moving to next" - LSTR MSG_UBL_ACTIVATE_MESH = _UxGT("激活UBL"); // "Activate UBL" - LSTR MSG_UBL_DEACTIVATE_MESH = _UxGT("关闭UBL"); // "Deactivate UBL" - LSTR MSG_UBL_SET_TEMP_BED = _UxGT("热床温度"); // "Bed Temp" + LSTR MSG_UBL_MANUAL_MESH = _UxGT("手工创设网格"); // "Manually Build Mesh" + LSTR MSG_UBL_BC_INSERT = _UxGT("放置垫片并测量"); // "Place shim & measure" + LSTR MSG_UBL_BC_INSERT2 = _UxGT("测量"); // "Measure" + LSTR MSG_UBL_BC_REMOVE = _UxGT("移除并测量热床"); // "Remove & measure bed" + LSTR MSG_UBL_MOVING_TO_NEXT = _UxGT("移动到下一个"); // "Moving to next" + LSTR MSG_UBL_ACTIVATE_MESH = _UxGT("激活UBL"); // "Activate UBL" + LSTR MSG_UBL_DEACTIVATE_MESH = _UxGT("关闭UBL"); // "Deactivate UBL" + LSTR MSG_UBL_SET_TEMP_BED = _UxGT("热床温度"); // "Bed Temp" LSTR MSG_UBL_BED_TEMP_CUSTOM = _UxGT("热床温度"); - LSTR MSG_UBL_SET_TEMP_HOTEND = _UxGT("热端温度"); // "Hotend Temp" + LSTR MSG_UBL_SET_TEMP_HOTEND = _UxGT("热端温度"); // "Hotend Temp" LSTR MSG_UBL_HOTEND_TEMP_CUSTOM = _UxGT("热端温度"); - LSTR MSG_UBL_MESH_EDIT = _UxGT("网格编辑"); // "Mesh Edit" - LSTR MSG_UBL_EDIT_CUSTOM_MESH = _UxGT("编辑客户网格"); // "Edit Custom Mesh" - LSTR MSG_UBL_FINE_TUNE_MESH = _UxGT("细调网格"); // "Fine Tuning Mesh" - LSTR MSG_UBL_DONE_EDITING_MESH = _UxGT("完成编辑网格"); // "Done Editing Mesh" - LSTR MSG_UBL_BUILD_CUSTOM_MESH = _UxGT("创设客户网格"); // "Build Custom Mesh" - LSTR MSG_UBL_BUILD_MESH_MENU = _UxGT("创设网格"); // "Build Mesh" + LSTR MSG_UBL_MESH_EDIT = _UxGT("网格编辑"); // "Mesh Edit" + LSTR MSG_UBL_EDIT_CUSTOM_MESH = _UxGT("编辑客户网格"); // "Edit Custom Mesh" + LSTR MSG_UBL_FINE_TUNE_MESH = _UxGT("细调网格"); // "Fine Tuning Mesh" + LSTR MSG_UBL_DONE_EDITING_MESH = _UxGT("完成编辑网格"); // "Done Editing Mesh" + LSTR MSG_UBL_BUILD_CUSTOM_MESH = _UxGT("创设客户网格"); // "Build Custom Mesh" + LSTR MSG_UBL_BUILD_MESH_MENU = _UxGT("创设网格"); // "Build Mesh" #if HAS_PREHEAT - LSTR MSG_UBL_BUILD_MESH_M = _UxGT("创设 $ 网格"); // "Build PREHEAT_1_LABEL Mesh" - LSTR MSG_UBL_VALIDATE_MESH_M = _UxGT("批准 $ 网格"); // "Validate PREHEAT_1_LABEL Mesh" + LSTR MSG_UBL_BUILD_MESH_M = _UxGT("创设 $ 网格"); // "Build PREHEAT_1_LABEL Mesh" + LSTR MSG_UBL_VALIDATE_MESH_M = _UxGT("批准 $ 网格"); // "Validate PREHEAT_1_LABEL Mesh" #endif - LSTR MSG_UBL_BUILD_COLD_MESH = _UxGT("创设冷网格"); // "Build Cold Mesh" - LSTR MSG_UBL_MESH_HEIGHT_ADJUST = _UxGT("调整网格高度"); // "Adjust Mesh Height" - LSTR MSG_UBL_MESH_HEIGHT_AMOUNT = _UxGT("高度合计"); // "Height Amount" - LSTR MSG_UBL_VALIDATE_MESH_MENU = _UxGT("批准网格"); // "Validate Mesh" - LSTR MSG_UBL_VALIDATE_CUSTOM_MESH = _UxGT("批准客户网格"); // "Validate Custom Mesh" + LSTR MSG_UBL_BUILD_COLD_MESH = _UxGT("创设冷网格"); // "Build Cold Mesh" + LSTR MSG_UBL_MESH_HEIGHT_ADJUST = _UxGT("调整网格高度"); // "Adjust Mesh Height" + LSTR MSG_UBL_MESH_HEIGHT_AMOUNT = _UxGT("高度合计"); // "Height Amount" + LSTR MSG_UBL_VALIDATE_MESH_MENU = _UxGT("批准网格"); // "Validate Mesh" + LSTR MSG_UBL_VALIDATE_CUSTOM_MESH = _UxGT("批准客户网格"); // "Validate Custom Mesh" LSTR MSG_G26_HEATING_BED = _UxGT("G26加热热床"); LSTR MSG_G26_HEATING_NOZZLE = _UxGT("G26加热喷嘴"); LSTR MSG_G26_MANUAL_PRIME = _UxGT("手动填装中..."); @@ -158,38 +158,38 @@ namespace Language_zh_CN { LSTR MSG_G26_PRIME_DONE = _UxGT("填装完成"); LSTR MSG_G26_CANCELED = _UxGT("G26已取消"); LSTR MSG_G26_LEAVING = _UxGT("离开G26"); - LSTR MSG_UBL_CONTINUE_MESH = _UxGT("继续热床网格"); // "Continue Bed Mesh" - LSTR MSG_UBL_MESH_LEVELING = _UxGT("网格调平"); // "Mesh Leveling" - LSTR MSG_UBL_3POINT_MESH_LEVELING = _UxGT("三点调平"); // "3-Point Leveling" - LSTR MSG_UBL_GRID_MESH_LEVELING = _UxGT("格子网格调平"); // "Grid Mesh Leveling" - LSTR MSG_UBL_MESH_LEVEL = _UxGT("调平网格"); // "Level Mesh" - LSTR MSG_UBL_SIDE_POINTS = _UxGT("边点"); // "Side Points" - LSTR MSG_UBL_MAP_TYPE = _UxGT("图类型"); // "Map Type" - LSTR MSG_UBL_OUTPUT_MAP = _UxGT("输出网格图"); // "Output Mesh Map" - LSTR MSG_UBL_OUTPUT_MAP_HOST = _UxGT("输出到主机"); // "Output for Host" - LSTR MSG_UBL_OUTPUT_MAP_CSV = _UxGT("输出到CSV"); // "Output for CSV" - LSTR MSG_UBL_OUTPUT_MAP_BACKUP = _UxGT("输出到备份"); // "Off Printer Backup" - LSTR MSG_UBL_INFO_UBL = _UxGT("输出UBL信息"); // "Output UBL Info" - LSTR MSG_UBL_FILLIN_AMOUNT = _UxGT("填充合计"); // "Fill-in Amount" - 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_INVALIDATE_ALL = _UxGT("作废所有的"); // "Invalidate All" - LSTR MSG_UBL_INVALIDATE_CLOSEST = _UxGT("作废最近的"); // "Invalidate Closest" - LSTR MSG_UBL_FINE_TUNE_ALL = _UxGT("细调所有的"); // "Fine Tune All" - LSTR MSG_UBL_FINE_TUNE_CLOSEST = _UxGT("细调最近的"); // "Fine Tune Closest" - LSTR MSG_UBL_STORAGE_MESH_MENU = _UxGT("网格存储"); // "Mesh Storage" - 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_MESH_LOADED = _UxGT("网格 %i 已装载"); // "Mesh %i loaded" - LSTR MSG_MESH_SAVED = _UxGT("网格 %i 已保存"); // "Mesh %i saved" - LSTR MSG_UBL_NO_STORAGE = _UxGT("没有存储"); // "No storage" - LSTR MSG_UBL_SAVE_ERROR = _UxGT("错误: UBL保存"); // "Err: UBL Save" - LSTR MSG_UBL_RESTORE_ERROR = _UxGT("错误: UBL还原"); // "Err: UBL Restore" + LSTR MSG_UBL_CONTINUE_MESH = _UxGT("继续热床网格"); // "Continue Bed Mesh" + LSTR MSG_UBL_MESH_LEVELING = _UxGT("网格调平"); // "Mesh Leveling" + LSTR MSG_UBL_3POINT_MESH_LEVELING = _UxGT("三点调平"); // "3-Point Leveling" + LSTR MSG_UBL_GRID_MESH_LEVELING = _UxGT("格子网格调平"); // "Grid Mesh Leveling" + LSTR MSG_UBL_MESH_LEVEL = _UxGT("调平网格"); // "Level Mesh" + LSTR MSG_UBL_SIDE_POINTS = _UxGT("边点"); // "Side Points" + LSTR MSG_UBL_MAP_TYPE = _UxGT("图类型"); // "Map Type" + LSTR MSG_UBL_OUTPUT_MAP = _UxGT("输出网格图"); // "Output Mesh Map" + LSTR MSG_UBL_OUTPUT_MAP_HOST = _UxGT("输出到主机"); // "Output for Host" + LSTR MSG_UBL_OUTPUT_MAP_CSV = _UxGT("输出到CSV"); // "Output for CSV" + LSTR MSG_UBL_OUTPUT_MAP_BACKUP = _UxGT("输出到备份"); // "Off Printer Backup" + LSTR MSG_UBL_INFO_UBL = _UxGT("输出UBL信息"); // "Output UBL Info" + LSTR MSG_UBL_FILLIN_AMOUNT = _UxGT("填充合计"); // "Fill-in Amount" + 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_INVALIDATE_ALL = _UxGT("作废所有的"); // "Invalidate All" + LSTR MSG_UBL_INVALIDATE_CLOSEST = _UxGT("作废最近的"); // "Invalidate Closest" + LSTR MSG_UBL_FINE_TUNE_ALL = _UxGT("细调所有的"); // "Fine Tune All" + LSTR MSG_UBL_FINE_TUNE_CLOSEST = _UxGT("细调最近的"); // "Fine Tune Closest" + LSTR MSG_UBL_STORAGE_MESH_MENU = _UxGT("网格存储"); // "Mesh Storage" + 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_MESH_LOADED = _UxGT("网格 %i 已装载"); // "Mesh %i loaded" + LSTR MSG_MESH_SAVED = _UxGT("网格 %i 已保存"); // "Mesh %i saved" + LSTR MSG_UBL_NO_STORAGE = _UxGT("没有存储"); // "No storage" + LSTR MSG_UBL_SAVE_ERROR = _UxGT("错误: UBL保存"); // "Err: UBL Save" + LSTR MSG_UBL_RESTORE_ERROR = _UxGT("错误: UBL还原"); // "Err: UBL Restore" LSTR MSG_UBL_Z_OFFSET = _UxGT("Z偏移量: "); - LSTR MSG_UBL_Z_OFFSET_STOPPED = _UxGT("Z偏移已停止"); // "Z-Offset Stopped" - LSTR MSG_UBL_STEP_BY_STEP_MENU = _UxGT("一步步UBL"); // "Step-By-Step UBL" + LSTR MSG_UBL_Z_OFFSET_STOPPED = _UxGT("Z偏移已停止"); // "Z-Offset Stopped" + LSTR MSG_UBL_STEP_BY_STEP_MENU = _UxGT("一步步UBL"); // "Step-By-Step UBL" LSTR MSG_UBL_1_BUILD_COLD_MESH = _UxGT("1. 创设冷网格"); LSTR MSG_UBL_2_SMART_FILLIN = _UxGT("2. 聪明填充"); LSTR MSG_UBL_3_VALIDATE_MESH_MENU = _UxGT("3. 批准网格"); @@ -198,66 +198,66 @@ namespace Language_zh_CN { LSTR MSG_UBL_6_FINE_TUNE_ALL = _UxGT("6. 细调所有的"); LSTR MSG_UBL_7_SAVE_MESH = _UxGT("7. 保存热床网格"); - LSTR MSG_LED_CONTROL = _UxGT("LED控制"); // "LED Control" - LSTR MSG_LEDS = _UxGT("灯"); // "Lights" - LSTR MSG_LED_PRESETS = _UxGT("灯预置"); // "Light Presets" - LSTR MSG_SET_LEDS_RED = _UxGT("红"); // "Red" - LSTR MSG_SET_LEDS_ORANGE = _UxGT("橙"); // "Orange" - LSTR MSG_SET_LEDS_YELLOW = _UxGT("黄"); // "Yellow" - LSTR MSG_SET_LEDS_GREEN = _UxGT("绿"); // "Green" - LSTR MSG_SET_LEDS_BLUE = _UxGT("蓝"); // "Blue" - LSTR MSG_SET_LEDS_INDIGO = _UxGT("青"); // "Indigo" - LSTR MSG_SET_LEDS_VIOLET = _UxGT("紫"); // "Violet" - LSTR MSG_SET_LEDS_WHITE = _UxGT("白"); // "White" - LSTR MSG_SET_LEDS_DEFAULT = _UxGT("缺省"); // "Default" - LSTR MSG_CUSTOM_LEDS = _UxGT("定制灯"); // "Custom Lights" - LSTR MSG_INTENSITY_R = _UxGT("红饱和度"); // "Red Intensity" - LSTR MSG_INTENSITY_G = _UxGT("绿饱和度"); // "Green Intensity" - LSTR MSG_INTENSITY_B = _UxGT("蓝饱和度"); // "Blue Intensity" - LSTR MSG_INTENSITY_W = _UxGT("白饱和度"); // "White Intensity" - LSTR MSG_LED_BRIGHTNESS = _UxGT("亮度"); // "Brightness" + LSTR MSG_LED_CONTROL = _UxGT("LED控制"); // "LED Control" + LSTR MSG_LEDS = _UxGT("灯"); // "Lights" + LSTR MSG_LED_PRESETS = _UxGT("灯预置"); // "Light Presets" + LSTR MSG_SET_LEDS_RED = _UxGT("红"); // "Red" + LSTR MSG_SET_LEDS_ORANGE = _UxGT("橙"); // "Orange" + LSTR MSG_SET_LEDS_YELLOW = _UxGT("黄"); // "Yellow" + LSTR MSG_SET_LEDS_GREEN = _UxGT("绿"); // "Green" + LSTR MSG_SET_LEDS_BLUE = _UxGT("蓝"); // "Blue" + LSTR MSG_SET_LEDS_INDIGO = _UxGT("青"); // "Indigo" + LSTR MSG_SET_LEDS_VIOLET = _UxGT("紫"); // "Violet" + LSTR MSG_SET_LEDS_WHITE = _UxGT("白"); // "White" + LSTR MSG_SET_LEDS_DEFAULT = _UxGT("缺省"); // "Default" + LSTR MSG_CUSTOM_LEDS = _UxGT("定制灯"); // "Custom Lights" + LSTR MSG_INTENSITY_R = _UxGT("红饱和度"); // "Red Intensity" + LSTR MSG_INTENSITY_G = _UxGT("绿饱和度"); // "Green Intensity" + LSTR MSG_INTENSITY_B = _UxGT("蓝饱和度"); // "Blue Intensity" + LSTR MSG_INTENSITY_W = _UxGT("白饱和度"); // "White Intensity" + LSTR MSG_LED_BRIGHTNESS = _UxGT("亮度"); // "Brightness" - LSTR MSG_MOVING = _UxGT("移动..."); // "Moving..." - LSTR MSG_FREE_XY = _UxGT("释放 XY"); // "Free XY" - LSTR MSG_MOVE_X = _UxGT("移动X"); // "Move X" - LSTR MSG_MOVE_Y = _UxGT("移动Y"); // "Move Y" - LSTR MSG_MOVE_Z = _UxGT("移动Z"); // "Move Z" - LSTR MSG_MOVE_N = _UxGT("移动@"); // "Move @" - LSTR MSG_MOVE_E = _UxGT("挤出机"); // "Extruder" - LSTR MSG_MOVE_EN = _UxGT("挤出机 *"); // "Extruder" + LSTR MSG_MOVING = _UxGT("移动..."); // "Moving..." + LSTR MSG_FREE_XY = _UxGT("释放 XY"); // "Free XY" + LSTR MSG_MOVE_X = _UxGT("移动X"); // "Move X" + LSTR MSG_MOVE_Y = _UxGT("移动Y"); // "Move Y" + LSTR MSG_MOVE_Z = _UxGT("移动Z"); // "Move Z" + LSTR MSG_MOVE_N = _UxGT("移动@"); // "Move @" + LSTR MSG_MOVE_E = _UxGT("挤出机"); // "Extruder" + LSTR MSG_MOVE_EN = _UxGT("挤出机 *"); // "Extruder" LSTR MSG_HOTEND_TOO_COLD = _UxGT("热端太冷"); - 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" - LSTR MSG_MOVE_100MM = _UxGT("移动 100 mm"); // "Move 100mm" - LSTR MSG_SPEED = _UxGT("速率"); // "Speed" - LSTR MSG_MESH_Z_OFFSET = _UxGT("热床Z"); // "Bed Z" - LSTR MSG_NOZZLE = _UxGT("喷嘴"); // "Nozzle" 噴嘴 - LSTR MSG_NOZZLE_N = _UxGT("喷嘴 ~"); // "Nozzle" 噴嘴 + 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" + LSTR MSG_MOVE_100MM = _UxGT("移动 100 mm"); // "Move 100mm" + LSTR MSG_SPEED = _UxGT("速率"); // "Speed" + LSTR MSG_MESH_Z_OFFSET = _UxGT("热床Z"); // "Bed Z" + LSTR MSG_NOZZLE = _UxGT("喷嘴"); // "Nozzle" 噴嘴 + LSTR MSG_NOZZLE_N = _UxGT("喷嘴 ~"); // "Nozzle" 噴嘴 LSTR MSG_NOZZLE_PARKED = _UxGT("喷嘴已停靠"); LSTR MSG_NOZZLE_STANDBY = _UxGT("喷嘴待命中"); - LSTR MSG_BED = _UxGT("热床"); // "Bed" + LSTR MSG_BED = _UxGT("热床"); // "Bed" LSTR MSG_CHAMBER = _UxGT("机箱壳"); - LSTR MSG_FAN_SPEED = _UxGT("风扇速率"); // "Fan speed" - LSTR MSG_FAN_SPEED_N = _UxGT("风扇速率 ~"); // "Fan speed" + LSTR MSG_FAN_SPEED = _UxGT("风扇速率"); // "Fan speed" + LSTR MSG_FAN_SPEED_N = _UxGT("风扇速率 ~"); // "Fan speed" LSTR MSG_STORED_FAN_N = _UxGT("存储的风扇 ~"); - LSTR MSG_EXTRA_FAN_SPEED = _UxGT("额外风扇速率"); // "Extra fan speed" - LSTR MSG_EXTRA_FAN_SPEED_N = _UxGT("额外风扇速率 ~"); // "Extra fan speed" + LSTR MSG_EXTRA_FAN_SPEED = _UxGT("额外风扇速率"); // "Extra fan speed" + LSTR MSG_EXTRA_FAN_SPEED_N = _UxGT("额外风扇速率 ~"); // "Extra fan speed" LSTR MSG_CONTROLLER_FAN = _UxGT("控制器风扇"); LSTR MSG_CONTROLLER_FAN_IDLE_SPEED = _UxGT("空闲速度"); LSTR MSG_CONTROLLER_FAN_AUTO_ON = _UxGT("自动模式"); LSTR MSG_CONTROLLER_FAN_SPEED = _UxGT("工作速度"); LSTR MSG_CONTROLLER_FAN_DURATION = _UxGT("空闲周期"); - LSTR MSG_FLOW = _UxGT("挤出速率"); // "Flow" - LSTR MSG_FLOW_N = _UxGT("挤出速率 ~"); // "Flow" - LSTR MSG_CONTROL = _UxGT("控制"); // "Control" - LSTR MSG_MIN = " " LCD_STR_THERMOMETER _UxGT(" 最小"); // " " LCD_STR_THERMOMETER " Min" - LSTR MSG_MAX = " " LCD_STR_THERMOMETER _UxGT(" 最大"); // " " LCD_STR_THERMOMETER " Max" - LSTR MSG_FACTOR = " " LCD_STR_THERMOMETER _UxGT(" 因数"); // " " LCD_STR_THERMOMETER " Fact" - LSTR MSG_AUTOTEMP = _UxGT("自动控温"); // "Autotemp" - LSTR MSG_LCD_ON = _UxGT("开"); // "On" - LSTR MSG_LCD_OFF = _UxGT("关"); // "Off" + LSTR MSG_FLOW = _UxGT("挤出速率"); // "Flow" + LSTR MSG_FLOW_N = _UxGT("挤出速率 ~"); // "Flow" + LSTR MSG_CONTROL = _UxGT("控制"); // "Control" + LSTR MSG_MIN = " " LCD_STR_THERMOMETER _UxGT(" 最小"); // " " LCD_STR_THERMOMETER " Min" + LSTR MSG_MAX = " " LCD_STR_THERMOMETER _UxGT(" 最大"); // " " LCD_STR_THERMOMETER " Max" + LSTR MSG_FACTOR = " " LCD_STR_THERMOMETER _UxGT(" 因数"); // " " LCD_STR_THERMOMETER " Fact" + LSTR MSG_AUTOTEMP = _UxGT("自动控温"); // "Autotemp" + LSTR MSG_LCD_ON = _UxGT("开"); // "On" + LSTR MSG_LCD_OFF = _UxGT("关"); // "Off" LSTR MSG_PID_AUTOTUNE = _UxGT("自动PID"); LSTR MSG_PID_AUTOTUNE_E = _UxGT("自动PID *"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("PID调整完成"); @@ -265,58 +265,58 @@ namespace Language_zh_CN { LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("自动调失败! 温度太高"); LSTR MSG_PID_TIMEOUT = _UxGT("自动调失败! 超时"); LSTR MSG_SELECT_E = _UxGT("选择 *"); - LSTR MSG_ACC = _UxGT("加速度"); // "Accel" acceleration - LSTR MSG_JERK = _UxGT("抖动速率"); // "Jerk" - 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_VN_JERK = _UxGT("轴抖动速率@"); // "V@-jerk" - LSTR MSG_VE_JERK = _UxGT("挤出机抖动速率"); // "Ve-jerk" + LSTR MSG_ACC = _UxGT("加速度"); // "Accel" acceleration + LSTR MSG_JERK = _UxGT("抖动速率"); // "Jerk" + 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_VN_JERK = _UxGT("轴抖动速率@"); // "V@-jerk" + LSTR MSG_VE_JERK = _UxGT("挤出机抖动速率"); // "Ve-jerk" LSTR MSG_JUNCTION_DEVIATION = _UxGT("接点差"); - LSTR MSG_MAX_SPEED = _UxGT("速度"); // "Velocity" - LSTR MSG_VMAX_A = _UxGT("最大进料速率") STR_A; // "Vmax " max_feedrate_mm_s + 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_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 - LSTR MSG_ACCELERATION = _UxGT("加速度"); // "Acceleration" - LSTR MSG_AMAX_A = _UxGT("最大打印加速度") STR_A; // "Amax " max_acceleration_mm_per_s2, acceleration in units/s^2 for print moves + 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 + LSTR MSG_ACCELERATION = _UxGT("加速度"); // "Acceleration" + 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_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 + 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 LSTR MSG_XY_FREQUENCY_LIMIT = _UxGT("频率最大"); LSTR MSG_XY_FREQUENCY_FEEDRATE = _UxGT("进给速度"); - LSTR MSG_STEPS_PER_MM = _UxGT("轴步数/mm"); // "Steps/mm" axis_steps_per_mm, axis steps-per-unit G92 - LSTR MSG_A_STEPS = STR_A _UxGT(" 步数/mm"); // "Asteps/mm" + LSTR MSG_STEPS_PER_MM = _UxGT("轴步数/mm"); // "Steps/mm" axis_steps_per_mm, axis steps-per-unit G92 + 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_N_STEPS = _UxGT("@ 步数/mm"); - LSTR MSG_E_STEPS = _UxGT("E 步数/mm"); // "Esteps/mm" + LSTR MSG_E_STEPS = _UxGT("E 步数/mm"); // "Esteps/mm" LSTR MSG_EN_STEPS = _UxGT("* 步数/mm"); - LSTR MSG_TEMPERATURE = _UxGT("温度"); // "Temperature" - LSTR MSG_MOTION = _UxGT("运动"); // "Motion" - LSTR MSG_FILAMENT = _UxGT("料丝"); // "Filament" menu_advanced_filament - LSTR MSG_VOLUMETRIC_ENABLED = _UxGT("E 在 mm") SUPERSCRIPT_THREE; // "E in mm3" volumetric_enabled + LSTR MSG_TEMPERATURE = _UxGT("温度"); // "Temperature" + LSTR MSG_MOTION = _UxGT("运动"); // "Motion" + LSTR MSG_FILAMENT = _UxGT("料丝"); // "Filament" menu_advanced_filament + LSTR MSG_VOLUMETRIC_ENABLED = _UxGT("E 在 mm") SUPERSCRIPT_THREE; // "E in mm3" volumetric_enabled LSTR MSG_VOLUMETRIC_LIMIT = _UxGT("E 限制 在 mm") SUPERSCRIPT_THREE; LSTR MSG_VOLUMETRIC_LIMIT_E = _UxGT("E 限制 *"); - LSTR MSG_FILAMENT_DIAM = _UxGT("丝料直径"); // "Fil. Dia." + LSTR MSG_FILAMENT_DIAM = _UxGT("丝料直径"); // "Fil. Dia." LSTR MSG_FILAMENT_DIAM_E = _UxGT("丝料直径 *"); - LSTR MSG_FILAMENT_UNLOAD = _UxGT("卸载 mm"); // "Unload mm" - LSTR MSG_FILAMENT_LOAD = _UxGT("装载 mm"); // "Load mm" + LSTR MSG_FILAMENT_UNLOAD = _UxGT("卸载 mm"); // "Unload mm" + LSTR MSG_FILAMENT_LOAD = _UxGT("装载 mm"); // "Load mm" LSTR MSG_ADVANCE_K = _UxGT("Advance K"); LSTR MSG_ADVANCE_K_E = _UxGT("Advance K *"); - LSTR MSG_CONTRAST = _UxGT("LCD对比度"); // "LCD contrast" - LSTR MSG_STORE_EEPROM = _UxGT("保存设置"); // "Store memory" - LSTR MSG_LOAD_EEPROM = _UxGT("装载设置"); // "Load memory" - LSTR MSG_RESTORE_DEFAULTS = _UxGT("恢复安全值"); // "Restore Defaults" - LSTR MSG_INIT_EEPROM = _UxGT("初始化设置"); // "Initialize EEPROM" + LSTR MSG_CONTRAST = _UxGT("LCD对比度"); // "LCD contrast" + LSTR MSG_STORE_EEPROM = _UxGT("保存设置"); // "Store memory" + LSTR MSG_LOAD_EEPROM = _UxGT("装载设置"); // "Load memory" + LSTR MSG_RESTORE_DEFAULTS = _UxGT("恢复安全值"); // "Restore Defaults" + LSTR MSG_INIT_EEPROM = _UxGT("初始化设置"); // "Initialize EEPROM" LSTR MSG_ERR_EEPROM_CRC = _UxGT("EEPROM 校验和 错误"); LSTR MSG_ERR_EEPROM_SIZE = _UxGT("EEPROM 尺寸 错误"); LSTR MSG_ERR_EEPROM_VERSION = _UxGT("EEPROM 版本 错误"); @@ -324,9 +324,9 @@ namespace Language_zh_CN { LSTR MSG_MEDIA_UPDATE = _UxGT("存储器更新"); LSTR MSG_RESET_PRINTER = _UxGT("复位打印机"); LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("刷新"); - LSTR MSG_INFO_SCREEN = _UxGT("信息屏"); // "Info screen" - LSTR MSG_PREPARE = _UxGT("准备"); // "Prepare" - LSTR MSG_TUNE = _UxGT("调整"); // "Tune" + LSTR MSG_INFO_SCREEN = _UxGT("信息屏"); // "Info screen" + LSTR MSG_PREPARE = _UxGT("准备"); // "Prepare" + LSTR MSG_TUNE = _UxGT("调整"); // "Tune" LSTR MSG_POWER_MONITOR = _UxGT("电源监控"); LSTR MSG_CURRENT = _UxGT("电流"); LSTR MSG_VOLTAGE = _UxGT("电压"); @@ -343,33 +343,33 @@ namespace Language_zh_CN { LSTR MSG_BUTTON_BACK = _UxGT("返回"); LSTR MSG_BUTTON_PROCEED = _UxGT("继续"); LSTR MSG_PAUSING = _UxGT("暂停中..."); - LSTR MSG_PAUSE_PRINT = _UxGT("暂停打印"); // "Pause print" - LSTR MSG_RESUME_PRINT = _UxGT("恢复打印"); // "Resume print" - LSTR MSG_STOP_PRINT = _UxGT("停止打印"); // "Stop print" + LSTR MSG_PAUSE_PRINT = _UxGT("暂停打印"); // "Pause print" + LSTR MSG_RESUME_PRINT = _UxGT("恢复打印"); // "Resume print" + LSTR MSG_STOP_PRINT = _UxGT("停止打印"); // "Stop print" LSTR MSG_PRINTING_OBJECT = _UxGT("打印物体"); LSTR MSG_CANCEL_OBJECT = _UxGT("取消物体"); LSTR MSG_CANCEL_OBJECT_N = _UxGT("取消物体 {"); LSTR MSG_OUTAGE_RECOVERY = _UxGT("中断恢复"); - LSTR MSG_MEDIA_MENU = _UxGT("从存储卡上打印"); // "Print from SD" - LSTR MSG_NO_MEDIA = _UxGT("无存储卡"); // "No SD card" - LSTR MSG_DWELL = _UxGT("休眠中 ..."); // "Sleep..." - LSTR MSG_USERWAIT = _UxGT("点击继续 ..."); // "Click to resume..." - LSTR MSG_PRINT_PAUSED = _UxGT("暫停打印"); // "Print paused" + LSTR MSG_MEDIA_MENU = _UxGT("从存储卡上打印"); // "Print from SD" + LSTR MSG_NO_MEDIA = _UxGT("无存储卡"); // "No SD card" + LSTR MSG_DWELL = _UxGT("休眠中 ..."); // "Sleep..." + LSTR MSG_USERWAIT = _UxGT("点击继续 ..."); // "Click to resume..." + LSTR MSG_PRINT_PAUSED = _UxGT("暫停打印"); // "Print paused" LSTR MSG_PRINTING = _UxGT("打印中..."); - LSTR MSG_PRINT_ABORTED = _UxGT("已取消打印"); // "Print aborted" + LSTR MSG_PRINT_ABORTED = _UxGT("已取消打印"); // "Print aborted" LSTR MSG_PRINT_DONE = _UxGT("打印已完成"); - LSTR MSG_NO_MOVE = _UxGT("无移动"); // "No move." - LSTR MSG_KILLED = _UxGT("已杀掉"); // "KILLED. " - LSTR MSG_STOPPED = _UxGT("已停止"); // "STOPPED. " - LSTR MSG_CONTROL_RETRACT = _UxGT("回抽长度mm"); // "Retract mm" retract_length, retract length (positive mm) - LSTR MSG_CONTROL_RETRACT_SWAP = _UxGT("换手回抽长度mm"); // "Swap Re.mm" swap_retract_length, swap retract length (positive mm), for extruder change - LSTR MSG_CONTROL_RETRACTF = _UxGT("回抽速率mm/s"); // "Retract V" retract_feedrate_mm_s, feedrate for retracting (mm/s) - LSTR MSG_CONTROL_RETRACT_ZHOP = _UxGT("Hop mm"); // "Hop mm" retract_zraise, retract Z-lift - LSTR MSG_CONTROL_RETRACT_RECOVER = _UxGT("回抽恢复长度mm"); // "UnRet +mm" retract_recover_extra, additional recover length (mm, added to retract length when recovering) - LSTR MSG_CONTROL_RETRACT_RECOVER_SWAP = _UxGT("换手回抽恢复长度mm"); // "S UnRet+mm" swap_retract_recover_extra, additional swap recover length (mm, added to retract length when recovering from extruder change) - LSTR MSG_CONTROL_RETRACT_RECOVERF = _UxGT("回抽恢复后进料速率mm/s"); // "Unretract V" retract_recover_feedrate_mm_s, feedrate for recovering from retraction (mm/s) - LSTR MSG_CONTROL_RETRACT_RECOVER_SWAPF = _UxGT("S UnRet V"); // "S UnRet V" - LSTR MSG_AUTORETRACT = _UxGT("自动抽回"); // "Auto-Retract" autoretract_enabled, + LSTR MSG_NO_MOVE = _UxGT("无移动"); // "No move." + LSTR MSG_KILLED = _UxGT("已杀掉"); // "KILLED. " + LSTR MSG_STOPPED = _UxGT("已停止"); // "STOPPED. " + LSTR MSG_CONTROL_RETRACT = _UxGT("回抽长度mm"); // "Retract mm" retract_length, retract length (positive mm) + LSTR MSG_CONTROL_RETRACT_SWAP = _UxGT("换手回抽长度mm"); // "Swap Re.mm" swap_retract_length, swap retract length (positive mm), for extruder change + LSTR MSG_CONTROL_RETRACTF = _UxGT("回抽速率mm/s"); // "Retract V" retract_feedrate_mm_s, feedrate for retracting (mm/s) + LSTR MSG_CONTROL_RETRACT_ZHOP = _UxGT("Hop mm"); // "Hop mm" retract_zraise, retract Z-lift + LSTR MSG_CONTROL_RETRACT_RECOVER = _UxGT("回抽恢复长度mm"); // "UnRet +mm" retract_recover_extra, additional recover length (mm, added to retract length when recovering) + LSTR MSG_CONTROL_RETRACT_RECOVER_SWAP = _UxGT("换手回抽恢复长度mm"); // "S UnRet+mm" swap_retract_recover_extra, additional swap recover length (mm, added to retract length when recovering from extruder change) + LSTR MSG_CONTROL_RETRACT_RECOVERF = _UxGT("回抽恢复后进料速率mm/s"); // "Unretract V" retract_recover_feedrate_mm_s, feedrate for recovering from retraction (mm/s) + LSTR MSG_CONTROL_RETRACT_RECOVER_SWAPF = _UxGT("S UnRet V"); // "S UnRet V" + LSTR MSG_AUTORETRACT = _UxGT("自动抽回"); // "Auto-Retract" autoretract_enabled, LSTR MSG_FILAMENT_SWAP_LENGTH = _UxGT("交换长度"); LSTR MSG_FILAMENT_SWAP_EXTRA = _UxGT("额外的交换"); LSTR MSG_FILAMENT_PURGE_LENGTH = _UxGT("清洗长度"); @@ -387,19 +387,19 @@ namespace Language_zh_CN { LSTR MSG_TOOL_MIGRATION_AUTO = _UxGT("自动迁移"); LSTR MSG_TOOL_MIGRATION_END = _UxGT("上一个挤出机"); LSTR MSG_TOOL_MIGRATION_SWAP = _UxGT("迁移至 *"); - LSTR MSG_FILAMENTCHANGE = _UxGT("更换丝料"); // "Change filament" - LSTR MSG_FILAMENTCHANGE_E = _UxGT("更换丝料 *"); // "Change filament" - LSTR MSG_FILAMENTLOAD = _UxGT("装载丝料"); // "Load filament" - LSTR MSG_FILAMENTLOAD_E = _UxGT("装载丝料 *"); // "Load filament" - LSTR MSG_FILAMENTUNLOAD = _UxGT("卸载丝料"); // "Unload filament" - LSTR MSG_FILAMENTUNLOAD_E = _UxGT("卸载丝料 *"); // "Unload filament" - LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("卸载全部"); // "Unload All" - LSTR MSG_ATTACH_MEDIA = _UxGT("初始化存储卡"); // "Init. SD card" - LSTR MSG_CHANGE_MEDIA = _UxGT("更换存储卡"); // "Change SD card" + LSTR MSG_FILAMENTCHANGE = _UxGT("更换丝料"); // "Change filament" + LSTR MSG_FILAMENTCHANGE_E = _UxGT("更换丝料 *"); // "Change filament" + LSTR MSG_FILAMENTLOAD = _UxGT("装载丝料"); // "Load filament" + LSTR MSG_FILAMENTLOAD_E = _UxGT("装载丝料 *"); // "Load filament" + LSTR MSG_FILAMENTUNLOAD = _UxGT("卸载丝料"); // "Unload filament" + LSTR MSG_FILAMENTUNLOAD_E = _UxGT("卸载丝料 *"); // "Unload filament" + LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("卸载全部"); // "Unload All" + LSTR MSG_ATTACH_MEDIA = _UxGT("初始化存储卡"); // "Init. SD card" + LSTR MSG_CHANGE_MEDIA = _UxGT("更换存储卡"); // "Change SD card" LSTR MSG_RELEASE_MEDIA = _UxGT("释放存储卡"); - LSTR MSG_ZPROBE_OUT = _UxGT("Z探针在热床之外"); // "Z probe out. bed" Z probe is not within the physical limits - LSTR MSG_SKEW_FACTOR = _UxGT("偏斜因数"); // "Skew Factor" - LSTR MSG_BLTOUCH = _UxGT("BLTouch"); // "BLTouch" + LSTR MSG_ZPROBE_OUT = _UxGT("Z探针在热床之外"); // "Z probe out. bed" Z probe is not within the physical limits + LSTR MSG_SKEW_FACTOR = _UxGT("偏斜因数"); // "Skew Factor" + LSTR MSG_BLTOUCH = _UxGT("BLTouch"); // "BLTouch" LSTR MSG_BLTOUCH_SELFTEST = _UxGT("自检"); LSTR MSG_BLTOUCH_RESET = _UxGT("重置"); LSTR MSG_BLTOUCH_STOW = _UxGT("装载"); @@ -419,96 +419,96 @@ namespace Language_zh_CN { LSTR MSG_MANUAL_DEPLOY_TOUCHMI = _UxGT("部署TouchMI"); LSTR MSG_MANUAL_DEPLOY = _UxGT("部署Z探针"); LSTR MSG_MANUAL_STOW = _UxGT("收好Z探针"); - LSTR MSG_HOME_FIRST = _UxGT("归位 %s 先"); // "Home ... first" + LSTR MSG_HOME_FIRST = _UxGT("归位 %s 先"); // "Home ... first" LSTR MSG_ZPROBE_OFFSETS = _UxGT("探针偏移量"); LSTR MSG_ZPROBE_XOFFSET = _UxGT("探针X偏移"); LSTR MSG_ZPROBE_YOFFSET = _UxGT("探针Y偏移"); - LSTR MSG_ZPROBE_ZOFFSET = _UxGT("探针Z偏移"); // "Z Offset" - LSTR MSG_BABYSTEP_X = _UxGT("微量调整X轴"); // "Babystep X" lcd_babystep_x, Babystepping enables the user to control the axis in tiny amounts - LSTR MSG_BABYSTEP_Y = _UxGT("微量调整Y轴"); // "Babystep Y" - LSTR MSG_BABYSTEP_Z = _UxGT("微量调整Z轴"); // "Babystep Z" + LSTR MSG_ZPROBE_ZOFFSET = _UxGT("探针Z偏移"); // "Z Offset" + LSTR MSG_BABYSTEP_X = _UxGT("微量调整X轴"); // "Babystep X" lcd_babystep_x, Babystepping enables the user to control the axis in tiny amounts + LSTR MSG_BABYSTEP_Y = _UxGT("微量调整Y轴"); // "Babystep Y" + LSTR MSG_BABYSTEP_Z = _UxGT("微量调整Z轴"); // "Babystep Z" LSTR MSG_BABYSTEP_TOTAL = _UxGT("总计"); - LSTR MSG_ENDSTOP_ABORT = _UxGT("挡块终止"); // "Endstop abort" - LSTR MSG_HEATING_FAILED_LCD = _UxGT("加热失败"); // "Heating failed" - LSTR MSG_ERR_REDUNDANT_TEMP = _UxGT("错误:冗余温度"); // "Err: REDUNDANT TEMP" - LSTR MSG_THERMAL_RUNAWAY = _UxGT("温控失控"); // "THERMAL RUNAWAY" + LSTR MSG_ENDSTOP_ABORT = _UxGT("挡块终止"); // "Endstop abort" + LSTR MSG_HEATING_FAILED_LCD = _UxGT("加热失败"); // "Heating failed" + LSTR MSG_ERR_REDUNDANT_TEMP = _UxGT("错误:冗余温度"); // "Err: REDUNDANT TEMP" + LSTR MSG_THERMAL_RUNAWAY = _UxGT("温控失控"); // "THERMAL RUNAWAY" LSTR MSG_THERMAL_RUNAWAY_BED = _UxGT("热床热量失控"); LSTR MSG_THERMAL_RUNAWAY_CHAMBER = _UxGT("机箱热量失控"); - LSTR MSG_ERR_MAXTEMP = _UxGT("错误:最高温度"); // "Err: MAXTEMP" - LSTR MSG_ERR_MINTEMP = _UxGT("错误:最低温度"); // "Err: MINTEMP" - LSTR MSG_HALTED = _UxGT("打印停机"); // "PRINTER HALTED" - LSTR MSG_PLEASE_RESET = _UxGT("请重置"); // "Please reset" - LSTR MSG_HEATING = _UxGT("加热中 ..."); // "Heating..." + LSTR MSG_ERR_MAXTEMP = _UxGT("错误:最高温度"); // "Err: MAXTEMP" + LSTR MSG_ERR_MINTEMP = _UxGT("错误:最低温度"); // "Err: MINTEMP" + LSTR MSG_HALTED = _UxGT("打印停机"); // "PRINTER HALTED" + LSTR MSG_PLEASE_RESET = _UxGT("请重置"); // "Please reset" + LSTR MSG_HEATING = _UxGT("加热中 ..."); // "Heating..." LSTR MSG_COOLING = _UxGT("冷却中 ..."); - LSTR MSG_BED_HEATING = _UxGT("加热热床中 ..."); // "Bed Heating..." + LSTR MSG_BED_HEATING = _UxGT("加热热床中 ..."); // "Bed Heating..." LSTR MSG_BED_COOLING = _UxGT("热床冷却中 ..."); LSTR MSG_CHAMBER_HEATING = _UxGT("机箱加热中 ..."); LSTR MSG_CHAMBER_COOLING = _UxGT("机箱冷却中 ..."); - LSTR MSG_DELTA_CALIBRATE = _UxGT("⊿校准"); // "Delta Calibration" - LSTR MSG_DELTA_CALIBRATE_X = _UxGT("⊿校准X"); // "Calibrate X" - LSTR MSG_DELTA_CALIBRATE_Y = _UxGT("⊿校准Y"); // "Calibrate Y" - LSTR MSG_DELTA_CALIBRATE_Z = _UxGT("⊿校准Z"); // "Calibrate Z" - 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_DIAG_ROD = _UxGT("⊿斜柱"); // "Diag Rod" - LSTR MSG_DELTA_HEIGHT = _UxGT("⊿高度"); // "Height" - LSTR MSG_DELTA_RADIUS = _UxGT("⊿半径"); // "Radius" - LSTR MSG_INFO_MENU = _UxGT("关于打印机"); // "About Printer" - LSTR MSG_INFO_PRINTER_MENU = _UxGT("打印机信息"); // "Printer Info" - LSTR MSG_3POINT_LEVELING = _UxGT("三点调平"); // "3-Point Leveling" - LSTR MSG_LINEAR_LEVELING = _UxGT("线性调平"); // "Linear Leveling" - LSTR MSG_BILINEAR_LEVELING = _UxGT("双线性调平"); // "Bilinear Leveling" - LSTR MSG_UBL_LEVELING = _UxGT("统一热床调平(UBL)"); // "Unified Bed Leveling" - LSTR MSG_MESH_LEVELING = _UxGT("网格调平"); // "Mesh Leveling" - LSTR MSG_INFO_STATS_MENU = _UxGT("打印机统计"); // "Printer Stats" - LSTR MSG_INFO_BOARD_MENU = _UxGT("主板信息"); // "Board Info" - LSTR MSG_INFO_THERMISTOR_MENU = _UxGT("温度计"); // "Thermistors" - LSTR MSG_INFO_EXTRUDERS = _UxGT("挤出机"); // "Extruders" - LSTR MSG_INFO_BAUDRATE = _UxGT("波特率"); // "Baud" - LSTR MSG_INFO_PROTOCOL = _UxGT("协议"); // "Protocol" + LSTR MSG_DELTA_CALIBRATE = _UxGT("⊿校准"); // "Delta Calibration" + LSTR MSG_DELTA_CALIBRATE_X = _UxGT("⊿校准X"); // "Calibrate X" + LSTR MSG_DELTA_CALIBRATE_Y = _UxGT("⊿校准Y"); // "Calibrate Y" + LSTR MSG_DELTA_CALIBRATE_Z = _UxGT("⊿校准Z"); // "Calibrate Z" + 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_DIAG_ROD = _UxGT("⊿斜柱"); // "Diag Rod" + LSTR MSG_DELTA_HEIGHT = _UxGT("⊿高度"); // "Height" + LSTR MSG_DELTA_RADIUS = _UxGT("⊿半径"); // "Radius" + LSTR MSG_INFO_MENU = _UxGT("关于打印机"); // "About Printer" + LSTR MSG_INFO_PRINTER_MENU = _UxGT("打印机信息"); // "Printer Info" + LSTR MSG_3POINT_LEVELING = _UxGT("三点调平"); // "3-Point Leveling" + LSTR MSG_LINEAR_LEVELING = _UxGT("线性调平"); // "Linear Leveling" + LSTR MSG_BILINEAR_LEVELING = _UxGT("双线性调平"); // "Bilinear Leveling" + LSTR MSG_UBL_LEVELING = _UxGT("统一热床调平(UBL)"); // "Unified Bed Leveling" + LSTR MSG_MESH_LEVELING = _UxGT("网格调平"); // "Mesh Leveling" + LSTR MSG_INFO_STATS_MENU = _UxGT("打印机统计"); // "Printer Stats" + LSTR MSG_INFO_BOARD_MENU = _UxGT("主板信息"); // "Board Info" + LSTR MSG_INFO_THERMISTOR_MENU = _UxGT("温度计"); // "Thermistors" + LSTR MSG_INFO_EXTRUDERS = _UxGT("挤出机"); // "Extruders" + LSTR MSG_INFO_BAUDRATE = _UxGT("波特率"); // "Baud" + LSTR MSG_INFO_PROTOCOL = _UxGT("协议"); // "Protocol" LSTR MSG_INFO_RUNAWAY_OFF = _UxGT("监控温度失控:关"); LSTR MSG_INFO_RUNAWAY_ON = _UxGT("监控温度失控:开"); LSTR MSG_HOTEND_IDLE_TIMEOUT = _UxGT("热端空闲超时"); - LSTR MSG_CASE_LIGHT = _UxGT("外壳灯"); // "Case light" - LSTR MSG_CASE_LIGHT_BRIGHTNESS = _UxGT("灯亮度"); // "Light BRIGHTNESS" + LSTR MSG_CASE_LIGHT = _UxGT("外壳灯"); // "Case light" + LSTR MSG_CASE_LIGHT_BRIGHTNESS = _UxGT("灯亮度"); // "Light BRIGHTNESS" - LSTR MSG_KILL_EXPECTED_PRINTER = _UxGT("打印机不正确"); // "The printer is incorrect" + LSTR MSG_KILL_EXPECTED_PRINTER = _UxGT("打印机不正确"); // "The printer is incorrect" #if LCD_WIDTH >= 20 || HAS_DWIN_E3V2 - LSTR MSG_INFO_PRINT_COUNT = _UxGT("打印计数"); // "Print Count" - LSTR MSG_INFO_COMPLETED_PRINTS = _UxGT("完成了"); // "Completed" - LSTR MSG_INFO_PRINT_TIME = _UxGT("总打印时间"); // "Total print time" - LSTR MSG_INFO_PRINT_LONGEST = _UxGT("最长工作时间"); // "Longest job time" - LSTR MSG_INFO_PRINT_FILAMENT = _UxGT("总计挤出"); // "Extruded total" + LSTR MSG_INFO_PRINT_COUNT = _UxGT("打印计数"); // "Print Count" + LSTR MSG_INFO_COMPLETED_PRINTS = _UxGT("完成了"); // "Completed" + LSTR MSG_INFO_PRINT_TIME = _UxGT("总打印时间"); // "Total print time" + LSTR MSG_INFO_PRINT_LONGEST = _UxGT("最长工作时间"); // "Longest job time" + LSTR MSG_INFO_PRINT_FILAMENT = _UxGT("总计挤出"); // "Extruded total" #else - LSTR MSG_INFO_PRINT_COUNT = _UxGT("打印数"); // "Prints" - LSTR MSG_INFO_COMPLETED_PRINTS = _UxGT("完成"); // "Completed" - LSTR MSG_INFO_PRINT_TIME = _UxGT("总共"); // "Total" - LSTR MSG_INFO_PRINT_LONGEST = _UxGT("最长"); // "Longest" - LSTR MSG_INFO_PRINT_FILAMENT = _UxGT("已挤出"); // "Extruded" + LSTR MSG_INFO_PRINT_COUNT = _UxGT("打印数"); // "Prints" + LSTR MSG_INFO_COMPLETED_PRINTS = _UxGT("完成"); // "Completed" + LSTR MSG_INFO_PRINT_TIME = _UxGT("总共"); // "Total" + LSTR MSG_INFO_PRINT_LONGEST = _UxGT("最长"); // "Longest" + LSTR MSG_INFO_PRINT_FILAMENT = _UxGT("已挤出"); // "Extruded" #endif - LSTR MSG_INFO_MIN_TEMP = _UxGT("最低温度"); // "Min Temp" - 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_N = _UxGT("@ 驱动 %"); // "E Driver %" + LSTR MSG_INFO_MIN_TEMP = _UxGT("最低温度"); // "Min Temp" + 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_N = _UxGT("@ 驱动 %"); // "E Driver %" LSTR MSG_ERROR_TMC = _UxGT("TMC 连接错误"); - LSTR MSG_DAC_EEPROM_WRITE = _UxGT("保存驱动设置"); // "DAC EEPROM Write" + LSTR MSG_DAC_EEPROM_WRITE = _UxGT("保存驱动设置"); // "DAC EEPROM Write" LSTR MSG_FILAMENT_CHANGE_HEADER = _UxGT("更换料"); - LSTR MSG_FILAMENT_CHANGE_HEADER_PAUSE = _UxGT("打印已暂停"); // "PRINT PAUSED" - LSTR MSG_FILAMENT_CHANGE_HEADER_LOAD = _UxGT("装载丝料"); // "LOAD FILAMENT" - LSTR MSG_FILAMENT_CHANGE_HEADER_UNLOAD = _UxGT("卸载丝料"); // "UNLOAD FILAMENT" - 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("恢复打印"); // "Resume print" - LSTR MSG_FILAMENT_CHANGE_NOZZLE = _UxGT(" 喷嘴: "); // " Nozzle: " + LSTR MSG_FILAMENT_CHANGE_HEADER_PAUSE = _UxGT("打印已暂停"); // "PRINT PAUSED" + LSTR MSG_FILAMENT_CHANGE_HEADER_LOAD = _UxGT("装载丝料"); // "LOAD FILAMENT" + LSTR MSG_FILAMENT_CHANGE_HEADER_UNLOAD = _UxGT("卸载丝料"); // "UNLOAD FILAMENT" + 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("恢复打印"); // "Resume print" + LSTR MSG_FILAMENT_CHANGE_NOZZLE = _UxGT(" 喷嘴: "); // " Nozzle: " LSTR MSG_RUNOUT_SENSOR = _UxGT("断料传感器"); LSTR MSG_RUNOUT_DISTANCE_MM = _UxGT("断料距离mm"); - LSTR MSG_KILL_HOMING_FAILED = _UxGT("归原位失败"); // "Homing failed" - LSTR MSG_LCD_PROBING_FAILED = _UxGT("探针探测失败"); // "Probing failed" + LSTR MSG_KILL_HOMING_FAILED = _UxGT("归原位失败"); // "Homing failed" + LSTR MSG_LCD_PROBING_FAILED = _UxGT("探针探测失败"); // "Probing failed" LSTR MSG_MMU2_CHOOSE_FILAMENT_HEADER = _UxGT("选择料"); LSTR MSG_MMU2_MENU = _UxGT("MMU"); @@ -566,27 +566,27 @@ namespace Language_zh_CN { #if LCD_HEIGHT >= 4 LSTR MSG_ADVANCED_PAUSE_WAITING = _UxGT(MSG_2_LINE("按下按钮", "恢复打印")); LSTR MSG_PAUSE_PRINT_PARKING = _UxGT(MSG_1_LINE("停靠中...")); - LSTR MSG_FILAMENT_CHANGE_INIT = _UxGT(MSG_3_LINE("等待开始", "丝料", "变更")); // "Wait for start of the filament change" + LSTR MSG_FILAMENT_CHANGE_INIT = _UxGT(MSG_3_LINE("等待开始", "丝料", "变更")); // "Wait for start of the filament change" LSTR MSG_FILAMENT_CHANGE_INSERT = _UxGT(MSG_3_LINE("插入料", "并按下", "以继续")); - LSTR MSG_FILAMENT_CHANGE_HEAT = _UxGT(MSG_2_LINE("按下按钮来", "加热喷嘴.")); // "Press button to heat nozzle." - LSTR MSG_FILAMENT_CHANGE_HEATING = _UxGT(MSG_2_LINE("加热喷嘴", "请等待 ...")); // "Heating nozzle Please wait..." - LSTR MSG_FILAMENT_CHANGE_UNLOAD = _UxGT(MSG_2_LINE("等待", "卸下丝料")); // "Wait for filament unload" - LSTR MSG_FILAMENT_CHANGE_LOAD = _UxGT(MSG_2_LINE("等待", "进料")); // "Wait for filament load" - LSTR MSG_FILAMENT_CHANGE_PURGE = _UxGT(MSG_2_LINE("等待", "丝料清除")); // "Wait for filament purge" + LSTR MSG_FILAMENT_CHANGE_HEAT = _UxGT(MSG_2_LINE("按下按钮来", "加热喷嘴.")); // "Press button to heat nozzle." + LSTR MSG_FILAMENT_CHANGE_HEATING = _UxGT(MSG_2_LINE("加热喷嘴", "请等待 ...")); // "Heating nozzle Please wait..." + LSTR MSG_FILAMENT_CHANGE_UNLOAD = _UxGT(MSG_2_LINE("等待", "卸下丝料")); // "Wait for filament unload" + LSTR MSG_FILAMENT_CHANGE_LOAD = _UxGT(MSG_2_LINE("等待", "进料")); // "Wait for filament load" + LSTR MSG_FILAMENT_CHANGE_PURGE = _UxGT(MSG_2_LINE("等待", "丝料清除")); // "Wait for filament purge" LSTR MSG_FILAMENT_CHANGE_CONT_PURGE = _UxGT(MSG_2_LINE("按下已完成", "料的清洗")); - LSTR MSG_FILAMENT_CHANGE_RESUME = _UxGT(MSG_2_LINE("等待打印", "恢复")); // "Wait for print to resume" + LSTR MSG_FILAMENT_CHANGE_RESUME = _UxGT(MSG_2_LINE("等待打印", "恢复")); // "Wait for print to resume" #else LSTR MSG_ADVANCED_PAUSE_WAITING = _UxGT(MSG_1_LINE("按下继续")); LSTR MSG_PAUSE_PRINT_PARKING = _UxGT(MSG_1_LINE("停靠中...")); - LSTR MSG_FILAMENT_CHANGE_INIT = _UxGT(MSG_1_LINE("请等待 ...")); // "Please wait..." - LSTR MSG_FILAMENT_CHANGE_INSERT = _UxGT(MSG_1_LINE("插入并单击")); // "Insert and Click" + LSTR MSG_FILAMENT_CHANGE_INIT = _UxGT(MSG_1_LINE("请等待 ...")); // "Please wait..." + LSTR MSG_FILAMENT_CHANGE_INSERT = _UxGT(MSG_1_LINE("插入并单击")); // "Insert and Click" LSTR MSG_FILAMENT_CHANGE_HEAT = _UxGT(MSG_1_LINE("按下加热")); - LSTR MSG_FILAMENT_CHANGE_HEATING = _UxGT(MSG_1_LINE("加热中 ...")); // "Heating..." - LSTR MSG_FILAMENT_CHANGE_UNLOAD = _UxGT(MSG_1_LINE("退出中 ...")); // "Ejecting..." - LSTR MSG_FILAMENT_CHANGE_LOAD = _UxGT(MSG_1_LINE("装载中 ...")); // "Loading..." - LSTR MSG_FILAMENT_CHANGE_PURGE = _UxGT(MSG_1_LINE("清除中 ...")); // "Purging..." + LSTR MSG_FILAMENT_CHANGE_HEATING = _UxGT(MSG_1_LINE("加热中 ...")); // "Heating..." + LSTR MSG_FILAMENT_CHANGE_UNLOAD = _UxGT(MSG_1_LINE("退出中 ...")); // "Ejecting..." + LSTR MSG_FILAMENT_CHANGE_LOAD = _UxGT(MSG_1_LINE("装载中 ...")); // "Loading..." + LSTR MSG_FILAMENT_CHANGE_PURGE = _UxGT(MSG_1_LINE("清除中 ...")); // "Purging..." LSTR MSG_FILAMENT_CHANGE_CONT_PURGE = _UxGT(MSG_1_LINE("按下完成")); - LSTR MSG_FILAMENT_CHANGE_RESUME = _UxGT(MSG_1_LINE("恢复中 ...")); // "Resuming..." + LSTR MSG_FILAMENT_CHANGE_RESUME = _UxGT(MSG_1_LINE("恢复中 ...")); // "Resuming..." #endif LSTR MSG_TMC_DRIVERS = _UxGT("TMC驱动器"); LSTR MSG_TMC_CURRENT = _UxGT("驱动电流"); @@ -606,7 +606,7 @@ namespace Language_zh_CN { LSTR MSG_REHEAT = _UxGT("重新加热"); LSTR MSG_REHEATING = _UxGT("重新加热中..."); - LSTR MSG_SHORT_DAY = _UxGT("天"); // "d" // One character only - LSTR MSG_SHORT_HOUR = _UxGT("时"); // "h" // One character only - LSTR MSG_SHORT_MINUTE = _UxGT("分"); // "m" // One character only + LSTR MSG_SHORT_DAY = _UxGT("天"); // "d" // One character only + LSTR MSG_SHORT_HOUR = _UxGT("时"); // "h" // One character only + LSTR MSG_SHORT_MINUTE = _UxGT("分"); // "m" // One character only } diff --git a/Marlin/src/lcd/language/language_zh_TW.h b/Marlin/src/lcd/language/language_zh_TW.h index 9365225cae85f..968ad4424e196 100644 --- a/Marlin/src/lcd/language/language_zh_TW.h +++ b/Marlin/src/lcd/language/language_zh_TW.h @@ -28,87 +28,87 @@ * See also https://marlinfw.org/docs/development/lcd_language.html */ namespace Language_zh_TW { - using namespace Language_en; // Inherit undefined strings from English + using namespace Language_en; // Inherit undefined strings from English constexpr uint8_t CHARSIZE = 3; LSTR LANGUAGE = _UxGT("Traditional Chinese"); - LSTR WELCOME_MSG = MACHINE_NAME _UxGT("已就緒."); // " ready." - LSTR MSG_YES = _UxGT("是"); // "YES" - LSTR MSG_NO = _UxGT("否"); // "NO" - LSTR MSG_BACK = _UxGT("返回"); // "Back" - LSTR MSG_MEDIA_ABORTING = _UxGT("正在中止..."); // "Aborting..." - LSTR MSG_MEDIA_INSERTED = _UxGT("記憶卡已插入"); // "Card inserted" - LSTR MSG_MEDIA_REMOVED = _UxGT("記憶卡被拔出"); // "Card removed" - LSTR MSG_MEDIA_WAITING = _UxGT("等待記憶卡"); // "Waiting for media" + LSTR WELCOME_MSG = MACHINE_NAME _UxGT("已就緒."); // " ready." + LSTR MSG_YES = _UxGT("是"); // "YES" + LSTR MSG_NO = _UxGT("否"); // "NO" + LSTR MSG_BACK = _UxGT("返回"); // "Back" + LSTR MSG_MEDIA_ABORTING = _UxGT("正在中止..."); // "Aborting..." + LSTR MSG_MEDIA_INSERTED = _UxGT("記憶卡已插入"); // "Card inserted" + LSTR MSG_MEDIA_REMOVED = _UxGT("記憶卡被拔出"); // "Card removed" + LSTR MSG_MEDIA_WAITING = _UxGT("等待記憶卡"); // "Waiting for media" LSTR MSG_MEDIA_READ_ERROR = _UxGT("記憶卡讀取錯誤"); //"Media read error" - LSTR MSG_MEDIA_USB_REMOVED = _UxGT("USB裝置已移除"); // "USB device removed" - LSTR MSG_MEDIA_USB_FAILED = _UxGT("USB啟動失敗"); // "USB start failed" - LSTR MSG_LCD_ENDSTOPS = _UxGT("擋塊"); // "Endstops" // Max length 8 characters - LSTR MSG_LCD_SOFT_ENDSTOPS = _UxGT("軟體擋塊"); // "Soft Endstops" - LSTR MSG_MAIN_MENU = _UxGT("主選單"); // "Main" - LSTR MSG_ADVANCED_SETTINGS = _UxGT("進階設置"); // "Advanced Settings" - LSTR MSG_CONFIGURATION = _UxGT("設置"); //Configuration - LSTR MSG_RUN_AUTO_FILES = _UxGT("自動開始"); // "Autostart" - LSTR MSG_DISABLE_STEPPERS = _UxGT("關閉步進馬達"); // "Disable steppers" - LSTR MSG_DEBUG_MENU = _UxGT("除錯選單"); // "Debug Menu" - LSTR MSG_PROGRESS_BAR_TEST = _UxGT("進度條測試"); // "Progress Bar Test" - LSTR MSG_AUTO_HOME = _UxGT("自動回原點"); // "Auto home" - LSTR MSG_AUTO_HOME_X = _UxGT("回X原點"); // "Home X" - LSTR MSG_AUTO_HOME_Y = _UxGT("回Y原點"); // "Home Y" - LSTR MSG_AUTO_HOME_Z = _UxGT("回Z原點"); // "Home Z" - LSTR MSG_AUTO_Z_ALIGN = _UxGT("自動Z對齊"); // "Auto Z-Align" - LSTR MSG_LEVEL_BED_HOMING = _UxGT("平台調平XYZ歸原點"); // "Homing XYZ" - LSTR MSG_LEVEL_BED_WAITING = _UxGT("單擊開始熱床調平"); // "Click to Begin" - LSTR MSG_LEVEL_BED_NEXT_POINT = _UxGT("下個熱床調平點"); // "Next Point" - LSTR MSG_LEVEL_BED_DONE = _UxGT("完成熱床調平"); // "Leveling Done!" - 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_MEDIA_USB_REMOVED = _UxGT("USB裝置已移除"); // "USB device removed" + LSTR MSG_MEDIA_USB_FAILED = _UxGT("USB啟動失敗"); // "USB start failed" + LSTR MSG_LCD_ENDSTOPS = _UxGT("擋塊"); // "Endstops" // Max length 8 characters + LSTR MSG_LCD_SOFT_ENDSTOPS = _UxGT("軟體擋塊"); // "Soft Endstops" + LSTR MSG_MAIN_MENU = _UxGT("主選單"); // "Main" + LSTR MSG_ADVANCED_SETTINGS = _UxGT("進階設置"); // "Advanced Settings" + LSTR MSG_CONFIGURATION = _UxGT("設置"); //Configuration + LSTR MSG_RUN_AUTO_FILES = _UxGT("自動開始"); // "Autostart" + LSTR MSG_DISABLE_STEPPERS = _UxGT("關閉步進馬達"); // "Disable steppers" + LSTR MSG_DEBUG_MENU = _UxGT("除錯選單"); // "Debug Menu" + LSTR MSG_PROGRESS_BAR_TEST = _UxGT("進度條測試"); // "Progress Bar Test" + LSTR MSG_AUTO_HOME = _UxGT("自動回原點"); // "Auto home" + LSTR MSG_AUTO_HOME_X = _UxGT("回X原點"); // "Home X" + LSTR MSG_AUTO_HOME_Y = _UxGT("回Y原點"); // "Home Y" + LSTR MSG_AUTO_HOME_Z = _UxGT("回Z原點"); // "Home Z" + LSTR MSG_AUTO_Z_ALIGN = _UxGT("自動Z對齊"); // "Auto Z-Align" + LSTR MSG_LEVEL_BED_HOMING = _UxGT("平台調平XYZ歸原點"); // "Homing XYZ" + LSTR MSG_LEVEL_BED_WAITING = _UxGT("單擊開始熱床調平"); // "Click to Begin" + LSTR MSG_LEVEL_BED_NEXT_POINT = _UxGT("下個熱床調平點"); // "Next Point" + LSTR MSG_LEVEL_BED_DONE = _UxGT("完成熱床調平"); // "Leveling Done!" + 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" #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" - LSTR MSG_PREHEAT_1_END = _UxGT("預熱 ") PREHEAT_1_LABEL _UxGT(" 噴嘴"); //MSG_PREHEAT_1 " " - LSTR MSG_PREHEAT_1_END_E = _UxGT("預熱 ") PREHEAT_1_LABEL _UxGT(" 噴嘴 ~"); //MSG_PREHEAT_1 " " - LSTR MSG_PREHEAT_1_ALL = _UxGT("預熱 ") PREHEAT_1_LABEL _UxGT(" 全部"); //MSG_PREHEAT_1 " All" - LSTR MSG_PREHEAT_1_BEDONLY = _UxGT("預熱 ") PREHEAT_1_LABEL _UxGT(" 熱床"); //MSG_PREHEAT_1 " Bed" - LSTR MSG_PREHEAT_1_SETTINGS = _UxGT("預熱 ") PREHEAT_1_LABEL _UxGT(" 設置"); //MSG_PREHEAT_1 " conf" + 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" + LSTR MSG_PREHEAT_1_END = _UxGT("預熱 ") PREHEAT_1_LABEL _UxGT(" 噴嘴"); //MSG_PREHEAT_1 " " + LSTR MSG_PREHEAT_1_END_E = _UxGT("預熱 ") PREHEAT_1_LABEL _UxGT(" 噴嘴 ~"); //MSG_PREHEAT_1 " " + LSTR MSG_PREHEAT_1_ALL = _UxGT("預熱 ") PREHEAT_1_LABEL _UxGT(" 全部"); //MSG_PREHEAT_1 " All" + LSTR MSG_PREHEAT_1_BEDONLY = _UxGT("預熱 ") PREHEAT_1_LABEL _UxGT(" 熱床"); //MSG_PREHEAT_1 " Bed" + LSTR MSG_PREHEAT_1_SETTINGS = _UxGT("預熱 ") PREHEAT_1_LABEL _UxGT(" 設置"); //MSG_PREHEAT_1 " conf" - LSTR MSG_PREHEAT_M = _UxGT("預熱 $"); // "Preheat PREHEAT_1_LABEL" - LSTR MSG_PREHEAT_M_H = _UxGT("預熱 $ ~"); // "Preheat PREHEAT_1_LABEL" - LSTR MSG_PREHEAT_M_END = _UxGT("預熱 $ 噴嘴"); //MSG_PREHEAT_1 " " - LSTR MSG_PREHEAT_M_END_E = _UxGT("預熱 $ 噴嘴 ~"); //MSG_PREHEAT_1 " " - LSTR MSG_PREHEAT_M_ALL = _UxGT("預熱 $ 全部"); //MSG_PREHEAT_1 " All" - LSTR MSG_PREHEAT_M_BEDONLY = _UxGT("預熱 $ 熱床"); //MSG_PREHEAT_1 " Bed" - LSTR MSG_PREHEAT_M_SETTINGS = _UxGT("預熱 $ 設置"); //MSG_PREHEAT_1 " conf" + LSTR MSG_PREHEAT_M = _UxGT("預熱 $"); // "Preheat PREHEAT_1_LABEL" + LSTR MSG_PREHEAT_M_H = _UxGT("預熱 $ ~"); // "Preheat PREHEAT_1_LABEL" + LSTR MSG_PREHEAT_M_END = _UxGT("預熱 $ 噴嘴"); //MSG_PREHEAT_1 " " + LSTR MSG_PREHEAT_M_END_E = _UxGT("預熱 $ 噴嘴 ~"); //MSG_PREHEAT_1 " " + LSTR MSG_PREHEAT_M_ALL = _UxGT("預熱 $ 全部"); //MSG_PREHEAT_1 " All" + LSTR MSG_PREHEAT_M_BEDONLY = _UxGT("預熱 $ 熱床"); //MSG_PREHEAT_1 " Bed" + LSTR MSG_PREHEAT_M_SETTINGS = _UxGT("預熱 $ 設置"); //MSG_PREHEAT_1 " conf" #endif - LSTR MSG_PREHEAT_CUSTOM = _UxGT("自定預熱"); // "Preheat Custom" - LSTR MSG_COOLDOWN = _UxGT("降溫"); // "Cooldown" - LSTR MSG_LASER_MENU = _UxGT("激光控制"); // "Laser Control" - LSTR MSG_LASER_POWER = _UxGT("激光電源"); // "Laser Power" - LSTR MSG_SPINDLE_MENU = _UxGT("主軸控告制"); // "Spindle Control" - LSTR MSG_SPINDLE_POWER = _UxGT("主軸電源"); // "Spindle Power" - LSTR MSG_SPINDLE_REVERSE = _UxGT("主軸反轉"); // "Spindle Reverse" - LSTR MSG_SWITCH_PS_ON = _UxGT("電源打開"); // "Switch power on" - LSTR MSG_SWITCH_PS_OFF = _UxGT("電源關閉"); // "Switch power off" - LSTR MSG_EXTRUDE = _UxGT("擠出"); // "Extrude" - LSTR MSG_RETRACT = _UxGT("回縮"); // "Retract" - LSTR MSG_MOVE_AXIS = _UxGT("移動軸"); // "Move axis" - LSTR MSG_BED_LEVELING = _UxGT("調平熱床"); // "Bed leveling" - LSTR MSG_LEVEL_BED = _UxGT("調平熱床"); // "Level bed" - LSTR MSG_BED_TRAMMING = _UxGT("調平邊角"); // "Bed Tramming" - LSTR MSG_NEXT_CORNER = _UxGT("下個邊角"); // "Next corner" - LSTR MSG_MESH_EDITOR = _UxGT("網格編輯器"); // "Mesh Editor" - LSTR MSG_EDIT_MESH = _UxGT("編輯網格"); // "Edit Mesh" - LSTR MSG_EDITING_STOPPED = _UxGT("網格編輯已停止"); // "Mesh Editing Stopped" - LSTR MSG_PROBING_POINT = _UxGT("探測點"); // "Probing Point" - LSTR MSG_MESH_X = _UxGT("索引 X"); // "Index X" - LSTR MSG_MESH_Y = _UxGT("索引 Y"); // "Index Y" - LSTR MSG_MESH_EDIT_Z = _UxGT("Z 值"); // "Z Value" - LSTR MSG_CUSTOM_COMMANDS = _UxGT("自定命令"); // "Custom Commands" - LSTR MSG_M48_TEST = _UxGT("M48 探測測試"); // "M48 Probe Test" - LSTR MSG_M48_POINT = _UxGT("M48 探測點"); // "M48 Point" - LSTR MSG_M48_DEVIATION = _UxGT("偏差"); // "Deviation" + LSTR MSG_PREHEAT_CUSTOM = _UxGT("自定預熱"); // "Preheat Custom" + LSTR MSG_COOLDOWN = _UxGT("降溫"); // "Cooldown" + LSTR MSG_LASER_MENU = _UxGT("激光控制"); // "Laser Control" + LSTR MSG_LASER_POWER = _UxGT("激光電源"); // "Laser Power" + LSTR MSG_SPINDLE_MENU = _UxGT("主軸控告制"); // "Spindle Control" + LSTR MSG_SPINDLE_POWER = _UxGT("主軸電源"); // "Spindle Power" + LSTR MSG_SPINDLE_REVERSE = _UxGT("主軸反轉"); // "Spindle Reverse" + LSTR MSG_SWITCH_PS_ON = _UxGT("電源打開"); // "Switch power on" + LSTR MSG_SWITCH_PS_OFF = _UxGT("電源關閉"); // "Switch power off" + LSTR MSG_EXTRUDE = _UxGT("擠出"); // "Extrude" + LSTR MSG_RETRACT = _UxGT("回縮"); // "Retract" + LSTR MSG_MOVE_AXIS = _UxGT("移動軸"); // "Move axis" + LSTR MSG_BED_LEVELING = _UxGT("調平熱床"); // "Bed leveling" + LSTR MSG_LEVEL_BED = _UxGT("調平熱床"); // "Level bed" + LSTR MSG_BED_TRAMMING = _UxGT("調平邊角"); // "Bed Tramming" + LSTR MSG_NEXT_CORNER = _UxGT("下個邊角"); // "Next corner" + LSTR MSG_MESH_EDITOR = _UxGT("網格編輯器"); // "Mesh Editor" + LSTR MSG_EDIT_MESH = _UxGT("編輯網格"); // "Edit Mesh" + LSTR MSG_EDITING_STOPPED = _UxGT("網格編輯已停止"); // "Mesh Editing Stopped" + LSTR MSG_PROBING_POINT = _UxGT("探測點"); // "Probing Point" + LSTR MSG_MESH_X = _UxGT("索引 X"); // "Index X" + LSTR MSG_MESH_Y = _UxGT("索引 Y"); // "Index Y" + LSTR MSG_MESH_EDIT_Z = _UxGT("Z 值"); // "Z Value" + LSTR MSG_CUSTOM_COMMANDS = _UxGT("自定命令"); // "Custom Commands" + LSTR MSG_M48_TEST = _UxGT("M48 探測測試"); // "M48 Probe Test" + LSTR MSG_M48_POINT = _UxGT("M48 探測點"); // "M48 Point" + LSTR MSG_M48_DEVIATION = _UxGT("偏差"); // "Deviation" LSTR MSG_IDEX_MENU = _UxGT("IDEX Mode"); LSTR MSG_OFFSETS_MENU = _UxGT("Tool Offsets"); LSTR MSG_IDEX_MODE_AUTOPARK = _UxGT("Auto-Park"); @@ -117,75 +117,75 @@ namespace Language_zh_TW { LSTR MSG_IDEX_MODE_FULL_CTRL = _UxGT("Full Control"); LSTR MSG_HOTEND_OFFSET_Z = _UxGT("2nd Nozzle Z"); LSTR MSG_HOTEND_OFFSET_A = _UxGT("2nd Nozzle @"); - LSTR MSG_UBL_DOING_G29 = _UxGT("執行G29"); // "Doing G29" - LSTR MSG_UBL_TOOLS = _UxGT("UBL工具"); // "UBL Tools" - LSTR MSG_UBL_LEVEL_BED = _UxGT("統一熱床調平(UBL)"); // "Unified Bed Leveling" - LSTR MSG_LCD_TILTING_MESH = _UxGT("傾斜點"); // "Tilting Point" - LSTR MSG_UBL_MANUAL_MESH = _UxGT("手工建網"); // "Manually Build Mesh" - LSTR MSG_UBL_BC_INSERT = _UxGT("放置墊片並測量"); // "Place shim & measure" - LSTR MSG_UBL_BC_INSERT2 = _UxGT("測量"); // "Measure" - LSTR MSG_UBL_BC_REMOVE = _UxGT("移除並測量熱床"); // "Remove & measure bed" - LSTR MSG_UBL_MOVING_TO_NEXT = _UxGT("移動到下一個"); // "Moving to next" - LSTR MSG_UBL_ACTIVATE_MESH = _UxGT("啟動UBL"); // "Activate UBL" - LSTR MSG_UBL_DEACTIVATE_MESH = _UxGT("關閉UBL"); // "Deactivate UBL" - LSTR MSG_UBL_SET_TEMP_BED = _UxGT("置設熱床溫度"); // "Bed Temp" - LSTR MSG_UBL_BED_TEMP_CUSTOM = _UxGT("置設熱床溫度"); // "Bed Temp" - LSTR MSG_UBL_SET_TEMP_HOTEND = _UxGT("置設噴嘴溫度"); // "Hotend Temp" - LSTR MSG_UBL_HOTEND_TEMP_CUSTOM = _UxGT("熱端溫度"); // "Hotend Temp" - LSTR MSG_UBL_MESH_EDIT = _UxGT("網格編輯"); // "Mesh Edit" - LSTR MSG_UBL_EDIT_CUSTOM_MESH = _UxGT("編輯客戶網格"); // "Edit Custom Mesh" - LSTR MSG_UBL_FINE_TUNE_MESH = _UxGT("細調網格"); // "Fine Tuning Mesh" - LSTR MSG_UBL_DONE_EDITING_MESH = _UxGT("完成編輯網格"); // "Done Editing Mesh" - LSTR MSG_UBL_BUILD_CUSTOM_MESH = _UxGT("創設客戶網格"); // "Build Custom Mesh" - LSTR MSG_UBL_BUILD_MESH_MENU = _UxGT("創設網格"); // "Build Mesh" + LSTR MSG_UBL_DOING_G29 = _UxGT("執行G29"); // "Doing G29" + LSTR MSG_UBL_TOOLS = _UxGT("UBL工具"); // "UBL Tools" + LSTR MSG_UBL_LEVEL_BED = _UxGT("統一熱床調平(UBL)"); // "Unified Bed Leveling" + LSTR MSG_LCD_TILTING_MESH = _UxGT("傾斜點"); // "Tilting Point" + LSTR MSG_UBL_MANUAL_MESH = _UxGT("手工建網"); // "Manually Build Mesh" + LSTR MSG_UBL_BC_INSERT = _UxGT("放置墊片並測量"); // "Place shim & measure" + LSTR MSG_UBL_BC_INSERT2 = _UxGT("測量"); // "Measure" + LSTR MSG_UBL_BC_REMOVE = _UxGT("移除並測量熱床"); // "Remove & measure bed" + LSTR MSG_UBL_MOVING_TO_NEXT = _UxGT("移動到下一個"); // "Moving to next" + LSTR MSG_UBL_ACTIVATE_MESH = _UxGT("啟動UBL"); // "Activate UBL" + LSTR MSG_UBL_DEACTIVATE_MESH = _UxGT("關閉UBL"); // "Deactivate UBL" + LSTR MSG_UBL_SET_TEMP_BED = _UxGT("置設熱床溫度"); // "Bed Temp" + LSTR MSG_UBL_BED_TEMP_CUSTOM = _UxGT("置設熱床溫度"); // "Bed Temp" + LSTR MSG_UBL_SET_TEMP_HOTEND = _UxGT("置設噴嘴溫度"); // "Hotend Temp" + LSTR MSG_UBL_HOTEND_TEMP_CUSTOM = _UxGT("熱端溫度"); // "Hotend Temp" + LSTR MSG_UBL_MESH_EDIT = _UxGT("網格編輯"); // "Mesh Edit" + LSTR MSG_UBL_EDIT_CUSTOM_MESH = _UxGT("編輯客戶網格"); // "Edit Custom Mesh" + LSTR MSG_UBL_FINE_TUNE_MESH = _UxGT("細調網格"); // "Fine Tuning Mesh" + LSTR MSG_UBL_DONE_EDITING_MESH = _UxGT("完成編輯網格"); // "Done Editing Mesh" + LSTR MSG_UBL_BUILD_CUSTOM_MESH = _UxGT("創設客戶網格"); // "Build Custom Mesh" + LSTR MSG_UBL_BUILD_MESH_MENU = _UxGT("創設網格"); // "Build Mesh" #if HAS_PREHEAT - LSTR MSG_UBL_BUILD_MESH_M = _UxGT("創設 $ 網格"); // "Build PREHEAT_1_LABEL Mesh" - LSTR MSG_UBL_VALIDATE_MESH_M = _UxGT("批准 $ 網格"); // "Validate PREHEAT_1_LABEL Mesh" + LSTR MSG_UBL_BUILD_MESH_M = _UxGT("創設 $ 網格"); // "Build PREHEAT_1_LABEL Mesh" + LSTR MSG_UBL_VALIDATE_MESH_M = _UxGT("批准 $ 網格"); // "Validate PREHEAT_1_LABEL Mesh" #endif - LSTR MSG_UBL_BUILD_COLD_MESH = _UxGT("創設冷網格"); // "Build Cold Mesh" - LSTR MSG_UBL_MESH_HEIGHT_ADJUST = _UxGT("調整網格高度"); // "Adjust Mesh Height" - LSTR MSG_UBL_MESH_HEIGHT_AMOUNT = _UxGT("高度合計"); // "Height Amount" - LSTR MSG_UBL_VALIDATE_MESH_MENU = _UxGT("批准網格"); // "Validate Mesh" - LSTR MSG_UBL_VALIDATE_CUSTOM_MESH = _UxGT("批准客戶網格"); // "Validate Custom Mesh" - LSTR MSG_G26_HEATING_BED = _UxGT("G26 加熱熱床"); // "G26 Heating Bed" + LSTR MSG_UBL_BUILD_COLD_MESH = _UxGT("創設冷網格"); // "Build Cold Mesh" + LSTR MSG_UBL_MESH_HEIGHT_ADJUST = _UxGT("調整網格高度"); // "Adjust Mesh Height" + LSTR MSG_UBL_MESH_HEIGHT_AMOUNT = _UxGT("高度合計"); // "Height Amount" + LSTR MSG_UBL_VALIDATE_MESH_MENU = _UxGT("批准網格"); // "Validate Mesh" + LSTR MSG_UBL_VALIDATE_CUSTOM_MESH = _UxGT("批准客戶網格"); // "Validate Custom Mesh" + LSTR MSG_G26_HEATING_BED = _UxGT("G26 加熱熱床"); // "G26 Heating Bed" LSTR MSG_G26_HEATING_NOZZLE = _UxGT("G26 加熱噴嘴"); //"G26 Heating Nozzle" - LSTR MSG_G26_MANUAL_PRIME = _UxGT("手動填裝"); // "Manual priming..." - LSTR MSG_G26_FIXED_LENGTH = _UxGT("固定距離填裝"); // "Fixed Length Prime" - LSTR MSG_G26_PRIME_DONE = _UxGT("完成填裝"); // "Done Priming" - LSTR MSG_G26_CANCELED = _UxGT("G26已取消"); // "G26 Canceled" - LSTR MSG_G26_LEAVING = _UxGT("離開 G26"); // "Leaving G26" - LSTR MSG_UBL_CONTINUE_MESH = _UxGT("繼續熱床網格"); // "Continue Bed Mesh" - LSTR MSG_UBL_MESH_LEVELING = _UxGT("網格調平"); // "Mesh Leveling" - LSTR MSG_UBL_3POINT_MESH_LEVELING = _UxGT("三點調平"); // "3-Point Leveling" - LSTR MSG_UBL_GRID_MESH_LEVELING = _UxGT("格子網格調平"); // "Grid Mesh Leveling" - LSTR MSG_UBL_MESH_LEVEL = _UxGT("調平網格"); // "Level Mesh" - LSTR MSG_UBL_SIDE_POINTS = _UxGT("邊點"); // "Side Points" - LSTR MSG_UBL_MAP_TYPE = _UxGT("圖類型"); // "Map Type" - LSTR MSG_UBL_OUTPUT_MAP = _UxGT("輸出網格圖"); // "Output Mesh Map" - LSTR MSG_UBL_OUTPUT_MAP_HOST = _UxGT("輸出到主機"); // "Output for Host" - LSTR MSG_UBL_OUTPUT_MAP_CSV = _UxGT("輸出到CSV"); // "Output for CSV" - LSTR MSG_UBL_OUTPUT_MAP_BACKUP = _UxGT("輸出到備份"); // "Off Printer Backup" - LSTR MSG_UBL_INFO_UBL = _UxGT("輸出UBL信息"); // "Output UBL Info" - LSTR MSG_UBL_FILLIN_AMOUNT = _UxGT("填充合計"); // "Fill-in Amount" - 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_INVALIDATE_ALL = _UxGT("作廢所有的"); // "Invalidate All" - LSTR MSG_UBL_INVALIDATE_CLOSEST = _UxGT("作廢最近的"); // "Invalidate Closest" - LSTR MSG_UBL_FINE_TUNE_ALL = _UxGT("細調所有的"); // "Fine Tune All" - LSTR MSG_UBL_FINE_TUNE_CLOSEST = _UxGT("細調最近的"); // "Fine Tune Closest" - LSTR MSG_UBL_STORAGE_MESH_MENU = _UxGT("網格存儲"); // "Mesh Storage" - 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_MESH_LOADED = _UxGT("網格 %i 已裝載"); // "Mesh %i loaded" - LSTR MSG_MESH_SAVED = _UxGT("網格 %i 已保存"); // "Mesh %i saved" - LSTR MSG_UBL_NO_STORAGE = _UxGT("沒有存儲"); // "No storage" - LSTR MSG_UBL_SAVE_ERROR = _UxGT("錯誤: UBL保存"); // "Err: UBL Save" - LSTR MSG_UBL_RESTORE_ERROR = _UxGT("錯誤: UBL還原"); // "Err: UBL Restore" - LSTR MSG_UBL_Z_OFFSET = _UxGT("Z-偏移:"); // "Z-Offset: " - LSTR MSG_UBL_Z_OFFSET_STOPPED = _UxGT("Z偏移已停止"); // "Z-Offset Stopped" - LSTR MSG_UBL_STEP_BY_STEP_MENU = _UxGT("一步步UBL"); // "Step-By-Step UBL" + LSTR MSG_G26_MANUAL_PRIME = _UxGT("手動填裝"); // "Manual priming..." + LSTR MSG_G26_FIXED_LENGTH = _UxGT("固定距離填裝"); // "Fixed Length Prime" + LSTR MSG_G26_PRIME_DONE = _UxGT("完成填裝"); // "Done Priming" + LSTR MSG_G26_CANCELED = _UxGT("G26已取消"); // "G26 Canceled" + LSTR MSG_G26_LEAVING = _UxGT("離開 G26"); // "Leaving G26" + LSTR MSG_UBL_CONTINUE_MESH = _UxGT("繼續熱床網格"); // "Continue Bed Mesh" + LSTR MSG_UBL_MESH_LEVELING = _UxGT("網格調平"); // "Mesh Leveling" + LSTR MSG_UBL_3POINT_MESH_LEVELING = _UxGT("三點調平"); // "3-Point Leveling" + LSTR MSG_UBL_GRID_MESH_LEVELING = _UxGT("格子網格調平"); // "Grid Mesh Leveling" + LSTR MSG_UBL_MESH_LEVEL = _UxGT("調平網格"); // "Level Mesh" + LSTR MSG_UBL_SIDE_POINTS = _UxGT("邊點"); // "Side Points" + LSTR MSG_UBL_MAP_TYPE = _UxGT("圖類型"); // "Map Type" + LSTR MSG_UBL_OUTPUT_MAP = _UxGT("輸出網格圖"); // "Output Mesh Map" + LSTR MSG_UBL_OUTPUT_MAP_HOST = _UxGT("輸出到主機"); // "Output for Host" + LSTR MSG_UBL_OUTPUT_MAP_CSV = _UxGT("輸出到CSV"); // "Output for CSV" + LSTR MSG_UBL_OUTPUT_MAP_BACKUP = _UxGT("輸出到備份"); // "Off Printer Backup" + LSTR MSG_UBL_INFO_UBL = _UxGT("輸出UBL信息"); // "Output UBL Info" + LSTR MSG_UBL_FILLIN_AMOUNT = _UxGT("填充合計"); // "Fill-in Amount" + 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_INVALIDATE_ALL = _UxGT("作廢所有的"); // "Invalidate All" + LSTR MSG_UBL_INVALIDATE_CLOSEST = _UxGT("作廢最近的"); // "Invalidate Closest" + LSTR MSG_UBL_FINE_TUNE_ALL = _UxGT("細調所有的"); // "Fine Tune All" + LSTR MSG_UBL_FINE_TUNE_CLOSEST = _UxGT("細調最近的"); // "Fine Tune Closest" + LSTR MSG_UBL_STORAGE_MESH_MENU = _UxGT("網格存儲"); // "Mesh Storage" + 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_MESH_LOADED = _UxGT("網格 %i 已裝載"); // "Mesh %i loaded" + LSTR MSG_MESH_SAVED = _UxGT("網格 %i 已保存"); // "Mesh %i saved" + LSTR MSG_UBL_NO_STORAGE = _UxGT("沒有存儲"); // "No storage" + LSTR MSG_UBL_SAVE_ERROR = _UxGT("錯誤: UBL保存"); // "Err: UBL Save" + LSTR MSG_UBL_RESTORE_ERROR = _UxGT("錯誤: UBL還原"); // "Err: UBL Restore" + LSTR MSG_UBL_Z_OFFSET = _UxGT("Z-偏移:"); // "Z-Offset: " + LSTR MSG_UBL_Z_OFFSET_STOPPED = _UxGT("Z偏移已停止"); // "Z-Offset Stopped" + LSTR MSG_UBL_STEP_BY_STEP_MENU = _UxGT("一步步UBL"); // "Step-By-Step UBL" LSTR MSG_UBL_1_BUILD_COLD_MESH = _UxGT("1. 創設冷網格"); LSTR MSG_UBL_2_SMART_FILLIN = _UxGT("2. 聰明填充"); LSTR MSG_UBL_3_VALIDATE_MESH_MENU = _UxGT("3. 批准網格"); @@ -194,269 +194,269 @@ namespace Language_zh_TW { LSTR MSG_UBL_6_FINE_TUNE_ALL = _UxGT("6. 細調所有的"); LSTR MSG_UBL_7_SAVE_MESH = _UxGT("7. 保存熱床網格"); - LSTR MSG_LED_CONTROL = _UxGT("燈管控制"); // "LED Control" - LSTR MSG_LEDS = _UxGT("燈"); // "Lights" - LSTR MSG_LED_PRESETS = _UxGT("燈預置"); // "Light Presets" - LSTR MSG_SET_LEDS_RED = _UxGT("红"); // "Red" - LSTR MSG_SET_LEDS_ORANGE = _UxGT("橙"); // "Orange" - LSTR MSG_SET_LEDS_YELLOW = _UxGT("黃"); // "Yellow" - LSTR MSG_SET_LEDS_GREEN = _UxGT("綠"); // "Green" - LSTR MSG_SET_LEDS_BLUE = _UxGT("藍"); // "Blue" - LSTR MSG_SET_LEDS_INDIGO = _UxGT("青"); // "Indigo" - LSTR MSG_SET_LEDS_VIOLET = _UxGT("紫"); // "Violet" - LSTR MSG_SET_LEDS_WHITE = _UxGT("白"); // "White" - LSTR MSG_SET_LEDS_DEFAULT = _UxGT("復歸"); // "Default" - LSTR MSG_CUSTOM_LEDS = _UxGT("定制燈"); // "Custom Lights" - LSTR MSG_INTENSITY_R = _UxGT("紅飽和度"); // "Red Intensity" - LSTR MSG_INTENSITY_G = _UxGT("綠飽和度"); // "Green Intensity" - LSTR MSG_INTENSITY_B = _UxGT("藍飽和度"); // "Blue Intensity" - LSTR MSG_INTENSITY_W = _UxGT("白飽和度"); // "White Intensity" - LSTR MSG_LED_BRIGHTNESS = _UxGT("亮度"); // "Brightness" + LSTR MSG_LED_CONTROL = _UxGT("燈管控制"); // "LED Control" + LSTR MSG_LEDS = _UxGT("燈"); // "Lights" + LSTR MSG_LED_PRESETS = _UxGT("燈預置"); // "Light Presets" + LSTR MSG_SET_LEDS_RED = _UxGT("红"); // "Red" + LSTR MSG_SET_LEDS_ORANGE = _UxGT("橙"); // "Orange" + LSTR MSG_SET_LEDS_YELLOW = _UxGT("黃"); // "Yellow" + LSTR MSG_SET_LEDS_GREEN = _UxGT("綠"); // "Green" + LSTR MSG_SET_LEDS_BLUE = _UxGT("藍"); // "Blue" + LSTR MSG_SET_LEDS_INDIGO = _UxGT("青"); // "Indigo" + LSTR MSG_SET_LEDS_VIOLET = _UxGT("紫"); // "Violet" + LSTR MSG_SET_LEDS_WHITE = _UxGT("白"); // "White" + LSTR MSG_SET_LEDS_DEFAULT = _UxGT("復歸"); // "Default" + LSTR MSG_CUSTOM_LEDS = _UxGT("定制燈"); // "Custom Lights" + LSTR MSG_INTENSITY_R = _UxGT("紅飽和度"); // "Red Intensity" + LSTR MSG_INTENSITY_G = _UxGT("綠飽和度"); // "Green Intensity" + LSTR MSG_INTENSITY_B = _UxGT("藍飽和度"); // "Blue Intensity" + LSTR MSG_INTENSITY_W = _UxGT("白飽和度"); // "White Intensity" + LSTR MSG_LED_BRIGHTNESS = _UxGT("亮度"); // "Brightness" - LSTR MSG_MOVING = _UxGT("移動 ..."); // "Moving..." - LSTR MSG_FREE_XY = _UxGT("釋放 XY"); // "Free XY" - LSTR MSG_MOVE_X = _UxGT("移動X"); // "Move X" - LSTR MSG_MOVE_Y = _UxGT("移動Y"); // "Move Y" - LSTR MSG_MOVE_Z = _UxGT("移動Z"); // "Move Z" - LSTR MSG_MOVE_N = _UxGT("移動Q"); // "Move @" - 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("移動 $ 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" - LSTR MSG_MOVE_50MM = _UxGT("移動 50 mm"); // "Move 50mm" - LSTR MSG_MOVE_100MM = _UxGT("移動 100 mm"); // "Move 100mm" - LSTR MSG_SPEED = _UxGT("速率"); // "Speed" - LSTR MSG_MESH_Z_OFFSET = _UxGT("熱床Z"); // "Bed Z" - LSTR MSG_NOZZLE = " " LCD_STR_THERMOMETER _UxGT(" 噴嘴"); // "Nozzle" 噴嘴 + LSTR MSG_MOVING = _UxGT("移動 ..."); // "Moving..." + LSTR MSG_FREE_XY = _UxGT("釋放 XY"); // "Free XY" + LSTR MSG_MOVE_X = _UxGT("移動X"); // "Move X" + LSTR MSG_MOVE_Y = _UxGT("移動Y"); // "Move Y" + LSTR MSG_MOVE_Z = _UxGT("移動Z"); // "Move Z" + LSTR MSG_MOVE_N = _UxGT("移動Q"); // "Move @" + 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("移動 $ 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" + LSTR MSG_MOVE_50MM = _UxGT("移動 50 mm"); // "Move 50mm" + LSTR MSG_MOVE_100MM = _UxGT("移動 100 mm"); // "Move 100mm" + LSTR MSG_SPEED = _UxGT("速率"); // "Speed" + LSTR MSG_MESH_Z_OFFSET = _UxGT("熱床Z"); // "Bed Z" + LSTR MSG_NOZZLE = " " LCD_STR_THERMOMETER _UxGT(" 噴嘴"); // "Nozzle" 噴嘴 LSTR MSG_NOZZLE_N = " " LCD_STR_THERMOMETER _UxGT(" 噴嘴 ~"); - LSTR MSG_BED = " " LCD_STR_THERMOMETER _UxGT(" 熱床"); // "Bed" + LSTR MSG_BED = " " LCD_STR_THERMOMETER _UxGT(" 熱床"); // "Bed" LSTR MSG_CHAMBER = _UxGT("Enclosure"); - LSTR MSG_FAN_SPEED = _UxGT("風扇速率"); // "Fan speed" + LSTR MSG_FAN_SPEED = _UxGT("風扇速率"); // "Fan speed" LSTR MSG_FAN_SPEED_N = _UxGT("風扇速率 {"); LSTR MSG_STORED_FAN_N = _UxGT("Stored Fan {"); - LSTR MSG_EXTRA_FAN_SPEED = _UxGT("額外風扇速率"); // "Extra fan speed" + LSTR MSG_EXTRA_FAN_SPEED = _UxGT("額外風扇速率"); // "Extra fan speed" LSTR MSG_EXTRA_FAN_SPEED_N = _UxGT("額外風扇速率 {"); LSTR MSG_FLOW = _UxGT("擠出速率"); - LSTR MSG_FLOW_N = _UxGT("擠出速率 ~"); // "Flow" - LSTR MSG_CONTROL = _UxGT("控制"); // "Control" - LSTR MSG_MIN = " " LCD_STR_THERMOMETER _UxGT(" 最小"); // " " LCD_STR_THERMOMETER " Min" - LSTR MSG_MAX = " " LCD_STR_THERMOMETER _UxGT(" 最大"); // " " LCD_STR_THERMOMETER " Max" - LSTR MSG_FACTOR = " " LCD_STR_THERMOMETER _UxGT(" 系數"); // " " LCD_STR_THERMOMETER " Fact" - LSTR MSG_AUTOTEMP = _UxGT("自動控溫"); // "Autotemp" - LSTR MSG_LCD_ON = _UxGT("開 "); // "On" - LSTR MSG_LCD_OFF = _UxGT("關 "); // "Off" + LSTR MSG_FLOW_N = _UxGT("擠出速率 ~"); // "Flow" + LSTR MSG_CONTROL = _UxGT("控制"); // "Control" + LSTR MSG_MIN = " " LCD_STR_THERMOMETER _UxGT(" 最小"); // " " LCD_STR_THERMOMETER " Min" + LSTR MSG_MAX = " " LCD_STR_THERMOMETER _UxGT(" 最大"); // " " LCD_STR_THERMOMETER " Max" + LSTR MSG_FACTOR = " " LCD_STR_THERMOMETER _UxGT(" 系數"); // " " LCD_STR_THERMOMETER " Fact" + LSTR MSG_AUTOTEMP = _UxGT("自動控溫"); // "Autotemp" + LSTR MSG_LCD_ON = _UxGT("開 "); // "On" + LSTR MSG_LCD_OFF = _UxGT("關 "); // "Off" LSTR MSG_SELECT_E = _UxGT("選擇 *"); - LSTR MSG_ACC = _UxGT("加速度"); // "Accel" acceleration - LSTR MSG_JERK = _UxGT("抖動速率"); // "Jerk" - LSTR MSG_VA_JERK = _UxGT("軸抖動速率") STR_A; // "Va-jerk" + LSTR MSG_ACC = _UxGT("加速度"); // "Accel" acceleration + LSTR MSG_JERK = _UxGT("抖動速率"); // "Jerk" + 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_VN_JERK = _UxGT("軸抖動速率@"); LSTR MSG_VE_JERK = _UxGT("擠出機抖動速率"); - LSTR MSG_MAX_SPEED = _UxGT("速度"); // "Velocity" - LSTR MSG_VMAX_A = _UxGT("最大進料速率") STR_A; // "Vmax " max_feedrate_mm_s + 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_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 - LSTR MSG_ACCELERATION = _UxGT("加速度"); // "Acceleration" - LSTR MSG_AMAX_A = _UxGT("最大列印加速度") STR_A; // "Amax " max_acceleration_mm_per_s2, acceleration in units/s^2 for print moves + 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 + LSTR MSG_ACCELERATION = _UxGT("加速度"); // "Acceleration" + 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_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 - LSTR MSG_STEPS_PER_MM = _UxGT("軸步數/mm"); // "Steps/mm" axis_steps_per_mm, axis steps-per-unit G92 - LSTR MSG_A_STEPS = STR_A _UxGT(" 軸步數/mm"); // "Asteps/mm" axis_steps_per_mm, axis steps-per-unit G92 + 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 + LSTR MSG_STEPS_PER_MM = _UxGT("軸步數/mm"); // "Steps/mm" axis_steps_per_mm, axis steps-per-unit G92 + 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_N_STEPS = _UxGT("@ 軸步數/mm"); - LSTR MSG_E_STEPS = _UxGT("擠出機步數/mm"); // "Esteps/mm" + LSTR MSG_E_STEPS = _UxGT("擠出機步數/mm"); // "Esteps/mm" LSTR MSG_EN_STEPS = _UxGT("擠出機~步數/mm"); - LSTR MSG_TEMPERATURE = _UxGT("溫度"); // "Temperature" - LSTR MSG_MOTION = _UxGT("運作"); // "Motion" - LSTR MSG_FILAMENT = _UxGT("絲料測容"); // "Filament" menu_control_volumetric - LSTR MSG_VOLUMETRIC_ENABLED = _UxGT("測容積mm") SUPERSCRIPT_THREE; // "E in mm3" volumetric_enabled - LSTR MSG_FILAMENT_DIAM = _UxGT("絲料直徑"); // "Fil. Dia." + LSTR MSG_TEMPERATURE = _UxGT("溫度"); // "Temperature" + LSTR MSG_MOTION = _UxGT("運作"); // "Motion" + LSTR MSG_FILAMENT = _UxGT("絲料測容"); // "Filament" menu_control_volumetric + LSTR MSG_VOLUMETRIC_ENABLED = _UxGT("測容積mm") SUPERSCRIPT_THREE; // "E in mm3" volumetric_enabled + LSTR MSG_FILAMENT_DIAM = _UxGT("絲料直徑"); // "Fil. Dia." LSTR MSG_FILAMENT_DIAM_E = _UxGT("絲料直徑 *"); - LSTR MSG_FILAMENT_UNLOAD = _UxGT("卸載 mm"); // "Unload mm" - LSTR MSG_FILAMENT_LOAD = _UxGT("装載 mm"); // "Load mm" + LSTR MSG_FILAMENT_UNLOAD = _UxGT("卸載 mm"); // "Unload mm" + LSTR MSG_FILAMENT_LOAD = _UxGT("装載 mm"); // "Load mm" LSTR MSG_ADVANCE_K = _UxGT("Advance K"); LSTR MSG_ADVANCE_K_E = _UxGT("Advance K *"); - LSTR MSG_CONTRAST = _UxGT("LCD對比度"); // "LCD contrast" - LSTR MSG_STORE_EEPROM = _UxGT("保存設置"); // "Store memory" - LSTR MSG_LOAD_EEPROM = _UxGT("載入設置"); // "Load memory" - LSTR MSG_RESTORE_DEFAULTS = _UxGT("恢復安全值"); // "Restore failsafe" - LSTR MSG_INIT_EEPROM = _UxGT("初始化設置"); // "Initialize EEPROM" - LSTR MSG_ERR_EEPROM_CRC = _UxGT("錯誤: EEPROM CRC"); // "Err: EEPROM CRC" - LSTR MSG_ERR_EEPROM_SIZE = _UxGT("錯誤: EEPROM 尺寸"); // "Err: EEPROM Index" - LSTR MSG_ERR_EEPROM_VERSION = _UxGT("錯誤: EEPROM 版本"); // "EEPROM Version" - LSTR MSG_MEDIA_UPDATE = _UxGT("媒體更新"); // "Media Update" - LSTR MSG_RESET_PRINTER = _UxGT("重置打印機"); // "Reset Printer - LSTR MSG_REFRESH = _UxGT("刷新"); // "Refresh" - LSTR MSG_INFO_SCREEN = _UxGT("資訊界面"); // "Info screen" - LSTR MSG_PREPARE = _UxGT("準備"); // "Prepare" - LSTR MSG_TUNE = _UxGT("調整"); // "Tune" - LSTR MSG_START_PRINT = _UxGT("開始列印"); // "Start Print" - LSTR MSG_BUTTON_NEXT = _UxGT("下一個"); // "Next" - LSTR MSG_BUTTON_INIT = _UxGT("初始 "); // "Init" - LSTR MSG_BUTTON_STOP = _UxGT("停止 "); // "Stop" - LSTR MSG_BUTTON_PRINT = _UxGT("列印 "); // "Print" - LSTR MSG_BUTTON_RESET = _UxGT("復歸 "); // "Reset" - LSTR MSG_BUTTON_CANCEL = _UxGT("放棄 "); // "Cancel" - LSTR MSG_BUTTON_DONE = _UxGT("確認 "); // "Done" - LSTR MSG_BUTTON_BACK = _UxGT("返回 "); // "Back" - LSTR MSG_BUTTON_PROCEED = _UxGT("繼續 "); // "Proceed" - LSTR MSG_PAUSE_PRINT = _UxGT("暫停列印"); // "Pause print" - LSTR MSG_RESUME_PRINT = _UxGT("恢復列印"); // "Resume print" - LSTR MSG_STOP_PRINT = _UxGT("停止列印"); // "Stop print" - LSTR MSG_PRINTING_OBJECT = _UxGT("列印物件"); // "Printing Object" - LSTR MSG_CANCEL_OBJECT = _UxGT("中止物件"); // "Cancel Object" - LSTR MSG_CANCEL_OBJECT_N = _UxGT("中止物件 {"); // "Cancel Object {" - LSTR MSG_OUTAGE_RECOVERY = _UxGT("中斷恢復"); // "Outage Recovery" - LSTR MSG_MEDIA_MENU = _UxGT("從記憶卡上列印"); // "Print from SD" - LSTR MSG_NO_MEDIA = _UxGT("無記憶卡"); // "No SD card" - LSTR MSG_DWELL = _UxGT("休眠 ..."); // "Sleep..." - LSTR MSG_USERWAIT = _UxGT("點擊繼續 ..."); // "Click to resume..." - LSTR MSG_PRINT_PAUSED = _UxGT("列印已暫停"); // "Print paused" - LSTR MSG_PRINTING = _UxGT("列印中 ..."); // "Printing..." - LSTR MSG_PRINT_ABORTED = _UxGT("已取消列印"); // "Print aborted" - LSTR MSG_NO_MOVE = _UxGT("無移動"); // "No move." - LSTR MSG_KILLED = _UxGT("已砍掉"); // "KILLED. " - LSTR MSG_STOPPED = _UxGT("已停止"); // "STOPPED. " - LSTR MSG_CONTROL_RETRACT = _UxGT("回縮長度mm"); // "Retract mm" retract_length, retract length (positive mm) - LSTR MSG_CONTROL_RETRACT_SWAP = _UxGT("換手回抽長度mm"); // "Swap Re.mm" swap_retract_length, swap retract length (positive mm), for extruder change - LSTR MSG_CONTROL_RETRACTF = _UxGT("回縮速率mm/s"); // "Retract V" retract_feedrate_mm_s, feedrate for retracting (mm/s) - LSTR MSG_CONTROL_RETRACT_ZHOP = _UxGT("Hop mm"); // "Hop mm" retract_zraise, retract Z-lift - LSTR MSG_CONTROL_RETRACT_RECOVER = _UxGT("回縮恢復長度mm"); // "UnRet +mm" retract_recover_extra, additional recover length (mm, added to retract length when recovering) - LSTR MSG_CONTROL_RETRACT_RECOVER_SWAP = _UxGT("換手回縮恢復長度mm"); // "S UnRet+mm" swap_retract_recover_extra, additional swap recover length (mm, added to retract length when recovering from extruder change) - LSTR MSG_CONTROL_RETRACT_RECOVERF = _UxGT("回縮恢復後進料速率mm/s"); // "Unretract V" retract_recover_feedrate_mm_s, feedrate for recovering from retraction (mm/s) - LSTR MSG_CONTROL_RETRACT_RECOVER_SWAPF = _UxGT("S UnRet V"); // "S UnRet V" - LSTR MSG_AUTORETRACT = _UxGT("自動回縮"); // "Auto-Retract" autoretract_enabled, - LSTR MSG_FILAMENT_SWAP_LENGTH = _UxGT("交換長度"); // "Swap Length" - LSTR MSG_FILAMENT_PURGE_LENGTH = _UxGT("清除長度"); // "Purge Length" + LSTR MSG_CONTRAST = _UxGT("LCD對比度"); // "LCD contrast" + LSTR MSG_STORE_EEPROM = _UxGT("保存設置"); // "Store memory" + LSTR MSG_LOAD_EEPROM = _UxGT("載入設置"); // "Load memory" + LSTR MSG_RESTORE_DEFAULTS = _UxGT("恢復安全值"); // "Restore failsafe" + LSTR MSG_INIT_EEPROM = _UxGT("初始化設置"); // "Initialize EEPROM" + LSTR MSG_ERR_EEPROM_CRC = _UxGT("錯誤: EEPROM CRC"); // "Err: EEPROM CRC" + LSTR MSG_ERR_EEPROM_SIZE = _UxGT("錯誤: EEPROM 尺寸"); // "Err: EEPROM Index" + LSTR MSG_ERR_EEPROM_VERSION = _UxGT("錯誤: EEPROM 版本"); // "EEPROM Version" + LSTR MSG_MEDIA_UPDATE = _UxGT("媒體更新"); // "Media Update" + LSTR MSG_RESET_PRINTER = _UxGT("重置打印機"); // "Reset Printer + LSTR MSG_REFRESH = _UxGT("刷新"); // "Refresh" + LSTR MSG_INFO_SCREEN = _UxGT("資訊界面"); // "Info screen" + LSTR MSG_PREPARE = _UxGT("準備"); // "Prepare" + LSTR MSG_TUNE = _UxGT("調整"); // "Tune" + LSTR MSG_START_PRINT = _UxGT("開始列印"); // "Start Print" + LSTR MSG_BUTTON_NEXT = _UxGT("下一個"); // "Next" + LSTR MSG_BUTTON_INIT = _UxGT("初始 "); // "Init" + LSTR MSG_BUTTON_STOP = _UxGT("停止 "); // "Stop" + LSTR MSG_BUTTON_PRINT = _UxGT("列印 "); // "Print" + LSTR MSG_BUTTON_RESET = _UxGT("復歸 "); // "Reset" + LSTR MSG_BUTTON_CANCEL = _UxGT("放棄 "); // "Cancel" + LSTR MSG_BUTTON_DONE = _UxGT("確認 "); // "Done" + LSTR MSG_BUTTON_BACK = _UxGT("返回 "); // "Back" + LSTR MSG_BUTTON_PROCEED = _UxGT("繼續 "); // "Proceed" + LSTR MSG_PAUSE_PRINT = _UxGT("暫停列印"); // "Pause print" + LSTR MSG_RESUME_PRINT = _UxGT("恢復列印"); // "Resume print" + LSTR MSG_STOP_PRINT = _UxGT("停止列印"); // "Stop print" + LSTR MSG_PRINTING_OBJECT = _UxGT("列印物件"); // "Printing Object" + LSTR MSG_CANCEL_OBJECT = _UxGT("中止物件"); // "Cancel Object" + LSTR MSG_CANCEL_OBJECT_N = _UxGT("中止物件 {"); // "Cancel Object {" + LSTR MSG_OUTAGE_RECOVERY = _UxGT("中斷恢復"); // "Outage Recovery" + LSTR MSG_MEDIA_MENU = _UxGT("從記憶卡上列印"); // "Print from SD" + LSTR MSG_NO_MEDIA = _UxGT("無記憶卡"); // "No SD card" + LSTR MSG_DWELL = _UxGT("休眠 ..."); // "Sleep..." + LSTR MSG_USERWAIT = _UxGT("點擊繼續 ..."); // "Click to resume..." + LSTR MSG_PRINT_PAUSED = _UxGT("列印已暫停"); // "Print paused" + LSTR MSG_PRINTING = _UxGT("列印中 ..."); // "Printing..." + LSTR MSG_PRINT_ABORTED = _UxGT("已取消列印"); // "Print aborted" + LSTR MSG_NO_MOVE = _UxGT("無移動"); // "No move." + LSTR MSG_KILLED = _UxGT("已砍掉"); // "KILLED. " + LSTR MSG_STOPPED = _UxGT("已停止"); // "STOPPED. " + LSTR MSG_CONTROL_RETRACT = _UxGT("回縮長度mm"); // "Retract mm" retract_length, retract length (positive mm) + LSTR MSG_CONTROL_RETRACT_SWAP = _UxGT("換手回抽長度mm"); // "Swap Re.mm" swap_retract_length, swap retract length (positive mm), for extruder change + LSTR MSG_CONTROL_RETRACTF = _UxGT("回縮速率mm/s"); // "Retract V" retract_feedrate_mm_s, feedrate for retracting (mm/s) + LSTR MSG_CONTROL_RETRACT_ZHOP = _UxGT("Hop mm"); // "Hop mm" retract_zraise, retract Z-lift + LSTR MSG_CONTROL_RETRACT_RECOVER = _UxGT("回縮恢復長度mm"); // "UnRet +mm" retract_recover_extra, additional recover length (mm, added to retract length when recovering) + LSTR MSG_CONTROL_RETRACT_RECOVER_SWAP = _UxGT("換手回縮恢復長度mm"); // "S UnRet+mm" swap_retract_recover_extra, additional swap recover length (mm, added to retract length when recovering from extruder change) + LSTR MSG_CONTROL_RETRACT_RECOVERF = _UxGT("回縮恢復後進料速率mm/s"); // "Unretract V" retract_recover_feedrate_mm_s, feedrate for recovering from retraction (mm/s) + LSTR MSG_CONTROL_RETRACT_RECOVER_SWAPF = _UxGT("S UnRet V"); // "S UnRet V" + LSTR MSG_AUTORETRACT = _UxGT("自動回縮"); // "Auto-Retract" autoretract_enabled, + LSTR MSG_FILAMENT_SWAP_LENGTH = _UxGT("交換長度"); // "Swap Length" + LSTR MSG_FILAMENT_PURGE_LENGTH = _UxGT("清除長度"); // "Purge Length" LSTR MSG_TOOL_CHANGE = _UxGT("交換工具"); //"Tool Change" - LSTR MSG_TOOL_CHANGE_ZLIFT = _UxGT("Z軸提昇"); // "Z Raise" - LSTR MSG_SINGLENOZZLE_PRIME_SPEED = _UxGT("最高速度"); // "Prime Speed" - LSTR MSG_SINGLENOZZLE_RETRACT_SPEED = _UxGT("收回速度"); // "Retract Speed" + LSTR MSG_TOOL_CHANGE_ZLIFT = _UxGT("Z軸提昇"); // "Z Raise" + LSTR MSG_SINGLENOZZLE_PRIME_SPEED = _UxGT("最高速度"); // "Prime Speed" + LSTR MSG_SINGLENOZZLE_RETRACT_SPEED = _UxGT("收回速度"); // "Retract Speed" LSTR MSG_NOZZLE_STANDBY = _UxGT("噴嘴待機"); //"Nozzle Standby" - LSTR MSG_FILAMENTCHANGE = _UxGT("更換絲料"); // "Change filament" + LSTR MSG_FILAMENTCHANGE = _UxGT("更換絲料"); // "Change filament" LSTR MSG_FILAMENTCHANGE_E = _UxGT("更換絲料 *"); - LSTR MSG_FILAMENTLOAD = _UxGT("裝載絲料"); // "Load filament" + LSTR MSG_FILAMENTLOAD = _UxGT("裝載絲料"); // "Load filament" LSTR MSG_FILAMENTLOAD_E = _UxGT("裝載絲料 *"); - LSTR MSG_FILAMENTUNLOAD = _UxGT("卸載絲料"); // "Unload filament" - LSTR MSG_FILAMENTUNLOAD_E = _UxGT("卸載絲料 *"); // "Unload filament" - LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("卸載全部"); // "Unload All" - LSTR MSG_INIT_MEDIA = _UxGT("初始化記憶卡"); // "Init. SD card" - LSTR MSG_ATTACH_MEDIA = _UxGT("連接記憶卡"); // "Attach Media - LSTR MSG_CHANGE_MEDIA = _UxGT("更換記憶卡"); // "Change SD card" - LSTR MSG_RELEASE_MEDIA = _UxGT("釋放媒體"); // "Release Media" - LSTR MSG_ZPROBE_OUT = _UxGT("Z探針在熱床之外"); // "Z probe out. bed" Z probe is not within the physical limits - LSTR MSG_SKEW_FACTOR = _UxGT("偏斜因數"); // "Skew Factor" + LSTR MSG_FILAMENTUNLOAD = _UxGT("卸載絲料"); // "Unload filament" + LSTR MSG_FILAMENTUNLOAD_E = _UxGT("卸載絲料 *"); // "Unload filament" + LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("卸載全部"); // "Unload All" + LSTR MSG_INIT_MEDIA = _UxGT("初始化記憶卡"); // "Init. SD card" + LSTR MSG_ATTACH_MEDIA = _UxGT("連接記憶卡"); // "Attach Media + LSTR MSG_CHANGE_MEDIA = _UxGT("更換記憶卡"); // "Change SD card" + LSTR MSG_RELEASE_MEDIA = _UxGT("釋放媒體"); // "Release Media" + LSTR MSG_ZPROBE_OUT = _UxGT("Z探針在熱床之外"); // "Z probe out. bed" Z probe is not within the physical limits + LSTR MSG_SKEW_FACTOR = _UxGT("偏斜因數"); // "Skew Factor" - LSTR MSG_BLTOUCH_SELFTEST = _UxGT("BLTouch 自檢"); // "BLTouch Self-Test" - LSTR MSG_BLTOUCH_RESET = _UxGT("重置BLTouch"); // "Reset BLTouch" - LSTR MSG_BLTOUCH_STOW = _UxGT("裝載BLTouch"); // "Stow BLTouch" - LSTR MSG_BLTOUCH_DEPLOY = _UxGT("部署BLTouch"); // "Deploy BLTouch" + LSTR MSG_BLTOUCH_SELFTEST = _UxGT("BLTouch 自檢"); // "BLTouch Self-Test" + LSTR MSG_BLTOUCH_RESET = _UxGT("重置BLTouch"); // "Reset BLTouch" + LSTR MSG_BLTOUCH_STOW = _UxGT("裝載BLTouch"); // "Stow BLTouch" + LSTR MSG_BLTOUCH_DEPLOY = _UxGT("部署BLTouch"); // "Deploy BLTouch" - LSTR MSG_HOME_FIRST = _UxGT("歸位 %s 先"); // "Home ... first" - LSTR MSG_ZPROBE_OFFSETS = _UxGT("探針偏移"); //Probe Offsets - LSTR MSG_ZPROBE_XOFFSET = _UxGT("探針X偏移量"); //Probe X Offset - LSTR MSG_ZPROBE_YOFFSET = _UxGT("探針Y偏移量"); //Probe Y Offset - LSTR MSG_ZPROBE_ZOFFSET = _UxGT("探針Z偏移量"); //Probe Z Offset - LSTR MSG_BABYSTEP_X = _UxGT("微量調整X軸"); // "Babystep X" lcd_babystep_x, Babystepping enables the user to control the axis in tiny amounts - LSTR MSG_BABYSTEP_Y = _UxGT("微量調整Y軸"); // "Babystep Y" - LSTR MSG_BABYSTEP_Z = _UxGT("微量調整Z軸"); // "Babystep Z" - LSTR MSG_BABYSTEP_TOTAL = _UxGT("總計"); // "Total" - LSTR MSG_ENDSTOP_ABORT = _UxGT("擋塊終止"); // "Endstop abort" - LSTR MSG_HEATING_FAILED_LCD = _UxGT("加熱失敗"); // "Heating failed" - LSTR MSG_ERR_REDUNDANT_TEMP = _UxGT("錯誤:冗餘溫度"); // "Err: REDUNDANT TEMP" - LSTR MSG_THERMAL_RUNAWAY = _UxGT("溫度失控"); // "THERMAL RUNAWAY" - LSTR MSG_THERMAL_RUNAWAY_BED = _UxGT("熱床溫度失控"); // "BED THERMAL RUNAWAY" - LSTR MSG_THERMAL_RUNAWAY_CHAMBER = _UxGT("機箱溫度失控"); // "CHAMBER T. RUNAWAY" - LSTR MSG_ERR_MAXTEMP = _UxGT("錯誤:最高溫度"); // "Err: MAXTEMP" - LSTR MSG_ERR_MINTEMP = _UxGT("錯誤:最低溫度"); // "Err: MINTEMP" - LSTR MSG_HALTED = _UxGT("印表機停機"); // "PRINTER HALTED" - LSTR MSG_PLEASE_RESET = _UxGT("請重置"); // "Please reset" - LSTR MSG_HEATING = _UxGT("加熱中 ..."); // "Heating..." - LSTR MSG_COOLING = _UxGT("冷卻中 ..."); // "Cooling..." - LSTR MSG_BED_HEATING = _UxGT("加熱熱床中 ..."); // "Bed Heating..." - LSTR MSG_BED_COOLING = _UxGT("熱床冷卻中 ..."); // "Bed Cooling..." - LSTR MSG_CHAMBER_HEATING = _UxGT("機箱加熱中 .."); // "Chamber Heating..." - LSTR MSG_CHAMBER_COOLING = _UxGT("機箱冷卻中 ..."); //Chamber Cooling... - LSTR MSG_DELTA_CALIBRATE = _UxGT("⊿校準"); // "Delta Calibration" - LSTR MSG_DELTA_CALIBRATE_X = _UxGT("⊿校準X"); // "Calibrate X" - LSTR MSG_DELTA_CALIBRATE_Y = _UxGT("⊿校準Y"); // "Calibrate Y" - LSTR MSG_DELTA_CALIBRATE_Z = _UxGT("⊿校準Z"); // "Calibrate Z" - 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_DIAG_ROD = _UxGT("⊿斜柱"); // "Diag Rod" - LSTR MSG_DELTA_HEIGHT = _UxGT("⊿高度"); // "Height" - LSTR MSG_DELTA_RADIUS = _UxGT("⊿半徑"); // "Radius" - LSTR MSG_INFO_MENU = _UxGT("關於印表機"); // "About Printer" - LSTR MSG_INFO_PRINTER_MENU = _UxGT("印表機訊息"); // "Printer Info" - LSTR MSG_3POINT_LEVELING = _UxGT("三點調平"); // "3-Point Leveling" - LSTR MSG_LINEAR_LEVELING = _UxGT("線性調平"); // "Linear Leveling" - LSTR MSG_BILINEAR_LEVELING = _UxGT(" 雙線性調平"); // "Bilinear Leveling" - LSTR MSG_UBL_LEVELING = _UxGT("統一熱床調平(UBL)"); // "Unified Bed Leveling" - LSTR MSG_MESH_LEVELING = _UxGT("網格調平"); // "Mesh Leveling" - LSTR MSG_INFO_STATS_MENU = _UxGT("印表機統計"); // "Printer Stats" - LSTR MSG_INFO_BOARD_MENU = _UxGT("主板訊息"); // "Board Info" - LSTR MSG_INFO_THERMISTOR_MENU = _UxGT("溫度計"); // "Thermistors" - LSTR MSG_INFO_EXTRUDERS = _UxGT(" 擠出機"); // "Extruders" - LSTR MSG_INFO_BAUDRATE = _UxGT("傳輸率"); // "Baud" - LSTR MSG_INFO_PROTOCOL = _UxGT("協議"); // "Protocol" - LSTR MSG_INFO_RUNAWAY_OFF = _UxGT("監測溫度失控:關"); // "Runaway Watch: OFF" - LSTR MSG_INFO_RUNAWAY_ON = _UxGT("監測溫度失控:開"); // "Runaway Watch: ON" + LSTR MSG_HOME_FIRST = _UxGT("歸位 %s 先"); // "Home ... first" + LSTR MSG_ZPROBE_OFFSETS = _UxGT("探針偏移"); //Probe Offsets + LSTR MSG_ZPROBE_XOFFSET = _UxGT("探針X偏移量"); //Probe X Offset + LSTR MSG_ZPROBE_YOFFSET = _UxGT("探針Y偏移量"); //Probe Y Offset + LSTR MSG_ZPROBE_ZOFFSET = _UxGT("探針Z偏移量"); //Probe Z Offset + LSTR MSG_BABYSTEP_X = _UxGT("微量調整X軸"); // "Babystep X" lcd_babystep_x, Babystepping enables the user to control the axis in tiny amounts + LSTR MSG_BABYSTEP_Y = _UxGT("微量調整Y軸"); // "Babystep Y" + LSTR MSG_BABYSTEP_Z = _UxGT("微量調整Z軸"); // "Babystep Z" + LSTR MSG_BABYSTEP_TOTAL = _UxGT("總計"); // "Total" + LSTR MSG_ENDSTOP_ABORT = _UxGT("擋塊終止"); // "Endstop abort" + LSTR MSG_HEATING_FAILED_LCD = _UxGT("加熱失敗"); // "Heating failed" + LSTR MSG_ERR_REDUNDANT_TEMP = _UxGT("錯誤:冗餘溫度"); // "Err: REDUNDANT TEMP" + LSTR MSG_THERMAL_RUNAWAY = _UxGT("溫度失控"); // "THERMAL RUNAWAY" + LSTR MSG_THERMAL_RUNAWAY_BED = _UxGT("熱床溫度失控"); // "BED THERMAL RUNAWAY" + LSTR MSG_THERMAL_RUNAWAY_CHAMBER = _UxGT("機箱溫度失控"); // "CHAMBER T. RUNAWAY" + LSTR MSG_ERR_MAXTEMP = _UxGT("錯誤:最高溫度"); // "Err: MAXTEMP" + LSTR MSG_ERR_MINTEMP = _UxGT("錯誤:最低溫度"); // "Err: MINTEMP" + LSTR MSG_HALTED = _UxGT("印表機停機"); // "PRINTER HALTED" + LSTR MSG_PLEASE_RESET = _UxGT("請重置"); // "Please reset" + LSTR MSG_HEATING = _UxGT("加熱中 ..."); // "Heating..." + LSTR MSG_COOLING = _UxGT("冷卻中 ..."); // "Cooling..." + LSTR MSG_BED_HEATING = _UxGT("加熱熱床中 ..."); // "Bed Heating..." + LSTR MSG_BED_COOLING = _UxGT("熱床冷卻中 ..."); // "Bed Cooling..." + LSTR MSG_CHAMBER_HEATING = _UxGT("機箱加熱中 .."); // "Chamber Heating..." + LSTR MSG_CHAMBER_COOLING = _UxGT("機箱冷卻中 ..."); //Chamber Cooling... + LSTR MSG_DELTA_CALIBRATE = _UxGT("⊿校準"); // "Delta Calibration" + LSTR MSG_DELTA_CALIBRATE_X = _UxGT("⊿校準X"); // "Calibrate X" + LSTR MSG_DELTA_CALIBRATE_Y = _UxGT("⊿校準Y"); // "Calibrate Y" + LSTR MSG_DELTA_CALIBRATE_Z = _UxGT("⊿校準Z"); // "Calibrate Z" + 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_DIAG_ROD = _UxGT("⊿斜柱"); // "Diag Rod" + LSTR MSG_DELTA_HEIGHT = _UxGT("⊿高度"); // "Height" + LSTR MSG_DELTA_RADIUS = _UxGT("⊿半徑"); // "Radius" + LSTR MSG_INFO_MENU = _UxGT("關於印表機"); // "About Printer" + LSTR MSG_INFO_PRINTER_MENU = _UxGT("印表機訊息"); // "Printer Info" + LSTR MSG_3POINT_LEVELING = _UxGT("三點調平"); // "3-Point Leveling" + LSTR MSG_LINEAR_LEVELING = _UxGT("線性調平"); // "Linear Leveling" + LSTR MSG_BILINEAR_LEVELING = _UxGT(" 雙線性調平"); // "Bilinear Leveling" + LSTR MSG_UBL_LEVELING = _UxGT("統一熱床調平(UBL)"); // "Unified Bed Leveling" + LSTR MSG_MESH_LEVELING = _UxGT("網格調平"); // "Mesh Leveling" + LSTR MSG_INFO_STATS_MENU = _UxGT("印表機統計"); // "Printer Stats" + LSTR MSG_INFO_BOARD_MENU = _UxGT("主板訊息"); // "Board Info" + LSTR MSG_INFO_THERMISTOR_MENU = _UxGT("溫度計"); // "Thermistors" + LSTR MSG_INFO_EXTRUDERS = _UxGT(" 擠出機"); // "Extruders" + LSTR MSG_INFO_BAUDRATE = _UxGT("傳輸率"); // "Baud" + LSTR MSG_INFO_PROTOCOL = _UxGT("協議"); // "Protocol" + LSTR MSG_INFO_RUNAWAY_OFF = _UxGT("監測溫度失控:關"); // "Runaway Watch: OFF" + LSTR MSG_INFO_RUNAWAY_ON = _UxGT("監測溫度失控:開"); // "Runaway Watch: ON" - LSTR MSG_CASE_LIGHT = _UxGT("外殼燈"); // "Case light" - LSTR MSG_CASE_LIGHT_BRIGHTNESS = _UxGT("燈亮度"); // "Light BRIGHTNESS" - LSTR MSG_KILL_EXPECTED_PRINTER = _UxGT("打印機不正確"); // "The printer is incorrect" + LSTR MSG_CASE_LIGHT = _UxGT("外殼燈"); // "Case light" + LSTR MSG_CASE_LIGHT_BRIGHTNESS = _UxGT("燈亮度"); // "Light BRIGHTNESS" + LSTR MSG_KILL_EXPECTED_PRINTER = _UxGT("打印機不正確"); // "The printer is incorrect" #if LCD_WIDTH >= 20 || HAS_DWIN_E3V2 - LSTR MSG_INFO_PRINT_COUNT = _UxGT("列印計數"); // "Print Count" - LSTR MSG_INFO_COMPLETED_PRINTS = _UxGT("已完成"); // "Completed" - LSTR MSG_INFO_PRINT_TIME = _UxGT("總列印時間"); // "Total print time" - LSTR MSG_INFO_PRINT_LONGEST = _UxGT("最長工作時間"); // "Longest job time" - LSTR MSG_INFO_PRINT_FILAMENT = _UxGT("總計擠出"); // "Extruded total" + LSTR MSG_INFO_PRINT_COUNT = _UxGT("列印計數"); // "Print Count" + LSTR MSG_INFO_COMPLETED_PRINTS = _UxGT("已完成"); // "Completed" + LSTR MSG_INFO_PRINT_TIME = _UxGT("總列印時間"); // "Total print time" + LSTR MSG_INFO_PRINT_LONGEST = _UxGT("最長工作時間"); // "Longest job time" + LSTR MSG_INFO_PRINT_FILAMENT = _UxGT("總計擠出"); // "Extruded total" #else - LSTR MSG_INFO_PRINT_COUNT = _UxGT("列印數"); // "Prints" - LSTR MSG_INFO_COMPLETED_PRINTS = _UxGT("完成"); // "Completed" - LSTR MSG_INFO_PRINT_TIME = _UxGT("總共"); // "Total" - LSTR MSG_INFO_PRINT_LONGEST = _UxGT("最長"); // "Longest" - LSTR MSG_INFO_PRINT_FILAMENT = _UxGT("已擠出"); // "Extruded" + LSTR MSG_INFO_PRINT_COUNT = _UxGT("列印數"); // "Prints" + LSTR MSG_INFO_COMPLETED_PRINTS = _UxGT("完成"); // "Completed" + LSTR MSG_INFO_PRINT_TIME = _UxGT("總共"); // "Total" + LSTR MSG_INFO_PRINT_LONGEST = _UxGT("最長"); // "Longest" + LSTR MSG_INFO_PRINT_FILAMENT = _UxGT("已擠出"); // "Extruded" #endif - LSTR MSG_INFO_MIN_TEMP = _UxGT("最低溫度"); // "Min Temp" - 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_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" - LSTR MSG_FILAMENT_CHANGE_HEADER_PAUSE = _UxGT("列印已暫停"); // "PRINT PAUSED" - LSTR MSG_FILAMENT_CHANGE_HEADER_LOAD = _UxGT("裝載絲料"); // "LOAD FILAMENT" - LSTR MSG_FILAMENT_CHANGE_HEADER_UNLOAD = _UxGT("卸載絲料"); // "UNLOAD FILAMENT" - 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("恢復列印"); // "Resume print" - LSTR MSG_FILAMENT_CHANGE_NOZZLE = _UxGT(" 噴嘴: "); // " Nozzle: " - LSTR MSG_RUNOUT_SENSOR = _UxGT("斷絲偵測"); // "Runout Sensor" - LSTR MSG_RUNOUT_DISTANCE_MM = _UxGT("絲距離mm"); // "Runout Dist mm" - LSTR MSG_KILL_HOMING_FAILED = _UxGT("歸原位失敗"); // "Homing failed" - LSTR MSG_LCD_PROBING_FAILED = _UxGT("探針探測失敗"); // "Probing failed" + LSTR MSG_INFO_MIN_TEMP = _UxGT("最低溫度"); // "Min Temp" + 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_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" + LSTR MSG_FILAMENT_CHANGE_HEADER_PAUSE = _UxGT("列印已暫停"); // "PRINT PAUSED" + LSTR MSG_FILAMENT_CHANGE_HEADER_LOAD = _UxGT("裝載絲料"); // "LOAD FILAMENT" + LSTR MSG_FILAMENT_CHANGE_HEADER_UNLOAD = _UxGT("卸載絲料"); // "UNLOAD FILAMENT" + 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("恢復列印"); // "Resume print" + LSTR MSG_FILAMENT_CHANGE_NOZZLE = _UxGT(" 噴嘴: "); // " Nozzle: " + LSTR MSG_RUNOUT_SENSOR = _UxGT("斷絲偵測"); // "Runout Sensor" + LSTR MSG_RUNOUT_DISTANCE_MM = _UxGT("絲距離mm"); // "Runout Dist mm" + LSTR MSG_KILL_HOMING_FAILED = _UxGT("歸原位失敗"); // "Homing failed" + LSTR MSG_LCD_PROBING_FAILED = _UxGT("探針探測失敗"); // "Probing failed" // // Filament Change screens show up to 3 lines on a 4-line display @@ -464,31 +464,31 @@ namespace Language_zh_TW { // #if LCD_HEIGHT >= 4 LSTR MSG_ADVANCED_PAUSE_WAITING = _UxGT(MSG_2_LINE("按下按鈕", "恢復列印")); //"Press Button to resume print" - LSTR MSG_PAUSE_PRINT_PARKING = _UxGT(MSG_1_LINE("停車中 ...")); // "Parking..." - LSTR MSG_FILAMENT_CHANGE_INIT = _UxGT(MSG_3_LINE("等待開始", "絲料", "變更")); // "Wait for start of the filament change" - LSTR MSG_FILAMENT_CHANGE_UNLOAD = _UxGT(MSG_2_LINE("等待", "卸下絲料")); // "Wait for filament unload" - LSTR MSG_FILAMENT_CHANGE_INSERT = _UxGT(MSG_3_LINE("插入絲料", "並按鍵", "繼續 ...")); // "Insert filament and press button to continue..." - LSTR MSG_FILAMENT_CHANGE_HEAT = _UxGT(MSG_2_LINE("按下按鈕", "加熱噴嘴.")); // "Press button to heat nozzle." - LSTR MSG_FILAMENT_CHANGE_HEATING = _UxGT(MSG_2_LINE("加熱噴嘴", "請等待 ...")); // "Heating nozzle Please wait..." - LSTR MSG_FILAMENT_CHANGE_LOAD = _UxGT(MSG_2_LINE("等待", "進料")); // "Wait for filament load" - LSTR MSG_FILAMENT_CHANGE_PURGE = _UxGT(MSG_2_LINE("等待", "絲料清除")); // "Wait for filament purge" + LSTR MSG_PAUSE_PRINT_PARKING = _UxGT(MSG_1_LINE("停車中 ...")); // "Parking..." + LSTR MSG_FILAMENT_CHANGE_INIT = _UxGT(MSG_3_LINE("等待開始", "絲料", "變更")); // "Wait for start of the filament change" + LSTR MSG_FILAMENT_CHANGE_UNLOAD = _UxGT(MSG_2_LINE("等待", "卸下絲料")); // "Wait for filament unload" + LSTR MSG_FILAMENT_CHANGE_INSERT = _UxGT(MSG_3_LINE("插入絲料", "並按鍵", "繼續 ...")); // "Insert filament and press button to continue..." + LSTR MSG_FILAMENT_CHANGE_HEAT = _UxGT(MSG_2_LINE("按下按鈕", "加熱噴嘴.")); // "Press button to heat nozzle." + LSTR MSG_FILAMENT_CHANGE_HEATING = _UxGT(MSG_2_LINE("加熱噴嘴", "請等待 ...")); // "Heating nozzle Please wait..." + LSTR MSG_FILAMENT_CHANGE_LOAD = _UxGT(MSG_2_LINE("等待", "進料")); // "Wait for filament load" + LSTR MSG_FILAMENT_CHANGE_PURGE = _UxGT(MSG_2_LINE("等待", "絲料清除")); // "Wait for filament purge" LSTR MSG_FILAMENT_CHANGE_CONT_PURGE = _UxGT(MSG_2_LINE("按下完成","絲料清除")); //"Press button to filament purge" - LSTR MSG_FILAMENT_CHANGE_RESUME = _UxGT(MSG_2_LINE("等待列印", "恢復")); // "Wait for print to resume" + LSTR MSG_FILAMENT_CHANGE_RESUME = _UxGT(MSG_2_LINE("等待列印", "恢復")); // "Wait for print to resume" #else // LCD_HEIGHT < 4 - LSTR MSG_ADVANCED_PAUSE_WAITING = _UxGT(MSG_1_LINE("按下繼續..")); // "Click to continue" - LSTR MSG_PAUSE_PRINT_PARKING = _UxGT(MSG_1_LINE("停車中 ...")); // "Parking..." - LSTR MSG_FILAMENT_CHANGE_INIT = _UxGT(MSG_1_LINE("請等待 ...")); // "Please wait..." - LSTR MSG_FILAMENT_CHANGE_INSERT = _UxGT(MSG_1_LINE("插入並點擊")); // "Insert and Click" - LSTR MSG_FILAMENT_CHANGE_HEAT = _UxGT(MSG_1_LINE("按下加熱..")); // "Click to heat" - LSTR MSG_FILAMENT_CHANGE_HEATING = _UxGT(MSG_1_LINE("加熱中 ...")); // "Heating..." - LSTR MSG_FILAMENT_CHANGE_UNLOAD = _UxGT(MSG_1_LINE("退出中 ...")); // "Ejecting..." - LSTR MSG_FILAMENT_CHANGE_LOAD = _UxGT(MSG_1_LINE("載入中 ...")); // "Loading..." - LSTR MSG_FILAMENT_CHANGE_PURGE = _UxGT(MSG_1_LINE("清除中 ...")); // "Purging..." - LSTR MSG_FILAMENT_CHANGE_CONT_PURGE = _UxGT(MSG_1_LINE("按下完成..")); // "Click to finish" - LSTR MSG_FILAMENT_CHANGE_RESUME = _UxGT(MSG_1_LINE("恢復中 ...")); // "Resuming..." + LSTR MSG_ADVANCED_PAUSE_WAITING = _UxGT(MSG_1_LINE("按下繼續..")); // "Click to continue" + LSTR MSG_PAUSE_PRINT_PARKING = _UxGT(MSG_1_LINE("停車中 ...")); // "Parking..." + LSTR MSG_FILAMENT_CHANGE_INIT = _UxGT(MSG_1_LINE("請等待 ...")); // "Please wait..." + LSTR MSG_FILAMENT_CHANGE_INSERT = _UxGT(MSG_1_LINE("插入並點擊")); // "Insert and Click" + LSTR MSG_FILAMENT_CHANGE_HEAT = _UxGT(MSG_1_LINE("按下加熱..")); // "Click to heat" + LSTR MSG_FILAMENT_CHANGE_HEATING = _UxGT(MSG_1_LINE("加熱中 ...")); // "Heating..." + LSTR MSG_FILAMENT_CHANGE_UNLOAD = _UxGT(MSG_1_LINE("退出中 ...")); // "Ejecting..." + LSTR MSG_FILAMENT_CHANGE_LOAD = _UxGT(MSG_1_LINE("載入中 ...")); // "Loading..." + LSTR MSG_FILAMENT_CHANGE_PURGE = _UxGT(MSG_1_LINE("清除中 ...")); // "Purging..." + LSTR MSG_FILAMENT_CHANGE_CONT_PURGE = _UxGT(MSG_1_LINE("按下完成..")); // "Click to finish" + LSTR MSG_FILAMENT_CHANGE_RESUME = _UxGT(MSG_1_LINE("恢復中 ...")); // "Resuming..." #endif // LCD_HEIGHT < 4 - LSTR MSG_SHORT_DAY = _UxGT("天"); // "d" // One character only - LSTR MSG_SHORT_HOUR = _UxGT("時"); // "h" // One character only - LSTR MSG_SHORT_MINUTE = _UxGT("分"); // "m" // One character only + LSTR MSG_SHORT_DAY = _UxGT("天"); // "d" // One character only + LSTR MSG_SHORT_HOUR = _UxGT("時"); // "h" // One character only + LSTR MSG_SHORT_MINUTE = _UxGT("分"); // "m" // One character only } diff --git a/Marlin/src/pins/stm32f1/pins_KEDI_CONTROLLER_V1_2.h b/Marlin/src/pins/stm32f1/pins_KEDI_CONTROLLER_V1_2.h index 494af83f59e17..c2865372c5aec 100644 --- a/Marlin/src/pins/stm32f1/pins_KEDI_CONTROLLER_V1_2.h +++ b/Marlin/src/pins/stm32f1/pins_KEDI_CONTROLLER_V1_2.h @@ -72,11 +72,11 @@ // L6470 or L6474 on SPI #if HAS_DRIVER(L6470) || HAS_DRIVER(L6474) // Shared with SPI on EXP2 - #define L6470_CHAIN_SCK_PIN PB3 - #define L6470_CHAIN_MISO_PIN PB4 - #define L6470_CHAIN_MOSI_PIN PB5 - #define L6470_CHAIN_SS_PIN PA15 - #define ENABLE_RESET_L64XX_CHIPS + #define L6470_CHAIN_SCK_PIN PB3 + #define L6470_CHAIN_MISO_PIN PB4 + #define L6470_CHAIN_MOSI_PIN PB5 + #define L6470_CHAIN_SS_PIN PA15 + #define ENABLE_RESET_L64XX_CHIPS #endif // TMC2130 on SPI From ef93b401c38eb1748721be74c9fdbae77f375792 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 27 May 2023 00:22:42 +0000 Subject: [PATCH 068/100] [cron] Bump distribution date (2023-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 bb0da06648856..cac9dbda5dda7 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 "2023-05-26" +//#define STRING_DISTRIBUTION_DATE "2023-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 a203e9267c89e..0bb7faffe2a63 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 "2023-05-26" + #define STRING_DISTRIBUTION_DATE "2023-05-27" #endif /** From 0b4500155e8c61aecf41090b41f34a3452593b78 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Sun, 28 May 2023 13:24:45 -0700 Subject: [PATCH 069/100] =?UTF-8?q?=F0=9F=A9=B9=20Update=20KEDI=20/=20GODI?= =?UTF-8?q?=20LCD=5FPINS=5FEN=20pin=20(#25886)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/language/language_vi.h | 1 - Marlin/src/pins/stm32f1/pins_KEDI_CONTROLLER_V1_2.h | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Marlin/src/lcd/language/language_vi.h b/Marlin/src/lcd/language/language_vi.h index 2ce22961ca73f..69b58f71f01db 100644 --- a/Marlin/src/lcd/language/language_vi.h +++ b/Marlin/src/lcd/language/language_vi.h @@ -438,5 +438,4 @@ namespace Language_vi { LSTR MSG_SHORT_DAY = _UxGT("n"); // d - ngày - One character only LSTR MSG_SHORT_HOUR = _UxGT("g"); // h - giờ - One character only LSTR MSG_SHORT_MINUTE = _UxGT("p"); // m - phút - One character only - LSTR MSG_SHORT_MINUTE = _UxGT("p"); // M - phút - One character only } diff --git a/Marlin/src/pins/stm32f1/pins_KEDI_CONTROLLER_V1_2.h b/Marlin/src/pins/stm32f1/pins_KEDI_CONTROLLER_V1_2.h index c2865372c5aec..c18085755c328 100644 --- a/Marlin/src/pins/stm32f1/pins_KEDI_CONTROLLER_V1_2.h +++ b/Marlin/src/pins/stm32f1/pins_KEDI_CONTROLLER_V1_2.h @@ -190,7 +190,7 @@ #define BTN_EN1 EXP1_08_PIN #define BTN_EN2 EXP1_06_PIN - #define LCD_PINS_ENABLE EXP1_03_PIN + #define LCD_PINS_EN EXP1_03_PIN #define LCD_PINS_D4 EXP1_05_PIN #elif IS_TFTGLCD_PANEL @@ -211,7 +211,7 @@ #define BTN_EN1 EXP2_08_PIN #define BTN_EN2 EXP2_06_PIN - #define LCD_PINS_ENABLE EXP1_08_PIN + #define LCD_PINS_EN EXP1_08_PIN #if ENABLED(FYSETC_MINI_12864) From b4ba3dd7f37a6214ed8a3e62f45f9d2aac3917c9 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Mon, 29 May 2023 00:21:30 +0000 Subject: [PATCH 070/100] [cron] Bump distribution date (2023-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 cac9dbda5dda7..4c3f7ed262522 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 "2023-05-27" +//#define STRING_DISTRIBUTION_DATE "2023-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 0bb7faffe2a63..5fc2b732c3b3d 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 "2023-05-27" + #define STRING_DISTRIBUTION_DATE "2023-05-29" #endif /** From d926d4dea413f70303ae38a74bc627aaaf21d97e Mon Sep 17 00:00:00 2001 From: DejitaruJin Date: Sun, 28 May 2023 21:22:00 -0400 Subject: [PATCH 071/100] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20and=20improve=20GT?= =?UTF-8?q?2560=20pins=20(#25890)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/pins/mega/pins_GT2560_REV_A.h | 122 +++++++++++------- Marlin/src/pins/mega/pins_GT2560_REV_A_PLUS.h | 6 +- .../stm32f1/pins_BTT_SKR_MINI_E3_common.h | 8 +- 3 files changed, 84 insertions(+), 52 deletions(-) diff --git a/Marlin/src/pins/mega/pins_GT2560_REV_A.h b/Marlin/src/pins/mega/pins_GT2560_REV_A.h index 61c61f94fff46..783a93a85b938 100644 --- a/Marlin/src/pins/mega/pins_GT2560_REV_A.h +++ b/Marlin/src/pins/mega/pins_GT2560_REV_A.h @@ -47,14 +47,12 @@ #define Y_MAX_PIN 28 #define Z_MIN_PIN 30 -#if ENABLED(BLTOUCH) - #if MB(GT2560_REV_A_PLUS) - #define SERVO0_PIN 11 - #define Z_MAX_PIN 32 - #else - #define SERVO0_PIN 32 - #define Z_MAX_PIN -1 - #endif +#if ENABLED(BLTOUCH) && !defined(SERVO0_PIN) + #define SERVO0_PIN 32 +#endif + +#if SERVO0_PIN == 32 + #define Z_MAX_PIN -1 #else #define Z_MAX_PIN 32 #endif @@ -102,64 +100,100 @@ // // Misc. Functions // -#define SDSS 53 + +// Power monitoring pins - set to 0 for main VIN, 1 for dedicated bed supply rail. +// Don't forget to enable POWER_MONITOR_VOLTAGE in Configuration_adv.h +// and set POWER_MONITOR_VOLTS_PER_VOLT to 0.090909. +#define POWER_MONITOR_VOLTAGE_PIN 0 + +/** LCD SDCARD + * ------ ------ + * (TX1) 18 | 1 2 | 19 (RX1) (MISO) 50 | 1 2 | 52 (SCK) + * (RX2) 17 | 3 4 | 20 (SDA) 42 | 3 4 | 53 (SS) + * (TX2) 16 | 5 6 21 (SCL) 40 | 5 6 51 (MOSI) + * 5 | 7 8 | 6 38 | 7 8 | RESET + * GND | 9 10 | 5V GND | 9 10 | 5V/3V3 + * ------ ------ + * SV1 SV3 + * + * GT2560 LCD & SD headers follow typical EXP1 & EXP2 format. + * SD header voltage pin set by link pads beneath the header; R25 for 5V, R44 for 3.3V (default) + * Pins 20 (SDA) and 21 (SCL) have external 10K pull-ups on the board. + */ + +#define EXP1_01_PIN 18 // TX1 / BEEPER +#define EXP1_02_PIN 19 // RX1 / ENC +#define EXP1_03_PIN 17 // RX2 / CS +#define EXP1_04_PIN 20 // SDA / A0 +#define EXP1_05_PIN 16 // TX2 / LCD_RS +#define EXP1_06_PIN 21 // SCL / CS +#define EXP1_07_PIN 5 // D6 / A0 +#define EXP1_08_PIN 6 // D7 / D4 + +#define EXP2_01_PIN 50 // MISO +#define EXP2_02_PIN 52 // SCK +#define EXP2_03_PIN 42 // EN2 +#define EXP2_04_PIN 53 // SDSS +#define EXP2_05_PIN 40 // EN1 +#define EXP2_06_PIN 51 // MOSI +#define EXP2_07_PIN 38 // SD_DET +#define EXP2_08_PIN -1 // RESET + +#define SDSS EXP2_04_PIN #define LED_PIN 13 -#define PS_ON_PIN 12 -#define SUICIDE_PIN 54 // Must be enabled at startup to keep power flowing -#define KILL_PIN -1 #if HAS_WIRED_LCD - #define BEEPER_PIN 18 + #define BEEPER_PIN EXP1_01_PIN #if IS_NEWPANEL #if ENABLED(MKS_MINI_12864) - #define DOGLCD_A0 5 - #define DOGLCD_CS 21 - #define BTN_EN1 40 - #define BTN_EN2 42 + #define DOGLCD_CS EXP1_06_PIN + #define DOGLCD_A0 EXP1_07_PIN + #define BTN_EN1 EXP2_05_PIN + #define BTN_EN2 EXP2_03_PIN #elif ENABLED(FYSETC_MINI_12864) // Disconnect EXP2-1 and EXP2-2, otherwise future firmware upload won't work. - #define DOGLCD_A0 20 - #define DOGLCD_CS 17 + #define DOGLCD_CS EXP1_03_PIN + #define DOGLCD_A0 EXP1_04_PIN - #define NEOPIXEL_PIN 21 - #define BTN_EN1 42 - #define BTN_EN2 40 + #define NEOPIXEL_PIN EXP1_06_PIN + #define BTN_EN1 EXP2_03_PIN + #define BTN_EN2 EXP2_05_PIN - #define LCD_RESET_PIN 16 + #define LCD_RESET_PIN EXP1_05_PIN #define LCD_CONTRAST_INIT 220 #define LCD_BACKLIGHT_PIN -1 #else - #define LCD_PINS_RS 20 - #define LCD_PINS_EN 17 - #define LCD_PINS_D4 16 - #define LCD_PINS_D5 21 - #define LCD_PINS_D6 5 - #define LCD_PINS_D7 6 - #define BTN_EN1 42 - #define BTN_EN2 40 + #define LCD_PINS_RS EXP1_04_PIN + #define LCD_PINS_EN EXP1_03_PIN + #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 + #define BTN_EN1 EXP2_03_PIN + #define BTN_EN2 EXP2_05_PIN #endif - #define BTN_ENC 19 - #define SD_DETECT_PIN 38 + #define BTN_ENC EXP1_02_PIN + #define SD_DETECT_PIN EXP2_07_PIN #else // !IS_NEWPANEL - #define SHIFT_CLK_PIN 38 - #define SHIFT_LD_PIN 42 - #define SHIFT_OUT_PIN 40 - #define SHIFT_EN_PIN 17 - - #define LCD_PINS_RS 16 - #define LCD_PINS_EN 5 - #define LCD_PINS_D4 6 - #define LCD_PINS_D5 21 - #define LCD_PINS_D6 20 - #define LCD_PINS_D7 19 + #define SHIFT_CLK_PIN EXP2_07_PIN + #define SHIFT_LD_PIN EXP2_03_PIN + #define SHIFT_OUT_PIN EXP2_05_PIN + #define SHIFT_EN_PIN EXP1_03_PIN + + #define LCD_PINS_RS EXP1_05_PIN + #define LCD_PINS_EN EXP1_07_PIN + #define LCD_PINS_D4 EXP1_08_PIN + #define LCD_PINS_D5 EXP1_06_PIN + #define LCD_PINS_D6 EXP1_04_PIN + #define LCD_PINS_D7 EXP1_02_PIN #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) #define BTN_ENC_EN LCD_PINS_D7 // Detect the presence of the encoder diff --git a/Marlin/src/pins/mega/pins_GT2560_REV_A_PLUS.h b/Marlin/src/pins/mega/pins_GT2560_REV_A_PLUS.h index a982a0e00e739..1905f58108d0f 100644 --- a/Marlin/src/pins/mega/pins_GT2560_REV_A_PLUS.h +++ b/Marlin/src/pins/mega/pins_GT2560_REV_A_PLUS.h @@ -30,8 +30,6 @@ #define BOARD_INFO_NAME "GT2560 Rev.A+" -#include "pins_GT2560_REV_A.h" +#define SERVO0_PIN 11 -#if DISABLED(BLTOUCH) - #define SERVO0_PIN 32 -#endif +#include "pins_GT2560_REV_A.h" 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 689e73c4f3e1c..45829d2eded22 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 @@ -114,15 +114,15 @@ #define USB_CONNECT_INVERTING false /** - * SKR Mini E3 V1.0, V1.2 - * ------ + * SKR Mini E3 V1.0, V1.2 + * ------ * (BEEPER) PB5 | 1 2 | PB6 (BTN_ENC) * (BTN_EN1) PA9 | 3 4 | RESET * (BTN_EN2) PA10 5 6 | PB9 (LCD_D4) * (LCD_RS) PB8 | 7 8 | PB7 (LCD_EN) * GND | 9 10 | 5V - * ------ - * EXP1 + * ------ + * EXP1 */ #ifndef EXP1_02_PIN #define EXP1_02_PIN PB6 From 47616c7dfa7f3f7fddd8fa8d207929d65d2291a6 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 29 May 2023 19:00:09 -0500 Subject: [PATCH 072/100] =?UTF-8?q?=F0=9F=94=A8=20Install=20'heatshrink'?= =?UTF-8?q?=20if=20needed=20(#25896)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../share/scripts/MarlinBinaryProtocol.py | 28 +++++++++++-------- buildroot/share/scripts/upload.py | 26 +++++++++-------- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/buildroot/share/scripts/MarlinBinaryProtocol.py b/buildroot/share/scripts/MarlinBinaryProtocol.py index ecf9df35e2f51..dca5e167f761f 100644 --- a/buildroot/share/scripts/MarlinBinaryProtocol.py +++ b/buildroot/share/scripts/MarlinBinaryProtocol.py @@ -11,11 +11,14 @@ import datetime import random try: - import heatshrink + import heatshrink2 as heatshrink heatshrink_exists = True except ImportError: - heatshrink_exists = False - + try: + import heatshrink + heatshrink_exists = True + except ImportError: + heatshrink_exists = False def millis(): return time.perf_counter() * 1000 @@ -393,18 +396,19 @@ def abort(self): def copy(self, filename, dest_filename, compression, dummy): self.connect() - compression_support = heatshrink_exists and self.compression['algorithm'] == 'heatshrink' and compression - if compression and (not heatshrink_exists or not self.compression['algorithm'] == 'heatshrink'): - print("Compression not supported by client") - #compression_support = False + has_heatshrink = heatshrink_exists and self.compression['algorithm'] == 'heatshrink' + if compression and not has_heatshrink: + hs = '2' if sys.version_info[0] > 2 else '' + print("Compression not supported by client. Use 'pip install heatshrink%s' to fix." % hs) + compression = False data = open(filename, "rb").read() filesize = len(data) - self.open(dest_filename, compression_support, dummy) + self.open(dest_filename, compression, dummy) block_size = self.protocol.block_size - if compression_support: + if compression: data = heatshrink.encode(data, window_sz2=self.compression['window'], lookahead_sz2=self.compression['lookahead']) cratio = filesize / len(data) @@ -419,17 +423,17 @@ def copy(self, filename, dest_filename, compression, dummy): self.write(data[start:end]) kibs = (( (i+1) * block_size) / 1024) / (millis() + 1 - start_time) * 1000 if (i / blocks) >= dump_pctg: - print("\r{0:2.0f}% {1:4.2f}KiB/s {2} Errors: {3}".format((i / blocks) * 100, kibs, "[{0:4.2f}KiB/s]".format(kibs * cratio) if compression_support else "", self.protocol.errors), end='') + print("\r{0:2.0f}% {1:4.2f}KiB/s {2} Errors: {3}".format((i / blocks) * 100, kibs, "[{0:4.2f}KiB/s]".format(kibs * cratio) if compression else "", self.protocol.errors), end='') dump_pctg += 0.1 if self.protocol.errors > 0: # Dump last status (errors may not be visible) - print("\r{0:2.0f}% {1:4.2f}KiB/s {2} Errors: {3} - Aborting...".format((i / blocks) * 100, kibs, "[{0:4.2f}KiB/s]".format(kibs * cratio) if compression_support else "", self.protocol.errors), end='') + print("\r{0:2.0f}% {1:4.2f}KiB/s {2} Errors: {3} - Aborting...".format((i / blocks) * 100, kibs, "[{0:4.2f}KiB/s]".format(kibs * cratio) if compression else "", self.protocol.errors), end='') print("") # New line to break the transfer speed line self.close() print("Transfer aborted due to protocol errors") #raise Exception("Transfer aborted due to protocol errors") return False; - print("\r{0:2.0f}% {1:4.2f}KiB/s {2} Errors: {3}".format(100, kibs, "[{0:4.2f}KiB/s]".format(kibs * cratio) if compression_support else "", self.protocol.errors)) # no one likes transfers finishing at 99.8% + print("\r{0:2.0f}% {1:4.2f}KiB/s {2} Errors: {3}".format(100, kibs, "[{0:4.2f}KiB/s]".format(kibs * cratio) if compression else "", self.protocol.errors)) # no one likes transfers finishing at 99.8% if not self.close(): print("Transfer failed") diff --git a/buildroot/share/scripts/upload.py b/buildroot/share/scripts/upload.py index af15a825906e5..c97605e3f4b74 100644 --- a/buildroot/share/scripts/upload.py +++ b/buildroot/share/scripts/upload.py @@ -7,17 +7,6 @@ Import("env") -# Needed (only) for compression, but there are problems with pip install heatshrink -#try: -# import heatshrink -#except ImportError: -# # Install heatshrink -# print("Installing 'heatshrink' python module...") -# env.Execute(env.subst("$PYTHONEXE -m pip install heatshrink")) -# -# Not tested: If it's safe to install python libraries in PIO python try: -# env.Execute(env.subst("$PYTHONEXE -m pip install https://github.com/p3p/pyheatshrink/releases/download/0.3.3/pyheatshrink-pip.zip")) - import MarlinBinaryProtocol #-----------------# @@ -191,6 +180,21 @@ def _RollbackUpload(FirmwareFile): # "upload_random_name": generate a random 8.3 firmware filename to upload upload_random_filename = upload_delete_old_bins and not marlin_long_filename_host_support + # Heatshrink module is needed (only) for compression + if upload_compression: + if sys.version_info[0] > 2: + try: + import heatshrink2 + except ImportError: + print("Installing 'heatshrink2' python module...") + env.Execute(env.subst("$PYTHONEXE -m pip install heatshrink2")) + else: + try: + import heatshrink + except ImportError: + print("Installing 'heatshrink' python module...") + env.Execute(env.subst("$PYTHONEXE -m pip install heatshrink")) + try: # Start upload job From 67f0d6ae5ea89fe1cdfc7ac4b25ea2947df1772b Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 30 May 2023 00:33:07 +0000 Subject: [PATCH 073/100] [cron] Bump distribution date (2023-05-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 4c3f7ed262522..745b738b3b510 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 "2023-05-29" +//#define STRING_DISTRIBUTION_DATE "2023-05-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 5fc2b732c3b3d..47b8fecd57c2e 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 "2023-05-29" + #define STRING_DISTRIBUTION_DATE "2023-05-30" #endif /** From 3999d67e514c1e752128df2a6dc80ec0579ee504 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Thu, 1 Jun 2023 12:44:19 -0700 Subject: [PATCH 074/100] =?UTF-8?q?=F0=9F=94=A7=20Default=20has=20Heated?= =?UTF-8?q?=20Bed=20(#25895)?= 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/src/inc/Conditionals_adv.h | 2 -- Marlin/src/inc/Conditionals_post.h | 18 ++++++++++++------ Marlin/src/inc/SanityCheck.h | 11 +++++++++++ buildroot/tests/DUE | 2 +- buildroot/tests/mega2560 | 2 +- buildroot/tests/rumba32 | 2 +- 7 files changed, 27 insertions(+), 12 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index fee89898a3754..61377189a8bd8 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -547,7 +547,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_6 0 #define TEMP_SENSOR_7 0 -#define TEMP_SENSOR_BED 0 +#define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_PROBE 0 #define TEMP_SENSOR_CHAMBER 0 #define TEMP_SENSOR_COOLER 0 diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 70644ddf0d1ba..343ebae1ff386 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -688,8 +688,6 @@ #define TEMP_SENSOR_BED_IS_CUSTOM 1 #endif #else - #undef THERMAL_PROTECTION_BED - #undef THERMAL_PROTECTION_BED_PERIOD #undef BED_MINTEMP #undef BED_MAXTEMP #endif diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index d137e1d9c198a..5794a96b8b81b 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -2240,8 +2240,11 @@ #if HOTENDS > 7 && HAS_ADC_TEST(7) #define HAS_TEMP_ADC_7 1 #endif -#if HAS_ADC_TEST(BED) - #define HAS_TEMP_ADC_BED 1 +#if TEMP_SENSOR_BED + #define HAS_HEATED_BED 1 + #if HAS_ADC_TEST(BED) + #define HAS_TEMP_ADC_BED 1 + #endif #endif #if HAS_ADC_TEST(PROBE) #define HAS_TEMP_ADC_PROBE 1 @@ -2262,7 +2265,7 @@ #define HAS_TEMP_ADC_REDUNDANT 1 #endif -#define HAS_TEMP(N) (TEMP_SENSOR_IS_MAX_TC(N) || EITHER(HAS_TEMP_ADC_##N, TEMP_SENSOR_##N##_IS_DUMMY)) +#define HAS_TEMP(N) (TEMP_SENSOR_IS_MAX_TC(N) || HAS_TEMP_ADC_##N || TEMP_SENSOR_##N##_IS_DUMMY) #if HAS_HOTEND && HAS_TEMP(0) #define HAS_TEMP_HOTEND 1 #endif @@ -2331,10 +2334,12 @@ #if PIN_EXISTS(HEATER_BED) #define HAS_HEATER_BED 1 #endif +#if PIN_EXISTS(HEATER_CHAMBER) + #define HAS_HEATER_CHAMBER 1 +#endif // Shorthand for common combinations -#if HAS_TEMP_BED && HAS_HEATER_BED - #define HAS_HEATED_BED 1 +#if HAS_HEATED_BED #ifndef BED_OVERSHOOT #define BED_OVERSHOOT 10 #endif @@ -2361,7 +2366,7 @@ #define HAS_TEMP_SENSOR 1 #endif -#if HAS_TEMP_CHAMBER && PIN_EXISTS(HEATER_CHAMBER) +#if HAS_TEMP_CHAMBER && HAS_HEATER_CHAMBER #define HAS_HEATED_CHAMBER 1 #ifndef CHAMBER_OVERSHOOT #define CHAMBER_OVERSHOOT 10 @@ -2388,6 +2393,7 @@ // Thermal protection #if !HAS_HEATED_BED #undef THERMAL_PROTECTION_BED + #undef THERMAL_PROTECTION_BED_PERIOD #endif #if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0 #define WATCH_HOTENDS 1 diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 78630051b67d9..89cf8c5198c50 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -127,6 +127,17 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #undef _ISMAX_1 #undef _ISSNS_1 +/** + * Heated Bed requirements + */ +#if HAS_HEATED_BED + #if !HAS_TEMP_BED + #error "The Heated Bed requires a TEMP_BED_PIN or Thermocouple." + #elif !HAS_HEATER_BED + #error "The Heated Bed requires HEATER_BED_PIN." + #endif +#endif + /** * Hephestos 2 Heated Bed Kit requirements */ diff --git a/buildroot/tests/DUE b/buildroot/tests/DUE index c43d30c76ed39..81e60c962345c 100755 --- a/buildroot/tests/DUE +++ b/buildroot/tests/DUE @@ -47,6 +47,6 @@ exec_test $1 $2 "RADDS with ABL (Bilinear), Triple Z Axis, Z_STEPPER_AUTO_ALIGN, # Test SWITCHING_EXTRUDER # restore_configs -opt_set MOTHERBOARD BOARD_RAMPS4DUE_EEF LCD_LANGUAGE fi EXTRUDERS 2 NUM_SERVOS 1 +opt_set MOTHERBOARD BOARD_RAMPS4DUE_EEF LCD_LANGUAGE fi EXTRUDERS 2 TEMP_SENSOR_BED 0 NUM_SERVOS 1 opt_enable SWITCHING_EXTRUDER ULTIMAKERCONTROLLER BEEP_ON_FEEDRATE_CHANGE POWER_LOSS_RECOVERY exec_test $1 $2 "RAMPS4DUE_EEF with SWITCHING_EXTRUDER, POWER_LOSS_RECOVERY" "$3" diff --git a/buildroot/tests/mega2560 b/buildroot/tests/mega2560 index 1490c9e4aaa4c..46de664e43b64 100755 --- a/buildroot/tests/mega2560 +++ b/buildroot/tests/mega2560 @@ -90,7 +90,7 @@ exec_test $1 $2 "E Axis Only | DOGM MarlinUI" "$3" # restore_configs opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO MIXING_STEPPERS 5 LCD_LANGUAGE ru \ - NUM_RUNOUT_SENSORS E_STEPPERS REDUNDANT_PART_COOLING_FAN 1 \ + NUM_RUNOUT_SENSORS E_STEPPERS TEMP_SENSOR_BED 0 REDUNDANT_PART_COOLING_FAN 1 \ FIL_RUNOUT2_PIN 16 FIL_RUNOUT3_PIN 17 FIL_RUNOUT4_PIN 4 FIL_RUNOUT5_PIN 5 opt_enable MIXING_EXTRUDER GRADIENT_MIX GRADIENT_VTOOL CR10_STOCKDISPLAY \ USE_CONTROLLER_FAN CONTROLLER_FAN_EDITABLE CONTROLLER_FAN_IGNORE_Z \ diff --git a/buildroot/tests/rumba32 b/buildroot/tests/rumba32 index 833769d0b9ba7..c3d7603e4e8de 100755 --- a/buildroot/tests/rumba32 +++ b/buildroot/tests/rumba32 @@ -13,7 +13,7 @@ opt_set MOTHERBOARD BOARD_RUMBA32_V1_0 SERIAL_PORT -1 \ opt_disable PIDTEMP opt_enable PIDTEMPBED FAN_SOFT_PWM opt_disable THERMAL_PROTECTION_BED -exec_test $1 $2 "RUMBA32 V1.0 with TMC2130, PID Bed, and bed thermal protection disabled" "$3" +exec_test $1 $2 "RUMBA32 V1.0 with TMC2130, PID Bed, no Bed Thermal Protection" "$3" # Build examples restore_configs From ad23b8c559d55bfbc81d077a129c256c9ef9a585 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 1 Jun 2023 14:54:23 -0500 Subject: [PATCH 075/100] =?UTF-8?q?=F0=9F=9A=B8=20Probe=20Wizard=20display?= =?UTF-8?q?=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/menu/menu_probe_offset.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/lcd/menu/menu_probe_offset.cpp b/Marlin/src/lcd/menu/menu_probe_offset.cpp index 0dd118ed22309..82bf23ca842ee 100644 --- a/Marlin/src/lcd/menu/menu_probe_offset.cpp +++ b/Marlin/src/lcd/menu/menu_probe_offset.cpp @@ -59,7 +59,7 @@ void probe_offset_wizard_menu() { STATIC_ITEM(MSG_MOVE_NOZZLE_TO_BED, SS_CENTER|SS_INVERT); STATIC_ITEM_F(F("Z"), SS_CENTER, ftostr42_52(current_position.z)); - STATIC_ITEM(MSG_ZPROBE_ZOFFSET, SS_LEFT, ftostr42_52(calculated_z_offset)); + STATIC_ITEM(MSG_ZPROBE_ZOFFSET, SS_FULL, ftostr42_52(calculated_z_offset)); SUBMENU(MSG_MOVE_1MM, []{ _goto_manual_move_z( 1); }); SUBMENU(MSG_MOVE_01MM, []{ _goto_manual_move_z( 0.1f); }); From 9e0dcd4a2b6d0262ee2b09170aff0c1f21d9175e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 1 Jun 2023 16:53:02 -0500 Subject: [PATCH 076/100] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Ext?= =?UTF-8?q?UI::onLevelingStart/Done=20for=20all=20leveling=20(#25913)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp | 4 +++- .../src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp | 5 +++-- Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp | 4 +++- Marlin/src/lcd/extui/dgus/dgus_extui.cpp | 4 +++- .../src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp | 11 +++++------ .../src/lcd/extui/dgus_reloaded/DGUSSetupHandler.cpp | 2 +- .../lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp | 4 +++- Marlin/src/lcd/extui/example/example.cpp | 4 +++- .../lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp | 5 ++++- .../generic/bed_mesh_edit_screen.cpp | 2 +- .../generic/bed_mesh_view_screen.cpp | 2 +- .../src/lcd/extui/ia_creality/ia_creality_extui.cpp | 4 ++-- Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp | 2 +- Marlin/src/lcd/extui/malyan/malyan_extui.cpp | 9 ++++++--- Marlin/src/lcd/extui/nextion/nextion_extui.cpp | 4 +++- Marlin/src/lcd/extui/ui_api.cpp | 2 +- Marlin/src/lcd/extui/ui_api.h | 6 +++--- 17 files changed, 46 insertions(+), 28 deletions(-) diff --git a/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp b/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp index 27ee4689ba122..4ed0461afe0e2 100644 --- a/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp +++ b/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp @@ -104,10 +104,12 @@ namespace ExtUI { // whether successful or not. } - #if HAS_MESH + #if HAS_LEVELING void onLevelingStart() {} void onLevelingDone() {} + #endif + #if HAS_MESH void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) { // Called when any mesh points are updated //SERIAL_ECHOLNPGM("onMeshUpdate() x:", xpos, " y:", ypos, " z:", zval); diff --git a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp index 0df3bde89d50c..2bd2a458b8797 100644 --- a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp +++ b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp @@ -91,11 +91,12 @@ namespace ExtUI { // whether successful or not. } - #if HAS_MESH - + #if HAS_LEVELING void onLevelingStart() {} void onLevelingDone() {} + #endif + #if HAS_MESH void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) { // Called when any mesh points are updated } diff --git a/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp b/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp index 80e1746a2f9f7..6990a23f7b726 100644 --- a/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp +++ b/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp @@ -108,10 +108,12 @@ namespace ExtUI { // whether successful or not. } - #if HAS_MESH + #if HAS_LEVELING void onLevelingStart() {} void onLevelingDone() {} + #endif + #if HAS_MESH void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) { // Called when any mesh points are updated //SERIAL_ECHOLNPGM("onMeshUpdate() x:", xpos, " y:", ypos, " z:", zval); diff --git a/Marlin/src/lcd/extui/dgus/dgus_extui.cpp b/Marlin/src/lcd/extui/dgus/dgus_extui.cpp index 1d86d8bd558f5..ede627c3dad54 100644 --- a/Marlin/src/lcd/extui/dgus/dgus_extui.cpp +++ b/Marlin/src/lcd/extui/dgus/dgus_extui.cpp @@ -112,10 +112,12 @@ namespace ExtUI { // whether successful or not. } - #if HAS_MESH + #if HAS_LEVELING void onLevelingStart() {} void onLevelingDone() {} + #endif + #if HAS_MESH void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) { // Called when any mesh points are updated } diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp index 6a430e74a6d0f..c0f85760456a1 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp @@ -118,8 +118,7 @@ void DGUSScreenHandler::Loop() { } if (current_screen == DGUS_Screen::WAIT - && ((wait_continue && !wait_for_user) - || (!wait_continue && IsPrinterIdle())) + && ((wait_continue && !wait_for_user) || (!wait_continue && IsPrinterIdle())) ) { MoveToScreen(wait_return_screen, true); return; @@ -128,7 +127,7 @@ void DGUSScreenHandler::Loop() { if (current_screen == DGUS_Screen::LEVELING_PROBING && IsPrinterIdle()) { dgus_display.PlaySound(3); - SetStatusMessage(ExtUI::getMeshValid() ? GET_TEXT_F(DGUS_MSG_PROBING_SUCCESS) : GET_TEXT_F(DGUS_MSG_PROBING_FAILED)); + SetStatusMessage(ExtUI::getLevelingIsValid() ? GET_TEXT_F(DGUS_MSG_PROBING_SUCCESS) : GET_TEXT_F(DGUS_MSG_PROBING_FAILED)); MoveToScreen(DGUS_Screen::LEVELING_AUTOMATIC); return; @@ -190,7 +189,7 @@ void DGUSScreenHandler::StoreSettings(char *buff) { data.initialized = true; data.volume = dgus_display.GetVolume(); data.brightness = dgus_display.GetBrightness(); - data.abl_okay = (ExtUI::getLevelingActive() && ExtUI::getMeshValid()); + data.abl_okay = (ExtUI::getLevelingActive() && ExtUI::getLevelingIsValid()); memcpy(buff, &data, sizeof(data)); } @@ -206,7 +205,7 @@ void DGUSScreenHandler::LoadSettings(const char *buff) { dgus_display.SetBrightness(data.initialized ? data.brightness : DGUS_DEFAULT_BRIGHTNESS); if (data.initialized) { - leveling_active = (data.abl_okay && ExtUI::getMeshValid()); + leveling_active = (data.abl_okay && ExtUI::getLevelingIsValid()); ExtUI::setLevelingActive(leveling_active); } } @@ -247,7 +246,7 @@ void DGUSScreenHandler::MeshUpdate(const int8_t xpos, const int8_t ypos) { uint8_t point = ypos * GRID_MAX_POINTS_X + xpos; probing_icons[point < 16 ? 0 : 1] |= (1U << (point % 16)); - if (xpos >= GRID_MAX_POINTS_X - 1 && ypos >= GRID_MAX_POINTS_Y - 1 && !ExtUI::getMeshValid()) + if (xpos >= GRID_MAX_POINTS_X - 1 && ypos >= GRID_MAX_POINTS_Y - 1 && !ExtUI::getLevelingIsValid()) probing_icons[0] = probing_icons[1] = 0; TriggerFullUpdate(); diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.cpp index 3b1a38502db6a..c3b4bad88ad55 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.cpp @@ -136,7 +136,7 @@ bool DGUSSetupHandler::LevelingOffset() { } bool DGUSSetupHandler::LevelingAutomatic() { - if (ExtUI::getMeshValid()) { + if (ExtUI::getLevelingIsValid()) { dgus_screen_handler.leveling_active = true; ExtUI::setLevelingActive(true); diff --git a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp index 73dead1b56f6d..6e8f2b010067a 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp @@ -108,10 +108,12 @@ namespace ExtUI { dgus_screen_handler.ConfigurationStoreRead(success); } - #if HAS_MESH + #if HAS_LEVELING void onLevelingStart() {} void onLevelingDone() {} + #endif + #if HAS_MESH void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) { dgus_screen_handler.MeshUpdate(xpos, ypos); } diff --git a/Marlin/src/lcd/extui/example/example.cpp b/Marlin/src/lcd/extui/example/example.cpp index 83b7a0a3cabc0..b295434d842cf 100644 --- a/Marlin/src/lcd/extui/example/example.cpp +++ b/Marlin/src/lcd/extui/example/example.cpp @@ -98,10 +98,12 @@ namespace ExtUI { // whether successful or not. } - #if HAS_MESH + #if HAS_LEVELING void onLevelingStart() {} void onLevelingDone() {} + #endif + #if HAS_MESH void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) { // Called when any mesh points are updated } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp index 86f470ee19156..dc49a77ff8a38 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp @@ -117,9 +117,12 @@ namespace ExtUI { ConfirmUserRequestAlertBox::hide(); } - #if HAS_LEVELING && HAS_MESH + #if HAS_LEVELING void onLevelingStart() {} void onLevelingDone() {} + #endif + + #if HAS_MESH void onMeshUpdate(const int8_t x, const int8_t y, const_float_t val) { BedMeshViewScreen::onMeshUpdate(x, y, val); } void onMeshUpdate(const int8_t x, const int8_t y, const ExtUI::probe_state_t state) { BedMeshViewScreen::onMeshUpdate(x, y, state); } #endif diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/bed_mesh_edit_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/bed_mesh_edit_screen.cpp index 37eb29a99d11a..ab6d8a89024de 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/bed_mesh_edit_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/bed_mesh_edit_screen.cpp @@ -95,7 +95,7 @@ void BedMeshEditScreen::setHighlightedValue(float value) { } void BedMeshEditScreen::moveToHighlightedValue() { - if (ExtUI::getMeshValid()) { + if (ExtUI::getLevelingIsValid()) { ExtUI::setLevelingActive(true); ExtUI::setSoftEndstopState(false); ExtUI::moveToMeshPoint(mydata.highlight, gaugeThickness + mydata.zAdjustment); diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/bed_mesh_view_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/bed_mesh_view_screen.cpp index 7b4195ff5ce38..86eab54d85b1b 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/bed_mesh_view_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/bed_mesh_view_screen.cpp @@ -125,7 +125,7 @@ void BedMeshViewScreen::onMeshUpdate(const int8_t x, const int8_t y, const ExtUI mydata.count = 0; break; case ExtUI::G29_FINISH: - if (mydata.count == GRID_MAX_POINTS && ExtUI::getMeshValid()) + if (mydata.count == GRID_MAX_POINTS && ExtUI::getLevelingIsValid()) mydata.message = GET_TEXT_F(MSG_BED_MAPPING_DONE); else mydata.message = GET_TEXT_F(MSG_BED_MAPPING_INCOMPLETE); diff --git a/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp b/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp index 4bfdfc6ec3c90..2d6c2aa96e689 100644 --- a/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp +++ b/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp @@ -311,7 +311,7 @@ void onSettingsStored(const bool success) { void onSettingsLoaded(const bool success) { #if HAS_MESH - if (ExtUI::getMeshValid()) { + if (ExtUI::getLevelingIsValid()) { uint8_t abl_probe_index = 0; for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) { @@ -371,7 +371,7 @@ void onLevelingStart() {} void onLevelingDone() { #if HAS_MESH - if (ExtUI::getMeshValid()) { + if (ExtUI::getLevelingIsValid()) { uint8_t abl_probe_index = 0; for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) { diff --git a/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp b/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp index 37ba539ff1026..3eac438bb1b70 100644 --- a/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp +++ b/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp @@ -1043,7 +1043,7 @@ void RTS::handleData() { #if HAS_MESH sendData(getLevelingActive() ? 3 : 2, AutoLevelIcon); - if (ExtUI::getMeshValid()) { + if (ExtUI::getLevelingIsValid()) { uint8_t abl_probe_index = 0; for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) { diff --git a/Marlin/src/lcd/extui/malyan/malyan_extui.cpp b/Marlin/src/lcd/extui/malyan/malyan_extui.cpp index 042062b7c9b74..f82f1f06a7de2 100644 --- a/Marlin/src/lcd/extui/malyan/malyan_extui.cpp +++ b/Marlin/src/lcd/extui/malyan/malyan_extui.cpp @@ -150,11 +150,14 @@ namespace ExtUI { void onSettingsStored(const bool) {} void onSettingsLoaded(const bool) {} - #if HAS_MESH + #if HAS_LEVELING void onLevelingStart() {} void onLevelingDone() {} - void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {} - void onMeshUpdate(const int8_t xpos, const int8_t ypos, const ExtUI::probe_state_t state) {} + #endif + + #if HAS_MESH + void onMeshUpdate(const int8_t, const int8_t, const_float_t) {} + void onMeshUpdate(const int8_t, const int8_t, const ExtUI::probe_state_t) {} #endif #if ENABLED(POWER_LOSS_RECOVERY) diff --git a/Marlin/src/lcd/extui/nextion/nextion_extui.cpp b/Marlin/src/lcd/extui/nextion/nextion_extui.cpp index da3e344a35aab..b1e1997a3ac61 100644 --- a/Marlin/src/lcd/extui/nextion/nextion_extui.cpp +++ b/Marlin/src/lcd/extui/nextion/nextion_extui.cpp @@ -89,10 +89,12 @@ namespace ExtUI { // whether successful or not. } - #if HAS_MESH + #if HAS_LEVELING void onLevelingStart() {} void onLevelingDone() {} + #endif + #if HAS_MESH void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) { // Called when any mesh points are updated } diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index fb77be94afb0f..1d917df7cd62a 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -919,7 +919,7 @@ namespace ExtUI { bool getLevelingActive() { return planner.leveling_active; } void setLevelingActive(const bool state) { set_bed_leveling_enabled(state); } - bool getMeshValid() { return leveling_is_valid(); } + bool getLevelingIsValid() { return leveling_is_valid(); } #if HAS_MESH diff --git a/Marlin/src/lcd/extui/ui_api.h b/Marlin/src/lcd/extui/ui_api.h index 209635ea0944e..125c85ffa275f 100644 --- a/Marlin/src/lcd/extui/ui_api.h +++ b/Marlin/src/lcd/extui/ui_api.h @@ -172,14 +172,14 @@ namespace ExtUI { #if HAS_LEVELING bool getLevelingActive(); void setLevelingActive(const bool); - bool getMeshValid(); + bool getLevelingIsValid(); + void onLevelingStart(); + void onLevelingDone(); #if HAS_MESH bed_mesh_t& getMeshArray(); float getMeshPoint(const xy_uint8_t &pos); void setMeshPoint(const xy_uint8_t &pos, const_float_t zval); void moveToMeshPoint(const xy_uint8_t &pos, const_float_t z); - void onLevelingStart(); - void onLevelingDone(); void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval); inline void onMeshUpdate(const xy_int8_t &pos, const_float_t zval) { onMeshUpdate(pos.x, pos.y, zval); } From ded810cebfbde80ebbb64afe1f4fd277c94e12f1 Mon Sep 17 00:00:00 2001 From: EvilGremlin <22657714+EvilGremlin@users.noreply.github.com> Date: Fri, 2 Jun 2023 01:35:42 +0300 Subject: [PATCH 077/100] =?UTF-8?q?=F0=9F=8C=90=20Update=20Russian=20trans?= =?UTF-8?q?lation=20(#25840)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/language/language_ru.h | 373 +++++++++++++++++++------- 1 file changed, 278 insertions(+), 95 deletions(-) diff --git a/Marlin/src/lcd/language/language_ru.h b/Marlin/src/lcd/language/language_ru.h index 25f62173f3504..4594a1046f54f 100644 --- a/Marlin/src/lcd/language/language_ru.h +++ b/Marlin/src/lcd/language/language_ru.h @@ -52,6 +52,8 @@ namespace Language_ru { LSTR MSG_ADVANCED_SETTINGS = _UxGT("Расшир. настройки"); LSTR MSG_KILL_SUBCALL_OVERFLOW = _UxGT("Переполн. вызова"); #endif + LSTR MSG_TOOLBAR_SETUP = _UxGT("Настр. инструменты"); + LSTR MSG_OPTION_DISABLED = _UxGT("Опция отключена"); LSTR MSG_MEDIA_READ_ERROR = _UxGT("Ошибка чтения"); LSTR MSG_MEDIA_USB_REMOVED = _UxGT("USB диск удалён"); LSTR MSG_MEDIA_USB_FAILED = _UxGT("Ошибка USB диска"); @@ -91,42 +93,49 @@ namespace Language_ru { LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Смещения применены"); LSTR MSG_SELECT_ORIGIN = _UxGT("Выберите ноль"); #if LCD_WIDTH > 21 || HAS_DWIN_E3V2 - LSTR MSG_LAST_VALUE_SP = _UxGT("Последнее знач. "); + LSTR MSG_LAST_VALUE_SP = _UxGT("Последнее значение "); #else LSTR MSG_LAST_VALUE_SP = _UxGT("Послед. знач. "); #endif #if HAS_PREHEAT - LSTR MSG_PREHEAT_1 = _UxGT("Преднагрев ") PREHEAT_1_LABEL; - LSTR MSG_PREHEAT_1_H = _UxGT("Нагреть ~ ") PREHEAT_1_LABEL; - LSTR MSG_PREHEAT_1_END = _UxGT("Нагреть сопло ") PREHEAT_1_LABEL; - LSTR MSG_PREHEAT_1_END_E = _UxGT("Нагреть сопло ~") PREHEAT_1_LABEL; - LSTR MSG_PREHEAT_1_ALL = _UxGT("Нагреть всё ") PREHEAT_1_LABEL; - LSTR MSG_PREHEAT_1_BEDONLY = _UxGT("Нагреть стол ") PREHEAT_1_LABEL; - LSTR MSG_PREHEAT_1_SETTINGS = _UxGT("Правка предн. ") PREHEAT_1_LABEL; - - LSTR MSG_PREHEAT_M = _UxGT("Преднагрев $"); + LSTR MSG_PREHEAT_1 = _UxGT("Нагрев ") PREHEAT_1_LABEL; + LSTR MSG_PREHEAT_1_H = _UxGT("Нагреть ~ ") PREHEAT_1_LABEL " ~"; + LSTR MSG_PREHEAT_1_END = _UxGT("Нагреть сопло ") PREHEAT_1_LABEL _UxGT(" сопло"); + LSTR MSG_PREHEAT_1_END_E = _UxGT("Нагреть сопло ~") PREHEAT_1_LABEL _UxGT(" сопло ~");; + LSTR MSG_PREHEAT_1_ALL = _UxGT("Нагреть всё ") PREHEAT_1_LABEL _UxGT(" всё"); + LSTR MSG_PREHEAT_1_BEDONLY = _UxGT("Нагреть стол ") PREHEAT_1_LABEL _UxGT(" стол"); + LSTR MSG_PREHEAT_1_SETTINGS = _UxGT("Правка предн. ") PREHEAT_1_LABEL _UxGT(" наст."); + #ifdef PREHEAT_2_LABEL + LSTR MSG_PREHEAT_2 = _UxGT("Нагрев ") PREHEAT_2_LABEL; + LSTR MSG_PREHEAT_2_SETTINGS = _UxGT("Нагрев ") PREHEAT_2_LABEL _UxGT(" настр."); + #endif + #ifdef PREHEAT_3_LABEL + LSTR MSG_PREHEAT_3 = _UxGT("Нагрев ") PREHEAT_3_LABEL; + LSTR MSG_PREHEAT_3_SETTINGS = _UxGT("Нагрев ") PREHEAT_3_LABEL _UxGT(" настр."); + #endif + LSTR MSG_PREHEAT_M = _UxGT("Нагрев $"); LSTR MSG_PREHEAT_M_H = _UxGT("Нагреть ~ $"); LSTR MSG_PREHEAT_M_END = _UxGT("Нагреть сопло $"); LSTR MSG_PREHEAT_M_END_E = _UxGT("Нагреть сопло ~ $"); LSTR MSG_PREHEAT_M_ALL = _UxGT("Нагреть всё $"); LSTR MSG_PREHEAT_M_BEDONLY = _UxGT("Нагреть стол $"); - LSTR MSG_PREHEAT_M_SETTINGS = _UxGT("Правка преднаг. $"); + LSTR MSG_PREHEAT_M_SETTINGS = _UxGT("Настр.нагрева $"); #endif LSTR MSG_PREHEAT_CUSTOM = _UxGT("Нагрев Свой"); LSTR MSG_COOLDOWN = _UxGT("Охлаждение"); LSTR MSG_CUTTER_FREQUENCY = _UxGT("Частота"); LSTR MSG_LASER_MENU = _UxGT("Управление лазером"); #if LCD_WIDTH > 21 || HAS_DWIN_E3V2 - LSTR MSG_SPINDLE_MENU = _UxGT("Управление шпинделем"); + LSTR MSG_SPINDLE_MENU = _UxGT("Управлен.шпинделем"); LSTR MSG_LASER_TOGGLE = _UxGT("Переключить лазер"); - LSTR MSG_SPINDLE_TOGGLE = _UxGT("Переключ.шпиндель"); + LSTR MSG_SPINDLE_TOGGLE = _UxGT("Переключ. шпиндель"); LSTR MSG_SPINDLE_POWER = _UxGT("Мощность шпинделя"); LSTR MSG_LASER_POWER = _UxGT("Мощность лазера"); LSTR MSG_LASER_PULSE_MS = _UxGT("Тестовый импульс мс"); LSTR MSG_LASER_EVAC_TOGGLE = _UxGT("Переключить обдув"); LSTR MSG_SPINDLE_EVAC_TOGGLE = _UxGT("Переключить вакуум"); #else - LSTR MSG_SPINDLE_MENU = _UxGT("Управление шпинд."); + LSTR MSG_SPINDLE_MENU = _UxGT("Управл. шпинд."); LSTR MSG_LASER_TOGGLE = _UxGT("Переключ.лазер"); LSTR MSG_SPINDLE_TOGGLE = _UxGT("Переключ.шпинд"); LSTR MSG_SPINDLE_POWER = _UxGT("Мощн.шпинделя"); @@ -339,6 +348,11 @@ namespace Language_ru { LSTR MSG_MOVE_1MM = _UxGT("Движение 1мм"); LSTR MSG_MOVE_10MM = _UxGT("Движение 10мм"); LSTR MSG_MOVE_100MM = _UxGT("Движение 100mm"); + LSTR MSG_MOVE_0001IN = _UxGT("Движение 0.001in"); + LSTR MSG_MOVE_001IN = _UxGT("Движение 0.01in"); + LSTR MSG_MOVE_01IN = _UxGT("Движение 0.1in"); + LSTR MSG_MOVE_05IN = _UxGT("Движение 0.5in"); + LSTR MSG_MOVE_1IN = _UxGT("Движение 1.0in"); LSTR MSG_SPEED = _UxGT("Скорость"); LSTR MSG_MESH_Z_OFFSET = _UxGT("Z стола"); LSTR MSG_NOZZLE = _UxGT("Сопло, ") LCD_STR_DEGREE _UxGT("C"); @@ -454,10 +468,11 @@ namespace Language_ru { LSTR MSG_ERR_EEPROM_CRC = _UxGT("Сбой EEPROM: CRC"); LSTR MSG_ERR_EEPROM_SIZE = _UxGT("Сбой EEPROM: размер"); LSTR MSG_ERR_EEPROM_VERSION = _UxGT("Сбой EEPROM: версия"); + LSTR MSG_ERR_EEPROM_CORRUPT = _UxGT("Сбой EEPROM: данные"); LSTR MSG_SETTINGS_STORED = _UxGT("Параметры сохранены"); LSTR MSG_MEDIA_UPDATE = _UxGT("Обновление прошивки"); LSTR MSG_RESET_PRINTER = _UxGT("Сброс принтера"); - LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT(" Обновить"); + LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT(" Обновить"); LSTR MSG_INFO_SCREEN = _UxGT("Главный экран"); LSTR MSG_PREPARE = _UxGT("Подготовить"); LSTR MSG_TUNE = _UxGT("Настроить"); @@ -777,93 +792,261 @@ namespace Language_ru { LSTR MSG_BAD_PAGE_SPEED = _UxGT("Плохая скор.стран."); #endif - LSTR MSG_EDIT_PASSWORD = _UxGT("Редактировать пароль"); - LSTR MSG_LOGIN_REQUIRED = _UxGT("Нужен логин"); - LSTR MSG_PASSWORD_SETTINGS = _UxGT("Настройки пароля"); - LSTR MSG_ENTER_DIGIT = _UxGT("Введите цифру"); - LSTR MSG_CHANGE_PASSWORD = _UxGT("Смените пароль"); - LSTR MSG_REMOVE_PASSWORD = _UxGT("Удалить пароль"); - LSTR MSG_PASSWORD_SET = _UxGT("Пароль это "); - LSTR MSG_START_OVER = _UxGT("Старт через"); + LSTR MSG_EDIT_PASSWORD = _UxGT("Редактировать пароль"); + LSTR MSG_LOGIN_REQUIRED = _UxGT("Нужен логин"); + LSTR MSG_PASSWORD_SETTINGS = _UxGT("Настройки пароля"); + LSTR MSG_ENTER_DIGIT = _UxGT("Введите цифру"); + LSTR MSG_CHANGE_PASSWORD = _UxGT("Смените пароль"); + LSTR MSG_REMOVE_PASSWORD = _UxGT("Удалить пароль"); + LSTR MSG_PASSWORD_SET = _UxGT("Пароль это "); + LSTR MSG_START_OVER = _UxGT("Старт через"); #if LCD_WIDTH > 21 || HAS_DWIN_E3V2 - LSTR MSG_REMINDER_SAVE_SETTINGS = _UxGT("Не забудь сохранить!"); + LSTR MSG_REMINDER_SAVE_SETTINGS = _UxGT("Не забудь сохранить!"); #else - LSTR MSG_REMINDER_SAVE_SETTINGS = _UxGT("Не забудь сохранить"); + LSTR MSG_REMINDER_SAVE_SETTINGS = _UxGT("Не забудь сохранить"); #endif - LSTR MSG_PASSWORD_REMOVED = _UxGT("Пароль удалён"); + LSTR MSG_PASSWORD_REMOVED = _UxGT("Пароль удалён"); // // Filament Change screens show up to 3 lines on a 4-line display // ...or up to 2 lines on a 3-line display // - LSTR MSG_PAUSE_PRINT_PARKING = _UxGT(MSG_1_LINE("Парковка...")); + LSTR MSG_PAUSE_PRINT_PARKING = _UxGT(MSG_1_LINE("Парковка...")); #if LCD_HEIGHT >= 4 - LSTR MSG_ADVANCED_PAUSE_WAITING = _UxGT(MSG_3_LINE("Нажмите кнопку", "для продолжения", "печати")); - LSTR MSG_FILAMENT_CHANGE_INIT = _UxGT(MSG_2_LINE("Ожидайте начала", "смены филамента")); - LSTR MSG_FILAMENT_CHANGE_INSERT = _UxGT(MSG_3_LINE("Вставьте филамент", "и нажмите кнопку", "для продолжения")); - LSTR MSG_FILAMENT_CHANGE_HEAT = _UxGT(MSG_3_LINE("Нажмите кнопку", "для нагрева", "сопла...")); - LSTR MSG_FILAMENT_CHANGE_HEATING = _UxGT(MSG_2_LINE("Нагрев сопла", "Ждите...")); - LSTR MSG_FILAMENT_CHANGE_UNLOAD = _UxGT(MSG_3_LINE("Ожидайте", "выгрузки", "филамента")); - LSTR MSG_FILAMENT_CHANGE_LOAD = _UxGT(MSG_3_LINE("Ожидайте", "загрузки", "филамента")); - LSTR MSG_FILAMENT_CHANGE_PURGE = _UxGT(MSG_3_LINE("Ожидайте", "экструзии", "филамента")); - LSTR MSG_FILAMENT_CHANGE_CONT_PURGE = _UxGT(MSG_3_LINE("Нажмите кнопку", "для завершения", "прочистки филамента")); - LSTR MSG_FILAMENT_CHANGE_RESUME = _UxGT(MSG_3_LINE("Ожидайте", "возобновления", "печати")); - #else - LSTR MSG_ADVANCED_PAUSE_WAITING = _UxGT(MSG_1_LINE("Продолжить печать")); - LSTR MSG_FILAMENT_CHANGE_INIT = _UxGT(MSG_1_LINE("Ожидайте...")); - LSTR MSG_FILAMENT_CHANGE_INSERT = _UxGT(MSG_1_LINE("Вставь и нажми")); - LSTR MSG_FILAMENT_CHANGE_HEAT = _UxGT(MSG_1_LINE("Нагреть сопло")); - LSTR MSG_FILAMENT_CHANGE_HEATING = _UxGT(MSG_1_LINE("Нагрев...")); - LSTR MSG_FILAMENT_CHANGE_UNLOAD = _UxGT(MSG_1_LINE("Выгрузка...")); - LSTR MSG_FILAMENT_CHANGE_LOAD = _UxGT(MSG_1_LINE("Загрузка...")); - LSTR MSG_FILAMENT_CHANGE_PURGE = _UxGT(MSG_1_LINE("Прочистка...")); - LSTR MSG_FILAMENT_CHANGE_CONT_PURGE = _UxGT(MSG_1_LINE("Завершить прочистку")); - LSTR MSG_FILAMENT_CHANGE_RESUME = _UxGT(MSG_1_LINE("Возобновление...")); - #endif - - LSTR MSG_TMC_DRIVERS = _UxGT("Драйвера TMC"); - LSTR MSG_TMC_CURRENT = _UxGT("Ток двигателей"); - LSTR MSG_TMC_HYBRID_THRS = _UxGT("Гибридный режим"); - LSTR MSG_TMC_HOMING_THRS = _UxGT("Чувствительность"); - LSTR MSG_TMC_STEPPING_MODE = _UxGT("Режим драйвера"); - LSTR MSG_TMC_STEALTH_ENABLED = _UxGT("Тихий режим вкл"); - - LSTR MSG_SERVICE_RESET = _UxGT("Сброс"); - LSTR MSG_SERVICE_IN = _UxGT(" в:"); - LSTR MSG_BACKLASH = _UxGT("Люфт"); - LSTR MSG_BACKLASH_CORRECTION = _UxGT("Исправление"); - LSTR MSG_BACKLASH_SMOOTHING = _UxGT("Сглаживание"); - - LSTR MSG_LEVEL_X_AXIS = _UxGT("Выровнять ось X"); - LSTR MSG_AUTO_CALIBRATE = _UxGT("Автокалибровка"); - LSTR MSG_HEATER_TIMEOUT = _UxGT("Таймаут нагрева"); - LSTR MSG_REHEAT = _UxGT("Возобновить нагрев"); - LSTR MSG_REHEATING = _UxGT("Нагрев..."); - - LSTR MSG_PROBE_WIZARD = _UxGT("Мастер Z-зонда"); - #if LCD_WIDTH > 21 || HAS_DWIN_E3V2 - LSTR MSG_PROBE_WIZARD_PROBING = _UxGT("Зондиров. контр. точки Z"); - LSTR MSG_PROBE_WIZARD_MOVING = _UxGT("Движение к точке зондиров."); - #else - LSTR MSG_PROBE_WIZARD_PROBING = _UxGT("Зондир.контр.точки Z"); - LSTR MSG_PROBE_WIZARD_MOVING = _UxGT("Движ. к точке зондир."); - #endif - - LSTR MSG_SOUND = _UxGT("Звук"); - - LSTR MSG_TOP_LEFT = _UxGT("Верхний левый"); - LSTR MSG_BOTTOM_LEFT = _UxGT("Нижний левый"); - LSTR MSG_TOP_RIGHT = _UxGT("Верхний правый"); - LSTR MSG_BOTTOM_RIGHT = _UxGT("Нижний правый"); - LSTR MSG_CALIBRATION_COMPLETED = _UxGT("Калибровка успешна"); - LSTR MSG_CALIBRATION_FAILED = _UxGT("Ошибка калибровки"); - - LSTR MSG_DRIVER_BACKWARD = _UxGT(" драйвер наоборот"); - - LSTR MSG_SD_CARD = _UxGT("SD Карта"); - LSTR MSG_USB_DISK = _UxGT("USB Диск"); - - LSTR MSG_SHORT_DAY = _UxGT("д"); // One character only - LSTR MSG_SHORT_HOUR = _UxGT("ч"); // One character only - LSTR MSG_SHORT_MINUTE = _UxGT("м"); // One character only + LSTR MSG_ADVANCED_PAUSE_WAITING = _UxGT(MSG_3_LINE("Нажмите кнопку", "для продолжения", "печати")); + LSTR MSG_FILAMENT_CHANGE_INIT = _UxGT(MSG_2_LINE("Ожидайте начала", "смены филамента")); + LSTR MSG_FILAMENT_CHANGE_INSERT = _UxGT(MSG_3_LINE("Вставьте филамент", "и нажмите кнопку", "для продолжения")); + LSTR MSG_FILAMENT_CHANGE_HEAT = _UxGT(MSG_3_LINE("Нажмите кнопку", "для нагрева", "сопла...")); + LSTR MSG_FILAMENT_CHANGE_HEATING = _UxGT(MSG_2_LINE("Нагрев сопла", "Ждите...")); + LSTR MSG_FILAMENT_CHANGE_UNLOAD = _UxGT(MSG_3_LINE("Ожидайте", "выгрузки", "филамента")); + LSTR MSG_FILAMENT_CHANGE_LOAD = _UxGT(MSG_3_LINE("Ожидайте", "загрузки", "филамента")); + LSTR MSG_FILAMENT_CHANGE_PURGE = _UxGT(MSG_3_LINE("Ожидайте", "экструзии", "филамента")); + LSTR MSG_FILAMENT_CHANGE_CONT_PURGE = _UxGT(MSG_3_LINE("Нажмите кнопку", "для завершения", "прочистки филамента")); + LSTR MSG_FILAMENT_CHANGE_RESUME = _UxGT(MSG_3_LINE("Ожидайте", "возобновления", "печати")); + #else + LSTR MSG_ADVANCED_PAUSE_WAITING = _UxGT(MSG_1_LINE("Продолжить печать")); + LSTR MSG_FILAMENT_CHANGE_INIT = _UxGT(MSG_1_LINE("Ожидайте...")); + LSTR MSG_FILAMENT_CHANGE_INSERT = _UxGT(MSG_1_LINE("Вставь и нажми")); + LSTR MSG_FILAMENT_CHANGE_HEAT = _UxGT(MSG_1_LINE("Нагреть сопло")); + LSTR MSG_FILAMENT_CHANGE_HEATING = _UxGT(MSG_1_LINE("Нагрев...")); + LSTR MSG_FILAMENT_CHANGE_UNLOAD = _UxGT(MSG_1_LINE("Выгрузка...")); + LSTR MSG_FILAMENT_CHANGE_LOAD = _UxGT(MSG_1_LINE("Загрузка...")); + LSTR MSG_FILAMENT_CHANGE_PURGE = _UxGT(MSG_1_LINE("Прочистка...")); + LSTR MSG_FILAMENT_CHANGE_CONT_PURGE = _UxGT(MSG_1_LINE("Завершить прочистку")); + LSTR MSG_FILAMENT_CHANGE_RESUME = _UxGT(MSG_1_LINE("Возобновление...")); + #endif + + LSTR MSG_TMC_DRIVERS = _UxGT("Драйвера TMC"); + LSTR MSG_TMC_CURRENT = _UxGT("Ток двигателей"); + LSTR MSG_TMC_HYBRID_THRS = _UxGT("Гибридный режим"); + LSTR MSG_TMC_HOMING_THRS = _UxGT("Чувствительность"); + LSTR MSG_TMC_STEPPING_MODE = _UxGT("Режим драйвера"); + LSTR MSG_TMC_STEALTH_ENABLED = _UxGT("Тихий режим вкл"); + + LSTR MSG_SERVICE_RESET = _UxGT("Сброс"); + LSTR MSG_SERVICE_IN = _UxGT(" в:"); + LSTR MSG_BACKLASH = _UxGT("Люфт"); + LSTR MSG_BACKLASH_CORRECTION = _UxGT("Исправление"); + LSTR MSG_BACKLASH_SMOOTHING = _UxGT("Сглаживание"); + + LSTR MSG_LEVEL_X_AXIS = _UxGT("Выровнять ось X"); + LSTR MSG_AUTO_CALIBRATE = _UxGT("Автокалибровка"); + LSTR MSG_HEATER_TIMEOUT = _UxGT("Таймаут нагрева"); + LSTR MSG_REHEAT = _UxGT("Возобновить нагрев"); + LSTR MSG_REHEATING = _UxGT("Нагрев..."); + + LSTR MSG_PROBE_WIZARD = _UxGT("Мастер Z-зонда"); + #if LCD_WIDTH > 20 || HAS_DWIN_E3V2 + LSTR MSG_PROBE_WIZARD_PROBING = _UxGT("Зондиров. контр. точки Z"); + LSTR MSG_PROBE_WIZARD_MOVING = _UxGT("Движение к точке зондиров."); + #else + LSTR MSG_PROBE_WIZARD_PROBING = _UxGT("Зондир.контр.точки Z"); + LSTR MSG_PROBE_WIZARD_MOVING = _UxGT("Движ.к точке зондир."); + #endif + + LSTR MSG_SOUND = _UxGT("Звук"); + + LSTR MSG_TOP_LEFT = _UxGT("Верхний левый"); + LSTR MSG_BOTTOM_LEFT = _UxGT("Нижний левый"); + LSTR MSG_TOP_RIGHT = _UxGT("Верхний правый"); + LSTR MSG_BOTTOM_RIGHT = _UxGT("Нижний правый"); + LSTR MSG_CALIBRATION_COMPLETED = _UxGT("Калибровка успешна"); + LSTR MSG_CALIBRATION_FAILED = _UxGT("Ошибка калибровки"); + + LSTR MSG_DRIVER_BACKWARD = _UxGT(" драйвер наоборот"); + + LSTR MSG_SD_CARD = _UxGT("SD Карта"); + LSTR MSG_USB_DISK = _UxGT("USB Диск"); + + LSTR MSG_SHORT_DAY = _UxGT("д"); // One character only + LSTR MSG_SHORT_HOUR = _UxGT("ч"); // One character only + LSTR MSG_SHORT_MINUTE = _UxGT("м"); // One character only + + LSTR MSG_HIGH = _UxGT("ВЫСОКИЙ"); + LSTR MSG_LOW = _UxGT("НИЗКИЙ"); + LSTR MSG_ERROR = _UxGT("Ошибка"); + LSTR MSG_ENDSTOP_TEST = _UxGT("Тест концевиков"); + LSTR MSG_Z_PROBE = _UxGT("Z-зонд"); + LSTR MSG_HOMING = _UxGT("Парковка"); + LSTR MSG_Z_AFTER_HOME = _UxGT("Z после парковки"); + LSTR MSG_FILAMENT_SET = _UxGT("Настройки филамента"); + #if LCD_WIDTH > 20 || HAS_DWIN_E3V2 + LSTR MSG_FILAMENT_MAN = _UxGT("Управление филаментом"); + #else + LSTR MSG_FILAMENT_MAN = _UxGT("Управл.филаментом"); + #endif + LSTR MSG_MANUAL_LEVELING = _UxGT("Ручное выравнивание"); + LSTR MSG_LEVBED_FL = _UxGT("Передний левый"); + LSTR MSG_LEVBED_FR = _UxGT("Передний правый"); + LSTR MSG_LEVBED_C = _UxGT("Центр"); + LSTR MSG_LEVBED_BL = _UxGT("Задний левый"); + LSTR MSG_LEVBED_BR = _UxGT("Задний правый"); + LSTR MSG_MANUAL_MESH = _UxGT("Сетка вручную"); + LSTR MSG_AUTO_MESH = _UxGT("Сетка автоматически"); + LSTR MSG_ERR_M428_TOO_FAR = _UxGT("Ошибка: слишком далеко!"); + LSTR MSG_TRAMMING_WIZARD = _UxGT("Помощник выравнив."); + LSTR MSG_PREHEAT_HOTEND = _UxGT("Нагреть сопло"); + LSTR MSG_BED_TRAMMING_MANUAL = _UxGT("Ручное выравнив."); + LSTR MSG_MESH_VIEWER = _UxGT("Просмотр сетки"); + LSTR MSG_MESH_VIEW = _UxGT("Смотреть сетку"); + LSTR MSG_NO_VALID_MESH = _UxGT("Нет годной сетки"); + LSTR MSG_ACTIVATE_MESH = _UxGT("Включить сетку"); + LSTR MSG_MESH_INSET = _UxGT("Отступы сетки"); + LSTR MSG_MESH_MIN_X = _UxGT("Сетка X минимум"); + LSTR MSG_MESH_MAX_X = _UxGT("Сетка X максимум"); + LSTR MSG_MESH_MIN_Y = _UxGT("Сетка Y минимум"); + LSTR MSG_MESH_MAX_Y = _UxGT("Сетка Y максимум"); + LSTR MSG_MESH_AMAX = _UxGT("Максимальная зона"); + LSTR MSG_MESH_CENTER = _UxGT("Центрировать зону"); + LSTR MSG_MESH_CANCEL = _UxGT("Сетка отменена"); + LSTR MSG_UBL_TILT_MESH = _UxGT("Наколнить сетку"); + LSTR MSG_UBL_TILTING_GRID = _UxGT("Величина наклона"); + LSTR MSG_UBL_MESH_TILTED = _UxGT("Сетка наклонена"); + LSTR MSG_UBL_MESH_FILLED = _UxGT("Попущенные точки заполнены"); + LSTR MSG_UBL_MESH_INVALID = _UxGT("Негодная сетка"); + LSTR MSG_UBL_INVALID_SLOT = _UxGT("Сперва выберите слот сетки"); + LSTR MSG_MESH_ACTIVE = _UxGT("Сетка %i активна"); + LSTR MSG_MOVE_50MM = _UxGT("Двигать 50mm"); + LSTR MSG_LIVE_MOVE = _UxGT("Живое перемещение"); + LSTR MSG_CUTTER = _UxGT("Резак"); + LSTR MSG_PID_CYCLE = _UxGT("Циклы PID"); + LSTR MSG_PID_AUTOTUNE_FAILED = _UxGT("Автонастройка PID не удалась!"); + LSTR MSG_BAD_HEATER_ID = _UxGT("Неверный экструдер."); + LSTR MSG_TEMP_TOO_HIGH = _UxGT("Слишком высокая температура."); + LSTR MSG_TIMEOUT = _UxGT("Таймаут."); + LSTR MSG_MPC_MEASURING_AMBIENT = _UxGT("Тест потери тепла"); + LSTR MSG_MPC_HEATING_PAST_200 = _UxGT("Нагрев выше >200C"); + LSTR MSG_MPC_COOLING_TO_AMBIENT = _UxGT("Охлаждение до окружающей"); + LSTR MSG_MPC_AUTOTUNE = _UxGT("Автонастройка MPC"); + LSTR MSG_MPC_EDIT = _UxGT("Изменить * MPC"); + LSTR MSG_MPC_POWER = _UxGT("Мощность нагревателя"); + LSTR MSG_MPC_POWER_E = _UxGT("Мощность *"); + LSTR MSG_MPC_BLOCK_HEAT_CAPACITY = _UxGT("Теплоёмкость"); + LSTR MSG_MPC_BLOCK_HEAT_CAPACITY_E = _UxGT("Теплоёмк. *"); + LSTR MSG_SENSOR_RESPONSIVENESS = _UxGT("Отклик датчика"); + LSTR MSG_SENSOR_RESPONSIVENESS_E = _UxGT("Отклик датч. *"); + LSTR MSG_MPC_AMBIENT_XFER_COEFF = _UxGT("Коэфф.окружения"); + LSTR MSG_MPC_AMBIENT_XFER_COEFF_E = _UxGT("Коэфф.окруж *"); + LSTR MSG_MPC_AMBIENT_XFER_COEFF_FAN = _UxGT("Коэфф.кулера"); + LSTR MSG_MPC_AMBIENT_XFER_COEFF_FAN_E = _UxGT("Коэфф.кулер *"); + LSTR MSG_INPUT_SHAPING = _UxGT("Input Shaping"); + LSTR MSG_SHAPING_ENABLE = _UxGT("Включить шейпинг @"); + LSTR MSG_SHAPING_DISABLE = _UxGT("Выключить шейпинг @"); + LSTR MSG_SHAPING_FREQ = _UxGT("@ частота"); + LSTR MSG_SHAPING_ZETA = _UxGT("@ подавление"); + LSTR MSG_FILAMENT_EN = _UxGT("Филамент *"); + LSTR MSG_SEGMENTS_PER_SECOND = _UxGT("Сегментов/сек"); + LSTR MSG_DRAW_MIN_X = _UxGT("Рисовать мин X"); + LSTR MSG_DRAW_MAX_X = _UxGT("Рисовать макс X"); + LSTR MSG_DRAW_MIN_Y = _UxGT("Рисовать мин Y"); + LSTR MSG_DRAW_MAX_Y = _UxGT("Рисовать макс Y"); + LSTR MSG_MAX_BELT_LEN = _UxGT("Макс.длина ремня"); + LSTR MSG_LINEAR_ADVANCE = _UxGT("Linear Advance"); + LSTR MSG_BRIGHTNESS = _UxGT("Яркость LCD"); + LSTR MSG_SCREEN_TIMEOUT = _UxGT("Таймаут LCD (м)"); + LSTR MSG_BRIGHTNESS_OFF = _UxGT("Выкл.подсветку"); + LSTR MSG_INFO_MACHINENAME = _UxGT("Название машины"); + LSTR MSG_INFO_SIZE = _UxGT("Размер"); + LSTR MSG_INFO_FWVERSION = _UxGT("Версия прошивки"); + LSTR MSG_INFO_BUILD = _UxGT("Дата сборки"); + LSTR MSG_BUTTON_CONFIRM = _UxGT("Подтвердить"); + LSTR MSG_BUTTON_CONTINUE = _UxGT("Продолжить"); + LSTR MSG_BUTTON_INFO = _UxGT("Инфо"); + LSTR MSG_BUTTON_LEVEL = _UxGT("Выровнять"); + LSTR MSG_BUTTON_PAUSE = _UxGT("Пауза"); + LSTR MSG_BUTTON_RESUME = _UxGT("Продолжить"); + LSTR MSG_BUTTON_ADVANCED = _UxGT("Расширанные"); + LSTR MSG_BUTTON_SAVE = _UxGT("Сохранить"); + LSTR MSG_BUTTON_PURGE = _UxGT("Прочистить"); + LSTR MSG_PAUSING = _UxGT("Пауза..."); + LSTR MSG_ADVANCED_PAUSE = _UxGT("Расширенная пауза"); + LSTR MSG_CONTINUE_PRINT_JOB = _UxGT("Продолжить печать"); + LSTR MSG_TURN_OFF = _UxGT("Выключить принтер"); + LSTR MSG_END_LOOPS = _UxGT("Завершить петлю"); + LSTR MSG_STOPPING = _UxGT("Остановка..."); + LSTR MSG_REMAINING_TIME = _UxGT("Осталось"); + LSTR MSG_PRINTER_KILLED = _UxGT("Принтер убит!"); + LSTR MSG_FWRETRACT = _UxGT("Откат принтера"); + LSTR MSG_SINGLENOZZLE_WIPE_RETRACT = _UxGT("Вытирание при откате"); + LSTR MSG_PARK_FAILED = _UxGT("Не удалось запарковать"); + LSTR MSG_FILAMENTUNLOAD = _UxGT("Выгрузить филамент"); + LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Монтировать USB"); + LSTR MSG_BLTOUCH_SPEED_MODE = _UxGT("Высокая скорость"); + LSTR MSG_MANUAL_PENUP = _UxGT("Поднять перо"); + LSTR MSG_MANUAL_PENDOWN = _UxGT("Опустить перо"); + LSTR MSG_ZPROBE_SETTINGS = _UxGT("Наторойки зонда"); + LSTR MSG_ZPROBE_MARGIN = _UxGT("Отступы зонда"); + LSTR MSG_Z_FEED_RATE = _UxGT("Скорость Z"); + LSTR MSG_ENABLE_HS_MODE = _UxGT("Включить режим ВС"); + LSTR MSG_TEMP_MALFUNCTION = _UxGT("СБОЙ ТЕМПЕРАТУРЫ"); + LSTR MSG_PLEASE_WAIT = _UxGT("Ожидайте..."); + LSTR MSG_PREHEATING = _UxGT("Нагреваю..."); + LSTR MSG_DELTA_CALIBRATION_IN_PROGRESS = _UxGT("Делаю дельта-калибровку"); + LSTR MSG_RESET_STATS = _UxGT("Сбросить статистику печати?"); + LSTR MSG_FAN_SPEED_FAULT = _UxGT("Сбой скорости кулера"); + LSTR MSG_COLORS_GET = _UxGT("Получить цвет"); + LSTR MSG_COLORS_SELECT = _UxGT("Выбрать цвета"); + LSTR MSG_COLORS_APPLIED = _UxGT("Цвета применены"); + LSTR MSG_COLORS_RED = _UxGT("Красный"); + LSTR MSG_COLORS_GREEN = _UxGT("Зелёный"); + LSTR MSG_COLORS_BLUE = _UxGT("Синий"); + LSTR MSG_COLORS_WHITE = _UxGT("Белый"); + LSTR MSG_UI_LANGUAGE = _UxGT("UI Language"); + LSTR MSG_SOUND_ENABLE = _UxGT("Включить звук"); + LSTR MSG_LOCKSCREEN = _UxGT("Блокировать экран"); + LSTR MSG_LOCKSCREEN_LOCKED = _UxGT("Принтер заблокирован,"); + LSTR MSG_LOCKSCREEN_UNLOCK = _UxGT("Крутить для разблокировки."); + LSTR MSG_PLEASE_WAIT_REBOOT = _UxGT("Ждите перезагрузки."); + LSTR MSG_MEDIA_NOT_INSERTED = _UxGT("Нет носителя."); + LSTR MSG_PLEASE_PREHEAT = _UxGT("Нагрейте сопло."); + LSTR MSG_INFO_PRINT_COUNT_RESET = _UxGT("Сбросить счетчик"); + LSTR MSG_FILAMENT_CHANGE_PURGE_CONTINUE = _UxGT("Прочистить или продолжить?"); + LSTR MSG_RUNOUT_ENABLE = _UxGT("Включить датч.филамента"); + LSTR MSG_RUNOUT_ACTIVE = _UxGT("Датч.филам. активен"); + LSTR MSG_INVERT_EXTRUDER = _UxGT("Инвертировать экструдер"); + LSTR MSG_EXTRUDER_MIN_TEMP = _UxGT("Миню темп. экструдера."); + LSTR MSG_FANCHECK = _UxGT("Пров.тахометра кулера"); + LSTR MSG_MMU2_REMOVE_AND_CLICK = _UxGT("Уберите и кликните..."); + LSTR MSG_REHEATDONE = _UxGT("Нагрето"); + LSTR MSG_XATC = _UxGT("Помощник перекоса X"); + LSTR MSG_XATC_DONE = _UxGT("Перекос Х настроен!"); + LSTR MSG_XATC_UPDATE_Z_OFFSET = _UxGT("Новое смещение Z-зонда "); + LSTR MSG_HOST_SHUTDOWN = _UxGT("Выключить хост"); + + // did not translate as there is no local terms/slang yet + LSTR MSG_FIXED_TIME_MOTION = _UxGT("Fixed-Time Motion"); + LSTR MSG_FTM_MODE = _UxGT("Motion Mode:"); + LSTR MSG_FTM_ZV = _UxGT("ZV"); + LSTR MSG_FTM_ZVD = _UxGT("ZVD"); + LSTR MSG_FTM_EI = _UxGT("EI"); + LSTR MSG_FTM_2HEI = _UxGT("2HEI"); + LSTR MSG_FTM_3HEI = _UxGT("3HEI"); + LSTR MSG_FTM_MZV = _UxGT("MZV"); + //LSTR MSG_FTM_ULENDO_FBS = _UxGT("Ulendo ФBС"); + //LSTR MSG_FTM_DISCTF = _UxGT("DISCTF"); + LSTR MSG_FTM_DYN_MODE = _UxGT("DF Mode:"); + LSTR MSG_FTM_Z_BASED = _UxGT("Z-based"); + LSTR MSG_FTM_MASS_BASED = _UxGT("Mass-based"); + LSTR MSG_FTM_BASE_FREQ_N = _UxGT("@ Base Freq."); + LSTR MSG_FTM_DFREQ_K_N = _UxGT("@ Dyn. Freq."); } From 6044cb99559e0bb29a697f346fd1507c59ffbba5 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 1 Jun 2023 17:39:08 -0500 Subject: [PATCH 078/100] =?UTF-8?q?=F0=9F=8C=90=20Remove=20unused=20string?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/language/language_de.h | 2 -- Marlin/src/lcd/language/language_en.h | 2 -- Marlin/src/lcd/language/language_it.h | 2 -- Marlin/src/lcd/language/language_ru.h | 2 -- Marlin/src/lcd/language/language_sk.h | 2 -- Marlin/src/lcd/language/language_tr.h | 2 -- 6 files changed, 12 deletions(-) diff --git a/Marlin/src/lcd/language/language_de.h b/Marlin/src/lcd/language/language_de.h index 2e75c2668b90b..3f17ca1453bbb 100644 --- a/Marlin/src/lcd/language/language_de.h +++ b/Marlin/src/lcd/language/language_de.h @@ -54,8 +54,6 @@ namespace Language_de { LSTR MSG_LCD_SOFT_ENDSTOPS = _UxGT("Software-Endstopp"); LSTR MSG_MAIN_MENU = _UxGT("Hauptmenü"); LSTR MSG_ADVANCED_SETTINGS = _UxGT("Erw. Einstellungen"); - LSTR MSG_TOOLBAR_SETUP = _UxGT("Toolbar Einstellung"); - LSTR MSG_OPTION_DISABLED = _UxGT("Option Deaktiviert"); LSTR MSG_CONFIGURATION = _UxGT("Konfiguration"); LSTR MSG_RUN_AUTO_FILES = _UxGT("Autostart"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Motoren deaktivieren"); // M84 :: Max length 19 characters diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index f74e24e93a1c0..1876b26038d8c 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -69,8 +69,6 @@ namespace Language_en { LSTR MSG_LCD_SOFT_ENDSTOPS = _UxGT("Soft Endstops"); LSTR MSG_MAIN_MENU = _UxGT("Main Menu"); 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"); diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index a6b48b0d0a1b7..e4f95bf72ce1e 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -64,8 +64,6 @@ namespace Language_it { LSTR MSG_LCD_SOFT_ENDSTOPS = _UxGT("Finecorsa Soft"); LSTR MSG_MAIN_MENU = _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"); diff --git a/Marlin/src/lcd/language/language_ru.h b/Marlin/src/lcd/language/language_ru.h index 4594a1046f54f..a8db7852ccf3d 100644 --- a/Marlin/src/lcd/language/language_ru.h +++ b/Marlin/src/lcd/language/language_ru.h @@ -52,8 +52,6 @@ namespace Language_ru { LSTR MSG_ADVANCED_SETTINGS = _UxGT("Расшир. настройки"); LSTR MSG_KILL_SUBCALL_OVERFLOW = _UxGT("Переполн. вызова"); #endif - LSTR MSG_TOOLBAR_SETUP = _UxGT("Настр. инструменты"); - LSTR MSG_OPTION_DISABLED = _UxGT("Опция отключена"); LSTR MSG_MEDIA_READ_ERROR = _UxGT("Ошибка чтения"); LSTR MSG_MEDIA_USB_REMOVED = _UxGT("USB диск удалён"); LSTR MSG_MEDIA_USB_FAILED = _UxGT("Ошибка USB диска"); diff --git a/Marlin/src/lcd/language/language_sk.h b/Marlin/src/lcd/language/language_sk.h index c7b2cef0d10c5..cea40d2406aab 100644 --- a/Marlin/src/lcd/language/language_sk.h +++ b/Marlin/src/lcd/language/language_sk.h @@ -67,8 +67,6 @@ namespace Language_sk { LSTR MSG_LCD_SOFT_ENDSTOPS = _UxGT("Soft. endstopy"); LSTR MSG_MAIN_MENU = _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"); diff --git a/Marlin/src/lcd/language/language_tr.h b/Marlin/src/lcd/language/language_tr.h index 5be21c9c565f8..63c41854477b7 100644 --- a/Marlin/src/lcd/language/language_tr.h +++ b/Marlin/src/lcd/language/language_tr.h @@ -57,8 +57,6 @@ namespace Language_tr { LSTR MSG_LCD_SOFT_ENDSTOPS = _UxGT("Yazılımsal Endstops"); LSTR MSG_MAIN_MENU = _UxGT("Ana"); LSTR MSG_ADVANCED_SETTINGS = _UxGT("Gelişmiş Ayarlar"); - LSTR MSG_TOOLBAR_SETUP = _UxGT("Araç Çubuğu Kurulumu"); - LSTR MSG_OPTION_DISABLED = _UxGT("Seçenek Devre Dışı"); LSTR MSG_CONFIGURATION = _UxGT("Yapılandırma"); LSTR MSG_RUN_AUTO_FILES = _UxGT("Oto. Başlat"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Motorları Durdur"); From 49134a9467f79037cc6ea643b8ac9634e5f7eb36 Mon Sep 17 00:00:00 2001 From: I3DBeeTech <129617321+I3DBeeTech@users.noreply.github.com> Date: Fri, 2 Jun 2023 04:58:34 +0530 Subject: [PATCH 079/100] =?UTF-8?q?=F0=9F=94=A7=20Update=20LCD=20with=20Ne?= =?UTF-8?q?oPixel=20Contrast=20(#25893)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Conditionals_post.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 5794a96b8b81b..92b4463556b38 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -472,8 +472,8 @@ #elif EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY) #define _LCD_CONTRAST_MIN 120 #define _LCD_CONTRAST_INIT 195 -#elif EITHER(MKS_MINI_12864_V3, BTT_MINI_12864_V1) - #define _LCD_CONTRAST_MIN 255 +#elif ENABLED(FYSETC_MINI_12864_2_1) + #define _LCD_CONTRAST_MIN 230 #define _LCD_CONTRAST_INIT 255 #elif ENABLED(FYSETC_MINI_12864) #define _LCD_CONTRAST_MIN 180 From 2de2185d970ce63dab078bfdd7eb9e49a64a39c2 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 2 Jun 2023 01:38:48 +0000 Subject: [PATCH 080/100] [cron] Bump distribution date (2023-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 745b738b3b510..dbb481833cada 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 "2023-05-30" +//#define STRING_DISTRIBUTION_DATE "2023-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 47b8fecd57c2e..e1e4a9a8af38f 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 "2023-05-30" + #define STRING_DISTRIBUTION_DATE "2023-06-02" #endif /** From d9659d3177ff3ffd3530fac2db850a5384b67af9 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 1 Jun 2023 22:58:17 -0500 Subject: [PATCH 081/100] =?UTF-8?q?=F0=9F=93=9D=20M122=20comment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/feature/trinamic/M122.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Marlin/src/gcode/feature/trinamic/M122.cpp b/Marlin/src/gcode/feature/trinamic/M122.cpp index 61786d51ada10..a1765bfb43b4f 100644 --- a/Marlin/src/gcode/feature/trinamic/M122.cpp +++ b/Marlin/src/gcode/feature/trinamic/M122.cpp @@ -30,6 +30,14 @@ /** * M122: Debug TMC drivers + * + * I - Flag to re-initialize stepper drivers with current settings. + * X, Y, Z, E - Flags to only report the specified axes. + * + * With TMC_DEBUG: + * V - Report raw register data. Refer to the datasheet to decipher the report. + * S - Flag to enable/disable continuous debug reporting. + * P - Interval between continuous debug reports, in milliseconds. */ void GcodeSuite::M122() { xyze_bool_t print_axis = ARRAY_N_1(LOGICAL_AXES, false); From 500415955051a3295756668b3aae3c383bc1b4bf Mon Sep 17 00:00:00 2001 From: alextrical <35117191+alextrical@users.noreply.github.com> Date: Fri, 2 Jun 2023 17:32:43 +0100 Subject: [PATCH 082/100] =?UTF-8?q?=F0=9F=94=A8=20Clarify=20env=20error=20?= =?UTF-8?q?(#25915)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/share/PlatformIO/scripts/preflight-checks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildroot/share/PlatformIO/scripts/preflight-checks.py b/buildroot/share/PlatformIO/scripts/preflight-checks.py index 3f7c97af9d783..54d7f3db55e16 100644 --- a/buildroot/share/PlatformIO/scripts/preflight-checks.py +++ b/buildroot/share/PlatformIO/scripts/preflight-checks.py @@ -72,7 +72,7 @@ def sanity_check_target(): result = check_envs("env:"+build_env, board_envs, config) if not result: - err = "Error: Build environment '%s' is incompatible with %s. Use one of these: %s" % \ + err = "Error: Build environment '%s' is incompatible with %s. Use one of these environments: %s" % \ ( build_env, motherboard, ", ".join([ e[4:] for e in board_envs if e.startswith("env:") ]) ) raise SystemExit(err) From e45eddfd6c4008d82b3aefe4764793b0669dc60a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 2 Jun 2023 12:46:23 -0500 Subject: [PATCH 083/100] =?UTF-8?q?=F0=9F=94=A8=20Fix=20pins=20debugging?= =?UTF-8?q?=20for=20Simulator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/NATIVE_SIM/pinsDebug.cpp | 45 +++++++++++++++++++++++++ Marlin/src/HAL/NATIVE_SIM/pinsDebug.h | 26 ++++---------- 2 files changed, 52 insertions(+), 19 deletions(-) create mode 100644 Marlin/src/HAL/NATIVE_SIM/pinsDebug.cpp diff --git a/Marlin/src/HAL/NATIVE_SIM/pinsDebug.cpp b/Marlin/src/HAL/NATIVE_SIM/pinsDebug.cpp new file mode 100644 index 0000000000000..e75826c58a8cf --- /dev/null +++ b/Marlin/src/HAL/NATIVE_SIM/pinsDebug.cpp @@ -0,0 +1,45 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * 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_NATIVE_SIM__ + +#include "../../inc/MarlinConfig.h" +#include "pinsDebug.h" + +int8_t ADC_pin_mode(pin_t pin) { return -1; } + +int8_t get_pin_mode(const pin_t pin) { return VALID_PIN(pin) ? 0 : -1; } + +bool GET_PINMODE(const pin_t pin) { + const int8_t pin_mode = get_pin_mode(pin); + if (pin_mode == -1 || pin_mode == ADC_pin_mode(pin)) // Invalid pin or active analog pin + return false; + + return (Gpio::getMode(pin) != 0); // Input/output state +} + +bool GET_ARRAY_IS_DIGITAL(const pin_t pin) { + return !IS_ANALOG(pin) || get_pin_mode(pin) != ADC_pin_mode(pin); +} + +void print_port(const pin_t) {} +void pwm_details(const pin_t) {} +bool pwm_status(const pin_t) { return false; } + +#endif diff --git a/Marlin/src/HAL/NATIVE_SIM/pinsDebug.h b/Marlin/src/HAL/NATIVE_SIM/pinsDebug.h index 9c53b4b0d9c9a..28821acbd07c7 100644 --- a/Marlin/src/HAL/NATIVE_SIM/pinsDebug.h +++ b/Marlin/src/HAL/NATIVE_SIM/pinsDebug.h @@ -36,22 +36,10 @@ #define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin // Active ADC function/mode/code values for PINSEL registers -constexpr int8_t ADC_pin_mode(pin_t pin) { return -1; } - -int8_t get_pin_mode(const pin_t pin) { return VALID_PIN(pin) ? 0 : -1; } - -bool GET_PINMODE(const pin_t pin) { - const int8_t pin_mode = get_pin_mode(pin); - if (pin_mode == -1 || pin_mode == ADC_pin_mode(pin)) // Invalid pin or active analog pin - return false; - - return (Gpio::getMode(pin) != 0); // Input/output state -} - -bool GET_ARRAY_IS_DIGITAL(const pin_t pin) { - return !IS_ANALOG(pin) || get_pin_mode(pin) != ADC_pin_mode(pin); -} - -void print_port(const pin_t) {} -void pwm_details(const pin_t) {} -bool pwm_status(const pin_t) { return false; } +int8_t ADC_pin_mode(pin_t pin); +int8_t get_pin_mode(const pin_t pin); +bool GET_PINMODE(const pin_t pin); +bool GET_ARRAY_IS_DIGITAL(const pin_t pin); +void print_port(const pin_t); +void pwm_details(const pin_t); +bool pwm_status(const pin_t); From bc385122e94d7eda79bdf1573a7c2071c4589da2 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 2 Jun 2023 13:34:13 -0500 Subject: [PATCH 084/100] =?UTF-8?q?=F0=9F=8E=A8=20Lowercase=20method=20/?= =?UTF-8?q?=20data=20member=20names=20(#25914)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/MarlinCore.cpp | 2 +- .../src/lcd/extui/anycubic_vyper/dgus_tft.cpp | 24 +- .../src/lcd/extui/anycubic_vyper/dgus_tft.h | 24 +- Marlin/src/lcd/extui/dgus/DGUSDisplay.cpp | 56 +- Marlin/src/lcd/extui/dgus/DGUSDisplay.h | 46 +- .../src/lcd/extui/dgus/DGUSScreenHandler.cpp | 226 +++--- Marlin/src/lcd/extui/dgus/DGUSScreenHandler.h | 2 +- .../lcd/extui/dgus/DGUSScreenHandlerBase.h | 148 ++-- Marlin/src/lcd/extui/dgus/dgus_extui.cpp | 46 +- .../lcd/extui/dgus/fysetc/DGUSDisplayDef.cpp | 212 +++--- .../lcd/extui/dgus/fysetc/DGUSDisplayDef.h | 58 +- .../extui/dgus/fysetc/DGUSScreenHandler.cpp | 88 +-- .../lcd/extui/dgus/fysetc/DGUSScreenHandler.h | 4 +- .../lcd/extui/dgus/hiprecy/DGUSDisplayDef.cpp | 208 +++--- .../lcd/extui/dgus/hiprecy/DGUSDisplayDef.h | 58 +- .../extui/dgus/hiprecy/DGUSScreenHandler.cpp | 88 +-- .../extui/dgus/hiprecy/DGUSScreenHandler.h | 4 +- .../src/lcd/extui/dgus/mks/DGUSDisplayDef.cpp | 314 ++++----- .../src/lcd/extui/dgus/mks/DGUSDisplayDef.h | 60 +- .../lcd/extui/dgus/mks/DGUSScreenHandler.cpp | 664 +++++++++--------- .../lcd/extui/dgus/mks/DGUSScreenHandler.h | 106 +-- .../lcd/extui/dgus/origin/DGUSDisplayDef.cpp | 182 ++--- .../lcd/extui/dgus/origin/DGUSDisplayDef.h | 48 +- .../extui/dgus/origin/DGUSScreenHandler.cpp | 88 +-- .../lcd/extui/dgus/origin/DGUSScreenHandler.h | 4 +- .../lcd/extui/dgus_reloaded/DGUSDisplay.cpp | 78 +- .../src/lcd/extui/dgus_reloaded/DGUSDisplay.h | 62 +- .../lcd/extui/dgus_reloaded/DGUSRxHandler.cpp | 376 +++++----- .../lcd/extui/dgus_reloaded/DGUSRxHandler.h | 90 +-- .../extui/dgus_reloaded/DGUSScreenHandler.cpp | 294 ++++---- .../extui/dgus_reloaded/DGUSScreenHandler.h | 82 +-- .../extui/dgus_reloaded/DGUSSetupHandler.cpp | 64 +- .../lcd/extui/dgus_reloaded/DGUSTxHandler.cpp | 228 +++--- .../lcd/extui/dgus_reloaded/DGUSTxHandler.h | 88 +-- .../config/{DGUS_Screen.h => DGUS_ScreenID.h} | 2 +- .../definition/DGUS_ScreenAddrList.cpp | 52 +- .../definition/DGUS_ScreenAddrList.h | 6 +- .../definition/DGUS_ScreenSetup.cpp | 34 +- .../definition/DGUS_ScreenSetup.h | 4 +- .../dgus_reloaded/definition/DGUS_VPList.cpp | 224 +++--- .../dgus_reloaded/dgus_reloaded_extui.cpp | 44 +- Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp | 92 +-- Marlin/src/lcd/tft/canvas.cpp | 52 +- Marlin/src/lcd/tft/canvas.h | 32 +- Marlin/src/lcd/tft/tft_queue.cpp | 22 +- Marlin/src/lcd/tft/tft_queue.h | 2 +- Marlin/src/libs/duration_t.h | 14 +- 47 files changed, 2352 insertions(+), 2350 deletions(-) rename Marlin/src/lcd/extui/dgus_reloaded/config/{DGUS_Screen.h => DGUS_ScreenID.h} (97%) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index f1d43e7b6093c..779dea4ca274c 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -393,7 +393,7 @@ void startOrResumeJob() { if (queue.enqueue_one(F("M1001"))) { // Keep trying until it gets queued marlin_state = MF_RUNNING; // Signal to stop trying TERN_(PASSWORD_AFTER_SD_PRINT_END, password.lock_machine()); - TERN_(DGUS_LCD_UI_MKS, ScreenHandler.SDPrintingFinished()); + TERN_(DGUS_LCD_UI_MKS, screen.sdPrintingFinished()); } } diff --git a/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp index 49609ada329a5..2ccc3a37f8f8a 100644 --- a/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp +++ b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp @@ -160,7 +160,7 @@ namespace Anycubic { tftSendLn(AC_msg_ready); } - void DgusTFT::ParamInit() { + void DgusTFT::paramInit() { #if ACDEBUG(AC_MARLIN) DEBUG_ECHOLNPGM("DgusTFT::ParamInit()"); @@ -668,7 +668,7 @@ namespace Anycubic { #if ENABLED(POWER_LOSS_RECOVERY) - void DgusTFT::PowerLoss() { + void DgusTFT::powerLoss() { // On: 5A A5 05 82 00 82 00 00 // Off: 5A A5 05 82 00 82 00 64 uint8_t data[] = { 0x5A, 0xA5, 0x05, 0x82, 0x00, 0x82, 0x00, uint8_t(recovery.enabled ? 0x00 : 0x64) }; @@ -681,12 +681,12 @@ namespace Anycubic { #endif // POWER_LOSS_RECOVERY - void DgusTFT::HomingStart() { + void DgusTFT::homingStart() { if (!isPrintingFromMedia()) ChangePageOfTFT(PAGE_CHS_HOMING); } - void DgusTFT::HomingComplete() { + void DgusTFT::homingComplete() { if (lcd_info.language == ENG && page_index_last > 120) page_index_last -= 120; @@ -720,17 +720,17 @@ namespace Anycubic { TFTSer.println(); } - void DgusTFT::SendValueToTFT(const uint16_t value, const uint16_t address) { + void DgusTFT::sendValueToTFT(const uint16_t value, const uint16_t address) { uint8_t data[] = { 0x5A, 0xA5, 0x05, 0x82, uint8_t(address >> 8), uint8_t(address & 0xFF), uint8_t(value >> 8), uint8_t(value & 0xFF) }; LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]); } - void DgusTFT::RequestValueFromTFT(const uint16_t address) { + void DgusTFT::requestValueFromTFT(const uint16_t address) { uint8_t data[] = { 0x5A, 0xA5, 0x04, 0x83, uint8_t(address >> 8), uint8_t(address & 0xFF), 0x01 }; LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]); } - void DgusTFT::SendTxtToTFT(const char *pdata, const uint16_t address) { + void DgusTFT::sendTxtToTFT(const char *pdata, const uint16_t address) { uint8_t data_len = strlen(pdata); uint8_t data[] = { 0x5A, 0xA5, uint8_t(data_len + 5), 0x82, uint8_t(address >> 8), uint8_t(address & 0xFF) }; LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]); @@ -738,17 +738,17 @@ namespace Anycubic { TFTSer.write(0xFF); TFTSer.write(0xFF); } - void DgusTFT::SendColorToTFT(const uint16_t color, const uint16_t address) { + void DgusTFT::sendColorToTFT(const uint16_t color, const uint16_t address) { uint8_t data[] = { 0x5A, 0xA5, 0x05, 0x82, uint8_t(address >> 8), uint8_t(address & 0xFF), uint8_t(color >> 8), uint8_t(color & 0xFF) }; LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]); } - void DgusTFT::SendReadNumOfTxtToTFT(const uint8_t number, const uint16_t address) { + void DgusTFT::sendReadNumOfTxtToTFT(const uint8_t number, const uint16_t address) { uint8_t data[] = { 0x5A, 0xA5, 0x04, 0x83, uint8_t(address >> 8), uint8_t(address & 0xFF), number }; LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]); } - void DgusTFT::ChangePageOfTFT(const uint16_t page_index, const bool no_send/*=false*/) { + void DgusTFT::changePageOfTFT(const uint16_t page_index, const bool no_send/*=false*/) { #if ACDEBUG(AC_MARLIN) DEBUG_ECHOLNPGM("ChangePageOfTFT: ", page_index); #endif @@ -789,7 +789,7 @@ namespace Anycubic { #endif } - void DgusTFT::FakeChangePageOfTFT(const uint16_t page_index) { + void DgusTFT::fakeChangePageOfTFT(const uint16_t page_index) { #if ACDEBUG(AC_MARLIN) if (page_index_saved != page_index_now) DEBUG_ECHOLNPGM("FakeChangePageOfTFT: ", page_index); @@ -797,7 +797,7 @@ namespace Anycubic { ChangePageOfTFT(page_index, true); } - void DgusTFT::LcdAudioSet(const bool audio_on) { + void DgusTFT::lcdAudioSet(const bool audio_on) { // On: 5A A5 07 82 00 80 5A 00 00 1A // Off: 5A A5 07 82 00 80 5A 00 00 12 uint8_t data[] = { 0x5A, 0xA5, 0x07, 0x82, 0x00, 0x80, 0x5A, 0x00, 0x00, uint8_t(audio_on ? 0x1A : 0x12) }; diff --git a/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.h b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.h index 747193dd77f5f..63803d209fbac 100644 --- a/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.h +++ b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.h @@ -357,7 +357,7 @@ namespace Anycubic { static uint16_t page_index_now; static void startup(); - static void ParamInit(); + static void paramInit(); static void idleLoop(); static void printerKilled(FSTR_P,FSTR_P); static void mediaEvent(media_event_t); @@ -365,10 +365,10 @@ namespace Anycubic { static void filamentRunout(); static void confirmationRequest(const char * const); static void statusChange(const char * const); - static void PowerLoss(); + static void powerLoss(); static void powerLossRecovery(); - static void HomingStart(); - static void HomingComplete(); + static void homingStart(); + static void homingComplete(); static void set_descript_color(const uint16_t color, const uint8_t index=lcd_txtbox_index); static void set_language(language_t); @@ -462,14 +462,14 @@ namespace Anycubic { static void panelAction(uint8_t); static void panelProcess(uint8_t); - static void SendValueToTFT(const uint16_t value, const uint16_t address); - static void RequestValueFromTFT(const uint16_t address); - static void SendTxtToTFT(const char *pdata, const uint16_t address); - static void SendColorToTFT(const uint16_t color, const uint16_t address); - static void SendReadNumOfTxtToTFT(const uint8_t number, const uint16_t address); - static void ChangePageOfTFT(const uint16_t page_index, const bool no_send=false); - static void FakeChangePageOfTFT(const uint16_t page_index); - static void LcdAudioSet(const bool audio_on); + static void sendValueToTFT(const uint16_t value, const uint16_t address); + static void requestValueFromTFT(const uint16_t address); + static void sendTxtToTFT(const char *pdata, const uint16_t address); + static void sendColorToTFT(const uint16_t color, const uint16_t address); + static void sendReadNumOfTxtToTFT(const uint8_t number, const uint16_t address); + static void changePageOfTFT(const uint16_t page_index, const bool no_send=false); + static void fakeChangePageOfTFT(const uint16_t page_index); + static void lcdAudioSet(const bool audio_on); private: diff --git a/Marlin/src/lcd/extui/dgus/DGUSDisplay.cpp b/Marlin/src/lcd/extui/dgus/DGUSDisplay.cpp index 876a88891875b..8e54b20d99a15 100644 --- a/Marlin/src/lcd/extui/dgus/DGUSDisplay.cpp +++ b/Marlin/src/lcd/extui/dgus/DGUSDisplay.cpp @@ -44,9 +44,9 @@ #include "DGUSVPVariable.h" #include "DGUSDisplayDef.h" -DGUSDisplay dgusdisplay; +DGUSDisplay dgus; -#ifdef DEBUG_DGUSLCD_COMM +#ifdef DEBUG_DGUS_COMM #define DEBUGLCDCOMM_ECHOPGM DEBUG_ECHOPGM #else #define DEBUGLCDCOMM_ECHOPGM(...) NOOP @@ -63,7 +63,7 @@ constexpr uint8_t DGUS_CMD_READVAR = 0x83; bool dguslcd_local_debug; // = false; #endif -void DGUSDisplay::InitDisplay() { +void DGUSDisplay::initDisplay() { #ifndef LCD_BAUDRATE #define LCD_BAUDRATE 115200 #endif @@ -73,13 +73,13 @@ void DGUSDisplay::InitDisplay() { TERN_(DGUS_LCD_UI_MKS, delay(LOGO_TIME_DELAY)); // Show the logo for a little while } - RequestScreen(TERN(SHOW_BOOTSCREEN, DGUSLCD_SCREEN_BOOT, DGUSLCD_SCREEN_MAIN)); + requestScreen(TERN(SHOW_BOOTSCREEN, DGUS_SCREEN_BOOT, DGUS_SCREEN_MAIN)); } -void DGUSDisplay::WriteVariable(uint16_t adr, const void *values, uint8_t valueslen, bool isstr) { +void DGUSDisplay::writeVariable(uint16_t adr, const void *values, uint8_t valueslen, bool isstr) { const char* myvalues = static_cast(values); bool strend = !myvalues; - WriteHeader(adr, DGUS_CMD_WRITEVAR, valueslen); + writeHeader(adr, DGUS_CMD_WRITEVAR, valueslen); while (valueslen--) { char x; if (!strend) x = *myvalues++; @@ -91,25 +91,25 @@ void DGUSDisplay::WriteVariable(uint16_t adr, const void *values, uint8_t values } } -void DGUSDisplay::WriteVariable(uint16_t adr, uint16_t value) { +void DGUSDisplay::writeVariable(uint16_t adr, uint16_t value) { value = (value & 0xFFU) << 8U | (value >> 8U); - WriteVariable(adr, static_cast(&value), sizeof(uint16_t)); + writeVariable(adr, static_cast(&value), sizeof(uint16_t)); } -void DGUSDisplay::WriteVariable(uint16_t adr, int16_t value) { +void DGUSDisplay::writeVariable(uint16_t adr, int16_t value) { value = (value & 0xFFU) << 8U | (value >> 8U); - WriteVariable(adr, static_cast(&value), sizeof(uint16_t)); + writeVariable(adr, static_cast(&value), sizeof(uint16_t)); } -void DGUSDisplay::WriteVariable(uint16_t adr, uint8_t value) { - WriteVariable(adr, static_cast(&value), sizeof(uint8_t)); +void DGUSDisplay::writeVariable(uint16_t adr, uint8_t value) { + writeVariable(adr, static_cast(&value), sizeof(uint8_t)); } -void DGUSDisplay::WriteVariable(uint16_t adr, int8_t value) { - WriteVariable(adr, static_cast(&value), sizeof(int8_t)); +void DGUSDisplay::writeVariable(uint16_t adr, int8_t value) { + writeVariable(adr, static_cast(&value), sizeof(int8_t)); } -void DGUSDisplay::WriteVariable(uint16_t adr, long value) { +void DGUSDisplay::writeVariable(uint16_t adr, long value) { union { long l; char lb[4]; } endian; char tmp[4]; endian.l = value; @@ -117,13 +117,13 @@ void DGUSDisplay::WriteVariable(uint16_t adr, long value) { tmp[1] = endian.lb[2]; tmp[2] = endian.lb[1]; tmp[3] = endian.lb[0]; - WriteVariable(adr, static_cast(&tmp), sizeof(long)); + writeVariable(adr, static_cast(&tmp), sizeof(long)); } -void DGUSDisplay::WriteVariablePGM(uint16_t adr, const void *values, uint8_t valueslen, bool isstr) { +void DGUSDisplay::writeVariablePGM(uint16_t adr, const void *values, uint8_t valueslen, bool isstr) { const char* myvalues = static_cast(values); bool strend = !myvalues; - WriteHeader(adr, DGUS_CMD_WRITEVAR, valueslen); + writeHeader(adr, DGUS_CMD_WRITEVAR, valueslen); while (valueslen--) { char x; if (!strend) x = pgm_read_byte(myvalues++); @@ -135,7 +135,7 @@ void DGUSDisplay::WriteVariablePGM(uint16_t adr, const void *values, uint8_t val } } -void DGUSDisplay::ProcessRx() { +void DGUSDisplay::processRx() { #if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS) if (!LCD_SERIAL.available() && LCD_SERIAL.buffer_overruns()) { @@ -174,8 +174,8 @@ void DGUSDisplay::ProcessRx() { case DGUS_WAIT_TELEGRAM: // wait for complete datagram to arrive. if (LCD_SERIAL.available() < rx_datagram_len) return; - Initialized = true; // We've talked to it, so we defined it as initialized. - uint8_t command = LCD_SERIAL.read(); + initialized = true; // We've talked to it, so we defined it as initialized. + const uint8_t command = LCD_SERIAL.read(); //DEBUGLCDCOMM_ECHOPGM("# ", command); @@ -220,9 +220,9 @@ void DGUSDisplay::ProcessRx() { } } -size_t DGUSDisplay::GetFreeTxBuffer() { return LCD_SERIAL_TX_BUFFER_FREE(); } +size_t DGUSDisplay::getFreeTxBuffer() { return LCD_SERIAL_TX_BUFFER_FREE(); } -void DGUSDisplay::WriteHeader(uint16_t adr, uint8_t cmd, uint8_t payloadlen) { +void DGUSDisplay::writeHeader(uint16_t adr, uint8_t cmd, uint8_t payloadlen) { LCD_SERIAL.write(DGUS_HEADER1); LCD_SERIAL.write(DGUS_HEADER2); LCD_SERIAL.write(payloadlen + 3); @@ -231,29 +231,29 @@ void DGUSDisplay::WriteHeader(uint16_t adr, uint8_t cmd, uint8_t payloadlen) { LCD_SERIAL.write(adr & 0xFF); } -void DGUSDisplay::WritePGM(const char str[], uint8_t len) { +void DGUSDisplay::writePGM(const char str[], uint8_t len) { while (len--) LCD_SERIAL.write(pgm_read_byte(str++)); } void DGUSDisplay::loop() { - // Protect against recursion. ProcessRx() may indirectly call idle() when injecting G-code commands. + // Protect against recursion. processRx() may indirectly call idle() when injecting G-code commands. if (!no_reentrance) { no_reentrance = true; - ProcessRx(); + processRx(); no_reentrance = false; } } rx_datagram_state_t DGUSDisplay::rx_datagram_state = DGUS_IDLE; uint8_t DGUSDisplay::rx_datagram_len = 0; -bool DGUSDisplay::Initialized = false, +bool DGUSDisplay::initialized = false, DGUSDisplay::no_reentrance = false; // A SW memory barrier, to ensure GCC does not overoptimize loops #define sw_barrier() asm volatile("": : :"memory"); bool populate_VPVar(const uint16_t VP, DGUS_VP_Variable * const ramcopy) { - const DGUS_VP_Variable *pvp = DGUSLCD_FindVPVar(VP); + const DGUS_VP_Variable *pvp = findVPVar(VP); if (!pvp) return false; memcpy_P(ramcopy, pvp, sizeof(DGUS_VP_Variable)); return true; diff --git a/Marlin/src/lcd/extui/dgus/DGUSDisplay.h b/Marlin/src/lcd/extui/dgus/DGUSDisplay.h index c307ff44787e5..d65c30fc16b6e 100644 --- a/Marlin/src/lcd/extui/dgus/DGUSDisplay.h +++ b/Marlin/src/lcd/extui/dgus/DGUSDisplay.h @@ -30,14 +30,14 @@ #include // size_t //#define DEBUG_DGUSLCD -//#define DEBUG_DGUSLCD_COMM +//#define DEBUG_DGUS_COMM #if HAS_BED_PROBE #include "../../../module/probe.h" #endif #include "DGUSVPVariable.h" -enum DGUSLCD_Screens : uint8_t; +enum DGUS_ScreenID : uint8_t; #define DEBUG_OUT ENABLED(DEBUG_DGUSLCD) #include "../../../core/debug_out.h" @@ -57,25 +57,25 @@ class DGUSDisplay { DGUSDisplay() = default; - static void InitDisplay(); + static void initDisplay(); // Variable access. - static void WriteVariable(uint16_t adr, const void *values, uint8_t valueslen, bool isstr=false); - static void WriteVariablePGM(uint16_t adr, const void *values, uint8_t valueslen, bool isstr=false); - static void WriteVariable(uint16_t adr, int16_t value); - static void WriteVariable(uint16_t adr, uint16_t value); - static void WriteVariable(uint16_t adr, uint8_t value); - static void WriteVariable(uint16_t adr, int8_t value); - static void WriteVariable(uint16_t adr, long value); + static void writeVariable(uint16_t adr, const void *values, uint8_t valueslen, bool isstr=false); + static void writeVariablePGM(uint16_t adr, const void *values, uint8_t valueslen, bool isstr=false); + static void writeVariable(uint16_t adr, int16_t value); + static void writeVariable(uint16_t adr, uint16_t value); + static void writeVariable(uint16_t adr, uint8_t value); + static void writeVariable(uint16_t adr, int8_t value); + static void writeVariable(uint16_t adr, long value); // Utility functions for bridging ui_api and dbus template - static void SetVariable(DGUS_VP_Variable &var) { - WriteVariable(var.VP, (WireType)Getter(selector)); + static void setVariable(DGUS_VP_Variable &var) { + writeVariable(var.VP, (WireType)Getter(selector)); } template - static void GetVariable(DGUS_VP_Variable &var, void *val_ptr) { + static void getVariable(DGUS_VP_Variable &var, void *val_ptr) { uint16_t newvalue = swap16(*(uint16_t*)val_ptr); Setter(newvalue, selector); } @@ -86,39 +86,39 @@ class DGUSDisplay { // Force display into another screen. // (And trigger update of containing VPs) // (to implement a pop up message, which may not be nested) - static void RequestScreen(DGUSLCD_Screens screen); + static void requestScreen(const DGUS_ScreenID screenID); // Periodic tasks, eg. Rx-Queue handling. static void loop(); public: // Helper for users of this class to estimate if an interaction would be blocking. - static size_t GetFreeTxBuffer(); + static size_t getFreeTxBuffer(); // Checks two things: Can we confirm the presence of the display and has we initialized it. // (both boils down that the display answered to our chatting) - static bool isInitialized() { return Initialized; } + static bool isInitialized() { return initialized; } private: - static void WriteHeader(uint16_t adr, uint8_t cmd, uint8_t payloadlen); - static void WritePGM(const char str[], uint8_t len); - static void ProcessRx(); + static void writeHeader(uint16_t adr, uint8_t cmd, uint8_t payloadlen); + static void writePGM(const char str[], uint8_t len); + static void processRx(); static rx_datagram_state_t rx_datagram_state; static uint8_t rx_datagram_len; - static bool Initialized, no_reentrance; + static bool initialized, no_reentrance; }; -extern DGUSDisplay dgusdisplay; +extern DGUSDisplay dgus; // compile-time x^y constexpr float cpow(const float x, const int y) { return y == 0 ? 1.0 : x * cpow(x, y - 1); } /// -const uint16_t* DGUSLCD_FindScreenVPMapList(uint8_t screen); +const uint16_t* findScreenVPMapList(uint8_t screen); /// Find the flash address of a DGUS_VP_Variable for the VP. -const DGUS_VP_Variable* DGUSLCD_FindVPVar(const uint16_t vp); +const DGUS_VP_Variable* findVPVar(const uint16_t vp); /// Helper to populate a DGUS_VP_Variable for a given VP. Return false if not found. bool populate_VPVar(const uint16_t VP, DGUS_VP_Variable * const ramcopy); diff --git a/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp index e8abc259a21d0..d440ea5375390 100644 --- a/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp @@ -40,15 +40,15 @@ #include "../../../feature/powerloss.h" #endif -DGUSScreenHandlerClass ScreenHandler; +DGUSScreenHandlerClass screen; -uint16_t DGUSScreenHandler::ConfirmVP; +uint16_t DGUSScreenHandler::confirmVP; -DGUSLCD_Screens DGUSScreenHandler::current_screen; -DGUSLCD_Screens DGUSScreenHandler::past_screens[NUM_PAST_SCREENS]; +DGUS_ScreenID DGUSScreenHandler::current_screenID; +DGUS_ScreenID DGUSScreenHandler::past_screenIDs[NUM_PAST_SCREENS]; uint8_t DGUSScreenHandler::update_ptr; uint16_t DGUSScreenHandler::skipVP; -bool DGUSScreenHandler::ScreenComplete; +bool DGUSScreenHandler::screenComplete; void (*DGUSScreenHandler::confirm_action_cb)() = nullptr; @@ -62,42 +62,42 @@ void (*DGUSScreenHandler::confirm_action_cb)() = nullptr; filament_data_t filament_data; #endif -void DGUSScreenHandler::sendinfoscreen(PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool l4inflash) { +void DGUSScreenHandler::sendInfoScreen(PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool l4inflash) { DGUS_VP_Variable ramcopy; if (populate_VPVar(VP_MSGSTR1, &ramcopy)) { ramcopy.memadr = (void*) line1; - l1inflash ? DGUSScreenHandler::DGUSLCD_SendStringToDisplayPGM(ramcopy) : DGUSScreenHandler::DGUSLCD_SendStringToDisplay(ramcopy); + l1inflash ? DGUSScreenHandler::sendStringToDisplayPGM(ramcopy) : DGUSScreenHandler::sendStringToDisplay(ramcopy); } if (populate_VPVar(VP_MSGSTR2, &ramcopy)) { ramcopy.memadr = (void*) line2; - l2inflash ? DGUSScreenHandler::DGUSLCD_SendStringToDisplayPGM(ramcopy) : DGUSScreenHandler::DGUSLCD_SendStringToDisplay(ramcopy); + l2inflash ? DGUSScreenHandler::sendStringToDisplayPGM(ramcopy) : DGUSScreenHandler::sendStringToDisplay(ramcopy); } if (populate_VPVar(VP_MSGSTR3, &ramcopy)) { ramcopy.memadr = (void*) line3; - l3inflash ? DGUSScreenHandler::DGUSLCD_SendStringToDisplayPGM(ramcopy) : DGUSScreenHandler::DGUSLCD_SendStringToDisplay(ramcopy); + l3inflash ? DGUSScreenHandler::sendStringToDisplayPGM(ramcopy) : DGUSScreenHandler::sendStringToDisplay(ramcopy); } #ifdef VP_MSGSTR4 if (populate_VPVar(VP_MSGSTR4, &ramcopy)) { ramcopy.memadr = (void*) line4; - l4inflash ? DGUSScreenHandler::DGUSLCD_SendStringToDisplayPGM(ramcopy) : DGUSScreenHandler::DGUSLCD_SendStringToDisplay(ramcopy); + l4inflash ? DGUSScreenHandler::sendStringToDisplayPGM(ramcopy) : DGUSScreenHandler::sendStringToDisplay(ramcopy); } #endif } -void DGUSScreenHandler::HandleUserConfirmationPopUp(uint16_t VP, PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4, bool l1, bool l2, bool l3, bool l4) { - if (current_screen == DGUSLCD_SCREEN_CONFIRM) // Already showing a pop up, so we need to cancel that first. - PopToOldScreen(); +void DGUSScreenHandler::handleUserConfirmationPopUp(uint16_t VP, PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4, bool l1, bool l2, bool l3, bool l4) { + if (current_screenID == DGUS_SCREEN_CONFIRM) // Already showing a pop up, so we need to cancel that first. + popToOldScreen(); - ConfirmVP = VP; - sendinfoscreen(line1, line2, line3, line4, l1, l2, l3, l4); - GotoScreen(DGUSLCD_SCREEN_CONFIRM); + confirmVP = VP; + sendInfoScreen(line1, line2, line3, line4, l1, l2, l3, l4); + gotoScreen(DGUS_SCREEN_CONFIRM); } -void DGUSScreenHandler::setstatusmessage(const char *msg) { +void DGUSScreenHandler::setStatusMessage(const char *msg) { DGUS_VP_Variable ramcopy; if (populate_VPVar(VP_M117, &ramcopy)) { ramcopy.memadr = (void*) msg; - DGUSLCD_SendStringToDisplay(ramcopy); + sendStringToDisplay(ramcopy); } } @@ -105,46 +105,46 @@ void DGUSScreenHandler::setstatusmessagePGM(PGM_P const msg) { DGUS_VP_Variable ramcopy; if (populate_VPVar(VP_M117, &ramcopy)) { ramcopy.memadr = (void*) msg; - DGUSLCD_SendStringToDisplayPGM(ramcopy); + sendStringToDisplayPGM(ramcopy); } } // Send an 8 bit or 16 bit value to the display. -void DGUSScreenHandler::DGUSLCD_SendWordValueToDisplay(DGUS_VP_Variable &var) { +void DGUSScreenHandler::sendWordValueToDisplay(DGUS_VP_Variable &var) { if (var.memadr) { if (var.size > 1) - dgusdisplay.WriteVariable(var.VP, *(int16_t*)var.memadr); + dgus.writeVariable(var.VP, *(int16_t*)var.memadr); else - dgusdisplay.WriteVariable(var.VP, *(int8_t*)var.memadr); + dgus.writeVariable(var.VP, *(int8_t*)var.memadr); } } // Send an uint8_t between 0 and 255 to the display, but scale to a percentage (0..100) -void DGUSScreenHandler::DGUSLCD_SendPercentageToDisplay(DGUS_VP_Variable &var) { +void DGUSScreenHandler::sendPercentageToDisplay(DGUS_VP_Variable &var) { if (var.memadr) { uint16_t tmp = *(uint8_t *) var.memadr + 1; // +1 -> avoid rounding issues for the display. tmp = map(tmp, 0, 255, 0, 100); - dgusdisplay.WriteVariable(var.VP, tmp); + dgus.writeVariable(var.VP, tmp); } } // Send the current print progress to the display. -void DGUSScreenHandler::DGUSLCD_SendPrintProgressToDisplay(DGUS_VP_Variable &var) { +void DGUSScreenHandler::sendPrintProgressToDisplay(DGUS_VP_Variable &var) { uint16_t tmp = ExtUI::getProgress_percent(); - dgusdisplay.WriteVariable(var.VP, tmp); + dgus.writeVariable(var.VP, tmp); } // Send the current print time to the display. // It is using a hex display for that: It expects BSD coded data in the format xxyyzz -void DGUSScreenHandler::DGUSLCD_SendPrintTimeToDisplay(DGUS_VP_Variable &var) { +void DGUSScreenHandler::sendPrintTimeToDisplay(DGUS_VP_Variable &var) { duration_t elapsed = print_job_timer.duration(); char buf[32]; elapsed.toString(buf); - dgusdisplay.WriteVariable(VP_PrintTime, buf, var.size, true); + dgus.writeVariable(VP_PrintTime, buf, var.size, true); } // Send an uint8_t between 0 and 100 to a variable scale to 0..255 -void DGUSScreenHandler::DGUSLCD_PercentageToUint8(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandler::percentageToUint8(DGUS_VP_Variable &var, void *val_ptr) { if (var.memadr) { const uint16_t value = BE16_P(val_ptr); *(uint8_t*)var.memadr = map(constrain(value, 0, 100), 0, 100, 0, 255); @@ -154,21 +154,21 @@ void DGUSScreenHandler::DGUSLCD_PercentageToUint8(DGUS_VP_Variable &var, void *v // Sends a (RAM located) string to the DGUS Display // (Note: The DGUS Display does not clear after the \0, you have to // overwrite the remainings with spaces.// var.size has the display buffer size! -void DGUSScreenHandler::DGUSLCD_SendStringToDisplay(DGUS_VP_Variable &var) { +void DGUSScreenHandler::sendStringToDisplay(DGUS_VP_Variable &var) { char *tmp = (char*) var.memadr; - dgusdisplay.WriteVariable(var.VP, tmp, var.size, true); + dgus.writeVariable(var.VP, tmp, var.size, true); } // Sends a (flash located) string to the DGUS Display // (Note: The DGUS Display does not clear after the \0, you have to // overwrite the remainings with spaces.// var.size has the display buffer size! -void DGUSScreenHandler::DGUSLCD_SendStringToDisplayPGM(DGUS_VP_Variable &var) { +void DGUSScreenHandler::sendStringToDisplayPGM(DGUS_VP_Variable &var) { char *tmp = (char*) var.memadr; - dgusdisplay.WriteVariablePGM(var.VP, tmp, var.size, true); + dgus.writeVariablePGM(var.VP, tmp, var.size, true); } #if HAS_PID_HEATING - void DGUSScreenHandler::DGUSLCD_SendTemperaturePID(DGUS_VP_Variable &var) { + void DGUSScreenHandler::sendTemperaturePID(DGUS_VP_Variable &var) { float value = *(float *)var.memadr; value /= 10; float valuesend = 0; @@ -198,7 +198,7 @@ void DGUSScreenHandler::DGUSLCD_SendStringToDisplayPGM(DGUS_VP_Variable &var) { endian.i = valuesend; tmp[0] = endian.lb[1]; tmp[1] = endian.lb[0]; - dgusdisplay.WriteVariable(var.VP, tmp, 2); + dgus.writeVariable(var.VP, tmp, 2); } #endif @@ -206,19 +206,19 @@ void DGUSScreenHandler::DGUSLCD_SendStringToDisplayPGM(DGUS_VP_Variable &var) { // Send the accumulate print time to the display. // It is using a hex display for that: It expects BSD coded data in the format xxyyzz - void DGUSScreenHandler::DGUSLCD_SendPrintAccTimeToDisplay(DGUS_VP_Variable &var) { + void DGUSScreenHandler::sendPrintAccTimeToDisplay(DGUS_VP_Variable &var) { printStatistics state = print_job_timer.getStats(); char buf[22]; duration_t elapsed = state.printTime; elapsed.toString(buf); - dgusdisplay.WriteVariable(VP_PrintAccTime, buf, var.size, true); + dgus.writeVariable(VP_PrintAccTime, buf, var.size, true); } - void DGUSScreenHandler::DGUSLCD_SendPrintsTotalToDisplay(DGUS_VP_Variable &var) { + void DGUSScreenHandler::sendPrintsTotalToDisplay(DGUS_VP_Variable &var) { printStatistics state = print_job_timer.getStats(); char buf[10]; sprintf_P(buf, PSTR("%u"), state.totalPrints); - dgusdisplay.WriteVariable(VP_PrintsTotal, buf, var.size, true); + dgus.writeVariable(VP_PrintsTotal, buf, var.size, true); } #endif @@ -226,33 +226,33 @@ void DGUSScreenHandler::DGUSLCD_SendStringToDisplayPGM(DGUS_VP_Variable &var) { // Send fan status value to the display. #if HAS_FAN - void DGUSScreenHandler::DGUSLCD_SendFanStatusToDisplay(DGUS_VP_Variable &var) { + void DGUSScreenHandler::sendFanStatusToDisplay(DGUS_VP_Variable &var) { if (var.memadr) { uint16_t data_to_send = 0; if (*(uint8_t *) var.memadr) data_to_send = 1; - dgusdisplay.WriteVariable(var.VP, data_to_send); + dgus.writeVariable(var.VP, data_to_send); } } #endif // Send heater status value to the display. -void DGUSScreenHandler::DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var) { +void DGUSScreenHandler::sendHeaterStatusToDisplay(DGUS_VP_Variable &var) { if (var.memadr) { uint16_t data_to_send = 0; if (*(int16_t *) var.memadr) data_to_send = 1; - dgusdisplay.WriteVariable(var.VP, data_to_send); + dgus.writeVariable(var.VP, data_to_send); } } #if ENABLED(DGUS_UI_WAITING) - void DGUSScreenHandler::DGUSLCD_SendWaitingStatusToDisplay(DGUS_VP_Variable &var) { + void DGUSScreenHandler::sendWaitingStatusToDisplay(DGUS_VP_Variable &var) { // In FYSETC UI design there are 10 statuses to loop static uint16_t period = 0; static uint16_t index = 0; if (period++ > DGUS_UI_WAITING_STATUS_PERIOD) { - dgusdisplay.WriteVariable(var.VP, index); + dgus.writeVariable(var.VP, index); if (++index >= DGUS_UI_WAITING_STATUS) index = 0; period = 0; } @@ -262,11 +262,11 @@ void DGUSScreenHandler::DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var) #if HAS_MEDIA - void DGUSScreenHandler::ScreenChangeHookIfSD(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::screenChangeHookIfSD(DGUS_VP_Variable &var, void *val_ptr) { // default action executed when there is a SD card, but not printing if (ExtUI::isMediaInserted() && !ExtUI::isPrintingFromMedia()) { - ScreenChangeHook(var, val_ptr); - dgusdisplay.RequestScreen(current_screen); + screenChangeHook(var, val_ptr); + dgus.requestScreen(current_screenID); return; } @@ -274,22 +274,22 @@ void DGUSScreenHandler::DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var) // This should host e.g a print pause / print abort / print resume dialog. // This concept allows to recycle this hook for other file if (ExtUI::isPrintingFromMedia() && !card.flag.abort_sd_printing) { - GotoScreen(DGUSLCD_SCREEN_SDPRINTMANIPULATION); + gotoScreen(DGUS_SCREEN_SDPRINTMANIPULATION); return; } // Don't let the user in the dark why there is no reaction. if (!ExtUI::isMediaInserted()) { - setstatusmessage(GET_TEXT_F(MSG_NO_MEDIA)); + setStatusMessage(GET_TEXT_F(MSG_NO_MEDIA)); return; } if (card.flag.abort_sd_printing) { - setstatusmessage(GET_TEXT_F(MSG_MEDIA_ABORTING)); + setStatusMessage(GET_TEXT_F(MSG_MEDIA_ABORTING)); return; } } - void DGUSScreenHandler::DGUSLCD_SD_ScrollFilelist(DGUS_VP_Variable& var, void *val_ptr) { + void DGUSScreenHandler::sdScrollFilelist(DGUS_VP_Variable& var, void *val_ptr) { auto old_top = top_file; const int16_t scroll = (int16_t)BE16_P(val_ptr); if (scroll) { @@ -306,38 +306,38 @@ void DGUSScreenHandler::DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var) else if (!filelist.isAtRootDir()) { IF_DISABLED(DGUS_LCD_UI_MKS, filelist.upDir()); top_file = 0; - ForceCompleteUpdate(); + forceCompleteUpdate(); } - if (old_top != top_file) ForceCompleteUpdate(); + if (old_top != top_file) forceCompleteUpdate(); } - void DGUSScreenHandler::DGUSLCD_SD_ReallyAbort(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::sdReallyAbort(DGUS_VP_Variable &var, void *val_ptr) { ExtUI::stopPrint(); - GotoScreen(DGUSLCD_SCREEN_MAIN); + gotoScreen(DGUS_SCREEN_MAIN); } - void DGUSScreenHandler::DGUSLCD_SD_PrintTune(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::sdPrintTune(DGUS_VP_Variable &var, void *val_ptr) { if (!ExtUI::isPrintingFromMedia()) return; // avoid race condition when user stays in this menu and printer finishes. - GotoScreen(DGUSLCD_SCREEN_SDPRINTTUNE); + gotoScreen(DGUS_SCREEN_SDPRINTTUNE); } - void DGUSScreenHandler::SDCardError() { - DGUSScreenHandler::SDCardRemoved(); - sendinfoscreen(F("NOTICE"), nullptr, F("SD card error"), nullptr, true, true, true, true); - SetupConfirmAction(nullptr); - GotoScreen(DGUSLCD_SCREEN_POPUP); + void DGUSScreenHandler::sdCardError() { + DGUSScreenHandler::sdCardRemoved(); + sendInfoScreen(F("NOTICE"), nullptr, F("SD card error"), nullptr, true, true, true, true); + setupConfirmAction(nullptr); + gotoScreen(DGUS_SCREEN_POPUP); } #endif // HAS_MEDIA -void DGUSScreenHandler::ScreenConfirmedOK(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandler::screenConfirmedOK(DGUS_VP_Variable &var, void *val_ptr) { DGUS_VP_Variable ramcopy; - if (!populate_VPVar(ConfirmVP, &ramcopy)) return; + if (!populate_VPVar(confirmVP, &ramcopy)) return; if (ramcopy.set_by_display_handler) ramcopy.set_by_display_handler(ramcopy, val_ptr); } -const uint16_t* DGUSLCD_FindScreenVPMapList(uint8_t screen) { +const uint16_t* findScreenVPMapList(uint8_t screen) { const uint16_t *ret; const struct VPMapping *map = VPMap; while ((ret = (uint16_t*) pgm_read_ptr(&(map->VPList)))) { @@ -347,7 +347,7 @@ const uint16_t* DGUSLCD_FindScreenVPMapList(uint8_t screen) { return nullptr; } -const DGUS_VP_Variable* DGUSLCD_FindVPVar(const uint16_t vp) { +const DGUS_VP_Variable* findVPVar(const uint16_t vp) { const DGUS_VP_Variable *ret = ListOfVP; do { const uint16_t vpcheck = pgm_read_word(&(ret->VP)); @@ -359,19 +359,19 @@ const DGUS_VP_Variable* DGUSLCD_FindVPVar(const uint16_t vp) { return nullptr; } -void DGUSScreenHandler::ScreenChangeHookIfIdle(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandler::screenChangeHookIfIdle(DGUS_VP_Variable &var, void *val_ptr) { if (!ExtUI::isPrinting()) { - ScreenChangeHook(var, val_ptr); - dgusdisplay.RequestScreen(current_screen); + screenChangeHook(var, val_ptr); + dgus.requestScreen(current_screenID); } } -void DGUSScreenHandler::HandleAllHeatersOff(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandler::handleAllHeatersOff(DGUS_VP_Variable &var, void *val_ptr) { thermalManager.disable_all_heaters(); - ForceCompleteUpdate(); // hint to send all data. + forceCompleteUpdate(); // hint to send all data. } -void DGUSScreenHandler::HandleTemperatureChanged(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandler::handleTemperatureChanged(DGUS_VP_Variable &var, void *val_ptr) { celsius_t newvalue = BE16_P(val_ptr); celsius_t acceptedvalue; @@ -405,7 +405,7 @@ void DGUSScreenHandler::HandleTemperatureChanged(DGUS_VP_Variable &var, void *va skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel } -void DGUSScreenHandler::HandleFlowRateChanged(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandler::handleFlowRateChanged(DGUS_VP_Variable &var, void *val_ptr) { #if HAS_EXTRUDERS const uint16_t newvalue = BE16_P(val_ptr); uint8_t target_extruder; @@ -424,7 +424,7 @@ void DGUSScreenHandler::HandleFlowRateChanged(DGUS_VP_Variable &var, void *val_p #endif } -void DGUSScreenHandler::HandleManualExtrude(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandler::handleManualExtrude(DGUS_VP_Variable &var, void *val_ptr) { const int16_t movevalue = BE16_P(val_ptr); float target = movevalue * 0.01f; ExtUI::extruder_t target_extruder; @@ -445,17 +445,17 @@ void DGUSScreenHandler::HandleManualExtrude(DGUS_VP_Variable &var, void *val_ptr } #if ENABLED(DGUS_UI_MOVE_DIS_OPTION) - void DGUSScreenHandler::HandleManualMoveOption(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::handleManualMoveOption(DGUS_VP_Variable &var, void *val_ptr) { *(uint16_t*)var.memadr = BE16_P(val_ptr); } #endif -void DGUSScreenHandler::HandleMotorLockUnlock(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandler::handleMotorLockUnlock(DGUS_VP_Variable &var, void *val_ptr) { const int16_t lock = BE16_P(val_ptr); queue.enqueue_one_now(lock ? F("M18") : F("M17")); } -void DGUSScreenHandler::HandleSettings(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandler::handleSettings(DGUS_VP_Variable &var, void *val_ptr) { const uint16_t value = BE16_P(val_ptr); switch (value) { default: break; @@ -469,7 +469,7 @@ void DGUSScreenHandler::HandleSettings(DGUS_VP_Variable &var, void *val_ptr) { } } -void DGUSScreenHandler::HandleStepPerMMChanged(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandler::handleStepPerMMChanged(DGUS_VP_Variable &var, void *val_ptr) { const uint16_t value_raw = BE16_P(val_ptr); const float value = (float)value_raw / 10; ExtUI::axis_t axis; @@ -483,7 +483,7 @@ void DGUSScreenHandler::HandleStepPerMMChanged(DGUS_VP_Variable &var, void *val_ skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel } -void DGUSScreenHandler::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandler::handleStepPerMMExtruderChanged(DGUS_VP_Variable &var, void *val_ptr) { const uint16_t value_raw = BE16_P(val_ptr); const float value = (float)value_raw / 10; ExtUI::extruder_t extruder; @@ -501,7 +501,7 @@ void DGUSScreenHandler::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, vo } #if HAS_PID_HEATING - void DGUSScreenHandler::HandlePIDAutotune(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::handlePIDAutotune(DGUS_VP_Variable &var, void *val_ptr) { char buf[32] = {0}; switch (var.VP) { @@ -528,14 +528,14 @@ void DGUSScreenHandler::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, vo } #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); + sendInfoScreen(F("PID is autotuning"), F("please wait"), NUL_STR, NUL_STR, true, true, true, true); + gotoScreen(DGUS_SCREEN_WAITING); #endif } #endif // HAS_PID_HEATING #if HAS_BED_PROBE - void DGUSScreenHandler::HandleProbeOffsetZChanged(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::handleProbeOffsetZChanged(DGUS_VP_Variable &var, void *val_ptr) { const float offset = float(int16_t(BE16_P(val_ptr))) / 100.0f; ExtUI::setZOffset_mm(offset); skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel @@ -544,12 +544,12 @@ void DGUSScreenHandler::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, vo #endif #if HAS_FAN - void DGUSScreenHandler::HandleFanControl(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::handleFanControl(DGUS_VP_Variable &var, void *val_ptr) { *(uint8_t*)var.memadr = *(uint8_t*)var.memadr > 0 ? 0 : 255; } #endif -void DGUSScreenHandler::HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandler::handleHeaterControl(DGUS_VP_Variable &var, void *val_ptr) { uint8_t preheat_temp = 0; switch (var.VP) { #if HAS_HOTEND @@ -576,7 +576,7 @@ void DGUSScreenHandler::HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr #if ENABLED(DGUS_PREHEAT_UI) - void DGUSScreenHandler::HandlePreheat(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::handlePreheat(DGUS_VP_Variable &var, void *val_ptr) { const uint16_t preheat_option = BE16_P(val_ptr); switch (preheat_option) { default: @@ -592,48 +592,48 @@ void DGUSScreenHandler::HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr } // Go to the preheat screen to show the heating progress - GotoScreen(DGUSLCD_SCREEN_PREHEAT); + gotoScreen(DGUS_SCREEN_PREHEAT); } #endif // DGUS_PREHEAT_UI #if ENABLED(POWER_LOSS_RECOVERY) - void DGUSScreenHandler::HandlePowerLossRecovery(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::handlePowerLossRecovery(DGUS_VP_Variable &var, void *val_ptr) { uint16_t value = BE16_P(val_ptr); if (value) { queue.inject(F("M1000")); - dgusdisplay.WriteVariable(VP_SD_Print_Filename, filelist.filename(), 32, true); - GotoScreen(PLR_SCREEN_RECOVER); + dgus.writeVariable(VP_SD_Print_Filename, filelist.filename(), 32, true); + gotoScreen(PLR_SCREEN_RECOVER); } else { recovery.cancel(); - GotoScreen(PLR_SCREEN_CANCEL); + gotoScreen(PLR_SCREEN_CANCEL); } } #endif -void DGUSScreenHandler::UpdateNewScreen(DGUSLCD_Screens newscreen, bool popup) { +void DGUSScreenHandler::updateNewScreen(const DGUS_ScreenID screenID, const bool popup) { if (!popup) { - memmove(&past_screens[1], &past_screens[0], sizeof(past_screens) - 1); - past_screens[0] = current_screen; + memmove(&past_screenIDs[1], &past_screenIDs[0], sizeof(past_screenIDs) - 1); + past_screenIDs[0] = current_screenID; } - current_screen = newscreen; + current_screenID = screenID; skipVP = 0; - ForceCompleteUpdate(); + forceCompleteUpdate(); } -void DGUSScreenHandler::PopToOldScreen() { - GotoScreen(past_screens[0], true); - memmove(&past_screens[0], &past_screens[1], sizeof(past_screens) - 1); - past_screens[sizeof(past_screens) - 1] = DGUSLCD_SCREEN_MAIN; +void DGUSScreenHandler::popToOldScreen() { + gotoScreen(past_screenIDs[0], true); + memmove(&past_screenIDs[0], &past_screenIDs[1], sizeof(past_screenIDs) - 1); + past_screenIDs[sizeof(past_screenIDs) - 1] = DGUS_SCREEN_MAIN; } -void DGUSScreenHandler::UpdateScreenVPData() { - const uint16_t *VPList = DGUSLCD_FindScreenVPMapList(current_screen); +void DGUSScreenHandler::updateScreenVPData() { + const uint16_t *VPList = findScreenVPMapList(current_screenID); if (!VPList) { - ScreenComplete = true; + screenComplete = true; return; // nothing to do, likely a bug or boring screen. } @@ -645,7 +645,7 @@ void DGUSScreenHandler::UpdateScreenVPData() { uint16_t VP = pgm_read_word(VPList); if (!VP) { update_ptr = 0; - ScreenComplete = true; + screenComplete = true; return; // Screen completed. } @@ -656,12 +656,12 @@ void DGUSScreenHandler::UpdateScreenVPData() { uint8_t expected_tx = 6 + rcpy.size; // expected overhead is 6 bytes + payload. // Send the VP to the display, but try to avoid overrunning the Tx Buffer. // But send at least one VP, to avoid getting stalled. - if (rcpy.send_to_display_handler && (!sent_one || expected_tx <= dgusdisplay.GetFreeTxBuffer())) { + if (rcpy.send_to_display_handler && (!sent_one || expected_tx <= dgus.getFreeTxBuffer())) { sent_one = true; rcpy.send_to_display_handler(rcpy); } else { - ScreenComplete = false; + screenComplete = false; return; // please call again! } } @@ -669,14 +669,14 @@ void DGUSScreenHandler::UpdateScreenVPData() { } while (++update_ptr, ++VPList, true); } -void DGUSScreenHandler::GotoScreen(DGUSLCD_Screens screen, bool ispopup) { - dgusdisplay.RequestScreen(screen); - UpdateNewScreen(screen, ispopup); +void DGUSScreenHandler::gotoScreen(const DGUS_ScreenID screenID, const bool popup/*=false*/) { + dgus.requestScreen(screenID); + updateNewScreen(screenID, popup); } -void DGUSDisplay::RequestScreen(DGUSLCD_Screens screen) { - const unsigned char gotoscreen[] = { 0x5A, 0x01, (unsigned char) (screen >> 8U), (unsigned char) (screen & 0xFFU) }; - WriteVariable(0x84, gotoscreen, sizeof(gotoscreen)); +void DGUSDisplay::requestScreen(const DGUS_ScreenID screenID) { + const unsigned char gotoscreen[] = { 0x5A, 0x01, (unsigned char) (screenID >> 8U), (unsigned char) (screenID & 0xFFU) }; + writeVariable(0x84, gotoscreen, sizeof(gotoscreen)); } #endif // HAS_DGUS_LCD_CLASSIC diff --git a/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.h b/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.h index 4486105d3c4a0..cb403dbdad763 100644 --- a/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.h +++ b/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.h @@ -56,7 +56,7 @@ #include "hiprecy/DGUSScreenHandler.h" #endif -extern DGUSScreenHandlerClass ScreenHandler; +extern DGUSScreenHandlerClass screen; // Helper to define a DGUS_VP_Variable for common use-cases. #define VPHELPER(VPADR, VPADRVAR, RXFPTR, TXFPTR) { \ diff --git a/Marlin/src/lcd/extui/dgus/DGUSScreenHandlerBase.h b/Marlin/src/lcd/extui/dgus/DGUSScreenHandlerBase.h index 9ebca87be1d95..e2405bf2ef3ef 100644 --- a/Marlin/src/lcd/extui/dgus/DGUSScreenHandlerBase.h +++ b/Marlin/src/lcd/extui/dgus/DGUSScreenHandlerBase.h @@ -27,7 +27,7 @@ #include "../../../inc/MarlinConfig.h" -enum DGUSLCD_Screens : uint8_t; +enum DGUS_ScreenID : uint8_t; class DGUSScreenHandler { public: @@ -37,150 +37,150 @@ class DGUSScreenHandler { // Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen // The bools specifying whether the strings are in RAM or FLASH. - static void sendinfoscreen(PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash); - static void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) { - sendinfoscreen(FTOP(line1), FTOP(line2), line3, line4, l1inflash, l2inflash, l3inflash, liinflash); + static void sendInfoScreen(PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash); + static void sendInfoScreen(FSTR_P const line1, FSTR_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) { + sendInfoScreen(FTOP(line1), FTOP(line2), line3, line4, l1inflash, l2inflash, l3inflash, liinflash); } - static void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, FSTR_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) { - sendinfoscreen(FTOP(line1), FTOP(line2), FTOP(line3), FTOP(line4), l1inflash, l2inflash, l3inflash, liinflash); + static void sendInfoScreen(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, FSTR_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) { + sendInfoScreen(FTOP(line1), FTOP(line2), FTOP(line3), FTOP(line4), l1inflash, l2inflash, l3inflash, liinflash); } - static void HandleUserConfirmationPopUp(uint16_t ConfirmVP, PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash); + static void handleUserConfirmationPopUp(uint16_t confirmVP, PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash); // "M117" Message -- msg is a RAM ptr. - static void setstatusmessage(const char *msg); + static void setStatusMessage(const char *msg); // The same for messages from Flash static void setstatusmessagePGM(PGM_P const msg); - static void setstatusmessage(FSTR_P const fmsg) { setstatusmessagePGM(FTOP(fmsg)); } + static void setStatusMessage(FSTR_P const fmsg) { setstatusmessagePGM(FTOP(fmsg)); } // Callback for VP "Display wants to change screen on idle printer" - static void ScreenChangeHookIfIdle(DGUS_VP_Variable &var, void *val_ptr); + static void screenChangeHookIfIdle(DGUS_VP_Variable &var, void *val_ptr); // Callback for VP "Screen has been changed" - static void ScreenChangeHook(DGUS_VP_Variable &var, void *val_ptr); + static void screenChangeHook(DGUS_VP_Variable &var, void *val_ptr); // Callback for VP "All Heaters Off" - static void HandleAllHeatersOff(DGUS_VP_Variable &var, void *val_ptr); + static void handleAllHeatersOff(DGUS_VP_Variable &var, void *val_ptr); // Hook for "Change this temperature" - static void HandleTemperatureChanged(DGUS_VP_Variable &var, void *val_ptr); + static void handleTemperatureChanged(DGUS_VP_Variable &var, void *val_ptr); // Hook for "Change Flowrate" - static void HandleFlowRateChanged(DGUS_VP_Variable &var, void *val_ptr); + static void handleFlowRateChanged(DGUS_VP_Variable &var, void *val_ptr); #if ENABLED(DGUS_UI_MOVE_DIS_OPTION) // Hook for manual move option - static void HandleManualMoveOption(DGUS_VP_Variable &var, void *val_ptr); + static void handleManualMoveOption(DGUS_VP_Variable &var, void *val_ptr); #endif // Hook for manual move. - static void HandleManualMove(DGUS_VP_Variable &var, void *val_ptr); + static void handleManualMove(DGUS_VP_Variable &var, void *val_ptr); // Hook for manual extrude. - static void HandleManualExtrude(DGUS_VP_Variable &var, void *val_ptr); + static void handleManualExtrude(DGUS_VP_Variable &var, void *val_ptr); // Hook for motor lock and unlook - static void HandleMotorLockUnlock(DGUS_VP_Variable &var, void *val_ptr); + static void handleMotorLockUnlock(DGUS_VP_Variable &var, void *val_ptr); #if ENABLED(POWER_LOSS_RECOVERY) // Hook for power loss recovery. - static void HandlePowerLossRecovery(DGUS_VP_Variable &var, void *val_ptr); + static void handlePowerLossRecovery(DGUS_VP_Variable &var, void *val_ptr); #endif // Hook for settings - static void HandleSettings(DGUS_VP_Variable &var, void *val_ptr); - static void HandleStepPerMMChanged(DGUS_VP_Variable &var, void *val_ptr); - static void HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, void *val_ptr); + static void handleSettings(DGUS_VP_Variable &var, void *val_ptr); + static void handleStepPerMMChanged(DGUS_VP_Variable &var, void *val_ptr); + static void handleStepPerMMExtruderChanged(DGUS_VP_Variable &var, void *val_ptr); #if HAS_PID_HEATING // Hook for "Change this temperature PID para" - static void HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr); + static void handleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr); // Hook for PID autotune - static void HandlePIDAutotune(DGUS_VP_Variable &var, void *val_ptr); + static void handlePIDAutotune(DGUS_VP_Variable &var, void *val_ptr); #endif #if HAS_BED_PROBE // Hook for "Change probe offset z" - static void HandleProbeOffsetZChanged(DGUS_VP_Variable &var, void *val_ptr); + static void handleProbeOffsetZChanged(DGUS_VP_Variable &var, void *val_ptr); #endif #if ENABLED(BABYSTEPPING) // Hook for live z adjust action - static void HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr); + static void handleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr); #endif #if HAS_FAN // Hook for fan control - static void HandleFanControl(DGUS_VP_Variable &var, void *val_ptr); + static void handleFanControl(DGUS_VP_Variable &var, void *val_ptr); #endif // Hook for heater control - static void HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr); + static void handleHeaterControl(DGUS_VP_Variable &var, void *val_ptr); #if ENABLED(DGUS_PREHEAT_UI) // Hook for preheat - static void HandlePreheat(DGUS_VP_Variable &var, void *val_ptr); + static void handlePreheat(DGUS_VP_Variable &var, void *val_ptr); #endif #if ENABLED(DGUS_FILAMENT_LOADUNLOAD) // Hook for filament load and unload filament option - static void HandleFilamentOption(DGUS_VP_Variable &var, void *val_ptr); + static void handleFilamentOption(DGUS_VP_Variable &var, void *val_ptr); // Hook for filament load and unload - static void HandleFilamentLoadUnload(DGUS_VP_Variable &var); + static void handleFilamentLoadUnload(DGUS_VP_Variable &var); #endif #if HAS_MEDIA // Callback for VP "Display wants to change screen when there is a SD card" - static void ScreenChangeHookIfSD(DGUS_VP_Variable &var, void *val_ptr); + static void screenChangeHookIfSD(DGUS_VP_Variable &var, void *val_ptr); // Scroll buttons on the file listing screen. - static void DGUSLCD_SD_ScrollFilelist(DGUS_VP_Variable &var, void *val_ptr); + static void sdScrollFilelist(DGUS_VP_Variable &var, void *val_ptr); // File touched. - static void DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr); + static void sdFileSelected(DGUS_VP_Variable &var, void *val_ptr); // start print after confirmation received. - static void DGUSLCD_SD_StartPrint(DGUS_VP_Variable &var, void *val_ptr); + static void sdStartPrint(DGUS_VP_Variable &var, void *val_ptr); // User hit the pause, resume or abort button. - static void DGUSLCD_SD_ResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr); + static void sdResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr); // User confirmed the abort action - static void DGUSLCD_SD_ReallyAbort(DGUS_VP_Variable &var, void *val_ptr); + static void sdReallyAbort(DGUS_VP_Variable &var, void *val_ptr); // User hit the tune button - static void DGUSLCD_SD_PrintTune(DGUS_VP_Variable &var, void *val_ptr); + static void sdPrintTune(DGUS_VP_Variable &var, void *val_ptr); // Send a single filename to the display. - static void DGUSLCD_SD_SendFilename(DGUS_VP_Variable &var); + static void sdSendFilename(DGUS_VP_Variable &var); // Marlin informed us that a new SD has been inserted. - static void SDCardInserted(); + static void sdCardInserted(); // Marlin informed us that the SD Card has been removed(). - static void SDCardRemoved(); + static void sdCardRemoved(); // Marlin informed us about a bad SD Card. - static void SDCardError(); + static void sdCardError(); #endif // OK Button on the Confirm screen. - static void ScreenConfirmedOK(DGUS_VP_Variable &var, void *val_ptr); + static void screenConfirmedOK(DGUS_VP_Variable &var, void *val_ptr); - // Update data after going to a new screen (by display or by GotoScreen) + // Update data after going to a new screen (by display or by gotoScreen) // remember to store the last-displayed screen so it can be restored. // (e.g., for popup messages) - static void UpdateNewScreen(DGUSLCD_Screens newscreen, bool popup=false); + static void updateNewScreen(const DGUS_ScreenID screenID, const bool popup=false); // Recall the remembered screen. - static void PopToOldScreen(); + static void popToOldScreen(); // Make the display show the screen and update all VPs in it. - static void GotoScreen(DGUSLCD_Screens screen, bool ispopup = false); + static void gotoScreen(const DGUS_ScreenID screenID, const bool popup=false); - static void UpdateScreenVPData(); + static void updateScreenVPData(); // Helpers to convert and transfer data to the display. - static void DGUSLCD_SendWordValueToDisplay(DGUS_VP_Variable &var); - static void DGUSLCD_SendStringToDisplay(DGUS_VP_Variable &var); - static void DGUSLCD_SendStringToDisplayPGM(DGUS_VP_Variable &var); - static void DGUSLCD_SendTemperaturePID(DGUS_VP_Variable &var); - static void DGUSLCD_SendPercentageToDisplay(DGUS_VP_Variable &var); - static void DGUSLCD_SendPrintProgressToDisplay(DGUS_VP_Variable &var); - static void DGUSLCD_SendPrintTimeToDisplay(DGUS_VP_Variable &var); + static void sendWordValueToDisplay(DGUS_VP_Variable &var); + static void sendStringToDisplay(DGUS_VP_Variable &var); + static void sendStringToDisplayPGM(DGUS_VP_Variable &var); + static void sendTemperaturePID(DGUS_VP_Variable &var); + static void sendPercentageToDisplay(DGUS_VP_Variable &var); + static void sendPrintProgressToDisplay(DGUS_VP_Variable &var); + static void sendPrintTimeToDisplay(DGUS_VP_Variable &var); #if ENABLED(PRINTCOUNTER) - static void DGUSLCD_SendPrintAccTimeToDisplay(DGUS_VP_Variable &var); - static void DGUSLCD_SendPrintsTotalToDisplay(DGUS_VP_Variable &var); + static void sendPrintAccTimeToDisplay(DGUS_VP_Variable &var); + static void sendPrintsTotalToDisplay(DGUS_VP_Variable &var); #endif #if HAS_FAN - static void DGUSLCD_SendFanStatusToDisplay(DGUS_VP_Variable &var); + static void sendFanStatusToDisplay(DGUS_VP_Variable &var); #endif - static void DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var); + static void sendHeaterStatusToDisplay(DGUS_VP_Variable &var); #if ENABLED(DGUS_UI_WAITING) - static void DGUSLCD_SendWaitingStatusToDisplay(DGUS_VP_Variable &var); + static void sendWaitingStatusToDisplay(DGUS_VP_Variable &var); #endif // Send a value from 0..100 to a variable with a range from 0..255 - static void DGUSLCD_PercentageToUint8(DGUS_VP_Variable &var, void *val_ptr); + static void percentageToUint8(DGUS_VP_Variable &var, void *val_ptr); template - static void DGUSLCD_SetValueDirectly(DGUS_VP_Variable &var, void *val_ptr) { + static void setValueDirectly(DGUS_VP_Variable &var, void *val_ptr) { if (!var.memadr) return; union { unsigned char tmp[sizeof(T)]; T t; } x; unsigned char *ptr = (unsigned char*)val_ptr; @@ -192,11 +192,11 @@ class DGUSScreenHandler { // Display will get a 4-byte integer scaled to the number of digits: // Tell the display the number of digits and it cheats by displaying a dot between... template - static void DGUSLCD_SendFloatAsLongValueToDisplay(DGUS_VP_Variable &var) { + static void sendFloatAsLongValueToDisplay(DGUS_VP_Variable &var) { if (var.memadr) { float f = *(float *)var.memadr; f *= cpow(10, decimals); - dgusdisplay.WriteVariable(var.VP, (long)f); + dgus.writeVariable(var.VP, (long)f); } } @@ -204,34 +204,34 @@ class DGUSScreenHandler { // Display will get a 2-byte integer scaled to the number of digits: // Tell the display the number of digits and it cheats by displaying a dot between... template - static void DGUSLCD_SendFloatAsIntValueToDisplay(DGUS_VP_Variable &var) { + static void sendFloatAsIntValueToDisplay(DGUS_VP_Variable &var) { if (var.memadr) { float f = *(float *)var.memadr; DEBUG_ECHOLNPAIR_F(" >> ", f, 6); f *= cpow(10, decimals); - dgusdisplay.WriteVariable(var.VP, (int16_t)f); + dgus.writeVariable(var.VP, (int16_t)f); } } // Force an update of all VP on the current screen. - static void ForceCompleteUpdate() { update_ptr = 0; ScreenComplete = false; } + static void forceCompleteUpdate() { update_ptr = 0; screenComplete = false; } // Has all VPs sent to the screen - static bool IsScreenComplete() { return ScreenComplete; } + static bool isScreenComplete() { return screenComplete; } - static DGUSLCD_Screens getCurrentScreen() { return current_screen; } + static DGUS_ScreenID getCurrentScreen() { return current_screenID; } - static void SetupConfirmAction( void (*f)()) { confirm_action_cb = f; } + static void setupConfirmAction( void (*f)()) { confirm_action_cb = f; } protected: - static DGUSLCD_Screens current_screen; //< currently on screen + static DGUS_ScreenID current_screenID; //< currently on screen static constexpr uint8_t NUM_PAST_SCREENS = 4; - static DGUSLCD_Screens past_screens[NUM_PAST_SCREENS]; //< LIFO with past screens for the "back" button. + static DGUS_ScreenID past_screenIDs[NUM_PAST_SCREENS]; //< LIFO with past screens for the "back" button. static uint8_t update_ptr; //< Last sent entry in the VPList for the actual screen. static uint16_t skipVP; //< When updating the screen data, skip this one, because the user is interacting with it. - static bool ScreenComplete; //< All VPs sent to screen? + static bool screenComplete; //< All VPs sent to screen? - static uint16_t ConfirmVP; //< context for confirm screen (VP that will be emulated-sent on "OK"). + static uint16_t confirmVP; //< context for confirm screen (VP that will be emulated-sent on "OK"). #if HAS_MEDIA static int16_t top_file; //< file on top of file chooser diff --git a/Marlin/src/lcd/extui/dgus/dgus_extui.cpp b/Marlin/src/lcd/extui/dgus/dgus_extui.cpp index ede627c3dad54..30d1c710b2134 100644 --- a/Marlin/src/lcd/extui/dgus/dgus_extui.cpp +++ b/Marlin/src/lcd/extui/dgus/dgus_extui.cpp @@ -36,21 +36,21 @@ namespace ExtUI { void onStartup() { - dgusdisplay.InitDisplay(); - ScreenHandler.UpdateScreenVPData(); + dgus.initDisplay(); + screen.updateScreenVPData(); } - void onIdle() { ScreenHandler.loop(); } + void onIdle() { screen.loop(); } void onPrinterKilled(FSTR_P const error, FSTR_P const) { - ScreenHandler.sendinfoscreen(GET_TEXT_F(MSG_HALTED), error, FPSTR(NUL_STR), GET_TEXT_F(MSG_PLEASE_RESET), true, true, true, true); - ScreenHandler.GotoScreen(DGUSLCD_SCREEN_KILL); - while (!ScreenHandler.loop()); // Wait while anything is left to be sent + screen.sendInfoScreen(GET_TEXT_F(MSG_HALTED), error, FPSTR(NUL_STR), GET_TEXT_F(MSG_PLEASE_RESET), true, true, true, true); + screen.gotoScreen(DGUS_SCREEN_KILL); + while (!screen.loop()); // Wait while anything is left to be sent } - void onMediaInserted() { TERN_(HAS_MEDIA, ScreenHandler.SDCardInserted()); } - void onMediaError() { TERN_(HAS_MEDIA, ScreenHandler.SDCardError()); } - void onMediaRemoved() { TERN_(HAS_MEDIA, ScreenHandler.SDCardRemoved()); } + void onMediaInserted() { TERN_(HAS_MEDIA, screen.sdCardInserted()); } + void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); } + void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); } void onPlayTone(const uint16_t frequency, const uint16_t duration) {} void onPrintTimerStarted() {} @@ -60,17 +60,17 @@ namespace ExtUI { void onUserConfirmRequired(const char * const msg) { if (msg) { - ScreenHandler.sendinfoscreen(F("Please confirm."), nullptr, msg, nullptr, true, true, false, true); - ScreenHandler.SetupConfirmAction(setUserConfirmed); - ScreenHandler.GotoScreen(DGUSLCD_SCREEN_POPUP); + screen.sendInfoScreen(F("Please confirm."), nullptr, msg, nullptr, true, true, false, true); + screen.setupConfirmAction(setUserConfirmed); + screen.gotoScreen(DGUS_SCREEN_POPUP); } - else if (ScreenHandler.getCurrentScreen() == DGUSLCD_SCREEN_POPUP) { - ScreenHandler.SetupConfirmAction(nullptr); - ScreenHandler.PopToOldScreen(); + else if (screen.getCurrentScreen() == DGUS_SCREEN_POPUP) { + screen.setupConfirmAction(nullptr); + screen.popToOldScreen(); } } - void onStatusChanged(const char * const msg) { ScreenHandler.setstatusmessage(msg); } + void onStatusChanged(const char * const msg) { screen.setStatusMessage(msg); } void onHomingStart() {} void onHomingDone() {} @@ -136,7 +136,7 @@ namespace ExtUI { } void onPowerLossResume() { // Called on resume from power-loss - IF_DISABLED(DGUS_LCD_UI_MKS, ScreenHandler.GotoScreen(DGUSLCD_SCREEN_POWER_LOSS)); + IF_DISABLED(DGUS_LCD_UI_MKS, screen.gotoScreen(DGUS_SCREEN_POWER_LOSS)); } #endif @@ -145,22 +145,22 @@ namespace ExtUI { // Called for temperature PID tuning result switch (rst) { case PID_STARTED: - ScreenHandler.setstatusmessage(GET_TEXT_F(MSG_PID_AUTOTUNE)); + screen.setStatusMessage(GET_TEXT_F(MSG_PID_AUTOTUNE)); break; case PID_BAD_HEATER_ID: - ScreenHandler.setstatusmessage(GET_TEXT_F(MSG_PID_BAD_HEATER_ID)); + screen.setStatusMessage(GET_TEXT_F(MSG_PID_BAD_HEATER_ID)); break; case PID_TEMP_TOO_HIGH: - ScreenHandler.setstatusmessage(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH)); + screen.setStatusMessage(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH)); break; case PID_TUNING_TIMEOUT: - ScreenHandler.setstatusmessage(GET_TEXT_F(MSG_PID_TIMEOUT)); + screen.setStatusMessage(GET_TEXT_F(MSG_PID_TIMEOUT)); break; case PID_DONE: - ScreenHandler.setstatusmessage(GET_TEXT_F(MSG_PID_AUTOTUNE_DONE)); + screen.setStatusMessage(GET_TEXT_F(MSG_PID_AUTOTUNE_DONE)); break; } - ScreenHandler.GotoScreen(DGUSLCD_SCREEN_MAIN); + screen.gotoScreen(DGUS_SCREEN_MAIN); } #endif diff --git a/Marlin/src/lcd/extui/dgus/fysetc/DGUSDisplayDef.cpp b/Marlin/src/lcd/extui/dgus/fysetc/DGUSDisplayDef.cpp index 6b670368b656a..08d5387ceff3a 100644 --- a/Marlin/src/lcd/extui/dgus/fysetc/DGUSDisplayDef.cpp +++ b/Marlin/src/lcd/extui/dgus/fysetc/DGUSDisplayDef.cpp @@ -289,28 +289,28 @@ const uint16_t VPList_Z_Offset[] PROGMEM = { }; const struct VPMapping VPMap[] PROGMEM = { - { DGUSLCD_SCREEN_BOOT, VPList_Boot }, - { DGUSLCD_SCREEN_MAIN, VPList_Main }, - { DGUSLCD_SCREEN_TEMPERATURE, VPList_Temp }, - { DGUSLCD_SCREEN_STATUS, VPList_Status }, - { DGUSLCD_SCREEN_STATUS2, VPList_Status2 }, - { DGUSLCD_SCREEN_PREHEAT, VPList_Preheat }, - { DGUSLCD_SCREEN_MANUALMOVE, VPList_ManualMove }, - { DGUSLCD_SCREEN_MANUALEXTRUDE, VPList_ManualExtrude }, - { DGUSLCD_SCREEN_FILAMENT_HEATING, VPList_Filament_heating }, - { DGUSLCD_SCREEN_FILAMENT_LOADING, VPList_Filament_load_unload }, - { DGUSLCD_SCREEN_FILAMENT_UNLOADING, VPList_Filament_load_unload }, - { DGUSLCD_SCREEN_SDPRINTMANIPULATION, VPList_SD_PrintManipulation }, - { DGUSLCD_SCREEN_SDFILELIST, VPList_SDFileList }, - { DGUSLCD_SCREEN_SDPRINTTUNE, VPList_SDPrintTune }, - { DGUSLCD_SCREEN_WAITING, VPList_PIDTuningWaiting }, - { DGUSLCD_SCREEN_FLC_PREHEAT, VPList_FLCPreheat }, - { DGUSLCD_SCREEN_FLC_PRINTING, VPList_FLCPrinting }, - { DGUSLCD_SCREEN_Z_OFFSET, VPList_Z_Offset }, - { DGUSLCD_SCREEN_STEPPERMM, VPList_StepPerMM }, - { DGUSLCD_SCREEN_PID_E, VPList_PIDE0 }, - { DGUSLCD_SCREEN_PID_BED, VPList_PIDBED }, - { DGUSLCD_SCREEN_INFOS, VPList_Infos }, + { DGUS_SCREEN_BOOT, VPList_Boot }, + { DGUS_SCREEN_MAIN, VPList_Main }, + { DGUS_SCREEN_TEMPERATURE, VPList_Temp }, + { DGUS_SCREEN_STATUS, VPList_Status }, + { DGUS_SCREEN_STATUS2, VPList_Status2 }, + { DGUS_SCREEN_PREHEAT, VPList_Preheat }, + { DGUS_SCREEN_MANUALMOVE, VPList_ManualMove }, + { DGUS_SCREEN_MANUALEXTRUDE, VPList_ManualExtrude }, + { DGUS_SCREEN_FILAMENT_HEATING, VPList_Filament_heating }, + { DGUS_SCREEN_FILAMENT_LOADING, VPList_Filament_load_unload }, + { DGUS_SCREEN_FILAMENT_UNLOADING, VPList_Filament_load_unload }, + { DGUS_SCREEN_SDPRINTMANIPULATION, VPList_SD_PrintManipulation }, + { DGUS_SCREEN_SDFILELIST, VPList_SDFileList }, + { DGUS_SCREEN_SDPRINTTUNE, VPList_SDPrintTune }, + { DGUS_SCREEN_WAITING, VPList_PIDTuningWaiting }, + { DGUS_SCREEN_FLC_PREHEAT, VPList_FLCPreheat }, + { DGUS_SCREEN_FLC_PRINTING, VPList_FLCPrinting }, + { DGUS_SCREEN_Z_OFFSET, VPList_Z_Offset }, + { DGUS_SCREEN_STEPPERMM, VPList_StepPerMM }, + { DGUS_SCREEN_PID_E, VPList_PIDE0 }, + { DGUS_SCREEN_PID_BED, VPList_PIDBED }, + { DGUS_SCREEN_INFOS, VPList_Infos }, { 0 , nullptr } // List is terminated with an nullptr as table entry. }; @@ -318,159 +318,159 @@ const char MarlinVersion[] PROGMEM = SHORT_BUILD_VERSION; const struct DGUS_VP_Variable ListOfVP[] PROGMEM = { // Helper to detect touch events - VPHELPER(VP_SCREENCHANGE, nullptr, ScreenHandler.ScreenChangeHook, nullptr), - VPHELPER(VP_SCREENCHANGE_ASK, nullptr, ScreenHandler.ScreenChangeHookIfIdle, nullptr), + VPHELPER(VP_SCREENCHANGE, nullptr, screen.screenChangeHook, nullptr), + VPHELPER(VP_SCREENCHANGE_ASK, nullptr, screen.screenChangeHookIfIdle, nullptr), #if HAS_MEDIA - VPHELPER(VP_SCREENCHANGE_WHENSD, nullptr, ScreenHandler.ScreenChangeHookIfSD, nullptr), + VPHELPER(VP_SCREENCHANGE_WHENSD, nullptr, screen.screenChangeHookIfSD, nullptr), #endif - VPHELPER(VP_CONFIRMED, nullptr, ScreenHandler.ScreenConfirmedOK, nullptr), + VPHELPER(VP_CONFIRMED, nullptr, screen.screenConfirmedOK, nullptr), - VPHELPER(VP_TEMP_ALL_OFF, nullptr, ScreenHandler.HandleAllHeatersOff, nullptr), + VPHELPER(VP_TEMP_ALL_OFF, nullptr, screen.handleAllHeatersOff, nullptr), #if ENABLED(DGUS_UI_MOVE_DIS_OPTION) - VPHELPER(VP_MOVE_OPTION, &distanceToMove, ScreenHandler.HandleManualMoveOption, nullptr), + VPHELPER(VP_MOVE_OPTION, &distanceToMove, screen.handleManualMoveOption, nullptr), #endif #if ENABLED(DGUS_UI_MOVE_DIS_OPTION) - VPHELPER(VP_MOVE_X, &distanceToMove, ScreenHandler.HandleManualMove, nullptr), - VPHELPER(VP_MOVE_Y, &distanceToMove, ScreenHandler.HandleManualMove, nullptr), - VPHELPER(VP_MOVE_Z, &distanceToMove, ScreenHandler.HandleManualMove, nullptr), - VPHELPER(VP_HOME_ALL, &distanceToMove, ScreenHandler.HandleManualMove, nullptr), + VPHELPER(VP_MOVE_X, &distanceToMove, screen.handleManualMove, nullptr), + VPHELPER(VP_MOVE_Y, &distanceToMove, screen.handleManualMove, nullptr), + VPHELPER(VP_MOVE_Z, &distanceToMove, screen.handleManualMove, nullptr), + VPHELPER(VP_HOME_ALL, &distanceToMove, screen.handleManualMove, nullptr), #else - VPHELPER(VP_MOVE_X, nullptr, ScreenHandler.HandleManualMove, nullptr), - VPHELPER(VP_MOVE_Y, nullptr, ScreenHandler.HandleManualMove, nullptr), - VPHELPER(VP_MOVE_Z, nullptr, ScreenHandler.HandleManualMove, nullptr), - VPHELPER(VP_HOME_ALL, nullptr, ScreenHandler.HandleManualMove, nullptr), + VPHELPER(VP_MOVE_X, nullptr, screen.handleManualMove, nullptr), + VPHELPER(VP_MOVE_Y, nullptr, screen.handleManualMove, nullptr), + VPHELPER(VP_MOVE_Z, nullptr, screen.handleManualMove, nullptr), + VPHELPER(VP_HOME_ALL, nullptr, screen.handleManualMove, nullptr), #endif - VPHELPER(VP_MOTOR_LOCK_UNLOK, nullptr, ScreenHandler.HandleMotorLockUnlock, nullptr), + VPHELPER(VP_MOTOR_LOCK_UNLOK, nullptr, screen.handleMotorLockUnlock, nullptr), #if ENABLED(POWER_LOSS_RECOVERY) - VPHELPER(VP_POWER_LOSS_RECOVERY, nullptr, ScreenHandler.HandlePowerLossRecovery, nullptr), + VPHELPER(VP_POWER_LOSS_RECOVERY, nullptr, screen.handlePowerLossRecovery, nullptr), #endif - VPHELPER(VP_SETTINGS, nullptr, ScreenHandler.HandleSettings, nullptr), + VPHELPER(VP_SETTINGS, nullptr, screen.handleSettings, nullptr), #if ENABLED(SINGLE_Z_CALIBRATION) - VPHELPER(VP_Z_CALIBRATE, nullptr, ScreenHandler.HandleZCalibration, nullptr), + VPHELPER(VP_Z_CALIBRATE, nullptr, screen.handleZCalibration, nullptr), #endif #if ENABLED(FIRST_LAYER_CAL) - VPHELPER(VP_Z_FIRST_LAYER_CAL, nullptr, ScreenHandler.HandleFirstLayerCal, nullptr), + VPHELPER(VP_Z_FIRST_LAYER_CAL, nullptr, screen.handleFirstLayerCal, nullptr), #endif - { .VP = VP_MARLIN_VERSION, .memadr = (void*)MarlinVersion, .size = VP_MARLIN_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM }, + { .VP = VP_MARLIN_VERSION, .memadr = (void*)MarlinVersion, .size = VP_MARLIN_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM }, // M117 LCD String (We don't need the string in memory but "just" push it to the display on demand, hence the nullptr - { .VP = VP_M117, .memadr = nullptr, .size = VP_M117_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplay }, + { .VP = VP_M117, .memadr = nullptr, .size = VP_M117_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplay }, // Temperature Data #if HAS_HOTEND - VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>), - VPHELPER(VP_T_E0_Set, &thermalManager.temp_hotend[0].target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_Flowrate_E0, &planner.flow_percentage[ExtUI::extruder_t::E0], ScreenHandler.HandleFlowRateChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_EPos, &destination.e, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>), - VPHELPER(VP_MOVE_E0, nullptr, ScreenHandler.HandleManualExtrude, nullptr), - VPHELPER(VP_E0_CONTROL, &thermalManager.temp_hotend[0].target, ScreenHandler.HandleHeaterControl, nullptr), - VPHELPER(VP_E0_STATUS, &thermalManager.temp_hotend[0].target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay), + VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, screen.sendFloatAsLongValueToDisplay<0>), + VPHELPER(VP_T_E0_Set, &thermalManager.temp_hotend[0].target, screen.handleTemperatureChanged, screen.sendWordValueToDisplay), + VPHELPER(VP_Flowrate_E0, &planner.flow_percentage[ExtUI::extruder_t::E0], screen.handleFlowRateChanged, screen.sendWordValueToDisplay), + VPHELPER(VP_EPos, &destination.e, nullptr, screen.sendFloatAsLongValueToDisplay<2>), + VPHELPER(VP_MOVE_E0, nullptr, screen.handleManualExtrude, nullptr), + VPHELPER(VP_E0_CONTROL, &thermalManager.temp_hotend[0].target, screen.handleHeaterControl, nullptr), + VPHELPER(VP_E0_STATUS, &thermalManager.temp_hotend[0].target, nullptr, screen.sendHeaterStatusToDisplay), #if ENABLED(DGUS_PREHEAT_UI) - VPHELPER(VP_E0_BED_PREHEAT, nullptr, ScreenHandler.HandlePreheat, nullptr), + VPHELPER(VP_E0_BED_PREHEAT, nullptr, screen.handlePreheat, nullptr), #endif #if ENABLED(PIDTEMP) - VPHELPER(VP_E0_PID_P, &thermalManager.temp_hotend[0].pid.Kp, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID), - VPHELPER(VP_E0_PID_I, &thermalManager.temp_hotend[0].pid.Ki, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID), - VPHELPER(VP_E0_PID_D, &thermalManager.temp_hotend[0].pid.Kd, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID), - VPHELPER(VP_PID_AUTOTUNE_E0, nullptr, ScreenHandler.HandlePIDAutotune, nullptr), + VPHELPER(VP_E0_PID_P, &thermalManager.temp_hotend[0].pid.Kp, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID), + VPHELPER(VP_E0_PID_I, &thermalManager.temp_hotend[0].pid.Ki, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID), + VPHELPER(VP_E0_PID_D, &thermalManager.temp_hotend[0].pid.Kd, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID), + VPHELPER(VP_PID_AUTOTUNE_E0, nullptr, screen.handlePIDAutotune, nullptr), #endif #if ENABLED(DGUS_FILAMENT_LOADUNLOAD) - VPHELPER(VP_E0_FILAMENT_LOAD_UNLOAD, nullptr, ScreenHandler.HandleFilamentOption, ScreenHandler.HandleFilamentLoadUnload), + VPHELPER(VP_E0_FILAMENT_LOAD_UNLOAD, nullptr, screen.handleFilamentOption, screen.handleFilamentLoadUnload), #endif #endif #if HAS_MULTI_HOTEND - VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>), - VPHELPER(VP_T_E1_Set, &thermalManager.temp_hotend[1].target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_Flowrate_E1, &planner.flow_percentage[ExtUI::extruder_t::E1], ScreenHandler.HandleFlowRateChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), // ERROR: Flow is per-extruder, not per-hotend - VPHELPER(VP_MOVE_E1, nullptr, ScreenHandler.HandleManualExtrude, nullptr), - VPHELPER(VP_E1_CONTROL, &thermalManager.temp_hotend[1].target, ScreenHandler.HandleHeaterControl, nullptr), - VPHELPER(VP_E1_STATUS, &thermalManager.temp_hotend[1].target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay), + VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, screen.sendFloatAsLongValueToDisplay<0>), + VPHELPER(VP_T_E1_Set, &thermalManager.temp_hotend[1].target, screen.handleTemperatureChanged, screen.sendWordValueToDisplay), + VPHELPER(VP_Flowrate_E1, &planner.flow_percentage[ExtUI::extruder_t::E1], screen.handleFlowRateChanged, screen.sendWordValueToDisplay), // ERROR: Flow is per-extruder, not per-hotend + VPHELPER(VP_MOVE_E1, nullptr, screen.handleManualExtrude, nullptr), + VPHELPER(VP_E1_CONTROL, &thermalManager.temp_hotend[1].target, screen.handleHeaterControl, nullptr), + VPHELPER(VP_E1_STATUS, &thermalManager.temp_hotend[1].target, nullptr, screen.sendHeaterStatusToDisplay), #if ENABLED(PIDTEMP) - VPHELPER(VP_PID_AUTOTUNE_E1, nullptr, ScreenHandler.HandlePIDAutotune, nullptr), + VPHELPER(VP_PID_AUTOTUNE_E1, nullptr, screen.handlePIDAutotune, nullptr), #endif - VPHELPER(VP_E1_FILAMENT_LOAD_UNLOAD, nullptr, ScreenHandler.HandleFilamentOption, ScreenHandler.HandleFilamentLoadUnload), + VPHELPER(VP_E1_FILAMENT_LOAD_UNLOAD, nullptr, screen.handleFilamentOption, screen.handleFilamentLoadUnload), #endif #if HAS_HEATED_BED - VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.celsius, nullptr, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_T_Bed_Set, &thermalManager.temp_bed.target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_BED_CONTROL, &thermalManager.temp_bed.target, ScreenHandler.HandleHeaterControl, nullptr), - VPHELPER(VP_BED_STATUS, &thermalManager.temp_bed.target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay), + VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.celsius, nullptr, screen.sendWordValueToDisplay), + VPHELPER(VP_T_Bed_Set, &thermalManager.temp_bed.target, screen.handleTemperatureChanged, screen.sendWordValueToDisplay), + VPHELPER(VP_BED_CONTROL, &thermalManager.temp_bed.target, screen.handleHeaterControl, nullptr), + VPHELPER(VP_BED_STATUS, &thermalManager.temp_bed.target, nullptr, screen.sendHeaterStatusToDisplay), #if ENABLED(PIDTEMPBED) - VPHELPER(VP_BED_PID_P, &thermalManager.temp_bed.pid.Kp, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID), - VPHELPER(VP_BED_PID_I, &thermalManager.temp_bed.pid.Ki, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID), - VPHELPER(VP_BED_PID_D, &thermalManager.temp_bed.pid.Kd, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID), - VPHELPER(VP_PID_AUTOTUNE_BED, nullptr, ScreenHandler.HandlePIDAutotune, nullptr), + VPHELPER(VP_BED_PID_P, &thermalManager.temp_bed.pid.Kp, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID), + VPHELPER(VP_BED_PID_I, &thermalManager.temp_bed.pid.Ki, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID), + VPHELPER(VP_BED_PID_D, &thermalManager.temp_bed.pid.Kd, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID), + VPHELPER(VP_PID_AUTOTUNE_BED, nullptr, screen.handlePIDAutotune, nullptr), #endif #endif // Fan Data #if HAS_FAN #define FAN_VPHELPER(N) \ - VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], ScreenHandler.DGUSLCD_PercentageToUint8, ScreenHandler.DGUSLCD_SendPercentageToDisplay), \ - VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], ScreenHandler.HandleFanControl, nullptr), \ - VPHELPER(VP_FAN##N##_STATUS, &thermalManager.fan_speed[N], nullptr, ScreenHandler.DGUSLCD_SendFanStatusToDisplay), + VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], screen.percentageToUint8, screen.sendPercentageToDisplay), \ + VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], screen.handleFanControl, nullptr), \ + VPHELPER(VP_FAN##N##_STATUS, &thermalManager.fan_speed[N], nullptr, screen.sendFanStatusToDisplay), REPEAT(FAN_COUNT, FAN_VPHELPER) #endif // Feedrate - VPHELPER(VP_Feedrate_Percentage, &feedrate_percentage, ScreenHandler.DGUSLCD_SetValueDirectly, ScreenHandler.DGUSLCD_SendWordValueToDisplay), + VPHELPER(VP_Feedrate_Percentage, &feedrate_percentage, screen.setValueDirectly, screen.sendWordValueToDisplay), // Position Data - VPHELPER(VP_XPos, ¤t_position.x, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>), - VPHELPER(VP_YPos, ¤t_position.y, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>), - VPHELPER(VP_ZPos, ¤t_position.z, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>), + VPHELPER(VP_XPos, ¤t_position.x, nullptr, screen.sendFloatAsLongValueToDisplay<2>), + VPHELPER(VP_YPos, ¤t_position.y, nullptr, screen.sendFloatAsLongValueToDisplay<2>), + VPHELPER(VP_ZPos, ¤t_position.z, nullptr, screen.sendFloatAsLongValueToDisplay<2>), // Print Progress - VPHELPER(VP_PrintProgress_Percentage, nullptr, nullptr, ScreenHandler.DGUSLCD_SendPrintProgressToDisplay), + VPHELPER(VP_PrintProgress_Percentage, nullptr, nullptr, screen.sendPrintProgressToDisplay), // Print Time - VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintTimeToDisplay), + VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, screen.sendPrintTimeToDisplay), #if ENABLED(PRINTCOUNTER) - VPHELPER_STR(VP_PrintAccTime, nullptr, VP_PrintAccTime_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintAccTimeToDisplay), - VPHELPER_STR(VP_PrintsTotal, nullptr, VP_PrintsTotal_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintsTotalToDisplay), + VPHELPER_STR(VP_PrintAccTime, nullptr, VP_PrintAccTime_LEN, nullptr, screen.sendPrintAccTimeToDisplay), + VPHELPER_STR(VP_PrintsTotal, nullptr, VP_PrintsTotal_LEN, nullptr, screen.sendPrintsTotalToDisplay), #endif - VPHELPER(VP_X_STEP_PER_MM, &planner.settings.axis_steps_per_mm[X_AXIS], ScreenHandler.HandleStepPerMMChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>), - VPHELPER(VP_Y_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Y_AXIS], ScreenHandler.HandleStepPerMMChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>), - VPHELPER(VP_Z_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Z_AXIS], ScreenHandler.HandleStepPerMMChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>), + VPHELPER(VP_X_STEP_PER_MM, &planner.settings.axis_steps_per_mm[X_AXIS], screen.handleStepPerMMChanged, screen.sendFloatAsIntValueToDisplay<1>), + VPHELPER(VP_Y_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Y_AXIS], screen.handleStepPerMMChanged, screen.sendFloatAsIntValueToDisplay<1>), + VPHELPER(VP_Z_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Z_AXIS], screen.handleStepPerMMChanged, screen.sendFloatAsIntValueToDisplay<1>), #if HAS_EXTRUDERS - VPHELPER(VP_E0_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(0)], ScreenHandler.HandleStepPerMMExtruderChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>), + VPHELPER(VP_E0_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(0)], screen.handleStepPerMMExtruderChanged, screen.sendFloatAsIntValueToDisplay<1>), #if HAS_MULTI_EXTRUDER - VPHELPER(VP_E1_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(1)], ScreenHandler.HandleStepPerMMExtruderChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>), + VPHELPER(VP_E1_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(1)], screen.handleStepPerMMExtruderChanged, screen.sendFloatAsIntValueToDisplay<1>), #endif #endif // SDCard File listing. #if HAS_MEDIA - VPHELPER(VP_SD_ScrollEvent, nullptr, ScreenHandler.DGUSLCD_SD_ScrollFilelist, nullptr), - VPHELPER(VP_SD_FileSelected, nullptr, ScreenHandler.DGUSLCD_SD_FileSelected, nullptr), - VPHELPER(VP_SD_FileSelectConfirm, nullptr, ScreenHandler.DGUSLCD_SD_StartPrint, nullptr), - VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename), - VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename), - VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename), - VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename), - VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename), - VPHELPER(VP_SD_ResumePauseAbort, nullptr, ScreenHandler.DGUSLCD_SD_ResumePauseAbort, nullptr), - VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, ScreenHandler.DGUSLCD_SD_ReallyAbort, nullptr), - VPHELPER(VP_SD_Print_Setting, nullptr, ScreenHandler.DGUSLCD_SD_PrintTune, nullptr), + VPHELPER(VP_SD_ScrollEvent, nullptr, screen.sdScrollFilelist, nullptr), + VPHELPER(VP_SD_FileSelected, nullptr, screen.sdFileSelected, nullptr), + VPHELPER(VP_SD_FileSelectConfirm, nullptr, screen.sdStartPrint, nullptr), + VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename), + VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename), + VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename), + VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename), + VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename), + VPHELPER(VP_SD_ResumePauseAbort, nullptr, screen.sdResumePauseAbort, nullptr), + VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, screen.sdReallyAbort, nullptr), + VPHELPER(VP_SD_Print_Setting, nullptr, screen.sdPrintTune, nullptr), #if HAS_BED_PROBE - VPHELPER(VP_SD_Print_ProbeOffsetZ, &probe.offset.z, ScreenHandler.HandleProbeOffsetZChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<2>), + VPHELPER(VP_SD_Print_ProbeOffsetZ, &probe.offset.z, screen.handleProbeOffsetZChanged, screen.sendFloatAsIntValueToDisplay<2>), #if ENABLED(BABYSTEPPING) - VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, ScreenHandler.HandleLiveAdjustZ, nullptr), + VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, screen.handleLiveAdjustZ, nullptr), #endif #endif #endif #if ENABLED(DGUS_UI_WAITING) - VPHELPER(VP_WAITING_STATUS, nullptr, nullptr, ScreenHandler.DGUSLCD_SendWaitingStatusToDisplay), + VPHELPER(VP_WAITING_STATUS, nullptr, nullptr, screen.sendWaitingStatusToDisplay), #endif // Messages for the User, shared by the popup and the kill screen. They can't be autouploaded as we do not buffer content. - { .VP = VP_MSGSTR1, .memadr = nullptr, .size = VP_MSGSTR1_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM }, - { .VP = VP_MSGSTR2, .memadr = nullptr, .size = VP_MSGSTR2_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM }, - { .VP = VP_MSGSTR3, .memadr = nullptr, .size = VP_MSGSTR3_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM }, - { .VP = VP_MSGSTR4, .memadr = nullptr, .size = VP_MSGSTR4_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM }, + { .VP = VP_MSGSTR1, .memadr = nullptr, .size = VP_MSGSTR1_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM }, + { .VP = VP_MSGSTR2, .memadr = nullptr, .size = VP_MSGSTR2_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM }, + { .VP = VP_MSGSTR3, .memadr = nullptr, .size = VP_MSGSTR3_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM }, + { .VP = VP_MSGSTR4, .memadr = nullptr, .size = VP_MSGSTR4_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM }, VPHELPER(0, 0, 0, 0) // must be last entry. }; diff --git a/Marlin/src/lcd/extui/dgus/fysetc/DGUSDisplayDef.h b/Marlin/src/lcd/extui/dgus/fysetc/DGUSDisplayDef.h index 5deedc0450792..70559f903196b 100644 --- a/Marlin/src/lcd/extui/dgus/fysetc/DGUSDisplayDef.h +++ b/Marlin/src/lcd/extui/dgus/fysetc/DGUSDisplayDef.h @@ -23,35 +23,35 @@ #include "../DGUSDisplayDef.h" -enum DGUSLCD_Screens : uint8_t { - DGUSLCD_SCREEN_BOOT = 0, - DGUSLCD_SCREEN_MAIN = 1, - DGUSLCD_SCREEN_STATUS = 1, - DGUSLCD_SCREEN_STATUS2 = 1, - DGUSLCD_SCREEN_TEMPERATURE = 10, - DGUSLCD_SCREEN_PREHEAT = 18, - DGUSLCD_SCREEN_POWER_LOSS = 100, - DGUSLCD_SCREEN_MANUALMOVE = 192, - DGUSLCD_SCREEN_UTILITY = 120, - DGUSLCD_SCREEN_FILAMENT_HEATING = 146, - DGUSLCD_SCREEN_FILAMENT_LOADING = 148, - DGUSLCD_SCREEN_FILAMENT_UNLOADING = 158, - DGUSLCD_SCREEN_MANUALEXTRUDE = 160, - DGUSLCD_SCREEN_SDFILELIST = 71, - DGUSLCD_SCREEN_SDPRINTMANIPULATION = 73, - DGUSLCD_SCREEN_SDPRINTTUNE = 75, - DGUSLCD_SCREEN_FLC_PREHEAT = 94, - DGUSLCD_SCREEN_FLC_PRINTING = 96, - DGUSLCD_SCREEN_STEPPERMM = 212, - DGUSLCD_SCREEN_PID_E = 214, - DGUSLCD_SCREEN_PID_BED = 218, - DGUSLCD_SCREEN_Z_OFFSET = 222, - DGUSLCD_SCREEN_INFOS = 36, - DGUSLCD_SCREEN_CONFIRM = 240, - DGUSLCD_SCREEN_KILL = 250, ///< Kill Screen. Must always be 250 (to be able to display "Error wrong LCD Version") - DGUSLCD_SCREEN_WAITING = 251, - DGUSLCD_SCREEN_POPUP = 252, ///< special target, popup screen will also return this code to say "return to previous screen" - DGUSLCD_SCREEN_UNUSED = 255 +enum DGUS_ScreenID : uint8_t { + DGUS_SCREEN_BOOT = 0, + DGUS_SCREEN_MAIN = 1, + DGUS_SCREEN_STATUS = 1, + DGUS_SCREEN_STATUS2 = 1, + DGUS_SCREEN_TEMPERATURE = 10, + DGUS_SCREEN_PREHEAT = 18, + DGUS_SCREEN_POWER_LOSS = 100, + DGUS_SCREEN_MANUALMOVE = 192, + DGUS_SCREEN_UTILITY = 120, + DGUS_SCREEN_FILAMENT_HEATING = 146, + DGUS_SCREEN_FILAMENT_LOADING = 148, + DGUS_SCREEN_FILAMENT_UNLOADING = 158, + DGUS_SCREEN_MANUALEXTRUDE = 160, + DGUS_SCREEN_SDFILELIST = 71, + DGUS_SCREEN_SDPRINTMANIPULATION = 73, + DGUS_SCREEN_SDPRINTTUNE = 75, + DGUS_SCREEN_FLC_PREHEAT = 94, + DGUS_SCREEN_FLC_PRINTING = 96, + DGUS_SCREEN_STEPPERMM = 212, + DGUS_SCREEN_PID_E = 214, + DGUS_SCREEN_PID_BED = 218, + DGUS_SCREEN_Z_OFFSET = 222, + DGUS_SCREEN_INFOS = 36, + DGUS_SCREEN_CONFIRM = 240, + DGUS_SCREEN_KILL = 250, ///< Kill Screen. Must always be 250 (to be able to display "Error wrong LCD Version") + DGUS_SCREEN_WAITING = 251, + DGUS_SCREEN_POPUP = 252, ///< special target, popup screen will also return this code to say "return to previous screen" + DGUS_SCREEN_UNUSED = 255 }; // Display Memory layout used (T5UID) diff --git a/Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.cpp index aa83ee2a4ee28..768092633eda9 100644 --- a/Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.cpp @@ -44,7 +44,7 @@ extern ExtUI::FileList filelist; - void DGUSScreenHandler::DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::sdFileSelected(DGUS_VP_Variable &var, void *val_ptr) { uint16_t touched_nr = (int16_t)swap16(*(uint16_t*)val_ptr) + top_file; if (touched_nr > filelist.count()) return; if (!filelist.seek(touched_nr)) return; @@ -52,28 +52,28 @@ if (filelist.isDir()) { filelist.changeDir(filelist.filename()); top_file = 0; - ForceCompleteUpdate(); + forceCompleteUpdate(); return; } #if ENABLED(DGUS_PRINT_FILENAME) // Send print filename - dgusdisplay.WriteVariable(VP_SD_Print_Filename, filelist.filename(), VP_SD_FileName_LEN, true); + dgus.writeVariable(VP_SD_Print_Filename, filelist.filename(), VP_SD_FileName_LEN, true); #endif // Setup Confirmation screen file_to_print = touched_nr; - HandleUserConfirmationPopUp(VP_SD_FileSelectConfirm, nullptr, PSTR("Print file"), filelist.filename(), PSTR("from SD Card?"), true, true, false, true); + handleUserConfirmationPopUp(VP_SD_FileSelectConfirm, nullptr, PSTR("Print file"), filelist.filename(), PSTR("from SD Card?"), true, true, false, true); } - void DGUSScreenHandler::DGUSLCD_SD_StartPrint(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::sdStartPrint(DGUS_VP_Variable &var, void *val_ptr) { if (!filelist.seek(file_to_print)) return; ExtUI::printFile(filelist.shortFilename()); - GotoScreen(DGUSLCD_SCREEN_SDPRINTMANIPULATION); + gotoScreen(DGUS_SCREEN_SDPRINTMANIPULATION); } - void DGUSScreenHandler::DGUSLCD_SD_ResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::sdResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr) { if (!ExtUI::isPrintingFromMedia()) return; // avoid race condition when user stays in this menu and printer finishes. switch (swap16(*(uint16_t*)val_ptr)) { @@ -85,19 +85,19 @@ case 1: // Pause - GotoScreen(DGUSLCD_SCREEN_SDPRINTMANIPULATION); + gotoScreen(DGUS_SCREEN_SDPRINTMANIPULATION); if (!ExtUI::isPrintingFromMediaPaused()) { ExtUI::pausePrint(); //ExtUI::mks_pausePrint(); } break; case 2: // Abort - HandleUserConfirmationPopUp(VP_SD_AbortPrintConfirmed, nullptr, PSTR("Abort printing"), filelist.filename(), PSTR("?"), true, true, false, true); + handleUserConfirmationPopUp(VP_SD_AbortPrintConfirmed, nullptr, PSTR("Abort printing"), filelist.filename(), PSTR("?"), true, true, false, true); break; } } - void DGUSScreenHandler::DGUSLCD_SD_SendFilename(DGUS_VP_Variable& var) { + void DGUSScreenHandler::sdSendFilename(DGUS_VP_Variable& var) { uint16_t target_line = (var.VP - VP_SD_FileName0) / VP_SD_FileName_LEN; if (target_line > DGUS_SD_FILESPERSCREEN) return; char tmpfilename[VP_SD_FileName_LEN + 1] = ""; @@ -106,49 +106,49 @@ if (filelist.seek(top_file + target_line)) { snprintf_P(tmpfilename, VP_SD_FileName_LEN, PSTR("%s%c"), filelist.filename(), filelist.isDir() ? '/' : 0); // snprintf_P(tmpfilename, VP_SD_FileName_LEN, PSTR("%s"), filelist.filename()); } - DGUSLCD_SendStringToDisplay(var); + sendStringToDisplay(var); } - void DGUSScreenHandler::SDCardInserted() { + void DGUSScreenHandler::sdCardInserted() { top_file = 0; filelist.refresh(); auto cs = getCurrentScreen(); - if (cs == DGUSLCD_SCREEN_MAIN || cs == DGUSLCD_SCREEN_STATUS) - GotoScreen(DGUSLCD_SCREEN_SDFILELIST); + if (cs == DGUS_SCREEN_MAIN || cs == DGUS_SCREEN_STATUS) + gotoScreen(DGUS_SCREEN_SDFILELIST); } - void DGUSScreenHandler::SDCardRemoved() { - if (current_screen == DGUSLCD_SCREEN_SDFILELIST - || (current_screen == DGUSLCD_SCREEN_CONFIRM && (ConfirmVP == VP_SD_AbortPrintConfirmed || ConfirmVP == VP_SD_FileSelectConfirm)) - || current_screen == DGUSLCD_SCREEN_SDPRINTMANIPULATION - ) GotoScreen(DGUSLCD_SCREEN_MAIN); + void DGUSScreenHandler::sdCardRemoved() { + if (current_screenID == DGUS_SCREEN_SDFILELIST + || (current_screenID == DGUS_SCREEN_CONFIRM && (confirmVP == VP_SD_AbortPrintConfirmed || confirmVP == VP_SD_FileSelectConfirm)) + || current_screenID == DGUS_SCREEN_SDPRINTMANIPULATION + ) gotoScreen(DGUS_SCREEN_MAIN); } #endif // HAS_MEDIA -void DGUSScreenHandler::ScreenChangeHook(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandler::screenChangeHook(DGUS_VP_Variable &var, void *val_ptr) { uint8_t *tmp = (uint8_t*)val_ptr; // The keycode in target is coded as , so 0x0100A means - // from screen 1 (main) to 10 (temperature). DGUSLCD_SCREEN_POPUP is special, + // from screen 1 (main) to 10 (temperature). DGUS_SCREEN_POPUP is special, // meaning "return to previous screen" - DGUSLCD_Screens target = (DGUSLCD_Screens)tmp[1]; + DGUS_ScreenID target = (DGUS_ScreenID)tmp[1]; - if (target == DGUSLCD_SCREEN_POPUP) { + if (target == DGUS_SCREEN_POPUP) { // Special handling for popup is to return to previous menu - if (current_screen == DGUSLCD_SCREEN_POPUP && confirm_action_cb) confirm_action_cb(); - PopToOldScreen(); + if (current_screenID == DGUS_SCREEN_POPUP && confirm_action_cb) confirm_action_cb(); + popToOldScreen(); return; } - UpdateNewScreen(target); + updateNewScreen(target); #ifdef DEBUG_DGUSLCD - if (!DGUSLCD_FindScreenVPMapList(target)) DEBUG_ECHOLNPGM("WARNING: No screen Mapping found for ", target); + if (!findScreenVPMapList(target)) DEBUG_ECHOLNPGM("WARNING: No screen Mapping found for ", target); #endif } -void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandler::handleManualMove(DGUS_VP_Variable &var, void *val_ptr) { int16_t movevalue = swap16(*(uint16_t*)val_ptr); #if ENABLED(DGUS_UI_MOVE_DIS_OPTION) if (movevalue) { @@ -196,7 +196,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { char buf[6] = "G28 X"; buf[4] = axiscode; queue.enqueue_one_now(buf); - ForceCompleteUpdate(); + forceCompleteUpdate(); return; } else { @@ -219,14 +219,14 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { if (!old_relative_mode) queue.enqueue_now(F("G90")); } - ForceCompleteUpdate(); + forceCompleteUpdate(); cannotmove: return; } #if HAS_PID_HEATING - void DGUSScreenHandler::HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::handleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr) { uint16_t rawvalue = swap16(*(uint16_t*)val_ptr); float value = (float)rawvalue / 10; float newvalue = 0; @@ -257,17 +257,17 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { #endif // HAS_PID_HEATING #if ENABLED(BABYSTEPPING) - void DGUSScreenHandler::HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::handleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr) { int16_t flag = swap16(*(uint16_t*)val_ptr), steps = flag ? -20 : 20; ExtUI::smartAdjustAxis_steps(steps, ExtUI::axis_t::Z, true); - ForceCompleteUpdate(); + forceCompleteUpdate(); } #endif #if ENABLED(DGUS_FILAMENT_LOADUNLOAD) - void DGUSScreenHandler::HandleFilamentOption(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::handleFilamentOption(DGUS_VP_Variable &var, void *val_ptr) { uint8_t e_temp = 0; filament_data.heated = false; uint16_t preheat_option = swap16(*(uint16_t*)val_ptr); @@ -315,7 +315,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E1); #endif #endif - GotoScreen(DGUSLCD_SCREEN_UTILITY); + gotoScreen(DGUS_SCREEN_UTILITY); } else { // Go to the preheat screen to show the heating progress switch (var.VP) { @@ -333,11 +333,11 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { break; #endif } - GotoScreen(DGUSLCD_SCREEN_FILAMENT_HEATING); + gotoScreen(DGUS_SCREEN_FILAMENT_HEATING); } } - void DGUSScreenHandler::HandleFilamentLoadUnload(DGUS_VP_Variable &var) { + void DGUSScreenHandler::handleFilamentLoadUnload(DGUS_VP_Variable &var) { if (filament_data.action <= 0) return; // If we close to the target temperature, we can start load or unload the filament @@ -347,14 +347,14 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { if (filament_data.action == 1) { // load filament if (!filament_data.heated) { - //GotoScreen(DGUSLCD_SCREEN_FILAMENT_LOADING); + //gotoScreen(DGUS_SCREEN_FILAMENT_LOADING); filament_data.heated = true; } movevalue = ExtUI::getAxisPosition_mm(filament_data.extruder) + movevalue; } else { // unload filament if (!filament_data.heated) { - GotoScreen(DGUSLCD_SCREEN_FILAMENT_UNLOADING); + gotoScreen(DGUS_SCREEN_FILAMENT_UNLOADING); filament_data.heated = true; } // Before unloading extrude to prevent jamming @@ -372,14 +372,14 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { #endif // DGUS_FILAMENT_LOADUNLOAD bool DGUSScreenHandler::loop() { - dgusdisplay.loop(); + dgus.loop(); const millis_t ms = millis(); static millis_t next_event_ms = 0; - if (!IsScreenComplete() || ELAPSED(ms, next_event_ms)) { + if (!isScreenComplete() || ELAPSED(ms, next_event_ms)) { next_event_ms = ms + DGUS_UPDATE_INTERVAL_MS; - UpdateScreenVPData(); + updateScreenVPData(); } #if ENABLED(SHOW_BOOTSCREEN) @@ -390,11 +390,11 @@ bool DGUSScreenHandler::loop() { if (!booted && ELAPSED(ms, BOOTSCREEN_TIMEOUT)) { booted = true; - GotoScreen(TERN0(POWER_LOSS_RECOVERY, recovery.valid()) ? DGUSLCD_SCREEN_POWER_LOSS : DGUSLCD_SCREEN_MAIN); + gotoScreen(TERN0(POWER_LOSS_RECOVERY, recovery.valid()) ? DGUS_SCREEN_POWER_LOSS : DGUS_SCREEN_MAIN); } #endif - return IsScreenComplete(); + return isScreenComplete(); } #endif // DGUS_LCD_UI_FYSETC diff --git a/Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.h b/Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.h index 73e3527d7e7c1..16c5dec408d6b 100644 --- a/Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.h +++ b/Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.h @@ -26,6 +26,6 @@ typedef DGUSScreenHandler DGUSScreenHandlerClass; #if ENABLED(POWER_LOSS_RECOVERY) - #define PLR_SCREEN_RECOVER DGUSLCD_SCREEN_SDPRINTMANIPULATION - #define PLR_SCREEN_CANCEL DGUSLCD_SCREEN_STATUS + #define PLR_SCREEN_RECOVER DGUS_SCREEN_SDPRINTMANIPULATION + #define PLR_SCREEN_CANCEL DGUS_SCREEN_STATUS #endif diff --git a/Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.cpp b/Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.cpp index c278179e3f27f..d99a4fe4f6882 100644 --- a/Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.cpp +++ b/Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.cpp @@ -286,28 +286,28 @@ const uint16_t VPList_Z_Offset[] PROGMEM = { }; const struct VPMapping VPMap[] PROGMEM = { - { DGUSLCD_SCREEN_BOOT, VPList_Boot }, - { DGUSLCD_SCREEN_MAIN, VPList_Main }, - { DGUSLCD_SCREEN_TEMPERATURE, VPList_Temp }, - { DGUSLCD_SCREEN_STATUS, VPList_Status }, - { DGUSLCD_SCREEN_STATUS2, VPList_Status2 }, - { DGUSLCD_SCREEN_PREHEAT, VPList_Preheat }, - { DGUSLCD_SCREEN_MANUALMOVE, VPList_ManualMove }, - { DGUSLCD_SCREEN_Z_OFFSET, VPList_Z_Offset }, - { DGUSLCD_SCREEN_MANUALEXTRUDE, VPList_ManualExtrude }, - { DGUSLCD_SCREEN_FILAMENT_HEATING, VPList_Filament_heating }, - { DGUSLCD_SCREEN_FILAMENT_LOADING, VPList_Filament_load_unload }, - { DGUSLCD_SCREEN_FILAMENT_UNLOADING, VPList_Filament_load_unload }, - { DGUSLCD_SCREEN_SDPRINTMANIPULATION, VPList_SD_PrintManipulation }, - { DGUSLCD_SCREEN_SDFILELIST, VPList_SDFileList }, - { DGUSLCD_SCREEN_SDPRINTTUNE, VPList_SDPrintTune }, - { DGUSLCD_SCREEN_WAITING, VPList_PIDTuningWaiting }, - { DGUSLCD_SCREEN_FLC_PREHEAT, VPList_FLCPreheat }, - { DGUSLCD_SCREEN_FLC_PRINTING, VPList_FLCPrinting }, - { DGUSLCD_SCREEN_STEPPERMM, VPList_StepPerMM }, - { DGUSLCD_SCREEN_PID_E, VPList_PIDE0 }, - { DGUSLCD_SCREEN_PID_BED, VPList_PIDBED }, - { DGUSLCD_SCREEN_INFOS, VPList_Infos }, + { DGUS_SCREEN_BOOT, VPList_Boot }, + { DGUS_SCREEN_MAIN, VPList_Main }, + { DGUS_SCREEN_TEMPERATURE, VPList_Temp }, + { DGUS_SCREEN_STATUS, VPList_Status }, + { DGUS_SCREEN_STATUS2, VPList_Status2 }, + { DGUS_SCREEN_PREHEAT, VPList_Preheat }, + { DGUS_SCREEN_MANUALMOVE, VPList_ManualMove }, + { DGUS_SCREEN_Z_OFFSET, VPList_Z_Offset }, + { DGUS_SCREEN_MANUALEXTRUDE, VPList_ManualExtrude }, + { DGUS_SCREEN_FILAMENT_HEATING, VPList_Filament_heating }, + { DGUS_SCREEN_FILAMENT_LOADING, VPList_Filament_load_unload }, + { DGUS_SCREEN_FILAMENT_UNLOADING, VPList_Filament_load_unload }, + { DGUS_SCREEN_SDPRINTMANIPULATION, VPList_SD_PrintManipulation }, + { DGUS_SCREEN_SDFILELIST, VPList_SDFileList }, + { DGUS_SCREEN_SDPRINTTUNE, VPList_SDPrintTune }, + { DGUS_SCREEN_WAITING, VPList_PIDTuningWaiting }, + { DGUS_SCREEN_FLC_PREHEAT, VPList_FLCPreheat }, + { DGUS_SCREEN_FLC_PRINTING, VPList_FLCPrinting }, + { DGUS_SCREEN_STEPPERMM, VPList_StepPerMM }, + { DGUS_SCREEN_PID_E, VPList_PIDE0 }, + { DGUS_SCREEN_PID_BED, VPList_PIDBED }, + { DGUS_SCREEN_INFOS, VPList_Infos }, { 0 , nullptr } // List is terminated with an nullptr as table entry. }; @@ -315,155 +315,155 @@ const char MarlinVersion[] PROGMEM = SHORT_BUILD_VERSION; const struct DGUS_VP_Variable ListOfVP[] PROGMEM = { // Helper to detect touch events - VPHELPER(VP_SCREENCHANGE, nullptr, ScreenHandler.ScreenChangeHook, nullptr), - VPHELPER(VP_SCREENCHANGE_ASK, nullptr, ScreenHandler.ScreenChangeHookIfIdle, nullptr), + VPHELPER(VP_SCREENCHANGE, nullptr, screen.screenChangeHook, nullptr), + VPHELPER(VP_SCREENCHANGE_ASK, nullptr, screen.screenChangeHookIfIdle, nullptr), #if HAS_MEDIA - VPHELPER(VP_SCREENCHANGE_WHENSD, nullptr, ScreenHandler.ScreenChangeHookIfSD, nullptr), + VPHELPER(VP_SCREENCHANGE_WHENSD, nullptr, screen.screenChangeHookIfSD, nullptr), #endif - VPHELPER(VP_CONFIRMED, nullptr, ScreenHandler.ScreenConfirmedOK, nullptr), + VPHELPER(VP_CONFIRMED, nullptr, screen.screenConfirmedOK, nullptr), - VPHELPER(VP_TEMP_ALL_OFF, nullptr, ScreenHandler.HandleAllHeatersOff, nullptr), + VPHELPER(VP_TEMP_ALL_OFF, nullptr, screen.handleAllHeatersOff, nullptr), #if ENABLED(DGUS_UI_MOVE_DIS_OPTION) - VPHELPER(VP_MOVE_OPTION, &distanceToMove, ScreenHandler.HandleManualMoveOption, nullptr), + VPHELPER(VP_MOVE_OPTION, &distanceToMove, screen.handleManualMoveOption, nullptr), #endif #if ENABLED(DGUS_UI_MOVE_DIS_OPTION) - VPHELPER(VP_MOVE_X, &distanceToMove, ScreenHandler.HandleManualMove, nullptr), - VPHELPER(VP_MOVE_Y, &distanceToMove, ScreenHandler.HandleManualMove, nullptr), - VPHELPER(VP_MOVE_Z, &distanceToMove, ScreenHandler.HandleManualMove, nullptr), - VPHELPER(VP_HOME_ALL, &distanceToMove, ScreenHandler.HandleManualMove, nullptr), + VPHELPER(VP_MOVE_X, &distanceToMove, screen.handleManualMove, nullptr), + VPHELPER(VP_MOVE_Y, &distanceToMove, screen.handleManualMove, nullptr), + VPHELPER(VP_MOVE_Z, &distanceToMove, screen.handleManualMove, nullptr), + VPHELPER(VP_HOME_ALL, &distanceToMove, screen.handleManualMove, nullptr), #else - VPHELPER(VP_MOVE_X, nullptr, ScreenHandler.HandleManualMove, nullptr), - VPHELPER(VP_MOVE_Y, nullptr, ScreenHandler.HandleManualMove, nullptr), - VPHELPER(VP_MOVE_Z, nullptr, ScreenHandler.HandleManualMove, nullptr), - VPHELPER(VP_HOME_ALL, nullptr, ScreenHandler.HandleManualMove, nullptr), + VPHELPER(VP_MOVE_X, nullptr, screen.handleManualMove, nullptr), + VPHELPER(VP_MOVE_Y, nullptr, screen.handleManualMove, nullptr), + VPHELPER(VP_MOVE_Z, nullptr, screen.handleManualMove, nullptr), + VPHELPER(VP_HOME_ALL, nullptr, screen.handleManualMove, nullptr), #endif - VPHELPER(VP_MOTOR_LOCK_UNLOK, nullptr, ScreenHandler.HandleMotorLockUnlock, nullptr), + VPHELPER(VP_MOTOR_LOCK_UNLOK, nullptr, screen.handleMotorLockUnlock, nullptr), #if ENABLED(POWER_LOSS_RECOVERY) - VPHELPER(VP_POWER_LOSS_RECOVERY, nullptr, ScreenHandler.HandlePowerLossRecovery, nullptr), + VPHELPER(VP_POWER_LOSS_RECOVERY, nullptr, screen.handlePowerLossRecovery, nullptr), #endif - VPHELPER(VP_SETTINGS, nullptr, ScreenHandler.HandleSettings, nullptr), + VPHELPER(VP_SETTINGS, nullptr, screen.handleSettings, nullptr), #if ENABLED(SINGLE_Z_CALIBRATION) - VPHELPER(VP_Z_CALIBRATE, nullptr, ScreenHandler.HandleZCalibration, nullptr), + VPHELPER(VP_Z_CALIBRATE, nullptr, screen.handleZCalibration, nullptr), #endif #if ENABLED(FIRST_LAYER_CAL) - VPHELPER(VP_Z_FIRST_LAYER_CAL, nullptr, ScreenHandler.HandleFirstLayerCal, nullptr), + VPHELPER(VP_Z_FIRST_LAYER_CAL, nullptr, screen.handleFirstLayerCal, nullptr), #endif - { .VP = VP_MARLIN_VERSION, .memadr = (void*)MarlinVersion, .size = VP_MARLIN_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM }, + { .VP = VP_MARLIN_VERSION, .memadr = (void*)MarlinVersion, .size = VP_MARLIN_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM }, // M117 LCD String (We don't need the string in memory but "just" push it to the display on demand, hence the nullptr - { .VP = VP_M117, .memadr = nullptr, .size = VP_M117_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplay }, + { .VP = VP_M117, .memadr = nullptr, .size = VP_M117_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplay }, // Temperature Data #if HAS_HOTEND - VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>), - VPHELPER(VP_T_E0_Set, &thermalManager.temp_hotend[0].target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_Flowrate_E0, &planner.flow_percentage[ExtUI::extruder_t::E0], ScreenHandler.HandleFlowRateChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_EPos, &destination.e, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>), - VPHELPER(VP_MOVE_E0, nullptr, ScreenHandler.HandleManualExtrude, nullptr), - VPHELPER(VP_E0_CONTROL, &thermalManager.temp_hotend[0].target, ScreenHandler.HandleHeaterControl, nullptr), - VPHELPER(VP_E0_STATUS, &thermalManager.temp_hotend[0].target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay), + VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, screen.sendFloatAsLongValueToDisplay<0>), + VPHELPER(VP_T_E0_Set, &thermalManager.temp_hotend[0].target, screen.handleTemperatureChanged, screen.sendWordValueToDisplay), + VPHELPER(VP_Flowrate_E0, &planner.flow_percentage[ExtUI::extruder_t::E0], screen.handleFlowRateChanged, screen.sendWordValueToDisplay), + VPHELPER(VP_EPos, &destination.e, nullptr, screen.sendFloatAsLongValueToDisplay<2>), + VPHELPER(VP_MOVE_E0, nullptr, screen.handleManualExtrude, nullptr), + VPHELPER(VP_E0_CONTROL, &thermalManager.temp_hotend[0].target, screen.handleHeaterControl, nullptr), + VPHELPER(VP_E0_STATUS, &thermalManager.temp_hotend[0].target, nullptr, screen.sendHeaterStatusToDisplay), #if ENABLED(DGUS_PREHEAT_UI) - VPHELPER(VP_E0_BED_PREHEAT, nullptr, ScreenHandler.HandlePreheat, nullptr), + VPHELPER(VP_E0_BED_PREHEAT, nullptr, screen.handlePreheat, nullptr), #endif #if ENABLED(DGUS_FILAMENT_LOADUNLOAD) - VPHELPER(VP_E0_FILAMENT_LOAD_UNLOAD, nullptr, ScreenHandler.HandleFilamentOption, ScreenHandler.HandleFilamentLoadUnload), + VPHELPER(VP_E0_FILAMENT_LOAD_UNLOAD, nullptr, screen.handleFilamentOption, screen.handleFilamentLoadUnload), #endif #if ENABLED(PIDTEMP) - VPHELPER(VP_E0_PID_P, &thermalManager.temp_hotend[0].pid.Kp, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID), - VPHELPER(VP_E0_PID_I, &thermalManager.temp_hotend[0].pid.Ki, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID), - VPHELPER(VP_E0_PID_D, &thermalManager.temp_hotend[0].pid.Kd, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID), - VPHELPER(VP_PID_AUTOTUNE_E0, nullptr, ScreenHandler.HandlePIDAutotune, nullptr), + VPHELPER(VP_E0_PID_P, &thermalManager.temp_hotend[0].pid.Kp, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID), + VPHELPER(VP_E0_PID_I, &thermalManager.temp_hotend[0].pid.Ki, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID), + VPHELPER(VP_E0_PID_D, &thermalManager.temp_hotend[0].pid.Kd, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID), + VPHELPER(VP_PID_AUTOTUNE_E0, nullptr, screen.handlePIDAutotune, nullptr), #endif #endif #if HAS_MULTI_HOTEND - VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>), - VPHELPER(VP_T_E1_Set, &thermalManager.temp_hotend[1].target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_Flowrate_E1, nullptr, ScreenHandler.HandleFlowRateChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_MOVE_E1, nullptr, ScreenHandler.HandleManualExtrude, nullptr), - VPHELPER(VP_E1_CONTROL, &thermalManager.temp_hotend[1].target, ScreenHandler.HandleHeaterControl, nullptr), - VPHELPER(VP_E1_STATUS, &thermalManager.temp_hotend[1].target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay), + VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, screen.sendFloatAsLongValueToDisplay<0>), + VPHELPER(VP_T_E1_Set, &thermalManager.temp_hotend[1].target, screen.handleTemperatureChanged, screen.sendWordValueToDisplay), + VPHELPER(VP_Flowrate_E1, nullptr, screen.handleFlowRateChanged, screen.sendWordValueToDisplay), + VPHELPER(VP_MOVE_E1, nullptr, screen.handleManualExtrude, nullptr), + VPHELPER(VP_E1_CONTROL, &thermalManager.temp_hotend[1].target, screen.handleHeaterControl, nullptr), + VPHELPER(VP_E1_STATUS, &thermalManager.temp_hotend[1].target, nullptr, screen.sendHeaterStatusToDisplay), #endif #if HAS_HEATED_BED - VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.celsius, nullptr, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_T_Bed_Set, &thermalManager.temp_bed.target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_BED_CONTROL, &thermalManager.temp_bed.target, ScreenHandler.HandleHeaterControl, nullptr), - VPHELPER(VP_BED_STATUS, &thermalManager.temp_bed.target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay), + VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.celsius, nullptr, screen.sendWordValueToDisplay), + VPHELPER(VP_T_Bed_Set, &thermalManager.temp_bed.target, screen.handleTemperatureChanged, screen.sendWordValueToDisplay), + VPHELPER(VP_BED_CONTROL, &thermalManager.temp_bed.target, screen.handleHeaterControl, nullptr), + VPHELPER(VP_BED_STATUS, &thermalManager.temp_bed.target, nullptr, screen.sendHeaterStatusToDisplay), #if ENABLED(PIDTEMPBED) - VPHELPER(VP_BED_PID_P, &thermalManager.temp_bed.pid.Kp, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID), - VPHELPER(VP_BED_PID_I, &thermalManager.temp_bed.pid.Ki, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID), - VPHELPER(VP_BED_PID_D, &thermalManager.temp_bed.pid.Kd, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID), - VPHELPER(VP_PID_AUTOTUNE_BED, nullptr, ScreenHandler.HandlePIDAutotune, nullptr), + VPHELPER(VP_BED_PID_P, &thermalManager.temp_bed.pid.Kp, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID), + VPHELPER(VP_BED_PID_I, &thermalManager.temp_bed.pid.Ki, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID), + VPHELPER(VP_BED_PID_D, &thermalManager.temp_bed.pid.Kd, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID), + VPHELPER(VP_PID_AUTOTUNE_BED, nullptr, screen.handlePIDAutotune, nullptr), #endif #endif // Fan Data #if HAS_FAN #define FAN_VPHELPER(N) \ - VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], ScreenHandler.DGUSLCD_PercentageToUint8, ScreenHandler.DGUSLCD_SendPercentageToDisplay), \ - VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], ScreenHandler.HandleFanControl, nullptr), \ - VPHELPER(VP_FAN##N##_STATUS, &thermalManager.fan_speed[N], nullptr, ScreenHandler.DGUSLCD_SendFanStatusToDisplay), + VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], screen.percentageToUint8, screen.sendPercentageToDisplay), \ + VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], screen.handleFanControl, nullptr), \ + VPHELPER(VP_FAN##N##_STATUS, &thermalManager.fan_speed[N], nullptr, screen.sendFanStatusToDisplay), REPEAT(FAN_COUNT, FAN_VPHELPER) #endif // Feedrate - VPHELPER(VP_Feedrate_Percentage, &feedrate_percentage, ScreenHandler.DGUSLCD_SetValueDirectly, ScreenHandler.DGUSLCD_SendWordValueToDisplay), + VPHELPER(VP_Feedrate_Percentage, &feedrate_percentage, screen.setValueDirectly, screen.sendWordValueToDisplay), // Position Data - VPHELPER(VP_XPos, ¤t_position.x, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>), - VPHELPER(VP_YPos, ¤t_position.y, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>), - VPHELPER(VP_ZPos, ¤t_position.z, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>), + VPHELPER(VP_XPos, ¤t_position.x, nullptr, screen.sendFloatAsLongValueToDisplay<2>), + VPHELPER(VP_YPos, ¤t_position.y, nullptr, screen.sendFloatAsLongValueToDisplay<2>), + VPHELPER(VP_ZPos, ¤t_position.z, nullptr, screen.sendFloatAsLongValueToDisplay<2>), // Print Progress - VPHELPER(VP_PrintProgress_Percentage, nullptr, nullptr, ScreenHandler.DGUSLCD_SendPrintProgressToDisplay), + VPHELPER(VP_PrintProgress_Percentage, nullptr, nullptr, screen.sendPrintProgressToDisplay), // Print Time - VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintTimeToDisplay), + VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, screen.sendPrintTimeToDisplay), #if ENABLED(PRINTCOUNTER) - VPHELPER_STR(VP_PrintAccTime, nullptr, VP_PrintAccTime_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintAccTimeToDisplay), - VPHELPER_STR(VP_PrintsTotal, nullptr, VP_PrintsTotal_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintsTotalToDisplay), + VPHELPER_STR(VP_PrintAccTime, nullptr, VP_PrintAccTime_LEN, nullptr, screen.sendPrintAccTimeToDisplay), + VPHELPER_STR(VP_PrintsTotal, nullptr, VP_PrintsTotal_LEN, nullptr, screen.sendPrintsTotalToDisplay), #endif - VPHELPER(VP_X_STEP_PER_MM, &planner.settings.axis_steps_per_mm[X_AXIS], ScreenHandler.HandleStepPerMMChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>), - VPHELPER(VP_Y_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Y_AXIS], ScreenHandler.HandleStepPerMMChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>), - VPHELPER(VP_Z_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Z_AXIS], ScreenHandler.HandleStepPerMMChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>), + VPHELPER(VP_X_STEP_PER_MM, &planner.settings.axis_steps_per_mm[X_AXIS], screen.handleStepPerMMChanged, screen.sendFloatAsIntValueToDisplay<1>), + VPHELPER(VP_Y_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Y_AXIS], screen.handleStepPerMMChanged, screen.sendFloatAsIntValueToDisplay<1>), + VPHELPER(VP_Z_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Z_AXIS], screen.handleStepPerMMChanged, screen.sendFloatAsIntValueToDisplay<1>), #if HAS_HOTEND - VPHELPER(VP_E0_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(0)], ScreenHandler.HandleStepPerMMExtruderChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>), + VPHELPER(VP_E0_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(0)], screen.handleStepPerMMExtruderChanged, screen.sendFloatAsIntValueToDisplay<1>), #if HAS_MULTI_HOTEND - VPHELPER(VP_E1_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(1)], ScreenHandler.HandleStepPerMMExtruderChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>), + VPHELPER(VP_E1_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(1)], screen.handleStepPerMMExtruderChanged, screen.sendFloatAsIntValueToDisplay<1>), #endif #endif // SDCard File listing. #if HAS_MEDIA - VPHELPER(VP_SD_ScrollEvent, nullptr, ScreenHandler.DGUSLCD_SD_ScrollFilelist, nullptr), - VPHELPER(VP_SD_FileSelected, nullptr, ScreenHandler.DGUSLCD_SD_FileSelected, nullptr), - VPHELPER(VP_SD_FileSelectConfirm, nullptr, ScreenHandler.DGUSLCD_SD_StartPrint, nullptr), - VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename), - VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename), - VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename), - VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename), - VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename), - VPHELPER(VP_SD_ResumePauseAbort, nullptr, ScreenHandler.DGUSLCD_SD_ResumePauseAbort, nullptr), - VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, ScreenHandler.DGUSLCD_SD_ReallyAbort, nullptr), - VPHELPER(VP_SD_Print_Setting, nullptr, ScreenHandler.DGUSLCD_SD_PrintTune, nullptr), + VPHELPER(VP_SD_ScrollEvent, nullptr, screen.sdScrollFilelist, nullptr), + VPHELPER(VP_SD_FileSelected, nullptr, screen.sdFileSelected, nullptr), + VPHELPER(VP_SD_FileSelectConfirm, nullptr, screen.sdStartPrint, nullptr), + VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename), + VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename), + VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename), + VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename), + VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename), + VPHELPER(VP_SD_ResumePauseAbort, nullptr, screen.sdResumePauseAbort, nullptr), + VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, screen.sdReallyAbort, nullptr), + VPHELPER(VP_SD_Print_Setting, nullptr, screen.sdPrintTune, nullptr), #if HAS_BED_PROBE - VPHELPER(VP_SD_Print_ProbeOffsetZ, &probe.offset.z, ScreenHandler.HandleProbeOffsetZChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<2>), + VPHELPER(VP_SD_Print_ProbeOffsetZ, &probe.offset.z, screen.handleProbeOffsetZChanged, screen.sendFloatAsIntValueToDisplay<2>), #if ENABLED(BABYSTEPPING) - VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, ScreenHandler.HandleLiveAdjustZ, nullptr), + VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, screen.handleLiveAdjustZ, nullptr), #endif #endif #endif #if ENABLED(DGUS_UI_WAITING) - VPHELPER(VP_WAITING_STATUS, nullptr, nullptr, ScreenHandler.DGUSLCD_SendWaitingStatusToDisplay), + VPHELPER(VP_WAITING_STATUS, nullptr, nullptr, screen.sendWaitingStatusToDisplay), #endif // Messages for the User, shared by the popup and the kill screen. They can't be autouploaded as we do not buffer content. - { .VP = VP_MSGSTR1, .memadr = nullptr, .size = VP_MSGSTR1_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM }, - { .VP = VP_MSGSTR2, .memadr = nullptr, .size = VP_MSGSTR2_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM }, - { .VP = VP_MSGSTR3, .memadr = nullptr, .size = VP_MSGSTR3_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM }, - { .VP = VP_MSGSTR4, .memadr = nullptr, .size = VP_MSGSTR4_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM }, + { .VP = VP_MSGSTR1, .memadr = nullptr, .size = VP_MSGSTR1_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM }, + { .VP = VP_MSGSTR2, .memadr = nullptr, .size = VP_MSGSTR2_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM }, + { .VP = VP_MSGSTR3, .memadr = nullptr, .size = VP_MSGSTR3_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM }, + { .VP = VP_MSGSTR4, .memadr = nullptr, .size = VP_MSGSTR4_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM }, VPHELPER(0, 0, 0, 0) // must be last entry. }; diff --git a/Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.h b/Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.h index 3b7199f07eb8b..6270207990a70 100644 --- a/Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.h +++ b/Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.h @@ -23,35 +23,35 @@ #include "../DGUSDisplayDef.h" -enum DGUSLCD_Screens : uint8_t { - DGUSLCD_SCREEN_BOOT = 160, - DGUSLCD_SCREEN_MAIN = 1, - DGUSLCD_SCREEN_STATUS = 1, - DGUSLCD_SCREEN_STATUS2 = 1, - DGUSLCD_SCREEN_POWER_LOSS = 17, - DGUSLCD_SCREEN_TEMPERATURE = 40, - DGUSLCD_SCREEN_MANUALMOVE = 86, - DGUSLCD_SCREEN_PREHEAT = 48, - DGUSLCD_SCREEN_UTILITY = 70, - DGUSLCD_SCREEN_FILAMENT_HEATING = 80, - DGUSLCD_SCREEN_FILAMENT_LOADING = 76, - DGUSLCD_SCREEN_FILAMENT_UNLOADING = 82, - DGUSLCD_SCREEN_MANUALEXTRUDE = 84, - DGUSLCD_SCREEN_Z_OFFSET = 88, - DGUSLCD_SCREEN_SDFILELIST = 3, - DGUSLCD_SCREEN_SDPRINTMANIPULATION = 7, - DGUSLCD_SCREEN_SDPRINTTUNE = 9, - DGUSLCD_SCREEN_FLC_PREHEAT = 94, - DGUSLCD_SCREEN_FLC_PRINTING = 96, - DGUSLCD_SCREEN_STEPPERMM = 122, - DGUSLCD_SCREEN_PID_E = 126, - DGUSLCD_SCREEN_PID_BED = 128, - DGUSLCD_SCREEN_INFOS = 131, - DGUSLCD_SCREEN_CONFIRM = 240, - DGUSLCD_SCREEN_KILL = 250, ///< Kill Screen. Must always be 250 (to be able to display "Error wrong LCD Version") - DGUSLCD_SCREEN_WAITING = 251, - DGUSLCD_SCREEN_POPUP = 252, ///< special target, popup screen will also return this code to say "return to previous screen" - DGUSLCD_SCREEN_UNUSED = 255 +enum DGUS_ScreenID : uint8_t { + DGUS_SCREEN_BOOT = 160, + DGUS_SCREEN_MAIN = 1, + DGUS_SCREEN_STATUS = 1, + DGUS_SCREEN_STATUS2 = 1, + DGUS_SCREEN_POWER_LOSS = 17, + DGUS_SCREEN_TEMPERATURE = 40, + DGUS_SCREEN_MANUALMOVE = 86, + DGUS_SCREEN_PREHEAT = 48, + DGUS_SCREEN_UTILITY = 70, + DGUS_SCREEN_FILAMENT_HEATING = 80, + DGUS_SCREEN_FILAMENT_LOADING = 76, + DGUS_SCREEN_FILAMENT_UNLOADING = 82, + DGUS_SCREEN_MANUALEXTRUDE = 84, + DGUS_SCREEN_Z_OFFSET = 88, + DGUS_SCREEN_SDFILELIST = 3, + DGUS_SCREEN_SDPRINTMANIPULATION = 7, + DGUS_SCREEN_SDPRINTTUNE = 9, + DGUS_SCREEN_FLC_PREHEAT = 94, + DGUS_SCREEN_FLC_PRINTING = 96, + DGUS_SCREEN_STEPPERMM = 122, + DGUS_SCREEN_PID_E = 126, + DGUS_SCREEN_PID_BED = 128, + DGUS_SCREEN_INFOS = 131, + DGUS_SCREEN_CONFIRM = 240, + DGUS_SCREEN_KILL = 250, ///< Kill Screen. Must always be 250 (to be able to display "Error wrong LCD Version") + DGUS_SCREEN_WAITING = 251, + DGUS_SCREEN_POPUP = 252, ///< special target, popup screen will also return this code to say "return to previous screen" + DGUS_SCREEN_UNUSED = 255 }; // Display Memory layout used (T5UID) diff --git a/Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.cpp index d0119d494f4be..f817453f1b0ec 100644 --- a/Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.cpp @@ -44,7 +44,7 @@ extern ExtUI::FileList filelist; - void DGUSScreenHandler::DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::sdFileSelected(DGUS_VP_Variable &var, void *val_ptr) { uint16_t touched_nr = (int16_t)swap16(*(uint16_t*)val_ptr) + top_file; if (touched_nr > filelist.count()) return; if (!filelist.seek(touched_nr)) return; @@ -52,28 +52,28 @@ if (filelist.isDir()) { filelist.changeDir(filelist.filename()); top_file = 0; - ForceCompleteUpdate(); + forceCompleteUpdate(); return; } #if ENABLED(DGUS_PRINT_FILENAME) // Send print filename - dgusdisplay.WriteVariable(VP_SD_Print_Filename, filelist.filename(), VP_SD_FileName_LEN, true); + dgus.writeVariable(VP_SD_Print_Filename, filelist.filename(), VP_SD_FileName_LEN, true); #endif // Setup Confirmation screen file_to_print = touched_nr; - HandleUserConfirmationPopUp(VP_SD_FileSelectConfirm, nullptr, PSTR("Print file"), filelist.filename(), PSTR("from SD Card?"), true, true, false, true); + handleUserConfirmationPopUp(VP_SD_FileSelectConfirm, nullptr, PSTR("Print file"), filelist.filename(), PSTR("from SD Card?"), true, true, false, true); } - void DGUSScreenHandler::DGUSLCD_SD_StartPrint(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::sdStartPrint(DGUS_VP_Variable &var, void *val_ptr) { if (!filelist.seek(file_to_print)) return; ExtUI::printFile(filelist.shortFilename()); - GotoScreen(DGUSLCD_SCREEN_SDPRINTMANIPULATION); + gotoScreen(DGUS_SCREEN_SDPRINTMANIPULATION); } - void DGUSScreenHandler::DGUSLCD_SD_ResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::sdResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr) { if (!ExtUI::isPrintingFromMedia()) return; // avoid race condition when user stays in this menu and printer finishes. switch (swap16(*(uint16_t*)val_ptr)) { @@ -85,19 +85,19 @@ case 1: // Pause - GotoScreen(MKSLCD_SCREEN_PAUSE); + gotoScreen(MKSLCD_SCREEN_PAUSE); if (!ExtUI::isPrintingFromMediaPaused()) { ExtUI::pausePrint(); //ExtUI::mks_pausePrint(); } break; case 2: // Abort - HandleUserConfirmationPopUp(VP_SD_AbortPrintConfirmed, nullptr, PSTR("Abort printing"), filelist.filename(), PSTR("?"), true, true, false, true); + handleUserConfirmationPopUp(VP_SD_AbortPrintConfirmed, nullptr, PSTR("Abort printing"), filelist.filename(), PSTR("?"), true, true, false, true); break; } } - void DGUSScreenHandler::DGUSLCD_SD_SendFilename(DGUS_VP_Variable& var) { + void DGUSScreenHandler::sdSendFilename(DGUS_VP_Variable& var) { uint16_t target_line = (var.VP - VP_SD_FileName0) / VP_SD_FileName_LEN; if (target_line > DGUS_SD_FILESPERSCREEN) return; char tmpfilename[VP_SD_FileName_LEN + 1] = ""; @@ -106,49 +106,49 @@ if (filelist.seek(top_file + target_line)) { snprintf_P(tmpfilename, VP_SD_FileName_LEN, PSTR("%s%c"), filelist.filename(), filelist.isDir() ? '/' : 0); // snprintf_P(tmpfilename, VP_SD_FileName_LEN, PSTR("%s"), filelist.filename()); } - DGUSLCD_SendStringToDisplay(var); + sendStringToDisplay(var); } - void DGUSScreenHandler::SDCardInserted() { + void DGUSScreenHandler::sdCardInserted() { top_file = 0; filelist.refresh(); auto cs = getCurrentScreen(); - if (cs == DGUSLCD_SCREEN_MAIN || cs == DGUSLCD_SCREEN_STATUS) - GotoScreen(DGUSLCD_SCREEN_SDFILELIST); + if (cs == DGUS_SCREEN_MAIN || cs == DGUS_SCREEN_STATUS) + gotoScreen(DGUS_SCREEN_SDFILELIST); } - void DGUSScreenHandler::SDCardRemoved() { - if (current_screen == DGUSLCD_SCREEN_SDFILELIST - || (current_screen == DGUSLCD_SCREEN_CONFIRM && (ConfirmVP == VP_SD_AbortPrintConfirmed || ConfirmVP == VP_SD_FileSelectConfirm)) - || current_screen == DGUSLCD_SCREEN_SDPRINTMANIPULATION - ) GotoScreen(DGUSLCD_SCREEN_MAIN); + void DGUSScreenHandler::sdCardRemoved() { + if (current_screenID == DGUS_SCREEN_SDFILELIST + || (current_screenID == DGUS_SCREEN_CONFIRM && (confirmVP == VP_SD_AbortPrintConfirmed || confirmVP == VP_SD_FileSelectConfirm)) + || current_screenID == DGUS_SCREEN_SDPRINTMANIPULATION + ) gotoScreen(DGUS_SCREEN_MAIN); } #endif // HAS_MEDIA -void DGUSScreenHandler::ScreenChangeHook(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandler::screenChangeHook(DGUS_VP_Variable &var, void *val_ptr) { uint8_t *tmp = (uint8_t*)val_ptr; // The keycode in target is coded as , so 0x0100A means - // from screen 1 (main) to 10 (temperature). DGUSLCD_SCREEN_POPUP is special, + // from screen 1 (main) to 10 (temperature). DGUS_SCREEN_POPUP is special, // meaning "return to previous screen" - DGUSLCD_Screens target = (DGUSLCD_Screens)tmp[1]; + DGUS_ScreenID target = (DGUS_ScreenID)tmp[1]; - if (target == DGUSLCD_SCREEN_POPUP) { + if (target == DGUS_SCREEN_POPUP) { // Special handling for popup is to return to previous menu - if (current_screen == DGUSLCD_SCREEN_POPUP && confirm_action_cb) confirm_action_cb(); - PopToOldScreen(); + if (current_screenID == DGUS_SCREEN_POPUP && confirm_action_cb) confirm_action_cb(); + popToOldScreen(); return; } - UpdateNewScreen(target); + updateNewScreen(target); #ifdef DEBUG_DGUSLCD - if (!DGUSLCD_FindScreenVPMapList(target)) DEBUG_ECHOLNPGM("WARNING: No screen Mapping found for ", target); + if (!findScreenVPMapList(target)) DEBUG_ECHOLNPGM("WARNING: No screen Mapping found for ", target); #endif } -void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandler::handleManualMove(DGUS_VP_Variable &var, void *val_ptr) { int16_t movevalue = swap16(*(uint16_t*)val_ptr); #if ENABLED(DGUS_UI_MOVE_DIS_OPTION) if (movevalue) { @@ -196,7 +196,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { char buf[6] = "G28 X"; buf[4] = axiscode; queue.enqueue_one_now(buf); - ForceCompleteUpdate(); + forceCompleteUpdate(); return; } else { @@ -219,14 +219,14 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { if (!old_relative_mode) queue.enqueue_now(F("G90")); } - ForceCompleteUpdate(); + forceCompleteUpdate(); cannotmove: return; } #if HAS_PID_HEATING - void DGUSScreenHandler::HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::handleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr) { uint16_t rawvalue = swap16(*(uint16_t*)val_ptr); float value = (float)rawvalue / 10; float newvalue = 0; @@ -257,17 +257,17 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { #endif // HAS_PID_HEATING #if ENABLED(BABYSTEPPING) - void DGUSScreenHandler::HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::handleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr) { int16_t flag = swap16(*(uint16_t*)val_ptr), steps = flag ? -20 : 20; ExtUI::smartAdjustAxis_steps(steps, ExtUI::axis_t::Z, true); - ForceCompleteUpdate(); + forceCompleteUpdate(); } #endif #if ENABLED(DGUS_FILAMENT_LOADUNLOAD) - void DGUSScreenHandler::HandleFilamentOption(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::handleFilamentOption(DGUS_VP_Variable &var, void *val_ptr) { uint8_t e_temp = 0; filament_data.heated = false; uint16_t preheat_option = swap16(*(uint16_t*)val_ptr); @@ -315,7 +315,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E1); #endif #endif - GotoScreen(DGUSLCD_SCREEN_UTILITY); + gotoScreen(DGUS_SCREEN_UTILITY); } else { // Go to the preheat screen to show the heating progress switch (var.VP) { @@ -333,11 +333,11 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { break; #endif } - GotoScreen(DGUSLCD_SCREEN_FILAMENT_HEATING); + gotoScreen(DGUS_SCREEN_FILAMENT_HEATING); } } - void DGUSScreenHandler::HandleFilamentLoadUnload(DGUS_VP_Variable &var) { + void DGUSScreenHandler::handleFilamentLoadUnload(DGUS_VP_Variable &var) { if (filament_data.action <= 0) return; // If we close to the target temperature, we can start load or unload the filament @@ -347,14 +347,14 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { if (filament_data.action == 1) { // load filament if (!filament_data.heated) { - //GotoScreen(DGUSLCD_SCREEN_FILAMENT_LOADING); + //gotoScreen(DGUS_SCREEN_FILAMENT_LOADING); filament_data.heated = true; } movevalue = ExtUI::getAxisPosition_mm(filament_data.extruder) + movevalue; } else { // unload filament if (!filament_data.heated) { - GotoScreen(DGUSLCD_SCREEN_FILAMENT_UNLOADING); + gotoScreen(DGUS_SCREEN_FILAMENT_UNLOADING); filament_data.heated = true; } // Before unloading extrude to prevent jamming @@ -372,14 +372,14 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { #endif // DGUS_FILAMENT_LOADUNLOAD bool DGUSScreenHandler::loop() { - dgusdisplay.loop(); + dgus.loop(); const millis_t ms = millis(); static millis_t next_event_ms = 0; - if (!IsScreenComplete() || ELAPSED(ms, next_event_ms)) { + if (!isScreenComplete() || ELAPSED(ms, next_event_ms)) { next_event_ms = ms + DGUS_UPDATE_INTERVAL_MS; - UpdateScreenVPData(); + updateScreenVPData(); } #if ENABLED(SHOW_BOOTSCREEN) @@ -390,11 +390,11 @@ bool DGUSScreenHandler::loop() { if (!booted && ELAPSED(ms, BOOTSCREEN_TIMEOUT)) { booted = true; - GotoScreen(TERN0(POWER_LOSS_RECOVERY, recovery.valid()) ? DGUSLCD_SCREEN_POWER_LOSS : DGUSLCD_SCREEN_MAIN); + gotoScreen(TERN0(POWER_LOSS_RECOVERY, recovery.valid()) ? DGUS_SCREEN_POWER_LOSS : DGUS_SCREEN_MAIN); } #endif - return IsScreenComplete(); + return isScreenComplete(); } #endif // DGUS_LCD_UI_HIPRECY diff --git a/Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.h b/Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.h index 73e3527d7e7c1..16c5dec408d6b 100644 --- a/Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.h +++ b/Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.h @@ -26,6 +26,6 @@ typedef DGUSScreenHandler DGUSScreenHandlerClass; #if ENABLED(POWER_LOSS_RECOVERY) - #define PLR_SCREEN_RECOVER DGUSLCD_SCREEN_SDPRINTMANIPULATION - #define PLR_SCREEN_CANCEL DGUSLCD_SCREEN_STATUS + #define PLR_SCREEN_RECOVER DGUS_SCREEN_SDPRINTMANIPULATION + #define PLR_SCREEN_CANCEL DGUS_SCREEN_STATUS #endif diff --git a/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.cpp b/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.cpp index 8dee8e26d7053..2b5b6d956e2a1 100644 --- a/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.cpp +++ b/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.cpp @@ -500,301 +500,301 @@ const char Updata_Time[] PROGMEM = STRING_DISTRIBUTION_DATE; const struct DGUS_VP_Variable ListOfVP[] PROGMEM = { // Helper to detect touch events - VPHELPER(VP_SCREENCHANGE, nullptr, ScreenHandler.ScreenChangeHook, nullptr), - VPHELPER(VP_SCREENCHANGE_ASK, nullptr, ScreenHandler.ScreenChangeHookIfIdle, nullptr), + VPHELPER(VP_SCREENCHANGE, nullptr, screen.screenChangeHook, nullptr), + VPHELPER(VP_SCREENCHANGE_ASK, nullptr, screen.screenChangeHookIfIdle, nullptr), #if HAS_MEDIA - VPHELPER(VP_SCREENCHANGE_WHENSD, nullptr, ScreenHandler.ScreenChangeHookIfSD, nullptr), + VPHELPER(VP_SCREENCHANGE_WHENSD, nullptr, screen.screenChangeHookIfSD, nullptr), #endif - VPHELPER(VP_CONFIRMED, nullptr, ScreenHandler.ScreenConfirmedOK, nullptr), + VPHELPER(VP_CONFIRMED, nullptr, screen.screenConfirmedOK, nullptr), // Back Button - VPHELPER(VP_BACK_PAGE, nullptr, ScreenHandler.ScreenBackChange, nullptr), - VPHELPER(VP_TEMP_ALL_OFF, nullptr, ScreenHandler.HandleAllHeatersOff, nullptr), + VPHELPER(VP_BACK_PAGE, nullptr, screen.screenBackChange, nullptr), + VPHELPER(VP_TEMP_ALL_OFF, nullptr, screen.handleAllHeatersOff, nullptr), - VPHELPER(VP_MOVE_X, nullptr, ScreenHandler.HandleManualMove, nullptr), - VPHELPER(VP_MOVE_Y, nullptr, ScreenHandler.HandleManualMove, nullptr), - VPHELPER(VP_MOVE_Z, nullptr, ScreenHandler.HandleManualMove, nullptr), - VPHELPER(VP_HOME_ALL, nullptr, ScreenHandler.HandleManualMove, nullptr), + VPHELPER(VP_MOVE_X, nullptr, screen.handleManualMove, nullptr), + VPHELPER(VP_MOVE_Y, nullptr, screen.handleManualMove, nullptr), + VPHELPER(VP_MOVE_Z, nullptr, screen.handleManualMove, nullptr), + VPHELPER(VP_HOME_ALL, nullptr, screen.handleManualMove, nullptr), - VPHELPER(VP_X_HOME, nullptr, ScreenHandler.HandleManualMove, nullptr), - VPHELPER(VP_Y_HOME, nullptr, ScreenHandler.HandleManualMove, nullptr), - VPHELPER(VP_Z_HOME, nullptr, ScreenHandler.HandleManualMove, nullptr), + VPHELPER(VP_X_HOME, nullptr, screen.handleManualMove, nullptr), + VPHELPER(VP_Y_HOME, nullptr, screen.handleManualMove, nullptr), + VPHELPER(VP_Z_HOME, nullptr, screen.handleManualMove, nullptr), - VPHELPER(VP_MOVE_DISTANCE, &manualMoveStep, ScreenHandler.GetManualMovestep, nullptr), + VPHELPER(VP_MOVE_DISTANCE, &manualMoveStep, screen.getManualMovestep, nullptr), - VPHELPER(VP_MOTOR_LOCK_UNLOK, nullptr, ScreenHandler.HandleManualMove, nullptr), - VPHELPER(VP_LEVEL_POINT, nullptr, ScreenHandler.ManualAssistLeveling, nullptr), + VPHELPER(VP_MOTOR_LOCK_UNLOK, nullptr, screen.handleManualMove, nullptr), + VPHELPER(VP_LEVEL_POINT, nullptr, screen.manualAssistLeveling, nullptr), #if ENABLED(POWER_LOSS_RECOVERY) - VPHELPER(VP_POWER_LOSS_RECOVERY, nullptr, ScreenHandler.HandlePowerLossRecovery, nullptr), + VPHELPER(VP_POWER_LOSS_RECOVERY, nullptr, screen.handlePowerLossRecovery, nullptr), #endif - VPHELPER(VP_SETTINGS, nullptr, ScreenHandler.HandleSettings, nullptr), + VPHELPER(VP_SETTINGS, nullptr, screen.handleSettings, nullptr), #if ENABLED(SINGLE_Z_CALIBRATION) - VPHELPER(VP_Z_CALIBRATE, nullptr, ScreenHandler.HandleZCalibration, nullptr), + VPHELPER(VP_Z_CALIBRATE, nullptr, screen.handleZCalibration, nullptr), #endif #if ENABLED(FIRST_LAYER_CAL) - VPHELPER(VP_Z_FIRST_LAYER_CAL, nullptr, ScreenHandler.HandleFirstLayerCal, nullptr), + VPHELPER(VP_Z_FIRST_LAYER_CAL, nullptr, screen.handleFirstLayerCal, nullptr), #endif - {.VP = VP_MARLIN_VERSION, .memadr = (void *)MarlinVersion, .size = VP_MARLIN_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM}, + {.VP = VP_MARLIN_VERSION, .memadr = (void *)MarlinVersion, .size = VP_MARLIN_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM}, // M117 LCD String (We don't need the string in memory but "just" push it to the display on demand, hence the nullptr - {.VP = VP_M117, .memadr = nullptr, .size = VP_M117_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplay}, - {.VP = VP_MKS_H43_VERSION, .memadr = (void *)H43Version, .size = VP_MKS_H43_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM}, - {.VP = VP_MKS_H43_UpdataVERSION, .memadr = (void *)Updata_Time, .size = VP_MKS_H43_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM}, + {.VP = VP_M117, .memadr = nullptr, .size = VP_M117_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplay}, + {.VP = VP_MKS_H43_VERSION, .memadr = (void *)H43Version, .size = VP_MKS_H43_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM}, + {.VP = VP_MKS_H43_UpdataVERSION, .memadr = (void *)Updata_Time, .size = VP_MKS_H43_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM}, // Temperature Data #if HAS_HOTEND - VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>), - VPHELPER(VP_T_E0_Set, &thermalManager.temp_hotend[0].target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_Flowrate_E0, &planner.flow_percentage[ExtUI::extruder_t::E0], ScreenHandler.HandleFlowRateChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_EPos, &destination.e, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>), - VPHELPER(VP_MOVE_E0, nullptr, ScreenHandler.HandleManualExtrude, nullptr), - VPHELPER(VP_E0_CONTROL, &thermalManager.temp_hotend[0].target, ScreenHandler.HandleHeaterControl, nullptr), - VPHELPER(VP_E0_STATUS, &thermalManager.temp_hotend[0].target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay), + VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, screen.sendFloatAsLongValueToDisplay<0>), + VPHELPER(VP_T_E0_Set, &thermalManager.temp_hotend[0].target, screen.handleTemperatureChanged, screen.sendWordValueToDisplay), + VPHELPER(VP_Flowrate_E0, &planner.flow_percentage[ExtUI::extruder_t::E0], screen.handleFlowRateChanged, screen.sendWordValueToDisplay), + VPHELPER(VP_EPos, &destination.e, nullptr, screen.sendFloatAsLongValueToDisplay<2>), + VPHELPER(VP_MOVE_E0, nullptr, screen.handleManualExtrude, nullptr), + VPHELPER(VP_E0_CONTROL, &thermalManager.temp_hotend[0].target, screen.handleHeaterControl, nullptr), + VPHELPER(VP_E0_STATUS, &thermalManager.temp_hotend[0].target, nullptr, screen.sendHeaterStatusToDisplay), #if ENABLED(DGUS_PREHEAT_UI) - VPHELPER(VP_E0_BED_PREHEAT, nullptr, ScreenHandler.HandlePreheat, nullptr), + VPHELPER(VP_E0_BED_PREHEAT, nullptr, screen.handlePreheat, nullptr), #endif #if ENABLED(PIDTEMP) - VPHELPER(VP_E0_PID_P, &thermalManager.temp_hotend[0].pid.Kp, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID), - VPHELPER(VP_E0_PID_I, &thermalManager.temp_hotend[0].pid.Ki, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID), - VPHELPER(VP_E0_PID_D, &thermalManager.temp_hotend[0].pid.Kd, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID), - VPHELPER(VP_PID_AUTOTUNE_E0, nullptr, ScreenHandler.HandlePIDAutotune, nullptr), + VPHELPER(VP_E0_PID_P, &thermalManager.temp_hotend[0].pid.Kp, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID), + VPHELPER(VP_E0_PID_I, &thermalManager.temp_hotend[0].pid.Ki, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID), + VPHELPER(VP_E0_PID_D, &thermalManager.temp_hotend[0].pid.Kd, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID), + VPHELPER(VP_PID_AUTOTUNE_E0, nullptr, screen.handlePIDAutotune, nullptr), #endif #if ENABLED(DGUS_FILAMENT_LOADUNLOAD) - VPHELPER(VP_LOAD_Filament, nullptr, ScreenHandler.FilamentLoad, nullptr), - VPHELPER(VP_UNLOAD_Filament, nullptr, ScreenHandler.FilamentUnLoad, nullptr), - VPHELPER(VP_Filament_distance, &distanceFilament, ScreenHandler.GetManualFilament, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_Filament_speed, &filamentSpeed_mm_s, ScreenHandler.GetManualFilamentSpeed, ScreenHandler.DGUSLCD_SendWordValueToDisplay), + VPHELPER(VP_LOAD_Filament, nullptr, screen.filamentLoad, nullptr), + VPHELPER(VP_UNLOAD_Filament, nullptr, screen.filamentUnload, nullptr), + VPHELPER(VP_Filament_distance, &distanceFilament, screen.getManualFilament, screen.sendWordValueToDisplay), + VPHELPER(VP_Filament_speed, &filamentSpeed_mm_s, screen.getManualFilamentSpeed, screen.sendWordValueToDisplay), #endif #endif #if HAS_MULTI_HOTEND - VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>), - VPHELPER(VP_T_E1_Set, &thermalManager.temp_hotend[1].target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_Flowrate_E1, &planner.flow_percentage[ExtUI::extruder_t::E1], ScreenHandler.HandleFlowRateChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_MOVE_E1, nullptr, ScreenHandler.HandleManualExtrude, nullptr), - VPHELPER(VP_E1_CONTROL, &thermalManager.temp_hotend[1].target, ScreenHandler.HandleHeaterControl, nullptr), - VPHELPER(VP_E1_STATUS, &thermalManager.temp_hotend[1].target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay), + VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, screen.sendFloatAsLongValueToDisplay<0>), + VPHELPER(VP_T_E1_Set, &thermalManager.temp_hotend[1].target, screen.handleTemperatureChanged, screen.sendWordValueToDisplay), + VPHELPER(VP_Flowrate_E1, &planner.flow_percentage[ExtUI::extruder_t::E1], screen.handleFlowRateChanged, screen.sendWordValueToDisplay), + VPHELPER(VP_MOVE_E1, nullptr, screen.handleManualExtrude, nullptr), + VPHELPER(VP_E1_CONTROL, &thermalManager.temp_hotend[1].target, screen.handleHeaterControl, nullptr), + VPHELPER(VP_E1_STATUS, &thermalManager.temp_hotend[1].target, nullptr, screen.sendHeaterStatusToDisplay), #if ENABLED(DGUS_FILAMENT_LOADUNLOAD) - VPHELPER(VP_Filament_distance, &distanceFilament, ScreenHandler.GetManualFilament, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>), - VPHELPER(VP_Filament_speed, &filamentSpeed_mm_s, ScreenHandler.GetManualFilamentSpeed, ScreenHandler.DGUSLCD_SendWordValueToDisplay), + VPHELPER(VP_Filament_distance, &distanceFilament, screen.getManualFilament, screen.sendFloatAsIntValueToDisplay<0>), + VPHELPER(VP_Filament_speed, &filamentSpeed_mm_s, screen.getManualFilamentSpeed, screen.sendWordValueToDisplay), #endif #if ENABLED(PIDTEMP) - VPHELPER(VP_PID_AUTOTUNE_E1, nullptr, ScreenHandler.HandlePIDAutotune, nullptr), + VPHELPER(VP_PID_AUTOTUNE_E1, nullptr, screen.handlePIDAutotune, nullptr), #endif - VPHELPER(VP_E1_FILAMENT_LOAD_UNLOAD, nullptr, ScreenHandler.HandleFilamentOption, ScreenHandler.HandleFilamentLoadUnload), + VPHELPER(VP_E1_FILAMENT_LOAD_UNLOAD, nullptr, screen.handleFilamentOption, screen.handleFilamentLoadUnload), #endif #if HAS_HEATED_BED - VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>), - VPHELPER(VP_T_Bed_Set, &thermalManager.temp_bed.target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_BED_CONTROL, &thermalManager.temp_bed.target, ScreenHandler.HandleHeaterControl, nullptr), - VPHELPER(VP_BED_STATUS, &thermalManager.temp_bed.target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay), + VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.celsius, nullptr, screen.sendFloatAsLongValueToDisplay<0>), + VPHELPER(VP_T_Bed_Set, &thermalManager.temp_bed.target, screen.handleTemperatureChanged, screen.sendWordValueToDisplay), + VPHELPER(VP_BED_CONTROL, &thermalManager.temp_bed.target, screen.handleHeaterControl, nullptr), + VPHELPER(VP_BED_STATUS, &thermalManager.temp_bed.target, nullptr, screen.sendHeaterStatusToDisplay), #if ENABLED(PIDTEMPBED) - VPHELPER(VP_BED_PID_P, &thermalManager.temp_bed.pid.Kp, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID), - VPHELPER(VP_BED_PID_I, &thermalManager.temp_bed.pid.Ki, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID), - VPHELPER(VP_BED_PID_D, &thermalManager.temp_bed.pid.Kd, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID), - VPHELPER(VP_PID_AUTOTUNE_BED, nullptr, ScreenHandler.HandlePIDAutotune, nullptr), + VPHELPER(VP_BED_PID_P, &thermalManager.temp_bed.pid.Kp, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID), + VPHELPER(VP_BED_PID_I, &thermalManager.temp_bed.pid.Ki, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID), + VPHELPER(VP_BED_PID_D, &thermalManager.temp_bed.pid.Kd, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID), + VPHELPER(VP_PID_AUTOTUNE_BED, nullptr, screen.handlePIDAutotune, nullptr), #endif #endif // Fan Data #if HAS_FAN #define FAN_VPHELPER(N) \ - VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], ScreenHandler.DGUSLCD_SetUint8, ScreenHandler.DGUSLCD_SendFanToDisplay), \ - VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], ScreenHandler.HandleFanControl, nullptr), \ - VPHELPER(VP_FAN##N##_STATUS, &thermalManager.fan_speed[N], nullptr, ScreenHandler.DGUSLCD_SendFanStatusToDisplay), + VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], screen.setUint8, screen.sendFanToDisplay), \ + VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], screen.handleFanControl, nullptr), \ + VPHELPER(VP_FAN##N##_STATUS, &thermalManager.fan_speed[N], nullptr, screen.sendFanStatusToDisplay), REPEAT(FAN_COUNT, FAN_VPHELPER) #endif // Feedrate - VPHELPER(VP_Feedrate_Percentage, &feedrate_percentage, ScreenHandler.DGUSLCD_SetValueDirectly, ScreenHandler.DGUSLCD_SendWordValueToDisplay), + VPHELPER(VP_Feedrate_Percentage, &feedrate_percentage, screen.setValueDirectly, screen.sendWordValueToDisplay), // Position Data - VPHELPER(VP_XPos, ¤t_position.x, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>), - VPHELPER(VP_YPos, ¤t_position.y, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>), - VPHELPER(VP_ZPos, ¤t_position.z, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>), + VPHELPER(VP_XPos, ¤t_position.x, nullptr, screen.sendFloatAsLongValueToDisplay<2>), + VPHELPER(VP_YPos, ¤t_position.y, nullptr, screen.sendFloatAsLongValueToDisplay<2>), + VPHELPER(VP_ZPos, ¤t_position.z, nullptr, screen.sendFloatAsLongValueToDisplay<2>), // Level Point Set - VPHELPER(VP_Level_Point_One_X, &mks_corner_offsets[0].x, ScreenHandler.HandleChangeLevelPoint, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_Level_Point_One_Y, &mks_corner_offsets[0].y, ScreenHandler.HandleChangeLevelPoint, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_Level_Point_Two_X, &mks_corner_offsets[1].x, ScreenHandler.HandleChangeLevelPoint, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_Level_Point_Two_Y, &mks_corner_offsets[1].y, ScreenHandler.HandleChangeLevelPoint, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_Level_Point_Three_X, &mks_corner_offsets[2].x, ScreenHandler.HandleChangeLevelPoint, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_Level_Point_Three_Y, &mks_corner_offsets[2].y, ScreenHandler.HandleChangeLevelPoint, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_Level_Point_Four_X, &mks_corner_offsets[3].x, ScreenHandler.HandleChangeLevelPoint, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_Level_Point_Four_Y, &mks_corner_offsets[3].y, ScreenHandler.HandleChangeLevelPoint, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_Level_Point_Five_X, &mks_corner_offsets[4].x, ScreenHandler.HandleChangeLevelPoint, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_Level_Point_Five_Y, &mks_corner_offsets[4].y, ScreenHandler.HandleChangeLevelPoint, ScreenHandler.DGUSLCD_SendWordValueToDisplay), + VPHELPER(VP_Level_Point_One_X, &mks_corner_offsets[0].x, screen.handleChangeLevelPoint, screen.sendWordValueToDisplay), + VPHELPER(VP_Level_Point_One_Y, &mks_corner_offsets[0].y, screen.handleChangeLevelPoint, screen.sendWordValueToDisplay), + VPHELPER(VP_Level_Point_Two_X, &mks_corner_offsets[1].x, screen.handleChangeLevelPoint, screen.sendWordValueToDisplay), + VPHELPER(VP_Level_Point_Two_Y, &mks_corner_offsets[1].y, screen.handleChangeLevelPoint, screen.sendWordValueToDisplay), + VPHELPER(VP_Level_Point_Three_X, &mks_corner_offsets[2].x, screen.handleChangeLevelPoint, screen.sendWordValueToDisplay), + VPHELPER(VP_Level_Point_Three_Y, &mks_corner_offsets[2].y, screen.handleChangeLevelPoint, screen.sendWordValueToDisplay), + VPHELPER(VP_Level_Point_Four_X, &mks_corner_offsets[3].x, screen.handleChangeLevelPoint, screen.sendWordValueToDisplay), + VPHELPER(VP_Level_Point_Four_Y, &mks_corner_offsets[3].y, screen.handleChangeLevelPoint, screen.sendWordValueToDisplay), + VPHELPER(VP_Level_Point_Five_X, &mks_corner_offsets[4].x, screen.handleChangeLevelPoint, screen.sendWordValueToDisplay), + VPHELPER(VP_Level_Point_Five_Y, &mks_corner_offsets[4].y, screen.handleChangeLevelPoint, screen.sendWordValueToDisplay), // Print Progress - VPHELPER(VP_PrintProgress_Percentage, nullptr, nullptr, ScreenHandler.DGUSLCD_SendPrintProgressToDisplay), + VPHELPER(VP_PrintProgress_Percentage, nullptr, nullptr, screen.sendPrintProgressToDisplay), // LCD Control - VPHELPER(VP_LCD_BLK, &lcd_default_light, ScreenHandler.LCD_BLK_Adjust, ScreenHandler.DGUSLCD_SendWordValueToDisplay), + VPHELPER(VP_LCD_BLK, &lcd_default_light, screen.lcdBLKAdjust, screen.sendWordValueToDisplay), // SD File - Back - VPHELPER(VP_SD_FileSelect_Back, nullptr, ScreenHandler.SD_FileBack, nullptr), + VPHELPER(VP_SD_FileSelect_Back, nullptr, screen.sdFileBack, nullptr), // Print Time - VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintTimeToDisplay), + VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, screen.sendPrintTimeToDisplay), #if ENABLED(PRINTCOUNTER) - VPHELPER_STR(VP_PrintAccTime, nullptr, VP_PrintAccTime_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintAccTimeToDisplay), - VPHELPER_STR(VP_PrintsTotal, nullptr, VP_PrintsTotal_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintsTotalToDisplay), + VPHELPER_STR(VP_PrintAccTime, nullptr, VP_PrintAccTime_LEN, nullptr, screen.sendPrintAccTimeToDisplay), + VPHELPER_STR(VP_PrintsTotal, nullptr, VP_PrintsTotal_LEN, nullptr, screen.sendPrintsTotalToDisplay), #endif - VPHELPER(VP_X_STEP_PER_MM, &planner.settings.axis_steps_per_mm[X_AXIS], ScreenHandler.HandleStepPerMMChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>), - VPHELPER(VP_Y_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Y_AXIS], ScreenHandler.HandleStepPerMMChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>), - VPHELPER(VP_Z_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Z_AXIS], ScreenHandler.HandleStepPerMMChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>), + VPHELPER(VP_X_STEP_PER_MM, &planner.settings.axis_steps_per_mm[X_AXIS], screen.handleStepPerMMChanged, screen.sendFloatAsIntValueToDisplay<0>), + VPHELPER(VP_Y_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Y_AXIS], screen.handleStepPerMMChanged, screen.sendFloatAsIntValueToDisplay<0>), + VPHELPER(VP_Z_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Z_AXIS], screen.handleStepPerMMChanged, screen.sendFloatAsIntValueToDisplay<0>), - VPHELPER(VP_X_MAX_SPEED, &planner.settings.max_feedrate_mm_s[X_AXIS], ScreenHandler.HandleMaxSpeedChange, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>), - VPHELPER(VP_Y_MAX_SPEED, &planner.settings.max_feedrate_mm_s[Y_AXIS], ScreenHandler.HandleMaxSpeedChange, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>), - VPHELPER(VP_Z_MAX_SPEED, &planner.settings.max_feedrate_mm_s[Z_AXIS], ScreenHandler.HandleMaxSpeedChange, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>), + VPHELPER(VP_X_MAX_SPEED, &planner.settings.max_feedrate_mm_s[X_AXIS], screen.handleMaxSpeedChange, screen.sendFloatAsIntValueToDisplay<0>), + VPHELPER(VP_Y_MAX_SPEED, &planner.settings.max_feedrate_mm_s[Y_AXIS], screen.handleMaxSpeedChange, screen.sendFloatAsIntValueToDisplay<0>), + VPHELPER(VP_Z_MAX_SPEED, &planner.settings.max_feedrate_mm_s[Z_AXIS], screen.handleMaxSpeedChange, screen.sendFloatAsIntValueToDisplay<0>), #if HAS_HOTEND - VPHELPER(VP_E0_MAX_SPEED, &planner.settings.max_feedrate_mm_s[E_AXIS_N(0)], ScreenHandler.HandleExtruderMaxSpeedChange, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>), + VPHELPER(VP_E0_MAX_SPEED, &planner.settings.max_feedrate_mm_s[E_AXIS_N(0)], screen.handleExtruderMaxSpeedChange, screen.sendFloatAsIntValueToDisplay<0>), #if HAS_MULTI_HOTEND - VPHELPER(VP_E1_MAX_SPEED, &planner.settings.max_feedrate_mm_s[E_AXIS_N(1)], ScreenHandler.HandleExtruderMaxSpeedChange, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>), + VPHELPER(VP_E1_MAX_SPEED, &planner.settings.max_feedrate_mm_s[E_AXIS_N(1)], screen.handleExtruderMaxSpeedChange, screen.sendFloatAsIntValueToDisplay<0>), #endif #endif - VPHELPER(VP_X_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[X_AXIS], ScreenHandler.HandleMaxAccChange, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_Y_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[Y_AXIS], ScreenHandler.HandleMaxAccChange, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_Z_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[Z_AXIS], ScreenHandler.HandleMaxAccChange, ScreenHandler.DGUSLCD_SendWordValueToDisplay), + VPHELPER(VP_X_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[X_AXIS], screen.handleMaxAccChange, screen.sendWordValueToDisplay), + VPHELPER(VP_Y_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[Y_AXIS], screen.handleMaxAccChange, screen.sendWordValueToDisplay), + VPHELPER(VP_Z_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[Z_AXIS], screen.handleMaxAccChange, screen.sendWordValueToDisplay), #if HAS_HOTEND - VPHELPER(VP_E0_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(0)], ScreenHandler.HandleExtruderAccChange, ScreenHandler.DGUSLCD_SendWordValueToDisplay), + VPHELPER(VP_E0_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(0)], screen.handleExtruderAccChange, screen.sendWordValueToDisplay), #if HAS_MULTI_HOTEND - VPHELPER(VP_E1_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)], ScreenHandler.HandleExtruderAccChange, ScreenHandler.DGUSLCD_SendWordValueToDisplay), + VPHELPER(VP_E1_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)], screen.handleExtruderAccChange, screen.sendWordValueToDisplay), #endif #endif - VPHELPER(VP_TRAVEL_SPEED, (uint16_t *)&planner.settings.travel_acceleration, ScreenHandler.HandleTravelAccChange, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>), - VPHELPER(VP_FEEDRATE_MIN_SPEED, (uint16_t *)&planner.settings.min_feedrate_mm_s, ScreenHandler.HandleFeedRateMinChange, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>), - VPHELPER(VP_T_F_SPEED, (uint16_t *)&planner.settings.min_travel_feedrate_mm_s, ScreenHandler.HandleMin_T_F, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>), - VPHELPER(VP_ACC_SPEED, (uint16_t *)&planner.settings.acceleration, ScreenHandler.HandleAccChange, ScreenHandler.DGUSLCD_SendWordValueToDisplay), + VPHELPER(VP_TRAVEL_SPEED, (uint16_t *)&planner.settings.travel_acceleration, screen.handleTravelAccChange, screen.sendFloatAsIntValueToDisplay<0>), + VPHELPER(VP_FEEDRATE_MIN_SPEED, (uint16_t *)&planner.settings.min_feedrate_mm_s, screen.handleFeedRateMinChange, screen.sendFloatAsIntValueToDisplay<0>), + VPHELPER(VP_T_F_SPEED, (uint16_t *)&planner.settings.min_travel_feedrate_mm_s, screen.handleMin_T_F, screen.sendFloatAsIntValueToDisplay<0>), + VPHELPER(VP_ACC_SPEED, (uint16_t *)&planner.settings.acceleration, screen.handleAccChange, screen.sendWordValueToDisplay), - VPHELPER(VP_X_PARK_POS, &mks_park_pos.x, ScreenHandler.GetParkPos, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_Y_PARK_POS, &mks_park_pos.y, ScreenHandler.GetParkPos, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_Z_PARK_POS, &mks_park_pos.z, ScreenHandler.GetParkPos, ScreenHandler.DGUSLCD_SendWordValueToDisplay), + VPHELPER(VP_X_PARK_POS, &mks_park_pos.x, screen.getParkPos, screen.sendWordValueToDisplay), + VPHELPER(VP_Y_PARK_POS, &mks_park_pos.y, screen.getParkPos, screen.sendWordValueToDisplay), + VPHELPER(VP_Z_PARK_POS, &mks_park_pos.z, screen.getParkPos, screen.sendWordValueToDisplay), #if ENABLED(PREVENT_COLD_EXTRUSION) - VPHELPER(VP_MIN_EX_T, &thermalManager.extrude_min_temp, ScreenHandler.HandleGetExMinTemp, ScreenHandler.DGUSLCD_SendWordValueToDisplay), + VPHELPER(VP_MIN_EX_T, &thermalManager.extrude_min_temp, screen.handleGetExMinTemp, screen.sendWordValueToDisplay), #endif #if ENABLED(SENSORLESS_HOMING) // TMC SENSORLESS Setting #if X_HAS_STEALTHCHOP - VPHELPER(VP_TMC_X_STEP, &tmc_step.x, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendTMCStepValue), + VPHELPER(VP_TMC_X_STEP, &tmc_step.x, screen.tmcChangeConfig, screen.sendTMCStepValue), #endif #if Y_HAS_STEALTHCHOP - VPHELPER(VP_TMC_Y_STEP, &tmc_step.y, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendTMCStepValue), + VPHELPER(VP_TMC_Y_STEP, &tmc_step.y, screen.tmcChangeConfig, screen.sendTMCStepValue), #endif #if Z_HAS_STEALTHCHOP - VPHELPER(VP_TMC_Z_STEP, &tmc_step.z, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendTMCStepValue), + VPHELPER(VP_TMC_Z_STEP, &tmc_step.z, screen.tmcChangeConfig, screen.sendTMCStepValue), #endif #endif #if HAS_TRINAMIC_CONFIG // TMC Current Setting #if AXIS_IS_TMC(X) - VPHELPER(VP_TMC_X_Current, &stepperX.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay), + VPHELPER(VP_TMC_X_Current, &stepperX.val_mA, screen.tmcChangeConfig, screen.sendWordValueToDisplay), #endif #if AXIS_IS_TMC(Y) - VPHELPER(VP_TMC_Y_Current, &stepperY.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay), + VPHELPER(VP_TMC_Y_Current, &stepperY.val_mA, screen.tmcChangeConfig, screen.sendWordValueToDisplay), #endif #if AXIS_IS_TMC(Z) - VPHELPER(VP_TMC_Z_Current, &stepperZ.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay), + VPHELPER(VP_TMC_Z_Current, &stepperZ.val_mA, screen.tmcChangeConfig, screen.sendWordValueToDisplay), #endif #if AXIS_IS_TMC(E0) - VPHELPER(VP_TMC_E0_Current, &stepperE0.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay), + VPHELPER(VP_TMC_E0_Current, &stepperE0.val_mA, screen.tmcChangeConfig, screen.sendWordValueToDisplay), #endif #if AXIS_IS_TMC(E1) - VPHELPER(VP_TMC_E1_Current, &stepperE1.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay), + VPHELPER(VP_TMC_E1_Current, &stepperE1.val_mA, screen.tmcChangeConfig, screen.sendWordValueToDisplay), #endif #if AXIS_IS_TMC(X2) - VPHELPER(VP_TMC_X1_Current, &stepperX2.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay), + VPHELPER(VP_TMC_X1_Current, &stepperX2.val_mA, screen.tmcChangeConfig, screen.sendWordValueToDisplay), #endif #if AXIS_IS_TMC(Y2) - VPHELPER(VP_TMC_Y1_Current, &stepperY2.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay), + VPHELPER(VP_TMC_Y1_Current, &stepperY2.val_mA, screen.tmcChangeConfig, screen.sendWordValueToDisplay), #endif #if AXIS_IS_TMC(Z2) - VPHELPER(VP_TMC_Z1_Current, &stepperZ2.val_mA, ScreenHandler.TMC_ChangeConfig, ScreenHandler.DGUSLCD_SendWordValueToDisplay), + VPHELPER(VP_TMC_Z1_Current, &stepperZ2.val_mA, screen.tmcChangeConfig, screen.sendWordValueToDisplay), #endif #endif - VPHELPER(VP_EEPROM_CTRL, nullptr, ScreenHandler.EEPROM_CTRL, nullptr), - VPHELPER(VP_LEVEL_BUTTON, nullptr, ScreenHandler.Level_Ctrl, nullptr), - VPHELPER(VP_LANGUAGE_CHANGE, nullptr, ScreenHandler.LanguageChange, nullptr), + VPHELPER(VP_EEPROM_CTRL, nullptr, screen.eepromControl, nullptr), + VPHELPER(VP_LEVEL_BUTTON, nullptr, screen.levelControl, nullptr), + VPHELPER(VP_LANGUAGE_CHANGE, nullptr, screen.languageChange, nullptr), - //VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, ScreenHandler.HandleLiveAdjustZ, nullptr), + //VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, screen.handleLiveAdjustZ, nullptr), - VPHELPER(VP_SD_Print_LiveAdjustZ_Confirm, nullptr, ScreenHandler.ZoffsetConfirm, nullptr), + VPHELPER(VP_SD_Print_LiveAdjustZ_Confirm, nullptr, screen.zOffsetConfirm, nullptr), - VPHELPER(VP_ZOffset_Distance,nullptr ,ScreenHandler.GetZoffsetDistance, nullptr), - VPHELPER(VP_MESH_LEVEL_ADJUST, nullptr, ScreenHandler.MeshLevelDistanceConfig, nullptr), - VPHELPER(VP_MESH_LEVEL_POINT,nullptr, ScreenHandler.MeshLevel,nullptr), + VPHELPER(VP_ZOffset_Distance,nullptr ,screen.getZoffsetDistance, nullptr), + VPHELPER(VP_MESH_LEVEL_ADJUST, nullptr, screen.meshLevelDistanceConfig, nullptr), + VPHELPER(VP_MESH_LEVEL_POINT,nullptr, screen.meshLevel, nullptr), #if ENABLED(PREVENT_COLD_EXTRUSION) - VPHELPER(VP_Min_EX_T_E, &thermalManager.extrude_min_temp, ScreenHandler.GetMinExtrudeTemp, ScreenHandler.DGUSLCD_SendWordValueToDisplay), + VPHELPER(VP_Min_EX_T_E, &thermalManager.extrude_min_temp, screen.getMinExtrudeTemp, screen.sendWordValueToDisplay), #endif - VPHELPER(VP_AutoTurnOffSw, nullptr, ScreenHandler.GetTurnOffCtrl, nullptr), + VPHELPER(VP_AutoTurnOffSw, nullptr, screen.getTurnOffCtrl, nullptr), #if HAS_HOTEND - VPHELPER(VP_E0_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(0)], ScreenHandler.HandleStepPerMMExtruderChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>), + VPHELPER(VP_E0_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(0)], screen.handleStepPerMMExtruderChanged, screen.sendFloatAsIntValueToDisplay<0>), #if HAS_MULTI_HOTEND - VPHELPER(VP_E1_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(1)], ScreenHandler.HandleStepPerMMExtruderChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>), + VPHELPER(VP_E1_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(1)], screen.handleStepPerMMExtruderChanged, screen.sendFloatAsIntValueToDisplay<0>), #endif #endif // SDCard File listing #if HAS_MEDIA - VPHELPER(VP_SD_FileSelected, nullptr, ScreenHandler.DGUSLCD_SD_FileSelected, nullptr), - VPHELPER(VP_SD_ScrollEvent, nullptr, ScreenHandler.DGUSLCD_SD_ScrollFilelist, nullptr), - VPHELPER(VP_SD_FileSelectConfirm, nullptr, ScreenHandler.DGUSLCD_SD_StartPrint, nullptr), - VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename), - VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename), - VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename), - VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename), - VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename), - VPHELPER_STR(VP_SD_FileName5, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename), - VPHELPER_STR(VP_SD_FileName6, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename), - VPHELPER_STR(VP_SD_FileName7, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename), - VPHELPER_STR(VP_SD_FileName8, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename), - VPHELPER_STR(VP_SD_FileName9, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename), - VPHELPER(VP_SD_ResumePauseAbort, nullptr, ScreenHandler.DGUSLCD_SD_ResumePauseAbort, nullptr), - VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, ScreenHandler.DGUSLCD_SD_ReallyAbort, nullptr), - VPHELPER(VP_SD_Print_Setting, nullptr, ScreenHandler.DGUSLCD_SD_PrintTune, nullptr), + VPHELPER(VP_SD_FileSelected, nullptr, screen.sdFileSelected, nullptr), + VPHELPER(VP_SD_ScrollEvent, nullptr, screen.sdScrollFilelist, nullptr), + VPHELPER(VP_SD_FileSelectConfirm, nullptr, screen.sdStartPrint, nullptr), + VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename), + VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename), + VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename), + VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename), + VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename), + VPHELPER_STR(VP_SD_FileName5, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename), + VPHELPER_STR(VP_SD_FileName6, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename), + VPHELPER_STR(VP_SD_FileName7, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename), + VPHELPER_STR(VP_SD_FileName8, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename), + VPHELPER_STR(VP_SD_FileName9, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename), + VPHELPER(VP_SD_ResumePauseAbort, nullptr, screen.sdResumePauseAbort, nullptr), + VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, screen.sdReallyAbort, nullptr), + VPHELPER(VP_SD_Print_Setting, nullptr, screen.sdPrintTune, nullptr), #if ENABLED(BABYSTEPPING) - VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, ScreenHandler.HandleLiveAdjustZ, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<2>), - VPHELPER(VP_ZOffset_DE_DIS, &z_offset_add, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>), + VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, screen.handleLiveAdjustZ, screen.sendFloatAsIntValueToDisplay<2>), + VPHELPER(VP_ZOffset_DE_DIS, &z_offset_add, nullptr, screen.sendFloatAsLongValueToDisplay<2>), #endif #if HAS_BED_PROBE - VPHELPER(VP_OFFSET_X, &probe.offset.x, ScreenHandler.GetOffsetValue,ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>), - VPHELPER(VP_OFFSET_Y, &probe.offset.y, ScreenHandler.GetOffsetValue,ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>), - VPHELPER(VP_OFFSET_Z, &probe.offset.z, ScreenHandler.GetOffsetValue,ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>), + VPHELPER(VP_OFFSET_X, &probe.offset.x, screen.getOffsetValue,screen.sendFloatAsLongValueToDisplay<2>), + VPHELPER(VP_OFFSET_Y, &probe.offset.y, screen.getOffsetValue,screen.sendFloatAsLongValueToDisplay<2>), + VPHELPER(VP_OFFSET_Z, &probe.offset.z, screen.getOffsetValue,screen.sendFloatAsLongValueToDisplay<2>), #endif #else - VPHELPER(VP_SD_FileSelected, nullptr, ScreenHandler.PrintReturn, nullptr), + VPHELPER(VP_SD_FileSelected, nullptr, screen.printReturn, nullptr), #endif #if ENABLED(DGUS_UI_WAITING) - VPHELPER(VP_WAITING_STATUS, nullptr, nullptr, ScreenHandler.DGUSLCD_SendWaitingStatusToDisplay), + VPHELPER(VP_WAITING_STATUS, nullptr, nullptr, screen.sendWaitingStatusToDisplay), #endif // Messages for the User, shared by the popup and the kill screen. They can't be autouploaded as we do not buffer content. - //{.VP = VP_MSGSTR1, .memadr = nullptr, .size = VP_MSGSTR1_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM}, - //{.VP = VP_MSGSTR2, .memadr = nullptr, .size = VP_MSGSTR2_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM}, - //{.VP = VP_MSGSTR3, .memadr = nullptr, .size = VP_MSGSTR3_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM}, - //{.VP = VP_MSGSTR4, .memadr = nullptr, .size = VP_MSGSTR4_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM}, - - {.VP = VP_MSGSTR1, .memadr = nullptr, .size = VP_MSGSTR1_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplay_Language}, - {.VP = VP_MSGSTR2, .memadr = nullptr, .size = VP_MSGSTR2_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplay_Language}, - {.VP = VP_MSGSTR3, .memadr = nullptr, .size = VP_MSGSTR3_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplay_Language}, - {.VP = VP_MSGSTR4, .memadr = nullptr, .size = VP_MSGSTR4_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplay_Language}, + //{.VP = VP_MSGSTR1, .memadr = nullptr, .size = VP_MSGSTR1_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM}, + //{.VP = VP_MSGSTR2, .memadr = nullptr, .size = VP_MSGSTR2_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM}, + //{.VP = VP_MSGSTR3, .memadr = nullptr, .size = VP_MSGSTR3_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM}, + //{.VP = VP_MSGSTR4, .memadr = nullptr, .size = VP_MSGSTR4_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM}, + + {.VP = VP_MSGSTR1, .memadr = nullptr, .size = VP_MSGSTR1_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplay_Language}, + {.VP = VP_MSGSTR2, .memadr = nullptr, .size = VP_MSGSTR2_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplay_Language}, + {.VP = VP_MSGSTR3, .memadr = nullptr, .size = VP_MSGSTR3_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplay_Language}, + {.VP = VP_MSGSTR4, .memadr = nullptr, .size = VP_MSGSTR4_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplay_Language}, VPHELPER(0, 0, 0, 0) // must be last entry. }; diff --git a/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.h b/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.h index 63586e7fe517f..53e57e1c65bba 100644 --- a/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.h +++ b/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.h @@ -124,21 +124,21 @@ typedef struct { extern NOZZLE_PARK_DEF nozzle_park_mks; -enum DGUSLCD_Screens : uint8_t { +enum DGUS_ScreenID : uint8_t { #if ENABLED(USE_MKS_GREEN_UI) - DGUSLCD_SCREEN_BOOT = 33, - DGUSLCD_SCREEN_MAIN = 60, - DGUSLCD_SCREEN_STATUS = 60, - DGUSLCD_SCREEN_STATUS2 = 60, - DGUSLCD_SCREEN_PREHEAT = 18, - DGUSLCD_SCREEN_POWER_LOSS = 100, - DGUSLCD_SCREEN_MANUALMOVE = 192, - DGUSLCD_SCREEN_UTILITY = 120, - DGUSLCD_SCREEN_FILAMENT_UNLOADING = 158, - DGUSLCD_SCREEN_SDFILELIST = 15, - DGUSLCD_SCREEN_SDPRINTMANIPULATION = 15, - DGUSLCD_SCREEN_SDPRINTTUNE = 17, + DGUS_SCREEN_BOOT = 33, + DGUS_SCREEN_MAIN = 60, + DGUS_SCREEN_STATUS = 60, + DGUS_SCREEN_STATUS2 = 60, + DGUS_SCREEN_PREHEAT = 18, + DGUS_SCREEN_POWER_LOSS = 100, + DGUS_SCREEN_MANUALMOVE = 192, + DGUS_SCREEN_UTILITY = 120, + DGUS_SCREEN_FILAMENT_UNLOADING = 158, + DGUS_SCREEN_SDFILELIST = 15, + DGUS_SCREEN_SDPRINTMANIPULATION = 15, + DGUS_SCREEN_SDPRINTTUNE = 17, MKSLCD_SCREEN_BOOT = 33, MKSLCD_SCREEN_HOME = 60, // MKS main page @@ -178,19 +178,19 @@ enum DGUSLCD_Screens : uint8_t { #else - DGUSLCD_SCREEN_BOOT = 120, - DGUSLCD_SCREEN_MAIN = 1, + DGUS_SCREEN_BOOT = 120, + DGUS_SCREEN_MAIN = 1, - DGUSLCD_SCREEN_STATUS = 1, - DGUSLCD_SCREEN_STATUS2 = 1, - DGUSLCD_SCREEN_PREHEAT = 18, - DGUSLCD_SCREEN_POWER_LOSS = 100, - DGUSLCD_SCREEN_MANUALMOVE = 192, - DGUSLCD_SCREEN_UTILITY = 120, - DGUSLCD_SCREEN_FILAMENT_UNLOADING = 158, - DGUSLCD_SCREEN_SDFILELIST = 15, - DGUSLCD_SCREEN_SDPRINTMANIPULATION = 15, - DGUSLCD_SCREEN_SDPRINTTUNE = 17, + DGUS_SCREEN_STATUS = 1, + DGUS_SCREEN_STATUS2 = 1, + DGUS_SCREEN_PREHEAT = 18, + DGUS_SCREEN_POWER_LOSS = 100, + DGUS_SCREEN_MANUALMOVE = 192, + DGUS_SCREEN_UTILITY = 120, + DGUS_SCREEN_FILAMENT_UNLOADING = 158, + DGUS_SCREEN_SDFILELIST = 15, + DGUS_SCREEN_SDPRINTMANIPULATION = 15, + DGUS_SCREEN_SDPRINTTUNE = 17, MKSLCD_SCREEN_BOOT = 0, MKSLCD_SCREEN_HOME = 1, // MKS main page @@ -234,11 +234,11 @@ enum DGUSLCD_Screens : uint8_t { #endif - DGUSLCD_SCREEN_CONFIRM = 240, - DGUSLCD_SCREEN_KILL = 250, ///< Kill Screen. Must always be 250 (to be able to display "Error wrong LCD Version") - DGUSLCD_SCREEN_WAITING = 251, - DGUSLCD_SCREEN_POPUP = 252, ///< special target, popup screen will also return this code to say "return to previous screen" - DGUSLCD_SCREEN_UNUSED = 255 + DGUS_SCREEN_CONFIRM = 240, + DGUS_SCREEN_KILL = 250, ///< Kill Screen. Must always be 250 (to be able to display "Error wrong LCD Version") + DGUS_SCREEN_WAITING = 251, + DGUS_SCREEN_POPUP = 252, ///< special target, popup screen will also return this code to say "return to previous screen" + DGUS_SCREEN_UNUSED = 255 }; diff --git a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp index ad89a715c3626..16aeeab1a1428 100644 --- a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp @@ -56,20 +56,20 @@ MKS_Language mks_language_index; // Initialized by settings.load() #if 0 void DGUSScreenHandlerMKS::sendinfoscreen_ch(const uint16_t *line1, const uint16_t *line2, const uint16_t *line3, const uint16_t *line4) { - dgusdisplay.WriteVariable(VP_MSGSTR1, line1, 32, true); - dgusdisplay.WriteVariable(VP_MSGSTR2, line2, 32, true); - dgusdisplay.WriteVariable(VP_MSGSTR3, line3, 32, true); - dgusdisplay.WriteVariable(VP_MSGSTR4, line4, 32, true); + dgus.writeVariable(VP_MSGSTR1, line1, 32, true); + dgus.writeVariable(VP_MSGSTR2, line2, 32, true); + dgus.writeVariable(VP_MSGSTR3, line3, 32, true); + dgus.writeVariable(VP_MSGSTR4, line4, 32, true); } void DGUSScreenHandlerMKS::sendinfoscreen_en(PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4) { - dgusdisplay.WriteVariable(VP_MSGSTR1, line1, 32, true); - dgusdisplay.WriteVariable(VP_MSGSTR2, line2, 32, true); - dgusdisplay.WriteVariable(VP_MSGSTR3, line3, 32, true); - dgusdisplay.WriteVariable(VP_MSGSTR4, line4, 32, true); + dgus.writeVariable(VP_MSGSTR1, line1, 32, true); + dgus.writeVariable(VP_MSGSTR2, line2, 32, true); + dgus.writeVariable(VP_MSGSTR3, line3, 32, true); + dgus.writeVariable(VP_MSGSTR4, line4, 32, true); } -void DGUSScreenHandlerMKS::sendinfoscreen(const void *line1, const void *line2, const void *line3, const void *line4, uint16_t language) { +void DGUSScreenHandlerMKS::sendInfoScreen(const void *line1, const void *line2, const void *line3, const void *line4, uint16_t language) { if (language == MKS_English) DGUSScreenHandlerMKS::sendinfoscreen_en((char *)line1, (char *)line2, (char *)line3, (char *)line4); else if (language == MKS_SimpleChinese) @@ -78,78 +78,78 @@ void DGUSScreenHandlerMKS::sendinfoscreen(const void *line1, const void *line2, #endif -void DGUSScreenHandlerMKS::DGUSLCD_SendFanToDisplay(DGUS_VP_Variable &var) { +void DGUSScreenHandlerMKS::sendFanToDisplay(DGUS_VP_Variable &var) { if (var.memadr) { uint16_t tmp = *(uint8_t *) var.memadr; // +1 -> avoid rounding issues for the display. // tmp = map(tmp, 0, 255, 0, 100); - dgusdisplay.WriteVariable(var.VP, tmp); + dgus.writeVariable(var.VP, tmp); } } -void DGUSScreenHandlerMKS::DGUSLCD_SendBabyStepToDisplay(DGUS_VP_Variable &var) { +void DGUSScreenHandlerMKS::sendBabyStepToDisplay(DGUS_VP_Variable &var) { float value = current_position.z; value *= cpow(10, 2); - dgusdisplay.WriteVariable(VP_SD_Print_Baby, (uint16_t)value); + dgus.writeVariable(VP_SD_Print_Baby, (uint16_t)value); } -void DGUSScreenHandlerMKS::DGUSLCD_SendPrintTimeToDisplay(DGUS_VP_Variable &var) { +void DGUSScreenHandlerMKS::sendPrintTimeToDisplay(DGUS_VP_Variable &var) { duration_t elapsed = print_job_timer.duration(); uint32_t time = elapsed.value; - dgusdisplay.WriteVariable(VP_PrintTime_H, uint16_t(time / 3600)); - dgusdisplay.WriteVariable(VP_PrintTime_M, uint16_t(time % 3600 / 60)); - dgusdisplay.WriteVariable(VP_PrintTime_S, uint16_t((time % 3600) % 60)); + dgus.writeVariable(VP_PrintTime_H, uint16_t(time / 3600)); + dgus.writeVariable(VP_PrintTime_M, uint16_t(time % 3600 / 60)); + dgus.writeVariable(VP_PrintTime_S, uint16_t((time % 3600) % 60)); } -void DGUSScreenHandlerMKS::DGUSLCD_SetUint8(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::setUint8(DGUS_VP_Variable &var, void *val_ptr) { if (var.memadr) { const uint16_t value = BE16_P(val_ptr); *(uint8_t*)var.memadr = map(constrain(value, 0, 255), 0, 255, 0, 255); } } -void DGUSScreenHandlerMKS::DGUSLCD_SendGbkToDisplay(DGUS_VP_Variable &var) { +void DGUSScreenHandlerMKS::sendGbkToDisplay(DGUS_VP_Variable &var) { uint16_t *tmp = (uint16_t*) var.memadr; - dgusdisplay.WriteVariable(var.VP, tmp, var.size, true); + dgus.writeVariable(var.VP, tmp, var.size, true); } -void DGUSScreenHandlerMKS::DGUSLCD_SendStringToDisplay_Language(DGUS_VP_Variable &var) { +void DGUSScreenHandlerMKS::sendStringToDisplay_Language(DGUS_VP_Variable &var) { if (mks_language_index == MKS_English) { char *tmp = (char*) var.memadr; - dgusdisplay.WriteVariable(var.VP, tmp, var.size, true); + dgus.writeVariable(var.VP, tmp, var.size, true); } else if (mks_language_index == MKS_SimpleChinese) { uint16_t *tmp = (uint16_t *)var.memadr; - dgusdisplay.WriteVariable(var.VP, tmp, var.size, true); + dgus.writeVariable(var.VP, tmp, var.size, true); } } -void DGUSScreenHandlerMKS::DGUSLCD_SendTMCStepValue(DGUS_VP_Variable &var) { +void DGUSScreenHandlerMKS::sendTMCStepValue(DGUS_VP_Variable &var) { #if ENABLED(SENSORLESS_HOMING) #if X_HAS_STEALTHCHOP tmc_step.x = stepperX.homing_threshold(); - dgusdisplay.WriteVariable(var.VP, *(int16_t*)var.memadr); + dgus.writeVariable(var.VP, *(int16_t*)var.memadr); #endif #if Y_HAS_STEALTHCHOP tmc_step.y = stepperY.homing_threshold(); - dgusdisplay.WriteVariable(var.VP, *(int16_t*)var.memadr); + dgus.writeVariable(var.VP, *(int16_t*)var.memadr); #endif #if Z_HAS_STEALTHCHOP tmc_step.z = stepperZ.homing_threshold(); - dgusdisplay.WriteVariable(var.VP, *(int16_t*)var.memadr); + dgus.writeVariable(var.VP, *(int16_t*)var.memadr); #endif #endif } #if HAS_MEDIA - void DGUSScreenHandler::DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::sdFileSelected(DGUS_VP_Variable &var, void *val_ptr) { uint16_t touched_nr = (int16_t)BE16_P(val_ptr) + top_file; if (touched_nr != 0x0F && touched_nr > filelist.count()) return; if (!filelist.seek(touched_nr) && touched_nr != 0x0F) return; if (touched_nr == 0x0F) { if (filelist.isAtRootDir()) - GotoScreen(DGUSLCD_SCREEN_MAIN); + gotoScreen(DGUS_SCREEN_MAIN); else filelist.upDir(); return; @@ -158,28 +158,28 @@ void DGUSScreenHandlerMKS::DGUSLCD_SendTMCStepValue(DGUS_VP_Variable &var) { if (filelist.isDir()) { filelist.changeDir(filelist.filename()); top_file = 0; - ForceCompleteUpdate(); + forceCompleteUpdate(); return; } #if ENABLED(DGUS_PRINT_FILENAME) // Send print filename - dgusdisplay.WriteVariable(VP_SD_Print_Filename, filelist.filename(), VP_SD_FileName_LEN, true); + dgus.writeVariable(VP_SD_Print_Filename, filelist.filename(), VP_SD_FileName_LEN, true); #endif // Setup Confirmation screen file_to_print = touched_nr; - GotoScreen(MKSLCD_SCREEN_PRINT_CONFIRM); + gotoScreen(MKSLCD_SCREEN_PRINT_CONFIRM); } - void DGUSScreenHandler::DGUSLCD_SD_StartPrint(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::sdStartPrint(DGUS_VP_Variable &var, void *val_ptr) { if (!filelist.seek(file_to_print)) return; ExtUI::printFile(filelist.shortFilename()); - GotoScreen(MKSLCD_SCREEN_PRINT); + gotoScreen(MKSLCD_SCREEN_PRINT); z_offset_add = 0; } - void DGUSScreenHandler::DGUSLCD_SD_ResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::sdResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr) { if (!ExtUI::isPrintingFromMedia()) return; // avoid race condition when user stays in this menu and printer finishes. switch (BE16_P(val_ptr)) { @@ -187,13 +187,13 @@ void DGUSScreenHandlerMKS::DGUSLCD_SendTMCStepValue(DGUS_VP_Variable &var) { 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) - GotoScreen(MKSLCD_SCREEN_PAUSE); + gotoScreen(MKSLCD_SCREEN_PAUSE); return; } else runout_mks.runout_status = UNRUNOUT_STATUS; - GotoScreen(MKSLCD_SCREEN_PRINT); + gotoScreen(MKSLCD_SCREEN_PRINT); if (ExtUI::isPrintingFromMediaPaused()) { nozzle_park_mks.print_pause_start_flag = 0; @@ -203,7 +203,7 @@ void DGUSScreenHandlerMKS::DGUSLCD_SendTMCStepValue(DGUS_VP_Variable &var) { } break; case 1: // Pause - GotoScreen(MKSLCD_SCREEN_PAUSE); + gotoScreen(MKSLCD_SCREEN_PAUSE); if (!ExtUI::isPrintingFromMediaPaused()) { nozzle_park_mks.print_pause_start_flag = 1; nozzle_park_mks.blstatus = true; @@ -213,12 +213,12 @@ void DGUSScreenHandlerMKS::DGUSLCD_SendTMCStepValue(DGUS_VP_Variable &var) { break; case 2: // Abort - HandleUserConfirmationPopUp(VP_SD_AbortPrintConfirmed, nullptr, PSTR("Abort printing"), filelist.filename(), PSTR("?"), true, true, false, true); + handleUserConfirmationPopUp(VP_SD_AbortPrintConfirmed, nullptr, PSTR("Abort printing"), filelist.filename(), PSTR("?"), true, true, false, true); break; } } - void DGUSScreenHandler::DGUSLCD_SD_SendFilename(DGUS_VP_Variable& var) { + void DGUSScreenHandler::sdSendFilename(DGUS_VP_Variable& var) { uint16_t target_line = (var.VP - VP_SD_FileName0) / VP_SD_FileName_LEN; if (target_line > DGUS_SD_FILESPERSCREEN) return; char tmpfilename[VP_SD_FileName_LEN + 1] = ""; @@ -229,50 +229,50 @@ void DGUSScreenHandlerMKS::DGUSLCD_SendTMCStepValue(DGUS_VP_Variable &var) { snprintf_P(tmpfilename, VP_SD_FileName_LEN, PSTR("%s%c"), filelist.filename(), filelist.isDir() ? '/' : 0); // snprintf_P(tmpfilename, VP_SD_FileName_LEN, PSTR("%s"), filelist.filename()); dir_icon_val = filelist.isDir() ? 0 : 1; } - DGUSLCD_SendStringToDisplay(var); + sendStringToDisplay(var); - dgusdisplay.WriteVariable(VP_File_Pictutr0 + target_line * 2, dir_icon_val); + dgus.writeVariable(VP_File_Pictutr0 + target_line * 2, dir_icon_val); } - void DGUSScreenHandler::SDCardInserted() { + void DGUSScreenHandler::sdCardInserted() { top_file = 0; filelist.refresh(); auto cs = getCurrentScreen(); - if (cs == DGUSLCD_SCREEN_MAIN || cs == DGUSLCD_SCREEN_STATUS) - GotoScreen(MKSLCD_SCREEN_CHOOSE_FILE); + if (cs == DGUS_SCREEN_MAIN || cs == DGUS_SCREEN_STATUS) + gotoScreen(MKSLCD_SCREEN_CHOOSE_FILE); } - void DGUSScreenHandler::SDCardRemoved() { - if (current_screen == DGUSLCD_SCREEN_SDFILELIST - || (current_screen == DGUSLCD_SCREEN_CONFIRM && (ConfirmVP == VP_SD_AbortPrintConfirmed || ConfirmVP == VP_SD_FileSelectConfirm)) - || current_screen == DGUSLCD_SCREEN_SDPRINTMANIPULATION + void DGUSScreenHandler::sdCardRemoved() { + if (current_screenID == DGUS_SCREEN_SDFILELIST + || (current_screenID == DGUS_SCREEN_CONFIRM && (confirmVP == VP_SD_AbortPrintConfirmed || confirmVP == VP_SD_FileSelectConfirm)) + || current_screenID == DGUS_SCREEN_SDPRINTMANIPULATION ) filelist.refresh(); } - void DGUSScreenHandlerMKS::SDPrintingFinished() { + void DGUSScreenHandlerMKS::sdPrintingFinished() { if (DGUSAutoTurnOff) { queue.exhaust(); gcode.process_subcommands_now(F("M81")); } - GotoScreen(MKSLCD_SCREEN_PrintDone); + gotoScreen(MKSLCD_SCREEN_PrintDone); } #else - void DGUSScreenHandlerMKS::PrintReturn(DGUS_VP_Variable& var, void *val_ptr) { + void DGUSScreenHandlerMKS::printReturn(DGUS_VP_Variable& var, void *val_ptr) { const uint16_t value = BE16_P(val_ptr); - if (value == 0x0F) GotoScreen(DGUSLCD_SCREEN_MAIN); + if (value == 0x0F) gotoScreen(DGUS_SCREEN_MAIN); } #endif // HAS_MEDIA -void DGUSScreenHandler::ScreenChangeHook(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandler::screenChangeHook(DGUS_VP_Variable &var, void *val_ptr) { uint8_t *tmp = (uint8_t*)val_ptr; // The keycode in target is coded as , so 0x0100A means - // from screen 1 (main) to 10 (temperature). DGUSLCD_SCREEN_POPUP is special, + // from screen 1 (main) to 10 (temperature). DGUS_SCREEN_POPUP is special, // meaning "return to previous screen" - DGUSLCD_Screens target = (DGUSLCD_Screens)tmp[1]; + DGUS_ScreenID target = (DGUS_ScreenID)tmp[1]; - // when the dgus had reboot, it will enter the DGUSLCD_SCREEN_MAIN page, + // when the dgus had reboot, it will enter the DGUS_SCREEN_MAIN page, // so user can change any page to use this function, an it will check // if robin nano is printing. when it is, dgus will enter the printing // page to continue print; @@ -283,41 +283,41 @@ void DGUSScreenHandler::ScreenChangeHook(DGUS_VP_Variable &var, void *val_ptr) { // ) { // } // else - // GotoScreen(MKSLCD_SCREEN_PRINT); + // gotoScreen(MKSLCD_SCREEN_PRINT); // return; //} - if (target == DGUSLCD_SCREEN_POPUP) { - SetupConfirmAction(ExtUI::setUserConfirmed); + if (target == DGUS_SCREEN_POPUP) { + setupConfirmAction(ExtUI::setUserConfirmed); // Special handling for popup is to return to previous menu - if (current_screen == DGUSLCD_SCREEN_POPUP && confirm_action_cb) confirm_action_cb(); - PopToOldScreen(); + if (current_screenID == DGUS_SCREEN_POPUP && confirm_action_cb) confirm_action_cb(); + popToOldScreen(); return; } - UpdateNewScreen(target); + updateNewScreen(target); #ifdef DEBUG_DGUSLCD - if (!DGUSLCD_FindScreenVPMapList(target)) DEBUG_ECHOLNPGM("WARNING: No screen Mapping found for ", target); + if (!findScreenVPMapList(target)) DEBUG_ECHOLNPGM("WARNING: No screen Mapping found for ", target); #endif } -void DGUSScreenHandlerMKS::ScreenBackChange(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::screenBackChange(DGUS_VP_Variable &var, void *val_ptr) { const uint16_t target = BE16_P(val_ptr); switch (target) { } } -void DGUSScreenHandlerMKS::ZoffsetConfirm(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::zOffsetConfirm(DGUS_VP_Variable &var, void *val_ptr) { settings.save(); if (printJobOngoing()) - GotoScreen(MKSLCD_SCREEN_PRINT); + gotoScreen(MKSLCD_SCREEN_PRINT); else if (print_job_timer.isPaused) - GotoScreen(MKSLCD_SCREEN_PAUSE); + gotoScreen(MKSLCD_SCREEN_PAUSE); } -void DGUSScreenHandlerMKS::GetTurnOffCtrl(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::getTurnOffCtrl(DGUS_VP_Variable &var, void *val_ptr) { const uint16_t value = BE16_P(val_ptr); switch (value) { case 0 ... 1: DGUSAutoTurnOff = (bool)value; break; @@ -325,14 +325,14 @@ void DGUSScreenHandlerMKS::GetTurnOffCtrl(DGUS_VP_Variable &var, void *val_ptr) } } -void DGUSScreenHandlerMKS::GetMinExtrudeTemp(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::getMinExtrudeTemp(DGUS_VP_Variable &var, void *val_ptr) { const uint16_t value = BE16_P(val_ptr); TERN_(PREVENT_COLD_EXTRUSION, thermalManager.extrude_min_temp = value); mks_min_extrusion_temp = value; settings.save(); } -void DGUSScreenHandlerMKS::GetZoffsetDistance(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::getZoffsetDistance(DGUS_VP_Variable &var, void *val_ptr) { const uint16_t value = BE16_P(val_ptr); float val_distance = 0; switch (value) { @@ -345,29 +345,29 @@ void DGUSScreenHandlerMKS::GetZoffsetDistance(DGUS_VP_Variable &var, void *val_p ZOffset_distance = val_distance; } -void DGUSScreenHandlerMKS::GetManualMovestep(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::getManualMovestep(DGUS_VP_Variable &var, void *val_ptr) { *(uint16_t *)var.memadr = BE16_P(val_ptr); } -void DGUSScreenHandlerMKS::EEPROM_CTRL(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::eepromControl(DGUS_VP_Variable &var, void *val_ptr) { const uint16_t eep_flag = BE16_P(val_ptr); switch (eep_flag) { case 0: settings.save(); settings.load(); // load eeprom data to check the data is right - GotoScreen(MKSLCD_SCREEN_EEP_Config); + gotoScreen(MKSLCD_SCREEN_EEP_Config); break; case 1: settings.reset(); - GotoScreen(MKSLCD_SCREEN_EEP_Config); + gotoScreen(MKSLCD_SCREEN_EEP_Config); break; default: break; } } -void DGUSScreenHandlerMKS::Z_offset_select(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::zOffsetSelect(DGUS_VP_Variable &var, void *val_ptr) { const uint16_t z = BE16_P(val_ptr); switch (z) { case 0: Z_distance = 0.01; break; @@ -377,7 +377,7 @@ void DGUSScreenHandlerMKS::Z_offset_select(DGUS_VP_Variable &var, void *val_ptr) } } -void DGUSScreenHandlerMKS::GetOffsetValue(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::getOffsetValue(DGUS_VP_Variable &var, void *val_ptr) { #if HAS_BED_PROBE const int32_t value = BE32_P(val_ptr); @@ -393,21 +393,21 @@ void DGUSScreenHandlerMKS::GetOffsetValue(DGUS_VP_Variable &var, void *val_ptr) #endif } -void DGUSScreenHandlerMKS::LanguageChange(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::languageChange(DGUS_VP_Variable &var, void *val_ptr) { const uint16_t lag_flag = BE16_P(val_ptr); switch (lag_flag) { case MKS_SimpleChinese: - DGUS_LanguageDisplay(MKS_SimpleChinese); + languageDisplay(MKS_SimpleChinese); mks_language_index = MKS_SimpleChinese; - dgusdisplay.WriteVariable(VP_LANGUAGE_CHANGE1, (uint8_t)MKS_Language_Choose); - dgusdisplay.WriteVariable(VP_LANGUAGE_CHANGE2, (uint8_t)MKS_Language_NoChoose); + dgus.writeVariable(VP_LANGUAGE_CHANGE1, (uint8_t)MKS_Language_Choose); + dgus.writeVariable(VP_LANGUAGE_CHANGE2, (uint8_t)MKS_Language_NoChoose); settings.save(); break; case MKS_English: - DGUS_LanguageDisplay(MKS_English); + languageDisplay(MKS_English); mks_language_index = MKS_English; - dgusdisplay.WriteVariable(VP_LANGUAGE_CHANGE1, (uint8_t)MKS_Language_NoChoose); - dgusdisplay.WriteVariable(VP_LANGUAGE_CHANGE2, (uint8_t)MKS_Language_Choose); + dgus.writeVariable(VP_LANGUAGE_CHANGE1, (uint8_t)MKS_Language_NoChoose); + dgus.writeVariable(VP_LANGUAGE_CHANGE2, (uint8_t)MKS_Language_Choose); settings.save(); break; default: break; @@ -418,7 +418,7 @@ void DGUSScreenHandlerMKS::LanguageChange(DGUS_VP_Variable &var, void *val_ptr) grid_count_t mesh_point_count = GRID_MAX_POINTS; #endif -void DGUSScreenHandlerMKS::Level_Ctrl(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::levelControl(DGUS_VP_Variable &var, void *val_ptr) { #if ENABLED(MESH_BED_LEVELING) auto cs = getCurrentScreen(); #endif @@ -440,32 +440,32 @@ void DGUSScreenHandlerMKS::Level_Ctrl(DGUS_VP_Variable &var, void *val_ptr) { if (mks_language_index == MKS_English) { const char level_buf_en[] = "Start Level"; - dgusdisplay.WriteVariable(VP_AutoLevel_1_Dis, level_buf_en, 32, true); + dgus.writeVariable(VP_AutoLevel_1_Dis, level_buf_en, 32, true); } else if (mks_language_index == MKS_SimpleChinese) { const uint16_t level_buf_ch[] = {0xAABF, 0xBCCA, 0xF7B5, 0xBDC6, 0x2000}; - dgusdisplay.WriteVariable(VP_AutoLevel_1_Dis, level_buf_ch, 32, true); + dgus.writeVariable(VP_AutoLevel_1_Dis, level_buf_ch, 32, true); } cs = getCurrentScreen(); - if (cs != MKSLCD_AUTO_LEVEL) GotoScreen(MKSLCD_AUTO_LEVEL); + if (cs != MKSLCD_AUTO_LEVEL) gotoScreen(MKSLCD_AUTO_LEVEL); #else - GotoScreen(MKSLCD_SCREEN_LEVEL); + gotoScreen(MKSLCD_SCREEN_LEVEL); #endif break; case 1: soft_endstop._enabled = true; - GotoScreen(MKSLCD_SCREEM_TOOL); + gotoScreen(MKSLCD_SCREEM_TOOL); break; default: break; } } -void DGUSScreenHandlerMKS::MeshLevelDistanceConfig(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::meshLevelDistanceConfig(DGUS_VP_Variable &var, void *val_ptr) { const uint16_t mesh_dist = BE16_P(val_ptr); switch (mesh_dist) { case 0: mesh_adj_distance = 0.01; break; @@ -475,7 +475,7 @@ void DGUSScreenHandlerMKS::MeshLevelDistanceConfig(DGUS_VP_Variable &var, void * } } -void DGUSScreenHandlerMKS::MeshLevel(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::meshLevel(DGUS_VP_Variable &var, void *val_ptr) { #if ENABLED(MESH_BED_LEVELING) const uint16_t mesh_val = BE16_P(val_ptr); // static uint8_t a_first_level = 1; @@ -524,11 +524,11 @@ void DGUSScreenHandlerMKS::MeshLevel(DGUS_VP_Variable &var, void *val_ptr) { if (mks_language_index == MKS_English) { const char level_buf_en1[] = "Next Point"; - dgusdisplay.WriteVariable(VP_AutoLevel_1_Dis, level_buf_en1, 32, true); + dgus.writeVariable(VP_AutoLevel_1_Dis, level_buf_en1, 32, true); } else if (mks_language_index == MKS_SimpleChinese) { const uint16_t level_buf_ch1[] = {0xC2CF, 0xBBD2, 0xE3B5, 0x2000}; - dgusdisplay.WriteVariable(VP_AutoLevel_1_Dis, level_buf_ch1, 32, true); + dgus.writeVariable(VP_AutoLevel_1_Dis, level_buf_ch1, 32, true); } } else if (mesh_point_count > 1) { // 倒数第二个点 @@ -536,11 +536,11 @@ void DGUSScreenHandlerMKS::MeshLevel(DGUS_VP_Variable &var, void *val_ptr) { mesh_point_count--; if (mks_language_index == MKS_English) { const char level_buf_en2[] = "Next Point"; - dgusdisplay.WriteVariable(VP_AutoLevel_1_Dis, level_buf_en2, 32, true); + dgus.writeVariable(VP_AutoLevel_1_Dis, level_buf_en2, 32, true); } else if (mks_language_index == MKS_SimpleChinese) { const uint16_t level_buf_ch2[] = {0xC2CF, 0xBBD2, 0xE3B5, 0x2000}; - dgusdisplay.WriteVariable(VP_AutoLevel_1_Dis, level_buf_ch2, 32, true); + dgus.writeVariable(VP_AutoLevel_1_Dis, level_buf_ch2, 32, true); } } else if (mesh_point_count == 1) { @@ -548,11 +548,11 @@ void DGUSScreenHandlerMKS::MeshLevel(DGUS_VP_Variable &var, void *val_ptr) { mesh_point_count--; if (mks_language_index == MKS_English) { const char level_buf_en2[] = "Leveling Done"; - dgusdisplay.WriteVariable(VP_AutoLevel_1_Dis, level_buf_en2, 32, true); + dgus.writeVariable(VP_AutoLevel_1_Dis, level_buf_en2, 32, true); } else if (mks_language_index == MKS_SimpleChinese) { const uint16_t level_buf_ch2[] = {0xF7B5, 0xBDC6, 0xEACD, 0xC9B3, 0x2000}; - dgusdisplay.WriteVariable(VP_AutoLevel_1_Dis, level_buf_ch2, 32, true); + dgus.writeVariable(VP_AutoLevel_1_Dis, level_buf_ch2, 32, true); } settings.save(); } @@ -560,7 +560,7 @@ void DGUSScreenHandlerMKS::MeshLevel(DGUS_VP_Variable &var, void *val_ptr) { mesh_point_count = GRID_MAX_POINTS; soft_endstop._enabled = true; settings.save(); - GotoScreen(MKSLCD_SCREEM_TOOL); + gotoScreen(MKSLCD_SCREEM_TOOL); } break; @@ -570,19 +570,19 @@ void DGUSScreenHandlerMKS::MeshLevel(DGUS_VP_Variable &var, void *val_ptr) { #endif // MESH_BED_LEVELING } -void DGUSScreenHandlerMKS::SD_FileBack(DGUS_VP_Variable&, void*) { - GotoScreen(MKSLCD_SCREEN_HOME); +void DGUSScreenHandlerMKS::sdFileBack(DGUS_VP_Variable&, void*) { + gotoScreen(MKSLCD_SCREEN_HOME); } -void DGUSScreenHandlerMKS::LCD_BLK_Adjust(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::lcdBLKAdjust(DGUS_VP_Variable &var, void *val_ptr) { const uint16_t lcd_val = BE16_P(val_ptr); lcd_default_light = constrain(lcd_val, 10, 100); const uint16_t lcd_data[2] = { lcd_default_light, lcd_default_light }; - dgusdisplay.WriteVariable(0x0082, &lcd_data, 5, true); + dgus.writeVariable(0x0082, &lcd_data, 5, true); } -void DGUSScreenHandlerMKS::ManualAssistLeveling(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::manualAssistLeveling(DGUS_VP_Variable &var, void *val_ptr) { const int16_t point_val = BE16_P(val_ptr); // Insist on leveling first time at this screen @@ -635,7 +635,7 @@ void DGUSScreenHandlerMKS::ManualAssistLeveling(DGUS_VP_Variable &var, void *val #define mks_min(a, b) ((a) < (b)) ? (a) : (b) #define mks_max(a, b) ((a) > (b)) ? (a) : (b) -void DGUSScreenHandlerMKS::TMC_ChangeConfig(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::tmcChangeConfig(DGUS_VP_Variable &var, void *val_ptr) { #if EITHER(HAS_TRINAMIC_CONFIG, HAS_STEALTHCHOP) const uint16_t tmc_val = BE16_P(val_ptr); #endif @@ -727,7 +727,7 @@ void DGUSScreenHandlerMKS::TMC_ChangeConfig(DGUS_VP_Variable &var, void *val_ptr #endif } -void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandler::handleManualMove(DGUS_VP_Variable &var, void *val_ptr) { int16_t movevalue = BE16_P(val_ptr); // Choose Move distance @@ -812,14 +812,14 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { char buf[6]; sprintf(buf, "G28 %c", axiscode); queue.enqueue_one_now(buf); - ForceCompleteUpdate(); + forceCompleteUpdate(); return; } else if (movevalue == 5) { char buf[6]; snprintf_P(buf,6,PSTR("M84 %c"), axiscode); queue.enqueue_one_now(buf); - ForceCompleteUpdate(); + forceCompleteUpdate(); return; } else { @@ -845,13 +845,13 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { if (!old_relative_mode) queue.enqueue_now(F("G90")); } - ForceCompleteUpdate(); + forceCompleteUpdate(); cannotmove: return; } -void DGUSScreenHandlerMKS::GetParkPos(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::getParkPos(DGUS_VP_Variable &var, void *val_ptr) { const int16_t pos = BE16_P(val_ptr); switch (var.VP) { @@ -863,7 +863,7 @@ void DGUSScreenHandlerMKS::GetParkPos(DGUS_VP_Variable &var, void *val_ptr) { skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel } -void DGUSScreenHandlerMKS::HandleChangeLevelPoint(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::handleChangeLevelPoint(DGUS_VP_Variable &var, void *val_ptr) { const int16_t raw = BE16_P(val_ptr); *(int16_t*)var.memadr = raw; @@ -872,7 +872,7 @@ void DGUSScreenHandlerMKS::HandleChangeLevelPoint(DGUS_VP_Variable &var, void *v skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel } -void DGUSScreenHandlerMKS::HandleStepPerMMChanged(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::handleStepPerMMChanged(DGUS_VP_Variable &var, void *val_ptr) { const uint16_t raw = BE16_P(val_ptr); const float value = (float)raw; @@ -888,7 +888,7 @@ void DGUSScreenHandlerMKS::HandleStepPerMMChanged(DGUS_VP_Variable &var, void *v skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel } -void DGUSScreenHandlerMKS::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::handleStepPerMMExtruderChanged(DGUS_VP_Variable &var, void *val_ptr) { const uint16_t raw = BE16_P(val_ptr); const float value = (float)raw; @@ -907,7 +907,7 @@ void DGUSScreenHandlerMKS::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel } -void DGUSScreenHandlerMKS::HandleMaxSpeedChange(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::handleMaxSpeedChange(DGUS_VP_Variable &var, void *val_ptr) { const uint16_t raw = BE16_P(val_ptr); const float value = (float)raw; @@ -923,7 +923,7 @@ void DGUSScreenHandlerMKS::HandleMaxSpeedChange(DGUS_VP_Variable &var, void *val skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel } -void DGUSScreenHandlerMKS::HandleExtruderMaxSpeedChange(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::handleExtruderMaxSpeedChange(DGUS_VP_Variable &var, void *val_ptr) { const uint16_t raw = BE16_P(val_ptr); const float value = (float)raw; @@ -942,7 +942,7 @@ void DGUSScreenHandlerMKS::HandleExtruderMaxSpeedChange(DGUS_VP_Variable &var, v skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel } -void DGUSScreenHandlerMKS::HandleMaxAccChange(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::handleMaxAccChange(DGUS_VP_Variable &var, void *val_ptr) { const uint16_t raw = BE16_P(val_ptr); const float value = (float)raw; @@ -958,7 +958,7 @@ void DGUSScreenHandlerMKS::HandleMaxAccChange(DGUS_VP_Variable &var, void *val_p skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel } -void DGUSScreenHandlerMKS::HandleExtruderAccChange(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::handleExtruderAccChange(DGUS_VP_Variable &var, void *val_ptr) { uint16_t raw = BE16_P(val_ptr); float value = (float)raw; ExtUI::extruder_t extruder; @@ -976,32 +976,32 @@ void DGUSScreenHandlerMKS::HandleExtruderAccChange(DGUS_VP_Variable &var, void * skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel } -void DGUSScreenHandlerMKS::HandleTravelAccChange(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::handleTravelAccChange(DGUS_VP_Variable &var, void *val_ptr) { uint16_t travel = BE16_P(val_ptr); planner.settings.travel_acceleration = (float)travel; skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel } -void DGUSScreenHandlerMKS::HandleFeedRateMinChange(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::handleFeedRateMinChange(DGUS_VP_Variable &var, void *val_ptr) { uint16_t t = BE16_P(val_ptr); planner.settings.min_feedrate_mm_s = (float)t; skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel } -void DGUSScreenHandlerMKS::HandleMin_T_F(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::handleMin_T_F(DGUS_VP_Variable &var, void *val_ptr) { uint16_t t_f = BE16_P(val_ptr); planner.settings.min_travel_feedrate_mm_s = (float)t_f; skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel } -void DGUSScreenHandlerMKS::HandleAccChange(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::handleAccChange(DGUS_VP_Variable &var, void *val_ptr) { uint16_t acc = BE16_P(val_ptr); planner.settings.acceleration = (float)acc; skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel } #if ENABLED(PREVENT_COLD_EXTRUSION) - void DGUSScreenHandlerMKS::HandleGetExMinTemp(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandlerMKS::handleGetExMinTemp(DGUS_VP_Variable &var, void *val_ptr) { const uint16_t ex_min_temp = BE16_P(val_ptr); thermalManager.extrude_min_temp = ex_min_temp; skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel @@ -1009,7 +1009,7 @@ void DGUSScreenHandlerMKS::HandleAccChange(DGUS_VP_Variable &var, void *val_ptr) #endif #if HAS_PID_HEATING - void DGUSScreenHandler::HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::handleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr) { const uint16_t rawvalue = BE16_P(val_ptr); const float value = float(rawvalue); float newvalue = 0; @@ -1041,7 +1041,7 @@ void DGUSScreenHandlerMKS::HandleAccChange(DGUS_VP_Variable &var, void *val_ptr) #endif // HAS_PID_HEATING #if ENABLED(BABYSTEPPING) - void DGUSScreenHandler::HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::handleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr) { const float step = ZOffset_distance; const uint16_t flag = BE16_P(val_ptr); @@ -1078,11 +1078,11 @@ void DGUSScreenHandlerMKS::HandleAccChange(DGUS_VP_Variable &var, void *val_ptr) default: break; } - ForceCompleteUpdate(); + forceCompleteUpdate(); } #endif // BABYSTEPPING -void DGUSScreenHandlerMKS::GetManualFilament(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::getManualFilament(DGUS_VP_Variable &var, void *val_ptr) { const uint16_t len = BE16_P(val_ptr); const float value = (float)len; @@ -1091,14 +1091,14 @@ void DGUSScreenHandlerMKS::GetManualFilament(DGUS_VP_Variable &var, void *val_pt skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel } -void DGUSScreenHandlerMKS::GetManualFilamentSpeed(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandlerMKS::getManualFilamentSpeed(DGUS_VP_Variable &var, void *val_ptr) { const uint16_t len = BE16_P(val_ptr); filamentSpeed_mm_s = len; skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel } -void DGUSScreenHandlerMKS::FilamentLoadUnload(DGUS_VP_Variable &var, void *val_ptr, const int filamentDir) { +void DGUSScreenHandlerMKS::filamentLoadUnload(DGUS_VP_Variable &var, void *val_ptr, const int filamentDir) { #if EITHER(HAS_MULTI_HOTEND, SINGLENOZZLE) uint8_t swap_tool = 0; #else @@ -1138,9 +1138,9 @@ void DGUSScreenHandlerMKS::FilamentLoadUnload(DGUS_VP_Variable &var, void *val_p #if BOTH(HAS_HOTEND, PREVENT_COLD_EXTRUSION) if (hotend_too_cold) { if (thermalManager.targetTooColdToExtrude(hotend_too_cold - 1)) thermalManager.setTargetHotend(thermalManager.extrude_min_temp, hotend_too_cold - 1); - sendinfoscreen(F("NOTICE"), nullptr, F("Please wait."), F("Nozzle heating!"), true, true, true, true); - SetupConfirmAction(nullptr); - GotoScreen(DGUSLCD_SCREEN_POPUP); + sendInfoScreen(F("NOTICE"), nullptr, F("Please wait."), F("Nozzle heating!"), true, true, true, true); + setupConfirmAction(nullptr); + gotoScreen(DGUS_SCREEN_POPUP); } #endif @@ -1159,7 +1159,7 @@ void DGUSScreenHandlerMKS::FilamentLoadUnload(DGUS_VP_Variable &var, void *val_p } /** - * M1002: Do a tool-change and relative move for FilamentLoadUnload + * M1002: Do a tool-change and relative move for filamentLoadUnload * within the G-code execution window for best concurrency. */ void GcodeSuite::M1002() { @@ -1181,17 +1181,17 @@ void GcodeSuite::M1002() { axis_relative = old_axis_relative; } -void DGUSScreenHandlerMKS::FilamentLoad(DGUS_VP_Variable &var, void *val_ptr) { - FilamentLoadUnload(var, val_ptr, 1); +void DGUSScreenHandlerMKS::filamentLoad(DGUS_VP_Variable &var, void *val_ptr) { + filamentLoadUnload(var, val_ptr, 1); } -void DGUSScreenHandlerMKS::FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr) { - FilamentLoadUnload(var, val_ptr, -1); +void DGUSScreenHandlerMKS::filamentUnload(DGUS_VP_Variable &var, void *val_ptr) { + filamentLoadUnload(var, val_ptr, -1); } #if ENABLED(DGUS_FILAMENT_LOADUNLOAD) - void DGUSScreenHandler::HandleFilamentOption(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::handleFilamentOption(DGUS_VP_Variable &var, void *val_ptr) { uint8_t e_temp = 0; filament_data.heated = false; uint16_t preheat_option = BE16_P(val_ptr); @@ -1237,7 +1237,7 @@ void DGUSScreenHandlerMKS::FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr) #if HAS_MULTI_HOTEND thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E1); #endif - GotoScreen(DGUSLCD_SCREEN_UTILITY); + gotoScreen(DGUS_SCREEN_UTILITY); } else { // Go to the preheat screen to show the heating progress switch (var.VP) { @@ -1258,7 +1258,7 @@ void DGUSScreenHandlerMKS::FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr) } } - void DGUSScreenHandler::HandleFilamentLoadUnload(DGUS_VP_Variable &var) { + void DGUSScreenHandler::handleFilamentLoadUnload(DGUS_VP_Variable &var) { if (filament_data.action <= 0) return; // If we close to the target temperature, we can start load or unload the filament @@ -1274,7 +1274,7 @@ void DGUSScreenHandlerMKS::FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr) } else { // unload filament if (!filament_data.heated) { - GotoScreen(DGUSLCD_SCREEN_FILAMENT_UNLOADING); + gotoScreen(DGUS_SCREEN_FILAMENT_UNLOADING); filament_data.heated = true; } // Before unloading extrude to prevent jamming @@ -1293,21 +1293,21 @@ void DGUSScreenHandlerMKS::FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr) #endif // DGUS_FILAMENT_LOADUNLOAD bool DGUSScreenHandlerMKS::loop() { - dgusdisplay.loop(); + dgus.loop(); const millis_t ms = millis(); static millis_t next_event_ms = 0; static uint8_t language_times = 2; - if (!IsScreenComplete() || ELAPSED(ms, next_event_ms)) { + if (!isScreenComplete() || ELAPSED(ms, next_event_ms)) { next_event_ms = ms + DGUS_UPDATE_INTERVAL_MS; - UpdateScreenVPData(); + updateScreenVPData(); } if (language_times != 0) { - LanguagePInit(); - DGUS_LanguageDisplay(mks_language_index); + languagePInit(); + languageDisplay(mks_language_index); language_times--; } @@ -1326,40 +1326,40 @@ bool DGUSScreenHandlerMKS::loop() { thermalManager.extrude_min_temp = mks_min_extrusion_temp; #endif - DGUS_ExtrudeLoadInit(); + extrudeLoadInit(); - TERN_(DGUS_MKS_RUNOUT_SENSOR, DGUS_RunoutInit()); + TERN_(DGUS_MKS_RUNOUT_SENSOR, runoutInit()); if (TERN0(POWER_LOSS_RECOVERY, recovery.valid())) - GotoScreen(DGUSLCD_SCREEN_POWER_LOSS); + gotoScreen(DGUS_SCREEN_POWER_LOSS); else - GotoScreen(DGUSLCD_SCREEN_MAIN); + gotoScreen(DGUS_SCREEN_MAIN); } #if ENABLED(DGUS_MKS_RUNOUT_SENSOR) - if (booted && printingIsActive()) DGUS_Runout_Idle(); + if (booted && printingIsActive()) runoutIdle(); #endif #endif // SHOW_BOOTSCREEN - return IsScreenComplete(); + return isScreenComplete(); } -void DGUSScreenHandlerMKS::LanguagePInit() { +void DGUSScreenHandlerMKS::languagePInit() { switch (mks_language_index) { case MKS_SimpleChinese: - dgusdisplay.WriteVariable(VP_LANGUAGE_CHANGE1, (uint8_t)MKS_Language_Choose); - dgusdisplay.WriteVariable(VP_LANGUAGE_CHANGE2, (uint8_t)MKS_Language_NoChoose); + dgus.writeVariable(VP_LANGUAGE_CHANGE1, (uint8_t)MKS_Language_Choose); + dgus.writeVariable(VP_LANGUAGE_CHANGE2, (uint8_t)MKS_Language_NoChoose); break; case MKS_English: - dgusdisplay.WriteVariable(VP_LANGUAGE_CHANGE1, (uint8_t)MKS_Language_NoChoose); - dgusdisplay.WriteVariable(VP_LANGUAGE_CHANGE2, (uint8_t)MKS_Language_Choose); + dgus.writeVariable(VP_LANGUAGE_CHANGE1, (uint8_t)MKS_Language_NoChoose); + dgus.writeVariable(VP_LANGUAGE_CHANGE2, (uint8_t)MKS_Language_Choose); break; default: break; } } -void DGUSScreenHandlerMKS::DGUS_ExtrudeLoadInit() { +void DGUSScreenHandlerMKS::extrudeLoadInit() { ex_filament.ex_length = distanceFilament; ex_filament.ex_load_unload_flag = 0; ex_filament.ex_need_time = filamentSpeed_mm_s; @@ -1369,7 +1369,7 @@ void DGUSScreenHandlerMKS::DGUS_ExtrudeLoadInit() { ex_filament.ex_tick_start = 0; } -void DGUSScreenHandlerMKS::DGUS_RunoutInit() { +void DGUSScreenHandlerMKS::runoutInit() { #if PIN_EXISTS(MT_DET_1) SET_INPUT_PULLUP(MT_DET_1_PIN); #endif @@ -1379,7 +1379,7 @@ void DGUSScreenHandlerMKS::DGUS_RunoutInit() { runout_mks.runout_status = UNRUNOUT_STATUS; } -void DGUSScreenHandlerMKS::DGUS_Runout_Idle() { +void DGUSScreenHandlerMKS::runoutIdle() { #if ENABLED(DGUS_MKS_RUNOUT_SENSOR) // scanf runout pin switch (runout_mks.runout_status) { @@ -1387,11 +1387,11 @@ void DGUSScreenHandlerMKS::DGUS_Runout_Idle() { case RUNOUT_STATUS: runout_mks.runout_status = RUNOUT_BEGIN_STATUS; queue.inject(F("M25")); - GotoScreen(MKSLCD_SCREEN_PAUSE); + gotoScreen(MKSLCD_SCREEN_PAUSE); - sendinfoscreen(F("NOTICE"), nullptr, F("Please change filament!"), nullptr, true, true, true, true); - //SetupConfirmAction(nullptr); - GotoScreen(DGUSLCD_SCREEN_POPUP); + sendInfoScreen(F("NOTICE"), nullptr, F("Please change filament!"), nullptr, true, true, true, true); + //setupConfirmAction(nullptr); + gotoScreen(DGUS_SCREEN_POPUP); break; case UNRUNOUT_STATUS: @@ -1414,516 +1414,516 @@ void DGUSScreenHandlerMKS::DGUS_Runout_Idle() { #endif } -void DGUSScreenHandlerMKS::DGUS_LanguageDisplay(uint8_t var) { +void DGUSScreenHandlerMKS::languageDisplay(uint8_t var) { if (var == MKS_English) { const char home_buf_en[] = "Home"; - dgusdisplay.WriteVariable(VP_HOME_Dis, home_buf_en, 32, true); + dgus.writeVariable(VP_HOME_Dis, home_buf_en, 32, true); const char setting_buf_en[] = "Setting"; - dgusdisplay.WriteVariable(VP_Setting_Dis, setting_buf_en, 32, true); + dgus.writeVariable(VP_Setting_Dis, setting_buf_en, 32, true); const char Tool_buf_en[] = "Tool"; - dgusdisplay.WriteVariable(VP_Tool_Dis, Tool_buf_en, 32, true); + dgus.writeVariable(VP_Tool_Dis, Tool_buf_en, 32, true); const char Print_buf_en[] = "Print"; - dgusdisplay.WriteVariable(VP_Print_Dis, Print_buf_en, 32, true); + dgus.writeVariable(VP_Print_Dis, Print_buf_en, 32, true); const char Language_buf_en[] = "Language"; - dgusdisplay.WriteVariable(VP_Language_Dis, Language_buf_en, 32, true); + dgus.writeVariable(VP_Language_Dis, Language_buf_en, 32, true); const char About_buf_en[] = "About"; - dgusdisplay.WriteVariable(VP_About_Dis, About_buf_en, 32, true); + dgus.writeVariable(VP_About_Dis, About_buf_en, 32, true); const char Config_buf_en[] = "Config"; - dgusdisplay.WriteVariable(VP_Config_Dis, Config_buf_en, 32, true); + dgus.writeVariable(VP_Config_Dis, Config_buf_en, 32, true); const char MotorConfig_buf_en[] = "MotorConfig"; - dgusdisplay.WriteVariable(VP_MotorConfig_Dis, MotorConfig_buf_en, 32, true); + dgus.writeVariable(VP_MotorConfig_Dis, MotorConfig_buf_en, 32, true); const char LevelConfig_buf_en[] = "LevelConfig"; - dgusdisplay.WriteVariable(VP_LevelConfig_Dis, LevelConfig_buf_en, 32, true); + dgus.writeVariable(VP_LevelConfig_Dis, LevelConfig_buf_en, 32, true); const char TemperatureConfig_buf_en[] = "Temperature"; - dgusdisplay.WriteVariable(VP_TemperatureConfig_Dis, TemperatureConfig_buf_en, 32, true); + dgus.writeVariable(VP_TemperatureConfig_Dis, TemperatureConfig_buf_en, 32, true); const char Advance_buf_en[] = "Advance"; - dgusdisplay.WriteVariable(VP_Advance_Dis, Advance_buf_en, 32, true); + dgus.writeVariable(VP_Advance_Dis, Advance_buf_en, 32, true); const char Filament_buf_en[] = "Extrude"; - dgusdisplay.WriteVariable(VP_Filament_Dis, Filament_buf_en, 32, true); + dgus.writeVariable(VP_Filament_Dis, Filament_buf_en, 32, true); const char Move_buf_en[] = "Move"; - dgusdisplay.WriteVariable(VP_Move_Dis, Move_buf_en, 32, true); + dgus.writeVariable(VP_Move_Dis, Move_buf_en, 32, true); #if ENABLED(AUTO_BED_LEVELING_BILINEAR) const char Level_buf_en[] = "AutoLevel"; - dgusdisplay.WriteVariable(VP_Level_Dis, Level_buf_en, 32, true); + dgus.writeVariable(VP_Level_Dis, Level_buf_en, 32, true); #elif ENABLED(MESH_BED_LEVELING) const char Level_buf_en[] = "MeshLevel"; - dgusdisplay.WriteVariable(VP_Level_Dis, Level_buf_en, 32, true); + dgus.writeVariable(VP_Level_Dis, Level_buf_en, 32, true); #else const char Level_buf_en[] = "Level"; - dgusdisplay.WriteVariable(VP_Level_Dis, Level_buf_en, 32, true); + dgus.writeVariable(VP_Level_Dis, Level_buf_en, 32, true); #endif const char MotorPluse_buf_en[] = "MotorPluse"; - dgusdisplay.WriteVariable(VP_MotorPluse_Dis, MotorPluse_buf_en, 32, true); + dgus.writeVariable(VP_MotorPluse_Dis, MotorPluse_buf_en, 32, true); const char MotorMaxSpeed_buf_en[] = "MotorMaxSpeed"; - dgusdisplay.WriteVariable(VP_MotorMaxSpeed_Dis, MotorMaxSpeed_buf_en, 32, true); + dgus.writeVariable(VP_MotorMaxSpeed_Dis, MotorMaxSpeed_buf_en, 32, true); const char MotorMaxAcc_buf_en[] = "MotorAcc"; - dgusdisplay.WriteVariable(VP_MotorMaxAcc_Dis, MotorMaxAcc_buf_en, 32, true); + dgus.writeVariable(VP_MotorMaxAcc_Dis, MotorMaxAcc_buf_en, 32, true); const char TravelAcc_buf_en[] = "TravelAcc"; - dgusdisplay.WriteVariable(VP_TravelAcc_Dis, TravelAcc_buf_en, 32, true); + dgus.writeVariable(VP_TravelAcc_Dis, TravelAcc_buf_en, 32, true); const char FeedRateMin_buf_en[] = "FeedRateMin"; - dgusdisplay.WriteVariable(VP_FeedRateMin_Dis, FeedRateMin_buf_en, 32, true); + dgus.writeVariable(VP_FeedRateMin_Dis, FeedRateMin_buf_en, 32, true); const char TravelFeeRateMin_buf_en[] = "TravelFeedRateMin"; - dgusdisplay.WriteVariable(VP_TravelFeeRateMin_Dis, TravelFeeRateMin_buf_en, 32, true); + dgus.writeVariable(VP_TravelFeeRateMin_Dis, TravelFeeRateMin_buf_en, 32, true); const char Acc_buf_en[] = "Acc"; - dgusdisplay.WriteVariable(VP_ACC_Dis, Acc_buf_en, 32, true); + dgus.writeVariable(VP_ACC_Dis, Acc_buf_en, 32, true); const char Point_One_buf_en[] = "Point_First"; - dgusdisplay.WriteVariable(VP_Point_One_Dis, Point_One_buf_en, 32, true); + dgus.writeVariable(VP_Point_One_Dis, Point_One_buf_en, 32, true); const char Point_Two_buf_en[] = "Point_Second"; - dgusdisplay.WriteVariable(VP_Point_Two_Dis, Point_Two_buf_en, 32, true); + dgus.writeVariable(VP_Point_Two_Dis, Point_Two_buf_en, 32, true); const char Point_Three_buf_en[] = "Point_Third"; - dgusdisplay.WriteVariable(VP_Point_Three_Dis, Point_Three_buf_en, 32, true); + dgus.writeVariable(VP_Point_Three_Dis, Point_Three_buf_en, 32, true); const char Point_Four_buf_en[] = "Point_Fourth"; - dgusdisplay.WriteVariable(VP_Point_Four_Dis, Point_Four_buf_en, 32, true); + dgus.writeVariable(VP_Point_Four_Dis, Point_Four_buf_en, 32, true); const char Point_Five_buf_en[] = "Point_Fifth"; - dgusdisplay.WriteVariable(VP_Point_Five_Dis, Point_Five_buf_en, 32, true); + dgus.writeVariable(VP_Point_Five_Dis, Point_Five_buf_en, 32, true); const char Extrusion_buf_en[] = "Extrusion"; - dgusdisplay.WriteVariable(VP_Extrusion_Dis, Extrusion_buf_en, 32, true); + dgus.writeVariable(VP_Extrusion_Dis, Extrusion_buf_en, 32, true); const char HeatBed_buf_en[] = "HeatBed"; - dgusdisplay.WriteVariable(VP_HeatBed_Dis, HeatBed_buf_en, 32, true); + dgus.writeVariable(VP_HeatBed_Dis, HeatBed_buf_en, 32, true); const char FactoryDefaults_buf_en[] = "FactoryDefaults"; - dgusdisplay.WriteVariable(VP_FactoryDefaults_Dis, FactoryDefaults_buf_en, 32, true); + dgus.writeVariable(VP_FactoryDefaults_Dis, FactoryDefaults_buf_en, 32, true); const char StoreSetting_buf_en[] = "StoreSetting"; - dgusdisplay.WriteVariable(VP_StoreSetting_Dis, StoreSetting_buf_en, 32, true); + dgus.writeVariable(VP_StoreSetting_Dis, StoreSetting_buf_en, 32, true); const char PrintPauseConfig_buf_en[] = "PrintPauseConfig"; - dgusdisplay.WriteVariable(VP_PrintPauseConfig_Dis, PrintPauseConfig_buf_en, 32, true); + dgus.writeVariable(VP_PrintPauseConfig_Dis, PrintPauseConfig_buf_en, 32, true); const char X_Pluse_buf_en[] = "X_Pluse"; - dgusdisplay.WriteVariable(VP_X_Pluse_Dis, X_Pluse_buf_en, 32, true); + dgus.writeVariable(VP_X_Pluse_Dis, X_Pluse_buf_en, 32, true); const char Y_Pluse_buf_en[] = "Y_Pluse"; - dgusdisplay.WriteVariable(VP_Y_Pluse_Dis, Y_Pluse_buf_en, 32, true); + dgus.writeVariable(VP_Y_Pluse_Dis, Y_Pluse_buf_en, 32, true); const char Z_Pluse_buf_en[] = "Z_Pluse"; - dgusdisplay.WriteVariable(VP_Z_Pluse_Dis, Z_Pluse_buf_en, 32, true); + dgus.writeVariable(VP_Z_Pluse_Dis, Z_Pluse_buf_en, 32, true); const char E0_Pluse_buf_en[] = "E0_Pluse"; - dgusdisplay.WriteVariable(VP_E0_Pluse_Dis, E0_Pluse_buf_en, 32, true); + dgus.writeVariable(VP_E0_Pluse_Dis, E0_Pluse_buf_en, 32, true); const char E1_Pluse_buf_en[] = "E1_Pluse"; - dgusdisplay.WriteVariable(VP_E1_Pluse_Dis, E1_Pluse_buf_en, 32, true); + dgus.writeVariable(VP_E1_Pluse_Dis, E1_Pluse_buf_en, 32, true); const char X_Max_Speed_buf_en[] = "X_Max_Speed"; - dgusdisplay.WriteVariable(VP_X_Max_Speed_Dis, X_Max_Speed_buf_en, 32, true); + dgus.writeVariable(VP_X_Max_Speed_Dis, X_Max_Speed_buf_en, 32, true); const char Y_Max_Speed_buf_en[] = "Y_Max_Speed"; - dgusdisplay.WriteVariable(VP_Y_Max_Speed_Dis, Y_Max_Speed_buf_en, 32, true); + dgus.writeVariable(VP_Y_Max_Speed_Dis, Y_Max_Speed_buf_en, 32, true); const char Z_Max_Speed_buf_en[] = "Z_Max_Speed"; - dgusdisplay.WriteVariable(VP_Z_Max_Speed_Dis, Z_Max_Speed_buf_en, 32, true); + dgus.writeVariable(VP_Z_Max_Speed_Dis, Z_Max_Speed_buf_en, 32, true); const char E0_Max_Speed_buf_en[] = "E0_Max_Speed"; - dgusdisplay.WriteVariable(VP_E0_Max_Speed_Dis, E0_Max_Speed_buf_en, 32, true); + dgus.writeVariable(VP_E0_Max_Speed_Dis, E0_Max_Speed_buf_en, 32, true); const char E1_Max_Speed_buf_en[] = "E1_Max_Speed"; - dgusdisplay.WriteVariable(VP_E1_Max_Speed_Dis, E1_Max_Speed_buf_en, 32, true); + dgus.writeVariable(VP_E1_Max_Speed_Dis, E1_Max_Speed_buf_en, 32, true); const char X_Max_Acc_Speed_buf_en[] = "X_Max_Acc_Speed"; - dgusdisplay.WriteVariable(VP_X_Max_Acc_Speed_Dis, X_Max_Acc_Speed_buf_en, 32, true); + dgus.writeVariable(VP_X_Max_Acc_Speed_Dis, X_Max_Acc_Speed_buf_en, 32, true); const char Y_Max_Acc_Speed_buf_en[] = "Y_Max_Acc_Speed"; - dgusdisplay.WriteVariable(VP_Y_Max_Acc_Speed_Dis, Y_Max_Acc_Speed_buf_en, 32, true); + dgus.writeVariable(VP_Y_Max_Acc_Speed_Dis, Y_Max_Acc_Speed_buf_en, 32, true); const char Z_Max_Acc_Speed_buf_en[] = "Z_Max_Acc_Speed"; - dgusdisplay.WriteVariable(VP_Z_Max_Acc_Speed_Dis, Z_Max_Acc_Speed_buf_en, 32, true); + dgus.writeVariable(VP_Z_Max_Acc_Speed_Dis, Z_Max_Acc_Speed_buf_en, 32, true); const char E0_Max_Acc_Speed_buf_en[] = "E0_Max_Acc_Speed"; - dgusdisplay.WriteVariable(VP_E0_Max_Acc_Speed_Dis, E0_Max_Acc_Speed_buf_en, 32, true); + dgus.writeVariable(VP_E0_Max_Acc_Speed_Dis, E0_Max_Acc_Speed_buf_en, 32, true); const char E1_Max_Acc_Speed_buf_en[] = "E1_Max_Acc_Speed"; - dgusdisplay.WriteVariable(VP_E1_Max_Acc_Speed_Dis, E1_Max_Acc_Speed_buf_en, 32, true); + dgus.writeVariable(VP_E1_Max_Acc_Speed_Dis, E1_Max_Acc_Speed_buf_en, 32, true); const char X_PARK_POS_buf_en[] = "X_PARK_POS"; - dgusdisplay.WriteVariable(VP_X_PARK_POS_Dis, X_PARK_POS_buf_en, 32, true); + dgus.writeVariable(VP_X_PARK_POS_Dis, X_PARK_POS_buf_en, 32, true); const char Y_PARK_POS_buf_en[] = "Y_PARK_POS"; - dgusdisplay.WriteVariable(VP_Y_PARK_POS_Dis, Y_PARK_POS_buf_en, 32, true); + dgus.writeVariable(VP_Y_PARK_POS_Dis, Y_PARK_POS_buf_en, 32, true); const char Z_PARK_POS_buf_en[] = "Z_PARK_POS"; - dgusdisplay.WriteVariable(VP_Z_PARK_POS_Dis, Z_PARK_POS_buf_en, 32, true); + dgus.writeVariable(VP_Z_PARK_POS_Dis, Z_PARK_POS_buf_en, 32, true); const char Length_buf_en[] = "Length"; - dgusdisplay.WriteVariable(VP_Length_Dis, Length_buf_en, 32, true); + dgus.writeVariable(VP_Length_Dis, Length_buf_en, 32, true); const char Speed_buf_en[] = "Speed"; - dgusdisplay.WriteVariable(VP_Speed_Dis, Speed_buf_en, 32, true); + dgus.writeVariable(VP_Speed_Dis, Speed_buf_en, 32, true); const char InOut_buf_en[] = "InOut"; - dgusdisplay.WriteVariable(VP_InOut_Dis, InOut_buf_en, 32, true); + dgus.writeVariable(VP_InOut_Dis, InOut_buf_en, 32, true); const char PrintTimet_buf_en[] = "PrintTime"; - dgusdisplay.WriteVariable(VP_PrintTime_Dis, PrintTimet_buf_en, 32, true); + dgus.writeVariable(VP_PrintTime_Dis, PrintTimet_buf_en, 32, true); const char E0_Temp_buf_en[] = "E0_Temp"; - dgusdisplay.WriteVariable(VP_E0_Temp_Dis, E0_Temp_buf_en, 32, true); + dgus.writeVariable(VP_E0_Temp_Dis, E0_Temp_buf_en, 32, true); const char E1_Temp_buf_en[] = "E1_Temp"; - dgusdisplay.WriteVariable(VP_E1_Temp_Dis, E1_Temp_buf_en, 32, true); + dgus.writeVariable(VP_E1_Temp_Dis, E1_Temp_buf_en, 32, true); const char HB_Temp_buf_en[] = "HB_Temp"; - dgusdisplay.WriteVariable(VP_HB_Temp_Dis, HB_Temp_buf_en, 32, true); + dgus.writeVariable(VP_HB_Temp_Dis, HB_Temp_buf_en, 32, true); const char Feedrate_buf_en[] = "Feedrate"; - dgusdisplay.WriteVariable(VP_Feedrate_Dis, Feedrate_buf_en, 32, true); + dgus.writeVariable(VP_Feedrate_Dis, Feedrate_buf_en, 32, true); const char PrintAcc_buf_en[] = "PrintSpeed"; - dgusdisplay.WriteVariable(VP_PrintAcc_Dis, PrintAcc_buf_en, 32, true); + dgus.writeVariable(VP_PrintAcc_Dis, PrintAcc_buf_en, 32, true); const char FAN_Speed_buf_en[] = "FAN_Speed"; - dgusdisplay.WriteVariable(VP_Fan_Speed_Dis, FAN_Speed_buf_en, 32, true); + dgus.writeVariable(VP_Fan_Speed_Dis, FAN_Speed_buf_en, 32, true); const char Printing_buf_en[] = "Printing"; - dgusdisplay.WriteVariable(VP_Printing_Dis, Printing_buf_en, 32, true); + dgus.writeVariable(VP_Printing_Dis, Printing_buf_en, 32, true); const char Info_EEPROM_1_buf_en[] = "Store setting?"; - dgusdisplay.WriteVariable(VP_Info_EEPROM_1_Dis, Info_EEPROM_1_buf_en, 32, true); + dgus.writeVariable(VP_Info_EEPROM_1_Dis, Info_EEPROM_1_buf_en, 32, true); const char Info_EEPROM_2_buf_en[] = "Revert setting?"; - dgusdisplay.WriteVariable(VP_Info_EEPROM_2_Dis, Info_EEPROM_2_buf_en, 32, true); + dgus.writeVariable(VP_Info_EEPROM_2_Dis, Info_EEPROM_2_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); + dgus.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); + dgus.writeVariable(VP_TMC_X_Step_Dis, TMC_X_Step_buf_en, 32, true); const char TMC_Y_Step_buf_en[] = "Y_SenSitivity"; - dgusdisplay.WriteVariable(VP_TMC_Y_Step_Dis, TMC_Y_Step_buf_en, 32, true); + dgus.writeVariable(VP_TMC_Y_Step_Dis, TMC_Y_Step_buf_en, 32, true); const char TMC_Z_Step_buf_en[] = "Z_SenSitivity"; - dgusdisplay.WriteVariable(VP_TMC_Z_Step_Dis, TMC_Z_Step_buf_en, 32, true); + dgus.writeVariable(VP_TMC_Z_Step_Dis, TMC_Z_Step_buf_en, 32, true); const char TMC_X_Current_buf_en[] = "X_Current"; - dgusdisplay.WriteVariable(VP_TMC_X_Current_Dis, TMC_X_Current_buf_en, 32, true); + dgus.writeVariable(VP_TMC_X_Current_Dis, TMC_X_Current_buf_en, 32, true); const char TMC_Y_Current_buf_en[] = "Y_Current"; - dgusdisplay.WriteVariable(VP_TMC_Y_Current_Dis, TMC_Y_Current_buf_en, 32, true); + dgus.writeVariable(VP_TMC_Y_Current_Dis, TMC_Y_Current_buf_en, 32, true); const char TMC_Z_Current_buf_en[] = "Z_Current"; - dgusdisplay.WriteVariable(VP_TMC_Z_Current_Dis, TMC_Z_Current_buf_en, 32, true); + dgus.writeVariable(VP_TMC_Z_Current_Dis, TMC_Z_Current_buf_en, 32, true); const char TMC_E0_Current_buf_en[] = "E0_Current"; - dgusdisplay.WriteVariable(VP_TMC_E0_Current_Dis, TMC_E0_Current_buf_en, 32, true); + dgus.writeVariable(VP_TMC_E0_Current_Dis, TMC_E0_Current_buf_en, 32, true); const char TMC_X1_Current_buf_en[] = "X1_Current"; - dgusdisplay.WriteVariable(VP_TMC_X1_Current_Dis, TMC_X1_Current_buf_en, 32, true); + dgus.writeVariable(VP_TMC_X1_Current_Dis, TMC_X1_Current_buf_en, 32, true); const char TMC_Y1_Current_buf_en[] = "Y1_Current"; - dgusdisplay.WriteVariable(VP_TMC_Y1_Current_Dis, TMC_Y1_Current_buf_en, 32, true); + dgus.writeVariable(VP_TMC_Y1_Current_Dis, TMC_Y1_Current_buf_en, 32, true); const char TMC_Z1_Current_buf_en[] = "Z1_Current"; - dgusdisplay.WriteVariable(VP_TMC_Z1_Current_Dis, TMC_Z1_Current_buf_en, 32, true); + dgus.writeVariable(VP_TMC_Z1_Current_Dis, TMC_Z1_Current_buf_en, 32, true); const char TMC_E1_Current_buf_en[] = "E1_Current"; - dgusdisplay.WriteVariable(VP_TMC_E1_Current_Dis, TMC_E1_Current_buf_en, 32, true); + dgus.writeVariable(VP_TMC_E1_Current_Dis, TMC_E1_Current_buf_en, 32, true); const char Min_Ex_Temp_buf_en[] = "Min_Ex_Temp"; - dgusdisplay.WriteVariable(VP_Min_Ex_Temp_Dis, Min_Ex_Temp_buf_en, 32, true); + dgus.writeVariable(VP_Min_Ex_Temp_Dis, Min_Ex_Temp_buf_en, 32, true); const char AutoLEVEL_INFO1_buf_en[] = "Please Press Button!"; - dgusdisplay.WriteVariable(VP_AutoLEVEL_INFO1, AutoLEVEL_INFO1_buf_en, 32, true); + dgus.writeVariable(VP_AutoLEVEL_INFO1, AutoLEVEL_INFO1_buf_en, 32, true); const char EX_TEMP_INFO2_buf_en[] = "Please wait a monent"; - dgusdisplay.WriteVariable(VP_EX_TEMP_INFO2_Dis, EX_TEMP_INFO2_buf_en, 32, true); + dgus.writeVariable(VP_EX_TEMP_INFO2_Dis, EX_TEMP_INFO2_buf_en, 32, true); const char EX_TEMP_INFO3_buf_en[] = "Cancle"; - dgusdisplay.WriteVariable(VP_EX_TEMP_INFO3_Dis, EX_TEMP_INFO3_buf_en, 32, true); + dgus.writeVariable(VP_EX_TEMP_INFO3_Dis, EX_TEMP_INFO3_buf_en, 32, true); const char PrintConfrim_Info_buf_en[] = "Start Print?"; - dgusdisplay.WriteVariable(VP_PrintConfrim_Info_Dis, PrintConfrim_Info_buf_en, 32, true); + dgus.writeVariable(VP_PrintConfrim_Info_Dis, PrintConfrim_Info_buf_en, 32, true); const char StopPrintConfrim_Info_buf_en[] = "Stop Print?"; - dgusdisplay.WriteVariable(VP_StopPrintConfrim_Info_Dis, StopPrintConfrim_Info_buf_en, 32, true); + dgus.writeVariable(VP_StopPrintConfrim_Info_Dis, StopPrintConfrim_Info_buf_en, 32, true); const char Printting_buf_en[] = "Printing"; - dgusdisplay.WriteVariable(VP_Printting_Dis, Printting_buf_en, 32, true); + dgus.writeVariable(VP_Printting_Dis, Printting_buf_en, 32, true); const char LCD_BLK_buf_en[] = "Backlight"; - dgusdisplay.WriteVariable(VP_LCD_BLK_Dis, LCD_BLK_buf_en, 32, true); + dgus.writeVariable(VP_LCD_BLK_Dis, LCD_BLK_buf_en, 32, true); } else if (var == MKS_SimpleChinese) { uint16_t home_buf_ch[] = { 0xF7D6, 0xB3D2 }; - dgusdisplay.WriteVariable(VP_HOME_Dis, home_buf_ch, 4, true); + dgus.writeVariable(VP_HOME_Dis, home_buf_ch, 4, true); const uint16_t Setting_Dis[] = { 0xE8C9, 0xC3D6, 0x2000, 0x2000, 0x2000 }; - dgusdisplay.WriteVariable(VP_Setting_Dis, Setting_Dis, 7, true); + dgus.writeVariable(VP_Setting_Dis, Setting_Dis, 7, true); const uint16_t Tool_Dis[] = { 0xA4B9, 0xDFBE }; - dgusdisplay.WriteVariable(VP_Tool_Dis, Tool_Dis, 4, true); + dgus.writeVariable(VP_Tool_Dis, Tool_Dis, 4, true); const uint16_t Print_buf_ch[] = { 0xF2B4, 0xA1D3, 0x2000 }; - dgusdisplay.WriteVariable(VP_Print_Dis, Print_buf_ch, 6, true); + dgus.writeVariable(VP_Print_Dis, Print_buf_ch, 6, true); const uint16_t Language_buf_ch[] = { 0xEFD3, 0xD4D1, 0x2000, 0x2000 }; - dgusdisplay.WriteVariable(VP_Language_Dis, Language_buf_ch, 8, true); + dgus.writeVariable(VP_Language_Dis, Language_buf_ch, 8, true); const uint16_t About_buf_ch[] = { 0xD8B9, 0xDAD3, 0x2000 }; - dgusdisplay.WriteVariable(VP_About_Dis, About_buf_ch, 6, true); + dgus.writeVariable(VP_About_Dis, About_buf_ch, 6, true); const uint16_t Config_buf_ch[] = { 0xE4C5, 0xC3D6, 0x2000 }; - dgusdisplay.WriteVariable(VP_Config_Dis, Config_buf_ch, 6, true); + dgus.writeVariable(VP_Config_Dis, Config_buf_ch, 6, true); const uint16_t MotorConfig_buf_ch[] = { 0xE7B5, 0xFABB, 0xE4C5, 0xC3D6, 0x2000 }; - dgusdisplay.WriteVariable(VP_MotorConfig_Dis, MotorConfig_buf_ch, 12, true); + dgus.writeVariable(VP_MotorConfig_Dis, MotorConfig_buf_ch, 12, true); const uint16_t LevelConfig_buf_ch[] = { 0xD6CA, 0xAFB6, 0xF7B5, 0xBDC6, 0xE8C9, 0xC3D6, 0x2000 }; - dgusdisplay.WriteVariable(VP_LevelConfig_Dis, LevelConfig_buf_ch, 32, true); + dgus.writeVariable(VP_LevelConfig_Dis, LevelConfig_buf_ch, 32, true); const uint16_t TemperatureConfig_buf_ch[] = { 0xC2CE, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_TemperatureConfig_Dis, TemperatureConfig_buf_ch, 11, true); + dgus.writeVariable(VP_TemperatureConfig_Dis, TemperatureConfig_buf_ch, 11, true); const uint16_t Advance_buf_ch[] = { 0xDFB8, 0xB6BC, 0xE8C9, 0xC3D6, 0x2000 }; - dgusdisplay.WriteVariable(VP_Advance_Dis, Advance_buf_ch, 16, true); + dgus.writeVariable(VP_Advance_Dis, Advance_buf_ch, 16, true); const uint16_t Filament_buf_ch[] = { 0xB7BC, 0xF6B3, 0x2000 }; - dgusdisplay.WriteVariable(VP_Filament_Dis, Filament_buf_ch, 8, true); + dgus.writeVariable(VP_Filament_Dis, Filament_buf_ch, 8, true); const uint16_t Move_buf_ch[] = { 0xC6D2, 0xAFB6, 0x2000 }; - dgusdisplay.WriteVariable(VP_Move_Dis, Move_buf_ch, 4, true); + dgus.writeVariable(VP_Move_Dis, Move_buf_ch, 4, true); #if ENABLED(AUTO_BED_LEVELING_BILINEAR) const uint16_t Level_buf_ch[] = { 0xD4D7, 0xAFB6, 0xF7B5, 0xBDC6, 0x2000 }; - dgusdisplay.WriteVariable(VP_Level_Dis, Level_buf_ch, 32, true); + dgus.writeVariable(VP_Level_Dis, Level_buf_ch, 32, true); #elif ENABLED(MESH_BED_LEVELING) const uint16_t Level_buf_ch[] = { 0xF8CD, 0xF1B8, 0xF7B5, 0xBDC6, 0x2000 }; - dgusdisplay.WriteVariable(VP_Level_Dis, Level_buf_ch, 32, true); + dgus.writeVariable(VP_Level_Dis, Level_buf_ch, 32, true); #else const uint16_t Level_buf_ch[] = { 0xD6CA, 0xAFB6, 0xF7B5, 0xBDC6, 0x2000 }; - dgusdisplay.WriteVariable(VP_Level_Dis, Level_buf_ch, 32, true); + dgus.writeVariable(VP_Level_Dis, Level_buf_ch, 32, true); #endif const uint16_t MotorPluse_buf_ch[] = { 0xF6C2, 0xE5B3, 0x2000 }; - dgusdisplay.WriteVariable(VP_MotorPluse_Dis, MotorPluse_buf_ch, 16, true); + dgus.writeVariable(VP_MotorPluse_Dis, MotorPluse_buf_ch, 16, true); const uint16_t MotorMaxSpeed_buf_ch[] = { 0xEED7, 0xF3B4, 0xD9CB, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_MotorMaxSpeed_Dis, MotorMaxSpeed_buf_ch, 16, true); + dgus.writeVariable(VP_MotorMaxSpeed_Dis, MotorMaxSpeed_buf_ch, 16, true); const uint16_t MotorMaxAcc_buf_ch[] = { 0xEED7, 0xF3B4, 0xD3BC, 0xD9CB, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_MotorMaxAcc_Dis, MotorMaxAcc_buf_ch, 16, true); + dgus.writeVariable(VP_MotorMaxAcc_Dis, MotorMaxAcc_buf_ch, 16, true); const uint16_t TravelAcc_buf_ch[] = { 0xD5BF, 0xD0D0, 0xD3BC, 0xD9CB, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_TravelAcc_Dis, TravelAcc_buf_ch, 16, true); + dgus.writeVariable(VP_TravelAcc_Dis, TravelAcc_buf_ch, 16, true); const uint16_t FeedRateMin_buf_ch[] = { 0xEED7, 0xA1D0, 0xD9CB, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_FeedRateMin_Dis, FeedRateMin_buf_ch, 12, true); + dgus.writeVariable(VP_FeedRateMin_Dis, FeedRateMin_buf_ch, 12, true); const uint16_t TravelFeeRateMin_buf_ch[] = { 0xD5BF, 0xD0D0, 0xEED7, 0xA1D0, 0xD9CB, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_TravelFeeRateMin_Dis, TravelFeeRateMin_buf_ch, 24, true); + dgus.writeVariable(VP_TravelFeeRateMin_Dis, TravelFeeRateMin_buf_ch, 24, true); const uint16_t Acc_buf_ch[] = { 0xD3BC, 0xD9CB, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_ACC_Dis, Acc_buf_ch, 16, true); + dgus.writeVariable(VP_ACC_Dis, Acc_buf_ch, 16, true); const uint16_t Point_One_buf_ch[] = { 0xDAB5, 0xBBD2, 0xE3B5, 0x2000 }; - dgusdisplay.WriteVariable(VP_Point_One_Dis, Point_One_buf_ch, 12, true); + dgus.writeVariable(VP_Point_One_Dis, Point_One_buf_ch, 12, true); const uint16_t Point_Two_buf_ch[] = { 0xDAB5, 0xFEB6, 0xE3B5, 0x2000 }; - dgusdisplay.WriteVariable(VP_Point_Two_Dis, Point_Two_buf_ch, 12, true); + dgus.writeVariable(VP_Point_Two_Dis, Point_Two_buf_ch, 12, true); const uint16_t Point_Three_buf_ch[] = { 0xDAB5, 0xFDC8, 0xE3B5, 0x2000 }; - dgusdisplay.WriteVariable(VP_Point_Three_Dis, Point_Three_buf_ch, 12, true); + dgus.writeVariable(VP_Point_Three_Dis, Point_Three_buf_ch, 12, true); const uint16_t Point_Four_buf_ch[] = { 0xDAB5, 0xC4CB, 0xE3B5, 0x2000 }; - dgusdisplay.WriteVariable(VP_Point_Four_Dis, Point_Four_buf_ch, 12, true); + dgus.writeVariable(VP_Point_Four_Dis, Point_Four_buf_ch, 12, true); const uint16_t Point_Five_buf_ch[] = { 0xDAB5, 0xE5CE, 0xE3B5, 0x2000 }; - dgusdisplay.WriteVariable(VP_Point_Five_Dis, Point_Five_buf_ch, 12, true); + dgus.writeVariable(VP_Point_Five_Dis, Point_Five_buf_ch, 12, true); const uint16_t Extrusion_buf_ch[] = { 0xB7BC, 0xF6B3, 0xB7CD, 0x2000 }; - dgusdisplay.WriteVariable(VP_Extrusion_Dis, Extrusion_buf_ch, 12, true); + dgus.writeVariable(VP_Extrusion_Dis, Extrusion_buf_ch, 12, true); const uint16_t HeatBed_buf_ch[] = { 0xC8C8, 0xB2B4, 0x2000 }; - dgusdisplay.WriteVariable(VP_HeatBed_Dis, HeatBed_buf_ch, 12, true); + dgus.writeVariable(VP_HeatBed_Dis, HeatBed_buf_ch, 12, true); const uint16_t FactoryDefaults_buf_ch[] = { 0xD6BB, 0xB4B8, 0xF6B3, 0xA7B3, 0xE8C9, 0xC3D6, 0x2000 }; - dgusdisplay.WriteVariable(VP_FactoryDefaults_Dis, FactoryDefaults_buf_ch, 16, true); + dgus.writeVariable(VP_FactoryDefaults_Dis, FactoryDefaults_buf_ch, 16, true); const uint16_t StoreSetting_buf_ch[] = { 0xA3B1, 0xE6B4, 0xE8C9, 0xC3D6, 0x2000 }; - dgusdisplay.WriteVariable(VP_StoreSetting_Dis, StoreSetting_buf_ch, 16, true); + dgus.writeVariable(VP_StoreSetting_Dis, StoreSetting_buf_ch, 16, true); const uint16_t PrintPauseConfig_buf_ch[] = { 0xDDD4, 0xA3CD, 0xBBCE, 0xC3D6, 0x2000 }; - dgusdisplay.WriteVariable(VP_PrintPauseConfig_Dis, PrintPauseConfig_buf_ch, 32, true); + dgus.writeVariable(VP_PrintPauseConfig_Dis, PrintPauseConfig_buf_ch, 32, true); const uint16_t X_Pluse_buf_ch[] = { 0x2058, 0xE1D6, 0xF6C2, 0xE5B3, 0x2000 }; - dgusdisplay.WriteVariable(VP_X_Pluse_Dis, X_Pluse_buf_ch, 16, true); + dgus.writeVariable(VP_X_Pluse_Dis, X_Pluse_buf_ch, 16, true); const uint16_t Y_Pluse_buf_ch[] = { 0x2059, 0xE1D6, 0xF6C2, 0xE5B3, 0x2000 }; - dgusdisplay.WriteVariable(VP_Y_Pluse_Dis, Y_Pluse_buf_ch, 16, true); + dgus.writeVariable(VP_Y_Pluse_Dis, Y_Pluse_buf_ch, 16, true); const uint16_t Z_Pluse_buf_ch[] = { 0x205A, 0xE1D6, 0xF6C2, 0xE5B3, 0x2000 }; - dgusdisplay.WriteVariable(VP_Z_Pluse_Dis, Z_Pluse_buf_ch, 16, true); + dgus.writeVariable(VP_Z_Pluse_Dis, Z_Pluse_buf_ch, 16, true); const uint16_t E0_Pluse_buf_ch[] = { 0x3045, 0xE1D6, 0xF6C2, 0xE5B3, 0x2000 }; - dgusdisplay.WriteVariable(VP_E0_Pluse_Dis, E0_Pluse_buf_ch, 16, true); + dgus.writeVariable(VP_E0_Pluse_Dis, E0_Pluse_buf_ch, 16, true); const uint16_t E1_Pluse_buf_ch[] = { 0x3145, 0xE1D6, 0xF6C2, 0xE5B3, 0x2000 }; - dgusdisplay.WriteVariable(VP_E1_Pluse_Dis, E1_Pluse_buf_ch, 16, true); + dgus.writeVariable(VP_E1_Pluse_Dis, E1_Pluse_buf_ch, 16, true); const uint16_t X_Max_Speed_buf_ch[] = { 0x2058, 0xEED7, 0xF3B4, 0xD9CB, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_X_Max_Speed_Dis, X_Max_Speed_buf_ch, 16, true); + dgus.writeVariable(VP_X_Max_Speed_Dis, X_Max_Speed_buf_ch, 16, true); const uint16_t Y_Max_Speed_buf_ch[] = { 0x2059, 0xEED7, 0xF3B4, 0xD9CB, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_Y_Max_Speed_Dis, Y_Max_Speed_buf_ch, 16, true); + dgus.writeVariable(VP_Y_Max_Speed_Dis, Y_Max_Speed_buf_ch, 16, true); const uint16_t Z_Max_Speed_buf_ch[] = { 0x205A, 0xEED7, 0xF3B4, 0xD9CB, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_Z_Max_Speed_Dis, Z_Max_Speed_buf_ch, 16, true); + dgus.writeVariable(VP_Z_Max_Speed_Dis, Z_Max_Speed_buf_ch, 16, true); const uint16_t E0_Max_Speed_buf_ch[] = { 0x3045, 0xEED7, 0xF3B4, 0xD9CB, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_E0_Max_Speed_Dis, E0_Max_Speed_buf_ch, 16, true); + dgus.writeVariable(VP_E0_Max_Speed_Dis, E0_Max_Speed_buf_ch, 16, true); const uint16_t E1_Max_Speed_buf_ch[] = { 0x3145, 0xEED7, 0xF3B4, 0xD9CB, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_E1_Max_Speed_Dis, E1_Max_Speed_buf_ch, 16, true); + dgus.writeVariable(VP_E1_Max_Speed_Dis, E1_Max_Speed_buf_ch, 16, true); const uint16_t X_Max_Acc_Speed_buf_ch[] = { 0x2058, 0xEED7, 0xF3B4, 0xD3BC, 0xD9CB, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_X_Max_Acc_Speed_Dis, X_Max_Acc_Speed_buf_ch, 16, true); + dgus.writeVariable(VP_X_Max_Acc_Speed_Dis, X_Max_Acc_Speed_buf_ch, 16, true); const uint16_t Y_Max_Acc_Speed_buf_ch[] = { 0x2059, 0xEED7, 0xF3B4, 0xD3BC, 0xD9CB, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_Y_Max_Acc_Speed_Dis, Y_Max_Acc_Speed_buf_ch, 16, true); + dgus.writeVariable(VP_Y_Max_Acc_Speed_Dis, Y_Max_Acc_Speed_buf_ch, 16, true); const uint16_t Z_Max_Acc_Speed_buf_ch[] = { 0x205A, 0xEED7, 0xF3B4, 0xD3BC, 0xD9CB, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_Z_Max_Acc_Speed_Dis, Z_Max_Acc_Speed_buf_ch, 16, true); + dgus.writeVariable(VP_Z_Max_Acc_Speed_Dis, Z_Max_Acc_Speed_buf_ch, 16, true); const uint16_t E0_Max_Acc_Speed_buf_ch[] = { 0x3045, 0xEED7, 0xF3B4, 0xD3BC, 0xD9CB, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_E0_Max_Acc_Speed_Dis, E0_Max_Acc_Speed_buf_ch, 16, true); + dgus.writeVariable(VP_E0_Max_Acc_Speed_Dis, E0_Max_Acc_Speed_buf_ch, 16, true); const uint16_t E1_Max_Acc_Speed_buf_ch[] = { 0x3145, 0xEED7, 0xF3B4, 0xD3BC, 0xD9CB, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_E1_Max_Acc_Speed_Dis, E1_Max_Acc_Speed_buf_ch, 16, true); + dgus.writeVariable(VP_E1_Max_Acc_Speed_Dis, E1_Max_Acc_Speed_buf_ch, 16, true); const uint16_t X_PARK_POS_buf_ch[] = { 0x2058, 0xDDD4, 0xA3CD, 0xBBCE, 0xC3D6, 0x2000 }; - dgusdisplay.WriteVariable(VP_X_PARK_POS_Dis, X_PARK_POS_buf_ch, 16, true); + dgus.writeVariable(VP_X_PARK_POS_Dis, X_PARK_POS_buf_ch, 16, true); const uint16_t Y_PARK_POS_buf_ch[] = { 0x2059, 0xDDD4, 0xA3CD, 0xBBCE, 0xC3D6, 0x2000 }; - dgusdisplay.WriteVariable(VP_Y_PARK_POS_Dis, Y_PARK_POS_buf_ch, 16, true); + dgus.writeVariable(VP_Y_PARK_POS_Dis, Y_PARK_POS_buf_ch, 16, true); const uint16_t Z_PARK_POS_buf_ch[] = { 0x205A, 0xDDD4, 0xA3CD, 0xBBCE, 0xC3D6, 0x2000 }; - dgusdisplay.WriteVariable(VP_Z_PARK_POS_Dis, Z_PARK_POS_buf_ch, 16, true); + dgus.writeVariable(VP_Z_PARK_POS_Dis, Z_PARK_POS_buf_ch, 16, true); const uint16_t Length_buf_ch[] = { 0xBDB2, 0xA4B3, 0x2000 }; - dgusdisplay.WriteVariable(VP_Length_Dis, Length_buf_ch, 8, true); + dgus.writeVariable(VP_Length_Dis, Length_buf_ch, 8, true); const uint16_t Speed_buf_ch[] = { 0xD9CB, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_Speed_Dis, Speed_buf_ch, 8, true); + dgus.writeVariable(VP_Speed_Dis, Speed_buf_ch, 8, true); const uint16_t InOut_buf_ch[] = { 0xF8BD, 0xF6B3, 0x2000 }; - dgusdisplay.WriteVariable(VP_InOut_Dis, InOut_buf_ch, 8, true); + dgus.writeVariable(VP_InOut_Dis, InOut_buf_ch, 8, true); const uint16_t PrintTimet_buf_en[] = { 0xF2B4, 0xA1D3, 0xB1CA, 0xE4BC, 0x2000 }; - dgusdisplay.WriteVariable(VP_PrintTime_Dis, PrintTimet_buf_en, 16, true); + dgus.writeVariable(VP_PrintTime_Dis, PrintTimet_buf_en, 16, true); const uint16_t E0_Temp_buf_ch[] = { 0x3045, 0xC2CE, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_E0_Temp_Dis, E0_Temp_buf_ch, 16, true); + dgus.writeVariable(VP_E0_Temp_Dis, E0_Temp_buf_ch, 16, true); const uint16_t E1_Temp_buf_ch[] = { 0x3145, 0xC2CE, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_E1_Temp_Dis, E1_Temp_buf_ch, 16, true); + dgus.writeVariable(VP_E1_Temp_Dis, E1_Temp_buf_ch, 16, true); const uint16_t HB_Temp_buf_ch[] = { 0xC8C8, 0xB2B4, 0xC2CE, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_HB_Temp_Dis, HB_Temp_buf_ch, 16, true); + dgus.writeVariable(VP_HB_Temp_Dis, HB_Temp_buf_ch, 16, true); const uint16_t Feedrate_buf_ch[] = { 0xB7BC, 0xF6B3, 0xD9CB, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_Feedrate_Dis, Feedrate_buf_ch, 16, true); + dgus.writeVariable(VP_Feedrate_Dis, Feedrate_buf_ch, 16, true); const uint16_t PrintAcc_buf_ch[] = { 0xF2B4, 0xA1D3, 0xD9CB, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_PrintAcc_Dis, PrintAcc_buf_ch, 16, true); + dgus.writeVariable(VP_PrintAcc_Dis, PrintAcc_buf_ch, 16, true); const uint16_t FAN_Speed_buf_ch[] = { 0xE7B7, 0xC8C9, 0xD9CB, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_Fan_Speed_Dis, FAN_Speed_buf_ch, 16, true); + dgus.writeVariable(VP_Fan_Speed_Dis, FAN_Speed_buf_ch, 16, true); const uint16_t Printing_buf_ch[] = { 0xF2B4, 0xA1D3, 0xD0D6, 0x2000 }; - dgusdisplay.WriteVariable(VP_Printing_Dis, Printing_buf_ch, 16, true); + dgus.writeVariable(VP_Printing_Dis, Printing_buf_ch, 16, true); const uint16_t Info_EEPROM_1_buf_ch[] = { 0xC7CA, 0xF1B7, 0xA3B1, 0xE6B4, 0xE8C9, 0xC3D6, 0xBFA3, 0x2000 }; - dgusdisplay.WriteVariable(VP_Info_EEPROM_1_Dis, Info_EEPROM_1_buf_ch, 32, true); + dgus.writeVariable(VP_Info_EEPROM_1_Dis, Info_EEPROM_1_buf_ch, 32, true); const uint16_t Info_EEPROM_2_buf_ch[] = { 0xC7CA, 0xF1B7, 0xD6BB, 0xB4B8, 0xF6B3, 0xA7B3, 0xE8C9, 0xC3D6, 0xBFA3, 0x2000 }; - dgusdisplay.WriteVariable(VP_Info_EEPROM_2_Dis, Info_EEPROM_2_buf_ch, 32, true); + dgus.writeVariable(VP_Info_EEPROM_2_Dis, Info_EEPROM_2_buf_ch, 32, true); const uint16_t TMC_X_Step_buf_ch[] = { 0x2058, 0xE9C1, 0xF4C3, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_TMC_X_Step_Dis, TMC_X_Step_buf_ch, 16, true); + dgus.writeVariable(VP_TMC_X_Step_Dis, TMC_X_Step_buf_ch, 16, true); const uint16_t TMC_Y_Step_buf_ch[] = { 0x2059, 0xE9C1, 0xF4C3, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_TMC_Y_Step_Dis, TMC_Y_Step_buf_ch, 16, true); + dgus.writeVariable(VP_TMC_Y_Step_Dis, TMC_Y_Step_buf_ch, 16, true); 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); + dgus.writeVariable(VP_TMC_Z_Step_Dis, TMC_Z_Step_buf_ch, 16, 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); + dgus.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); + dgus.writeVariable(VP_TMC_X_Current_Dis, TMC_X_Current_buf_ch, 16, true); const uint16_t TMC_Y_Current_buf_ch[] = { 0x2059, 0xE1D6, 0xE7B5, 0xF7C1, 0x2000 }; - dgusdisplay.WriteVariable(VP_TMC_Y_Current_Dis, TMC_Y_Current_buf_ch, 16, true); + dgus.writeVariable(VP_TMC_Y_Current_Dis, TMC_Y_Current_buf_ch, 16, true); const uint16_t TMC_Z_Current_buf_ch[] = { 0x205A, 0xE1D6, 0xE7B5, 0xF7C1, 0x2000 }; - dgusdisplay.WriteVariable(VP_TMC_Z_Current_Dis, TMC_Z_Current_buf_ch, 16, true); + dgus.writeVariable(VP_TMC_Z_Current_Dis, TMC_Z_Current_buf_ch, 16, true); const uint16_t TMC_E0_Current_buf_ch[] = { 0x3045, 0xE1D6, 0xE7B5, 0xF7C1, 0x2000 }; - dgusdisplay.WriteVariable(VP_TMC_E0_Current_Dis, TMC_E0_Current_buf_ch, 16, true); + dgus.writeVariable(VP_TMC_E0_Current_Dis, TMC_E0_Current_buf_ch, 16, true); const uint16_t TMC_X1_Current_buf_ch[] = { 0x3158, 0xE1D6, 0xE7B5, 0xF7C1, 0x2000 }; - dgusdisplay.WriteVariable(VP_TMC_X1_Current_Dis, TMC_X1_Current_buf_ch, 16, true); + dgus.writeVariable(VP_TMC_X1_Current_Dis, TMC_X1_Current_buf_ch, 16, true); const uint16_t TMC_Y1_Current_buf_ch[] = { 0x3159, 0xE1D6, 0xE7B5, 0xF7C1, 0x2000 }; - dgusdisplay.WriteVariable(VP_TMC_Y1_Current_Dis, TMC_Y1_Current_buf_ch, 16, true); + dgus.writeVariable(VP_TMC_Y1_Current_Dis, TMC_Y1_Current_buf_ch, 16, true); const uint16_t TMC_Z1_Current_buf_ch[] = { 0x315A, 0xE1D6, 0xE7B5, 0xF7C1, 0x2000 }; - dgusdisplay.WriteVariable(VP_TMC_Z1_Current_Dis, TMC_Z1_Current_buf_ch, 16, true); + dgus.writeVariable(VP_TMC_Z1_Current_Dis, TMC_Z1_Current_buf_ch, 16, true); const uint16_t TMC_E1_Current_buf_ch[] = { 0x3145, 0xE1D6, 0xE7B5, 0xF7C1, 0x2000 }; - dgusdisplay.WriteVariable(VP_TMC_E1_Current_Dis, TMC_E1_Current_buf_ch, 16, true); + dgus.writeVariable(VP_TMC_E1_Current_Dis, TMC_E1_Current_buf_ch, 16, true); const uint16_t Min_Ex_Temp_buf_ch[] = { 0xEED7, 0xA1D0, 0xB7BC, 0xF6B3, 0xC2CE, 0xC8B6, 0x2000 }; - dgusdisplay.WriteVariable(VP_Min_Ex_Temp_Dis, Min_Ex_Temp_buf_ch, 32, true); + dgus.writeVariable(VP_Min_Ex_Temp_Dis, Min_Ex_Temp_buf_ch, 32, true); const uint16_t AutoLEVEL_INFO1_buf_ch[] = { 0xEBC7, 0xB4B0, 0xC2CF, 0xB4B0, 0xA5C5, 0x2000 }; - dgusdisplay.WriteVariable(VP_AutoLEVEL_INFO1, AutoLEVEL_INFO1_buf_ch, 32, true); + dgus.writeVariable(VP_AutoLEVEL_INFO1, AutoLEVEL_INFO1_buf_ch, 32, true); const uint16_t EX_TEMP_INFO2_buf_ch[] = { 0xEBC7, 0xD4C9, 0xC8B5, 0x2000 }; - dgusdisplay.WriteVariable(VP_EX_TEMP_INFO2_Dis, EX_TEMP_INFO2_buf_ch, 32, true); + dgus.writeVariable(VP_EX_TEMP_INFO2_Dis, EX_TEMP_INFO2_buf_ch, 32, true); const uint16_t EX_TEMP_INFO3_buf_ch[] = { 0xA1C8, 0xFBCF, 0xD3BC, 0xC8C8, 0x2000 }; - dgusdisplay.WriteVariable(VP_EX_TEMP_INFO3_Dis, EX_TEMP_INFO3_buf_ch, 32, true); + dgus.writeVariable(VP_EX_TEMP_INFO3_Dis, EX_TEMP_INFO3_buf_ch, 32, true); const uint16_t PrintConfrim_Info_buf_ch[] = { 0xC7CA, 0xF1B7, 0xAABF, 0xBCCA, 0xF2B4, 0xA1D3, 0x2000 }; - dgusdisplay.WriteVariable(VP_PrintConfrim_Info_Dis, PrintConfrim_Info_buf_ch, 32, true); + dgus.writeVariable(VP_PrintConfrim_Info_Dis, PrintConfrim_Info_buf_ch, 32, true); const uint16_t StopPrintConfrim_Info_buf_ch[] = { 0xC7CA, 0xF1B7, 0xA3CD, 0xB9D6, 0xF2B4, 0xA1D3, 0x2000 }; - dgusdisplay.WriteVariable(VP_StopPrintConfrim_Info_Dis, StopPrintConfrim_Info_buf_ch, 32, true); + dgus.writeVariable(VP_StopPrintConfrim_Info_Dis, StopPrintConfrim_Info_buf_ch, 32, true); const uint16_t Printting_buf_ch[] = { 0xF2B4, 0xA1D3, 0xD0D6, 0x2000 }; - dgusdisplay.WriteVariable(VP_Printting_Dis, Printting_buf_ch, 32, true); + dgus.writeVariable(VP_Printting_Dis, Printting_buf_ch, 32, true); const uint16_t LCD_BLK_buf_ch[] = { 0xB3B1, 0xE2B9, 0xE8C9, 0xC3D6, 0x2000 }; - dgusdisplay.WriteVariable(VP_LCD_BLK_Dis, LCD_BLK_buf_ch, 32, true); + dgus.writeVariable(VP_LCD_BLK_Dis, LCD_BLK_buf_ch, 32, true); } } diff --git a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.h b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.h index 69ded29ffbc73..9527badb5a798 100644 --- a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.h +++ b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.h @@ -23,7 +23,7 @@ #include "../DGUSScreenHandlerBase.h" -enum DGUSLCD_Screens : uint8_t; +enum DGUS_ScreenID : uint8_t; class DGUSScreenHandlerMKS : public DGUSScreenHandler { public: @@ -32,72 +32,72 @@ class DGUSScreenHandlerMKS : public DGUSScreenHandler { #if 0 static void sendinfoscreen_ch(const uint16_t *line1, const uint16_t *line2, const uint16_t *line3, const uint16_t *line4); static void sendinfoscreen_en(PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4); - static void sendinfoscreen(const void *line1, const void *line2, const void *line3, const void *line4, uint16_t language); + static void sendInfoScreen(const void *line1, const void *line2, const void *line3, const void *line4, uint16_t language); #endif - static void ScreenBackChange(DGUS_VP_Variable &var, void *val_ptr); - - static void EEPROM_CTRL(DGUS_VP_Variable &var, void *val_ptr); - static void LanguageChange(DGUS_VP_Variable &var, void *val_ptr); - static void GetOffsetValue(DGUS_VP_Variable &var, void *val_ptr); - static void Level_Ctrl(DGUS_VP_Variable &var, void *val_ptr); - static void MeshLevel(DGUS_VP_Variable &var, void *val_ptr); - static void MeshLevelDistanceConfig(DGUS_VP_Variable &var, void *val_ptr); - static void ManualAssistLeveling(DGUS_VP_Variable &var, void *val_ptr); - static void ZoffsetConfirm(DGUS_VP_Variable &var, void *val_ptr); - static void Z_offset_select(DGUS_VP_Variable &var, void *val_ptr); - static void GetManualMovestep(DGUS_VP_Variable &var, void *val_ptr); - static void GetZoffsetDistance(DGUS_VP_Variable &var, void *val_ptr); - static void GetMinExtrudeTemp(DGUS_VP_Variable &var, void *val_ptr); - static void GetParkPos(DGUS_VP_Variable &var, void *val_ptr); + static void screenBackChange(DGUS_VP_Variable &var, void *val_ptr); + + static void eepromControl(DGUS_VP_Variable &var, void *val_ptr); + static void languageChange(DGUS_VP_Variable &var, void *val_ptr); + static void getOffsetValue(DGUS_VP_Variable &var, void *val_ptr); + static void levelControl(DGUS_VP_Variable &var, void *val_ptr); + static void meshLevel(DGUS_VP_Variable &var, void *val_ptr); + static void meshLevelDistanceConfig(DGUS_VP_Variable &var, void *val_ptr); + static void manualAssistLeveling(DGUS_VP_Variable &var, void *val_ptr); + static void zOffsetConfirm(DGUS_VP_Variable &var, void *val_ptr); + static void zOffsetSelect(DGUS_VP_Variable &var, void *val_ptr); + static void getManualMovestep(DGUS_VP_Variable &var, void *val_ptr); + static void getZoffsetDistance(DGUS_VP_Variable &var, void *val_ptr); + static void getMinExtrudeTemp(DGUS_VP_Variable &var, void *val_ptr); + static void getParkPos(DGUS_VP_Variable &var, void *val_ptr); #if ENABLED(PREVENT_COLD_EXTRUSION) - static void HandleGetExMinTemp(DGUS_VP_Variable &var, void *val_ptr); + static void handleGetExMinTemp(DGUS_VP_Variable &var, void *val_ptr); #endif - static void DGUS_LanguageDisplay(uint8_t var); - static void TMC_ChangeConfig(DGUS_VP_Variable &var, void *val_ptr); - static void GetTurnOffCtrl(DGUS_VP_Variable &var, void *val_ptr); - static void LanguagePInit(); - static void DGUS_Runout_Idle(); - static void DGUS_RunoutInit(); - static void DGUS_ExtrudeLoadInit(); - static void LCD_BLK_Adjust(DGUS_VP_Variable &var, void *val_ptr); - static void SD_FileBack(DGUS_VP_Variable &var, void *val_ptr); - - static void HandleStepPerMMChanged(DGUS_VP_Variable &var, void *val_ptr); - static void HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, void *val_ptr); - static void HandleMaxSpeedChange(DGUS_VP_Variable &var, void *val_ptr); - static void HandleExtruderMaxSpeedChange(DGUS_VP_Variable &var, void *val_ptr); - static void HandleAccChange(DGUS_VP_Variable &var, void *val_ptr); - static void HandleMaxAccChange(DGUS_VP_Variable &var, void *val_ptr); - static void HandleExtruderAccChange(DGUS_VP_Variable &var, void *val_ptr); - static void HandleChangeLevelPoint(DGUS_VP_Variable &var, void *val_ptr); - static void HandleTravelAccChange(DGUS_VP_Variable &var, void *val_ptr); - static void HandleFeedRateMinChange(DGUS_VP_Variable &var, void *val_ptr); - static void HandleMin_T_F(DGUS_VP_Variable &var, void *val_ptr); + static void languageDisplay(uint8_t var); + static void tmcChangeConfig(DGUS_VP_Variable &var, void *val_ptr); + static void getTurnOffCtrl(DGUS_VP_Variable &var, void *val_ptr); + static void languagePInit(); + static void runoutIdle(); + static void runoutInit(); + static void extrudeLoadInit(); + static void lcdBLKAdjust(DGUS_VP_Variable &var, void *val_ptr); + static void sdFileBack(DGUS_VP_Variable &var, void *val_ptr); + + static void handleStepPerMMChanged(DGUS_VP_Variable &var, void *val_ptr); + static void handleStepPerMMExtruderChanged(DGUS_VP_Variable &var, void *val_ptr); + static void handleMaxSpeedChange(DGUS_VP_Variable &var, void *val_ptr); + static void handleExtruderMaxSpeedChange(DGUS_VP_Variable &var, void *val_ptr); + static void handleAccChange(DGUS_VP_Variable &var, void *val_ptr); + static void handleMaxAccChange(DGUS_VP_Variable &var, void *val_ptr); + static void handleExtruderAccChange(DGUS_VP_Variable &var, void *val_ptr); + static void handleChangeLevelPoint(DGUS_VP_Variable &var, void *val_ptr); + static void handleTravelAccChange(DGUS_VP_Variable &var, void *val_ptr); + static void handleFeedRateMinChange(DGUS_VP_Variable &var, void *val_ptr); + static void handleMin_T_F(DGUS_VP_Variable &var, void *val_ptr); #if HAS_PID_HEATING - static void FilamentLoadUnload(DGUS_VP_Variable &var, void *val_ptr, const int filamentDir); - static void FilamentLoad(DGUS_VP_Variable &var, void *val_ptr); - static void FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr); - static void GetManualFilament(DGUS_VP_Variable &var, void *val_ptr); - static void GetManualFilamentSpeed(DGUS_VP_Variable &var, void *val_ptr); + static void filamentLoadUnload(DGUS_VP_Variable &var, void *val_ptr, const int filamentDir); + static void filamentLoad(DGUS_VP_Variable &var, void *val_ptr); + static void filamentUnload(DGUS_VP_Variable &var, void *val_ptr); + static void getManualFilament(DGUS_VP_Variable &var, void *val_ptr); + static void getManualFilamentSpeed(DGUS_VP_Variable &var, void *val_ptr); #endif #if HAS_MEDIA // Marlin informed us about SD print completion. - static void SDPrintingFinished(); + static void sdPrintingFinished(); #else - static void PrintReturn(DGUS_VP_Variable &var, void *val_ptr); + static void printReturn(DGUS_VP_Variable &var, void *val_ptr); #endif - static void DGUSLCD_SendPrintTimeToDisplay(DGUS_VP_Variable &var); - static void DGUSLCD_SendBabyStepToDisplay(DGUS_VP_Variable &var); - static void DGUSLCD_SendFanToDisplay(DGUS_VP_Variable &var); - static void DGUSLCD_SendGbkToDisplay(DGUS_VP_Variable &var); - static void DGUSLCD_SendStringToDisplay_Language(DGUS_VP_Variable &var); - static void DGUSLCD_SendTMCStepValue(DGUS_VP_Variable &var); + static void sendPrintTimeToDisplay(DGUS_VP_Variable &var); + static void sendBabyStepToDisplay(DGUS_VP_Variable &var); + static void sendFanToDisplay(DGUS_VP_Variable &var); + static void sendGbkToDisplay(DGUS_VP_Variable &var); + static void sendStringToDisplay_Language(DGUS_VP_Variable &var); + static void sendTMCStepValue(DGUS_VP_Variable &var); - static void DGUSLCD_SetUint8(DGUS_VP_Variable &var, void *val_ptr); + static void setUint8(DGUS_VP_Variable &var, void *val_ptr); static bool loop(); }; diff --git a/Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.cpp b/Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.cpp index c5711320ec184..d69041ebc5e0b 100644 --- a/Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.cpp +++ b/Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.cpp @@ -108,17 +108,17 @@ const uint16_t VPList_SDFileList[] PROGMEM = { VP_SD_FileName0, VP_SD_ const uint16_t VPList_SD_PrintManipulation[] PROGMEM = { VP_PrintProgress_Percentage, VP_PrintTime, 0x0000 }; const struct VPMapping VPMap[] PROGMEM = { - { DGUSLCD_SCREEN_BOOT, VPList_Boot }, - { DGUSLCD_SCREEN_MAIN, VPList_Main }, - { DGUSLCD_SCREEN_TEMPERATURE, VPList_Temp }, - { DGUSLCD_SCREEN_STATUS, VPList_Status }, - { DGUSLCD_SCREEN_STATUS2, VPList_Status2 }, - { DGUSLCD_SCREEN_MANUALMOVE, VPList_ManualMove }, - { DGUSLCD_SCREEN_MANUALEXTRUDE, VPList_ManualExtrude }, - { DGUSLCD_SCREEN_FANANDFEEDRATE, VPList_FanAndFeedrate }, - { DGUSLCD_SCREEN_FLOWRATES, VPList_SD_FlowRates }, - { DGUSLCD_SCREEN_SDPRINTMANIPULATION, VPList_SD_PrintManipulation }, - { DGUSLCD_SCREEN_SDFILELIST, VPList_SDFileList }, + { DGUS_SCREEN_BOOT, VPList_Boot }, + { DGUS_SCREEN_MAIN, VPList_Main }, + { DGUS_SCREEN_TEMPERATURE, VPList_Temp }, + { DGUS_SCREEN_STATUS, VPList_Status }, + { DGUS_SCREEN_STATUS2, VPList_Status2 }, + { DGUS_SCREEN_MANUALMOVE, VPList_ManualMove }, + { DGUS_SCREEN_MANUALEXTRUDE, VPList_ManualExtrude }, + { DGUS_SCREEN_FANANDFEEDRATE, VPList_FanAndFeedrate }, + { DGUS_SCREEN_FLOWRATES, VPList_SD_FlowRates }, + { DGUS_SCREEN_SDPRINTMANIPULATION, VPList_SD_PrintManipulation }, + { DGUS_SCREEN_SDFILELIST, VPList_SDFileList }, { 0 , nullptr } // List is terminated with an nullptr as table entry. }; @@ -126,152 +126,152 @@ const char MarlinVersion[] PROGMEM = SHORT_BUILD_VERSION; const struct DGUS_VP_Variable ListOfVP[] PROGMEM = { // Helper to detect touch events - VPHELPER(VP_SCREENCHANGE, nullptr, ScreenHandler.ScreenChangeHook, nullptr), - VPHELPER(VP_SCREENCHANGE_ASK, nullptr, ScreenHandler.ScreenChangeHookIfIdle, nullptr), + VPHELPER(VP_SCREENCHANGE, nullptr, screen.screenChangeHook, nullptr), + VPHELPER(VP_SCREENCHANGE_ASK, nullptr, screen.screenChangeHookIfIdle, nullptr), #if HAS_MEDIA - VPHELPER(VP_SCREENCHANGE_WHENSD, nullptr, ScreenHandler.ScreenChangeHookIfSD, nullptr), + VPHELPER(VP_SCREENCHANGE_WHENSD, nullptr, screen.screenChangeHookIfSD, nullptr), #endif - VPHELPER(VP_CONFIRMED, nullptr, ScreenHandler.ScreenConfirmedOK, nullptr), + VPHELPER(VP_CONFIRMED, nullptr, screen.screenConfirmedOK, nullptr), - VPHELPER(VP_TEMP_ALL_OFF, nullptr, ScreenHandler.HandleAllHeatersOff, nullptr), + VPHELPER(VP_TEMP_ALL_OFF, nullptr, screen.handleAllHeatersOff, nullptr), #if ENABLED(DGUS_UI_MOVE_DIS_OPTION) - VPHELPER(VP_MOVE_OPTION, &distanceToMove, ScreenHandler.HandleManualMoveOption, nullptr), + VPHELPER(VP_MOVE_OPTION, &distanceToMove, screen.handleManualMoveOption, nullptr), #endif #if ENABLED(DGUS_UI_MOVE_DIS_OPTION) - VPHELPER(VP_MOVE_X, &distanceToMove, ScreenHandler.HandleManualMove, nullptr), - VPHELPER(VP_MOVE_Y, &distanceToMove, ScreenHandler.HandleManualMove, nullptr), - VPHELPER(VP_MOVE_Z, &distanceToMove, ScreenHandler.HandleManualMove, nullptr), - VPHELPER(VP_HOME_ALL, &distanceToMove, ScreenHandler.HandleManualMove, nullptr), + VPHELPER(VP_MOVE_X, &distanceToMove, screen.handleManualMove, nullptr), + VPHELPER(VP_MOVE_Y, &distanceToMove, screen.handleManualMove, nullptr), + VPHELPER(VP_MOVE_Z, &distanceToMove, screen.handleManualMove, nullptr), + VPHELPER(VP_HOME_ALL, &distanceToMove, screen.handleManualMove, nullptr), #else - VPHELPER(VP_MOVE_X, nullptr, ScreenHandler.HandleManualMove, nullptr), - VPHELPER(VP_MOVE_Y, nullptr, ScreenHandler.HandleManualMove, nullptr), - VPHELPER(VP_MOVE_Z, nullptr, ScreenHandler.HandleManualMove, nullptr), - VPHELPER(VP_HOME_ALL, nullptr, ScreenHandler.HandleManualMove, nullptr), + VPHELPER(VP_MOVE_X, nullptr, screen.handleManualMove, nullptr), + VPHELPER(VP_MOVE_Y, nullptr, screen.handleManualMove, nullptr), + VPHELPER(VP_MOVE_Z, nullptr, screen.handleManualMove, nullptr), + VPHELPER(VP_HOME_ALL, nullptr, screen.handleManualMove, nullptr), #endif - VPHELPER(VP_MOTOR_LOCK_UNLOK, nullptr, ScreenHandler.HandleMotorLockUnlock, nullptr), + VPHELPER(VP_MOTOR_LOCK_UNLOK, nullptr, screen.handleMotorLockUnlock, nullptr), #if ENABLED(POWER_LOSS_RECOVERY) - VPHELPER(VP_POWER_LOSS_RECOVERY, nullptr, ScreenHandler.HandlePowerLossRecovery, nullptr), + VPHELPER(VP_POWER_LOSS_RECOVERY, nullptr, screen.handlePowerLossRecovery, nullptr), #endif - VPHELPER(VP_SETTINGS, nullptr, ScreenHandler.HandleSettings, nullptr), + VPHELPER(VP_SETTINGS, nullptr, screen.handleSettings, nullptr), - { .VP = VP_MARLIN_VERSION, .memadr = (void*)MarlinVersion, .size = VP_MARLIN_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM }, + { .VP = VP_MARLIN_VERSION, .memadr = (void*)MarlinVersion, .size = VP_MARLIN_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM }, // M117 LCD String (We don't need the string in memory but "just" push it to the display on demand, hence the nullptr - { .VP = VP_M117, .memadr = nullptr, .size = VP_M117_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplay }, + { .VP = VP_M117, .memadr = nullptr, .size = VP_M117_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplay }, // Temperature Data #if HAS_HOTEND - VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>), - VPHELPER(VP_T_E0_Set, &thermalManager.temp_hotend[0].target, ScreenHandler.HandleTemperatureChanged, &ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_Flowrate_E0, nullptr, ScreenHandler.HandleFlowRateChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_EPos, &destination.e, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>), - VPHELPER(VP_MOVE_E0, nullptr, ScreenHandler.HandleManualExtrude, nullptr), - VPHELPER(VP_E0_CONTROL, &thermalManager.temp_hotend[0].target, ScreenHandler.HandleHeaterControl, nullptr), - VPHELPER(VP_E0_STATUS, &thermalManager.temp_hotend[0].target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay), + VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, screen.sendFloatAsLongValueToDisplay<0>), + VPHELPER(VP_T_E0_Set, &thermalManager.temp_hotend[0].target, screen.handleTemperatureChanged, &screen.sendWordValueToDisplay), + VPHELPER(VP_Flowrate_E0, nullptr, screen.handleFlowRateChanged, screen.sendWordValueToDisplay), + VPHELPER(VP_EPos, &destination.e, nullptr, screen.sendFloatAsLongValueToDisplay<2>), + VPHELPER(VP_MOVE_E0, nullptr, screen.handleManualExtrude, nullptr), + VPHELPER(VP_E0_CONTROL, &thermalManager.temp_hotend[0].target, screen.handleHeaterControl, nullptr), + VPHELPER(VP_E0_STATUS, &thermalManager.temp_hotend[0].target, nullptr, screen.sendHeaterStatusToDisplay), #if ENABLED(DGUS_PREHEAT_UI) - VPHELPER(VP_E0_BED_PREHEAT, nullptr, ScreenHandler.HandlePreheat, nullptr), + VPHELPER(VP_E0_BED_PREHEAT, nullptr, screen.handlePreheat, nullptr), #endif #if ENABLED(PIDTEMP) - VPHELPER(VP_E0_PID_P, &thermalManager.temp_hotend[0].pid.Kp, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID), - VPHELPER(VP_E0_PID_I, &thermalManager.temp_hotend[0].pid.Ki, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID), - VPHELPER(VP_E0_PID_D, &thermalManager.temp_hotend[0].pid.Kd, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID), - VPHELPER(VP_PID_AUTOTUNE_E0, nullptr, ScreenHandler.HandlePIDAutotune, nullptr), + VPHELPER(VP_E0_PID_P, &thermalManager.temp_hotend[0].pid.Kp, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID), + VPHELPER(VP_E0_PID_I, &thermalManager.temp_hotend[0].pid.Ki, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID), + VPHELPER(VP_E0_PID_D, &thermalManager.temp_hotend[0].pid.Kd, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID), + VPHELPER(VP_PID_AUTOTUNE_E0, nullptr, screen.handlePIDAutotune, nullptr), #endif #if ENABLED(DGUS_FILAMENT_LOADUNLOAD) - VPHELPER(VP_E0_FILAMENT_LOAD_UNLOAD, nullptr, ScreenHandler.HandleFilamentOption, ScreenHandler.HandleFilamentLoadUnload), + VPHELPER(VP_E0_FILAMENT_LOAD_UNLOAD, nullptr, screen.handleFilamentOption, screen.handleFilamentLoadUnload), #endif #endif #if HAS_MULTI_HOTEND - VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>), - VPHELPER(VP_T_E1_Set, &thermalManager.temp_hotend[1].target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_Flowrate_E1, nullptr, ScreenHandler.HandleFlowRateChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_MOVE_E1, nullptr, ScreenHandler.HandleManualExtrude, nullptr), - VPHELPER(VP_E1_CONTROL, &thermalManager.temp_hotend[1].target, ScreenHandler.HandleHeaterControl, nullptr), - VPHELPER(VP_E1_STATUS, &thermalManager.temp_hotend[1].target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay), + VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, screen.sendFloatAsLongValueToDisplay<0>), + VPHELPER(VP_T_E1_Set, &thermalManager.temp_hotend[1].target, screen.handleTemperatureChanged, screen.sendWordValueToDisplay), + VPHELPER(VP_Flowrate_E1, nullptr, screen.handleFlowRateChanged, screen.sendWordValueToDisplay), + VPHELPER(VP_MOVE_E1, nullptr, screen.handleManualExtrude, nullptr), + VPHELPER(VP_E1_CONTROL, &thermalManager.temp_hotend[1].target, screen.handleHeaterControl, nullptr), + VPHELPER(VP_E1_STATUS, &thermalManager.temp_hotend[1].target, nullptr, screen.sendHeaterStatusToDisplay), #if ENABLED(PIDTEMP) - VPHELPER(VP_PID_AUTOTUNE_E1, nullptr, ScreenHandler.HandlePIDAutotune, nullptr), + VPHELPER(VP_PID_AUTOTUNE_E1, nullptr, screen.handlePIDAutotune, nullptr), #endif #endif #if HAS_HEATED_BED - VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>), - VPHELPER(VP_T_Bed_Set, &thermalManager.temp_bed.target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - VPHELPER(VP_BED_CONTROL, &thermalManager.temp_bed.target, ScreenHandler.HandleHeaterControl, nullptr), - VPHELPER(VP_BED_STATUS, &thermalManager.temp_bed.target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay), + VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.celsius, nullptr, screen.sendFloatAsLongValueToDisplay<0>), + VPHELPER(VP_T_Bed_Set, &thermalManager.temp_bed.target, screen.handleTemperatureChanged, screen.sendWordValueToDisplay), + VPHELPER(VP_BED_CONTROL, &thermalManager.temp_bed.target, screen.handleHeaterControl, nullptr), + VPHELPER(VP_BED_STATUS, &thermalManager.temp_bed.target, nullptr, screen.sendHeaterStatusToDisplay), #if ENABLED(PIDTEMPBED) - VPHELPER(VP_BED_PID_P, &thermalManager.temp_bed.pid.Kp, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID), - VPHELPER(VP_BED_PID_I, &thermalManager.temp_bed.pid.Ki, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID), - VPHELPER(VP_BED_PID_D, &thermalManager.temp_bed.pid.Kd, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID), + VPHELPER(VP_BED_PID_P, &thermalManager.temp_bed.pid.Kp, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID), + VPHELPER(VP_BED_PID_I, &thermalManager.temp_bed.pid.Ki, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID), + VPHELPER(VP_BED_PID_D, &thermalManager.temp_bed.pid.Kd, screen.handleTemperaturePIDChanged, screen.sendTemperaturePID), #endif #endif // Fan Data #if HAS_FAN #define FAN_VPHELPER(N) \ - VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], ScreenHandler.DGUSLCD_PercentageToUint8, ScreenHandler.DGUSLCD_SendPercentageToDisplay), \ - VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], ScreenHandler.HandleFanControl, nullptr), \ - VPHELPER(VP_FAN##N##_STATUS, &thermalManager.fan_speed[N], nullptr, ScreenHandler.DGUSLCD_SendFanStatusToDisplay), + VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], screen.percentageToUint8, screen.sendPercentageToDisplay), \ + VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], screen.handleFanControl, nullptr), \ + VPHELPER(VP_FAN##N##_STATUS, &thermalManager.fan_speed[N], nullptr, screen.sendFanStatusToDisplay), REPEAT(FAN_COUNT, FAN_VPHELPER) #endif // Feedrate - VPHELPER(VP_Feedrate_Percentage, &feedrate_percentage, ScreenHandler.DGUSLCD_SetValueDirectly, ScreenHandler.DGUSLCD_SendWordValueToDisplay), + VPHELPER(VP_Feedrate_Percentage, &feedrate_percentage, screen.setValueDirectly, screen.sendWordValueToDisplay), // Position Data - VPHELPER(VP_XPos, ¤t_position.x, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>), - VPHELPER(VP_YPos, ¤t_position.y, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>), - VPHELPER(VP_ZPos, ¤t_position.z, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>), + VPHELPER(VP_XPos, ¤t_position.x, nullptr, screen.sendFloatAsLongValueToDisplay<2>), + VPHELPER(VP_YPos, ¤t_position.y, nullptr, screen.sendFloatAsLongValueToDisplay<2>), + VPHELPER(VP_ZPos, ¤t_position.z, nullptr, screen.sendFloatAsLongValueToDisplay<2>), // Print Progress - VPHELPER(VP_PrintProgress_Percentage, nullptr, nullptr, ScreenHandler.DGUSLCD_SendPrintProgressToDisplay), + VPHELPER(VP_PrintProgress_Percentage, nullptr, nullptr, screen.sendPrintProgressToDisplay), // Print Time - VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintTimeToDisplay), + VPHELPER_STR(VP_PrintTime, nullptr, VP_PrintTime_LEN, nullptr, screen.sendPrintTimeToDisplay), #if ENABLED(PRINTCOUNTER) - VPHELPER_STR(VP_PrintAccTime, nullptr, VP_PrintAccTime_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintAccTimeToDisplay), - VPHELPER_STR(VP_PrintsTotal, nullptr, VP_PrintsTotal_LEN, nullptr, ScreenHandler.DGUSLCD_SendPrintsTotalToDisplay), + VPHELPER_STR(VP_PrintAccTime, nullptr, VP_PrintAccTime_LEN, nullptr, screen.sendPrintAccTimeToDisplay), + VPHELPER_STR(VP_PrintsTotal, nullptr, VP_PrintsTotal_LEN, nullptr, screen.sendPrintsTotalToDisplay), #endif - VPHELPER(VP_X_STEP_PER_MM, &planner.settings.axis_steps_per_mm[X_AXIS], ScreenHandler.HandleStepPerMMChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>), - VPHELPER(VP_Y_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Y_AXIS], ScreenHandler.HandleStepPerMMChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>), - VPHELPER(VP_Z_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Z_AXIS], ScreenHandler.HandleStepPerMMChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>), + VPHELPER(VP_X_STEP_PER_MM, &planner.settings.axis_steps_per_mm[X_AXIS], screen.handleStepPerMMChanged, screen.sendFloatAsIntValueToDisplay<1>), + VPHELPER(VP_Y_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Y_AXIS], screen.handleStepPerMMChanged, screen.sendFloatAsIntValueToDisplay<1>), + VPHELPER(VP_Z_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Z_AXIS], screen.handleStepPerMMChanged, screen.sendFloatAsIntValueToDisplay<1>), #if HAS_HOTEND - VPHELPER(VP_E0_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(0)], ScreenHandler.HandleStepPerMMExtruderChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>), + VPHELPER(VP_E0_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(0)], screen.handleStepPerMMExtruderChanged, screen.sendFloatAsIntValueToDisplay<1>), #if HAS_MULTI_HOTEND - VPHELPER(VP_E1_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(1)], ScreenHandler.HandleStepPerMMExtruderChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>), + VPHELPER(VP_E1_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(1)], screen.handleStepPerMMExtruderChanged, screen.sendFloatAsIntValueToDisplay<1>), #endif #endif // SDCard File listing. #if HAS_MEDIA - VPHELPER(VP_SD_ScrollEvent, nullptr, ScreenHandler.DGUSLCD_SD_ScrollFilelist, nullptr), - VPHELPER(VP_SD_FileSelected, nullptr, ScreenHandler.DGUSLCD_SD_FileSelected, nullptr), - VPHELPER(VP_SD_FileSelectConfirm, nullptr, ScreenHandler.DGUSLCD_SD_StartPrint, nullptr), - VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename), - VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename), - VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename), - VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename), - VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename), - VPHELPER(VP_SD_ResumePauseAbort, nullptr, ScreenHandler.DGUSLCD_SD_ResumePauseAbort, nullptr), - VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, ScreenHandler.DGUSLCD_SD_ReallyAbort, nullptr), - VPHELPER(VP_SD_Print_Setting, nullptr, ScreenHandler.DGUSLCD_SD_PrintTune, nullptr), + VPHELPER(VP_SD_ScrollEvent, nullptr, screen.sdScrollFilelist, nullptr), + VPHELPER(VP_SD_FileSelected, nullptr, screen.sdFileSelected, nullptr), + VPHELPER(VP_SD_FileSelectConfirm, nullptr, screen.sdStartPrint, nullptr), + VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename), + VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename), + VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename), + VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename), + VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, screen.sdSendFilename), + VPHELPER(VP_SD_ResumePauseAbort, nullptr, screen.sdResumePauseAbort, nullptr), + VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, screen.sdReallyAbort, nullptr), + VPHELPER(VP_SD_Print_Setting, nullptr, screen.sdPrintTune, nullptr), #if HAS_BED_PROBE - VPHELPER(VP_SD_Print_ProbeOffsetZ, &probe.offset.z, ScreenHandler.HandleProbeOffsetZChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<2>), + VPHELPER(VP_SD_Print_ProbeOffsetZ, &probe.offset.z, screen.handleProbeOffsetZChanged, screen.sendFloatAsIntValueToDisplay<2>), #if ENABLED(BABYSTEPPING) - VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, ScreenHandler.HandleLiveAdjustZ, nullptr), + VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, screen.handleLiveAdjustZ, nullptr), #endif #endif #endif #if ENABLED(DGUS_UI_WAITING) - VPHELPER(VP_WAITING_STATUS, nullptr, nullptr, ScreenHandler.DGUSLCD_SendWaitingStatusToDisplay), + VPHELPER(VP_WAITING_STATUS, nullptr, nullptr, screen.sendWaitingStatusToDisplay), #endif // Messages for the User, shared by the popup and the kill screen. They can't be autouploaded as we do not buffer content. - { .VP = VP_MSGSTR1, .memadr = nullptr, .size = VP_MSGSTR1_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM }, - { .VP = VP_MSGSTR2, .memadr = nullptr, .size = VP_MSGSTR2_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM }, - { .VP = VP_MSGSTR3, .memadr = nullptr, .size = VP_MSGSTR3_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM }, - { .VP = VP_MSGSTR4, .memadr = nullptr, .size = VP_MSGSTR4_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = ScreenHandler.DGUSLCD_SendStringToDisplayPGM }, + { .VP = VP_MSGSTR1, .memadr = nullptr, .size = VP_MSGSTR1_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM }, + { .VP = VP_MSGSTR2, .memadr = nullptr, .size = VP_MSGSTR2_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM }, + { .VP = VP_MSGSTR3, .memadr = nullptr, .size = VP_MSGSTR3_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM }, + { .VP = VP_MSGSTR4, .memadr = nullptr, .size = VP_MSGSTR4_LEN, .set_by_display_handler = nullptr, .send_to_display_handler = screen.sendStringToDisplayPGM }, VPHELPER(0, 0, 0, 0) // must be last entry. }; diff --git a/Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.h b/Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.h index d529b0adfe60f..e601abd25518e 100644 --- a/Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.h +++ b/Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.h @@ -23,30 +23,30 @@ #include "../DGUSDisplayDef.h" -enum DGUSLCD_Screens : uint8_t { - DGUSLCD_SCREEN_BOOT = 0, - DGUSLCD_SCREEN_MAIN = 10, - DGUSLCD_SCREEN_TEMPERATURE = 20, - DGUSLCD_SCREEN_STATUS = 30, - DGUSLCD_SCREEN_STATUS2 = 32, - DGUSLCD_SCREEN_MANUALMOVE = 40, - DGUSLCD_SCREEN_MANUALEXTRUDE = 42, - DGUSLCD_SCREEN_FANANDFEEDRATE = 44, - DGUSLCD_SCREEN_FLOWRATES = 46, - DGUSLCD_SCREEN_SDFILELIST = 50, - DGUSLCD_SCREEN_SDPRINTMANIPULATION = 52, - DGUSLCD_SCREEN_POWER_LOSS = 100, - DGUSLCD_SCREEN_PREHEAT = 120, - DGUSLCD_SCREEN_UTILITY = 110, - DGUSLCD_SCREEN_FILAMENT_HEATING = 146, - DGUSLCD_SCREEN_FILAMENT_LOADING = 148, - DGUSLCD_SCREEN_FILAMENT_UNLOADING = 158, - DGUSLCD_SCREEN_SDPRINTTUNE = 170, - DGUSLCD_SCREEN_CONFIRM = 240, - DGUSLCD_SCREEN_KILL = 250, ///< Kill Screen. Must always be 250 (to be able to display "Error wrong LCD Version") - DGUSLCD_SCREEN_WAITING = 251, - DGUSLCD_SCREEN_POPUP = 252, ///< special target, popup screen will also return this code to say "return to previous screen" - DGUSLCD_SCREEN_UNUSED = 255 +enum DGUS_ScreenID : uint8_t { + DGUS_SCREEN_BOOT = 0, + DGUS_SCREEN_MAIN = 10, + DGUS_SCREEN_TEMPERATURE = 20, + DGUS_SCREEN_STATUS = 30, + DGUS_SCREEN_STATUS2 = 32, + DGUS_SCREEN_MANUALMOVE = 40, + DGUS_SCREEN_MANUALEXTRUDE = 42, + DGUS_SCREEN_FANANDFEEDRATE = 44, + DGUS_SCREEN_FLOWRATES = 46, + DGUS_SCREEN_SDFILELIST = 50, + DGUS_SCREEN_SDPRINTMANIPULATION = 52, + DGUS_SCREEN_POWER_LOSS = 100, + DGUS_SCREEN_PREHEAT = 120, + DGUS_SCREEN_UTILITY = 110, + DGUS_SCREEN_FILAMENT_HEATING = 146, + DGUS_SCREEN_FILAMENT_LOADING = 148, + DGUS_SCREEN_FILAMENT_UNLOADING = 158, + DGUS_SCREEN_SDPRINTTUNE = 170, + DGUS_SCREEN_CONFIRM = 240, + DGUS_SCREEN_KILL = 250, ///< Kill Screen. Must always be 250 (to be able to display "Error wrong LCD Version") + DGUS_SCREEN_WAITING = 251, + DGUS_SCREEN_POPUP = 252, ///< special target, popup screen will also return this code to say "return to previous screen" + DGUS_SCREEN_UNUSED = 255 }; // Display Memory layout used (T5UID) diff --git a/Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.cpp index 44f4a95cad2ac..943d8c50a55ef 100644 --- a/Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.cpp @@ -44,7 +44,7 @@ extern ExtUI::FileList filelist; - void DGUSScreenHandler::DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::sdFileSelected(DGUS_VP_Variable &var, void *val_ptr) { uint16_t touched_nr = (int16_t)swap16(*(uint16_t*)val_ptr) + top_file; if (touched_nr > filelist.count()) return; if (!filelist.seek(touched_nr)) return; @@ -52,28 +52,28 @@ if (filelist.isDir()) { filelist.changeDir(filelist.filename()); top_file = 0; - ForceCompleteUpdate(); + forceCompleteUpdate(); return; } #if ENABLED(DGUS_PRINT_FILENAME) // Send print filename - dgusdisplay.WriteVariable(VP_SD_Print_Filename, filelist.filename(), VP_SD_FileName_LEN, true); + dgus.writeVariable(VP_SD_Print_Filename, filelist.filename(), VP_SD_FileName_LEN, true); #endif // Setup Confirmation screen file_to_print = touched_nr; - HandleUserConfirmationPopUp(VP_SD_FileSelectConfirm, nullptr, PSTR("Print file"), filelist.filename(), PSTR("from SD Card?"), true, true, false, true); + handleUserConfirmationPopUp(VP_SD_FileSelectConfirm, nullptr, PSTR("Print file"), filelist.filename(), PSTR("from SD Card?"), true, true, false, true); } - void DGUSScreenHandler::DGUSLCD_SD_StartPrint(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::sdStartPrint(DGUS_VP_Variable &var, void *val_ptr) { if (!filelist.seek(file_to_print)) return; ExtUI::printFile(filelist.shortFilename()); - GotoScreen(DGUSLCD_SCREEN_STATUS); + gotoScreen(DGUS_SCREEN_STATUS); } - void DGUSScreenHandler::DGUSLCD_SD_ResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::sdResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr) { if (!ExtUI::isPrintingFromMedia()) return; // avoid race condition when user stays in this menu and printer finishes. switch (swap16(*(uint16_t*)val_ptr)) { @@ -85,19 +85,19 @@ case 1: // Pause - GotoScreen(DGUSLCD_SCREEN_SDPRINTMANIPULATION); + gotoScreen(DGUS_SCREEN_SDPRINTMANIPULATION); if (!ExtUI::isPrintingFromMediaPaused()) { ExtUI::pausePrint(); //ExtUI::mks_pausePrint(); } break; case 2: // Abort - HandleUserConfirmationPopUp(VP_SD_AbortPrintConfirmed, nullptr, PSTR("Abort printing"), filelist.filename(), PSTR("?"), true, true, false, true); + handleUserConfirmationPopUp(VP_SD_AbortPrintConfirmed, nullptr, PSTR("Abort printing"), filelist.filename(), PSTR("?"), true, true, false, true); break; } } - void DGUSScreenHandler::DGUSLCD_SD_SendFilename(DGUS_VP_Variable& var) { + void DGUSScreenHandler::sdSendFilename(DGUS_VP_Variable& var) { uint16_t target_line = (var.VP - VP_SD_FileName0) / VP_SD_FileName_LEN; if (target_line > DGUS_SD_FILESPERSCREEN) return; char tmpfilename[VP_SD_FileName_LEN + 1] = ""; @@ -106,49 +106,49 @@ if (filelist.seek(top_file + target_line)) { snprintf_P(tmpfilename, VP_SD_FileName_LEN, PSTR("%s%c"), filelist.filename(), filelist.isDir() ? '/' : 0); // snprintf_P(tmpfilename, VP_SD_FileName_LEN, PSTR("%s"), filelist.filename()); } - DGUSLCD_SendStringToDisplay(var); + sendStringToDisplay(var); } - void DGUSScreenHandler::SDCardInserted() { + void DGUSScreenHandler::sdCardInserted() { top_file = 0; filelist.refresh(); auto cs = getCurrentScreen(); - if (cs == DGUSLCD_SCREEN_MAIN || cs == DGUSLCD_SCREEN_STATUS) - GotoScreen(DGUSLCD_SCREEN_SDFILELIST); + if (cs == DGUS_SCREEN_MAIN || cs == DGUS_SCREEN_STATUS) + gotoScreen(DGUS_SCREEN_SDFILELIST); } - void DGUSScreenHandler::SDCardRemoved() { - if (current_screen == DGUSLCD_SCREEN_SDFILELIST - || (current_screen == DGUSLCD_SCREEN_CONFIRM && (ConfirmVP == VP_SD_AbortPrintConfirmed || ConfirmVP == VP_SD_FileSelectConfirm)) - || current_screen == DGUSLCD_SCREEN_SDPRINTMANIPULATION - ) GotoScreen(DGUSLCD_SCREEN_MAIN); + void DGUSScreenHandler::sdCardRemoved() { + if (current_screenID == DGUS_SCREEN_SDFILELIST + || (current_screenID == DGUS_SCREEN_CONFIRM && (confirmVP == VP_SD_AbortPrintConfirmed || confirmVP == VP_SD_FileSelectConfirm)) + || current_screenID == DGUS_SCREEN_SDPRINTMANIPULATION + ) gotoScreen(DGUS_SCREEN_MAIN); } #endif // HAS_MEDIA -void DGUSScreenHandler::ScreenChangeHook(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandler::screenChangeHook(DGUS_VP_Variable &var, void *val_ptr) { uint8_t *tmp = (uint8_t*)val_ptr; // The keycode in target is coded as , so 0x0100A means - // from screen 1 (main) to 10 (temperature). DGUSLCD_SCREEN_POPUP is special, + // from screen 1 (main) to 10 (temperature). DGUS_SCREEN_POPUP is special, // meaning "return to previous screen" - DGUSLCD_Screens target = (DGUSLCD_Screens)tmp[1]; + DGUS_ScreenID target = (DGUS_ScreenID)tmp[1]; - if (target == DGUSLCD_SCREEN_POPUP) { + if (target == DGUS_SCREEN_POPUP) { // Special handling for popup is to return to previous menu - if (current_screen == DGUSLCD_SCREEN_POPUP && confirm_action_cb) confirm_action_cb(); - PopToOldScreen(); + if (current_screenID == DGUS_SCREEN_POPUP && confirm_action_cb) confirm_action_cb(); + popToOldScreen(); return; } - UpdateNewScreen(target); + updateNewScreen(target); #ifdef DEBUG_DGUSLCD - if (!DGUSLCD_FindScreenVPMapList(target)) DEBUG_ECHOLNPGM("WARNING: No screen Mapping found for ", target); + if (!findScreenVPMapList(target)) DEBUG_ECHOLNPGM("WARNING: No screen Mapping found for ", target); #endif } -void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { +void DGUSScreenHandler::handleManualMove(DGUS_VP_Variable &var, void *val_ptr) { int16_t movevalue = swap16(*(uint16_t*)val_ptr); #if ENABLED(DGUS_UI_MOVE_DIS_OPTION) if (movevalue) { @@ -196,7 +196,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { char buf[6] = "G28 X"; buf[4] = axiscode; queue.enqueue_one_now(buf); - ForceCompleteUpdate(); + forceCompleteUpdate(); return; } else { @@ -219,14 +219,14 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { if (!old_relative_mode) queue.enqueue_now(F("G90")); } - ForceCompleteUpdate(); + forceCompleteUpdate(); cannotmove: return; } #if HAS_PID_HEATING - void DGUSScreenHandler::HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::handleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr) { uint16_t rawvalue = swap16(*(uint16_t*)val_ptr); float value = (float)rawvalue / 10; float newvalue = 0; @@ -257,17 +257,17 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { #endif // HAS_PID_HEATING #if ENABLED(BABYSTEPPING) - void DGUSScreenHandler::HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::handleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr) { int16_t flag = swap16(*(uint16_t*)val_ptr), steps = flag ? -20 : 20; ExtUI::smartAdjustAxis_steps(steps, ExtUI::axis_t::Z, true); - ForceCompleteUpdate(); + forceCompleteUpdate(); } #endif #if ENABLED(DGUS_FILAMENT_LOADUNLOAD) - void DGUSScreenHandler::HandleFilamentOption(DGUS_VP_Variable &var, void *val_ptr) { + void DGUSScreenHandler::handleFilamentOption(DGUS_VP_Variable &var, void *val_ptr) { uint8_t e_temp = 0; filament_data.heated = false; uint16_t preheat_option = swap16(*(uint16_t*)val_ptr); @@ -315,7 +315,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E1); #endif #endif - GotoScreen(DGUSLCD_SCREEN_UTILITY); + gotoScreen(DGUS_SCREEN_UTILITY); } else { // Go to the preheat screen to show the heating progress switch (var.VP) { @@ -333,11 +333,11 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { break; #endif } - GotoScreen(DGUSLCD_SCREEN_FILAMENT_HEATING); + gotoScreen(DGUS_SCREEN_FILAMENT_HEATING); } } - void DGUSScreenHandler::HandleFilamentLoadUnload(DGUS_VP_Variable &var) { + void DGUSScreenHandler::handleFilamentLoadUnload(DGUS_VP_Variable &var) { if (filament_data.action <= 0) return; // If we close to the target temperature, we can start load or unload the filament @@ -347,14 +347,14 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { if (filament_data.action == 1) { // load filament if (!filament_data.heated) { - //GotoScreen(DGUSLCD_SCREEN_FILAMENT_LOADING); + //gotoScreen(DGUS_SCREEN_FILAMENT_LOADING); filament_data.heated = true; } movevalue = ExtUI::getAxisPosition_mm(filament_data.extruder) + movevalue; } else { // unload filament if (!filament_data.heated) { - GotoScreen(DGUSLCD_SCREEN_FILAMENT_UNLOADING); + gotoScreen(DGUS_SCREEN_FILAMENT_UNLOADING); filament_data.heated = true; } // Before unloading extrude to prevent jamming @@ -372,14 +372,14 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { #endif // DGUS_FILAMENT_LOADUNLOAD bool DGUSScreenHandler::loop() { - dgusdisplay.loop(); + dgus.loop(); const millis_t ms = millis(); static millis_t next_event_ms = 0; - if (!IsScreenComplete() || ELAPSED(ms, next_event_ms)) { + if (!isScreenComplete() || ELAPSED(ms, next_event_ms)) { next_event_ms = ms + DGUS_UPDATE_INTERVAL_MS; - UpdateScreenVPData(); + updateScreenVPData(); } #if ENABLED(SHOW_BOOTSCREEN) @@ -390,11 +390,11 @@ bool DGUSScreenHandler::loop() { if (!booted && ELAPSED(ms, BOOTSCREEN_TIMEOUT)) { booted = true; - GotoScreen(TERN0(POWER_LOSS_RECOVERY, recovery.valid()) ? DGUSLCD_SCREEN_POWER_LOSS : DGUSLCD_SCREEN_MAIN); + gotoScreen(TERN0(POWER_LOSS_RECOVERY, recovery.valid()) ? DGUS_SCREEN_POWER_LOSS : DGUS_SCREEN_MAIN); } #endif - return IsScreenComplete(); + return isScreenComplete(); } #endif // DGUS_LCD_UI_ORIGIN diff --git a/Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.h b/Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.h index 73e3527d7e7c1..16c5dec408d6b 100644 --- a/Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.h +++ b/Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.h @@ -26,6 +26,6 @@ typedef DGUSScreenHandler DGUSScreenHandlerClass; #if ENABLED(POWER_LOSS_RECOVERY) - #define PLR_SCREEN_RECOVER DGUSLCD_SCREEN_SDPRINTMANIPULATION - #define PLR_SCREEN_CANCEL DGUSLCD_SCREEN_STATUS + #define PLR_SCREEN_RECOVER DGUS_SCREEN_SDPRINTMANIPULATION + #define PLR_SCREEN_CANCEL DGUS_SCREEN_STATUS #endif diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.cpp index 7e215f887c5b8..31272681804fb 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.cpp @@ -50,26 +50,26 @@ uint8_t DGUSDisplay::rx_datagram_len = 0; bool DGUSDisplay::initialized = false; -void DGUSDisplay::Loop() { - ProcessRx(); +void DGUSDisplay::loop() { + processRx(); } -void DGUSDisplay::Init() { +void DGUSDisplay::init() { LCD_SERIAL.begin(LCD_BAUDRATE); - ReadVersions(); + readVersions(); } -void DGUSDisplay::Read(uint16_t addr, uint8_t size) { - WriteHeader(addr, DGUS_READVAR, size); +void DGUSDisplay::read(uint16_t addr, uint8_t size) { + writeHeader(addr, DGUS_READVAR, size); LCD_SERIAL.write(size); } -void DGUSDisplay::Write(uint16_t addr, const void* data_ptr, uint8_t size) { +void DGUSDisplay::write(uint16_t addr, const void* data_ptr, uint8_t size) { if (!data_ptr) return; - WriteHeader(addr, DGUS_WRITEVAR, size); + writeHeader(addr, DGUS_WRITEVAR, size); const char* data = static_cast(data_ptr); @@ -78,10 +78,10 @@ void DGUSDisplay::Write(uint16_t addr, const void* data_ptr, uint8_t size) { } } -void DGUSDisplay::WriteString(uint16_t addr, const void* data_ptr, uint8_t size, bool left, bool right, bool use_space) { +void DGUSDisplay::writeString(uint16_t addr, const void* data_ptr, uint8_t size, bool left, bool right, bool use_space) { if (!data_ptr) return; - WriteHeader(addr, DGUS_WRITEVAR, size); + writeHeader(addr, DGUS_WRITEVAR, size); const char* data = static_cast(data_ptr); size_t len = strlen(data); @@ -118,10 +118,10 @@ void DGUSDisplay::WriteString(uint16_t addr, const void* data_ptr, uint8_t size, } } -void DGUSDisplay::WriteStringPGM(uint16_t addr, const void* data_ptr, uint8_t size, bool left, bool right, bool use_space) { +void DGUSDisplay::writeStringPGM(uint16_t addr, const void* data_ptr, uint8_t size, bool left, bool right, bool use_space) { if (!data_ptr) return; - WriteHeader(addr, DGUS_WRITEVAR, size); + writeHeader(addr, DGUS_WRITEVAR, size); const char* data = static_cast(data_ptr); size_t len = strlen_P(data); @@ -151,61 +151,61 @@ void DGUSDisplay::WriteStringPGM(uint16_t addr, const void* data_ptr, uint8_t si while (right_spaces--) LCD_SERIAL.write(use_space ? ' ' : '\0'); } -void DGUSDisplay::ReadVersions() { +void DGUSDisplay::readVersions() { if (gui_version != 0 && os_version != 0) return; - Read(DGUS_VERSION, 1); + read(DGUS_VERSION, 1); } -void DGUSDisplay::SwitchScreen(DGUS_Screen screen) { - const uint8_t command[] = { 0x5A, 0x01, 0x00, (uint8_t)screen }; - Write(0x84, command, sizeof(command)); +void DGUSDisplay::switchScreen(const DGUS_ScreenID screenID) { + const uint8_t command[] = { 0x5A, 0x01, 0x00, (uint8_t)screenID }; + write(0x84, command, sizeof(command)); } -void DGUSDisplay::PlaySound(uint8_t start, uint8_t len, uint8_t volume) { +void DGUSDisplay::playSound(uint8_t start, uint8_t len, uint8_t volume) { if (volume == 0) volume = DGUSDisplay::volume; if (volume == 0) return; const uint8_t command[] = { start, len, volume, 0x00 }; - Write(0xA0, command, sizeof(command)); + write(0xA0, command, sizeof(command)); } -void DGUSDisplay::EnableControl(DGUS_Screen screen, DGUS_ControlType type, DGUS_Control control) { - const uint8_t command[] = { 0x5A, 0xA5, 0x00, (uint8_t)screen, (uint8_t)control, type, 0x00, 0x01 }; - Write(0xB0, command, sizeof(command)); +void DGUSDisplay::enableControl(const DGUS_ScreenID screenID, DGUS_ControlType type, DGUS_Control control) { + const uint8_t command[] = { 0x5A, 0xA5, 0x00, (uint8_t)screenID, (uint8_t)control, type, 0x00, 0x01 }; + write(0xB0, command, sizeof(command)); - FlushTx(); + flushTx(); delay(50); } -void DGUSDisplay::DisableControl(DGUS_Screen screen, DGUS_ControlType type, DGUS_Control control) { - const uint8_t command[] = { 0x5A, 0xA5, 0x00, (uint8_t)screen, (uint8_t)control, type, 0x00, 0x00 }; - Write(0xB0, command, sizeof(command)); +void DGUSDisplay::disableControl(const DGUS_ScreenID screenID, DGUS_ControlType type, DGUS_Control control) { + const uint8_t command[] = { 0x5A, 0xA5, 0x00, (uint8_t)screenID, (uint8_t)control, type, 0x00, 0x00 }; + write(0xB0, command, sizeof(command)); - FlushTx(); + flushTx(); delay(50); } -uint8_t DGUSDisplay::GetBrightness() { +uint8_t DGUSDisplay::getBrightness() { return brightness; } -uint8_t DGUSDisplay::GetVolume() { +uint8_t DGUSDisplay::getVolume() { return map_precise(volume, 0, 255, 0, 100); } -void DGUSDisplay::SetBrightness(uint8_t new_brightness) { +void DGUSDisplay::setBrightness(uint8_t new_brightness) { brightness = constrain(new_brightness, 0, 100); new_brightness = map_precise(brightness, 0, 100, 5, 100); const uint8_t command[] = { new_brightness, new_brightness }; - Write(0x82, command, sizeof(command)); + write(0x82, command, sizeof(command)); } -void DGUSDisplay::SetVolume(uint8_t new_volume) { +void DGUSDisplay::setVolume(uint8_t new_volume) { volume = map_precise(constrain(new_volume, 0, 100), 0, 100, 0, 255); const uint8_t command[] = { volume, 0x00 }; - Write(0xA1, command, sizeof(command)); + write(0xA1, command, sizeof(command)); } -void DGUSDisplay::ProcessRx() { +void DGUSDisplay::processRx() { #if ENABLED(LCD_SERIAL_STATS_RX_BUFFER_OVERRUNS) if (!LCD_SERIAL.available() && LCD_SERIAL.buffer_overruns()) { @@ -274,7 +274,7 @@ void DGUSDisplay::ProcessRx() { } DGUS_VP vp; - if (!DGUS_PopulateVP((DGUS_Addr)addr, &vp)) { + if (!populateVP((DGUS_Addr)addr, &vp)) { rx_datagram_state = DGUS_IDLE; break; } @@ -332,7 +332,7 @@ void DGUSDisplay::ProcessRx() { } } -size_t DGUSDisplay::GetFreeTxBuffer() { +size_t DGUSDisplay::getFreeTxBuffer() { return ( #ifdef LCD_SERIAL_GET_TX_BUFFER_FREE LCD_SERIAL_GET_TX_BUFFER_FREE() @@ -342,7 +342,7 @@ size_t DGUSDisplay::GetFreeTxBuffer() { ); } -void DGUSDisplay::FlushTx() { +void DGUSDisplay::flushTx() { #ifdef ARDUINO_ARCH_STM32 LCD_SERIAL.flush(); #else @@ -350,7 +350,7 @@ void DGUSDisplay::FlushTx() { #endif } -void DGUSDisplay::WriteHeader(uint16_t addr, uint8_t command, uint8_t len) { +void DGUSDisplay::writeHeader(uint16_t addr, uint8_t command, uint8_t len) { LCD_SERIAL.write(DGUS_HEADER1); LCD_SERIAL.write(DGUS_HEADER2); LCD_SERIAL.write(len + 3); @@ -359,7 +359,7 @@ void DGUSDisplay::WriteHeader(uint16_t addr, uint8_t command, uint8_t len) { LCD_SERIAL.write(addr & 0xFF); } -bool DGUS_PopulateVP(const DGUS_Addr addr, DGUS_VP * const buffer) { +bool populateVP(const DGUS_Addr addr, DGUS_VP * const buffer) { const DGUS_VP *ret = vp_list; do { diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.h b/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.h index bfea5780a1f04..88fed7a3b8123 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.h @@ -26,7 +26,7 @@ * Updated for STM32G0B1RE by Protomosh in 2022. */ -#include "config/DGUS_Screen.h" +#include "config/DGUS_ScreenID.h" #include "config/DGUS_Control.h" #include "definition/DGUS_VP.h" @@ -58,58 +58,58 @@ class DGUSDisplay { DGUSDisplay() = default; - static void Init(); + static void init(); - static void Read(uint16_t addr, uint8_t size); - static void Write(uint16_t addr, const void* data_ptr, uint8_t size); + static void read(uint16_t addr, uint8_t size); + static void write(uint16_t addr, const void* data_ptr, uint8_t size); - static void WriteString(uint16_t addr, const void* data_ptr, uint8_t size, bool left=true, bool right=false, bool use_space=true); - static void WriteStringPGM(uint16_t addr, const void* data_ptr, uint8_t size, bool left=true, bool right=false, bool use_space=true); - static void WriteString(uint16_t addr, FSTR_P const fstr, uint8_t size, bool left=true, bool right=false, bool use_space=true) { - WriteStringPGM(addr, FTOP(fstr), size, left, right, use_space); + static void writeString(uint16_t addr, const void* data_ptr, uint8_t size, bool left=true, bool right=false, bool use_space=true); + static void writeStringPGM(uint16_t addr, const void* data_ptr, uint8_t size, bool left=true, bool right=false, bool use_space=true); + static void writeString(uint16_t addr, FSTR_P const fstr, uint8_t size, bool left=true, bool right=false, bool use_space=true) { + writeStringPGM(addr, FTOP(fstr), size, left, right, use_space); } template - static void Write(uint16_t addr, T data) { - Write(addr, static_cast(&data), sizeof(T)); + static void write(uint16_t addr, T data) { + write(addr, static_cast(&data), sizeof(T)); } // Until now I did not need to actively read from the display. That's why there is no ReadVariable // (I extensively use the auto upload of the display) // Read GUI and OS version from screen - static void ReadVersions(); + static void readVersions(); // Force display into another screen. - static void SwitchScreen(DGUS_Screen screen); + static void switchScreen(const DGUS_ScreenID screenID); // Play sounds using the display speaker. // start: position at which the sound was stored on the display. // len: how many sounds to play. Sounds will play consecutively from start to start+len-1. // volume: playback volume. 0 keeps the current volume. - static void PlaySound(uint8_t start, uint8_t len=1, uint8_t volume=0); + static void playSound(uint8_t start, uint8_t len=1, uint8_t volume=0); // Enable/disable a specific touch control. // type: control type. // control: index of the control on the page (set during screen development). - static void EnableControl(DGUS_Screen screen, DGUS_ControlType type, DGUS_Control control); - static void DisableControl(DGUS_Screen screen, DGUS_ControlType type, DGUS_Control control); + static void enableControl(const DGUS_ScreenID screenID, DGUS_ControlType type, DGUS_Control control); + static void disableControl(const DGUS_ScreenID screenID, DGUS_ControlType type, DGUS_Control control); - static uint8_t GetBrightness(); - static uint8_t GetVolume(); + static uint8_t getBrightness(); + static uint8_t getVolume(); // Set the display brightness/volume, ranging 0 - 100 - static void SetBrightness(uint8_t brightness); - static void SetVolume(uint8_t volume); + static void setBrightness(uint8_t brightness); + static void setVolume(uint8_t volume); // Periodic tasks, eg. Rx-Queue handling. - static void Loop(); + static void loop(); // Helper for users of this class to estimate if an interaction would be blocking. - static size_t GetFreeTxBuffer(); - static void FlushTx(); + static size_t getFreeTxBuffer(); + static void flushTx(); // Checks two things: Can we confirm the presence of the display and has we initialized it. // (both boils down that the display answered to our chatting) - static bool IsInitialized() { + static bool isInitialized() { return initialized; } @@ -117,7 +117,7 @@ class DGUSDisplay { static uint8_t os_version; template - static T SwapBytes(const T value) { + static T swapBytes(const T value) { union { T val; char byte[sizeof(T)]; @@ -129,12 +129,12 @@ class DGUSDisplay { } template - T_out FromFixedPoint(const T_in value) { + T_out fromFixedPoint(const T_in value) { return (T_out)((float)value / POW(10, decimals)); } template - T_out ToFixedPoint(const T_in value) { + T_out toFixedPoint(const T_in value) { return (T_out)LROUND((float)value * POW(10, decimals)); } @@ -160,8 +160,8 @@ class DGUSDisplay { DGUS_VERSION = 0x000F // OS/GUI version }; - static void WriteHeader(uint16_t addr, uint8_t command, uint8_t len); - static void ProcessRx(); + static void writeHeader(uint16_t addr, uint8_t command, uint8_t len); + static void processRx(); static uint8_t volume; static uint8_t brightness; @@ -172,11 +172,11 @@ class DGUSDisplay { static bool initialized; }; -template<> inline uint16_t DGUSDisplay::SwapBytes(const uint16_t value) { +template<> inline uint16_t DGUSDisplay::swapBytes(const uint16_t value) { return ((value << 8) | (value >> 8)); } -extern DGUSDisplay dgus_display; +extern DGUSDisplay dgus; /// Helper to populate a DGUS_VP for a given VP. Return false if not found. -extern bool DGUS_PopulateVP(const DGUS_Addr addr, DGUS_VP * const buffer); +extern bool populateVP(const DGUS_Addr addr, DGUS_VP * const buffer); diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp index 97ae7638c9414..aa58e8569229e 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp @@ -27,7 +27,7 @@ #include "DGUSRxHandler.h" #include "DGUSScreenHandler.h" -#include "config/DGUS_Screen.h" +#include "config/DGUS_ScreenID.h" #include "../ui_api.h" #include "../../../core/language.h" @@ -42,73 +42,73 @@ #include "../../../feature/powerloss.h" #endif -void DGUSRxHandler::ScreenChange(DGUS_VP &vp, void *data_ptr) { - const DGUS_Screen screen = (DGUS_Screen)((uint8_t*)data_ptr)[1]; +void DGUSRxHandler::screenChange(DGUS_VP &vp, void *data_ptr) { + const DGUS_ScreenID screenID = (DGUS_ScreenID)((uint8_t*)data_ptr)[1]; if (vp.addr == DGUS_Addr::SCREENCHANGE_SD) { #if HAS_MEDIA IF_DISABLED(HAS_SD_DETECT, card.mount()); if (!ExtUI::isMediaInserted()) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(MSG_NO_MEDIA)); + screen.setStatusMessage(GET_TEXT_F(MSG_NO_MEDIA)); return; } card.cdroot(); #else - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(MSG_NO_MEDIA)); + screen.setStatusMessage(GET_TEXT_F(MSG_NO_MEDIA)); return; #endif } if (vp.addr == DGUS_Addr::SCREENCHANGE_Idle && (ExtUI::isPrinting() || ExtUI::isPrintingPaused())) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_NOT_WHILE_PRINTING)); + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_NOT_WHILE_PRINTING)); return; } if (vp.addr == DGUS_Addr::SCREENCHANGE_Printing && (!ExtUI::isPrinting() && !ExtUI::isPrintingPaused())) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_NOT_WHILE_IDLE)); + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_NOT_WHILE_IDLE)); return; } - dgus_screen_handler.TriggerScreenChange(screen); + screen.triggerScreenChange(screenID); } #if HAS_MEDIA - void DGUSRxHandler::Scroll(DGUS_VP &vp, void *data_ptr) { + void DGUSRxHandler::scroll(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); const DGUS_Data::Scroll scroll = (DGUS_Data::Scroll)((uint8_t*)data_ptr)[1]; switch (scroll) { case DGUS_Data::Scroll::GO_BACK: - if (dgus_screen_handler.filelist.isAtRootDir()) { + if (screen.filelist.isAtRootDir()) { return; } - dgus_screen_handler.filelist_offset = 0; - dgus_screen_handler.filelist_selected = -1; - dgus_screen_handler.filelist.upDir(); + screen.filelist_offset = 0; + screen.filelist_selected = -1; + screen.filelist.upDir(); break; case DGUS_Data::Scroll::UP: - if (dgus_screen_handler.filelist_offset < 1) { + if (screen.filelist_offset < 1) { return; } - --dgus_screen_handler.filelist_offset; + --screen.filelist_offset; break; case DGUS_Data::Scroll::DOWN: - if (dgus_screen_handler.filelist_offset + 1 + DGUS_FILE_COUNT > dgus_screen_handler.filelist.count()) { + if (screen.filelist_offset + 1 + DGUS_FILE_COUNT > screen.filelist.count()) { return; } - ++dgus_screen_handler.filelist_offset; + ++screen.filelist_offset; break; } - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerFullUpdate(); } void DGUSRxHandler::selectFile(DGUS_VP &vp, void *data_ptr) { @@ -116,47 +116,47 @@ void DGUSRxHandler::ScreenChange(DGUS_VP &vp, void *data_ptr) { const uint8_t index = ((uint8_t*)data_ptr)[1]; - if (!dgus_screen_handler.filelist.seek(dgus_screen_handler.filelist_offset + index)) { + if (!screen.filelist.seek(screen.filelist_offset + index)) { return; } - if (dgus_screen_handler.filelist.isDir()) { - dgus_screen_handler.filelist_offset = 0; - dgus_screen_handler.filelist_selected = -1; - dgus_screen_handler.filelist.changeDir(dgus_screen_handler.filelist.filename()); + if (screen.filelist.isDir()) { + screen.filelist_offset = 0; + screen.filelist_selected = -1; + screen.filelist.changeDir(screen.filelist.filename()); } else { - dgus_screen_handler.filelist_selected = dgus_screen_handler.filelist_offset + index; + screen.filelist_selected = screen.filelist_offset + index; } - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerFullUpdate(); } - void DGUSRxHandler::PrintFile(DGUS_VP &vp, void *data_ptr) { + void DGUSRxHandler::printFile(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); UNUSED(data_ptr); - if (dgus_screen_handler.filelist_selected < 0) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_NO_FILE_SELECTED)); + if (screen.filelist_selected < 0) { + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_NO_FILE_SELECTED)); return; } - if (!dgus_screen_handler.filelist.seek(dgus_screen_handler.filelist_selected) - || dgus_screen_handler.filelist.isDir()) { + if (!screen.filelist.seek(screen.filelist_selected) + || screen.filelist.isDir()) { return; } - if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); + if (!screen.isPrinterIdle()) { + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } - ExtUI::printFile(dgus_screen_handler.filelist.shortFilename()); - dgus_screen_handler.TriggerScreenChange(DGUS_Screen::PRINT_STATUS); + ExtUI::printFile(screen.filelist.shortFilename()); + screen.triggerScreenChange(DGUS_ScreenID::PRINT_STATUS); } #endif // HAS_MEDIA -void DGUSRxHandler::PrintAbort(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::printAbort(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); const DGUS_Data::Popup result = (DGUS_Data::Popup)((uint8_t*)data_ptr)[1]; @@ -166,14 +166,14 @@ void DGUSRxHandler::PrintAbort(DGUS_VP &vp, void *data_ptr) { } if (!ExtUI::isPrinting() && !ExtUI::isPrintingPaused()) { - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerFullUpdate(); return; } ExtUI::stopPrint(); } -void DGUSRxHandler::PrintPause(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::printPause(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); const DGUS_Data::Popup result = (DGUS_Data::Popup)((uint8_t*)data_ptr)[1]; @@ -183,14 +183,14 @@ void DGUSRxHandler::PrintPause(DGUS_VP &vp, void *data_ptr) { } if (!ExtUI::isPrinting()) { - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerFullUpdate(); return; } ExtUI::pausePrint(); } -void DGUSRxHandler::PrintResume(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::printResume(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); const DGUS_Data::Popup result = (DGUS_Data::Popup)((uint8_t*)data_ptr)[1]; @@ -200,29 +200,29 @@ void DGUSRxHandler::PrintResume(DGUS_VP &vp, void *data_ptr) { } if (!ExtUI::isPrintingPaused()) { - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerFullUpdate(); return; } - if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); + if (!screen.isPrinterIdle()) { + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } ExtUI::resumePrint(); } -void DGUSRxHandler::Feedrate(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::feedrate(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); const int16_t feedrate = BE16_P(data_ptr); ExtUI::setFeedrate_percent(feedrate); - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerFullUpdate(); } -void DGUSRxHandler::Flowrate(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::flowrate(DGUS_VP &vp, void *data_ptr) { const int16_t flowrate = BE16_P(data_ptr); switch (vp.addr) { @@ -240,24 +240,24 @@ void DGUSRxHandler::Flowrate(DGUS_VP &vp, void *data_ptr) { #endif } - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerFullUpdate(); } -void DGUSRxHandler::BabystepSet(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::babystepSet(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); const int16_t data = BE16_P(data_ptr); - const float offset = dgus_display.FromFixedPoint(data); + const float offset = dgus.fromFixedPoint(data); const int16_t steps = ExtUI::mmToWholeSteps(offset - ExtUI::getZOffset_mm(), ExtUI::Z); ExtUI::smartAdjustAxis_steps(steps, ExtUI::Z, true); - dgus_screen_handler.TriggerEEPROMSave(); - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerEEPROMSave(); + screen.triggerFullUpdate(); } -void DGUSRxHandler::Babystep(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::babystep(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); const DGUS_Data::Adjust adjust = (DGUS_Data::Adjust)((uint8_t*)data_ptr)[1]; @@ -275,11 +275,11 @@ void DGUSRxHandler::Babystep(DGUS_VP &vp, void *data_ptr) { ExtUI::smartAdjustAxis_steps(steps, ExtUI::Z, true); - dgus_screen_handler.TriggerEEPROMSave(); - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerEEPROMSave(); + screen.triggerFullUpdate(); } -void DGUSRxHandler::TempPreset(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::tempPreset(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); const DGUS_Data::TempPreset preset = (DGUS_Data::TempPreset)((uint8_t*)data_ptr)[1]; @@ -311,10 +311,10 @@ void DGUSRxHandler::TempPreset(DGUS_VP &vp, void *data_ptr) { break; } - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerFullUpdate(); } -void DGUSRxHandler::TempTarget(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::tempTarget(DGUS_VP &vp, void *data_ptr) { const int16_t temp = BE16_P(data_ptr); switch (vp.addr) { @@ -332,10 +332,10 @@ void DGUSRxHandler::TempTarget(DGUS_VP &vp, void *data_ptr) { #endif } - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerFullUpdate(); } -void DGUSRxHandler::TempCool(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::tempCool(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); const DGUS_Data::Heater heater = (DGUS_Data::Heater)BE16_P(data_ptr); @@ -362,12 +362,12 @@ void DGUSRxHandler::TempCool(DGUS_VP &vp, void *data_ptr) { #endif } - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(MSG_COOLING)); + screen.setStatusMessage(GET_TEXT_F(MSG_COOLING)); - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerFullUpdate(); } -void DGUSRxHandler::Steppers(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::steppers(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); const DGUS_Data::Control control = (DGUS_Data::Control)((uint8_t*)data_ptr)[1]; @@ -381,50 +381,50 @@ void DGUSRxHandler::Steppers(DGUS_VP &vp, void *data_ptr) { break; } - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerFullUpdate(); } -void DGUSRxHandler::ZOffset(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::zOffset(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); if (TERN0(NO_MOTION_BEFORE_HOMING, !ExtUI::isAxisPositionKnown(ExtUI::Z))) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED)); + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED)); return; } - if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); + if (!screen.isPrinterIdle()) { + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } const int16_t data = BE16_P(data_ptr); - const float offset = dgus_display.FromFixedPoint(data); + const float offset = dgus.fromFixedPoint(data); const int16_t steps = ExtUI::mmToWholeSteps(offset - ExtUI::getZOffset_mm(), ExtUI::Z); ExtUI::smartAdjustAxis_steps(steps, ExtUI::Z, true); - dgus_screen_handler.TriggerEEPROMSave(); - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerEEPROMSave(); + screen.triggerFullUpdate(); } -void DGUSRxHandler::ZOffsetStep(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::zOffsetStep(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); if (TERN0(NO_MOTION_BEFORE_HOMING, !ExtUI::isAxisPositionKnown(ExtUI::Z))) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED)); + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED)); return; } - if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); + if (!screen.isPrinterIdle()) { + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } const DGUS_Data::Adjust adjust = (DGUS_Data::Adjust)((uint8_t*)data_ptr)[1]; int16_t steps; - switch (dgus_screen_handler.offset_steps) { + switch (screen.offset_steps) { default: return; case DGUS_Data::StepSize::MMP1: steps = ExtUI::mmToWholeSteps((adjust == DGUS_Data::Adjust::INCREMENT ? 0.1f : -0.1f), ExtUI::Z); @@ -436,30 +436,30 @@ void DGUSRxHandler::ZOffsetStep(DGUS_VP &vp, void *data_ptr) { ExtUI::smartAdjustAxis_steps(steps, ExtUI::Z, true); - dgus_screen_handler.TriggerEEPROMSave(); - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerEEPROMSave(); + screen.triggerFullUpdate(); } -void DGUSRxHandler::ZOffsetSetStep(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::zOffsetSetStep(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); const DGUS_Data::StepSize size = (DGUS_Data::StepSize)((uint8_t*)data_ptr)[1]; - dgus_screen_handler.offset_steps = size; + screen.offset_steps = size; - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerFullUpdate(); } -void DGUSRxHandler::MoveToPoint(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::moveToPoint(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); if (!ExtUI::isPositionKnown()) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED)); + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED)); return; } - if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); + if (!screen.isPrinterIdle()) { + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } @@ -499,26 +499,26 @@ void DGUSRxHandler::MoveToPoint(DGUS_VP &vp, void *data_ptr) { ExtUI::setAxisPosition_mm(Z_MIN_POS + BED_TRAMMING_HEIGHT, ExtUI::Z); } -void DGUSRxHandler::Probe(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::probe(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); UNUSED(data_ptr); #if ENABLED(MESH_BED_LEVELING) - dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_ABL_REQUIRED)); + screen.setStatusMessage(FPSTR(DGUS_MSG_ABL_REQUIRED)); return; #endif if (!ExtUI::isPositionKnown()) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED)); + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED)); return; } - if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); + if (!screen.isPrinterIdle()) { + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } - dgus_screen_handler.TriggerScreenChange(DGUS_Screen::LEVELING_PROBING); + screen.triggerScreenChange(DGUS_ScreenID::LEVELING_PROBING); #if ENABLED(AUTO_BED_LEVELING_UBL) queue.enqueue_now(F("G29P1\nG29P3\nG29P5C")); @@ -528,22 +528,22 @@ void DGUSRxHandler::Probe(DGUS_VP &vp, void *data_ptr) { queue.enqueue_now(F("M500")); } -void DGUSRxHandler::DisableABL(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::disableABL(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); UNUSED(data_ptr); - if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); + if (!screen.isPrinterIdle()) { + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } ExtUI::setLevelingActive(false); - dgus_screen_handler.TriggerEEPROMSave(); - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerEEPROMSave(); + screen.triggerFullUpdate(); } -void DGUSRxHandler::FilamentSelect(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::filamentSelect(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); const DGUS_Data::Extruder extruder = (DGUS_Data::Extruder)BE16_P(data_ptr); @@ -553,34 +553,34 @@ void DGUSRxHandler::FilamentSelect(DGUS_VP &vp, void *data_ptr) { case DGUS_Data::Extruder::CURRENT: case DGUS_Data::Extruder::E0: E_TERN_(case DGUS_Data::Extruder::E1:) - dgus_screen_handler.filament_extruder = extruder; + screen.filament_extruder = extruder; break; } - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerFullUpdate(); } -void DGUSRxHandler::FilamentLength(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::filamentLength(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); const uint16_t length = BE16_P(data_ptr); - dgus_screen_handler.filament_length = constrain(length, 0, EXTRUDE_MAXLENGTH); + screen.filament_length = constrain(length, 0, EXTRUDE_MAXLENGTH); - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerFullUpdate(); } -void DGUSRxHandler::FilamentMove(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::filamentMove(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); - if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); + if (!screen.isPrinterIdle()) { + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } ExtUI::extruder_t extruder; - switch (dgus_screen_handler.filament_extruder) { + switch (screen.filament_extruder) { default: return; case DGUS_Data::Extruder::CURRENT: #if HAS_MULTI_EXTRUDER @@ -598,7 +598,7 @@ void DGUSRxHandler::FilamentMove(DGUS_VP &vp, void *data_ptr) { } if (ExtUI::getActualTemp_celsius(extruder) < (float)EXTRUDE_MINTEMP) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_TEMP_TOO_LOW)); + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_TEMP_TOO_LOW)); return; } @@ -606,25 +606,25 @@ void DGUSRxHandler::FilamentMove(DGUS_VP &vp, void *data_ptr) { switch (move) { case DGUS_Data::FilamentMove::RETRACT: - UI_DECREMENT_BY(AxisPosition_mm, (float)dgus_screen_handler.filament_length, extruder); + UI_DECREMENT_BY(AxisPosition_mm, (float)screen.filament_length, extruder); break; case DGUS_Data::FilamentMove::EXTRUDE: - UI_INCREMENT_BY(AxisPosition_mm, (float)dgus_screen_handler.filament_length, extruder); + UI_INCREMENT_BY(AxisPosition_mm, (float)screen.filament_length, extruder); break; } } -void DGUSRxHandler::Home(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::home(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); - if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); + if (!screen.isPrinterIdle()) { + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } DGUS_Data::Axis axis = (DGUS_Data::Axis)((uint8_t*)data_ptr)[1]; - dgus_screen_handler.ShowWaitScreen(GET_TEXT_F(DGUS_MSG_HOMING), dgus_screen_handler.GetCurrentScreen()); + screen.showWaitScreen(GET_TEXT_F(DGUS_MSG_HOMING), screen.getCurrentScreen()); switch (axis) { case DGUS_Data::Axis::X_Y_Z: @@ -639,9 +639,9 @@ void DGUSRxHandler::Home(DGUS_VP &vp, void *data_ptr) { } } -void DGUSRxHandler::Move(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::move(DGUS_VP &vp, void *data_ptr) { const int16_t data = BE16_P(data_ptr); - const float position = dgus_display.FromFixedPoint(data); + const float position = dgus.fromFixedPoint(data); ExtUI::axis_t axis; switch (vp.addr) { @@ -652,20 +652,20 @@ void DGUSRxHandler::Move(DGUS_VP &vp, void *data_ptr) { } if (TERN0(NO_MOTION_BEFORE_HOMING, !ExtUI::isAxisPositionKnown(axis))) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED)); + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED)); return; } ExtUI::setAxisPosition_mm(position, axis); - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerFullUpdate(); } -void DGUSRxHandler::MoveStep(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::moveStep(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); float offset; - switch (dgus_screen_handler.move_steps) { + switch (screen.move_steps) { default: return; case DGUS_Data::StepSize::MM10: offset = 10.0f; break; case DGUS_Data::StepSize::MM1: offset = 1.0f; break; @@ -686,58 +686,58 @@ void DGUSRxHandler::MoveStep(DGUS_VP &vp, void *data_ptr) { } if (TERN0(NO_MOTION_BEFORE_HOMING, !ExtUI::isAxisPositionKnown(axis))) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED)); + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED)); return; } UI_INCREMENT_BY(AxisPosition_mm, offset, axis); - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerFullUpdate(); } -void DGUSRxHandler::MoveSetStep(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::moveSetStep(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); const DGUS_Data::StepSize size = (DGUS_Data::StepSize)((uint8_t*)data_ptr)[1]; - dgus_screen_handler.move_steps = size; + screen.move_steps = size; - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerFullUpdate(); } -void DGUSRxHandler::GcodeClear(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::gcodeClear(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); UNUSED(data_ptr); - ZERO(dgus_screen_handler.gcode); + ZERO(screen.gcode); - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerFullUpdate(); } -void DGUSRxHandler::GcodeExecute(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::gcodeExecute(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); UNUSED(data_ptr); - if (!strlen(dgus_screen_handler.gcode)) return; + if (!strlen(screen.gcode)) return; - if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); + if (!screen.isPrinterIdle()) { + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } - dgus_screen_handler.ShowWaitScreen(GET_TEXT_F(DGUS_MSG_EXECUTING_COMMAND), DGUS_Screen::GCODE); + screen.showWaitScreen(GET_TEXT_F(DGUS_MSG_EXECUTING_COMMAND), DGUS_ScreenID::GCODE); - queue.enqueue_one_now(dgus_screen_handler.gcode); + queue.enqueue_one_now(screen.gcode); } -void DGUSRxHandler::ResetEEPROM(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::resetEEPROM(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); const DGUS_Data::Popup result = (DGUS_Data::Popup)((uint8_t*)data_ptr)[1]; if (result != DGUS_Data::Popup::CONFIRMED) return; - if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); + if (!screen.isPrinterIdle()) { + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } @@ -745,7 +745,7 @@ void DGUSRxHandler::ResetEEPROM(DGUS_VP &vp, void *data_ptr) { queue.enqueue_now(F("M500")); } -void DGUSRxHandler::SettingsExtra(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::settingsExtra(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); const DGUS_Data::Extra extra = (DGUS_Data::Extra)((uint8_t*)data_ptr)[1]; @@ -754,25 +754,25 @@ void DGUSRxHandler::SettingsExtra(DGUS_VP &vp, void *data_ptr) { default: return; case DGUS_Data::Extra::BUTTON1: #if ENABLED(BLTOUCH) - if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); + if (!screen.isPrinterIdle()) { + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } queue.enqueue_now(F(DGUS_RESET_BLTOUCH)); #else - dgus_screen_handler.TriggerScreenChange(DGUS_Screen::INFOS); + screen.triggerScreenChange(DGUS_ScreenID::INFOS); #endif break; #if ENABLED(BLTOUCH) case DGUS_Data::Extra::BUTTON2: - dgus_screen_handler.TriggerScreenChange(DGUS_Screen::INFOS); + screen.triggerScreenChange(DGUS_ScreenID::INFOS); break; #endif } } -void DGUSRxHandler::PIDSelect(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::pidSelect(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); const DGUS_Data::Heater heater = (DGUS_Data::Heater)BE16_P(data_ptr); @@ -780,34 +780,34 @@ void DGUSRxHandler::PIDSelect(DGUS_VP &vp, void *data_ptr) { switch (heater) { default: return; case DGUS_Data::Heater::BED: - dgus_screen_handler.pid_temp = DGUS_PLA_TEMP_BED; - dgus_screen_handler.pid_heater = heater; + screen.pid_temp = DGUS_PLA_TEMP_BED; + screen.pid_heater = heater; break; case DGUS_Data::Heater::H0: #if HAS_MULTI_HOTEND case DGUS_Data::Heater::H1: #endif - dgus_screen_handler.pid_temp = DGUS_PLA_TEMP_HOTEND; - dgus_screen_handler.pid_heater = heater; + screen.pid_temp = DGUS_PLA_TEMP_HOTEND; + screen.pid_heater = heater; break; } - dgus_screen_handler.pid_cycles = 5; + screen.pid_cycles = 5; - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerFullUpdate(); } -void DGUSRxHandler::PIDSetTemp(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::pidSetTemp(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); - if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); + if (!screen.isPrinterIdle()) { + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } uint16_t temp = BE16_P(data_ptr); - switch (dgus_screen_handler.pid_heater) { + switch (screen.pid_heater) { default: return; case DGUS_Data::Heater::BED: temp = constrain(temp, BED_MINTEMP, BED_MAX_TARGET); @@ -822,31 +822,31 @@ void DGUSRxHandler::PIDSetTemp(DGUS_VP &vp, void *data_ptr) { #endif } - dgus_screen_handler.pid_temp = temp; + screen.pid_temp = temp; - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerFullUpdate(); } -void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::pidRun(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); UNUSED(data_ptr); - if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); + if (!screen.isPrinterIdle()) { + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } heater_id_t heater; - uint8_t cycles = constrain(dgus_screen_handler.pid_cycles, 3, 10); + uint8_t cycles = constrain(screen.pid_cycles, 3, 10); - switch (dgus_screen_handler.pid_heater) { + switch (screen.pid_heater) { default: return; case DGUS_Data::Heater::BED: #if ENABLED(PIDTEMPBED) heater = H_BED; break; #else - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BED_PID_DISABLED)); + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BED_PID_DISABLED)); return; #endif case DGUS_Data::Heater::H0: @@ -854,7 +854,7 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) { heater = H_E0; break; #else - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_PID_DISABLED)); + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_PID_DISABLED)); return; #endif #if HAS_MULTI_HOTEND @@ -863,23 +863,23 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) { heater = H_E1; break; #else - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_PID_DISABLED)); + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_PID_DISABLED)); return; #endif #endif } char buffer[24]; - snprintf_P(buffer, sizeof(buffer), PSTR("M303C%dE%dS%dU1"), cycles, heater, dgus_screen_handler.pid_temp); + snprintf_P(buffer, sizeof(buffer), PSTR("M303C%dE%dS%dU1"), cycles, heater, screen.pid_temp); - dgus_screen_handler.ShowWaitScreen(GET_TEXT_F(DGUS_MSG_PID_AUTOTUNING), DGUS_Screen::PID); + screen.showWaitScreen(GET_TEXT_F(DGUS_MSG_PID_AUTOTUNING), DGUS_ScreenID::PID); queue.enqueue_one_now(buffer); queue.enqueue_now(F("M500")); } #if ENABLED(POWER_LOSS_RECOVERY) - void DGUSRxHandler::PowerLossAbort(DGUS_VP &vp, void *data_ptr) { + void DGUSRxHandler::powerLossAbort(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); const DGUS_Data::Popup result = (DGUS_Data::Popup)((uint8_t*)data_ptr)[1]; @@ -888,17 +888,17 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) { return; } - if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); + if (!screen.isPrinterIdle()) { + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } - dgus_screen_handler.TriggerScreenChange(DGUS_Screen::HOME); + screen.triggerScreenChange(DGUS_ScreenID::HOME); queue.enqueue_now(F("M1000C")); } - void DGUSRxHandler::PowerLossResume(DGUS_VP &vp, void *data_ptr) { + void DGUSRxHandler::powerLossResume(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); const DGUS_Data::Popup result = (DGUS_Data::Popup)((uint8_t*)data_ptr)[1]; @@ -907,23 +907,23 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) { return; } - if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); + if (!screen.isPrinterIdle()) { + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return; } if (!recovery.valid()) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_INVALID_RECOVERY_DATA)); + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_INVALID_RECOVERY_DATA)); return; } - dgus_screen_handler.TriggerScreenChange(DGUS_Screen::PRINT_STATUS); + screen.triggerScreenChange(DGUS_ScreenID::PRINT_STATUS); queue.enqueue_now(F("M1000")); } #endif // POWER_LOSS_RECOVERY -void DGUSRxHandler::WaitAbort(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::waitAbort(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); const DGUS_Data::Popup result = (DGUS_Data::Popup)((uint8_t*)data_ptr)[1]; @@ -933,25 +933,25 @@ void DGUSRxHandler::WaitAbort(DGUS_VP &vp, void *data_ptr) { } if (!ExtUI::isPrintingPaused()) { - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerFullUpdate(); return; } ExtUI::stopPrint(); - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerFullUpdate(); } -void DGUSRxHandler::WaitContinue(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::waitContinue(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); UNUSED(data_ptr); ExtUI::setUserConfirmed(); - dgus_screen_handler.TriggerFullUpdate(); + screen.triggerFullUpdate(); } -void DGUSRxHandler::FanSpeed(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::fanSpeed(DGUS_VP &vp, void *data_ptr) { uint8_t speed = ((uint8_t*)data_ptr)[1]; switch (vp.addr) { default: return; @@ -961,36 +961,36 @@ void DGUSRxHandler::FanSpeed(DGUS_VP &vp, void *data_ptr) { } } -void DGUSRxHandler::Volume(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::volume(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); uint8_t volume = ((uint8_t*)data_ptr)[1]; - dgus_display.SetVolume(volume); + dgus.setVolume(volume); - dgus_screen_handler.TriggerEEPROMSave(); + screen.triggerEEPROMSave(); } -void DGUSRxHandler::Brightness(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::brightness(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); uint8_t brightness = ((uint8_t*)data_ptr)[1]; - dgus_display.SetBrightness(brightness); + dgus.setBrightness(brightness); - dgus_screen_handler.TriggerEEPROMSave(); + screen.triggerEEPROMSave(); } -void DGUSRxHandler::Debug(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::debug(DGUS_VP &vp, void *data_ptr) { UNUSED(vp); UNUSED(data_ptr); - ++dgus_screen_handler.debug_count; + ++screen.debug_count; - if (dgus_screen_handler.debug_count >= 10) { - dgus_screen_handler.TriggerScreenChange(DGUS_Screen::DEBUG); + if (screen.debug_count >= 10) { + screen.triggerScreenChange(DGUS_ScreenID::DEBUG); } } -void DGUSRxHandler::StringToExtra(DGUS_VP &vp, void *data_ptr) { +void DGUSRxHandler::stringToExtra(DGUS_VP &vp, void *data_ptr) { if (!vp.size || !vp.extra) return; memcpy(vp.extra, data_ptr, vp.size); } diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.h b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.h index b81b142d8411d..9143b83554eea 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.h @@ -26,78 +26,78 @@ namespace DGUSRxHandler { - void ScreenChange(DGUS_VP &, void *); + void screenChange(DGUS_VP &, void *); #if HAS_MEDIA - void Scroll(DGUS_VP &, void *); + void scroll(DGUS_VP &, void *); void selectFile(DGUS_VP &, void *); - void PrintFile(DGUS_VP &, void *); + void printFile(DGUS_VP &, void *); #endif - void PrintAbort(DGUS_VP &, void *); - void PrintPause(DGUS_VP &, void *); - void PrintResume(DGUS_VP &, void *); + void printAbort(DGUS_VP &, void *); + void printPause(DGUS_VP &, void *); + void printResume(DGUS_VP &, void *); - void Feedrate(DGUS_VP &, void *); - void Flowrate(DGUS_VP &, void *); - void BabystepSet(DGUS_VP &, void *); - void Babystep(DGUS_VP &, void *); + void feedrate(DGUS_VP &, void *); + void flowrate(DGUS_VP &, void *); + void babystepSet(DGUS_VP &, void *); + void babystep(DGUS_VP &, void *); - void TempPreset(DGUS_VP &, void *); - void TempTarget(DGUS_VP &, void *); - void TempCool(DGUS_VP &, void *); + void tempPreset(DGUS_VP &, void *); + void tempTarget(DGUS_VP &, void *); + void tempCool(DGUS_VP &, void *); - void Steppers(DGUS_VP &, void *); + void steppers(DGUS_VP &, void *); - void ZOffset(DGUS_VP &, void *); - void ZOffsetStep(DGUS_VP &, void *); - void ZOffsetSetStep(DGUS_VP &, void *); + void zOffset(DGUS_VP &, void *); + void zOffsetStep(DGUS_VP &, void *); + void zOffsetSetStep(DGUS_VP &, void *); - void MoveToPoint(DGUS_VP &, void *); + void moveToPoint(DGUS_VP &, void *); - void Probe(DGUS_VP &, void *); - void DisableABL(DGUS_VP &, void *); + void probe(DGUS_VP &, void *); + void disableABL(DGUS_VP &, void *); - void FilamentSelect(DGUS_VP &, void *); - void FilamentLength(DGUS_VP &, void *); - void FilamentMove(DGUS_VP &, void *); + void filamentSelect(DGUS_VP &, void *); + void filamentLength(DGUS_VP &, void *); + void filamentMove(DGUS_VP &, void *); - void Home(DGUS_VP &, void *); - void Move(DGUS_VP &, void *); - void MoveStep(DGUS_VP &, void *); - void MoveSetStep(DGUS_VP &, void *); + void home(DGUS_VP &, void *); + void move(DGUS_VP &, void *); + void moveStep(DGUS_VP &, void *); + void moveSetStep(DGUS_VP &, void *); - void GcodeClear(DGUS_VP &, void *); - void GcodeExecute(DGUS_VP &, void *); + void gcodeClear(DGUS_VP &, void *); + void gcodeExecute(DGUS_VP &, void *); - void ResetEEPROM(DGUS_VP &, void *); + void resetEEPROM(DGUS_VP &, void *); - void SettingsExtra(DGUS_VP &, void *); + void settingsExtra(DGUS_VP &, void *); - void PIDSelect(DGUS_VP &, void *); - void PIDSetTemp(DGUS_VP &, void *); - void PIDRun(DGUS_VP &, void *); + void pidSelect(DGUS_VP &, void *); + void pidSetTemp(DGUS_VP &, void *); + void pidRun(DGUS_VP &, void *); #if ENABLED(POWER_LOSS_RECOVERY) - void PowerLossAbort(DGUS_VP &, void *); - void PowerLossResume(DGUS_VP &, void *); + void powerLossAbort(DGUS_VP &, void *); + void powerLossResume(DGUS_VP &, void *); #endif - void WaitAbort(DGUS_VP &, void *); - void WaitContinue(DGUS_VP &, void *); + void waitAbort(DGUS_VP &, void *); + void waitContinue(DGUS_VP &, void *); - void FanSpeed(DGUS_VP &, void *); + void fanSpeed(DGUS_VP &, void *); - void Volume(DGUS_VP &, void *); + void volume(DGUS_VP &, void *); - void Brightness(DGUS_VP &, void *); + void brightness(DGUS_VP &, void *); - void Debug(DGUS_VP &, void *); + void debug(DGUS_VP &, void *); - void StringToExtra(DGUS_VP &, void *); + void stringToExtra(DGUS_VP &, void *); template - void IntegerToExtra(DGUS_VP &vp, void *data_ptr) { + void integerToExtra(DGUS_VP &vp, void *data_ptr) { if (!vp.size || !vp.extra) return; switch (vp.size) { default: return; @@ -112,7 +112,7 @@ namespace DGUSRxHandler { break; } case 4: { - const uint32_t data = dgus_display.SwapBytes(*(uint32_t*)data_ptr); + const uint32_t data = dgus.swapBytes(*(uint32_t*)data_ptr); *(T*)vp.extra = (T)data; break; } diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp index c0f85760456a1..793a2c15796f6 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp @@ -57,11 +57,11 @@ uint8_t DGUSScreenHandler::pid_cycles = 5; bool DGUSScreenHandler::settings_ready = false; bool DGUSScreenHandler::booted = false; -DGUS_Screen DGUSScreenHandler::current_screen = DGUS_Screen::BOOT; -DGUS_Screen DGUSScreenHandler::new_screen = DGUS_Screen::BOOT; +DGUS_ScreenID DGUSScreenHandler::current_screenID = DGUS_ScreenID::BOOT; +DGUS_ScreenID DGUSScreenHandler::new_screenID = DGUS_ScreenID::BOOT; bool DGUSScreenHandler::full_update = false; -DGUS_Screen DGUSScreenHandler::wait_return_screen = DGUS_Screen::HOME; +DGUS_ScreenID DGUSScreenHandler::wait_return_screenID = DGUS_ScreenID::HOME; bool DGUSScreenHandler::wait_continue = false; bool DGUSScreenHandler::leveling_active = false; @@ -69,41 +69,41 @@ bool DGUSScreenHandler::leveling_active = false; millis_t DGUSScreenHandler::status_expire = 0; millis_t DGUSScreenHandler::eeprom_save = 0; -void DGUSScreenHandler::Init() { - dgus_display.Init(); +void DGUSScreenHandler::init() { + dgus.init(); - MoveToScreen(DGUS_Screen::BOOT, true); + moveToScreen(DGUS_ScreenID::BOOT, true); } -void DGUSScreenHandler::Ready() { - dgus_display.PlaySound(1); +void DGUSScreenHandler::ready() { + dgus.playSound(1); } -void DGUSScreenHandler::Loop() { - if (!settings_ready || current_screen == DGUS_Screen::KILL) { +void DGUSScreenHandler::loop() { + if (!settings_ready || current_screenID == DGUS_ScreenID::KILL) { return; } const millis_t ms = ExtUI::safe_millis(); static millis_t next_event_ms = 0; - if (new_screen != DGUS_Screen::BOOT) { - const DGUS_Screen screen = new_screen; - new_screen = DGUS_Screen::BOOT; - if (current_screen == screen) - TriggerFullUpdate(); + if (new_screenID != DGUS_ScreenID::BOOT) { + const DGUS_ScreenID screenID = new_screenID; + new_screenID = DGUS_ScreenID::BOOT; + if (current_screenID == screenID) + triggerFullUpdate(); else - MoveToScreen(screen); + moveToScreen(screenID); return; } if (!booted && ELAPSED(ms, 3000)) { booted = true; - dgus_display.ReadVersions(); + dgus.readVersions(); - if (current_screen == DGUS_Screen::BOOT) - MoveToScreen(DGUS_Screen::HOME); + if (current_screenID == DGUS_ScreenID::BOOT) + moveToScreen(DGUS_ScreenID::HOME); return; } @@ -111,98 +111,98 @@ void DGUSScreenHandler::Loop() { if (ELAPSED(ms, next_event_ms) || full_update) { next_event_ms = ms + DGUS_UPDATE_INTERVAL_MS; - if (!SendScreenVPData(current_screen, full_update)) - DEBUG_ECHOLNPGM("SendScreenVPData failed"); + if (!sendScreenVPData(current_screenID, full_update)) + DEBUG_ECHOLNPGM("sendScreenVPData failed"); return; } - if (current_screen == DGUS_Screen::WAIT - && ((wait_continue && !wait_for_user) || (!wait_continue && IsPrinterIdle())) + if (current_screenID == DGUS_ScreenID::WAIT + && ((wait_continue && !wait_for_user) || (!wait_continue && isPrinterIdle())) ) { - MoveToScreen(wait_return_screen, true); + moveToScreen(wait_return_screenID, true); return; } - if (current_screen == DGUS_Screen::LEVELING_PROBING && IsPrinterIdle()) { - dgus_display.PlaySound(3); + if (current_screenID == DGUS_ScreenID::LEVELING_PROBING && isPrinterIdle()) { + dgus.playSound(3); - SetStatusMessage(ExtUI::getLevelingIsValid() ? GET_TEXT_F(DGUS_MSG_PROBING_SUCCESS) : GET_TEXT_F(DGUS_MSG_PROBING_FAILED)); + setStatusMessage(ExtUI::getLevelingIsValid() ? GET_TEXT_F(DGUS_MSG_PROBING_SUCCESS) : GET_TEXT_F(DGUS_MSG_PROBING_FAILED)); - MoveToScreen(DGUS_Screen::LEVELING_AUTOMATIC); + moveToScreen(DGUS_ScreenID::LEVELING_AUTOMATIC); return; } if (status_expire > 0 && ELAPSED(ms, status_expire)) { - SetStatusMessage(FPSTR(NUL_STR), 0); + setStatusMessage(FPSTR(NUL_STR), 0); return; } - if (eeprom_save > 0 && ELAPSED(ms, eeprom_save) && IsPrinterIdle()) { + if (eeprom_save > 0 && ELAPSED(ms, eeprom_save) && isPrinterIdle()) { eeprom_save = 0; queue.enqueue_now(F("M500")); return; } - dgus_display.Loop(); + dgus.loop(); } void DGUSScreenHandler::printerKilled(FSTR_P const error, FSTR_P const component) { - SetMessageLine(error, 1); - SetMessageLine(component, 2); - SetMessageLinePGM(NUL_STR, 3); - SetMessageLine(GET_TEXT_F(MSG_PLEASE_RESET), 4); + setMessageLine(error, 1); + setMessageLine(component, 2); + setMessageLinePGM(NUL_STR, 3); + setMessageLine(GET_TEXT_F(MSG_PLEASE_RESET), 4); - dgus_display.PlaySound(3, 1, 200); + dgus.playSound(3, 1, 200); - MoveToScreen(DGUS_Screen::KILL, true); + moveToScreen(DGUS_ScreenID::KILL, true); } -void DGUSScreenHandler::UserConfirmRequired(const char * const msg) { - SetMessageLinePGM(NUL_STR, 1); - SetMessageLine(msg, 2); - SetMessageLinePGM(NUL_STR, 3); - SetMessageLinePGM(NUL_STR, 4); +void DGUSScreenHandler::userConfirmRequired(const char * const msg) { + setMessageLinePGM(NUL_STR, 1); + setMessageLine(msg, 2); + setMessageLinePGM(NUL_STR, 3); + setMessageLinePGM(NUL_STR, 4); - dgus_display.PlaySound(3); + dgus.playSound(3); - ShowWaitScreen(current_screen, true); + showWaitScreen(current_screenID, true); } -void DGUSScreenHandler::SettingsReset() { - dgus_display.SetVolume(DGUS_DEFAULT_VOLUME); - dgus_display.SetBrightness(DGUS_DEFAULT_BRIGHTNESS); +void DGUSScreenHandler::settingsReset() { + dgus.setVolume(DGUS_DEFAULT_VOLUME); + dgus.setBrightness(DGUS_DEFAULT_BRIGHTNESS); if (!settings_ready) { settings_ready = true; - Ready(); + ready(); } - SetStatusMessage(GET_TEXT_F(DGUS_MSG_RESET_EEPROM)); + setStatusMessage(GET_TEXT_F(DGUS_MSG_RESET_EEPROM)); } -void DGUSScreenHandler::StoreSettings(char *buff) { +void DGUSScreenHandler::storeSettings(char *buff) { eeprom_data_t data; static_assert(sizeof(data) <= ExtUI::eeprom_data_size, "sizeof(eeprom_data_t) > eeprom_data_size."); data.initialized = true; - data.volume = dgus_display.GetVolume(); - data.brightness = dgus_display.GetBrightness(); + data.volume = dgus.getVolume(); + data.brightness = dgus.getBrightness(); data.abl_okay = (ExtUI::getLevelingActive() && ExtUI::getLevelingIsValid()); memcpy(buff, &data, sizeof(data)); } -void DGUSScreenHandler::LoadSettings(const char *buff) { +void DGUSScreenHandler::loadSettings(const char *buff) { eeprom_data_t data; static_assert(sizeof(data) <= ExtUI::eeprom_data_size, "sizeof(eeprom_data_t) > eeprom_data_size."); memcpy(&data, buff, sizeof(data)); - dgus_display.SetVolume(data.initialized ? data.volume : DGUS_DEFAULT_VOLUME); - dgus_display.SetBrightness(data.initialized ? data.brightness : DGUS_DEFAULT_BRIGHTNESS); + dgus.setVolume(data.initialized ? data.volume : DGUS_DEFAULT_VOLUME); + dgus.setBrightness(data.initialized ? data.brightness : DGUS_DEFAULT_BRIGHTNESS); if (data.initialized) { leveling_active = (data.abl_okay && ExtUI::getLevelingIsValid()); @@ -210,36 +210,36 @@ void DGUSScreenHandler::LoadSettings(const char *buff) { } } -void DGUSScreenHandler::ConfigurationStoreWritten(bool success) { +void DGUSScreenHandler::configurationStoreWritten(bool success) { if (!success) - SetStatusMessage(GET_TEXT_F(DGUS_MSG_WRITE_EEPROM_FAILED)); + setStatusMessage(GET_TEXT_F(DGUS_MSG_WRITE_EEPROM_FAILED)); } -void DGUSScreenHandler::ConfigurationStoreRead(bool success) { +void DGUSScreenHandler::configurationStoreRead(bool success) { if (!success) { - SetStatusMessage(GET_TEXT_F(DGUS_MSG_READ_EEPROM_FAILED)); + setStatusMessage(GET_TEXT_F(DGUS_MSG_READ_EEPROM_FAILED)); } else if (!settings_ready) { settings_ready = true; - Ready(); + ready(); } } -void DGUSScreenHandler::PlayTone(const uint16_t frequency, const uint16_t duration) { +void DGUSScreenHandler::playTone(const uint16_t frequency, const uint16_t duration) { UNUSED(duration); if (frequency >= 1 && frequency <= 255) { if (duration >= 1 && duration <= 255) - dgus_display.PlaySound((uint8_t)frequency, (uint8_t)duration); + dgus.playSound((uint8_t)frequency, (uint8_t)duration); else - dgus_display.PlaySound((uint8_t)frequency); + dgus.playSound((uint8_t)frequency); } } -void DGUSScreenHandler::MeshUpdate(const int8_t xpos, const int8_t ypos) { - if (current_screen != DGUS_Screen::LEVELING_PROBING) { - if (current_screen == DGUS_Screen::LEVELING_AUTOMATIC) - TriggerFullUpdate(); +void DGUSScreenHandler::meshUpdate(const int8_t xpos, const int8_t ypos) { + if (current_screenID != DGUS_ScreenID::LEVELING_PROBING) { + if (current_screenID == DGUS_ScreenID::LEVELING_AUTOMATIC) + triggerFullUpdate(); return; } @@ -249,25 +249,25 @@ void DGUSScreenHandler::MeshUpdate(const int8_t xpos, const int8_t ypos) { if (xpos >= GRID_MAX_POINTS_X - 1 && ypos >= GRID_MAX_POINTS_Y - 1 && !ExtUI::getLevelingIsValid()) probing_icons[0] = probing_icons[1] = 0; - TriggerFullUpdate(); + triggerFullUpdate(); } -void DGUSScreenHandler::PrintTimerStarted() { - TriggerScreenChange(DGUS_Screen::PRINT_STATUS); +void DGUSScreenHandler::printTimerStarted() { + triggerScreenChange(DGUS_ScreenID::PRINT_STATUS); } -void DGUSScreenHandler::PrintTimerPaused() { - dgus_display.PlaySound(3); - TriggerFullUpdate(); +void DGUSScreenHandler::printTimerPaused() { + dgus.playSound(3); + triggerFullUpdate(); } -void DGUSScreenHandler::PrintTimerStopped() { - if (current_screen != DGUS_Screen::PRINT_STATUS && current_screen != DGUS_Screen::PRINT_ADJUST) +void DGUSScreenHandler::printTimerStopped() { + if (current_screenID != DGUS_ScreenID::PRINT_STATUS && current_screenID != DGUS_ScreenID::PRINT_ADJUST) return; - dgus_display.PlaySound(3); + dgus.playSound(3); - TriggerScreenChange(DGUS_Screen::PRINT_FINISHED); + triggerScreenChange(DGUS_ScreenID::PRINT_FINISHED); } void DGUSScreenHandler::filamentRunout(const ExtUI::extruder_t extruder) { @@ -275,161 +275,161 @@ void DGUSScreenHandler::filamentRunout(const ExtUI::extruder_t extruder) { snprintf_P(buffer, sizeof(buffer), GET_TEXT(DGUS_MSG_FILAMENT_RUNOUT), extruder); - SetStatusMessage(buffer); + setStatusMessage(buffer); - dgus_display.PlaySound(3); + dgus.playSound(3); } #if HAS_MEDIA - void DGUSScreenHandler::SDCardInserted() { - if (current_screen == DGUS_Screen::HOME) - TriggerScreenChange(DGUS_Screen::PRINT); + void DGUSScreenHandler::sdCardInserted() { + if (current_screenID == DGUS_ScreenID::HOME) + triggerScreenChange(DGUS_ScreenID::PRINT); } - void DGUSScreenHandler::SDCardRemoved() { - if (current_screen == DGUS_Screen::PRINT) - TriggerScreenChange(DGUS_Screen::HOME); + void DGUSScreenHandler::sdCardRemoved() { + if (current_screenID == DGUS_ScreenID::PRINT) + triggerScreenChange(DGUS_ScreenID::HOME); } - void DGUSScreenHandler::SDCardError() { - SetStatusMessage(GET_TEXT_F(MSG_MEDIA_READ_ERROR)); - if (current_screen == DGUS_Screen::PRINT) - TriggerScreenChange(DGUS_Screen::HOME); + void DGUSScreenHandler::sdCardError() { + setStatusMessage(GET_TEXT_F(MSG_MEDIA_READ_ERROR)); + if (current_screenID == DGUS_ScreenID::PRINT) + triggerScreenChange(DGUS_ScreenID::HOME); } #endif // HAS_MEDIA #if ENABLED(POWER_LOSS_RECOVERY) - void DGUSScreenHandler::PowerLossResume() { - MoveToScreen(DGUS_Screen::POWERLOSS, true); + void DGUSScreenHandler::powerLossResume() { + moveToScreen(DGUS_ScreenID::POWERLOSS, true); } #endif // POWER_LOSS_RECOVERY #if HAS_PID_HEATING - void DGUSScreenHandler::PidTuning(const ExtUI::result_t rst) { + void DGUSScreenHandler::pidTuning(const ExtUI::result_t rst) { switch (rst) { case ExtUI::PID_STARTED: - SetStatusMessage(GET_TEXT_F(MSG_PID_AUTOTUNE)); + setStatusMessage(GET_TEXT_F(MSG_PID_AUTOTUNE)); break; case ExtUI::PID_BAD_HEATER_ID: - SetStatusMessage(GET_TEXT_F(MSG_PID_BAD_HEATER_ID)); + setStatusMessage(GET_TEXT_F(MSG_PID_BAD_HEATER_ID)); break; case ExtUI::PID_TEMP_TOO_HIGH: - SetStatusMessage(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH)); + setStatusMessage(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH)); break; case ExtUI::PID_TUNING_TIMEOUT: - SetStatusMessage(GET_TEXT_F(MSG_PID_TIMEOUT)); + setStatusMessage(GET_TEXT_F(MSG_PID_TIMEOUT)); break; case ExtUI::PID_DONE: - SetStatusMessage(GET_TEXT_F(MSG_PID_AUTOTUNE_DONE)); + setStatusMessage(GET_TEXT_F(MSG_PID_AUTOTUNE_DONE)); break; default: return; } - dgus_display.PlaySound(3); + dgus.playSound(3); } #endif // HAS_PID_HEATING -void DGUSScreenHandler::SetMessageLine(const char * const msg, const uint8_t line) { +void DGUSScreenHandler::setMessageLine(const char * const msg, const uint8_t line) { switch (line) { default: return; case 1: - dgus_display.WriteString((uint16_t)DGUS_Addr::MESSAGE_Line1, msg, DGUS_LINE_LEN, true, true); + dgus.writeString((uint16_t)DGUS_Addr::MESSAGE_Line1, msg, DGUS_LINE_LEN, true, true); break; case 2: - dgus_display.WriteString((uint16_t)DGUS_Addr::MESSAGE_Line2, msg, DGUS_LINE_LEN, true, true); + dgus.writeString((uint16_t)DGUS_Addr::MESSAGE_Line2, msg, DGUS_LINE_LEN, true, true); break; case 3: - dgus_display.WriteString((uint16_t)DGUS_Addr::MESSAGE_Line3, msg, DGUS_LINE_LEN, true, true); + dgus.writeString((uint16_t)DGUS_Addr::MESSAGE_Line3, msg, DGUS_LINE_LEN, true, true); break; case 4: - dgus_display.WriteString((uint16_t)DGUS_Addr::MESSAGE_Line4, msg, DGUS_LINE_LEN, true, true); + dgus.writeString((uint16_t)DGUS_Addr::MESSAGE_Line4, msg, DGUS_LINE_LEN, true, true); break; } } -void DGUSScreenHandler::SetMessageLinePGM(PGM_P const msg, const uint8_t line) { +void DGUSScreenHandler::setMessageLinePGM(PGM_P const msg, const uint8_t line) { switch (line) { default: return; case 1: - dgus_display.WriteStringPGM((uint16_t)DGUS_Addr::MESSAGE_Line1, msg, DGUS_LINE_LEN, true, true); + dgus.writeStringPGM((uint16_t)DGUS_Addr::MESSAGE_Line1, msg, DGUS_LINE_LEN, true, true); break; case 2: - dgus_display.WriteStringPGM((uint16_t)DGUS_Addr::MESSAGE_Line2, msg, DGUS_LINE_LEN, true, true); + dgus.writeStringPGM((uint16_t)DGUS_Addr::MESSAGE_Line2, msg, DGUS_LINE_LEN, true, true); break; case 3: - dgus_display.WriteStringPGM((uint16_t)DGUS_Addr::MESSAGE_Line3, msg, DGUS_LINE_LEN, true, true); + dgus.writeStringPGM((uint16_t)DGUS_Addr::MESSAGE_Line3, msg, DGUS_LINE_LEN, true, true); break; case 4: - dgus_display.WriteStringPGM((uint16_t)DGUS_Addr::MESSAGE_Line4, msg, DGUS_LINE_LEN, true, true); + dgus.writeStringPGM((uint16_t)DGUS_Addr::MESSAGE_Line4, msg, DGUS_LINE_LEN, true, true); break; } } -void DGUSScreenHandler::SetStatusMessage(const char* msg, const millis_t duration) { - dgus_display.WriteString((uint16_t)DGUS_Addr::MESSAGE_Status, msg, DGUS_STATUS_LEN, false, true); +void DGUSScreenHandler::setStatusMessage(const char* msg, const millis_t duration) { + dgus.writeString((uint16_t)DGUS_Addr::MESSAGE_Status, msg, DGUS_STATUS_LEN, false, true); status_expire = (duration > 0 ? ExtUI::safe_millis() + duration : 0); } -void DGUSScreenHandler::SetStatusMessage(FSTR_P const fmsg, const millis_t duration) { - dgus_display.WriteString((uint16_t)DGUS_Addr::MESSAGE_Status, fmsg, DGUS_STATUS_LEN, false, true); +void DGUSScreenHandler::setStatusMessage(FSTR_P const fmsg, const millis_t duration) { + dgus.writeString((uint16_t)DGUS_Addr::MESSAGE_Status, fmsg, DGUS_STATUS_LEN, false, true); status_expire = (duration > 0 ? ExtUI::safe_millis() + duration : 0); } -void DGUSScreenHandler::ShowWaitScreen(const DGUS_Screen return_screen, const bool has_continue/*=false*/) { - if (return_screen != DGUS_Screen::WAIT) { - wait_return_screen = return_screen; +void DGUSScreenHandler::showWaitScreen(const DGUS_ScreenID return_screenID, const bool has_continue/*=false*/) { + if (return_screenID != DGUS_ScreenID::WAIT) { + wait_return_screenID = return_screenID; } wait_continue = has_continue; - TriggerScreenChange(DGUS_Screen::WAIT); + triggerScreenChange(DGUS_ScreenID::WAIT); } -void DGUSScreenHandler::ShowWaitScreen(FSTR_P const msg, const DGUS_Screen return_screen, const bool has_continue/*=false*/) { - SetMessageLinePGM(NUL_STR, 1); - SetMessageLine(msg, 2); - SetMessageLinePGM(NUL_STR, 3); - SetMessageLinePGM(NUL_STR, 4); - ShowWaitScreen(return_screen, has_continue); +void DGUSScreenHandler::showWaitScreen(FSTR_P const msg, const DGUS_ScreenID return_screenID, const bool has_continue/*=false*/) { + setMessageLinePGM(NUL_STR, 1); + setMessageLine(msg, 2); + setMessageLinePGM(NUL_STR, 3); + setMessageLinePGM(NUL_STR, 4); + showWaitScreen(return_screenID, has_continue); } -DGUS_Screen DGUSScreenHandler::GetCurrentScreen() { - return current_screen; +DGUS_ScreenID DGUSScreenHandler::getCurrentScreen() { + return current_screenID; } -void DGUSScreenHandler::TriggerScreenChange(DGUS_Screen screen) { - new_screen = screen; +void DGUSScreenHandler::triggerScreenChange(const DGUS_ScreenID screenID) { + new_screenID = screenID; } -void DGUSScreenHandler::TriggerFullUpdate() { +void DGUSScreenHandler::triggerFullUpdate() { full_update = true; } -void DGUSScreenHandler::TriggerEEPROMSave() { +void DGUSScreenHandler::triggerEEPROMSave() { eeprom_save = ExtUI::safe_millis() + 500; } -bool DGUSScreenHandler::IsPrinterIdle() { +bool DGUSScreenHandler::isPrinterIdle() { return (!ExtUI::commandsInQueue() && !ExtUI::isMoving()); } -const DGUS_Addr* DGUSScreenHandler::FindScreenAddrList(DGUS_Screen screen) { +const DGUS_Addr* DGUSScreenHandler::findScreenAddrList(const DGUS_ScreenID screenID) { DGUS_ScreenAddrList list; const DGUS_ScreenAddrList *map = screen_addr_list_map; do { memcpy_P(&list, map, sizeof(*map)); if (!list.addr_list) break; - if (list.screen == screen) { + if (list.screenID == screenID) { return list.addr_list; } } while (++map); @@ -437,14 +437,14 @@ const DGUS_Addr* DGUSScreenHandler::FindScreenAddrList(DGUS_Screen screen) { return nullptr; } -bool DGUSScreenHandler::CallScreenSetup(DGUS_Screen screen) { +bool DGUSScreenHandler::callScreenSetup(const DGUS_ScreenID screenID) { DGUS_ScreenSetup setup; const DGUS_ScreenSetup *list = screen_setup_list; do { memcpy_P(&setup, list, sizeof(*list)); if (!setup.setup_fn) break; - if (setup.screen == screen) { + if (setup.screenID == screenID) { return setup.setup_fn(); } } while (++list); @@ -452,14 +452,14 @@ bool DGUSScreenHandler::CallScreenSetup(DGUS_Screen screen) { return true; } -void DGUSScreenHandler::MoveToScreen(DGUS_Screen screen, bool abort_wait) { - if (current_screen == DGUS_Screen::KILL) { +void DGUSScreenHandler::moveToScreen(const DGUS_ScreenID screenID, bool abort_wait) { + if (current_screenID == DGUS_ScreenID::KILL) { return; } - if (current_screen == DGUS_Screen::WAIT) { - if (screen != DGUS_Screen::WAIT) { - wait_return_screen = screen; + if (current_screenID == DGUS_ScreenID::WAIT) { + if (screenID != DGUS_ScreenID::WAIT) { + wait_return_screenID = screenID; } if (!abort_wait) return; @@ -469,18 +469,18 @@ void DGUSScreenHandler::MoveToScreen(DGUS_Screen screen, bool abort_wait) { } } - if (!CallScreenSetup(screen)) return; + if (!callScreenSetup(screenID)) return; - if (!SendScreenVPData(screen, true)) return; + if (!sendScreenVPData(screenID, true)) return; - current_screen = screen; - dgus_display.SwitchScreen(current_screen); + current_screenID = screenID; + dgus.switchScreen(current_screenID); } -bool DGUSScreenHandler::SendScreenVPData(DGUS_Screen screen, bool complete_update) { +bool DGUSScreenHandler::sendScreenVPData(const DGUS_ScreenID screenID, bool complete_update) { if (complete_update) full_update = false; - const DGUS_Addr *list = FindScreenAddrList(screen); + const DGUS_Addr *list = findScreenAddrList(screenID); while (true) { if (!list) return true; // Nothing left to send @@ -489,17 +489,17 @@ bool DGUSScreenHandler::SendScreenVPData(DGUS_Screen screen, bool complete_updat if (!addr) return true; // Nothing left to send DGUS_VP vp; - if (!DGUS_PopulateVP((DGUS_Addr)addr, &vp)) continue; // Invalid VP + if (!populateVP((DGUS_Addr)addr, &vp)) continue; // Invalid VP if (!vp.tx_handler) continue; // Nothing to send if (!complete_update && !(vp.flags & VPFLAG_AUTOUPLOAD)) continue; // Unnecessary VP uint8_t expected_tx = 6 + vp.size; // 6 bytes header + payload. const millis_t try_until = ExtUI::safe_millis() + 1000; - while (expected_tx > dgus_display.GetFreeTxBuffer()) { + while (expected_tx > dgus.getFreeTxBuffer()) { if (ELAPSED(ExtUI::safe_millis(), try_until)) return false; // Stop trying after 1 second - dgus_display.FlushTx(); // Flush the TX buffer + dgus.flushTx(); // Flush the TX buffer delay(50); } diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h index 2ecf7192fe41b..27f7f92517caf 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h @@ -23,7 +23,7 @@ #include "config/DGUS_Addr.h" #include "config/DGUS_Data.h" -#include "config/DGUS_Screen.h" +#include "config/DGUS_ScreenID.h" #include "config/DGUS_Constants.h" #include "../ui_api.h" @@ -33,59 +33,59 @@ class DGUSScreenHandler { public: DGUSScreenHandler() = default; - static void Init(); - static void Ready(); - static void Loop(); + static void init(); + static void ready(); + static void loop(); static void printerKilled(FSTR_P const error, FSTR_P const component); - static void UserConfirmRequired(const char * const msg); - static void SettingsReset(); - static void StoreSettings(char *buff); - static void LoadSettings(const char *buff); - static void ConfigurationStoreWritten(bool success); - static void ConfigurationStoreRead(bool success); - - static void PlayTone(const uint16_t frequency, const uint16_t duration); - static void MeshUpdate(const int8_t xpos, const int8_t ypos); - static void PrintTimerStarted(); - static void PrintTimerPaused(); - static void PrintTimerStopped(); + static void userConfirmRequired(const char * const msg); + static void settingsReset(); + static void storeSettings(char *buff); + static void loadSettings(const char *buff); + static void configurationStoreWritten(bool success); + static void configurationStoreRead(bool success); + + static void playTone(const uint16_t frequency, const uint16_t duration); + static void meshUpdate(const int8_t xpos, const int8_t ypos); + static void printTimerStarted(); + static void printTimerPaused(); + static void printTimerStopped(); static void filamentRunout(const ExtUI::extruder_t extruder); #if HAS_MEDIA /// Marlin informed us that a new SD has been inserted. - static void SDCardInserted(); + static void sdCardInserted(); /// Marlin informed us that the SD Card has been removed(). - static void SDCardRemoved(); + static void sdCardRemoved(); /// Marlin informed us about a bad SD Card. - static void SDCardError(); + static void sdCardError(); #endif #if ENABLED(POWER_LOSS_RECOVERY) - static void PowerLossResume(); + static void powerLossResume(); #endif #if HAS_PID_HEATING - static void PidTuning(const ExtUI::result_t rst); + static void pidTuning(const ExtUI::result_t rst); #endif - static void SetMessageLine(const char * const msg, const uint8_t line); - static void SetMessageLinePGM(PGM_P const msg, const uint8_t line); - static void SetMessageLine(FSTR_P const msg, const uint8_t line) { SetMessageLinePGM(FTOP(msg), line); } + static void setMessageLine(const char * const msg, const uint8_t line); + static void setMessageLinePGM(PGM_P const msg, const uint8_t line); + static void setMessageLine(FSTR_P const msg, const uint8_t line) { setMessageLinePGM(FTOP(msg), line); } - static void SetStatusMessage(const char* msg, const millis_t duration=DGUS_STATUS_EXPIRATION_MS); - static void SetStatusMessage(FSTR_P const msg, const millis_t duration=DGUS_STATUS_EXPIRATION_MS); + static void setStatusMessage(const char* msg, const millis_t duration=DGUS_STATUS_EXPIRATION_MS); + static void setStatusMessage(FSTR_P const msg, const millis_t duration=DGUS_STATUS_EXPIRATION_MS); - static void ShowWaitScreen(const DGUS_Screen return_screen, const bool has_continue=false); - static void ShowWaitScreen(FSTR_P const msg, const DGUS_Screen return_screen, const bool has_continue=false); + static void showWaitScreen(const DGUS_ScreenID return_screenID, const bool has_continue=false); + static void showWaitScreen(FSTR_P const msg, const DGUS_ScreenID return_screenID, const bool has_continue=false); - static DGUS_Screen GetCurrentScreen(); - static void TriggerScreenChange(DGUS_Screen screen); - static void TriggerFullUpdate(); + static DGUS_ScreenID getCurrentScreen(); + static void triggerScreenChange(const DGUS_ScreenID screenID); + static void triggerFullUpdate(); - static void TriggerEEPROMSave(); + static void triggerEEPROMSave(); - static bool IsPrinterIdle(); + static bool isPrinterIdle(); static uint8_t debug_count; @@ -114,20 +114,20 @@ class DGUSScreenHandler { static bool leveling_active; private: - static const DGUS_Addr* FindScreenAddrList(DGUS_Screen screen); - static bool CallScreenSetup(DGUS_Screen screen); + static const DGUS_Addr* findScreenAddrList(const DGUS_ScreenID screenID); + static bool callScreenSetup(const DGUS_ScreenID screenID); - static void MoveToScreen(DGUS_Screen screen, bool abort_wait=false); - static bool SendScreenVPData(DGUS_Screen screen, bool complete_update); + static void moveToScreen(const DGUS_ScreenID screenID, bool abort_wait=false); + static bool sendScreenVPData(const DGUS_ScreenID screenID, bool complete_update); static bool settings_ready; static bool booted; - static DGUS_Screen current_screen; - static DGUS_Screen new_screen; + static DGUS_ScreenID current_screenID; + static DGUS_ScreenID new_screenID; static bool full_update; - static DGUS_Screen wait_return_screen; + static DGUS_ScreenID wait_return_screenID; static millis_t status_expire; static millis_t eeprom_save; @@ -140,4 +140,4 @@ class DGUSScreenHandler { } eeprom_data_t; }; -extern DGUSScreenHandler dgus_screen_handler; +extern DGUSScreenHandler screen; diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.cpp index c3b4bad88ad55..b0aeacbfdffef 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.cpp @@ -33,14 +33,14 @@ #if HAS_MEDIA bool DGUSSetupHandler::Print() { - dgus_screen_handler.filelist.refresh(); + screen.filelist.refresh(); - while (!dgus_screen_handler.filelist.isAtRootDir()) { - dgus_screen_handler.filelist.upDir(); + while (!screen.filelist.isAtRootDir()) { + screen.filelist.upDir(); } - dgus_screen_handler.filelist_offset = 0; - dgus_screen_handler.filelist_selected = -1; + screen.filelist_offset = 0; + screen.filelist_selected = -1; return true; } @@ -51,7 +51,7 @@ bool DGUSSetupHandler::PrintStatus() { return true; } - dgus_screen_handler.TriggerScreenChange(DGUS_Screen::PRINT_FINISHED); + screen.triggerScreenChange(DGUS_ScreenID::PRINT_FINISHED); return false; } @@ -60,15 +60,15 @@ bool DGUSSetupHandler::PrintAdjust() { return true; } - dgus_screen_handler.TriggerScreenChange(DGUS_Screen::PRINT_FINISHED); + screen.triggerScreenChange(DGUS_ScreenID::PRINT_FINISHED); return false; } bool DGUSSetupHandler::LevelingMenu() { - ExtUI::setLevelingActive(dgus_screen_handler.leveling_active); + ExtUI::setLevelingActive(screen.leveling_active); - if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); + if (!screen.isPrinterIdle()) { + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return false; } @@ -80,7 +80,7 @@ bool DGUSSetupHandler::LevelingMenu() { return true; } - dgus_screen_handler.ShowWaitScreen(GET_TEXT_F(DGUS_MSG_HOMING), DGUS_Screen::LEVELING_MENU); + screen.showWaitScreen(GET_TEXT_F(DGUS_MSG_HOMING), DGUS_ScreenID::LEVELING_MENU); queue.enqueue_now(F("G28")); @@ -94,12 +94,12 @@ bool DGUSSetupHandler::LevelingManual() { return true; } - if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); + if (!screen.isPrinterIdle()) { + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return false; } - dgus_screen_handler.ShowWaitScreen(GET_TEXT_F(DGUS_MSG_HOMING), DGUS_Screen::LEVELING_MANUAL); + screen.showWaitScreen(GET_TEXT_F(DGUS_MSG_HOMING), DGUS_ScreenID::LEVELING_MANUAL); queue.enqueue_now(F("G28")); @@ -107,10 +107,10 @@ bool DGUSSetupHandler::LevelingManual() { } bool DGUSSetupHandler::LevelingOffset() { - dgus_screen_handler.offset_steps = DGUS_Data::StepSize::MMP1; + screen.offset_steps = DGUS_Data::StepSize::MMP1; - if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); + if (!screen.isPrinterIdle()) { + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return false; } @@ -128,7 +128,7 @@ bool DGUSSetupHandler::LevelingOffset() { return true; } - dgus_screen_handler.ShowWaitScreen(GET_TEXT_F(DGUS_MSG_HOMING), DGUS_Screen::LEVELING_OFFSET); + screen.showWaitScreen(GET_TEXT_F(DGUS_MSG_HOMING), DGUS_ScreenID::LEVELING_OFFSET); queue.enqueue_now(F("G28")); @@ -137,7 +137,7 @@ bool DGUSSetupHandler::LevelingOffset() { bool DGUSSetupHandler::LevelingAutomatic() { if (ExtUI::getLevelingIsValid()) { - dgus_screen_handler.leveling_active = true; + screen.leveling_active = true; ExtUI::setLevelingActive(true); } @@ -146,24 +146,24 @@ bool DGUSSetupHandler::LevelingAutomatic() { } bool DGUSSetupHandler::LevelingProbing() { - dgus_screen_handler.probing_icons[0] = 0; - dgus_screen_handler.probing_icons[1] = 0; + screen.probing_icons[0] = 0; + screen.probing_icons[1] = 0; return true; } bool DGUSSetupHandler::Filament() { - dgus_screen_handler.filament_extruder = DGUS_Data::Extruder::CURRENT; - dgus_screen_handler.filament_length = DGUS_DEFAULT_FILAMENT_LEN; + screen.filament_extruder = DGUS_Data::Extruder::CURRENT; + screen.filament_length = DGUS_DEFAULT_FILAMENT_LEN; return true; } bool DGUSSetupHandler::Move() { - dgus_screen_handler.move_steps = DGUS_Data::StepSize::MM10; + screen.move_steps = DGUS_Data::StepSize::MM10; - if (!dgus_screen_handler.IsPrinterIdle()) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); + if (!screen.isPrinterIdle()) { + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY)); return false; } @@ -171,10 +171,10 @@ bool DGUSSetupHandler::Move() { } bool DGUSSetupHandler::Gcode() { - ZERO(dgus_screen_handler.gcode); + ZERO(screen.gcode); - if (dgus_display.gui_version < 0x30 || dgus_display.os_version < 0x21) { - dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_FW_OUTDATED)); + if (dgus.gui_version < 0x30 || dgus.os_version < 0x21) { + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_FW_OUTDATED)); return false; } @@ -182,14 +182,14 @@ bool DGUSSetupHandler::Gcode() { } bool DGUSSetupHandler::PID() { - dgus_screen_handler.pid_heater = DGUS_Data::Heater::H0; - dgus_screen_handler.pid_temp = DGUS_PLA_TEMP_HOTEND; + screen.pid_heater = DGUS_Data::Heater::H0; + screen.pid_temp = DGUS_PLA_TEMP_HOTEND; return true; } bool DGUSSetupHandler::Infos() { - dgus_screen_handler.debug_count = 0; + screen.debug_count = 0; return true; } diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.cpp index c7d650c03ec82..037eafcc94247 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.cpp @@ -37,7 +37,7 @@ #endif #if HAS_MEDIA - void DGUSTxHandler::SetFileControlState(int16_t file, bool state) { + void DGUSTxHandler::setFileControlState(int16_t file, bool state) { DGUS_Control control; switch (file) { @@ -60,40 +60,40 @@ } if (state) { - dgus_display.EnableControl(DGUS_Screen::PRINT, + dgus.enableControl(DGUS_ScreenID::PRINT, DGUSDisplay::RETURN_KEY_CODE, control); } else { - dgus_display.DisableControl(DGUS_Screen::PRINT, + dgus.disableControl(DGUS_ScreenID::PRINT, DGUSDisplay::RETURN_KEY_CODE, control); } } - void DGUSTxHandler::FileType(DGUS_VP &vp) { + void DGUSTxHandler::fileType(DGUS_VP &vp) { // Batch send uint16_t data[DGUS_FILE_COUNT]; for (int16_t i = 0; i < DGUS_FILE_COUNT; i++) { - if (!dgus_screen_handler.filelist.seek(dgus_screen_handler.filelist_offset + i)) { + if (!screen.filelist.seek(screen.filelist_offset + i)) { data[i] = Swap16(DGUS_Data::SDType::NONE); - SetFileControlState(i, false); + setFileControlState(i, false); continue; } - data[i] = dgus_screen_handler.filelist.isDir() ? + data[i] = screen.filelist.isDir() ? Swap16(DGUS_Data::SDType::DIRECTORY) : Swap16(DGUS_Data::SDType::FILE); - SetFileControlState(i, true); + setFileControlState(i, true); } - dgus_display.Write((uint16_t)vp.addr, data, sizeof(*data) * DGUS_FILE_COUNT); + dgus.write((uint16_t)vp.addr, data, sizeof(*data) * DGUS_FILE_COUNT); } - void DGUSTxHandler::FileName(DGUS_VP &vp) { + void DGUSTxHandler::fileName(DGUS_VP &vp) { uint8_t offset; switch (vp.addr) { @@ -115,84 +115,84 @@ break; } - if (dgus_screen_handler.filelist.seek(dgus_screen_handler.filelist_offset + offset)) { - dgus_display.WriteString((uint16_t)vp.addr, dgus_screen_handler.filelist.filename(), vp.size); + if (screen.filelist.seek(screen.filelist_offset + offset)) { + dgus.writeString((uint16_t)vp.addr, screen.filelist.filename(), vp.size); } else { - dgus_display.WriteStringPGM((uint16_t)vp.addr, NUL_STR, vp.size); + dgus.writeStringPGM((uint16_t)vp.addr, NUL_STR, vp.size); } } - void DGUSTxHandler::ScrollIcons(DGUS_VP &vp) { + void DGUSTxHandler::scrollIcons(DGUS_VP &vp) { uint16_t icons = 0; - if (!dgus_screen_handler.filelist.isAtRootDir()) { + if (!screen.filelist.isAtRootDir()) { icons |= (uint16_t)DGUS_Data::ScrollIcon::GO_BACK; - dgus_display.EnableControl(DGUS_Screen::PRINT, + dgus.enableControl(DGUS_ScreenID::PRINT, DGUSDisplay::RETURN_KEY_CODE, DGUS_Control::GO_BACK); } else { - dgus_display.DisableControl(DGUS_Screen::PRINT, + dgus.disableControl(DGUS_ScreenID::PRINT, DGUSDisplay::RETURN_KEY_CODE, DGUS_Control::GO_BACK); } - if (dgus_screen_handler.filelist_offset > 0) { + if (screen.filelist_offset > 0) { icons |= (uint16_t)DGUS_Data::ScrollIcon::UP; - dgus_display.EnableControl(DGUS_Screen::PRINT, + dgus.enableControl(DGUS_ScreenID::PRINT, DGUSDisplay::RETURN_KEY_CODE, DGUS_Control::SCROLL_UP); } else { - dgus_display.DisableControl(DGUS_Screen::PRINT, + dgus.disableControl(DGUS_ScreenID::PRINT, DGUSDisplay::RETURN_KEY_CODE, DGUS_Control::SCROLL_UP); } - if (dgus_screen_handler.filelist_offset + DGUS_FILE_COUNT < dgus_screen_handler.filelist.count()) { + if (screen.filelist_offset + DGUS_FILE_COUNT < screen.filelist.count()) { icons |= (uint16_t)DGUS_Data::ScrollIcon::DOWN; - dgus_display.EnableControl(DGUS_Screen::PRINT, + dgus.enableControl(DGUS_ScreenID::PRINT, DGUSDisplay::RETURN_KEY_CODE, DGUS_Control::SCROLL_DOWN); } else { - dgus_display.DisableControl(DGUS_Screen::PRINT, + dgus.disableControl(DGUS_ScreenID::PRINT, DGUSDisplay::RETURN_KEY_CODE, DGUS_Control::SCROLL_DOWN); } - dgus_display.Write((uint16_t)vp.addr, Swap16(icons)); + dgus.write((uint16_t)vp.addr, Swap16(icons)); } - void DGUSTxHandler::SelectedFileName(DGUS_VP &vp) { - if (dgus_screen_handler.filelist_selected < 0 - || !dgus_screen_handler.filelist.seek(dgus_screen_handler.filelist_selected)) { - dgus_display.WriteStringPGM((uint16_t)vp.addr, NUL_STR, vp.size); + void DGUSTxHandler::selectedFileName(DGUS_VP &vp) { + if (screen.filelist_selected < 0 + || !screen.filelist.seek(screen.filelist_selected)) { + dgus.writeStringPGM((uint16_t)vp.addr, NUL_STR, vp.size); return; } - dgus_display.WriteString((uint16_t)vp.addr, dgus_screen_handler.filelist.filename(), vp.size); + dgus.writeString((uint16_t)vp.addr, screen.filelist.filename(), vp.size); } #endif // HAS_MEDIA -void DGUSTxHandler::PositionZ(DGUS_VP &vp) { +void DGUSTxHandler::zPosition(DGUS_VP &vp) { const float position = ExtUI::isAxisPositionKnown(ExtUI::Z) ? planner.get_axis_position_mm(Z_AXIS) : 0; - const int32_t data = dgus_display.ToFixedPoint(int32_t(position * 50.0f) / 50.0f); // Round to 0.02 - dgus_display.Write((uint16_t)vp.addr, dgus_display.SwapBytes(data)); + const int32_t data = dgus.toFixedPoint(int32_t(position * 50.0f) / 50.0f); // Round to 0.02 + dgus.write((uint16_t)vp.addr, dgus.swapBytes(data)); } -void DGUSTxHandler::Elapsed(DGUS_VP &vp) { +void DGUSTxHandler::elapsed(DGUS_VP &vp) { char buffer[21]; duration_t(print_job_timer.duration()).toString(buffer); - dgus_display.WriteString((uint16_t)vp.addr, buffer, vp.size); + dgus.writeString((uint16_t)vp.addr, buffer, vp.size); } -void DGUSTxHandler::Percent(DGUS_VP &vp) { +void DGUSTxHandler::percent(DGUS_VP &vp) { uint16_t progress; switch (vp.addr) { @@ -205,21 +205,21 @@ void DGUSTxHandler::Percent(DGUS_VP &vp) { break; } - dgus_display.Write((uint16_t)DGUS_Addr::STATUS_Percent, Swap16(progress)); + dgus.write((uint16_t)DGUS_Addr::STATUS_Percent, Swap16(progress)); } -void DGUSTxHandler::StatusIcons(DGUS_VP &vp) { +void DGUSTxHandler::statusIcons(DGUS_VP &vp) { uint16_t icons = 0; if (ExtUI::isPrinting()) { icons |= (uint16_t)DGUS_Data::StatusIcon::PAUSE; - dgus_display.EnableControl(DGUS_Screen::PRINT_STATUS, + dgus.enableControl(DGUS_ScreenID::PRINT_STATUS, DGUSDisplay::POPUP_WINDOW, DGUS_Control::PAUSE); } else { - dgus_display.DisableControl(DGUS_Screen::PRINT_STATUS, + dgus.disableControl(DGUS_ScreenID::PRINT_STATUS, DGUSDisplay::POPUP_WINDOW, DGUS_Control::PAUSE); } @@ -227,20 +227,20 @@ void DGUSTxHandler::StatusIcons(DGUS_VP &vp) { if (ExtUI::isPrintingPaused()) { icons |= (uint16_t)DGUS_Data::StatusIcon::RESUME; - dgus_display.EnableControl(DGUS_Screen::PRINT_STATUS, + dgus.enableControl(DGUS_ScreenID::PRINT_STATUS, DGUSDisplay::POPUP_WINDOW, DGUS_Control::RESUME); } else { - dgus_display.DisableControl(DGUS_Screen::PRINT_STATUS, + dgus.disableControl(DGUS_ScreenID::PRINT_STATUS, DGUSDisplay::POPUP_WINDOW, DGUS_Control::RESUME); } - dgus_display.Write((uint16_t)vp.addr, Swap16(icons)); + dgus.write((uint16_t)vp.addr, Swap16(icons)); } -void DGUSTxHandler::Flowrate(DGUS_VP &vp) { +void DGUSTxHandler::flowrate(DGUS_VP &vp) { int16_t flowrate; switch (vp.addr) { @@ -258,10 +258,10 @@ void DGUSTxHandler::Flowrate(DGUS_VP &vp) { #endif } - dgus_display.Write((uint16_t)vp.addr, Swap16(flowrate)); + dgus.write((uint16_t)vp.addr, Swap16(flowrate)); } -void DGUSTxHandler::TempMax(DGUS_VP &vp) { +void DGUSTxHandler::tempMax(DGUS_VP &vp) { uint16_t temp; switch (vp.addr) { @@ -279,15 +279,15 @@ void DGUSTxHandler::TempMax(DGUS_VP &vp) { #endif } - dgus_display.Write((uint16_t)vp.addr, Swap16(temp)); + dgus.write((uint16_t)vp.addr, Swap16(temp)); } -void DGUSTxHandler::StepperStatus(DGUS_VP &vp) { +void DGUSTxHandler::stepperStatus(DGUS_VP &vp) { const bool motor_on = stepper.axis_enabled.bits & (_BV(NUM_AXES) - 1); - dgus_display.Write((uint16_t)vp.addr, Swap16(motor_on ? DGUS_Data::Status::ENABLED : DGUS_Data::Status::DISABLED)); + dgus.write((uint16_t)vp.addr, Swap16(motor_on ? DGUS_Data::Status::ENABLED : DGUS_Data::Status::DISABLED)); } -void DGUSTxHandler::StepIcons(DGUS_VP &vp) { +void DGUSTxHandler::stepIcons(DGUS_VP &vp) { if (!vp.extra) return; uint16_t icons = 0; DGUS_Data::StepSize size = *(DGUS_Data::StepSize*)vp.extra; @@ -307,31 +307,31 @@ void DGUSTxHandler::StepIcons(DGUS_VP &vp) { break; } - dgus_display.Write((uint16_t)vp.addr, Swap16(icons)); + dgus.write((uint16_t)vp.addr, Swap16(icons)); } -void DGUSTxHandler::ABLDisableIcon(DGUS_VP &vp) { +void DGUSTxHandler::ablDisableIcon(DGUS_VP &vp) { uint16_t data; if (ExtUI::getLevelingActive()) { data = (uint16_t)DGUS_Data::Status::ENABLED; - dgus_display.EnableControl(DGUS_Screen::LEVELING_AUTOMATIC, + dgus.enableControl(DGUS_ScreenID::LEVELING_AUTOMATIC, DGUSDisplay::RETURN_KEY_CODE, DGUS_Control::DISABLE); } else { data = (uint16_t)DGUS_Data::Status::DISABLED; - dgus_display.DisableControl(DGUS_Screen::LEVELING_AUTOMATIC, + dgus.disableControl(DGUS_ScreenID::LEVELING_AUTOMATIC, DGUSDisplay::RETURN_KEY_CODE, DGUS_Control::DISABLE); } - dgus_display.Write((uint16_t)vp.addr, Swap16(data)); + dgus.write((uint16_t)vp.addr, Swap16(data)); } -void DGUSTxHandler::ABLGrid(DGUS_VP &vp) { +void DGUSTxHandler::ablGrid(DGUS_VP &vp) { // Batch send int16_t data[DGUS_LEVEL_GRID_SIZE]; xy_uint8_t point; @@ -340,17 +340,17 @@ void DGUSTxHandler::ABLGrid(DGUS_VP &vp) { for (int16_t i = 0; i < DGUS_LEVEL_GRID_SIZE; i++) { point.x = i % (GRID_MAX_POINTS_X); point.y = i / (GRID_MAX_POINTS_X); - fixed = dgus_display.ToFixedPoint(ExtUI::getMeshPoint(point)); + fixed = dgus.toFixedPoint(ExtUI::getMeshPoint(point)); data[i] = Swap16(fixed); } - dgus_display.Write((uint16_t)vp.addr, data, sizeof(*data) * DGUS_LEVEL_GRID_SIZE); + dgus.write((uint16_t)vp.addr, data, sizeof(*data) * DGUS_LEVEL_GRID_SIZE); } -void DGUSTxHandler::FilamentIcons(DGUS_VP &vp) { +void DGUSTxHandler::filamentIcons(DGUS_VP &vp) { uint16_t icons = 0; - switch (dgus_screen_handler.filament_extruder) { + switch (screen.filament_extruder) { default: return; case DGUS_Data::Extruder::CURRENT: #if HAS_MULTI_EXTRUDER @@ -373,29 +373,29 @@ void DGUSTxHandler::FilamentIcons(DGUS_VP &vp) { break; } - dgus_display.Write((uint16_t)vp.addr, Swap16(icons)); + dgus.write((uint16_t)vp.addr, Swap16(icons)); } -void DGUSTxHandler::BLTouch(DGUS_VP &vp) { +void DGUSTxHandler::blTouch(DGUS_VP &vp) { #if ENABLED(BLTOUCH) - dgus_display.EnableControl(DGUS_Screen::SETTINGS_MENU2, + dgus.enableControl(DGUS_ScreenID::SETTINGS_MENU2, DGUSDisplay::RETURN_KEY_CODE, DGUS_Control::EXTRA2); - dgus_display.Write((uint16_t)vp.addr, Swap16(DGUS_Data::Status::ENABLED)); + dgus.write((uint16_t)vp.addr, Swap16(DGUS_Data::Status::ENABLED)); #else - dgus_display.DisableControl(DGUS_Screen::SETTINGS_MENU2, + dgus.disableControl(DGUS_ScreenID::SETTINGS_MENU2, DGUSDisplay::RETURN_KEY_CODE, DGUS_Control::EXTRA2); - dgus_display.Write((uint16_t)vp.addr, Swap16(DGUS_Data::Status::DISABLED)); + dgus.write((uint16_t)vp.addr, Swap16(DGUS_Data::Status::DISABLED)); #endif } -void DGUSTxHandler::PIDIcons(DGUS_VP &vp) { +void DGUSTxHandler::pidIcons(DGUS_VP &vp) { uint16_t icons = 0; - switch (dgus_screen_handler.pid_heater) { + switch (screen.pid_heater) { default: return; case DGUS_Data::Heater::BED: icons |= (uint16_t)DGUS_Data::HeaterIcon::BED; @@ -408,13 +408,13 @@ void DGUSTxHandler::PIDIcons(DGUS_VP &vp) { break; } - dgus_display.Write((uint16_t)vp.addr, Swap16(icons)); + dgus.write((uint16_t)vp.addr, Swap16(icons)); } -void DGUSTxHandler::PIDKp(DGUS_VP &vp) { +void DGUSTxHandler::pidKp(DGUS_VP &vp) { float value; - switch (dgus_screen_handler.pid_heater) { + switch (screen.pid_heater) { default: return; #if ENABLED(PIDTEMPBED) case DGUS_Data::Heater::BED: @@ -433,14 +433,14 @@ void DGUSTxHandler::PIDKp(DGUS_VP &vp) { #endif } - const int32_t data = dgus_display.ToFixedPoint(value); - dgus_display.Write((uint16_t)vp.addr, dgus_display.SwapBytes(data)); + const int32_t data = dgus.toFixedPoint(value); + dgus.write((uint16_t)vp.addr, dgus.swapBytes(data)); } -void DGUSTxHandler::PIDKi(DGUS_VP &vp) { +void DGUSTxHandler::pidKi(DGUS_VP &vp) { float value; - switch (dgus_screen_handler.pid_heater) { + switch (screen.pid_heater) { default: return; #if ENABLED(PIDTEMPBED) case DGUS_Data::Heater::BED: @@ -459,14 +459,14 @@ void DGUSTxHandler::PIDKi(DGUS_VP &vp) { #endif } - const int32_t data = dgus_display.ToFixedPoint(value); - dgus_display.Write((uint16_t)vp.addr, dgus_display.SwapBytes(data)); + const int32_t data = dgus.toFixedPoint(value); + dgus.write((uint16_t)vp.addr, dgus.swapBytes(data)); } -void DGUSTxHandler::PIDKd(DGUS_VP &vp) { +void DGUSTxHandler::pidKd(DGUS_VP &vp) { float value; - switch (dgus_screen_handler.pid_heater) { + switch (screen.pid_heater) { default: return; #if ENABLED(PIDTEMPBED) case DGUS_Data::Heater::BED: @@ -485,99 +485,99 @@ void DGUSTxHandler::PIDKd(DGUS_VP &vp) { #endif } - const int32_t data = dgus_display.ToFixedPoint(value); - dgus_display.Write((uint16_t)vp.addr, dgus_display.SwapBytes(data)); + const int32_t data = dgus.toFixedPoint(value); + dgus.write((uint16_t)vp.addr, dgus.swapBytes(data)); } -void DGUSTxHandler::BuildVolume(DGUS_VP &vp) { +void DGUSTxHandler::buildVolume(DGUS_VP &vp) { char buffer[vp.size]; snprintf_P(buffer, vp.size, PSTR("%dx%dx%d"), X_BED_SIZE, Y_BED_SIZE, (Z_MAX_POS - Z_MIN_POS)); - dgus_display.WriteString((uint16_t)vp.addr, buffer, vp.size); + dgus.writeString((uint16_t)vp.addr, buffer, vp.size); } -void DGUSTxHandler::TotalPrints(DGUS_VP &vp) { +void DGUSTxHandler::totalPrints(DGUS_VP &vp) { #if ENABLED(PRINTCOUNTER) - dgus_display.Write((uint16_t)vp.addr, dgus_display.SwapBytes(print_job_timer.getStats().totalPrints)); + dgus.write((uint16_t)vp.addr, dgus.swapBytes(print_job_timer.getStats().totalPrints)); #else UNUSED(vp); #endif } -void DGUSTxHandler::FinishedPrints(DGUS_VP &vp) { +void DGUSTxHandler::finishedPrints(DGUS_VP &vp) { #if ENABLED(PRINTCOUNTER) - dgus_display.Write((uint16_t)vp.addr, dgus_display.SwapBytes(print_job_timer.getStats().finishedPrints)); + dgus.write((uint16_t)vp.addr, dgus.swapBytes(print_job_timer.getStats().finishedPrints)); #else UNUSED(vp); #endif } -void DGUSTxHandler::PrintTime(DGUS_VP &vp) { +void DGUSTxHandler::printTime(DGUS_VP &vp) { #if ENABLED(PRINTCOUNTER) char buffer[21]; ExtUI::getTotalPrintTime_str(buffer); - dgus_display.WriteString((uint16_t)vp.addr, buffer, vp.size); + dgus.writeString((uint16_t)vp.addr, buffer, vp.size); #else - dgus_display.WriteString((uint16_t)vp.addr, F("-"), vp.size); + dgus.writeString((uint16_t)vp.addr, F("-"), vp.size); #endif } -void DGUSTxHandler::LongestPrint(DGUS_VP &vp) { +void DGUSTxHandler::longestPrint(DGUS_VP &vp) { #if ENABLED(PRINTCOUNTER) char buffer[21]; ExtUI::getLongestPrint_str(buffer); - dgus_display.WriteString((uint16_t)vp.addr, buffer, vp.size); + dgus.writeString((uint16_t)vp.addr, buffer, vp.size); #else - dgus_display.WriteString((uint16_t)vp.addr, F("-"), vp.size); + dgus.writeString((uint16_t)vp.addr, F("-"), vp.size); #endif } -void DGUSTxHandler::FilamentUsed(DGUS_VP &vp) { +void DGUSTxHandler::filamentUsed(DGUS_VP &vp) { #if ENABLED(PRINTCOUNTER) char buffer[21]; ExtUI::getFilamentUsed_str(buffer); - dgus_display.WriteString((uint16_t)vp.addr, buffer, vp.size); + dgus.writeString((uint16_t)vp.addr, buffer, vp.size); #else - dgus_display.WriteString((uint16_t)vp.addr, F("-"), vp.size); + dgus.writeString((uint16_t)vp.addr, F("-"), vp.size); #endif } -void DGUSTxHandler::WaitIcons(DGUS_VP &vp) { +void DGUSTxHandler::waitIcons(DGUS_VP &vp) { uint16_t icons = 0; if (ExtUI::isPrintingPaused()) { icons |= (uint16_t)DGUS_Data::WaitIcon::ABORT; - dgus_display.EnableControl(DGUS_Screen::WAIT, + dgus.enableControl(DGUS_ScreenID::WAIT, DGUSDisplay::POPUP_WINDOW, DGUS_Control::ABORT); } else { - dgus_display.DisableControl(DGUS_Screen::WAIT, + dgus.disableControl(DGUS_ScreenID::WAIT, DGUSDisplay::POPUP_WINDOW, DGUS_Control::ABORT); } - if (dgus_screen_handler.wait_continue) { + if (screen.wait_continue) { icons |= (uint16_t)DGUS_Data::WaitIcon::CONTINUE; - dgus_display.EnableControl(DGUS_Screen::WAIT, + dgus.enableControl(DGUS_ScreenID::WAIT, DGUSDisplay::RETURN_KEY_CODE, DGUS_Control::CONTINUE); } else { - dgus_display.DisableControl(DGUS_Screen::WAIT, + dgus.disableControl(DGUS_ScreenID::WAIT, DGUSDisplay::RETURN_KEY_CODE, DGUS_Control::CONTINUE); } - dgus_display.Write((uint16_t)vp.addr, Swap16(icons)); + dgus.write((uint16_t)vp.addr, Swap16(icons)); } -void DGUSTxHandler::FanSpeed(DGUS_VP &vp) { +void DGUSTxHandler::fanSpeed(DGUS_VP &vp) { uint16_t fan_speed; switch (vp.addr) { @@ -585,31 +585,31 @@ void DGUSTxHandler::FanSpeed(DGUS_VP &vp) { case DGUS_Addr::FAN0_Speed: fan_speed = ExtUI::getTargetFan_percent(ExtUI::FAN0); break; } - dgus_display.Write((uint16_t)vp.addr, Swap16(fan_speed)); + dgus.write((uint16_t)vp.addr, Swap16(fan_speed)); } -void DGUSTxHandler::Volume(DGUS_VP &vp) { - const uint16_t volume = dgus_display.GetVolume(); +void DGUSTxHandler::volume(DGUS_VP &vp) { + const uint16_t volume = dgus.getVolume(); - dgus_display.Write((uint16_t)vp.addr, Swap16(volume)); + dgus.write((uint16_t)vp.addr, Swap16(volume)); } -void DGUSTxHandler::Brightness(DGUS_VP &vp) { - const uint16_t brightness = dgus_display.GetBrightness(); +void DGUSTxHandler::brightness(DGUS_VP &vp) { + const uint16_t brightness = dgus.getBrightness(); - dgus_display.Write((uint16_t)vp.addr, Swap16(brightness)); + dgus.write((uint16_t)vp.addr, Swap16(brightness)); } -void DGUSTxHandler::ExtraToString(DGUS_VP &vp) { +void DGUSTxHandler::extraToString(DGUS_VP &vp) { if (!vp.size || !vp.extra) return; - dgus_display.WriteString((uint16_t)vp.addr, vp.extra, vp.size, true, false, false); + dgus.writeString((uint16_t)vp.addr, vp.extra, vp.size, true, false, false); } -void DGUSTxHandler::ExtraPGMToString(DGUS_VP &vp) { +void DGUSTxHandler::extraPGMToString(DGUS_VP &vp) { if (!vp.size || !vp.extra) return; - dgus_display.WriteStringPGM((uint16_t)vp.addr, vp.extra, vp.size, true, false, false); + dgus.writeStringPGM((uint16_t)vp.addr, vp.extra, vp.size, true, false, false); } #endif // DGUS_LCD_UI_RELOADED diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.h b/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.h index 6e4f1db5dc7e3..c82f4c80dadca 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.h @@ -29,97 +29,97 @@ namespace DGUSTxHandler { #if HAS_MEDIA - void SetFileControlState(int16_t, bool); - void FileType(DGUS_VP &); - void FileName(DGUS_VP &); - void ScrollIcons(DGUS_VP &); - void SelectedFileName(DGUS_VP &); + void setFileControlState(int16_t, bool); + void fileType(DGUS_VP &); + void fileName(DGUS_VP &); + void scrollIcons(DGUS_VP &); + void selectedFileName(DGUS_VP &); #endif - void PositionZ(DGUS_VP &); - void Elapsed(DGUS_VP &); - void Percent(DGUS_VP &); - void StatusIcons(DGUS_VP &); + void zPosition(DGUS_VP &); + void elapsed(DGUS_VP &); + void percent(DGUS_VP &); + void statusIcons(DGUS_VP &); - void Flowrate(DGUS_VP &); + void flowrate(DGUS_VP &); - void TempMax(DGUS_VP &); + void tempMax(DGUS_VP &); - void StepperStatus(DGUS_VP &); + void stepperStatus(DGUS_VP &); - void StepIcons(DGUS_VP &); + void stepIcons(DGUS_VP &); - void ABLDisableIcon(DGUS_VP &); - void ABLGrid(DGUS_VP &); + void ablDisableIcon(DGUS_VP &); + void ablGrid(DGUS_VP &); - void FilamentIcons(DGUS_VP &); + void filamentIcons(DGUS_VP &); - void BLTouch(DGUS_VP &); + void blTouch(DGUS_VP &); - void PIDIcons(DGUS_VP &); - void PIDKp(DGUS_VP &); - void PIDKi(DGUS_VP &); - void PIDKd(DGUS_VP &); + void pidIcons(DGUS_VP &); + void pidKp(DGUS_VP &); + void pidKi(DGUS_VP &); + void pidKd(DGUS_VP &); - void BuildVolume(DGUS_VP &); - void TotalPrints(DGUS_VP &); - void FinishedPrints(DGUS_VP &); - void PrintTime(DGUS_VP &); - void LongestPrint(DGUS_VP &); - void FilamentUsed(DGUS_VP &); + void buildVolume(DGUS_VP &); + void totalPrints(DGUS_VP &); + void finishedPrints(DGUS_VP &); + void printTime(DGUS_VP &); + void longestPrint(DGUS_VP &); + void filamentUsed(DGUS_VP &); - void WaitIcons(DGUS_VP &); + void waitIcons(DGUS_VP &); - void FanSpeed(DGUS_VP &); + void fanSpeed(DGUS_VP &); - void Volume(DGUS_VP &); + void volume(DGUS_VP &); - void Brightness(DGUS_VP &); + void brightness(DGUS_VP &); - void ExtraToString(DGUS_VP &); - void ExtraPGMToString(DGUS_VP &); + void extraToString(DGUS_VP &); + void extraPGMToString(DGUS_VP &); template - void ExtraToInteger(DGUS_VP &vp) { + void extraToInteger(DGUS_VP &vp) { if (!vp.size || !vp.extra) return; switch (vp.size) { default: return; case 1: { const uint8_t data = uint8_t(*(T*)vp.extra); - dgus_display.Write(uint16_t(vp.addr), data); + dgus.write(uint16_t(vp.addr), data); break; } case 2: { const uint16_t data = uint16_t(*(T*)vp.extra); - dgus_display.Write(uint16_t(vp.addr), Swap16(data)); + dgus.write(uint16_t(vp.addr), Swap16(data)); break; } case 4: { const uint32_t data = uint32_t(*(T*)vp.extra); - dgus_display.Write(uint16_t(vp.addr), dgus_display.SwapBytes(data)); + dgus.write(uint16_t(vp.addr), dgus.swapBytes(data)); break; } } } template - void ExtraToFixedPoint(DGUS_VP &vp) { + void extraToFixedPoint(DGUS_VP &vp) { if (!vp.size || !vp.extra) return; switch (vp.size) { default: return; case 1: { - const uint8_t data = dgus_display.ToFixedPoint(*(T*)vp.extra); - dgus_display.Write(uint16_t(vp.addr), data); + const uint8_t data = dgus.toFixedPoint(*(T*)vp.extra); + dgus.write(uint16_t(vp.addr), data); break; } case 2: { - const uint16_t data = dgus_display.ToFixedPoint(*(T*)vp.extra); - dgus_display.Write(uint16_t(vp.addr), Swap16(data)); + const uint16_t data = dgus.toFixedPoint(*(T*)vp.extra); + dgus.write(uint16_t(vp.addr), Swap16(data)); break; } case 4: { - const uint32_t data = dgus_display.ToFixedPoint(*(T*)vp.extra); - dgus_display.Write(uint16_t(vp.addr), dgus_display.SwapBytes(data)); + const uint32_t data = dgus.toFixedPoint(*(T*)vp.extra); + dgus.write(uint16_t(vp.addr), dgus.swapBytes(data)); break; } } diff --git a/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Screen.h b/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_ScreenID.h similarity index 97% rename from Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Screen.h rename to Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_ScreenID.h index 0a738223ce364..546ebb466665f 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Screen.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_ScreenID.h @@ -21,7 +21,7 @@ */ #pragma once -enum class DGUS_Screen : uint8_t { +enum class DGUS_ScreenID : uint8_t { BOOT = 0, HOME = 1, PRINT = 2, diff --git a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenAddrList.cpp b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenAddrList.cpp index 4c99ff6a0089c..1a99eceeff3a3 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenAddrList.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenAddrList.cpp @@ -204,37 +204,35 @@ constexpr DGUS_Addr LIST_WAIT[] PROGMEM = { (DGUS_Addr)0 }; -#define MAP_HELPER(SCREEN, LIST) \ - { .screen = SCREEN, \ - .addr_list = LIST } +#define MAP_HELPER(SCREEN, LIST) { .screenID = SCREEN, .addr_list = LIST } const struct DGUS_ScreenAddrList screen_addr_list_map[] PROGMEM = { - MAP_HELPER(DGUS_Screen::HOME, LIST_HOME), + MAP_HELPER(DGUS_ScreenID::HOME, LIST_HOME), #if HAS_MEDIA - MAP_HELPER(DGUS_Screen::PRINT, LIST_PRINT), + MAP_HELPER(DGUS_ScreenID::PRINT, LIST_PRINT), #endif - MAP_HELPER(DGUS_Screen::PRINT_STATUS, LIST_PRINT_STATUS), - MAP_HELPER(DGUS_Screen::PRINT_ADJUST, LIST_PRINT_ADJUST), - MAP_HELPER(DGUS_Screen::PRINT_FINISHED, LIST_PRINT_FINISHED), - MAP_HELPER(DGUS_Screen::TEMP_MENU, LIST_TEMP_MENU), - MAP_HELPER(DGUS_Screen::TEMP_MANUAL, LIST_TEMP_MANUAL), - MAP_HELPER(DGUS_Screen::FAN, LIST_FAN), - MAP_HELPER(DGUS_Screen::SETTINGS_MENU, LIST_SETTINGS_MENU), - MAP_HELPER(DGUS_Screen::LEVELING_OFFSET, LIST_LEVELING_OFFSET), - MAP_HELPER(DGUS_Screen::LEVELING_MANUAL, LIST_LEVELING_MANUAL), - MAP_HELPER(DGUS_Screen::LEVELING_AUTOMATIC, LIST_LEVELING_AUTOMATIC), - MAP_HELPER(DGUS_Screen::LEVELING_PROBING, LIST_LEVELING_PROBING), - MAP_HELPER(DGUS_Screen::FILAMENT, LIST_FILAMENT), - MAP_HELPER(DGUS_Screen::MOVE, LIST_MOVE), - MAP_HELPER(DGUS_Screen::GCODE, LIST_GCODE), - MAP_HELPER(DGUS_Screen::SETTINGS_MENU2, LIST_SETTINGS_MENU2), - MAP_HELPER(DGUS_Screen::PID, LIST_PID), - MAP_HELPER(DGUS_Screen::VOLUME, LIST_VOLUME), - MAP_HELPER(DGUS_Screen::BRIGHTNESS, LIST_BRIGHTNESS), - MAP_HELPER(DGUS_Screen::INFOS, LIST_INFOS), - MAP_HELPER(DGUS_Screen::WAIT, LIST_WAIT), - - MAP_HELPER((DGUS_Screen)0, nullptr) + MAP_HELPER(DGUS_ScreenID::PRINT_STATUS, LIST_PRINT_STATUS), + MAP_HELPER(DGUS_ScreenID::PRINT_ADJUST, LIST_PRINT_ADJUST), + MAP_HELPER(DGUS_ScreenID::PRINT_FINISHED, LIST_PRINT_FINISHED), + MAP_HELPER(DGUS_ScreenID::TEMP_MENU, LIST_TEMP_MENU), + MAP_HELPER(DGUS_ScreenID::TEMP_MANUAL, LIST_TEMP_MANUAL), + MAP_HELPER(DGUS_ScreenID::FAN, LIST_FAN), + MAP_HELPER(DGUS_ScreenID::SETTINGS_MENU, LIST_SETTINGS_MENU), + MAP_HELPER(DGUS_ScreenID::LEVELING_OFFSET, LIST_LEVELING_OFFSET), + MAP_HELPER(DGUS_ScreenID::LEVELING_MANUAL, LIST_LEVELING_MANUAL), + MAP_HELPER(DGUS_ScreenID::LEVELING_AUTOMATIC, LIST_LEVELING_AUTOMATIC), + MAP_HELPER(DGUS_ScreenID::LEVELING_PROBING, LIST_LEVELING_PROBING), + MAP_HELPER(DGUS_ScreenID::FILAMENT, LIST_FILAMENT), + MAP_HELPER(DGUS_ScreenID::MOVE, LIST_MOVE), + MAP_HELPER(DGUS_ScreenID::GCODE, LIST_GCODE), + MAP_HELPER(DGUS_ScreenID::SETTINGS_MENU2, LIST_SETTINGS_MENU2), + MAP_HELPER(DGUS_ScreenID::PID, LIST_PID), + MAP_HELPER(DGUS_ScreenID::VOLUME, LIST_VOLUME), + MAP_HELPER(DGUS_ScreenID::BRIGHTNESS, LIST_BRIGHTNESS), + MAP_HELPER(DGUS_ScreenID::INFOS, LIST_INFOS), + MAP_HELPER(DGUS_ScreenID::WAIT, LIST_WAIT), + + MAP_HELPER((DGUS_ScreenID)0, nullptr) }; #endif // DGUS_LCD_UI_RELOADED diff --git a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenAddrList.h b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenAddrList.h index 1e481ef3cce61..dea39ed145ad6 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenAddrList.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenAddrList.h @@ -21,12 +21,12 @@ */ #pragma once -#include "../config/DGUS_Screen.h" +#include "../config/DGUS_ScreenID.h" #include "../config/DGUS_Addr.h" struct DGUS_ScreenAddrList { - DGUS_Screen screen; - const DGUS_Addr *addr_list; + DGUS_ScreenID screenID; + const DGUS_Addr *addr_list; }; extern const struct DGUS_ScreenAddrList screen_addr_list_map[]; diff --git a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenSetup.cpp b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenSetup.cpp index e3ba393af25b2..e01f6ab3a6bba 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenSetup.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenSetup.cpp @@ -30,28 +30,26 @@ #include "../../ui_api.h" -#define SETUP_HELPER(SCREEN, SETUP) \ - { .screen = SCREEN, \ - .setup_fn = SETUP } +#define SETUP_HELPER(SCREEN, SETUP) { .screenID = SCREEN, .setup_fn = SETUP } const struct DGUS_ScreenSetup screen_setup_list[] PROGMEM = { #if HAS_MEDIA - SETUP_HELPER(DGUS_Screen::PRINT, &DGUSSetupHandler::Print), + SETUP_HELPER(DGUS_ScreenID::PRINT, &DGUSSetupHandler::Print), #endif - SETUP_HELPER(DGUS_Screen::PRINT_STATUS, &DGUSSetupHandler::PrintStatus), - SETUP_HELPER(DGUS_Screen::PRINT_ADJUST, &DGUSSetupHandler::PrintAdjust), - SETUP_HELPER(DGUS_Screen::LEVELING_MENU, &DGUSSetupHandler::LevelingMenu), - SETUP_HELPER(DGUS_Screen::LEVELING_OFFSET, &DGUSSetupHandler::LevelingOffset), - SETUP_HELPER(DGUS_Screen::LEVELING_MANUAL, &DGUSSetupHandler::LevelingManual), - SETUP_HELPER(DGUS_Screen::LEVELING_AUTOMATIC, &DGUSSetupHandler::LevelingAutomatic), - SETUP_HELPER(DGUS_Screen::LEVELING_PROBING, &DGUSSetupHandler::LevelingProbing), - SETUP_HELPER(DGUS_Screen::FILAMENT, &DGUSSetupHandler::Filament), - SETUP_HELPER(DGUS_Screen::MOVE, &DGUSSetupHandler::Move), - SETUP_HELPER(DGUS_Screen::GCODE, &DGUSSetupHandler::Gcode), - SETUP_HELPER(DGUS_Screen::PID, &DGUSSetupHandler::PID), - SETUP_HELPER(DGUS_Screen::INFOS, &DGUSSetupHandler::Infos), - - SETUP_HELPER((DGUS_Screen)0, nullptr) + SETUP_HELPER(DGUS_ScreenID::PRINT_STATUS, &DGUSSetupHandler::PrintStatus), + SETUP_HELPER(DGUS_ScreenID::PRINT_ADJUST, &DGUSSetupHandler::PrintAdjust), + SETUP_HELPER(DGUS_ScreenID::LEVELING_MENU, &DGUSSetupHandler::LevelingMenu), + SETUP_HELPER(DGUS_ScreenID::LEVELING_OFFSET, &DGUSSetupHandler::LevelingOffset), + SETUP_HELPER(DGUS_ScreenID::LEVELING_MANUAL, &DGUSSetupHandler::LevelingManual), + SETUP_HELPER(DGUS_ScreenID::LEVELING_AUTOMATIC, &DGUSSetupHandler::LevelingAutomatic), + SETUP_HELPER(DGUS_ScreenID::LEVELING_PROBING, &DGUSSetupHandler::LevelingProbing), + SETUP_HELPER(DGUS_ScreenID::FILAMENT, &DGUSSetupHandler::Filament), + SETUP_HELPER(DGUS_ScreenID::MOVE, &DGUSSetupHandler::Move), + SETUP_HELPER(DGUS_ScreenID::GCODE, &DGUSSetupHandler::Gcode), + SETUP_HELPER(DGUS_ScreenID::PID, &DGUSSetupHandler::PID), + SETUP_HELPER(DGUS_ScreenID::INFOS, &DGUSSetupHandler::Infos), + + SETUP_HELPER((DGUS_ScreenID)0, nullptr) }; #endif // DGUS_LCD_UI_RELOADED diff --git a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenSetup.h b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenSetup.h index 93df5ad90ae6d..e740997ad446e 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenSetup.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenSetup.h @@ -21,10 +21,10 @@ */ #pragma once -#include "../config/DGUS_Screen.h" +#include "../config/DGUS_ScreenID.h" struct DGUS_ScreenSetup { - DGUS_Screen screen; + DGUS_ScreenID screenID; bool (*setup_fn)(void); }; diff --git a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.cpp b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.cpp index 69f792c45d1bb..172cf98fe6f60 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.cpp @@ -75,248 +75,248 @@ const struct DGUS_VP vp_list[] PROGMEM = { // READ-ONLY VARIABLES - VP_HELPER_RX(DGUS_Addr::SCREENCHANGE, &DGUSRxHandler::ScreenChange), - VP_HELPER_RX(DGUS_Addr::SCREENCHANGE_SD, &DGUSRxHandler::ScreenChange), - VP_HELPER_RX(DGUS_Addr::SCREENCHANGE_Idle, &DGUSRxHandler::ScreenChange), - VP_HELPER_RX(DGUS_Addr::SCREENCHANGE_Printing, &DGUSRxHandler::ScreenChange), + VP_HELPER_RX(DGUS_Addr::SCREENCHANGE, &DGUSRxHandler::screenChange), + VP_HELPER_RX(DGUS_Addr::SCREENCHANGE_SD, &DGUSRxHandler::screenChange), + VP_HELPER_RX(DGUS_Addr::SCREENCHANGE_Idle, &DGUSRxHandler::screenChange), + VP_HELPER_RX(DGUS_Addr::SCREENCHANGE_Printing, &DGUSRxHandler::screenChange), #if HAS_MEDIA VP_HELPER_RX(DGUS_Addr::SD_SelectFile, &DGUSRxHandler::selectFile), - VP_HELPER_RX(DGUS_Addr::SD_Scroll, &DGUSRxHandler::Scroll), - VP_HELPER_RX_NODATA(DGUS_Addr::SD_Print, &DGUSRxHandler::PrintFile), + VP_HELPER_RX(DGUS_Addr::SD_Scroll, &DGUSRxHandler::scroll), + VP_HELPER_RX_NODATA(DGUS_Addr::SD_Print, &DGUSRxHandler::printFile), #endif - VP_HELPER_RX(DGUS_Addr::STATUS_Abort, &DGUSRxHandler::PrintAbort), - VP_HELPER_RX(DGUS_Addr::STATUS_Pause, &DGUSRxHandler::PrintPause), - VP_HELPER_RX(DGUS_Addr::STATUS_Resume, &DGUSRxHandler::PrintResume), + VP_HELPER_RX(DGUS_Addr::STATUS_Abort, &DGUSRxHandler::printAbort), + VP_HELPER_RX(DGUS_Addr::STATUS_Pause, &DGUSRxHandler::printPause), + VP_HELPER_RX(DGUS_Addr::STATUS_Resume, &DGUSRxHandler::printResume), - VP_HELPER_RX(DGUS_Addr::ADJUST_SetFeedrate, &DGUSRxHandler::Feedrate), - VP_HELPER_RX(DGUS_Addr::ADJUST_SetFlowrate_CUR, &DGUSRxHandler::Flowrate), + VP_HELPER_RX(DGUS_Addr::ADJUST_SetFeedrate, &DGUSRxHandler::feedrate), + VP_HELPER_RX(DGUS_Addr::ADJUST_SetFlowrate_CUR, &DGUSRxHandler::flowrate), #if HAS_MULTI_EXTRUDER - VP_HELPER_RX(DGUS_Addr::ADJUST_SetFlowrate_E0, &DGUSRxHandler::Flowrate), - VP_HELPER_RX(DGUS_Addr::ADJUST_SetFlowrate_E1, &DGUSRxHandler::Flowrate), + VP_HELPER_RX(DGUS_Addr::ADJUST_SetFlowrate_E0, &DGUSRxHandler::flowrate), + VP_HELPER_RX(DGUS_Addr::ADJUST_SetFlowrate_E1, &DGUSRxHandler::flowrate), #endif - VP_HELPER_RX(DGUS_Addr::ADJUST_SetBabystep, &DGUSRxHandler::BabystepSet), - VP_HELPER_RX(DGUS_Addr::ADJUST_Babystep, &DGUSRxHandler::Babystep), + VP_HELPER_RX(DGUS_Addr::ADJUST_SetBabystep, &DGUSRxHandler::babystepSet), + VP_HELPER_RX(DGUS_Addr::ADJUST_Babystep, &DGUSRxHandler::babystep), - VP_HELPER_RX(DGUS_Addr::TEMP_Preset, &DGUSRxHandler::TempPreset), - VP_HELPER_RX(DGUS_Addr::TEMP_SetTarget_Bed, &DGUSRxHandler::TempTarget), - VP_HELPER_RX(DGUS_Addr::TEMP_SetTarget_H0, &DGUSRxHandler::TempTarget), + VP_HELPER_RX(DGUS_Addr::TEMP_Preset, &DGUSRxHandler::tempPreset), + VP_HELPER_RX(DGUS_Addr::TEMP_SetTarget_Bed, &DGUSRxHandler::tempTarget), + VP_HELPER_RX(DGUS_Addr::TEMP_SetTarget_H0, &DGUSRxHandler::tempTarget), #if HAS_MULTI_HOTEND - VP_HELPER_RX(DGUS_Addr::TEMP_SetTarget_H1, &DGUSRxHandler::TempTarget), + VP_HELPER_RX(DGUS_Addr::TEMP_SetTarget_H1, &DGUSRxHandler::tempTarget), #endif - VP_HELPER_RX(DGUS_Addr::TEMP_Cool, &DGUSRxHandler::TempCool), + VP_HELPER_RX(DGUS_Addr::TEMP_Cool, &DGUSRxHandler::tempCool), - VP_HELPER_RX(DGUS_Addr::STEPPER_Control, &DGUSRxHandler::Steppers), + VP_HELPER_RX(DGUS_Addr::STEPPER_Control, &DGUSRxHandler::steppers), - VP_HELPER_RX(DGUS_Addr::LEVEL_OFFSET_Set, &DGUSRxHandler::ZOffset), - VP_HELPER_RX(DGUS_Addr::LEVEL_OFFSET_Step, &DGUSRxHandler::ZOffsetStep), - VP_HELPER_RX(DGUS_Addr::LEVEL_OFFSET_SetStep, &DGUSRxHandler::ZOffsetSetStep), + VP_HELPER_RX(DGUS_Addr::LEVEL_OFFSET_Set, &DGUSRxHandler::zOffset), + VP_HELPER_RX(DGUS_Addr::LEVEL_OFFSET_Step, &DGUSRxHandler::zOffsetStep), + VP_HELPER_RX(DGUS_Addr::LEVEL_OFFSET_SetStep, &DGUSRxHandler::zOffsetSetStep), - VP_HELPER_RX(DGUS_Addr::LEVEL_MANUAL_Point, &DGUSRxHandler::MoveToPoint), + VP_HELPER_RX(DGUS_Addr::LEVEL_MANUAL_Point, &DGUSRxHandler::moveToPoint), - VP_HELPER_RX_NODATA(DGUS_Addr::LEVEL_AUTO_Probe, &DGUSRxHandler::Probe), - VP_HELPER_RX_NODATA(DGUS_Addr::LEVEL_AUTO_Disable, &DGUSRxHandler::DisableABL), + VP_HELPER_RX_NODATA(DGUS_Addr::LEVEL_AUTO_Probe, &DGUSRxHandler::probe), + VP_HELPER_RX_NODATA(DGUS_Addr::LEVEL_AUTO_Disable, &DGUSRxHandler::disableABL), - VP_HELPER_RX(DGUS_Addr::FILAMENT_Select, &DGUSRxHandler::FilamentSelect), - VP_HELPER_RX(DGUS_Addr::FILAMENT_SetLength, &DGUSRxHandler::FilamentLength), - VP_HELPER_RX(DGUS_Addr::FILAMENT_Move, &DGUSRxHandler::FilamentMove), + VP_HELPER_RX(DGUS_Addr::FILAMENT_Select, &DGUSRxHandler::filamentSelect), + VP_HELPER_RX(DGUS_Addr::FILAMENT_SetLength, &DGUSRxHandler::filamentLength), + VP_HELPER_RX(DGUS_Addr::FILAMENT_Move, &DGUSRxHandler::filamentMove), - VP_HELPER_RX(DGUS_Addr::MOVE_Home, &DGUSRxHandler::Home), - VP_HELPER_RX(DGUS_Addr::MOVE_SetX, &DGUSRxHandler::Move), - VP_HELPER_RX(DGUS_Addr::MOVE_SetY, &DGUSRxHandler::Move), - VP_HELPER_RX(DGUS_Addr::MOVE_SetZ, &DGUSRxHandler::Move), - VP_HELPER_RX(DGUS_Addr::MOVE_Step, &DGUSRxHandler::MoveStep), - VP_HELPER_RX(DGUS_Addr::MOVE_SetStep, &DGUSRxHandler::MoveSetStep), + VP_HELPER_RX(DGUS_Addr::MOVE_Home, &DGUSRxHandler::home), + VP_HELPER_RX(DGUS_Addr::MOVE_SetX, &DGUSRxHandler::move), + VP_HELPER_RX(DGUS_Addr::MOVE_SetY, &DGUSRxHandler::move), + VP_HELPER_RX(DGUS_Addr::MOVE_SetZ, &DGUSRxHandler::move), + VP_HELPER_RX(DGUS_Addr::MOVE_Step, &DGUSRxHandler::moveStep), + VP_HELPER_RX(DGUS_Addr::MOVE_SetStep, &DGUSRxHandler::moveSetStep), - VP_HELPER_RX_NODATA(DGUS_Addr::GCODE_Clear, &DGUSRxHandler::GcodeClear), - VP_HELPER_RX_NODATA(DGUS_Addr::GCODE_Execute, &DGUSRxHandler::GcodeExecute), + VP_HELPER_RX_NODATA(DGUS_Addr::GCODE_Clear, &DGUSRxHandler::gcodeClear), + VP_HELPER_RX_NODATA(DGUS_Addr::GCODE_Execute, &DGUSRxHandler::gcodeExecute), - VP_HELPER_RX(DGUS_Addr::EEPROM_Reset, &DGUSRxHandler::ResetEEPROM), + VP_HELPER_RX(DGUS_Addr::EEPROM_Reset, &DGUSRxHandler::resetEEPROM), - VP_HELPER_RX(DGUS_Addr::SETTINGS2_Extra, &DGUSRxHandler::SettingsExtra), + VP_HELPER_RX(DGUS_Addr::SETTINGS2_Extra, &DGUSRxHandler::settingsExtra), - VP_HELPER_RX(DGUS_Addr::PID_Select, &DGUSRxHandler::PIDSelect), - VP_HELPER_RX(DGUS_Addr::PID_SetTemp, &DGUSRxHandler::PIDSetTemp), - VP_HELPER_RX_NODATA(DGUS_Addr::PID_Run, &DGUSRxHandler::PIDRun), + VP_HELPER_RX(DGUS_Addr::PID_Select, &DGUSRxHandler::pidSelect), + VP_HELPER_RX(DGUS_Addr::PID_SetTemp, &DGUSRxHandler::pidSetTemp), + VP_HELPER_RX_NODATA(DGUS_Addr::PID_Run, &DGUSRxHandler::pidRun), #if ENABLED(POWER_LOSS_RECOVERY) - VP_HELPER_RX(DGUS_Addr::POWERLOSS_Abort, &DGUSRxHandler::PowerLossAbort), - VP_HELPER_RX(DGUS_Addr::POWERLOSS_Resume, &DGUSRxHandler::PowerLossResume), + VP_HELPER_RX(DGUS_Addr::POWERLOSS_Abort, &DGUSRxHandler::powerLossAbort), + VP_HELPER_RX(DGUS_Addr::POWERLOSS_Resume, &DGUSRxHandler::powerLossResume), #endif - VP_HELPER_RX(DGUS_Addr::WAIT_Abort, &DGUSRxHandler::WaitAbort), - VP_HELPER_RX_NODATA(DGUS_Addr::WAIT_Continue, &DGUSRxHandler::WaitContinue), + VP_HELPER_RX(DGUS_Addr::WAIT_Abort, &DGUSRxHandler::waitAbort), + VP_HELPER_RX_NODATA(DGUS_Addr::WAIT_Continue, &DGUSRxHandler::waitContinue), // WRITE-ONLY VARIABLES #if HAS_MEDIA - VP_HELPER_TX(DGUS_Addr::SD_Type, &DGUSTxHandler::FileType), + VP_HELPER_TX(DGUS_Addr::SD_Type, &DGUSTxHandler::fileType), VP_HELPER_TX_SIZE(DGUS_Addr::SD_FileName0, DGUS_FILENAME_LEN, - &DGUSTxHandler::FileName), + &DGUSTxHandler::fileName), VP_HELPER_TX_SIZE(DGUS_Addr::SD_FileName1, DGUS_FILENAME_LEN, - &DGUSTxHandler::FileName), + &DGUSTxHandler::fileName), VP_HELPER_TX_SIZE(DGUS_Addr::SD_FileName2, DGUS_FILENAME_LEN, - &DGUSTxHandler::FileName), + &DGUSTxHandler::fileName), VP_HELPER_TX_SIZE(DGUS_Addr::SD_FileName3, DGUS_FILENAME_LEN, - &DGUSTxHandler::FileName), + &DGUSTxHandler::fileName), VP_HELPER_TX_SIZE(DGUS_Addr::SD_FileName4, DGUS_FILENAME_LEN, - &DGUSTxHandler::FileName), - VP_HELPER_TX(DGUS_Addr::SD_ScrollIcons, &DGUSTxHandler::ScrollIcons), + &DGUSTxHandler::fileName), + VP_HELPER_TX(DGUS_Addr::SD_ScrollIcons, &DGUSTxHandler::scrollIcons), VP_HELPER_TX_SIZE(DGUS_Addr::SD_SelectedFileName, DGUS_FILENAME_LEN, - &DGUSTxHandler::SelectedFileName), + &DGUSTxHandler::selectedFileName), #endif VP_HELPER_TX_AUTO(DGUS_Addr::STATUS_PositionZ, nullptr, - &DGUSTxHandler::PositionZ), + &DGUSTxHandler::zPosition), VP_HELPER(DGUS_Addr::STATUS_Elapsed, DGUS_ELAPSED_LEN, VPFLAG_AUTOUPLOAD, nullptr, nullptr, - &DGUSTxHandler::Elapsed), + &DGUSTxHandler::elapsed), VP_HELPER_TX_AUTO(DGUS_Addr::STATUS_Percent, nullptr, - &DGUSTxHandler::Percent), - VP_HELPER_TX(DGUS_Addr::STATUS_Icons, &DGUSTxHandler::StatusIcons), + &DGUSTxHandler::percent), + VP_HELPER_TX(DGUS_Addr::STATUS_Icons, &DGUSTxHandler::statusIcons), VP_HELPER_TX_AUTO(DGUS_Addr::ADJUST_Feedrate, &feedrate_percentage, - &DGUSTxHandler::ExtraToInteger), + &DGUSTxHandler::extraToInteger), VP_HELPER_TX_AUTO(DGUS_Addr::ADJUST_Flowrate_CUR, nullptr, - &DGUSTxHandler::Flowrate), + &DGUSTxHandler::flowrate), #if HAS_MULTI_EXTRUDER VP_HELPER_TX_AUTO(DGUS_Addr::ADJUST_Flowrate_E0, nullptr, - &DGUSTxHandler::Flowrate), + &DGUSTxHandler::flowrate), VP_HELPER_TX_AUTO(DGUS_Addr::ADJUST_Flowrate_E1, nullptr, - &DGUSTxHandler::Flowrate), + &DGUSTxHandler::flowrate), #endif VP_HELPER_TX_AUTO(DGUS_Addr::TEMP_Current_Bed, &thermalManager.temp_bed.celsius, - (&DGUSTxHandler::ExtraToFixedPoint)), + (&DGUSTxHandler::extraToFixedPoint)), VP_HELPER_TX_AUTO(DGUS_Addr::TEMP_Target_Bed, &thermalManager.temp_bed.target, - &DGUSTxHandler::ExtraToInteger), - VP_HELPER_TX(DGUS_Addr::TEMP_Max_Bed, &DGUSTxHandler::TempMax), + &DGUSTxHandler::extraToInteger), + VP_HELPER_TX(DGUS_Addr::TEMP_Max_Bed, &DGUSTxHandler::tempMax), VP_HELPER_TX_AUTO(DGUS_Addr::TEMP_Current_H0, &thermalManager.temp_hotend[ExtUI::heater_t::H0].celsius, - (&DGUSTxHandler::ExtraToFixedPoint)), + (&DGUSTxHandler::extraToFixedPoint)), VP_HELPER_TX_AUTO(DGUS_Addr::TEMP_Target_H0, &thermalManager.temp_hotend[ExtUI::heater_t::H0].target, - &DGUSTxHandler::ExtraToInteger), - VP_HELPER_TX(DGUS_Addr::TEMP_Max_H0, &DGUSTxHandler::TempMax), + &DGUSTxHandler::extraToInteger), + VP_HELPER_TX(DGUS_Addr::TEMP_Max_H0, &DGUSTxHandler::tempMax), #if HAS_MULTI_HOTEND VP_HELPER_TX_AUTO(DGUS_Addr::TEMP_Current_H1, &thermalManager.temp_hotend[ExtUI::heater_t::H1].celsius, - (&DGUSTxHandler::ExtraToFixedPoint)), + (&DGUSTxHandler::extraToFixedPoint)), VP_HELPER_TX_AUTO(DGUS_Addr::TEMP_Target_H1, &thermalManager.temp_hotend[ExtUI::heater_t::H1].target, - &DGUSTxHandler::ExtraToInteger), - VP_HELPER_TX(DGUS_Addr::TEMP_Max_H1, &DGUSTxHandler::TempMax), + &DGUSTxHandler::extraToInteger), + VP_HELPER_TX(DGUS_Addr::TEMP_Max_H1, &DGUSTxHandler::tempMax), #endif VP_HELPER_TX_AUTO(DGUS_Addr::STEPPER_Status, nullptr, - &DGUSTxHandler::StepperStatus), + &DGUSTxHandler::stepperStatus), VP_HELPER_TX_AUTO(DGUS_Addr::LEVEL_OFFSET_Current, &probe.offset.z, - (&DGUSTxHandler::ExtraToFixedPoint)), + (&DGUSTxHandler::extraToFixedPoint)), VP_HELPER_TX_EXTRA(DGUS_Addr::LEVEL_OFFSET_StepIcons, &DGUSScreenHandler::offset_steps, - &DGUSTxHandler::StepIcons), + &DGUSTxHandler::stepIcons), VP_HELPER_TX_AUTO(DGUS_Addr::LEVEL_AUTO_DisableIcon, nullptr, - &DGUSTxHandler::ABLDisableIcon), - VP_HELPER_TX(DGUS_Addr::LEVEL_AUTO_Grid, &DGUSTxHandler::ABLGrid), + &DGUSTxHandler::ablDisableIcon), + VP_HELPER_TX(DGUS_Addr::LEVEL_AUTO_Grid, &DGUSTxHandler::ablGrid), VP_HELPER_TX_EXTRA(DGUS_Addr::LEVEL_PROBING_Icons1, &DGUSScreenHandler::probing_icons[0], - &DGUSTxHandler::ExtraToInteger), + &DGUSTxHandler::extraToInteger), VP_HELPER_TX_EXTRA(DGUS_Addr::LEVEL_PROBING_Icons2, &DGUSScreenHandler::probing_icons[1], - &DGUSTxHandler::ExtraToInteger), + &DGUSTxHandler::extraToInteger), - VP_HELPER_TX(DGUS_Addr::FILAMENT_ExtruderIcons, &DGUSTxHandler::FilamentIcons), + VP_HELPER_TX(DGUS_Addr::FILAMENT_ExtruderIcons, &DGUSTxHandler::filamentIcons), VP_HELPER_TX_EXTRA(DGUS_Addr::FILAMENT_Length, &DGUSScreenHandler::filament_length, - &DGUSTxHandler::ExtraToInteger), + &DGUSTxHandler::extraToInteger), VP_HELPER_TX_AUTO(DGUS_Addr::MOVE_CurrentX, ¤t_position.x, - (&DGUSTxHandler::ExtraToFixedPoint)), + (&DGUSTxHandler::extraToFixedPoint)), VP_HELPER_TX_AUTO(DGUS_Addr::MOVE_CurrentY, ¤t_position.y, - (&DGUSTxHandler::ExtraToFixedPoint)), + (&DGUSTxHandler::extraToFixedPoint)), VP_HELPER_TX_AUTO(DGUS_Addr::MOVE_CurrentZ, ¤t_position.z, - (&DGUSTxHandler::ExtraToFixedPoint)), + (&DGUSTxHandler::extraToFixedPoint)), VP_HELPER_TX_EXTRA(DGUS_Addr::MOVE_StepIcons, &DGUSScreenHandler::move_steps, - &DGUSTxHandler::StepIcons), + &DGUSTxHandler::stepIcons), - VP_HELPER_TX(DGUS_Addr::SETTINGS2_BLTouch, &DGUSTxHandler::BLTouch), + VP_HELPER_TX(DGUS_Addr::SETTINGS2_BLTouch, &DGUSTxHandler::blTouch), - VP_HELPER_TX(DGUS_Addr::PID_HeaterIcons, &DGUSTxHandler::PIDIcons), + VP_HELPER_TX(DGUS_Addr::PID_HeaterIcons, &DGUSTxHandler::pidIcons), VP_HELPER_TX_EXTRA(DGUS_Addr::PID_Temp, &DGUSScreenHandler::pid_temp, - &DGUSTxHandler::ExtraToInteger), + &DGUSTxHandler::extraToInteger), VP_HELPER_DWORD(DGUS_Addr::PID_Kp, VPFLAG_AUTOUPLOAD, nullptr, nullptr, - &DGUSTxHandler::PIDKp), + &DGUSTxHandler::pidKp), VP_HELPER_DWORD(DGUS_Addr::PID_Ki, VPFLAG_AUTOUPLOAD, nullptr, nullptr, - &DGUSTxHandler::PIDKi), + &DGUSTxHandler::pidKi), VP_HELPER_DWORD(DGUS_Addr::PID_Kd, VPFLAG_AUTOUPLOAD, nullptr, nullptr, - &DGUSTxHandler::PIDKd), + &DGUSTxHandler::pidKd), VP_HELPER(DGUS_Addr::INFOS_Machine, DGUS_MACHINE_LEN, VPFLAG_NONE, (void*)DGUS_MACHINENAME, nullptr, - &DGUSTxHandler::ExtraPGMToString), + &DGUSTxHandler::extraPGMToString), VP_HELPER_TX_SIZE(DGUS_Addr::INFOS_BuildVolume, DGUS_BUILDVOLUME_LEN, - &DGUSTxHandler::BuildVolume), + &DGUSTxHandler::buildVolume), VP_HELPER(DGUS_Addr::INFOS_Version, DGUS_VERSION_LEN, VPFLAG_NONE, (void*)DGUS_MARLINVERSION, nullptr, - &DGUSTxHandler::ExtraPGMToString), - VP_HELPER_TX(DGUS_Addr::INFOS_TotalPrints, &DGUSTxHandler::TotalPrints), - VP_HELPER_TX(DGUS_Addr::INFOS_FinishedPrints, &DGUSTxHandler::FinishedPrints), + &DGUSTxHandler::extraPGMToString), + VP_HELPER_TX(DGUS_Addr::INFOS_TotalPrints, &DGUSTxHandler::totalPrints), + VP_HELPER_TX(DGUS_Addr::INFOS_FinishedPrints, &DGUSTxHandler::finishedPrints), VP_HELPER_TX_SIZE(DGUS_Addr::INFOS_PrintTime, DGUS_PRINTTIME_LEN, - &DGUSTxHandler::PrintTime), + &DGUSTxHandler::printTime), VP_HELPER_TX_SIZE(DGUS_Addr::INFOS_LongestPrint, DGUS_LONGESTPRINT_LEN, - &DGUSTxHandler::LongestPrint), + &DGUSTxHandler::longestPrint), VP_HELPER_TX_SIZE(DGUS_Addr::INFOS_FilamentUsed, DGUS_FILAMENTUSED_LEN, - &DGUSTxHandler::FilamentUsed), + &DGUSTxHandler::filamentUsed), - VP_HELPER_TX(DGUS_Addr::WAIT_Icons, &DGUSTxHandler::WaitIcons), + VP_HELPER_TX(DGUS_Addr::WAIT_Icons, &DGUSTxHandler::waitIcons), // READ-WRITE VARIABLES @@ -324,41 +324,41 @@ const struct DGUS_VP vp_list[] PROGMEM = { 2, VPFLAG_AUTOUPLOAD, nullptr, - &DGUSRxHandler::FanSpeed, - &DGUSTxHandler::FanSpeed), + &DGUSRxHandler::fanSpeed, + &DGUSTxHandler::fanSpeed), VP_HELPER(DGUS_Addr::GCODE_Data, DGUS_GCODE_LEN, VPFLAG_RXSTRING, (void*)DGUSScreenHandler::gcode, - &DGUSRxHandler::StringToExtra, - &DGUSTxHandler::ExtraToString), + &DGUSRxHandler::stringToExtra, + &DGUSTxHandler::extraToString), VP_HELPER(DGUS_Addr::PID_Cycles, 2, VPFLAG_NONE, &DGUSScreenHandler::pid_cycles, - &DGUSRxHandler::IntegerToExtra, - &DGUSTxHandler::ExtraToInteger), + &DGUSRxHandler::integerToExtra, + &DGUSTxHandler::extraToInteger), VP_HELPER(DGUS_Addr::VOLUME_Level, 2, VPFLAG_NONE, nullptr, - &DGUSRxHandler::Volume, - &DGUSTxHandler::Volume), + &DGUSRxHandler::volume, + &DGUSTxHandler::volume), VP_HELPER(DGUS_Addr::BRIGHTNESS_Level, 2, VPFLAG_NONE, nullptr, - &DGUSRxHandler::Brightness, - &DGUSTxHandler::Brightness), + &DGUSRxHandler::brightness, + &DGUSTxHandler::brightness), // SPECIAL CASES - VP_HELPER_TX(DGUS_Addr::STATUS_Percent_Complete, &DGUSTxHandler::Percent), - VP_HELPER_RX_NODATA(DGUS_Addr::INFOS_Debug, &DGUSRxHandler::Debug), + VP_HELPER_TX(DGUS_Addr::STATUS_Percent_Complete, &DGUSTxHandler::percent), + VP_HELPER_RX_NODATA(DGUS_Addr::INFOS_Debug, &DGUSRxHandler::debug), VP_HELPER((DGUS_Addr)0, 0, VPFLAG_NONE, nullptr, nullptr, nullptr) diff --git a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp index 6e8f2b010067a..e9e3940a08057 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp @@ -33,7 +33,7 @@ namespace ExtUI { - void onStartup() { dgus_screen_handler.Init(); } + void onStartup() { screen.init(); } void onIdle() { static bool processing = false; @@ -41,45 +41,45 @@ namespace ExtUI { // Prevent recursion if (!processing) { processing = true; - dgus_screen_handler.Loop(); + screen.loop(); processing = false; } } void onPrinterKilled(FSTR_P const error, FSTR_P const component) { - dgus_screen_handler.printerKilled(error, component); + screen.printerKilled(error, component); } - void onMediaInserted() { TERN_(HAS_MEDIA, dgus_screen_handler.SDCardInserted()); } - void onMediaError() { TERN_(HAS_MEDIA, dgus_screen_handler.SDCardError()); } - void onMediaRemoved() { TERN_(HAS_MEDIA, dgus_screen_handler.SDCardRemoved()); } + void onMediaInserted() { TERN_(HAS_MEDIA, screen.sDCardInserted()); } + void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); } + void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); } void onPlayTone(const uint16_t frequency, const uint16_t duration) { - dgus_screen_handler.PlayTone(frequency, duration); + screen.playTone(frequency, duration); } void onPrintTimerStarted() { - dgus_screen_handler.PrintTimerStarted(); + screen.printTimerStarted(); } void onPrintTimerPaused() { - dgus_screen_handler.PrintTimerPaused(); + screen.printTimerPaused(); } void onPrintTimerStopped() { - dgus_screen_handler.PrintTimerStopped(); + screen.printTimerStopped(); } void onFilamentRunout(const extruder_t extruder) { - dgus_screen_handler.filamentRunout(extruder); + screen.filamentRunout(extruder); } void onUserConfirmRequired(const char * const msg) { - dgus_screen_handler.UserConfirmRequired(msg); + screen.userConfirmRequired(msg); } void onStatusChanged(const char * const msg) { - dgus_screen_handler.SetStatusMessage(msg); + screen.setStatusMessage(msg); } void onHomingStart() {} @@ -87,25 +87,25 @@ namespace ExtUI { void onPrintDone() {} void onFactoryReset() { - dgus_screen_handler.SettingsReset(); + screen.settingsReset(); } void onStoreSettings(char *buff) { - dgus_screen_handler.StoreSettings(buff); + screen.storeSettings(buff); } void onLoadSettings(const char *buff) { - dgus_screen_handler.LoadSettings(buff); + screen.loadSettings(buff); } void onPostprocessSettings() {} void onSettingsStored(const bool success) { - dgus_screen_handler.ConfigurationStoreWritten(success); + screen.configurationStoreWritten(success); } void onSettingsLoaded(const bool success) { - dgus_screen_handler.ConfigurationStoreRead(success); + screen.configurationStoreRead(success); } #if HAS_LEVELING @@ -115,12 +115,12 @@ namespace ExtUI { #if HAS_MESH void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) { - dgus_screen_handler.MeshUpdate(xpos, ypos); + screen.meshUpdate(xpos, ypos); } void onMeshUpdate(const int8_t xpos, const int8_t ypos, const probe_state_t state) { if (state == G29_POINT_FINISH) - dgus_screen_handler.MeshUpdate(xpos, ypos); + screen.meshUpdate(xpos, ypos); } #endif @@ -133,14 +133,14 @@ namespace ExtUI { } void onPowerLossResume() { // Called on resume from power-loss - dgus_screen_handler.PowerLossResume(); + screen.powerLossResume(); } #endif #if HAS_PID_HEATING void onPidTuning(const result_t rst) { // Called for temperature PID tuning result - dgus_screen_handler.PidTuning(rst); + screen.pidTuning(rst); } #endif diff --git a/Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp b/Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp index 398d35fdc3f36..eaf41526e5d2d 100644 --- a/Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp +++ b/Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp @@ -101,15 +101,17 @@ const char *resultMessages[] = { "slip data" }; -// A note on baud rates. -// The ESP8266 supports 921600, 460800, 230400, 115200, 74880 and some lower baud rates. -// 921600b is not reliable because even though it sometimes succeeds in connecting, we get a bad response during uploading after a few blocks. -// Probably our UART ISR cannot receive bytes fast enough, perhaps because of the latency of the system tick ISR. -// 460800b doesn't always manage to connect, but if it does then uploading appears to be reliable. -// 230400b always manages to connect. +/** + * Baud Rate Notes: + * The ESP8266 supports 921600, 460800, 230400, 115200, 74880 and some lower baud rates. + * 921600b is not reliable because even though it sometimes succeeds in connecting, we get a bad response during uploading after a few blocks. + * Probably our UART ISR cannot receive bytes fast enough, perhaps because of the latency of the system tick ISR. + * 460800b doesn't always manage to connect, but if it does then uploading appears to be reliable. + * 230400b always manages to connect. + */ static const uint32_t uploadBaudRates[] = { 460800, 230400, 115200, 74880 }; -signed char IsReady() { +signed char isReady() { return esp_upload.state == upload_idle; } @@ -170,15 +172,17 @@ void putData(uint32_t val, unsigned byteCnt, uint8_t *buf, int ofst) { } } -// Read a byte optionally performing SLIP decoding. The return values are: -// -// 2 - an escaped byte was read successfully -// 1 - a non-escaped byte was read successfully -// 0 - no data was available -// -1 - the value 0xC0 was encountered (shouldn't happen) -// -2 - a SLIP escape byte was found but the following byte wasn't available -// -3 - a SLIP escape byte was followed by an invalid byte -int ReadByte(uint8_t *data, signed char slipDecode) { +/** + * Read a byte optionally performing SLIP decoding. The return values are: + * + * 2 - an escaped byte was read successfully + * 1 - a non-escaped byte was read successfully + * 0 - no data was available + * -1 - the value 0xC0 was encountered (shouldn't happen) + * -2 - a SLIP escape byte was found but the following byte wasn't available + * -3 - a SLIP escape byte was followed by an invalid byte + */ +int readByte(uint8_t *data, signed char slipDecode) { if (uploadPort_available() == 0) return 0; // At least one byte is available @@ -206,31 +210,33 @@ void _writePacketRaw(const uint8_t *buf, size_t len) { } // Write a byte to the serial port optionally SLIP encoding. Return the number of bytes actually written. -void WriteByteRaw(uint8_t b) { +void writeByteRaw(uint8_t b) { uploadPort_write((const uint8_t *)&b, 1); } // Write a byte to the serial port optionally SLIP encoding. Return the number of bytes actually written. -void WriteByteSlip(const uint8_t b) { +void writeByteSlip(const uint8_t b) { if (b == 0xC0) { - WriteByteRaw(0xDB); - WriteByteRaw(0xDC); + writeByteRaw(0xDB); + writeByteRaw(0xDC); } else if (b == 0xDB) { - WriteByteRaw(0xDB); - WriteByteRaw(0xDD); + writeByteRaw(0xDB); + writeByteRaw(0xDD); } else uploadPort_write((const uint8_t *)&b, 1); } -// Wait for a data packet to be returned. If the body of the packet is -// non-zero length, return an allocated buffer indirectly containing the -// data and return the data length. Note that if the pointer for returning -// the data buffer is nullptr, the response is expected to be two bytes of zero. -// -// If an error occurs, return a negative value. Otherwise, return the number -// of bytes in the response (or zero if the response was not the standard "two bytes of zero"). +/** + * Wait for a data packet to be returned. If the body of the packet is + * non-zero length, return an allocated buffer indirectly containing the + * data and return the data length. Note that if the pointer for returning + * the data buffer is nullptr, the response is expected to be two bytes of zero. + * + * If an error occurs, return a negative value. Otherwise, return the number + * of bytes in the response (or zero if the response was not the standard "two bytes of zero"). + */ EspUploadResult readPacket(uint8_t op, uint32_t *valp, size_t *bodyLen, uint32_t msTimeout) { typedef enum { begin = 0, @@ -292,7 +298,7 @@ EspUploadResult readPacket(uint8_t op, uint32_t *valp, size_t *bodyLen, uint32_t case body: { // reading the response body int rslt; // retrieve a byte with SLIP decoding - rslt = ReadByte(&c, 1); + rslt = readByte(&c, 1); if (rslt != 1 && rslt != 2) { // some error occurred stat = (rslt == 0 || rslt == -2) ? slipData : slipFrame; @@ -370,19 +376,19 @@ void _writePacket(const uint8_t *data, size_t len) { // 0xC0 and 0xDB replaced by the two-byte sequences {0xDB, 0xDC} and {0xDB, 0xDD} respectively. void writePacket(const uint8_t *hdr, size_t hdrLen, const uint8_t *data, size_t dataLen) { - WriteByteRaw(0xC0); // send the packet start character + writeByteRaw(0xC0); // send the packet start character _writePacket(hdr, hdrLen); // send the header _writePacket(data, dataLen); // send the data block - WriteByteRaw(0xC0); // send the packet end character + writeByteRaw(0xC0); // send the packet end character } // Send a packet to the serial port while performing SLIP framing. The packet data comprises a header and an optional data block. // This is like writePacket except that it does a fast block write for both the header and the main data with no SLIP encoding. Used to send sync commands. void writePacketRaw(const uint8_t *hdr, size_t hdrLen, const uint8_t *data, size_t dataLen) { - WriteByteRaw(0xC0); // send the packet start character + writeByteRaw(0xC0); // send the packet start character _writePacketRaw(hdr, hdrLen); // send the header _writePacketRaw(data, dataLen); // send the data block in raw mode - WriteByteRaw(0xC0); // send the packet end character + writeByteRaw(0xC0); // send the packet end character } // Send a command to the attached device together with the supplied data, if any. @@ -418,7 +424,7 @@ EspUploadResult doCommand(uint8_t op, const uint8_t *data, size_t dataLen, uint3 // Send a synchronising packet to the serial port in an attempt to induce // the ESP8266 to auto-baud lock on the baud rate. -EspUploadResult Sync(uint16_t timeout) { +EspUploadResult sync(uint16_t timeout) { uint8_t buf[36]; EspUploadResult stat; int i; @@ -553,7 +559,7 @@ void upload_spin() { case connecting: if ((getWifiTickDiff(esp_upload.lastAttemptTime, getWifiTick()) >= connectAttemptInterval) && (getWifiTickDiff(esp_upload.lastResetTime, getWifiTick()) >= 500)) { - EspUploadResult res = Sync(5000); + EspUploadResult res = sync(5000); esp_upload.lastAttemptTime = getWifiTick(); if (res == success) esp_upload.state = erasing; @@ -622,7 +628,7 @@ void upload_spin() { } // Try to upload the given file at the given address -void SendUpdateFile(const char *file, uint32_t address) { +void sendUpdateFile(const char *file, uint32_t address) { const char * const fname = card.diveToFile(false, update_curDir, ESP_FIRMWARE_FILE); if (!update_file.open(update_curDir, fname, O_READ)) return; @@ -640,7 +646,7 @@ void SendUpdateFile(const char *file, uint32_t address) { static const uint32_t FirmwareAddress = 0x00000000, WebFilesAddress = 0x00100000; -void ResetWiFiForUpload(int begin_or_end) { +void resetWiFiForUpload(int begin_or_end) { //#if 0 uint32_t start = getWifiTick(); @@ -660,12 +666,12 @@ void ResetWiFiForUpload(int begin_or_end) { int32_t wifi_upload(int type) { esp_upload.retriesPerBaudRate = 9; - ResetWiFiForUpload(0); + resetWiFiForUpload(0); switch (type) { - case 0: SendUpdateFile(ESP_FIRMWARE_FILE, FirmwareAddress); break; - case 1: SendUpdateFile(ESP_WEB_FIRMWARE_FILE, FirmwareAddress); break; - case 2: SendUpdateFile(ESP_WEB_FILE, WebFilesAddress); break; + case 0: sendUpdateFile(ESP_FIRMWARE_FILE, FirmwareAddress); break; + case 1: sendUpdateFile(ESP_WEB_FIRMWARE_FILE, FirmwareAddress); break; + case 2: sendUpdateFile(ESP_WEB_FILE, WebFilesAddress); break; default: return -1; } @@ -674,7 +680,7 @@ int32_t wifi_upload(int type) { hal.watchdog_refresh(); } - ResetWiFiForUpload(1); + resetWiFiForUpload(1); return esp_upload.uploadResult == success ? 0 : -1; } diff --git a/Marlin/src/lcd/tft/canvas.cpp b/Marlin/src/lcd/tft/canvas.cpp index 3fb500e8e21bb..0894f7afb94bc 100644 --- a/Marlin/src/lcd/tft/canvas.cpp +++ b/Marlin/src/lcd/tft/canvas.cpp @@ -26,31 +26,31 @@ #include "canvas.h" -uint16_t CANVAS::width, CANVAS::height; -uint16_t CANVAS::startLine, CANVAS::endLine; -uint16_t CANVAS::background_color; -uint16_t *CANVAS::buffer = TFT::buffer; - -void CANVAS::New(uint16_t x, uint16_t y, uint16_t width, uint16_t height) { - CANVAS::width = width; - CANVAS::height = height; +uint16_t Canvas::width, Canvas::height; +uint16_t Canvas::startLine, Canvas::endLine; +uint16_t Canvas::background_color; +uint16_t *Canvas::buffer = TFT::buffer; + +void Canvas::instantiate(uint16_t x, uint16_t y, uint16_t width, uint16_t height) { + Canvas::width = width; + Canvas::height = height; startLine = 0; endLine = 0; tft.set_window(x, y, x + width - 1, y + height - 1); } -void CANVAS::Continue() { +void Canvas::next() { startLine = endLine; endLine = TFT_BUFFER_SIZE < width * (height - startLine) ? startLine + TFT_BUFFER_SIZE / width : height; } -bool CANVAS::ToScreen() { +bool Canvas::toScreen() { tft.write_sequence(buffer, width * (endLine - startLine)); return endLine == height; } -void CANVAS::SetBackground(uint16_t color) { +void Canvas::setBackground(uint16_t color) { /* TODO: test and optimize performance */ /* uint32_t count = (endLine - startLine) * width; @@ -67,35 +67,35 @@ void CANVAS::SetBackground(uint16_t color) { extern uint16_t gradient(uint16_t colorA, uint16_t colorB, uint16_t factor); -void CANVAS::AddText(uint16_t x, uint16_t y, uint16_t color, uint16_t *string, uint16_t maxWidth) { - if (endLine < y || startLine > y + GetFontHeight()) return; +void Canvas::addText(uint16_t x, uint16_t y, uint16_t color, uint16_t *string, uint16_t maxWidth) { + if (endLine < y || startLine > y + getFontHeight()) return; if (maxWidth == 0) maxWidth = width - x; uint16_t colors[16]; uint16_t stringWidth = 0; - if (GetFontType() == FONT_MARLIN_GLYPHS_2BPP) { + if (getFontType() == FONT_MARLIN_GLYPHS_2BPP) { for (uint8_t i = 0; i < 3; i++) { colors[i] = gradient(ENDIAN_COLOR(color), ENDIAN_COLOR(background_color), ((i+1) << 8) / 3); colors[i] = ENDIAN_COLOR(colors[i]); } } for (uint16_t i = 0 ; *(string + i) ; i++) { - glyph_t *glyph = Glyph(string + i); - if (stringWidth + glyph->BBXWidth > maxWidth) break; - switch (GetFontType()) { + glyph_t *pGlyph = glyph(string + i); + if (stringWidth + pGlyph->BBXWidth > maxWidth) break; + switch (getFontType()) { case FONT_MARLIN_GLYPHS_1BPP: - AddImage(x + stringWidth + glyph->BBXOffsetX, y + GetFontAscent() - glyph->BBXHeight - glyph->BBXOffsetY, glyph->BBXWidth, glyph->BBXHeight, GREYSCALE1, ((uint8_t *)glyph) + sizeof(glyph_t), &color); + addImage(x + stringWidth + pGlyph->BBXOffsetX, y + getFontAscent() - pGlyph->BBXHeight - pGlyph->BBXOffsetY, pGlyph->BBXWidth, pGlyph->BBXHeight, GREYSCALE1, ((uint8_t *)glyph) + sizeof(glyph_t), &color); break; case FONT_MARLIN_GLYPHS_2BPP: - AddImage(x + stringWidth + glyph->BBXOffsetX, y + GetFontAscent() - glyph->BBXHeight - glyph->BBXOffsetY, glyph->BBXWidth, glyph->BBXHeight, GREYSCALE2, ((uint8_t *)glyph) + sizeof(glyph_t), colors); + addImage(x + stringWidth + pGlyph->BBXOffsetX, y + getFontAscent() - pGlyph->BBXHeight - pGlyph->BBXOffsetY, pGlyph->BBXWidth, pGlyph->BBXHeight, GREYSCALE2, ((uint8_t *)glyph) + sizeof(glyph_t), colors); break; } - stringWidth += glyph->DWidth; + stringWidth += pGlyph->DWidth; } } -void CANVAS::AddImage(int16_t x, int16_t y, MarlinImage image, uint16_t *colors) { +void Canvas::addImage(int16_t x, int16_t y, MarlinImage image, uint16_t *colors) { uint16_t *data = (uint16_t *)Images[image].data; if (!data) return; @@ -104,7 +104,7 @@ void CANVAS::AddImage(int16_t x, int16_t y, MarlinImage image, uint16_t *colors) colorMode_t color_mode = Images[image].colorMode; if (color_mode != HIGHCOLOR) - return AddImage(x, y, image_width, image_height, color_mode, (uint8_t *)data, colors); + return addImage(x, y, image_width, image_height, color_mode, (uint8_t *)data, colors); // HIGHCOLOR - 16 bits per pixel @@ -123,7 +123,7 @@ void CANVAS::AddImage(int16_t x, int16_t y, MarlinImage image, uint16_t *colors) } } -void CANVAS::AddImage(int16_t x, int16_t y, uint8_t image_width, uint8_t image_height, colorMode_t color_mode, uint8_t *data, uint16_t *colors) { +void Canvas::addImage(int16_t x, int16_t y, uint8_t image_width, uint8_t image_height, colorMode_t color_mode, uint8_t *data, uint16_t *colors) { uint8_t bitsPerPixel; switch (color_mode) { case GREYSCALE1: bitsPerPixel = 1; break; @@ -161,7 +161,7 @@ void CANVAS::AddImage(int16_t x, int16_t y, uint8_t image_width, uint8_t image_h } } -void CANVAS::AddRectangle(uint16_t x, uint16_t y, uint16_t rectangleWidth, uint16_t rectangleHeight, uint16_t color) { +void Canvas::addRect(uint16_t x, uint16_t y, uint16_t rectangleWidth, uint16_t rectangleHeight, uint16_t color) { if (endLine < y || startLine > y + rectangleHeight) return; for (uint16_t i = 0; i < rectangleHeight; i++) { @@ -180,7 +180,7 @@ void CANVAS::AddRectangle(uint16_t x, uint16_t y, uint16_t rectangleWidth, uint1 } } -void CANVAS::AddBar(uint16_t x, uint16_t y, uint16_t barWidth, uint16_t barHeight, uint16_t color) { +void Canvas::addBar(uint16_t x, uint16_t y, uint16_t barWidth, uint16_t barHeight, uint16_t color) { if (endLine < y || startLine > y + barHeight) return; for (uint16_t i = 0; i < barHeight; i++) { @@ -192,6 +192,6 @@ void CANVAS::AddBar(uint16_t x, uint16_t y, uint16_t barWidth, uint16_t barHeigh } } -CANVAS Canvas; +Canvas tftCanvas; #endif // HAS_GRAPHICAL_TFT diff --git a/Marlin/src/lcd/tft/canvas.h b/Marlin/src/lcd/tft/canvas.h index 1c9c7bb13a272..d271ae7af3f74 100644 --- a/Marlin/src/lcd/tft/canvas.h +++ b/Marlin/src/lcd/tft/canvas.h @@ -28,32 +28,32 @@ #include "../../inc/MarlinConfig.h" -class CANVAS { +class Canvas { private: static uint16_t background_color; static uint16_t width, height; static uint16_t startLine, endLine; static uint16_t *buffer; - inline static glyph_t *Glyph(uint16_t *character) { return TFT_String::glyph(character); } - inline static uint16_t GetFontType() { return TFT_String::font_type(); } - inline static uint16_t GetFontAscent() { return TFT_String::font_ascent(); } - inline static uint16_t GetFontHeight() { return TFT_String::font_height(); } + inline static glyph_t *glyph(uint16_t *character) { return TFT_String::glyph(character); } + inline static uint16_t getFontType() { return TFT_String::font_type(); } + inline static uint16_t getFontAscent() { return TFT_String::font_ascent(); } + inline static uint16_t getFontHeight() { return TFT_String::font_height(); } - static void AddImage(int16_t x, int16_t y, uint8_t image_width, uint8_t image_height, colorMode_t color_mode, uint8_t *data, uint16_t *colors); - static void AddImage(uint16_t x, uint16_t y, uint16_t imageWidth, uint16_t imageHeight, uint16_t color, uint16_t bgColor, uint8_t *image); + static void addImage(int16_t x, int16_t y, uint8_t image_width, uint8_t image_height, colorMode_t color_mode, uint8_t *data, uint16_t *colors); + static void addImage(uint16_t x, uint16_t y, uint16_t imageWidth, uint16_t imageHeight, uint16_t color, uint16_t bgColor, uint8_t *image); public: - static void New(uint16_t x, uint16_t y, uint16_t width, uint16_t height); - static void Continue(); - static bool ToScreen(); + static void instantiate(uint16_t x, uint16_t y, uint16_t width, uint16_t height); + static void next(); + static bool toScreen(); - static void SetBackground(uint16_t color); - static void AddText(uint16_t x, uint16_t y, uint16_t color, uint16_t *string, uint16_t maxWidth); - static void AddImage(int16_t x, int16_t y, MarlinImage image, uint16_t *colors); + static void setBackground(uint16_t color); + static void addText(uint16_t x, uint16_t y, uint16_t color, uint16_t *string, uint16_t maxWidth); + static void addImage(int16_t x, int16_t y, MarlinImage image, uint16_t *colors); - static void AddRectangle(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color); - static void AddBar(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color); + static void addRect(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color); + static void addBar(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color); }; -extern CANVAS Canvas; +extern Canvas tftCanvas; diff --git a/Marlin/src/lcd/tft/tft_queue.cpp b/Marlin/src/lcd/tft/tft_queue.cpp index 1cec4a715947c..fb96a440eaa8a 100644 --- a/Marlin/src/lcd/tft/tft_queue.cpp +++ b/Marlin/src/lcd/tft/tft_queue.cpp @@ -107,17 +107,17 @@ void TFT_Queue::canvas(queueTask_t *task) { if (task->state == TASK_STATE_READY) { task->state = TASK_STATE_IN_PROGRESS; - Canvas.New(task_parameters->x, task_parameters->y, task_parameters->width, task_parameters->height); + tftCanvas.instantiate(task_parameters->x, task_parameters->y, task_parameters->width, task_parameters->height); } - Canvas.Continue(); + tftCanvas.next(); for (i = 0; i < task_parameters->count; i++) { switch (*item) { case CANVAS_SET_BACKGROUND: - Canvas.SetBackground(((parametersCanvasBackground_t *)item)->color); + tftCanvas.setBackground(((parametersCanvasBackground_t *)item)->color); break; case CANVAS_ADD_TEXT: - Canvas.AddText(((parametersCanvasText_t *)item)->x, ((parametersCanvasText_t *)item)->y, ((parametersCanvasText_t *)item)->color, (uint16_t*)(item + sizeof(parametersCanvasText_t)), ((parametersCanvasText_t *)item)->maxWidth); + tftCanvas.addText(((parametersCanvasText_t *)item)->x, ((parametersCanvasText_t *)item)->y, ((parametersCanvasText_t *)item)->color, (uint16_t*)(item + sizeof(parametersCanvasText_t)), ((parametersCanvasText_t *)item)->maxWidth); break; case CANVAS_ADD_IMAGE: @@ -126,20 +126,20 @@ void TFT_Queue::canvas(queueTask_t *task) { image = ((parametersCanvasImage_t *)item)->image; colors = (uint16_t *)(item + sizeof(parametersCanvasImage_t)); - Canvas.AddImage(((parametersCanvasImage_t *)item)->x, ((parametersCanvasImage_t *)item)->y, image, colors); + tftCanvas.addImage(((parametersCanvasImage_t *)item)->x, ((parametersCanvasImage_t *)item)->y, image, colors); break; case CANVAS_ADD_BAR: - Canvas.AddBar(((parametersCanvasBar_t *)item)->x, ((parametersCanvasBar_t *)item)->y, ((parametersCanvasBar_t *)item)->width, ((parametersCanvasBar_t *)item)->height, ((parametersCanvasBar_t *)item)->color); + tftCanvas.addBar(((parametersCanvasBar_t *)item)->x, ((parametersCanvasBar_t *)item)->y, ((parametersCanvasBar_t *)item)->width, ((parametersCanvasBar_t *)item)->height, ((parametersCanvasBar_t *)item)->color); break; - case CANVAS_ADD_RECTANGLE: - Canvas.AddRectangle(((parametersCanvasRectangle_t *)item)->x, ((parametersCanvasRectangle_t *)item)->y, ((parametersCanvasRectangle_t *)item)->width, ((parametersCanvasRectangle_t *)item)->height, ((parametersCanvasRectangle_t *)item)->color); + case CANVAS_ADD_RECT: + tftCanvas.addRect(((parametersCanvasRectangle_t *)item)->x, ((parametersCanvasRectangle_t *)item)->y, ((parametersCanvasRectangle_t *)item)->width, ((parametersCanvasRectangle_t *)item)->height, ((parametersCanvasRectangle_t *)item)->color); break; } item = ((parametersCanvasBackground_t *)item)->nextParameter; } - if (Canvas.ToScreen()) task->state = TASK_STATE_COMPLETED; + if (tftCanvas.toScreen()) task->state = TASK_STATE_COMPLETED; } void TFT_Queue::fill(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { @@ -265,7 +265,7 @@ void TFT_Queue::add_text(uint16_t x, uint16_t y, uint16_t color, const uint16_t end_of_queue += sizeof(parametersCanvasText_t); uint16_t *character = (uint16_t *)end_of_queue; - /* TODO: Deal with maxWidth */ + // TODO: Deal with maxWidth while ((*character++ = *pointer++) != 0); end_of_queue = (uint8_t *)character; @@ -373,7 +373,7 @@ void TFT_Queue::add_rectangle(uint16_t x, uint16_t y, uint16_t width, uint16_t h parametersCanvasRectangle_t *parameters = (parametersCanvasRectangle_t *)end_of_queue; last_parameter = end_of_queue; - parameters->type = CANVAS_ADD_RECTANGLE; + parameters->type = CANVAS_ADD_RECT; parameters->x = x; parameters->y = y; parameters->width = width; diff --git a/Marlin/src/lcd/tft/tft_queue.h b/Marlin/src/lcd/tft/tft_queue.h index ed929166cb98a..59a13dd43a460 100644 --- a/Marlin/src/lcd/tft/tft_queue.h +++ b/Marlin/src/lcd/tft/tft_queue.h @@ -47,7 +47,7 @@ enum CanvasSubtype : uint8_t { CANVAS_ADD_TEXT, CANVAS_ADD_IMAGE, CANVAS_ADD_BAR, - CANVAS_ADD_RECTANGLE, + CANVAS_ADD_RECT, }; typedef struct __attribute__((__packed__)) { diff --git a/Marlin/src/libs/duration_t.h b/Marlin/src/libs/duration_t.h index 69a648441feb1..e45ce01496c7c 100644 --- a/Marlin/src/libs/duration_t.h +++ b/Marlin/src/libs/duration_t.h @@ -67,7 +67,7 @@ struct duration_t { } /** - * @brief Formats the duration as years + * @brief Format the duration as years * @return The number of years */ inline uint8_t year() const { @@ -75,7 +75,7 @@ struct duration_t { } /** - * @brief Formats the duration as days + * @brief Format the duration as days * @return The number of days */ inline uint16_t day() const { @@ -83,7 +83,7 @@ struct duration_t { } /** - * @brief Formats the duration as hours + * @brief Format the duration as hours * @return The number of hours */ inline uint32_t hour() const { @@ -91,7 +91,7 @@ struct duration_t { } /** - * @brief Formats the duration as minutes + * @brief Format the duration as minutes * @return The number of minutes */ inline uint32_t minute() const { @@ -99,7 +99,7 @@ struct duration_t { } /** - * @brief Formats the duration as seconds + * @brief Format the duration as seconds * @return The number of seconds */ inline uint32_t second() const { @@ -112,7 +112,7 @@ struct duration_t { #endif /** - * @brief Formats the duration as a string + * @brief Format the duration as a string * @details String will be formatted using a "full" representation of duration * * @param buffer The array pointed to must be able to accommodate 22 bytes @@ -142,7 +142,7 @@ struct duration_t { } /** - * @brief Formats the duration as a string + * @brief Format the duration as a string * @details String will be formatted using a "digital" representation of duration * * @param buffer The array pointed to must be able to accommodate 10 bytes From 32be4065efeafe781e007ca6ff47bd5a3fc22184 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 31 May 2023 16:47:05 -0500 Subject: [PATCH 085/100] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20num?= =?UTF-8?q?tostr=20use=20functions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/libs/numtostr.cpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/Marlin/src/libs/numtostr.cpp b/Marlin/src/libs/numtostr.cpp index 2938229a7ae17..c34faf68ff7a2 100644 --- a/Marlin/src/libs/numtostr.cpp +++ b/Marlin/src/libs/numtostr.cpp @@ -25,14 +25,25 @@ #include "../inc/MarlinConfigPre.h" #include "../core/utility.h" -char conv[9] = { 0 }; +constexpr char DIGIT(const uint8_t n) { return '0' + n; } + +template +constexpr char DIGIMOD(const T1 n, const T2 f) { return DIGIT((n / f) % 10); } + +template +constexpr char RJDIGIT(const T1 n, const T2 f) { return (n >= f ? DIGIMOD(n, f) : ' '); } + +template +constexpr char MINUSOR(T &n, const char alt) { return (n >= 0) ? alt : (n = -n) ? '-' : '-'; } -#define DIGIT(n) ('0' + (n)) -#define DIGIMOD(n, f) DIGIT(((n)/(f)) % 10) -#define RJDIGIT(n, f) ((n) >= (f) ? DIGIMOD(n, f) : ' ') -#define MINUSOR(n, alt) (n >= 0 ? (alt) : (n = -n, '-')) -#define INTFLOAT(V,N) (((V) * 10 * pow(10, N) + ((V) < 0 ? -5: 5)) / 10) // pow10? -#define UINTFLOAT(V,N) INTFLOAT((V) < 0 ? -(V) : (V), N) +constexpr long INTFLOAT(const float V, const int N) { + return long((V * 10.0f * pow(10.0f, N) + (V < 0.0f ? -5.0f : 5.0f)) / 10.0f); +} +constexpr long UINTFLOAT(const float V, const int N) { + return INTFLOAT(V < 0.0f ? -V : V, N); +} + +char conv[9] = { 0 }; // Format uint8_t (0-100) as rj string with 123% / _12% / __1% format const char* pcttostrpctrj(const uint8_t i) { From 2691167afe02fbbe74b0fdca2c28a49fac635741 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 2 Jun 2023 14:26:02 -0500 Subject: [PATCH 086/100] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Dum?= =?UTF-8?q?p=20BOTH=20and=20EITHER=20macros=20(#25908)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 16 +- Marlin/Configuration_adv.h | 38 ++-- Marlin/src/HAL/AVR/MarlinSerial.h | 2 +- Marlin/src/HAL/AVR/eeprom.cpp | 2 +- Marlin/src/HAL/AVR/inc/SanityCheck.h | 4 +- Marlin/src/HAL/DUE/HAL_SPI.cpp | 2 +- Marlin/src/HAL/DUE/inc/Conditionals_post.h | 2 +- Marlin/src/HAL/ESP32/HAL.cpp | 2 +- Marlin/src/HAL/ESP32/inc/SanityCheck.h | 8 +- Marlin/src/HAL/ESP32/ota.cpp | 2 +- Marlin/src/HAL/ESP32/spiffs.cpp | 2 +- Marlin/src/HAL/ESP32/u8g_esp32_spi.cpp | 4 +- Marlin/src/HAL/ESP32/web.cpp | 2 +- Marlin/src/HAL/LINUX/spi_pins.h | 2 +- .../src/HAL/LPC1768/inc/Conditionals_post.h | 2 +- Marlin/src/HAL/LPC1768/spi_pins.h | 2 +- .../u8g/u8g_com_HAL_LPC1768_sw_spi.cpp | 10 +- Marlin/src/HAL/NATIVE_SIM/spi_pins.h | 2 +- .../src/HAL/NATIVE_SIM/u8g/u8g_com_sw_spi.cpp | 10 +- Marlin/src/HAL/SAMD21/HAL_SPI.cpp | 2 +- Marlin/src/HAL/SAMD21/inc/Conditionals_post.h | 2 +- Marlin/src/HAL/SAMD51/HAL_SPI.cpp | 2 +- Marlin/src/HAL/SAMD51/inc/Conditionals_post.h | 2 +- Marlin/src/HAL/STM32/inc/Conditionals_adv.h | 2 +- Marlin/src/HAL/STM32/inc/Conditionals_post.h | 2 +- Marlin/src/HAL/STM32/timers.cpp | 6 +- Marlin/src/HAL/STM32/usb_host.cpp | 2 +- Marlin/src/HAL/STM32F1/HAL.cpp | 2 +- Marlin/src/HAL/STM32F1/HAL.h | 2 +- Marlin/src/HAL/STM32F1/MarlinSerial.cpp | 2 +- Marlin/src/HAL/STM32F1/MarlinSerial.h | 2 +- .../STM32F1/dogm/u8g_com_stm32duino_swspi.cpp | 2 +- .../src/HAL/STM32F1/inc/Conditionals_post.h | 2 +- Marlin/src/HAL/STM32F1/pinsDebug.h | 2 +- Marlin/src/HAL/STM32F1/sdio.cpp | 2 +- Marlin/src/HAL/shared/HAL_ST7920.h | 2 +- Marlin/src/HAL/shared/eeprom_api.cpp | 2 +- Marlin/src/MarlinCore.cpp | 22 +-- Marlin/src/core/language.h | 2 +- Marlin/src/core/macros.h | 12 +- Marlin/src/feature/babystep.cpp | 2 +- Marlin/src/feature/babystep.h | 4 +- Marlin/src/feature/backlash.cpp | 2 +- Marlin/src/feature/bedlevel/bedlevel.cpp | 6 +- Marlin/src/feature/bedlevel/bedlevel.h | 6 +- Marlin/src/feature/cancel_object.cpp | 2 +- Marlin/src/feature/cooler.cpp | 2 +- Marlin/src/feature/host_actions.cpp | 6 +- Marlin/src/feature/leds/leds.cpp | 14 +- Marlin/src/feature/leds/leds.h | 4 +- Marlin/src/feature/leds/neopixel.cpp | 2 +- Marlin/src/feature/leds/neopixel.h | 2 +- Marlin/src/feature/mixing.cpp | 4 +- Marlin/src/feature/mixing.h | 2 +- Marlin/src/feature/mmu/mmu2.cpp | 2 +- Marlin/src/feature/pause.cpp | 12 +- Marlin/src/feature/pause.h | 2 +- Marlin/src/feature/power.cpp | 14 +- Marlin/src/feature/power.h | 4 +- Marlin/src/feature/powerloss.cpp | 2 +- Marlin/src/feature/solenoid.cpp | 2 +- Marlin/src/gcode/bedlevel/G35.cpp | 2 +- Marlin/src/gcode/bedlevel/abl/G29.cpp | 14 +- Marlin/src/gcode/calibrate/G28.cpp | 8 +- Marlin/src/gcode/calibrate/G34_M422.cpp | 4 +- Marlin/src/gcode/calibrate/G76_M871.cpp | 2 +- Marlin/src/gcode/calibrate/M100.cpp | 2 +- Marlin/src/gcode/calibrate/M666.cpp | 2 +- Marlin/src/gcode/control/M380_M381.cpp | 2 +- Marlin/src/gcode/control/M7-M9.cpp | 2 +- Marlin/src/gcode/control/M80_M81.cpp | 2 +- Marlin/src/gcode/control/T.cpp | 2 +- Marlin/src/gcode/feature/pause/M125.cpp | 2 +- Marlin/src/gcode/feature/pause/M701_M702.cpp | 2 +- Marlin/src/gcode/gcode.cpp | 22 +-- Marlin/src/gcode/gcode.h | 18 +- Marlin/src/gcode/geometry/G92.cpp | 14 +- Marlin/src/gcode/motion/G0_G1.cpp | 6 +- Marlin/src/gcode/parser.cpp | 2 +- Marlin/src/gcode/probe/G30.cpp | 2 +- Marlin/src/gcode/sd/M1001.cpp | 2 +- Marlin/src/gcode/sd/M34.cpp | 2 +- Marlin/src/inc/Conditionals_LCD.h | 88 ++++----- Marlin/src/inc/Conditionals_adv.h | 36 ++-- Marlin/src/inc/Conditionals_post.h | 61 +++--- Marlin/src/inc/SanityCheck.h | 186 +++++++++--------- Marlin/src/inc/Warnings.cpp | 10 +- Marlin/src/lcd/HD44780/marlinui_HD44780.cpp | 14 +- Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp | 12 +- Marlin/src/lcd/buttons.h | 4 +- Marlin/src/lcd/dogm/dogm_Statusscreen.h | 16 +- Marlin/src/lcd/dogm/marlinui_DOGM.cpp | 2 +- Marlin/src/lcd/dogm/marlinui_DOGM.h | 4 +- Marlin/src/lcd/dogm/status_screen_DOGM.cpp | 14 +- Marlin/src/lcd/e3v2/creality/dwin.cpp | 20 +- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 6 +- Marlin/src/lcd/e3v2/marlinui/ui_common.cpp | 2 +- .../lcd/e3v2/marlinui/ui_status_480x272.cpp | 2 +- Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp | 2 +- Marlin/src/lcd/e3v2/proui/dwin.cpp | 36 ++-- Marlin/src/lcd/e3v2/proui/dwin.h | 16 +- Marlin/src/lcd/e3v2/proui/dwin_defines.h | 2 +- Marlin/src/lcd/e3v2/proui/endstop_diag.cpp | 2 +- Marlin/src/lcd/e3v2/proui/gcode_preview.cpp | 2 +- Marlin/src/lcd/e3v2/proui/lockscreen.cpp | 2 +- Marlin/src/lcd/e3v2/proui/meshviewer.cpp | 2 +- Marlin/src/lcd/e3v2/proui/plot.cpp | 2 +- Marlin/src/lcd/e3v2/proui/printstats.cpp | 2 +- Marlin/src/lcd/extui/anycubic/Tunes.cpp | 2 +- .../anycubic_i3mega/anycubic_i3mega_lcd.cpp | 2 +- .../lcd/extui/dgus/mks/DGUSScreenHandler.cpp | 12 +- Marlin/src/lcd/extui/example/example.cpp | 2 +- .../cocoa_press/leveling_menu.cpp | 2 +- .../cocoa_press/main_menu.cpp | 4 +- .../ftdi_eve_lib/basic/commands.cpp | 2 +- .../ftdi_eve_touch_ui/ftdi_eve_lib/compat.h | 7 +- .../extended/unicode/font_size_t.cpp | 2 +- .../extended/unicode/standard_char_set.cpp | 2 +- .../ftdi_eve_lib/extended/unicode/unicode.cpp | 2 +- .../generic/about_screen.cpp | 8 +- .../generic/advanced_settings_menu.cpp | 8 +- .../generic/endstop_state_screen.cpp | 2 +- .../generic/leveling_menu.cpp | 6 +- .../extui/ftdi_eve_touch_ui/generic/screens.h | 4 +- .../ftdi_eve_touch_ui/generic/tune_menu.cpp | 8 +- .../extui/ftdi_eve_touch_ui/theme/colors.h | 4 +- .../draw_auto_level_offset_settings.cpp | 2 +- .../src/lcd/extui/mks_ui/draw_cloud_bind.cpp | 2 +- .../lcd/extui/mks_ui/draw_jerk_settings.cpp | 2 +- .../lcd/extui/mks_ui/draw_media_select.cpp | 2 +- .../lcd/extui/mks_ui/draw_pause_message.cpp | 2 +- .../mks_ui/draw_tmc_current_settings.cpp | 2 +- .../mks_ui/draw_tmc_step_mode_settings.cpp | 2 +- .../extui/mks_ui/draw_touch_calibration.cpp | 2 +- Marlin/src/lcd/extui/mks_ui/draw_ui.cpp | 2 +- .../lcd/extui/mks_ui/draw_z_offset_wizard.cpp | 2 +- Marlin/src/lcd/extui/mks_ui/irq_overrid.cpp | 2 +- Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp | 2 +- Marlin/src/lcd/extui/mks_ui/mks_hardware.h | 2 +- .../extui/mks_ui/tft_lvgl_configuration.cpp | 4 +- .../src/lcd/extui/mks_ui/wifiSerial_STM32.cpp | 2 +- .../lcd/extui/mks_ui/wifiSerial_STM32F1.cpp | 2 +- Marlin/src/lcd/extui/mks_ui/wifi_module.cpp | 2 +- Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp | 2 +- Marlin/src/lcd/extui/nextion/nextion_tft.cpp | 4 +- Marlin/src/lcd/extui/ui_api.cpp | 2 +- Marlin/src/lcd/marlinui.cpp | 42 ++-- Marlin/src/lcd/marlinui.h | 28 +-- Marlin/src/lcd/menu/menu.cpp | 2 +- Marlin/src/lcd/menu/menu_advanced.cpp | 10 +- Marlin/src/lcd/menu/menu_backlash.cpp | 4 +- Marlin/src/lcd/menu/menu_bed_leveling.cpp | 6 +- Marlin/src/lcd/menu/menu_bed_tramming.cpp | 10 +- Marlin/src/lcd/menu/menu_cancelobject.cpp | 2 +- Marlin/src/lcd/menu/menu_configuration.cpp | 6 +- Marlin/src/lcd/menu/menu_delta_calibrate.cpp | 2 +- Marlin/src/lcd/menu/menu_filament.cpp | 2 +- Marlin/src/lcd/menu/menu_info.cpp | 2 +- Marlin/src/lcd/menu/menu_job_recovery.cpp | 2 +- Marlin/src/lcd/menu/menu_led.cpp | 2 +- Marlin/src/lcd/menu/menu_main.cpp | 10 +- Marlin/src/lcd/menu/menu_media.cpp | 2 +- Marlin/src/lcd/menu/menu_mixer.cpp | 2 +- Marlin/src/lcd/menu/menu_mmu2.cpp | 2 +- Marlin/src/lcd/menu/menu_motion.cpp | 6 +- Marlin/src/lcd/menu/menu_password.cpp | 2 +- Marlin/src/lcd/menu/menu_temperature.cpp | 2 +- Marlin/src/lcd/menu/menu_touch_screen.cpp | 2 +- Marlin/src/lcd/menu/menu_tramming_wizard.cpp | 2 +- Marlin/src/lcd/menu/menu_tune.cpp | 2 +- Marlin/src/lcd/menu/menu_ubl.cpp | 2 +- Marlin/src/lcd/menu/menu_x_twist.cpp | 2 +- Marlin/src/lcd/tft/ui_1024x600.cpp | 8 +- Marlin/src/lcd/tft/ui_320x240.cpp | 8 +- Marlin/src/lcd/tft/ui_480x320.cpp | 8 +- Marlin/src/libs/nozzle.cpp | 4 +- Marlin/src/module/endstops.cpp | 6 +- Marlin/src/module/motion.cpp | 26 +-- Marlin/src/module/motion.h | 2 +- Marlin/src/module/planner.cpp | 16 +- Marlin/src/module/planner.h | 4 +- Marlin/src/module/printcounter.h | 2 +- Marlin/src/module/probe.cpp | 20 +- Marlin/src/module/probe.h | 2 +- Marlin/src/module/scara.cpp | 2 +- Marlin/src/module/settings.cpp | 18 +- Marlin/src/module/stepper.cpp | 20 +- Marlin/src/module/stepper.h | 10 +- Marlin/src/module/temperature.cpp | 52 ++--- Marlin/src/module/temperature.h | 22 +-- Marlin/src/module/tool_change.cpp | 8 +- .../pins/esp32/pins_GODI_CONTROLLER_V1_0.h | 2 +- Marlin/src/pins/esp32/pins_MKS_TINYBEE.h | 2 +- Marlin/src/pins/linux/pins_RAMPS_LINUX.h | 6 +- Marlin/src/pins/lpc1768/pins_BIQU_B300_V1.0.h | 2 +- Marlin/src/pins/lpc1768/pins_BIQU_BQ111_A4.h | 2 +- Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h | 2 +- Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h | 2 +- Marlin/src/pins/lpc1768/pins_BTT_SKR_common.h | 4 +- Marlin/src/pins/lpc1768/pins_MKS_SBASE.h | 4 +- Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h | 2 +- Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h | 8 +- Marlin/src/pins/lpc1769/pins_AZTEEG_X5_GT.h | 2 +- Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI.h | 2 +- .../src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h | 2 +- .../src/pins/lpc1769/pins_COHESION3D_REMIX.h | 2 +- Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h | 2 +- Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h | 2 +- Marlin/src/pins/lpc1769/pins_TH3D_EZBOARD.h | 2 +- Marlin/src/pins/pins.h | 4 +- Marlin/src/pins/pinsDebug.h | 8 +- Marlin/src/pins/rambo/pins_RAMBO.h | 2 +- Marlin/src/pins/rambo/pins_SCOOVO_X9H.h | 2 +- Marlin/src/pins/ramps/pins_3DRAG.h | 2 +- Marlin/src/pins/ramps/pins_AZTEEG_X3.h | 2 +- Marlin/src/pins/ramps/pins_AZTEEG_X3_PRO.h | 4 +- Marlin/src/pins/ramps/pins_FYSETC_F6_13.h | 2 +- Marlin/src/pins/ramps/pins_K8400.h | 2 +- Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h | 2 +- Marlin/src/pins/ramps/pins_MKS_GEN_13.h | 2 +- Marlin/src/pins/ramps/pins_RAMPS.h | 20 +- Marlin/src/pins/ramps/pins_RUMBA.h | 4 +- Marlin/src/pins/ramps/pins_TRIGORILLA_14.h | 6 +- Marlin/src/pins/ramps/pins_TT_OSCAR.h | 6 +- Marlin/src/pins/ramps/pins_ULTIMAKER_OLD.h | 10 +- Marlin/src/pins/ramps/pins_ZRIB_V53.h | 4 +- Marlin/src/pins/sam/env_validate.h | 2 +- Marlin/src/pins/sam/pins_KRATOS32.h | 2 +- Marlin/src/pins/sam/pins_RADDS.h | 2 +- Marlin/src/pins/sam/pins_RAMPS_DUO.h | 2 +- Marlin/src/pins/sam/pins_RAMPS_FD_V1.h | 4 +- Marlin/src/pins/sam/pins_RURAMPS4D_11.h | 4 +- Marlin/src/pins/sam/pins_RURAMPS4D_13.h | 4 +- .../src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h | 10 +- Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h | 10 +- Marlin/src/pins/samd/pins_MINITRONICS20.h | 10 +- Marlin/src/pins/samd/pins_RAMPS_144.h | 10 +- .../pins/sanguino/pins_MELZI_CREALITY_E2.h | 2 +- Marlin/src/pins/sanguino/pins_MELZI_TRONXY.h | 2 +- .../src/pins/sanguino/pins_SANGUINOLOLU_11.h | 4 +- Marlin/src/pins/sanguino/pins_ZMIB_V2.h | 10 +- Marlin/src/pins/sensitive_pins.h | 2 +- Marlin/src/pins/stm32f1/pins_BEAST.h | 2 +- Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h | 8 +- .../stm32f1/pins_BTT_SKR_MINI_E3_common.h | 8 +- .../src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h | 6 +- .../src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h | 2 +- Marlin/src/pins/stm32f1/pins_CHITU3D.h | 4 +- .../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 | 4 +- Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h | 2 +- Marlin/src/pins/stm32f1/pins_CREALITY_V521.h | 2 +- .../src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h | 8 +- Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h | 2 +- Marlin/src/pins/stm32f1/pins_FLY_MINI.h | 2 +- Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h | 2 +- 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 +- .../pins/stm32f1/pins_KEDI_CONTROLLER_V1_2.h | 4 +- .../pins/stm32f1/pins_MINGDA_MPX_ARM_MINI.h | 2 +- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h | 2 +- .../pins/stm32f1/pins_MKS_ROBIN_E3_common.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_PANDA_PI_V29.h | 6 +- Marlin/src/pins/stm32f1/pins_STM32F1R.h | 2 +- Marlin/src/pins/stm32f1/pins_STM3R_MINI.h | 2 +- Marlin/src/pins/stm32f1/pins_ZM3E2_V1_0.h | 2 +- Marlin/src/pins/stm32f4/pins_ARMED.h | 2 +- Marlin/src/pins/stm32f4/pins_ARTILLERY_RUBY.h | 4 +- .../src/pins/stm32f4/pins_BTT_BTT002_V1_0.h | 2 +- Marlin/src/pins/stm32f4/pins_BTT_E3_RRF.h | 6 +- Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h | 2 +- .../pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h | 4 +- .../stm32f4/pins_BTT_SKR_MINI_E3_V3_0_1.h | 8 +- .../pins/stm32f4/pins_BTT_SKR_PRO_common.h | 6 +- .../pins/stm32f4/pins_BTT_SKR_V2_0_common.h | 6 +- .../pins/stm32f4/pins_FYSETC_CHEETAH_V20.h | 4 +- Marlin/src/pins/stm32f4/pins_FYSETC_S6.h | 2 +- Marlin/src/pins/stm32f4/pins_I3DBEEZ9.h | 6 +- .../pins/stm32f4/pins_MKS_MONSTER8_common.h | 2 +- .../stm32f4/pins_MKS_ROBIN_NANO_V3_common.h | 2 +- Marlin/src/pins/stm32f4/pins_MKS_SKIPR_V1_0.h | 2 +- .../src/pins/stm32f4/pins_TH3D_EZBOARD_V2.h | 4 +- Marlin/src/pins/stm32g0/pins_BTT_EBB42_V1_1.h | 2 +- .../pins/stm32g0/pins_BTT_MANTA_E3_EZ_V1_0.h | 6 +- .../pins/stm32g0/pins_BTT_MANTA_M4P_V1_0.h | 4 +- .../pins/stm32g0/pins_BTT_MANTA_M5P_V1_0.h | 4 +- .../pins/stm32g0/pins_BTT_MANTA_M8P_common.h | 4 +- .../pins/stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h | 8 +- .../pins/stm32h7/pins_BTT_OCTOPUS_MAX_EZ.h | 4 +- .../pins/stm32h7/pins_BTT_SKR_V3_0_common.h | 8 +- Marlin/src/pins/teensy2/pins_PRINTRBOARD.h | 2 +- .../src/pins/teensy2/pins_PRINTRBOARD_REVF.h | 2 +- Marlin/src/pins/teensy2/pins_SAV_MKI.h | 2 +- Marlin/src/sd/Sd2Card.h | 2 +- Marlin/src/sd/cardreader.cpp | 8 +- Marlin/src/sd/cardreader.h | 2 +- .../sd/usb_flashdrive/Sd2Card_FlashDrive.h | 2 +- .../PlatformIO/scripts/common-dependencies.h | 6 +- 305 files changed, 946 insertions(+), 952 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 61377189a8bd8..b905b246886e5 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -266,7 +266,7 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) +#if ANY(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder @@ -419,7 +419,7 @@ #define POWER_TIMEOUT 30 // (s) Turn off power if the machine is idle for this duration //#define POWER_OFF_DELAY 60 // (s) Delay of poweroff after M81 command. Useful to let fans run for extra time. #endif - #if EITHER(AUTO_POWER_CONTROL, POWER_OFF_WAIT_FOR_COOLDOWN) + #if ANY(AUTO_POWER_CONTROL, POWER_OFF_WAIT_FOR_COOLDOWN) //#define AUTO_POWER_E_TEMP 50 // (°C) PSU on if any extruder is over this temperature //#define AUTO_POWER_CHAMBER_TEMP 30 // (°C) PSU on if the chamber is over this temperature //#define AUTO_POWER_COOLER_TEMP 26 // (°C) PSU on if the cooler is over this temperature @@ -921,7 +921,7 @@ #define DELTA_CALIBRATION_DEFAULT_POINTS 4 #endif - #if EITHER(DELTA_AUTO_CALIBRATION, DELTA_CALIBRATION_MENU) + #if ANY(DELTA_AUTO_CALIBRATION, DELTA_CALIBRATION_MENU) // Step size for paper-test probing #define PROBE_MANUALLY_STEP 0.05 // (mm) #endif @@ -965,7 +965,7 @@ */ //#define MORGAN_SCARA //#define MP_SCARA -#if EITHER(MORGAN_SCARA, MP_SCARA) +#if ANY(MORGAN_SCARA, MP_SCARA) // If movement is choppy try lowering this value #define DEFAULT_SEGMENTS_PER_SECOND 200 @@ -1809,7 +1809,7 @@ #define MAX_SOFTWARE_ENDSTOP_W #endif -#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) +#if ANY(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -2046,7 +2046,7 @@ #endif -#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) +#if ANY(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -3340,7 +3340,7 @@ //#define TOUCH_OFFSET_Y 257 //#define TOUCH_ORIENTATION TOUCH_LANDSCAPE - #if BOTH(TOUCH_SCREEN_CALIBRATION, EEPROM_SETTINGS) + #if ALL(TOUCH_SCREEN_CALIBRATION, EEPROM_SETTINGS) #define TOUCH_CALIBRATION_AUTO_SAVE // Auto save successful calibration values to EEPROM #endif @@ -3437,7 +3437,7 @@ //#define RGB_LED //#define RGBW_LED -#if EITHER(RGB_LED, RGBW_LED) +#if ANY(RGB_LED, RGBW_LED) //#define RGB_LED_R_PIN 34 //#define RGB_LED_G_PIN 43 //#define RGB_LED_B_PIN 35 diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index a635e4a3022ce..eee111a5412a9 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -310,7 +310,7 @@ //#define ADAPTIVE_FAN_SLOWING // Slow down the part-cooling fan if the temperature drops #if ENABLED(ADAPTIVE_FAN_SLOWING) //#define REPORT_ADAPTIVE_FAN_SLOWING // Report fan slowing activity to the console - #if EITHER(MPCTEMP, PIDTEMP) + #if ANY(MPCTEMP, PIDTEMP) //#define TEMP_TUNING_MAINTAIN_FAN // Don't slow down the fan speed during M303 or M306 T #endif #endif @@ -759,10 +759,10 @@ #if ENABLED(NEOPIXEL_LED) //#define CASE_LIGHT_USE_NEOPIXEL // Use NeoPixel LED as case light #endif - #if EITHER(RGB_LED, RGBW_LED) + #if ANY(RGB_LED, RGBW_LED) //#define CASE_LIGHT_USE_RGB_LED // Use RGB / RGBW LED as case light #endif - #if EITHER(CASE_LIGHT_USE_NEOPIXEL, CASE_LIGHT_USE_RGB_LED) + #if ANY(CASE_LIGHT_USE_NEOPIXEL, CASE_LIGHT_USE_RGB_LED) #define CASE_LIGHT_DEFAULT_COLOR { 255, 255, 255, 255 } // { Red, Green, Blue, White } #endif #endif @@ -1175,7 +1175,7 @@ */ //#define INPUT_SHAPING_X //#define INPUT_SHAPING_Y -#if EITHER(INPUT_SHAPING_X, INPUT_SHAPING_Y) +#if ANY(INPUT_SHAPING_X, INPUT_SHAPING_Y) #if ENABLED(INPUT_SHAPING_X) #define SHAPING_FREQ_X 40 // (Hz) The default dominant resonant frequency on the X axis. #define SHAPING_ZETA_X 0.15f // Damping ratio of the X axis (range: 0.0 = no damping to 1.0 = critical damping). @@ -1417,7 +1417,7 @@ */ //#define DIGIPOT_MCP4018 // Requires https://github.com/felias-fogg/SlowSoftI2CMaster //#define DIGIPOT_MCP4451 -#if EITHER(DIGIPOT_MCP4018, DIGIPOT_MCP4451) +#if ANY(DIGIPOT_MCP4018, DIGIPOT_MCP4451) #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT:4 AZTEEG_X3_PRO:8 MKS_SBASE:5 MIGHTYBOARD_REVE:5 // Actual motor currents in Amps. The number of entries must match DIGIPOT_I2C_NUM_CHANNELS. @@ -1474,7 +1474,7 @@ // //#define LCD_BACKLIGHT_TIMEOUT_MINS 1 // (minutes) Timeout before turning off the backlight -#if HAS_BED_PROBE && EITHER(HAS_MARLINUI_MENU, HAS_TFT_LVGL_UI) +#if HAS_BED_PROBE && ANY(HAS_MARLINUI_MENU, HAS_TFT_LVGL_UI) //#define PROBE_OFFSET_WIZARD // Add a Probe Z Offset calibration option to the LCD menu #if ENABLED(PROBE_OFFSET_WIZARD) /** @@ -1544,13 +1544,13 @@ #define SHOW_BOOTSCREEN // Show the Marlin bootscreen on startup. ** ENABLE FOR PRODUCTION ** #if ENABLED(SHOW_BOOTSCREEN) #define BOOTSCREEN_TIMEOUT 3000 // (ms) Total Duration to display the boot screen(s) - #if EITHER(HAS_MARLINUI_U8GLIB, TFT_COLOR_UI) + #if ANY(HAS_MARLINUI_U8GLIB, TFT_COLOR_UI) #define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving lots of flash) #endif #if HAS_MARLINUI_U8GLIB //#define BOOT_MARLIN_LOGO_ANIMATED // Animated Marlin logo. Costs ~3260 (or ~940) bytes of flash. #endif - #if EITHER(HAS_MARLINUI_U8GLIB, TOUCH_UI_FTDI_EVE) + #if ANY(HAS_MARLINUI_U8GLIB, TOUCH_UI_FTDI_EVE) //#define SHOW_CUSTOM_BOOTSCREEN // Show the bitmap in Marlin/_Bootscreen.h on startup. #endif #endif @@ -1615,13 +1615,13 @@ #define SET_REMAINING_TIME // Add 'R' parameter to set remaining time //#define SET_INTERACTION_TIME // Add 'C' parameter to set time until next filament change or other user interaction //#define M73_REPORT // Report M73 values to host - #if BOTH(M73_REPORT, HAS_MEDIA) + #if ALL(M73_REPORT, HAS_MEDIA) #define M73_REPORT_SD_ONLY // Report only when printing from SD #endif #endif // LCD Print Progress options. Multiple times may be displayed in turn. -#if HAS_DISPLAY && EITHER(HAS_MEDIA, SET_PROGRESS_MANUALLY) +#if HAS_DISPLAY && ANY(HAS_MEDIA, SET_PROGRESS_MANUALLY) #define SHOW_PROGRESS_PERCENT // Show print progress percentage (doesn't affect progress bar) #define SHOW_ELAPSED_TIME // Display elapsed printing time (prefix 'E') //#define SHOW_REMAINING_TIME // Display estimated time to completion (prefix 'R') @@ -1630,7 +1630,7 @@ #endif //#define PRINT_PROGRESS_SHOW_DECIMALS // Show/report progress with decimal digits, not all UIs support this - #if EITHER(HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL) + #if ANY(HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL) //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -2302,7 +2302,7 @@ //#define PROBING_MARGIN_BACK PROBING_MARGIN #endif -#if EITHER(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL) // Override the mesh area if the automatic (max) area is too large //#define MESH_MIN_X MESH_INSET //#define MESH_MIN_Y MESH_INSET @@ -2310,7 +2310,7 @@ //#define MESH_MAX_Y Y_BED_SIZE - (MESH_INSET) #endif -#if BOTH(AUTO_BED_LEVELING_UBL, EEPROM_SETTINGS) +#if ALL(AUTO_BED_LEVELING_UBL, EEPROM_SETTINGS) //#define OPTIMIZED_MESH_STORAGE // Store mesh with less precision to save EEPROM space #endif @@ -2380,7 +2380,7 @@ #endif // G76 options - #if BOTH(PTC_PROBE, PTC_BED) + #if ALL(PTC_PROBE, PTC_BED) // Park position to wait for probe cooldown #define PTC_PARK_POS { 0, 0, 100 } @@ -2422,7 +2422,7 @@ // G5 Bézier Curve Support with XYZE destination and IJPQ offsets //#define BEZIER_CURVE_SUPPORT // Requires ~2666 bytes -#if EITHER(ARC_SUPPORT, BEZIER_CURVE_SUPPORT) +#if ANY(ARC_SUPPORT, BEZIER_CURVE_SUPPORT) //#define CNC_WORKSPACE_PLANES // Allow G2/G3/G5 to operate in XY, ZX, or YZ planes #endif @@ -2508,7 +2508,7 @@ // The number of linear moves that can be in the planner at once. // The value of BLOCK_BUFFER_SIZE must be a power of 2 (e.g., 8, 16, 32) -#if BOTH(HAS_MEDIA, DIRECT_STEPPING) +#if ALL(HAS_MEDIA, DIRECT_STEPPING) #define BLOCK_BUFFER_SIZE 8 #elif HAS_MEDIA #define BLOCK_BUFFER_SIZE 16 @@ -3290,7 +3290,7 @@ */ //#define SENSORLESS_HOMING // StallGuard capable drivers only - #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) + #if ANY(SENSORLESS_HOMING, SENSORLESS_PROBING) // TMC2209: 0...255. TMC2130: -64...63 #define X_STALL_SENSITIVITY 8 #define X2_STALL_SENSITIVITY X_STALL_SENSITIVITY @@ -3453,7 +3453,7 @@ */ //#define SPINDLE_FEATURE //#define LASER_FEATURE -#if EITHER(SPINDLE_FEATURE, LASER_FEATURE) +#if ANY(SPINDLE_FEATURE, LASER_FEATURE) #define SPINDLE_LASER_ACTIVE_STATE LOW // Set to "HIGH" if SPINDLE_LASER_ENA_PIN is active HIGH #define SPINDLE_LASER_USE_PWM // Enable if your controller supports setting the speed/power @@ -4205,7 +4205,7 @@ //#define WIFISUPPORT // Marlin embedded WiFi management //#define ESP3D_WIFISUPPORT // ESP3D Library WiFi management (https://github.com/luc-github/ESP3DLib) -#if EITHER(WIFISUPPORT, ESP3D_WIFISUPPORT) +#if ANY(WIFISUPPORT, ESP3D_WIFISUPPORT) //#define WEBSUPPORT // Start a webserver (which may include auto-discovery) //#define OTASUPPORT // Support over-the-air firmware updates //#define WIFI_CUSTOM_COMMAND // Accept feature config commands (e.g., WiFi ESP3D) from the host diff --git a/Marlin/src/HAL/AVR/MarlinSerial.h b/Marlin/src/HAL/AVR/MarlinSerial.h index 7dd208e54e85e..f47541f12dc54 100644 --- a/Marlin/src/HAL/AVR/MarlinSerial.h +++ b/Marlin/src/HAL/AVR/MarlinSerial.h @@ -280,7 +280,7 @@ static constexpr bool DROPPED_RX = false; static constexpr bool RX_FRAMING_ERRORS = false; static constexpr bool MAX_RX_QUEUED = false; - static constexpr bool RX_OVERRUNS = BOTH(HAS_DGUS_LCD, SERIAL_STATS_RX_BUFFER_OVERRUNS); + static constexpr bool RX_OVERRUNS = ALL(HAS_DGUS_LCD, SERIAL_STATS_RX_BUFFER_OVERRUNS); }; typedef Serial1Class< MarlinSerial< LCDSerialCfg > > MSerialLCD; diff --git a/Marlin/src/HAL/AVR/eeprom.cpp b/Marlin/src/HAL/AVR/eeprom.cpp index 8d084dec7fdfa..6465e4702544d 100644 --- a/Marlin/src/HAL/AVR/eeprom.cpp +++ b/Marlin/src/HAL/AVR/eeprom.cpp @@ -23,7 +23,7 @@ #include "../../inc/MarlinConfig.h" -#if EITHER(EEPROM_SETTINGS, SD_FIRMWARE_UPDATE) +#if ANY(EEPROM_SETTINGS, SD_FIRMWARE_UPDATE) /** * PersistentStore for Arduino-style EEPROM interface diff --git a/Marlin/src/HAL/AVR/inc/SanityCheck.h b/Marlin/src/HAL/AVR/inc/SanityCheck.h index 665e68043a853..6a7e1728891dc 100644 --- a/Marlin/src/HAL/AVR/inc/SanityCheck.h +++ b/Marlin/src/HAL/AVR/inc/SanityCheck.h @@ -95,11 +95,11 @@ /** * The Trinamic library includes SoftwareSerial.h, leading to a compile error. */ -#if BOTH(HAS_TRINAMIC_CONFIG, ENDSTOP_INTERRUPTS_FEATURE) +#if ALL(HAS_TRINAMIC_CONFIG, ENDSTOP_INTERRUPTS_FEATURE) #error "TMCStepper includes SoftwareSerial.h which is incompatible with ENDSTOP_INTERRUPTS_FEATURE. Disable ENDSTOP_INTERRUPTS_FEATURE to continue." #endif -#if BOTH(HAS_TMC_SW_SERIAL, MONITOR_DRIVER_STATUS) +#if ALL(HAS_TMC_SW_SERIAL, MONITOR_DRIVER_STATUS) #error "MONITOR_DRIVER_STATUS causes performance issues when used with SoftwareSerial-connected drivers. Disable MONITOR_DRIVER_STATUS or use hardware serial to continue." #endif diff --git a/Marlin/src/HAL/DUE/HAL_SPI.cpp b/Marlin/src/HAL/DUE/HAL_SPI.cpp index f5bcaacee505b..63ebf164f2b16 100644 --- a/Marlin/src/HAL/DUE/HAL_SPI.cpp +++ b/Marlin/src/HAL/DUE/HAL_SPI.cpp @@ -42,7 +42,7 @@ // Public functions // ------------------------ -#if EITHER(DUE_SOFTWARE_SPI, FORCE_SOFT_SPI) +#if ANY(DUE_SOFTWARE_SPI, FORCE_SOFT_SPI) // ------------------------ // Software SPI diff --git a/Marlin/src/HAL/DUE/inc/Conditionals_post.h b/Marlin/src/HAL/DUE/inc/Conditionals_post.h index ce6d3fdde27f6..295596b78b197 100644 --- a/Marlin/src/HAL/DUE/inc/Conditionals_post.h +++ b/Marlin/src/HAL/DUE/inc/Conditionals_post.h @@ -23,6 +23,6 @@ #if USE_FALLBACK_EEPROM #define FLASH_EEPROM_EMULATION -#elif EITHER(I2C_EEPROM, SPI_EEPROM) +#elif ANY(I2C_EEPROM, SPI_EEPROM) #define USE_SHARED_EEPROM 1 #endif diff --git a/Marlin/src/HAL/ESP32/HAL.cpp b/Marlin/src/HAL/ESP32/HAL.cpp index 46dd4e761b8ca..27f6516f9ae86 100644 --- a/Marlin/src/HAL/ESP32/HAL.cpp +++ b/Marlin/src/HAL/ESP32/HAL.cpp @@ -165,7 +165,7 @@ void MarlinHAL::init_board() { } void MarlinHAL::idletask() { - #if BOTH(WIFISUPPORT, OTASUPPORT) + #if ALL(WIFISUPPORT, OTASUPPORT) OTA_handle(); #endif TERN_(ESP3D_WIFISUPPORT, esp3dlib.idletask()); diff --git a/Marlin/src/HAL/ESP32/inc/SanityCheck.h b/Marlin/src/HAL/ESP32/inc/SanityCheck.h index 910918b9ea476..e6c364a6fe4cb 100644 --- a/Marlin/src/HAL/ESP32/inc/SanityCheck.h +++ b/Marlin/src/HAL/ESP32/inc/SanityCheck.h @@ -40,7 +40,7 @@ #error "TMC220x Software Serial is not supported on ESP32." #endif -#if BOTH(WIFISUPPORT, ESP3D_WIFISUPPORT) +#if ALL(WIFISUPPORT, ESP3D_WIFISUPPORT) #error "Only enable one WiFi option, either WIFISUPPORT or ESP3D_WIFISUPPORT." #endif @@ -52,7 +52,7 @@ #error "FAST_PWM_FAN is not available on TinyBee." #endif -#if BOTH(I2S_STEPPER_STREAM, BABYSTEPPING) && DISABLED(INTEGRATED_BABYSTEPPING) +#if ALL(I2S_STEPPER_STREAM, BABYSTEPPING) && DISABLED(INTEGRATED_BABYSTEPPING) #error "BABYSTEPPING on I2S stream requires INTEGRATED_BABYSTEPPING." #endif @@ -60,10 +60,10 @@ #error "PULLDOWN pin mode is not available on ESP32 boards." #endif -#if BOTH(I2S_STEPPER_STREAM, LIN_ADVANCE) && DISABLED(EXPERIMENTAL_I2S_LA) +#if ALL(I2S_STEPPER_STREAM, LIN_ADVANCE) && DISABLED(EXPERIMENTAL_I2S_LA) #error "I2S stream is currently incompatible with LIN_ADVANCE." #endif -#if BOTH(I2S_STEPPER_STREAM, PRINTCOUNTER) && PRINTCOUNTER_SAVE_INTERVAL > 0 && DISABLED(PRINTCOUNTER_SYNC) +#if ALL(I2S_STEPPER_STREAM, PRINTCOUNTER) && PRINTCOUNTER_SAVE_INTERVAL > 0 && DISABLED(PRINTCOUNTER_SYNC) #error "PRINTCOUNTER_SAVE_INTERVAL may cause issues on ESP32 with an I2S expander. Define PRINTCOUNTER_SYNC in Configuration.h for an imperfect solution." #endif diff --git a/Marlin/src/HAL/ESP32/ota.cpp b/Marlin/src/HAL/ESP32/ota.cpp index f31a78c2c5194..c5c3082c30cb2 100644 --- a/Marlin/src/HAL/ESP32/ota.cpp +++ b/Marlin/src/HAL/ESP32/ota.cpp @@ -22,7 +22,7 @@ #include "../../inc/MarlinConfigPre.h" -#if BOTH(WIFISUPPORT, OTASUPPORT) +#if ALL(WIFISUPPORT, OTASUPPORT) #include #include diff --git a/Marlin/src/HAL/ESP32/spiffs.cpp b/Marlin/src/HAL/ESP32/spiffs.cpp index a0e713bff0bbd..043ad7849adba 100644 --- a/Marlin/src/HAL/ESP32/spiffs.cpp +++ b/Marlin/src/HAL/ESP32/spiffs.cpp @@ -23,7 +23,7 @@ #include "../../inc/MarlinConfigPre.h" -#if BOTH(WIFISUPPORT, WEBSUPPORT) +#if ALL(WIFISUPPORT, WEBSUPPORT) #include "../../core/serial.h" diff --git a/Marlin/src/HAL/ESP32/u8g_esp32_spi.cpp b/Marlin/src/HAL/ESP32/u8g_esp32_spi.cpp index 955c751e48695..012604dbfb8b1 100644 --- a/Marlin/src/HAL/ESP32/u8g_esp32_spi.cpp +++ b/Marlin/src/HAL/ESP32/u8g_esp32_spi.cpp @@ -25,7 +25,7 @@ #include "../../inc/MarlinConfig.h" -#if EITHER(MKS_MINI_12864, FYSETC_MINI_12864_2_1) +#if ANY(MKS_MINI_12864, FYSETC_MINI_12864_2_1) #include #include "../shared/HAL_SPI.h" @@ -101,6 +101,6 @@ uint8_t u8g_eps_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_pt return 1; } -#endif // EITHER(MKS_MINI_12864, FYSETC_MINI_12864_2_1) +#endif // MKS_MINI_12864 || FYSETC_MINI_12864_2_1 #endif // ARDUINO_ARCH_ESP32 diff --git a/Marlin/src/HAL/ESP32/web.cpp b/Marlin/src/HAL/ESP32/web.cpp index 7a27707a3e14e..63a101595ff7c 100644 --- a/Marlin/src/HAL/ESP32/web.cpp +++ b/Marlin/src/HAL/ESP32/web.cpp @@ -23,7 +23,7 @@ #include "../../inc/MarlinConfigPre.h" -#if BOTH(WIFISUPPORT, WEBSUPPORT) +#if ALL(WIFISUPPORT, WEBSUPPORT) #include "../../inc/MarlinConfig.h" diff --git a/Marlin/src/HAL/LINUX/spi_pins.h b/Marlin/src/HAL/LINUX/spi_pins.h index f09d1decb8eb6..7bd2498be7487 100644 --- a/Marlin/src/HAL/LINUX/spi_pins.h +++ b/Marlin/src/HAL/LINUX/spi_pins.h @@ -24,7 +24,7 @@ #include "../../core/macros.h" #include "../../inc/MarlinConfigPre.h" -#if BOTH(HAS_MARLINUI_U8GLIB, HAS_MEDIA) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_EN == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN) +#if ALL(HAS_MARLINUI_U8GLIB, HAS_MEDIA) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_EN == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN) #define SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently // needed due to the speed and mode required for communicating with each device being different. // This requirement can be removed if the SPI access to these devices is updated to use diff --git a/Marlin/src/HAL/LPC1768/inc/Conditionals_post.h b/Marlin/src/HAL/LPC1768/inc/Conditionals_post.h index a0bf4215383e3..0b03cb2aea636 100644 --- a/Marlin/src/HAL/LPC1768/inc/Conditionals_post.h +++ b/Marlin/src/HAL/LPC1768/inc/Conditionals_post.h @@ -23,7 +23,7 @@ #if USE_FALLBACK_EEPROM #define FLASH_EEPROM_EMULATION -#elif EITHER(I2C_EEPROM, SPI_EEPROM) +#elif ANY(I2C_EEPROM, SPI_EEPROM) #define USE_SHARED_EEPROM 1 #endif diff --git a/Marlin/src/HAL/LPC1768/spi_pins.h b/Marlin/src/HAL/LPC1768/spi_pins.h index 33a5b369adab0..babe8a11d7194 100644 --- a/Marlin/src/HAL/LPC1768/spi_pins.h +++ b/Marlin/src/HAL/LPC1768/spi_pins.h @@ -23,7 +23,7 @@ #include "../../core/macros.h" -#if BOTH(HAS_MEDIA, HAS_MARLINUI_U8GLIB) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_EN == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN) +#if ALL(HAS_MEDIA, HAS_MARLINUI_U8GLIB) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_EN == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN) #define SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently // needed due to the speed and mode required for communicating with each device being different. // This requirement can be removed if the SPI access to these devices is updated to use diff --git a/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp b/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp index f116a9b80aa67..785b4ef5c410a 100644 --- a/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp +++ b/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp @@ -132,7 +132,7 @@ uint8_t swSpiTransfer_mode_3(uint8_t b, const uint8_t spi_speed, const pin_t sck static uint8_t SPI_speed = 0; static void u8g_sw_spi_HAL_LPC1768_shift_out(uint8_t dataPin, uint8_t clockPin, uint8_t val) { - #if EITHER(FYSETC_MINI_12864, MKS_MINI_12864) + #if ANY(FYSETC_MINI_12864, MKS_MINI_12864) swSpiTransfer_mode_3(val, SPI_speed, clockPin, -1, dataPin); #else swSpiTransfer_mode_0(val, SPI_speed, clockPin, -1, dataPin); @@ -160,10 +160,10 @@ uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, break; case U8G_COM_MSG_CHIP_SELECT: - #if EITHER(FYSETC_MINI_12864, MKS_MINI_12864) // LCD SPI is running mode 3 while SD card is running mode 0 - if (arg_val) { // SCK idle state needs to be set to the proper idle state before - // the next chip select goes active - u8g_SetPILevel(u8g, U8G_PI_SCK, 1); // Set SCK to mode 3 idle state before CS goes active + #if ANY(FYSETC_MINI_12864, MKS_MINI_12864) // LCD SPI is running mode 3 while SD card is running mode 0 + if (arg_val) { // SCK idle state needs to be set to the proper idle state before + // the next chip select goes active + u8g_SetPILevel(u8g, U8G_PI_SCK, 1); // Set SCK to mode 3 idle state before CS goes active u8g_SetPILevel(u8g, U8G_PI_CS, LOW); } else { diff --git a/Marlin/src/HAL/NATIVE_SIM/spi_pins.h b/Marlin/src/HAL/NATIVE_SIM/spi_pins.h index 02fb3592382ce..9b1bae9a5836d 100644 --- a/Marlin/src/HAL/NATIVE_SIM/spi_pins.h +++ b/Marlin/src/HAL/NATIVE_SIM/spi_pins.h @@ -24,7 +24,7 @@ #include "../../core/macros.h" #include "../../inc/MarlinConfigPre.h" -#if BOTH(HAS_MARLINUI_U8GLIB, HAS_MEDIA) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_EN == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN) +#if ALL(HAS_MARLINUI_U8GLIB, HAS_MEDIA) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_EN == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN) #define SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently // needed due to the speed and mode required for communicating with each device being different. // This requirement can be removed if the SPI access to these devices is updated to use diff --git a/Marlin/src/HAL/NATIVE_SIM/u8g/u8g_com_sw_spi.cpp b/Marlin/src/HAL/NATIVE_SIM/u8g/u8g_com_sw_spi.cpp index 7be84580b1331..5187a4958308b 100644 --- a/Marlin/src/HAL/NATIVE_SIM/u8g/u8g_com_sw_spi.cpp +++ b/Marlin/src/HAL/NATIVE_SIM/u8g/u8g_com_sw_spi.cpp @@ -131,7 +131,7 @@ static uint8_t swSpiInit(const uint8_t spi_speed, const uint8_t clk_pin, const u } static void u8g_sw_spi_shift_out(uint8_t dataPin, uint8_t clockPin, uint8_t val) { - #if EITHER(FYSETC_MINI_12864, MKS_MINI_12864) + #if ANY(FYSETC_MINI_12864, MKS_MINI_12864) swSpiTransfer_mode_3(val, SPI_speed, clockPin, -1, dataPin); #else swSpiTransfer_mode_0(val, SPI_speed, clockPin, -1, dataPin); @@ -159,10 +159,10 @@ uint8_t u8g_com_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_pt break; case U8G_COM_MSG_CHIP_SELECT: - #if EITHER(FYSETC_MINI_12864, MKS_MINI_12864) // LCD SPI is running mode 3 while SD card is running mode 0 - if (arg_val) { // SCK idle state needs to be set to the proper idle state before - // the next chip select goes active - u8g_SetPILevel(u8g, U8G_PI_SCK, 1); // Set SCK to mode 3 idle state before CS goes active + #if ANY(FYSETC_MINI_12864, MKS_MINI_12864) // LCD SPI is running mode 3 while SD card is running mode 0 + if (arg_val) { // SCK idle state needs to be set to the proper idle state before + // the next chip select goes active + u8g_SetPILevel(u8g, U8G_PI_SCK, 1); // Set SCK to mode 3 idle state before CS goes active u8g_SetPILevel(u8g, U8G_PI_CS, LOW); } else { diff --git a/Marlin/src/HAL/SAMD21/HAL_SPI.cpp b/Marlin/src/HAL/SAMD21/HAL_SPI.cpp index 69c6a43af835a..e01f540cf8a19 100644 --- a/Marlin/src/HAL/SAMD21/HAL_SPI.cpp +++ b/Marlin/src/HAL/SAMD21/HAL_SPI.cpp @@ -45,7 +45,7 @@ // Public functions // -------------------------------------------------------------------------- -#if EITHER(SOFTWARE_SPI, FORCE_SOFT_SPI) +#if ANY(SOFTWARE_SPI, FORCE_SOFT_SPI) // ------------------------ // Software SPI diff --git a/Marlin/src/HAL/SAMD21/inc/Conditionals_post.h b/Marlin/src/HAL/SAMD21/inc/Conditionals_post.h index 7315dc12a7790..87d3350c94505 100644 --- a/Marlin/src/HAL/SAMD21/inc/Conditionals_post.h +++ b/Marlin/src/HAL/SAMD21/inc/Conditionals_post.h @@ -28,6 +28,6 @@ #if USE_FALLBACK_EEPROM #define FLASH_EEPROM_EMULATION -#elif EITHER(I2C_EEPROM, SPI_EEPROM) +#elif ANY(I2C_EEPROM, SPI_EEPROM) #define USE_SHARED_EEPROM 1 #endif diff --git a/Marlin/src/HAL/SAMD51/HAL_SPI.cpp b/Marlin/src/HAL/SAMD51/HAL_SPI.cpp index 58fdfe9499a11..63d3971965c94 100644 --- a/Marlin/src/HAL/SAMD51/HAL_SPI.cpp +++ b/Marlin/src/HAL/SAMD51/HAL_SPI.cpp @@ -44,7 +44,7 @@ // Public functions // -------------------------------------------------------------------------- -#if EITHER(SOFTWARE_SPI, FORCE_SOFT_SPI) +#if ANY(SOFTWARE_SPI, FORCE_SOFT_SPI) // ------------------------ // Software SPI diff --git a/Marlin/src/HAL/SAMD51/inc/Conditionals_post.h b/Marlin/src/HAL/SAMD51/inc/Conditionals_post.h index ce6d3fdde27f6..295596b78b197 100644 --- a/Marlin/src/HAL/SAMD51/inc/Conditionals_post.h +++ b/Marlin/src/HAL/SAMD51/inc/Conditionals_post.h @@ -23,6 +23,6 @@ #if USE_FALLBACK_EEPROM #define FLASH_EEPROM_EMULATION -#elif EITHER(I2C_EEPROM, SPI_EEPROM) +#elif ANY(I2C_EEPROM, SPI_EEPROM) #define USE_SHARED_EEPROM 1 #endif diff --git a/Marlin/src/HAL/STM32/inc/Conditionals_adv.h b/Marlin/src/HAL/STM32/inc/Conditionals_adv.h index ee8c49e4e0556..032716a294ced 100644 --- a/Marlin/src/HAL/STM32/inc/Conditionals_adv.h +++ b/Marlin/src/HAL/STM32/inc/Conditionals_adv.h @@ -21,7 +21,7 @@ */ #pragma once -#if BOTH(HAS_MEDIA, USBD_USE_CDC_MSC) && DISABLED(NO_SD_HOST_DRIVE) +#if ALL(HAS_MEDIA, USBD_USE_CDC_MSC) && DISABLED(NO_SD_HOST_DRIVE) #define HAS_SD_HOST_DRIVE 1 #endif diff --git a/Marlin/src/HAL/STM32/inc/Conditionals_post.h b/Marlin/src/HAL/STM32/inc/Conditionals_post.h index 83ce077c754de..6c97a635b3cc6 100644 --- a/Marlin/src/HAL/STM32/inc/Conditionals_post.h +++ b/Marlin/src/HAL/STM32/inc/Conditionals_post.h @@ -24,7 +24,7 @@ // If no real or emulated EEPROM selected, fall back to SD emulation #if USE_FALLBACK_EEPROM #define SDCARD_EEPROM_EMULATION -#elif EITHER(I2C_EEPROM, SPI_EEPROM) +#elif ANY(I2C_EEPROM, SPI_EEPROM) #define USE_SHARED_EEPROM 1 #endif diff --git a/Marlin/src/HAL/STM32/timers.cpp b/Marlin/src/HAL/STM32/timers.cpp index e68b59c46fee8..27ced33db2c13 100644 --- a/Marlin/src/HAL/STM32/timers.cpp +++ b/Marlin/src/HAL/STM32/timers.cpp @@ -292,9 +292,9 @@ static constexpr int get_timer_num_from_base_address(uintptr_t base_address) { // constexpr doesn't like using the base address pointers that timers evaluate to. // We can get away with casting them to uintptr_t, if we do so inside an array. // GCC will not currently do it directly to a uintptr_t. -IF_ENABLED(HAS_TMC_SW_SERIAL, static constexpr uintptr_t timer_serial[] = {uintptr_t(TIMER_SERIAL)}); -IF_ENABLED(SPEAKER, static constexpr uintptr_t timer_tone[] = {uintptr_t(TIMER_TONE)}); -IF_ENABLED(HAS_SERVOS, static constexpr uintptr_t timer_servo[] = {uintptr_t(TIMER_SERVO)}); +TERN_(HAS_TMC_SW_SERIAL, static constexpr uintptr_t timer_serial[] = {uintptr_t(TIMER_SERIAL)}); +TERN_(SPEAKER, static constexpr uintptr_t timer_tone[] = {uintptr_t(TIMER_TONE)}); +TERN_(HAS_SERVOS, static constexpr uintptr_t timer_servo[] = {uintptr_t(TIMER_SERVO)}); enum TimerPurpose { TP_SERIAL, TP_TONE, TP_SERVO, TP_STEP, TP_TEMP }; diff --git a/Marlin/src/HAL/STM32/usb_host.cpp b/Marlin/src/HAL/STM32/usb_host.cpp index f3784670049c7..afafe1d4f3d13 100644 --- a/Marlin/src/HAL/STM32/usb_host.cpp +++ b/Marlin/src/HAL/STM32/usb_host.cpp @@ -26,7 +26,7 @@ #include "../../inc/MarlinConfig.h" -#if BOTH(USE_OTG_USB_HOST, USBHOST) +#if ALL(USE_OTG_USB_HOST, USBHOST) #include "usb_host.h" #include "../shared/Marduino.h" diff --git a/Marlin/src/HAL/STM32F1/HAL.cpp b/Marlin/src/HAL/STM32F1/HAL.cpp index a0cdda3b4fd71..373116ba39fbd 100644 --- a/Marlin/src/HAL/STM32F1/HAL.cpp +++ b/Marlin/src/HAL/STM32F1/HAL.cpp @@ -224,7 +224,7 @@ void MarlinHAL::init() { #endif #if HAS_SD_HOST_DRIVE MSC_SD_init(); - #elif BOTH(SERIAL_USB, EMERGENCY_PARSER) + #elif ALL(SERIAL_USB, EMERGENCY_PARSER) usb_cdcacm_set_hooks(USB_CDCACM_HOOK_RX, my_rx_callback); #endif #if PIN_EXISTS(USB_CONNECT) diff --git a/Marlin/src/HAL/STM32F1/HAL.h b/Marlin/src/HAL/STM32F1/HAL.h index 8ed525bfb71bd..b5f4d6fe8babb 100644 --- a/Marlin/src/HAL/STM32F1/HAL.h +++ b/Marlin/src/HAL/STM32F1/HAL.h @@ -82,7 +82,7 @@ #define _MSERIAL(X) MSerial##X #define MSERIAL(X) _MSERIAL(X) -#if EITHER(STM32_HIGH_DENSITY, STM32_XL_DENSITY) +#if ANY(STM32_HIGH_DENSITY, STM32_XL_DENSITY) #define NUM_UARTS 5 #else #define NUM_UARTS 3 diff --git a/Marlin/src/HAL/STM32F1/MarlinSerial.cpp b/Marlin/src/HAL/STM32F1/MarlinSerial.cpp index 7898e9f2bcc12..568fc05d4185d 100644 --- a/Marlin/src/HAL/STM32F1/MarlinSerial.cpp +++ b/Marlin/src/HAL/STM32F1/MarlinSerial.cpp @@ -116,7 +116,7 @@ constexpr bool serial_handles_emergency(int port) { #endif DEFINE_HWSERIAL_MARLIN(MSerial2, 2); DEFINE_HWSERIAL_MARLIN(MSerial3, 3); -#if EITHER(STM32_HIGH_DENSITY, STM32_XL_DENSITY) +#if ANY(STM32_HIGH_DENSITY, STM32_XL_DENSITY) DEFINE_HWSERIAL_UART_MARLIN(MSerial4, 4); DEFINE_HWSERIAL_UART_MARLIN(MSerial5, 5); #endif diff --git a/Marlin/src/HAL/STM32F1/MarlinSerial.h b/Marlin/src/HAL/STM32F1/MarlinSerial.h index dda32fe7a2efe..53bcd48476388 100644 --- a/Marlin/src/HAL/STM32F1/MarlinSerial.h +++ b/Marlin/src/HAL/STM32F1/MarlinSerial.h @@ -52,7 +52,7 @@ typedef Serial1Class MSerialT; extern MSerialT MSerial1; extern MSerialT MSerial2; extern MSerialT MSerial3; -#if EITHER(STM32_HIGH_DENSITY, STM32_XL_DENSITY) +#if ANY(STM32_HIGH_DENSITY, STM32_XL_DENSITY) extern MSerialT MSerial4; extern MSerialT MSerial5; #endif diff --git a/Marlin/src/HAL/STM32F1/dogm/u8g_com_stm32duino_swspi.cpp b/Marlin/src/HAL/STM32F1/dogm/u8g_com_stm32duino_swspi.cpp index 26ea1ea19af95..db9b6f0b1c8d2 100644 --- a/Marlin/src/HAL/STM32F1/dogm/u8g_com_stm32duino_swspi.cpp +++ b/Marlin/src/HAL/STM32F1/dogm/u8g_com_stm32duino_swspi.cpp @@ -24,7 +24,7 @@ #include "../../../inc/MarlinConfig.h" -#if BOTH(HAS_MARLINUI_U8GLIB, FORCE_SOFT_SPI) +#if ALL(HAS_MARLINUI_U8GLIB, FORCE_SOFT_SPI) #include #include "../../shared/HAL_SPI.h" diff --git a/Marlin/src/HAL/STM32F1/inc/Conditionals_post.h b/Marlin/src/HAL/STM32F1/inc/Conditionals_post.h index 5a4bde16a5e6d..f130f5cad8e1b 100644 --- a/Marlin/src/HAL/STM32F1/inc/Conditionals_post.h +++ b/Marlin/src/HAL/STM32F1/inc/Conditionals_post.h @@ -24,7 +24,7 @@ // If no real EEPROM, Flash emulation, or SRAM emulation is available fall back to SD emulation #if USE_FALLBACK_EEPROM #define SDCARD_EEPROM_EMULATION -#elif EITHER(I2C_EEPROM, SPI_EEPROM) +#elif ANY(I2C_EEPROM, SPI_EEPROM) #define USE_SHARED_EEPROM 1 #endif diff --git a/Marlin/src/HAL/STM32F1/pinsDebug.h b/Marlin/src/HAL/STM32F1/pinsDebug.h index 2142f0ebac62b..6f8e48f455bd0 100644 --- a/Marlin/src/HAL/STM32F1/pinsDebug.h +++ b/Marlin/src/HAL/STM32F1/pinsDebug.h @@ -94,7 +94,7 @@ void pwm_details(const pin_t pin) { timer_dev * const tdev = PIN_MAP[pin].timer_device; const uint8_t channel = PIN_MAP[pin].timer_channel; const char num = ( - #if EITHER(STM32_HIGH_DENSITY, STM32_XL_DENSITY) + #if ANY(STM32_HIGH_DENSITY, STM32_XL_DENSITY) tdev == &timer8 ? '8' : tdev == &timer5 ? '5' : #endif diff --git a/Marlin/src/HAL/STM32F1/sdio.cpp b/Marlin/src/HAL/STM32F1/sdio.cpp index b00be302179d0..1ab76440b7aa3 100644 --- a/Marlin/src/HAL/STM32F1/sdio.cpp +++ b/Marlin/src/HAL/STM32F1/sdio.cpp @@ -26,7 +26,7 @@ #include "../../inc/MarlinConfig.h" // Allow pins/pins.h to set density -#if EITHER(STM32_HIGH_DENSITY, STM32_XL_DENSITY) +#if ANY(STM32_HIGH_DENSITY, STM32_XL_DENSITY) #include "sdio.h" diff --git a/Marlin/src/HAL/shared/HAL_ST7920.h b/Marlin/src/HAL/shared/HAL_ST7920.h index 4e362f96ba55e..305736c3a5141 100644 --- a/Marlin/src/HAL/shared/HAL_ST7920.h +++ b/Marlin/src/HAL/shared/HAL_ST7920.h @@ -27,7 +27,7 @@ * (bypassing U8G), it will allow the LIGHTWEIGHT_UI to operate. */ -#if BOTH(HAS_MARLINUI_U8GLIB, LIGHTWEIGHT_UI) +#if ALL(HAS_MARLINUI_U8GLIB, LIGHTWEIGHT_UI) void ST7920_cs(); void ST7920_ncs(); void ST7920_set_cmd(); diff --git a/Marlin/src/HAL/shared/eeprom_api.cpp b/Marlin/src/HAL/shared/eeprom_api.cpp index 47cfa5a2dbe08..083ccc70d7c94 100644 --- a/Marlin/src/HAL/shared/eeprom_api.cpp +++ b/Marlin/src/HAL/shared/eeprom_api.cpp @@ -22,7 +22,7 @@ */ #include "../../inc/MarlinConfigPre.h" -#if EITHER(EEPROM_SETTINGS, SD_FIRMWARE_UPDATE) +#if ANY(EEPROM_SETTINGS, SD_FIRMWARE_UPDATE) #include "eeprom_api.h" PersistentStore persistentStore; diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 779dea4ca274c..6184109030802 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -199,7 +199,7 @@ #include "feature/runout.h" #endif -#if EITHER(PROBE_TARE, HAS_Z_SERVO_PROBE) +#if ANY(PROBE_TARE, HAS_Z_SERVO_PROBE) #include "module/probe.h" #endif @@ -726,7 +726,7 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) { #endif } -#if BOTH(EP_BABYSTEPPING, EMERGENCY_PARSER) +#if ALL(EP_BABYSTEPPING, EMERGENCY_PARSER) #include "feature/babystep.h" #endif @@ -853,7 +853,7 @@ void idle(const bool no_stepper_sleep/*=false*/) { TERN_(POLL_JOG, joystick.inject_jog_moves()); // Async Babystepping via the Emergency Parser - #if BOTH(EP_BABYSTEPPING, EMERGENCY_PARSER) + #if ALL(EP_BABYSTEPPING, EMERGENCY_PARSER) babystep.do_ep_steps(); #endif @@ -924,7 +924,7 @@ void minkill(const bool steppers_off/*=false*/) { TERN_(HAS_SUICIDE, suicide()); - #if EITHER(HAS_KILL, SOFT_RESET_ON_KILL) + #if ANY(HAS_KILL, SOFT_RESET_ON_KILL) // Wait for both KILL and ENC to be released while (TERN0(HAS_KILL, kill_state()) || TERN0(SOFT_RESET_ON_KILL, ui.button_pressed())) @@ -953,7 +953,7 @@ void stop() { print_job_timer.stop(); - #if EITHER(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE) + #if ANY(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE) thermalManager.set_fans_paused(false); // Un-pause fans for safety #endif @@ -1315,14 +1315,14 @@ void setup() { #endif #endif - #if BOTH(HAS_MEDIA, SDCARD_EEPROM_EMULATION) + #if ALL(HAS_MEDIA, SDCARD_EEPROM_EMULATION) SETUP_RUN(card.mount()); // Mount media with settings before first_load #endif SETUP_RUN(settings.first_load()); // Load data from EEPROM if available (or use defaults) // This also updates variables in the planner, elsewhere - #if BOTH(HAS_WIRED_LCD, SHOW_BOOTSCREEN) + #if ALL(HAS_WIRED_LCD, SHOW_BOOTSCREEN) SETUP_RUN(ui.show_bootscreen()); const millis_t bootscreen_ms = millis(); #endif @@ -1397,7 +1397,7 @@ void setup() { SETUP_RUN(stepper_dac.init()); #endif - #if EITHER(Z_PROBE_SLED, SOLENOID_PROBE) && HAS_SOLENOID_1 + #if ANY(Z_PROBE_SLED, SOLENOID_PROBE) && HAS_SOLENOID_1 OUT_WRITE(SOL1_PIN, LOW); // OFF #endif @@ -1605,7 +1605,7 @@ void setup() { SETUP_RUN(tft_lvgl_init()); #endif - #if BOTH(HAS_WIRED_LCD, SHOW_BOOTSCREEN) + #if ALL(HAS_WIRED_LCD, SHOW_BOOTSCREEN) const millis_t elapsed = millis() - bootscreen_ms; #if ENABLED(MARLIN_DEV_MODE) SERIAL_ECHOLNPGM("elapsed=", elapsed); @@ -1617,7 +1617,7 @@ void setup() { SETUP_RUN(password.lock_machine()); // Will not proceed until correct password provided #endif - #if BOTH(HAS_MARLINUI_MENU, TOUCH_SCREEN_CALIBRATION) && EITHER(TFT_CLASSIC_UI, TFT_COLOR_UI) + #if ALL(HAS_MARLINUI_MENU, TOUCH_SCREEN_CALIBRATION) && ANY(TFT_CLASSIC_UI, TFT_COLOR_UI) SETUP_RUN(ui.check_touch_calibration()); #endif @@ -1674,7 +1674,7 @@ void loop() { queue.advance(); - #if EITHER(POWER_OFF_TIMER, POWER_OFF_WAIT_FOR_COOLDOWN) + #if ANY(POWER_OFF_TIMER, POWER_OFF_WAIT_FOR_COOLDOWN) powerManager.checkAutoPowerOff(); #endif diff --git a/Marlin/src/core/language.h b/Marlin/src/core/language.h index 521fcfca3ec97..b76a3d301cc5a 100644 --- a/Marlin/src/core/language.h +++ b/Marlin/src/core/language.h @@ -508,7 +508,7 @@ #define STR_W "" #endif -#if EITHER(HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL) +#if ANY(HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL) // Custom characters defined in the first 8 characters of the LCD #define LCD_STR_BEDTEMP "\x00" // Print only as a char. This will have 'unexpected' results when used in a string! diff --git a/Marlin/src/core/macros.h b/Marlin/src/core/macros.h index 7e20f838032aa..c44d60843ad2d 100644 --- a/Marlin/src/core/macros.h +++ b/Marlin/src/core/macros.h @@ -192,7 +192,11 @@ #define _DIS_1(O) NOT(_ENA_1(O)) #define ENABLED(V...) DO(ENA,&&,V) #define DISABLED(V...) DO(DIS,&&,V) +#define ANY(V...) !DISABLED(V) +#define ALL ENABLED +#define NONE DISABLED #define COUNT_ENABLED(V...) DO(ENA,+,V) +#define MANY(V...) (COUNT_ENABLED(V) > 1) #define TERN(O,A,B) _TERN(_ENA_1(O),B,A) // OPTION ? 'A' : 'B' #define TERN0(O,A) _TERN(_ENA_1(O),0,A) // OPTION ? 'A' : '0' @@ -216,16 +220,8 @@ #define SUM_TERN(O,B,A) ((B) PLUS_TERN0(O,A)) // ((B) (OPTION ? '+ (A)' : '')) #define DIFF_TERN(O,B,A) ((B) MINUS_TERN0(O,A)) // ((B) (OPTION ? '- (A)' : '')) -#define IF_ENABLED TERN_ #define IF_DISABLED(O,A) TERN(O,,A) -#define ANY(V...) !DISABLED(V) -#define NONE(V...) DISABLED(V) -#define ALL(V...) ENABLED(V) -#define BOTH(V1,V2) ALL(V1,V2) -#define EITHER(V1,V2) ANY(V1,V2) -#define MANY(V...) (COUNT_ENABLED(V) > 1) - // Macros to support pins/buttons exist testing #define PIN_EXISTS(PN) (defined(PN##_PIN) && PN##_PIN >= 0) #define _PINEX_1 PIN_EXISTS diff --git a/Marlin/src/feature/babystep.cpp b/Marlin/src/feature/babystep.cpp index c8c1d42f886b0..e431e40165ff4 100644 --- a/Marlin/src/feature/babystep.cpp +++ b/Marlin/src/feature/babystep.cpp @@ -42,7 +42,7 @@ volatile int16_t Babystep::steps[BS_AXIS_IND(Z_AXIS) + 1]; #endif int16_t Babystep::accum; -#if BOTH(EP_BABYSTEPPING, EMERGENCY_PARSER) +#if ALL(EP_BABYSTEPPING, EMERGENCY_PARSER) int16_t Babystep::ep_babysteps; #endif diff --git a/Marlin/src/feature/babystep.h b/Marlin/src/feature/babystep.h index 1e319ec5446d3..70a529a0c3c58 100644 --- a/Marlin/src/feature/babystep.h +++ b/Marlin/src/feature/babystep.h @@ -31,7 +31,7 @@ #define BABYSTEP_TICKS ((TEMP_TIMER_RATE) / (BABYSTEPS_PER_SEC)) #endif -#if IS_CORE || EITHER(BABYSTEP_XY, I2C_POSITION_ENCODERS) +#if ANY(IS_CORE, BABYSTEP_XY, I2C_POSITION_ENCODERS) #define BS_AXIS_IND(A) A #define BS_AXIS(I) AxisEnum(I) #else @@ -52,7 +52,7 @@ class Babystep { static volatile int16_t steps[BS_AXIS_IND(Z_AXIS) + 1]; static int16_t accum; // Total babysteps in current edit - #if BOTH(EP_BABYSTEPPING, EMERGENCY_PARSER) + #if ALL(EP_BABYSTEPPING, EMERGENCY_PARSER) static int16_t ep_babysteps; #endif diff --git a/Marlin/src/feature/backlash.cpp b/Marlin/src/feature/backlash.cpp index 8d180c7a4a3e5..c6eb0d33f3093 100644 --- a/Marlin/src/feature/backlash.cpp +++ b/Marlin/src/feature/backlash.cpp @@ -66,7 +66,7 @@ Backlash backlash; void Backlash::add_correction_steps(const int32_t &da, const int32_t &db, const int32_t &dc, const AxisBits dm, block_t * const block) { AxisBits changed_dir = last_direction_bits ^ dm; // Ignore direction change unless steps are taken in that direction - #if DISABLED(CORE_BACKLASH) || EITHER(MARKFORGED_XY, MARKFORGED_YX) + #if DISABLED(CORE_BACKLASH) || ANY(MARKFORGED_XY, MARKFORGED_YX) if (!da) changed_dir.x = false; if (!db) changed_dir.y = false; if (!dc) changed_dir.z = false; diff --git a/Marlin/src/feature/bedlevel/bedlevel.cpp b/Marlin/src/feature/bedlevel/bedlevel.cpp index 03b67745ec16d..0bb8b8191a5ee 100644 --- a/Marlin/src/feature/bedlevel/bedlevel.cpp +++ b/Marlin/src/feature/bedlevel/bedlevel.cpp @@ -27,7 +27,7 @@ #include "bedlevel.h" #include "../../module/planner.h" -#if EITHER(MESH_BED_LEVELING, PROBE_MANUALLY) +#if ANY(MESH_BED_LEVELING, PROBE_MANUALLY) #include "../../module/motion.h" #endif @@ -120,7 +120,7 @@ void reset_bed_level() { TERN_(ABL_PLANAR, planner.bed_level_matrix.set_to_identity()); } -#if EITHER(AUTO_BED_LEVELING_BILINEAR, MESH_BED_LEVELING) +#if ANY(AUTO_BED_LEVELING_BILINEAR, MESH_BED_LEVELING) /** * Enable to produce output in JSON format suitable @@ -188,7 +188,7 @@ void reset_bed_level() { #endif // AUTO_BED_LEVELING_BILINEAR || MESH_BED_LEVELING -#if EITHER(MESH_BED_LEVELING, PROBE_MANUALLY) +#if ANY(MESH_BED_LEVELING, PROBE_MANUALLY) void _manual_goto_xy(const xy_pos_t &pos) { diff --git a/Marlin/src/feature/bedlevel/bedlevel.h b/Marlin/src/feature/bedlevel/bedlevel.h index aeafec10d6abc..ccb9543e72e5a 100644 --- a/Marlin/src/feature/bedlevel/bedlevel.h +++ b/Marlin/src/feature/bedlevel/bedlevel.h @@ -23,7 +23,7 @@ #include "../../inc/MarlinConfigPre.h" -#if EITHER(RESTORE_LEVELING_AFTER_G28, ENABLE_LEVELING_AFTER_G28) +#if ANY(RESTORE_LEVELING_AFTER_G28, ENABLE_LEVELING_AFTER_G28) #define CAN_SET_LEVELING_AFTER_G28 1 #endif @@ -41,7 +41,7 @@ void reset_bed_level(); void set_z_fade_height(const_float_t zfh, const bool do_report=true); #endif -#if EITHER(MESH_BED_LEVELING, PROBE_MANUALLY) +#if ANY(MESH_BED_LEVELING, PROBE_MANUALLY) void _manual_goto_xy(const xy_pos_t &pos); #endif @@ -69,7 +69,7 @@ class TemporaryBedLevelingState { #include "mbl/mesh_bed_leveling.h" #endif - #if EITHER(AUTO_BED_LEVELING_BILINEAR, MESH_BED_LEVELING) + #if ANY(AUTO_BED_LEVELING_BILINEAR, MESH_BED_LEVELING) #include diff --git a/Marlin/src/feature/cancel_object.cpp b/Marlin/src/feature/cancel_object.cpp index bffd2bb72020d..9b658315ed8b4 100644 --- a/Marlin/src/feature/cancel_object.cpp +++ b/Marlin/src/feature/cancel_object.cpp @@ -44,7 +44,7 @@ void CancelObject::set_active_object(const int8_t obj) { else skipping = false; - #if BOTH(HAS_STATUS_MESSAGE, CANCEL_OBJECTS_REPORTING) + #if ALL(HAS_STATUS_MESSAGE, CANCEL_OBJECTS_REPORTING) if (active_object >= 0) ui.status_printf(0, F(S_FMT " %i"), GET_TEXT(MSG_PRINTING_OBJECT), int(active_object)); else diff --git a/Marlin/src/feature/cooler.cpp b/Marlin/src/feature/cooler.cpp index e0f99777d19a8..6c45e992262e4 100644 --- a/Marlin/src/feature/cooler.cpp +++ b/Marlin/src/feature/cooler.cpp @@ -22,7 +22,7 @@ #include "../inc/MarlinConfig.h" -#if EITHER(HAS_COOLER, LASER_COOLANT_FLOW_METER) +#if ANY(HAS_COOLER, LASER_COOLANT_FLOW_METER) #include "cooler.h" Cooler cooler; diff --git a/Marlin/src/feature/host_actions.cpp b/Marlin/src/feature/host_actions.cpp index a1c1bad5bb44a..235253b5a345d 100644 --- a/Marlin/src/feature/host_actions.cpp +++ b/Marlin/src/feature/host_actions.cpp @@ -187,13 +187,13 @@ void HostUI::action(FSTR_P const fstr, const bool eol) { switch (response) { case 0: // "Purge More" button - #if BOTH(M600_PURGE_MORE_RESUMABLE, ADVANCED_PAUSE_FEATURE) + #if ALL(M600_PURGE_MORE_RESUMABLE, ADVANCED_PAUSE_FEATURE) pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE; // Simulate menu selection (menu exits, doesn't extrude more) #endif break; case 1: // "Continue" / "Disable Runout" button - #if BOTH(M600_PURGE_MORE_RESUMABLE, ADVANCED_PAUSE_FEATURE) + #if ALL(M600_PURGE_MORE_RESUMABLE, ADVANCED_PAUSE_FEATURE) pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT; // Simulate menu selection #endif #if HAS_FILAMENT_SENSOR @@ -209,7 +209,7 @@ void HostUI::action(FSTR_P const fstr, const bool eol) { TERN_(HAS_RESUME_CONTINUE, wait_for_user = false); break; case PROMPT_PAUSE_RESUME: - #if BOTH(ADVANCED_PAUSE_FEATURE, HAS_MEDIA) + #if ALL(ADVANCED_PAUSE_FEATURE, HAS_MEDIA) extern const char M24_STR[]; queue.inject_P(M24_STR); #endif diff --git a/Marlin/src/feature/leds/leds.cpp b/Marlin/src/feature/leds/leds.cpp index 94900445dcbc1..45810a31ab3c0 100644 --- a/Marlin/src/feature/leds/leds.cpp +++ b/Marlin/src/feature/leds/leds.cpp @@ -30,7 +30,7 @@ #include "leds.h" -#if EITHER(CASE_LIGHT_USE_RGB_LED, CASE_LIGHT_USE_NEOPIXEL) +#if ANY(CASE_LIGHT_USE_RGB_LED, CASE_LIGHT_USE_NEOPIXEL) #include "../../feature/caselight.h" #endif @@ -50,7 +50,7 @@ LEDLights leds; void LEDLights::setup() { - #if EITHER(RGB_LED, RGBW_LED) + #if ANY(RGB_LED, RGBW_LED) if (PWM_PIN(RGB_LED_R_PIN)) SET_PWM(RGB_LED_R_PIN); else SET_OUTPUT(RGB_LED_R_PIN); if (PWM_PIN(RGB_LED_G_PIN)) SET_PWM(RGB_LED_G_PIN); else SET_OUTPUT(RGB_LED_G_PIN); if (PWM_PIN(RGB_LED_B_PIN)) SET_PWM(RGB_LED_B_PIN); else SET_OUTPUT(RGB_LED_B_PIN); @@ -96,7 +96,7 @@ void LEDLights::setup() { } #endif // RGB_STARTUP_TEST - #elif BOTH(PCA9632, RGB_STARTUP_TEST) // PCA9632 RGB_STARTUP_TEST + #elif ALL(PCA9632, RGB_STARTUP_TEST) // PCA9632 RGB_STARTUP_TEST constexpr int8_t led_pin_count = TERN(HAS_WHITE_LED, 4, 3); @@ -176,7 +176,7 @@ void LEDLights::set_color(const LEDColor &incol #endif #endif - #if BOTH(CASE_LIGHT_MENU, CASE_LIGHT_USE_NEOPIXEL) + #if ALL(CASE_LIGHT_MENU, CASE_LIGHT_USE_NEOPIXEL) // Update brightness only if caselight is ON or switching leds off if (caselight.on || incol.is_off()) #endif @@ -191,7 +191,7 @@ void LEDLights::set_color(const LEDColor &incol } #endif - #if BOTH(CASE_LIGHT_MENU, CASE_LIGHT_USE_NEOPIXEL) + #if ALL(CASE_LIGHT_MENU, CASE_LIGHT_USE_NEOPIXEL) // Update color only if caselight is ON or switching leds off if (caselight.on || incol.is_off()) #endif @@ -206,7 +206,7 @@ void LEDLights::set_color(const LEDColor &incol #endif - #if EITHER(RGB_LED, RGBW_LED) + #if ANY(RGB_LED, RGBW_LED) // This variant uses 3-4 separate pins for the RGB(W) components. // If the pins can do PWM then their intensity will be set. @@ -228,7 +228,7 @@ void LEDLights::set_color(const LEDColor &incol TERN_(PCA9632, PCA9632_set_led_color(incol)); TERN_(PCA9533, PCA9533_set_rgb(incol.r, incol.g, incol.b)); - #if EITHER(LED_CONTROL_MENU, PRINTER_EVENT_LEDS) + #if ANY(LED_CONTROL_MENU, PRINTER_EVENT_LEDS) // Don't update the color when OFF lights_on = !incol.is_off(); if (lights_on) color = incol; diff --git a/Marlin/src/feature/leds/leds.h b/Marlin/src/feature/leds/leds.h index c6137b45c3555..7a31ca685d49a 100644 --- a/Marlin/src/feature/leds/leds.h +++ b/Marlin/src/feature/leds/leds.h @@ -30,7 +30,7 @@ #include // A white component can be passed -#if EITHER(RGBW_LED, PCA9632_RGBW) +#if ANY(RGBW_LED, PCA9632_RGBW) #define HAS_WHITE_LED 1 #endif @@ -164,7 +164,7 @@ class LEDLights { #if ENABLED(LED_CONTROL_MENU) static void toggle(); // swap "off" with color #endif - #if EITHER(LED_CONTROL_MENU, CASE_LIGHT_USE_RGB_LED) || LED_POWEROFF_TIMEOUT > 0 + #if ANY(LED_CONTROL_MENU, CASE_LIGHT_USE_RGB_LED) || LED_POWEROFF_TIMEOUT > 0 static void update() { set_color(color); } #endif diff --git a/Marlin/src/feature/leds/neopixel.cpp b/Marlin/src/feature/leds/neopixel.cpp index 2193217df0559..1b0772c2f9a6c 100644 --- a/Marlin/src/feature/leds/neopixel.cpp +++ b/Marlin/src/feature/leds/neopixel.cpp @@ -30,7 +30,7 @@ #include "leds.h" -#if EITHER(NEOPIXEL_STARTUP_TEST, NEOPIXEL2_STARTUP_TEST) +#if ANY(NEOPIXEL_STARTUP_TEST, NEOPIXEL2_STARTUP_TEST) #include "../../core/utility.h" #endif diff --git a/Marlin/src/feature/leds/neopixel.h b/Marlin/src/feature/leds/neopixel.h index 3801ded6aa455..6cc8b6157e806 100644 --- a/Marlin/src/feature/leds/neopixel.h +++ b/Marlin/src/feature/leds/neopixel.h @@ -58,7 +58,7 @@ #define MULTIPLE_NEOPIXEL_TYPES 1 #endif -#if EITHER(MULTIPLE_NEOPIXEL_TYPES, NEOPIXEL2_INSERIES) +#if ANY(MULTIPLE_NEOPIXEL_TYPES, NEOPIXEL2_INSERIES) #define CONJOINED_NEOPIXEL 1 #endif diff --git a/Marlin/src/feature/mixing.cpp b/Marlin/src/feature/mixing.cpp index cf88b806f542e..7c9c54a314b8f 100644 --- a/Marlin/src/feature/mixing.cpp +++ b/Marlin/src/feature/mixing.cpp @@ -42,7 +42,7 @@ int_fast8_t Mixer::runner = 0; mixer_comp_t Mixer::s_color[MIXING_STEPPERS]; mixer_accu_t Mixer::accu[MIXING_STEPPERS] = { 0 }; -#if EITHER(HAS_DUAL_MIXING, GRADIENT_MIX) +#if ANY(HAS_DUAL_MIXING, GRADIENT_MIX) mixer_perc_t Mixer::mix[MIXING_STEPPERS]; #endif @@ -138,7 +138,7 @@ void Mixer::init() { color[MIXER_AUTORETRACT_TOOL][i] = COLOR_A_MASK; #endif - #if EITHER(HAS_DUAL_MIXING, GRADIENT_MIX) + #if ANY(HAS_DUAL_MIXING, GRADIENT_MIX) update_mix_from_vtool(); #endif diff --git a/Marlin/src/feature/mixing.h b/Marlin/src/feature/mixing.h index 3a14fdad5975c..a43b0599447ae 100644 --- a/Marlin/src/feature/mixing.h +++ b/Marlin/src/feature/mixing.h @@ -122,7 +122,7 @@ class Mixer { MIXER_STEPPER_LOOP(i) s_color[i] = b_color[i]; } - #if EITHER(HAS_DUAL_MIXING, GRADIENT_MIX) + #if ANY(HAS_DUAL_MIXING, GRADIENT_MIX) static mixer_perc_t mix[MIXING_STEPPERS]; // Scratch array for the Mix in proportion to 100 diff --git a/Marlin/src/feature/mmu/mmu2.cpp b/Marlin/src/feature/mmu/mmu2.cpp index 8aec1dc1db1b0..fbfcf3fd3f7fa 100644 --- a/Marlin/src/feature/mmu/mmu2.cpp +++ b/Marlin/src/feature/mmu/mmu2.cpp @@ -135,7 +135,7 @@ void MMU2::reset() { int8_t MMU2::get_current_tool() { return extruder == MMU2_NO_TOOL ? -1 : extruder; } -#if EITHER(HAS_PRUSA_MMU2S, MMU_EXTRUDER_SENSOR) +#if ANY(HAS_PRUSA_MMU2S, MMU_EXTRUDER_SENSOR) #define FILAMENT_PRESENT() (READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE) #else #define FILAMENT_PRESENT() true diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index 504a9f61c78a5..6e57f6e2dc847 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -210,7 +210,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load while (wait_for_user) { impatient_beep(max_beep_count); - #if BOTH(FILAMENT_CHANGE_RESUME_ON_INSERT, FILAMENT_RUNOUT_SENSOR) + #if ALL(FILAMENT_CHANGE_RESUME_ON_INSERT, FILAMENT_RUNOUT_SENSOR) #if MULTI_FILAMENT_SENSOR #define _CASE_INSERTED(N) case N-1: if (READ(FIL_RUNOUT##N##_PIN) != FIL_RUNOUT##N##_STATE) wait_for_user = false; break; switch (active_extruder) { @@ -286,7 +286,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load // Show "Purge More" / "Resume" menu and wait for reply KEEPALIVE_STATE(PAUSED_FOR_USER); wait_for_user = false; - #if EITHER(HAS_MARLINUI_MENU, DWIN_LCD_PROUI) + #if ANY(HAS_MARLINUI_MENU, DWIN_LCD_PROUI) ui.pause_show_message(PAUSE_MESSAGE_OPTION); // Also sets PAUSE_RESPONSE_WAIT_FOR #else pause_menu_response = PAUSE_RESPONSE_WAIT_FOR; @@ -331,18 +331,18 @@ inline void disable_active_extruder() { */ bool unload_filament(const_float_t unload_length, const bool show_lcd/*=false*/, const PauseMode mode/*=PAUSE_MODE_PAUSE_PRINT*/ - #if BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER) + #if ALL(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER) , const_float_t mix_multiplier/*=1.0*/ #endif ) { DEBUG_SECTION(uf, "unload_filament", true); DEBUG_ECHOLNPGM("... unloadlen:", unload_length, " showlcd:", show_lcd, " mode:", mode - #if BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER) + #if ALL(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER) , " mixmult:", mix_multiplier #endif ); - #if !BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER) + #if !ALL(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER) constexpr float mix_multiplier = 1.0f; #endif @@ -445,7 +445,7 @@ bool pause_print(const_float_t retract, const xyz_pos_t &park_point, const bool // Wait for buffered blocks to complete planner.synchronize(); - #if BOTH(ADVANCED_PAUSE_FANS_PAUSE, HAS_FAN) + #if ALL(ADVANCED_PAUSE_FANS_PAUSE, HAS_FAN) thermalManager.set_fans_paused(true); #endif diff --git a/Marlin/src/feature/pause.h b/Marlin/src/feature/pause.h index 134b1d1b3294d..7ea0c03b6bbba 100644 --- a/Marlin/src/feature/pause.h +++ b/Marlin/src/feature/pause.h @@ -117,7 +117,7 @@ bool unload_filament( const_float_t unload_length, // (mm) Filament Unload Length - 0 to skip const bool show_lcd=false, // Set LCD status messages? const PauseMode mode=PAUSE_MODE_PAUSE_PRINT // Pause Mode to apply - #if BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER) + #if ALL(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER) , const_float_t mix_multiplier=1.0f // Extrusion multiplier (for a Mixing Extruder) #endif ); diff --git a/Marlin/src/feature/power.cpp b/Marlin/src/feature/power.cpp index 8a16628bac459..d0f8a66fec36e 100644 --- a/Marlin/src/feature/power.cpp +++ b/Marlin/src/feature/power.cpp @@ -26,7 +26,7 @@ #include "../inc/MarlinConfigPre.h" -#if EITHER(PSU_CONTROL, AUTO_POWER_CONTROL) +#if ANY(PSU_CONTROL, AUTO_POWER_CONTROL) #include "power.h" #include "../module/planner.h" @@ -49,7 +49,7 @@ bool Power::psu_on; #include "../module/stepper.h" #include "../module/temperature.h" - #if BOTH(USE_CONTROLLER_FAN, AUTO_POWER_CONTROLLERFAN) + #if ALL(USE_CONTROLLER_FAN, AUTO_POWER_CONTROLLERFAN) #include "controllerfan.h" #endif @@ -78,7 +78,7 @@ void Power::power_on() { if (psu_on) return; - #if EITHER(POWER_OFF_TIMER, POWER_OFF_WAIT_FOR_COOLDOWN) + #if ANY(POWER_OFF_TIMER, POWER_OFF_WAIT_FOR_COOLDOWN) cancelAutoPowerOff(); #endif @@ -115,12 +115,12 @@ void Power::power_off() { OUT_WRITE(PS_ON_PIN, !PSU_ACTIVE_STATE); psu_on = false; - #if EITHER(POWER_OFF_TIMER, POWER_OFF_WAIT_FOR_COOLDOWN) + #if ANY(POWER_OFF_TIMER, POWER_OFF_WAIT_FOR_COOLDOWN) cancelAutoPowerOff(); #endif } -#if EITHER(AUTO_POWER_CONTROL, POWER_OFF_WAIT_FOR_COOLDOWN) +#if ANY(AUTO_POWER_CONTROL, POWER_OFF_WAIT_FOR_COOLDOWN) bool Power::is_cooling_needed() { #if HAS_HOTEND && AUTO_POWER_E_TEMP @@ -140,7 +140,7 @@ void Power::power_off() { #endif -#if EITHER(POWER_OFF_TIMER, POWER_OFF_WAIT_FOR_COOLDOWN) +#if ANY(POWER_OFF_TIMER, POWER_OFF_WAIT_FOR_COOLDOWN) #if ENABLED(POWER_OFF_TIMER) millis_t Power::power_off_time = 0; @@ -192,7 +192,7 @@ void Power::power_off() { HOTEND_LOOP() if (thermalManager.autofan_speed[e]) return true; #endif - #if BOTH(USE_CONTROLLER_FAN, AUTO_POWER_CONTROLLERFAN) + #if ALL(USE_CONTROLLER_FAN, AUTO_POWER_CONTROLLERFAN) if (controllerFan.state()) return true; #endif diff --git a/Marlin/src/feature/power.h b/Marlin/src/feature/power.h index 839366ca602bd..fdbb7126ceae8 100644 --- a/Marlin/src/feature/power.h +++ b/Marlin/src/feature/power.h @@ -25,7 +25,7 @@ * power.h - power control */ -#if EITHER(AUTO_POWER_CONTROL, POWER_OFF_TIMER) +#if ANY(AUTO_POWER_CONTROL, POWER_OFF_TIMER) #include "../core/millis_t.h" #endif @@ -37,7 +37,7 @@ class Power { static void power_on(); static void power_off(); - #if EITHER(POWER_OFF_TIMER, POWER_OFF_WAIT_FOR_COOLDOWN) + #if ANY(POWER_OFF_TIMER, POWER_OFF_WAIT_FOR_COOLDOWN) #if ENABLED(POWER_OFF_TIMER) static millis_t power_off_time; static void setPowerOffTimer(const millis_t delay_ms); diff --git a/Marlin/src/feature/powerloss.cpp b/Marlin/src/feature/powerloss.cpp index 29c4695ca4767..24ff2b2195829 100644 --- a/Marlin/src/feature/powerloss.cpp +++ b/Marlin/src/feature/powerloss.cpp @@ -699,7 +699,7 @@ void PrintJobRecovery::resume() { #endif // Mixing extruder and gradient - #if BOTH(MIXING_EXTRUDER, GRADIENT_MIX) + #if ALL(MIXING_EXTRUDER, GRADIENT_MIX) DEBUG_ECHOLNPGM("gradient: ", info.gradient.enabled ? "ON" : "OFF"); #endif diff --git a/Marlin/src/feature/solenoid.cpp b/Marlin/src/feature/solenoid.cpp index 861e44ed05deb..46364eaf8f5b3 100644 --- a/Marlin/src/feature/solenoid.cpp +++ b/Marlin/src/feature/solenoid.cpp @@ -22,7 +22,7 @@ #include "../inc/MarlinConfig.h" -#if EITHER(EXT_SOLENOID, MANUAL_SOLENOID_CONTROL) +#if ANY(EXT_SOLENOID, MANUAL_SOLENOID_CONTROL) #include "solenoid.h" diff --git a/Marlin/src/gcode/bedlevel/G35.cpp b/Marlin/src/gcode/bedlevel/G35.cpp index f5f395ee2e252..901e97ab756b4 100644 --- a/Marlin/src/gcode/bedlevel/G35.cpp +++ b/Marlin/src/gcode/bedlevel/G35.cpp @@ -144,7 +144,7 @@ void GcodeSuite::G35() { // Restore the active tool after homing probe.use_probing_tool(false); - #if BOTH(HAS_LEVELING, RESTORE_LEVELING_AFTER_G35) + #if ALL(HAS_LEVELING, RESTORE_LEVELING_AFTER_G35) set_bed_leveling_enabled(leveling_was_active); #endif diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 1fe4a31bee483..5c86f4b991687 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -97,7 +97,7 @@ class G29_State { bool dryrun, reenable; - #if EITHER(PROBE_MANUALLY, AUTO_BED_LEVELING_LINEAR) + #if ANY(PROBE_MANUALLY, AUTO_BED_LEVELING_LINEAR) int abl_probe_index; #endif @@ -139,7 +139,7 @@ class G29_State { #endif }; -#if ABL_USES_GRID && EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_BILINEAR) +#if ABL_USES_GRID && ANY(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_BILINEAR) constexpr xy_uint8_t G29_State::grid_points; constexpr grid_count_t G29_State::abl_points; #endif @@ -231,7 +231,7 @@ G29_TYPE GcodeSuite::G29() { reset_stepper_timeout(); // Q = Query leveling and G29 state - const bool seenQ = EITHER(DEBUG_LEVELING_FEATURE, PROBE_MANUALLY) && parser.seen_test('Q'); + const bool seenQ = ANY(DEBUG_LEVELING_FEATURE, PROBE_MANUALLY) && parser.seen_test('Q'); // G29 Q is also available if debugging #if ENABLED(DEBUG_LEVELING_FEATURE) @@ -279,7 +279,7 @@ G29_TYPE GcodeSuite::G29() { probe.use_probing_tool(); - #if EITHER(PROBE_MANUALLY, AUTO_BED_LEVELING_LINEAR) + #if ANY(PROBE_MANUALLY, AUTO_BED_LEVELING_LINEAR) abl.abl_probe_index = -1; #endif @@ -436,7 +436,7 @@ G29_TYPE GcodeSuite::G29() { #if ENABLED(PREHEAT_BEFORE_LEVELING) if (!abl.dryrun) probe.preheat_for_probing(LEVELING_NOZZLE_TEMP, - #if BOTH(DWIN_LCD_PROUI, HAS_HEATED_BED) + #if ALL(DWIN_LCD_PROUI, HAS_HEATED_BED) HMI_data.BedLevT #else LEVELING_BED_TEMP @@ -484,7 +484,7 @@ G29_TYPE GcodeSuite::G29() { if (!no_action) set_bed_leveling_enabled(false); // Deploy certain probes before starting probing - #if ENABLED(BLTOUCH) || BOTH(HAS_Z_SERVO_PROBE, Z_SERVO_INTERMEDIATE_STOW) + #if ENABLED(BLTOUCH) || ALL(HAS_Z_SERVO_PROBE, Z_SERVO_INTERMEDIATE_STOW) do_z_clearance(Z_CLEARANCE_DEPLOY_PROBE); #elif HAS_BED_PROBE if (probe.deploy()) { // (returns true on deploy failure) @@ -542,7 +542,7 @@ G29_TYPE GcodeSuite::G29() { } else { - #if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT) + #if ANY(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT) const uint16_t index = abl.abl_probe_index - 1; #endif diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index be593d0d5b1b1..fde640fe98953 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -486,7 +486,7 @@ void GcodeSuite::G28() { } #endif // HAS_X_AXIS - #if BOTH(FOAMCUTTER_XYUV, HAS_I_AXIS) + #if ALL(FOAMCUTTER_XYUV, HAS_I_AXIS) // Home I (after X) if (doI) homeaxis(I_AXIS); #endif @@ -497,7 +497,7 @@ void GcodeSuite::G28() { homeaxis(Y_AXIS); #endif - #if BOTH(FOAMCUTTER_XYUV, HAS_J_AXIS) + #if ALL(FOAMCUTTER_XYUV, HAS_J_AXIS) // Home J (after Y) if (doJ) homeaxis(J_AXIS); #endif @@ -514,7 +514,7 @@ void GcodeSuite::G28() { // Home Z last if homing towards the bed #if DISABLED(HOME_Z_FIRST) if (doZ) { - #if EITHER(Z_MULTI_ENDSTOPS, Z_STEPPER_AUTO_ALIGN) + #if ANY(Z_MULTI_ENDSTOPS, Z_STEPPER_AUTO_ALIGN) stepper.set_all_z_lock(false); stepper.set_separate_multi_axis(false); #endif @@ -525,7 +525,7 @@ void GcodeSuite::G28() { homeaxis(Z_AXIS); #endif - #if EITHER(Z_HOME_TO_MIN, ALLOW_Z_AFTER_HOMING) + #if ANY(Z_HOME_TO_MIN, ALLOW_Z_AFTER_HOMING) finalRaiseZ = true; #endif } diff --git a/Marlin/src/gcode/calibrate/G34_M422.cpp b/Marlin/src/gcode/calibrate/G34_M422.cpp index 3e7ed08b6c1e1..a878db2edfec7 100644 --- a/Marlin/src/gcode/calibrate/G34_M422.cpp +++ b/Marlin/src/gcode/calibrate/G34_M422.cpp @@ -22,7 +22,7 @@ #include "../../inc/MarlinConfigPre.h" -#if EITHER(Z_MULTI_ENDSTOPS, Z_STEPPER_AUTO_ALIGN) +#if ANY(Z_MULTI_ENDSTOPS, Z_STEPPER_AUTO_ALIGN) #include "../../feature/z_stepper_align.h" @@ -431,7 +431,7 @@ void GcodeSuite::G34() { probe.use_probing_tool(false); - #if BOTH(HAS_LEVELING, RESTORE_LEVELING_AFTER_G34) + #if ALL(HAS_LEVELING, RESTORE_LEVELING_AFTER_G34) set_bed_leveling_enabled(leveling_was_active); #endif diff --git a/Marlin/src/gcode/calibrate/G76_M871.cpp b/Marlin/src/gcode/calibrate/G76_M871.cpp index f25c848f2faca..34b72ecdf3178 100644 --- a/Marlin/src/gcode/calibrate/G76_M871.cpp +++ b/Marlin/src/gcode/calibrate/G76_M871.cpp @@ -81,7 +81,7 @@ * - `P` - Run probe temperature calibration. */ -#if BOTH(PTC_PROBE, PTC_BED) +#if ALL(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."); } diff --git a/Marlin/src/gcode/calibrate/M100.cpp b/Marlin/src/gcode/calibrate/M100.cpp index 338392b59746a..9141d360e1b96 100644 --- a/Marlin/src/gcode/calibrate/M100.cpp +++ b/Marlin/src/gcode/calibrate/M100.cpp @@ -60,7 +60,7 @@ #define TEST_BYTE ((char) 0xE5) -#if EITHER(__AVR__, IS_32BIT_TEENSY) +#if ANY(__AVR__, IS_32BIT_TEENSY) extern char __bss_end; char *end_bss = &__bss_end, diff --git a/Marlin/src/gcode/calibrate/M666.cpp b/Marlin/src/gcode/calibrate/M666.cpp index 546aa7fcb54a8..dbee73f3947bd 100644 --- a/Marlin/src/gcode/calibrate/M666.cpp +++ b/Marlin/src/gcode/calibrate/M666.cpp @@ -22,7 +22,7 @@ #include "../../inc/MarlinConfig.h" -#if EITHER(DELTA, HAS_EXTRA_ENDSTOPS) +#if ANY(DELTA, HAS_EXTRA_ENDSTOPS) #include "../gcode.h" diff --git a/Marlin/src/gcode/control/M380_M381.cpp b/Marlin/src/gcode/control/M380_M381.cpp index 6bcec891e2818..20d24484ed0f6 100644 --- a/Marlin/src/gcode/control/M380_M381.cpp +++ b/Marlin/src/gcode/control/M380_M381.cpp @@ -22,7 +22,7 @@ #include "../../inc/MarlinConfig.h" -#if EITHER(EXT_SOLENOID, MANUAL_SOLENOID_CONTROL) +#if ANY(EXT_SOLENOID, MANUAL_SOLENOID_CONTROL) #include "../gcode.h" #include "../../feature/solenoid.h" diff --git a/Marlin/src/gcode/control/M7-M9.cpp b/Marlin/src/gcode/control/M7-M9.cpp index ccde4f552cb99..837bb114b2993 100644 --- a/Marlin/src/gcode/control/M7-M9.cpp +++ b/Marlin/src/gcode/control/M7-M9.cpp @@ -37,7 +37,7 @@ } #endif -#if EITHER(COOLANT_FLOOD, AIR_ASSIST) +#if ANY(COOLANT_FLOOD, AIR_ASSIST) #if ENABLED(AIR_ASSIST) #include "../../feature/spindle_laser.h" diff --git a/Marlin/src/gcode/control/M80_M81.cpp b/Marlin/src/gcode/control/M80_M81.cpp index 90b25e7ed34db..94dd5e3dd93f3 100644 --- a/Marlin/src/gcode/control/M80_M81.cpp +++ b/Marlin/src/gcode/control/M80_M81.cpp @@ -79,7 +79,7 @@ void GcodeSuite::M81() { print_job_timer.stop(); - #if BOTH(HAS_FAN, PROBING_FANS_OFF) + #if ALL(HAS_FAN, PROBING_FANS_OFF) thermalManager.fans_paused = false; ZERO(thermalManager.saved_fan_speed); #endif diff --git a/Marlin/src/gcode/control/T.cpp b/Marlin/src/gcode/control/T.cpp index 5e8f6b5436d43..5e1579ec123ae 100644 --- a/Marlin/src/gcode/control/T.cpp +++ b/Marlin/src/gcode/control/T.cpp @@ -23,7 +23,7 @@ #include "../gcode.h" #include "../../module/tool_change.h" -#if EITHER(HAS_MULTI_EXTRUDER, DEBUG_LEVELING_FEATURE) +#if ANY(HAS_MULTI_EXTRUDER, DEBUG_LEVELING_FEATURE) #include "../../module/motion.h" #endif diff --git a/Marlin/src/gcode/feature/pause/M125.cpp b/Marlin/src/gcode/feature/pause/M125.cpp index d6e6cb93150a5..079ae6c1ba5fd 100644 --- a/Marlin/src/gcode/feature/pause/M125.cpp +++ b/Marlin/src/gcode/feature/pause/M125.cpp @@ -96,7 +96,7 @@ void GcodeSuite::M125() { const bool show_lcd = TERN0(HAS_MARLINUI_MENU, parser.boolval('P')); if (pause_print(retract, park_point, show_lcd, 0)) { - if (ENABLED(EXTENSIBLE_UI) || BOTH(EMERGENCY_PARSER, HOST_PROMPT_SUPPORT) || !sd_printing || show_lcd) { + if (ENABLED(EXTENSIBLE_UI) || ALL(EMERGENCY_PARSER, HOST_PROMPT_SUPPORT) || !sd_printing || show_lcd) { wait_for_confirmation(false, 0); resume_print(0, 0, -retract, 0); } diff --git a/Marlin/src/gcode/feature/pause/M701_M702.cpp b/Marlin/src/gcode/feature/pause/M701_M702.cpp index 6ec560f5c6d65..aec3a16a2a023 100644 --- a/Marlin/src/gcode/feature/pause/M701_M702.cpp +++ b/Marlin/src/gcode/feature/pause/M701_M702.cpp @@ -199,7 +199,7 @@ void GcodeSuite::M702() { #if HAS_PRUSA_MMU2 mmu2.unload(); #else - #if BOTH(HAS_MULTI_EXTRUDER, FILAMENT_UNLOAD_ALL_EXTRUDERS) + #if ALL(HAS_MULTI_EXTRUDER, FILAMENT_UNLOAD_ALL_EXTRUDERS) if (!parser.seenval('T')) { HOTEND_LOOP() { if (e != active_extruder) tool_change(e); diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 530cde7901a2d..01b48a4af92b4 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -82,7 +82,7 @@ millis_t GcodeSuite::previous_move_ms = 0, // Relative motion mode for each logical axis relative_t GcodeSuite::axis_relative; // Init in constructor -#if EITHER(HAS_AUTO_REPORTING, HOST_KEEPALIVE_FEATURE) +#if ANY(HAS_AUTO_REPORTING, HOST_KEEPALIVE_FEATURE) bool GcodeSuite::autoreport_paused; // = false #endif @@ -204,13 +204,13 @@ void GcodeSuite::get_destination_from_command() { TERN_(LASER_FEATURE, cutter.feedrate_mm_m = MMS_TO_MMM(feedrate_mm_s)); } - #if BOTH(PRINTCOUNTER, HAS_EXTRUDERS) + #if ALL(PRINTCOUNTER, HAS_EXTRUDERS) if (!DEBUGGING(DRYRUN) && !skip_move) print_job_timer.incFilamentUsed(destination.e - current_position.e); #endif // Get ABCDHI mixing factors - #if BOTH(MIXING_EXTRUDER, DIRECT_MIXING_IN_G1) + #if ALL(MIXING_EXTRUDER, DIRECT_MIXING_IN_G1) M165(); #endif @@ -442,7 +442,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 61: G61(); break; // G61: Apply/restore saved coordinates. #endif - #if BOTH(PTC_PROBE, PTC_BED) + #if ALL(PTC_PROBE, PTC_BED) case 76: G76(); break; // G76: Calibrate first layer compensation values #endif @@ -484,11 +484,11 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 7: M7(); break; // M7: Coolant Mist ON #endif - #if EITHER(AIR_ASSIST, COOLANT_FLOOD) + #if ANY(AIR_ASSIST, COOLANT_FLOOD) case 8: M8(); break; // M8: Air Assist / Coolant Flood ON #endif - #if EITHER(AIR_ASSIST, COOLANT_CONTROL) + #if ANY(AIR_ASSIST, COOLANT_CONTROL) case 9: M9(); break; // M9: Air Assist / Coolant OFF #endif @@ -528,7 +528,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 33: M33(); break; // M33: Get the long full path to a file or folder #endif - #if BOTH(SDCARD_SORT_ALPHA, SDSORT_GCODE) + #if ALL(SDCARD_SORT_ALPHA, SDSORT_GCODE) case 34: M34(); break; // M34: Set SD card sorting options #endif @@ -628,7 +628,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 154: M154(); break; // M154: Set position auto-report interval #endif - #if BOTH(AUTO_REPORT_TEMPERATURES, HAS_TEMP_SENSOR) + #if ALL(AUTO_REPORT_TEMPERATURES, HAS_TEMP_SENSOR) case 155: M155(); break; // M155: Set temperature auto-report interval #endif @@ -828,7 +828,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 364: if (M364()) return; break; // M364: SCARA Psi pos3 (90 deg to Theta) #endif - #if EITHER(EXT_SOLENOID, MANUAL_SOLENOID_CONTROL) + #if ANY(EXT_SOLENOID, MANUAL_SOLENOID_CONTROL) case 380: M380(); break; // M380: Activate solenoid on active (or specified) extruder case 381: M381(); break; // M381: Disable all solenoids or, if MANUAL_SOLENOID_CONTROL, active (or specified) solenoid #endif @@ -946,7 +946,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 665: M665(); break; // M665: Set Kinematics parameters #endif - #if EITHER(DELTA, HAS_EXTRA_ENDSTOPS) + #if ANY(DELTA, HAS_EXTRA_ENDSTOPS) case 666: M666(); break; // M666: Set delta or multiple endstop adjustment #endif @@ -987,7 +987,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { #if ANY(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_PWM, HAS_MOTOR_CURRENT_I2C, HAS_MOTOR_CURRENT_DAC) case 907: M907(); break; // M907: Set digital trimpot motor current using axis codes. - #if EITHER(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_DAC) + #if ANY(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_DAC) case 908: M908(); break; // M908: Control digital trimpot directly. #if HAS_MOTOR_CURRENT_DAC case 909: M909(); break; // M909: Print digipot/DAC current value diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 52e8fbf8025e5..73729491adab2 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -336,7 +336,7 @@ #include "../feature/encoder_i2c.h" #endif -#if EITHER(IS_SCARA, POLAR) || defined(G0_FEEDRATE) +#if ANY(IS_SCARA, POLAR) || defined(G0_FEEDRATE) #define HAS_FAST_MOVES 1 #endif @@ -442,7 +442,7 @@ class GcodeSuite { process_subcommands_now(keep_leveling ? FPSTR(G28_STR) : TERN(CAN_SET_LEVELING_AFTER_G28, F("G28L0"), FPSTR(G28_STR))); } - #if EITHER(HAS_AUTO_REPORTING, HOST_KEEPALIVE_FEATURE) + #if ANY(HAS_AUTO_REPORTING, HOST_KEEPALIVE_FEATURE) static bool autoreport_paused; static bool set_autoreport_paused(const bool p) { const bool was = autoreport_paused; @@ -592,7 +592,7 @@ class GcodeSuite { static void G59(); #endif - #if BOTH(PTC_PROBE, PTC_BED) + #if ALL(PTC_PROBE, PTC_BED) static void G76(); #endif @@ -624,11 +624,11 @@ class GcodeSuite { static void M7(); #endif - #if EITHER(AIR_ASSIST, COOLANT_FLOOD) + #if ANY(AIR_ASSIST, COOLANT_FLOOD) static void M8(); #endif - #if EITHER(AIR_ASSIST, COOLANT_CONTROL) + #if ANY(AIR_ASSIST, COOLANT_CONTROL) static void M9(); #endif @@ -672,7 +672,7 @@ class GcodeSuite { #if ENABLED(LONG_FILENAME_HOST_SUPPORT) static void M33(); #endif - #if BOTH(SDCARD_SORT_ALPHA, SDSORT_GCODE) + #if ALL(SDCARD_SORT_ALPHA, SDSORT_GCODE) static void M34(); #endif #endif @@ -821,7 +821,7 @@ class GcodeSuite { static void M154(); #endif - #if BOTH(AUTO_REPORT_TEMPERATURES, HAS_TEMP_SENSOR) + #if ALL(AUTO_REPORT_TEMPERATURES, HAS_TEMP_SENSOR) static void M155(); #endif @@ -993,7 +993,7 @@ class GcodeSuite { static bool M364(); #endif - #if EITHER(EXT_SOLENOID, MANUAL_SOLENOID_CONTROL) + #if ANY(EXT_SOLENOID, MANUAL_SOLENOID_CONTROL) static void M380(); static void M381(); #endif @@ -1120,7 +1120,7 @@ class GcodeSuite { static void M665_report(const bool forReplay=true); #endif - #if EITHER(DELTA, HAS_EXTRA_ENDSTOPS) + #if ANY(DELTA, HAS_EXTRA_ENDSTOPS) static void M666(); static void M666_report(const bool forReplay=true); #endif diff --git a/Marlin/src/gcode/geometry/G92.cpp b/Marlin/src/gcode/geometry/G92.cpp index b36f21d3c08fd..dfe4170620eca 100644 --- a/Marlin/src/gcode/geometry/G92.cpp +++ b/Marlin/src/gcode/geometry/G92.cpp @@ -88,28 +88,28 @@ void GcodeSuite::G92() { case 0: LOOP_LOGICAL_AXES(i) { if (parser.seenval(AXIS_CHAR(i))) { - const float l = parser.value_axis_units((AxisEnum)i), // Given axis coordinate value, converted to millimeters + const float l = parser.value_axis_units((AxisEnum)i), // Given axis coordinate value, converted to millimeters 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? + d = v - current_position[i]; // How much is the current axis position altered by? if (!NEAR_ZERO(d)) { - #if HAS_POSITION_SHIFT && NONE(IS_SCARA, POLARGRAPH) // 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... + position_shift[i] += d; // ...most axes offset the workspace... update_workspace_offset((AxisEnum)i); } else { #if HAS_EXTRUDERS sync_E = true; - current_position.e = v; // ...but E is set directly + current_position.e = v; // ...but E is set directly #endif } - #else // Without workspaces... + #else // Without workspaces... if (TERN1(HAS_EXTRUDERS, i != E_AXIS)) sync_XYZE = true; else { TERN_(HAS_EXTRUDERS, sync_E = true); } - current_position[i] = v; // ...set Current Position directly (like Marlin 1.0) + current_position[i] = v; // ...set Current Position directly (like Marlin 1.0) #endif } } diff --git a/Marlin/src/gcode/motion/G0_G1.cpp b/Marlin/src/gcode/motion/G0_G1.cpp index 88551f5eb6e9d..957541a361d04 100644 --- a/Marlin/src/gcode/motion/G0_G1.cpp +++ b/Marlin/src/gcode/motion/G0_G1.cpp @@ -25,7 +25,7 @@ #include "../../MarlinCore.h" -#if BOTH(FWRETRACT, FWRETRACT_AUTORETRACT) +#if ALL(FWRETRACT, FWRETRACT_AUTORETRACT) #include "../../feature/fwretract.h" #endif @@ -72,7 +72,7 @@ void GcodeSuite::G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move/*=false*/)) { } #endif - #if BOTH(FWRETRACT, FWRETRACT_AUTORETRACT) + #if ALL(FWRETRACT, FWRETRACT_AUTORETRACT) if (MIN_AUTORETRACT <= MAX_AUTORETRACT) { // When M209 Autoretract is enabled, convert E-only moves to firmware retract/recover moves @@ -91,7 +91,7 @@ void GcodeSuite::G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move/*=false*/)) { #endif // FWRETRACT - #if EITHER(IS_SCARA, POLAR) + #if ANY(IS_SCARA, POLAR) fast_move ? prepare_fast_move_to_destination() : prepare_line_to_destination(); #else prepare_line_to_destination(); diff --git a/Marlin/src/gcode/parser.cpp b/Marlin/src/gcode/parser.cpp index 3fc1fc1625add..90586e371f501 100644 --- a/Marlin/src/gcode/parser.cpp +++ b/Marlin/src/gcode/parser.cpp @@ -233,7 +233,7 @@ void GCodeParser::parse(char *p) { #if ENABLED(GCODE_MOTION_MODES) - #if EITHER(BEZIER_CURVE_SUPPORT, ARC_SUPPORT) + #if ANY(BEZIER_CURVE_SUPPORT, ARC_SUPPORT) case 'I' ... 'J': case 'P': if (TERN1(BEZIER_CURVE_SUPPORT, motion_mode_codenum != 5) && TERN1(ARC_P_CIRCLES, !WITHIN(motion_mode_codenum, 2, 3)) diff --git a/Marlin/src/gcode/probe/G30.cpp b/Marlin/src/gcode/probe/G30.cpp index ad797688bb83d..4c044af9d6e7b 100644 --- a/Marlin/src/gcode/probe/G30.cpp +++ b/Marlin/src/gcode/probe/G30.cpp @@ -79,7 +79,7 @@ void GcodeSuite::G30() { TERN_(HAS_PTC, ptc.set_enabled(true)); if (!isnan(measured_z)) { SERIAL_ECHOLNPGM("Bed X: ", probepos.asLogical().x, " Y: ", probepos.asLogical().y, " Z: ", measured_z); - #if EITHER(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) + #if ANY(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(probepos.x, 1, 1, str_1), diff --git a/Marlin/src/gcode/sd/M1001.cpp b/Marlin/src/gcode/sd/M1001.cpp index 3c8f38a1448ac..c49909646eaaa 100644 --- a/Marlin/src/gcode/sd/M1001.cpp +++ b/Marlin/src/gcode/sd/M1001.cpp @@ -34,7 +34,7 @@ #include "../queue.h" #endif -#if EITHER(SET_PROGRESS_MANUALLY, SD_REPRINT_LAST_SELECTED_FILE) +#if ANY(SET_PROGRESS_MANUALLY, SD_REPRINT_LAST_SELECTED_FILE) #include "../../lcd/marlinui.h" #endif diff --git a/Marlin/src/gcode/sd/M34.cpp b/Marlin/src/gcode/sd/M34.cpp index 2dd7dc580c93d..0a7d4d8c6221e 100644 --- a/Marlin/src/gcode/sd/M34.cpp +++ b/Marlin/src/gcode/sd/M34.cpp @@ -22,7 +22,7 @@ #include "../../inc/MarlinConfig.h" -#if BOTH(SDCARD_SORT_ALPHA, SDSORT_GCODE) +#if ALL(SDCARD_SORT_ALPHA, SDSORT_GCODE) #include "../gcode.h" #include "../../sd/cardreader.h" diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 5b643386622aa..e5cbc83459d9f 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -31,12 +31,12 @@ #endif // MKS_LCD12864A/B is a variant of MKS_MINI_12864 -#if EITHER(MKS_LCD12864A, MKS_LCD12864B) +#if ANY(MKS_LCD12864A, MKS_LCD12864B) #define MKS_MINI_12864 #endif // MKS_MINI_12864_V3 and BTT_MINI_12864_V1 are identical to FYSETC_MINI_12864_2_1 -#if EITHER(MKS_MINI_12864_V3, BTT_MINI_12864_V1) +#if ANY(MKS_MINI_12864_V3, BTT_MINI_12864_V1) #define FYSETC_MINI_12864_2_1 #endif @@ -70,7 +70,7 @@ * IS_U8GLIB_ST7565_64128N : ST7565 128x64 LCD with SPI interface via U8GLib * IS_U8GLIB_LM6059_AF : LM6059 with Hardware SPI via U8GLib */ -#if EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY) +#if ANY(MKS_MINI_12864, ENDER2_STOCKDISPLAY) #define MINIPANEL @@ -83,7 +83,7 @@ #define DOGLCD #define IS_ULTIPANEL 1 -#elif EITHER(DWIN_MARLINUI_PORTRAIT, DWIN_MARLINUI_LANDSCAPE) +#elif ANY(DWIN_MARLINUI_PORTRAIT, DWIN_MARLINUI_LANDSCAPE) #define IS_DWIN_MARLINUI 1 #define IS_ULTIPANEL 1 @@ -216,7 +216,7 @@ #define LCD_WIDTH 16 #define LCD_HEIGHT 2 -#elif EITHER(TFTGLCD_PANEL_SPI, TFTGLCD_PANEL_I2C) +#elif ANY(TFTGLCD_PANEL_SPI, TFTGLCD_PANEL_I2C) #define IS_TFTGLCD_PANEL 1 #define IS_ULTIPANEL 1 // Note that IS_ULTIPANEL leads to HAS_WIRED_LCD @@ -246,7 +246,7 @@ #define LCD_ST7920_DELAY_2 125 #define LCD_ST7920_DELAY_3 125 -#elif EITHER(ANET_FULL_GRAPHICS_LCD, ANET_FULL_GRAPHICS_LCD_ALT_WIRING) +#elif ANY(ANET_FULL_GRAPHICS_LCD, ANET_FULL_GRAPHICS_LCD_ALT_WIRING) #define IS_RRD_FG_SC 1 #define LCD_ST7920_DELAY_1 150 @@ -276,7 +276,7 @@ #endif // ST7565 / 64128N graphical displays -#if EITHER(MAKRPANEL, MINIPANEL) +#if ANY(MAKRPANEL, MINIPANEL) #define IS_ULTIPANEL 1 #define DOGLCD #if ENABLED(MAKRPANEL) @@ -337,11 +337,11 @@ #elif ANY(SPI_GRAPHICAL_TFT, TFT_320x240_SPI, TFT_480x320_SPI, TFT_LVGL_UI_SPI) #define TFT_INTERFACE_SPI #endif - #if EITHER(FSMC_GRAPHICAL_TFT, SPI_GRAPHICAL_TFT) + #if ANY(FSMC_GRAPHICAL_TFT, SPI_GRAPHICAL_TFT) #define TFT_CLASSIC_UI #elif ANY(TFT_320x240, TFT_480x320, TFT_320x240_SPI, TFT_480x320_SPI) #define TFT_COLOR_UI - #elif EITHER(TFT_LVGL_UI_FSMC, TFT_LVGL_UI_SPI) + #elif ANY(TFT_LVGL_UI_FSMC, TFT_LVGL_UI_SPI) #define TFT_LVGL_UI #endif #endif @@ -387,7 +387,7 @@ #define IS_ULTIPANEL 1 #endif -#elif EITHER(LCD_SAINSMART_I2C_1602, LCD_SAINSMART_I2C_2004) +#elif ANY(LCD_SAINSMART_I2C_1602, LCD_SAINSMART_I2C_2004) #define LCD_I2C_TYPE_PCF8575 // I2C Character-based 12864 display #define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander @@ -425,7 +425,7 @@ #endif -#if EITHER(LCD_I2C_TYPE_MCP23017, LCD_I2C_TYPE_MCP23008) && DISABLED(NO_LCD_DETECT) +#if ANY(LCD_I2C_TYPE_MCP23017, LCD_I2C_TYPE_MCP23008) && DISABLED(NO_LCD_DETECT) #define DETECT_I2C_LCD_DEVICE 1 #endif @@ -463,15 +463,15 @@ #define IS_ULTIPANEL 1 #endif -#if EITHER(IS_ULTIPANEL, ULTRA_LCD) +#if ANY(IS_ULTIPANEL, ULTRA_LCD) #define HAS_WIRED_LCD 1 #endif -#if EITHER(IS_ULTIPANEL, REPRAPWORLD_KEYPAD) +#if ANY(IS_ULTIPANEL, REPRAPWORLD_KEYPAD) #define IS_NEWPANEL 1 #endif -#if EITHER(ZONESTAR_LCD, REPRAPWORLD_KEYPAD) +#if ANY(ZONESTAR_LCD, REPRAPWORLD_KEYPAD) #define IS_RRW_KEYPAD 1 #ifndef REPRAPWORLD_KEYPAD_MOVE_STEP #define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0 @@ -493,10 +493,10 @@ #endif // Aliases for LCD features -#if EITHER(DWIN_CREALITY_LCD, DWIN_LCD_PROUI) +#if ANY(DWIN_CREALITY_LCD, DWIN_LCD_PROUI) #define HAS_DWIN_E3V2_BASIC 1 #endif -#if EITHER(HAS_DWIN_E3V2_BASIC, DWIN_CREALITY_LCD_JYERSUI) +#if ANY(HAS_DWIN_E3V2_BASIC, DWIN_CREALITY_LCD_JYERSUI) #define HAS_DWIN_E3V2 1 #endif @@ -639,10 +639,10 @@ #define E_TERN_(N) TERN_(HAS_MULTI_EXTRUDER, N) #define E_TERN0(N) TERN0(HAS_MULTI_EXTRUDER, N) -#if EITHER(SWITCHING_EXTRUDER, MECHANICAL_SWITCHING_EXTRUDER) +#if ANY(SWITCHING_EXTRUDER, MECHANICAL_SWITCHING_EXTRUDER) #define HAS_SWITCHING_EXTRUDER 1 #endif -#if EITHER(SWITCHING_NOZZLE, MECHANICAL_SWITCHING_NOZZLE) +#if ANY(SWITCHING_NOZZLE, MECHANICAL_SWITCHING_NOZZLE) #define HAS_SWITCHING_NOZZLE 1 #endif @@ -700,14 +700,14 @@ #endif // Number of hotends... -#if EITHER(SINGLENOZZLE, MIXING_EXTRUDER) // Only one for singlenozzle or mixing extruder +#if ANY(SINGLENOZZLE, MIXING_EXTRUDER) // Only one for singlenozzle or mixing extruder #define HOTENDS 1 -#elif HAS_SWITCHING_EXTRUDER && !HAS_SWITCHING_NOZZLE // One for each pair of abstract "extruders" +#elif HAS_SWITCHING_EXTRUDER && !HAS_SWITCHING_NOZZLE // One for each pair of abstract "extruders" #define HOTENDS E_STEPPERS #elif TEMP_SENSOR_0 - #define HOTENDS EXTRUDERS // One per extruder if at least one heater exists + #define HOTENDS EXTRUDERS // One per extruder if at least one heater exists #else - #define HOTENDS 0 // A machine with no hotends at all can still extrude + #define HOTENDS 0 // A machine with no hotends at all can still extrude #endif // More than one hotend... @@ -1104,7 +1104,7 @@ #if DISABLED(SINGLENOZZLE) #undef SINGLENOZZLE_STANDBY_TEMP #endif -#if !BOTH(HAS_FAN, SINGLENOZZLE) +#if !ALL(HAS_FAN, SINGLENOZZLE) #undef SINGLENOZZLE_STANDBY_FAN #endif @@ -1409,7 +1409,7 @@ #if DISABLED(NOZZLE_AS_PROBE) #define HAS_PROBE_XY_OFFSET 1 #endif - #if BOTH(DELTA, SENSORLESS_PROBING) + #if ALL(DELTA, SENSORLESS_PROBING) #define HAS_DELTA_SENSORLESS_PROBING 1 #endif #if NONE(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN, HAS_DELTA_SENSORLESS_PROBING) @@ -1421,7 +1421,7 @@ #ifndef Z_PROBE_LOW_POINT #define Z_PROBE_LOW_POINT -5 #endif - #if EITHER(Z_PROBE_ALLEN_KEY, MAG_MOUNTED_PROBE) + #if ANY(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 @@ -1451,14 +1451,14 @@ */ #if ENABLED(AUTO_BED_LEVELING_UBL) #undef LCD_BED_LEVELING - #if EITHER(DELTA, SEGMENT_LEVELED_MOVES) + #if ANY(DELTA, SEGMENT_LEVELED_MOVES) #define UBL_SEGMENTED 1 #endif #endif -#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT) +#if ANY(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT) #define ABL_PLANAR 1 #endif -#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) +#if ANY(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) #define ABL_USES_GRID 1 #endif #if ANY(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_3POINT) @@ -1467,16 +1467,16 @@ #if ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_UBL, MESH_BED_LEVELING) #define HAS_MESH 1 #endif -#if EITHER(AUTO_BED_LEVELING_UBL, AUTO_BED_LEVELING_3POINT) +#if ANY(AUTO_BED_LEVELING_UBL, AUTO_BED_LEVELING_3POINT) #define NEEDS_THREE_PROBE_POINTS 1 #endif -#if EITHER(HAS_ABL_NOT_UBL, AUTO_BED_LEVELING_UBL) +#if ANY(HAS_ABL_NOT_UBL, AUTO_BED_LEVELING_UBL) #define HAS_ABL_OR_UBL 1 #if DISABLED(PROBE_MANUALLY) #define HAS_AUTOLEVEL 1 #endif #endif -#if EITHER(HAS_ABL_OR_UBL, MESH_BED_LEVELING) +#if ANY(HAS_ABL_OR_UBL, MESH_BED_LEVELING) #define HAS_LEVELING 1 #if DISABLED(AUTO_BED_LEVELING_UBL) #define PLANNER_LEVELING 1 @@ -1487,7 +1487,7 @@ #undef ENABLE_LEVELING_AFTER_G28 #undef G29_RETRY_AND_RECOVER #endif -#if !HAS_LEVELING || EITHER(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL) +#if !HAS_LEVELING || ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL) #undef PROBE_MANUALLY #endif #if ANY(HAS_BED_PROBE, PROBE_MANUALLY, MESH_BED_LEVELING) @@ -1507,13 +1507,13 @@ /** * CoreXY, CoreXZ, and CoreYZ - and their reverse */ -#if EITHER(COREXY, COREYX) +#if ANY(COREXY, COREYX) #define CORE_IS_XY 1 #endif -#if EITHER(COREXZ, COREZX) +#if ANY(COREXZ, COREZX) #define CORE_IS_XZ 1 #endif -#if EITHER(COREYZ, COREZY) +#if ANY(COREYZ, COREZY) #define CORE_IS_YZ 1 #endif #if CORE_IS_XY || CORE_IS_XZ || CORE_IS_YZ @@ -1534,7 +1534,7 @@ #define CORE_AXIS_2 C_AXIS #endif #define CORESIGN(n) (ANY(COREYX, COREZX, COREZY) ? (-(n)) : (n)) -#elif EITHER(MARKFORGED_XY, MARKFORGED_YX) +#elif ANY(MARKFORGED_XY, MARKFORGED_YX) // Markforged kinematics #define CORE_AXIS_1 A_AXIS #define CORE_AXIS_2 B_AXIS @@ -1558,7 +1558,7 @@ #endif // This flag indicates some kind of jerk storage is needed -#if EITHER(CLASSIC_JERK, IS_KINEMATIC) +#if ANY(CLASSIC_JERK, IS_KINEMATIC) #define HAS_CLASSIC_JERK 1 #endif @@ -1622,12 +1622,12 @@ * - TFT_COLOR * - GRAPHICAL_TFT_UPSCALE */ -#if EITHER(MKS_TS35_V2_0, BTT_TFT35_SPI_V1_0) // ST7796 +#if ANY(MKS_TS35_V2_0, BTT_TFT35_SPI_V1_0) // ST7796 #define TFT_DEFAULT_DRIVER ST7796 #define TFT_DEFAULT_ORIENTATION TFT_EXCHANGE_XY #define TFT_RES_480x320 #define TFT_INTERFACE_SPI -#elif EITHER(LERDGE_TFT35, ANET_ET5_TFT35) // ST7796 +#elif ANY(LERDGE_TFT35, ANET_ET5_TFT35) // ST7796 #define TFT_DEFAULT_ORIENTATION TFT_EXCHANGE_XY #define TFT_RES_480x320 #define TFT_INTERFACE_FSMC @@ -1645,7 +1645,7 @@ #define TFT_DEFAULT_ORIENTATION 0 #define TFT_RES_480x272 #define TFT_INTERFACE_FSMC -#elif EITHER(MKS_ROBIN_TFT_V1_1R, LONGER_LK_TFT28) // ILI9328 or R61505 +#elif ANY(MKS_ROBIN_TFT_V1_1R, LONGER_LK_TFT28) // ILI9328 or R61505 #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y) #define TFT_RES_320x240 #define TFT_INTERFACE_FSMC @@ -1756,13 +1756,13 @@ #endif #endif -#if EITHER(TFT_320x240, TFT_320x240_SPI) +#if ANY(TFT_320x240, TFT_320x240_SPI) #define HAS_UI_320x240 1 -#elif EITHER(TFT_480x320, TFT_480x320_SPI) +#elif ANY(TFT_480x320, TFT_480x320_SPI) #define HAS_UI_480x320 1 -#elif EITHER(TFT_480x272, TFT_480x272_SPI) +#elif ANY(TFT_480x272, TFT_480x272_SPI) #define HAS_UI_480x272 1 -#elif EITHER(TFT_1024x600_LTDC, TFT_1024x600_SIM) +#elif ANY(TFT_1024x600_LTDC, TFT_1024x600_SIM) #define HAS_UI_1024x600 1 #endif #if ANY(HAS_UI_320x240, HAS_UI_480x320, HAS_UI_480x272) diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 343ebae1ff386..683eeb3da217b 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -245,8 +245,8 @@ #define DISABLE_IDLE_E #endif -#define _OR_HAS_DI(A) || BOTH(HAS_##A##_AXIS, DISABLE_IDLE_##A) -#if BOTH(HAS_EXTRUDERS, DISABLE_IDLE_E) MAP(_OR_HAS_DI, X, Y, Z, I, J, K, U, V, W) +#define _OR_HAS_DI(A) || ALL(HAS_##A##_AXIS, DISABLE_IDLE_##A) +#if ALL(HAS_EXTRUDERS, DISABLE_IDLE_E) MAP(_OR_HAS_DI, X, Y, Z, I, J, K, U, V, W) #define HAS_DISABLE_IDLE_AXES 1 #endif #undef _OR_HAS_DI @@ -768,11 +768,11 @@ #endif #endif -#if ENABLED(MIXING_EXTRUDER) && (ENABLED(RETRACT_SYNC_MIXING) || BOTH(FILAMENT_LOAD_UNLOAD_GCODES, FILAMENT_UNLOAD_ALL_EXTRUDERS)) +#if ENABLED(MIXING_EXTRUDER) && (ENABLED(RETRACT_SYNC_MIXING) || ALL(FILAMENT_LOAD_UNLOAD_GCODES, FILAMENT_UNLOAD_ALL_EXTRUDERS)) #define HAS_MIXER_SYNC_CHANNEL 1 #endif -#if EITHER(DUAL_X_CARRIAGE, MULTI_NOZZLE_DUPLICATION) +#if ANY(DUAL_X_CARRIAGE, MULTI_NOZZLE_DUPLICATION) #define HAS_DUPLICATION_MODE 1 #endif @@ -810,7 +810,7 @@ #undef MENU_ADDAUTOSTART #endif -#if EITHER(HAS_MEDIA, SET_PROGRESS_MANUALLY) +#if ANY(HAS_MEDIA, SET_PROGRESS_MANUALLY) #define HAS_PRINT_PROGRESS 1 #endif @@ -836,7 +836,7 @@ #define HAS_EXTRA_PROGRESS 1 #endif -#if HAS_PRINT_PROGRESS && EITHER(PRINT_PROGRESS_SHOW_DECIMALS, SHOW_REMAINING_TIME) +#if HAS_PRINT_PROGRESS && ANY(PRINT_PROGRESS_SHOW_DECIMALS, SHOW_REMAINING_TIME) #define HAS_PRINT_PROGRESS_PERMYRIAD 1 #endif @@ -854,7 +854,7 @@ #if ANY(X_DUAL_ENDSTOPS, Y_DUAL_ENDSTOPS, Z_MULTI_ENDSTOPS) #define HAS_EXTRA_ENDSTOPS 1 #endif -#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) +#if ANY(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) #define HAS_SOFTWARE_ENDSTOPS 1 #endif #if ANY(EXTENSIBLE_UI, IS_NEWPANEL, EMERGENCY_PARSER, HAS_ADC_BUTTONS, HAS_DWIN_E3V2) @@ -876,7 +876,7 @@ #define HAS_GCODE_M255 1 #endif -#if EITHER(DIGIPOT_MCP4018, DIGIPOT_MCP4451) +#if ANY(DIGIPOT_MCP4018, DIGIPOT_MCP4451) #define HAS_MOTOR_CURRENT_I2C 1 #endif @@ -927,7 +927,7 @@ // Spindle/Laser power display types // Defined here so sanity checks can use them // -#if EITHER(SPINDLE_FEATURE, LASER_FEATURE) +#if ANY(SPINDLE_FEATURE, LASER_FEATURE) #define HAS_CUTTER 1 #define _CUTTER_POWER_PWM255 1 #define _CUTTER_POWER_PERCENT 2 @@ -1000,7 +1000,7 @@ #endif #endif -#if EITHER(FYSETC_MINI_12864_2_1, FYSETC_242_OLED_12864) +#if ANY(FYSETC_MINI_12864_2_1, FYSETC_242_OLED_12864) #ifndef LED_USER_PRESET_GREEN #define LED_USER_PRESET_GREEN 128 #endif @@ -1035,7 +1035,7 @@ #endif #endif -#if BOTH(LED_CONTROL_MENU, NEOPIXEL2_SEPARATE) +#if ALL(LED_CONTROL_MENU, NEOPIXEL2_SEPARATE) #ifndef LED2_USER_PRESET_RED #define LED2_USER_PRESET_RED 255 #endif @@ -1058,7 +1058,7 @@ #endif // Full Touch Screen needs 'tft/xpt2046' -#if EITHER(TFT_TOUCH_DEVICE_XPT2046, HAS_TFT_LVGL_UI) +#if ANY(TFT_TOUCH_DEVICE_XPT2046, HAS_TFT_LVGL_UI) #define HAS_TFT_XPT2046 1 #endif @@ -1188,7 +1188,7 @@ #endif // Power Monitor sensors -#if EITHER(POWER_MONITOR_CURRENT, POWER_MONITOR_VOLTAGE) +#if ANY(POWER_MONITOR_CURRENT, POWER_MONITOR_VOLTAGE) #define HAS_POWER_MONITOR 1 #if ENABLED(POWER_MONITOR_CURRENT) && (ENABLED(POWER_MONITOR_VOLTAGE) || defined(POWER_MONITOR_FIXED_VOLTAGE)) #define HAS_POWER_MONITOR_WATTS 1 @@ -1207,7 +1207,7 @@ // Flags for Case Light having a color property or a single pin #if ENABLED(CASE_LIGHT_ENABLE) - #if EITHER(CASE_LIGHT_USE_NEOPIXEL, CASE_LIGHT_USE_RGB_LED) + #if ANY(CASE_LIGHT_USE_NEOPIXEL, CASE_LIGHT_USE_RGB_LED) #define CASE_LIGHT_IS_COLOR_LED 1 #else #define NEED_CASE_LIGHT_PIN 1 @@ -1224,7 +1224,7 @@ #define NEED_LSF 1 #endif -#if BOTH(HAS_TFT_LVGL_UI, CUSTOM_MENU_MAIN) +#if ALL(HAS_TFT_LVGL_UI, CUSTOM_MENU_MAIN) #define _HAS_1(N) (defined(MAIN_MENU_ITEM_##N##_DESC) && defined(MAIN_MENU_ITEM_##N##_GCODE)) #define HAS_USER_ITEM(V...) DO(HAS,||,V) #else @@ -1251,18 +1251,18 @@ #if !HAS_MULTI_SERIAL #undef MEATPACK_ON_SERIAL_PORT_2 #endif -#if EITHER(MEATPACK_ON_SERIAL_PORT_1, MEATPACK_ON_SERIAL_PORT_2) +#if ANY(MEATPACK_ON_SERIAL_PORT_1, MEATPACK_ON_SERIAL_PORT_2) #define HAS_MEATPACK 1 #endif // AVR are (usually) too limited in resources to store the configuration into the binary -#if ENABLED(CONFIGURATION_EMBEDDING) && !defined(FORCE_CONFIG_EMBED) && (defined(__AVR__) || !HAS_MEDIA || EITHER(SDCARD_READONLY, DISABLE_M503)) +#if ENABLED(CONFIGURATION_EMBEDDING) && !defined(FORCE_CONFIG_EMBED) && (defined(__AVR__) || !HAS_MEDIA || ANY(SDCARD_READONLY, DISABLE_M503)) #undef CONFIGURATION_EMBEDDING #define CANNOT_EMBED_CONFIGURATION defined(__AVR__) #endif // Input shaping -#if EITHER(INPUT_SHAPING_X, INPUT_SHAPING_Y) +#if ANY(INPUT_SHAPING_X, INPUT_SHAPING_Y) #define HAS_ZV_SHAPING 1 #endif diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 92b4463556b38..588484ff3e3bd 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -38,7 +38,7 @@ #endif // Linear advance uses Jerk since E is an isolated axis -#if BOTH(HAS_JUNCTION_DEVIATION, LIN_ADVANCE) +#if ALL(HAS_JUNCTION_DEVIATION, LIN_ADVANCE) #define HAS_LINEAR_E_JERK 1 #endif @@ -48,7 +48,7 @@ // Set additional flags to let HALs choose in their Conditionals_post.h #if ANY(FLASH_EEPROM_EMULATION, SRAM_EEPROM_EMULATION, SDCARD_EEPROM_EMULATION, QSPI_EEPROM) #define USE_EMULATED_EEPROM 1 - #elif EITHER(I2C_EEPROM, SPI_EEPROM) + #elif ANY(I2C_EEPROM, SPI_EEPROM) #define USE_WIRED_EEPROM 1 #elif ENABLED(IIC_BL24CXX_EEPROM) // nothing @@ -265,7 +265,7 @@ #endif // Calibration codes only for non-core axes -#if EITHER(BACKLASH_GCODE, CALIBRATION_GCODE) +#if ANY(BACKLASH_GCODE, CALIBRATION_GCODE) #if ANY(IS_CORE, MARKFORGED_XY, MARKFORGED_YX) #define CAN_CALIBRATE(A,B) TERN0(HAS_##A##_AXIS, (_AXIS(A) == B)) #else @@ -466,14 +466,15 @@ #elif ENABLED(AZSMZ_12864) #define _LCD_CONTRAST_MIN 120 #define _LCD_CONTRAST_INIT 190 -#elif EITHER(MKS_LCD12864A, MKS_LCD12864B) +#elif ANY(MKS_LCD12864A, MKS_LCD12864B) #define _LCD_CONTRAST_MIN 120 #define _LCD_CONTRAST_INIT 205 -#elif EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY) +#elif ANY(MKS_MINI_12864, ENDER2_STOCKDISPLAY) #define _LCD_CONTRAST_MIN 120 #define _LCD_CONTRAST_INIT 195 #elif ENABLED(FYSETC_MINI_12864_2_1) #define _LCD_CONTRAST_MIN 230 + #define _LCD_CONTRAST_MIN 255 #define _LCD_CONTRAST_INIT 255 #elif ENABLED(FYSETC_MINI_12864) #define _LCD_CONTRAST_MIN 180 @@ -558,7 +559,7 @@ #endif #endif - #if DISABLED(USB_FLASH_DRIVE_SUPPORT) || BOTH(MULTI_VOLUME, VOLUME_SD_ONBOARD) + #if DISABLED(USB_FLASH_DRIVE_SUPPORT) || ALL(MULTI_VOLUME, VOLUME_SD_ONBOARD) #if ENABLED(ONBOARD_SDIO) #define NEED_SD2CARD_SDIO 1 #else @@ -731,13 +732,13 @@ // Add LIB_MAX6675 / LIB_MAX31855 / LIB_MAX31865 to the build_flags // to select a USER library for MAX6675, MAX31855, MAX31865 // - #if BOTH(HAS_MAX6675, LIB_MAX6675) + #if ALL(HAS_MAX6675, LIB_MAX6675) #define USE_LIB_MAX6675 1 #endif - #if BOTH(HAS_MAX31855, LIB_MAX31855) + #if ALL(HAS_MAX31855, LIB_MAX31855) #define USE_ADAFRUIT_MAX31855 1 #endif - #if BOTH(HAS_MAX31865, LIB_MAX31865) + #if ALL(HAS_MAX31865, LIB_MAX31865) #define USE_ADAFRUIT_MAX31865 1 #elif HAS_MAX31865 #define LIB_INTERNAL_MAX31865 1 @@ -1375,7 +1376,7 @@ * - Z_PROBE_SLED uses SOL1_PIN, when defined (unless EXT_SOLENOID is enabled) */ #if ANY(EXT_SOLENOID, MANUAL_SOLENOID_CONTROL, PARKING_EXTRUDER, SOLENOID_PROBE, Z_PROBE_SLED) - #if PIN_EXISTS(SOL0) && (EITHER(MANUAL_SOLENOID_CONTROL, PARKING_EXTRUDER) || BOTH(EXT_SOLENOID, HAS_EXTRUDERS)) + #if PIN_EXISTS(SOL0) && (ANY(MANUAL_SOLENOID_CONTROL, PARKING_EXTRUDER) || ALL(EXT_SOLENOID, HAS_EXTRUDERS)) #define HAS_SOLENOID_0 1 #endif #if PIN_EXISTS(SOL1) && (ANY(MANUAL_SOLENOID_CONTROL, PARKING_EXTRUDER, SOLENOID_PROBE, Z_PROBE_SLED) || TERN0(EXT_SOLENOID, E_STEPPERS > 1)) @@ -1409,7 +1410,7 @@ #if ANY(STEALTHCHOP_E, STEALTHCHOP_XY, STEALTHCHOP_Z, STEALTHCHOP_I, STEALTHCHOP_J, STEALTHCHOP_K, STEALTHCHOP_U, STEALTHCHOP_V, STEALTHCHOP_W) #define STEALTHCHOP_ENABLED 1 #endif - #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) + #if ANY(SENSORLESS_HOMING, SENSORLESS_PROBING) #define USE_SENSORLESS 1 #endif @@ -1970,7 +1971,7 @@ #define HAS_Y_ENDSTOP 1 #endif -#if _USE_STOP(Z,,MIN,EITHER(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN, HAS_DELTA_SENSORLESS_PROBING)) +#if _USE_STOP(Z,,MIN,ANY(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN, HAS_DELTA_SENSORLESS_PROBING)) #define USE_Z_MIN 1 #if !HAS_DELTA_SENSORLESS_PROBING #define HAS_Z_MIN_PIN 1 @@ -2037,7 +2038,7 @@ #define HAS_W_ENDSTOP 1 #endif -#if EITHER(DUAL_X_CARRIAGE, X_DUAL_ENDSTOPS) +#if ANY(DUAL_X_CARRIAGE, X_DUAL_ENDSTOPS) #if _USE_STOP(X,2,MIN,) #define USE_X2_MIN 1 #elif _USE_STOP(X,2,MAX,) @@ -2382,10 +2383,10 @@ #endif #if ENABLED(DWIN_LCD_PROUI) - #if EITHER(PIDTEMP, PIDTEMPBED) + #if ANY(PIDTEMP, PIDTEMPBED) #define DWIN_PID_TUNE 1 #endif - #if EITHER(DWIN_PID_TUNE, MPC_AUTOTUNE) && DISABLED(DISABLE_TUNING_GRAPH) + #if ANY(DWIN_PID_TUNE, MPC_AUTOTUNE) && DISABLED(DISABLE_TUNING_GRAPH) #define SHOW_TUNING_GRAPH 1 #endif #endif @@ -2401,10 +2402,10 @@ #if ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0 #define WATCH_BED 1 #endif -#if BOTH(HAS_HEATED_CHAMBER, THERMAL_PROTECTION_CHAMBER) && WATCH_CHAMBER_TEMP_PERIOD > 0 +#if ALL(HAS_HEATED_CHAMBER, THERMAL_PROTECTION_CHAMBER) && WATCH_CHAMBER_TEMP_PERIOD > 0 #define WATCH_CHAMBER 1 #endif -#if BOTH(HAS_COOLER, THERMAL_PROTECTION_COOLER) && WATCH_COOLER_TEMP_PERIOD > 0 +#if ALL(HAS_COOLER, THERMAL_PROTECTION_COOLER) && WATCH_COOLER_TEMP_PERIOD > 0 #define WATCH_COOLER 1 #endif #if NONE(THERMAL_PROTECTION_HOTENDS, THERMAL_PROTECTION_CHAMBER, THERMAL_PROTECTION_BED, THERMAL_PROTECTION_COOLER) @@ -2616,7 +2617,7 @@ /** * MIN/MAX fan PWM scaling */ -#if EITHER(HAS_FAN, USE_CONTROLLER_FAN) +#if ANY(HAS_FAN, USE_CONTROLLER_FAN) #ifndef FAN_OFF_PWM #define FAN_OFF_PWM 0 #endif @@ -2716,7 +2717,7 @@ * Helper Macros for heaters and extruder fan */ #define WRITE_HEATER_0P(v) WRITE(HEATER_0_PIN, (v) ^ ENABLED(HEATER_0_INVERTING)) -#if EITHER(HAS_MULTI_HOTEND, HEATERS_PARALLEL) +#if ANY(HAS_MULTI_HOTEND, HEATERS_PARALLEL) #define WRITE_HEATER_1(v) WRITE(HEATER_1_PIN, (v) ^ ENABLED(HEATER_1_INVERTING)) #if HOTENDS > 2 #define WRITE_HEATER_2(v) WRITE(HEATER_2_PIN, (v) ^ ENABLED(HEATER_2_INVERTING)) @@ -2829,7 +2830,7 @@ /** * Bed Probe dependencies */ -#if EITHER(MESH_BED_LEVELING, HAS_BED_PROBE) +#if ANY(MESH_BED_LEVELING, HAS_BED_PROBE) #ifndef Z_PROBE_OFFSET_RANGE_MIN #define Z_PROBE_OFFSET_RANGE_MIN -20 #endif @@ -2838,7 +2839,7 @@ #endif #endif #if HAS_BED_PROBE - #if BOTH(ENDSTOPPULLUPS, USE_Z_MIN_PROBE) + #if ALL(ENDSTOPPULLUPS, USE_Z_MIN_PROBE) #define ENDSTOPPULLUP_ZMIN_PROBE #endif #ifndef XY_PROBE_FEEDRATE @@ -2896,16 +2897,16 @@ #undef ADAPTIVE_FAN_SLOWING #undef TEMP_TUNING_MAINTAIN_FAN #endif -#if !BOTH(HAS_BED_PROBE, HAS_FAN) +#if !ALL(HAS_BED_PROBE, HAS_FAN) #undef PROBING_FANS_OFF #endif -#if !BOTH(HAS_BED_PROBE, HAS_EXTRUDERS) +#if !ALL(HAS_BED_PROBE, HAS_EXTRUDERS) #undef PROBING_ESTEPPERS_OFF #elif ENABLED(PROBING_STEPPERS_OFF) // PROBING_STEPPERS_OFF implies PROBING_ESTEPPERS_OFF, make sure it is defined #define PROBING_ESTEPPERS_OFF #endif -#if EITHER(ADVANCED_PAUSE_FEATURE, PROBING_HEATERS_OFF) +#if ANY(ADVANCED_PAUSE_FEATURE, PROBING_HEATERS_OFF) #define HEATER_IDLE_HANDLER 1 #endif #if HAS_BED_PROBE && (ANY(PROBING_HEATERS_OFF, PROBING_STEPPERS_OFF, PROBING_ESTEPPERS_OFF, PROBING_FANS_OFF) || DELAY_BEFORE_PROBING > 0) @@ -2916,7 +2917,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, DWIN_CREALITY_LCD_JYERSUI) || ALL(EMERGENCY_PARSER, HOST_PROMPT_SUPPORT) #define M600_PURGE_MORE_RESUMABLE 1 #endif #ifndef FILAMENT_CHANGE_SLOW_LOAD_LENGTH @@ -3002,7 +3003,7 @@ /** * Default mesh area is an area with an inset margin on the print area. */ -#if EITHER(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL) #if IS_KINEMATIC // Probing points may be verified at compile time within the radius // using static_assert(HYPOT2(X2-X1,Y2-Y1)<=sq(PRINTABLE_RADIUS),"bad probe point!") @@ -3052,7 +3053,7 @@ #if ANY(IS_TFTGLCD_PANEL, PCA9632_BUZZER, LCD_USE_I2C_BUZZER) #define USE_MARLINUI_BUZZER 1 #endif -#if EITHER(HAS_BEEPER, USE_MARLINUI_BUZZER) +#if ANY(HAS_BEEPER, USE_MARLINUI_BUZZER) #define HAS_SOUND 1 #endif @@ -3123,7 +3124,7 @@ // Define a starting height for measuring manual probe points #ifndef MANUAL_PROBE_START_Z - #if EITHER(MESH_BED_LEVELING, PROBE_MANUALLY) + #if ANY(MESH_BED_LEVELING, PROBE_MANUALLY) // Leave MANUAL_PROBE_START_Z undefined so the prior Z height will be used. // Note: If Z_CLEARANCE_BETWEEN_MANUAL_PROBES is 0 there will be no raise between points #elif ENABLED(AUTO_BED_LEVELING_UBL) && defined(Z_CLEARANCE_BETWEEN_PROBES) @@ -3149,7 +3150,7 @@ #endif #endif -#if EITHER(HAS_MARLINUI_MENU, TOUCH_UI_FTDI_EVE) +#if ANY(HAS_MARLINUI_MENU, TOUCH_UI_FTDI_EVE) // LCD timeout to status screen default is 15s #ifndef LCD_TIMEOUT_TO_STATUS #define LCD_TIMEOUT_TO_STATUS 15000 @@ -3202,7 +3203,7 @@ #define MAX_VFAT_ENTRIES 20 // by VFAT specs to fit LFN of length 255 // Nozzle park for Delta -#if BOTH(NOZZLE_PARK_FEATURE, DELTA) +#if ALL(NOZZLE_PARK_FEATURE, DELTA) #undef NOZZLE_PARK_Z_FEEDRATE #define NOZZLE_PARK_Z_FEEDRATE NOZZLE_PARK_XY_FEEDRATE #endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 89cf8c5198c50..00b5321205185 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -46,8 +46,8 @@ #if ENABLED(TEST0) || !ENABLED(TEST2) || ENABLED(TEST3) || !ENABLED(TEST1, TEST2, TEST4) #error "ENABLED is borked!" #endif -#if BOTH(TEST0, TEST1) - #error "BOTH is borked!" +#if ALL(TEST0, TEST1) + #error "ALL is borked!" #endif #if DISABLED(TEST1) || !DISABLED(TEST3) || DISABLED(TEST4) || DISABLED(TEST0, TEST1, TEST2, TEST4) || !DISABLED(TEST0, TEST3) #error "DISABLED is borked!" @@ -300,45 +300,45 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #endif #endif -#if BOTH(ENDSTOPPULLUPS, ENDSTOPPULLDOWNS) +#if ALL(ENDSTOPPULLUPS, ENDSTOPPULLDOWNS) #error "Enable only one of ENDSTOPPULLUPS or ENDSTOPPULLDOWNS." -#elif BOTH(FIL_RUNOUT_PULLUP, FIL_RUNOUT_PULLDOWN) +#elif ALL(FIL_RUNOUT_PULLUP, FIL_RUNOUT_PULLDOWN) #error "Enable only one of FIL_RUNOUT_PULLUP or FIL_RUNOUT_PULLDOWN." -#elif BOTH(ENDSTOPPULLUP_XMAX, ENDSTOPPULLDOWN_XMAX) +#elif ALL(ENDSTOPPULLUP_XMAX, ENDSTOPPULLDOWN_XMAX) #error "Enable only one of ENDSTOPPULLUP_X_MAX or ENDSTOPPULLDOWN_X_MAX." -#elif BOTH(ENDSTOPPULLUP_YMAX, ENDSTOPPULLDOWN_YMAX) +#elif ALL(ENDSTOPPULLUP_YMAX, ENDSTOPPULLDOWN_YMAX) #error "Enable only one of ENDSTOPPULLUP_Y_MAX or ENDSTOPPULLDOWN_Y_MAX." -#elif BOTH(ENDSTOPPULLUP_ZMAX, ENDSTOPPULLDOWN_ZMAX) +#elif ALL(ENDSTOPPULLUP_ZMAX, ENDSTOPPULLDOWN_ZMAX) #error "Enable only one of ENDSTOPPULLUP_Z_MAX or ENDSTOPPULLDOWN_Z_MAX." -#elif BOTH(ENDSTOPPULLUP_IMAX, ENDSTOPPULLDOWN_IMAX) +#elif ALL(ENDSTOPPULLUP_IMAX, ENDSTOPPULLDOWN_IMAX) #error "Enable only one of ENDSTOPPULLUP_I_MAX or ENDSTOPPULLDOWN_I_MAX." -#elif BOTH(ENDSTOPPULLUP_JMAX, ENDSTOPPULLDOWN_JMAX) +#elif ALL(ENDSTOPPULLUP_JMAX, ENDSTOPPULLDOWN_JMAX) #error "Enable only one of ENDSTOPPULLUP_J_MAX or ENDSTOPPULLDOWN_J_MAX." -#elif BOTH(ENDSTOPPULLUP_KMAX, ENDSTOPPULLDOWN_KMAX) +#elif ALL(ENDSTOPPULLUP_KMAX, ENDSTOPPULLDOWN_KMAX) #error "Enable only one of ENDSTOPPULLUP_K_MAX or ENDSTOPPULLDOWN_K_MAX." -#elif BOTH(ENDSTOPPULLUP_UMAX, ENDSTOPPULLDOWN_UMAX) +#elif ALL(ENDSTOPPULLUP_UMAX, ENDSTOPPULLDOWN_UMAX) #error "Enable only one of ENDSTOPPULLUP_U_MAX or ENDSTOPPULLDOWN_U_MAX." -#elif BOTH(ENDSTOPPULLUP_VMAX, ENDSTOPPULLDOWN_VMAX) +#elif ALL(ENDSTOPPULLUP_VMAX, ENDSTOPPULLDOWN_VMAX) #error "Enable only one of ENDSTOPPULLUP_V_MAX or ENDSTOPPULLDOWN_V_MAX." -#elif BOTH(ENDSTOPPULLUP_WMAX, ENDSTOPPULLDOWN_WMAX) +#elif ALL(ENDSTOPPULLUP_WMAX, ENDSTOPPULLDOWN_WMAX) #error "Enable only one of ENDSTOPPULLUP_W_MAX or ENDSTOPPULLDOWN_W_MAX." -#elif BOTH(ENDSTOPPULLUP_XMIN, ENDSTOPPULLDOWN_XMIN) +#elif ALL(ENDSTOPPULLUP_XMIN, ENDSTOPPULLDOWN_XMIN) #error "Enable only one of ENDSTOPPULLUP_X_MIN or ENDSTOPPULLDOWN_X_MIN." -#elif BOTH(ENDSTOPPULLUP_YMIN, ENDSTOPPULLDOWN_YMIN) +#elif ALL(ENDSTOPPULLUP_YMIN, ENDSTOPPULLDOWN_YMIN) #error "Enable only one of ENDSTOPPULLUP_Y_MIN or ENDSTOPPULLDOWN_Y_MIN." -#elif BOTH(ENDSTOPPULLUP_ZMIN, ENDSTOPPULLDOWN_ZMIN) +#elif ALL(ENDSTOPPULLUP_ZMIN, ENDSTOPPULLDOWN_ZMIN) #error "Enable only one of ENDSTOPPULLUP_Z_MIN or ENDSTOPPULLDOWN_Z_MIN." -#elif BOTH(ENDSTOPPULLUP_IMIN, ENDSTOPPULLDOWN_IMIN) +#elif ALL(ENDSTOPPULLUP_IMIN, ENDSTOPPULLDOWN_IMIN) #error "Enable only one of ENDSTOPPULLUP_I_MIN or ENDSTOPPULLDOWN_I_MIN." -#elif BOTH(ENDSTOPPULLUP_JMIN, ENDSTOPPULLDOWN_JMIN) +#elif ALL(ENDSTOPPULLUP_JMIN, ENDSTOPPULLDOWN_JMIN) #error "Enable only one of ENDSTOPPULLUP_J_MIN or ENDSTOPPULLDOWN_J_MIN." -#elif BOTH(ENDSTOPPULLUP_KMIN, ENDSTOPPULLDOWN_KMIN) +#elif ALL(ENDSTOPPULLUP_KMIN, ENDSTOPPULLDOWN_KMIN) #error "Enable only one of ENDSTOPPULLUP_K_MIN or ENDSTOPPULLDOWN_K_MIN." -#elif BOTH(ENDSTOPPULLUP_UMIN, ENDSTOPPULLDOWN_UMIN) +#elif ALL(ENDSTOPPULLUP_UMIN, ENDSTOPPULLDOWN_UMIN) #error "Enable only one of ENDSTOPPULLUP_U_MIN or ENDSTOPPULLDOWN_U_MIN." -#elif BOTH(ENDSTOPPULLUP_VMIN, ENDSTOPPULLDOWN_VMIN) +#elif ALL(ENDSTOPPULLUP_VMIN, ENDSTOPPULLDOWN_VMIN) #error "Enable only one of ENDSTOPPULLUP_V_MIN or ENDSTOPPULLDOWN_V_MIN." -#elif BOTH(ENDSTOPPULLUP_WMIN, ENDSTOPPULLDOWN_WMIN) +#elif ALL(ENDSTOPPULLUP_WMIN, ENDSTOPPULLDOWN_WMIN) #error "Enable only one of ENDSTOPPULLUP_W_MIN or ENDSTOPPULLDOWN_W_MIN." #endif @@ -455,7 +455,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L * I2C Position Encoders */ #if ENABLED(I2C_POSITION_ENCODERS) - #if !BOTH(BABYSTEPPING, BABYSTEP_XY) + #if !ALL(BABYSTEPPING, BABYSTEP_XY) #error "I2C_POSITION_ENCODERS requires BABYSTEPPING and BABYSTEP_XY." #elif !WITHIN(I2CPE_ENCODER_CNT, 1, 5) #error "I2CPE_ENCODER_CNT must be between 1 and 5." @@ -468,11 +468,11 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #if ENABLED(BABYSTEPPING) #if ENABLED(SCARA) #error "BABYSTEPPING is not implemented for SCARA yet." - #elif ENABLED(BABYSTEP_XY) && EITHER(MARKFORGED_XY, MARKFORGED_YX) + #elif ENABLED(BABYSTEP_XY) && ANY(MARKFORGED_XY, MARKFORGED_YX) #error "BABYSTEPPING only implemented for Z axis on MarkForged." - #elif BOTH(DELTA, BABYSTEP_XY) + #elif ALL(DELTA, BABYSTEP_XY) #error "BABYSTEPPING only implemented for Z axis on deltabots." - #elif BOTH(BABYSTEP_ZPROBE_OFFSET, MESH_BED_LEVELING) + #elif ALL(BABYSTEP_ZPROBE_OFFSET, MESH_BED_LEVELING) #error "MESH_BED_LEVELING and BABYSTEP_ZPROBE_OFFSET is not a valid combination" #elif ENABLED(BABYSTEP_ZPROBE_OFFSET) && !HAS_BED_PROBE #error "BABYSTEP_ZPROBE_OFFSET requires a probe." @@ -482,7 +482,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #error "BABYSTEP_GFX_OVERLAY requires a BABYSTEP_ZPROBE_OFFSET." #elif ENABLED(BABYSTEP_HOTEND_Z_OFFSET) && !HAS_HOTEND_OFFSET #error "BABYSTEP_HOTEND_Z_OFFSET requires 2 or more HOTENDS." - #elif BOTH(BABYSTEP_ALWAYS_AVAILABLE, MOVE_Z_WHEN_IDLE) + #elif ALL(BABYSTEP_ALWAYS_AVAILABLE, MOVE_Z_WHEN_IDLE) #error "BABYSTEP_ALWAYS_AVAILABLE and MOVE_Z_WHEN_IDLE are incompatible." #elif !defined(BABYSTEP_MULTIPLICATOR_Z) #error "BABYSTEPPING requires BABYSTEP_MULTIPLICATOR_Z." @@ -520,21 +520,21 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #error "FIL_RUNOUT3_PIN is required with NUM_RUNOUT_SENSORS >= 3." #elif NUM_RUNOUT_SENSORS >= 2 && !PIN_EXISTS(FIL_RUNOUT2) #error "FIL_RUNOUT2_PIN is required with NUM_RUNOUT_SENSORS >= 2." - #elif BOTH(FIL_RUNOUT1_PULLUP, FIL_RUNOUT1_PULLDOWN) + #elif ALL(FIL_RUNOUT1_PULLUP, FIL_RUNOUT1_PULLDOWN) #error "You can't enable FIL_RUNOUT1_PULLUP and FIL_RUNOUT1_PULLDOWN at the same time." - #elif BOTH(FIL_RUNOUT2_PULLUP, FIL_RUNOUT2_PULLDOWN) + #elif ALL(FIL_RUNOUT2_PULLUP, FIL_RUNOUT2_PULLDOWN) #error "You can't enable FIL_RUNOUT2_PULLUP and FIL_RUNOUT2_PULLDOWN at the same time." - #elif BOTH(FIL_RUNOUT3_PULLUP, FIL_RUNOUT3_PULLDOWN) + #elif ALL(FIL_RUNOUT3_PULLUP, FIL_RUNOUT3_PULLDOWN) #error "You can't enable FIL_RUNOUT3_PULLUP and FIL_RUNOUT3_PULLDOWN at the same time." - #elif BOTH(FIL_RUNOUT4_PULLUP, FIL_RUNOUT4_PULLDOWN) + #elif ALL(FIL_RUNOUT4_PULLUP, FIL_RUNOUT4_PULLDOWN) #error "You can't enable FIL_RUNOUT4_PULLUP and FIL_RUNOUT4_PULLDOWN at the same time." - #elif BOTH(FIL_RUNOUT5_PULLUP, FIL_RUNOUT5_PULLDOWN) + #elif ALL(FIL_RUNOUT5_PULLUP, FIL_RUNOUT5_PULLDOWN) #error "You can't enable FIL_RUNOUT5_PULLUP and FIL_RUNOUT5_PULLDOWN at the same time." - #elif BOTH(FIL_RUNOUT6_PULLUP, FIL_RUNOUT6_PULLDOWN) + #elif ALL(FIL_RUNOUT6_PULLUP, FIL_RUNOUT6_PULLDOWN) #error "You can't enable FIL_RUNOUT6_PULLUP and FIL_RUNOUT6_PULLDOWN at the same time." - #elif BOTH(FIL_RUNOUT7_PULLUP, FIL_RUNOUT7_PULLDOWN) + #elif ALL(FIL_RUNOUT7_PULLUP, FIL_RUNOUT7_PULLDOWN) #error "You can't enable FIL_RUNOUT7_PULLUP and FIL_RUNOUT7_PULLDOWN at the same time." - #elif BOTH(FIL_RUNOUT8_PULLUP, FIL_RUNOUT8_PULLDOWN) + #elif ALL(FIL_RUNOUT8_PULLUP, FIL_RUNOUT8_PULLDOWN) #error "You can't enable FIL_RUNOUT8_PULLUP and FIL_RUNOUT8_PULLDOWN at the same time." #elif FILAMENT_RUNOUT_DISTANCE_MM < 0 #error "FILAMENT_RUNOUT_DISTANCE_MM must be greater than or equal to zero." @@ -587,7 +587,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L /** * Individual axis homing is useless for DELTAS */ -#if BOTH(INDIVIDUAL_AXIS_HOMING_MENU, DELTA) +#if ALL(INDIVIDUAL_AXIS_HOMING_MENU, DELTA) #error "INDIVIDUAL_AXIS_HOMING_MENU is incompatible with DELTA kinematics." #endif @@ -691,7 +691,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L /** * A Dual Nozzle carriage with switching servo */ -#if BOTH(SWITCHING_NOZZLE, MECHANICAL_SWITCHING_NOZZLE) +#if ALL(SWITCHING_NOZZLE, MECHANICAL_SWITCHING_NOZZLE) #error "Enable only one of SWITCHING_NOZZLE or MECHANICAL_SWITCHING_NOZZLE." #elif ENABLED(MECHANICAL_SWITCHING_NOZZLE) #if EXTRUDERS != 2 @@ -747,7 +747,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L /** * Single Stepper Dual Extruder with switching servo */ -#if BOTH(SWITCHING_EXTRUDER, MECHANICAL_SWITCHING_EXTRUDER) +#if ALL(SWITCHING_EXTRUDER, MECHANICAL_SWITCHING_EXTRUDER) #error "Enable only one of SWITCHING_EXTRUDER or MECHANICAL_SWITCHING_EXTRUDER." #elif ENABLED(MECHANICAL_SWITCHING_EXTRUDER) #if EXTRUDERS < 2 @@ -855,7 +855,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L /** * (Magnetic) Parking Extruder requirements */ -#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) +#if ANY(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #if ENABLED(EXT_SOLENOID) #error "(MAGNETIC_)PARKING_EXTRUDER and EXT_SOLENOID are incompatible. (Pins are used twice.)" #elif EXTRUDERS != 2 @@ -913,7 +913,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L /** * Magnetic / Electromagnetic Switching Toolhead requirements */ -#if EITHER(MAGNETIC_SWITCHING_TOOLHEAD, ELECTROMAGNETIC_SWITCHING_TOOLHEAD) +#if ANY(MAGNETIC_SWITCHING_TOOLHEAD, ELECTROMAGNETIC_SWITCHING_TOOLHEAD) #ifndef SWITCHING_TOOLHEAD_Y_POS #error "(ELECTRO)?MAGNETIC_SWITCHING_TOOLHEAD requires SWITCHING_TOOLHEAD_Y_POS" #elif !defined(SWITCHING_TOOLHEAD_X_POS) @@ -983,7 +983,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L /** * Extruder temperature control algorithm - There can be only one! */ -#if BOTH(PIDTEMP, MPCTEMP) +#if ALL(PIDTEMP, MPCTEMP) #error "Only enable PIDTEMP or MPCTEMP, but not both." #undef MPCTEMP #undef MPC_AUTOTUNE @@ -1007,7 +1007,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L /** * Bed Heating Options - PID vs Limit Switching */ -#if BOTH(PIDTEMPBED, BED_LIMIT_SWITCHING) +#if ALL(PIDTEMPBED, BED_LIMIT_SWITCHING) #error "To use BED_LIMIT_SWITCHING you must disable PIDTEMPBED." #endif @@ -1030,7 +1030,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L /** * Chamber Heating Options - PID vs Limit Switching */ -#if BOTH(PIDTEMPCHAMBER, CHAMBER_LIMIT_SWITCHING) +#if ALL(PIDTEMPCHAMBER, CHAMBER_LIMIT_SWITCHING) #error "To use CHAMBER_LIMIT_SWITCHING you must disable PIDTEMPCHAMBER." #endif @@ -1196,7 +1196,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L /** * Some things should not be used on Belt Printers */ -#if BOTH(BELTPRINTER, HAS_LEVELING) +#if ALL(BELTPRINTER, HAS_LEVELING) #error "Bed Leveling is not compatible with BELTPRINTER." #endif @@ -1218,7 +1218,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L /** * Z_PROBE_SLED is incompatible with DELTA */ - #if BOTH(Z_PROBE_SLED, DELTA) + #if ALL(Z_PROBE_SLED, DELTA) #error "You cannot use Z_PROBE_SLED with DELTA." #endif @@ -1361,7 +1361,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L /** * Mag mounted probe requirements */ - #if BOTH(MAG_MOUNTED_PROBE, USE_PROBE_FOR_Z_HOMING) && DISABLED(Z_SAFE_HOMING) + #if ALL(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 @@ -1586,7 +1586,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #endif #endif -#if BOTH(PREHEAT_BEFORE_PROBING, PREHEAT_BEFORE_LEVELING) +#if ALL(PREHEAT_BEFORE_PROBING, PREHEAT_BEFORE_LEVELING) #error "Disable PREHEAT_BEFORE_LEVELING when using PREHEAT_BEFORE_PROBING." #endif @@ -1703,7 +1703,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L /** * Make sure DISABLE_[XYZ] compatible with selected homing options */ -#if HAS_DISABLE_MAIN_AXES && EITHER(HOME_AFTER_DEACTIVATE, Z_SAFE_HOMING) +#if HAS_DISABLE_MAIN_AXES && ANY(HOME_AFTER_DEACTIVATE, Z_SAFE_HOMING) #error "DISABLE_[XYZIJKUVW] is not compatible with HOME_AFTER_DEACTIVATE or Z_SAFE_HOMING." #endif @@ -1725,7 +1725,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #error "POWER_MONITOR_CURRENT requires a valid POWER_MONITOR_CURRENT_PIN." #elif ENABLED(POWER_MONITOR_VOLTAGE) && !PIN_EXISTS(POWER_MONITOR_VOLTAGE) #error "POWER_MONITOR_VOLTAGE requires POWER_MONITOR_VOLTAGE_PIN to be defined." -#elif BOTH(POWER_MONITOR_CURRENT, POWER_MONITOR_VOLTAGE) && POWER_MONITOR_CURRENT_PIN == POWER_MONITOR_VOLTAGE_PIN +#elif ALL(POWER_MONITOR_CURRENT, POWER_MONITOR_VOLTAGE) && POWER_MONITOR_CURRENT_PIN == POWER_MONITOR_VOLTAGE_PIN #error "POWER_MONITOR_CURRENT_PIN and POWER_MONITOR_VOLTAGE_PIN must be different." #endif @@ -1757,7 +1757,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #if ENABLED(SAV_3DGLCD) #if NONE(U8GLIB_SSD1306, U8GLIB_SH1106) #error "Enable a SAV_3DGLCD display type: U8GLIB_SSD1306 or U8GLIB_SH1106." - #elif BOTH(U8GLIB_SSD1306, U8GLIB_SH1106) + #elif ALL(U8GLIB_SSD1306, U8GLIB_SH1106) #error "Only enable one SAV_3DGLCD display type: U8GLIB_SSD1306 or U8GLIB_SH1106." #endif #endif @@ -1841,7 +1841,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L /** * Make sure FAN_*_PWM values are sensible */ -#if EITHER(HAS_FAN, USE_CONTROLLER_FAN) +#if ANY(HAS_FAN, USE_CONTROLLER_FAN) #if !WITHIN(FAN_MIN_PWM, 0, 255) #error "FAN_MIN_PWM must be a value from 0 to 255." #elif !WITHIN(FAN_MAX_PWM, 0, 255) @@ -2047,7 +2047,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #elif !ANY_PIN(TEMP_0, TEMP_0_CS) && !TEMP_SENSOR_0_IS_DUMMY #error "TEMP_0_PIN or TEMP_0_CS_PIN not defined for this board." #endif - #if EITHER(HAS_MULTI_HOTEND, HEATERS_PARALLEL) && !HAS_HEATER_1 + #if ANY(HAS_MULTI_HOTEND, HEATERS_PARALLEL) && !HAS_HEATER_1 #error "HEATER_1_PIN is not defined. TEMP_SENSOR_1 might not be set, or the board (not EEB / EEF?) doesn't define a pin." #endif #if HAS_MULTI_HOTEND @@ -2230,7 +2230,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L /** * FYSETC/MKS/BTT Mini Panel Requirements */ -#if EITHER(FYSETC_242_OLED_12864, FYSETC_MINI_12864_2_1) +#if ANY(FYSETC_242_OLED_12864, FYSETC_MINI_12864_2_1) #ifndef NEO_RGB #define NEO_RGB 123 #define FAUX_RGB 1 @@ -2244,7 +2244,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #undef NEO_RGB #undef FAUX_RGB #endif -#elif EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) && DISABLED(RGB_LED) +#elif ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) && DISABLED(RGB_LED) #error "Your FYSETC Mini Panel requires RGB_LED." #endif @@ -2354,12 +2354,12 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L // Z homing requirements #if Z_HOME_TO_MAX && ENABLED(USE_PROBE_FOR_Z_HOMING) #error "Z_HOME_DIR must be -1 when homing Z with the probe." - #elif BOTH(HOMING_Z_WITH_PROBE, Z_MULTI_ENDSTOPS) + #elif ALL(HOMING_Z_WITH_PROBE, Z_MULTI_ENDSTOPS) #error "Z_MULTI_ENDSTOPS is incompatible with USE_PROBE_FOR_Z_HOMING." #endif #endif -#if BOTH(HOME_Z_FIRST, USE_PROBE_FOR_Z_HOMING) +#if ALL(HOME_Z_FIRST, USE_PROBE_FOR_Z_HOMING) #error "HOME_Z_FIRST can't be used when homing Z with a probe." #endif @@ -2498,21 +2498,21 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L * Fan check */ #if HAS_FANCHECK - #if BOTH(E0_FAN_TACHO_PULLUP, E0_FAN_TACHO_PULLDOWN) + #if ALL(E0_FAN_TACHO_PULLUP, E0_FAN_TACHO_PULLDOWN) #error "Enable only one of E0_FAN_TACHO_PULLUP or E0_FAN_TACHO_PULLDOWN." - #elif BOTH(E1_FAN_TACHO_PULLUP, E1_FAN_TACHO_PULLDOWN) + #elif ALL(E1_FAN_TACHO_PULLUP, E1_FAN_TACHO_PULLDOWN) #error "Enable only one of E1_FAN_TACHO_PULLUP or E1_FAN_TACHO_PULLDOWN." - #elif BOTH(E2_FAN_TACHO_PULLUP, E2_FAN_TACHO_PULLDOWN) + #elif ALL(E2_FAN_TACHO_PULLUP, E2_FAN_TACHO_PULLDOWN) #error "Enable only one of E2_FAN_TACHO_PULLUP or E2_FAN_TACHO_PULLDOWN." - #elif BOTH(E3_FAN_TACHO_PULLUP, E3_FAN_TACHO_PULLDOWN) + #elif ALL(E3_FAN_TACHO_PULLUP, E3_FAN_TACHO_PULLDOWN) #error "Enable only one of E3_FAN_TACHO_PULLUP or E3_FAN_TACHO_PULLDOWN." - #elif BOTH(E4_FAN_TACHO_PULLUP, E4_FAN_TACHO_PULLDOWN) + #elif ALL(E4_FAN_TACHO_PULLUP, E4_FAN_TACHO_PULLDOWN) #error "Enable only one of E4_FAN_TACHO_PULLUP or E4_FAN_TACHO_PULLDOWN." - #elif BOTH(E5_FAN_TACHO_PULLUP, E5_FAN_TACHO_PULLDOWN) + #elif ALL(E5_FAN_TACHO_PULLUP, E5_FAN_TACHO_PULLDOWN) #error "Enable only one of E5_FAN_TACHO_PULLUP or E5_FAN_TACHO_PULLDOWN." - #elif BOTH(E6_FAN_TACHO_PULLUP, E6_FAN_TACHO_PULLDOWN) + #elif ALL(E6_FAN_TACHO_PULLUP, E6_FAN_TACHO_PULLDOWN) #error "Enable only one of E6_FAN_TACHO_PULLUP or E6_FAN_TACHO_PULLDOWN." - #elif BOTH(E7_FAN_TACHO_PULLUP, E7_FAN_TACHO_PULLDOWN) + #elif ALL(E7_FAN_TACHO_PULLUP, E7_FAN_TACHO_PULLDOWN) #error "Enable only one of E7_FAN_TACHO_PULLUP or E7_FAN_TACHO_PULLDOWN." #endif #elif ENABLED(AUTO_REPORT_FANS) @@ -2640,7 +2640,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #if ENABLED(TFT_GENERIC) && NONE(TFT_INTERFACE_FSMC, TFT_INTERFACE_SPI) #error "TFT_GENERIC requires either TFT_INTERFACE_FSMC or TFT_INTERFACE_SPI interface." -#elif BOTH(TFT_INTERFACE_FSMC, TFT_INTERFACE_SPI) +#elif ALL(TFT_INTERFACE_FSMC, TFT_INTERFACE_SPI) #error "Please enable only one of TFT_INTERFACE_FSMC or TFT_INTERFACE_SPI." #endif @@ -2664,7 +2664,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #error "GRAPHICAL_TFT_UPSCALE must be between 2 and 8." #endif -#if BOTH(CHIRON_TFT_STANDARD, CHIRON_TFT_NEW) +#if ALL(CHIRON_TFT_STANDARD, CHIRON_TFT_NEW) #error "Please select only one of CHIRON_TFT_STANDARD or CHIRON_TFT_NEW." #endif @@ -2686,7 +2686,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L static_assert(strcmp(STRINGIFY(LCD_LANGUAGE_2), "zh_CN") == 0, "LCD_LANGUAGE_2 must be set to zh_CN for ANYCUBIC_LCD_VYPER."); #endif -#if EITHER(MKS_TS35_V2_0, BTT_TFT35_SPI_V1_0) && SD_CONNECTION_IS(LCD) +#if ANY(MKS_TS35_V2_0, BTT_TFT35_SPI_V1_0) && SD_CONNECTION_IS(LCD) #error "SDCARD_CONNECTION cannot be set to LCD for the enabled TFT. No available SD card reader." #endif @@ -2696,25 +2696,25 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #if ENABLED(DWIN_CREALITY_LCD) #if !HAS_MEDIA #error "DWIN_CREALITY_LCD requires SDSUPPORT to be enabled." - #elif EITHER(PID_EDIT_MENU, PID_AUTOTUNE_MENU) + #elif ANY(PID_EDIT_MENU, PID_AUTOTUNE_MENU) #error "DWIN_CREALITY_LCD does not support PID_EDIT_MENU or PID_AUTOTUNE_MENU." - #elif EITHER(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) + #elif ANY(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) #error "DWIN_CREALITY_LCD does not support MPC_EDIT_MENU or MPC_AUTOTUNE_MENU." #elif ENABLED(LCD_BED_TRAMMING) #error "DWIN_CREALITY_LCD does not support LCD_BED_TRAMMING." - #elif BOTH(LCD_BED_LEVELING, PROBE_MANUALLY) + #elif ALL(LCD_BED_LEVELING, PROBE_MANUALLY) #error "DWIN_CREALITY_LCD does not support LCD_BED_LEVELING with PROBE_MANUALLY." #endif #elif ENABLED(DWIN_LCD_PROUI) #if !HAS_MEDIA #error "DWIN_LCD_PROUI requires SDSUPPORT to be enabled." - #elif EITHER(PID_EDIT_MENU, PID_AUTOTUNE_MENU) + #elif ANY(PID_EDIT_MENU, PID_AUTOTUNE_MENU) #error "DWIN_LCD_PROUI does not support PID_EDIT_MENU or PID_AUTOTUNE_MENU." - #elif EITHER(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) + #elif ANY(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) #error "DWIN_LCD_PROUI does not support MPC_EDIT_MENU or MPC_AUTOTUNE_MENU." #elif ENABLED(LCD_BED_TRAMMING) #error "DWIN_LCD_PROUI does not support LCD_BED_TRAMMING." - #elif BOTH(LCD_BED_LEVELING, PROBE_MANUALLY) + #elif ALL(LCD_BED_LEVELING, PROBE_MANUALLY) #error "DWIN_LCD_PROUI does not support LCD_BED_LEVELING with PROBE_MANUALLY." #endif #endif @@ -2735,9 +2735,9 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L // Startup Tune requirements #ifdef STARTUP_TUNE - #if EITHER(ANYCUBIC_LCD_CHIRON, ANYCUBIC_LCD_VYPER) + #if ANY(ANYCUBIC_LCD_CHIRON, ANYCUBIC_LCD_VYPER) #error "STARTUP_TUNE should be disabled with ANYCUBIC_LCD_CHIRON or ANYCUBIC_LCD_VYPER." - #elif !(BOTH(HAS_BEEPER, SPEAKER) || USE_MARLINUI_BUZZER) + #elif !(ALL(HAS_BEEPER, SPEAKER) || USE_MARLINUI_BUZZER) #error "STARTUP_TUNE requires a BEEPER_PIN with SPEAKER or USE_MARLINUI_BUZZER." #undef STARTUP_TUNE #endif @@ -3232,7 +3232,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #endif // !SPI_ENDSTOPS - #if ENABLED(DELTA) && !BOTH(STEALTHCHOP_XY, STEALTHCHOP_Z) + #if ENABLED(DELTA) && !ALL(STEALTHCHOP_XY, STEALTHCHOP_Z) #error "SENSORLESS_HOMING on DELTA currently requires STEALTHCHOP_XY and STEALTHCHOP_Z." #elif ENDSTOP_NOISE_THRESHOLD #error "SENSORLESS_HOMING is incompatible with ENDSTOP_NOISE_THRESHOLD." @@ -3262,7 +3262,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #error "CoreXZ requires both X and Z to use sensorless homing if either one does." #elif CORE_IS_YZ && Y_SENSORLESS != Z_SENSORLESS && !HOMING_Z_WITH_PROBE #error "CoreYZ requires both Y and Z to use sensorless homing if either one does." -#elif EITHER(MARKFORGED_XY, MARKFORGED_YX) && X_SENSORLESS != Y_SENSORLESS +#elif ANY(MARKFORGED_XY, MARKFORGED_YX) && X_SENSORLESS != Y_SENSORLESS #error "MARKFORGED requires both X and Y to use sensorless homing if either one does." #endif @@ -3350,7 +3350,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L * Digipot requirement */ #if HAS_MOTOR_CURRENT_I2C - #if BOTH(DIGIPOT_MCP4018, DIGIPOT_MCP4451) + #if ALL(DIGIPOT_MCP4018, DIGIPOT_MCP4451) #error "Enable only one of DIGIPOT_MCP4018 or DIGIPOT_MCP4451." #elif !MB(MKS_SBASE, AZTEEG_X5_GT, AZTEEG_X5_MINI, AZTEEG_X5_MINI_WIFI) \ && (!defined(DIGIPOTS_I2C_SDA_X) || !defined(DIGIPOTS_I2C_SDA_Y) || !defined(DIGIPOTS_I2C_SDA_Z) || !defined(DIGIPOTS_I2C_SDA_E0) || !defined(DIGIPOTS_I2C_SDA_E1)) @@ -3423,7 +3423,7 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive." #undef _PLUS_TEST #undef _EXTRA_NOTE -#if BOTH(CNC_COORDINATE_SYSTEMS, NO_WORKSPACE_OFFSETS) +#if ALL(CNC_COORDINATE_SYSTEMS, NO_WORKSPACE_OFFSETS) #error "CNC_COORDINATE_SYSTEMS is incompatible with NO_WORKSPACE_OFFSETS." #endif @@ -3459,18 +3459,18 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive." #endif #endif -#if BOTH(X_AXIS_TWIST_COMPENSATION, NOZZLE_AS_PROBE) +#if ALL(X_AXIS_TWIST_COMPENSATION, NOZZLE_AS_PROBE) #error "X_AXIS_TWIST_COMPENSATION is incompatible with NOZZLE_AS_PROBE." #endif #if ENABLED(POWER_LOSS_RECOVERY) #if ENABLED(BACKUP_POWER_SUPPLY) && !PIN_EXISTS(POWER_LOSS) #error "BACKUP_POWER_SUPPLY requires a POWER_LOSS_PIN." - #elif BOTH(POWER_LOSS_PULLUP, POWER_LOSS_PULLDOWN) + #elif ALL(POWER_LOSS_PULLUP, POWER_LOSS_PULLDOWN) #error "You can't enable POWER_LOSS_PULLUP and POWER_LOSS_PULLDOWN at the same time." #elif ENABLED(POWER_LOSS_RECOVER_ZHOME) && Z_HOME_TO_MAX #error "POWER_LOSS_RECOVER_ZHOME is not needed on a machine that homes to ZMAX." - #elif BOTH(IS_CARTESIAN, POWER_LOSS_RECOVER_ZHOME) && Z_HOME_TO_MIN && !defined(POWER_LOSS_ZHOME_POS) + #elif ALL(IS_CARTESIAN, POWER_LOSS_RECOVER_ZHOME) && Z_HOME_TO_MIN && !defined(POWER_LOSS_ZHOME_POS) #error "POWER_LOSS_RECOVER_ZHOME requires POWER_LOSS_ZHOME_POS for a Cartesian that homes to ZMIN." #endif #endif @@ -3532,7 +3532,7 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive." #error "BACKLASH_COMPENSATION requires BACKLASH_DISTANCE_MM." #elif !defined(BACKLASH_CORRECTION) #error "BACKLASH_COMPENSATION requires BACKLASH_CORRECTION." - #elif EITHER(MARKFORGED_XY, MARKFORGED_YX) + #elif ANY(MARKFORGED_XY, MARKFORGED_YX) constexpr float backlash_arr[] = BACKLASH_DISTANCE_MM; static_assert(!backlash_arr[CORE_AXIS_1] && !backlash_arr[CORE_AXIS_2], "BACKLASH_COMPENSATION can only apply to " STRINGIFY(NORMAL_AXIS) " on a MarkForged system."); @@ -3582,7 +3582,7 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive." /** * Require soft endstops for certain setups */ -#if !BOTH(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) +#if !ALL(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) #if ENABLED(DUAL_X_CARRIAGE) #error "DUAL_X_CARRIAGE requires both MIN_ and MAX_SOFTWARE_ENDSTOPS." #elif HAS_HOTEND_OFFSET @@ -3643,7 +3643,7 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive." #endif #define _PIN_CONFLICT(P) (PIN_EXISTS(P) && P##_PIN == SPINDLE_LASER_PWM_PIN) - #if BOTH(SPINDLE_FEATURE, LASER_FEATURE) + #if ALL(SPINDLE_FEATURE, LASER_FEATURE) #error "Enable only one of SPINDLE_FEATURE or LASER_FEATURE." #elif NONE(SPINDLE_SERVO, SPINDLE_LASER_USE_PWM) && !PIN_EXISTS(SPINDLE_LASER_ENA) #error "(SPINDLE|LASER)_FEATURE requires SPINDLE_LASER_ENA_PIN, SPINDLE_LASER_USE_PWM, or SPINDLE_SERVO to control the power." @@ -3792,7 +3792,7 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive." #error "ESP3D_WIFISUPPORT requires an ESP32 MOTHERBOARD." #elif ENABLED(WEBSUPPORT) && NONE(ARDUINO_ARCH_ESP32, WIFISUPPORT) #error "WEBSUPPORT requires WIFISUPPORT and an ESP32 MOTHERBOARD." -#elif BOTH(ESP3D_WIFISUPPORT, WIFISUPPORT) +#elif ALL(ESP3D_WIFISUPPORT, WIFISUPPORT) #error "Enable only one of ESP3D_WIFISUPPORT or WIFISUPPORT." #endif @@ -3810,14 +3810,14 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive." /** * Sanity Check for MEATPACK and BINARY_FILE_TRANSFER Features */ -#if BOTH(HAS_MEATPACK, BINARY_FILE_TRANSFER) +#if ALL(HAS_MEATPACK, BINARY_FILE_TRANSFER) #error "Either enable MEATPACK_ON_SERIAL_PORT_* or BINARY_FILE_TRANSFER, not both." #endif /** * Sanity Check for Slim LCD Menus and Probe Offset Wizard */ -#if BOTH(SLIM_LCD_MENUS, PROBE_OFFSET_WIZARD) +#if ALL(SLIM_LCD_MENUS, PROBE_OFFSET_WIZARD) #error "SLIM_LCD_MENUS disables \"Advanced Settings > Probe Offsets > PROBE_OFFSET_WIZARD.\"" #endif @@ -3854,7 +3854,7 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive." /** * Sanity check for MIXING_EXTRUDER & DISTINCT_E_FACTORS these are not compatible */ -#if BOTH(MIXING_EXTRUDER, DISTINCT_E_FACTORS) +#if ALL(MIXING_EXTRUDER, DISTINCT_E_FACTORS) #error "MIXING_EXTRUDER can't be used with DISTINCT_E_FACTORS. But you may use SINGLENOZZLE with DISTINCT_E_FACTORS." #endif @@ -3988,7 +3988,7 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive." #endif // Check requirements for upload.py -#if ENABLED(XFER_BUILD) && !BOTH(BINARY_FILE_TRANSFER, CUSTOM_FIRMWARE_UPLOAD) +#if ENABLED(XFER_BUILD) && !ALL(BINARY_FILE_TRANSFER, CUSTOM_FIRMWARE_UPLOAD) #error "BINARY_FILE_TRANSFER and CUSTOM_FIRMWARE_UPLOAD are required for custom upload." #endif @@ -4008,12 +4008,12 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive." #error "Input Shaping is not compatible with POLARGRAPH kinematics." #elif ENABLED(DIRECT_STEPPING) #error "Input Shaping is not compatible with DIRECT_STEPPING." - #elif BOTH(INPUT_SHAPING_X, CORE_IS_XZ) + #elif ALL(INPUT_SHAPING_X, CORE_IS_XZ) #error "INPUT_SHAPING_X is not supported with COREXZ." - #elif BOTH(INPUT_SHAPING_Y, CORE_IS_YZ) + #elif ALL(INPUT_SHAPING_Y, CORE_IS_YZ) #error "INPUT_SHAPING_Y is not supported with COREYZ." #elif ANY(CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX) - #if !BOTH(INPUT_SHAPING_X, INPUT_SHAPING_Y) + #if !ALL(INPUT_SHAPING_X, INPUT_SHAPING_Y) #error "INPUT_SHAPING_X and INPUT_SHAPING_Y must both be enabled for COREXY, COREYX, or MARKFORGED_*." #else static_assert(SHAPING_FREQ_X == SHAPING_FREQ_Y, "SHAPING_FREQ_X and SHAPING_FREQ_Y must be the same for COREXY / COREYX / MARKFORGED_*."); diff --git a/Marlin/src/inc/Warnings.cpp b/Marlin/src/inc/Warnings.cpp index 5c6297ba60191..34c63239e5c60 100644 --- a/Marlin/src/inc/Warnings.cpp +++ b/Marlin/src/inc/Warnings.cpp @@ -687,17 +687,17 @@ /** * 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) +#if ANY(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/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) +#if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) && DISABLED(RGB_LED) #warning "Your FYSETC Mini Panel works best with RGB_LED." -#elif EITHER(FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1) && DISABLED(LED_USER_PRESET_STARTUP) +#elif ANY(FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1) && DISABLED(LED_USER_PRESET_STARTUP) #warning "Your FYSETC Mini Panel works best with LED_USER_PRESET_STARTUP." #endif -#if EITHER(FYSETC_242_OLED_12864, FYSETC_MINI_12864) && BOTH(PSU_CONTROL, HAS_COLOR_LEDS) && !LED_POWEROFF_TIMEOUT +#if ANY(FYSETC_242_OLED_12864, FYSETC_MINI_12864) && ALL(PSU_CONTROL, HAS_COLOR_LEDS) && !LED_POWEROFF_TIMEOUT #warning "Your FYSETC display with PSU_CONTROL works best with LED_POWEROFF_TIMEOUT." #endif @@ -739,7 +739,7 @@ /** * POLAR warnings */ -#if BOTH(POLAR, S_CURVE_ACCELERATION) +#if ALL(POLAR, S_CURVE_ACCELERATION) #warning "POLAR kinematics may not work well with S_CURVE_ACCELERATION." #endif diff --git a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp index b03ff8a9f5335..55e4d156ea9e6 100644 --- a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp +++ b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp @@ -41,12 +41,12 @@ #include "../../module/planner.h" #include "../../module/motion.h" -#if DISABLED(LCD_PROGRESS_BAR) && BOTH(FILAMENT_LCD_DISPLAY, HAS_MEDIA) +#if DISABLED(LCD_PROGRESS_BAR) && ALL(FILAMENT_LCD_DISPLAY, HAS_MEDIA) #include "../../feature/filwidth.h" #include "../../gcode/parser.h" #endif -#if EITHER(HAS_COOLER, LASER_COOLANT_FLOW_METER) +#if ANY(HAS_COOLER, LASER_COOLANT_FLOW_METER) #include "../../feature/cooler.h" #endif @@ -70,7 +70,7 @@ LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_I2C_PIN_EN, LCD_I2C_PIN_RW, LCD_I2C_PIN_RS, LCD_I2C_PIN_D4, LCD_I2C_PIN_D5, LCD_I2C_PIN_D6, LCD_I2C_PIN_D7); -#elif EITHER(LCD_I2C_TYPE_MCP23017, LCD_I2C_TYPE_MCP23008) +#elif ANY(LCD_I2C_TYPE_MCP23017, LCD_I2C_TYPE_MCP23008) LCD_CLASS lcd(LCD_I2C_ADDRESS OPTARG(DETECT_I2C_LCD_DEVICE, 1)); @@ -305,7 +305,7 @@ void MarlinUI::set_custom_characters(const HD44780CharSet screen_charset/*=CHARS #endif // LCD_PROGRESS_BAR - #if BOTH(HAS_MEDIA, HAS_MARLINUI_MENU) + #if ALL(HAS_MEDIA, HAS_MARLINUI_MENU) // CHARSET_MENU const static PROGMEM byte refresh[8] = { @@ -355,7 +355,7 @@ void MarlinUI::set_custom_characters(const HD44780CharSet screen_charset/*=CHARS #endif { createChar_P(LCD_STR_UPLEVEL[0], uplevel); - #if BOTH(HAS_MEDIA, HAS_MARLINUI_MENU) + #if ALL(HAS_MEDIA, HAS_MARLINUI_MENU) // SD Card sub-menu special characters createChar_P(LCD_STR_REFRESH[0], refresh); createChar_P(LCD_STR_FOLDER[0], folder); @@ -713,7 +713,7 @@ void MarlinUI::draw_status_message(const bool blink) { if (progress > 2) return draw_progress_bar(progress); } - #elif BOTH(FILAMENT_LCD_DISPLAY, HAS_MEDIA) + #elif ALL(FILAMENT_LCD_DISPLAY, HAS_MEDIA) // Alternate Status message and Filament display if (ELAPSED(millis(), next_filament_display)) { @@ -1046,7 +1046,7 @@ void MarlinUI::draw_status_screen() { uint16_t per; #if HAS_FAN0 if (true - #if BOTH(HAS_EXTRUDERS, ADAPTIVE_FAN_SLOWING) + #if ALL(HAS_EXTRUDERS, ADAPTIVE_FAN_SLOWING) && (blink || thermalManager.fan_speed_scaler[0] < 128) #endif ) { diff --git a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp index f7e9ff3e45643..dfb685f096ec4 100644 --- a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp +++ b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp @@ -52,12 +52,12 @@ #include "../../module/planner.h" #include "../../module/motion.h" -#if DISABLED(LCD_PROGRESS_BAR) && BOTH(FILAMENT_LCD_DISPLAY, HAS_MEDIA) +#if DISABLED(LCD_PROGRESS_BAR) && ALL(FILAMENT_LCD_DISPLAY, HAS_MEDIA) #include "../../feature/filwidth.h" #include "../../gcode/parser.h" #endif -#if EITHER(HAS_COOLER, LASER_COOLANT_FLOW_METER) +#if ANY(HAS_COOLER, LASER_COOLANT_FLOW_METER) #include "../../feature/cooler.h" #endif @@ -141,7 +141,7 @@ static uint8_t PanelDetected = 0; #if ANY(__AVR__, TARGET_LPC1768, __STM32F1__, ARDUINO_ARCH_SAM, __SAMD51__, __MK20DX256__, __MK64FX512__) #define SPI_SEND_ONE(V) SPI.transfer(V); #define SPI_SEND_TWO(V) SPI.transfer16(V); -#elif EITHER(STM32F4xx, STM32F1xx) +#elif ANY(STM32F4xx, STM32F1xx) #define SPI_SEND_ONE(V) SPI.transfer(V, SPI_CONTINUE); #define SPI_SEND_TWO(V) SPI.transfer16(V, SPI_CONTINUE); #elif defined(ARDUINO_ARCH_ESP32) @@ -151,7 +151,7 @@ static uint8_t PanelDetected = 0; #if ANY(__AVR__, ARDUINO_ARCH_SAM, __SAMD51__, __MK20DX256__, __MK64FX512__) #define SPI_SEND_SOME(V,L,Z) SPI.transfer(&V[Z], L); -#elif EITHER(STM32F4xx, STM32F1xx) +#elif ANY(STM32F4xx, STM32F1xx) #define SPI_SEND_SOME(V,L,Z) SPI.transfer(&V[Z], L, SPI_CONTINUE); #elif ANY(TARGET_LPC1768, __STM32F1__, ARDUINO_ARCH_ESP32) #define SPI_SEND_SOME(V,L,Z) do{ for (uint16_t i = 0; i < L; i++) SPI_SEND_ONE(V[(Z)+i]); }while(0) @@ -290,7 +290,7 @@ uint8_t MarlinUI::read_slow_buttons() { Wire.requestFrom((uint8_t)LCD_I2C_ADDRESS, 2, 0, 0, 1); #elif defined(STM32F1) Wire.requestFrom((uint8_t)LCD_I2C_ADDRESS, (uint8_t)2); - #elif EITHER(STM32F4xx, TARGET_LPC1768) + #elif ANY(STM32F4xx, TARGET_LPC1768) Wire.requestFrom(LCD_I2C_ADDRESS, 2); #endif encoderDiff += Wire.read(); @@ -672,7 +672,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_moveto(0, 3); - #if BOTH(FILAMENT_LCD_DISPLAY, HAS_MEDIA) + #if ALL(FILAMENT_LCD_DISPLAY, HAS_MEDIA) // Alternate Status message and Filament display if (ELAPSED(millis(), next_filament_display)) { diff --git a/Marlin/src/lcd/buttons.h b/Marlin/src/lcd/buttons.h index 58471239bbfba..601e8a70ae05e 100644 --- a/Marlin/src/lcd/buttons.h +++ b/Marlin/src/lcd/buttons.h @@ -38,7 +38,7 @@ #define HAS_SLOW_BUTTONS 1 #endif -#if EITHER(HAS_DIGITAL_BUTTONS, HAS_DWIN_E3V2) +#if ANY(HAS_DIGITAL_BUTTONS, HAS_DWIN_E3V2) // Wheel spin pins where BA is 00, 10, 11, 01 (1 bit always changes) #define BLEN_A 0 #define BLEN_B 1 @@ -149,7 +149,7 @@ #ifndef EN_C #define EN_C 0 #endif -#if BUTTON_EXISTS(BACK) || EITHER(HAS_TOUCH_BUTTONS, IS_TFTGLCD_PANEL) +#if BUTTON_EXISTS(BACK) || ANY(HAS_TOUCH_BUTTONS, IS_TFTGLCD_PANEL) #define BLEN_D 3 #define EN_D _BV(BLEN_D) #else diff --git a/Marlin/src/lcd/dogm/dogm_Statusscreen.h b/Marlin/src/lcd/dogm/dogm_Statusscreen.h index 8d0ab4efbe460..9eec9d1987171 100644 --- a/Marlin/src/lcd/dogm/dogm_Statusscreen.h +++ b/Marlin/src/lcd/dogm/dogm_Statusscreen.h @@ -143,7 +143,7 @@ // Can also be overridden in Configuration_adv.h // If you can afford it, try the 3-frame fan animation! // Don't compile in the fan animation with no fan -#if !HAS_FAN0 || (HOTENDS == 5 || (HOTENDS == 4 && BED_OR_CHAMBER) || BOTH(STATUS_COMBINE_HEATERS, HAS_HEATED_CHAMBER)) +#if !HAS_FAN0 || (HOTENDS == 5 || (HOTENDS == 4 && BED_OR_CHAMBER) || ALL(STATUS_COMBINE_HEATERS, HAS_HEATED_CHAMBER)) #undef STATUS_FAN_FRAMES #elif !STATUS_FAN_FRAMES #define STATUS_FAN_FRAMES 2 @@ -253,7 +253,7 @@ ((STATUS_CHAMBER_WIDTH || STATUS_FAN_WIDTH || STATUS_BED_WIDTH) && STATUS_HOTEND_BITMAPS == 4) #define STATUS_HEATERS_X 5 #else - #if BOTH(STATUS_COMBINE_HEATERS, HAS_HEATED_BED) && HOTENDS <= 4 + #if ALL(STATUS_COMBINE_HEATERS, HAS_HEATED_BED) && HOTENDS <= 4 #define STATUS_HEATERS_X 5 #else #define STATUS_HEATERS_X 8 // Like the included bitmaps @@ -742,22 +742,22 @@ #if HAS_FAN0 && STATUS_FAN_WIDTH && HOTENDS <= 4 && defined(STATUS_FAN_FRAMES) #define DO_DRAW_FAN 1 #endif -#if BOTH(HAS_HOTEND, STATUS_HOTEND_ANIM) +#if ALL(HAS_HOTEND, STATUS_HOTEND_ANIM) #define ANIM_HOTEND 1 #endif -#if BOTH(DO_DRAW_BED, STATUS_BED_ANIM) +#if ALL(DO_DRAW_BED, STATUS_BED_ANIM) #define ANIM_BED 1 #endif -#if BOTH(DO_DRAW_CHAMBER, STATUS_CHAMBER_ANIM) +#if ALL(DO_DRAW_CHAMBER, STATUS_CHAMBER_ANIM) #define ANIM_CHAMBER 1 #endif -#if BOTH(DO_DRAW_CUTTER, STATUS_CUTTER_ANIM) +#if ALL(DO_DRAW_CUTTER, STATUS_CUTTER_ANIM) #define ANIM_CUTTER 1 #endif -#if BOTH(DO_DRAW_COOLER, STATUS_COOLER_ANIM) +#if ALL(DO_DRAW_COOLER, STATUS_COOLER_ANIM) #define ANIM_COOLER 1 #endif -#if BOTH(DO_DRAW_FLOWMETER, STATUS_FLOWMETER_ANIM) +#if ALL(DO_DRAW_FLOWMETER, STATUS_FLOWMETER_ANIM) #define ANIM_FLOWMETER 1 #endif #if ANIM_HOTEND || ANIM_BED || ANIM_CHAMBER || ANIM_CUTTER diff --git a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp index 2552df3b88f41..185d3488dbc93 100644 --- a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp +++ b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp @@ -645,7 +645,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop #endif // AUTO_BED_LEVELING_UBL - #if EITHER(BABYSTEP_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY) + #if ANY(BABYSTEP_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY) // // Draw knob rotation => Z motion key for: diff --git a/Marlin/src/lcd/dogm/marlinui_DOGM.h b/Marlin/src/lcd/dogm/marlinui_DOGM.h index afdda5ac5bf5b..414508b1294c7 100644 --- a/Marlin/src/lcd/dogm/marlinui_DOGM.h +++ b/Marlin/src/lcd/dogm/marlinui_DOGM.h @@ -127,7 +127,7 @@ #define U8G_CLASS U8GLIB_SSD1306_128X64 // 8 stripes #endif -#elif EITHER(FYSETC_242_OLED_12864, K3D_242_OLED_CONTROLLER) +#elif ANY(FYSETC_242_OLED_12864, K3D_242_OLED_CONTROLLER) // FYSETC OLED 2.42" 128 × 64 Full Graphics Controller // or K3D OLED 2.42" 128 × 64 Full Graphics Controller @@ -151,7 +151,7 @@ #define U8G_CLASS U8GLIB_SH1306_128X64 // 8 stripes #endif -#elif EITHER(MKS_12864OLED, ZONESTAR_12864OLED) +#elif ANY(MKS_12864OLED, ZONESTAR_12864OLED) // MKS 128x64 (SH1106) OLED I2C LCD // - or - diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp index 7d1f090d1e3f5..61181f9a005b1 100644 --- a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp @@ -55,7 +55,7 @@ #include "../../feature/spindle_laser.h" #endif -#if EITHER(HAS_COOLER, LASER_COOLANT_FLOW_METER) +#if ANY(HAS_COOLER, LASER_COOLANT_FLOW_METER) #include "../../feature/cooler.h" #endif @@ -127,7 +127,7 @@ #define MAX_HOTEND_DRAW _MIN(HOTENDS, ((LCD_PIXEL_WIDTH - (STATUS_LOGO_BYTEWIDTH + STATUS_FAN_BYTEWIDTH) * 8) / (STATUS_HEATERS_XSPACE))) #endif -#if EITHER(DO_DRAW_BED, DO_DRAW_HOTENDS) +#if ANY(DO_DRAW_BED, DO_DRAW_HOTENDS) #define STATUS_HEATERS_BOT (STATUS_HEATERS_Y + STATUS_HEATERS_HEIGHT - 1) #endif @@ -457,7 +457,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const } // Prepare strings for progress display -#if EITHER(HAS_EXTRA_PROGRESS, HAS_PRINT_PROGRESS) +#if ANY(HAS_EXTRA_PROGRESS, HAS_PRINT_PROGRESS) static MarlinUI::progress_t progress = 0; static char bufferc[13]; #endif @@ -512,7 +512,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const void MarlinUI::draw_status_screen() { #if NUM_AXES constexpr int xystorage = TERN(INCH_MODE_SUPPORT, 8, 5); - #if EITHER(HAS_X_AXIS, LCD_SHOW_E_TOTAL) + #if ANY(HAS_X_AXIS, LCD_SHOW_E_TOTAL) static char xstring[TERN(LCD_SHOW_E_TOTAL, 12, xystorage)]; #endif #if HAS_Y_AXIS @@ -612,7 +612,7 @@ void MarlinUI::draw_status_screen() { #if DO_DRAW_BED && DISABLED(STATUS_COMBINE_HEATERS) #if ANIM_BED - #if BOTH(HAS_LEVELING, STATUS_ALT_BED_BITMAP) + #if ALL(HAS_LEVELING, STATUS_ALT_BED_BITMAP) #define BED_BITMAP(S) ((S) \ ? (planner.leveling_active ? status_bed_leveled_on_bmp : status_bed_on_bmp) \ : (planner.leveling_active ? status_bed_leveled_bmp : status_bed_bmp)) @@ -783,7 +783,7 @@ void MarlinUI::draw_status_screen() { // XYZ Coordinates // - #if EITHER(XYZ_NO_FRAME, XYZ_HOLLOW_FRAME) + #if ANY(XYZ_NO_FRAME, XYZ_HOLLOW_FRAME) #define XYZ_FRAME_TOP 29 #define XYZ_FRAME_HEIGHT INFO_FONT_ASCENT + 3 #else @@ -890,7 +890,7 @@ void MarlinUI::draw_status_screen() { if (PAGE_CONTAINS(STATUS_BASELINE - INFO_FONT_ASCENT, STATUS_BASELINE + INFO_FONT_DESCENT)) { lcd_moveto(0, STATUS_BASELINE); - #if BOTH(FILAMENT_LCD_DISPLAY, HAS_MEDIA) + #if ALL(FILAMENT_LCD_DISPLAY, HAS_MEDIA) // Alternate Status message and Filament display if (ELAPSED(millis(), next_filament_display)) { lcd_put_u8str(F(LCD_STR_FILAM_DIA)); diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index 9ae1cf1e0626d..3c259e5bf4dec 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp @@ -76,7 +76,7 @@ #include "../../../module/probe.h" #endif -#if EITHER(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP) +#if ANY(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP) #include "../../../feature/babystep.h" #endif @@ -201,7 +201,7 @@ void HMI_SetLanguageCache() { } void HMI_SetLanguage() { - #if BOTH(EEPROM_SETTINGS, IIC_BL24CXX_EEPROM) + #if ALL(EEPROM_SETTINGS, IIC_BL24CXX_EEPROM) BL24CXX::read(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&HMI_flag.language, sizeof(HMI_flag.language)); #endif HMI_SetLanguageCache(); @@ -210,7 +210,7 @@ void HMI_SetLanguage() { void HMI_ToggleLanguage() { HMI_flag.language = HMI_IsChinese() ? DWIN_ENGLISH : DWIN_CHINESE; HMI_SetLanguageCache(); - #if BOTH(EEPROM_SETTINGS, IIC_BL24CXX_EEPROM) + #if ALL(EEPROM_SETTINGS, IIC_BL24CXX_EEPROM) BL24CXX::write(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&HMI_flag.language, sizeof(HMI_flag.language)); #endif } @@ -475,7 +475,7 @@ void Draw_Back_First(const bool is_sel=true) { #define PREPARE_CASE_ZOFF (PREPARE_CASE_HOME + ENABLED(HAS_ZOFFSET_ITEM)) #define PREPARE_CASE_PLA (PREPARE_CASE_ZOFF + ENABLED(HAS_PREHEAT)) #define PREPARE_CASE_ABS (PREPARE_CASE_PLA + (TERN0(HAS_PREHEAT, PREHEAT_COUNT > 1))) -#define PREPARE_CASE_COOL (PREPARE_CASE_ABS + EITHER(HAS_HOTEND, HAS_HEATED_BED)) +#define PREPARE_CASE_COOL (PREPARE_CASE_ABS + ANY(HAS_HOTEND, HAS_HEATED_BED)) #define PREPARE_CASE_LANG (PREPARE_CASE_COOL + 1) #define PREPARE_CASE_TOTAL PREPARE_CASE_LANG @@ -1375,7 +1375,7 @@ void HMI_Move_Z() { LIMIT(HMI_ValueStruct.offset_value, (Z_PROBE_OFFSET_RANGE_MIN) * 100, (Z_PROBE_OFFSET_RANGE_MAX) * 100); last_zoffset = dwin_zoffset; dwin_zoffset = HMI_ValueStruct.offset_value / 100.0f; - #if EITHER(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP) + #if ANY(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP) if (BABYSTEP_ALLOWED()) babystep.add_mm(Z_AXIS, dwin_zoffset - last_zoffset); #endif Draw_Edit_Signed_Float2(zoff_line, HMI_ValueStruct.offset_value, true); @@ -2291,10 +2291,10 @@ void HMI_Printing() { char cmd[40]; cmd[0] = '\0'; - #if BOTH(HAS_HEATED_BED, PAUSE_HEAT) + #if ALL(HAS_HEATED_BED, PAUSE_HEAT) if (resume_bed_temp) sprintf_P(cmd, PSTR("M190 S%i\n"), resume_bed_temp); #endif - #if BOTH(HAS_HOTEND, PAUSE_HEAT) + #if ALL(HAS_HOTEND, PAUSE_HEAT) if (resume_hotend_temp) sprintf_P(&cmd[strlen(cmd)], PSTR("M109 S%i\n"), resume_hotend_temp); #endif @@ -2701,7 +2701,7 @@ void HMI_Prepare() { #if HAS_ZOFFSET_ITEM case PREPARE_CASE_ZOFF: - #if EITHER(HAS_BED_PROBE, BABYSTEPPING) + #if ANY(HAS_BED_PROBE, BABYSTEPPING) checkkey = Homeoffset; HMI_ValueStruct.show_mode = -4; HMI_ValueStruct.offset_value = BABY_Z_VAR * 100; @@ -3780,7 +3780,7 @@ void HMI_Tune() { #endif #if HAS_ZOFFSET_ITEM case TUNE_CASE_ZOFF: // Z-offset - #if EITHER(HAS_BED_PROBE, BABYSTEPPING) + #if ANY(HAS_BED_PROBE, BABYSTEPPING) checkkey = Homeoffset; HMI_ValueStruct.offset_value = BABY_Z_VAR * 100; Draw_Edit_Signed_Float2(TUNE_CASE_ZOFF + MROWS - index_tune, HMI_ValueStruct.offset_value, true); @@ -4240,7 +4240,7 @@ void DWIN_HandleScreen() { case Extruder: HMI_Move_E(); break; case ETemp: HMI_ETemp(); break; #endif - #if EITHER(HAS_BED_PROBE, BABYSTEPPING) + #if ANY(HAS_BED_PROBE, BABYSTEPPING) case Homeoffset: HMI_Zoffset(); break; #endif #if HAS_HEATED_BED diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 53e4466bf811a..81478887cec35 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -1104,7 +1104,7 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item #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_COOLDOWN (PREPARE_PREHEAT + ANY(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 @@ -3081,7 +3081,7 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item #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_TILT (LEVELING_ACTIVE + ALL(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) @@ -3116,7 +3116,7 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item Draw_Checkbox(row, planner.leveling_active); } break; - #if BOTH(HAS_BED_PROBE, AUTO_BED_LEVELING_UBL) + #if ALL(HAS_BED_PROBE, AUTO_BED_LEVELING_UBL) case LEVELING_GET_TILT: if (draw) Draw_Menu_Item(row, ICON_Tilt, F("Autotilt Current Mesh")); diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp index 58a84ac34e510..5d6e238fe1d20 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp @@ -582,7 +582,7 @@ void MarlinUI::draw_status_message(const bool blink) { #endif // AUTO_BED_LEVELING_UBL - #if EITHER(BABYSTEP_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY) + #if ANY(BABYSTEP_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY) void MarlinUI::zoffset_overlay(const int8_t dir) { const int rot_up = TERN(OVERLAY_GFX_REVERSE, ICON_RotateCCW, ICON_RotateCW), diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp index 5cfeb6488f928..b66750bd88123 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp @@ -192,7 +192,7 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater, const uint16_t x #endif celsius_float_t tc = 0, tt = 0; - bool isBed = (DISABLED(HAS_HOTEND) && ENABLED(HAS_HEATED_BED)) || (BOTH(HAS_HOTEND, HAS_HEATED_BED) && heater < 0), + bool isBed = (DISABLED(HAS_HOTEND) && ENABLED(HAS_HEATED_BED)) || (ALL(HAS_HOTEND, HAS_HEATED_BED) && heater < 0), ta = false, c_draw, t_draw, i_draw; c_draw = t_draw = i_draw = !ui.did_first_redraw; if (isBed) { diff --git a/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp index 47b104c5ba479..48e07cc207938 100644 --- a/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp +++ b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp @@ -46,7 +46,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if BOTH(DWIN_LCD_PROUI, HAS_LEVELING) +#if ALL(DWIN_LCD_PROUI, HAS_LEVELING) #include "../../marlinui.h" #include "../../../core/types.h" diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 6730c026c59a7..807f1915f6f3f 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -233,7 +233,7 @@ MenuClass *MaxAccelMenu = nullptr; MenuClass *MaxJerkMenu = nullptr; #endif MenuClass *StepsMenu = nullptr; -#if EITHER(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) +#if ANY(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) MenuClass *HotendMPCMenu = nullptr; #endif #if ENABLED(PIDTEMP) @@ -285,7 +285,7 @@ void HMI_SetLanguageCache() { } void HMI_SetLanguage() { - #if BOTH(EEPROM_SETTINGS, IIC_BL24CXX_EEPROM) + #if ALL(EEPROM_SETTINGS, IIC_BL24CXX_EEPROM) BL24CXX::read(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&HMI_flag.language, sizeof(HMI_flag.language)); #endif HMI_SetLanguageCache(); @@ -294,7 +294,7 @@ void HMI_SetLanguage() { void HMI_ToggleLanguage() { HMI_flag.language = HMI_IsChinese() ? DWIN_ENGLISH : DWIN_CHINESE; HMI_SetLanguageCache(); - #if BOTH(EEPROM_SETTINGS, IIC_BL24CXX_EEPROM) + #if ALL(EEPROM_SETTINGS, IIC_BL24CXX_EEPROM) BL24CXX::write(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&HMI_flag.language, sizeof(HMI_flag.language)); #endif } @@ -1410,7 +1410,7 @@ 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 ALL(AUTO_BED_LEVELING_UBL, PREHEAT_BEFORE_LEVELING) #if HAS_HOTEND if (thermalManager.degTargetHotend(0) < LEVELING_NOZZLE_TEMP) thermalManager.setTargetHotend(LEVELING_NOZZLE_TEMP, 0); @@ -1460,7 +1460,7 @@ void DWIN_LevelingDone() { DWINUI::Draw_String(HMI_data.PopupTxt_Color, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("MPC target: Celsius")); break; #endif - #if EITHER(PIDTEMP, PIDTEMPBED) + #if ANY(PIDTEMP, PIDTEMPBED) TERN_(PIDTEMP, case PIDTEMP_START:) TERN_(PIDTEMPBED, case PIDTEMPBED_START:) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 100, GET_TEXT_F(MSG_PID_AUTOTUNE)); @@ -1471,7 +1471,7 @@ void DWIN_LevelingDone() { switch (HMI_value.pidresult) { default: break; - #if EITHER(PIDTEMP, MPC_AUTOTUNE) + #if ANY(PIDTEMP, MPC_AUTOTUNE) TERN_(PIDTEMP, case PIDTEMP_START:) TERN_(MPC_AUTOTUNE, case MPCTEMP_START:) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 120, F("for Nozzle is running.")); @@ -1705,10 +1705,10 @@ void DWIN_SetDataDefaults() { TERN_(BAUD_RATE_GCODE, SetBaud250K()); HMI_data.FullManualTramming = false; HMI_data.MediaAutoMount = ENABLED(HAS_SD_EXTENDER); - #if BOTH(INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) + #if ALL(INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) HMI_data.z_after_homing = DEF_Z_AFTER_HOMING; #endif - #if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS) + #if ALL(LED_CONTROL_MENU, HAS_COLOR_LEDS) TERN_(LED_COLOR_PRESETS, leds.set_default()); ApplyLEDColor(); #endif @@ -1725,7 +1725,7 @@ void DWIN_CopySettingsFrom(const char * const buff) { TERN_(PREVENT_COLD_EXTRUSION, ApplyExtMinT()); feedrate_percentage = 100; TERN_(BAUD_RATE_GCODE, HMI_SetBaudRate()); - #if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS) + #if ALL(LED_CONTROL_MENU, HAS_COLOR_LEDS) leds.set_color( HMI_data.Led_Color.r, HMI_data.Led_Color.g, @@ -1983,7 +1983,7 @@ void AutoHome() { queue.inject_P(G28_STR); } void HomeX() { queue.inject(F("G28X")); } void HomeY() { queue.inject(F("G28Y")); } void HomeZ() { queue.inject(F("G28Z")); } - #if BOTH(INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) + #if ALL(INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) void ApplyZAfterHoming() { HMI_data.z_after_homing = MenuData.Value; }; void SetZAfterHoming() { SetIntOnClick(0, 20, HMI_data.z_after_homing, ApplyZAfterHoming); } #endif @@ -2001,13 +2001,13 @@ void AutoHome() { queue.inject_P(G28_STR); } void ApplyZOffset() { TERN_(EEPROM_SETTINGS, settings.save()); } void LiveZOffset() { - #if EITHER(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP) + #if ANY(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP) 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 } void SetZOffset() { - #if EITHER(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP) + #if ANY(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP) babystep.accum = round(planner.settings.axis_steps_per_mm[Z_AXIS] * BABY_Z_VAR); #endif SetPFloatOnClick(Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX, 2, ApplyZOffset, LiveZOffset); @@ -2135,7 +2135,7 @@ void SetMoveZ() { HMI_value.axis = Z_AXIS; SetPFloatOnClick(Z_MIN_POS, Z_MAX_POS #endif #if ENABLED(LED_CONTROL_MENU) - #if !BOTH(CASE_LIGHT_MENU, CASE_LIGHT_USE_NEOPIXEL) + #if !ALL(CASE_LIGHT_MENU, CASE_LIGHT_USE_NEOPIXEL) void SetLedStatus() { leds.toggle(); Show_Chkb_Line(leds.lights_on); @@ -2675,7 +2675,7 @@ void onDrawAutoHome(MenuItemClass* menuitem, int8_t line) { } #if HAS_ZOFFSET_ITEM - #if EITHER(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP) + #if ANY(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); @@ -3118,7 +3118,7 @@ void Draw_AdvancedSettings_Menu() { #if ENABLED(PIDTEMP) MENU_ITEM_F(ICON_PIDNozzle, STR_HOTEND_PID " Settings", onDrawSubMenu, Draw_HotendPID_Menu); #endif - #if EITHER(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) + #if ANY(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) MENU_ITEM_F(ICON_MPCNozzle, "MPC Settings", onDrawSubMenu, Draw_HotendMPC_Menu); #endif #if ENABLED(PIDTEMPBED) @@ -3292,7 +3292,7 @@ void Draw_GetColor_Menu() { DWIN_Draw_Rectangle(1, *MenuData.P_Int, 20, 315, DWIN_WIDTH - 20, 335); } -#if BOTH(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS) +#if ALL(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS) void Draw_CaseLight_Menu() { checkkey = Menu; @@ -3312,7 +3312,7 @@ void Draw_GetColor_Menu() { checkkey = Menu; if (SET_MENU(LedControlMenu, MSG_LED_CONTROL, 10)) { BACK_ITEM(Draw_Control_Menu); - #if !BOTH(CASE_LIGHT_MENU, CASE_LIGHT_USE_NEOPIXEL) + #if !ALL(CASE_LIGHT_MENU, CASE_LIGHT_USE_NEOPIXEL) EDIT_ITEM(ICON_LedControl, MSG_LEDS, onDrawChkbMenu, SetLedStatus, &leds.lights_on); #endif #if HAS_COLOR_LEDS @@ -3594,7 +3594,7 @@ void Draw_Steps_Menu() { #endif -#if EITHER(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) +#if ANY(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) #if ENABLED(MPC_AUTOTUNE_MENU) void HotendMPC() { thermalManager.MPC_autotune(active_extruder); } diff --git a/Marlin/src/lcd/e3v2/proui/dwin.h b/Marlin/src/lcd/e3v2/proui/dwin.h index 0057a8639234f..2e967bc15f6f3 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.h +++ b/Marlin/src/lcd/e3v2/proui/dwin.h @@ -36,7 +36,7 @@ #include "../common/limits.h" #include "../../../libs/BL24CXX.h" -#if EITHER(BABYSTEPPING, HAS_BED_PROBE) +#if ANY(BABYSTEPPING, HAS_BED_PROBE) #define HAS_ZOFFSET_ITEM 1 #if !HAS_BED_PROBE #define JUST_BABYSTEP 1 @@ -75,7 +75,7 @@ enum processID : uint8_t { NothingToDo }; -#if EITHER(DWIN_PID_TUNE, MPC_AUTOTUNE) +#if ANY(DWIN_PID_TUNE, MPC_AUTOTUNE) enum tempcontrol_t : uint8_t { #if DWIN_PID_TUNE @@ -142,10 +142,10 @@ typedef struct { bool FullManualTramming = false; bool MediaAutoMount = ENABLED(HAS_SD_EXTENDER); - #if BOTH(INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) + #if ALL(INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) uint8_t z_after_homing = DEF_Z_AFTER_HOMING; #endif - #if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS) + #if ALL(LED_CONTROL_MENU, HAS_COLOR_LEDS) LEDColor Led_Color = Def_Leds_Color; #endif } HMI_data_t; @@ -225,7 +225,7 @@ void ParkHead(); #if HAS_ONESTEP_LEVELING void Trammingwizard(); #endif -#if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS) +#if ALL(LED_CONTROL_MENU, HAS_COLOR_LEDS) void ApplyLEDColor(); #endif #if ENABLED(AUTO_BED_LEVELING_UBL) @@ -333,7 +333,7 @@ void Draw_FilSet_Menu(); void Draw_PhySet_Menu(); void Draw_SelectColors_Menu(); void Draw_GetColor_Menu(); -#if BOTH(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS) +#if ALL(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS) void Draw_CaseLight_Menu(); #endif #if ENABLED(LED_CONTROL_MENU) @@ -354,7 +354,7 @@ void Draw_MaxAccel_Menu(); void Draw_MaxJerk_Menu(); #endif void Draw_Steps_Menu(); -#if EITHER(HAS_BED_PROBE, BABYSTEPPING) +#if ANY(HAS_BED_PROBE, BABYSTEPPING) void Draw_ZOffsetWiz_Menu(); #endif #if ENABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU) @@ -384,7 +384,7 @@ void Draw_Steps_Menu(); #endif // MPC -#if EITHER(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) +#if ANY(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) void Draw_HotendMPC_Menu(); #endif #if ENABLED(MPC_AUTOTUNE) diff --git a/Marlin/src/lcd/e3v2/proui/dwin_defines.h b/Marlin/src/lcd/e3v2/proui/dwin_defines.h index 164fd00fe6daf..6f4520e23bc0a 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_defines.h +++ b/Marlin/src/lcd/e3v2/proui/dwin_defines.h @@ -65,7 +65,7 @@ #define Def_Indicator_Color Color_White #define Def_Coordinate_Color Color_White #define Def_Button_Color RGB( 0, 23, 16) -#if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS) +#if ALL(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/endstop_diag.cpp b/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp index 7ec088e240c4f..860bad74f3f4c 100644 --- a/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp +++ b/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp @@ -29,7 +29,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if BOTH(DWIN_LCD_PROUI, HAS_ESDIAG) +#if ALL(DWIN_LCD_PROUI, HAS_ESDIAG) #include "endstop_diag.h" diff --git a/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp b/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp index f8bcda83530a1..6cf3e9e135f51 100644 --- a/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp +++ b/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp @@ -29,7 +29,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if BOTH(DWIN_LCD_PROUI, HAS_GCODE_PREVIEW) +#if ALL(DWIN_LCD_PROUI, HAS_GCODE_PREVIEW) #include "../../../core/types.h" #include "../../marlinui.h" diff --git a/Marlin/src/lcd/e3v2/proui/lockscreen.cpp b/Marlin/src/lcd/e3v2/proui/lockscreen.cpp index 85f35582b2683..abf67ad9aff4e 100644 --- a/Marlin/src/lcd/e3v2/proui/lockscreen.cpp +++ b/Marlin/src/lcd/e3v2/proui/lockscreen.cpp @@ -29,7 +29,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if BOTH(DWIN_LCD_PROUI, HAS_LOCKSCREEN) +#if ALL(DWIN_LCD_PROUI, HAS_LOCKSCREEN) #include "dwin_defines.h" #include "dwinui.h" diff --git a/Marlin/src/lcd/e3v2/proui/meshviewer.cpp b/Marlin/src/lcd/e3v2/proui/meshviewer.cpp index 69d21c044ce95..c0ca216c32a91 100644 --- a/Marlin/src/lcd/e3v2/proui/meshviewer.cpp +++ b/Marlin/src/lcd/e3v2/proui/meshviewer.cpp @@ -29,7 +29,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if BOTH(DWIN_LCD_PROUI, HAS_MESH) +#if ALL(DWIN_LCD_PROUI, HAS_MESH) #include "../../../core/types.h" #include "../../marlinui.h" diff --git a/Marlin/src/lcd/e3v2/proui/plot.cpp b/Marlin/src/lcd/e3v2/proui/plot.cpp index fddaf3963ae1b..627dc39223cf5 100644 --- a/Marlin/src/lcd/e3v2/proui/plot.cpp +++ b/Marlin/src/lcd/e3v2/proui/plot.cpp @@ -29,7 +29,7 @@ #include "../../../inc/MarlinConfig.h" -#if BOTH(DWIN_LCD_PROUI, SHOW_TUNING_GRAPH) +#if ALL(DWIN_LCD_PROUI, SHOW_TUNING_GRAPH) #include "plot.h" #include "../../../core/types.h" diff --git a/Marlin/src/lcd/e3v2/proui/printstats.cpp b/Marlin/src/lcd/e3v2/proui/printstats.cpp index 638cd3420809c..7f45fa71ef1be 100644 --- a/Marlin/src/lcd/e3v2/proui/printstats.cpp +++ b/Marlin/src/lcd/e3v2/proui/printstats.cpp @@ -29,7 +29,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if BOTH(DWIN_LCD_PROUI, PRINTCOUNTER) +#if ALL(DWIN_LCD_PROUI, PRINTCOUNTER) #include "printstats.h" diff --git a/Marlin/src/lcd/extui/anycubic/Tunes.cpp b/Marlin/src/lcd/extui/anycubic/Tunes.cpp index d1fb888d17a20..8a9e84f0001df 100644 --- a/Marlin/src/lcd/extui/anycubic/Tunes.cpp +++ b/Marlin/src/lcd/extui/anycubic/Tunes.cpp @@ -31,7 +31,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if EITHER(ANYCUBIC_LCD_CHIRON, ANYCUBIC_LCD_VYPER) +#if ANY(ANYCUBIC_LCD_CHIRON, ANYCUBIC_LCD_VYPER) #include "Tunes.h" #include "../../../libs/buzzer.h" 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 dca0f2e85da47..a560e5e9a0788 100644 --- a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp +++ b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp @@ -885,7 +885,7 @@ void AnycubicTFTClass::getCommandFromTFT() { } void AnycubicTFTClass::doSDCardStateCheck() { - #if BOTH(HAS_MEDIA, HAS_SD_DETECT) + #if ALL(HAS_MEDIA, 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/mks/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp index 16aeeab1a1428..4c1995cebc249 100644 --- a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp @@ -636,7 +636,7 @@ void DGUSScreenHandlerMKS::manualAssistLeveling(DGUS_VP_Variable &var, void *val #define mks_min(a, b) ((a) < (b)) ? (a) : (b) #define mks_max(a, b) ((a) > (b)) ? (a) : (b) void DGUSScreenHandlerMKS::tmcChangeConfig(DGUS_VP_Variable &var, void *val_ptr) { - #if EITHER(HAS_TRINAMIC_CONFIG, HAS_STEALTHCHOP) + #if ANY(HAS_TRINAMIC_CONFIG, HAS_STEALTHCHOP) const uint16_t tmc_val = BE16_P(val_ptr); #endif @@ -1099,7 +1099,7 @@ void DGUSScreenHandlerMKS::getManualFilamentSpeed(DGUS_VP_Variable &var, void *v } void DGUSScreenHandlerMKS::filamentLoadUnload(DGUS_VP_Variable &var, void *val_ptr, const int filamentDir) { - #if EITHER(HAS_MULTI_HOTEND, SINGLENOZZLE) + #if ANY(HAS_MULTI_HOTEND, SINGLENOZZLE) uint8_t swap_tool = 0; #else constexpr uint8_t swap_tool = 1; // T0 (or none at all) @@ -1120,7 +1120,7 @@ void DGUSScreenHandlerMKS::filamentLoadUnload(DGUS_VP_Variable &var, void *val_p if (thermalManager.tooColdToExtrude(0)) hotend_too_cold = 1; else { - #if EITHER(HAS_MULTI_HOTEND, SINGLENOZZLE) + #if ANY(HAS_MULTI_HOTEND, SINGLENOZZLE) swap_tool = 1; #endif } @@ -1135,7 +1135,7 @@ void DGUSScreenHandlerMKS::filamentLoadUnload(DGUS_VP_Variable &var, void *val_p break; } - #if BOTH(HAS_HOTEND, PREVENT_COLD_EXTRUSION) + #if ALL(HAS_HOTEND, PREVENT_COLD_EXTRUSION) if (hotend_too_cold) { if (thermalManager.targetTooColdToExtrude(hotend_too_cold - 1)) thermalManager.setTargetHotend(thermalManager.extrude_min_temp, hotend_too_cold - 1); sendInfoScreen(F("NOTICE"), nullptr, F("Please wait."), F("Nozzle heating!"), true, true, true, true); @@ -1147,7 +1147,7 @@ void DGUSScreenHandlerMKS::filamentLoadUnload(DGUS_VP_Variable &var, void *val_p if (swap_tool) { char buf[30]; snprintf_P(buf, 30 - #if EITHER(HAS_MULTI_HOTEND, SINGLENOZZLE) + #if ANY(HAS_MULTI_HOTEND, SINGLENOZZLE) , PSTR("M1002T%cE%dF%d"), char('0' + swap_tool - 1) #else , PSTR("M1002E%dF%d") @@ -1163,7 +1163,7 @@ void DGUSScreenHandlerMKS::filamentLoadUnload(DGUS_VP_Variable &var, void *val_p * within the G-code execution window for best concurrency. */ void GcodeSuite::M1002() { - #if EITHER(HAS_MULTI_HOTEND, SINGLENOZZLE) + #if ANY(HAS_MULTI_HOTEND, SINGLENOZZLE) { char buf[3]; sprintf_P(buf, PSTR("T%c"), char('0' + parser.intval('T'))); diff --git a/Marlin/src/lcd/extui/example/example.cpp b/Marlin/src/lcd/extui/example/example.cpp index b295434d842cf..e78e4b9679877 100644 --- a/Marlin/src/lcd/extui/example/example.cpp +++ b/Marlin/src/lcd/extui/example/example.cpp @@ -21,7 +21,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if BOTH(EXTUI_EXAMPLE, EXTENSIBLE_UI) +#if ALL(EXTUI_EXAMPLE, EXTENSIBLE_UI) #include "../ui_api.h" diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/leveling_menu.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/leveling_menu.cpp index be18c03483881..fa31ce1553324 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/leveling_menu.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/leveling_menu.cpp @@ -25,7 +25,7 @@ #if ENABLED(COCOA_LEVELING_MENU) -#if BOTH(HAS_BED_PROBE, BLTOUCH) +#if ALL(HAS_BED_PROBE, BLTOUCH) #include "../../../../feature/bltouch.h" #endif diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/main_menu.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/main_menu.cpp index ee299a7f64d62..2f231278f2d8d 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/main_menu.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/main_menu.cpp @@ -57,7 +57,7 @@ void MainMenu::onRedraw(draw_mode_t what) { .font(Theme::font_medium) .tag( 2).button(MOVE_XYZ_POS, GET_TEXT_F(MSG_XYZ_MOVE)) .tag( 3).button(TEMPERATURE_POS, GET_TEXT_F(MSG_TEMPERATURE)) - .enabled(BOTH(HAS_LEVELING, HAS_BED_PROBE)) + .enabled(ALL(HAS_LEVELING, HAS_BED_PROBE)) .tag( 4).button(ZPROBE_ZOFFSET_POS, GET_TEXT_F(MSG_ZPROBE_ZOFFSET)) .tag( 5).button(MOVE_E_POS, GET_TEXT_F(MSG_E_MOVE)) .tag( 6).button(SPEED_POS, GET_TEXT_F(MSG_PRINT_SPEED)) @@ -79,7 +79,7 @@ bool MainMenu::onTouchEnd(uint8_t tag) { case 1: SaveSettingsDialogBox::promptToSaveSettings(); break; case 2: GOTO_SCREEN(MoveXYZScreen); break; case 3: GOTO_SCREEN(TemperatureScreen); break; - #if BOTH(HAS_LEVELING, HAS_BED_PROBE) + #if ALL(HAS_LEVELING, HAS_BED_PROBE) case 4: GOTO_SCREEN(ZOffsetScreen); break; #endif case 5: GOTO_SCREEN(MoveEScreen); break; 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 662753a1547cc..a796c8edcf5f6 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 @@ -1208,7 +1208,7 @@ void CLCD::default_display_orientation() { + ENABLED(TOUCH_UI_INVERTED) * 1 ); cmd.execute(); - #elif EITHER(TOUCH_UI_PORTRAIT, TOUCH_UI_MIRRORED) + #elif ANY(TOUCH_UI_PORTRAIT, TOUCH_UI_MIRRORED) #error "PORTRAIT or MIRRORED orientation not supported on the FT800." #elif ENABLED(TOUCH_UI_INVERTED) mem_write_32(REG::ROTATE, 1); 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 6b2dc9eb4498c..a9f77a518ba09 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 @@ -305,14 +305,11 @@ #define __TERN(T,V...) ___TERN(_CAT(_NO,T),V) // Prepend '_NO' to get '_NOT_0' or '_NOT_1' #define ___TERN(P,V...) THIRD(P,V) // If first argument has a comma, A. Else B. - #define IF_ENABLED TERN_ #define IF_DISABLED(O,A) _TERN(_ENA_1(O),,A) #define ANY(V...) !DISABLED(V) - #define NONE(V...) DISABLED(V) - #define ALL(V...) ENABLED(V) - #define BOTH(V1,V2) ALL(V1,V2) - #define EITHER(V1,V2) ANY(V1,V2) + #define NONE DISABLED + #define ALL ENABLED // Remove compiler warning on an unused variable #ifndef UNUSED diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/font_size_t.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/font_size_t.cpp index 0e251f7bb1c78..b229154e82a4c 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/font_size_t.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/font_size_t.cpp @@ -21,7 +21,7 @@ #include "../ftdi_extended.h" -#if BOTH(FTDI_EXTENDED, TOUCH_UI_USE_UTF8) +#if ALL(FTDI_EXTENDED, TOUCH_UI_USE_UTF8) namespace FTDI { // Returns the height of a standard FTDI romfont diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/standard_char_set.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/standard_char_set.cpp index d12bf97119075..5171ee508aff4 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/standard_char_set.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/standard_char_set.cpp @@ -21,7 +21,7 @@ #include "../ftdi_extended.h" -#if BOTH(FTDI_EXTENDED, TOUCH_UI_USE_UTF8) +#if ALL(FTDI_EXTENDED, TOUCH_UI_USE_UTF8) constexpr static uint8_t std_font = 31; 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 6f189155f5de3..d7f4d31bdc12a 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 @@ -21,7 +21,7 @@ #include "../ftdi_extended.h" -#if BOTH(FTDI_EXTENDED, TOUCH_UI_USE_UTF8) +#if ALL(FTDI_EXTENDED, TOUCH_UI_USE_UTF8) using namespace FTDI; diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/about_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/about_screen.cpp index 43e5c333651a3..698f0d47b794f 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/about_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/about_screen.cpp @@ -76,7 +76,7 @@ void AboutScreen::onRedraw(draw_mode_t) { #endif , OPT_CENTER, font_xlarge ); - #if BOTH(TOUCH_UI_DEVELOPER_MENU, FTDI_DEVELOPER_MENU) + #if ALL(TOUCH_UI_DEVELOPER_MENU, FTDI_DEVELOPER_MENU) cmd.tag(3); #endif draw_text_box(cmd, FW_VERS_POS, @@ -91,7 +91,7 @@ void AboutScreen::onRedraw(draw_mode_t) { draw_text_box(cmd, LICENSE_POS, GET_TEXT_F(MSG_LICENSE), OPT_CENTER, font_tiny); cmd.font(font_medium); - #if BOTH(PRINTCOUNTER, FTDI_STATISTICS_SCREEN) + #if ALL(PRINTCOUNTER, FTDI_STATISTICS_SCREEN) cmd.colors(normal_btn) .tag(2).button(STATS_POS, GET_TEXT_F(MSG_INFO_STATS_MENU)); #endif @@ -102,10 +102,10 @@ void AboutScreen::onRedraw(draw_mode_t) { bool AboutScreen::onTouchEnd(uint8_t tag) { switch (tag) { case 1: GOTO_PREVIOUS(); break; - #if BOTH(PRINTCOUNTER, FTDI_STATISTICS_SCREEN) + #if ALL(PRINTCOUNTER, FTDI_STATISTICS_SCREEN) case 2: GOTO_SCREEN(StatisticsScreen); break; #endif - #if BOTH(TOUCH_UI_DEVELOPER_MENU, FTDI_DEVELOPER_MENU) + #if ALL(TOUCH_UI_DEVELOPER_MENU, FTDI_DEVELOPER_MENU) case 3: GOTO_SCREEN(DeveloperMenu); break; #endif default: return false; 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 8753b44e709b1..4745ff99dc552 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 @@ -37,7 +37,7 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) { } #if ENABLED(TOUCH_UI_PORTRAIT) - #if EITHER(HAS_MULTI_HOTEND, SENSORLESS_HOMING) + #if ANY(HAS_MULTI_HOTEND, SENSORLESS_HOMING) #define GRID_ROWS 9 #else #define GRID_ROWS 8 @@ -58,7 +58,7 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) { #define BACKLASH_POS BTN_POS(2,7), BTN_SIZE(1,1) #define OFFSETS_POS BTN_POS(1,8), BTN_SIZE(1,1) #define TMC_HOMING_THRS_POS BTN_POS(2,8), BTN_SIZE(1,1) - #if EITHER(HAS_MULTI_HOTEND, SENSORLESS_HOMING) + #if ANY(HAS_MULTI_HOTEND, SENSORLESS_HOMING) #define BACK_POS BTN_POS(1,9), BTN_SIZE(2,1) #else #define BACK_POS BTN_POS(1,8), BTN_SIZE(2,1) @@ -99,7 +99,7 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) { .tag(14).button(TMC_HOMING_THRS_POS, GET_TEXT_F(MSG_TMC_HOMING_THRS)) .enabled(ENABLED(HAS_MULTI_HOTEND)) .tag(4) .button(OFFSETS_POS, GET_TEXT_F(MSG_OFFSETS_MENU)) - .enabled(EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)) + .enabled(ANY(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)) .tag(11).button(FILAMENT_POS, GET_TEXT_F(MSG_FILAMENT)) .tag(12).button(ENDSTOPS_POS, GET_TEXT_F(MSG_LCD_ENDSTOPS)) .tag(15).button(DISPLAY_POS, GET_TEXT_F(MSG_DISPLAY_MENU)) @@ -133,7 +133,7 @@ bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) { #endif case 9: GOTO_SCREEN(InterfaceSettingsScreen); LockScreen::check_passcode(); break; case 10: GOTO_SCREEN(RestoreFailsafeDialogBox); LockScreen::check_passcode(); break; - #if EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR) + #if ANY(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR) case 11: GOTO_SCREEN(FilamentMenu); break; #endif case 12: GOTO_SCREEN(EndstopStatesScreen); break; diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/endstop_state_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/endstop_state_screen.cpp index eae83d070d48c..1d81649444e29 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/endstop_state_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/endstop_state_screen.cpp @@ -89,7 +89,7 @@ void EndstopStatesScreen::onRedraw(draw_mode_t) { #else PIN_DISABLED(1, 4, GET_TEXT_F(MSG_RUNOUT_1), FIL_RUNOUT) #endif - #if BOTH(HAS_MULTI_EXTRUDER, FILAMENT_RUNOUT_SENSOR) && PIN_EXISTS(FIL_RUNOUT2) + #if ALL(HAS_MULTI_EXTRUDER, FILAMENT_RUNOUT_SENSOR) && PIN_EXISTS(FIL_RUNOUT2) PIN_ENABLED (3, 4, GET_TEXT_F(MSG_RUNOUT_2), FIL_RUNOUT2, FIL_RUNOUT2_STATE) #else PIN_DISABLED(3, 4, GET_TEXT_F(MSG_RUNOUT_2), FIL_RUNOUT2) diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/leveling_menu.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/leveling_menu.cpp index 2fb9d18498c07..47540b0f55196 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/leveling_menu.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/leveling_menu.cpp @@ -25,7 +25,7 @@ #ifdef FTDI_LEVELING_MENU -#if BOTH(HAS_BED_PROBE,BLTOUCH) +#if ALL(HAS_BED_PROBE,BLTOUCH) #include "../../../../feature/bltouch.h" #endif @@ -81,7 +81,7 @@ void LevelingMenu::onRedraw(draw_mode_t what) { .text(BLTOUCH_TITLE_POS, GET_TEXT_F(MSG_BLTOUCH)) #endif .font(font_medium).colors(normal_btn) - .enabled(EITHER(Z_STEPPER_AUTO_ALIGN,MECHANICAL_GANTRY_CALIBRATION)) + .enabled(ANY(Z_STEPPER_AUTO_ALIGN,MECHANICAL_GANTRY_CALIBRATION)) .tag(2).button(LEVEL_AXIS_POS, GET_TEXT_F(MSG_LEVEL_X_AXIS)) .enabled(ENABLED(HAS_BED_PROBE)) .tag(3).button(PROBE_BED_POS, GET_TEXT_F(MSG_PROBE_BED)) @@ -103,7 +103,7 @@ void LevelingMenu::onRedraw(draw_mode_t what) { bool LevelingMenu::onTouchEnd(uint8_t tag) { switch (tag) { case 1: GOTO_PREVIOUS(); break; - #if EITHER(Z_STEPPER_AUTO_ALIGN,MECHANICAL_GANTRY_CALIBRATION) + #if ANY(Z_STEPPER_AUTO_ALIGN,MECHANICAL_GANTRY_CALIBRATION) case 2: SpinnerDialogBox::enqueueAndWait(F("G34")); break; #endif #if HAS_BED_PROBE diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/screens.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/screens.h index e2df29cb833d8..c200931eec51c 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/screens.h +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/screens.h @@ -74,7 +74,7 @@ enum { #if ENABLED(CASE_LIGHT_ENABLE) CASE_LIGHT_SCREEN_CACHE, #endif - #if EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR) + #if ANY(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR) FILAMENT_MENU_CACHE, #endif #if ENABLED(LIN_ADVANCE) @@ -192,7 +192,7 @@ enum { #include "case_light_screen.h" #endif -#if EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR) +#if ANY(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR) #include "filament_menu.h" #endif 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 0370c44174786..259f6d5b89ef2 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 @@ -74,11 +74,11 @@ void TuneMenu::onRedraw(draw_mode_t what) { .tag(2).button(TEMPERATURE_POS, GET_TEXT_F(MSG_TEMPERATURE)) .enabled(!sdOrHostPrinting || sdOrHostPaused) .tag(3).button(FIL_CHANGE_POS, GET_TEXT_F(MSG_FILAMENTCHANGE)) - .enabled(EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)) + .enabled(ANY(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)) .tag(9).button(FILAMENT_POS, GET_TEXT_F(MSG_FILAMENT)) #if ENABLED(BABYSTEPPING) && HAS_MULTI_HOTEND .tag(4).button(NUDGE_NOZ_POS, GET_TEXT_F(MSG_NUDGE_NOZZLE)) - #elif BOTH(HAS_LEVELING, HAS_BED_PROBE) + #elif ALL(HAS_LEVELING, HAS_BED_PROBE) .tag(4).button(NUDGE_NOZ_POS, GET_TEXT_F(MSG_ZPROBE_ZOFFSET)) #endif .tag(5).button(SPEED_POS, GET_TEXT_F(MSG_PRINT_SPEED)) @@ -105,7 +105,7 @@ bool TuneMenu::onTouchEnd(uint8_t tag) { case 4: #if ENABLED(BABYSTEPPING) && HAS_MULTI_HOTEND GOTO_SCREEN(NudgeNozzleScreen); - #elif BOTH(HAS_LEVELING, HAS_BED_PROBE) + #elif ALL(HAS_LEVELING, HAS_BED_PROBE) GOTO_SCREEN(ZOffsetScreen); #endif break; @@ -117,7 +117,7 @@ bool TuneMenu::onTouchEnd(uint8_t tag) { current_screen.forget(); PUSH_SCREEN(StatusScreen); break; - #if EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR) + #if ANY(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR) case 9: GOTO_SCREEN(FilamentMenu); break; #endif #if ENABLED(CASE_LIGHT_ENABLE) diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/theme/colors.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/theme/colors.h index 70c2be4ec23fa..0e145e39f2080 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/theme/colors.h +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/theme/colors.h @@ -37,7 +37,7 @@ namespace Theme { #else // Use linear accent colors - #if EITHER(TOUCH_UI_ROYAL_THEME, TOUCH_UI_FROZEN_THEME) + #if ANY(TOUCH_UI_ROYAL_THEME, TOUCH_UI_FROZEN_THEME) // Dark blue accent colors constexpr int accent_hue = 216; constexpr float accent_sat = 0.7; @@ -88,7 +88,7 @@ namespace Theme { constexpr uint32_t bed_mesh_lines_rgb = 0xFFFFFF; constexpr uint32_t bed_mesh_shadow_rgb = 0x444444; - #elif EITHER(TOUCH_UI_COCOA_THEME, TOUCH_UI_FROZEN_THEME) + #elif ANY(TOUCH_UI_COCOA_THEME, TOUCH_UI_FROZEN_THEME) constexpr uint32_t theme_darkest = accent_color_1; constexpr uint32_t theme_dark = accent_color_4; diff --git a/Marlin/src/lcd/extui/mks_ui/draw_auto_level_offset_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_auto_level_offset_settings.cpp index fd14585e70286..5a5d457b080bd 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_auto_level_offset_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_auto_level_offset_settings.cpp @@ -22,7 +22,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if BOTH(HAS_TFT_LVGL_UI, HAS_BED_PROBE) +#if ALL(HAS_TFT_LVGL_UI, HAS_BED_PROBE) #include "draw_ui.h" #include diff --git a/Marlin/src/lcd/extui/mks_ui/draw_cloud_bind.cpp b/Marlin/src/lcd/extui/mks_ui/draw_cloud_bind.cpp index 1dae0ebe22512..0798db1cc9f40 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_cloud_bind.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_cloud_bind.cpp @@ -22,7 +22,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if BOTH(HAS_TFT_LVGL_UI, MKS_WIFI_MODULE) +#if ALL(HAS_TFT_LVGL_UI, MKS_WIFI_MODULE) #include "lv_conf.h" #include "draw_ui.h" diff --git a/Marlin/src/lcd/extui/mks_ui/draw_jerk_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_jerk_settings.cpp index a070cae15f4ec..5b22103e8f2d2 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_jerk_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_jerk_settings.cpp @@ -22,7 +22,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if BOTH(HAS_TFT_LVGL_UI, HAS_CLASSIC_JERK) +#if ALL(HAS_TFT_LVGL_UI, HAS_CLASSIC_JERK) #include "draw_ui.h" #include diff --git a/Marlin/src/lcd/extui/mks_ui/draw_media_select.cpp b/Marlin/src/lcd/extui/mks_ui/draw_media_select.cpp index 81c82dc02dfa5..085a008acde9f 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_media_select.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_media_select.cpp @@ -21,7 +21,7 @@ */ #include "../../../inc/MarlinConfigPre.h" -#if BOTH(HAS_TFT_LVGL_UI, MULTI_VOLUME) +#if ALL(HAS_TFT_LVGL_UI, MULTI_VOLUME) #include "draw_ui.h" #include diff --git a/Marlin/src/lcd/extui/mks_ui/draw_pause_message.cpp b/Marlin/src/lcd/extui/mks_ui/draw_pause_message.cpp index e5f6a5963a6bc..b753a578012ba 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_pause_message.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_pause_message.cpp @@ -22,7 +22,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if BOTH(HAS_TFT_LVGL_UI, ADVANCED_PAUSE_FEATURE) +#if ALL(HAS_TFT_LVGL_UI, ADVANCED_PAUSE_FEATURE) #include "draw_ui.h" #include diff --git a/Marlin/src/lcd/extui/mks_ui/draw_tmc_current_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_tmc_current_settings.cpp index 9ec8f1501a0b0..b243c88705a33 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_tmc_current_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_tmc_current_settings.cpp @@ -22,7 +22,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if BOTH(HAS_TFT_LVGL_UI, HAS_TRINAMIC_CONFIG) +#if ALL(HAS_TFT_LVGL_UI, HAS_TRINAMIC_CONFIG) #include "draw_ui.h" #include diff --git a/Marlin/src/lcd/extui/mks_ui/draw_tmc_step_mode_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_tmc_step_mode_settings.cpp index 990cdda7e63b4..d09c823b59797 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_tmc_step_mode_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_tmc_step_mode_settings.cpp @@ -22,7 +22,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if BOTH(HAS_TFT_LVGL_UI, HAS_STEALTHCHOP) +#if ALL(HAS_TFT_LVGL_UI, HAS_STEALTHCHOP) #include "draw_ui.h" #include diff --git a/Marlin/src/lcd/extui/mks_ui/draw_touch_calibration.cpp b/Marlin/src/lcd/extui/mks_ui/draw_touch_calibration.cpp index a9a25db11822f..74902a30ddc83 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_touch_calibration.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_touch_calibration.cpp @@ -22,7 +22,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if BOTH(HAS_TFT_LVGL_UI, TOUCH_SCREEN_CALIBRATION) +#if ALL(HAS_TFT_LVGL_UI, TOUCH_SCREEN_CALIBRATION) #include "draw_ui.h" #include "draw_touch_calibration.h" diff --git a/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp b/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp index 102109a1363e1..708ad77fca8c9 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp @@ -1377,7 +1377,7 @@ void LV_TASK_HANDLER() { if (TERN1(USE_SPI_DMA_TC, !get_lcd_dma_lock())) lv_task_handler(); - #if BOTH(MKS_TEST, HAS_MEDIA) + #if ALL(MKS_TEST, HAS_MEDIA) if (mks_test_flag == 0x1E) mks_hardware_test(); #endif 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 69e547a68ccb6..9d16c9dff2610 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 @@ -22,7 +22,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if BOTH(HAS_TFT_LVGL_UI, PROBE_OFFSET_WIZARD) +#if ALL(HAS_TFT_LVGL_UI, PROBE_OFFSET_WIZARD) #include "draw_ui.h" #include diff --git a/Marlin/src/lcd/extui/mks_ui/irq_overrid.cpp b/Marlin/src/lcd/extui/mks_ui/irq_overrid.cpp index aca1db0039ba0..b2615ac24b24c 100644 --- a/Marlin/src/lcd/extui/mks_ui/irq_overrid.cpp +++ b/Marlin/src/lcd/extui/mks_ui/irq_overrid.cpp @@ -23,7 +23,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if BOTH(HAS_TFT_LVGL_UI, MKS_WIFI_MODULE) +#if ALL(HAS_TFT_LVGL_UI, MKS_WIFI_MODULE) #include "tft_lvgl_configuration.h" diff --git a/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp b/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp index 6576290496735..53f31b1c4042d 100644 --- a/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp +++ b/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp @@ -681,7 +681,7 @@ void disp_assets_update_progress(FSTR_P const fmsg) { #endif } -#if BOTH(MKS_TEST, HAS_MEDIA) +#if ALL(MKS_TEST, HAS_MEDIA) uint8_t mks_test_flag = 0; const char *MKSTestPath = "MKS_TEST"; void mks_test_get() { diff --git a/Marlin/src/lcd/extui/mks_ui/mks_hardware.h b/Marlin/src/lcd/extui/mks_ui/mks_hardware.h index 6a2574e3b0ce3..f73f4e6459101 100644 --- a/Marlin/src/lcd/extui/mks_ui/mks_hardware.h +++ b/Marlin/src/lcd/extui/mks_ui/mks_hardware.h @@ -26,7 +26,7 @@ #include // Functions for MKS_TEST -#if BOTH(MKS_TEST, HAS_MEDIA) +#if ALL(MKS_TEST, HAS_MEDIA) void mks_hardware_test(); void mks_test_get(); void mks_gpio_test(); 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 71f4166ca89ea..5dfb02bfaca46 100644 --- a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp +++ b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp @@ -51,7 +51,7 @@ XPT2046 touch; #include "../../../module/servo.h" #endif -#if EITHER(PROBE_TARE, HAS_Z_SERVO_PROBE) +#if ANY(PROBE_TARE, HAS_Z_SERVO_PROBE) #include "../../../module/probe.h" #endif @@ -249,7 +249,7 @@ void tft_lvgl_init() { if (ready) lv_draw_ready_print(); - #if BOTH(MKS_TEST, HAS_MEDIA) + #if ALL(MKS_TEST, HAS_MEDIA) if (mks_test_flag == 0x1E) mks_gpio_test(); #endif } diff --git a/Marlin/src/lcd/extui/mks_ui/wifiSerial_STM32.cpp b/Marlin/src/lcd/extui/mks_ui/wifiSerial_STM32.cpp index 9d7f5e20325f7..cb5b7f0b68c88 100644 --- a/Marlin/src/lcd/extui/mks_ui/wifiSerial_STM32.cpp +++ b/Marlin/src/lcd/extui/mks_ui/wifiSerial_STM32.cpp @@ -25,7 +25,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if BOTH(HAS_TFT_LVGL_UI, MKS_WIFI_MODULE) +#if ALL(HAS_TFT_LVGL_UI, MKS_WIFI_MODULE) #include "tft_lvgl_configuration.h" diff --git a/Marlin/src/lcd/extui/mks_ui/wifiSerial_STM32F1.cpp b/Marlin/src/lcd/extui/mks_ui/wifiSerial_STM32F1.cpp index 654fca6cb3347..92fd139dfa5dc 100644 --- a/Marlin/src/lcd/extui/mks_ui/wifiSerial_STM32F1.cpp +++ b/Marlin/src/lcd/extui/mks_ui/wifiSerial_STM32F1.cpp @@ -23,7 +23,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if BOTH(HAS_TFT_LVGL_UI, MKS_WIFI_MODULE) +#if ALL(HAS_TFT_LVGL_UI, MKS_WIFI_MODULE) #include "tft_lvgl_configuration.h" diff --git a/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp b/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp index bf399f70aad4c..f3967a3ec38af 100644 --- a/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp +++ b/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp @@ -22,7 +22,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if BOTH(HAS_TFT_LVGL_UI, MKS_WIFI_MODULE) +#if ALL(HAS_TFT_LVGL_UI, MKS_WIFI_MODULE) #include "draw_ui.h" #include "wifi_module.h" diff --git a/Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp b/Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp index eaf41526e5d2d..2d4d19e7a23e5 100644 --- a/Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp +++ b/Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp @@ -22,7 +22,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if BOTH(HAS_TFT_LVGL_UI, MKS_WIFI_MODULE) +#if ALL(HAS_TFT_LVGL_UI, MKS_WIFI_MODULE) #include "draw_ui.h" #include "wifi_module.h" diff --git a/Marlin/src/lcd/extui/nextion/nextion_tft.cpp b/Marlin/src/lcd/extui/nextion/nextion_tft.cpp index 15c384808f89d..e5e3a74be2c53 100644 --- a/Marlin/src/lcd/extui/nextion/nextion_tft.cpp +++ b/Marlin/src/lcd/extui/nextion/nextion_tft.cpp @@ -294,7 +294,7 @@ void NextionTFT::panelInfo(uint8_t req) { break; case 26: // TMC Hybrid Threshold Speed - #if 0 && BOTH(HAS_TRINAMIC_CONFIG, HYBRID_THRESHOLD) + #if 0 && ALL(HAS_TRINAMIC_CONFIG, HYBRID_THRESHOLD) #define SEND_TRINAMIC_THRS(A, B) SEND_VALasTXT(A, getAxisPWMthrs(B)) #else #define SEND_TRINAMIC_THRS(A, B) SEND_NA(A) @@ -463,7 +463,7 @@ void NextionTFT::panelInfo(uint8_t req) { #else #define SEND_PID_INFO_0(A, B) SEND_NA(A) #endif - #if BOTH(PIDTEMP, HAS_MULTI_EXTRUDER) + #if ALL(PIDTEMP, HAS_MULTI_EXTRUDER) #define SEND_PID_INFO_1(A, B) SEND_VALasTXT(A, getPID_K##B(E1)) #else #define SEND_PID_INFO_1(A, B) SEND_NA(A) diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index 1d917df7cd62a..7f216107289a0 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -933,7 +933,7 @@ namespace ExtUI { } void moveToMeshPoint(const xy_uint8_t &pos, const_float_t z) { - #if EITHER(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL) + #if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL) REMEMBER(fr, feedrate_mm_s); const float x_target = MESH_MIN_X + pos.x * (MESH_X_DIST), y_target = MESH_MIN_Y + pos.y * (MESH_Y_DIST); diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 1c4bbe5fa93bc..a812dff556a79 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -24,7 +24,7 @@ #include "../MarlinCore.h" // for printingIsPaused -#if LED_POWEROFF_TIMEOUT > 0 || BOTH(HAS_WIRED_LCD, PRINTER_EVENT_LEDS) || (defined(LCD_BACKLIGHT_TIMEOUT_MINS) && defined(NEOPIXEL_BKGD_INDEX_FIRST)) +#if LED_POWEROFF_TIMEOUT > 0 || ALL(HAS_WIRED_LCD, PRINTER_EVENT_LEDS) || (defined(LCD_BACKLIGHT_TIMEOUT_MINS) && defined(NEOPIXEL_BKGD_INDEX_FIRST)) #include "../feature/leds/leds.h" #endif @@ -32,7 +32,7 @@ #include "../feature/host_actions.h" #endif -#if BOTH(BROWSE_MEDIA_ON_INSERT, PASSWORD_ON_SD_PRINT_MENU) +#if ALL(BROWSE_MEDIA_ON_INSERT, PASSWORD_ON_SD_PRINT_MENU) #include "../feature/password/password.h" #endif @@ -68,7 +68,7 @@ MarlinUI ui; constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; #if HAS_STATUS_MESSAGE - #if ENABLED(STATUS_MESSAGE_SCROLLING) && EITHER(HAS_WIRED_LCD, DWIN_LCD_PROUI) + #if ENABLED(STATUS_MESSAGE_SCROLLING) && ANY(HAS_WIRED_LCD, DWIN_LCD_PROUI) uint8_t MarlinUI::status_scroll_offset; // = 0 #endif char MarlinUI::status_message[MAX_MESSAGE_LENGTH + 1]; @@ -154,7 +154,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; } #endif -#if EITHER(HAS_MARLINUI_MENU, EXTENSIBLE_UI) +#if ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI) bool MarlinUI::lcd_clicked; #endif @@ -270,7 +270,7 @@ void MarlinUI::init() { #endif // HAS_SHIFT_ENCODER - #if BOTH(HAS_ENCODER_ACTION, HAS_SLOW_BUTTONS) + #if ALL(HAS_ENCODER_ACTION, HAS_SLOW_BUTTONS) slow_buttons = 0; #endif @@ -339,7 +339,7 @@ void MarlinUI::init() { uint8_t MarlinUI::lcd_status_update_delay = 1; // First update one loop delayed - #if BOTH(FILAMENT_LCD_DISPLAY, HAS_MEDIA) + #if ALL(FILAMENT_LCD_DISPLAY, HAS_MEDIA) millis_t MarlinUI::next_filament_display; // = 0 #endif @@ -402,7 +402,7 @@ void MarlinUI::init() { } #endif - #if EITHER(REVERSE_MENU_DIRECTION, REVERSE_SELECT_DIRECTION) + #if ANY(REVERSE_MENU_DIRECTION, REVERSE_SELECT_DIRECTION) int8_t MarlinUI::encoderDirection = ENCODERBASE; #endif @@ -411,7 +411,7 @@ void MarlinUI::init() { uint8_t MarlinUI::repeat_delay; #endif - #if EITHER(AUTO_BED_LEVELING_UBL, G26_MESH_VALIDATION) + #if ANY(AUTO_BED_LEVELING_UBL, G26_MESH_VALIDATION) bool MarlinUI::external_control; // = false @@ -574,7 +574,7 @@ void MarlinUI::init() { #endif if (homed) { - #if EITHER(DELTA, Z_HOME_TO_MAX) + #if ANY(DELTA, Z_HOME_TO_MAX) if (RRK(EN_KEYPAD_F2)) _reprapworld_keypad_move(Z_AXIS, 1); #endif if (RRK(EN_KEYPAD_F3)) _reprapworld_keypad_move(Z_AXIS, -1); @@ -670,7 +670,7 @@ void MarlinUI::init() { #if HAS_MARLINUI_MENU if (use_click()) { - #if BOTH(FILAMENT_LCD_DISPLAY, HAS_MEDIA) + #if ALL(FILAMENT_LCD_DISPLAY, HAS_MEDIA) pause_filament_display(); #endif goto_screen(menu_main); @@ -702,7 +702,7 @@ void MarlinUI::init() { if (old_frm != new_frm) { feedrate_percentage = new_frm; encoderPosition = 0; - #if BOTH(HAS_SOUND, BEEP_ON_FEEDRATE_CHANGE) + #if ALL(HAS_SOUND, BEEP_ON_FEEDRATE_CHANGE) static millis_t next_beep; #ifndef GOT_MS const millis_t ms = millis(); @@ -1046,7 +1046,7 @@ void MarlinUI::init() { if (encoderPastThreshold || lcd_clicked) { if (encoderPastThreshold && TERN1(IS_TFTGLCD_PANEL, !external_control)) { - #if BOTH(HAS_MARLINUI_MENU, ENCODER_RATE_MULTIPLIER) + #if ALL(HAS_MARLINUI_MENU, ENCODER_RATE_MULTIPLIER) int32_t encoderMultiplier = 1; @@ -1112,7 +1112,7 @@ void MarlinUI::init() { refresh(LCDVIEW_REDRAW_NOW); } - #if BOTH(HAS_MARLINUI_MENU, SCROLL_LONG_FILENAMES) + #if ALL(HAS_MARLINUI_MENU, SCROLL_LONG_FILENAMES) // If scrolling of long file names is enabled and we are in the sd card menu, // cause a refresh to occur until all the text has scrolled into view. if (currentScreen == menu_media && !lcd_status_update_delay--) { @@ -1353,7 +1353,7 @@ void MarlinUI::init() { #endif // UP || DOWN || LEFT || RIGHT buttons = (newbutton | TERN0(HAS_SLOW_BUTTONS, slow_buttons) - #if BOTH(HAS_TOUCH_BUTTONS, HAS_ENCODER_ACTION) + #if ALL(HAS_TOUCH_BUTTONS, HAS_ENCODER_ACTION) | (touch_buttons & TERN(HAS_ENCODER_WHEEL, ~(EN_A | EN_B), 0xFF)) #endif ); @@ -1413,7 +1413,7 @@ void MarlinUI::init() { case 3: ENCODER_SPIN(2, 1); break; case 1: ENCODER_SPIN(3, 0); break; } - #if BOTH(HAS_MARLINUI_MENU, AUTO_BED_LEVELING_UBL) + #if ALL(HAS_MARLINUI_MENU, AUTO_BED_LEVELING_UBL) external_encoder(); #endif lastEncoderBits = enc; @@ -1587,7 +1587,7 @@ void MarlinUI::init() { #if HAS_WIRED_LCD - #if BASIC_PROGRESS_BAR || BOTH(FILAMENT_LCD_DISPLAY, HAS_MEDIA) + #if BASIC_PROGRESS_BAR || ALL(FILAMENT_LCD_DISPLAY, HAS_MEDIA) const millis_t ms = millis(); #endif @@ -1598,13 +1598,13 @@ void MarlinUI::init() { #endif #endif - #if BOTH(FILAMENT_LCD_DISPLAY, HAS_MEDIA) + #if ALL(FILAMENT_LCD_DISPLAY, HAS_MEDIA) pause_filament_display(ms); // Show status message for 5s #endif #endif - #if ENABLED(STATUS_MESSAGE_SCROLLING) && EITHER(HAS_WIRED_LCD, DWIN_LCD_PROUI) + #if ENABLED(STATUS_MESSAGE_SCROLLING) && ANY(HAS_WIRED_LCD, DWIN_LCD_PROUI) status_scroll_offset = 0; #endif @@ -1670,7 +1670,7 @@ void MarlinUI::init() { TERN_(DWIN_LCD_PROUI, HMI_flag.abort_flag = true); } - #if BOTH(HAS_MARLINUI_MENU, PSU_CONTROL) + #if ALL(HAS_MARLINUI_MENU, PSU_CONTROL) void MarlinUI::poweroff() { queue.inject(F("M81" TERN_(POWER_OFF_WAIT_FOR_COOLDOWN, "S"))); @@ -1848,7 +1848,7 @@ void MarlinUI::init() { #endif } - #if EITHER(BABYSTEP_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY) + #if ANY(BABYSTEP_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY) void MarlinUI::zoffset_overlay(const_float_t zvalue) { // Determine whether the user is raising or lowering the nozzle. static int8_t dir; @@ -1863,7 +1863,7 @@ void MarlinUI::init() { #endif -#if BOTH(EXTENSIBLE_UI, ADVANCED_PAUSE_FEATURE) +#if ALL(EXTENSIBLE_UI, ADVANCED_PAUSE_FEATURE) void MarlinUI::pause_show_message( const PauseMessage message, diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index ccdbd64322809..7819afe97869a 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -88,7 +88,7 @@ typedef bool (*statusResetFunc_t)(); #endif // HAS_WIRED_LCD -#if EITHER(HAS_WIRED_LCD, DWIN_CREALITY_LCD_JYERSUI) +#if ANY(HAS_WIRED_LCD, DWIN_CREALITY_LCD_JYERSUI) #define LCD_WITH_BLINK 1 #define LCD_UPDATE_INTERVAL TERN(HAS_TOUCH_BUTTONS, 50, 100) #endif @@ -246,7 +246,7 @@ class MarlinUI { // LCD implementations static void clear_lcd(); - #if BOTH(HAS_MARLINUI_MENU, TOUCH_SCREEN_CALIBRATION) + #if ALL(HAS_MARLINUI_MENU, TOUCH_SCREEN_CALIBRATION) static void check_touch_calibration() { if (touch_calibration.need_calibration()) currentScreen = touch_calibration_screen; } @@ -313,7 +313,7 @@ class MarlinUI { static void set_progress_done() { progress_override = (PROGRESS_MASK + 1U) + 100U * (PROGRESS_SCALE); } static void progress_reset() { if (progress_override & (PROGRESS_MASK + 1U)) set_progress(0); } #endif - #if EITHER(SHOW_REMAINING_TIME, SET_PROGRESS_MANUALLY) + #if ANY(SHOW_REMAINING_TIME, SET_PROGRESS_MANUALLY) static uint32_t _calculated_remaining_time() { const duration_t elapsed = print_job_timer.duration(); const progress_t progress = _get_progress(); @@ -361,7 +361,7 @@ class MarlinUI { #if HAS_STATUS_MESSAGE - #if EITHER(HAS_WIRED_LCD, DWIN_LCD_PROUI) + #if ANY(HAS_WIRED_LCD, DWIN_LCD_PROUI) #if ENABLED(STATUS_MESSAGE_SCROLLING) #define MAX_MESSAGE_LENGTH _MAX(LONG_FILENAME_LENGTH, MAX_LANG_CHARSIZE * 2 * (LCD_WIDTH)) #else @@ -412,7 +412,7 @@ class MarlinUI { static void resume_print(); static void flow_fault(); - #if BOTH(HAS_MARLINUI_MENU, PSU_CONTROL) + #if ALL(HAS_MARLINUI_MENU, PSU_CONTROL) static void poweroff(); #endif @@ -471,7 +471,7 @@ class MarlinUI { FORCE_INLINE static void refresh_contrast() { set_contrast(contrast); } #endif - #if BOTH(FILAMENT_LCD_DISPLAY, HAS_MEDIA) + #if ALL(FILAMENT_LCD_DISPLAY, HAS_MEDIA) static millis_t next_filament_display; static void pause_filament_display(const millis_t ms=millis()) { next_filament_display = ms + 5000UL; } #endif @@ -510,7 +510,7 @@ class MarlinUI { static bool did_first_redraw; #endif - #if EITHER(BABYSTEP_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY) + #if ANY(BABYSTEP_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY) static void zoffset_overlay(const int8_t dir); static void zoffset_overlay(const_float_t zvalue); #endif @@ -534,7 +534,7 @@ class MarlinUI { #endif #if HAS_MEDIA - #if BOTH(SCROLL_LONG_FILENAMES, HAS_MARLINUI_MENU) + #if ALL(SCROLL_LONG_FILENAMES, HAS_MARLINUI_MENU) #define MARLINUI_SCROLL_NAME 1 #endif #if MARLINUI_SCROLL_NAME @@ -646,7 +646,7 @@ class MarlinUI { #endif - #if EITHER(HAS_MARLINUI_MENU, EXTENSIBLE_UI) + #if ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI) static bool lcd_clicked; static bool use_click() { const bool click = lcd_clicked; @@ -684,7 +684,7 @@ class MarlinUI { // // Special handling if a move is underway // - #if ANY(DELTA_CALIBRATION_MENU, DELTA_AUTO_CALIBRATION, PROBE_OFFSET_WIZARD, X_AXIS_TWIST_COMPENSATION) || (ENABLED(LCD_BED_LEVELING) && EITHER(PROBE_MANUALLY, MESH_BED_LEVELING)) + #if ANY(DELTA_CALIBRATION_MENU, DELTA_AUTO_CALIBRATION, PROBE_OFFSET_WIZARD, X_AXIS_TWIST_COMPENSATION) || (ENABLED(LCD_BED_LEVELING) && ANY(PROBE_MANUALLY, MESH_BED_LEVELING)) #define LCD_HAS_WAIT_FOR_MOVE 1 static bool wait_for_move; #else @@ -694,7 +694,7 @@ class MarlinUI { // // Block interaction while under external control // - #if HAS_MARLINUI_MENU && EITHER(AUTO_BED_LEVELING_UBL, G26_MESH_VALIDATION) + #if HAS_MARLINUI_MENU && ANY(AUTO_BED_LEVELING_UBL, G26_MESH_VALIDATION) static bool external_control; FORCE_INLINE static void capture() { external_control = true; } FORCE_INLINE static void release() { external_control = false; } @@ -737,7 +737,7 @@ class MarlinUI { static bool hw_button_pressed() { return BUTTON_CLICK(); } #endif - #if EITHER(AUTO_BED_LEVELING_UBL, G26_MESH_VALIDATION) + #if ANY(AUTO_BED_LEVELING_UBL, G26_MESH_VALIDATION) static void wait_for_release(); #endif @@ -745,14 +745,14 @@ class MarlinUI { #define ENCODERBASE (TERN(REVERSE_ENCODER_DIRECTION, -1, +1)) - #if EITHER(REVERSE_MENU_DIRECTION, REVERSE_SELECT_DIRECTION) + #if ANY(REVERSE_MENU_DIRECTION, REVERSE_SELECT_DIRECTION) static int8_t encoderDirection; #else static constexpr int8_t encoderDirection = ENCODERBASE; #endif FORCE_INLINE static void encoder_direction_normal() { - #if EITHER(REVERSE_MENU_DIRECTION, REVERSE_SELECT_DIRECTION) + #if ANY(REVERSE_MENU_DIRECTION, REVERSE_SELECT_DIRECTION) encoderDirection = ENCODERBASE; #endif } diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp index 911a35d482bd7..a9574dd4d9afa 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -176,7 +176,7 @@ void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, co TERN_(SET_PROGRESS_PERCENT, progress_reset()); - #if BOTH(DOUBLECLICK_FOR_Z_BABYSTEPPING, BABYSTEPPING) + #if ALL(DOUBLECLICK_FOR_Z_BABYSTEPPING, BABYSTEPPING) static millis_t doubleclick_expire_ms = 0; // Going to menu_main from status screen? Remember first click time. // Going back to status screen within a very short time? Go to Z babystepping. diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 0be23be71a84d..370ea56402ffb 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -268,7 +268,7 @@ void menu_backlash(); } #endif -#if BOTH(AUTOTEMP, HAS_TEMP_HOTEND) || ANY(PID_AUTOTUNE_MENU, PID_EDIT_MENU, MPC_AUTOTUNE_MENU, MPC_EDIT_MENU) +#if ALL(AUTOTEMP, HAS_TEMP_HOTEND) || ANY(PID_AUTOTUNE_MENU, PID_EDIT_MENU, MPC_AUTOTUNE_MENU, MPC_EDIT_MENU) #define SHOW_MENU_ADVANCED_TEMPERATURE 1 #endif @@ -277,7 +277,7 @@ void menu_backlash(); // #if SHOW_MENU_ADVANCED_TEMPERATURE - #if BOTH(MPC_EDIT_MENU, MPC_INCLUDE_FAN) + #if ALL(MPC_EDIT_MENU, MPC_INCLUDE_FAN) #define MPC_EDIT_DEFS(N) editable.decimal = thermalManager.temp_hotend[N].fanCoefficient() #else #define MPC_EDIT_DEFS(...) @@ -294,7 +294,7 @@ void menu_backlash(); // // Autotemp, Min, Max, Fact // - #if BOTH(AUTOTEMP, HAS_TEMP_HOTEND) + #if ALL(AUTOTEMP, HAS_TEMP_HOTEND) EDIT_ITEM(int3, MSG_MIN, &planner.autotemp.min, 0, thermalManager.hotend_max_target(0)); EDIT_ITEM(int3, MSG_MAX, &planner.autotemp.max, 0, thermalManager.hotend_max_target(0)); EDIT_ITEM(float42_52, MSG_FACTOR, &planner.autotemp.factor, 0, 10); @@ -309,7 +309,7 @@ void menu_backlash(); // PID-P E5, PID-I E5, PID-D E5, PID-C E5, PID Autotune E5 // - #if BOTH(PIDTEMP, PID_EDIT_MENU) + #if ALL(PIDTEMP, PID_EDIT_MENU) #define __PID_HOTEND_MENU_ITEMS(N) \ raw_Kp = thermalManager.temp_hotend[N].pid.p(); \ raw_Ki = thermalManager.temp_hotend[N].pid.i(); \ @@ -342,7 +342,7 @@ void menu_backlash(); #endif - #if ENABLED(PID_EDIT_MENU) && EITHER(PIDTEMPBED, PIDTEMPCHAMBER) + #if ENABLED(PID_EDIT_MENU) && ANY(PIDTEMPBED, PIDTEMPCHAMBER) #define _PID_EDIT_ITEMS_TMPL(N,T) \ raw_Kp = T.pid.p(); \ raw_Ki = T.pid.i(); \ diff --git a/Marlin/src/lcd/menu/menu_backlash.cpp b/Marlin/src/lcd/menu/menu_backlash.cpp index 1f3856918f434..a5f1f3746bf0b 100644 --- a/Marlin/src/lcd/menu/menu_backlash.cpp +++ b/Marlin/src/lcd/menu/menu_backlash.cpp @@ -26,7 +26,7 @@ #include "../../inc/MarlinConfigPre.h" -#if BOTH(HAS_MARLINUI_MENU, BACKLASH_GCODE) +#if ALL(HAS_MARLINUI_MENU, BACKLASH_GCODE) #include "menu_item.h" @@ -39,7 +39,7 @@ void menu_backlash() { editable.uint8 = backlash.get_correction_uint8(); EDIT_ITEM_FAST(percent, MSG_BACKLASH_CORRECTION, &editable.uint8, backlash.all_off, backlash.all_on, []{ backlash.set_correction_uint8(editable.uint8); }); - #if DISABLED(CORE_BACKLASH) || EITHER(MARKFORGED_XY, MARKFORGED_YX) + #if DISABLED(CORE_BACKLASH) || ANY(MARKFORGED_XY, MARKFORGED_YX) #define _CAN_CALI AXIS_CAN_CALIBRATE #else #define _CAN_CALI(A) true diff --git a/Marlin/src/lcd/menu/menu_bed_leveling.cpp b/Marlin/src/lcd/menu/menu_bed_leveling.cpp index dcf77cb3eb3a0..efc05aabde487 100644 --- a/Marlin/src/lcd/menu/menu_bed_leveling.cpp +++ b/Marlin/src/lcd/menu/menu_bed_leveling.cpp @@ -43,7 +43,7 @@ #endif #endif -#if EITHER(PROBE_MANUALLY, MESH_BED_LEVELING) +#if ANY(PROBE_MANUALLY, MESH_BED_LEVELING) #include "../../module/motion.h" #include "../../gcode/queue.h" @@ -169,7 +169,7 @@ if (ui.should_draw()) { 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) + #if ALL(TOUCH_SCREEN, HAS_GRAPHICAL_TFT) touch.add_control(CLICK, 0, 0, TFT_WIDTH, TFT_HEIGHT); #endif } @@ -249,7 +249,7 @@ void menu_bed_leveling() { #endif // Level Bed - #if EITHER(PROBE_MANUALLY, MESH_BED_LEVELING) + #if ANY(PROBE_MANUALLY, MESH_BED_LEVELING) // Manual leveling uses a guided procedure SUBMENU(MSG_LEVEL_BED, _lcd_level_bed_continue); #else diff --git a/Marlin/src/lcd/menu/menu_bed_tramming.cpp b/Marlin/src/lcd/menu/menu_bed_tramming.cpp index 8129a347c3141..b6b3e7212485e 100644 --- a/Marlin/src/lcd/menu/menu_bed_tramming.cpp +++ b/Marlin/src/lcd/menu/menu_bed_tramming.cpp @@ -26,7 +26,7 @@ #include "../../inc/MarlinConfigPre.h" -#if BOTH(HAS_MARLINUI_MENU, LCD_BED_TRAMMING) +#if ALL(HAS_MARLINUI_MENU, LCD_BED_TRAMMING) #include "menu_item.h" #include "../../module/motion.h" @@ -43,7 +43,7 @@ #define BED_TRAMMING_HEIGHT 0.0 #endif -#if BOTH(HAS_STOWABLE_PROBE, BED_TRAMMING_USE_PROBE) && DISABLED(BLTOUCH) +#if ALL(HAS_STOWABLE_PROBE, BED_TRAMMING_USE_PROBE) && DISABLED(BLTOUCH) #define NEEDS_PROBE_DEPLOY 1 #endif @@ -152,7 +152,7 @@ static void _lcd_goto_next_corner() { } float z = BED_TRAMMING_Z_HOP; - #if BOTH(BED_TRAMMING_USE_PROBE, BLTOUCH) + #if ALL(BED_TRAMMING_USE_PROBE, BLTOUCH) z += bltouch.z_extra_clearance(); #endif line_to_z(z); @@ -187,7 +187,7 @@ static void _lcd_goto_next_corner() { if (PAGE_CONTAINS(y - (MENU_FONT_HEIGHT), y)) { SETCURSOR(TERN(TFT_COLOR_UI, 2, 0), cy); lcd_put_u8str(GET_TEXT_F(MSG_BED_TRAMMING_GOOD_POINTS)); - IF_ENABLED(TFT_COLOR_UI, lcd_moveto(12, cy)); + TERN_(TFT_COLOR_UI, lcd_moveto(12, cy)); lcd_put_u8str(GOOD_POINTS_TO_STR(good_points)); lcd_put_u8str(F("/")); lcd_put_u8str(GOOD_POINTS_TO_STR(nr_edge_points)); @@ -200,7 +200,7 @@ static void _lcd_goto_next_corner() { if (PAGE_CONTAINS(y - (MENU_FONT_HEIGHT), y)) { SETCURSOR(TERN(TFT_COLOR_UI, 2, 0), cy); lcd_put_u8str(GET_TEXT_F(MSG_BED_TRAMMING_LAST_Z)); - IF_ENABLED(TFT_COLOR_UI, lcd_moveto(12, 2)); + TERN_(TFT_COLOR_UI, lcd_moveto(12, 2)); lcd_put_u8str(LAST_Z_TO_STR(last_z)); } } diff --git a/Marlin/src/lcd/menu/menu_cancelobject.cpp b/Marlin/src/lcd/menu/menu_cancelobject.cpp index b2784bcd41b6a..bcbd90ee3a60f 100644 --- a/Marlin/src/lcd/menu/menu_cancelobject.cpp +++ b/Marlin/src/lcd/menu/menu_cancelobject.cpp @@ -26,7 +26,7 @@ #include "../../inc/MarlinConfigPre.h" -#if BOTH(HAS_MARLINUI_MENU, CANCEL_OBJECTS) +#if ALL(HAS_MARLINUI_MENU, CANCEL_OBJECTS) #include "menu_item.h" #include "menu_addon.h" diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp index 0611bda84b325..0622eb98d4e48 100644 --- a/Marlin/src/lcd/menu/menu_configuration.cpp +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -59,7 +59,7 @@ #include "../../libs/buzzer.h" #endif -#if EITHER(LCD_PROGRESS_BAR_TEST, LCD_ENDSTOP_TEST) +#if ANY(LCD_PROGRESS_BAR_TEST, LCD_ENDSTOP_TEST) #include "../lcdprint.h" #define HAS_DEBUG_MENU 1 #endif @@ -68,7 +68,7 @@ #include "../../core/debug_out.h" void menu_advanced_settings(); -#if EITHER(DELTA_CALIBRATION_MENU, DELTA_AUTO_CALIBRATION) +#if ANY(DELTA_CALIBRATION_MENU, DELTA_AUTO_CALIBRATION) void menu_delta_calibrate(); #endif @@ -592,7 +592,7 @@ void menu_configuration() { #endif if (!busy) { - #if EITHER(DELTA_CALIBRATION_MENU, DELTA_AUTO_CALIBRATION) + #if ANY(DELTA_CALIBRATION_MENU, DELTA_AUTO_CALIBRATION) SUBMENU(MSG_DELTA_CALIBRATE, menu_delta_calibrate); #endif diff --git a/Marlin/src/lcd/menu/menu_delta_calibrate.cpp b/Marlin/src/lcd/menu/menu_delta_calibrate.cpp index fe0be0439853d..c7da12a61ee6a 100644 --- a/Marlin/src/lcd/menu/menu_delta_calibrate.cpp +++ b/Marlin/src/lcd/menu/menu_delta_calibrate.cpp @@ -26,7 +26,7 @@ #include "../../inc/MarlinConfigPre.h" -#if HAS_MARLINUI_MENU && EITHER(DELTA_CALIBRATION_MENU, DELTA_AUTO_CALIBRATION) +#if HAS_MARLINUI_MENU && ANY(DELTA_CALIBRATION_MENU, DELTA_AUTO_CALIBRATION) #include "menu_item.h" #include "../../module/delta.h" diff --git a/Marlin/src/lcd/menu/menu_filament.cpp b/Marlin/src/lcd/menu/menu_filament.cpp index 6fdcc2b48818e..bdcd20fae3c62 100644 --- a/Marlin/src/lcd/menu/menu_filament.cpp +++ b/Marlin/src/lcd/menu/menu_filament.cpp @@ -26,7 +26,7 @@ #include "../../inc/MarlinConfigPre.h" -#if BOTH(HAS_MARLINUI_MENU, ADVANCED_PAUSE_FEATURE) +#if ALL(HAS_MARLINUI_MENU, ADVANCED_PAUSE_FEATURE) #include "menu_item.h" #include "../../module/temperature.h" diff --git a/Marlin/src/lcd/menu/menu_info.cpp b/Marlin/src/lcd/menu/menu_info.cpp index e2dd6c647527c..59ed52e6f17b0 100644 --- a/Marlin/src/lcd/menu/menu_info.cpp +++ b/Marlin/src/lcd/menu/menu_info.cpp @@ -26,7 +26,7 @@ #include "../../inc/MarlinConfigPre.h" -#if BOTH(HAS_MARLINUI_MENU, LCD_INFO_MENU) +#if ALL(HAS_MARLINUI_MENU, LCD_INFO_MENU) #include "menu_item.h" diff --git a/Marlin/src/lcd/menu/menu_job_recovery.cpp b/Marlin/src/lcd/menu/menu_job_recovery.cpp index 6329c5839786c..b2276aeb0cdd1 100644 --- a/Marlin/src/lcd/menu/menu_job_recovery.cpp +++ b/Marlin/src/lcd/menu/menu_job_recovery.cpp @@ -26,7 +26,7 @@ #include "../../inc/MarlinConfigPre.h" -#if BOTH(HAS_MARLINUI_MENU, POWER_LOSS_RECOVERY) +#if ALL(HAS_MARLINUI_MENU, POWER_LOSS_RECOVERY) #include "menu_item.h" #include "../../gcode/queue.h" diff --git a/Marlin/src/lcd/menu/menu_led.cpp b/Marlin/src/lcd/menu/menu_led.cpp index dea5ecceeb010..c7390b98cb207 100644 --- a/Marlin/src/lcd/menu/menu_led.cpp +++ b/Marlin/src/lcd/menu/menu_led.cpp @@ -26,7 +26,7 @@ #include "../../inc/MarlinConfigPre.h" -#if HAS_MARLINUI_MENU && EITHER(LED_CONTROL_MENU, CASE_LIGHT_MENU) +#if HAS_MARLINUI_MENU && ANY(LED_CONTROL_MENU, CASE_LIGHT_MENU) #include "menu_item.h" diff --git a/Marlin/src/lcd/menu/menu_main.cpp b/Marlin/src/lcd/menu/menu_main.cpp index a202f624f7fc1..4ccdb60bf14c3 100644 --- a/Marlin/src/lcd/menu/menu_main.cpp +++ b/Marlin/src/lcd/menu/menu_main.cpp @@ -43,7 +43,7 @@ #include "game/game.h" #endif -#if EITHER(HAS_MEDIA, HOST_PROMPT_SUPPORT) || defined(ACTION_ON_CANCEL) +#if ANY(HAS_MEDIA, HOST_PROMPT_SUPPORT) || defined(ACTION_ON_CANCEL) #define MACHINE_CAN_STOP 1 #endif #if ANY(HAS_MEDIA, HOST_PROMPT_SUPPORT, PARK_HEAD_ON_PAUSE) || defined(ACTION_ON_PAUSE) @@ -88,7 +88,7 @@ void menu_configuration(); void menu_info(); #endif -#if EITHER(LED_CONTROL_MENU, CASE_LIGHT_MENU) +#if ANY(LED_CONTROL_MENU, CASE_LIGHT_MENU) void menu_led(); #endif @@ -273,7 +273,7 @@ void menu_main() { #endif } else { - #if BOTH(HAS_MEDIA, MEDIA_MENU_AT_TOP) + #if ALL(HAS_MEDIA, MEDIA_MENU_AT_TOP) // BEGIN MEDIA MENU #if ENABLED(MENU_ADDAUTOSTART) ACTION_ITEM(MSG_RUN_AUTO_FILES, card.autofile_begin); // Run Auto Files @@ -326,7 +326,7 @@ void menu_main() { SUBMENU(MSG_MOTION, menu_motion); } - #if BOTH(ADVANCED_PAUSE_FEATURE, DISABLE_ENCODER) + #if ALL(ADVANCED_PAUSE_FEATURE, DISABLE_ENCODER) FILAMENT_CHANGE_ITEM(); #endif @@ -366,7 +366,7 @@ void menu_main() { SUBMENU(MSG_INFO_MENU, menu_info); #endif - #if EITHER(LED_CONTROL_MENU, CASE_LIGHT_MENU) + #if ANY(LED_CONTROL_MENU, CASE_LIGHT_MENU) SUBMENU(MSG_LEDS, menu_led); #endif diff --git a/Marlin/src/lcd/menu/menu_media.cpp b/Marlin/src/lcd/menu/menu_media.cpp index 795ac2052b414..26f7a0517d316 100644 --- a/Marlin/src/lcd/menu/menu_media.cpp +++ b/Marlin/src/lcd/menu/menu_media.cpp @@ -26,7 +26,7 @@ #include "../../inc/MarlinConfigPre.h" -#if BOTH(HAS_MARLINUI_MENU, HAS_MEDIA) +#if ALL(HAS_MARLINUI_MENU, HAS_MEDIA) #include "menu_item.h" #include "../../sd/cardreader.h" diff --git a/Marlin/src/lcd/menu/menu_mixer.cpp b/Marlin/src/lcd/menu/menu_mixer.cpp index 478792479cc1d..b3be5e6336fd4 100644 --- a/Marlin/src/lcd/menu/menu_mixer.cpp +++ b/Marlin/src/lcd/menu/menu_mixer.cpp @@ -26,7 +26,7 @@ #include "../../inc/MarlinConfigPre.h" -#if BOTH(HAS_MARLINUI_MENU, MIXING_EXTRUDER) +#if ALL(HAS_MARLINUI_MENU, MIXING_EXTRUDER) #include "menu_item.h" #include "menu_addon.h" diff --git a/Marlin/src/lcd/menu/menu_mmu2.cpp b/Marlin/src/lcd/menu/menu_mmu2.cpp index ca3627ce10028..c9d163357bbd9 100644 --- a/Marlin/src/lcd/menu/menu_mmu2.cpp +++ b/Marlin/src/lcd/menu/menu_mmu2.cpp @@ -22,7 +22,7 @@ #include "../../inc/MarlinConfig.h" -#if BOTH(HAS_MARLINUI_MENU, MMU2_MENUS) +#if ALL(HAS_MARLINUI_MENU, MMU2_MENUS) #include "../../MarlinCore.h" #include "../../feature/mmu/mmu2.h" diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index bab03db606273..67fcbdd8511e2 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -119,7 +119,7 @@ void lcd_move_axis(const AxisEnum axis) { #endif // E_MANUAL -#if EITHER(PROBE_OFFSET_WIZARD, X_AXIS_TWIST_COMPENSATION) +#if ANY(PROBE_OFFSET_WIZARD, X_AXIS_TWIST_COMPENSATION) void _goto_manual_move_z(const_float_t scale) { ui.manual_move.menu_scale = scale; @@ -207,7 +207,7 @@ void menu_move() { START_MENU(); BACK_ITEM(MSG_MOTION); - #if BOTH(HAS_SOFTWARE_ENDSTOPS, SOFT_ENDSTOPS_MENU_ITEM) + #if ALL(HAS_SOFTWARE_ENDSTOPS, SOFT_ENDSTOPS_MENU_ITEM) EDIT_ITEM(bool, MSG_LCD_SOFT_ENDSTOPS, &soft_endstop._enabled); #endif @@ -530,7 +530,7 @@ void menu_motion() { // // Auto Z-Align // - #if EITHER(Z_STEPPER_AUTO_ALIGN, MECHANICAL_GANTRY_CALIBRATION) + #if ANY(Z_STEPPER_AUTO_ALIGN, MECHANICAL_GANTRY_CALIBRATION) GCODES_ITEM(MSG_AUTO_Z_ALIGN, F("G34")); #endif diff --git a/Marlin/src/lcd/menu/menu_password.cpp b/Marlin/src/lcd/menu/menu_password.cpp index b50194d60dc8c..6ca4202f6c270 100644 --- a/Marlin/src/lcd/menu/menu_password.cpp +++ b/Marlin/src/lcd/menu/menu_password.cpp @@ -26,7 +26,7 @@ #include "../../inc/MarlinConfigPre.h" -#if BOTH(HAS_MARLINUI_MENU, PASSWORD_FEATURE) +#if ALL(HAS_MARLINUI_MENU, PASSWORD_FEATURE) #include "../../feature/password/password.h" diff --git a/Marlin/src/lcd/menu/menu_temperature.cpp b/Marlin/src/lcd/menu/menu_temperature.cpp index c534597690765..82b358623fc21 100644 --- a/Marlin/src/lcd/menu/menu_temperature.cpp +++ b/Marlin/src/lcd/menu/menu_temperature.cpp @@ -35,7 +35,7 @@ #include "../../module/motion.h" #endif -#if EITHER(HAS_COOLER, LASER_COOLANT_FLOW_METER) +#if ANY(HAS_COOLER, LASER_COOLANT_FLOW_METER) #include "../../feature/cooler.h" #endif diff --git a/Marlin/src/lcd/menu/menu_touch_screen.cpp b/Marlin/src/lcd/menu/menu_touch_screen.cpp index 130308dadffab..93380cb0e04a3 100644 --- a/Marlin/src/lcd/menu/menu_touch_screen.cpp +++ b/Marlin/src/lcd/menu/menu_touch_screen.cpp @@ -22,7 +22,7 @@ #include "../../inc/MarlinConfigPre.h" -#if BOTH(HAS_MARLINUI_MENU, TOUCH_SCREEN_CALIBRATION) +#if ALL(HAS_MARLINUI_MENU, TOUCH_SCREEN_CALIBRATION) #include "menu_item.h" #include "../marlinui.h" diff --git a/Marlin/src/lcd/menu/menu_tramming_wizard.cpp b/Marlin/src/lcd/menu/menu_tramming_wizard.cpp index 8fb251c23862f..e0f88ea1bb859 100644 --- a/Marlin/src/lcd/menu/menu_tramming_wizard.cpp +++ b/Marlin/src/lcd/menu/menu_tramming_wizard.cpp @@ -26,7 +26,7 @@ #include "../../inc/MarlinConfigPre.h" -#if BOTH(HAS_MARLINUI_MENU, ASSISTED_TRAMMING_WIZARD) +#if ALL(HAS_MARLINUI_MENU, ASSISTED_TRAMMING_WIZARD) #include "menu_item.h" diff --git a/Marlin/src/lcd/menu/menu_tune.cpp b/Marlin/src/lcd/menu/menu_tune.cpp index 081b9f58a02d5..5247c714c6621 100644 --- a/Marlin/src/lcd/menu/menu_tune.cpp +++ b/Marlin/src/lcd/menu/menu_tune.cpp @@ -119,7 +119,7 @@ void menu_tune() { // // Manual bed leveling, Bed Z: // - #if BOTH(MESH_BED_LEVELING, LCD_BED_LEVELING) + #if ALL(MESH_BED_LEVELING, LCD_BED_LEVELING) EDIT_ITEM(float43, MSG_MESH_Z_OFFSET, &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 d6f42faa5558d..c8fd33d26df0b 100644 --- a/Marlin/src/lcd/menu/menu_ubl.cpp +++ b/Marlin/src/lcd/menu/menu_ubl.cpp @@ -26,7 +26,7 @@ #include "../../inc/MarlinConfigPre.h" -#if BOTH(HAS_MARLINUI_MENU, AUTO_BED_LEVELING_UBL) +#if ALL(HAS_MARLINUI_MENU, AUTO_BED_LEVELING_UBL) #include "menu_item.h" #include "../../gcode/gcode.h" diff --git a/Marlin/src/lcd/menu/menu_x_twist.cpp b/Marlin/src/lcd/menu/menu_x_twist.cpp index 86ef3be7b999c..5339e8e6e5159 100644 --- a/Marlin/src/lcd/menu/menu_x_twist.cpp +++ b/Marlin/src/lcd/menu/menu_x_twist.cpp @@ -170,7 +170,7 @@ void xatc_wizard_homing_done() { 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) + #if ALL(TOUCH_SCREEN, HAS_GRAPHICAL_TFT) touch.add_control(CLICK, 0, 0, TFT_WIDTH, TFT_HEIGHT); #endif } diff --git a/Marlin/src/lcd/tft/ui_1024x600.cpp b/Marlin/src/lcd/tft/ui_1024x600.cpp index 460f3a345b552..e43ccf74500a1 100644 --- a/Marlin/src/lcd/tft/ui_1024x600.cpp +++ b/Marlin/src/lcd/tft/ui_1024x600.cpp @@ -36,7 +36,7 @@ #include "../../module/planner.h" #include "../../module/motion.h" -#if DISABLED(LCD_PROGRESS_BAR) && BOTH(FILAMENT_LCD_DISPLAY, HAS_MEDIA) +#if DISABLED(LCD_PROGRESS_BAR) && ALL(FILAMENT_LCD_DISPLAY, HAS_MEDIA) #include "../../feature/filwidth.h" #include "../../gcode/parser.h" #endif @@ -627,7 +627,7 @@ struct { 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, HAS_BEEPER) + #if ALL(HAS_MARLINUI_MENU, HAS_BEEPER) for (int8_t i = 5; i--;) { buzzer.tick(); delay(2); } #elif HAS_MARLINUI_MENU delay(10); @@ -837,7 +837,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { } #endif -#if BOTH(HAS_BED_PROBE, TOUCH_SCREEN) +#if ALL(HAS_BED_PROBE, TOUCH_SCREEN) static void z_select() { motionAxisState.z_selection *= -1; quick_feedback(); @@ -936,7 +936,7 @@ void MarlinUI::move_axis_screen() { motionAxisState.zTypePos.x = x; motionAxisState.zTypePos.y = y; TERN_(HAS_Z_AXIS, drawCurZSelection()); - #if BOTH(HAS_BED_PROBE, TOUCH_SCREEN) + #if ALL(HAS_BED_PROBE, TOUCH_SCREEN) if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select); #endif diff --git a/Marlin/src/lcd/tft/ui_320x240.cpp b/Marlin/src/lcd/tft/ui_320x240.cpp index c2918711f47b9..0d145f10eb9d8 100644 --- a/Marlin/src/lcd/tft/ui_320x240.cpp +++ b/Marlin/src/lcd/tft/ui_320x240.cpp @@ -36,7 +36,7 @@ #include "../../module/planner.h" #include "../../module/motion.h" -#if DISABLED(LCD_PROGRESS_BAR) && BOTH(FILAMENT_LCD_DISPLAY, HAS_MEDIA) +#if DISABLED(LCD_PROGRESS_BAR) && ALL(FILAMENT_LCD_DISPLAY, HAS_MEDIA) #include "../../feature/filwidth.h" #include "../../gcode/parser.h" #endif @@ -708,7 +708,7 @@ struct { 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, HAS_BEEPER) + #if ALL(HAS_MARLINUI_MENU, HAS_BEEPER) for (int8_t i = 5; i--;) { buzzer.tick(); delay(2); } #elif HAS_MARLINUI_MENU delay(10); @@ -1029,7 +1029,7 @@ void MarlinUI::move_axis_screen() { drawBtn(zplus_x, y, "X+", (intptr_t)x_plus, imgRight, X_BTN_COLOR, !busy); - #if BOTH(HAS_BED_PROBE, TOUCH_SCREEN) + #if ALL(HAS_BED_PROBE, TOUCH_SCREEN) if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select); #endif @@ -1129,7 +1129,7 @@ void MarlinUI::move_axis_screen() { motionAxisState.zTypePos.x = x; motionAxisState.zTypePos.y = y; TERN_(HAS_Z_AXIS, drawCurZSelection()); - #if BOTH(HAS_BED_PROBE, TOUCH_SCREEN) + #if ALL(HAS_BED_PROBE, TOUCH_SCREEN) if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select); #endif diff --git a/Marlin/src/lcd/tft/ui_480x320.cpp b/Marlin/src/lcd/tft/ui_480x320.cpp index e1ddfe5e1ab11..75ec50adc284d 100644 --- a/Marlin/src/lcd/tft/ui_480x320.cpp +++ b/Marlin/src/lcd/tft/ui_480x320.cpp @@ -36,7 +36,7 @@ #include "../../module/planner.h" #include "../../module/motion.h" -#if DISABLED(LCD_PROGRESS_BAR) && BOTH(FILAMENT_LCD_DISPLAY, HAS_MEDIA) +#if DISABLED(LCD_PROGRESS_BAR) && ALL(FILAMENT_LCD_DISPLAY, HAS_MEDIA) #include "../../feature/filwidth.h" #include "../../gcode/parser.h" #endif @@ -627,7 +627,7 @@ struct { 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, HAS_BEEPER) + #if ALL(HAS_MARLINUI_MENU, HAS_BEEPER) for (int8_t i = 5; i--;) { buzzer.tick(); delay(2); } #elif HAS_MARLINUI_MENU delay(10); @@ -837,7 +837,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { } #endif // TOUCH_SCREEN -#if BOTH(HAS_BED_PROBE, TOUCH_SCREEN) +#if ALL(HAS_BED_PROBE, TOUCH_SCREEN) static void z_select() { motionAxisState.z_selection *= -1; quick_feedback(); @@ -940,7 +940,7 @@ void MarlinUI::move_axis_screen() { motionAxisState.zTypePos.x = x; motionAxisState.zTypePos.y = y; TERN_(HAS_Z_AXIS, drawCurZSelection()); - #if BOTH(HAS_BED_PROBE, TOUCH_SCREEN) + #if ALL(HAS_BED_PROBE, TOUCH_SCREEN) if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select); #endif diff --git a/Marlin/src/libs/nozzle.cpp b/Marlin/src/libs/nozzle.cpp index e675c53cb1060..58c097e3167e1 100644 --- a/Marlin/src/libs/nozzle.cpp +++ b/Marlin/src/libs/nozzle.cpp @@ -22,7 +22,7 @@ #include "../inc/MarlinConfig.h" -#if EITHER(NOZZLE_CLEAN_FEATURE, NOZZLE_PARK_FEATURE) +#if ANY(NOZZLE_CLEAN_FEATURE, NOZZLE_PARK_FEATURE) #include "nozzle.h" @@ -170,7 +170,7 @@ Nozzle nozzle; xyz_pos_t middle[HOTENDS] = NOZZLE_CLEAN_CIRCLE_MIDDLE; #endif - const uint8_t arrPos = EITHER(SINGLENOZZLE, MIXING_EXTRUDER) ? 0 : active_extruder; + const uint8_t arrPos = ANY(SINGLENOZZLE, MIXING_EXTRUDER) ? 0 : active_extruder; switch (pattern) { #if DISABLED(NOZZLE_CLEAN_PATTERN_LINE) diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index a22c4f03817ba..f73d0f1e6b42f 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -31,7 +31,7 @@ #include "temperature.h" #include "../lcd/marlinui.h" -#define DEBUG_OUT BOTH(USE_SENSORLESS, DEBUG_LEVELING_FEATURE) +#define DEBUG_OUT ALL(USE_SENSORLESS, DEBUG_LEVELING_FEATURE) #include "../core/debug_out.h" #if ENABLED(ENDSTOP_INTERRUPTS_FEATURE) @@ -1136,11 +1136,11 @@ void Endstops::update() { void Endstops::clear_endstop_state() { TERN_(X_SPI_SENSORLESS, CBI(live_state, X_ENDSTOP)); - #if BOTH(X_SPI_SENSORLESS, X_DUAL_ENDSTOPS) + #if ALL(X_SPI_SENSORLESS, X_DUAL_ENDSTOPS) CBI(live_state, X2_ENDSTOP); #endif TERN_(Y_SPI_SENSORLESS, CBI(live_state, Y_ENDSTOP)); - #if BOTH(Y_SPI_SENSORLESS, Y_DUAL_ENDSTOPS) + #if ALL(Y_SPI_SENSORLESS, Y_DUAL_ENDSTOPS) CBI(live_state, Y2_ENDSTOP); #endif TERN_(Z_SPI_SENSORLESS, CBI(live_state, Z_ENDSTOP)); diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index e6df20a99843e..d7b6d76fae8d1 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -257,7 +257,7 @@ void report_current_position_projected() { AutoReporter position_auto_reporter; #endif -#if EITHER(FULL_REPORT_TO_HOST_FEATURE, REALTIME_REPORTING_COMMANDS) +#if ANY(FULL_REPORT_TO_HOST_FEATURE, REALTIME_REPORTING_COMMANDS) M_StateEnum M_State_grbl = M_INIT; @@ -941,7 +941,7 @@ void restore_feedrate_and_scaling() { if (TERN0(DELTA, !all_axes_homed())) return; - #if BOTH(HAS_HOTEND_OFFSET, DELTA) + #if ALL(HAS_HOTEND_OFFSET, DELTA) // The effector center position will be the target minus the hotend offset. const xy_pos_t offs = hotend_offset[active_extruder]; #elif ENABLED(POLARGRAPH) @@ -1232,7 +1232,7 @@ float get_move_distance(const xyze_pos_t &diff OPTARG(HAS_ROTATIONAL_AXES, bool // Minimum number of seconds to move the given distance const float seconds = cartesian_mm / ( - #if BOTH(HAS_ROTATIONAL_AXES, INCH_MODE_SUPPORT) + #if ALL(HAS_ROTATIONAL_AXES, INCH_MODE_SUPPORT) cartes_move ? scaled_fr_mm_s : LINEAR_UNIT(scaled_fr_mm_s) #else scaled_fr_mm_s @@ -1542,7 +1542,7 @@ float get_move_distance(const xyze_pos_t &diff OPTARG(HAS_ROTATIONAL_AXES, bool void prepare_line_to_destination() { apply_motion_limits(destination); - #if EITHER(PREVENT_COLD_EXTRUSION, PREVENT_LENGTHY_EXTRUDE) + #if ANY(PREVENT_COLD_EXTRUSION, PREVENT_LENGTHY_EXTRUDE) if (!DEBUGGING(DRYRUN) && destination.e != current_position.e) { bool ignore_e = thermalManager.tooColdToExtrude(active_extruder); @@ -1873,12 +1873,12 @@ void prepare_line_to_destination() { if (is_home_dir) { if (TERN0(HOMING_Z_WITH_PROBE, axis == Z_AXIS)) { - #if BOTH(HAS_HEATED_BED, WAIT_FOR_BED_HEATER) + #if ALL(HAS_HEATED_BED, WAIT_FOR_BED_HEATER) // Wait for bed to heat back up between probing points thermalManager.wait_for_bed_heating(); #endif - #if BOTH(HAS_HOTEND, WAIT_FOR_HOTEND) + #if ALL(HAS_HOTEND, WAIT_FOR_HOTEND) // Wait for the hotend to heat back up between probing points thermalManager.wait_for_hotend_heating(active_extruder); #endif @@ -1895,7 +1895,7 @@ void prepare_line_to_destination() { #endif } - #if EITHER(MORGAN_SCARA, MP_SCARA) + #if ANY(MORGAN_SCARA, MP_SCARA) // Tell the planner the axis is at 0 current_position[axis] = 0; sync_plan_position(); @@ -2093,11 +2093,11 @@ void prepare_line_to_destination() { void homeaxis(const AxisEnum axis) { - #if EITHER(MORGAN_SCARA, MP_SCARA) + #if ANY(MORGAN_SCARA, MP_SCARA) // Only Z homing (with probe) is permitted if (axis != Z_AXIS) { BUZZ(100, 880); return; } #else - #define _CAN_HOME(A) (axis == _AXIS(A) && (EITHER(A##_SPI_SENSORLESS, HAS_##A##_ENDSTOP) || TERN0(HOMING_Z_WITH_PROBE, _AXIS(A) == Z_AXIS))) + #define _CAN_HOME(A) (axis == _AXIS(A) && (ANY(A##_SPI_SENSORLESS, HAS_##A##_ENDSTOP) || TERN0(HOMING_Z_WITH_PROBE, _AXIS(A) == Z_AXIS))) #define _ANDCANT(N) && !_CAN_HOME(N) if (true MAIN_AXIS_MAP(_ANDCANT)) return; #endif @@ -2173,7 +2173,7 @@ void prepare_line_to_destination() { // If a second homing move is configured... if (bump) { - #if BOTH(HOMING_Z_WITH_PROBE, BLTOUCH) + #if ALL(HOMING_Z_WITH_PROBE, BLTOUCH) if (axis == Z_AXIS && !bltouch.high_speed_mode) bltouch.stow(); // Intermediate STOW (in LOW SPEED MODE) #endif @@ -2195,7 +2195,7 @@ void prepare_line_to_destination() { } #endif - #if BOTH(HOMING_Z_WITH_PROBE, BLTOUCH) + #if ALL(HOMING_Z_WITH_PROBE, BLTOUCH) if (axis == Z_AXIS && !bltouch.high_speed_mode && bltouch.deploy()) return; // Intermediate DEPLOY (in LOW SPEED MODE) #endif @@ -2206,7 +2206,7 @@ void prepare_line_to_destination() { do_homing_move(axis, rebump, get_homing_bump_feedrate(axis), true); } - #if BOTH(HOMING_Z_WITH_PROBE, BLTOUCH) + #if ALL(HOMING_Z_WITH_PROBE, BLTOUCH) if (axis == Z_AXIS) bltouch.stow(); // The final STOW #endif @@ -2443,7 +2443,7 @@ void set_axis_is_at_home(const AxisEnum axis) { } #endif - #if EITHER(MORGAN_SCARA, AXEL_TPARA) + #if ANY(MORGAN_SCARA, AXEL_TPARA) scara_set_axis_is_at_home(axis); #elif ENABLED(DELTA) current_position[axis] = (axis == Z_AXIS) ? DIFF_TERN(HAS_BED_PROBE, delta_height, probe.offset.z) : base_home_pos(axis); diff --git a/Marlin/src/module/motion.h b/Marlin/src/module/motion.h index b7e37f6b70437..ce05c82c772db 100644 --- a/Marlin/src/module/motion.h +++ b/Marlin/src/module/motion.h @@ -271,7 +271,7 @@ void report_current_position_projected(); extern AutoReporter position_auto_reporter; #endif -#if EITHER(FULL_REPORT_TO_HOST_FEATURE, REALTIME_REPORTING_COMMANDS) +#if ANY(FULL_REPORT_TO_HOST_FEATURE, REALTIME_REPORTING_COMMANDS) #define HAS_GRBL_STATE 1 /** * Machine states for GRBL or TinyG diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 02a7d05cae3ad..1d3bb268efa49 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -795,7 +795,7 @@ void Planner::calculate_trapezoid_for_block(block_t * const block, const_float_t NOLESS(initial_rate, uint32_t(MINIMAL_STEP_RATE)); NOLESS(final_rate, uint32_t(MINIMAL_STEP_RATE)); - #if EITHER(S_CURVE_ACCELERATION, LIN_ADVANCE) + #if ANY(S_CURVE_ACCELERATION, LIN_ADVANCE) // If we have some plateau time, the cruise rate will be the nominal rate uint32_t cruise_rate = block->nominal_rate; #endif @@ -829,7 +829,7 @@ void Planner::calculate_trapezoid_for_block(block_t * const block, const_float_t accelerate_steps = _MIN(uint32_t(_MAX(accelerate_steps_float, 0)), block->step_event_count); decelerate_steps = block->step_event_count - accelerate_steps; - #if EITHER(S_CURVE_ACCELERATION, LIN_ADVANCE) + #if ANY(S_CURVE_ACCELERATION, LIN_ADVANCE) // We won't reach the cruising rate. Let's calculate the speed we will reach cruise_rate = final_speed(initial_rate, accel, accelerate_steps); #endif @@ -1349,7 +1349,7 @@ void Planner::check_axes_activity() { if (has_blocks_queued()) { - #if EITHER(HAS_TAIL_FAN_SPEED, BARICUDA) + #if ANY(HAS_TAIL_FAN_SPEED, BARICUDA) block_t *block = &block_buffer[block_buffer_tail]; #endif @@ -1773,7 +1773,7 @@ float Planner::get_axis_position_mm(const AxisEnum axis) { else axis_steps = DIFF_TERN(BACKLASH_COMPENSATION, stepper.position(axis), backlash.get_applied_steps(axis)); - #elif EITHER(MARKFORGED_XY, MARKFORGED_YX) + #elif ANY(MARKFORGED_XY, MARKFORGED_YX) // Requesting one of the joined axes? if (axis == CORE_AXIS_1 || axis == CORE_AXIS_2) { @@ -1925,7 +1925,7 @@ bool Planner::_populate_block( ); //*/ - #if EITHER(PREVENT_COLD_EXTRUSION, PREVENT_LENGTHY_EXTRUDE) + #if ANY(PREVENT_COLD_EXTRUSION, PREVENT_LENGTHY_EXTRUDE) if (dist.e) { #if ENABLED(PREVENT_COLD_EXTRUSION) if (thermalManager.tooColdToExtrude(extruder)) { @@ -2299,7 +2299,7 @@ bool Planner::_populate_block( // Example: At 120mm/s a 60mm move involving XYZ axes takes 0.5s. So this will give 2.0. // Example 2: At 120°/s a 60° move involving only rotational axes takes 0.5s. So this will give 2.0. float inverse_secs = inverse_millimeters * ( - #if BOTH(HAS_ROTATIONAL_AXES, INCH_MODE_SUPPORT) + #if ALL(HAS_ROTATIONAL_AXES, INCH_MODE_SUPPORT) cartesian_move ? fr_mm_s : LINEAR_UNIT(fr_mm_s) #else fr_mm_s @@ -2310,7 +2310,7 @@ bool Planner::_populate_block( const uint8_t moves_queued = nonbusy_movesplanned(); // Slow down when the buffer starts to empty, rather than wait at the corner for a buffer refill - #if EITHER(SLOWDOWN, HAS_WIRED_LCD) || defined(XY_FREQUENCY_LIMIT) + #if ANY(SLOWDOWN, HAS_WIRED_LCD) || defined(XY_FREQUENCY_LIMIT) // Segment time in microseconds int32_t segment_time_us = LROUND(1000000.0f / inverse_secs); #endif @@ -2907,7 +2907,7 @@ void Planner::buffer_sync_block(const BlockFlagBit sync_flag/*=BLOCK_BIT_SYNC_PO #if ENABLED(BACKLASH_COMPENSATION) LOOP_NUM_AXES(axis) block->position[axis] += backlash.get_applied_steps((AxisEnum)axis); #endif - #if BOTH(HAS_FAN, LASER_SYNCHRONOUS_M106_M107) + #if ALL(HAS_FAN, LASER_SYNCHRONOUS_M106_M107) FANS_LOOP(i) block->fan_speed[i] = thermalManager.fan_speed[i]; #endif diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index ee79c913af529..e74aea56a5718 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -938,7 +938,7 @@ class Planner { } // SCARA AB and Polar YB axes are in degrees, not mm - #if EITHER(IS_SCARA, POLAR) + #if ANY(IS_SCARA, POLAR) FORCE_INLINE static float get_axis_position_degrees(const AxisEnum axis) { return get_axis_position_mm(axis); } #endif @@ -1041,7 +1041,7 @@ class Planner { return target_velocity_sqr - 2 * accel * distance; } - #if EITHER(S_CURVE_ACCELERATION, LIN_ADVANCE) + #if ANY(S_CURVE_ACCELERATION, LIN_ADVANCE) /** * Calculate the speed reached given initial speed, acceleration and distance */ diff --git a/Marlin/src/module/printcounter.h b/Marlin/src/module/printcounter.h index 63cc1da158e8b..ebf61a3a1ce0c 100644 --- a/Marlin/src/module/printcounter.h +++ b/Marlin/src/module/printcounter.h @@ -54,7 +54,7 @@ struct printStatistics { // 16 bytes class PrintCounter: public Stopwatch { private: typedef Stopwatch super; - typedef IF::type eeprom_address_t; + typedef IF::type eeprom_address_t; static printStatistics data; diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 1e01cfd9b6161..c3ea161cb413f 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -57,9 +57,9 @@ float largest_sensorless_adj = 0; #endif -#if EITHER(HAS_QUIET_PROBING, USE_SENSORLESS) +#if ANY(HAS_QUIET_PROBING, USE_SENSORLESS) #include "stepper/indirection.h" - #if BOTH(HAS_QUIET_PROBING, PROBING_ESTEPPERS_OFF) + #if ALL(HAS_QUIET_PROBING, PROBING_ESTEPPERS_OFF) #include "stepper.h" #endif #if USE_SENSORLESS @@ -429,7 +429,7 @@ FORCE_INLINE void probe_specific_action(const bool deploy) { #endif } -#if EITHER(PREHEAT_BEFORE_PROBING, PREHEAT_BEFORE_LEVELING) +#if ANY(PREHEAT_BEFORE_PROBING, PREHEAT_BEFORE_LEVELING) #if ENABLED(PREHEAT_BEFORE_PROBING) #ifndef PROBING_NOZZLE_TEMP @@ -490,7 +490,7 @@ FORCE_INLINE void probe_specific_action(const bool deploy) { void Probe::probe_error_stop() { SERIAL_ERROR_START(); SERIAL_ECHOPGM(STR_STOP_PRE); - #if EITHER(Z_PROBE_SLED, Z_PROBE_ALLEN_KEY) + #if ANY(Z_PROBE_SLED, Z_PROBE_ALLEN_KEY) SERIAL_ECHOPGM(STR_STOP_UNHOMED); #elif ENABLED(BLTOUCH) SERIAL_ECHOPGM(STR_STOP_BLTOUCH); @@ -515,7 +515,7 @@ bool Probe::set_deployed(const bool deploy, const bool no_return/*=false*/) { // Make room for probe to deploy (or stow) // Fix-mounted probe should only raise for deploy // unless PAUSE_BEFORE_DEPLOY_STOW is enabled - #if EITHER(FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE) && DISABLED(PAUSE_BEFORE_DEPLOY_STOW) + #if ANY(FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE) && DISABLED(PAUSE_BEFORE_DEPLOY_STOW) const bool z_raise_wanted = deploy; #else constexpr bool z_raise_wanted = true; @@ -527,7 +527,7 @@ bool Probe::set_deployed(const bool deploy, const bool no_return/*=false*/) { do_z_clearance(zdest); } - #if EITHER(Z_PROBE_SLED, Z_PROBE_ALLEN_KEY) + #if ANY(Z_PROBE_SLED, Z_PROBE_ALLEN_KEY) if (homing_needed_error(TERN_(Z_PROBE_SLED, _BV(X_AXIS)))) { probe_error_stop(); return true; @@ -588,11 +588,11 @@ bool Probe::set_deployed(const bool deploy, const bool no_return/*=false*/) { bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) { DEBUG_SECTION(log_probe, "Probe::probe_down_to_z", DEBUGGING(LEVELING)); - #if BOTH(HAS_HEATED_BED, WAIT_FOR_BED_HEATER) + #if ALL(HAS_HEATED_BED, WAIT_FOR_BED_HEATER) thermalManager.wait_for_bed_heating(); #endif - #if BOTH(HAS_TEMP_HOTEND, WAIT_FOR_HOTEND) + #if ALL(HAS_TEMP_HOTEND, WAIT_FOR_HOTEND) thermalManager.wait_for_hotend_heating(active_extruder); #endif @@ -654,7 +654,7 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) { return true; // Stow in LOW SPEED MODE on every trigger #endif - #if BOTH(HAS_Z_SERVO_PROBE, Z_SERVO_INTERMEDIATE_STOW) + #if ALL(HAS_Z_SERVO_PROBE, Z_SERVO_INTERMEDIATE_STOW) probe_specific_action(false); // Always stow #endif @@ -689,7 +689,7 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) { * @return TRUE if the tare cold not be completed */ bool Probe::tare() { - #if BOTH(PROBE_ACTIVATION_SWITCH, PROBE_TARE_ONLY_WHILE_INACTIVE) + #if ALL(PROBE_ACTIVATION_SWITCH, PROBE_TARE_ONLY_WHILE_INACTIVE) if (endstops.probe_switch_activated()) { if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Cannot tare an active probe"); return true; diff --git a/Marlin/src/module/probe.h b/Marlin/src/module/probe.h index 98b4b107cd4f4..05a97d9470246 100644 --- a/Marlin/src/module/probe.h +++ b/Marlin/src/module/probe.h @@ -79,7 +79,7 @@ class Probe { static xyz_pos_t offset; - #if EITHER(PREHEAT_BEFORE_PROBING, PREHEAT_BEFORE_LEVELING) + #if ANY(PREHEAT_BEFORE_PROBING, PREHEAT_BEFORE_LEVELING) static void preheat_for_probing(const celsius_t hotend_temp, const celsius_t bed_temp, const bool early=false); #endif diff --git a/Marlin/src/module/scara.cpp b/Marlin/src/module/scara.cpp index 4c42ace884dec..9c149670e92ef 100644 --- a/Marlin/src/module/scara.cpp +++ b/Marlin/src/module/scara.cpp @@ -39,7 +39,7 @@ float segments_per_second = DEFAULT_SEGMENTS_PER_SECOND; -#if EITHER(MORGAN_SCARA, MP_SCARA) +#if ANY(MORGAN_SCARA, MP_SCARA) static constexpr xy_pos_t scara_offset = { SCARA_OFFSET_X, SCARA_OFFSET_Y }; diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 28eee57c086f3..f9dff246569e1 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -56,7 +56,7 @@ #include "../gcode/gcode.h" #include "../MarlinCore.h" -#if EITHER(EEPROM_SETTINGS, SD_FIRMWARE_UPDATE) +#if ANY(EEPROM_SETTINGS, SD_FIRMWARE_UPDATE) #include "../HAL/shared/eeprom_api.h" #endif @@ -695,7 +695,7 @@ void MarlinSettings::postprocess() { #endif } -#if BOTH(PRINTCOUNTER, EEPROM_SETTINGS) +#if ALL(PRINTCOUNTER, EEPROM_SETTINGS) #include "printcounter.h" static_assert( !WITHIN(STATS_EEPROM_ADDRESS, EEPROM_OFFSET, EEPROM_OFFSET + sizeof(SettingsData)) && @@ -739,10 +739,10 @@ void MarlinSettings::postprocess() { // This file simply uses the DEBUG_ECHO macros to implement EEPROM_CHITCHAT. // For deeper debugging of EEPROM issues enable DEBUG_EEPROM_READWRITE. // -#define DEBUG_OUT EITHER(EEPROM_CHITCHAT, DEBUG_LEVELING_FEATURE) +#define DEBUG_OUT ANY(EEPROM_CHITCHAT, DEBUG_LEVELING_FEATURE) #include "../core/debug_out.h" -#if BOTH(EEPROM_CHITCHAT, HOST_PROMPT_SUPPORT) +#if ALL(EEPROM_CHITCHAT, HOST_PROMPT_SUPPORT) #define HOST_EEPROM_CHITCHAT 1 #endif @@ -2803,14 +2803,14 @@ void MarlinSettings::postprocess() { bedlevel.report_state(); if (!bedlevel.sanity_check()) { - #if BOTH(EEPROM_CHITCHAT, DEBUG_LEVELING_FEATURE) + #if ALL(EEPROM_CHITCHAT, DEBUG_LEVELING_FEATURE) bedlevel.echo_name(); DEBUG_ECHOLNPGM(" initialized.\n"); #endif } else { eeprom_error = ERR_EEPROM_CORRUPT; - #if BOTH(EEPROM_CHITCHAT, DEBUG_LEVELING_FEATURE) + #if ALL(EEPROM_CHITCHAT, DEBUG_LEVELING_FEATURE) DEBUG_ECHOPGM("?Can't enable "); bedlevel.echo_name(); DEBUG_ECHOLNPGM("."); @@ -2888,7 +2888,7 @@ void MarlinSettings::postprocess() { return success; } reset(); - #if EITHER(EEPROM_AUTO_INIT, EEPROM_INIT_NOW) + #if ANY(EEPROM_AUTO_INIT, EEPROM_INIT_NOW) (void)save(); SERIAL_ECHO_MSG("EEPROM Initialized"); #endif @@ -3590,7 +3590,7 @@ void MarlinSettings::reset() { postprocess(); - #if EITHER(EEPROM_CHITCHAT, DEBUG_LEVELING_FEATURE) + #if ANY(EEPROM_CHITCHAT, DEBUG_LEVELING_FEATURE) FSTR_P const hdsl = F("Hardcoded Default Settings Loaded"); TERN_(HOST_EEPROM_CHITCHAT, hostui.notify(hdsl)); DEBUG_ECHO_START(); DEBUG_ECHOLNF(hdsl); @@ -3743,7 +3743,7 @@ void MarlinSettings::reset() { // // M666 Endstops Adjustment // - #if EITHER(DELTA, HAS_EXTRA_ENDSTOPS) + #if ANY(DELTA, HAS_EXTRA_ENDSTOPS) gcode.M666_report(forReplay); #endif diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 3188f77da8bb0..eb977793efe2e 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -148,7 +148,7 @@ Stepper stepper; // Singleton // public: -#if EITHER(HAS_EXTRA_ENDSTOPS, Z_STEPPER_AUTO_ALIGN) +#if ANY(HAS_EXTRA_ENDSTOPS, Z_STEPPER_AUTO_ALIGN) bool Stepper::separate_multi_axis = false; #endif @@ -182,7 +182,7 @@ bool Stepper::abort_current_block; bool Stepper::locked_Y_motor = false, Stepper::locked_Y2_motor = false; #endif -#if EITHER(Z_MULTI_ENDSTOPS, Z_STEPPER_AUTO_ALIGN) +#if ANY(Z_MULTI_ENDSTOPS, Z_STEPPER_AUTO_ALIGN) bool Stepper::locked_Z_motor = false, Stepper::locked_Z2_motor = false #if NUM_Z_STEPPERS >= 3 , Stepper::locked_Z3_motor = false @@ -218,7 +218,7 @@ uint32_t Stepper::advance_divisor = 0, Stepper::decelerate_after, // The count at which to start decelerating Stepper::step_event_count; // The total event count for the current block -#if EITHER(HAS_MULTI_EXTRUDER, MIXING_EXTRUDER) +#if ANY(HAS_MULTI_EXTRUDER, MIXING_EXTRUDER) uint8_t Stepper::stepper_extruder; #else constexpr uint8_t Stepper::stepper_extruder; @@ -1967,7 +1967,7 @@ void Stepper::pulse_phase_isr() { PULSE_PREP(W); #endif - #if EITHER(HAS_E0_STEP, MIXING_EXTRUDER) + #if ANY(HAS_E0_STEP, MIXING_EXTRUDER) PULSE_PREP(E); #if ENABLED(LIN_ADVANCE) @@ -2558,7 +2558,7 @@ hal_timer_t Stepper::block_phase_isr() { * If DeltaA == -DeltaB, the movement is only in the 2nd axis (Y or Z, handled below) * If DeltaA == DeltaB, the movement is only in the 1st axis (X) */ - #if EITHER(COREXY, COREXZ) + #if ANY(COREXY, COREXZ) #define X_CMP(A,B) ((A)==(B)) #else #define X_CMP(A,B) ((A)!=(B)) @@ -2578,7 +2578,7 @@ hal_timer_t Stepper::block_phase_isr() { * If DeltaA == DeltaB, the movement is only in the 1st axis (X or Y) * If DeltaA == -DeltaB, the movement is only in the 2nd axis (Y or Z) */ - #if EITHER(COREYX, COREYZ) + #if ANY(COREYX, COREYZ) #define Y_CMP(A,B) ((A)==(B)) #else #define Y_CMP(A,B) ((A)!=(B)) @@ -2598,7 +2598,7 @@ hal_timer_t Stepper::block_phase_isr() { * If DeltaA == DeltaB, the movement is only in the 1st axis (X or Y, already handled above) * If DeltaA == -DeltaB, the movement is only in the 2nd axis (Z) */ - #if EITHER(COREZX, COREZY) + #if ANY(COREZX, COREZY) #define Z_CMP(A,B) ((A)==(B)) #else #define Z_CMP(A,B) ((A)!=(B)) @@ -2856,7 +2856,7 @@ void Stepper::init() { TERN_(HAS_X2_DIR, X2_DIR_INIT()); #if HAS_Y_DIR Y_DIR_INIT(); - #if BOTH(HAS_Y2_STEPPER, HAS_Y2_DIR) + #if ALL(HAS_Y2_STEPPER, HAS_Y2_DIR) Y2_DIR_INIT(); #endif #endif @@ -2908,7 +2908,7 @@ void Stepper::init() { #endif X_ENABLE_INIT(); if (X_ENABLE_INIT_STATE) X_ENABLE_WRITE(X_ENABLE_INIT_STATE); - #if BOTH(HAS_X2_STEPPER, HAS_X2_ENABLE) + #if ALL(HAS_X2_STEPPER, HAS_X2_ENABLE) X2_ENABLE_INIT(); if (X_ENABLE_INIT_STATE) X2_ENABLE_WRITE(X_ENABLE_INIT_STATE); #endif @@ -2919,7 +2919,7 @@ void Stepper::init() { #endif Y_ENABLE_INIT(); if (Y_ENABLE_INIT_STATE) Y_ENABLE_WRITE(Y_ENABLE_INIT_STATE); - #if BOTH(HAS_Y2_STEPPER, HAS_Y2_ENABLE) + #if ALL(HAS_Y2_STEPPER, HAS_Y2_ENABLE) Y2_ENABLE_INIT(); if (Y_ENABLE_INIT_STATE) Y2_ENABLE_WRITE(Y_ENABLE_INIT_STATE); #endif diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h index a2c9861abc6bc..97993193684ac 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -290,7 +290,7 @@ class Stepper { public: - #if EITHER(HAS_EXTRA_ENDSTOPS, Z_STEPPER_AUTO_ALIGN) + #if ANY(HAS_EXTRA_ENDSTOPS, Z_STEPPER_AUTO_ALIGN) static bool separate_multi_axis; #endif @@ -337,7 +337,7 @@ class Stepper { #if ENABLED(Y_DUAL_ENDSTOPS) static bool locked_Y_motor, locked_Y2_motor; #endif - #if EITHER(Z_MULTI_ENDSTOPS, Z_STEPPER_AUTO_ALIGN) + #if ANY(Z_MULTI_ENDSTOPS, Z_STEPPER_AUTO_ALIGN) static bool locked_Z_motor, locked_Z2_motor #if NUM_Z_STEPPERS >= 3 , locked_Z3_motor @@ -375,7 +375,7 @@ class Stepper { decelerate_after, // The point from where we need to start decelerating step_event_count; // The total event count for the current block - #if EITHER(HAS_MULTI_EXTRUDER, MIXING_EXTRUDER) + #if ANY(HAS_MULTI_EXTRUDER, MIXING_EXTRUDER) static uint8_t stepper_extruder; #else static constexpr uint8_t stepper_extruder = 0; @@ -547,7 +547,7 @@ class Stepper { static void microstep_readings(); #endif - #if EITHER(HAS_EXTRA_ENDSTOPS, Z_STEPPER_AUTO_ALIGN) + #if ANY(HAS_EXTRA_ENDSTOPS, Z_STEPPER_AUTO_ALIGN) FORCE_INLINE static void set_separate_multi_axis(const bool state) { separate_multi_axis = state; } #endif #if ENABLED(X_DUAL_ENDSTOPS) @@ -558,7 +558,7 @@ class Stepper { FORCE_INLINE static void set_y_lock(const bool state) { locked_Y_motor = state; } FORCE_INLINE static void set_y2_lock(const bool state) { locked_Y2_motor = state; } #endif - #if EITHER(Z_MULTI_ENDSTOPS, Z_STEPPER_AUTO_ALIGN) + #if ANY(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_STEPPERS >= 3 diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index f785a683eb4a4..315cf8883089e 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -37,7 +37,7 @@ #include "planner.h" #include "printcounter.h" -#if EITHER(HAS_COOLER, LASER_COOLANT_FLOW_METER) +#if ANY(HAS_COOLER, LASER_COOLANT_FLOW_METER) #include "../feature/cooler.h" #include "../feature/spindle_laser.h" #endif @@ -156,7 +156,7 @@ #include "probe.h" #endif -#if EITHER(MPCTEMP, PID_EXTRUSION_SCALING) +#if ANY(MPCTEMP, PID_EXTRUSION_SCALING) #include "stepper.h" #endif @@ -373,7 +373,7 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED); redundant_info_t Temperature::temp_redundant; #endif -#if EITHER(AUTO_POWER_E_FANS, HAS_FANCHECK) +#if ANY(AUTO_POWER_E_FANS, HAS_FANCHECK) uint8_t Temperature::autofan_speed[HOTENDS] = ARRAY_N_1(HOTENDS, FAN_OFF_PWM); #endif @@ -385,7 +385,7 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED); uint8_t Temperature::coolerfan_speed = FAN_OFF_PWM; #endif -#if BOTH(FAN_SOFT_PWM, USE_CONTROLLER_FAN) +#if ALL(FAN_SOFT_PWM, USE_CONTROLLER_FAN) uint8_t Temperature::soft_pwm_controller_speed = FAN_OFF_PWM; #endif @@ -439,7 +439,7 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED); #endif - #if EITHER(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE) + #if ANY(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE) bool Temperature::fans_paused; // = false; uint8_t Temperature::saved_fan_speed[FAN_COUNT] = ARRAY_N_1(FAN_COUNT, FAN_OFF_PWM); #endif @@ -489,7 +489,7 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED); } #endif - #if EITHER(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE) + #if ANY(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE) void Temperature::set_fans_paused(const bool p) { if (p != fans_paused) { @@ -573,7 +573,7 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED); raw_adc_t Temperature::maxtemp_raw_SOC = TEMP_SENSOR_SOC_RAW_HI_TEMP; #endif -#if BOTH(HAS_MARLINUI_MENU, PREVENT_COLD_EXTRUSION) && E_MANUAL > 0 +#if ALL(HAS_MARLINUI_MENU, PREVENT_COLD_EXTRUSION) && E_MANUAL > 0 bool Temperature::allow_cold_extrude_override = false; #else constexpr bool Temperature::allow_cold_extrude_override; @@ -698,15 +698,15 @@ volatile bool Temperature::raw_temps_ready = false; #define ONHEATINGSTART() C_TERN(ischamber, printerEventLEDs.onChamberHeatingStart(), B_TERN(isbed, printerEventLEDs.onBedHeatingStart(), printerEventLEDs.onHotendHeatingStart())) #define ONHEATING(S,C,T) C_TERN(ischamber, printerEventLEDs.onChamberHeating(S,C,T), B_TERN(isbed, printerEventLEDs.onBedHeating(S,C,T), printerEventLEDs.onHotendHeating(S,C,T))) - #define WATCH_PID DISABLED(NO_WATCH_PID_TUNING) && (BOTH(WATCH_CHAMBER, PIDTEMPCHAMBER) || BOTH(WATCH_BED, PIDTEMPBED) || BOTH(WATCH_HOTENDS, PIDTEMP)) + #define WATCH_PID DISABLED(NO_WATCH_PID_TUNING) && (ALL(WATCH_CHAMBER, PIDTEMPCHAMBER) || ALL(WATCH_BED, PIDTEMPBED) || ALL(WATCH_HOTENDS, PIDTEMP)) #if WATCH_PID - #if BOTH(THERMAL_PROTECTION_CHAMBER, PIDTEMPCHAMBER) + #if ALL(THERMAL_PROTECTION_CHAMBER, PIDTEMPCHAMBER) #define C_GTV(T,A,B) ((T) ? (A) : (B)) #else #define C_GTV(T,A,B) (B) #endif - #if BOTH(THERMAL_PROTECTION_BED, PIDTEMPBED) + #if ALL(THERMAL_PROTECTION_BED, PIDTEMPBED) #define B_GTV(T,A,B) ((T) ? (A) : (B)) #else #define B_GTV(T,A,B) (B) @@ -835,7 +835,7 @@ volatile bool Temperature::raw_temps_ready = false; // Make sure heating is actually working #if WATCH_PID - if (BOTH(WATCH_BED, WATCH_HOTENDS) || isbed == DISABLED(WATCH_HOTENDS) || ischamber == DISABLED(WATCH_HOTENDS)) { + if (ALL(WATCH_BED, WATCH_HOTENDS) || isbed == DISABLED(WATCH_HOTENDS) || ischamber == DISABLED(WATCH_HOTENDS)) { if (!heated) { // If not yet reached target... if (current_temp > next_watch_temp) { // Over the watch temp? next_watch_temp = current_temp + watch_temp_increase; // - set the next temp to watch for @@ -868,7 +868,7 @@ volatile bool Temperature::raw_temps_ready = false; SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_AUTOTUNE_FINISHED); TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_AUTOTUNE_DONE))); - #if EITHER(PIDTEMPBED, PIDTEMPCHAMBER) + #if ANY(PIDTEMPBED, PIDTEMPCHAMBER) FSTR_P const estring = GHV(F("chamber"), F("bed"), FPSTR(NUL_STR)); say_default_(); SERIAL_ECHOF(estring); SERIAL_ECHOLNPGM("Kp ", tune_pid.p); say_default_(); SERIAL_ECHOF(estring); SERIAL_ECHOLNPGM("Ki ", tune_pid.i); @@ -939,7 +939,7 @@ volatile bool Temperature::raw_temps_ready = false; #if ENABLED(MPC_AUTOTUNE) - #if EITHER(MPC_FAN_0_ALL_HOTENDS, MPC_FAN_0_ACTIVE_HOTEND) + #if ANY(MPC_FAN_0_ALL_HOTENDS, MPC_FAN_0_ACTIVE_HOTEND) #define SINGLEFAN 1 #endif @@ -1416,13 +1416,13 @@ int16_t Temperature::getHeaterPower(const heater_id_t heater_id) { break; #endif default: - #if EITHER(AUTO_POWER_E_FANS, HAS_FANCHECK) + #if ANY(AUTO_POWER_E_FANS, HAS_FANCHECK) autofan_speed[realFan] = fan_on ? EXTRUDER_AUTO_FAN_SPEED : 0; #endif break; } - #if BOTH(HAS_FANCHECK, HAS_PWMFANCHECK) + #if ALL(HAS_FANCHECK, HAS_PWMFANCHECK) #define _AUTOFAN_SPEED() fan_check.is_measuring() ? 255 : EXTRUDER_AUTO_FAN_SPEED #else #define _AUTOFAN_SPEED() EXTRUDER_AUTO_FAN_SPEED @@ -1789,7 +1789,7 @@ void Temperature::mintemp_error(const heater_id_t heater_id) { } #endif // WATCH_BED - #if BOTH(PROBING_HEATERS_OFF, BED_LIMIT_SWITCHING) + #if ALL(PROBING_HEATERS_OFF, BED_LIMIT_SWITCHING) #define PAUSE_CHANGE_REQD 1 #endif @@ -1877,11 +1877,11 @@ void Temperature::mintemp_error(const heater_id_t heater_id) { } #endif - #if EITHER(CHAMBER_FAN, CHAMBER_VENT) || DISABLED(PIDTEMPCHAMBER) + #if ANY(CHAMBER_FAN, CHAMBER_VENT) || DISABLED(PIDTEMPCHAMBER) static bool flag_chamber_excess_heat; // = false; #endif - #if EITHER(CHAMBER_FAN, CHAMBER_VENT) + #if ANY(CHAMBER_FAN, CHAMBER_VENT) static bool flag_chamber_off; // = false if (temp_chamber.target > CHAMBER_MINTEMP) { @@ -2646,22 +2646,22 @@ void Temperature::updateTemperaturesFromRawValues() { if (temp_bed.target > 0 && !is_bed_preheating() && TP_CMP(BED, mintemp_raw_BED, temp_bed.getraw())) mintemp_error(H_BED); #endif - #if BOTH(HAS_HEATED_CHAMBER, THERMAL_PROTECTION_CHAMBER) + #if ALL(HAS_HEATED_CHAMBER, THERMAL_PROTECTION_CHAMBER) if (TP_CMP(CHAMBER, temp_chamber.getraw(), maxtemp_raw_CHAMBER)) maxtemp_error(H_CHAMBER); if (temp_chamber.target > 0 && TP_CMP(CHAMBER, mintemp_raw_CHAMBER, temp_chamber.getraw())) mintemp_error(H_CHAMBER); #endif - #if BOTH(HAS_COOLER, THERMAL_PROTECTION_COOLER) + #if ALL(HAS_COOLER, THERMAL_PROTECTION_COOLER) if (cutter.unitPower > 0 && TP_CMP(COOLER, temp_cooler.getraw(), maxtemp_raw_COOLER)) maxtemp_error(H_COOLER); if (TP_CMP(COOLER, mintemp_raw_COOLER, temp_cooler.getraw())) mintemp_error(H_COOLER); #endif - #if BOTH(HAS_TEMP_BOARD, THERMAL_PROTECTION_BOARD) + #if ALL(HAS_TEMP_BOARD, THERMAL_PROTECTION_BOARD) if (TP_CMP(BOARD, temp_board.getraw(), maxtemp_raw_BOARD)) maxtemp_error(H_BOARD); if (TP_CMP(BOARD, mintemp_raw_BOARD, temp_board.getraw())) mintemp_error(H_BOARD); #endif - #if BOTH(HAS_TEMP_SOC, THERMAL_PROTECTION_SOC) + #if ALL(HAS_TEMP_SOC, THERMAL_PROTECTION_SOC) if (TP_CMP(SOC, temp_soc.getraw(), maxtemp_raw_SOC)) maxtemp_error(H_SOC); #endif #undef TP_CMP @@ -3011,12 +3011,12 @@ void Temperature::init() { while (analog_to_celsius_cooler(maxtemp_raw_COOLER) < COOLER_MAXTEMP) maxtemp_raw_COOLER -= TEMPDIR(COOLER) * (OVERSAMPLENR); #endif - #if BOTH(HAS_TEMP_BOARD, THERMAL_PROTECTION_BOARD) + #if ALL(HAS_TEMP_BOARD, THERMAL_PROTECTION_BOARD) while (analog_to_celsius_board(mintemp_raw_BOARD) < BOARD_MINTEMP) mintemp_raw_BOARD += TEMPDIR(BOARD) * (OVERSAMPLENR); while (analog_to_celsius_board(maxtemp_raw_BOARD) > BOARD_MAXTEMP) maxtemp_raw_BOARD -= TEMPDIR(BOARD) * (OVERSAMPLENR); #endif - #if BOTH(HAS_TEMP_SOC, THERMAL_PROTECTION_SOC) + #if ALL(HAS_TEMP_SOC, THERMAL_PROTECTION_SOC) while (analog_to_celsius_soc(maxtemp_raw_SOC) > SOC_MAXTEMP) maxtemp_raw_SOC -= OVERSAMPLENR; #endif @@ -3272,7 +3272,7 @@ void Temperature::disable_all_heaters() { #endif // PROBING_HEATERS_OFF -#if EITHER(SINGLENOZZLE_STANDBY_TEMP, SINGLENOZZLE_STANDBY_FAN) +#if ANY(SINGLENOZZLE_STANDBY_TEMP, SINGLENOZZLE_STANDBY_FAN) void Temperature::singlenozzle_change(const uint8_t old_tool, const uint8_t new_tool) { #if ENABLED(SINGLENOZZLE_STANDBY_FAN) @@ -3641,7 +3641,7 @@ void Temperature::isr() { static SoftPWM soft_pwm_cooler; #endif - #if BOTH(FAN_SOFT_PWM, USE_CONTROLLER_FAN) + #if ALL(FAN_SOFT_PWM, USE_CONTROLLER_FAN) static SoftPWM soft_pwm_controller; #endif diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index c4dae4c6e5a73..9d1d68cf0b003 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -369,7 +369,7 @@ typedef struct { float p, i, d, c, f; } raw_pidcf_t; }; typedef - #if BOTH(PID_EXTRUSION_SCALING, PID_FAN_SCALING) + #if ALL(PID_EXTRUSION_SCALING, PID_FAN_SCALING) PIDCF_t<0, PID_MAX, LPQ_MAX_LEN, PID_FAN_SCALING_MIN_SPEED, PID_FAN_SCALING_LIN_FACTOR> #elif ENABLED(PID_EXTRUSION_SCALING) PIDC_t<0, PID_MAX, LPQ_MAX_LEN> @@ -409,7 +409,7 @@ typedef struct { float p, i, d, c, f; } raw_pidcf_t; #endif -#if ENABLED(G26_MESH_VALIDATION) && EITHER(HAS_MARLINUI_MENU, EXTENSIBLE_UI) +#if ENABLED(G26_MESH_VALIDATION) && ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI) #define G26_CLICK_CAN_CANCEL 1 #endif @@ -485,7 +485,7 @@ struct PIDHeaterInfo : public HeaterInfo { #if HAS_TEMP_PROBE typedef temp_info_t probe_info_t; #endif -#if EITHER(HAS_COOLER, HAS_TEMP_COOLER) +#if ANY(HAS_COOLER, HAS_TEMP_COOLER) typedef heater_info_t cooler_info_t; #endif #if HAS_TEMP_BOARD @@ -628,7 +628,7 @@ class Temperature { static redundant_info_t temp_redundant; #endif - #if EITHER(AUTO_POWER_E_FANS, HAS_FANCHECK) + #if ANY(AUTO_POWER_E_FANS, HAS_FANCHECK) static uint8_t autofan_speed[HOTENDS]; #endif #if ENABLED(AUTO_POWER_CHAMBER_FAN) @@ -643,11 +643,11 @@ class Temperature { soft_pwm_count_fan[FAN_COUNT]; #endif - #if BOTH(FAN_SOFT_PWM, USE_CONTROLLER_FAN) + #if ALL(FAN_SOFT_PWM, USE_CONTROLLER_FAN) static uint8_t soft_pwm_controller_speed; #endif - #if BOTH(HAS_MARLINUI_MENU, PREVENT_COLD_EXTRUSION) && E_MANUAL > 0 + #if ALL(HAS_MARLINUI_MENU, PREVENT_COLD_EXTRUSION) && E_MANUAL > 0 static bool allow_cold_extrude_override; static void set_menu_cold_override(const bool allow) { allow_cold_extrude_override = allow; } #else @@ -671,7 +671,7 @@ class Temperature { static bool hotEnoughToExtrude(const uint8_t e) { return !tooColdToExtrude(e); } static bool targetHotEnoughToExtrude(const uint8_t e) { return !targetTooColdToExtrude(e); } - #if EITHER(SINGLENOZZLE_STANDBY_TEMP, SINGLENOZZLE_STANDBY_FAN) + #if ANY(SINGLENOZZLE_STANDBY_TEMP, SINGLENOZZLE_STANDBY_FAN) #if ENABLED(SINGLENOZZLE_STANDBY_TEMP) static celsius_t singlenozzle_temp[EXTRUDERS]; #endif @@ -767,11 +767,11 @@ class Temperature { static raw_adc_t mintemp_raw_COOLER, maxtemp_raw_COOLER; #endif - #if BOTH(HAS_TEMP_BOARD, THERMAL_PROTECTION_BOARD) + #if ALL(HAS_TEMP_BOARD, THERMAL_PROTECTION_BOARD) static raw_adc_t mintemp_raw_BOARD, maxtemp_raw_BOARD; #endif - #if BOTH(HAS_TEMP_SOC, THERMAL_PROTECTION_SOC) + #if ALL(HAS_TEMP_SOC, THERMAL_PROTECTION_SOC) static raw_adc_t maxtemp_raw_SOC; #endif @@ -885,7 +885,7 @@ class Temperature { static void report_fan_speed(const uint8_t fan); #endif - #if EITHER(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE) + #if ANY(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE) static bool fans_paused; static uint8_t saved_fan_speed[FAN_COUNT]; #endif @@ -913,7 +913,7 @@ class Temperature { static void set_temp_fan_speed(const uint8_t fan, const uint16_t command_or_speed); #endif - #if EITHER(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE) + #if ANY(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE) void set_fans_paused(const bool p); #endif diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index cce3669355e1e..d4c2fcb675d1c 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -1165,7 +1165,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { if (new_tool != old_tool || TERN0(PARKING_EXTRUDER, extruder_parked)) { // PARKING_EXTRUDER may need to attach old_tool when homing destination = current_position; - #if BOTH(TOOLCHANGE_FILAMENT_SWAP, HAS_FAN) && TOOLCHANGE_FS_FAN >= 0 + #if ALL(TOOLCHANGE_FILAMENT_SWAP, HAS_FAN) && TOOLCHANGE_FS_FAN >= 0 // Store and stop fan. Restored on any exit. REMEMBER(fan, thermalManager.fan_speed[TOOLCHANGE_FS_FAN], 0); #endif @@ -1277,7 +1277,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { fast_line_to_current(Z_AXIS); } move_nozzle_servo(new_tool); - #elif EITHER(MECHANICAL_SWITCHING_EXTRUDER, MECHANICAL_SWITCHING_NOZZLE) + #elif ANY(MECHANICAL_SWITCHING_EXTRUDER, MECHANICAL_SWITCHING_NOZZLE) if (!no_move) { current_position.z = _MIN(current_position.z + toolchange_settings.z_raise, _MIN(TERN(HAS_SOFTWARE_ENDSTOPS, soft_endstop.max.z, Z_MAX_POS), Z_MAX_POS)); fast_line_to_current(Z_AXIS); @@ -1308,7 +1308,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { const bool should_move = safe_to_move && !no_move && IsRunning(); if (should_move) { - #if EITHER(SINGLENOZZLE_STANDBY_TEMP, SINGLENOZZLE_STANDBY_FAN) + #if ANY(SINGLENOZZLE_STANDBY_TEMP, SINGLENOZZLE_STANDBY_FAN) thermalManager.singlenozzle_change(old_tool, new_tool); #endif @@ -1469,7 +1469,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { // If using MECHANICAL_SWITCHING extruder/nozzle, set HOTEND_OFFSET in Z axis after running EVENT_GCODE_TOOLCHANGE // so that nozzle does not lower below print surface if new hotend Z offset is higher than old hotend Z offset. - #if EITHER(MECHANICAL_SWITCHING_EXTRUDER, MECHANICAL_SWITCHING_NOZZLE) + #if ANY(MECHANICAL_SWITCHING_EXTRUDER, MECHANICAL_SWITCHING_NOZZLE) #if HAS_HOTEND_OFFSET xyz_pos_t diff = hotend_offset[new_tool] - hotend_offset[old_tool]; TERN_(DUAL_X_CARRIAGE, diff.x = 0); diff --git a/Marlin/src/pins/esp32/pins_GODI_CONTROLLER_V1_0.h b/Marlin/src/pins/esp32/pins_GODI_CONTROLLER_V1_0.h index 35fc4e035d814..6f8046988e374 100644 --- a/Marlin/src/pins/esp32/pins_GODI_CONTROLLER_V1_0.h +++ b/Marlin/src/pins/esp32/pins_GODI_CONTROLLER_V1_0.h @@ -129,7 +129,7 @@ // Heaters / Fans // -#if EITHER(EDUTRONICS_12864OLED_SH1106, EDUTRONICS_12864OLED_SSD1306) +#if ANY(EDUTRONICS_12864OLED_SH1106, EDUTRONICS_12864OLED_SSD1306) #define LCDSCREEN_NAME "EDUTRONICS 12864 OLED" #define BTN_EN2 1 #define BTN_EN1 3 diff --git a/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h b/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h index 546fa82c0d9f8..2dea1edacc599 100644 --- a/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h +++ b/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h @@ -177,7 +177,7 @@ #if SD_CONNECTION_IS(ONBOARD) #define FORCE_SOFT_SPI #endif - #if BOTH(MKS_MINI_12864_V3, HAS_MEDIA) + #if ALL(MKS_MINI_12864_V3, HAS_MEDIA) #define PAUSE_LCD_FOR_BUSY_SD #endif #else diff --git a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h b/Marlin/src/pins/linux/pins_RAMPS_LINUX.h index 4f32304dde9d2..19ea927531b8e 100644 --- a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h +++ b/Marlin/src/pins/linux/pins_RAMPS_LINUX.h @@ -477,7 +477,7 @@ #define LCD_PINS_EN 51 // SID (MOSI) #define LCD_PINS_D4 52 // SCK (CLK) clock - #elif BOTH(IS_NEWPANEL, PANEL_ONE) + #elif ALL(IS_NEWPANEL, PANEL_ONE) #define LCD_PINS_RS 40 #define LCD_PINS_EN 42 @@ -509,7 +509,7 @@ #else - #if EITHER(MKS_12864OLED, MKS_12864OLED_SSD1306) + #if ANY(MKS_12864OLED, MKS_12864OLED_SSD1306) #define LCD_PINS_DC 25 // Set as output on init #define LCD_PINS_RS 27 // Pull low for 1s to init // DOGM SPI LCD Support @@ -593,7 +593,7 @@ #define LCD_SDSS SDSS #define SD_DETECT_PIN 49 - #elif EITHER(VIKI2, miniVIKI) + #elif ANY(VIKI2, miniVIKI) #define DOGLCD_CS 45 #define DOGLCD_A0 44 diff --git a/Marlin/src/pins/lpc1768/pins_BIQU_B300_V1.0.h b/Marlin/src/pins/lpc1768/pins_BIQU_B300_V1.0.h index 423c89b8c9492..c498af3a64d94 100644 --- a/Marlin/src/pins/lpc1768/pins_BIQU_B300_V1.0.h +++ b/Marlin/src/pins/lpc1768/pins_BIQU_B300_V1.0.h @@ -130,7 +130,7 @@ #define LCD_PINS_EN P0_18 // (MOSI) EXP1-3 #define LCD_PINS_D4 P0_15 // (SCK) EXP1-5 - #if BOTH(HAS_MARLINUI_HD44780, IS_RRD_SC) + #if ALL(HAS_MARLINUI_HD44780, IS_RRD_SC) #error "REPRAP_DISCOUNT_SMART_CONTROLLER displays aren't supported by the BIQU B300 v1.0" #endif diff --git a/Marlin/src/pins/lpc1768/pins_BIQU_BQ111_A4.h b/Marlin/src/pins/lpc1768/pins_BIQU_BQ111_A4.h index 278ba12dd508a..3fb29b90929df 100644 --- a/Marlin/src/pins/lpc1768/pins_BIQU_BQ111_A4.h +++ b/Marlin/src/pins/lpc1768/pins_BIQU_BQ111_A4.h @@ -107,7 +107,7 @@ #define LCD_PINS_EN P0_18 // (MOSI) EXP1-3 #define LCD_PINS_D4 P0_15 // (SCK) EXP1-5 - #if BOTH(HAS_MARLINUI_HD44780, IS_RRD_SC) + #if ALL(HAS_MARLINUI_HD44780, IS_RRD_SC) #error "REPRAP_DISCOUNT_SMART_CONTROLLER displays aren't supported by the BIQU BQ111-A4" #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 ec21a1b39ddac..8cca8ec440816 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h @@ -407,7 +407,7 @@ #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) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN EXP1_06_PIN #endif 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 9aa6a2b21b02b..a3fb8f6488756 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h @@ -450,7 +450,7 @@ #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) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN EXP1_06_PIN #endif diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_common.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_common.h index 2b01b4ce6f9a1..75eea8e0f6ca2 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_common.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_common.h @@ -27,8 +27,8 @@ // 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) +#if ALL(HAS_WIRED_LCD, BTT_MOTOR_EXPANSION) + #if ANY(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." diff --git a/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h b/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h index 6d76fb2c8fcc9..a4150aa22f217 100644 --- a/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h +++ b/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h @@ -240,7 +240,7 @@ #define LCD_SDSS P0_28 // EXP2.4 #define LCD_PINS_EN P0_18 // EXP1.3 #define LCD_PINS_D4 P0_15 // EXP1.5 - #if EITHER(VIKI2, miniVIKI) + #if ANY(VIKI2, miniVIKI) #define DOGLCD_SCK SD_SCK_PIN #define DOGLCD_MOSI SD_MOSI_PIN #endif @@ -265,7 +265,7 @@ //#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 - #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN P2_12 // J8-4 (LCD_D6 on FYSETC schematic) #endif diff --git a/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h b/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h index 54a91e364d1f5..42a0155471b2b 100644 --- a/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h +++ b/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h @@ -371,7 +371,7 @@ #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) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN EXP1_06_PIN #endif diff --git a/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h b/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h index a6341ec5295dc..f3b134cd36f4f 100644 --- a/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h +++ b/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h @@ -207,9 +207,9 @@ #endif #ifndef FAN0_PIN - #if EITHER(FET_ORDER_EFB, FET_ORDER_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan + #if ANY(FET_ORDER_EFB, FET_ORDER_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan #define FAN0_PIN MOSFET_B_PIN - #elif EITHER(FET_ORDER_EEF, FET_ORDER_SF) // Hotend, Hotend, Fan or Spindle, Fan + #elif ANY(FET_ORDER_EEF, FET_ORDER_SF) // Hotend, Hotend, Fan or Spindle, Fan #define FAN0_PIN MOSFET_C_PIN #elif FET_ORDER_EEB // Hotend, Hotend, Bed #define FAN0_PIN P1_18 // (4) IO pin. Buffer needed @@ -353,7 +353,7 @@ //#define SHIFT_EN_PIN P1_22 // (41) J5-4 & AUX-4 #endif - #if EITHER(VIKI2, miniVIKI) + #if ANY(VIKI2, miniVIKI) #define DOGLCD_CS P0_16 // (16) #define DOGLCD_A0 P2_06 // (59) J3-8 & AUX-2 #define DOGLCD_SCK P0_15 // (52) (SCK) J3-9 & AUX-3 @@ -378,7 +378,7 @@ #define LCD_RESET_PIN P0_16 // Must be high or open for LCD to operate normally. - #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN P1_00 #endif diff --git a/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_GT.h b/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_GT.h index 5899cb0f503ae..8412f1c12d3b3 100644 --- a/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_GT.h +++ b/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_GT.h @@ -108,7 +108,7 @@ // // Display // -#if EITHER(VIKI2, miniVIKI) +#if ANY(VIKI2, miniVIKI) #define BEEPER_PIN P1_31 #define DOGLCD_A0 P2_06 #define DOGLCD_CS P0_16 diff --git a/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI.h b/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI.h index 1a8192bafe20f..92e97ca8753dd 100644 --- a/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI.h +++ b/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI.h @@ -158,7 +158,7 @@ //#define SHIFT_EN_PIN P1_22 // (41) J5-4 & AUX-4 #endif - #if EITHER(VIKI2, miniVIKI) + #if ANY(VIKI2, miniVIKI) #define BEEPER_PIN P1_30 // (37) may change if cable changes #define DOGLCD_CS P0_26 // (63) J5-3 & AUX-2 #define DOGLCD_SCK SD_SCK_PIN 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 2e04f7869a733..966ff5ef957fa 100644 --- a/Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h +++ b/Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h @@ -260,7 +260,7 @@ #define LCD_PINS_D7 EXP1_01_PIN #define ADC_KEYPAD_PIN P1_23 // Repurpose servo pin for ADC - CONNECTING TO 5V WILL DAMAGE THE BOARD! - #elif EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY) + #elif ANY(MKS_MINI_12864, ENDER2_STOCKDISPLAY) #define BTN_EN1 EXP1_03_PIN #define BTN_EN2 EXP1_05_PIN diff --git a/Marlin/src/pins/lpc1769/pins_COHESION3D_REMIX.h b/Marlin/src/pins/lpc1769/pins_COHESION3D_REMIX.h index f86cd5d3c6950..362aafe12e754 100644 --- a/Marlin/src/pins/lpc1769/pins_COHESION3D_REMIX.h +++ b/Marlin/src/pins/lpc1769/pins_COHESION3D_REMIX.h @@ -190,7 +190,7 @@ // A custom EXP1 cable is required colored LEDs. Pins 1-5, 9, 10 of the cable go to pins 1-5, 9, 10 // on the board's EXP1 connector. Pins 6, 7, and 8 of the EXP1 cable go to the Ethernet connector. // Rev 1.2 displays do NOT require the RGB LEDs. 2.0 and 2.1 displays do require RGB. - #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN P1_16 // EXP1-6 => Ethernet pin 6 (top row, 3 from left) #endif 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 e8c48c1b7a58e..ba781466232e3 100644 --- a/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h +++ b/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h @@ -389,7 +389,7 @@ #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) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN EXP1_06_PIN #endif diff --git a/Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h b/Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h index 3e7e784b59ab5..3db18e4acfeaf 100644 --- a/Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h +++ b/Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h @@ -93,7 +93,7 @@ // // LCD / Controller // -#if EITHER(VIKI2, miniVIKI) +#if ANY(VIKI2, miniVIKI) #define BEEPER_PIN P1_31 #define DOGLCD_A0 P2_11 diff --git a/Marlin/src/pins/lpc1769/pins_TH3D_EZBOARD.h b/Marlin/src/pins/lpc1769/pins_TH3D_EZBOARD.h index 1982652af6c59..634e50c223af3 100644 --- a/Marlin/src/pins/lpc1769/pins_TH3D_EZBOARD.h +++ b/Marlin/src/pins/lpc1769/pins_TH3D_EZBOARD.h @@ -217,7 +217,7 @@ #endif -#if EITHER(CR10_STOCKDISPLAY, MKS_MINI_12864) +#if ANY(CR10_STOCKDISPLAY, MKS_MINI_12864) #define BTN_EN1 EXP1_03_PIN #define BTN_EN2 EXP1_05_PIN #define BTN_ENC EXP1_02_PIN diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 6ee6401badfc2..77c2fc803737d 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -61,7 +61,7 @@ #endif #endif -#if !(BOTH(HAS_WIRED_LCD, IS_NEWPANEL) && ANY(PANEL_ONE, VIKI2, miniVIKI, WYH_L12864, MINIPANEL, REPRAPWORLD_KEYPAD)) +#if !(ALL(HAS_WIRED_LCD, IS_NEWPANEL) && ANY(PANEL_ONE, VIKI2, miniVIKI, WYH_L12864, MINIPANEL, REPRAPWORLD_KEYPAD)) #define HAS_FREE_AUX2_PINS 1 #endif @@ -93,7 +93,7 @@ #if _ENDSTOP_IS_ANY(Y_MIN_PIN) || _ENDSTOP_IS_ANY(Y_MAX_PIN) #define NEEDS_Y_MINMAX 1 #endif -#if _ENDSTOP_IS_ANY(Z_MIN_PIN) || _ENDSTOP_IS_ANY(Z_MAX_PIN) || BOTH(Z_HOME_TO_MAX, Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) +#if _ENDSTOP_IS_ANY(Z_MIN_PIN) || _ENDSTOP_IS_ANY(Z_MAX_PIN) || ALL(Z_HOME_TO_MAX, Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) #define NEEDS_Z_MINMAX 1 #endif #undef _ENDSTOP_IS_ANY diff --git a/Marlin/src/pins/pinsDebug.h b/Marlin/src/pins/pinsDebug.h index 3219b1b7a2432..a342d546c48c0 100644 --- a/Marlin/src/pins/pinsDebug.h +++ b/Marlin/src/pins/pinsDebug.h @@ -100,7 +100,7 @@ const PinInfo pin_array[] PROGMEM = { */ #if SERIAL_IN_USE(0) - #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM) + #if ANY(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM) { RXD_NAME_0, 0, true }, { TXD_NAME_0, 1, true }, #elif AVR_ATmega1284_FAMILY @@ -113,7 +113,7 @@ const PinInfo pin_array[] PROGMEM = { #endif #if SERIAL_IN_USE(1) - #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM) + #if ANY(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM) { RXD_NAME_1, 19, true }, { TXD_NAME_1, 18, true }, #elif AVR_ATmega1284_FAMILY @@ -131,7 +131,7 @@ const PinInfo pin_array[] PROGMEM = { #endif #if SERIAL_IN_USE(2) - #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM) + #if ANY(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM) { RXD_NAME_2, 17, true }, { TXD_NAME_2, 16, true }, #elif defined(TARGET_LPC1768) @@ -146,7 +146,7 @@ const PinInfo pin_array[] PROGMEM = { #endif #if SERIAL_IN_USE(3) - #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM) + #if ANY(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM) { RXD_NAME_3, 15, true }, { TXD_NAME_3, 14, true }, #elif defined(TARGET_LPC1768) diff --git a/Marlin/src/pins/rambo/pins_RAMBO.h b/Marlin/src/pins/rambo/pins_RAMBO.h index e1ddf972d9959..ba8046d6d0fbf 100644 --- a/Marlin/src/pins/rambo/pins_RAMBO.h +++ b/Marlin/src/pins/rambo/pins_RAMBO.h @@ -212,7 +212,7 @@ #define LCD_PINS_D6 74 #define LCD_PINS_D7 75 - #if EITHER(VIKI2, miniVIKI) + #if ANY(VIKI2, miniVIKI) #define BEEPER_PIN 44 // NB: Panucatt's Viki 2.0 wiring diagram (v1.2) indicates that the // beeper/buzzer is connected to pin 33; however, the pin used in the diff --git a/Marlin/src/pins/rambo/pins_SCOOVO_X9H.h b/Marlin/src/pins/rambo/pins_SCOOVO_X9H.h index f0e107f398c04..0d212010e0654 100644 --- a/Marlin/src/pins/rambo/pins_SCOOVO_X9H.h +++ b/Marlin/src/pins/rambo/pins_SCOOVO_X9H.h @@ -143,7 +143,7 @@ #define HOME_PIN BTN_HOME -#if EITHER(VIKI2, miniVIKI) +#if ANY(VIKI2, miniVIKI) #define BEEPER_PIN 44 // Pins for DOGM SPI LCD Support #define DOGLCD_A0 70 diff --git a/Marlin/src/pins/ramps/pins_3DRAG.h b/Marlin/src/pins/ramps/pins_3DRAG.h index 6f57b0eca62a2..2d419e1321793 100644 --- a/Marlin/src/pins/ramps/pins_3DRAG.h +++ b/Marlin/src/pins/ramps/pins_3DRAG.h @@ -117,7 +117,7 @@ #define SPINDLE_LASER_PWM_PIN 46 // Hardware PWM #define SPINDLE_LASER_ENA_PIN 62 // Pullup! #define SPINDLE_DIR_PIN 48 - #elif !BOTH(HAS_WIRED_LCD, IS_NEWPANEL) // Use expansion header if no LCD in use + #elif !ALL(HAS_WIRED_LCD, IS_NEWPANEL) // Use expansion header if no LCD in use #define SPINDLE_LASER_ENA_PIN 16 // Pullup or pulldown! #define SPINDLE_DIR_PIN 17 #if !NUM_SERVOS // Use servo connector if possible diff --git a/Marlin/src/pins/ramps/pins_AZTEEG_X3.h b/Marlin/src/pins/ramps/pins_AZTEEG_X3.h index 4d3722655df93..17581dca62411 100644 --- a/Marlin/src/pins/ramps/pins_AZTEEG_X3.h +++ b/Marlin/src/pins/ramps/pins_AZTEEG_X3.h @@ -54,7 +54,7 @@ #undef STAT_LED_RED_PIN #undef STAT_LED_BLUE_PIN -#if EITHER(VIKI2, miniVIKI) +#if ANY(VIKI2, miniVIKI) #undef DOGLCD_A0 #undef DOGLCD_CS diff --git a/Marlin/src/pins/ramps/pins_AZTEEG_X3_PRO.h b/Marlin/src/pins/ramps/pins_AZTEEG_X3_PRO.h index b0eee92c72181..ddd56b28e859e 100644 --- a/Marlin/src/pins/ramps/pins_AZTEEG_X3_PRO.h +++ b/Marlin/src/pins/ramps/pins_AZTEEG_X3_PRO.h @@ -145,7 +145,7 @@ #undef BEEPER_PIN #define BEEPER_PIN 33 -#if EITHER(VIKI2, miniVIKI) +#if ANY(VIKI2, miniVIKI) #undef SD_DETECT_PIN #define SD_DETECT_PIN 49 // For easy adapter board #undef BEEPER_PIN @@ -172,7 +172,7 @@ #undef SPINDLE_DIR_PIN #if HAS_CUTTER // EXP2 header - #if EITHER(VIKI2, miniVIKI) + #if ANY(VIKI2, miniVIKI) #define BTN_EN2 31 // Pin 7 needed for Spindle PWM #endif #define SPINDLE_LASER_PWM_PIN 7 // Hardware PWM diff --git a/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h b/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h index fa5bbb5b9e752..824dbd9f2df8b 100644 --- a/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h +++ b/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h @@ -249,7 +249,7 @@ #define LCD_RESET_PIN 23 // Must be high or open for LCD to operate normally. // Seems to work best if left open. - #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN 25 #endif diff --git a/Marlin/src/pins/ramps/pins_K8400.h b/Marlin/src/pins/ramps/pins_K8400.h index 56ec66191b32b..bcb145825b242 100644 --- a/Marlin/src/pins/ramps/pins_K8400.h +++ b/Marlin/src/pins/ramps/pins_K8400.h @@ -53,7 +53,7 @@ #define X_STOP_PIN 3 #define Y_STOP_PIN 14 -#if EITHER(BLTOUCH, TOUCH_MI_PROBE) +#if ANY(BLTOUCH, TOUCH_MI_PROBE) #define INVERTED_PROBE_STATE #endif diff --git a/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h b/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h index 89da25d074fa8..cb28762adc553 100644 --- a/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h +++ b/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h @@ -127,7 +127,7 @@ // Aux-1 | D19 D18 GND 5V | J21 | D4 D5 D6 GND | J17 | D11 GND 24V | J18 | D7 GND 5V | // ------------------ ---------------- --------------- ------------- -#if BOTH(CR10_STOCKDISPLAY, LONGER_LK5) +#if ALL(CR10_STOCKDISPLAY, LONGER_LK5) /** CR-10 Stock Display * ------ * BEEPER D11 | 1 2 | D15 ENC diff --git a/Marlin/src/pins/ramps/pins_MKS_GEN_13.h b/Marlin/src/pins/ramps/pins_MKS_GEN_13.h index 4cf66ed2cd418..9afdc62a53a8a 100644 --- a/Marlin/src/pins/ramps/pins_MKS_GEN_13.h +++ b/Marlin/src/pins/ramps/pins_MKS_GEN_13.h @@ -63,7 +63,7 @@ // // LCD / Controller // -#if EITHER(VIKI2, miniVIKI) +#if ANY(VIKI2, miniVIKI) /** * VIKI2 Has two groups of wires with... * diff --git a/Marlin/src/pins/ramps/pins_RAMPS.h b/Marlin/src/pins/ramps/pins_RAMPS.h index 422991aba4c1a..8b15f82736f90 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS.h +++ b/Marlin/src/pins/ramps/pins_RAMPS.h @@ -250,7 +250,7 @@ #ifndef HEATER_BED_PIN #define HEATER_BED_PIN MOSFET_C_PIN #endif - #if EITHER(HAS_MULTI_HOTEND, HEATERS_PARALLEL) + #if ANY(HAS_MULTI_HOTEND, HEATERS_PARALLEL) #define HEATER_1_PIN MOSFET_D_PIN #else #define FAN1_PIN MOSFET_D_PIN @@ -258,9 +258,9 @@ #endif #ifndef FAN0_PIN - #if EITHER(FET_ORDER_EFB, FET_ORDER_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan + #if ANY(FET_ORDER_EFB, FET_ORDER_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan #define FAN0_PIN MOSFET_B_PIN - #elif EITHER(FET_ORDER_EEF, FET_ORDER_SF) // Hotend, Hotend, Fan or Spindle, Fan + #elif ANY(FET_ORDER_EEF, FET_ORDER_SF) // Hotend, Hotend, Fan or Spindle, Fan #define FAN0_PIN MOSFET_C_PIN #elif FET_ORDER_EEB // Hotend, Hotend, Bed #define FAN0_PIN 4 // IO pin. Buffer needed @@ -567,7 +567,7 @@ #define EXP1_01_PIN AUX4_09_PIN #define EXP1_02_PIN AUX4_10_PIN - #if BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) + #if ALL(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) #define EXP2_03_PIN AUX4_11_PIN #define EXP2_05_PIN AUX4_12_PIN #define EXP2_08_PIN -1 // RESET @@ -598,7 +598,7 @@ #define LCD_PINS_EN EXP2_06_PIN // SID (MOSI) #define LCD_PINS_D4 EXP2_02_PIN // SCK (CLK) clock - #elif BOTH(IS_NEWPANEL, PANEL_ONE) + #elif ALL(IS_NEWPANEL, PANEL_ONE) #define LCD_PINS_RS AUX2_06_PIN #define LCD_PINS_EN AUX2_08_PIN @@ -642,7 +642,7 @@ #else - #if EITHER(MKS_12864OLED, MKS_12864OLED_SSD1306) + #if ANY(MKS_12864OLED, MKS_12864OLED_SSD1306) #define LCD_PINS_DC EXP1_06_PIN // Set as output on init #define LCD_PINS_RS EXP1_07_PIN // Pull low for 1s to init // DOGM SPI LCD Support @@ -736,7 +736,7 @@ #define SD_DETECT_PIN EXP2_07_PIN #endif - #elif EITHER(VIKI2, miniVIKI) + #elif ANY(VIKI2, miniVIKI) #define DOGLCD_CS AUX4_05_PIN #define DOGLCD_A0 AUX2_07_PIN @@ -777,7 +777,7 @@ #endif #define KILL_PIN EXP2_08_PIN - #elif EITHER(MKS_MINI_12864, FYSETC_MINI_12864) + #elif ANY(MKS_MINI_12864, FYSETC_MINI_12864) #define BTN_ENC EXP1_02_PIN #ifndef SD_DETECT_PIN @@ -814,7 +814,7 @@ #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) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN EXP1_06_PIN #endif @@ -914,7 +914,7 @@ #endif #endif -#if BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) +#if ALL(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) #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.)" diff --git a/Marlin/src/pins/ramps/pins_RUMBA.h b/Marlin/src/pins/ramps/pins_RUMBA.h index 20c804367adbf..1d2aeb4f0f882 100644 --- a/Marlin/src/pins/ramps/pins_RUMBA.h +++ b/Marlin/src/pins/ramps/pins_RUMBA.h @@ -190,7 +190,7 @@ // // LCD / Controller // -#if EITHER(MKS_12864OLED, MKS_12864OLED_SSD1306) +#if ANY(MKS_12864OLED, MKS_12864OLED_SSD1306) #define LCD_PINS_DC 38 // Set as output on init #define LCD_PINS_RS 41 // Pull low for 1s to init // DOGM SPI LCD Support @@ -209,7 +209,7 @@ #define LCD_RESET_PIN 18 // Must be high or open for LCD to operate normally. - #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN 41 #endif diff --git a/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h b/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h index bb74fe421a7ff..7306272127e1f 100644 --- a/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h +++ b/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h @@ -115,7 +115,7 @@ #if ENABLED(ANYCUBIC_4_MAX_PRO_ENDSTOPS) #define X_MAX_PIN 43 // AUX (2) #define Y_STOP_PIN 19 // Z+ -#elif EITHER(TRIGORILLA_MAPPING_CHIRON, TRIGORILLA_MAPPING_I3MEGA) +#elif ANY(TRIGORILLA_MAPPING_CHIRON, TRIGORILLA_MAPPING_I3MEGA) // Chiron uses AUX header for Y and Z endstops #define Y_STOP_PIN 42 // AUX (1) #define Z_STOP_PIN 43 // AUX (2) @@ -145,7 +145,7 @@ #define FIL_RUNOUT_PIN 19 // Z+ #endif - #if EITHER(TRIGORILLA_MAPPING_CHIRON, SWAP_Z_MOTORS) + #if ANY(TRIGORILLA_MAPPING_CHIRON, SWAP_Z_MOTORS) // Chiron and some Anycubic i3 MEGAs swap Z steppers #define Z_STEP_PIN 36 #define Z_DIR_PIN 34 @@ -159,7 +159,7 @@ #endif #endif -#if EITHER(ANYCUBIC_LCD_CHIRON, ANYCUBIC_LCD_I3MEGA) +#if ANY(ANYCUBIC_LCD_CHIRON, ANYCUBIC_LCD_I3MEGA) #ifndef BEEPER_PIN #define BEEPER_PIN EXP2_03_PIN // Chiron Standard Adapter #endif diff --git a/Marlin/src/pins/ramps/pins_TT_OSCAR.h b/Marlin/src/pins/ramps/pins_TT_OSCAR.h index d9c79f5da8ebe..1edeb6b8fedfe 100644 --- a/Marlin/src/pins/ramps/pins_TT_OSCAR.h +++ b/Marlin/src/pins/ramps/pins_TT_OSCAR.h @@ -279,7 +279,7 @@ #define LCD_PINS_EN 51 // SID (MOSI) #define LCD_PINS_D4 52 // SCK (CLK) clock - #elif BOTH(IS_NEWPANEL, PANEL_ONE) + #elif ALL(IS_NEWPANEL, PANEL_ONE) #define LCD_PINS_RS 40 #define LCD_PINS_EN 42 @@ -312,7 +312,7 @@ #else - #if EITHER(MKS_12864OLED, MKS_12864OLED_SSD1306) + #if ANY(MKS_12864OLED, MKS_12864OLED_SSD1306) #define LCD_PINS_DC 25 // Set as output on init #define LCD_PINS_RS 27 // Pull low for 1s to init // DOGM SPI LCD Support @@ -400,7 +400,7 @@ #define LCD_SDSS 53 #define SD_DETECT_PIN 49 - #elif EITHER(VIKI2, miniVIKI) + #elif ANY(VIKI2, miniVIKI) #define DOGLCD_CS 45 #define DOGLCD_A0 44 diff --git a/Marlin/src/pins/ramps/pins_ULTIMAKER_OLD.h b/Marlin/src/pins/ramps/pins_ULTIMAKER_OLD.h index a1b02aa06c738..0e3b25b4f670a 100644 --- a/Marlin/src/pins/ramps/pins_ULTIMAKER_OLD.h +++ b/Marlin/src/pins/ramps/pins_ULTIMAKER_OLD.h @@ -116,7 +116,7 @@ // // Z Probe (when not Z_MIN_PIN) // -#if !defined(Z_MIN_PROBE_PIN) && !BOTH(HAS_CUTTER, BOARD_REV_1_0) +#if !defined(Z_MIN_PROBE_PIN) && !ALL(HAS_CUTTER, BOARD_REV_1_0) #define Z_MIN_PROBE_PIN Z_MAX_PIN #endif @@ -135,7 +135,7 @@ #define Z_DIR_PIN 39 #define Z_ENABLE_PIN 35 -#if BOTH(HAS_CUTTER, BOARD_REV_1_1_TO_1_3) && EXTRUDERS == 1 +#if ALL(HAS_CUTTER, BOARD_REV_1_1_TO_1_3) && EXTRUDERS == 1 // Move E0 to the spare and get Spindle/Laser signals from E0 #define E0_STEP_PIN 49 #define E0_DIR_PIN 47 @@ -166,7 +166,7 @@ // // LCD / Controller // -#if EITHER(BOARD_REV_1_0, BOARD_REV_1_1_TO_1_3) +#if ANY(BOARD_REV_1_0, BOARD_REV_1_1_TO_1_3) #define LCD_PINS_RS 24 #define LCD_PINS_EN 22 @@ -175,7 +175,7 @@ #define LCD_PINS_D6 32 #define LCD_PINS_D7 30 -#elif BOTH(BOARD_REV_1_5, HAS_WIRED_LCD) +#elif ALL(BOARD_REV_1_5, HAS_WIRED_LCD) #define BEEPER_PIN 18 @@ -225,7 +225,7 @@ // M3/M4/M5 - Spindle/Laser Control // #if HAS_CUTTER - #if EITHER(BOARD_REV_1_0, BOARD_REV_1_5) // Use the last three SW positions + #if ANY(BOARD_REV_1_0, BOARD_REV_1_5) // Use the last three SW positions #define SPINDLE_LASER_PWM_PIN 9 // 1.0: SW5 1.5: EXP3-7 ( "9") .. MUST BE HARDWARE PWM #define SPINDLE_LASER_ENA_PIN 8 // 1.0: SW6 1.5: EXP3-8 ( "8") .. Pin should have a pullup! #define SPINDLE_DIR_PIN 10 // 1.0: SW4 1.5: EXP3-6 ("10") diff --git a/Marlin/src/pins/ramps/pins_ZRIB_V53.h b/Marlin/src/pins/ramps/pins_ZRIB_V53.h index 2b8b583075a3b..8d59eeb1f76dc 100644 --- a/Marlin/src/pins/ramps/pins_ZRIB_V53.h +++ b/Marlin/src/pins/ramps/pins_ZRIB_V53.h @@ -361,7 +361,7 @@ // OLED 128x64 //================================================================================ -#if EITHER(ZONESTAR_12864OLED, ZONESTAR_12864OLED_SSD1306) +#if ANY(ZONESTAR_12864OLED, ZONESTAR_12864OLED_SSD1306) #define LCDSCREEN_NAME "ZONESTAR 12864OLED" #define LCD_SDSS 16 #define LCD_PINS_RS 23 // RESET Pull low for 1s to init @@ -372,7 +372,7 @@ #define BTN_ENC 29 #define BEEPER_PIN -1 #define KILL_PIN -1 - #if EITHER(OLED_HW_IIC, OLED_HW_SPI) + #if ANY(OLED_HW_IIC, OLED_HW_SPI) #error "Oops! You must choose SW SPI for ZRIB V53 board and connect the OLED screen to EXP1 connector." #else // SW_SPI #define DOGLCD_A0 LCD_PINS_DC diff --git a/Marlin/src/pins/sam/env_validate.h b/Marlin/src/pins/sam/env_validate.h index c6f4d76894be5..c51583f0a13c6 100644 --- a/Marlin/src/pins/sam/env_validate.h +++ b/Marlin/src/pins/sam/env_validate.h @@ -22,7 +22,7 @@ #ifndef ENV_VALIDATE_H #define ENV_VALIDATE_H -#if BOTH(ALLOW_MEGA1280, ALLOW_MEGA2560) && NOT_TARGET(__SAM3X8E__, __AVR_ATmega1280__, __AVR_ATmega2560__) +#if ALL(ALLOW_MEGA1280, ALLOW_MEGA2560) && NOT_TARGET(__SAM3X8E__, __AVR_ATmega1280__, __AVR_ATmega2560__) #error "Oops! Select 'Arduino Due or Mega' in 'Tools > Board.'" #elif ENABLED(ALLOW_MEGA2560) && NOT_TARGET(__SAM3X8E__, __AVR_ATmega2560__) #error "Oops! Select 'Arduino Due or Mega' in 'Tools > Board.'" diff --git a/Marlin/src/pins/sam/pins_KRATOS32.h b/Marlin/src/pins/sam/pins_KRATOS32.h index f4e3eb479cce8..74da7a78f6251 100644 --- a/Marlin/src/pins/sam/pins_KRATOS32.h +++ b/Marlin/src/pins/sam/pins_KRATOS32.h @@ -32,7 +32,7 @@ // // EEPROM // -#if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM) +#if ANY(NO_EEPROM_SELECTED, I2C_EEPROM) #define I2C_EEPROM #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 93011679595fd..9a3edff0c9891 100644 --- a/Marlin/src/pins/sam/pins_RADDS.h +++ b/Marlin/src/pins/sam/pins_RADDS.h @@ -32,7 +32,7 @@ // // EEPROM // -#if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM) +#if ANY(NO_EEPROM_SELECTED, I2C_EEPROM) #define I2C_EEPROM #define MARLIN_EEPROM_SIZE 0x2000 // 8K #endif diff --git a/Marlin/src/pins/sam/pins_RAMPS_DUO.h b/Marlin/src/pins/sam/pins_RAMPS_DUO.h index 92de79bd7f232..b00d215cc7fb2 100644 --- a/Marlin/src/pins/sam/pins_RAMPS_DUO.h +++ b/Marlin/src/pins/sam/pins_RAMPS_DUO.h @@ -68,7 +68,7 @@ // #if HAS_WIRED_LCD - #if BOTH(IS_NEWPANEL, PANEL_ONE) + #if ALL(IS_NEWPANEL, PANEL_ONE) #undef LCD_PINS_D4 #define LCD_PINS_D4 68 diff --git a/Marlin/src/pins/sam/pins_RAMPS_FD_V1.h b/Marlin/src/pins/sam/pins_RAMPS_FD_V1.h index 8f206d9f876b4..f5587a6cbaa1b 100644 --- a/Marlin/src/pins/sam/pins_RAMPS_FD_V1.h +++ b/Marlin/src/pins/sam/pins_RAMPS_FD_V1.h @@ -191,7 +191,7 @@ #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) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN EXP1_05_PIN #endif @@ -219,7 +219,7 @@ #endif - #if EITHER(VIKI2, miniVIKI) + #if ANY(VIKI2, miniVIKI) #define DOGLCD_A0 EXP1_07_PIN #define KILL_PIN 51 #define STAT_LED_BLUE_PIN EXP1_03_PIN diff --git a/Marlin/src/pins/sam/pins_RURAMPS4D_11.h b/Marlin/src/pins/sam/pins_RURAMPS4D_11.h index 516063d158a9c..64fad0e081239 100644 --- a/Marlin/src/pins/sam/pins_RURAMPS4D_11.h +++ b/Marlin/src/pins/sam/pins_RURAMPS4D_11.h @@ -227,7 +227,7 @@ #define SD_DETECT_PIN EXP2_07_PIN #endif - #if EITHER(RADDS_DISPLAY, IS_RRD_SC) + #if ANY(RADDS_DISPLAY, IS_RRD_SC) #define LCD_PINS_RS EXP1_04_PIN #define LCD_PINS_EN EXP1_03_PIN @@ -254,7 +254,7 @@ #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) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN EXP1_06_PIN // D5 #endif diff --git a/Marlin/src/pins/sam/pins_RURAMPS4D_13.h b/Marlin/src/pins/sam/pins_RURAMPS4D_13.h index 9e9aeb9fec174..1b66b766db2c4 100644 --- a/Marlin/src/pins/sam/pins_RURAMPS4D_13.h +++ b/Marlin/src/pins/sam/pins_RURAMPS4D_13.h @@ -217,7 +217,7 @@ #define SD_DETECT_PIN EXP2_07_PIN #endif - #if EITHER(RADDS_DISPLAY, IS_RRD_SC) + #if ANY(RADDS_DISPLAY, IS_RRD_SC) #define LCD_PINS_RS EXP1_04_PIN #define LCD_PINS_EN EXP1_03_PIN @@ -244,7 +244,7 @@ #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) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN EXP1_06_PIN // D5 #endif 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 8af1054a2cd12..6f41bd6848c93 100644 --- a/Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h +++ b/Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h @@ -238,7 +238,7 @@ //#define LCD_PINS_EN EXP2_06_PIN // SID (MOSI) //#define LCD_PINS_D4 EXP2_02_PIN // SCK (CLK) clock - #elif BOTH(IS_NEWPANEL, PANEL_ONE) + #elif ALL(IS_NEWPANEL, PANEL_ONE) // TO TEST //#define LCD_PINS_RS EXP1_02_PIN @@ -274,7 +274,7 @@ #else - #if EITHER(MKS_12864OLED, MKS_12864OLED_SSD1306) + #if ANY(MKS_12864OLED, MKS_12864OLED_SSD1306) // TO TEST //#define LCD_PINS_DC 25 // Set as output on init //#define LCD_PINS_RS 27 // Pull low for 1s to init @@ -372,7 +372,7 @@ //#define LCD_SDSS SDSS //#define SD_DETECT_PIN EXP2_10_PIN - #elif EITHER(VIKI2, miniVIKI) + #elif ANY(VIKI2, miniVIKI) // TO TEST //#define DOGLCD_CS 45 @@ -407,7 +407,7 @@ //#define SD_DETECT_PIN EXP2_10_PIN //#define KILL_PIN EXP1_01_PIN - #elif EITHER(MKS_MINI_12864, FYSETC_MINI_12864) + #elif ANY(MKS_MINI_12864, FYSETC_MINI_12864) // TO TEST //#define BEEPER_PIN EXP1_06_PIN @@ -452,7 +452,7 @@ //#define LCD_RESET_PIN 23 // Must be high or open for LCD to operate normally. - #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN // TO TEST //#define RGB_LED_R_PIN 25 diff --git a/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h b/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h index 7378731c90719..699f10ed481e9 100644 --- a/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h +++ b/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h @@ -291,7 +291,7 @@ //#define LCD_PINS_EN EXP2_06_PIN // SID (MOSI) //#define LCD_PINS_D4 EXP2_02_PIN // SCK (CLK) clock - #elif BOTH(IS_NEWPANEL, PANEL_ONE) + #elif ALL(IS_NEWPANEL, PANEL_ONE) // TO TEST //#define LCD_PINS_RS EXP1_02_PIN @@ -327,7 +327,7 @@ #else - #if EITHER(MKS_12864OLED, MKS_12864OLED_SSD1306) + #if ANY(MKS_12864OLED, MKS_12864OLED_SSD1306) // TO TEST //#define LCD_PINS_DC 25 // Set as output on init //#define LCD_PINS_RS 27 // Pull low for 1s to init @@ -424,7 +424,7 @@ //#define LCD_SDSS SDSS //#define SD_DETECT_PIN EXP2_10_PIN - #elif EITHER(VIKI2, miniVIKI) + #elif ANY(VIKI2, miniVIKI) // TO TEST //#define DOGLCD_CS 45 @@ -459,7 +459,7 @@ //#define SD_DETECT_PIN EXP2_10_PIN //#define KILL_PIN EXP1_01_PIN - #elif EITHER(MKS_MINI_12864, FYSETC_MINI_12864) + #elif ANY(MKS_MINI_12864, FYSETC_MINI_12864) // TO TEST //#define BEEPER_PIN EXP1_06_PIN @@ -504,7 +504,7 @@ //#define LCD_RESET_PIN 23 // Must be high or open for LCD to operate normally. - #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN // TO TEST //#define RGB_LED_R_PIN 25 diff --git a/Marlin/src/pins/samd/pins_MINITRONICS20.h b/Marlin/src/pins/samd/pins_MINITRONICS20.h index 804750b69a3da..8c0daa497b014 100644 --- a/Marlin/src/pins/samd/pins_MINITRONICS20.h +++ b/Marlin/src/pins/samd/pins_MINITRONICS20.h @@ -197,7 +197,7 @@ #define BTN_EN1 27 #define BTN_EN2 33 - #elif BOTH(IS_NEWPANEL, PANEL_ONE) + #elif ALL(IS_NEWPANEL, PANEL_ONE) // TO TEST //#define LCD_PINS_RS EXP1_02_PIN @@ -233,7 +233,7 @@ #else - #if EITHER(MKS_12864OLED, MKS_12864OLED_SSD1306) + #if ANY(MKS_12864OLED, MKS_12864OLED_SSD1306) // TO TEST //#define LCD_PINS_DC 25 // Set as output on init //#define LCD_PINS_RS 27 // Pull low for 1s to init @@ -322,7 +322,7 @@ //#define LCD_SDSS SDSS //#define SD_DETECT_PIN EXP2_10_PIN - #elif EITHER(VIKI2, miniVIKI) + #elif ANY(VIKI2, miniVIKI) // TO TEST //#define DOGLCD_CS 45 @@ -357,7 +357,7 @@ //#define SD_DETECT_PIN EXP2_10_PIN //#define KILL_PIN EXP1_01_PIN - #elif EITHER(MKS_MINI_12864, FYSETC_MINI_12864) + #elif ANY(MKS_MINI_12864, FYSETC_MINI_12864) // TO TEST //#define BEEPER_PIN EXP1_06_PIN @@ -402,7 +402,7 @@ //#define LCD_RESET_PIN 23 // Must be high or open for LCD to operate normally. - #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN // TO TEST //#define RGB_LED_R_PIN 25 diff --git a/Marlin/src/pins/samd/pins_RAMPS_144.h b/Marlin/src/pins/samd/pins_RAMPS_144.h index a762d3cdbdccf..3e5d563929eda 100644 --- a/Marlin/src/pins/samd/pins_RAMPS_144.h +++ b/Marlin/src/pins/samd/pins_RAMPS_144.h @@ -276,7 +276,7 @@ //#define LCD_PINS_EN 51 // SID (MOSI) //#define LCD_PINS_D4 52 // SCK (CLK) clock - #elif BOTH(IS_NEWPANEL, PANEL_ONE) + #elif ALL(IS_NEWPANEL, PANEL_ONE) // TO TEST //#define LCD_PINS_RS 40 @@ -312,7 +312,7 @@ #else - #if EITHER(MKS_12864OLED, MKS_12864OLED_SSD1306) + #if ANY(MKS_12864OLED, MKS_12864OLED_SSD1306) // TO TEST //#define LCD_PINS_DC 25 // Set as output on init //#define LCD_PINS_RS 27 // Pull low for 1s to init @@ -406,7 +406,7 @@ //#define LCD_SDSS SDSS //#define SD_DETECT_PIN 49 - #elif EITHER(VIKI2, miniVIKI) + #elif ANY(VIKI2, miniVIKI) // TO TEST //#define DOGLCD_CS 45 @@ -442,7 +442,7 @@ //#define SD_DETECT_PIN 49 //#define KILL_PIN 41 - #elif EITHER(MKS_MINI_12864, FYSETC_MINI_12864) + #elif ANY(MKS_MINI_12864, FYSETC_MINI_12864) // TO TEST //#define BEEPER_PIN 37 @@ -483,7 +483,7 @@ //#define LCD_RESET_PIN 23 // Must be high or open for LCD to operate normally. - #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN // TO TEST //#define RGB_LED_R_PIN 25 diff --git a/Marlin/src/pins/sanguino/pins_MELZI_CREALITY_E2.h b/Marlin/src/pins/sanguino/pins_MELZI_CREALITY_E2.h index 0d021e1bf694f..4ded3294b950a 100644 --- a/Marlin/src/pins/sanguino/pins_MELZI_CREALITY_E2.h +++ b/Marlin/src/pins/sanguino/pins_MELZI_CREALITY_E2.h @@ -56,7 +56,7 @@ // // LCD / Controller // -#if EITHER(CR10_STOCKDISPLAY, ENDER2_STOCKDISPLAY) +#if ANY(CR10_STOCKDISPLAY, ENDER2_STOCKDISPLAY) #if ENABLED(CR10_STOCKDISPLAY) #if ENABLED(SDSUPPORT) #error "Cannot have SDSUPPORT with CR10_STOCKDISPLAY on this motherboard." // Hardware SDCARD SCK and MOSI pins are reallocated. diff --git a/Marlin/src/pins/sanguino/pins_MELZI_TRONXY.h b/Marlin/src/pins/sanguino/pins_MELZI_TRONXY.h index 6b47d9186c413..7e4cc22bbe8f1 100644 --- a/Marlin/src/pins/sanguino/pins_MELZI_TRONXY.h +++ b/Marlin/src/pins/sanguino/pins_MELZI_TRONXY.h @@ -32,7 +32,7 @@ #define LCD_SDSS -1 -#if EITHER(CR10_STOCKDISPLAY, LCD_FOR_MELZI) +#if ANY(CR10_STOCKDISPLAY, LCD_FOR_MELZI) #define LCD_PINS_RS 30 #define LCD_PINS_EN 28 #define LCD_PINS_D4 16 diff --git a/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_11.h b/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_11.h index 9a80ca2e63aa5..b99437ac93e59 100644 --- a/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_11.h +++ b/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_11.h @@ -133,7 +133,7 @@ #define LCD_BACKLIGHT_PIN 17 // LCD backlight LED #endif -#if !HAS_CUTTER && ENABLED(SANGUINOLOLU_V_1_2) && !BOTH(HAS_WIRED_LCD, IS_NEWPANEL) // try to use IO Header +#if !HAS_CUTTER && ENABLED(SANGUINOLOLU_V_1_2) && !ALL(HAS_WIRED_LCD, IS_NEWPANEL) // try to use IO Header #define CASE_LIGHT_PIN 4 // Hardware PWM - see if IO Header is available #endif @@ -270,7 +270,7 @@ // M3/M4/M5 - Spindle/Laser Control // #if HAS_CUTTER - #if !MB(AZTEEG_X1) && ENABLED(SANGUINOLOLU_V_1_2) && !BOTH(HAS_WIRED_LCD, IS_NEWPANEL) // try to use IO Header + #if !MB(AZTEEG_X1) && ENABLED(SANGUINOLOLU_V_1_2) && !ALL(HAS_WIRED_LCD, IS_NEWPANEL) // try to use IO Header #define SPINDLE_LASER_PWM_PIN 4 // Hardware PWM #define SPINDLE_LASER_ENA_PIN 10 // Pullup or pulldown! diff --git a/Marlin/src/pins/sanguino/pins_ZMIB_V2.h b/Marlin/src/pins/sanguino/pins_ZMIB_V2.h index 1e449579cf402..438acb79c7897 100644 --- a/Marlin/src/pins/sanguino/pins_ZMIB_V2.h +++ b/Marlin/src/pins/sanguino/pins_ZMIB_V2.h @@ -92,7 +92,7 @@ #define X_MIN_PIN 21 #define Y_MIN_PIN 18 -#if EITHER(Z6S_ZFAULT, Z6BS_ZFAULT) +#if ANY(Z6S_ZFAULT, Z6BS_ZFAULT) #define Z_MIN_PIN 25 #else #define Z_MIN_PIN 13 @@ -109,7 +109,7 @@ #define Y_DIR_PIN 19 #define Y_ENABLE_PIN 24 -#if EITHER(Z6S_ZFAULT, Z6BS_ZFAULT) +#if ANY(Z6S_ZFAULT, Z6BS_ZFAULT) #define Z_STEP_PIN 27 #define Z_DIR_PIN 26 #else @@ -119,7 +119,7 @@ #define Z_ENABLE_PIN 24 -#if EITHER(Z6S_ZFAULT, Z6BS_ZFAULT) +#if ANY(Z6S_ZFAULT, Z6BS_ZFAULT) #define E0_STEP_PIN 15 #define E0_DIR_PIN 14 #else @@ -150,7 +150,7 @@ // // Filament Runout Sensor // -#if EITHER(Z6S_ZFAULT, Z6BS_ZFAULT) +#if ANY(Z6S_ZFAULT, Z6BS_ZFAULT) #define FIL_RUNOUT_PIN 13 #else #define FIL_RUNOUT_PIN 25 // Z-MIN @@ -201,7 +201,7 @@ #define BOARD_ST7920_DELAY_2 DELAY_2_NOP #define BOARD_ST7920_DELAY_3 DELAY_2_NOP -#elif EITHER(ZONESTAR_12864OLED, ZONESTAR_12864OLED_SSD1306) +#elif ANY(ZONESTAR_12864OLED, ZONESTAR_12864OLED_SSD1306) // // OLED 128x64 // diff --git a/Marlin/src/pins/sensitive_pins.h b/Marlin/src/pins/sensitive_pins.h index e655663a73d40..7264a26539683 100644 --- a/Marlin/src/pins/sensitive_pins.h +++ b/Marlin/src/pins/sensitive_pins.h @@ -650,7 +650,7 @@ #endif #endif -#elif EITHER(HAS_MULTI_EXTRUDER, MIXING_EXTRUDER) +#elif ANY(HAS_MULTI_EXTRUDER, MIXING_EXTRUDER) #undef _E1_PINS #define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, _E1_CS _E1_MS1 _E1_MS2 _E1_MS3 diff --git a/Marlin/src/pins/stm32f1/pins_BEAST.h b/Marlin/src/pins/stm32f1/pins_BEAST.h index eca4529636ba2..b136ca52cd705 100644 --- a/Marlin/src/pins/stm32f1/pins_BEAST.h +++ b/Marlin/src/pins/stm32f1/pins_BEAST.h @@ -131,7 +131,7 @@ #error "LCD_I2C_PANELOLU2 is not supported." #elif ENABLED(LCD_I2C_VIKI) #error "LCD_I2C_VIKI is not supported." - #elif EITHER(VIKI2, miniVIKI) + #elif ANY(VIKI2, miniVIKI) #error "VIKI2 / miniVIKI is not supported." #elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) #error "ELB_FULL_GRAPHIC_CONTROLLER is not supported." 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 5f3dc781503d6..8be66eedb5707 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h @@ -31,7 +31,7 @@ // Ignore temp readings during development. //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000 -#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) +#if ANY(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION #define EEPROM_PAGE_SIZE (0x800U) // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) @@ -204,7 +204,7 @@ #define LCD_PINS_D7 EXP1_01_PIN #define ADC_KEYPAD_PIN PA1 // Repurpose servo pin for ADC - CONNECTING TO 5V WILL DAMAGE THE BOARD! - #elif EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY) + #elif ANY(MKS_MINI_12864, ENDER2_STOCKDISPLAY) /** Creality Ender-2 display pinout * ------ @@ -296,7 +296,7 @@ #endif // HAS_WIRED_LCD -#if BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) +#if ALL(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) #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.)" @@ -352,7 +352,7 @@ #define SD_SCK_PIN PA5 #define SD_MISO_PIN PA6 #define SD_MOSI_PIN PA7 -#elif SD_CONNECTION_IS(LCD) && BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) +#elif SD_CONNECTION_IS(LCD) && ALL(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) #define SD_DETECT_PIN EXP1_01_PIN #define SD_SS_PIN EXP1_05_PIN #elif SD_CONNECTION_IS(CUSTOM_CABLE) 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 45829d2eded22..c86e2f7504521 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 @@ -31,7 +31,7 @@ // Ignore temp readings during development. //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000 -#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) +#if ANY(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION #define EEPROM_PAGE_SIZE (0x800U) // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) @@ -217,7 +217,7 @@ #define LCD_PINS_D7 EXP1_01_PIN #define ADC_KEYPAD_PIN PA1 // Repurpose servo pin for ADC - CONNECTING TO 5V WILL DAMAGE THE BOARD! - #elif EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY) + #elif ANY(MKS_MINI_12864, ENDER2_STOCKDISPLAY) #define BTN_ENC EXP1_02_PIN #define BTN_EN1 EXP1_03_PIN @@ -342,7 +342,7 @@ #endif // HAS_WIRED_LCD -#if BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) +#if ALL(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) #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.)" @@ -396,7 +396,7 @@ #if SD_CONNECTION_IS(ONBOARD) #define SD_DETECT_PIN PC4 -#elif SD_CONNECTION_IS(LCD) && (BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) || IS_TFTGLCD_PANEL) +#elif SD_CONNECTION_IS(LCD) && (ALL(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) || IS_TFTGLCD_PANEL) #define SD_DETECT_PIN EXP1_01_PIN #define SD_SS_PIN EXP1_05_PIN #elif SD_CONNECTION_IS(CUSTOM_CABLE) 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 851eee8296b2d..6719b090495ba 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 @@ -31,7 +31,7 @@ // Ignore temp readings during development. //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000 -#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) +#if ANY(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION #define EEPROM_PAGE_SIZE (0x800U) // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) @@ -142,7 +142,7 @@ // // LCD / Controller // -#if EITHER(TFT_COLOR_UI, TFT_CLASSIC_UI) +#if ANY(TFT_COLOR_UI, TFT_CLASSIC_UI) #define BEEPER_PIN EXP1_01_PIN #define BTN_ENC EXP1_02_PIN #define BTN_EN1 EXP2_03_PIN @@ -221,7 +221,7 @@ //#define LED_PIN EXP1_07_PIN // green //#define LED_PIN EXP1_08_PIN // blue - //#if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) + //#if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) // #ifndef RGB_LED_R_PIN // #define RGB_LED_R_PIN EXP1_06_PIN // #endif diff --git a/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h b/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h index 015d8c03ee2b6..1d501e512b260 100644 --- a/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h +++ b/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h @@ -41,7 +41,7 @@ // // EEPROM // -#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) +#if ANY(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION #define EEPROM_PAGE_SIZE 0x800U // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) diff --git a/Marlin/src/pins/stm32f1/pins_CHITU3D.h b/Marlin/src/pins/stm32f1/pins_CHITU3D.h index 73030c8ef6ebc..2074bbeccec11 100644 --- a/Marlin/src/pins/stm32f1/pins_CHITU3D.h +++ b/Marlin/src/pins/stm32f1/pins_CHITU3D.h @@ -104,7 +104,7 @@ #define LCD_PINS_RS PD1 // 49 // CS chip select /SS chip slave select #define LCD_PINS_EN PD3 // 51 // SID (MOSI) #define LCD_PINS_D4 PD4 // 52 // SCK (CLK) clock - #elif BOTH(IS_NEWPANEL, PANEL_ONE) + #elif ALL(IS_NEWPANEL, PANEL_ONE) #define LCD_PINS_RS PB8 #define LCD_PINS_EN PD2 #define LCD_PINS_D4 PB12 @@ -171,7 +171,7 @@ #define LCD_SDSS PD5 // 53 #define SD_DETECT_PIN PD1 // 49 - #elif EITHER(VIKI2, miniVIKI) + #elif ANY(VIKI2, miniVIKI) #define BEEPER_PIN PC1 // 33 diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h index af9a6d891e31f..ce942ba5450e3 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h @@ -33,7 +33,7 @@ #define E_ERROR 1 #endif -#if BOTH(BLTOUCH, Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) +#if ALL(BLTOUCH, Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) #error "Disable Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN when using BLTOUCH with Creality V24S1-301." #endif diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V25S1.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V25S1.h index f78bad624d288..5657a79950271 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V25S1.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V25S1.h @@ -52,7 +52,7 @@ #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) +#elif ANY(SDCARD_EEPROM_EMULATION, FLASH_EEPROM_EMULATION) #define MARLIN_EEPROM_SIZE 0x800 // 2K #endif diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h index 3d0a1885af75c..96b3007ca650a 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h @@ -183,7 +183,7 @@ #define EXP3_07_PIN PB12 #define EXP3_08_PIN PB15 -#elif EITHER(VET6_12864_LCD, DWIN_VET6_CREALITY_LCD) +#elif ANY(VET6_12864_LCD, DWIN_VET6_CREALITY_LCD) /** * VET6 12864 LCD @@ -204,7 +204,7 @@ #define EXP3_07_PIN PA4 #define EXP3_08_PIN PA7 -#elif EITHER(CR10_STOCKDISPLAY, FYSETC_MINI_12864_2_1) +#elif ANY(CR10_STOCKDISPLAY, FYSETC_MINI_12864_2_1) #error "Define RET6_12864_LCD or VET6_12864_LCD to select pins for the LCD with the Creality V4 controller." #endif diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h index 7a7ec355084fc..2e0de876410b2 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h @@ -164,7 +164,7 @@ #define EXP3_07_PIN PB12 #define EXP3_08_PIN PB15 -#elif EITHER(VET6_12864_LCD, DWIN_VET6_CREALITY_LCD) +#elif ANY(VET6_12864_LCD, DWIN_VET6_CREALITY_LCD) /** * VET6 12864 LCD diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V521.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V521.h index 81cb1e1f790e4..d555c0aaa12d4 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V521.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V521.h @@ -168,7 +168,7 @@ #define EXP3_07_PIN PB12 #define EXP3_08_PIN PB15 -#elif EITHER(VET6_12864_LCD, DWIN_VET6_CREALITY_LCD) +#elif ANY(VET6_12864_LCD, DWIN_VET6_CREALITY_LCD) /** * VET6 12864 LCD diff --git a/Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h b/Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h index 7a1f1e6cce32a..b18bd09de8943 100644 --- a/Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h @@ -39,7 +39,7 @@ #define DISABLE_JTAG //#define ENABLE_SPI3 -#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) +#if ANY(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION #define EEPROM_PAGE_SIZE (0x800U) // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) @@ -98,7 +98,7 @@ #define FAN1_PIN PD12 #elif DISABLED(FET_ORDER_SF) // Not Spindle, Fan (i.e., "EFBF" or "EFBE") #define HEATER_BED_PIN PD12 - #if EITHER(HAS_MULTI_HOTEND, HEATERS_PARALLEL) + #if ANY(HAS_MULTI_HOTEND, HEATERS_PARALLEL) #define HEATER_1_PIN PB9 #else #define FAN1_PIN PB9 @@ -106,9 +106,9 @@ #endif #ifndef FAN0_PIN - #if EITHER(FET_ORDER_EFB, FET_ORDER_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan + #if ANY(FET_ORDER_EFB, FET_ORDER_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan #define FAN0_PIN PB5 - #elif EITHER(FET_ORDER_EEF, FET_ORDER_SF) // Hotend, Hotend, Fan or Spindle, Fan + #elif ANY(FET_ORDER_EEF, FET_ORDER_SF) // Hotend, Hotend, Fan or Spindle, Fan #define FAN0_PIN PD12 #elif ENABLED(FET_ORDER_EEB) // Hotend, Hotend, Bed #define FAN0_PIN -1 // IO pin. Buffer needed diff --git a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h index bdfe24cad0109..a0c2ed1dc8274 100644 --- a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h +++ b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h @@ -51,7 +51,7 @@ // // EEPROM // -#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) +#if ANY(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION #define EEPROM_PAGE_SIZE (0x800U) // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) diff --git a/Marlin/src/pins/stm32f1/pins_FLY_MINI.h b/Marlin/src/pins/stm32f1/pins_FLY_MINI.h index f7ef25419fd14..69e11be20cf52 100644 --- a/Marlin/src/pins/stm32f1/pins_FLY_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_FLY_MINI.h @@ -30,7 +30,7 @@ // // Flash EEPROM Emulation // -#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) +#if ANY(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION #define EEPROM_PAGE_SIZE 0x800 // 2K #define EEPROM_START_ADDRESS (0x8000000 + 256 * 1024 - 2 * EEPROM_PAGE_SIZE) // 256K firmware space diff --git a/Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h b/Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h index c4fde59c47dd1..93ef7b75d4e7c 100644 --- a/Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h +++ b/Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h @@ -38,7 +38,7 @@ // // Flash EEPROM Emulation // -#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) +#if ANY(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION #define EEPROM_PAGE_SIZE (0x800U) // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) diff --git a/Marlin/src/pins/stm32f1/pins_FYSETC_CHEETAH.h b/Marlin/src/pins/stm32f1/pins_FYSETC_CHEETAH.h index 47bea172a8aa3..49b6f25a47e6e 100644 --- a/Marlin/src/pins/stm32f1/pins_FYSETC_CHEETAH.h +++ b/Marlin/src/pins/stm32f1/pins_FYSETC_CHEETAH.h @@ -35,7 +35,7 @@ #define RESET_STEPPERS_ON_MEDIA_INSERT #define DISABLE_JTAG -#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) +#if ANY(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION #define EEPROM_PAGE_SIZE (0x800U) // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) @@ -164,7 +164,7 @@ #define DOGLCD_SCK EXP1_06_PIN #define DOGLCD_MOSI EXP1_08_PIN - #if EITHER(FYSETC_MINI_12864, U8GLIB_ST7920) + #if ANY(FYSETC_MINI_12864, U8GLIB_ST7920) #define FORCE_SOFT_SPI #endif //#define LCD_SCREEN_ROTATE 180 // 0, 90, 180, 270 diff --git a/Marlin/src/pins/stm32f1/pins_GTM32_MINI.h b/Marlin/src/pins/stm32f1/pins_GTM32_MINI.h index 9c136c11f65aa..b97ccc8ec738b 100644 --- a/Marlin/src/pins/stm32f1/pins_GTM32_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_GTM32_MINI.h @@ -51,7 +51,7 @@ //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000 // Enable EEPROM Emulation for this board as it doesn't have EEPROM -#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) +#if ANY(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION #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 2cd77f42b2046..4bb8c5dee627f 100644 --- a/Marlin/src/pins/stm32f1/pins_GTM32_MINI_A30.h +++ b/Marlin/src/pins/stm32f1/pins_GTM32_MINI_A30.h @@ -51,7 +51,7 @@ //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000 // Enable EEPROM Emulation for this board as it doesn't have EEPROM -#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) +#if ANY(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION #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 5e012c177d44d..57abf7aca79e3 100644 --- a/Marlin/src/pins/stm32f1/pins_GTM32_PRO_VB.h +++ b/Marlin/src/pins/stm32f1/pins_GTM32_PRO_VB.h @@ -56,7 +56,7 @@ //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000 // Enable EEPROM Emulation for this board as it doesn't have EEPROM -#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) +#if ANY(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION #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 8a0f15806e771..34f7dba91f9cb 100644 --- a/Marlin/src/pins/stm32f1/pins_GTM32_REV_B.h +++ b/Marlin/src/pins/stm32f1/pins_GTM32_REV_B.h @@ -51,7 +51,7 @@ //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000 // Enable EEPROM Emulation for this board as it doesn't have EEPROM -#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) +#if ANY(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION #define MARLIN_EEPROM_SIZE 0x1000 // 4K #endif diff --git a/Marlin/src/pins/stm32f1/pins_KEDI_CONTROLLER_V1_2.h b/Marlin/src/pins/stm32f1/pins_KEDI_CONTROLLER_V1_2.h index c18085755c328..9b20700adb52d 100644 --- a/Marlin/src/pins/stm32f1/pins_KEDI_CONTROLLER_V1_2.h +++ b/Marlin/src/pins/stm32f1/pins_KEDI_CONTROLLER_V1_2.h @@ -31,7 +31,7 @@ // Ignore temp readings during development. //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000 -#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) +#if ANY(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION #define EEPROM_PAGE_SIZE (0x800U) // 2KB #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) @@ -228,7 +228,7 @@ //#define LED_PIN EXP1_04_PIN // green //#define LED_PIN EXP1_03_PIN // blue - //#if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) + //#if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) // #ifndef RGB_LED_R_PIN // #define RGB_LED_R_PIN EXP1_05_PIN // #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 c86552ba12add..6add3ca01c122 100644 --- a/Marlin/src/pins/stm32f1/pins_MINGDA_MPX_ARM_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_MINGDA_MPX_ARM_MINI.h @@ -51,7 +51,7 @@ #define E2END 0xFFFF // EEPROM end address AT24C256 (32kB) */ -#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) +#if ANY(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION #define EEPROM_PAGE_SIZE 0x800U // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h index 6892655e468f8..c7a8da2ddccec 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h @@ -52,7 +52,7 @@ //#define FLASH_EEPROM_EMULATION //#define SDCARD_EEPROM_EMULATION -#if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM) +#if ANY(NO_EEPROM_SELECTED, I2C_EEPROM) #define I2C_EEPROM // EEPROM on I2C-0 #define MARLIN_EEPROM_SIZE 0x1000 // 4K #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 a8583e92d7e69..c3becd3fa1aa9 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h @@ -38,7 +38,7 @@ // // EEPROM // -#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) +#if ANY(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION #define EEPROM_PAGE_SIZE (0x800U) // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h index 372da38c628ad..85c8de26ad704 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h @@ -43,7 +43,7 @@ // // EEPROM // -#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) +#if ANY(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION #define EEPROM_PAGE_SIZE (0x800U) // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) 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 956e9dc72ef1e..983cb6adedeb5 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 @@ //#define FLASH_EEPROM_EMULATION //#define SDCARD_EEPROM_EMULATION -#if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM) +#if ANY(NO_EEPROM_SELECTED, I2C_EEPROM) #define I2C_EEPROM // EEPROM on I2C-0 #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 69eee63007c50..16ee7757b95b7 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h @@ -42,7 +42,7 @@ #if ENABLED(SRAM_EEPROM_EMULATION) #undef NO_EEPROM_SELECTED #endif -#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) +#if ANY(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION #define EEPROM_PAGE_SIZE (0x800U) // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) diff --git a/Marlin/src/pins/stm32f1/pins_PANDA_PI_V29.h b/Marlin/src/pins/stm32f1/pins_PANDA_PI_V29.h index 2ce878ea593cd..4c65ce9f64560 100644 --- a/Marlin/src/pins/stm32f1/pins_PANDA_PI_V29.h +++ b/Marlin/src/pins/stm32f1/pins_PANDA_PI_V29.h @@ -31,7 +31,7 @@ // Ignore temp readings during development. //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000 -#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) +#if ANY(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION #define EEPROM_PAGE_SIZE (0x800U) // 2K #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) @@ -178,7 +178,7 @@ #define LCD_PINS_D4 PC1 #endif -#if BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) +#if ALL(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) #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.)" @@ -219,7 +219,7 @@ #define CLCD_MOD_RESET PA9 #define CLCD_SPI_CS PB8 - #if SD_CONNECTION_IS(LCD) && BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) + #if SD_CONNECTION_IS(LCD) && ALL(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) #define SD_DETECT_PIN PA15 #define SD_SS_PIN PA10 #endif diff --git a/Marlin/src/pins/stm32f1/pins_STM32F1R.h b/Marlin/src/pins/stm32f1/pins_STM32F1R.h index 46bd48f93fb36..a2efa632f8c87 100644 --- a/Marlin/src/pins/stm32f1/pins_STM32F1R.h +++ b/Marlin/src/pins/stm32f1/pins_STM32F1R.h @@ -120,7 +120,7 @@ #error "LCD_I2C_PANELOLU2 is not supported." #elif ENABLED(LCD_I2C_VIKI) #error "LCD_I2C_VIKI is not supported." - #elif EITHER(VIKI2, miniVIKI) + #elif ANY(VIKI2, miniVIKI) #error "VIKI2 / miniVIKI is not supported." #elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) #error "ELB_FULL_GRAPHIC_CONTROLLER is not supported." diff --git a/Marlin/src/pins/stm32f1/pins_STM3R_MINI.h b/Marlin/src/pins/stm32f1/pins_STM3R_MINI.h index 4cf464aaeeca9..b4cf21ee7f04a 100644 --- a/Marlin/src/pins/stm32f1/pins_STM3R_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_STM3R_MINI.h @@ -144,7 +144,7 @@ #error "LCD_I2C_PANELOLU2 is not supported." #elif ENABLED(LCD_I2C_VIKI) #error "LCD_I2C_VIKI is not supported." - #elif EITHER(VIKI2, miniVIKI) + #elif ANY(VIKI2, miniVIKI) #error "VIKI2 / miniVIKI is not supported." #elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) #error "ELB_FULL_GRAPHIC_CONTROLLER is not supported." diff --git a/Marlin/src/pins/stm32f1/pins_ZM3E2_V1_0.h b/Marlin/src/pins/stm32f1/pins_ZM3E2_V1_0.h index 08491fc21cbc9..8ce0f48839de6 100644 --- a/Marlin/src/pins/stm32f1/pins_ZM3E2_V1_0.h +++ b/Marlin/src/pins/stm32f1/pins_ZM3E2_V1_0.h @@ -205,7 +205,7 @@ #define BOARD_ST7920_DELAY_2 200 #define BOARD_ST7920_DELAY_3 125 -#elif EITHER(ZONESTAR_12864OLED, ZONESTAR_12864OLED_SSD1306) +#elif ANY(ZONESTAR_12864OLED, ZONESTAR_12864OLED_SSD1306) //================================================================================ // OLED 128x64 diff --git a/Marlin/src/pins/stm32f4/pins_ARMED.h b/Marlin/src/pins/stm32f4/pins_ARMED.h index 9a04c80cdd5e4..b4661226380f4 100644 --- a/Marlin/src/pins/stm32f4/pins_ARMED.h +++ b/Marlin/src/pins/stm32f4/pins_ARMED.h @@ -158,7 +158,7 @@ #define LCD_RESET_PIN PB12 // Must be high or open for LCD to operate normally. - #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN PB13 #endif diff --git a/Marlin/src/pins/stm32f4/pins_ARTILLERY_RUBY.h b/Marlin/src/pins/stm32f4/pins_ARTILLERY_RUBY.h index 8510e8148259c..02ad9bb4ad763 100644 --- a/Marlin/src/pins/stm32f4/pins_ARTILLERY_RUBY.h +++ b/Marlin/src/pins/stm32f4/pins_ARTILLERY_RUBY.h @@ -126,7 +126,7 @@ // LCD / Controller // #if HAS_WIRED_LCD - #if EITHER(MKS_12864OLED, MKS_12864OLED_SSD1306) + #if ANY(MKS_12864OLED, MKS_12864OLED_SSD1306) #define LCD_PINS_DC PB8 // Set as output on init #define LCD_PINS_RS PB9 // Pull low for 1s to init // DOGM SPI LCD Support @@ -143,7 +143,7 @@ #define LCD_RESET_PIN PB5 // Must be high or open for LCD to operate normally. - #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN PB9 #endif 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 ce3d2556bffdb..bc80720916fba 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h @@ -287,7 +287,7 @@ #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) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN EXP1_06_PIN #endif diff --git a/Marlin/src/pins/stm32f4/pins_BTT_E3_RRF.h b/Marlin/src/pins/stm32f4/pins_BTT_E3_RRF.h index d737dbdc93391..4350fad7f78f2 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_E3_RRF.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_E3_RRF.h @@ -196,7 +196,7 @@ #if HAS_WIRED_LCD - #if EITHER(CR10_STOCKDISPLAY, LCD_FOR_MELZI) + #if ANY(CR10_STOCKDISPLAY, LCD_FOR_MELZI) #define BEEPER_PIN PE8 @@ -258,7 +258,7 @@ #define LCD_PINS_D7 PE8 #define ADC_KEYPAD_PIN PB0 // Repurpose servo pin for ADC - CONNECTING TO 5V WILL DAMAGE THE BOARD! - #elif EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY) + #elif ANY(MKS_MINI_12864, ENDER2_STOCKDISPLAY) #define BTN_ENC PE9 #define BTN_EN1 PE7 @@ -330,7 +330,7 @@ #endif // HAS_WIRED_LCD -#if BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) +#if ALL(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) #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.)" 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 0445476490de5..2414c07ae3632 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h @@ -464,7 +464,7 @@ //#define LCD_BACKLIGHT_PIN -1 #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) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN EXP1_06_PIN #endif 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 29c1e9f984e46..4cfb8e7b7ea6a 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h @@ -27,7 +27,7 @@ #define USES_DIAG_JUMPERS // Onboard I2C EEPROM -#if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM) +#if ANY(NO_EEPROM_SELECTED, I2C_EEPROM) #undef NO_EEPROM_SELECTED #define I2C_EEPROM #define MARLIN_EEPROM_SIZE 0x1000 // 4K (AT24C32) @@ -467,7 +467,7 @@ #define DOGLCD_A0 EXP1_04_PIN //#define LCD_BACKLIGHT_PIN -1 #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) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN EXP1_06_PIN #endif diff --git a/Marlin/src/pins/stm32f4/pins_BTT_SKR_MINI_E3_V3_0_1.h b/Marlin/src/pins/stm32f4/pins_BTT_SKR_MINI_E3_V3_0_1.h index 6f2de83b5142a..64ab2dd6c9e8a 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_SKR_MINI_E3_V3_0_1.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_MINI_E3_V3_0_1.h @@ -43,7 +43,7 @@ #endif // Onboard I2C EEPROM -#if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM) +#if ANY(NO_EEPROM_SELECTED, I2C_EEPROM) #undef NO_EEPROM_SELECTED #define I2C_EEPROM #define SOFT_I2C_EEPROM // Force the use of Software I2C @@ -219,7 +219,7 @@ #define LCD_PINS_D7 EXP1_01_PIN #define ADC_KEYPAD_PIN PA1 // Repurpose servo pin for ADC - CONNECTING TO 5V WILL DAMAGE THE BOARD! - #elif EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY) + #elif ANY(MKS_MINI_12864, ENDER2_STOCKDISPLAY) #define BTN_ENC EXP1_02_PIN #define BTN_EN1 EXP1_03_PIN @@ -280,7 +280,7 @@ #endif // HAS_WIRED_LCD -#if BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) +#if ALL(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) #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.)" @@ -332,7 +332,7 @@ #define SDCARD_CONNECTION ONBOARD #endif -#if SD_CONNECTION_IS(LCD) && (BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) || IS_TFTGLCD_PANEL) +#if SD_CONNECTION_IS(LCD) && (ALL(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) || IS_TFTGLCD_PANEL) #define SD_DETECT_PIN EXP1_01_PIN #define SD_SS_PIN EXP1_05_PIN #elif SD_CONNECTION_IS(CUSTOM_CABLE) 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 407d89f60b358..f2fbdb9ece748 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h @@ -29,8 +29,8 @@ // 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) +#if ALL(HAS_WIRED_LCD, BTT_MOTOR_EXPANSION) + #if ANY(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." @@ -505,7 +505,7 @@ #define DOGLCD_A0 EXP1_04_PIN //#define LCD_BACKLIGHT_PIN -1 #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) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN EXP1_06_PIN #endif 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 05537ec243a40..055338f45b38f 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 @@ -29,8 +29,8 @@ // 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) +#if ALL(HAS_WIRED_LCD, BTT_MOTOR_EXPANSION) + #if ANY(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." @@ -484,7 +484,7 @@ #define DOGLCD_A0 EXP1_04_PIN //#define LCD_BACKLIGHT_PIN -1 #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) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN EXP1_06_PIN #endif diff --git a/Marlin/src/pins/stm32f4/pins_FYSETC_CHEETAH_V20.h b/Marlin/src/pins/stm32f4/pins_FYSETC_CHEETAH_V20.h index 626bdcde76215..16973b344fb3a 100644 --- a/Marlin/src/pins/stm32f4/pins_FYSETC_CHEETAH_V20.h +++ b/Marlin/src/pins/stm32f4/pins_FYSETC_CHEETAH_V20.h @@ -34,7 +34,7 @@ // Ignore temp readings during development. //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000 -#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) +#if ANY(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION #define FLASH_EEPROM_LEVELING @@ -224,7 +224,7 @@ #define DOGLCD_A0 EXP1_04_PIN //#define LCD_BACKLIGHT_PIN -1 #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) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN EXP1_06_PIN #endif diff --git a/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h b/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h index 778049079910d..3daa8139524ad 100644 --- a/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h +++ b/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h @@ -291,7 +291,7 @@ #define LCD_BACKLIGHT_PIN EXP1_07_PIN #endif #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) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN EXP1_06_PIN #endif diff --git a/Marlin/src/pins/stm32f4/pins_I3DBEEZ9.h b/Marlin/src/pins/stm32f4/pins_I3DBEEZ9.h index a7ad18c8dccae..f63f4adeec1eb 100644 --- a/Marlin/src/pins/stm32f4/pins_I3DBEEZ9.h +++ b/Marlin/src/pins/stm32f4/pins_I3DBEEZ9.h @@ -33,8 +33,8 @@ //#define MOTOR_EXPANSION -#if BOTH(HAS_WIRED_LCD, MOTOR_EXPANSION) - #if EITHER(CR10_STOCKDISPLAY, ENDER2_STOCKDISPLAY) +#if ALL(HAS_WIRED_LCD, MOTOR_EXPANSION) + #if ANY(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." @@ -560,7 +560,7 @@ #define DOGLCD_A0 EXP1_04_PIN //#define LCD_BACKLIGHT_PIN -1 #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) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN EXP1_06_PIN #endif diff --git a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_common.h b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_common.h index 0940fc5e0c3c2..05c938037d510 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_common.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_common.h @@ -263,7 +263,7 @@ #endif #endif -#if EITHER(TFT_COLOR_UI, TFT_CLASSIC_UI) +#if ANY(TFT_COLOR_UI, TFT_CLASSIC_UI) #define TFT_CS_PIN EXP1_07_PIN #define TFT_SCK_PIN EXP2_02_PIN #define TFT_MISO_PIN EXP2_01_PIN 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 04c40095295d1..cdb9f5edecc46 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 @@ -33,7 +33,7 @@ // Use one of these or SDCard-based Emulation will be used //#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation //#define FLASH_EEPROM_EMULATION // Use Flash-based EEPROM emulation -#if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM) +#if ANY(NO_EEPROM_SELECTED, I2C_EEPROM) #define I2C_EEPROM #define MARLIN_EEPROM_SIZE 0x1000 // 4K #define I2C_SCL_PIN PB6 diff --git a/Marlin/src/pins/stm32f4/pins_MKS_SKIPR_V1_0.h b/Marlin/src/pins/stm32f4/pins_MKS_SKIPR_V1_0.h index 84d5a5f5e0ab8..f7b9fb467432b 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_SKIPR_V1_0.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_SKIPR_V1_0.h @@ -311,7 +311,7 @@ #define DOGLCD_A0 EXP1_04_PIN //#define LCD_BACKLIGHT_PIN -1 #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) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN EXP1_06_PIN #endif diff --git a/Marlin/src/pins/stm32f4/pins_TH3D_EZBOARD_V2.h b/Marlin/src/pins/stm32f4/pins_TH3D_EZBOARD_V2.h index 0ab67c1558a87..61490005987ea 100644 --- a/Marlin/src/pins/stm32f4/pins_TH3D_EZBOARD_V2.h +++ b/Marlin/src/pins/stm32f4/pins_TH3D_EZBOARD_V2.h @@ -61,7 +61,7 @@ // // Limit Switches // -#if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) +#if ANY(SENSORLESS_HOMING, SENSORLESS_PROBING) // Sensorless homing pins #if ENABLED(X_AXIS_SENSORLESS_HOMING) #define X_STOP_PIN PB4 @@ -269,7 +269,7 @@ #endif -#if EITHER(CR10_STOCKDISPLAY, MKS_MINI_12864) +#if ANY(CR10_STOCKDISPLAY, MKS_MINI_12864) #define BTN_EN1 EXP1_03_PIN #define BTN_EN2 EXP1_05_PIN #define BTN_ENC EXP1_02_PIN diff --git a/Marlin/src/pins/stm32g0/pins_BTT_EBB42_V1_1.h b/Marlin/src/pins/stm32g0/pins_BTT_EBB42_V1_1.h index 07c68dc780d50..6c31fdc572619 100644 --- a/Marlin/src/pins/stm32g0/pins_BTT_EBB42_V1_1.h +++ b/Marlin/src/pins/stm32g0/pins_BTT_EBB42_V1_1.h @@ -38,7 +38,7 @@ // // EEPROM // -#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) +#if ANY(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #undef NO_EEPROM_SELECTED #ifndef FLASH_EEPROM_EMULATION #define FLASH_EEPROM_EMULATION diff --git a/Marlin/src/pins/stm32g0/pins_BTT_MANTA_E3_EZ_V1_0.h b/Marlin/src/pins/stm32g0/pins_BTT_MANTA_E3_EZ_V1_0.h index 25f1b307ca8dd..156698f4247ee 100644 --- a/Marlin/src/pins/stm32g0/pins_BTT_MANTA_E3_EZ_V1_0.h +++ b/Marlin/src/pins/stm32g0/pins_BTT_MANTA_E3_EZ_V1_0.h @@ -35,7 +35,7 @@ // // EEPROM // -#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) +#if ANY(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #undef NO_EEPROM_SELECTED #ifndef FLASH_EEPROM_EMULATION #define FLASH_EEPROM_EMULATION @@ -286,7 +286,7 @@ #define LCD_PINS_D7 EXP1_01_PIN #define ADC_KEYPAD_PIN PA7 // Repurpose default SERVO0_PIN for ADC - CONNECTING TO 5V WILL DAMAGE THE BOARD! - #elif EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY) + #elif ANY(MKS_MINI_12864, ENDER2_STOCKDISPLAY) #define BTN_EN1 EXP1_03_PIN #define BTN_EN2 EXP1_05_PIN @@ -317,7 +317,7 @@ #define SD_DETECT_PIN -1 -#if SD_CONNECTION_IS(LCD) && (BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) || IS_TFTGLCD_PANEL) +#if SD_CONNECTION_IS(LCD) && (ALL(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) || IS_TFTGLCD_PANEL) #define SD_SS_PIN EXP1_05_PIN #elif SD_CONNECTION_IS(CUSTOM_CABLE) #error "SD CUSTOM_CABLE is not compatible with Manta E3 EZ." diff --git a/Marlin/src/pins/stm32g0/pins_BTT_MANTA_M4P_V1_0.h b/Marlin/src/pins/stm32g0/pins_BTT_MANTA_M4P_V1_0.h index 3a18b7864c8b5..33b957f53a3eb 100644 --- a/Marlin/src/pins/stm32g0/pins_BTT_MANTA_M4P_V1_0.h +++ b/Marlin/src/pins/stm32g0/pins_BTT_MANTA_M4P_V1_0.h @@ -37,7 +37,7 @@ // // EEPROM // -#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) +#if ANY(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #undef NO_EEPROM_SELECTED #ifndef FLASH_EEPROM_EMULATION #define FLASH_EEPROM_EMULATION @@ -259,7 +259,7 @@ // results in LCD soft SPI mode 3, SD soft SPI mode 0 #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) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN EXP1_06_PIN #endif diff --git a/Marlin/src/pins/stm32g0/pins_BTT_MANTA_M5P_V1_0.h b/Marlin/src/pins/stm32g0/pins_BTT_MANTA_M5P_V1_0.h index 1d77a6cb07517..286a59a00b6e7 100644 --- a/Marlin/src/pins/stm32g0/pins_BTT_MANTA_M5P_V1_0.h +++ b/Marlin/src/pins/stm32g0/pins_BTT_MANTA_M5P_V1_0.h @@ -35,7 +35,7 @@ // // EEPROM // -#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) +#if ANY(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #undef NO_EEPROM_SELECTED #ifndef FLASH_EEPROM_EMULATION #define FLASH_EEPROM_EMULATION @@ -287,7 +287,7 @@ // results in LCD soft SPI mode 3, SD soft SPI mode 0 #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) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN EXP1_06_PIN #endif diff --git a/Marlin/src/pins/stm32g0/pins_BTT_MANTA_M8P_common.h b/Marlin/src/pins/stm32g0/pins_BTT_MANTA_M8P_common.h index 8cab6b53574fb..d4a21ba2f24f9 100644 --- a/Marlin/src/pins/stm32g0/pins_BTT_MANTA_M8P_common.h +++ b/Marlin/src/pins/stm32g0/pins_BTT_MANTA_M8P_common.h @@ -33,7 +33,7 @@ // // EEPROM // -#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) +#if ANY(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) #undef NO_EEPROM_SELECTED #ifndef FLASH_EEPROM_EMULATION #define FLASH_EEPROM_EMULATION @@ -337,7 +337,7 @@ // results in LCD soft SPI mode 3, SD soft SPI mode 0 #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) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN EXP1_06_PIN #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 0f7da52572e81..ef6a22b88f1bd 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 @@ -37,7 +37,7 @@ #define LED_PIN PD8 // Onboard I2C EEPROM -#if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM) +#if ANY(NO_EEPROM_SELECTED, I2C_EEPROM) #undef NO_EEPROM_SELECTED #define I2C_EEPROM #define SOFT_I2C_EEPROM // Force the use of Software I2C @@ -255,7 +255,7 @@ #define LCD_PINS_D7 EXP1_01_PIN #define ADC_KEYPAD_PIN PA1 // Repurpose servo pin for ADC - CONNECTING TO 5V WILL DAMAGE THE BOARD! - #elif EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY) + #elif ANY(MKS_MINI_12864, ENDER2_STOCKDISPLAY) #define BTN_ENC EXP1_02_PIN #define BTN_EN1 EXP1_03_PIN @@ -363,7 +363,7 @@ #endif // HAS_WIRED_LCD -#if BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) +#if ALL(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) #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.)" @@ -416,7 +416,7 @@ #if SD_CONNECTION_IS(ONBOARD) #define SD_DETECT_PIN PC3 -#elif SD_CONNECTION_IS(LCD) && (BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) || IS_TFTGLCD_PANEL) +#elif SD_CONNECTION_IS(LCD) && (ALL(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) || IS_TFTGLCD_PANEL) #define SD_DETECT_PIN EXP1_01_PIN #define SD_SS_PIN EXP1_05_PIN #elif SD_CONNECTION_IS(CUSTOM_CABLE) diff --git a/Marlin/src/pins/stm32h7/pins_BTT_OCTOPUS_MAX_EZ.h b/Marlin/src/pins/stm32h7/pins_BTT_OCTOPUS_MAX_EZ.h index 69723947fd737..ee92372b5a0fb 100644 --- a/Marlin/src/pins/stm32h7/pins_BTT_OCTOPUS_MAX_EZ.h +++ b/Marlin/src/pins/stm32h7/pins_BTT_OCTOPUS_MAX_EZ.h @@ -28,7 +28,7 @@ #define USES_DIAG_JUMPERS // Onboard I2C EEPROM -#if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM) +#if ANY(NO_EEPROM_SELECTED, I2C_EEPROM) #undef NO_EEPROM_SELECTED #define I2C_EEPROM #define SOFT_I2C_EEPROM // Force the use of Software I2C @@ -440,7 +440,7 @@ // results in LCD soft SPI mode 3, SD soft SPI mode 0 //#define LCD_BACKLIGHT_PIN -1 #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) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN EXP1_06_PIN #endif 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 index 77f47f8106647..85fd24da0fc61 100644 --- a/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h +++ b/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h @@ -27,8 +27,8 @@ // 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) +#if ALL(HAS_WIRED_LCD, BTT_MOTOR_EXPANSION) + #if ANY(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." @@ -38,7 +38,7 @@ #define USES_DIAG_JUMPERS // Onboard I2C EEPROM -#if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM) +#if ANY(NO_EEPROM_SELECTED, I2C_EEPROM) #undef NO_EEPROM_SELECTED #define I2C_EEPROM #define SOFT_I2C_EEPROM // Force the use of Software I2C @@ -473,7 +473,7 @@ #define DOGLCD_A0 EXP1_04_PIN //#define LCD_BACKLIGHT_PIN -1 #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) + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN EXP1_06_PIN #endif diff --git a/Marlin/src/pins/teensy2/pins_PRINTRBOARD.h b/Marlin/src/pins/teensy2/pins_PRINTRBOARD.h index 124faa769106a..c1eee00c2dd38 100644 --- a/Marlin/src/pins/teensy2/pins_PRINTRBOARD.h +++ b/Marlin/src/pins/teensy2/pins_PRINTRBOARD.h @@ -139,7 +139,7 @@ #define LCD_PINS_D6 5 // D5 JP11-6 #define LCD_PINS_D7 4 // D4 JP11-5 - #if EITHER(VIKI2, miniVIKI) + #if ANY(VIKI2, miniVIKI) #define BEEPER_PIN 8 // E0 JP11-10 #define DOGLCD_A0 40 // F2 JP2-2 diff --git a/Marlin/src/pins/teensy2/pins_PRINTRBOARD_REVF.h b/Marlin/src/pins/teensy2/pins_PRINTRBOARD_REVF.h index b208b08826f39..62922399d827b 100644 --- a/Marlin/src/pins/teensy2/pins_PRINTRBOARD_REVF.h +++ b/Marlin/src/pins/teensy2/pins_PRINTRBOARD_REVF.h @@ -220,7 +220,7 @@ #define LCD_PINS_D6 5 // D5 JP11-6 #define LCD_PINS_D7 4 // D4 JP11-5 - #if EITHER(VIKI2, miniVIKI) + #if ANY(VIKI2, miniVIKI) #define BEEPER_PIN 8 // E0 JP11-10 #define DOGLCD_A0 40 // F2 JP2-2 diff --git a/Marlin/src/pins/teensy2/pins_SAV_MKI.h b/Marlin/src/pins/teensy2/pins_SAV_MKI.h index c1809eed6b3c1..28b0aebe42a69 100644 --- a/Marlin/src/pins/teensy2/pins_SAV_MKI.h +++ b/Marlin/src/pins/teensy2/pins_SAV_MKI.h @@ -163,7 +163,7 @@ #define SR_CLK_PIN EXT_AUX_SCL_D0 #endif -#if EITHER(SAV_3DLCD, SAV_3DGLCD) +#if ANY(SAV_3DLCD, SAV_3DGLCD) #define BTN_EN1 EXT_AUX_A1_IO #define BTN_EN2 EXT_AUX_A0_IO diff --git a/Marlin/src/sd/Sd2Card.h b/Marlin/src/sd/Sd2Card.h index 23677b24fa4bd..71e31ac614c2c 100644 --- a/Marlin/src/sd/Sd2Card.h +++ b/Marlin/src/sd/Sd2Card.h @@ -83,7 +83,7 @@ uint8_t const SD_CARD_TYPE_SD1 = 1, // Standard capacity V1 SD card /** * Define SOFTWARE_SPI to use bit-bang SPI */ -#if EITHER(MEGA_SOFT_SPI, USE_SOFTWARE_SPI) +#if ANY(MEGA_SOFT_SPI, USE_SOFTWARE_SPI) #define SOFTWARE_SPI #endif diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index a4a10b316986b..811351ec8c1f5 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -60,7 +60,7 @@ #include "../../src/lcd/menu/menu.h" #endif -#define DEBUG_OUT EITHER(DEBUG_CARDREADER, MARLIN_DEV_MODE) +#define DEBUG_OUT ANY(DEBUG_CARDREADER, MARLIN_DEV_MODE) #include "../core/debug_out.h" #include "../libs/hex_print.h" @@ -176,7 +176,7 @@ CardReader::CardReader() { workDirDepth = 0; ZERO(workDirParents); - #if BOTH(HAS_MEDIA, HAS_SD_DETECT) + #if ALL(HAS_MEDIA, HAS_SD_DETECT) SET_INPUT_PULLUP(SD_DETECT_PIN); #endif @@ -499,7 +499,7 @@ void CardReader::mount() { if (flag.mounted) cdroot(); else { - #if EITHER(HAS_SD_DETECT, USB_FLASH_DRIVE_SUPPORT) + #if ANY(HAS_SD_DETECT, USB_FLASH_DRIVE_SUPPORT) if (marlin_state != MF_INITIALIZING) LCD_ALERTMESSAGE(MSG_MEDIA_INIT_FAIL); #endif } @@ -1355,7 +1355,7 @@ void CardReader::cdroot() { } else { sort_order[0] = 0; - #if BOTH(SDSORT_USES_RAM, SDSORT_CACHE_NAMES) + #if ALL(SDSORT_USES_RAM, SDSORT_CACHE_NAMES) #if ENABLED(SDSORT_DYNAMIC_RAM) sortnames = new char*[1]; sortshort = new char*[1]; diff --git a/Marlin/src/sd/cardreader.h b/Marlin/src/sd/cardreader.h index 832d79efe4eed..80e317ebcf101 100644 --- a/Marlin/src/sd/cardreader.h +++ b/Marlin/src/sd/cardreader.h @@ -284,7 +284,7 @@ class CardReader { static uint8_t sort_order[SDSORT_LIMIT]; #endif - #if BOTH(SDSORT_USES_RAM, SDSORT_CACHE_NAMES) && DISABLED(SDSORT_DYNAMIC_RAM) + #if ALL(SDSORT_USES_RAM, SDSORT_CACHE_NAMES) && DISABLED(SDSORT_DYNAMIC_RAM) #define SORTED_LONGNAME_MAXLEN (SDSORT_CACHE_VFATS) * (FILENAME_LENGTH) #define SORTED_LONGNAME_STORAGE (SORTED_LONGNAME_MAXLEN + 1) #else diff --git a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.h b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.h index 3390bc51becc8..f722c873ae0a4 100644 --- a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.h +++ b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.h @@ -33,7 +33,7 @@ /** * Define SOFTWARE_SPI to use bit-bang SPI */ - #if EITHER(MEGA_SOFT_SPI, USE_SOFTWARE_SPI) + #if ANY(MEGA_SOFT_SPI, USE_SOFTWARE_SPI) #define SOFTWARE_SPI #endif diff --git a/buildroot/share/PlatformIO/scripts/common-dependencies.h b/buildroot/share/PlatformIO/scripts/common-dependencies.h index c75d9a3d675a9..b37a377df9942 100644 --- a/buildroot/share/PlatformIO/scripts/common-dependencies.h +++ b/buildroot/share/PlatformIO/scripts/common-dependencies.h @@ -33,7 +33,7 @@ // #if ENABLED(SR_LCD_3W_NL) // Feature checks for SR_LCD_3W_NL -#elif EITHER(LCD_I2C_TYPE_MCP23017, LCD_I2C_TYPE_MCP23008) +#elif ANY(LCD_I2C_TYPE_MCP23017, LCD_I2C_TYPE_MCP23008) #define USES_LIQUIDTWI2 #elif ENABLED(LCD_I2C_TYPE_PCA8574) #define USES_LIQUIDCRYSTAL_I2C @@ -59,10 +59,10 @@ #if ENABLED(CANCEL_OBJECTS) #define HAS_MENU_CANCELOBJECT #endif - #if EITHER(DELTA_CALIBRATION_MENU, DELTA_AUTO_CALIBRATION) + #if ANY(DELTA_CALIBRATION_MENU, DELTA_AUTO_CALIBRATION) #define HAS_MENU_DELTA_CALIBRATE #endif - #if EITHER(LED_CONTROL_MENU, CASE_LIGHT_MENU) + #if ANY(LED_CONTROL_MENU, CASE_LIGHT_MENU) #define HAS_MENU_LED #endif #if ENABLED(ADVANCED_PAUSE_FEATURE) From 86c811660ebf0b3fcbae2f34273d4c9d0c22abc4 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 2 Jun 2023 14:30:34 -0500 Subject: [PATCH 087/100] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Rem?= =?UTF-8?q?ove=20LOOP=20macros=20(#25917)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/AVR/HAL_SPI.cpp | 4 ++-- Marlin/src/HAL/AVR/fast_pwm.cpp | 4 ++-- Marlin/src/HAL/AVR/pinsDebug.h | 4 ++-- Marlin/src/HAL/AVR/u8g_com_HAL_AVR_sw_spi.cpp | 4 ++-- .../dogm/u8g_com_HAL_DUE_sw_spi_shared.cpp | 4 ++-- Marlin/src/HAL/DUE/fastio/G2_PWM.h | 2 +- Marlin/src/HAL/ESP32/i2s.cpp | 2 +- Marlin/src/HAL/LPC1768/main.cpp | 2 +- Marlin/src/HAL/LPC1768/tft/tft_spi.cpp | 2 +- .../u8g/u8g_com_HAL_LPC1768_sw_spi.cpp | 16 ++++++------- .../src/HAL/NATIVE_SIM/u8g/u8g_com_sw_spi.cpp | 16 ++++++------- Marlin/src/HAL/SAMD51/HAL.cpp | 6 ++--- Marlin/src/HAL/STM32/fastio.cpp | 2 +- Marlin/src/HAL/STM32/tft/gt911.cpp | 12 +++++----- Marlin/src/HAL/STM32/timers.cpp | 4 ++-- .../STM32F1/dogm/u8g_com_stm32duino_swspi.cpp | 16 ++++++------- Marlin/src/HAL/STM32F1/tft/tft_spi.cpp | 2 +- Marlin/src/HAL/shared/servo.cpp | 2 +- Marlin/src/MarlinCore.cpp | 4 ++-- Marlin/src/core/macros.h | 5 ---- Marlin/src/core/serial_base.h | 2 +- Marlin/src/core/types.h | 10 ++++---- Marlin/src/feature/babystep.h | 2 +- Marlin/src/feature/bedlevel/abl/bbl.cpp | 16 ++++++------- Marlin/src/feature/bedlevel/bedlevel.cpp | 8 +++---- .../bedlevel/mbl/mesh_bed_leveling.cpp | 4 ++-- Marlin/src/feature/bedlevel/ubl/ubl.cpp | 4 ++-- Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 24 +++++++++---------- .../src/feature/digipot/digipot_mcp4018.cpp | 4 ++-- .../src/feature/digipot/digipot_mcp4451.cpp | 2 +- Marlin/src/feature/encoder_i2c.cpp | 6 ++--- Marlin/src/feature/encoder_i2c.h | 2 +- Marlin/src/feature/fancheck.cpp | 10 ++++---- Marlin/src/feature/filwidth.cpp | 2 +- Marlin/src/feature/leds/leds.cpp | 8 +++---- Marlin/src/feature/max7219.cpp | 22 ++++++++--------- Marlin/src/feature/mixing.cpp | 4 ++-- Marlin/src/feature/mmu/mmu2.cpp | 10 ++++---- Marlin/src/feature/powerloss.cpp | 2 +- Marlin/src/feature/probe_temp_comp.cpp | 12 +++++----- Marlin/src/feature/repeat.cpp | 2 +- Marlin/src/feature/repeat.h | 2 +- Marlin/src/feature/runout.h | 24 +++++++++---------- Marlin/src/feature/twibus.cpp | 2 +- Marlin/src/feature/x_twist.cpp | 4 ++-- Marlin/src/gcode/bedlevel/G26.cpp | 2 +- Marlin/src/gcode/bedlevel/G35.cpp | 4 ++-- Marlin/src/gcode/bedlevel/abl/G29.cpp | 4 ++-- Marlin/src/gcode/bedlevel/abl/M421.cpp | 4 ++-- Marlin/src/gcode/calibrate/G34_M422.cpp | 16 ++++++------- Marlin/src/gcode/calibrate/G425.cpp | 4 ++-- Marlin/src/gcode/calibrate/M100.cpp | 4 ++-- Marlin/src/gcode/calibrate/M48.cpp | 6 ++--- Marlin/src/gcode/config/M200-M205.cpp | 4 ++-- Marlin/src/gcode/config/M218.cpp | 2 +- Marlin/src/gcode/config/M281.cpp | 2 +- Marlin/src/gcode/config/M305.cpp | 2 +- Marlin/src/gcode/config/M43.cpp | 10 ++++---- Marlin/src/gcode/config/M672.cpp | 2 +- Marlin/src/gcode/config/M92.cpp | 2 +- Marlin/src/gcode/control/M111.cpp | 2 +- Marlin/src/gcode/feature/camera/M240.cpp | 2 +- .../src/gcode/feature/digipot/M907-M910.cpp | 6 ++--- Marlin/src/gcode/feature/leds/M7219.cpp | 2 +- .../src/gcode/feature/network/M552-M554.cpp | 4 ++-- Marlin/src/gcode/host/M114.cpp | 2 +- Marlin/src/gcode/host/M115.cpp | 2 +- Marlin/src/gcode/lcd/M145.cpp | 2 +- Marlin/src/gcode/probe/M423.cpp | 2 +- Marlin/src/gcode/queue.cpp | 6 ++--- Marlin/src/inc/Conditionals_LCD.h | 2 +- Marlin/src/lcd/HD44780/marlinui_HD44780.cpp | 4 ++-- Marlin/src/lcd/dogm/marlinui_DOGM.cpp | 4 ++-- Marlin/src/lcd/dogm/status_screen_DOGM.cpp | 2 +- .../lcd/dogm/status_screen_lite_ST7920.cpp | 8 +++---- .../lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp | 4 ++-- .../dogm/u8g_dev_tft_upscale_from_128x64.cpp | 12 +++++----- Marlin/src/lcd/e3v2/common/dwin_api.cpp | 4 ++-- Marlin/src/lcd/e3v2/creality/dwin.cpp | 14 +++++------ Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 12 +++++----- Marlin/src/lcd/e3v2/proui/dwin.cpp | 14 +++++------ Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp | 4 ++-- Marlin/src/lcd/e3v2/proui/meshviewer.cpp | 10 ++++---- .../src/lcd/extui/anycubic_vyper/dgus_tft.cpp | 18 +++++++------- .../lcd/extui/dgus/DGUSScreenHandlerBase.h | 2 +- .../src/lcd/extui/dgus_reloaded/DGUSDisplay.h | 2 +- .../extended/unicode/cyrillic_char_set.cpp | 4 ++-- .../extended/unicode/western_char_set.cpp | 4 ++-- .../generic/move_axis_screen.cpp | 2 +- Marlin/src/lcd/extui/malyan/malyan.cpp | 4 ++-- Marlin/src/lcd/extui/mks_ui/pic_manager.cpp | 2 +- Marlin/src/lcd/marlinui.cpp | 4 ++-- Marlin/src/lcd/marlinui.h | 2 +- Marlin/src/lcd/menu/game/brickout.cpp | 8 +++---- Marlin/src/lcd/menu/game/invaders.cpp | 20 ++++++++-------- Marlin/src/lcd/menu/game/maze.cpp | 2 +- Marlin/src/lcd/menu/game/snake.cpp | 14 +++++------ Marlin/src/lcd/menu/menu_advanced.cpp | 6 ++--- Marlin/src/lcd/menu/menu_configuration.cpp | 2 +- Marlin/src/lcd/menu/menu_filament.cpp | 8 +++---- Marlin/src/lcd/menu/menu_mixer.cpp | 2 +- Marlin/src/lcd/menu/menu_password.cpp | 2 +- Marlin/src/lcd/menu/menu_temperature.cpp | 6 ++--- Marlin/src/lcd/menu/menu_tune.cpp | 2 +- Marlin/src/lcd/menu/menu_x_twist.cpp | 4 ++-- Marlin/src/libs/BL24CXX.cpp | 8 +++---- Marlin/src/libs/nozzle.cpp | 8 +++---- Marlin/src/libs/vector_3.cpp | 12 +++++----- Marlin/src/module/endstops.cpp | 2 +- Marlin/src/module/planner.cpp | 4 ++-- Marlin/src/module/planner.h | 2 +- Marlin/src/module/probe.cpp | 4 ++-- Marlin/src/module/settings.cpp | 24 +++++++++---------- Marlin/src/module/stepper.cpp | 6 ++--- Marlin/src/module/stepper/trinamic.cpp | 2 +- Marlin/src/module/temperature.cpp | 2 +- Marlin/src/module/temperature.h | 4 ++-- Marlin/src/module/tool_change.cpp | 2 +- Marlin/src/pins/pinsDebug.h | 2 +- Marlin/src/sd/Sd2Card.cpp | 10 ++++---- Marlin/src/sd/SdBaseFile.cpp | 18 +++++++------- Marlin/src/sd/cardreader.cpp | 6 ++--- 122 files changed, 362 insertions(+), 367 deletions(-) diff --git a/Marlin/src/HAL/AVR/HAL_SPI.cpp b/Marlin/src/HAL/AVR/HAL_SPI.cpp index dc98f2f79e71b..32c0361d03520 100644 --- a/Marlin/src/HAL/AVR/HAL_SPI.cpp +++ b/Marlin/src/HAL/AVR/HAL_SPI.cpp @@ -198,7 +198,7 @@ void spiBegin() { // output pin high - like sending 0xFF WRITE(SD_MOSI_PIN, HIGH); - LOOP_L_N(i, 8) { + for (uint8_t i = 0; i < 8; ++i) { WRITE(SD_SCK_PIN, HIGH); nop; // adjust so SCK is nice @@ -225,7 +225,7 @@ void spiBegin() { void spiSend(uint8_t data) { // no interrupts during byte send - about 8µs cli(); - LOOP_L_N(i, 8) { + for (uint8_t i = 0; i < 8; ++i) { WRITE(SD_SCK_PIN, LOW); WRITE(SD_MOSI_PIN, data & 0x80); data <<= 1; diff --git a/Marlin/src/HAL/AVR/fast_pwm.cpp b/Marlin/src/HAL/AVR/fast_pwm.cpp index 0b2b8fd0b3a4d..6da68e6245d30 100644 --- a/Marlin/src/HAL/AVR/fast_pwm.cpp +++ b/Marlin/src/HAL/AVR/fast_pwm.cpp @@ -132,7 +132,7 @@ void MarlinHAL::set_pwm_frequency(const pin_t pin, const uint16_t f_desired) { DEBUG_ECHOLNPGM("f=", f); DEBUG_ECHOLNPGM("(prescaler loop)"); - LOOP_L_N(i, COUNT(prescaler)) { // Loop through all prescaler values + for (uint8_t i = 0; i < COUNT(prescaler); ++i) { // Loop through all prescaler values const uint32_t p = prescaler[i]; // Extend to 32 bits for calculations DEBUG_ECHOLNPGM("prescaler[", i, "]=", p); uint16_t res_fast_temp, res_pc_temp; @@ -232,7 +232,7 @@ void MarlinHAL::init_pwm_timers() { #endif }; - LOOP_L_N(i, COUNT(pwm_pin)) + for (uint8_t i = 0; i < COUNT(pwm_pin); ++i) set_pwm_frequency(pwm_pin[i], 1000); } diff --git a/Marlin/src/HAL/AVR/pinsDebug.h b/Marlin/src/HAL/AVR/pinsDebug.h index accd3c663f71b..fc51f41ef81e9 100644 --- a/Marlin/src/HAL/AVR/pinsDebug.h +++ b/Marlin/src/HAL/AVR/pinsDebug.h @@ -77,12 +77,12 @@ void PRINT_ARRAY_NAME(uint8_t x) { PGM_P const name_mem_pointer = (PGM_P)pgm_read_ptr(&pin_array[x].name); - LOOP_L_N(y, MAX_NAME_LENGTH) { + for (uint8_t y = 0; y < MAX_NAME_LENGTH; ++y) { char temp_char = pgm_read_byte(name_mem_pointer + y); if (temp_char != 0) SERIAL_CHAR(temp_char); else { - LOOP_L_N(i, MAX_NAME_LENGTH - y) SERIAL_CHAR(' '); + for (uint8_t i = 0; i < MAX_NAME_LENGTH - y; ++i) SERIAL_CHAR(' '); break; } } diff --git a/Marlin/src/HAL/AVR/u8g_com_HAL_AVR_sw_spi.cpp b/Marlin/src/HAL/AVR/u8g_com_HAL_AVR_sw_spi.cpp index 45b54379dba78..79bafe293967e 100644 --- a/Marlin/src/HAL/AVR/u8g_com_HAL_AVR_sw_spi.cpp +++ b/Marlin/src/HAL/AVR/u8g_com_HAL_AVR_sw_spi.cpp @@ -88,7 +88,7 @@ void u8g_spiSend_sw_AVR_mode_0(uint8_t val) { volatile uint8_t *outData = u8g_outData, *outClock = u8g_outClock; U8G_ATOMIC_START(); - LOOP_L_N(i, 8) { + for (uint8_t i = 0; i < 8; ++i) { if (val & 0x80) *outData |= bitData; else @@ -108,7 +108,7 @@ void u8g_spiSend_sw_AVR_mode_3(uint8_t val) { volatile uint8_t *outData = u8g_outData, *outClock = u8g_outClock; U8G_ATOMIC_START(); - LOOP_L_N(i, 8) { + for (uint8_t i = 0; i < 8; ++i) { *outClock &= bitNotClock; if (val & 0x80) *outData |= bitData; diff --git a/Marlin/src/HAL/DUE/dogm/u8g_com_HAL_DUE_sw_spi_shared.cpp b/Marlin/src/HAL/DUE/dogm/u8g_com_HAL_DUE_sw_spi_shared.cpp index 904924793b4c7..86c8a4847026a 100644 --- a/Marlin/src/HAL/DUE/dogm/u8g_com_HAL_DUE_sw_spi_shared.cpp +++ b/Marlin/src/HAL/DUE/dogm/u8g_com_HAL_DUE_sw_spi_shared.cpp @@ -81,7 +81,7 @@ Pio *SCK_pPio, *MOSI_pPio; uint32_t SCK_dwMask, MOSI_dwMask; void u8g_spiSend_sw_DUE_mode_0(uint8_t val) { // 3MHz - LOOP_L_N(i, 8) { + for (uint8_t i = 0; i < 8; ++i) { if (val & 0x80) MOSI_pPio->PIO_SODR = MOSI_dwMask; else @@ -95,7 +95,7 @@ void u8g_spiSend_sw_DUE_mode_0(uint8_t val) { // 3MHz } void u8g_spiSend_sw_DUE_mode_3(uint8_t val) { // 3.5MHz - LOOP_L_N(i, 8) { + for (uint8_t i = 0; i < 8; ++i) { SCK_pPio->PIO_CODR = SCK_dwMask; DELAY_NS(50); if (val & 0x80) diff --git a/Marlin/src/HAL/DUE/fastio/G2_PWM.h b/Marlin/src/HAL/DUE/fastio/G2_PWM.h index dc4edffff851f..2afe246ceaea5 100644 --- a/Marlin/src/HAL/DUE/fastio/G2_PWM.h +++ b/Marlin/src/HAL/DUE/fastio/G2_PWM.h @@ -63,7 +63,7 @@ extern PWM_map ISR_table[NUM_PWMS]; extern uint32_t motor_current_setting[3]; #define IR_BIT(p) (WITHIN(p, 0, 3) ? (p) : (p) + 4) -#define COPY_ACTIVE_TABLE() do{ LOOP_L_N(i, 6) work_table[i] = active_table[i]; }while(0) +#define COPY_ACTIVE_TABLE() do{ for (uint8_t i = 0; i < 6; ++i) work_table[i] = active_table[i]; }while(0) #define PWM_MR0 19999 // base repetition rate minus one count - 20mS #define PWM_PR 24 // prescaler value - prescaler divide by 24 + 1 - 1 MHz output diff --git a/Marlin/src/HAL/ESP32/i2s.cpp b/Marlin/src/HAL/ESP32/i2s.cpp index 63ceed4c9dcde..69f8ca98458ab 100644 --- a/Marlin/src/HAL/ESP32/i2s.cpp +++ b/Marlin/src/HAL/ESP32/i2s.cpp @@ -356,7 +356,7 @@ 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) { + for (uint8_t p = 0; p < MAX_EXPANDER_BITS; ++p) { 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 diff --git a/Marlin/src/HAL/LPC1768/main.cpp b/Marlin/src/HAL/LPC1768/main.cpp index 419c99793fb8a..15518c3d86542 100644 --- a/Marlin/src/HAL/LPC1768/main.cpp +++ b/Marlin/src/HAL/LPC1768/main.cpp @@ -68,7 +68,7 @@ void MarlinHAL::init() { #endif // Flash status LED 3 times to indicate Marlin has started booting - LOOP_L_N(i, 6) { + for (uint8_t i = 0; i < 6; ++i) { TOGGLE(LED_PIN); delay(100); } diff --git a/Marlin/src/HAL/LPC1768/tft/tft_spi.cpp b/Marlin/src/HAL/LPC1768/tft/tft_spi.cpp index 10555762b1a03..c148617785cc7 100644 --- a/Marlin/src/HAL/LPC1768/tft/tft_spi.cpp +++ b/Marlin/src/HAL/LPC1768/tft/tft_spi.cpp @@ -74,7 +74,7 @@ uint32_t TFT_SPI::ReadID(uint16_t Reg) { WRITE(TFT_CS_PIN, LOW); WriteReg(Reg); - LOOP_L_N(i, 4) { + for (uint8_t i = 0; i < 4; ++i) { SPIx.read((uint8_t*)&d, 1); data = (data << 8) | d; } diff --git a/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp b/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp index 785b4ef5c410a..f6ed7b0e7e8a3 100644 --- a/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp +++ b/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp @@ -75,7 +75,7 @@ uint8_t swSpiTransfer_mode_0(uint8_t b, const uint8_t spi_speed, const pin_t sck_pin, const pin_t miso_pin, const pin_t mosi_pin ) { - LOOP_L_N(i, 8) { + for (uint8_t i = 0; i < 8; ++i) { if (spi_speed == 0) { LPC176x::gpio_set(mosi_pin, !!(b & 0x80)); LPC176x::gpio_set(sck_pin, HIGH); @@ -85,16 +85,16 @@ uint8_t swSpiTransfer_mode_0(uint8_t b, const uint8_t spi_speed, const pin_t sck } else { const uint8_t state = (b & 0x80) ? HIGH : LOW; - LOOP_L_N(j, spi_speed) + for (uint8_t j = 0; j < spi_speed; ++j) LPC176x::gpio_set(mosi_pin, state); - LOOP_L_N(j, spi_speed + (miso_pin >= 0 ? 0 : 1)) + for (uint8_t j = 0; j < spi_speed + (miso_pin >= 0 ? 0 : 1); ++j) LPC176x::gpio_set(sck_pin, HIGH); b <<= 1; if (miso_pin >= 0 && LPC176x::gpio_get(miso_pin)) b |= 1; - LOOP_L_N(j, spi_speed) + for (uint8_t j = 0; j < spi_speed; ++j) LPC176x::gpio_set(sck_pin, LOW); } } @@ -104,7 +104,7 @@ uint8_t swSpiTransfer_mode_0(uint8_t b, const uint8_t spi_speed, const pin_t sck uint8_t swSpiTransfer_mode_3(uint8_t b, const uint8_t spi_speed, const pin_t sck_pin, const pin_t miso_pin, const pin_t mosi_pin ) { - LOOP_L_N(i, 8) { + for (uint8_t i = 0; i < 8; ++i) { const uint8_t state = (b & 0x80) ? HIGH : LOW; if (spi_speed == 0) { LPC176x::gpio_set(sck_pin, LOW); @@ -113,13 +113,13 @@ uint8_t swSpiTransfer_mode_3(uint8_t b, const uint8_t spi_speed, const pin_t sck LPC176x::gpio_set(sck_pin, HIGH); } else { - LOOP_L_N(j, spi_speed + (miso_pin >= 0 ? 0 : 1)) + for (uint8_t j = 0; j < spi_speed + (miso_pin >= 0 ? 0 : 1); ++j) LPC176x::gpio_set(sck_pin, LOW); - LOOP_L_N(j, spi_speed) + for (uint8_t j = 0; j < spi_speed; ++j) LPC176x::gpio_set(mosi_pin, state); - LOOP_L_N(j, spi_speed) + for (uint8_t j = 0; j < spi_speed; ++j) LPC176x::gpio_set(sck_pin, HIGH); } b <<= 1; diff --git a/Marlin/src/HAL/NATIVE_SIM/u8g/u8g_com_sw_spi.cpp b/Marlin/src/HAL/NATIVE_SIM/u8g/u8g_com_sw_spi.cpp index 5187a4958308b..9184e2f6188cd 100644 --- a/Marlin/src/HAL/NATIVE_SIM/u8g/u8g_com_sw_spi.cpp +++ b/Marlin/src/HAL/NATIVE_SIM/u8g/u8g_com_sw_spi.cpp @@ -70,7 +70,7 @@ #endif uint8_t swSpiTransfer_mode_0(uint8_t b, const uint8_t spi_speed, const pin_t sck_pin, const pin_t miso_pin, const pin_t mosi_pin ) { - LOOP_L_N(i, 8) { + for (uint8_t i = 0; i < 8; ++i) { if (spi_speed == 0) { WRITE_PIN(mosi_pin, !!(b & 0x80)); WRITE_PIN(sck_pin, HIGH); @@ -80,16 +80,16 @@ uint8_t swSpiTransfer_mode_0(uint8_t b, const uint8_t spi_speed, const pin_t sck } else { const uint8_t state = (b & 0x80) ? HIGH : LOW; - LOOP_L_N(j, spi_speed) + for (uint8_t j = 0; j < spi_speed; ++j) WRITE_PIN(mosi_pin, state); - LOOP_L_N(j, spi_speed + (miso_pin >= 0 ? 0 : 1)) + for (uint8_t j = 0; j < spi_speed + (miso_pin >= 0 ? 0 : 1); ++j) WRITE_PIN(sck_pin, HIGH); b <<= 1; if (miso_pin >= 0 && READ_PIN(miso_pin)) b |= 1; - LOOP_L_N(j, spi_speed) + for (uint8_t j = 0; j < spi_speed; ++j) WRITE_PIN(sck_pin, LOW); } } @@ -99,7 +99,7 @@ uint8_t swSpiTransfer_mode_0(uint8_t b, const uint8_t spi_speed, const pin_t sck uint8_t swSpiTransfer_mode_3(uint8_t b, const uint8_t spi_speed, const pin_t sck_pin, const pin_t miso_pin, const pin_t mosi_pin ) { - LOOP_L_N(i, 8) { + for (uint8_t i = 0; i < 8; ++i) { const uint8_t state = (b & 0x80) ? HIGH : LOW; if (spi_speed == 0) { WRITE_PIN(sck_pin, LOW); @@ -108,13 +108,13 @@ uint8_t swSpiTransfer_mode_3(uint8_t b, const uint8_t spi_speed, const pin_t sck WRITE_PIN(sck_pin, HIGH); } else { - LOOP_L_N(j, spi_speed + (miso_pin >= 0 ? 0 : 1)) + for (uint8_t j = 0; j < spi_speed + (miso_pin >= 0 ? 0 : 1); ++j) WRITE_PIN(sck_pin, LOW); - LOOP_L_N(j, spi_speed) + for (uint8_t j = 0; j < spi_speed; ++j) WRITE_PIN(mosi_pin, state); - LOOP_L_N(j, spi_speed) + for (uint8_t j = 0; j < spi_speed; ++j) WRITE_PIN(sck_pin, HIGH); } b <<= 1; diff --git a/Marlin/src/HAL/SAMD51/HAL.cpp b/Marlin/src/HAL/SAMD51/HAL.cpp index bc7a9b6d913a4..8ec5d5a86c4bb 100644 --- a/Marlin/src/HAL/SAMD51/HAL.cpp +++ b/Marlin/src/HAL/SAMD51/HAL.cpp @@ -650,10 +650,10 @@ void MarlinHAL::adc_init() { #if ADC_IS_REQUIRED memset(adc_results, 0xFF, sizeof(adc_results)); // Fill result with invalid values - LOOP_L_N(pi, COUNT(adc_pins)) + for (uint8_t pi = 0; pi < COUNT(adc_pins); ++pi) pinPeripheral(adc_pins[pi], PIO_ANALOG); - LOOP_S_LE_N(ai, FIRST_ADC, LAST_ADC) { + for (uint8_t ai = FIRST_ADC; ai <= LAST_ADC; ++ai) { Adc* adc = ((Adc*[])ADC_INSTS)[ai]; // ADC clock setup @@ -685,7 +685,7 @@ void MarlinHAL::adc_init() { void MarlinHAL::adc_start(const pin_t pin) { #if ADC_IS_REQUIRED - LOOP_L_N(pi, COUNT(adc_pins)) + for (uint8_t pi = 0; pi < COUNT(adc_pins); ++pi) if (pin == adc_pins[pi]) { adc_result = adc_results[pi]; return; } #endif diff --git a/Marlin/src/HAL/STM32/fastio.cpp b/Marlin/src/HAL/STM32/fastio.cpp index b34555b8c8418..a4b3ba70c923c 100644 --- a/Marlin/src/HAL/STM32/fastio.cpp +++ b/Marlin/src/HAL/STM32/fastio.cpp @@ -29,7 +29,7 @@ GPIO_TypeDef* FastIOPortMap[LastPort + 1] = { 0 }; void FastIO_init() { - LOOP_L_N(i, NUM_DIGITAL_PINS) + for (uint8_t i = 0; i < NUM_DIGITAL_PINS; ++i) FastIOPortMap[STM_PORT(digitalPin[i])] = get_GPIO_Port(STM_PORT(digitalPin[i])); } diff --git a/Marlin/src/HAL/STM32/tft/gt911.cpp b/Marlin/src/HAL/STM32/tft/gt911.cpp index 82b7c5b103912..6809f66200934 100644 --- a/Marlin/src/HAL/STM32/tft/gt911.cpp +++ b/Marlin/src/HAL/STM32/tft/gt911.cpp @@ -90,7 +90,7 @@ bool SW_IIC::read_ack() { } void SW_IIC::send_byte(uint8_t txd) { - LOOP_L_N(i, 8) { + for (uint8_t i = 0; i < 8; ++i) { write_sda(txd & 0x80); // write data bit txd <<= 1; iic_delay(1); @@ -107,7 +107,7 @@ uint8_t SW_IIC::read_byte(bool ack) { uint8_t data = 0; set_sda_in(); - LOOP_L_N(i, 8) { + for (uint8_t i = 0; i < 8; ++i) { write_scl(HIGH); // SCL = 1 iic_delay(1); data <<= 1; @@ -128,12 +128,12 @@ SW_IIC GT911::sw_iic = SW_IIC(GT911_SW_I2C_SDA_PIN, GT911_SW_I2C_SCL_PIN); void GT911::write_reg(uint16_t reg, uint8_t reg_len, uint8_t* w_data, uint8_t w_len) { sw_iic.start(); sw_iic.send_byte(gt911_slave_address); // Set IIC Slave address - LOOP_L_N(i, reg_len) { // Set reg address + for (uint8_t i = 0; i < reg_len; ++i) { // Set reg address uint8_t r = (reg >> (8 * (reg_len - 1 - i))) & 0xFF; sw_iic.send_byte(r); } - LOOP_L_N(i, w_len) { // Write data to reg + for (uint8_t i = 0; i < w_len; ++i) { // Write data to reg sw_iic.send_byte(w_data[i]); } sw_iic.stop(); @@ -142,7 +142,7 @@ void GT911::write_reg(uint16_t reg, uint8_t reg_len, uint8_t* w_data, uint8_t w_ void GT911::read_reg(uint16_t reg, uint8_t reg_len, uint8_t* r_data, uint8_t r_len) { sw_iic.start(); sw_iic.send_byte(gt911_slave_address); // Set IIC Slave address - LOOP_L_N(i, reg_len) { // Set reg address + for (uint8_t i = 0; i < reg_len; ++i) { // Set reg address uint8_t r = (reg >> (8 * (reg_len - 1 - i))) & 0xFF; sw_iic.send_byte(r); } @@ -150,7 +150,7 @@ void GT911::read_reg(uint16_t reg, uint8_t reg_len, uint8_t* r_data, uint8_t r_l sw_iic.start(); sw_iic.send_byte(gt911_slave_address + 1); // Set read mode - LOOP_L_N(i, r_len) + for (uint8_t i = 0; i < r_len; ++i) r_data[i] = sw_iic.read_byte(1); // Read data from reg sw_iic.stop(); diff --git a/Marlin/src/HAL/STM32/timers.cpp b/Marlin/src/HAL/STM32/timers.cpp index 27ced33db2c13..54506cb4513f9 100644 --- a/Marlin/src/HAL/STM32/timers.cpp +++ b/Marlin/src/HAL/STM32/timers.cpp @@ -316,8 +316,8 @@ static constexpr struct { TimerPurpose p; int t; } timers_in_use[] = { }; static constexpr bool verify_no_timer_conflicts() { - LOOP_L_N(i, COUNT(timers_in_use)) - LOOP_S_L_N(j, i + 1, COUNT(timers_in_use)) + for (uint8_t i = 0; i < COUNT(timers_in_use); ++i) + for (uint8_t j = i + 1; j < COUNT(timers_in_use); ++j) if (timers_in_use[i].t == timers_in_use[j].t) return false; return true; } diff --git a/Marlin/src/HAL/STM32F1/dogm/u8g_com_stm32duino_swspi.cpp b/Marlin/src/HAL/STM32F1/dogm/u8g_com_stm32duino_swspi.cpp index db9b6f0b1c8d2..c57350aa2efdf 100644 --- a/Marlin/src/HAL/STM32F1/dogm/u8g_com_stm32duino_swspi.cpp +++ b/Marlin/src/HAL/STM32F1/dogm/u8g_com_stm32duino_swspi.cpp @@ -37,7 +37,7 @@ static uint8_t SPI_speed = LCD_SPI_SPEED; static inline uint8_t swSpiTransfer_mode_0(uint8_t b, const uint8_t spi_speed, const pin_t miso_pin=-1) { - LOOP_L_N(i, 8) { + for (uint8_t i = 0; i < 8; ++i) { if (spi_speed == 0) { WRITE(DOGLCD_MOSI, !!(b & 0x80)); WRITE(DOGLCD_SCK, HIGH); @@ -47,16 +47,16 @@ static inline uint8_t swSpiTransfer_mode_0(uint8_t b, const uint8_t spi_speed, c } else { const uint8_t state = (b & 0x80) ? HIGH : LOW; - LOOP_L_N(j, spi_speed) + for (uint8_t j = 0; j < spi_speed; ++j) WRITE(DOGLCD_MOSI, state); - LOOP_L_N(j, spi_speed + (miso_pin >= 0 ? 0 : 1)) + for (uint8_t j = 0; j < spi_speed + (miso_pin >= 0 ? 0 : 1); ++j) WRITE(DOGLCD_SCK, HIGH); b <<= 1; if (miso_pin >= 0 && READ(miso_pin)) b |= 1; - LOOP_L_N(j, spi_speed) + for (uint8_t j = 0; j < spi_speed; ++j) WRITE(DOGLCD_SCK, LOW); } } @@ -64,7 +64,7 @@ static inline uint8_t swSpiTransfer_mode_0(uint8_t b, const uint8_t spi_speed, c } static inline uint8_t swSpiTransfer_mode_3(uint8_t b, const uint8_t spi_speed, const pin_t miso_pin=-1) { - LOOP_L_N(i, 8) { + for (uint8_t i = 0; i < 8; ++i) { const uint8_t state = (b & 0x80) ? HIGH : LOW; if (spi_speed == 0) { WRITE(DOGLCD_SCK, LOW); @@ -73,13 +73,13 @@ static inline uint8_t swSpiTransfer_mode_3(uint8_t b, const uint8_t spi_speed, c WRITE(DOGLCD_SCK, HIGH); } else { - LOOP_L_N(j, spi_speed + (miso_pin >= 0 ? 0 : 1)) + for (uint8_t j = 0; j < spi_speed + (miso_pin >= 0 ? 0 : 1); ++j) WRITE(DOGLCD_SCK, LOW); - LOOP_L_N(j, spi_speed) + for (uint8_t j = 0; j < spi_speed; ++j) WRITE(DOGLCD_MOSI, state); - LOOP_L_N(j, spi_speed) + for (uint8_t j = 0; j < spi_speed; ++j) WRITE(DOGLCD_SCK, HIGH); } b <<= 1; diff --git a/Marlin/src/HAL/STM32F1/tft/tft_spi.cpp b/Marlin/src/HAL/STM32F1/tft/tft_spi.cpp index 5264aabef6627..a68b2b98f8a3c 100644 --- a/Marlin/src/HAL/STM32F1/tft/tft_spi.cpp +++ b/Marlin/src/HAL/STM32F1/tft/tft_spi.cpp @@ -101,7 +101,7 @@ uint32_t TFT_SPI::ReadID(uint16_t Reg) { DataTransferBegin(DATASIZE_8BIT); WriteReg(Reg); - LOOP_L_N(i, 4) { + for (uint8_t i = 0; i < 4; ++i) { uint8_t d; SPIx.read(&d, 1); data = (data << 8) | d; diff --git a/Marlin/src/HAL/shared/servo.cpp b/Marlin/src/HAL/shared/servo.cpp index b838800de654f..bb9d61801841b 100644 --- a/Marlin/src/HAL/shared/servo.cpp +++ b/Marlin/src/HAL/shared/servo.cpp @@ -67,7 +67,7 @@ uint8_t ServoCount = 0; // the total number of attached 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) { + for (uint8_t channel = 0; channel < SERVOS_PER_TIMER; ++channel) { if (SERVO(timer, channel).Pin.isActive) return true; } diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 6184109030802..ac5a6b7ff9b02 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -321,7 +321,7 @@ bool pin_is_protected(const pin_t pin) { static constexpr size_t pincount = OnlyPins::size; static const pin_t (&sensitive_pins)[pincount] PROGMEM = OnlyPins::table; #endif - LOOP_L_N(i, pincount) { + for (uint8_t i = 0; i < pincount; ++i) { const pin_t * const pptr = &sensitive_pins[i]; if (pin == (sizeof(pin_t) == 2 ? (pin_t)pgm_read_word(pptr) : (pin_t)pgm_read_byte(pptr))) return true; } @@ -800,7 +800,7 @@ void idle(const bool no_stepper_sleep/*=false*/) { // Run StallGuard endstop checks #if ENABLED(SPI_ENDSTOPS) if (endstops.tmc_spi_homing.any && TERN1(IMPROVE_HOMING_RELIABILITY, ELAPSED(millis(), sg_guard_period))) - LOOP_L_N(i, 4) if (endstops.tmc_spi_homing_check()) break; // Read SGT 4 times per idle loop + for (uint8_t i = 0; i < 4; ++i) if (endstops.tmc_spi_homing_check()) break; // Read SGT 4 times per idle loop #endif // Handle SD Card insert / remove diff --git a/Marlin/src/core/macros.h b/Marlin/src/core/macros.h index c44d60843ad2d..565de2436c11f 100644 --- a/Marlin/src/core/macros.h +++ b/Marlin/src/core/macros.h @@ -326,11 +326,6 @@ #define _JOIN_1(O) (O) #define JOIN_N(N,C,V...) (DO(JOIN,C,LIST_N(N,V))) -#define LOOP_S_LE_N(VAR, S, N) for (uint8_t VAR=(S); VAR<=(N); VAR++) -#define LOOP_S_L_N(VAR, S, N) for (uint8_t VAR=(S); VAR<(N); VAR++) -#define LOOP_LE_N(VAR, N) LOOP_S_LE_N(VAR, 0, N) -#define LOOP_L_N(VAR, N) LOOP_S_L_N(VAR, 0, N) - #define NOOP (void(0)) #define CEILING(x,y) (((x) + (y) - 1) / (y)) diff --git a/Marlin/src/core/serial_base.h b/Marlin/src/core/serial_base.h index 059b424284989..fa0a2298f7c00 100644 --- a/Marlin/src/core/serial_base.h +++ b/Marlin/src/core/serial_base.h @@ -234,7 +234,7 @@ struct SerialBase { // Round correctly so that print(1.999, 2) prints as "2.00" double rounding = 0.5; - LOOP_L_N(i, digits) rounding *= 0.1; + for (uint8_t i = 0; i < digits; ++i) rounding *= 0.1; number += rounding; // Extract the integer part of the number and print it diff --git a/Marlin/src/core/types.h b/Marlin/src/core/types.h index 958155860414b..7b5837efb8d73 100644 --- a/Marlin/src/core/types.h +++ b/Marlin/src/core/types.h @@ -246,11 +246,11 @@ enum AxisEnum : uint8_t { // // Loop over axes // -#define LOOP_ABC(VAR) LOOP_S_LE_N(VAR, A_AXIS, C_AXIS) -#define LOOP_NUM_AXES(VAR) LOOP_S_L_N(VAR, 0, NUM_AXES) -#define LOOP_LOGICAL_AXES(VAR) LOOP_S_L_N(VAR, 0, LOGICAL_AXES) -#define LOOP_DISTINCT_AXES(VAR) LOOP_S_L_N(VAR, 0, DISTINCT_AXES) -#define LOOP_DISTINCT_E(VAR) LOOP_L_N(VAR, DISTINCT_E) +#define LOOP_ABC(VAR) for (uint8_t VAR = A_AXIS; VAR <= C_AXIS; ++VAR) +#define LOOP_NUM_AXES(VAR) for (uint8_t VAR = 0; VAR < NUM_AXES; ++VAR) +#define LOOP_LOGICAL_AXES(VAR) for (uint8_t VAR = 0; VAR < LOGICAL_AXES; ++VAR) +#define LOOP_DISTINCT_AXES(VAR) for (uint8_t VAR = 0; VAR < DISTINCT_AXES; ++VAR) +#define LOOP_DISTINCT_E(VAR) for (uint8_t VAR = 0; VAR < DISTINCT_E; ++VAR) // // feedRate_t is just a humble float diff --git a/Marlin/src/feature/babystep.h b/Marlin/src/feature/babystep.h index 70a529a0c3c58..df88da6e147a5 100644 --- a/Marlin/src/feature/babystep.h +++ b/Marlin/src/feature/babystep.h @@ -95,7 +95,7 @@ class Babystep { // apply accumulated babysteps to the axes. // static void task() { - LOOP_LE_N(i, BS_AXIS_IND(Z_AXIS)) step_axis(BS_AXIS(i)); + for (uint8_t i = 0; i <= BS_AXIS_IND(Z_AXIS); ++i) step_axis(BS_AXIS(i)); } private: diff --git a/Marlin/src/feature/bedlevel/abl/bbl.cpp b/Marlin/src/feature/bedlevel/abl/bbl.cpp index 6ef3945fa52c4..14c4bd24bcf08 100644 --- a/Marlin/src/feature/bedlevel/abl/bbl.cpp +++ b/Marlin/src/feature/bedlevel/abl/bbl.cpp @@ -133,8 +133,8 @@ void LevelingBilinear::extrapolate_unprobed_bed_level() { yend = ctry1; #endif - LOOP_LE_N(xo, xend) - LOOP_LE_N(yo, yend) { + for (uint8_t xo = 0; xo <= xend; ++xo) + for (uint8_t yo = 0; yo <= yend; ++yo) { uint8_t x2 = ctrx2 + xo, y2 = ctry2 + yo; #ifndef HALF_IN_X const uint8_t x1 = ctrx1 - xo; @@ -231,8 +231,8 @@ void LevelingBilinear::print_leveling_grid(const bed_mesh_t* _z_values/*=nullptr float LevelingBilinear::virt_2cmr(const uint8_t x, const uint8_t y, const_float_t tx, const_float_t ty) { float row[4], column[4]; - LOOP_L_N(i, 4) { - LOOP_L_N(j, 4) { + for (uint8_t i = 0; i < 4; ++i) { + for (uint8_t j = 0; j < 4; ++j) { column[j] = virt_coord(i + x - 1, j + y - 1); } row[i] = virt_cmr(column, 1, ty); @@ -243,10 +243,10 @@ void LevelingBilinear::print_leveling_grid(const bed_mesh_t* _z_values/*=nullptr void LevelingBilinear::subdivide_mesh() { grid_spacing_virt = grid_spacing / (BILINEAR_SUBDIVISIONS); grid_factor_virt = grid_spacing_virt.reciprocal(); - LOOP_L_N(y, GRID_MAX_POINTS_Y) - LOOP_L_N(x, GRID_MAX_POINTS_X) - LOOP_L_N(ty, BILINEAR_SUBDIVISIONS) - LOOP_L_N(tx, BILINEAR_SUBDIVISIONS) { + for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; ++y) + for (uint8_t x = 0; x < GRID_MAX_POINTS_X; ++x) + for (uint8_t ty = 0; ty < BILINEAR_SUBDIVISIONS; ++ty) + for (uint8_t tx = 0; tx < BILINEAR_SUBDIVISIONS; ++tx) { if ((ty && y == (GRID_MAX_POINTS_Y) - 1) || (tx && x == (GRID_MAX_POINTS_X) - 1)) continue; z_values_virt[x * (BILINEAR_SUBDIVISIONS) + tx][y * (BILINEAR_SUBDIVISIONS) + ty] = diff --git a/Marlin/src/feature/bedlevel/bedlevel.cpp b/Marlin/src/feature/bedlevel/bedlevel.cpp index 0bb8b8191a5ee..17407eafb958c 100644 --- a/Marlin/src/feature/bedlevel/bedlevel.cpp +++ b/Marlin/src/feature/bedlevel/bedlevel.cpp @@ -137,7 +137,7 @@ void reset_bed_level() { */ void print_2d_array(const uint8_t sx, const uint8_t sy, const uint8_t precision, const float *values) { #ifndef SCAD_MESH_OUTPUT - LOOP_L_N(x, sx) { + for (uint8_t x = 0; x < sx; ++x) { serial_spaces(precision + (x < 10 ? 3 : 2)); SERIAL_ECHO(x); } @@ -146,14 +146,14 @@ void reset_bed_level() { #ifdef SCAD_MESH_OUTPUT SERIAL_ECHOLNPGM("measured_z = ["); // open 2D array #endif - LOOP_L_N(y, sy) { + for (uint8_t y = 0; y < sy; ++y) { #ifdef SCAD_MESH_OUTPUT SERIAL_ECHOPGM(" ["); // open sub-array #else if (y < 10) SERIAL_CHAR(' '); SERIAL_ECHO(y); #endif - LOOP_L_N(x, sx) { + for (uint8_t x = 0; x < sx; ++x) { SERIAL_CHAR(' '); const float offset = values[x * sy + y]; if (!isnan(offset)) { @@ -166,7 +166,7 @@ void reset_bed_level() { SERIAL_CHAR(' '); SERIAL_ECHOPGM("NAN"); #else - LOOP_L_N(i, precision + 3) + for (uint8_t i = 0; i < precision + 3; ++i) SERIAL_CHAR(i ? '=' : ' '); #endif } diff --git a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp index 193cbbf7654ab..787827bb9bfca 100644 --- a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp +++ b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp @@ -40,9 +40,9 @@ mesh_bed_leveling::index_to_ypos[GRID_MAX_POINTS_Y]; mesh_bed_leveling::mesh_bed_leveling() { - LOOP_L_N(i, GRID_MAX_POINTS_X) + for (uint8_t i = 0; i < GRID_MAX_POINTS_X; ++i) index_to_xpos[i] = MESH_MIN_X + i * (MESH_X_DIST); - LOOP_L_N(i, GRID_MAX_POINTS_Y) + for (uint8_t i = 0; i < GRID_MAX_POINTS_Y; ++i) index_to_ypos[i] = MESH_MIN_Y + i * (MESH_Y_DIST); reset(); } diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.cpp b/Marlin/src/feature/bedlevel/ubl/ubl.cpp index ca519f86b49d2..b99334795d13d 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl.cpp @@ -149,7 +149,7 @@ static void serial_echo_xy(const uint8_t sp, const int16_t x, const int16_t y) { static void serial_echo_column_labels(const uint8_t sp) { SERIAL_ECHO_SP(7); - LOOP_L_N(i, GRID_MAX_POINTS_X) { + for (uint8_t i = 0; i < GRID_MAX_POINTS_X; ++i) { if (i < 10) SERIAL_CHAR(' '); SERIAL_ECHO(i); SERIAL_ECHO_SP(sp); @@ -199,7 +199,7 @@ void unified_bed_leveling::display_map(const uint8_t map_type) { } // Row Values (I indexes) - LOOP_L_N(i, GRID_MAX_POINTS_X) { + for (uint8_t i = 0; i < GRID_MAX_POINTS_X; ++i) { // Opening Brace or Space const bool is_current = i == curr.x && j == curr.y; diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index ecbf76ec6ed62..551277c35d1c8 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -396,7 +396,7 @@ void unified_bed_leveling::G29() { break; case 1: - LOOP_L_N(x, GRID_MAX_POINTS_X) { // Create a diagonal line several Mesh cells thick that is raised + for (uint8_t x = 0; x < GRID_MAX_POINTS_X; ++x) { // Create a diagonal line several Mesh cells thick that is raised const uint8_t x2 = x + (x < (GRID_MAX_POINTS_Y) - 1 ? 1 : -1); z_values[x][x] += 9.999f; z_values[x][x2] += 9.999f; // We want the altered line several mesh points thick @@ -1445,7 +1445,7 @@ void unified_bed_leveling::smart_fill_mesh() { 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)) { + for (uint8_t i = 0; i < COUNT(info); ++i) { const smart_fill_info *f = (smart_fill_info*)pgm_read_ptr(&info[i]); const int8_t sx = pgm_read_byte(&f->sx), sy = pgm_read_byte(&f->sy), ex = pgm_read_byte(&f->ex), ey = pgm_read_byte(&f->ey); @@ -1484,7 +1484,7 @@ void unified_bed_leveling::smart_fill_mesh() { #if ENABLED(UBL_TILT_ON_MESH_POINTS_3POINT) mesh_index_pair cpos[3]; - LOOP_L_N(ix, 3) { // Convert points to coordinates of mesh points + for (uint8_t ix = 0; ix < 3; ++ix) { // Convert points to coordinates of mesh points cpos[ix] = find_closest_mesh_point_of_type(REAL, points[ix], true); points[ix] = cpos[ix].meshpos(); } @@ -1494,7 +1494,7 @@ void unified_bed_leveling::smart_fill_mesh() { float gotz[3]; // Used for algorithm validation below #endif - LOOP_L_N(i, 3) { + for (uint8_t i = 0; i < 3; ++i) { SERIAL_ECHOLNPGM("Tilting mesh (", i + 1, "/3)"); TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " %i/3"), GET_TEXT(MSG_LCD_TILTING_MESH), i + 1)); @@ -1534,10 +1534,10 @@ void unified_bed_leveling::smart_fill_mesh() { const uint16_t total_points = sq(param.J_grid_size); uint16_t point_num = 1; - LOOP_L_N(ix, param.J_grid_size) { + for (uint8_t ix = 0; ix < param.J_grid_size; ++ix) { xy_pos_t rpos; rpos.x = x_min + ix * dx; - LOOP_L_N(iy, param.J_grid_size) { + for (uint8_t iy = 0; iy < param.J_grid_size; ++iy) { rpos.y = y_min + dy * (zig_zag ? param.J_grid_size - 1 - iy : iy); #if ENABLED(UBL_TILT_ON_MESH_POINTS) @@ -1714,17 +1714,17 @@ void unified_bed_leveling::smart_fill_mesh() { GRID_LOOP(jx, jy) if (!isnan(z_values[jx][jy])) SBI(bitmap[jx], jy); xy_pos_t ppos; - LOOP_L_N(ix, GRID_MAX_POINTS_X) { + for (uint8_t ix = 0; ix < GRID_MAX_POINTS_X; ++ix) { ppos.x = get_mesh_x(ix); - LOOP_L_N(iy, GRID_MAX_POINTS_Y) { + for (uint8_t iy = 0; iy < GRID_MAX_POINTS_Y; ++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) { + for (uint8_t jx = 0; jx < GRID_MAX_POINTS_X; ++jx) { rpos.x = get_mesh_x(jx); - LOOP_L_N(jy, GRID_MAX_POINTS_Y) { + for (uint8_t jy = 0; jy < GRID_MAX_POINTS_Y; ++jy) { if (TEST(bitmap[jx], jy)) { rpos.y = get_mesh_y(jy); const float rz = z_values[jx][jy], @@ -1784,7 +1784,7 @@ void unified_bed_leveling::smart_fill_mesh() { SERIAL_ECHOLNPGM("MESH_Y_DIST ", MESH_Y_DIST); serial_delay(50); SERIAL_ECHOPGM("X-Axis Mesh Points at: "); - LOOP_L_N(i, GRID_MAX_POINTS_X) { + for (uint8_t i = 0; i < GRID_MAX_POINTS_X; ++i) { SERIAL_ECHO_F(LOGICAL_X_POSITION(get_mesh_x(i)), 3); SERIAL_ECHOPGM(" "); serial_delay(25); @@ -1792,7 +1792,7 @@ void unified_bed_leveling::smart_fill_mesh() { SERIAL_EOL(); SERIAL_ECHOPGM("Y-Axis Mesh Points at: "); - LOOP_L_N(i, GRID_MAX_POINTS_Y) { + for (uint8_t i = 0; i < GRID_MAX_POINTS_Y; ++i) { SERIAL_ECHO_F(LOGICAL_Y_POSITION(get_mesh_y(i)), 3); SERIAL_ECHOPGM(" "); serial_delay(25); diff --git a/Marlin/src/feature/digipot/digipot_mcp4018.cpp b/Marlin/src/feature/digipot/digipot_mcp4018.cpp index 3f2ecbfcdc0b1..f776c5a339011 100644 --- a/Marlin/src/feature/digipot/digipot_mcp4018.cpp +++ b/Marlin/src/feature/digipot/digipot_mcp4018.cpp @@ -89,7 +89,7 @@ void DigipotI2C::set_current(const uint8_t channel, const float current) { } void DigipotI2C::init() { - LOOP_L_N(i, DIGIPOT_I2C_NUM_CHANNELS) pots[i].i2c_init(); + for (uint8_t i = 0; i < DIGIPOT_I2C_NUM_CHANNELS; ++i) pots[i].i2c_init(); // Init currents according to Configuration_adv.h static const float digipot_motor_current[] PROGMEM = @@ -99,7 +99,7 @@ void DigipotI2C::init() { DIGIPOT_I2C_MOTOR_CURRENTS #endif ; - LOOP_L_N(i, COUNT(digipot_motor_current)) + for (uint8_t i = 0; i < COUNT(digipot_motor_current); ++i) set_current(i, pgm_read_float(&digipot_motor_current[i])); } diff --git a/Marlin/src/feature/digipot/digipot_mcp4451.cpp b/Marlin/src/feature/digipot/digipot_mcp4451.cpp index ba5ecdad050a7..7416fe9f8d5c5 100644 --- a/Marlin/src/feature/digipot/digipot_mcp4451.cpp +++ b/Marlin/src/feature/digipot/digipot_mcp4451.cpp @@ -94,7 +94,7 @@ void DigipotI2C::init() { DIGIPOT_I2C_MOTOR_CURRENTS #endif ; - LOOP_L_N(i, COUNT(digipot_motor_current)) + for (uint8_t i = 0; i < COUNT(digipot_motor_current); ++i) set_current(i, pgm_read_float(&digipot_motor_current[i])); } diff --git a/Marlin/src/feature/encoder_i2c.cpp b/Marlin/src/feature/encoder_i2c.cpp index b1ff21cf92c7d..1c01e1c23b5ec 100644 --- a/Marlin/src/feature/encoder_i2c.cpp +++ b/Marlin/src/feature/encoder_i2c.cpp @@ -138,7 +138,7 @@ void I2CPositionEncoder::update() { errIdx = (errIdx >= I2CPE_ERR_ARRAY_SIZE - 1) ? 0 : errIdx + 1; err[errIdx] = get_axis_error_steps(false); - LOOP_L_N(i, I2CPE_ERR_ARRAY_SIZE) { + for (uint8_t i = 0; i < I2CPE_ERR_ARRAY_SIZE; ++i) { sum += err[i]; if (i) diffSum += ABS(err[i-1] - err[i]); } @@ -170,7 +170,7 @@ void I2CPositionEncoder::update() { errPrst[errPrstIdx++] = error; // Error must persist for I2CPE_ERR_PRST_ARRAY_SIZE error cycles. This also serves to improve the average accuracy if (errPrstIdx >= I2CPE_ERR_PRST_ARRAY_SIZE) { float sumP = 0; - LOOP_L_N(i, I2CPE_ERR_PRST_ARRAY_SIZE) sumP += errPrst[i]; + for (uint8_t i = 0; i < I2CPE_ERR_PRST_ARRAY_SIZE; ++i) sumP += errPrst[i]; const int32_t errorP = int32_t(sumP * RECIPROCAL(I2CPE_ERR_PRST_ARRAY_SIZE)); SERIAL_CHAR(AXIS_CHAR(encoderAxis)); SERIAL_ECHOLNPGM(" : CORRECT ERR ", errorP * planner.mm_per_step[encoderAxis], "mm"); @@ -404,7 +404,7 @@ void I2CPositionEncoder::calibrate_steps_mm(const uint8_t iter) { planner.synchronize(); - LOOP_L_N(i, iter) { + for (uint8_t i = 0; i < iter; ++i) { TERN_(HAS_EXTRUDERS, startCoord.e = planner.get_axis_position_mm(E_AXIS)); planner.buffer_line(startCoord, fr_mm_s, 0); planner.synchronize(); diff --git a/Marlin/src/feature/encoder_i2c.h b/Marlin/src/feature/encoder_i2c.h index f25fe2ea6bc4d..1ae05d1433b3e 100644 --- a/Marlin/src/feature/encoder_i2c.h +++ b/Marlin/src/feature/encoder_i2c.h @@ -90,7 +90,7 @@ #define I2CPE_PARSE_ERR 1 #define I2CPE_PARSE_OK 0 -#define LOOP_PE(VAR) LOOP_L_N(VAR, I2CPE_ENCODER_CNT) +#define LOOP_PE(VAR) for (uint8_t VAR = 0; VAR < I2CPE_ENCODER_CNT; ++VAR) #define CHECK_IDX() do{ if (!WITHIN(idx, 0, I2CPE_ENCODER_CNT - 1)) return; }while(0) typedef union { diff --git a/Marlin/src/feature/fancheck.cpp b/Marlin/src/feature/fancheck.cpp index 126b79b0a409f..844191e7e442f 100644 --- a/Marlin/src/feature/fancheck.cpp +++ b/Marlin/src/feature/fancheck.cpp @@ -72,7 +72,7 @@ void FanCheck::update_tachometers() { bool status; #define _TACHO_CASE(N) case N: status = READ(E##N##_FAN_TACHO_PIN); break; - LOOP_L_N(f, TACHO_COUNT) { + for (uint8_t f = 0; f < TACHO_COUNT; ++f) { switch (f) { #if HAS_E0_FAN_TACHO _TACHO_CASE(0) @@ -113,7 +113,7 @@ void FanCheck::compute_speed(uint16_t elapsedTime) { static uint8_t fan_reported_errors_msk = 0; uint8_t fan_error_msk = 0; - LOOP_L_N(f, TACHO_COUNT) { + for (uint8_t f = 0; f < TACHO_COUNT; ++f) { switch (f) { TERN_(HAS_E0_FAN_TACHO, case 0:) TERN_(HAS_E1_FAN_TACHO, case 1:) @@ -150,7 +150,7 @@ void FanCheck::compute_speed(uint16_t elapsedTime) { if (fan_error_msk & ~fan_reported_errors_msk) { // Handle new faults only - LOOP_L_N(f, TACHO_COUNT) if (TEST(fan_error_msk, f)) report_speed_error(f); + for (uint8_t f = 0; f < TACHO_COUNT; ++f) if (TEST(fan_error_msk, f)) report_speed_error(f); } fan_reported_errors_msk = fan_error_msk; } @@ -176,8 +176,8 @@ void FanCheck::report_speed_error(uint8_t fan) { } void FanCheck::print_fan_states() { - LOOP_L_N(s, 2) { - LOOP_L_N(f, TACHO_COUNT) { + for (uint8_t s = 0; s < 2; ++s) { + for (uint8_t f = 0; f < TACHO_COUNT; ++f) { switch (f) { TERN_(HAS_E0_FAN_TACHO, case 0:) TERN_(HAS_E1_FAN_TACHO, case 1:) diff --git a/Marlin/src/feature/filwidth.cpp b/Marlin/src/feature/filwidth.cpp index 2bd9c789808e7..3befd7752a6e0 100644 --- a/Marlin/src/feature/filwidth.cpp +++ b/Marlin/src/feature/filwidth.cpp @@ -42,7 +42,7 @@ int8_t FilamentWidthSensor::ratios[MAX_MEASUREMENT_DELAY + 1], // Ring void FilamentWidthSensor::init() { const int8_t ratio = sample_to_size_ratio(); - LOOP_L_N(i, COUNT(ratios)) ratios[i] = ratio; + for (uint8_t i = 0; i < COUNT(ratios); ++i) ratios[i] = ratio; index_r = index_w = 0; } diff --git a/Marlin/src/feature/leds/leds.cpp b/Marlin/src/feature/leds/leds.cpp index 45810a31ab3c0..7305581cd0461 100644 --- a/Marlin/src/feature/leds/leds.cpp +++ b/Marlin/src/feature/leds/leds.cpp @@ -76,8 +76,8 @@ void LEDLights::setup() { #endif delay(200); - LOOP_L_N(i, led_pin_count) { - LOOP_LE_N(b, 200) { + for (uint8_t i = 0; i < led_pin_count; ++i) { + for (uint8_t b = 0; b <= 200; ++b) { const uint16_t led_pwm = b <= 100 ? b : 200 - b; if (i == 0 && PWM_PIN(RGB_LED_R_PIN)) hal.set_pwm_duty(pin_t(RGB_LED_R_PIN), led_pwm); else WRITE(RGB_LED_R_PIN, b < 100 ? HIGH : LOW); if (i == 1 && PWM_PIN(RGB_LED_G_PIN)) hal.set_pwm_duty(pin_t(RGB_LED_G_PIN), led_pwm); else WRITE(RGB_LED_G_PIN, b < 100 ? HIGH : LOW); @@ -118,7 +118,7 @@ void LEDLights::setup() { while (led_pin_counters[0] != 99 || !canEnd) { if (led_pin_counters[0] == 99) // End loop next time pin0 counter is 99 canEnd = true; - LOOP_L_N(i, led_pin_count) { + for (uint8_t i = 0; i < led_pin_count; ++i) { if (led_pin_counters[i] > 0) { if (++led_pin_counters[i] == 400) // turn off current pin counter in led_pin_counters led_pin_counters[i] = 0; @@ -140,7 +140,7 @@ void LEDLights::setup() { } // Fade to white - LOOP_LE_N(led_pwm, 100) { + for (uint8_t led_pwm = 0; led_pwm <= 100; ++led_pwm) { NOLESS(curColor.r, led_pwm); NOLESS(curColor.g, led_pwm); NOLESS(curColor.b, led_pwm); diff --git a/Marlin/src/feature/max7219.cpp b/Marlin/src/feature/max7219.cpp index efc992f80fe1f..d3328855f4441 100644 --- a/Marlin/src/feature/max7219.cpp +++ b/Marlin/src/feature/max7219.cpp @@ -156,7 +156,7 @@ void Max7219::error(FSTR_P const func, const int32_t v1, const int32_t v2/*=-1*/ */ inline uint32_t flipped(const uint32_t bits, const uint8_t n_bytes) { uint32_t mask = 1, outbits = 0; - LOOP_L_N(b, n_bytes * 8) { + for (uint8_t b = 0; b < n_bytes * 8; ++b) { outbits <<= 1; if (bits & mask) outbits |= 1; mask <<= 1; @@ -339,13 +339,13 @@ void Max7219::fill() { void Max7219::clear_row(const uint8_t row) { if (row >= MAX7219_Y_LEDS) return error(F("clear_row"), row); - LOOP_L_N(x, MAX7219_X_LEDS) CLR_7219(x, row); + for (uint8_t x = 0; x < MAX7219_X_LEDS; ++x) CLR_7219(x, row); send_row(row); } void Max7219::clear_column(const uint8_t col) { if (col >= MAX7219_X_LEDS) return error(F("set_column"), col); - LOOP_L_N(y, MAX7219_Y_LEDS) CLR_7219(col, y); + for (uint8_t y = 0; y < MAX7219_Y_LEDS; ++y) CLR_7219(col, y); send_column(col); } @@ -357,7 +357,7 @@ void Max7219::clear_column(const uint8_t col) { void Max7219::set_row(const uint8_t row, const uint32_t val) { if (row >= MAX7219_Y_LEDS) return error(F("set_row"), row); uint32_t mask = _BV32(MAX7219_X_LEDS - 1); - LOOP_L_N(x, MAX7219_X_LEDS) { + for (uint8_t x = 0; x < MAX7219_X_LEDS; ++x) { if (val & mask) SET_7219(x, row); else CLR_7219(x, row); mask >>= 1; } @@ -372,7 +372,7 @@ void Max7219::set_row(const uint8_t row, const uint32_t val) { void Max7219::set_column(const uint8_t col, const uint32_t val) { if (col >= MAX7219_X_LEDS) return error(F("set_column"), col); uint32_t mask = _BV32(MAX7219_Y_LEDS - 1); - LOOP_L_N(y, MAX7219_Y_LEDS) { + for (uint8_t y = 0; y < MAX7219_Y_LEDS; ++y) { if (val & mask) SET_7219(col, y); else CLR_7219(col, y); mask >>= 1; } @@ -437,23 +437,23 @@ void Max7219::set_columns_32bits(const uint8_t x, uint32_t val) { // Initialize the Max7219 void Max7219::register_setup() { - LOOP_L_N(i, MAX7219_NUMBER_UNITS) + for (uint8_t i = 0; i < MAX7219_NUMBER_UNITS; ++i) send(max7219_reg_scanLimit, 0x07); pulse_load(); // Tell the chips to load the clocked out data - LOOP_L_N(i, MAX7219_NUMBER_UNITS) + for (uint8_t i = 0; i < MAX7219_NUMBER_UNITS; ++i) send(max7219_reg_decodeMode, 0x00); // Using an led matrix (not digits) pulse_load(); // Tell the chips to load the clocked out data - LOOP_L_N(i, MAX7219_NUMBER_UNITS) + for (uint8_t i = 0; i < MAX7219_NUMBER_UNITS; ++i) send(max7219_reg_shutdown, 0x01); // Not in shutdown mode pulse_load(); // Tell the chips to load the clocked out data - LOOP_L_N(i, MAX7219_NUMBER_UNITS) + for (uint8_t i = 0; i < MAX7219_NUMBER_UNITS; ++i) send(max7219_reg_displayTest, 0x00); // No display test pulse_load(); // Tell the chips to load the clocked out data - LOOP_L_N(i, MAX7219_NUMBER_UNITS) + for (uint8_t i = 0; i < MAX7219_NUMBER_UNITS; ++i) send(max7219_reg_intensity, 0x01 & 0x0F); // The first 0x0F is the value you can set // Range: 0x00 to 0x0F pulse_load(); // Tell the chips to load the clocked out data @@ -740,7 +740,7 @@ void Max7219::idle_tasks() { // batch line updates suspended--; if (!suspended) - LOOP_L_N(i, 8) if (row_change_mask & _BV(i)) + for (uint8_t i = 0; i < 8; ++i) if (row_change_mask & _BV(i)) refresh_line(i); // After resume() automatically do a refresh() diff --git a/Marlin/src/feature/mixing.cpp b/Marlin/src/feature/mixing.cpp index 7c9c54a314b8f..1ce489224813e 100644 --- a/Marlin/src/feature/mixing.cpp +++ b/Marlin/src/feature/mixing.cpp @@ -94,13 +94,13 @@ void Mixer::normalize(const uint8_t tool_index) { void Mixer::reset_vtools() { // Virtual Tools 0, 1, 2, 3 = Filament 1, 2, 3, 4, etc. // Every virtual tool gets a pure filament - LOOP_L_N(t, _MIN(MIXING_VIRTUAL_TOOLS, MIXING_STEPPERS)) + for (uint8_t t = 0; t < _MIN(MIXING_VIRTUAL_TOOLS, MIXING_STEPPERS); ++t) MIXER_STEPPER_LOOP(i) color[t][i] = (t == i) ? COLOR_A_MASK : 0; // Remaining virtual tools are 100% filament 1 #if MIXING_VIRTUAL_TOOLS > MIXING_STEPPERS - LOOP_S_L_N(t, MIXING_STEPPERS, MIXING_VIRTUAL_TOOLS) + for (uint8_t t = MIXING_STEPPERS; t < MIXING_VIRTUAL_TOOLS; ++t) MIXER_STEPPER_LOOP(i) color[t][i] = (i == 0) ? COLOR_A_MASK : 0; #endif diff --git a/Marlin/src/feature/mmu/mmu2.cpp b/Marlin/src/feature/mmu/mmu2.cpp index fbfcf3fd3f7fa..ea1a33ddaad49 100644 --- a/Marlin/src/feature/mmu/mmu2.cpp +++ b/Marlin/src/feature/mmu/mmu2.cpp @@ -403,7 +403,7 @@ void MMU2::tx_str(FSTR_P fstr) { void MMU2::tx_printf(FSTR_P format, int argument = -1) { clear_rx_buffer(); const uint8_t len = sprintf_P(tx_buffer, FTOP(format), argument); - LOOP_L_N(i, len) MMU2_SERIAL.write(tx_buffer[i]); + for (uint8_t i = 0; i < len; ++i) MMU2_SERIAL.write(tx_buffer[i]); prev_request = millis(); } @@ -413,7 +413,7 @@ void MMU2::tx_printf(FSTR_P format, int argument = -1) { void MMU2::tx_printf(FSTR_P format, int argument1, int argument2) { clear_rx_buffer(); const uint8_t len = sprintf_P(tx_buffer, FTOP(format), argument1, argument2); - LOOP_L_N(i, len) MMU2_SERIAL.write(tx_buffer[i]); + for (uint8_t i = 0; i < len; ++i) MMU2_SERIAL.write(tx_buffer[i]); prev_request = millis(); } @@ -467,7 +467,7 @@ inline void beep_bad_cmd() { BUZZ(400, 40); } bool MMU2::load_to_gears() { command(MMU_CMD_C0); manage_response(true, true); - LOOP_L_N(i, MMU2_C0_RETRY) { // Keep loading until filament reaches gears + for (uint8_t i = 0; i < MMU2_C0_RETRY; ++i) { // Keep loading until filament reaches gears if (mmu2s_triggered) break; command(MMU_CMD_C0); manage_response(true, true); @@ -900,7 +900,7 @@ void MMU2::filament_runout() { int filament_detected_count = 0; const int steps = (MMU2_CAN_LOAD_RETRACT) / (MMU2_CAN_LOAD_INCREMENT); DEBUG_ECHOLNPGM("MMU can_load:"); - LOOP_L_N(i, steps) { + for (uint8_t i = 0; i < steps; ++i) { execute_extruder_sequence(can_load_increment_sequence, COUNT(can_load_increment_sequence)); check_filament(); // Don't trust the idle function DEBUG_CHAR(mmu2s_triggered ? 'O' : 'o'); @@ -1047,7 +1047,7 @@ void MMU2::execute_extruder_sequence(const E_Step * sequence, int steps) { const E_Step *step = sequence; - LOOP_L_N(i, steps) { + for (uint8_t i = 0; i < steps; ++i) { const float es = pgm_read_float(&(step->extrude)); const feedRate_t fr_mm_m = pgm_read_float(&(step->feedRate)); DEBUG_ECHO_MSG("E step ", es, "/", fr_mm_m); diff --git a/Marlin/src/feature/powerloss.cpp b/Marlin/src/feature/powerloss.cpp index 24ff2b2195829..af85a16448629 100644 --- a/Marlin/src/feature/powerloss.cpp +++ b/Marlin/src/feature/powerloss.cpp @@ -630,7 +630,7 @@ void PrintJobRecovery::resume() { #if ENABLED(GCODE_REPEAT_MARKERS) DEBUG_ECHOLNPGM("repeat index: ", info.stored_repeat.index); - LOOP_L_N(i, info.stored_repeat.index) + for (uint8_t i = 0; i < info.stored_repeat.index; ++i) DEBUG_ECHOLNPGM("..... sdpos: ", info.stored_repeat.marker.sdpos, " count: ", info.stored_repeat.marker.counter); #endif diff --git a/Marlin/src/feature/probe_temp_comp.cpp b/Marlin/src/feature/probe_temp_comp.cpp index b5f636e698c95..2b362a2186b6f 100644 --- a/Marlin/src/feature/probe_temp_comp.cpp +++ b/Marlin/src/feature/probe_temp_comp.cpp @@ -66,13 +66,13 @@ float ProbeTempComp::init_measurement; // = 0.0 bool ProbeTempComp::enabled = true; void ProbeTempComp::reset() { - TERN_(PTC_PROBE, LOOP_L_N(i, PTC_PROBE_COUNT) z_offsets_probe[i] = z_offsets_probe_default[i]); - TERN_(PTC_BED, LOOP_L_N(i, PTC_BED_COUNT) z_offsets_bed[i] = z_offsets_bed_default[i]); - TERN_(PTC_HOTEND, LOOP_L_N(i, PTC_HOTEND_COUNT) z_offsets_hotend[i] = z_offsets_hotend_default[i]); + TERN_(PTC_PROBE, for (uint8_t i = 0; i < PTC_PROBE_COUNT; ++i) z_offsets_probe[i] = z_offsets_probe_default[i]); + TERN_(PTC_BED, for (uint8_t i = 0; i < PTC_BED_COUNT; ++i) z_offsets_bed[i] = z_offsets_bed_default[i]); + TERN_(PTC_HOTEND, for (uint8_t i = 0; i < PTC_HOTEND_COUNT; ++i) z_offsets_hotend[i] = z_offsets_hotend_default[i]); } void ProbeTempComp::clear_offsets(const TempSensorID tsi) { - LOOP_L_N(i, cali_info[tsi].measurements) + for (uint8_t i = 0; i < cali_info[tsi].measurements; ++i) sensor_z_offsets[tsi][i] = 0; calib_idx = 0; } @@ -84,7 +84,7 @@ bool ProbeTempComp::set_offset(const TempSensorID tsi, const uint8_t idx, const } void ProbeTempComp::print_offsets() { - LOOP_L_N(s, TSI_COUNT) { + for (uint8_t s = 0; s < TSI_COUNT; ++s) { celsius_t temp = cali_info[s].start_temp; for (int16_t i = -1; i < cali_info[s].measurements; ++i) { SERIAL_ECHOF( @@ -232,7 +232,7 @@ bool ProbeTempComp::linear_regression(const TempSensorID tsi, float &k, float &d sum_xy = 0, sum_y = 0; float xi = static_cast(start_temp); - LOOP_L_N(i, calib_idx) { + for (uint8_t i = 0; i < calib_idx; ++i) { const float yi = static_cast(data[i]); xi += res_temp; sum_x += xi; diff --git a/Marlin/src/feature/repeat.cpp b/Marlin/src/feature/repeat.cpp index fed7ac0908a0f..4484dab95b390 100644 --- a/Marlin/src/feature/repeat.cpp +++ b/Marlin/src/feature/repeat.cpp @@ -66,7 +66,7 @@ void Repeat::loop() { } } -void Repeat::cancel() { LOOP_L_N(i, index) marker[i].counter = 0; } +void Repeat::cancel() { for (uint8_t i = 0; i < index; ++i) marker[i].counter = 0; } void Repeat::early_parse_M808(char * const cmd) { if (is_command_M808(cmd)) { diff --git a/Marlin/src/feature/repeat.h b/Marlin/src/feature/repeat.h index fc11e4a9e2cff..8a54149b3d1e1 100644 --- a/Marlin/src/feature/repeat.h +++ b/Marlin/src/feature/repeat.h @@ -40,7 +40,7 @@ class Repeat { public: static void reset() { index = 0; } static bool is_active() { - LOOP_L_N(i, index) if (marker[i].counter) return true; + for (uint8_t i = 0; i < index; ++i) if (marker[i].counter) return true; return false; } static bool is_command_M808(char * const cmd) { return cmd[0] == 'M' && cmd[1] == '8' && cmd[2] == '0' && cmd[3] == '8' && !NUMERIC(cmd[4]); } diff --git a/Marlin/src/feature/runout.h b/Marlin/src/feature/runout.h index e160f889050d7..ea17cbc4422b5 100644 --- a/Marlin/src/feature/runout.h +++ b/Marlin/src/feature/runout.h @@ -155,7 +155,7 @@ class TFilamentMonitor : public FilamentMonitorBase { #if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG) if (runout_flags) { SERIAL_ECHOPGM("Runout Sensors: "); - LOOP_L_N(i, 8) SERIAL_ECHO('0' + TEST(runout_flags, i)); + for (uint8_t i = 0; i < 8; ++i) SERIAL_ECHO('0' + TEST(runout_flags, i)); SERIAL_ECHOPGM(" -> ", extruder); if (ran_out) SERIAL_ECHOPGM(" RUN OUT"); SERIAL_EOL(); @@ -255,7 +255,7 @@ class FilamentSensorBase { #if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG) if (change) { SERIAL_ECHOPGM("Motion detected:"); - LOOP_L_N(e, TERN(FILAMENT_SWITCH_AND_MOTION, NUM_MOTION_SENSORS, NUM_RUNOUT_SENSORS)) + for (uint8_t e = 0; e < TERN(FILAMENT_SWITCH_AND_MOTION, NUM_MOTION_SENSORS, NUM_RUNOUT_SENSORS); ++e) if (TEST(change, e)) SERIAL_CHAR(' ', '0' + e); SERIAL_EOL(); } @@ -304,7 +304,7 @@ class FilamentSensorBase { static void block_completed(const block_t * const) {} static void run() { - LOOP_L_N(s, NUM_RUNOUT_SENSORS) { + for (uint8_t s = 0; s < NUM_RUNOUT_SENSORS; ++s) { const bool out = poll_runout_state(s); if (!out) filament_present(s); #if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG) @@ -364,9 +364,9 @@ class FilamentSensorBase { static float runout_distance_mm; static void reset() { - LOOP_L_N(i, NUM_RUNOUT_SENSORS) filament_present(i); + for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) filament_present(i); #if ENABLED(FILAMENT_SWITCH_AND_MOTION) - LOOP_L_N(i, NUM_MOTION_SENSORS) filament_motion_present(i); + for (uint8_t i = 0; i < NUM_MOTION_SENSORS; ++i) filament_motion_present(i); #endif } @@ -376,10 +376,10 @@ class FilamentSensorBase { const millis_t ms = millis(); if (ELAPSED(ms, t)) { t = millis() + 1000UL; - LOOP_L_N(i, NUM_RUNOUT_SENSORS) + for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) SERIAL_ECHOF(i ? F(", ") : F("Runout remaining mm: "), mm_countdown.runout[i]); #if ENABLED(FILAMENT_SWITCH_AND_MOTION) - LOOP_L_N(i, NUM_MOTION_SENSORS) + for (uint8_t i = 0; i < NUM_MOTION_SENSORS; ++i) SERIAL_ECHOF(i ? F(", ") : F("Motion remaining mm: "), mm_countdown.motion[i]); #endif SERIAL_EOL(); @@ -389,9 +389,9 @@ class FilamentSensorBase { static uint8_t has_run_out() { uint8_t runout_flags = 0; - LOOP_L_N(i, NUM_RUNOUT_SENSORS) if (mm_countdown.runout[i] < 0) SBI(runout_flags, i); + for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) if (mm_countdown.runout[i] < 0) SBI(runout_flags, i); #if ENABLED(FILAMENT_SWITCH_AND_MOTION) - LOOP_L_N(i, NUM_MOTION_SENSORS) if (mm_countdown.motion[i] < 0) SBI(runout_flags, i); + for (uint8_t i = 0; i < NUM_MOTION_SENSORS; ++i) if (mm_countdown.motion[i] < 0) SBI(runout_flags, i); #endif return runout_flags; } @@ -432,16 +432,16 @@ class FilamentSensorBase { public: static void reset() { - LOOP_L_N(i, NUM_RUNOUT_SENSORS) filament_present(i); + for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) filament_present(i); } static void run() { - LOOP_L_N(i, NUM_RUNOUT_SENSORS) if (runout_count[i] >= 0) runout_count[i]--; + for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) if (runout_count[i] >= 0) runout_count[i]--; } static uint8_t has_run_out() { uint8_t runout_flags = 0; - LOOP_L_N(i, NUM_RUNOUT_SENSORS) if (runout_count[i] < 0) SBI(runout_flags, i); + for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) if (runout_count[i] < 0) SBI(runout_flags, i); return runout_flags; } diff --git a/Marlin/src/feature/twibus.cpp b/Marlin/src/feature/twibus.cpp index 9aec6b030537f..4aedb4b5f3c50 100644 --- a/Marlin/src/feature/twibus.cpp +++ b/Marlin/src/feature/twibus.cpp @@ -145,7 +145,7 @@ void TWIBus::echodata(uint8_t bytes, FSTR_P const pref, uint8_t adr, const uint8 void TWIBus::echobuffer(FSTR_P const prefix, uint8_t adr) { echoprefix(buffer_s, prefix, adr); - LOOP_L_N(i, buffer_s) SERIAL_CHAR(buffer[i]); + for (uint8_t i = 0; i < buffer_s; ++i) SERIAL_CHAR(buffer[i]); SERIAL_EOL(); } diff --git a/Marlin/src/feature/x_twist.cpp b/Marlin/src/feature/x_twist.cpp index b5ad25cba87d7..b8f7e52ab6d58 100644 --- a/Marlin/src/feature/x_twist.cpp +++ b/Marlin/src/feature/x_twist.cpp @@ -43,12 +43,12 @@ void XATC::reset() { void XATC::print_points() { SERIAL_ECHOLNPGM(" X-Twist Correction:"); - LOOP_L_N(x, XATC_MAX_POINTS) { + for (uint8_t x = 0; x < XATC_MAX_POINTS; ++x) { SERIAL_CHAR(' '); if (!isnan(z_offset[x])) serial_offset(z_offset[x]); else - LOOP_L_N(i, 6) SERIAL_CHAR(i ? '=' : ' '); + for (uint8_t i = 0; i < 6; ++i) SERIAL_CHAR(i ? '=' : ' '); } SERIAL_EOL(); } diff --git a/Marlin/src/gcode/bedlevel/G26.cpp b/Marlin/src/gcode/bedlevel/G26.cpp index 1b55bdb4286c7..30643cb84e9bd 100644 --- a/Marlin/src/gcode/bedlevel/G26.cpp +++ b/Marlin/src/gcode/bedlevel/G26.cpp @@ -707,7 +707,7 @@ void GcodeSuite::G26() { #error "A_CNT must be a positive value. Please change A_INT." #endif float trig_table[A_CNT]; - LOOP_L_N(i, A_CNT) + for (uint8_t i = 0; i < A_CNT; ++i) trig_table[i] = INTERSECTION_CIRCLE_RADIUS * cos(RADIANS(i * A_INT)); #endif // !ARC_SUPPORT diff --git a/Marlin/src/gcode/bedlevel/G35.cpp b/Marlin/src/gcode/bedlevel/G35.cpp index 901e97ab756b4..9c1ee472ec5ae 100644 --- a/Marlin/src/gcode/bedlevel/G35.cpp +++ b/Marlin/src/gcode/bedlevel/G35.cpp @@ -97,7 +97,7 @@ void GcodeSuite::G35() { bool err_break = false; // Probe all positions - LOOP_L_N(i, G35_PROBE_COUNT) { + for (uint8_t i = 0; i < G35_PROBE_COUNT; ++i) { const float z_probed_height = probe.probe_at_point(tramming_points[i], PROBE_PT_RAISE); if (isnan(z_probed_height)) { SERIAL_ECHOPGM("G35 failed at point ", i + 1, " ("); @@ -122,7 +122,7 @@ void GcodeSuite::G35() { const float threads_factor[] = { 0.5, 0.7, 0.8 }; // Calculate adjusts - LOOP_S_L_N(i, 1, G35_PROBE_COUNT) { + for (uint8_t i = 1; i < G35_PROBE_COUNT; ++i) { const float diff = z_measured[0] - z_measured[i], adjust = ABS(diff) < 0.001f ? 0 : diff / threads_factor[(screw_thread - 30) / 10]; diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 5c86f4b991687..ca02fc9765362 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -728,7 +728,7 @@ G29_TYPE GcodeSuite::G29() { // Probe at 3 arbitrary points - LOOP_L_N(i, 3) { + for (uint8_t i = 0; i < 3; ++i) { if (abl.verbose_level) SERIAL_ECHOLNPGM("Probing point ", i + 1, "/3."); TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " %i/3"), GET_TEXT(MSG_PROBING_POINT), int(i + 1))); @@ -839,7 +839,7 @@ G29_TYPE GcodeSuite::G29() { auto print_topo_map = [&](FSTR_P const title, const bool get_min) { SERIAL_ECHOF(title); for (int8_t yy = abl.grid_points.y - 1; yy >= 0; yy--) { - LOOP_L_N(xx, abl.grid_points.x) { + for (uint8_t xx = 0; xx < abl.grid_points.x; ++xx) { const int ind = abl.indexIntoAB[xx][yy]; xyz_float_t tmp = { abl.eqnAMatrix[ind + 0 * abl.abl_points], abl.eqnAMatrix[ind + 1 * abl.abl_points], 0 }; diff --git a/Marlin/src/gcode/bedlevel/abl/M421.cpp b/Marlin/src/gcode/bedlevel/abl/M421.cpp index 3272ea1bd2273..f66d0231901e0 100644 --- a/Marlin/src/gcode/bedlevel/abl/M421.cpp +++ b/Marlin/src/gcode/bedlevel/abl/M421.cpp @@ -56,8 +56,8 @@ void GcodeSuite::M421() { const float zval = parser.value_linear_units(); uint8_t sx = ix >= 0 ? ix : 0, ex = ix >= 0 ? ix : GRID_MAX_POINTS_X - 1, 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) { + for (uint8_t x = sx; x <= ex; ++x) { + for (uint8_t y = sy; y <= ey; ++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])); } diff --git a/Marlin/src/gcode/calibrate/G34_M422.cpp b/Marlin/src/gcode/calibrate/G34_M422.cpp index a878db2edfec7..7650443de8621 100644 --- a/Marlin/src/gcode/calibrate/G34_M422.cpp +++ b/Marlin/src/gcode/calibrate/G34_M422.cpp @@ -204,7 +204,7 @@ void GcodeSuite::G34() { float z_measured_max = -100000.0f; // Probe all positions (one per Z-Stepper) - LOOP_L_N(i, NUM_Z_STEPPERS) { + for (uint8_t i = 0; i < NUM_Z_STEPPERS; ++i) { // iteration odd/even --> downward / upward stepper sequence const uint8_t iprobe = (iteration & 1) ? NUM_Z_STEPPERS - 1 - i : i; @@ -255,14 +255,14 @@ 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_STEPPERS) { + for (uint8_t i = 0; i < NUM_Z_STEPPERS; ++i) { 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_STEPPERS) { + for (uint8_t i = 0; i < NUM_Z_STEPPERS; ++i) { 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]); } @@ -330,12 +330,12 @@ void GcodeSuite::G34() { // Calculate mean value as a reference float z_measured_mean = 0.0f; - LOOP_L_N(zstepper, NUM_Z_STEPPERS) z_measured_mean += z_measured[zstepper]; + for (uint8_t zstepper = 0; zstepper < NUM_Z_STEPPERS; ++zstepper) 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_STEPPERS) + for (uint8_t zstepper = 0; zstepper < NUM_Z_STEPPERS; ++zstepper) z_align_level_indicator += ABS(z_measured[zstepper] - z_measured_mean); // If it's getting worse, stop and throw an error @@ -350,7 +350,7 @@ void GcodeSuite::G34() { bool success_break = true; // Correct the individual stepper offsets - LOOP_L_N(zstepper, NUM_Z_STEPPERS) { + for (uint8_t zstepper = 0; zstepper < NUM_Z_STEPPERS; ++zstepper) { // Calculate current stepper move float z_align_move = z_measured[zstepper] - z_measured_min; const float z_align_abs = ABS(z_align_move); @@ -529,7 +529,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_STEPPERS) { + for (uint8_t i = 0; i < NUM_Z_STEPPERS; ++i) { report_echo_start(forReplay); SERIAL_ECHOLNPGM_P( PSTR(" M422 S"), i + 1, @@ -538,7 +538,7 @@ void GcodeSuite::M422_report(const bool forReplay/*=true*/) { ); } #if HAS_Z_STEPPER_ALIGN_STEPPER_XY - LOOP_L_N(i, NUM_Z_STEPPERS) { + for (uint8_t i = 0; i < NUM_Z_STEPPERS; ++i) { report_echo_start(forReplay); SERIAL_ECHOLNPGM_P( PSTR(" M422 W"), i + 1, diff --git a/Marlin/src/gcode/calibrate/G425.cpp b/Marlin/src/gcode/calibrate/G425.cpp index ef055498a922e..fb211ad88c743 100644 --- a/Marlin/src/gcode/calibrate/G425.cpp +++ b/Marlin/src/gcode/calibrate/G425.cpp @@ -171,7 +171,7 @@ inline void park_above_object(measurements_t &m, const float uncertainty) { #if HAS_HOTEND_OFFSET inline void normalize_hotend_offsets() { - LOOP_S_L_N(e, 1, HOTENDS) + for (uint8_t e = 1; e < HOTENDS; ++e) hotend_offset[e] -= hotend_offset[0]; hotend_offset[0].reset(); } @@ -618,7 +618,7 @@ inline void probe_sides(measurements_t &m, const float uncertainty) { // This function requires normalize_hotend_offsets() to be called // inline void report_hotend_offsets() { - LOOP_S_L_N(e, 1, HOTENDS) + for (uint8_t e = 1; e < HOTENDS; ++e) SERIAL_ECHOLNPGM_P(PSTR("T"), e, PSTR(" Hotend Offset X"), hotend_offset[e].x, SP_Y_STR, hotend_offset[e].y, SP_Z_STR, hotend_offset[e].z); } #endif diff --git a/Marlin/src/gcode/calibrate/M100.cpp b/Marlin/src/gcode/calibrate/M100.cpp index 9141d360e1b96..3791c69f88bd6 100644 --- a/Marlin/src/gcode/calibrate/M100.cpp +++ b/Marlin/src/gcode/calibrate/M100.cpp @@ -163,14 +163,14 @@ inline int32_t count_test_bytes(const char * const start_free_memory) { while (start_free_memory < end_free_memory) { print_hex_address(start_free_memory); // Print the address SERIAL_CHAR(':'); - LOOP_L_N(i, 16) { // and 16 data bytes + for (uint8_t i = 0; i < 16; ++i) { // and 16 data bytes if (i == 8) SERIAL_CHAR('-'); print_hex_byte(start_free_memory[i]); SERIAL_CHAR(' '); } serial_delay(25); SERIAL_CHAR('|'); // Point out non test bytes - LOOP_L_N(i, 16) { + for (uint8_t i = 0; i < 16; ++i) { char ccc = (char)start_free_memory[i]; // cast to char before automatically casting to char on assignment, in case the compiler is broken ccc = (ccc == TEST_BYTE) ? ' ' : '?'; SERIAL_CHAR(ccc); diff --git a/Marlin/src/gcode/calibrate/M48.cpp b/Marlin/src/gcode/calibrate/M48.cpp index 701e9386979a2..2748d4e7bada7 100644 --- a/Marlin/src/gcode/calibrate/M48.cpp +++ b/Marlin/src/gcode/calibrate/M48.cpp @@ -148,7 +148,7 @@ void GcodeSuite::M48() { float sample_sum = 0.0; - LOOP_L_N(n, n_samples) { + for (uint8_t n = 0; n < n_samples; ++n) { #if HAS_STATUS_MESSAGE // Display M48 progress in the status bar ui.status_printf(0, F(S_FMT ": %d/%d"), GET_TEXT(MSG_M48_POINT), int(n + 1), int(n_samples)); @@ -175,7 +175,7 @@ void GcodeSuite::M48() { } // Move from leg to leg in rapid succession - LOOP_L_N(l, n_legs - 1) { + for (uint8_t l = 0; l < n_legs - 1; ++l) { // Move some distance around the perimeter float delta_angle; @@ -243,7 +243,7 @@ void GcodeSuite::M48() { // Calculate the standard deviation so far. // The value after the last sample will be the final output. float dev_sum = 0.0; - LOOP_LE_N(j, n) dev_sum += sq(sample_set[j] - mean); + for (uint8_t j = 0; j <= n; ++j) dev_sum += sq(sample_set[j] - mean); sigma = SQRT(dev_sum / (n + 1)); if (verbose_level > 1) { diff --git a/Marlin/src/gcode/config/M200-M205.cpp b/Marlin/src/gcode/config/M200-M205.cpp index 8383be691466f..e5e1edf3261f8 100644 --- a/Marlin/src/gcode/config/M200-M205.cpp +++ b/Marlin/src/gcode/config/M200-M205.cpp @@ -168,7 +168,7 @@ void GcodeSuite::M201_report(const bool forReplay/*=true*/) { #endif #if ENABLED(DISTINCT_E_FACTORS) - LOOP_L_N(i, E_STEPPERS) { + for (uint8_t i = 0; i < E_STEPPERS; ++i) { report_echo_start(forReplay); SERIAL_ECHOLNPGM_P( PSTR(" M201 T"), i @@ -224,7 +224,7 @@ void GcodeSuite::M203_report(const bool forReplay/*=true*/) { #endif #if ENABLED(DISTINCT_E_FACTORS) - LOOP_L_N(i, E_STEPPERS) { + for (uint8_t i = 0; i < E_STEPPERS; ++i) { if (!forReplay) SERIAL_ECHO_START(); SERIAL_ECHOLNPGM_P( PSTR(" M203 T"), i diff --git a/Marlin/src/gcode/config/M218.cpp b/Marlin/src/gcode/config/M218.cpp index 62295f5771c60..d645685701ec6 100644 --- a/Marlin/src/gcode/config/M218.cpp +++ b/Marlin/src/gcode/config/M218.cpp @@ -64,7 +64,7 @@ void GcodeSuite::M218() { void GcodeSuite::M218_report(const bool forReplay/*=true*/) { report_heading_etc(forReplay, F(STR_HOTEND_OFFSETS)); - LOOP_S_L_N(e, 1, HOTENDS) { + for (uint8_t e = 1; e < HOTENDS; ++e) { report_echo_start(forReplay); SERIAL_ECHOPGM_P( PSTR(" M218 T"), e, diff --git a/Marlin/src/gcode/config/M281.cpp b/Marlin/src/gcode/config/M281.cpp index e4ef3ab40b8cf..2e7f08fe86592 100644 --- a/Marlin/src/gcode/config/M281.cpp +++ b/Marlin/src/gcode/config/M281.cpp @@ -56,7 +56,7 @@ void GcodeSuite::M281() { void GcodeSuite::M281_report(const bool forReplay/*=true*/) { report_heading_etc(forReplay, F(STR_SERVO_ANGLES)); - LOOP_L_N(i, NUM_SERVOS) { + for (uint8_t i = 0; i < NUM_SERVOS; ++i) { switch (i) { default: break; #if ENABLED(SWITCHING_EXTRUDER) diff --git a/Marlin/src/gcode/config/M305.cpp b/Marlin/src/gcode/config/M305.cpp index e7746923b3188..48d7cf18820a3 100644 --- a/Marlin/src/gcode/config/M305.cpp +++ b/Marlin/src/gcode/config/M305.cpp @@ -69,7 +69,7 @@ void GcodeSuite::M305() { SERIAL_ECHO_MSG("!Invalid Steinhart-Hart C coeff. (-0.01 < C < +0.01)"); } // If not setting then report parameters else if (t_index < 0) { // ...all user thermistors - LOOP_L_N(i, USER_THERMISTORS) + for (uint8_t i = 0; i < USER_THERMISTORS; ++i) thermalManager.M305_report(i); } else // ...one user thermistor diff --git a/Marlin/src/gcode/config/M43.cpp b/Marlin/src/gcode/config/M43.cpp index 3b95ccd3bb1c1..7daf8afab8b6e 100644 --- a/Marlin/src/gcode/config/M43.cpp +++ b/Marlin/src/gcode/config/M43.cpp @@ -61,7 +61,7 @@ inline void toggle_pins() { end = PARSED_PIN_INDEX('L', NUM_DIGITAL_PINS - 1), wait = parser.intval('W', 500); - LOOP_S_LE_N(i, start, end) { + for (uint8_t i = start; i <= end; ++i) { pin_t pin = GET_PIN_MAP_PIN_M43(i); if (!VALID_PIN(pin)) continue; if (M43_NEVER_TOUCH(i) || (!ignore_protection && pin_is_protected(pin))) { @@ -189,7 +189,7 @@ inline void servo_probe_test() { // DEPLOY and STOW 4 times and see if the signal follows // Then it is a mechanical switch SERIAL_ECHOLNPGM(". Deploy & stow 4 times"); - LOOP_L_N(i, 4) { + for (uint8_t i = 0; i < 4; ++i) { servo[probe_index].move(servo_angles[Z_PROBE_SERVO_NR][0]); // Deploy safe_delay(500); deploy_state = READ(PROBE_TEST_PIN); @@ -328,7 +328,7 @@ void GcodeSuite::M43() { const uint8_t pin_count = last_pin - first_pin + 1; uint8_t pin_state[pin_count]; bool can_watch = false; - LOOP_S_LE_N(i, first_pin, last_pin) { + for (uint8_t i = first_pin; i <= last_pin; ++i) { pin_t pin = GET_PIN_MAP_PIN_M43(i); if (!VALID_PIN(pin)) continue; if (M43_NEVER_TOUCH(i) || (!ignore_protection && pin_is_protected(pin))) continue; @@ -371,7 +371,7 @@ void GcodeSuite::M43() { #endif for (;;) { - LOOP_S_LE_N(i, first_pin, last_pin) { + for (uint8_t i = first_pin; i <= last_pin; ++i) { const pin_t pin = GET_PIN_MAP_PIN_M43(i); if (!VALID_PIN(pin)) continue; if (M43_NEVER_TOUCH(i) || (!ignore_protection && pin_is_protected(pin))) continue; @@ -400,7 +400,7 @@ void GcodeSuite::M43() { } else { // Report current state of selected pin(s) - LOOP_S_LE_N(i, first_pin, last_pin) { + for (uint8_t i = first_pin; i <= last_pin; ++i) { const pin_t pin = GET_PIN_MAP_PIN_M43(i); if (VALID_PIN(pin)) report_pin_state_extended(pin, ignore_protection, true); } diff --git a/Marlin/src/gcode/config/M672.cpp b/Marlin/src/gcode/config/M672.cpp index 257b49471f61b..064d05d0b6393 100644 --- a/Marlin/src/gcode/config/M672.cpp +++ b/Marlin/src/gcode/config/M672.cpp @@ -54,7 +54,7 @@ // b3 b2 b1 b0 ~b0 ... lo bits, NOT last bit // void M672_send(uint8_t b) { // bit rate requirement: 1kHz +/- 30% - LOOP_L_N(bits, 14) { + for (uint8_t bits = 0; bits < 14; ++bits) { switch (bits) { default: { OUT_WRITE(SMART_EFFECTOR_MOD_PIN, !!(b & 0x80)); b <<= 1; break; } // send bit, shift next into place case 7: diff --git a/Marlin/src/gcode/config/M92.cpp b/Marlin/src/gcode/config/M92.cpp index 888a7e5c21d0b..e848665e6b6d1 100644 --- a/Marlin/src/gcode/config/M92.cpp +++ b/Marlin/src/gcode/config/M92.cpp @@ -115,7 +115,7 @@ void GcodeSuite::M92_report(const bool forReplay/*=true*/, const int8_t e/*=-1*/ #endif #if ENABLED(DISTINCT_E_FACTORS) - LOOP_L_N(i, E_STEPPERS) { + for (uint8_t i = 0; i < E_STEPPERS; ++i) { if (e >= 0 && i != e) continue; report_echo_start(forReplay); SERIAL_ECHOLNPGM_P( diff --git a/Marlin/src/gcode/control/M111.cpp b/Marlin/src/gcode/control/M111.cpp index a92d334ae9d38..02f37f84974e1 100644 --- a/Marlin/src/gcode/control/M111.cpp +++ b/Marlin/src/gcode/control/M111.cpp @@ -46,7 +46,7 @@ void GcodeSuite::M111() { SERIAL_ECHOPGM(STR_DEBUG_PREFIX); if (marlin_debug_flags) { uint8_t comma = 0; - LOOP_L_N(i, COUNT(debug_strings)) { + for (uint8_t i = 0; i < COUNT(debug_strings); ++i) { if (TEST(marlin_debug_flags, i)) { if (comma++) SERIAL_CHAR(','); SERIAL_ECHOPGM_P((PGM_P)pgm_read_ptr(&debug_strings[i])); diff --git a/Marlin/src/gcode/feature/camera/M240.cpp b/Marlin/src/gcode/feature/camera/M240.cpp index cf2e47ef6d2fc..f79e80bcc236d 100644 --- a/Marlin/src/gcode/feature/camera/M240.cpp +++ b/Marlin/src/gcode/feature/camera/M240.cpp @@ -84,7 +84,7 @@ inline void spin_photo_pin() { static constexpr uint32_t sequence[] = PHOTO_PULSES_US; - LOOP_L_N(i, COUNT(sequence)) + for (uint8_t i = 0; i < COUNT(sequence); ++i) pulse_photo_pin(sequence[i], !(i & 1)); } diff --git a/Marlin/src/gcode/feature/digipot/M907-M910.cpp b/Marlin/src/gcode/feature/digipot/M907-M910.cpp index 9ebe713cde46a..8869f8d494623 100644 --- a/Marlin/src/gcode/feature/digipot/M907-M910.cpp +++ b/Marlin/src/gcode/feature/digipot/M907-M910.cpp @@ -51,7 +51,7 @@ void GcodeSuite::M907() { 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()); + if (parser.seenval('S')) for (uint8_t i = 0; i < MOTOR_CURRENT_COUNT; ++i) stepper.set_digipot_current(i, parser.value_int()); LOOP_LOGICAL_AXES(i) if (parser.seenval(IAXIS_CHAR(i))) stepper.set_digipot_current(i, parser.value_int()); // X Y Z (I J K U V W) E (map to drivers according to DIGIPOT_CHANNELS. Default with NUM_AXES 3: map X Y Z E to X Y Z E0) // Additional extruders use B,C. // TODO: Change these parameters because 'E' is used and D should be reserved for debugging. B? @@ -82,7 +82,7 @@ void GcodeSuite::M907() { #endif )) return M907_report(); - if (parser.seenval('S')) LOOP_L_N(a, MOTOR_CURRENT_COUNT) stepper.set_digipot_current(a, parser.value_int()); + if (parser.seenval('S')) for (uint8_t a = 0; a < MOTOR_CURRENT_COUNT; ++a) stepper.set_digipot_current(a, parser.value_int()); #if HAS_X_Y_XY_I_J_K_U_V_W if (NUM_AXIS_GANG( @@ -104,7 +104,7 @@ void GcodeSuite::M907() { #if HAS_MOTOR_CURRENT_I2C // this one uses actual amps in floating point - if (parser.seenval('S')) LOOP_L_N(q, DIGIPOT_I2C_NUM_CHANNELS) digipot_i2c.set_current(q, parser.value_float()); + if (parser.seenval('S')) for (uint8_t q = 0; q < DIGIPOT_I2C_NUM_CHANNELS; ++q) digipot_i2c.set_current(q, parser.value_float()); LOOP_LOGICAL_AXES(i) if (parser.seenval(IAXIS_CHAR(i))) digipot_i2c.set_current(i, parser.value_float()); // X Y Z (I J K U V W) E (map to drivers according to pots adresses. Default with NUM_AXES 3 X Y Z E: map to X Y Z E0) // Additional extruders use B,C,D. // TODO: Change these parameters because 'E' is used and because 'D' should be reserved for debugging. B? diff --git a/Marlin/src/gcode/feature/leds/M7219.cpp b/Marlin/src/gcode/feature/leds/M7219.cpp index 40d3554dfe6e2..1f74217be3cb4 100644 --- a/Marlin/src/gcode/feature/leds/M7219.cpp +++ b/Marlin/src/gcode/feature/leds/M7219.cpp @@ -79,7 +79,7 @@ void GcodeSuite::M7219() { } if (parser.seen('P')) { - LOOP_L_N(r, MAX7219_LINES) { + for (uint8_t r = 0; r < MAX7219_LINES; ++r) { SERIAL_ECHOPGM("led_line["); if (r < 10) SERIAL_CHAR(' '); SERIAL_ECHO(r); diff --git a/Marlin/src/gcode/feature/network/M552-M554.cpp b/Marlin/src/gcode/feature/network/M552-M554.cpp index 0973fb87bf1a2..ca7ddd0d360fc 100644 --- a/Marlin/src/gcode/feature/network/M552-M554.cpp +++ b/Marlin/src/gcode/feature/network/M552-M554.cpp @@ -46,7 +46,7 @@ void MAC_report() { if (ethernet.hardware_enabled) { Ethernet.MACAddress(mac); SERIAL_ECHOPGM(" MAC: "); - LOOP_L_N(i, 6) { + for (uint8_t i = 0; i < 6; ++i) { if (mac[i] < 16) SERIAL_CHAR('0'); SERIAL_PRINT(mac[i], PrintBase::Hex); if (i < 5) SERIAL_CHAR(':'); @@ -59,7 +59,7 @@ void MAC_report() { // otherwise show the stored values void ip_report(const uint16_t cmd, FSTR_P const post, const IPAddress &ipo) { SERIAL_CHAR('M'); SERIAL_ECHO(cmd); SERIAL_CHAR(' '); - LOOP_L_N(i, 4) { + for (uint8_t i = 0; i < 4; ++i) { SERIAL_ECHO(ipo[i]); if (i < 3) SERIAL_CHAR('.'); } diff --git a/Marlin/src/gcode/host/M114.cpp b/Marlin/src/gcode/host/M114.cpp index 3a75e687b8461..979764f75e30a 100644 --- a/Marlin/src/gcode/host/M114.cpp +++ b/Marlin/src/gcode/host/M114.cpp @@ -30,7 +30,7 @@ void report_all_axis_pos(const xyze_pos_t &pos, const uint8_t n=LOGICAL_AXES, const uint8_t precision=3) { char str[12]; - LOOP_L_N(a, n) { + for (uint8_t a = 0; a < n; ++a) { SERIAL_ECHOPGM_P((PGM_P)pgm_read_ptr(&SP_AXIS_LBL[a])); if (pos[a] >= 0) SERIAL_CHAR(' '); SERIAL_ECHO(dtostrf(pos[a], 1, precision, str)); diff --git a/Marlin/src/gcode/host/M115.cpp b/Marlin/src/gcode/host/M115.cpp index 8ca6d07ce2699..806e593fcb4a9 100644 --- a/Marlin/src/gcode/host/M115.cpp +++ b/Marlin/src/gcode/host/M115.cpp @@ -81,7 +81,7 @@ void GcodeSuite::M115() { // Although this code should work on all STM32 based boards SERIAL_ECHOPGM(" UUID:"); uint32_t *uid_address = (uint32_t*)UID_BASE; - LOOP_L_N(i, 3) { + for (uint8_t i = 0; i < 3; ++i) { const uint32_t UID = uint32_t(READ_REG(*(uid_address))); uid_address += 4U; for (int B = 24; B >= 0; B -= 8) print_hex_byte(UID >> B); diff --git a/Marlin/src/gcode/lcd/M145.cpp b/Marlin/src/gcode/lcd/M145.cpp index 942d20afd2f83..d72d5d6789896 100644 --- a/Marlin/src/gcode/lcd/M145.cpp +++ b/Marlin/src/gcode/lcd/M145.cpp @@ -62,7 +62,7 @@ void GcodeSuite::M145() { void GcodeSuite::M145_report(const bool forReplay/*=true*/) { report_heading(forReplay, F(STR_MATERIAL_HEATUP)); - LOOP_L_N(i, PREHEAT_COUNT) { + for (uint8_t i = 0; i < PREHEAT_COUNT; ++i) { report_echo_start(forReplay); SERIAL_ECHOLNPGM_P( PSTR(" M145 S"), i diff --git a/Marlin/src/gcode/probe/M423.cpp b/Marlin/src/gcode/probe/M423.cpp index fde5aaaf87c90..7c82a4f8af309 100644 --- a/Marlin/src/gcode/probe/M423.cpp +++ b/Marlin/src/gcode/probe/M423.cpp @@ -88,7 +88,7 @@ void GcodeSuite::M423() { void GcodeSuite::M423_report(const bool forReplay/*=true*/) { report_heading(forReplay, F("X-Twist Correction")); SERIAL_ECHOLNPGM(" M423 A", xatc.start, " I", xatc.spacing); - LOOP_L_N(x, XATC_MAX_POINTS) { + for (uint8_t x = 0; x < XATC_MAX_POINTS; ++x) { const float z = xatc.z_offset[x]; SERIAL_ECHOPGM(" M423 X", x, " Z"); serial_offset(isnan(z) ? 0 : z); diff --git a/Marlin/src/gcode/queue.cpp b/Marlin/src/gcode/queue.cpp index b64aa951129ea..156436b7dda46 100644 --- a/Marlin/src/gcode/queue.cpp +++ b/Marlin/src/gcode/queue.cpp @@ -294,7 +294,7 @@ static bool serial_data_available(serial_index_t index) { #if NO_TIMEOUTS > 0 // Multiserial already handles dispatch to/from multiple ports static bool any_serial_data_available() { - LOOP_L_N(p, NUM_SERIAL) + for (uint8_t p = 0; p < NUM_SERIAL; ++p) if (serial_data_available(p)) return true; return false; @@ -313,7 +313,7 @@ inline int read_serial(const serial_index_t index) { return SERIAL_IMPL.read(ind */ void GCodeQueue::flush_rx() { // Flush receive buffer - LOOP_L_N(p, NUM_SERIAL) { + for (uint8_t p = 0; p < NUM_SERIAL; ++p) { if (!serial_data_available(p)) continue; // No data for this port? Skip. while (SERIAL_IMPL.available(p)) (void)read_serial(p); } @@ -441,7 +441,7 @@ void GCodeQueue::get_serial_commands() { // Unless a serial port has data, this will exit on next iteration hadData = false; - LOOP_L_N(p, NUM_SERIAL) { + for (uint8_t p = 0; p < NUM_SERIAL; ++p) { // Check if the queue is full and exit if it is. if (ring_buffer.full()) return; diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index e5cbc83459d9f..f2b5016272798 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -1496,7 +1496,7 @@ #ifdef GRID_MAX_POINTS_X #define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y)) - #define GRID_LOOP(A,B) LOOP_L_N(A, GRID_MAX_POINTS_X) LOOP_L_N(B, GRID_MAX_POINTS_Y) + #define GRID_LOOP(A,B) for (uint8_t A = 0; A < GRID_MAX_POINTS_X; ++A) for (uint8_t B = 0; B < GRID_MAX_POINTS_Y; ++B) #endif // Slim menu optimizations diff --git a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp index 55e4d156ea9e6..51b3fbd3c434a 100644 --- a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp +++ b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp @@ -130,7 +130,7 @@ static void createChar_P(const char c, const byte * const ptr) { byte temp[8]; - LOOP_L_N(i, 8) + for (uint8_t i = 0; i < 8; ++i) temp[i] = pgm_read_byte(&ptr[i]); lcd.createChar(c, temp); } @@ -440,7 +440,7 @@ void MarlinUI::clear_lcd() { lcd.clear(); } else { PGM_P p = FTOP(ftxt); int dly = time / _MAX(slen, 1); - LOOP_LE_N(i, slen) { + for (uint8_t i = 0; i <= slen; ++i) { // Print the text at the correct place lcd_put_u8str_max_P(col, line, p, len); diff --git a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp index 185d3488dbc93..5b2db31fbbd2d 100644 --- a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp +++ b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp @@ -155,7 +155,7 @@ bool MarlinUI::detected() { return true; } #if DISABLED(CUSTOM_BOOTSCREEN_ANIMATED_FRAME_TIME) constexpr millis_t frame_time = CUSTOM_BOOTSCREEN_FRAME_TIME; #endif - LOOP_L_N(f, COUNT(custom_bootscreen_animation)) + for (uint8_t f = 0; f < COUNT(custom_bootscreen_animation); ++f) #endif { #if ENABLED(CUSTOM_BOOTSCREEN_ANIMATED_FRAME_TIME) @@ -228,7 +228,7 @@ bool MarlinUI::detected() { return true; } draw_bootscreen_bmp(start_bmp); #else constexpr millis_t frame_time = MARLIN_BOOTSCREEN_FRAME_TIME; - LOOP_L_N(f, COUNT(marlin_bootscreen_animation)) { + for (uint8_t f = 0; f < COUNT(marlin_bootscreen_animation); ++f) { draw_bootscreen_bmp((uint8_t*)pgm_read_ptr(&marlin_bootscreen_animation[f])); if (frame_time) safe_delay(frame_time); } diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp index 61181f9a005b1..12cee1fc80d45 100644 --- a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp @@ -672,7 +672,7 @@ void MarlinUI::draw_status_screen() { if (PAGE_UNDER(6 + 1 + 12 + 1 + 6 + 1)) { // Extruders #if DO_DRAW_HOTENDS - LOOP_L_N(e, MAX_HOTEND_DRAW) _draw_hotend_status((heater_id_t)e, blink); + for (uint8_t e = 0; e < MAX_HOTEND_DRAW; ++e) _draw_hotend_status((heater_id_t)e, blink); #endif // Laser / Spindle diff --git a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp index bc961dbf15d41..8e709416288fa 100644 --- a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp +++ b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp @@ -237,7 +237,7 @@ void ST7920_Lite_Status_Screen::clear_ddram() { /* This fills the entire graphics buffer with zeros */ void ST7920_Lite_Status_Screen::clear_gdram() { - LOOP_L_N(y, BUFFER_HEIGHT) { + for (uint8_t y = 0; y < BUFFER_HEIGHT; ++y) { set_gdram_address(0, y); begin_data(); for (uint8_t i = (BUFFER_WIDTH) / 16; i--;) write_word(0); @@ -435,7 +435,7 @@ void ST7920_Lite_Status_Screen::draw_degree_symbol(uint8_t x, uint8_t y, const b const uint8_t x_word = x >> 1, y_top = degree_symbol_y_top, y_bot = y_top + COUNT(degree_symbol); - LOOP_S_L_N(i, y_top, y_bot) { + for (uint8_t i = y_top; i < y_bot; ++i) { uint8_t byte = pgm_read_byte(p_bytes++); set_gdram_address(x_word, i + y * 16); begin_data(); @@ -754,10 +754,10 @@ bool ST7920_Lite_Status_Screen::indicators_changed() { // This drawing is a mess and only produce readable result around 25% steps // i.e. 74-76% look fine [|||||||||||||||||||||||| ], but 73% look like this: [|||||||||||||||| | ] // meaning partially filled bytes produce only single vertical line, and i bet they're not supposed to! - LOOP_S_LE_N(y, top, bottom) { + for (uint8_t y = top; y <= bottom; ++y) { set_gdram_address(left, y); begin_data(); - LOOP_L_N(x, width) { + for (uint8_t x = 0; x < width; ++x) { uint16_t gfx_word = 0x0000; if ((x + 1) * char_pcnt <= value) gfx_word = 0xFFFF; // Draw completely filled bytes diff --git a/Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp b/Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp index fde6e41792dc3..ae1531e9f8df0 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp @@ -87,11 +87,11 @@ void clear_graphics_DRAM(u8g_t *u8g, u8g_dev_t *dev) { u8g_SetAddress(u8g, dev, 0); // cmd mode u8g_WriteByte(u8g, dev, 0x08); //display off, cursor+blink off u8g_WriteByte(u8g, dev, 0x3E); //extended mode + GDRAM active - LOOP_L_N(y, (LCD_PIXEL_HEIGHT) / 2) { //clear GDRAM + for (uint8_t y = 0; y < (LCD_PIXEL_HEIGHT) / 2; ++y) { //clear GDRAM u8g_WriteByte(u8g, dev, 0x80 | y); //set y u8g_WriteByte(u8g, dev, 0x80); //set x = 0 u8g_SetAddress(u8g, dev, 1); /* data mode */ - LOOP_L_N(i, 2 * (LCD_PIXEL_WIDTH) / 8) //2x width clears both segments + for (uint8_t i = 0; i < 2 * (LCD_PIXEL_WIDTH) / 8; ++i) //2x width clears both segments u8g_WriteByte(u8g, dev, 0); u8g_SetAddress(u8g, dev, 0); /* cmd mode */ } 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 e51767f96a90b..3e173aab6cec0 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 @@ -298,10 +298,10 @@ static void setWindow(u8g_t *u8g, u8g_dev_t *dev, uint16_t Xmin, uint16_t Ymin, v = color; else v = TFT_MARLINBG_COLOR; - LOOP_L_N(n, GRAPHICAL_TFT_UPSCALE) buffer[k++] = v; + for (uint8_t n = 0; n < GRAPHICAL_TFT_UPSCALE; ++n) buffer[k++] = v; } #if HAS_LCD_IO - LOOP_S_L_N(n, 1, GRAPHICAL_TFT_UPSCALE) + for (uint8_t n = 1; n < GRAPHICAL_TFT_UPSCALE; ++n) for (uint16_t l = 0; l < UPSCALE0(length); l++) buffer[l + n * UPSCALE0(length)] = buffer[l]; @@ -412,16 +412,16 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u if (TERN0(HAS_TOUCH_BUTTONS_SLEEP, touchBt.isSleeping())) break; if (++page > (HEIGHT / PAGE_HEIGHT)) return 1; - LOOP_L_N(y, PAGE_HEIGHT) { + for (uint8_t y = 0; y < PAGE_HEIGHT; ++y) { uint32_t k = 0; TERN_(HAS_LCD_IO, buffer = (y & 1) ? bufferB : bufferA); for (uint16_t i = 0; i < (uint32_t)pb->width; i++) { const uint8_t b = *(((uint8_t *)pb->buf) + i); const uint16_t c = TEST(b, y) ? TFT_MARLINUI_COLOR : TFT_MARLINBG_COLOR; - LOOP_L_N(n, GRAPHICAL_TFT_UPSCALE) buffer[k++] = c; + for (uint8_t n = 0; n < GRAPHICAL_TFT_UPSCALE; ++n) buffer[k++] = c; } #if HAS_LCD_IO - LOOP_S_L_N(n, 1, GRAPHICAL_TFT_UPSCALE) + for (uint8_t n = 1; n < GRAPHICAL_TFT_UPSCALE; ++n) for (uint16_t l = 0; l < UPSCALE0(WIDTH); l++) buffer[l + n * UPSCALE0(WIDTH)] = buffer[l]; @@ -429,7 +429,7 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u #else uint8_t *bufptr = (uint8_t*) buffer; for (uint8_t i = GRAPHICAL_TFT_UPSCALE; i--;) { - LOOP_S_L_N(n, 0, GRAPHICAL_TFT_UPSCALE * 2) { + for (uint8_t n = 0; n < GRAPHICAL_TFT_UPSCALE * 2; ++n) { u8g_WriteSequence(u8g, dev, WIDTH, &bufptr[WIDTH * n]); } } diff --git a/Marlin/src/lcd/e3v2/common/dwin_api.cpp b/Marlin/src/lcd/e3v2/common/dwin_api.cpp index f3abaf25c96bf..319c861ea4ffe 100644 --- a/Marlin/src/lcd/e3v2/common/dwin_api.cpp +++ b/Marlin/src/lcd/e3v2/common/dwin_api.cpp @@ -38,8 +38,8 @@ uint8_t databuf[26] = { 0 }; // Send the data in the buffer plus the packet tail void DWIN_Send(size_t &i) { ++i; - LOOP_L_N(n, i) { LCD_SERIAL.write(DWIN_SendBuf[n]); delayMicroseconds(1); } - LOOP_L_N(n, 4) { LCD_SERIAL.write(DWIN_BufTail[n]); delayMicroseconds(1); } + for (uint8_t n = 0; n < i; ++n) { LCD_SERIAL.write(DWIN_SendBuf[n]); delayMicroseconds(1); } + for (uint8_t n = 0; n < 4; ++n) { LCD_SERIAL.write(DWIN_BufTail[n]); delayMicroseconds(1); } } /*-------------------------------------- System variable function --------------------------------------*/ diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index 3c259e5bf4dec..af3d1eaeb8fa8 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp @@ -1891,7 +1891,7 @@ void Redraw_SD_List() { if (card.isMounted()) { // As many files as will fit - LOOP_L_N(i, _MIN(nr_sd_menu_items(), MROWS)) + for (uint8_t i = 0; i < _MIN(nr_sd_menu_items(), MROWS); ++i) Draw_SDItem(i, i + 1); TERN_(SCROLL_LONG_FILENAMES, Init_SDItem_Shift()); @@ -2038,7 +2038,7 @@ void Draw_Info_Menu() { DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, (DWIN_WIDTH - strlen(CORP_WEBSITE) * MENU_CHR_W) / 2, 268, F(CORP_WEBSITE)); Draw_Back_First(); - LOOP_L_N(i, 3) { + for (uint8_t i = 0; i < 3; ++i) { DWIN_ICON_Show(ICON, ICON_PrintSize + i, 26, 99 + i * 73); DWIN_Draw_Line(Line_Color, 16, MBASE(2) + i * 73, 256, 156 + i * 73); } @@ -2390,7 +2390,7 @@ void Draw_Move_Menu() { if (select_axis.now != CASE_BACK) Draw_Menu_Cursor(select_axis.now); // Draw separators and icons - LOOP_L_N(i, 3 + ENABLED(HAS_HOTEND)) Draw_Menu_Line(i + 1, ICON_MoveX + i); + for (uint8_t i = 0; i < 3 + ENABLED(HAS_HOTEND); ++i) Draw_Menu_Line(i + 1, ICON_MoveX + i); } void Item_Adv_HomeOffsets(const uint8_t row) { @@ -3264,7 +3264,7 @@ void Draw_Max_Speed_Menu() { } Draw_Back_First(); - LOOP_L_N(i, 3 + ENABLED(HAS_HOTEND)) Draw_Menu_Line(i + 1, ICON_MaxSpeedX + i); + for (uint8_t i = 0; i < 3 + ENABLED(HAS_HOTEND); ++i) Draw_Menu_Line(i + 1, ICON_MaxSpeedX + i); Draw_Edit_Integer4(1, planner.settings.max_feedrate_mm_s[X_AXIS]); Draw_Edit_Integer4(2, planner.settings.max_feedrate_mm_s[Y_AXIS]); Draw_Edit_Integer4(3, planner.settings.max_feedrate_mm_s[Z_AXIS]); @@ -3318,7 +3318,7 @@ void Draw_Max_Accel_Menu() { } Draw_Back_First(); - LOOP_L_N(i, 3 + ENABLED(HAS_HOTEND)) Draw_Menu_Line(i + 1, ICON_MaxAccX + i); + for (uint8_t i = 0; i < 3 + ENABLED(HAS_HOTEND); ++i) Draw_Menu_Line(i + 1, ICON_MaxAccX + i); Draw_Edit_Integer4(1, planner.settings.max_acceleration_mm_per_s2[X_AXIS]); Draw_Edit_Integer4(2, planner.settings.max_acceleration_mm_per_s2[Y_AXIS]); Draw_Edit_Integer4(3, planner.settings.max_acceleration_mm_per_s2[Z_AXIS]); @@ -3377,7 +3377,7 @@ void Draw_Max_Accel_Menu() { } Draw_Back_First(); - LOOP_L_N(i, 3 + ENABLED(HAS_HOTEND)) Draw_Menu_Line(i + 1, ICON_MaxSpeedJerkX + i); + for (uint8_t i = 0; i < 3 + ENABLED(HAS_HOTEND); ++i) Draw_Menu_Line(i + 1, ICON_MaxSpeedJerkX + i); Draw_Edit_Float3(1, planner.max_jerk.x * MINUNITMULT); Draw_Edit_Float3(2, planner.max_jerk.y * MINUNITMULT); Draw_Edit_Float3(3, planner.max_jerk.z * MINUNITMULT); @@ -3428,7 +3428,7 @@ void Draw_Steps_Menu() { } Draw_Back_First(); - LOOP_L_N(i, 3 + ENABLED(HAS_HOTEND)) Draw_Menu_Line(i + 1, ICON_StepX + i); + for (uint8_t i = 0; i < 3 + ENABLED(HAS_HOTEND); ++i) Draw_Menu_Line(i + 1, ICON_StepX + i); Draw_Edit_Float3(1, planner.settings.axis_steps_per_mm[X_AXIS] * MINUNITMULT); Draw_Edit_Float3(2, planner.settings.axis_steps_per_mm[Y_AXIS] * MINUNITMULT); Draw_Edit_Float3(3, planner.settings.axis_steps_per_mm[Z_AXIS] * MINUNITMULT); diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 81478887cec35..b453bc20317df 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -594,7 +594,7 @@ void CrealityDWINClass::Draw_Menu(const uint8_t menu, const uint8_t select/*=0*/ active_menu = menu; Clear_Screen(); Draw_Title(Get_Menu_Title(menu)); - LOOP_L_N(i, TROWS) Menu_Item_Handler(menu, i + scrollpos); + for (uint8_t i = 0; i < TROWS; ++i) 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); } @@ -814,9 +814,9 @@ void CrealityDWINClass::Draw_SD_Item(const uint8_t item, const uint8_t row) { len = pos; if (len > max) len = max; char name[len + 1]; - LOOP_L_N(i, len) name[i] = filename[i]; + for (uint8_t i = 0; i < len; ++i) name[i] = filename[i]; if (pos > max) - LOOP_S_L_N(i, len - 3, len) name[i] = '.'; + for (uint8_t i = len - 3; i < len; ++i) name[i] = '.'; name[len] = '\0'; Draw_Menu_Item(row, card.flag.filenameIsDir ? ICON_More : ICON_File, name); } @@ -829,7 +829,7 @@ void CrealityDWINClass::Draw_SD_List(const bool removed/*=false*/) { scrollpos = 0; process = File; if (card.isMounted() && !removed) { - LOOP_L_N(i, _MIN(card.get_num_items() + 1, TROWS)) + for (uint8_t i = 0; i < _MIN(card.get_num_items() + 1, TROWS); ++i) Draw_SD_Item(i, i); } else { @@ -4664,12 +4664,12 @@ void CrealityDWINClass::Modify_Option(const uint8_t value, const char * const * 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]; + for (uint8_t i = 0; i < _MIN((size_t)LONG_FILENAME_LENGTH, strlen(text)); ++i) 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]; + for (uint8_t i = 0; i < _MIN((size_t)64, strlen(text)); ++i) statusmsg[i] = text[i]; statusmsg[_MIN((size_t)64, strlen(text))] = '\0'; } } diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 807f1915f6f3f..293e6c2d5cf1a 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -569,7 +569,7 @@ void DWIN_Print_Header(const char *text = nullptr) { static char headertxt[31] = ""; // Print header text if (text) { const int8_t size = _MIN(30U, strlen_P(text)); - LOOP_L_N(i, size) headertxt[i] = text[i]; + for (uint8_t i = 0; i < size; ++i) headertxt[i] = text[i]; headertxt[size] = '\0'; } if (checkkey == PrintProcess || checkkey == PrintDone) { @@ -938,7 +938,7 @@ void Draw_Print_File_Menu() { if (card.isMounted()) { if (SET_MENU(FileMenu, MSG_MEDIA_MENU, nr_sd_menu_items() + 1)) { BACK_ITEM(Goto_Main_Menu); - LOOP_L_N(i, nr_sd_menu_items()) { + for (uint8_t i = 0; i < nr_sd_menu_items(); ++i) { MenuItemAdd(onDrawFileName, onClickSDItem); } } @@ -1040,7 +1040,7 @@ void Draw_Info_Menu() { DWINUI::Draw_CenteredString(122, F(MACHINE_SIZE)); DWINUI::Draw_CenteredString(195, F(SHORT_BUILD_VERSION)); - LOOP_L_N(i, 3) { + for (uint8_t i = 0; i < 3; ++i) { DWINUI::Draw_Icon(ICON_PrintSize + i, ICOX, 99 + i * 73); DWIN_Draw_HLine(HMI_data.SplitLine_Color, 16, MBASE(2) + i * 73, 240); } @@ -2413,9 +2413,9 @@ void TramC () { Tram(4); } 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]; + for (uint8_t x = 0; x < 2; ++x) for (uint8_t y = 0; y < 2; ++y) avg += zval[x][y]; avg /= 4.0f; - LOOP_L_N(x, 2) LOOP_L_N(y, 2) zval[x][y] -= avg; + for (uint8_t x = 0; x < 2; ++x) for (uint8_t y = 0; y < 2; ++y) zval[x][y] -= avg; MeshViewer.DrawMesh(zval, 2, 2); ui.reset_status(); @@ -2428,7 +2428,7 @@ void TramC () { Tram(4); } float max = 0; FSTR_P plabel; bool s = true; - LOOP_L_N(x, 2) LOOP_L_N(y, 2) { + for (uint8_t x = 0; x < 2; ++x) for (uint8_t y = 0; y < 2; ++y) { const float d = ABS(zval[x][y]); if (max < d) { s = (zval[x][y] >= 0); @@ -3771,7 +3771,7 @@ void Draw_Steps_Menu() { } void UBLSmartFillMesh() { - LOOP_L_N(x, GRID_MAX_POINTS_Y) bedlevel.smart_fill_mesh(); + for (uint8_t x = 0; x < GRID_MAX_POINTS_Y; ++x) bedlevel.smart_fill_mesh(); LCD_MESSAGE(MSG_UBL_MESH_FILLED); } diff --git a/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp b/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp index 6cdafc8a935fb..ad2cd2709348a 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp @@ -126,9 +126,9 @@ void DWIN_WriteToMem(uint8_t mem, uint16_t addr, uint16_t length, uint8_t *data) 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 (uint8_t j = 0; j < i; ++j) { 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); } + for (uint8_t j = 0; j < 4; ++j) { LCD_SERIAL.write(DWIN_BufTail[j]); delayMicroseconds(1); } block++; pending -= to_send; } diff --git a/Marlin/src/lcd/e3v2/proui/meshviewer.cpp b/Marlin/src/lcd/e3v2/proui/meshviewer.cpp index c0ca216c32a91..80f1d35f40340 100644 --- a/Marlin/src/lcd/e3v2/proui/meshviewer.cpp +++ b/Marlin/src/lcd/e3v2/proui/meshviewer.cpp @@ -60,7 +60,7 @@ void MeshViewerClass::DrawMesh(bed_mesh_t zval, const uint8_t sizex, const uint8 #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; - LOOP_L_N(y, sizey) LOOP_L_N(x, sizex) { + for (uint8_t y = 0; y < sizey; ++y) for (uint8_t x = 0; x < sizex; ++x) { const float v = isnan(zval[x][y]) ? 0 : round(zval[x][y] * 100); zmesh[x][y] = v; NOLESS(maxz, v); @@ -70,11 +70,11 @@ void MeshViewerClass::DrawMesh(bed_mesh_t zval, const uint8_t sizex, const uint8 min = (float)minz / 100; 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); - LOOP_L_N(y, sizey) { + for (uint8_t x = 1; x < sizex - 1; ++x) DrawMeshVLine(x); + for (uint8_t y = 1; y < sizey - 1; ++y) DrawMeshHLine(y); + for (uint8_t y = 0; y < sizey; ++y) { hal.watchdog_refresh(); - LOOP_L_N(x, sizex) { + for (uint8_t x = 0; x < sizex; ++x) { 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); diff --git a/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp index 2ccc3a37f8f8a..518bda73f3f61 100644 --- a/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp +++ b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp @@ -672,7 +672,7 @@ namespace Anycubic { // On: 5A A5 05 82 00 82 00 00 // Off: 5A A5 05 82 00 82 00 64 uint8_t data[] = { 0x5A, 0xA5, 0x05, 0x82, 0x00, 0x82, 0x00, uint8_t(recovery.enabled ? 0x00 : 0x64) }; - LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]); + for (uint8_t i = 0; i < COUNT(data); ++i) TFTSer.write(data[i]); } void DgusTFT::powerLossRecovery() { @@ -722,30 +722,30 @@ namespace Anycubic { void DgusTFT::sendValueToTFT(const uint16_t value, const uint16_t address) { uint8_t data[] = { 0x5A, 0xA5, 0x05, 0x82, uint8_t(address >> 8), uint8_t(address & 0xFF), uint8_t(value >> 8), uint8_t(value & 0xFF) }; - LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]); + for (uint8_t i = 0; i < COUNT(data); ++i) TFTSer.write(data[i]); } void DgusTFT::requestValueFromTFT(const uint16_t address) { uint8_t data[] = { 0x5A, 0xA5, 0x04, 0x83, uint8_t(address >> 8), uint8_t(address & 0xFF), 0x01 }; - LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]); + for (uint8_t i = 0; i < COUNT(data); ++i) TFTSer.write(data[i]); } void DgusTFT::sendTxtToTFT(const char *pdata, const uint16_t address) { uint8_t data_len = strlen(pdata); uint8_t data[] = { 0x5A, 0xA5, uint8_t(data_len + 5), 0x82, uint8_t(address >> 8), uint8_t(address & 0xFF) }; - LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]); - LOOP_L_N(i, data_len) TFTSer.write(pdata[i]); + for (uint8_t i = 0; i < COUNT(data); ++i) TFTSer.write(data[i]); + for (uint8_t i = 0; i < data_len; ++i) TFTSer.write(pdata[i]); TFTSer.write(0xFF); TFTSer.write(0xFF); } void DgusTFT::sendColorToTFT(const uint16_t color, const uint16_t address) { uint8_t data[] = { 0x5A, 0xA5, 0x05, 0x82, uint8_t(address >> 8), uint8_t(address & 0xFF), uint8_t(color >> 8), uint8_t(color & 0xFF) }; - LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]); + for (uint8_t i = 0; i < COUNT(data); ++i) TFTSer.write(data[i]); } void DgusTFT::sendReadNumOfTxtToTFT(const uint8_t number, const uint16_t address) { uint8_t data[] = { 0x5A, 0xA5, 0x04, 0x83, uint8_t(address >> 8), uint8_t(address & 0xFF), number }; - LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]); + for (uint8_t i = 0; i < COUNT(data); ++i) TFTSer.write(data[i]); } void DgusTFT::changePageOfTFT(const uint16_t page_index, const bool no_send/*=false*/) { @@ -775,7 +775,7 @@ namespace Anycubic { if (!no_send) { uint8_t data[] = { 0x5A, 0xA5, 0x07, 0x82, 0x00, 0x84, 0x5A, 0x01, uint8_t(data_temp >> 8), uint8_t(data_temp & 0xFF) }; - LOOP_L_N(i, COUNT(data)) TFTSer.write(data[i]); + for (uint8_t i = 0; i < COUNT(data); ++i) TFTSer.write(data[i]); } page_index_last_2 = page_index_last; @@ -801,7 +801,7 @@ namespace Anycubic { // On: 5A A5 07 82 00 80 5A 00 00 1A // Off: 5A A5 07 82 00 80 5A 00 00 12 uint8_t data[] = { 0x5A, 0xA5, 0x07, 0x82, 0x00, 0x80, 0x5A, 0x00, 0x00, uint8_t(audio_on ? 0x1A : 0x12) }; - LOOP_L_N(i, 10) TFTSer.write(data[i]); + for (uint8_t i = 0; i < 10; ++i) TFTSer.write(data[i]); } bool DgusTFT::readTFTCommand() { diff --git a/Marlin/src/lcd/extui/dgus/DGUSScreenHandlerBase.h b/Marlin/src/lcd/extui/dgus/DGUSScreenHandlerBase.h index e2405bf2ef3ef..c6dd270edf900 100644 --- a/Marlin/src/lcd/extui/dgus/DGUSScreenHandlerBase.h +++ b/Marlin/src/lcd/extui/dgus/DGUSScreenHandlerBase.h @@ -184,7 +184,7 @@ class DGUSScreenHandler { if (!var.memadr) return; union { unsigned char tmp[sizeof(T)]; T t; } x; unsigned char *ptr = (unsigned char*)val_ptr; - LOOP_L_N(i, sizeof(T)) x.tmp[i] = ptr[sizeof(T) - i - 1]; + for (uint8_t i = 0; i < sizeof(T); ++i) x.tmp[i] = ptr[sizeof(T) - i - 1]; *(T*)var.memadr = x.t; } diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.h b/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.h index 88fed7a3b8123..7c27162ce657a 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.h @@ -124,7 +124,7 @@ class DGUSDisplay { } src, dst; src.val = value; - LOOP_L_N(i, sizeof(T)) dst.byte[i] = src.byte[sizeof(T) - i - 1]; + for (uint8_t i = 0; i < sizeof(T); ++i) dst.byte[i] = src.byte[sizeof(T) - i - 1]; return dst.val; } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/cyrillic_char_set.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/cyrillic_char_set.cpp index 1c193ade4be12..2faa1c72e688f 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/cyrillic_char_set.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/cyrillic_char_set.cpp @@ -58,11 +58,11 @@ cyrillic_fm.stride = 20; cyrillic_fm.width = 40; cyrillic_fm.height = 49; - LOOP_L_N(i, 127) + for (uint8_t i = 0; i < 127; ++i) cyrillic_fm.char_widths[i] = 0; // For cyrillic characters, copy the character widths from the widths tables - LOOP_L_N(i, NUM_ELEMENTS(cyrillic_font_widths)) { + for (uint8_t i = 0; i < NUM_ELEMENTS(cyrillic_font_widths); ++i) { cyrillic_fm.char_widths[i] = cyrillic_font_widths[i]; } CLCD::mem_write_bulk(addr, &cyrillic_fm, 148); diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/western_char_set.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/western_char_set.cpp index 4fb2f8fdbf245..02a39cd01c87a 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/western_char_set.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/western_char_set.cpp @@ -342,11 +342,11 @@ alt_fm.stride = 19; alt_fm.width = 38; alt_fm.height = 49; - LOOP_L_N(i, 127) + for (uint8_t i = 0; i < 127; ++i) alt_fm.char_widths[i] = 0; // For special characters, copy the character widths from the char tables - LOOP_L_N(i, NUM_ELEMENTS(char_recipe)) { + for (uint8_t i = 0; i < NUM_ELEMENTS(char_recipe); ++i) { uint8_t std_char, alt_char, alt_data; get_char_data(i, std_char, alt_char, alt_data); if (std_char == 0) diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/move_axis_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/move_axis_screen.cpp index c08935f3bcdac..95fe023cdaf6f 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/move_axis_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/move_axis_screen.cpp @@ -37,7 +37,7 @@ void BaseMoveAxisScreen::onEntry() { // ourselves. The relative distances are reset to zero whenever this // screen is entered. - LOOP_L_N(i, ExtUI::extruderCount) { + for (uint8_t i = 0; i < ExtUI::extruderCount; ++i) { mydata.e_rel[i] = 0; } BaseNumericAdjustmentScreen::onEntry(); diff --git a/Marlin/src/lcd/extui/malyan/malyan.cpp b/Marlin/src/lcd/extui/malyan/malyan.cpp index 1c051f4504cd6..d1c2387682ffd 100644 --- a/Marlin/src/lcd/extui/malyan/malyan.cpp +++ b/Marlin/src/lcd/extui/malyan/malyan.cpp @@ -79,7 +79,7 @@ void write_to_lcd(FSTR_P const fmsg) { char encoded_message[MAX_CURLY_COMMAND]; uint8_t message_length = _MIN(strlen_P(pmsg), sizeof(encoded_message)); - LOOP_L_N(i, message_length) + for (uint8_t i = 0; i < message_length; ++i) encoded_message[i] = pgm_read_byte(&pmsg[i]) | 0x80; LCD_SERIAL.Print::write(encoded_message, message_length); @@ -89,7 +89,7 @@ void write_to_lcd(const char * const cmsg) { char encoded_message[MAX_CURLY_COMMAND]; const uint8_t message_length = _MIN(strlen(cmsg), sizeof(encoded_message)); - LOOP_L_N(i, message_length) + for (uint8_t i = 0; i < message_length; ++i) encoded_message[i] = cmsg[i] | 0x80; LCD_SERIAL.Print::write(encoded_message, message_length); diff --git a/Marlin/src/lcd/extui/mks_ui/pic_manager.cpp b/Marlin/src/lcd/extui/mks_ui/pic_manager.cpp index 6e39c9a36e8f6..7c0ec802c306d 100644 --- a/Marlin/src/lcd/extui/mks_ui/pic_manager.cpp +++ b/Marlin/src/lcd/extui/mks_ui/pic_manager.cpp @@ -379,7 +379,7 @@ uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) { static void dosName2LongName(const char dosName[11], char *longName) { uint8_t j = 0; - LOOP_L_N(i, 11) { + for (uint8_t i = 0; i < 11; ++i) { if (i == 8) longName[j++] = '.'; if (dosName[i] == '\0' || dosName[i] == ' ') continue; longName[j++] = dosName[i]; diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index a812dff556a79..8d27ee8f7e261 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -1289,7 +1289,7 @@ void MarlinUI::init() { thermalManager.current_ADCKey_raw = HAL_ADC_RANGE; thermalManager.ADCKey_count = 0; if (currentkpADCValue < adc_other_button) - LOOP_L_N(i, ADC_KEY_NUM) { + for (uint8_t i = 0; i < ADC_KEY_NUM; ++i) { const raw_adc_t lo = pgm_read_word(&stADCKeyTable[i].ADCKeyValueMin), hi = pgm_read_word(&stADCKeyTable[i].ADCKeyValueMax); if (WITHIN(currentkpADCValue, lo, hi)) return pgm_read_byte(&stADCKeyTable[i].ADCKeyNo); @@ -1380,7 +1380,7 @@ void MarlinUI::init() { uint8_t val = 0; WRITE(SHIFT_LD_PIN, LOW); WRITE(SHIFT_LD_PIN, HIGH); - LOOP_L_N(i, 8) { + for (uint8_t i = 0; i < 8; ++i) { val >>= 1; if (READ(SHIFT_OUT_PIN)) SBI(val, 7); WRITE(SHIFT_CLK_PIN, HIGH); diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index 7819afe97869a..f811545ef66b6 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -727,7 +727,7 @@ class MarlinUI { * printer unusable in practice. */ static bool hw_button_pressed() { - LOOP_L_N(s, ENCODER_SAMPLES) { + for (uint8_t s = 0; s < ENCODER_SAMPLES; ++s) { if (!BUTTON_CLICK()) return false; safe_delay(1); } diff --git a/Marlin/src/lcd/menu/game/brickout.cpp b/Marlin/src/lcd/menu/game/brickout.cpp index fc4d19b1d98d3..078cbbcceee22 100644 --- a/Marlin/src/lcd/menu/game/brickout.cpp +++ b/Marlin/src/lcd/menu/game/brickout.cpp @@ -44,7 +44,7 @@ brickout_data_t &bdat = marlin_game_data.brickout; inline void reset_bricks(const uint16_t v) { bdat.brick_count = (BRICK_COLS) * (BRICK_ROWS); - LOOP_L_N(i, BRICK_ROWS) bdat.bricks[i] = v; + for (uint8_t i = 0; i < BRICK_ROWS; ++i) bdat.bricks[i] = v; } void reset_ball() { @@ -138,13 +138,13 @@ void BrickoutGame::game_screen() { // Draw bricks if (PAGE_CONTAINS(BRICK_TOP, BRICK_BOT)) { - LOOP_L_N(y, BRICK_ROWS) { + for (uint8_t y = 0; y < BRICK_ROWS; ++y) { const uint8_t yy = y * BRICK_H + BRICK_TOP; if (PAGE_CONTAINS(yy, yy + BRICK_H - 1)) { - LOOP_L_N(x, BRICK_COLS) { + for (uint8_t x = 0; x < BRICK_COLS; ++x) { if (TEST(bdat.bricks[y], x)) { const uint8_t xx = x * BRICK_W; - LOOP_L_N(v, BRICK_H - 1) + for (uint8_t v = 0; v < BRICK_H - 1; ++v) if (PAGE_CONTAINS(yy + v, yy + v)) u8g.drawHLine(xx, yy + v, BRICK_W - 1); } diff --git a/Marlin/src/lcd/menu/game/invaders.cpp b/Marlin/src/lcd/menu/game/invaders.cpp index 56e4c224dd14a..1cb3e5bf3fcb0 100644 --- a/Marlin/src/lcd/menu/game/invaders.cpp +++ b/Marlin/src/lcd/menu/game/invaders.cpp @@ -166,29 +166,29 @@ inline void update_invader_data() { uint8_t inv_mask = 0; // Get a list of all active invaders uint8_t sc = 0; - LOOP_L_N(y, INVADER_ROWS) { + for (uint8_t y = 0; y < INVADER_ROWS; ++y) { uint8_t m = idat.bugs[y]; if (m) idat.botmost = y + 1; inv_mask |= m; - LOOP_L_N(x, INVADER_COLS) + for (uint8_t x = 0; x < INVADER_COLS; ++x) if (TEST(m, x)) idat.shooters[sc++] = (y << 4) | x; } idat.leftmost = 0; - LOOP_L_N(i, INVADER_COLS) { if (TEST(inv_mask, i)) break; idat.leftmost -= INVADER_COL_W; } + for (uint8_t i = 0; i < INVADER_COLS; ++i) { if (TEST(inv_mask, i)) break; idat.leftmost -= INVADER_COL_W; } idat.rightmost = LCD_PIXEL_WIDTH - (INVADERS_WIDE); for (uint8_t i = INVADER_COLS; i--;) { if (TEST(inv_mask, i)) break; idat.rightmost += INVADER_COL_W; } if (idat.count == 2) idat.dir = idat.dir > 0 ? INVADER_VEL + 1 : -(INVADER_VEL + 1); } inline void reset_bullets() { - LOOP_L_N(i, COUNT(idat.bullet)) idat.bullet[i].v = 0; + for (uint8_t i = 0; i < COUNT(idat.bullet); ++i) idat.bullet[i].v = 0; } inline void reset_invaders() { idat.pos.x = 0; idat.pos.y = INVADER_TOP; idat.dir = INVADER_VEL; idat.count = (INVADER_COLS) * (INVADER_ROWS); - LOOP_L_N(i, INVADER_ROWS) idat.bugs[i] = _BV(INVADER_COLS) - 1; + for (uint8_t i = 0; i < INVADER_ROWS; ++i) idat.bugs[i] = _BV(INVADER_COLS) - 1; update_invader_data(); reset_bullets(); } @@ -274,7 +274,7 @@ void InvadersGame::game_screen() { // Find a free bullet laser_t *b = nullptr; - LOOP_L_N(i, COUNT(idat.bullet)) if (!idat.bullet[i].v) { b = &idat.bullet[i]; break; } + for (uint8_t i = 0; i < COUNT(idat.bullet); ++i) if (!idat.bullet[i].v) { b = &idat.bullet[i]; break; } if (b) { // Pick a random shooter and update the bullet //SERIAL_ECHOLNPGM("free bullet found"); @@ -322,7 +322,7 @@ void InvadersGame::game_screen() { } // laser in invader zone // Handle alien bullets - LOOP_L_N(s, COUNT(idat.bullet)) { + for (uint8_t s = 0; s < COUNT(idat.bullet); ++s) { laser_t *b = &idat.bullet[s]; if (b->v) { // Update alien bullet position @@ -371,11 +371,11 @@ void InvadersGame::game_screen() { // Draw invaders if (PAGE_CONTAINS(idat.pos.y, idat.pos.y + idat.botmost * (INVADER_ROW_H) - 2 - 1)) { int8_t yy = idat.pos.y; - LOOP_L_N(y, INVADER_ROWS) { + for (uint8_t y = 0; y < INVADER_ROWS; ++y) { const uint8_t type = inv_type[y]; if (PAGE_CONTAINS(yy, yy + INVADER_H - 1)) { int8_t xx = idat.pos.x; - LOOP_L_N(x, INVADER_COLS) { + for (uint8_t x = 0; x < INVADER_COLS; ++x) { if (TEST(idat.bugs[y], x)) u8g.drawBitmapP(xx, yy, 2, INVADER_H, invader[type][idat.game_blink]); xx += INVADER_COL_W; @@ -398,7 +398,7 @@ void InvadersGame::game_screen() { u8g.drawVLine(idat.laser.x, idat.laser.y, LASER_H); // Draw invader bullets - LOOP_L_N (i, COUNT(idat.bullet)) { + for (uint8_t i = 0; i < COUNT(idat.bullet); ++i) { if (idat.bullet[i].v && PAGE_CONTAINS(idat.bullet[i].y - (SHOT_H - 1), idat.bullet[i].y)) u8g.drawVLine(idat.bullet[i].x, idat.bullet[i].y - (SHOT_H - 1), SHOT_H); } diff --git a/Marlin/src/lcd/menu/game/maze.cpp b/Marlin/src/lcd/menu/game/maze.cpp index 85f752ee7de5c..0c77f69e1ed40 100644 --- a/Marlin/src/lcd/menu/game/maze.cpp +++ b/Marlin/src/lcd/menu/game/maze.cpp @@ -83,7 +83,7 @@ void MazeGame::game_screen() { if (PAGE_UNDER(HEADER_H)) lcd_put_int(0, HEADER_H - 1, score); // Draw the maze - // LOOP_L_N(n, head_ind) { + // for (uint8_t n = 0; n < head_ind; ++n) { // const pos_t &p = maze_walls[n], &q = maze_walls[n + 1]; // if (p.x == q.x) { // const int8_t y1 = GAMEY(_MIN(p.y, q.y)), y2 = GAMEY(_MAX(p.y, q.y)); diff --git a/Marlin/src/lcd/menu/game/snake.cpp b/Marlin/src/lcd/menu/game/snake.cpp index c88893a6e6c7b..2a78c089cfbe0 100644 --- a/Marlin/src/lcd/menu/game/snake.cpp +++ b/Marlin/src/lcd/menu/game/snake.cpp @@ -84,14 +84,14 @@ void shorten_tail() { } if (shift) { sdat.head_ind--; - LOOP_LE_N(i, sdat.head_ind) + for (uint8_t i = 0; i <= sdat.head_ind; ++i) sdat.snake_tail[i] = sdat.snake_tail[i + 1]; } } // The food is on a line inline bool food_on_line() { - LOOP_L_N(n, sdat.head_ind) { + for (uint8_t n = 0; n < sdat.head_ind; ++n) { pos_t &p = sdat.snake_tail[n], &q = sdat.snake_tail[n + 1]; if (p.x == q.x) { if ((sdat.foodx == p.x - 1 || sdat.foodx == p.x) && WITHIN(sdat.foody, _MIN(p.y, q.y), _MAX(p.y, q.y))) @@ -151,7 +151,7 @@ bool snake_overlap() { // VERTICAL head segment? if (h1.x == h2.x) { // Loop from oldest to segment two away from head - LOOP_L_N(n, sdat.head_ind - 2) { + for (uint8_t n = 0; n < sdat.head_ind - 2; ++n) { // Segment p to q const pos_t &p = sdat.snake_tail[n], &q = sdat.snake_tail[n + 1]; if (p.x != q.x) { @@ -163,7 +163,7 @@ bool snake_overlap() { } else { // Loop from oldest to segment two away from head - LOOP_L_N(n, sdat.head_ind - 2) { + for (uint8_t n = 0; n < sdat.head_ind - 2; ++n) { // Segment p to q const pos_t &p = sdat.snake_tail[n], &q = sdat.snake_tail[n + 1]; if (p.y != q.y) { @@ -240,7 +240,7 @@ void SnakeGame::game_screen() { #if SNAKE_WH < 2 // At this scale just draw a line - LOOP_L_N(n, sdat.head_ind) { + for (uint8_t n = 0; n < sdat.head_ind; ++n) { const pos_t &p = sdat.snake_tail[n], &q = sdat.snake_tail[n + 1]; if (p.x == q.x) { const int8_t y1 = GAMEY(_MIN(p.y, q.y)), y2 = GAMEY(_MAX(p.y, q.y)); @@ -256,7 +256,7 @@ void SnakeGame::game_screen() { #elif SNAKE_WH == 2 // At this scale draw two lines - LOOP_L_N(n, sdat.head_ind) { + for (uint8_t n = 0; n < sdat.head_ind; ++n) { const pos_t &p = sdat.snake_tail[n], &q = sdat.snake_tail[n + 1]; if (p.x == q.x) { const int8_t y1 = GAMEY(_MIN(p.y, q.y)), y2 = GAMEY(_MAX(p.y, q.y)); @@ -275,7 +275,7 @@ void SnakeGame::game_screen() { #else // Draw a series of boxes - LOOP_L_N(n, sdat.head_ind) { + for (uint8_t n = 0; n < sdat.head_ind; ++n) { const pos_t &p = sdat.snake_tail[n], &q = sdat.snake_tail[n + 1]; if (p.x == q.x) { const int8_t y1 = _MIN(p.y, q.y), y2 = _MAX(p.y, q.y); diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 370ea56402ffb..7ef11d0e06c46 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -460,7 +460,7 @@ void menu_backlash(); 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) + for (uint8_t n = 0; n < E_STEPPERS; ++n) EDIT_ITEM_FAST_N(float5, n, MSG_VMAX_EN, &planner.settings.max_feedrate_mm_s[E_AXIS_N(n)], 1, max_fr_edit_scaled.e); #endif @@ -532,7 +532,7 @@ 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.refresh_acceleration_rates(); }); - LOOP_L_N(n, E_STEPPERS) + for (uint8_t n = 0; n < E_STEPPERS; ++n) 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.refresh_acceleration_rates(); @@ -656,7 +656,7 @@ void menu_advanced_steps_per_mm() { EDIT_ITEM_FAST_N(float72, 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) + for (uint8_t n = 0; n < E_STEPPERS; ++n) EDIT_ITEM_FAST_N(float72, n, MSG_EN_STEPS, &planner.settings.axis_steps_per_mm[E_AXIS_N(n)], 5, 9999, []{ const uint8_t e = MenuItemBase::itemIndex; if (e == active_extruder) diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp index 0622eb98d4e48..6440cae033026 100644 --- a/Marlin/src/lcd/menu/menu_configuration.cpp +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -657,7 +657,7 @@ void menu_configuration() { // Preheat configurations #if HAS_PREHEAT && DISABLED(SLIM_LCD_MENUS) - LOOP_L_N(m, PREHEAT_COUNT) + for (uint8_t m = 0; m < PREHEAT_COUNT; ++m) SUBMENU_N_f(m, ui.get_preheat_label(m), MSG_PREHEAT_M_SETTINGS, _menu_configuration_preheat_settings); #endif diff --git a/Marlin/src/lcd/menu/menu_filament.cpp b/Marlin/src/lcd/menu/menu_filament.cpp index bdcd20fae3c62..073ffc183855b 100644 --- a/Marlin/src/lcd/menu/menu_filament.cpp +++ b/Marlin/src/lcd/menu/menu_filament.cpp @@ -96,7 +96,7 @@ void _menu_temp_filament_op(const PauseMode mode, const int8_t extruder) { 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) + for (uint8_t m = 0; m < PREHEAT_COUNT; ++m) 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, @@ -141,7 +141,7 @@ void menu_change_filament() { GCODES_ITEM_F(fmsg, F("M600 B0")); #else FSTR_P const fmsg = GET_TEXT_F(MSG_FILAMENTCHANGE_E); - LOOP_L_N(s, E_STEPPERS) { + for (uint8_t s = 0; s < E_STEPPERS; ++s) { if (thermalManager.targetTooColdToExtrude(s)) SUBMENU_N_F(s, fmsg, []{ _menu_temp_filament_op(PAUSE_MODE_CHANGE_FILAMENT, MenuItemBase::itemIndex); }); else { @@ -166,7 +166,7 @@ void menu_change_filament() { GCODES_ITEM_F(msg_load, F("M701")); #else FSTR_P const msg_load = GET_TEXT_F(MSG_FILAMENTLOAD_E); - LOOP_L_N(s, E_STEPPERS) { + for (uint8_t s = 0; s < E_STEPPERS; ++s) { if (thermalManager.targetTooColdToExtrude(s)) SUBMENU_N_F(s, msg_load, []{ _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, MenuItemBase::itemIndex); }); else { @@ -194,7 +194,7 @@ void menu_change_filament() { GCODES_ITEM(MSG_FILAMENTUNLOAD_ALL, F("M702")); #endif FSTR_P const msg_unload = GET_TEXT_F(MSG_FILAMENTUNLOAD_E); - LOOP_L_N(s, E_STEPPERS) { + for (uint8_t s = 0; s < E_STEPPERS; ++s) { if (thermalManager.targetTooColdToExtrude(s)) SUBMENU_N_F(s, msg_unload, []{ _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, MenuItemBase::itemIndex); }); else { diff --git a/Marlin/src/lcd/menu/menu_mixer.cpp b/Marlin/src/lcd/menu/menu_mixer.cpp index b3be5e6336fd4..21c18c820989f 100644 --- a/Marlin/src/lcd/menu/menu_mixer.cpp +++ b/Marlin/src/lcd/menu/menu_mixer.cpp @@ -170,7 +170,7 @@ void lcd_mixer_mix_edit() { #if CHANNEL_MIX_EDITING - LOOP_S_LE_N(n, 1, MIXING_STEPPERS) + for (uint8_t n = 1; n <= MIXING_STEPPERS; ++n) EDIT_ITEM_FAST_N(float42_52, n, MSG_MIX_COMPONENT_N, &mixer.collector[n-1], 0, 10); ACTION_ITEM(MSG_CYCLE_MIX, _lcd_mixer_cycle_mix); diff --git a/Marlin/src/lcd/menu/menu_password.cpp b/Marlin/src/lcd/menu/menu_password.cpp index 6ca4202f6c270..33d4231cd543a 100644 --- a/Marlin/src/lcd/menu/menu_password.cpp +++ b/Marlin/src/lcd/menu/menu_password.cpp @@ -85,7 +85,7 @@ void Password::authentication_done() { // A single digit was completed void Password::digit_entered() { uint32_t multiplier = CAT(1e, PASSWORD_LENGTH); // 1e5 = 100000 - LOOP_LE_N(i, digit_no) multiplier /= 10; + for (uint8_t i = 0; i <= digit_no; ++i) multiplier /= 10; value_entry += editable.uint8 * multiplier; string[digit_no++] = '0' + editable.uint8; diff --git a/Marlin/src/lcd/menu/menu_temperature.cpp b/Marlin/src/lcd/menu/menu_temperature.cpp index 82b358623fc21..710cef6468a14 100644 --- a/Marlin/src/lcd/menu/menu_temperature.cpp +++ b/Marlin/src/lcd/menu/menu_temperature.cpp @@ -179,7 +179,7 @@ void menu_temperature() { #endif #if ENABLED(SINGLENOZZLE_STANDBY_TEMP) - LOOP_S_L_N(e, 1, EXTRUDERS) + for (uint8_t e = 1; e < EXTRUDERS; ++e) EDIT_ITEM_FAST_N(int3, e, MSG_NOZZLE_STANDBY, &thermalManager.singlenozzle_temp[e], 0, thermalManager.hotend_max_target(0)); #endif @@ -266,7 +266,7 @@ void menu_temperature() { // // Preheat for all Materials // - LOOP_L_N(m, PREHEAT_COUNT) { + for (uint8_t m = 0; m < PREHEAT_COUNT; ++m) { editable.int8 = m; #if HAS_MULTI_HOTEND || HAS_HEATED_BED SUBMENU_f(ui.get_preheat_label(m), MSG_PREHEAT_M, menu_preheat_m); @@ -293,7 +293,7 @@ void menu_temperature() { START_MENU(); BACK_ITEM(MSG_MAIN_MENU); - LOOP_L_N(m, PREHEAT_COUNT) { + for (uint8_t m = 0; m < PREHEAT_COUNT; ++m) { editable.int8 = m; #if HAS_MULTI_HOTEND || HAS_HEATED_BED SUBMENU_f(ui.get_preheat_label(m), MSG_PREHEAT_M, menu_preheat_m); diff --git a/Marlin/src/lcd/menu/menu_tune.cpp b/Marlin/src/lcd/menu/menu_tune.cpp index 5247c714c6621..c36ac013b86fc 100644 --- a/Marlin/src/lcd/menu/menu_tune.cpp +++ b/Marlin/src/lcd/menu/menu_tune.cpp @@ -135,7 +135,7 @@ void menu_tune() { #endif #if ENABLED(SINGLENOZZLE_STANDBY_TEMP) - LOOP_S_L_N(e, 1, EXTRUDERS) + for (uint8_t e = 1; e < EXTRUDERS; ++e) EDIT_ITEM_FAST_N(int3, e, MSG_NOZZLE_STANDBY, &thermalManager.singlenozzle_temp[e], 0, thermalManager.hotend_max_target(0)); #endif diff --git a/Marlin/src/lcd/menu/menu_x_twist.cpp b/Marlin/src/lcd/menu/menu_x_twist.cpp index 5339e8e6e5159..56872b73ee25d 100644 --- a/Marlin/src/lcd/menu/menu_x_twist.cpp +++ b/Marlin/src/lcd/menu/menu_x_twist.cpp @@ -150,12 +150,12 @@ void xatc_wizard_goto_next_point() { else { // Compute the z-offset by averaging the values found with this wizard z_offset = 0; - LOOP_L_N(i, XATC_MAX_POINTS) z_offset += xatc.z_offset[i]; + for (uint8_t i = 0; i < XATC_MAX_POINTS; ++i) z_offset += xatc.z_offset[i]; z_offset /= XATC_MAX_POINTS; // Subtract the average from the values found with this wizard. // This way they are indipendent from the z-offset - LOOP_L_N(i, XATC_MAX_POINTS) xatc.z_offset[i] -= z_offset; + for (uint8_t i = 0; i < XATC_MAX_POINTS; ++i) xatc.z_offset[i] -= z_offset; ui.goto_screen(xatc_wizard_update_z_offset); } diff --git a/Marlin/src/libs/BL24CXX.cpp b/Marlin/src/libs/BL24CXX.cpp index 4b5a23e4c5509..adfdc1387cf2b 100644 --- a/Marlin/src/libs/BL24CXX.cpp +++ b/Marlin/src/libs/BL24CXX.cpp @@ -141,7 +141,7 @@ void IIC::nAck() { void IIC::send_byte(uint8_t txd) { SDA_OUT(); IIC_SCL_0(); // Pull down the clock to start data transmission - LOOP_L_N(t, 8) { + for (uint8_t t = 0; t < 8; ++t) { // IIC_SDA = (txd & 0x80) >> 7; if (txd & 0x80) IIC_SDA_1(); else IIC_SDA_0(); txd <<= 1; @@ -157,7 +157,7 @@ void IIC::send_byte(uint8_t txd) { uint8_t IIC::read_byte(unsigned char ack_chr) { unsigned char receive = 0; SDA_IN(); // SDA is set as input - LOOP_L_N(i, 8) { + for (uint8_t i = 0; i < 8; ++i) { IIC_SCL_0(); delay_us(2); IIC_SCL_1(); @@ -228,7 +228,7 @@ void BL24CXX::writeOneByte(uint16_t WriteAddr, uint8_t DataToWrite) { // DataToWrite: the first address of the data array // Len: The length of the data to be written 2, 4 void BL24CXX::writeLenByte(uint16_t WriteAddr, uint32_t DataToWrite, uint8_t Len) { - LOOP_L_N(t, Len) + for (uint8_t t = 0; t < Len; ++t) writeOneByte(WriteAddr + t, (DataToWrite >> (8 * t)) & 0xFF); } @@ -239,7 +239,7 @@ void BL24CXX::writeLenByte(uint16_t WriteAddr, uint32_t DataToWrite, uint8_t Len // Len: The length of the data to be read 2,4 uint32_t BL24CXX::readLenByte(uint16_t ReadAddr, uint8_t Len) { uint32_t temp = 0; - LOOP_L_N(t, Len) { + for (uint8_t t = 0; t < Len; ++t) { temp <<= 8; temp += readOneByte(ReadAddr + Len - t - 1); } diff --git a/Marlin/src/libs/nozzle.cpp b/Marlin/src/libs/nozzle.cpp index 58c097e3167e1..10ebd71efd9a9 100644 --- a/Marlin/src/libs/nozzle.cpp +++ b/Marlin/src/libs/nozzle.cpp @@ -63,7 +63,7 @@ Nozzle nozzle; #endif // Start the stroke pattern - LOOP_L_N(i, strokes >> 1) { + for (uint8_t i = 0; i < strokes >> 1; ++i) { #if ENABLED(NOZZLE_CLEAN_NO_Y) do_blocking_move_to_x(end.x); do_blocking_move_to_x(start.x); @@ -105,7 +105,7 @@ Nozzle nozzle; const bool horiz = ABS(diff.x) >= ABS(diff.y); // Do a horizontal wipe? const float P = (horiz ? diff.x : diff.y) / zigs; // Period of each zig / zag const xyz_pos_t *side; - LOOP_L_N(j, strokes) { + for (uint8_t j = 0; j < strokes; ++j) { for (int8_t i = 0; i < zigs; i++) { side = (i & 1) ? &end : &start; if (horiz) @@ -143,8 +143,8 @@ Nozzle nozzle; #endif TERN(NOZZLE_CLEAN_NO_Z, do_blocking_move_to_xy, do_blocking_move_to)(start); - LOOP_L_N(s, strokes) - LOOP_L_N(i, NOZZLE_CLEAN_CIRCLE_FN) + for (uint8_t s = 0; s < strokes; ++s) + for (uint8_t i = 0; i < NOZZLE_CLEAN_CIRCLE_FN; ++i) do_blocking_move_to_xy( middle.x + sin((RADIANS(360) / NOZZLE_CLEAN_CIRCLE_FN) * i) * radius, middle.y + cos((RADIANS(360) / NOZZLE_CLEAN_CIRCLE_FN) * i) * radius diff --git a/Marlin/src/libs/vector_3.cpp b/Marlin/src/libs/vector_3.cpp index 02945fe6871a5..a222b5cc2e7e1 100644 --- a/Marlin/src/libs/vector_3.cpp +++ b/Marlin/src/libs/vector_3.cpp @@ -93,8 +93,8 @@ void matrix_3x3::apply_rotation_xyz(float &_x, float &_y, float &_z) { // Reset to identity. No rotate or translate. void matrix_3x3::set_to_identity() { - LOOP_L_N(i, 3) - LOOP_L_N(j, 3) + for (uint8_t i = 0; i < 3; ++i) + for (uint8_t j = 0; j < 3; ++j) vectors[i][j] = float(i == j); } @@ -131,16 +131,16 @@ matrix_3x3 matrix_3x3::create_look_at(const vector_3 &target) { // Get a transposed copy of the matrix matrix_3x3 matrix_3x3::transpose(const matrix_3x3 &original) { matrix_3x3 new_matrix; - LOOP_L_N(i, 3) - LOOP_L_N(j, 3) + for (uint8_t i = 0; i < 3; ++i) + for (uint8_t j = 0; j < 3; ++j) new_matrix.vectors[i][j] = original.vectors[j][i]; return new_matrix; } void matrix_3x3::debug(FSTR_P const title) { if (title) SERIAL_ECHOLNF(title); - LOOP_L_N(i, 3) { - LOOP_L_N(j, 3) { + for (uint8_t i = 0; i < 3; ++i) { + for (uint8_t j = 0; j < 3; ++j) { serial_offset(vectors[i][j], 2); SERIAL_CHAR(' '); } diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index f73d0f1e6b42f..3031e7d694897 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -480,7 +480,7 @@ void __O2 Endstops::report_states() { #endif #if MULTI_FILAMENT_SENSOR #define _CASE_RUNOUT(N) case N: pin = FIL_RUNOUT##N##_PIN; state = FIL_RUNOUT##N##_STATE; break; - LOOP_S_LE_N(i, 1, NUM_RUNOUT_SENSORS) { + for (uint8_t i = 1; i <= NUM_RUNOUT_SENSORS; ++i) { pin_t pin; uint8_t state; switch (i) { diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 1d3bb268efa49..10b8ca86706a8 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1520,7 +1520,7 @@ void Planner::check_axes_activity() { * The multiplier converts a given E value into a length. */ void Planner::calculate_volumetric_multipliers() { - LOOP_L_N(i, COUNT(filament_size)) { + for (uint8_t i = 0; i < COUNT(filament_size); ++i) { volumetric_multiplier[i] = calculate_volumetric_multiplier(filament_size[i]); refresh_e_factor(i); } @@ -2260,7 +2260,7 @@ bool Planner::_populate_block( #if ENABLED(DISABLE_OTHER_EXTRUDERS) // Enable only the selected extruder // Count down all steppers that were recently moved - LOOP_L_N(i, E_STEPPERS) + for (uint8_t i = 0; i < E_STEPPERS; ++i) if (extruder_last_move[i]) extruder_last_move[i]--; // Switching Extruder uses one E stepper motor per two nozzles diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index e74aea56a5718..c45ff6ad1d1d4 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -650,7 +650,7 @@ class Planner { filament_size[e] = v; if (v > 0) volumetric_area_nominal = CIRCLE_AREA(v * 0.5); //TODO: should it be per extruder // make sure all extruders have some sane value for the filament size - LOOP_L_N(i, COUNT(filament_size)) + for (uint8_t i = 0; i < COUNT(filament_size); ++i) if (!filament_size[i]) filament_size[i] = DEFAULT_NOMINAL_FILAMENT_DIA; } diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index c3ea161cb413f..0bece02c15a84 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -811,7 +811,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/, const_float_t z_min_p #if EXTRA_PROBING > 0 // Insert Z measurement into probes[]. Keep it sorted ascending. - LOOP_LE_N(i, p) { // Iterate the saved Zs to insert the new Z + for (uint8_t i = 0; i <= p; ++i) { // Iterate the saved Zs to insert the new Z if (i == p || probes[i] > z) { // Last index or new Z is smaller than this Z for (int8_t m = p; --m >= i;) probes[m + 1] = probes[m]; // Shift items down after the insertion point probes[i] = z; // Insert the new Z measurement @@ -849,7 +849,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/, const_float_t z_min_p max_avg_idx--; else min_avg_idx++; // Return the average value of all remaining probes. - LOOP_S_LE_N(i, min_avg_idx, max_avg_idx) + for (uint8_t i = min_avg_idx; i <= max_avg_idx; ++i) probes_z_sum += probes[i]; #endif diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index f9dff246569e1..62b03a1b9cff1 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -874,7 +874,7 @@ void MarlinSettings::postprocess() { { #if HAS_HOTEND_OFFSET // Skip hotend 0 which must be 0 - LOOP_S_L_N(e, 1, HOTENDS) + for (uint8_t e = 1; e < HOTENDS; ++e) EEPROM_WRITE(hotend_offset[e]); #endif } @@ -1885,7 +1885,7 @@ void MarlinSettings::postprocess() { { #if HAS_HOTEND_OFFSET // Skip hotend 0 which must be 0 - LOOP_S_L_N(e, 1, HOTENDS) + for (uint8_t e = 1; e < HOTENDS; ++e) EEPROM_READ(hotend_offset[e]); #endif } @@ -3294,7 +3294,7 @@ void MarlinSettings::reset() { #if HAS_FAN constexpr uint8_t fpre[] = { REPEAT2_S(1, INCREMENT(PREHEAT_COUNT), _PITEM, FAN_SPEED) }; #endif - LOOP_L_N(i, PREHEAT_COUNT) { + for (uint8_t i = 0; i < PREHEAT_COUNT; ++i) { TERN_(HAS_HOTEND, ui.material_preset[i].hotend_temp = hpre[i]); TERN_(HAS_HEATED_BED, ui.material_preset[i].bed_temp = bpre[i]); TERN_(HAS_FAN, ui.material_preset[i].fan_speed = fpre[i]); @@ -3435,10 +3435,10 @@ void MarlinSettings::reset() { #if DISABLED(NO_VOLUMETRICS) parser.volumetric_enabled = ENABLED(VOLUMETRIC_DEFAULT_ON); - LOOP_L_N(q, COUNT(planner.filament_size)) + for (uint8_t q = 0; q < COUNT(planner.filament_size); ++q) planner.filament_size[q] = DEFAULT_NOMINAL_FILAMENT_DIA; #if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT) - LOOP_L_N(q, COUNT(planner.volumetric_extruder_limit)) + for (uint8_t q = 0; q < COUNT(planner.volumetric_extruder_limit); ++q) planner.volumetric_extruder_limit[q] = DEFAULT_VOLUMETRIC_EXTRUDER_LIMIT; #endif #endif @@ -3469,7 +3469,7 @@ void MarlinSettings::reset() { #if HAS_MOTOR_CURRENT_PWM constexpr uint32_t tmp_motor_current_setting[MOTOR_CURRENT_COUNT] = PWM_MOTOR_CURRENT; - LOOP_L_N(q, MOTOR_CURRENT_COUNT) + for (uint8_t q = 0; q < MOTOR_CURRENT_COUNT; ++q) stepper.set_digipot_current(q, (stepper.motor_current_setting[q] = tmp_motor_current_setting[q])); #endif @@ -3479,7 +3479,7 @@ void MarlinSettings::reset() { #if HAS_MOTOR_CURRENT_SPI static constexpr uint32_t tmp_motor_current_setting[] = DIGIPOT_MOTOR_CURRENT; DEBUG_ECHOLNPGM("Writing Digipot"); - LOOP_L_N(q, COUNT(tmp_motor_current_setting)) + for (uint8_t q = 0; q < COUNT(tmp_motor_current_setting); ++q) stepper.set_digipot_current(q, tmp_motor_current_setting[q]); DEBUG_ECHOLNPGM("Digipot Written"); #endif @@ -3686,8 +3686,8 @@ void MarlinSettings::reset() { #if ENABLED(MESH_BED_LEVELING) if (leveling_is_valid()) { - LOOP_L_N(py, GRID_MAX_POINTS_Y) { - LOOP_L_N(px, GRID_MAX_POINTS_X) { + for (uint8_t py = 0; py < GRID_MAX_POINTS_Y; ++py) { + for (uint8_t px = 0; px < GRID_MAX_POINTS_X; ++px) { CONFIG_ECHO_START(); SERIAL_ECHOPGM(" G29 S3 I", px, " J", py); SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, LINEAR_UNIT(bedlevel.z_values[px][py]), 5); @@ -3712,8 +3712,8 @@ void MarlinSettings::reset() { #elif ENABLED(AUTO_BED_LEVELING_BILINEAR) if (leveling_is_valid()) { - LOOP_L_N(py, GRID_MAX_POINTS_Y) { - LOOP_L_N(px, GRID_MAX_POINTS_X) { + for (uint8_t py = 0; py < GRID_MAX_POINTS_Y; ++py) { + for (uint8_t px = 0; px < GRID_MAX_POINTS_X; ++px) { CONFIG_ECHO_START(); SERIAL_ECHOPGM(" G29 W I", px, " J", py); SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, LINEAR_UNIT(bedlevel.z_values[px][py]), 5); @@ -3765,7 +3765,7 @@ void MarlinSettings::reset() { TERN_(PIDTEMPCHAMBER, gcode.M309_report(forReplay)); #if HAS_USER_THERMISTORS - LOOP_L_N(i, USER_THERMISTORS) + for (uint8_t i = 0; i < USER_THERMISTORS; ++i) thermalManager.M305_report(i, forReplay); #endif diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index eb977793efe2e..66dd114616df9 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -2842,7 +2842,7 @@ void Stepper::init() { #if MB(ALLIGATOR) const float motor_current[] = MOTOR_CURRENT; unsigned int digipot_motor = 0; - LOOP_L_N(i, 3 + EXTRUDERS) { + for (uint8_t i = 0; i < 3 + EXTRUDERS; ++i) { digipot_motor = 255 * (motor_current[i] / 2.5); dac084s085::setValue(i, digipot_motor); } @@ -3725,7 +3725,7 @@ void Stepper::report_positions() { void Stepper::refresh_motor_power() { if (!initialized) return; - LOOP_L_N(i, COUNT(motor_current_setting)) { + for (uint8_t i = 0; i < COUNT(motor_current_setting); ++i) { switch (i) { #if ANY_PIN(MOTOR_CURRENT_PWM_XY, MOTOR_CURRENT_PWM_X, MOTOR_CURRENT_PWM_Y, MOTOR_CURRENT_PWM_I, MOTOR_CURRENT_PWM_J, MOTOR_CURRENT_PWM_K, MOTOR_CURRENT_PWM_U, MOTOR_CURRENT_PWM_V, MOTOR_CURRENT_PWM_W) case 0: @@ -3821,7 +3821,7 @@ void Stepper::report_positions() { SPI.begin(); SET_OUTPUT(DIGIPOTSS_PIN); - LOOP_L_N(i, COUNT(motor_current_setting)) + for (uint8_t i = 0; i < COUNT(motor_current_setting); ++i) set_digipot_current(i, motor_current_setting[i]); #elif HAS_MOTOR_CURRENT_PWM diff --git a/Marlin/src/module/stepper/trinamic.cpp b/Marlin/src/module/stepper/trinamic.cpp index 7649c52f5ce69..1e8782753ae0e 100644 --- a/Marlin/src/module/stepper/trinamic.cpp +++ b/Marlin/src/module/stepper/trinamic.cpp @@ -501,7 +501,7 @@ enum StealthIndex : uint8_t { struct { const void *ptr[TMCAxis::TOTAL]; bool began(const TMCAxis a, const void * const p) { - LOOP_L_N(i, a) if (p == ptr[i]) return true; + for (uint8_t i = 0; i < a; ++i) if (p == ptr[i]) return true; ptr[a] = p; return false; }; } sp_helper; diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 315cf8883089e..7383f6a1c3ded 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -1400,7 +1400,7 @@ int16_t Temperature::getHeaterPower(const heater_id_t heater_id) { }while(0) uint8_t fanDone = 0; - LOOP_L_N(f, COUNT(fanBit)) { + for (uint8_t f = 0; f < COUNT(fanBit); ++f) { const uint8_t realFan = pgm_read_byte(&fanBit[f]); if (TEST(fanDone, realFan)) continue; const bool fan_on = TEST(fanState, realFan); diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index 9d1d68cf0b003..b0cb3d778ebe6 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -273,7 +273,7 @@ typedef struct { float p, i, d, c, f; } raw_pidcf_t; base::reset(); prev_e_pos = 0; lpq_ptr = 0; - LOOP_L_N(i, LPQ_ARR_SZ) lpq[i] = 0; + for (uint8_t i = 0; i < LPQ_ARR_SZ; ++i) lpq[i] = 0; } float get_extrusion_scale_output(const bool is_active, const int32_t e_position, const float e_mm_per_step, const int16_t lpq_len) { @@ -877,7 +877,7 @@ class Temperature { #if HAS_FAN static uint8_t fan_speed[FAN_COUNT]; - #define FANS_LOOP(I) LOOP_L_N(I, FAN_COUNT) + #define FANS_LOOP(I) for (uint8_t I = 0; I < FAN_COUNT; ++I) static void set_fan_speed(const uint8_t fan, const uint16_t speed); diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index d4c2fcb675d1c..21f5ce80b5322 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -250,7 +250,7 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0. #elif ENABLED(PARKING_EXTRUDER) void pe_solenoid_init() { - LOOP_LE_N(n, 1) pe_solenoid_set_pin_state(n, !PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE); + for (uint8_t n = 0; n <= 1; ++n) pe_solenoid_set_pin_state(n, !PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE); } void pe_solenoid_set_pin_state(const uint8_t extruder_num, const uint8_t state) { diff --git a/Marlin/src/pins/pinsDebug.h b/Marlin/src/pins/pinsDebug.h index a342d546c48c0..4d51de52c88e7 100644 --- a/Marlin/src/pins/pinsDebug.h +++ b/Marlin/src/pins/pinsDebug.h @@ -206,7 +206,7 @@ inline void report_pin_state_extended(const pin_t pin, const bool ignore, const return true; }; - LOOP_L_N(x, COUNT(pin_array)) { // scan entire array and report all instances of this pin + for (uint8_t x = 0; x < COUNT(pin_array); ++x) { // scan entire array and report all instances of this pin if (GET_ARRAY_PIN(x) == pin) { if (!found) { // report digital and analog pin number only on the first time through if (start_string) SERIAL_ECHOF(start_string); diff --git a/Marlin/src/sd/Sd2Card.cpp b/Marlin/src/sd/Sd2Card.cpp index 81cc03230483a..7deebd4776a26 100644 --- a/Marlin/src/sd/Sd2Card.cpp +++ b/Marlin/src/sd/Sd2Card.cpp @@ -74,7 +74,7 @@ #else static uint8_t CRC7(const uint8_t *data, uint8_t n) { uint8_t crc = 0; - LOOP_L_N(i, n) { + for (uint8_t i = 0; i < n; ++i) { uint8_t d = data[i]; d ^= crc << 1; if (d & 0x80) d ^= 9; @@ -111,7 +111,7 @@ uint8_t DiskIODriver_SPI_SD::cardCommand(const uint8_t cmd, const uint32_t arg) d[5] = CRC7(d, 5); // Send message - LOOP_L_N(k, 6) spiSend(d[k]); + for (uint8_t k = 0; k < 6; ++k) spiSend(d[k]); #else // Send command @@ -268,7 +268,7 @@ bool DiskIODriver_SPI_SD::init(const uint8_t sckRateID, const pin_t chipSelectPi spiInit(spiRate_); // Must supply min of 74 clock cycles with CS high. - LOOP_L_N(i, 10) spiSend(0xFF); + for (uint8_t i = 0; i < 10; ++i) spiSend(0xFF); hal.watchdog_refresh(); // In case init takes too long @@ -294,7 +294,7 @@ bool DiskIODriver_SPI_SD::init(const uint8_t sckRateID, const pin_t chipSelectPi } // Get the last byte of r7 response - LOOP_L_N(i, 4) status_ = spiRec(); + for (uint8_t i = 0; i < 4; ++i) status_ = spiRec(); if (status_ == 0xAA) { type(SD_CARD_TYPE_SD2); break; @@ -325,7 +325,7 @@ bool DiskIODriver_SPI_SD::init(const uint8_t sckRateID, const pin_t chipSelectPi } if ((spiRec() & 0xC0) == 0xC0) type(SD_CARD_TYPE_SDHC); // Discard rest of ocr - contains allowed voltage range - LOOP_L_N(i, 3) spiRec(); + for (uint8_t i = 0; i < 3; ++i) spiRec(); } chipDeselect(); diff --git a/Marlin/src/sd/SdBaseFile.cpp b/Marlin/src/sd/SdBaseFile.cpp index 98cbe9ba9d1cb..46312bca82fb4 100644 --- a/Marlin/src/sd/SdBaseFile.cpp +++ b/Marlin/src/sd/SdBaseFile.cpp @@ -209,7 +209,7 @@ bool SdBaseFile::dirEntry(dir_t *dir) { */ void SdBaseFile::dirName(const dir_t &dir, char *name) { uint8_t j = 0; - LOOP_L_N(i, 11) { + for (uint8_t i = 0; i < 11; ++i) { if (dir.name[i] == ' ')continue; if (i == 8) name[j++] = '.'; name[j++] = dir.name[i]; @@ -350,10 +350,10 @@ int8_t SdBaseFile::lsPrintNext(const uint8_t flags, const uint8_t indent) { && DIR_IS_FILE_OR_SUBDIR(&dir)) break; } // indent for dir level - LOOP_L_N(i, indent) SERIAL_CHAR(' '); + for (uint8_t i = 0; i < indent; ++i) SERIAL_CHAR(' '); // print name - LOOP_L_N(i, 11) { + for (uint8_t i = 0; i < 11; ++i) { if (dir.name[i] == ' ')continue; if (i == 8) { SERIAL_CHAR('.'); @@ -504,7 +504,7 @@ bool SdBaseFile::mkdir(SdBaseFile * const parent, const uint8_t dname[11] dir_t d; memcpy(&d, p, sizeof(d)); d.name[0] = '.'; - LOOP_S_L_N(i, 1, 11) d.name[i] = ' '; + for (uint8_t i = 1; i < 11; ++i) d.name[i] = ' '; // cache block for '.' and '..' uint32_t block = vol_->clusterStartBlock(firstCluster_); @@ -771,7 +771,7 @@ bool SdBaseFile::open(SdBaseFile * const dirFile, const uint8_t dname[11] if (!dirFile->seekSet(32 * index)) return false; // Dir entries write loop: [LFN] + SFN(1) - LOOP_L_N(dirWriteIdx, reqEntriesNum) { + for (uint8_t dirWriteIdx = 0; dirWriteIdx < reqEntriesNum; ++dirWriteIdx) { index = (dirFile->curPosition_ / 32) & 0xF; p = dirFile->readDirCache(); // LFN or SFN Entry? @@ -1137,7 +1137,7 @@ bool SdBaseFile::openNext(SdBaseFile *dirFile, const uint8_t oflag) { */ void SdBaseFile::getLFNName(vfat_t *pFatDir, char *lname, const uint8_t sequenceNumber) { const uint8_t startOffset = (sequenceNumber - 1) * FILENAME_LENGTH; - LOOP_L_N(i, FILENAME_LENGTH) { + for (uint8_t i = 0; i < FILENAME_LENGTH; ++i) { const uint16_t utf16_ch = (i >= 11) ? pFatDir->name3[i - 11] : (i >= 5) ? pFatDir->name2[i - 5] : pFatDir->name1[i]; #if ENABLED(UTF_FILENAME_SUPPORT) // We can't reconvert to UTF-8 here as UTF-8 is variable-size encoding, but joining LFN blocks @@ -1158,7 +1158,7 @@ bool SdBaseFile::openNext(SdBaseFile *dirFile, const uint8_t oflag) { void SdBaseFile::setLFNName(vfat_t *pFatDir, char *lname, const uint8_t sequenceNumber) { const uint8_t startOffset = (sequenceNumber - 1) * FILENAME_LENGTH, nameLength = strlen(lname); - LOOP_L_N(i, FILENAME_LENGTH) { + for (uint8_t i = 0; i < FILENAME_LENGTH; ++i) { uint16_t ch = 0; if ((startOffset + i) < nameLength) ch = lname[startOffset + i]; @@ -1479,7 +1479,7 @@ int8_t SdBaseFile::readDir(dir_t * const dir, char * const longFilename) { n = (seq - 1) * (FILENAME_LENGTH); - LOOP_L_N(i, FILENAME_LENGTH) { + for (uint8_t i = 0; i < FILENAME_LENGTH; ++i) { const uint16_t utf16_ch = (i >= 11) ? VFAT->name3[i - 11] : (i >= 5) ? VFAT->name2[i - 5] : VFAT->name1[i]; #if ENABLED(UTF_FILENAME_SUPPORT) // We can't reconvert to UTF-8 here as UTF-8 is variable-size encoding, but joining LFN blocks @@ -1627,7 +1627,7 @@ bool SdBaseFile::remove() { // Check if the entry has a LFN bool lastEntry = false; // loop back to search for any LFN entries related to this file - LOOP_S_LE_N(sequenceNumber, 1, VFAT_ENTRIES_LIMIT) { + for (uint8_t sequenceNumber = 1; sequenceNumber <= VFAT_ENTRIES_LIMIT; ++sequenceNumber) { dirIndex_ = (dirIndex_ - 1) & 0xF; if (dirBlock_ == 0) break; if (dirIndex_ == 0xF) dirBlock_--; diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index 811351ec8c1f5..40c1f09f1182f 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -190,7 +190,7 @@ CardReader::CardReader() { // char *createFilename(char * const buffer, const dir_t &p) { char *pos = buffer; - LOOP_L_N(i, 11) { + for (uint8_t i = 0; i < 11; ++i) { if (p.name[i] == ' ') continue; if (i == 8) *pos++ = '.'; *pos++ = p.name[i]; @@ -650,7 +650,7 @@ void CardReader::getAbsFilenameInCWD(char *dst) { if (cnt < MAXPATHNAMELENGTH) { *dst = '/'; dst++; cnt++; } }; - LOOP_L_N(i, workDirDepth) // Loop down to current work dir + for (uint8_t i = 0; i < workDirDepth; ++i) // Loop down to current work dir appendAtom(workDirParents[i]); if (cnt < MAXPATHNAMELENGTH - (FILENAME_LENGTH) - 1) { // Leave room for filename and nul @@ -1377,7 +1377,7 @@ void CardReader::cdroot() { #if ENABLED(SDSORT_DYNAMIC_RAM) delete [] sort_order; #if ENABLED(SDSORT_CACHE_NAMES) - LOOP_L_N(i, sort_count) { + for (uint8_t i = 0; i < sort_count; ++i) { free(sortshort[i]); // strdup free(sortnames[i]); // strdup } From ad0d700a3e783943a722fec00ee3ac24020691ba Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 3 Jun 2023 00:22:16 +0000 Subject: [PATCH 088/100] [cron] Bump distribution date (2023-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 dbb481833cada..361b1035d070b 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 "2023-06-02" +//#define STRING_DISTRIBUTION_DATE "2023-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 e1e4a9a8af38f..69937ac7fceda 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 "2023-06-02" + #define STRING_DISTRIBUTION_DATE "2023-06-03" #endif /** From a6b56d171d855429d1f0249fcc1ffe64881994f4 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sat, 3 Jun 2023 15:37:29 +1200 Subject: [PATCH 089/100] =?UTF-8?q?=F0=9F=8E=A8=20Lowercase=20followup=20(?= =?UTF-8?q?#25923)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #25914 --- Marlin/src/lcd/tft/canvas.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/lcd/tft/canvas.cpp b/Marlin/src/lcd/tft/canvas.cpp index 0894f7afb94bc..ac3a2d76c3890 100644 --- a/Marlin/src/lcd/tft/canvas.cpp +++ b/Marlin/src/lcd/tft/canvas.cpp @@ -85,10 +85,10 @@ void Canvas::addText(uint16_t x, uint16_t y, uint16_t color, uint16_t *string, u if (stringWidth + pGlyph->BBXWidth > maxWidth) break; switch (getFontType()) { case FONT_MARLIN_GLYPHS_1BPP: - addImage(x + stringWidth + pGlyph->BBXOffsetX, y + getFontAscent() - pGlyph->BBXHeight - pGlyph->BBXOffsetY, pGlyph->BBXWidth, pGlyph->BBXHeight, GREYSCALE1, ((uint8_t *)glyph) + sizeof(glyph_t), &color); + addImage(x + stringWidth + pGlyph->BBXOffsetX, y + getFontAscent() - pGlyph->BBXHeight - pGlyph->BBXOffsetY, pGlyph->BBXWidth, pGlyph->BBXHeight, GREYSCALE1, ((uint8_t *)pGlyph) + sizeof(glyph_t), &color); break; case FONT_MARLIN_GLYPHS_2BPP: - addImage(x + stringWidth + pGlyph->BBXOffsetX, y + getFontAscent() - pGlyph->BBXHeight - pGlyph->BBXOffsetY, pGlyph->BBXWidth, pGlyph->BBXHeight, GREYSCALE2, ((uint8_t *)glyph) + sizeof(glyph_t), colors); + addImage(x + stringWidth + pGlyph->BBXOffsetX, y + getFontAscent() - pGlyph->BBXHeight - pGlyph->BBXOffsetY, pGlyph->BBXWidth, pGlyph->BBXHeight, GREYSCALE2, ((uint8_t *)pGlyph) + sizeof(glyph_t), colors); break; } stringWidth += pGlyph->DWidth; From 739f1027f8e12da28d15e1de78a5b7ecc49c3b12 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sat, 3 Jun 2023 15:47:57 +1200 Subject: [PATCH 090/100] =?UTF-8?q?=F0=9F=94=A8=20STM32H723VG=20(1024KB)?= =?UTF-8?q?=20(#25921)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/pins.h | 6 +- ...M32H723Vx.json => marlin_STM32H723VE.json} | 4 +- .../PlatformIO/boards/marlin_STM32H723VG.json | 61 ++ .../PeripheralPins.c | 0 .../PinNamesVar.h | 0 .../ldscript.ld | 0 .../variant_MARLIN_STM32H723VE.cpp} | 0 .../variant_MARLIN_STM32H723VE.h} | 0 .../variants/MARLIN_H723VG/PeripheralPins.c | 590 ++++++++++++++++++ .../variants/MARLIN_H723VG/PinNamesVar.h | 108 ++++ .../variants/MARLIN_H723VG/ldscript.ld | 174 ++++++ .../variant_MARLIN_STM32H723VG.cpp | 273 ++++++++ .../variant_MARLIN_STM32H723VG.h | 269 ++++++++ ini/renamed.ini | 3 + ini/stm32h7.ini | 24 +- 15 files changed, 1501 insertions(+), 11 deletions(-) rename buildroot/share/PlatformIO/boards/{marlin_STM32H723Vx.json => marlin_STM32H723VE.json} (96%) create mode 100644 buildroot/share/PlatformIO/boards/marlin_STM32H723VG.json rename buildroot/share/PlatformIO/variants/{MARLIN_H723Vx => MARLIN_H723VE}/PeripheralPins.c (100%) rename buildroot/share/PlatformIO/variants/{MARLIN_H723Vx => MARLIN_H723VE}/PinNamesVar.h (100%) rename buildroot/share/PlatformIO/variants/{MARLIN_H723Vx => MARLIN_H723VE}/ldscript.ld (100%) rename buildroot/share/PlatformIO/variants/{MARLIN_H723Vx/variant_MARLIN_STM32H723VX.cpp => MARLIN_H723VE/variant_MARLIN_STM32H723VE.cpp} (100%) rename buildroot/share/PlatformIO/variants/{MARLIN_H723Vx/variant_MARLIN_STM32H723VX.h => MARLIN_H723VE/variant_MARLIN_STM32H723VE.h} (100%) create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_H723VG/PeripheralPins.c create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_H723VG/PinNamesVar.h create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_H723VG/ldscript.ld create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_H723VG/variant_MARLIN_STM32H723VG.cpp create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_H723VG/variant_MARLIN_STM32H723VG.h diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 77c2fc803737d..0ae0312daef34 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -810,11 +810,11 @@ #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:STM32H723Vx_btt env:STM32H743Vx_btt + #include "stm32h7/pins_BTT_SKR_V3_0.h" // STM32H743Vx/STM32H723VG env:STM32H743Vx_btt env:STM32H723VG_btt #elif MB(BTT_SKR_V3_0_EZ) - #include "stm32h7/pins_BTT_SKR_V3_0_EZ.h" // STM32H7 env:STM32H723Vx_btt env:STM32H743Vx_btt + #include "stm32h7/pins_BTT_SKR_V3_0_EZ.h" // STM32H743Vx/STM32H723VG env:STM32H743Vx_btt env:STM32H723VG_btt #elif MB(BTT_OCTOPUS_MAX_EZ_V1_0) - #include "stm32h7/pins_BTT_OCTOPUS_MAX_EZ.h" // STM32H7 env:STM32H723Vx_btt env:STM32H723Zx_btt + #include "stm32h7/pins_BTT_OCTOPUS_MAX_EZ.h" // STM32H723Zx/STM32H723VE env:STM32H723Zx_btt env:STM32H723VE_btt #elif MB(TEENSY41) #include "teensy4/pins_TEENSY41.h" // Teensy-4.x env:teensy41 #elif MB(T41U5XBB) diff --git a/buildroot/share/PlatformIO/boards/marlin_STM32H723Vx.json b/buildroot/share/PlatformIO/boards/marlin_STM32H723VE.json similarity index 96% rename from buildroot/share/PlatformIO/boards/marlin_STM32H723Vx.json rename to buildroot/share/PlatformIO/boards/marlin_STM32H723VE.json index a2154d448a9e5..3941b3d00a767 100644 --- a/buildroot/share/PlatformIO/boards/marlin_STM32H723Vx.json +++ b/buildroot/share/PlatformIO/boards/marlin_STM32H723VE.json @@ -6,7 +6,7 @@ "f_cpu": "550000000L", "mcu": "stm32h723vet6", "product_line": "STM32H723xx", - "variant": "MARLIN_H723Vx" + "variant": "MARLIN_H723VE" }, "connectivity": [ "can", @@ -56,6 +56,6 @@ "use_1200bps_touch": false, "wait_for_upload_port": false }, - "url": "https://www.st.com/en/microcontrollers-microprocessors/stm32h723ze.html", + "url": "https://www.st.com/en/microcontrollers-microprocessors/stm32h723ve.html", "vendor": "ST" } diff --git a/buildroot/share/PlatformIO/boards/marlin_STM32H723VG.json b/buildroot/share/PlatformIO/boards/marlin_STM32H723VG.json new file mode 100644 index 0000000000000..bf1fc961af0f6 --- /dev/null +++ b/buildroot/share/PlatformIO/boards/marlin_STM32H723VG.json @@ -0,0 +1,61 @@ +{ + "build": { + "core": "stm32", + "cpu": "cortex-m7", + "extra_flags": "-DSTM32H7xx -DSTM32H723xx", + "f_cpu": "550000000L", + "mcu": "stm32h723vzt6", + "product_line": "STM32H723xx", + "variant": "MARLIN_H723VG" + }, + "connectivity": [ + "can", + "ethernet" + ], + "debug": { + "jlink_device": "STM32H723VG", + "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": "STM32H723VG (564k RAM. 1024k Flash)", + "upload": { + "disable_flushing": false, + "maximum_ram_size": 577536, + "maximum_size": 1048576, + "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/stm32h723vg.html", + "vendor": "ST" +} diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723Vx/PeripheralPins.c b/buildroot/share/PlatformIO/variants/MARLIN_H723VE/PeripheralPins.c similarity index 100% rename from buildroot/share/PlatformIO/variants/MARLIN_H723Vx/PeripheralPins.c rename to buildroot/share/PlatformIO/variants/MARLIN_H723VE/PeripheralPins.c diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723Vx/PinNamesVar.h b/buildroot/share/PlatformIO/variants/MARLIN_H723VE/PinNamesVar.h similarity index 100% rename from buildroot/share/PlatformIO/variants/MARLIN_H723Vx/PinNamesVar.h rename to buildroot/share/PlatformIO/variants/MARLIN_H723VE/PinNamesVar.h diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723Vx/ldscript.ld b/buildroot/share/PlatformIO/variants/MARLIN_H723VE/ldscript.ld similarity index 100% rename from buildroot/share/PlatformIO/variants/MARLIN_H723Vx/ldscript.ld rename to buildroot/share/PlatformIO/variants/MARLIN_H723VE/ldscript.ld diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723Vx/variant_MARLIN_STM32H723VX.cpp b/buildroot/share/PlatformIO/variants/MARLIN_H723VE/variant_MARLIN_STM32H723VE.cpp similarity index 100% rename from buildroot/share/PlatformIO/variants/MARLIN_H723Vx/variant_MARLIN_STM32H723VX.cpp rename to buildroot/share/PlatformIO/variants/MARLIN_H723VE/variant_MARLIN_STM32H723VE.cpp diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723Vx/variant_MARLIN_STM32H723VX.h b/buildroot/share/PlatformIO/variants/MARLIN_H723VE/variant_MARLIN_STM32H723VE.h similarity index 100% rename from buildroot/share/PlatformIO/variants/MARLIN_H723Vx/variant_MARLIN_STM32H723VX.h rename to buildroot/share/PlatformIO/variants/MARLIN_H723VE/variant_MARLIN_STM32H723VE.h diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723VG/PeripheralPins.c b/buildroot/share/PlatformIO/variants/MARLIN_H723VG/PeripheralPins.c new file mode 100644 index 0000000000000..e484edd1ad44c --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_H723VG/PeripheralPins.c @@ -0,0 +1,590 @@ +/* + ******************************************************************************* + * Copyright (c) 2020, 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 STM32H723VEHx.xml, STM32H723VETx.xml + * STM32H723VGHx.xml, STM32H723VGTx.xml + * STM32H730VBHx.xml, STM32H730VBTx.xml + * STM32H733VGHx.xml, STM32H733VGTx.xml + * CubeMX DB release 6.0.60 + */ +#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)}, + {PC_9_ALT1, I2C5, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C5)}, + {PC_10, I2C5, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C5)}, + {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)}, + {PA_8_ALT1, I2C5, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C5)}, + {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)}, + {PC_11, I2C5, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C5)}, + {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 + {PC_12, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM15, 1, 0)}, // TIM15_CH1 + {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)}, + {PD_15, UART9, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART9)}, + {PE_1, UART8, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART8)}, + {PE_3, USART10, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_USART10)}, + {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)}, + {PD_14, UART9, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART9)}, + {PE_0, UART8, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART8)}, + {PE_2, USART10, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART10)}, + {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_13, UART9, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART9)}, + {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_0, UART9, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART9)}, + {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)}, + {PC_12, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI6)}, + {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_0, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI6)}, + {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)}, + {PD_12, FDCAN3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_FDCAN3)}, + {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)}, + {PD_13, FDCAN3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_FDCAN3)}, + {NC, NP, 0} +}; +#endif + +//*** ETHERNET *** + +#if defined(HAL_ETH_MODULE_ENABLED) || defined(HAL_ETH_LEGACY_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 + {PA_9, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TX_ER + {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_2, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TX_ER + {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 + +//*** OCTOSPI *** + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA0[] = { + {PA_2, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0 + {PB_1, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0 + {PB_12, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0 + {PC_3_C, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0 + {PC_9, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0 + {PD_11, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA1[] = { + {PB_0, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO1 + {PC_10, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO1 + {PD_12, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO1 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA2[] = { + {PA_3, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO2 + {PA_7, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO2 + {PB_13, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO2 + {PC_2_C, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO2 + {PE_2, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO2 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA3[] = { + {PA_1, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO3 + {PA_6, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO3 + {PD_13, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO3 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA4[] = { + {PC_1, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO4 + {PD_4, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO4 + {PE_7, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO4 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA5[] = { + {PC_2_C, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO5 + {PD_5, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO5 + {PE_8, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO5 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA6[] = { + {PC_3_C, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO6 + {PD_6, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO6 + {PE_9, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO6 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA7[] = { + {PD_7, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO7 + {PE_10, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO7 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_SCLK[] = { + {PA_3, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_OCTOSPIM_P1)}, // OCTOSPIM_P1_CLK + {PB_2, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_CLK + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_SSEL[] = { + {PB_6, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_NCS + {PB_10, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_NCS + {PC_11, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_NCS + {PE_11, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_OCTOSPIM_P1)}, // OCTOSPIM_P1_NCS + {NC, NP, 0} +}; +#endif + +//*** USB *** + +#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_8, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_SOF + {PA_9, USB_OTG_HS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, GPIO_AF_NONE)}, // USB_OTG_HS_VBUS + {PA_10, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ID + {PA_11, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF_NONE)}, // USB_OTG_HS_DM + {PA_12, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF_NONE)}, // USB_OTG_HS_DP +#else + {PA_3, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D0 + {PA_5, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_CK + {PB_0, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D1 + {PB_1, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D2 + {PB_5, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D7 + {PB_10, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D3 + {PB_11, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D4 + {PB_12, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D5 + {PB_13, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D6 + {PC_0, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_STP + {PC_2_C, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_DIR + {PC_3_C, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_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_SDMMC2)}, // SDMMC2_CMD + {PB_3, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_SDMMC2)}, // SDMMC2_D2 + {PB_4, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_SDMMC2)}, // SDMMC2_D3 + {PB_8, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF7_SDMMC1)}, // SDMMC1_CKIN + {PB_8_ALT1, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D4 + {PB_8_ALT2, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDMMC2)}, // SDMMC2_D4 + {PB_9, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF7_SDMMC1)}, // SDMMC1_CDIR + {PB_9_ALT1, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D5 + {PB_9_ALT2, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDMMC2)}, // SDMMC2_D5 + {PB_13, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D0 + {PB_14, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_SDMMC2)}, // SDMMC2_D0 + {PB_15, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_SDMMC2)}, // SDMMC2_D1 + {PC_1, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_SDMMC2)}, // SDMMC2_CK + {PC_4, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF10_SDMMC2)}, // SDMMC2_CKIN + {PC_6, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF8_SDMMC1)}, // SDMMC1_D0DIR + {PC_6_ALT1, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D6 + {PC_6_ALT2, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDMMC2)}, // SDMMC2_D6 + {PC_7, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF8_SDMMC1)}, // SDMMC1_D123DIR + {PC_7_ALT1, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D7 + {PC_7_ALT2, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDMMC2)}, // SDMMC2_D7 + {PC_8, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D0 + {PC_9, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D1 + {PC_10, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D2 + {PC_11, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D3 + {PC_12, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDMMC1)}, // SDMMC1_CK + {PD_2, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDMMC1)}, // SDMMC1_CMD + {PD_6, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF11_SDMMC2)}, // SDMMC2_CK + {PD_7, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF11_SDMMC2)}, // SDMMC2_CMD + {NC, NP, 0} +}; +#endif + +#endif /* !CUSTOM_PERIPHERAL_PINS */ diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723VG/PinNamesVar.h b/buildroot/share/PlatformIO/variants/MARLIN_H723VG/PinNamesVar.h new file mode 100644 index 0000000000000..3bd0ed8fcd64c --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_H723VG/PinNamesVar.h @@ -0,0 +1,108 @@ +/* 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_8_ALT1 = PA_8 | ALT1, +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, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = PA_2, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = NC, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = PC_13, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = PC_1, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif + +/* USB */ +#ifdef USBCON + USB_OTG_HS_DM = PA_11, + USB_OTG_HS_DP = PA_12, + USB_OTG_HS_ID = PA_10, + USB_OTG_HS_SOF = PA_8, + 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 = PA_9, +#endif diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723VG/ldscript.ld b/buildroot/share/PlatformIO/variants/MARLIN_H723VG/ldscript.ld new file mode 100644 index 0000000000000..63228610336b1 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_H723VG/ldscript.ld @@ -0,0 +1,174 @@ +/* +****************************************************************************** +** +** File : LinkerScript.ld +** +** Author : STM32CubeIDE +** +** Abstract : Linker script for STM32H7 series +** 512Kbytes FLASH and 560Kbytes 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) 2022 STMicroelectronics. +** All rights reserved. +** +** This software is licensed under terms that can be found in the LICENSE file +** in the root directory of this software component. +** If no LICENSE file comes with this software, it is provided AS-IS. +** +**************************************************************************** +*/ + +/* Entry Point */ +ENTRY(Reset_Handler) + +/* Highest address of the user mode stack */ +_estack = ORIGIN(RAM_D1) + LENGTH(RAM_D1); /* 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 +{ + ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K + DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K + FLASH (rx) : ORIGIN = 0x8000000 + LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET + RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 320K + RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 32K + RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 16K +} + +/* 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); + *(.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 */ + *(.RamFunc) /* .RamFunc sections */ + *(.RamFunc*) /* .RamFunc* sections */ + + . = ALIGN(4); + _edata = .; /* define a global symbol at data end */ + } >RAM_D1 AT> FLASH + + /* Uninitialized data section */ + . = 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 left */ + ._user_heap_stack : + { + . = ALIGN(8); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(8); + } >RAM_D1 + + /* Remove information from the standard libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } +} diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723VG/variant_MARLIN_STM32H723VG.cpp b/buildroot/share/PlatformIO/variants/MARLIN_H723VG/variant_MARLIN_STM32H723VG.cpp new file mode 100644 index 0000000000000..bfeb0f9abc62f --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_H723VG/variant_MARLIN_STM32H723VG.cpp @@ -0,0 +1,273 @@ +/* + ******************************************************************************* + * 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 + * + ******************************************************************************* + */ +#ifdef STM32H723xx +#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 +}; + +void MPU_Config(void) +{ + MPU_Region_InitTypeDef MPU_InitStruct = {0}; + + /* Disables the MPU */ + HAL_MPU_Disable(); + + /** Initializes and configures the Region and the memory to be protected + */ + MPU_InitStruct.Enable = MPU_REGION_ENABLE; + MPU_InitStruct.Number = MPU_REGION_NUMBER0; + MPU_InitStruct.BaseAddress = 0x0; + MPU_InitStruct.Size = MPU_REGION_SIZE_4GB; + MPU_InitStruct.SubRegionDisable = 0x87; + MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0; + MPU_InitStruct.AccessPermission = MPU_REGION_NO_ACCESS; + MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE; + MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE; + MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE; + MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE; + + HAL_MPU_ConfigRegion(&MPU_InitStruct); + /* Enables the MPU */ + HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT); + +} + +/* + * @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 = {}; + + MPU_Config(); + + /** 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_HSI48 | RCC_OSCILLATORTYPE_HSE; + RCC_OscInitStruct.HSEState = RCC_HSE_ON; + RCC_OscInitStruct.HSI48State = RCC_HSI48_ON; // 48Mhz for USB + 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 = 110; // 25Mhz / 5 * 110 = 550Mhz + RCC_OscInitStruct.PLL.PLLP = 1; // 550Mhz / 1 = 550Mhz + RCC_OscInitStruct.PLL.PLLQ = 10; // 550Mhz / 10 = 55Mhz + RCC_OscInitStruct.PLL.PLLR = 10; // 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_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; + + /* HSI48 used for USB 48 Mhz */ + /* PLL1 qclk also used for FMC, 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 HSI48 + PeriphClkInitStruct.UsbClockSelection = RCC_USBCLKSOURCE_HSI48; + // 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_H723VG/variant_MARLIN_STM32H723VG.h b/buildroot/share/PlatformIO/variants/MARLIN_H723VG/variant_MARLIN_STM32H723VG.h new file mode 100644 index 0000000000000..8b67905680a9f --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_H723VG/variant_MARLIN_STM32H723VG.h @@ -0,0 +1,269 @@ +/* + ******************************************************************************* + * Copyright (c) 2020, 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 PA8_ALT1 (PA8 | ALT1) +#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_OSPI_MODULE_DISABLED) + #define HAL_OSPI_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/renamed.ini b/ini/renamed.ini index ae1b5742b5e02..99fbde95d01ad 100644 --- a/ini/renamed.ini +++ b/ini/renamed.ini @@ -71,3 +71,6 @@ extends = renamed [env:BIGTREE_OCTOPUS_V1_F407_USB] ;=> STM32F407ZE_btt_USB extends = renamed + +[env:STM32H723Vx_btt] ;=> STM32H723VE_btt or STM32H723VG_btt +extends = renamed diff --git a/ini/stm32h7.ini b/ini/stm32h7.ini index e7617b1c965d0..5485e57e91d88 100644 --- a/ini/stm32h7.ini +++ b/ini/stm32h7.ini @@ -12,8 +12,8 @@ # H : High Performance # 7 : Cortex M7 core (0:M0, 1-2:M3, 3-4:M4, 7:M7) # 43 : Line/Features -# I : 176 pins -# I : 2048KB Flash-memory +# I : 176 pins (T:36, C:48 or 49, M:81, V:100, Z:144, I:176) +# I : 2048KB Flash-memory (C:256KB, D:384KB, E:512KB, G:1024KB) # T : LQFP package # 6 : -40...85°C (7: ...105°C) # @@ -61,14 +61,12 @@ upload_protocol = cmsis-dap debug_tool = cmsis-dap # -# BigTreeTech SKR V3.0 / SKR V3.0 EZ (STM32H723VGT6 ARM Cortex-M7) -# BigTreeTech Octopus Max EZ V1.0 (STM32H723VET6 ARM Cortex-M7) +# BigTreeTech STM32H723Vx ARM Cortex-M7 Common # -[env:STM32H723Vx_btt] +[STM32H723Vx_btt] extends = stm32_variant platform = ststm32@15.4.1 platform_packages = framework-arduinoststm32@~4.20200.220530 -board = marlin_STM32H723Vx board_build.offset = 0x20000 board_upload.offset_address = 0x08020000 build_flags = ${stm32_variant.build_flags} @@ -87,6 +85,20 @@ build_flags = ${stm32_variant.build_flags} upload_protocol = cmsis-dap debug_tool = cmsis-dap +# +# BigTreeTech Octopus Max EZ V1.0 (STM32H723VET6 ARM Cortex-M7) +# +[env:STM32H723VE_btt] +extends = STM32H723Vx_btt +board = marlin_STM32H723VE + +# +# BigTreeTech SKR V3.0 / SKR V3.0 EZ (STM32H723VGT6 ARM Cortex-M7) +# +[env:STM32H723VG_btt] +extends = STM32H723Vx_btt +board = marlin_STM32H723VG + # # BigTreeTech Octopus Pro V1.0 / Octopus Max EZ V1.0 (STM32H723ZET6 ARM Cortex-M7) # From ac954b57f764cf958000314efc20b725c2b8e054 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Fri, 2 Jun 2023 20:50:45 -0700 Subject: [PATCH 091/100] =?UTF-8?q?=F0=9F=A9=B9=20Endstop=20hit=20state=20?= =?UTF-8?q?followup=20(#25885)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #25574 --- Marlin/src/inc/Conditionals_LCD.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index f2b5016272798..b33720b2a5f30 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -833,8 +833,8 @@ #undef AVOID_OBSTACLES #undef ENDSTOPPULLUP_XMIN #undef ENDSTOPPULLUP_XMAX - #undef X_MIN_ENDSTOP_INVERTING - #undef X_MAX_ENDSTOP_INVERTING + #undef X_MIN_ENDSTOP_HIT_STATE + #undef X_MAX_ENDSTOP_HIT_STATE #undef X2_DRIVER_TYPE #undef X_ENABLE_ON #undef DISABLE_X From ba08dcfb76804a912380603b3f69831ea0d1d6eb Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 3 Jun 2023 04:40:07 -0500 Subject: [PATCH 092/100] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Fix?= =?UTF-8?q?=20narrowing=20conversions=20(#25924)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/types.h | 15 +++++++++++++++ .../src/feature/bedlevel/mbl/mesh_bed_leveling.h | 10 +++++----- Marlin/src/feature/bedlevel/ubl/ubl.h | 12 ++++++------ Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp | 8 ++++---- Marlin/src/libs/numtostr.cpp | 2 +- Marlin/src/module/motion.h | 3 --- Marlin/src/module/stepper.h | 3 +++ 7 files changed, 34 insertions(+), 19 deletions(-) diff --git a/Marlin/src/core/types.h b/Marlin/src/core/types.h index 7b5837efb8d73..57d1c5d5f7885 100644 --- a/Marlin/src/core/types.h +++ b/Marlin/src/core/types.h @@ -479,6 +479,11 @@ struct XYval { FI XYval& operator>>=(const int &p) { _RSE(x); _RSE(y); return *this; } FI XYval& operator<<=(const int &p) { _LSE(x); _LSE(y); return *this; } + // Absolute difference between two objects + FI constexpr XYval diff(const XYZEval &rs) const { return { TERN(HAS_X_AXIS, T(_ABS(x - rs.x)), x), TERN(HAS_Y_AXIS, T(_ABS(y - rs.y)), y) }; } + FI constexpr XYval diff(const XYZval &rs) const { return { TERN(HAS_X_AXIS, T(_ABS(x - rs.x)), x), TERN(HAS_Y_AXIS, T(_ABS(y - rs.y)), y) }; } + FI constexpr XYval diff(const XYval &rs) const { return { T(_ABS(x - rs.x)), T(_ABS(y - rs.y)) }; } + // Exact comparisons. For floats a "NEAR" operation may be better. FI bool operator==(const XYval &rs) const { return x == rs.x && y == rs.y; } FI bool operator==(const XYZval &rs) const { return ENABLED(HAS_X_AXIS) XY_GANG(&& x == rs.x, && y == rs.y); } @@ -607,6 +612,11 @@ struct XYZval { FI constexpr XYZval operator<<(const int &p) const { return NUM_AXIS_ARRAY(_LS(x), _LS(y), _LS(z), _LS(i), _LS(j), _LS(k), _LS(u), _LS(v), _LS(w)); } FI constexpr XYZval operator-() const { return NUM_AXIS_ARRAY(-x, -y, -z, -i, -j, -k, -u, -v, -w); } + // Absolute difference between two objects + FI constexpr XYZval diff(const XYZEval &rs) const { return NUM_AXIS_ARRAY(T(_ABS(x - rs.x)), T(_ABS(y - rs.y)), T(_ABS(z - rs.z)), T(_ABS(i - rs.i)), T(_ABS(j - rs.j)), T(_ABS(k - rs.k)), T(_ABS(u - rs.u)), T(_ABS(v - rs.v)), T(_ABS(w - rs.w)) ); } + FI constexpr XYZval diff(const XYZval &rs) const { return NUM_AXIS_ARRAY(T(_ABS(x - rs.x)), T(_ABS(y - rs.y)), T(_ABS(z - rs.z)), T(_ABS(i - rs.i)), T(_ABS(j - rs.j)), T(_ABS(k - rs.k)), T(_ABS(u - rs.u)), T(_ABS(v - rs.v)), T(_ABS(w - rs.w)) ); } + FI constexpr XYZval diff(const XYval &rs) const { return NUM_AXIS_ARRAY(T(_ABS(x - rs.x)), T(_ABS(y - rs.y)), z, i, j, k, u, v, w ); } + // Modifier operators FI XYZval& operator+=(const XYval &rs) { XY_CODE(x += rs.x, y += rs.y); return *this; } FI XYZval& operator-=(const XYval &rs) { XY_CODE(x -= rs.x, y -= rs.y); return *this; } @@ -749,6 +759,11 @@ struct XYZEval { FI constexpr XYZEval operator<<(const int &p) const { return LOGICAL_AXIS_ARRAY(_LS(e), _LS(x), _LS(y), _LS(z), _LS(i), _LS(j), _LS(k), _LS(u), _LS(v), _LS(w)); } FI constexpr XYZEval operator-() const { return LOGICAL_AXIS_ARRAY(-e, -x, -y, -z, -i, -j, -k, -u, -v, -w); } + // Absolute difference between two objects + FI constexpr XYZEval diff(const XYZEval &rs) const { return LOGICAL_AXIS_ARRAY(T(_ABS(e - rs.e)), T(_ABS(x - rs.x)), T(_ABS(y - rs.y)), T(_ABS(z - rs.z)), T(_ABS(i - rs.i)), T(_ABS(j - rs.j)), T(_ABS(k - rs.k)), T(_ABS(u - rs.u)), T(_ABS(v - rs.v)), T(_ABS(w - rs.w)) ); } + FI constexpr XYZEval diff(const XYZval &rs) const { return LOGICAL_AXIS_ARRAY(0 , T(_ABS(x - rs.x)), T(_ABS(y - rs.y)), T(_ABS(z - rs.z)), T(_ABS(i - rs.i)), T(_ABS(j - rs.j)), T(_ABS(k - rs.k)), T(_ABS(u - rs.u)), T(_ABS(v - rs.v)), T(_ABS(w - rs.w)) ); } + FI constexpr XYZEval diff(const XYval &rs) const { return LOGICAL_AXIS_ARRAY(0 , T(_ABS(x - rs.x)), T(_ABS(y - rs.y)), z, i, j, k, u, v, w ); } + // Modifier operators FI XYZEval& operator+=(const XYval &rs) { XY_CODE(x += rs.x, y += rs.y); return *this; } FI XYZEval& operator-=(const XYval &rs) { XY_CODE(x -= rs.x, y -= rs.y); return *this; } diff --git a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h index 0193b4f43e5b6..cb4f36cd59f2c 100644 --- a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h +++ b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h @@ -72,18 +72,18 @@ class mesh_bed_leveling { 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) { + static uint8_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); } - static int8_t cell_index_y(const_float_t y) { + static uint8_t cell_index_y(const_float_t y) { int8_t cy = (y - (MESH_MIN_Y)) * RECIPROCAL(MESH_Y_DIST); return constrain(cy, 0, GRID_MAX_CELLS_Y - 1); } - static xy_int8_t cell_indexes(const_float_t x, const_float_t y) { + static xy_uint8_t cell_indexes(const_float_t x, const_float_t y) { return { cell_index_x(x), cell_index_y(y) }; } - static xy_int8_t cell_indexes(const xy_pos_t &xy) { return cell_indexes(xy.x, xy.y); } + static xy_uint8_t cell_indexes(const xy_pos_t &xy) { return cell_indexes(xy.x, xy.y); } static int8_t probe_index_x(const_float_t x) { int8_t px = (x - (MESH_MIN_X) + 0.5f * (MESH_X_DIST)) * RECIPROCAL(MESH_X_DIST); @@ -107,7 +107,7 @@ class mesh_bed_leveling { 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 xy_uint8_t ind = cell_indexes(pos); const float x1 = index_to_xpos[ind.x], x2 = index_to_xpos[ind.x+1], y1 = index_to_ypos[ind.y], y2 = index_to_ypos[ind.y+1], z1 = calc_z0(pos.x, x1, z_values[ind.x][ind.y ], x2, z_values[ind.x+1][ind.y ]), diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.h b/Marlin/src/feature/bedlevel/ubl/ubl.h index 785cb5d883aa5..c9bc7974296c0 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.h +++ b/Marlin/src/feature/bedlevel/ubl/ubl.h @@ -141,26 +141,26 @@ class unified_bed_leveling { return FLOOR((y - (MESH_MIN_Y)) * RECIPROCAL(MESH_Y_DIST)); } - static int8_t cell_index_x_valid(const_float_t x) { + static bool cell_index_x_valid(const_float_t x) { return WITHIN(cell_index_x_raw(x), 0, GRID_MAX_CELLS_X - 1); } - static int8_t cell_index_y_valid(const_float_t y) { + static bool cell_index_y_valid(const_float_t y) { return WITHIN(cell_index_y_raw(y), 0, GRID_MAX_CELLS_Y - 1); } - static int8_t cell_index_x(const_float_t x) { + static uint8_t cell_index_x(const_float_t x) { return constrain(cell_index_x_raw(x), 0, GRID_MAX_CELLS_X - 1); } - static int8_t cell_index_y(const_float_t y) { + static uint8_t cell_index_y(const_float_t y) { return constrain(cell_index_y_raw(y), 0, GRID_MAX_CELLS_Y - 1); } - static xy_int8_t cell_indexes(const_float_t x, const_float_t y) { + static xy_uint8_t cell_indexes(const_float_t x, const_float_t y) { return { cell_index_x(x), cell_index_y(y) }; } - static xy_int8_t cell_indexes(const xy_pos_t &xy) { return cell_indexes(xy.x, xy.y); } + static xy_uint8_t cell_indexes(const xy_pos_t &xy) { return cell_indexes(xy.x, xy.y); } static int8_t closest_x_index(const_float_t x) { const int8_t px = (x - (MESH_MIN_X) + (MESH_X_DIST) * 0.5) * RECIPROCAL(MESH_X_DIST); diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp index 1a2b6eb23abd7..053a68b77d78a 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp @@ -61,7 +61,7 @@ const xyze_pos_t &start = current_position, &end = destination; #endif - const xy_int8_t istart = cell_indexes(start), iend = cell_indexes(end); + const xy_uint8_t istart = cell_indexes(start), iend = cell_indexes(end); // A move within the same cell needs no splitting if (istart == iend) { @@ -108,7 +108,7 @@ const xy_float_t dist = end - start; const xy_bool_t neg { dist.x < 0, dist.y < 0 }; - const xy_int8_t ineg { int8_t(neg.x), int8_t(neg.y) }; + const xy_uint8_t ineg { uint8_t(neg.x), uint8_t(neg.y) }; const xy_float_t sign { neg.x ? -1.0f : 1.0f, neg.y ? -1.0f : 1.0f }; const xy_int8_t iadd { int8_t(iend.x == istart.x ? 0 : sign.x), int8_t(iend.y == istart.y ? 0 : sign.y) }; @@ -131,7 +131,7 @@ const bool inf_normalized_flag = isinf(e_normalized_dist); #endif - xy_int8_t icell = istart; + xy_uint8_t icell = istart; const float ratio = dist.y / dist.x, // Allow divide by zero c = start.y - ratio * start.x; @@ -252,7 +252,7 @@ * Generic case of a line crossing both X and Y Mesh lines. */ - xy_int8_t cnt = (istart - iend).ABS(); + xy_uint8_t cnt = istart.diff(iend); icell += ineg; diff --git a/Marlin/src/libs/numtostr.cpp b/Marlin/src/libs/numtostr.cpp index c34faf68ff7a2..e27373263556e 100644 --- a/Marlin/src/libs/numtostr.cpp +++ b/Marlin/src/libs/numtostr.cpp @@ -31,7 +31,7 @@ template constexpr char DIGIMOD(const T1 n, const T2 f) { return DIGIT((n / f) % 10); } template -constexpr char RJDIGIT(const T1 n, const T2 f) { return (n >= f ? DIGIMOD(n, f) : ' '); } +constexpr char RJDIGIT(const T1 n, const T2 f) { return (n >= (T1)f ? DIGIMOD(n, f) : ' '); } template constexpr char MINUSOR(T &n, const char alt) { return (n >= 0) ? alt : (n = -n) ? '-' : '-'; } diff --git a/Marlin/src/module/motion.h b/Marlin/src/module/motion.h index ce05c82c772db..1e6d02d2a7c89 100644 --- a/Marlin/src/module/motion.h +++ b/Marlin/src/module/motion.h @@ -434,9 +434,6 @@ void restore_feedrate_and_scaling(); typedef bits_t(NUM_AXES) main_axes_bits_t; constexpr main_axes_bits_t main_axes_mask = _BV(NUM_AXES) - 1; -typedef bits_t(NUM_AXES + EXTRUDERS) 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 diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h index 97993193684ac..9f49e353a753a 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -83,6 +83,9 @@ typedef struct { }; } stepper_flags_t; +typedef bits_t(NUM_AXES + E_STATES) e_axis_bits_t; +constexpr e_axis_bits_t e_axis_mask = (_BV(E_STATES) - 1) << NUM_AXES; + // All the stepper enable pins constexpr pin_t ena_pins[] = { NUM_AXIS_LIST_(X_ENABLE_PIN, Y_ENABLE_PIN, Z_ENABLE_PIN, I_ENABLE_PIN, J_ENABLE_PIN, K_ENABLE_PIN, U_ENABLE_PIN, V_ENABLE_PIN, W_ENABLE_PIN) From b8655ca0ed05e077ac89ff377bff3e4db7ff5b3a Mon Sep 17 00:00:00 2001 From: Manuel McLure Date: Sat, 3 Jun 2023 13:39:41 -0700 Subject: [PATCH 093/100] =?UTF-8?q?=F0=9F=94=A7=20BTT=20SKR=203=20has=20on?= =?UTF-8?q?board=20endstop=20pullups=20(#24876)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h | 1 + 1 file changed, 1 insertion(+) 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 index 85fd24da0fc61..d6a7358f3e580 100644 --- a/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h +++ b/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h @@ -119,6 +119,7 @@ #define Z_STOP_PIN PC0 // Z-STOP #endif #endif +#define ONBOARD_ENDSTOPPULLUPS // Board has built-in pullups // // Z Probe (when not Z_MIN_PIN) From 6136e48df5c8e2aee3447b99beb8464231895b69 Mon Sep 17 00:00:00 2001 From: Giuliano Zaro <3684609+GMagician@users.noreply.github.com> Date: Sat, 3 Jun 2023 23:09:29 +0200 Subject: [PATCH 094/100] =?UTF-8?q?=F0=9F=90=9B=20Fix=20M25/M125=20for=20L?= =?UTF-8?q?CDs=20with=20ui.resume=5Fprint=20(#24877)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/pause.cpp | 2 -- Marlin/src/gcode/feature/pause/M125.cpp | 2 +- Marlin/src/lcd/language/language_it.h | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index 6e57f6e2dc847..66f7ad15edfdc 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -402,8 +402,6 @@ bool pause_print(const_float_t retract, const xyz_pos_t &park_point, const bool DEBUG_SECTION(pp, "pause_print", true); DEBUG_ECHOLNPGM("... park.x:", park_point.x, " y:", park_point.y, " z:", park_point.z, " unloadlen:", unload_length, " showlcd:", show_lcd DXC_SAY); - UNUSED(show_lcd); - if (did_pause_print) return false; // already paused #if ENABLED(HOST_ACTION_COMMANDS) diff --git a/Marlin/src/gcode/feature/pause/M125.cpp b/Marlin/src/gcode/feature/pause/M125.cpp index 079ae6c1ba5fd..0e0d6ed143d2f 100644 --- a/Marlin/src/gcode/feature/pause/M125.cpp +++ b/Marlin/src/gcode/feature/pause/M125.cpp @@ -96,7 +96,7 @@ void GcodeSuite::M125() { const bool show_lcd = TERN0(HAS_MARLINUI_MENU, parser.boolval('P')); if (pause_print(retract, park_point, show_lcd, 0)) { - if (ENABLED(EXTENSIBLE_UI) || ALL(EMERGENCY_PARSER, HOST_PROMPT_SUPPORT) || !sd_printing || show_lcd) { + if (HAS_DISPLAY || ALL(EMERGENCY_PARSER, HOST_PROMPT_SUPPORT) || !sd_printing || show_lcd) { wait_for_confirmation(false, 0); resume_print(0, 0, -retract, 0); } diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index e4f95bf72ce1e..d9a9340762df1 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -776,7 +776,7 @@ namespace Language_it { // #if LCD_HEIGHT >= 4 LSTR MSG_ADVANCED_PAUSE_WAITING = _UxGT(MSG_3_LINE("Premi per", "riprendere", "la stampa")); - LSTR MSG_PAUSE_PRINT_PARKING = _UxGT(MSG_1_LINE("Parcheggiando...")); + LSTR MSG_PAUSE_PRINT_PARKING = _UxGT(MSG_1_LINE("Sto parcheggiando...")); LSTR MSG_FILAMENT_CHANGE_INIT = _UxGT(MSG_3_LINE("Attendere avvio", "del cambio", "di filamento")); LSTR MSG_FILAMENT_CHANGE_INSERT = _UxGT(MSG_3_LINE("Inserisci il", "filamento e premi", "per continuare")); LSTR MSG_FILAMENT_CHANGE_HEAT = _UxGT(MSG_2_LINE("Premi per", "riscaldare ugello")); From f8c51523694e5ccc6473bc9791f3fa0135ad395f Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sun, 4 Jun 2023 00:27:30 +0000 Subject: [PATCH 095/100] [cron] Bump distribution date (2023-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 361b1035d070b..921e496acb4ac 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 "2023-06-03" +//#define STRING_DISTRIBUTION_DATE "2023-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 69937ac7fceda..578ed8a20a219 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 "2023-06-03" + #define STRING_DISTRIBUTION_DATE "2023-06-04" #endif /** From 1a2816284c0e92f39840e8688d617faa1e32cd2f Mon Sep 17 00:00:00 2001 From: Andrew <18502096+classicrocker883@users.noreply.github.com> Date: Sun, 4 Jun 2023 05:20:07 -0400 Subject: [PATCH 096/100] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20Fix=20LCD=20contra?= =?UTF-8?q?st=20typo=20(#25929)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/parser.cpp | 2 +- Marlin/src/inc/Conditionals_post.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Marlin/src/gcode/parser.cpp b/Marlin/src/gcode/parser.cpp index 90586e371f501..ccd6b4111f106 100644 --- a/Marlin/src/gcode/parser.cpp +++ b/Marlin/src/gcode/parser.cpp @@ -229,7 +229,7 @@ void GCodeParser::parse(char *p) { } #endif - } break; + } break; #if ENABLED(GCODE_MOTION_MODES) diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 588484ff3e3bd..6d2bbd6edf229 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -474,7 +474,6 @@ #define _LCD_CONTRAST_INIT 195 #elif ENABLED(FYSETC_MINI_12864_2_1) #define _LCD_CONTRAST_MIN 230 - #define _LCD_CONTRAST_MIN 255 #define _LCD_CONTRAST_INIT 255 #elif ENABLED(FYSETC_MINI_12864) #define _LCD_CONTRAST_MIN 180 From f8423f9da09a8d67074b4243917953a6b2b8d279 Mon Sep 17 00:00:00 2001 From: kisslorand <50251547+kisslorand@users.noreply.github.com> Date: Sun, 4 Jun 2023 12:49:27 +0300 Subject: [PATCH 097/100] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20D576=20buffer=20un?= =?UTF-8?q?derrun=20reporting=20(#25931)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/queue.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/gcode/queue.cpp b/Marlin/src/gcode/queue.cpp index 156436b7dda46..967ab76897f7f 100644 --- a/Marlin/src/gcode/queue.cpp +++ b/Marlin/src/gcode/queue.cpp @@ -713,8 +713,8 @@ void GCodeQueue::advance() { void GCodeQueue::report_buffer_statistics() { SERIAL_ECHOLNPGM("D576" - " P:", planner.moves_free(), " ", -planner_buffer_underruns, " (", max_planner_buffer_empty_duration, ")" - " B:", BUFSIZE - ring_buffer.length, " ", -command_buffer_underruns, " (", max_command_buffer_empty_duration, ")" + " P:", planner.moves_free(), " ", planner_buffer_underruns, " (", max_planner_buffer_empty_duration, ")" + " B:", BUFSIZE - ring_buffer.length, " ", command_buffer_underruns, " (", max_command_buffer_empty_duration, ")" ); command_buffer_underruns = planner_buffer_underruns = 0; max_command_buffer_empty_duration = max_planner_buffer_empty_duration = 0; From 6e8035e5aa59454600cd359665a34954dac80a70 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Mon, 5 Jun 2023 00:24:02 +0000 Subject: [PATCH 098/100] [cron] Bump distribution date (2023-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 921e496acb4ac..4b3e3b2c8c835 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 "2023-06-04" +//#define STRING_DISTRIBUTION_DATE "2023-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 578ed8a20a219..66ee44531cc3e 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 "2023-06-04" + #define STRING_DISTRIBUTION_DATE "2023-06-05" #endif /** From 3b681f7b7450582e0fca2425aabf47b37624cbda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roi=20Rodr=C3=ADguez=20Huertas?= Date: Mon, 5 Jun 2023 07:13:57 +0200 Subject: [PATCH 099/100] =?UTF-8?q?=F0=9F=94=A7=20TMC=20Driver=20axis=20ba?= =?UTF-8?q?ud=20for=20Soft=20Serial=20(#25664)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/stepper/trinamic.cpp | 44 +++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/Marlin/src/module/stepper/trinamic.cpp b/Marlin/src/module/stepper/trinamic.cpp index 1e8782753ae0e..ce99d87f09961 100644 --- a/Marlin/src/module/stepper/trinamic.cpp +++ b/Marlin/src/module/stepper/trinamic.cpp @@ -514,154 +514,154 @@ enum StealthIndex : uint8_t { #ifdef X_HARDWARE_SERIAL HW_SERIAL_BEGIN(X); #else - stepperX.beginSerial(TMC_BAUD_RATE); + stepperX.beginSerial(TMC_X_BAUD_RATE); #endif #endif #if AXIS_HAS_UART(X2) #ifdef X2_HARDWARE_SERIAL HW_SERIAL_BEGIN(X2); #else - stepperX2.beginSerial(TMC_BAUD_RATE); + stepperX2.beginSerial(TMC_X2_BAUD_RATE); #endif #endif #if AXIS_HAS_UART(Y) #ifdef Y_HARDWARE_SERIAL HW_SERIAL_BEGIN(Y); #else - stepperY.beginSerial(TMC_BAUD_RATE); + stepperY.beginSerial(TMC_Y_BAUD_RATE); #endif #endif #if AXIS_HAS_UART(Y2) #ifdef Y2_HARDWARE_SERIAL HW_SERIAL_BEGIN(Y2); #else - stepperY2.beginSerial(TMC_BAUD_RATE); + stepperY2.beginSerial(TMC_Y2_BAUD_RATE); #endif #endif #if AXIS_HAS_UART(Z) #ifdef Z_HARDWARE_SERIAL HW_SERIAL_BEGIN(Z); #else - stepperZ.beginSerial(TMC_BAUD_RATE); + stepperZ.beginSerial(TMC_Z_BAUD_RATE); #endif #endif #if AXIS_HAS_UART(Z2) #ifdef Z2_HARDWARE_SERIAL HW_SERIAL_BEGIN(Z2); #else - stepperZ2.beginSerial(TMC_BAUD_RATE); + stepperZ2.beginSerial(TMC_Z2_BAUD_RATE); #endif #endif #if AXIS_HAS_UART(Z3) #ifdef Z3_HARDWARE_SERIAL HW_SERIAL_BEGIN(Z3); #else - stepperZ3.beginSerial(TMC_BAUD_RATE); + stepperZ3.beginSerial(TMC_Z3_BAUD_RATE); #endif #endif #if AXIS_HAS_UART(Z4) #ifdef Z4_HARDWARE_SERIAL HW_SERIAL_BEGIN(Z4); #else - stepperZ4.beginSerial(TMC_BAUD_RATE); + stepperZ4.beginSerial(TMC_Z4_BAUD_RATE); #endif #endif #if AXIS_HAS_UART(I) #ifdef I_HARDWARE_SERIAL HW_SERIAL_BEGIN(I); #else - stepperI.beginSerial(TMC_BAUD_RATE); + stepperI.beginSerial(TMC_I_BAUD_RATE); #endif #endif #if AXIS_HAS_UART(J) #ifdef J_HARDWARE_SERIAL HW_SERIAL_BEGIN(J); #else - stepperJ.beginSerial(TMC_BAUD_RATE); + stepperJ.beginSerial(TMC_J_BAUD_RATE); #endif #endif #if AXIS_HAS_UART(K) #ifdef K_HARDWARE_SERIAL HW_SERIAL_BEGIN(K); #else - stepperK.beginSerial(TMC_BAUD_RATE); + stepperK.beginSerial(TMC_K_BAUD_RATE); #endif #endif #if AXIS_HAS_UART(U) #ifdef U_HARDWARE_SERIAL HW_SERIAL_BEGIN(U); #else - stepperU.beginSerial(TMC_BAUD_RATE); + stepperU.beginSerial(TMC_U_BAUD_RATE); #endif #endif #if AXIS_HAS_UART(V) #ifdef V_HARDWARE_SERIAL HW_SERIAL_BEGIN(V); #else - stepperV.beginSerial(TMC_BAUD_RATE); + stepperV.beginSerial(TMC_V_BAUD_RATE); #endif #endif #if AXIS_HAS_UART(W) #ifdef W_HARDWARE_SERIAL HW_SERIAL_BEGIN(W); #else - stepperW.beginSerial(TMC_BAUD_RATE); + stepperW.beginSerial(TMC_W_BAUD_RATE); #endif #endif #if AXIS_HAS_UART(E0) #ifdef E0_HARDWARE_SERIAL HW_SERIAL_BEGIN(E0); #else - stepperE0.beginSerial(TMC_BAUD_RATE); + stepperE0.beginSerial(TMC_E0_BAUD_RATE); #endif #endif #if AXIS_HAS_UART(E1) #ifdef E1_HARDWARE_SERIAL HW_SERIAL_BEGIN(E1); #else - stepperE1.beginSerial(TMC_BAUD_RATE); + stepperE1.beginSerial(TMC_E1_BAUD_RATE); #endif #endif #if AXIS_HAS_UART(E2) #ifdef E2_HARDWARE_SERIAL HW_SERIAL_BEGIN(E2); #else - stepperE2.beginSerial(TMC_BAUD_RATE); + stepperE2.beginSerial(TMC_E2_BAUD_RATE); #endif #endif #if AXIS_HAS_UART(E3) #ifdef E3_HARDWARE_SERIAL HW_SERIAL_BEGIN(E3); #else - stepperE3.beginSerial(TMC_BAUD_RATE); + stepperE3.beginSerial(TMC_E3_BAUD_RATE); #endif #endif #if AXIS_HAS_UART(E4) #ifdef E4_HARDWARE_SERIAL HW_SERIAL_BEGIN(E4); #else - stepperE4.beginSerial(TMC_BAUD_RATE); + stepperE4.beginSerial(TMC_E4_BAUD_RATE); #endif #endif #if AXIS_HAS_UART(E5) #ifdef E5_HARDWARE_SERIAL HW_SERIAL_BEGIN(E5); #else - stepperE5.beginSerial(TMC_BAUD_RATE); + stepperE5.beginSerial(TMC_E5_BAUD_RATE); #endif #endif #if AXIS_HAS_UART(E6) #ifdef E6_HARDWARE_SERIAL HW_SERIAL_BEGIN(E6); #else - stepperE6.beginSerial(TMC_BAUD_RATE); + stepperE6.beginSerial(TMC_E6_BAUD_RATE); #endif #endif #if AXIS_HAS_UART(E7) #ifdef E7_HARDWARE_SERIAL HW_SERIAL_BEGIN(E7); #else - stepperE7.beginSerial(TMC_BAUD_RATE); + stepperE7.beginSerial(TMC_E7_BAUD_RATE); #endif #endif } From 64595d3ee0105b5995517967a99197ed7afd5f55 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 5 Jun 2023 00:43:31 -0500 Subject: [PATCH 100/100] =?UTF-8?q?=F0=9F=8E=A8=20Detab=20C/C++?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/DUE/usb/genclk.h | 296 ++++++------- Marlin/src/HAL/DUE/usb/osc.h | 211 +++++---- Marlin/src/HAL/DUE/usb/pll.h | 254 +++++------ Marlin/src/HAL/DUE/usb/sbc_protocol.h | 111 +++-- Marlin/src/HAL/DUE/usb/spc_protocol.h | 357 ++++++++------- Marlin/src/HAL/DUE/usb/sysclk.h | 30 +- Marlin/src/HAL/DUE/usb/udc.h | 411 +++++++++--------- Marlin/src/HAL/DUE/usb/udc_desc.h | 57 ++- Marlin/src/HAL/DUE/usb/udd.h | 58 +-- Marlin/src/HAL/DUE/usb/udi.h | 94 ++-- Marlin/src/HAL/DUE/usb/udi_cdc.h | 304 +++++++------ Marlin/src/HAL/DUE/usb/udi_msc.h | 227 +++++----- Marlin/src/HAL/DUE/usb/uotghs_otg.h | 27 +- Marlin/src/HAL/DUE/usb/usb_protocol.h | 266 ++++++------ Marlin/src/HAL/DUE/usb/usb_protocol_cdc.h | 132 +++--- Marlin/src/HAL/DUE/usb/usb_protocol_msc.h | 64 +-- .../marlin_maple_CHITU_F103/board/board.h | 12 +- .../marlin_maple_MEEB_3DP/board/board.h | 12 +- 18 files changed, 1424 insertions(+), 1499 deletions(-) diff --git a/Marlin/src/HAL/DUE/usb/genclk.h b/Marlin/src/HAL/DUE/usb/genclk.h index cde03bc0d1078..45eba5873f8c8 100644 --- a/Marlin/src/HAL/DUE/usb/genclk.h +++ b/Marlin/src/HAL/DUE/usb/genclk.h @@ -74,17 +74,17 @@ extern "C" { //@{ enum genclk_source { - GENCLK_PCK_SRC_SLCK_RC = 0, //!< Internal 32kHz RC oscillator as PCK source clock - GENCLK_PCK_SRC_SLCK_XTAL = 1, //!< External 32kHz crystal oscillator as PCK source clock - GENCLK_PCK_SRC_SLCK_BYPASS = 2, //!< External 32kHz bypass oscillator as PCK source clock - GENCLK_PCK_SRC_MAINCK_4M_RC = 3, //!< Internal 4MHz RC oscillator as PCK source clock - GENCLK_PCK_SRC_MAINCK_8M_RC = 4, //!< Internal 8MHz RC oscillator as PCK source clock - GENCLK_PCK_SRC_MAINCK_12M_RC = 5, //!< Internal 12MHz RC oscillator as PCK source clock - GENCLK_PCK_SRC_MAINCK_XTAL = 6, //!< External crystal oscillator as PCK source clock - GENCLK_PCK_SRC_MAINCK_BYPASS = 7, //!< External bypass oscillator as PCK source clock - GENCLK_PCK_SRC_PLLACK = 8, //!< Use PLLACK as PCK source clock - GENCLK_PCK_SRC_PLLBCK = 9, //!< Use PLLBCK as PCK source clock - GENCLK_PCK_SRC_MCK = 10, //!< Use Master Clk as PCK source clock + GENCLK_PCK_SRC_SLCK_RC = 0, //!< Internal 32kHz RC oscillator as PCK source clock + GENCLK_PCK_SRC_SLCK_XTAL = 1, //!< External 32kHz crystal oscillator as PCK source clock + GENCLK_PCK_SRC_SLCK_BYPASS = 2, //!< External 32kHz bypass oscillator as PCK source clock + GENCLK_PCK_SRC_MAINCK_4M_RC = 3, //!< Internal 4MHz RC oscillator as PCK source clock + GENCLK_PCK_SRC_MAINCK_8M_RC = 4, //!< Internal 8MHz RC oscillator as PCK source clock + GENCLK_PCK_SRC_MAINCK_12M_RC = 5, //!< Internal 12MHz RC oscillator as PCK source clock + GENCLK_PCK_SRC_MAINCK_XTAL = 6, //!< External crystal oscillator as PCK source clock + GENCLK_PCK_SRC_MAINCK_BYPASS = 7, //!< External bypass oscillator as PCK source clock + GENCLK_PCK_SRC_PLLACK = 8, //!< Use PLLACK as PCK source clock + GENCLK_PCK_SRC_PLLBCK = 9, //!< Use PLLBCK as PCK source clock + GENCLK_PCK_SRC_MCK = 10, //!< Use Master Clk as PCK source clock }; //@} @@ -93,176 +93,162 @@ enum genclk_source { //@{ enum genclk_divider { - GENCLK_PCK_PRES_1 = PMC_PCK_PRES_CLK_1, //!< Set PCK clock prescaler to 1 - GENCLK_PCK_PRES_2 = PMC_PCK_PRES_CLK_2, //!< Set PCK clock prescaler to 2 - GENCLK_PCK_PRES_4 = PMC_PCK_PRES_CLK_4, //!< Set PCK clock prescaler to 4 - GENCLK_PCK_PRES_8 = PMC_PCK_PRES_CLK_8, //!< Set PCK clock prescaler to 8 - GENCLK_PCK_PRES_16 = PMC_PCK_PRES_CLK_16, //!< Set PCK clock prescaler to 16 - GENCLK_PCK_PRES_32 = PMC_PCK_PRES_CLK_32, //!< Set PCK clock prescaler to 32 - GENCLK_PCK_PRES_64 = PMC_PCK_PRES_CLK_64, //!< Set PCK clock prescaler to 64 + GENCLK_PCK_PRES_1 = PMC_PCK_PRES_CLK_1, //!< Set PCK clock prescaler to 1 + GENCLK_PCK_PRES_2 = PMC_PCK_PRES_CLK_2, //!< Set PCK clock prescaler to 2 + GENCLK_PCK_PRES_4 = PMC_PCK_PRES_CLK_4, //!< Set PCK clock prescaler to 4 + GENCLK_PCK_PRES_8 = PMC_PCK_PRES_CLK_8, //!< Set PCK clock prescaler to 8 + GENCLK_PCK_PRES_16 = PMC_PCK_PRES_CLK_16, //!< Set PCK clock prescaler to 16 + GENCLK_PCK_PRES_32 = PMC_PCK_PRES_CLK_32, //!< Set PCK clock prescaler to 32 + GENCLK_PCK_PRES_64 = PMC_PCK_PRES_CLK_64, //!< Set PCK clock prescaler to 64 }; //@} struct genclk_config { - uint32_t ctrl; + uint32_t ctrl; }; -static inline void genclk_config_defaults(struct genclk_config *p_cfg, - uint32_t ul_id) -{ - ul_id = ul_id; - p_cfg->ctrl = 0; +static inline void genclk_config_defaults(struct genclk_config *p_cfg, uint32_t ul_id) { + ul_id = ul_id; + p_cfg->ctrl = 0; } -static inline void genclk_config_read(struct genclk_config *p_cfg, - uint32_t ul_id) -{ - p_cfg->ctrl = PMC->PMC_PCK[ul_id]; +static inline void genclk_config_read(struct genclk_config *p_cfg, uint32_t ul_id) { + p_cfg->ctrl = PMC->PMC_PCK[ul_id]; } -static inline void genclk_config_write(const struct genclk_config *p_cfg, - uint32_t ul_id) -{ - PMC->PMC_PCK[ul_id] = p_cfg->ctrl; +static inline void genclk_config_write(const struct genclk_config *p_cfg, uint32_t ul_id) { + PMC->PMC_PCK[ul_id] = p_cfg->ctrl; } //! \name Programmable Clock Source and Prescaler configuration //@{ -static inline void genclk_config_set_source(struct genclk_config *p_cfg, - enum genclk_source e_src) -{ - p_cfg->ctrl &= (~PMC_PCK_CSS_Msk); - - switch (e_src) { - case GENCLK_PCK_SRC_SLCK_RC: - case GENCLK_PCK_SRC_SLCK_XTAL: - case GENCLK_PCK_SRC_SLCK_BYPASS: - p_cfg->ctrl |= (PMC_PCK_CSS_SLOW_CLK); - break; - - case GENCLK_PCK_SRC_MAINCK_4M_RC: - case GENCLK_PCK_SRC_MAINCK_8M_RC: - case GENCLK_PCK_SRC_MAINCK_12M_RC: - case GENCLK_PCK_SRC_MAINCK_XTAL: - case GENCLK_PCK_SRC_MAINCK_BYPASS: - p_cfg->ctrl |= (PMC_PCK_CSS_MAIN_CLK); - break; - - case GENCLK_PCK_SRC_PLLACK: - p_cfg->ctrl |= (PMC_PCK_CSS_PLLA_CLK); - break; - - case GENCLK_PCK_SRC_PLLBCK: - p_cfg->ctrl |= (PMC_PCK_CSS_UPLL_CLK); - break; - - case GENCLK_PCK_SRC_MCK: - p_cfg->ctrl |= (PMC_PCK_CSS_MCK); - break; - } +static inline void genclk_config_set_source(struct genclk_config *p_cfg, enum genclk_source e_src) { + p_cfg->ctrl &= (~PMC_PCK_CSS_Msk); + + switch (e_src) { + case GENCLK_PCK_SRC_SLCK_RC: + case GENCLK_PCK_SRC_SLCK_XTAL: + case GENCLK_PCK_SRC_SLCK_BYPASS: + p_cfg->ctrl |= (PMC_PCK_CSS_SLOW_CLK); + break; + + case GENCLK_PCK_SRC_MAINCK_4M_RC: + case GENCLK_PCK_SRC_MAINCK_8M_RC: + case GENCLK_PCK_SRC_MAINCK_12M_RC: + case GENCLK_PCK_SRC_MAINCK_XTAL: + case GENCLK_PCK_SRC_MAINCK_BYPASS: + p_cfg->ctrl |= (PMC_PCK_CSS_MAIN_CLK); + break; + + case GENCLK_PCK_SRC_PLLACK: + p_cfg->ctrl |= (PMC_PCK_CSS_PLLA_CLK); + break; + + case GENCLK_PCK_SRC_PLLBCK: + p_cfg->ctrl |= (PMC_PCK_CSS_UPLL_CLK); + break; + + case GENCLK_PCK_SRC_MCK: + p_cfg->ctrl |= (PMC_PCK_CSS_MCK); + break; + } } -static inline void genclk_config_set_divider(struct genclk_config *p_cfg, - uint32_t e_divider) -{ - p_cfg->ctrl &= ~PMC_PCK_PRES_Msk; - p_cfg->ctrl |= e_divider; +static inline void genclk_config_set_divider(struct genclk_config *p_cfg, uint32_t e_divider) { + p_cfg->ctrl &= ~PMC_PCK_PRES_Msk; + p_cfg->ctrl |= e_divider; } //@} -static inline void genclk_enable(const struct genclk_config *p_cfg, - uint32_t ul_id) -{ - PMC->PMC_PCK[ul_id] = p_cfg->ctrl; - pmc_enable_pck(ul_id); +static inline void genclk_enable(const struct genclk_config *p_cfg, uint32_t ul_id) { + PMC->PMC_PCK[ul_id] = p_cfg->ctrl; + pmc_enable_pck(ul_id); } -static inline void genclk_disable(uint32_t ul_id) -{ - pmc_disable_pck(ul_id); +static inline void genclk_disable(uint32_t ul_id) { + pmc_disable_pck(ul_id); } -static inline void genclk_enable_source(enum genclk_source e_src) -{ - switch (e_src) { - case GENCLK_PCK_SRC_SLCK_RC: - if (!osc_is_ready(OSC_SLCK_32K_RC)) { - osc_enable(OSC_SLCK_32K_RC); - osc_wait_ready(OSC_SLCK_32K_RC); - } - break; - - case GENCLK_PCK_SRC_SLCK_XTAL: - if (!osc_is_ready(OSC_SLCK_32K_XTAL)) { - osc_enable(OSC_SLCK_32K_XTAL); - osc_wait_ready(OSC_SLCK_32K_XTAL); - } - break; - - case GENCLK_PCK_SRC_SLCK_BYPASS: - if (!osc_is_ready(OSC_SLCK_32K_BYPASS)) { - osc_enable(OSC_SLCK_32K_BYPASS); - osc_wait_ready(OSC_SLCK_32K_BYPASS); - } - break; - - case GENCLK_PCK_SRC_MAINCK_4M_RC: - if (!osc_is_ready(OSC_MAINCK_4M_RC)) { - osc_enable(OSC_MAINCK_4M_RC); - osc_wait_ready(OSC_MAINCK_4M_RC); - } - break; - - case GENCLK_PCK_SRC_MAINCK_8M_RC: - if (!osc_is_ready(OSC_MAINCK_8M_RC)) { - osc_enable(OSC_MAINCK_8M_RC); - osc_wait_ready(OSC_MAINCK_8M_RC); - } - break; - - case GENCLK_PCK_SRC_MAINCK_12M_RC: - if (!osc_is_ready(OSC_MAINCK_12M_RC)) { - osc_enable(OSC_MAINCK_12M_RC); - osc_wait_ready(OSC_MAINCK_12M_RC); - } - break; - - case GENCLK_PCK_SRC_MAINCK_XTAL: - if (!osc_is_ready(OSC_MAINCK_XTAL)) { - osc_enable(OSC_MAINCK_XTAL); - osc_wait_ready(OSC_MAINCK_XTAL); - } - break; - - case GENCLK_PCK_SRC_MAINCK_BYPASS: - if (!osc_is_ready(OSC_MAINCK_BYPASS)) { - osc_enable(OSC_MAINCK_BYPASS); - osc_wait_ready(OSC_MAINCK_BYPASS); - } - break; - -#ifdef CONFIG_PLL0_SOURCE - case GENCLK_PCK_SRC_PLLACK: - pll_enable_config_defaults(0); - break; -#endif - -#ifdef CONFIG_PLL1_SOURCE - case GENCLK_PCK_SRC_PLLBCK: - pll_enable_config_defaults(1); - break; -#endif - - case GENCLK_PCK_SRC_MCK: - break; - - default: - Assert(false); - break; - } +static inline void genclk_enable_source(enum genclk_source e_src) { + switch (e_src) { + case GENCLK_PCK_SRC_SLCK_RC: + if (!osc_is_ready(OSC_SLCK_32K_RC)) { + osc_enable(OSC_SLCK_32K_RC); + osc_wait_ready(OSC_SLCK_32K_RC); + } + break; + + case GENCLK_PCK_SRC_SLCK_XTAL: + if (!osc_is_ready(OSC_SLCK_32K_XTAL)) { + osc_enable(OSC_SLCK_32K_XTAL); + osc_wait_ready(OSC_SLCK_32K_XTAL); + } + break; + + case GENCLK_PCK_SRC_SLCK_BYPASS: + if (!osc_is_ready(OSC_SLCK_32K_BYPASS)) { + osc_enable(OSC_SLCK_32K_BYPASS); + osc_wait_ready(OSC_SLCK_32K_BYPASS); + } + break; + + case GENCLK_PCK_SRC_MAINCK_4M_RC: + if (!osc_is_ready(OSC_MAINCK_4M_RC)) { + osc_enable(OSC_MAINCK_4M_RC); + osc_wait_ready(OSC_MAINCK_4M_RC); + } + break; + + case GENCLK_PCK_SRC_MAINCK_8M_RC: + if (!osc_is_ready(OSC_MAINCK_8M_RC)) { + osc_enable(OSC_MAINCK_8M_RC); + osc_wait_ready(OSC_MAINCK_8M_RC); + } + break; + + case GENCLK_PCK_SRC_MAINCK_12M_RC: + if (!osc_is_ready(OSC_MAINCK_12M_RC)) { + osc_enable(OSC_MAINCK_12M_RC); + osc_wait_ready(OSC_MAINCK_12M_RC); + } + break; + + case GENCLK_PCK_SRC_MAINCK_XTAL: + if (!osc_is_ready(OSC_MAINCK_XTAL)) { + osc_enable(OSC_MAINCK_XTAL); + osc_wait_ready(OSC_MAINCK_XTAL); + } + break; + + case GENCLK_PCK_SRC_MAINCK_BYPASS: + if (!osc_is_ready(OSC_MAINCK_BYPASS)) { + osc_enable(OSC_MAINCK_BYPASS); + osc_wait_ready(OSC_MAINCK_BYPASS); + } + break; + + #ifdef CONFIG_PLL0_SOURCE + case GENCLK_PCK_SRC_PLLACK: + pll_enable_config_defaults(0); + break; + #endif + + #ifdef CONFIG_PLL1_SOURCE + case GENCLK_PCK_SRC_PLLBCK: + pll_enable_config_defaults(1); + break; + #endif + + case GENCLK_PCK_SRC_MCK: + break; + + default: + Assert(false); + break; + } } //! @} diff --git a/Marlin/src/HAL/DUE/usb/osc.h b/Marlin/src/HAL/DUE/usb/osc.h index 953bcbbed1d3b..c0ae24381a397 100644 --- a/Marlin/src/HAL/DUE/usb/osc.h +++ b/Marlin/src/HAL/DUE/usb/osc.h @@ -62,28 +62,28 @@ extern "C" { * should be defined by the board code, otherwise default value are used. */ #ifndef BOARD_FREQ_SLCK_XTAL -# warning The board slow clock xtal frequency has not been defined. -# define BOARD_FREQ_SLCK_XTAL (32768UL) + #warning The board slow clock xtal frequency has not been defined. + #define BOARD_FREQ_SLCK_XTAL (32768UL) #endif #ifndef BOARD_FREQ_SLCK_BYPASS -# warning The board slow clock bypass frequency has not been defined. -# define BOARD_FREQ_SLCK_BYPASS (32768UL) + #warning The board slow clock bypass frequency has not been defined. + #define BOARD_FREQ_SLCK_BYPASS (32768UL) #endif #ifndef BOARD_FREQ_MAINCK_XTAL -# warning The board main clock xtal frequency has not been defined. -# define BOARD_FREQ_MAINCK_XTAL (12000000UL) + #warning The board main clock xtal frequency has not been defined. + #define BOARD_FREQ_MAINCK_XTAL (12000000UL) #endif #ifndef BOARD_FREQ_MAINCK_BYPASS -# warning The board main clock bypass frequency has not been defined. -# define BOARD_FREQ_MAINCK_BYPASS (12000000UL) + #warning The board main clock bypass frequency has not been defined. + #define BOARD_FREQ_MAINCK_BYPASS (12000000UL) #endif #ifndef BOARD_OSC_STARTUP_US -# warning The board main clock xtal startup time has not been defined. -# define BOARD_OSC_STARTUP_US (15625UL) + #warning The board main clock xtal startup time has not been defined. + #define BOARD_OSC_STARTUP_US (15625UL) #endif /** @@ -115,122 +115,118 @@ extern "C" { #define OSC_MAINCK_BYPASS_HZ BOARD_FREQ_MAINCK_BYPASS //!< External bypass oscillator. //@} -static inline void osc_enable(uint32_t ul_id) -{ - switch (ul_id) { - case OSC_SLCK_32K_RC: - break; +static inline void osc_enable(uint32_t ul_id) { + switch (ul_id) { + case OSC_SLCK_32K_RC: + break; - case OSC_SLCK_32K_XTAL: - pmc_switch_sclk_to_32kxtal(PMC_OSC_XTAL); - break; + case OSC_SLCK_32K_XTAL: + pmc_switch_sclk_to_32kxtal(PMC_OSC_XTAL); + break; - case OSC_SLCK_32K_BYPASS: - pmc_switch_sclk_to_32kxtal(PMC_OSC_BYPASS); - break; + case OSC_SLCK_32K_BYPASS: + pmc_switch_sclk_to_32kxtal(PMC_OSC_BYPASS); + break; - case OSC_MAINCK_4M_RC: - pmc_switch_mainck_to_fastrc(CKGR_MOR_MOSCRCF_4_MHz); - break; + case OSC_MAINCK_4M_RC: + pmc_switch_mainck_to_fastrc(CKGR_MOR_MOSCRCF_4_MHz); + break; - case OSC_MAINCK_8M_RC: - pmc_switch_mainck_to_fastrc(CKGR_MOR_MOSCRCF_8_MHz); - break; + case OSC_MAINCK_8M_RC: + pmc_switch_mainck_to_fastrc(CKGR_MOR_MOSCRCF_8_MHz); + break; - case OSC_MAINCK_12M_RC: - pmc_switch_mainck_to_fastrc(CKGR_MOR_MOSCRCF_12_MHz); - break; + case OSC_MAINCK_12M_RC: + pmc_switch_mainck_to_fastrc(CKGR_MOR_MOSCRCF_12_MHz); + break; - case OSC_MAINCK_XTAL: - pmc_switch_mainck_to_xtal(PMC_OSC_XTAL/*, - pmc_us_to_moscxtst(BOARD_OSC_STARTUP_US, - OSC_SLCK_32K_RC_HZ)*/); - break; + case OSC_MAINCK_XTAL: + pmc_switch_mainck_to_xtal(PMC_OSC_XTAL/*, + pmc_us_to_moscxtst(BOARD_OSC_STARTUP_US, + OSC_SLCK_32K_RC_HZ)*/); + break; - case OSC_MAINCK_BYPASS: - pmc_switch_mainck_to_xtal(PMC_OSC_BYPASS/*, - pmc_us_to_moscxtst(BOARD_OSC_STARTUP_US, - OSC_SLCK_32K_RC_HZ)*/); - break; - } + case OSC_MAINCK_BYPASS: + pmc_switch_mainck_to_xtal(PMC_OSC_BYPASS/*, + pmc_us_to_moscxtst(BOARD_OSC_STARTUP_US, + OSC_SLCK_32K_RC_HZ)*/); + break; + } } -static inline void osc_disable(uint32_t ul_id) -{ - switch (ul_id) { - case OSC_SLCK_32K_RC: - case OSC_SLCK_32K_XTAL: - case OSC_SLCK_32K_BYPASS: - break; - - case OSC_MAINCK_4M_RC: - case OSC_MAINCK_8M_RC: - case OSC_MAINCK_12M_RC: - pmc_osc_disable_fastrc(); - break; - - case OSC_MAINCK_XTAL: - pmc_osc_disable_xtal(PMC_OSC_XTAL); - break; - - case OSC_MAINCK_BYPASS: - pmc_osc_disable_xtal(PMC_OSC_BYPASS); - break; - } +static inline void osc_disable(uint32_t ul_id) { + switch (ul_id) { + case OSC_SLCK_32K_RC: + case OSC_SLCK_32K_XTAL: + case OSC_SLCK_32K_BYPASS: + break; + + case OSC_MAINCK_4M_RC: + case OSC_MAINCK_8M_RC: + case OSC_MAINCK_12M_RC: + pmc_osc_disable_fastrc(); + break; + + case OSC_MAINCK_XTAL: + pmc_osc_disable_xtal(PMC_OSC_XTAL); + break; + + case OSC_MAINCK_BYPASS: + pmc_osc_disable_xtal(PMC_OSC_BYPASS); + break; + } } -static inline bool osc_is_ready(uint32_t ul_id) -{ - switch (ul_id) { - case OSC_SLCK_32K_RC: - return 1; - - case OSC_SLCK_32K_XTAL: - case OSC_SLCK_32K_BYPASS: - return pmc_osc_is_ready_32kxtal(); - - case OSC_MAINCK_4M_RC: - case OSC_MAINCK_8M_RC: - case OSC_MAINCK_12M_RC: - case OSC_MAINCK_XTAL: - case OSC_MAINCK_BYPASS: - return pmc_osc_is_ready_mainck(); - } - - return 0; +static inline bool osc_is_ready(uint32_t ul_id) { + switch (ul_id) { + case OSC_SLCK_32K_RC: + return 1; + + case OSC_SLCK_32K_XTAL: + case OSC_SLCK_32K_BYPASS: + return pmc_osc_is_ready_32kxtal(); + + case OSC_MAINCK_4M_RC: + case OSC_MAINCK_8M_RC: + case OSC_MAINCK_12M_RC: + case OSC_MAINCK_XTAL: + case OSC_MAINCK_BYPASS: + return pmc_osc_is_ready_mainck(); + } + + return 0; } -static inline uint32_t osc_get_rate(uint32_t ul_id) -{ - switch (ul_id) { - case OSC_SLCK_32K_RC: - return OSC_SLCK_32K_RC_HZ; +static inline uint32_t osc_get_rate(uint32_t ul_id) { + switch (ul_id) { + case OSC_SLCK_32K_RC: + return OSC_SLCK_32K_RC_HZ; - case OSC_SLCK_32K_XTAL: - return BOARD_FREQ_SLCK_XTAL; + case OSC_SLCK_32K_XTAL: + return BOARD_FREQ_SLCK_XTAL; - case OSC_SLCK_32K_BYPASS: - return BOARD_FREQ_SLCK_BYPASS; + case OSC_SLCK_32K_BYPASS: + return BOARD_FREQ_SLCK_BYPASS; - case OSC_MAINCK_4M_RC: - return OSC_MAINCK_4M_RC_HZ; + case OSC_MAINCK_4M_RC: + return OSC_MAINCK_4M_RC_HZ; - case OSC_MAINCK_8M_RC: - return OSC_MAINCK_8M_RC_HZ; + case OSC_MAINCK_8M_RC: + return OSC_MAINCK_8M_RC_HZ; - case OSC_MAINCK_12M_RC: - return OSC_MAINCK_12M_RC_HZ; + case OSC_MAINCK_12M_RC: + return OSC_MAINCK_12M_RC_HZ; - case OSC_MAINCK_XTAL: - return BOARD_FREQ_MAINCK_XTAL; + case OSC_MAINCK_XTAL: + return BOARD_FREQ_MAINCK_XTAL; - case OSC_MAINCK_BYPASS: - return BOARD_FREQ_MAINCK_BYPASS; - } + case OSC_MAINCK_BYPASS: + return BOARD_FREQ_MAINCK_BYPASS; + } - return 0; + return 0; } /** @@ -241,11 +237,10 @@ static inline uint32_t osc_get_rate(uint32_t ul_id) * * \param id A number identifying the oscillator to wait for. */ -static inline void osc_wait_ready(uint8_t id) -{ - while (!osc_is_ready(id)) { - /* Do nothing */ - } +static inline void osc_wait_ready(uint8_t id) { + while (!osc_is_ready(id)) { + /* Do nothing */ + } } //! @} diff --git a/Marlin/src/HAL/DUE/usb/pll.h b/Marlin/src/HAL/DUE/usb/pll.h index 8eaf27672b25b..d25a1f65d09b8 100644 --- a/Marlin/src/HAL/DUE/usb/pll.h +++ b/Marlin/src/HAL/DUE/usb/pll.h @@ -77,22 +77,22 @@ extern "C" { #define PLL_COUNT 0x3FU enum pll_source { - PLL_SRC_MAINCK_4M_RC = OSC_MAINCK_4M_RC, //!< Internal 4MHz RC oscillator. - PLL_SRC_MAINCK_8M_RC = OSC_MAINCK_8M_RC, //!< Internal 8MHz RC oscillator. - PLL_SRC_MAINCK_12M_RC = OSC_MAINCK_12M_RC, //!< Internal 12MHz RC oscillator. - PLL_SRC_MAINCK_XTAL = OSC_MAINCK_XTAL, //!< External crystal oscillator. - PLL_SRC_MAINCK_BYPASS = OSC_MAINCK_BYPASS, //!< External bypass oscillator. - PLL_NR_SOURCES, //!< Number of PLL sources. + PLL_SRC_MAINCK_4M_RC = OSC_MAINCK_4M_RC, //!< Internal 4MHz RC oscillator. + PLL_SRC_MAINCK_8M_RC = OSC_MAINCK_8M_RC, //!< Internal 8MHz RC oscillator. + PLL_SRC_MAINCK_12M_RC = OSC_MAINCK_12M_RC, //!< Internal 12MHz RC oscillator. + PLL_SRC_MAINCK_XTAL = OSC_MAINCK_XTAL, //!< External crystal oscillator. + PLL_SRC_MAINCK_BYPASS = OSC_MAINCK_BYPASS, //!< External bypass oscillator. + PLL_NR_SOURCES, //!< Number of PLL sources. }; struct pll_config { - uint32_t ctrl; + uint32_t ctrl; }; #define pll_get_default_rate(pll_id) \ - ((osc_get_rate(CONFIG_PLL##pll_id##_SOURCE) \ - * CONFIG_PLL##pll_id##_MUL) \ - / CONFIG_PLL##pll_id##_DIV) + ((osc_get_rate(CONFIG_PLL##pll_id##_SOURCE) \ + * CONFIG_PLL##pll_id##_MUL) \ + / CONFIG_PLL##pll_id##_DIV) /* Force UTMI PLL parameters (Hardware defined) */ #ifdef CONFIG_PLL1_SOURCE @@ -113,145 +113,130 @@ struct pll_config { * is hidden in this implementation. Use mul as mul effective value. */ static inline void pll_config_init(struct pll_config *p_cfg, - enum pll_source e_src, uint32_t ul_div, uint32_t ul_mul) -{ - uint32_t vco_hz; - - Assert(e_src < PLL_NR_SOURCES); - - if (ul_div == 0 && ul_mul == 0) { /* Must only be true for UTMI PLL */ - p_cfg->ctrl = CKGR_UCKR_UPLLCOUNT(PLL_COUNT); - } else { /* PLLA */ - /* Calculate internal VCO frequency */ - vco_hz = osc_get_rate(e_src) / ul_div; - Assert(vco_hz >= PLL_INPUT_MIN_HZ); - Assert(vco_hz <= PLL_INPUT_MAX_HZ); - - vco_hz *= ul_mul; - Assert(vco_hz >= PLL_OUTPUT_MIN_HZ); - Assert(vco_hz <= PLL_OUTPUT_MAX_HZ); - - /* PMC hardware will automatically make it mul+1 */ - p_cfg->ctrl = CKGR_PLLAR_MULA(ul_mul - 1) | CKGR_PLLAR_DIVA(ul_div) | CKGR_PLLAR_PLLACOUNT(PLL_COUNT); - } + enum pll_source e_src, uint32_t ul_div, uint32_t ul_mul) { + uint32_t vco_hz; + + Assert(e_src < PLL_NR_SOURCES); + + if (ul_div == 0 && ul_mul == 0) { /* Must only be true for UTMI PLL */ + p_cfg->ctrl = CKGR_UCKR_UPLLCOUNT(PLL_COUNT); + } + else { /* PLLA */ + /* Calculate internal VCO frequency */ + vco_hz = osc_get_rate(e_src) / ul_div; + Assert(vco_hz >= PLL_INPUT_MIN_HZ); + Assert(vco_hz <= PLL_INPUT_MAX_HZ); + + vco_hz *= ul_mul; + Assert(vco_hz >= PLL_OUTPUT_MIN_HZ); + Assert(vco_hz <= PLL_OUTPUT_MAX_HZ); + + /* PMC hardware will automatically make it mul+1 */ + p_cfg->ctrl = CKGR_PLLAR_MULA(ul_mul - 1) | CKGR_PLLAR_DIVA(ul_div) | CKGR_PLLAR_PLLACOUNT(PLL_COUNT); + } } -#define pll_config_defaults(cfg, pll_id) \ - pll_config_init(cfg, \ - CONFIG_PLL##pll_id##_SOURCE, \ - CONFIG_PLL##pll_id##_DIV, \ - CONFIG_PLL##pll_id##_MUL) - -static inline void pll_config_read(struct pll_config *p_cfg, uint32_t ul_pll_id) -{ - Assert(ul_pll_id < NR_PLLS); - - if (ul_pll_id == PLLA_ID) { - p_cfg->ctrl = PMC->CKGR_PLLAR; - } else { - p_cfg->ctrl = PMC->CKGR_UCKR; - } +#define pll_config_defaults(cfg, pll_id) \ + pll_config_init(cfg, \ + CONFIG_PLL##pll_id##_SOURCE, \ + CONFIG_PLL##pll_id##_DIV, \ + CONFIG_PLL##pll_id##_MUL) + +static inline void pll_config_read(struct pll_config *p_cfg, uint32_t ul_pll_id) { + Assert(ul_pll_id < NR_PLLS); + p_cfg->ctrl = ul_pll_id == PLLA_ID ? PMC->CKGR_PLLAR : PMC->CKGR_UCKR; } -static inline void pll_config_write(const struct pll_config *p_cfg, uint32_t ul_pll_id) -{ - Assert(ul_pll_id < NR_PLLS); +static inline void pll_config_write(const struct pll_config *p_cfg, uint32_t ul_pll_id) { + Assert(ul_pll_id < NR_PLLS); - if (ul_pll_id == PLLA_ID) { - pmc_disable_pllack(); // Always stop PLL first! - PMC->CKGR_PLLAR = CKGR_PLLAR_ONE | p_cfg->ctrl; - } else { - PMC->CKGR_UCKR = p_cfg->ctrl; - } + if (ul_pll_id == PLLA_ID) { + pmc_disable_pllack(); // Always stop PLL first! + PMC->CKGR_PLLAR = CKGR_PLLAR_ONE | p_cfg->ctrl; + } + else + PMC->CKGR_UCKR = p_cfg->ctrl; } -static inline void pll_enable(const struct pll_config *p_cfg, uint32_t ul_pll_id) -{ - Assert(ul_pll_id < NR_PLLS); +static inline void pll_enable(const struct pll_config *p_cfg, uint32_t ul_pll_id) { + Assert(ul_pll_id < NR_PLLS); - if (ul_pll_id == PLLA_ID) { - pmc_disable_pllack(); // Always stop PLL first! - PMC->CKGR_PLLAR = CKGR_PLLAR_ONE | p_cfg->ctrl; - } else { - PMC->CKGR_UCKR = p_cfg->ctrl | CKGR_UCKR_UPLLEN; - } + if (ul_pll_id == PLLA_ID) { + pmc_disable_pllack(); // Always stop PLL first! + PMC->CKGR_PLLAR = CKGR_PLLAR_ONE | p_cfg->ctrl; + } + else + PMC->CKGR_UCKR = p_cfg->ctrl | CKGR_UCKR_UPLLEN; } /** * \note This will only disable the selected PLL, not the underlying oscillator (mainck). */ -static inline void pll_disable(uint32_t ul_pll_id) -{ - Assert(ul_pll_id < NR_PLLS); - - if (ul_pll_id == PLLA_ID) { - pmc_disable_pllack(); - } else { - PMC->CKGR_UCKR &= ~CKGR_UCKR_UPLLEN; - } +static inline void pll_disable(uint32_t ul_pll_id) { + Assert(ul_pll_id < NR_PLLS); + + if (ul_pll_id == PLLA_ID) + pmc_disable_pllack(); + else + PMC->CKGR_UCKR &= ~CKGR_UCKR_UPLLEN; } -static inline uint32_t pll_is_locked(uint32_t ul_pll_id) -{ - Assert(ul_pll_id < NR_PLLS); +static inline uint32_t pll_is_locked(uint32_t ul_pll_id) { + Assert(ul_pll_id < NR_PLLS); - if (ul_pll_id == PLLA_ID) { - return pmc_is_locked_pllack(); - } else { - return pmc_is_locked_upll(); - } + if (ul_pll_id == PLLA_ID) + return pmc_is_locked_pllack(); + else + return pmc_is_locked_upll(); } -static inline void pll_enable_source(enum pll_source e_src) -{ - switch (e_src) { - case PLL_SRC_MAINCK_4M_RC: - case PLL_SRC_MAINCK_8M_RC: - case PLL_SRC_MAINCK_12M_RC: - case PLL_SRC_MAINCK_XTAL: - case PLL_SRC_MAINCK_BYPASS: - osc_enable(e_src); - osc_wait_ready(e_src); - break; - - default: - Assert(false); - break; - } +static inline void pll_enable_source(enum pll_source e_src) { + switch (e_src) { + case PLL_SRC_MAINCK_4M_RC: + case PLL_SRC_MAINCK_8M_RC: + case PLL_SRC_MAINCK_12M_RC: + case PLL_SRC_MAINCK_XTAL: + case PLL_SRC_MAINCK_BYPASS: + osc_enable(e_src); + osc_wait_ready(e_src); + break; + + default: + Assert(false); + break; + } } -static inline void pll_enable_config_defaults(unsigned int ul_pll_id) -{ - struct pll_config pllcfg; - - if (pll_is_locked(ul_pll_id)) { - return; // Pll already running - } - switch (ul_pll_id) { -#ifdef CONFIG_PLL0_SOURCE - case 0: - pll_enable_source(CONFIG_PLL0_SOURCE); - pll_config_init(&pllcfg, - CONFIG_PLL0_SOURCE, - CONFIG_PLL0_DIV, - CONFIG_PLL0_MUL); - break; -#endif -#ifdef CONFIG_PLL1_SOURCE - case 1: - pll_enable_source(CONFIG_PLL1_SOURCE); - pll_config_init(&pllcfg, - CONFIG_PLL1_SOURCE, - CONFIG_PLL1_DIV, - CONFIG_PLL1_MUL); - break; -#endif - default: - Assert(false); - break; - } - pll_enable(&pllcfg, ul_pll_id); - while (!pll_is_locked(ul_pll_id)); +static inline void pll_enable_config_defaults(unsigned int ul_pll_id) { + struct pll_config pllcfg; + + if (pll_is_locked(ul_pll_id)) return; // Pll already running + + switch (ul_pll_id) { + #ifdef CONFIG_PLL0_SOURCE + case 0: + pll_enable_source(CONFIG_PLL0_SOURCE); + pll_config_init(&pllcfg, + CONFIG_PLL0_SOURCE, + CONFIG_PLL0_DIV, + CONFIG_PLL0_MUL); + break; + #endif + #ifdef CONFIG_PLL1_SOURCE + case 1: + pll_enable_source(CONFIG_PLL1_SOURCE); + pll_config_init(&pllcfg, + CONFIG_PLL1_SOURCE, + CONFIG_PLL1_DIV, + CONFIG_PLL1_MUL); + break; + #endif + default: + Assert(false); + break; + } + pll_enable(&pllcfg, ul_pll_id); + while (!pll_is_locked(ul_pll_id)); } /** @@ -264,15 +249,12 @@ static inline void pll_enable_config_defaults(unsigned int ul_pll_id) * \retval STATUS_OK The PLL is now locked. * \retval ERR_TIMEOUT Timed out waiting for PLL to become locked. */ -static inline int pll_wait_for_lock(unsigned int pll_id) -{ - Assert(pll_id < NR_PLLS); +static inline int pll_wait_for_lock(unsigned int pll_id) { + Assert(pll_id < NR_PLLS); - while (!pll_is_locked(pll_id)) { - /* Do nothing */ - } + while (!pll_is_locked(pll_id)) { /* Do nothing */ } - return 0; + return 0; } //! @} diff --git a/Marlin/src/HAL/DUE/usb/sbc_protocol.h b/Marlin/src/HAL/DUE/usb/sbc_protocol.h index ab845739fd484..983ec7adca1c6 100644 --- a/Marlin/src/HAL/DUE/usb/sbc_protocol.h +++ b/Marlin/src/HAL/DUE/usb/sbc_protocol.h @@ -57,7 +57,6 @@ #ifndef _SBC_PROTOCOL_H_ #define _SBC_PROTOCOL_H_ - /** * \ingroup usb_msc_protocol * \defgroup usb_sbc_protocol SCSI Block Commands protocol definitions @@ -81,82 +80,82 @@ //@{ enum scsi_sbc_mode { - SCSI_MS_MODE_RW_ERR_RECOV = 0x01, //!< Read-Write Error Recovery mode page - SCSI_MS_MODE_FORMAT_DEVICE = 0x03, //!< Format Device mode page - SCSI_MS_MODE_FLEXIBLE_DISK = 0x05, //!< Flexible Disk mode page - SCSI_MS_MODE_CACHING = 0x08, //!< Caching mode page + SCSI_MS_MODE_RW_ERR_RECOV = 0x01, //!< Read-Write Error Recovery mode page + SCSI_MS_MODE_FORMAT_DEVICE = 0x03, //!< Format Device mode page + SCSI_MS_MODE_FLEXIBLE_DISK = 0x05, //!< Flexible Disk mode page + SCSI_MS_MODE_CACHING = 0x08, //!< Caching mode page }; //! \name SBC-2 Device-Specific Parameter //@{ -#define SCSI_MS_SBC_WP 0x80 //!< Write Protected -#define SCSI_MS_SBC_DPOFUA 0x10 //!< DPO and FUA supported +#define SCSI_MS_SBC_WP 0x80 //!< Write Protected +#define SCSI_MS_SBC_DPOFUA 0x10 //!< DPO and FUA supported //@} /** * \brief SBC-2 Short LBA mode parameter block descriptor */ struct sbc_slba_block_desc { - be32_t nr_blocks; //!< Number of Blocks - be32_t block_len; //!< Block Length -#define SBC_SLBA_BLOCK_LEN_MASK 0x00FFFFFFU //!< Mask reserved bits + be32_t nr_blocks; //!< Number of Blocks + be32_t block_len; //!< Block Length +#define SBC_SLBA_BLOCK_LEN_MASK 0x00FFFFFFU //!< Mask reserved bits }; /** * \brief SBC-2 Caching mode page */ struct sbc_caching_mode_page { - uint8_t page_code; - uint8_t page_length; - uint8_t flags2; -#define SBC_MP_CACHE_IC (1 << 7) //!< Initiator Control -#define SBC_MP_CACHE_ABPF (1 << 6) //!< Abort Pre-Fetch -#define SBC_MP_CACHE_CAP (1 << 5) //!< Catching Analysis Permitted -#define SBC_MP_CACHE_DISC (1 << 4) //!< Discontinuity -#define SBC_MP_CACHE_SIZE (1 << 3) //!< Size enable -#define SBC_MP_CACHE_WCE (1 << 2) //!< Write back Cache Enable -#define SBC_MP_CACHE_MF (1 << 1) //!< Multiplication Factor -#define SBC_MP_CACHE_RCD (1 << 0) //!< Read Cache Disable - uint8_t retention; - be16_t dis_pf_transfer_len; - be16_t min_prefetch; - be16_t max_prefetch; - be16_t max_prefetch_ceil; - uint8_t flags12; -#define SBC_MP_CACHE_FSW (1 << 7) //!< Force Sequential Write -#define SBC_MP_CACHE_LBCSS (1 << 6) //!< Logical Blk Cache Seg Sz -#define SBC_MP_CACHE_DRA (1 << 5) //!< Disable Read-Ahead -#define SBC_MP_CACHE_NV_DIS (1 << 0) //!< Non-Volatile Cache Disable - uint8_t nr_cache_segments; - be16_t cache_segment_size; - uint8_t reserved[4]; + uint8_t page_code; + uint8_t page_length; + uint8_t flags2; +#define SBC_MP_CACHE_IC (1 << 7) //!< Initiator Control +#define SBC_MP_CACHE_ABPF (1 << 6) //!< Abort Pre-Fetch +#define SBC_MP_CACHE_CAP (1 << 5) //!< Catching Analysis Permitted +#define SBC_MP_CACHE_DISC (1 << 4) //!< Discontinuity +#define SBC_MP_CACHE_SIZE (1 << 3) //!< Size enable +#define SBC_MP_CACHE_WCE (1 << 2) //!< Write back Cache Enable +#define SBC_MP_CACHE_MF (1 << 1) //!< Multiplication Factor +#define SBC_MP_CACHE_RCD (1 << 0) //!< Read Cache Disable + uint8_t retention; + be16_t dis_pf_transfer_len; + be16_t min_prefetch; + be16_t max_prefetch; + be16_t max_prefetch_ceil; + uint8_t flags12; +#define SBC_MP_CACHE_FSW (1 << 7) //!< Force Sequential Write +#define SBC_MP_CACHE_LBCSS (1 << 6) //!< Logical Blk Cache Seg Sz +#define SBC_MP_CACHE_DRA (1 << 5) //!< Disable Read-Ahead +#define SBC_MP_CACHE_NV_DIS (1 << 0) //!< Non-Volatile Cache Disable + uint8_t nr_cache_segments; + be16_t cache_segment_size; + uint8_t reserved[4]; }; /** * \brief SBC-2 Read-Write Error Recovery mode page */ struct sbc_rdwr_error_recovery_mode_page { - uint8_t page_code; - uint8_t page_length; -#define SPC_MP_RW_ERR_RECOV_PAGE_LENGTH 0x0A - uint8_t flags1; -#define SBC_MP_RW_ERR_RECOV_AWRE (1 << 7) -#define SBC_MP_RW_ERR_RECOV_ARRE (1 << 6) -#define SBC_MP_RW_ERR_RECOV_TB (1 << 5) -#define SBC_MP_RW_ERR_RECOV_RC (1 << 4) -#define SBC_MP_RW_ERR_RECOV_ERR (1 << 3) -#define SBC_MP_RW_ERR_RECOV_PER (1 << 2) -#define SBC_MP_RW_ERR_RECOV_DTE (1 << 1) -#define SBC_MP_RW_ERR_RECOV_DCR (1 << 0) - uint8_t read_retry_count; - uint8_t correction_span; - uint8_t head_offset_count; - uint8_t data_strobe_offset_count; - uint8_t flags2; - uint8_t write_retry_count; - uint8_t flags3; - be16_t recovery_time_limit; + uint8_t page_code; + uint8_t page_length; + #define SPC_MP_RW_ERR_RECOV_PAGE_LENGTH 0x0A + uint8_t flags1; + #define SBC_MP_RW_ERR_RECOV_AWRE (1 << 7) + #define SBC_MP_RW_ERR_RECOV_ARRE (1 << 6) + #define SBC_MP_RW_ERR_RECOV_TB (1 << 5) + #define SBC_MP_RW_ERR_RECOV_RC (1 << 4) + #define SBC_MP_RW_ERR_RECOV_ERR (1 << 3) + #define SBC_MP_RW_ERR_RECOV_PER (1 << 2) + #define SBC_MP_RW_ERR_RECOV_DTE (1 << 1) + #define SBC_MP_RW_ERR_RECOV_DCR (1 << 0) + uint8_t read_retry_count; + uint8_t correction_span; + uint8_t head_offset_count; + uint8_t data_strobe_offset_count; + uint8_t flags2; + uint8_t write_retry_count; + uint8_t flags3; + be16_t recovery_time_limit; }; //@} @@ -164,8 +163,8 @@ struct sbc_rdwr_error_recovery_mode_page { * \brief SBC-2 READ CAPACITY (10) parameter data */ struct sbc_read_capacity10_data { - be32_t max_lba; //!< LBA of last logical block - be32_t block_len; //!< Number of bytes in the last logical block + be32_t max_lba; //!< LBA of last logical block + be32_t block_len; //!< Number of bytes in the last logical block }; //@} diff --git a/Marlin/src/HAL/DUE/usb/spc_protocol.h b/Marlin/src/HAL/DUE/usb/spc_protocol.h index d67cc5c78803e..3fe82a9dca575 100644 --- a/Marlin/src/HAL/DUE/usb/spc_protocol.h +++ b/Marlin/src/HAL/DUE/usb/spc_protocol.h @@ -59,23 +59,23 @@ //! \name SCSI commands defined by SPC-2 //@{ -#define SPC_TEST_UNIT_READY 0x00 -#define SPC_REQUEST_SENSE 0x03 -#define SPC_INQUIRY 0x12 -#define SPC_MODE_SELECT6 0x15 -#define SPC_MODE_SENSE6 0x1A -#define SPC_SEND_DIAGNOSTIC 0x1D -#define SPC_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1E -#define SPC_MODE_SENSE10 0x5A -#define SPC_REPORT_LUNS 0xA0 +#define SPC_TEST_UNIT_READY 0x00 +#define SPC_REQUEST_SENSE 0x03 +#define SPC_INQUIRY 0x12 +#define SPC_MODE_SELECT6 0x15 +#define SPC_MODE_SENSE6 0x1A +#define SPC_SEND_DIAGNOSTIC 0x1D +#define SPC_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1E +#define SPC_MODE_SENSE10 0x5A +#define SPC_REPORT_LUNS 0xA0 //@} //! \brief May be set in byte 0 of the INQUIRY CDB //@{ //! Enable Vital Product Data -#define SCSI_INQ_REQ_EVPD 0x01 +#define SCSI_INQ_REQ_EVPD 0x01 //! Command Support Data specified by the PAGE OR OPERATION CODE field -#define SCSI_INQ_REQ_CMDT 0x02 +#define SCSI_INQ_REQ_CMDT 0x02 //@} COMPILER_PACK_SET(1) @@ -84,110 +84,110 @@ COMPILER_PACK_SET(1) * \brief SCSI Standard Inquiry data structure */ struct scsi_inquiry_data { - uint8_t pq_pdt; //!< Peripheral Qual / Peripheral Dev Type -#define SCSI_INQ_PQ_CONNECTED 0x00 //!< Peripheral connected -#define SCSI_INQ_PQ_NOT_CONN 0x20 //!< Peripheral not connected -#define SCSI_INQ_PQ_NOT_SUPP 0x60 //!< Peripheral not supported -#define SCSI_INQ_DT_DIR_ACCESS 0x00 //!< Direct Access (SBC) -#define SCSI_INQ_DT_SEQ_ACCESS 0x01 //!< Sequential Access -#define SCSI_INQ_DT_PRINTER 0x02 //!< Printer -#define SCSI_INQ_DT_PROCESSOR 0x03 //!< Processor device -#define SCSI_INQ_DT_WRITE_ONCE 0x04 //!< Write-once device -#define SCSI_INQ_DT_CD_DVD 0x05 //!< CD/DVD device -#define SCSI_INQ_DT_OPTICAL 0x07 //!< Optical Memory -#define SCSI_INQ_DT_MC 0x08 //!< Medium Changer -#define SCSI_INQ_DT_ARRAY 0x0C //!< Storage Array Controller -#define SCSI_INQ_DT_ENCLOSURE 0x0D //!< Enclosure Services -#define SCSI_INQ_DT_RBC 0x0E //!< Simplified Direct Access -#define SCSI_INQ_DT_OCRW 0x0F //!< Optical card reader/writer -#define SCSI_INQ_DT_BCC 0x10 //!< Bridge Controller Commands -#define SCSI_INQ_DT_OSD 0x11 //!< Object-based Storage -#define SCSI_INQ_DT_NONE 0x1F //!< No Peripheral - uint8_t flags1; //!< Flags (byte 1) -#define SCSI_INQ_RMB 0x80 //!< Removable Medium - uint8_t version; //!< Version -#define SCSI_INQ_VER_NONE 0x00 //!< No standards conformance -#define SCSI_INQ_VER_SPC 0x03 //!< SCSI Primary Commands (link to SBC) -#define SCSI_INQ_VER_SPC2 0x04 //!< SCSI Primary Commands - 2 (link to SBC-2) -#define SCSI_INQ_VER_SPC3 0x05 //!< SCSI Primary Commands - 3 (link to SBC-2) -#define SCSI_INQ_VER_SPC4 0x06 //!< SCSI Primary Commands - 4 (link to SBC-3) - uint8_t flags3; //!< Flags (byte 3) -#define SCSI_INQ_NORMACA 0x20 //!< Normal ACA Supported -#define SCSI_INQ_HISUP 0x10 //!< Hierarchal LUN addressing -#define SCSI_INQ_RSP_SPC2 0x02 //!< SPC-2 / SPC-3 response format - uint8_t addl_len; //!< Additional Length (n-4) -#define SCSI_INQ_ADDL_LEN(tot) ((tot)-5) //!< Total length is \a tot - uint8_t flags5; //!< Flags (byte 5) -#define SCSI_INQ_SCCS 0x80 - uint8_t flags6; //!< Flags (byte 6) -#define SCSI_INQ_BQUE 0x80 -#define SCSI_INQ_ENCSERV 0x40 -#define SCSI_INQ_MULTIP 0x10 -#define SCSI_INQ_MCHGR 0x08 -#define SCSI_INQ_ADDR16 0x01 - uint8_t flags7; //!< Flags (byte 7) -#define SCSI_INQ_WBUS16 0x20 -#define SCSI_INQ_SYNC 0x10 -#define SCSI_INQ_LINKED 0x08 -#define SCSI_INQ_CMDQUE 0x02 - uint8_t vendor_id[8]; //!< T10 Vendor Identification - uint8_t product_id[16]; //!< Product Identification - uint8_t product_rev[4]; //!< Product Revision Level + uint8_t pq_pdt; //!< Peripheral Qual / Peripheral Dev Type + #define SCSI_INQ_PQ_CONNECTED 0x00 //!< Peripheral connected + #define SCSI_INQ_PQ_NOT_CONN 0x20 //!< Peripheral not connected + #define SCSI_INQ_PQ_NOT_SUPP 0x60 //!< Peripheral not supported + #define SCSI_INQ_DT_DIR_ACCESS 0x00 //!< Direct Access (SBC) + #define SCSI_INQ_DT_SEQ_ACCESS 0x01 //!< Sequential Access + #define SCSI_INQ_DT_PRINTER 0x02 //!< Printer + #define SCSI_INQ_DT_PROCESSOR 0x03 //!< Processor device + #define SCSI_INQ_DT_WRITE_ONCE 0x04 //!< Write-once device + #define SCSI_INQ_DT_CD_DVD 0x05 //!< CD/DVD device + #define SCSI_INQ_DT_OPTICAL 0x07 //!< Optical Memory + #define SCSI_INQ_DT_MC 0x08 //!< Medium Changer + #define SCSI_INQ_DT_ARRAY 0x0C //!< Storage Array Controller + #define SCSI_INQ_DT_ENCLOSURE 0x0D //!< Enclosure Services + #define SCSI_INQ_DT_RBC 0x0E //!< Simplified Direct Access + #define SCSI_INQ_DT_OCRW 0x0F //!< Optical card reader/writer + #define SCSI_INQ_DT_BCC 0x10 //!< Bridge Controller Commands + #define SCSI_INQ_DT_OSD 0x11 //!< Object-based Storage + #define SCSI_INQ_DT_NONE 0x1F //!< No Peripheral + uint8_t flags1; //!< Flags (byte 1) + #define SCSI_INQ_RMB 0x80 //!< Removable Medium + uint8_t version; //!< Version + #define SCSI_INQ_VER_NONE 0x00 //!< No standards conformance + #define SCSI_INQ_VER_SPC 0x03 //!< SCSI Primary Commands (link to SBC) + #define SCSI_INQ_VER_SPC2 0x04 //!< SCSI Primary Commands - 2 (link to SBC-2) + #define SCSI_INQ_VER_SPC3 0x05 //!< SCSI Primary Commands - 3 (link to SBC-2) + #define SCSI_INQ_VER_SPC4 0x06 //!< SCSI Primary Commands - 4 (link to SBC-3) + uint8_t flags3; //!< Flags (byte 3) + #define SCSI_INQ_NORMACA 0x20 //!< Normal ACA Supported + #define SCSI_INQ_HISUP 0x10 //!< Hierarchal LUN addressing + #define SCSI_INQ_RSP_SPC2 0x02 //!< SPC-2 / SPC-3 response format + uint8_t addl_len; //!< Additional Length (n-4) + #define SCSI_INQ_ADDL_LEN (tot) ((tot)-5) //!< Total length is \a tot + uint8_t flags5; //!< Flags (byte 5) + #define SCSI_INQ_SCCS 0x80 + uint8_t flags6; //!< Flags (byte 6) + #define SCSI_INQ_BQUE 0x80 + #define SCSI_INQ_ENCSERV 0x40 + #define SCSI_INQ_MULTIP 0x10 + #define SCSI_INQ_MCHGR 0x08 + #define SCSI_INQ_ADDR16 0x01 + uint8_t flags7; //!< Flags (byte 7) + #define SCSI_INQ_WBUS16 0x20 + #define SCSI_INQ_SYNC 0x10 + #define SCSI_INQ_LINKED 0x08 + #define SCSI_INQ_CMDQUE 0x02 + uint8_t vendor_id[8]; //!< T10 Vendor Identification + uint8_t product_id[16]; //!< Product Identification + uint8_t product_rev[4]; //!< Product Revision Level }; /** * \brief SCSI Standard Request sense data structure */ struct scsi_request_sense_data { - /* 1st byte: REQUEST SENSE response flags*/ - uint8_t valid_reponse_code; -#define SCSI_SENSE_VALID 0x80 //!< Indicates the INFORMATION field contains valid information -#define SCSI_SENSE_RESPONSE_CODE_MASK 0x7F -#define SCSI_SENSE_CURRENT 0x70 //!< Response code 70h (current errors) -#define SCSI_SENSE_DEFERRED 0x71 - - /* 2nd byte */ - uint8_t obsolete; - - /* 3rd byte */ - uint8_t sense_flag_key; -#define SCSI_SENSE_FILEMARK 0x80 //!< Indicates that the current command has read a filemark or setmark. -#define SCSI_SENSE_EOM 0x40 //!< Indicates that an end-of-medium condition exists. -#define SCSI_SENSE_ILI 0x20 //!< Indicates that the requested logical block length did not match the logical block length of the data on the medium. -#define SCSI_SENSE_RESERVED 0x10 //!< Reserved -#define SCSI_SENSE_KEY(x) (x&0x0F) //!< Sense Key - - /* 4th to 7th bytes - INFORMATION field */ - uint8_t information[4]; - - /* 8th byte - ADDITIONAL SENSE LENGTH field */ - uint8_t AddSenseLen; -#define SCSI_SENSE_ADDL_LEN(total_len) ((total_len) - 8) - - /* 9th to 12th byte - COMMAND-SPECIFIC INFORMATION field */ - uint8_t CmdSpecINFO[4]; - - /* 13th byte - ADDITIONAL SENSE CODE field */ - uint8_t AddSenseCode; - - /* 14th byte - ADDITIONAL SENSE CODE QUALIFIER field */ - uint8_t AddSnsCodeQlfr; - - /* 15th byte - FIELD REPLACEABLE UNIT CODE field */ - uint8_t FldReplUnitCode; - - /* 16th byte */ - uint8_t SenseKeySpec[3]; -#define SCSI_SENSE_SKSV 0x80 //!< Indicates the SENSE-KEY SPECIFIC field contains valid information + /* 1st byte: REQUEST SENSE response flags*/ + uint8_t valid_reponse_code; + #define SCSI_SENSE_VALID 0x80 //!< Indicates the INFORMATION field contains valid information + #define SCSI_SENSE_RESPONSE_CODE_MASK 0x7F + #define SCSI_SENSE_CURRENT 0x70 //!< Response code 70h (current errors) + #define SCSI_SENSE_DEFERRED 0x71 + + /* 2nd byte */ + uint8_t obsolete; + + /* 3rd byte */ + uint8_t sense_flag_key; + #define SCSI_SENSE_FILEMARK 0x80 //!< Indicates that the current command has read a filemark or setmark. + #define SCSI_SENSE_EOM 0x40 //!< Indicates that an end-of-medium condition exists. + #define SCSI_SENSE_ILI 0x20 //!< Indicates that the requested logical block length did not match the logical block length of the data on the medium. + #define SCSI_SENSE_RESERVED 0x10 //!< Reserved + #define SCSI_SENSE_KEY(x) (x&0x0F) //!< Sense Key + + /* 4th to 7th bytes - INFORMATION field */ + uint8_t information[4]; + + /* 8th byte - ADDITIONAL SENSE LENGTH field */ + uint8_t AddSenseLen; + #define SCSI_SENSE_ADDL_LEN(total_len) ((total_len) - 8) + + /* 9th to 12th byte - COMMAND-SPECIFIC INFORMATION field */ + uint8_t CmdSpecINFO[4]; + + /* 13th byte - ADDITIONAL SENSE CODE field */ + uint8_t AddSenseCode; + + /* 14th byte - ADDITIONAL SENSE CODE QUALIFIER field */ + uint8_t AddSnsCodeQlfr; + + /* 15th byte - FIELD REPLACEABLE UNIT CODE field */ + uint8_t FldReplUnitCode; + + /* 16th byte */ + uint8_t SenseKeySpec[3]; + #define SCSI_SENSE_SKSV 0x80 //!< Indicates the SENSE-KEY SPECIFIC field contains valid information }; COMPILER_PACK_RESET() /* Vital Product Data page codes */ enum scsi_vpd_page_code { - SCSI_VPD_SUPPORTED_PAGES = 0x00, - SCSI_VPD_UNIT_SERIAL_NUMBER = 0x80, - SCSI_VPD_DEVICE_IDENTIFICATION = 0x83, + SCSI_VPD_SUPPORTED_PAGES = 0x00, + SCSI_VPD_UNIT_SERIAL_NUMBER = 0x80, + SCSI_VPD_DEVICE_IDENTIFICATION = 0x83, }; #define SCSI_VPD_HEADER_SIZE 4 @@ -200,37 +200,36 @@ enum scsi_vpd_page_code { #define SCSI_VPD_ID_TYPE_T10 1 - /* Sense keys */ enum scsi_sense_key { - SCSI_SK_NO_SENSE = 0x0, - SCSI_SK_RECOVERED_ERROR = 0x1, - SCSI_SK_NOT_READY = 0x2, - SCSI_SK_MEDIUM_ERROR = 0x3, - SCSI_SK_HARDWARE_ERROR = 0x4, - SCSI_SK_ILLEGAL_REQUEST = 0x5, - SCSI_SK_UNIT_ATTENTION = 0x6, - SCSI_SK_DATA_PROTECT = 0x7, - SCSI_SK_BLANK_CHECK = 0x8, - SCSI_SK_VENDOR_SPECIFIC = 0x9, - SCSI_SK_COPY_ABORTED = 0xA, - SCSI_SK_ABORTED_COMMAND = 0xB, - SCSI_SK_VOLUME_OVERFLOW = 0xD, - SCSI_SK_MISCOMPARE = 0xE, + SCSI_SK_NO_SENSE = 0x0, + SCSI_SK_RECOVERED_ERROR = 0x1, + SCSI_SK_NOT_READY = 0x2, + SCSI_SK_MEDIUM_ERROR = 0x3, + SCSI_SK_HARDWARE_ERROR = 0x4, + SCSI_SK_ILLEGAL_REQUEST = 0x5, + SCSI_SK_UNIT_ATTENTION = 0x6, + SCSI_SK_DATA_PROTECT = 0x7, + SCSI_SK_BLANK_CHECK = 0x8, + SCSI_SK_VENDOR_SPECIFIC = 0x9, + SCSI_SK_COPY_ABORTED = 0xA, + SCSI_SK_ABORTED_COMMAND = 0xB, + SCSI_SK_VOLUME_OVERFLOW = 0xD, + SCSI_SK_MISCOMPARE = 0xE, }; /* Additional Sense Code / Additional Sense Code Qualifier pairs */ enum scsi_asc_ascq { - SCSI_ASC_NO_ADDITIONAL_SENSE_INFO = 0x0000, - SCSI_ASC_LU_NOT_READY_REBUILD_IN_PROGRESS = 0x0405, - SCSI_ASC_WRITE_ERROR = 0x0C00, - SCSI_ASC_UNRECOVERED_READ_ERROR = 0x1100, - SCSI_ASC_INVALID_COMMAND_OPERATION_CODE = 0x2000, - SCSI_ASC_INVALID_FIELD_IN_CDB = 0x2400, - SCSI_ASC_WRITE_PROTECTED = 0x2700, - SCSI_ASC_NOT_READY_TO_READY_CHANGE = 0x2800, - SCSI_ASC_MEDIUM_NOT_PRESENT = 0x3A00, - SCSI_ASC_INTERNAL_TARGET_FAILURE = 0x4400, + SCSI_ASC_NO_ADDITIONAL_SENSE_INFO = 0x0000, + SCSI_ASC_LU_NOT_READY_REBUILD_IN_PROGRESS = 0x0405, + SCSI_ASC_WRITE_ERROR = 0x0C00, + SCSI_ASC_UNRECOVERED_READ_ERROR = 0x1100, + SCSI_ASC_INVALID_COMMAND_OPERATION_CODE = 0x2000, + SCSI_ASC_INVALID_FIELD_IN_CDB = 0x2400, + SCSI_ASC_WRITE_PROTECTED = 0x2700, + SCSI_ASC_NOT_READY_TO_READY_CHANGE = 0x2800, + SCSI_ASC_MEDIUM_NOT_PRESENT = 0x3A00, + SCSI_ASC_INTERNAL_TARGET_FAILURE = 0x4400, }; /** @@ -240,9 +239,9 @@ enum scsi_asc_ascq { * that are applicable to all SCSI devices. */ enum scsi_spc_mode { - SCSI_MS_MODE_VENDOR_SPEC = 0x00, - SCSI_MS_MODE_INFEXP = 0x1C, // Informational exceptions control page - SCSI_MS_MODE_ALL = 0x3F, + SCSI_MS_MODE_VENDOR_SPEC = 0x00, + SCSI_MS_MODE_INFEXP = 0x1C, // Informational exceptions control page + SCSI_MS_MODE_ALL = 0x3F, }; /** @@ -250,51 +249,45 @@ enum scsi_spc_mode { * See chapter 8.3.8 */ struct spc_control_page_info_execpt { - uint8_t page_code; - uint8_t page_length; -#define SPC_MP_INFEXP_PAGE_LENGTH 0x0A - uint8_t flags1; -#define SPC_MP_INFEXP_PERF (1<<7) //!< Initiator Control -#define SPC_MP_INFEXP_EBF (1<<5) //!< Caching Analysis Permitted -#define SPC_MP_INFEXP_EWASC (1<<4) //!< Discontinuity -#define SPC_MP_INFEXP_DEXCPT (1<<3) //!< Size enable -#define SPC_MP_INFEXP_TEST (1<<2) //!< Writeback Cache Enable -#define SPC_MP_INFEXP_LOGERR (1<<0) //!< Log errors bit - uint8_t mrie; -#define SPC_MP_INFEXP_MRIE_NO_REPORT 0x00 -#define SPC_MP_INFEXP_MRIE_ASYNC_EVENT 0x01 -#define SPC_MP_INFEXP_MRIE_GEN_UNIT 0x02 -#define SPC_MP_INFEXP_MRIE_COND_RECOV_ERROR 0x03 -#define SPC_MP_INFEXP_MRIE_UNCOND_RECOV_ERROR 0x04 -#define SPC_MP_INFEXP_MRIE_NO_SENSE 0x05 -#define SPC_MP_INFEXP_MRIE_ONLY_REPORT 0x06 - be32_t interval_timer; - be32_t report_count; + uint8_t page_code; + uint8_t page_length; + #define SPC_MP_INFEXP_PAGE_LENGTH 0x0A + uint8_t flags1; + #define SPC_MP_INFEXP_PERF (1<<7) //!< Initiator Control + #define SPC_MP_INFEXP_EBF (1<<5) //!< Caching Analysis Permitted + #define SPC_MP_INFEXP_EWASC (1<<4) //!< Discontinuity + #define SPC_MP_INFEXP_DEXCPT (1<<3) //!< Size enable + #define SPC_MP_INFEXP_TEST (1<<2) //!< Writeback Cache Enable + #define SPC_MP_INFEXP_LOGERR (1<<0) //!< Log errors bit + uint8_t mrie; + #define SPC_MP_INFEXP_MRIE_NO_REPORT 0x00 + #define SPC_MP_INFEXP_MRIE_ASYNC_EVENT 0x01 + #define SPC_MP_INFEXP_MRIE_GEN_UNIT 0x02 + #define SPC_MP_INFEXP_MRIE_COND_RECOV_ERROR 0x03 + #define SPC_MP_INFEXP_MRIE_UNCOND_RECOV_ERROR 0x04 + #define SPC_MP_INFEXP_MRIE_NO_SENSE 0x05 + #define SPC_MP_INFEXP_MRIE_ONLY_REPORT 0x06 + be32_t interval_timer; + be32_t report_count; }; - enum scsi_spc_mode_sense_pc { - SCSI_MS_SENSE_PC_CURRENT = 0, - SCSI_MS_SENSE_PC_CHANGEABLE = 1, - SCSI_MS_SENSE_PC_DEFAULT = 2, - SCSI_MS_SENSE_PC_SAVED = 3, + SCSI_MS_SENSE_PC_CURRENT = 0, + SCSI_MS_SENSE_PC_CHANGEABLE = 1, + SCSI_MS_SENSE_PC_DEFAULT = 2, + SCSI_MS_SENSE_PC_SAVED = 3, }; - - -static inline bool scsi_mode_sense_dbd_is_set(const uint8_t * cdb) -{ - return (cdb[1] >> 3) & 1; +static inline bool scsi_mode_sense_dbd_is_set(const uint8_t * cdb) { + return (cdb[1] >> 3) & 1; } -static inline uint8_t scsi_mode_sense_get_page_code(const uint8_t * cdb) -{ - return cdb[2] & 0x3F; +static inline uint8_t scsi_mode_sense_get_page_code(const uint8_t * cdb) { + return cdb[2] & 0x3F; } -static inline uint8_t scsi_mode_sense_get_pc(const uint8_t * cdb) -{ - return cdb[2] >> 6; +static inline uint8_t scsi_mode_sense_get_pc(const uint8_t * cdb) { + return cdb[2] >> 6; } /** @@ -302,10 +295,10 @@ static inline uint8_t scsi_mode_sense_get_pc(const uint8_t * cdb) * SENSE(6) */ struct scsi_mode_param_header6 { - uint8_t mode_data_length; //!< Number of bytes after this - uint8_t medium_type; //!< Medium Type - uint8_t device_specific_parameter; //!< Defined by command set - uint8_t block_descriptor_length; //!< Length of block descriptors + uint8_t mode_data_length; //!< Number of bytes after this + uint8_t medium_type; //!< Medium Type + uint8_t device_specific_parameter; //!< Defined by command set + uint8_t block_descriptor_length; //!< Length of block descriptors }; /** @@ -313,23 +306,23 @@ struct scsi_mode_param_header6 { * SENSE(10) */ struct scsi_mode_param_header10 { - be16_t mode_data_length; //!< Number of bytes after this - uint8_t medium_type; //!< Medium Type - uint8_t device_specific_parameter; //!< Defined by command set - uint8_t flags4; //!< LONGLBA in bit 0 - uint8_t reserved; - be16_t block_descriptor_length; //!< Length of block descriptors + be16_t mode_data_length; //!< Number of bytes after this + uint8_t medium_type; //!< Medium Type + uint8_t device_specific_parameter; //!< Defined by command set + uint8_t flags4; //!< LONGLBA in bit 0 + uint8_t reserved; + be16_t block_descriptor_length; //!< Length of block descriptors }; /** * \brief SCSI Page_0 Mode Page header (SPF not set) */ struct scsi_mode_page_0_header { - uint8_t page_code; -#define SCSI_PAGE_CODE_PS (1 << 7) //!< Parameters Saveable -#define SCSI_PAGE_CODE_SPF (1 << 6) //!< SubPage Format - uint8_t page_length; //!< Number of bytes after this -#define SCSI_MS_PAGE_LEN(total) ((total) - 2) + uint8_t page_code; +#define SCSI_PAGE_CODE_PS (1 << 7) //!< Parameters Saveable +#define SCSI_PAGE_CODE_SPF (1 << 6) //!< SubPage Format + uint8_t page_length; //!< Number of bytes after this +#define SCSI_MS_PAGE_LEN(total) ((total) - 2) }; //@} diff --git a/Marlin/src/HAL/DUE/usb/sysclk.h b/Marlin/src/HAL/DUE/usb/sysclk.h index 16db8c86d3737..0623378615024 100644 --- a/Marlin/src/HAL/DUE/usb/sysclk.h +++ b/Marlin/src/HAL/DUE/usb/sysclk.h @@ -71,7 +71,7 @@ * \subsection sysclk_quickstart_use_case_1_setup_steps Initialization code * Add to the application initialization code: * \code - sysclk_init(); + sysclk_init(); \endcode * * \subsection sysclk_quickstart_use_case_1_setup_steps_workflow Workflow @@ -82,15 +82,15 @@ * Add or uncomment the following in your conf_clock.h header file, commenting out all other * definitions of the same symbol(s): * \code - #define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_PLLACK + #define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_PLLACK - // Fpll0 = (Fclk * PLL_mul) / PLL_div - #define CONFIG_PLL0_SOURCE PLL_SRC_MAINCK_XTAL - #define CONFIG_PLL0_MUL (84000000UL / BOARD_FREQ_MAINCK_XTAL) - #define CONFIG_PLL0_DIV 1 + // Fpll0 = (Fclk * PLL_mul) / PLL_div + #define CONFIG_PLL0_SOURCE PLL_SRC_MAINCK_XTAL + #define CONFIG_PLL0_MUL (84000000UL / BOARD_FREQ_MAINCK_XTAL) + #define CONFIG_PLL0_DIV 1 - // Fbus = Fsys / BUS_div - #define CONFIG_SYSCLK_PRES SYSCLK_PRES_1 + // Fbus = Fsys / BUS_div + #define CONFIG_SYSCLK_PRES SYSCLK_PRES_1 \endcode * * \subsection sysclk_quickstart_use_case_1_example_workflow Workflow @@ -100,14 +100,14 @@ * \code #define CONFIG_PLL0_SOURCE PLL_SRC_MAINCK_XTAL \endcode * -# Configure the PLL module to multiply the external fast crystal oscillator frequency up to 84MHz: * \code - #define CONFIG_PLL0_MUL (84000000UL / BOARD_FREQ_MAINCK_XTAL) - #define CONFIG_PLL0_DIV 1 + #define CONFIG_PLL0_MUL (84000000UL / BOARD_FREQ_MAINCK_XTAL) + #define CONFIG_PLL0_DIV 1 \endcode * \note For user boards, \c BOARD_FREQ_MAINCK_XTAL should be defined in the board \c conf_board.h configuration * file as the frequency of the fast crystal attached to the microcontroller. * -# Configure the main clock to run at the full 84MHz, disable scaling of the main system clock speed: * \code - #define CONFIG_SYSCLK_PRES SYSCLK_PRES_1 + #define CONFIG_SYSCLK_PRES SYSCLK_PRES_1 \endcode * \note Some dividers are powers of two, while others are integer division factors. Refer to the * formulas in the conf_clock.h template commented above each division define. @@ -136,7 +136,7 @@ extern "C" { * initialization. */ #ifndef CONFIG_SYSCLK_SOURCE -# define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_MAINCK_4M_RC + #define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_MAINCK_4M_RC #endif /** * \def CONFIG_SYSCLK_PRES @@ -149,7 +149,7 @@ extern "C" { * after initialization. */ #ifndef CONFIG_SYSCLK_PRES -# define CONFIG_SYSCLK_PRES 0 + #define CONFIG_SYSCLK_PRES 0 #endif //@} @@ -197,7 +197,7 @@ extern "C" { * USB is not required. */ #ifdef __DOXYGEN__ -# define CONFIG_USBCLK_SOURCE + #define CONFIG_USBCLK_SOURCE #endif /** @@ -209,7 +209,7 @@ extern "C" { * defined. */ #ifdef __DOXYGEN__ -# define CONFIG_USBCLK_DIV + #define CONFIG_USBCLK_DIV #endif diff --git a/Marlin/src/HAL/DUE/usb/udc.h b/Marlin/src/HAL/DUE/usb/udc.h index 8d92eb5c038ad..6230a81b359c2 100644 --- a/Marlin/src/HAL/DUE/usb/udc.h +++ b/Marlin/src/HAL/DUE/usb/udc.h @@ -144,15 +144,15 @@ extern "C" { * \code #define USB_DEVICE_ATTACH_AUTO_DISABLE \endcode * User C file contains: * \code - // Authorize VBUS monitoring - if (!udc_include_vbus_monitoring()) { - // Implement custom VBUS monitoring via GPIO or other - } - Event_VBUS_present() // VBUS interrupt or GPIO interrupt or other - { - // Attach USB Device - udc_attach(); - } + // Authorize VBUS monitoring + if (!udc_include_vbus_monitoring()) { + // Implement custom VBUS monitoring via GPIO or other + } + Event_VBUS_present() // VBUS interrupt or GPIO interrupt or other + { + // Attach USB Device + udc_attach(); + } \endcode * * - Case of battery charging. conf_usb.h file contains define @@ -160,21 +160,20 @@ extern "C" { * \code #define USB_DEVICE_ATTACH_AUTO_DISABLE \endcode * User C file contains: * \code - Event VBUS present() // VBUS interrupt or GPIO interrupt or .. - { - // Authorize battery charging, but wait key press to start USB. - } - Event Key press() - { - // Stop batteries charging - // Start USB - udc_attach(); - } + Event VBUS present() // VBUS interrupt or GPIO interrupt or .. + { + // Authorize battery charging, but wait key press to start USB. + } + Event Key press() + { + // Stop batteries charging + // Start USB + udc_attach(); + } \endcode */ -static inline bool udc_include_vbus_monitoring(void) -{ - return udd_include_vbus_monitoring(); +static inline bool udc_include_vbus_monitoring(void) { + return udd_include_vbus_monitoring(); } /*! \brief Start the USB Device stack @@ -192,32 +191,26 @@ void udc_stop(void); * then it will attach device when an acceptable Vbus * level from the host is detected. */ -static inline void udc_attach(void) -{ - udd_attach(); +static inline void udc_attach(void) { + udd_attach(); } - /** * \brief Detaches the device from the bus * * The driver must remove pull-up on USB line D- or D+. */ -static inline void udc_detach(void) -{ - udd_detach(); +static inline void udc_detach(void) { + udd_detach(); } - /*! \brief The USB driver sends a resume signal called \e "Upstream Resume" * This is authorized only when the remote wakeup feature is enabled by host. */ -static inline void udc_remotewakeup(void) -{ - udd_send_remotewakeup(); +static inline void udc_remotewakeup(void) { + udd_send_remotewakeup(); } - /** * \brief Returns a pointer on the current interface descriptor * @@ -296,23 +289,23 @@ usb_iface_desc_t UDC_DESC_STORAGE *udc_get_interface_desc(void); * * for AVR and SAM3/4 devices, add to the initialization code: * \code - sysclk_init(); - irq_initialize_vectors(); - cpu_irq_enable(); - board_init(); - sleepmgr_init(); // Optional + sysclk_init(); + irq_initialize_vectors(); + cpu_irq_enable(); + board_init(); + sleepmgr_init(); // Optional \endcode * * For SAMD devices, add to the initialization code: * \code - system_init(); - irq_initialize_vectors(); - cpu_irq_enable(); - sleepmgr_init(); // Optional + system_init(); + irq_initialize_vectors(); + cpu_irq_enable(); + sleepmgr_init(); // Optional \endcode * Add to the main IDLE loop: * \code - sleepmgr_enter_sleep(); // Optional + sleepmgr_enter_sleep(); // Optional \endcode * */ @@ -324,20 +317,20 @@ usb_iface_desc_t UDC_DESC_STORAGE *udc_get_interface_desc(void); * * Content of conf_usb.h: * \code - #define USB_DEVICE_VENDOR_ID 0x03EB - #define USB_DEVICE_PRODUCT_ID 0xXXXX - #define USB_DEVICE_MAJOR_VERSION 1 - #define USB_DEVICE_MINOR_VERSION 0 - #define USB_DEVICE_POWER 100 - #define USB_DEVICE_ATTR USB_CONFIG_ATTR_BUS_POWERED + #define USB_DEVICE_VENDOR_ID 0x03EB + #define USB_DEVICE_PRODUCT_ID 0xXXXX + #define USB_DEVICE_MAJOR_VERSION 1 + #define USB_DEVICE_MINOR_VERSION 0 + #define USB_DEVICE_POWER 100 + #define USB_DEVICE_ATTR USB_CONFIG_ATTR_BUS_POWERED \endcode * * Add to application C-file: * \code - void usb_init(void) - { - udc_start(); - } + void usb_init(void) + { + udc_start(); + } \endcode */ @@ -349,17 +342,17 @@ usb_iface_desc_t UDC_DESC_STORAGE *udc_get_interface_desc(void); * -# Ensure that conf_usb.h is available and contains the following configuration * which is the main USB device configuration: * - \code // Vendor ID provided by USB org (ATMEL 0x03EB) - #define USB_DEVICE_VENDOR_ID 0x03EB // Type Word - // Product ID (Atmel PID referenced in usb_atmel.h) - #define USB_DEVICE_PRODUCT_ID 0xXXXX // Type Word - // Major version of the device - #define USB_DEVICE_MAJOR_VERSION 1 // Type Byte - // Minor version of the device - #define USB_DEVICE_MINOR_VERSION 0 // Type Byte - // Maximum device power (mA) - #define USB_DEVICE_POWER 100 // Type 9-bits - // USB attributes to enable features - #define USB_DEVICE_ATTR USB_CONFIG_ATTR_BUS_POWERED // Flags \endcode + #define USB_DEVICE_VENDOR_ID 0x03EB // Type Word + // Product ID (Atmel PID referenced in usb_atmel.h) + #define USB_DEVICE_PRODUCT_ID 0xXXXX // Type Word + // Major version of the device + #define USB_DEVICE_MAJOR_VERSION 1 // Type Byte + // Minor version of the device + #define USB_DEVICE_MINOR_VERSION 0 // Type Byte + // Maximum device power (mA) + #define USB_DEVICE_POWER 100 // Type 9-bits + // USB attributes to enable features + #define USB_DEVICE_ATTR USB_CONFIG_ATTR_BUS_POWERED // Flags \endcode * -# Call the USB device stack start function to enable stack and start USB: * - \code udc_start(); \endcode * \note In case of USB dual roles (Device and Host) managed through USB OTG connector @@ -372,90 +365,90 @@ usb_iface_desc_t UDC_DESC_STORAGE *udc_get_interface_desc(void); * * Content of XMEGA conf_clock.h: * \code - // Configuration based on internal RC: - // USB clock need of 48Mhz - #define CONFIG_USBCLK_SOURCE USBCLK_SRC_RCOSC - #define CONFIG_OSC_RC32_CAL 48000000UL - #define CONFIG_OSC_AUTOCAL_RC32MHZ_REF_OSC OSC_ID_USBSOF - // CPU clock need of clock > 12MHz to run with USB (Here 24MHz) - #define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_RC32MHZ - #define CONFIG_SYSCLK_PSADIV SYSCLK_PSADIV_2 - #define CONFIG_SYSCLK_PSBCDIV SYSCLK_PSBCDIV_1_1 + // Configuration based on internal RC: + // USB clock need of 48Mhz + #define CONFIG_USBCLK_SOURCE USBCLK_SRC_RCOSC + #define CONFIG_OSC_RC32_CAL 48000000UL + #define CONFIG_OSC_AUTOCAL_RC32MHZ_REF_OSC OSC_ID_USBSOF + // CPU clock need of clock > 12MHz to run with USB (Here 24MHz) + #define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_RC32MHZ + #define CONFIG_SYSCLK_PSADIV SYSCLK_PSADIV_2 + #define CONFIG_SYSCLK_PSBCDIV SYSCLK_PSBCDIV_1_1 \endcode * * Content of conf_clock.h for AT32UC3A0, AT32UC3A1, AT32UC3B devices (USBB): * \code - // Configuration based on 12MHz external OSC: - #define CONFIG_PLL1_SOURCE PLL_SRC_OSC0 - #define CONFIG_PLL1_MUL 8 - #define CONFIG_PLL1_DIV 2 - #define CONFIG_USBCLK_SOURCE USBCLK_SRC_PLL1 - #define CONFIG_USBCLK_DIV 1 // Fusb = Fsys/(2 ^ USB_div) + // Configuration based on 12MHz external OSC: + #define CONFIG_PLL1_SOURCE PLL_SRC_OSC0 + #define CONFIG_PLL1_MUL 8 + #define CONFIG_PLL1_DIV 2 + #define CONFIG_USBCLK_SOURCE USBCLK_SRC_PLL1 + #define CONFIG_USBCLK_DIV 1 // Fusb = Fsys/(2 ^ USB_div) \endcode * * Content of conf_clock.h for AT32UC3A3, AT32UC3A4 devices (USBB with high speed support): * \code - // Configuration based on 12MHz external OSC: - #define CONFIG_USBCLK_SOURCE USBCLK_SRC_OSC0 - #define CONFIG_USBCLK_DIV 1 // Fusb = Fsys/(2 ^ USB_div) + // Configuration based on 12MHz external OSC: + #define CONFIG_USBCLK_SOURCE USBCLK_SRC_OSC0 + #define CONFIG_USBCLK_DIV 1 // Fusb = Fsys/(2 ^ USB_div) \endcode * * Content of conf_clock.h for AT32UC3C, ATUCXXD, ATUCXXL3U, ATUCXXL4U devices (USBC): * \code - // Configuration based on 12MHz external OSC: - #define CONFIG_PLL1_SOURCE PLL_SRC_OSC0 - #define CONFIG_PLL1_MUL 8 - #define CONFIG_PLL1_DIV 2 - #define CONFIG_USBCLK_SOURCE USBCLK_SRC_PLL1 - #define CONFIG_USBCLK_DIV 1 // Fusb = Fsys/(2 ^ USB_div) - // CPU clock need of clock > 25MHz to run with USBC - #define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_PLL1 + // Configuration based on 12MHz external OSC: + #define CONFIG_PLL1_SOURCE PLL_SRC_OSC0 + #define CONFIG_PLL1_MUL 8 + #define CONFIG_PLL1_DIV 2 + #define CONFIG_USBCLK_SOURCE USBCLK_SRC_PLL1 + #define CONFIG_USBCLK_DIV 1 // Fusb = Fsys/(2 ^ USB_div) + // CPU clock need of clock > 25MHz to run with USBC + #define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_PLL1 \endcode * * Content of conf_clock.h for SAM3S, SAM3SD, SAM4S devices (UPD: USB Peripheral Device): * \code - // PLL1 (B) Options (Fpll = (Fclk * PLL_mul) / PLL_div) - #define CONFIG_PLL1_SOURCE PLL_SRC_MAINCK_XTAL - #define CONFIG_PLL1_MUL 16 - #define CONFIG_PLL1_DIV 2 - // USB Clock Source Options (Fusb = FpllX / USB_div) - #define CONFIG_USBCLK_SOURCE USBCLK_SRC_PLL1 - #define CONFIG_USBCLK_DIV 2 + // PLL1 (B) Options (Fpll = (Fclk * PLL_mul) / PLL_div) + #define CONFIG_PLL1_SOURCE PLL_SRC_MAINCK_XTAL + #define CONFIG_PLL1_MUL 16 + #define CONFIG_PLL1_DIV 2 + // USB Clock Source Options (Fusb = FpllX / USB_div) + #define CONFIG_USBCLK_SOURCE USBCLK_SRC_PLL1 + #define CONFIG_USBCLK_DIV 2 \endcode * * Content of conf_clock.h for SAM3U device (UPDHS: USB Peripheral Device High Speed): * \code - // USB Clock Source fixed at UPLL. + // USB Clock Source fixed at UPLL. \endcode * * Content of conf_clock.h for SAM3X, SAM3A devices (UOTGHS: USB OTG High Speed): * \code - // USB Clock Source fixed at UPLL. - #define CONFIG_USBCLK_SOURCE USBCLK_SRC_UPLL - #define CONFIG_USBCLK_DIV 1 + // USB Clock Source fixed at UPLL. + #define CONFIG_USBCLK_SOURCE USBCLK_SRC_UPLL + #define CONFIG_USBCLK_DIV 1 \endcode * * Content of conf_clocks.h for SAMD devices (USB): * \code - // System clock bus configuration - # define CONF_CLOCK_FLASH_WAIT_STATES 2 - - // USB Clock Source fixed at DFLL. - // SYSTEM_CLOCK_SOURCE_DFLL configuration - Digital Frequency Locked Loop - # define CONF_CLOCK_DFLL_ENABLE true - # define CONF_CLOCK_DFLL_LOOP_MODE SYSTEM_CLOCK_DFLL_LOOP_MODE_USB_RECOVERY - # define CONF_CLOCK_DFLL_ON_DEMAND true - - // Set this to true to configure the GCLK when running clocks_init. - // If set to false, none of the GCLK generators will be configured in clocks_init(). - # define CONF_CLOCK_CONFIGURE_GCLK true - - // Configure GCLK generator 0 (Main Clock) - # define CONF_CLOCK_GCLK_0_ENABLE true - # define CONF_CLOCK_GCLK_0_RUN_IN_STANDBY true - # define CONF_CLOCK_GCLK_0_CLOCK_SOURCE SYSTEM_CLOCK_SOURCE_DFLL - # define CONF_CLOCK_GCLK_0_PRESCALER 1 - # define CONF_CLOCK_GCLK_0_OUTPUT_ENABLE false + // System clock bus configuration + # define CONF_CLOCK_FLASH_WAIT_STATES 2 + + // USB Clock Source fixed at DFLL. + // SYSTEM_CLOCK_SOURCE_DFLL configuration - Digital Frequency Locked Loop + # define CONF_CLOCK_DFLL_ENABLE true + # define CONF_CLOCK_DFLL_LOOP_MODE SYSTEM_CLOCK_DFLL_LOOP_MODE_USB_RECOVERY + # define CONF_CLOCK_DFLL_ON_DEMAND true + + // Set this to true to configure the GCLK when running clocks_init. + // If set to false, none of the GCLK generators will be configured in clocks_init(). + # define CONF_CLOCK_CONFIGURE_GCLK true + + // Configure GCLK generator 0 (Main Clock) + # define CONF_CLOCK_GCLK_0_ENABLE true + # define CONF_CLOCK_GCLK_0_RUN_IN_STANDBY true + # define CONF_CLOCK_GCLK_0_CLOCK_SOURCE SYSTEM_CLOCK_SOURCE_DFLL + # define CONF_CLOCK_GCLK_0_PRESCALER 1 + # define CONF_CLOCK_GCLK_0_OUTPUT_ENABLE false \endcode */ @@ -474,34 +467,34 @@ usb_iface_desc_t UDC_DESC_STORAGE *udc_get_interface_desc(void); * \subsection udc_use_case_1_usage_code Example code * Content of conf_usb.h: * \code - #if // Low speed - #define USB_DEVICE_LOW_SPEED - // #define USB_DEVICE_HS_SUPPORT + #if // Low speed + #define USB_DEVICE_LOW_SPEED + // #define USB_DEVICE_HS_SUPPORT - #elif // Full speed - // #define USB_DEVICE_LOW_SPEED - // #define USB_DEVICE_HS_SUPPORT + #elif // Full speed + // #define USB_DEVICE_LOW_SPEED + // #define USB_DEVICE_HS_SUPPORT - #elif // High speed - // #define USB_DEVICE_LOW_SPEED - #define USB_DEVICE_HS_SUPPORT + #elif // High speed + // #define USB_DEVICE_LOW_SPEED + #define USB_DEVICE_HS_SUPPORT - #endif + #endif \endcode * * \subsection udc_use_case_1_usage_flow Workflow * -# Ensure that conf_usb.h is available and contains the following parameters * required for a USB device low speed (1.5Mbit/s): * - \code #define USB_DEVICE_LOW_SPEED - //#define USB_DEVICE_HS_SUPPORT \endcode + //#define USB_DEVICE_HS_SUPPORT \endcode * -# Ensure that conf_usb.h contains the following parameters * required for a USB device full speed (12Mbit/s): * - \code //#define USB_DEVICE_LOW_SPEED - //#define USB_DEVICE_HS_SUPPORT \endcode + //#define USB_DEVICE_HS_SUPPORT \endcode * -# Ensure that conf_usb.h contains the following parameters * required for a USB device high speed (480Mbit/s): * - \code //#define USB_DEVICE_LOW_SPEED - #define USB_DEVICE_HS_SUPPORT \endcode + #define USB_DEVICE_HS_SUPPORT \endcode */ /** @@ -518,20 +511,20 @@ usb_iface_desc_t UDC_DESC_STORAGE *udc_get_interface_desc(void); * \subsection udc_use_case_2_usage_code Example code * Content of conf_usb.h: * \code - #define USB_DEVICE_MANUFACTURE_NAME "Manufacture name" - #define USB_DEVICE_PRODUCT_NAME "Product name" - #define USB_DEVICE_SERIAL_NAME "12...EF" + #define USB_DEVICE_MANUFACTURE_NAME "Manufacture name" + #define USB_DEVICE_PRODUCT_NAME "Product name" + #define USB_DEVICE_SERIAL_NAME "12...EF" \endcode * * \subsection udc_use_case_2_usage_flow Workflow * -# Ensure that conf_usb.h is available and contains the following parameters * required to enable different USB strings: * - \code // Static ASCII name for the manufacture - #define USB_DEVICE_MANUFACTURE_NAME "Manufacture name" \endcode + #define USB_DEVICE_MANUFACTURE_NAME "Manufacture name" \endcode * - \code // Static ASCII name for the product - #define USB_DEVICE_PRODUCT_NAME "Product name" \endcode + #define USB_DEVICE_PRODUCT_NAME "Product name" \endcode * - \code // Static ASCII name to enable and set a serial number - #define USB_DEVICE_SERIAL_NAME "12...EF" \endcode + #define USB_DEVICE_SERIAL_NAME "12...EF" \endcode */ /** @@ -548,42 +541,42 @@ usb_iface_desc_t UDC_DESC_STORAGE *udc_get_interface_desc(void); * \subsection udc_use_case_3_usage_code Example code * Content of conf_usb.h: * \code - #define USB_DEVICE_ATTR \ - (USB_CONFIG_ATTR_REMOTE_WAKEUP | USB_CONFIG_ATTR_..._POWERED) - #define UDC_REMOTEWAKEUP_ENABLE() my_callback_remotewakeup_enable() - extern void my_callback_remotewakeup_enable(void); - #define UDC_REMOTEWAKEUP_DISABLE() my_callback_remotewakeup_disable() - extern void my_callback_remotewakeup_disable(void); + #define USB_DEVICE_ATTR \ + (USB_CONFIG_ATTR_REMOTE_WAKEUP | USB_CONFIG_ATTR_..._POWERED) + #define UDC_REMOTEWAKEUP_ENABLE() my_callback_remotewakeup_enable() + extern void my_callback_remotewakeup_enable(void); + #define UDC_REMOTEWAKEUP_DISABLE() my_callback_remotewakeup_disable() + extern void my_callback_remotewakeup_disable(void); \endcode * * Add to application C-file: * \code - void my_callback_remotewakeup_enable(void) - { - // Enable application wakeup events (e.g. enable GPIO interrupt) - } - void my_callback_remotewakeup_disable(void) - { - // Disable application wakeup events (e.g. disable GPIO interrupt) - } - - void my_interrupt_event(void) - { - udc_remotewakeup(); - } + void my_callback_remotewakeup_enable(void) + { + // Enable application wakeup events (e.g. enable GPIO interrupt) + } + void my_callback_remotewakeup_disable(void) + { + // Disable application wakeup events (e.g. disable GPIO interrupt) + } + + void my_interrupt_event(void) + { + udc_remotewakeup(); + } \endcode * * \subsection udc_use_case_3_usage_flow Workflow * -# Ensure that conf_usb.h is available and contains the following parameters * required to enable remote wakeup feature: * - \code // Authorizes the remote wakeup feature - #define USB_DEVICE_ATTR (USB_CONFIG_ATTR_REMOTE_WAKEUP | USB_CONFIG_ATTR_..._POWERED) \endcode + #define USB_DEVICE_ATTR (USB_CONFIG_ATTR_REMOTE_WAKEUP | USB_CONFIG_ATTR_..._POWERED) \endcode * - \code // Define callback called when the host enables the remotewakeup feature - #define UDC_REMOTEWAKEUP_ENABLE() my_callback_remotewakeup_enable() - extern void my_callback_remotewakeup_enable(void); \endcode + #define UDC_REMOTEWAKEUP_ENABLE() my_callback_remotewakeup_enable() + extern void my_callback_remotewakeup_enable(void); \endcode * - \code // Define callback called when the host disables the remotewakeup feature - #define UDC_REMOTEWAKEUP_DISABLE() my_callback_remotewakeup_disable() - extern void my_callback_remotewakeup_disable(void); \endcode + #define UDC_REMOTEWAKEUP_DISABLE() my_callback_remotewakeup_disable() + extern void my_callback_remotewakeup_disable(void); \endcode * -# Send a remote wakeup (USB upstream): * - \code udc_remotewakeup(); \endcode */ @@ -603,40 +596,40 @@ usb_iface_desc_t UDC_DESC_STORAGE *udc_get_interface_desc(void); * \subsection udc_use_case_5_usage_code Example code * Content of conf_usb.h: * \code - #define USB_DEVICE_ATTR (USB_CONFIG_ATTR_BUS_POWERED) - #define UDC_SUSPEND_EVENT() user_callback_suspend_action() - extern void user_callback_suspend_action(void) - #define UDC_RESUME_EVENT() user_callback_resume_action() - extern void user_callback_resume_action(void) + #define USB_DEVICE_ATTR (USB_CONFIG_ATTR_BUS_POWERED) + #define UDC_SUSPEND_EVENT() user_callback_suspend_action() + extern void user_callback_suspend_action(void) + #define UDC_RESUME_EVENT() user_callback_resume_action() + extern void user_callback_resume_action(void) \endcode * * Add to application C-file: * \code - void user_callback_suspend_action(void) - { - // Disable hardware component to reduce power consumption - } - void user_callback_resume_action(void) - { - // Re-enable hardware component - } + void user_callback_suspend_action(void) + { + // Disable hardware component to reduce power consumption + } + void user_callback_resume_action(void) + { + // Re-enable hardware component + } \endcode * * \subsection udc_use_case_5_usage_flow Workflow * -# Ensure that conf_usb.h is available and contains the following parameters: * - \code // Authorizes the BUS power feature - #define USB_DEVICE_ATTR (USB_CONFIG_ATTR_BUS_POWERED) \endcode + #define USB_DEVICE_ATTR (USB_CONFIG_ATTR_BUS_POWERED) \endcode * - \code // Define callback called when the host suspend the USB line - #define UDC_SUSPEND_EVENT() user_callback_suspend_action() - extern void user_callback_suspend_action(void); \endcode + #define UDC_SUSPEND_EVENT() user_callback_suspend_action() + extern void user_callback_suspend_action(void); \endcode * - \code // Define callback called when the host or device resume the USB line - #define UDC_RESUME_EVENT() user_callback_resume_action() - extern void user_callback_resume_action(void); \endcode + #define UDC_RESUME_EVENT() user_callback_resume_action() + extern void user_callback_resume_action(void); \endcode * -# Reduce power consumption in suspend mode (max. 2.5mA on Vbus): * - \code void user_callback_suspend_action(void) - { - turn_off_components(); - } \endcode + { + turn_off_components(); + } \endcode */ /** @@ -654,42 +647,42 @@ usb_iface_desc_t UDC_DESC_STORAGE *udc_get_interface_desc(void); * \subsection udc_use_case_6_usage_code Example code * Content of conf_usb.h: * \code - #define USB_DEVICE_SERIAL_NAME - #define USB_DEVICE_GET_SERIAL_NAME_POINTER serial_number - #define USB_DEVICE_GET_SERIAL_NAME_LENGTH 12 - extern uint8_t serial_number[]; + #define USB_DEVICE_SERIAL_NAME + #define USB_DEVICE_GET_SERIAL_NAME_POINTER serial_number + #define USB_DEVICE_GET_SERIAL_NAME_LENGTH 12 + extern uint8_t serial_number[]; \endcode * * Add to application C-file: * \code - uint8_t serial_number[USB_DEVICE_GET_SERIAL_NAME_LENGTH]; + uint8_t serial_number[USB_DEVICE_GET_SERIAL_NAME_LENGTH]; - void init_build_usb_serial_number(void) - { - serial_number[0] = 'A'; - serial_number[1] = 'B'; - ... - serial_number[USB_DEVICE_GET_SERIAL_NAME_LENGTH-1] = 'C'; - } \endcode + void init_build_usb_serial_number(void) + { + serial_number[0] = 'A'; + serial_number[1] = 'B'; + ... + serial_number[USB_DEVICE_GET_SERIAL_NAME_LENGTH-1] = 'C'; + } \endcode * * \subsection udc_use_case_6_usage_flow Workflow * -# Ensure that conf_usb.h is available and contains the following parameters * required to enable a USB serial number strings dynamically: * - \code #define USB_DEVICE_SERIAL_NAME // Define this empty - #define USB_DEVICE_GET_SERIAL_NAME_POINTER serial_number // Give serial array pointer - #define USB_DEVICE_GET_SERIAL_NAME_LENGTH 12 // Give size of serial array - extern uint8_t serial_number[]; // Declare external serial array \endcode + #define USB_DEVICE_GET_SERIAL_NAME_POINTER serial_number // Give serial array pointer + #define USB_DEVICE_GET_SERIAL_NAME_LENGTH 12 // Give size of serial array + extern uint8_t serial_number[]; // Declare external serial array \endcode * -# Before start USB stack, initialize the serial array * - \code - uint8_t serial_number[USB_DEVICE_GET_SERIAL_NAME_LENGTH]; - - void init_build_usb_serial_number(void) - { - serial_number[0] = 'A'; - serial_number[1] = 'B'; - ... - serial_number[USB_DEVICE_GET_SERIAL_NAME_LENGTH-1] = 'C'; - } \endcode + uint8_t serial_number[USB_DEVICE_GET_SERIAL_NAME_LENGTH]; + + void init_build_usb_serial_number(void) + { + serial_number[0] = 'A'; + serial_number[1] = 'B'; + ... + serial_number[USB_DEVICE_GET_SERIAL_NAME_LENGTH-1] = 'C'; + } \endcode */ diff --git a/Marlin/src/HAL/DUE/usb/udc_desc.h b/Marlin/src/HAL/DUE/usb/udc_desc.h index 052ca08eca78b..f1f328d035c34 100644 --- a/Marlin/src/HAL/DUE/usb/udc_desc.h +++ b/Marlin/src/HAL/DUE/usb/udc_desc.h @@ -78,50 +78,47 @@ extern "C" { * For Mega application used "code". */ #define UDC_DESC_STORAGE - // Descriptor storage in internal RAM + // Descriptor storage in internal RAM #if (defined UDC_DATA_USE_HRAM_SUPPORT) -# if defined(__GNUC__) -# define UDC_DATA(x) COMPILER_WORD_ALIGNED __attribute__((__section__(".data_hram0"))) -# define UDC_BSS(x) COMPILER_ALIGNED(x) __attribute__((__section__(".bss_hram0"))) -# elif defined(__ICCAVR32__) -# define UDC_DATA(x) COMPILER_ALIGNED(x) __data32 -# define UDC_BSS(x) COMPILER_ALIGNED(x) __data32 -# endif + #if defined(__GNUC__) + #define UDC_DATA(x) COMPILER_WORD_ALIGNED __attribute__((__section__(".data_hram0"))) + #define UDC_BSS(x) COMPILER_ALIGNED(x) __attribute__((__section__(".bss_hram0"))) +#elif defined(__ICCAVR32__) + #define UDC_DATA(x) COMPILER_ALIGNED(x) __data32 + #define UDC_BSS(x) COMPILER_ALIGNED(x) __data32 +#endif #else -# define UDC_DATA(x) COMPILER_ALIGNED(x) -# define UDC_BSS(x) COMPILER_ALIGNED(x) + #define UDC_DATA(x) COMPILER_ALIGNED(x) + #define UDC_BSS(x) COMPILER_ALIGNED(x) #endif - - /** * \brief Configuration descriptor and UDI link for one USB speed */ typedef struct { - //! USB configuration descriptor - usb_conf_desc_t UDC_DESC_STORAGE *desc; - //! Array of UDI API pointer - udi_api_t UDC_DESC_STORAGE *UDC_DESC_STORAGE * udi_apis; + //! USB configuration descriptor + usb_conf_desc_t UDC_DESC_STORAGE *desc; + //! Array of UDI API pointer + udi_api_t UDC_DESC_STORAGE *UDC_DESC_STORAGE * udi_apis; } udc_config_speed_t; - /** * \brief All information about the USB Device */ typedef struct { - //! USB device descriptor for low or full speed - usb_dev_desc_t UDC_DESC_STORAGE *confdev_lsfs; - //! USB configuration descriptor and UDI API pointers for low or full speed - udc_config_speed_t UDC_DESC_STORAGE *conf_lsfs; -#ifdef USB_DEVICE_HS_SUPPORT - //! USB device descriptor for high speed - usb_dev_desc_t UDC_DESC_STORAGE *confdev_hs; - //! USB device qualifier, only use in high speed mode - usb_dev_qual_desc_t UDC_DESC_STORAGE *qualifier; - //! USB configuration descriptor and UDI API pointers for high speed - udc_config_speed_t UDC_DESC_STORAGE *conf_hs; -#endif - usb_dev_bos_desc_t UDC_DESC_STORAGE *conf_bos; + //! USB device descriptor for low or full speed + usb_dev_desc_t UDC_DESC_STORAGE *confdev_lsfs; + //! USB configuration descriptor and UDI API pointers for low or full speed + udc_config_speed_t UDC_DESC_STORAGE *conf_lsfs; + #ifdef USB_DEVICE_HS_SUPPORT + //! USB device descriptor for high speed + usb_dev_desc_t UDC_DESC_STORAGE *confdev_hs; + //! USB device qualifier, only use in high speed mode + usb_dev_qual_desc_t UDC_DESC_STORAGE *qualifier; + //! USB configuration descriptor and UDI API pointers for high speed + udc_config_speed_t UDC_DESC_STORAGE *conf_hs; + #endif + usb_dev_bos_desc_t UDC_DESC_STORAGE *conf_bos; } udc_config_t; //! Global variables of USB Device Descriptor and UDI links diff --git a/Marlin/src/HAL/DUE/usb/udd.h b/Marlin/src/HAL/DUE/usb/udd.h index 319d8842f7444..6eda465e54a44 100644 --- a/Marlin/src/HAL/DUE/usb/udd.h +++ b/Marlin/src/HAL/DUE/usb/udd.h @@ -71,8 +71,8 @@ typedef uint8_t udd_ep_id_t; //! \brief Endpoint transfer status //! Returned in parameters of callback register via udd_ep_run routine. typedef enum { - UDD_EP_TRANSFER_OK = 0, - UDD_EP_TRANSFER_ABORT = 1, + UDD_EP_TRANSFER_OK = 0, + UDD_EP_TRANSFER_ABORT = 1, } udd_ep_status_t; /** @@ -82,41 +82,37 @@ typedef enum { * It can be updated by udc_process_setup() from UDC or *setup() from UDIs. */ typedef struct { - //! Data received in USB SETUP packet - //! Note: The swap of "req.wValues" from uin16_t to le16_t is done by UDD. - usb_setup_req_t req; + //! Data received in USB SETUP packet + //! Note: The swap of "req.wValues" from uin16_t to le16_t is done by UDD. + usb_setup_req_t req; - //! Point to buffer to send or fill with data following SETUP packet - //! This buffer must be word align for DATA IN phase (use prefix COMPILER_WORD_ALIGNED for buffer) - uint8_t *payload; + //! Point to buffer to send or fill with data following SETUP packet + //! This buffer must be word align for DATA IN phase (use prefix COMPILER_WORD_ALIGNED for buffer) + uint8_t *payload; - //! Size of buffer to send or fill, and content the number of byte transferred - uint16_t payload_size; + //! Size of buffer to send or fill, and content the number of byte transferred + uint16_t payload_size; - //! Callback called after reception of ZLP from setup request - void (*callback)(void); + //! Callback called after reception of ZLP from setup request + void (*callback)(void); - //! Callback called when the buffer given (.payload) is full or empty. - //! This one return false to abort data transfer, or true with a new buffer in .payload. - bool (*over_under_run)(void); + //! Callback called when the buffer given (.payload) is full or empty. + //! This one return false to abort data transfer, or true with a new buffer in .payload. + bool (*over_under_run)(void); } udd_ctrl_request_t; extern udd_ctrl_request_t udd_g_ctrlreq; //! Return true if the setup request \a udd_g_ctrlreq indicates IN data transfer -#define Udd_setup_is_in() \ - (USB_REQ_DIR_IN == (udd_g_ctrlreq.req.bmRequestType & USB_REQ_DIR_MASK)) +#define Udd_setup_is_in() (USB_REQ_DIR_IN == (udd_g_ctrlreq.req.bmRequestType & USB_REQ_DIR_MASK)) //! Return true if the setup request \a udd_g_ctrlreq indicates OUT data transfer -#define Udd_setup_is_out() \ - (USB_REQ_DIR_OUT == (udd_g_ctrlreq.req.bmRequestType & USB_REQ_DIR_MASK)) +#define Udd_setup_is_out() (USB_REQ_DIR_OUT == (udd_g_ctrlreq.req.bmRequestType & USB_REQ_DIR_MASK)) //! Return the type of the SETUP request \a udd_g_ctrlreq. \see usb_reqtype. -#define Udd_setup_type() \ - (udd_g_ctrlreq.req.bmRequestType & USB_REQ_TYPE_MASK) +#define Udd_setup_type() (udd_g_ctrlreq.req.bmRequestType & USB_REQ_TYPE_MASK) //! Return the recipient of the SETUP request \a udd_g_ctrlreq. \see usb_recipient -#define Udd_setup_recipient() \ - (udd_g_ctrlreq.req.bmRequestType & USB_REQ_RECIP_MASK) +#define Udd_setup_recipient() (udd_g_ctrlreq.req.bmRequestType & USB_REQ_RECIP_MASK) /** * \brief End of halt callback function type. @@ -134,8 +130,7 @@ typedef void (*udd_callback_halt_cleared_t)(void); * \param status UDD_EP_TRANSFER_ABORT, if transfer is aborted * \param n number of data transferred */ -typedef void (*udd_callback_trans_t) (udd_ep_status_t status, - iram_size_t nb_transferred, udd_ep_id_t ep); +typedef void (*udd_callback_trans_t) (udd_ep_status_t status, iram_size_t nb_transferred, udd_ep_id_t ep); /** * \brief Authorizes the VBUS event @@ -239,8 +234,7 @@ void udd_set_setup_payload( uint8_t *payload, uint16_t payload_size ); * * \return \c 1 if the endpoint is enabled, otherwise \c 0. */ -bool udd_ep_alloc(udd_ep_id_t ep, uint8_t bmAttributes, - uint16_t MaxEndpointSize); +bool udd_ep_alloc(udd_ep_id_t ep, uint8_t bmAttributes, uint16_t MaxEndpointSize); /** * \brief Disables an endpoint @@ -294,8 +288,7 @@ bool udd_ep_clear_halt(udd_ep_id_t ep); * * \return \c 1 if the register is accepted, otherwise \c 0. */ -bool udd_ep_wait_stall_clear(udd_ep_id_t ep, - udd_callback_halt_cleared_t callback); +bool udd_ep_wait_stall_clear(udd_ep_id_t ep, udd_callback_halt_cleared_t callback); /** * \brief Allows to receive or send data on an endpoint @@ -321,9 +314,8 @@ bool udd_ep_wait_stall_clear(udd_ep_id_t ep, * * \return \c 1 if function was successfully done, otherwise \c 0. */ -bool udd_ep_run(udd_ep_id_t ep, bool b_shortpacket, - uint8_t * buf, iram_size_t buf_size, - udd_callback_trans_t callback); +bool udd_ep_run(udd_ep_id_t ep, bool b_shortpacket, uint8_t * buf, iram_size_t buf_size, udd_callback_trans_t callback); + /** * \brief Aborts transfer on going on endpoint * @@ -339,7 +331,6 @@ void udd_ep_abort(udd_ep_id_t ep); //@} - /** * \name High speed test mode management * @@ -352,7 +343,6 @@ void udd_test_mode_se0_nak(void); void udd_test_mode_packet(void); //@} - /** * \name UDC callbacks to provide for UDD * diff --git a/Marlin/src/HAL/DUE/usb/udi.h b/Marlin/src/HAL/DUE/usb/udi.h index febf03b7181e2..bc5de086f3cef 100644 --- a/Marlin/src/HAL/DUE/usb/udi.h +++ b/Marlin/src/HAL/DUE/usb/udi.h @@ -72,57 +72,57 @@ extern "C" { * selected by UDC. */ typedef struct { - /** - * \brief Enable the interface. - * - * This function is called when the host selects a configuration - * to which this interface belongs through a Set Configuration - * request, and when the host selects an alternate setting of - * this interface through a Set Interface request. - * - * \return \c 1 if function was successfully done, otherwise \c 0. - */ - bool (*enable)(void); + /** + * \brief Enable the interface. + * + * This function is called when the host selects a configuration + * to which this interface belongs through a Set Configuration + * request, and when the host selects an alternate setting of + * this interface through a Set Interface request. + * + * \return \c 1 if function was successfully done, otherwise \c 0. + */ + bool (*enable)(void); - /** - * \brief Disable the interface. - * - * This function is called when this interface is currently - * active, and - * - the host selects any configuration through a Set - * Configuration request, or - * - the host issues a USB reset, or - * - the device is detached from the host (i.e. Vbus is no - * longer present) - */ - void (*disable)(void); + /** + * \brief Disable the interface. + * + * This function is called when this interface is currently + * active, and + * - the host selects any configuration through a Set + * Configuration request, or + * - the host issues a USB reset, or + * - the device is detached from the host (i.e. Vbus is no + * longer present) + */ + void (*disable)(void); - /** - * \brief Handle a control request directed at an interface. - * - * This function is called when this interface is currently - * active and the host sends a SETUP request - * with this interface as the recipient. - * - * Use udd_g_ctrlreq to decode and response to SETUP request. - * - * \return \c 1 if this interface supports the SETUP request, otherwise \c 0. - */ - bool (*setup)(void); + /** + * \brief Handle a control request directed at an interface. + * + * This function is called when this interface is currently + * active and the host sends a SETUP request + * with this interface as the recipient. + * + * Use udd_g_ctrlreq to decode and response to SETUP request. + * + * \return \c 1 if this interface supports the SETUP request, otherwise \c 0. + */ + bool (*setup)(void); - /** - * \brief Returns the current setting of the selected interface. - * - * This function is called when UDC when know alternate setting of selected interface. - * - * \return alternate setting of selected interface - */ - uint8_t (*getsetting)(void); + /** + * \brief Returns the current setting of the selected interface. + * + * This function is called when UDC when know alternate setting of selected interface. + * + * \return alternate setting of selected interface + */ + uint8_t (*getsetting)(void); - /** - * \brief To signal that a SOF is occurred - */ - void (*sof_notify)(void); + /** + * \brief To signal that a SOF is occurred + */ + void (*sof_notify)(void); } udi_api_t; //@} diff --git a/Marlin/src/HAL/DUE/usb/udi_cdc.h b/Marlin/src/HAL/DUE/usb/udi_cdc.h index b61845011aa26..2bc5fff187165 100644 --- a/Marlin/src/HAL/DUE/usb/udi_cdc.h +++ b/Marlin/src/HAL/DUE/usb/udi_cdc.h @@ -92,18 +92,18 @@ extern UDC_DESC_STORAGE udi_api_t udi_api_cdc_data; * descriptors for the CDC Communication Class interface. */ typedef struct { - //! Standard interface descriptor - usb_iface_desc_t iface; - //! CDC Header functional descriptor - usb_cdc_hdr_desc_t header; - //! CDC Abstract Control Model functional descriptor - usb_cdc_acm_desc_t acm; - //! CDC Union functional descriptor - usb_cdc_union_desc_t union_desc; - //! CDC Call Management functional descriptor - usb_cdc_call_mgmt_desc_t call_mgmt; - //! Notification endpoint descriptor - usb_ep_desc_t ep_notify; + //! Standard interface descriptor + usb_iface_desc_t iface; + //! CDC Header functional descriptor + usb_cdc_hdr_desc_t header; + //! CDC Abstract Control Model functional descriptor + usb_cdc_acm_desc_t acm; + //! CDC Union functional descriptor + usb_cdc_union_desc_t union_desc; + //! CDC Call Management functional descriptor + usb_cdc_call_mgmt_desc_t call_mgmt; + //! Notification endpoint descriptor + usb_ep_desc_t ep_notify; } udi_cdc_comm_desc_t; @@ -114,11 +114,11 @@ typedef struct { * CDC Data Class interface. */ typedef struct { - //! Standard interface descriptor - usb_iface_desc_t iface; - //! Data IN/OUT endpoint descriptors - usb_ep_desc_t ep_in; - usb_ep_desc_t ep_out; + //! Standard interface descriptor + usb_iface_desc_t iface; + //! Data IN/OUT endpoint descriptors + usb_ep_desc_t ep_in; + usb_ep_desc_t ep_out; } udi_cdc_data_desc_t; @@ -136,13 +136,13 @@ typedef struct { //@{ //! By default no string associated to these interfaces #ifndef UDI_CDC_IAD_STRING_ID_0 -#define UDI_CDC_IAD_STRING_ID_0 0 + #define UDI_CDC_IAD_STRING_ID_0 0 #endif #ifndef UDI_CDC_COMM_STRING_ID_0 -#define UDI_CDC_COMM_STRING_ID_0 0 + #define UDI_CDC_COMM_STRING_ID_0 0 #endif #ifndef UDI_CDC_DATA_STRING_ID_0 -#define UDI_CDC_DATA_STRING_ID_0 0 + #define UDI_CDC_DATA_STRING_ID_0 0 #endif #define UDI_CDC_IAD_DESC_0 UDI_CDC_IAD_DESC(0) #define UDI_CDC_COMM_DESC_0 UDI_CDC_COMM_DESC(0) @@ -151,13 +151,13 @@ typedef struct { //! By default no string associated to these interfaces #ifndef UDI_CDC_IAD_STRING_ID_1 -#define UDI_CDC_IAD_STRING_ID_1 0 + #define UDI_CDC_IAD_STRING_ID_1 0 #endif #ifndef UDI_CDC_COMM_STRING_ID_1 -#define UDI_CDC_COMM_STRING_ID_1 0 + #define UDI_CDC_COMM_STRING_ID_1 0 #endif #ifndef UDI_CDC_DATA_STRING_ID_1 -#define UDI_CDC_DATA_STRING_ID_1 0 + #define UDI_CDC_DATA_STRING_ID_1 0 #endif #define UDI_CDC_IAD_DESC_1 UDI_CDC_IAD_DESC(1) #define UDI_CDC_COMM_DESC_1 UDI_CDC_COMM_DESC(1) @@ -166,13 +166,13 @@ typedef struct { //! By default no string associated to these interfaces #ifndef UDI_CDC_IAD_STRING_ID_2 -#define UDI_CDC_IAD_STRING_ID_2 0 + #define UDI_CDC_IAD_STRING_ID_2 0 #endif #ifndef UDI_CDC_COMM_STRING_ID_2 -#define UDI_CDC_COMM_STRING_ID_2 0 + #define UDI_CDC_COMM_STRING_ID_2 0 #endif #ifndef UDI_CDC_DATA_STRING_ID_2 -#define UDI_CDC_DATA_STRING_ID_2 0 + #define UDI_CDC_DATA_STRING_ID_2 0 #endif #define UDI_CDC_IAD_DESC_2 UDI_CDC_IAD_DESC(2) #define UDI_CDC_COMM_DESC_2 UDI_CDC_COMM_DESC(2) @@ -181,13 +181,13 @@ typedef struct { //! By default no string associated to these interfaces #ifndef UDI_CDC_IAD_STRING_ID_3 -#define UDI_CDC_IAD_STRING_ID_3 0 + #define UDI_CDC_IAD_STRING_ID_3 0 #endif #ifndef UDI_CDC_COMM_STRING_ID_3 -#define UDI_CDC_COMM_STRING_ID_3 0 + #define UDI_CDC_COMM_STRING_ID_3 0 #endif #ifndef UDI_CDC_DATA_STRING_ID_3 -#define UDI_CDC_DATA_STRING_ID_3 0 + #define UDI_CDC_DATA_STRING_ID_3 0 #endif #define UDI_CDC_IAD_DESC_3 UDI_CDC_IAD_DESC(3) #define UDI_CDC_COMM_DESC_3 UDI_CDC_COMM_DESC(3) @@ -196,13 +196,13 @@ typedef struct { //! By default no string associated to these interfaces #ifndef UDI_CDC_IAD_STRING_ID_4 -#define UDI_CDC_IAD_STRING_ID_4 0 + #define UDI_CDC_IAD_STRING_ID_4 0 #endif #ifndef UDI_CDC_COMM_STRING_ID_4 -#define UDI_CDC_COMM_STRING_ID_4 0 + #define UDI_CDC_COMM_STRING_ID_4 0 #endif #ifndef UDI_CDC_DATA_STRING_ID_4 -#define UDI_CDC_DATA_STRING_ID_4 0 + #define UDI_CDC_DATA_STRING_ID_4 0 #endif #define UDI_CDC_IAD_DESC_4 UDI_CDC_IAD_DESC(4) #define UDI_CDC_COMM_DESC_4 UDI_CDC_COMM_DESC(4) @@ -211,13 +211,13 @@ typedef struct { //! By default no string associated to these interfaces #ifndef UDI_CDC_IAD_STRING_ID_5 -#define UDI_CDC_IAD_STRING_ID_5 0 + #define UDI_CDC_IAD_STRING_ID_5 0 #endif #ifndef UDI_CDC_COMM_STRING_ID_5 -#define UDI_CDC_COMM_STRING_ID_5 0 + #define UDI_CDC_COMM_STRING_ID_5 0 #endif #ifndef UDI_CDC_DATA_STRING_ID_5 -#define UDI_CDC_DATA_STRING_ID_5 0 + #define UDI_CDC_DATA_STRING_ID_5 0 #endif #define UDI_CDC_IAD_DESC_5 UDI_CDC_IAD_DESC(5) #define UDI_CDC_COMM_DESC_5 UDI_CDC_COMM_DESC(5) @@ -226,13 +226,13 @@ typedef struct { //! By default no string associated to these interfaces #ifndef UDI_CDC_IAD_STRING_ID_6 -#define UDI_CDC_IAD_STRING_ID_6 0 + #define UDI_CDC_IAD_STRING_ID_6 0 #endif #ifndef UDI_CDC_COMM_STRING_ID_6 -#define UDI_CDC_COMM_STRING_ID_6 0 + #define UDI_CDC_COMM_STRING_ID_6 0 #endif #ifndef UDI_CDC_DATA_STRING_ID_6 -#define UDI_CDC_DATA_STRING_ID_6 0 + #define UDI_CDC_DATA_STRING_ID_6 0 #endif #define UDI_CDC_IAD_DESC_6 UDI_CDC_IAD_DESC(6) #define UDI_CDC_COMM_DESC_6 UDI_CDC_COMM_DESC(6) @@ -240,7 +240,6 @@ typedef struct { #define UDI_CDC_DATA_DESC_6_HS UDI_CDC_DATA_DESC_HS(6) //@} - //! Content of CDC IAD interface descriptor for all speeds #define UDI_CDC_IAD_DESC(port) { \ .bLength = sizeof(usb_iad_desc_t),\ @@ -270,7 +269,7 @@ typedef struct { .call_mgmt.bDescriptorType = CDC_CS_INTERFACE,\ .call_mgmt.bDescriptorSubtype = CDC_SCS_CALL_MGMT,\ .call_mgmt.bmCapabilities = \ - CDC_CALL_MGMT_SUPPORTED | CDC_CALL_MGMT_OVER_DCI,\ + CDC_CALL_MGMT_SUPPORTED | CDC_CALL_MGMT_OVER_DCI,\ .acm.bFunctionLength = sizeof(usb_cdc_acm_desc_t),\ .acm.bDescriptorType = CDC_CS_INTERFACE,\ .acm.bDescriptorSubtype = CDC_SCS_ACM,\ @@ -610,40 +609,37 @@ iram_size_t udi_cdc_multi_write_buf(uint8_t port, const void* buf, iram_size_t s * \subsection udi_cdc_basic_use_case_usage_code Example code * Content of conf_usb.h: * \code - #define UDI_CDC_ENABLE_EXT(port) my_callback_cdc_enable() - extern bool my_callback_cdc_enable(void); - #define UDI_CDC_DISABLE_EXT(port) my_callback_cdc_disable() - extern void my_callback_cdc_disable(void); - #define UDI_CDC_LOW_RATE - - #define UDI_CDC_DEFAULT_RATE 115200 - #define UDI_CDC_DEFAULT_STOPBITS CDC_STOP_BITS_1 - #define UDI_CDC_DEFAULT_PARITY CDC_PAR_NONE - #define UDI_CDC_DEFAULT_DATABITS 8 - - #include "udi_cdc_conf.h" // At the end of conf_usb.h file + #define UDI_CDC_ENABLE_EXT(port) my_callback_cdc_enable() + extern bool my_callback_cdc_enable(void); + #define UDI_CDC_DISABLE_EXT(port) my_callback_cdc_disable() + extern void my_callback_cdc_disable(void); + #define UDI_CDC_LOW_RATE + + #define UDI_CDC_DEFAULT_RATE 115200 + #define UDI_CDC_DEFAULT_STOPBITS CDC_STOP_BITS_1 + #define UDI_CDC_DEFAULT_PARITY CDC_PAR_NONE + #define UDI_CDC_DEFAULT_DATABITS 8 + + #include "udi_cdc_conf.h" // At the end of conf_usb.h file \endcode * * Add to application C-file: * \code - static bool my_flag_autorize_cdc_transfert = false; - bool my_callback_cdc_enable(void) - { - my_flag_autorize_cdc_transfert = true; - return true; - } - void my_callback_cdc_disable(void) - { - my_flag_autorize_cdc_transfert = false; - } - - void task(void) - { - if (my_flag_autorize_cdc_transfert) { - udi_cdc_putc('A'); - udi_cdc_getc(); - } - } + static bool my_flag_autorize_cdc_transfert = false; + bool my_callback_cdc_enable(void) { + my_flag_autorize_cdc_transfert = true; + return true; + } + void my_callback_cdc_disable(void) { + my_flag_autorize_cdc_transfert = false; + } + + void task(void) { + if (my_flag_autorize_cdc_transfert) { + udi_cdc_putc('A'); + udi_cdc_getc(); + } + } \endcode * * \subsection udi_cdc_basic_use_case_setup_flow Workflow @@ -652,14 +648,14 @@ iram_size_t udi_cdc_multi_write_buf(uint8_t port, const void* buf, iram_size_t s * - \code #define USB_DEVICE_SERIAL_NAME "12...EF" // Disk SN for CDC \endcode * \note The USB serial number is mandatory when a CDC interface is used. * - \code #define UDI_CDC_ENABLE_EXT(port) my_callback_cdc_enable() - extern bool my_callback_cdc_enable(void); \endcode + extern bool my_callback_cdc_enable(void); \endcode * \note After the device enumeration (detecting and identifying USB devices), * the USB host starts the device configuration. When the USB CDC interface * from the device is accepted by the host, the USB host enables this interface and the * UDI_CDC_ENABLE_EXT() callback function is called and return true. * Thus, when this event is received, the data transfer on CDC interface are authorized. * - \code #define UDI_CDC_DISABLE_EXT(port) my_callback_cdc_disable() - extern void my_callback_cdc_disable(void); \endcode + extern void my_callback_cdc_disable(void); \endcode * \note When the USB device is unplugged or is reset by the USB host, the USB * interface is disabled and the UDI_CDC_DISABLE_EXT() callback function * is called. Thus, the data transfer must be stopped on CDC interface. @@ -667,19 +663,19 @@ iram_size_t udi_cdc_multi_write_buf(uint8_t port, const void* buf, iram_size_t s * \note Define it when the transfer CDC Device to Host is a low rate * (<512000 bauds) to reduce CDC buffers size. * - \code #define UDI_CDC_DEFAULT_RATE 115200 - #define UDI_CDC_DEFAULT_STOPBITS CDC_STOP_BITS_1 - #define UDI_CDC_DEFAULT_PARITY CDC_PAR_NONE - #define UDI_CDC_DEFAULT_DATABITS 8 \endcode + #define UDI_CDC_DEFAULT_STOPBITS CDC_STOP_BITS_1 + #define UDI_CDC_DEFAULT_PARITY CDC_PAR_NONE + #define UDI_CDC_DEFAULT_DATABITS 8 \endcode * \note Default configuration of communication port at startup. * -# Send or wait data on CDC line: * - \code // Waits and gets a value on CDC line - int udi_cdc_getc(void); - // Reads a RAM buffer on CDC line - iram_size_t udi_cdc_read_buf(int *buf, iram_size_t size); - // Puts a byte on CDC line - int udi_cdc_putc(int value); - // Writes a RAM buffer on CDC line - iram_size_t udi_cdc_write_buf(const int *buf, iram_size_t size); \endcode + int udi_cdc_getc(void); + // Reads a RAM buffer on CDC line + iram_size_t udi_cdc_read_buf(int *buf, iram_size_t size); + // Puts a byte on CDC line + int udi_cdc_putc(int value); + // Writes a RAM buffer on CDC line + iram_size_t udi_cdc_write_buf(const int *buf, iram_size_t size); \endcode * * \section udi_cdc_use_cases Advanced use cases * For more advanced use of the UDI CDC module, see the following use cases: @@ -713,90 +709,90 @@ iram_size_t udi_cdc_multi_write_buf(uint8_t port, const void* buf, iram_size_t s * \subsection udi_cdc_use_case_composite_usage_code Example code * Content of conf_usb.h: * \code - #define USB_DEVICE_EP_CTRL_SIZE 64 - #define USB_DEVICE_NB_INTERFACE (X+2) - #define USB_DEVICE_MAX_EP (X+3) - - #define UDI_CDC_DATA_EP_IN_0 (1 | USB_EP_DIR_IN) // TX - #define UDI_CDC_DATA_EP_OUT_0 (2 | USB_EP_DIR_OUT) // RX - #define UDI_CDC_COMM_EP_0 (3 | USB_EP_DIR_IN) // Notify endpoint - #define UDI_CDC_COMM_IFACE_NUMBER_0 X+0 - #define UDI_CDC_DATA_IFACE_NUMBER_0 X+1 - - #define UDI_COMPOSITE_DESC_T \ - usb_iad_desc_t udi_cdc_iad; \ - udi_cdc_comm_desc_t udi_cdc_comm; \ - udi_cdc_data_desc_t udi_cdc_data; \ - ... - #define UDI_COMPOSITE_DESC_FS \ - .udi_cdc_iad = UDI_CDC_IAD_DESC_0, \ - .udi_cdc_comm = UDI_CDC_COMM_DESC_0, \ - .udi_cdc_data = UDI_CDC_DATA_DESC_0_FS, \ - ... - #define UDI_COMPOSITE_DESC_HS \ - .udi_cdc_iad = UDI_CDC_IAD_DESC_0, \ - .udi_cdc_comm = UDI_CDC_COMM_DESC_0, \ - .udi_cdc_data = UDI_CDC_DATA_DESC_0_HS, \ - ... - #define UDI_COMPOSITE_API \ - &udi_api_cdc_comm, \ - &udi_api_cdc_data, \ - ... + #define USB_DEVICE_EP_CTRL_SIZE 64 + #define USB_DEVICE_NB_INTERFACE (X+2) + #define USB_DEVICE_MAX_EP (X+3) + + #define UDI_CDC_DATA_EP_IN_0 (1 | USB_EP_DIR_IN) // TX + #define UDI_CDC_DATA_EP_OUT_0 (2 | USB_EP_DIR_OUT) // RX + #define UDI_CDC_COMM_EP_0 (3 | USB_EP_DIR_IN) // Notify endpoint + #define UDI_CDC_COMM_IFACE_NUMBER_0 X+0 + #define UDI_CDC_DATA_IFACE_NUMBER_0 X+1 + + #define UDI_COMPOSITE_DESC_T \ + usb_iad_desc_t udi_cdc_iad; \ + udi_cdc_comm_desc_t udi_cdc_comm; \ + udi_cdc_data_desc_t udi_cdc_data; \ + ... + #define UDI_COMPOSITE_DESC_FS \ + .udi_cdc_iad = UDI_CDC_IAD_DESC_0, \ + .udi_cdc_comm = UDI_CDC_COMM_DESC_0, \ + .udi_cdc_data = UDI_CDC_DATA_DESC_0_FS, \ + ... + #define UDI_COMPOSITE_DESC_HS \ + .udi_cdc_iad = UDI_CDC_IAD_DESC_0, \ + .udi_cdc_comm = UDI_CDC_COMM_DESC_0, \ + .udi_cdc_data = UDI_CDC_DATA_DESC_0_HS, \ + ... + #define UDI_COMPOSITE_API \ + &udi_api_cdc_comm, \ + &udi_api_cdc_data, \ + ... \endcode * * \subsection udi_cdc_use_case_composite_usage_flow Workflow * -# Ensure that conf_usb.h is available and contains the following parameters * required for a USB composite device configuration: * - \code // Endpoint control size, This must be: - // - 8, 16, 32 or 64 for full speed device (8 is recommended to save RAM) - // - 64 for a high speed device - #define USB_DEVICE_EP_CTRL_SIZE 64 - // Total Number of interfaces on this USB device. - // Add 2 for CDC. - #define USB_DEVICE_NB_INTERFACE (X+2) - // Total number of endpoints on this USB device. - // This must include each endpoint for each interface. - // Add 3 for CDC. - #define USB_DEVICE_MAX_EP (X+3) \endcode + // - 8, 16, 32 or 64 for full speed device (8 is recommended to save RAM) + // - 64 for a high speed device + #define USB_DEVICE_EP_CTRL_SIZE 64 + // Total Number of interfaces on this USB device. + // Add 2 for CDC. + #define USB_DEVICE_NB_INTERFACE (X+2) + // Total number of endpoints on this USB device. + // This must include each endpoint for each interface. + // Add 3 for CDC. + #define USB_DEVICE_MAX_EP (X+3) \endcode * -# Ensure that conf_usb.h contains the description of * composite device: * - \code // The endpoint numbers chosen by you for the CDC. - // The endpoint numbers starting from 1. - #define UDI_CDC_DATA_EP_IN_0 (1 | USB_EP_DIR_IN) // TX - #define UDI_CDC_DATA_EP_OUT_0 (2 | USB_EP_DIR_OUT) // RX - #define UDI_CDC_COMM_EP_0 (3 | USB_EP_DIR_IN) // Notify endpoint - // The interface index of an interface starting from 0 - #define UDI_CDC_COMM_IFACE_NUMBER_0 X+0 - #define UDI_CDC_DATA_IFACE_NUMBER_0 X+1 \endcode + // The endpoint numbers starting from 1. + #define UDI_CDC_DATA_EP_IN_0 (1 | USB_EP_DIR_IN) // TX + #define UDI_CDC_DATA_EP_OUT_0 (2 | USB_EP_DIR_OUT) // RX + #define UDI_CDC_COMM_EP_0 (3 | USB_EP_DIR_IN) // Notify endpoint + // The interface index of an interface starting from 0 + #define UDI_CDC_COMM_IFACE_NUMBER_0 X+0 + #define UDI_CDC_DATA_IFACE_NUMBER_0 X+1 \endcode * -# Ensure that conf_usb.h contains the following parameters * required for a USB composite device configuration: * - \code // USB Interfaces descriptor structure - #define UDI_COMPOSITE_DESC_T \ - ... - usb_iad_desc_t udi_cdc_iad; \ - udi_cdc_comm_desc_t udi_cdc_comm; \ - udi_cdc_data_desc_t udi_cdc_data; \ - ... - // USB Interfaces descriptor value for Full Speed - #define UDI_COMPOSITE_DESC_FS \ - ... - .udi_cdc_iad = UDI_CDC_IAD_DESC_0, \ - .udi_cdc_comm = UDI_CDC_COMM_DESC_0, \ - .udi_cdc_data = UDI_CDC_DATA_DESC_0_FS, \ - ... - // USB Interfaces descriptor value for High Speed - #define UDI_COMPOSITE_DESC_HS \ - ... - .udi_cdc_iad = UDI_CDC_IAD_DESC_0, \ - .udi_cdc_comm = UDI_CDC_COMM_DESC_0, \ - .udi_cdc_data = UDI_CDC_DATA_DESC_0_HS, \ - ... - // USB Interface APIs - #define UDI_COMPOSITE_API \ - ... - &udi_api_cdc_comm, \ - &udi_api_cdc_data, \ - ... \endcode + #define UDI_COMPOSITE_DESC_T \ + ... + usb_iad_desc_t udi_cdc_iad; \ + udi_cdc_comm_desc_t udi_cdc_comm; \ + udi_cdc_data_desc_t udi_cdc_data; \ + ... + // USB Interfaces descriptor value for Full Speed + #define UDI_COMPOSITE_DESC_FS \ + ... + .udi_cdc_iad = UDI_CDC_IAD_DESC_0, \ + .udi_cdc_comm = UDI_CDC_COMM_DESC_0, \ + .udi_cdc_data = UDI_CDC_DATA_DESC_0_FS, \ + ... + // USB Interfaces descriptor value for High Speed + #define UDI_COMPOSITE_DESC_HS \ + ... + .udi_cdc_iad = UDI_CDC_IAD_DESC_0, \ + .udi_cdc_comm = UDI_CDC_COMM_DESC_0, \ + .udi_cdc_data = UDI_CDC_DATA_DESC_0_HS, \ + ... + // USB Interface APIs + #define UDI_COMPOSITE_API \ + ... + &udi_api_cdc_comm, \ + &udi_api_cdc_data, \ + ... \endcode * - \note The descriptors order given in the four lists above must be the * same as the order defined by all interface indexes. The interface index * orders are defined through UDI_X_IFACE_NUMBER defines.\n diff --git a/Marlin/src/HAL/DUE/usb/udi_msc.h b/Marlin/src/HAL/DUE/usb/udi_msc.h index 730dbc8eec563..0ede4d6a83467 100644 --- a/Marlin/src/HAL/DUE/usb/udi_msc.h +++ b/Marlin/src/HAL/DUE/usb/udi_msc.h @@ -77,9 +77,9 @@ extern UDC_DESC_STORAGE udi_api_t udi_api_msc; //! Interface descriptor structure for MSC typedef struct { - usb_iface_desc_t iface; - usb_ep_desc_t ep_in; - usb_ep_desc_t ep_out; + usb_iface_desc_t iface; + usb_ep_desc_t ep_in; + usb_ep_desc_t ep_out; } udi_msc_desc_t; //! By default no string associated to this interface @@ -94,32 +94,32 @@ typedef struct { //! Content of MSC interface descriptor for all speeds #define UDI_MSC_DESC \ - .iface.bLength = sizeof(usb_iface_desc_t),\ - .iface.bDescriptorType = USB_DT_INTERFACE,\ - .iface.bInterfaceNumber = UDI_MSC_IFACE_NUMBER,\ - .iface.bAlternateSetting = 0,\ - .iface.bNumEndpoints = 2,\ - .iface.bInterfaceClass = MSC_CLASS,\ - .iface.bInterfaceSubClass = MSC_SUBCLASS_TRANSPARENT,\ - .iface.bInterfaceProtocol = MSC_PROTOCOL_BULK,\ - .iface.iInterface = UDI_MSC_STRING_ID,\ - .ep_in.bLength = sizeof(usb_ep_desc_t),\ - .ep_in.bDescriptorType = USB_DT_ENDPOINT,\ - .ep_in.bEndpointAddress = UDI_MSC_EP_IN,\ - .ep_in.bmAttributes = USB_EP_TYPE_BULK,\ - .ep_in.bInterval = 0,\ - .ep_out.bLength = sizeof(usb_ep_desc_t),\ - .ep_out.bDescriptorType = USB_DT_ENDPOINT,\ - .ep_out.bEndpointAddress = UDI_MSC_EP_OUT,\ - .ep_out.bmAttributes = USB_EP_TYPE_BULK,\ - .ep_out.bInterval = 0, + .iface.bLength = sizeof(usb_iface_desc_t),\ + .iface.bDescriptorType = USB_DT_INTERFACE,\ + .iface.bInterfaceNumber = UDI_MSC_IFACE_NUMBER,\ + .iface.bAlternateSetting = 0,\ + .iface.bNumEndpoints = 2,\ + .iface.bInterfaceClass = MSC_CLASS,\ + .iface.bInterfaceSubClass = MSC_SUBCLASS_TRANSPARENT,\ + .iface.bInterfaceProtocol = MSC_PROTOCOL_BULK,\ + .iface.iInterface = UDI_MSC_STRING_ID,\ + .ep_in.bLength = sizeof(usb_ep_desc_t),\ + .ep_in.bDescriptorType = USB_DT_ENDPOINT,\ + .ep_in.bEndpointAddress = UDI_MSC_EP_IN,\ + .ep_in.bmAttributes = USB_EP_TYPE_BULK,\ + .ep_in.bInterval = 0,\ + .ep_out.bLength = sizeof(usb_ep_desc_t),\ + .ep_out.bDescriptorType = USB_DT_ENDPOINT,\ + .ep_out.bEndpointAddress = UDI_MSC_EP_OUT,\ + .ep_out.bmAttributes = USB_EP_TYPE_BULK,\ + .ep_out.bInterval = 0, //! Content of MSC interface descriptor for full speed only #define UDI_MSC_DESC_FS {\ - UDI_MSC_DESC \ - .ep_in.wMaxPacketSize = LE16(UDI_MSC_EPS_SIZE_FS),\ - .ep_out.wMaxPacketSize = LE16(UDI_MSC_EPS_SIZE_FS),\ - } + UDI_MSC_DESC \ + .ep_in.wMaxPacketSize = LE16(UDI_MSC_EPS_SIZE_FS),\ + .ep_out.wMaxPacketSize = LE16(UDI_MSC_EPS_SIZE_FS),\ + } //! Content of MSC interface descriptor for high speed only #define UDI_MSC_DESC_HS {\ @@ -129,7 +129,6 @@ typedef struct { } //@} - /** * \ingroup udi_group * \defgroup udi_msc_group USB Device Interface (UDI) for Mass Storage Class (MSC) @@ -163,14 +162,13 @@ bool udi_msc_process_trans(void); * \return \c 1 if function was successfully done, otherwise \c 0. */ bool udi_msc_trans_block(bool b_read, uint8_t * block, iram_size_t block_size, - void (*callback) (udd_ep_status_t status, iram_size_t n, udd_ep_id_t ep)); + void (*callback) (udd_ep_status_t status, iram_size_t n, udd_ep_id_t ep)); //@} #ifdef __cplusplus } #endif - /** * \page udi_msc_quickstart Quick start guide for USB device Mass Storage module (UDI MSC) * @@ -200,35 +198,32 @@ bool udi_msc_trans_block(bool b_read, uint8_t * block, iram_size_t block_size, * \subsection udi_msc_basic_use_case_usage_code Example code * Content of conf_usb.h: * \code - #define USB_DEVICE_SERIAL_NAME "12...EF" // Disk SN for MSC - #define UDI_MSC_GLOBAL_VENDOR_ID \ - 'A', 'T', 'M', 'E', 'L', ' ', ' ', ' ' - #define UDI_MSC_GLOBAL_PRODUCT_VERSION \ - '1', '.', '0', '0' - #define UDI_MSC_ENABLE_EXT() my_callback_msc_enable() - extern bool my_callback_msc_enable(void); - #define UDI_MSC_DISABLE_EXT() my_callback_msc_disable() - extern void my_callback_msc_disable(void); - #include "udi_msc_conf.h" // At the end of conf_usb.h file + #define USB_DEVICE_SERIAL_NAME "12...EF" // Disk SN for MSC + #define UDI_MSC_GLOBAL_VENDOR_ID \ + 'A', 'T', 'M', 'E', 'L', ' ', ' ', ' ' + #define UDI_MSC_GLOBAL_PRODUCT_VERSION \ + '1', '.', '0', '0' + #define UDI_MSC_ENABLE_EXT() my_callback_msc_enable() + extern bool my_callback_msc_enable(void); + #define UDI_MSC_DISABLE_EXT() my_callback_msc_disable() + extern void my_callback_msc_disable(void); + #include "udi_msc_conf.h" // At the end of conf_usb.h file \endcode * * Add to application C-file: * \code - static bool my_flag_autorize_msc_transfert = false; - bool my_callback_msc_enable(void) - { - my_flag_autorize_msc_transfert = true; - return true; - } - void my_callback_msc_disable(void) - { - my_flag_autorize_msc_transfert = false; - } + static bool my_flag_autorize_msc_transfert = false; + bool my_callback_msc_enable(void) { + my_flag_autorize_msc_transfert = true; + return true; + } + void my_callback_msc_disable(void) { + my_flag_autorize_msc_transfert = false; + } - void task(void) - { - udi_msc_process_trans(); - } + void task(void) { + udi_msc_process_trans(); + } \endcode * * \subsection udi_msc_basic_use_case_setup_flow Workflow @@ -237,14 +232,14 @@ bool udi_msc_trans_block(bool b_read, uint8_t * block, iram_size_t block_size, * - \code #define USB_DEVICE_SERIAL_NAME "12...EF" // Disk SN for MSC \endcode * \note The USB serial number is mandatory when a MSC interface is used. * - \code //! Vendor name and Product version of MSC interface - #define UDI_MSC_GLOBAL_VENDOR_ID \ - 'A', 'T', 'M', 'E', 'L', ' ', ' ', ' ' - #define UDI_MSC_GLOBAL_PRODUCT_VERSION \ - '1', '.', '0', '0' \endcode + #define UDI_MSC_GLOBAL_VENDOR_ID \ + 'A', 'T', 'M', 'E', 'L', ' ', ' ', ' ' + #define UDI_MSC_GLOBAL_PRODUCT_VERSION \ + '1', '.', '0', '0' \endcode * \note The USB MSC interface requires a vendor ID (8 ASCII characters) * and a product version (4 ASCII characters). * - \code #define UDI_MSC_ENABLE_EXT() my_callback_msc_enable() - extern bool my_callback_msc_enable(void); \endcode + extern bool my_callback_msc_enable(void); \endcode * \note After the device enumeration (detecting and identifying USB devices), * the USB host starts the device configuration. When the USB MSC interface * from the device is accepted by the host, the USB host enables this interface and the @@ -252,7 +247,7 @@ bool udi_msc_trans_block(bool b_read, uint8_t * block, iram_size_t block_size, * Thus, when this event is received, the tasks which call * udi_msc_process_trans() must be enabled. * - \code #define UDI_MSC_DISABLE_EXT() my_callback_msc_disable() - extern void my_callback_msc_disable(void); \endcode + extern void my_callback_msc_disable(void); \endcode * \note When the USB device is unplugged or is reset by the USB host, the USB * interface is disabled and the UDI_MSC_DISABLE_EXT() callback function * is called. Thus, it is recommended to disable the task which is called udi_msc_process_trans(). @@ -261,15 +256,15 @@ bool udi_msc_trans_block(bool b_read, uint8_t * block, iram_size_t block_size, * must be done outside USB interrupt routine. This is done in the MSC process * ("udi_msc_process_trans()") called by main loop: * - \code * void task(void) { - udi_msc_process_trans(); - } \endcode + udi_msc_process_trans(); + } \endcode * -# The MSC speed depends on task periodicity. To get the best speed * the notification callback "UDI_MSC_NOTIFY_TRANS_EXT" can be used to wakeup * this task (Example, through a mutex): * - \code #define UDI_MSC_NOTIFY_TRANS_EXT() msc_notify_trans() - void msc_notify_trans(void) { - wakeup_my_task(); - } \endcode + void msc_notify_trans(void) { + wakeup_my_task(); + } \endcode * * \section udi_msc_use_cases Advanced use cases * For more advanced use of the UDI MSC module, see the following use cases: @@ -302,72 +297,72 @@ bool udi_msc_trans_block(bool b_read, uint8_t * block, iram_size_t block_size, * \subsection udi_msc_use_case_composite_usage_code Example code * Content of conf_usb.h: * \code - #define USB_DEVICE_EP_CTRL_SIZE 64 - #define USB_DEVICE_NB_INTERFACE (X+1) - #define USB_DEVICE_MAX_EP (X+2) + #define USB_DEVICE_EP_CTRL_SIZE 64 + #define USB_DEVICE_NB_INTERFACE (X+1) + #define USB_DEVICE_MAX_EP (X+2) - #define UDI_MSC_EP_IN (X | USB_EP_DIR_IN) - #define UDI_MSC_EP_OUT (Y | USB_EP_DIR_OUT) - #define UDI_MSC_IFACE_NUMBER X + #define UDI_MSC_EP_IN (X | USB_EP_DIR_IN) + #define UDI_MSC_EP_OUT (Y | USB_EP_DIR_OUT) + #define UDI_MSC_IFACE_NUMBER X - #define UDI_COMPOSITE_DESC_T \ - udi_msc_desc_t udi_msc; \ - ... - #define UDI_COMPOSITE_DESC_FS \ - .udi_msc = UDI_MSC_DESC, \ - ... - #define UDI_COMPOSITE_DESC_HS \ - .udi_msc = UDI_MSC_DESC, \ - ... - #define UDI_COMPOSITE_API \ - &udi_api_msc, \ - ... + #define UDI_COMPOSITE_DESC_T \ + udi_msc_desc_t udi_msc; \ + ... + #define UDI_COMPOSITE_DESC_FS \ + .udi_msc = UDI_MSC_DESC, \ + ... + #define UDI_COMPOSITE_DESC_HS \ + .udi_msc = UDI_MSC_DESC, \ + ... + #define UDI_COMPOSITE_API \ + &udi_api_msc, \ + ... \endcode * * \subsection udi_msc_use_case_composite_usage_flow Workflow * -# Ensure that conf_usb.h is available and contains the following parameters * required for a USB composite device configuration: * - \code // Endpoint control size, This must be: - // - 8, 16, 32 or 64 for full speed device (8 is recommended to save RAM) - // - 64 for a high speed device - #define USB_DEVICE_EP_CTRL_SIZE 64 - // Total Number of interfaces on this USB device. - // Add 1 for MSC. - #define USB_DEVICE_NB_INTERFACE (X+1) - // Total number of endpoints on this USB device. - // This must include each endpoint for each interface. - // Add 2 for MSC. - #define USB_DEVICE_MAX_EP (X+2) \endcode + // - 8, 16, 32 or 64 for full speed device (8 is recommended to save RAM) + // - 64 for a high speed device + #define USB_DEVICE_EP_CTRL_SIZE 64 + // Total Number of interfaces on this USB device. + // Add 1 for MSC. + #define USB_DEVICE_NB_INTERFACE (X+1) + // Total number of endpoints on this USB device. + // This must include each endpoint for each interface. + // Add 2 for MSC. + #define USB_DEVICE_MAX_EP (X+2) \endcode * -# Ensure that conf_usb.h contains the description of * composite device: * - \code // The endpoint numbers chosen by you for the MSC. - // The endpoint numbers starting from 1. - #define UDI_MSC_EP_IN (X | USB_EP_DIR_IN) - #define UDI_MSC_EP_OUT (Y | USB_EP_DIR_OUT) - // The interface index of an interface starting from 0 - #define UDI_MSC_IFACE_NUMBER X \endcode + // The endpoint numbers starting from 1. + #define UDI_MSC_EP_IN (X | USB_EP_DIR_IN) + #define UDI_MSC_EP_OUT (Y | USB_EP_DIR_OUT) + // The interface index of an interface starting from 0 + #define UDI_MSC_IFACE_NUMBER X \endcode * -# Ensure that conf_usb.h contains the following parameters * required for a USB composite device configuration: * - \code // USB Interfaces descriptor structure - #define UDI_COMPOSITE_DESC_T \ - ... - udi_msc_desc_t udi_msc; \ - ... - // USB Interfaces descriptor value for Full Speed - #define UDI_COMPOSITE_DESC_FS \ - ... - .udi_msc = UDI_MSC_DESC_FS, \ - ... - // USB Interfaces descriptor value for High Speed - #define UDI_COMPOSITE_DESC_HS \ - ... - .udi_msc = UDI_MSC_DESC_HS, \ - ... - // USB Interface APIs - #define UDI_COMPOSITE_API \ - ... - &udi_api_msc, \ - ... \endcode + #define UDI_COMPOSITE_DESC_T \ + ... + udi_msc_desc_t udi_msc; \ + ... + // USB Interfaces descriptor value for Full Speed + #define UDI_COMPOSITE_DESC_FS \ + ... + .udi_msc = UDI_MSC_DESC_FS, \ + ... + // USB Interfaces descriptor value for High Speed + #define UDI_COMPOSITE_DESC_HS \ + ... + .udi_msc = UDI_MSC_DESC_HS, \ + ... + // USB Interface APIs + #define UDI_COMPOSITE_API \ + ... + &udi_api_msc, \ + ... \endcode * - \note The descriptors order given in the four lists above must be the * same as the order defined by all interface indexes. The interface index * orders are defined through UDI_X_IFACE_NUMBER defines. diff --git a/Marlin/src/HAL/DUE/usb/uotghs_otg.h b/Marlin/src/HAL/DUE/usb/uotghs_otg.h index eca5e938bbe1b..f0e55c896fac0 100644 --- a/Marlin/src/HAL/DUE/usb/uotghs_otg.h +++ b/Marlin/src/HAL/DUE/usb/uotghs_otg.h @@ -127,13 +127,13 @@ void otg_dual_disable(void); //! These macros allows to enable/disable pad and UOTGHS hardware //! @{ //! Reset USB macro -#define otg_reset() \ - do { \ - UOTGHS->UOTGHS_CTRL = 0; \ - while( UOTGHS->UOTGHS_SR & 0x3FFF) {\ - UOTGHS->UOTGHS_SCR = 0xFFFFFFFF;\ - } \ - } while (0) +#define otg_reset() \ + do { \ + UOTGHS->UOTGHS_CTRL = 0; \ + while( UOTGHS->UOTGHS_SR & 0x3FFF) { \ + UOTGHS->UOTGHS_SCR = 0xFFFFFFFF; \ + } \ + } while (0) //! Enable USB macro #define otg_enable() (Set_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_USBE)) //! Disable USB macro @@ -157,15 +157,14 @@ void otg_dual_disable(void); //! Configure time-out of specified OTG timer #define otg_configure_timeout(timer, timeout) (Set_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_UNLOCK),\ - Wr_bitfield(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_TIMPAGE_Msk, timer),\ - Wr_bitfield(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_TIMVALUE_Msk, timeout),\ - Clr_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_UNLOCK)) + Wr_bitfield(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_TIMPAGE_Msk, timer),\ + Wr_bitfield(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_TIMVALUE_Msk, timeout),\ + Clr_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_UNLOCK)) //! Get configured time-out of specified OTG timer #define otg_get_timeout(timer) (Set_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_UNLOCK),\ - Wr_bitfield(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_TIMPAGE_Msk, timer),\ - Clr_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_UNLOCK),\ - Rd_bitfield(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_TIMVALUE_Msk)) - + Wr_bitfield(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_TIMPAGE_Msk, timer),\ + Clr_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_UNLOCK),\ + Rd_bitfield(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_TIMVALUE_Msk)) //! Get the dual-role device state of the internal USB finite state machine of the UOTGHS controller #define otg_get_fsm_drd_state() (Rd_bitfield(UOTGHS->UOTGHS_FSM, UOTGHS_FSM_DRDSTATE_Msk)) diff --git a/Marlin/src/HAL/DUE/usb/usb_protocol.h b/Marlin/src/HAL/DUE/usb/usb_protocol.h index ea51a8689649c..4540247df8266 100644 --- a/Marlin/src/HAL/DUE/usb/usb_protocol.h +++ b/Marlin/src/HAL/DUE/usb/usb_protocol.h @@ -108,17 +108,17 @@ * \brief Standard USB requests (bRequest) */ enum usb_reqid { - USB_REQ_GET_STATUS = 0, - USB_REQ_CLEAR_FEATURE = 1, - USB_REQ_SET_FEATURE = 3, - USB_REQ_SET_ADDRESS = 5, - USB_REQ_GET_DESCRIPTOR = 6, - USB_REQ_SET_DESCRIPTOR = 7, - USB_REQ_GET_CONFIGURATION = 8, - USB_REQ_SET_CONFIGURATION = 9, - USB_REQ_GET_INTERFACE = 10, - USB_REQ_SET_INTERFACE = 11, - USB_REQ_SYNCH_FRAME = 12, + USB_REQ_GET_STATUS = 0, + USB_REQ_CLEAR_FEATURE = 1, + USB_REQ_SET_FEATURE = 3, + USB_REQ_SET_ADDRESS = 5, + USB_REQ_GET_DESCRIPTOR = 6, + USB_REQ_SET_DESCRIPTOR = 7, + USB_REQ_GET_CONFIGURATION = 8, + USB_REQ_SET_CONFIGURATION = 9, + USB_REQ_GET_INTERFACE = 10, + USB_REQ_SET_INTERFACE = 11, + USB_REQ_SYNCH_FRAME = 12, }; /** @@ -126,9 +126,9 @@ enum usb_reqid { * */ enum usb_device_status { - USB_DEV_STATUS_BUS_POWERED = 0, - USB_DEV_STATUS_SELF_POWERED = 1, - USB_DEV_STATUS_REMOTEWAKEUP = 2 + USB_DEV_STATUS_BUS_POWERED = 0, + USB_DEV_STATUS_SELF_POWERED = 1, + USB_DEV_STATUS_REMOTEWAKEUP = 2 }; /** @@ -136,7 +136,7 @@ enum usb_device_status { * */ enum usb_interface_status { - USB_IFACE_STATUS_RESERVED = 0 + USB_IFACE_STATUS_RESERVED = 0 }; /** @@ -144,7 +144,7 @@ enum usb_interface_status { * */ enum usb_endpoint_status { - USB_EP_STATUS_HALTED = 1, + USB_EP_STATUS_HALTED = 1, }; /** @@ -153,11 +153,11 @@ enum usb_endpoint_status { * \note valid for SetFeature request. */ enum usb_device_feature { - USB_DEV_FEATURE_REMOTE_WAKEUP = 1, //!< Remote wakeup enabled - USB_DEV_FEATURE_TEST_MODE = 2, //!< USB test mode - USB_DEV_FEATURE_OTG_B_HNP_ENABLE = 3, - USB_DEV_FEATURE_OTG_A_HNP_SUPPORT = 4, - USB_DEV_FEATURE_OTG_A_ALT_HNP_SUPPORT = 5 + USB_DEV_FEATURE_REMOTE_WAKEUP = 1, //!< Remote wakeup enabled + USB_DEV_FEATURE_TEST_MODE = 2, //!< USB test mode + USB_DEV_FEATURE_OTG_B_HNP_ENABLE = 3, + USB_DEV_FEATURE_OTG_A_HNP_SUPPORT = 4, + USB_DEV_FEATURE_OTG_A_ALT_HNP_SUPPORT = 5 }; /** @@ -166,54 +166,54 @@ enum usb_device_feature { * \note valid for USB_DEV_FEATURE_TEST_MODE request. */ enum usb_device_hs_test_mode { - USB_DEV_TEST_MODE_J = 1, - USB_DEV_TEST_MODE_K = 2, - USB_DEV_TEST_MODE_SE0_NAK = 3, - USB_DEV_TEST_MODE_PACKET = 4, - USB_DEV_TEST_MODE_FORCE_ENABLE = 5, + USB_DEV_TEST_MODE_J = 1, + USB_DEV_TEST_MODE_K = 2, + USB_DEV_TEST_MODE_SE0_NAK = 3, + USB_DEV_TEST_MODE_PACKET = 4, + USB_DEV_TEST_MODE_FORCE_ENABLE = 5, }; /** * \brief Standard USB endpoint feature/status flags */ enum usb_endpoint_feature { - USB_EP_FEATURE_HALT = 0, + USB_EP_FEATURE_HALT = 0, }; /** * \brief Standard USB Test Mode Selectors */ enum usb_test_mode_selector { - USB_TEST_J = 0x01, - USB_TEST_K = 0x02, - USB_TEST_SE0_NAK = 0x03, - USB_TEST_PACKET = 0x04, - USB_TEST_FORCE_ENABLE = 0x05, + USB_TEST_J = 0x01, + USB_TEST_K = 0x02, + USB_TEST_SE0_NAK = 0x03, + USB_TEST_PACKET = 0x04, + USB_TEST_FORCE_ENABLE = 0x05, }; /** * \brief Standard USB descriptor types */ enum usb_descriptor_type { - USB_DT_DEVICE = 1, - USB_DT_CONFIGURATION = 2, - USB_DT_STRING = 3, - USB_DT_INTERFACE = 4, - USB_DT_ENDPOINT = 5, - USB_DT_DEVICE_QUALIFIER = 6, - USB_DT_OTHER_SPEED_CONFIGURATION = 7, - USB_DT_INTERFACE_POWER = 8, - USB_DT_OTG = 9, - USB_DT_IAD = 0x0B, - USB_DT_BOS = 0x0F, - USB_DT_DEVICE_CAPABILITY = 0x10, + USB_DT_DEVICE = 1, + USB_DT_CONFIGURATION = 2, + USB_DT_STRING = 3, + USB_DT_INTERFACE = 4, + USB_DT_ENDPOINT = 5, + USB_DT_DEVICE_QUALIFIER = 6, + USB_DT_OTHER_SPEED_CONFIGURATION = 7, + USB_DT_INTERFACE_POWER = 8, + USB_DT_OTG = 9, + USB_DT_IAD = 0x0B, + USB_DT_BOS = 0x0F, + USB_DT_DEVICE_CAPABILITY = 0x10, }; /** * \brief USB Device Capability types */ enum usb_capability_type { - USB_DC_USB20_EXTENSION = 0x02, + USB_DC_USB20_EXTENSION = 0x02, }; /** @@ -221,7 +221,7 @@ enum usb_capability_type { * To fill bmAttributes field of usb_capa_ext_desc_t structure. */ enum usb_capability_extension_attr { - USB_DC_EXT_LPM = 0x00000002, + USB_DC_EXT_LPM = 0x00000002, }; #define HIRD_50_US 0 @@ -254,18 +254,18 @@ enum usb_capability_extension_attr { * \brief Standard USB endpoint transfer types */ enum usb_ep_type { - USB_EP_TYPE_CONTROL = 0x00, - USB_EP_TYPE_ISOCHRONOUS = 0x01, - USB_EP_TYPE_BULK = 0x02, - USB_EP_TYPE_INTERRUPT = 0x03, - USB_EP_TYPE_MASK = 0x03, + USB_EP_TYPE_CONTROL = 0x00, + USB_EP_TYPE_ISOCHRONOUS = 0x01, + USB_EP_TYPE_BULK = 0x02, + USB_EP_TYPE_INTERRUPT = 0x03, + USB_EP_TYPE_MASK = 0x03, }; /** * \brief Standard USB language IDs for string descriptors */ enum usb_langid { - USB_LANGID_EN_US = 0x0409, //!< English (United States) + USB_LANGID_EN_US = 0x0409, //!< English (United States) }; /** @@ -308,31 +308,31 @@ COMPILER_PACK_SET(1) * The data payload of SETUP packets always follows this structure. */ typedef struct { - uint8_t bmRequestType; - uint8_t bRequest; - le16_t wValue; - le16_t wIndex; - le16_t wLength; + uint8_t bmRequestType; + uint8_t bRequest; + le16_t wValue; + le16_t wIndex; + le16_t wLength; } usb_setup_req_t; /** * \brief Standard USB device descriptor structure */ typedef struct { - uint8_t bLength; - uint8_t bDescriptorType; - le16_t bcdUSB; - uint8_t bDeviceClass; - uint8_t bDeviceSubClass; - uint8_t bDeviceProtocol; - uint8_t bMaxPacketSize0; - le16_t idVendor; - le16_t idProduct; - le16_t bcdDevice; - uint8_t iManufacturer; - uint8_t iProduct; - uint8_t iSerialNumber; - uint8_t bNumConfigurations; + uint8_t bLength; + uint8_t bDescriptorType; + le16_t bcdUSB; + uint8_t bDeviceClass; + uint8_t bDeviceSubClass; + uint8_t bDeviceProtocol; + uint8_t bMaxPacketSize0; + le16_t idVendor; + le16_t idProduct; + le16_t bcdDevice; + uint8_t iManufacturer; + uint8_t iProduct; + uint8_t iSerialNumber; + uint8_t bNumConfigurations; } usb_dev_desc_t; /** @@ -344,15 +344,15 @@ typedef struct { * the device was operating at full speed.) */ typedef struct { - uint8_t bLength; - uint8_t bDescriptorType; - le16_t bcdUSB; - uint8_t bDeviceClass; - uint8_t bDeviceSubClass; - uint8_t bDeviceProtocol; - uint8_t bMaxPacketSize0; - uint8_t bNumConfigurations; - uint8_t bReserved; + uint8_t bLength; + uint8_t bDescriptorType; + le16_t bcdUSB; + uint8_t bDeviceClass; + uint8_t bDeviceSubClass; + uint8_t bDeviceProtocol; + uint8_t bMaxPacketSize0; + uint8_t bNumConfigurations; + uint8_t bReserved; } usb_dev_qual_desc_t; /** @@ -368,10 +368,10 @@ typedef struct { * The descriptor type in the GetDescriptor() request is set to BOS. */ typedef struct { - uint8_t bLength; - uint8_t bDescriptorType; - le16_t wTotalLength; - uint8_t bNumDeviceCaps; + uint8_t bLength; + uint8_t bDescriptorType; + le16_t wTotalLength; + uint8_t bNumDeviceCaps; } usb_dev_bos_desc_t; @@ -381,10 +381,10 @@ typedef struct { * Defines the set of USB 1.1-specific device level capabilities. */ typedef struct { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDevCapabilityType; - le32_t bmAttributes; + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bDevCapabilityType; + le32_t bmAttributes; } usb_dev_capa_ext_desc_t; /** @@ -393,22 +393,22 @@ typedef struct { * The BOS descriptor and capabilities descriptors for LPM. */ typedef struct { - usb_dev_bos_desc_t bos; - usb_dev_capa_ext_desc_t capa_ext; + usb_dev_bos_desc_t bos; + usb_dev_capa_ext_desc_t capa_ext; } usb_dev_lpm_desc_t; /** * \brief Standard USB Interface Association Descriptor structure */ typedef struct { - uint8_t bLength; //!< size of this descriptor in bytes - uint8_t bDescriptorType; //!< INTERFACE descriptor type - uint8_t bFirstInterface; //!< Number of interface - uint8_t bInterfaceCount; //!< value to select alternate setting - uint8_t bFunctionClass; //!< Class code assigned by the USB - uint8_t bFunctionSubClass;//!< Sub-class code assigned by the USB - uint8_t bFunctionProtocol;//!< Protocol code assigned by the USB - uint8_t iFunction; //!< Index of string descriptor + uint8_t bLength; //!< size of this descriptor in bytes + uint8_t bDescriptorType; //!< INTERFACE descriptor type + uint8_t bFirstInterface; //!< Number of interface + uint8_t bInterfaceCount; //!< value to select alternate setting + uint8_t bFunctionClass; //!< Class code assigned by the USB + uint8_t bFunctionSubClass;//!< Sub-class code assigned by the USB + uint8_t bFunctionProtocol;//!< Protocol code assigned by the USB + uint8_t iFunction; //!< Index of string descriptor } usb_association_desc_t; @@ -416,14 +416,14 @@ typedef struct { * \brief Standard USB configuration descriptor structure */ typedef struct { - uint8_t bLength; - uint8_t bDescriptorType; - le16_t wTotalLength; - uint8_t bNumInterfaces; - uint8_t bConfigurationValue; - uint8_t iConfiguration; - uint8_t bmAttributes; - uint8_t bMaxPower; + uint8_t bLength; + uint8_t bDescriptorType; + le16_t wTotalLength; + uint8_t bNumInterfaces; + uint8_t bConfigurationValue; + uint8_t iConfiguration; + uint8_t bmAttributes; + uint8_t bMaxPower; } usb_conf_desc_t; @@ -438,41 +438,41 @@ typedef struct { * \brief Standard USB association descriptor structure */ typedef struct { - uint8_t bLength; //!< Size of this descriptor in bytes - uint8_t bDescriptorType; //!< Interface descriptor type - uint8_t bFirstInterface; //!< Number of interface - uint8_t bInterfaceCount; //!< value to select alternate setting - uint8_t bFunctionClass; //!< Class code assigned by the USB - uint8_t bFunctionSubClass; //!< Sub-class code assigned by the USB - uint8_t bFunctionProtocol; //!< Protocol code assigned by the USB - uint8_t iFunction; //!< Index of string descriptor + uint8_t bLength; //!< Size of this descriptor in bytes + uint8_t bDescriptorType; //!< Interface descriptor type + uint8_t bFirstInterface; //!< Number of interface + uint8_t bInterfaceCount; //!< value to select alternate setting + uint8_t bFunctionClass; //!< Class code assigned by the USB + uint8_t bFunctionSubClass; //!< Sub-class code assigned by the USB + uint8_t bFunctionProtocol; //!< Protocol code assigned by the USB + uint8_t iFunction; //!< Index of string descriptor } usb_iad_desc_t; /** * \brief Standard USB interface descriptor structure */ typedef struct { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bInterfaceNumber; - uint8_t bAlternateSetting; - uint8_t bNumEndpoints; - uint8_t bInterfaceClass; - uint8_t bInterfaceSubClass; - uint8_t bInterfaceProtocol; - uint8_t iInterface; + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bInterfaceNumber; + uint8_t bAlternateSetting; + uint8_t bNumEndpoints; + uint8_t bInterfaceClass; + uint8_t bInterfaceSubClass; + uint8_t bInterfaceProtocol; + uint8_t iInterface; } usb_iface_desc_t; /** * \brief Standard USB endpoint descriptor structure */ typedef struct { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bEndpointAddress; - uint8_t bmAttributes; - le16_t wMaxPacketSize; - uint8_t bInterval; + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bEndpointAddress; + uint8_t bmAttributes; + le16_t wMaxPacketSize; + uint8_t bInterval; } usb_ep_desc_t; @@ -480,13 +480,13 @@ typedef struct { * \brief A standard USB string descriptor structure */ typedef struct { - uint8_t bLength; - uint8_t bDescriptorType; + uint8_t bLength; + uint8_t bDescriptorType; } usb_str_desc_t; typedef struct { - usb_str_desc_t desc; - le16_t string[1]; + usb_str_desc_t desc; + le16_t string[1]; } usb_str_lgid_desc_t; COMPILER_PACK_RESET() diff --git a/Marlin/src/HAL/DUE/usb/usb_protocol_cdc.h b/Marlin/src/HAL/DUE/usb/usb_protocol_cdc.h index d594db52e33b2..9b82afc6242be 100644 --- a/Marlin/src/HAL/DUE/usb/usb_protocol_cdc.h +++ b/Marlin/src/HAL/DUE/usb/usb_protocol_cdc.h @@ -58,42 +58,42 @@ * \name Possible values of class */ //@{ -#define CDC_CLASS_DEVICE 0x02 //!< USB Communication Device Class -#define CDC_CLASS_COMM 0x02 //!< CDC Communication Class Interface -#define CDC_CLASS_DATA 0x0A //!< CDC Data Class Interface +#define CDC_CLASS_DEVICE 0x02 //!< USB Communication Device Class +#define CDC_CLASS_COMM 0x02 //!< CDC Communication Class Interface +#define CDC_CLASS_DATA 0x0A //!< CDC Data Class Interface #define CDC_CLASS_MULTI 0xEF //!< CDC Multi-interface Function //@} //! \name USB CDC Subclass IDs //@{ -#define CDC_SUBCLASS_DLCM 0x01 //!< Direct Line Control Model -#define CDC_SUBCLASS_ACM 0x02 //!< Abstract Control Model -#define CDC_SUBCLASS_TCM 0x03 //!< Telephone Control Model -#define CDC_SUBCLASS_MCCM 0x04 //!< Multi-Channel Control Model -#define CDC_SUBCLASS_CCM 0x05 //!< CAPI Control Model -#define CDC_SUBCLASS_ETH 0x06 //!< Ethernet Networking Control Model -#define CDC_SUBCLASS_ATM 0x07 //!< ATM Networking Control Model +#define CDC_SUBCLASS_DLCM 0x01 //!< Direct Line Control Model +#define CDC_SUBCLASS_ACM 0x02 //!< Abstract Control Model +#define CDC_SUBCLASS_TCM 0x03 //!< Telephone Control Model +#define CDC_SUBCLASS_MCCM 0x04 //!< Multi-Channel Control Model +#define CDC_SUBCLASS_CCM 0x05 //!< CAPI Control Model +#define CDC_SUBCLASS_ETH 0x06 //!< Ethernet Networking Control Model +#define CDC_SUBCLASS_ATM 0x07 //!< ATM Networking Control Model //@} //! \name USB CDC Communication Interface Protocol IDs //@{ -#define CDC_PROTOCOL_V25TER 0x01 //!< Common AT commands +#define CDC_PROTOCOL_V25TER 0x01 //!< Common AT commands //@} //! \name USB CDC Data Interface Protocol IDs //@{ -#define CDC_PROTOCOL_I430 0x30 //!< ISDN BRI -#define CDC_PROTOCOL_HDLC 0x31 //!< HDLC -#define CDC_PROTOCOL_TRANS 0x32 //!< Transparent -#define CDC_PROTOCOL_Q921M 0x50 //!< Q.921 management protocol -#define CDC_PROTOCOL_Q921 0x51 //!< Q.931 [sic] Data link protocol -#define CDC_PROTOCOL_Q921TM 0x52 //!< Q.921 TEI-multiplexor -#define CDC_PROTOCOL_V42BIS 0x90 //!< Data compression procedures -#define CDC_PROTOCOL_Q931 0x91 //!< Euro-ISDN protocol control -#define CDC_PROTOCOL_V120 0x92 //!< V.24 rate adaption to ISDN -#define CDC_PROTOCOL_CAPI20 0x93 //!< CAPI Commands -#define CDC_PROTOCOL_HOST 0xFD //!< Host based driver +#define CDC_PROTOCOL_I430 0x30 //!< ISDN BRI +#define CDC_PROTOCOL_HDLC 0x31 //!< HDLC +#define CDC_PROTOCOL_TRANS 0x32 //!< Transparent +#define CDC_PROTOCOL_Q921M 0x50 //!< Q.921 management protocol +#define CDC_PROTOCOL_Q921 0x51 //!< Q.931 [sic] Data link protocol +#define CDC_PROTOCOL_Q921TM 0x52 //!< Q.921 TEI-multiplexor +#define CDC_PROTOCOL_V42BIS 0x90 //!< Data compression procedures +#define CDC_PROTOCOL_Q931 0x91 //!< Euro-ISDN protocol control +#define CDC_PROTOCOL_V120 0x92 //!< V.24 rate adaption to ISDN +#define CDC_PROTOCOL_CAPI20 0x93 //!< CAPI Commands +#define CDC_PROTOCOL_HOST 0xFD //!< Host based driver /** * \brief Describes the Protocol Unit Functional Descriptors [sic] * on Communication Class Interface @@ -103,16 +103,16 @@ //! \name USB CDC Functional Descriptor Types //@{ -#define CDC_CS_INTERFACE 0x24 //!< Interface Functional Descriptor -#define CDC_CS_ENDPOINT 0x25 //!< Endpoint Functional Descriptor +#define CDC_CS_INTERFACE 0x24 //!< Interface Functional Descriptor +#define CDC_CS_ENDPOINT 0x25 //!< Endpoint Functional Descriptor //@} //! \name USB CDC Functional Descriptor Subtypes //@{ -#define CDC_SCS_HEADER 0x00 //!< Header Functional Descriptor -#define CDC_SCS_CALL_MGMT 0x01 //!< Call Management -#define CDC_SCS_ACM 0x02 //!< Abstract Control Management -#define CDC_SCS_UNION 0x06 //!< Union Functional Descriptor +#define CDC_SCS_HEADER 0x00 //!< Header Functional Descriptor +#define CDC_SCS_CALL_MGMT 0x01 //!< Call Management +#define CDC_SCS_ACM 0x02 //!< Abstract Control Management +#define CDC_SCS_UNION 0x06 //!< Union Functional Descriptor //@} //! \name USB CDC Request IDs @@ -171,36 +171,36 @@ COMPILER_PACK_SET(1) //! CDC Header Functional Descriptor typedef struct { - uint8_t bFunctionLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubtype; - le16_t bcdCDC; + uint8_t bFunctionLength; + uint8_t bDescriptorType; + uint8_t bDescriptorSubtype; + le16_t bcdCDC; } usb_cdc_hdr_desc_t; //! CDC Call Management Functional Descriptor typedef struct { - uint8_t bFunctionLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubtype; - uint8_t bmCapabilities; - uint8_t bDataInterface; + uint8_t bFunctionLength; + uint8_t bDescriptorType; + uint8_t bDescriptorSubtype; + uint8_t bmCapabilities; + uint8_t bDataInterface; } usb_cdc_call_mgmt_desc_t; //! CDC ACM Functional Descriptor typedef struct { - uint8_t bFunctionLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubtype; - uint8_t bmCapabilities; + uint8_t bFunctionLength; + uint8_t bDescriptorType; + uint8_t bDescriptorSubtype; + uint8_t bmCapabilities; } usb_cdc_acm_desc_t; //! CDC Union Functional Descriptor typedef struct { - uint8_t bFunctionLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubtype; - uint8_t bMasterInterface; - uint8_t bSlaveInterface0; + uint8_t bFunctionLength; + uint8_t bDescriptorType; + uint8_t bDescriptorSubtype; + uint8_t bMasterInterface; + uint8_t bSlaveInterface0; } usb_cdc_union_desc_t; @@ -235,24 +235,24 @@ typedef struct { //@{ //! Line Coding structure typedef struct { - le32_t dwDTERate; - uint8_t bCharFormat; - uint8_t bParityType; - uint8_t bDataBits; + le32_t dwDTERate; + uint8_t bCharFormat; + uint8_t bParityType; + uint8_t bDataBits; } usb_cdc_line_coding_t; //! Possible values of bCharFormat enum cdc_char_format { - CDC_STOP_BITS_1 = 0, //!< 1 stop bit - CDC_STOP_BITS_1_5 = 1, //!< 1.5 stop bits - CDC_STOP_BITS_2 = 2, //!< 2 stop bits + CDC_STOP_BITS_1 = 0, //!< 1 stop bit + CDC_STOP_BITS_1_5 = 1, //!< 1.5 stop bits + CDC_STOP_BITS_2 = 2, //!< 2 stop bits }; //! Possible values of bParityType enum cdc_parity { - CDC_PAR_NONE = 0, //!< No parity - CDC_PAR_ODD = 1, //!< Odd parity - CDC_PAR_EVEN = 2, //!< Even parity - CDC_PAR_MARK = 3, //!< Parity forced to 0 (space) - CDC_PAR_SPACE = 4, //!< Parity forced to 1 (mark) + CDC_PAR_NONE = 0, //!< No parity + CDC_PAR_ODD = 1, //!< Odd parity + CDC_PAR_EVEN = 2, //!< Even parity + CDC_PAR_MARK = 3, //!< Parity forced to 0 (space) + CDC_PAR_SPACE = 4, //!< Parity forced to 1 (mark) }; //@} @@ -262,7 +262,7 @@ enum cdc_parity { //! Control signal structure typedef struct { - uint16_t value; + uint16_t value; } usb_cdc_control_signal_t; //! \name Possible values in usb_cdc_control_signal_t @@ -283,11 +283,11 @@ typedef struct { //@{ typedef struct { - uint8_t bmRequestType; - uint8_t bNotification; - le16_t wValue; - le16_t wIndex; - le16_t wLength; + uint8_t bmRequestType; + uint8_t bNotification; + le16_t wValue; + le16_t wIndex; + le16_t wLength; } usb_cdc_notify_msg_t; //! \name USB CDC serial state @@ -295,8 +295,8 @@ typedef struct { //! Hardware handshake support (cdc spec 1.1 chapter 6.3.5) typedef struct { - usb_cdc_notify_msg_t header; - le16_t value; + usb_cdc_notify_msg_t header; + le16_t value; } usb_cdc_notify_serial_state_t; //! \name Possible values in usb_cdc_notify_serial_state_t diff --git a/Marlin/src/HAL/DUE/usb/usb_protocol_msc.h b/Marlin/src/HAL/DUE/usb/usb_protocol_msc.h index e1e59237d8232..cc30a94e4fc89 100644 --- a/Marlin/src/HAL/DUE/usb/usb_protocol_msc.h +++ b/Marlin/src/HAL/DUE/usb/usb_protocol_msc.h @@ -59,7 +59,7 @@ * \name Possible Class value */ //@{ -#define MSC_CLASS 0x08 +#define MSC_CLASS 0x08 //@} /** @@ -71,12 +71,12 @@ * operating systems like Windows XP. */ //@{ -#define MSC_SUBCLASS_RBC 0x01 //!< Reduced Block Commands -#define MSC_SUBCLASS_ATAPI 0x02 //!< CD/DVD devices -#define MSC_SUBCLASS_QIC_157 0x03 //!< Tape devices -#define MSC_SUBCLASS_UFI 0x04 //!< Floppy disk drives -#define MSC_SUBCLASS_SFF_8070I 0x05 //!< Floppy disk drives -#define MSC_SUBCLASS_TRANSPARENT 0x06 //!< Determined by INQUIRY +#define MSC_SUBCLASS_RBC 0x01 //!< Reduced Block Commands +#define MSC_SUBCLASS_ATAPI 0x02 //!< CD/DVD devices +#define MSC_SUBCLASS_QIC_157 0x03 //!< Tape devices +#define MSC_SUBCLASS_UFI 0x04 //!< Floppy disk drives +#define MSC_SUBCLASS_SFF_8070I 0x05 //!< Floppy disk drives +#define MSC_SUBCLASS_TRANSPARENT 0x06 //!< Determined by INQUIRY //@} /** @@ -84,9 +84,9 @@ * \note Only the BULK protocol should be used in new designs. */ //@{ -#define MSC_PROTOCOL_CBI 0x00 //!< Command/Bulk/Interrupt -#define MSC_PROTOCOL_CBI_ALT 0x01 //!< W/o command completion -#define MSC_PROTOCOL_BULK 0x50 //!< Bulk-only +#define MSC_PROTOCOL_CBI 0x00 //!< Command/Bulk/Interrupt +#define MSC_PROTOCOL_CBI_ALT 0x01 //!< W/o command completion +#define MSC_PROTOCOL_BULK 0x50 //!< Bulk-only //@} @@ -94,8 +94,8 @@ * \brief MSC USB requests (bRequest) */ enum usb_reqid_msc { - USB_REQ_MSC_BULK_RESET = 0xFF, //!< Mass Storage Reset - USB_REQ_MSC_GET_MAX_LUN = 0xFE //!< Get Max LUN + USB_REQ_MSC_BULK_RESET = 0xFF, //!< Mass Storage Reset + USB_REQ_MSC_GET_MAX_LUN = 0xFE //!< Get Max LUN }; @@ -106,20 +106,20 @@ COMPILER_PACK_SET(1) */ //@{ struct usb_msc_cbw { - le32_t dCBWSignature; //!< Must contain 'USBC' - le32_t dCBWTag; //!< Unique command ID - le32_t dCBWDataTransferLength; //!< Number of bytes to transfer - uint8_t bmCBWFlags; //!< Direction in bit 7 - uint8_t bCBWLUN; //!< Logical Unit Number - uint8_t bCBWCBLength; //!< Number of valid CDB bytes - uint8_t CDB[16]; //!< SCSI Command Descriptor Block + le32_t dCBWSignature; //!< Must contain 'USBC' + le32_t dCBWTag; //!< Unique command ID + le32_t dCBWDataTransferLength; //!< Number of bytes to transfer + uint8_t bmCBWFlags; //!< Direction in bit 7 + uint8_t bCBWLUN; //!< Logical Unit Number + uint8_t bCBWCBLength; //!< Number of valid CDB bytes + uint8_t CDB[16]; //!< SCSI Command Descriptor Block }; -#define USB_CBW_SIGNATURE 0x55534243 //!< dCBWSignature value -#define USB_CBW_DIRECTION_IN (1<<7) //!< Data from device to host -#define USB_CBW_DIRECTION_OUT (0<<7) //!< Data from host to device -#define USB_CBW_LUN_MASK 0x0F //!< Valid bits in bCBWLUN -#define USB_CBW_LEN_MASK 0x1F //!< Valid bits in bCBWCBLength +#define USB_CBW_SIGNATURE 0x55534243 //!< dCBWSignature value +#define USB_CBW_DIRECTION_IN (1<<7) //!< Data from device to host +#define USB_CBW_DIRECTION_OUT (0<<7) //!< Data from host to device +#define USB_CBW_LUN_MASK 0x0F //!< Valid bits in bCBWLUN +#define USB_CBW_LEN_MASK 0x1F //!< Valid bits in bCBWCBLength //@} @@ -128,16 +128,16 @@ struct usb_msc_cbw { */ //@{ struct usb_msc_csw { - le32_t dCSWSignature; //!< Must contain 'USBS' - le32_t dCSWTag; //!< Same as dCBWTag - le32_t dCSWDataResidue; //!< Number of bytes not transferred - uint8_t bCSWStatus; //!< Status code + le32_t dCSWSignature; //!< Must contain 'USBS' + le32_t dCSWTag; //!< Same as dCBWTag + le32_t dCSWDataResidue; //!< Number of bytes not transferred + uint8_t bCSWStatus; //!< Status code }; -#define USB_CSW_SIGNATURE 0x55534253 //!< dCSWSignature value -#define USB_CSW_STATUS_PASS 0x00 //!< Command Passed -#define USB_CSW_STATUS_FAIL 0x01 //!< Command Failed -#define USB_CSW_STATUS_PE 0x02 //!< Phase Error +#define USB_CSW_SIGNATURE 0x55534253 //!< dCSWSignature value +#define USB_CSW_STATUS_PASS 0x00 //!< Command Passed +#define USB_CSW_STATUS_FAIL 0x01 //!< Command Failed +#define USB_CSW_STATUS_PE 0x02 //!< Phase Error //@} COMPILER_PACK_RESET() diff --git a/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/board/board.h b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/board/board.h index 80261d30274d1..5664a1ad2c680 100644 --- a/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/board/board.h +++ b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/board/board.h @@ -100,12 +100,12 @@ /* * SDIO Pins */ -#define BOARD_SDIO_D0 PC8 -#define BOARD_SDIO_D1 PC9 -#define BOARD_SDIO_D2 PC10 -#define BOARD_SDIO_D3 PC11 -#define BOARD_SDIO_CLK PC12 -#define BOARD_SDIO_CMD PD2 +#define BOARD_SDIO_D0 PC8 +#define BOARD_SDIO_D1 PC9 +#define BOARD_SDIO_D2 PC10 +#define BOARD_SDIO_D3 PC11 +#define BOARD_SDIO_CLK PC12 +#define BOARD_SDIO_CMD PD2 /* Pin aliases: these give the GPIO port/bit for each pin as an * enum. These are optional, but recommended. They make it easier to diff --git a/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/board/board.h b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/board/board.h index 6ffa2447460d1..24458fe79ab29 100644 --- a/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/board/board.h +++ b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/board/board.h @@ -100,12 +100,12 @@ /* * SDIO Pins */ -#define BOARD_SDIO_D0 PC8 -#define BOARD_SDIO_D1 PC9 -#define BOARD_SDIO_D2 PC10 -#define BOARD_SDIO_D3 PC11 -#define BOARD_SDIO_CLK PC12 -#define BOARD_SDIO_CMD PD2 +#define BOARD_SDIO_D0 PC8 +#define BOARD_SDIO_D1 PC9 +#define BOARD_SDIO_D2 PC10 +#define BOARD_SDIO_D3 PC11 +#define BOARD_SDIO_CLK PC12 +#define BOARD_SDIO_CMD PD2 /* Pin aliases: these give the GPIO port/bit for each pin as an * enum. These are optional, but recommended. They make it easier to