From 6f5e6fd25b80aa994b2a887e0c20d3a67e3d2fb5 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 9 Apr 2025 18:41:12 -0500 Subject: [PATCH 01/86] =?UTF-8?q?=F0=9F=A9=B9=20TFT=5FBUFFER=5FSIZE=20=3D>?= =?UTF-8?q?=20=5FWORDS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #26011 --- Marlin/src/pins/rp2040/pins_RP2040.h | 2 +- .../pins/stm32f4/pins_BTT_SKR_V2_0_common.h | 2 +- .../src/pins/stm32f4/pins_MELLOW_FLY_E3_V2.h | 2 +- .../pins/stm32f4/pins_MKS_NEPTUNE_X_common.h | 39 +------------------ 4 files changed, 5 insertions(+), 40 deletions(-) diff --git a/Marlin/src/pins/rp2040/pins_RP2040.h b/Marlin/src/pins/rp2040/pins_RP2040.h index 48e37e4e1f..6a4e54f0bd 100644 --- a/Marlin/src/pins/rp2040/pins_RP2040.h +++ b/Marlin/src/pins/rp2040/pins_RP2040.h @@ -293,7 +293,7 @@ #define SPI_FLASH_SCK_PIN SD_SCK_PIN #endif - #define TFT_BUFFER_SIZE 0xFFFF + #define TFT_BUFFER_WORDS 0xFFFF #ifndef TFT_DRIVER #define TFT_DRIVER ST7796 #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 692b50be40..51b27efa39 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 @@ -483,7 +483,7 @@ #elif ENABLED(FYSETC_MINI_12864_2_1) #define NEOPIXEL_PIN EXP1_06_PIN #endif - #endif // !FYSETC_MINI_12864 + #endif // FYSETC_MINI_12864 #if IS_ULTIPANEL #define LCD_PINS_D5 EXP1_06_PIN diff --git a/Marlin/src/pins/stm32f4/pins_MELLOW_FLY_E3_V2.h b/Marlin/src/pins/stm32f4/pins_MELLOW_FLY_E3_V2.h index 3ae1432a14..4626176a99 100644 --- a/Marlin/src/pins/stm32f4/pins_MELLOW_FLY_E3_V2.h +++ b/Marlin/src/pins/stm32f4/pins_MELLOW_FLY_E3_V2.h @@ -472,7 +472,7 @@ #define LCD_READ_ID 0xD3 #define LCD_USE_DMA_SPI - #define TFT_BUFFER_SIZE 14400 + #define TFT_BUFFER_WORDS 14400 #endif diff --git a/Marlin/src/pins/stm32f4/pins_MKS_NEPTUNE_X_common.h b/Marlin/src/pins/stm32f4/pins_MKS_NEPTUNE_X_common.h index 7d1d7943cf..4e59f1c5dd 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_NEPTUNE_X_common.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_NEPTUNE_X_common.h @@ -208,41 +208,6 @@ #define MKS_TEST_PS_ON_PIN PB2 // PW_OFF #endif -// -// TFT with FSMC interface -// -#if HAS_FSMC_TFT - /** - * Note: MKS Robin TFT screens use various TFT controllers. - * If the screen stays white, disable 'TFT_RESET_PIN' - * to let the bootloader init the screen. - */ - #define TFT_RESET_PIN PC6 // FSMC_RST - #define TFT_BACKLIGHT_PIN PD13 - - #define DOGLCD_MOSI -1 // Prevent auto-define by Conditionals_post.h - #define DOGLCD_SCK -1 - - #define TOUCH_CS_PIN PA7 // SPI2_NSS - #define TOUCH_SCK_PIN PB13 // SPI2_SCK - #define TOUCH_MISO_PIN PB14 // SPI2_MISO - #define TOUCH_MOSI_PIN PB15 // SPI2_MOSI - - #define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT - #define FSMC_CS_PIN PD7 - #define FSMC_RS_PIN PD11 - #define FSMC_DMA_DEV DMA2 - #define FSMC_DMA_CHANNEL DMA_CH5 - - #define TFT_CS_PIN FSMC_CS_PIN - #define TFT_RS_PIN FSMC_RS_PIN - - #define TOUCH_BUTTONS_HW_SPI - #define TOUCH_BUTTONS_HW_SPI_DEVICE 2 - - #define TFT_BUFFER_SIZE 14400 -#endif - // // Onboard SD card // @@ -305,5 +270,5 @@ #define TOUCH_BUTTONS_HW_SPI #define TOUCH_BUTTONS_HW_SPI_DEVICE 2 - #define TFT_BUFFER_SIZE 14400 -#endif + #define TFT_BUFFER_WORDS 14400 +#endif // HAS_FSMC_TFT From 47820cac8a20987508236cdc4de639502f500b2f Mon Sep 17 00:00:00 2001 From: Andrew <18502096+classicrocker883@users.noreply.github.com> Date: Wed, 9 Apr 2025 20:08:10 -0400 Subject: [PATCH 02/86] =?UTF-8?q?=F0=9F=8E=A8=20Whitespace=20cleanups=20(#?= =?UTF-8?q?27784)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Makefile | 10 +- Marlin/src/HAL/AVR/pinsDebug_plus_70.h | 504 ++++++++--------- Marlin/src/HAL/DUE/HAL_SPI.cpp | 14 +- Marlin/src/HAL/RP2040/timers.h | 8 +- Marlin/src/HAL/STM32F1/HAL_N32.h | 16 +- Marlin/src/HAL/STM32F1/sdio.cpp | 2 +- Marlin/src/HAL/TEENSY31_32/fastio.h | 6 +- Marlin/src/HAL/TEENSY35_36/fastio.h | 6 +- Marlin/src/core/serial_base.h | 2 +- Marlin/src/core/types.h | 4 +- Marlin/src/feature/bedlevel/ubl/ubl.h | 2 +- Marlin/src/gcode/host/M360.cpp | 2 +- Marlin/src/inc/Conditionals-2-LCD.h | 2 +- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 4 +- Marlin/src/lcd/e3v2/proui/menus.cpp | 4 +- .../lcd/extui/anycubic_chiron/chiron_tft.cpp | 4 +- .../src/lcd/extui/anycubic_vyper/dgus_tft.cpp | 4 +- .../lcd/extui/dgus/fysetc/DGUSDisplayDef.cpp | 2 +- .../lcd/extui/dgus/fysetc/DGUSDisplayDef.h | 12 +- .../lcd/extui/dgus/hiprecy/DGUSDisplayDef.cpp | 2 +- .../lcd/extui/dgus/hiprecy/DGUSDisplayDef.h | 10 +- .../src/lcd/extui/dgus/mks/DGUSDisplayDef.cpp | 12 +- .../src/lcd/extui/dgus/mks/DGUSDisplayDef.h | 12 +- .../lcd/extui/dgus/origin/DGUSDisplayDef.cpp | 2 +- .../lcd/extui/dgus/origin/DGUSDisplayDef.h | 10 +- .../ftdi_eve_lib/scripts/font2cpp.py | 2 +- Marlin/src/lcd/extui/mks_ui/tft_Language_en.h | 4 +- Marlin/src/lcd/extui/mks_ui/tft_Language_it.h | 4 +- Marlin/src/lcd/extui/mks_ui/tft_Language_ru.h | 4 +- Marlin/src/lcd/extui/ui_api.h | 4 +- Marlin/src/lcd/tft/ui_color_ui.cpp | 6 +- Marlin/src/module/scara.cpp | 4 +- Marlin/src/module/temperature.cpp | 4 +- Marlin/src/module/thermistor/thermistor_666.h | 2 +- Marlin/src/pins/sam/pins_ALLIGATOR_R2.h | 2 +- .../src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h | 2 +- Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h | 2 +- .../usb_flashdrive/lib-uhs3/dyn_SWI/dyn_SWI.h | 2 +- buildroot/share/PlatformIO/scripts/exc.S | 2 +- .../variants/MARLIN_FLY_D5/ldscript.ld | 2 +- .../variants/MARLIN_FLY_D7/ldscript.ld | 2 +- .../MARLIN_MEGA_EXTENDED/pins_arduino.h | 516 +++++++++--------- .../marlin_maple_CHITU_F103/board.cpp | 128 ++--- .../variants/marlin_maple_MEEB_3DP/board.cpp | 6 +- .../scripts/createTemperatureLookupMarlin.py | 2 +- buildroot/tests/BTT_GTR_V1_0 | 2 +- docs/Cutter.md | 2 +- ini/hc32.ini | 12 +- 48 files changed, 686 insertions(+), 686 deletions(-) diff --git a/Marlin/Makefile b/Marlin/Makefile index 63b1029e1b..ce26bd3572 100644 --- a/Marlin/Makefile +++ b/Marlin/Makefile @@ -127,9 +127,9 @@ NEOPIXEL ?= 0 # on GCC versions: # https://www.avrfreaks.net/comment/1789106#comment-1789106 -CC_MAJ:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC__ | cut -f3 -d\ ) -CC_MIN:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC_MINOR__ | cut -f3 -d\ ) -CC_PATCHLEVEL:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC_PATCHLEVEL__ | cut -f3 -d\ ) +CC_MAJ:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC__ | cut -f3 -d' ' ) +CC_MIN:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC_MINOR__ | cut -f3 -d' ' ) +CC_PATCHLEVEL:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC_PATCHLEVEL__ | cut -f3 -d' ' ) CC_VER:=$(shell echo $$(( $(CC_MAJ) * 10000 + $(CC_MIN) * 100 + $(CC_PATCHLEVEL) ))) ifeq ($(shell test $(CC_VER) -lt 40901 && echo 1),1) $(warning This GCC version $(CC_VER) is likely broken. Enabling relocation workaround.) @@ -868,8 +868,8 @@ else ifeq ($(HARDWARE_VARIANT), archim) endif # Add all the source directories as include directories too -CINCS = ${addprefix -I ,${VPATH}} -CXXINCS = ${addprefix -I ,${VPATH}} +CINCS = ${addprefix -I, ${VPATH}} +CXXINCS = ${addprefix -I, ${VPATH}} # Silence warnings for library code (won't work for .h files, unfortunately) LIBWARN = -w -Wno-packed-bitfield-compat diff --git a/Marlin/src/HAL/AVR/pinsDebug_plus_70.h b/Marlin/src/HAL/AVR/pinsDebug_plus_70.h index fa479cfe8f..6565acd523 100644 --- a/Marlin/src/HAL/AVR/pinsDebug_plus_70.h +++ b/Marlin/src/HAL/AVR/pinsDebug_plus_70.h @@ -48,92 +48,92 @@ const uint8_t PROGMEM digital_pin_to_port_PGM_plus_70[] = { // PORTLIST // ------------------------ - PE , // PE 0 ** 0 ** USART0_RX - PE , // PE 1 ** 1 ** USART0_TX - PE , // PE 4 ** 2 ** PWM2 - PE , // PE 5 ** 3 ** PWM3 - PG , // PG 5 ** 4 ** PWM4 - PE , // PE 3 ** 5 ** PWM5 - PH , // PH 3 ** 6 ** PWM6 - PH , // PH 4 ** 7 ** PWM7 - PH , // PH 5 ** 8 ** PWM8 - PH , // PH 6 ** 9 ** PWM9 - PB , // PB 4 ** 10 ** PWM10 - PB , // PB 5 ** 11 ** PWM11 - PB , // PB 6 ** 12 ** PWM12 - PB , // PB 7 ** 13 ** PWM13 - PJ , // PJ 1 ** 14 ** USART3_TX - PJ , // PJ 0 ** 15 ** USART3_RX - PH , // PH 1 ** 16 ** USART2_TX - PH , // PH 0 ** 17 ** USART2_RX - PD , // PD 3 ** 18 ** USART1_TX - PD , // PD 2 ** 19 ** USART1_RX - PD , // PD 1 ** 20 ** I2C_SDA - PD , // PD 0 ** 21 ** I2C_SCL - PA , // PA 0 ** 22 ** D22 - PA , // PA 1 ** 23 ** D23 - PA , // PA 2 ** 24 ** D24 - PA , // PA 3 ** 25 ** D25 - PA , // PA 4 ** 26 ** D26 - PA , // PA 5 ** 27 ** D27 - PA , // PA 6 ** 28 ** D28 - PA , // PA 7 ** 29 ** D29 - PC , // PC 7 ** 30 ** D30 - PC , // PC 6 ** 31 ** D31 - PC , // PC 5 ** 32 ** D32 - PC , // PC 4 ** 33 ** D33 - PC , // PC 3 ** 34 ** D34 - PC , // PC 2 ** 35 ** D35 - PC , // PC 1 ** 36 ** D36 - PC , // PC 0 ** 37 ** D37 - PD , // PD 7 ** 38 ** D38 - PG , // PG 2 ** 39 ** D39 - PG , // PG 1 ** 40 ** D40 - PG , // PG 0 ** 41 ** D41 - PL , // PL 7 ** 42 ** D42 - PL , // PL 6 ** 43 ** D43 - PL , // PL 5 ** 44 ** D44 - PL , // PL 4 ** 45 ** D45 - PL , // PL 3 ** 46 ** D46 - PL , // PL 2 ** 47 ** D47 - PL , // PL 1 ** 48 ** D48 - PL , // PL 0 ** 49 ** D49 - PB , // PB 3 ** 50 ** SPI_MISO - PB , // PB 2 ** 51 ** SPI_MOSI - PB , // PB 1 ** 52 ** SPI_SCK - PB , // PB 0 ** 53 ** SPI_SS - PF , // PF 0 ** 54 ** A0 - PF , // PF 1 ** 55 ** A1 - PF , // PF 2 ** 56 ** A2 - PF , // PF 3 ** 57 ** A3 - PF , // PF 4 ** 58 ** A4 - PF , // PF 5 ** 59 ** A5 - PF , // PF 6 ** 60 ** A6 - PF , // PF 7 ** 61 ** A7 - PK , // PK 0 ** 62 ** A8 - PK , // PK 1 ** 63 ** A9 - PK , // PK 2 ** 64 ** A10 - PK , // PK 3 ** 65 ** A11 - PK , // PK 4 ** 66 ** A12 - PK , // PK 5 ** 67 ** A13 - PK , // PK 6 ** 68 ** A14 - PK , // PK 7 ** 69 ** A15 - PG , // PG 4 ** 70 ** - PG , // PG 3 ** 71 ** - PJ , // PJ 2 ** 72 ** - PJ , // PJ 3 ** 73 ** - PJ , // PJ 7 ** 74 ** - PJ , // PJ 4 ** 75 ** - PJ , // PJ 5 ** 76 ** - PJ , // PJ 6 ** 77 ** - PE , // PE 2 ** 78 ** - PE , // PE 6 ** 79 ** - PE , // PE 7 ** 80 ** - PD , // PD 4 ** 81 ** - PD , // PD 5 ** 82 ** - PD , // PD 6 ** 83 ** - PH , // PH 2 ** 84 ** - PH , // PH 7 ** 85 ** + PE, // PE 0 ** 0 ** USART0_RX + PE, // PE 1 ** 1 ** USART0_TX + PE, // PE 4 ** 2 ** PWM2 + PE, // PE 5 ** 3 ** PWM3 + PG, // PG 5 ** 4 ** PWM4 + PE, // PE 3 ** 5 ** PWM5 + PH, // PH 3 ** 6 ** PWM6 + PH, // PH 4 ** 7 ** PWM7 + PH, // PH 5 ** 8 ** PWM8 + PH, // PH 6 ** 9 ** PWM9 + PB, // PB 4 ** 10 ** PWM10 + PB, // PB 5 ** 11 ** PWM11 + PB, // PB 6 ** 12 ** PWM12 + PB, // PB 7 ** 13 ** PWM13 + PJ, // PJ 1 ** 14 ** USART3_TX + PJ, // PJ 0 ** 15 ** USART3_RX + PH, // PH 1 ** 16 ** USART2_TX + PH, // PH 0 ** 17 ** USART2_RX + PD, // PD 3 ** 18 ** USART1_TX + PD, // PD 2 ** 19 ** USART1_RX + PD, // PD 1 ** 20 ** I2C_SDA + PD, // PD 0 ** 21 ** I2C_SCL + PA, // PA 0 ** 22 ** D22 + PA, // PA 1 ** 23 ** D23 + PA, // PA 2 ** 24 ** D24 + PA, // PA 3 ** 25 ** D25 + PA, // PA 4 ** 26 ** D26 + PA, // PA 5 ** 27 ** D27 + PA, // PA 6 ** 28 ** D28 + PA, // PA 7 ** 29 ** D29 + PC, // PC 7 ** 30 ** D30 + PC, // PC 6 ** 31 ** D31 + PC, // PC 5 ** 32 ** D32 + PC, // PC 4 ** 33 ** D33 + PC, // PC 3 ** 34 ** D34 + PC, // PC 2 ** 35 ** D35 + PC, // PC 1 ** 36 ** D36 + PC, // PC 0 ** 37 ** D37 + PD, // PD 7 ** 38 ** D38 + PG, // PG 2 ** 39 ** D39 + PG, // PG 1 ** 40 ** D40 + PG, // PG 0 ** 41 ** D41 + PL, // PL 7 ** 42 ** D42 + PL, // PL 6 ** 43 ** D43 + PL, // PL 5 ** 44 ** D44 + PL, // PL 4 ** 45 ** D45 + PL, // PL 3 ** 46 ** D46 + PL, // PL 2 ** 47 ** D47 + PL, // PL 1 ** 48 ** D48 + PL, // PL 0 ** 49 ** D49 + PB, // PB 3 ** 50 ** SPI_MISO + PB, // PB 2 ** 51 ** SPI_MOSI + PB, // PB 1 ** 52 ** SPI_SCK + PB, // PB 0 ** 53 ** SPI_SS + PF, // PF 0 ** 54 ** A0 + PF, // PF 1 ** 55 ** A1 + PF, // PF 2 ** 56 ** A2 + PF, // PF 3 ** 57 ** A3 + PF, // PF 4 ** 58 ** A4 + PF, // PF 5 ** 59 ** A5 + PF, // PF 6 ** 60 ** A6 + PF, // PF 7 ** 61 ** A7 + PK, // PK 0 ** 62 ** A8 + PK, // PK 1 ** 63 ** A9 + PK, // PK 2 ** 64 ** A10 + PK, // PK 3 ** 65 ** A11 + PK, // PK 4 ** 66 ** A12 + PK, // PK 5 ** 67 ** A13 + PK, // PK 6 ** 68 ** A14 + PK, // PK 7 ** 69 ** A15 + PG, // PG 4 ** 70 ** + PG, // PG 3 ** 71 ** + PJ, // PJ 2 ** 72 ** + PJ, // PJ 3 ** 73 ** + PJ, // PJ 7 ** 74 ** + PJ, // PJ 4 ** 75 ** + PJ, // PJ 5 ** 76 ** + PJ, // PJ 6 ** 77 ** + PE, // PE 2 ** 78 ** + PE, // PE 6 ** 79 ** + PE, // PE 7 ** 80 ** + PD, // PD 4 ** 81 ** + PD, // PD 5 ** 82 ** + PD, // PD 6 ** 83 ** + PH, // PH 2 ** 84 ** + PH, // PH 7 ** 85 ** }; #define digitalPinToPort_plus_70(P) ( pgm_read_byte( digital_pin_to_port_PGM_plus_70 + (P) ) ) @@ -141,92 +141,92 @@ const uint8_t PROGMEM digital_pin_to_port_PGM_plus_70[] = { const uint8_t PROGMEM digital_pin_to_bit_mask_PGM_plus_70[] = { // PIN IN PORT // ------------------------ - _BV( 0 ) , // PE 0 ** 0 ** USART0_RX - _BV( 1 ) , // PE 1 ** 1 ** USART0_TX - _BV( 4 ) , // PE 4 ** 2 ** PWM2 - _BV( 5 ) , // PE 5 ** 3 ** PWM3 - _BV( 5 ) , // PG 5 ** 4 ** PWM4 - _BV( 3 ) , // PE 3 ** 5 ** PWM5 - _BV( 3 ) , // PH 3 ** 6 ** PWM6 - _BV( 4 ) , // PH 4 ** 7 ** PWM7 - _BV( 5 ) , // PH 5 ** 8 ** PWM8 - _BV( 6 ) , // PH 6 ** 9 ** PWM9 - _BV( 4 ) , // PB 4 ** 10 ** PWM10 - _BV( 5 ) , // PB 5 ** 11 ** PWM11 - _BV( 6 ) , // PB 6 ** 12 ** PWM12 - _BV( 7 ) , // PB 7 ** 13 ** PWM13 - _BV( 1 ) , // PJ 1 ** 14 ** USART3_TX - _BV( 0 ) , // PJ 0 ** 15 ** USART3_RX - _BV( 1 ) , // PH 1 ** 16 ** USART2_TX - _BV( 0 ) , // PH 0 ** 17 ** USART2_RX - _BV( 3 ) , // PD 3 ** 18 ** USART1_TX - _BV( 2 ) , // PD 2 ** 19 ** USART1_RX - _BV( 1 ) , // PD 1 ** 20 ** I2C_SDA - _BV( 0 ) , // PD 0 ** 21 ** I2C_SCL - _BV( 0 ) , // PA 0 ** 22 ** D22 - _BV( 1 ) , // PA 1 ** 23 ** D23 - _BV( 2 ) , // PA 2 ** 24 ** D24 - _BV( 3 ) , // PA 3 ** 25 ** D25 - _BV( 4 ) , // PA 4 ** 26 ** D26 - _BV( 5 ) , // PA 5 ** 27 ** D27 - _BV( 6 ) , // PA 6 ** 28 ** D28 - _BV( 7 ) , // PA 7 ** 29 ** D29 - _BV( 7 ) , // PC 7 ** 30 ** D30 - _BV( 6 ) , // PC 6 ** 31 ** D31 - _BV( 5 ) , // PC 5 ** 32 ** D32 - _BV( 4 ) , // PC 4 ** 33 ** D33 - _BV( 3 ) , // PC 3 ** 34 ** D34 - _BV( 2 ) , // PC 2 ** 35 ** D35 - _BV( 1 ) , // PC 1 ** 36 ** D36 - _BV( 0 ) , // PC 0 ** 37 ** D37 - _BV( 7 ) , // PD 7 ** 38 ** D38 - _BV( 2 ) , // PG 2 ** 39 ** D39 - _BV( 1 ) , // PG 1 ** 40 ** D40 - _BV( 0 ) , // PG 0 ** 41 ** D41 - _BV( 7 ) , // PL 7 ** 42 ** D42 - _BV( 6 ) , // PL 6 ** 43 ** D43 - _BV( 5 ) , // PL 5 ** 44 ** D44 - _BV( 4 ) , // PL 4 ** 45 ** D45 - _BV( 3 ) , // PL 3 ** 46 ** D46 - _BV( 2 ) , // PL 2 ** 47 ** D47 - _BV( 1 ) , // PL 1 ** 48 ** D48 - _BV( 0 ) , // PL 0 ** 49 ** D49 - _BV( 3 ) , // PB 3 ** 50 ** SPI_MISO - _BV( 2 ) , // PB 2 ** 51 ** SPI_MOSI - _BV( 1 ) , // PB 1 ** 52 ** SPI_SCK - _BV( 0 ) , // PB 0 ** 53 ** SPI_SS - _BV( 0 ) , // PF 0 ** 54 ** A0 - _BV( 1 ) , // PF 1 ** 55 ** A1 - _BV( 2 ) , // PF 2 ** 56 ** A2 - _BV( 3 ) , // PF 3 ** 57 ** A3 - _BV( 4 ) , // PF 4 ** 58 ** A4 - _BV( 5 ) , // PF 5 ** 59 ** A5 - _BV( 6 ) , // PF 6 ** 60 ** A6 - _BV( 7 ) , // PF 7 ** 61 ** A7 - _BV( 0 ) , // PK 0 ** 62 ** A8 - _BV( 1 ) , // PK 1 ** 63 ** A9 - _BV( 2 ) , // PK 2 ** 64 ** A10 - _BV( 3 ) , // PK 3 ** 65 ** A11 - _BV( 4 ) , // PK 4 ** 66 ** A12 - _BV( 5 ) , // PK 5 ** 67 ** A13 - _BV( 6 ) , // PK 6 ** 68 ** A14 - _BV( 7 ) , // PK 7 ** 69 ** A15 - _BV( 4 ) , // PG 4 ** 70 ** - _BV( 3 ) , // PG 3 ** 71 ** - _BV( 2 ) , // PJ 2 ** 72 ** - _BV( 3 ) , // PJ 3 ** 73 ** - _BV( 7 ) , // PJ 7 ** 74 ** - _BV( 4 ) , // PJ 4 ** 75 ** - _BV( 5 ) , // PJ 5 ** 76 ** - _BV( 6 ) , // PJ 6 ** 77 ** - _BV( 2 ) , // PE 2 ** 78 ** - _BV( 6 ) , // PE 6 ** 79 ** - _BV( 7 ) , // PE 7 ** 80 ** - _BV( 4 ) , // PD 4 ** 81 ** - _BV( 5 ) , // PD 5 ** 82 ** - _BV( 6 ) , // PD 6 ** 83 ** - _BV( 2 ) , // PH 2 ** 84 ** - _BV( 7 ) , // PH 7 ** 85 ** + _BV( 0 ), // PE 0 ** 0 ** USART0_RX + _BV( 1 ), // PE 1 ** 1 ** USART0_TX + _BV( 4 ), // PE 4 ** 2 ** PWM2 + _BV( 5 ), // PE 5 ** 3 ** PWM3 + _BV( 5 ), // PG 5 ** 4 ** PWM4 + _BV( 3 ), // PE 3 ** 5 ** PWM5 + _BV( 3 ), // PH 3 ** 6 ** PWM6 + _BV( 4 ), // PH 4 ** 7 ** PWM7 + _BV( 5 ), // PH 5 ** 8 ** PWM8 + _BV( 6 ), // PH 6 ** 9 ** PWM9 + _BV( 4 ), // PB 4 ** 10 ** PWM10 + _BV( 5 ), // PB 5 ** 11 ** PWM11 + _BV( 6 ), // PB 6 ** 12 ** PWM12 + _BV( 7 ), // PB 7 ** 13 ** PWM13 + _BV( 1 ), // PJ 1 ** 14 ** USART3_TX + _BV( 0 ), // PJ 0 ** 15 ** USART3_RX + _BV( 1 ), // PH 1 ** 16 ** USART2_TX + _BV( 0 ), // PH 0 ** 17 ** USART2_RX + _BV( 3 ), // PD 3 ** 18 ** USART1_TX + _BV( 2 ), // PD 2 ** 19 ** USART1_RX + _BV( 1 ), // PD 1 ** 20 ** I2C_SDA + _BV( 0 ), // PD 0 ** 21 ** I2C_SCL + _BV( 0 ), // PA 0 ** 22 ** D22 + _BV( 1 ), // PA 1 ** 23 ** D23 + _BV( 2 ), // PA 2 ** 24 ** D24 + _BV( 3 ), // PA 3 ** 25 ** D25 + _BV( 4 ), // PA 4 ** 26 ** D26 + _BV( 5 ), // PA 5 ** 27 ** D27 + _BV( 6 ), // PA 6 ** 28 ** D28 + _BV( 7 ), // PA 7 ** 29 ** D29 + _BV( 7 ), // PC 7 ** 30 ** D30 + _BV( 6 ), // PC 6 ** 31 ** D31 + _BV( 5 ), // PC 5 ** 32 ** D32 + _BV( 4 ), // PC 4 ** 33 ** D33 + _BV( 3 ), // PC 3 ** 34 ** D34 + _BV( 2 ), // PC 2 ** 35 ** D35 + _BV( 1 ), // PC 1 ** 36 ** D36 + _BV( 0 ), // PC 0 ** 37 ** D37 + _BV( 7 ), // PD 7 ** 38 ** D38 + _BV( 2 ), // PG 2 ** 39 ** D39 + _BV( 1 ), // PG 1 ** 40 ** D40 + _BV( 0 ), // PG 0 ** 41 ** D41 + _BV( 7 ), // PL 7 ** 42 ** D42 + _BV( 6 ), // PL 6 ** 43 ** D43 + _BV( 5 ), // PL 5 ** 44 ** D44 + _BV( 4 ), // PL 4 ** 45 ** D45 + _BV( 3 ), // PL 3 ** 46 ** D46 + _BV( 2 ), // PL 2 ** 47 ** D47 + _BV( 1 ), // PL 1 ** 48 ** D48 + _BV( 0 ), // PL 0 ** 49 ** D49 + _BV( 3 ), // PB 3 ** 50 ** SPI_MISO + _BV( 2 ), // PB 2 ** 51 ** SPI_MOSI + _BV( 1 ), // PB 1 ** 52 ** SPI_SCK + _BV( 0 ), // PB 0 ** 53 ** SPI_SS + _BV( 0 ), // PF 0 ** 54 ** A0 + _BV( 1 ), // PF 1 ** 55 ** A1 + _BV( 2 ), // PF 2 ** 56 ** A2 + _BV( 3 ), // PF 3 ** 57 ** A3 + _BV( 4 ), // PF 4 ** 58 ** A4 + _BV( 5 ), // PF 5 ** 59 ** A5 + _BV( 6 ), // PF 6 ** 60 ** A6 + _BV( 7 ), // PF 7 ** 61 ** A7 + _BV( 0 ), // PK 0 ** 62 ** A8 + _BV( 1 ), // PK 1 ** 63 ** A9 + _BV( 2 ), // PK 2 ** 64 ** A10 + _BV( 3 ), // PK 3 ** 65 ** A11 + _BV( 4 ), // PK 4 ** 66 ** A12 + _BV( 5 ), // PK 5 ** 67 ** A13 + _BV( 6 ), // PK 6 ** 68 ** A14 + _BV( 7 ), // PK 7 ** 69 ** A15 + _BV( 4 ), // PG 4 ** 70 ** + _BV( 3 ), // PG 3 ** 71 ** + _BV( 2 ), // PJ 2 ** 72 ** + _BV( 3 ), // PJ 3 ** 73 ** + _BV( 7 ), // PJ 7 ** 74 ** + _BV( 4 ), // PJ 4 ** 75 ** + _BV( 5 ), // PJ 5 ** 76 ** + _BV( 6 ), // PJ 6 ** 77 ** + _BV( 2 ), // PE 2 ** 78 ** + _BV( 6 ), // PE 6 ** 79 ** + _BV( 7 ), // PE 7 ** 80 ** + _BV( 4 ), // PD 4 ** 81 ** + _BV( 5 ), // PD 5 ** 82 ** + _BV( 6 ), // PD 6 ** 83 ** + _BV( 2 ), // PH 2 ** 84 ** + _BV( 7 ), // PH 7 ** 85 ** }; #define digitalPinToBitMask_plus_70(P) ( pgm_read_byte( digital_pin_to_bit_mask_PGM_plus_70 + (P) ) ) @@ -234,86 +234,86 @@ const uint8_t PROGMEM digital_pin_to_bit_mask_PGM_plus_70[] = { const uint8_t PROGMEM digital_pin_to_timer_PGM_plus_70[] = { // TIMERS // ------------------------ - NOT_ON_TIMER , // PE 0 ** 0 ** USART0_RX - NOT_ON_TIMER , // PE 1 ** 1 ** USART0_TX - TIMER3B , // PE 4 ** 2 ** PWM2 - TIMER3C , // PE 5 ** 3 ** PWM3 - TIMER0B , // PG 5 ** 4 ** PWM4 - TIMER3A , // PE 3 ** 5 ** PWM5 - TIMER4A , // PH 3 ** 6 ** PWM6 - TIMER4B , // PH 4 ** 7 ** PWM7 - TIMER4C , // PH 5 ** 8 ** PWM8 - TIMER2B , // PH 6 ** 9 ** PWM9 - TIMER2A , // PB 4 ** 10 ** PWM10 - TIMER1A , // PB 5 ** 11 ** PWM11 - TIMER1B , // PB 6 ** 12 ** PWM12 - TIMER0A , // PB 7 ** 13 ** PWM13 - NOT_ON_TIMER , // PJ 1 ** 14 ** USART3_TX - NOT_ON_TIMER , // PJ 0 ** 15 ** USART3_RX - NOT_ON_TIMER , // PH 1 ** 16 ** USART2_TX - NOT_ON_TIMER , // PH 0 ** 17 ** USART2_RX - NOT_ON_TIMER , // PD 3 ** 18 ** USART1_TX - NOT_ON_TIMER , // PD 2 ** 19 ** USART1_RX - NOT_ON_TIMER , // PD 1 ** 20 ** I2C_SDA - NOT_ON_TIMER , // PD 0 ** 21 ** I2C_SCL - NOT_ON_TIMER , // PA 0 ** 22 ** D22 - NOT_ON_TIMER , // PA 1 ** 23 ** D23 - NOT_ON_TIMER , // PA 2 ** 24 ** D24 - NOT_ON_TIMER , // PA 3 ** 25 ** D25 - NOT_ON_TIMER , // PA 4 ** 26 ** D26 - NOT_ON_TIMER , // PA 5 ** 27 ** D27 - NOT_ON_TIMER , // PA 6 ** 28 ** D28 - NOT_ON_TIMER , // PA 7 ** 29 ** D29 - NOT_ON_TIMER , // PC 7 ** 30 ** D30 - NOT_ON_TIMER , // PC 6 ** 31 ** D31 - NOT_ON_TIMER , // PC 5 ** 32 ** D32 - NOT_ON_TIMER , // PC 4 ** 33 ** D33 - NOT_ON_TIMER , // PC 3 ** 34 ** D34 - NOT_ON_TIMER , // PC 2 ** 35 ** D35 - NOT_ON_TIMER , // PC 1 ** 36 ** D36 - NOT_ON_TIMER , // PC 0 ** 37 ** D37 - NOT_ON_TIMER , // PD 7 ** 38 ** D38 - NOT_ON_TIMER , // PG 2 ** 39 ** D39 - NOT_ON_TIMER , // PG 1 ** 40 ** D40 - NOT_ON_TIMER , // PG 0 ** 41 ** D41 - NOT_ON_TIMER , // PL 7 ** 42 ** D42 - NOT_ON_TIMER , // PL 6 ** 43 ** D43 - TIMER5C , // PL 5 ** 44 ** D44 - TIMER5B , // PL 4 ** 45 ** D45 - TIMER5A , // PL 3 ** 46 ** D46 - NOT_ON_TIMER , // PL 2 ** 47 ** D47 - NOT_ON_TIMER , // PL 1 ** 48 ** D48 - NOT_ON_TIMER , // PL 0 ** 49 ** D49 - NOT_ON_TIMER , // PB 3 ** 50 ** SPI_MISO - NOT_ON_TIMER , // PB 2 ** 51 ** SPI_MOSI - NOT_ON_TIMER , // PB 1 ** 52 ** SPI_SCK - NOT_ON_TIMER , // PB 0 ** 53 ** SPI_SS - NOT_ON_TIMER , // PF 0 ** 54 ** A0 - NOT_ON_TIMER , // PF 1 ** 55 ** A1 - NOT_ON_TIMER , // PF 2 ** 56 ** A2 - NOT_ON_TIMER , // PF 3 ** 57 ** A3 - NOT_ON_TIMER , // PF 4 ** 58 ** A4 - NOT_ON_TIMER , // PF 5 ** 59 ** A5 - NOT_ON_TIMER , // PF 6 ** 60 ** A6 - NOT_ON_TIMER , // PF 7 ** 61 ** A7 - NOT_ON_TIMER , // PK 0 ** 62 ** A8 - NOT_ON_TIMER , // PK 1 ** 63 ** A9 - NOT_ON_TIMER , // PK 2 ** 64 ** A10 - NOT_ON_TIMER , // PK 3 ** 65 ** A11 - NOT_ON_TIMER , // PK 4 ** 66 ** A12 - NOT_ON_TIMER , // PK 5 ** 67 ** A13 - NOT_ON_TIMER , // PK 6 ** 68 ** A14 - NOT_ON_TIMER , // PK 7 ** 69 ** A15 - NOT_ON_TIMER , // PG 4 ** 70 ** - NOT_ON_TIMER , // PG 3 ** 71 ** - NOT_ON_TIMER , // PJ 2 ** 72 ** - NOT_ON_TIMER , // PJ 3 ** 73 ** - NOT_ON_TIMER , // PJ 7 ** 74 ** - NOT_ON_TIMER , // PJ 4 ** 75 ** - NOT_ON_TIMER , // PJ 5 ** 76 ** - NOT_ON_TIMER , // PJ 6 ** 77 ** - NOT_ON_TIMER , // PE 2 ** 78 ** - NOT_ON_TIMER , // PE 6 ** 79 ** + NOT_ON_TIMER, // PE 0 ** 0 ** USART0_RX + NOT_ON_TIMER, // PE 1 ** 1 ** USART0_TX + TIMER3B, // PE 4 ** 2 ** PWM2 + TIMER3C, // PE 5 ** 3 ** PWM3 + TIMER0B, // PG 5 ** 4 ** PWM4 + TIMER3A, // PE 3 ** 5 ** PWM5 + TIMER4A, // PH 3 ** 6 ** PWM6 + TIMER4B, // PH 4 ** 7 ** PWM7 + TIMER4C, // PH 5 ** 8 ** PWM8 + TIMER2B, // PH 6 ** 9 ** PWM9 + TIMER2A, // PB 4 ** 10 ** PWM10 + TIMER1A, // PB 5 ** 11 ** PWM11 + TIMER1B, // PB 6 ** 12 ** PWM12 + TIMER0A, // PB 7 ** 13 ** PWM13 + NOT_ON_TIMER, // PJ 1 ** 14 ** USART3_TX + NOT_ON_TIMER, // PJ 0 ** 15 ** USART3_RX + NOT_ON_TIMER, // PH 1 ** 16 ** USART2_TX + NOT_ON_TIMER, // PH 0 ** 17 ** USART2_RX + NOT_ON_TIMER, // PD 3 ** 18 ** USART1_TX + NOT_ON_TIMER, // PD 2 ** 19 ** USART1_RX + NOT_ON_TIMER, // PD 1 ** 20 ** I2C_SDA + NOT_ON_TIMER, // PD 0 ** 21 ** I2C_SCL + NOT_ON_TIMER, // PA 0 ** 22 ** D22 + NOT_ON_TIMER, // PA 1 ** 23 ** D23 + NOT_ON_TIMER, // PA 2 ** 24 ** D24 + NOT_ON_TIMER, // PA 3 ** 25 ** D25 + NOT_ON_TIMER, // PA 4 ** 26 ** D26 + NOT_ON_TIMER, // PA 5 ** 27 ** D27 + NOT_ON_TIMER, // PA 6 ** 28 ** D28 + NOT_ON_TIMER, // PA 7 ** 29 ** D29 + NOT_ON_TIMER, // PC 7 ** 30 ** D30 + NOT_ON_TIMER, // PC 6 ** 31 ** D31 + NOT_ON_TIMER, // PC 5 ** 32 ** D32 + NOT_ON_TIMER, // PC 4 ** 33 ** D33 + NOT_ON_TIMER, // PC 3 ** 34 ** D34 + NOT_ON_TIMER, // PC 2 ** 35 ** D35 + NOT_ON_TIMER, // PC 1 ** 36 ** D36 + NOT_ON_TIMER, // PC 0 ** 37 ** D37 + NOT_ON_TIMER, // PD 7 ** 38 ** D38 + NOT_ON_TIMER, // PG 2 ** 39 ** D39 + NOT_ON_TIMER, // PG 1 ** 40 ** D40 + NOT_ON_TIMER, // PG 0 ** 41 ** D41 + NOT_ON_TIMER, // PL 7 ** 42 ** D42 + NOT_ON_TIMER, // PL 6 ** 43 ** D43 + TIMER5C, // PL 5 ** 44 ** D44 + TIMER5B, // PL 4 ** 45 ** D45 + TIMER5A, // PL 3 ** 46 ** D46 + NOT_ON_TIMER, // PL 2 ** 47 ** D47 + NOT_ON_TIMER, // PL 1 ** 48 ** D48 + NOT_ON_TIMER, // PL 0 ** 49 ** D49 + NOT_ON_TIMER, // PB 3 ** 50 ** SPI_MISO + NOT_ON_TIMER, // PB 2 ** 51 ** SPI_MOSI + NOT_ON_TIMER, // PB 1 ** 52 ** SPI_SCK + NOT_ON_TIMER, // PB 0 ** 53 ** SPI_SS + NOT_ON_TIMER, // PF 0 ** 54 ** A0 + NOT_ON_TIMER, // PF 1 ** 55 ** A1 + NOT_ON_TIMER, // PF 2 ** 56 ** A2 + NOT_ON_TIMER, // PF 3 ** 57 ** A3 + NOT_ON_TIMER, // PF 4 ** 58 ** A4 + NOT_ON_TIMER, // PF 5 ** 59 ** A5 + NOT_ON_TIMER, // PF 6 ** 60 ** A6 + NOT_ON_TIMER, // PF 7 ** 61 ** A7 + NOT_ON_TIMER, // PK 0 ** 62 ** A8 + NOT_ON_TIMER, // PK 1 ** 63 ** A9 + NOT_ON_TIMER, // PK 2 ** 64 ** A10 + NOT_ON_TIMER, // PK 3 ** 65 ** A11 + NOT_ON_TIMER, // PK 4 ** 66 ** A12 + NOT_ON_TIMER, // PK 5 ** 67 ** A13 + NOT_ON_TIMER, // PK 6 ** 68 ** A14 + NOT_ON_TIMER, // PK 7 ** 69 ** A15 + NOT_ON_TIMER, // PG 4 ** 70 ** + NOT_ON_TIMER, // PG 3 ** 71 ** + NOT_ON_TIMER, // PJ 2 ** 72 ** + NOT_ON_TIMER, // PJ 3 ** 73 ** + NOT_ON_TIMER, // PJ 7 ** 74 ** + NOT_ON_TIMER, // PJ 4 ** 75 ** + NOT_ON_TIMER, // PJ 5 ** 76 ** + NOT_ON_TIMER, // PJ 6 ** 77 ** + NOT_ON_TIMER, // PE 2 ** 78 ** + NOT_ON_TIMER, // PE 6 ** 79 ** }; #define digitalPinToTimer_plus_70(P) ( pgm_read_byte( digital_pin_to_timer_PGM_plus_70 + (P) ) ) diff --git a/Marlin/src/HAL/DUE/HAL_SPI.cpp b/Marlin/src/HAL/DUE/HAL_SPI.cpp index 5bbc4223bb..e44549357e 100644 --- a/Marlin/src/HAL/DUE/HAL_SPI.cpp +++ b/Marlin/src/HAL/DUE/HAL_SPI.cpp @@ -208,8 +208,8 @@ A("str %[sck_mask],[%[sck_port],#0x4]") /* CODR */ A("bfi %[bin],%[work],#0,#1") /* Store read bit as the bit 0 */ - : [bin]"+r"(bin), - [work]"+r"(work) + : [bin]"+r"( bin ), + [work]"+r"( work ) : [bitband_miso_port]"r"( BITBAND_MISO_PORT ), [sck_mask]"r"( SCK_MASK ), [sck_port]"r"( SCK_PORT_PLUS30 ) @@ -350,7 +350,7 @@ static void spiRxBlock0(uint8_t *ptr, uint32_t todo) { uint32_t bin = 0; uint32_t work = 0; - uint32_t BITBAND_MISO_PORT = BITBAND_ADDRESS( ((uint32_t)PORT(SD_MISO_PIN))+0x3C, PIN_SHIFT(SD_MISO_PIN)); /* PDSR of port in bitband area */ + uint32_t BITBAND_MISO_PORT = BITBAND_ADDRESS(((uint32_t)PORT(SD_MISO_PIN))+0x3C, PIN_SHIFT(SD_MISO_PIN)); /* PDSR of port in bitband area */ uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SD_SCK_PIN)) + 0x30; /* SODR of port */ uint32_t SCK_MASK = PIN_MASK(SD_SCK_PIN); @@ -412,10 +412,10 @@ A("strb.w %[bin], [%[ptr]], #1") /* Store read value into buffer, increment buffer pointer */ A("bne.n loop%=") /* Repeat until done */ - : [ptr]"+r"(ptr), - [todo]"+r"(todo), - [bin]"+r"(bin), - [work]"+r"(work) + : [ptr]"+r"( ptr ), + [todo]"+r"( todo ), + [bin]"+r"( bin ), + [work]"+r"( work ) : [bitband_miso_port]"r"( BITBAND_MISO_PORT ), [sck_mask]"r"( SCK_MASK ), [sck_port]"r"( SCK_PORT_PLUS30 ) diff --git a/Marlin/src/HAL/RP2040/timers.h b/Marlin/src/HAL/RP2040/timers.h index 83fdc0a2fc..512c6ba465 100644 --- a/Marlin/src/HAL/RP2040/timers.h +++ b/Marlin/src/HAL/RP2040/timers.h @@ -131,19 +131,19 @@ FORCE_INLINE static void HAL_timer_set_compare(const uint8_t timer_num, hal_time switch (timer_num) { case 0: - alarm_pool_add_alarm_in_us(HAL_timer_pool_0 ,compare , HAL_timer_alarm_pool_0_callback ,0 ,false ); + alarm_pool_add_alarm_in_us(HAL_timer_pool_0, compare, HAL_timer_alarm_pool_0_callback, 0, false); break; case 1: - alarm_pool_add_alarm_in_us(HAL_timer_pool_1 ,compare , HAL_timer_alarm_pool_1_callback ,0 ,false ); + alarm_pool_add_alarm_in_us(HAL_timer_pool_1, compare, HAL_timer_alarm_pool_1_callback, 0, false); break; case 2: - alarm_pool_add_alarm_in_us(HAL_timer_pool_2 ,compare , HAL_timer_alarm_pool_2_callback ,0 ,false ); + alarm_pool_add_alarm_in_us(HAL_timer_pool_2, compare, HAL_timer_alarm_pool_2_callback, 0, false); break; case 3: - alarm_pool_add_alarm_in_us(HAL_timer_pool_3 ,compare , HAL_timer_alarm_pool_3_callback ,0 ,false ); + alarm_pool_add_alarm_in_us(HAL_timer_pool_3, compare, HAL_timer_alarm_pool_3_callback, 0, false); break; } } diff --git a/Marlin/src/HAL/STM32F1/HAL_N32.h b/Marlin/src/HAL/STM32F1/HAL_N32.h index 7162e2b971..8b47ef4b96 100644 --- a/Marlin/src/HAL/STM32F1/HAL_N32.h +++ b/Marlin/src/HAL/STM32F1/HAL_N32.h @@ -239,8 +239,8 @@ typedef struct { #define ADC_WORKMODE_SLOW_INTERL ((uint32_t)0x00080000) #define ADC_WORKMODE_ALTER_TRIG ((uint32_t)0x00090000) -#define ADC_EXT_TRIGCONV_T1_CC3 ((uint32_t)0x00040000) //!< For ADC1, ADC2 , ADC3 and ADC4 -#define ADC_EXT_TRIGCONV_NONE ((uint32_t)0x000E0000) //!< For ADC1, ADC2 , ADC3 and ADC4 +#define ADC_EXT_TRIGCONV_T1_CC3 ((uint32_t)0x00040000) //!< For ADC1, ADC2, ADC3, and ADC4 +#define ADC_EXT_TRIGCONV_NONE ((uint32_t)0x000E0000) //!< For ADC1, ADC2, ADC3, and ADC4 #define ADC_DAT_ALIGN_R ((uint32_t)0x00000000) #define ADC_DAT_ALIGN_L ((uint32_t)0x00000800) @@ -603,9 +603,9 @@ typedef struct { #define DMA_CHCFG7_PINC ((uint16_t)0x0040) //!< Peripheral increment mode #define DMA_CHCFG7_MINC ((uint16_t)0x0080) //!< Memory increment mode -#define DMA_CHCFG7_PSIZE , ((uint16_t)0x0300) //!< PSIZE[1:0] bits (Peripheral size) -#define DMA_CHCFG7_PSIZE_0 ((uint16_t)0x0100) //!< Bit 0 -#define DMA_CHCFG7_PSIZE_1 ((uint16_t)0x0200) //!< Bit 1 +#define DMA_CHCFG7_PSIZE ((uint16_t)0x0300) //!< PSIZE[1:0] bits (Peripheral size) +#define DMA_CHCFG7_PSIZE_0 ((uint16_t)0x0100) //!< Bit 0 +#define DMA_CHCFG7_PSIZE_1 ((uint16_t)0x0200) //!< Bit 1 #define DMA_CHCFG7_MSIZE ((uint16_t)0x0C00) //!< MSIZE[1:0] bits (Memory size) #define DMA_CHCFG7_MSIZE_0 ((uint16_t)0x0400) //!< Bit 0 @@ -627,9 +627,9 @@ typedef struct { #define DMA_CHCFG8_PINC ((uint16_t)0x0040) //!< Peripheral increment mode #define DMA_CHCFG8_MINC ((uint16_t)0x0080) //!< Memory increment mode -#define DMA_CHCFG8_PSIZE , ((uint16_t)0x0300) //!< PSIZE[1:0] bits (Peripheral size) -#define DMA_CHCFG8_PSIZE_0 ((uint16_t)0x0100) //!< Bit 0 -#define DMA_CHCFG8_PSIZE_1 ((uint16_t)0x0200) //!< Bit 1 +#define DMA_CHCFG8_PSIZE ((uint16_t)0x0300) //!< PSIZE[1:0] bits (Peripheral size) +#define DMA_CHCFG8_PSIZE_0 ((uint16_t)0x0100) //!< Bit 0 +#define DMA_CHCFG8_PSIZE_1 ((uint16_t)0x0200) //!< Bit 1 #define DMA_CHCFG8_MSIZE ((uint16_t)0x0C00) //!< MSIZE[1:0] bits (Memory size) #define DMA_CHCFG8_MSIZE_0 ((uint16_t)0x0400) //!< Bit 0 diff --git a/Marlin/src/HAL/STM32F1/sdio.cpp b/Marlin/src/HAL/STM32F1/sdio.cpp index 5bb1ddb6c5..258422eba3 100644 --- a/Marlin/src/HAL/STM32F1/sdio.cpp +++ b/Marlin/src/HAL/STM32F1/sdio.cpp @@ -219,7 +219,7 @@ bool SDIO_CmdAppSetBusWidth(uint32_t rsa, uint32_t argument) { bool SDIO_CmdAppOperCommand(uint32_t sdType) { if (!SDIO_CmdAppCommand(0)) return false; - SDIO_SendCommand(ACMD41_SD_APP_OP_COND , SDMMC_VOLTAGE_WINDOW_SD | sdType); + SDIO_SendCommand(ACMD41_SD_APP_OP_COND, SDMMC_VOLTAGE_WINDOW_SD | sdType); return SDIO_GetCmdResp3(); } diff --git a/Marlin/src/HAL/TEENSY31_32/fastio.h b/Marlin/src/HAL/TEENSY31_32/fastio.h index 622799ec8c..b582c7bfec 100644 --- a/Marlin/src/HAL/TEENSY31_32/fastio.h +++ b/Marlin/src/HAL/TEENSY31_32/fastio.h @@ -53,17 +53,17 @@ #define _SET_INPUT(P) do{ \ CORE_PIN ## P ## _CONFIG = PORT_PCR_MUX(1); \ - GPIO_BITBAND(CORE_PIN ## P ## _DDRREG , CORE_PIN ## P ## _BIT) = 0; \ + GPIO_BITBAND(CORE_PIN ## P ## _DDRREG, CORE_PIN ## P ## _BIT) = 0; \ }while(0) #define _SET_OUTPUT(P) do{ \ CORE_PIN ## P ## _CONFIG = PORT_PCR_MUX(1)|PORT_PCR_SRE|PORT_PCR_DSE; \ - GPIO_BITBAND(CORE_PIN ## P ## _DDRREG , CORE_PIN ## P ## _BIT) = 1; \ + GPIO_BITBAND(CORE_PIN ## P ## _DDRREG, CORE_PIN ## P ## _BIT) = 1; \ }while(0) #define _SET_INPUT_PULLUP(P) do{ \ CORE_PIN ## P ## _CONFIG = PORT_PCR_MUX(1) | PORT_PCR_PE | PORT_PCR_PS; \ - GPIO_BITBAND(CORE_PIN ## P ## _DDRREG , CORE_PIN ## P ## _BIT) = 0; \ + GPIO_BITBAND(CORE_PIN ## P ## _DDRREG, CORE_PIN ## P ## _BIT) = 0; \ }while(0) #define _IS_INPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0) diff --git a/Marlin/src/HAL/TEENSY35_36/fastio.h b/Marlin/src/HAL/TEENSY35_36/fastio.h index 622799ec8c..b582c7bfec 100644 --- a/Marlin/src/HAL/TEENSY35_36/fastio.h +++ b/Marlin/src/HAL/TEENSY35_36/fastio.h @@ -53,17 +53,17 @@ #define _SET_INPUT(P) do{ \ CORE_PIN ## P ## _CONFIG = PORT_PCR_MUX(1); \ - GPIO_BITBAND(CORE_PIN ## P ## _DDRREG , CORE_PIN ## P ## _BIT) = 0; \ + GPIO_BITBAND(CORE_PIN ## P ## _DDRREG, CORE_PIN ## P ## _BIT) = 0; \ }while(0) #define _SET_OUTPUT(P) do{ \ CORE_PIN ## P ## _CONFIG = PORT_PCR_MUX(1)|PORT_PCR_SRE|PORT_PCR_DSE; \ - GPIO_BITBAND(CORE_PIN ## P ## _DDRREG , CORE_PIN ## P ## _BIT) = 1; \ + GPIO_BITBAND(CORE_PIN ## P ## _DDRREG, CORE_PIN ## P ## _BIT) = 1; \ }while(0) #define _SET_INPUT_PULLUP(P) do{ \ CORE_PIN ## P ## _CONFIG = PORT_PCR_MUX(1) | PORT_PCR_PE | PORT_PCR_PS; \ - GPIO_BITBAND(CORE_PIN ## P ## _DDRREG , CORE_PIN ## P ## _BIT) = 0; \ + GPIO_BITBAND(CORE_PIN ## P ## _DDRREG, CORE_PIN ## P ## _BIT) = 0; \ }while(0) #define _IS_INPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0) diff --git a/Marlin/src/core/serial_base.h b/Marlin/src/core/serial_base.h index a2f49417b7..a8700f3d23 100644 --- a/Marlin/src/core/serial_base.h +++ b/Marlin/src/core/serial_base.h @@ -220,7 +220,7 @@ struct SerialBase { // On non 2-complement CPU, there would be no possible representation for 2147483648. write('-'); } - printNumber_unsigned((uint_fixed_print_t)n , base); + printNumber_unsigned((uint_fixed_print_t)n, base); } // Print a decimal number diff --git a/Marlin/src/core/types.h b/Marlin/src/core/types.h index 395dc430f5..0de49771ee 100644 --- a/Marlin/src/core/types.h +++ b/Marlin/src/core/types.h @@ -892,8 +892,8 @@ struct XYZEval { // 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 ); } + 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; } diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.h b/Marlin/src/feature/bedlevel/ubl/ubl.h index b08cb812f8..84ecc3a6c7 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.h +++ b/Marlin/src/feature/bedlevel/ubl/ubl.h @@ -70,7 +70,7 @@ private: static void move_z_with_encoder(const_float_t multiplier); static float measure_point_with_encoder(); static float measure_business_card_thickness(); - static void manually_probe_remaining_mesh(const xy_pos_t&, const_float_t , const_float_t , const bool) __O0; + static void manually_probe_remaining_mesh(const xy_pos_t&, const_float_t, const_float_t, const bool) __O0; static void fine_tune_mesh(const xy_pos_t &pos, const bool do_ubl_mesh_map) __O0; #endif diff --git a/Marlin/src/gcode/host/M360.cpp b/Marlin/src/gcode/host/M360.cpp index 535ed48039..63071f6113 100644 --- a/Marlin/src/gcode/host/M360.cpp +++ b/Marlin/src/gcode/host/M360.cpp @@ -44,7 +44,7 @@ static void config_line(PGM_P const name, const float val, PGM_P const pref=null SERIAL_ECHOLN(val); } static void config_line(FSTR_P const name, const float val, FSTR_P const pref=nullptr, const int8_t ind=-1) { - config_line(FTOP(name), val, FTOP(pref) , ind); + config_line(FTOP(name), val, FTOP(pref), ind); } static void config_line_e(const int8_t e, PGM_P const name, const float val) { config_line(name, val, PSTR("Extr."), e + 1); diff --git a/Marlin/src/inc/Conditionals-2-LCD.h b/Marlin/src/inc/Conditionals-2-LCD.h index 2462231593..633cd2beb6 100644 --- a/Marlin/src/inc/Conditionals-2-LCD.h +++ b/Marlin/src/inc/Conditionals-2-LCD.h @@ -78,7 +78,7 @@ #define MKS_MINI_12864 #endif -// MKS_MINI_12864_V3 , BTT_MINI_12864 and BEEZ_MINI_12864 are nearly identical to FYSETC_MINI_12864_2_1 +// MKS_MINI_12864_V3, BTT_MINI_12864 and BEEZ_MINI_12864 are nearly identical to FYSETC_MINI_12864_2_1 #if ANY(MKS_MINI_12864_V3, BTT_MINI_12864, BEEZ_MINI_12864) #define FYSETC_MINI_12864_2_1 #endif diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index b9c637d722..5811ac11bb 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -427,7 +427,7 @@ private: v1 = -rmax; v2 = rmin; } - jyersDWIN.updateStatus(TS(GET_TEXT_F(MSG_COLORS_RED), ' ', p_float_t(v1, 3) , F("..0.."), p_float_t(v2, 3), ' ', GET_TEXT_F(MSG_COLORS_GREEN))); + jyersDWIN.updateStatus(TS(GET_TEXT_F(MSG_COLORS_RED), ' ', p_float_t(v1, 3), F("..0.."), p_float_t(v2, 3), ' ', GET_TEXT_F(MSG_COLORS_GREEN))); drawing_mesh = false; } @@ -3033,7 +3033,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra drawMenuItem(row, ICON_StepY, F("M48 Probe Test")); else { gcode.process_subcommands_now( - TS(F("G28O\nM48X") , p_float_t((X_BED_SIZE + X_MIN_POS) / 2.0f, 3), 'Y', p_float_t((Y_BED_SIZE + Y_MIN_POS) / 2.0f, 3), 'P', testcount) + TS(F("G28O\nM48X"), p_float_t((X_BED_SIZE + X_MIN_POS) / 2.0f, 3), 'Y', p_float_t((Y_BED_SIZE + Y_MIN_POS) / 2.0f, 3), 'P', testcount) ); } break; diff --git a/Marlin/src/lcd/e3v2/proui/menus.cpp b/Marlin/src/lcd/e3v2/proui/menus.cpp index 7edf32169d..0451944645 100644 --- a/Marlin/src/lcd/e3v2/proui/menus.cpp +++ b/Marlin/src/lcd/e3v2/proui/menus.cpp @@ -100,7 +100,7 @@ void toggleCheckboxLine(bool &checked) { } void drawMenuIntValue(uint16_t bcolor, const uint8_t line, uint8_t iNum, const int32_t value/*=0*/) { - DWINUI::drawSignedInt(hmiData.colorText, bcolor, iNum , VALX, MBASE(line) - 1, value); + DWINUI::drawSignedInt(hmiData.colorText, bcolor, iNum, VALX, MBASE(line) - 1, value); } void onDrawMenuItem(MenuItem* menuitem, int8_t line) { @@ -163,7 +163,7 @@ void DrawItemEdit(const bool selected) { switch (checkkey) { case ID_SetIntNoDraw: if (menuData.liveUpdate) menuData.liveUpdate(); break; case ID_SetInt: - case ID_SetPInt: DWINUI::drawSignedInt(hmiData.colorText, bcolor, iNum , VALX, MBASE(currentMenu->line()) - 1, menuData.value); break; + case ID_SetPInt: DWINUI::drawSignedInt(hmiData.colorText, bcolor, iNum, VALX, MBASE(currentMenu->line()) - 1, menuData.value); break; case ID_SetFloat: case ID_SetPFloat: DWINUI::drawSignedFloat(hmiData.colorText, bcolor, iNum, menuData.dp, VALX - 2 * DWINUI::fontWidth(), MBASE(currentMenu->line()), menuData.value / POW(10, menuData.dp)); break; default: break; diff --git a/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp b/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp index 9e38face6f..e6e8c88155 100644 --- a/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp +++ b/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp @@ -130,7 +130,7 @@ void ChironTFT::idleLoop() { void ChironTFT::printerKilled(FSTR_P const error, FSTR_P const component) { tftSendLn(AC_msg_kill_lcd); #if ACDEBUG(AC_MARLIN) - DEBUG_ECHOLNPGM("printerKilled()\nerror: ", error , "\ncomponent: ", component); + DEBUG_ECHOLNPGM("printerKilled()\nerror: ", error, "\ncomponent: ", component); #endif } @@ -875,7 +875,7 @@ 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) - DEBUG_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(); diff --git a/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp index d23b10898e..696cfad684 100644 --- a/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp +++ b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp @@ -64,7 +64,7 @@ namespace Anycubic { DgusTFT::page25, DgusTFT::page26, DgusTFT::page27, DgusTFT::page28, DgusTFT::page29, DgusTFT::page30, DgusTFT::page31, DgusTFT::page32 #if HAS_LEVELING - , DgusTFT::page33 , DgusTFT::page34 + , DgusTFT::page33, DgusTFT::page34 #endif }; @@ -1108,7 +1108,7 @@ namespace Anycubic { */ } else if (0x82 == data_buf[0]) { - // send_cmd_to_pc(cmd ,start ); + // send_cmd_to_pc(cmd, start ); } } } diff --git a/Marlin/src/lcd/extui/dgus/fysetc/DGUSDisplayDef.cpp b/Marlin/src/lcd/extui/dgus/fysetc/DGUSDisplayDef.cpp index 24e472be05..9ec98779c8 100644 --- a/Marlin/src/lcd/extui/dgus/fysetc/DGUSDisplayDef.cpp +++ b/Marlin/src/lcd/extui/dgus/fysetc/DGUSDisplayDef.cpp @@ -311,7 +311,7 @@ const struct VPMapping VPMap[] PROGMEM = { { 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. + { 0, nullptr } // List is terminated with an nullptr as table entry. }; const char MarlinVersion[] PROGMEM = SHORT_BUILD_VERSION; diff --git a/Marlin/src/lcd/extui/dgus/fysetc/DGUSDisplayDef.h b/Marlin/src/lcd/extui/dgus/fysetc/DGUSDisplayDef.h index 3bac9cf2c6..1ba2a25ea3 100644 --- a/Marlin/src/lcd/extui/dgus/fysetc/DGUSDisplayDef.h +++ b/Marlin/src/lcd/extui/dgus/fysetc/DGUSDisplayDef.h @@ -121,13 +121,13 @@ constexpr uint16_t VP_MOTOR_LOCK_UNLOCK = 0x2130; // Power loss recovery constexpr uint16_t VP_POWER_LOSS_RECOVERY = 0x2180; -// Fan Control Buttons , switch between "off" and "on" +// Fan Control Buttons, switch between "off" and "on" constexpr uint16_t VP_FAN0_CONTROL = 0x2200; constexpr uint16_t VP_FAN1_CONTROL = 0x2202; constexpr uint16_t VP_FAN2_CONTROL = 0x2204; constexpr uint16_t VP_FAN3_CONTROL = 0x2206; -// Heater Control Buttons , triged between "cool down" and "heat PLA" state +// Heater Control Buttons, triged between "cool down" and "heat PLA" state constexpr uint16_t VP_E0_CONTROL = 0x2210; constexpr uint16_t VP_E1_CONTROL = 0x2212; //constexpr uint16_t VP_E2_CONTROL = 0x2214; @@ -148,7 +148,7 @@ constexpr uint16_t VP_E1_BED_PREHEAT = 0x2222; constexpr uint16_t VP_E0_FILAMENT_LOAD_UNLOAD = 0x2300; constexpr uint16_t VP_E1_FILAMENT_LOAD_UNLOAD = 0x2302; -// Settings store , reset +// Settings store, reset constexpr uint16_t VP_SETTINGS = 0x2400; // PID autotune @@ -258,7 +258,7 @@ constexpr uint16_t VP_BED_STATUS = 0x331C; constexpr uint16_t VP_MOVE_OPTION = 0x3400; // Step per mm -constexpr uint16_t VP_X_STEP_PER_MM = 0x3600; // at the moment , uint16_t , 0~1638.4 +constexpr uint16_t VP_X_STEP_PER_MM = 0x3600; // at the moment, uint16_t, 0~1638.4 //constexpr uint16_t VP_X2_STEP_PER_MM = 0x3602; constexpr uint16_t VP_Y_STEP_PER_MM = 0x3604; //constexpr uint16_t VP_Y2_STEP_PER_MM = 0x3606; @@ -272,10 +272,10 @@ constexpr uint16_t VP_E1_STEP_PER_MM = 0x3612; //constexpr uint16_t VP_E5_STEP_PER_MM = 0x361A; // PIDs -constexpr uint16_t VP_E0_PID_P = 0x3700; // at the moment , uint16_t , 0~1638.4 +constexpr uint16_t VP_E0_PID_P = 0x3700; // at the moment, uint16_t, 0~1638.4 constexpr uint16_t VP_E0_PID_I = 0x3702; constexpr uint16_t VP_E0_PID_D = 0x3704; -constexpr uint16_t VP_E1_PID_P = 0x3706; // at the moment , uint16_t , 0~1638.4 +constexpr uint16_t VP_E1_PID_P = 0x3706; // at the moment, uint16_t, 0~1638.4 constexpr uint16_t VP_E1_PID_I = 0x3708; constexpr uint16_t VP_E1_PID_D = 0x370A; constexpr uint16_t VP_BED_PID_P = 0x3710; diff --git a/Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.cpp b/Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.cpp index 79e0ccf942..db0ebbc903 100644 --- a/Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.cpp +++ b/Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.cpp @@ -308,7 +308,7 @@ const struct VPMapping VPMap[] PROGMEM = { { 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. + { 0, nullptr } // List is terminated with an nullptr as table entry. }; const char MarlinVersion[] PROGMEM = SHORT_BUILD_VERSION; diff --git a/Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.h b/Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.h index a5e0d327a4..f7a716f4d5 100644 --- a/Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.h +++ b/Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.h @@ -121,13 +121,13 @@ constexpr uint16_t VP_MOTOR_LOCK_UNLOCK = 0x2130; // Power loss recovery constexpr uint16_t VP_POWER_LOSS_RECOVERY = 0x2180; -// Fan Control Buttons , switch between "off" and "on" +// Fan Control Buttons, switch between "off" and "on" constexpr uint16_t VP_FAN0_CONTROL = 0x2200; constexpr uint16_t VP_FAN1_CONTROL = 0x2202; //constexpr uint16_t VP_FAN2_CONTROL = 0x2204; //constexpr uint16_t VP_FAN3_CONTROL = 0x2206; -// Heater Control Buttons , triged between "cool down" and "heat PLA" state +// Heater Control Buttons, triged between "cool down" and "heat PLA" state constexpr uint16_t VP_E0_CONTROL = 0x2210; constexpr uint16_t VP_E1_CONTROL = 0x2212; //constexpr uint16_t VP_E2_CONTROL = 0x2214; @@ -147,7 +147,7 @@ constexpr uint16_t VP_E0_BED_PREHEAT = 0x2220; // Filament load and unload constexpr uint16_t VP_E0_FILAMENT_LOAD_UNLOAD = 0x2300; -// Settings store , reset +// Settings store, reset constexpr uint16_t VP_SETTINGS = 0x2400; // PID autotune @@ -257,7 +257,7 @@ constexpr uint16_t VP_BED_STATUS = 0x331C; constexpr uint16_t VP_MOVE_OPTION = 0x3400; // Step per mm -constexpr uint16_t VP_X_STEP_PER_MM = 0x3600; // at the moment , uint16_t , 0~1638.4 +constexpr uint16_t VP_X_STEP_PER_MM = 0x3600; // at the moment, uint16_t, 0~1638.4 //constexpr uint16_t VP_X2_STEP_PER_MM = 0x3602; constexpr uint16_t VP_Y_STEP_PER_MM = 0x3604; //constexpr uint16_t VP_Y2_STEP_PER_MM = 0x3606; @@ -271,7 +271,7 @@ constexpr uint16_t VP_E0_STEP_PER_MM = 0x3610; //constexpr uint16_t VP_E5_STEP_PER_MM = 0x361A; // PIDs -constexpr uint16_t VP_E0_PID_P = 0x3700; // at the moment , uint16_t , 0~1638.4 +constexpr uint16_t VP_E0_PID_P = 0x3700; // at the moment, uint16_t, 0~1638.4 constexpr uint16_t VP_E0_PID_I = 0x3702; constexpr uint16_t VP_E0_PID_D = 0x3704; constexpr uint16_t VP_BED_PID_P = 0x3710; diff --git a/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.cpp b/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.cpp index 4a67f78b8c..b108dab0a0 100644 --- a/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.cpp +++ b/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.cpp @@ -327,7 +327,7 @@ const uint16_t MKSList_MotionConfig[] PROGMEM = { const uint16_t MKSList_EX_Config[] PROGMEM = { INFO_BAR - VP_MIN_EX_T,VP_Min_EX_T_E, + VP_MIN_EX_T, VP_Min_EX_T_E, 0x0000 }; @@ -666,9 +666,9 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = { VPHELPER(VP_SD_Print_LiveAdjustZ_Confirm, nullptr, screen.zOffsetConfirm, nullptr), - VPHELPER(VP_ZOffset_Distance,nullptr ,screen.getZoffsetDistance, 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), + VPHELPER(VP_MESH_LEVEL_POINT, nullptr, screen.meshLevel, nullptr), #if ENABLED(PREVENT_COLD_EXTRUSION) VPHELPER(VP_Min_EX_T_E, &thermalManager.extrude_min_temp, screen.getMinExtrudeTemp, screen.sendWordValueToDisplay), @@ -709,9 +709,9 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = { VPHELPER(VP_ZOffset_DE_DIS, &z_offset_add, nullptr, screen.sendFloatAsLongValueToDisplay<2>), #endif #if HAS_BED_PROBE - 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>), + 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, screen.printReturn, nullptr), diff --git a/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.h b/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.h index a0e5b5d731..ba5508e441 100644 --- a/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.h +++ b/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.h @@ -301,7 +301,7 @@ constexpr uint16_t SP_T_Bed_Set = 0x5040; constexpr uint16_t VP_Y_HOME = 0x2338; constexpr uint16_t VP_Z_HOME = 0x233A; - // Fan Control Buttons , switch between "off" and "on" + // Fan Control Buttons, switch between "off" and "on" constexpr uint16_t VP_FAN0_CONTROL = 0x2350; constexpr uint16_t VP_FAN1_CONTROL = 0x2352; constexpr uint16_t VP_FAN2_CONTROL = 0x2354; @@ -350,7 +350,7 @@ constexpr uint16_t SP_T_Bed_Set = 0x5040; constexpr uint16_t VP_FAN3_STATUS = 0x2716; // Step per mm - constexpr uint16_t VP_X_STEP_PER_MM = 0x2900; // at the moment , uint16_t , 0~1638.4 + constexpr uint16_t VP_X_STEP_PER_MM = 0x2900; // at the moment, uint16_t, 0~1638.4 constexpr uint16_t VP_Y_STEP_PER_MM = 0x2904; constexpr uint16_t VP_Z_STEP_PER_MM = 0x2908; constexpr uint16_t VP_E0_STEP_PER_MM = 0x2910; @@ -450,10 +450,10 @@ constexpr uint16_t SP_T_Bed_Set = 0x5040; constexpr uint16_t VP_PrintTime_S = 0x3504; // PIDs - constexpr uint16_t VP_E0_PID_P = 0x3700; // at the moment , uint16_t , 0~1638.4 + constexpr uint16_t VP_E0_PID_P = 0x3700; // at the moment, uint16_t, 0~1638.4 constexpr uint16_t VP_E0_PID_I = 0x3702; constexpr uint16_t VP_E0_PID_D = 0x3704; - constexpr uint16_t VP_E1_PID_P = 0x3706; // at the moment , uint16_t , 0~1638.4 + constexpr uint16_t VP_E1_PID_P = 0x3706; // at the moment, uint16_t, 0~1638.4 constexpr uint16_t VP_E1_PID_I = 0x3708; constexpr uint16_t VP_E1_PID_D = 0x370A; constexpr uint16_t VP_BED_PID_P = 0x3710; @@ -482,7 +482,7 @@ constexpr uint16_t SP_T_Bed_Set = 0x5040; constexpr uint16_t VP_Z_PARK_POS = 0x3904; /* -------------------------------0x4000-0x4FFF------------------------------- */ - // Heater Control Buttons , triged between "cool down" and "heat PLA" state + // Heater Control Buttons, triged between "cool down" and "heat PLA" state constexpr uint16_t VP_E0_CONTROL = 0x4010; constexpr uint16_t VP_E1_CONTROL = 0x4012; constexpr uint16_t VP_BED_CONTROL = 0x401C; @@ -495,7 +495,7 @@ constexpr uint16_t SP_T_Bed_Set = 0x5040; //constexpr uint16_t VP_E0_FILAMENT_LOAD_UNLOAD = 0x4030; //constexpr uint16_t VP_E1_FILAMENT_LOAD_UNLOAD = 0x4032; - // Settings store , reset + // Settings store, reset // Level data constexpr uint16_t VP_Level_Point_One_X = 0x4100; diff --git a/Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.cpp b/Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.cpp index ac408e8d9c..2cb7bd6f83 100644 --- a/Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.cpp +++ b/Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.cpp @@ -119,7 +119,7 @@ const struct VPMapping VPMap[] PROGMEM = { { 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. + { 0, nullptr } // List is terminated with an nullptr as table entry. }; const char MarlinVersion[] PROGMEM = SHORT_BUILD_VERSION; diff --git a/Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.h b/Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.h index d34b90b45f..6b5b780283 100644 --- a/Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.h +++ b/Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.h @@ -116,13 +116,13 @@ constexpr uint16_t VP_MOTOR_LOCK_UNLOCK = 0x2130; // Power loss recovery constexpr uint16_t VP_POWER_LOSS_RECOVERY = 0x2180; -// Fan Control Buttons , switch between "off" and "on" +// Fan Control Buttons, switch between "off" and "on" constexpr uint16_t VP_FAN0_CONTROL = 0x2200; constexpr uint16_t VP_FAN1_CONTROL = 0x2202; //constexpr uint16_t VP_FAN2_CONTROL = 0x2204; //constexpr uint16_t VP_FAN3_CONTROL = 0x2206; -// Heater Control Buttons , triged between "cool down" and "heat PLA" state +// Heater Control Buttons, triged between "cool down" and "heat PLA" state constexpr uint16_t VP_E0_CONTROL = 0x2210; constexpr uint16_t VP_E1_CONTROL = 0x2212; //constexpr uint16_t VP_E2_CONTROL = 0x2214; @@ -143,7 +143,7 @@ constexpr uint16_t VP_E1_BED_CONTROL = 0x2222; constexpr uint16_t VP_E0_FILAMENT_LOAD_UNLOAD = 0x2300; constexpr uint16_t VP_E1_FILAMENT_LOAD_UNLOAD = 0x2302; -// Settings store , reset +// Settings store, reset constexpr uint16_t VP_SETTINGS = 0x2400; // PID autotune @@ -247,7 +247,7 @@ constexpr uint16_t VP_BED_STATUS = 0x331C; constexpr uint16_t VP_MOVE_OPTION = 0x3400; // Step per mm -constexpr uint16_t VP_X_STEP_PER_MM = 0x3600; // at the moment , uint16_t , 0~1638.4 +constexpr uint16_t VP_X_STEP_PER_MM = 0x3600; // at the moment, uint16_t, 0~1638.4 //constexpr uint16_t VP_X2_STEP_PER_MM = 0x3602; constexpr uint16_t VP_Y_STEP_PER_MM = 0x3604; //constexpr uint16_t VP_Y2_STEP_PER_MM = 0x3606; @@ -261,7 +261,7 @@ constexpr uint16_t VP_E0_STEP_PER_MM = 0x3610; //constexpr uint16_t VP_E5_STEP_PER_MM = 0x361A; // PIDs -constexpr uint16_t VP_E0_PID_P = 0x3700; // at the moment , uint16_t , 0~1638.4 +constexpr uint16_t VP_E0_PID_P = 0x3700; // at the moment, uint16_t, 0~1638.4 constexpr uint16_t VP_E0_PID_I = 0x3702; constexpr uint16_t VP_E0_PID_D = 0x3704; constexpr uint16_t VP_BED_PID_P = 0x3710; diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/scripts/font2cpp.py b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/scripts/font2cpp.py index 98a2420497..8d066d876a 100755 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/scripts/font2cpp.py +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/scripts/font2cpp.py @@ -56,7 +56,7 @@ class WriteSource: data.append(0) # Combine each two adjacent values into one i = iter(data) - data = list(map(lambda a, b: a << 4 | b, i ,i)) + data = list(map(lambda a, b: a << 4 | b, i, i)) # Pack the data data = pack_rle(data) # Convert values into hex strings diff --git a/Marlin/src/lcd/extui/mks_ui/tft_Language_en.h b/Marlin/src/lcd/extui/mks_ui/tft_Language_en.h index 5195986e35..f012b17ea7 100644 --- a/Marlin/src/lcd/extui/mks_ui/tft_Language_en.h +++ b/Marlin/src/lcd/extui/mks_ui/tft_Language_en.h @@ -399,8 +399,8 @@ #define FILAMENT_DIALOG_LOAD_CONFIRM1_TIPS_EN "Heat completed,please load filament \nto extruder,and click \nfor start loading." #define FILAMENT_DIALOG_LOAD_CONFIRM2_TIPS_EN "Please load filament to extruder,\nand click for start loading." #define FILAMENT_DIALOG_UNLOAD_CONFIRM_TIPS_EN "Heat completed,please \nclick for start unloading.!" -#define FILAMENT_DIALOG_LOADING_TIPS_EN "Is loading ,please wait!" -#define FILAMENT_DIALOG_UNLOADING_TIPS_EN "Is unloading,please wait!" +#define FILAMENT_DIALOG_LOADING_TIPS_EN "Is loading, please wait!" +#define FILAMENT_DIALOG_UNLOADING_TIPS_EN "Is unloading, please wait!" #define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_EN "Load filament completed,\nclick for return!" #define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_EN "Unload filament completed,\nclick for return!" diff --git a/Marlin/src/lcd/extui/mks_ui/tft_Language_it.h b/Marlin/src/lcd/extui/mks_ui/tft_Language_it.h index b74842afef..2be8f7d17b 100644 --- a/Marlin/src/lcd/extui/mks_ui/tft_Language_it.h +++ b/Marlin/src/lcd/extui/mks_ui/tft_Language_it.h @@ -149,8 +149,8 @@ #define FILAMENT_DIALOG_LOAD_CONFIRM1_TIPS_IT "Heat completed,please load filament \nto extruder,and click \nfor start loading." #define FILAMENT_DIALOG_LOAD_CONFIRM2_TIPS_IT "Please load filament to extruder,\nand click for start loading." #define FILAMENT_DIALOG_UNLOAD_CONFIRM_TIPS_IT "Heat completed,please \nclick for start unloading.!" -#define FILAMENT_DIALOG_LOADING_TIPS_IT "Is loading ,please wait!" -#define FILAMENT_DIALOG_UNLOADING_TIPS_IT "Is unloading,please wait!" +#define FILAMENT_DIALOG_LOADING_TIPS_IT "Is loading, please wait!" +#define FILAMENT_DIALOG_UNLOADING_TIPS_IT "Is unloading, please wait!" #define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_IT "Load filament completed,\nclick for return!" #define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_IT "Unload filament completed,\nclick for return!" diff --git a/Marlin/src/lcd/extui/mks_ui/tft_Language_ru.h b/Marlin/src/lcd/extui/mks_ui/tft_Language_ru.h index da36ed14c7..aced93f4b6 100644 --- a/Marlin/src/lcd/extui/mks_ui/tft_Language_ru.h +++ b/Marlin/src/lcd/extui/mks_ui/tft_Language_ru.h @@ -148,8 +148,8 @@ #define FILAMENT_DIALOG_LOAD_CONFIRM1_TIPS_RU "Heat completed,please load filament \nto extruder,and click \nfor start loading." #define FILAMENT_DIALOG_LOAD_CONFIRM2_TIPS_RU "Please load filament to extruder,\nand click for start loading." #define FILAMENT_DIALOG_UNLOAD_CONFIRM_TIPS_RU "Heat completed,please \nclick for start unloading.!" -#define FILAMENT_DIALOG_LOADING_TIPS_RU "Is loading ,please wait!" -#define FILAMENT_DIALOG_UNLOADING_TIPS_RU "Is unloading,please wait!" +#define FILAMENT_DIALOG_LOADING_TIPS_RU "Is loading, please wait!" +#define FILAMENT_DIALOG_UNLOADING_TIPS_RU "Is unloading, please wait!" #define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_RU "Load filament completed,\nclick for return!" #define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_RU "Unload filament completed,\nclick for return!" diff --git a/Marlin/src/lcd/extui/ui_api.h b/Marlin/src/lcd/extui/ui_api.h index dfe393e39a..5e781706bc 100644 --- a/Marlin/src/lcd/extui/ui_api.h +++ b/Marlin/src/lcd/extui/ui_api.h @@ -430,7 +430,7 @@ namespace ExtUI { float getPID_Kp(const extruder_t); float getPID_Ki(const extruder_t); float getPID_Kd(const extruder_t); - void setPID(const_float_t, const_float_t , const_float_t , extruder_t); + void setPID(const_float_t, const_float_t, const_float_t, extruder_t); void startPIDTune(const celsius_t, extruder_t); #endif @@ -439,7 +439,7 @@ namespace ExtUI { float getBedPID_Kp(); float getBedPID_Ki(); float getBedPID_Kd(); - void setBedPID(const_float_t, const_float_t , const_float_t); + void setBedPID(const_float_t, const_float_t, const_float_t); void startBedPIDTune(const celsius_t); #endif diff --git a/Marlin/src/lcd/tft/ui_color_ui.cpp b/Marlin/src/lcd/tft/ui_color_ui.cpp index 64eed045e1..8186650070 100644 --- a/Marlin/src/lcd/tft/ui_color_ui.cpp +++ b/Marlin/src/lcd/tft/ui_color_ui.cpp @@ -248,21 +248,21 @@ void MarlinUI::draw_status_screen() { tft.add_rectangle(0, 0, COORDINATES_W, COORDINATES_H, COLOR_AXIS_HOMED); #if HAS_X_AXIS && defined(X_MARK_X) && defined(X_MARK_Y) && defined(X_VALUE_X) && defined(X_VALUE_Y) - tft.add_text(X_MARK_X, X_MARK_Y, COLOR_AXIS_HOMED , "X"); + tft.add_text(X_MARK_X, X_MARK_Y, 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(X_VALUE_X, X_VALUE_Y, nhx ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string); #endif #if HAS_Y_AXIS && defined(Y_MARK_X) && defined(Y_MARK_Y) && defined(Y_VALUE_X) && defined(Y_VALUE_Y) - tft.add_text(Y_MARK_X, Y_MARK_Y, COLOR_AXIS_HOMED , "Y"); + tft.add_text(Y_MARK_X, Y_MARK_Y, 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(Y_VALUE_X, Y_VALUE_Y, nhy ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string); #endif #if HAS_Z_AXIS && defined(Z_MARK_X) && defined(Z_MARK_Y) && defined(Z_VALUE_X) && defined(Z_VALUE_Y) && defined(Z_VALUE_OFFSET) - tft.add_text(Z_MARK_X, Z_MARK_Y, COLOR_AXIS_HOMED , "Z"); + tft.add_text(Z_MARK_X, Z_MARK_Y, COLOR_AXIS_HOMED, "Z"); uint16_t offset = Z_VALUE_OFFSET; const bool nhz = axis_should_home(Z_AXIS); if (blink && nhz) diff --git a/Marlin/src/module/scara.cpp b/Marlin/src/module/scara.cpp index d6656d36d8..50aaf56196 100644 --- a/Marlin/src/module/scara.cpp +++ b/Marlin/src/module/scara.cpp @@ -223,7 +223,7 @@ float segments_per_second = DEFAULT_SEGMENTS_PER_SECOND; //const int x_axis_home_dir = TOOL_X_HOME_DIR(active_extruder); - //const xy_pos_t pos { max_length(X_AXIS) , max_length(Y_AXIS) }; + //const xy_pos_t pos { max_length(X_AXIS), max_length(Y_AXIS) }; //const float mlz = max_length(X_AXIS), // Move all carriages together linearly until an endstop is hit. @@ -293,7 +293,7 @@ float segments_per_second = DEFAULT_SEGMENTS_PER_SECOND; delta.set(DEGREES(THETA), DEGREES(PHI), DEGREES(PSI)); - //SERIAL_ECHOLNPGM(" SCARA (x,y,z) ", spos.x , ",", spos.y, ",", spos.z, " Rho=", RHO, " Rho2=", RHO2, " Theta=", THETA, " Phi=", PHI, " Psi=", PSI, " Gamma=", GAMMA); + //SERIAL_ECHOLNPGM(" SCARA (x,y,z) ", spos.x, ",", spos.y, ",", spos.z, " Rho=", RHO, " Rho2=", RHO2, " Theta=", THETA, " Phi=", PHI, " Psi=", PSI, " Gamma=", GAMMA); } #endif diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 7da051f9d7..169d86a72f 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -1755,7 +1755,7 @@ void Temperature::mintemp_error(const heater_id_t heater_id OPTARG(ERR_INCLUDE_T float ambient_xfer_coeff = mpc.ambient_xfer_coeff_fan0; #if ENABLED(MPC_INCLUDE_FAN) const uint8_t fan_index = TERN(SINGLEFAN, 0, ee); - const float fan_fraction = TERN_(MPC_FAN_0_ACTIVE_HOTEND, !this_hotend ? 0.0f : ) fan_speed[fan_index] * RECIPROCAL(255); + const float fan_fraction = TERN_(MPC_FAN_0_ACTIVE_HOTEND, !this_hotend ? 0.0f :) fan_speed[fan_index] * RECIPROCAL(255); ambient_xfer_coeff += fan_fraction * mpc.fan255_adjustment; #endif @@ -3589,7 +3589,7 @@ void Temperature::disable_all_heaters() { #define THERMO_SEL(A,B,C) (hindex > 1 ? (C) : hindex == 1 ? (B) : (A)) #define MAXTC_CS_WRITE(V) do{ switch (hindex) { case 1: WRITE(TEMP_1_CS_PIN, V); break; case 2: WRITE(TEMP_2_CS_PIN, V); break; default: WRITE(TEMP_0_CS_PIN, V); } }while(0) #elif MAX_TC_COUNT > 1 - #define THERMO_SEL(A,B,C) ( hindex == 1 ? (B) : (A)) + #define THERMO_SEL(A,B,C) (hindex == 1 ? (B) : (A)) #define MAXTC_CS_WRITE(V) do{ switch (hindex) { case 1: WRITE(TEMP_1_CS_PIN, V); break; default: WRITE(TEMP_0_CS_PIN, V); } }while(0) #endif #else diff --git a/Marlin/src/module/thermistor/thermistor_666.h b/Marlin/src/module/thermistor/thermistor_666.h index 14a03c23b5..1b3a3a4615 100644 --- a/Marlin/src/module/thermistor/thermistor_666.h +++ b/Marlin/src/module/thermistor/thermistor_666.h @@ -42,7 +42,7 @@ constexpr temp_entry_t temptable_666[] PROGMEM = { { OV( 86), 176 }, { OV(103), 166 }, { OV(120), 157 }, - { OV(137) ,150 }, + { OV(137), 150 }, { OV(154), 144 }, { OV(172), 138 }, { OV(189), 134 }, diff --git a/Marlin/src/pins/sam/pins_ALLIGATOR_R2.h b/Marlin/src/pins/sam/pins_ALLIGATOR_R2.h index 6f6182a684..5e9df26fdd 100644 --- a/Marlin/src/pins/sam/pins_ALLIGATOR_R2.h +++ b/Marlin/src/pins/sam/pins_ALLIGATOR_R2.h @@ -92,7 +92,7 @@ #define MICROSTEP32 HIGH,HIGH,LOW #endif -//#define MOTOR_FAULT_PIN 22 // PB26 , motor X-Y-Z-E0 motor FAULT +//#define MOTOR_FAULT_PIN 22 // PB26, motor X-Y-Z-E0 motor FAULT // // Temperature Sensors 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 7e145ccc0e..98ec48de80 100644 --- a/Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h +++ b/Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h @@ -36,7 +36,7 @@ #endif #ifndef BOARD_INFO_NAME - #define BOARD_INFO_NAME "BRICOLEMON LITE V1.0" // , Lemoncrest & BricoGeek collaboration. + #define BOARD_INFO_NAME "BRICOLEMON LITE V1.0" // Lemoncrest & BricoGeek collaboration. #endif /** diff --git a/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h b/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h index c00caa73a4..37f0b79f6b 100644 --- a/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h +++ b/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h @@ -30,7 +30,7 @@ #endif #ifndef BOARD_INFO_NAME - #define BOARD_INFO_NAME "BRICOLEMON V1.0" // , Lemoncrest & BricoGeek collaboration. + #define BOARD_INFO_NAME "BRICOLEMON V1.0" // Lemoncrest & BricoGeek collaboration. #endif /** diff --git a/Marlin/src/sd/usb_flashdrive/lib-uhs3/dyn_SWI/dyn_SWI.h b/Marlin/src/sd/usb_flashdrive/lib-uhs3/dyn_SWI/dyn_SWI.h index 652b43fd2e..cb99851fdd 100644 --- a/Marlin/src/sd/usb_flashdrive/lib-uhs3/dyn_SWI/dyn_SWI.h +++ b/Marlin/src/sd/usb_flashdrive/lib-uhs3/dyn_SWI/dyn_SWI.h @@ -79,7 +79,7 @@ extern "C" #define NVIC_GET_PENDING(n) NVIC_GetPendingIRQ((IRQn_Type)n) #define NVIC_SET_PENDING(n) NVIC_SetPendingIRQ((IRQn_Type)n) #define NVIC_ENABLE_IRQ(n) NVIC_EnableIRQ((IRQn_Type)n) -#define NVIC_SET_PRIORITY(n ,p) NVIC_SetPriority((IRQn_Type)n, (uint32_t) p) +#define NVIC_SET_PRIORITY(n, p) NVIC_SetPriority((IRQn_Type)n, (uint32_t) p) //extern "C" { // extern uint32_t _VectorsRam[VECTORTABLE_SIZE] __attribute__((aligned(VECTORTABLE_ALIGNMENT))); //} diff --git a/buildroot/share/PlatformIO/scripts/exc.S b/buildroot/share/PlatformIO/scripts/exc.S index 1db462bb23..3a61701aca 100644 --- a/buildroot/share/PlatformIO/scripts/exc.S +++ b/buildroot/share/PlatformIO/scripts/exc.S @@ -81,7 +81,7 @@ __exc_usagefault: .thumb_func __default_exc: ldr r2, NVIC_CCR @ Enable returning to thread mode even if there are - mov r1 ,#1 @ pending exceptions. See flag NONEBASETHRDENA. + mov r1, #1 @ pending exceptions. See flag NONEBASETHRDENA. str r1, [r2] cpsid i @ Disable global interrupts ldr r2, SYSTICK_CSR @ Disable systick handler diff --git a/buildroot/share/PlatformIO/variants/MARLIN_FLY_D5/ldscript.ld b/buildroot/share/PlatformIO/variants/MARLIN_FLY_D5/ldscript.ld index e86d8aa274..9d9d6e5a59 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_FLY_D5/ldscript.ld +++ b/buildroot/share/PlatformIO/variants/MARLIN_FLY_D5/ldscript.ld @@ -37,7 +37,7 @@ _Min_Stack_Size = 0x400; /* required amount of stack */ MEMORY { RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 16K - FLASH (rx) : ORIGIN = 0x8000000 , LENGTH = 128K + FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 128K } /* Sections */ diff --git a/buildroot/share/PlatformIO/variants/MARLIN_FLY_D7/ldscript.ld b/buildroot/share/PlatformIO/variants/MARLIN_FLY_D7/ldscript.ld index e86d8aa274..9d9d6e5a59 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_FLY_D7/ldscript.ld +++ b/buildroot/share/PlatformIO/variants/MARLIN_FLY_D7/ldscript.ld @@ -37,7 +37,7 @@ _Min_Stack_Size = 0x400; /* required amount of stack */ MEMORY { RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 16K - FLASH (rx) : ORIGIN = 0x8000000 , LENGTH = 128K + FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 128K } /* Sections */ diff --git a/buildroot/share/PlatformIO/variants/MARLIN_MEGA_EXTENDED/pins_arduino.h b/buildroot/share/PlatformIO/variants/MARLIN_MEGA_EXTENDED/pins_arduino.h index cae4d83024..2d342f57c7 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_MEGA_EXTENDED/pins_arduino.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_MEGA_EXTENDED/pins_arduino.h @@ -168,274 +168,274 @@ const uint16_t PROGMEM port_to_input_PGM[] = { const uint8_t PROGMEM digital_pin_to_port_PGM[] = { // PORTLIST // ------------------------------------------- - PE , // PE 0 ** 0 ** USART0_RX - PE , // PE 1 ** 1 ** USART0_TX - PE , // PE 4 ** 2 ** PWM2 - PE , // PE 5 ** 3 ** PWM3 - PG , // PG 5 ** 4 ** PWM4 - PE , // PE 3 ** 5 ** PWM5 - PH , // PH 3 ** 6 ** PWM6 - PH , // PH 4 ** 7 ** PWM7 - PH , // PH 5 ** 8 ** PWM8 - PH , // PH 6 ** 9 ** PWM9 - PB , // PB 4 ** 10 ** PWM10 - PB , // PB 5 ** 11 ** PWM11 - PB , // PB 6 ** 12 ** PWM12 - PB , // PB 7 ** 13 ** PWM13 - PJ , // PJ 1 ** 14 ** USART3_TX - PJ , // PJ 0 ** 15 ** USART3_RX - PH , // PH 1 ** 16 ** USART2_TX - PH , // PH 0 ** 17 ** USART2_RX - PD , // PD 3 ** 18 ** USART1_TX - PD , // PD 2 ** 19 ** USART1_RX - PD , // PD 1 ** 20 ** I2C_SDA - PD , // PD 0 ** 21 ** I2C_SCL - PA , // PA 0 ** 22 ** D22 - PA , // PA 1 ** 23 ** D23 - PA , // PA 2 ** 24 ** D24 - PA , // PA 3 ** 25 ** D25 - PA , // PA 4 ** 26 ** D26 - PA , // PA 5 ** 27 ** D27 - PA , // PA 6 ** 28 ** D28 - PA , // PA 7 ** 29 ** D29 - PC , // PC 7 ** 30 ** D30 - PC , // PC 6 ** 31 ** D31 - PC , // PC 5 ** 32 ** D32 - PC , // PC 4 ** 33 ** D33 - PC , // PC 3 ** 34 ** D34 - PC , // PC 2 ** 35 ** D35 - PC , // PC 1 ** 36 ** D36 - PC , // PC 0 ** 37 ** D37 - PD , // PD 7 ** 38 ** D38 - PG , // PG 2 ** 39 ** D39 - PG , // PG 1 ** 40 ** D40 - PG , // PG 0 ** 41 ** D41 - PL , // PL 7 ** 42 ** D42 - PL , // PL 6 ** 43 ** D43 - PL , // PL 5 ** 44 ** D44 - PL , // PL 4 ** 45 ** D45 - PL , // PL 3 ** 46 ** D46 - PL , // PL 2 ** 47 ** D47 - PL , // PL 1 ** 48 ** D48 - PL , // PL 0 ** 49 ** D49 - PB , // PB 3 ** 50 ** SPI_MISO - PB , // PB 2 ** 51 ** SPI_MOSI - PB , // PB 1 ** 52 ** SPI_SCK - PB , // PB 0 ** 53 ** SPI_SS - PF , // PF 0 ** 54 ** A0 - PF , // PF 1 ** 55 ** A1 - PF , // PF 2 ** 56 ** A2 - PF , // PF 3 ** 57 ** A3 - PF , // PF 4 ** 58 ** A4 - PF , // PF 5 ** 59 ** A5 - PF , // PF 6 ** 60 ** A6 - PF , // PF 7 ** 61 ** A7 - PK , // PK 0 ** 62 ** A8 - PK , // PK 1 ** 63 ** A9 - PK , // PK 2 ** 64 ** A10 - PK , // PK 3 ** 65 ** A11 - PK , // PK 4 ** 66 ** A12 - PK , // PK 5 ** 67 ** A13 - PK , // PK 6 ** 68 ** A14 - PK , // PK 7 ** 69 ** A15 - PG , // PG 4 ** 70 ** D70 - PG , // PG 3 ** 71 ** D71 - PJ , // PJ 2 ** 72 ** D72 - PJ , // PJ 3 ** 73 ** D73 - PJ , // PJ 7 ** 74 ** D74 - PJ , // PJ 4 ** 75 ** D75 - PJ , // PJ 5 ** 76 ** D76 - PJ , // PJ 6 ** 77 ** D77 - PE , // PE 2 ** 78 ** D78 - PE , // PE 6 ** 79 ** D79 - PE , // PE 7 ** 80 ** D80 - PD , // PD 4 ** 81 ** D81 - PD , // PD 5 ** 82 ** D82 - PD , // PD 6 ** 83 ** D83 - PH , // PH 2 ** 84 ** D84 - PH , // PH 7 ** 85 ** D85 + PE, // PE 0 ** 0 ** USART0_RX + PE, // PE 1 ** 1 ** USART0_TX + PE, // PE 4 ** 2 ** PWM2 + PE, // PE 5 ** 3 ** PWM3 + PG, // PG 5 ** 4 ** PWM4 + PE, // PE 3 ** 5 ** PWM5 + PH, // PH 3 ** 6 ** PWM6 + PH, // PH 4 ** 7 ** PWM7 + PH, // PH 5 ** 8 ** PWM8 + PH, // PH 6 ** 9 ** PWM9 + PB, // PB 4 ** 10 ** PWM10 + PB, // PB 5 ** 11 ** PWM11 + PB, // PB 6 ** 12 ** PWM12 + PB, // PB 7 ** 13 ** PWM13 + PJ, // PJ 1 ** 14 ** USART3_TX + PJ, // PJ 0 ** 15 ** USART3_RX + PH, // PH 1 ** 16 ** USART2_TX + PH, // PH 0 ** 17 ** USART2_RX + PD, // PD 3 ** 18 ** USART1_TX + PD, // PD 2 ** 19 ** USART1_RX + PD, // PD 1 ** 20 ** I2C_SDA + PD, // PD 0 ** 21 ** I2C_SCL + PA, // PA 0 ** 22 ** D22 + PA, // PA 1 ** 23 ** D23 + PA, // PA 2 ** 24 ** D24 + PA, // PA 3 ** 25 ** D25 + PA, // PA 4 ** 26 ** D26 + PA, // PA 5 ** 27 ** D27 + PA, // PA 6 ** 28 ** D28 + PA, // PA 7 ** 29 ** D29 + PC, // PC 7 ** 30 ** D30 + PC, // PC 6 ** 31 ** D31 + PC, // PC 5 ** 32 ** D32 + PC, // PC 4 ** 33 ** D33 + PC, // PC 3 ** 34 ** D34 + PC, // PC 2 ** 35 ** D35 + PC, // PC 1 ** 36 ** D36 + PC, // PC 0 ** 37 ** D37 + PD, // PD 7 ** 38 ** D38 + PG, // PG 2 ** 39 ** D39 + PG, // PG 1 ** 40 ** D40 + PG, // PG 0 ** 41 ** D41 + PL, // PL 7 ** 42 ** D42 + PL, // PL 6 ** 43 ** D43 + PL, // PL 5 ** 44 ** D44 + PL, // PL 4 ** 45 ** D45 + PL, // PL 3 ** 46 ** D46 + PL, // PL 2 ** 47 ** D47 + PL, // PL 1 ** 48 ** D48 + PL, // PL 0 ** 49 ** D49 + PB, // PB 3 ** 50 ** SPI_MISO + PB, // PB 2 ** 51 ** SPI_MOSI + PB, // PB 1 ** 52 ** SPI_SCK + PB, // PB 0 ** 53 ** SPI_SS + PF, // PF 0 ** 54 ** A0 + PF, // PF 1 ** 55 ** A1 + PF, // PF 2 ** 56 ** A2 + PF, // PF 3 ** 57 ** A3 + PF, // PF 4 ** 58 ** A4 + PF, // PF 5 ** 59 ** A5 + PF, // PF 6 ** 60 ** A6 + PF, // PF 7 ** 61 ** A7 + PK, // PK 0 ** 62 ** A8 + PK, // PK 1 ** 63 ** A9 + PK, // PK 2 ** 64 ** A10 + PK, // PK 3 ** 65 ** A11 + PK, // PK 4 ** 66 ** A12 + PK, // PK 5 ** 67 ** A13 + PK, // PK 6 ** 68 ** A14 + PK, // PK 7 ** 69 ** A15 + PG, // PG 4 ** 70 ** D70 + PG, // PG 3 ** 71 ** D71 + PJ, // PJ 2 ** 72 ** D72 + PJ, // PJ 3 ** 73 ** D73 + PJ, // PJ 7 ** 74 ** D74 + PJ, // PJ 4 ** 75 ** D75 + PJ, // PJ 5 ** 76 ** D76 + PJ, // PJ 6 ** 77 ** D77 + PE, // PE 2 ** 78 ** D78 + PE, // PE 6 ** 79 ** D79 + PE, // PE 7 ** 80 ** D80 + PD, // PD 4 ** 81 ** D81 + PD, // PD 5 ** 82 ** D82 + PD, // PD 6 ** 83 ** D83 + PH, // PH 2 ** 84 ** D84 + PH, // PH 7 ** 85 ** D85 }; const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = { // PIN IN PORT // ------------------------------------------- - _BV( 0 ) , // PE 0 ** 0 ** USART0_RX - _BV( 1 ) , // PE 1 ** 1 ** USART0_TX - _BV( 4 ) , // PE 4 ** 2 ** PWM2 - _BV( 5 ) , // PE 5 ** 3 ** PWM3 - _BV( 5 ) , // PG 5 ** 4 ** PWM4 - _BV( 3 ) , // PE 3 ** 5 ** PWM5 - _BV( 3 ) , // PH 3 ** 6 ** PWM6 - _BV( 4 ) , // PH 4 ** 7 ** PWM7 - _BV( 5 ) , // PH 5 ** 8 ** PWM8 - _BV( 6 ) , // PH 6 ** 9 ** PWM9 - _BV( 4 ) , // PB 4 ** 10 ** PWM10 - _BV( 5 ) , // PB 5 ** 11 ** PWM11 - _BV( 6 ) , // PB 6 ** 12 ** PWM12 - _BV( 7 ) , // PB 7 ** 13 ** PWM13 - _BV( 1 ) , // PJ 1 ** 14 ** USART3_TX - _BV( 0 ) , // PJ 0 ** 15 ** USART3_RX - _BV( 1 ) , // PH 1 ** 16 ** USART2_TX - _BV( 0 ) , // PH 0 ** 17 ** USART2_RX - _BV( 3 ) , // PD 3 ** 18 ** USART1_TX - _BV( 2 ) , // PD 2 ** 19 ** USART1_RX - _BV( 1 ) , // PD 1 ** 20 ** I2C_SDA - _BV( 0 ) , // PD 0 ** 21 ** I2C_SCL - _BV( 0 ) , // PA 0 ** 22 ** D22 - _BV( 1 ) , // PA 1 ** 23 ** D23 - _BV( 2 ) , // PA 2 ** 24 ** D24 - _BV( 3 ) , // PA 3 ** 25 ** D25 - _BV( 4 ) , // PA 4 ** 26 ** D26 - _BV( 5 ) , // PA 5 ** 27 ** D27 - _BV( 6 ) , // PA 6 ** 28 ** D28 - _BV( 7 ) , // PA 7 ** 29 ** D29 - _BV( 7 ) , // PC 7 ** 30 ** D30 - _BV( 6 ) , // PC 6 ** 31 ** D31 - _BV( 5 ) , // PC 5 ** 32 ** D32 - _BV( 4 ) , // PC 4 ** 33 ** D33 - _BV( 3 ) , // PC 3 ** 34 ** D34 - _BV( 2 ) , // PC 2 ** 35 ** D35 - _BV( 1 ) , // PC 1 ** 36 ** D36 - _BV( 0 ) , // PC 0 ** 37 ** D37 - _BV( 7 ) , // PD 7 ** 38 ** D38 - _BV( 2 ) , // PG 2 ** 39 ** D39 - _BV( 1 ) , // PG 1 ** 40 ** D40 - _BV( 0 ) , // PG 0 ** 41 ** D41 - _BV( 7 ) , // PL 7 ** 42 ** D42 - _BV( 6 ) , // PL 6 ** 43 ** D43 - _BV( 5 ) , // PL 5 ** 44 ** D44 - _BV( 4 ) , // PL 4 ** 45 ** D45 - _BV( 3 ) , // PL 3 ** 46 ** D46 - _BV( 2 ) , // PL 2 ** 47 ** D47 - _BV( 1 ) , // PL 1 ** 48 ** D48 - _BV( 0 ) , // PL 0 ** 49 ** D49 - _BV( 3 ) , // PB 3 ** 50 ** SPI_MISO - _BV( 2 ) , // PB 2 ** 51 ** SPI_MOSI - _BV( 1 ) , // PB 1 ** 52 ** SPI_SCK - _BV( 0 ) , // PB 0 ** 53 ** SPI_SS - _BV( 0 ) , // PF 0 ** 54 ** A0 - _BV( 1 ) , // PF 1 ** 55 ** A1 - _BV( 2 ) , // PF 2 ** 56 ** A2 - _BV( 3 ) , // PF 3 ** 57 ** A3 - _BV( 4 ) , // PF 4 ** 58 ** A4 - _BV( 5 ) , // PF 5 ** 59 ** A5 - _BV( 6 ) , // PF 6 ** 60 ** A6 - _BV( 7 ) , // PF 7 ** 61 ** A7 - _BV( 0 ) , // PK 0 ** 62 ** A8 - _BV( 1 ) , // PK 1 ** 63 ** A9 - _BV( 2 ) , // PK 2 ** 64 ** A10 - _BV( 3 ) , // PK 3 ** 65 ** A11 - _BV( 4 ) , // PK 4 ** 66 ** A12 - _BV( 5 ) , // PK 5 ** 67 ** A13 - _BV( 6 ) , // PK 6 ** 68 ** A14 - _BV( 7 ) , // PK 7 ** 69 ** A15 - _BV( 4 ) , // PG 4 ** 70 ** D70 - _BV( 3 ) , // PG 3 ** 71 ** D71 - _BV( 2 ) , // PJ 2 ** 72 ** D72 - _BV( 3 ) , // PJ 3 ** 73 ** D73 - _BV( 7 ) , // PJ 7 ** 74 ** D74 - _BV( 4 ) , // PJ 4 ** 75 ** D75 - _BV( 5 ) , // PJ 5 ** 76 ** D76 - _BV( 6 ) , // PJ 6 ** 77 ** D77 - _BV( 2 ) , // PE 2 ** 78 ** D78 - _BV( 6 ) , // PE 6 ** 79 ** D79 - _BV( 7 ) , // PE 7 ** 80 ** D80 - _BV( 4 ) , // PD 4 ** 81 ** D81 - _BV( 5 ) , // PD 5 ** 82 ** D82 - _BV( 6 ) , // PD 6 ** 83 ** D83 - _BV( 2 ) , // PH 2 ** 84 ** D84 - _BV( 7 ) , // PH 7 ** 85 ** D85 + _BV( 0 ), // PE 0 ** 0 ** USART0_RX + _BV( 1 ), // PE 1 ** 1 ** USART0_TX + _BV( 4 ), // PE 4 ** 2 ** PWM2 + _BV( 5 ), // PE 5 ** 3 ** PWM3 + _BV( 5 ), // PG 5 ** 4 ** PWM4 + _BV( 3 ), // PE 3 ** 5 ** PWM5 + _BV( 3 ), // PH 3 ** 6 ** PWM6 + _BV( 4 ), // PH 4 ** 7 ** PWM7 + _BV( 5 ), // PH 5 ** 8 ** PWM8 + _BV( 6 ), // PH 6 ** 9 ** PWM9 + _BV( 4 ), // PB 4 ** 10 ** PWM10 + _BV( 5 ), // PB 5 ** 11 ** PWM11 + _BV( 6 ), // PB 6 ** 12 ** PWM12 + _BV( 7 ), // PB 7 ** 13 ** PWM13 + _BV( 1 ), // PJ 1 ** 14 ** USART3_TX + _BV( 0 ), // PJ 0 ** 15 ** USART3_RX + _BV( 1 ), // PH 1 ** 16 ** USART2_TX + _BV( 0 ), // PH 0 ** 17 ** USART2_RX + _BV( 3 ), // PD 3 ** 18 ** USART1_TX + _BV( 2 ), // PD 2 ** 19 ** USART1_RX + _BV( 1 ), // PD 1 ** 20 ** I2C_SDA + _BV( 0 ), // PD 0 ** 21 ** I2C_SCL + _BV( 0 ), // PA 0 ** 22 ** D22 + _BV( 1 ), // PA 1 ** 23 ** D23 + _BV( 2 ), // PA 2 ** 24 ** D24 + _BV( 3 ), // PA 3 ** 25 ** D25 + _BV( 4 ), // PA 4 ** 26 ** D26 + _BV( 5 ), // PA 5 ** 27 ** D27 + _BV( 6 ), // PA 6 ** 28 ** D28 + _BV( 7 ), // PA 7 ** 29 ** D29 + _BV( 7 ), // PC 7 ** 30 ** D30 + _BV( 6 ), // PC 6 ** 31 ** D31 + _BV( 5 ), // PC 5 ** 32 ** D32 + _BV( 4 ), // PC 4 ** 33 ** D33 + _BV( 3 ), // PC 3 ** 34 ** D34 + _BV( 2 ), // PC 2 ** 35 ** D35 + _BV( 1 ), // PC 1 ** 36 ** D36 + _BV( 0 ), // PC 0 ** 37 ** D37 + _BV( 7 ), // PD 7 ** 38 ** D38 + _BV( 2 ), // PG 2 ** 39 ** D39 + _BV( 1 ), // PG 1 ** 40 ** D40 + _BV( 0 ), // PG 0 ** 41 ** D41 + _BV( 7 ), // PL 7 ** 42 ** D42 + _BV( 6 ), // PL 6 ** 43 ** D43 + _BV( 5 ), // PL 5 ** 44 ** D44 + _BV( 4 ), // PL 4 ** 45 ** D45 + _BV( 3 ), // PL 3 ** 46 ** D46 + _BV( 2 ), // PL 2 ** 47 ** D47 + _BV( 1 ), // PL 1 ** 48 ** D48 + _BV( 0 ), // PL 0 ** 49 ** D49 + _BV( 3 ), // PB 3 ** 50 ** SPI_MISO + _BV( 2 ), // PB 2 ** 51 ** SPI_MOSI + _BV( 1 ), // PB 1 ** 52 ** SPI_SCK + _BV( 0 ), // PB 0 ** 53 ** SPI_SS + _BV( 0 ), // PF 0 ** 54 ** A0 + _BV( 1 ), // PF 1 ** 55 ** A1 + _BV( 2 ), // PF 2 ** 56 ** A2 + _BV( 3 ), // PF 3 ** 57 ** A3 + _BV( 4 ), // PF 4 ** 58 ** A4 + _BV( 5 ), // PF 5 ** 59 ** A5 + _BV( 6 ), // PF 6 ** 60 ** A6 + _BV( 7 ), // PF 7 ** 61 ** A7 + _BV( 0 ), // PK 0 ** 62 ** A8 + _BV( 1 ), // PK 1 ** 63 ** A9 + _BV( 2 ), // PK 2 ** 64 ** A10 + _BV( 3 ), // PK 3 ** 65 ** A11 + _BV( 4 ), // PK 4 ** 66 ** A12 + _BV( 5 ), // PK 5 ** 67 ** A13 + _BV( 6 ), // PK 6 ** 68 ** A14 + _BV( 7 ), // PK 7 ** 69 ** A15 + _BV( 4 ), // PG 4 ** 70 ** D70 + _BV( 3 ), // PG 3 ** 71 ** D71 + _BV( 2 ), // PJ 2 ** 72 ** D72 + _BV( 3 ), // PJ 3 ** 73 ** D73 + _BV( 7 ), // PJ 7 ** 74 ** D74 + _BV( 4 ), // PJ 4 ** 75 ** D75 + _BV( 5 ), // PJ 5 ** 76 ** D76 + _BV( 6 ), // PJ 6 ** 77 ** D77 + _BV( 2 ), // PE 2 ** 78 ** D78 + _BV( 6 ), // PE 6 ** 79 ** D79 + _BV( 7 ), // PE 7 ** 80 ** D80 + _BV( 4 ), // PD 4 ** 81 ** D81 + _BV( 5 ), // PD 5 ** 82 ** D82 + _BV( 6 ), // PD 6 ** 83 ** D83 + _BV( 2 ), // PH 2 ** 84 ** D84 + _BV( 7 ), // PH 7 ** 85 ** D85 }; const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { // TIMERS // ------------------------------------------- - NOT_ON_TIMER , // PE 0 ** 0 ** USART0_RX - NOT_ON_TIMER , // PE 1 ** 1 ** USART0_TX - TIMER3B , // PE 4 ** 2 ** PWM2 - TIMER3C , // PE 5 ** 3 ** PWM3 - TIMER0B , // PG 5 ** 4 ** PWM4 - TIMER3A , // PE 3 ** 5 ** PWM5 - TIMER4A , // PH 3 ** 6 ** PWM6 - TIMER4B , // PH 4 ** 7 ** PWM7 - TIMER4C , // PH 5 ** 8 ** PWM8 - TIMER2B , // PH 6 ** 9 ** PWM9 - TIMER2A , // PB 4 ** 10 ** PWM10 - TIMER1A , // PB 5 ** 11 ** PWM11 - TIMER1B , // PB 6 ** 12 ** PWM12 - TIMER0A , // PB 7 ** 13 ** PWM13 - NOT_ON_TIMER , // PJ 1 ** 14 ** USART3_TX - NOT_ON_TIMER , // PJ 0 ** 15 ** USART3_RX - NOT_ON_TIMER , // PH 1 ** 16 ** USART2_TX - NOT_ON_TIMER , // PH 0 ** 17 ** USART2_RX - NOT_ON_TIMER , // PD 3 ** 18 ** USART1_TX - NOT_ON_TIMER , // PD 2 ** 19 ** USART1_RX - NOT_ON_TIMER , // PD 1 ** 20 ** I2C_SDA - NOT_ON_TIMER , // PD 0 ** 21 ** I2C_SCL - NOT_ON_TIMER , // PA 0 ** 22 ** D22 - NOT_ON_TIMER , // PA 1 ** 23 ** D23 - NOT_ON_TIMER , // PA 2 ** 24 ** D24 - NOT_ON_TIMER , // PA 3 ** 25 ** D25 - NOT_ON_TIMER , // PA 4 ** 26 ** D26 - NOT_ON_TIMER , // PA 5 ** 27 ** D27 - NOT_ON_TIMER , // PA 6 ** 28 ** D28 - NOT_ON_TIMER , // PA 7 ** 29 ** D29 - NOT_ON_TIMER , // PC 7 ** 30 ** D30 - NOT_ON_TIMER , // PC 6 ** 31 ** D31 - NOT_ON_TIMER , // PC 5 ** 32 ** D32 - NOT_ON_TIMER , // PC 4 ** 33 ** D33 - NOT_ON_TIMER , // PC 3 ** 34 ** D34 - NOT_ON_TIMER , // PC 2 ** 35 ** D35 - NOT_ON_TIMER , // PC 1 ** 36 ** D36 - NOT_ON_TIMER , // PC 0 ** 37 ** D37 - NOT_ON_TIMER , // PD 7 ** 38 ** D38 - NOT_ON_TIMER , // PG 2 ** 39 ** D39 - NOT_ON_TIMER , // PG 1 ** 40 ** D40 - NOT_ON_TIMER , // PG 0 ** 41 ** D41 - NOT_ON_TIMER , // PL 7 ** 42 ** D42 - NOT_ON_TIMER , // PL 6 ** 43 ** D43 - TIMER5C , // PL 5 ** 44 ** D44 - TIMER5B , // PL 4 ** 45 ** D45 - TIMER5A , // PL 3 ** 46 ** D46 - NOT_ON_TIMER , // PL 2 ** 47 ** D47 - NOT_ON_TIMER , // PL 1 ** 48 ** D48 - NOT_ON_TIMER , // PL 0 ** 49 ** D49 - NOT_ON_TIMER , // PB 3 ** 50 ** SPI_MISO - NOT_ON_TIMER , // PB 2 ** 51 ** SPI_MOSI - NOT_ON_TIMER , // PB 1 ** 52 ** SPI_SCK - NOT_ON_TIMER , // PB 0 ** 53 ** SPI_SS - NOT_ON_TIMER , // PF 0 ** 54 ** A0 - NOT_ON_TIMER , // PF 1 ** 55 ** A1 - NOT_ON_TIMER , // PF 2 ** 56 ** A2 - NOT_ON_TIMER , // PF 3 ** 57 ** A3 - NOT_ON_TIMER , // PF 4 ** 58 ** A4 - NOT_ON_TIMER , // PF 5 ** 59 ** A5 - NOT_ON_TIMER , // PF 6 ** 60 ** A6 - NOT_ON_TIMER , // PF 7 ** 61 ** A7 - NOT_ON_TIMER , // PK 0 ** 62 ** A8 - NOT_ON_TIMER , // PK 1 ** 63 ** A9 - NOT_ON_TIMER , // PK 2 ** 64 ** A10 - NOT_ON_TIMER , // PK 3 ** 65 ** A11 - NOT_ON_TIMER , // PK 4 ** 66 ** A12 - NOT_ON_TIMER , // PK 5 ** 67 ** A13 - NOT_ON_TIMER , // PK 6 ** 68 ** A14 - NOT_ON_TIMER , // PK 7 ** 69 ** A15 - NOT_ON_TIMER , // PG 4 ** 70 ** D70 - NOT_ON_TIMER , // PG 3 ** 71 ** D71 - NOT_ON_TIMER , // PJ 2 ** 72 ** D72 - NOT_ON_TIMER , // PJ 3 ** 73 ** D73 - NOT_ON_TIMER , // PJ 7 ** 74 ** D74 - NOT_ON_TIMER , // PJ 4 ** 75 ** D75 - NOT_ON_TIMER , // PJ 5 ** 76 ** D76 - NOT_ON_TIMER , // PJ 6 ** 77 ** D77 - NOT_ON_TIMER , // PE 2 ** 78 ** D78 - NOT_ON_TIMER , // PE 6 ** 79 ** D79 - NOT_ON_TIMER , // PE 7 ** 80 ** D80 - NOT_ON_TIMER , // PD 4 ** 81 ** D81 - NOT_ON_TIMER , // PD 5 ** 82 ** D82 - NOT_ON_TIMER , // PD 6 ** 83 ** D83 - NOT_ON_TIMER , // PH 2 ** 84 ** D84 - NOT_ON_TIMER , // PH 7 ** 85 ** D85 + NOT_ON_TIMER, // PE 0 ** 0 ** USART0_RX + NOT_ON_TIMER, // PE 1 ** 1 ** USART0_TX + TIMER3B, // PE 4 ** 2 ** PWM2 + TIMER3C, // PE 5 ** 3 ** PWM3 + TIMER0B, // PG 5 ** 4 ** PWM4 + TIMER3A, // PE 3 ** 5 ** PWM5 + TIMER4A, // PH 3 ** 6 ** PWM6 + TIMER4B, // PH 4 ** 7 ** PWM7 + TIMER4C, // PH 5 ** 8 ** PWM8 + TIMER2B, // PH 6 ** 9 ** PWM9 + TIMER2A, // PB 4 ** 10 ** PWM10 + TIMER1A, // PB 5 ** 11 ** PWM11 + TIMER1B, // PB 6 ** 12 ** PWM12 + TIMER0A, // PB 7 ** 13 ** PWM13 + NOT_ON_TIMER, // PJ 1 ** 14 ** USART3_TX + NOT_ON_TIMER, // PJ 0 ** 15 ** USART3_RX + NOT_ON_TIMER, // PH 1 ** 16 ** USART2_TX + NOT_ON_TIMER, // PH 0 ** 17 ** USART2_RX + NOT_ON_TIMER, // PD 3 ** 18 ** USART1_TX + NOT_ON_TIMER, // PD 2 ** 19 ** USART1_RX + NOT_ON_TIMER, // PD 1 ** 20 ** I2C_SDA + NOT_ON_TIMER, // PD 0 ** 21 ** I2C_SCL + NOT_ON_TIMER, // PA 0 ** 22 ** D22 + NOT_ON_TIMER, // PA 1 ** 23 ** D23 + NOT_ON_TIMER, // PA 2 ** 24 ** D24 + NOT_ON_TIMER, // PA 3 ** 25 ** D25 + NOT_ON_TIMER, // PA 4 ** 26 ** D26 + NOT_ON_TIMER, // PA 5 ** 27 ** D27 + NOT_ON_TIMER, // PA 6 ** 28 ** D28 + NOT_ON_TIMER, // PA 7 ** 29 ** D29 + NOT_ON_TIMER, // PC 7 ** 30 ** D30 + NOT_ON_TIMER, // PC 6 ** 31 ** D31 + NOT_ON_TIMER, // PC 5 ** 32 ** D32 + NOT_ON_TIMER, // PC 4 ** 33 ** D33 + NOT_ON_TIMER, // PC 3 ** 34 ** D34 + NOT_ON_TIMER, // PC 2 ** 35 ** D35 + NOT_ON_TIMER, // PC 1 ** 36 ** D36 + NOT_ON_TIMER, // PC 0 ** 37 ** D37 + NOT_ON_TIMER, // PD 7 ** 38 ** D38 + NOT_ON_TIMER, // PG 2 ** 39 ** D39 + NOT_ON_TIMER, // PG 1 ** 40 ** D40 + NOT_ON_TIMER, // PG 0 ** 41 ** D41 + NOT_ON_TIMER, // PL 7 ** 42 ** D42 + NOT_ON_TIMER, // PL 6 ** 43 ** D43 + TIMER5C, // PL 5 ** 44 ** D44 + TIMER5B, // PL 4 ** 45 ** D45 + TIMER5A, // PL 3 ** 46 ** D46 + NOT_ON_TIMER, // PL 2 ** 47 ** D47 + NOT_ON_TIMER, // PL 1 ** 48 ** D48 + NOT_ON_TIMER, // PL 0 ** 49 ** D49 + NOT_ON_TIMER, // PB 3 ** 50 ** SPI_MISO + NOT_ON_TIMER, // PB 2 ** 51 ** SPI_MOSI + NOT_ON_TIMER, // PB 1 ** 52 ** SPI_SCK + NOT_ON_TIMER, // PB 0 ** 53 ** SPI_SS + NOT_ON_TIMER, // PF 0 ** 54 ** A0 + NOT_ON_TIMER, // PF 1 ** 55 ** A1 + NOT_ON_TIMER, // PF 2 ** 56 ** A2 + NOT_ON_TIMER, // PF 3 ** 57 ** A3 + NOT_ON_TIMER, // PF 4 ** 58 ** A4 + NOT_ON_TIMER, // PF 5 ** 59 ** A5 + NOT_ON_TIMER, // PF 6 ** 60 ** A6 + NOT_ON_TIMER, // PF 7 ** 61 ** A7 + NOT_ON_TIMER, // PK 0 ** 62 ** A8 + NOT_ON_TIMER, // PK 1 ** 63 ** A9 + NOT_ON_TIMER, // PK 2 ** 64 ** A10 + NOT_ON_TIMER, // PK 3 ** 65 ** A11 + NOT_ON_TIMER, // PK 4 ** 66 ** A12 + NOT_ON_TIMER, // PK 5 ** 67 ** A13 + NOT_ON_TIMER, // PK 6 ** 68 ** A14 + NOT_ON_TIMER, // PK 7 ** 69 ** A15 + NOT_ON_TIMER, // PG 4 ** 70 ** D70 + NOT_ON_TIMER, // PG 3 ** 71 ** D71 + NOT_ON_TIMER, // PJ 2 ** 72 ** D72 + NOT_ON_TIMER, // PJ 3 ** 73 ** D73 + NOT_ON_TIMER, // PJ 7 ** 74 ** D74 + NOT_ON_TIMER, // PJ 4 ** 75 ** D75 + NOT_ON_TIMER, // PJ 5 ** 76 ** D76 + NOT_ON_TIMER, // PJ 6 ** 77 ** D77 + NOT_ON_TIMER, // PE 2 ** 78 ** D78 + NOT_ON_TIMER, // PE 6 ** 79 ** D79 + NOT_ON_TIMER, // PE 7 ** 80 ** D80 + NOT_ON_TIMER, // PD 4 ** 81 ** D81 + NOT_ON_TIMER, // PD 5 ** 82 ** D82 + NOT_ON_TIMER, // PD 6 ** 83 ** D83 + NOT_ON_TIMER, // PH 2 ** 84 ** D84 + NOT_ON_TIMER, // PH 7 ** 85 ** D85 }; #endif diff --git a/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/board.cpp b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/board.cpp index 8a4320a664..afaece9760 100644 --- a/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/board.cpp +++ b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/board.cpp @@ -131,74 +131,74 @@ extern const stm32_pin_info PIN_MAP[BOARD_NR_GPIO_PINS] = { {&gpioc, NULL, NULL, 14, 0, ADCx}, /* PC14 OSC32_IN */ {&gpioc, NULL, NULL, 15, 0, ADCx}, /* PC15 OSC32_OUT */ - {&gpiod, NULL, NULL, 0, 0, ADCx} , /* PD0 OSC_IN */ - {&gpiod, NULL, NULL, 1, 0, ADCx} , /* PD1 OSC_OUT */ - {&gpiod, NULL, NULL, 2, 0, ADCx} , /* PD2 TIM3_ETR/UART5_RX SDIO_CMD */ + {&gpiod, NULL, NULL, 0, 0, ADCx}, /* PD0 OSC_IN */ + {&gpiod, NULL, NULL, 1, 0, ADCx}, /* PD1 OSC_OUT */ + {&gpiod, NULL, NULL, 2, 0, ADCx}, /* PD2 TIM3_ETR/UART5_RX SDIO_CMD */ - {&gpiod, NULL, NULL, 3, 0, ADCx} , /* PD3 FSMC_CLK */ - {&gpiod, NULL, NULL, 4, 0, ADCx} , /* PD4 FSMC_NOE */ - {&gpiod, NULL, NULL, 5, 0, ADCx} , /* PD5 FSMC_NWE */ - {&gpiod, NULL, NULL, 6, 0, ADCx} , /* PD6 FSMC_NWAIT */ - {&gpiod, NULL, NULL, 7, 0, ADCx} , /* PD7 FSMC_NE1/FSMC_NCE2 */ - {&gpiod, NULL, NULL, 8, 0, ADCx} , /* PD8 FSMC_D13 */ - {&gpiod, NULL, NULL, 9, 0, ADCx} , /* PD9 FSMC_D14 */ - {&gpiod, NULL, NULL, 10, 0, ADCx} , /* PD10 FSMC_D15 */ - {&gpiod, NULL, NULL, 11, 0, ADCx} , /* PD11 FSMC_A16 */ - {&gpiod, NULL, NULL, 12, 0, ADCx} , /* PD12 FSMC_A17 */ - {&gpiod, NULL, NULL, 13, 0, ADCx} , /* PD13 FSMC_A18 */ - {&gpiod, NULL, NULL, 14, 0, ADCx} , /* PD14 FSMC_D0 */ - {&gpiod, NULL, NULL, 15, 0, ADCx} , /* PD15 FSMC_D1 */ + {&gpiod, NULL, NULL, 3, 0, ADCx}, /* PD3 FSMC_CLK */ + {&gpiod, NULL, NULL, 4, 0, ADCx}, /* PD4 FSMC_NOE */ + {&gpiod, NULL, NULL, 5, 0, ADCx}, /* PD5 FSMC_NWE */ + {&gpiod, NULL, NULL, 6, 0, ADCx}, /* PD6 FSMC_NWAIT */ + {&gpiod, NULL, NULL, 7, 0, ADCx}, /* PD7 FSMC_NE1/FSMC_NCE2 */ + {&gpiod, NULL, NULL, 8, 0, ADCx}, /* PD8 FSMC_D13 */ + {&gpiod, NULL, NULL, 9, 0, ADCx}, /* PD9 FSMC_D14 */ + {&gpiod, NULL, NULL, 10, 0, ADCx}, /* PD10 FSMC_D15 */ + {&gpiod, NULL, NULL, 11, 0, ADCx}, /* PD11 FSMC_A16 */ + {&gpiod, NULL, NULL, 12, 0, ADCx}, /* PD12 FSMC_A17 */ + {&gpiod, NULL, NULL, 13, 0, ADCx}, /* PD13 FSMC_A18 */ + {&gpiod, NULL, NULL, 14, 0, ADCx}, /* PD14 FSMC_D0 */ + {&gpiod, NULL, NULL, 15, 0, ADCx}, /* PD15 FSMC_D1 */ - {&gpioe, NULL, NULL, 0, 0, ADCx} , /* PE0 */ - {&gpioe, NULL, NULL, 1, 0, ADCx} , /* PE1 */ - {&gpioe, NULL, NULL, 2, 0, ADCx} , /* PE2 */ - {&gpioe, NULL, NULL, 3, 0, ADCx} , /* PE3 */ - {&gpioe, NULL, NULL, 4, 0, ADCx} , /* PE4 */ - {&gpioe, NULL, NULL, 5, 0, ADCx} , /* PE5 */ - {&gpioe, NULL, NULL, 6, 0, ADCx} , /* PE6 */ - {&gpioe, NULL, NULL, 7, 0, ADCx} , /* PE7 */ - {&gpioe, NULL, NULL, 8, 0, ADCx} , /* PE8 */ - {&gpioe, NULL, NULL, 9, 0, ADCx} , /* PE9 */ - {&gpioe, NULL, NULL, 10, 0, ADCx} , /* PE10 */ - {&gpioe, NULL, NULL, 11, 0, ADCx} , /* PE11 */ - {&gpioe, NULL, NULL, 12, 0, ADCx} , /* PE12 */ - {&gpioe, NULL, NULL, 13, 0, ADCx} , /* PE13 */ - {&gpioe, NULL, NULL, 14, 0, ADCx} , /* PE14 */ - {&gpioe, NULL, NULL, 15, 0, ADCx} , /* PE15 */ + {&gpioe, NULL, NULL, 0, 0, ADCx}, /* PE0 */ + {&gpioe, NULL, NULL, 1, 0, ADCx}, /* PE1 */ + {&gpioe, NULL, NULL, 2, 0, ADCx}, /* PE2 */ + {&gpioe, NULL, NULL, 3, 0, ADCx}, /* PE3 */ + {&gpioe, NULL, NULL, 4, 0, ADCx}, /* PE4 */ + {&gpioe, NULL, NULL, 5, 0, ADCx}, /* PE5 */ + {&gpioe, NULL, NULL, 6, 0, ADCx}, /* PE6 */ + {&gpioe, NULL, NULL, 7, 0, ADCx}, /* PE7 */ + {&gpioe, NULL, NULL, 8, 0, ADCx}, /* PE8 */ + {&gpioe, NULL, NULL, 9, 0, ADCx}, /* PE9 */ + {&gpioe, NULL, NULL, 10, 0, ADCx}, /* PE10 */ + {&gpioe, NULL, NULL, 11, 0, ADCx}, /* PE11 */ + {&gpioe, NULL, NULL, 12, 0, ADCx}, /* PE12 */ + {&gpioe, NULL, NULL, 13, 0, ADCx}, /* PE13 */ + {&gpioe, NULL, NULL, 14, 0, ADCx}, /* PE14 */ + {&gpioe, NULL, NULL, 15, 0, ADCx}, /* PE15 */ - {&gpiof, NULL, NULL, 0, 0, ADCx} , /* PF0 */ - {&gpiof, NULL, NULL, 1, 0, ADCx} , /* PF1 */ - {&gpiof, NULL, NULL, 2, 0, ADCx} , /* PF2 */ - {&gpiof, NULL, NULL, 3, 0, ADCx} , /* PF3 */ - {&gpiof, NULL, NULL, 4, 0, ADCx} , /* PF4 */ - {&gpiof, NULL, NULL, 5, 0, ADCx} , /* PF5 */ - {&gpiof, NULL, NULL, 6, 0, ADCx} , /* PF6 */ - {&gpiof, NULL, NULL, 7, 0, ADCx} , /* PF7 */ - {&gpiof, NULL, NULL, 8, 0, ADCx} , /* PF8 */ - {&gpiof, NULL, NULL, 9, 0, ADCx} , /* PF9 */ - {&gpiof, NULL, NULL, 10, 0, ADCx} , /* PF10 */ - {&gpiof, NULL, NULL, 11, 0, ADCx} , /* PF11 */ - {&gpiof, NULL, NULL, 12, 0, ADCx} , /* PF12 */ - {&gpiof, NULL, NULL, 13, 0, ADCx} , /* PF13 */ - {&gpiof, NULL, NULL, 14, 0, ADCx} , /* PF14 */ - {&gpiof, NULL, NULL, 15, 0, ADCx} , /* PF15 */ + {&gpiof, NULL, NULL, 0, 0, ADCx}, /* PF0 */ + {&gpiof, NULL, NULL, 1, 0, ADCx}, /* PF1 */ + {&gpiof, NULL, NULL, 2, 0, ADCx}, /* PF2 */ + {&gpiof, NULL, NULL, 3, 0, ADCx}, /* PF3 */ + {&gpiof, NULL, NULL, 4, 0, ADCx}, /* PF4 */ + {&gpiof, NULL, NULL, 5, 0, ADCx}, /* PF5 */ + {&gpiof, NULL, NULL, 6, 0, ADCx}, /* PF6 */ + {&gpiof, NULL, NULL, 7, 0, ADCx}, /* PF7 */ + {&gpiof, NULL, NULL, 8, 0, ADCx}, /* PF8 */ + {&gpiof, NULL, NULL, 9, 0, ADCx}, /* PF9 */ + {&gpiof, NULL, NULL, 10, 0, ADCx}, /* PF10 */ + {&gpiof, NULL, NULL, 11, 0, ADCx}, /* PF11 */ + {&gpiof, NULL, NULL, 12, 0, ADCx}, /* PF12 */ + {&gpiof, NULL, NULL, 13, 0, ADCx}, /* PF13 */ + {&gpiof, NULL, NULL, 14, 0, ADCx}, /* PF14 */ + {&gpiof, NULL, NULL, 15, 0, ADCx}, /* PF15 */ - {&gpiog, NULL, NULL, 0, 0, ADCx} , /* PG0 */ - {&gpiog, NULL, NULL, 1, 0, ADCx} , /* PG1 */ - {&gpiog, NULL, NULL, 2, 0, ADCx} , /* PG2 */ - {&gpiog, NULL, NULL, 3, 0, ADCx} , /* PG3 */ - {&gpiog, NULL, NULL, 4, 0, ADCx} , /* PG4 */ - {&gpiog, NULL, NULL, 5, 0, ADCx} , /* PG5 */ - {&gpiog, NULL, NULL, 6, 0, ADCx} , /* PG6 */ - {&gpiog, NULL, NULL, 7, 0, ADCx} , /* PG7 */ - {&gpiog, NULL, NULL, 8, 0, ADCx} , /* PG8 */ - {&gpiog, NULL, NULL, 9, 0, ADCx} , /* PG9 */ - {&gpiog, NULL, NULL, 10, 0, ADCx} , /* PG10 */ - {&gpiog, NULL, NULL, 11, 0, ADCx} , /* PG11 */ - {&gpiog, NULL, NULL, 12, 0, ADCx} , /* PG12 */ - {&gpiog, NULL, NULL, 13, 0, ADCx} , /* PG13 */ - {&gpiog, NULL, NULL, 14, 0, ADCx} , /* PG14 */ - {&gpiog, NULL, NULL, 15, 0, ADCx} /* PG15 */ + {&gpiog, NULL, NULL, 0, 0, ADCx}, /* PG0 */ + {&gpiog, NULL, NULL, 1, 0, ADCx}, /* PG1 */ + {&gpiog, NULL, NULL, 2, 0, ADCx}, /* PG2 */ + {&gpiog, NULL, NULL, 3, 0, ADCx}, /* PG3 */ + {&gpiog, NULL, NULL, 4, 0, ADCx}, /* PG4 */ + {&gpiog, NULL, NULL, 5, 0, ADCx}, /* PG5 */ + {&gpiog, NULL, NULL, 6, 0, ADCx}, /* PG6 */ + {&gpiog, NULL, NULL, 7, 0, ADCx}, /* PG7 */ + {&gpiog, NULL, NULL, 8, 0, ADCx}, /* PG8 */ + {&gpiog, NULL, NULL, 9, 0, ADCx}, /* PG9 */ + {&gpiog, NULL, NULL, 10, 0, ADCx}, /* PG10 */ + {&gpiog, NULL, NULL, 11, 0, ADCx}, /* PG11 */ + {&gpiog, NULL, NULL, 12, 0, ADCx}, /* PG12 */ + {&gpiog, NULL, NULL, 13, 0, ADCx}, /* PG13 */ + {&gpiog, NULL, NULL, 14, 0, ADCx}, /* PG14 */ + {&gpiog, NULL, NULL, 15, 0, ADCx} /* PG15 */ }; /* Basically everything that is defined as having a timer us PWM */ diff --git a/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/board.cpp b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/board.cpp index 5ddeb1f1d9..332c9f005e 100644 --- a/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/board.cpp +++ b/buildroot/share/PlatformIO/variants/marlin_maple_MEEB_3DP/board.cpp @@ -132,9 +132,9 @@ extern const stm32_pin_info PIN_MAP[BOARD_NR_GPIO_PINS] = { {&gpioc, NULL, NULL, 14, 0, ADCx}, /* PC14 OSC32_IN */ {&gpioc, NULL, NULL, 15, 0, ADCx}, /* PC15 OSC32_OUT */ - {&gpiod, NULL, NULL, 0, 0, ADCx} , /* PD0 OSC_IN */ - {&gpiod, NULL, NULL, 1, 0, ADCx} , /* PD1 OSC_OUT */ - {&gpiod, NULL, NULL, 2, 0, ADCx} , /* PD2 TIM3_ETR/UART5_RX SDIO_CMD */ + {&gpiod, NULL, NULL, 0, 0, ADCx}, /* PD0 OSC_IN */ + {&gpiod, NULL, NULL, 1, 0, ADCx}, /* PD1 OSC_OUT */ + {&gpiod, NULL, NULL, 2, 0, ADCx}, /* PD2 TIM3_ETR/UART5_RX SDIO_CMD */ }; /* Basically everything that is defined as having a timer us PWM */ diff --git a/buildroot/share/scripts/createTemperatureLookupMarlin.py b/buildroot/share/scripts/createTemperatureLookupMarlin.py index eb8c094957..5515681bfc 100755 --- a/buildroot/share/scripts/createTemperatureLookupMarlin.py +++ b/buildroot/share/scripts/createTemperatureLookupMarlin.py @@ -141,7 +141,7 @@ def main(argv): for temp in temps: adc = t.adc(temp) - print(" { OV(%7.2f), %4s }%s // v=%.3f\tr=%.3f\tres=%.3f degC/count" % (adc , temp, \ + print(" { OV(%7.2f), %4s }%s // v=%.3f\tr=%.3f\tres=%.3f degC/count" % (adc, temp, \ ',' if temp != temps[-1] else ' ', \ t.voltage(adc), \ t.resist( adc), \ diff --git a/buildroot/tests/BTT_GTR_V1_0 b/buildroot/tests/BTT_GTR_V1_0 index c6cb7d5feb..e40f3ffa53 100755 --- a/buildroot/tests/BTT_GTR_V1_0 +++ b/buildroot/tests/BTT_GTR_V1_0 @@ -36,7 +36,7 @@ opt_set MOTHERBOARD BOARD_BTT_GTR_V1_0 SERIAL_PORT -1 \ EXTRUDERS 3 TEMP_SENSOR_1 1 TEMP_SENSOR_2 1 \ SERVO1_PIN PE9 SERVO2_PIN PE11 \ SERVO_DELAY '{ 300, 300, 300 }' \ - SWITCHING_TOOLHEAD_X_POS '{ 215, 0 ,0 }' \ + SWITCHING_TOOLHEAD_X_POS '{ 215, 0, 0 }' \ MPC_HEATER_POWER '{ 40.0f, 40.0f, 40.0f }' \ MPC_BLOCK_HEAT_CAPACITY '{ 16.7f, 16.7f, 16.7f }' \ MPC_SENSOR_RESPONSIVENESS '{ 0.22f, 0.22f, 0.22f }' \ diff --git a/docs/Cutter.md b/docs/Cutter.md index 8f4b7e67aa..207036c6e8 100644 --- a/docs/Cutter.md +++ b/docs/Cutter.md @@ -4,7 +4,7 @@ With Marlin version 2.0.9.x or higher, Laser improvements were introduced that e ### Architecture -Laser selectable feature capability is defined through 4 global mode flags within G-code ,laser/spindle, planner and stepper routines. The default mode maintains the standard laser function. G-Codes are received, processed and parsed to determine what mode to set through M3, M4 and M5 commands. When the inline mode parameter set is detected, laser power processing will be driven through the planner and stepper routines. Handling of the initial power values and settings are performed by G-Code parsing and the laser/spindle routines. +Laser selectable feature capability is defined through 4 global mode flags within G-code, laser/spindle, planner and stepper routines. The default mode maintains the standard laser function. G-Codes are received, processed and parsed to determine what mode to set through M3, M4 and M5 commands. When the inline mode parameter set is detected, laser power processing will be driven through the planner and stepper routines. Handling of the initial power values and settings are performed by G-Code parsing and the laser/spindle routines. Inline power feeds from the block->inline_power variable into the planner's laser.power when in continuous power mode. Further power adjustment will be applied if the laser power trap feature is active otherwise laser.power is used as set in the stepper for the entire block. When laser power trap is active the power levels are step incremented during acceleration and step decremented during deceleration. diff --git a/ini/hc32.ini b/ini/hc32.ini index a99614beec..8a55e3b495 100644 --- a/ini/hc32.ini +++ b/ini/hc32.ini @@ -33,12 +33,12 @@ platform_packages = framework-hc32f46x-ddl@https://github.com/shadow578/framewor board = generic_hc32f460 build_src_filter = ${common.default_src_filter} + + build_type = release -build_flags = -D ARDUINO_ARCH_HC32 - -D PLATFORM_M997_SUPPORT # Enable M997 command - # NOTE: DDL and Arduino debug mode are - # automatically enabled with MARLIN_DEV_MODE - #-D __DEBUG # force DDL debug mode - #-D __CORE_DEBUG # force Arduino core debug mode +build_flags = -DARDUINO_ARCH_HC32 + -DPLATFORM_M997_SUPPORT # Enable M997 command + # NOTE: DDL and Arduino debug mode are + # automatically enabled with MARLIN_DEV_MODE + #-D__DEBUG # force DDL debug mode + #-D__CORE_DEBUG # force Arduino core debug mode # HC32 app configuration file board_build.app_config = Marlin/src/HAL/HC32/app_config.h From 8cb6e57789e76e5cf359f276b5993f9d8c771ac0 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Thu, 10 Apr 2025 00:31:25 +0000 Subject: [PATCH 03/86] [cron] Bump distribution date (2025-04-10) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index d071d96c66..6982c994d4 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 "2025-04-08" +//#define STRING_DISTRIBUTION_DATE "2025-04-10" /** * The protocol for communication to the host. Protocol indicates communication diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 13b8eee07e..4e7935271a 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 "2025-04-08" + #define STRING_DISTRIBUTION_DATE "2025-04-10" #endif /** From 893dddcbd1a7da69eeb09092fe265e12aa34539a Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Sat, 12 Apr 2025 13:12:31 -0700 Subject: [PATCH 04/86] =?UTF-8?q?=F0=9F=93=9D=20Malyan=20LCD=20uses=20enco?= =?UTF-8?q?ders=20(#27781)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 69cae47ee1..af7e17ad05 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -3282,7 +3282,7 @@ #endif // -// Touch-screen LCD for Malyan M200/M300 printers +// LCD for Malyan M200/M300 printers // //#define MALYAN_LCD From d1947fac07e326c749c3617591872b7ff471ec79 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sun, 13 Apr 2025 00:56:12 +0000 Subject: [PATCH 05/86] [cron] Bump distribution date (2025-04-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 6982c994d4..cb253de7bc 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 "2025-04-10" +//#define STRING_DISTRIBUTION_DATE "2025-04-13" /** * The protocol for communication to the host. Protocol indicates communication diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 4e7935271a..aa30ba6e18 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 "2025-04-10" + #define STRING_DISTRIBUTION_DATE "2025-04-13" #endif /** From 6d2dfcaa1cb55d11e3689094144ada1751fe2ff5 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 12 Apr 2025 16:13:49 -0500 Subject: [PATCH 06/86] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20i2c=20encoder=20repo?= =?UTF-8?q?rt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/encoder_i2c.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/feature/encoder_i2c.cpp b/Marlin/src/feature/encoder_i2c.cpp index 55bde4ca62..3d9466f7ed 100644 --- a/Marlin/src/feature/encoder_i2c.cpp +++ b/Marlin/src/feature/encoder_i2c.cpp @@ -652,7 +652,7 @@ void I2CPositionEncodersMgr::report_position(const int8_t idx, const bool units, else { if (noOffset) { const int32_t raw_count = encoders[idx].get_raw_count(); - SERIAL_CHAR(AXIS_CHAR(encoders[idx).get_axis()], ' '); + SERIAL_CHAR(AXIS_CHAR(encoders[idx].get_axis()), ' '); for (uint8_t j = 31; j > 0; j--) SERIAL_ECHO((bool)(0x00000001 & (raw_count >> j))); @@ -707,7 +707,7 @@ void I2CPositionEncodersMgr::change_module_address(const uint8_t oldaddr, const // and enable it (it will likely have failed initialization on power-up, before the address change). const int8_t idx = idx_from_addr(newaddr); if (idx >= 0 && !encoders[idx].get_active()) { - SERIAL_CHAR(AXIS_CHAR(encoders[idx).get_axis()]); + SERIAL_CHAR(AXIS_CHAR(encoders[idx].get_axis())); SERIAL_ECHOLNPGM(" axis encoder was not detected on printer startup. Trying again."); encoders[idx].set_active(encoders[idx].passes_test(true)); } From a55355d088c94b8c12bbccaf708fe986d0448c14 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 13 Apr 2025 00:55:58 -0500 Subject: [PATCH 07/86] =?UTF-8?q?=F0=9F=9A=B8=20FT=20Motion=20menu=20fix,?= =?UTF-8?q?=20neaten?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/language/language_en.h | 4 ++-- Marlin/src/lcd/language/language_it.h | 4 ++-- Marlin/src/lcd/language/language_ru.h | 4 ++-- Marlin/src/lcd/language/language_tr.h | 4 ++-- Marlin/src/lcd/menu/menu_motion.cpp | 18 ++++++------------ Marlin/src/libs/numtostr.cpp | 2 +- 6 files changed, 15 insertions(+), 21 deletions(-) diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 54740c923e..686a0b759c 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -894,7 +894,7 @@ namespace LanguageNarrow_en { LSTR MSG_BACKLASH_SMOOTHING = _UxGT("Smoothing"); LSTR MSG_FIXED_TIME_MOTION = _UxGT("Fixed-Time Motion"); - LSTR MSG_FTM_CMPN_MODE = _UxGT("@ Comp. Mode:"); + LSTR MSG_FTM_CMPN_MODE = _UxGT("@ Comp. Mode: $"); LSTR MSG_FTM_ZV = _UxGT("ZV"); LSTR MSG_FTM_ZVD = _UxGT("ZVD"); LSTR MSG_FTM_ZVDD = _UxGT("ZVDD"); @@ -905,7 +905,7 @@ namespace LanguageNarrow_en { 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_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."); diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index 1e81514440..c1b5366332 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -861,8 +861,8 @@ namespace LanguageNarrow_it { LSTR MSG_BACKLASH_SMOOTHING = _UxGT("Appianamento"); LSTR MSG_FIXED_TIME_MOTION = _UxGT("Movimento a Tempo-Fisso"); - LSTR MSG_FTM_CMPN_MODE = _UxGT("@ Modo Comp:"); - LSTR MSG_FTM_DYN_MODE = _UxGT("Modo DF:"); + LSTR MSG_FTM_CMPN_MODE = _UxGT("@ Modo Comp: $"); + LSTR MSG_FTM_DYN_MODE = _UxGT("Modo DF: $"); LSTR MSG_FTM_Z_BASED = _UxGT("Base-Z"); LSTR MSG_FTM_MASS_BASED = _UxGT("Base-Massa"); LSTR MSG_FTM_BASE_FREQ_N = _UxGT("@ Freq. base"); diff --git a/Marlin/src/lcd/language/language_ru.h b/Marlin/src/lcd/language/language_ru.h index 92011f66a6..991fd638ef 100644 --- a/Marlin/src/lcd/language/language_ru.h +++ b/Marlin/src/lcd/language/language_ru.h @@ -811,7 +811,7 @@ namespace LanguageNarrow_ru { // did not translate as there is no local terms/slang yet LSTR MSG_FIXED_TIME_MOTION = _UxGT("FT Motion"); - LSTR MSG_FTM_CMPN_MODE = _UxGT("@ Режим комп.:"); + LSTR MSG_FTM_CMPN_MODE = _UxGT("@ Режим комп.: $"); LSTR MSG_FTM_ZV = _UxGT("ZV"); LSTR MSG_FTM_ZVD = _UxGT("ZVD"); LSTR MSG_FTM_EI = _UxGT("EI"); @@ -820,7 +820,7 @@ namespace LanguageNarrow_ru { 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_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."); diff --git a/Marlin/src/lcd/language/language_tr.h b/Marlin/src/lcd/language/language_tr.h index b52ded8db8..947f094fa6 100644 --- a/Marlin/src/lcd/language/language_tr.h +++ b/Marlin/src/lcd/language/language_tr.h @@ -796,7 +796,7 @@ namespace LanguageNarrow_tr { LSTR MSG_BACKLASH_SMOOTHING = _UxGT("Yumuşatma"); LSTR MSG_FIXED_TIME_MOTION = _UxGT("Sabit Zamanlı Hareket"); - LSTR MSG_FTM_CMPN_MODE = _UxGT("@ Telafi Modu:"); + LSTR MSG_FTM_CMPN_MODE = _UxGT("@ Telafi Modu: $"); LSTR MSG_FTM_ZV = _UxGT("ZV"); LSTR MSG_FTM_ZVD = _UxGT("ZVD"); LSTR MSG_FTM_ZVDD = _UxGT("ZVDD"); @@ -807,7 +807,7 @@ namespace LanguageNarrow_tr { 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 Modu:"); + LSTR MSG_FTM_DYN_MODE = _UxGT("DF Modu: $"); 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."); diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index f6f13e2a4e..e2adbfded2 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -426,8 +426,7 @@ void menu_move() { // Show only when FT Motion is active (or optionally always show) if (c.active || ENABLED(FT_MOTION_NO_MENU_TOGGLE)) { #if HAS_X_AXIS - SUBMENU_N(X_AXIS, MSG_FTM_CMPN_MODE, menu_ftm_shaper_x); - MENU_ITEM_ADDON_START_RJ(5); lcd_put_u8str(shaper_name[X_AXIS]); MENU_ITEM_ADDON_END(); + SUBMENU_N_S(X_AXIS, shaper_name[X_AXIS], MSG_FTM_CMPN_MODE, menu_ftm_shaper_x); if (AXIS_HAS_SHAPER(X)) { EDIT_ITEM_FAST_N(float42_52, X_AXIS, MSG_FTM_BASE_FREQ_N, &c.baseFreq.x, FTM_MIN_SHAPE_FREQ, (FTM_FS) / 2, ftMotion.update_shaping_params); @@ -437,8 +436,7 @@ void menu_move() { } #endif #if HAS_Y_AXIS - SUBMENU_N(Y_AXIS, MSG_FTM_CMPN_MODE, menu_ftm_shaper_y); - MENU_ITEM_ADDON_START_RJ(5); lcd_put_u8str(shaper_name[Y_AXIS]); MENU_ITEM_ADDON_END(); + SUBMENU_N_S(Y_AXIS, shaper_name[Y_AXIS], MSG_FTM_CMPN_MODE, menu_ftm_shaper_y); if (AXIS_HAS_SHAPER(Y)) { EDIT_ITEM_FAST_N(float42_52, Y_AXIS, MSG_FTM_BASE_FREQ_N, &c.baseFreq.y, FTM_MIN_SHAPE_FREQ, (FTM_FS) / 2, ftMotion.update_shaping_params); @@ -449,8 +447,7 @@ void menu_move() { #endif #if HAS_DYNAMIC_FREQ - SUBMENU(MSG_FTM_DYN_MODE, menu_ftm_dyn_mode); - MENU_ITEM_ADDON_START_RJ(11); lcd_put_u8str(dmode); MENU_ITEM_ADDON_END(); + SUBMENU_S(dmode, MSG_FTM_DYN_MODE, menu_ftm_dyn_mode); if (c.dynFreqMode != dynFreqMode_DISABLED) { #if HAS_X_AXIS EDIT_ITEM_FAST_N(float42_52, X_AXIS, MSG_FTM_DFREQ_K_N, &c.dynFreqK.x, 0.0f, 20.0f); @@ -489,16 +486,13 @@ void menu_move() { BACK_ITEM(MSG_TUNE); #if HAS_X_AXIS - SUBMENU_N(X_AXIS, MSG_FTM_CMPN_MODE, menu_ftm_shaper_x); - MENU_ITEM_ADDON_START_RJ(5); lcd_put_u8str(shaper_name[X_AXIS]); MENU_ITEM_ADDON_END(); + SUBMENU_N_S(X_AXIS, shaper_name[X_AXIS], MSG_FTM_CMPN_MODE, menu_ftm_shaper_x); #endif #if HAS_Y_AXIS - SUBMENU_N(Y_AXIS, MSG_FTM_CMPN_MODE, menu_ftm_shaper_y); - MENU_ITEM_ADDON_START_RJ(5); lcd_put_u8str(shaper_name[Y_AXIS]); MENU_ITEM_ADDON_END(); + SUBMENU_N_S(Y_AXIS, shaper_name[Y_AXIS], MSG_FTM_CMPN_MODE, menu_ftm_shaper_y); #endif #if HAS_DYNAMIC_FREQ - SUBMENU(MSG_FTM_DYN_MODE, menu_ftm_dyn_mode); - MENU_ITEM_ADDON_START_RJ(dmode.length()); lcd_put_u8str(dmode); MENU_ITEM_ADDON_END(); + SUBMENU_S(dmode, MSG_FTM_DYN_MODE, menu_ftm_dyn_mode); #endif #if HAS_EXTRUDERS EDIT_ITEM(bool, MSG_LINEAR_ADVANCE, &c.linearAdvEna); diff --git a/Marlin/src/libs/numtostr.cpp b/Marlin/src/libs/numtostr.cpp index aa00b5d6e2..830e9b356b 100644 --- a/Marlin/src/libs/numtostr.cpp +++ b/Marlin/src/libs/numtostr.cpp @@ -406,8 +406,8 @@ inline const char* ftostrX2rj(const_float_t f, const int index=1) { case 1: conv[1] = RJDIGIT(i, 100000); case 2: conv[2] = RJDIGIT(i, 10000); case 3: conv[3] = RJDIGIT(i, 1000); - case 4: conv[4] = RJDIGIT(i, 100); } + conv[4] = DIGIMOD(i, 100); conv[5] = '.'; conv[6] = DIGIMOD(i, 10); conv[7] = DIGIMOD(i, 1); From aee25d75ea2b8e8b0a6b90fb366d0fc9ea2db584 Mon Sep 17 00:00:00 2001 From: narno2202 <130909513+narno2202@users.noreply.github.com> Date: Sun, 13 Apr 2025 08:36:21 +0200 Subject: [PATCH 08/86] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20DGUSS?= =?UTF-8?q?creenHandler=20hack=20for=20MKS=20(#27789)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp index 38b3d93853..79353a4e23 100644 --- a/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp @@ -326,7 +326,7 @@ void DGUSScreenHandler::sendHeaterStatusToDisplay(DGUS_VP_Variable &var) { void DGUSScreenHandler::sdCardError() { DGUSScreenHandler::sdCardRemoved(); #if DGUS_LCD_UI_MKS - sendInfoScreenMKS(F("NOTICE"), nullptr, F("SD card error"), nullptr, mks_language_index); + screen.sendInfoScreenMKS(F("NOTICE"), nullptr, F("SD card error"), nullptr, mks_language_index); #else sendInfoScreen(F("NOTICE"), nullptr, F("SD card error"), nullptr); #endif From c173ecd89ae636c2deaf7310a626569b6a6c4797 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 13 Apr 2025 02:06:50 -0500 Subject: [PATCH 09/86] =?UTF-8?q?=F0=9F=8E=A8=20Misc.=20serial=20echo/char?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/MarlinCore.cpp | 6 ++-- Marlin/src/core/bug_on.h | 8 ++--- Marlin/src/core/utility.cpp | 11 ++---- Marlin/src/feature/cancel_object.cpp | 2 +- Marlin/src/feature/encoder_i2c.cpp | 53 ++++++++++++---------------- Marlin/src/libs/hex_print.cpp | 2 +- Marlin/src/sd/cardreader.cpp | 23 ++++-------- 7 files changed, 40 insertions(+), 65 deletions(-) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index bfe69ba94e..f2b2589ee6 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -428,8 +428,7 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) { if (gcode.stepper_max_timed_out(ms)) { SERIAL_ERROR_START(); - SERIAL_ECHOPGM(STR_KILL_PRE); - SERIAL_ECHOLNPGM(STR_KILL_INACTIVE_TIME, parser.command_ptr); + SERIAL_ECHOLN(F(STR_KILL_PRE), F(STR_KILL_INACTIVE_TIME), parser.command_ptr); kill(); } @@ -497,8 +496,7 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) { // ---------------------------------------------------------------- if (killCount >= KILL_DELAY) { SERIAL_ERROR_START(); - SERIAL_ECHOPGM(STR_KILL_PRE); - SERIAL_ECHOLNPGM(STR_KILL_BUTTON); + SERIAL_ECHOLN(F(STR_KILL_PRE), F(STR_KILL_BUTTON)); kill(); } #endif diff --git a/Marlin/src/core/bug_on.h b/Marlin/src/core/bug_on.h index 7f1243ed40..8ff565ff73 100644 --- a/Marlin/src/core/bug_on.h +++ b/Marlin/src/core/bug_on.h @@ -27,12 +27,12 @@ // Useful macro for stopping the CPU on an unexpected condition // This is used like SERIAL_ECHOPGM, that is: a key-value call of the local variables you want // to dump to the serial port before stopping the CPU. - // \/ Don't replace by SERIAL_ECHOPGM since ONLY_FILENAME cannot be transformed to a PGM string on Arduino and it breaks building - #define BUG_ON(V...) do { SERIAL_ECHO(ONLY_FILENAME); SERIAL_ECHO(__LINE__); SERIAL_ECHOLNPGM(": "); SERIAL_ECHOLNPGM(V); SERIAL_FLUSHTX(); *(char*)0 = 42; } while(0) + // \/ Don't use SERIAL_ECHOPGM with ONLY_FILENAME. It can't be a PGM string, + #define BUG_ON(V...) do { SERIAL_ECHOLN(ONLY_FILENAME, __LINE__, F(": ")); SERIAL_ECHOLNPGM(V); SERIAL_FLUSHTX(); *(char*)0 = 42; } while(0) #elif ENABLED(MARLIN_DEV_MODE) // Don't stop the CPU here, but at least dump the bug on the serial port - // \/ Don't replace by SERIAL_ECHOPGM since ONLY_FILENAME cannot be transformed to a PGM string on Arduino and it breaks building - #define BUG_ON(V...) do { SERIAL_ECHO(ONLY_FILENAME); SERIAL_ECHO(__LINE__); SERIAL_ECHOLNPGM(": BUG!"); SERIAL_ECHOLNPGM(V); SERIAL_FLUSHTX(); } while(0) + // \/ Don't use SERIAL_ECHOPGM with ONLY_FILENAME. It can't be a PGM string, + #define BUG_ON(V...) do { SERIAL_ECHOLN(ONLY_FILENAME, __LINE__, F(": BUG!")); SERIAL_ECHOLNPGM(V); SERIAL_FLUSHTX(); } while(0) #else // Release mode, let's ignore the bug #define BUG_ON(V...) NOOP diff --git a/Marlin/src/core/utility.cpp b/Marlin/src/core/utility.cpp index 6a8452bfaa..cc49cf2cfb 100644 --- a/Marlin/src/core/utility.cpp +++ b/Marlin/src/core/utility.cpp @@ -154,10 +154,8 @@ void safe_delay(millis_t ms) { const float rz = bedlevel.get_z_correction(current_position); SERIAL_ECHO(ftostr43sign(rz, '+')); #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) - if (planner.z_fade_height) { - SERIAL_ECHOPGM(" (", ftostr43sign(rz * planner.fade_scaling_factor_for_z(current_position.z), '+')); - SERIAL_CHAR(')'); - } + if (planner.z_fade_height) + SERIAL_ECHO(F(" ("), ftostr43sign(rz * planner.fade_scaling_factor_for_z(current_position.z), '+'), C(')')); #endif #endif } @@ -176,10 +174,7 @@ void safe_delay(millis_t ms) { SERIAL_ECHOPGM("MBL Adjustment Z", ftostr43sign(z_offset + z_correction, '+')); #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) if (planner.z_fade_height) { - SERIAL_ECHOPGM(" (", ftostr43sign( - z_offset + z_correction * planner.fade_scaling_factor_for_z(current_position.z), '+' - )); - SERIAL_CHAR(')'); + SERIAL_ECHO(F(" ("), ftostr43sign(z_offset + z_correction * planner.fade_scaling_factor_for_z(current_position.z), '+'), C(')')); } #endif } diff --git a/Marlin/src/feature/cancel_object.cpp b/Marlin/src/feature/cancel_object.cpp index 818661b1f0..c17c9988e4 100644 --- a/Marlin/src/feature/cancel_object.cpp +++ b/Marlin/src/feature/cancel_object.cpp @@ -72,7 +72,7 @@ void CancelObject::report() { SERIAL_ECHO_START(); SERIAL_ECHOPGM("Canceled:"); for (int i = 0; i < state.object_count; i++) - if (TEST(state.canceled, i)) { SERIAL_CHAR(' '); SERIAL_ECHO(i); } + if (TEST(state.canceled, i)) SERIAL_ECHO(C(' '), i); SERIAL_EOL(); } diff --git a/Marlin/src/feature/encoder_i2c.cpp b/Marlin/src/feature/encoder_i2c.cpp index 3d9466f7ed..1930176aa6 100644 --- a/Marlin/src/feature/encoder_i2c.cpp +++ b/Marlin/src/feature/encoder_i2c.cpp @@ -168,8 +168,7 @@ void I2CPositionEncoder::update() { float sumP = 0; 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"); + SERIAL_ECHOLN(C(AXIS_CHAR(encoderAxis)), F(" : CORRECT ERR "), errorP * planner.mm_per_step[encoderAxis], F("mm")); babystep.add_steps(encoderAxis, -LROUND(errorP)); errPrstIdx = 0; } @@ -188,8 +187,7 @@ void I2CPositionEncoder::update() { if (ABS(error) > I2CPE_ERR_CNT_THRESH * planner.settings.axis_steps_per_mm[encoderAxis]) { const millis_t ms = millis(); if (ELAPSED(ms, nextErrorCountTime)) { - SERIAL_CHAR(AXIS_CHAR(encoderAxis)); - SERIAL_ECHOLNPGM(" : LARGE ERR ", error, "; diffSum=", diffSum); + SERIAL_ECHOLN(C(AXIS_CHAR(encoderAxis)), F(" : LARGE ERR "), error, F("; diffSum="), diffSum); errorCount++; nextErrorCountTime = ms + I2CPE_ERR_CNT_DEBOUNCE_MS; } @@ -208,8 +206,7 @@ void I2CPositionEncoder::set_homed() { homed = trusted = true; #ifdef I2CPE_DEBUG - SERIAL_CHAR(AXIS_CHAR(encoderAxis)); - SERIAL_ECHOLNPGM(" axis encoder homed, offset of ", zeroOffset, " ticks."); + SERIAL_ECHO(C(AXIS_CHAR(encoderAxis)), F(" axis encoder homed, offset of "), zeroOffset, F(" ticks.\n")); #endif } } @@ -219,8 +216,7 @@ void I2CPositionEncoder::set_unhomed() { homed = trusted = false; #ifdef I2CPE_DEBUG - SERIAL_CHAR(AXIS_CHAR(encoderAxis)); - SERIAL_ECHOLNPGM(" axis encoder unhomed."); + SERIAL_ECHO(C(AXIS_CHAR(encoderAxis)), F(" axis encoder unhomed.\n")); #endif } @@ -247,10 +243,8 @@ float I2CPositionEncoder::get_axis_error_mm(const bool report) { diff = actual - target, error = ABS(diff) > 10000 ? 0 : diff; // Huge error is a bad reading - if (report) { - SERIAL_CHAR(AXIS_CHAR(encoderAxis)); - SERIAL_ECHOLNPGM(" axis target=", target, "mm; actual=", actual, "mm; err=", error, "mm"); - } + if (report) + SERIAL_ECHO(C(AXIS_CHAR(encoderAxis)), F(" axis target="), target, F("mm; actual="), actual, F("mm; err="), error, F("mm\n")); return error; } @@ -282,10 +276,8 @@ int32_t I2CPositionEncoder::get_axis_error_steps(const bool report) { errorPrev = error; - if (report) { - SERIAL_CHAR(AXIS_CHAR(encoderAxis)); - SERIAL_ECHOLNPGM(" axis target=", target, "; actual=", encoderCountInStepperTicksScaled, "; err=", error); - } + if (report) + SERIAL_ECHOLN(C(AXIS_CHAR(encoderAxis)), F(" axis target="), target, F("; actual="), encoderCountInStepperTicksScaled, F("; err="), error); if (suppressOutput) { if (report) SERIAL_ECHOLNPGM("!Discontinuity. Suppressing error."); @@ -647,23 +639,22 @@ void I2CPositionEncodersMgr::init() { void I2CPositionEncodersMgr::report_position(const int8_t idx, const bool units, const bool noOffset) { CHECK_IDX(); - if (units) + if (units) { SERIAL_ECHOLN(noOffset ? encoders[idx].mm_from_count(encoders[idx].get_raw_count()) : encoders[idx].get_position_mm()); - else { - if (noOffset) { - const int32_t raw_count = encoders[idx].get_raw_count(); - SERIAL_CHAR(AXIS_CHAR(encoders[idx].get_axis()), ' '); - - for (uint8_t j = 31; j > 0; j--) - SERIAL_ECHO((bool)(0x00000001 & (raw_count >> j))); - - SERIAL_ECHO((bool)(0x00000001 & raw_count)); - SERIAL_CHAR(' '); - SERIAL_ECHOLN(raw_count); - } - else - SERIAL_ECHOLN(encoders[idx].get_position()); + return; } + + if (noOffset) { + const int32_t raw_count = encoders[idx].get_raw_count(); + SERIAL_CHAR(AXIS_CHAR(encoders[idx].get_axis()), ' '); + + for (uint8_t j = 31; j >= 0; j--) + SERIAL_ECHO(TEST32(raw_count, j)); + + SERIAL_ECHOLN(C(' '), raw_count); + } + else + SERIAL_ECHOLN(encoders[idx].get_position()); } void I2CPositionEncodersMgr::change_module_address(const uint8_t oldaddr, const uint8_t newaddr) { diff --git a/Marlin/src/libs/hex_print.cpp b/Marlin/src/libs/hex_print.cpp index 9ff3fc6eb2..f0095b18ce 100644 --- a/Marlin/src/libs/hex_print.cpp +++ b/Marlin/src/libs/hex_print.cpp @@ -59,7 +59,7 @@ char* hex_address(const void * const a) { void print_hex_nybble(const uint8_t n) { SERIAL_CHAR(hex_nybble(n)); } void print_hex_byte(const uint8_t b) { SERIAL_ECHO(hex_byte(b)); } void print_hex_word(const uint16_t w) { SERIAL_ECHO(_hex_word(w)); } -void print_hex_address(const void * const w) { SERIAL_ECHO(hex_address(w)); } +void print_hex_address(const void * const a) { SERIAL_ECHO(hex_address(a)); } void print_hex_long(const uint32_t w, const char delimiter/*='\0'*/, const bool prefix/*=false*/) { if (prefix) SERIAL_ECHOPGM("0x"); diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index 68b5846c2f..647e071c72 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -330,24 +330,21 @@ void CardReader::printListing(MediaFile parent, const char * const prepend, cons } } else if (is_visible_entity(p OPTARG(CUSTOM_FIRMWARE_UPLOAD, onlyBin))) { - if (prepend) { SERIAL_ECHO(prepend); SERIAL_CHAR('/'); } - SERIAL_ECHO(createFilename(filename, p)); - SERIAL_CHAR(' '); - SERIAL_ECHO(p.fileSize); + if (prepend) SERIAL_ECHO(prepend, C('/')); + SERIAL_ECHO(createFilename(filename, p), C(' '), p.fileSize); if (includeTime) { - SERIAL_CHAR(' '); uint16_t crmodDate = p.lastWriteDate, crmodTime = p.lastWriteTime; if (crmodDate < p.creationDate || (crmodDate == p.creationDate && crmodTime < p.creationTime)) { crmodDate = p.creationDate; crmodTime = p.creationTime; } - SERIAL_ECHOPGM("0x", hex_word(crmodDate)); + SERIAL_ECHOPGM(" 0x", hex_word(crmodDate)); print_hex_word(crmodTime); } #if ENABLED(LONG_FILENAME_HOST_SUPPORT) if (includeLong) { SERIAL_CHAR(' '); - if (prependLong) { SERIAL_ECHO(prependLong); SERIAL_CHAR('/'); } + if (prependLong) SERIAL_ECHO(prependLong, C('/')); SERIAL_ECHO(longFilename[0] ? longFilename : filename); } #endif @@ -470,10 +467,7 @@ void CardReader::printSelectedFilename() { SERIAL_ECHO(dosFilename); #if ENABLED(LONG_FILENAME_HOST_SUPPORT) selectFileByName(dosFilename); - if (longFilename[0]) { - SERIAL_CHAR(' '); - SERIAL_ECHO(longFilename); - } + if (longFilename[0]) SERIAL_ECHO(C(' '), longFilename); #endif } else @@ -856,11 +850,8 @@ void CardReader::report_status(TERN_(QUIETER_AUTO_REPORT_SD_STATUS, const bool i if (has_job) old_sdpos = sdpos; #endif - if (has_job) { - SERIAL_ECHOPGM(STR_SD_PRINTING_BYTE, sdpos); - SERIAL_CHAR('/'); - SERIAL_ECHOLN(filesize); - } + if (has_job) + SERIAL_ECHOLN(F(STR_SD_PRINTING_BYTE), sdpos, C('/'), filesize); else SERIAL_ECHOLNPGM(STR_SD_NOT_PRINTING); } From 9a6bf16938eaa1bbb8ba4e15c691ccc53f10c371 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 13 Apr 2025 03:18:35 -0500 Subject: [PATCH 10/86] =?UTF-8?q?=F0=9F=9A=B8=20Some=20default=20filament?= =?UTF-8?q?=20runout=20pins?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/mega/pins_HJC2560C_REV2.h | 12 ++++++++---- Marlin/src/pins/ramps/pins_ULTIMAIN_2.h | 10 ++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Marlin/src/pins/mega/pins_HJC2560C_REV2.h b/Marlin/src/pins/mega/pins_HJC2560C_REV2.h index 38e6617f51..4b454f2968 100644 --- a/Marlin/src/pins/mega/pins_HJC2560C_REV2.h +++ b/Marlin/src/pins/mega/pins_HJC2560C_REV2.h @@ -22,7 +22,7 @@ #pragma once /** - * Geeetech HJC2560-C Rev 2.x board pin assignments + * Geeetech HJC2560-C Rev 1.x and 2.x board pin assignments * ATmega2560 */ @@ -78,6 +78,13 @@ #endif #define DEFAULT_PWM_MOTOR_CURRENT { 1300, 1300, 1250 } +// +// Filament Runout Sensor +// +#ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN 24 // Filament runout +#endif + // // Temperature Sensors // @@ -138,9 +145,6 @@ //#ifndef LCD_CONTRAST_PIN // #define LCD_CONTRAST_PIN 5 // LCD_Contrast //#endif - #ifndef FIL_RUNOUT_PIN - #define FIL_RUNOUT_PIN 24 // Filament runout - #endif #else #define LCD_PINS_D5 21 #define LCD_PINS_D6 5 diff --git a/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h b/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h index 448c79a8d2..4633bfc037 100644 --- a/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h +++ b/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h @@ -89,6 +89,16 @@ #endif #define DEFAULT_PWM_MOTOR_CURRENT {1300, 1300, 1250} +// +// Filament Runout Sensor +// +#ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN 54 // ADC0 +#endif +#ifndef FIL_RUNOUT2_PIN + #define FIL_RUNOUT2_PIN 55 // ADC1 +#endif + // // Temperature Sensors // From db427415376db9ed4f4287a6a5b6b8842575446d Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sun, 13 Apr 2025 20:27:45 +1200 Subject: [PATCH 11/86] =?UTF-8?q?=F0=9F=94=A7=20Raise=20MBL=20grid=20size?= =?UTF-8?q?=20limit=20(#27790)?= 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/SanityCheck.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index af7e17ad05..faa6f56843 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -2276,7 +2276,7 @@ //=========================================================================== #define MESH_INSET 10 // Set Mesh bounds as an inset region of the bed - #define GRID_MAX_POINTS_X 3 // Don't use more than 7 points per axis, implementation limited. + #define GRID_MAX_POINTS_X 3 #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index fa06bac9f5..c40a2f7632 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1649,8 +1649,8 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i #elif ENABLED(MESH_BED_LEVELING) #if ENABLED(DELTA) #error "MESH_BED_LEVELING is not compatible with DELTA printers." - #elif (GRID_MAX_POINTS_X) > 9 || (GRID_MAX_POINTS_Y) > 9 - #error "GRID_MAX_POINTS_X and GRID_MAX_POINTS_Y must be less than 10 for MBL." + #elif !WITHIN(GRID_MAX_POINTS_X, 2, 255) || !WITHIN(GRID_MAX_POINTS_Y, 2, 255) + #error "GRID_MAX_POINTS_[XY] must be between 2 and 255 for MESH_BED_LEVELING." #endif #endif From 69464790e220a7a96eb92d3f47a57c44dadd2c75 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Mon, 14 Apr 2025 00:32:24 +0000 Subject: [PATCH 12/86] [cron] Bump distribution date (2025-04-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 cb253de7bc..008997c83a 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 "2025-04-13" +//#define STRING_DISTRIBUTION_DATE "2025-04-14" /** * The protocol for communication to the host. Protocol indicates communication diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index aa30ba6e18..ba062ee43d 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 "2025-04-13" + #define STRING_DISTRIBUTION_DATE "2025-04-14" #endif /** From 7d82f95df879250286c6cf230784bc0d217fda19 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 14 Apr 2025 16:45:12 -0500 Subject: [PATCH 13/86] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20DWIN=5FCREALITY=5FLC?= =?UTF-8?q?D=5FSTD=5FICONS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/e3v2/common/dwin_set.h | 38 ++++++++++++++++++++------- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 16 +++++------ Marlin/src/lcd/e3v2/jyersui/dwin.h | 32 ++-------------------- 3 files changed, 38 insertions(+), 48 deletions(-) diff --git a/Marlin/src/lcd/e3v2/common/dwin_set.h b/Marlin/src/lcd/e3v2/common/dwin_set.h index 644efb40ba..f59bb74cd3 100644 --- a/Marlin/src/lcd/e3v2/common/dwin_set.h +++ b/Marlin/src/lcd/e3v2/common/dwin_set.h @@ -132,17 +132,7 @@ #define ICON_Printer_0 93 #define ICON_Box 200 #define ICON_Checkbox 201 -#define ICON_Fade 202 -#define ICON_Mesh 203 -#define ICON_Tilt 204 -#define ICON_Brightness 205 #define ICON_Probe 206 -#define ICON_AxisD 249 -#define ICON_AxisBR 250 -#define ICON_AxisTR 251 -#define ICON_AxisBL 252 -#define ICON_AxisTL 253 -#define ICON_AxisC 254 #define ICON_Folder ICON_More #define ICON_AdvSet ICON_Language @@ -162,3 +152,31 @@ #define ICON_FWRetZRaise ICON_MoveZ #define ICON_FWRecSpeed ICON_Setspeed #define ICON_FWRecExtra ICON_StepE + +#if DISABLED(DWIN_CREALITY_LCD_STD_ICONS) + // Index of custom icons should be >= CUSTOM_ICON_START + #define CUSTOM_ICON_START 200 + #define ICON_Checkbox_F ICON_Box + #define ICON_Checkbox_T ICON_Checkbox + #define ICON_Fade 202 + #define ICON_Mesh 203 + #define ICON_Tilt 204 + #define ICON_Brightness 205 + #define ICON_AxisD 249 + #define ICON_AxisBR 250 + #define ICON_AxisTR 251 + #define ICON_AxisBL 252 + #define ICON_AxisTL 253 + #define ICON_AxisC 254 +#else + #define ICON_Fade ICON_Version + #define ICON_Mesh ICON_Version + #define ICON_Tilt ICON_Version + #define ICON_Brightness ICON_Version + #define ICON_AxisD ICON_Axis + #define ICON_AxisBR ICON_Axis + #define ICON_AxisTR ICON_Axis + #define ICON_AxisBL ICON_Axis + #define ICON_AxisTL ICON_Axis + #define ICON_AxisC ICON_Axis +#endif diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 5811ac11bb..d582b96ed7 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -523,18 +523,18 @@ void JyersDWIN::drawMenuItem(const uint8_t row, const uint8_t icon/*=0*/, FSTR_P } void JyersDWIN::drawCheckbox(const uint8_t row, const bool value) { - #if ENABLED(DWIN_CREALITY_LCD_CUSTOM_ICONS) // Draw appropriate checkbox icon + #if DISABLED(DWIN_CREALITY_LCD_STD_ICONS) // Draw appropriate checkbox icon dwinIconShow(ICON, (value ? ICON_Checkbox_T : ICON_Checkbox_F), 226, MBASE(row) - 3); #else // Draw a basic checkbox using rectangles and lines dwinDrawRectangle(1, COLOR_BG_BLACK, 226, MBASE(row) - 3, 226 + 20, MBASE(row) - 3 + 20); - dwinDrawRectangle(0, COLOR_WHITE, 226, MBASE(row) - 3, 226 + 20, MBASE(row) - 3 + 20); + dwinDrawRectangle(0, COLOR_WHITE, 226, MBASE(row) - 3, 226 + 20, MBASE(row) - 3 + 20); if (value) { - dwinDrawLine(COLOR_CHECKBOX, 227, MBASE(row) - 3 + 11, 226 + 8, MBASE(row) - 3 + 17); - dwinDrawLine(COLOR_CHECKBOX, 227 + 8, MBASE(row) - 3 + 17, 226 + 19, MBASE(row) - 3 + 1); - dwinDrawLine(COLOR_CHECKBOX, 227, MBASE(row) - 3 + 12, 226 + 8, MBASE(row) - 3 + 18); - dwinDrawLine(COLOR_CHECKBOX, 227 + 8, MBASE(row) - 3 + 18, 226 + 19, MBASE(row) - 3 + 2); - dwinDrawLine(COLOR_CHECKBOX, 227, MBASE(row) - 3 + 13, 226 + 8, MBASE(row) - 3 + 19); - dwinDrawLine(COLOR_CHECKBOX, 227 + 8, MBASE(row) - 3 + 19, 226 + 19, MBASE(row) - 3 + 3); + dwinDrawLine(COLOR_CHECKBOX, 227, MBASE(row) - 3 + 11, 226 + 8, MBASE(row) - 3 + 17); + dwinDrawLine(COLOR_CHECKBOX, 227 + 8, MBASE(row) - 3 + 17, 226 + 19, MBASE(row) - 3 + 1); + dwinDrawLine(COLOR_CHECKBOX, 227, MBASE(row) - 3 + 12, 226 + 8, MBASE(row) - 3 + 18); + dwinDrawLine(COLOR_CHECKBOX, 227 + 8, MBASE(row) - 3 + 18, 226 + 19, MBASE(row) - 3 + 2); + dwinDrawLine(COLOR_CHECKBOX, 227, MBASE(row) - 3 + 13, 226 + 8, MBASE(row) - 3 + 19); + dwinDrawLine(COLOR_CHECKBOX, 227 + 8, MBASE(row) - 3 + 19, 226 + 19, MBASE(row) - 3 + 3); } #endif } diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.h b/Marlin/src/lcd/e3v2/jyersui/dwin.h index 48e413efbb..40c7490e30 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.h +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.h @@ -26,7 +26,6 @@ */ #include "dwin_lcd.h" -#include "../common/dwin_set.h" #include "../common/dwin_font.h" #include "../common/dwin_color.h" #include "../common/encoder.h" @@ -35,7 +34,8 @@ #include "../../../inc/MarlinConfigPre.h" -//#define DWIN_CREALITY_LCD_CUSTOM_ICONS +#define DWIN_CREALITY_LCD_STD_ICONS +#include "../common/dwin_set.h" enum processID : uint8_t { Proc_Main, Proc_Print, Proc_Menu, Proc_Value, Proc_Option, @@ -120,34 +120,6 @@ enum menuID : uint8_t { ID_PreheatHotend }; -// Custom icons -#if ENABLED(DWIN_CREALITY_LCD_CUSTOM_ICONS) - // index of every custom icon should be >= CUSTOM_ICON_START - #define CUSTOM_ICON_START ICON_Checkbox_F - #define ICON_Checkbox_F 200 - #define ICON_Checkbox_T 201 - #define ICON_Fade 202 - #define ICON_Mesh 203 - #define ICON_Tilt 204 - #define ICON_Brightness 205 - #define ICON_AxisD 249 - #define ICON_AxisBR 250 - #define ICON_AxisTR 251 - #define ICON_AxisBL 252 - #define ICON_AxisTL 253 - #define ICON_AxisC 254 -#else - #define ICON_Fade ICON_Version - #define ICON_Mesh ICON_Version - #define ICON_Tilt ICON_Version - #define ICON_Brightness ICON_Version - #define ICON_AxisD ICON_Axis - #define ICON_AxisBR ICON_Axis - #define ICON_AxisTR ICON_Axis - #define ICON_AxisBL ICON_Axis - #define ICON_AxisTL ICON_Axis - #define ICON_AxisC ICON_Axis -#endif enum colorID : uint8_t { Default, White, Green, Cyan, Blue, Magenta, Red, Orange, Yellow, Brown, Black From b5d7b4aee6352009346fe968e6367215dcecb25b Mon Sep 17 00:00:00 2001 From: DerAndere <26200979+DerAndere1@users.noreply.github.com> Date: Mon, 14 Apr 2025 23:50:26 +0200 Subject: [PATCH 14/86] =?UTF-8?q?=E2=9C=A8=20DEFAULT=5FACCELERATION=5FSPIN?= =?UTF-8?q?DLE=20(#27759)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 2 ++ Marlin/src/feature/spindle_laser.cpp | 27 ++++++++++++--- Marlin/src/feature/spindle_laser.h | 9 +++-- Marlin/src/inc/Conditionals-4-adv.h | 3 ++ Marlin/src/inc/SanityCheck.h | 2 ++ Marlin/src/lcd/e3v2/common/limits.h | 6 ++++ Marlin/src/lcd/e3v2/creality/dwin.cpp | 24 +++++++++++++ Marlin/src/lcd/e3v2/creality/dwin.h | 9 +++++ Marlin/src/lcd/language/language_en.h | 1 + Marlin/src/lcd/menu/menu_advanced.cpp | 11 ++++++ Marlin/src/module/settings.cpp | 50 +++++++++++++++++++++++++-- buildroot/tests/mega1280 | 3 +- 12 files changed, 136 insertions(+), 11 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 2e0ca3d4a1..d4b4307b05 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -3682,6 +3682,8 @@ #define SPEED_POWER_MIN 5000 // (RPM) #define SPEED_POWER_MAX 30000 // (RPM) SuperPID router controller 0 - 30,000 RPM #define SPEED_POWER_STARTUP 25000 // (RPM) M3/M4 speed/power default (with no arguments) + + //#define DEFAULT_ACCELERATION_SPINDLE 1000 // (°/s/s) Default spindle acceleration (speed change with time) #endif #else diff --git a/Marlin/src/feature/spindle_laser.cpp b/Marlin/src/feature/spindle_laser.cpp index b83c1c1797..5f0ea7dd7b 100644 --- a/Marlin/src/feature/spindle_laser.cpp +++ b/Marlin/src/feature/spindle_laser.cpp @@ -43,6 +43,10 @@ bool SpindleLaser::enable_state; // Virtual uint8_t SpindleLaser::power, // Actual power output 0-255 ocr or "0 = off" > 0 = "on" SpindleLaser::last_power_applied; // = 0 // Basic power state tracking +#if HAS_SPINDLE_ACCELERATION + uint32_t SpindleLaser::acceleration_spindle_deg_per_s2; // (°/s/s) Spindle acceleration. Initialized by settings.load +#endif + #if ENABLED(LASER_FEATURE) cutter_test_pulse_t SpindleLaser::testPulse = 50; // (ms) Test fire pulse default duration uint8_t SpindleLaser::last_block_power; // = 0 // Track power changes for dynamic inline power @@ -100,7 +104,22 @@ void SpindleLaser::init() { #if ENABLED(HAL_CAN_SET_PWM_FREQ) && SPINDLE_LASER_FREQUENCY hal.set_pwm_frequency(pin_t(SPINDLE_LASER_PWM_PIN), frequency); #endif - hal.set_pwm_duty(pin_t(SPINDLE_LASER_PWM_PIN), ocr ^ SPINDLE_LASER_PWM_OFF); + #if HAS_SPINDLE_ACCELERATION + const int16_t diff = ocr - last_power_applied; + const uint8_t abs_diff = ABS(diff); + uint8_t current_ocr = last_power_applied; + // Duration between ocr increments. SPEED_POWER_MAX is in RPM. + const millis_t duration = (float(SPEED_POWER_MAX) * (60000.f / 2550.f) / float(acceleration_spindle_deg_per_s2)) * abs_diff; + millis_t next_ocr_change = millis() + duration; + while (current_ocr != ocr) { + while (PENDING(millis(), next_ocr_change)) idle(); + current_ocr += diff > 0 ? 1 : -1; + hal.set_pwm_duty(pin_t(SPINDLE_LASER_PWM_PIN), current_ocr ^ SPINDLE_LASER_PWM_OFF); + next_ocr_change += duration; + } + #else + hal.set_pwm_duty(pin_t(SPINDLE_LASER_PWM_PIN), ocr ^ SPINDLE_LASER_PWM_OFF); + #endif } void SpindleLaser::set_ocr(const uint8_t ocr) { @@ -111,10 +130,10 @@ void SpindleLaser::init() { } void SpindleLaser::ocr_off() { + _set_ocr(0); #if PIN_EXISTS(SPINDLE_LASER_ENA) WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ACTIVE_STATE); // Cutter OFF #endif - _set_ocr(0); } #endif // SPINDLE_LASER_USE_PWM @@ -127,9 +146,8 @@ void SpindleLaser::init() { */ void SpindleLaser::apply_power(const uint8_t opwr) { if (enabled() || opwr == 0) { // 0 check allows us to disable where no ENA pin exists - // Test and set the last power used to improve performance + // Test the last power used to improve performance if (opwr == last_power_applied) return; - last_power_applied = opwr; // Handle PWM driven or just simple on/off #if ENABLED(SPINDLE_LASER_USE_PWM) if (CUTTER_UNIT_IS(RPM) && unitPower == 0) @@ -146,6 +164,7 @@ void SpindleLaser::apply_power(const uint8_t opwr) { WRITE(SPINDLE_LASER_ENA_PIN, enabled() ? SPINDLE_LASER_ACTIVE_STATE : !SPINDLE_LASER_ACTIVE_STATE); isReadyForUI = true; #endif + last_power_applied = opwr; } else { #if PIN_EXISTS(SPINDLE_LASER_ENA) diff --git a/Marlin/src/feature/spindle_laser.h b/Marlin/src/feature/spindle_laser.h index a443d7df5e..a283f0786d 100644 --- a/Marlin/src/feature/spindle_laser.h +++ b/Marlin/src/feature/spindle_laser.h @@ -109,11 +109,14 @@ public: static uint8_t power, last_power_applied; // Basic power state tracking - static cutter_frequency_t frequency; // Set PWM frequency; range: 2K-50K + static cutter_frequency_t frequency; // (Hz) Laser/Spindle PWM frequency (2000..50000) - static cutter_power_t menuPower, // Power as set via LCD menu in PWM, Percentage or RPM - unitPower; // Power as displayed status in PWM, Percentage or RPM + static cutter_power_t menuPower, // Power as set via LCD menu in PWM, Percentage, or RPM + unitPower; // Power as displayed status in PWM, Percentage, or RPM + #if HAS_SPINDLE_ACCELERATION + static uint32_t acceleration_spindle_deg_per_s2; // (°/s/s) Spindle acceleration + #endif static void init(); #if ENABLED(HAL_CAN_SET_PWM_FREQ) && SPINDLE_LASER_FREQUENCY diff --git a/Marlin/src/inc/Conditionals-4-adv.h b/Marlin/src/inc/Conditionals-4-adv.h index 653a754700..109fca6b29 100644 --- a/Marlin/src/inc/Conditionals-4-adv.h +++ b/Marlin/src/inc/Conditionals-4-adv.h @@ -1090,6 +1090,9 @@ #define _CUTTER_POWER_RPM 3 #define _CUTTER_POWER(V) _CAT(_CUTTER_POWER_, V) #define CUTTER_UNIT_IS(V) (_CUTTER_POWER(CUTTER_POWER_UNIT) == _CUTTER_POWER(V)) + #if DEFAULT_ACCELERATION_SPINDLE + #define HAS_SPINDLE_ACCELERATION 1 + #endif #endif #if !defined(__AVR__) || !defined(USBCON) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index c40a2f7632..169f84983c 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -4072,6 +4072,8 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive." #error "SPINDLE_LASER_PWM_INVERT is required for (SPINDLE|LASER)_FEATURE." #elif !(defined(SPEED_POWER_MIN) && defined(SPEED_POWER_MAX) && defined(SPEED_POWER_STARTUP)) #error "SPINDLE_LASER_USE_PWM equation constant(s) missing." + #elif DEFAULT_ACCELERATION_SPINDLE > SPEED_POWER_MAX - SPEED_POWER_MIN + #error "DEFAULT_ACCELERATION_SPINDLE must be <= SPEED_POWER_MAX - SPEED_POWER_MIN." #elif _PIN_CONFLICT(X_MIN) #error "SPINDLE_LASER_PWM_PIN conflicts with X_MIN_PIN." #elif _PIN_CONFLICT(X_MAX) diff --git a/Marlin/src/lcd/e3v2/common/limits.h b/Marlin/src/lcd/e3v2/common/limits.h index 560c8735a7..c773240b28 100644 --- a/Marlin/src/lcd/e3v2/common/limits.h +++ b/Marlin/src/lcd/e3v2/common/limits.h @@ -65,6 +65,12 @@ constexpr xyze_float_t max_acceleration_edit_values = #endif ; +#if HAS_SPINDLE_ACCELERATION + constexpr float min_acceleration_edit_values_spindle = 1, + default_acceleration_spindle = DEFAULT_ACCELERATION_SPINDLE, + max_acceleration_edit_values_spindle = default_acceleration_spindle * DEFAULT_MAX_MULTIPLIER; +#endif + // // Max Jerk limits // diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index fcbeecde83..56830086fd 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp @@ -1595,6 +1595,27 @@ void hmiMaxAccelerationXYZE() { drawEditInteger4(select_acc.now, hmiValues.maxAcceleration, true); } + +#if HAS_SPINDLE_ACCELERATION + + void hmiSpindleAcceleration() { + EncoderState encoder_diffState = encoderReceiveAnalyze(); + if (encoder_diffState == ENCODER_DIFF_NO) return; + if (applyEncoder(encoder_diffState, hmiValues.spindleAcceleration)) { + checkkey = ID_SpindleAcceleration; + encoderRate.enabled = false; + cutter.spindle_acceleration_deg_per_s2 = hmiValues.spindleAcceleration; + drawEditInteger4(select_acc.now, hmiValues.spindleAcceleration); + return; + } + // SpindleAcceleration limit + LIMIT(hmiValues.spindleAcceleration, min_acceleration_edit_values_spindle, max_acceleration_edit_values_spindle); + // SpindleAcceleration value + drawEditInteger4(select_acc.now, hmiValues.spindleAcceleration, true); + } + +#endif // HAS_SPINDLE_ACCELERATION + #if ENABLED(CLASSIC_JERK) void hmiMaxJerkXYZE() { @@ -4283,6 +4304,9 @@ void dwinHandleScreen() { case ID_PrintSpeed: hmiPrintSpeed(); break; case ID_MaxSpeedValue: hmiMaxFeedspeedXYZE(); break; case ID_MaxAccelerationValue: hmiMaxAccelerationXYZE(); break; + #if HAS_SPINDLE_ACCELERATION + case ID_SpindleAccelerationValue: hmiSpindleAcceleration(); break; + #endif #if ENABLED(CLASSIC_JERK) case ID_MaxJerkValue: hmiMaxJerkXYZE(); break; #endif diff --git a/Marlin/src/lcd/e3v2/creality/dwin.h b/Marlin/src/lcd/e3v2/creality/dwin.h index fce52d8cf4..50723d015c 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.h +++ b/Marlin/src/lcd/e3v2/creality/dwin.h @@ -53,6 +53,9 @@ enum processID : uint8_t { #endif ID_MaxSpeed, ID_MaxSpeedValue, ID_MaxAcceleration, ID_MaxAccelerationValue, + #if HAS_SPINDLE_ACCELERATION + ID_SpindleAccelerationValue, + #endif ID_MaxJerk, ID_MaxJerkValue, ID_Step, ID_StepValue, ID_HomeOff, ID_HomeOffX, ID_HomeOffY, ID_HomeOffZ, @@ -105,6 +108,9 @@ typedef struct { int16_t printSpeed = 100; float maxFeedSpeed = 0; float maxAcceleration = 0; + #if HAS_SPINDLE_ACCELERATION + float spindleAcceleration = 0; + #endif float maxJerkScaled = 0; float maxStepScaled = 0; float offset_value = 0; @@ -203,6 +209,9 @@ void hmiPrintSpeed(); void hmiMaxFeedspeedXYZE(); void hmiMaxAccelerationXYZE(); +#if HAS_SPINDLE_ACCELERATION + void hmiSpindleAcceleration(); +#endif void hmiMaxJerkXYZE(); #if ENABLED(EDITABLE_STEPS_PER_UNIT) void hmiStepXYZE(); diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 686a0b759c..d184c0358f 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -452,6 +452,7 @@ namespace LanguageNarrow_en { LSTR MSG_AMAX_EN = _UxGT("Max * Accel"); LSTR MSG_A_RETRACT = _UxGT("Retract Accel"); LSTR MSG_A_TRAVEL = _UxGT("Travel Accel"); + LSTR MSG_A_SPINDLE = _UxGT("Spindle Accel"); LSTR MSG_INPUT_SHAPING = _UxGT("Input Shaping"); LSTR MSG_SHAPING_ENABLE_N = _UxGT("Enable @ shaping"); LSTR MSG_SHAPING_DISABLE_N = _UxGT("Disable @ shaping"); diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 99ece89f27..8080a23ba4 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -37,6 +37,10 @@ #include "../../gcode/parser.h" #endif +#if HAS_SPINDLE_ACCELERATION + #include "../../feature/spindle_laser.h" +#endif + #if HAS_BED_PROBE #include "../../module/probe.h" #endif @@ -511,6 +515,9 @@ void menu_backlash(); #else const xyze_ulong_t &max_accel_edit_scaled = max_accel_edit; #endif + #if HAS_SPINDLE_ACCELERATION + constexpr uint32_t max_spindle_accel_edit = 99000; + #endif START_MENU(); BACK_ITEM(MSG_ADVANCED_SETTINGS); @@ -544,6 +551,10 @@ void menu_backlash(); EDIT_ITEM_FAST(long5_25, MSG_AMAX_E, &planner.settings.max_acceleration_mm_per_s2[E_AXIS], 100, max_accel_edit_scaled.e, []{ planner.refresh_acceleration_rates(); }); #endif + #if HAS_SPINDLE_ACCELERATION + EDIT_ITEM_FAST(long5_25, MSG_A_SPINDLE, &cutter.acceleration_spindle_deg_per_s2, 100, max_spindle_accel_edit); + #endif + #ifdef XY_FREQUENCY_LIMIT EDIT_ITEM(int8, MSG_XY_FREQUENCY_LIMIT, &planner.xy_freq_limit_hz, 0, 100, planner.refresh_frequency_limit, true); editable.uint8 = uint8_t(LROUND(planner.xy_freq_min_speed_factor * 255)); // percent to u8 diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 4205261a3c..7062164dc9 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -60,6 +60,10 @@ #include "../HAL/shared/eeprom_api.h" #endif +#if HAS_SPINDLE_ACCELERATION + #include "../feature/spindle_laser.h" +#endif + #if HAS_BED_PROBE #include "probe.h" #endif @@ -252,6 +256,13 @@ typedef struct SettingsDataStruct { xyz_pos_t hotend_offset[HOTENDS - 1]; // M218 XYZ #endif + // + // Spindle Acceleration + // + #if HAS_SPINDLE_ACCELERATION + uint32_t acceleration_spindle; // cutter.acceleration_spindle_deg_per_s2 + #endif + // // FILAMENT_RUNOUT_SENSOR // @@ -941,7 +952,7 @@ void MarlinSettings::postprocess() { #endif // NUM_AXES // - // Hotend Offsets, if any + // Hotend Offsets // { #if HAS_HOTEND_OFFSET @@ -951,6 +962,16 @@ void MarlinSettings::postprocess() { #endif } + // + // Spindle Acceleration + // + { + #if HAS_SPINDLE_ACCELERATION + _FIELD_TEST(acceleration_spindle); + EEPROM_WRITE(cutter.acceleration_spindle_deg_per_s2); + #endif + } + // // Filament Runout Sensor // @@ -1985,7 +2006,7 @@ void MarlinSettings::postprocess() { #endif // NUM_AXES // - // Hotend Offsets, if any + // Hotend Offsets // { #if HAS_HOTEND_OFFSET @@ -1995,6 +2016,16 @@ void MarlinSettings::postprocess() { #endif } + // + // Spindle Acceleration + // + { + #if HAS_SPINDLE_ACCELERATION + _FIELD_TEST(acceleration_spindle); + EEPROM_READ(cutter.acceleration_spindle_deg_per_s2); + #endif + } + // // Filament Runout Sensor // @@ -2003,7 +2034,7 @@ void MarlinSettings::postprocess() { _FIELD_TEST(runout_sensor_enabled); EEPROM_READ(runout_sensor_enabled); #if HAS_FILAMENT_SENSOR - if (!validating) runout.enabled = runout_sensor_enabled < 0 ? FIL_RUNOUT_ENABLED_DEFAULT : runout_sensor_enabled; + if (!validating) runout.enabled = runout_sensor_enabled < 0 ? FIL_RUNOUT_ENABLED_DEFAULT : runout_sensor_enabled; #endif TERN_(HAS_FILAMENT_SENSOR, if (runout.enabled) runout.reset()); @@ -3286,14 +3317,27 @@ void MarlinSettings::reset() { TERN_(HAS_JUNCTION_DEVIATION, planner.junction_deviation_mm = float(JUNCTION_DEVIATION_MM)); + // + // Home Offset + // #if HAS_SCARA_OFFSET scara_home_offset.reset(); #elif HAS_HOME_OFFSET home_offset.reset(); #endif + // + // Hotend Offsets + // TERN_(HAS_HOTEND_OFFSET, reset_hotend_offsets()); + // + // Spindle Acceleration + // + #if HAS_SPINDLE_ACCELERATION + cutter.acceleration_spindle_deg_per_s2 = DEFAULT_ACCELERATION_SPINDLE; + #endif + // // Filament Runout Sensor // diff --git a/buildroot/tests/mega1280 b/buildroot/tests/mega1280 index 1b1a8f86b7..6d703ac8f6 100755 --- a/buildroot/tests/mega1280 +++ b/buildroot/tests/mega1280 @@ -19,7 +19,8 @@ restore_configs opt_set LCD_LANGUAGE an \ POWER_MONITOR_CURRENT_PIN 14 POWER_MONITOR_VOLTAGE_PIN 15 \ CLOSED_LOOP_ENABLE_PIN 44 CLOSED_LOOP_MOVE_COMPLETE_PIN 45 -opt_enable SPINDLE_FEATURE ULTIMAKERCONTROLLER LCD_BED_LEVELING EDITABLE_HOMING_FEEDRATE \ +opt_enable SPINDLE_FEATURE DEFAULT_ACCELERATION_SPINDLE \ + ULTIMAKERCONTROLLER LCD_BED_LEVELING EDITABLE_HOMING_FEEDRATE \ EEPROM_SETTINGS EEPROM_BOOT_SILENT EEPROM_AUTO_INIT \ SENSORLESS_BACKOFF_MM HOMING_BACKOFF_POST_MM HOME_Y_BEFORE_X CODEPENDENT_XY_HOMING \ MESH_BED_LEVELING ENABLE_LEVELING_FADE_HEIGHT MESH_G28_REST_ORIGIN \ From 5e8a5230a35400c9a9ce833f2b0de7ef865cdc6e Mon Sep 17 00:00:00 2001 From: feldi12 <25982433+feldi12@users.noreply.github.com> Date: Tue, 15 Apr 2025 00:08:40 +0200 Subject: [PATCH 15/86] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Optimize=20PID,=20in?= =?UTF-8?q?crease=20PID=20range=20(#27740)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 2 +- Marlin/src/lcd/sovol_rts/sovol_rts.cpp | 6 +++--- Marlin/src/module/temperature.h | 13 +++++-------- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index faa6f56843..91a3b342b6 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -899,7 +899,7 @@ #if ANY(PIDTEMP, PIDTEMPBED, PIDTEMPCHAMBER) //#define PID_OPENLOOP // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay - #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature + #define PID_FUNCTIONAL_RANGE 20 // If the temperature difference between the target temperature and the actual temperature // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. //#define PID_EDIT_MENU // Add PID editing to the "Advanced Settings" menu. (~700 bytes of flash) diff --git a/Marlin/src/lcd/sovol_rts/sovol_rts.cpp b/Marlin/src/lcd/sovol_rts/sovol_rts.cpp index c92850494b..dcd5d9b384 100644 --- a/Marlin/src/lcd/sovol_rts/sovol_rts.cpp +++ b/Marlin/src/lcd/sovol_rts/sovol_rts.cpp @@ -1312,9 +1312,9 @@ void RTS::handleData() { #endif #if ENABLED(PIDTEMPBED) - case Hot_Bed_P: thermalManager.temp_bed.pid.Kp = float(recdat.data[0]) / 100.0f; break; - case Hot_Bed_I: thermalManager.temp_bed.pid.Ki = float(recdat.data[0]) * 8.0f / 10000.0f; break; - case Hot_Bed_D: thermalManager.temp_bed.pid.Kd = float(recdat.data[0]) / 0.8f; break; + case Hot_Bed_P: thermalManager.temp_bed.pid.set_Kp(float(recdat.data[0]) / 100.0f); break; + case Hot_Bed_I: thermalManager.temp_bed.pid.set_Ki(float(recdat.data[0]) * 8.0f / 10000.0f); break; + case Hot_Bed_D: thermalManager.temp_bed.pid.set_Kd(float(recdat.data[0]) / 0.8f); break; #endif #if HAS_X_AXIS diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index 934b1b1246..77c16bba0a 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -173,7 +173,7 @@ typedef struct { float p, i, d, c, f; } raw_pidcf_t; struct PID_t { protected: bool pid_reset = true; - float temp_iState = 0.0f, temp_dState = 0.0f; + float temp_dState = 0; float work_p = 0, work_i = 0, work_d = 0; public: @@ -217,17 +217,14 @@ typedef struct { float p, i, d, c, f; } raw_pidcf_t; } else { if (pid_reset) { + work_i = 0; + work_d = 0; pid_reset = false; - temp_iState = 0.0; - work_d = 0.0; } - const float max_power_over_i_gain = float(MAX_POW) / Ki - float(MIN_POW); - temp_iState = constrain(temp_iState + pid_error, 0, max_power_over_i_gain); - work_p = Kp * pid_error; - work_i = Ki * temp_iState; - work_d = work_d + PID_K2 * (Kd * (temp_dState - current) - work_d); + work_i = constrain(work_i + Ki * pid_error, 0, float(MAX_POW - MIN_POW)); + work_d += (Kd * (temp_dState - current) - work_d) * PID_K2; output_pow = constrain(work_p + work_i + work_d + float(MIN_POW), 0, MAX_POW); } From 7cd1b7708f1679015a9247876ca3f0367a2fc3a5 Mon Sep 17 00:00:00 2001 From: B Date: Mon, 14 Apr 2025 15:52:51 -0700 Subject: [PATCH 16/86] =?UTF-8?q?=F0=9F=90=9B=20Fix=20Servos=20in=20GD32?= =?UTF-8?q?=20HAL=20(#27791)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/GD32_MFL/Servo.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Marlin/src/HAL/GD32_MFL/Servo.cpp b/Marlin/src/HAL/GD32_MFL/Servo.cpp index d5f8533544..6cbcbc049b 100644 --- a/Marlin/src/HAL/GD32_MFL/Servo.cpp +++ b/Marlin/src/HAL/GD32_MFL/Servo.cpp @@ -41,23 +41,26 @@ static uint32_t servo_interrupt_priority = NVIC_EncodePriority(NVIC_GetPriorityG // This must be called after the MFL Servo class has initialized the timer. // To be safe this is currently called after every call to attach(). static void fixServoTimerInterruptPriority() { - NVIC_SetPriority(getTimerUpIRQ(TIMER_SERVO), servo_interrupt_priority); + auto& servoTimerIdx = GeneralTimer::get_instance(static_cast(TIMER_SERVO)); + NVIC_SetPriority(servoTimerIdx.getTimerUpIRQ(), servo_interrupt_priority); } // Default constructor for libServo class. // Initializes the servo delay, pause state, and pause value. // Registers the servo instance in the servos array. -libServo::libServo() : delay(servoDelay[servoCount]), +libServo::libServo() : + delay(servoDelay[servoCount]), was_attached_before_pause(false), - value_before_pause(0) { + value_before_pause(0) +{ servos[servoCount++] = this; } // Attaches a servo to a specified pin. int8_t libServo::attach(const int pin) { if (servoCount >= MAX_SERVOS) return -1; - if (pin > 0) servo_pin = pin; - auto result = mflServo.attach(servo_pin); + if (pin > 0) servoPin = pin; + auto result = mflServo.attach(servoPin); fixServoTimerInterruptPriority(); return result; } @@ -65,8 +68,8 @@ int8_t libServo::attach(const int pin) { // Attaches a servo to a specified pin with minimum and maximum pulse widths. int8_t libServo::attach(const int pin, const int min, const int max) { if (servoCount >= MAX_SERVOS) return -1; - if (pin > 0) servo_pin = pin; - auto result = mflServo.attach(servo_pin, min, max); + if (pin > 0) servoPin = pin; + auto result = mflServo.attach(servoPin, min, max); fixServoTimerInterruptPriority(); return result; } From 1d4c002c2ab0ed67edb3a7fcc2f5463844f02d7c Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 15 Apr 2025 00:30:55 +0000 Subject: [PATCH 17/86] [cron] Bump distribution date (2025-04-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 008997c83a..11822b4b13 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 "2025-04-14" +//#define STRING_DISTRIBUTION_DATE "2025-04-15" /** * The protocol for communication to the host. Protocol indicates communication diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index ba062ee43d..65e128bdf9 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 "2025-04-14" + #define STRING_DISTRIBUTION_DATE "2025-04-15" #endif /** From 1242e875aadcb5b5ef8a9f54fd99f32a0adbdde8 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 15 Apr 2025 15:49:23 -0500 Subject: [PATCH 18/86] =?UTF-8?q?=F0=9F=9A=B8=20More=20frequent=20button?= =?UTF-8?q?=20polling=20(#27797)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 2 ++ Marlin/src/inc/Conditionals-5-post.h | 4 ++++ Marlin/src/module/temperature.cpp | 11 ++++++++--- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index d4b4307b05..73073762f1 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -2268,6 +2268,8 @@ #define ADC_BUTTON_DEBOUNCE_DELAY 16 // (count) Increase if buttons bounce or repeat too fast #endif +//#define FAST_BUTTON_POLLING // Poll buttons at ~1kHz on 8-bit AVR. Set to 'false' for slow polling on 32-bit. + // @section safety /** diff --git a/Marlin/src/inc/Conditionals-5-post.h b/Marlin/src/inc/Conditionals-5-post.h index 9b16f515d6..380e8e6071 100644 --- a/Marlin/src/inc/Conditionals-5-post.h +++ b/Marlin/src/inc/Conditionals-5-post.h @@ -3557,6 +3557,10 @@ #define HAS_ROTARY_ENCODER 1 #endif +#if defined(CPU_32_BIT) && !defined(FAST_BUTTON_POLLING) + #define FAST_BUTTON_POLLING +#endif + #if PIN_EXISTS(SAFE_POWER) && DISABLED(DISABLE_DRIVER_SAFE_POWER_PROTECT) #define HAS_DRIVER_SAFE_POWER_PROTECT 1 #endif diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 169d86a72f..5c9f122067 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -4283,10 +4283,15 @@ void Temperature::isr() { #endif // SLOW_PWM_HEATERS // - // Update lcd buttons 488 times per second + // Update lcd buttons at ~488Hz or ~976Hz // - static bool do_buttons; - if ((do_buttons ^= true)) ui.update_buttons(); + #if ENABLED(FAST_BUTTON_POLLING) + constexpr bool do_buttons = true; + #else + static bool do_buttons; + do_buttons ^= true; + #endif + if (do_buttons) ui.update_buttons(); /** * One sensor is sampled on every other call of the ISR. From f149e14d1a18fef4089d907d15083afc182c4e6b Mon Sep 17 00:00:00 2001 From: Andrew <18502096+classicrocker883@users.noreply.github.com> Date: Tue, 15 Apr 2025 18:36:27 -0400 Subject: [PATCH 19/86] =?UTF-8?q?=F0=9F=9A=B8=20Fix=20missing=20"echo:"=20?= =?UTF-8?q?in=20some=20reports=20(#27794)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/ethernet.cpp | 42 +++++++++++++++ Marlin/src/feature/ethernet.h | 6 +++ Marlin/src/gcode/config/M200-M205.cpp | 6 +-- .../src/gcode/feature/network/M552-M554.cpp | 52 +++---------------- Marlin/src/gcode/feature/nonlinear/M592.cpp | 2 +- Marlin/src/gcode/feature/pause/M603.cpp | 1 - Marlin/src/gcode/feature/trinamic/M569.cpp | 2 +- Marlin/src/gcode/gcode.h | 6 +-- Marlin/src/gcode/probe/M423.cpp | 3 +- Marlin/src/gcode/temp/M86_M87.cpp | 2 +- Marlin/src/module/settings.cpp | 15 ++---- 11 files changed, 71 insertions(+), 66 deletions(-) diff --git a/Marlin/src/feature/ethernet.cpp b/Marlin/src/feature/ethernet.cpp index 9b022b4e17..cdf176f832 100644 --- a/Marlin/src/feature/ethernet.cpp +++ b/Marlin/src/feature/ethernet.cpp @@ -172,4 +172,46 @@ void MarlinEthernet::check() { } } +void say_ethernet() { SERIAL_ECHOPGM(" Ethernet "); } + +void MarlinEthernet::ETH0_report(const bool forReplay/*=true*/) { + say_ethernet(); + SERIAL_ECHO_TERNARY(ethernet.hardware_enabled, "port ", "en", "dis", "abled.\n"); + if (ethernet.hardware_enabled) { + say_ethernet(); + SERIAL_ECHO_TERNARY(ethernet.have_telnet_client, "client ", "en", "dis", "abled.\n"); + } + else + SERIAL_ECHOLNPGM("Send 'M552 S1' to enable."); +} + +void MarlinEthernet::MAC_report(const bool forReplay/*=true*/) { + if (!forReplay) SERIAL_ECHO_START(); + SERIAL_ECHOPGM("MAC: "); + if (ethernet.hardware_enabled) { + uint8_t mac[6]; + Ethernet.MACAddress(mac); + for (uint8_t i = 0; i < 6; ++i) { + if (mac[i] < 0x10) SERIAL_CHAR('0'); + SERIAL_PRINT(mac[i], PrintBase::Hex); + if (i < 5) SERIAL_CHAR(':'); + } + } + else + SERIAL_ECHOPGM("Disabled"); + SERIAL_EOL(); +} + +// Display current values when the link is active, +// otherwise show the stored values +void MarlinEthernet::ip_report(const uint16_t cmd, FSTR_P const post, const IPAddress &ipo, const bool forReplay/*=true*/) { + if (!forReplay) SERIAL_ECHO_START(); + SERIAL_ECHO(F(" M"), cmd, C(' ')); + for (uint8_t i = 0; i < 4; ++i) { + SERIAL_ECHO(ipo[i]); + if (i < 3) SERIAL_CHAR('.'); + } + SERIAL_ECHOLN(F(" ; "), post); +} + #endif // HAS_ETHERNET diff --git a/Marlin/src/feature/ethernet.h b/Marlin/src/feature/ethernet.h index 70a58efce7..7aa364fc3c 100644 --- a/Marlin/src/feature/ethernet.h +++ b/Marlin/src/feature/ethernet.h @@ -25,6 +25,8 @@ #include #endif +#include "../HAL/shared/Marduino.h" + // Teensy 4.1 uses internal MAC Address class MarlinEthernet { @@ -34,6 +36,10 @@ class MarlinEthernet { static EthernetClient telnetClient; static void init(); static void check(); + + static void ETH0_report(const bool forReplay=true); + static void MAC_report(const bool forReplay=true); + static void ip_report(const uint16_t cmd, FSTR_P const post, const IPAddress &ipo, const bool forReplay=true); }; extern MarlinEthernet ethernet; diff --git a/Marlin/src/gcode/config/M200-M205.cpp b/Marlin/src/gcode/config/M200-M205.cpp index a0466fbeab..a55813aeae 100644 --- a/Marlin/src/gcode/config/M200-M205.cpp +++ b/Marlin/src/gcode/config/M200-M205.cpp @@ -78,10 +78,10 @@ TERN_(MARLIN_SMALL_BUILD, return); if (!forReplay) { - report_heading(forReplay, F(STR_FILAMENT_SETTINGS), false); + report_heading(false, F(STR_FILAMENT_SETTINGS), false); if (!parser.volumetric_enabled) SERIAL_ECHOPGM(" (Disabled):"); SERIAL_EOL(); - report_echo_start(forReplay); + report_echo_start(false); } #if EXTRUDERS == 1 @@ -231,7 +231,7 @@ void GcodeSuite::M203_report(const bool forReplay/*=true*/) { #if ENABLED(DISTINCT_E_FACTORS) for (uint8_t i = 0; i < E_STEPPERS; ++i) { - if (!forReplay) SERIAL_ECHO_START(); + report_echo_start(forReplay); SERIAL_ECHOLNPGM_P( PSTR(" M203 T"), i , SP_E_STR, VOLUMETRIC_UNIT(planner.settings.max_feedrate_mm_s[E_AXIS_N(i)]) diff --git a/Marlin/src/gcode/feature/network/M552-M554.cpp b/Marlin/src/gcode/feature/network/M552-M554.cpp index 9a09a973c8..fc965fc3bd 100644 --- a/Marlin/src/gcode/feature/network/M552-M554.cpp +++ b/Marlin/src/gcode/feature/network/M552-M554.cpp @@ -28,44 +28,6 @@ #include "../../../core/serial.h" #include "../../gcode.h" -void say_ethernet() { SERIAL_ECHOPGM(" Ethernet "); } - -void ETH0_report() { - say_ethernet(); - SERIAL_ECHO_TERNARY(ethernet.hardware_enabled, "port ", "en", "dis", "abled.\n"); - if (ethernet.hardware_enabled) { - say_ethernet(); - SERIAL_ECHO_TERNARY(ethernet.have_telnet_client, "client ", "en", "dis", "abled.\n"); - } - else - SERIAL_ECHOLNPGM("Send 'M552 S1' to enable."); -} - -void MAC_report() { - uint8_t mac[6]; - if (ethernet.hardware_enabled) { - Ethernet.MACAddress(mac); - SERIAL_ECHOPGM(" MAC: "); - 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(':'); - } - } - SERIAL_EOL(); -} - -// Display current values when the link is active, -// 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(' '); - for (uint8_t i = 0; i < 4; ++i) { - SERIAL_ECHO(ipo[i]); - if (i < 3) SERIAL_CHAR('.'); - } - SERIAL_ECHOLN(F(" ; "), post); -} - /** * M552: Set IP address, enable/disable network interface * @@ -92,13 +54,13 @@ void GcodeSuite::M552() { } } const bool nopar = !seenS && !seenP; - if (nopar || seenS) ETH0_report(); + if (nopar || seenS) ethernet.ETH0_report(); if (nopar || seenP) M552_report(); } -void GcodeSuite::M552_report() { +void GcodeSuite::M552_report(const bool forReplay/*=true*/) { TERN_(MARLIN_SMALL_BUILD, return); - ip_report(552, F("ip address"), Ethernet.linkStatus() == LinkON ? Ethernet.localIP() : ethernet.ip); + ethernet.ip_report(552, F("ip address"), Ethernet.linkStatus() == LinkON ? Ethernet.localIP() : ethernet.ip, forReplay); } /** @@ -111,9 +73,9 @@ void GcodeSuite::M553() { M553_report(); } -void GcodeSuite::M553_report() { +void GcodeSuite::M553_report(const bool forReplay/*=true*/) { TERN_(MARLIN_SMALL_BUILD, return); - ip_report(553, F("subnet mask"), Ethernet.linkStatus() == LinkON ? Ethernet.subnetMask() : ethernet.subnet); + ethernet.ip_report(553, F("subnet mask"), Ethernet.linkStatus() == LinkON ? Ethernet.subnetMask() : ethernet.subnet, forReplay); } /** @@ -126,9 +88,9 @@ void GcodeSuite::M554() { M554_report(); } -void GcodeSuite::M554_report() { +void GcodeSuite::M554_report(const bool forReplay/*=true*/) { TERN_(MARLIN_SMALL_BUILD, return); - ip_report(554, F("gateway"), Ethernet.linkStatus() == LinkON ? Ethernet.gatewayIP() : ethernet.gateway); + ethernet.ip_report(554, F("gateway"), Ethernet.linkStatus() == LinkON ? Ethernet.gatewayIP() : ethernet.gateway, forReplay); } #endif // HAS_ETHERNET diff --git a/Marlin/src/gcode/feature/nonlinear/M592.cpp b/Marlin/src/gcode/feature/nonlinear/M592.cpp index 2fc02133ec..77a6258ddc 100644 --- a/Marlin/src/gcode/feature/nonlinear/M592.cpp +++ b/Marlin/src/gcode/feature/nonlinear/M592.cpp @@ -29,7 +29,7 @@ void GcodeSuite::M592_report(const bool forReplay/*=true*/) { TERN_(MARLIN_SMALL_BUILD, return); - report_heading(forReplay, F(STR_NONLINEAR_EXTRUSION)); + report_heading_etc(forReplay, F(STR_NONLINEAR_EXTRUSION)); SERIAL_ECHOLNPGM(" M592 A", stepper.ne.A, " B", stepper.ne.B, " C", stepper.ne.C); } diff --git a/Marlin/src/gcode/feature/pause/M603.cpp b/Marlin/src/gcode/feature/pause/M603.cpp index fcc042f58e..fd8a779ae0 100644 --- a/Marlin/src/gcode/feature/pause/M603.cpp +++ b/Marlin/src/gcode/feature/pause/M603.cpp @@ -64,7 +64,6 @@ void GcodeSuite::M603_report(const bool forReplay/*=true*/) { TERN_(MARLIN_SMALL_BUILD, return); report_heading(forReplay, F(STR_FILAMENT_LOAD_UNLOAD)); - #if EXTRUDERS == 1 report_echo_start(forReplay); SERIAL_ECHOPGM(" M603 L", LINEAR_UNIT(fc_settings[0].load_length), " U", LINEAR_UNIT(fc_settings[0].unload_length), " ;"); diff --git a/Marlin/src/gcode/feature/trinamic/M569.cpp b/Marlin/src/gcode/feature/trinamic/M569.cpp index 06a4992ceb..99bbf6ed35 100644 --- a/Marlin/src/gcode/feature/trinamic/M569.cpp +++ b/Marlin/src/gcode/feature/trinamic/M569.cpp @@ -160,7 +160,7 @@ void GcodeSuite::M569_report(const bool forReplay/*=true*/) { report_heading(forReplay, F(STR_DRIVER_STEPPING_MODE)); auto say_M569 = [](const bool forReplay, FSTR_P const etc=nullptr, const bool eol=false) { - if (!forReplay) SERIAL_ECHO_START(); + report_echo_start(forReplay); SERIAL_ECHOPGM(" M569 S1"); if (etc) SERIAL_ECHO(C(' '), etc); if (eol) SERIAL_EOL(); diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 911820ee7b..706a7387db 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -1137,11 +1137,11 @@ private: #if HAS_ETHERNET static void M552(); - static void M552_report(); + static void M552_report(const bool forReplay=true); static void M553(); - static void M553_report(); + static void M553_report(const bool forReplay=true); static void M554(); - static void M554_report(); + static void M554_report(const bool forReplay=true); #endif #if HAS_STEALTHCHOP diff --git a/Marlin/src/gcode/probe/M423.cpp b/Marlin/src/gcode/probe/M423.cpp index 7ab887eb64..17941d64f3 100644 --- a/Marlin/src/gcode/probe/M423.cpp +++ b/Marlin/src/gcode/probe/M423.cpp @@ -88,10 +88,11 @@ void GcodeSuite::M423() { void GcodeSuite::M423_report(const bool forReplay/*=true*/) { TERN_(MARLIN_SMALL_BUILD, return); - report_heading(forReplay, F("X-Twist Correction")); + report_heading_etc(forReplay, F("X-Twist Correction")); SERIAL_ECHOLNPGM(" M423 A", xatc.start, " I", xatc.spacing); for (uint8_t x = 0; x < XATC_MAX_POINTS; ++x) { const float z = xatc.z_offset[x]; + report_echo_start(forReplay); SERIAL_ECHOPGM(" M423 X", x, " Z"); serial_offset(isnan(z) ? 0 : z); SERIAL_EOL(); diff --git a/Marlin/src/gcode/temp/M86_M87.cpp b/Marlin/src/gcode/temp/M86_M87.cpp index 502052e87b..442d325c56 100644 --- a/Marlin/src/gcode/temp/M86_M87.cpp +++ b/Marlin/src/gcode/temp/M86_M87.cpp @@ -37,7 +37,7 @@ void GcodeSuite::M86_report(const bool forReplay/*=true*/) { TERN_(MARLIN_SMALL_BUILD, return); hotend_idle_settings_t &c = hotend_idle.cfg; - report_heading(forReplay, F("Hotend Idle Timeout")); + report_heading_etc(forReplay, F("Hotend Idle Timeout")); SERIAL_ECHOLNPGM(" M86" #if HAS_HEATED_BED " B", c.bed_target, diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 7062164dc9..a6714b3e6a 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -190,11 +190,6 @@ #pragma pack(push, 1) // No padding between variables -#if HAS_ETHERNET - void ETH0_report(); - void MAC_report(); -#endif - #define _EN_ITEM(N) , E##N #define _EN1_ITEM(N) , E##N:1 @@ -4210,11 +4205,11 @@ void MarlinSettings::reset() { #if HAS_ETHERNET CONFIG_ECHO_HEADING("Ethernet"); - if (!forReplay) ETH0_report(); - CONFIG_ECHO_START(); SERIAL_ECHO_SP(2); MAC_report(); - CONFIG_ECHO_START(); SERIAL_ECHO_SP(2); gcode.M552_report(); - CONFIG_ECHO_START(); SERIAL_ECHO_SP(2); gcode.M553_report(); - CONFIG_ECHO_START(); SERIAL_ECHO_SP(2); gcode.M554_report(); + if (!forReplay) ethernet.ETH0_report(false); + ethernet.MAC_report(forReplay); + gcode.M552_report(forReplay); + gcode.M553_report(forReplay); + gcode.M554_report(forReplay); #endif TERN_(HAS_MULTI_LANGUAGE, gcode.M414_report(forReplay)); From c0e108b21df5452e7376d48797cbaf7ac8b63904 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Wed, 16 Apr 2025 00:30:52 +0000 Subject: [PATCH 20/86] [cron] Bump distribution date (2025-04-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 11822b4b13..2015e2ce0a 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 "2025-04-15" +//#define STRING_DISTRIBUTION_DATE "2025-04-16" /** * The protocol for communication to the host. Protocol indicates communication diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 65e128bdf9..cb0252d149 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 "2025-04-15" + #define STRING_DISTRIBUTION_DATE "2025-04-16" #endif /** From 8867c458311c7e5c34ad73a4fb95c716bbd90bc7 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 16 Apr 2025 14:26:52 -0500 Subject: [PATCH 21/86] =?UTF-8?q?=F0=9F=8E=A8=20Fix=20and/or=20warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/feature/digipot/M907-M910.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/gcode/feature/digipot/M907-M910.cpp b/Marlin/src/gcode/feature/digipot/M907-M910.cpp index a73f88ca89..425d27a72d 100644 --- a/Marlin/src/gcode/feature/digipot/M907-M910.cpp +++ b/Marlin/src/gcode/feature/digipot/M907-M910.cpp @@ -104,11 +104,11 @@ void GcodeSuite::M907() { // X Y I J K U V W - All aliases to set the current for "most axes." // Only the value of the last given parameter is used. - if (ENABLED(HAS_X_Y_XY_I_J_K_U_V_W) && NUM_AXIS_GANG( + if (ENABLED(HAS_X_Y_XY_I_J_K_U_V_W) && (NUM_AXIS_GANG( parser.seenval('X'), || parser.seenval('Y'), || false, || parser.seenval('I'), || parser.seenval('J'), || parser.seenval('K'), || parser.seenval('U'), || parser.seenval('V'), || parser.seenval('W') - )) + ))) stepper.set_digipot_current(0, parser.value_int()); // Z - Set the current just for the Z axis From f3be22c4ffbd016a0dcac19eaf3649c8c7eec3e5 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 16 Apr 2025 14:29:31 -0500 Subject: [PATCH 22/86] =?UTF-8?q?=F0=9F=8E=A8=20Delete=20libsam=5Fsam3x8e?= =?UTF-8?q?=5Fgcc=5Frel.a.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../libsam_sam3x8e_gcc_rel.a.txt | 576 ------------------ 1 file changed, 576 deletions(-) delete mode 100644 buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/libsam_sam3x8e_gcc_rel.a.txt diff --git a/buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/libsam_sam3x8e_gcc_rel.a.txt b/buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/libsam_sam3x8e_gcc_rel.a.txt deleted file mode 100644 index 9b614811bd..0000000000 --- a/buildroot/share/PlatformIO/variants/MARLIN_ARCHIM/libsam_sam3x8e_gcc_rel.a.txt +++ /dev/null @@ -1,576 +0,0 @@ - -adc10_sam3u.o: - -adc12_sam3u.o: - -adc_sam3snxa.o: - -pio.o: -00000000 T PIO_Clear -00000000 T PIO_Configure -00000000 T PIO_DisableInterrupt -00000000 T PIO_Get -00000000 T PIO_GetOutputDataStatus -00000000 T PIO_PullUp -00000000 T PIO_Set -00000000 T PIO_SetDebounceFilter -00000000 T PIO_SetInput -00000000 T PIO_SetOutput -00000000 T PIO_SetPeripheral - -pmc.o: -00000000 T pmc_clr_fast_startup_input -00000000 T pmc_disable_all_pck -00000000 T pmc_disable_all_periph_clk -00000000 T pmc_disable_interrupt -00000000 T pmc_disable_pck -00000000 T pmc_disable_periph_clk -00000000 T pmc_disable_pllack -00000000 T pmc_disable_udpck -00000000 T pmc_disable_upll_clock -00000000 T pmc_enable_all_pck -00000000 T pmc_enable_all_periph_clk -00000000 T pmc_enable_backupmode -00000000 T pmc_enable_interrupt -00000000 T pmc_enable_pck -00000000 T pmc_enable_periph_clk -00000000 T pmc_enable_pllack -00000000 T pmc_enable_sleepmode -00000000 T pmc_enable_udpck -00000000 T pmc_enable_upll_clock -00000000 T pmc_enable_waitmode -00000000 T pmc_get_interrupt_mask -00000000 T pmc_get_status -00000000 T pmc_get_writeprotect_status -00000000 T pmc_is_locked_pllack -00000000 T pmc_is_locked_upll -00000000 T pmc_is_pck_enabled -00000000 T pmc_is_periph_clk_enabled -00000000 T pmc_mck_set_prescaler -00000000 T pmc_mck_set_source -00000000 T pmc_osc_disable_fastrc -00000000 T pmc_osc_disable_xtal -00000000 T pmc_osc_enable_fastrc -00000000 T pmc_osc_is_ready_32kxtal -00000000 T pmc_osc_is_ready_mainck -00000000 T pmc_pck_set_prescaler -00000000 T pmc_pck_set_source -00000000 T pmc_set_fast_startup_input -00000000 T pmc_set_writeprotect -00000000 T pmc_switch_mainck_to_fastrc -00000000 T pmc_switch_mainck_to_xtal -00000000 T pmc_switch_mck_to_mainck -00000000 T pmc_switch_mck_to_pllack -00000000 T pmc_switch_mck_to_sclk -00000000 T pmc_switch_mck_to_upllck -00000000 T pmc_switch_pck_to_mainck -00000000 T pmc_switch_pck_to_pllack -00000000 T pmc_switch_pck_to_sclk -00000000 T pmc_switch_pck_to_upllck -00000000 T pmc_switch_sclk_to_32kxtal -00000000 T pmc_switch_udpck_to_pllack -00000000 T pmc_switch_udpck_to_upllck - -pwmc.o: -00000000 t FindClockConfiguration -00000000 T PWMC_ConfigureChannel -00000000 T PWMC_ConfigureChannelExt -00000000 T PWMC_ConfigureClocks -00000000 T PWMC_ConfigureComparisonUnit -00000000 T PWMC_ConfigureEventLineMode -00000000 T PWMC_ConfigureSyncChannel -00000000 T PWMC_DisableChannel -00000000 T PWMC_DisableChannelIt -00000000 T PWMC_DisableIt -00000000 T PWMC_DisableOverrideOutput -00000000 T PWMC_EnableChannel -00000000 T PWMC_EnableChannelIt -00000000 T PWMC_EnableFaultProtection -00000000 T PWMC_EnableIt -00000000 T PWMC_EnableOverrideOutput -00000000 T PWMC_FaultClear -00000000 T PWMC_SetDeadTime -00000000 T PWMC_SetDutyCycle -00000000 T PWMC_SetFaultMode -00000000 T PWMC_SetFaultProtectionValue -00000000 T PWMC_SetOverrideValue -00000000 T PWMC_SetPeriod -00000000 T PWMC_SetSyncChannelUpdatePeriod -00000000 T PWMC_SetSyncChannelUpdateUnlock -00000000 T PWMC_WriteBuffer - U __assert_func -00000000 r __func__.6793 -00000000 r __func__.6804 -00000000 r __func__.6819 -00000000 r __func__.6830 -00000000 r __func__.6841 -00000000 r __func__.6848 -00000000 r __func__.6932 -00000000 r __func__.6938 - -rtc.o: -00000000 T RTC_ClearSCCR -00000000 T RTC_DisableIt -00000000 T RTC_EnableIt -00000000 T RTC_GetDate -00000000 T RTC_GetHourMode -00000000 T RTC_GetSR -00000000 T RTC_GetTime -00000000 T RTC_SetDate -00000000 T RTC_SetDateAlarm -00000000 T RTC_SetHourMode -00000000 T RTC_SetTime -00000000 T RTC_SetTimeAlarm - U __assert_func -00000000 r __func__.6790 -00000000 r __func__.6799 -00000000 r __func__.6804 - -rtt.o: -00000000 T RTT_EnableIT -00000000 T RTT_GetStatus -00000000 T RTT_GetTime -00000000 T RTT_SetAlarm -00000000 T RTT_SetPrescaler - U __assert_func -00000000 r __func__.6797 -00000000 r __func__.6805 - -spi.o: -00000000 T SPI_Configure -00000000 T SPI_ConfigureNPCS -00000000 T SPI_Disable -00000000 T SPI_DisableIt -00000000 T SPI_Enable -00000000 T SPI_EnableIt -00000000 T SPI_GetStatus -00000000 T SPI_IsFinished -00000000 T SPI_Read -00000000 T SPI_Write - U pmc_enable_periph_clk - -tc.o: -00000000 T TC_Configure -00000000 T TC_FindMckDivisor -00000000 T TC_GetStatus -00000000 T TC_ReadCV -00000000 T TC_SetRA -00000000 T TC_SetRB -00000000 T TC_SetRC -00000000 T TC_Start -00000000 T TC_Stop - U __assert_func -00000000 r __func__.6792 -00000000 r __func__.6798 -00000000 r __func__.6804 - -timetick.o: -00000000 T GetTickCount -00000000 T Sleep -00000000 T TimeTick_Configure -00000000 T TimeTick_Increment -00000000 T Wait -00000000 b _dwTickCount - -twi.o: -00000000 T TWI_ByteReceived -00000000 T TWI_ByteSent -00000000 T TWI_ConfigureMaster -00000000 T TWI_ConfigureSlave -00000000 T TWI_Disable -00000000 T TWI_DisableIt -00000000 T TWI_EnableIt -00000000 T TWI_GetMaskedStatus -00000000 T TWI_GetStatus -00000000 T TWI_ReadByte -00000000 T TWI_SendSTOPCondition -00000000 T TWI_SetClock -00000000 T TWI_StartRead -00000000 T TWI_StartWrite -00000000 T TWI_Stop -00000000 T TWI_TransferComplete -00000000 T TWI_WriteByte - U __assert_func -00000000 r __func__.7151 -00000000 r __func__.7157 -00000000 r __func__.7172 -00000000 r __func__.7176 -00000000 r __func__.7184 -00000000 r __func__.7191 -00000000 r __func__.7195 -00000000 r __func__.7200 -00000000 r __func__.7208 -00000000 r __func__.7222 -00000000 r __func__.7227 -00000000 r __func__.7231 -00000000 r __func__.7236 -00000000 r __func__.7240 - -usart.o: -00000000 T USART_Configure -00000000 T USART_DisableIt -00000000 T USART_EnableIt -00000000 T USART_GetChar -00000000 T USART_GetStatus -00000000 T USART_IsDataAvailable -00000000 T USART_IsRxReady -00000000 T USART_PutChar -00000000 T USART_Read -00000000 T USART_ReadBuffer -00000000 T USART_SetIrdaFilter -00000000 T USART_SetReceiverEnabled -00000000 T USART_SetTransmitterEnabled -00000000 T USART_Write -00000000 T USART_WriteBuffer - U __assert_func -00000000 r __func__.7068 - -wdt.o: -00000000 T WDT_Disable -00000000 T WDT_Enable -00000000 T WDT_GetPeriod -00000000 T WDT_GetStatus -00000000 T WDT_Restart - -system_sam3xa.o: -00000000 D SystemCoreClock -00000000 T SystemCoreClockUpdate -00000000 T SystemInit -00000000 T system_init_flash - -startup_sam3xa.o: - U ADC_Handler - U BusFault_Handler - U CAN0_Handler - U CAN1_Handler - U DACC_Handler - U DMAC_Handler - U DebugMon_Handler - U EFC0_Handler - U EFC1_Handler - U EMAC_Handler - U HSMCI_Handler - U HardFault_Handler - U MemManage_Handler - U NMI_Handler - U PIOA_Handler - U PIOB_Handler - U PIOC_Handler - U PIOD_Handler - U PMC_Handler - U PWM_Handler - U PendSV_Handler - U RSTC_Handler - U RTC_Handler - U RTT_Handler -00000000 T Reset_Handler - U SMC_Handler - U SPI0_Handler - U SSC_Handler - U SUPC_Handler - U SVC_Handler - U SysTick_Handler - U TC0_Handler - U TC1_Handler - U TC2_Handler - U TC3_Handler - U TC4_Handler - U TC5_Handler - U TC6_Handler - U TC7_Handler - U TC8_Handler - U TRNG_Handler - U TWI0_Handler - U TWI1_Handler - U UART_Handler - U UOTGHS_Handler - U USART0_Handler - U USART1_Handler - U USART2_Handler - U USART3_Handler - U UsageFault_Handler - U WDT_Handler - U _erelocate - U _estack - U _etext - U _ezero - U _sfixed - U _srelocate - U _szero -00000000 R exception_table - U main - -adc.o: -00000000 T adc_configure_power_save -00000000 T adc_configure_sequence -00000000 T adc_configure_timing -00000000 T adc_configure_trigger -00000000 T adc_disable_all_channel -00000000 T adc_disable_anch -00000000 T adc_disable_channel -00000000 T adc_disable_channel_differential_input -00000000 T adc_disable_channel_input_offset -00000000 T adc_disable_interrupt -00000000 T adc_disable_tag -00000000 T adc_disable_ts -00000000 T adc_enable_all_channel -00000000 T adc_enable_anch -00000000 T adc_enable_channel -00000000 T adc_enable_channel_differential_input -00000000 T adc_enable_channel_input_offset -00000000 T adc_enable_interrupt -00000000 T adc_enable_tag -00000000 T adc_enable_ts -00000000 T adc_get_actual_adc_clock -00000000 T adc_get_channel_status -00000000 T adc_get_channel_value -00000000 T adc_get_comparison_mode -00000000 T adc_get_interrupt_mask -00000000 T adc_get_latest_value -00000000 T adc_get_overrun_status -00000000 T adc_get_pdc_base -00000000 T adc_get_status -00000000 T adc_get_tag -00000000 T adc_get_writeprotect_status -00000000 T adc_init -00000000 T adc_set_bias_current -00000000 T adc_set_channel_input_gain -00000000 T adc_set_comparison_channel -00000000 T adc_set_comparison_mode -00000000 T adc_set_comparison_window -00000000 T adc_set_resolution -00000000 T adc_set_writeprotect -00000000 T adc_start -00000000 T adc_start_sequencer -00000000 T adc_stop -00000000 T adc_stop_sequencer - -udp.o: - -udphs.o: - -uotghs.o: -00000000 T UOTGHS_Handler -00000000 B gpf_isr - -interrupt_sam_nvic.o: -00000000 D g_interrupt_enabled - -uotghs_device.o: -00000000 T UDD_Attach -00000000 T UDD_ClearIN -00000000 T UDD_ClearOUT -00000000 T UDD_ClearSetupInt -00000000 T UDD_Detach -00000000 T UDD_FifoByteCount -00000000 T UDD_GetFrameNumber -00000000 T UDD_Init -00000000 T UDD_InitEP -00000000 T UDD_InitEndpoints -00000000 T UDD_ReadWriteAllowed -00000000 T UDD_ReceivedSetupInt -00000000 T UDD_Recv -00000000 T UDD_Recv8 -00000000 T UDD_ReleaseRX -00000000 T UDD_ReleaseTX -00000000 T UDD_Send -00000000 T UDD_Send8 -00000000 T UDD_SetAddress -00000000 T UDD_SetStack -00000000 T UDD_Stall -00000000 T UDD_WaitForINOrOUT -00000000 T UDD_WaitIN -00000000 T UDD_WaitOUT - U g_interrupt_enabled - U gpf_isr - U pmc_enable_periph_clk - U pmc_enable_udpck - U pmc_enable_upll_clock - U pmc_switch_udpck_to_upllck -00000000 b ul_recv_fifo_ptr -00000000 b ul_send_fifo_ptr - -uotghs_host.o: -00000000 T UHD_BusReset -00000000 T UHD_GetVBUSState -00000000 t UHD_ISR -00000000 T UHD_Init -00000000 T UHD_Pipe0_Alloc -00000000 T UHD_Pipe_Alloc -00000000 T UHD_Pipe_Free -00000000 T UHD_Pipe_Is_Transfer_Complete -00000000 T UHD_Pipe_Read -00000000 T UHD_Pipe_Send -00000000 T UHD_Pipe_Write -00000000 T UHD_SetStack - U g_interrupt_enabled - U gpf_isr - U pmc_enable_periph_clk - U pmc_enable_udpck - U pmc_enable_upll_clock - U pmc_switch_udpck_to_upllck -00000000 b uhd_state - -dacc.o: -00000000 T dacc_disable_channel -00000000 T dacc_disable_interrupt -00000000 T dacc_disable_trigger -00000000 T dacc_enable_channel -00000000 T dacc_enable_flexible_selection -00000000 T dacc_enable_interrupt -00000000 T dacc_get_analog_control -00000000 T dacc_get_channel_status -00000000 T dacc_get_interrupt_mask -00000000 T dacc_get_interrupt_status -00000000 T dacc_get_pdc_base -00000000 T dacc_get_writeprotect_status -00000000 T dacc_reset -00000000 T dacc_set_analog_control -00000000 T dacc_set_channel_selection -00000000 T dacc_set_power_save -00000000 T dacc_set_timing -00000000 T dacc_set_transfer_mode -00000000 T dacc_set_trigger -00000000 T dacc_set_writeprotect -00000000 T dacc_write_conversion_data - -can.o: -00000000 R can_bit_time -00000000 T can_disable -00000000 T can_disable_autobaud_listen_mode -00000000 T can_disable_interrupt -00000000 T can_disable_low_power_mode -00000000 T can_disable_overload_frame -00000000 T can_disable_time_triggered_mode -00000000 T can_disable_timer_freeze -00000000 T can_disable_tx_repeat -00000000 T can_enable -00000000 T can_enable_autobaud_listen_mode -00000000 T can_enable_interrupt -00000000 T can_enable_low_power_mode -00000000 T can_enable_overload_frame -00000000 T can_enable_time_triggered_mode -00000000 T can_enable_timer_freeze -00000000 T can_enable_tx_repeat -00000000 T can_get_internal_timer_value -00000000 T can_get_interrupt_mask -00000000 T can_get_rx_error_cnt -00000000 T can_get_status -00000000 T can_get_timestamp_value -00000000 T can_get_tx_error_cnt -00000000 T can_global_send_abort_cmd -00000000 T can_global_send_transfer_cmd -00000000 T can_init -00000000 T can_mailbox_get_status -00000000 T can_mailbox_init -00000000 T can_mailbox_read -00000000 T can_mailbox_send_abort_cmd -00000000 T can_mailbox_send_transfer_cmd -00000000 T can_mailbox_set_timemark -00000000 T can_mailbox_tx_remote_frame -00000000 T can_mailbox_write -00000000 T can_reset_all_mailbox -00000000 T can_reset_internal_timer -00000000 T can_reset_mailbox_data -00000000 T can_set_rx_sync_stage -00000000 T can_set_timestamp_capture_point - U memset - -efc.o: -00000000 T efc_disable_frdy_interrupt -00000000 T efc_enable_frdy_interrupt -00000000 T efc_get_flash_access_mode -00000000 T efc_get_result -00000000 T efc_get_status -00000000 T efc_get_wait_state -00000000 T efc_init -00000000 T efc_perform_command -0000006c T efc_perform_fcr -00000000 T efc_perform_read_sequence -00000000 T efc_set_flash_access_mode -00000000 T efc_set_wait_state -00000068 T efc_write_fmr -00000000 b iap_perform_command.7049 - -gpbr.o: -00000000 T gpbr_read -00000000 T gpbr_write - -ssc.o: - U memset -00000000 T ssc_disable_interrupt -00000000 T ssc_disable_rx -00000000 T ssc_disable_tx -00000000 T ssc_disable_tx_frame_sync_data -00000000 T ssc_enable_interrupt -00000000 T ssc_enable_rx -00000000 T ssc_enable_tx -00000000 T ssc_enable_tx_frame_sync_data -00000000 T ssc_get_interrupt_mask -00000000 T ssc_get_rx_access -00000000 T ssc_get_rx_compare -00000000 T ssc_get_status -00000000 T ssc_get_tx_access -00000000 T ssc_get_writeprotect_status -00000000 T ssc_i2s_set_receiver -00000000 T ssc_i2s_set_transmitter -00000000 T ssc_is_rx_enabled -00000000 T ssc_is_rx_ready -00000000 T ssc_is_tx_empty -00000000 T ssc_is_tx_enabled -00000000 T ssc_is_tx_ready -00000000 T ssc_read -00000000 T ssc_read_sync_data -00000000 T ssc_reset -00000000 T ssc_set_clock_divider -00000000 T ssc_set_loop_mode -00000000 T ssc_set_normal_mode -00000000 T ssc_set_receiver -00000000 T ssc_set_rx_compare -00000000 T ssc_set_rx_stop_selection -00000000 T ssc_set_td_default_level -00000000 T ssc_set_transmitter -00000000 T ssc_set_writeprotect -00000000 T ssc_write -00000000 T ssc_write_sync_data - -trng.o: -00000000 T trng_disable -00000000 T trng_disable_interrupt -00000000 T trng_enable -00000000 T trng_enable_interrupt -00000000 T trng_get_interrupt_mask -00000000 T trng_get_interrupt_status -00000000 T trng_read_output_data - -rstc.o: -00000000 T rstc_disable_user_reset -00000000 T rstc_disable_user_reset_interrupt -00000000 T rstc_enable_user_reset -00000000 T rstc_enable_user_reset_interrupt -00000000 T rstc_get_reset_cause -00000000 T rstc_get_status -00000000 T rstc_reset_extern -00000000 T rstc_set_external_reset -00000000 T rstc_start_software_reset - -emac.o: -00000000 t circ_inc -00000000 T emac_dev_get_tx_load -00000000 T emac_dev_init -00000000 T emac_dev_read -00000000 T emac_dev_reset -00000000 T emac_dev_set_rx_callback -00000000 T emac_dev_set_tx_wakeup_callback -00000000 T emac_dev_write -00000000 T emac_handler -00000000 T emac_phy_read -00000000 T emac_phy_write -00000000 t emac_reset_rx_mem -00000000 t emac_reset_tx_mem -00000000 b gs_rx_desc -00000000 b gs_tx_callback -00000000 b gs_tx_desc -00000000 b gs_uc_rx_buffer -00000000 b gs_uc_tx_buffer - U memcpy From bd382fb8a128ac0ab36b4c539646812dd470eb37 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 16 Apr 2025 14:43:53 -0500 Subject: [PATCH 23/86] =?UTF-8?q?=F0=9F=94=A8=20Suppress=20generate=5Fvers?= =?UTF-8?q?ion=20(for=20now)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/bin/generate_version | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/buildroot/bin/generate_version b/buildroot/bin/generate_version index ff85fe7ecf..edc25e18af 100755 --- a/buildroot/bin/generate_version +++ b/buildroot/bin/generate_version @@ -3,12 +3,19 @@ # generate_version # # Make a Version.h file to accompany CUSTOM_VERSION_FILE +# Invoked automatically by Arduino IDE # # Authors: jbrazio, thinkyhead, InsanityAutomation, rfinnie # set -e +# Only run if ALLOW_GENERATE_VERSION is set +if [[ "$ALLOW_GENERATE_VERSION" != "1" ]]; then + echo "Skipping generate_version because ALLOW_GENERATE_VERSION is not set." + exit 0 +fi + DIR="${1:-Marlin}" READ_FILE="${READ_FILE:-${DIR}/Version.h}" WRITE_FILE="${WRITE_FILE:-${READ_FILE}}" From 62c1c116f74713a50577d1992b423de40c3bc0c5 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Thu, 17 Apr 2025 00:30:15 +0000 Subject: [PATCH 24/86] [cron] Bump distribution date (2025-04-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 2015e2ce0a..b7b07dd43d 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 "2025-04-16" +//#define STRING_DISTRIBUTION_DATE "2025-04-17" /** * The protocol for communication to the host. Protocol indicates communication diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index cb0252d149..c34074006d 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 "2025-04-16" + #define STRING_DISTRIBUTION_DATE "2025-04-17" #endif /** From 58f03953b8a6d8c86ec2d82000b6b7d33712b1a8 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 17 Apr 2025 15:42:21 -0500 Subject: [PATCH 25/86] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20Linear=20Advance=20e?= =?UTF-8?q?dit=20item?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/menu/menu_advanced.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 8080a23ba4..2ffdee798d 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -736,7 +736,7 @@ void menu_advanced_settings() { EDIT_ITEM(float42_52, MSG_ADVANCE_K, &planner.extruder_advance_K[0], 0, 10); #else EXTRUDER_LOOP() - EDIT_ITEM_N(float42_52, n, MSG_ADVANCE_K_E, &planner.extruder_advance_K[e], 0, 10); + EDIT_ITEM_N(float42_52, e, MSG_ADVANCE_K_E, &planner.extruder_advance_K[e], 0, 10); #endif #endif From 4ea75ad284107959ea33dbb7875a55a689594faf Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 17 Apr 2025 15:43:40 -0500 Subject: [PATCH 26/86] =?UTF-8?q?=F0=9F=8E=A8=20Cosmetic=20updates,=20fix?= =?UTF-8?q?=20alias=20warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/ESP32/i2s.cpp | 16 ++--- Marlin/src/feature/max7219.cpp | 2 +- .../src/feature/mmu3/mmu3_error_converter.cpp | 8 +-- Marlin/src/inc/SanityCheck.h | 2 +- Marlin/src/lcd/menu/menu_advanced.cpp | 10 +++- Marlin/src/lcd/menu/menu_item.h | 8 +++ Marlin/src/module/planner.cpp | 60 +++++++++---------- 7 files changed, 59 insertions(+), 47 deletions(-) diff --git a/Marlin/src/HAL/ESP32/i2s.cpp b/Marlin/src/HAL/ESP32/i2s.cpp index 4b17db3daf..6aeeb0e3dc 100644 --- a/Marlin/src/HAL/ESP32/i2s.cpp +++ b/Marlin/src/HAL/ESP32/i2s.cpp @@ -145,7 +145,7 @@ static void IRAM_ATTR i2s_intr_handler_default(void *arg) { void stepperTask(void *parameter) { uint32_t nextMainISR = 0; #if ENABLED(LIN_ADVANCE) - uint32_t nextAdvanceISR = Stepper::LA_ADV_NEVER; + uint32_t nextAdvanceISR = stepper.LA_ADV_NEVER; #endif for (;;) { @@ -167,13 +167,13 @@ void stepperTask(void *parameter) { if (!using_ftMotion) { if (!nextMainISR) { - Stepper::pulse_phase_isr(); - nextMainISR = Stepper::block_phase_isr(); + stepper.pulse_phase_isr(); + nextMainISR = stepper.block_phase_isr(); } #if ENABLED(LIN_ADVANCE) else if (!nextAdvanceISR) { - Stepper::advance_isr(); - nextAdvanceISR = Stepper::la_interval; + stepper.advance_isr(); + nextAdvanceISR = stepper.la_interval; } #endif else @@ -182,10 +182,10 @@ void stepperTask(void *parameter) { nextMainISR--; #if ENABLED(LIN_ADVANCE) - if (nextAdvanceISR == Stepper::LA_ADV_NEVER) - nextAdvanceISR = Stepper::la_interval; + if (nextAdvanceISR == stepper.LA_ADV_NEVER) + nextAdvanceISR = stepper.la_interval; - if (nextAdvanceISR && nextAdvanceISR != Stepper::LA_ADV_NEVER) + if (nextAdvanceISR && nextAdvanceISR != stepper.LA_ADV_NEVER) nextAdvanceISR--; #endif } diff --git a/Marlin/src/feature/max7219.cpp b/Marlin/src/feature/max7219.cpp index 5a25ea6710..5a61922c1d 100644 --- a/Marlin/src/feature/max7219.cpp +++ b/Marlin/src/feature/max7219.cpp @@ -757,7 +757,7 @@ void Max7219::idle_tasks() { #ifdef MAX7219_DEBUG_MULTISTEPPING static uint8_t last_multistepping = 0; - const uint8_t multistepping = Stepper::steps_per_isr; + const uint8_t multistepping = stepper.steps_per_isr; if (multistepping != last_multistepping) { static uint8_t log2_old = 0; uint8_t log2_new = 0; diff --git a/Marlin/src/feature/mmu3/mmu3_error_converter.cpp b/Marlin/src/feature/mmu3/mmu3_error_converter.cpp index d5d124427e..d7fc651fbd 100644 --- a/Marlin/src/feature/mmu3/mmu3_error_converter.cpp +++ b/Marlin/src/feature/mmu3/mmu3_error_converter.cpp @@ -196,16 +196,16 @@ namespace MMU3 { return FindErrorIndex(ERR_OTHER_UNKNOWN_ERROR); } - uint16_t PrusaErrorCode(const uint8_t i) { return (uint16_t)pgm_read_word(&errorCodes[i]); } + uint16_t PrusaErrorCode(const uint8_t i) { return pgm_read_word(errorCodes + i); } - FSTR_P const PrusaErrorTitle(const uint8_t i) { return (FSTR_P const)pgm_read_ptr(&errorTitles[i]); } - FSTR_P const PrusaErrorDesc(const uint8_t i) { return (FSTR_P const)pgm_read_ptr(&errorDescs[i]); } + FSTR_P const PrusaErrorTitle(const uint8_t i) { return (FSTR_P const)pgm_read_ptr(errorTitles + i); } + FSTR_P const PrusaErrorDesc(const uint8_t i) { return (FSTR_P const)pgm_read_ptr(errorDescs + i); } uint8_t PrusaErrorButtons(const uint8_t i) { return pgm_read_byte(errorButtons + i); } FSTR_P const PrusaErrorButtonTitle(const uint8_t bi) { // -1 represents the hidden NoOperation button which is not drawn in any way - return (FSTR_P const)pgm_read_ptr(&btnOperation[bi - 1]); + return (FSTR_P const)pgm_read_ptr(btnOperation + bi - 1); } Buttons ButtonPressed(const ErrorCode ec) { diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 169f84983c..cd3c1cd573 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -4460,7 +4460,7 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive." * Direct Stepping requirements */ #if ENABLED(DIRECT_STEPPING) - #if ENABLED(CPU_32_BIT) + #ifdef CPU_32_BIT #error "Direct Stepping is not supported on 32-bit boards." #elif !IS_FULL_CARTESIAN #error "Direct Stepping is incompatible with enabled kinematics." diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 2ffdee798d..137439c6df 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -104,6 +104,10 @@ void menu_backlash(); #endif #if DISABLED(NO_VOLUMETRICS) || ENABLED(ADVANCED_PAUSE_FEATURE) + #define HAS_ADV_FILAMENT_MENU 1 +#endif + +#if HAS_ADV_FILAMENT_MENU // // Advanced Settings > Filament // @@ -138,7 +142,7 @@ void menu_backlash(); EDIT_ITEM_FAST_N(float43, e, MSG_FILAMENT_DIAM_E, &planner.filament_size[e], 1.5f, 3.25f, planner.calculate_volumetric_multipliers); #endif } - #endif + #endif // !NO_VOLUMETRICS #if ENABLED(CONFIGURE_FILAMENT_CHANGE) constexpr float extrude_maxlength = TERN(PREVENT_LENGTHY_EXTRUDE, EXTRUDE_MAXLENGTH, 999); @@ -169,7 +173,7 @@ void menu_backlash(); END_MENU(); } -#endif // !NO_VOLUMETRICS || ADVANCED_PAUSE_FEATURE +#endif // HAS_ADV_FILAMENT_MENU // // Advanced Settings > Temperature helpers @@ -729,7 +733,7 @@ void menu_advanced_settings() { SUBMENU(MSG_TEMPERATURE, menu_advanced_temperature); #endif - #if DISABLED(NO_VOLUMETRICS) || ENABLED(ADVANCED_PAUSE_FEATURE) + #if HAS_ADV_FILAMENT_MENU SUBMENU(MSG_FILAMENT, menu_advanced_filament); #elif ENABLED(LIN_ADVANCE) #if DISTINCT_E < 2 diff --git a/Marlin/src/lcd/menu/menu_item.h b/Marlin/src/lcd/menu/menu_item.h index df2c90425c..af4558cefc 100644 --- a/Marlin/src/lcd/menu/menu_item.h +++ b/Marlin/src/lcd/menu/menu_item.h @@ -276,6 +276,14 @@ class MenuItem_bool : public MenuEditItemBase { * EDIT_ITEM(int3, MSG_SPEED, &feedrate_percentage, SPEED_EDIT_MIN, SPEED_EDIT_MAX) * MenuItem_int3::action(flabel, &feedrate_percentage, SPEED_EDIT_MIN, SPEED_EDIT_MAX) * MenuItem_int3::draw(sel, row, flabel, &feedrate_percentage, SPEED_EDIT_MIN, SPEED_EDIT_MAX) + * + * Variants use standard suffixes. N:Number Index, S:C-string for substitution, F:F-string label, f:F-string for substitution + * _MENU_ITEM_F(TYPE, V...) Item with optional data + * _MENU_ITEM_N_S_F(TYPE, N, S, V...) Item with index value, C-string, and optional data + * _MENU_ITEM_N_f_F(TYPE, N, f, V...) Item with index value and F-string + * _MENU_ITEM_N_F(TYPE, N, V...) Item with index value + * _MENU_ITEM_S_F(TYPE, S, V...) Item with a unique string + * _MENU_ITEM_f_F(TYPE, f, V...) Item with a unique F-string */ #if ENABLED(ENCODER_RATE_MULTIPLIER) diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 561d13fa2a..b3df490cf0 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -780,7 +780,7 @@ block_t* Planner::get_current_block() { * by the provided factors. If entry_factor is 0 don't change the initial_rate. * Assumes that the implied initial_rate and final_rate are no less than * sqrt(block->acceleration_steps_per_s2 / 2). This is ensured through - * minimum_planner_speed_sqr / min_entry_speed_sqr though note there's one + * minimum_planner_speed_sqr / min_entry_speed_sqr - but there's one * exception in recalculate_trapezoids(). * * ############ VERY IMPORTANT ############ @@ -854,6 +854,8 @@ void Planner::calculate_trapezoid_for_block(block_t * const block, const_float_t block->accelerate_before = accelerate_steps; block->decelerate_start = block->step_event_count - decelerate_steps; block->initial_rate = initial_rate; + block->final_rate = final_rate; + #if ENABLED(S_CURVE_ACCELERATION) block->acceleration_time = acceleration_time; block->deceleration_time = deceleration_time; @@ -861,7 +863,6 @@ void Planner::calculate_trapezoid_for_block(block_t * const block, const_float_t block->deceleration_time_inverse = deceleration_time_inverse; block->cruise_rate = cruise_rate; #endif - block->final_rate = final_rate; #if ENABLED(LIN_ADVANCE) if (block->la_advance_rate) { @@ -892,30 +893,29 @@ void Planner::calculate_trapezoid_for_block(block_t * const block, const_float_t * Laser Trap Power works for all Jerk and Curve modes; however Arc-based moves will have issues since * the segments are usually too small. */ - if (cutter.cutter_mode == CUTTER_MODE_CONTINUOUS) { - if (planner.laser_inline.status.isPowered && planner.laser_inline.status.isEnabled) { - if (block->laser.power > 0) { - NOLESS(block->laser.power, laser_power_floor); - block->laser.trap_ramp_active_pwr = (block->laser.power - laser_power_floor) * (initial_rate / float(block->nominal_rate)) + laser_power_floor; - block->laser.trap_ramp_entry_incr = (block->laser.power - block->laser.trap_ramp_active_pwr) / accelerate_steps; - float laser_pwr = block->laser.power * (final_rate / float(block->nominal_rate)); - NOLESS(laser_pwr, laser_power_floor); - block->laser.trap_ramp_exit_decr = (block->laser.power - laser_pwr) / decelerate_steps; - #if ENABLED(DEBUG_LASER_TRAP) - SERIAL_ECHO_MSG("lp:",block->laser.power); - SERIAL_ECHO_MSG("as:",accelerate_steps); - SERIAL_ECHO_MSG("ds:",decelerate_steps); - SERIAL_ECHO_MSG("p.trap:",block->laser.trap_ramp_active_pwr); - SERIAL_ECHO_MSG("p.incr:",block->laser.trap_ramp_entry_incr); - SERIAL_ECHO_MSG("p.decr:",block->laser.trap_ramp_exit_decr); - #endif - } - else { - block->laser.trap_ramp_active_pwr = 0; - block->laser.trap_ramp_entry_incr = 0; - block->laser.trap_ramp_exit_decr = 0; - } - + if (cutter.cutter_mode == CUTTER_MODE_CONTINUOUS + && planner.laser_inline.status.isPowered && planner.laser_inline.status.isEnabled + ) { + if (block->laser.power > 0) { + NOLESS(block->laser.power, laser_power_floor); + block->laser.trap_ramp_active_pwr = (block->laser.power - laser_power_floor) * (initial_rate / float(block->nominal_rate)) + laser_power_floor; + block->laser.trap_ramp_entry_incr = (block->laser.power - block->laser.trap_ramp_active_pwr) / accelerate_steps; + float laser_pwr = block->laser.power * (final_rate / float(block->nominal_rate)); + NOLESS(laser_pwr, laser_power_floor); + block->laser.trap_ramp_exit_decr = (block->laser.power - laser_pwr) / decelerate_steps; + #if ENABLED(DEBUG_LASER_TRAP) + SERIAL_ECHO_MSG("lp:", block->laser.power); + SERIAL_ECHO_MSG("as:", accelerate_steps); + SERIAL_ECHO_MSG("ds:", decelerate_steps); + SERIAL_ECHO_MSG("p.trap:", block->laser.trap_ramp_active_pwr); + SERIAL_ECHO_MSG("p.incr:", block->laser.trap_ramp_entry_incr); + SERIAL_ECHO_MSG("p.decr:", block->laser.trap_ramp_exit_decr); + #endif + } + else { + block->laser.trap_ramp_active_pwr = 0; + block->laser.trap_ramp_entry_incr = 0; + block->laser.trap_ramp_exit_decr = 0; } } #endif // LASER_POWER_TRAP @@ -2440,7 +2440,7 @@ bool Planner::_populate_block( block->acceleration_steps_per_s2 = accel; block->acceleration = accel / steps_per_mm; #if DISABLED(S_CURVE_ACCELERATION) - block->acceleration_rate = (uint32_t)(accel * (float(1UL << 24) / (STEPPER_TIMER_RATE))); + block->acceleration_rate = uint32_t(accel * (float(1UL << 24) / (STEPPER_TIMER_RATE))); #endif #if ENABLED(LIN_ADVANCE) @@ -2448,10 +2448,10 @@ bool Planner::_populate_block( block->la_scaling = 0; if (use_advance_lead) { - // the Bresenham algorithm will convert this step rate into extruder steps + // The Bresenham algorithm will convert this step rate into extruder steps block->la_advance_rate = extruder_advance_K[E_INDEX_N(extruder)] * block->acceleration_steps_per_s2; - // reduce LA ISR frequency by calling it only often enough to ensure that there will + // Reduce LA ISR frequency by calling it only often enough to ensure that there will // never be more than four extruder steps per call for (uint32_t dividend = block->steps.e << 1; dividend <= (block->step_event_count >> 2); dividend <<= 1) block->la_scaling++; @@ -2461,7 +2461,7 @@ bool Planner::_populate_block( SERIAL_ECHOLNPGM("eISR running at > 10kHz: ", block->la_advance_rate); #endif } - #endif + #endif // LIN_ADVANCE // Formula for the average speed over a 1 step worth of distance if starting from zero and // accelerating at the current limit. Since we can only change the speed every step this is a From 65b8ced80ccb9462cf9052a80f8e7f8a2a832b81 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 17 Apr 2025 17:29:20 -0500 Subject: [PATCH 27/86] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Clari?= =?UTF-8?q?fy=20DEPLOY=5FALARM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/bltouch.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Marlin/src/feature/bltouch.h b/Marlin/src/feature/bltouch.h index 0f9f2e68ba..1371ec9f46 100644 --- a/Marlin/src/feature/bltouch.h +++ b/Marlin/src/feature/bltouch.h @@ -26,6 +26,7 @@ // BLTouch commands are sent as servo angles typedef unsigned char BLTCommand; +#define DEPLOY_ALARM true #define STOW_ALARM true #define BLTOUCH_DEPLOY 10 #define BLTOUCH_STOW 90 @@ -104,7 +105,7 @@ public: static bool triggered(); private: - static bool _deploy_query_alarm() { return command(BLTOUCH_DEPLOY, BLTOUCH_DEPLOY_DELAY); } + static bool _deploy_query_alarm() { return command(BLTOUCH_DEPLOY, BLTOUCH_DEPLOY_DELAY) == DEPLOY_ALARM; } static bool _stow_query_alarm() { return command(BLTOUCH_STOW, BLTOUCH_STOW_DELAY) == STOW_ALARM; } static void clear(); From 7b083be5c5dda3486642af7b4cea3853c1057162 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 18 Apr 2025 00:29:57 +0000 Subject: [PATCH 28/86] [cron] Bump distribution date (2025-04-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 b7b07dd43d..2260bfc119 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 "2025-04-17" +//#define STRING_DISTRIBUTION_DATE "2025-04-18" /** * The protocol for communication to the host. Protocol indicates communication diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index c34074006d..e4d0c6679b 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 "2025-04-17" + #define STRING_DISTRIBUTION_DATE "2025-04-18" #endif /** From a653c3aca02f4b0eb8da0c2b7f90c0bb33d8cb9c Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sat, 19 Apr 2025 10:36:22 +1200 Subject: [PATCH 29/86] =?UTF-8?q?=F0=9F=8E=A8=20Binary=20Stream=20cleanup?= =?UTF-8?q?=20(#27799)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/binary_stream.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Marlin/src/feature/binary_stream.h b/Marlin/src/feature/binary_stream.h index b2d76c045a..304fdae300 100644 --- a/Marlin/src/feature/binary_stream.h +++ b/Marlin/src/feature/binary_stream.h @@ -134,19 +134,19 @@ private: public: static void idle() { - // If a transfer is interrupted and a file is left open, abort it after TIMEOUT ms + // If a transfer is interrupted and a file is left open, abort it after 'idle_period' ms const millis_t ms = millis(); if (transfer_active && ELAPSED(ms, idle_timeout)) { - idle_timeout = ms + IDLE_PERIOD; + idle_timeout = ms + idle_period; if (ELAPSED(ms, transfer_timeout)) transfer_abort(); } } static void process(uint8_t packet_type, char *buffer, const uint16_t length) { - transfer_timeout = millis() + TIMEOUT; + transfer_timeout = millis() + timeout; switch (static_cast(packet_type)) { case FileTransfer::QUERY: - SERIAL_ECHO(F("PFT:version:"), VERSION_MAJOR, C('.'), VERSION_MINOR, C('.'), VERSION_PATCH); + SERIAL_ECHO(F("PFT:version:"), version_major, C('.'), version_minor, C('.'), version_patch); #if ENABLED(BINARY_STREAM_COMPRESSION) SERIAL_ECHOLN(F(":compression:heatshrink,"), HEATSHRINK_STATIC_WINDOW_BITS, C(','), HEATSHRINK_STATIC_LOOKAHEAD_BITS); #else @@ -194,7 +194,7 @@ public: } } - static const uint16_t VERSION_MAJOR = 0, VERSION_MINOR = 1, VERSION_PATCH = 0, TIMEOUT = 10000, IDLE_PERIOD = 1000; + static const uint16_t version_major = 0, version_minor = 1, version_patch = 0, timeout = 10000, idle_period = 1000; }; class BinaryStream { @@ -209,7 +209,7 @@ public: struct Packet { // 10 byte protocol overhead, ascii with checksum and line number has a minimum of 7 increasing with line union Header { - static constexpr uint16_t HEADER_TOKEN = 0xB5AD; + static constexpr uint16_t header_token = 0xB5AD; struct [[gnu::packed]] { uint16_t token; // packet start token uint8_t sync; // stream sync, resend id and packet loss detection @@ -245,7 +245,7 @@ public: bytes_received = 0; checksum = 0; header_checksum = 0; - timeout = millis() + PACKET_MAX_WAIT; + timeout = millis() + packet_max_wait; buffer = nullptr; } } packet{}; @@ -272,14 +272,14 @@ public: } if (!bs_serial_data_available(card.transfer_port_index)) return false; data = bs_read_serial(card.transfer_port_index); - packet.timeout = millis() + PACKET_MAX_WAIT; + packet.timeout = millis() + packet_max_wait; return true; } template void receive(char (&buffer)[buffer_size]) { uint8_t data = 0; - millis_t transfer_window = millis() + RX_TIMESLICE; + millis_t transfer_window = millis() + rx_timeslice; #if HAS_MEDIA PORT_REDIRECT(SERIAL_PORTMASK(card.transfer_port_index)); @@ -299,7 +299,7 @@ public: case StreamState::PACKET_WAIT: if (!stream_read(data)) { idle(); return; } // no active packet so don't wait packet.header.data[1] = data; - if (packet.header.token == packet.header.HEADER_TOKEN) { + if (packet.header.token == packet.header.header_token) { packet.bytes_received = 2; stream_state = StreamState::PACKET_HEADER; } @@ -322,7 +322,7 @@ public: if (packet.header.checksum == packet.header_checksum) { // The SYNC control packet is a special case in that it doesn't require the stream sync to be correct if (static_cast(packet.header.protocol()) == Protocol::CONTROL && static_cast(packet.header.type()) == ProtocolControl::SYNC) { - SERIAL_ECHOLN(F("ss"), sync, C(','), buffer_size, C(','), VERSION_MAJOR, C('.'), VERSION_MINOR, C('.'), VERSION_PATCH); + SERIAL_ECHOLN(F("ss"), sync, C(','), buffer_size, C(','), version_major, C('.'), version_minor, C('.'), version_patch); stream_state = StreamState::PACKET_RESET; break; } @@ -398,7 +398,7 @@ public: stream_state = StreamState::PACKET_RESET; break; case StreamState::PACKET_RESEND: - if (packet_retries < MAX_RETRIES || MAX_RETRIES == 0) { + if (packet_retries < max_retries || max_retries == 0) { packet_retries++; stream_state = StreamState::PACKET_RESET; SERIAL_ECHO_MSG("Resend request ", packet_retries); @@ -446,7 +446,7 @@ public: SDFileTransferProtocol::idle(); } - static const uint16_t PACKET_MAX_WAIT = 500, RX_TIMESLICE = 20, MAX_RETRIES = 0, VERSION_MAJOR = 0, VERSION_MINOR = 1, VERSION_PATCH = 0; + static const uint16_t packet_max_wait = 500, rx_timeslice = 20, max_retries = 0, version_major = 0, version_minor = 1, version_patch = 0; uint8_t packet_retries, sync; uint16_t buffer_next_index; uint32_t bytes_received; From 3c32770faf895b9306a8433b6849da37a1b4e554 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 19 Apr 2025 00:28:50 +0000 Subject: [PATCH 30/86] [cron] Bump distribution date (2025-04-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 2260bfc119..bf36617e2c 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 "2025-04-18" +//#define STRING_DISTRIBUTION_DATE "2025-04-19" /** * The protocol for communication to the host. Protocol indicates communication diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index e4d0c6679b..b03913446a 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 "2025-04-18" + #define STRING_DISTRIBUTION_DATE "2025-04-19" #endif /** From d009c48b11d65897b7432a089c829c6ef2adee53 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sat, 19 Apr 2025 12:43:31 +1200 Subject: [PATCH 31/86] =?UTF-8?q?=E2=9C=A8=20Simulator:=20Virtual=20servos?= =?UTF-8?q?,=20BLTouch=20(#27779)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Christopher Pepper --- Marlin/src/HAL/NATIVE_SIM/HAL.h | 10 +- Marlin/src/HAL/NATIVE_SIM/Servo.cpp | 104 ++++++++++++++++++ Marlin/src/HAL/NATIVE_SIM/Servo.h | 48 ++++++++ .../src/HAL/NATIVE_SIM/endstop_interrupts.h | 30 +++++ Marlin/src/HAL/NATIVE_SIM/servo_private.h | 79 ------------- Marlin/src/HAL/shared/servo.h | 30 ++--- ini/native.ini | 2 +- 7 files changed, 206 insertions(+), 97 deletions(-) create mode 100644 Marlin/src/HAL/NATIVE_SIM/Servo.cpp create mode 100644 Marlin/src/HAL/NATIVE_SIM/Servo.h create mode 100644 Marlin/src/HAL/NATIVE_SIM/endstop_interrupts.h delete mode 100644 Marlin/src/HAL/NATIVE_SIM/servo_private.h diff --git a/Marlin/src/HAL/NATIVE_SIM/HAL.h b/Marlin/src/HAL/NATIVE_SIM/HAL.h index f741d0b246..ffede7ef34 100644 --- a/Marlin/src/HAL/NATIVE_SIM/HAL.h +++ b/Marlin/src/HAL/NATIVE_SIM/HAL.h @@ -52,7 +52,9 @@ uint8_t _getc(); // ------------------------ #define CPU_32_BIT -#define SHARED_SERVOS HAS_SERVOS // Use shared/servos.cpp + +class Servo; +typedef Servo hal_servo_t; #define F_CPU 100000000 #define SystemCoreClock F_CPU @@ -232,8 +234,10 @@ public: * No option to invert the duty cycle [default = false] * No option to change the scale of the provided value to enable finer PWM duty control [default = 255] */ - static void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t=255, const bool=false) { - analogWrite(pin, v); + static void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size=255, const bool invert=false) { + auto value = map(v, 0, v_size, 0, UINT16_MAX); + value = invert ? UINT16_MAX - value : value; + analogWrite(pin, value); } static void set_pwm_frequency(const pin_t, int) {} diff --git a/Marlin/src/HAL/NATIVE_SIM/Servo.cpp b/Marlin/src/HAL/NATIVE_SIM/Servo.cpp new file mode 100644 index 0000000000..a15eda1bf6 --- /dev/null +++ b/Marlin/src/HAL/NATIVE_SIM/Servo.cpp @@ -0,0 +1,104 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2025 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#include "../platforms.h" + +#ifdef __PLAT_NATIVE_SIM__ + +#include "../../inc/MarlinConfig.h" + +#if HAS_SERVOS + +#include "Servo.h" + +//#define DEBUG_SERVOS +#define DEBUG_OUT ENABLED(DEBUG_SERVOS) +#include "../../../core/debug_out.h" + +uint8_t ServoCount = 0; // the total number of attached servos + +Servo::Servo() { + // Constructor stub + DEBUG_ECHOLNPGM("Debug Servo: constructor"); + this->servoIndex = ServoCount++; // assign a servo index to this instance +} + +uint8_t Servo::attach(int pin) { + // Attach stub + DEBUG_ECHOLNPGM("Debug Servo: attach to pin ", pin, " servo index ", this->servoIndex); + return attach(pin, MIN_PULSE_WIDTH, MAX_PULSE_WIDTH); +} + +uint8_t Servo::attach(int pin, int min, int max) { + // Attach with min and max stub + DEBUG_ECHOLNPGM("Debug Servo: attach to pin ", pin, " with min ", min, " and max ", max); + if (pin > 0) servo_pin = pin; + return this->servoIndex; +} + +void Servo::detach() { + // Detach stub + DEBUG_ECHOLNPGM("Debug Servo: detach"); +} + +// If value is < 200 it is treated as an angle, otherwise as pulse width in microseconds +void Servo::write(int value) { + if (value < MIN_PULSE_WIDTH) { // treat values less than 544 as angles in degrees (valid values in microseconds are handled as microseconds) + value = map(constrain(value, 0, 180), 0, 180, SERVO_MIN_US(min), SERVO_MAX_US(max)); + } + writeMicroseconds(value); + DEBUG_ECHOLNPGM("Debug Servo: write ", value); +} + +void Servo::writeMicroseconds(int value) { + // Simulate the servo movement + this->value = value; + hal.set_pwm_duty(pin_t(this->servo_pin), (float(value) / 20000) * UINT16_MAX, UINT16_MAX); + DEBUG_ECHOLNPGM("Debug Servo: write microseconds ", value); +} + +int Servo::read() { + // Read stub + DEBUG_ECHOLNPGM("Debug Servo: read ", this->value); + return this->value; +} + +int Servo::readMicroseconds() { + // Read microseconds stub + DEBUG_ECHOLNPGM("Debug Servo: read microseconds"); + return 0; +} + +bool Servo::attached() { + // Attached stub + DEBUG_ECHOLNPGM("Debug Servo: attached"); + return false; +} + +int Servo::move(const unsigned char cmd) { + // Move stub + DEBUG_ECHOLNPGM("Debug Servo: move ", cmd); + write(cmd); + return 0; +} + +#endif // HAS_SERVOS +#endif // __PLAT_NATIVE_SIM__ diff --git a/Marlin/src/HAL/NATIVE_SIM/Servo.h b/Marlin/src/HAL/NATIVE_SIM/Servo.h new file mode 100644 index 0000000000..428871142c --- /dev/null +++ b/Marlin/src/HAL/NATIVE_SIM/Servo.h @@ -0,0 +1,48 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2025 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +#define MIN_PULSE_WIDTH 544 // the shortest pulse sent to a servo +#define MAX_PULSE_WIDTH 2400 // the longest pulse sent to a servo +#define DEFAULT_PULSE_WIDTH 1500 // default pulse width when servo is attached +#define SERVO_MIN_US(v) (MIN_PULSE_WIDTH - (v) * 4) // minimum value in uS for this servo +#define SERVO_MAX_US(v) (MAX_PULSE_WIDTH - (v) * 4) // maximum value in uS for this servo + +class Servo { +public: + Servo(); + uint8_t attach(int pin); // Attach the given pin to the next free channel, set pinMode, return channel number or INVALID_SERVO if failure + uint8_t attach(int pin, int min, int max); // As above but also set min and max values for writes. + void detach(); + void write(int value); // If value is < 200 it's treated as an angle, otherwise as pulse width in microseconds + void writeMicroseconds(int value); // Write pulse width in microseconds + int read(); // Return current pulse width as an angle between 0 and 180 degrees + int readMicroseconds(); // Return current pulse width in microseconds for this servo + bool attached(); // Return true if this servo is attached, otherwise false + int move (const unsigned char cmd); +private: + uint8_t servoIndex; // Index into the channel data for this servo + int8_t min; // Minimum is this value times 4 added to MIN_PULSE_WIDTH + int8_t max; // Maximum is this value times 4 added to MAX_PULSE_WIDTH + int value; // Pulse width in microseconds for this servo + int servo_pin = 0; // pin number for this servo +}; diff --git a/Marlin/src/HAL/NATIVE_SIM/endstop_interrupts.h b/Marlin/src/HAL/NATIVE_SIM/endstop_interrupts.h new file mode 100644 index 0000000000..e74c312274 --- /dev/null +++ b/Marlin/src/HAL/NATIVE_SIM/endstop_interrupts.h @@ -0,0 +1,30 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2025 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 + +#error "ENDSTOP_INTERRUPTS_FEATURE is not supported in this simulation environment." + +void setup_endstop_interrupts() { + // This function is a stub for setting up endstop interrupts. + // Since this is a simulation environment, actual hardware interrupts + // are not applicable. Add any necessary simulation-specific logic here. +} diff --git a/Marlin/src/HAL/NATIVE_SIM/servo_private.h b/Marlin/src/HAL/NATIVE_SIM/servo_private.h deleted file mode 100644 index e0eb30ab28..0000000000 --- a/Marlin/src/HAL/NATIVE_SIM/servo_private.h +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#pragma once - -/** - * servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2 - * Copyright (c) 2009 Michael Margolis. All right reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * Based on "servo.h - Interrupt driven Servo library for Arduino using 16 bit timers - - * Version 2 Copyright (c) 2009 Michael Margolis. All right reserved. - * - * The only modification was to update/delete macros to match the LPC176x. - * - */ - -#include - -// Macros -//values in microseconds -#define MIN_PULSE_WIDTH 544 // the shortest pulse sent to a servo -#define MAX_PULSE_WIDTH 2400 // the longest pulse sent to a servo -#define DEFAULT_PULSE_WIDTH 1500 // default pulse width when servo is attached -#define REFRESH_INTERVAL 20000 // minimum time to refresh servos in microseconds - -#define MAX_SERVOS 4 - -#define INVALID_SERVO 255 // flag indicating an invalid servo index - -// Types - -typedef struct { - uint8_t nbr : 8 ; // a pin number from 0 to 254 (255 signals invalid pin) - uint8_t isActive : 1 ; // true if this channel is enabled, pin not pulsed if false -} ServoPin_t; - -typedef struct { - ServoPin_t Pin; - unsigned int pulse_width; // pulse width in microseconds -} ServoInfo_t; - -// Global variables - -extern uint8_t ServoCount; -extern ServoInfo_t servo_info[MAX_SERVOS]; diff --git a/Marlin/src/HAL/shared/servo.h b/Marlin/src/HAL/shared/servo.h index 0101fcb628..85e645146c 100644 --- a/Marlin/src/HAL/shared/servo.h +++ b/Marlin/src/HAL/shared/servo.h @@ -59,7 +59,7 @@ * write() - Sets the servo angle in degrees. (invalid angle that is valid as pulse in microseconds is treated as microseconds) * writeMicroseconds() - Sets the servo pulse width in microseconds * read() - Gets the last written servo pulse width as an angle between 0 and 180. - * readMicroseconds() - Gets the last written servo pulse width in microseconds. (was read_us() in first release) + * readMicroseconds() - Gets the last written servo pulse width in microseconds. * attached() - Returns true if there is a servo attached. * detach() - Stops an attached servos from pulsing its i/o pin. * move(angle) - Sequence of attach(0), write(angle), @@ -86,6 +86,8 @@ #include "../ESP32/Servo.h" #elif defined(__PLAT_RP2040__) #include "../RP2040/Servo.h" +#elif defined(__PLAT_NATIVE_SIM__) + #include "../NATIVE_SIM/Servo.h" #else #include @@ -100,22 +102,22 @@ class Servo { public: Servo(); - int8_t attach(const int pin); // attach the given pin to the next free channel, set pinMode, return channel number (-1 on fail) - int8_t attach(const int pin, const int min, const int max); // as above but also sets min and max values for writes. + int8_t attach(const int pin); // Attach the given pin to the next free channel, set pinMode, return channel number (-1 on fail) + int8_t attach(const int pin, const int min, const int max); // As above but also set min and max values for writes. void detach(); - void write(int value); // if value is < 200 it is treated as an angle, otherwise as pulse width in microseconds - void writeMicroseconds(int value); // write pulse width in microseconds - void move(const int value); // attach the servo, then move to value - // if value is < 200 it is treated as an angle, otherwise as pulse width in microseconds - // if DEACTIVATE_SERVOS_AFTER_MOVE wait SERVO_DELAY, then detach - int read(); // returns current pulse width as an angle between 0 and 180 degrees - int readMicroseconds(); // returns current pulse width in microseconds for this servo (was read_us() in first release) - bool attached(); // return true if this servo is attached, otherwise false + void write(int value); // If value is < 200 it is treated as an angle, otherwise as pulse width in microseconds + void writeMicroseconds(int value); // Write pulse width in microseconds + void move(const int value); // Attach the servo, then move to value + // If value is < 200 it is treated as an angle, otherwise as pulse width in microseconds + // If DEACTIVATE_SERVOS_AFTER_MOVE wait SERVO_DELAY, then detach + int read(); // Return current pulse width as an angle between 0 and 180 degrees + int readMicroseconds(); // Return current pulse width in microseconds for this servo + bool attached(); // Return true if this servo is attached, otherwise false private: - uint8_t servoIndex; // index into the channel data for this servo - int8_t min; // minimum is this value times 4 added to MIN_PULSE_WIDTH - int8_t max; // maximum is this value times 4 added to MAX_PULSE_WIDTH + uint8_t servoIndex; // Index into the channel data for this servo + int8_t min; // Minimum is this value times 4 added to MIN_PULSE_WIDTH + int8_t max; // Maximum is this value times 4 added to MAX_PULSE_WIDTH }; #endif diff --git a/ini/native.ini b/ini/native.ini index 479155a78c..f01e72ca67 100644 --- a/ini/native.ini +++ b/ini/native.ini @@ -58,7 +58,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/afe7c1c293.zip + MarlinSimUI=https://github.com/p3p/MarlinSimUI/archive/6ea016e104.zip Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/c6b319f447.zip LiquidCrystal=https://github.com/p3p/LiquidCrystal/archive/322fb5fc23.zip extra_scripts = ${common.extra_scripts} From d40bf0d6b271baa6cea9181faef8470ac033fd3c Mon Sep 17 00:00:00 2001 From: B Date: Fri, 18 Apr 2025 17:53:18 -0700 Subject: [PATCH 32/86] =?UTF-8?q?=F0=9F=90=9B=20Fix=20GD32=20ignoring=20SE?= =?UTF-8?q?RIAL=5FDMA=20on=20init=20(#27800)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/GD32_MFL/MarlinSerial.cpp | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/Marlin/src/HAL/GD32_MFL/MarlinSerial.cpp b/Marlin/src/HAL/GD32_MFL/MarlinSerial.cpp index c9b76a4ca4..271247295c 100644 --- a/Marlin/src/HAL/GD32_MFL/MarlinSerial.cpp +++ b/Marlin/src/HAL/GD32_MFL/MarlinSerial.cpp @@ -60,10 +60,9 @@ MarlinSerial& MarlinSerial::get_instance(usart::USART_Base Base, pin_size_t rxPi static MarlinSerial* current_serial_instance = nullptr; static void emergency_callback() { - if (current_serial_instance) { - uint8_t last_data = current_serial_instance->get_last_data(); - emergency_parser.update(current_serial_instance->emergency_state, last_data); - } + if (!current_serial_instance) return; + const uint8_t last_data = current_serial_instance->get_last_data(); + emergency_parser.update(current_serial_instance->emergency_state, last_data); } void MarlinSerial::register_emergency_callback(void (*callback)()) { @@ -72,26 +71,23 @@ MarlinSerial& MarlinSerial::get_instance(usart::USART_Base Base, pin_size_t rxPi #endif void MarlinSerial::begin(unsigned long baudrate, uint16_t config) { - UsartSerial::begin(baudrate, config); - #if DISABLED(SERIAL_DMA) - #if ENABLED(EMERGENCY_PARSER) - current_serial_instance = this; - register_emergency_callback(emergency_callback); - #endif + UsartSerial::begin(baudrate, config, ENABLED(SERIAL_DMA)); + #if ENABLED(EMERGENCY_PARSER) && DISABLED(SERIAL_DMA) + current_serial_instance = this; + register_emergency_callback(emergency_callback); #endif } void MarlinSerial::updateRxDmaBuffer() { #if ENABLED(EMERGENCY_PARSER) // Get the number of bytes available in the receive buffer - size_t available_bytes = usart_.available_for_read(true); - uint8_t data; + const size_t available_bytes = usart_.available_for_read(true); // Process only the available data for (size_t i = 0; i < available_bytes; ++i) { - if (usart_.read_rx_buffer(data)) { + uint8_t data; + if (usart_.read_rx_buffer(data)) emergency_parser.update(emergency_state, data); - } } #endif // Call the base class implementation to handle any additional updates From 067c830e840b69f04b7ce9f9d9a647cdf58090e1 Mon Sep 17 00:00:00 2001 From: B Date: Fri, 18 Apr 2025 17:55:26 -0700 Subject: [PATCH 33/86] =?UTF-8?q?=F0=9F=93=8C=20GD32=20platform=20v1.0.3?= =?UTF-8?q?=20(and=20Arduino=20v1.0.4)=20(#27801)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ini/gd32.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ini/gd32.ini b/ini/gd32.ini index e983f496ec..5187895021 100644 --- a/ini/gd32.ini +++ b/ini/gd32.ini @@ -10,7 +10,7 @@ #################################### [gd32_base] -platform = https://github.com/bmourit/platform-mfl/archive/refs/tags/V1.0.2.zip +platform = https://github.com/bmourit/platform-mfl/archive/refs/tags/V1.0.3.zip board_build.core = gd32 build_src_filter = ${common.default_src_filter} + + build_unflags = -std=gnu++11 -std=gnu++14 -std=gnu++17 From 26b3f0b00f897a0624fd96d064f50cb3cf54d3b2 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 18 Apr 2025 19:56:46 -0500 Subject: [PATCH 34/86] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Plann?= =?UTF-8?q?er::max=5Fjerk=20always=20xyze=5Fpos=5Ft?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/planner.cpp | 2 +- Marlin/src/module/planner.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index b3df490cf0..881e11f4c0 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -157,7 +157,7 @@ uint32_t Planner::max_acceleration_steps_per_s2[DISTINCT_AXES]; // (steps/s^2) D float Planner::max_e_jerk[DISTINCT_E]; // Calculated from junction_deviation_mm #endif #else // CLASSIC_JERK - TERN(HAS_LINEAR_E_JERK, xyz_pos_t, xyze_pos_t) Planner::max_jerk; + xyze_pos_t Planner::max_jerk; #endif #if ENABLED(SD_ABORT_ON_ENDSTOP_HIT) diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index 318be33131..e8bacddd9f 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -494,7 +494,7 @@ class Planner { #endif #else // CLASSIC_JERK // (mm/s^2) M205 XYZ(E) - The largest speed change requiring no acceleration. - static TERN(HAS_LINEAR_E_JERK, xyz_pos_t, xyze_pos_t) max_jerk; + static xyze_pos_t max_jerk; #endif #if HAS_LEVELING From 87f26e77ff2180fc487e2547487915eee4d526cd Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sun, 20 Apr 2025 00:33:22 +0000 Subject: [PATCH 35/86] [cron] Bump distribution date (2025-04-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 bf36617e2c..85663d4899 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 "2025-04-19" +//#define STRING_DISTRIBUTION_DATE "2025-04-20" /** * The protocol for communication to the host. Protocol indicates communication diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index b03913446a..f46988c11b 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 "2025-04-19" + #define STRING_DISTRIBUTION_DATE "2025-04-20" #endif /** From b97b09413f1cd805743240a1f3f0c94f4a10d1e2 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 19 Apr 2025 20:04:59 -0500 Subject: [PATCH 36/86] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Add?= =?UTF-8?q?=20stepper/control.cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/DUE/fastio/G2_PWM.cpp | 3 +- Marlin/src/HAL/DUE/fastio/G2_PWM.h | 5 +- Marlin/src/inc/Conditionals-5-post.h | 4 + Marlin/src/module/stepper.cpp | 735 --------------------- Marlin/src/module/stepper/control.cpp | 764 ++++++++++++++++++++++ Marlin/src/pins/sam/pins_PRINTRBOARD_G2.h | 8 +- ini/features.ini | 1 + 7 files changed, 776 insertions(+), 744 deletions(-) create mode 100644 Marlin/src/module/stepper/control.cpp diff --git a/Marlin/src/HAL/DUE/fastio/G2_PWM.cpp b/Marlin/src/HAL/DUE/fastio/G2_PWM.cpp index 403e3356e1..745e4205bc 100644 --- a/Marlin/src/HAL/DUE/fastio/G2_PWM.cpp +++ b/Marlin/src/HAL/DUE/fastio/G2_PWM.cpp @@ -40,11 +40,12 @@ * Some jitter in the Vref signal is OK so the interrupt priority is left at its default value. */ -#include "../../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfigPre.h" #if MB(PRINTRBOARD_G2) #include "G2_PWM.h" +#include "../../../module/stepper.h" #if PIN_EXISTS(MOTOR_CURRENT_PWM_X) #define G2_PWM_X 1 diff --git a/Marlin/src/HAL/DUE/fastio/G2_PWM.h b/Marlin/src/HAL/DUE/fastio/G2_PWM.h index 054eb2cf80..7fb2aaf7a8 100644 --- a/Marlin/src/HAL/DUE/fastio/G2_PWM.h +++ b/Marlin/src/HAL/DUE/fastio/G2_PWM.h @@ -26,10 +26,7 @@ * PR #7500. It is hardwired for the PRINTRBOARD_G2 Motor Current needs. */ -#include "../../../inc/MarlinConfigPre.h" -#include "../../../module/stepper.h" -//C:\Users\bobku\Documents\GitHub\Marlin-Bob-2\Marlin\src\module\stepper.h -//C:\Users\bobku\Documents\GitHub\Marlin-Bob-2\Marlin\src\HAL\HAL_DUE\G2_PWM.h +#include #define PWM_PERIOD_US 100 // base repetition rate in micro seconds diff --git a/Marlin/src/inc/Conditionals-5-post.h b/Marlin/src/inc/Conditionals-5-post.h index 380e8e6071..920031dcdb 100644 --- a/Marlin/src/inc/Conditionals-5-post.h +++ b/Marlin/src/inc/Conditionals-5-post.h @@ -3012,6 +3012,10 @@ #undef MICROSTEP_MODES #endif +#if MB(PRINTRBOARD_G2) || ANY(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_PWM, HAS_MICROSTEPS) + #define HAS_STEPPER_CONTROL 1 +#endif + /** * Helper Macros for heaters and extruder fan */ diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 85c7521960..1340cd9157 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -3627,738 +3627,3 @@ void Stepper::report_positions() { } #endif // BABYSTEPPING - -/** - * Software-controlled Stepper Motor Current - */ - -#if HAS_MOTOR_CURRENT_SPI - - // From Arduino DigitalPotControl example - void Stepper::set_digipot_value_spi(const int16_t address, const int16_t value) { - WRITE(DIGIPOTSS_PIN, LOW); // Take the SS pin low to select the chip - SPI.transfer(address); // Send the address and value via SPI - SPI.transfer(value); - WRITE(DIGIPOTSS_PIN, HIGH); // Take the SS pin high to de-select the chip - //delay(10); - } - -#endif // HAS_MOTOR_CURRENT_SPI - -#if HAS_MOTOR_CURRENT_PWM - - void Stepper::refresh_motor_power() { - if (!initialized) return; - 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: - #endif - #if HAS_MOTOR_CURRENT_PWM_Z - case 1: - #endif - #if HAS_MOTOR_CURRENT_PWM_E - case 2: - #endif - set_digipot_current(i, motor_current_setting[i]); - default: break; - } - } - } - -#endif // HAS_MOTOR_CURRENT_PWM - -#if !MB(PRINTRBOARD_G2) - - #if HAS_MOTOR_CURRENT_SPI || HAS_MOTOR_CURRENT_PWM - - void Stepper::set_digipot_current(const uint8_t driver, const int16_t current) { - if (WITHIN(driver, 0, COUNT(motor_current_setting) - 1)) - motor_current_setting[driver] = current; // update motor_current_setting - - if (!initialized) return; - - #if HAS_MOTOR_CURRENT_SPI - - //SERIAL_ECHOLNPGM("Digipotss current ", current); - - const uint8_t digipot_ch[] = DIGIPOT_CHANNELS; - set_digipot_value_spi(digipot_ch[driver], current); - - #elif HAS_MOTOR_CURRENT_PWM - - #define _WRITE_CURRENT_PWM(P) hal.set_pwm_duty(pin_t(MOTOR_CURRENT_PWM_## P ##_PIN), 255L * current / (MOTOR_CURRENT_PWM_RANGE)) - switch (driver) { - case 0: - #if PIN_EXISTS(MOTOR_CURRENT_PWM_X) - _WRITE_CURRENT_PWM(X); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_Y) - _WRITE_CURRENT_PWM(Y); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) - _WRITE_CURRENT_PWM(XY); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_I) - _WRITE_CURRENT_PWM(I); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_J) - _WRITE_CURRENT_PWM(J); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_K) - _WRITE_CURRENT_PWM(K); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_U) - _WRITE_CURRENT_PWM(U); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_V) - _WRITE_CURRENT_PWM(V); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_W) - _WRITE_CURRENT_PWM(W); - #endif - break; - case 1: - #if HAS_MOTOR_CURRENT_PWM_Z - _WRITE_CURRENT_PWM(Z); - #endif - break; - case 2: - #if PIN_EXISTS(MOTOR_CURRENT_PWM_E) - _WRITE_CURRENT_PWM(E); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_E0) - _WRITE_CURRENT_PWM(E0); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_E1) - _WRITE_CURRENT_PWM(E1); - #endif - break; - } - #endif - } - - void Stepper::digipot_init() { - - #if HAS_MOTOR_CURRENT_SPI - - SPI.begin(); - SET_OUTPUT(DIGIPOTSS_PIN); - - for (uint8_t i = 0; i < COUNT(motor_current_setting); ++i) - set_digipot_current(i, motor_current_setting[i]); - - #elif HAS_MOTOR_CURRENT_PWM - - #ifdef __SAM3X8E__ - #define _RESET_CURRENT_PWM_FREQ(P) NOOP - #else - #define _RESET_CURRENT_PWM_FREQ(P) hal.set_pwm_frequency(pin_t(P), MOTOR_CURRENT_PWM_FREQUENCY) - #endif - #define INIT_CURRENT_PWM(P) do{ SET_PWM(MOTOR_CURRENT_PWM_## P ##_PIN); _RESET_CURRENT_PWM_FREQ(MOTOR_CURRENT_PWM_## P ##_PIN); }while(0) - - #if PIN_EXISTS(MOTOR_CURRENT_PWM_X) - INIT_CURRENT_PWM(X); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_Y) - INIT_CURRENT_PWM(Y); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) - INIT_CURRENT_PWM(XY); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_I) - INIT_CURRENT_PWM(I); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_J) - INIT_CURRENT_PWM(J); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_K) - INIT_CURRENT_PWM(K); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_U) - INIT_CURRENT_PWM(U); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_V) - INIT_CURRENT_PWM(V); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_W) - INIT_CURRENT_PWM(W); - #endif - #if HAS_MOTOR_CURRENT_PWM_Z - INIT_CURRENT_PWM(Z); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_E) - INIT_CURRENT_PWM(E); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_E0) - INIT_CURRENT_PWM(E0); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_E1) - INIT_CURRENT_PWM(E1); - #endif - - refresh_motor_power(); - - #endif - } - - #endif - -#else // PRINTRBOARD_G2 - - #include HAL_PATH(.., fastio/G2_PWM.h) - -#endif - -#if HAS_MICROSTEPS - - /** - * Software-controlled Microstepping - */ - - void Stepper::microstep_init() { - #if HAS_X_MS_PINS - SET_OUTPUT(X_MS1_PIN); SET_OUTPUT(X_MS2_PIN); - #if PIN_EXISTS(X_MS3) - SET_OUTPUT(X_MS3_PIN); - #endif - #endif - #if HAS_X2_MS_PINS - SET_OUTPUT(X2_MS1_PIN); SET_OUTPUT(X2_MS2_PIN); - #if PIN_EXISTS(X2_MS3) - SET_OUTPUT(X2_MS3_PIN); - #endif - #endif - #if HAS_Y_MS_PINS - SET_OUTPUT(Y_MS1_PIN); SET_OUTPUT(Y_MS2_PIN); - #if PIN_EXISTS(Y_MS3) - SET_OUTPUT(Y_MS3_PIN); - #endif - #endif - #if HAS_Y2_MS_PINS - SET_OUTPUT(Y2_MS1_PIN); SET_OUTPUT(Y2_MS2_PIN); - #if PIN_EXISTS(Y2_MS3) - SET_OUTPUT(Y2_MS3_PIN); - #endif - #endif - #if HAS_Z_MS_PINS - SET_OUTPUT(Z_MS1_PIN); SET_OUTPUT(Z_MS2_PIN); - #if PIN_EXISTS(Z_MS3) - SET_OUTPUT(Z_MS3_PIN); - #endif - #endif - #if HAS_Z2_MS_PINS - SET_OUTPUT(Z2_MS1_PIN); SET_OUTPUT(Z2_MS2_PIN); - #if PIN_EXISTS(Z2_MS3) - SET_OUTPUT(Z2_MS3_PIN); - #endif - #endif - #if HAS_Z3_MS_PINS - SET_OUTPUT(Z3_MS1_PIN); SET_OUTPUT(Z3_MS2_PIN); - #if PIN_EXISTS(Z3_MS3) - SET_OUTPUT(Z3_MS3_PIN); - #endif - #endif - #if HAS_Z4_MS_PINS - SET_OUTPUT(Z4_MS1_PIN); SET_OUTPUT(Z4_MS2_PIN); - #if PIN_EXISTS(Z4_MS3) - SET_OUTPUT(Z4_MS3_PIN); - #endif - #endif - #if HAS_I_MS_PINS - SET_OUTPUT(I_MS1_PIN); SET_OUTPUT(I_MS2_PIN); - #if PIN_EXISTS(I_MS3) - SET_OUTPUT(I_MS3_PIN); - #endif - #endif - #if HAS_J_MS_PINS - SET_OUTPUT(J_MS1_PIN); SET_OUTPUT(J_MS2_PIN); - #if PIN_EXISTS(J_MS3) - SET_OUTPUT(J_MS3_PIN); - #endif - #endif - #if HAS_K_MS_PINS - SET_OUTPUT(K_MS1_PIN); SET_OUTPUT(K_MS2_PIN); - #if PIN_EXISTS(K_MS3) - SET_OUTPUT(K_MS3_PIN); - #endif - #endif - #if HAS_U_MS_PINS - SET_OUTPUT(U_MS1_PIN); SET_OUTPUT(U_MS2_PIN); - #if PIN_EXISTS(U_MS3) - SET_OUTPUT(U_MS3_PIN); - #endif - #endif - #if HAS_V_MS_PINS - SET_OUTPUT(V_MS1_PIN); SET_OUTPUT(V_MS2_PIN); - #if PIN_EXISTS(V_MS3) - SET_OUTPUT(V_MS3_PIN); - #endif - #endif - #if HAS_W_MS_PINS - SET_OUTPUT(W_MS1_PIN); SET_OUTPUT(W_MS2_PIN); - #if PIN_EXISTS(W_MS3) - SET_OUTPUT(W_MS3_PIN); - #endif - #endif - #if HAS_E0_MS_PINS - SET_OUTPUT(E0_MS1_PIN); SET_OUTPUT(E0_MS2_PIN); - #if PIN_EXISTS(E0_MS3) - SET_OUTPUT(E0_MS3_PIN); - #endif - #endif - #if HAS_E1_MS_PINS - SET_OUTPUT(E1_MS1_PIN); SET_OUTPUT(E1_MS2_PIN); - #if PIN_EXISTS(E1_MS3) - SET_OUTPUT(E1_MS3_PIN); - #endif - #endif - #if HAS_E2_MS_PINS - SET_OUTPUT(E2_MS1_PIN); SET_OUTPUT(E2_MS2_PIN); - #if PIN_EXISTS(E2_MS3) - SET_OUTPUT(E2_MS3_PIN); - #endif - #endif - #if HAS_E3_MS_PINS - SET_OUTPUT(E3_MS1_PIN); SET_OUTPUT(E3_MS2_PIN); - #if PIN_EXISTS(E3_MS3) - SET_OUTPUT(E3_MS3_PIN); - #endif - #endif - #if HAS_E4_MS_PINS - SET_OUTPUT(E4_MS1_PIN); SET_OUTPUT(E4_MS2_PIN); - #if PIN_EXISTS(E4_MS3) - SET_OUTPUT(E4_MS3_PIN); - #endif - #endif - #if HAS_E5_MS_PINS - SET_OUTPUT(E5_MS1_PIN); SET_OUTPUT(E5_MS2_PIN); - #if PIN_EXISTS(E5_MS3) - SET_OUTPUT(E5_MS3_PIN); - #endif - #endif - #if HAS_E6_MS_PINS - SET_OUTPUT(E6_MS1_PIN); SET_OUTPUT(E6_MS2_PIN); - #if PIN_EXISTS(E6_MS3) - SET_OUTPUT(E6_MS3_PIN); - #endif - #endif - #if HAS_E7_MS_PINS - SET_OUTPUT(E7_MS1_PIN); SET_OUTPUT(E7_MS2_PIN); - #if PIN_EXISTS(E7_MS3) - SET_OUTPUT(E7_MS3_PIN); - #endif - #endif - - static const uint8_t microstep_modes[] = MICROSTEP_MODES; - for (uint16_t i = 0; i < COUNT(microstep_modes); i++) - microstep_mode(i, microstep_modes[i]); - } - - void Stepper::microstep_ms(const uint8_t driver, const int8_t ms1, const int8_t ms2, const int8_t ms3) { - if (ms1 >= 0) switch (driver) { - #if HAS_X_MS_PINS || HAS_X2_MS_PINS - case X_AXIS: - #if HAS_X_MS_PINS - WRITE(X_MS1_PIN, ms1); - #endif - #if HAS_X2_MS_PINS - WRITE(X2_MS1_PIN, ms1); - #endif - break; - #endif - #if HAS_Y_MS_PINS || HAS_Y2_MS_PINS - case Y_AXIS: - #if HAS_Y_MS_PINS - WRITE(Y_MS1_PIN, ms1); - #endif - #if HAS_Y2_MS_PINS - WRITE(Y2_MS1_PIN, ms1); - #endif - break; - #endif - #if HAS_SOME_Z_MS_PINS - case Z_AXIS: - #if HAS_Z_MS_PINS - WRITE(Z_MS1_PIN, ms1); - #endif - #if HAS_Z2_MS_PINS - WRITE(Z2_MS1_PIN, ms1); - #endif - #if HAS_Z3_MS_PINS - WRITE(Z3_MS1_PIN, ms1); - #endif - #if HAS_Z4_MS_PINS - WRITE(Z4_MS1_PIN, ms1); - #endif - break; - #endif - #if HAS_I_MS_PINS - case I_AXIS: WRITE(I_MS1_PIN, ms1); break; - #endif - #if HAS_J_MS_PINS - case J_AXIS: WRITE(J_MS1_PIN, ms1); break; - #endif - #if HAS_K_MS_PINS - case K_AXIS: WRITE(K_MS1_PIN, ms1); break; - #endif - #if HAS_U_MS_PINS - case U_AXIS: WRITE(U_MS1_PIN, ms1); break; - #endif - #if HAS_V_MS_PINS - case V_AXIS: WRITE(V_MS1_PIN, ms1); break; - #endif - #if HAS_W_MS_PINS - case W_AXIS: WRITE(W_MS1_PIN, ms1); break; - #endif - #if HAS_E0_MS_PINS - case E_AXIS: WRITE(E0_MS1_PIN, ms1); break; - #endif - #if HAS_E1_MS_PINS - case (E_AXIS + 1): WRITE(E1_MS1_PIN, ms1); break; - #endif - #if HAS_E2_MS_PINS - case (E_AXIS + 2): WRITE(E2_MS1_PIN, ms1); break; - #endif - #if HAS_E3_MS_PINS - case (E_AXIS + 3): WRITE(E3_MS1_PIN, ms1); break; - #endif - #if HAS_E4_MS_PINS - case (E_AXIS + 4): WRITE(E4_MS1_PIN, ms1); break; - #endif - #if HAS_E5_MS_PINS - case (E_AXIS + 5): WRITE(E5_MS1_PIN, ms1); break; - #endif - #if HAS_E6_MS_PINS - case (E_AXIS + 6): WRITE(E6_MS1_PIN, ms1); break; - #endif - #if HAS_E7_MS_PINS - case (E_AXIS + 7): WRITE(E7_MS1_PIN, ms1); break; - #endif - } - if (ms2 >= 0) switch (driver) { - #if HAS_X_MS_PINS || HAS_X2_MS_PINS - case X_AXIS: - #if HAS_X_MS_PINS - WRITE(X_MS2_PIN, ms2); - #endif - #if HAS_X2_MS_PINS - WRITE(X2_MS2_PIN, ms2); - #endif - break; - #endif - #if HAS_Y_MS_PINS || HAS_Y2_MS_PINS - case Y_AXIS: - #if HAS_Y_MS_PINS - WRITE(Y_MS2_PIN, ms2); - #endif - #if HAS_Y2_MS_PINS - WRITE(Y2_MS2_PIN, ms2); - #endif - break; - #endif - #if HAS_SOME_Z_MS_PINS - case Z_AXIS: - #if HAS_Z_MS_PINS - WRITE(Z_MS2_PIN, ms2); - #endif - #if HAS_Z2_MS_PINS - WRITE(Z2_MS2_PIN, ms2); - #endif - #if HAS_Z3_MS_PINS - WRITE(Z3_MS2_PIN, ms2); - #endif - #if HAS_Z4_MS_PINS - WRITE(Z4_MS2_PIN, ms2); - #endif - break; - #endif - #if HAS_I_MS_PINS - case I_AXIS: WRITE(I_MS2_PIN, ms2); break; - #endif - #if HAS_J_MS_PINS - case J_AXIS: WRITE(J_MS2_PIN, ms2); break; - #endif - #if HAS_K_MS_PINS - case K_AXIS: WRITE(K_MS2_PIN, ms2); break; - #endif - #if HAS_U_MS_PINS - case U_AXIS: WRITE(U_MS2_PIN, ms2); break; - #endif - #if HAS_V_MS_PINS - case V_AXIS: WRITE(V_MS2_PIN, ms2); break; - #endif - #if HAS_W_MS_PINS - case W_AXIS: WRITE(W_MS2_PIN, ms2); break; - #endif - #if HAS_E0_MS_PINS - case E_AXIS: WRITE(E0_MS2_PIN, ms2); break; - #endif - #if HAS_E1_MS_PINS - case (E_AXIS + 1): WRITE(E1_MS2_PIN, ms2); break; - #endif - #if HAS_E2_MS_PINS - case (E_AXIS + 2): WRITE(E2_MS2_PIN, ms2); break; - #endif - #if HAS_E3_MS_PINS - case (E_AXIS + 3): WRITE(E3_MS2_PIN, ms2); break; - #endif - #if HAS_E4_MS_PINS - case (E_AXIS + 4): WRITE(E4_MS2_PIN, ms2); break; - #endif - #if HAS_E5_MS_PINS - case (E_AXIS + 5): WRITE(E5_MS2_PIN, ms2); break; - #endif - #if HAS_E6_MS_PINS - case (E_AXIS + 6): WRITE(E6_MS2_PIN, ms2); break; - #endif - #if HAS_E7_MS_PINS - case (E_AXIS + 7): WRITE(E7_MS2_PIN, ms2); break; - #endif - } - if (ms3 >= 0) switch (driver) { - #if HAS_X_MS_PINS || HAS_X2_MS_PINS - case X_AXIS: - #if HAS_X_MS_PINS && PIN_EXISTS(X_MS3) - WRITE(X_MS3_PIN, ms3); - #endif - #if HAS_X2_MS_PINS && PIN_EXISTS(X2_MS3) - WRITE(X2_MS3_PIN, ms3); - #endif - break; - #endif - #if HAS_Y_MS_PINS || HAS_Y2_MS_PINS - case Y_AXIS: - #if HAS_Y_MS_PINS && PIN_EXISTS(Y_MS3) - WRITE(Y_MS3_PIN, ms3); - #endif - #if HAS_Y2_MS_PINS && PIN_EXISTS(Y2_MS3) - WRITE(Y2_MS3_PIN, ms3); - #endif - break; - #endif - #if HAS_SOME_Z_MS_PINS - case Z_AXIS: - #if HAS_Z_MS_PINS && PIN_EXISTS(Z_MS3) - WRITE(Z_MS3_PIN, ms3); - #endif - #if HAS_Z2_MS_PINS && PIN_EXISTS(Z2_MS3) - WRITE(Z2_MS3_PIN, ms3); - #endif - #if HAS_Z3_MS_PINS && PIN_EXISTS(Z3_MS3) - WRITE(Z3_MS3_PIN, ms3); - #endif - #if HAS_Z4_MS_PINS && PIN_EXISTS(Z4_MS3) - WRITE(Z4_MS3_PIN, ms3); - #endif - break; - #endif - #if HAS_I_MS_PINS && PIN_EXISTS(I_MS3) - case I_AXIS: WRITE(I_MS3_PIN, ms3); break; - #endif - #if HAS_J_MS_PINS && PIN_EXISTS(J_MS3) - case J_AXIS: WRITE(J_MS3_PIN, ms3); break; - #endif - #if HAS_K_MS_PINS && PIN_EXISTS(K_MS3) - case K_AXIS: WRITE(K_MS3_PIN, ms3); break; - #endif - #if HAS_U_MS_PINS && PIN_EXISTS(U_MS3) - case U_AXIS: WRITE(U_MS3_PIN, ms3); break; - #endif - #if HAS_V_MS_PINS && PIN_EXISTS(V_MS3) - case V_AXIS: WRITE(V_MS3_PIN, ms3); break; - #endif - #if HAS_W_MS_PINS && PIN_EXISTS(W_MS3) - case W_AXIS: WRITE(W_MS3_PIN, ms3); break; - #endif - #if HAS_E0_MS_PINS && PIN_EXISTS(E0_MS3) - case E_AXIS: WRITE(E0_MS3_PIN, ms3); break; - #endif - #if HAS_E1_MS_PINS && PIN_EXISTS(E1_MS3) - case (E_AXIS + 1): WRITE(E1_MS3_PIN, ms3); break; - #endif - #if HAS_E2_MS_PINS && PIN_EXISTS(E2_MS3) - case (E_AXIS + 2): WRITE(E2_MS3_PIN, ms3); break; - #endif - #if HAS_E3_MS_PINS && PIN_EXISTS(E3_MS3) - case (E_AXIS + 3): WRITE(E3_MS3_PIN, ms3); break; - #endif - #if HAS_E4_MS_PINS && PIN_EXISTS(E4_MS3) - case (E_AXIS + 4): WRITE(E4_MS3_PIN, ms3); break; - #endif - #if HAS_E5_MS_PINS && PIN_EXISTS(E5_MS3) - case (E_AXIS + 5): WRITE(E5_MS3_PIN, ms3); break; - #endif - #if HAS_E6_MS_PINS && PIN_EXISTS(E6_MS3) - case (E_AXIS + 6): WRITE(E6_MS3_PIN, ms3); break; - #endif - #if HAS_E7_MS_PINS && PIN_EXISTS(E7_MS3) - case (E_AXIS + 7): WRITE(E7_MS3_PIN, ms3); break; - #endif - } - } - - // MS1 MS2 MS3 Stepper Driver Microstepping mode table - #ifndef MICROSTEP1 - #define MICROSTEP1 LOW,LOW,LOW - #endif - #if ENABLED(HEROIC_STEPPER_DRIVERS) - #ifndef MICROSTEP128 - #define MICROSTEP128 LOW,HIGH,LOW - #endif - #else - #ifndef MICROSTEP2 - #define MICROSTEP2 HIGH,LOW,LOW - #endif - #ifndef MICROSTEP4 - #define MICROSTEP4 LOW,HIGH,LOW - #endif - #endif - #ifndef MICROSTEP8 - #define MICROSTEP8 HIGH,HIGH,LOW - #endif - #ifndef MICROSTEP16 - #define MICROSTEP16 HIGH,HIGH,LOW - #endif - - void Stepper::microstep_mode(const uint8_t driver, const uint8_t stepping_mode) { - switch (stepping_mode) { - #ifdef MICROSTEP1 - case 1: microstep_ms(driver, MICROSTEP1); break; - #endif - #ifdef MICROSTEP2 - case 2: microstep_ms(driver, MICROSTEP2); break; - #endif - #ifdef MICROSTEP4 - case 4: microstep_ms(driver, MICROSTEP4); break; - #endif - #ifdef MICROSTEP8 - case 8: microstep_ms(driver, MICROSTEP8); break; - #endif - #ifdef MICROSTEP16 - case 16: microstep_ms(driver, MICROSTEP16); break; - #endif - #ifdef MICROSTEP32 - case 32: microstep_ms(driver, MICROSTEP32); break; - #endif - #ifdef MICROSTEP64 - case 64: microstep_ms(driver, MICROSTEP64); break; - #endif - #ifdef MICROSTEP128 - case 128: microstep_ms(driver, MICROSTEP128); break; - #endif - - default: SERIAL_ERROR_MSG("Microsteps unavailable"); break; - } - } - - void Stepper::microstep_readings() { - #define PIN_CHAR(P) SERIAL_CHAR('0' + READ(P##_PIN)) - #define MS_LINE(A) do{ SERIAL_ECHOPGM(" " STRINGIFY(A) ":"); PIN_CHAR(A##_MS1); PIN_CHAR(A##_MS2); }while(0) - SERIAL_ECHOPGM("MS1|2|3 Pins"); - #if HAS_X_MS_PINS - MS_LINE(X); - #if PIN_EXISTS(X_MS3) - PIN_CHAR(X_MS3); - #endif - #endif - #if HAS_Y_MS_PINS - MS_LINE(Y); - #if PIN_EXISTS(Y_MS3) - PIN_CHAR(Y_MS3); - #endif - #endif - #if HAS_Z_MS_PINS - MS_LINE(Z); - #if PIN_EXISTS(Z_MS3) - PIN_CHAR(Z_MS3); - #endif - #endif - #if HAS_I_MS_PINS - MS_LINE(I); - #if PIN_EXISTS(I_MS3) - PIN_CHAR(I_MS3); - #endif - #endif - #if HAS_J_MS_PINS - MS_LINE(J); - #if PIN_EXISTS(J_MS3) - PIN_CHAR(J_MS3); - #endif - #endif - #if HAS_K_MS_PINS - MS_LINE(K); - #if PIN_EXISTS(K_MS3) - PIN_CHAR(K_MS3); - #endif - #endif - #if HAS_U_MS_PINS - MS_LINE(U); - #if PIN_EXISTS(U_MS3) - PIN_CHAR(U_MS3); - #endif - #endif - #if HAS_V_MS_PINS - MS_LINE(V); - #if PIN_EXISTS(V_MS3) - PIN_CHAR(V_MS3); - #endif - #endif - #if HAS_W_MS_PINS - MS_LINE(W); - #if PIN_EXISTS(W_MS3) - PIN_CHAR(W_MS3); - #endif - #endif - #if HAS_E0_MS_PINS - MS_LINE(E0); - #if PIN_EXISTS(E0_MS3) - PIN_CHAR(E0_MS3); - #endif - #endif - #if HAS_E1_MS_PINS - MS_LINE(E1); - #if PIN_EXISTS(E1_MS3) - PIN_CHAR(E1_MS3); - #endif - #endif - #if HAS_E2_MS_PINS - MS_LINE(E2); - #if PIN_EXISTS(E2_MS3) - PIN_CHAR(E2_MS3); - #endif - #endif - #if HAS_E3_MS_PINS - MS_LINE(E3); - #if PIN_EXISTS(E3_MS3) - PIN_CHAR(E3_MS3); - #endif - #endif - #if HAS_E4_MS_PINS - MS_LINE(E4); - #if PIN_EXISTS(E4_MS3) - PIN_CHAR(E4_MS3); - #endif - #endif - #if HAS_E5_MS_PINS - MS_LINE(E5); - #if PIN_EXISTS(E5_MS3) - PIN_CHAR(E5_MS3); - #endif - #endif - #if HAS_E6_MS_PINS - MS_LINE(E6); - #if PIN_EXISTS(E6_MS3) - PIN_CHAR(E6_MS3); - #endif - #endif - #if HAS_E7_MS_PINS - MS_LINE(E7); - #if PIN_EXISTS(E7_MS3) - PIN_CHAR(E7_MS3); - #endif - #endif - SERIAL_EOL(); - } - -#endif // HAS_MICROSTEPS diff --git a/Marlin/src/module/stepper/control.cpp b/Marlin/src/module/stepper/control.cpp new file mode 100644 index 0000000000..0d523c8ed5 --- /dev/null +++ b/Marlin/src/module/stepper/control.cpp @@ -0,0 +1,764 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2025 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 . + * + */ + +/** + * stepper/control.cpp + * Control for Stepper Motor Current and Driver Micro-stepping + * (other than Trinamic UART / SPI). + */ + +#include "../stepper.h" + +#if MB(PRINTRBOARD_G2) + #include HAL_PATH(../.., fastio/G2_PWM.h) +#endif + +/** + * Software-controlled Stepper Motor Current + */ + +#if HAS_MOTOR_CURRENT_SPI + + // From Arduino DigitalPotControl example + void Stepper::set_digipot_value_spi(const int16_t address, const int16_t value) { + WRITE(DIGIPOTSS_PIN, LOW); // Take the SS pin low to select the chip + SPI.transfer(address); // Send the address and value via SPI + SPI.transfer(value); + WRITE(DIGIPOTSS_PIN, HIGH); // Take the SS pin high to de-select the chip + //delay(10); + } + +#endif // HAS_MOTOR_CURRENT_SPI + +#if HAS_MOTOR_CURRENT_PWM + + void Stepper::refresh_motor_power() { + if (!initialized) return; + 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: + #endif + #if HAS_MOTOR_CURRENT_PWM_Z + case 1: + #endif + #if HAS_MOTOR_CURRENT_PWM_E + case 2: + #endif + set_digipot_current(i, motor_current_setting[i]); + default: break; + } + } + } + +#endif // HAS_MOTOR_CURRENT_PWM + +/** + * PWM-controlled Stepper Motor Current + */ + +#if !MB(PRINTRBOARD_G2) && (HAS_MOTOR_CURRENT_SPI || HAS_MOTOR_CURRENT_PWM) + + void Stepper::set_digipot_current(const uint8_t driver, const int16_t current) { + if (WITHIN(driver, 0, COUNT(motor_current_setting) - 1)) + motor_current_setting[driver] = current; // update motor_current_setting + + if (!initialized) return; + + #if HAS_MOTOR_CURRENT_SPI + + //SERIAL_ECHOLNPGM("Digipotss current ", current); + + const uint8_t digipot_ch[] = DIGIPOT_CHANNELS; + set_digipot_value_spi(digipot_ch[driver], current); + + #elif HAS_MOTOR_CURRENT_PWM + + #define _WRITE_CURRENT_PWM(P) hal.set_pwm_duty(pin_t(MOTOR_CURRENT_PWM_## P ##_PIN), 255L * current / (MOTOR_CURRENT_PWM_RANGE)) + switch (driver) { + case 0: + #if PIN_EXISTS(MOTOR_CURRENT_PWM_X) + _WRITE_CURRENT_PWM(X); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_Y) + _WRITE_CURRENT_PWM(Y); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) + _WRITE_CURRENT_PWM(XY); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_I) + _WRITE_CURRENT_PWM(I); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_J) + _WRITE_CURRENT_PWM(J); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_K) + _WRITE_CURRENT_PWM(K); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_U) + _WRITE_CURRENT_PWM(U); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_V) + _WRITE_CURRENT_PWM(V); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_W) + _WRITE_CURRENT_PWM(W); + #endif + break; + case 1: + #if HAS_MOTOR_CURRENT_PWM_Z + _WRITE_CURRENT_PWM(Z); + #endif + break; + case 2: + #if PIN_EXISTS(MOTOR_CURRENT_PWM_E) + _WRITE_CURRENT_PWM(E); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_E0) + _WRITE_CURRENT_PWM(E0); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_E1) + _WRITE_CURRENT_PWM(E1); + #endif + break; + } + #endif + } + + void Stepper::digipot_init() { + + #if HAS_MOTOR_CURRENT_SPI + + SPI.begin(); + SET_OUTPUT(DIGIPOTSS_PIN); + + for (uint8_t i = 0; i < COUNT(motor_current_setting); ++i) + set_digipot_current(i, motor_current_setting[i]); + + #elif HAS_MOTOR_CURRENT_PWM + + #ifdef __SAM3X8E__ + #define _RESET_CURRENT_PWM_FREQ(P) NOOP + #else + #define _RESET_CURRENT_PWM_FREQ(P) hal.set_pwm_frequency(pin_t(P), MOTOR_CURRENT_PWM_FREQUENCY) + #endif + #define INIT_CURRENT_PWM(P) do{ SET_PWM(MOTOR_CURRENT_PWM_## P ##_PIN); _RESET_CURRENT_PWM_FREQ(MOTOR_CURRENT_PWM_## P ##_PIN); }while(0) + + #if PIN_EXISTS(MOTOR_CURRENT_PWM_X) + INIT_CURRENT_PWM(X); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_Y) + INIT_CURRENT_PWM(Y); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) + INIT_CURRENT_PWM(XY); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_I) + INIT_CURRENT_PWM(I); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_J) + INIT_CURRENT_PWM(J); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_K) + INIT_CURRENT_PWM(K); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_U) + INIT_CURRENT_PWM(U); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_V) + INIT_CURRENT_PWM(V); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_W) + INIT_CURRENT_PWM(W); + #endif + #if HAS_MOTOR_CURRENT_PWM_Z + INIT_CURRENT_PWM(Z); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_E) + INIT_CURRENT_PWM(E); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_E0) + INIT_CURRENT_PWM(E0); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_E1) + INIT_CURRENT_PWM(E1); + #endif + + refresh_motor_power(); + + #endif + } + +#endif + +/** + * Software-controlled Microstepping with digital pins + */ + +#if HAS_MICROSTEPS + + void Stepper::microstep_init() { + #if HAS_X_MS_PINS + SET_OUTPUT(X_MS1_PIN); SET_OUTPUT(X_MS2_PIN); + #if PIN_EXISTS(X_MS3) + SET_OUTPUT(X_MS3_PIN); + #endif + #endif + #if HAS_X2_MS_PINS + SET_OUTPUT(X2_MS1_PIN); SET_OUTPUT(X2_MS2_PIN); + #if PIN_EXISTS(X2_MS3) + SET_OUTPUT(X2_MS3_PIN); + #endif + #endif + #if HAS_Y_MS_PINS + SET_OUTPUT(Y_MS1_PIN); SET_OUTPUT(Y_MS2_PIN); + #if PIN_EXISTS(Y_MS3) + SET_OUTPUT(Y_MS3_PIN); + #endif + #endif + #if HAS_Y2_MS_PINS + SET_OUTPUT(Y2_MS1_PIN); SET_OUTPUT(Y2_MS2_PIN); + #if PIN_EXISTS(Y2_MS3) + SET_OUTPUT(Y2_MS3_PIN); + #endif + #endif + #if HAS_Z_MS_PINS + SET_OUTPUT(Z_MS1_PIN); SET_OUTPUT(Z_MS2_PIN); + #if PIN_EXISTS(Z_MS3) + SET_OUTPUT(Z_MS3_PIN); + #endif + #endif + #if HAS_Z2_MS_PINS + SET_OUTPUT(Z2_MS1_PIN); SET_OUTPUT(Z2_MS2_PIN); + #if PIN_EXISTS(Z2_MS3) + SET_OUTPUT(Z2_MS3_PIN); + #endif + #endif + #if HAS_Z3_MS_PINS + SET_OUTPUT(Z3_MS1_PIN); SET_OUTPUT(Z3_MS2_PIN); + #if PIN_EXISTS(Z3_MS3) + SET_OUTPUT(Z3_MS3_PIN); + #endif + #endif + #if HAS_Z4_MS_PINS + SET_OUTPUT(Z4_MS1_PIN); SET_OUTPUT(Z4_MS2_PIN); + #if PIN_EXISTS(Z4_MS3) + SET_OUTPUT(Z4_MS3_PIN); + #endif + #endif + #if HAS_I_MS_PINS + SET_OUTPUT(I_MS1_PIN); SET_OUTPUT(I_MS2_PIN); + #if PIN_EXISTS(I_MS3) + SET_OUTPUT(I_MS3_PIN); + #endif + #endif + #if HAS_J_MS_PINS + SET_OUTPUT(J_MS1_PIN); SET_OUTPUT(J_MS2_PIN); + #if PIN_EXISTS(J_MS3) + SET_OUTPUT(J_MS3_PIN); + #endif + #endif + #if HAS_K_MS_PINS + SET_OUTPUT(K_MS1_PIN); SET_OUTPUT(K_MS2_PIN); + #if PIN_EXISTS(K_MS3) + SET_OUTPUT(K_MS3_PIN); + #endif + #endif + #if HAS_U_MS_PINS + SET_OUTPUT(U_MS1_PIN); SET_OUTPUT(U_MS2_PIN); + #if PIN_EXISTS(U_MS3) + SET_OUTPUT(U_MS3_PIN); + #endif + #endif + #if HAS_V_MS_PINS + SET_OUTPUT(V_MS1_PIN); SET_OUTPUT(V_MS2_PIN); + #if PIN_EXISTS(V_MS3) + SET_OUTPUT(V_MS3_PIN); + #endif + #endif + #if HAS_W_MS_PINS + SET_OUTPUT(W_MS1_PIN); SET_OUTPUT(W_MS2_PIN); + #if PIN_EXISTS(W_MS3) + SET_OUTPUT(W_MS3_PIN); + #endif + #endif + #if HAS_E0_MS_PINS + SET_OUTPUT(E0_MS1_PIN); SET_OUTPUT(E0_MS2_PIN); + #if PIN_EXISTS(E0_MS3) + SET_OUTPUT(E0_MS3_PIN); + #endif + #endif + #if HAS_E1_MS_PINS + SET_OUTPUT(E1_MS1_PIN); SET_OUTPUT(E1_MS2_PIN); + #if PIN_EXISTS(E1_MS3) + SET_OUTPUT(E1_MS3_PIN); + #endif + #endif + #if HAS_E2_MS_PINS + SET_OUTPUT(E2_MS1_PIN); SET_OUTPUT(E2_MS2_PIN); + #if PIN_EXISTS(E2_MS3) + SET_OUTPUT(E2_MS3_PIN); + #endif + #endif + #if HAS_E3_MS_PINS + SET_OUTPUT(E3_MS1_PIN); SET_OUTPUT(E3_MS2_PIN); + #if PIN_EXISTS(E3_MS3) + SET_OUTPUT(E3_MS3_PIN); + #endif + #endif + #if HAS_E4_MS_PINS + SET_OUTPUT(E4_MS1_PIN); SET_OUTPUT(E4_MS2_PIN); + #if PIN_EXISTS(E4_MS3) + SET_OUTPUT(E4_MS3_PIN); + #endif + #endif + #if HAS_E5_MS_PINS + SET_OUTPUT(E5_MS1_PIN); SET_OUTPUT(E5_MS2_PIN); + #if PIN_EXISTS(E5_MS3) + SET_OUTPUT(E5_MS3_PIN); + #endif + #endif + #if HAS_E6_MS_PINS + SET_OUTPUT(E6_MS1_PIN); SET_OUTPUT(E6_MS2_PIN); + #if PIN_EXISTS(E6_MS3) + SET_OUTPUT(E6_MS3_PIN); + #endif + #endif + #if HAS_E7_MS_PINS + SET_OUTPUT(E7_MS1_PIN); SET_OUTPUT(E7_MS2_PIN); + #if PIN_EXISTS(E7_MS3) + SET_OUTPUT(E7_MS3_PIN); + #endif + #endif + + static const uint8_t microstep_modes[] = MICROSTEP_MODES; + for (uint16_t i = 0; i < COUNT(microstep_modes); i++) + microstep_mode(i, microstep_modes[i]); + } + + void Stepper::microstep_ms(const uint8_t driver, const int8_t ms1, const int8_t ms2, const int8_t ms3) { + if (ms1 >= 0) switch (driver) { + #if HAS_X_MS_PINS || HAS_X2_MS_PINS + case X_AXIS: + #if HAS_X_MS_PINS + WRITE(X_MS1_PIN, ms1); + #endif + #if HAS_X2_MS_PINS + WRITE(X2_MS1_PIN, ms1); + #endif + break; + #endif + #if HAS_Y_MS_PINS || HAS_Y2_MS_PINS + case Y_AXIS: + #if HAS_Y_MS_PINS + WRITE(Y_MS1_PIN, ms1); + #endif + #if HAS_Y2_MS_PINS + WRITE(Y2_MS1_PIN, ms1); + #endif + break; + #endif + #if HAS_SOME_Z_MS_PINS + case Z_AXIS: + #if HAS_Z_MS_PINS + WRITE(Z_MS1_PIN, ms1); + #endif + #if HAS_Z2_MS_PINS + WRITE(Z2_MS1_PIN, ms1); + #endif + #if HAS_Z3_MS_PINS + WRITE(Z3_MS1_PIN, ms1); + #endif + #if HAS_Z4_MS_PINS + WRITE(Z4_MS1_PIN, ms1); + #endif + break; + #endif + #if HAS_I_MS_PINS + case I_AXIS: WRITE(I_MS1_PIN, ms1); break; + #endif + #if HAS_J_MS_PINS + case J_AXIS: WRITE(J_MS1_PIN, ms1); break; + #endif + #if HAS_K_MS_PINS + case K_AXIS: WRITE(K_MS1_PIN, ms1); break; + #endif + #if HAS_U_MS_PINS + case U_AXIS: WRITE(U_MS1_PIN, ms1); break; + #endif + #if HAS_V_MS_PINS + case V_AXIS: WRITE(V_MS1_PIN, ms1); break; + #endif + #if HAS_W_MS_PINS + case W_AXIS: WRITE(W_MS1_PIN, ms1); break; + #endif + #if HAS_E0_MS_PINS + case E_AXIS: WRITE(E0_MS1_PIN, ms1); break; + #endif + #if HAS_E1_MS_PINS + case (E_AXIS + 1): WRITE(E1_MS1_PIN, ms1); break; + #endif + #if HAS_E2_MS_PINS + case (E_AXIS + 2): WRITE(E2_MS1_PIN, ms1); break; + #endif + #if HAS_E3_MS_PINS + case (E_AXIS + 3): WRITE(E3_MS1_PIN, ms1); break; + #endif + #if HAS_E4_MS_PINS + case (E_AXIS + 4): WRITE(E4_MS1_PIN, ms1); break; + #endif + #if HAS_E5_MS_PINS + case (E_AXIS + 5): WRITE(E5_MS1_PIN, ms1); break; + #endif + #if HAS_E6_MS_PINS + case (E_AXIS + 6): WRITE(E6_MS1_PIN, ms1); break; + #endif + #if HAS_E7_MS_PINS + case (E_AXIS + 7): WRITE(E7_MS1_PIN, ms1); break; + #endif + } + if (ms2 >= 0) switch (driver) { + #if HAS_X_MS_PINS || HAS_X2_MS_PINS + case X_AXIS: + #if HAS_X_MS_PINS + WRITE(X_MS2_PIN, ms2); + #endif + #if HAS_X2_MS_PINS + WRITE(X2_MS2_PIN, ms2); + #endif + break; + #endif + #if HAS_Y_MS_PINS || HAS_Y2_MS_PINS + case Y_AXIS: + #if HAS_Y_MS_PINS + WRITE(Y_MS2_PIN, ms2); + #endif + #if HAS_Y2_MS_PINS + WRITE(Y2_MS2_PIN, ms2); + #endif + break; + #endif + #if HAS_SOME_Z_MS_PINS + case Z_AXIS: + #if HAS_Z_MS_PINS + WRITE(Z_MS2_PIN, ms2); + #endif + #if HAS_Z2_MS_PINS + WRITE(Z2_MS2_PIN, ms2); + #endif + #if HAS_Z3_MS_PINS + WRITE(Z3_MS2_PIN, ms2); + #endif + #if HAS_Z4_MS_PINS + WRITE(Z4_MS2_PIN, ms2); + #endif + break; + #endif + #if HAS_I_MS_PINS + case I_AXIS: WRITE(I_MS2_PIN, ms2); break; + #endif + #if HAS_J_MS_PINS + case J_AXIS: WRITE(J_MS2_PIN, ms2); break; + #endif + #if HAS_K_MS_PINS + case K_AXIS: WRITE(K_MS2_PIN, ms2); break; + #endif + #if HAS_U_MS_PINS + case U_AXIS: WRITE(U_MS2_PIN, ms2); break; + #endif + #if HAS_V_MS_PINS + case V_AXIS: WRITE(V_MS2_PIN, ms2); break; + #endif + #if HAS_W_MS_PINS + case W_AXIS: WRITE(W_MS2_PIN, ms2); break; + #endif + #if HAS_E0_MS_PINS + case E_AXIS: WRITE(E0_MS2_PIN, ms2); break; + #endif + #if HAS_E1_MS_PINS + case (E_AXIS + 1): WRITE(E1_MS2_PIN, ms2); break; + #endif + #if HAS_E2_MS_PINS + case (E_AXIS + 2): WRITE(E2_MS2_PIN, ms2); break; + #endif + #if HAS_E3_MS_PINS + case (E_AXIS + 3): WRITE(E3_MS2_PIN, ms2); break; + #endif + #if HAS_E4_MS_PINS + case (E_AXIS + 4): WRITE(E4_MS2_PIN, ms2); break; + #endif + #if HAS_E5_MS_PINS + case (E_AXIS + 5): WRITE(E5_MS2_PIN, ms2); break; + #endif + #if HAS_E6_MS_PINS + case (E_AXIS + 6): WRITE(E6_MS2_PIN, ms2); break; + #endif + #if HAS_E7_MS_PINS + case (E_AXIS + 7): WRITE(E7_MS2_PIN, ms2); break; + #endif + } + if (ms3 >= 0) switch (driver) { + #if HAS_X_MS_PINS || HAS_X2_MS_PINS + case X_AXIS: + #if HAS_X_MS_PINS && PIN_EXISTS(X_MS3) + WRITE(X_MS3_PIN, ms3); + #endif + #if HAS_X2_MS_PINS && PIN_EXISTS(X2_MS3) + WRITE(X2_MS3_PIN, ms3); + #endif + break; + #endif + #if HAS_Y_MS_PINS || HAS_Y2_MS_PINS + case Y_AXIS: + #if HAS_Y_MS_PINS && PIN_EXISTS(Y_MS3) + WRITE(Y_MS3_PIN, ms3); + #endif + #if HAS_Y2_MS_PINS && PIN_EXISTS(Y2_MS3) + WRITE(Y2_MS3_PIN, ms3); + #endif + break; + #endif + #if HAS_SOME_Z_MS_PINS + case Z_AXIS: + #if HAS_Z_MS_PINS && PIN_EXISTS(Z_MS3) + WRITE(Z_MS3_PIN, ms3); + #endif + #if HAS_Z2_MS_PINS && PIN_EXISTS(Z2_MS3) + WRITE(Z2_MS3_PIN, ms3); + #endif + #if HAS_Z3_MS_PINS && PIN_EXISTS(Z3_MS3) + WRITE(Z3_MS3_PIN, ms3); + #endif + #if HAS_Z4_MS_PINS && PIN_EXISTS(Z4_MS3) + WRITE(Z4_MS3_PIN, ms3); + #endif + break; + #endif + #if HAS_I_MS_PINS && PIN_EXISTS(I_MS3) + case I_AXIS: WRITE(I_MS3_PIN, ms3); break; + #endif + #if HAS_J_MS_PINS && PIN_EXISTS(J_MS3) + case J_AXIS: WRITE(J_MS3_PIN, ms3); break; + #endif + #if HAS_K_MS_PINS && PIN_EXISTS(K_MS3) + case K_AXIS: WRITE(K_MS3_PIN, ms3); break; + #endif + #if HAS_U_MS_PINS && PIN_EXISTS(U_MS3) + case U_AXIS: WRITE(U_MS3_PIN, ms3); break; + #endif + #if HAS_V_MS_PINS && PIN_EXISTS(V_MS3) + case V_AXIS: WRITE(V_MS3_PIN, ms3); break; + #endif + #if HAS_W_MS_PINS && PIN_EXISTS(W_MS3) + case W_AXIS: WRITE(W_MS3_PIN, ms3); break; + #endif + #if HAS_E0_MS_PINS && PIN_EXISTS(E0_MS3) + case E_AXIS: WRITE(E0_MS3_PIN, ms3); break; + #endif + #if HAS_E1_MS_PINS && PIN_EXISTS(E1_MS3) + case (E_AXIS + 1): WRITE(E1_MS3_PIN, ms3); break; + #endif + #if HAS_E2_MS_PINS && PIN_EXISTS(E2_MS3) + case (E_AXIS + 2): WRITE(E2_MS3_PIN, ms3); break; + #endif + #if HAS_E3_MS_PINS && PIN_EXISTS(E3_MS3) + case (E_AXIS + 3): WRITE(E3_MS3_PIN, ms3); break; + #endif + #if HAS_E4_MS_PINS && PIN_EXISTS(E4_MS3) + case (E_AXIS + 4): WRITE(E4_MS3_PIN, ms3); break; + #endif + #if HAS_E5_MS_PINS && PIN_EXISTS(E5_MS3) + case (E_AXIS + 5): WRITE(E5_MS3_PIN, ms3); break; + #endif + #if HAS_E6_MS_PINS && PIN_EXISTS(E6_MS3) + case (E_AXIS + 6): WRITE(E6_MS3_PIN, ms3); break; + #endif + #if HAS_E7_MS_PINS && PIN_EXISTS(E7_MS3) + case (E_AXIS + 7): WRITE(E7_MS3_PIN, ms3); break; + #endif + } + } + + // MS1 MS2 MS3 Stepper Driver Microstepping mode table + #ifndef MICROSTEP1 + #define MICROSTEP1 LOW,LOW,LOW + #endif + #if ENABLED(HEROIC_STEPPER_DRIVERS) + #ifndef MICROSTEP128 + #define MICROSTEP128 LOW,HIGH,LOW + #endif + #else + #ifndef MICROSTEP2 + #define MICROSTEP2 HIGH,LOW,LOW + #endif + #ifndef MICROSTEP4 + #define MICROSTEP4 LOW,HIGH,LOW + #endif + #endif + #ifndef MICROSTEP8 + #define MICROSTEP8 HIGH,HIGH,LOW + #endif + #ifndef MICROSTEP16 + #define MICROSTEP16 HIGH,HIGH,LOW + #endif + + void Stepper::microstep_mode(const uint8_t driver, const uint8_t stepping_mode) { + switch (stepping_mode) { + #ifdef MICROSTEP1 + case 1: microstep_ms(driver, MICROSTEP1); break; + #endif + #ifdef MICROSTEP2 + case 2: microstep_ms(driver, MICROSTEP2); break; + #endif + #ifdef MICROSTEP4 + case 4: microstep_ms(driver, MICROSTEP4); break; + #endif + #ifdef MICROSTEP8 + case 8: microstep_ms(driver, MICROSTEP8); break; + #endif + #ifdef MICROSTEP16 + case 16: microstep_ms(driver, MICROSTEP16); break; + #endif + #ifdef MICROSTEP32 + case 32: microstep_ms(driver, MICROSTEP32); break; + #endif + #ifdef MICROSTEP64 + case 64: microstep_ms(driver, MICROSTEP64); break; + #endif + #ifdef MICROSTEP128 + case 128: microstep_ms(driver, MICROSTEP128); break; + #endif + + default: SERIAL_ERROR_MSG("Microsteps unavailable"); break; + } + } + + void Stepper::microstep_readings() { + #define PIN_CHAR(P) SERIAL_CHAR('0' + READ(P##_PIN)) + #define MS_LINE(A) do{ SERIAL_ECHOPGM(" " STRINGIFY(A) ":"); PIN_CHAR(A##_MS1); PIN_CHAR(A##_MS2); }while(0) + SERIAL_ECHOPGM("MS1|2|3 Pins"); + #if HAS_X_MS_PINS + MS_LINE(X); + #if PIN_EXISTS(X_MS3) + PIN_CHAR(X_MS3); + #endif + #endif + #if HAS_Y_MS_PINS + MS_LINE(Y); + #if PIN_EXISTS(Y_MS3) + PIN_CHAR(Y_MS3); + #endif + #endif + #if HAS_Z_MS_PINS + MS_LINE(Z); + #if PIN_EXISTS(Z_MS3) + PIN_CHAR(Z_MS3); + #endif + #endif + #if HAS_I_MS_PINS + MS_LINE(I); + #if PIN_EXISTS(I_MS3) + PIN_CHAR(I_MS3); + #endif + #endif + #if HAS_J_MS_PINS + MS_LINE(J); + #if PIN_EXISTS(J_MS3) + PIN_CHAR(J_MS3); + #endif + #endif + #if HAS_K_MS_PINS + MS_LINE(K); + #if PIN_EXISTS(K_MS3) + PIN_CHAR(K_MS3); + #endif + #endif + #if HAS_U_MS_PINS + MS_LINE(U); + #if PIN_EXISTS(U_MS3) + PIN_CHAR(U_MS3); + #endif + #endif + #if HAS_V_MS_PINS + MS_LINE(V); + #if PIN_EXISTS(V_MS3) + PIN_CHAR(V_MS3); + #endif + #endif + #if HAS_W_MS_PINS + MS_LINE(W); + #if PIN_EXISTS(W_MS3) + PIN_CHAR(W_MS3); + #endif + #endif + #if HAS_E0_MS_PINS + MS_LINE(E0); + #if PIN_EXISTS(E0_MS3) + PIN_CHAR(E0_MS3); + #endif + #endif + #if HAS_E1_MS_PINS + MS_LINE(E1); + #if PIN_EXISTS(E1_MS3) + PIN_CHAR(E1_MS3); + #endif + #endif + #if HAS_E2_MS_PINS + MS_LINE(E2); + #if PIN_EXISTS(E2_MS3) + PIN_CHAR(E2_MS3); + #endif + #endif + #if HAS_E3_MS_PINS + MS_LINE(E3); + #if PIN_EXISTS(E3_MS3) + PIN_CHAR(E3_MS3); + #endif + #endif + #if HAS_E4_MS_PINS + MS_LINE(E4); + #if PIN_EXISTS(E4_MS3) + PIN_CHAR(E4_MS3); + #endif + #endif + #if HAS_E5_MS_PINS + MS_LINE(E5); + #if PIN_EXISTS(E5_MS3) + PIN_CHAR(E5_MS3); + #endif + #endif + #if HAS_E6_MS_PINS + MS_LINE(E6); + #if PIN_EXISTS(E6_MS3) + PIN_CHAR(E6_MS3); + #endif + #endif + #if HAS_E7_MS_PINS + MS_LINE(E7); + #if PIN_EXISTS(E7_MS3) + PIN_CHAR(E7_MS3); + #endif + #endif + SERIAL_EOL(); + } + +#endif // HAS_MICROSTEPS diff --git a/Marlin/src/pins/sam/pins_PRINTRBOARD_G2.h b/Marlin/src/pins/sam/pins_PRINTRBOARD_G2.h index 0f4db200a3..fb8a1e7c6d 100644 --- a/Marlin/src/pins/sam/pins_PRINTRBOARD_G2.h +++ b/Marlin/src/pins/sam/pins_PRINTRBOARD_G2.h @@ -102,10 +102,6 @@ #define E0_ENABLE_PIN 37 // PB22 // Microstepping mode pins -#define Z_MS1_PIN 52 // PB21 MODE0 MOTOR 1 -#define Z_MS2_PIN 52 // PB21 MODE1 -#define Z_MS3_PIN 65 // PB20 MODE2 - #define X_MS1_PIN 43 // PA20 MODE0 MOTOR 2 #define X_MS2_PIN 43 // PA20 MODE1 #define X_MS3_PIN 42 // PA19 MODE2 @@ -114,6 +110,10 @@ #define Y_MS2_PIN 77 // PA28 MODE1 #define Y_MS3_PIN 76 // PA27 MODE2 +#define Z_MS1_PIN 52 // PB21 MODE0 MOTOR 1 +#define Z_MS2_PIN 52 // PB21 MODE1 +#define Z_MS3_PIN 65 // PB20 MODE2 + #define E0_MS1_PIN 38 // PB11 MODE0 MOTOR 4 #define E0_MS2_PIN 38 // PB11 MODE1 #define E0_MS3_PIN 39 // PB10 MODE2 diff --git a/ini/features.ini b/ini/features.ini index 1cff1a61f4..e51ad0bda3 100644 --- a/ini/features.ini +++ b/ini/features.ini @@ -22,6 +22,7 @@ POSTMORTEM_DEBUGGING = build_src_filter=+ + + + + +HAS_STEPPER_CONTROL = build_src_filter=+ HAS_T(RINAMIC_CONFIG|MC_SPI) = build_src_filter=+ EDITABLE_HOMING_CURRENT = build_src_filter=+ SR_LCD_3W_NL = SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/6f53c19a8a.zip From f6c891554574e00febec83208951fa52ad8af7b7 Mon Sep 17 00:00:00 2001 From: David Buezas Date: Sun, 20 Apr 2025 07:18:45 +0200 Subject: [PATCH 37/86] =?UTF-8?q?=E2=9C=A8=20SMOOTH=5FLIN=5FADVANCE=20(#27?= =?UTF-8?q?710)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/Configuration_adv.h | 18 ++ Marlin/src/feature/bltouch.cpp | 2 +- Marlin/src/gcode/feature/advance/M900.cpp | 50 ++++- Marlin/src/inc/Conditionals-4-adv.h | 5 + Marlin/src/inc/SanityCheck.h | 18 +- Marlin/src/inc/Warnings.cpp | 9 + Marlin/src/lcd/language/language_en.h | 2 + Marlin/src/lcd/menu/menu_advanced.cpp | 28 ++- Marlin/src/lcd/menu/menu_tune.cpp | 12 ++ Marlin/src/module/planner.cpp | 63 ++++-- Marlin/src/module/planner.h | 37 +++- Marlin/src/module/settings.cpp | 44 +++- Marlin/src/module/stepper.cpp | 233 +++++++++++++++++++--- Marlin/src/module/stepper.h | 39 +++- buildroot/tests/LPC1768 | 28 ++- buildroot/tests/LPC1769 | 22 +- 16 files changed, 504 insertions(+), 106 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 73073762f1..9d291f6219 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -2352,6 +2352,24 @@ //#define ADVANCE_K_EXTRA // Add a second linear advance constant, configurable with M900 L. //#define LA_DEBUG // Print debug information to serial during operation. Disable for production use. //#define EXPERIMENTAL_I2S_LA // Allow I2S_STEPPER_STREAM to be used with LA. Performance degrades as the LA step rate reaches ~20kHz. + + //#define SMOOTH_LIN_ADVANCE // Remove limits on acceleration by gradual increase of nozzle pressure + #if ENABLED(SMOOTH_LIN_ADVANCE) + /** + * ADVANCE_TAU is also the time ahead that the smoother needs to look + * into the planner, so the planner needs to have enough blocks loaded. + * For k=0.04 at 10k acceleration and an "Orbiter 2" extruder it can be as low as 0.0075. + * Adjust by lowering the value until you observe the extruder skipping, then raise slightly. + * Higher k and higher XY acceleration may require larger ADVANCE_TAU to avoid skipping steps. + */ + #if ENABLED(DISTINCT_E_FACTORS) + #define ADVANCE_TAU { 0.01 } // (s) Smoothing time to reduce extruder acceleration, per extruder + #else + #define ADVANCE_TAU 0.01 // (s) Smoothing time to reduce extruder acceleration + #endif + #define SMOOTH_LIN_ADV_HZ 5000 // (Hz) How often to update extruder speed + #define INPUT_SHAPING_E_SYNC // Synchronize the extruder-shaped XY axes (to increase precision) + #endif #endif /** diff --git a/Marlin/src/feature/bltouch.cpp b/Marlin/src/feature/bltouch.cpp index 2559547b85..5b498cd474 100644 --- a/Marlin/src/feature/bltouch.cpp +++ b/Marlin/src/feature/bltouch.cpp @@ -48,7 +48,7 @@ bool BLTouch::command(const BLTCommand cmd, const millis_t &ms) { // The previous write should've already delayed to detect the alarm. if (cmd != current) { servo[Z_PROBE_SERVO_NR].move(cmd); - safe_delay(_MAX(ms, (uint32_t)BLTOUCH_DELAY)); // BLTOUCH_DELAY is also the *minimum* delay + safe_delay(_MAX(ms, uint32_t(BLTOUCH_DELAY))); // BLTOUCH_DELAY is also the *minimum* delay } return triggered(); } diff --git a/Marlin/src/gcode/feature/advance/M900.cpp b/Marlin/src/gcode/feature/advance/M900.cpp index e8a16d952f..51a40f934e 100644 --- a/Marlin/src/gcode/feature/advance/M900.cpp +++ b/Marlin/src/gcode/feature/advance/M900.cpp @@ -26,6 +26,7 @@ #include "../../gcode.h" #include "../../../module/planner.h" +#include "../../../module/stepper.h" #if ENABLED(ADVANCE_K_EXTRA) float other_extruder_advance_K[DISTINCT_E]; @@ -62,6 +63,11 @@ void GcodeSuite::M900() { float &kref = planner.extruder_advance_K[E_INDEX_N(tool_index)], newK = kref; const float oldK = newK; + #if ENABLED(SMOOTH_LIN_ADVANCE) + const float oldU = stepper.get_advance_tau(E_INDEX_N(tool_index)); + float newU = oldU; + #endif + #if ENABLED(ADVANCE_K_EXTRA) float &lref = other_extruder_advance_K[E_INDEX_N(tool_index)]; @@ -105,9 +111,22 @@ void GcodeSuite::M900() { #endif - if (newK != oldK) { + #if ENABLED(SMOOTH_LIN_ADVANCE) + if (parser.seenval('U')) { + const float tau = parser.value_float(); + if (WITHIN(tau, 0.0f, 0.5f)) + newU = tau; + else + echo_value_oor('U'); + } + #endif + + if (newK != oldK || TERN0(SMOOTH_LIN_ADVANCE, newU != oldU)) { planner.synchronize(); - kref = newK; + if (newK != oldK) kref = newK; + #if ENABLED(SMOOTH_LIN_ADVANCE) + if (newU != oldU) stepper.set_advance_tau(newU); + #endif } if (!parser.seen_any()) { @@ -124,18 +143,27 @@ void GcodeSuite::M900() { } #endif - #else + #else // !ADVANCE_K_EXTRA SERIAL_ECHO_START(); #if DISTINCT_E < 2 - SERIAL_ECHOLNPGM("Advance K=", planner.extruder_advance_K[0]); + SERIAL_ECHOPGM("Advance K=", planner.extruder_advance_K[0]); + #if ENABLED(SMOOTH_LIN_ADVANCE) + SERIAL_ECHOPGM(" TAU=", stepper.get_advance_tau()); + #endif + SERIAL_EOL(); #else SERIAL_ECHOPGM("Advance K"); EXTRUDER_LOOP() SERIAL_ECHO(C(' '), C('0' + e), C(':'), planner.extruder_advance_K[e]); SERIAL_EOL(); + #if ENABLED(SMOOTH_LIN_ADVANCE) + SERIAL_ECHOPGM("Advance TAU"); + EXTRUDER_LOOP() SERIAL_ECHO(C(' '), C('0' + e), C(':'), stepper.get_advance_tau(e)); + SERIAL_EOL(); + #endif #endif - #endif + #endif // !ADVANCE_K_EXTRA } } @@ -146,11 +174,19 @@ void GcodeSuite::M900_report(const bool forReplay/*=true*/) { report_heading(forReplay, F(STR_LINEAR_ADVANCE)); #if DISTINCT_E < 2 report_echo_start(forReplay); - SERIAL_ECHOLNPGM(" M900 K", planner.extruder_advance_K[0]); + SERIAL_ECHOPGM(" M900 K", planner.extruder_advance_K[0]); + #if ENABLED(SMOOTH_LIN_ADVANCE) + SERIAL_ECHOPGM(" M900 U", stepper.get_advance_tau()); + #endif + SERIAL_EOL(); #else EXTRUDER_LOOP() { report_echo_start(forReplay); - SERIAL_ECHOLNPGM(" M900 T", e, " K", planner.extruder_advance_K[e]); + SERIAL_ECHOPGM(" M900 T", e, " K", planner.extruder_advance_K[e]); + #if ENABLED(SMOOTH_LIN_ADVANCE) + SERIAL_ECHOPGM(" U", stepper.get_advance_tau(e)); + #endif + SERIAL_EOL(); } #endif } diff --git a/Marlin/src/inc/Conditionals-4-adv.h b/Marlin/src/inc/Conditionals-4-adv.h index 109fca6b29..ca096c7661 100644 --- a/Marlin/src/inc/Conditionals-4-adv.h +++ b/Marlin/src/inc/Conditionals-4-adv.h @@ -231,6 +231,7 @@ #undef FWRETRACT #undef LCD_SHOW_E_TOTAL #undef LIN_ADVANCE + #undef SMOOTH_LIN_ADVANCE #undef MANUAL_E_MOVES_RELATIVE #undef PID_EXTRUSION_SCALING #undef SHOW_TEMP_ADC_VALUES @@ -339,6 +340,10 @@ #define HAS_LINEAR_E_JERK 1 #endif +#if ENABLED(LIN_ADVANCE) && DISABLED(SMOOTH_LIN_ADVANCE) + #define HAS_ROUGH_LIN_ADVANCE 1 +#endif + // Some displays can toggle Adaptive Step Smoothing. // The state is saved to EEPROM. // In future this may be added to a G-code such as M205 A. diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index cd3c1cd573..970847ecb5 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -847,7 +847,23 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #if ENABLED(DIRECT_STEPPING) #error "DIRECT_STEPPING is incompatible with LIN_ADVANCE. (Extrusion is controlled externally by the Step Daemon.)" #endif -#endif + + /** + * Smooth Linear Advance + */ + #if ENABLED(SMOOTH_LIN_ADVANCE) + #ifndef CPU_32_BIT + #error "SMOOTH_LIN_ADVANCE requires a 32-bit CPU." + #elif DISTINCT_E > 1 + #error "SMOOTH_LIN_ADVANCE is not compatible with multiple extruders." + #elif ENABLED(S_CURVE_ACCELERATION) + #error "SMOOTH_LIN_ADVANCE is not compatible with S_CURVE_ACCELERATION." + #elif ENABLED(INPUT_SHAPING_E_SYNC) && NONE(INPUT_SHAPING_X, INPUT_SHAPING_Y) + #error "INPUT_SHAPING_E_SYNC requires INPUT_SHAPING_X or INPUT_SHAPING_Y." + #endif + #endif + +#endif // LIN_ADVANCE /** * Nonlinear Extrusion requirements diff --git a/Marlin/src/inc/Warnings.cpp b/Marlin/src/inc/Warnings.cpp index 119e2205ab..f11eedbe52 100644 --- a/Marlin/src/inc/Warnings.cpp +++ b/Marlin/src/inc/Warnings.cpp @@ -946,3 +946,12 @@ #if LCD_IS_SERIAL_HOST && defined(BOARD_LCD_SERIAL_PORT) && LCD_SERIAL_PORT != BOARD_LCD_SERIAL_PORT && DISABLED(NO_LCD_SERIAL_PORT_WARNING) #warning "LCD_SERIAL_PORT overrides the default (BOARD_LCD_SERIAL_PORT)." #endif + +/** + * Smooth Linear Advance with Mixing Extruder, S-Curve Acceleration + */ +#if ENABLED(SMOOTH_LIN_ADVANCE) + #if ENABLED(MIXING_EXTRUDER) + #warning "SMOOTH_LIN_ADVANCE with MIXING_EXTRUDER is untested. Use with caution." + #endif +#endif diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index d184c0358f..e0c1f53f77 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -492,7 +492,9 @@ namespace LanguageNarrow_en { 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_TAU = _UxGT("Advance Tau"); LSTR MSG_ADVANCE_K_E = _UxGT("Advance K *"); + LSTR MSG_ADVANCE_TAU_E = _UxGT("Advance Tau *"); LSTR MSG_CONTRAST = _UxGT("LCD Contrast"); LSTR MSG_BRIGHTNESS = _UxGT("LCD Brightness"); LSTR MSG_SCREEN_TIMEOUT = _UxGT("LCD Timeout (m)"); diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 137439c6df..296312bb1f 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -122,7 +122,18 @@ void menu_backlash(); EXTRUDER_LOOP() EDIT_ITEM_N(float42_52, e, MSG_ADVANCE_K_E, &planner.extruder_advance_K[e], 0, 10); #endif - #endif + #if ENABLED(SMOOTH_LIN_ADVANCE) + #if DISTINCT_E < 2 + editable.decimal = stepper.get_advance_tau(); + EDIT_ITEM(float54, MSG_ADVANCE_TAU, &editable.decimal, 0.0f, 0.5f, []{ stepper.set_advance_tau(editable.decimal); }); + #else + EXTRUDER_LOOP() { + editable.decimal = stepper.get_advance_tau(e); + EDIT_ITEM_N(float54, e, MSG_ADVANCE_TAU_E, &editable.decimal, 0.0f, 0.5f, []{ stepper.set_advance_tau(editable.decimal, MenuItemBase::itemIndex); }); + } + #endif + #endif + #endif // LIN_ADVANCE #if DISABLED(NO_VOLUMETRICS) EDIT_ITEM(bool, MSG_VOLUMETRIC_ENABLED, &parser.volumetric_enabled, planner.calculate_volumetric_multipliers); @@ -735,13 +746,26 @@ void menu_advanced_settings() { #if HAS_ADV_FILAMENT_MENU SUBMENU(MSG_FILAMENT, menu_advanced_filament); - #elif ENABLED(LIN_ADVANCE) + #endif + + #if ENABLED(LIN_ADVANCE) && DISABLED(HAS_ADV_FILAMENT_MENU) #if DISTINCT_E < 2 EDIT_ITEM(float42_52, MSG_ADVANCE_K, &planner.extruder_advance_K[0], 0, 10); #else EXTRUDER_LOOP() EDIT_ITEM_N(float42_52, e, MSG_ADVANCE_K_E, &planner.extruder_advance_K[e], 0, 10); #endif + #if ENABLED(SMOOTH_LIN_ADVANCE) + #if DISTINCT_E < 2 + editable.decimal = stepper.get_advance_tau(); + EDIT_ITEM(float54, MSG_ADVANCE_TAU, &editable.decimal, 0.0f, 0.5f, []{ stepper.set_advance_tau(editable.decimal); }); + #else + EXTRUDER_LOOP() { + editable.decimal = stepper.get_advance_tau(e); + EDIT_ITEM_N(float54, e, MSG_ADVANCE_TAU_E, &editable.decimal, 0.0f, 0.5f, []{ stepper.set_advance_tau(editable.decimal, MenuItemBase::itemIndex); }); + } + #endif + #endif #endif // M540 S - Abort on endstop hit when SD printing diff --git a/Marlin/src/lcd/menu/menu_tune.cpp b/Marlin/src/lcd/menu/menu_tune.cpp index 1f1571d986..51d877fc5c 100644 --- a/Marlin/src/lcd/menu/menu_tune.cpp +++ b/Marlin/src/lcd/menu/menu_tune.cpp @@ -31,6 +31,7 @@ #include "menu_item.h" #include "../../module/motion.h" #include "../../module/planner.h" +#include "../../module/stepper.h" #include "../../module/temperature.h" #include "../../MarlinCore.h" @@ -220,6 +221,17 @@ void menu_tune() { EXTRUDER_LOOP() EDIT_ITEM_N(float42_52, e, MSG_ADVANCE_K_E, &planner.extruder_advance_K[e], 0, 10); #endif + #if ENABLED(SMOOTH_LIN_ADVANCE) + #if DISTINCT_E < 2 + editable.decimal = stepper.get_advance_tau(); + EDIT_ITEM(float54, MSG_ADVANCE_TAU, &editable.decimal, 0.0f, 0.5f, []{ stepper.set_advance_tau(editable.decimal); }); + #else + EXTRUDER_LOOP() { + editable.decimal = stepper.get_advance_tau(e); + EDIT_ITEM_N(float54, e, MSG_ADVANCE_TAU_E, &editable.decimal, 0.0f, 0.5f, []{ stepper.set_advance_tau(editable.decimal, MenuItemBase::itemIndex); }); + } + #endif + #endif #endif // diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 881e11f4c0..87cb4cd21b 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -775,6 +775,14 @@ block_t* Planner::get_current_block() { return nullptr; } +block_t* Planner::get_future_block(const uint8_t offset) { + const uint8_t nr_moves = movesplanned(); + if (nr_moves <= offset) return nullptr; + block_t * const block = &block_buffer[block_inc_mod(block_buffer_tail, offset)]; + if (block->flag.recalculate) return nullptr; + return block; +} + /** * Calculate trapezoid parameters, multiplying the entry- and exit-speeds * by the provided factors. If entry_factor is 0 don't change the initial_rate. @@ -840,13 +848,15 @@ void Planner::calculate_trapezoid_for_block(block_t * const block, const_float_t } } - #if ENABLED(S_CURVE_ACCELERATION) + #if ANY(S_CURVE_ACCELERATION, SMOOTH_LIN_ADVANCE) const float rate_factor = inverse_accel * (STEPPER_TIMER_RATE); // Jerk controlled speed requires to express speed versus time, NOT steps uint32_t acceleration_time = rate_factor * float(cruise_rate - initial_rate), - deceleration_time = rate_factor * float(cruise_rate - final_rate), + deceleration_time = rate_factor * float(cruise_rate - final_rate); + #endif + #if ENABLED(S_CURVE_ACCELERATION) // And to offload calculations from the ISR, we also calculate the inverse of those times here - acceleration_time_inverse = get_period_inverse(acceleration_time), + uint32_t acceleration_time_inverse = get_period_inverse(acceleration_time), deceleration_time_inverse = get_period_inverse(deceleration_time); #endif @@ -856,15 +866,20 @@ void Planner::calculate_trapezoid_for_block(block_t * const block, const_float_t block->initial_rate = initial_rate; block->final_rate = final_rate; - #if ENABLED(S_CURVE_ACCELERATION) + #if ANY(S_CURVE_ACCELERATION, SMOOTH_LIN_ADVANCE) block->acceleration_time = acceleration_time; block->deceleration_time = deceleration_time; - block->acceleration_time_inverse = acceleration_time_inverse; - block->deceleration_time_inverse = deceleration_time_inverse; block->cruise_rate = cruise_rate; #endif + #if ENABLED(S_CURVE_ACCELERATION) + block->acceleration_time_inverse = acceleration_time_inverse; + block->deceleration_time_inverse = deceleration_time_inverse; + #endif + #if ENABLED(SMOOTH_LIN_ADVANCE) + block->cruise_time = plateau_steps > 0 ? float(plateau_steps) * float(STEPPER_TIMER_RATE) / float(cruise_rate) : 0; + #endif - #if ENABLED(LIN_ADVANCE) + #if HAS_ROUGH_LIN_ADVANCE if (block->la_advance_rate) { const float comp = extruder_advance_K[E_INDEX_N(block->extruder)] * block->steps.e / block->step_event_count; block->max_adv_steps = cruise_rate * comp; @@ -2409,15 +2424,17 @@ bool Planner::_populate_block( if (e_D_ratio > 3.0f) use_advance_lead = false; else { - // Scale E acceleration so that it will be possible to jump to the advance speed. - const uint32_t max_accel_steps_per_s2 = MAX_E_JERK(extruder) / (extruder_advance_K[E_INDEX_N(extruder)] * e_D_ratio) * steps_per_mm; - if (accel > max_accel_steps_per_s2) { - accel = max_accel_steps_per_s2; - if (ENABLED(LA_DEBUG)) SERIAL_ECHOLNPGM("Acceleration limited."); - } + #if HAS_ROUGH_LIN_ADVANCE + // Scale E acceleration so that it will be possible to jump to the advance speed. + const uint32_t max_accel_steps_per_s2 = MAX_E_JERK(extruder) / (extruder_advance_K[E_INDEX_N(extruder)] * e_D_ratio) * steps_per_mm; + if (accel > max_accel_steps_per_s2) { + accel = max_accel_steps_per_s2; + if (TERN0(LA_DEBUG, DEBUGGING(INFO))) SERIAL_ECHOLNPGM("Acceleration limited."); + } + #endif } } - #endif + #endif // LIN_ADVANCE // Limit acceleration per axis if (block->step_event_count <= acceleration_long_cutoff) { @@ -2443,10 +2460,9 @@ bool Planner::_populate_block( block->acceleration_rate = uint32_t(accel * (float(1UL << 24) / (STEPPER_TIMER_RATE))); #endif - #if ENABLED(LIN_ADVANCE) + #if HAS_ROUGH_LIN_ADVANCE block->la_advance_rate = 0; block->la_scaling = 0; - if (use_advance_lead) { // The Bresenham algorithm will convert this step rate into extruder steps block->la_advance_rate = extruder_advance_K[E_INDEX_N(extruder)] * block->acceleration_steps_per_s2; @@ -2456,12 +2472,14 @@ bool Planner::_populate_block( for (uint32_t dividend = block->steps.e << 1; dividend <= (block->step_event_count >> 2); dividend <<= 1) block->la_scaling++; - #if ENABLED(LA_DEBUG) - if (block->la_advance_rate >> block->la_scaling > 10000) + // Output debugging if the rate gets very high + if (TERN0(LA_DEBUG, DEBUGGING(INFO)) && block->la_advance_rate >> block->la_scaling > 10000) SERIAL_ECHOLNPGM("eISR running at > 10kHz: ", block->la_advance_rate); - #endif } - #endif // LIN_ADVANCE + #elif ENABLED(SMOOTH_LIN_ADVANCE) + block->use_advance_lead = use_advance_lead; + block->e_step_ratio = (block->direction_bits.e ? 1 : -1) * float(block->steps.e) / block->step_event_count; + #endif // Formula for the average speed over a 1 step worth of distance if starting from zero and // accelerating at the current limit. Since we can only change the speed every step this is a @@ -2688,7 +2706,8 @@ bool Planner::_populate_block( } #endif - #if ENABLED(LIN_ADVANCE) + // In the SMOOTH_LIN_ADVANCE case, the extra jerk will be applied by the residual current la_step_rate. + #if HAS_ROUGH_LIN_ADVANCE // Advance affects E_AXIS speed and therefore jerk. Add a speed correction whenever // LA is turned OFF. No correction is applied when LA is turned ON (because it didn't // perform well; it takes more time/effort to push/melt filament than the reverse). @@ -2703,7 +2722,7 @@ bool Planner::_populate_block( // Prepare for next segment. previous_advance_rate = block->la_advance_rate; previous_e_mm_per_step = mm_per_step[E_AXIS_N(extruder)]; - #endif + #endif // HAS_ROUGH_LIN_ADVANCE xyze_float_t speed_diff = current_speed; float vmax_junction; diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index e8bacddd9f..a2f91edc81 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -43,6 +43,11 @@ #define JD_USE_LOOKUP_TABLE #endif +#if ENABLED(SMOOTH_LIN_ADVANCE) + #define SMOOTH_LIN_ADV_EXP_ORDER 5 // Closest to Gaussian smoothing between 3 and 7 + #define SMOOTH_LIN_ADV_INTERVAL (STEPPER_TIMER_RATE / SMOOTH_LIN_ADV_HZ) // Hz +#endif + #include "motion.h" #include "../gcode/queue.h" @@ -240,11 +245,17 @@ typedef struct PlannerBlock { uint32_t accelerate_before, // The index of the step event where cruising starts decelerate_start; // The index of the step event on which to start decelerating - #if ENABLED(S_CURVE_ACCELERATION) + #if ENABLED(SMOOTH_LIN_ADVANCE) + uint32_t cruise_time; // Cruise time in STEP timer counts + float e_step_ratio; + #endif + #if ANY(S_CURVE_ACCELERATION, SMOOTH_LIN_ADVANCE) uint32_t cruise_rate, // The actual cruise rate to use, between end of the acceleration phase and start of deceleration phase acceleration_time, // Acceleration time and deceleration time in STEP timer counts - deceleration_time, - acceleration_time_inverse, // Inverse of acceleration and deceleration periods, expressed as integer. Scale depends on CPU being used + deceleration_time; + #endif + #if ENABLED(S_CURVE_ACCELERATION) + uint32_t acceleration_time_inverse, // Inverse of acceleration and deceleration periods, expressed as integer. Scale depends on CPU being used deceleration_time_inverse; #else uint32_t acceleration_rate; // Acceleration rate in (2^24 steps)/timer_ticks*s @@ -254,10 +265,14 @@ typedef struct PlannerBlock { // Advance extrusion #if ENABLED(LIN_ADVANCE) - uint32_t la_advance_rate; // The rate at which steps are added whilst accelerating - uint8_t la_scaling; // Scale ISR frequency down and step frequency up by 2 ^ la_scaling - uint16_t max_adv_steps, // Max advance steps to get cruising speed pressure - final_adv_steps; // Advance steps for exit speed pressure + #if ENABLED(SMOOTH_LIN_ADVANCE) + bool use_advance_lead; + #else + uint32_t la_advance_rate; // The rate at which steps are added whilst accelerating + uint8_t la_scaling; // Scale ISR frequency down and step frequency up by 2 ^ la_scaling + uint16_t max_adv_steps, // Max advance steps to get cruising speed pressure + final_adv_steps; // Advance steps for exit speed pressure + #endif #endif uint32_t nominal_rate, // The nominal step rate for this block in step_events/sec @@ -1041,6 +1056,14 @@ class Planner { */ static block_t* get_current_block(); + /** + * Get a planned upcoming block from the buffer. + * Return nullptr if the buffer doesn't have the `current + offset` yet. + * + * WARNING: Called from Stepper ISR context! + */ + static block_t* get_future_block(const uint8_t offset); + /** * "Release" the current block so its slot can be reused. * Called when the current block is no longer needed. diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index a6714b3e6a..feb433041e 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -500,7 +500,12 @@ typedef struct SettingsDataStruct { // // LIN_ADVANCE // - float planner_extruder_advance_K[DISTINCT_E]; // M900 K planner.extruder_advance_K + #if ENABLED(LIN_ADVANCE) + float planner_extruder_advance_K[DISTINCT_E]; // M900 K planner.extruder_advance_K + #if ENABLED(SMOOTH_LIN_ADVANCE) + float stepper_extruder_advance_tau[DISTINCT_E]; // M900 U stepper.extruder_advance_tau + #endif + #endif // // HAS_MOTOR_CURRENT_PWM @@ -1554,13 +1559,13 @@ void MarlinSettings::postprocess() { // Linear Advance // { - _FIELD_TEST(planner_extruder_advance_K); - #if ENABLED(LIN_ADVANCE) + _FIELD_TEST(planner_extruder_advance_K); EEPROM_WRITE(planner.extruder_advance_K); - #else - dummyf = 0; - for (uint8_t q = DISTINCT_E; q--;) EEPROM_WRITE(dummyf); + #if ENABLED(SMOOTH_LIN_ADVANCE) + _FIELD_TEST(stepper_extruder_advance_tau); + EEPROM_WRITE(stepper.extruder_advance_tau); + #endif #endif } @@ -2633,15 +2638,27 @@ void MarlinSettings::postprocess() { // // Linear Advance // + #if ENABLED(LIN_ADVANCE) { float extruder_advance_K[DISTINCT_E]; _FIELD_TEST(planner_extruder_advance_K); EEPROM_READ(extruder_advance_K); - #if ENABLED(LIN_ADVANCE) - if (!validating) - COPY(planner.extruder_advance_K, extruder_advance_K); + if (!validating) + COPY(planner.extruder_advance_K, extruder_advance_K); + #if ENABLED(SMOOTH_LIN_ADVANCE) + _FIELD_TEST(stepper_extruder_advance_tau); + float tau[DISTINCT_E]; + EEPROM_READ(tau); + if (!validating) { + #if ENABLED(DISTINCT_E_FACTORS) + EXTRUDER_LOOP() stepper.set_advance_tau(tau[e], e); + #else + stepper.set_advance_tau(tau[0]); + #endif + } #endif } + #endif // // Motor Current PWM @@ -3742,6 +3759,15 @@ void MarlinSettings::reset() { #else planner.extruder_advance_K[0] = ADVANCE_K; #endif + #if ENABLED(SMOOTH_LIN_ADVANCE) + #if ENABLED(DISTINCT_E_FACTORS) + constexpr float linAdvanceTau[] = ADVANCE_TAU; + EXTRUDER_LOOP() + stepper.set_advance_tau(linAdvanceTau[_MAX(uint8_t(e), COUNT(linAdvanceTau) - 1)], e); + #else + stepper.set_advance_tau(ADVANCE_TAU); + #endif + #endif #endif // diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 1340cd9157..cc042181c6 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -256,10 +256,15 @@ uint32_t Stepper::advance_divisor = 0, #if ENABLED(LIN_ADVANCE) hal_timer_t Stepper::nextAdvanceISR = LA_ADV_NEVER, Stepper::la_interval = LA_ADV_NEVER; - int32_t Stepper::la_delta_error = 0, + #if HAS_ROUGH_LIN_ADVANCE + int32_t Stepper::la_delta_error = 0, Stepper::la_dividend = 0, Stepper::la_advance_steps = 0; - bool Stepper::la_active = false; + bool Stepper::la_active = false; + #else + uint32_t Stepper::curr_step_rate, + Stepper::curr_timer_tick = 0; + #endif #endif #if ENABLED(NONLINEAR_EXTRUSION) @@ -1521,6 +1526,10 @@ void Stepper::isr() { static hal_timer_t nextMainISR = 0; // Interval until the next main Stepper Pulse phase (0 = Now) + #if ENABLED(SMOOTH_LIN_ADVANCE) + static hal_timer_t smoothLinAdvISR = 0; + #endif + // Program timer compare for the maximum period, so it does NOT // flag an interrupt while this ISR is running - So changes from small // periods to big periods are respected and the timer does not reset to 0 @@ -1594,6 +1603,9 @@ void Stepper::isr() { // ^== Time critical. NOTHING besides pulse generation should be above here!!! if (!nextMainISR) nextMainISR = block_phase_isr(); // Manage acc/deceleration, get next block + #if ENABLED(SMOOTH_LIN_ADVANCE) + if (!smoothLinAdvISR) smoothLinAdvISR = smooth_lin_adv_isr(); // Manage la + #endif #if ENABLED(BABYSTEPPING) if (is_babystep) // Avoid ANY stepping too soon after baby-stepping @@ -1609,6 +1621,7 @@ void Stepper::isr() { TERN_(INPUT_SHAPING_Y, NOMORE(interval, ShapingQueue::peek_y())); // Time until next input shaping echo for Y TERN_(INPUT_SHAPING_Z, NOMORE(interval, ShapingQueue::peek_z())); // Time until next input shaping echo for Z TERN_(LIN_ADVANCE, NOMORE(interval, nextAdvanceISR)); // Come back early for Linear Advance? + TERN_(SMOOTH_LIN_ADVANCE, NOMORE(interval, smoothLinAdvISR)); // Come back early for Linear Advance rate update? TERN_(BABYSTEPPING, NOMORE(interval, nextBabystepISR)); // Come back early for Babystepping? // @@ -1621,6 +1634,7 @@ void Stepper::isr() { nextMainISR -= interval; TERN_(HAS_ZV_SHAPING, ShapingQueue::decrement_delays(interval)); TERN_(LIN_ADVANCE, if (nextAdvanceISR != LA_ADV_NEVER) nextAdvanceISR -= interval); + TERN_(SMOOTH_LIN_ADVANCE, if (smoothLinAdvISR != LA_ADV_NEVER) smoothLinAdvISR -= interval); TERN_(BABYSTEPPING, if (nextBabystepISR != BABYSTEP_NEVER) nextBabystepISR -= interval); } // standard motion control @@ -2000,15 +2014,18 @@ void Stepper::pulse_phase_isr() { #if ANY(HAS_E0_STEP, MIXING_EXTRUDER) PULSE_PREP(E); + #endif - #if ENABLED(LIN_ADVANCE) - if (la_active && step_needed.e) { - // don't actually step here, but do subtract movements steps - // from the linear advance step count - step_needed.e = false; - la_advance_steps--; - } - #endif + #if HAS_ROUGH_LIN_ADVANCE + if (la_active && step_needed.e) { + // don't actually step here, but do subtract movements steps + // from the linear advance step count + step_needed.e = false; + la_advance_steps--; + } + #elif ENABLED(SMOOTH_LIN_ADVANCE) + // Extruder steps are exclusively managed by the LA isr + step_needed.e = false; #endif #if HAS_ZV_SHAPING @@ -2458,7 +2475,7 @@ hal_timer_t Stepper::block_phase_isr() { calc_nonlinear_e(acc_step_rate << oversampling_factor); #endif - #if ENABLED(LIN_ADVANCE) + #if HAS_ROUGH_LIN_ADVANCE if (la_active) { const uint32_t la_step_rate = la_advance_steps < current_block->max_adv_steps ? current_block->la_advance_rate : 0; la_interval = calc_timer_interval((acc_step_rate + la_step_rate) >> current_block->la_scaling); @@ -2487,6 +2504,7 @@ hal_timer_t Stepper::block_phase_isr() { else cutter.apply_power(0); } #endif + TERN_(SMOOTH_LIN_ADVANCE, curr_step_rate = acc_step_rate;) } // Are we in Deceleration phase ? else if (step_events_completed >= decelerate_start) { @@ -2523,7 +2541,7 @@ hal_timer_t Stepper::block_phase_isr() { calc_nonlinear_e(step_rate << oversampling_factor); #endif - #if ENABLED(LIN_ADVANCE) + #if HAS_ROUGH_LIN_ADVANCE 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) { @@ -2561,7 +2579,7 @@ hal_timer_t Stepper::block_phase_isr() { } } #endif - + TERN_(SMOOTH_LIN_ADVANCE, curr_step_rate = step_rate;) } else { // Must be in cruise phase otherwise @@ -2571,13 +2589,14 @@ hal_timer_t Stepper::block_phase_isr() { ticks_nominal = calc_multistep_timer_interval(current_block->nominal_rate << oversampling_factor); // Prepare for deceleration IF_DISABLED(S_CURVE_ACCELERATION, acc_step_rate = current_block->nominal_rate); + TERN_(SMOOTH_LIN_ADVANCE, curr_step_rate = current_block->nominal_rate;) deceleration_time = ticks_nominal / 2; #if ENABLED(NONLINEAR_EXTRUSION) calc_nonlinear_e(current_block->nominal_rate << oversampling_factor); #endif - #if ENABLED(LIN_ADVANCE) + #if HAS_ROUGH_LIN_ADVANCE if (la_active) la_interval = calc_timer_interval(current_block->nominal_rate >> current_block->la_scaling); #endif @@ -2712,7 +2731,8 @@ hal_timer_t Stepper::block_phase_isr() { step_event_count = current_block->step_event_count << oversampling_factor; // Initialize Bresenham delta errors to 1/2 - delta_error = TERN_(LIN_ADVANCE, la_delta_error =) -int32_t(step_event_count); + delta_error = -int32_t(step_event_count); + TERN_(HAS_ROUGH_LIN_ADVANCE, la_delta_error = delta_error); // Calculate Bresenham dividends and divisors advance_dividend = (current_block->steps << 1).asLong(); @@ -2762,12 +2782,12 @@ hal_timer_t Stepper::block_phase_isr() { E_TERN_(stepper_extruder = current_block->extruder); // Initialize the trapezoid generator from the current block. - #if ENABLED(LIN_ADVANCE) - la_active = (current_block->la_advance_rate != 0); + #if HAS_ROUGH_LIN_ADVANCE #if DISABLED(MIXING_EXTRUDER) && E_STEPPERS > 1 // If the now active extruder wasn't in use during the last move, its pressure is most likely gone. if (stepper_extruder != last_moved_extruder) la_advance_steps = 0; #endif + la_active = (current_block->la_advance_rate != 0); if (la_active) { // Apply LA scaling and discount the effect of frequency scaling la_dividend = (advance_dividend.e << current_block->la_scaling) << oversampling_factor; @@ -2849,10 +2869,14 @@ hal_timer_t Stepper::block_phase_isr() { #endif #if ENABLED(LIN_ADVANCE) - if (la_active) { - const uint32_t la_step_rate = la_advance_steps < current_block->max_adv_steps ? current_block->la_advance_rate : 0; - la_interval = calc_timer_interval((current_block->initial_rate + la_step_rate) >> current_block->la_scaling); - } + #if ENABLED(SMOOTH_LIN_ADVANCE) + curr_timer_tick = 0; + #else + if (la_active) { + const uint32_t la_step_rate = la_advance_steps < current_block->max_adv_steps ? current_block->la_advance_rate : 0; + la_interval = calc_timer_interval((current_block->initial_rate + la_step_rate) >> current_block->la_scaling); + } + #endif #endif } } // !current_block @@ -2863,17 +2887,176 @@ hal_timer_t Stepper::block_phase_isr() { #if ENABLED(LIN_ADVANCE) + #if ENABLED(SMOOTH_LIN_ADVANCE) + + float Stepper::extruder_advance_tau[DISTINCT_E], + Stepper::extruder_advance_tau_ticks[DISTINCT_E], + Stepper::extruder_advance_alpha[DISTINCT_E]; + + void Stepper::set_la_interval(const int32_t rate) { + if (rate == 0) { + la_interval = LA_ADV_NEVER; + } + else { + const bool forward_e = rate > 0; + la_interval = calc_timer_interval(uint32_t(ABS(rate))); + if (forward_e != motor_direction(E_AXIS)) { + last_direction_bits.toggle(E_AXIS); + count_direction.e = -count_direction.e; + DIR_WAIT_BEFORE(); + E_APPLY_DIR(forward_e, false); + TERN_(FT_MOTION, last_set_direction = last_direction_bits); + DIR_WAIT_AFTER(); + } + } + } + + #if ENABLED(INPUT_SHAPING_E_SYNC) + + constexpr uint16_t IS_COMPENSATION_BUFFER_SIZE = uint16_t(float(SMOOTH_LIN_ADV_HZ) / float(SHAPING_MIN_FREQ) / 2.0f + 0.5f); + + typedef struct { + xy_float_t buffer[IS_COMPENSATION_BUFFER_SIZE]; + uint16_t index; + } DelayBuffer; + + DelayBuffer delayBuffer; + + void add_to_buffer(xy_float_t input) { + delayBuffer.buffer[delayBuffer.index++] = input; + if (delayBuffer.index == IS_COMPENSATION_BUFFER_SIZE) + delayBuffer.index = 0; + } + + xy_float_t lookback(shaping_time_t t /* in stepper timer ticks */) { + constexpr float ADV_TICKS_PER_STEPPER_TICKS = float(SMOOTH_LIN_ADV_HZ) / (STEPPER_TIMER_RATE); + uint32_t delay_steps = t * ADV_TICKS_PER_STEPPER_TICKS + 0.5f; // Convert time to steps + uint16_t past_i; + if (delay_steps>= IS_COMPENSATION_BUFFER_SIZE) { + // this means the buffer is too small. TODO: how to inform user? + past_i = delayBuffer.index; + } + else { + past_i = (delayBuffer.index + IS_COMPENSATION_BUFFER_SIZE - delay_steps) % IS_COMPENSATION_BUFFER_SIZE; + } + return delayBuffer.buffer[past_i]; + } + + #endif // INPUT_SHAPING_E_SYNC + + float lookahead(uint32_t t) { + for (uint8_t i = 0; block_t *block = Planner::get_future_block(i); i++) { + if (block->is_sync()) continue; + if (t <= block->acceleration_time) { + if (!block->use_advance_lead) return 0.0f; + uint32_t rate = STEP_MULTIPLY(t, block->acceleration_rate) + block->initial_rate; + NOMORE(rate, block->nominal_rate); + return rate * block->e_step_ratio; + } + t -= block->acceleration_time; + + if (t <= block->cruise_time) { + if (!block->use_advance_lead) return 0.0f; + return block->cruise_rate * block->e_step_ratio; + } + t -= block->cruise_time; + + if (t <= block->deceleration_time) { + if (!block->use_advance_lead) return 0.0f; + uint32_t rate = STEP_MULTIPLY(t, block->acceleration_rate); + if (rate < block->cruise_rate) { + rate = block->cruise_rate - rate; + NOLESS(rate, block->final_rate); + } + else + rate = block->final_rate; + return rate * block->e_step_ratio; + } + t -= block->deceleration_time; + } + return 0.0f; + } + + hal_timer_t Stepper::smooth_lin_adv_isr() { + float target_adv_steps = 0; + if (current_block) { + const uint32_t t = extruder_advance_tau_ticks[0] + curr_timer_tick; + target_adv_steps = lookahead(t) * Planner::extruder_advance_K[0]; + } + else { + curr_step_rate = 0; + } + static float last_target_adv_steps = 0; + constexpr float dt_inv = SMOOTH_LIN_ADV_HZ; + float la_step_rate = (target_adv_steps - last_target_adv_steps) * dt_inv; + last_target_adv_steps = target_adv_steps; + + static float smoothed_vals[SMOOTH_LIN_ADV_EXP_ORDER] = {0}; + for (uint8_t i = 0; i < SMOOTH_LIN_ADV_EXP_ORDER; i++) { + // Approximate gaussian smoothing via higher order exponential smoothing + la_step_rate = extruder_advance_alpha[0] * la_step_rate + (1 - extruder_advance_alpha[0]) * smoothed_vals[i]; + smoothed_vals[i] = la_step_rate; + } + const float planned_step_rate = current_block ? curr_step_rate * current_block->e_step_ratio : 0; + float total_step_rate = la_step_rate + planned_step_rate; + + #if ENABLED(INPUT_SHAPING_E_SYNC) + + xy_float_t pre_shaping_rate = xy_float_t({0, 0}), + first_pulse_rate = xy_float_t({0, 0}); + float unshaped_rate_e = total_step_rate; + if (current_block) { + const float xy_length = TERN0(INPUT_SHAPING_X, current_block->steps.x) + TERN0(INPUT_SHAPING_Y, current_block->steps.y); + if (xy_length > 0) { + unshaped_rate_e = 0; + pre_shaping_rate = xy_float_t({ + TERN0(INPUT_SHAPING_X, total_step_rate * current_block->steps.x / xy_length), + TERN0(INPUT_SHAPING_Y, total_step_rate * current_block->steps.y / xy_length) + }); + first_pulse_rate = xy_float_t({ + TERN0(INPUT_SHAPING_X, pre_shaping_rate.x * Stepper::shaping_x.factor1 / 128.0f), + TERN0(INPUT_SHAPING_Y, pre_shaping_rate.y * Stepper::shaping_y.factor1 / 128.0f) + }); + } + } + const xy_float_t second_pulse_rate = { + TERN0(INPUT_SHAPING_X, lookback(ShapingQueue::get_delay_x()).x * Stepper::shaping_x.factor2 / 128.0f), + TERN0(INPUT_SHAPING_Y, lookback(ShapingQueue::get_delay_y()).y * Stepper::shaping_y.factor2 / 128.0f) + }; + add_to_buffer(pre_shaping_rate); + + const float x = TERN0(INPUT_SHAPING_X, first_pulse_rate.x + second_pulse_rate.x), + y = TERN0(INPUT_SHAPING_Y, first_pulse_rate.y + second_pulse_rate.y); + + total_step_rate = unshaped_rate_e + x + y; + + #endif // INPUT_SHAPING_E_SYNC + + set_la_interval(total_step_rate); + + curr_timer_tick += SMOOTH_LIN_ADV_INTERVAL; + return SMOOTH_LIN_ADV_INTERVAL; + } + #endif // SMOOTH_LIN_ADVANCE + // Timer interrupt for E. LA_steps is set in the main routine void Stepper::advance_isr() { // Apply Bresenham algorithm so that linear advance can piggy back on // the acceleration and speed values calculated in block_phase_isr(). // This helps keep LA in sync with, for example, S_CURVE_ACCELERATION. - la_delta_error += la_dividend; - const bool e_step_needed = la_delta_error >= 0; + #if HAS_ROUGH_LIN_ADVANCE + la_delta_error += la_dividend; + const bool e_step_needed = la_delta_error >= 0; + #else + constexpr bool e_step_needed = true; + #endif + if (e_step_needed) { count_position.e += count_direction.e; - la_advance_steps += count_direction.e; - la_delta_error -= advance_divisor; + #if HAS_ROUGH_LIN_ADVANCE + la_advance_steps += count_direction.e; + la_delta_error -= advance_divisor; + #endif // Set the STEP pulse ON E_STEP_WRITE(TERN(MIXING_EXTRUDER, mixer.get_next_stepper(), stepper_extruder), STEP_STATE_E); diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h index 306b2151b5..83ada9202e 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -241,18 +241,21 @@ constexpr ena_mask_t enable_overlap[] = { static bool dequeue_x() { SHAPING_QUEUE_DEQUEUE(x) } static bool empty_x() { return head_x == tail; } static uint16_t free_count_x() { return _free_count_x; } + static uint16_t get_delay_x() { return delay_x; } #endif #if ENABLED(INPUT_SHAPING_Y) static shaping_time_t peek_y() { return _peek_y; } static bool dequeue_y() { SHAPING_QUEUE_DEQUEUE(y) } static bool empty_y() { return head_y == tail; } static uint16_t free_count_y() { return _free_count_y; } + static uint16_t get_delay_y() { return delay_y; } #endif #if ENABLED(INPUT_SHAPING_Z) static shaping_time_t peek_z() { return _peek_z; } static bool dequeue_z() { SHAPING_QUEUE_DEQUEUE(z) } static bool empty_z() { return head_z == tail; } static uint16_t free_count_z() { return _free_count_z; } + static uint16_t get_delay_z() { return delay_z; } #endif static void purge() { const auto st = shaping_time_t(-1); @@ -292,6 +295,7 @@ constexpr ena_mask_t enable_overlap[] = { class Stepper { friend class Max7219; friend class FTMotion; + friend class MarlinSettings; friend void stepperTask(void *); public: @@ -348,6 +352,16 @@ class Stepper { static constexpr bool adaptive_step_smoothing_enabled = true; #endif + #if ENABLED(SMOOTH_LIN_ADVANCE) + static void set_advance_tau(const_float_t tau, const uint8_t e=E_INDEX_N(active_extruder)) { + extruder_advance_tau[e] = tau; + extruder_advance_tau_ticks[e] = tau * (STEPPER_TIMER_RATE); // i.e., <= STEPPER_TIMER_RATE / 2 + // α=1−exp(−dt/τ) + extruder_advance_alpha[e] = 1.0f - expf(-(SMOOTH_LIN_ADV_INTERVAL) * (SMOOTH_LIN_ADV_EXP_ORDER) / extruder_advance_tau_ticks[e]); + } + static float get_advance_tau(const uint8_t e=E_INDEX_N(active_extruder)) { return extruder_advance_tau[e]; } + #endif + private: static block_t* current_block; // A pointer to the block currently being traced @@ -434,11 +448,20 @@ class Stepper { #if ENABLED(LIN_ADVANCE) static constexpr hal_timer_t LA_ADV_NEVER = HAL_TIMER_TYPE_MAX; static hal_timer_t nextAdvanceISR, - la_interval; // Interval between ISR calls for LA - static int32_t la_delta_error, // Analogue of delta_error.e for E steps in LA ISR - la_dividend, // Analogue of advance_dividend.e for E steps in LA ISR - la_advance_steps; // Count of steps added to increase nozzle pressure - static bool la_active; // Whether linear advance is used on the present segment. + la_interval; // Interval between ISR calls for LA + #if ENABLED(SMOOTH_LIN_ADVANCE) + static uint32_t curr_timer_tick, // Current tick relative to block start + curr_step_rate; // Current motion step rate + static float extruder_advance_tau[DISTINCT_E], // Smoothing time; also the lookahead time of the smoother + extruder_advance_tau_ticks[DISTINCT_E], // Same as extruder_advance_tau but in in stepper timer ticks + extruder_advance_alpha[DISTINCT_E]; // The smoothing factor of each stage of the high-order exponential + // smoothing filter (calculated from tau) + #else + static int32_t la_delta_error, // Analogue of delta_error.e for E steps in LA ISR + la_dividend, // Analogue of advance_dividend.e for E steps in LA ISR + la_advance_steps; // Count of steps added to increase nozzle pressure + static bool la_active; // Whether linear advance is used on the present segment + #endif #endif #if ENABLED(NONLINEAR_EXTRUSION) @@ -504,6 +527,10 @@ class Stepper { #if ENABLED(LIN_ADVANCE) // The Linear advance ISR phase static void advance_isr(); + #if ENABLED(SMOOTH_LIN_ADVANCE) + static void set_la_interval(const int32_t rate); + static hal_timer_t smooth_lin_adv_isr(); + #endif #endif #if ENABLED(BABYSTEPPING) @@ -558,7 +585,7 @@ class Stepper { current_block = nullptr; axis_did_move.reset(); planner.release_current_block(); - TERN_(LIN_ADVANCE, la_interval = nextAdvanceISR = LA_ADV_NEVER); + TERN_(HAS_ROUGH_LIN_ADVANCE, la_interval = nextAdvanceISR = LA_ADV_NEVER); } // Quickly stop all steppers diff --git a/buildroot/tests/LPC1768 b/buildroot/tests/LPC1768 index 3a08af8ae8..cd911a9060 100755 --- a/buildroot/tests/LPC1768 +++ b/buildroot/tests/LPC1768 @@ -77,21 +77,19 @@ opt_set MOTHERBOARD BOARD_BTT_SKR_V1_4 SERIAL_PORT -1 \ Z_STEPPER_ALIGN_ITERATIONS 10 DEFAULT_STEPPER_TIMEOUT_SEC 0 \ SLOWDOWN_DIVISOR 16 SDCARD_CONNECTION ONBOARD BLOCK_BUFFER_SIZE 64 \ CHOPPER_TIMING CHOPPER_DEFAULT_24V MMU_SERIAL_PORT 0 -opt_enable PIDTEMPBED S_CURVE_ACCELERATION \ - USE_PROBE_FOR_Z_HOMING BLTOUCH FILAMENT_RUNOUT_SENSOR \ - AUTO_BED_LEVELING_BILINEAR RESTORE_LEVELING_AFTER_G28 \ - EXTRAPOLATE_BEYOND_GRID LCD_BED_LEVELING MESH_EDIT_MENU Z_SAFE_HOMING \ - EEPROM_SETTINGS EEPROM_AUTO_INIT NOZZLE_PARK_FEATURE SDSUPPORT \ - SPEAKER CR10_STOCKDISPLAY QUICK_HOME BLTOUCH_FORCE_SW_MODE \ - Z_STEPPER_AUTO_ALIGN INPUT_SHAPING_X INPUT_SHAPING_Y SHAPING_MENU \ - ADAPTIVE_STEP_SMOOTHING LCD_INFO_MENU STATUS_MESSAGE_SCROLLING \ - SET_PROGRESS_MANUALLY M73_REPORT SHOW_REMAINING_TIME \ - PRINT_PROGRESS_SHOW_DECIMALS AUTO_REPORT_SD_STATUS USE_BIG_EDIT_FONT \ - BABYSTEPPING BABYSTEP_WITHOUT_HOMING BABYSTEP_ALWAYS_AVAILABLE \ - DOUBLECLICK_FOR_Z_BABYSTEPPING BABYSTEP_DISPLAY_TOTAL LIN_ADVANCE \ - BEZIER_CURVE_SUPPORT EMERGENCY_PARSER ADVANCED_PAUSE_FEATURE \ - TMC_DEBUG HOST_ACTION_COMMANDS HOST_PAUSE_M76 HOST_PROMPT_SUPPORT \ - HOST_STATUS_NOTIFICATIONS MMU_DEBUG +opt_enable PIDTEMPBED FILAMENT_RUNOUT_SENSOR NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE \ + AUTO_BED_LEVELING_BILINEAR EXTRAPOLATE_BEYOND_GRID RESTORE_LEVELING_AFTER_G28 LCD_BED_LEVELING MESH_EDIT_MENU \ + BLTOUCH BLTOUCH_FORCE_SW_MODE USE_PROBE_FOR_Z_HOMING Z_SAFE_HOMING QUICK_HOME Z_STEPPER_AUTO_ALIGN \ + SDSUPPORT AUTO_REPORT_SD_STATUS \ + EEPROM_SETTINGS EEPROM_AUTO_INIT \ + CR10_STOCKDISPLAY USE_BIG_EDIT_FONT SPEAKER LCD_INFO_MENU STATUS_MESSAGE_SCROLLING \ + INPUT_SHAPING_X INPUT_SHAPING_Y SHAPING_MENU \ + BEZIER_CURVE_SUPPORT \ + LIN_ADVANCE SMOOTH_LIN_ADVANCE INPUT_SHAPING_E_SYNC \ + TMC_DEBUG ADAPTIVE_STEP_SMOOTHING \ + SET_PROGRESS_MANUALLY M73_REPORT SHOW_REMAINING_TIME PRINT_PROGRESS_SHOW_DECIMALS \ + BABYSTEPPING BABYSTEP_WITHOUT_HOMING BABYSTEP_ALWAYS_AVAILABLE DOUBLECLICK_FOR_Z_BABYSTEPPING BABYSTEP_DISPLAY_TOTAL \ + EMERGENCY_PARSER HOST_ACTION_COMMANDS HOST_PAUSE_M76 HOST_PROMPT_SUPPORT HOST_STATUS_NOTIFICATIONS MMU_DEBUG opt_disable Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN FILAMENT_LOAD_UNLOAD_GCODES \ PARK_HEAD_ON_PAUSE exec_test $1 $2 "BigTreeTech SKR 1.4 | MMU2" "$3" diff --git a/buildroot/tests/LPC1769 b/buildroot/tests/LPC1769 index f29bbb5656..5356d3e186 100755 --- a/buildroot/tests/LPC1769 +++ b/buildroot/tests/LPC1769 @@ -81,20 +81,20 @@ opt_set MOTHERBOARD BOARD_BTT_SKR_V1_4_TURBO SERIAL_PORT -1 \ SLOWDOWN_DIVISOR 16 SDCARD_CONNECTION ONBOARD BLOCK_BUFFER_SIZE 64 \ CHOPPER_TIMING CHOPPER_DEFAULT_24V MMU_SERIAL_PORT 0 \ Z_MIN_ENDSTOP_HIT_STATE HIGH -opt_enable PIDTEMPBED S_CURVE_ACCELERATION \ - USE_PROBE_FOR_Z_HOMING BLTOUCH FILAMENT_RUNOUT_SENSOR \ - AUTO_BED_LEVELING_BILINEAR RESTORE_LEVELING_AFTER_G28 \ - EXTRAPOLATE_BEYOND_GRID LCD_BED_LEVELING MESH_EDIT_MENU Z_SAFE_HOMING \ - EEPROM_SETTINGS EEPROM_AUTO_INIT NOZZLE_PARK_FEATURE SDSUPPORT \ - SPEAKER CR10_STOCKDISPLAY QUICK_HOME BLTOUCH_FORCE_SW_MODE \ - Z_STEPPER_AUTO_ALIGN INPUT_SHAPING_X INPUT_SHAPING_Y SHAPING_MENU \ - ADAPTIVE_STEP_SMOOTHING LCD_INFO_MENU STATUS_MESSAGE_SCROLLING \ +opt_enable PIDTEMPBED \ + FILAMENT_RUNOUT_SENSOR NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE \ + BLTOUCH BLTOUCH_FORCE_SW_MODE USE_PROBE_FOR_Z_HOMING Z_SAFE_HOMING QUICK_HOME Z_STEPPER_AUTO_ALIGN \ + AUTO_BED_LEVELING_BILINEAR EXTRAPOLATE_BEYOND_GRID RESTORE_LEVELING_AFTER_G28 LCD_BED_LEVELING MESH_EDIT_MENU \ + EEPROM_SETTINGS EEPROM_AUTO_INIT \ + SDSUPPORT CR10_STOCKDISPLAY SPEAKER LCD_INFO_MENU STATUS_MESSAGE_SCROLLING \ + INPUT_SHAPING_X INPUT_SHAPING_Y SHAPING_MENU \ + BEZIER_CURVE_SUPPORT LIN_ADVANCE \ + TMC_DEBUG S_CURVE_ACCELERATION ADAPTIVE_STEP_SMOOTHING \ SET_PROGRESS_MANUALLY M73_REPORT SHOW_REMAINING_TIME \ PRINT_PROGRESS_SHOW_DECIMALS AUTO_REPORT_SD_STATUS USE_BIG_EDIT_FONT \ BABYSTEPPING BABYSTEP_WITHOUT_HOMING BABYSTEP_ALWAYS_AVAILABLE \ - DOUBLECLICK_FOR_Z_BABYSTEPPING BABYSTEP_DISPLAY_TOTAL LIN_ADVANCE \ - BEZIER_CURVE_SUPPORT EMERGENCY_PARSER ADVANCED_PAUSE_FEATURE \ - TMC_DEBUG HOST_ACTION_COMMANDS HOST_PAUSE_M76 HOST_PROMPT_SUPPORT HOST_STATUS_NOTIFICATIONS \ + DOUBLECLICK_FOR_Z_BABYSTEPPING BABYSTEP_DISPLAY_TOTAL \ + EMERGENCY_PARSER HOST_ACTION_COMMANDS HOST_PAUSE_M76 HOST_PROMPT_SUPPORT HOST_STATUS_NOTIFICATIONS \ MMU3_SPOOL_JOIN_CONSUMES_ALL_FILAMENT MMU_MENUS MMU_DEBUG opt_disable Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN FILAMENT_LOAD_UNLOAD_GCODES PARK_HEAD_ON_PAUSE exec_test $1 $2 "BigTreeTech SKR 1.4 Turbo | MMU3" "$3" From 4b32be9df074df23ee084869af8a3ed3bd07c9f5 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Sun, 20 Apr 2025 09:04:48 -0700 Subject: [PATCH 38/86] =?UTF-8?q?=F0=9F=94=A7=20Malyan=20M300=20/=20Monopr?= =?UTF-8?q?ice=20Mini=20alternate=20orientation=20(#27808)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/stm32f0/pins_MALYAN_M300.h | 44 ++++++++++++++++------ 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/Marlin/src/pins/stm32f0/pins_MALYAN_M300.h b/Marlin/src/pins/stm32f0/pins_MALYAN_M300.h index 5bc8c5f74b..0a524e4952 100644 --- a/Marlin/src/pins/stm32f0/pins_MALYAN_M300.h +++ b/Marlin/src/pins/stm32f0/pins_MALYAN_M300.h @@ -46,9 +46,15 @@ // // Limit Switches // -#define X_STOP_PIN PC13 -#define Y_STOP_PIN PC14 -#define Z_STOP_PIN PC15 +#if ENABLED(M300_ROTATE_TOWERS) + #define X_STOP_PIN PC14 + #define Y_STOP_PIN PC15 + #define Z_STOP_PIN PC13 +#else + #define X_STOP_PIN PC13 + #define Y_STOP_PIN PC14 + #define Z_STOP_PIN PC15 +#endif #ifndef Z_MIN_PROBE_PIN #define Z_MIN_PROBE_PIN PB7 @@ -57,17 +63,31 @@ // // Steppers // -#define X_STEP_PIN PB14 -#define X_DIR_PIN PB13 -#define X_ENABLE_PIN PB10 +#if ENABLED(M300_ROTATE_TOWERS) + #define X_STEP_PIN PB12 + #define X_DIR_PIN PB11 + #define X_ENABLE_PIN PB10 -#define Y_STEP_PIN PB12 -#define Y_DIR_PIN PB11 -#define Y_ENABLE_PIN PB10 + #define Y_STEP_PIN PB2 + #define Y_DIR_PIN PB1 + #define Y_ENABLE_PIN PB10 -#define Z_STEP_PIN PB2 -#define Z_DIR_PIN PB1 -#define Z_ENABLE_PIN PB10 + #define Z_STEP_PIN PB14 + #define Z_DIR_PIN PB13 + #define Z_ENABLE_PIN PB10 +#else + #define X_STEP_PIN PB14 + #define X_DIR_PIN PB13 + #define X_ENABLE_PIN PB10 + + #define Y_STEP_PIN PB12 + #define Y_DIR_PIN PB11 + #define Y_ENABLE_PIN PB10 + + #define Z_STEP_PIN PB2 + #define Z_DIR_PIN PB1 + #define Z_ENABLE_PIN PB10 +#endif #define E0_STEP_PIN PA7 #define E0_DIR_PIN PA6 From d3687d933ca029626865d8465ef5ea728a262296 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 20 Apr 2025 11:27:15 -0500 Subject: [PATCH 39/86] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Add?= =?UTF-8?q?=20stepper/control.cpp=20(2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Conditionals-5-post.h | 2 +- Marlin/src/module/settings.cpp | 2 +- Marlin/src/module/stepper.cpp | 12 ---- Marlin/src/module/stepper/control.cpp | 87 +++++++++++++++------------ 4 files changed, 51 insertions(+), 52 deletions(-) diff --git a/Marlin/src/inc/Conditionals-5-post.h b/Marlin/src/inc/Conditionals-5-post.h index 920031dcdb..fd06285bca 100644 --- a/Marlin/src/inc/Conditionals-5-post.h +++ b/Marlin/src/inc/Conditionals-5-post.h @@ -3012,7 +3012,7 @@ #undef MICROSTEP_MODES #endif -#if MB(PRINTRBOARD_G2) || ANY(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_PWM, HAS_MICROSTEPS) +#if ANY(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_PWM, HAS_MICROSTEPS) #define HAS_STEPPER_CONTROL 1 #endif diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index feb433041e..8c99c54323 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -508,7 +508,7 @@ typedef struct SettingsDataStruct { #endif // - // HAS_MOTOR_CURRENT_PWM + // Stepper Motors Current // #ifndef MOTOR_CURRENT_COUNT #if HAS_MOTOR_CURRENT_PWM diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index cc042181c6..1d02620e6f 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -120,10 +120,6 @@ Stepper stepper; // Singleton #include "../feature/dac/dac_dac084s085.h" #endif -#if HAS_MOTOR_CURRENT_SPI - #include -#endif - #if ENABLED(MIXING_EXTRUDER) #include "../feature/mixing.h" #endif @@ -158,14 +154,6 @@ Stepper stepper; // Singleton bool Stepper::separate_multi_axis = false; #endif -#if HAS_MOTOR_CURRENT_SPI || HAS_MOTOR_CURRENT_PWM - bool Stepper::initialized; // = false - uint32_t Stepper::motor_current_setting[MOTOR_CURRENT_COUNT]; // Initialized by settings.load - #if HAS_MOTOR_CURRENT_SPI - constexpr uint32_t Stepper::digipot_count[]; - #endif -#endif - stepper_flags_t Stepper::axis_enabled; // {0} // private: diff --git a/Marlin/src/module/stepper/control.cpp b/Marlin/src/module/stepper/control.cpp index 0d523c8ed5..4d4b6b351f 100644 --- a/Marlin/src/module/stepper/control.cpp +++ b/Marlin/src/module/stepper/control.cpp @@ -30,14 +30,24 @@ #if MB(PRINTRBOARD_G2) #include HAL_PATH(../.., fastio/G2_PWM.h) +#elif HAS_MOTOR_CURRENT_SPI || HAS_MOTOR_CURRENT_PWM + #define HAS_NON_G2_MOTOR_CURRENT 1 +#endif + +#if HAS_MOTOR_CURRENT_PWM || HAS_NON_G2_MOTOR_CURRENT + bool Stepper::initialized; // = false + uint32_t Stepper::motor_current_setting[MOTOR_CURRENT_COUNT]; // Initialized by settings.load #endif /** - * Software-controlled Stepper Motor Current + * SPI-controlled Stepper Motor Current */ #if HAS_MOTOR_CURRENT_SPI + #include + constexpr uint32_t Stepper::digipot_count[]; + // From Arduino DigitalPotControl example void Stepper::set_digipot_value_spi(const int16_t address, const int16_t value) { WRITE(DIGIPOTSS_PIN, LOW); // Take the SS pin low to select the chip @@ -47,8 +57,36 @@ //delay(10); } + #if HAS_NON_G2_MOTOR_CURRENT + + void Stepper::set_digipot_current(const uint8_t driver, const int16_t current) { + if (WITHIN(driver, 0, COUNT(motor_current_setting) - 1)) + motor_current_setting[driver] = current; // update motor_current_setting + + if (!initialized) return; + + //SERIAL_ECHOLNPGM("Digipotss current ", current); + + const uint8_t digipot_ch[] = DIGIPOT_CHANNELS; + set_digipot_value_spi(digipot_ch[driver], current); + } + + void Stepper::digipot_init() { + SPI.begin(); + SET_OUTPUT(DIGIPOTSS_PIN); + + for (uint8_t i = 0; i < COUNT(motor_current_setting); ++i) + set_digipot_current(i, motor_current_setting[i]); + } + + #endif // HAS_NON_G2_MOTOR_CURRENT + #endif // HAS_MOTOR_CURRENT_SPI +/** + * PWM-controlled Stepper Motor Current + */ + #if HAS_MOTOR_CURRENT_PWM void Stepper::refresh_motor_power() { @@ -70,28 +108,13 @@ } } -#endif // HAS_MOTOR_CURRENT_PWM + #if HAS_NON_G2_MOTOR_CURRENT -/** - * PWM-controlled Stepper Motor Current - */ + void Stepper::set_digipot_current(const uint8_t driver, const int16_t current) { + if (WITHIN(driver, 0, COUNT(motor_current_setting) - 1)) + motor_current_setting[driver] = current; // update motor_current_setting -#if !MB(PRINTRBOARD_G2) && (HAS_MOTOR_CURRENT_SPI || HAS_MOTOR_CURRENT_PWM) - - void Stepper::set_digipot_current(const uint8_t driver, const int16_t current) { - if (WITHIN(driver, 0, COUNT(motor_current_setting) - 1)) - motor_current_setting[driver] = current; // update motor_current_setting - - if (!initialized) return; - - #if HAS_MOTOR_CURRENT_SPI - - //SERIAL_ECHOLNPGM("Digipotss current ", current); - - const uint8_t digipot_ch[] = DIGIPOT_CHANNELS; - set_digipot_value_spi(digipot_ch[driver], current); - - #elif HAS_MOTOR_CURRENT_PWM + if (!initialized) return; #define _WRITE_CURRENT_PWM(P) hal.set_pwm_duty(pin_t(MOTOR_CURRENT_PWM_## P ##_PIN), 255L * current / (MOTOR_CURRENT_PWM_RANGE)) switch (driver) { @@ -141,21 +164,9 @@ #endif break; } - #endif - } - - void Stepper::digipot_init() { - - #if HAS_MOTOR_CURRENT_SPI - - SPI.begin(); - SET_OUTPUT(DIGIPOTSS_PIN); - - for (uint8_t i = 0; i < COUNT(motor_current_setting); ++i) - set_digipot_current(i, motor_current_setting[i]); - - #elif HAS_MOTOR_CURRENT_PWM + } + void Stepper::digipot_init() { #ifdef __SAM3X8E__ #define _RESET_CURRENT_PWM_FREQ(P) NOOP #else @@ -204,11 +215,11 @@ #endif refresh_motor_power(); + } - #endif - } + #endif // HAS_NON_G2_MOTOR_CURRENT -#endif +#endif // HAS_MOTOR_CURRENT_PWM /** * Software-controlled Microstepping with digital pins From b23f86f83f6ff5f2e8fcedc4203ca081cbc58596 Mon Sep 17 00:00:00 2001 From: B Date: Sun, 20 Apr 2025 10:12:02 -0700 Subject: [PATCH 40/86] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20GD32?= =?UTF-8?q?=20fast=20write=20non-bool=20(#27806)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/GD32_MFL/fastio.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Marlin/src/HAL/GD32_MFL/fastio.h b/Marlin/src/HAL/GD32_MFL/fastio.h index 8185be73a4..35bd2b1ef7 100644 --- a/Marlin/src/HAL/GD32_MFL/fastio.h +++ b/Marlin/src/HAL/GD32_MFL/fastio.h @@ -27,9 +27,12 @@ #include #include -static inline void fast_write_pin_wrapper(pin_size_t IO, bool V) { - if (V) gpio::fast_set_pin(getPortFromPin(IO), getPinInPort(IO)); - else gpio::fast_clear_pin(getPortFromPin(IO), getPinInPort(IO)); +template +static inline void fast_write_pin_wrapper(pin_size_t IO, T V) { + auto port = getPortFromPin(IO); + auto pin = getPinInPort(IO); + if (static_cast(V)) gpio::fast_set_pin(port, pin); + else gpio::fast_clear_pin(port, pin); } static inline bool fast_read_pin_wrapper(pin_size_t IO) { From d434729da6ea38295fed76a23603767439b22e06 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 20 Apr 2025 19:25:12 -0500 Subject: [PATCH 41/86] =?UTF-8?q?=F0=9F=90=9B=F0=9F=94=A7=20Move=20extra?= =?UTF-8?q?=20volume=20flags?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Conditionals-2-LCD.h | 6 ------ Marlin/src/inc/Conditionals-4-adv.h | 10 ++++++++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Marlin/src/inc/Conditionals-2-LCD.h b/Marlin/src/inc/Conditionals-2-LCD.h index 633cd2beb6..2bf663b6f0 100644 --- a/Marlin/src/inc/Conditionals-2-LCD.h +++ b/Marlin/src/inc/Conditionals-2-LCD.h @@ -36,12 +36,6 @@ #if ENABLED(SDSUPPORT) #define HAS_MEDIA 1 #endif -#if ENABLED(MULTI_VOLUME) - #define HAS_MULTI_VOLUME 1 -#endif -#if ENABLED(USB_FLASH_DRIVE_SUPPORT) - #define HAS_USB_FLASH_DRIVE 1 -#endif // // Serial Port Info diff --git a/Marlin/src/inc/Conditionals-4-adv.h b/Marlin/src/inc/Conditionals-4-adv.h index ca096c7661..3b01077931 100644 --- a/Marlin/src/inc/Conditionals-4-adv.h +++ b/Marlin/src/inc/Conditionals-4-adv.h @@ -1246,8 +1246,14 @@ #define HOMING_BUMP_MM { 0, 0, 0 } #endif -#if HAS_USB_FLASH_DRIVE && NONE(USE_OTG_USB_HOST, USE_UHS3_USB) - #define USE_UHS2_USB +#if ENABLED(MULTI_VOLUME) + #define HAS_MULTI_VOLUME 1 +#endif +#if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define HAS_USB_FLASH_DRIVE 1 + #if NONE(USE_OTG_USB_HOST, USE_UHS3_USB) + #define USE_UHS2_USB + #endif #endif /** From 1e009c2aa5f3ca5c7d5671f28dec333b9a2f3686 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Mon, 21 Apr 2025 00:32:59 +0000 Subject: [PATCH 42/86] [cron] Bump distribution date (2025-04-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 85663d4899..50361ebc03 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 "2025-04-20" +//#define STRING_DISTRIBUTION_DATE "2025-04-21" /** * The protocol for communication to the host. Protocol indicates communication diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index f46988c11b..2462ecd50c 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 "2025-04-20" + #define STRING_DISTRIBUTION_DATE "2025-04-21" #endif /** From 24928f93bac5694daf00827316419cd224781fb0 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 21 Apr 2025 19:59:41 -0500 Subject: [PATCH 43/86] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20FastI?= =?UTF-8?q?O=20AT90USB=20pins=2046-47?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/AVR/fastio/fastio_AT90USB.h | 12 ++++++------ Marlin/src/HAL/AVR/pinsDebug.h | 8 ++++---- Marlin/src/gcode/config/M43.cpp | 20 ++++++++++---------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Marlin/src/HAL/AVR/fastio/fastio_AT90USB.h b/Marlin/src/HAL/AVR/fastio/fastio_AT90USB.h index 2119d168ab..a9af519ff3 100644 --- a/Marlin/src/HAL/AVR/fastio/fastio_AT90USB.h +++ b/Marlin/src/HAL/AVR/fastio/fastio_AT90USB.h @@ -363,8 +363,11 @@ #define AIO7_PWM 0 #define AIO7_DDR DDRF -//-- Begin not supported by Teensyduino -//-- don't use Arduino functions on these pins pinMode/digitalWrite/etc +//-- 46-47 are not supported by Teensyduino +//-- Don't use Arduino functions (pinMode, digitalWrite, etc.) on these pins +#define PIN_E2 46 +#define PIN_E3 47 + #define DIO46_PIN PINE2 #define DIO46_RPORT PINE #define DIO46_WPORT PORTE @@ -377,10 +380,7 @@ #define DIO47_PWM 0 #define DIO47_DDR DDRE -#define TEENSY_E2 46 -#define TEENSY_E3 47 - -//-- end not supported by Teensyduino +//-- #undef PA0 #define PA0_PIN PINA0 diff --git a/Marlin/src/HAL/AVR/pinsDebug.h b/Marlin/src/HAL/AVR/pinsDebug.h index e9bc09a4bf..c833964a29 100644 --- a/Marlin/src/HAL/AVR/pinsDebug.h +++ b/Marlin/src/HAL/AVR/pinsDebug.h @@ -377,16 +377,16 @@ void printPinPort(const pin_t pin) { // print port number uint8_t x; SERIAL_ECHOPGM(" Port: "); #if AVR_AT90USB1286_FAMILY - x = (pin == 46 || pin == 47) ? 'E' : digitalPinToPort_DEBUG(pin) + 64; + x = (pin == PIN_E2 || pin == PIN_E3) ? 'E' : 'A' + digitalPinToPort_DEBUG(pin) - 1; #else - x = digitalPinToPort_DEBUG(pin) + 64; + x = 'A' + digitalPinToPort_DEBUG(pin) - 1; #endif SERIAL_CHAR(x); #if AVR_AT90USB1286_FAMILY - if (pin == 46) + if (pin == PIN_E2) x = '2'; - else if (pin == 47) + else if (pin == PIN_E3) x = '3'; else { uint8_t temp = digitalPinToBitMask_DEBUG(pin); diff --git a/Marlin/src/gcode/config/M43.cpp b/Marlin/src/gcode/config/M43.cpp index 893607792a..a515acb241 100644 --- a/Marlin/src/gcode/config/M43.cpp +++ b/Marlin/src/gcode/config/M43.cpp @@ -79,20 +79,20 @@ inline void toggle_pins() { #endif ); #if AVR_AT90USB1286_FAMILY // Teensy IDEs don't know about these pins so must use FASTIO - if (pin == TEENSY_E2) { - SET_OUTPUT(TEENSY_E2); + if (pin == PIN_E2) { + SET_OUTPUT(PIN_E2); for (int16_t j = 0; j < repeat; j++) { - WRITE(TEENSY_E2, LOW); safe_delay(wait); - WRITE(TEENSY_E2, HIGH); safe_delay(wait); - WRITE(TEENSY_E2, LOW); safe_delay(wait); + WRITE(PIN_E2, LOW); safe_delay(wait); + WRITE(PIN_E2, HIGH); safe_delay(wait); + WRITE(PIN_E2, LOW); safe_delay(wait); } } - else if (pin == TEENSY_E3) { - SET_OUTPUT(TEENSY_E3); + else if (pin == PIN_E3) { + SET_OUTPUT(PIN_E3); for (int16_t j = 0; j < repeat; j++) { - WRITE(TEENSY_E3, LOW); safe_delay(wait); - WRITE(TEENSY_E3, HIGH); safe_delay(wait); - WRITE(TEENSY_E3, LOW); safe_delay(wait); + WRITE(PIN_E3, LOW); safe_delay(wait); + WRITE(PIN_E3, HIGH); safe_delay(wait); + WRITE(PIN_E3, LOW); safe_delay(wait); } } else From db3c5dd877fb41e2cd03ca3ff02c50e4f2bfcbbd Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 22 Apr 2025 06:09:47 +0000 Subject: [PATCH 44/86] [cron] Bump distribution date (2025-04-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 50361ebc03..59bbef9fda 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 "2025-04-21" +//#define STRING_DISTRIBUTION_DATE "2025-04-22" /** * The protocol for communication to the host. Protocol indicates communication diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 2462ecd50c..82956a1451 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 "2025-04-21" + #define STRING_DISTRIBUTION_DATE "2025-04-22" #endif /** From 9a901941aa118e88dcbbf3177e7d54495f34d909 Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Tue, 22 Apr 2025 13:01:14 -0400 Subject: [PATCH 45/86] =?UTF-8?q?=F0=9F=90=9B=20Watchdog=20Reset=20PIO=20o?= =?UTF-8?q?n=20DUE=20to=20prevent=20hang=20(#27803)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/HAL/DUE/HAL.cpp | 23 ++++++++------ Marlin/src/pins/pins.h | 30 +++++++++---------- .../PlatformIO/boards/marlin_archim.json | 2 +- ini/due.ini | 10 ++----- 4 files changed, 33 insertions(+), 32 deletions(-) diff --git a/Marlin/src/HAL/DUE/HAL.cpp b/Marlin/src/HAL/DUE/HAL.cpp index d1db9148c4..9b3cf1a516 100644 --- a/Marlin/src/HAL/DUE/HAL.cpp +++ b/Marlin/src/HAL/DUE/HAL.cpp @@ -102,6 +102,10 @@ void watchdogSetup() { #if ENABLED(USE_WATCHDOG) + #ifndef WATCHDOG_PIO_RESET + #define WATCHDOG_PIO_RESET + #endif + // 4 seconds timeout uint32_t timeout = TERN(WATCHDOG_DURATION_8S, 8000, 4000); @@ -115,15 +119,16 @@ void watchdogSetup() { timeout = 0xFFF; // We want to enable the watchdog with the specified timeout - uint32_t value = - WDT_MR_WDV(timeout) | // With the specified timeout - WDT_MR_WDD(timeout) | // and no invalid write window - #if !(SAMV70 || SAMV71 || SAME70 || SAMS70) - WDT_MR_WDRPROC | // WDT fault resets processor only - We want - // to keep PIO controller state - #endif - WDT_MR_WDDBGHLT | // WDT stops in debug state. - WDT_MR_WDIDLEHLT; // WDT stops in idle state. + uint32_t value = (0 + | WDT_MR_WDV(timeout) // With the specified timeout + | WDT_MR_WDD(timeout) // and no invalid write window + #if NONE(WATCHDOG_PIO_RESET, SAMV70, SAMV71, SAME70, SAMS70) + | WDT_MR_WDRPROC // WDT fault resets processor only with this flag. + // Omit to also reset the PIO controller. + #endif + | WDT_MR_WDDBGHLT // WDT stops in debug state. + | WDT_MR_WDIDLEHLT // WDT stops in idle state. + ); #if ENABLED(WATCHDOG_RESET_MANUAL) // We enable the watchdog timer, but only for the interrupt. diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index dcb8415de8..8c974cce48 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -516,33 +516,33 @@ // #elif MB(DUE3DOM) - #include "sam/pins_DUE3DOM.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_DUE3DOM.h" // SAM3X8E env:DUE env:DUE_USB #elif MB(DUE3DOM_MINI) - #include "sam/pins_DUE3DOM_MINI.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_DUE3DOM_MINI.h" // SAM3X8E env:DUE env:DUE_USB #elif MB(RADDS) - #include "sam/pins_RADDS.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_RADDS.h" // SAM3X8E env:DUE env:DUE_USB #elif MB(RAMPS_FD_V1) - #include "sam/pins_RAMPS_FD_V1.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_RAMPS_FD_V1.h" // SAM3X8E env:DUE env:DUE_USB #elif MB(RAMPS_FD_V2) - #include "sam/pins_RAMPS_FD_V2.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_RAMPS_FD_V2.h" // SAM3X8E env:DUE env:DUE_USB #elif MB(RAMPS_SMART_EFB, RAMPS_SMART_EEB, RAMPS_SMART_EFF, RAMPS_SMART_EEF, RAMPS_SMART_SF) - #include "sam/pins_RAMPS_SMART.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_RAMPS_SMART.h" // SAM3X8E env:DUE env:DUE_USB #elif MB(RAMPS_DUO_EFB, RAMPS_DUO_EEB, RAMPS_DUO_EFF, RAMPS_DUO_EEF, RAMPS_DUO_SF) - #include "sam/pins_RAMPS_DUO.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_RAMPS_DUO.h" // SAM3X8E env:DUE env:DUE_USB #elif MB(RAMPS4DUE_EFB, RAMPS4DUE_EEB, RAMPS4DUE_EFF, RAMPS4DUE_EEF, RAMPS4DUE_SF) - #include "sam/pins_RAMPS4DUE.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_RAMPS4DUE.h" // SAM3X8E env:DUE env:DUE_USB #elif MB(RURAMPS4D_11) - #include "sam/pins_RURAMPS4D_11.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_RURAMPS4D_11.h" // SAM3X8E env:DUE env:DUE_USB #elif MB(RURAMPS4D_13) - #include "sam/pins_RURAMPS4D_13.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_RURAMPS4D_13.h" // SAM3X8E env:DUE env:DUE_USB #elif MB(ULTRATRONICS_PRO) - #include "sam/pins_ULTRATRONICS_PRO.h" // SAM3X8E env:DUE env:DUE_debug + #include "sam/pins_ULTRATRONICS_PRO.h" // SAM3X8E env:DUE #elif MB(ARCHIM1) - #include "sam/pins_ARCHIM1.h" // SAM3X8E env:DUE_archim env:DUE_archim_debug + #include "sam/pins_ARCHIM1.h" // SAM3X8E env:DUE_archim #elif MB(ARCHIM2) - #include "sam/pins_ARCHIM2.h" // SAM3X8E env:DUE_archim env:DUE_archim_debug + #include "sam/pins_ARCHIM2.h" // SAM3X8E env:DUE_archim #elif MB(ALLIGATOR) - #include "sam/pins_ALLIGATOR_R2.h" // SAM3X8E env:DUE env:DUE_debug + #include "sam/pins_ALLIGATOR_R2.h" // SAM3X8E env:DUE #elif MB(CNCONTROLS_15D) #include "sam/pins_CNCONTROLS_15D.h" // SAM3X8E env:DUE env:DUE_USB #elif MB(KRATOS32) @@ -555,7 +555,7 @@ #elif MB(PRINTRBOARD_G2) #include "sam/pins_PRINTRBOARD_G2.h" // SAM3X8C env:DUE_USB #elif MB(ADSK) - #include "sam/pins_ADSK.h" // SAM3X8C env:DUE env:DUE_debug + #include "sam/pins_ADSK.h" // SAM3X8C env:DUE // // STM32 ARM Cortex-M0+ diff --git a/buildroot/share/PlatformIO/boards/marlin_archim.json b/buildroot/share/PlatformIO/boards/marlin_archim.json index 6d78c1f195..ee2ebd62ad 100644 --- a/buildroot/share/PlatformIO/boards/marlin_archim.json +++ b/buildroot/share/PlatformIO/boards/marlin_archim.json @@ -2,7 +2,7 @@ "build": { "core": "arduino", "cpu": "cortex-m3", - "extra_flags": "-D__SAM3X8E__ -DARDUINO_ARCH_SAM -DARDUINO_SAM_DUE", + "extra_flags": "-D__SAM3X8E__ -DARDUINO_SAM_DUE -DARDUINO_SAM_ARCHIM", "f_cpu": "84000000L", "hwids": [ [ diff --git a/ini/due.ini b/ini/due.ini index c1e2375d7c..7e4017e257 100644 --- a/ini/due.ini +++ b/ini/due.ini @@ -19,6 +19,7 @@ platform = atmelsam board = due build_src_filter = ${common.default_src_filter} + + +build_flags = -DWATCHDOG_PIO_RESET [env:DUE_USB] extends = env:DUE @@ -27,14 +28,9 @@ board = dueUSB # # Archim SAM # -[common_DUE_archim] +[env:DUE_archim] extends = env:DUE board = marlin_archim -build_flags = ${common.build_flags} - -DARDUINO_SAM_ARCHIM -DARDUINO_ARCH_SAM -D__SAM3X8E__ -DUSBCON board_build.variants_dir = buildroot/share/PlatformIO/variants/ extra_scripts = ${common.extra_scripts} - Marlin/src/HAL/DUE/upload_extra_script.py - -[env:DUE_archim] -extends = common_DUE_archim + Marlin/src/HAL/DUE/upload_extra_script.py From 28a1355f293d568e6f1ca70a0b63153bb1d5664b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 22 Apr 2025 15:12:13 -0500 Subject: [PATCH 46/86] =?UTF-8?q?=F0=9F=8C=90=20Fix=20extra=20MSG=5FATTACH?= =?UTF-8?q?=5FUSB=5FMEDIA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/language/language_ru.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Marlin/src/lcd/language/language_ru.h b/Marlin/src/lcd/language/language_ru.h index 991fd638ef..42e1656a8b 100644 --- a/Marlin/src/lcd/language/language_ru.h +++ b/Marlin/src/lcd/language/language_ru.h @@ -437,7 +437,7 @@ namespace LanguageNarrow_ru { LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("Выгрузить всё"); #if HAS_MULTI_VOLUME LSTR MSG_ATTACH_SD_MEDIA = _UxGT("Установить SD карту"); - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Установить флешка"); + LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Монтировать USB"); // Установить флешка #else LSTR MSG_ATTACH_MEDIA = _UxGT("Установить SD карту"); #endif @@ -766,7 +766,6 @@ namespace LanguageNarrow_ru { 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("Опустить перо"); From 4b419eefd2b35bd08df928481053ca45a3bf992d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 22 Apr 2025 17:41:59 -0500 Subject: [PATCH 47/86] =?UTF-8?q?=F0=9F=94=A5=20DEFAULT=5FVOLUME?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 9d291f6219..b1ad8d9629 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1960,7 +1960,6 @@ #if ENABLED(MULTI_VOLUME) #define VOLUME_SD_ONBOARD #define VOLUME_USB_FLASH_DRIVE - #define DEFAULT_VOLUME SV_SD_ONBOARD #define DEFAULT_SHARED_VOLUME SV_USB_FLASH_DRIVE #endif From 21dadce958f993b1e33e94a7e160f2926ecd2177 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Wed, 23 Apr 2025 00:30:30 +0000 Subject: [PATCH 48/86] [cron] Bump distribution date (2025-04-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 59bbef9fda..e9c1d9ba1b 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 "2025-04-22" +//#define STRING_DISTRIBUTION_DATE "2025-04-23" /** * The protocol for communication to the host. Protocol indicates communication diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 82956a1451..d06c53dd5e 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 "2025-04-22" + #define STRING_DISTRIBUTION_DATE "2025-04-23" #endif /** From efd875766a7e443e2078d70c44c05b3947316c3b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 22 Apr 2025 19:10:27 -0500 Subject: [PATCH 49/86] =?UTF-8?q?=F0=9F=9A=B8=20"Inverted"=20text=20on=20G?= =?UTF-8?q?LCD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/tft/themes/theme_ANET_BLACK.h | 1 + Marlin/src/lcd/tft/themes/theme_BLUE_MARLIN.h | 5 ++++- Marlin/src/lcd/tft/themes/theme_default.h | 3 +++ Marlin/src/lcd/tft/ui_common.cpp | 8 +++++--- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Marlin/src/lcd/tft/themes/theme_ANET_BLACK.h b/Marlin/src/lcd/tft/themes/theme_ANET_BLACK.h index d6a7bab671..67db585435 100644 --- a/Marlin/src/lcd/tft/themes/theme_ANET_BLACK.h +++ b/Marlin/src/lcd/tft/themes/theme_ANET_BLACK.h @@ -47,6 +47,7 @@ #define COLOR_SD_DISABLED COLOR_CONTROL_DISABLED #define COLOR_MENU_TEXT COLOR_WHITE #define COLOR_MENU_STATIC_TEXT COLOR_WHITE +#define COLOR_MENU_INVERT_TEXT COLOR_YELLOW #define COLOR_MENU_BACK_TEXT COLOR_YELLOW #define COLOR_MENU_EDIT_TEXT COLOR_LIME2 #define COLOR_MENU_VALUE_FONT COLOR_ORANGE2 diff --git a/Marlin/src/lcd/tft/themes/theme_BLUE_MARLIN.h b/Marlin/src/lcd/tft/themes/theme_BLUE_MARLIN.h index 7414a7f250..bbc3b6671f 100644 --- a/Marlin/src/lcd/tft/themes/theme_BLUE_MARLIN.h +++ b/Marlin/src/lcd/tft/themes/theme_BLUE_MARLIN.h @@ -106,9 +106,12 @@ #ifndef COLOR_MENU_TEXT #define COLOR_MENU_TEXT COLOR_YELLOW #endif -#ifndef COLOR_MENU_TEXT +#ifndef COLOR_MENU_STATIC_TEXT #define COLOR_MENU_STATIC_TEXT COLOR_SILVER #endif +#ifndef COLOR_MENU_INVERT_TEXT + #define COLOR_MENU_INVERT_TEXT COLOR_WHITE +#endif #ifndef COLOR_MENU_BACK_TEXT #define COLOR_MENU_BACK_TEXT COLOR_CYAN #endif diff --git a/Marlin/src/lcd/tft/themes/theme_default.h b/Marlin/src/lcd/tft/themes/theme_default.h index 17790c7557..6b7e789216 100644 --- a/Marlin/src/lcd/tft/themes/theme_default.h +++ b/Marlin/src/lcd/tft/themes/theme_default.h @@ -107,6 +107,9 @@ #ifndef COLOR_MENU_STATIC_TEXT #define COLOR_MENU_STATIC_TEXT COLOR_SILVER #endif +#ifndef COLOR_MENU_INVERT_TEXT + #define COLOR_MENU_INVERT_TEXT COLOR_WHITE +#endif #ifndef COLOR_MENU_BACK_TEXT #define COLOR_MENU_BACK_TEXT COLOR_WHITE #endif diff --git a/Marlin/src/lcd/tft/ui_common.cpp b/Marlin/src/lcd/tft/ui_common.cpp index 6d59e0ce8b..b16b3e80a0 100644 --- a/Marlin/src/lcd/tft/ui_common.cpp +++ b/Marlin/src/lcd/tft/ui_common.cpp @@ -390,10 +390,12 @@ void MenuItem_static::draw(const uint8_t row, FSTR_P const ftpl, const uint8_t s else tft_string.set(); + const uint16_t color = (style & SS_INVERT) ? COLOR_MENU_INVERT_TEXT : COLOR_MENU_STATIC_TEXT; + const bool center = bool(style & SS_CENTER), full = bool(style & SS_FULL); if (!full || !vstr) { if (vstr) tft_string.add(vstr); - tft.add_text(center ? tft_string.center(TFT_WIDTH) : 0, MENU_TEXT_Y, COLOR_MENU_STATIC_TEXT, tft_string); + tft.add_text(center ? tft_string.center(TFT_WIDTH) : 0, MENU_TEXT_Y, color, tft_string); return; } @@ -401,12 +403,12 @@ void MenuItem_static::draw(const uint8_t row, FSTR_P const ftpl, const uint8_t s if (*vstr == ':') { tft_string.add(':'); vstr++; } // Left-justified label - tft.add_text(0, MENU_TEXT_Y, COLOR_MENU_STATIC_TEXT, tft_string); + tft.add_text(0, MENU_TEXT_Y, color, tft_string); // Right-justified value, after spaces while (*vstr == ' ') vstr++; tft_string.set(vstr); - tft.add_text(TFT_WIDTH - 1 - tft_string.width(), MENU_TEXT_Y, COLOR_MENU_STATIC_TEXT, tft_string); + tft.add_text(TFT_WIDTH - 1 - tft_string.width(), MENU_TEXT_Y, color, tft_string); } #if HAS_MEDIA From 3696cc351313dce38213630435c3e45753391223 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 22 Apr 2025 19:11:30 -0500 Subject: [PATCH 50/86] =?UTF-8?q?=F0=9F=9A=B8=20Clear=20alert=20on=20menu?= =?UTF-8?q?=20click?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/menu/menu.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp index 96e6f6d073..6e22dfa23e 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -203,6 +203,15 @@ void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, co } #endif + // + // Clear alerts when exiting the Status Screen to the Main Menu + // + + if (currentScreen == status_screen && screen == menu_main) { + reset_alert_level(); + reset_status(); + } + // // Go to the new screen // From 7ee745b2da37b04cbd30ca01538acc37021efe09 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 23 Apr 2025 12:57:30 -0500 Subject: [PATCH 51/86] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20TFT?= =?UTF-8?q?=20GLCD=20"panel=5Fdetected"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp | 96 ++++++++++----------- 1 file changed, 46 insertions(+), 50 deletions(-) diff --git a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp index 6a80044a34..6766820cfd 100644 --- a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp +++ b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp @@ -135,7 +135,7 @@ static unsigned char framebuffer[FBSIZE]; static unsigned char *fb; static uint8_t cour_line; static uint8_t picBits, ledBits, hotBits; -static uint8_t PanelDetected = 0; +static bool panel_detected = false; // Different platforms use different SPI methods #if ANY(__AVR__, TARGET_LPC1768, __STM32F1__, ARDUINO_ARCH_SAM, __SAMD51__, __MK20DX256__, __MK64FX512__) @@ -169,13 +169,13 @@ void TFTGLCD::clear_buffer() { // Clear panel's screen void TFTGLCD::clr_screen() { - if (!PanelDetected) return; + if (!panel_detected) return; #if ENABLED(TFTGLCD_PANEL_SPI) WRITE(TFTGLCD_CS, LOW); SPI_SEND_ONE(CLR_SCREEN); WRITE(TFTGLCD_CS, HIGH); #else - Wire.beginTransmission((uint8_t)LCD_I2C_ADDRESS); //set I2C device address + Wire.beginTransmission(uint8_t(LCD_I2C_ADDRESS)); //set I2C device address Wire.write(CLR_SCREEN); Wire.endTransmission(); //transmit data #endif @@ -199,7 +199,7 @@ void TFTGLCD::print(const char *line) { // For menu void TFTGLCD::print_line() { - if (!PanelDetected) return; + if (!panel_detected) return; #if ENABLED(TFTGLCD_PANEL_SPI) WRITE(TFTGLCD_CS, LOW); SPI_SEND_ONE(LCD_PUT); @@ -207,7 +207,7 @@ void TFTGLCD::print_line() { SPI_SEND_SOME(framebuffer, LCD_WIDTH, cour_line * LCD_WIDTH); WRITE(TFTGLCD_CS, HIGH); #else - Wire.beginTransmission((uint8_t)LCD_I2C_ADDRESS); //set I2C device address + Wire.beginTransmission(uint8_t(LCD_I2C_ADDRESS)); //set I2C device address Wire.write(LCD_PUT); Wire.write(cour_line); Wire.write(&framebuffer[cour_line * LCD_WIDTH], LCD_WIDTH); //transfer 1 line to txBuffer @@ -217,7 +217,7 @@ void TFTGLCD::print_line() { } void TFTGLCD::print_screen() { - if (!PanelDetected) return; + if (!panel_detected) return; framebuffer[FBSIZE - 2] = picBits & PIC_MASK; framebuffer[FBSIZE - 1] = ledBits; #if ENABLED(TFTGLCD_PANEL_SPI) @@ -229,18 +229,18 @@ void TFTGLCD::print_screen() { #else uint8_t r; // Send framebuffer to panel by line - Wire.beginTransmission((uint8_t)LCD_I2C_ADDRESS); + Wire.beginTransmission(uint8_t(LCD_I2C_ADDRESS)); // First line Wire.write(LCD_WRITE); Wire.write(&framebuffer[0], LCD_WIDTH); Wire.endTransmission(); for (r = 1; r < (LCD_HEIGHT - 1); r++) { - Wire.beginTransmission((uint8_t)LCD_I2C_ADDRESS); + Wire.beginTransmission(uint8_t(LCD_I2C_ADDRESS)); Wire.write(&framebuffer[r * LCD_WIDTH], LCD_WIDTH); Wire.endTransmission(); } // Last line - Wire.beginTransmission((uint8_t)LCD_I2C_ADDRESS); + Wire.beginTransmission(uint8_t(LCD_I2C_ADDRESS)); Wire.write(&framebuffer[r * LCD_WIDTH], LCD_WIDTH); Wire.write(&framebuffer[FBSIZE - 2], 2); Wire.endTransmission(); @@ -248,14 +248,14 @@ void TFTGLCD::print_screen() { } void TFTGLCD::setContrast(uint16_t contrast) { - if (!PanelDetected) return; + if (!panel_detected) return; #if ENABLED(TFTGLCD_PANEL_SPI) WRITE(TFTGLCD_CS, LOW); SPI_SEND_ONE(CONTRAST); SPI_SEND_ONE((uint8_t)contrast); WRITE(TFTGLCD_CS, HIGH); #else - Wire.beginTransmission((uint8_t)LCD_I2C_ADDRESS); + Wire.beginTransmission(uint8_t(LCD_I2C_ADDRESS)); Wire.write(CONTRAST); Wire.write((uint8_t)contrast); Wire.endTransmission(); @@ -266,7 +266,7 @@ extern volatile int8_t encoderDiff; // Read buttons and encoder states uint8_t MarlinUI::read_slow_buttons() { - if (!PanelDetected) return 0; + if (!panel_detected) return 0; #if ENABLED(TFTGLCD_PANEL_SPI) uint8_t b = 0; WRITE(TFTGLCD_CS, LOW); @@ -283,13 +283,13 @@ uint8_t MarlinUI::read_slow_buttons() { WRITE(TFTGLCD_CS, HIGH); return b; #else - Wire.beginTransmission((uint8_t)LCD_I2C_ADDRESS); + Wire.beginTransmission(uint8_t(LCD_I2C_ADDRESS)); Wire.write(READ_ENCODER); Wire.endTransmission(); #ifdef __AVR__ - Wire.requestFrom((uint8_t)LCD_I2C_ADDRESS, 2, 0, 0, 1); + Wire.requestFrom(uint8_t(LCD_I2C_ADDRESS), 2, 0, 0, 1); #elif defined(STM32F1) - Wire.requestFrom((uint8_t)LCD_I2C_ADDRESS, (uint8_t)2); + Wire.requestFrom(uint8_t(LCD_I2C_ADDRESS), uint8_t(2)); #elif ANY(STM32F4xx, TARGET_LPC1768) Wire.requestFrom(LCD_I2C_ADDRESS, 2); #endif @@ -300,7 +300,7 @@ uint8_t MarlinUI::read_slow_buttons() { // Duration in ms, freq in Hz void MarlinUI::buzz(const long duration, const uint16_t freq/*=0*/) { - if (!PanelDetected) return; + if (!panel_detected) return; if (!sound_on) return; #if ENABLED(TFTGLCD_PANEL_SPI) WRITE(TFTGLCD_CS, LOW); @@ -309,20 +309,19 @@ void MarlinUI::buzz(const long duration, const uint16_t freq/*=0*/) { SPI_SEND_TWO(freq); WRITE(TFTGLCD_CS, HIGH); #else - Wire.beginTransmission((uint8_t)LCD_I2C_ADDRESS); + Wire.beginTransmission(uint8_t(LCD_I2C_ADDRESS)); Wire.write(BUZZER); - Wire.write((uint8_t)(duration >> 8)); - Wire.write((uint8_t)duration); - Wire.write((uint8_t)(freq >> 8)); - Wire.write((uint8_t)freq); + Wire.write(uint8_t(duration >> 8)); + Wire.write(uint8_t(duration)); + Wire.write(uint8_t(freq >> 8)); + Wire.write(uint8_t(freq)); Wire.endTransmission(); #endif } void MarlinUI::init_lcd() { - uint8_t t; lcd.clear_buffer(); - t = 0; + uint8_t t = 0; #if ENABLED(TFTGLCD_PANEL_SPI) // SPI speed must be less 10MHz SET_OUTPUT(TFTGLCD_CS); @@ -335,43 +334,40 @@ void MarlinUI::init_lcd() { #ifdef TARGET_LPC1768 Wire.begin(); //init twi/I2C #else - Wire.begin((uint8_t)LCD_I2C_ADDRESS); //init twi/I2C + Wire.begin(uint8_t(LCD_I2C_ADDRESS)); //init twi/I2C #endif - Wire.beginTransmission((uint8_t)LCD_I2C_ADDRESS); - Wire.write((uint8_t)GET_LCD_ROW); // put command to buffer + Wire.beginTransmission(uint8_t(LCD_I2C_ADDRESS)); + Wire.write(uint8_t(GET_LCD_ROW)); // put command to buffer Wire.endTransmission(); // send buffer #ifdef __AVR__ - Wire.requestFrom((uint8_t)LCD_I2C_ADDRESS, 1, 0, 0, 1); + Wire.requestFrom(uint8_t(LCD_I2C_ADDRESS), 1, 0, 0, 1); #elif ANY(STM32F1, STM32F4xx, TARGET_LPC1768) Wire.requestFrom(LCD_I2C_ADDRESS, 1); #endif t = (uint8_t)Wire.read(); #endif - if (t == LCD_HEIGHT) { - PanelDetected = 1; + panel_detected = (t == LCD_HEIGHT); + + if (panel_detected) { #if ENABLED(TFTGLCD_PANEL_SPI) SPI_SEND_ONE(INIT_SCREEN); SPI_SEND_ONE(Marlin); WRITE(TFTGLCD_CS, HIGH); #else - Wire.beginTransmission((uint8_t)LCD_I2C_ADDRESS); - Wire.write((uint8_t)INIT_SCREEN); + Wire.beginTransmission(uint8_t(LCD_I2C_ADDRESS)); + Wire.write(uint8_t(INIT_SCREEN)); Wire.write(Marlin); Wire.endTransmission(); #endif } - else - PanelDetected = 0; safe_delay(100); } -bool MarlinUI::detected() { - return PanelDetected; -} +bool MarlinUI::detected() { return panel_detected; } void MarlinUI::clear_lcd() { - if (!PanelDetected) return; + if (!panel_detected) return; lcd.clr_screen(); lcd.clear_buffer(); } @@ -395,7 +391,7 @@ static void center_text(FSTR_P const fstart, const uint8_t y) { #if ENABLED(SHOW_BOOTSCREEN) void MarlinUI::show_bootscreen() { - if (!PanelDetected) return; + if (!panel_detected) return; // // Show the Marlin logo, splash line1, and splash line 2 // @@ -418,7 +414,7 @@ static void center_text(FSTR_P const fstart, const uint8_t y) { #endif // SHOW_BOOTSCREEN void MarlinUI::draw_kill_screen() { - if (!PanelDetected) return; + if (!panel_detected) return; lcd.clear_buffer(); lcd_moveto(0, 3); lcd.write(COLOR_ERROR); lcd_moveto((LCD_WIDTH - status_message.glyphs()) / 2 + 1, 3); @@ -655,7 +651,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const #if ENABLED(LCD_PROGRESS_BAR) void MarlinUI::draw_progress_bar(const uint8_t percent) { - if (!PanelDetected) return; + if (!panel_detected) return; if (fb == &framebuffer[0] + LCD_WIDTH * 2) { // For status screen lcd.write('%'); lcd.write(percent); } @@ -672,7 +668,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const #endif // LCD_PROGRESS_BAR void MarlinUI::draw_status_message(const bool blink) { - if (!PanelDetected) return; + if (!panel_detected) return; lcd_moveto(0, 3); #if ALL(FILAMENT_LCD_DISPLAY, HAS_MEDIA) @@ -812,7 +808,7 @@ Equal to 24x10 text LCD */ void MarlinUI::draw_status_screen() { - if (!PanelDetected) return; + if (!panel_detected) return; const bool blink = get_blink(); @@ -959,7 +955,7 @@ void MarlinUI::draw_status_screen() { #if ENABLED(ADVANCED_PAUSE_FEATURE) void MarlinUI::draw_hotend_status(const uint8_t row, const uint8_t extruder) { - if (!PanelDetected) return; + if (!panel_detected) return; lcd_moveto((LCD_WIDTH - 14) / 2, row + 1); lcd.write(LCD_STR_THERMOMETER[0]); lcd_put_u8str(F(" E")); lcd.write('1' + extruder); lcd.write(' '); lcd.print(i16tostr3rj(thermalManager.wholeDegHotend(extruder))); lcd.write(LCD_STR_DEGREE[0]); lcd.write('/'); @@ -971,7 +967,7 @@ void MarlinUI::draw_status_screen() { // Draw a static item with no left-right margin required. Centered by default. void MenuItem_static::draw(const uint8_t row, FSTR_P const ftpl, const uint8_t style/*=SS_DEFAULT*/, const char *vstr/*=nullptr*/) { - if (!PanelDetected) return; + if (!panel_detected) return; lcd_moveto(0, row); uint8_t n = LCD_WIDTH; @@ -1019,7 +1015,7 @@ void MarlinUI::draw_status_screen() { // Draw a generic menu item with pre_char (if selected) and post_char void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char pre_char, const char post_char) { - if (!PanelDetected) return; + if (!panel_detected) return; lcd_moveto(0, row); lcd.write(sel ? pre_char : ' '); uint8_t n = LCD_WIDTH - 2; @@ -1031,7 +1027,7 @@ void MarlinUI::draw_status_screen() { // Draw a menu item with a (potentially) editable value void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char * const inStr, const bool pgm) { - if (!PanelDetected) return; + if (!panel_detected) return; const uint8_t vlen = inStr ? (pgm ? utf8_strlen_P(inStr) : utf8_strlen(inStr)) : 0; lcd_moveto(0, row); lcd.write(sel ? LCD_STR_ARROW_RIGHT[0] : ' '); @@ -1048,7 +1044,7 @@ void MarlinUI::draw_status_screen() { // Low-level draw_edit_screen can be used to draw an edit screen from anyplace // This line moves to the last line of the screen for UBL plot screen on the panel side void MenuEditItemBase::draw_edit_screen(FSTR_P const fstr, const char * const value/*=nullptr*/) { - if (!PanelDetected) return; + if (!panel_detected) return; ui.encoder_direction_normal(); const uint8_t y = TERN0(AUTO_BED_LEVELING_UBL, ui.external_control) ? LCD_HEIGHT - 1 : MIDDLE_Y; lcd_moveto(0, y); @@ -1066,7 +1062,7 @@ void MarlinUI::draw_status_screen() { // The Select Screen presents a prompt and two "buttons" void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, const bool yesno, FSTR_P const fpre, const char * const string, FSTR_P const fsuf) { - if (!PanelDetected) return; + if (!panel_detected) return; ui.draw_select_screen_prompt(fpre, string, fsuf); lcd.write(COLOR_EDIT); if (no) { @@ -1083,7 +1079,7 @@ void MarlinUI::draw_status_screen() { #if HAS_MEDIA void MenuItem_sdbase::draw(const bool sel, const uint8_t row, FSTR_P const, CardReader &theCard, const bool isDir) { - if (!PanelDetected) return; + if (!panel_detected) return; lcd_moveto(0, row); lcd.write(sel ? LCD_STR_ARROW_RIGHT[0] : ' '); uint8_t n = LCD_WIDTH - 2; @@ -1116,7 +1112,7 @@ void MarlinUI::draw_status_screen() { * |____________________| */ void MarlinUI::ubl_plot(const uint8_t x_plot, const uint8_t y_plot) { - if (!PanelDetected) return; + if (!panel_detected) return; #define _LCD_W_POS 12 From 3df75188f3b4bdff9463bbf16eebfae84c2b8733 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 23 Apr 2025 12:57:53 -0500 Subject: [PATCH 52/86] =?UTF-8?q?=F0=9F=9A=B8=20Fix=20TFT=20GLCD=20"Select?= =?UTF-8?q?=20from=20Media"=20glitch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/marlinui.cpp | 2 +- Marlin/src/lcd/menu/menu.h | 1 + Marlin/src/lcd/menu/menu_media.cpp | 45 +++++++++++++++++------------- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 384bf65211..7f78d21bf3 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -1114,7 +1114,7 @@ void MarlinUI::init() { #if MARLINUI_SCROLL_NAME // 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 && filename_scroll_max && !lcd_status_update_delay--) { + if (currentScreen == menu_media_filelist && filename_scroll_max && !lcd_status_update_delay--) { lcd_status_update_delay = ++filename_scroll_pos >= filename_scroll_max ? 12 : 4; // Long delay at end and start if (filename_scroll_pos > filename_scroll_max) filename_scroll_pos = 0; refresh(LCDVIEW_REDRAW_NOW); diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index 92a2d506f5..80a84af1ba 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -211,6 +211,7 @@ void menu_main(); void menu_move(); #if HAS_MEDIA + void menu_media_filelist(); void menu_media(); #endif diff --git a/Marlin/src/lcd/menu/menu_media.cpp b/Marlin/src/lcd/menu/menu_media.cpp index fe00bf3710..8633551672 100644 --- a/Marlin/src/lcd/menu/menu_media.cpp +++ b/Marlin/src/lcd/menu/menu_media.cpp @@ -45,7 +45,7 @@ void lcd_sd_updir() { void MarlinUI::reselect_last_file() { if (sd_encoder_position == 0xFFFF) return; - goto_screen(menu_media, sd_encoder_position, sd_top_line, sd_items); + goto_screen(menu_media_filelist, sd_encoder_position, sd_top_line, sd_items); sd_encoder_position = 0xFFFF; defer_status_screen(); } @@ -101,6 +101,29 @@ class MenuItem_sdfolder : public MenuItem_sdbase { } }; +#if HAS_MULTI_VOLUME + void menu_media_select() { + START_MENU(); + BACK_ITEM_F(TERN1(BROWSE_MEDIA_ON_INSERT, screen_history_depth) ? GET_TEXT_F(MSG_MAIN_MENU) : GET_TEXT_F(MSG_BACK)); + #if ENABLED(VOLUME_SD_ONBOARD) + ACTION_ITEM(MSG_SD_CARD, []{ card.changeMedia(&card.media_driver_sdcard); card.mount(); ui.goto_screen(menu_media_filelist); }); + #endif + #if ENABLED(VOLUME_USB_FLASH_DRIVE) + ACTION_ITEM(MSG_USB_DISK, []{ card.changeMedia(&card.media_driver_usbFlash); card.mount(); ui.goto_screen(menu_media_filelist); }); + #endif + END_MENU(); + } +#endif + +/** + * "Select From Media" menu item. Depending on single or multiple drives: + * - menu_media_filelist - List files on the current media + * - menu_media_select - Select one of the attached drives, then go to the file list + */ +void menu_media() { + ui.goto_screen(TERN(HAS_MULTI_VOLUME, menu_media_select, menu_media_filelist)); +} + void menu_media_filelist() { ui.encoder_direction_menus(); @@ -113,7 +136,7 @@ void menu_media_filelist() { START_MENU(); #if HAS_MULTI_VOLUME - ACTION_ITEM(MSG_BACK, []{ ui.goto_screen(menu_media); }); + ACTION_ITEM(MSG_BACK, []{ ui.goto_screen(menu_media_select); }); #else BACK_ITEM_F(TERN1(BROWSE_MEDIA_ON_INSERT, screen_history_depth) ? GET_TEXT_F(MSG_MAIN_MENU) : GET_TEXT_F(MSG_BACK)); #endif @@ -141,22 +164,4 @@ void menu_media_filelist() { END_MENU(); } -#if HAS_MULTI_VOLUME - void menu_media_select() { - START_MENU(); - BACK_ITEM_F(TERN1(BROWSE_MEDIA_ON_INSERT, screen_history_depth) ? GET_TEXT_F(MSG_MAIN_MENU) : GET_TEXT_F(MSG_BACK)); - #if ENABLED(VOLUME_SD_ONBOARD) - ACTION_ITEM(MSG_SD_CARD, []{ card.changeMedia(&card.media_driver_sdcard); card.mount(); ui.goto_screen(menu_media_filelist); }); - #endif - #if ENABLED(VOLUME_USB_FLASH_DRIVE) - ACTION_ITEM(MSG_USB_DISK, []{ card.changeMedia(&card.media_driver_usbFlash); card.mount(); ui.goto_screen(menu_media_filelist); }); - #endif - END_MENU(); - } -#endif - -void menu_media() { - TERN(HAS_MULTI_VOLUME, menu_media_select, menu_media_filelist)(); -} - #endif // HAS_MARLINUI_MENU && HAS_MEDIA From ef9cec9e40ec055e811dbc83ee3991e59a58cecb Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 23 Apr 2025 13:43:15 -0500 Subject: [PATCH 53/86] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20FastI?= =?UTF-8?q?O=20AT90USB=20pins=2046-47=20(2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit also lang --- Marlin/src/pins/pinsDebug.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Marlin/src/pins/pinsDebug.h b/Marlin/src/pins/pinsDebug.h index 94da51ccc2..f897343ffc 100644 --- a/Marlin/src/pins/pinsDebug.h +++ b/Marlin/src/pins/pinsDebug.h @@ -191,14 +191,14 @@ inline void printPinStateExt(const pin_t pin, const bool ignore, const bool exte auto alt_pin_echo = [](const pin_t &pin) { #if AVR_AT90USB1286_FAMILY // Use FastIO for pins Teensy doesn't expose - if (pin == 46) { - printPinIOState(IS_OUTPUT(46)); - printPinState(READ(46)); + if (pin == PIN_E2) { + printPinIOState(IS_OUTPUT(PIN_E2)); + printPinState(READ(PIN_E2)); return false; } - else if (pin == 47) { - printPinIOState(IS_OUTPUT(47)); - printPinState(READ(47)); + else if (pin == PIN_E3) { + printPinIOState(IS_OUTPUT(PIN_E3)); + printPinState(READ(PIN_E3)); return false; } #endif From e3a28afd5100c3bcd430db992e8a446ef4f40956 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 23 Apr 2025 15:08:57 -0500 Subject: [PATCH 54/86] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20AboutScreen::onTouch?= =?UTF-8?q?End=20warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/lcd/extui/ftdi_eve_touch_ui/generic/about_screen.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 065f89adef..eac6e646e6 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 @@ -92,16 +92,17 @@ void AboutScreen::onRedraw(draw_mode_t) { } bool AboutScreen::onTouchEnd(uint8_t tag) { - switch(tag) { + switch (tag) { default: return false; #if ALL(PRINTCOUNTER, FTDI_STATISTICS_SCREEN) case 1: GOTO_SCREEN(StatisticsScreen); break; #endif - case 2: GOTO_PREVIOUS(); return true; + case 2: GOTO_PREVIOUS(); break; #if ALL(TOUCH_UI_DEVELOPER_MENU, FTDI_DEVELOPER_MENU) case 3: GOTO_SCREEN(DeveloperMenu); break; #endif } + return true; } #endif // EXTENSIBLE_UI From 1e6326e85f9846e0db7c5cd23b39d86f97165af4 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 23 Apr 2025 11:22:20 -0500 Subject: [PATCH 55/86] =?UTF-8?q?=F0=9F=8C=90=20Language=20for=20SD=20/=20?= =?UTF-8?q?USB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/language/language_an.h | 13 ++-- Marlin/src/lcd/language/language_bg.h | 13 ++-- Marlin/src/lcd/language/language_ca.h | 13 ++-- Marlin/src/lcd/language/language_cz.h | 12 ++-- Marlin/src/lcd/language/language_da.h | 2 + Marlin/src/lcd/language/language_de.h | 13 ++-- Marlin/src/lcd/language/language_el.h | 13 ++-- Marlin/src/lcd/language/language_el_gr.h | 13 ++-- Marlin/src/lcd/language/language_en.h | 73 +++++++++++++++------- Marlin/src/lcd/language/language_es.h | 21 ++++--- Marlin/src/lcd/language/language_eu.h | 13 ++-- Marlin/src/lcd/language/language_fi.h | 2 +- Marlin/src/lcd/language/language_fr.h | 13 ++-- Marlin/src/lcd/language/language_fr_na.h | 13 ++-- Marlin/src/lcd/language/language_gl.h | 21 ++++--- Marlin/src/lcd/language/language_hr.h | 13 ++-- Marlin/src/lcd/language/language_hu.h | 13 ++-- Marlin/src/lcd/language/language_it.h | 21 ++++--- Marlin/src/lcd/language/language_jp_kana.h | 13 ++-- Marlin/src/lcd/language/language_ko_KR.h | 2 +- Marlin/src/lcd/language/language_nl.h | 13 ++-- Marlin/src/lcd/language/language_pl.h | 13 ++-- Marlin/src/lcd/language/language_pt.h | 11 ++-- Marlin/src/lcd/language/language_pt_br.h | 13 ++-- Marlin/src/lcd/language/language_ro.h | 13 ++-- Marlin/src/lcd/language/language_ru.h | 13 ++-- Marlin/src/lcd/language/language_sk.h | 13 ++-- Marlin/src/lcd/language/language_sv.h | 13 ++-- Marlin/src/lcd/language/language_tr.h | 13 ++-- Marlin/src/lcd/language/language_uk.h | 13 ++-- Marlin/src/lcd/language/language_vi.h | 36 +++++------ Marlin/src/lcd/language/language_zh_CN.h | 13 ++-- Marlin/src/lcd/language/language_zh_TW.h | 13 ++-- Marlin/src/lcd/menu/menu_main.cpp | 8 +-- 34 files changed, 260 insertions(+), 248 deletions(-) diff --git a/Marlin/src/lcd/language/language_an.h b/Marlin/src/lcd/language/language_an.h index 095a3440aa..c5230db098 100644 --- a/Marlin/src/lcd/language/language_an.h +++ b/Marlin/src/lcd/language/language_an.h @@ -42,7 +42,6 @@ namespace LanguageNarrow_an { LSTR MSG_MEDIA_REMOVED = _UxGT("Tarcheta sacada"); LSTR MSG_LCD_ENDSTOPS = _UxGT("Endstops"); // Max length 8 characters LSTR MSG_MAIN_MENU = _UxGT("Menu prencipal"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("Inicio automatico"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Amortar motors"); LSTR MSG_HOMING = _UxGT("Orichen"); LSTR MSG_AUTO_HOME = _UxGT("Levar a l'orichen"); @@ -155,13 +154,13 @@ namespace LanguageNarrow_an { LSTR MSG_AUTORETRACT = _UxGT("Retraccion auto."); LSTR MSG_FILAMENTCHANGE = _UxGT("Cambear filamento"); LSTR MSG_FILAMENTCHANGE_E = _UxGT("Cambear filamento *"); - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("Encetan. SD"); - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Encetan. USB"); - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("Encetan. SD"); - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("Encetan. media"); + LSTR MSG_ATTACH_SD = _UxGT("Encetan. SD"); + LSTR MSG_ATTACH_USB = _UxGT("Encetan. USB"); LSTR MSG_CHANGE_MEDIA = _UxGT("Cambiar tarcheta"); + LSTR MSG_RUN_AUTOFILES = _UxGT("Inicio automatico"); + LSTR MSG_ZPROBE_OUT = _UxGT("Sonda Z fuera"); LSTR MSG_BLTOUCH_RESET = _UxGT("Reset BLTouch"); LSTR MSG_ZPROBE_XOFFSET = _UxGT("Desfase X"); diff --git a/Marlin/src/lcd/language/language_bg.h b/Marlin/src/lcd/language/language_bg.h index 4eef867826..4f278c4bcf 100644 --- a/Marlin/src/lcd/language/language_bg.h +++ b/Marlin/src/lcd/language/language_bg.h @@ -40,7 +40,6 @@ namespace LanguageNarrow_bg { LSTR MSG_MEDIA_INSERTED = _UxGT("Картата е поставена"); LSTR MSG_MEDIA_REMOVED = _UxGT("Картата е извадена"); LSTR MSG_MAIN_MENU = _UxGT("Меню"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("Автостарт"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Изкл. двигатели"); LSTR MSG_AUTO_HOME = _UxGT("Паркиране"); LSTR MSG_SET_HOME_OFFSETS = _UxGT("Задай Начало"); @@ -139,13 +138,13 @@ namespace LanguageNarrow_bg { LSTR MSG_AUTORETRACT = _UxGT("Автоoткат"); LSTR MSG_FILAMENTCHANGE = _UxGT("Смяна нишка"); LSTR MSG_FILAMENTCHANGE_E = _UxGT("Смяна нишка *"); - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("Иниц. SD-Карта"); - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Иниц. USB-Карта"); - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("Иниц. SD-Карта"); - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("Иниц. SD-Карта"); + LSTR MSG_ATTACH_SD = _UxGT("Иниц. SD-Карта"); + LSTR MSG_ATTACH_USB = _UxGT("Иниц. USB-Карта"); LSTR MSG_CHANGE_MEDIA = _UxGT("Смяна SD-Карта"); + LSTR MSG_RUN_AUTOFILES = _UxGT("Автостарт"); + LSTR MSG_ZPROBE_OUT = _UxGT("Z-сондата е извадена"); LSTR MSG_ZPROBE_XOFFSET = _UxGT("X Отстояние"); LSTR MSG_ZPROBE_YOFFSET = _UxGT("Y Отстояние"); diff --git a/Marlin/src/lcd/language/language_ca.h b/Marlin/src/lcd/language/language_ca.h index fa74f255aa..be12c69df4 100644 --- a/Marlin/src/lcd/language/language_ca.h +++ b/Marlin/src/lcd/language/language_ca.h @@ -38,7 +38,6 @@ namespace LanguageNarrow_ca { LSTR MSG_MEDIA_REMOVED = _UxGT("Targeta extreta."); LSTR MSG_LCD_ENDSTOPS = _UxGT("Endstops"); LSTR MSG_MAIN_MENU = _UxGT("Menú principal"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("Inici automatic"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Desactiva motors"); LSTR MSG_DEBUG_MENU = _UxGT("Menu de depuracio"); LSTR MSG_PROGRESS_BAR_TEST = _UxGT("Test barra progres"); @@ -145,13 +144,13 @@ namespace LanguageNarrow_ca { LSTR MSG_AUTORETRACT = _UxGT("Auto retraccio"); LSTR MSG_FILAMENTCHANGE = _UxGT("Canvia filament"); LSTR MSG_FILAMENTCHANGE_E = _UxGT("Canvia filament *"); - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("Inicialitza SD"); - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Inicialitza USB"); - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("Inicialitza SD"); - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("Inicialitza SD"); + LSTR MSG_ATTACH_SD = _UxGT("Inicialitza SD"); + LSTR MSG_ATTACH_USB = _UxGT("Inicialitza USB"); LSTR MSG_CHANGE_MEDIA = _UxGT("Canvia SD"); + LSTR MSG_RUN_AUTOFILES = _UxGT("Inici automatic"); + LSTR MSG_ZPROBE_OUT = _UxGT("Sonda Z fora"); LSTR MSG_BLTOUCH_RESET = _UxGT("Reinicia BLTouch"); LSTR MSG_HOME_FIRST = _UxGT("Home %s primer"); diff --git a/Marlin/src/lcd/language/language_cz.h b/Marlin/src/lcd/language/language_cz.h index 9a01466227..ac23bc8daf 100644 --- a/Marlin/src/lcd/language/language_cz.h +++ b/Marlin/src/lcd/language/language_cz.h @@ -57,7 +57,6 @@ namespace LanguageNarrow_cz { LSTR MSG_MAIN_MENU = _UxGT("Hlavní nabídka"); LSTR MSG_ADVANCED_SETTINGS = _UxGT("Další nastavení"); LSTR MSG_CONFIGURATION = _UxGT("Konfigurace"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("Autostart"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Uvolnit motory"); LSTR MSG_DEBUG_MENU = _UxGT("Nabídka ladění"); LSTR MSG_PROGRESS_BAR_TEST = _UxGT("Test uk. průběhu"); @@ -359,14 +358,13 @@ namespace LanguageNarrow_cz { LSTR MSG_FILAMENTUNLOAD_E = _UxGT("Vysunout filament *"); LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("Vysunout vše"); - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("Načíst SD"); - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Načíst USB"); - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("Načíst SD"); - #endif + LSTR MSG_ATTACH_MEDIA = _UxGT("Načíst médium"); + LSTR MSG_ATTACH_SD = _UxGT("Načíst SD"); + LSTR MSG_ATTACH_USB = _UxGT("Načíst USB"); LSTR MSG_CHANGE_MEDIA = _UxGT("Vyměnit médium"); LSTR MSG_RELEASE_MEDIA = _UxGT("Vysunout médium"); + LSTR MSG_RUN_AUTOFILES = _UxGT("Autostart"); + LSTR MSG_ZPROBE_OUT = _UxGT("Sonda Z mimo podl"); LSTR MSG_SKEW_FACTOR = _UxGT("Faktor zkosení"); LSTR MSG_BLTOUCH = _UxGT("BLTouch"); diff --git a/Marlin/src/lcd/language/language_da.h b/Marlin/src/lcd/language/language_da.h index 35083aa01f..0a286d1751 100644 --- a/Marlin/src/lcd/language/language_da.h +++ b/Marlin/src/lcd/language/language_da.h @@ -133,7 +133,9 @@ namespace LanguageNarrow_da { LSTR MSG_AUTORETRACT = _UxGT("Auto-Retract"); LSTR MSG_FILAMENTCHANGE = _UxGT("Skift filament"); LSTR MSG_FILAMENTCHANGE_E = _UxGT("Skift filament *"); + LSTR MSG_CHANGE_MEDIA = _UxGT("Skift SD kort"); + LSTR MSG_ZPROBE_OUT = _UxGT("Probe udenfor plade"); LSTR MSG_BLTOUCH_SELFTEST = _UxGT("BLTouch Selv-Test"); LSTR MSG_HOME_FIRST = _UxGT("Home %s først"); diff --git a/Marlin/src/lcd/language/language_de.h b/Marlin/src/lcd/language/language_de.h index 23730d321a..e681317fb8 100644 --- a/Marlin/src/lcd/language/language_de.h +++ b/Marlin/src/lcd/language/language_de.h @@ -55,7 +55,6 @@ namespace LanguageNarrow_de { LSTR MSG_MAIN_MENU = _UxGT("Hauptmenü"); LSTR MSG_ADVANCED_SETTINGS = _UxGT("Erw. Einstellungen"); LSTR MSG_CONFIGURATION = _UxGT("Konfiguration"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("Autostart"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Motoren deaktivieren"); // M84 :: Max length 19 characters LSTR MSG_DEBUG_MENU = _UxGT("Debug-Menü"); LSTR MSG_PROGRESS_BAR_TEST = _UxGT("Statusbalken-Test"); @@ -493,14 +492,14 @@ namespace LanguageNarrow_de { LSTR MSG_FILAMENTUNLOAD = _UxGT("Filament entladen"); LSTR MSG_FILAMENTUNLOAD_E = _UxGT("Filament entladen *"); LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("Alles entladen"); - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("SD initial."); - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("USB initial."); - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("SD initial."); - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("SD initial."); + LSTR MSG_ATTACH_SD = _UxGT("SD initial."); + LSTR MSG_ATTACH_USB = _UxGT("USB initial."); 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_RUN_AUTOFILES = _UxGT("Autostart"); + LSTR MSG_ZPROBE_OUT = _UxGT("Z-Sonde außerhalb"); LSTR MSG_SKEW_FACTOR = _UxGT("Korrekturfaktor"); LSTR MSG_BLTOUCH = _UxGT("BLTouch"); diff --git a/Marlin/src/lcd/language/language_el.h b/Marlin/src/lcd/language/language_el.h index 85de0f0751..0d3d355cb0 100644 --- a/Marlin/src/lcd/language/language_el.h +++ b/Marlin/src/lcd/language/language_el.h @@ -52,7 +52,6 @@ namespace LanguageNarrow_el { LSTR MSG_MEDIA_USB_FAILED = _UxGT("Αποτυχία εκκίνησης USB"); LSTR MSG_MEDIA_INIT_FAIL = _UxGT("Αποτυχία αρχικοποίησης SD"); LSTR MSG_MAIN_MENU = _UxGT("Αρχική Οθόνη"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("Αυτόματη εκκίνηση"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Απενεργοποίηση μοτέρ"); LSTR MSG_AUTO_HOME = _UxGT("Αυτόμ. επαναφορά XYZ"); LSTR MSG_AUTO_HOME_X = _UxGT("Επαναφορά X"); @@ -180,13 +179,13 @@ namespace LanguageNarrow_el { LSTR MSG_AUTORETRACT = _UxGT("Αυτόματη ανάσυρση"); LSTR MSG_FILAMENTCHANGE = _UxGT("Αλλαγή νήματος"); LSTR MSG_FILAMENTCHANGE_E = _UxGT("Αλλαγή νήματος *"); - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("Προετοιμασία SD"); - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Προετοιμασία USB"); - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("Προετοιμασία SD"); - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("Προετοιμασία SD"); + LSTR MSG_ATTACH_SD = _UxGT("Προετοιμασία SD"); + LSTR MSG_ATTACH_USB = _UxGT("Προετοιμασία USB"); LSTR MSG_CHANGE_MEDIA = _UxGT("Αλλαγή κάρτας SD"); + LSTR MSG_RUN_AUTOFILES = _UxGT("Αυτόματη εκκίνηση"); + LSTR MSG_ZPROBE_OUT = _UxGT("Διερεύνηση Z εκτός Επ.Εκτύπωσης"); // SHORTEN LSTR MSG_YX_UNHOMED = _UxGT("Επαναφορά Χ/Υ πρώτα"); LSTR MSG_XYZ_UNHOMED = _UxGT("Επαναφορά ΧΥZ πρώτα"); diff --git a/Marlin/src/lcd/language/language_el_gr.h b/Marlin/src/lcd/language/language_el_gr.h index 65b2da5ee3..3e2cb0ec07 100644 --- a/Marlin/src/lcd/language/language_el_gr.h +++ b/Marlin/src/lcd/language/language_el_gr.h @@ -41,7 +41,6 @@ namespace LanguageNarrow_el_gr { LSTR MSG_MEDIA_REMOVED = _UxGT("Αφαίρεση κάρτας"); LSTR MSG_LCD_ENDSTOPS = _UxGT("Endstops"); // Max length 8 characters LSTR MSG_MAIN_MENU = _UxGT("Βασική Οθόνη"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("Αυτόματη εκκίνηση"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Απενεργοποίηση βηματιστή"); LSTR MSG_AUTO_HOME = _UxGT("Αυτομ. επαναφορά στο αρχικό σημείο"); LSTR MSG_AUTO_HOME_X = _UxGT("Αρχικό σημείο X"); @@ -170,13 +169,13 @@ namespace LanguageNarrow_el_gr { LSTR MSG_AUTORETRACT = _UxGT("Αυτόματη ανάσυρση"); LSTR MSG_FILAMENTCHANGE = _UxGT("Αλλαγή νήματος"); LSTR MSG_FILAMENTCHANGE_E = _UxGT("Αλλαγή νήματος *"); - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("Προετοιμασία SD"); - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Προετοιμασία USB"); - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("Προετοιμασία SD"); - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("Προετοιμασία SD"); + LSTR MSG_ATTACH_SD = _UxGT("Προετοιμασία SD"); + LSTR MSG_ATTACH_USB = _UxGT("Προετοιμασία USB"); LSTR MSG_CHANGE_MEDIA = _UxGT("Αλλαγή κάρτας SD"); + LSTR MSG_RUN_AUTOFILES = _UxGT("Αυτόματη εκκίνηση"); + LSTR MSG_ZPROBE_OUT = _UxGT("Διερεύνηση Z εκτός κλίνης"); LSTR MSG_YX_UNHOMED = _UxGT("Επαναφορά Χ/Υ πριν από Z"); LSTR MSG_XYZ_UNHOMED = _UxGT("Επαναφορά ΧΥZ πρώτα"); diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index e0c1f53f77..d23e638a78 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -42,7 +42,13 @@ #endif #undef en -#define MEDIA_TYPE_EN "Media" +#if HAS_SDCARD && !HAS_USB_FLASH_DRIVE + #define MEDIA_TYPE_EN "SD Card" +#elif HAS_USB_FLASH_DRIVE + #define MEDIA_TYPE_EN "USB Drive" +#else + #define MEDIA_TYPE_EN "Media" +#endif #ifndef PREHEAT_1_LABEL #define PREHEAT_1_LABEL "" @@ -76,23 +82,32 @@ namespace LanguageNarrow_en { LSTR MSG_LOW = _UxGT("LOW"); LSTR MSG_BACK = _UxGT("Back"); LSTR MSG_ERROR = _UxGT("Error"); + LSTR MSG_MEDIA_ABORTING = _UxGT("Aborting..."); LSTR MSG_MEDIA_INSERTED = MEDIA_TYPE_EN _UxGT(" Inserted"); + LSTR MSG_MEDIA_INSERTED_SD = _UxGT("SD Card Inserted"); + LSTR MSG_MEDIA_INSERTED_USB = _UxGT("USB Drive Inserted"); LSTR MSG_MEDIA_REMOVED = MEDIA_TYPE_EN _UxGT(" Removed"); + LSTR MSG_MEDIA_REMOVED_SD = _UxGT("SD Card Removed"); + LSTR MSG_MEDIA_REMOVED_USB = _UxGT("USB Drive Removed"); LSTR MSG_MEDIA_WAITING = _UxGT("Waiting for ") MEDIA_TYPE_EN; + LSTR MSG_MEDIA_WAITING_SD = _UxGT("Waiting for SD Card"); + LSTR MSG_MEDIA_WAITING_USB = _UxGT("Waiting for USB Drive"); LSTR MSG_MEDIA_INIT_FAIL = MEDIA_TYPE_EN _UxGT(" Init Fail"); + LSTR MSG_MEDIA_INIT_FAIL_SD = _UxGT("SD Card Init Fail"); + LSTR MSG_MEDIA_INIT_FAIL_USB = _UxGT("USB Drive Init Fail"); LSTR MSG_MEDIA_READ_ERROR = MEDIA_TYPE_EN _UxGT(" read error"); LSTR MSG_MEDIA_USB_REMOVED = _UxGT("USB device removed"); LSTR MSG_MEDIA_USB_FAILED = _UxGT("USB start failed"); LSTR MSG_MEDIA_SORT = _UxGT("Sort ") MEDIA_TYPE_EN; LSTR MSG_MEDIA_UPDATE = MEDIA_TYPE_EN _UxGT(" Update"); + LSTR MSG_KILL_SUBCALL_OVERFLOW = _UxGT("Subcall Overflow"); LSTR MSG_LCD_ENDSTOPS = _UxGT("Endstops"); // Max length 8 characters LSTR MSG_LCD_SOFT_ENDSTOPS = _UxGT("Soft Endstops"); LSTR MSG_MAIN_MENU = _UxGT("Main Menu"); LSTR MSG_ADVANCED_SETTINGS = _UxGT("Advanced Settings"); LSTR MSG_CONFIGURATION = _UxGT("Configuration"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("Run Auto Files"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Disable Steppers"); LSTR MSG_DEBUG_MENU = _UxGT("Debug Menu"); LSTR MSG_PROGRESS_BAR_TEST = _UxGT("Progress Bar Test"); @@ -613,14 +628,20 @@ namespace LanguageNarrow_en { LSTR MSG_FILAMENTUNLOAD = _UxGT("Unload Filament"); LSTR MSG_FILAMENTUNLOAD_E = _UxGT("Unload * Filament"); LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("Unload All"); - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("Attach SD Card"); - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Attach USB Drive"); - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("Attach ") MEDIA_TYPE_EN; - #endif - LSTR MSG_CHANGE_MEDIA = _UxGT("Change ") MEDIA_TYPE_EN; + + LSTR MSG_ATTACH_MEDIA = _UxGT("Attach ") MEDIA_TYPE_EN; + LSTR MSG_ATTACH_SD = _UxGT("Attach SD Card"); + LSTR MSG_ATTACH_USB = _UxGT("Attach USB Drive"); LSTR MSG_RELEASE_MEDIA = _UxGT("Release ") MEDIA_TYPE_EN; + LSTR MSG_RELEASE_SD = _UxGT("Release SD Card"); + LSTR MSG_RELEASE_USB = _UxGT("Release USB Drive"); + LSTR MSG_CHANGE_MEDIA = _UxGT("Refresh ") MEDIA_TYPE_EN; + LSTR MSG_CHANGE_SD = _UxGT("Select SD Card"); + LSTR MSG_CHANGE_USB = _UxGT("Select USB Drive"); + LSTR MSG_RUN_AUTOFILES = _UxGT("Run Autofiles"); + LSTR MSG_RUN_AUTOFILES_SD = _UxGT("Run SD Autofiles"); + LSTR MSG_RUN_AUTOFILES_USB = _UxGT("Run USB Autofiles"); + LSTR MSG_ZPROBE_OUT = _UxGT("Z Probe Past Bed"); LSTR MSG_SKEW_FACTOR = _UxGT("Skew Factor"); LSTR MSG_BLTOUCH = _UxGT("BLTouch"); @@ -665,6 +686,7 @@ namespace LanguageNarrow_en { LSTR MSG_BABYSTEP_N = _UxGT("Babystep @"); LSTR MSG_BABYSTEP_TOTAL = _UxGT("Total"); LSTR MSG_ENDSTOP_ABORT = _UxGT("Endstop Abort"); + LSTR MSG_ERR_HEATING_FAILED = _UxGT("Heating Failed"); LSTR MSG_ERR_REDUNDANT_TEMP = _UxGT("Err: REDUNDANT TEMP"); LSTR MSG_ERR_THERMAL_RUNAWAY = _UxGT("THERMAL RUNAWAY"); @@ -686,6 +708,7 @@ namespace LanguageNarrow_en { LSTR MSG_CHAMBER_HEATING = _UxGT("Chamber Heating..."); LSTR MSG_CHAMBER_COOLING = _UxGT("Chamber Cooling..."); LSTR MSG_LASER_COOLING = _UxGT("Laser Cooling..."); + LSTR MSG_DELTA_CALIBRATE = _UxGT("Delta Calibration"); LSTR MSG_DELTA_CALIBRATION_IN_PROGRESS = _UxGT("Delta Calibration in progress"); LSTR MSG_DELTA_CALIBRATE_X = _UxGT("Calibrate X"); @@ -697,14 +720,9 @@ namespace LanguageNarrow_en { 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("Unified Bed Leveling"); - LSTR MSG_MESH_LEVELING = _UxGT("Mesh Leveling"); - LSTR MSG_MESH_DONE = _UxGT("Mesh probing done"); LSTR MSG_INFO_PRINTER_STATS_MENU = _UxGT("Printer Stats"); LSTR MSG_INFO_STATS_MENU = _UxGT("Stats"); LSTR MSG_RESET_STATS = _UxGT("Reset Print Stats?"); @@ -715,6 +733,22 @@ namespace LanguageNarrow_en { 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_INFO_PRINT_COUNT = _UxGT("Prints"); + LSTR MSG_INFO_PRINT_TIME = _UxGT("Total"); + LSTR MSG_INFO_PRINT_LONGEST = _UxGT("Longest"); + LSTR MSG_INFO_PRINT_FILAMENT = _UxGT("Extruded"); + LSTR MSG_INFO_COMPLETED_PRINTS = _UxGT("Completed"); + LSTR MSG_INFO_MIN_TEMP = _UxGT("Min Temp"); + LSTR MSG_INFO_MAX_TEMP = _UxGT("Max Temp"); + LSTR MSG_INFO_PSU = _UxGT("PSU"); + + 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("Unified Bed Leveling"); + LSTR MSG_MESH_LEVELING = _UxGT("Mesh Leveling"); + LSTR MSG_MESH_DONE = _UxGT("Mesh probing done"); + LSTR MSG_HOTEND_IDLE_TIMEOUT = _UxGT("Hotend Idle Timeout"); LSTR MSG_BED_IDLE_TIMEOUT = _UxGT("Bed Idle Timeout"); LSTR MSG_HOTEND_IDLE_DISABLE = _UxGT("Disable Timeout"); @@ -726,15 +760,6 @@ namespace LanguageNarrow_en { LSTR MSG_CASE_LIGHT_BRIGHTNESS = _UxGT("Light Brightness"); LSTR MSG_KILL_EXPECTED_PRINTER = _UxGT("INCORRECT PRINTER"); - LSTR MSG_INFO_PRINT_COUNT = _UxGT("Prints"); - LSTR MSG_INFO_PRINT_TIME = _UxGT("Total"); - LSTR MSG_INFO_PRINT_LONGEST = _UxGT("Longest"); - LSTR MSG_INFO_PRINT_FILAMENT = _UxGT("Extruded"); - LSTR MSG_INFO_COMPLETED_PRINTS = _UxGT("Completed"); - LSTR MSG_INFO_MIN_TEMP = _UxGT("Min Temp"); - LSTR MSG_INFO_MAX_TEMP = _UxGT("Max Temp"); - LSTR MSG_INFO_PSU = _UxGT("PSU"); - LSTR MSG_DRIVE_STRENGTH = _UxGT("Drive Strength"); LSTR MSG_DAC_PERCENT_N = _UxGT("@ Driver %"); LSTR MSG_ERROR_TMC = _UxGT("TMC CONNECTION ERROR"); diff --git a/Marlin/src/lcd/language/language_es.h b/Marlin/src/lcd/language/language_es.h index 058b550f67..d1e4babf2b 100644 --- a/Marlin/src/lcd/language/language_es.h +++ b/Marlin/src/lcd/language/language_es.h @@ -28,7 +28,13 @@ * See also https://marlinfw.org/docs/development/lcd_language.html */ -#define MEDIA_TYPE_ES "SD/FD" +#if HAS_SDCARD && !HAS_USB_FLASH_DRIVE + #define MEDIA_TYPE_ES "SD" +#elif HAS_USB_FLASH_DRIVE + #define MEDIA_TYPE_ES "USB" +#else + #define MEDIA_TYPE_ES "SD/FD" +#endif namespace LanguageNarrow_es { using namespace Language_en; // Inherit undefined strings from English @@ -54,7 +60,6 @@ namespace LanguageNarrow_es { LSTR MSG_MAIN_MENU = _UxGT("Menú principal"); LSTR MSG_ADVANCED_SETTINGS = _UxGT("Ajustes avanzados"); LSTR MSG_CONFIGURATION = _UxGT("Configuración"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("Inicio automático"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Apagar motores"); LSTR MSG_DEBUG_MENU = _UxGT("Menú depuración"); LSTR MSG_PROGRESS_BAR_TEST = _UxGT("Prob. barra progreso"); @@ -368,14 +373,14 @@ namespace LanguageNarrow_es { LSTR MSG_FILAMENTUNLOAD = _UxGT("Descargar filamento"); LSTR MSG_FILAMENTUNLOAD_E = _UxGT("Descargar fil. *"); LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("Descargar todo"); - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("Iniciar SD"); - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Iniciar USB"); - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("Iniciar ") MEDIA_TYPE_ES; - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("Iniciar ") MEDIA_TYPE_ES; + LSTR MSG_ATTACH_SD = _UxGT("Iniciar SD"); + LSTR MSG_ATTACH_USB = _UxGT("Iniciar USB"); LSTR MSG_CHANGE_MEDIA = _UxGT("Cambiar ") MEDIA_TYPE_ES; LSTR MSG_RELEASE_MEDIA = _UxGT("Lanzar ") MEDIA_TYPE_ES; + LSTR MSG_RUN_AUTOFILES = _UxGT("Inicio automático"); + LSTR MSG_ZPROBE_OUT = _UxGT("Sonda Z fuera cama"); LSTR MSG_SKEW_FACTOR = _UxGT("Factor de desviación"); LSTR MSG_BLTOUCH = _UxGT("BLTouch"); diff --git a/Marlin/src/lcd/language/language_eu.h b/Marlin/src/lcd/language/language_eu.h index 561de0b8e6..52612a8081 100644 --- a/Marlin/src/lcd/language/language_eu.h +++ b/Marlin/src/lcd/language/language_eu.h @@ -42,7 +42,6 @@ namespace LanguageNarrow_eu { LSTR MSG_MEDIA_INSERTED = _UxGT("Txartela sartuta"); LSTR MSG_MEDIA_REMOVED = _UxGT("Txartela kenduta"); LSTR MSG_MAIN_MENU = _UxGT("Menu nagusia"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("Auto hasiera"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Itzali motoreak"); LSTR MSG_DEBUG_MENU = _UxGT("Arazketa Menua"); LSTR MSG_PROGRESS_BAR_TEST = _UxGT("Prog. Barra Proba"); @@ -219,13 +218,13 @@ namespace LanguageNarrow_eu { LSTR MSG_FILAMENTUNLOAD = _UxGT("Harizpia deskargatu"); LSTR MSG_FILAMENTUNLOAD_E = _UxGT("Harizpia deskargatu *"); LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("Erabat deskargatu"); - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("Hasieratu SD-a"); - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Hasieratu USB-a"); - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("Hasieratu SD-a"); - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("Hasieratu SD-a"); + LSTR MSG_ATTACH_SD = _UxGT("Hasieratu SD-a"); + LSTR MSG_ATTACH_USB = _UxGT("Hasieratu USB-a"); LSTR MSG_CHANGE_MEDIA = _UxGT("Aldatu txartela"); + LSTR MSG_RUN_AUTOFILES = _UxGT("Auto hasiera"); + LSTR MSG_ZPROBE_OUT = _UxGT("Z zunda kanpora"); LSTR MSG_SKEW_FACTOR = _UxGT("Okertze faktorea"); LSTR MSG_BLTOUCH = _UxGT("BLTouch"); diff --git a/Marlin/src/lcd/language/language_fi.h b/Marlin/src/lcd/language/language_fi.h index 7b3f0f6082..d70c67208c 100644 --- a/Marlin/src/lcd/language/language_fi.h +++ b/Marlin/src/lcd/language/language_fi.h @@ -40,7 +40,7 @@ namespace LanguageNarrow_fi { LSTR MSG_MEDIA_INSERTED = _UxGT("Kortti asetettu"); LSTR MSG_MEDIA_REMOVED = _UxGT("Kortti poistettu"); LSTR MSG_MAIN_MENU = _UxGT("Palaa"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("Automaatti"); + LSTR MSG_RUN_AUTOFILES = _UxGT("Automaatti"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Vapauta moottorit"); LSTR MSG_AUTO_HOME = _UxGT("Aja referenssiin"); diff --git a/Marlin/src/lcd/language/language_fr.h b/Marlin/src/lcd/language/language_fr.h index 13bee9fbb8..6d9fd3b4f4 100644 --- a/Marlin/src/lcd/language/language_fr.h +++ b/Marlin/src/lcd/language/language_fr.h @@ -52,7 +52,6 @@ namespace LanguageNarrow_fr { LSTR MSG_MAIN_MENU = _UxGT("Menu principal"); LSTR MSG_ADVANCED_SETTINGS = _UxGT("Config. avancée"); LSTR MSG_CONFIGURATION = _UxGT("Configuration"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("Exéc. auto.gcode"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Arrêter moteurs"); LSTR MSG_DEBUG_MENU = _UxGT("Menu debug"); LSTR MSG_PROGRESS_BAR_TEST = _UxGT("Test barre progress."); @@ -392,14 +391,14 @@ namespace LanguageNarrow_fr { LSTR MSG_FILAMENTUNLOAD = _UxGT("Retrait filament"); LSTR MSG_FILAMENTUNLOAD_E = _UxGT("Retrait filament *"); LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("Retirer tout"); - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("Charger le SD"); - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Charger le USB"); - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("Charger le SD"); - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("Charger le SD"); + LSTR MSG_ATTACH_SD = _UxGT("Charger le SD"); + LSTR MSG_ATTACH_USB = _UxGT("Charger le USB"); LSTR MSG_CHANGE_MEDIA = _UxGT("Actualiser média"); LSTR MSG_RELEASE_MEDIA = _UxGT("Retirer le média"); + LSTR MSG_RUN_AUTOFILES = _UxGT("Exéc. auto.gcode"); + LSTR MSG_ZPROBE_OUT = _UxGT("Sonde Z hors lit"); LSTR MSG_SKEW_FACTOR = _UxGT("Facteur écart"); LSTR MSG_BLTOUCH = _UxGT("BLTouch"); diff --git a/Marlin/src/lcd/language/language_fr_na.h b/Marlin/src/lcd/language/language_fr_na.h index a3da3082de..07f2b86499 100644 --- a/Marlin/src/lcd/language/language_fr_na.h +++ b/Marlin/src/lcd/language/language_fr_na.h @@ -52,7 +52,6 @@ namespace LanguageNarrow_fr_na { LSTR MSG_MAIN_MENU = _UxGT("Menu principal"); LSTR MSG_ADVANCED_SETTINGS = _UxGT("Config. avancee"); LSTR MSG_CONFIGURATION = _UxGT("Configuration"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("Exec. auto.gcode"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Arreter moteurs"); LSTR MSG_DEBUG_MENU = _UxGT("Menu debug"); LSTR MSG_PROGRESS_BAR_TEST = _UxGT("Test barre progress."); @@ -392,14 +391,14 @@ namespace LanguageNarrow_fr_na { LSTR MSG_FILAMENTUNLOAD = _UxGT("Retrait filament"); LSTR MSG_FILAMENTUNLOAD_E = _UxGT("Retrait filament *"); LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("Retirer tout"); - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("Charger le SD"); - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Charger le USB"); - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("Charger le SD"); - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("Charger le SD"); + LSTR MSG_ATTACH_SD = _UxGT("Charger le SD"); + LSTR MSG_ATTACH_USB = _UxGT("Charger le USB"); LSTR MSG_CHANGE_MEDIA = _UxGT("Actualiser media"); LSTR MSG_RELEASE_MEDIA = _UxGT("Retirer le media"); + LSTR MSG_RUN_AUTOFILES = _UxGT("Exec. auto.gcode"); + LSTR MSG_ZPROBE_OUT = _UxGT("Sonde Z hors lit"); LSTR MSG_SKEW_FACTOR = _UxGT("Facteur ecart"); LSTR MSG_BLTOUCH = _UxGT("BLTouch"); diff --git a/Marlin/src/lcd/language/language_gl.h b/Marlin/src/lcd/language/language_gl.h index 3287ae2676..6dd699f1bd 100644 --- a/Marlin/src/lcd/language/language_gl.h +++ b/Marlin/src/lcd/language/language_gl.h @@ -30,7 +30,13 @@ #define DISPLAY_CHARSET_ISO10646_1 -#define MEDIA_TYPE_GL "SD/FD" +#if HAS_SDCARD && !HAS_USB_FLASH_DRIVE + #define MEDIA_TYPE_GL "SD" +#elif HAS_USB_FLASH_DRIVE + #define MEDIA_TYPE_GL "FD" +#else + #define MEDIA_TYPE_GL "SD/FD" +#endif namespace LanguageNarrow_gl { using namespace Language_en; // Inherit undefined strings from English @@ -55,7 +61,6 @@ namespace LanguageNarrow_gl { LSTR MSG_MAIN_MENU = _UxGT("Menú principal"); LSTR MSG_ADVANCED_SETTINGS = _UxGT("Axustes avanzados"); LSTR MSG_CONFIGURATION = _UxGT("Configuración"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("Autoarranque"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Apagar motores"); LSTR MSG_DEBUG_MENU = _UxGT("Menú depuración"); LSTR MSG_PROGRESS_BAR_TEST = _UxGT("Test barra progreso"); @@ -383,14 +388,14 @@ namespace LanguageNarrow_gl { LSTR MSG_FILAMENTUNLOAD = _UxGT("Descargar Filamento"); LSTR MSG_FILAMENTUNLOAD_E = _UxGT("Descargar Filamento *"); LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("Descargar Todo"); - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("Iniciar SD"); - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Iniciar USB"); - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("Iniciar ") MEDIA_TYPE_GL; - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("Iniciar ") MEDIA_TYPE_GL; + LSTR MSG_ATTACH_SD = _UxGT("Iniciar SD"); + LSTR MSG_ATTACH_USB = _UxGT("Iniciar USB"); LSTR MSG_CHANGE_MEDIA = _UxGT("Cambiar ") MEDIA_TYPE_GL; LSTR MSG_RELEASE_MEDIA = _UxGT("Lanzar ") MEDIA_TYPE_GL; + LSTR MSG_RUN_AUTOFILES = _UxGT("Autoarranque"); + LSTR MSG_ZPROBE_OUT = _UxGT("Sonda-Z fóra Cama"); LSTR MSG_SKEW_FACTOR = _UxGT("Factor de Desviación"); LSTR MSG_BLTOUCH = _UxGT("BLTouch"); diff --git a/Marlin/src/lcd/language/language_hr.h b/Marlin/src/lcd/language/language_hr.h index 5f60b000e3..a75dcff846 100644 --- a/Marlin/src/lcd/language/language_hr.h +++ b/Marlin/src/lcd/language/language_hr.h @@ -41,7 +41,6 @@ namespace LanguageNarrow_hr { LSTR MSG_MEDIA_REMOVED = _UxGT("SD kartica uklonjena"); LSTR MSG_LCD_ENDSTOPS = _UxGT("Endstops"); // Max length 8 characters LSTR MSG_MAIN_MENU = _UxGT("Main"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("Auto pokretanje"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Ugasi steppere"); LSTR MSG_AUTO_HOME = _UxGT("Automatski homing"); LSTR MSG_AUTO_HOME_X = _UxGT("Home-aj X"); @@ -117,13 +116,13 @@ namespace LanguageNarrow_hr { LSTR MSG_STOPPED = _UxGT("ZAUSTAVLJEN. "); LSTR MSG_FILAMENTCHANGE = _UxGT("Promijeni filament"); LSTR MSG_FILAMENTCHANGE_E = _UxGT("Promijeni filament *"); - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("Init. SD karticu"); - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Init. USB pogon"); - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("Init. SD karticu"); - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("Init. SD karticu"); + LSTR MSG_ATTACH_SD = _UxGT("Init. SD karticu"); + LSTR MSG_ATTACH_USB = _UxGT("Init. USB pogon"); LSTR MSG_CHANGE_MEDIA = _UxGT("Promijeni SD karticu"); + LSTR MSG_RUN_AUTOFILES = _UxGT("Auto pokretanje"); + LSTR MSG_ERR_HEATING_FAILED = _UxGT("Grijanje neuspješno"); LSTR MSG_HEATING = _UxGT("Grijanje..."); LSTR MSG_BED_HEATING = _UxGT("Grijanje Bed-a..."); diff --git a/Marlin/src/lcd/language/language_hu.h b/Marlin/src/lcd/language/language_hu.h index a626aa2209..3159b79827 100644 --- a/Marlin/src/lcd/language/language_hu.h +++ b/Marlin/src/lcd/language/language_hu.h @@ -57,7 +57,6 @@ namespace LanguageNarrow_hu { LSTR MSG_MAIN_MENU = _UxGT(""); LSTR MSG_ADVANCED_SETTINGS = _UxGT("További beállítások"); LSTR MSG_CONFIGURATION = _UxGT("Konfiguráció"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("Fájl auto. futtatás"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Motorok kikapcsolása"); LSTR MSG_DEBUG_MENU = _UxGT("Hiba Menü"); LSTR MSG_PROGRESS_BAR_TEST = _UxGT("Haladás sáv teszt"); @@ -431,14 +430,14 @@ namespace LanguageNarrow_hu { LSTR MSG_FILAMENTUNLOAD = _UxGT("Szál eltávolítás"); LSTR MSG_FILAMENTUNLOAD_E = _UxGT("Szál eltávolítás *"); LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("Mindet eltávolít"); - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("Tároló SD"); - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Tároló USB"); - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("Tároló SD"); - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("Tároló SD"); + LSTR MSG_ATTACH_SD = _UxGT("Tároló SD"); + LSTR MSG_ATTACH_USB = _UxGT("Tároló USB"); LSTR MSG_CHANGE_MEDIA = _UxGT("Tároló csere"); LSTR MSG_RELEASE_MEDIA = _UxGT("Tároló Kiadása"); + LSTR MSG_RUN_AUTOFILES = _UxGT("Fájl auto. futtatás"); + LSTR MSG_ZPROBE_OUT = _UxGT("Z szonda tálcán kivül"); LSTR MSG_SKEW_FACTOR = _UxGT("Ferdeség faktor"); LSTR MSG_BLTOUCH = _UxGT("BLTouch"); diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index c1b5366332..424bcd8367 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -38,7 +38,13 @@ #define DISPLAY_CHARSET_ISO10646_1 -#define MEDIA_TYPE_IT "Media" +#if HAS_SDCARD && !HAS_USB_FLASH_DRIVE + #define MEDIA_TYPE_IT "SD" +#elif HAS_USB_FLASH_DRIVE + #define MEDIA_TYPE_IT "USB" +#else + #define MEDIA_TYPE_IT "Media" +#endif namespace LanguageNarrow_it { using namespace Language_en; // Inherit undefined strings from English @@ -69,7 +75,6 @@ namespace LanguageNarrow_it { LSTR MSG_MAIN_MENU = _UxGT("Menu principale"); LSTR MSG_ADVANCED_SETTINGS = _UxGT("Impostaz. avanzate"); LSTR MSG_CONFIGURATION = _UxGT("Configurazione"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("Esegui files auto"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Disabilita motori"); LSTR MSG_DEBUG_MENU = _UxGT("Menu di debug"); LSTR MSG_PROGRESS_BAR_TEST = _UxGT("Test barra avanzam."); @@ -581,14 +586,14 @@ namespace LanguageNarrow_it { LSTR MSG_FILAMENTUNLOAD = _UxGT("Rimuovi filamento"); LSTR MSG_FILAMENTUNLOAD_E = _UxGT("Rimuovi filam. *"); LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("Rimuovi tutto"); - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("Collega scheda SD"); - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Collega penna USB"); - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("Collega ") MEDIA_TYPE_IT; - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("Collega ") MEDIA_TYPE_IT; + LSTR MSG_ATTACH_SD = _UxGT("Collega scheda SD"); + LSTR MSG_ATTACH_USB = _UxGT("Collega penna USB"); LSTR MSG_CHANGE_MEDIA = _UxGT("Cambia ") MEDIA_TYPE_IT; LSTR MSG_RELEASE_MEDIA = _UxGT("Rilascia ") MEDIA_TYPE_IT; + LSTR MSG_RUN_AUTOFILES = _UxGT("Esegui files auto"); + LSTR MSG_ZPROBE_OUT = _UxGT("Z probe fuori piatto"); LSTR MSG_SKEW_FACTOR = _UxGT("Fattore distorsione"); LSTR MSG_BLTOUCH = _UxGT("BLTouch"); diff --git a/Marlin/src/lcd/language/language_jp_kana.h b/Marlin/src/lcd/language/language_jp_kana.h index ae88b1d968..37c9aa043e 100644 --- a/Marlin/src/lcd/language/language_jp_kana.h +++ b/Marlin/src/lcd/language/language_jp_kana.h @@ -47,7 +47,6 @@ namespace LanguageNarrow_jp_kana { 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" @@ -168,13 +167,13 @@ namespace LanguageNarrow_jp_kana { LSTR MSG_CONTROL_RETRACT_RECOVERF = _UxGT("ホショウソクド mm/s"); // "Unretract V" LSTR MSG_AUTORETRACT = _UxGT("ジドウヒキコミ"); // "Auto-Retract" LSTR MSG_FILAMENTCHANGE = _UxGT("フィラメントコウカン"); // "Change filament" - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("SDカードをマウントする"); // "Attach SD Card" - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("USBメモリをマウントする"); // "Attach USB Drive" - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("SDカードをマウントする"); // "Attach SD Card" - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("SDカードをマウントする"); // "Attach SD Card" + LSTR MSG_ATTACH_SD = _UxGT("SDカードをマウントする"); // "Attach SD Card" + LSTR MSG_ATTACH_USB = _UxGT("USBメモリをマウントする"); // "Attach USB Drive" LSTR MSG_CHANGE_MEDIA = _UxGT("メディアコウカン"); // "Change SD card" + LSTR MSG_RUN_AUTOFILES = _UxGT("ジドウカイシ"); // "Autostart" + 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" diff --git a/Marlin/src/lcd/language/language_ko_KR.h b/Marlin/src/lcd/language/language_ko_KR.h index d5410cadf5..4ecaab5394 100644 --- a/Marlin/src/lcd/language/language_ko_KR.h +++ b/Marlin/src/lcd/language/language_ko_KR.h @@ -42,7 +42,7 @@ namespace LanguageNarrow_ko_KR { LSTR MSG_MAIN_MENU = _UxGT("뒤로"); LSTR MSG_ADVANCED_SETTINGS = _UxGT("고급 설정"); LSTR MSG_CONFIGURATION = _UxGT("설정"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("자동 시작"); + LSTR MSG_RUN_AUTOFILES = _UxGT("자동 시작"); LSTR MSG_DISABLE_STEPPERS = _UxGT("모터 정지"); LSTR MSG_DEBUG_MENU = _UxGT("디버깅 메뉴"); LSTR MSG_PROGRESS_BAR_TEST = _UxGT("프로그레스바 테스트"); diff --git a/Marlin/src/lcd/language/language_nl.h b/Marlin/src/lcd/language/language_nl.h index e99417a2dc..bb4c7e00b2 100644 --- a/Marlin/src/lcd/language/language_nl.h +++ b/Marlin/src/lcd/language/language_nl.h @@ -43,7 +43,6 @@ namespace LanguageNarrow_nl { LSTR MSG_MEDIA_REMOVED = _UxGT("Kaart verwijderd"); LSTR MSG_LCD_ENDSTOPS = _UxGT("Endstops"); // Max length 8 characters LSTR MSG_MAIN_MENU = _UxGT("Hoofdmenu"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("Autostart"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Motoren uit"); LSTR MSG_DEBUG_MENU = _UxGT("Debug Menu"); // accepted English terms LSTR MSG_PROGRESS_BAR_TEST = _UxGT("Vooruitgang Test"); @@ -146,13 +145,13 @@ namespace LanguageNarrow_nl { LSTR MSG_AUTORETRACT = _UxGT("Auto-Retract"); LSTR MSG_FILAMENTCHANGE = _UxGT("Verv. Filament"); LSTR MSG_FILAMENTCHANGE_E = _UxGT("Verv. Filament *"); - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("Init. SD kaart"); - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Init. USB stick"); - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("Init. SD kaart"); - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("Init. SD kaart"); + LSTR MSG_ATTACH_SD = _UxGT("Init. SD kaart"); + LSTR MSG_ATTACH_USB = _UxGT("Init. USB stick"); LSTR MSG_CHANGE_MEDIA = _UxGT("Verv. SD Kaart"); + LSTR MSG_RUN_AUTOFILES = _UxGT("Autostart"); + LSTR MSG_ZPROBE_OUT = _UxGT("Z probe uit. bed"); LSTR MSG_BLTOUCH_SELFTEST = _UxGT("BLTouch Zelf-Test"); LSTR MSG_BLTOUCH_RESET = _UxGT("Reset BLTouch"); diff --git a/Marlin/src/lcd/language/language_pl.h b/Marlin/src/lcd/language/language_pl.h index 07573bb2d8..7c7297d184 100644 --- a/Marlin/src/lcd/language/language_pl.h +++ b/Marlin/src/lcd/language/language_pl.h @@ -61,7 +61,6 @@ namespace LanguageNarrow_pl { LSTR MSG_MAIN_MENU = _UxGT("Menu główne"); LSTR MSG_ADVANCED_SETTINGS = _UxGT("Ustawienie zaawansowane"); LSTR MSG_CONFIGURATION = _UxGT("Konfiguracja"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("Autostart"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Wyłącz silniki"); LSTR MSG_DEBUG_MENU = _UxGT("Menu Debugowania"); LSTR MSG_PROGRESS_BAR_TEST = _UxGT("Testowy pasek postępu"); @@ -358,14 +357,14 @@ namespace LanguageNarrow_pl { LSTR MSG_FILAMENTUNLOAD = _UxGT("Wysuń Filament"); LSTR MSG_FILAMENTUNLOAD_E = _UxGT("Wysuń Filament *"); LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("Wysuń wszystkie"); - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("Inicjal. karty SD"); - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Inicjal. dysk flash"); - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("Inicjal. karty SD"); - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("Inicjal. karty SD"); + LSTR MSG_ATTACH_SD = _UxGT("Inicjal. karty SD"); + LSTR MSG_ATTACH_USB = _UxGT("Inicjal. dysk flash"); LSTR MSG_CHANGE_MEDIA = _UxGT("Zmiana karty SD"); LSTR MSG_RELEASE_MEDIA = _UxGT("Zwolnienie karty"); + LSTR MSG_RUN_AUTOFILES = _UxGT("Autostart"); + LSTR MSG_ZPROBE_OUT = _UxGT("Sonda Z za stołem"); LSTR MSG_SKEW_FACTOR = _UxGT("Współczynik skrzywienia"); LSTR MSG_BLTOUCH_SELFTEST = _UxGT("BLTouch Self-Test"); diff --git a/Marlin/src/lcd/language/language_pt.h b/Marlin/src/lcd/language/language_pt.h index 62799fc9a5..229211b4f2 100644 --- a/Marlin/src/lcd/language/language_pt.h +++ b/Marlin/src/lcd/language/language_pt.h @@ -142,13 +142,12 @@ namespace LanguageNarrow_pt { LSTR MSG_AUTORETRACT = _UxGT(" Auto-Retract"); LSTR MSG_FILAMENTCHANGE = _UxGT("Trocar filamento"); LSTR MSG_FILAMENTCHANGE_E = _UxGT("Trocar filamento *"); - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("Inici. cartão SD"); - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Inici. flash USB"); - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("Inici. cartão SD"); - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("Inici. cartão SD"); + LSTR MSG_ATTACH_SD = _UxGT("Inici. cartão SD"); + LSTR MSG_ATTACH_USB = _UxGT("Inici. flash USB"); LSTR MSG_CHANGE_MEDIA = _UxGT("Trocar cartão SD"); + LSTR MSG_ZPROBE_OUT = _UxGT("Sensor fora/base"); LSTR MSG_ZPROBE_XOFFSET = _UxGT("Desvio X"); LSTR MSG_ZPROBE_YOFFSET = _UxGT("Desvio Y"); diff --git a/Marlin/src/lcd/language/language_pt_br.h b/Marlin/src/lcd/language/language_pt_br.h index 8d5a608d00..80a8d95bdb 100644 --- a/Marlin/src/lcd/language/language_pt_br.h +++ b/Marlin/src/lcd/language/language_pt_br.h @@ -50,7 +50,6 @@ namespace LanguageNarrow_pt_br { LSTR MSG_MAIN_MENU = _UxGT("Menu principal"); LSTR MSG_ADVANCED_SETTINGS = _UxGT("Config. Avançada"); LSTR MSG_CONFIGURATION = _UxGT("Configuração"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("Início automático"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Desabilit. motores"); LSTR MSG_DEBUG_MENU = _UxGT("Menu Debug"); LSTR MSG_PROGRESS_BAR_TEST = _UxGT("Testar Barra Progres"); @@ -321,14 +320,14 @@ namespace LanguageNarrow_pt_br { LSTR MSG_FILAMENTUNLOAD = _UxGT("Descarreg. Filamento"); LSTR MSG_FILAMENTUNLOAD_E = _UxGT("Descarreg. Filamento *"); LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("Descarregar Todos"); - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("Iniciar cartão SD"); - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Iniciar flash USB"); - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("Iniciar cartão SD"); - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("Iniciar cartão SD"); + LSTR MSG_ATTACH_SD = _UxGT("Iniciar cartão SD"); + LSTR MSG_ATTACH_USB = _UxGT("Iniciar flash USB"); LSTR MSG_CHANGE_MEDIA = _UxGT("Trocar SD"); LSTR MSG_RELEASE_MEDIA = _UxGT("Liberar SD"); + LSTR MSG_RUN_AUTOFILES = _UxGT("Início automático"); + LSTR MSG_ZPROBE_OUT = _UxGT("Sonda fora da mesa"); LSTR MSG_SKEW_FACTOR = _UxGT("Fator de Cisalho"); LSTR MSG_BLTOUCH = _UxGT("BLTouch"); diff --git a/Marlin/src/lcd/language/language_ro.h b/Marlin/src/lcd/language/language_ro.h index 0b263a4ea6..7337862909 100644 --- a/Marlin/src/lcd/language/language_ro.h +++ b/Marlin/src/lcd/language/language_ro.h @@ -52,7 +52,6 @@ namespace LanguageNarrow_ro { LSTR MSG_MAIN_MENU = _UxGT("Principal"); LSTR MSG_ADVANCED_SETTINGS = _UxGT("Setari Avansate"); LSTR MSG_CONFIGURATION = _UxGT("Configurare"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("Autostart"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Dezactivare Motoare"); LSTR MSG_DEBUG_MENU = _UxGT("Meniu Debug"); LSTR MSG_PROGRESS_BAR_TEST = _UxGT("Test Bara Progres"); @@ -388,14 +387,14 @@ namespace LanguageNarrow_ro { LSTR MSG_FILAMENTUNLOAD = _UxGT("Scoatere Filament"); LSTR MSG_FILAMENTUNLOAD_E = _UxGT("Scoatere Filament *"); LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("Scoate Tot"); - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("Atasare card SD"); - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Atasare FD USB"); - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("Atasare card SD"); - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("Atasare card SD"); + LSTR MSG_ATTACH_SD = _UxGT("Atasare card SD"); + LSTR MSG_ATTACH_USB = _UxGT("Atasare FD USB"); LSTR MSG_CHANGE_MEDIA = _UxGT("Inlocuire Media"); LSTR MSG_RELEASE_MEDIA = _UxGT("Eliberare Media"); + LSTR MSG_RUN_AUTOFILES = _UxGT("Autostart"); + LSTR MSG_ZPROBE_OUT = _UxGT("Z Probe Past Bed"); LSTR MSG_SKEW_FACTOR = _UxGT("Skew Factor"); LSTR MSG_BLTOUCH = _UxGT("BLTouch"); diff --git a/Marlin/src/lcd/language/language_ru.h b/Marlin/src/lcd/language/language_ru.h index 42e1656a8b..40b3a03d3d 100644 --- a/Marlin/src/lcd/language/language_ru.h +++ b/Marlin/src/lcd/language/language_ru.h @@ -53,7 +53,6 @@ namespace LanguageNarrow_ru { LSTR MSG_LCD_ENDSTOPS = _UxGT("Концевик"); // Max length 8 characters LSTR MSG_MAIN_MENU = _UxGT("Главное меню"); LSTR MSG_CONFIGURATION = _UxGT("Конфигурация"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("Автостарт"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Выключить двигатели"); LSTR MSG_DEBUG_MENU = _UxGT("Меню отладки"); LSTR MSG_PROGRESS_BAR_TEST = _UxGT("Тест индикатора"); @@ -435,14 +434,14 @@ namespace LanguageNarrow_ru { LSTR MSG_FILAMENTLOAD_E = _UxGT("Подать филамент *"); LSTR MSG_FILAMENTUNLOAD_E = _UxGT("Убрать филамент *"); LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("Выгрузить всё"); - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("Установить SD карту"); - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Монтировать USB"); // Установить флешка - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("Установить SD карту"); - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("Установить SD карту"); + LSTR MSG_ATTACH_SD = _UxGT("Установить SD карту"); + LSTR MSG_ATTACH_USB = _UxGT("Монтировать USB"); // Установить флешка LSTR MSG_CHANGE_MEDIA = _UxGT("Сменить SD карту"); LSTR MSG_RELEASE_MEDIA = _UxGT("Освободить SD карту"); + LSTR MSG_RUN_AUTOFILES = _UxGT("Автостарт"); + LSTR MSG_ZPROBE_OUT = _UxGT("Z-зонд вне стола"); LSTR MSG_SKEW_FACTOR = _UxGT("Фактор перекоса"); LSTR MSG_BLTOUCH = _UxGT("Z-зонд BLTouch"); diff --git a/Marlin/src/lcd/language/language_sk.h b/Marlin/src/lcd/language/language_sk.h index 782f42f118..7a8c228d84 100644 --- a/Marlin/src/lcd/language/language_sk.h +++ b/Marlin/src/lcd/language/language_sk.h @@ -68,7 +68,6 @@ namespace LanguageNarrow_sk { LSTR MSG_MAIN_MENU = _UxGT("Hlavná ponuka"); LSTR MSG_ADVANCED_SETTINGS = _UxGT("Pokročilé nastav."); LSTR MSG_CONFIGURATION = _UxGT("Konfigurácia"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("Auto-štart"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Uvolniť motory"); LSTR MSG_DEBUG_MENU = _UxGT("Ponuka ladenia"); LSTR MSG_PROGRESS_BAR_TEST = _UxGT("Test uk. priebehu"); @@ -533,14 +532,14 @@ namespace LanguageNarrow_sk { LSTR MSG_FILAMENTUNLOAD = _UxGT("Vysunúť filament"); LSTR MSG_FILAMENTUNLOAD_E = _UxGT("Vysunúť filament *"); LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("Vysunúť všetko"); - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("Načítať SD kartu"); - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Načítať USB disk"); - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("Načítať SD kartu"); - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("Načítať SD kartu"); + LSTR MSG_ATTACH_SD = _UxGT("Načítať SD kartu"); + LSTR MSG_ATTACH_USB = _UxGT("Načítať USB disk"); LSTR MSG_CHANGE_MEDIA = _UxGT("Vymeniť kartu"); LSTR MSG_RELEASE_MEDIA = _UxGT("Odpojiť kartu"); + LSTR MSG_RUN_AUTOFILES = _UxGT("Auto-štart"); + LSTR MSG_ZPROBE_OUT = _UxGT("Sonda Z mimo podl."); LSTR MSG_SKEW_FACTOR = _UxGT("Faktor skosenia"); LSTR MSG_BLTOUCH = _UxGT("BLTouch"); diff --git a/Marlin/src/lcd/language/language_sv.h b/Marlin/src/lcd/language/language_sv.h index 356a253b6e..e2e408391c 100644 --- a/Marlin/src/lcd/language/language_sv.h +++ b/Marlin/src/lcd/language/language_sv.h @@ -54,7 +54,6 @@ namespace LanguageNarrow_sv { LSTR MSG_MAIN_MENU = _UxGT("Huvud"); LSTR MSG_ADVANCED_SETTINGS = _UxGT("Advancerade inställningar"); LSTR MSG_CONFIGURATION = _UxGT("Konfiguration"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("Autostarta Filer"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Inaktivera Stegare"); LSTR MSG_DEBUG_MENU = _UxGT("Debug Meny"); LSTR MSG_PROGRESS_BAR_TEST = _UxGT("Framstegsindikator Test"); @@ -417,14 +416,14 @@ namespace LanguageNarrow_sv { LSTR MSG_FILAMENTUNLOAD = _UxGT("Lossa Tråd"); LSTR MSG_FILAMENTUNLOAD_E = _UxGT("Lossa *"); LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("Lossa All"); - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("Bifoga SD-kort"); - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Bifoga USB-minne"); - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("Bifoga SD-kort"); - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("Bifoga SD-kort"); + LSTR MSG_ATTACH_SD = _UxGT("Bifoga SD-kort"); + LSTR MSG_ATTACH_USB = _UxGT("Bifoga USB-minne"); LSTR MSG_CHANGE_MEDIA = _UxGT("Byt Media"); LSTR MSG_RELEASE_MEDIA = _UxGT("Släpp Media"); + LSTR MSG_RUN_AUTOFILES = _UxGT("Autostarta Filer"); + LSTR MSG_ZPROBE_OUT = _UxGT("Z Sond Utanför Bädd"); LSTR MSG_SKEW_FACTOR = _UxGT("Skev Faktor"); LSTR MSG_BLTOUCH = _UxGT("BLTouch"); diff --git a/Marlin/src/lcd/language/language_tr.h b/Marlin/src/lcd/language/language_tr.h index 947f094fa6..36fe4188fa 100644 --- a/Marlin/src/lcd/language/language_tr.h +++ b/Marlin/src/lcd/language/language_tr.h @@ -68,7 +68,6 @@ namespace LanguageNarrow_tr { LSTR MSG_MAIN_MENU = _UxGT("Ana"); LSTR MSG_ADVANCED_SETTINGS = _UxGT("Gelişmiş Ayarlar"); LSTR MSG_CONFIGURATION = _UxGT("Yapılandırma"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("Oto. Başlat"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Motorları Durdur"); LSTR MSG_DEBUG_MENU = _UxGT("Hata Ayıklama"); LSTR MSG_PROGRESS_BAR_TEST = _UxGT("Durum Çubuğu Testi"); @@ -550,14 +549,14 @@ namespace LanguageNarrow_tr { LSTR MSG_FILAMENTUNLOAD = _UxGT("Filaman Çıkart"); LSTR MSG_FILAMENTUNLOAD_E = _UxGT("Filaman Çıkart *"); LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("Tümünü Çıkart"); - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("SD Kartı takın"); - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("USB Sürücüyü takın"); - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("Medyayı Ekle"); - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("Medyayı Ekle"); + LSTR MSG_ATTACH_SD = _UxGT("SD Kartı takın"); + LSTR MSG_ATTACH_USB = _UxGT("USB Sürücüyü takın"); LSTR MSG_CHANGE_MEDIA = _UxGT("Medyayı Değiştir"); LSTR MSG_RELEASE_MEDIA = _UxGT("Medyayı Çıkart"); + LSTR MSG_RUN_AUTOFILES = _UxGT("Oto. Başlat"); + LSTR MSG_ZPROBE_OUT = _UxGT("Z Prob Tablayı Geçti"); LSTR MSG_SKEW_FACTOR = _UxGT("Çarpıklık Faktörü"); LSTR MSG_BLTOUCH = _UxGT("BLTouch"); diff --git a/Marlin/src/lcd/language/language_uk.h b/Marlin/src/lcd/language/language_uk.h index c061b9ad02..4d323d6ba7 100644 --- a/Marlin/src/lcd/language/language_uk.h +++ b/Marlin/src/lcd/language/language_uk.h @@ -54,7 +54,6 @@ namespace LanguageNarrow_uk { LSTR MSG_MAIN_MENU = _UxGT("Основне меню"); LSTR MSG_ADVANCED_SETTINGS = _UxGT("Інші налаштування"); LSTR MSG_CONFIGURATION = _UxGT("Конфігурація"); - LSTR MSG_RUN_AUTO_FILES = _UxGT("Автостарт"); LSTR MSG_DISABLE_STEPPERS = _UxGT("Вимкнути двигуни"); LSTR MSG_DEBUG_MENU = _UxGT("Меню Debug"); LSTR MSG_PROGRESS_BAR_TEST = _UxGT("Тест лінії прогр."); @@ -445,14 +444,14 @@ namespace LanguageNarrow_uk { LSTR MSG_FILAMENTUNLOAD = _UxGT("Видалити пруток"); LSTR MSG_FILAMENTUNLOAD_E = _UxGT("Видалити пруток *"); LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("Видалити все"); - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("Вставити SD-картку"); - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Вставити USB флешка"); - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("Вставити SD-картку"); - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("Вставити SD-картку"); + LSTR MSG_ATTACH_SD = _UxGT("Вставити SD-картку"); + LSTR MSG_ATTACH_USB = _UxGT("Вставити USB флешка"); LSTR MSG_CHANGE_MEDIA = _UxGT("Заміна SD-картки"); LSTR MSG_RELEASE_MEDIA = _UxGT("Видаліть SD-картку"); + LSTR MSG_RUN_AUTOFILES = _UxGT("Автостарт"); + LSTR MSG_ZPROBE_OUT = _UxGT("Z-Зонд поза столом"); LSTR MSG_SKEW_FACTOR = _UxGT("Фактор нахилу"); LSTR MSG_BLTOUCH = _UxGT("BLTouch"); diff --git a/Marlin/src/lcd/language/language_vi.h b/Marlin/src/lcd/language/language_vi.h index fb158e306b..f7f5545bcb 100644 --- a/Marlin/src/lcd/language/language_vi.h +++ b/Marlin/src/lcd/language/language_vi.h @@ -47,7 +47,6 @@ namespace LanguageNarrow_vi { 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 - LSTR MSG_RUN_AUTO_FILES = _UxGT("Khởi chạy tự động"); // Autostart LSTR MSG_DISABLE_STEPPERS = _UxGT("Tắt động cơ bước"); // Disable steppers 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 @@ -309,14 +308,14 @@ namespace LanguageNarrow_vi { 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 - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("Khởi tạo thẻ SD"); // Attach SD Card - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Khởi tạo thanh USB"); // Attach USB Drive - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("Khởi tạo phương tiện"); // Attach media - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("Khởi tạo phương tiện"); // Attach media + LSTR MSG_ATTACH_SD = _UxGT("Khởi tạo thẻ SD"); // Attach SD Card + LSTR MSG_ATTACH_USB = _UxGT("Khởi tạo thanh USB"); // Attach USB Drive 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_RUN_AUTOFILES = _UxGT("Khởi chạy tự động"); // Autostart + 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 @@ -373,19 +372,11 @@ namespace LanguageNarrow_vi { 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_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 - #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_FILAMENT = _UxGT("Đã ép đùn"); - #endif + 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"); 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 @@ -446,6 +437,11 @@ namespace LanguageNarrow_vi { namespace LanguageWide_vi { using namespace LanguageNarrow_vi; #if LCD_WIDTH >= 20 || HAS_DWIN_E3V2 + 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 #endif } diff --git a/Marlin/src/lcd/language/language_zh_CN.h b/Marlin/src/lcd/language/language_zh_CN.h index 680ff8c9b0..01f9f53d0c 100644 --- a/Marlin/src/lcd/language/language_zh_CN.h +++ b/Marlin/src/lcd/language/language_zh_CN.h @@ -54,7 +54,6 @@ namespace LanguageNarrow_zh_CN { 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" @@ -398,14 +397,14 @@ namespace LanguageNarrow_zh_CN { LSTR MSG_FILAMENTUNLOAD = _UxGT("卸载丝料"); // "Unload filament" LSTR MSG_FILAMENTUNLOAD_E = _UxGT("卸载丝料 *"); // "Unload filament" LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("卸载全部"); // "Unload All" - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("挂载存储卡"); // "Attach SD Card" - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("挂载U盘"); // "Attach USB Drive" - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("挂载存储卡"); // "Attach SD Card" - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("挂载存储卡"); // "Attach SD Card" + LSTR MSG_ATTACH_SD = _UxGT("挂载存储卡"); // "Attach SD Card" + LSTR MSG_ATTACH_USB = _UxGT("挂载U盘"); // "Attach USB Drive" LSTR MSG_CHANGE_MEDIA = _UxGT("更换存储卡"); // "Change SD card" LSTR MSG_RELEASE_MEDIA = _UxGT("释放存储卡"); + LSTR MSG_RUN_AUTOFILES = _UxGT("自动开始"); // "Autostart" + 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" diff --git a/Marlin/src/lcd/language/language_zh_TW.h b/Marlin/src/lcd/language/language_zh_TW.h index 63e386a06f..7321252de7 100644 --- a/Marlin/src/lcd/language/language_zh_TW.h +++ b/Marlin/src/lcd/language/language_zh_TW.h @@ -49,7 +49,6 @@ namespace LanguageNarrow_zh_TW { 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" @@ -350,14 +349,14 @@ namespace LanguageNarrow_zh_TW { LSTR MSG_FILAMENTUNLOAD = _UxGT("卸載絲料"); // "Unload filament" LSTR MSG_FILAMENTUNLOAD_E = _UxGT("卸載絲料 *"); // "Unload filament" LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("卸載全部"); // "Unload All" - #if HAS_MULTI_VOLUME - LSTR MSG_ATTACH_SD_MEDIA = _UxGT("挂载記憶卡"); // "Attach SD Card" - LSTR MSG_ATTACH_USB_MEDIA = _UxGT("挂载隨身碟"); // "Attach USB Drive" - #else - LSTR MSG_ATTACH_MEDIA = _UxGT("連接記憶卡"); // "Attach Media" - #endif + + LSTR MSG_ATTACH_MEDIA = _UxGT("連接記憶卡"); // "Attach Media" + LSTR MSG_ATTACH_SD = _UxGT("挂载記憶卡"); // "Attach SD Card" + LSTR MSG_ATTACH_USB = _UxGT("挂载隨身碟"); // "Attach USB Drive" LSTR MSG_CHANGE_MEDIA = _UxGT("更換記憶卡"); // "Change SD card" LSTR MSG_RELEASE_MEDIA = _UxGT("釋放媒體"); // "Release Media" + LSTR MSG_RUN_AUTOFILES = _UxGT("自動開始"); // "Autostart" + 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" diff --git a/Marlin/src/lcd/menu/menu_main.cpp b/Marlin/src/lcd/menu/menu_main.cpp index 9509c72cc5..7e2d458e41 100644 --- a/Marlin/src/lcd/menu/menu_main.cpp +++ b/Marlin/src/lcd/menu/menu_main.cpp @@ -253,13 +253,13 @@ void menu_main() { if (card_detected) { if (!card_open) { #if ENABLED(MENU_ADDAUTOSTART) - ACTION_ITEM(MSG_RUN_AUTO_FILES, card.autofile_begin); // Run Auto Files + ACTION_ITEM(MSG_RUN_AUTOFILES, card.autofile_begin); // Run Auto Files #endif #if HAS_SD_DETECT GCODES_ITEM(MSG_CHANGE_MEDIA, F("M21" TERN_(HAS_MULTI_VOLUME, "S"))); // M21 Change Media #if HAS_MULTI_VOLUME - GCODES_ITEM(MSG_ATTACH_USB_MEDIA, F("M21U")); // M21 Attach USB Media + GCODES_ITEM(MSG_ATTACH_USB, F("M21U")); // M21 Attach USB Media #endif #else // - or - ACTION_ITEM(MSG_RELEASE_MEDIA, []{ // M22 Release Media @@ -279,8 +279,8 @@ void menu_main() { ACTION_ITEM(MSG_NO_MEDIA, nullptr); // "No Media" #else #if HAS_MULTI_VOLUME - GCODES_ITEM(MSG_ATTACH_SD_MEDIA, F("M21S")); // M21S Attach SD Card - GCODES_ITEM(MSG_ATTACH_USB_MEDIA, F("M21U")); // M21U Attach USB Media + GCODES_ITEM(MSG_ATTACH_SD, F("M21S")); // M21S Attach SD Card + GCODES_ITEM(MSG_ATTACH_USB, F("M21U")); // M21U Attach USB Media #else GCODES_ITEM(MSG_ATTACH_MEDIA, F("M21")); // M21 Attach Media #endif From 62f2b8fc176887071e9a07152420f28fe54fceef Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Thu, 24 Apr 2025 00:30:48 +0000 Subject: [PATCH 56/86] [cron] Bump distribution date (2025-04-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 e9c1d9ba1b..e8a64a95f0 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 "2025-04-23" +//#define STRING_DISTRIBUTION_DATE "2025-04-24" /** * The protocol for communication to the host. Protocol indicates communication diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index d06c53dd5e..8a91fbdb71 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 "2025-04-23" + #define STRING_DISTRIBUTION_DATE "2025-04-24" #endif /** From d16667838fdbdf793840ee5ac8b977746af6055d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 23 Apr 2025 18:37:03 -0500 Subject: [PATCH 57/86] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Clari?= =?UTF-8?q?fy=20some=20SD=20/=20FD=20build=20flags?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/sd/M21_M22.cpp | 4 +- Marlin/src/inc/Conditionals-4-adv.h | 11 +- Marlin/src/inc/Conditionals-5-post.h | 2 + Marlin/src/inc/SanityCheck.h | 2 +- .../lcd/extui/mks_ui/draw_media_select.cpp | 4 +- .../extui/mks_ui/tft_lvgl_configuration.cpp | 15 +- Marlin/src/lcd/marlinui.cpp | 2 +- Marlin/src/lcd/menu/menu.h | 2 +- Marlin/src/lcd/menu/menu_media.cpp | 18 +-- Marlin/src/sd/cardreader.cpp | 24 ++-- Marlin/src/sd/cardreader.h | 112 ++++++++++----- .../sd/usb_flashdrive/Sd2Card_FlashDrive.cpp | 130 +++++++++--------- 12 files changed, 190 insertions(+), 136 deletions(-) diff --git a/Marlin/src/gcode/sd/M21_M22.cpp b/Marlin/src/gcode/sd/M21_M22.cpp index f561229b17..672dc80f00 100644 --- a/Marlin/src/gcode/sd/M21_M22.cpp +++ b/Marlin/src/gcode/sd/M21_M22.cpp @@ -38,9 +38,9 @@ void GcodeSuite::M21() { #if HAS_MULTI_VOLUME const int8_t vol = parser.intval('P', -1); if (vol == 0 || parser.seen_test('S')) // "S" for SD Card - card.changeMedia(&card.media_driver_sdcard); + card.selectMediaSDCard(); else if (vol == 1 || parser.seen_test('U')) // "U" for USB - card.changeMedia(&card.media_driver_usbFlash); + card.selectMediaFlashDrive(); #endif card.mount(); } diff --git a/Marlin/src/inc/Conditionals-4-adv.h b/Marlin/src/inc/Conditionals-4-adv.h index 3b01077931..a9427c3605 100644 --- a/Marlin/src/inc/Conditionals-4-adv.h +++ b/Marlin/src/inc/Conditionals-4-adv.h @@ -1248,10 +1248,17 @@ #if ENABLED(MULTI_VOLUME) #define HAS_MULTI_VOLUME 1 + #define SV_SD_ONBOARD 101 + #define SV_USB_FLASH_DRIVE 102 + #define _VOLUME_ID(N) _CAT(SV_, N) + #define SHARED_VOLUME_IS(N) (DEFAULT_SHARED_VOLUME == _VOLUME_ID(N)) +#else + #define SHARED_VOLUME_IS(...) 0 #endif -#if ENABLED(USB_FLASH_DRIVE_SUPPORT) + +#if ANY(USB_FLASH_DRIVE_SUPPORT, VOLUME_USB_FLASH_DRIVE) #define HAS_USB_FLASH_DRIVE 1 - #if NONE(USE_OTG_USB_HOST, USE_UHS3_USB) + #if NONE(USE_OTG_USB_HOST, USE_UHS2_USB, USE_UHS3_USB) #define USE_UHS2_USB #endif #endif diff --git a/Marlin/src/inc/Conditionals-5-post.h b/Marlin/src/inc/Conditionals-5-post.h index fd06285bca..ae9074ec89 100644 --- a/Marlin/src/inc/Conditionals-5-post.h +++ b/Marlin/src/inc/Conditionals-5-post.h @@ -550,7 +550,9 @@ #endif #endif + // Tests indicating a single or multi-volume SD Card #if !HAS_USB_FLASH_DRIVE || ALL(HAS_MULTI_VOLUME, VOLUME_SD_ONBOARD) + #define HAS_SDCARD 1 #if ENABLED(ONBOARD_SDIO) #define NEED_SD2CARD_SDIO 1 #else diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 970847ecb5..3182d93e92 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -3943,7 +3943,7 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive." #if HAS_USB_FLASH_DRIVE && DISABLED(USE_OTG_USB_HOST) && !PINS_EXIST(USB_CS, USB_INTR) #error "USB_CS_PIN and USB_INTR_PIN (or USE_OTG_USB_HOST) are required for USB_FLASH_DRIVE_SUPPORT." -#elif ENABLED(USE_OTG_USB_HOST) && !defined(HAS_OTG_USB_HOST_SUPPORT) +#elif ENABLED(USE_OTG_USB_HOST) && DISABLED(HAS_OTG_USB_HOST_SUPPORT) #error "The current board does not support USE_OTG_USB_HOST." #endif 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 25a9238705..a327f2f33e 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_media_select.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_media_select.cpp @@ -46,8 +46,8 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { if (event != LV_EVENT_RELEASED) return; lv_clear_media_select(); switch (obj->mks_obj_id) { - case ID_T_USB_DISK: card.changeMedia(&card.media_driver_usbFlash); break; - case ID_T_SD_DISK: card.changeMedia(&card.media_driver_sdcard); break; + case ID_T_USB_DISK: card.selectMediaFlashDrive(); break; + case ID_T_SD_DISK: card.selectMediaSDCard(); break; case ID_T_RETURN: TERN_(MKS_TEST, current_disp_ui = 1); lv_draw_ready_print(); 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 7a56cf371f..e138449181 100644 --- a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp +++ b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp @@ -135,18 +135,19 @@ void tft_lvgl_init() { hal.watchdog_refresh(); // LVGL init takes time #if HAS_USB_FLASH_DRIVE - uint16_t usb_flash_loop = 1000; #if HAS_MULTI_VOLUME && !HAS_SD_HOST_DRIVE if (IS_SD_INSERTED()) - card.changeMedia(&card.media_driver_sdcard); + card.selectMediaSDCard(); else - card.changeMedia(&card.media_driver_usbFlash); + card.selectMediaFlashDrive(); #endif - do { - card.media_driver_usbFlash.idle(); + // Wait up to two seconds for USB Drive to mount + for (uint16_t usb_flash_loop = 500; --usb_flash_loop;) { hal.watchdog_refresh(); - delay(2); - } while (!card.media_driver_usbFlash.isInserted() && usb_flash_loop--); + card.media_driver_usbFlash.idle(); + delay(4); + if (card.media_driver_usbFlash.isInserted()) break; + } card.mount(); #elif HAS_LOGO_IN_FLASH delay(1000); diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 7f78d21bf3..1726c67930 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -1114,7 +1114,7 @@ void MarlinUI::init() { #if MARLINUI_SCROLL_NAME // 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_filelist && filename_scroll_max && !lcd_status_update_delay--) { + if (currentScreen == menu_file_selector && filename_scroll_max && !lcd_status_update_delay--) { lcd_status_update_delay = ++filename_scroll_pos >= filename_scroll_max ? 12 : 4; // Long delay at end and start if (filename_scroll_pos > filename_scroll_max) filename_scroll_pos = 0; refresh(LCDVIEW_REDRAW_NOW); diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index 80a84af1ba..b7861655e2 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -211,7 +211,7 @@ void menu_main(); void menu_move(); #if HAS_MEDIA - void menu_media_filelist(); + void menu_file_selector(); void menu_media(); #endif diff --git a/Marlin/src/lcd/menu/menu_media.cpp b/Marlin/src/lcd/menu/menu_media.cpp index 8633551672..8747685fe5 100644 --- a/Marlin/src/lcd/menu/menu_media.cpp +++ b/Marlin/src/lcd/menu/menu_media.cpp @@ -45,7 +45,7 @@ void lcd_sd_updir() { void MarlinUI::reselect_last_file() { if (sd_encoder_position == 0xFFFF) return; - goto_screen(menu_media_filelist, sd_encoder_position, sd_top_line, sd_items); + goto_screen(menu_file_selector, sd_encoder_position, sd_top_line, sd_items); sd_encoder_position = 0xFFFF; defer_status_screen(); } @@ -105,11 +105,11 @@ class MenuItem_sdfolder : public MenuItem_sdbase { void menu_media_select() { START_MENU(); BACK_ITEM_F(TERN1(BROWSE_MEDIA_ON_INSERT, screen_history_depth) ? GET_TEXT_F(MSG_MAIN_MENU) : GET_TEXT_F(MSG_BACK)); - #if ENABLED(VOLUME_SD_ONBOARD) - ACTION_ITEM(MSG_SD_CARD, []{ card.changeMedia(&card.media_driver_sdcard); card.mount(); ui.goto_screen(menu_media_filelist); }); + #if HAS_SDCARD + ACTION_ITEM(MSG_SD_CARD, []{ card.selectMediaSDCard(); card.mount(); ui.goto_screen(menu_file_selector); }); #endif - #if ENABLED(VOLUME_USB_FLASH_DRIVE) - ACTION_ITEM(MSG_USB_DISK, []{ card.changeMedia(&card.media_driver_usbFlash); card.mount(); ui.goto_screen(menu_media_filelist); }); + #if HAS_USB_FLASH_DRIVE + ACTION_ITEM(MSG_USB_DISK, []{ card.selectMediaFlashDrive(); card.mount(); ui.goto_screen(menu_file_selector); }); #endif END_MENU(); } @@ -117,14 +117,14 @@ class MenuItem_sdfolder : public MenuItem_sdbase { /** * "Select From Media" menu item. Depending on single or multiple drives: - * - menu_media_filelist - List files on the current media - * - menu_media_select - Select one of the attached drives, then go to the file list + * - menu_file_selector - List files on the current media + * - menu_media_select - Select one of the attached drives, then go to the file list */ void menu_media() { - ui.goto_screen(TERN(HAS_MULTI_VOLUME, menu_media_select, menu_media_filelist)); + ui.goto_screen(TERN(HAS_MULTI_VOLUME, menu_media_select, menu_file_selector)); } -void menu_media_filelist() { +void menu_file_selector() { ui.encoder_direction_menus(); #if HAS_MARLINUI_U8GLIB diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index 647e071c72..cd20f921db 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -28,6 +28,10 @@ #if HAS_MEDIA +#if HAS_MULTI_VOLUME && !SHARED_VOLUME_IS(SD_ONBOARD) && !SHARED_VOLUME_IS(USB_FLASH_DRIVE) + #error "DEFAULT_SHARED_VOLUME must be either SV_SD_ONBOARD or SV_USB_FLASH_DRIVE." +#endif + //#define DEBUG_CARDREADER #include "cardreader.h" @@ -132,12 +136,12 @@ int16_t CardReader::nrItems = -1; #endif // SDCARD_SORT_ALPHA -#if HAS_USB_FLASH_DRIVE - DiskIODriver_USBFlash CardReader::media_driver_usbFlash; +#if HAS_SDCARD + CardReader::sdcard_driver_t CardReader::media_driver_sdcard; #endif -#if NEED_SD2CARD_SDIO || NEED_SD2CARD_SPI - CardReader::sdcard_driver_t CardReader::media_driver_sdcard; +#if HAS_USB_FLASH_DRIVE + DiskIODriver_USBFlash CardReader::media_driver_usbFlash; #endif DiskIODriver* CardReader::driver = nullptr; @@ -153,13 +157,11 @@ MediaFile CardReader::file; uint32_t CardReader::filesize, CardReader::sdpos; CardReader::CardReader() { - changeMedia(& - #if HAS_USB_FLASH_DRIVE && !SHARED_VOLUME_IS(SD_ONBOARD) - media_driver_usbFlash - #else - media_driver_sdcard - #endif - ); + #if HAS_USB_FLASH_DRIVE && !SHARED_VOLUME_IS(SD_ONBOARD) + selectMediaFlashDrive(); + #else + selectMediaSDCard(); + #endif #if ENABLED(SDCARD_SORT_ALPHA) sort_count = 0; diff --git a/Marlin/src/sd/cardreader.h b/Marlin/src/sd/cardreader.h index eeead4e490..7dfe7e344f 100644 --- a/Marlin/src/sd/cardreader.h +++ b/Marlin/src/sd/cardreader.h @@ -60,18 +60,6 @@ extern const char M23_STR[], M24_STR[]; #include "Sd2Card.h" #endif -#if HAS_MULTI_VOLUME - #define SV_SD_ONBOARD 1 - #define SV_USB_FLASH_DRIVE 2 - #define _VOLUME_ID(N) _CAT(SV_, N) - #define SHARED_VOLUME_IS(N) (DEFAULT_SHARED_VOLUME == _VOLUME_ID(N)) - #if !SHARED_VOLUME_IS(SD_ONBOARD) && !SHARED_VOLUME_IS(USB_FLASH_DRIVE) - #error "DEFAULT_SHARED_VOLUME must be either SD_ONBOARD or USB_FLASH_DRIVE." - #endif -#else - #define SHARED_VOLUME_IS(...) 0 -#endif - typedef struct { bool saving:1, // Receiving a G-code file or logging commands during a print logging:1, // Log enqueued commands to the open file. See GCodeQueue::advance() @@ -114,15 +102,76 @@ public: CardReader(); + /** + * Media Selection - Only one drive may be active at a time, + * so switching drives (currently) returns to the root folder. + * TODO: Save the last-used path for each device and cd on mount. + */ static void changeMedia(DiskIODriver *_driver) { driver = _driver; } - static MediaFile getroot() { return root; } + static DiskIODriver* diskIODriver() { return driver; } + #if HAS_SDCARD + typedef TERN(NEED_SD2CARD_SDIO, DiskIODriver_SDIO, DiskIODriver_SPI_SD) sdcard_driver_t; + static sdcard_driver_t media_driver_sdcard; + #endif + + #if HAS_USB_FLASH_DRIVE + static DiskIODriver_USBFlash media_driver_usbFlash; + #endif + + static void selectMediaSDCard() { + #if HAS_SDCARD + changeMedia(&media_driver_sdcard); + #endif + } + + static void selectMediaFlashDrive() { + #if HAS_USB_FLASH_DRIVE + changeMedia(&media_driver_usbFlash); + #endif + } + + static bool isSDCardSelected() { + return TERN0(HAS_SDCARD, TERN1(HAS_MULTI_VOLUME, driver == &media_driver_sdcard)); + } + static bool isFlashDriveSelected() { + return TERN0(HAS_USB_FLASH_DRIVE, TERN1(HAS_MULTI_VOLUME, driver == &media_driver_usbFlash)); + } + static bool isMediaSelected() { + return isSDCardSelected() || isFlashDriveSelected(); + } + + /** + * Media Detection - Inserted, Mounted, Job Running, Job Paused, etc. + * + * Marlin 2.1.x supports up to two drives, either an SD Card or USB-FD + * Onboard SD may have SPI or SDIO interface. USB FD may use MSC. + */ + + // No card detect line? Assume the card is inserted. + static bool isSDCardInserted() { + return ( + #if HAS_SD_DETECT + READ(SD_DETECT_PIN) == SD_DETECT_STATE + #else + ENABLED(HAS_SDCARD) + #endif + ); + } + + // Use the isInserted state from the driver + static bool isFlashDriveInserted() { return TERN0(HAS_USB_FLASH_DRIVE, DiskIODriver_USBFlash::isInserted()); } + + // NOTE: If the SD Card has no DETECT line this always returns true + static bool isInserted() { return isFlashDriveInserted() || isSDCardInserted(); } + + // Mount and release physical media static void mount(); static void release(); static bool isMounted() { return flag.mounted; } - // Handle media insert/remove + // Handle media insert/remove (including mounting on boot-up) static void manage_media(); // SD Card Logging @@ -142,6 +191,9 @@ public: static bool selectNewestFile(); #endif + // The root directory of the current mounted drive + static MediaFile getroot() { return root; } + // Basic file ops static void openFileRead(const char * const path, const uint8_t subcall=0); static void openFileWrite(const char * const path); @@ -232,7 +284,7 @@ public: // Current Working Dir - Set by cd, cdup, cdroot, and diveToFile(true, ...) static char* getWorkDirName() { workDir.getDosName(filename); return filename; } - static MediaFile& getWorkDir() { return workDir.isOpen() ? workDir : root; } + static MediaFile& getWorkDir() { return workDir.isOpen() ? workDir : root; } // Print File stats static uint32_t getFileSize() { return filesize; } @@ -246,9 +298,6 @@ public: static int16_t write(void *buf, uint16_t nbyte) { return file.isOpen() ? file.write(buf, nbyte) : -1; } static void setIndex(const uint32_t index) { file.seekSet((sdpos = index)); } - // TODO: rename to diskIODriver() - static DiskIODriver* diskIODriver() { return driver; } - #if ENABLED(AUTO_REPORT_SD_STATUS) // // SD Auto Reporting @@ -257,17 +306,17 @@ public: static AutoReporter auto_reporter; #endif - #if SHARED_VOLUME_IS(USB_FLASH_DRIVE) || HAS_USB_FLASH_DRIVE - #define HAS_USB_FLASH_DRIVE 1 - static DiskIODriver_USBFlash media_driver_usbFlash; - #endif - - #if NEED_SD2CARD_SDIO || NEED_SD2CARD_SPI - typedef TERN(NEED_SD2CARD_SDIO, DiskIODriver_SDIO, DiskIODriver_SPI_SD) sdcard_driver_t; - static sdcard_driver_t media_driver_sdcard; - #endif - private: + // + // Driver, volume, and temporary file + // + static DiskIODriver *driver; + static MarlinVolume volume; + + static MediaFile file; + static uint32_t filesize, // Total size of the current file, in bytes + sdpos; // Index most recently read (one behind file.getPos) + // // Working directory and parents // @@ -330,13 +379,6 @@ private: #endif // SDCARD_SORT_ALPHA - static DiskIODriver *driver; - static MarlinVolume volume; - static MediaFile file; - - static uint32_t filesize, // Total size of the current file, in bytes - sdpos; // Index most recently read (one behind file.getPos) - // // Procedure calls to other files // diff --git a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp index 455ba6ba0a..2ae38c64c0 100644 --- a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp +++ b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp @@ -179,82 +179,82 @@ void DiskIODriver_USBFlash::idle() { } #endif - static millis_t next_state_ms = millis(); + static millis_t next_state_ms = 0; #define GOTO_STATE_AFTER_DELAY(STATE, DELAY) do{ state = STATE; next_state_ms = millis() + DELAY; }while(0) - if (ELAPSED(millis(), next_state_ms)) { - GOTO_STATE_AFTER_DELAY(state, 250); // Default delay + if (PENDING(millis(), next_state_ms)) return; - switch (state) { + GOTO_STATE_AFTER_DELAY(state, 250); // Default delay - case UNINITIALIZED: - #ifndef MANUAL_USB_STARTUP - GOTO_STATE_AFTER_DELAY( DO_STARTUP, USB_STARTUP_DELAY ); + switch (state) { + + case UNINITIALIZED: + #ifndef MANUAL_USB_STARTUP + GOTO_STATE_AFTER_DELAY( DO_STARTUP, USB_STARTUP_DELAY ); + #endif + break; + + case DO_STARTUP: usbStartup(); break; + + case WAIT_FOR_DEVICE: + if (task_state == UHS_STATE(RUNNING)) { + #if USB_DEBUG >= 1 + SERIAL_ECHOLNPGM("USB device inserted"); #endif - break; + GOTO_STATE_AFTER_DELAY( WAIT_FOR_LUN, 250 ); + } + break; - case DO_STARTUP: usbStartup(); break; + case WAIT_FOR_LUN: + /* USB device is inserted, but if it is an SD card, + * adapter it may not have an SD card in it yet. */ + if (bulk.LUNIsGood(0)) { + #if USB_DEBUG >= 1 + SERIAL_ECHOLNPGM("LUN is good"); + #endif + GOTO_STATE_AFTER_DELAY( MEDIA_READY, 100 ); + } + else { + #ifdef USB_HOST_MANUAL_POLL + // Make sure we catch disconnect events + usb.busprobe(); + usb.VBUS_changed(); + #endif + #if USB_DEBUG >= 1 + SERIAL_ECHOLNPGM("Waiting for media"); + #endif + LCD_MESSAGE(MSG_MEDIA_WAITING); + GOTO_STATE_AFTER_DELAY(state, 2000); + } + break; - case WAIT_FOR_DEVICE: - if (task_state == UHS_STATE(RUNNING)) { - #if USB_DEBUG >= 1 - SERIAL_ECHOLNPGM("USB device inserted"); - #endif - GOTO_STATE_AFTER_DELAY( WAIT_FOR_LUN, 250 ); - } - break; + case MEDIA_READY: break; + case MEDIA_ERROR: break; + } - case WAIT_FOR_LUN: - /* USB device is inserted, but if it is an SD card, - * adapter it may not have an SD card in it yet. */ - if (bulk.LUNIsGood(0)) { - #if USB_DEBUG >= 1 - SERIAL_ECHOLNPGM("LUN is good"); - #endif - GOTO_STATE_AFTER_DELAY( MEDIA_READY, 100 ); - } - else { - #ifdef USB_HOST_MANUAL_POLL - // Make sure we catch disconnect events - usb.busprobe(); - usb.VBUS_changed(); - #endif - #if USB_DEBUG >= 1 - SERIAL_ECHOLNPGM("Waiting for media"); - #endif - LCD_MESSAGE(MSG_MEDIA_WAITING); - GOTO_STATE_AFTER_DELAY(state, 2000); - } - break; + if (state > WAIT_FOR_DEVICE && task_state != UHS_STATE(RUNNING)) { + // Handle device removal events + #if USB_DEBUG >= 1 + SERIAL_ECHOLNPGM("USB device removed"); + #endif + if (state != MEDIA_READY) + LCD_MESSAGE(MSG_MEDIA_USB_REMOVED); + GOTO_STATE_AFTER_DELAY(WAIT_FOR_DEVICE, 0); + } - case MEDIA_READY: break; - case MEDIA_ERROR: break; - } + else if (state > WAIT_FOR_LUN && !bulk.LUNIsGood(0)) { + // Handle media removal events + #if USB_DEBUG >= 1 + SERIAL_ECHOLNPGM("Media removed"); + #endif + LCD_MESSAGE(MSG_MEDIA_REMOVED); + GOTO_STATE_AFTER_DELAY(WAIT_FOR_DEVICE, 0); + } - if (state > WAIT_FOR_DEVICE && task_state != UHS_STATE(RUNNING)) { - // Handle device removal events - #if USB_DEBUG >= 1 - SERIAL_ECHOLNPGM("USB device removed"); - #endif - if (state != MEDIA_READY) - LCD_MESSAGE(MSG_MEDIA_USB_REMOVED); - GOTO_STATE_AFTER_DELAY(WAIT_FOR_DEVICE, 0); - } - - else if (state > WAIT_FOR_LUN && !bulk.LUNIsGood(0)) { - // Handle media removal events - #if USB_DEBUG >= 1 - SERIAL_ECHOLNPGM("Media removed"); - #endif - LCD_MESSAGE(MSG_MEDIA_REMOVED); - GOTO_STATE_AFTER_DELAY(WAIT_FOR_DEVICE, 0); - } - - else if (task_state == UHS_STATE(ERROR)) { - LCD_MESSAGE(MSG_MEDIA_READ_ERROR); - GOTO_STATE_AFTER_DELAY(MEDIA_ERROR, 0); - } + else if (task_state == UHS_STATE(ERROR)) { + LCD_MESSAGE(MSG_MEDIA_READ_ERROR); + GOTO_STATE_AFTER_DELAY(MEDIA_ERROR, 0); } } From 5c0e8d594d343d4e38f6d2254916077e0f3a3c7d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 21 Apr 2025 20:00:49 -0500 Subject: [PATCH 58/86] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Stub?= =?UTF-8?q?=20CardReader,=20proper=20methods?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/DUE/usb/sd_mmc_spi_mem.cpp | 2 +- Marlin/src/HAL/LPC1768/HAL.cpp | 4 +- Marlin/src/HAL/STM32F1/HAL.cpp | 2 +- Marlin/src/MarlinCore.cpp | 12 +++-- Marlin/src/feature/mmu3/mmu3.cpp | 2 +- Marlin/src/feature/pause.cpp | 2 +- Marlin/src/feature/powerloss.cpp | 8 ++-- Marlin/src/gcode/feature/pause/M125.cpp | 2 +- Marlin/src/gcode/gcode.cpp | 2 +- Marlin/src/gcode/lcd/M73.cpp | 2 +- Marlin/src/gcode/queue.cpp | 2 +- Marlin/src/gcode/sd/M21_M22.cpp | 2 +- Marlin/src/gcode/sd/M24_M25.cpp | 2 +- Marlin/src/gcode/sd/M32.cpp | 2 +- Marlin/src/gcode/sd/M524.cpp | 2 +- Marlin/src/gcode/stats/M75-M78.cpp | 2 +- Marlin/src/lcd/HD44780/marlinui_HD44780.cpp | 2 +- Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp | 2 +- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 2 +- Marlin/src/lcd/e3v2/proui/dwin.cpp | 6 +-- .../generic/about_screen.cpp | 6 +-- Marlin/src/lcd/extui/mks_ui/draw_ui.cpp | 13 ----- Marlin/src/lcd/extui/mks_ui/draw_ui.h | 1 - .../lcd/extui/mks_ui/printer_operation.cpp | 2 +- .../extui/mks_ui/tft_lvgl_configuration.cpp | 2 +- Marlin/src/lcd/extui/ui_api.cpp | 7 +-- Marlin/src/lcd/marlinui.cpp | 6 +-- Marlin/src/lcd/sovol_rts/sovol_rts.cpp | 10 ++-- Marlin/src/module/temperature.cpp | 2 +- Marlin/src/sd/cardreader.cpp | 32 ++++++------- Marlin/src/sd/cardreader.h | 48 ++++++++----------- 31 files changed, 85 insertions(+), 106 deletions(-) diff --git a/Marlin/src/HAL/DUE/usb/sd_mmc_spi_mem.cpp b/Marlin/src/HAL/DUE/usb/sd_mmc_spi_mem.cpp index cf6739c5bd..ff6ff4859b 100644 --- a/Marlin/src/HAL/DUE/usb/sd_mmc_spi_mem.cpp +++ b/Marlin/src/HAL/DUE/usb/sd_mmc_spi_mem.cpp @@ -19,7 +19,7 @@ void sd_mmc_spi_mem_init() { } inline bool media_ready() { - return IS_SD_MOUNTED() && IS_SD_INSERTED() && !IS_SD_FILE_OPEN() && !IS_SD_PRINTING(); + return card.isMounted() && card.isInserted() && !card.isFileOpen() && !card.isStillPrinting(); } bool sd_mmc_spi_unload(bool) { return true; } diff --git a/Marlin/src/HAL/LPC1768/HAL.cpp b/Marlin/src/HAL/LPC1768/HAL.cpp index 55658acb76..6e4357777d 100644 --- a/Marlin/src/HAL/LPC1768/HAL.cpp +++ b/Marlin/src/HAL/LPC1768/HAL.cpp @@ -175,11 +175,11 @@ void MarlinHAL::idletask() { #if HAS_SHARED_MEDIA // If Marlin is using the SD card we need to lock it to prevent access from // a PC via USB. - // Other HALs use IS_SD_PRINTING() and IS_SD_FILE_OPEN() to check for access but + // Other HALs use card.isStillPrinting() and card.isFileOpen() to check for access but // this will not reliably detect delete operations. To be safe we will lock // the disk if Marlin has it mounted. Unfortunately there is currently no way // to unmount the disk from the LCD menu. - // if (IS_SD_PRINTING() || IS_SD_FILE_OPEN()) + // if (card.isStillPrinting() || card.isFileOpen()) if (card.isMounted()) MSC_Aquire_Lock(); else diff --git a/Marlin/src/HAL/STM32F1/HAL.cpp b/Marlin/src/HAL/STM32F1/HAL.cpp index e6cbb9fc06..d5f4ade79d 100644 --- a/Marlin/src/HAL/STM32F1/HAL.cpp +++ b/Marlin/src/HAL/STM32F1/HAL.cpp @@ -264,7 +264,7 @@ void MarlinHAL::idletask() { /** * When Marlin is using the SD card it should be locked to prevent it being * accessed from a PC over USB. - * Other HALs use (IS_SD_PRINTING() || IS_SD_FILE_OPEN()) to check for access + * Other HALs use (card.isStillPrinting() || card.isFileOpen()) to check for access * but this won't reliably detect other file operations. To be safe we just lock * the drive whenever Marlin has it mounted. LCDs should include an Unmount * command so drives can be released as needed. diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index f2b2589ee6..05355ddccb 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -269,6 +269,10 @@ #include "feature/rs485.h" #endif +#if !HAS_MEDIA + CardReader card; // Stub instance with "no media" methods +#endif + PGMSTR(M112_KILL_STR, "M112 Shutdown"); #if ENABLED(CONFIGURABLE_MACHINE_NAME) @@ -339,7 +343,7 @@ bool printer_busy() { /** * A Print Job exists when the timer is running or SD is printing */ -bool printJobOngoing() { return print_job_timer.isRunning() || IS_SD_PRINTING(); } +bool printJobOngoing() { return print_job_timer.isRunning() || card.isStillPrinting(); } /** * Printing is active when a job is underway but not paused @@ -350,7 +354,7 @@ bool printingIsActive() { return !did_pause_print && printJobOngoing(); } * Printing is paused according to SD or host indicators */ bool printingIsPaused() { - return did_pause_print || print_job_timer.isPaused() || IS_SD_PAUSED(); + return did_pause_print || print_job_timer.isPaused() || card.isPaused(); } void startOrResumeJob() { @@ -509,7 +513,7 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) { // Handle a standalone HOME button constexpr millis_t HOME_DEBOUNCE_DELAY = 1000UL; static millis_t next_home_key_ms; // = 0 - if (!IS_SD_PRINTING() && !READ(HOME_PIN)) { // HOME_PIN goes LOW when pressed + if (!card.isStillPrinting() && !READ(HOME_PIN)) { // HOME_PIN goes LOW when pressed if (ELAPSED(ms, next_home_key_ms)) { next_home_key_ms = ms + HOME_DEBOUNCE_DELAY; LCD_MESSAGE(MSG_AUTO_HOME); @@ -804,7 +808,7 @@ void idle(const bool no_stepper_sleep/*=false*/) { // Handle Power-Loss Recovery #if ENABLED(POWER_LOSS_RECOVERY) && PIN_EXISTS(POWER_LOSS) - if (IS_SD_PRINTING()) recovery.outage(); + if (card.isStillPrinting()) recovery.outage(); #endif // Run StallGuard endstop checks diff --git a/Marlin/src/feature/mmu3/mmu3.cpp b/Marlin/src/feature/mmu3/mmu3.cpp index b4d4c76afc..27a1dc05c9 100644 --- a/Marlin/src/feature/mmu3/mmu3.cpp +++ b/Marlin/src/feature/mmu3/mmu3.cpp @@ -456,7 +456,7 @@ namespace MMU3 { if (slot != extruder) { if ( //findaDetectsFilament() - //!IS_SD_PRINTING() && !usb_timer.running() + //!card.isStillPrinting() && !usb_timer.running() !marlin_printingIsActive() ) { // If Tcodes are used manually through the serial diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index fbb78ccbf9..bd86133771 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -439,7 +439,7 @@ bool pause_print(const_float_t retract, const xyz_pos_t &park_point, const bool // Pause the print job and timer #if HAS_MEDIA - const bool was_sd_printing = IS_SD_PRINTING(); + const bool was_sd_printing = card.isStillPrinting(); if (was_sd_printing) { card.pauseSDPrint(); ++did_pause_print; // Indicate SD pause also diff --git a/Marlin/src/feature/powerloss.cpp b/Marlin/src/feature/powerloss.cpp index 3cd96e1155..27f3e44ca5 100644 --- a/Marlin/src/feature/powerloss.cpp +++ b/Marlin/src/feature/powerloss.cpp @@ -117,7 +117,7 @@ void PrintJobRecovery::enable(const bool onoff) { void PrintJobRecovery::changed() { if (!enabled) purge(); - else if (IS_SD_PRINTING()) + else if (card.isStillPrinting()) save(true); TERN_(EXTENSIBLE_UI, ExtUI::onSetPowerLoss(enabled)); } @@ -174,7 +174,7 @@ void PrintJobRecovery::prepare() { */ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POWER_LOSS_ZRAISE*/, const bool raised/*=false*/) { - // We don't check IS_SD_PRINTING here so a save may occur during a pause + // We don't check isStillPrinting here so a save may occur during a pause #if SAVE_INFO_INTERVAL_MS > 0 static millis_t next_save_ms; // = 0 @@ -202,7 +202,7 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW // Set Head and Foot to matching non-zero values if (!++info.valid_head) ++info.valid_head; // non-zero in sequence - //if (!IS_SD_PRINTING()) info.valid_head = 0; + //if (!card.isStillPrinting()) info.valid_head = 0; info.valid_foot = info.valid_head; // Machine state @@ -326,7 +326,7 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW // Save the current position, distance that Z was (or should be) raised, // and a flag whether the raise was already done here. - if (IS_SD_PRINTING()) save(true, zraise, ENABLED(BACKUP_POWER_SUPPLY)); + if (card.isStillPrinting()) save(true, zraise, ENABLED(BACKUP_POWER_SUPPLY)); // Tell the LCD about the outage, even though it is about to die TERN_(EXTENSIBLE_UI, ExtUI::onPowerLoss()); diff --git a/Marlin/src/gcode/feature/pause/M125.cpp b/Marlin/src/gcode/feature/pause/M125.cpp index 71fa7c7b4d..75611760f1 100644 --- a/Marlin/src/gcode/feature/pause/M125.cpp +++ b/Marlin/src/gcode/feature/pause/M125.cpp @@ -88,7 +88,7 @@ void GcodeSuite::M125() { park_point += hotend_offset[active_extruder]; #endif - const bool sd_printing = IS_SD_PRINTING(); + const bool sd_printing = card.isStillPrinting(); ui.pause_show_message(PAUSE_MESSAGE_PARKING, PAUSE_MODE_PAUSE_PRINT); diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 6dfc54d99e..469ab134d3 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -196,7 +196,7 @@ void GcodeSuite::get_destination_from_command() { #if ENABLED(POWER_LOSS_RECOVERY) && !PIN_EXISTS(POWER_LOSS) // Only update power loss recovery on moves with E - if (recovery.enabled && IS_SD_PRINTING() && seen.e && (seen.x || seen.y)) + if (recovery.enabled && card.isStillPrinting() && seen.e && (seen.x || seen.y)) recovery.save(); #endif diff --git a/Marlin/src/gcode/lcd/M73.cpp b/Marlin/src/gcode/lcd/M73.cpp index 6f74476240..5d9b3bd107 100644 --- a/Marlin/src/gcode/lcd/M73.cpp +++ b/Marlin/src/gcode/lcd/M73.cpp @@ -62,7 +62,7 @@ void GcodeSuite::M73() { #endif #if ENABLED(M73_REPORT) - if (TERN1(M73_REPORT_SD_ONLY, IS_SD_PRINTING())) { + if (TERN1(M73_REPORT_SD_ONLY, card.isStillPrinting())) { SERIAL_ECHO_START(); SERIAL_ECHOPGM(" M73"); #if ENABLED(SET_PROGRESS_PERCENT) diff --git a/Marlin/src/gcode/queue.cpp b/Marlin/src/gcode/queue.cpp index 657bfab08b..7fa55b70e8 100644 --- a/Marlin/src/gcode/queue.cpp +++ b/Marlin/src/gcode/queue.cpp @@ -570,7 +570,7 @@ void GCodeQueue::get_serial_commands() { static uint8_t sd_input_state = PS_NORMAL; // Get commands if there are more in the file - if (!IS_SD_FETCHING()) return; + if (!card.isStillFetching()) return; int sd_count = 0; while (!ring_buffer.full() && !card.eof()) { diff --git a/Marlin/src/gcode/sd/M21_M22.cpp b/Marlin/src/gcode/sd/M21_M22.cpp index 672dc80f00..eb1594fbaf 100644 --- a/Marlin/src/gcode/sd/M21_M22.cpp +++ b/Marlin/src/gcode/sd/M21_M22.cpp @@ -49,7 +49,7 @@ void GcodeSuite::M21() { * M22: Release SD Card */ void GcodeSuite::M22() { - if (!IS_SD_PRINTING()) card.release(); + if (!card.isStillPrinting()) card.release(); } #endif // HAS_MEDIA diff --git a/Marlin/src/gcode/sd/M24_M25.cpp b/Marlin/src/gcode/sd/M24_M25.cpp index 7bf1ab74d5..f4ad7c7dab 100644 --- a/Marlin/src/gcode/sd/M24_M25.cpp +++ b/Marlin/src/gcode/sd/M24_M25.cpp @@ -101,7 +101,7 @@ void GcodeSuite::M25() { #else // Set initial pause flag to prevent more commands from landing in the queue while we try to pause - if (IS_SD_PRINTING()) card.pauseSDPrint(); + if (card.isStillPrinting()) card.pauseSDPrint(); #if ENABLED(POWER_LOSS_RECOVERY) && DISABLED(DGUS_LCD_UI_MKS) if (recovery.enabled) recovery.save(true); diff --git a/Marlin/src/gcode/sd/M32.cpp b/Marlin/src/gcode/sd/M32.cpp index 3baa552e6e..552a75cdf4 100644 --- a/Marlin/src/gcode/sd/M32.cpp +++ b/Marlin/src/gcode/sd/M32.cpp @@ -40,7 +40,7 @@ * M32 S60 !PATH/TO/FILE.GCO# ; Start FILE.GCO at byte 60 */ void GcodeSuite::M32() { - if (IS_SD_PRINTING()) planner.synchronize(); + if (card.isStillPrinting()) planner.synchronize(); if (card.isMounted()) { const uint8_t call_procedure = parser.boolval('P'); diff --git a/Marlin/src/gcode/sd/M524.cpp b/Marlin/src/gcode/sd/M524.cpp index 61185b7e0b..d72aa0ac35 100644 --- a/Marlin/src/gcode/sd/M524.cpp +++ b/Marlin/src/gcode/sd/M524.cpp @@ -42,7 +42,7 @@ void GcodeSuite::M524() { #else - if (IS_SD_PRINTING()) + if (card.isStillPrinting()) card.abortFilePrintSoon(); else if (card.isMounted()) card.closefile(); diff --git a/Marlin/src/gcode/stats/M75-M78.cpp b/Marlin/src/gcode/stats/M75-M78.cpp index 8ab94577ef..4e1b1aff9d 100644 --- a/Marlin/src/gcode/stats/M75-M78.cpp +++ b/Marlin/src/gcode/stats/M75-M78.cpp @@ -43,7 +43,7 @@ void GcodeSuite::M75() { startOrResumeJob(); // ... ExtUI::onPrintTimerStarted() #if ENABLED(DWIN_LCD_PROUI) // TODO: Remove if M75 is never used - if (!IS_SD_PRINTING()) dwinPrintHeader(parser.has_string() ? parser.string_arg : GET_TEXT(MSG_HOST_START_PRINT)); + if (!card.isStillPrinting()) dwinPrintHeader(parser.has_string() ? parser.string_arg : GET_TEXT(MSG_HOST_START_PRINT)); #endif } diff --git a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp index a0145d6165..265f62ab88 100644 --- a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp +++ b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp @@ -841,7 +841,7 @@ void MarlinUI::draw_status_message(const bool blink) { const uint8_t progress = get_progress_percent(); if (progress) { lcd_moveto(pc, pr); - lcd_put_u8str(F(TERN(IS_SD_PRINTING, "SD", "P:"))); + lcd_put_u8str(card.isStillPrinting() ? F("SD") : F("P:")); lcd_put_u8str(TERN(PRINT_PROGRESS_SHOW_DECIMALS, permyriadtostr4(get_progress_permyriad()), ui8tostr3rj(progress))); lcd_put_u8str(F("%")); } diff --git a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp index 6766820cfd..4ac012ba93 100644 --- a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp +++ b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp @@ -603,7 +603,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const const uint8_t progress = ui.get_progress_percent(); if (progress) { lcd_moveto(0, 2); - lcd_put_u8str(F(TERN(IS_SD_PRINTING, "SD", "P:"))); + lcd_put_u8str(card.isStillPrinting() ? F("SD") : F("P:")); lcd.print(TERN(PRINT_PROGRESS_SHOW_DECIMALS, permyriadtostr4(ui.get_progress_permyriad()), ui8tostr3rj(progress))); lcd.write('%'); } diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index d582b96ed7..aa087cefc4 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -4653,7 +4653,7 @@ void JyersDWIN::popupControl() { #if ENABLED(PARK_HEAD_ON_PAUSE) popupHandler(Popup_Home, true); #if HAS_MEDIA - if (IS_SD_PRINTING()) card.pauseSDPrint(); + if (card.isStillPrinting()) card.pauseSDPrint(); #endif planner.synchronize(); queue.inject(F("M125")); diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 7428a4b254..b1df0234b0 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -294,9 +294,9 @@ MenuItem *fanSpeedItem = nullptr; MenuItem *mMeshMoveZItem = nullptr; MenuItem *editZValueItem = nullptr; -bool isPrinting() { return printingIsActive() || printingIsPaused(); } -bool sdPrinting() { return isPrinting() && IS_SD_FILE_OPEN(); } -bool hostPrinting() { return isPrinting() && !IS_SD_FILE_OPEN(); } +bool isPrinting() { return printingIsActive() || printingIsPaused(); } +bool sdPrinting() { return isPrinting() && card.isStillPrinting(); } +bool hostPrinting() { return isPrinting() && !card.isStillPrinting(); } #define DWIN_LANGUAGE_EEPROM_ADDRESS 0x01 // Between 0x01 and 0x63 (EEPROM_OFFSET-1) // BL24CXX::check() uses 0x00 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 eac6e646e6..366151959b 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 @@ -62,11 +62,11 @@ void AboutScreen::onRedraw(draw_mode_t) { #ifdef LULZBOT_LCD_MACHINE_NAME cmd.tag(3); draw_text_box(cmd, BTN_POS(1,7), BTN_SIZE(4,3), F( - "Firmware:" + "Firmware:" ), OPT_CENTER, font_xlarge); draw_text_box(cmd, BTN_POS(1,10), BTN_SIZE(4,2), F( - "" LULZBOT_M115_EXTRUDER_TYPE "" + "" LULZBOT_M115_EXTRUDER_TYPE "" ), OPT_CENTER, font_xlarge); #endif @@ -77,7 +77,7 @@ void AboutScreen::onRedraw(draw_mode_t) { #endif draw_text_box(cmd, BTN_POS(1,19), BTN_SIZE(4,3), F( - "Version:" + "Version:" ), OPT_CENTER, font_xlarge); draw_text_box(cmd, BTN_POS(1,22), BTN_SIZE(4,2), F( diff --git a/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp b/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp index 92cc17f8cc..2e66db2c86 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp @@ -1332,19 +1332,6 @@ void lv_screen_menu_item_onoff_update(lv_obj_t *btn, const bool curValue) { lv_label_set_text((lv_obj_t*)btn->child_ll.head, curValue ? machine_menu.enable : machine_menu.disable); } -#if HAS_MEDIA - - void sd_detection() { - static bool last_sd_status; - const bool sd_status = IS_SD_INSERTED(); - if (sd_status != last_sd_status) { - last_sd_status = sd_status; - if (sd_status) card.mount(); else card.release(); - } - } - -#endif - void lv_ex_line(lv_obj_t *line, lv_point_t *points) { // Copy the previous line and apply the new style lv_line_set_points(line, points, 2); // Set the points diff --git a/Marlin/src/lcd/extui/mks_ui/draw_ui.h b/Marlin/src/lcd/extui/mks_ui/draw_ui.h index 10b8dcee28..33a0764d2c 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_ui.h +++ b/Marlin/src/lcd/extui/mks_ui/draw_ui.h @@ -468,7 +468,6 @@ void GUI_RefreshPage(); void clear_cur_ui(); void draw_return_ui(); void goto_previous_ui(); -void sd_detection(); void gCfg_to_spiFlah(); void print_time_count(); diff --git a/Marlin/src/lcd/extui/mks_ui/printer_operation.cpp b/Marlin/src/lcd/extui/mks_ui/printer_operation.cpp index dc47cdb357..9999aa4843 100644 --- a/Marlin/src/lcd/extui/mks_ui/printer_operation.cpp +++ b/Marlin/src/lcd/extui/mks_ui/printer_operation.cpp @@ -88,7 +88,7 @@ void printer_state_polling() { } if (uiCfg.print_state == RESUMING) { - if (IS_SD_PAUSED()) { + if (card.isPaused()) { if (gCfgItems.pausePosX != (float)-1 && gCfgItems.pausePosY != (float)-1) { sprintf_P(public_buf_m, PSTR("G1 X%s Y%s"), dtostrf(uiCfg.current_x_position_bak, 1, 1, str_1), dtostrf(uiCfg.current_y_position_bak, 1, 1, str_1)); gcode.process_subcommands_now(public_buf_m); 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 e138449181..729d8bc4b2 100644 --- a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp +++ b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp @@ -136,7 +136,7 @@ void tft_lvgl_init() { #if HAS_USB_FLASH_DRIVE #if HAS_MULTI_VOLUME && !HAS_SD_HOST_DRIVE - if (IS_SD_INSERTED()) + if (card.isSDCardInserted()) card.selectMediaSDCard(); else card.selectMediaFlashDrive(); diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index b88df6ee9d..7763bac05a 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -1064,11 +1064,8 @@ namespace ExtUI { TERN(HAS_MEDIA, card.openAndPrintFile(filename), UNUSED(filename)); } - bool isPrintingFromMediaPaused() { - return IS_SD_PAUSED(); - } - - bool isPrintingFromMedia() { return IS_SD_PRINTING() || IS_SD_PAUSED(); } + bool isPrintingFromMedia() { return card.isStillPrinting() || card.isPaused(); } + bool isPrintingFromMediaPaused() { return card.isPaused(); } bool isPrinting() { return commandsInQueue() || isPrintingFromMedia() || printJobOngoing() || printingIsPaused(); diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 1726c67930..8b7e64dda8 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -1540,7 +1540,7 @@ uint8_t expand_u8str_P(char * const outstr, PGM_P const ptpl, const int8_t ind, if (printingIsPaused()) msg = GET_TEXT_F(MSG_PRINT_PAUSED); #if HAS_MEDIA - else if (IS_SD_PRINTING()) + else if (card.isStillPrinting()) return set_status_no_expire(card.longest_filename()); #endif else if (print_job_timer.isRunning()) @@ -1743,7 +1743,7 @@ uint8_t expand_u8str_P(char * const outstr, PGM_P const ptpl, const int8_t ind, void MarlinUI::abort_print() { #if HAS_MEDIA wait_for_heatup = wait_for_user = false; - if (IS_SD_PRINTING()) + if (card.isStillPrinting()) card.abortFilePrintSoon(); else if (card.isMounted()) card.closefile(); @@ -1810,7 +1810,7 @@ uint8_t expand_u8str_P(char * const outstr, PGM_P const ptpl, const int8_t ind, void MarlinUI::resume_print() { reset_status(); TERN_(PARK_HEAD_ON_PAUSE, wait_for_heatup = wait_for_user = false); - TERN_(HAS_MEDIA, if (IS_SD_PAUSED()) queue.inject_P(M24_STR)); + TERN_(HAS_MEDIA, if (card.isPaused()) queue.inject_P(M24_STR)); #ifdef ACTION_ON_RESUME hostui.resume(); #endif diff --git a/Marlin/src/lcd/sovol_rts/sovol_rts.cpp b/Marlin/src/lcd/sovol_rts/sovol_rts.cpp index dcd5d9b384..bea95be96a 100644 --- a/Marlin/src/lcd/sovol_rts/sovol_rts.cpp +++ b/Marlin/src/lcd/sovol_rts/sovol_rts.cpp @@ -171,7 +171,7 @@ void RTS::sdCardInit() { // Clear the file name displayed in the print interface sendData(0, PRINT_FILE_TEXT_VP + j); } - lcd_sd_status = IS_SD_INSERTED(); + lcd_sd_status = card.isInserted(); } else { // Clean all filename Icons @@ -186,7 +186,7 @@ bool RTS::sdDetected() { static bool state = false, stable = false, was_present = false; static millis_t stable_ms = 0; - const bool present = IS_SD_INSERTED(); + const bool present = card.isInserted(); if (present != was_present) stable = false; else if (!stable) { @@ -1485,7 +1485,7 @@ void RTS::handleData() { sendData(cardRec.display_filename[cardRec.recordcount], PRINT_FILE_TEXT_VP); // Represents to update file list - if (update_sd && lcd_sd_status && IS_SD_INSERTED()) { + if (update_sd && lcd_sd_status && card.isInserted()) { for (uint16_t i = 0; i < cardRec.Filesum; i++) { delay(3); sendData(cardRec.display_filename[i], cardRec.addr[i]); @@ -1654,8 +1654,8 @@ void RTS_Update() { // Check the status of card rts.sdCardUpdate(); - sd_printing = IS_SD_PRINTING(); - card_insert_st = IS_SD_INSERTED(); + sd_printing = card.isStillPrinting(); + card_insert_st = card.isInserted(); if (!card_insert_st && sd_printing) { rts.gotoPage(ID_MediaFail_L, ID_MediaFail_D); diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 5c9f122067..0ef0a2f961 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -4772,7 +4772,7 @@ void Temperature::isr() { dwin_heat_time = elapsed.value; #elif ENABLED(SOVOL_SV06_RTS) update_time_value = RTS_UPDATE_VALUE; - if (IS_SD_PRINTING()) rts.refreshTime(); + if (card.isStillPrinting()) rts.refreshTime(); rts.start_print_flag = false; #else ui.reset_status(); diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index cd20f921db..9b0a37913a 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -146,7 +146,7 @@ int16_t CardReader::nrItems = -1; DiskIODriver* CardReader::driver = nullptr; MarlinVolume CardReader::volume; -MediaFile CardReader::file; +MediaFile CardReader::myfile; #if HAS_MEDIA_SUBCALLS uint8_t CardReader::file_subcall_ctr; @@ -463,9 +463,9 @@ void CardReader::ls(const uint8_t lsflags/*=0*/) { // Echo the DOS 8.3 filename (and long filename, if any) // void CardReader::printSelectedFilename() { - if (file.isOpen()) { + if (myfile.isOpen()) { char dosFilename[FILENAME_LENGTH]; - file.getDosName(dosFilename); + myfile.getDosName(dosFilename); SERIAL_ECHO(dosFilename); #if ENABLED(LONG_FILENAME_HOST_SUPPORT) selectFileByName(dosFilename); @@ -517,7 +517,7 @@ void CardReader::mount() { */ void CardReader::manage_media() { static uint8_t prev_stat = 2; // At boot we don't know if media is present or not - uint8_t stat = uint8_t(IS_SD_INSERTED()); + uint8_t stat = uint8_t(isInserted()); if (stat == prev_stat) return; // Already checked and still no change? DEBUG_SECTION(cmm, "CardReader::manage_media()", true); @@ -626,7 +626,7 @@ void CardReader::endFilePrintNow(TERN_(SD_RESORT, const bool re_sort/*=false*/)) TERN_(ADVANCED_PAUSE_FEATURE, did_pause_print = 0); TERN_(DWIN_CREALITY_LCD, hmiFlag.print_finish = flag.sdprinting); flag.abort_sd_printing = false; - if (isFileOpen()) file.close(); + if (isFileOpen()) myfile.close(); TERN_(SD_RESORT, if (re_sort) presort()); } @@ -661,7 +661,7 @@ void CardReader::getAbsFilenameInCWD(char *dst) { appendAtom(workDirParents[i]); if (cnt < MAXPATHNAMELENGTH - (FILENAME_LENGTH) - 1) { // Leave room for filename and nul - appendAtom(file); + appendAtom(myfile); --dst; } *dst = '\0'; @@ -738,8 +738,8 @@ void CardReader::openFileRead(const char * const path, const uint8_t subcall_typ const char * const fname = diveToFile(true, diveDir, path); if (!fname) return openFailed(path); - if (file.open(diveDir, fname, O_READ)) { - filesize = file.fileSize(); + if (myfile.open(diveDir, fname, O_READ)) { + filesize = myfile.fileSize(); sdpos = 0; { // Don't remove this block, as the PORT_REDIRECT is a RAII @@ -778,7 +778,7 @@ void CardReader::openFileWrite(const char * const path) { if (!fname) return openFailed(path); #if DISABLED(SDCARD_READONLY) - if (file.open(diveDir, fname, O_CREAT | O_APPEND | O_WRITE | O_TRUNC)) { + if (myfile.open(diveDir, fname, O_CREAT | O_APPEND | O_WRITE | O_TRUNC)) { flag.saving = true; selectFileByName(fname); TERN_(EMERGENCY_PARSER, emergency_parser.disable()); @@ -832,7 +832,7 @@ void CardReader::removeFile(const char * const name) { #if ENABLED(SDCARD_READONLY) SERIAL_ECHOLNPGM("Deletion failed (read-only), File: ", fname, "."); #else - if (file.remove(itsDirPtr, fname)) { + if (myfile.remove(itsDirPtr, fname)) { SERIAL_ECHOLNPGM("File deleted:", fname); sdpos = 0; TERN_(SDCARD_SORT_ALPHA, presort()); @@ -866,7 +866,7 @@ void CardReader::write_command(char * const buf) { *npos = nullptr, *end = buf + strlen(buf) - 1; - file.writeError = false; + myfile.writeError = false; if ((npos = strchr(buf, 'N'))) { begin = strchr(npos, ' ') + 1; end = strchr(npos, '*') - 1; @@ -874,9 +874,9 @@ void CardReader::write_command(char * const buf) { end[1] = '\r'; end[2] = '\n'; end[3] = '\0'; - file.write(begin); + myfile.write(begin); - if (file.writeError) SERIAL_ERROR_MSG(STR_SD_ERR_WRITE_TO_FILE); + if (myfile.writeError) SERIAL_ERROR_MSG(STR_SD_ERR_WRITE_TO_FILE); } #if DISABLED(NO_SD_AUTOSTART) @@ -1001,8 +1001,8 @@ void CardReader::write_command(char * const buf) { // Close the working file. // void CardReader::closefile(const bool store_location/*=false*/) { - file.sync(); - file.close(); + myfile.sync(); + myfile.close(); flag.saving = flag.logging = false; sdpos = 0; @@ -1441,7 +1441,7 @@ int16_t CardReader::get_num_items() { // Return from procedure or close out the Print Job. // void CardReader::fileHasFinished() { - file.close(); + myfile.close(); #if HAS_MEDIA_SUBCALLS if (file_subcall_ctr > 0) { // Resume calling file after closing procedure diff --git a/Marlin/src/sd/cardreader.h b/Marlin/src/sd/cardreader.h index 7dfe7e344f..1fa23ececf 100644 --- a/Marlin/src/sd/cardreader.h +++ b/Marlin/src/sd/cardreader.h @@ -230,6 +230,7 @@ public: static void pauseSDPrint() { flag.sdprinting = false; } static bool isPrinting() { return flag.sdprinting; } static bool isStillPrinting() { return flag.sdprinting && !flag.abort_sd_printing; } + static bool isStillFetching() { return isStillPrinting() && !flag.sdprintdone; } static bool isPaused() { return isFileOpen() && !isPrinting(); } #if HAS_PRINT_PROGRESS_PERMYRIAD static uint16_t permyriadDone() { @@ -289,14 +290,14 @@ public: // Print File stats static uint32_t getFileSize() { return filesize; } static uint32_t getIndex() { return sdpos; } - static bool isFileOpen() { return isMounted() && file.isOpen(); } + static bool isFileOpen() { return isMounted() && myfile.isOpen(); } static bool eof() { return getIndex() >= getFileSize(); } // File data operations - static int16_t get() { int16_t out = (int16_t)file.read(); sdpos = file.curPosition(); return out; } - static int16_t read(void *buf, uint16_t nbyte) { return file.isOpen() ? file.read(buf, nbyte) : -1; } - static int16_t write(void *buf, uint16_t nbyte) { return file.isOpen() ? file.write(buf, nbyte) : -1; } - static void setIndex(const uint32_t index) { file.seekSet((sdpos = index)); } + static int16_t get() { int16_t out = (int16_t)myfile.read(); sdpos = myfile.curPosition(); return out; } + static int16_t read(void *buf, uint16_t nbyte) { return myfile.isOpen() ? myfile.read(buf, nbyte) : -1; } + static int16_t write(void *buf, uint16_t nbyte) { return myfile.isOpen() ? myfile.write(buf, nbyte) : -1; } + static void setIndex(const uint32_t index) { myfile.seekSet((sdpos = index)); } #if ENABLED(AUTO_REPORT_SD_STATUS) // @@ -313,7 +314,7 @@ private: static DiskIODriver *driver; static MarlinVolume volume; - static MediaFile file; + static MediaFile myfile; static uint32_t filesize, // Total size of the current file, in bytes sdpos; // Index most recently read (one behind file.getPos) @@ -405,31 +406,22 @@ private: #endif }; -#if HAS_USB_FLASH_DRIVE - #define IS_SD_INSERTED() DiskIODriver_USBFlash::isInserted() -#elif HAS_SD_DETECT - #define IS_SD_INSERTED() (READ(SD_DETECT_PIN) == SD_DETECT_STATE) -#else - // No card detect line? Assume the card is inserted. - #define IS_SD_INSERTED() true -#endif - -#define IS_SD_MOUNTED() card.isMounted() -#define IS_SD_PRINTING() card.isStillPrinting() -#define IS_SD_FETCHING() (!card.flag.sdprintdone && card.isStillPrinting()) -#define IS_SD_PAUSED() card.isPaused() -#define IS_SD_FILE_OPEN() card.isFileOpen() - -extern CardReader card; - #else // !HAS_MEDIA -#define IS_SD_MOUNTED() false -#define IS_SD_PRINTING() false -#define IS_SD_FETCHING() false -#define IS_SD_PAUSED() false -#define IS_SD_FILE_OPEN() false +class CardReader { +public: + static constexpr bool isFlashDriveInserted() { return false; } + static constexpr bool isSDCardInserted() { return false; } + static constexpr bool isInserted() { return false; } + static constexpr bool isMounted() { return false; } + static constexpr bool isStillPrinting() { return false; } + static constexpr bool isStillFetching() { return false; } + static constexpr bool isPaused() { return false; } + static constexpr bool isFileOpen() { return false; } +}; #define LONG_FILENAME_LENGTH 0 #endif // !HAS_MEDIA + +extern CardReader card; From 06ef78dd19a3741f2bd2050ea34995701fad4575 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 22 Apr 2025 22:30:14 -0500 Subject: [PATCH 59/86] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Speci?= =?UTF-8?q?fic=20SD=20/=20FD=20methods?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/MarlinCore.cpp | 3 --- .../cocoa_press/status_screen.cpp | 6 +++-- .../generic/status_screen.cpp | 6 +++-- Marlin/src/lcd/extui/ui_api.cpp | 4 +++- Marlin/src/lcd/extui/ui_api.h | 3 +++ Marlin/src/lcd/language/language_en.h | 2 +- Marlin/src/lcd/language/language_es.h | 2 +- Marlin/src/lcd/language/language_gl.h | 2 +- Marlin/src/lcd/language/language_it.h | 2 +- Marlin/src/lcd/marlinui.cpp | 7 +++++- Marlin/src/sd/cardreader.cpp | 13 +++++++++- Marlin/src/sd/cardreader.h | 24 +++++++++++++++---- .../sd/usb_flashdrive/Sd2Card_FlashDrive.cpp | 2 +- 13 files changed, 57 insertions(+), 19 deletions(-) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 05355ddccb..de6677fc9a 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -820,9 +820,6 @@ void idle(const bool no_stepper_sleep/*=false*/) { // Handle SD Card insert / remove TERN_(HAS_MEDIA, card.manage_media()); - // Handle USB Flash Drive insert / remove - TERN_(HAS_USB_FLASH_DRIVE, card.diskIODriver()->idle()); - // Announce Host Keepalive state (if any) TERN_(HOST_KEEPALIVE_FEATURE, gcode.host_keepalive()); diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.cpp index 1a7ccd8be5..65ac4551b9 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.cpp @@ -432,8 +432,10 @@ void StatusScreen::onIdle() { } void StatusScreen::onMediaMounted() { - if (AT_SCREEN(StatusScreen)) - setStatusMessage(GET_TEXT_F(MSG_MEDIA_INSERTED)); + if (!AT_SCREEN(StatusScreen)) return; + setStatusMessage(ExtUI::isMediaMountedSD() ? GET_TEXT_F(MSG_MEDIA_INSERTED_SD) : + ExtUI::isMediaMountedUSB() ? GET_TEXT_F(MSG_MEDIA_INSERTED_USB) : + GET_TEXT_F(MSG_MEDIA_INSERTED)); } void StatusScreen::onMediaRemoved() { diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/status_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/status_screen.cpp index 420758ca88..7b9e8f9f34 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/status_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/status_screen.cpp @@ -588,8 +588,10 @@ bool StatusScreen::onTouchEnd(uint8_t tag) { } void StatusScreen::onMediaMounted() { - if (AT_SCREEN(StatusScreen)) - setStatusMessage(GET_TEXT_F(MSG_MEDIA_INSERTED)); + if (!AT_SCREEN(StatusScreen)) return; + setStatusMessage(ExtUI::isMediaMountedSD() ? GET_TEXT_F(MSG_MEDIA_INSERTED_SD) : + ExtUI::isMediaMountedUSB() ? GET_TEXT_F(MSG_MEDIA_INSERTED_USB) : + GET_TEXT_F(MSG_MEDIA_INSERTED)); } void StatusScreen::onMediaRemoved() { diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index 7763bac05a..b3f4c39c24 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -1079,7 +1079,9 @@ namespace ExtUI { return isPrintingFromMedia() || printJobOngoing(); } - bool isMediaMounted() { return TERN0(HAS_MEDIA, card.isMounted()); } + bool isMediaMounted() { return card.isMounted(); } + bool isMediaMountedSD() { return card.isSDCardMounted(); } + bool isMediaMountedUSB() { return card.isFlashDriveMounted(); } // Pause/Resume/Stop are implemented in MarlinUI void pausePrint() { ui.pause_print(); } diff --git a/Marlin/src/lcd/extui/ui_api.h b/Marlin/src/lcd/extui/ui_api.h index 5e781706bc..7796a4e49f 100644 --- a/Marlin/src/lcd/extui/ui_api.h +++ b/Marlin/src/lcd/extui/ui_api.h @@ -464,6 +464,9 @@ namespace ExtUI { * Use these to operate on files */ bool isMediaMounted(); + bool isMediaMountedSD(); + bool isMediaMountedUSB(); + bool isPrintingFromMediaPaused(); bool isPrintingFromMedia(); bool isPrinting(); diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index d23e638a78..7ea17d5bb3 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -44,7 +44,7 @@ #if HAS_SDCARD && !HAS_USB_FLASH_DRIVE #define MEDIA_TYPE_EN "SD Card" -#elif HAS_USB_FLASH_DRIVE +#elif HAS_USB_FLASH_DRIVE && !HAS_SDCARD #define MEDIA_TYPE_EN "USB Drive" #else #define MEDIA_TYPE_EN "Media" diff --git a/Marlin/src/lcd/language/language_es.h b/Marlin/src/lcd/language/language_es.h index d1e4babf2b..a92efd5389 100644 --- a/Marlin/src/lcd/language/language_es.h +++ b/Marlin/src/lcd/language/language_es.h @@ -30,7 +30,7 @@ #if HAS_SDCARD && !HAS_USB_FLASH_DRIVE #define MEDIA_TYPE_ES "SD" -#elif HAS_USB_FLASH_DRIVE +#elif HAS_USB_FLASH_DRIVE && !HAS_SDCARD #define MEDIA_TYPE_ES "USB" #else #define MEDIA_TYPE_ES "SD/FD" diff --git a/Marlin/src/lcd/language/language_gl.h b/Marlin/src/lcd/language/language_gl.h index 6dd699f1bd..3b7620de90 100644 --- a/Marlin/src/lcd/language/language_gl.h +++ b/Marlin/src/lcd/language/language_gl.h @@ -32,7 +32,7 @@ #if HAS_SDCARD && !HAS_USB_FLASH_DRIVE #define MEDIA_TYPE_GL "SD" -#elif HAS_USB_FLASH_DRIVE +#elif HAS_USB_FLASH_DRIVE && !HAS_SDCARD #define MEDIA_TYPE_GL "FD" #else #define MEDIA_TYPE_GL "SD/FD" diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index 424bcd8367..4bcde87859 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -40,7 +40,7 @@ #if HAS_SDCARD && !HAS_USB_FLASH_DRIVE #define MEDIA_TYPE_IT "SD" -#elif HAS_USB_FLASH_DRIVE +#elif HAS_USB_FLASH_DRIVE && !HAS_SDCARD #define MEDIA_TYPE_IT "USB" #else #define MEDIA_TYPE_IT "Media" diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 8b7e64dda8..f6b1b60c7d 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -1907,7 +1907,12 @@ uint8_t expand_u8str_P(char * const outstr, PGM_P const ptpl, const int8_t ind, quick_feedback(); goto_screen(MEDIA_MENU_GATEWAY); #else - LCD_MESSAGE(MSG_MEDIA_INSERTED); + if (card.isSDCardSelected()) + LCD_MESSAGE(MSG_MEDIA_INSERTED_SD); + else if (card.isFlashDriveSelected()) + LCD_MESSAGE(MSG_MEDIA_INSERTED_USB); + else + LCD_MESSAGE(MSG_MEDIA_INSERTED); #endif } else { // Media Removed diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index 9b0a37913a..21bc6e780a 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -501,7 +501,14 @@ void CardReader::mount() { cdroot(); else { #if ANY(HAS_SD_DETECT, HAS_USB_FLASH_DRIVE) - if (marlin_state != MarlinState::MF_INITIALIZING) LCD_ALERTMESSAGE(MSG_MEDIA_INIT_FAIL); + if (marlin_state != MarlinState::MF_INITIALIZING) { + if (isSDCardSelected()) + LCD_ALERTMESSAGE(MSG_MEDIA_INIT_FAIL_SD); + else if (isFlashDriveSelected()) + LCD_ALERTMESSAGE(MSG_MEDIA_INIT_FAIL_USB); + else + LCD_ALERTMESSAGE(MSG_MEDIA_INIT_FAIL); + } #endif } @@ -516,6 +523,10 @@ void CardReader::mount() { * Handle SD card events */ void CardReader::manage_media() { + #if HAS_USB_FLASH_DRIVE // Wrap for optimal non-virtual? + driver->idle(); // Handle device tasks (e.g., USB Drive insert / remove) + #endif + static uint8_t prev_stat = 2; // At boot we don't know if media is present or not uint8_t stat = uint8_t(isInserted()); if (stat == prev_stat) return; // Already checked and still no change? diff --git a/Marlin/src/sd/cardreader.h b/Marlin/src/sd/cardreader.h index 1fa23ececf..1a8843da58 100644 --- a/Marlin/src/sd/cardreader.h +++ b/Marlin/src/sd/cardreader.h @@ -143,10 +143,11 @@ public: } /** - * Media Detection - Inserted, Mounted, Job Running, Job Paused, etc. + * Media Detection - Inserted and Mounted Media * - * Marlin 2.1.x supports up to two drives, either an SD Card or USB-FD - * Onboard SD may have SPI or SDIO interface. USB FD may use MSC. + * Marlin 2.1.x supports up to two drives, either an SD Card or USB-FD. + * SD Card may have SPI or SDIO interface. + * SDIO / USB drives may be shared via MSC when not in use by Marlin. */ // No card detect line? Assume the card is inserted. @@ -169,8 +170,16 @@ public: // Mount and release physical media static void mount(); static void release(); + static bool isMounted() { return flag.mounted; } + static bool isSDCardMounted() { + return isMounted() && isSDCardSelected(); + } + static bool isFlashDriveMounted() { + return isMounted() && isFlashDriveSelected(); + } + // Handle media insert/remove (including mounting on boot-up) static void manage_media(); @@ -410,10 +419,17 @@ private: class CardReader { public: - static constexpr bool isFlashDriveInserted() { return false; } + static constexpr bool isSDCardSelected() { return false; } + static constexpr bool isFlashDriveSelected() { return false; } + static constexpr bool isSDCardInserted() { return false; } + static constexpr bool isFlashDriveInserted() { return false; } static constexpr bool isInserted() { return false; } + + static constexpr bool isSDCardMounted() { return false; } + static constexpr bool isFlashDriveMounted() { return false; } static constexpr bool isMounted() { return false; } + static constexpr bool isStillPrinting() { return false; } static constexpr bool isStillFetching() { return false; } static constexpr bool isPaused() { return false; } diff --git a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp index 2ae38c64c0..e6e6f30ae6 100644 --- a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp +++ b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp @@ -30,7 +30,7 @@ * 3 - perform block range checking * 4 - print each block access */ -#define USB_DEBUG 1 +#define USB_DEBUG TERN(MARLIN_DEV_MODE, 1, 0) #define USB_STARTUP_DELAY 0 // uncomment to get 'printf' console debugging. NOT FOR UNO! From 1383a4e413307a458b6fb95c4a92563b04f1c93e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 23 Apr 2025 22:04:42 -0500 Subject: [PATCH 60/86] =?UTF-8?q?=F0=9F=94=A7=20Allow=20SMOOTH=5FLIN=5FADV?= =?UTF-8?q?ANCE=20with=20DISTINCT=5FE=5FFACTORS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/SanityCheck.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 3182d93e92..074cfe0dcb 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -854,8 +854,6 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #if ENABLED(SMOOTH_LIN_ADVANCE) #ifndef CPU_32_BIT #error "SMOOTH_LIN_ADVANCE requires a 32-bit CPU." - #elif DISTINCT_E > 1 - #error "SMOOTH_LIN_ADVANCE is not compatible with multiple extruders." #elif ENABLED(S_CURVE_ACCELERATION) #error "SMOOTH_LIN_ADVANCE is not compatible with S_CURVE_ACCELERATION." #elif ENABLED(INPUT_SHAPING_E_SYNC) && NONE(INPUT_SHAPING_X, INPUT_SHAPING_Y) From ad71b81b0c78cd62fbfe98814b0110956adeda5b Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 25 Apr 2025 00:31:00 +0000 Subject: [PATCH 61/86] [cron] Bump distribution date (2025-04-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 e8a64a95f0..c96f304a03 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 "2025-04-24" +//#define STRING_DISTRIBUTION_DATE "2025-04-25" /** * The protocol for communication to the host. Protocol indicates communication diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 8a91fbdb71..43e63deb20 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 "2025-04-24" + #define STRING_DISTRIBUTION_DATE "2025-04-25" #endif /** From e0d8ea57a8261160f040431016db5f827e7a47c6 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 25 Apr 2025 21:54:53 -0500 Subject: [PATCH 62/86] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Group?= =?UTF-8?q?=20HAL/*/eeprom=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/DUE/{ => eeprom}/eeprom_flash.cpp | 6 +++--- Marlin/src/HAL/DUE/{ => eeprom}/eeprom_wired.cpp | 6 +++--- .../src/HAL/GD32_MFL/{ => eeprom}/eeprom_bl24cxx.cpp | 8 ++++---- Marlin/src/HAL/GD32_MFL/{ => eeprom}/eeprom_if_iic.cpp | 8 ++++---- Marlin/src/HAL/GD32_MFL/{ => eeprom}/eeprom_wired.cpp | 8 ++++---- Marlin/src/HAL/HC32/{ => eeprom}/eeprom_bl24cxx.cpp | 6 +++--- Marlin/src/HAL/HC32/{ => eeprom}/eeprom_if_iic.cpp | 6 +++--- Marlin/src/HAL/HC32/{ => eeprom}/eeprom_sdcard.cpp | 6 +++--- Marlin/src/HAL/HC32/{ => eeprom}/eeprom_wired.cpp | 6 +++--- Marlin/src/HAL/LPC1768/{ => eeprom}/eeprom_flash.cpp | 4 ++-- Marlin/src/HAL/LPC1768/{ => eeprom}/eeprom_sdcard.cpp | 4 ++-- Marlin/src/HAL/LPC1768/{ => eeprom}/eeprom_wired.cpp | 6 +++--- Marlin/src/HAL/RP2040/{ => eeprom}/eeprom_flash.cpp | 6 +++--- Marlin/src/HAL/RP2040/{ => eeprom}/eeprom_wired.cpp | 8 ++++---- Marlin/src/HAL/SAMD21/{ => eeprom}/QSPIFlash.cpp | 2 +- Marlin/src/HAL/SAMD21/{ => eeprom}/QSPIFlash.h | 0 Marlin/src/HAL/SAMD21/{ => eeprom}/eeprom_flash.cpp | 4 ++-- Marlin/src/HAL/SAMD21/{ => eeprom}/eeprom_qspi.cpp | 4 ++-- Marlin/src/HAL/SAMD21/{ => eeprom}/eeprom_wired.cpp | 6 +++--- Marlin/src/HAL/SAMD51/{ => eeprom}/QSPIFlash.cpp | 2 +- Marlin/src/HAL/SAMD51/{ => eeprom}/QSPIFlash.h | 0 Marlin/src/HAL/SAMD51/{ => eeprom}/eeprom_flash.cpp | 4 ++-- Marlin/src/HAL/SAMD51/{ => eeprom}/eeprom_qspi.cpp | 4 ++-- Marlin/src/HAL/SAMD51/{ => eeprom}/eeprom_wired.cpp | 6 +++--- Marlin/src/HAL/STM32/{ => eeprom}/eeprom_bl24cxx.cpp | 8 ++++---- Marlin/src/HAL/STM32/{ => eeprom}/eeprom_flash.cpp | 10 +++++----- Marlin/src/HAL/STM32/{ => eeprom}/eeprom_if_iic.cpp | 8 ++++---- Marlin/src/HAL/STM32/{ => eeprom}/eeprom_sdcard.cpp | 8 ++++---- Marlin/src/HAL/STM32/{ => eeprom}/eeprom_sram.cpp | 8 ++++---- Marlin/src/HAL/STM32/{ => eeprom}/eeprom_wired.cpp | 8 ++++---- Marlin/src/HAL/STM32F1/{ => eeprom}/eeprom_bl24cxx.cpp | 6 +++--- Marlin/src/HAL/STM32F1/{ => eeprom}/eeprom_flash.cpp | 4 ++-- Marlin/src/HAL/STM32F1/{ => eeprom}/eeprom_if_iic.cpp | 6 +++--- Marlin/src/HAL/STM32F1/{ => eeprom}/eeprom_sdcard.cpp | 6 +++--- Marlin/src/HAL/STM32F1/{ => eeprom}/eeprom_wired.cpp | 6 +++--- platformio.ini | 1 + 36 files changed, 100 insertions(+), 99 deletions(-) rename Marlin/src/HAL/DUE/{ => eeprom}/eeprom_flash.cpp (99%) rename Marlin/src/HAL/DUE/{ => eeprom}/eeprom_wired.cpp (95%) rename Marlin/src/HAL/GD32_MFL/{ => eeprom}/eeprom_bl24cxx.cpp (94%) rename Marlin/src/HAL/GD32_MFL/{ => eeprom}/eeprom_if_iic.cpp (91%) rename Marlin/src/HAL/GD32_MFL/{ => eeprom}/eeprom_wired.cpp (94%) rename Marlin/src/HAL/HC32/{ => eeprom}/eeprom_bl24cxx.cpp (95%) rename Marlin/src/HAL/HC32/{ => eeprom}/eeprom_if_iic.cpp (92%) rename Marlin/src/HAL/HC32/{ => eeprom}/eeprom_sdcard.cpp (96%) rename Marlin/src/HAL/HC32/{ => eeprom}/eeprom_wired.cpp (95%) rename Marlin/src/HAL/LPC1768/{ => eeprom}/eeprom_flash.cpp (98%) rename Marlin/src/HAL/LPC1768/{ => eeprom}/eeprom_sdcard.cpp (98%) rename Marlin/src/HAL/LPC1768/{ => eeprom}/eeprom_wired.cpp (95%) rename Marlin/src/HAL/RP2040/{ => eeprom}/eeprom_flash.cpp (95%) rename Marlin/src/HAL/RP2040/{ => eeprom}/eeprom_wired.cpp (94%) rename Marlin/src/HAL/SAMD21/{ => eeprom}/QSPIFlash.cpp (98%) rename Marlin/src/HAL/SAMD21/{ => eeprom}/QSPIFlash.h (100%) rename Marlin/src/HAL/SAMD21/{ => eeprom}/eeprom_flash.cpp (98%) rename Marlin/src/HAL/SAMD21/{ => eeprom}/eeprom_qspi.cpp (96%) rename Marlin/src/HAL/SAMD21/{ => eeprom}/eeprom_wired.cpp (95%) rename Marlin/src/HAL/SAMD51/{ => eeprom}/QSPIFlash.cpp (98%) rename Marlin/src/HAL/SAMD51/{ => eeprom}/QSPIFlash.h (100%) rename Marlin/src/HAL/SAMD51/{ => eeprom}/eeprom_flash.cpp (97%) rename Marlin/src/HAL/SAMD51/{ => eeprom}/eeprom_qspi.cpp (96%) rename Marlin/src/HAL/SAMD51/{ => eeprom}/eeprom_wired.cpp (95%) rename Marlin/src/HAL/STM32/{ => eeprom}/eeprom_bl24cxx.cpp (94%) rename Marlin/src/HAL/STM32/{ => eeprom}/eeprom_flash.cpp (98%) rename Marlin/src/HAL/STM32/{ => eeprom}/eeprom_if_iic.cpp (91%) rename Marlin/src/HAL/STM32/{ => eeprom}/eeprom_sdcard.cpp (94%) rename Marlin/src/HAL/STM32/{ => eeprom}/eeprom_sram.cpp (93%) rename Marlin/src/HAL/STM32/{ => eeprom}/eeprom_wired.cpp (94%) rename Marlin/src/HAL/STM32F1/{ => eeprom}/eeprom_bl24cxx.cpp (95%) rename Marlin/src/HAL/STM32F1/{ => eeprom}/eeprom_flash.cpp (98%) rename Marlin/src/HAL/STM32F1/{ => eeprom}/eeprom_if_iic.cpp (93%) rename Marlin/src/HAL/STM32F1/{ => eeprom}/eeprom_sdcard.cpp (96%) rename Marlin/src/HAL/STM32F1/{ => eeprom}/eeprom_wired.cpp (95%) diff --git a/Marlin/src/HAL/DUE/eeprom_flash.cpp b/Marlin/src/HAL/DUE/eeprom/eeprom_flash.cpp similarity index 99% rename from Marlin/src/HAL/DUE/eeprom_flash.cpp rename to Marlin/src/HAL/DUE/eeprom/eeprom_flash.cpp index 55206a0f9d..b33d15e106 100644 --- a/Marlin/src/HAL/DUE/eeprom_flash.cpp +++ b/Marlin/src/HAL/DUE/eeprom/eeprom_flash.cpp @@ -21,7 +21,7 @@ */ #ifdef ARDUINO_ARCH_SAM -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if ENABLED(FLASH_EEPROM_EMULATION) @@ -132,7 +132,7 @@ static uint8_t buffer[256] = {0}, // The RAM buffer to accumulate writes curGroup = 0xFF; // Current FLASH group #define DEBUG_OUT ENABLED(EE_EMU_DEBUG) -#include "../../core/debug_out.h" +#include "../../../core/debug_out.h" static void ee_Dump(const int page, const void *data) { @@ -953,7 +953,7 @@ static void ee_Init() { /* PersistentStore -----------------------------------------------------------*/ -#include "../shared/eeprom_api.h" +#include "../../shared/eeprom_api.h" #ifndef MARLIN_EEPROM_SIZE #define MARLIN_EEPROM_SIZE 0x1000 // 4KB diff --git a/Marlin/src/HAL/DUE/eeprom_wired.cpp b/Marlin/src/HAL/DUE/eeprom/eeprom_wired.cpp similarity index 95% rename from Marlin/src/HAL/DUE/eeprom_wired.cpp rename to Marlin/src/HAL/DUE/eeprom/eeprom_wired.cpp index 84338ccb4b..cf9233816c 100644 --- a/Marlin/src/HAL/DUE/eeprom_wired.cpp +++ b/Marlin/src/HAL/DUE/eeprom/eeprom_wired.cpp @@ -21,7 +21,7 @@ */ #ifdef ARDUINO_ARCH_SAM -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if USE_WIRED_EEPROM @@ -30,8 +30,8 @@ * with simple implementations supplied by Marlin. */ -#include "../shared/eeprom_if.h" -#include "../shared/eeprom_api.h" +#include "../../shared/eeprom_if.h" +#include "../../shared/eeprom_api.h" #ifndef MARLIN_EEPROM_SIZE #error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM." diff --git a/Marlin/src/HAL/GD32_MFL/eeprom_bl24cxx.cpp b/Marlin/src/HAL/GD32_MFL/eeprom/eeprom_bl24cxx.cpp similarity index 94% rename from Marlin/src/HAL/GD32_MFL/eeprom_bl24cxx.cpp rename to Marlin/src/HAL/GD32_MFL/eeprom/eeprom_bl24cxx.cpp index 2d3329c7f6..9c44933fe3 100644 --- a/Marlin/src/HAL/GD32_MFL/eeprom_bl24cxx.cpp +++ b/Marlin/src/HAL/GD32_MFL/eeprom/eeprom_bl24cxx.cpp @@ -25,16 +25,16 @@ * with simple implementations supplied by Marlin. */ -#include "../platforms.h" +#include "../../platforms.h" #ifdef ARDUINO_ARCH_MFL -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if ENABLED(IIC_BL24CXX_EEPROM) -#include "../shared/eeprom_if.h" -#include "../shared/eeprom_api.h" +#include "../../shared/eeprom_if.h" +#include "../../shared/eeprom_api.h" #ifndef MARLIN_EEPROM_SIZE #error "MARLIN_EEPROM_SIZE is required for IIC_BL24CXX_EEPROM." diff --git a/Marlin/src/HAL/GD32_MFL/eeprom_if_iic.cpp b/Marlin/src/HAL/GD32_MFL/eeprom/eeprom_if_iic.cpp similarity index 91% rename from Marlin/src/HAL/GD32_MFL/eeprom_if_iic.cpp rename to Marlin/src/HAL/GD32_MFL/eeprom/eeprom_if_iic.cpp index 96eebea122..ea563f742c 100644 --- a/Marlin/src/HAL/GD32_MFL/eeprom_if_iic.cpp +++ b/Marlin/src/HAL/GD32_MFL/eeprom/eeprom_if_iic.cpp @@ -25,16 +25,16 @@ * Enable USE_SHARED_EEPROM if not supplied by the framework. */ -#include "../platforms.h" +#include "../../platforms.h" #ifdef ARDUINO_ARCH_MFL -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if ENABLED(IIC_BL24CXX_EEPROM) -#include "../../libs/BL24CXX.h" -#include "../shared/eeprom_if.h" +#include "../../../libs/BL24CXX.h" +#include "../../shared/eeprom_if.h" void eeprom_init() { BL24CXX::init(); diff --git a/Marlin/src/HAL/GD32_MFL/eeprom_wired.cpp b/Marlin/src/HAL/GD32_MFL/eeprom/eeprom_wired.cpp similarity index 94% rename from Marlin/src/HAL/GD32_MFL/eeprom_wired.cpp rename to Marlin/src/HAL/GD32_MFL/eeprom/eeprom_wired.cpp index 58a6f85e7f..8860e53a62 100644 --- a/Marlin/src/HAL/GD32_MFL/eeprom_wired.cpp +++ b/Marlin/src/HAL/GD32_MFL/eeprom/eeprom_wired.cpp @@ -19,11 +19,11 @@ * along with this program. If not, see . * */ -#include "../platforms.h" +#include "../../platforms.h" #ifdef ARDUINO_ARCH_MFL -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if USE_WIRED_EEPROM @@ -32,8 +32,8 @@ * with simple implementations supplied by Marlin. */ -#include "../shared/eeprom_if.h" -#include "../shared/eeprom_api.h" +#include "../../shared/eeprom_if.h" +#include "../../shared/eeprom_api.h" #ifndef MARLIN_EEPROM_SIZE #define MARLIN_EEPROM_SIZE size_t(E2END + 1) diff --git a/Marlin/src/HAL/HC32/eeprom_bl24cxx.cpp b/Marlin/src/HAL/HC32/eeprom/eeprom_bl24cxx.cpp similarity index 95% rename from Marlin/src/HAL/HC32/eeprom_bl24cxx.cpp rename to Marlin/src/HAL/HC32/eeprom/eeprom_bl24cxx.cpp index 59da99b3f5..a53a7c4062 100644 --- a/Marlin/src/HAL/HC32/eeprom_bl24cxx.cpp +++ b/Marlin/src/HAL/HC32/eeprom/eeprom_bl24cxx.cpp @@ -26,12 +26,12 @@ */ #ifdef ARDUINO_ARCH_HC32 -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if ENABLED(IIC_BL24CXX_EEPROM) -#include "../shared/eeprom_api.h" -#include "../shared/eeprom_if.h" +#include "../../shared/eeprom_api.h" +#include "../../shared/eeprom_if.h" #ifndef MARLIN_EEPROM_SIZE #error "MARLIN_EEPROM_SIZE is required for IIC_BL24CXX_EEPROM." diff --git a/Marlin/src/HAL/HC32/eeprom_if_iic.cpp b/Marlin/src/HAL/HC32/eeprom/eeprom_if_iic.cpp similarity index 92% rename from Marlin/src/HAL/HC32/eeprom_if_iic.cpp rename to Marlin/src/HAL/HC32/eeprom/eeprom_if_iic.cpp index 02b1d3fd54..85d21a972a 100644 --- a/Marlin/src/HAL/HC32/eeprom_if_iic.cpp +++ b/Marlin/src/HAL/HC32/eeprom/eeprom_if_iic.cpp @@ -26,12 +26,12 @@ */ #ifdef ARDUINO_ARCH_HC32 -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if ENABLED(IIC_BL24CXX_EEPROM) -#include "../../libs/BL24CXX.h" -#include "../shared/eeprom_if.h" +#include "../../../libs/BL24CXX.h" +#include "../../shared/eeprom_if.h" void eeprom_init() { BL24CXX::init(); diff --git a/Marlin/src/HAL/HC32/eeprom_sdcard.cpp b/Marlin/src/HAL/HC32/eeprom/eeprom_sdcard.cpp similarity index 96% rename from Marlin/src/HAL/HC32/eeprom_sdcard.cpp rename to Marlin/src/HAL/HC32/eeprom/eeprom_sdcard.cpp index 601e86dd30..45f3b01cf7 100644 --- a/Marlin/src/HAL/HC32/eeprom_sdcard.cpp +++ b/Marlin/src/HAL/HC32/eeprom/eeprom_sdcard.cpp @@ -25,12 +25,12 @@ */ #ifdef ARDUINO_ARCH_HC32 -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if ENABLED(SDCARD_EEPROM_EMULATION) -#include "../shared/eeprom_api.h" -#include "../../sd/cardreader.h" +#include "../../shared/eeprom_api.h" +#include "../../../sd/cardreader.h" #define EEPROM_FILENAME "eeprom.dat" diff --git a/Marlin/src/HAL/HC32/eeprom_wired.cpp b/Marlin/src/HAL/HC32/eeprom/eeprom_wired.cpp similarity index 95% rename from Marlin/src/HAL/HC32/eeprom_wired.cpp rename to Marlin/src/HAL/HC32/eeprom/eeprom_wired.cpp index aea5fc87db..997180bd98 100644 --- a/Marlin/src/HAL/HC32/eeprom_wired.cpp +++ b/Marlin/src/HAL/HC32/eeprom/eeprom_wired.cpp @@ -21,7 +21,7 @@ */ #ifdef ARDUINO_ARCH_HC32 -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if USE_WIRED_EEPROM @@ -32,8 +32,8 @@ * with simple implementations supplied by Marlin. */ -#include "../shared/eeprom_if.h" -#include "../shared/eeprom_api.h" +#include "../../shared/eeprom_if.h" +#include "../../shared/eeprom_api.h" #ifndef MARLIN_EEPROM_SIZE #error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM." diff --git a/Marlin/src/HAL/LPC1768/eeprom_flash.cpp b/Marlin/src/HAL/LPC1768/eeprom/eeprom_flash.cpp similarity index 98% rename from Marlin/src/HAL/LPC1768/eeprom_flash.cpp rename to Marlin/src/HAL/LPC1768/eeprom/eeprom_flash.cpp index 9f873d5774..3610f433eb 100644 --- a/Marlin/src/HAL/LPC1768/eeprom_flash.cpp +++ b/Marlin/src/HAL/LPC1768/eeprom/eeprom_flash.cpp @@ -36,11 +36,11 @@ * 16Kb I/O buffers (intended to hold DMA USB and Ethernet data, but currently * unused). */ -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if ENABLED(FLASH_EEPROM_EMULATION) -#include "../shared/eeprom_api.h" +#include "../../shared/eeprom_api.h" extern "C" { #include diff --git a/Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp b/Marlin/src/HAL/LPC1768/eeprom/eeprom_sdcard.cpp similarity index 98% rename from Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp rename to Marlin/src/HAL/LPC1768/eeprom/eeprom_sdcard.cpp index 30ecb01a09..3500f3e7cf 100644 --- a/Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp +++ b/Marlin/src/HAL/LPC1768/eeprom/eeprom_sdcard.cpp @@ -26,13 +26,13 @@ #ifdef TARGET_LPC1768 -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if ENABLED(SDCARD_EEPROM_EMULATION) //#define DEBUG_SD_EEPROM_EMULATION -#include "../shared/eeprom_api.h" +#include "../../shared/eeprom_api.h" #include #include diff --git a/Marlin/src/HAL/LPC1768/eeprom_wired.cpp b/Marlin/src/HAL/LPC1768/eeprom/eeprom_wired.cpp similarity index 95% rename from Marlin/src/HAL/LPC1768/eeprom_wired.cpp rename to Marlin/src/HAL/LPC1768/eeprom/eeprom_wired.cpp index 3230e29afc..6a5d90bd02 100644 --- a/Marlin/src/HAL/LPC1768/eeprom_wired.cpp +++ b/Marlin/src/HAL/LPC1768/eeprom/eeprom_wired.cpp @@ -21,7 +21,7 @@ */ #ifdef TARGET_LPC1768 -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if USE_WIRED_EEPROM @@ -30,8 +30,8 @@ * with implementations supplied by the framework. */ -#include "../shared/eeprom_if.h" -#include "../shared/eeprom_api.h" +#include "../../shared/eeprom_if.h" +#include "../../shared/eeprom_api.h" #ifndef MARLIN_EEPROM_SIZE #define MARLIN_EEPROM_SIZE 0x8000 // 32K diff --git a/Marlin/src/HAL/RP2040/eeprom_flash.cpp b/Marlin/src/HAL/RP2040/eeprom/eeprom_flash.cpp similarity index 95% rename from Marlin/src/HAL/RP2040/eeprom_flash.cpp rename to Marlin/src/HAL/RP2040/eeprom/eeprom_flash.cpp index 5b1131ed43..89e882d77b 100644 --- a/Marlin/src/HAL/RP2040/eeprom_flash.cpp +++ b/Marlin/src/HAL/RP2040/eeprom/eeprom_flash.cpp @@ -19,15 +19,15 @@ * along with this program. If not, see . * */ -#include "../platforms.h" +#include "../../platforms.h" #ifdef __PLAT_RP2040__ -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if ENABLED(FLASH_EEPROM_EMULATION) -#include "../shared/eeprom_api.h" +#include "../../shared/eeprom_api.h" // NOTE: The Bigtreetech SKR Pico has an onboard W25Q16 flash module diff --git a/Marlin/src/HAL/RP2040/eeprom_wired.cpp b/Marlin/src/HAL/RP2040/eeprom/eeprom_wired.cpp similarity index 94% rename from Marlin/src/HAL/RP2040/eeprom_wired.cpp rename to Marlin/src/HAL/RP2040/eeprom/eeprom_wired.cpp index 974f6f8dc1..7a5ca86c4c 100644 --- a/Marlin/src/HAL/RP2040/eeprom_wired.cpp +++ b/Marlin/src/HAL/RP2040/eeprom/eeprom_wired.cpp @@ -19,11 +19,11 @@ * along with this program. If not, see . * */ -#include "../platforms.h" +#include "../../platforms.h" #ifdef __PLAT_RP2040__ -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if USE_WIRED_EEPROM @@ -32,8 +32,8 @@ * with simple implementations supplied by Marlin. */ -#include "../shared/eeprom_if.h" -#include "../shared/eeprom_api.h" +#include "../../shared/eeprom_if.h" +#include "../../shared/eeprom_api.h" #ifndef MARLIN_EEPROM_SIZE #define MARLIN_EEPROM_SIZE size_t(E2END + 1) diff --git a/Marlin/src/HAL/SAMD21/QSPIFlash.cpp b/Marlin/src/HAL/SAMD21/eeprom/QSPIFlash.cpp similarity index 98% rename from Marlin/src/HAL/SAMD21/QSPIFlash.cpp rename to Marlin/src/HAL/SAMD21/eeprom/QSPIFlash.cpp index fa54c62071..2a93226a6f 100644 --- a/Marlin/src/HAL/SAMD21/QSPIFlash.cpp +++ b/Marlin/src/HAL/SAMD21/eeprom/QSPIFlash.cpp @@ -24,7 +24,7 @@ * SAMD21 HAL developed by Bart Meijer (brupje) * Based on SAMD51 HAL by Giuliano Zaro (AKA GMagician) */ -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if ENABLED(QSPI_EEPROM) diff --git a/Marlin/src/HAL/SAMD21/QSPIFlash.h b/Marlin/src/HAL/SAMD21/eeprom/QSPIFlash.h similarity index 100% rename from Marlin/src/HAL/SAMD21/QSPIFlash.h rename to Marlin/src/HAL/SAMD21/eeprom/QSPIFlash.h diff --git a/Marlin/src/HAL/SAMD21/eeprom_flash.cpp b/Marlin/src/HAL/SAMD21/eeprom/eeprom_flash.cpp similarity index 98% rename from Marlin/src/HAL/SAMD21/eeprom_flash.cpp rename to Marlin/src/HAL/SAMD21/eeprom/eeprom_flash.cpp index 66329bff19..1c190495de 100644 --- a/Marlin/src/HAL/SAMD21/eeprom_flash.cpp +++ b/Marlin/src/HAL/SAMD21/eeprom/eeprom_flash.cpp @@ -26,7 +26,7 @@ */ #ifdef __SAMD21__ -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if ENABLED(FLASH_EEPROM_EMULATION) @@ -35,7 +35,7 @@ /* reserve flash memory */ static const uint8_t flashdata[TOTAL_FLASH_SIZE] __attribute__((__aligned__(256))) { }; \ -#include "../shared/eeprom_api.h" +#include "../../shared/eeprom_api.h" size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; } diff --git a/Marlin/src/HAL/SAMD21/eeprom_qspi.cpp b/Marlin/src/HAL/SAMD21/eeprom/eeprom_qspi.cpp similarity index 96% rename from Marlin/src/HAL/SAMD21/eeprom_qspi.cpp rename to Marlin/src/HAL/SAMD21/eeprom/eeprom_qspi.cpp index 12977a178c..8bd1bd3539 100644 --- a/Marlin/src/HAL/SAMD21/eeprom_qspi.cpp +++ b/Marlin/src/HAL/SAMD21/eeprom/eeprom_qspi.cpp @@ -26,13 +26,13 @@ */ #ifdef __SAMD21__ -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if ENABLED(QSPI_EEPROM) #error "QSPI_EEPROM emulation Not implemented on SAMD21" -#include "../shared/eeprom_api.h" +#include "../../shared/eeprom_api.h" #include "QSPIFlash.h" diff --git a/Marlin/src/HAL/SAMD21/eeprom_wired.cpp b/Marlin/src/HAL/SAMD21/eeprom/eeprom_wired.cpp similarity index 95% rename from Marlin/src/HAL/SAMD21/eeprom_wired.cpp rename to Marlin/src/HAL/SAMD21/eeprom/eeprom_wired.cpp index da0eb1b0c8..82c701ebb1 100644 --- a/Marlin/src/HAL/SAMD21/eeprom_wired.cpp +++ b/Marlin/src/HAL/SAMD21/eeprom/eeprom_wired.cpp @@ -26,7 +26,7 @@ */ #ifdef __SAMD21__ -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if USE_WIRED_EEPROM @@ -36,8 +36,8 @@ * with simple implementations supplied by Marlin. */ -#include "../shared/eeprom_if.h" -#include "../shared/eeprom_api.h" +#include "../../shared/eeprom_if.h" +#include "../../shared/eeprom_api.h" #ifndef MARLIN_EEPROM_SIZE #error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM." diff --git a/Marlin/src/HAL/SAMD51/QSPIFlash.cpp b/Marlin/src/HAL/SAMD51/eeprom/QSPIFlash.cpp similarity index 98% rename from Marlin/src/HAL/SAMD51/QSPIFlash.cpp rename to Marlin/src/HAL/SAMD51/eeprom/QSPIFlash.cpp index fc21a1ad8c..191da1f30c 100644 --- a/Marlin/src/HAL/SAMD51/QSPIFlash.cpp +++ b/Marlin/src/HAL/SAMD51/eeprom/QSPIFlash.cpp @@ -20,7 +20,7 @@ * */ -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if ENABLED(QSPI_EEPROM) diff --git a/Marlin/src/HAL/SAMD51/QSPIFlash.h b/Marlin/src/HAL/SAMD51/eeprom/QSPIFlash.h similarity index 100% rename from Marlin/src/HAL/SAMD51/QSPIFlash.h rename to Marlin/src/HAL/SAMD51/eeprom/QSPIFlash.h diff --git a/Marlin/src/HAL/SAMD51/eeprom_flash.cpp b/Marlin/src/HAL/SAMD51/eeprom/eeprom_flash.cpp similarity index 97% rename from Marlin/src/HAL/SAMD51/eeprom_flash.cpp rename to Marlin/src/HAL/SAMD51/eeprom/eeprom_flash.cpp index 7d5518956c..2387a0f99e 100644 --- a/Marlin/src/HAL/SAMD51/eeprom_flash.cpp +++ b/Marlin/src/HAL/SAMD51/eeprom/eeprom_flash.cpp @@ -25,11 +25,11 @@ */ #ifdef __SAMD51__ -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if ENABLED(FLASH_EEPROM_EMULATION) -#include "../shared/eeprom_api.h" +#include "../../shared/eeprom_api.h" #define NVMCTRL_CMD(c) do{ \ SYNC(!NVMCTRL->STATUS.bit.READY); \ diff --git a/Marlin/src/HAL/SAMD51/eeprom_qspi.cpp b/Marlin/src/HAL/SAMD51/eeprom/eeprom_qspi.cpp similarity index 96% rename from Marlin/src/HAL/SAMD51/eeprom_qspi.cpp rename to Marlin/src/HAL/SAMD51/eeprom/eeprom_qspi.cpp index a39e4c4fa3..e829c28e26 100644 --- a/Marlin/src/HAL/SAMD51/eeprom_qspi.cpp +++ b/Marlin/src/HAL/SAMD51/eeprom/eeprom_qspi.cpp @@ -25,11 +25,11 @@ */ #ifdef __SAMD51__ -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if ENABLED(QSPI_EEPROM) -#include "../shared/eeprom_api.h" +#include "../../shared/eeprom_api.h" #include "QSPIFlash.h" diff --git a/Marlin/src/HAL/SAMD51/eeprom_wired.cpp b/Marlin/src/HAL/SAMD51/eeprom/eeprom_wired.cpp similarity index 95% rename from Marlin/src/HAL/SAMD51/eeprom_wired.cpp rename to Marlin/src/HAL/SAMD51/eeprom/eeprom_wired.cpp index 00a739a587..fc1eb09a0c 100644 --- a/Marlin/src/HAL/SAMD51/eeprom_wired.cpp +++ b/Marlin/src/HAL/SAMD51/eeprom/eeprom_wired.cpp @@ -25,7 +25,7 @@ */ #ifdef __SAMD51__ -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if USE_WIRED_EEPROM @@ -34,8 +34,8 @@ * with simple implementations supplied by Marlin. */ -#include "../shared/eeprom_if.h" -#include "../shared/eeprom_api.h" +#include "../../shared/eeprom_if.h" +#include "../../shared/eeprom_api.h" #ifndef MARLIN_EEPROM_SIZE #error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM." diff --git a/Marlin/src/HAL/STM32/eeprom_bl24cxx.cpp b/Marlin/src/HAL/STM32/eeprom/eeprom_bl24cxx.cpp similarity index 94% rename from Marlin/src/HAL/STM32/eeprom_bl24cxx.cpp rename to Marlin/src/HAL/STM32/eeprom/eeprom_bl24cxx.cpp index 3e0bb58dad..8240f15d3a 100644 --- a/Marlin/src/HAL/STM32/eeprom_bl24cxx.cpp +++ b/Marlin/src/HAL/STM32/eeprom/eeprom_bl24cxx.cpp @@ -20,7 +20,7 @@ * */ -#include "../platforms.h" +#include "../../platforms.h" #ifdef HAL_STM32 @@ -29,12 +29,12 @@ * with simple implementations supplied by Marlin. */ -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if ENABLED(IIC_BL24CXX_EEPROM) -#include "../shared/eeprom_if.h" -#include "../shared/eeprom_api.h" +#include "../../shared/eeprom_if.h" +#include "../../shared/eeprom_api.h" // // PersistentStore diff --git a/Marlin/src/HAL/STM32/eeprom_flash.cpp b/Marlin/src/HAL/STM32/eeprom/eeprom_flash.cpp similarity index 98% rename from Marlin/src/HAL/STM32/eeprom_flash.cpp rename to Marlin/src/HAL/STM32/eeprom/eeprom_flash.cpp index 14e6e4d854..9f1e49a4f6 100644 --- a/Marlin/src/HAL/STM32/eeprom_flash.cpp +++ b/Marlin/src/HAL/STM32/eeprom/eeprom_flash.cpp @@ -19,15 +19,15 @@ * along with this program. If not, see . * */ -#include "../platforms.h" +#include "../../platforms.h" #ifdef HAL_STM32 -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if ENABLED(FLASH_EEPROM_EMULATION) -#include "../shared/eeprom_api.h" +#include "../../shared/eeprom_api.h" // Better: "utility/stm32_eeprom.h", but only after updating stm32duino to 2.0.0 // Use EEPROM.h for compatibility, for now. @@ -50,10 +50,10 @@ #if ENABLED(FLASH_EEPROM_LEVELING) - #include "stm32_def.h" + #include #define DEBUG_OUT ENABLED(EEPROM_CHITCHAT) - #include "../../core/debug_out.h" + #include "../../../core/debug_out.h" #ifndef MARLIN_EEPROM_SIZE #define MARLIN_EEPROM_SIZE 0x1000 // 4KB diff --git a/Marlin/src/HAL/STM32/eeprom_if_iic.cpp b/Marlin/src/HAL/STM32/eeprom/eeprom_if_iic.cpp similarity index 91% rename from Marlin/src/HAL/STM32/eeprom_if_iic.cpp rename to Marlin/src/HAL/STM32/eeprom/eeprom_if_iic.cpp index ad8712c0c0..9cabdd681b 100644 --- a/Marlin/src/HAL/STM32/eeprom_if_iic.cpp +++ b/Marlin/src/HAL/STM32/eeprom/eeprom_if_iic.cpp @@ -20,7 +20,7 @@ * */ -#include "../platforms.h" +#include "../../platforms.h" #ifdef HAL_STM32 @@ -29,12 +29,12 @@ * Enable USE_SHARED_EEPROM if not supplied by the framework. */ -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if ENABLED(IIC_BL24CXX_EEPROM) -#include "../../libs/BL24CXX.h" -#include "../shared/eeprom_if.h" +#include "../../../libs/BL24CXX.h" +#include "../../shared/eeprom_if.h" void eeprom_init() { BL24CXX::init(); } diff --git a/Marlin/src/HAL/STM32/eeprom_sdcard.cpp b/Marlin/src/HAL/STM32/eeprom/eeprom_sdcard.cpp similarity index 94% rename from Marlin/src/HAL/STM32/eeprom_sdcard.cpp rename to Marlin/src/HAL/STM32/eeprom/eeprom_sdcard.cpp index 071d0bac00..bcc76df813 100644 --- a/Marlin/src/HAL/STM32/eeprom_sdcard.cpp +++ b/Marlin/src/HAL/STM32/eeprom/eeprom_sdcard.cpp @@ -20,7 +20,7 @@ * */ -#include "../platforms.h" +#include "../../platforms.h" #ifdef HAL_STM32 @@ -28,12 +28,12 @@ * Implementation of EEPROM settings in SD Card */ -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if ENABLED(SDCARD_EEPROM_EMULATION) -#include "../shared/eeprom_api.h" -#include "../../sd/cardreader.h" +#include "../../shared/eeprom_api.h" +#include "../../../sd/cardreader.h" #define EEPROM_FILENAME "eeprom.dat" diff --git a/Marlin/src/HAL/STM32/eeprom_sram.cpp b/Marlin/src/HAL/STM32/eeprom/eeprom_sram.cpp similarity index 93% rename from Marlin/src/HAL/STM32/eeprom_sram.cpp rename to Marlin/src/HAL/STM32/eeprom/eeprom_sram.cpp index 58a67f1759..a9d62ec29c 100644 --- a/Marlin/src/HAL/STM32/eeprom_sram.cpp +++ b/Marlin/src/HAL/STM32/eeprom/eeprom_sram.cpp @@ -19,16 +19,16 @@ * along with this program. If not, see . * */ -#include "../platforms.h" +#include "../../platforms.h" #ifdef HAL_STM32 -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if ENABLED(SRAM_EEPROM_EMULATION) -#include "../shared/eeprom_if.h" -#include "../shared/eeprom_api.h" +#include "../../shared/eeprom_if.h" +#include "../../shared/eeprom_api.h" #ifndef MARLIN_EEPROM_SIZE #define MARLIN_EEPROM_SIZE 0x1000 // 4KB diff --git a/Marlin/src/HAL/STM32/eeprom_wired.cpp b/Marlin/src/HAL/STM32/eeprom/eeprom_wired.cpp similarity index 94% rename from Marlin/src/HAL/STM32/eeprom_wired.cpp rename to Marlin/src/HAL/STM32/eeprom/eeprom_wired.cpp index 5440030bd4..fa45e6c40d 100644 --- a/Marlin/src/HAL/STM32/eeprom_wired.cpp +++ b/Marlin/src/HAL/STM32/eeprom/eeprom_wired.cpp @@ -19,11 +19,11 @@ * along with this program. If not, see . * */ -#include "../platforms.h" +#include "../../platforms.h" #ifdef HAL_STM32 -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if USE_WIRED_EEPROM @@ -32,8 +32,8 @@ * with simple implementations supplied by Marlin. */ -#include "../shared/eeprom_if.h" -#include "../shared/eeprom_api.h" +#include "../../shared/eeprom_if.h" +#include "../../shared/eeprom_api.h" #ifndef MARLIN_EEPROM_SIZE #define MARLIN_EEPROM_SIZE size_t(E2END + 1) diff --git a/Marlin/src/HAL/STM32F1/eeprom_bl24cxx.cpp b/Marlin/src/HAL/STM32F1/eeprom/eeprom_bl24cxx.cpp similarity index 95% rename from Marlin/src/HAL/STM32F1/eeprom_bl24cxx.cpp rename to Marlin/src/HAL/STM32F1/eeprom/eeprom_bl24cxx.cpp index 1252e77b0b..9e96a741bf 100644 --- a/Marlin/src/HAL/STM32F1/eeprom_bl24cxx.cpp +++ b/Marlin/src/HAL/STM32F1/eeprom/eeprom_bl24cxx.cpp @@ -26,12 +26,12 @@ * with simple implementations supplied by Marlin. */ -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if ENABLED(IIC_BL24CXX_EEPROM) -#include "../shared/eeprom_if.h" -#include "../shared/eeprom_api.h" +#include "../../shared/eeprom_if.h" +#include "../../shared/eeprom_api.h" // // PersistentStore diff --git a/Marlin/src/HAL/STM32F1/eeprom_flash.cpp b/Marlin/src/HAL/STM32F1/eeprom/eeprom_flash.cpp similarity index 98% rename from Marlin/src/HAL/STM32F1/eeprom_flash.cpp rename to Marlin/src/HAL/STM32F1/eeprom/eeprom_flash.cpp index 50d9cfc4f4..485bc4f1ba 100644 --- a/Marlin/src/HAL/STM32F1/eeprom_flash.cpp +++ b/Marlin/src/HAL/STM32F1/eeprom/eeprom_flash.cpp @@ -28,11 +28,11 @@ #ifdef __STM32F1__ -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if ENABLED(FLASH_EEPROM_EMULATION) -#include "../shared/eeprom_api.h" +#include "../../shared/eeprom_api.h" #include #include diff --git a/Marlin/src/HAL/STM32F1/eeprom_if_iic.cpp b/Marlin/src/HAL/STM32F1/eeprom/eeprom_if_iic.cpp similarity index 93% rename from Marlin/src/HAL/STM32F1/eeprom_if_iic.cpp rename to Marlin/src/HAL/STM32F1/eeprom/eeprom_if_iic.cpp index 78b7af0b04..e1d5e06b68 100644 --- a/Marlin/src/HAL/STM32F1/eeprom_if_iic.cpp +++ b/Marlin/src/HAL/STM32F1/eeprom/eeprom_if_iic.cpp @@ -27,12 +27,12 @@ #ifdef __STM32F1__ -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if ENABLED(IIC_BL24CXX_EEPROM) -#include "../../libs/BL24CXX.h" -#include "../shared/eeprom_if.h" +#include "../../../libs/BL24CXX.h" +#include "../../shared/eeprom_if.h" void eeprom_init() { BL24CXX::init(); } diff --git a/Marlin/src/HAL/STM32F1/eeprom_sdcard.cpp b/Marlin/src/HAL/STM32F1/eeprom/eeprom_sdcard.cpp similarity index 96% rename from Marlin/src/HAL/STM32F1/eeprom_sdcard.cpp rename to Marlin/src/HAL/STM32F1/eeprom/eeprom_sdcard.cpp index 6b72193422..4d28ce8e0a 100644 --- a/Marlin/src/HAL/STM32F1/eeprom_sdcard.cpp +++ b/Marlin/src/HAL/STM32F1/eeprom/eeprom_sdcard.cpp @@ -27,12 +27,12 @@ #ifdef __STM32F1__ -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if ENABLED(SDCARD_EEPROM_EMULATION) -#include "../shared/eeprom_api.h" -#include "../../sd/cardreader.h" +#include "../../shared/eeprom_api.h" +#include "../../../sd/cardreader.h" #define EEPROM_FILENAME "eeprom.dat" diff --git a/Marlin/src/HAL/STM32F1/eeprom_wired.cpp b/Marlin/src/HAL/STM32F1/eeprom/eeprom_wired.cpp similarity index 95% rename from Marlin/src/HAL/STM32F1/eeprom_wired.cpp rename to Marlin/src/HAL/STM32F1/eeprom/eeprom_wired.cpp index bfb7718094..a1464ab983 100644 --- a/Marlin/src/HAL/STM32F1/eeprom_wired.cpp +++ b/Marlin/src/HAL/STM32F1/eeprom/eeprom_wired.cpp @@ -26,12 +26,12 @@ #ifdef __STM32F1__ -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if USE_WIRED_EEPROM -#include "../shared/eeprom_if.h" -#include "../shared/eeprom_api.h" +#include "../../shared/eeprom_if.h" +#include "../../shared/eeprom_api.h" #ifndef MARLIN_EEPROM_SIZE #error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM." diff --git a/platformio.ini b/platformio.ini index d69fdc6cea..4d03696b5a 100644 --- a/platformio.ini +++ b/platformio.ini @@ -78,6 +78,7 @@ default_src_filter = + - - - - - + - - - - From f60bc278fa14abc7d7fabf79a8ac9335a1a764b4 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 26 Apr 2025 17:21:41 -0500 Subject: [PATCH 63/86] =?UTF-8?q?=F0=9F=A9=B9=20Misc.=20HAL,=20flag=20fixe?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/DUE/usb/sd_mmc_spi_mem.cpp | 11 ++++++----- Marlin/src/HAL/LPC1768/HAL.cpp | 9 ++------- Marlin/src/HAL/LPC1768/eeprom/eeprom_sdcard.cpp | 2 +- Marlin/src/HAL/RP2040/HAL.cpp | 2 +- Marlin/src/HAL/STM32/HAL.cpp | 2 +- Marlin/src/HAL/STM32/usb_serial.cpp | 4 ++-- Marlin/src/HAL/STM32F1/HAL.cpp | 3 ++- Marlin/src/sd/usb_flashdrive/lib-uhs2/usbhost.cpp | 2 +- ini/stm32f1-maple.ini | 2 +- ini/stm32f1.ini | 9 +++++---- 10 files changed, 22 insertions(+), 24 deletions(-) diff --git a/Marlin/src/HAL/DUE/usb/sd_mmc_spi_mem.cpp b/Marlin/src/HAL/DUE/usb/sd_mmc_spi_mem.cpp index ff6ff4859b..74cfd9b39b 100644 --- a/Marlin/src/HAL/DUE/usb/sd_mmc_spi_mem.cpp +++ b/Marlin/src/HAL/DUE/usb/sd_mmc_spi_mem.cpp @@ -29,11 +29,10 @@ bool sd_mmc_spi_wr_protect() { return false; } bool sd_mmc_spi_removal() { return !media_ready(); } Ctrl_status sd_mmc_spi_test_unit_ready() { - #ifdef DISABLE_DUE_SD_MMC + #if ENABLED(DISABLE_DUE_SD_MMC) return CTRL_NO_PRESENT; #endif - if (sd_mmc_spi_removal()) return CTRL_NO_PRESENT; - return CTRL_GOOD; + return sd_mmc_spi_removal() ? CTRL_NO_PRESENT : CTRL_GOOD; } // NOTE: This function is defined as returning the address of the last block @@ -58,9 +57,10 @@ uint8_t sector_buf[SD_MMC_BLOCK_SIZE]; // #define DEBUG_MMC Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) { - #ifdef DISABLE_DUE_SD_MMC + #if ENABLED(DISABLE_DUE_SD_MMC) return CTRL_NO_PRESENT; #endif + if (sd_mmc_spi_removal()) return CTRL_NO_PRESENT; #ifdef DEBUG_MMC @@ -97,9 +97,10 @@ Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) { } Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) { - #ifdef DISABLE_DUE_SD_MMC + #if ENABLED(DISABLE_DUE_SD_MMC) return CTRL_NO_PRESENT; #endif + if (sd_mmc_spi_removal()) return CTRL_NO_PRESENT; #ifdef DEBUG_MMC diff --git a/Marlin/src/HAL/LPC1768/HAL.cpp b/Marlin/src/HAL/LPC1768/HAL.cpp index 6e4357777d..4b0e255f37 100644 --- a/Marlin/src/HAL/LPC1768/HAL.cpp +++ b/Marlin/src/HAL/LPC1768/HAL.cpp @@ -173,13 +173,8 @@ void MarlinHAL::init() { // HAL idle task void MarlinHAL::idletask() { #if HAS_SHARED_MEDIA - // If Marlin is using the SD card we need to lock it to prevent access from - // a PC via USB. - // Other HALs use card.isStillPrinting() and card.isFileOpen() to check for access but - // this will not reliably detect delete operations. To be safe we will lock - // the disk if Marlin has it mounted. Unfortunately there is currently no way - // to unmount the disk from the LCD menu. - // if (card.isStillPrinting() || card.isFileOpen()) + // When Marlin is using the SD Card it must be locked to prevent PC access via USB. + // For maximum safety we lock the disk if Marlin has it mounted for any reason. if (card.isMounted()) MSC_Aquire_Lock(); else diff --git a/Marlin/src/HAL/LPC1768/eeprom/eeprom_sdcard.cpp b/Marlin/src/HAL/LPC1768/eeprom/eeprom_sdcard.cpp index 3500f3e7cf..5bf2d353b6 100644 --- a/Marlin/src/HAL/LPC1768/eeprom/eeprom_sdcard.cpp +++ b/Marlin/src/HAL/LPC1768/eeprom/eeprom_sdcard.cpp @@ -52,7 +52,6 @@ bool eeprom_file_open = false; size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; } bool PersistentStore::access_start() { - const char eeprom_erase_value = 0xFF; MSC_Aquire_Lock(); if (f_mount(&fat_fs, "", 1)) { MSC_Release_Lock(); @@ -65,6 +64,7 @@ bool PersistentStore::access_start() { UINT bytes_written; FSIZE_t file_size = f_size(&eeprom_file); f_lseek(&eeprom_file, file_size); + const char eeprom_erase_value = 0xFF; while (file_size < capacity() && res == FR_OK) { res = f_write(&eeprom_file, &eeprom_erase_value, 1, &bytes_written); file_size++; diff --git a/Marlin/src/HAL/RP2040/HAL.cpp b/Marlin/src/HAL/RP2040/HAL.cpp index ceaf540452..6e35fac938 100644 --- a/Marlin/src/HAL/RP2040/HAL.cpp +++ b/Marlin/src/HAL/RP2040/HAL.cpp @@ -77,7 +77,7 @@ void MarlinHAL::init() { HAL_timer_init(); - #if ENABLED(EMERGENCY_PARSER) && USBD_USE_CDC + #if ALL(EMERGENCY_PARSER, USBD_USE_CDC) USB_Hook_init(); #endif diff --git a/Marlin/src/HAL/STM32/HAL.cpp b/Marlin/src/HAL/STM32/HAL.cpp index 6bebaa24f0..a44c333096 100644 --- a/Marlin/src/HAL/STM32/HAL.cpp +++ b/Marlin/src/HAL/STM32/HAL.cpp @@ -87,7 +87,7 @@ void MarlinHAL::init() { SetTimerInterruptPriorities(); - #if ENABLED(EMERGENCY_PARSER) && (USBD_USE_CDC || USBD_USE_CDC_MSC) + #if ENABLED(EMERGENCY_PARSER) && ANY(USBD_USE_CDC, USBD_USE_CDC_MSC) USB_Hook_init(); #endif diff --git a/Marlin/src/HAL/STM32/usb_serial.cpp b/Marlin/src/HAL/STM32/usb_serial.cpp index 0b2372f3a7..1ca8b19976 100644 --- a/Marlin/src/HAL/STM32/usb_serial.cpp +++ b/Marlin/src/HAL/STM32/usb_serial.cpp @@ -26,7 +26,7 @@ #include "../../inc/MarlinConfigPre.h" -#if ENABLED(EMERGENCY_PARSER) && (USBD_USE_CDC || USBD_USE_CDC_MSC) +#if ENABLED(EMERGENCY_PARSER) && ANY(USBD_USE_CDC, USBD_USE_CDC_MSC) #include "usb_serial.h" #include "../../feature/e_parser.h" @@ -56,5 +56,5 @@ void USB_Hook_init() { USBD_CDC_fops.Receive = USBD_CDC_Receive_hook; } -#endif // EMERGENCY_PARSER && USBD_USE_CDC +#endif // EMERGENCY_PARSER && (USBD_USE_CDC || USBD_USE_CDC_MSC) #endif // HAL_STM32 diff --git a/Marlin/src/HAL/STM32F1/HAL.cpp b/Marlin/src/HAL/STM32F1/HAL.cpp index d5f4ade79d..4072e55652 100644 --- a/Marlin/src/HAL/STM32F1/HAL.cpp +++ b/Marlin/src/HAL/STM32F1/HAL.cpp @@ -65,7 +65,8 @@ uint16_t adc_results[ADC_COUNT]; emergency_parser.update(MSerial0.emergency_state, buf[i + total - len]); } #endif -#endif + +#endif // SERIAL_USB && !HAS_SD_HOST_DRIVE // ------------------------ // Watchdog Timer diff --git a/Marlin/src/sd/usb_flashdrive/lib-uhs2/usbhost.cpp b/Marlin/src/sd/usb_flashdrive/lib-uhs2/usbhost.cpp index fd3849d1ed..6f3d44dd7f 100644 --- a/Marlin/src/sd/usb_flashdrive/lib-uhs2/usbhost.cpp +++ b/Marlin/src/sd/usb_flashdrive/lib-uhs2/usbhost.cpp @@ -109,7 +109,7 @@ bool MAX3421e::start() { // Initialize pins and SPI bus SET_OUTPUT(USB_CS_PIN); - SET_INPUT_PULLUP(USB_INTR_PIN); + SET_INPUT_PULLUP(USB_INTR_PIN); // Active LOW ncs(); spiBegin(); diff --git a/ini/stm32f1-maple.ini b/ini/stm32f1-maple.ini index 0e77ff8dfa..ddd75549c8 100644 --- a/ini/stm32f1-maple.ini +++ b/ini/stm32f1-maple.ini @@ -219,7 +219,7 @@ board_build.address = 0x08010000 board_build.rename = project.bin board_build.ldscript = STM32F103VE_longer.ld build_flags = ${STM32F1_maple.build_flags} - -DMCU_STM32F103VE -DSTM32F1xx -USERIAL_USB -DU20 -DTS_V12 + -DMCU_STM32F103VE -DSTM32F1xx -DSERIAL_USB -DU20 -DTS_V12 build_unflags = ${STM32F1_maple.build_unflags} -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DERROR_LED_PORT=GPIOE -DERROR_LED_PIN=6 diff --git a/ini/stm32f1.ini b/ini/stm32f1.ini index ed60983a23..58b33afaaf 100644 --- a/ini/stm32f1.ini +++ b/ini/stm32f1.ini @@ -64,13 +64,14 @@ board_build.offset = 0x7000 board_upload.offset_address = 0x08007000 [USBD_CDC_MSC] -build_flags = -DUSE_USB_FS -DUSBD_USE_CDC_MSC -DUSBD_IRQ_PRIO=5 -DUSBD_IRQ_SUBPRIO=6 +build_flags = -DUSE_USB_FS -DUSBD_USE_CDC_MSC -DUSBD_IRQ_PRIO=5 -DUSBD_IRQ_SUBPRIO=6 +build_unflags = -DUSBD_USE_CDC [env:STM32F103RC_btt_USB] extends = env:STM32F103RC_btt platform_packages = ${stm_flash_drive.platform_packages} build_flags = ${env:STM32F103RC_btt.build_flags} ${USBD_CDC_MSC.build_flags} -build_unflags = ${env:STM32F103RC_btt.build_unflags} -DUSBD_USE_CDC +build_unflags = ${env:STM32F103RC_btt.build_unflags} ${USBD_CDC_MSC.build_unflags} # # Panda Pi V2.9 - Standalone (STM32F103RC) @@ -227,7 +228,7 @@ upload_protocol = jlink extends = env:STM32F103RE_btt platform_packages = ${stm_flash_drive.platform_packages} build_flags = ${env:STM32F103RE_btt.build_flags} ${USBD_CDC_MSC.build_flags} -build_unflags = ${env:STM32F103RE_btt.build_unflags} -DUSBD_USE_CDC +build_unflags = ${env:STM32F103RE_btt.build_unflags} ${USBD_CDC_MSC.build_unflags} # # ZNP Robin Nano V1.2 @@ -473,7 +474,7 @@ board_upload.maximum_size = 237568 extra_scripts = ${stm32_variant.extra_scripts} build_flags = ${stm32_variant.build_flags} ${USBD_CDC_MSC.build_flags} -DSS_TIMER=4 -DTIMER_SERVO=TIM5 -build_unflags = ${stm32_variant.build_unflags} -DUSBD_USE_CDC +build_unflags = ${stm32_variant.build_unflags} ${USBD_CDC_MSC.build_unflags} [env:STM32F103RC_ZM3E2_USB] extends = ZONESTAR_ZM3E From 75d60b77bac5300e38725c0aae6f788b70ef085b Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sun, 27 Apr 2025 00:37:52 +0000 Subject: [PATCH 64/86] [cron] Bump distribution date (2025-04-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 c96f304a03..d48398ed22 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 "2025-04-25" +//#define STRING_DISTRIBUTION_DATE "2025-04-27" /** * The protocol for communication to the host. Protocol indicates communication diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 43e63deb20..f3a12580c9 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 "2025-04-25" + #define STRING_DISTRIBUTION_DATE "2025-04-27" #endif /** From 4d8f82df328016c1b325520d9af10d25e3a86aee Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 27 Apr 2025 15:02:58 -0500 Subject: [PATCH 65/86] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Organ?= =?UTF-8?q?ize=20some=20HAL=20code?= 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/DUE/usb/ctrl_access.c | 4 ++-- Marlin/src/HAL/ESP32/HAL.cpp | 10 ++++------ Marlin/src/HAL/ESP32/HAL.h | 8 +++----- Marlin/src/HAL/ESP32/u8g_esp32_spi.cpp | 2 +- Marlin/src/HAL/ESP32/{ => wifi}/WebSocketSerial.cpp | 2 +- Marlin/src/HAL/ESP32/{ => wifi}/WebSocketSerial.h | 4 ++-- Marlin/src/HAL/ESP32/{ => wifi}/ota.cpp | 2 +- Marlin/src/HAL/ESP32/{ => wifi}/ota.h | 0 Marlin/src/HAL/ESP32/{ => wifi}/spiffs.cpp | 4 ++-- Marlin/src/HAL/ESP32/{ => wifi}/spiffs.h | 0 Marlin/src/HAL/ESP32/{ => wifi}/web.cpp | 4 ++-- Marlin/src/HAL/ESP32/{ => wifi}/web.h | 0 Marlin/src/HAL/ESP32/{ => wifi}/wifi.cpp | 4 ++-- Marlin/src/HAL/ESP32/{ => wifi}/wifi.h | 0 Marlin/src/HAL/GD32_MFL/{ => sd}/SDCard.cpp | 6 +++--- Marlin/src/HAL/GD32_MFL/{ => sd}/SDCard.h | 4 ++-- Marlin/src/HAL/GD32_MFL/{ => sd}/sdio.cpp | 6 ++---- Marlin/src/HAL/GD32_MFL/{ => sd}/sdio.h | 0 Marlin/src/HAL/HAL.h | 2 +- Marlin/src/HAL/LINUX/HAL.h | 2 +- Marlin/src/HAL/LINUX/arduino.cpp | 2 -- Marlin/src/HAL/LINUX/include/Arduino.h | 1 - Marlin/src/HAL/NATIVE_SIM/HAL.h | 2 +- Marlin/src/HAL/RP2040/HAL.cpp | 2 +- Marlin/src/HAL/RP2040/HAL.h | 2 +- Marlin/src/HAL/STM32/HAL.cpp | 6 +++--- Marlin/src/HAL/STM32/HAL.h | 8 ++------ Marlin/src/HAL/STM32/{ => sd}/msc_sd.cpp | 11 +++++------ Marlin/src/HAL/STM32/{ => sd}/msc_sd.h | 0 Marlin/src/HAL/STM32/{ => sd}/usb_host.cpp | 9 ++++----- Marlin/src/HAL/STM32/{ => sd}/usb_host.h | 0 Marlin/src/HAL/STM32F1/HAL.cpp | 2 +- Marlin/src/HAL/STM32F1/HAL.h | 2 +- Marlin/src/HAL/STM32F1/{ => sd}/msc_sd.cpp | 9 +++++---- Marlin/src/HAL/STM32F1/{ => sd}/msc_sd.h | 4 ++-- Marlin/src/HAL/STM32F1/{ => sd}/onboard_sd.cpp | 6 +++--- Marlin/src/HAL/STM32F1/{ => sd}/onboard_sd.h | 0 Marlin/src/HAL/STM32F1/{ => sd}/sdio.cpp | 6 +++--- Marlin/src/HAL/STM32F1/{ => sd}/sdio.h | 2 +- Marlin/src/HAL/shared/math_32bit.h | 1 + Marlin/src/inc/MarlinConfig.h | 1 - Marlin/src/inc/MarlinConfigPre-6-type.h | 1 - Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp | 6 +++--- Marlin/src/sd/usb_flashdrive/lib-uhs2/Usb.cpp | 4 ++-- Marlin/src/sd/usb_flashdrive/lib-uhs2/masstorage.cpp | 4 ++-- Marlin/src/sd/usb_flashdrive/lib-uhs2/message.cpp | 4 ++-- Marlin/src/sd/usb_flashdrive/lib-uhs2/parsetools.cpp | 4 ++-- Marlin/src/sd/usb_flashdrive/lib-uhs2/usbhost.cpp | 4 ++-- 49 files changed, 77 insertions(+), 92 deletions(-) rename Marlin/src/HAL/ESP32/{ => wifi}/WebSocketSerial.cpp (99%) rename Marlin/src/HAL/ESP32/{ => wifi}/WebSocketSerial.h (96%) rename Marlin/src/HAL/ESP32/{ => wifi}/ota.cpp (98%) rename Marlin/src/HAL/ESP32/{ => wifi}/ota.h (100%) rename Marlin/src/HAL/ESP32/{ => wifi}/spiffs.cpp (94%) rename Marlin/src/HAL/ESP32/{ => wifi}/spiffs.h (100%) rename Marlin/src/HAL/ESP32/{ => wifi}/web.cpp (94%) rename Marlin/src/HAL/ESP32/{ => wifi}/web.h (100%) rename Marlin/src/HAL/ESP32/{ => wifi}/wifi.cpp (96%) rename Marlin/src/HAL/ESP32/{ => wifi}/wifi.h (100%) rename Marlin/src/HAL/GD32_MFL/{ => sd}/SDCard.cpp (99%) rename Marlin/src/HAL/GD32_MFL/{ => sd}/SDCard.h (99%) rename Marlin/src/HAL/GD32_MFL/{ => sd}/sdio.cpp (98%) rename Marlin/src/HAL/GD32_MFL/{ => sd}/sdio.h (100%) rename Marlin/src/HAL/STM32/{ => sd}/msc_sd.cpp (96%) rename Marlin/src/HAL/STM32/{ => sd}/msc_sd.h (100%) rename Marlin/src/HAL/STM32/{ => sd}/usb_host.cpp (96%) rename Marlin/src/HAL/STM32/{ => sd}/usb_host.h (100%) rename Marlin/src/HAL/STM32F1/{ => sd}/msc_sd.cpp (96%) rename Marlin/src/HAL/STM32F1/{ => sd}/msc_sd.h (93%) rename Marlin/src/HAL/STM32F1/{ => sd}/onboard_sd.cpp (99%) rename Marlin/src/HAL/STM32F1/{ => sd}/onboard_sd.h (100%) rename Marlin/src/HAL/STM32F1/{ => sd}/sdio.cpp (98%) rename Marlin/src/HAL/STM32F1/{ => sd}/sdio.h (98%) diff --git a/Marlin/src/HAL/AVR/HAL.h b/Marlin/src/HAL/AVR/HAL.h index b420236956..e7a82a3b83 100644 --- a/Marlin/src/HAL/AVR/HAL.h +++ b/Marlin/src/HAL/AVR/HAL.h @@ -204,7 +204,7 @@ public: static void isr_on() { sei(); } static void isr_off() { cli(); } - static void delay_ms(const int ms) { _delay_ms(ms); } + static void delay_ms(const int ms) { delay(ms); } // Tasks, called from idle() static void idletask() {} diff --git a/Marlin/src/HAL/DUE/usb/ctrl_access.c b/Marlin/src/HAL/DUE/usb/ctrl_access.c index b766ed1273..ec0e4adc4b 100644 --- a/Marlin/src/HAL/DUE/usb/ctrl_access.c +++ b/Marlin/src/HAL/DUE/usb/ctrl_access.c @@ -63,8 +63,8 @@ #include "compiler.h" #include "preprocessor.h" #ifdef FREERTOS_USED -#include "FreeRTOS.h" -#include "semphr.h" +#include +#include #endif #include "ctrl_access.h" diff --git a/Marlin/src/HAL/ESP32/HAL.cpp b/Marlin/src/HAL/ESP32/HAL.cpp index 415e2510e2..705b856aaa 100644 --- a/Marlin/src/HAL/ESP32/HAL.cpp +++ b/Marlin/src/HAL/ESP32/HAL.cpp @@ -34,13 +34,13 @@ #if ENABLED(WIFISUPPORT) #include - #include "wifi.h" + #include "wifi/wifi.h" #if ENABLED(OTASUPPORT) - #include "ota.h" + #include "wifi/ota.h" #endif #if ENABLED(WEBSUPPORT) - #include "spiffs.h" - #include "web.h" + #include "wifi/spiffs.h" + #include "wifi/web.h" #endif #endif @@ -175,8 +175,6 @@ uint8_t MarlinHAL::get_reset_source() { return rtc_get_reset_reason(1); } void MarlinHAL::reboot() { ESP.restart(); } -void _delay_ms(const int ms) { delay(ms); } - // return free memory between end of heap (or end bss) and whatever is current int MarlinHAL::freeMemory() { return ESP.getFreeHeap(); } diff --git a/Marlin/src/HAL/ESP32/HAL.h b/Marlin/src/HAL/ESP32/HAL.h index 0acb3676a2..baa03d8a76 100644 --- a/Marlin/src/HAL/ESP32/HAL.h +++ b/Marlin/src/HAL/ESP32/HAL.h @@ -37,11 +37,11 @@ #include "i2s.h" #if ENABLED(WIFISUPPORT) - #include "WebSocketSerial.h" + #include "wifi/WebSocketSerial.h" #endif #if ENABLED(ESP3D_WIFISUPPORT) - #include "esp3dlib.h" + #include #endif #include "FlushableHardwareSerial.h" @@ -165,8 +165,6 @@ int freeMemory(); #pragma GCC diagnostic pop -void _delay_ms(const int ms); - // ------------------------ // MarlinHAL Class // ------------------------ @@ -194,7 +192,7 @@ public: static void isr_on() { if (spinlock.owner != portMUX_FREE_VAL) portEXIT_CRITICAL(&spinlock); } static void isr_off() { portENTER_CRITICAL(&spinlock); } - static void delay_ms(const int ms) { _delay_ms(ms); } + static void delay_ms(const int ms) { delay(ms); } // Tasks, called from idle() static void idletask(); diff --git a/Marlin/src/HAL/ESP32/u8g_esp32_spi.cpp b/Marlin/src/HAL/ESP32/u8g_esp32_spi.cpp index a4c1980adc..42903da9d3 100644 --- a/Marlin/src/HAL/ESP32/u8g_esp32_spi.cpp +++ b/Marlin/src/HAL/ESP32/u8g_esp32_spi.cpp @@ -35,7 +35,7 @@ #if HAS_MEDIA #include "../../sd/cardreader.h" #if ENABLED(ESP3D_WIFISUPPORT) - #include "sd_ESP32.h" + #include #endif #endif diff --git a/Marlin/src/HAL/ESP32/WebSocketSerial.cpp b/Marlin/src/HAL/ESP32/wifi/WebSocketSerial.cpp similarity index 99% rename from Marlin/src/HAL/ESP32/WebSocketSerial.cpp rename to Marlin/src/HAL/ESP32/wifi/WebSocketSerial.cpp index eb5b9d6039..9c8933289d 100644 --- a/Marlin/src/HAL/ESP32/WebSocketSerial.cpp +++ b/Marlin/src/HAL/ESP32/wifi/WebSocketSerial.cpp @@ -21,7 +21,7 @@ */ #ifdef ARDUINO_ARCH_ESP32 -#include "../../inc/MarlinConfigPre.h" +#include "../../../inc/MarlinConfigPre.h" #if ENABLED(WIFISUPPORT) diff --git a/Marlin/src/HAL/ESP32/WebSocketSerial.h b/Marlin/src/HAL/ESP32/wifi/WebSocketSerial.h similarity index 96% rename from Marlin/src/HAL/ESP32/WebSocketSerial.h rename to Marlin/src/HAL/ESP32/wifi/WebSocketSerial.h index 6b3e419d10..3d2fdf1e6a 100644 --- a/Marlin/src/HAL/ESP32/WebSocketSerial.h +++ b/Marlin/src/HAL/ESP32/wifi/WebSocketSerial.h @@ -21,8 +21,8 @@ */ #pragma once -#include "../../inc/MarlinConfig.h" -#include "../../core/serial_hook.h" +#include "../../../inc/MarlinConfig.h" +#include "../../../core/serial_hook.h" #include diff --git a/Marlin/src/HAL/ESP32/ota.cpp b/Marlin/src/HAL/ESP32/wifi/ota.cpp similarity index 98% rename from Marlin/src/HAL/ESP32/ota.cpp rename to Marlin/src/HAL/ESP32/wifi/ota.cpp index be5847b831..03508840a5 100644 --- a/Marlin/src/HAL/ESP32/ota.cpp +++ b/Marlin/src/HAL/ESP32/wifi/ota.cpp @@ -27,7 +27,7 @@ #undef ENABLED #undef DISABLED -#include "../../inc/MarlinConfigPre.h" +#include "../../../inc/MarlinConfigPre.h" #if ALL(WIFISUPPORT, OTASUPPORT) diff --git a/Marlin/src/HAL/ESP32/ota.h b/Marlin/src/HAL/ESP32/wifi/ota.h similarity index 100% rename from Marlin/src/HAL/ESP32/ota.h rename to Marlin/src/HAL/ESP32/wifi/ota.h diff --git a/Marlin/src/HAL/ESP32/spiffs.cpp b/Marlin/src/HAL/ESP32/wifi/spiffs.cpp similarity index 94% rename from Marlin/src/HAL/ESP32/spiffs.cpp rename to Marlin/src/HAL/ESP32/wifi/spiffs.cpp index 043ad7849a..ba891acda9 100644 --- a/Marlin/src/HAL/ESP32/spiffs.cpp +++ b/Marlin/src/HAL/ESP32/wifi/spiffs.cpp @@ -21,11 +21,11 @@ */ #ifdef ARDUINO_ARCH_ESP32 -#include "../../inc/MarlinConfigPre.h" +#include "../../../inc/MarlinConfigPre.h" #if ALL(WIFISUPPORT, WEBSUPPORT) -#include "../../core/serial.h" +#include "../../../core/serial.h" #include #include diff --git a/Marlin/src/HAL/ESP32/spiffs.h b/Marlin/src/HAL/ESP32/wifi/spiffs.h similarity index 100% rename from Marlin/src/HAL/ESP32/spiffs.h rename to Marlin/src/HAL/ESP32/wifi/spiffs.h diff --git a/Marlin/src/HAL/ESP32/web.cpp b/Marlin/src/HAL/ESP32/wifi/web.cpp similarity index 94% rename from Marlin/src/HAL/ESP32/web.cpp rename to Marlin/src/HAL/ESP32/wifi/web.cpp index 63a101595f..f08dfd87c0 100644 --- a/Marlin/src/HAL/ESP32/web.cpp +++ b/Marlin/src/HAL/ESP32/wifi/web.cpp @@ -21,11 +21,11 @@ */ #ifdef ARDUINO_ARCH_ESP32 -#include "../../inc/MarlinConfigPre.h" +#include "../../../inc/MarlinConfigPre.h" #if ALL(WIFISUPPORT, WEBSUPPORT) -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #undef DISABLED // esp32-hal-gpio.h #include diff --git a/Marlin/src/HAL/ESP32/web.h b/Marlin/src/HAL/ESP32/wifi/web.h similarity index 100% rename from Marlin/src/HAL/ESP32/web.h rename to Marlin/src/HAL/ESP32/wifi/web.h diff --git a/Marlin/src/HAL/ESP32/wifi.cpp b/Marlin/src/HAL/ESP32/wifi/wifi.cpp similarity index 96% rename from Marlin/src/HAL/ESP32/wifi.cpp rename to Marlin/src/HAL/ESP32/wifi/wifi.cpp index aa2796adea..1f31ca1bb9 100644 --- a/Marlin/src/HAL/ESP32/wifi.cpp +++ b/Marlin/src/HAL/ESP32/wifi/wifi.cpp @@ -21,11 +21,11 @@ */ #ifdef ARDUINO_ARCH_ESP32 -#include "../../inc/MarlinConfigPre.h" +#include "../../../inc/MarlinConfigPre.h" #if ENABLED(WIFISUPPORT) -#include "../../core/serial.h" +#include "../../../core/serial.h" #include #include diff --git a/Marlin/src/HAL/ESP32/wifi.h b/Marlin/src/HAL/ESP32/wifi/wifi.h similarity index 100% rename from Marlin/src/HAL/ESP32/wifi.h rename to Marlin/src/HAL/ESP32/wifi/wifi.h diff --git a/Marlin/src/HAL/GD32_MFL/SDCard.cpp b/Marlin/src/HAL/GD32_MFL/sd/SDCard.cpp similarity index 99% rename from Marlin/src/HAL/GD32_MFL/SDCard.cpp rename to Marlin/src/HAL/GD32_MFL/sd/SDCard.cpp index 15d33d2596..c46e0fc6fb 100644 --- a/Marlin/src/HAL/GD32_MFL/SDCard.cpp +++ b/Marlin/src/HAL/GD32_MFL/sd/SDCard.cpp @@ -15,12 +15,12 @@ // If not, see . // -#include "../platforms.h" +#include "../../platforms.h" #ifdef ARDUINO_ARCH_MFL -#include "../../inc/MarlinConfig.h" -#include "../shared/Delay.h" +#include "../../../inc/MarlinConfig.h" +#include "../../shared/Delay.h" #include "SDCard.h" #include diff --git a/Marlin/src/HAL/GD32_MFL/SDCard.h b/Marlin/src/HAL/GD32_MFL/sd/SDCard.h similarity index 99% rename from Marlin/src/HAL/GD32_MFL/SDCard.h rename to Marlin/src/HAL/GD32_MFL/sd/SDCard.h index 467482a605..e202be6eb5 100644 --- a/Marlin/src/HAL/GD32_MFL/SDCard.h +++ b/Marlin/src/HAL/GD32_MFL/sd/SDCard.h @@ -16,9 +16,9 @@ // #pragma once -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" -#include "SDIO.hpp" +#include namespace sdio { diff --git a/Marlin/src/HAL/GD32_MFL/sdio.cpp b/Marlin/src/HAL/GD32_MFL/sd/sdio.cpp similarity index 98% rename from Marlin/src/HAL/GD32_MFL/sdio.cpp rename to Marlin/src/HAL/GD32_MFL/sd/sdio.cpp index 4b6d75d74f..69905feb51 100644 --- a/Marlin/src/HAL/GD32_MFL/sdio.cpp +++ b/Marlin/src/HAL/GD32_MFL/sd/sdio.cpp @@ -20,11 +20,11 @@ * */ -#include "../platforms.h" +#include "../../platforms.h" #ifdef ARDUINO_ARCH_MFL -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if ENABLED(ONBOARD_SDIO) @@ -215,7 +215,6 @@ void DMA1_IRQHandler() { } } - extern "C" { void SDIO_IRQHandler(void) { @@ -228,6 +227,5 @@ extern "C" { } // extern "C" - #endif // ONBOARD_SDIO #endif // ARDUINO_ARCH_MFL diff --git a/Marlin/src/HAL/GD32_MFL/sdio.h b/Marlin/src/HAL/GD32_MFL/sd/sdio.h similarity index 100% rename from Marlin/src/HAL/GD32_MFL/sdio.h rename to Marlin/src/HAL/GD32_MFL/sd/sdio.h diff --git a/Marlin/src/HAL/HAL.h b/Marlin/src/HAL/HAL.h index f3e16cfdf1..a211dfe259 100644 --- a/Marlin/src/HAL/HAL.h +++ b/Marlin/src/HAL/HAL.h @@ -27,7 +27,7 @@ #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #endif -#include HAL_PATH(..,HAL.h) +#include HAL_PATH(.., HAL.h) extern MarlinHAL hal; #define HAL_ADC_RANGE _BV(HAL_ADC_RESOLUTION) diff --git a/Marlin/src/HAL/LINUX/HAL.h b/Marlin/src/HAL/LINUX/HAL.h index bb5fb73e05..68e0e1062c 100644 --- a/Marlin/src/HAL/LINUX/HAL.h +++ b/Marlin/src/HAL/LINUX/HAL.h @@ -124,7 +124,7 @@ public: static void isr_on() {} static void isr_off() {} - static void delay_ms(const int ms) { _delay_ms(ms); } + static void delay_ms(const int ms) { delay(ms); } // Tasks, called from idle() static void idletask() {} diff --git a/Marlin/src/HAL/LINUX/arduino.cpp b/Marlin/src/HAL/LINUX/arduino.cpp index a387a9623e..0a09a11091 100644 --- a/Marlin/src/HAL/LINUX/arduino.cpp +++ b/Marlin/src/HAL/LINUX/arduino.cpp @@ -31,8 +31,6 @@ void cli() { } // Disable void sei() { } // Enable // Time functions -void _delay_ms(const int ms) { delay(ms); } - unsigned long millis() { return (unsigned long)Clock::millis(); } diff --git a/Marlin/src/HAL/LINUX/include/Arduino.h b/Marlin/src/HAL/LINUX/include/Arduino.h index b11e75ccbc..87148a40b2 100644 --- a/Marlin/src/HAL/LINUX/include/Arduino.h +++ b/Marlin/src/HAL/LINUX/include/Arduino.h @@ -74,7 +74,6 @@ extern "C" { // Time functions extern "C" void delay(const int ms); -void _delay_ms(const int ms); void delayMicroseconds(unsigned long); unsigned long millis(); diff --git a/Marlin/src/HAL/NATIVE_SIM/HAL.h b/Marlin/src/HAL/NATIVE_SIM/HAL.h index ffede7ef34..661c502f22 100644 --- a/Marlin/src/HAL/NATIVE_SIM/HAL.h +++ b/Marlin/src/HAL/NATIVE_SIM/HAL.h @@ -195,7 +195,7 @@ public: static void isr_on() {} static void isr_off() {} - static void delay_ms(const int ms) { _delay_ms(ms); } + static void delay_ms(const int ms) { delay(ms); } // Tasks, called from idle() static void idletask(); diff --git a/Marlin/src/HAL/RP2040/HAL.cpp b/Marlin/src/HAL/RP2040/HAL.cpp index 6e35fac938..8c35d45542 100644 --- a/Marlin/src/HAL/RP2040/HAL.cpp +++ b/Marlin/src/HAL/RP2040/HAL.cpp @@ -87,7 +87,7 @@ void MarlinHAL::init() { #if PIN_EXISTS(USB_CONNECT) OUT_WRITE(USB_CONNECT_PIN, !USB_CONNECT_INVERTING); // USB clear connection - delay_ms(1000); // Give OS time to notice + delay_ms(1000); // Give OS time to notice WRITE(USB_CONNECT_PIN, USB_CONNECT_INVERTING); #endif } diff --git a/Marlin/src/HAL/RP2040/HAL.h b/Marlin/src/HAL/RP2040/HAL.h index fbd3b61e1c..4862986d11 100644 --- a/Marlin/src/HAL/RP2040/HAL.h +++ b/Marlin/src/HAL/RP2040/HAL.h @@ -139,7 +139,7 @@ public: static void isr_on() { __enable_irq(); } static void isr_off() { __disable_irq(); } - static void delay_ms(const int ms) { ::delay(ms); } + static void delay_ms(const int ms) { delay(ms); } // Tasks, called from idle() static void idletask() {} diff --git a/Marlin/src/HAL/STM32/HAL.cpp b/Marlin/src/HAL/STM32/HAL.cpp index a44c333096..bdccdd546d 100644 --- a/Marlin/src/HAL/STM32/HAL.cpp +++ b/Marlin/src/HAL/STM32/HAL.cpp @@ -43,8 +43,8 @@ #endif #if HAS_SD_HOST_DRIVE - #include "msc_sd.h" - #include "usbd_cdc_if.h" + #include "sd/msc_sd.h" + #include #endif // ------------------------ @@ -97,7 +97,7 @@ void MarlinHAL::init() { #if PIN_EXISTS(USB_CONNECT) OUT_WRITE(USB_CONNECT_PIN, !USB_CONNECT_INVERTING); // USB clear connection - delay(1000); // Give OS time to notice + delay_ms(1000); // Give OS time to notice WRITE(USB_CONNECT_PIN, USB_CONNECT_INVERTING); #endif } diff --git a/Marlin/src/HAL/STM32/HAL.h b/Marlin/src/HAL/STM32/HAL.h index f43413fcd9..a8ef51bcfc 100644 --- a/Marlin/src/HAL/STM32/HAL.h +++ b/Marlin/src/HAL/STM32/HAL.h @@ -23,18 +23,14 @@ #define CPU_32_BIT -#include "../../core/macros.h" -#include "../shared/Marduino.h" +#include "../../inc/MarlinConfigPre.h" + #include "../shared/math_32bit.h" #include "../shared/HAL_SPI.h" #include "temp_soc.h" #include "fastio.h" #include "Servo.h" -#include "../../inc/MarlinConfigPre.h" - -#include - // // Default graphical display delays // diff --git a/Marlin/src/HAL/STM32/msc_sd.cpp b/Marlin/src/HAL/STM32/sd/msc_sd.cpp similarity index 96% rename from Marlin/src/HAL/STM32/msc_sd.cpp rename to Marlin/src/HAL/STM32/sd/msc_sd.cpp index d4afc5990a..f198b3e49a 100644 --- a/Marlin/src/HAL/STM32/msc_sd.cpp +++ b/Marlin/src/HAL/STM32/sd/msc_sd.cpp @@ -20,20 +20,19 @@ * along with this program. If not, see . * */ -#include "../platforms.h" +#include "../../platforms.h" #ifdef HAL_STM32 -#include "../../inc/MarlinConfigPre.h" +#include "../../../inc/MarlinConfigPre.h" #if HAS_SD_HOST_DRIVE -#include "../shared/Marduino.h" +#include "../../../sd/cardreader.h" + #include "msc_sd.h" -#include "usbd_core.h" - -#include "../../sd/cardreader.h" +#include #include #include diff --git a/Marlin/src/HAL/STM32/msc_sd.h b/Marlin/src/HAL/STM32/sd/msc_sd.h similarity index 100% rename from Marlin/src/HAL/STM32/msc_sd.h rename to Marlin/src/HAL/STM32/sd/msc_sd.h diff --git a/Marlin/src/HAL/STM32/usb_host.cpp b/Marlin/src/HAL/STM32/sd/usb_host.cpp similarity index 96% rename from Marlin/src/HAL/STM32/usb_host.cpp rename to Marlin/src/HAL/STM32/sd/usb_host.cpp index afafe1d4f3..f411771c8a 100644 --- a/Marlin/src/HAL/STM32/usb_host.cpp +++ b/Marlin/src/HAL/STM32/sd/usb_host.cpp @@ -20,18 +20,17 @@ * */ -#include "../platforms.h" +#include "../../platforms.h" #ifdef HAL_STM32 -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if ALL(USE_OTG_USB_HOST, USBHOST) #include "usb_host.h" -#include "../shared/Marduino.h" -#include "usbh_core.h" -#include "usbh_msc.h" +#include +#include USBH_HandleTypeDef hUsbHost; USBHost usb; diff --git a/Marlin/src/HAL/STM32/usb_host.h b/Marlin/src/HAL/STM32/sd/usb_host.h similarity index 100% rename from Marlin/src/HAL/STM32/usb_host.h rename to Marlin/src/HAL/STM32/sd/usb_host.h diff --git a/Marlin/src/HAL/STM32F1/HAL.cpp b/Marlin/src/HAL/STM32F1/HAL.cpp index 4072e55652..b0f86ae4ed 100644 --- a/Marlin/src/HAL/STM32F1/HAL.cpp +++ b/Marlin/src/HAL/STM32F1/HAL.cpp @@ -253,7 +253,7 @@ void MarlinHAL::init() { #endif #if PIN_EXISTS(USB_CONNECT) OUT_WRITE(USB_CONNECT_PIN, !USB_CONNECT_INVERTING); // USB clear connection - delay(1000); // Give OS time to notice + delay_ms(1000); // Give OS time to notice WRITE(USB_CONNECT_PIN, USB_CONNECT_INVERTING); #endif TERN_(POSTMORTEM_DEBUGGING, install_min_serial()); // Install the minimal serial handler diff --git a/Marlin/src/HAL/STM32F1/HAL.h b/Marlin/src/HAL/STM32F1/HAL.h index daf94dceb5..68773bdf27 100644 --- a/Marlin/src/HAL/STM32F1/HAL.h +++ b/Marlin/src/HAL/STM32F1/HAL.h @@ -40,7 +40,7 @@ #include "../../inc/MarlinConfigPre.h" #if HAS_SD_HOST_DRIVE - #include "msc_sd.h" + #include "sd/msc_sd.h" #endif // ------------------------ diff --git a/Marlin/src/HAL/STM32F1/msc_sd.cpp b/Marlin/src/HAL/STM32F1/sd/msc_sd.cpp similarity index 96% rename from Marlin/src/HAL/STM32F1/msc_sd.cpp rename to Marlin/src/HAL/STM32F1/sd/msc_sd.cpp index 067b46eb8b..5f1ba30c8a 100644 --- a/Marlin/src/HAL/STM32F1/msc_sd.cpp +++ b/Marlin/src/HAL/STM32F1/sd/msc_sd.cpp @@ -22,20 +22,21 @@ */ #ifdef __STM32F1__ -#include "../../inc/MarlinConfigPre.h" +#include "../../../inc/MarlinConfigPre.h" #if HAS_SD_HOST_DRIVE #include "msc_sd.h" -#include "SPI.h" -#include "usb_reg_map.h" +#include "../SPI.h" + +#include #define PRODUCT_ID 0x29 USBMassStorage MarlinMSC; Serial1Class MarlinCompositeSerial(true); -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if SD_CONNECTION_IS(ONBOARD) diff --git a/Marlin/src/HAL/STM32F1/msc_sd.h b/Marlin/src/HAL/STM32F1/sd/msc_sd.h similarity index 93% rename from Marlin/src/HAL/STM32F1/msc_sd.h rename to Marlin/src/HAL/STM32F1/sd/msc_sd.h index 371211efc6..871d98eaf2 100644 --- a/Marlin/src/HAL/STM32F1/msc_sd.h +++ b/Marlin/src/HAL/STM32F1/sd/msc_sd.h @@ -24,8 +24,8 @@ #include -#include "../../inc/MarlinConfigPre.h" -#include "../../core/serial_hook.h" +#include "../../../inc/MarlinConfigPre.h" +#include "../../../core/serial_hook.h" extern USBMassStorage MarlinMSC; extern Serial1Class MarlinCompositeSerial; diff --git a/Marlin/src/HAL/STM32F1/onboard_sd.cpp b/Marlin/src/HAL/STM32F1/sd/onboard_sd.cpp similarity index 99% rename from Marlin/src/HAL/STM32F1/onboard_sd.cpp rename to Marlin/src/HAL/STM32F1/sd/onboard_sd.cpp index a3d8dcb2d5..ace1204b75 100644 --- a/Marlin/src/HAL/STM32F1/onboard_sd.cpp +++ b/Marlin/src/HAL/STM32F1/sd/onboard_sd.cpp @@ -13,13 +13,13 @@ #ifdef __STM32F1__ -#include "../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfig.h" #if SD_CONNECTION_IS(ONBOARD) #include "onboard_sd.h" -#include "SPI.h" -#include "fastio.h" +#include "../SPI.h" +#include "../fastio.h" #ifndef ONBOARD_SPI_DEVICE #define ONBOARD_SPI_DEVICE SPI_DEVICE diff --git a/Marlin/src/HAL/STM32F1/onboard_sd.h b/Marlin/src/HAL/STM32F1/sd/onboard_sd.h similarity index 100% rename from Marlin/src/HAL/STM32F1/onboard_sd.h rename to Marlin/src/HAL/STM32F1/sd/onboard_sd.h diff --git a/Marlin/src/HAL/STM32F1/sdio.cpp b/Marlin/src/HAL/STM32F1/sd/sdio.cpp similarity index 98% rename from Marlin/src/HAL/STM32F1/sdio.cpp rename to Marlin/src/HAL/STM32F1/sd/sdio.cpp index 258422eba3..d657fd3b0e 100644 --- a/Marlin/src/HAL/STM32F1/sdio.cpp +++ b/Marlin/src/HAL/STM32F1/sd/sdio.cpp @@ -19,11 +19,11 @@ * along with this program. If not, see . * */ -#ifdef ARDUINO_ARCH_STM32F1 +#ifdef __STM32F1__ #include -#include "../../inc/MarlinConfig.h" // Allow pins/pins.h to set density +#include "../../../inc/MarlinConfig.h" // Allow pins/pins.h to set density #if ANY(STM32_HIGH_DENSITY, STM32_XL_DENSITY) @@ -308,4 +308,4 @@ bool SDIO_GetCmdResp7() { } #endif // STM32_HIGH_DENSITY || STM32_XL_DENSITY -#endif // ARDUINO_ARCH_STM32F1 +#endif // __STM32F1__ diff --git a/Marlin/src/HAL/STM32F1/sdio.h b/Marlin/src/HAL/STM32F1/sd/sdio.h similarity index 98% rename from Marlin/src/HAL/STM32F1/sdio.h rename to Marlin/src/HAL/STM32F1/sd/sdio.h index 08c884666d..ffcd354915 100644 --- a/Marlin/src/HAL/STM32F1/sdio.h +++ b/Marlin/src/HAL/STM32F1/sd/sdio.h @@ -21,7 +21,7 @@ */ #pragma once -#include "../../inc/MarlinConfig.h" // Allow pins/pins.h to override SDIO clock / retries +#include "../../../inc/MarlinConfig.h" // Allow pins/pins.h to override SDIO clock / retries #include #include diff --git a/Marlin/src/HAL/shared/math_32bit.h b/Marlin/src/HAL/shared/math_32bit.h index 1fb233e3e8..daf82e0650 100644 --- a/Marlin/src/HAL/shared/math_32bit.h +++ b/Marlin/src/HAL/shared/math_32bit.h @@ -22,6 +22,7 @@ #pragma once #include "../../core/macros.h" +#include /** * Math helper functions for 32 bit CPUs diff --git a/Marlin/src/inc/MarlinConfig.h b/Marlin/src/inc/MarlinConfig.h index 0164b7c2f7..f962a5ff5c 100644 --- a/Marlin/src/inc/MarlinConfig.h +++ b/Marlin/src/inc/MarlinConfig.h @@ -25,7 +25,6 @@ // Prefix header for all Marlin sources // -#include "MarlinConfigPre-6-type.h" // Include even with __MARLIN_DEPS__ #include "Conditionals-6-type.h" #ifndef __MARLIN_DEPS__ diff --git a/Marlin/src/inc/MarlinConfigPre-6-type.h b/Marlin/src/inc/MarlinConfigPre-6-type.h index 31597c6eb8..09367219d9 100644 --- a/Marlin/src/inc/MarlinConfigPre-6-type.h +++ b/Marlin/src/inc/MarlinConfigPre-6-type.h @@ -21,7 +21,6 @@ */ #pragma once -#include "MarlinConfigPre-5-post.h" #include "Conditionals-5-post.h" #ifndef __MARLIN_DEPS__ diff --git a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp index e6e6f30ae6..8b25df16b9 100644 --- a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp +++ b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp @@ -84,10 +84,10 @@ #elif ENABLED(USE_OTG_USB_HOST) #if HAS_SD_HOST_DRIVE - #include HAL_PATH(../.., msc_sd.h) + #include HAL_PATH(../.., sd/msc_sd.h) #endif - #include HAL_PATH(../.., usb_host.h) + #include HAL_PATH(../.., sd/usb_host.h) #define UHS_START usb.start() #define rREVISION 0 @@ -293,7 +293,7 @@ uint32_t DiskIODriver_USBFlash::cardSize() { #if USB_DEBUG < 3 const uint32_t #endif - lun0_capacity = bulk.GetCapacity(0); + lun0_capacity = bulk.GetCapacity(0); return lun0_capacity; } diff --git a/Marlin/src/sd/usb_flashdrive/lib-uhs2/Usb.cpp b/Marlin/src/sd/usb_flashdrive/lib-uhs2/Usb.cpp index aa102e228f..6c45b7eee7 100644 --- a/Marlin/src/sd/usb_flashdrive/lib-uhs2/Usb.cpp +++ b/Marlin/src/sd/usb_flashdrive/lib-uhs2/Usb.cpp @@ -29,7 +29,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if HAS_USB_FLASH_DRIVE && DISABLED(USE_UHS3_USB) +#if ALL(HAS_USB_FLASH_DRIVE, USE_UHS2_USB) #include "Usb.h" @@ -792,4 +792,4 @@ uint8_t USB::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value) { return ctrlReq(addr, ep, bmREQ_SET, USB_REQUEST_SET_CONFIGURATION, conf_value, 0x00, 0x0000, 0x0000, 0x0000, nullptr, nullptr); } -#endif // HAS_USB_FLASH_DRIVE && !USE_UHS3_USB +#endif // HAS_USB_FLASH_DRIVE && USE_UHS2_USB diff --git a/Marlin/src/sd/usb_flashdrive/lib-uhs2/masstorage.cpp b/Marlin/src/sd/usb_flashdrive/lib-uhs2/masstorage.cpp index a6124ab0fe..c311d7f9dd 100644 --- a/Marlin/src/sd/usb_flashdrive/lib-uhs2/masstorage.cpp +++ b/Marlin/src/sd/usb_flashdrive/lib-uhs2/masstorage.cpp @@ -25,7 +25,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if HAS_USB_FLASH_DRIVE && DISABLED(USE_UHS3_USB) +#if ALL(HAS_USB_FLASH_DRIVE, USE_UHS2_USB) #include "masstorage.h" @@ -1204,4 +1204,4 @@ uint8_t BulkOnly::Read(uint8_t lun __attribute__((unused)), uint32_t addr __attr #endif } -#endif // HAS_USB_FLASH_DRIVE && !USE_UHS3_USB +#endif // HAS_USB_FLASH_DRIVE && USE_UHS2_USB diff --git a/Marlin/src/sd/usb_flashdrive/lib-uhs2/message.cpp b/Marlin/src/sd/usb_flashdrive/lib-uhs2/message.cpp index afe9e86e52..2984a6cf03 100644 --- a/Marlin/src/sd/usb_flashdrive/lib-uhs2/message.cpp +++ b/Marlin/src/sd/usb_flashdrive/lib-uhs2/message.cpp @@ -25,7 +25,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if HAS_USB_FLASH_DRIVE && DISABLED(USE_UHS3_USB) +#if ALL(HAS_USB_FLASH_DRIVE, USE_UHS2_USB) #include "Usb.h" @@ -125,4 +125,4 @@ void E_Notify(double d, int lvl) { #endif // DEBUG_USB_HOST -#endif // HAS_USB_FLASH_DRIVE && !USE_UHS3_USB +#endif // HAS_USB_FLASH_DRIVE && USE_UHS2_USB diff --git a/Marlin/src/sd/usb_flashdrive/lib-uhs2/parsetools.cpp b/Marlin/src/sd/usb_flashdrive/lib-uhs2/parsetools.cpp index 4b2ef4b1f9..ae34006742 100644 --- a/Marlin/src/sd/usb_flashdrive/lib-uhs2/parsetools.cpp +++ b/Marlin/src/sd/usb_flashdrive/lib-uhs2/parsetools.cpp @@ -25,7 +25,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if HAS_USB_FLASH_DRIVE && DISABLED(USE_UHS3_USB) +#if ALL(HAS_USB_FLASH_DRIVE, USE_UHS2_USB) #include "Usb.h" @@ -74,4 +74,4 @@ bool PTPListParser::Parse(uint8_t **pp, uint16_t *pcntdn, PTP_ARRAY_EL_FUNC pf, return true; } -#endif // HAS_USB_FLASH_DRIVE && !USE_UHS3_USB +#endif // HAS_USB_FLASH_DRIVE && USE_UHS2_USB diff --git a/Marlin/src/sd/usb_flashdrive/lib-uhs2/usbhost.cpp b/Marlin/src/sd/usb_flashdrive/lib-uhs2/usbhost.cpp index 6f3d44dd7f..47282bbd63 100644 --- a/Marlin/src/sd/usb_flashdrive/lib-uhs2/usbhost.cpp +++ b/Marlin/src/sd/usb_flashdrive/lib-uhs2/usbhost.cpp @@ -25,7 +25,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if HAS_USB_FLASH_DRIVE && DISABLED(USE_UHS3_USB) +#if ALL(HAS_USB_FLASH_DRIVE, USE_UHS2_USB) #if !PINS_EXIST(USB_CS, USB_INTR) #error "USB_FLASH_DRIVE_SUPPORT requires USB_CS_PIN and USB_INTR_PIN (or USE_UHS3_USB) to be defined." @@ -203,4 +203,4 @@ uint8_t MAX3421e::IntHandler() { return HIRQ_sendback; } -#endif // HAS_USB_FLASH_DRIVE && !USE_UHS3_USB +#endif // HAS_USB_FLASH_DRIVE && USE_UHS2_USB From 38d6d61912df9a5220acdffc4064b287b78dab90 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 27 Apr 2025 18:50:35 -0500 Subject: [PATCH 66/86] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20MSC?= =?UTF-8?q?=20for=20RP2040=20-=20alpha?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/RP2040/HAL.h | 8 +- Marlin/src/HAL/RP2040/HAL_MinSerial.cpp | 1 - Marlin/src/HAL/RP2040/inc/Conditionals_adv.h | 2 +- Marlin/src/HAL/RP2040/msc_sd.cpp | 148 ++++++++----------- ini/raspberrypi.ini | 1 + 5 files changed, 64 insertions(+), 96 deletions(-) diff --git a/Marlin/src/HAL/RP2040/HAL.h b/Marlin/src/HAL/RP2040/HAL.h index 4862986d11..11472f72f5 100644 --- a/Marlin/src/HAL/RP2040/HAL.h +++ b/Marlin/src/HAL/RP2040/HAL.h @@ -29,16 +29,16 @@ #include "arduino_extras.h" #include "../../core/macros.h" -#include "../shared/Marduino.h" #include "../shared/math_32bit.h" #include "../shared/HAL_SPI.h" #include "fastio.h" -//#include "Servo.h" #include "watchdog.h" #include "../../inc/MarlinConfigPre.h" -#include +#if HAS_SD_HOST_DRIVE + #include "msc_sd.h" +#endif // // Serial Ports @@ -142,7 +142,7 @@ public: static void delay_ms(const int ms) { delay(ms); } // Tasks, called from idle() - static void idletask() {} + static void idletask() { TERN_(HAS_SD_HOST_DRIVE, tuh_task()); } // Reset static uint8_t get_reset_source(); diff --git a/Marlin/src/HAL/RP2040/HAL_MinSerial.cpp b/Marlin/src/HAL/RP2040/HAL_MinSerial.cpp index 5a65163591..d829edff24 100644 --- a/Marlin/src/HAL/RP2040/HAL_MinSerial.cpp +++ b/Marlin/src/HAL/RP2040/HAL_MinSerial.cpp @@ -29,7 +29,6 @@ #include "../shared/HAL_MinSerial.h" - static void TXBegin() { #if !WITHIN(SERIAL_PORT, -1, 2) #warning "Using POSTMORTEM_DEBUGGING requires a physical U(S)ART hardware in case of severe error." diff --git a/Marlin/src/HAL/RP2040/inc/Conditionals_adv.h b/Marlin/src/HAL/RP2040/inc/Conditionals_adv.h index 442639e130..b96b3baa64 100644 --- a/Marlin/src/HAL/RP2040/inc/Conditionals_adv.h +++ b/Marlin/src/HAL/RP2040/inc/Conditionals_adv.h @@ -21,7 +21,7 @@ */ #pragma once -#if ALL(SDSUPPORT, USBD_USE_CDC_MSC) && DISABLED(NO_SD_HOST_DRIVE) +#if HAS_MEDIA && DISABLED(NO_SD_HOST_DRIVE) #define HAS_SD_HOST_DRIVE 1 #endif diff --git a/Marlin/src/HAL/RP2040/msc_sd.cpp b/Marlin/src/HAL/RP2040/msc_sd.cpp index 58c900302d..b0de2241e5 100644 --- a/Marlin/src/HAL/RP2040/msc_sd.cpp +++ b/Marlin/src/HAL/RP2040/msc_sd.cpp @@ -27,109 +27,77 @@ #if HAS_SD_HOST_DRIVE -#include "../shared/Marduino.h" -#include "msc_sd.h" -#include "usbd_core.h" - #include "../../sd/cardreader.h" -#include -#include +#include // TinyUSB device stack #define BLOCK_SIZE 512 -#define PRODUCT_ID 0x29 +#define SD_MULTIBLOCK_RETRY_CNT 1 -class Sd2CardUSBMscHandler : public USBMscHandler { -public: - DiskIODriver* diskIODriver() { - #if HAS_MULTI_VOLUME - #if SHARED_VOLUME_IS(SD_ONBOARD) - return &card.media_driver_sdcard; - #elif SHARED_VOLUME_IS(USB_FLASH_DRIVE) - return &card.media_driver_usbFlash; - #endif - #else - return card.diskIODriver(); +DiskIODriver* diskIODriver() { + #if HAS_MULTI_VOLUME + #if SHARED_VOLUME_IS(SD_ONBOARD) + return &card.media_driver_sdcard; + #elif SHARED_VOLUME_IS(USB_FLASH_DRIVE) + return &card.media_driver_usbFlash; #endif - } + #else + return card.diskIODriver(); + #endif +} - bool GetCapacity(uint32_t *pBlockNum, uint16_t *pBlockSize) { - *pBlockNum = diskIODriver()->cardSize(); - *pBlockSize = BLOCK_SIZE; - return true; - } +/** Callbacks used by TinyUSB MSC **/ - bool Write(uint8_t *pBuf, uint32_t blkAddr, uint16_t blkLen) { - auto sd2card = diskIODriver(); - // single block - if (blkLen == 1) { - watchdog_refresh(); - sd2card->writeBlock(blkAddr, pBuf); - return true; +extern "C" { + +bool tud_msc_ready_cb(uint8_t lun) { + return diskIODriver()->isReady(); +} + +int32_t tud_msc_read10_cb(uint8_t lun, uint32_t lba, void* buffer, uint32_t bufsize) { + const uint32_t blocks = bufsize / BLOCK_SIZE; + for (uint16_t rcount = SD_MULTIBLOCK_RETRY_CNT; rcount--; ) { + if (diskIODriver()->readBlocks(lba, (uint8_t*)buffer, blocks)) + return bufsize; // Success + } + return -1; // Failure after retries +} + +int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint8_t const* buffer, uint32_t bufsize) { + const uint32_t blocks = bufsize / BLOCK_SIZE; + for (uint16_t rcount = SD_MULTIBLOCK_RETRY_CNT; rcount--; ) { + if (diskIODriver()->writeBlocks(lba, buffer, blocks)) + return bufsize; // Success + } + return -1; // Failure after retries +} + +void tud_msc_inquiry_cb(uint8_t lun, uint8_t vendor_id[8], uint8_t product_id[16], uint8_t product_rev[4]) { + memcpy(vendor_id, "MARLIN ", 8); + memcpy(product_id, "Product ", 16); + memcpy(product_rev, "0.01", 4); +} + +void tud_msc_capacity_cb(uint8_t lun, uint32_t* block_count, uint16_t* block_size) { + *block_count = diskIODriver()->cardSize(); + *block_size = BLOCK_SIZE; +} + +void tud_msc_start_stop_cb(uint8_t lun, uint8_t power_condition, bool start, bool load_eject) { + if (load_eject) { + if (start) { + // Handle media load + } else { + // Handle media eject } - - // multi block optimization - sd2card->writeStart(blkAddr, blkLen); - while (blkLen--) { - watchdog_refresh(); - sd2card->writeData(pBuf); - pBuf += BLOCK_SIZE; - } - sd2card->writeStop(); - return true; } +} - bool Read(uint8_t *pBuf, uint32_t blkAddr, uint16_t blkLen) { - auto sd2card = diskIODriver(); - // single block - if (blkLen == 1) { - watchdog_refresh(); - sd2card->readBlock(blkAddr, pBuf); - return true; - } - - // multi block optimization - sd2card->readStart(blkAddr); - while (blkLen--) { - watchdog_refresh(); - sd2card->readData(pBuf); - pBuf += BLOCK_SIZE; - } - sd2card->readStop(); - return true; - } - - bool IsReady() { - return diskIODriver()->isReady(); - } -}; - -Sd2CardUSBMscHandler usbMscHandler; - -/* USB Mass storage Standard Inquiry Data */ -uint8_t Marlin_STORAGE_Inquirydata[] = { /* 36 */ - /* LUN 0 */ - 0x00, - 0x80, - 0x02, - 0x02, - (STANDARD_INQUIRY_DATA_LEN - 5), - 0x00, - 0x00, - 0x00, - 'M', 'A', 'R', 'L', 'I', 'N', ' ', ' ', /* Manufacturer : 8 bytes */ - 'P', 'r', 'o', 'd', 'u', 'c', 't', ' ', /* Product : 16 Bytes */ - ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', - '0', '.', '0', '1', /* Version : 4 Bytes */ -}; - -USBMscHandler *pSingleMscHandler = &usbMscHandler; +} // extern "C" void MSC_SD_init() { - USBDevice.end(); - delay(200); - USBDevice.registerMscHandlers(1, &pSingleMscHandler, Marlin_STORAGE_Inquirydata); - USBDevice.begin(); + tusb_init(); + // Add USB reinitialization logic if needed } #endif // HAS_SD_HOST_DRIVE diff --git a/ini/raspberrypi.ini b/ini/raspberrypi.ini index c61b89b461..059f4d1821 100644 --- a/ini/raspberrypi.ini +++ b/ini/raspberrypi.ini @@ -21,6 +21,7 @@ lib_ignore = WiFi build_flags = ${common.build_flags} -D__PLAT_RP2040__ -DPLATFORM_M997_SUPPORT -Wno-expansion-to-defined -Wno-vla -Wno-ignored-qualifiers #debug_tool = jlink #upload_protocol = jlink +custom_marlin.HAS_SD_HOST_DRIVE = tinyusb [env:RP2040-alt] extends = env:RP2040 From f78aaf956277bd73840a007a319ca487068f0683 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 24 Apr 2025 11:06:47 -0500 Subject: [PATCH 67/86] =?UTF-8?q?=F0=9F=9A=B8=20Detect=20multi-volume=20in?= =?UTF-8?q?sert=20/=20remove?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/MarlinCore.cpp | 7 +- .../lcd/extui/anycubic_chiron/chiron_tft.cpp | 2 +- .../extui/mks_ui/tft_lvgl_configuration.cpp | 24 +-- Marlin/src/lcd/marlinui.cpp | 36 ++++- Marlin/src/lcd/marlinui.h | 2 +- Marlin/src/sd/cardreader.cpp | 152 ++++++++++++++---- Marlin/src/sd/cardreader.h | 11 ++ 7 files changed, 168 insertions(+), 66 deletions(-) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index de6677fc9a..aa229e80b6 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -1349,8 +1349,11 @@ void setup() { #endif #endif - #if HAS_MEDIA && ANY(SDCARD_EEPROM_EMULATION, POWER_LOSS_RECOVERY) - SETUP_RUN(card.mount()); // Mount media with settings before first_load + #if HAS_MEDIA + SETUP_RUN(card.init()); // Prepare for media usage + #if ANY(SDCARD_EEPROM_EMULATION, POWER_LOSS_RECOVERY) + SETUP_RUN(card.mount()); // Mount media with settings before first_load + #endif #endif // Prepare some LCDs to display early diff --git a/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp b/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp index e6e8c88155..b4e1978283 100644 --- a/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp +++ b/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp @@ -740,7 +740,7 @@ void ChironTFT::panelAction(uint8_t req) { break; case 26: // A26 Refresh SD - if (card.isMounted())card.release(); + card.release(); card.mount(); safe_delay(500); filenavigator.reset(); 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 729d8bc4b2..903afad884 100644 --- a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp +++ b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp @@ -131,32 +131,16 @@ void tft_lvgl_init() { // Init TFT first! SPI_TFT.spiInit(SPI_FULL_SPEED); SPI_TFT.lcdInit(); - hal.watchdog_refresh(); // LVGL init takes time - #if HAS_USB_FLASH_DRIVE - #if HAS_MULTI_VOLUME && !HAS_SD_HOST_DRIVE - if (card.isSDCardInserted()) - card.selectMediaSDCard(); - else - card.selectMediaFlashDrive(); - #endif - // Wait up to two seconds for USB Drive to mount - for (uint16_t usb_flash_loop = 500; --usb_flash_loop;) { - hal.watchdog_refresh(); - card.media_driver_usbFlash.idle(); - delay(4); - if (card.media_driver_usbFlash.isInserted()) break; - } - card.mount(); - #elif HAS_LOGO_IN_FLASH + #if HAS_LOGO_IN_FLASH + // Leave the boot screen visible for a moment delay(1000); - hal.watchdog_refresh(); + hal.watchdog_refresh(); // LVGL init takes time delay(1000); + hal.watchdog_refresh(); // LVGL init takes time #endif - hal.watchdog_refresh(); // LVGL init takes time - #if HAS_MEDIA UpdateAssets(); hal.watchdog_refresh(); // LVGL init takes time diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index f6b1b60c7d..2b730581c8 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -1891,40 +1891,60 @@ uint8_t expand_u8str_P(char * const outstr, PGM_P const ptpl, const int8_t ind, #include "extui/ui_api.h" #endif - void MarlinUI::media_changed(const uint8_t old_status, const uint8_t status) { + void MarlinUI::media_changed(const MediaPresence old_status, const MediaPresence status) { TERN_(HAS_DISPLAY_SLEEP, refresh_screen_timeout()); if (old_status == status) { TERN_(EXTENSIBLE_UI, ExtUI::onMediaError()); // Failed to mount/unmount return; } - if (old_status < 2) { // Skip this section on first boot check - if (status) { // Media Mounted + if (old_status > MEDIA_BOOT) { // Skip this section on first boot check + + if (status > old_status) { // Media Mounted + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMediaMounted(); + #elif ENABLED(BROWSE_MEDIA_ON_INSERT) + clear_menu_history(); quick_feedback(); goto_screen(MEDIA_MENU_GATEWAY); + #else + if (card.isSDCardSelected()) LCD_MESSAGE(MSG_MEDIA_INSERTED_SD); else if (card.isFlashDriveSelected()) LCD_MESSAGE(MSG_MEDIA_INSERTED_USB); else LCD_MESSAGE(MSG_MEDIA_INSERTED); + #endif } else { // Media Removed + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMediaRemoved(); - #elif HAS_SD_DETECT // Q: Does "Media Removed" need to be shown for manual release too? - LCD_MESSAGE(MSG_MEDIA_REMOVED); - #if HAS_MARLINUI_MENU - if (ENABLED(HAS_WIRED_LCD) || !defer_return_to_status) return_to_status(); - #endif + + #elif HAS_SD_DETECT || HAS_USB_FLASH_DRIVE // Q: Does "Media Removed" need to be shown for manual release too? + + if ((old_status ^ status) & INSERT_SD) + LCD_MESSAGE(MSG_MEDIA_REMOVED_SD); + else if ((old_status ^ status) & INSERT_USB) + LCD_MESSAGE(MSG_MEDIA_REMOVED_USB); + else + LCD_MESSAGE(MSG_MEDIA_REMOVED); + + if (ENABLED(HAS_WIRED_LCD) || !defer_return_to_status) + return_to_status(); + #elif HAS_WIRED_LCD + return_to_status(); + #endif } } diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index 9f2ac5a69a..076fc63f2a 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -256,7 +256,7 @@ public: #if HAS_MEDIA #define MEDIA_MENU_GATEWAY TERN(PASSWORD_ON_SD_PRINT_MENU, password.media_gatekeeper, menu_media) - static void media_changed(const uint8_t old_stat, const uint8_t stat); + static void media_changed(const MediaPresence old_stat, const MediaPresence stat); #endif #if HAS_LCD_BRIGHTNESS diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index 21bc6e780a..5502561ea4 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -145,6 +145,7 @@ int16_t CardReader::nrItems = -1; #endif DiskIODriver* CardReader::driver = nullptr; + MarlinVolume CardReader::volume; MediaFile CardReader::myfile; @@ -483,11 +484,15 @@ void CardReader::mount() { nrItems = -1; if (root.isOpen()) root.close(); - if (!driver->init(SD_SPI_SPEED, SD_SS_PIN) + const bool driver_init = ( + driver->init(SD_SPI_SPEED, SD_SS_PIN) #if PIN_EXISTS(LCD_SDSS) && (LCD_SDSS_PIN != SD_SS_PIN) - && !driver->init(SD_SPI_SPEED, LCD_SDSS_PIN) + || driver->init(SD_SPI_SPEED, LCD_SDSS_PIN) #endif - ) SERIAL_ECHO_MSG(STR_SD_INIT_FAIL); + ); + + if (!driver_init) + SERIAL_ECHO_MSG(STR_SD_INIT_FAIL); else if (!volume.init(driver)) SERIAL_WARN_MSG(STR_SD_VOL_INIT_FAIL); else if (!root.openRoot(&volume)) @@ -519,69 +524,146 @@ void CardReader::mount() { #include "../module/stepper.h" #endif +// Provide a little time for drives to prepare +void CardReader::init() { + #if HAS_USB_FLASH_DRIVE + for (uint8_t i = 10; --i;) { + media_driver_usbFlash.idle(); + hal.watchdog_refresh(); + if (media_driver_usbFlash.isInserted()) break; + delay(20); + } + #endif +} + /** - * Handle SD card events + * Handle media insertion and removal events + * based on SD Card detect and/or driver.isInserted() + * + * MULTI_VOLUME: + * - Track insert/remove for both media drives. + * - If the MOUNTED media is removed call release(). + * - If media is INSERTED when NO MEDIA is mounted, select and mount it. */ void CardReader::manage_media() { - #if HAS_USB_FLASH_DRIVE // Wrap for optimal non-virtual? - driver->idle(); // Handle device tasks (e.g., USB Drive insert / remove) + /** + * Handle device tasks (e.g., USB Drive insert / remove) + * - USB Flash Drive needs to run even when not selected. + * - SD Card currently has no background tasks. + */ + //driver->idle(); + #if HAS_USB_FLASH_DRIVE + //if (!isFlashDriveSelected()) + media_driver_usbFlash.idle(); #endif - static uint8_t prev_stat = 2; // At boot we don't know if media is present or not - uint8_t stat = uint8_t(isInserted()); + // Prevent re-entry during Marlin::idle + #if HAS_MULTI_VOLUME + static bool no_reenter = false; + if (no_reenter) return; + #endif + + static MediaPresence prev_stat = MEDIA_BOOT; // At boot we don't know if media is present or not + + // Live status is based on available media flags + MediaPresence stat = MediaPresence( + #if HAS_MULTI_VOLUME + (isSDCardInserted() ? INSERT_SD : 0) // Without SD Detect it's always "inserted" + | (isFlashDriveInserted() ? INSERT_USB : 0) + #else + isInserted() ? INSERT_MEDIA : 0 // Without SD Detect it's always "inserted" + #endif + ); + if (stat == prev_stat) return; // Already checked and still no change? DEBUG_SECTION(cmm, "CardReader::manage_media()", true); DEBUG_ECHOLNPGM("Media present: ", prev_stat, " -> ", stat); - if (!ui.detected()) { - DEBUG_ECHOLNPGM("SD: No UI Detected."); - return; - } + // Without a UI there's no auto-mount or release + if (!ui.detected()) { DEBUG_ECHOLNPGM("SD: No UI Detected."); return; } - flag.workDirIsRoot = true; // Return to root on mount/release/init - - const uint8_t old_stat = prev_stat; + const MediaPresence old_stat = prev_stat, + old_real = old_stat == MEDIA_BOOT ? INSERT_NONE : old_stat; prev_stat = stat; // Change now to prevent re-entry in safe_delay - if (stat) { // Media Inserted - safe_delay(500); // Some boards need a delay to get settled + #if HAS_MULTI_VOLUME + const int8_t vdiff = (old_real ^ stat), vadd = vdiff & stat; + #endif + const bool did_insert = TERN(HAS_MULTI_VOLUME, vadd, stat) != INSERT_NONE; - // Try to mount the media (only later with SD_IGNORE_AT_STARTUP) - if (TERN1(SD_IGNORE_AT_STARTUP, old_stat != 2)) mount(); - if (!isMounted()) stat = 0; // Not mounted? + if (did_insert) { // Media Inserted + + TERN_(HAS_MULTI_VOLUME, ui.refresh()); // Refresh for insert events without messages + + // Some media is already mounted? Nothing to do. + if (TERN0(HAS_MULTI_VOLUME, isMounted())) return; + + // Prevent re-entry during the following phases + TERN_(HAS_MULTI_VOLUME, no_reenter = true); + + // Try to mount the media (but not at boot if SD_IGNORE_AT_STARTUP) + if (TERN1(SD_IGNORE_AT_STARTUP, old_stat > MEDIA_BOOT)) { + #if HAS_MULTI_VOLUME + if ((vadd & INSERT_SD) && !isSDCardSelected()) + selectMediaSDCard(); + if ((vadd & INSERT_USB) && !isFlashDriveSelected()) + selectMediaFlashDrive(); + #endif + safe_delay(500); // Time for inserted media to settle. May re-enter for multiple media? + mount(); + } + + // If the selected media isn't mounted throw an alert in ui.media_changed + if (!isMounted()) stat = old_real; TERN_(RESET_STEPPERS_ON_MEDIA_INSERT, reset_stepper_drivers()); // Workaround for Cheetah bug + + // Re-enable media detection logic + TERN_(HAS_MULTI_VOLUME, no_reenter = false); + } + else if ( + // Media was removed from the device slot + #if HAS_MULTI_VOLUME + (isSDCardSelected() && (vdiff & INSERT_SD)) + || (isFlashDriveSelected() && (vdiff & INSERT_USB)) + #else + stat // == INSERT_MEDIA + #endif + ) { + flag.workDirIsRoot = true; // Return to root on release + release(); + //TERN_(HAS_MULTI_VOLUME, prev_stat = INSERT_NONE); // HACK to try mounting any remaining media } else { - TERN_(HAS_SD_DETECT, release()); // Card is released + #if HAS_MULTI_VOLUME + stat = old_real; // Ignore un-mounted media being ejected + ui.refresh(); // Refresh for menus that show inserted unmounted media + #endif } - ui.media_changed(old_stat, stat); // Update the UI or flag an error + ui.media_changed(old_stat, stat); // Update the UI or flag an error - if (!stat) return; // Exit if no media is present - - bool do_auto = true; UNUSED(do_auto); + if (stat == INSERT_NONE) return; // Exit if no media is present // First mount on boot? Load emulated EEPROM and look for PLR file. - if (old_stat == 2) { + if (old_stat <= MEDIA_BOOT) { DEBUG_ECHOLNPGM("First mount."); // Load settings the first time media is inserted (not just during init) TERN_(SDCARD_EEPROM_EMULATION, settings.first_load()); - // 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. If found skip other procedures! + if (TERN0(POWER_LOSS_RECOVERY, recovery.check())) return; } - // Find the newest file and prompt to print it. - TERN_(ONE_CLICK_PRINT, if (do_auto && one_click_check()) do_auto = false); + // Find the newest file and prompt to print it. Skip other procedures! + if (TERN0(ONE_CLICK_PRINT, one_click_check())) return; - // Also for the first mount run auto#.g for machine init. - // (Skip if PLR or One-Click Print was invoked.) - if (old_stat == 2) { + // On first mount at boot run auto#.g for machine init. + if (old_stat <= MEDIA_BOOT) { // Look for auto0.g on the next idle() - IF_DISABLED(NO_SD_AUTOSTART, if (do_auto) autofile_begin()); + IF_DISABLED(NO_SD_AUTOSTART, autofile_begin()); } } @@ -590,6 +672,8 @@ void CardReader::manage_media() { * Used by M22, "Release Media", manage_media. */ void CardReader::release() { + if (!flag.mounted) return; + // Card removed while printing? Abort! if (isStillPrinting()) abortFilePrintSoon(); diff --git a/Marlin/src/sd/cardreader.h b/Marlin/src/sd/cardreader.h index 1a8843da58..6c1f05b8af 100644 --- a/Marlin/src/sd/cardreader.h +++ b/Marlin/src/sd/cardreader.h @@ -78,6 +78,14 @@ typedef struct { ; } card_flags_t; +enum MediaPresence : int8_t { + MEDIA_BOOT = -1, + INSERT_NONE = 0x00, + INSERT_MEDIA = 0x01, + INSERT_SD = TERN(HAS_MULTI_VOLUME, 0x02, 0x00), + INSERT_USB = TERN(HAS_MULTI_VOLUME, 0x04, 0x00) +}; + enum ListingFlags : uint8_t { LS_LONG_FILENAME, LS_ONLY_BIN, LS_TIMESTAMP }; enum SortFlag : int8_t { AS_REV = -1, AS_OFF, AS_FWD, AS_ALSO_REV }; @@ -102,6 +110,9 @@ public: CardReader(); + // Init at startup before mounting media + static void init(); + /** * Media Selection - Only one drive may be active at a time, * so switching drives (currently) returns to the root folder. From 99c29cd9242387176a6be0f70acace28ac27ec03 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 24 Apr 2025 11:20:15 -0500 Subject: [PATCH 68/86] =?UTF-8?q?=F0=9F=9A=B8=20Simplified=20Media=20Menu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/password/password.cpp | 2 +- Marlin/src/feature/password/password.h | 2 + Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp | 8 +- Marlin/src/lcd/language/language_en.h | 9 +- Marlin/src/lcd/marlinui.h | 6 +- Marlin/src/lcd/menu/menu.h | 3 +- Marlin/src/lcd/menu/menu_item.h | 3 + Marlin/src/lcd/menu/menu_main.cpp | 154 +++++++++++++++----- Marlin/src/lcd/menu/menu_media.cpp | 46 +++--- Marlin/src/lcd/menu/menu_password.cpp | 12 +- Marlin/src/lcd/tft/ui_color_ui.cpp | 2 +- 11 files changed, 171 insertions(+), 76 deletions(-) diff --git a/Marlin/src/feature/password/password.cpp b/Marlin/src/feature/password/password.cpp index 1d376cc586..d36b3edd09 100644 --- a/Marlin/src/feature/password/password.cpp +++ b/Marlin/src/feature/password/password.cpp @@ -36,7 +36,7 @@ uint32_t Password::value, Password::value_entry; // // Authenticate user with password. -// Called from Setup, after SD Prinitng Stops/Aborts, and M510 +// Called from Setup, after SD Printing Stops/Aborts, and M510 // void Password::lock_machine() { is_locked = true; diff --git a/Marlin/src/feature/password/password.h b/Marlin/src/feature/password/password.h index 208765b212..0f8bc28bd8 100644 --- a/Marlin/src/feature/password/password.h +++ b/Marlin/src/feature/password/password.h @@ -37,6 +37,8 @@ public: static void access_menu_password(); static void authentication_done(); static void media_gatekeeper(); + static void media_gatekeeper_sd(); + static void media_gatekeeper_usb(); private: static void authenticate_user(const screenFunc_t, const screenFunc_t); diff --git a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp index 4ac012ba93..d772447551 100644 --- a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp +++ b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp @@ -175,9 +175,9 @@ void TFTGLCD::clr_screen() { SPI_SEND_ONE(CLR_SCREEN); WRITE(TFTGLCD_CS, HIGH); #else - Wire.beginTransmission(uint8_t(LCD_I2C_ADDRESS)); //set I2C device address + Wire.beginTransmission(uint8_t(LCD_I2C_ADDRESS)); // Transmit to LCD via I2C Wire.write(CLR_SCREEN); - Wire.endTransmission(); //transmit data + Wire.endTransmission(); // Send the data #endif } @@ -378,10 +378,6 @@ void MarlinUI::clear_for_drawing() { clear_lcd(); } void MarlinUI::_set_contrast() { lcd.setContrast(contrast); } #endif -#if !IS_TFTGLCD_PANEL - void lcd_moveto(const uint8_t col, const uint8_t row) { lcd.setCursor(col, row); } -#endif - static void center_text(FSTR_P const fstart, const uint8_t y) { const uint8_t len = utf8_strlen(fstart); lcd_moveto(len < LCD_WIDTH ? (LCD_WIDTH - len) / 2 : 0, y); diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 7ea17d5bb3..5ed5b24635 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -574,10 +574,8 @@ namespace LanguageNarrow_en { LSTR MSG_CANCEL_OBJECT = _UxGT("Cancel Obj"); LSTR MSG_CANCEL_OBJECT_N = _UxGT("Cancel Obj {"); LSTR MSG_CONTINUE_PRINT_JOB = _UxGT("Continue Job"); - LSTR MSG_MEDIA_MENU = MEDIA_TYPE_EN _UxGT(" Print"); LSTR MSG_TURN_OFF = _UxGT("Turn off now"); LSTR MSG_END_LOOPS = _UxGT("End Loops"); - LSTR MSG_NO_MEDIA = _UxGT("No ") MEDIA_TYPE_EN; LSTR MSG_DWELL = _UxGT("Sleep..."); LSTR MSG_USERWAIT = _UxGT("Click to Resume..."); LSTR MSG_PRINT_PAUSED = _UxGT("Print Paused"); @@ -641,6 +639,10 @@ namespace LanguageNarrow_en { LSTR MSG_RUN_AUTOFILES = _UxGT("Run Autofiles"); LSTR MSG_RUN_AUTOFILES_SD = _UxGT("Run SD Autofiles"); LSTR MSG_RUN_AUTOFILES_USB = _UxGT("Run USB Autofiles"); + LSTR MSG_MEDIA_MENU = MEDIA_TYPE_EN _UxGT(" Print"); + LSTR MSG_MEDIA_MENU_SD = _UxGT("Select from SD"); + LSTR MSG_MEDIA_MENU_USB = _UxGT("Select from USB"); + LSTR MSG_NO_MEDIA = _UxGT("No ") MEDIA_TYPE_EN _UxGT(" Detected"); LSTR MSG_ZPROBE_OUT = _UxGT("Z Probe Past Bed"); LSTR MSG_SKEW_FACTOR = _UxGT("Skew Factor"); @@ -1130,6 +1132,9 @@ namespace LanguageWide_en { LSTR MSG_CANCEL_OBJECT_N = _UxGT("Cancel Object {"); LSTR MSG_CONTINUE_PRINT_JOB = _UxGT("Continue Print Job"); LSTR MSG_MEDIA_MENU = _UxGT("Select from ") MEDIA_TYPE_EN; + LSTR MSG_MEDIA_MENU_SD = _UxGT("Select from SD Card"); + LSTR MSG_MEDIA_MENU_USB = _UxGT("Select from USB Drive"); + LSTR MSG_NO_MEDIA = _UxGT("No ") MEDIA_TYPE_EN _UxGT(" Found"); LSTR MSG_TURN_OFF = _UxGT("Turn off the printer"); LSTR MSG_END_LOOPS = _UxGT("End Repeat Loops"); LSTR MSG_MEDIA_NOT_INSERTED = _UxGT("No media inserted."); // ProUI diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index 076fc63f2a..a610796ebc 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -255,7 +255,9 @@ public: #endif #if HAS_MEDIA - #define MEDIA_MENU_GATEWAY TERN(PASSWORD_ON_SD_PRINT_MENU, password.media_gatekeeper, menu_media) + #define MEDIA_MENU_GATEWAY TERN(PASSWORD_ON_SD_PRINT_MENU, password.media_gatekeeper, menu_file_selector) + #define MEDIA_MENU_GATEWAY_SD TERN(PASSWORD_ON_SD_PRINT_MENU, password.media_gatekeeper_sd, menu_file_selector_sd) + #define MEDIA_MENU_GATEWAY_USB TERN(PASSWORD_ON_SD_PRINT_MENU, password.media_gatekeeper_usb, menu_file_selector_usb) static void media_changed(const MediaPresence old_stat, const MediaPresence stat); #endif @@ -864,7 +866,7 @@ public: TERN_(REVERSE_SELECT_DIRECTION, encoderDirection = -(ENCODERBASE)); } - #else + #else // !HAS_ENCODER_ACTION static void update_buttons() {} static bool hw_button_pressed() { return false; } diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index b7861655e2..47f5a312eb 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -212,7 +212,8 @@ void menu_move(); #if HAS_MEDIA void menu_file_selector(); - void menu_media(); + void menu_file_selector_sd(); + void menu_file_selector_usb(); #endif //////////////////////////////////////////// diff --git a/Marlin/src/lcd/menu/menu_item.h b/Marlin/src/lcd/menu/menu_item.h index af4558cefc..d79956aea7 100644 --- a/Marlin/src/lcd/menu/menu_item.h +++ b/Marlin/src/lcd/menu/menu_item.h @@ -226,6 +226,9 @@ class MenuItem_bool : public MenuEditItemBase { * should be done before the menu loop (START_MENU / START_SCREEN). */ +// CAUTION! When using menu items in a lambda or sub-function always use: +#define INJECT_MENU_ITEMS(FN) { FN; if (ui.screen_changed) return; } + /** * SCREEN_OR_MENU_LOOP generates header code for a screen or menu * diff --git a/Marlin/src/lcd/menu/menu_main.cpp b/Marlin/src/lcd/menu/menu_main.cpp index 7e2d458e41..04bbc41074 100644 --- a/Marlin/src/lcd/menu/menu_main.cpp +++ b/Marlin/src/lcd/menu/menu_main.cpp @@ -237,8 +237,8 @@ void menu_configuration(); void menu_main() { const bool busy = printingIsActive(); #if HAS_MEDIA - const bool card_detected = card.isMounted(), - card_open = card_detected && card.isFileOpen(); + const bool card_is_mounted = card.isMounted(), + card_open = card_is_mounted && card.isFileOpen(); #endif START_MENU(); @@ -248,45 +248,123 @@ void menu_main() { #define MEDIA_MENU_AT_TOP #endif - auto media_menus = [&]{ - #if HAS_MEDIA - if (card_detected) { - if (!card_open) { - #if ENABLED(MENU_ADDAUTOSTART) - ACTION_ITEM(MSG_RUN_AUTOFILES, card.autofile_begin); // Run Auto Files - #endif + // Show "Attach" for drives that don't auto-detect media (yet) + //#define ATTACH_WITHOUT_INSERT_SD + #define ATTACH_WITHOUT_INSERT_USB - #if HAS_SD_DETECT - GCODES_ITEM(MSG_CHANGE_MEDIA, F("M21" TERN_(HAS_MULTI_VOLUME, "S"))); // M21 Change Media - #if HAS_MULTI_VOLUME - GCODES_ITEM(MSG_ATTACH_USB, F("M21U")); // M21 Attach USB Media - #endif - #else // - or - - ACTION_ITEM(MSG_RELEASE_MEDIA, []{ // M22 Release Media - queue.inject(F("M22")); - #if ENABLED(TFT_COLOR_UI) - // Menu display issue on item removal with multi language selection menu - if (encoderTopLine > 0) encoderTopLine--; - ui.refresh(); - #endif - }); - #endif - SUBMENU(MSG_MEDIA_MENU, MEDIA_MENU_GATEWAY); // Media Menu (or Password First) - } + // Show all "inserted" drives and mount as-needed + #define SHOW_UNMOUNTED_DRIVES + + /** + * Previously: + * - The "selected" media is mounted? + * - [Run Auto Files] + * - HAS_SD_DETECT: + * - [Change Media] = M21 / M21S + * - HAS_MULTI_VOLUME? + * - [Attach USB Drive] = M21U + * - ELSE: + * - [Release Media] = M22 + * - [Select from Media] (or Password Gateway) > + * + * - The "selected" media is not mounted? + * - HAS_SD_DETECT? + * - [No Media] (does nothing) + * - HAS_MULTI_VOLUME? + * - [Attach SD Card] = M21S + * - [Attach USB Drive] = M21U + * - ELSE: + * - [Attach Media] = M21 + * + * Updated: + * - Something is mounted? + * - [Run SD/USB Autofiles] + * - [Release SD/USB] = M22 + * - [Select from SD/USB] (or Password Gateway) > + * + * - Something is inserted and SHOW_UNMOUNTED_DRIVES? + * - [Select from SD/USB] (or Password Gateway) > + * + * - The "selected" Card is NOT DETECTED? + * - Trust all media detect methods? + * - [No Media] (does nothing) + * - HAS_MULTI_VOLUME? + * - [Attach SD Card] = M21S + * - [Attach USB Drive] = M21U + * - ELSE: + * - [Attach SD Card/USB Drive] = M21 + * + * Ideal: + * - Password Gateway? + * - Use gateway passthroughs for all SD/USB Drive menu items... + * - [Run SD Autofiles] + * - [Run USB Autofiles] + * - [Select from SD Card] (or Password Gateway) > + * - [Select from USB Drive] (or Password Gateway) > + * - [Eject SD Card/USB Drive] + */ + auto media_menu_items = [&]{ + #if HAS_MEDIA + if (card_open) return; + + if (card_is_mounted) { + #if ENABLED(MENU_ADDAUTOSTART) + // [Run AutoFiles] for mounted drive(s) + if (card.isSDCardMounted()) + ACTION_ITEM(MSG_RUN_AUTOFILES_SD, card.autofile_begin); + if (card.isFlashDriveMounted()) + ACTION_ITEM(MSG_RUN_AUTOFILES_USB, card.autofile_begin); + #endif + + #if ENABLED(TFT_COLOR_UI) + // Menu display issue on item removal with multi language selection menu + #define M22_ITEM(T) do{ \ + ACTION_ITEM(T, []{ \ + queue.inject(F("M22")); encoderTopLine -= (encoderTopLine > 0); ui.refresh(); \ + }); \ + }while(0) + #else + #define M22_ITEM(T) GCODES_ITEM(T, F("M22")) + #endif + + // [Release Media] for mounted drive(s) + if (card.isSDCardMounted()) + M22_ITEM(MSG_RELEASE_SD); + if (card.isFlashDriveMounted()) + M22_ITEM(MSG_RELEASE_USB); + + // [Select from SD/USB] (or Password First) + if (card.isSDCardMounted()) + SUBMENU(MSG_MEDIA_MENU_SD, MEDIA_MENU_GATEWAY); + else if (TERN0(SHOW_UNMOUNTED_DRIVES, card.isSDCardInserted())) + SUBMENU(MSG_MEDIA_MENU_SD, MEDIA_MENU_GATEWAY_SD); + if (card.isFlashDriveMounted()) + SUBMENU(MSG_MEDIA_MENU_USB, MEDIA_MENU_GATEWAY); + else if (TERN0(SHOW_UNMOUNTED_DRIVES, card.isFlashDriveInserted())) + SUBMENU(MSG_MEDIA_MENU_USB, MEDIA_MENU_GATEWAY_USB); } else { - #if HAS_SD_DETECT - ACTION_ITEM(MSG_NO_MEDIA, nullptr); // "No Media" - #else - #if HAS_MULTI_VOLUME - GCODES_ITEM(MSG_ATTACH_SD, F("M21S")); // M21S Attach SD Card - GCODES_ITEM(MSG_ATTACH_USB, F("M21U")); // M21U Attach USB Media + // NOTE: If the SD Card has no SD_DETECT it will always appear to be "inserted" + const bool att_sd = ENABLED(ATTACH_WITHOUT_INSERT_SD) || card.isSDCardInserted(), + att_usb = ENABLED(ATTACH_WITHOUT_INSERT_USB) || card.isFlashDriveInserted(); + if (!att_sd && !att_usb) { + ACTION_ITEM(MSG_NO_MEDIA, nullptr); // [No Media] + } + else { + #if ALL(HAS_MULTI_VOLUME, SHOW_UNMOUNTED_DRIVES) + // [Select from SD/USB] (or Password First) + if (TERN0(SHOW_UNMOUNTED_DRIVES, card.isSDCardInserted())) + SUBMENU(MSG_MEDIA_MENU_SD, MEDIA_MENU_GATEWAY_SD); + if (TERN0(SHOW_UNMOUNTED_DRIVES, card.isFlashDriveInserted())) + SUBMENU(MSG_MEDIA_MENU_USB, MEDIA_MENU_GATEWAY_USB); #else - GCODES_ITEM(MSG_ATTACH_MEDIA, F("M21")); // M21 Attach Media + #define M21(T) F("M21" TERN_(HAS_MULTI_VOLUME, T)) + if (att_sd) GCODES_ITEM(MSG_ATTACH_SD, M21("S")); // M21 S - [Attach SD Card] + if (att_usb) GCODES_ITEM(MSG_ATTACH_USB, M21("U")); // M21 U - [Attach USB Drive] #endif - #endif + } } - #endif + #endif // HAS_MEDIA }; if (busy) { @@ -317,7 +395,9 @@ void menu_main() { else { // SD Card / Flash Drive - TERN_(MEDIA_MENU_AT_TOP, media_menus()); + #if ENABLED(MEDIA_MENU_AT_TOP) + INJECT_MENU_ITEMS(media_menu_items()); + #endif if (TERN0(MACHINE_CAN_PAUSE, printingIsPaused())) ACTION_ITEM(MSG_RESUME_PRINT, ui.resume_print); @@ -407,7 +487,7 @@ void menu_main() { // SD Card / Flash Drive #if DISABLED(MEDIA_MENU_AT_TOP) - if (!busy) media_menus(); + if (!busy) INJECT_MENU_ITEMS(media_menu_items()); #endif #if HAS_SERVICE_INTERVALS diff --git a/Marlin/src/lcd/menu/menu_media.cpp b/Marlin/src/lcd/menu/menu_media.cpp index 8747685fe5..f4c409c4a3 100644 --- a/Marlin/src/lcd/menu/menu_media.cpp +++ b/Marlin/src/lcd/menu/menu_media.cpp @@ -101,29 +101,27 @@ class MenuItem_sdfolder : public MenuItem_sdbase { } }; -#if HAS_MULTI_VOLUME - void menu_media_select() { - START_MENU(); - BACK_ITEM_F(TERN1(BROWSE_MEDIA_ON_INSERT, screen_history_depth) ? GET_TEXT_F(MSG_MAIN_MENU) : GET_TEXT_F(MSG_BACK)); - #if HAS_SDCARD - ACTION_ITEM(MSG_SD_CARD, []{ card.selectMediaSDCard(); card.mount(); ui.goto_screen(menu_file_selector); }); - #endif - #if HAS_USB_FLASH_DRIVE - ACTION_ITEM(MSG_USB_DISK, []{ card.selectMediaFlashDrive(); card.mount(); ui.goto_screen(menu_file_selector); }); - #endif - END_MENU(); +// Shortcut menu items to go directly to inserted — not necessarily mounted — drives +void menu_file_selector_sd() { + if (!card.isSDCardSelected()) { + card.release(); + card.selectMediaSDCard(); } -#endif - -/** - * "Select From Media" menu item. Depending on single or multiple drives: - * - menu_file_selector - List files on the current media - * - menu_media_select - Select one of the attached drives, then go to the file list - */ -void menu_media() { - ui.goto_screen(TERN(HAS_MULTI_VOLUME, menu_media_select, menu_file_selector)); + if (!card.isSDCardMounted()) card.mount(); + ui.goto_screen(menu_file_selector); } +// Shortcut menu items to go directly to inserted — not necessarily mounted — drives +void menu_file_selector_usb() { + if (!card.isFlashDriveSelected()) { + card.release(); + card.selectMediaFlashDrive(); + } + if (!card.isFlashDriveMounted()) card.mount(); + ui.goto_screen(menu_file_selector); +} + +// Shortcut menu items to go directly to inserted — not necessarily mounted — drives void menu_file_selector() { ui.encoder_direction_menus(); @@ -135,11 +133,9 @@ void menu_file_selector() { #endif START_MENU(); - #if HAS_MULTI_VOLUME - ACTION_ITEM(MSG_BACK, []{ ui.goto_screen(menu_media_select); }); - #else - BACK_ITEM_F(TERN1(BROWSE_MEDIA_ON_INSERT, screen_history_depth) ? GET_TEXT_F(MSG_MAIN_MENU) : GET_TEXT_F(MSG_BACK)); - #endif + + BACK_ITEM_F(TERN1(BROWSE_MEDIA_ON_INSERT, screen_history_depth) ? GET_TEXT_F(MSG_MAIN_MENU) : GET_TEXT_F(MSG_BACK)); + if (card.flag.workDirIsRoot) { #if !HAS_SD_DETECT ACTION_ITEM(MSG_REFRESH, []{ encoderTopLine = 0; card.mount(); }); diff --git a/Marlin/src/lcd/menu/menu_password.cpp b/Marlin/src/lcd/menu/menu_password.cpp index 33d4231cd5..5e3db846ac 100644 --- a/Marlin/src/lcd/menu/menu_password.cpp +++ b/Marlin/src/lcd/menu/menu_password.cpp @@ -140,8 +140,18 @@ void Password::access_menu_password() { #if ENABLED(PASSWORD_ON_SD_PRINT_MENU) void Password::media_gatekeeper() { - authenticate_user(menu_media, menu_main); + authenticate_user(menu_file_selector, menu_main); } + #if HAS_SDCARD + void Password::media_gatekeeper_sd() { + authenticate_user(menu_file_selector_sd, menu_main); + } + #endif + #if HAS_USB_FLASH_DRIVE + void Password::media_gatekeeper_usb() { + authenticate_user(menu_file_selector_usb, menu_main); + } + #endif #endif void Password::start_over() { diff --git a/Marlin/src/lcd/tft/ui_color_ui.cpp b/Marlin/src/lcd/tft/ui_color_ui.cpp index 8186650070..6c90cb6c36 100644 --- a/Marlin/src/lcd/tft/ui_color_ui.cpp +++ b/Marlin/src/lcd/tft/ui_color_ui.cpp @@ -323,7 +323,7 @@ void MarlinUI::draw_status_screen() { if (cm && pa) add_control(SDCARD_ICON_X, SDCARD_ICON_Y, STOP, imgCancel, true, COLOR_CONTROL_CANCEL); else - add_control(SDCARD_ICON_X, SDCARD_ICON_Y, menu_media, imgSD, cm && !pa, COLOR_CONTROL_ENABLED, COLOR_CONTROL_DISABLED); + add_control(SDCARD_ICON_X, SDCARD_ICON_Y, menu_file_selector, imgSD, cm && !pa, COLOR_CONTROL_ENABLED, COLOR_CONTROL_DISABLED); #endif #endif From 85f6090f2046d2c616f333c3d8df538405af8315 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 26 Apr 2025 17:54:54 -0500 Subject: [PATCH 69/86] =?UTF-8?q?=F0=9F=94=A7=20Apply=20DEFAULT=5FVOLUME?= =?UTF-8?q?=20on=20boot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 3 ++- Marlin/src/HAL/STM32/sd/msc_sd.cpp | 1 + Marlin/src/inc/Changes.h | 28 +++++++++++++++++++++++++++ Marlin/src/inc/Conditionals-4-adv.h | 9 +++++---- Marlin/src/inc/SanityCheck.h | 16 ++++++++++++--- Marlin/src/sd/cardreader.cpp | 30 ++++++++++++++--------------- 6 files changed, 64 insertions(+), 23 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index b1ad8d9629..a48a337270 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1960,7 +1960,8 @@ #if ENABLED(MULTI_VOLUME) #define VOLUME_SD_ONBOARD #define VOLUME_USB_FLASH_DRIVE - #define DEFAULT_SHARED_VOLUME SV_USB_FLASH_DRIVE + #define DEFAULT_VOLUME SD_ONBOARD // :[ 'SD_ONBOARD', 'USB_FLASH_DRIVE' ] + #define DEFAULT_SHARED_VOLUME USB_FLASH_DRIVE // :[ 'SD_ONBOARD', 'USB_FLASH_DRIVE' ] #endif #endif // HAS_MEDIA diff --git a/Marlin/src/HAL/STM32/sd/msc_sd.cpp b/Marlin/src/HAL/STM32/sd/msc_sd.cpp index f198b3e49a..9bb65aab4a 100644 --- a/Marlin/src/HAL/STM32/sd/msc_sd.cpp +++ b/Marlin/src/HAL/STM32/sd/msc_sd.cpp @@ -48,6 +48,7 @@ class Sd2CardUSBMscHandler : public USBMscHandler { public: DiskIODriver* diskIODriver() { + // TODO: Explore a variable shared volume, or auto share the un-mounted volume(s) #if HAS_MULTI_VOLUME #if SHARED_VOLUME_IS(SD_ONBOARD) return &card.media_driver_sdcard; diff --git a/Marlin/src/inc/Changes.h b/Marlin/src/inc/Changes.h index abd7db8011..839804d920 100644 --- a/Marlin/src/inc/Changes.h +++ b/Marlin/src/inc/Changes.h @@ -799,3 +799,31 @@ #undef _POWERSTEP01 #undef _TMC26X #undef _TMC26X_STANDALONE + +#if ENABLED(MULTI_VOLUME) + // Change to a generic ID without SV_ prefix + #define SV_SD_ONBOARD 201 + #define SV_USB_FLASH_DRIVE 202 + #if DEFAULT_VOLUME_IS(SV_SD_ONBOARD) || SHARED_VOLUME_IS(SV_SD_ONBOARD) + #error "SV_SD_ONBOARD is now SD_ONBOARD." + #elif DEFAULT_VOLUME_IS(SV_USB_FLASH_DRIVE) || SHARED_VOLUME_IS(SV_USB_FLASH_DRIVE) + #error "SV_USB_FLASH_DRIVE is now USB_FLASH_DRIVE." + #endif + // Skip less clear "bad value" errors in inc/SanityCheck.h + #if DEFAULT_VOLUME_IS(SV_SD_ONBOARD) + #undef DEFAULT_VOLUME + #define DEFAULT_VOLUME SD_ONBOARD + #elif DEFAULT_VOLUME_IS(SV_USB_FLASH_DRIVE) + #undef DEFAULT_VOLUME + #define DEFAULT_VOLUME USB_FLASH_DRIVE + #endif + #if SHARED_VOLUME_IS(SV_SD_ONBOARD) + #undef DEFAULT_SHARED_VOLUME + #define DEFAULT_SHARED_VOLUME SD_ONBOARD + #elif SHARED_VOLUME_IS(SV_USB_FLASH_DRIVE) + #undef DEFAULT_SHARED_VOLUME + #define DEFAULT_SHARED_VOLUME USB_FLASH_DRIVE + #endif + #undef SV_SD_ONBOARD + #undef SV_USB_FLASH_DRIVE +#endif diff --git a/Marlin/src/inc/Conditionals-4-adv.h b/Marlin/src/inc/Conditionals-4-adv.h index a9427c3605..629ee98273 100644 --- a/Marlin/src/inc/Conditionals-4-adv.h +++ b/Marlin/src/inc/Conditionals-4-adv.h @@ -1248,11 +1248,12 @@ #if ENABLED(MULTI_VOLUME) #define HAS_MULTI_VOLUME 1 - #define SV_SD_ONBOARD 101 - #define SV_USB_FLASH_DRIVE 102 - #define _VOLUME_ID(N) _CAT(SV_, N) - #define SHARED_VOLUME_IS(N) (DEFAULT_SHARED_VOLUME == _VOLUME_ID(N)) + #define SD_ONBOARD 101 + #define USB_FLASH_DRIVE 102 + #define DEFAULT_VOLUME_IS(N) (DEFAULT_VOLUME == N) + #define SHARED_VOLUME_IS(N) (DEFAULT_SHARED_VOLUME == N) #else + #define DEFAULT_VOLUME_IS(...) 0 #define SHARED_VOLUME_IS(...) 0 #endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 074cfe0dcb..cff241db72 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -416,10 +416,20 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L /** * SD Card Settings */ -#if ALL(HAS_MEDIA, HAS_SD_DETECT, SD_CONNECTION_TYPICAL, ELB_FULL_GRAPHIC_CONTROLLER, HAS_MARLINUI_MENU) && SD_DETECT_STATE == LOW - #error "SD_DETECT_STATE must be set HIGH for SD on the ELB_FULL_GRAPHIC_CONTROLLER." +#if HAS_MEDIA + #if HAS_MULTI_VOLUME + #if !(DEFAULT_VOLUME_IS(SD_ONBOARD) || DEFAULT_VOLUME_IS(USB_FLASH_DRIVE)) + #error "DEFAULT_VOLUME must be either SD_ONBOARD or USB_FLASH_DRIVE." + #endif + #if !(SHARED_VOLUME_IS(SD_ONBOARD) || SHARED_VOLUME_IS(USB_FLASH_DRIVE)) + #error "DEFAULT_SHARED_VOLUME must be either SD_ONBOARD or USB_FLASH_DRIVE." + #endif + #endif + #if ALL(ELB_FULL_GRAPHIC_CONTROLLER, HAS_MARLINUI_MENU, SD_CONNECTION_TYPICAL, HAS_SD_DETECT) && SD_DETECT_STATE == LOW + #error "SD_DETECT_STATE must be set HIGH for SD on the ELB_FULL_GRAPHIC_CONTROLLER." + #endif + #undef SD_CONNECTION_TYPICAL #endif -#undef SD_CONNECTION_TYPICAL /** * SD File Sorting diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index 5502561ea4..b7d6f70f65 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -28,10 +28,6 @@ #if HAS_MEDIA -#if HAS_MULTI_VOLUME && !SHARED_VOLUME_IS(SD_ONBOARD) && !SHARED_VOLUME_IS(USB_FLASH_DRIVE) - #error "DEFAULT_SHARED_VOLUME must be either SV_SD_ONBOARD or SV_USB_FLASH_DRIVE." -#endif - //#define DEBUG_CARDREADER #include "cardreader.h" @@ -144,7 +140,13 @@ int16_t CardReader::nrItems = -1; DiskIODriver_USBFlash CardReader::media_driver_usbFlash; #endif -DiskIODriver* CardReader::driver = nullptr; +DiskIODriver* CardReader::driver = ( + #if HAS_USB_FLASH_DRIVE && !DEFAULT_VOLUME_IS(SD_ONBOARD) + &CardReader::media_driver_usbFlash + #else + &CardReader::media_driver_sdcard + #endif +); MarlinVolume CardReader::volume; MediaFile CardReader::myfile; @@ -158,12 +160,6 @@ MediaFile CardReader::myfile; uint32_t CardReader::filesize, CardReader::sdpos; CardReader::CardReader() { - #if HAS_USB_FLASH_DRIVE && !SHARED_VOLUME_IS(SD_ONBOARD) - selectMediaFlashDrive(); - #else - selectMediaSDCard(); - #endif - #if ENABLED(SDCARD_SORT_ALPHA) sort_count = 0; #if ENABLED(SDSORT_GCODE) @@ -604,11 +600,15 @@ void CardReader::manage_media() { // Try to mount the media (but not at boot if SD_IGNORE_AT_STARTUP) if (TERN1(SD_IGNORE_AT_STARTUP, old_stat > MEDIA_BOOT)) { + // If both SD/FD mount simultaneously prefer the default #if HAS_MULTI_VOLUME - if ((vadd & INSERT_SD) && !isSDCardSelected()) - selectMediaSDCard(); - if ((vadd & INSERT_USB) && !isFlashDriveSelected()) - selectMediaFlashDrive(); + #if HAS_USB_FLASH_DRIVE && !DEFAULT_VOLUME_IS(SD_ONBOARD) + if (vadd & INSERT_USB) selectMediaFlashDrive(); + else if (vadd & INSERT_SD) selectMediaSDCard(); + #else + if (vadd & INSERT_SD) selectMediaSDCard(); + else if (vadd & INSERT_USB) selectMediaFlashDrive(); + #endif #endif safe_delay(500); // Time for inserted media to settle. May re-enter for multiple media? mount(); From 827c03b05648ea994496319d0e00904c587d0c8f Mon Sep 17 00:00:00 2001 From: Norman Chong <8681541+Grenite@users.noreply.github.com> Date: Mon, 28 Apr 2025 23:18:59 -0400 Subject: [PATCH 70/86] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20Ultimain=202=20MOTOR?= =?UTF-8?q?=5FCURRENT=5FPWM=5FRANGE=20(#27705)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/ramps/pins_ULTIMAIN_2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h b/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h index 4633bfc037..b7b04352d0 100644 --- a/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h +++ b/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h @@ -85,7 +85,7 @@ #define MOTOR_CURRENT_PWM_E_PIN 46 // Motor current PWM conversion, PWM value = MotorCurrentSetting * 255 / range #ifndef MOTOR_CURRENT_PWM_RANGE - #define MOTOR_CURRENT_PWM_RANGE 2000 + #define MOTOR_CURRENT_PWM_RANGE 2900 #endif #define DEFAULT_PWM_MOTOR_CURRENT {1300, 1300, 1250} From fea70777df6cd61aad0035bd13e89430284b8334 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 29 Apr 2025 06:10:06 +0000 Subject: [PATCH 71/86] [cron] Bump distribution date (2025-04-29) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index d48398ed22..da4a399ef0 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 "2025-04-27" +//#define STRING_DISTRIBUTION_DATE "2025-04-29" /** * The protocol for communication to the host. Protocol indicates communication diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index f3a12580c9..c4282ea03a 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 "2025-04-27" + #define STRING_DISTRIBUTION_DATE "2025-04-29" #endif /** From 585cbbb20316b75f70514b340339601ba37d70ab Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 29 Apr 2025 13:41:53 -0500 Subject: [PATCH 72/86] =?UTF-8?q?=F0=9F=A9=B9=20Minor=20ExtUI/DGUS=20code?= =?UTF-8?q?=20fix/cleanup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp | 6 ++---- Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp | 6 ++---- Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp | 6 ++---- Marlin/src/lcd/extui/dgus_e3s1pro/dgus_e3s1pro_extui.cpp | 6 ++---- Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp | 2 +- Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp | 6 ++---- Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp | 6 ++---- Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp | 6 ++---- Marlin/src/lcd/extui/nextion/nextion_extui.cpp | 6 ++---- 9 files changed, 17 insertions(+), 33 deletions(-) diff --git a/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp b/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp index b983fa3740..83db56ae20 100644 --- a/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp +++ b/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp @@ -70,13 +70,11 @@ namespace ExtUI { void onUserConfirmRequired(const char * const msg) { chiron.confirmationRequest(msg); } // For fancy LCDs include an icon ID, message, and translated button title - void onUserConfirmRequired(const int icon, const char * const cstr, FSTR_P const fBtn) { + void onUserConfirmRequired(const int, const char * const cstr, FSTR_P const) { onUserConfirmRequired(cstr); - UNUSED(icon); UNUSED(fBtn); } - void onUserConfirmRequired(const int icon, FSTR_P const fstr, FSTR_P const fBtn) { + void onUserConfirmRequired(const int, FSTR_P const fstr, FSTR_P const) { onUserConfirmRequired(fstr); - UNUSED(icon); UNUSED(fBtn); } #if ENABLED(ADVANCED_PAUSE_FEATURE) diff --git a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp index 7070c22602..d6dc4002b1 100644 --- a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp +++ b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp @@ -58,13 +58,11 @@ namespace ExtUI { void onUserConfirmRequired(const char * const msg) { anycubicTFT.onUserConfirmRequired(msg); } // For fancy LCDs include an icon ID, message, and translated button title - void onUserConfirmRequired(const int icon, const char * const cstr, FSTR_P const fBtn) { + void onUserConfirmRequired(const int, const char * const cstr, FSTR_P const) { onUserConfirmRequired(cstr); - UNUSED(icon); UNUSED(fBtn); } - void onUserConfirmRequired(const int icon, FSTR_P const fstr, FSTR_P const fBtn) { + void onUserConfirmRequired(const int, FSTR_P const fstr, FSTR_P const) { onUserConfirmRequired(fstr); - UNUSED(icon); UNUSED(fBtn); } #if ENABLED(ADVANCED_PAUSE_FEATURE) diff --git a/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp b/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp index 5fbe813446..8cd6e89ef1 100644 --- a/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp +++ b/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp @@ -70,13 +70,11 @@ namespace ExtUI { void onUserConfirmRequired(const char * const msg) { dgus.confirmationRequest(msg); } // For fancy LCDs include an icon ID, message, and translated button title - void onUserConfirmRequired(const int icon, const char * const cstr, FSTR_P const fBtn) { + void onUserConfirmRequired(const int, const char * const cstr, FSTR_P const) { onUserConfirmRequired(cstr); - UNUSED(icon); UNUSED(fBtn); } - void onUserConfirmRequired(const int icon, FSTR_P const fstr, FSTR_P const fBtn) { + void onUserConfirmRequired(const int, FSTR_P const fstr, FSTR_P const) { onUserConfirmRequired(fstr); - UNUSED(icon); UNUSED(fBtn); } #if ENABLED(ADVANCED_PAUSE_FEATURE) diff --git a/Marlin/src/lcd/extui/dgus_e3s1pro/dgus_e3s1pro_extui.cpp b/Marlin/src/lcd/extui/dgus_e3s1pro/dgus_e3s1pro_extui.cpp index 3b3f6db5b2..20012b689f 100644 --- a/Marlin/src/lcd/extui/dgus_e3s1pro/dgus_e3s1pro_extui.cpp +++ b/Marlin/src/lcd/extui/dgus_e3s1pro/dgus_e3s1pro_extui.cpp @@ -88,13 +88,11 @@ namespace ExtUI { } // For fancy LCDs include an icon ID, message, and translated button title - void onUserConfirmRequired(const int icon, const char * const cstr, FSTR_P const fBtn) { + void onUserConfirmRequired(const int, const char * const cstr, FSTR_P const) { onUserConfirmRequired(cstr); - UNUSED(icon); UNUSED(fBtn); } - void onUserConfirmRequired(const int icon, FSTR_P const fstr, FSTR_P const fBtn) { + void onUserConfirmRequired(const int, FSTR_P const fstr, FSTR_P const) { onUserConfirmRequired(fstr); - UNUSED(icon); UNUSED(fBtn); } #if ENABLED(ADVANCED_PAUSE_FEATURE) diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp index a0551fa28c..e195654caa 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp @@ -503,7 +503,7 @@ void DGUSRxHandler::probe(DGUS_VP &vp, void *data_ptr) { UNUSED(data_ptr); #if ENABLED(MESH_BED_LEVELING) - screen.setStatusMessage(FPSTR(DGUS_MSG_ABL_REQUIRED)); + screen.setStatusMessage(GET_TEXT_F(DGUS_MSG_ABL_REQUIRED)); return; #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 9aeb06dba1..e8ee497297 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp @@ -83,13 +83,11 @@ namespace ExtUI { } // For fancy LCDs include an icon ID, message, and translated button title - void onUserConfirmRequired(const int icon, const char * const cstr, FSTR_P const fBtn) { + void onUserConfirmRequired(const int, const char * const cstr, FSTR_P const) { onUserConfirmRequired(cstr); - UNUSED(icon); UNUSED(fBtn); } - void onUserConfirmRequired(const int icon, FSTR_P const fstr, FSTR_P const fBtn) { + void onUserConfirmRequired(const int, FSTR_P const fstr, FSTR_P const) { onUserConfirmRequired(fstr); - UNUSED(icon); UNUSED(fBtn); } #if ENABLED(ADVANCED_PAUSE_FEATURE) 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 c26a809037..2f9da20ecc 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 @@ -133,13 +133,11 @@ namespace ExtUI { #endif // For fancy LCDs include an icon ID, message, and translated button title - void onUserConfirmRequired(const int icon, const char * const cstr, FSTR_P const fBtn) { + void onUserConfirmRequired(const int, const char * const cstr, FSTR_P const) { onUserConfirmRequired(cstr); - UNUSED(icon); UNUSED(fBtn); } - void onUserConfirmRequired(const int icon, FSTR_P const fstr, FSTR_P const fBtn) { + void onUserConfirmRequired(const int, FSTR_P const fstr, FSTR_P const) { onUserConfirmRequired(fstr); - UNUSED(icon); UNUSED(fBtn); } #if ENABLED(ADVANCED_PAUSE_FEATURE) 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 4a1d49a020..86a19f6089 100644 --- a/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp +++ b/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp @@ -233,13 +233,11 @@ void onUserConfirmRequired(const char *const msg) { } // For fancy LCDs include an icon ID, message, and translated button title -void onUserConfirmRequired(const int icon, const char * const cstr, FSTR_P const fBtn) { +void onUserConfirmRequired(const int, const char * const cstr, FSTR_P const) { onUserConfirmRequired(cstr); - UNUSED(icon); UNUSED(fBtn); } -void onUserConfirmRequired(const int icon, FSTR_P const fstr, FSTR_P const fBtn) { +void onUserConfirmRequired(const int, FSTR_P const fstr, FSTR_P const) { onUserConfirmRequired(fstr); - UNUSED(icon); UNUSED(fBtn); } #if ENABLED(ADVANCED_PAUSE_FEATURE) diff --git a/Marlin/src/lcd/extui/nextion/nextion_extui.cpp b/Marlin/src/lcd/extui/nextion/nextion_extui.cpp index 570624afcc..7beecfecbf 100644 --- a/Marlin/src/lcd/extui/nextion/nextion_extui.cpp +++ b/Marlin/src/lcd/extui/nextion/nextion_extui.cpp @@ -56,13 +56,11 @@ namespace ExtUI { void onUserConfirmRequired(const char * const msg) { nextion.confirmationRequest(msg); } // For fancy LCDs include an icon ID, message, and translated button title - void onUserConfirmRequired(const int icon, const char * const cstr, FSTR_P const fBtn) { + void onUserConfirmRequired(const int, const char * const cstr, FSTR_P const) { onUserConfirmRequired(cstr); - UNUSED(icon); UNUSED(fBtn); } - void onUserConfirmRequired(const int icon, FSTR_P const fstr, FSTR_P const fBtn) { + void onUserConfirmRequired(const int, FSTR_P const fstr, FSTR_P const) { onUserConfirmRequired(fstr); - UNUSED(icon); UNUSED(fBtn); } #if ENABLED(ADVANCED_PAUSE_FEATURE) From e3433ea5996a8e0b3e3c9f9673464d99ac23a812 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Wed, 30 Apr 2025 00:30:45 +0000 Subject: [PATCH 73/86] [cron] Bump distribution date (2025-04-30) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index da4a399ef0..31c1157635 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 "2025-04-29" +//#define STRING_DISTRIBUTION_DATE "2025-04-30" /** * The protocol for communication to the host. Protocol indicates communication diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index c4282ea03a..b823785698 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 "2025-04-29" + #define STRING_DISTRIBUTION_DATE "2025-04-30" #endif /** From 1c719fd10de836efa01d71bf0208ecc40f607f3e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 30 Apr 2025 10:21:13 -0500 Subject: [PATCH 74/86] =?UTF-8?q?=F0=9F=8E=A8=20Cosmetic=2004-29?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/extui/mks_ui/draw_dialog.cpp | 2 +- Marlin/src/lcd/menu/menu_main.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Marlin/src/lcd/extui/mks_ui/draw_dialog.cpp b/Marlin/src/lcd/extui/mks_ui/draw_dialog.cpp index 8713bf8909..1989724370 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_dialog.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_dialog.cpp @@ -123,7 +123,7 @@ static void btn_ok_event_cb(lv_obj_t *btn, lv_event_t event) { #endif } else if (DIALOG_IS(TYPE_FINISH_PRINT)) { - uiCfg.print_state = IDLE; + uiCfg.print_state = IDLE; clear_cur_ui(); lv_draw_ready_print(); } diff --git a/Marlin/src/lcd/menu/menu_main.cpp b/Marlin/src/lcd/menu/menu_main.cpp index 04bbc41074..401c59f5c0 100644 --- a/Marlin/src/lcd/menu/menu_main.cpp +++ b/Marlin/src/lcd/menu/menu_main.cpp @@ -351,11 +351,11 @@ void menu_main() { ACTION_ITEM(MSG_NO_MEDIA, nullptr); // [No Media] } else { - #if ALL(HAS_MULTI_VOLUME, SHOW_UNMOUNTED_DRIVES) + #if ENABLED(SHOW_UNMOUNTED_DRIVES) // [Select from SD/USB] (or Password First) - if (TERN0(SHOW_UNMOUNTED_DRIVES, card.isSDCardInserted())) + if (card.isSDCardInserted()) SUBMENU(MSG_MEDIA_MENU_SD, MEDIA_MENU_GATEWAY_SD); - if (TERN0(SHOW_UNMOUNTED_DRIVES, card.isFlashDriveInserted())) + if (card.isFlashDriveInserted()) SUBMENU(MSG_MEDIA_MENU_USB, MEDIA_MENU_GATEWAY_USB); #else #define M21(T) F("M21" TERN_(HAS_MULTI_VOLUME, T)) From 48cc310c588b8ab52cffdc8f86855a05a4b20122 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Thu, 1 May 2025 07:37:11 +1200 Subject: [PATCH 75/86] =?UTF-8?q?=F0=9F=94=A7=20More=20thorough=20TEMP=5FS?= =?UTF-8?q?ENSOR=5F*=20cleanup=20(#27826)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Conditionals-3-etc.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Marlin/src/inc/Conditionals-3-etc.h b/Marlin/src/inc/Conditionals-3-etc.h index e4dcdda58f..2456728554 100644 --- a/Marlin/src/inc/Conditionals-3-etc.h +++ b/Marlin/src/inc/Conditionals-3-etc.h @@ -42,30 +42,32 @@ // Clean up unused temperature sensors and sub-options -#if !TEMP_SENSOR_0 +#define UNUSED_TEMP_SENSOR(N) (!TEMP_SENSOR_##N || N >= HOTENDS) +#if UNUSED_TEMP_SENSOR(0) #undef TEMP_SENSOR_0 #endif -#if !TEMP_SENSOR_1 +#if UNUSED_TEMP_SENSOR(1) #undef TEMP_SENSOR_1 #endif -#if !TEMP_SENSOR_2 +#if UNUSED_TEMP_SENSOR(2) #undef TEMP_SENSOR_2 #endif -#if !TEMP_SENSOR_3 +#if UNUSED_TEMP_SENSOR(3) #undef TEMP_SENSOR_3 #endif -#if !TEMP_SENSOR_4 +#if UNUSED_TEMP_SENSOR(4) #undef TEMP_SENSOR_4 #endif -#if !TEMP_SENSOR_5 +#if UNUSED_TEMP_SENSOR(5) #undef TEMP_SENSOR_5 #endif -#if !TEMP_SENSOR_6 +#if UNUSED_TEMP_SENSOR(6) #undef TEMP_SENSOR_6 #endif -#if !TEMP_SENSOR_7 +#if UNUSED_TEMP_SENSOR(7) #undef TEMP_SENSOR_7 #endif +#undef UNUSED_TEMP_SENSOR #if !TEMP_SENSOR_BED #undef TEMP_SENSOR_BED From 4096beaf527e3dfa27f12cc7cfff6502f94ef2ca Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Thu, 1 May 2025 00:34:50 +0000 Subject: [PATCH 76/86] [cron] Bump distribution date (2025-05-01) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 31c1157635..a2ef14eecd 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 "2025-04-30" +//#define STRING_DISTRIBUTION_DATE "2025-05-01" /** * The protocol for communication to the host. Protocol indicates communication diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index b823785698..618bca9810 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 "2025-04-30" + #define STRING_DISTRIBUTION_DATE "2025-05-01" #endif /** From e16885c558e8c03b43f2127780a4ec15ee29dd1e Mon Sep 17 00:00:00 2001 From: staff1010 <132726146+staff1010@users.noreply.github.com> Date: Sat, 3 May 2025 00:13:26 +0800 Subject: [PATCH 77/86] =?UTF-8?q?=F0=9F=9A=B8=20Fix=20MKS=20UI=20G-code=20?= =?UTF-8?q?result=20display=20(#27825)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/lcd/extui/mks_ui/draw_gcode.cpp | 25 +++++++--- Marlin/src/lcd/extui/mks_ui/draw_gcode.h | 1 + Marlin/src/lcd/extui/mks_ui/draw_keyboard.cpp | 2 +- .../src/lcd/extui/mks_ui/draw_move_motor.cpp | 24 +++++---- Marlin/src/lcd/extui/mks_ui/draw_ui.cpp | 8 +++ .../lcd/extui/mks_ui/draw_z_offset_wizard.cpp | 24 +++++---- Marlin/src/lcd/extui/mks_ui/wifi_module.cpp | 49 +++++++------------ 7 files changed, 70 insertions(+), 63 deletions(-) diff --git a/Marlin/src/lcd/extui/mks_ui/draw_gcode.cpp b/Marlin/src/lcd/extui/mks_ui/draw_gcode.cpp index 8a3366e01d..68c5cd22d4 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_gcode.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_gcode.cpp @@ -34,6 +34,7 @@ static lv_obj_t *scr, *outL, *outV = 0; static int currentWritePos = 0; extern uint8_t public_buf[513]; extern "C" { extern char public_buf_m[100]; } +extern bool gcode_output_update_flag; enum { ID_GCODE_RETURN = 1, @@ -43,6 +44,8 @@ enum { static void event_handler(lv_obj_t *obj, lv_event_t event) { if (event != LV_EVENT_RELEASED) return; lv_clear_gcode(); + public_buf[0] = public_buf_m[0] = 0; // Clear output buffer + MYSERIAL1.setHook(); switch (obj->mks_obj_id) { case ID_GCODE_RETURN: lv_draw_more(); @@ -56,20 +59,22 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { void lv_show_gcode_output(void * that, const char * txt) { // Ignore echo of command - if (!memcmp(txt, "echo:", 5)) { - public_buf[0] = 0; // Clear output buffer + if (txt[0] == 'e' && txt[4] == ':') { // !memcmp_P(txt, PSTR("echo:"), 5) + public_buf[0] = public_buf_m[0] = 0; // Clear output buffer return; } // Avoid overflow if the answer is too large size_t len = strlen((const char*)public_buf), tlen = strlen(txt); - if (len + tlen + 1 < sizeof(public_buf)) { + if (len + tlen + 2 <= sizeof(public_buf)) { memcpy(public_buf + len, txt, tlen); public_buf[len + tlen] = '\n'; + public_buf[len + tlen + 1] = '\0'; } } void lv_serial_capt_hook(void * userPointer, uint8_t c) { + gcode_output_update_flag = false; if (c == '\n' || currentWritePos == sizeof(public_buf_m) - 1) { // End of line, probably end of command anyway public_buf_m[currentWritePos] = 0; lv_show_gcode_output(userPointer, public_buf_m); @@ -82,17 +87,21 @@ void lv_serial_capt_hook(void * userPointer, uint8_t c) { void lv_eom_hook(void *) { // Message is done, let's remove the hook now MYSERIAL1.setHook(); + // Update message display + gcode_output_update_flag = true; } void lv_draw_gcode(bool clear) { if (clear) { currentWritePos = 0; - public_buf[0] = 0; + public_buf[0] = public_buf_m[0] = 0; + MYSERIAL1.setHook(); + gcode_output_update_flag = false; } scr = lv_screen_create(GCODE_UI, more_menu.gcode); - lv_screen_menu_item(scr, more_menu.entergcode, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_GCODE_COMMAND, 1); + lv_screen_menu_item(scr, more_menu.entergcode, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_GCODE_COMMAND, 0); outL = lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 2, "Result:"); - outV = lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 3, (const char*)public_buf); + outV = lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 2 + 20, (const char*)public_buf); lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X + 10, PARA_UI_BACK_POS_Y, event_handler, ID_GCODE_RETURN, true); } @@ -105,4 +114,8 @@ void lv_clear_gcode() { outV = 0; } +void disp_gcode_output() { + lv_label_set_text(outV, (const char*)public_buf); +} + #endif // HAS_TFT_LVGL_UI diff --git a/Marlin/src/lcd/extui/mks_ui/draw_gcode.h b/Marlin/src/lcd/extui/mks_ui/draw_gcode.h index df752e7cc9..0cb19fb1ad 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_gcode.h +++ b/Marlin/src/lcd/extui/mks_ui/draw_gcode.h @@ -27,6 +27,7 @@ void lv_draw_gcode(bool clear = false); void lv_clear_gcode(); +void disp_gcode_output(); #ifdef __cplusplus } /* C-declarations for C++ */ diff --git a/Marlin/src/lcd/extui/mks_ui/draw_keyboard.cpp b/Marlin/src/lcd/extui/mks_ui/draw_keyboard.cpp index ec7e549c41..0d049a2f64 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_keyboard.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_keyboard.cpp @@ -160,7 +160,7 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) { goto_previous_ui(); break; case GCodeCommand: - if (ret_ta_txt[0] && !queue.ring_buffer.full(3)) { + if (ret_ta_txt[0]) { // Hook for the next bytes to arrive from the serial port MYSERIAL1.setHook(lv_serial_capt_hook, lv_eom_hook, 0); // Run the command as soon as possible diff --git a/Marlin/src/lcd/extui/mks_ui/draw_move_motor.cpp b/Marlin/src/lcd/extui/mks_ui/draw_move_motor.cpp index 635421b4c3..aa9fbdcd95 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_move_motor.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_move_motor.cpp @@ -59,19 +59,17 @@ void disp_cur_pos() { static void event_handler(lv_obj_t *obj, lv_event_t event) { char str_1[16]; if (event != LV_EVENT_RELEASED) return; - if (!queue.ring_buffer.full(3)) { - bool do_inject = true; - float dist = uiCfg.move_dist; - switch (obj->mks_obj_id) { - case ID_M_X_N: dist *= -1; case ID_M_X_P: cur_label = 'X'; break; - case ID_M_Y_N: dist *= -1; case ID_M_Y_P: cur_label = 'Y'; break; - case ID_M_Z_N: dist *= -1; case ID_M_Z_P: cur_label = 'Z'; break; - default: do_inject = false; - } - if (do_inject) { - sprintf_P(public_buf_l, PSTR("G91\nG1 %c%s F%d\nG90"), cur_label, dtostrf(dist, 1, 3, str_1), uiCfg.moveSpeed); - queue.inject(public_buf_l); - } + bool do_inject = true; + float dist = uiCfg.move_dist; + switch (obj->mks_obj_id) { + case ID_M_X_N: dist *= -1; case ID_M_X_P: cur_label = 'X'; break; + case ID_M_Y_N: dist *= -1; case ID_M_Y_P: cur_label = 'Y'; break; + case ID_M_Z_N: dist *= -1; case ID_M_Z_P: cur_label = 'Z'; break; + default: do_inject = false; + } + if (do_inject) { + sprintf_P(public_buf_l, PSTR("G91\nG1 %c%s F%d\nG90"), cur_label, dtostrf(dist, 1, 3, str_1), uiCfg.moveSpeed); + queue.inject(public_buf_l); } switch (obj->mks_obj_id) { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp b/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp index 2e66db2c86..4278092472 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp @@ -71,6 +71,7 @@ uint32_t size = 809; uint16_t row; bool temps_update_flag; uint8_t printing_rate_update_flag; +bool gcode_output_update_flag; extern bool once_flag; extern uint8_t sel_id; @@ -864,6 +865,13 @@ void GUI_RefreshPage() { } break; + case GCODE_UI: + if (gcode_output_update_flag) { + gcode_output_update_flag = false; + disp_gcode_output(); + } + break; + default: break; } 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 9d16c9dff2..cdd151322b 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 @@ -73,19 +73,17 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { char str_1[16]; if (event != LV_EVENT_RELEASED) return; //lv_clear_z_offset_wizard(); - if (!queue.ring_buffer.full(3)) { - bool do_inject = true; - float dist = uiCfg.move_dist; - switch (obj->mks_obj_id) { - case ID_M_Z_N: dist *= -1; case ID_M_Z_P: cur_label = 'Z'; break; - default: do_inject = false; - } - if (do_inject) { - sprintf_P(public_buf_l, PSTR("G91\nG1 %c%s F%d\nG90"), cur_label, dtostrf(dist, 1, 3, str_1), uiCfg.moveSpeed); - queue.inject(public_buf_l); - //calculated_z_offset = probe.offset.z + current_position.z - z_offset_ref; - disp_cur_wizard_pos(); - } + bool do_inject = true; + float dist = uiCfg.move_dist; + switch (obj->mks_obj_id) { + case ID_M_Z_N: dist *= -1; case ID_M_Z_P: cur_label = 'Z'; break; + default: do_inject = false; + } + if (do_inject) { + sprintf_P(public_buf_l, PSTR("G91\nG1 %c%s F%d\nG90"), cur_label, dtostrf(dist, 1, 3, str_1), uiCfg.moveSpeed); + queue.inject(public_buf_l); + //calculated_z_offset = probe.offset.z + current_position.z - z_offset_ref; + disp_cur_wizard_pos(); } switch (obj->mks_obj_id) { diff --git a/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp b/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp index 1bc1e043d9..e6adbcbc03 100644 --- a/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp +++ b/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp @@ -770,8 +770,9 @@ int package_to_wifi(WIFI_RET_TYPE type, uint8_t *buf, int len) { } int send_to_wifi(uint8_t * const buf, const int len) { return package_to_wifi(WIFI_TRANS_INF, buf, len); } +int print_to_wifi(const char * const buf) { return package_to_wifi(WIFI_TRANS_INF, (uint8_t*)buf, strlen(buf)); } -inline void send_ok_to_wifi() { send_to_wifi((uint8_t *)"ok\r\n", strlen("ok\r\n")); } +inline void send_ok_to_wifi() { print_to_wifi("ok\r\n"); } void set_cur_file_sys(int fileType) { gCfgItems.fileSysType = fileType; } @@ -905,7 +906,7 @@ uint8_t exploreDisk(const char * const path, const uint8_t recu_level, const boo } strcat_P(Fstream, PSTR("\r\n")); - send_to_wifi((uint8_t*)Fstream, strlen(Fstream)); + print_to_wifi(Fstream); } return fileCnt; @@ -950,9 +951,9 @@ static void wifi_gcode_exec(uint8_t * const cmd_line) { int index = 0; if (spStr == nullptr) { gCfgItems.fileSysType = FILE_SYS_SD; - send_to_wifi((uint8_t *)(STR_BEGIN_FILE_LIST "\r\n"), strlen(STR_BEGIN_FILE_LIST "\r\n")); + print_to_wifi(STR_BEGIN_FILE_LIST "\r\n"); get_file_list("0:/", false); - send_to_wifi((uint8_t *)(STR_END_FILE_LIST "\r\n"), strlen(STR_END_FILE_LIST "\r\n")); + print_to_wifi(STR_END_FILE_LIST "\r\n"); send_ok_to_wifi(); break; } @@ -962,7 +963,7 @@ static void wifi_gcode_exec(uint8_t * const cmd_line) { if (gCfgItems.wifi_type == ESP_WIFI) { char * const path = (char *)tempBuf; if (strlen(&mStr[index]) < 80) { - send_to_wifi((uint8_t *)(STR_BEGIN_FILE_LIST "\r\n"), strlen(STR_BEGIN_FILE_LIST "\r\n")); + print_to_wifi(STR_BEGIN_FILE_LIST "\r\n"); if (strncmp(&mStr[index], "1:", 2) == 0) gCfgItems.fileSysType = FILE_SYS_SD; @@ -972,7 +973,7 @@ static void wifi_gcode_exec(uint8_t * const cmd_line) { strcpy(path, &mStr[index]); const bool with_longnames = strchr(mStr, 'L') != nullptr; get_file_list(path, with_longnames); - send_to_wifi((uint8_t *)(STR_END_FILE_LIST "\r\n"), strlen(STR_END_FILE_LIST "\r\n")); + print_to_wifi(STR_END_FILE_LIST "\r\n"); } send_ok_to_wifi(); } @@ -1033,9 +1034,9 @@ static void wifi_gcode_exec(uint8_t * const cmd_line) { card.openFileRead(cur_name); if (card.isFileOpen()) - send_to_wifi((uint8_t *)"File selected\r\n", strlen("File selected\r\n")); + print_to_wifi("File selected\r\n"); else { - send_to_wifi((uint8_t *)"file.open failed\r\n", strlen("file.open failed\r\n")); + print_to_wifi("file.open failed\r\n"); strcpy_P(list_file.file_name[sel_id], PSTR("notValid")); } send_ok_to_wifi(); @@ -1149,7 +1150,7 @@ static void wifi_gcode_exec(uint8_t * const cmd_line) { print_rate = uiCfg.totalSend; ZERO(tempBuf); sprintf_P((char *)tempBuf, PSTR("M27 %d\r\n"), print_rate); - send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf)); + print_to_wifi(tempBuf); } break; @@ -1182,7 +1183,7 @@ static void wifi_gcode_exec(uint8_t * const cmd_line) { ZERO(tempBuf); sprintf_P((char *)tempBuf, PSTR("Writing to file: %s\r\n"), (char *)file_writer.saveFileName); wifi_ret_ack(); - send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf)); + print_to_wifi(tempBuf); wifi_link_state = WIFI_WAIT_TRANS_START; } else { @@ -1246,7 +1247,7 @@ static void wifi_gcode_exec(uint8_t * const cmd_line) { ); } - send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf)); + print_to_wifi(tempBuf); queue.enqueue_one(F("M105")); break; @@ -1255,7 +1256,7 @@ static void wifi_gcode_exec(uint8_t * const cmd_line) { ZERO(tempBuf); sprintf_P((char *)tempBuf, PSTR("M992 %d%d:%d%d:%d%d\r\n"), print_time.hours/10, print_time.hours%10, print_time.minutes/10, print_time.minutes%10, print_time.seconds/10, print_time.seconds%10); wifi_ret_ack(); - send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf)); + print_to_wifi(tempBuf); } break; @@ -1265,7 +1266,7 @@ static void wifi_gcode_exec(uint8_t * const cmd_line) { if (strlen((char *)list_file.file_name[sel_id]) > (100 - 1)) return; sprintf_P((char *)tempBuf, PSTR("M994 %s;%d\n"), list_file.file_name[sel_id], (int)gCfgItems.curFilesize); wifi_ret_ack(); - send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf)); + print_to_wifi(tempBuf); } break; @@ -1275,22 +1276,10 @@ static void wifi_gcode_exec(uint8_t * const cmd_line) { #define SENDPAUSE "M997 PAUSE\r\n" switch (uiCfg.print_state) { default: break; - case IDLE: - wifi_ret_ack(); - send_to_wifi((uint8_t *)SENDIDLE, strlen(SENDIDLE)); - break; - case WORKING: - wifi_ret_ack(); - send_to_wifi((uint8_t *)SENDPRINTING, strlen(SENDPRINTING)); - break; - case PAUSED: - wifi_ret_ack(); - send_to_wifi((uint8_t *)SENDPAUSE, strlen(SENDPAUSE)); - break; - case REPRINTING: - wifi_ret_ack(); - send_to_wifi((uint8_t *)SENDPAUSE, strlen(SENDPAUSE)); - break; + case IDLE: wifi_ret_ack(); print_to_wifi(SENDIDLE); break; + case WORKING: wifi_ret_ack(); print_to_wifi(SENDPRINTING); break; + case PAUSED: wifi_ret_ack(); print_to_wifi(SENDPAUSE); break; + case REPRINTING: wifi_ret_ack(); print_to_wifi(SENDPAUSE); break; } if (!uiCfg.command_send) get_wifi_list_command_send(); break; @@ -1307,7 +1296,7 @@ static void wifi_gcode_exec(uint8_t * const cmd_line) { ZERO(tempBuf); send_ok_to_wifi(); #define SENDFW "FIRMWARE_NAME:Robin_nano\r\n" - send_to_wifi((uint8_t *)SENDFW, strlen(SENDFW)); + print_to_wifi(SENDFW); break; default: From b74c81d3e426899009a85827d834dbbe74579036 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 2 May 2025 11:58:45 -0500 Subject: [PATCH 78/86] =?UTF-8?q?=F0=9F=94=A7=20Bricolemon=20cleanup,=20up?= =?UTF-8?q?date=20(#27829)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/pins_postprocess.h | 22 ++-- .../src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h | 73 ++++++----- Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h | 123 ++++++++---------- Marlin/src/pins/samd/pins_MINITRONICS20.h | 10 +- 4 files changed, 111 insertions(+), 117 deletions(-) diff --git a/Marlin/src/pins/pins_postprocess.h b/Marlin/src/pins/pins_postprocess.h index 9e82d854f9..4d2455bd31 100644 --- a/Marlin/src/pins/pins_postprocess.h +++ b/Marlin/src/pins/pins_postprocess.h @@ -891,7 +891,7 @@ #endif #define AUTO_ASSIGNED_X2_DIAG 1 #endif -#endif +#endif // HAS_X2_STEPPER #ifndef X2_CS_PIN #define X2_CS_PIN -1 @@ -976,7 +976,7 @@ #endif #define AUTO_ASSIGNED_Y2_DIAG 1 #endif -#endif +#endif // HAS_Y2_STEPPER #ifndef Y2_CS_PIN #define Y2_CS_PIN -1 @@ -1061,7 +1061,7 @@ #endif #define AUTO_ASSIGNED_Z2_DIAG 1 #endif -#endif +#endif // NUM_Z_STEPPERS >= 2 #ifndef Z2_CS_PIN #define Z2_CS_PIN -1 @@ -1146,7 +1146,7 @@ #endif #define AUTO_ASSIGNED_Z3_DIAG 1 #endif -#endif +#endif // NUM_Z_STEPPERS >= 3 #ifndef Z3_CS_PIN #define Z3_CS_PIN -1 @@ -1231,7 +1231,7 @@ #endif #define AUTO_ASSIGNED_Z4_DIAG 1 #endif -#endif +#endif // NUM_Z_STEPPERS >= 4 #ifndef Z4_CS_PIN #define Z4_CS_PIN -1 @@ -1316,7 +1316,7 @@ #endif #define AUTO_ASSIGNED_I_DIAG 1 #endif -#endif +#endif // HAS_I_AXIS #ifndef I_CS_PIN #define I_CS_PIN -1 @@ -1401,7 +1401,7 @@ #endif #define AUTO_ASSIGNED_J_DIAG 1 #endif -#endif +#endif // HAS_J_AXIS #ifndef J_CS_PIN #define J_CS_PIN -1 @@ -1486,7 +1486,7 @@ #endif #define AUTO_ASSIGNED_K_DIAG 1 #endif -#endif +#endif // HAS_K_AXIS #ifndef K_CS_PIN #define K_CS_PIN -1 @@ -1571,7 +1571,7 @@ #endif #define AUTO_ASSIGNED_U_DIAG 1 #endif -#endif +#endif // HAS_U_AXIS #ifndef U_CS_PIN #define U_CS_PIN -1 @@ -1656,7 +1656,7 @@ #endif #define AUTO_ASSIGNED_V_DIAG 1 #endif -#endif +#endif // HAS_V_AXIS #ifndef V_CS_PIN #define V_CS_PIN -1 @@ -1734,7 +1734,7 @@ #endif #define AUTO_ASSIGNED_W_DIAG 1 #endif -#endif +#endif // HAS_W_AXIS #ifndef W_CS_PIN #define W_CS_PIN -1 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 98ec48de80..f79a743c2a 100644 --- a/Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h +++ b/Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h @@ -22,13 +22,15 @@ #pragma once /** - * BRICOLEMON LITE Board. Based on atsamd51 (AGCM4), bootloader and credits by ADAFRUIT. + * Bricolemon Lite Board. Based on atsamd51 (AGCM4), bootloader and credits by ADAFRUIT. + * https://lemoncrest.com https://bricogeek.com + * * This board its a 3.3V LOGIC Board, following the ADAFRUIT example, all of the board is open source. * Schematic: Refer to the Bricolemon - * 3DSTEP: https://github.com/bricogeek/bricolemon/blob/master/Documentacion/Bricolemon%20Lite/LC_BG_002_PCB_V1I4.step - * PinDemux: https://github.com/bricogeek/bricolemon/blob/master/Documentacion/Bricolemon/PinDEMUX.xlsx + * 3DSTEP: https://github.com/bricogeek/bricolemon/blob/master/Documentacion/Bricolemon%20Lite/LC_BG_002_PCB_V1I4.step + * PinDemux: https://github.com/bricogeek/bricolemon/blob/master/Documentacion/Bricolemon/PinDEMUX.xlsx * - * NOTE: We need the Serial port on the -1 to make it work!!. Remember to change it on configuration.h #define SERIAL_PORT -1 + * NOTE: Requires SERIAL_PORT -1 */ #if NOT_TARGET(ARDUINO_GRAND_CENTRAL_M4) @@ -36,37 +38,50 @@ #endif #ifndef BOARD_INFO_NAME - #define BOARD_INFO_NAME "BRICOLEMON LITE V1.0" // Lemoncrest & BricoGeek collaboration. + #define BOARD_INFO_NAME "Bricolemon Lite v1.0" // Lemoncrest & BricoGeek collaboration. #endif -/** - * EEPROM EMULATION: Works with some bugs already, but the board needs an I2C EEPROM memory soldered on. - */ -//#define FLASH_EEPROM_EMULATION -#define I2C_EEPROM // EEPROM on I2C-0 -#define MARLIN_EEPROM_SIZE 0x10000U // 64K (CAT24C512) - -// This is another option to emulate an EEPROM, but it's more efficient to not lose the data in the first place. -//#define SDCARD_EEPROM_EMULATION +// +// EEPROM Emulation: Works (with some bugs) already, but the board needs an I2C EEPROM memory soldered on. +// +#if NO_EEPROM_SELECTED + #define I2C_EEPROM // EEPROM on I2C-0 + //#define FLASH_EEPROM_EMULATION + //#define SDCARD_EEPROM_EMULATION + #if ENABLED(I2C_EEPROM) + #define MARLIN_EEPROM_SIZE 0x10000U // 64K (CAT24C512) + #if ENABLED(SDCARD_EEPROM_EMULATION) + #define MARLIN_EEPROM_SIZE 0x800U // 2K + #else + #define MARLIN_EEPROM_SIZE 0x800U // 2K + #endif + #undef NO_EEPROM_SELECTED +#endif // -// BLTOUCH PIN: This pin is the signal pin for the BLTOUCH sensor. +// Servos // -#define SERVO0_PIN 33 // BLTouch PWM +#define SERVO0_PIN 33 // BL_TOUCH + +// +// TMC StallGuard DIAG pins - Require soldered bridges! +// +#define X_DIAG_PIN 10 // X_STOP +#define Y_DIAG_PIN 11 // Y_STOP +#define Z_DIAG_PIN 12 // Z_STOP +#define E0_DIAG_PIN 32 // E_STOP // // Limit Switches // -#define X_STOP_PIN 10 -#define Y_STOP_PIN 11 -#define Z_STOP_PIN 12 +#define X_STOP_PIN X_DIAG_PIN +#define Y_STOP_PIN Y_DIAG_PIN +#define Z_STOP_PIN Z_DIAG_PIN // -// Z Probe (when not Z_MIN_PIN) +// Filament Runout Sensor // -#ifndef Z_MIN_PROBE_PIN - #define Z_MIN_PROBE_PIN 12 -#endif +#define FIL_RUNOUT_PIN 32 // E_STOP // // Steppers @@ -87,10 +102,6 @@ #define E0_DIR_PIN 25 #define E0_ENABLE_PIN 29 -// Filament runout. You may choose to use this pin for some other purpose. It's a normal GPIO that can be configured as I/O. -// For example, a switch to detect any kind of behavior, Power supply pin .... etc. -#define FIL_RUNOUT_PIN 32 - // // Temperature Sensors // @@ -579,16 +590,16 @@ // Default TMC slave addresses #ifndef X_SLAVE_ADDRESS - #define X_SLAVE_ADDRESS 0 + #define X_SLAVE_ADDRESS 0 #endif #ifndef Y_SLAVE_ADDRESS - #define Y_SLAVE_ADDRESS 1 + #define Y_SLAVE_ADDRESS 1 #endif #ifndef Z_SLAVE_ADDRESS - #define Z_SLAVE_ADDRESS 2 + #define Z_SLAVE_ADDRESS 2 #endif #ifndef E0_SLAVE_ADDRESS - #define E0_SLAVE_ADDRESS 3 + #define E0_SLAVE_ADDRESS 3 #endif static_assert(X_SLAVE_ADDRESS == 0, "X_SLAVE_ADDRESS must be 0 for BOARD_BRICOLEMON_LITE_V1_0."); static_assert(Y_SLAVE_ADDRESS == 1, "Y_SLAVE_ADDRESS must be 1 for BOARD_BRICOLEMON_LITE_V1_0."); diff --git a/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h b/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h index 37f0b79f6b..8de6ac5b71 100644 --- a/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h +++ b/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h @@ -22,7 +22,8 @@ #pragma once /** - * BRICOLEMON Board. Based on ATSAMD51 (AGCM4), bootloader and credits by ADAFRUIT. + * Bricolemon Board. Based on ATSAMD51 (AGCM4), bootloader and credits by ADAFRUIT. + * https://lemoncrest.com https://bricogeek.com */ #if NOT_TARGET(ARDUINO_GRAND_CENTRAL_M4) @@ -30,11 +31,11 @@ #endif #ifndef BOARD_INFO_NAME - #define BOARD_INFO_NAME "BRICOLEMON V1.0" // Lemoncrest & BricoGeek collaboration. + #define BOARD_INFO_NAME "Bricolemon V1.0" // Lemoncrest & BricoGeek collaboration. #endif /** - * BRICOLEMON Board. Based on atsamd51 (AGCM4), bootloader and credits by ADAFRUIT. + * Bricolemon Board. Based on atsamd51 (AGCM4), bootloader and credits by ADAFRUIT. * This board its a 3.3V LOGIC Board, following the ADAFRUIT example, all of the board is open source. * Schematic: https://github.com/bricogeek/bricolemon/blob/master/Documentacion/Bricolemon/EsquemaBricolemon_REVB.pdf * 3DSTEP: https://github.com/bricogeek/bricolemon/blob/master/Documentacion/Bricolemon/BricolemonREVB.step @@ -43,41 +44,52 @@ * NOTE: We need the Serial port on the -1 to make it work!!. Remember to change it on configuration.h #define SERIAL_PORT -1 */ -/** - * EEPROM EMULATION: Works with some bugs already, but the board needs an I2C EEPROM memory soldered on. - */ -//#define FLASH_EEPROM_EMULATION -#define I2C_EEPROM // EEPROM on I2C-0 -#define MARLIN_EEPROM_SIZE 0x10000U // 64K (CAT24C512) - -//This its another option to emulate an EEPROM, but its more efficient to dont loose the data the first One. -//#define SDCARD_EEPROM_EMULATION +// +// EEPROM Emulation: Works (with some bugs) already, but the board needs an I2C EEPROM memory soldered on. +// +#if NO_EEPROM_SELECTED + #define I2C_EEPROM // EEPROM on I2C-0 + //#define FLASH_EEPROM_EMULATION + //#define SDCARD_EEPROM_EMULATION + #if ENABLED(I2C_EEPROM) + #define MARLIN_EEPROM_SIZE 0x10000U // 64K (CAT24C512) + #if ENABLED(SDCARD_EEPROM_EMULATION) + #define MARLIN_EEPROM_SIZE 0x800U // 2K + #else + #define MARLIN_EEPROM_SIZE 0x800U // 2K + #endif + #undef NO_EEPROM_SELECTED +#endif // -// BLTouch +// Servos // -#define SERVO0_PIN 33 // BLTouch PWM +#define SERVO0_PIN 33 // BL_TOUCH // -// Limit Switches +// TMC StallGuard DIAG pins - Require soldered bridges! // -#define X_STOP_PIN 10 -#define Y_STOP_PIN 11 -#define Z_STOP_PIN 12 - -/** - * NOTE: Useful if extra TMC2209 are to be used as independent axes. - * We need to configure the new digital PIN, for this we could configure on the board the extra pin of this stepper, for example as a MIN_PIN/MAX_PIN. This pin is the D14. - */ -//#define Z2_STOP_PIN 14 -//#define X2_STOP_PIN 14 -//#define Y2_STOP_PIN 14 +#define X_DIAG_PIN 10 // X_STOP +#define Y_DIAG_PIN 11 // Y_STOP +#define Z_DIAG_PIN 12 // Z_STOP +#define E0_DIAG_PIN 48 // E0_STOP +#define E1_DIAG_PIN 14 // E1_STOP // -// Z Probe (when not Z_MIN_PIN) +// Limit Switches // -#ifndef Z_MIN_PROBE_PIN - #define Z_MIN_PROBE_PIN 12 +#define X_STOP_PIN X_DIAG_PIN +#define Y_STOP_PIN Y_DIAG_PIN +#define Z_STOP_PIN Z_DIAG_PIN + +// +// Filament Runout Sensor +// +#ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN 48 // E0_STOP +#endif +#ifndef FIL_RUNOUT2_PIN + #define FIL_RUNOUT2_PIN 14 // E1_STOP #endif // @@ -103,47 +115,18 @@ #define E1_DIR_PIN 46 #define E1_ENABLE_PIN 47 -// Filament runout. You may choose to use this pin for some other purpose. It's a normal GPIO that can be configured as I/O. -// For example, a switch to detect any kind of behavior, Power supply pin .... etc. -#define FIL_RUNOUT_PIN 32 - -// This board have the option to use an extra TMC2209 stepper, one of the use could be as a second extruder. -#if EXTRUDERS < 2 - // TODO: Corregir aquí que cuando tenemos dos extrusores o lo que sea, utiliza los endstop que le sobran, osea los max, no hay Z2_endstop - #if NUM_Z_STEPPERS > 1 - #define Z2_STOP_PIN 14 - #endif -#else - // If we want to configure the extra stepper as a Extruder, we should have undef all of the extra motors. - #undef X2_DRIVER_TYPE - #undef Y2_DRIVER_TYPE - #undef Z2_DRIVER_TYPE - #undef Z3_DRIVER_TYPE - #undef Z4_DRIVER_TYPE - - // Si tenemos más de un extrusor lo que hacemos es definir el nuevo extrusor así como sus pines - // Acordarse de definir el #define TEMP_SENSOR_1, ya que este contiene el tipo de sonda del extrusor E1 - - #define FIL_RUNOUT2_PIN 14 - -#endif - // -// Extruder / Bed -// - // Temperature Sensors +// #define TEMP_0_PIN 1 - -// You could use one of the ADC for a temp chamber if you don't use the second extruder, for example. -#if TEMP_SENSOR_CHAMBER > 0 - #define TEMP_CHAMBER_PIN 3 -#else - #define TEMP_1_PIN 3 -#endif - +#define TEMP_1_PIN 3 #define TEMP_BED_PIN 2 +// You could use one of the ADC for a chamber if you don't use the second extruder, for example. +#if TEMP_SENSOR_CHAMBER + #define TEMP_CHAMBER_PIN TEMP_1_PIN +#endif + // // Heaters / Fans // @@ -635,19 +618,19 @@ // Default TMC slave addresses #ifndef X_SLAVE_ADDRESS - #define X_SLAVE_ADDRESS 0 + #define X_SLAVE_ADDRESS 0 #endif #ifndef Y_SLAVE_ADDRESS - #define Y_SLAVE_ADDRESS 1 + #define Y_SLAVE_ADDRESS 1 #endif #ifndef Z_SLAVE_ADDRESS - #define Z_SLAVE_ADDRESS 2 + #define Z_SLAVE_ADDRESS 2 #endif #ifndef E0_SLAVE_ADDRESS - #define E0_SLAVE_ADDRESS 3 + #define E0_SLAVE_ADDRESS 3 #endif #ifndef E1_SLAVE_ADDRESS - #define E1_SLAVE_ADDRESS 0 + #define E1_SLAVE_ADDRESS 0 #endif static_assert(X_SLAVE_ADDRESS == 0, "X_SLAVE_ADDRESS must be 0 for BOARD_BRICOLEMON_V1_0."); static_assert(Y_SLAVE_ADDRESS == 1, "Y_SLAVE_ADDRESS must be 1 for BOARD_BRICOLEMON_V1_0."); diff --git a/Marlin/src/pins/samd/pins_MINITRONICS20.h b/Marlin/src/pins/samd/pins_MINITRONICS20.h index 0f61aea713..827cc57d1f 100644 --- a/Marlin/src/pins/samd/pins_MINITRONICS20.h +++ b/Marlin/src/pins/samd/pins_MINITRONICS20.h @@ -519,19 +519,19 @@ // Default TMC slave addresses #ifndef X_SLAVE_ADDRESS - #define X_SLAVE_ADDRESS 0 + #define X_SLAVE_ADDRESS 0 #endif #ifndef Y_SLAVE_ADDRESS - #define Y_SLAVE_ADDRESS 1 + #define Y_SLAVE_ADDRESS 1 #endif #ifndef Z_SLAVE_ADDRESS - #define Z_SLAVE_ADDRESS 2 + #define Z_SLAVE_ADDRESS 2 #endif #ifndef E0_SLAVE_ADDRESS - #define E0_SLAVE_ADDRESS 3 + #define E0_SLAVE_ADDRESS 3 #endif #ifndef E1_SLAVE_ADDRESS - #define E1_SLAVE_ADDRESS 0 + #define E1_SLAVE_ADDRESS 0 #endif static_assert(X_SLAVE_ADDRESS == 0, "X_SLAVE_ADDRESS must be 0 for BOARD_MINITRONICS20."); static_assert(Y_SLAVE_ADDRESS == 1, "Y_SLAVE_ADDRESS must be 1 for BOARD_MINITRONICS20."); From 019915b09750b10dae64a80d59e4fc30265d3b3a Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 2 May 2025 18:08:56 +0000 Subject: [PATCH 79/86] [cron] Bump distribution date (2025-05-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 a2ef14eecd..58bd8e05ce 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 "2025-05-01" +//#define STRING_DISTRIBUTION_DATE "2025-05-02" /** * The protocol for communication to the host. Protocol indicates communication diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 618bca9810..8d83493ab4 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 "2025-05-01" + #define STRING_DISTRIBUTION_DATE "2025-05-02" #endif /** From 0c72dc376ca78c5354054d6c9b80a286e7d2ffa5 Mon Sep 17 00:00:00 2001 From: B Date: Sat, 3 May 2025 13:20:29 -0700 Subject: [PATCH 80/86] =?UTF-8?q?=F0=9F=94=A8=20Creality=20V4.2.7=20(GD32)?= =?UTF-8?q?=20(#27796)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/GD32_MFL/timers.cpp | 9 +++- Marlin/src/core/boards.h | 3 +- .../pins/gd32f3/pins_CREALITY_V422_GD32_MFL.h | 8 +--- .../pins/gd32f3/pins_CREALITY_V427_GD32_MFL.h | 48 +++++++++++++++++++ Marlin/src/pins/pins.h | 2 + 5 files changed, 62 insertions(+), 8 deletions(-) create mode 100644 Marlin/src/pins/gd32f3/pins_CREALITY_V427_GD32_MFL.h diff --git a/Marlin/src/HAL/GD32_MFL/timers.cpp b/Marlin/src/HAL/GD32_MFL/timers.cpp index 5b2c2de7ef..632499742c 100644 --- a/Marlin/src/HAL/GD32_MFL/timers.cpp +++ b/Marlin/src/HAL/GD32_MFL/timers.cpp @@ -92,7 +92,9 @@ bool is_temp_timer_initialized = false; // Retrieves the clock frequency of the stepper timer uint32_t GetStepperTimerClkFreq() { - return Step_Timer.getTimerClockFrequency(); + // Cache result + static uint32_t clkFreq = Step_Timer.getTimerClockFrequency(); + return clkFreq; } /** @@ -191,10 +193,12 @@ void SetTimerInterruptPriorities() { // Detect timer conflicts // ------------------------ +TERN_(HAS_TMC_SW_SERIAL, static constexpr timer::TIMER_Base timer_serial[] = {static_cast(TIMER_SERIAL)}); TERN_(SPEAKER, static constexpr timer::TIMER_Base timer_tone[] = {static_cast(TIMER_TONE)}); TERN_(HAS_SERVOS, static constexpr timer::TIMER_Base timer_servo[] = {static_cast(TIMER_SERVO)}); enum TimerPurpose { + PURPOSE_SERIAL, PURPOSE_TONE, PURPOSE_SERVO, PURPOSE_STEP, @@ -205,6 +209,9 @@ enum TimerPurpose { // Includes the timer purpose to ease debugging when evaluating at build-time // This cannot yet account for timers used for PWM output, such as for fans static constexpr struct { TimerPurpose p; int t; } timers_in_use[] = { + #if HAS_TMC_SW_SERIAL + { PURPOSE_SERIAL, timer_base_to_index(timer_serial[0]) }, // Set in variant.h + #endif #if ENABLED(SPEAKER) { PURPOSE_TONE, timer_base_to_index(timer_tone[0]) }, // Set in variant.h #endif diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index e7851d001a..32ee85daab 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -386,7 +386,7 @@ #define BOARD_CREALITY_V422 5039 // Creality v4.2.2 (STM32F103RC / STM32F103RE) ... GD32 Variant Below! #define BOARD_CREALITY_V423 5040 // Creality v4.2.3 (STM32F103RC / STM32F103RE) #define BOARD_CREALITY_V425 5041 // Creality v4.2.5 (STM32F103RC / STM32F103RE) -#define BOARD_CREALITY_V427 5042 // Creality v4.2.7 (STM32F103RC / STM32F103RE) +#define BOARD_CREALITY_V427 5042 // Creality v4.2.7 (STM32F103RC / STM32F103RE) ... GD32 Variant Below! #define BOARD_CREALITY_V4210 5043 // Creality v4.2.10 (STM32F103RC / STM32F103RE) as found in the CR-30 #define BOARD_CREALITY_V431 5044 // Creality v4.3.1 (STM32F103RC / STM32F103RE) #define BOARD_CREALITY_V431_A 5045 // Creality v4.3.1a (STM32F103RC / STM32F103RE) @@ -563,6 +563,7 @@ // #define BOARD_CREALITY_V422_GD32_MFL 7400 // Creality V4.2.2 MFL (GD32F303RE) ... STM32 Variant Above! +#define BOARD_CREALITY_V427_GD32_MFL 7401 // Creality V4.2.7 MFL (GD32F303RE) ... STM32 Variant Above! // // Raspberry Pi diff --git a/Marlin/src/pins/gd32f3/pins_CREALITY_V422_GD32_MFL.h b/Marlin/src/pins/gd32f3/pins_CREALITY_V422_GD32_MFL.h index 70b171eef9..8b5cd90b15 100644 --- a/Marlin/src/pins/gd32f3/pins_CREALITY_V422_GD32_MFL.h +++ b/Marlin/src/pins/gd32f3/pins_CREALITY_V422_GD32_MFL.h @@ -27,11 +27,7 @@ #define ALLOW_GD32F3 -#ifndef BOARD_INFO_NAME - #define BOARD_INFO_NAME "Creality V4.2.2 MFL" -#endif -#ifndef DEFAULT_MACHINE_NAME - #define DEFAULT_MACHINE_NAME "Ender-3 MFL" -#endif +#define BOARD_INFO_NAME "Creality V4.2.2 MFL" +#define DEFAULT_MACHINE_NAME "Ender-3 MFL" #include "../stm32f1/pins_CREALITY_V4.h" diff --git a/Marlin/src/pins/gd32f3/pins_CREALITY_V427_GD32_MFL.h b/Marlin/src/pins/gd32f3/pins_CREALITY_V427_GD32_MFL.h new file mode 100644 index 0000000000..afa1b0620f --- /dev/null +++ b/Marlin/src/pins/gd32f3/pins_CREALITY_V427_GD32_MFL.h @@ -0,0 +1,48 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2025 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * Creality MFL GD32 V4.2.7 (GD32F303RE) board pin assignments + */ + +#define ALLOW_GD32F3 + +#define BOARD_INFO_NAME "Creality V4.2.7 MFL" +#define DEFAULT_MACHINE_NAME "Creality3D MFL" + +// +// Steppers +// +#define X_STEP_PIN PB9 +#define X_DIR_PIN PC2 + +#define Y_STEP_PIN PB7 +#define Y_DIR_PIN PB8 + +#define Z_STEP_PIN PB5 +#define Z_DIR_PIN PB6 + +#define E0_STEP_PIN PB3 +#define E0_DIR_PIN PB4 + +#include "../stm32f1/pins_CREALITY_V4.h" diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 8c974cce48..7b2daae1ea 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -977,6 +977,8 @@ #elif MB(CREALITY_V422_GD32_MFL) #include "gd32f3/pins_CREALITY_V422_GD32_MFL.h" // GD32F303RE env:GD32F303RE_creality_mfl +#elif MB(CREALITY_V427_GD32_MFL) + #include "gd32f3/pins_CREALITY_V427_GD32_MFL.h" // GD32F303RE env:GD32F303RE_creality_mfl // // Raspberry Pi RP2040 From b9ffe93d1f00a6a1b7c91710f54c29a22deeadd2 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sun, 4 May 2025 00:34:56 +0000 Subject: [PATCH 81/86] [cron] Bump distribution date (2025-05-04) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 58bd8e05ce..a58dfbe2a8 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 "2025-05-02" +//#define STRING_DISTRIBUTION_DATE "2025-05-04" /** * The protocol for communication to the host. Protocol indicates communication diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 8d83493ab4..b066410475 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 "2025-05-02" + #define STRING_DISTRIBUTION_DATE "2025-05-04" #endif /** From a8d18a0554aec9be9583b0799f750b6858a155d0 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 3 May 2025 19:57:05 -0500 Subject: [PATCH 82/86] =?UTF-8?q?=F0=9F=8E=A8=20ProUI=20code=20style?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/e3v2/proui/dwin.cpp | 77 +++++++++++++++++++----------- 1 file changed, 49 insertions(+), 28 deletions(-) diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index b1df0234b0..2b6087385e 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -589,7 +589,11 @@ void drawPrintProgressElapsed() { #endif void ICON_ResumeOrPause() { - if (checkkey == ID_PrintProcess) (print_job_timer.isPaused() || hmiFlag.pause_flag) ? ICON_Resume() : ICON_Pause(); + if (checkkey != ID_PrintProcess) return; + if (print_job_timer.isPaused() || hmiFlag.pause_flag) + ICON_Resume(); + else + ICON_Pause(); } // Print a string (up to 30 characters) in the header, @@ -927,19 +931,28 @@ void sdCardFolder(char * const dirname) { void onClickSDItem() { const uint16_t hasUpDir = !card.flag.workDirIsRoot; - if (hasUpDir && currentMenu->selected == 1) return sdCardUp(); + if (hasUpDir && currentMenu->selected == 1) { + sdCardUp(); + return; + } else { const uint16_t filenum = currentMenu->selected - 1 - hasUpDir; card.selectFileByIndexSorted(filenum); // Enter that folder! - if (card.flag.filenameIsDir) return sdCardFolder(card.filename); + if (card.flag.filenameIsDir) { + sdCardFolder(card.filename); + return; + } - if (card.fileIsBinary()) - return dwinPopupConfirm(ICON_Error, F("Please check filenames"), F("Only G-code can be printed")); + if (card.fileIsBinary()) { + dwinPopupConfirm(ICON_Error, F("Please check filenames"), F("Only G-code can be printed")); + return; + } else { dwinPrintHeader(card.longest_filename()); // Save filename - return gotoConfirmToPrint(); + gotoConfirmToPrint(); + return; } } } @@ -1171,7 +1184,7 @@ void onClickPauseOrStop() { case PRINT_STOP: if (hmiFlag.select_flag) ExtUI::stopPrint(); break; // Stop confirmed then abort print default: break; } - return gotoPrintProcess(); + gotoPrintProcess(); } // Printing @@ -1205,10 +1218,12 @@ void hmiPrinting() { ExtUI::resumePrint(); break; } - else - return gotoPopup(popupPauseOrStop, onClickPauseOrStop); - case PRINT_STOP: - return gotoPopup(popupPauseOrStop, onClickPauseOrStop); + gotoPopup(popupPauseOrStop, onClickPauseOrStop); + return; + case PRINT_STOP: { + gotoPopup(popupPauseOrStop, onClickPauseOrStop); + return; + } default: break; } } @@ -1256,8 +1271,9 @@ void drawMainArea() { void hmiWaitForUser() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState != ENCODER_DIFF_NO && !ui.backlight) { - if (checkkey == ID_WaitResponse) hmiReturnScreen(); - return ui.refresh_brightness(); + ui.refresh_brightness(); + hmiReturnScreen(); + return; } if (!wait_for_user) { switch (checkkey) { @@ -1387,7 +1403,8 @@ void eachMomentUpdate() { } #if HAS_PLR_UI_FLAG else if (DWIN_lcd_sd_status && recovery.ui_flag_resume) { // Resume interrupted print - return gotoPowerLossRecovery(); + gotoPowerLossRecovery(); + return; } #endif @@ -1426,7 +1443,8 @@ void eachMomentUpdate() { if (hmiFlag.select_flag) { queue.inject(F("M1000C")); select_page.reset(); - return gotoMainMenu(); + gotoMainMenu(); + return; } else { hmiSaveProcessID(ID_NothingToDo); @@ -1510,15 +1528,17 @@ void hmiReturnScreen() { drawMainArea(); } +#if ANY(TJC_DISPLAY, DACAI_DISPLAY) + #define HOME_AND_KILL_ICON ICON_BLTouch +#else + #define HOME_AND_KILL_ICON ICON_Printer_0 +#endif + void dwinHomingStart() { hmiFlag.home_flag = true; hmiSaveProcessID(ID_Homing); title.showCaption(GET_TEXT_F(MSG_HOMING)); - #if ANY(TJC_DISPLAY, DACAI_DISPLAY) - dwinShowPopup(ICON_BLTouch, GET_TEXT_F(MSG_HOMING), GET_TEXT_F(MSG_PLEASE_WAIT)); - #else - dwinShowPopup(ICON_Printer_0, GET_TEXT_F(MSG_HOMING), GET_TEXT_F(MSG_PLEASE_WAIT)); - #endif + dwinShowPopup(HOME_AND_KILL_ICON, GET_TEXT_F(MSG_HOMING), GET_TEXT_F(MSG_PLEASE_WAIT)); } void dwinHomingDone() { @@ -1941,11 +1961,7 @@ void MarlinUI::update() { #endif void MarlinUI::kill_screen(FSTR_P const lcd_error, FSTR_P const) { - #if ANY(TJC_DISPLAY, DACAI_DISPLAY) - dwinDrawPopup(ICON_BLTouch, GET_TEXT_F(MSG_PRINTER_KILLED), lcd_error); - #else - dwinDrawPopup(ICON_Printer_0, GET_TEXT_F(MSG_PRINTER_KILLED), lcd_error); - #endif + dwinDrawPopup(HOME_AND_KILL_ICON, GET_TEXT_F(MSG_PRINTER_KILLED), lcd_error); DWINUI::drawCenteredString(hmiData.colorPopupTxt, 270, GET_TEXT_F(MSG_TURN_OFF)); dwinUpdateLCD(); } @@ -2051,7 +2067,8 @@ void dwinRedrawScreen() { dwinResetStatusLine(); if (hmiFlag.select_flag) { // Confirm gotoMainMenu(); - return card.openAndPrintFile(card.filename); + card.openAndPrintFile(card.filename); + return; } else hmiReturnScreen(); @@ -2061,7 +2078,10 @@ void dwinRedrawScreen() { void gotoConfirmToPrint() { #if HAS_GCODE_PREVIEW - if (hmiData.enablePreview) return gotoPopup(preview.drawFromSD, onClickConfirmToPrint); + if (hmiData.enablePreview) { + gotoPopup(preview.drawFromSD, onClickConfirmToPrint); + return; + } #endif card.openAndPrintFile(card.filename); // Direct print SD file } @@ -2194,7 +2214,8 @@ void axisMove(AxisEnum axis) { #if HAS_HOTEND if (axis == E_AXIS && thermalManager.tooColdToExtrude(0)) { gcode.process_subcommands_now(F("G92E0")); // Reset extruder position - return dwinPopupConfirm(ICON_TempTooLow, GET_TEXT_F(MSG_HOTEND_TOO_COLD), GET_TEXT_F(MSG_PLEASE_PREHEAT)); + dwinPopupConfirm(ICON_TempTooLow, GET_TEXT_F(MSG_HOTEND_TOO_COLD), GET_TEXT_F(MSG_PLEASE_PREHEAT)); + return; } #endif planner.synchronize(); From 414951e42cdc49f6e3091978d1822bfb1b636cbd Mon Sep 17 00:00:00 2001 From: Andrew <18502096+classicrocker883@users.noreply.github.com> Date: Sat, 3 May 2025 21:08:27 -0400 Subject: [PATCH 83/86] =?UTF-8?q?=F0=9F=9A=B8=20Fix=20ProUI=20LCD=20wake?= =?UTF-8?q?=20up=20(#27832)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/e3v2/proui/dwin.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 2b6087385e..aa77704786 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -1957,7 +1957,10 @@ void MarlinUI::update() { } #if HAS_LCD_BRIGHTNESS - void MarlinUI::_set_brightness() { dwinLCDBrightness(backlight ? brightness : 0); } + void MarlinUI::_set_brightness() { + if (!backlight) wait_for_user = true; + dwinLCDBrightness(backlight ? brightness : 0); + } #endif void MarlinUI::kill_screen(FSTR_P const lcd_error, FSTR_P const) { @@ -2273,7 +2276,7 @@ void setMoveZ() { hmiValue.axis = Z_AXIS; setPFloatOnClick(Z_MIN_POS, Z_MAX_POS, void applyBrightness() { ui.set_brightness(menuData.value); } void liveBrightness() { dwinLCDBrightness(menuData.value); } void setBrightness() { setIntOnClick(LCD_BRIGHTNESS_MIN, LCD_BRIGHTNESS_MAX, ui.brightness, applyBrightness, liveBrightness); } - void turnOffBacklight() { hmiSaveProcessID(ID_WaitResponse); ui.set_brightness(0); dwinRedrawScreen(); } + void turnOffBacklight() { ui.set_brightness(0); dwinRedrawScreen(); } #endif #if ENABLED(CASE_LIGHT_MENU) From 4e1e7fa1b0dd6f9fdd6d18b88ccbe13cf3d36152 Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Sat, 3 May 2025 22:07:40 -0400 Subject: [PATCH 84/86] =?UTF-8?q?=E2=9C=A8=20SWITCHING=5FNOZZLE=5FLIFT=5FT?= =?UTF-8?q?O=5FPROBE=20(#27804)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 1 + Marlin/src/inc/Conditionals-1-axes.h | 2 +- Marlin/src/inc/Conditionals-3-etc.h | 4 ++++ Marlin/src/inc/SanityCheck.h | 2 ++ Marlin/src/module/probe.cpp | 4 ++++ Marlin/src/module/tool_change.cpp | 6 ++++++ buildroot/tests/LPC1768 | 2 +- 7 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 91a3b342b6..5effb31883 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -260,6 +260,7 @@ #define SWITCHING_NOZZLE_SERVO_ANGLES { 0, 90 } // A pair of angles for { E0, E1 }. // For Dual Servo use two pairs: { { lower, raise }, { lower, raise } } #define SWITCHING_NOZZLE_SERVO_DWELL 2500 // Dwell time to wait for servo to make physical move + #define SWITCHING_NOZZLE_LIFT_TO_PROBE // Lift toolheads out of the way while probing #endif // Switch nozzles by bumping the toolhead. Requires EVENT_GCODE_TOOLCHANGE_#. diff --git a/Marlin/src/inc/Conditionals-1-axes.h b/Marlin/src/inc/Conditionals-1-axes.h index e55f69c797..8e84d7d4d4 100644 --- a/Marlin/src/inc/Conditionals-1-axes.h +++ b/Marlin/src/inc/Conditionals-1-axes.h @@ -87,7 +87,7 @@ #endif /** - * Multi-Material-Unit supported models + * Multi-Material-Unit supported models */ #ifdef MMU_MODEL #define HAS_MMU 1 diff --git a/Marlin/src/inc/Conditionals-3-etc.h b/Marlin/src/inc/Conditionals-3-etc.h index 2456728554..b361a50a58 100644 --- a/Marlin/src/inc/Conditionals-3-etc.h +++ b/Marlin/src/inc/Conditionals-3-etc.h @@ -69,6 +69,10 @@ #endif #undef UNUSED_TEMP_SENSOR +#if !HAS_HOTEND + #undef PREHEAT_1_TEMP_HOTEND + #undef PREHEAT_2_TEMP_HOTEND +#endif #if !TEMP_SENSOR_BED #undef TEMP_SENSOR_BED #undef THERMAL_PROTECTION_BED diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index cff241db72..8a293b52a8 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -736,6 +736,8 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #error "SWITCHING_NOZZLE requires NUM_SERVOS >= 1." #elif !defined(SWITCHING_NOZZLE_SERVO_NR) #error "SWITCHING_NOZZLE requires SWITCHING_NOZZLE_SERVO_NR." + #elif ALL(SWITCHING_NOZZLE_LIFT_TO_PROBE, NOZZLE_AS_PROBE) + #error "SWITCHING_NOZZLE_LIFT_TO_PROBE cannot be used with NOZZLE_AS_PROBE." #elif SWITCHING_NOZZLE_SERVO_NR == 0 && !PIN_EXISTS(SERVO0) #error "SERVO0_PIN must be defined for your SWITCHING_NOZZLE." #elif SWITCHING_NOZZLE_SERVO_NR == 1 && !PIN_EXISTS(SERVO1) diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 4f7d7c7690..9a998ec569 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -406,6 +406,10 @@ FORCE_INLINE void probe_specific_action(const bool deploy) { #endif // PAUSE_BEFORE_DEPLOY_STOW + #if ENABLED(SWITCHING_NOZZLE_LIFT_TO_PROBE) + servo[SWITCHING_NOZZLE_SERVO_NR].move(servo_angles[SWITCHING_NOZZLE_SERVO_NR][deploy ? 1 : 0]); + #endif + #if ENABLED(SOLENOID_PROBE) #if HAS_SOLENOID_1 diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index 12aca3fff6..fcaa64cefe 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -1415,6 +1415,12 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { #endif } // (new_tool != old_tool) + else { + // For switching-nozzle-with-servos you may have manually-edited servo angles + // or other functions that can affect angles. So here we ensure a T# command + // restores active tool position even when recalling the same tool. + TERN_(SWITCHING_NOZZLE_TWO_SERVOS, lower_nozzle(new_tool)); + } planner.synchronize(); diff --git a/buildroot/tests/LPC1768 b/buildroot/tests/LPC1768 index cd911a9060..f00efb8341 100755 --- a/buildroot/tests/LPC1768 +++ b/buildroot/tests/LPC1768 @@ -30,7 +30,7 @@ restore_configs opt_set MOTHERBOARD BOARD_MKS_SBASE \ EXTRUDERS 2 TEMP_SENSOR_1 1 \ NUM_SERVOS 2 SERVO_DELAY '{ 300, 300 }' SWITCHING_NOZZLE_SERVO_ANGLES '{ { 0, 90 }, { 90, 0 } }' -opt_enable SWITCHING_NOZZLE SWITCHING_NOZZLE_E1_SERVO_NR EDITABLE_SERVO_ANGLES SERVO_DETACH_GCODE \ +opt_enable SWITCHING_NOZZLE SWITCHING_NOZZLE_E1_SERVO_NR SWITCHING_NOZZLE_LIFT_TO_PROBE EDITABLE_SERVO_ANGLES SERVO_DETACH_GCODE \ ULTIMAKERCONTROLLER REALTIME_REPORTING_COMMANDS FULL_REPORT_TO_HOST_FEATURE exec_test $1 $2 "MKS SBASE with SWITCHING_NOZZLE, Grbl Realtime Report" "$3" From 1f31027fd2588e8cf4c556347b5be043d2ff07a1 Mon Sep 17 00:00:00 2001 From: MrKuskov <94338763+MrKuskov@users.noreply.github.com> Date: Sun, 4 May 2025 09:11:23 +0700 Subject: [PATCH 85/86] =?UTF-8?q?=E2=9C=A8=20FILAMENT=5FMOTION=5FDISTANCE?= =?UTF-8?q?=5FMM=20(#27812)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/Configuration.h | 7 +++- Marlin/src/feature/runout.cpp | 9 +++- Marlin/src/feature/runout.h | 77 ++++++++++++++++++++++++++--------- 3 files changed, 71 insertions(+), 22 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 5effb31883..dc042ff1cb 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -2037,8 +2037,11 @@ //#define FILAMENT_MOTION_SENSOR #if ENABLED(FILAMENT_MOTION_SENSOR) - //#define FILAMENT_SWITCH_AND_MOTION + //#define FILAMENT_SWITCH_AND_MOTION // Define separate pins below to sense motion #if ENABLED(FILAMENT_SWITCH_AND_MOTION) + + #define FILAMENT_MOTION_DISTANCE_MM 3.0 // (mm) Missing distance required to trigger runout + #define NUM_MOTION_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_MOTION#_PIN for each. //#define FIL_MOTION1_PIN -1 @@ -2074,7 +2077,7 @@ //#define FIL_MOTION8_STATE LOW //#define FIL_MOTION8_PULLUP //#define FIL_MOTION8_PULLDOWN - #endif + #endif // FILAMENT_SWITCH_AND_MOTION #endif // FILAMENT_MOTION_SENSOR #endif // FILAMENT_RUNOUT_DISTANCE_MM #endif // FILAMENT_RUNOUT_SENSOR diff --git a/Marlin/src/feature/runout.cpp b/Marlin/src/feature/runout.cpp index cb7c6279bc..147f38ef09 100644 --- a/Marlin/src/feature/runout.cpp +++ b/Marlin/src/feature/runout.cpp @@ -33,7 +33,7 @@ FilamentMonitor runout; bool FilamentMonitorBase::enabled = true, - FilamentMonitorBase::filament_ran_out; // = false + FilamentMonitorBase::filament_ran_out; // = false #if ENABLED(HOST_ACTION_COMMANDS) bool FilamentMonitorBase::host_handling; // = false @@ -51,6 +51,11 @@ bool FilamentMonitorBase::enabled = true, #if ENABLED(FILAMENT_MOTION_SENSOR) uint8_t FilamentSensorEncoder::motion_detected; #endif + + #if ENABLED(FILAMENT_SWITCH_AND_MOTION) + bool RunoutResponseDelayed::ignore_motion = false; + constexpr float RunoutResponseDelayed::motion_distance_mm; + #endif #else int8_t RunoutResponseDebounced::runout_count[NUM_RUNOUT_SENSORS]; // = 0 #endif @@ -72,6 +77,8 @@ bool FilamentMonitorBase::enabled = true, void event_filament_runout(const uint8_t extruder) { + runout.init_for_restart(false); // Reset and disable + if (did_pause_print) return; // Action already in progress. Purge triggered repeated runout. #if ENABLED(TOOLCHANGE_MIGRATION_FEATURE) diff --git a/Marlin/src/feature/runout.h b/Marlin/src/feature/runout.h index d7c41907ed..8047db4f41 100644 --- a/Marlin/src/feature/runout.h +++ b/Marlin/src/feature/runout.h @@ -46,8 +46,10 @@ #if ENABLED(FILAMENT_MOTION_SENSOR) #define HAS_FILAMENT_MOTION 1 -#endif -#if DISABLED(FILAMENT_MOTION_SENSOR) || ENABLED(FILAMENT_SWITCH_AND_MOTION) + #if ENABLED(FILAMENT_SWITCH_AND_MOTION) + #define HAS_FILAMENT_SWITCH 1 + #endif +#else #define HAS_FILAMENT_SWITCH 1 #endif @@ -129,6 +131,7 @@ class TFilamentMonitor : public FilamentMonitorBase { // Handle a block completion. RunoutResponseDelayed uses this to // add up the length of filament moved while the filament is out. + // Called from ISR context! static void block_completed(const block_t * const b) { if (enabled) { response.block_completed(b); @@ -171,6 +174,12 @@ class TFilamentMonitor : public FilamentMonitorBase { } } } + + // Reset after a filament runout or upon resuming a job + static void init_for_restart(const bool onoff=true) { + response.init_for_restart(onoff); + } + }; /*************************** FILAMENT PRESENCE SENSORS ***************************/ @@ -267,6 +276,7 @@ class FilamentSensorBase { } public: + // Called from ISR context to indicate a block was completed static void block_completed(const block_t * const b) { // If the sensor wheel has moved since the last call to // this method reset the runout counter for the extruder. @@ -303,6 +313,7 @@ class FilamentSensorBase { } public: + // Called from ISR context to indicate a block was completed static void block_completed(const block_t * const) {} static void run() { @@ -332,6 +343,7 @@ class FilamentSensorBase { TERN_(HAS_FILAMENT_SWITCH, static FilamentSensorSwitch switch_sensor); public: + // Called from ISR context to indicate a block was completed static void block_completed(const block_t * const b) { TERN_(HAS_FILAMENT_MOTION, encoder_sensor.block_completed(b)); TERN_(HAS_FILAMENT_SWITCH, switch_sensor.block_completed(b)); @@ -362,10 +374,17 @@ class FilamentSensorBase { class RunoutResponseDelayed { private: static countdown_t mm_countdown; + static bool ignore_motion; // Flag to ignore the encoder public: static float runout_distance_mm; + #if ENABLED(FILAMENT_SWITCH_AND_MOTION) + static constexpr float motion_distance_mm = FILAMENT_MOTION_DISTANCE_MM; + #endif + + static void set_ignore_motion(const bool ignore=true) { ignore_motion = ignore; } + static void reset() { for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) filament_present(i); #if ENABLED(FILAMENT_SWITCH_AND_MOTION) @@ -377,24 +396,27 @@ class FilamentSensorBase { #if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG) static millis_t t = 0; const millis_t ms = millis(); - if (ELAPSED(ms, t)) { - t = millis() + 1000UL; - for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) - SERIAL_ECHO(i ? F(", ") : F("Runout remaining mm: "), mm_countdown.runout[i]); - #if ENABLED(FILAMENT_SWITCH_AND_MOTION) - for (uint8_t i = 0; i < NUM_MOTION_SENSORS; ++i) - SERIAL_ECHO(i ? F(", ") : F("Motion remaining mm: "), mm_countdown.motion[i]); - #endif - SERIAL_EOL(); - } + if (PENDING(ms, t)) return; + t = ms + 1000UL; + for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) + SERIAL_ECHO(i ? F(", ") : F("Runout remaining mm: "), mm_countdown.runout[i]); + #if ENABLED(FILAMENT_SWITCH_AND_MOTION) + for (uint8_t i = 0; i < NUM_MOTION_SENSORS; ++i) + SERIAL_ECHO(i ? F(", ") : F("Motion remaining mm: "), mm_countdown.motion[i]); + #endif + SERIAL_EOL(); #endif } + // Get runout status for all presence sensors and motion sensors static runout_flags_t has_run_out() { runout_flags_t runout_flags{0}; + // Runout based on filament presence for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) if (mm_countdown.runout[i] < 0) runout_flags.set(i); + // Runout based on filament motion #if ENABLED(FILAMENT_SWITCH_AND_MOTION) - for (uint8_t i = 0; i < NUM_MOTION_SENSORS; ++i) if (mm_countdown.motion[i] < 0) runout_flags.set(i); + if (!ignore_motion) + for (uint8_t i = 0; i < NUM_MOTION_SENSORS; ++i) if (mm_countdown.motion[i] < 0) runout_flags.set(i); #endif return runout_flags; } @@ -419,8 +441,8 @@ class FilamentSensorBase { #if ENABLED(FILAMENT_SWITCH_AND_MOTION) static void filament_motion_present(const uint8_t extruder) { // Same logic as filament_present - if (mm_countdown.motion[extruder] < runout_distance_mm || did_pause_print) { - mm_countdown.motion[extruder] = runout_distance_mm; + if (mm_countdown.motion[extruder] < motion_distance_mm || did_pause_print) { + mm_countdown.motion[extruder] = motion_distance_mm; mm_countdown.motion_reset.clear(extruder); } else @@ -428,29 +450,42 @@ class FilamentSensorBase { } #endif + // Called from ISR context to indicate a block was completed static void block_completed(const block_t * const b) { - const int32_t esteps = b->steps.e; - if (!esteps) return; - // No calculation unless paused or printing if (!should_monitor_runout()) return; + // Only extrusion moves are examined + const int32_t esteps = b->steps.e; + if (!esteps) return; + // No need to ignore retract/unretract movement since they complement each other const uint8_t e = b->extruder; const float mm = (b->direction_bits.e ? esteps : -esteps) * planner.mm_per_step[E_AXIS_N(e)]; + // Apply E distance to runout countdown, reset if flagged if (e < NUM_RUNOUT_SENSORS) { mm_countdown.runout[e] -= mm; if (mm_countdown.runout_reset[e]) filament_present(e); // Reset pending. Try to reset. } + // Apply E distance to motion countdown, reset if flagged #if ENABLED(FILAMENT_SWITCH_AND_MOTION) - if (e < NUM_MOTION_SENSORS) { + if (!ignore_motion && e < NUM_MOTION_SENSORS) { mm_countdown.motion[e] -= mm; if (mm_countdown.motion_reset[e]) filament_motion_present(e); // Reset pending. Try to reset. } #endif } + + // Reset after a filament runout or upon resuming a job + static void init_for_restart(const bool onoff=true) { + UNUSED(onoff); + #if ENABLED(FILAMENT_SWITCH_AND_MOTION) + reset(); + set_ignore_motion(!onoff); + #endif + } }; #else // !HAS_FILAMENT_RUNOUT_DISTANCE @@ -478,11 +513,15 @@ class FilamentSensorBase { return runout_flags; } + // Called from ISR context to indicate a block was completed static void block_completed(const block_t * const) { } static void filament_present(const uint8_t extruder) { runout_count[extruder] = runout_threshold; } + + // Reset after a filament runout or upon resuming a job + static void init_for_restart(const bool=true) { reset(); } }; #endif // !HAS_FILAMENT_RUNOUT_DISTANCE From cbe8a6867cd18e77e0ba7c4bdeb0e96f24e2bb1b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 3 May 2025 21:56:33 -0500 Subject: [PATCH 86/86] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Fix?= =?UTF-8?q?=20mac=5Fgcc=20HOMEBREW=5FPATH?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/bin/mac_gcc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/buildroot/bin/mac_gcc b/buildroot/bin/mac_gcc index 05ee9dd295..6c5d7ea24a 100755 --- a/buildroot/bin/mac_gcc +++ b/buildroot/bin/mac_gcc @@ -11,7 +11,9 @@ which port >/dev/null && HAS_MACPORTS=1 which brew >/dev/null && HAS_HOMEBREW=1 MACPORTS_PATH=$(dirname "$(which port)") -HOMEBREW_PATH="$(brew --prefix)/bin" +if ((HAS_HOMEBREW)); then + HOMEBREW_PATH="$(brew --prefix)/bin" +fi if [[ $1 == "apple" || $1 == "darwin" || $1 == "system" ]]; then