From dd3b65bb1ff41deda223562b24ed230bfa0e0c2a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 17 Oct 2022 13:01:45 -0500 Subject: [PATCH 001/109] =?UTF-8?q?=F0=9F=8E=A8=20HAS=5FSPI=5FFLASH=20=3D>?= =?UTF-8?q?=20SPI=5FFLASH?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/control/M993_M994.cpp | 4 ++-- Marlin/src/gcode/gcode.cpp | 2 +- Marlin/src/gcode/gcode.h | 2 +- Marlin/src/lcd/extui/mks_ui/SPIFlashStorage.cpp | 4 ++-- Marlin/src/libs/W25Qxx.cpp | 4 ++-- Marlin/src/pins/linux/pins_RAMPS_LINUX.h | 4 ++-- Marlin/src/pins/stm32f1/pins_CHITU3D_common.h | 4 ++-- Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h | 4 ++-- Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h | 4 ++-- Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h | 4 ++-- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h | 4 ++-- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h | 4 ++-- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h | 4 ++-- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h | 4 ++-- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h | 4 ++-- Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h | 2 +- Marlin/src/pins/stm32f4/pins_BTT_SKR_MINI_E3_V3_0_1.h | 2 +- Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h | 2 +- Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h | 2 +- Marlin/src/pins/stm32f4/pins_MKS_SKIPR_V1_0.h | 2 +- Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h | 2 +- ini/features.ini | 2 +- 22 files changed, 35 insertions(+), 35 deletions(-) diff --git a/Marlin/src/gcode/control/M993_M994.cpp b/Marlin/src/gcode/control/M993_M994.cpp index 252792e522..598a73fab7 100644 --- a/Marlin/src/gcode/control/M993_M994.cpp +++ b/Marlin/src/gcode/control/M993_M994.cpp @@ -22,7 +22,7 @@ #include "../../inc/MarlinConfig.h" -#if ALL(HAS_SPI_FLASH, SDSUPPORT, MARLIN_DEV_MODE) +#if ALL(SPI_FLASH, SDSUPPORT, MARLIN_DEV_MODE) #include "../gcode.h" #include "../../sd/cardreader.h" @@ -85,4 +85,4 @@ void GcodeSuite::M994() { card.closefile(); } -#endif // HAS_SPI_FLASH && SDSUPPORT && MARLIN_DEV_MODE +#endif // SPI_FLASH && SDSUPPORT && MARLIN_DEV_MODE diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 7edcaa981c..0667ef0b7b 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -1053,7 +1053,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 422: M422(); break; // M422: Set Z Stepper automatic alignment position using probe #endif - #if ALL(HAS_SPI_FLASH, SDSUPPORT, MARLIN_DEV_MODE) + #if ALL(SPI_FLASH, SDSUPPORT, MARLIN_DEV_MODE) case 993: M993(); break; // M993: Backup SPI Flash to SD case 994: M994(); break; // M994: Load a Backup from SD to SPI Flash #endif diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index d69298e28b..e2506e4ed9 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -1194,7 +1194,7 @@ private: static void M995(); #endif - #if BOTH(HAS_SPI_FLASH, SDSUPPORT) + #if BOTH(SPI_FLASH, SDSUPPORT) static void M993(); static void M994(); #endif diff --git a/Marlin/src/lcd/extui/mks_ui/SPIFlashStorage.cpp b/Marlin/src/lcd/extui/mks_ui/SPIFlashStorage.cpp index 6f2351bba6..6508f6f024 100644 --- a/Marlin/src/lcd/extui/mks_ui/SPIFlashStorage.cpp +++ b/Marlin/src/lcd/extui/mks_ui/SPIFlashStorage.cpp @@ -27,8 +27,8 @@ #include "../../../inc/MarlinConfig.h" #include "SPIFlashStorage.h" -#if !HAS_SPI_FLASH - #error "HAS_SPI_FLASH is required with TFT_LVGL_UI." +#if DISABLED(SPI_FLASH) + #error "SPI_FLASH is required with TFT_LVGL_UI." #endif extern W25QXXFlash W25QXX; diff --git a/Marlin/src/libs/W25Qxx.cpp b/Marlin/src/libs/W25Qxx.cpp index 033402d04a..591d0d0693 100644 --- a/Marlin/src/libs/W25Qxx.cpp +++ b/Marlin/src/libs/W25Qxx.cpp @@ -22,7 +22,7 @@ #include "../inc/MarlinConfig.h" -#if HAS_SPI_FLASH +#if ENABLED(SPI_FLASH) #include "W25Qxx.h" @@ -380,4 +380,4 @@ void W25QXXFlash::SPI_FLASH_BufferRead(uint8_t *pBuffer, uint32_t ReadAddr, uint SPI_FLASH_CS_H(); } -#endif // HAS_SPI_FLASH +#endif // SPI_FLASH diff --git a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h b/Marlin/src/pins/linux/pins_RAMPS_LINUX.h index 75d6b9d93e..3616b7a27c 100644 --- a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h +++ b/Marlin/src/pins/linux/pins_RAMPS_LINUX.h @@ -396,8 +396,8 @@ #define SD_DETECT_PIN 41 - #define HAS_SPI_FLASH 1 - #if HAS_SPI_FLASH + #define SPI_FLASH + #if ENABLED(SPI_FLASH) #define SPI_DEVICE 1 #define SPI_FLASH_SIZE 0x1000000 // 16MB #define SPI_FLASH_CS_PIN 31 diff --git a/Marlin/src/pins/stm32f1/pins_CHITU3D_common.h b/Marlin/src/pins/stm32f1/pins_CHITU3D_common.h index bc41e97041..f5dd4a42b0 100644 --- a/Marlin/src/pins/stm32f1/pins_CHITU3D_common.h +++ b/Marlin/src/pins/stm32f1/pins_CHITU3D_common.h @@ -114,8 +114,8 @@ #endif // SPI Flash -#define HAS_SPI_FLASH 1 -#if HAS_SPI_FLASH +#define SPI_FLASH +#if ENABLED(SPI_FLASH) #define SPI_FLASH_SIZE 0x200000 // 2MB #endif diff --git a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h index dd621eb5c1..ff588f9488 100644 --- a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h +++ b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h @@ -68,8 +68,8 @@ #define SPI_DEVICE 2 // SPI Flash -#define HAS_SPI_FLASH 1 -#if HAS_SPI_FLASH +#define SPI_FLASH +#if ENABLED(SPI_FLASH) // SPI 2 #define SPI_FLASH_CS_PIN PB12 // SPI2_NSS / Flash chip-select #define SPI_FLASH_MOSI_PIN PB15 diff --git a/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h b/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h index e6d3174653..ad6b84b057 100644 --- a/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h +++ b/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h @@ -183,7 +183,7 @@ // #if NO_EEPROM_SELECTED //#define SPI_EEPROM - //#define HAS_SPI_FLASH 1 // need MARLIN_DEV_MODE for M993/M994 eeprom backup tests + //#define SPI_FLASH // need MARLIN_DEV_MODE for M993/M994 EEPROM backup tests #define FLASH_EEPROM_EMULATION #endif @@ -196,7 +196,7 @@ #define EEPROM_MOSI_PIN BOARD_SPI1_MOSI_PIN // PA7 pin 32 #define EEPROM_PAGE_SIZE 0x1000U // 4K (from datasheet) #define MARLIN_EEPROM_SIZE 16UL * (EEPROM_PAGE_SIZE) // Limit to 64K for now... -#elif HAS_SPI_FLASH +#elif ENABLED(SPI_FLASH) #define SPI_FLASH_SIZE 0x40000U // limit to 256K (M993 will reboot with 512) #define SPI_FLASH_CS_PIN PC5 #define SPI_FLASH_MOSI_PIN PA7 diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h index 2c147eb9f3..be5f6c7404 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h @@ -272,8 +272,8 @@ // // W25Q64 64Mb (8MB) SPI flash // -#define HAS_SPI_FLASH 1 -#if HAS_SPI_FLASH +#define SPI_FLASH +#if ENABLED(SPI_FLASH) #define SPI_FLASH_SIZE 0x800000 // 8MB #define SPI_FLASH_CS_PIN PG9 #define SPI_FLASH_MOSI_PIN PB15 diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h index b8f6f6a330..89525d93ef 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h @@ -377,8 +377,8 @@ #endif // HAS_WIRED_LCD && !HAS_SPI_TFT -#define HAS_SPI_FLASH 1 -#if HAS_SPI_FLASH +#define SPI_FLASH +#if ENABLED(SPI_FLASH) #define SPI_FLASH_SIZE 0x1000000 // 16MB #define SPI_FLASH_CS_PIN PB12 #define SPI_FLASH_MOSI_PIN PB15 diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h index 0bfc7f5c8d..59441dc806 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h @@ -196,8 +196,8 @@ #endif #endif -#define HAS_SPI_FLASH 1 -#if HAS_SPI_FLASH +#define SPI_FLASH +#if ENABLED(SPI_FLASH) #define SPI_FLASH_SIZE 0x1000000 // 16MB #define SPI_FLASH_CS_PIN PB12 // Flash chip-select #define SPI_FLASH_MOSI_PIN PB15 diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h index 9c6373bef9..8dba943136 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h @@ -379,8 +379,8 @@ #endif // HAS_WIRED_LCD && !HAS_SPI_TFT -#define HAS_SPI_FLASH 1 -#if HAS_SPI_FLASH +#define SPI_FLASH +#if ENABLED(SPI_FLASH) #define SPI_FLASH_SIZE 0x1000000 // 16MB #define SPI_FLASH_CS_PIN PB12 #define SPI_FLASH_MOSI_PIN PB15 diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h index 6f1a790580..858dabb8b9 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_common.h @@ -208,8 +208,8 @@ #define TFT_BUFFER_SIZE 14400 #endif -#define HAS_SPI_FLASH 1 -#if HAS_SPI_FLASH +#define SPI_FLASH +#if ENABLED(SPI_FLASH) #define SPI_FLASH_SIZE 0x1000000 // 16MB #define SPI_FLASH_CS_PIN PB12 #define SPI_FLASH_MOSI_PIN PB15 diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h index 1db2d0c5dd..048570102b 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h @@ -308,8 +308,8 @@ #define BOARD_ST7920_DELAY_3 125 #endif -#define HAS_SPI_FLASH 1 -#if HAS_SPI_FLASH +#define SPI_FLASH +#if ENABLED(SPI_FLASH) #define SPI_FLASH_SIZE 0x1000000 // 16MB #define SPI_FLASH_CS_PIN PB12 // Flash chip-select #define SPI_FLASH_MOSI_PIN PB15 diff --git a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h index 9ff9f6a475..35287050b8 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h @@ -28,7 +28,7 @@ // Onboard I2C EEPROM #define I2C_EEPROM -#define MARLIN_EEPROM_SIZE 0x1000 // 4KB (AT24C32) +#define MARLIN_EEPROM_SIZE 0x1000 // 4K (AT24C32) #define I2C_SCL_PIN PB8 #define I2C_SDA_PIN PB9 diff --git a/Marlin/src/pins/stm32f4/pins_BTT_SKR_MINI_E3_V3_0_1.h b/Marlin/src/pins/stm32f4/pins_BTT_SKR_MINI_E3_V3_0_1.h index 1e278cd4ba..31551f6ff6 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_SKR_MINI_E3_V3_0_1.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_MINI_E3_V3_0_1.h @@ -49,7 +49,7 @@ #define SOFT_I2C_EEPROM // Force the use of Software I2C #define I2C_SCL_PIN PB8 #define I2C_SDA_PIN PB9 - #define MARLIN_EEPROM_SIZE 0x1000 // 4KB + #define MARLIN_EEPROM_SIZE 0x1000 // 4K #endif // diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h index 4ac64ae1d2..603da09d14 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h @@ -225,7 +225,7 @@ #define SPI_FLASH #if ENABLED(SPI_FLASH) - #define HAS_SPI_FLASH 1 + #define SPI_FLASH #define SPI_DEVICE 2 #define SPI_FLASH_SIZE 0x1000000 #define SPI_FLASH_CS_PIN PB12 diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h index 7e08caaa82..873ba3e90d 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h @@ -273,7 +273,7 @@ // // LCD / Controller #define SPI_FLASH -#define HAS_SPI_FLASH 1 +#define SPI_FLASH #define SPI_DEVICE 2 #define SPI_FLASH_SIZE 0x1000000 #if ENABLED(SPI_FLASH) diff --git a/Marlin/src/pins/stm32f4/pins_MKS_SKIPR_V1_0.h b/Marlin/src/pins/stm32f4/pins_MKS_SKIPR_V1_0.h index 046fbb95bf..d00b21c30b 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_SKIPR_V1_0.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_SKIPR_V1_0.h @@ -35,7 +35,7 @@ // Onboard I2C EEPROM #define I2C_EEPROM -#define MARLIN_EEPROM_SIZE 0x1000 // 4KB (AT24C32) +#define MARLIN_EEPROM_SIZE 0x1000 // 4K (AT24C32) #define I2C_SCL_PIN PB8 #define I2C_SDA_PIN PB9 diff --git a/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h b/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h index 24376d6f9c..eaceafe29e 100644 --- a/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h +++ b/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h @@ -46,7 +46,7 @@ #define SOFT_I2C_EEPROM // Force the use of Software I2C #define I2C_SCL_PIN PA14 #define I2C_SDA_PIN PA13 - #define MARLIN_EEPROM_SIZE 0x1000 // 4KB + #define MARLIN_EEPROM_SIZE 0x1000 // 4K #endif // diff --git a/ini/features.ini b/ini/features.ini index 7e4a3f97be..5f30db8a2f 100644 --- a/ini/features.ini +++ b/ini/features.ini @@ -119,7 +119,7 @@ EMERGENCY_PARSER = src_filter=+ EASYTHREED_UI = src_filter=+ I2C_POSITION_ENCODERS = src_filter=+ IIC_BL24CXX_EEPROM = src_filter=+ -HAS_SPI_FLASH = src_filter=+ +SPI_FLASH = src_filter=+ HAS_ETHERNET = src_filter=+ + HAS_FANCHECK = src_filter=+ + HAS_FANMUX = src_filter=+ From 4d56b557aa8e47090e2ac96daba42fc4b976660b Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Mon, 17 Oct 2022 18:46:42 +0000 Subject: [PATCH 002/109] [cron] Bump distribution date (2022-10-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 e08b65cc2e..7c061e387d 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-10-16" +//#define STRING_DISTRIBUTION_DATE "2022-10-17" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 6d3dba75b4..7cd0cfbb3c 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-10-16" + #define STRING_DISTRIBUTION_DATE "2022-10-17" #endif /** From ce40836717fb43787e168f2a077b42d2fe63aa7b Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Mon, 17 Oct 2022 15:17:51 -0400 Subject: [PATCH 003/109] =?UTF-8?q?=F0=9F=90=9B=20Fix=20bed/chamber=20PID?= =?UTF-8?q?=20P=20edit=20(#24861)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/menu/menu_advanced.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 6a42378aba..ace97c9627 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -222,10 +222,10 @@ void menu_backlash(); void apply_PID_p(const int8_t e) { switch (e) { #if ENABLED(PIDTEMPBED) - case H_BED: thermalManager.temp_bed.pid.set_Ki(raw_Ki); break; + case H_BED: thermalManager.temp_bed.pid.set_Kp(raw_Kp); break; #endif #if ENABLED(PIDTEMPCHAMBER) - case H_CHAMBER: thermalManager.temp_chamber.pid.set_Ki(raw_Ki); break; + case H_CHAMBER: thermalManager.temp_chamber.pid.set_Kp(raw_Kp); break; #endif default: #if ENABLED(PIDTEMP) From 5cdb9c2bc8b8232454c746185c869ff77154cc2c Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Mon, 17 Oct 2022 12:25:37 -0700 Subject: [PATCH 004/109] =?UTF-8?q?=F0=9F=94=A7=20Check=20Sensorless=20Hom?= =?UTF-8?q?ing=20on=20all=20axes=20(#24872)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/SanityCheck.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 1ee4667e3c..37efabe280 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -3565,8 +3565,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "SENSORLESS_HOMING on DELTA currently requires STEALTHCHOP_XY and STEALTHCHOP_Z." #elif ENDSTOP_NOISE_THRESHOLD #error "SENSORLESS_HOMING is incompatible with ENDSTOP_NOISE_THRESHOLD." - #elif !(X_SENSORLESS || Y_SENSORLESS || Z_SENSORLESS) - #error "SENSORLESS_HOMING requires a TMC stepper driver with StallGuard on X, Y, or Z axes." + #elif !(X_SENSORLESS || Y_SENSORLESS || Z_SENSORLESS || I_SENSORLESS || J_SENSORLESS || K_SENSORLESS || U_SENSORLESS || V_SENSORLESS || W_SENSORLESS) + #error "SENSORLESS_HOMING requires a TMC stepper driver with StallGuard on X, Y, Z, I, J, K, U, V, or W axes." #endif #undef X_ENDSTOP_INVERTING From fa63ed6cc774e1248e579d2384e29666e7f8d1a7 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 18 Oct 2022 00:35:28 +0000 Subject: [PATCH 005/109] [cron] Bump distribution date (2022-10-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 7c061e387d..f8efc0c0e8 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-10-17" +//#define STRING_DISTRIBUTION_DATE "2022-10-18" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 7cd0cfbb3c..ae9c65955e 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-10-17" + #define STRING_DISTRIBUTION_DATE "2022-10-18" #endif /** From 52096599b30d4d49b3fee61a85102054a2d298d8 Mon Sep 17 00:00:00 2001 From: karliss Date: Tue, 18 Oct 2022 04:01:18 +0300 Subject: [PATCH 006/109] =?UTF-8?q?=F0=9F=90=9B=20Fix=20compile=20without?= =?UTF-8?q?=20Y/Z=20(#24858)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/gcode/feature/trinamic/M569.cpp | 8 ++- Marlin/src/gcode/host/M115.cpp | 33 ++++++--- Marlin/src/inc/Conditionals_LCD.h | 80 +++++++++++++--------- Marlin/src/inc/SanityCheck.h | 38 +++++----- Marlin/src/lcd/dogm/status_screen_DOGM.cpp | 22 ++++-- Marlin/src/lcd/menu/menu_advanced.cpp | 4 +- Marlin/src/lcd/menu/menu_motion.cpp | 8 ++- 7 files changed, 122 insertions(+), 71 deletions(-) diff --git a/Marlin/src/gcode/feature/trinamic/M569.cpp b/Marlin/src/gcode/feature/trinamic/M569.cpp index 44675a850e..db31fe3d8e 100644 --- a/Marlin/src/gcode/feature/trinamic/M569.cpp +++ b/Marlin/src/gcode/feature/trinamic/M569.cpp @@ -197,8 +197,12 @@ void GcodeSuite::M569_report(const bool forReplay/*=true*/) { if (chop_x2 || chop_y2 || chop_z2) { say_M569(forReplay, F("I1")); if (chop_x2) SERIAL_ECHOPGM_P(SP_X_STR); - if (chop_y2) SERIAL_ECHOPGM_P(SP_Y_STR); - if (chop_z2) SERIAL_ECHOPGM_P(SP_Z_STR); + #if HAS_Y_AXIS + if (chop_y2) SERIAL_ECHOPGM_P(SP_Y_STR); + #endif + #if HAS_Z_AXIS + if (chop_z2) SERIAL_ECHOPGM_P(SP_Z_STR); + #endif SERIAL_EOL(); } diff --git a/Marlin/src/gcode/host/M115.cpp b/Marlin/src/gcode/host/M115.cpp index d3338d396d..1c00cb19f5 100644 --- a/Marlin/src/gcode/host/M115.cpp +++ b/Marlin/src/gcode/host/M115.cpp @@ -222,24 +222,41 @@ void GcodeSuite::M115() { // Machine Geometry #if ENABLED(M115_GEOMETRY_REPORT) - const xyz_pos_t bmin = { 0, 0, 0 }, - bmax = { X_BED_SIZE , Y_BED_SIZE, Z_MAX_POS }, - dmin = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS }, - dmax = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS }; + constexpr xyz_pos_t bmin{0}, + bmax = ARRAY_N(NUM_AXES, X_BED_SIZE, Y_BED_SIZE, Z_MAX_POS, I_MAX_POS, J_MAX_POS, K_MAX_POS, U_MAX_POS, V_MAX_POS, W_MAX_POS), + dmin = ARRAY_N(NUM_AXES, X_MIN_POS, Y_MIN_POS, Z_MIN_POS, I_MIN_POS, J_MIN_POS, K_MIN_POS, U_MIN_POS, V_MIN_POS, W_MIN_POS), + dmax = ARRAY_N(NUM_AXES, X_MAX_POS, Y_MAX_POS, Z_MAX_POS, I_MAX_POS, J_MAX_POS, K_MAX_POS, U_MAX_POS, V_MAX_POS, W_MAX_POS); xyz_pos_t cmin = bmin, cmax = bmax; apply_motion_limits(cmin); apply_motion_limits(cmax); const xyz_pos_t lmin = dmin.asLogical(), lmax = dmax.asLogical(), wmin = cmin.asLogical(), wmax = cmax.asLogical(); + SERIAL_ECHOLNPGM( "area:{" "full:{" - "min:{x:", lmin.x, ",y:", lmin.y, ",z:", lmin.z, "}," - "max:{x:", lmax.x, ",y:", lmax.y, ",z:", lmax.z, "}" + LIST_N(DOUBLE(NUM_AXES), + "min:{x:", lmin.x, ",y:", lmin.y, ",z:", lmin.z, + ",i:", lmin.i, ",j:", lmin.j, ",k:", lmin.k, + ",u:", lmin.u, ",v:", lmin.v, ",w:", lmin.w + ), + LIST_N(DOUBLE(NUM_AXES), + "max:{x:", lmax.x, ",y:", lmax.y, ",z:", lmax.z, + ",i:", lmax.i, ",j:", lmax.j, ",k:", lmax.k, + ",u:", lmax.u, ",v:", lmax.v, ",w:", lmax.w + ), "}," "work:{" - "min:{x:", wmin.x, ",y:", wmin.y, ",z:", wmin.z, "}," - "max:{x:", wmax.x, ",y:", wmax.y, ",z:", wmax.z, "}", + LIST_N(DOUBLE(NUM_AXES), + "min:{x:", wmin.x, ",y:", wmin.y, ",z:", wmin.z, + ",i:", wmin.i, ",j:", wmin.j, ",k:", wmin.k, + ",u:", wmin.u, ",v:", wmin.v, ",w:", wmin.w + ), + LIST_N(DOUBLE(NUM_AXES), + "max:{x:", wmax.x, ",y:", wmax.y, ",z:", wmax.z, + ",i:", wmax.i, ",j:", wmax.j, ",k:", wmax.k, + ",u:", wmax.u, ",v:", wmax.v, ",w:", wmax.w + ), "}" "}" ); diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 7f6857a3e0..b21eca30b2 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -1204,45 +1204,61 @@ #elif X_HOME_DIR < 0 #define X_HOME_TO_MIN 1 #endif -#if Y_HOME_DIR > 0 - #define Y_HOME_TO_MAX 1 -#elif Y_HOME_DIR < 0 - #define Y_HOME_TO_MIN 1 +#if HAS_Y_AXIS + #if Y_HOME_DIR > 0 + #define Y_HOME_TO_MAX 1 + #elif Y_HOME_DIR < 0 + #define Y_HOME_TO_MIN 1 + #endif #endif -#if Z_HOME_DIR > 0 - #define Z_HOME_TO_MAX 1 -#elif Z_HOME_DIR < 0 - #define Z_HOME_TO_MIN 1 +#if HAS_Z_AXIS + #if Z_HOME_DIR > 0 + #define Z_HOME_TO_MAX 1 + #elif Z_HOME_DIR < 0 + #define Z_HOME_TO_MIN 1 + #endif #endif -#if I_HOME_DIR > 0 - #define I_HOME_TO_MAX 1 -#elif I_HOME_DIR < 0 - #define I_HOME_TO_MIN 1 +#if HAS_I_AXIS + #if I_HOME_DIR > 0 + #define I_HOME_TO_MAX 1 + #elif I_HOME_DIR < 0 + #define I_HOME_TO_MIN 1 + #endif #endif -#if J_HOME_DIR > 0 - #define J_HOME_TO_MAX 1 -#elif J_HOME_DIR < 0 - #define J_HOME_TO_MIN 1 +#if HAS_J_AXIS + #if J_HOME_DIR > 0 + #define J_HOME_TO_MAX 1 + #elif J_HOME_DIR < 0 + #define J_HOME_TO_MIN 1 + #endif #endif -#if K_HOME_DIR > 0 - #define K_HOME_TO_MAX 1 -#elif K_HOME_DIR < 0 - #define K_HOME_TO_MIN 1 +#if HAS_K_AXIS + #if K_HOME_DIR > 0 + #define K_HOME_TO_MAX 1 + #elif K_HOME_DIR < 0 + #define K_HOME_TO_MIN 1 + #endif #endif -#if U_HOME_DIR > 0 - #define U_HOME_TO_MAX 1 -#elif U_HOME_DIR < 0 - #define U_HOME_TO_MIN 1 +#if HAS_U_AXIS + #if U_HOME_DIR > 0 + #define U_HOME_TO_MAX 1 + #elif U_HOME_DIR < 0 + #define U_HOME_TO_MIN 1 + #endif #endif -#if V_HOME_DIR > 0 - #define V_HOME_TO_MAX 1 -#elif V_HOME_DIR < 0 - #define V_HOME_TO_MIN 1 +#if HAS_V_AXIS + #if V_HOME_DIR > 0 + #define V_HOME_TO_MAX 1 + #elif V_HOME_DIR < 0 + #define V_HOME_TO_MIN 1 + #endif #endif -#if W_HOME_DIR > 0 - #define W_HOME_TO_MAX 1 -#elif W_HOME_DIR < 0 - #define W_HOME_TO_MIN 1 +#if HAS_W_AXIS + #if W_HOME_DIR > 0 + #define W_HOME_TO_MAX 1 + #elif W_HOME_DIR < 0 + #define W_HOME_TO_MIN 1 + #endif #endif /** diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 37efabe280..05a44f8e47 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2641,7 +2641,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #define _PLUG_UNUSED_TEST(A,P) (DISABLED(USE_##P##MIN_PLUG, USE_##P##MAX_PLUG) \ && !(ENABLED(A##_DUAL_ENDSTOPS) && WITHIN(A##2_USE_ENDSTOP, _##P##MAX_, _##P##MIN_)) \ && !(ENABLED(A##_MULTI_ENDSTOPS) && WITHIN(A##2_USE_ENDSTOP, _##P##MAX_, _##P##MIN_)) ) -#define _AXIS_PLUG_UNUSED_TEST(A) (1 NUM_AXIS_GANG(&& _PLUG_UNUSED_TEST(A,X), && _PLUG_UNUSED_TEST(A,Y), && _PLUG_UNUSED_TEST(A,Z), \ +#define _AXIS_PLUG_UNUSED_TEST(A) (HAS_##A##_A NUM_AXIS_GANG(&& _PLUG_UNUSED_TEST(A,X), && _PLUG_UNUSED_TEST(A,Y), && _PLUG_UNUSED_TEST(A,Z), \ && _PLUG_UNUSED_TEST(A,I), && _PLUG_UNUSED_TEST(A,J), && _PLUG_UNUSED_TEST(A,K), \ && _PLUG_UNUSED_TEST(A,U), && _PLUG_UNUSED_TEST(A,V), && _PLUG_UNUSED_TEST(A,W) ) ) @@ -2656,22 +2656,22 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #if _AXIS_PLUG_UNUSED_TEST(Z) #error "You must enable USE_ZMIN_PLUG or USE_ZMAX_PLUG." #endif - #if HAS_I_AXIS && _AXIS_PLUG_UNUSED_TEST(I) + #if _AXIS_PLUG_UNUSED_TEST(I) #error "You must enable USE_IMIN_PLUG or USE_IMAX_PLUG." #endif - #if HAS_J_AXIS && _AXIS_PLUG_UNUSED_TEST(J) + #if _AXIS_PLUG_UNUSED_TEST(J) #error "You must enable USE_JMIN_PLUG or USE_JMAX_PLUG." #endif - #if HAS_K_AXIS && _AXIS_PLUG_UNUSED_TEST(K) + #if _AXIS_PLUG_UNUSED_TEST(K) #error "You must enable USE_KMIN_PLUG or USE_KMAX_PLUG." #endif - #if HAS_U_AXIS && _AXIS_PLUG_UNUSED_TEST(U) + #if _AXIS_PLUG_UNUSED_TEST(U) #error "You must enable USE_UMIN_PLUG or USE_UMAX_PLUG." #endif - #if HAS_V_AXIS && _AXIS_PLUG_UNUSED_TEST(V) + #if _AXIS_PLUG_UNUSED_TEST(V) #error "You must enable USE_VMIN_PLUG or USE_VMAX_PLUG." #endif - #if HAS_W_AXIS && _AXIS_PLUG_UNUSED_TEST(W) + #if _AXIS_PLUG_UNUSED_TEST(W) #error "You must enable USE_WMIN_PLUG or USE_WMAX_PLUG." #endif @@ -2685,29 +2685,29 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "Enable USE_YMIN_PLUG when homing Y to MIN." #elif Y_HOME_TO_MAX && DISABLED(USE_YMAX_PLUG) #error "Enable USE_YMAX_PLUG when homing Y to MAX." - #elif HAS_I_AXIS && I_HOME_TO_MIN && DISABLED(USE_IMIN_PLUG) + #elif I_HOME_TO_MIN && DISABLED(USE_IMIN_PLUG) #error "Enable USE_IMIN_PLUG when homing I to MIN." - #elif HAS_I_AXIS && I_HOME_TO_MAX && DISABLED(USE_IMAX_PLUG) + #elif I_HOME_TO_MAX && DISABLED(USE_IMAX_PLUG) #error "Enable USE_IMAX_PLUG when homing I to MAX." - #elif HAS_J_AXIS && J_HOME_TO_MIN && DISABLED(USE_JMIN_PLUG) + #elif J_HOME_TO_MIN && DISABLED(USE_JMIN_PLUG) #error "Enable USE_JMIN_PLUG when homing J to MIN." - #elif HAS_J_AXIS && J_HOME_TO_MAX && DISABLED(USE_JMAX_PLUG) + #elif J_HOME_TO_MAX && DISABLED(USE_JMAX_PLUG) #error "Enable USE_JMAX_PLUG when homing J to MAX." - #elif HAS_K_AXIS && K_HOME_TO_MIN && DISABLED(USE_KMIN_PLUG) + #elif K_HOME_TO_MIN && DISABLED(USE_KMIN_PLUG) #error "Enable USE_KMIN_PLUG when homing K to MIN." - #elif HAS_K_AXIS && K_HOME_TO_MAX && DISABLED(USE_KMAX_PLUG) + #elif K_HOME_TO_MAX && DISABLED(USE_KMAX_PLUG) #error "Enable USE_KMAX_PLUG when homing K to MAX." - #elif HAS_U_AXIS && U_HOME_TO_MIN && DISABLED(USE_UMIN_PLUG) + #elif U_HOME_TO_MIN && DISABLED(USE_UMIN_PLUG) #error "Enable USE_UMIN_PLUG when homing U to MIN." - #elif HAS_U_AXIS && U_HOME_TO_MAX && DISABLED(USE_UMAX_PLUG) + #elif U_HOME_TO_MAX && DISABLED(USE_UMAX_PLUG) #error "Enable USE_UMAX_PLUG when homing U to MAX." - #elif HAS_V_AXIS && V_HOME_TO_MIN && DISABLED(USE_VMIN_PLUG) + #elif V_HOME_TO_MIN && DISABLED(USE_VMIN_PLUG) #error "Enable USE_VMIN_PLUG when homing V to MIN." - #elif HAS_V_AXIS && V_HOME_TO_MAX && DISABLED(USE_VMAX_PLUG) + #elif V_HOME_TO_MAX && DISABLED(USE_VMAX_PLUG) #error "Enable USE_VMAX_PLUG when homing V to MAX." - #elif HAS_W_AXIS && W_HOME_TO_MIN && DISABLED(USE_WMIN_PLUG) + #elif W_HOME_TO_MIN && DISABLED(USE_WMIN_PLUG) #error "Enable USE_WMIN_PLUG when homing W to MIN." - #elif HAS_W_AXIS && W_HOME_TO_MAX && DISABLED(USE_WMAX_PLUG) + #elif W_HOME_TO_MAX && DISABLED(USE_WMAX_PLUG) #error "Enable USE_WMAX_PLUG when homing W to MAX." #endif #endif diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp index 81119c0a10..83f492e124 100644 --- a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp @@ -438,7 +438,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const else if (axis_should_home(axis)) while (const char c = *value++) lcd_put_lchar(c <= '.' ? c : '?'); else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis)) - lcd_put_u8str(axis == Z_AXIS ? F(" ") : F(" ")); + lcd_put_u8str(TERN0(HAS_Z_AXIS, axis == Z_AXIS) ? F(" ") : F(" ")); else lcd_put_u8str(value); } @@ -500,7 +500,13 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const */ void MarlinUI::draw_status_screen() { constexpr int xystorage = TERN(INCH_MODE_SUPPORT, 8, 5); - static char xstring[TERN(LCD_SHOW_E_TOTAL, 12, xystorage)], ystring[xystorage], zstring[8]; + static char xstring[TERN(LCD_SHOW_E_TOTAL, 12, xystorage)]; + #if HAS_Y_AXIS + static char ystring[xystorage]; + #endif + #if HAS_Z_AXIS + static char zstring[8]; + #endif #if ENABLED(FILAMENT_LCD_DISPLAY) static char wstring[5], mstring[4]; @@ -525,7 +531,9 @@ void MarlinUI::draw_status_screen() { const xyz_pos_t lpos = current_position.asLogical(); const bool is_inch = parser.using_inch_units(); - strcpy(zstring, is_inch ? ftostr42_52(LINEAR_UNIT(lpos.z)) : ftostr52sp(lpos.z)); + #if HAS_Z_AXIS + strcpy(zstring, is_inch ? ftostr42_52(LINEAR_UNIT(lpos.z)) : ftostr52sp(lpos.z)); + #endif if (show_e_total) { #if ENABLED(LCD_SHOW_E_TOTAL) @@ -535,7 +543,7 @@ void MarlinUI::draw_status_screen() { } else { strcpy(xstring, is_inch ? ftostr53_63(LINEAR_UNIT(lpos.x)) : ftostr4sign(lpos.x)); - strcpy(ystring, is_inch ? ftostr53_63(LINEAR_UNIT(lpos.y)) : ftostr4sign(lpos.y)); + TERN_(HAS_Y_AXIS, strcpy(ystring, is_inch ? ftostr53_63(LINEAR_UNIT(lpos.y)) : ftostr4sign(lpos.y))); } #if ENABLED(FILAMENT_LCD_DISPLAY) @@ -858,12 +866,14 @@ void MarlinUI::draw_status_screen() { } else { _draw_axis_value(X_AXIS, xstring, blink); - _draw_axis_value(Y_AXIS, ystring, blink); + TERN_(HAS_Y_AXIS, _draw_axis_value(Y_AXIS, ystring, blink)); } #endif - _draw_axis_value(Z_AXIS, zstring, blink); + #if HAS_Z_AXIS + _draw_axis_value(Z_AXIS, zstring, blink); + #endif #if NONE(XYZ_NO_FRAME, XYZ_HOLLOW_FRAME) u8g.setColorIndex(1); // black on white diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index ace97c9627..5978a8ec1a 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -477,7 +477,9 @@ void menu_backlash(); // M201 / M204 Accelerations void menu_advanced_acceleration() { - const float max_accel = _MAX(planner.settings.max_acceleration_mm_per_s2[A_AXIS], planner.settings.max_acceleration_mm_per_s2[B_AXIS], planner.settings.max_acceleration_mm_per_s2[C_AXIS]); + float max_accel = planner.settings.max_acceleration_mm_per_s2[A_AXIS]; + TERN_(HAS_Y_AXIS, NOLESS(max_accel, planner.settings.max_acceleration_mm_per_s2[B_AXIS])); + TERN_(HAS_Z_AXIS, NOLESS(max_accel, planner.settings.max_acceleration_mm_per_s2[C_AXIS])); // M201 settings constexpr xyze_ulong_t max_accel_edit = diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index d5c2424429..3c2917cb71 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -28,7 +28,7 @@ #if HAS_MARLINUI_MENU -#define LARGE_AREA_TEST ((X_BED_SIZE) >= 1000 || (Y_BED_SIZE) >= 1000 || (Z_MAX_POS) >= 1000) +#define LARGE_AREA_TEST ((X_BED_SIZE) >= 1000 || TERN0(HAS_Y_AXIS, (Y_BED_SIZE) >= 1000) || TERN0(HAS_Z_AXIS, (Z_MAX_POS) >= 1000)) #include "menu_item.h" #include "menu_addon.h" @@ -160,8 +160,10 @@ void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int SUBMENU(MSG_MOVE_10MM, []{ _goto_manual_move(10); }); SUBMENU(MSG_MOVE_1MM, []{ _goto_manual_move( 1); }); SUBMENU(MSG_MOVE_01MM, []{ _goto_manual_move( 0.1f); }); - if (axis == Z_AXIS && (FINE_MANUAL_MOVE) > 0.0f && (FINE_MANUAL_MOVE) < 0.1f) - SUBMENU_f(F(STRINGIFY(FINE_MANUAL_MOVE)), MSG_MOVE_N_MM, []{ _goto_manual_move(float(FINE_MANUAL_MOVE)); }); + #if HAS_Z_AXIS + if (axis == Z_AXIS && (FINE_MANUAL_MOVE) > 0.0f && (FINE_MANUAL_MOVE) < 0.1f) + SUBMENU_f(F(STRINGIFY(FINE_MANUAL_MOVE)), MSG_MOVE_N_MM, []{ _goto_manual_move(float(FINE_MANUAL_MOVE)); }); + #endif } END_MENU(); } From 4e1e82b1228e635afc05ecc40279366430d19e20 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Mon, 17 Oct 2022 20:24:19 -0700 Subject: [PATCH 007/109] =?UTF-8?q?=F0=9F=94=A7=20No=20Sleep=20for=20CR-10?= =?UTF-8?q?=20Stock=20Display=20(#24875)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/SanityCheck.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 05a44f8e47..02d798543c 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -3106,7 +3106,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS * Display Sleep is not supported by these common displays */ #if HAS_DISPLAY_SLEEP - #if ANY(IS_U8GLIB_LM6059_AF, IS_U8GLIB_ST7565_64128, REPRAPWORLD_GRAPHICAL_LCD, FYSETC_MINI, ENDER2_STOCKDISPLAY, MINIPANEL) + #if ANY(IS_U8GLIB_LM6059_AF, IS_U8GLIB_ST7565_64128, REPRAPWORLD_GRAPHICAL_LCD, FYSETC_MINI, CR10_STOCKDISPLAY, ENDER2_STOCKDISPLAY, MINIPANEL) #error "DISPLAY_SLEEP_MINUTES is not supported by your display." #elif !WITHIN(DISPLAY_SLEEP_MINUTES, 0, 255) #error "DISPLAY_SLEEP_MINUTES must be between 0 and 255." From 1aa0ece8a42e3acbc4133a83a0f34d36ac743039 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Tue, 18 Oct 2022 16:41:41 +1300 Subject: [PATCH 008/109] =?UTF-8?q?=E2=9C=A8=20Tronxy=20v10=20(#24787)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 2 +- Marlin/src/core/boards.h | 1 + Marlin/src/pins/pins.h | 2 + .../src/pins/stm32f4/pins_TH3D_EZBOARD_V2.h | 4 + Marlin/src/pins/stm32f4/pins_TRONXY_V10.h | 266 +++++++++ .../boards/marlin_STM32F446ZET_tronxy.json | 35 ++ .../MARLIN_F446Zx_TRONXY/PeripheralPins.c | 359 +++++++++++++ .../MARLIN_F446Zx_TRONXY/PinNamesVar.h | 30 ++ .../MARLIN_F446Zx_TRONXY/hal_conf_custom.h | 505 ++++++++++++++++++ .../variants/MARLIN_F446Zx_TRONXY/ldscript.ld | 188 +++++++ .../variants/MARLIN_F446Zx_TRONXY/variant.cpp | 322 +++++++++++ .../variants/MARLIN_F446Zx_TRONXY/variant.h | 242 +++++++++ ini/stm32f4.ini | 15 + 13 files changed, 1970 insertions(+), 1 deletion(-) create mode 100644 Marlin/src/pins/stm32f4/pins_TRONXY_V10.h create mode 100644 buildroot/share/PlatformIO/boards/marlin_STM32F446ZET_tronxy.json create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/PeripheralPins.c create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/PinNamesVar.h create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/hal_conf_custom.h create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/ldscript.ld create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/variant.cpp create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/variant.h diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 9783b2ec67..83c1c541e3 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -3059,7 +3059,7 @@ //#define MKS_ROBIN_TFT_V1_1R // -// 480x320, 3.5", FSMC Stock Display from TronxXY +// 480x320, 3.5", FSMC Stock Display from Tronxy // //#define TFT_TRONXY_X5SA diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 74ff44d990..c993b9df0e 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -426,6 +426,7 @@ #define BOARD_OPULO_LUMEN_REV4 4241 // Opulo Lumen PnP Controller REV4 (STM32F407VE / STM32F407VG) #define BOARD_FYSETC_SPIDER_KING407 4242 // FYSETC Spider King407 (STM32F407ZG) #define BOARD_MKS_SKIPR_V1 4243 // MKS SKIPR v1.0 all-in-one board (STM32F407VE) +#define BOARD_TRONXY_V10 4244 // TRONXY V10 (STM32F446ZE) // // ARM Cortex M7 diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index c623b4844d..046957e1ba 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -711,6 +711,8 @@ #include "stm32f4/pins_FYSETC_SPIDER_KING407.h" // STM32F4 env:FYSETC_SPIDER_KING407 #elif MB(MKS_SKIPR_V1) #include "stm32f4/pins_MKS_SKIPR_V1_0.h" // STM32F4 env:mks_skipr_v1 env:mks_skipr_v1_nobootloader +#elif MB(TRONXY_V10) + #include "stm32f4/pins_TRONXY_V10.h" // STM32F4 env:STM32F446_tronxy // // ARM Cortex M7 diff --git a/Marlin/src/pins/stm32f4/pins_TH3D_EZBOARD_V2.h b/Marlin/src/pins/stm32f4/pins_TH3D_EZBOARD_V2.h index 1a75a859e6..1a7a5cd1c3 100644 --- a/Marlin/src/pins/stm32f4/pins_TH3D_EZBOARD_V2.h +++ b/Marlin/src/pins/stm32f4/pins_TH3D_EZBOARD_V2.h @@ -24,6 +24,10 @@ #define ALLOW_STM32DUINO #include "env_validate.h" +#if HOTENDS > 1 || E_STEPPERS > 1 + #error "TH3D EZBoard only supports 1 hotend / E stepper." +#endif + #define BOARD_INFO_NAME "TH3D EZBoard V2" #define BOARD_WEBSITE_URL "th3dstudio.com" diff --git a/Marlin/src/pins/stm32f4/pins_TRONXY_V10.h b/Marlin/src/pins/stm32f4/pins_TRONXY_V10.h new file mode 100644 index 0000000000..e3b9f7ef6e --- /dev/null +++ b/Marlin/src/pins/stm32f4/pins_TRONXY_V10.h @@ -0,0 +1,266 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +#include "env_validate.h" + +#if HOTENDS > 3 || E_STEPPERS > 3 + #error "Tronxy V10 supports up to 3 hotends / E steppers." +#endif + +#define BOARD_INFO_NAME "Tronxy V10" +#define DEFAULT_MACHINE_NAME BOARD_INFO_NAME + +#define STEP_TIMER 6 +#define TEMP_TIMER 14 + +// +// Servos +// +//#define SERVO0_PIN PB10 + +// +// EEPROM +// +#if NO_EEPROM_SELECTED + #undef NO_EEPROM_SELECTED + #if TRONXY_UI > 0 + #define EEPROM_AT24CXX + #else + #define FLASH_EEPROM_EMULATION + #endif +#endif + +#if ENABLED(FLASH_EEPROM_EMULATION) + // SoC Flash (framework-arduinoststm32-maple/STM32F1/libraries/EEPROM/EEPROM.h) + #define EEPROM_START_ADDRESS (0x8000000UL + (512 * 1024) - 2 * EEPROM_PAGE_SIZE) + #define EEPROM_PAGE_SIZE (0x800U) // 2KB, but will use 2x more (4KB) + #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE +#else + #if ENABLED(EEPROM_AT24CXX) + #define AT24CXX_SCL PB8 + #define AT24CXX_SDA PB9 + #define AT24CXX_WP PB7 + #else + #define I2C_EEPROM // AT24C32 + #endif + #define MARLIN_EEPROM_SIZE 0x1000 // 4K +#endif + +// +// SPI Flash +// +//#define SPI_FLASH +#if ENABLED(SPI_FLASH) + #define SPI_FLASH_SIZE 0x200000 // 2MB + #define W25QXX_CS_PIN PG15 // SPI2 + #define W25QXX_MOSI_PIN PB5 + #define W25QXX_MISO_PIN PB4 + #define W25QXX_SCK_PIN PB3 +#endif + +// +// Limit Switches +// +#define X_MIN_PIN PC15 +#define X_MAX_PIN PB0 +#define Y_STOP_PIN PC14 + +#ifndef Z_MIN_PROBE_PIN + #define Z_MIN_PROBE_PIN PE3 +#endif + +#if ENABLED(DUAL_Z_ENDSTOP_PROBE) + #if NUM_Z_STEPPERS > 1 && Z_HOME_TO_MAX // Swap Z1/Z2 for dual Z with max homing + #define Z_MIN_PIN PF11 + #define Z_MAX_PIN PC13 + #else + #define Z_MIN_PIN PC13 + #define Z_MAX_PIN PF11 + #endif +#else + #ifndef Z_STOP_PIN + #define Z_STOP_PIN PC13 + #endif +#endif +// +// Filament Sensors +// +#ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN PE6 // MT_DET +#endif +#ifndef FIL_RUNOUT2_PIN + #define FIL_RUNOUT2_PIN PF12 +#endif + +// +// Steppers +// +#define X_ENABLE_PIN PF0 +#define X_STEP_PIN PE5 +#define X_DIR_PIN PF1 + +#define Y_ENABLE_PIN PF5 +#define Y_STEP_PIN PF9 +#define Y_DIR_PIN PF3 + +#define Z_ENABLE_PIN PA5 +#define Z_STEP_PIN PA6 +#define Z_DIR_PIN PF15 + +#define E0_ENABLE_PIN PF14 +#define E0_STEP_PIN PB1 +#define E0_DIR_PIN PF13 + +#define E1_ENABLE_PIN PG5 +#define E1_STEP_PIN PD12 +#define E1_DIR_PIN PG4 + +#define E2_ENABLE_PIN PF7 +#define E2_STEP_PIN PF6 +#define E2_DIR_PIN PF4 + +// +// Temperature Sensors +// +#define TEMP_0_PIN PC3 // TH1 +#define TEMP_BED_PIN PC2 // TB1 + +// +// Heaters / Fans +// +#define HEATER_0_PIN PG7 // HEATER1 +#define HEATER_BED_PIN PE2 // HOT BED +//#define HEATER_BED_INVERTING true + +#define FAN_PIN PG0 // FAN0 +#define FAN1_PIN PB6 // FAN1 +#define FAN2_PIN PG9 // FAN2 +#define FAN3_PIN PF10 // FAN3 +#define CONTROLLER_FAN_PIN PD7 // BOARD FAN +#define FAN_SOFT_PWM + +// +// Laser / Spindle +// +#if HAS_CUTTER + #define SPINDLE_LASER_ENA_PIN PB11 // wifi:TX + #if ENABLED(SPINDLE_LASER_USE_PWM) + #define SPINDLE_LASER_PWM_PIN PB10 // wifi:RX-TIM2_CH3 + // The PWM pin definition const PinMap PinMap_PWM[] in PeripheralPins.c must be compounded here + // See PWM_PIN(x) definition for details + #endif +#endif + +// +// Misc +// +#define BEEPER_PIN PA8 + +//#define LED_PIN PG10 +#define PS_ON_PIN PG10 // Temporarily switch the machine with LED simulation + +#if ENABLED(TRONXY_BACKUP_POWER) + #define POWER_LOSS_PIN PF11 // Configure as drop-down input +#else + #define POWER_LOSS_PIN PE1 // Output of LM393 comparator, configured as pullup +#endif +//#define POWER_LM393_PIN PE0 // +V for the LM393 comparator, configured as output high + +#if ENABLED(TFT_TRONXY_X5SA) + #error "TFT_TRONXY_X5SA is not yet supported." +#endif + +#if 0 + +// +// TFT with FSMC interface +// +#if HAS_FSMC_TFT + #define TFT_RESET_PIN PB12 + #define TFT_BACKLIGHT_PIN PG8 + + #define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT + #define FSMC_DMA_DEV DMA2 + #define FSMC_DMA_CHANNEL DMA_CH5 + + #define TFT_CS_PIN PG12 + #define TFT_RS_PIN PG2 + + //#define TFT_WIDTH 480 + //#define TFT_HEIGHT 320 + //#define TFT_PIXEL_OFFSET_X 48 + //#define TFT_PIXEL_OFFSET_Y 32 + //#define TFT_DRIVER ILI9488 + //#define TFT_BUFFER_SIZE 14400 + + #if NEED_TOUCH_PINS + #define TOUCH_CS_PIN PD11 // SPI1_NSS + #define TOUCH_SCK_PIN PB13 // SPI1_SCK + #define TOUCH_MISO_PIN PB14 // SPI1_MISO + #define TOUCH_MOSI_PIN PB15 // SPI1_MOSI + #endif + + #if (LCD_CHIP_INDEX == 1 && (TRONXY_UI == 1 || TRONXY_UI == 2)) || LCD_CHIP_INDEX == 3 + #define TOUCH_CALIBRATION_X -17181 + #define TOUCH_CALIBRATION_Y 11434 + #define TOUCH_OFFSET_X 501 + #define TOUCH_OFFSET_Y -9 + #elif LCD_CHIP_INDEX == 1 && TRONXY_UI == 4 + #define TOUCH_CALIBRATION_X 11166 + #define TOUCH_CALIBRATION_Y 17162 + #define TOUCH_OFFSET_X -10 + #define TOUCH_OFFSET_Y -16 + #elif LCD_CHIP_INDEX == 4 && TRONXY_UI == 3 + //#define TOUCH_CALIBRATION_X 8781 + //#define TOUCH_CALIBRATION_Y 11773 + //#define TOUCH_OFFSET_X -17 + //#define TOUCH_OFFSET_Y -16 + // Upside-down + #define TOUCH_CALIBRATION_X -8553 + #define TOUCH_CALIBRATION_Y -11667 + #define TOUCH_OFFSET_X 253 + #define TOUCH_OFFSET_Y 331 + #elif LCD_CHIP_INDEX == 2 + #define TOUCH_CALIBRATION_X 17184 + #define TOUCH_CALIBRATION_Y 10604 + #define TOUCH_OFFSET_X -31 + #define TOUCH_OFFSET_Y -29 + #endif +#endif + +#endif + +// +// SD Card +// +#define SDIO_SUPPORT +#define SD_DETECT_PIN -1 // PF0, but not connected +#define SDIO_CLOCK 4500000 +#define SDIO_READ_RETRIES 16 + +#define SDIO_D0_PIN PC8 +#define SDIO_D1_PIN PC9 +#define SDIO_D2_PIN PC10 +#define SDIO_D3_PIN PC11 +#define SDIO_CK_PIN PC12 +#define SDIO_CMD_PIN PD2 diff --git a/buildroot/share/PlatformIO/boards/marlin_STM32F446ZET_tronxy.json b/buildroot/share/PlatformIO/boards/marlin_STM32F446ZET_tronxy.json new file mode 100644 index 0000000000..bd129a703a --- /dev/null +++ b/buildroot/share/PlatformIO/boards/marlin_STM32F446ZET_tronxy.json @@ -0,0 +1,35 @@ +{ + "build": { + "cpu": "cortex-m4", + "extra_flags": "-DSTM32F446xx", + "f_cpu": "180000000L", + "mcu": "stm32f446zet6", + "variant": "MARLIN_F446Zx_TRONXY" + }, + "connectivity": [ + "can" + ], + "debug": { + "jlink_device": "STM32F446ZE", + "openocd_target": "stm32f4x", + "svd_path": "STM32F446x.svd" + }, + "frameworks": [ + "arduino", + "stm32cube" + ], + "name": "STM32F446ZE (128k RAM. 512k Flash)", + "upload": { + "maximum_ram_size": 131072, + "maximum_size": 524288, + "protocol": "stlink", + "protocols": [ + "jlink", + "stlink", + "blackmagic", + "serial" + ] + }, + "url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f446.html", + "vendor": "Generic" +} diff --git a/buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/PeripheralPins.c b/buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/PeripheralPins.c new file mode 100644 index 0000000000..4514efe7e4 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/PeripheralPins.c @@ -0,0 +1,359 @@ +/* + ******************************************************************************* + * Copyright (c) 2016, STMicroelectronics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************* + */ +#include "Arduino.h" +#include "PeripheralPins.h" + +// ===== +// Note: Commented lines are alternative possibilities which are not used per default. +// If you change them, you will have to know what you do +// ===== + + +//*** ADC *** + +#ifdef HAL_ADC_MODULE_ENABLED +const PinMap PinMap_ADC[] = { + // {PA_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC1_IN0 + // {PA_0, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC2_IN0 + // {PA_0, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC3_IN0 + // {PA_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC1_IN1 + // {PA_1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC2_IN1 + // {PA_1, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC3_IN1 + // {PA_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_IN2 + // {PA_2, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC2_IN2 + // {PA_2, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC3_IN2 + {PA_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_IN3 + // {PA_3, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC2_IN3 + // {PA_3, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC3_IN3 + {PA_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_IN4 + // {PA_4, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC2_IN4 + // {PA_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC1_IN5 + // {PA_5, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC2_IN5 + // {PA_6, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC1_IN6 + // {PA_6, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC2_IN6 + // {PA_7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC1_IN7 + // {PA_7, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC2_IN7 + // {PB_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_IN8 + // {PB_0, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC2_IN8 + // {PB_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_IN9 + // {PB_1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC2_IN9 + {PC_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_IN10 + // {PC_0, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC2_IN10 + // {PC_0, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC3_IN10 + {PC_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC1_IN11 + // {PC_1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC2_IN11 + // {PC_1, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC3_IN11 + {PC_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC1_IN12 + // {PC_2, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC2_IN12 + // {PC_2, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC3_IN12 + {PC_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC1_IN13 + // {PC_3, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC2_IN13 + // {PC_3, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC3_IN13 + {PC_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC1_IN14 + // {PC_4, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC2_IN14 + // {PC_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC1_IN15 + // {PC_5, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC2_IN15 + {NC, NP, 0} +}; +#endif + +//*** DAC *** + +#ifdef HAL_DAC_MODULE_ENABLED +const PinMap PinMap_DAC[] = { + // {PA_4, DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // DAC_OUT1 + // {PA_5, DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // DAC_OUT2 - LD2 + {NC, NP, 0} +}; +#endif + +//*** I2C *** + +#ifdef HAL_I2C_MODULE_ENABLED +const PinMap PinMap_I2C_SDA[] = { + // {PB_3, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + // {PB_4, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, + // {PB_7, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_9, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + // {PC_7, FMPI2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_FMPI2C1)}, + // {PC_9, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, + // {PC_12, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_I2C_MODULE_ENABLED +const PinMap PinMap_I2C_SCL[] = { + // {PA_8, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, + // {PB_6, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_8, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + // {PB_10, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + // {PC_6, FMPI2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_FMPI2C1)}, + {NC, NP, 0} +}; +#endif + +//*** PWM *** + +#ifdef HAL_TIM_MODULE_ENABLED +const PinMap PinMap_PWM[] = { + {PA_0, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + // {PA_0, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 1, 0)}, // TIM5_CH1 + // {PA_1, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 + {PA_1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)}, // TIM5_CH2 + // {PA_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 - STLink Tx + // {PA_2, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 3, 0)}, // TIM5_CH3 - STLink Tx + // {PA_2, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 1, 0)}, // TIM9_CH1 - STLink Tx + // {PA_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 - STLink Rx + // {PA_3, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 4, 0)}, // TIM5_CH4 - STLink Rx + // {PA_3, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 2, 0)}, // TIM9_CH2 - STLink Rx + {PA_5, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + // {PA_5, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 1)}, // TIM8_CH1N + {PA_6, TIM13, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM13, 1, 0)}, // TIM13_CH1 + // {PA_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + //{PA_7, TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM14, 1, 0)}, // TIM14_CH1 + // {PA_7, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N + // {PA_7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + // {PA_7, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 1)}, // TIM8_CH1N + // {PA_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1 + {PA_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2 + {PA_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3 + {PA_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4 + {PA_15, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + // {PB_0, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + // {PB_0, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 + {PB_0, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)}, // Fan0, TIM8_CH2N + // {PB_1, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + // {PB_1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 + {PB_1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 1)}, // Fan1, TIM8_CH3N + {PB_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // Fan2, TIM2_CH4 + {PB_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // E0 Heater, TIM2_CH2 + {PB_4, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // E1 Heater, TIM3_CH1 + {PB_5, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // LED G, TIM3_CH2 + {PB_6, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // LED R, TIM4_CH1 + {PB_7, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // LED B, TIM4_CH2 + // {PB_8, TIM10, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM10, 1, 0)}, // TIM10_CH1 + // {PB_8, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + {PB_8, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3 + {PB_9, TIM11, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM11, 1, 0)}, // TIM11_CH1 + // {PB_9, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 + // {PB_9, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4 + {PB_10, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 + {PB_13, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N + {PB_14, TIM12, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM12, 1, 0)}, // TIM12_CH1 + // {PB_14, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + // {PB_14, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)}, // TIM8_CH2N + {PB_15, TIM12, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM12, 2, 0)}, // TIM12_CH2 + // {PB_15, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + // {PB_15, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 1)}, // TIM8_CH3N + {PC_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + // {PC_6, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 0)}, // TIM8_CH1 + // {PC_7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + {PC_7, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 0)}, // TIM8_CH2 + {PC_8, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 + // {PC_8, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 0)}, // TIM8_CH3 + // {PC_9, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 + {PC_9, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 4, 0)}, // TIM8_CH4 + {PD_15, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4 + {PE_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1 + {PE_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + {NC, NP, 0} +}; +#endif + +//*** SERIAL *** + +#ifdef HAL_UART_MODULE_ENABLED +const PinMap PinMap_UART_TX[] = { + // {PA_0, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + // {PA_2, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_9, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + // {PB_6, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + // {PB_10, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + // {PC_6, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + // {PC_10, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PC_10, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + // {PC_12, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +const PinMap PinMap_UART_RX[] = { + // {PA_1, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + // {PA_3, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_10, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + // {PB_7, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + // {PC_5, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + // {PC_7, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + // {PC_11, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PC_11, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + // {PD_2, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +const PinMap PinMap_UART_RTS[] = { + // {PA_1, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + // {PA_12, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + // {PA_15, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + // {PB_14, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + // {PC_8, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART5)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +const PinMap PinMap_UART_CTS[] = { + // {PA_0, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + // {PA_11, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + // {PB_0, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + // {PB_13, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + // {PC_9, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART5)}, + {NC, NP, 0} +}; +#endif + +//*** SPI *** + +#ifdef HAL_SPI_MODULE_ENABLED +const PinMap PinMap_SPI_MOSI[] = { + {PA_7, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + // {PB_0, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI3)}, + // {PB_2, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI3)}, + // {PB_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + // {PB_5, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + // {PB_15, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + // {PC_1, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI2)}, + // {PC_1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI3)}, + // {PC_3, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + // {PC_12, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +const PinMap PinMap_SPI_MISO[] = { + {PA_6, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + // {PB_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + // {PB_4, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + // {PB_14, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + // {PC_2, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + // {PC_11, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +const PinMap PinMap_SPI_SCLK[] = { + {PA_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + // {PA_9, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + // {PB_3, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + // {PB_3, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + // {PB_10, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + // {PB_13, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + // {PC_7, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + // {PC_10, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +const PinMap PinMap_SPI_SSEL[] = { + {PA_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + // {PA_4, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + // {PA_15, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + // {PA_15, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + // {PB_4, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI2)}, + // {PB_9, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + // {PB_12, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {NC, NP, 0} +}; +#endif + +//*** CAN *** + +#ifdef HAL_CAN_MODULE_ENABLED +const PinMap PinMap_CAN_RD[] = { + // {PA_11, CAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)}, + // {PB_5, CAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)}, + // {PB_8, CAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)}, + // {PB_12, CAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_CAN_MODULE_ENABLED +const PinMap PinMap_CAN_TD[] = { + // {PA_12, CAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)}, + // {PB_6, CAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)}, + // {PB_9, CAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)}, + // {PB_13, CAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)}, + {NC, NP, 0} +}; +#endif + +//*** ETHERNET *** + +//*** No Ethernet *** + +//*** QUADSPI *** + +#ifdef HAL_QSPI_MODULE_ENABLED +const PinMap PinMap_QUADSPI[] = { + // {PA_1, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QSPI)}, // QUADSPI_BK1_IO3 + // {PB_2, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QSPI)}, // QUADSPI_CLK + // {PB_6, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_QSPI)}, // QUADSPI_BK1_NCS + // {PC_9, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QSPI)}, // QUADSPI_BK1_IO0 + // {PC_10, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QSPI)}, // QUADSPI_BK1_IO1 + // {PC_11, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QSPI)}, // QUADSPI_BK2_NCS + {NC, NP, 0} +}; +#endif + +//*** USB *** + +#ifdef HAL_PCD_MODULE_ENABLED +const PinMap PinMap_USB_OTG_FS[] = { + // {PA_8, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_SOF + // {PA_9, USB_OTG_FS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 0)}, // USB_OTG_FS_VBUS + // {PA_10, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_ID + {PA_11, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_DM + {PA_12, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_DP + {NC, NP, 0} +}; +#endif + +#ifdef HAL_PCD_MODULE_ENABLED +const PinMap PinMap_USB_OTG_HS[] = { + {NC, NP, 0} +}; +#endif diff --git a/buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/PinNamesVar.h b/buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/PinNamesVar.h new file mode 100644 index 0000000000..bff3f21349 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/PinNamesVar.h @@ -0,0 +1,30 @@ +/* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, /* SYS_WKUP0 */ +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = NC, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = NC, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = NC, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = NC, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif +/* USB */ +#ifdef USBCON + USB_OTG_FS_DM = PA_11, + USB_OTG_FS_DP = PA_12, +#endif diff --git a/buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/hal_conf_custom.h b/buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/hal_conf_custom.h new file mode 100644 index 0000000000..e077592245 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/hal_conf_custom.h @@ -0,0 +1,505 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_conf.h + * @brief HAL configuration file. + ****************************************************************************** + * @attention + * + *

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

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

© COPYRIGHT(c) 2014 Ac6

+** +** Redistribution and use in source and binary forms, with or without modification, +** are permitted provided that the following conditions are met: +** 1. Redistributions of source code must retain the above copyright notice, +** this list of conditions and the following disclaimer. +** 2. Redistributions in binary form must reproduce the above copyright notice, +** this list of conditions and the following disclaimer in the documentation +** and/or other materials provided with the distribution. +** 3. Neither the name of Ac6 nor the names of its contributors +** may be used to endorse or promote products derived from this software +** without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +** +***************************************************************************** +*/ + +/* Entry Point */ +ENTRY(Reset_Handler) + +/* Highest address of the user mode stack */ +_estack = 0x20000000 + LD_MAX_DATA_SIZE; /* end of RAM */ +/* Generate a link error if heap and stack don't fit into RAM */ +_Min_Heap_Size = 0x2000; /* required amount of heap */ +_Min_Stack_Size = 0x400; /* required amount of stack */ + +/* Specify the memory areas */ +MEMORY +{ +RAM (xrw) : ORIGIN = 0x20000000, LENGTH = LD_MAX_DATA_SIZE +FLASH (rx) : ORIGIN = 0x08000000 + LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET +} + +/* Define output sections */ +SECTIONS +{ + /* The startup code goes first into FLASH */ + .isr_vector : + { + . = ALIGN(4); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(4); + } >FLASH + + /* The program code and other data goes into FLASH */ + .text ALIGN(4): + { + . = ALIGN(4); + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + *(.eh_frame) + + KEEP (*(.init)) + KEEP (*(.fini)) + + . = ALIGN(8); /*YSZ-WORK:4->8*/ + _etext = .; /* define a global symbols at end of code */ + } >FLASH + + /* Constant data goes into FLASH */ + .rodata : + { + . = ALIGN(4); + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + . = ALIGN(4); + } >FLASH + + .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH + .ARM : { + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + } >FLASH + + .preinit_array : + { + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + } >FLASH + .init_array : + { + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + } >FLASH + .fini_array : + { + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array*)) + PROVIDE_HIDDEN (__fini_array_end = .); + } >FLASH + + /* used by the startup to initialize data */ + _sidata = LOADADDR(.data); + + /* Initialized data sections goes into RAM, load LMA copy after code */ + .data : + { + . = ALIGN(4); + _sdata = .; /* create a global symbol at data start */ + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + + . = ALIGN(4); + _edata = .; /* define a global symbol at data end */ + } >RAM AT> FLASH + + + /* Uninitialized data section */ + . = ALIGN(4); + .bss : + { + /* This is used by the startup in order to initialize the .bss secion */ + _sbss = .; /* define a global symbol at bss start */ + __bss_start__ = _sbss; + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ebss = .; /* define a global symbol at bss end */ + __bss_end__ = _ebss; + } >RAM + + /* User_heap_stack section, used to check that there is enough RAM left */ + ._user_heap_stack : + { + . = ALIGN(4);/*YSZ-WORK:8->4*/ + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(4);/*YSZ-WORK:8->4*/ + } >RAM + + + + /* Remove information from the standard libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } +} + + diff --git a/buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/variant.cpp b/buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/variant.cpp new file mode 100644 index 0000000000..807b9392eb --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/variant.cpp @@ -0,0 +1,322 @@ +/* + Copyright (c) 2011 Arduino. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "pins_arduino.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Pin number +const PinName digitalPin[] = { + PA_0, //D0 + PA_1, //D1 + PA_2, //D2 + PA_3, //D3 + PA_4, //D4 + PA_5, //D5 + PA_6, //D6 + PA_7, //D7 + PA_8, //D8 + PA_9, //D9 + PA_10, //D10 + PA_11, //D11 + PA_12, //D12 + PA_13, //D13 + PA_14, //D14 + PA_15, //D15 + PB_0, //D16 + PB_1, //D17 + PB_2, //D18 + PB_3, //D19 + PB_4, //D20 + PB_5, //D21 + PB_6, //D22 + PB_7, //D23 + PB_8, //D24 + PB_9, //D25 + PB_10, //D26 + PB_11, //D27 + PB_12, //D28 + PB_13, //D29 + PB_14, //D30 + PB_15, //D31 + PC_0, //D32 + PC_1, //D33 + PC_2, //D34 + PC_3, //D35 + PC_4, //D36 + PC_5, //D37 + PC_6, //D38 + PC_7, //D39 + PC_8, //D40 + PC_9, //D41 + PC_10, //D42 + PC_11, //D43 + PC_12, //D44 + PC_13, //D45 + PC_14, //D46 + PC_15, //D47 + PD_0, //D48 + PD_1, //D49 + PD_2, //D50 + PD_3, //D51 + PD_4, //D52 + PD_5, //D53 + PD_6, //D54 + PD_7, //D55 + PD_8, //D56 + PD_9, //D57 + PD_10, //D58 + PD_11, //D59 + PD_12, //D60 + PD_13, //D61 + PD_14, //D62 + PD_15, //D63 + PE_0, //D64 + PE_1, //D65 + PE_2, //D66 + PE_3, //D67 + PE_4, //D68 + PE_5, //D69 + PE_6, //D70 + PE_7, //D71 + PE_8, //D72 + PE_9, //D73 + PE_10, //D74 + PE_11, //D75 + PE_12, //D76 + PE_13, //D77 + PE_14, //D78 + PE_15, //D79 + PF_0, //D80 + PF_1, //D81 + PF_2, //D82 + PF_3, //D83 + PF_4, //D84 + PF_5, //D85 + PF_6, //D86 + PF_7, //D87 + PF_8, //D88 + PF_9, //D89 + PF_10, //D90 + PF_11, //D91 + PF_12, //D92 + PF_13, //D93 + PF_14, //D94 + PF_15, //D95 + PG_0, //D96 + PG_1, //D97 + PG_2, //D98 + PG_3, //D99 + PG_4, //D100 + PG_5, //D101 + PG_6, //D102 + PG_7, //D103 + PG_8, //D104 + PG_9, //D105 + PG_10, //D106 + PG_11, //D107 + PG_12, //D108 + PG_13, //D109 + PG_14, //D110 + PG_15, //D111 + PH_0, //D112 + PH_1, //D113 + PH_2, //D114 + PH_3, //D115 + PH_4, //D116 + PH_5, //D117 + PH_6, //D118 + PH_7, //D119 + PH_8, //D120 + PH_9, //D121 + PH_10, //D122 + PH_11, //D123 + PH_12, //D124 + PH_13, //D125 + PH_14, //D126 + PH_15, //D127 + + //Duplicated ADC Pins + PC_3, //A0 T0 D128 + PC_0, //A1 T1 D129 + PC_2, //A2 BED D130 +}; + +#ifdef __cplusplus +} +#endif + +// ---------------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +uint32_t myvar[] = {1,2,3,4,5,6,7,8}; +void myshow(int fre,int times)//YSZ-WORK +{ + uint32_t index = 10; + RCC->AHB1ENR |= 1 << 6;//端口G时钟 + GPIOG->MODER &= ~(3UL << 2 * index);//清除旧模式 + GPIOG->MODER |= 1 << 2 * index;//模式为输出 + GPIOG->OSPEEDR &= ~(3UL << 2 * index); //清除旧输出速度 + GPIOG->OSPEEDR |= 2 << 2 * index;//设置输出速度 + GPIOG->OTYPER &= ~(1UL << index);//清除旧输出方式 + GPIOG->OTYPER |= 0 << index;//设置输出方式为推挽 + GPIOG->PUPDR &= ~(3 << 2 * index);//先清除原来的设置 + GPIOG->PUPDR |= 1 << 2 * index;//设置新的上下拉 + while(times != 0) { + GPIOG->BSRR = 1UL << index; + for(int i = 0;i < fre; i++) + for(int j = 0; j < 1000000; j++)__NOP(); + GPIOG->BSRR = 1UL << (index + 16); + for(int i = 0;i < fre; i++) + for(int j = 0; j < 1000000; j++)__NOP(); + if(times > 0)times--; + } +} + +HAL_StatusTypeDef SDMMC_IsProgramming(SDIO_TypeDef *SDIOx,uint32_t RCA) +{ + HAL_SD_CardStateTypeDef CardState; + volatile uint32_t respR1 = 0, status = 0; + SDIO_CmdInitTypeDef sdmmc_cmdinit; + do { + sdmmc_cmdinit.Argument = RCA << 16; + sdmmc_cmdinit.CmdIndex = SDMMC_CMD_SEND_STATUS; + sdmmc_cmdinit.Response = SDIO_RESPONSE_SHORT; + sdmmc_cmdinit.WaitForInterrupt = SDIO_WAIT_NO; + sdmmc_cmdinit.CPSM = SDIO_CPSM_ENABLE; + SDIO_SendCommand(SDIOx,&sdmmc_cmdinit);//发送CMD13 + do status = SDIOx->STA; + while(!(status & ((1 << 0) | (1 << 6) | (1 << 2))));//等待操作完成 + if(status & (1 << 0)) //CRC检测失败 + { + SDIOx->ICR |= 1 << 0; //清除错误标记 + return HAL_ERROR; + } + if(status & (1 << 2)) //命令超时 + { + SDIOx->ICR |= 1 << 2; //清除错误标记 + return HAL_ERROR; + } + if(SDIOx->RESPCMD != SDMMC_CMD_SEND_STATUS)return HAL_ERROR; + SDIOx->ICR = 0X5FF; //清除所有标记 + respR1 = SDIOx->RESP1; + CardState = (respR1 >> 9) & 0x0000000F; + }while((CardState == HAL_SD_CARD_RECEIVING) || (CardState == HAL_SD_CARD_SENDING) || (CardState == HAL_SD_CARD_PROGRAMMING)); + return HAL_OK; +} +void debugStr(const char*str) { + while(*str) { + while((USART1->SR & 0x40) == 0); + USART1->DR = *str++; + } +} +/** + * @brief System Clock Configuration + * The system Clock is configured as follow : + * System Clock source = PLL (HSE) + * SYSCLK(Hz) = 168000000/120000000/180000000 + * HCLK(Hz) = 168000000/120000000/180000000 + * AHB Prescaler = 1 + * APB1 Prescaler = 4 + * APB2 Prescaler = 2 + * HSE Frequency(Hz) = 8000000 + * PLL_M = 8/4/8 + * PLL_N = 336/120/360 + * PLL_P = 2 + * PLL_Q = 7/5/7 + * VDD(V) = 3.3 + * Main regulator output voltage = Scale1 mode + * Flash Latency(WS) = 5 + * @param None + * @retval None + */ +WEAK void SystemClock_Config(void) +{ + RCC_ClkInitTypeDef RCC_ClkInitStruct; + RCC_OscInitTypeDef RCC_OscInitStruct; + RCC_PeriphCLKInitTypeDef PeriphClkInitStruct; + HAL_StatusTypeDef ret = HAL_OK; + + __HAL_FLASH_INSTRUCTION_CACHE_ENABLE(); + __HAL_FLASH_DATA_CACHE_ENABLE(); + __HAL_FLASH_PREFETCH_BUFFER_ENABLE(); + HAL_RCC_DeInit(); + + /* Enable Power Control clock */ + __HAL_RCC_PWR_CLK_ENABLE(); + + /* The voltage scaling allows optimizing the power consumption when the device is + clocked below the maximum system frequency, to update the voltage scaling value + regarding system frequency refer to product datasheet. */ + __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); + + /* Enable HSE Oscillator and activate PLL with HSE as source */ + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; + RCC_OscInitStruct.HSEState = RCC_HSE_ON; + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; + RCC_OscInitStruct.PLL.PLLM = 8; + RCC_OscInitStruct.PLL.PLLN = 336; + RCC_OscInitStruct.PLL.PLLP = 2; + RCC_OscInitStruct.PLL.PLLQ = 7; + RCC_OscInitStruct.PLL.PLLR = 2; + ret = HAL_RCC_OscConfig(&RCC_OscInitStruct); + + if(ret != HAL_OK)myshow(10,-1); + HAL_PWREx_EnableOverDrive(); + + /* Select PLLSAI output as USB clock source */ + PeriphClkInitStruct.PLLSAI.PLLSAIM = 8; + PeriphClkInitStruct.PLLSAI.PLLSAIN = 192; + PeriphClkInitStruct.PLLSAI.PLLSAIP = RCC_PLLSAIP_DIV4; + PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_CLK48 | RCC_PERIPHCLK_SDIO; + PeriphClkInitStruct.Clk48ClockSelection = RCC_CK48CLKSOURCE_PLLSAIP; + PeriphClkInitStruct.SdioClockSelection = RCC_SDIOCLKSOURCE_CLK48;//SDIO Clock Mux + HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct); + + /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 + clocks dividers */ + RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2); + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; + RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; + RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4; + RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2; + ret = HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5); + if(ret != HAL_OK)myshow(10,-1); + + SystemCoreClockUpdate();//更新系统时钟SystemCoreClock + /**Configure the Systick interrupt time + */ + HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000); + + /**Configure the Systick + */ + HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK); + + /* SysTick_IRQn interrupt configuration */ + HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0); + __enable_irq();//打开中断,因为在bootloader中关闭了,所以这里要打开 +} +#ifdef __cplusplus +} +#endif diff --git a/buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/variant.h new file mode 100644 index 0000000000..29649de938 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/variant.h @@ -0,0 +1,242 @@ +/* + Copyright (c) 2011 Arduino. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef _VARIANT_ARDUINO_STM32_ +#define _VARIANT_ARDUINO_STM32_ + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +extern unsigned long myvar[]; +void myshow(int fre,int times); +void debugStr(const char*str); +/*---------------------------------------------------------------------------- + * Pins + *----------------------------------------------------------------------------*/ + +#define PA0 0x00 +#define PA1 0x01 +#define PA2 0x02 +#define PA3 0x03 +#define PA4 0x04 +#define PA5 0x05 +#define PA6 0x06 +#define PA7 0x07 +#define PA8 0x08 +#define PA9 0x09 +#define PA10 0x0A +#define PA11 0x0B +#define PA12 0x0C +#define PA13 0x0D +#define PA14 0x0E +#define PA15 0x0F + +#define PB0 0x10 +#define PB1 0x11 +#define PB2 0x12 +#define PB3 0x13 +#define PB4 0x14 +#define PB5 0x15 +#define PB6 0x16 +#define PB7 0x17 // 36 pins (F103T) +#define PB8 0x18 +#define PB9 0x19 +#define PB10 0x1A +#define PB11 0x1B +#define PB12 0x1C +#define PB13 0x1D +#define PB14 0x1E +#define PB15 0x1F + +#define PC0 0x20 +#define PC1 0x21 +#define PC2 0x22 +#define PC3 0x23 +#define PC4 0x24 +#define PC5 0x25 +#define PC6 0x26 +#define PC7 0x27 +#define PC8 0x28 +#define PC9 0x29 +#define PC10 0x2A +#define PC11 0x2B +#define PC12 0x2C +#define PC13 0x2D +#define PC14 0x2E +#define PC15 0x2F + +#define PD0 0x30 +#define PD1 0x31 +#define PD2 0x32 // 64 pins (F103R) +#define PD3 0x33 +#define PD4 0x34 +#define PD5 0x35 +#define PD6 0x36 +#define PD7 0x37 +#define PD8 0x38 +#define PD9 0x39 +#define PD10 0x3A +#define PD11 0x3B +#define PD12 0x3C +#define PD13 0x3D +#define PD14 0x3E +#define PD15 0x3F + +#define PE0 0x40 +#define PE1 0x41 +#define PE2 0x42 +#define PE3 0x43 +#define PE4 0x44 +#define PE5 0x45 +#define PE6 0x46 +#define PE7 0x47 +#define PE8 0x48 +#define PE9 0x49 +#define PE10 0x4A +#define PE11 0x4B +#define PE12 0x4C +#define PE13 0x4D +#define PE14 0x4E +#define PE15 0x4F // 100 pins (F446V) + +#define PF0 0x50 +#define PF1 0x51 +#define PF2 0x52 +#define PF3 0x53 +#define PF4 0x54 +#define PF5 0x55 +#define PF6 0x56 +#define PF7 0x57 +#define PF8 0x58 +#define PF9 0x59 +#define PF10 0x5A +#define PF11 0x5B +#define PF12 0x5C +#define PF13 0x5D +#define PF14 0x5E +#define PF15 0x5F + +#define PG0 0x60 +#define PG1 0x61 +#define PG2 0x62 +#define PG3 0x63 +#define PG4 0x64 +#define PG5 0x65 +#define PG6 0x66 +#define PG7 0x67 +#define PG8 0x68 +#define PG9 0x69 +#define PG10 0x6A +#define PG11 0x6B +#define PG12 0x6C +#define PG13 0x6D +#define PG14 0x6E +#define PG15 0x6F + +#define PH0 0x70 +#define PH1 0x71 +#define PH2 0x72 +#define PH3 0x73 +#define PH4 0x74 +#define PH5 0x75 +#define PH6 0x76 +#define PH7 0x77 +#define PH8 0x78 +#define PH9 0x79 +#define PH10 0x7A +#define PH11 0x7B +#define PH12 0x7C +#define PH13 0x7D +#define PH14 0x7E +#define PH15 0x7F // 144 pins (F446Z) + +// This must be a literal with the same value as PEND +#define NUM_DIGITAL_PINS 0x80 +// This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS +#define NUM_ANALOG_INPUTS 3 +#define NUM_ANALOG_FIRST 128 + +// PWM resolution +// #define PWM_RESOLUTION 12 +#define PWM_FREQUENCY 20000 // >= 20 Khz => inaudible noise for fans +#define PWM_MAX_DUTY_CYCLE 255 + +// SPI Definitions +// #define PIN_SPI_SS PG15 +// #define PIN_SPI_MOSI PB5 +// #define PIN_SPI_MISO PB4 +// #define PIN_SPI_SCK PB3 + +// I2C Definitions +#define PIN_WIRE_SDA PB9 +#define PIN_WIRE_SCL PB8 +#define PIN_I2C_WP PB7 +#define EEPROM_DEVICE_ADDRESS 0x50 + +// Timer Definitions +// Do not use timer used by PWM pin. See PinMap_PWM. +#define TIMER_TONE TIM8 +#define TIMER_SERVO TIM5 +#define TIMER_SERIAL TIM7 + +// UART Definitions +//#define SERIAL_UART_INSTANCE 1 // Connected to EXP3 header +/* Enable Serial 3 */ +#define HAVE_HWSERIAL1 +// #define HAVE_HWSERIAL3 + +// Default pin used for 'Serial' instance (ex: ST-Link) +// Mandatory for Firmata +#define PIN_SERIAL_RX PA10 +#define PIN_SERIAL_TX PA9 + +/* HAL configuration */ +#define HSE_VALUE 8000000U + +#define FLASH_PAGE_SIZE (4U * 1024U) + +#ifdef __cplusplus +} // extern "C" +#endif + +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ + +#ifdef __cplusplus +// These serial port names are intended to allow libraries and architecture-neutral +// sketches to automatically default to the correct port name for a particular type +// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, +// the first hardware serial port whose RX/TX pins are not dedicated to another use. +// +// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor +// +// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial +// +// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library +// +// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. +// +// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX +// pins are NOT connected to anything by default. +#define SERIAL_PORT_MONITOR Serial +#define SERIAL_PORT_HARDWARE_OPEN Serial +#endif + +#endif /* _VARIANT_ARDUINO_STM32_ */ diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 471e9e7fb4..7618cd0936 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -699,3 +699,18 @@ board_build.offset = 0x0000 board_upload.offset_address = 0x08000000 upload_protocol = dfu upload_command = dfu-util -a 0 -s 0x08000000:leave -D "$SOURCE" + +# +# STM32F446ZET6 ARM Cortex-M4 +# +[env:STM32F446_tronxy] +platform = ${common_stm32.platform} +extends = stm32_variant +board = marlin_STM32F446ZET_tronxy +board_build.offset = 0x10000 +board_build.rename = fmw_tronxy.bin +build_src_filter = ${common_stm32.build_src_filter} +build_flags = ${stm32_variant.build_flags} + -DSTM32F4xx +build_unflags = ${stm32_variant.build_unflags} -fno-rtti + -DUSBCON -DUSBD_USE_CDC From e298266eff9a53dd0bdddf5488135681d09baa77 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 17 Oct 2022 21:41:22 -0500 Subject: [PATCH 009/109] =?UTF-8?q?=F0=9F=8E=A8=20CONF=5FSERIAL=5FIS=20=3D?= =?UTF-8?q?>=20SERIAL=5FIN=5FUSE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/AVR/inc/SanityCheck.h | 10 +++++----- Marlin/src/HAL/DUE/inc/SanityCheck.h | 8 ++++---- Marlin/src/HAL/STM32/eeprom_flash.cpp | 18 ++++++++++-------- Marlin/src/inc/Conditionals_post.h | 6 +++--- Marlin/src/pins/pinsDebug.h | 16 ++++++++-------- 5 files changed, 30 insertions(+), 28 deletions(-) diff --git a/Marlin/src/HAL/AVR/inc/SanityCheck.h b/Marlin/src/HAL/AVR/inc/SanityCheck.h index 89425ca853..411b0198f1 100644 --- a/Marlin/src/HAL/AVR/inc/SanityCheck.h +++ b/Marlin/src/HAL/AVR/inc/SanityCheck.h @@ -37,22 +37,22 @@ || X_ENA_PIN == N || Y_ENA_PIN == N || Z_ENA_PIN == N \ || BTN_EN1 == N || BTN_EN2 == N \ ) -#if CONF_SERIAL_IS(0) +#if SERIAL_IN_USE(0) // D0-D1. No known conflicts. #endif #if NOT_TARGET(__AVR_ATmega644P__, __AVR_ATmega1284P__) - #if CONF_SERIAL_IS(1) && (CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19)) + #if SERIAL_IN_USE(1) && (CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19)) #error "Serial Port 1 pin D18 and/or D19 conflicts with another pin on the board." #endif #else - #if CONF_SERIAL_IS(1) && (CHECK_SERIAL_PIN(10) || CHECK_SERIAL_PIN(11)) + #if SERIAL_IN_USE(1) && (CHECK_SERIAL_PIN(10) || CHECK_SERIAL_PIN(11)) #error "Serial Port 1 pin D10 and/or D11 conflicts with another pin on the board." #endif #endif -#if CONF_SERIAL_IS(2) && (CHECK_SERIAL_PIN(16) || CHECK_SERIAL_PIN(17)) +#if SERIAL_IN_USE(2) && (CHECK_SERIAL_PIN(16) || CHECK_SERIAL_PIN(17)) #error "Serial Port 2 pin D16 and/or D17 conflicts with another pin on the board." #endif -#if CONF_SERIAL_IS(3) && (CHECK_SERIAL_PIN(14) || CHECK_SERIAL_PIN(15)) +#if SERIAL_IN_USE(3) && (CHECK_SERIAL_PIN(14) || CHECK_SERIAL_PIN(15)) #error "Serial Port 3 pin D14 and/or D15 conflicts with another pin on the board." #endif #undef CHECK_SERIAL_PIN diff --git a/Marlin/src/HAL/DUE/inc/SanityCheck.h b/Marlin/src/HAL/DUE/inc/SanityCheck.h index 13484f7029..1f5acc360c 100644 --- a/Marlin/src/HAL/DUE/inc/SanityCheck.h +++ b/Marlin/src/HAL/DUE/inc/SanityCheck.h @@ -36,15 +36,15 @@ || X_DIR_PIN == N || Y_DIR_PIN == N || Z_DIR_PIN == N \ || X_ENA_PIN == N || Y_ENA_PIN == N || Z_ENA_PIN == N \ ) -#if CONF_SERIAL_IS(0) // D0-D1. No known conflicts. +#if SERIAL_IN_USE(0) // D0-D1. No known conflicts. #endif -#if CONF_SERIAL_IS(1) && (CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19)) +#if SERIAL_IN_USE(1) && (CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19)) #error "Serial Port 1 pin D18 and/or D19 conflicts with another pin on the board." #endif -#if CONF_SERIAL_IS(2) && (CHECK_SERIAL_PIN(16) || CHECK_SERIAL_PIN(17)) +#if SERIAL_IN_USE(2) && (CHECK_SERIAL_PIN(16) || CHECK_SERIAL_PIN(17)) #error "Serial Port 2 pin D16 and/or D17 conflicts with another pin on the board." #endif -#if CONF_SERIAL_IS(3) && (CHECK_SERIAL_PIN(14) || CHECK_SERIAL_PIN(15)) +#if SERIAL_IN_USE(3) && (CHECK_SERIAL_PIN(14) || CHECK_SERIAL_PIN(15)) #error "Serial Port 3 pin D14 and/or D15 conflicts with another pin on the board." #endif #undef CHECK_SERIAL_PIN diff --git a/Marlin/src/HAL/STM32/eeprom_flash.cpp b/Marlin/src/HAL/STM32/eeprom_flash.cpp index 7c8cc8dd21..78db07c6c0 100644 --- a/Marlin/src/HAL/STM32/eeprom_flash.cpp +++ b/Marlin/src/HAL/STM32/eeprom_flash.cpp @@ -95,7 +95,7 @@ static_assert(IS_FLASH_SECTOR(FLASH_SECTOR), "FLASH_SECTOR is invalid"); static_assert(IS_POWER_OF_2(FLASH_UNIT_SIZE), "FLASH_UNIT_SIZE should be a power of 2, please check your chip's spec sheet"); -#endif +#endif // FLASH_EEPROM_LEVELING static bool eeprom_data_written = false; @@ -189,15 +189,15 @@ bool PersistentStore::access_finish() { UNLOCK_FLASH(); - uint32_t offset = 0; - uint32_t address = SLOT_ADDRESS(current_slot); - uint32_t address_end = address + MARLIN_EEPROM_SIZE; - uint32_t data = 0; + uint32_t offset = 0, + address = SLOT_ADDRESS(current_slot), + address_end = address + MARLIN_EEPROM_SIZE, + data = 0; bool success = true; while (address < address_end) { - memcpy(&data, ram_eeprom + offset, sizeof(uint32_t)); + memcpy(&data, ram_eeprom + offset, sizeof(data)); status = HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, address, data); if (status == HAL_OK) { address += sizeof(uint32_t); @@ -221,7 +221,8 @@ bool PersistentStore::access_finish() { return success; - #else + #else !FLASH_EEPROM_LEVELING + // The following was written for the STM32F4 but may work with other MCUs as well. // Most STM32F4 flash does not allow reading from flash during erase operations. // This takes about a second on a STM32F407 with a 128kB sector used as EEPROM. @@ -235,7 +236,8 @@ bool PersistentStore::access_finish() { TERN_(HAS_PAUSE_SERVO_OUTPUT, RESUME_SERVO_OUTPUT()); eeprom_data_written = false; - #endif + + #endif // !FLASH_EEPROM_LEVELING } return true; diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 90ed750d4a..bb9a1ac640 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -2446,7 +2446,7 @@ // // Flag the indexed hardware serial ports in use -#define CONF_SERIAL_IS(N) ( (defined(SERIAL_PORT) && SERIAL_PORT == N) \ +#define SERIAL_IN_USE(N) ( (defined(SERIAL_PORT) && SERIAL_PORT == N) \ || (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == N) \ || (defined(SERIAL_PORT_3) && SERIAL_PORT_3 == N) \ || (defined(MMU2_SERIAL_PORT) && MMU2_SERIAL_PORT == N) \ @@ -2454,7 +2454,7 @@ // Flag the named hardware serial ports in use #define TMC_UART_IS(A,N) (defined(A##_HARDWARE_SERIAL) && (CAT(HW_,A##_HARDWARE_SERIAL) == HW_Serial##N || CAT(HW_,A##_HARDWARE_SERIAL) == HW_MSerial##N)) -#define ANY_SERIAL_IS(N) ( CONF_SERIAL_IS(N) \ +#define ANY_SERIAL_IS(N) ( SERIAL_IN_USE(N) \ || TMC_UART_IS(X, N) || TMC_UART_IS(Y , N) || TMC_UART_IS(Z , N) \ || TMC_UART_IS(I, N) || TMC_UART_IS(J , N) || TMC_UART_IS(K , N) \ || TMC_UART_IS(U, N) || TMC_UART_IS(V , N) || TMC_UART_IS(W , N) \ @@ -2481,7 +2481,7 @@ #define HW_MSerial9 518 #define HW_MSerial10 519 -#if CONF_SERIAL_IS(-1) +#if SERIAL_IN_USE(-1) #define USING_HW_SERIALUSB 1 #endif #if ANY_SERIAL_IS(0) diff --git a/Marlin/src/pins/pinsDebug.h b/Marlin/src/pins/pinsDebug.h index b662f09ba9..b938496915 100644 --- a/Marlin/src/pins/pinsDebug.h +++ b/Marlin/src/pins/pinsDebug.h @@ -49,19 +49,19 @@ // manually add pins that have names that are macros which don't play well with these macros #if ANY(AVR_ATmega2560_FAMILY, AVR_ATmega1284_FAMILY, ARDUINO_ARCH_SAM, TARGET_LPC1768) - #if CONF_SERIAL_IS(0) + #if SERIAL_IN_USE(0) static const char RXD_NAME_0[] PROGMEM = { "RXD0" }; static const char TXD_NAME_0[] PROGMEM = { "TXD0" }; #endif - #if CONF_SERIAL_IS(1) + #if SERIAL_IN_USE(1) static const char RXD_NAME_1[] PROGMEM = { "RXD1" }; static const char TXD_NAME_1[] PROGMEM = { "TXD1" }; #endif - #if CONF_SERIAL_IS(2) + #if SERIAL_IN_USE(2) static const char RXD_NAME_2[] PROGMEM = { "RXD2" }; static const char TXD_NAME_2[] PROGMEM = { "TXD2" }; #endif - #if CONF_SERIAL_IS(3) + #if SERIAL_IN_USE(3) static const char RXD_NAME_3[] PROGMEM = { "RXD3" }; static const char TXD_NAME_3[] PROGMEM = { "TXD3" }; #endif @@ -99,7 +99,7 @@ const PinInfo pin_array[] PROGMEM = { * 2 bytes containing the digital/analog bool flag */ - #if CONF_SERIAL_IS(0) + #if SERIAL_IN_USE(0) #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM) { RXD_NAME_0, 0, true }, { TXD_NAME_0, 1, true }, @@ -112,7 +112,7 @@ const PinInfo pin_array[] PROGMEM = { #endif #endif - #if CONF_SERIAL_IS(1) + #if SERIAL_IN_USE(1) #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM) { RXD_NAME_1, 19, true }, { TXD_NAME_1, 18, true }, @@ -130,7 +130,7 @@ const PinInfo pin_array[] PROGMEM = { #endif #endif - #if CONF_SERIAL_IS(2) + #if SERIAL_IN_USE(2) #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM) { RXD_NAME_2, 17, true }, { TXD_NAME_2, 16, true }, @@ -145,7 +145,7 @@ const PinInfo pin_array[] PROGMEM = { #endif #endif - #if CONF_SERIAL_IS(3) + #if SERIAL_IN_USE(3) #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM) { RXD_NAME_3, 15, true }, { TXD_NAME_3, 14, true }, From 81976c43609863d73b28d8af656802214e677557 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 17 Oct 2022 23:00:26 -0500 Subject: [PATCH 010/109] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Pin?= =?UTF-8?q?s=20and=20debug=20list=20cleanup=20(#24878)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/AVR/fastio.h | 6 +- Marlin/src/lcd/buttons.h | 14 +- .../extui/mks_ui/tft_lvgl_configuration.cpp | 12 +- Marlin/src/lcd/marlinui.cpp | 18 +- Marlin/src/pins/mega/pins_EINSTART-S.h | 6 +- Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h | 15 +- Marlin/src/pins/mega/pins_OVERLORD.h | 2 +- Marlin/src/pins/pinsDebug.h | 4 +- Marlin/src/pins/pinsDebug_list.h | 1733 ++++++++++------- Marlin/src/pins/ramps/pins_RIGIDBOARD.h | 6 +- Marlin/src/pins/ramps/pins_ULTIMAIN_2.h | 4 +- Marlin/src/pins/ramps/pins_ZRIB_V20.h | 35 +- 12 files changed, 1092 insertions(+), 763 deletions(-) diff --git a/Marlin/src/HAL/AVR/fastio.h b/Marlin/src/HAL/AVR/fastio.h index 51d3b311ee..612ab902e3 100644 --- a/Marlin/src/HAL/AVR/fastio.h +++ b/Marlin/src/HAL/AVR/fastio.h @@ -293,11 +293,11 @@ enum ClockSource2 : uint8_t { #if HAS_MOTOR_CURRENT_PWM #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) - #define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E || P == MOTOR_CURRENT_PWM_Z || P == MOTOR_CURRENT_PWM_XY) + #define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E || P == MOTOR_CURRENT_PWM_E0 || P == MOTOR_CURRENT_PWM_E1 || P == MOTOR_CURRENT_PWM_Z || P == MOTOR_CURRENT_PWM_XY) #elif PIN_EXISTS(MOTOR_CURRENT_PWM_Z) - #define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E || P == MOTOR_CURRENT_PWM_Z) + #define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E || P == MOTOR_CURRENT_PWM_E0 || P == MOTOR_CURRENT_PWM_E1 || P == MOTOR_CURRENT_PWM_Z) #else - #define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E) + #define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E || P == MOTOR_CURRENT_PWM_E0 || P == MOTOR_CURRENT_PWM_E1) #endif #else #define PWM_CHK_MOTOR_CURRENT(P) false diff --git a/Marlin/src/lcd/buttons.h b/Marlin/src/lcd/buttons.h index 2580a71d1b..cb6348dc2d 100644 --- a/Marlin/src/lcd/buttons.h +++ b/Marlin/src/lcd/buttons.h @@ -26,7 +26,7 @@ #if ((!HAS_ADC_BUTTONS && IS_NEWPANEL) || BUTTONS_EXIST(EN1, EN2)) && !IS_TFTGLCD_PANEL #define HAS_ENCODER_WHEEL 1 #endif -#if (HAS_ENCODER_WHEEL || ANY_BUTTON(ENC, BACK, UP, DWN, LFT, RT)) && DISABLED(TOUCH_UI_FTDI_EVE) +#if (HAS_ENCODER_WHEEL || ANY_BUTTON(ENC, BACK, UP, DOWN, LEFT, RIGHT)) && DISABLED(TOUCH_UI_FTDI_EVE) #define HAS_DIGITAL_BUTTONS 1 #endif #if !HAS_ADC_BUTTONS && (IS_RRW_KEYPAD || (HAS_WIRED_LCD && !IS_NEWPANEL)) @@ -190,18 +190,18 @@ #else #define _BUTTON_PRESSED_UP false #endif -#if BUTTON_EXISTS(DWN) - #define _BUTTON_PRESSED_DWN _BUTTON_PRESSED(DWN) +#if BUTTON_EXISTS(DOWN) + #define _BUTTON_PRESSED_DWN _BUTTON_PRESSED(DOWN) #else #define _BUTTON_PRESSED_DWN false #endif -#if BUTTON_EXISTS(LFT) - #define _BUTTON_PRESSED_LFT _BUTTON_PRESSED(LFT) +#if BUTTON_EXISTS(LEFT) + #define _BUTTON_PRESSED_LFT _BUTTON_PRESSED(LEFT) #else #define _BUTTON_PRESSED_LFT false #endif -#if BUTTON_EXISTS(RT) - #define _BUTTON_PRESSED_RT _BUTTON_PRESSED(RT) +#if BUTTON_EXISTS(RIGHT) + #define _BUTTON_PRESSED_RT _BUTTON_PRESSED(RIGHT) #else #define _BUTTON_PRESSED_RT false #endif diff --git a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp index 3861235811..b31977e7ca 100644 --- a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp +++ b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp @@ -482,14 +482,14 @@ void lv_encoder_pin_init() { #if BUTTON_EXISTS(UP) SET_INPUT(BTN_UP); #endif - #if BUTTON_EXISTS(DWN) - SET_INPUT(BTN_DWN); + #if BUTTON_EXISTS(DOWN) + SET_INPUT(BTN_DOWN); #endif - #if BUTTON_EXISTS(LFT) - SET_INPUT(BTN_LFT); + #if BUTTON_EXISTS(LEFT) + SET_INPUT(BTN_LEFT); #endif - #if BUTTON_EXISTS(RT) - SET_INPUT(BTN_RT); + #if BUTTON_EXISTS(RIGHT) + SET_INPUT(BTN_RIGHT); #endif } diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 2e116d5479..b1827534b5 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -227,14 +227,14 @@ void MarlinUI::init() { #if BUTTON_EXISTS(UP) SET_INPUT(BTN_UP); #endif - #if BUTTON_EXISTS(DWN) - SET_INPUT(BTN_DWN); + #if BUTTON_EXISTS(DOWN) + SET_INPUT(BTN_DOWN); #endif #if BUTTON_EXISTS(LFT) - SET_INPUT(BTN_LFT); + SET_INPUT(BTN_LEFT); #endif #if BUTTON_EXISTS(RT) - SET_INPUT(BTN_RT); + SET_INPUT(BTN_RIGHT); #endif #endif @@ -1303,7 +1303,7 @@ void MarlinUI::init() { // // Directional buttons // - #if ANY_BUTTON(UP, DWN, LFT, RT) + #if ANY_BUTTON(UP, DOWN, LEFT, RIGHT) const int8_t pulses = epps * encoderDirection; @@ -1311,20 +1311,20 @@ void MarlinUI::init() { encoderDiff = (ENCODER_STEPS_PER_MENU_ITEM) * pulses; next_button_update_ms = now + 300; } - else if (BUTTON_PRESSED(DWN)) { + else if (BUTTON_PRESSED(DOWN)) { encoderDiff = -(ENCODER_STEPS_PER_MENU_ITEM) * pulses; next_button_update_ms = now + 300; } - else if (BUTTON_PRESSED(LFT)) { + else if (BUTTON_PRESSED(LEFT)) { encoderDiff = -pulses; next_button_update_ms = now + 300; } - else if (BUTTON_PRESSED(RT)) { + else if (BUTTON_PRESSED(RIGHT)) { encoderDiff = pulses; next_button_update_ms = now + 300; } - #endif // UP || DWN || LFT || RT + #endif // UP || DOWN || LEFT || RIGHT buttons = (newbutton | TERN0(HAS_SLOW_BUTTONS, slow_buttons) #if BOTH(HAS_TOUCH_BUTTONS, HAS_ENCODER_ACTION) diff --git a/Marlin/src/pins/mega/pins_EINSTART-S.h b/Marlin/src/pins/mega/pins_EINSTART-S.h index d42efe7361..c8cbee6740 100644 --- a/Marlin/src/pins/mega/pins_EINSTART-S.h +++ b/Marlin/src/pins/mega/pins_EINSTART-S.h @@ -101,9 +101,9 @@ // LCD Display input pins // #define BTN_UP 25 -#define BTN_DWN 26 -#define BTN_LFT 27 -#define BTN_RT 28 +#define BTN_DOWN 26 +#define BTN_LEFT 27 +#define BTN_RIGHT 28 // 'OK' button #define BTN_ENC 29 diff --git a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h index 3bcece400f..cff3a11af1 100644 --- a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h +++ b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h @@ -203,14 +203,13 @@ #define BTN_EN2 75 // J4, UP #define BTN_EN1 73 // J3, DOWN - //STOP button connected as KILL_PIN - #define KILL_PIN 14 // J1, RIGHT - //KILL - not connected + // STOP button connected as KILL_PIN + #define KILL_PIN 14 // J1, RIGHT (not connected) #define BEEPER_PIN 8 // H5, SD_WP - //on board leds - #define STAT_LED_RED_LED SERVO0_PIN // C1 (1280-EX1, DEBUG2) + // Onboard leds + #define STAT_LED_RED_PIN SERVO0_PIN // C1 (1280-EX1, DEBUG2) #define STAT_LED_BLUE_PIN SERVO1_PIN // C0 (1280-EX2, DEBUG3) #else @@ -220,9 +219,9 @@ #define SR_STROBE_PIN 33 // C4 #define BTN_UP 75 // J4 - #define BTN_DWN 73 // J3 - #define BTN_LFT 72 // J2 - #define BTN_RT 14 // J1 + #define BTN_DOWN 73 // J3 + #define BTN_LEFT 72 // J2 + #define BTN_RIGHT 14 // J1 // Disable encoder #undef BTN_EN1 diff --git a/Marlin/src/pins/mega/pins_OVERLORD.h b/Marlin/src/pins/mega/pins_OVERLORD.h index f1062b413e..49accf9f7c 100644 --- a/Marlin/src/pins/mega/pins_OVERLORD.h +++ b/Marlin/src/pins/mega/pins_OVERLORD.h @@ -135,7 +135,7 @@ #if IS_NEWPANEL #define BTN_ENC 16 // Enter Pin #define BTN_UP 19 // Button UP Pin - #define BTN_DWN 17 // Button DOWN Pin + #define BTN_DOWN 17 // Button DOWN Pin #endif // Additional connectors/pins on the Overlord V1.X board diff --git a/Marlin/src/pins/pinsDebug.h b/Marlin/src/pins/pinsDebug.h index b938496915..5b19ff1b2d 100644 --- a/Marlin/src/pins/pinsDebug.h +++ b/Marlin/src/pins/pinsDebug.h @@ -45,7 +45,7 @@ #define REPORT_NAME_ANALOG(COUNTER, NAME) _ADD_PIN(#NAME, COUNTER) #include "pinsDebug_list.h" -#line 48 +#line 49 // manually add pins that have names that are macros which don't play well with these macros #if ANY(AVR_ATmega2560_FAMILY, AVR_ATmega1284_FAMILY, ARDUINO_ARCH_SAM, TARGET_LPC1768) @@ -164,7 +164,7 @@ const PinInfo pin_array[] PROGMEM = { #endif #include "pinsDebug_list.h" - #line 167 + #line 168 }; diff --git a/Marlin/src/pins/pinsDebug_list.h b/Marlin/src/pins/pinsDebug_list.h index 034e4adf1b..2cd54ecf18 100644 --- a/Marlin/src/pins/pinsDebug_list.h +++ b/Marlin/src/pins/pinsDebug_list.h @@ -41,8 +41,8 @@ #if _EXISTS(EXT_AUX_A0) #if ANALOG_OK(EXT_AUX_A0) - REPORT_NAME_ANALOG(__LINE__, EXT_AUX_A0) -#endif + REPORT_NAME_ANALOG(__LINE__, EXT_AUX_A0) + #endif #endif #if _EXISTS(EXT_AUX_A1) #if ANALOG_OK(EXT_AUX_A0) @@ -87,8 +87,8 @@ #if !defined(ARDUINO_ARCH_SAM) && !defined(ARDUINO_ARCH_SAMD) // TC1 & TC2 are macros in the SAM/SAMD tool chain #if _EXISTS(TC1) #if ANALOG_OK(TC1) - REPORT_NAME_ANALOG(__LINE__, TC1) - #endif + REPORT_NAME_ANALOG(__LINE__, TC1) + #endif #endif #if _EXISTS(TC2) #if ANALOG_OK(TC1) @@ -98,8 +98,8 @@ #endif #if PIN_EXISTS(TEMP_0) #if ANALOG_OK(TEMP_0_PIN) - REPORT_NAME_ANALOG(__LINE__, TEMP_0_PIN) - #endif + REPORT_NAME_ANALOG(__LINE__, TEMP_0_PIN) + #endif #endif #if PIN_EXISTS(TEMP_1) #if ANALOG_OK(TEMP_1_PIN) @@ -183,6 +183,10 @@ #if _EXISTS(__GS) REPORT_NAME_DIGITAL(__LINE__, __GS) #endif + +// +// SPI on AVR +// #if PIN_EXISTS(AVR_MISO) REPORT_NAME_DIGITAL(__LINE__, AVR_MISO_PIN) #endif @@ -192,27 +196,29 @@ #if PIN_EXISTS(AVR_SCK) REPORT_NAME_DIGITAL(__LINE__, AVR_SCK_PIN) #endif -#if PIN_EXISTS(ALARM) - REPORT_NAME_DIGITAL(__LINE__, ALARM_PIN) -#endif #if PIN_EXISTS(AVR_SS) REPORT_NAME_DIGITAL(__LINE__, AVR_SS_PIN) #endif + +// +// Sound +// #if PIN_EXISTS(BEEPER) REPORT_NAME_DIGITAL(__LINE__, BEEPER_PIN) #endif +#if PIN_EXISTS(ALARM) + REPORT_NAME_DIGITAL(__LINE__, ALARM_PIN) +#endif + +// +// Digital Encoder / Keypad +// #if _EXISTS(BTN_BACK) REPORT_NAME_DIGITAL(__LINE__, BTN_BACK) #endif #if _EXISTS(BTN_CENTER) REPORT_NAME_DIGITAL(__LINE__, BTN_CENTER) #endif -#if _EXISTS(BTN_DOWN) - REPORT_NAME_DIGITAL(__LINE__, BTN_DOWN) -#endif -#if _EXISTS(BTN_DWN) - REPORT_NAME_DIGITAL(__LINE__, BTN_DWN) -#endif #if _EXISTS(BTN_EN1) REPORT_NAME_DIGITAL(__LINE__, BTN_EN1) #endif @@ -228,21 +234,22 @@ #if _EXISTS(BTN_HOME) REPORT_NAME_DIGITAL(__LINE__, BTN_HOME) #endif +#if _EXISTS(BTN_UP) + REPORT_NAME_DIGITAL(__LINE__, BTN_UP) +#endif +#if _EXISTS(BTN_DOWN) + REPORT_NAME_DIGITAL(__LINE__, BTN_DOWN) +#endif #if _EXISTS(BTN_LEFT) REPORT_NAME_DIGITAL(__LINE__, BTN_LEFT) #endif -#if _EXISTS(BTN_LFT) - REPORT_NAME_DIGITAL(__LINE__, BTN_LFT) -#endif #if _EXISTS(BTN_RIGHT) REPORT_NAME_DIGITAL(__LINE__, BTN_RIGHT) #endif -#if _EXISTS(BTN_RT) - REPORT_NAME_DIGITAL(__LINE__, BTN_RT) -#endif -#if _EXISTS(BTN_UP) - REPORT_NAME_DIGITAL(__LINE__, BTN_UP) -#endif + +// +// Joystick +// #if PIN_EXISTS(JOY_X) REPORT_NAME_DIGITAL(__LINE__, JOY_X_PIN) #endif @@ -255,6 +262,10 @@ #if PIN_EXISTS(JOY_EN) REPORT_NAME_DIGITAL(__LINE__, JOY_EN_PIN) #endif + +// +// Custom Buttons +// #if PIN_EXISTS(BUTTON1) REPORT_NAME_DIGITAL(__LINE__, BUTTON1_PIN) #endif @@ -330,33 +341,32 @@ #if PIN_EXISTS(BUTTON25) REPORT_NAME_DIGITAL(__LINE__, BUTTON25_PIN) #endif + #if PIN_EXISTS(CASE_LIGHT) REPORT_NAME_DIGITAL(__LINE__, CASE_LIGHT_PIN) #endif -#if PIN_EXISTS(CHAMBER_AUTO_FAN) - REPORT_NAME_DIGITAL(__LINE__, CHAMBER_AUTO_FAN_PIN) -#endif -#if PIN_EXISTS(CONTROLLER_FAN) - REPORT_NAME_DIGITAL(__LINE__, CONTROLLER_FAN_PIN) -#endif + #if PIN_EXISTS(COOLANT_FLOOD) REPORT_NAME_DIGITAL(__LINE__, COOLANT_FLOOD_PIN) #endif #if PIN_EXISTS(COOLANT_MIST) REPORT_NAME_DIGITAL(__LINE__, COOLANT_MIST_PIN) #endif + #if PIN_EXISTS(CUTOFF_RESET) REPORT_NAME_DIGITAL(__LINE__, CUTOFF_RESET_PIN) #endif #if PIN_EXISTS(CUTOFF_TEST) REPORT_NAME_DIGITAL(__LINE__, CUTOFF_TEST_PIN) #endif + #if _EXISTS(D57) REPORT_NAME_DIGITAL(__LINE__, D57) #endif #if _EXISTS(D58) REPORT_NAME_DIGITAL(__LINE__, D58) #endif + #if PIN_EXISTS(DAC_DISABLE) REPORT_NAME_DIGITAL(__LINE__, DAC_DISABLE_PIN) #endif @@ -366,9 +376,7 @@ #if PIN_EXISTS(DAC1_SYNC) REPORT_NAME_DIGITAL(__LINE__, DAC1_SYNC_PIN) #endif -#if PIN_EXISTS(DEBUG) - REPORT_NAME_DIGITAL(__LINE__, DEBUG_PIN) -#endif + #if _EXISTS(DIGIPOTS_I2C_SCL) REPORT_NAME_DIGITAL(__LINE__, DIGIPOTS_I2C_SCL) #endif @@ -390,21 +398,97 @@ #if PIN_EXISTS(DIGIPOTSS) REPORT_NAME_DIGITAL(__LINE__, DIGIPOTSS_PIN) #endif -#if PIN_EXISTS(LCD_RESET) - REPORT_NAME_DIGITAL(__LINE__, LCD_RESET_PIN) +#if PIN_EXISTS(EXP1_01) + REPORT_NAME_DIGITAL(__LINE__, EXP1_01_PIN) #endif -#if _EXISTS(DOGLCD_A0) - REPORT_NAME_DIGITAL(__LINE__, DOGLCD_A0) +#if PIN_EXISTS(EXP1_02) + REPORT_NAME_DIGITAL(__LINE__, EXP1_02_PIN) #endif -#if _EXISTS(DOGLCD_CS) - REPORT_NAME_DIGITAL(__LINE__, DOGLCD_CS) +#if PIN_EXISTS(EXP1_03) + REPORT_NAME_DIGITAL(__LINE__, EXP1_03_PIN) #endif -#if _EXISTS(DOGLCD_MOSI) - REPORT_NAME_DIGITAL(__LINE__, DOGLCD_MOSI) +#if PIN_EXISTS(EXP1_04) + REPORT_NAME_DIGITAL(__LINE__, EXP1_04_PIN) #endif -#if _EXISTS(DOGLCD_SCK) - REPORT_NAME_DIGITAL(__LINE__, DOGLCD_SCK) +#if PIN_EXISTS(EXP1_05) + REPORT_NAME_DIGITAL(__LINE__, EXP1_05_PIN) #endif +#if PIN_EXISTS(EXP1_06) + REPORT_NAME_DIGITAL(__LINE__, EXP1_06_PIN) +#endif +#if PIN_EXISTS(EXP1_07) + REPORT_NAME_DIGITAL(__LINE__, EXP1_07_PIN) +#endif +#if PIN_EXISTS(EXP1_08) + REPORT_NAME_DIGITAL(__LINE__, EXP1_08_PIN) +#endif +#if PIN_EXISTS(EXP1_09) + REPORT_NAME_DIGITAL(__LINE__, EXP1_09_PIN) +#endif +#if PIN_EXISTS(EXP1_10) + REPORT_NAME_DIGITAL(__LINE__, EXP1_10_PIN) +#endif +#if PIN_EXISTS(EXP2_01) + REPORT_NAME_DIGITAL(__LINE__, EXP2_01_PIN) +#endif +#if PIN_EXISTS(EXP2_02) + REPORT_NAME_DIGITAL(__LINE__, EXP2_02_PIN) +#endif +#if PIN_EXISTS(EXP2_03) + REPORT_NAME_DIGITAL(__LINE__, EXP2_03_PIN) +#endif +#if PIN_EXISTS(EXP2_04) + REPORT_NAME_DIGITAL(__LINE__, EXP2_04_PIN) +#endif +#if PIN_EXISTS(EXP2_05) + REPORT_NAME_DIGITAL(__LINE__, EXP2_05_PIN) +#endif +#if PIN_EXISTS(EXP2_06) + REPORT_NAME_DIGITAL(__LINE__, EXP2_06_PIN) +#endif +#if PIN_EXISTS(EXP2_07) + REPORT_NAME_DIGITAL(__LINE__, EXP2_07_PIN) +#endif +#if PIN_EXISTS(EXP2_08) + REPORT_NAME_DIGITAL(__LINE__, EXP2_08_PIN) +#endif +#if PIN_EXISTS(EXP2_09) + REPORT_NAME_DIGITAL(__LINE__, EXP2_09_PIN) +#endif +#if PIN_EXISTS(EXP2_10) + REPORT_NAME_DIGITAL(__LINE__, EXP2_10_PIN) +#endif +#if PIN_EXISTS(EXP3_01) + REPORT_NAME_DIGITAL(__LINE__, EXP3_01_PIN) +#endif +#if PIN_EXISTS(EXP3_02) + REPORT_NAME_DIGITAL(__LINE__, EXP3_02_PIN) +#endif +#if PIN_EXISTS(EXP3_03) + REPORT_NAME_DIGITAL(__LINE__, EXP3_03_PIN) +#endif +#if PIN_EXISTS(EXP3_04) + REPORT_NAME_DIGITAL(__LINE__, EXP3_04_PIN) +#endif +#if PIN_EXISTS(EXP3_05) + REPORT_NAME_DIGITAL(__LINE__, EXP3_05_PIN) +#endif +#if PIN_EXISTS(EXP3_06) + REPORT_NAME_DIGITAL(__LINE__, EXP3_06_PIN) +#endif +#if PIN_EXISTS(EXP3_07) + REPORT_NAME_DIGITAL(__LINE__, EXP3_07_PIN) +#endif +#if PIN_EXISTS(EXP3_08) + REPORT_NAME_DIGITAL(__LINE__, EXP3_08_PIN) +#endif +#if PIN_EXISTS(EXP3_09) + REPORT_NAME_DIGITAL(__LINE__, EXP3_09_PIN) +#endif +#if PIN_EXISTS(EXP3_10) + REPORT_NAME_DIGITAL(__LINE__, EXP3_10_PIN) +#endif + #if _EXISTS(TMC_SW_MISO) REPORT_NAME_DIGITAL(__LINE__, TMC_SW_MISO) #endif @@ -417,6 +501,10 @@ #if _EXISTS(TFTGLCD_CS) REPORT_NAME_DIGITAL(__LINE__, TFTGLCD_CS) #endif + +// +// E Multiplexing +// #if PIN_EXISTS(E_MUX0) REPORT_NAME_DIGITAL(__LINE__, E_MUX0_PIN) #endif @@ -426,228 +514,153 @@ #if PIN_EXISTS(E_MUX2) REPORT_NAME_DIGITAL(__LINE__, E_MUX2_PIN) #endif -#if PIN_EXISTS(E_STOP) - REPORT_NAME_DIGITAL(__LINE__, E_STOP_PIN) -#endif -#if PIN_EXISTS(E0_ATT) - REPORT_NAME_DIGITAL(__LINE__, E0_ATT_PIN) -#endif -#if PIN_EXISTS(E0_AUTO_FAN) - REPORT_NAME_DIGITAL(__LINE__, E0_AUTO_FAN_PIN) -#endif -#if PIN_EXISTS(E0_CS) - REPORT_NAME_DIGITAL(__LINE__, E0_CS_PIN) -#endif + #if PIN_EXISTS(E0_DIR) REPORT_NAME_DIGITAL(__LINE__, E0_DIR_PIN) #endif #if PIN_EXISTS(E0_ENABLE) REPORT_NAME_DIGITAL(__LINE__, E0_ENABLE_PIN) #endif -#if PIN_EXISTS(E0_MS1) - REPORT_NAME_DIGITAL(__LINE__, E0_MS1_PIN) -#endif -#if PIN_EXISTS(E0_MS2) - REPORT_NAME_DIGITAL(__LINE__, E0_MS2_PIN) -#endif -#if PIN_EXISTS(E0_MS3) - REPORT_NAME_DIGITAL(__LINE__, E0_MS3_PIN) -#endif #if PIN_EXISTS(E0_STEP) REPORT_NAME_DIGITAL(__LINE__, E0_STEP_PIN) #endif -#if PIN_EXISTS(E0_STDBY) - REPORT_NAME_DIGITAL(__LINE__, E0_STDBY_PIN) -#endif -#if PIN_EXISTS(E1_AUTO_FAN) - REPORT_NAME_DIGITAL(__LINE__, E1_AUTO_FAN_PIN) -#endif -#if PIN_EXISTS(E1_CS) - REPORT_NAME_DIGITAL(__LINE__, E1_CS_PIN) -#endif #if PIN_EXISTS(E1_DIR) REPORT_NAME_DIGITAL(__LINE__, E1_DIR_PIN) #endif #if PIN_EXISTS(E1_ENABLE) REPORT_NAME_DIGITAL(__LINE__, E1_ENABLE_PIN) #endif -#if PIN_EXISTS(E1_MS1) - REPORT_NAME_DIGITAL(__LINE__, E1_MS1_PIN) -#endif -#if PIN_EXISTS(E1_MS2) - REPORT_NAME_DIGITAL(__LINE__, E1_MS2_PIN) -#endif -#if PIN_EXISTS(E1_MS3) - REPORT_NAME_DIGITAL(__LINE__, E1_MS3_PIN) -#endif #if PIN_EXISTS(E1_STEP) REPORT_NAME_DIGITAL(__LINE__, E1_STEP_PIN) #endif -#if PIN_EXISTS(E1_STDBY) - REPORT_NAME_DIGITAL(__LINE__, E1_STDBY_PIN) -#endif -#if PIN_EXISTS(E2_AUTO_FAN) - REPORT_NAME_DIGITAL(__LINE__, E2_AUTO_FAN_PIN) -#endif -#if PIN_EXISTS(E2_CS) - REPORT_NAME_DIGITAL(__LINE__, E2_CS_PIN) -#endif #if PIN_EXISTS(E2_DIR) REPORT_NAME_DIGITAL(__LINE__, E2_DIR_PIN) #endif #if PIN_EXISTS(E2_ENABLE) REPORT_NAME_DIGITAL(__LINE__, E2_ENABLE_PIN) #endif -#if PIN_EXISTS(E2_MS1) - REPORT_NAME_DIGITAL(__LINE__, E2_MS1_PIN) -#endif -#if PIN_EXISTS(E2_MS2) - REPORT_NAME_DIGITAL(__LINE__, E2_MS2_PIN) -#endif -#if PIN_EXISTS(E2_MS3) - REPORT_NAME_DIGITAL(__LINE__, E2_MS3_PIN) -#endif #if PIN_EXISTS(E2_STEP) REPORT_NAME_DIGITAL(__LINE__, E2_STEP_PIN) #endif -#if PIN_EXISTS(E2_STDBY) - REPORT_NAME_DIGITAL(__LINE__, E2_STDBY_PIN) -#endif -#if PIN_EXISTS(E3_AUTO_FAN) - REPORT_NAME_DIGITAL(__LINE__, E3_AUTO_FAN_PIN) -#endif -#if PIN_EXISTS(E3_CS) - REPORT_NAME_DIGITAL(__LINE__, E3_CS_PIN) -#endif #if PIN_EXISTS(E3_DIR) REPORT_NAME_DIGITAL(__LINE__, E3_DIR_PIN) #endif #if PIN_EXISTS(E3_ENABLE) REPORT_NAME_DIGITAL(__LINE__, E3_ENABLE_PIN) #endif -#if PIN_EXISTS(E3_MS1) - REPORT_NAME_DIGITAL(__LINE__, E3_MS1_PIN) -#endif -#if PIN_EXISTS(E3_MS2) - REPORT_NAME_DIGITAL(__LINE__, E3_MS2_PIN) -#endif -#if PIN_EXISTS(E3_MS3) - REPORT_NAME_DIGITAL(__LINE__, E3_MS3_PIN) -#endif #if PIN_EXISTS(E3_STEP) REPORT_NAME_DIGITAL(__LINE__, E3_STEP_PIN) #endif -#if PIN_EXISTS(E3_STDBY) - REPORT_NAME_DIGITAL(__LINE__, E3_STDBY_PIN) -#endif -#if PIN_EXISTS(E4_AUTO_FAN) - REPORT_NAME_DIGITAL(__LINE__, E4_AUTO_FAN_PIN) -#endif -#if PIN_EXISTS(E4_CS) - REPORT_NAME_DIGITAL(__LINE__, E4_CS_PIN) -#endif #if PIN_EXISTS(E4_DIR) REPORT_NAME_DIGITAL(__LINE__, E4_DIR_PIN) #endif #if PIN_EXISTS(E4_ENABLE) REPORT_NAME_DIGITAL(__LINE__, E4_ENABLE_PIN) #endif -#if PIN_EXISTS(E4_MS1) - REPORT_NAME_DIGITAL(__LINE__, E4_MS1_PIN) -#endif -#if PIN_EXISTS(E4_MS2) - REPORT_NAME_DIGITAL(__LINE__, E4_MS2_PIN) -#endif -#if PIN_EXISTS(E4_MS3) - REPORT_NAME_DIGITAL(__LINE__, E4_MS3_PIN) -#endif #if PIN_EXISTS(E4_STEP) REPORT_NAME_DIGITAL(__LINE__, E4_STEP_PIN) #endif -#if PIN_EXISTS(E4_STDBY) - REPORT_NAME_DIGITAL(__LINE__, E4_STDBY_PIN) -#endif -#if PIN_EXISTS(E5_AUTO_FAN) - REPORT_NAME_DIGITAL(__LINE__, E5_AUTO_FAN_PIN) -#endif -#if PIN_EXISTS(E5_CS) - REPORT_NAME_DIGITAL(__LINE__, E5_CS_PIN) -#endif #if PIN_EXISTS(E5_DIR) REPORT_NAME_DIGITAL(__LINE__, E5_DIR_PIN) #endif #if PIN_EXISTS(E5_ENABLE) REPORT_NAME_DIGITAL(__LINE__, E5_ENABLE_PIN) #endif -#if PIN_EXISTS(E5_MS1) - REPORT_NAME_DIGITAL(__LINE__, E5_MS1_PIN) -#endif -#if PIN_EXISTS(E5_MS2) - REPORT_NAME_DIGITAL(__LINE__, E5_MS2_PIN) -#endif -#if PIN_EXISTS(E5_MS3) - REPORT_NAME_DIGITAL(__LINE__, E5_MS3_PIN) -#endif #if PIN_EXISTS(E5_STEP) REPORT_NAME_DIGITAL(__LINE__, E5_STEP_PIN) #endif -#if PIN_EXISTS(E5_STDBY) - REPORT_NAME_DIGITAL(__LINE__, E5_STDBY_PIN) -#endif -#if PIN_EXISTS(E6_AUTO_FAN) - REPORT_NAME_DIGITAL(__LINE__, E6_AUTO_FAN_PIN) -#endif -#if PIN_EXISTS(E6_CS) - REPORT_NAME_DIGITAL(__LINE__, E6_CS_PIN) -#endif #if PIN_EXISTS(E6_DIR) REPORT_NAME_DIGITAL(__LINE__, E6_DIR_PIN) #endif #if PIN_EXISTS(E6_ENABLE) REPORT_NAME_DIGITAL(__LINE__, E6_ENABLE_PIN) #endif -#if PIN_EXISTS(E6_MS1) - REPORT_NAME_DIGITAL(__LINE__, E6_MS1_PIN) -#endif -#if PIN_EXISTS(E6_MS2) - REPORT_NAME_DIGITAL(__LINE__, E6_MS2_PIN) -#endif -#if PIN_EXISTS(E6_MS3) - REPORT_NAME_DIGITAL(__LINE__, E6_MS3_PIN) -#endif #if PIN_EXISTS(E6_STEP) REPORT_NAME_DIGITAL(__LINE__, E6_STEP_PIN) #endif -#if PIN_EXISTS(E6_STDBY) - REPORT_NAME_DIGITAL(__LINE__, E6_STDBY_PIN) -#endif -#if PIN_EXISTS(E7_AUTO_FAN) - REPORT_NAME_DIGITAL(__LINE__, E7_AUTO_FAN_PIN) -#endif -#if PIN_EXISTS(E7_CS) - REPORT_NAME_DIGITAL(__LINE__, E7_CS_PIN) -#endif #if PIN_EXISTS(E7_DIR) REPORT_NAME_DIGITAL(__LINE__, E7_DIR_PIN) #endif #if PIN_EXISTS(E7_ENABLE) REPORT_NAME_DIGITAL(__LINE__, E7_ENABLE_PIN) #endif -#if PIN_EXISTS(E7_MS1) - REPORT_NAME_DIGITAL(__LINE__, E7_MS1_PIN) -#endif -#if PIN_EXISTS(E7_MS2) - REPORT_NAME_DIGITAL(__LINE__, E7_MS2_PIN) -#endif -#if PIN_EXISTS(E7_MS3) - REPORT_NAME_DIGITAL(__LINE__, E7_MS3_PIN) -#endif #if PIN_EXISTS(E7_STEP) REPORT_NAME_DIGITAL(__LINE__, E7_STEP_PIN) #endif -#if PIN_EXISTS(E7_STDBY) - REPORT_NAME_DIGITAL(__LINE__, E7_STDBY_PIN) + +// +// Stepper Select +// +#if PIN_EXISTS(X_CS) + REPORT_NAME_DIGITAL(__LINE__, X_CS_PIN) #endif +#if PIN_EXISTS(X2_CS) + REPORT_NAME_DIGITAL(__LINE__, X2_CS_PIN) +#endif +#if PIN_EXISTS(Y_CS) + REPORT_NAME_DIGITAL(__LINE__, Y_CS_PIN) +#endif +#if PIN_EXISTS(Y2_CS) + REPORT_NAME_DIGITAL(__LINE__, Y2_CS_PIN) +#endif +#if PIN_EXISTS(Z_CS) + REPORT_NAME_DIGITAL(__LINE__, Z_CS_PIN) +#endif +#if PIN_EXISTS(Z2_CS) + REPORT_NAME_DIGITAL(__LINE__, Z2_CS_PIN) +#endif +#if PIN_EXISTS(Z3_CS) + REPORT_NAME_DIGITAL(__LINE__, Z3_CS_PIN) +#endif +#if PIN_EXISTS(Z4_CS) + REPORT_NAME_DIGITAL(__LINE__, Z4_CS_PIN) +#endif +#if PIN_EXISTS(I_CS) + REPORT_NAME_DIGITAL(__LINE__, I_CS_PIN) +#endif +#if PIN_EXISTS(J_CS) + REPORT_NAME_DIGITAL(__LINE__, J_CS_PIN) +#endif +#if PIN_EXISTS(K_CS) + REPORT_NAME_DIGITAL(__LINE__, K_CS_PIN) +#endif +#if PIN_EXISTS(U_CS) + REPORT_NAME_DIGITAL(__LINE__, U_CS_PIN) +#endif +#if PIN_EXISTS(V_CS) + REPORT_NAME_DIGITAL(__LINE__, V_CS_PIN) +#endif +#if PIN_EXISTS(W_CS) + REPORT_NAME_DIGITAL(__LINE__, W_CS_PIN) +#endif +#if PIN_EXISTS(E0_CS) + REPORT_NAME_DIGITAL(__LINE__, E0_CS_PIN) +#endif +#if PIN_EXISTS(E1_CS) + REPORT_NAME_DIGITAL(__LINE__, E1_CS_PIN) +#endif +#if PIN_EXISTS(E2_CS) + REPORT_NAME_DIGITAL(__LINE__, E2_CS_PIN) +#endif +#if PIN_EXISTS(E3_CS) + REPORT_NAME_DIGITAL(__LINE__, E3_CS_PIN) +#endif +#if PIN_EXISTS(E4_CS) + REPORT_NAME_DIGITAL(__LINE__, E4_CS_PIN) +#endif +#if PIN_EXISTS(E5_CS) + REPORT_NAME_DIGITAL(__LINE__, E5_CS_PIN) +#endif +#if PIN_EXISTS(E6_CS) + REPORT_NAME_DIGITAL(__LINE__, E6_CS_PIN) +#endif +#if PIN_EXISTS(E7_CS) + REPORT_NAME_DIGITAL(__LINE__, E7_CS_PIN) +#endif + +// +// Ethernet +// #if _EXISTS(ENET_CRS) REPORT_NAME_DIGITAL(__LINE__, ENET_CRS) #endif @@ -675,6 +688,10 @@ #if _EXISTS(ENET_TXD1) REPORT_NAME_DIGITAL(__LINE__, ENET_TXD1) #endif +#if _EXISTS(REF_CLK) + REPORT_NAME_DIGITAL(__LINE__, REF_CLK) +#endif + #if PIN_EXISTS(EXP_VOLTAGE_LEVEL) REPORT_NAME_DIGITAL(__LINE__, EXP_VOLTAGE_LEVEL_PIN) #endif @@ -709,12 +726,10 @@ #if _EXISTS(EXT_AUX_TX1_D3) REPORT_NAME_DIGITAL(__LINE__, EXT_AUX_TX1_D3) #endif -#if _EXISTS(EXTRUDER_0_AUTO_FAN) - REPORT_NAME_DIGITAL(__LINE__, EXTRUDER_0_AUTO_FAN) -#endif -#if _EXISTS(EXTRUDER_1_AUTO_FAN) - REPORT_NAME_DIGITAL(__LINE__, EXTRUDER_1_AUTO_FAN) -#endif + +// +// Fans +// #if PIN_EXISTS(FAN) REPORT_NAME_DIGITAL(__LINE__, FAN_PIN) #endif @@ -748,12 +763,40 @@ #if PIN_EXISTS(FAN_MUX2) REPORT_NAME_DIGITAL(__LINE__, FAN_MUX2_PIN) #endif -#if PIN_EXISTS(POWER_LOSS) - REPORT_NAME_DIGITAL(__LINE__, POWER_LOSS_PIN) +#if PIN_EXISTS(E0_AUTO_FAN) + REPORT_NAME_DIGITAL(__LINE__, E0_AUTO_FAN_PIN) #endif -#if PIN_EXISTS(SAFE_POWER) - REPORT_NAME_DIGITAL(__LINE__, SAFE_POWER_PIN) +#if PIN_EXISTS(E1_AUTO_FAN) + REPORT_NAME_DIGITAL(__LINE__, E1_AUTO_FAN_PIN) #endif +#if PIN_EXISTS(E2_AUTO_FAN) + REPORT_NAME_DIGITAL(__LINE__, E2_AUTO_FAN_PIN) +#endif +#if PIN_EXISTS(E3_AUTO_FAN) + REPORT_NAME_DIGITAL(__LINE__, E3_AUTO_FAN_PIN) +#endif +#if PIN_EXISTS(E4_AUTO_FAN) + REPORT_NAME_DIGITAL(__LINE__, E4_AUTO_FAN_PIN) +#endif +#if PIN_EXISTS(E5_AUTO_FAN) + REPORT_NAME_DIGITAL(__LINE__, E5_AUTO_FAN_PIN) +#endif +#if PIN_EXISTS(E6_AUTO_FAN) + REPORT_NAME_DIGITAL(__LINE__, E6_AUTO_FAN_PIN) +#endif +#if PIN_EXISTS(E7_AUTO_FAN) + REPORT_NAME_DIGITAL(__LINE__, E7_AUTO_FAN_PIN) +#endif +#if PIN_EXISTS(CHAMBER_AUTO_FAN) + REPORT_NAME_DIGITAL(__LINE__, CHAMBER_AUTO_FAN_PIN) +#endif +#if PIN_EXISTS(CONTROLLER_FAN) + REPORT_NAME_DIGITAL(__LINE__, CONTROLLER_FAN_PIN) +#endif + +// +// Filament Runout Sensor +// #if PIN_EXISTS(FIL_RUNOUT) REPORT_NAME_DIGITAL(__LINE__, FIL_RUNOUT_PIN) #endif @@ -778,6 +821,10 @@ #if PIN_EXISTS(FIL_RUNOUT8) REPORT_NAME_DIGITAL(__LINE__, FIL_RUNOUT8_PIN) #endif + +// +// Heaters +// #if PIN_EXISTS(HEATER_0) REPORT_NAME_DIGITAL(__LINE__, HEATER_0_PIN) #endif @@ -811,23 +858,52 @@ #if PIN_EXISTS(COOLER) REPORT_NAME_DIGITAL(__LINE__, COOLER_PIN) #endif + #if PIN_EXISTS(HOME) REPORT_NAME_DIGITAL(__LINE__, HOME_PIN) #endif -#if PIN_EXISTS(I2C_SCL) - REPORT_NAME_DIGITAL(__LINE__, I2C_SCL_PIN) -#endif -#if PIN_EXISTS(I2C_SDA) - REPORT_NAME_DIGITAL(__LINE__, I2C_SDA_PIN) -#endif #if HAS_KILL REPORT_NAME_DIGITAL(__LINE__, KILL_PIN) #endif #if PIN_EXISTS(FREEZE) REPORT_NAME_DIGITAL(__LINE__, FREEZE_PIN) #endif -#if PIN_EXISTS(LCD_BACKLIGHT) - REPORT_NAME_DIGITAL(__LINE__, LCD_BACKLIGHT_PIN) +#if PIN_EXISTS(DEBUG) + REPORT_NAME_DIGITAL(__LINE__, DEBUG_PIN) +#endif +#if PIN_EXISTS(SUICIDE) + REPORT_NAME_DIGITAL(__LINE__, SUICIDE_PIN) +#endif +#if PIN_EXISTS(FET_SAFETY) + REPORT_NAME_DIGITAL(__LINE__, FET_SAFETY_PIN) +#endif +#if PIN_EXISTS(SAFETY_TRIGGERED) + REPORT_NAME_DIGITAL(__LINE__, SAFETY_TRIGGERED_PIN) +#endif +#if PIN_EXISTS(SAFE_POWER) + REPORT_NAME_DIGITAL(__LINE__, SAFE_POWER_PIN) +#endif +#if PIN_EXISTS(POWER_LOSS) + REPORT_NAME_DIGITAL(__LINE__, POWER_LOSS_PIN) +#endif +#if PIN_EXISTS(PS_ON) + REPORT_NAME_DIGITAL(__LINE__, PS_ON_PIN) +#endif + +// +// LCD +// +#if _EXISTS(DOGLCD_A0) + REPORT_NAME_DIGITAL(__LINE__, DOGLCD_A0) +#endif +#if _EXISTS(DOGLCD_CS) + REPORT_NAME_DIGITAL(__LINE__, DOGLCD_CS) +#endif +#if _EXISTS(DOGLCD_MOSI) + REPORT_NAME_DIGITAL(__LINE__, DOGLCD_MOSI) +#endif +#if _EXISTS(DOGLCD_SCK) + REPORT_NAME_DIGITAL(__LINE__, DOGLCD_SCK) #endif #if _EXISTS(LCD_PINS_D4) REPORT_NAME_DIGITAL(__LINE__, LCD_PINS_D4) @@ -850,9 +926,16 @@ #if _EXISTS(LCD_SDSS) REPORT_NAME_DIGITAL(__LINE__, LCD_SDSS) #endif -#if PIN_EXISTS(LED_GREEN) - REPORT_NAME_DIGITAL(__LINE__, LED_GREEN_PIN) +#if PIN_EXISTS(LCD_RESET) + REPORT_NAME_DIGITAL(__LINE__, LCD_RESET_PIN) #endif +#if PIN_EXISTS(LCD_BACKLIGHT) + REPORT_NAME_DIGITAL(__LINE__, LCD_BACKLIGHT_PIN) +#endif + +// +// LED Lights +// #if PIN_EXISTS(LED) REPORT_NAME_DIGITAL(__LINE__, LED_PIN) #endif @@ -865,9 +948,50 @@ #if PIN_EXISTS(LED4) REPORT_NAME_DIGITAL(__LINE__, LED4_PIN) #endif +#if PIN_EXISTS(LED_GREEN) + REPORT_NAME_DIGITAL(__LINE__, LED_GREEN_PIN) +#endif #if PIN_EXISTS(LED_RED) REPORT_NAME_DIGITAL(__LINE__, LED_RED_PIN) #endif +#if PIN_EXISTS(STAT_LED_BLUE) + REPORT_NAME_DIGITAL(__LINE__, STAT_LED_BLUE_PIN) +#endif +#if PIN_EXISTS(STAT_LED_RED) + REPORT_NAME_DIGITAL(__LINE__, STAT_LED_RED_PIN) +#endif +#if PIN_EXISTS(RGB_LED_R) + REPORT_NAME_DIGITAL(__LINE__, RGB_LED_R_PIN) +#endif +#if PIN_EXISTS(RGB_LED_G) + REPORT_NAME_DIGITAL(__LINE__, RGB_LED_G_PIN) +#endif +#if PIN_EXISTS(RGB_LED_B) + REPORT_NAME_DIGITAL(__LINE__, RGB_LED_B_PIN) +#endif +#if PIN_EXISTS(RGB_LED_W) + REPORT_NAME_DIGITAL(__LINE__, RGB_LED_W_PIN) +#endif +#if PIN_EXISTS(NEOPIXEL) + REPORT_NAME_DIGITAL(__LINE__, NEOPIXEL_PIN) +#endif +#if PIN_EXISTS(NEOPIXEL2) + REPORT_NAME_DIGITAL(__LINE__, NEOPIXEL2_PIN) +#endif + +// +// MAX7219 LED Matrix +// +#if PIN_EXISTS(MAX7219_CLK) + REPORT_NAME_DIGITAL(__LINE__, MAX7219_CLK_PIN) +#endif +#if PIN_EXISTS(MAX7219_DIN) + REPORT_NAME_DIGITAL(__LINE__, MAX7219_DIN_PIN) +#endif +#if PIN_EXISTS(MAX7219_LOAD) + REPORT_NAME_DIGITAL(__LINE__, MAX7219_LOAD_PIN) +#endif + #if PIN_EXISTS(TEMP_0_CS) REPORT_NAME_DIGITAL(__LINE__, TEMP_0_CS_PIN) #endif @@ -892,22 +1016,10 @@ #if PIN_EXISTS(TEMP_1_MISO) REPORT_NAME_DIGITAL(__LINE__, TEMP_1_MISO_PIN) #endif -#if PIN_EXISTS(MAX7219_CLK) - REPORT_NAME_DIGITAL(__LINE__, MAX7219_CLK_PIN) -#endif -#if PIN_EXISTS(MAX7219_DIN) - REPORT_NAME_DIGITAL(__LINE__, MAX7219_DIN_PIN) -#endif -#if PIN_EXISTS(MAX7219_LOAD) - REPORT_NAME_DIGITAL(__LINE__, MAX7219_LOAD_PIN) -#endif -//#if _EXISTS(MISO) -// REPORT_NAME_DIGITAL(__LINE__, MISO) -//#endif -#if PIN_EXISTS(MISO) - REPORT_NAME_DIGITAL(__LINE__, SD_MISO_PIN) -#endif +// +// MOSFETs (RAMPS) +// #if PIN_EXISTS(MOSFET_A) REPORT_NAME_DIGITAL(__LINE__, MOSFET_A_PIN) #endif @@ -920,12 +1032,92 @@ #if PIN_EXISTS(MOSFET_D) REPORT_NAME_DIGITAL(__LINE__, MOSFET_D_PIN) #endif + +// +// I2C +// + +//#if _EXISTS(SCL) +// REPORT_NAME_DIGITAL(__LINE__, SCL) +//#endif +#if PIN_EXISTS(I2C_SCL) + REPORT_NAME_DIGITAL(__LINE__, I2C_SCL_PIN) +#endif +//#if _EXISTS(SDA) +// REPORT_NAME_DIGITAL(__LINE__, SDA) +//#endif +#if PIN_EXISTS(I2C_SDA) + REPORT_NAME_DIGITAL(__LINE__, I2C_SDA_PIN) +#endif + +// +// SPI / SD Card +// + +//#if _EXISTS(MISO) +// REPORT_NAME_DIGITAL(__LINE__, MISO) +//#endif +#if PIN_EXISTS(SD_MISO) + REPORT_NAME_DIGITAL(__LINE__, SD_MISO_PIN) +#endif //#if _EXISTS(MOSI) // REPORT_NAME_DIGITAL(__LINE__, MOSI) //#endif -#if PIN_EXISTS(MOSI) +#if PIN_EXISTS(SD_MOSI) REPORT_NAME_DIGITAL(__LINE__, SD_MOSI_PIN) #endif +//#if _EXISTS(SCK) +// REPORT_NAME_DIGITAL(__LINE__, SCK) +//#endif +#if PIN_EXISTS(SD_SCK) + REPORT_NAME_DIGITAL(__LINE__, SD_SCK_PIN) +#endif +#if _EXISTS(SDSS) + REPORT_NAME_DIGITAL(__LINE__, SDSS) +#endif +#if PIN_EXISTS(SD_SS) + REPORT_NAME_DIGITAL(__LINE__, SD_SS_PIN) +#endif +#if PIN_EXISTS(SD_DETECT) + REPORT_NAME_DIGITAL(__LINE__, SD_DETECT_PIN) +#endif +#if PIN_EXISTS(SDPOWER) + REPORT_NAME_DIGITAL(__LINE__, SDPOWER_PIN) +#endif + +// +// Motor Current PWM +// +#if PIN_EXISTS(MOTOR_CURRENT_PWM_X) + REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_X_PIN) +#endif +#if PIN_EXISTS(MOTOR_CURRENT_PWM_Y) + REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_Y_PIN) +#endif +#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) + REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_XY_PIN) +#endif +#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z) + REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_Z_PIN) +#endif +#if PIN_EXISTS(MOTOR_CURRENT_PWM_I) + REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_I_PIN) +#endif +#if PIN_EXISTS(MOTOR_CURRENT_PWM_J) + REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_J_PIN) +#endif +#if PIN_EXISTS(MOTOR_CURRENT_PWM_K) + REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_K_PIN) +#endif +#if PIN_EXISTS(MOTOR_CURRENT_PWM_U) + REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_U_PIN) +#endif +#if PIN_EXISTS(MOTOR_CURRENT_PWM_V) + REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_V_PIN) +#endif +#if PIN_EXISTS(MOTOR_CURRENT_PWM_W) + REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_W_PIN) +#endif #if PIN_EXISTS(MOTOR_CURRENT_PWM_E) REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_E_PIN) #endif @@ -935,93 +1127,44 @@ #if PIN_EXISTS(MOTOR_CURRENT_PWM_E1) REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_E1_PIN) #endif -#if PIN_EXISTS(MOTOR_CURRENT_PWM_X) - REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_X_PIN) -#endif -#if PIN_EXISTS(MOTOR_CURRENT_PWM_Y) - REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_Y_PIN) -#endif -#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) - REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_XY_PIN) -#endif -#if PIN_EXISTS(MOTOR_CURRENT_PWM_X) - REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_X_PIN) -#endif -#if PIN_EXISTS(MOTOR_CURRENT_PWM_Y) - REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_Y_PIN) -#endif -#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z) - REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_Z_PIN) -#endif #if PIN_EXISTS(MOTOR_FAULT) REPORT_NAME_DIGITAL(__LINE__, MOTOR_FAULT_PIN) #endif + +#if PIN_EXISTS(SLED) + REPORT_NAME_DIGITAL(__LINE__, SLED_PIN) +#endif + +// +// Camera +// +#if PIN_EXISTS(CHDK) + REPORT_NAME_DIGITAL(__LINE__, CHDK_PIN) +#endif #if PIN_EXISTS(PHOTOGRAPH) REPORT_NAME_DIGITAL(__LINE__, PHOTOGRAPH_PIN) #endif -#if PIN_EXISTS(CHDK) - REPORT_NAME_DIGITAL(__LINE__, CHDK_PIN) -#endif -#if PIN_EXISTS(PS_ON) - REPORT_NAME_DIGITAL(__LINE__, PS_ON_PIN) -#endif + #if PIN_EXISTS(PWM_1) REPORT_NAME_DIGITAL(__LINE__, PWM_1_PIN) #endif #if PIN_EXISTS(PWM_2) REPORT_NAME_DIGITAL(__LINE__, PWM_2_PIN) #endif -#if _EXISTS(REF_CLK) - REPORT_NAME_DIGITAL(__LINE__, REF_CLK) -#endif -#if PIN_EXISTS(NEOPIXEL) - REPORT_NAME_DIGITAL(__LINE__, NEOPIXEL_PIN) -#endif -#if PIN_EXISTS(NEOPIXEL2) - REPORT_NAME_DIGITAL(__LINE__, NEOPIXEL2_PIN) -#endif -#if PIN_EXISTS(RGB_LED_R) - REPORT_NAME_DIGITAL(__LINE__, RGB_LED_R_PIN) -#endif -#if PIN_EXISTS(RGB_LED_G) - REPORT_NAME_DIGITAL(__LINE__, RGB_LED_G_PIN) -#endif -#if PIN_EXISTS(RGB_LED_B) - REPORT_NAME_DIGITAL(__LINE__, RGB_LED_B_PIN) -#endif -#if PIN_EXISTS(RGB_LED_W) - REPORT_NAME_DIGITAL(__LINE__, RGB_LED_W_PIN) -#endif + +// +// Serial UART +// #if PIN_EXISTS(RX_ENABLE) REPORT_NAME_DIGITAL(__LINE__, RX_ENABLE_PIN) #endif -#if PIN_EXISTS(SAFETY_TRIGGERED) - REPORT_NAME_DIGITAL(__LINE__, SAFETY_TRIGGERED_PIN) +#if PIN_EXISTS(TX_ENABLE) + REPORT_NAME_DIGITAL(__LINE__, TX_ENABLE_PIN) #endif -//#if _EXISTS(SCK) -// REPORT_NAME_DIGITAL(__LINE__, SCK) + +//#if _EXISTS(SERVO0) +// REPORT_NAME_DIGITAL(__LINE__, SERVO0) //#endif -#if PIN_EXISTS(SCK) - REPORT_NAME_DIGITAL(__LINE__, SD_SCK_PIN) -#endif -//#if _EXISTS(SCL) -// REPORT_NAME_DIGITAL(__LINE__, SCL) -//#endif -#if PIN_EXISTS(SD_DETECT) - REPORT_NAME_DIGITAL(__LINE__, SD_DETECT_PIN) -#endif -//#if _EXISTS(SDA) -// REPORT_NAME_DIGITAL(__LINE__, SDA) -//#endif -#if PIN_EXISTS(SDPOWER) - REPORT_NAME_DIGITAL(__LINE__, SDPOWER_PIN) -#endif -#if _EXISTS(SDSS) - REPORT_NAME_DIGITAL(__LINE__, SDSS) -#endif -#if _EXISTS(SERVO0) - REPORT_NAME_DIGITAL(__LINE__, SERVO0) -#endif #if PIN_EXISTS(SERVO0) REPORT_NAME_DIGITAL(__LINE__, SERVO0_PIN) #endif @@ -1034,6 +1177,7 @@ #if PIN_EXISTS(SERVO3) REPORT_NAME_DIGITAL(__LINE__, SERVO3_PIN) #endif + #if PIN_EXISTS(SHIFT_CLK) REPORT_NAME_DIGITAL(__LINE__, SHIFT_CLK_PIN) #endif @@ -1046,9 +1190,7 @@ #if PIN_EXISTS(SHIFT_OUT) REPORT_NAME_DIGITAL(__LINE__, SHIFT_OUT_PIN) #endif -#if PIN_EXISTS(SLED) - REPORT_NAME_DIGITAL(__LINE__, SLED_PIN) -#endif + #if PIN_EXISTS(SLEEP_WAKE) REPORT_NAME_DIGITAL(__LINE__, SLEEP_WAKE_PIN) #endif @@ -1076,9 +1218,11 @@ #if PIN_EXISTS(SOL7) REPORT_NAME_DIGITAL(__LINE__, SOL7_PIN) #endif + #if _EXISTS(SPARE_IO) REPORT_NAME_DIGITAL(__LINE__, SPARE_IO) #endif + #if PIN_EXISTS(SPI_EEPROM1_CS) REPORT_NAME_DIGITAL(__LINE__, SPI_EEPROM1_CS_PIN) #endif @@ -1088,6 +1232,7 @@ #if PIN_EXISTS(SPI_FLASH_CS) REPORT_NAME_DIGITAL(__LINE__, SPI_FLASH_CS_PIN) #endif + #if PIN_EXISTS(SPINDLE_DIR) REPORT_NAME_DIGITAL(__LINE__, SPINDLE_DIR_PIN) #endif @@ -1100,6 +1245,7 @@ #if PIN_EXISTS(SPINDLE_LASER_PWM) REPORT_NAME_DIGITAL(__LINE__, SPINDLE_LASER_PWM_PIN) #endif + #if PIN_EXISTS(SR_CLK) REPORT_NAME_DIGITAL(__LINE__, SR_CLK_PIN) #endif @@ -1109,24 +1255,10 @@ #if PIN_EXISTS(SR_STROBE) REPORT_NAME_DIGITAL(__LINE__, SR_STROBE_PIN) #endif -#if PIN_EXISTS(SS) - REPORT_NAME_DIGITAL(__LINE__, SD_SS_PIN) -#endif -#if PIN_EXISTS(STAT_LED_BLUE) - REPORT_NAME_DIGITAL(__LINE__, STAT_LED_BLUE_PIN) -#endif -#if _EXISTS(STAT_LED_RED_LED) - REPORT_NAME_DIGITAL(__LINE__, STAT_LED_RED_LED) -#endif -#if PIN_EXISTS(STAT_LED_RED) - REPORT_NAME_DIGITAL(__LINE__, STAT_LED_RED_PIN) -#endif + #if PIN_EXISTS(STEPPER_RESET) REPORT_NAME_DIGITAL(__LINE__, STEPPER_RESET_PIN) #endif -#if PIN_EXISTS(SUICIDE) - REPORT_NAME_DIGITAL(__LINE__, SUICIDE_PIN) -#endif #if PIN_EXISTS(TLC_BLANK) REPORT_NAME_DIGITAL(__LINE__, TLC_BLANK_PIN) #endif @@ -1139,6 +1271,13 @@ #if PIN_EXISTS(TLC_XLAT) REPORT_NAME_DIGITAL(__LINE__, TLC_XLAT_PIN) #endif + +// +// Generic Tool / PWM +// +#if PIN_EXISTS(TOOL_PWM) + REPORT_NAME_DIGITAL(__LINE__, TOOL_PWM_PIN) +#endif #if PIN_EXISTS(TOOL_0) REPORT_NAME_DIGITAL(__LINE__, TOOL_0_PIN) #endif @@ -1163,279 +1302,250 @@ #if PIN_EXISTS(TOOL_3_PWM) REPORT_NAME_DIGITAL(__LINE__, TOOL_3_PWM_PIN) #endif -#if PIN_EXISTS(TOOL_PWM) - REPORT_NAME_DIGITAL(__LINE__, TOOL_PWM_PIN) + +// +// Tool Sensors +// +#if PIN_EXISTS(TOOL_SENSOR1) + REPORT_NAME_DIGITAL(__LINE__, TOOL_SENSOR1_PIN) #endif -#if PIN_EXISTS(TX_ENABLE) - REPORT_NAME_DIGITAL(__LINE__, TX_ENABLE_PIN) +#if PIN_EXISTS(TOOL_SENSOR2) + REPORT_NAME_DIGITAL(__LINE__, TOOL_SENSOR2_PIN) #endif +#if PIN_EXISTS(TOOL_SENSOR3) + REPORT_NAME_DIGITAL(__LINE__, TOOL_SENSOR3_PIN) +#endif + +// +// UI +// #if _EXISTS(UI1) REPORT_NAME_DIGITAL(__LINE__, UI1) #endif #if _EXISTS(UI2) REPORT_NAME_DIGITAL(__LINE__, UI2) #endif -#if _EXISTS(UNUSED_PWM) - REPORT_NAME_DIGITAL(__LINE__, UNUSED_PWM) -#endif -#if PIN_EXISTS(X_ATT) - REPORT_NAME_DIGITAL(__LINE__, X_ATT_PIN) -#endif -#if PIN_EXISTS(X_CS) - REPORT_NAME_DIGITAL(__LINE__, X_CS_PIN) -#endif -#if PIN_EXISTS(X_DIR) - REPORT_NAME_DIGITAL(__LINE__, X_DIR_PIN) -#endif -#if PIN_EXISTS(X_ENABLE) - REPORT_NAME_DIGITAL(__LINE__, X_ENABLE_PIN) -#endif + +// +// Limit Switches +// #if PIN_EXISTS(X_MAX) REPORT_NAME_DIGITAL(__LINE__, X_MAX_PIN) #endif #if PIN_EXISTS(X_MIN) REPORT_NAME_DIGITAL(__LINE__, X_MIN_PIN) #endif -#if PIN_EXISTS(X_DIAG) - REPORT_NAME_DIGITAL(__LINE__, X_DIAG_PIN) -#endif -#if PIN_EXISTS(X_MS1) - REPORT_NAME_DIGITAL(__LINE__, X_MS1_PIN) -#endif -#if PIN_EXISTS(X_MS2) - REPORT_NAME_DIGITAL(__LINE__, X_MS2_PIN) -#endif -#if PIN_EXISTS(X_MS3) - REPORT_NAME_DIGITAL(__LINE__, X_MS3_PIN) -#endif -#if PIN_EXISTS(X_STEP) - REPORT_NAME_DIGITAL(__LINE__, X_STEP_PIN) -#endif -#if PIN_EXISTS(X_STDBY) - REPORT_NAME_DIGITAL(__LINE__, X_STDBY_PIN) -#endif #if PIN_EXISTS(X_STOP) REPORT_NAME_DIGITAL(__LINE__, X_STOP_PIN) #endif -#if PIN_EXISTS(X2_CS) - REPORT_NAME_DIGITAL(__LINE__, X2_CS_PIN) -#endif -#if PIN_EXISTS(X2_DIR) - REPORT_NAME_DIGITAL(__LINE__, X2_DIR_PIN) -#endif -#if PIN_EXISTS(X2_ENABLE) - REPORT_NAME_DIGITAL(__LINE__, X2_ENABLE_PIN) -#endif + #if PIN_EXISTS(X2_MAX) REPORT_NAME_DIGITAL(__LINE__, X2_MAX_PIN) #endif #if PIN_EXISTS(X2_MIN) REPORT_NAME_DIGITAL(__LINE__, X2_MIN_PIN) #endif -#if PIN_EXISTS(X2_MS1) - REPORT_NAME_DIGITAL(__LINE__, X2_MS1_PIN) -#endif -#if PIN_EXISTS(X2_MS2) - REPORT_NAME_DIGITAL(__LINE__, X2_MS2_PIN) -#endif -#if PIN_EXISTS(X2_MS3) - REPORT_NAME_DIGITAL(__LINE__, X2_MS3_PIN) -#endif -#if PIN_EXISTS(X2_STEP) - REPORT_NAME_DIGITAL(__LINE__, X2_STEP_PIN) -#endif -#if PIN_EXISTS(Y_ATT) - REPORT_NAME_DIGITAL(__LINE__, Y_ATT_PIN) -#endif -#if PIN_EXISTS(Y_CS) - REPORT_NAME_DIGITAL(__LINE__, Y_CS_PIN) -#endif -#if PIN_EXISTS(Y_DIR) - REPORT_NAME_DIGITAL(__LINE__, Y_DIR_PIN) -#endif -#if PIN_EXISTS(Y_ENABLE) - REPORT_NAME_DIGITAL(__LINE__, Y_ENABLE_PIN) +#if PIN_EXISTS(X2_STOP) + REPORT_NAME_DIGITAL(__LINE__, X2_STOP_PIN) #endif + #if PIN_EXISTS(Y_MAX) REPORT_NAME_DIGITAL(__LINE__, Y_MAX_PIN) #endif #if PIN_EXISTS(Y_MIN) REPORT_NAME_DIGITAL(__LINE__, Y_MIN_PIN) #endif -#if PIN_EXISTS(Y_DIAG) - REPORT_NAME_DIGITAL(__LINE__, Y_DIAG_PIN) -#endif -#if PIN_EXISTS(Y_MS1) - REPORT_NAME_DIGITAL(__LINE__, Y_MS1_PIN) -#endif -#if PIN_EXISTS(Y_MS2) - REPORT_NAME_DIGITAL(__LINE__, Y_MS2_PIN) -#endif -#if PIN_EXISTS(Y_MS3) - REPORT_NAME_DIGITAL(__LINE__, Y_MS3_PIN) -#endif -#if PIN_EXISTS(Y_STEP) - REPORT_NAME_DIGITAL(__LINE__, Y_STEP_PIN) -#endif -#if PIN_EXISTS(Y_STDBY) - REPORT_NAME_DIGITAL(__LINE__, Y_STDBY_PIN) -#endif #if PIN_EXISTS(Y_STOP) REPORT_NAME_DIGITAL(__LINE__, Y_STOP_PIN) #endif -#if PIN_EXISTS(Y2_CS) - REPORT_NAME_DIGITAL(__LINE__, Y2_CS_PIN) -#endif -#if PIN_EXISTS(Y2_DIR) - REPORT_NAME_DIGITAL(__LINE__, Y2_DIR_PIN) -#endif -#if PIN_EXISTS(Y2_ENABLE) - REPORT_NAME_DIGITAL(__LINE__, Y2_ENABLE_PIN) -#endif + #if PIN_EXISTS(Y2_MAX) REPORT_NAME_DIGITAL(__LINE__, Y2_MAX_PIN) #endif #if PIN_EXISTS(Y2_MIN) REPORT_NAME_DIGITAL(__LINE__, Y2_MIN_PIN) #endif -#if PIN_EXISTS(Y2_MS1) - REPORT_NAME_DIGITAL(__LINE__, Y2_MS1_PIN) -#endif -#if PIN_EXISTS(Y2_MS2) - REPORT_NAME_DIGITAL(__LINE__, Y2_MS2_PIN) -#endif -#if PIN_EXISTS(Y2_MS3) - REPORT_NAME_DIGITAL(__LINE__, Y2_MS3_PIN) -#endif -#if PIN_EXISTS(Y2_STEP) - REPORT_NAME_DIGITAL(__LINE__, Y2_STEP_PIN) -#endif -#if PIN_EXISTS(Z_ATT) - REPORT_NAME_DIGITAL(__LINE__, Z_ATT_PIN) -#endif -#if PIN_EXISTS(Z_CS) - REPORT_NAME_DIGITAL(__LINE__, Z_CS_PIN) -#endif -#if PIN_EXISTS(Z_DIR) - REPORT_NAME_DIGITAL(__LINE__, Z_DIR_PIN) -#endif -#if PIN_EXISTS(Z_ENABLE) - REPORT_NAME_DIGITAL(__LINE__, Z_ENABLE_PIN) +#if PIN_EXISTS(Y2_STOP) + REPORT_NAME_DIGITAL(__LINE__, Y2_STOP_PIN) #endif + #if PIN_EXISTS(Z_MAX) REPORT_NAME_DIGITAL(__LINE__, Z_MAX_PIN) #endif #if PIN_EXISTS(Z_MIN) REPORT_NAME_DIGITAL(__LINE__, Z_MIN_PIN) #endif -#if PIN_EXISTS(Z_DIAG) - REPORT_NAME_DIGITAL(__LINE__, Z_DIAG_PIN) -#endif -#if PIN_EXISTS(Z_MS1) - REPORT_NAME_DIGITAL(__LINE__, Z_MS1_PIN) -#endif -#if PIN_EXISTS(Z_MS2) - REPORT_NAME_DIGITAL(__LINE__, Z_MS2_PIN) -#endif -#if PIN_EXISTS(Z_MS3) - REPORT_NAME_DIGITAL(__LINE__, Z_MS3_PIN) -#endif -#if PIN_EXISTS(Z_STEP) - REPORT_NAME_DIGITAL(__LINE__, Z_STEP_PIN) -#endif -#if PIN_EXISTS(Z_STDBY) - REPORT_NAME_DIGITAL(__LINE__, Z_STDBY_PIN) -#endif #if PIN_EXISTS(Z_STOP) REPORT_NAME_DIGITAL(__LINE__, Z_STOP_PIN) #endif -#if PIN_EXISTS(Z2_CS) - REPORT_NAME_DIGITAL(__LINE__, Z2_CS_PIN) -#endif -#if PIN_EXISTS(Z2_DIR) - REPORT_NAME_DIGITAL(__LINE__, Z2_DIR_PIN) -#endif -#if PIN_EXISTS(Z2_ENABLE) - REPORT_NAME_DIGITAL(__LINE__, Z2_ENABLE_PIN) -#endif + #if PIN_EXISTS(Z2_MAX) REPORT_NAME_DIGITAL(__LINE__, Z2_MAX_PIN) #endif #if PIN_EXISTS(Z2_MIN) REPORT_NAME_DIGITAL(__LINE__, Z2_MIN_PIN) #endif -#if PIN_EXISTS(Z2_DIAG) - REPORT_NAME_DIGITAL(__LINE__, Z2_DIAG_PIN) -#endif -#if PIN_EXISTS(Z2_MS1) - REPORT_NAME_DIGITAL(__LINE__, Z2_MS1_PIN) -#endif -#if PIN_EXISTS(Z2_MS2) - REPORT_NAME_DIGITAL(__LINE__, Z2_MS2_PIN) -#endif -#if PIN_EXISTS(Z2_MS3) - REPORT_NAME_DIGITAL(__LINE__, Z2_MS3_PIN) -#endif -#if PIN_EXISTS(Z2_STEP) - REPORT_NAME_DIGITAL(__LINE__, Z2_STEP_PIN) -#endif #if PIN_EXISTS(Z2_STOP) REPORT_NAME_DIGITAL(__LINE__, Z2_STOP_PIN) #endif -#if PIN_EXISTS(Z3_CS) - REPORT_NAME_DIGITAL(__LINE__, Z3_CS_PIN) -#endif -#if PIN_EXISTS(Z3_DIR) - REPORT_NAME_DIGITAL(__LINE__, Z3_DIR_PIN) -#endif -#if PIN_EXISTS(Z3_ENABLE) - REPORT_NAME_DIGITAL(__LINE__, Z3_ENABLE_PIN) -#endif + #if PIN_EXISTS(Z3_MAX) REPORT_NAME_DIGITAL(__LINE__, Z3_MAX_PIN) #endif #if PIN_EXISTS(Z3_MIN) REPORT_NAME_DIGITAL(__LINE__, Z3_MIN_PIN) #endif -#if PIN_EXISTS(Z3_MS1) - REPORT_NAME_DIGITAL(__LINE__, Z3_MS1_PIN) -#endif -#if PIN_EXISTS(Z3_MS2) - REPORT_NAME_DIGITAL(__LINE__, Z3_MS2_PIN) -#endif -#if PIN_EXISTS(Z3_MS3) - REPORT_NAME_DIGITAL(__LINE__, Z3_MS3_PIN) -#endif -#if PIN_EXISTS(Z3_STEP) - REPORT_NAME_DIGITAL(__LINE__, Z3_STEP_PIN) -#endif -#if PIN_EXISTS(Z4_CS) - REPORT_NAME_DIGITAL(__LINE__, Z4_CS_PIN) -#endif -#if PIN_EXISTS(Z4_DIR) - REPORT_NAME_DIGITAL(__LINE__, Z4_DIR_PIN) -#endif -#if PIN_EXISTS(Z4_ENABLE) - REPORT_NAME_DIGITAL(__LINE__, Z4_ENABLE_PIN) +#if PIN_EXISTS(Z3_STOP) + REPORT_NAME_DIGITAL(__LINE__, Z3_STOP_PIN) #endif + #if PIN_EXISTS(Z4_MAX) REPORT_NAME_DIGITAL(__LINE__, Z4_MAX_PIN) #endif #if PIN_EXISTS(Z4_MIN) REPORT_NAME_DIGITAL(__LINE__, Z4_MIN_PIN) #endif -#if PIN_EXISTS(Z4_MS1) - REPORT_NAME_DIGITAL(__LINE__, Z4_MS1_PIN) +#if PIN_EXISTS(Z4_STOP) + REPORT_NAME_DIGITAL(__LINE__, Z4_STOP_PIN) #endif -#if PIN_EXISTS(Z4_MS2) - REPORT_NAME_DIGITAL(__LINE__, Z4_MS2_PIN) + +#if PIN_EXISTS(I_MAX) + REPORT_NAME_DIGITAL(__LINE__, I_MAX_PIN) #endif -#if PIN_EXISTS(Z4_MS3) - REPORT_NAME_DIGITAL(__LINE__, Z4_MS3_PIN) +#if PIN_EXISTS(I_MIN) + REPORT_NAME_DIGITAL(__LINE__, I_MIN_PIN) #endif -#if PIN_EXISTS(Z4_STEP) - REPORT_NAME_DIGITAL(__LINE__, Z4_STEP_PIN) +#if PIN_EXISTS(I_STOP) + REPORT_NAME_DIGITAL(__LINE__, I_STOP_PIN) #endif + +#if PIN_EXISTS(J_MAX) + REPORT_NAME_DIGITAL(__LINE__, J_MAX_PIN) +#endif +#if PIN_EXISTS(J_MIN) + REPORT_NAME_DIGITAL(__LINE__, J_MIN_PIN) +#endif +#if PIN_EXISTS(J_STOP) + REPORT_NAME_DIGITAL(__LINE__, J_STOP_PIN) +#endif + +#if PIN_EXISTS(K_MAX) + REPORT_NAME_DIGITAL(__LINE__, K_MAX_PIN) +#endif +#if PIN_EXISTS(K_MIN) + REPORT_NAME_DIGITAL(__LINE__, K_MIN_PIN) +#endif +#if PIN_EXISTS(K_STOP) + REPORT_NAME_DIGITAL(__LINE__, K_STOP_PIN) +#endif + +#if PIN_EXISTS(U_MAX) + REPORT_NAME_DIGITAL(__LINE__, U_MAX_PIN) +#endif +#if PIN_EXISTS(U_MIN) + REPORT_NAME_DIGITAL(__LINE__, U_MIN_PIN) +#endif +#if PIN_EXISTS(U_STOP) + REPORT_NAME_DIGITAL(__LINE__, U_STOP_PIN) +#endif + +#if PIN_EXISTS(V_MAX) + REPORT_NAME_DIGITAL(__LINE__, V_MAX_PIN) +#endif +#if PIN_EXISTS(V_MIN) + REPORT_NAME_DIGITAL(__LINE__, V_MIN_PIN) +#endif +#if PIN_EXISTS(V_STOP) + REPORT_NAME_DIGITAL(__LINE__, V_STOP_PIN) +#endif + +#if PIN_EXISTS(W_MAX) + REPORT_NAME_DIGITAL(__LINE__, W_MAX_PIN) +#endif +#if PIN_EXISTS(W_MIN) + REPORT_NAME_DIGITAL(__LINE__, W_MIN_PIN) +#endif +#if PIN_EXISTS(W_STOP) + REPORT_NAME_DIGITAL(__LINE__, W_STOP_PIN) +#endif + +#if PIN_EXISTS(E_STOP) + REPORT_NAME_DIGITAL(__LINE__, E_STOP_PIN) +#endif + +// +// TMC Diagnostic - Sensorless Endstops +// +#if PIN_EXISTS(X_DIAG) + REPORT_NAME_DIGITAL(__LINE__, X_DIAG_PIN) +#endif +#if PIN_EXISTS(X2_DIAG) + REPORT_NAME_DIGITAL(__LINE__, X2_DIAG_PIN) +#endif +#if PIN_EXISTS(Y_DIAG) + REPORT_NAME_DIGITAL(__LINE__, Y_DIAG_PIN) +#endif +#if PIN_EXISTS(Y2_DIAG) + REPORT_NAME_DIGITAL(__LINE__, Y2_DIAG_PIN) +#endif +#if PIN_EXISTS(Z_DIAG) + REPORT_NAME_DIGITAL(__LINE__, Z_DIAG_PIN) +#endif +#if PIN_EXISTS(Z2_DIAG) + REPORT_NAME_DIGITAL(__LINE__, Z2_DIAG_PIN) +#endif +#if PIN_EXISTS(Z3_DIAG) + REPORT_NAME_DIGITAL(__LINE__, Z3_DIAG_PIN) +#endif +#if PIN_EXISTS(Z4_DIAG) + REPORT_NAME_DIGITAL(__LINE__, Z4_DIAG_PIN) +#endif +#if PIN_EXISTS(I_DIAG) + REPORT_NAME_DIGITAL(__LINE__, I_DIAG_PIN) +#endif +#if PIN_EXISTS(J_DIAG) + REPORT_NAME_DIGITAL(__LINE__, J_DIAG_PIN) +#endif +#if PIN_EXISTS(K_DIAG) + REPORT_NAME_DIGITAL(__LINE__, K_DIAG_PIN) +#endif +#if PIN_EXISTS(U_DIAG) + REPORT_NAME_DIGITAL(__LINE__, U_DIAG_PIN) +#endif +#if PIN_EXISTS(V_DIAG) + REPORT_NAME_DIGITAL(__LINE__, V_DIAG_PIN) +#endif +#if PIN_EXISTS(W_DIAG) + REPORT_NAME_DIGITAL(__LINE__, W_DIAG_PIN) +#endif +#if PIN_EXISTS(E0_DIAG) + REPORT_NAME_DIGITAL(__LINE__, E0_DIAG_PIN) +#endif +#if PIN_EXISTS(E1_DIAG) + REPORT_NAME_DIGITAL(__LINE__, E1_DIAG_PIN) +#endif +#if PIN_EXISTS(E2_DIAG) + REPORT_NAME_DIGITAL(__LINE__, E2_DIAG_PIN) +#endif +#if PIN_EXISTS(E3_DIAG) + REPORT_NAME_DIGITAL(__LINE__, E3_DIAG_PIN) +#endif +#if PIN_EXISTS(E4_DIAG) + REPORT_NAME_DIGITAL(__LINE__, E4_DIAG_PIN) +#endif +#if PIN_EXISTS(E5_DIAG) + REPORT_NAME_DIGITAL(__LINE__, E5_DIAG_PIN) +#endif +#if PIN_EXISTS(E6_DIAG) + REPORT_NAME_DIGITAL(__LINE__, E6_DIAG_PIN) +#endif +#if PIN_EXISTS(E7_DIAG) + REPORT_NAME_DIGITAL(__LINE__, E7_DIAG_PIN) +#endif + +// +// Probes +// #if PIN_EXISTS(Z_MIN_PROBE) REPORT_NAME_DIGITAL(__LINE__, Z_MIN_PROBE_PIN) #endif @@ -1448,23 +1558,212 @@ #if PIN_EXISTS(PROBE_TARE) REPORT_NAME_DIGITAL(__LINE__, PROBE_TARE_PIN) #endif -#if PIN_EXISTS(I_ATT) - REPORT_NAME_DIGITAL(__LINE__, I_ATT_PIN) + +// +// Stepper Drivers +// +#if PIN_EXISTS(X_DIR) + REPORT_NAME_DIGITAL(__LINE__, X_DIR_PIN) #endif -#if PIN_EXISTS(I_CS) - REPORT_NAME_DIGITAL(__LINE__, I_CS_PIN) +#if PIN_EXISTS(X_ENABLE) + REPORT_NAME_DIGITAL(__LINE__, X_ENABLE_PIN) #endif +#if PIN_EXISTS(X_STEP) + REPORT_NAME_DIGITAL(__LINE__, X_STEP_PIN) +#endif +#if PIN_EXISTS(X2_DIR) + REPORT_NAME_DIGITAL(__LINE__, X2_DIR_PIN) +#endif +#if PIN_EXISTS(X2_ENABLE) + REPORT_NAME_DIGITAL(__LINE__, X2_ENABLE_PIN) +#endif +#if PIN_EXISTS(X2_STEP) + REPORT_NAME_DIGITAL(__LINE__, X2_STEP_PIN) +#endif +#if PIN_EXISTS(Y_DIR) + REPORT_NAME_DIGITAL(__LINE__, Y_DIR_PIN) +#endif +#if PIN_EXISTS(Y_ENABLE) + REPORT_NAME_DIGITAL(__LINE__, Y_ENABLE_PIN) +#endif +#if PIN_EXISTS(Y_STEP) + REPORT_NAME_DIGITAL(__LINE__, Y_STEP_PIN) +#endif +#if PIN_EXISTS(Y2_DIR) + REPORT_NAME_DIGITAL(__LINE__, Y2_DIR_PIN) +#endif +#if PIN_EXISTS(Y2_ENABLE) + REPORT_NAME_DIGITAL(__LINE__, Y2_ENABLE_PIN) +#endif +#if PIN_EXISTS(Y2_STEP) + REPORT_NAME_DIGITAL(__LINE__, Y2_STEP_PIN) +#endif +#if PIN_EXISTS(Z_DIR) + REPORT_NAME_DIGITAL(__LINE__, Z_DIR_PIN) +#endif +#if PIN_EXISTS(Z_ENABLE) + REPORT_NAME_DIGITAL(__LINE__, Z_ENABLE_PIN) +#endif +#if PIN_EXISTS(Z_STEP) + REPORT_NAME_DIGITAL(__LINE__, Z_STEP_PIN) +#endif +#if PIN_EXISTS(Z2_DIR) + REPORT_NAME_DIGITAL(__LINE__, Z2_DIR_PIN) +#endif +#if PIN_EXISTS(Z2_ENABLE) + REPORT_NAME_DIGITAL(__LINE__, Z2_ENABLE_PIN) +#endif +#if PIN_EXISTS(Z2_STEP) + REPORT_NAME_DIGITAL(__LINE__, Z2_STEP_PIN) +#endif +#if PIN_EXISTS(Z3_DIR) + REPORT_NAME_DIGITAL(__LINE__, Z3_DIR_PIN) +#endif +#if PIN_EXISTS(Z3_ENABLE) + REPORT_NAME_DIGITAL(__LINE__, Z3_ENABLE_PIN) +#endif +#if PIN_EXISTS(Z3_STEP) + REPORT_NAME_DIGITAL(__LINE__, Z3_STEP_PIN) +#endif +#if PIN_EXISTS(Z4_DIR) + REPORT_NAME_DIGITAL(__LINE__, Z4_DIR_PIN) +#endif +#if PIN_EXISTS(Z4_ENABLE) + REPORT_NAME_DIGITAL(__LINE__, Z4_ENABLE_PIN) +#endif +#if PIN_EXISTS(Z4_STEP) + REPORT_NAME_DIGITAL(__LINE__, Z4_STEP_PIN) +#endif + #if PIN_EXISTS(I_DIR) REPORT_NAME_DIGITAL(__LINE__, I_DIR_PIN) #endif #if PIN_EXISTS(I_ENABLE) REPORT_NAME_DIGITAL(__LINE__, I_ENABLE_PIN) #endif -#if PIN_EXISTS(I_MAX) - REPORT_NAME_DIGITAL(__LINE__, I_MAX_PIN) +#if PIN_EXISTS(I_STEP) + REPORT_NAME_DIGITAL(__LINE__, I_STEP_PIN) #endif -#if PIN_EXISTS(I_MIN) - REPORT_NAME_DIGITAL(__LINE__, I_MIN_PIN) +#if PIN_EXISTS(J_DIR) + REPORT_NAME_DIGITAL(__LINE__, J_DIR_PIN) +#endif +#if PIN_EXISTS(J_ENABLE) + REPORT_NAME_DIGITAL(__LINE__, J_ENABLE_PIN) +#endif +#if PIN_EXISTS(J_STEP) + REPORT_NAME_DIGITAL(__LINE__, J_STEP_PIN) +#endif +#if PIN_EXISTS(K_DIR) + REPORT_NAME_DIGITAL(__LINE__, K_DIR_PIN) +#endif +#if PIN_EXISTS(K_ENABLE) + REPORT_NAME_DIGITAL(__LINE__, K_ENABLE_PIN) +#endif +#if PIN_EXISTS(K_STEP) + REPORT_NAME_DIGITAL(__LINE__, K_STEP_PIN) +#endif +#if PIN_EXISTS(U_DIR) + REPORT_NAME_DIGITAL(__LINE__, U_DIR_PIN) +#endif +#if PIN_EXISTS(U_ENABLE) + REPORT_NAME_DIGITAL(__LINE__, U_ENABLE_PIN) +#endif +#if PIN_EXISTS(U_STEP) + REPORT_NAME_DIGITAL(__LINE__, U_STEP_PIN) +#endif +#if PIN_EXISTS(V_DIR) + REPORT_NAME_DIGITAL(__LINE__, V_DIR_PIN) +#endif +#if PIN_EXISTS(V_ENABLE) + REPORT_NAME_DIGITAL(__LINE__, V_ENABLE_PIN) +#endif +#if PIN_EXISTS(V_STEP) + REPORT_NAME_DIGITAL(__LINE__, V_STEP_PIN) +#endif +#if PIN_EXISTS(W_DIR) + REPORT_NAME_DIGITAL(__LINE__, W_DIR_PIN) +#endif +#if PIN_EXISTS(W_ENABLE) + REPORT_NAME_DIGITAL(__LINE__, W_ENABLE_PIN) +#endif +#if PIN_EXISTS(W_STEP) + REPORT_NAME_DIGITAL(__LINE__, W_STEP_PIN) +#endif + +// +// Digital Micro-steps +// +#if PIN_EXISTS(X_MS1) + REPORT_NAME_DIGITAL(__LINE__, X_MS1_PIN) +#endif +#if PIN_EXISTS(X_MS2) + REPORT_NAME_DIGITAL(__LINE__, X_MS2_PIN) +#endif +#if PIN_EXISTS(X_MS3) + REPORT_NAME_DIGITAL(__LINE__, X_MS3_PIN) +#endif +#if PIN_EXISTS(X2_MS1) + REPORT_NAME_DIGITAL(__LINE__, X2_MS1_PIN) +#endif +#if PIN_EXISTS(X2_MS2) + REPORT_NAME_DIGITAL(__LINE__, X2_MS2_PIN) +#endif +#if PIN_EXISTS(X2_MS3) + REPORT_NAME_DIGITAL(__LINE__, X2_MS3_PIN) +#endif +#if PIN_EXISTS(Y_MS1) + REPORT_NAME_DIGITAL(__LINE__, Y_MS1_PIN) +#endif +#if PIN_EXISTS(Y_MS2) + REPORT_NAME_DIGITAL(__LINE__, Y_MS2_PIN) +#endif +#if PIN_EXISTS(Y_MS3) + REPORT_NAME_DIGITAL(__LINE__, Y_MS3_PIN) +#endif +#if PIN_EXISTS(Y2_MS1) + REPORT_NAME_DIGITAL(__LINE__, Y2_MS1_PIN) +#endif +#if PIN_EXISTS(Y2_MS2) + REPORT_NAME_DIGITAL(__LINE__, Y2_MS2_PIN) +#endif +#if PIN_EXISTS(Y2_MS3) + REPORT_NAME_DIGITAL(__LINE__, Y2_MS3_PIN) +#endif +#if PIN_EXISTS(Z_MS1) + REPORT_NAME_DIGITAL(__LINE__, Z_MS1_PIN) +#endif +#if PIN_EXISTS(Z_MS2) + REPORT_NAME_DIGITAL(__LINE__, Z_MS2_PIN) +#endif +#if PIN_EXISTS(Z_MS3) + REPORT_NAME_DIGITAL(__LINE__, Z_MS3_PIN) +#endif +#if PIN_EXISTS(Z2_MS1) + REPORT_NAME_DIGITAL(__LINE__, Z2_MS1_PIN) +#endif +#if PIN_EXISTS(Z2_MS2) + REPORT_NAME_DIGITAL(__LINE__, Z2_MS2_PIN) +#endif +#if PIN_EXISTS(Z2_MS3) + REPORT_NAME_DIGITAL(__LINE__, Z2_MS3_PIN) +#endif +#if PIN_EXISTS(Z3_MS1) + REPORT_NAME_DIGITAL(__LINE__, Z3_MS1_PIN) +#endif +#if PIN_EXISTS(Z3_MS2) + REPORT_NAME_DIGITAL(__LINE__, Z3_MS2_PIN) +#endif +#if PIN_EXISTS(Z3_MS3) + REPORT_NAME_DIGITAL(__LINE__, Z3_MS3_PIN) +#endif +#if PIN_EXISTS(Z4_MS1) + REPORT_NAME_DIGITAL(__LINE__, Z4_MS1_PIN) +#endif +#if PIN_EXISTS(Z4_MS2) + REPORT_NAME_DIGITAL(__LINE__, Z4_MS2_PIN) +#endif +#if PIN_EXISTS(Z4_MS3) + REPORT_NAME_DIGITAL(__LINE__, Z4_MS3_PIN) #endif #if PIN_EXISTS(I_MS1) REPORT_NAME_DIGITAL(__LINE__, I_MS1_PIN) @@ -1475,30 +1774,6 @@ #if PIN_EXISTS(I_MS3) REPORT_NAME_DIGITAL(__LINE__, I_MS3_PIN) #endif -#if PIN_EXISTS(I_STEP) - REPORT_NAME_DIGITAL(__LINE__, I_STEP_PIN) -#endif -#if PIN_EXISTS(I_STOP) - REPORT_NAME_DIGITAL(__LINE__, I_STOP_PIN) -#endif -#if PIN_EXISTS(J_ATT) - REPORT_NAME_DIGITAL(__LINE__, J_ATT_PIN) -#endif -#if PIN_EXISTS(J_CS) - REPORT_NAME_DIGITAL(__LINE__, J_CS_PIN) -#endif -#if PIN_EXISTS(J_DIR) - REPORT_NAME_DIGITAL(__LINE__, J_DIR_PIN) -#endif -#if PIN_EXISTS(J_ENABLE) - REPORT_NAME_DIGITAL(__LINE__, J_ENABLE_PIN) -#endif -#if PIN_EXISTS(J_MAX) - REPORT_NAME_DIGITAL(__LINE__, J_MAX_PIN) -#endif -#if PIN_EXISTS(J_MIN) - REPORT_NAME_DIGITAL(__LINE__, J_MIN_PIN) -#endif #if PIN_EXISTS(J_MS1) REPORT_NAME_DIGITAL(__LINE__, J_MS1_PIN) #endif @@ -1508,30 +1783,6 @@ #if PIN_EXISTS(J_MS3) REPORT_NAME_DIGITAL(__LINE__, J_MS3_PIN) #endif -#if PIN_EXISTS(J_STEP) - REPORT_NAME_DIGITAL(__LINE__, J_STEP_PIN) -#endif -#if PIN_EXISTS(J_STOP) - REPORT_NAME_DIGITAL(__LINE__, J_STOP_PIN) -#endif -#if PIN_EXISTS(K_ATT) - REPORT_NAME_DIGITAL(__LINE__, K_ATT_PIN) -#endif -#if PIN_EXISTS(K_CS) - REPORT_NAME_DIGITAL(__LINE__, K_CS_PIN) -#endif -#if PIN_EXISTS(K_DIR) - REPORT_NAME_DIGITAL(__LINE__, K_DIR_PIN) -#endif -#if PIN_EXISTS(K_ENABLE) - REPORT_NAME_DIGITAL(__LINE__, K_ENABLE_PIN) -#endif -#if PIN_EXISTS(K_MAX) - REPORT_NAME_DIGITAL(__LINE__, K_MAX_PIN) -#endif -#if PIN_EXISTS(K_MIN) - REPORT_NAME_DIGITAL(__LINE__, K_MIN_PIN) -#endif #if PIN_EXISTS(K_MS1) REPORT_NAME_DIGITAL(__LINE__, K_MS1_PIN) #endif @@ -1541,30 +1792,6 @@ #if PIN_EXISTS(K_MS3) REPORT_NAME_DIGITAL(__LINE__, K_MS3_PIN) #endif -#if PIN_EXISTS(K_STEP) - REPORT_NAME_DIGITAL(__LINE__, K_STEP_PIN) -#endif -#if PIN_EXISTS(K_STOP) - REPORT_NAME_DIGITAL(__LINE__, K_STOP_PIN) -#endif -#if PIN_EXISTS(U_ATT) - REPORT_NAME_DIGITAL(__LINE__, U_ATT_PIN) -#endif -#if PIN_EXISTS(U_CS) - REPORT_NAME_DIGITAL(__LINE__, U_CS_PIN) -#endif -#if PIN_EXISTS(U_DIR) - REPORT_NAME_DIGITAL(__LINE__, U_DIR_PIN) -#endif -#if PIN_EXISTS(U_ENABLE) - REPORT_NAME_DIGITAL(__LINE__, U_ENABLE_PIN) -#endif -#if PIN_EXISTS(U_MAX) - REPORT_NAME_DIGITAL(__LINE__, U_MAX_PIN) -#endif -#if PIN_EXISTS(U_MIN) - REPORT_NAME_DIGITAL(__LINE__, U_MIN_PIN) -#endif #if PIN_EXISTS(U_MS1) REPORT_NAME_DIGITAL(__LINE__, U_MS1_PIN) #endif @@ -1574,30 +1801,6 @@ #if PIN_EXISTS(U_MS3) REPORT_NAME_DIGITAL(__LINE__, U_MS3_PIN) #endif -#if PIN_EXISTS(U_STEP) - REPORT_NAME_DIGITAL(__LINE__, U_STEP_PIN) -#endif -#if PIN_EXISTS(U_STOP) - REPORT_NAME_DIGITAL(__LINE__, U_STOP_PIN) -#endif -#if PIN_EXISTS(V_ATT) - REPORT_NAME_DIGITAL(__LINE__, V_ATT_PIN) -#endif -#if PIN_EXISTS(V_CS) - REPORT_NAME_DIGITAL(__LINE__, V_CS_PIN) -#endif -#if PIN_EXISTS(V_DIR) - REPORT_NAME_DIGITAL(__LINE__, V_DIR_PIN) -#endif -#if PIN_EXISTS(V_ENABLE) - REPORT_NAME_DIGITAL(__LINE__, V_ENABLE_PIN) -#endif -#if PIN_EXISTS(V_MAX) - REPORT_NAME_DIGITAL(__LINE__, V_MAX_PIN) -#endif -#if PIN_EXISTS(V_MIN) - REPORT_NAME_DIGITAL(__LINE__, V_MIN_PIN) -#endif #if PIN_EXISTS(V_MS1) REPORT_NAME_DIGITAL(__LINE__, V_MS1_PIN) #endif @@ -1607,30 +1810,6 @@ #if PIN_EXISTS(V_MS3) REPORT_NAME_DIGITAL(__LINE__, V_MS3_PIN) #endif -#if PIN_EXISTS(V_STEP) - REPORT_NAME_DIGITAL(__LINE__, V_STEP_PIN) -#endif -#if PIN_EXISTS(V_STOP) - REPORT_NAME_DIGITAL(__LINE__, V_STOP_PIN) -#endif -#if PIN_EXISTS(W_ATT) - REPORT_NAME_DIGITAL(__LINE__, W_ATT_PIN) -#endif -#if PIN_EXISTS(W_CS) - REPORT_NAME_DIGITAL(__LINE__, W_CS_PIN) -#endif -#if PIN_EXISTS(W_DIR) - REPORT_NAME_DIGITAL(__LINE__, W_DIR_PIN) -#endif -#if PIN_EXISTS(W_ENABLE) - REPORT_NAME_DIGITAL(__LINE__, W_ENABLE_PIN) -#endif -#if PIN_EXISTS(W_MAX) - REPORT_NAME_DIGITAL(__LINE__, W_MAX_PIN) -#endif -#if PIN_EXISTS(W_MIN) - REPORT_NAME_DIGITAL(__LINE__, W_MIN_PIN) -#endif #if PIN_EXISTS(W_MS1) REPORT_NAME_DIGITAL(__LINE__, W_MS1_PIN) #endif @@ -1640,18 +1819,186 @@ #if PIN_EXISTS(W_MS3) REPORT_NAME_DIGITAL(__LINE__, W_MS3_PIN) #endif -#if PIN_EXISTS(W_STEP) - REPORT_NAME_DIGITAL(__LINE__, W_STEP_PIN) +#if PIN_EXISTS(E0_MS1) + REPORT_NAME_DIGITAL(__LINE__, E0_MS1_PIN) #endif -#if PIN_EXISTS(W_STOP) - REPORT_NAME_DIGITAL(__LINE__, W_STOP_PIN) +#if PIN_EXISTS(E0_MS2) + REPORT_NAME_DIGITAL(__LINE__, E0_MS2_PIN) #endif -#if PIN_EXISTS(ZRIB_V20_D6) - REPORT_NAME_DIGITAL(__LINE__, ZRIB_V20_D6_PIN) +#if PIN_EXISTS(E0_MS3) + REPORT_NAME_DIGITAL(__LINE__, E0_MS3_PIN) #endif -#if PIN_EXISTS(ZRIB_V20_D9) - REPORT_NAME_DIGITAL(__LINE__, ZRIB_V20_D9_PIN) +#if PIN_EXISTS(E1_MS1) + REPORT_NAME_DIGITAL(__LINE__, E1_MS1_PIN) #endif +#if PIN_EXISTS(E1_MS2) + REPORT_NAME_DIGITAL(__LINE__, E1_MS2_PIN) +#endif +#if PIN_EXISTS(E1_MS3) + REPORT_NAME_DIGITAL(__LINE__, E1_MS3_PIN) +#endif +#if PIN_EXISTS(E2_MS1) + REPORT_NAME_DIGITAL(__LINE__, E2_MS1_PIN) +#endif +#if PIN_EXISTS(E2_MS2) + REPORT_NAME_DIGITAL(__LINE__, E2_MS2_PIN) +#endif +#if PIN_EXISTS(E2_MS3) + REPORT_NAME_DIGITAL(__LINE__, E2_MS3_PIN) +#endif +#if PIN_EXISTS(E3_MS1) + REPORT_NAME_DIGITAL(__LINE__, E3_MS1_PIN) +#endif +#if PIN_EXISTS(E3_MS2) + REPORT_NAME_DIGITAL(__LINE__, E3_MS2_PIN) +#endif +#if PIN_EXISTS(E3_MS3) + REPORT_NAME_DIGITAL(__LINE__, E3_MS3_PIN) +#endif +#if PIN_EXISTS(E4_MS1) + REPORT_NAME_DIGITAL(__LINE__, E4_MS1_PIN) +#endif +#if PIN_EXISTS(E4_MS2) + REPORT_NAME_DIGITAL(__LINE__, E4_MS2_PIN) +#endif +#if PIN_EXISTS(E4_MS3) + REPORT_NAME_DIGITAL(__LINE__, E4_MS3_PIN) +#endif +#if PIN_EXISTS(E5_MS1) + REPORT_NAME_DIGITAL(__LINE__, E5_MS1_PIN) +#endif +#if PIN_EXISTS(E5_MS2) + REPORT_NAME_DIGITAL(__LINE__, E5_MS2_PIN) +#endif +#if PIN_EXISTS(E5_MS3) + REPORT_NAME_DIGITAL(__LINE__, E5_MS3_PIN) +#endif +#if PIN_EXISTS(E6_MS1) + REPORT_NAME_DIGITAL(__LINE__, E6_MS1_PIN) +#endif +#if PIN_EXISTS(E6_MS2) + REPORT_NAME_DIGITAL(__LINE__, E6_MS2_PIN) +#endif +#if PIN_EXISTS(E6_MS3) + REPORT_NAME_DIGITAL(__LINE__, E6_MS3_PIN) +#endif +#if PIN_EXISTS(E7_MS1) + REPORT_NAME_DIGITAL(__LINE__, E7_MS1_PIN) +#endif +#if PIN_EXISTS(E7_MS2) + REPORT_NAME_DIGITAL(__LINE__, E7_MS2_PIN) +#endif +#if PIN_EXISTS(E7_MS3) + REPORT_NAME_DIGITAL(__LINE__, E7_MS3_PIN) +#endif + +// +// Stepper Standby +// +#if PIN_EXISTS(X_STDBY) + REPORT_NAME_DIGITAL(__LINE__, X_STDBY_PIN) +#endif +#if PIN_EXISTS(X2_STDBY) + REPORT_NAME_DIGITAL(__LINE__, X2_STDBY_PIN) +#endif +#if PIN_EXISTS(Y_STDBY) + REPORT_NAME_DIGITAL(__LINE__, Y_STDBY_PIN) +#endif +#if PIN_EXISTS(Y2_STDBY) + REPORT_NAME_DIGITAL(__LINE__, Y2_STDBY_PIN) +#endif +#if PIN_EXISTS(Z_STDBY) + REPORT_NAME_DIGITAL(__LINE__, Z_STDBY_PIN) +#endif +#if PIN_EXISTS(Z2_STDBY) + REPORT_NAME_DIGITAL(__LINE__, Z2_STDBY_PIN) +#endif +#if PIN_EXISTS(Z3_STDBY) + REPORT_NAME_DIGITAL(__LINE__, Z3_STDBY_PIN) +#endif +#if PIN_EXISTS(Z4_STDBY) + REPORT_NAME_DIGITAL(__LINE__, Z4_STDBY_PIN) +#endif +#if PIN_EXISTS(I_STDBY) + REPORT_NAME_DIGITAL(__LINE__, I_STDBY_PIN) +#endif +#if PIN_EXISTS(J_STDBY) + REPORT_NAME_DIGITAL(__LINE__, J_STDBY_PIN) +#endif +#if PIN_EXISTS(K_STDBY) + REPORT_NAME_DIGITAL(__LINE__, K_STDBY_PIN) +#endif +#if PIN_EXISTS(U_STDBY) + REPORT_NAME_DIGITAL(__LINE__, U_STDBY_PIN) +#endif +#if PIN_EXISTS(V_STDBY) + REPORT_NAME_DIGITAL(__LINE__, V_STDBY_PIN) +#endif +#if PIN_EXISTS(W_STDBY) + REPORT_NAME_DIGITAL(__LINE__, W_STDBY_PIN) +#endif +#if PIN_EXISTS(E0_STDBY) + REPORT_NAME_DIGITAL(__LINE__, E0_STDBY_PIN) +#endif +#if PIN_EXISTS(E1_STDBY) + REPORT_NAME_DIGITAL(__LINE__, E1_STDBY_PIN) +#endif +#if PIN_EXISTS(E2_STDBY) + REPORT_NAME_DIGITAL(__LINE__, E2_STDBY_PIN) +#endif +#if PIN_EXISTS(E3_STDBY) + REPORT_NAME_DIGITAL(__LINE__, E3_STDBY_PIN) +#endif +#if PIN_EXISTS(E4_STDBY) + REPORT_NAME_DIGITAL(__LINE__, E4_STDBY_PIN) +#endif +#if PIN_EXISTS(E5_STDBY) + REPORT_NAME_DIGITAL(__LINE__, E5_STDBY_PIN) +#endif +#if PIN_EXISTS(E6_STDBY) + REPORT_NAME_DIGITAL(__LINE__, E6_STDBY_PIN) +#endif +#if PIN_EXISTS(E7_STDBY) + REPORT_NAME_DIGITAL(__LINE__, E7_STDBY_PIN) +#endif + +// +// LV8731V Current Attenuation +// +#if PIN_EXISTS(X_ATT) + REPORT_NAME_DIGITAL(__LINE__, X_ATT_PIN) +#endif +#if PIN_EXISTS(Y_ATT) + REPORT_NAME_DIGITAL(__LINE__, Y_ATT_PIN) +#endif +#if PIN_EXISTS(E0_ATT) + REPORT_NAME_DIGITAL(__LINE__, E0_ATT_PIN) +#endif +#if PIN_EXISTS(Z_ATT) + REPORT_NAME_DIGITAL(__LINE__, Z_ATT_PIN) +#endif +#if PIN_EXISTS(I_ATT) + REPORT_NAME_DIGITAL(__LINE__, I_ATT_PIN) +#endif +#if PIN_EXISTS(J_ATT) + REPORT_NAME_DIGITAL(__LINE__, J_ATT_PIN) +#endif +#if PIN_EXISTS(K_ATT) + REPORT_NAME_DIGITAL(__LINE__, K_ATT_PIN) +#endif +#if PIN_EXISTS(U_ATT) + REPORT_NAME_DIGITAL(__LINE__, U_ATT_PIN) +#endif +#if PIN_EXISTS(V_ATT) + REPORT_NAME_DIGITAL(__LINE__, V_ATT_PIN) +#endif +#if PIN_EXISTS(W_ATT) + REPORT_NAME_DIGITAL(__LINE__, W_ATT_PIN) +#endif + +// +// TMC Serial UART +// #if PIN_EXISTS(X_SERIAL_TX) REPORT_NAME_DIGITAL(__LINE__, X_SERIAL_TX_PIN) #endif @@ -1736,99 +2083,59 @@ #if PIN_EXISTS(W_SERIAL_RX) REPORT_NAME_DIGITAL(__LINE__, W_SERIAL_RX_PIN) #endif -#if PIN_EXISTS(E0_DIAG) - REPORT_NAME_DIGITAL(__LINE__, E0_DIAG_PIN) -#endif + #if PIN_EXISTS(E0_SERIAL_TX) REPORT_NAME_DIGITAL(__LINE__, E0_SERIAL_TX_PIN) #endif #if PIN_EXISTS(E0_SERIAL_RX) REPORT_NAME_DIGITAL(__LINE__, E0_SERIAL_RX_PIN) #endif -#if PIN_EXISTS(E1_DIAG) - REPORT_NAME_DIGITAL(__LINE__, E1_DIAG_PIN) -#endif #if PIN_EXISTS(E1_SERIAL_TX) REPORT_NAME_DIGITAL(__LINE__, E1_SERIAL_TX_PIN) #endif #if PIN_EXISTS(E1_SERIAL_RX) REPORT_NAME_DIGITAL(__LINE__, E1_SERIAL_RX_PIN) #endif -#if PIN_EXISTS(E2_DIAG) - REPORT_NAME_DIGITAL(__LINE__, E2_DIAG_PIN) -#endif #if PIN_EXISTS(E2_SERIAL_TX) REPORT_NAME_DIGITAL(__LINE__, E2_SERIAL_TX_PIN) #endif #if PIN_EXISTS(E2_SERIAL_RX) REPORT_NAME_DIGITAL(__LINE__, E2_SERIAL_RX_PIN) #endif -#if PIN_EXISTS(E3_DIAG) - REPORT_NAME_DIGITAL(__LINE__, E3_DIAG_PIN) -#endif #if PIN_EXISTS(E3_SERIAL_TX) REPORT_NAME_DIGITAL(__LINE__, E3_SERIAL_TX_PIN) #endif #if PIN_EXISTS(E3_SERIAL_RX) REPORT_NAME_DIGITAL(__LINE__, E3_SERIAL_RX_PIN) #endif -#if PIN_EXISTS(E4_DIAG) - REPORT_NAME_DIGITAL(__LINE__, E4_DIAG_PIN) -#endif #if PIN_EXISTS(E4_SERIAL_TX) REPORT_NAME_DIGITAL(__LINE__, E4_SERIAL_TX_PIN) #endif #if PIN_EXISTS(E4_SERIAL_RX) REPORT_NAME_DIGITAL(__LINE__, E4_SERIAL_RX_PIN) #endif -#if PIN_EXISTS(E5_DIAG) - REPORT_NAME_DIGITAL(__LINE__, E5_DIAG_PIN) -#endif #if PIN_EXISTS(E5_SERIAL_TX) REPORT_NAME_DIGITAL(__LINE__, E5_SERIAL_TX_PIN) #endif #if PIN_EXISTS(E5_SERIAL_RX) REPORT_NAME_DIGITAL(__LINE__, E5_SERIAL_RX_PIN) #endif -#if PIN_EXISTS(E6_DIAG) - REPORT_NAME_DIGITAL(__LINE__, E6_DIAG_PIN) -#endif #if PIN_EXISTS(E6_SERIAL_TX) REPORT_NAME_DIGITAL(__LINE__, E6_SERIAL_TX_PIN) #endif #if PIN_EXISTS(E6_SERIAL_RX) REPORT_NAME_DIGITAL(__LINE__, E6_SERIAL_RX_PIN) #endif -#if PIN_EXISTS(E7_DIAG) - REPORT_NAME_DIGITAL(__LINE__, E7_DIAG_PIN) -#endif #if PIN_EXISTS(E7_SERIAL_TX) REPORT_NAME_DIGITAL(__LINE__, E7_SERIAL_TX_PIN) #endif #if PIN_EXISTS(E7_SERIAL_RX) REPORT_NAME_DIGITAL(__LINE__, E7_SERIAL_RX_PIN) #endif -#if PIN_EXISTS(I_SERIAL_TX) - REPORT_NAME_DIGITAL(__LINE__, I_SERIAL_TX_PIN) -#endif -#if PIN_EXISTS(I_SERIAL_RX) - REPORT_NAME_DIGITAL(__LINE__, I_SERIAL_RX_PIN) -#endif -#if PIN_EXISTS(J_SERIAL_TX) - REPORT_NAME_DIGITAL(__LINE__, J_SERIAL_TX_PIN) -#endif -#if PIN_EXISTS(J_SERIAL_RX) - REPORT_NAME_DIGITAL(__LINE__, J_SERIAL_RX_PIN) -#endif -#if PIN_EXISTS(K_SERIAL_TX) - REPORT_NAME_DIGITAL(__LINE__, K_SERIAL_TX_PIN) -#endif -#if PIN_EXISTS(K_SERIAL_RX) - REPORT_NAME_DIGITAL(__LINE__, K_SERIAL_RX_PIN) -#endif -#if PIN_EXISTS(FET_SAFETY) - REPORT_NAME_DIGITAL(__LINE__, FET_SAFETY_PIN) -#endif + +// +// Touch Screen +// #if PIN_EXISTS(TOUCH_MISO) REPORT_NAME_DIGITAL(__LINE__, TOUCH_MISO_PIN) #endif @@ -1844,27 +2151,51 @@ #if PIN_EXISTS(TOUCH_INT) REPORT_NAME_DIGITAL(__LINE__, TOUCH_INT_PIN) #endif + +// +// USB +// #if PIN_EXISTS(USB_CS) REPORT_NAME_DIGITAL(__LINE__, USB_CS_PIN) #endif #if PIN_EXISTS(USB_INTR) REPORT_NAME_DIGITAL(__LINE__, USB_INTR_PIN) #endif + +// +// MMU2 +// #if PIN_EXISTS(MMU2_RST) REPORT_NAME_DIGITAL(__LINE__, MMU2_RST_PIN) #endif + +// +// G425 Axis Calibration +// #if PIN_EXISTS(CALIBRATION) REPORT_NAME_DIGITAL(__LINE__, CALIBRATION_PIN) #endif + +// +// Duet Smart Effector +// #if PIN_EXISTS(SMART_EFFECTOR_MOD) REPORT_NAME_DIGITAL(__LINE__, SMART_EFFECTOR_MOD_PIN) #endif + +// +// Closed Loop +// #if PIN_EXISTS(CLOSED_LOOP_ENABLE) REPORT_NAME_DIGITAL(__LINE__, CLOSED_LOOP_ENABLE_PIN) #endif #if PIN_EXISTS(CLOSED_LOOP_MOVE_COMPLETE) REPORT_NAME_DIGITAL(__LINE__, CLOSED_LOOP_MOVE_COMPLETE_PIN) #endif + +// +// ESP WiFi +// #if PIN_EXISTS(ESP_WIFI_MODULE_RESET) REPORT_NAME_DIGITAL(__LINE__, ESP_WIFI_MODULE_RESET_PIN) #endif @@ -1877,7 +2208,10 @@ #if PIN_EXISTS(ESP_WIFI_MODULE_GPIO2) REPORT_NAME_DIGITAL(__LINE__, ESP_WIFI_MODULE_GPIO2_PIN) #endif -// TFT PINS + +// +// TFT +// #if PIN_EXISTS(TFT_CS) REPORT_NAME_DIGITAL(__LINE__, TFT_CS_PIN) #endif @@ -1896,3 +2230,10 @@ #if PIN_EXISTS(TFT_RESET) REPORT_NAME_DIGITAL(__LINE__, TFT_RESET_PIN) #endif + +// +// Miscellaneous +// +#if _EXISTS(UNUSED_PWM) + REPORT_NAME_DIGITAL(__LINE__, UNUSED_PWM) +#endif diff --git a/Marlin/src/pins/ramps/pins_RIGIDBOARD.h b/Marlin/src/pins/ramps/pins_RIGIDBOARD.h index 2d68577f7c..273e0274a8 100644 --- a/Marlin/src/pins/ramps/pins_RIGIDBOARD.h +++ b/Marlin/src/pins/ramps/pins_RIGIDBOARD.h @@ -103,9 +103,9 @@ // Direction buttons #define BTN_UP 37 - #define BTN_DWN 35 - #define BTN_LFT 33 - #define BTN_RT 32 + #define BTN_DOWN 35 + #define BTN_LEFT 33 + #define BTN_RIGHT 32 // 'R' button #undef BTN_ENC diff --git a/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h b/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h index 128f1974e0..0b15cd35ad 100644 --- a/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h +++ b/Marlin/src/pins/ramps/pins_ULTIMAIN_2.h @@ -107,8 +107,8 @@ #define SDSS 53 #define SD_DETECT_PIN 39 #define LED_PIN 8 -#define SAFETY_TRIGGERED_PIN 28 // PIN to detect the safety circuit has triggered -#define MAIN_VOLTAGE_MEASURE_PIN 14 // ANALOG PIN to measure the main voltage, with a 100k - 4k7 resitor divider. +//#define SAFETY_TRIGGERED_PIN 28 // PIN to detect the safety circuit has triggered +//#define MAIN_VOLTAGE_MEASURE_PIN 14 // ANALOG PIN to measure the main voltage, with a 100k - 4k7 resitor divider. // // LCD / Controller diff --git a/Marlin/src/pins/ramps/pins_ZRIB_V20.h b/Marlin/src/pins/ramps/pins_ZRIB_V20.h index e9328ca7ba..3078b9f77b 100644 --- a/Marlin/src/pins/ramps/pins_ZRIB_V20.h +++ b/Marlin/src/pins/ramps/pins_ZRIB_V20.h @@ -28,31 +28,20 @@ #include "pins_MKS_GEN_13.h" // ... RAMPS -#define ZRIB_V20_D6_PIN 6 // Fan -#define ZRIB_V20_D9_PIN 9 // Fan2 -#define ZRIB_V20_A10_PIN 10 -#define ZRIB_V20_D16_PIN 16 -#define ZRIB_V20_D17_PIN 17 -#define ZRIB_V20_D23_PIN 23 -#define ZRIB_V20_D25_PIN 25 -#define ZRIB_V20_D27_PIN 27 -#define ZRIB_V20_D29_PIN 29 -#define ZRIB_V20_D37_PIN 37 - // // Auto fans // #ifndef E0_AUTO_FAN_PIN - #define E0_AUTO_FAN_PIN ZRIB_V20_D6_PIN + #define E0_AUTO_FAN_PIN 6 // Fan #endif #ifndef E1_AUTO_FAN_PIN - #define E1_AUTO_FAN_PIN ZRIB_V20_D6_PIN + #define E1_AUTO_FAN_PIN 6 #endif #ifndef E2_AUTO_FAN_PIN - #define E2_AUTO_FAN_PIN ZRIB_V20_D6_PIN + #define E2_AUTO_FAN_PIN 6 #endif #ifndef E3_AUTO_FAN_PIN - #define E3_AUTO_FAN_PIN ZRIB_V20_D6_PIN + #define E3_AUTO_FAN_PIN 6 #endif #ifndef FILWIDTH_PIN @@ -76,12 +65,12 @@ #undef BTN_EN2 #undef BTN_ENC - #define LCD_PINS_RS ZRIB_V20_D16_PIN - #define LCD_PINS_ENABLE ZRIB_V20_D17_PIN - #define LCD_PINS_D4 ZRIB_V20_D23_PIN - #define LCD_PINS_D5 ZRIB_V20_D25_PIN - #define LCD_PINS_D6 ZRIB_V20_D27_PIN - #define LCD_PINS_D7 ZRIB_V20_D29_PIN - #define ADC_KEYPAD_PIN ZRIB_V20_A10_PIN - #define BEEPER_PIN ZRIB_V20_D37_PIN + #define LCD_PINS_RS 16 + #define LCD_PINS_ENABLE 17 + #define LCD_PINS_D4 23 + #define LCD_PINS_D5 25 + #define LCD_PINS_D6 27 + #define LCD_PINS_D7 29 + #define ADC_KEYPAD_PIN 10 // Analog Input + #define BEEPER_PIN 37 #endif From 6aa536c08f444daaf7e3aad125ab9ff225515e2b Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Wed, 19 Oct 2022 00:33:17 +0000 Subject: [PATCH 011/109] [cron] Bump distribution date (2022-10-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 f8efc0c0e8..794d5def4c 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-10-18" +//#define STRING_DISTRIBUTION_DATE "2022-10-19" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index ae9c65955e..b348d0cfac 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-10-18" + #define STRING_DISTRIBUTION_DATE "2022-10-19" #endif /** From e49c3dc0889f1a6b597701ceb69624bdf4365445 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 19 Oct 2022 00:45:35 -0500 Subject: [PATCH 012/109] =?UTF-8?q?=F0=9F=A9=B9=20Polargraph=20followup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix issue from #24847 --- Marlin/src/module/settings.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 95836a5f3a..cb8fe217e9 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -319,7 +319,7 @@ typedef struct SettingsDataStruct { #endif // - // Kinematic Settings + // Kinematic Settings (Delta, SCARA, TPARA, Polargraph...) // #if IS_KINEMATIC float segments_per_second; // M665 S @@ -992,7 +992,7 @@ void MarlinSettings::postprocess() { } // - // Kinematic Settings + // Kinematic Settings (Delta, SCARA, TPARA, Polargraph...) // #if IS_KINEMATIC { @@ -1444,14 +1444,6 @@ void MarlinSettings::postprocess() { _FIELD_TEST(planner_skew_factor); EEPROM_WRITE(planner.skew_factor); - // - // POLARGRAPH - // - #if ENABLED(POLARGRAPH) - _FIELD_TEST(polargraph_max_belt_len); - EEPROM_WRITE(polargraph_max_belt_len); - #endif - // // Advanced Pause filament load & unload lengths // @@ -1940,7 +1932,7 @@ void MarlinSettings::postprocess() { } // - // Kinematic Segments-per-second + // Kinematic Settings (Delta, SCARA, TPARA, Polargraph...) // #if IS_KINEMATIC { @@ -3001,7 +2993,7 @@ void MarlinSettings::reset() { #endif // - // Kinematic settings + // Kinematic Settings (Delta, SCARA, TPARA, Polargraph...) // #if IS_KINEMATIC From 4b279ac3008b35e8cfb257ba3d7dcdbe05a9d38d Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Thu, 20 Oct 2022 00:30:52 +0000 Subject: [PATCH 013/109] [cron] Bump distribution date (2022-10-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 794d5def4c..5b0f010226 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-10-19" +//#define STRING_DISTRIBUTION_DATE "2022-10-20" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index b348d0cfac..2d776134d6 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-10-19" + #define STRING_DISTRIBUTION_DATE "2022-10-20" #endif /** From 437cc484707cba8f8da5898bf7274e2254989cbe Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Thu, 20 Oct 2022 14:29:15 +1300 Subject: [PATCH 014/109] =?UTF-8?q?=F0=9F=94=A7=20No=20Native=20USB=20on?= =?UTF-8?q?=20AVR=20(#24906)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/AVR/HAL.h | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Marlin/src/HAL/AVR/HAL.h b/Marlin/src/HAL/AVR/HAL.h index 1491867721..d458790979 100644 --- a/Marlin/src/HAL/AVR/HAL.h +++ b/Marlin/src/HAL/AVR/HAL.h @@ -32,6 +32,7 @@ #include #else #include "MarlinSerial.h" + #define BOARD_NO_NATIVE_USB #endif #include @@ -106,36 +107,36 @@ typedef Servo hal_servo_t; #define MYSERIAL1 TERN(BLUETOOTH, btSerial, MSerial0) #else - #if !WITHIN(SERIAL_PORT, -1, 3) - #error "SERIAL_PORT must be from 0 to 3, or -1 for USB Serial." + #if !WITHIN(SERIAL_PORT, 0, 3) + #error "SERIAL_PORT must be from 0 to 3." #endif #define MYSERIAL1 customizedSerial1 #ifdef SERIAL_PORT_2 - #if !WITHIN(SERIAL_PORT_2, -1, 3) - #error "SERIAL_PORT_2 must be from 0 to 3, or -1 for USB Serial." + #if !WITHIN(SERIAL_PORT_2, 0, 3) + #error "SERIAL_PORT_2 must be from 0 to 3." #endif #define MYSERIAL2 customizedSerial2 #endif #ifdef SERIAL_PORT_3 - #if !WITHIN(SERIAL_PORT_3, -1, 3) - #error "SERIAL_PORT_3 must be from 0 to 3, or -1 for USB Serial." + #if !WITHIN(SERIAL_PORT_3, 0, 3) + #error "SERIAL_PORT_3 must be from 0 to 3." #endif #define MYSERIAL3 customizedSerial3 #endif #endif #ifdef MMU2_SERIAL_PORT - #if !WITHIN(MMU2_SERIAL_PORT, -1, 3) - #error "MMU2_SERIAL_PORT must be from 0 to 3, or -1 for USB Serial." + #if !WITHIN(MMU2_SERIAL_PORT, 0, 3) + #error "MMU2_SERIAL_PORT must be from 0 to 3" #endif #define MMU2_SERIAL mmuSerial #endif #ifdef LCD_SERIAL_PORT - #if !WITHIN(LCD_SERIAL_PORT, -1, 3) - #error "LCD_SERIAL_PORT must be from 0 to 3, or -1 for USB Serial." + #if !WITHIN(LCD_SERIAL_PORT, 0, 3) + #error "LCD_SERIAL_PORT must be from 0 to 3." #endif #define LCD_SERIAL lcdSerial #if HAS_DGUS_LCD From 7e25ef945676f148b54ed0fa159e858ec5b958ec Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Wed, 19 Oct 2022 18:32:12 -0700 Subject: [PATCH 015/109] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20Fix=20a=20label=20?= =?UTF-8?q?(#24903)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to e298266eff --- Marlin/src/HAL/STM32/eeprom_flash.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/HAL/STM32/eeprom_flash.cpp b/Marlin/src/HAL/STM32/eeprom_flash.cpp index 78db07c6c0..6bd519877d 100644 --- a/Marlin/src/HAL/STM32/eeprom_flash.cpp +++ b/Marlin/src/HAL/STM32/eeprom_flash.cpp @@ -221,7 +221,7 @@ bool PersistentStore::access_finish() { return success; - #else !FLASH_EEPROM_LEVELING + #else // !FLASH_EEPROM_LEVELING // The following was written for the STM32F4 but may work with other MCUs as well. // Most STM32F4 flash does not allow reading from flash during erase operations. From b244785141f518202060467bf39717192728c65d Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Wed, 19 Oct 2022 21:36:39 -0400 Subject: [PATCH 016/109] =?UTF-8?q?=F0=9F=90=9B=20Fix=20Print=20Timer=20st?= =?UTF-8?q?op=20with=20MarlinUI=20abort=20(#24902)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/marlinui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index b1827534b5..c885e83845 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -1630,7 +1630,7 @@ void MarlinUI::init() { #ifdef ACTION_ON_CANCEL hostui.cancel(); #endif - IF_DISABLED(SDSUPPORT, print_job_timer.stop()); + print_job_timer.stop(); TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_open(PROMPT_INFO, F("UI Aborted"), FPSTR(DISMISS_STR))); LCD_MESSAGE(MSG_PRINT_ABORTED); TERN_(HAS_MARLINUI_MENU, return_to_status()); From 9be1554faf486cec71742e82e1312d233162e31e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 19 Oct 2022 21:00:14 -0500 Subject: [PATCH 017/109] =?UTF-8?q?=F0=9F=8E=A8=20Misc.=20variant=20cleanu?= =?UTF-8?q?p,=20translation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #24787 --- .../MARLIN_F446Zx_TRONXY/hal_conf_custom.h | 2 +- .../variants/MARLIN_F446Zx_TRONXY/variant.cpp | 102 +++++++++--------- .../variants/MARLIN_F446Zx_TRONXY/variant.h | 5 +- .../MARLIN_MKS_SKIPR_V1/PeripheralPins.c | 4 +- .../variants/MARLIN_MKS_SKIPR_V1/variant.h | 2 +- 5 files changed, 57 insertions(+), 58 deletions(-) diff --git a/buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/hal_conf_custom.h b/buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/hal_conf_custom.h index e077592245..c23d30ce88 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/hal_conf_custom.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/hal_conf_custom.h @@ -411,7 +411,7 @@ in voltage and temperature. */ #endif /* HAL_SPI_MODULE_ENABLED */ #ifdef HAL_TIM_MODULE_ENABLED -#include "stm32f4xx_hal_tim.h" +#include "stm32f4xx_hal_tim.h" #endif /* HAL_TIM_MODULE_ENABLED */ #ifdef HAL_UART_MODULE_ENABLED diff --git a/buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/variant.cpp b/buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/variant.cpp index 807b9392eb..2d94ee763a 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/variant.cpp +++ b/buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/variant.cpp @@ -170,69 +170,69 @@ extern "C" { #endif uint32_t myvar[] = {1,2,3,4,5,6,7,8}; -void myshow(int fre,int times)//YSZ-WORK +void myshow(int fre, int times) // YSZ-WORK { uint32_t index = 10; - RCC->AHB1ENR |= 1 << 6;//端口G时钟 - GPIOG->MODER &= ~(3UL << 2 * index);//清除旧模式 - GPIOG->MODER |= 1 << 2 * index;//模式为输出 - GPIOG->OSPEEDR &= ~(3UL << 2 * index); //清除旧输出速度 - GPIOG->OSPEEDR |= 2 << 2 * index;//设置输出速度 - GPIOG->OTYPER &= ~(1UL << index);//清除旧输出方式 - GPIOG->OTYPER |= 0 << index;//设置输出方式为推挽 - GPIOG->PUPDR &= ~(3 << 2 * index);//先清除原来的设置 - GPIOG->PUPDR |= 1 << 2 * index;//设置新的上下拉 - while(times != 0) { + RCC->AHB1ENR |= 1 << 6; // port G clock + GPIOG->MODER &= ~(3UL << 2 * index); // clear old mode + GPIOG->MODER |= 1 << 2 * index; // mode is output + GPIOG->OSPEEDR &= ~(3UL << 2 * index) // Clear old output speed + GPIOG->OSPEEDR |= 2 << 2 * index; // Set output speed + GPIOG->OTYPER &= ~(1UL << index) // clear old output + GPIOG->OTYPER |= 0 << index; // Set the output mode to push-pull + GPIOG->PUPDR &= ~(3 << 2 * index) // Clear the original settings first + GPIOG->PUPDR |= 1 << 2 * index; // Set new up and down + while (times != 0) { GPIOG->BSRR = 1UL << index; - for(int i = 0;i < fre; i++) - for(int j = 0; j < 1000000; j++)__NOP(); + for (int i = 0; i < fre; i++) + for (int j = 0; j < 1000000; j++) __NOP(); GPIOG->BSRR = 1UL << (index + 16); - for(int i = 0;i < fre; i++) - for(int j = 0; j < 1000000; j++)__NOP(); - if(times > 0)times--; + for (int i = 0; i < fre; i++) + for (int j = 0; j < 1000000; j++) __NOP(); + if (times > 0) times--; } } HAL_StatusTypeDef SDMMC_IsProgramming(SDIO_TypeDef *SDIOx,uint32_t RCA) { HAL_SD_CardStateTypeDef CardState; - volatile uint32_t respR1 = 0, status = 0; - SDIO_CmdInitTypeDef sdmmc_cmdinit; + volatile uint32_t respR1 = 0, status = 0; + SDIO_CmdInitTypeDef sdmmc_cmdinit; do { sdmmc_cmdinit.Argument = RCA << 16; sdmmc_cmdinit.CmdIndex = SDMMC_CMD_SEND_STATUS; sdmmc_cmdinit.Response = SDIO_RESPONSE_SHORT; sdmmc_cmdinit.WaitForInterrupt = SDIO_WAIT_NO; sdmmc_cmdinit.CPSM = SDIO_CPSM_ENABLE; - SDIO_SendCommand(SDIOx,&sdmmc_cmdinit);//发送CMD13 + SDIO_SendCommand(SDIOx,&sdmmc_cmdinit); // send CMD13 do status = SDIOx->STA; - while(!(status & ((1 << 0) | (1 << 6) | (1 << 2))));//等待操作完成 - if(status & (1 << 0)) //CRC检测失败 - { - SDIOx->ICR |= 1 << 0; //清除错误标记 + while (!(status & ((1 << 0) | (1 << 6) | (1 << 2)))); // wait for the operation to complete + if (status & (1 << 0)) { // CRC check failed + SDIOx->ICR |= 1 << 0; // clear error flag return HAL_ERROR; } - if(status & (1 << 2)) //命令超时 - { - SDIOx->ICR |= 1 << 2; //清除错误标记 + if (status & (1 << 2)) { // command timed out + SDIOx->ICR |= 1 << 2; // clear error flag return HAL_ERROR; } - if(SDIOx->RESPCMD != SDMMC_CMD_SEND_STATUS)return HAL_ERROR; - SDIOx->ICR = 0X5FF; //清除所有标记 + if (SDIOx->RESPCMD != SDMMC_CMD_SEND_STATUS) return HAL_ERROR; + SDIOx->ICR = 0X5FF; // clear all tags respR1 = SDIOx->RESP1; CardState = (respR1 >> 9) & 0x0000000F; - }while((CardState == HAL_SD_CARD_RECEIVING) || (CardState == HAL_SD_CARD_SENDING) || (CardState == HAL_SD_CARD_PROGRAMMING)); + } while ((CardState == HAL_SD_CARD_RECEIVING) || (CardState == HAL_SD_CARD_SENDING) || (CardState == HAL_SD_CARD_PROGRAMMING)); return HAL_OK; } -void debugStr(const char*str) { - while(*str) { - while((USART1->SR & 0x40) == 0); - USART1->DR = *str++; - } + +void debugStr(const char *str) { + while (*str) { + while ((USART1->SR & 0x40) == 0); + USART1->DR = *str++; + } } + /** * @brief System Clock Configuration - * The system Clock is configured as follow : + * The system Clock is configured as follows: * System Clock source = PLL (HSE) * SYSCLK(Hz) = 168000000/120000000/180000000 * HCLK(Hz) = 168000000/120000000/180000000 @@ -265,8 +265,8 @@ WEAK void SystemClock_Config(void) /* Enable Power Control clock */ __HAL_RCC_PWR_CLK_ENABLE(); - /* The voltage scaling allows optimizing the power consumption when the device is - clocked below the maximum system frequency, to update the voltage scaling value + /* The voltage scaling allows optimizing the power consumption when the device is + clocked below the maximum system frequency, to update the voltage scaling value regarding system frequency refer to product datasheet. */ __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); @@ -281,42 +281,40 @@ WEAK void SystemClock_Config(void) RCC_OscInitStruct.PLL.PLLQ = 7; RCC_OscInitStruct.PLL.PLLR = 2; ret = HAL_RCC_OscConfig(&RCC_OscInitStruct); - - if(ret != HAL_OK)myshow(10,-1); + + if (ret != HAL_OK) myshow(10,-1); HAL_PWREx_EnableOverDrive(); - + /* Select PLLSAI output as USB clock source */ PeriphClkInitStruct.PLLSAI.PLLSAIM = 8; PeriphClkInitStruct.PLLSAI.PLLSAIN = 192; PeriphClkInitStruct.PLLSAI.PLLSAIP = RCC_PLLSAIP_DIV4; PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_CLK48 | RCC_PERIPHCLK_SDIO; PeriphClkInitStruct.Clk48ClockSelection = RCC_CK48CLKSOURCE_PLLSAIP; - PeriphClkInitStruct.SdioClockSelection = RCC_SDIOCLKSOURCE_CLK48;//SDIO Clock Mux + PeriphClkInitStruct.SdioClockSelection = RCC_SDIOCLKSOURCE_CLK48; // SDIO Clock Mux HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct); - /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 - clocks dividers */ + /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 clocks dividers */ RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2); RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; - RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4; - RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2; + RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4; + RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2; ret = HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5); - if(ret != HAL_OK)myshow(10,-1); + if (ret != HAL_OK) myshow(10,-1); - SystemCoreClockUpdate();//更新系统时钟SystemCoreClock - /**Configure the Systick interrupt time - */ + SystemCoreClockUpdate(); + /* Configure the Systick interrupt time */ HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000); - /**Configure the Systick - */ + /* Configure the Systick */ HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK); /* SysTick_IRQn interrupt configuration */ HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0); - __enable_irq();//打开中断,因为在bootloader中关闭了,所以这里要打开 + __enable_irq(); // Turn on the interrupt here because it is turned off in the bootloader } + #ifdef __cplusplus } #endif diff --git a/buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/variant.h index 29649de938..082be9403e 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/variant.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/variant.h @@ -24,8 +24,9 @@ extern "C" { #endif // __cplusplus extern unsigned long myvar[]; -void myshow(int fre,int times); -void debugStr(const char*str); +void myshow(int fre, int times); +void debugStr(const char *str); + /*---------------------------------------------------------------------------- * Pins *----------------------------------------------------------------------------*/ diff --git a/buildroot/share/PlatformIO/variants/MARLIN_MKS_SKIPR_V1/PeripheralPins.c b/buildroot/share/PlatformIO/variants/MARLIN_MKS_SKIPR_V1/PeripheralPins.c index 640fbdbe13..11f5cc5afc 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_MKS_SKIPR_V1/PeripheralPins.c +++ b/buildroot/share/PlatformIO/variants/MARLIN_MKS_SKIPR_V1/PeripheralPins.c @@ -76,8 +76,8 @@ WEAK const PinMap PinMap_PWM[] = { {PA_0, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 Fan2 {PA_1, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 Fan1 {PA_2, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 3, 0)}, // TIM5_CH3 Fan0 - {PA_3, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 4, 0)}, // TIM5_CH4 HE2 - {PA_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1 Servo + {PA_3, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 4, 0)}, // TIM5_CH4 HE2 + {PA_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1 Servo {PB_0, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N HE1 {PB_1, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N HE0 {PB_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 BEEPER diff --git a/buildroot/share/PlatformIO/variants/MARLIN_MKS_SKIPR_V1/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_MKS_SKIPR_V1/variant.h index dcc8c49395..51a9e92286 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_MKS_SKIPR_V1/variant.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_MKS_SKIPR_V1/variant.h @@ -32,7 +32,7 @@ #ifdef __cplusplus extern "C" { #endif // __cplusplus -// +// /*---------------------------------------------------------------------------- * Pins *----------------------------------------------------------------------------*/ From 42d30ed102308f0c5cb04b70dc55f9f37012a157 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Thu, 20 Oct 2022 15:23:22 +1300 Subject: [PATCH 018/109] =?UTF-8?q?=F0=9F=94=A7=20Some=20STM32=20UART=20Sa?= =?UTF-8?q?nity=20Checks=20(#24795)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 2 +- Marlin/src/HAL/AVR/inc/SanityCheck.h | 16 +++-- Marlin/src/HAL/STM32/inc/SanityCheck.h | 59 +++++++++++++++++ Marlin/src/inc/Conditionals_post.h | 10 +-- Marlin/src/pins/pinsDebug_list.h | 74 ++++++++++++++++++++++ Marlin/src/pins/stm32f1/pins_CREALITY_V4.h | 55 +++++++++++----- 6 files changed, 187 insertions(+), 29 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 4a60ec6139..47b42aa8dd 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1152,7 +1152,7 @@ #endif /** - * Automatic backlash, position and hotend offset calibration + * Automatic backlash, position, and hotend offset calibration * * Enable G425 to run automatic calibration using an electrically- * conductive cube, bolt, or washer mounted on the bed. diff --git a/Marlin/src/HAL/AVR/inc/SanityCheck.h b/Marlin/src/HAL/AVR/inc/SanityCheck.h index 411b0198f1..ff1610f741 100644 --- a/Marlin/src/HAL/AVR/inc/SanityCheck.h +++ b/Marlin/src/HAL/AVR/inc/SanityCheck.h @@ -40,13 +40,15 @@ #if SERIAL_IN_USE(0) // D0-D1. No known conflicts. #endif -#if NOT_TARGET(__AVR_ATmega644P__, __AVR_ATmega1284P__) - #if SERIAL_IN_USE(1) && (CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19)) - #error "Serial Port 1 pin D18 and/or D19 conflicts with another pin on the board." - #endif -#else - #if SERIAL_IN_USE(1) && (CHECK_SERIAL_PIN(10) || CHECK_SERIAL_PIN(11)) - #error "Serial Port 1 pin D10 and/or D11 conflicts with another pin on the board." +#if SERIAL_IN_USE(1) + #if NOT_TARGET(__AVR_ATmega644P__, __AVR_ATmega1284P__) + #if CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19) + #error "Serial Port 1 pin D18 and/or D19 conflicts with another pin on the board." + #endif + #else + #if CHECK_SERIAL_PIN(10) || CHECK_SERIAL_PIN(11) + #error "Serial Port 1 pin D10 and/or D11 conflicts with another pin on the board." + #endif #endif #endif #if SERIAL_IN_USE(2) && (CHECK_SERIAL_PIN(16) || CHECK_SERIAL_PIN(17)) diff --git a/Marlin/src/HAL/STM32/inc/SanityCheck.h b/Marlin/src/HAL/STM32/inc/SanityCheck.h index a440695a06..e8ddfa1720 100644 --- a/Marlin/src/HAL/STM32/inc/SanityCheck.h +++ b/Marlin/src/HAL/STM32/inc/SanityCheck.h @@ -50,3 +50,62 @@ #if ANY(TFT_COLOR_UI, TFT_LVGL_UI, TFT_CLASSIC_UI) && NOT_TARGET(STM32H7xx, STM32F4xx, STM32F1xx) #error "TFT_COLOR_UI, TFT_LVGL_UI and TFT_CLASSIC_UI are currently only supported on STM32H7, STM32F4 and STM32F1 hardware." #endif + +/** + * Check for common serial pin conflicts + */ +#define _CHECK_SERIAL_PIN(N) (( \ + BTN_EN1 == N || DOGLCD_CS == N || HEATER_BED_PIN == N || FAN_PIN == N || \ + SDIO_D2_PIN == N || SDIO_D3_PIN == N || SDIO_CK_PIN == N || SDIO_CMD_PIN == N \ + )) +#define CHECK_SERIAL_PIN(T,N) defined(UART##N##_##T##_PIN) && _CHECK_SERIAL_PIN(UART##N##_##T##_PIN) +#if SERIAL_IN_USE(1) + #if CHECK_SERIAL_PIN(TX,1) + #error "Serial Port 1 TX IO pins conflict with another pin on the board." + #endif + #if CHECK_SERIAL_PIN(RX,1) + #error "Serial Port 1 RX IO pins conflict with another pin on the board." + #endif +#endif +#if SERIAL_IN_USE(2) + #if CHECK_SERIAL_PIN(TX,2) + #error "Serial Port 2 TX IO pins conflict with another pin on the board." + #endif + #if CHECK_SERIAL_PIN(RX,2) + #error "Serial Port 2 RX IO pins conflict with another pin on the board." + #endif +#endif +#if SERIAL_IN_USE(3) + #if CHECK_SERIAL_PIN(TX,3) + #error "Serial Port 3 TX IO pins conflict with another pin on the board." + #endif + #if CHECK_SERIAL_PIN(RX,3) + #error "Serial Port 3 RX IO pins conflict with another pin on the board." + #endif +#endif +#if SERIAL_IN_USE(4) + #if CHECK_SERIAL_PIN(TX,4) + #error "Serial Port 4 TX IO pins conflict with another pin on the board." + #endif + #if CHECK_SERIAL_PIN(RX,4) + #error "Serial Port 4 RX IO pins conflict with another pin on the board." + #endif +#endif +#if SERIAL_IN_USE(5) + #if CHECK_SERIAL_PIN(TX,5) + #error "Serial Port 5 TX IO pins conflict with another pin on the board." + #endif + #if CHECK_SERIAL_PIN(RX,5) + #error "Serial Port 5 RX IO pins conflict with another pin on the board." + #endif +#endif +#if SERIAL_IN_USE(6) + #if CHECK_SERIAL_PIN(TX,6) + #error "Serial Port 6 TX IO pins conflict with another pin on the board." + #endif + #if CHECK_SERIAL_PIN(RX,6) + #error "Serial Port 6 RX IO pins conflict with another pin on the board." + #endif +#endif +#undef CHECK_SERIAL_PIN +#undef _CHECK_SERIAL_PIN diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index bb9a1ac640..417ce4479a 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -2446,11 +2446,11 @@ // // Flag the indexed hardware serial ports in use -#define SERIAL_IN_USE(N) ( (defined(SERIAL_PORT) && SERIAL_PORT == N) \ - || (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == N) \ - || (defined(SERIAL_PORT_3) && SERIAL_PORT_3 == N) \ - || (defined(MMU2_SERIAL_PORT) && MMU2_SERIAL_PORT == N) \ - || (defined(LCD_SERIAL_PORT) && LCD_SERIAL_PORT == N) ) +#define SERIAL_IN_USE(N) ( (defined(SERIAL_PORT) && N == SERIAL_PORT) \ + || (defined(SERIAL_PORT_2) && N == SERIAL_PORT_2) \ + || (defined(SERIAL_PORT_3) && N == SERIAL_PORT_3) \ + || (defined(MMU2_SERIAL_PORT) && N == MMU2_SERIAL_PORT) \ + || (defined(LCD_SERIAL_PORT) && N == LCD_SERIAL_PORT) ) // Flag the named hardware serial ports in use #define TMC_UART_IS(A,N) (defined(A##_HARDWARE_SERIAL) && (CAT(HW_,A##_HARDWARE_SERIAL) == HW_Serial##N || CAT(HW_,A##_HARDWARE_SERIAL) == HW_MSerial##N)) diff --git a/Marlin/src/pins/pinsDebug_list.h b/Marlin/src/pins/pinsDebug_list.h index 2cd54ecf18..077c94a60f 100644 --- a/Marlin/src/pins/pinsDebug_list.h +++ b/Marlin/src/pins/pinsDebug_list.h @@ -2231,6 +2231,80 @@ REPORT_NAME_DIGITAL(__LINE__, TFT_RESET_PIN) #endif +// +// Hardware UART +// +#if SERIAL_IN_USE(1) + #if PIN_EXISTS(UART1_TX) + REPORT_NAME_DIGITAL(__LINE__, UART1_TX_PIN) + #endif + #if PIN_EXISTS(UART1_RX) + REPORT_NAME_DIGITAL(__LINE__, UART1_RX_PIN) + #endif +#endif +#if SERIAL_IN_USE(2) + #if PIN_EXISTS(UART2_TX) + REPORT_NAME_DIGITAL(__LINE__, UART2_TX_PIN) + #endif + #if PIN_EXISTS(UART2_RX) + REPORT_NAME_DIGITAL(__LINE__, UART2_RX_PIN) + #endif +#endif +#if SERIAL_IN_USE(3) + #if PIN_EXISTS(UART3_TX) + REPORT_NAME_DIGITAL(__LINE__, UART3_TX_PIN) + #endif + #if PIN_EXISTS(UART3_RX) + REPORT_NAME_DIGITAL(__LINE__, UART3_RX_PIN) + #endif +#endif +#if SERIAL_IN_USE(4) + #if PIN_EXISTS(UART4_TX) + REPORT_NAME_DIGITAL(__LINE__, UART4_TX_PIN) + #endif + #if PIN_EXISTS(UART4_RX) + REPORT_NAME_DIGITAL(__LINE__, UART4_RX_PIN) + #endif +#endif +#if SERIAL_IN_USE(5) + #if PIN_EXISTS(UART5_TX) + REPORT_NAME_DIGITAL(__LINE__, UART5_TX_PIN) + #endif + #if PIN_EXISTS(UART5_RX) + REPORT_NAME_DIGITAL(__LINE__, UART5_RX_PIN) + #endif +#endif +#if SERIAL_IN_USE(6) + #if PIN_EXISTS(UART6_TX) + REPORT_NAME_DIGITAL(__LINE__, UART6_TX_PIN) + #endif + #if PIN_EXISTS(UART6_RX) + REPORT_NAME_DIGITAL(__LINE__, UART6_RX_PIN) + #endif +#endif + +// +// SDIO +// +#if PIN_EXISTS(SDIO_D0) + REPORT_NAME_DIGITAL(__LINE__, SDIO_D0_PIN) +#endif +#if PIN_EXISTS(SDIO_D1) + REPORT_NAME_DIGITAL(__LINE__, SDIO_D1_PIN) +#endif +#if PIN_EXISTS(SDIO_D2) + REPORT_NAME_DIGITAL(__LINE__, SDIO_D2_PIN) +#endif +#if PIN_EXISTS(SDIO_D3) + REPORT_NAME_DIGITAL(__LINE__, SDIO_D3_PIN) +#endif +#if PIN_EXISTS(SDIO_CK) + REPORT_NAME_DIGITAL(__LINE__, SDIO_CK_PIN) +#endif +#if PIN_EXISTS(SDIO_CMD) + REPORT_NAME_DIGITAL(__LINE__, SDIO_CMD_PIN) +#endif + // // Miscellaneous // diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h index 11384799a3..f633ee0983 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h @@ -173,14 +173,14 @@ * GND | 9 10 | 5V * ------ */ - #define EXP3_01_PIN PC6 - #define EXP3_02_PIN PB2 - #define EXP3_03_PIN PB10 - #define EXP3_04_PIN PB11 - #define EXP3_05_PIN PB14 - #define EXP3_06_PIN PB13 - #define EXP3_07_PIN PB12 - #define EXP3_08_PIN PB15 + #define EXP3_01_PIN PC6 + #define EXP3_02_PIN PB2 + #define EXP3_03_PIN PB10 + #define EXP3_04_PIN PB11 + #define EXP3_05_PIN PB14 + #define EXP3_06_PIN PB13 + #define EXP3_07_PIN PB12 + #define EXP3_08_PIN PB15 #elif EITHER(VET6_12864_LCD, DWIN_VET6_CREALITY_LCD) @@ -194,14 +194,14 @@ * GND | 9 10 | 5V * ------ */ - #define EXP3_01_PIN -1 - #define EXP3_02_PIN PC5 - #define EXP3_03_PIN PB10 - #define EXP3_04_PIN -1 - #define EXP3_05_PIN PA6 - #define EXP3_06_PIN PA5 - #define EXP3_07_PIN PA4 - #define EXP3_08_PIN PA7 + #define EXP3_01_PIN -1 + #define EXP3_02_PIN PC5 + #define EXP3_03_PIN PB10 + #define EXP3_04_PIN -1 + #define EXP3_05_PIN PA6 + #define EXP3_06_PIN PA5 + #define EXP3_07_PIN PA4 + #define EXP3_08_PIN PA7 #elif EITHER(CR10_STOCKDISPLAY, FYSETC_MINI_12864_2_1) #error "Define RET6_12864_LCD or VET6_12864_LCD to select pins for the LCD with the Creality V4 controller." @@ -283,3 +283,26 @@ #define NEOPIXEL_PIN PA13 #endif + +// Pins for documentation and sanity checks only. +// Changing these will not change the pin they are on. + +// Hardware UART pins +#define UART1_TX_PIN PA9 // default uses CH340 RX +#define UART1_RX_PIN PA10 // default uses CH340 TX +#define UART2_TX_PIN PA2 // default uses HEATER_BED_PIN +#define UART2_RX_PIN PA3 // not connected +#define UART3_TX_PIN PB10 // default uses LCD connector +#define UART3_RX_PIN PB11 // default uses LCD connector +#define UART4_TX_PIN PC10 // default uses sdcard SDIO_D2 +#define UART4_RX_PIN PC11 // default uses sdcard SDIO_D3 +#define UART5_TX_PIN PC12 // default uses sdcard SDIO_CK +#define UART5_RX_PIN PD2 // default uses sdcard SDIO_CMD + +// SDIO pins +#define SDIO_D0_PIN PC8 +#define SDIO_D1_PIN PC9 +#define SDIO_D2_PIN PC10 +#define SDIO_D3_PIN PC11 +#define SDIO_CK_PIN PC12 +#define SDIO_CMD_PIN PD2 From 70b3166715903aebc015362c7a96ac52cee4f2ed Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 21 Oct 2022 00:28:49 +0000 Subject: [PATCH 019/109] [cron] Bump distribution date (2022-10-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 5b0f010226..dae6ae3368 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-10-20" +//#define STRING_DISTRIBUTION_DATE "2022-10-21" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 2d776134d6..510641cf1d 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-10-20" + #define STRING_DISTRIBUTION_DATE "2022-10-21" #endif /** From 86aac677ac8f90536d895b3d33effa4ab65495be Mon Sep 17 00:00:00 2001 From: silycr <32662182+silycr@users.noreply.github.com> Date: Sat, 22 Oct 2022 04:31:46 +1030 Subject: [PATCH 020/109] =?UTF-8?q?=F0=9F=9A=B8=20Probe=20pins=20for=20Chi?= =?UTF-8?q?tu=20V5=20(#24910)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/stm32f1/pins_CHITU3D_V5.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Marlin/src/pins/stm32f1/pins_CHITU3D_V5.h b/Marlin/src/pins/stm32f1/pins_CHITU3D_V5.h index 53b6797e91..f4cecc21c2 100644 --- a/Marlin/src/pins/stm32f1/pins_CHITU3D_V5.h +++ b/Marlin/src/pins/stm32f1/pins_CHITU3D_V5.h @@ -23,6 +23,14 @@ #define BOARD_INFO_NAME "Chitu3D V5" -#define Z_STOP_PIN PA14 +// +// Servos +// +#define SERVO0_PIN PA13 // Z+ (behind FILAMENT) Pinout [+5v|G|S] + +// +// Limit Switches +// +#define Z_STOP_PIN PA14 // Pinout [+12/24v|G|S] #include "pins_CHITU3D_common.h" From 02c43f44c73b76c8d8d1e48b8e595ced62da2459 Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Fri, 21 Oct 2022 14:03:38 -0400 Subject: [PATCH 021/109] =?UTF-8?q?=E2=9C=A8=20Controllerfan=20PWM=20scali?= =?UTF-8?q?ng,=20kickstart=20(#24873)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 12 ++++++++---- Marlin/src/feature/controllerfan.cpp | 16 ++++++++++++++++ Marlin/src/inc/Conditionals_adv.h | 11 +++++++++++ Marlin/src/inc/SanityCheck.h | 5 +++++ Marlin/src/module/planner.cpp | 16 +++++----------- Marlin/src/module/temperature.cpp | 14 +++++++------- Marlin/src/module/tool_change.cpp | 2 +- 7 files changed, 53 insertions(+), 23 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 47b42aa8dd..085c5379a9 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -552,10 +552,14 @@ #endif #endif -// When first starting the main fan, run it at full speed for the -// given number of milliseconds. This gets the fan spinning reliably -// before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) -//#define FAN_KICKSTART_TIME 100 +/** + * Fan Kickstart + * When part cooling or controller fans first start, run at a speed that + * gets it spinning reliably for a short time before setting the requested speed. + * (Does not work on Sanguinololu with FAN_SOFT_PWM.) + */ +//#define FAN_KICKSTART_TIME 100 // (ms) +//#define FAN_KICKSTART_POWER 180 // 64-255 // Some coolers may require a non-zero "off" state. //#define FAN_OFF_PWM 1 diff --git a/Marlin/src/feature/controllerfan.cpp b/Marlin/src/feature/controllerfan.cpp index f42bf52ae4..2f25832cdc 100644 --- a/Marlin/src/feature/controllerfan.cpp +++ b/Marlin/src/feature/controllerfan.cpp @@ -72,6 +72,22 @@ void ControllerFan::update() { ? settings.active_speed : settings.idle_speed ); + speed = CALC_FAN_SPEED(speed); + + #if FAN_KICKSTART_TIME + static millis_t fan_kick_end = 0; + if (speed > FAN_OFF_PWM) { + if (!fan_kick_end) { + fan_kick_end = ms + FAN_KICKSTART_TIME; // May be longer based on slow update interval for controller fn check. Sets minimum + speed = FAN_KICKSTART_POWER; + } + else if (PENDING(ms, fan_kick_end)) + speed = FAN_KICKSTART_POWER; + } + else + fan_kick_end = 0; + #endif + #if ENABLED(FAN_SOFT_PWM) thermalManager.soft_pwm_controller_speed = speed; #else diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index ba8c3587fe..27185400f9 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -1074,3 +1074,14 @@ #if ANY(DISABLE_INACTIVE_X, DISABLE_INACTIVE_Y, DISABLE_INACTIVE_Z, DISABLE_INACTIVE_I, DISABLE_INACTIVE_J, DISABLE_INACTIVE_K, DISABLE_INACTIVE_U, DISABLE_INACTIVE_V, DISABLE_INACTIVE_W, DISABLE_INACTIVE_E) #define HAS_DISABLE_INACTIVE_AXIS 1 #endif + +// Fan Kickstart +#if FAN_KICKSTART_TIME && !defined(FAN_KICKSTART_POWER) + #define FAN_KICKSTART_POWER 180 +#endif + +#if FAN_MIN_PWM == 0 && FAN_MAX_PWM == 255 + #define CALC_FAN_SPEED(f) (f ?: FAN_OFF_PWM) +#else + #define CALC_FAN_SPEED(f) (f ? map(f, 1, 255, FAN_MIN_PWM, FAN_MAX_PWM) : FAN_OFF_PWM) +#endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 02d798543c..679463798a 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1513,6 +1513,11 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "To use BED_LIMIT_SWITCHING you must disable PIDTEMPBED." #endif +// Fan Kickstart +#if FAN_KICKSTART_TIME && defined(FAN_KICKSTART_POWER) && !WITHIN(FAN_KICKSTART_POWER, 64, 255) + #error "FAN_KICKSTART_POWER must be an integer from 64 to 255." +#endif + /** * Synchronous M106/M107 checks */ diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 91a994470a..3263e7660a 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1282,16 +1282,10 @@ void Planner::recalculate(TERN_(HINTS_SAFE_EXIT_SPEED, const_float_t safe_exit_s void Planner::sync_fan_speeds(uint8_t (&fan_speed)[FAN_COUNT]) { - #if FAN_MIN_PWM != 0 || FAN_MAX_PWM != 255 - #define CALC_FAN_SPEED(f) (fan_speed[f] ? map(fan_speed[f], 1, 255, FAN_MIN_PWM, FAN_MAX_PWM) : FAN_OFF_PWM) - #else - #define CALC_FAN_SPEED(f) (fan_speed[f] ?: FAN_OFF_PWM) - #endif - #if ENABLED(FAN_SOFT_PWM) - #define _FAN_SET(F) thermalManager.soft_pwm_amount_fan[F] = CALC_FAN_SPEED(F); + #define _FAN_SET(F) thermalManager.soft_pwm_amount_fan[F] = CALC_FAN_SPEED(fan_speed[F]); #else - #define _FAN_SET(F) hal.set_pwm_duty(pin_t(FAN##F##_PIN), CALC_FAN_SPEED(F)); + #define _FAN_SET(F) hal.set_pwm_duty(pin_t(FAN##F##_PIN), CALC_FAN_SPEED(fan_speed[F])); #endif #define FAN_SET(F) do{ kickstart_fan(fan_speed, ms, F); _FAN_SET(F); }while(0) @@ -1306,13 +1300,13 @@ void Planner::recalculate(TERN_(HINTS_SAFE_EXIT_SPEED, const_float_t safe_exit_s void Planner::kickstart_fan(uint8_t (&fan_speed)[FAN_COUNT], const millis_t &ms, const uint8_t f) { static millis_t fan_kick_end[FAN_COUNT] = { 0 }; - if (fan_speed[f]) { + if (fan_speed[f] > FAN_OFF_PWM) { if (fan_kick_end[f] == 0) { fan_kick_end[f] = ms + FAN_KICKSTART_TIME; - fan_speed[f] = 255; + fan_speed[f] = FAN_KICKSTART_POWER; } else if (PENDING(ms, fan_kick_end[f])) - fan_speed[f] = 255; + fan_speed[f] = FAN_KICKSTART_POWER; } else fan_kick_end[f] = 0; diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 349264606a..7515396fbe 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -306,19 +306,19 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED); #endif #if EITHER(AUTO_POWER_E_FANS, HAS_FANCHECK) - uint8_t Temperature::autofan_speed[HOTENDS]; // = { 0 } + uint8_t Temperature::autofan_speed[HOTENDS] = ARRAY_N_1(HOTENDS, FAN_OFF_PWM); #endif #if ENABLED(AUTO_POWER_CHAMBER_FAN) - uint8_t Temperature::chamberfan_speed; // = 0 + uint8_t Temperature::chamberfan_speed = FAN_OFF_PWM; #endif #if ENABLED(AUTO_POWER_COOLER_FAN) - uint8_t Temperature::coolerfan_speed; // = 0 + uint8_t Temperature::coolerfan_speed = FAN_OFF_PWM; #endif #if BOTH(FAN_SOFT_PWM, USE_CONTROLLER_FAN) - uint8_t Temperature::soft_pwm_controller_speed; + uint8_t Temperature::soft_pwm_controller_speed = FAN_OFF_PWM; #endif // Init fans according to whether they're native PWM or Software PWM @@ -342,11 +342,11 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED); // HAS_FAN does not include CONTROLLER_FAN #if HAS_FAN - uint8_t Temperature::fan_speed[FAN_COUNT]; // = { 0 } + uint8_t Temperature::fan_speed[FAN_COUNT] = ARRAY_N_1(FAN_COUNT, FAN_OFF_PWM); #if ENABLED(EXTRA_FAN_SPEED) - Temperature::extra_fan_t Temperature::extra_fan_speed[FAN_COUNT]; + Temperature::extra_fan_t Temperature::extra_fan_speed[FAN_COUNT] = ARRAY_N_1(FAN_COUNT, FAN_OFF_PWM); /** * Handle the M106 P T command: @@ -373,7 +373,7 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED); #if EITHER(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE) bool Temperature::fans_paused; // = false; - uint8_t Temperature::saved_fan_speed[FAN_COUNT]; // = { 0 } + uint8_t Temperature::saved_fan_speed[FAN_COUNT] = ARRAY_N_1(FAN_COUNT, FAN_OFF_PWM); #endif #if ENABLED(ADAPTIVE_FAN_SLOWING) diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index 4eb72a5b7d..80aedd3bdd 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -917,7 +917,7 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0. #if HAS_FAN && TOOLCHANGE_FS_FAN >= 0 thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = toolchange_settings.fan_speed; gcode.dwell(SEC_TO_MS(toolchange_settings.fan_time)); - thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = 0; + thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = FAN_OFF_PWM; #endif } From f8d7090e30ca679c5bce6a16c1350b15b52ba50b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 21 Oct 2022 15:41:51 -0500 Subject: [PATCH 022/109] =?UTF-8?q?=F0=9F=94=A8=20gcc-12=20for=20macOS=20n?= =?UTF-8?q?ative?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ini/native.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ini/native.ini b/ini/native.ini index 1905559fd0..15a4d36af8 100644 --- a/ini/native.ini +++ b/ini/native.ini @@ -66,11 +66,11 @@ build_flags = ${simulator_linux.build_flags} ${simulator_linux.release_flags} # # MacPorts: -# sudo port install gcc11 glm libsdl2 libsdl2_net +# sudo port install gcc12 glm libsdl2 libsdl2_net # # cd /opt/local/bin # sudo rm -f gcc g++ cc -# sudo ln -s gcc-mp-11 gcc ; sudo ln -s g++-mp-11 g++ ; sudo ln -s g++ cc +# sudo ln -s gcc-mp-12 gcc ; sudo ln -s g++-mp-12 g++ ; sudo ln -s g++ cc # cd - # rehash # From a460b01c876ff39901fe55a4b66b2c62737ef46c Mon Sep 17 00:00:00 2001 From: tombrazier <68918209+tombrazier@users.noreply.github.com> Date: Fri, 21 Oct 2022 22:34:22 +0100 Subject: [PATCH 023/109] =?UTF-8?q?=F0=9F=9A=80=20ZV=20Input=20Shaping=20(?= =?UTF-8?q?#24797)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 29 ++ .../src/gcode/feature/input_shaping/M593.cpp | 83 ++++++ Marlin/src/gcode/gcode.cpp | 4 + Marlin/src/gcode/gcode.h | 6 + Marlin/src/inc/Conditionals_adv.h | 14 + Marlin/src/inc/SanityCheck.h | 35 ++- Marlin/src/lcd/language/language_en.h | 5 + Marlin/src/lcd/menu/menu_advanced.cpp | 41 ++- Marlin/src/module/planner.cpp | 8 + Marlin/src/module/settings.cpp | 66 +++++ Marlin/src/module/stepper.cpp | 269 +++++++++++++++--- Marlin/src/module/stepper.h | 135 ++++++++- buildroot/tests/mega2560 | 2 +- ini/features.ini | 1 + platformio.ini | 1 + 15 files changed, 657 insertions(+), 42 deletions(-) create mode 100644 Marlin/src/gcode/feature/input_shaping/M593.cpp diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 085c5379a9..01a2bd85c5 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1055,6 +1055,35 @@ // @section motion +/** + * Input Shaping -- EXPERIMENTAL + * + * Zero Vibration (ZV) Input Shaping for X and/or Y movements. + * + * This option uses a lot of SRAM for the step buffer, which is proportional + * to the largest step rate possible for any axis. If the build fails due to + * low SRAM the buffer size may be reduced by setting smaller values for + * DEFAULT_AXIS_STEPS_PER_UNIT and/or DEFAULT_MAX_FEEDRATE. Runtime editing + * of max feedrate (M203) or resonant frequency (M593) may result feedrate + * being capped to prevent buffer overruns. + * + * Tune with M593 D F: + * + * D Set the zeta/damping factor. If axes (X, Y, etc.) are not specified, set for all axes. + * F Set the frequency. If axes (X, Y, etc.) are not specified, set for all axes. + * T[map] Input Shaping type, 0:ZV, 1:EI, 2:2H EI (not implemented yet) + * X<1> Set the given parameters only for the X axis. + * Y<1> Set the given parameters only for the Y axis. + */ +//#define INPUT_SHAPING +#if ENABLED(INPUT_SHAPING) + #define SHAPING_FREQ_X 40 // (Hz) The dominant resonant frequency of the X axis. + #define SHAPING_FREQ_Y 40 // (Hz) The dominant resonant frequency of the Y axis. + #define SHAPING_ZETA_X 0.3f // Damping ratio of the X axis (range: 0.0 = no damping to 1.0 = critical damping). + #define SHAPING_ZETA_Y 0.3f // Damping ratio of the Y axis (range: 0.0 = no damping to 1.0 = critical damping). + //#define SHAPING_MENU // Add a menu to the LCD to set shaping parameters. +#endif + #define AXIS_RELATIVE_MODES { false, false, false, false } // Add a Duplicate option for well-separated conjoined nozzles diff --git a/Marlin/src/gcode/feature/input_shaping/M593.cpp b/Marlin/src/gcode/feature/input_shaping/M593.cpp new file mode 100644 index 0000000000..84301963cb --- /dev/null +++ b/Marlin/src/gcode/feature/input_shaping/M593.cpp @@ -0,0 +1,83 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "../../../inc/MarlinConfig.h" + +#if ENABLED(INPUT_SHAPING) + +#include "../../gcode.h" +#include "../../../module/stepper.h" + +void GcodeSuite::M593_report(const bool forReplay/*=true*/) { + report_heading_etc(forReplay, F("Input Shaping")); + #if HAS_SHAPING_X + SERIAL_ECHO_MSG("M593 X" + " F", stepper.get_shaping_frequency(X_AXIS), + " D", stepper.get_shaping_damping_ratio(X_AXIS) + ); + #endif + #if HAS_SHAPING_Y + SERIAL_ECHO_MSG("M593 Y" + " F", stepper.get_shaping_frequency(Y_AXIS), + " D", stepper.get_shaping_damping_ratio(Y_AXIS) + ); + #endif +} + +/** + * M593: Get or Set Input Shaping Parameters + * D Set the zeta/damping factor. If axes (X, Y, etc.) are not specified, set for all axes. + * F Set the frequency. If axes (X, Y, etc.) are not specified, set for all axes. + * T[map] Input Shaping type, 0:ZV, 1:EI, 2:2H EI (not implemented yet) + * X<1> Set the given parameters only for the X axis. + * Y<1> Set the given parameters only for the Y axis. + */ +void GcodeSuite::M593() { + if (!parser.seen_any()) return M593_report(); + + const bool seen_X = TERN0(HAS_SHAPING_X, parser.seen_test('X')), + seen_Y = TERN0(HAS_SHAPING_Y, parser.seen_test('Y')), + for_X = seen_X || TERN0(HAS_SHAPING_X, (!seen_X && !seen_Y)), + for_Y = seen_Y || TERN0(HAS_SHAPING_Y, (!seen_X && !seen_Y)); + + if (parser.seen('D')) { + const float zeta = parser.value_float(); + if (WITHIN(zeta, 0, 1)) { + if (for_X) stepper.set_shaping_damping_ratio(X_AXIS, zeta); + if (for_Y) stepper.set_shaping_damping_ratio(Y_AXIS, zeta); + } + else + SERIAL_ECHO_MSG("?Zeta (D) value out of range (0-1)"); + } + + if (parser.seen('F')) { + const float freq = parser.value_float(); + if (freq > 0) { + if (for_X) stepper.set_shaping_frequency(X_AXIS, freq); + if (for_Y) stepper.set_shaping_frequency(Y_AXIS, freq); + } + else + SERIAL_ECHO_MSG("?Frequency (F) must be greater than 0"); + } +} + +#endif diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 0667ef0b7b..ff066ed678 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -933,6 +933,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 575: M575(); break; // M575: Set serial baudrate #endif + #if ENABLED(INPUT_SHAPING) + case 593: M593(); break; // M593: Set Input Shaping parameters + #endif + #if ENABLED(ADVANCED_PAUSE_FEATURE) case 600: M600(); break; // M600: Pause for Filament Change case 603: M603(); break; // M603: Configure Filament Change diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index e2506e4ed9..0ce8ab3902 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -259,6 +259,7 @@ * M554 - Get or set IP gateway. (Requires enabled Ethernet port) * M569 - Enable stealthChop on an axis. (Requires at least one _DRIVER_TYPE to be TMC2130/2160/2208/2209/5130/5160) * M575 - Change the serial baud rate. (Requires BAUD_RATE_GCODE) + * M593 - Get or set input shaping parameters. (Requires INPUT_SHAPING) * M600 - Pause for filament change: "M600 X Y Z E L". (Requires ADVANCED_PAUSE_FEATURE) * M603 - Configure filament change: "M603 T U L". (Requires ADVANCED_PAUSE_FEATURE) * M605 - Set Dual X-Carriage movement mode: "M605 S [X] [R]". (Requires DUAL_X_CARRIAGE) @@ -1080,6 +1081,11 @@ private: static void M575(); #endif + #if ENABLED(INPUT_SHAPING) + static void M593(); + static void M593_report(const bool forReplay=true); + #endif + #if ENABLED(ADVANCED_PAUSE_FEATURE) static void M600(); static void M603(); diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 27185400f9..1f8f0ddfb6 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -1085,3 +1085,17 @@ #else #define CALC_FAN_SPEED(f) (f ? map(f, 1, 255, FAN_MIN_PWM, FAN_MAX_PWM) : FAN_OFF_PWM) #endif + +// Input shaping +#if ENABLED(INPUT_SHAPING) + #if !HAS_Y_AXIS + #undef SHAPING_FREQ_Y + #undef SHAPING_BUFFER_Y + #endif + #ifdef SHAPING_FREQ_X + #define HAS_SHAPING_X 1 + #endif + #ifdef SHAPING_FREQ_Y + #define HAS_SHAPING_Y 1 + #endif +#endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 679463798a..06b8f32946 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -4238,11 +4238,6 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive."); #endif #endif -// Misc. Cleanup -#undef _TEST_PWM -#undef _NUM_AXES_STR -#undef _LOGICAL_AXES_STR - // JTAG support in the HAL #if ENABLED(DISABLE_DEBUG) && !defined(JTAGSWD_DISABLE) #error "DISABLE_DEBUG is not supported for the selected MCU/Board." @@ -4254,3 +4249,33 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive."); #if ENABLED(XFER_BUILD) && !BOTH(BINARY_FILE_TRANSFER, CUSTOM_FIRMWARE_UPLOAD) #error "BINARY_FILE_TRANSFER and CUSTOM_FIRMWARE_UPLOAD are required for custom upload." #endif + +// Check requirements for Input Shaping +#if ENABLED(INPUT_SHAPING) && defined(__AVR__) + #if HAS_SHAPING_X + #if F_CPU > 16000000 + static_assert((SHAPING_FREQ_X) * 2 * 0x10000 >= (STEPPER_TIMER_RATE), "SHAPING_FREQ_X is below the minimum (20) for AVR 20MHz."); + #else + static_assert((SHAPING_FREQ_X) * 2 * 0x10000 >= (STEPPER_TIMER_RATE), "SHAPING_FREQ_X is below the minimum (16) for AVR 16MHz."); + #endif + #elif HAS_SHAPING_Y + #if F_CPU > 16000000 + static_assert((SHAPING_FREQ_Y) * 2 * 0x10000 >= (STEPPER_TIMER_RATE), "SHAPING_FREQ_Y is below the minimum (20) for AVR 20MHz."); + #else + static_assert((SHAPING_FREQ_Y) * 2 * 0x10000 >= (STEPPER_TIMER_RATE), "SHAPING_FREQ_Y is below the minimum (16) for AVR 16MHz."); + #endif + #endif +#endif + +#if ENABLED(INPUT_SHAPING) + #if ENABLED(DIRECT_STEPPING) + #error "INPUT_SHAPING cannot currently be used with DIRECT_STEPPING." + #elif ENABLED(LASER_FEATURE) + #error "INPUT_SHAPING cannot currently be used with LASER_FEATURE." + #endif +#endif + +// Misc. Cleanup +#undef _TEST_PWM +#undef _NUM_AXES_STR +#undef _LOGICAL_AXES_STR diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index e4f8ef8fb7..c888207ed1 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -399,6 +399,11 @@ namespace Language_en { LSTR MSG_AMAX_EN = _UxGT("Max * Accel"); LSTR MSG_A_RETRACT = _UxGT("Retract Accel"); LSTR MSG_A_TRAVEL = _UxGT("Travel Accel"); + LSTR MSG_INPUT_SHAPING = _UxGT("Input Shaping"); + LSTR MSG_SHAPING_X_FREQ = STR_X _UxGT(" frequency"); + LSTR MSG_SHAPING_Y_FREQ = STR_Y _UxGT(" frequency"); + LSTR MSG_SHAPING_X_ZETA = STR_X _UxGT(" damping"); + LSTR MSG_SHAPING_Y_ZETA = STR_Y _UxGT(" damping"); LSTR MSG_XY_FREQUENCY_LIMIT = _UxGT("XY Freq Limit"); LSTR MSG_XY_FREQUENCY_FEEDRATE = _UxGT("Min FR Factor"); LSTR MSG_STEPS_PER_MM = _UxGT("Steps/mm"); diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 5978a8ec1a..9d6d79efd7 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -31,6 +31,7 @@ #include "menu_item.h" #include "../../MarlinCore.h" #include "../../module/planner.h" +#include "../../module/stepper.h" #if DISABLED(NO_VOLUMETRICS) #include "../../gcode/parser.h" @@ -80,8 +81,6 @@ void menu_backlash(); #if HAS_MOTOR_CURRENT_PWM - #include "../../module/stepper.h" - void menu_pwm() { START_MENU(); BACK_ITEM(MSG_ADVANCED_SETTINGS); @@ -538,6 +537,39 @@ void menu_backlash(); END_MENU(); } + #if ENABLED(SHAPING_MENU) + + void menu_advanced_input_shaping() { + constexpr float min_frequency = TERN(__AVR__, float(STEPPER_TIMER_RATE) / 2 / 0x10000, 1.0f); + + START_MENU(); + BACK_ITEM(MSG_ADVANCED_SETTINGS); + + // M593 F Frequency + #if HAS_SHAPING_X + editable.decimal = stepper.get_shaping_frequency(X_AXIS); + EDIT_ITEM_FAST(float61, MSG_SHAPING_X_FREQ, &editable.decimal, min_frequency, 200.0f, []{ stepper.set_shaping_frequency(X_AXIS, editable.decimal); }); + #endif + #if HAS_SHAPING_Y + editable.decimal = stepper.get_shaping_frequency(Y_AXIS); + EDIT_ITEM_FAST(float61, MSG_SHAPING_Y_FREQ, &editable.decimal, min_frequency, 200.0f, []{ stepper.set_shaping_frequency(Y_AXIS, editable.decimal); }); + #endif + + // M593 D Damping ratio + #if HAS_SHAPING_X + editable.decimal = stepper.get_shaping_damping_ratio(X_AXIS); + EDIT_ITEM_FAST(float42_52, MSG_SHAPING_X_ZETA, &editable.decimal, 0.0f, 1.0f, []{ stepper.set_shaping_damping_ratio(X_AXIS, editable.decimal); }); + #endif + #if HAS_SHAPING_Y + editable.decimal = stepper.get_shaping_damping_ratio(Y_AXIS); + EDIT_ITEM_FAST(float42_52, MSG_SHAPING_Y_ZETA, &editable.decimal, 0.0f, 1.0f, []{ stepper.set_shaping_damping_ratio(Y_AXIS, editable.decimal); }); + #endif + + END_MENU(); + } + + #endif + #if HAS_CLASSIC_JERK void menu_advanced_jerk() { @@ -657,6 +689,11 @@ void menu_advanced_settings() { // M201 - Acceleration items SUBMENU(MSG_ACCELERATION, menu_advanced_acceleration); + // M593 - Acceleration items + #if ENABLED(SHAPING_MENU) + SUBMENU(MSG_INPUT_SHAPING, menu_advanced_input_shaping); + #endif + #if HAS_CLASSIC_JERK // M205 - Max Jerk SUBMENU(MSG_JERK, menu_advanced_jerk); diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 3263e7660a..dce9160664 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -2483,6 +2483,14 @@ bool Planner::_populate_block( #endif // XY_FREQUENCY_LIMIT + #if ENABLED(INPUT_SHAPING) + const float top_freq = _MIN(float(0x7FFFFFFFL) + OPTARG(HAS_SHAPING_X, stepper.get_shaping_frequency(X_AXIS)) + OPTARG(HAS_SHAPING_Y, stepper.get_shaping_frequency(Y_AXIS))), + max_factor = (top_freq * float(shaping_dividends - 3) * 2.0f) / block->nominal_rate; + NOMORE(speed_factor, max_factor); + #endif + // Correct the speed if (speed_factor < 1.0f) { current_speed *= speed_factor; diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index cb8fe217e9..f76b5afe74 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -577,6 +577,18 @@ typedef struct SettingsDataStruct { MPC_t mpc_constants[HOTENDS]; // M306 #endif + // + // Input Shaping + // + #if HAS_SHAPING_X + float shaping_x_frequency, // M593 X F + shaping_x_zeta; // M593 X D + #endif + #if HAS_SHAPING_Y + float shaping_y_frequency, // M593 Y F + shaping_y_zeta; // M593 Y D + #endif + } SettingsData; //static_assert(sizeof(SettingsData) <= MARLIN_EEPROM_SIZE, "EEPROM too small to contain SettingsData!"); @@ -1602,6 +1614,20 @@ void MarlinSettings::postprocess() { EEPROM_WRITE(thermalManager.temp_hotend[e].constants); #endif + // + // Input Shaping + /// + #if ENABLED(INPUT_SHAPING) + #if HAS_SHAPING_X + EEPROM_WRITE(stepper.get_shaping_frequency(X_AXIS)); + EEPROM_WRITE(stepper.get_shaping_damping_ratio(X_AXIS)); + #endif + #if HAS_SHAPING_Y + EEPROM_WRITE(stepper.get_shaping_frequency(Y_AXIS)); + EEPROM_WRITE(stepper.get_shaping_damping_ratio(Y_AXIS)); + #endif + #endif + // // Report final CRC and Data Size // @@ -2573,6 +2599,27 @@ void MarlinSettings::postprocess() { } #endif + // + // Input Shaping + // + #if HAS_SHAPING_X + { + float _data[2]; + EEPROM_READ(_data); + stepper.set_shaping_frequency(X_AXIS, _data[0]); + stepper.set_shaping_damping_ratio(X_AXIS, _data[1]); + } + #endif + + #if HAS_SHAPING_Y + { + float _data[2]; + EEPROM_READ(_data); + stepper.set_shaping_frequency(Y_AXIS, _data[0]); + stepper.set_shaping_damping_ratio(Y_AXIS, _data[1]); + } + #endif + // // Validate Final Size and CRC // @@ -3343,6 +3390,20 @@ void MarlinSettings::reset() { } #endif + // + // Input Shaping + // + #if ENABLED(INPUT_SHAPING) + #if HAS_SHAPING_X + stepper.set_shaping_frequency(X_AXIS, SHAPING_FREQ_X); + stepper.set_shaping_damping_ratio(X_AXIS, SHAPING_ZETA_X); + #endif + #if HAS_SHAPING_Y + stepper.set_shaping_frequency(Y_AXIS, SHAPING_FREQ_Y); + stepper.set_shaping_damping_ratio(Y_AXIS, SHAPING_ZETA_Y); + #endif + #endif + postprocess(); #if EITHER(EEPROM_CHITCHAT, DEBUG_LEVELING_FEATURE) @@ -3590,6 +3651,11 @@ void MarlinSettings::reset() { // TERN_(HAS_STEALTHCHOP, gcode.M569_report(forReplay)); + // + // Input Shaping + // + TERN_(INPUT_SHAPING, gcode.M593_report(forReplay)); + // // Linear Advance // diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 4ee4c1d1a7..6cc40ccece 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -199,7 +199,7 @@ IF_DISABLED(ADAPTIVE_STEP_SMOOTHING, constexpr) uint8_t Stepper::oversampling_fa xyze_long_t Stepper::delta_error{0}; -xyze_ulong_t Stepper::advance_dividend{0}; +xyze_long_t Stepper::advance_dividend{0}; uint32_t Stepper::advance_divisor = 0, Stepper::step_events_completed = 0, // The number of step events executed in the current block Stepper::accelerate_until, // The count at which to stop accelerating @@ -232,6 +232,20 @@ uint32_t Stepper::advance_divisor = 0, Stepper::la_advance_steps = 0; #endif +#if ENABLED(INPUT_SHAPING) + shaping_time_t DelayTimeManager::now = 0; + ParamDelayQueue Stepper::shaping_dividend_queue; + DelayQueue Stepper::shaping_queue; + #if HAS_SHAPING_X + shaping_time_t DelayTimeManager::delay_x; + ShapeParams Stepper::shaping_x; + #endif + #if HAS_SHAPING_Y + shaping_time_t DelayTimeManager::delay_y; + ShapeParams Stepper::shaping_y; + #endif +#endif + #if ENABLED(INTEGRATED_BABYSTEPPING) uint32_t Stepper::nextBabystepISR = BABYSTEP_NEVER; #endif @@ -458,12 +472,10 @@ xyze_int8_t Stepper::count_direction{0}; #define PULSE_LOW_TICK_COUNT hal_timer_t(NS_TO_PULSE_TIMER_TICKS(_MIN_PULSE_LOW_NS - _MIN(_MIN_PULSE_LOW_NS, TIMER_SETUP_NS))) #define USING_TIMED_PULSE() hal_timer_t start_pulse_count = 0 -#define START_TIMED_PULSE(DIR) (start_pulse_count = HAL_timer_get_count(MF_TIMER_PULSE)) -#define AWAIT_TIMED_PULSE(DIR) while (PULSE_##DIR##_TICK_COUNT > HAL_timer_get_count(MF_TIMER_PULSE) - start_pulse_count) { } -#define START_HIGH_PULSE() START_TIMED_PULSE(HIGH) -#define AWAIT_HIGH_PULSE() AWAIT_TIMED_PULSE(HIGH) -#define START_LOW_PULSE() START_TIMED_PULSE(LOW) -#define AWAIT_LOW_PULSE() AWAIT_TIMED_PULSE(LOW) +#define START_TIMED_PULSE() (start_pulse_count = HAL_timer_get_count(MF_TIMER_PULSE)) +#define AWAIT_TIMED_PULSE(DIR) while (PULSE_##DIR##_TICK_COUNT > HAL_timer_get_count(MF_TIMER_PULSE) - start_pulse_count) { /* nada */ } +#define AWAIT_HIGH_PULSE() AWAIT_TIMED_PULSE(HIGH) +#define AWAIT_LOW_PULSE() AWAIT_TIMED_PULSE(LOW) #if MINIMUM_STEPPER_PRE_DIR_DELAY > 0 #define DIR_WAIT_BEFORE() DELAY_NS(MINIMUM_STEPPER_PRE_DIR_DELAY) @@ -559,6 +571,16 @@ void Stepper::disable_all_steppers() { TERN_(EXTENSIBLE_UI, ExtUI::onSteppersDisabled()); } +#define SET_STEP_DIR(A) \ + if (motor_direction(_AXIS(A))) { \ + A##_APPLY_DIR(INVERT_##A##_DIR, false); \ + count_direction[_AXIS(A)] = -1; \ + } \ + else { \ + A##_APPLY_DIR(!INVERT_##A##_DIR, false); \ + count_direction[_AXIS(A)] = 1; \ + } + /** * Set the stepper direction of each axis * @@ -570,16 +592,6 @@ void Stepper::set_directions() { DIR_WAIT_BEFORE(); - #define SET_STEP_DIR(A) \ - if (motor_direction(_AXIS(A))) { \ - A##_APPLY_DIR(INVERT_##A##_DIR, false); \ - count_direction[_AXIS(A)] = -1; \ - } \ - else { \ - A##_APPLY_DIR(!INVERT_##A##_DIR, false); \ - count_direction[_AXIS(A)] = 1; \ - } - TERN_(HAS_X_DIR, SET_STEP_DIR(X)); // A TERN_(HAS_Y_DIR, SET_STEP_DIR(Y)); // B TERN_(HAS_Z_DIR, SET_STEP_DIR(Z)); // C @@ -1467,8 +1479,20 @@ void Stepper::isr() { // Enable ISRs to reduce USART processing latency hal.isr_on(); + #if ENABLED(INPUT_SHAPING) + // Speed limiting should ensure the buffers never get full. But if somehow they do, stutter rather than overflow. + if (!nextMainISR) { + TERN_(HAS_SHAPING_X, if (shaping_dividend_queue.free_count_x() == 0) nextMainISR = shaping_dividend_queue.peek_x() + 1); + TERN_(HAS_SHAPING_Y, if (shaping_dividend_queue.free_count_y() == 0) NOLESS(nextMainISR, shaping_dividend_queue.peek_y() + 1)); + TERN_(HAS_SHAPING_X, if (shaping_queue.free_count_x() < steps_per_isr) NOLESS(nextMainISR, shaping_queue.peek_x() + 1)); + TERN_(HAS_SHAPING_Y, if (shaping_queue.free_count_y() < steps_per_isr) NOLESS(nextMainISR, shaping_queue.peek_y() + 1)); + } + #endif + if (!nextMainISR) pulse_phase_isr(); // 0 = Do coordinated axes Stepper pulses + TERN_(INPUT_SHAPING, shaping_isr()); // Do Shaper stepping, if needed + #if ENABLED(LIN_ADVANCE) if (!nextAdvanceISR) { // 0 = Do Linear Advance E Stepper pulses advance_isr(); @@ -1497,10 +1521,14 @@ void Stepper::isr() { // Get the interval to the next ISR call const uint32_t interval = _MIN( - uint32_t(HAL_TIMER_TYPE_MAX), // Come back in a very long time - nextMainISR // Time until the next Pulse / Block phase - OPTARG(LIN_ADVANCE, nextAdvanceISR) // Come back early for Linear Advance? - OPTARG(INTEGRATED_BABYSTEPPING, nextBabystepISR) // Come back early for Babystepping? + uint32_t(HAL_TIMER_TYPE_MAX), // Come back in a very long time + nextMainISR // Time until the next Pulse / Block phase + OPTARG(HAS_SHAPING_X, shaping_dividend_queue.peek_x()) // Time until next input shaping dividend change for X + OPTARG(HAS_SHAPING_Y, shaping_dividend_queue.peek_y()) // Time until next input shaping dividend change for Y + OPTARG(HAS_SHAPING_X, shaping_queue.peek_x()) // Time until next input shaping echo for X + OPTARG(HAS_SHAPING_Y, shaping_queue.peek_y()) // Time until next input shaping echo for Y + OPTARG(LIN_ADVANCE, nextAdvanceISR) // Come back early for Linear Advance? + OPTARG(INTEGRATED_BABYSTEPPING, nextBabystepISR) // Come back early for Babystepping? ); // @@ -1512,6 +1540,8 @@ void Stepper::isr() { nextMainISR -= interval; + TERN_(INPUT_SHAPING, DelayTimeManager::decrement_delays(interval)); + #if ENABLED(LIN_ADVANCE) if (nextAdvanceISR != LA_ADV_NEVER) nextAdvanceISR -= interval; #endif @@ -1604,11 +1634,19 @@ void Stepper::pulse_phase_isr() { // If we must abort the current block, do so! if (abort_current_block) { abort_current_block = false; - if (current_block) discard_current_block(); + if (current_block) { + discard_current_block(); + #if ENABLED(INPUT_SHAPING) + shaping_dividend_queue.purge(); + shaping_queue.purge(); + TERN_(HAS_SHAPING_X, delta_error.x = 0); + TERN_(HAS_SHAPING_Y, delta_error.y = 0); + #endif + } } // If there is no current block, do nothing - if (!current_block) return; + if (!current_block || step_events_completed >= step_event_count) return; // Skipping step processing causes motion to freeze if (TERN0(FREEZE_FEATURE, frozen)) return; @@ -1627,6 +1665,9 @@ void Stepper::pulse_phase_isr() { #endif xyze_bool_t step_needed{0}; + // Direct Stepping page? + const bool is_page = current_block->is_page(); + do { #define _APPLY_STEP(AXIS, INV, ALWAYS) AXIS ##_APPLY_STEP(INV, ALWAYS) #define _INVERT_STEP_PIN(AXIS) INVERT_## AXIS ##_STEP_PIN @@ -1641,6 +1682,22 @@ void Stepper::pulse_phase_isr() { } \ }while(0) + #define PULSE_PREP_SHAPING(AXIS, DIVIDEND) do{ \ + delta_error[_AXIS(AXIS)] += (DIVIDEND); \ + if ((MAXDIR(AXIS) && delta_error[_AXIS(AXIS)] <= -0x30000000L) || (MINDIR(AXIS) && delta_error[_AXIS(AXIS)] >= 0x30000000L)) { \ + TBI(last_direction_bits, _AXIS(AXIS)); \ + DIR_WAIT_BEFORE(); \ + SET_STEP_DIR(AXIS); \ + DIR_WAIT_AFTER(); \ + } \ + step_needed[_AXIS(AXIS)] = (MAXDIR(AXIS) && delta_error[_AXIS(AXIS)] >= 0x10000000L) || \ + (MINDIR(AXIS) && delta_error[_AXIS(AXIS)] <= -0x10000000L); \ + if (step_needed[_AXIS(AXIS)]) { \ + count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \ + delta_error[_AXIS(AXIS)] += MAXDIR(AXIS) ? -0x20000000L : 0x20000000L; \ + } \ + }while(0) + // Start an active pulse if needed #define PULSE_START(AXIS) do{ \ if (step_needed[_AXIS(AXIS)]) { \ @@ -1655,9 +1712,6 @@ void Stepper::pulse_phase_isr() { } \ }while(0) - // Direct Stepping page? - const bool is_page = current_block->is_page(); - #if ENABLED(DIRECT_STEPPING) // Direct stepping is currently not ready for HAS_I_AXIS if (is_page) { @@ -1765,12 +1819,22 @@ void Stepper::pulse_phase_isr() { #endif // DIRECT_STEPPING if (!is_page) { + TERN_(INPUT_SHAPING, shaping_queue.enqueue()); + // Determine if pulses are needed #if HAS_X_STEP - PULSE_PREP(X); + #if HAS_SHAPING_X + PULSE_PREP_SHAPING(X, advance_dividend.x); + #else + PULSE_PREP(X); + #endif #endif #if HAS_Y_STEP - PULSE_PREP(Y); + #if HAS_SHAPING_Y + PULSE_PREP_SHAPING(Y, advance_dividend.y); + #else + PULSE_PREP(Y); + #endif #endif #if HAS_Z_STEP PULSE_PREP(Z); @@ -1855,7 +1919,7 @@ void Stepper::pulse_phase_isr() { // TODO: need to deal with MINIMUM_STEPPER_PULSE over i2s #if ISR_MULTI_STEPS - START_HIGH_PULSE(); + START_TIMED_PULSE(); AWAIT_HIGH_PULSE(); #endif @@ -1895,12 +1959,62 @@ void Stepper::pulse_phase_isr() { #endif #if ISR_MULTI_STEPS - if (events_to_do) START_LOW_PULSE(); + if (events_to_do) START_TIMED_PULSE(); #endif } while (--events_to_do); } +#if ENABLED(INPUT_SHAPING) + + void Stepper::shaping_isr() { + xyze_bool_t step_needed{0}; + + const bool shapex = TERN0(HAS_SHAPING_X, !shaping_queue.peek_x()), + shapey = TERN0(HAS_SHAPING_Y, !shaping_queue.peek_y()); + + #if HAS_SHAPING_X + if (!shaping_dividend_queue.peek_x()) shaping_x.dividend = shaping_dividend_queue.dequeue_x(); + #endif + #if HAS_SHAPING_Y + if (!shaping_dividend_queue.peek_y()) shaping_y.dividend = shaping_dividend_queue.dequeue_y(); + #endif + + #if HAS_SHAPING_X + if (shapex) { + shaping_queue.dequeue_x(); + PULSE_PREP_SHAPING(X, shaping_x.dividend); + PULSE_START(X); + } + #endif + + #if HAS_SHAPING_Y + if (shapey) { + shaping_queue.dequeue_y(); + PULSE_PREP_SHAPING(Y, shaping_y.dividend); + PULSE_START(Y); + } + #endif + + TERN_(I2S_STEPPER_STREAM, i2s_push_sample()); + + if (shapex || shapey) { + #if ISR_MULTI_STEPS + USING_TIMED_PULSE(); + START_TIMED_PULSE(); + AWAIT_HIGH_PULSE(); + #endif + #if HAS_SHAPING_X + if (shapex) PULSE_STOP(X); + #endif + #if HAS_SHAPING_Y + if (shapey) PULSE_STOP(Y); + #endif + } + } + +#endif // INPUT_SHAPING + // Calculate timer interval, with all limits applied. uint32_t Stepper::calc_timer_interval(uint32_t step_rate) { #ifdef CPU_32_BIT @@ -2365,12 +2479,56 @@ uint32_t Stepper::block_phase_isr() { step_event_count = current_block->step_event_count << oversampling; // Initialize Bresenham delta errors to 1/2 + #if HAS_SHAPING_X + const int32_t old_delta_error_x = delta_error.x; + #endif + #if HAS_SHAPING_Y + const int32_t old_delta_error_y = delta_error.y; + #endif delta_error = TERN_(LIN_ADVANCE, la_delta_error =) -int32_t(step_event_count); // Calculate Bresenham dividends and divisors - advance_dividend = current_block->steps << 1; + advance_dividend = (current_block->steps << 1).asLong(); advance_divisor = step_event_count << 1; + // for input shaped axes, advance_divisor is replaced with 0x40000000 + // and steps are repeated twice so dividends have to be scaled and halved + // and the dividend is directional, i.e. signed + TERN_(HAS_SHAPING_X, advance_dividend.x = (uint64_t(current_block->steps.x) << 29) / step_event_count); + TERN_(HAS_SHAPING_X, if (TEST(current_block->direction_bits, X_AXIS)) advance_dividend.x *= -1); + TERN_(HAS_SHAPING_X, if (!shaping_queue.empty_x()) SET_BIT_TO(current_block->direction_bits, X_AXIS, TEST(last_direction_bits, X_AXIS))); + TERN_(HAS_SHAPING_Y, advance_dividend.y = (uint64_t(current_block->steps.y) << 29) / step_event_count); + TERN_(HAS_SHAPING_Y, if (TEST(current_block->direction_bits, Y_AXIS)) advance_dividend.y *= -1); + TERN_(HAS_SHAPING_Y, if (!shaping_queue.empty_y()) SET_BIT_TO(current_block->direction_bits, Y_AXIS, TEST(last_direction_bits, Y_AXIS))); + + // The scaling operation above introduces rounding errors which must now be removed. + // For this segment, there will be step_event_count calls to the Bresenham logic and the same number of echoes. + // For each pair of calls to the Bresenham logic, delta_error will increase by advance_dividend modulo 0x20000000 + // so (e.g. for x) delta_error.x will end up changing by (advance_dividend.x * step_event_count) % 0x20000000. + // For a divisor which is a power of 2, modulo is the same as as a bitmask, i.e. + // (advance_dividend.x * step_event_count) & 0x1FFFFFFF. + // This segment's final change in delta_error should actually be zero so we need to increase delta_error by + // 0 - ((advance_dividend.x * step_event_count) & 0x1FFFFFFF) + // And this needs to be adjusted to the range -0x10000000 to 0x10000000. + // Adding and subtracting 0x10000000 inside the outside the modulo achieves this. + TERN_(HAS_SHAPING_X, delta_error.x = old_delta_error_x + 0x10000000L - ((0x10000000L + advance_dividend.x * step_event_count) & 0x1FFFFFFFUL)); + TERN_(HAS_SHAPING_Y, delta_error.y = old_delta_error_y + 0x10000000L - ((0x10000000L + advance_dividend.y * step_event_count) & 0x1FFFFFFFUL)); + + // when there is damping, the signal and its echo have different amplitudes + #if ENABLED(HAS_SHAPING_X) + const int32_t echo_x = shaping_x.factor * (advance_dividend.x >> 7); + #endif + #if ENABLED(HAS_SHAPING_Y) + const int32_t echo_y = shaping_y.factor * (advance_dividend.y >> 7); + #endif + + // plan the change of values for advance_dividend for the input shaping echoes + TERN_(INPUT_SHAPING, shaping_dividend_queue.enqueue(TERN0(HAS_SHAPING_X, echo_x), TERN0(HAS_SHAPING_Y, echo_y))); + + // apply the adjustment to the primary signal + TERN_(HAS_SHAPING_X, advance_dividend.x -= echo_x); + TERN_(HAS_SHAPING_Y, advance_dividend.y -= echo_y); + // No step events completed so far step_events_completed = 0; @@ -2485,7 +2643,7 @@ uint32_t Stepper::block_phase_isr() { // Enforce a minimum duration for STEP pulse ON #if ISR_PULSE_CONTROL USING_TIMED_PULSE(); - START_HIGH_PULSE(); + START_TIMED_PULSE(); AWAIT_HIGH_PULSE(); #endif @@ -2816,6 +2974,51 @@ void Stepper::init() { #endif } +#if ENABLED(INPUT_SHAPING) + /** + * Calculate a fixed point factor to apply to the signal and its echo + * when shaping an axis. + */ + void Stepper::set_shaping_damping_ratio(const AxisEnum axis, const float zeta) { + // from the damping ratio, get a factor that can be applied to advance_dividend for fixed point maths + // for ZV, we use amplitudes 1/(1+K) and K/(1+K) where K = exp(-zeta * M_PI / sqrt(1.0f - zeta * zeta)) + // which can be converted to 1:7 fixed point with an excellent fit with a 3rd order polynomial + float shaping_factor; + if (zeta <= 0.0f) shaping_factor = 64.0f; + else if (zeta >= 1.0f) shaping_factor = 0.0f; + else { + shaping_factor = 64.44056192 + -99.02008832 * zeta; + const float zeta2 = zeta * zeta; + shaping_factor += -7.58095488 * zeta2; + const float zeta3 = zeta2 * zeta; + shaping_factor += 43.073216 * zeta3; + } + + const bool was_on = hal.isr_state(); + hal.isr_off(); + TERN_(HAS_SHAPING_X, if (axis == X_AXIS) { shaping_x.factor = floor(shaping_factor); shaping_x.zeta = zeta; }) + TERN_(HAS_SHAPING_Y, if (axis == Y_AXIS) { shaping_y.factor = floor(shaping_factor); shaping_y.zeta = zeta; }) + if (was_on) hal.isr_on(); + } + + float Stepper::get_shaping_damping_ratio(const AxisEnum axis) { + TERN_(HAS_SHAPING_X, if (axis == X_AXIS) return shaping_x.zeta); + TERN_(HAS_SHAPING_Y, if (axis == Y_AXIS) return shaping_y.zeta); + return -1; + } + + void Stepper::set_shaping_frequency(const AxisEnum axis, const float freq) { + TERN_(HAS_SHAPING_X, if (axis == X_AXIS) { DelayTimeManager::set_delay(axis, float(uint32_t(STEPPER_TIMER_RATE) / 2) / freq); shaping_x.frequency = freq; }) + TERN_(HAS_SHAPING_Y, if (axis == Y_AXIS) { DelayTimeManager::set_delay(axis, float(uint32_t(STEPPER_TIMER_RATE) / 2) / freq); shaping_y.frequency = freq; }) + } + + float Stepper::get_shaping_frequency(const AxisEnum axis) { + TERN_(HAS_SHAPING_X, if (axis == X_AXIS) return shaping_x.frequency); + TERN_(HAS_SHAPING_Y, if (axis == Y_AXIS) return shaping_y.frequency); + return -1; + } +#endif + /** * Set the stepper positions directly in steps * @@ -3021,7 +3224,7 @@ void Stepper::report_positions() { #if EXTRA_CYCLES_BABYSTEP > 20 #define _SAVE_START() const hal_timer_t pulse_start = HAL_timer_get_count(MF_TIMER_PULSE) - #define _PULSE_WAIT() while (EXTRA_CYCLES_BABYSTEP > (uint32_t)(HAL_timer_get_count(MF_TIMER_PULSE) - pulse_start) * (PULSE_TIMER_PRESCALE)) { /* nada */ } + #define _PULSE_WAIT() while (EXTRA_CYCLES_BABYSTEP > uint32_t(HAL_timer_get_count(MF_TIMER_PULSE) - pulse_start) * (PULSE_TIMER_PRESCALE)) { /* nada */ } #else #define _SAVE_START() NOOP #if EXTRA_CYCLES_BABYSTEP > 0 diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h index 729ab83266..5b634c52e4 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -312,6 +312,117 @@ constexpr ena_mask_t enable_overlap[] = { //static_assert(!any_enable_overlap(), "There is some overlap."); +#if ENABLED(INPUT_SHAPING) + + typedef IF::type shaping_time_t; + + // These constexpr are used to calculate the shaping queue buffer sizes + constexpr xyze_float_t max_feedrate = DEFAULT_MAX_FEEDRATE; + constexpr xyze_float_t steps_per_unit = DEFAULT_AXIS_STEPS_PER_UNIT; + constexpr float max_steprate = _MAX(LOGICAL_AXIS_LIST( + max_feedrate.e * steps_per_unit.e, + max_feedrate.x * steps_per_unit.x, + max_feedrate.y * steps_per_unit.y, + max_feedrate.z * steps_per_unit.z, + max_feedrate.i * steps_per_unit.i, + max_feedrate.j * steps_per_unit.j, + max_feedrate.k * steps_per_unit.k, + max_feedrate.u * steps_per_unit.u, + max_feedrate.v * steps_per_unit.v, + max_feedrate.w * steps_per_unit.w + )); + constexpr uint16_t shaping_dividends = max_steprate / _MIN(0x7FFFFFFFL OPTARG(HAS_SHAPING_X, SHAPING_FREQ_X) OPTARG(HAS_SHAPING_Y, SHAPING_FREQ_Y)) / 2 + 3; + constexpr uint16_t shaping_segments = max_steprate / (MIN_STEPS_PER_SEGMENT) / _MIN(0x7FFFFFFFL OPTARG(HAS_SHAPING_X, SHAPING_FREQ_X) OPTARG(HAS_SHAPING_Y, SHAPING_FREQ_Y)) / 2 + 3; + + class DelayTimeManager { + private: + static shaping_time_t now; + #ifdef HAS_SHAPING_X + static shaping_time_t delay_x; + #endif + #ifdef HAS_SHAPING_Y + static shaping_time_t delay_y; + #endif + public: + static void decrement_delays(const shaping_time_t interval) { now += interval; } + static void set_delay(const AxisEnum axis, const shaping_time_t delay) { + TERN_(HAS_SHAPING_X, if (axis == X_AXIS) delay_x = delay); + TERN_(HAS_SHAPING_Y, if (axis == Y_AXIS) delay_y = delay); + } + }; + + template + class DelayQueue : public DelayTimeManager { + protected: + shaping_time_t times[SIZE]; + uint16_t tail = 0 OPTARG(HAS_SHAPING_X, head_x = 0) OPTARG(HAS_SHAPING_Y, head_y = 0); + + public: + void enqueue() { + times[tail] = now; + if (++tail == SIZE) tail = 0; + } + #ifdef HAS_SHAPING_X + shaping_time_t peek_x() { + if (head_x != tail) return times[head_x] + delay_x - now; + else return shaping_time_t(-1); + } + void dequeue_x() { if (++head_x == SIZE) head_x = 0; } + bool empty_x() { return head_x == tail; } + uint16_t free_count_x() { return head_x > tail ? head_x - tail - 1 : head_x + SIZE - tail - 1; } + #endif + #ifdef HAS_SHAPING_Y + shaping_time_t peek_y() { + if (head_y != tail) return times[head_y] + delay_y - now; + else return shaping_time_t(-1); + } + void dequeue_y() { if (++head_y == SIZE) head_y = 0; } + bool empty_y() { return head_y == tail; } + uint16_t free_count_y() { return head_y > tail ? head_y - tail - 1 : head_y + SIZE - tail - 1; } + #endif + void purge() { auto temp = TERN_(HAS_SHAPING_X, head_x) = TERN_(HAS_SHAPING_Y, head_y) = tail; UNUSED(temp);} + }; + + class ParamDelayQueue : public DelayQueue { + private: + #ifdef HAS_SHAPING_X + int32_t params_x[shaping_segments]; + #endif + #ifdef HAS_SHAPING_Y + int32_t params_y[shaping_segments]; + #endif + + public: + void enqueue(const int32_t param_x, const int32_t param_y) { + TERN(HAS_SHAPING_X, params_x[DelayQueue::tail] = param_x, UNUSED(param_x)); + TERN(HAS_SHAPING_Y, params_y[DelayQueue::tail] = param_y, UNUSED(param_y)); + DelayQueue::enqueue(); + } + #ifdef HAS_SHAPING_X + const int32_t dequeue_x() { + const int32_t result = params_x[DelayQueue::head_x]; + DelayQueue::dequeue_x(); + return result; + } + #endif + #ifdef HAS_SHAPING_Y + const int32_t dequeue_y() { + const int32_t result = params_y[DelayQueue::head_y]; + DelayQueue::dequeue_y(); + return result; + } + #endif + }; + + struct ShapeParams { + float frequency; + float zeta; + uint8_t factor; + int32_t dividend; + }; + +#endif // INPUT_SHAPING + // // Stepper class definition // @@ -391,7 +502,7 @@ class Stepper { // Delta error variables for the Bresenham line tracer static xyze_long_t delta_error; - static xyze_ulong_t advance_dividend; + static xyze_long_t advance_dividend; static uint32_t advance_divisor, step_events_completed, // The number of step events executed in the current block accelerate_until, // The point from where we need to stop acceleration @@ -416,6 +527,17 @@ class Stepper { static bool bezier_2nd_half; // If Bézier curve has been initialized or not #endif + #if ENABLED(INPUT_SHAPING) + static ParamDelayQueue shaping_dividend_queue; + static DelayQueue shaping_queue; + #if HAS_SHAPING_X + static ShapeParams shaping_x; + #endif + #if HAS_SHAPING_Y + static ShapeParams shaping_y; + #endif + #endif + #if ENABLED(LIN_ADVANCE) static constexpr uint32_t LA_ADV_NEVER = 0xFFFFFFFF; static uint32_t nextAdvanceISR, @@ -475,6 +597,10 @@ class Stepper { // The stepper block processing ISR phase static uint32_t block_phase_isr(); + #if ENABLED(INPUT_SHAPING) + static void shaping_isr(); + #endif + #if ENABLED(LIN_ADVANCE) // The Linear advance ISR phase static void advance_isr(); @@ -628,6 +754,13 @@ class Stepper { set_directions(); } + #if ENABLED(INPUT_SHAPING) + static void set_shaping_damping_ratio(const AxisEnum axis, const float zeta); + static float get_shaping_damping_ratio(const AxisEnum axis); + static void set_shaping_frequency(const AxisEnum axis, const float freq); + static float get_shaping_frequency(const AxisEnum axis); + #endif + private: // Set the current position in steps diff --git a/buildroot/tests/mega2560 b/buildroot/tests/mega2560 index 86b2779032..333be2f0fa 100755 --- a/buildroot/tests/mega2560 +++ b/buildroot/tests/mega2560 @@ -80,7 +80,7 @@ opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO MIXING_STEPPERS 5 LCD_LANGUAGE ru \ FIL_RUNOUT2_PIN 16 FIL_RUNOUT3_PIN 17 FIL_RUNOUT4_PIN 4 FIL_RUNOUT5_PIN 5 opt_enable MIXING_EXTRUDER GRADIENT_MIX GRADIENT_VTOOL CR10_STOCKDISPLAY \ USE_CONTROLLER_FAN CONTROLLER_FAN_EDITABLE CONTROLLER_FAN_IGNORE_Z \ - FILAMENT_RUNOUT_SENSOR ADVANCED_PAUSE_FEATURE NOZZLE_PARK_FEATURE + FILAMENT_RUNOUT_SENSOR ADVANCED_PAUSE_FEATURE NOZZLE_PARK_FEATURE INPUT_SHAPING opt_disable DISABLE_INACTIVE_EXTRUDER exec_test $1 $2 "Azteeg X3 | Mixing Extruder (x5) | Gradient Mix | Greek" "$3" diff --git a/ini/features.ini b/ini/features.ini index 5f30db8a2f..7c8fd2fd8f 100644 --- a/ini/features.ini +++ b/ini/features.ini @@ -187,6 +187,7 @@ HAS_DUPLICATION_MODE = src_filter=+ PHOTO_GCODE = src_filter=+ CONTROLLER_FAN_EDITABLE = src_filter=+ +INPUT_SHAPING = src_filter=+ GCODE_MACROS = src_filter=+ GRADIENT_MIX = src_filter=+ HAS_SAVED_POSITIONS = src_filter=+ + diff --git a/platformio.ini b/platformio.ini index 751543c8a3..613f2c963a 100644 --- a/platformio.ini +++ b/platformio.ini @@ -192,6 +192,7 @@ default_src_filter = + - - + - - - + - - - - From ed1252642f43ccebfb329e74d46b745f8d3aa00f Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 22 Oct 2022 00:33:26 +0000 Subject: [PATCH 024/109] [cron] Bump distribution date (2022-10-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 dae6ae3368..5b21d2209e 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-10-21" +//#define STRING_DISTRIBUTION_DATE "2022-10-22" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 510641cf1d..05776b4a80 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-10-21" + #define STRING_DISTRIBUTION_DATE "2022-10-22" #endif /** From fd0c6fa153246e0ffa3a5b39b617c75f66857162 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 21 Oct 2022 19:45:20 -0500 Subject: [PATCH 025/109] =?UTF-8?q?=F0=9F=94=A7=20Clean=20up=20unused=20ES?= =?UTF-8?q?P=5FWIFI=20pins?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Conditionals_post.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 417ce4479a..21f0eed622 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -2543,6 +2543,21 @@ #undef TMC_UART_IS #undef ANY_SERIAL_IS +// Clean up unused ESP_WIFI pins +#ifdef ESP_WIFI_MODULE_COM + #if !SERIAL_IN_USE(ESP_WIFI_MODULE_COM) + #undef ESP_WIFI_MODULE_COM + #undef ESP_WIFI_MODULE_BAUDRATE + #undef ESP_WIFI_MODULE_RESET_PIN + #undef ESP_WIFI_MODULE_ENABLE_PIN + #undef ESP_WIFI_MODULE_TXD_PIN + #undef ESP_WIFI_MODULE_RXD_PIN + #undef ESP_WIFI_MODULE_GPIO0_PIN + #undef ESP_WIFI_MODULE_GPIO2_PIN + #undef ESP_WIFI_MODULE_GPIO4_PIN + #endif +#endif + // // Endstops and bed probe // From 1b31a7cf2c1b5cc1f7b58041604fa8b8ebb3ffe7 Mon Sep 17 00:00:00 2001 From: kurtis-potier-geofabrica <77456752+kurtis-potier-geofabrica@users.noreply.github.com> Date: Sat, 22 Oct 2022 00:13:56 -0400 Subject: [PATCH 026/109] =?UTF-8?q?=F0=9F=9A=B8=20Up=20to=203=20MAX=20Ther?= =?UTF-8?q?mocouples=20(#24898)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 4 + Marlin/Configuration_adv.h | 2 + Marlin/src/inc/Conditionals_adv.h | 100 ++++++++++++++++-------- Marlin/src/inc/Conditionals_post.h | 85 ++++++++++++++++++-- Marlin/src/inc/SanityCheck.h | 23 ++++-- Marlin/src/module/temperature.cpp | 121 +++++++++++++++++++++++------ 6 files changed, 261 insertions(+), 74 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 83c1c541e3..87a98298a5 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -564,6 +564,10 @@ #define MAX31865_SENSOR_OHMS_1 100 #define MAX31865_CALIBRATION_OHMS_1 430 #endif +#if TEMP_SENSOR_IS_MAX_TC(2) + #define MAX31865_SENSOR_OHMS_2 100 + #define MAX31865_CALIBRATION_OHMS_2 430 +#endif #if HAS_E_TEMP_SENSOR #define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 01a2bd85c5..9a54b10b82 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -175,6 +175,7 @@ //#define TEMP_SENSOR_FORCE_HW_SPI // Ignore SCK/MOSI/MISO pins; use CS and the default SPI bus. //#define MAX31865_SENSOR_WIRES_0 2 // (2-4) Number of wires for the probe connected to a MAX31865 board. //#define MAX31865_SENSOR_WIRES_1 2 +//#define MAX31865_SENSOR_WIRES_2 2 //#define MAX31865_50HZ_FILTER // Use a 50Hz filter instead of the default 60Hz. //#define MAX31865_USE_READ_ERROR_DETECTION // Treat value spikes (20°C delta in under 1s) as read errors. @@ -185,6 +186,7 @@ //#define MAX31865_WIRE_OHMS_0 0.95f // For 2-wire, set the wire resistances for more accurate readings. //#define MAX31865_WIRE_OHMS_1 0.0f +//#define MAX31865_WIRE_OHMS_2 0.0f /** * Hephestos 2 24V heated bed upgrade kit. diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 1f8f0ddfb6..dd69e61c92 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -262,26 +262,72 @@ #undef HEATER_1_MAXTEMP #endif +#if TEMP_SENSOR_IS_MAX_TC(2) + #if TEMP_SENSOR_2 == -5 + #define TEMP_SENSOR_2_IS_MAX31865 1 + #define TEMP_SENSOR_2_MAX_TC_TMIN 0 + #define TEMP_SENSOR_2_MAX_TC_TMAX 1024 + #ifndef MAX31865_SENSOR_WIRES_2 + #define MAX31865_SENSOR_WIRES_2 2 + #endif + #ifndef MAX31865_WIRE_OHMS_2 + #define MAX31865_WIRE_OHMS_2 0.0f + #endif + #elif TEMP_SENSOR_2 == -3 + #define TEMP_SENSOR_2_IS_MAX31855 1 + #define TEMP_SENSOR_2_MAX_TC_TMIN -270 + #define TEMP_SENSOR_2_MAX_TC_TMAX 1800 + #elif TEMP_SENSOR_2 == -2 + #define TEMP_SENSOR_2_IS_MAX6675 1 + #define TEMP_SENSOR_2_MAX_TC_TMIN 0 + #define TEMP_SENSOR_2_MAX_TC_TMAX 1024 + #endif + + #if TEMP_SENSOR_2 != TEMP_SENSOR_0 + #if TEMP_SENSOR_2 == -5 + #error "If MAX31865 Thermocouple (-5) is used for TEMP_SENSOR_2 then TEMP_SENSOR_0 must match." + #elif TEMP_SENSOR_2 == -3 + #error "If MAX31855 Thermocouple (-3) is used for TEMP_SENSOR_2 then TEMP_SENSOR_0 must match." + #elif TEMP_SENSOR_2 == -2 + #error "If MAX6675 Thermocouple (-2) is used for TEMP_SENSOR_2 then TEMP_SENSOR_0 must match." + #endif + #endif +#elif TEMP_SENSOR_2 == -4 + #define TEMP_SENSOR_2_IS_AD8495 1 +#elif TEMP_SENSOR_2 == -1 + #define TEMP_SENSOR_2_IS_AD595 1 +#elif TEMP_SENSOR_2 > 0 + #define TEMP_SENSOR_2_IS_THERMISTOR 1 + #if TEMP_SENSOR_2 == 1000 + #define TEMP_SENSOR_2_IS_CUSTOM 1 + #elif TEMP_SENSOR_2 == 998 || TEMP_SENSOR_2 == 999 + #define TEMP_SENSOR_2_IS_DUMMY 1 + #endif +#else + #undef HEATER_2_MINTEMP + #undef HEATER_2_MAXTEMP +#endif + #if TEMP_SENSOR_IS_MAX_TC(REDUNDANT) #if TEMP_SENSOR_REDUNDANT == -5 - #if !REDUNDANT_TEMP_MATCH(SOURCE, E0) && !REDUNDANT_TEMP_MATCH(SOURCE, E1) - #error "MAX31865 Thermocouples (-5) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)." + #if !REDUNDANT_TEMP_MATCH(SOURCE, E0) && !REDUNDANT_TEMP_MATCH(SOURCE, E1) && !REDUNDANT_TEMP_MATCH(SOURCE, E2) + #error "MAX31865 Thermocouples (-5) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1/TEMP_SENSOR_2 (0/1/2)." #endif #define TEMP_SENSOR_REDUNDANT_IS_MAX31865 1 #define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN 0 #define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1024 #elif TEMP_SENSOR_REDUNDANT == -3 - #if !REDUNDANT_TEMP_MATCH(SOURCE, E0) && !REDUNDANT_TEMP_MATCH(SOURCE, E1) - #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)." + #if !REDUNDANT_TEMP_MATCH(SOURCE, E0) && !REDUNDANT_TEMP_MATCH(SOURCE, E1) && !REDUNDANT_TEMP_MATCH(SOURCE, E2) + #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1/TEMP_SENSOR_2 (0/1/2)." #endif #define TEMP_SENSOR_REDUNDANT_IS_MAX31855 1 #define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN -270 #define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1800 #elif TEMP_SENSOR_REDUNDANT == -2 - #if !REDUNDANT_TEMP_MATCH(SOURCE, E0) && !REDUNDANT_TEMP_MATCH(SOURCE, E1) - #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)." + #if !REDUNDANT_TEMP_MATCH(SOURCE, E0) && !REDUNDANT_TEMP_MATCH(SOURCE, E1) && !REDUNDANT_TEMP_MATCH(SOURCE, E2) + #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1/TEMP_SENSOR_2 (0/1/2)." #endif #define TEMP_SENSOR_REDUNDANT_IS_MAX6675 1 @@ -302,15 +348,21 @@ #ifndef MAX31865_SENSOR_WIRES_1 #define MAX31865_SENSOR_WIRES_1 2 #endif + #elif REDUNDANT_TEMP_MATCH(SOURCE, E2) + #define TEMP_SENSOR_2_MAX_TC_TMIN TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN + #define TEMP_SENSOR_2_MAX_TC_TMAX TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX + #ifndef MAX31865_SENSOR_WIRES_2 + #define MAX31865_SENSOR_WIRES_2 2 + #endif #endif - #if (TEMP_SENSOR_IS_MAX_TC(0) && TEMP_SENSOR_REDUNDANT != TEMP_SENSOR_0) || (TEMP_SENSOR_IS_MAX_TC(1) && TEMP_SENSOR_REDUNDANT != TEMP_SENSOR_1) + #if (TEMP_SENSOR_IS_MAX_TC(0) && TEMP_SENSOR_REDUNDANT != TEMP_SENSOR_0) || (TEMP_SENSOR_IS_MAX_TC(1) && TEMP_SENSOR_REDUNDANT != TEMP_SENSOR_1) || (TEMP_SENSOR_IS_MAX_TC(2) && TEMP_SENSOR_REDUNDANT != TEMP_SENSOR_2) #if TEMP_SENSOR_REDUNDANT == -5 - #error "If MAX31865 Thermocouple (-5) is used for TEMP_SENSOR_0/TEMP_SENSOR_1 then TEMP_SENSOR_REDUNDANT must match." + #error "If MAX31865 Thermocouple (-5) is used for TEMP_SENSOR_0/TEMP_SENSOR_1/TEMP_SENSOR_2 then TEMP_SENSOR_REDUNDANT must match." #elif TEMP_SENSOR_REDUNDANT == -3 - #error "If MAX31855 Thermocouple (-3) is used for TEMP_SENSOR_0/TEMP_SENSOR_1 then TEMP_SENSOR_REDUNDANT must match." + #error "If MAX31855 Thermocouple (-3) is used for TEMP_SENSOR_0/TEMP_SENSOR_1/TEMP_SENSOR_2 then TEMP_SENSOR_REDUNDANT must match." #elif TEMP_SENSOR_REDUNDANT == -2 - #error "If MAX6675 Thermocouple (-2) is used for TEMP_SENSOR_0/TEMP_SENSOR_1 then TEMP_SENSOR_REDUNDANT must match." + #error "If MAX6675 Thermocouple (-2) is used for TEMP_SENSOR_0/TEMP_SENSOR_1/TEMP_SENSOR_2 then TEMP_SENSOR_REDUNDANT must match." #endif #endif #elif TEMP_SENSOR_REDUNDANT == -4 @@ -326,39 +378,19 @@ #endif #endif -#if TEMP_SENSOR_IS_MAX_TC(0) || TEMP_SENSOR_IS_MAX_TC(1) || TEMP_SENSOR_IS_MAX_TC(REDUNDANT) +#if TEMP_SENSOR_IS_MAX_TC(0) || TEMP_SENSOR_IS_MAX_TC(1) || TEMP_SENSOR_IS_MAX_TC(2) || TEMP_SENSOR_IS_MAX_TC(REDUNDANT) #define HAS_MAX_TC 1 #endif -#if TEMP_SENSOR_0_IS_MAX6675 || TEMP_SENSOR_1_IS_MAX6675 || TEMP_SENSOR_REDUNDANT_IS_MAX6675 +#if TEMP_SENSOR_0_IS_MAX6675 || TEMP_SENSOR_1_IS_MAX6675 || TEMP_SENSOR_2_IS_MAX6675 || TEMP_SENSOR_REDUNDANT_IS_MAX6675 #define HAS_MAX6675 1 #endif -#if TEMP_SENSOR_0_IS_MAX31855 || TEMP_SENSOR_1_IS_MAX31855 || TEMP_SENSOR_REDUNDANT_IS_MAX31855 +#if TEMP_SENSOR_0_IS_MAX31855 || TEMP_SENSOR_1_IS_MAX31855 || TEMP_SENSOR_2_IS_MAX31855 || TEMP_SENSOR_REDUNDANT_IS_MAX31855 #define HAS_MAX31855 1 #endif -#if TEMP_SENSOR_0_IS_MAX31865 || TEMP_SENSOR_1_IS_MAX31865 || TEMP_SENSOR_REDUNDANT_IS_MAX31865 +#if TEMP_SENSOR_0_IS_MAX31865 || TEMP_SENSOR_1_IS_MAX31865 || TEMP_SENSOR_2_IS_MAX31865 || TEMP_SENSOR_REDUNDANT_IS_MAX31865 #define HAS_MAX31865 1 #endif -#if TEMP_SENSOR_2 == -4 - #define TEMP_SENSOR_2_IS_AD8495 1 -#elif TEMP_SENSOR_2 == -3 - #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_2." -#elif TEMP_SENSOR_2 == -2 - #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_2." -#elif TEMP_SENSOR_2 == -1 - #define TEMP_SENSOR_2_IS_AD595 1 -#elif TEMP_SENSOR_2 > 0 - #define TEMP_SENSOR_2_IS_THERMISTOR 1 - #if TEMP_SENSOR_2 == 1000 - #define TEMP_SENSOR_2_IS_CUSTOM 1 - #elif TEMP_SENSOR_2 == 998 || TEMP_SENSOR_2 == 999 - #define TEMP_SENSOR_2_IS_DUMMY 1 - #endif -#else - #undef HEATER_2_MINTEMP - #undef HEATER_2_MAXTEMP -#endif - #if TEMP_SENSOR_3 == -4 #define TEMP_SENSOR_3_IS_AD8495 1 #elif TEMP_SENSOR_3 == -3 diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 21f0eed622..5f54039392 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -723,19 +723,19 @@ #define TEMP_0_SCK_PIN MAX31855_SCK_PIN #endif - #elif TEMP_SENSOR_1_IS_MAX31865 - #if !PIN_EXISTS(TEMP_1_MISO) // DO + #elif TEMP_SENSOR_0_IS_MAX31865 + #if !PIN_EXISTS(TEMP_0_MISO) // DO #if PIN_EXISTS(MAX31865_MISO) - #define TEMP_1_MISO_PIN MAX31865_MISO_PIN + #define TEMP_0_MISO_PIN MAX31865_MISO_PIN #elif PIN_EXISTS(MAX31865_DO) - #define TEMP_1_MISO_PIN MAX31865_DO_PIN + #define TEMP_0_MISO_PIN MAX31865_DO_PIN #endif #endif - #if !PIN_EXISTS(TEMP_1_SCK) && PIN_EXISTS(MAX31865_SCK) - #define TEMP_1_SCK_PIN MAX31865_SCK_PIN + #if !PIN_EXISTS(TEMP_0_SCK) && PIN_EXISTS(MAX31865_SCK) + #define TEMP_0_SCK_PIN MAX31865_SCK_PIN #endif - #if !PIN_EXISTS(TEMP_1_MOSI) && PIN_EXISTS(MAX31865_MOSI) // MOSI for '65 only - #define TEMP_1_MOSI_PIN MAX31865_MOSI_PIN + #if !PIN_EXISTS(TEMP_0_MOSI) && PIN_EXISTS(MAX31865_MOSI) // MOSI for '65 only + #define TEMP_0_MOSI_PIN MAX31865_MOSI_PIN #endif #endif @@ -819,6 +819,75 @@ #endif // TEMP_SENSOR_IS_MAX_TC(1) + #if TEMP_SENSOR_IS_MAX_TC(2) || (TEMP_SENSOR_IS_MAX_TC(REDUNDANT) && REDUNDANT_TEMP_MATCH(SOURCE, E2)) + + #if !PIN_EXISTS(TEMP_2_CS) // SS3, CS3 + #if PIN_EXISTS(MAX6675_SS3) + #define TEMP_2_CS_PIN MAX6675_SS3_PIN + #elif PIN_EXISTS(MAX6675_CS) + #define TEMP_2_CS_PIN MAX6675_CS3_PIN + #elif PIN_EXISTS(MAX31855_SS3) + #define TEMP_2_CS_PIN MAX31855_SS3_PIN + #elif PIN_EXISTS(MAX31855_CS3) + #define TEMP_2_CS_PIN MAX31855_CS3_PIN + #elif PIN_EXISTS(MAX31865_SS3) + #define TEMP_2_CS_PIN MAX31865_SS3_PIN + #elif PIN_EXISTS(MAX31865_CS3) + #define TEMP_2_CS_PIN MAX31865_CS3_PIN + #endif + #endif + + #if TEMP_SENSOR_2_IS_MAX6675 + #if !PIN_EXISTS(TEMP_2_MISO) // DO + #if PIN_EXISTS(MAX6675_MISO) + #define TEMP_2_MISO_PIN MAX6675_MISO_PIN + #elif PIN_EXISTS(MAX6675_DO) + #define TEMP_2_MISO_PIN MAX6675_DO_PIN + #endif + #endif + #if !PIN_EXISTS(TEMP_2_SCK) && PIN_EXISTS(MAX6675_SCK) + #define TEMP_2_SCK_PIN MAX6675_SCK_PIN + #endif + + #elif TEMP_SENSOR_2_IS_MAX31855 + #if !PIN_EXISTS(TEMP_2_MISO) // DO + #if PIN_EXISTS(MAX31855_MISO) + #define TEMP_2_MISO_PIN MAX31855_MISO_PIN + #elif PIN_EXISTS(MAX31855_DO) + #define TEMP_2_MISO_PIN MAX31855_DO_PIN + #endif + #endif + #if !PIN_EXISTS(TEMP_2_SCK) && PIN_EXISTS(MAX31855_SCK) + #define TEMP_2_SCK_PIN MAX31855_SCK_PIN + #endif + + #elif TEMP_SENSOR_2_IS_MAX31865 + #if !PIN_EXISTS(TEMP_2_MISO) // DO + #if PIN_EXISTS(MAX31865_MISO) + #define TEMP_2_MISO_PIN MAX31865_MISO_PIN + #elif PIN_EXISTS(MAX31865_DO) + #define TEMP_2_MISO_PIN MAX31865_DO_PIN + #endif + #endif + #if !PIN_EXISTS(TEMP_2_SCK) && PIN_EXISTS(MAX31865_SCK) + #define TEMP_2_SCK_PIN MAX31865_SCK_PIN + #endif + #if !PIN_EXISTS(TEMP_2_MOSI) && PIN_EXISTS(MAX31865_MOSI) // MOSI for '65 only + #define TEMP_2_MOSI_PIN MAX31865_MOSI_PIN + #endif + #endif + + // Software SPI - enable if MISO/SCK are defined. + #if PIN_EXISTS(TEMP_2_MISO) && PIN_EXISTS(TEMP_2_SCK) && DISABLED(TEMP_SENSOR_2_FORCE_HW_SPI) + #if TEMP_SENSOR_2_IS_MAX31865 && !PIN_EXISTS(TEMP_2_MOSI) + #error "TEMP_SENSOR_2 MAX31865 requires TEMP_2_MOSI_PIN defined for Software SPI. To use Hardware SPI instead, undefine MISO/SCK or enable TEMP_SENSOR_2_FORCE_HW_SPI." + #else + #define TEMP_SENSOR_2_HAS_SPI_PINS 1 + #endif + #endif + + #endif // TEMP_SENSOR_IS_MAX_TC(2) + // // User-defined thermocouple libraries // diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 06b8f32946..744e68a5bb 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -416,17 +416,17 @@ #elif defined(CHDK) #error "CHDK is now CHDK_PIN." #elif ANY_PIN( \ - MAX6675_SS, MAX6675_SS2, MAX6675_CS, MAX6675_CS2, \ - MAX31855_SS, MAX31855_SS2, MAX31855_CS, MAX31855_CS2, \ - MAX31865_SS, MAX31865_SS2, MAX31865_CS, MAX31865_CS2) - #warning "MAX*_SS_PIN, MAX*_SS2_PIN, MAX*_CS_PIN, and MAX*_CS2_PIN are deprecated and will be removed in a future version. Please use TEMP_0_CS_PIN/TEMP_1_CS_PIN instead." + MAX6675_SS, MAX6675_SS2, MAX6675_SS3, MAX6675_CS, MAX6675_CS2, MAX6675_CS3,\ + MAX31855_SS, MAX31855_SS2, MAX31855_SS3, MAX31855_CS, MAX31855_CS2, MAX31855_CS3, \ + MAX31865_SS, MAX31865_SS2, MAX31865_SS3, MAX31865_CS, MAX31865_CS2, MAX31865_CS3) + #warning "MAX*_SS_PIN, MAX*_SS2_PIN, MAX*_SS3_PIN, MAX*_CS_PIN, MAX*_CS2_PIN, and MAX*_CS3_PIN, are deprecated and will be removed in a future version. Please use TEMP_0_CS_PIN/TEMP_1_CS_PIN/TEMP_2_CS_PIN instead." #elif ANY_PIN(MAX6675_SCK, MAX31855_SCK, MAX31865_SCK) - #warning "MAX*_SCK_PIN is deprecated and will be removed in a future version. Please use TEMP_0_SCK_PIN/TEMP_1_SCK_PIN instead." + #warning "MAX*_SCK_PIN is deprecated and will be removed in a future version. Please use TEMP_0_SCK_PIN/TEMP_1_SCK_PIN/TEMP_2_SCK_PIN instead." #elif ANY_PIN(MAX6675_MISO, MAX6675_DO, MAX31855_MISO, MAX31855_DO, MAX31865_MISO, MAX31865_DO) - #warning "MAX*_MISO_PIN and MAX*_DO_PIN are deprecated and will be removed in a future version. Please use TEMP_0_MISO_PIN/TEMP_1_MISO_PIN instead." + #warning "MAX*_MISO_PIN and MAX*_DO_PIN are deprecated and will be removed in a future version. Please use TEMP_0_MISO_PIN/TEMP_1_MISO_PIN/TEMP_2_MISO_PIN instead." #elif PIN_EXISTS(MAX31865_MOSI) - #warning "MAX31865_MOSI_PIN is deprecated and will be removed in a future version. Please use TEMP_0_MOSI_PIN/TEMP_1_MOSI_PIN instead." -#elif ANY_PIN(THERMO_CS1_PIN, THERMO_CS2_PIN, THERMO_DO_PIN, THERMO_SCK_PIN) + #warning "MAX31865_MOSI_PIN is deprecated and will be removed in a future version. Please use TEMP_0_MOSI_PIN/TEMP_1_MOSI_PIN/TEMP_2_MOSI_PIN instead." +#elif ANY_PIN(THERMO_CS1_PIN, THERMO_CS2_PIN, THERMO_CS3_PIN, THERMO_DO_PIN, THERMO_SCK_PIN) #error "THERMO_*_PIN is now TEMP_n_CS_PIN, TEMP_n_SCK_PIN, TEMP_n_MOSI_PIN, TEMP_n_MISO_PIN." #elif defined(MAX31865_SENSOR_OHMS) #error "MAX31865_SENSOR_OHMS is now MAX31865_SENSOR_OHMS_0." @@ -2340,6 +2340,13 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "MAX31865_SENSOR_OHMS_1 and MAX31865_CALIBRATION_OHMS_1 must be set if TEMP_SENSOR_1/TEMP_SENSOR_REDUNDANT is MAX31865." #endif #endif +#if TEMP_SENSOR_2_IS_MAX31865 || (TEMP_SENSOR_REDUNDANT_IS_MAX31865 && REDUNDANT_TEMP_MATCH(SOURCE, E2)) + #if !defined(MAX31865_SENSOR_WIRES_2) || !WITHIN(MAX31865_SENSOR_WIRES_2, 2, 4) + #error "MAX31865_SENSOR_WIRES_2 must be defined as an integer between 2 and 4." + #elif !defined(MAX31865_SENSOR_OHMS_2) || !defined(MAX31865_CALIBRATION_OHMS_2) + #error "MAX31865_SENSOR_OHMS_2 and MAX31865_CALIBRATION_OHMS_2 must be set if TEMP_SENSOR_2/TEMP_SENSOR_REDUNDANT is MAX31865." + #endif +#endif /** * Redundant temperature sensor config diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 7515396fbe..8843582f4e 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -113,13 +113,16 @@ // 3. CS, MISO, and SCK pins w/ FORCE_HW_SPI: Hardware SPI on the default bus, ignoring MISO, SCK. // #if TEMP_SENSOR_IS_ANY_MAX_TC(0) && TEMP_SENSOR_0_HAS_SPI_PINS && DISABLED(TEMP_SENSOR_FORCE_HW_SPI) - #define TEMP_SENSOR_0_USES_SW_SPI 1 + #define TEMP_SENSOR_0_USES_SW_SPI 1 #endif #if TEMP_SENSOR_IS_ANY_MAX_TC(1) && TEMP_SENSOR_1_HAS_SPI_PINS && DISABLED(TEMP_SENSOR_FORCE_HW_SPI) - #define TEMP_SENSOR_1_USES_SW_SPI 1 + #define TEMP_SENSOR_1_USES_SW_SPI 1 +#endif +#if TEMP_SENSOR_IS_ANY_MAX_TC(2) && TEMP_SENSOR_2_HAS_SPI_PINS && DISABLED(TEMP_SENSOR_FORCE_HW_SPI) + #define TEMP_SENSOR_2_USES_SW_SPI 1 #endif -#if (TEMP_SENSOR_0_USES_SW_SPI || TEMP_SENSOR_1_USES_SW_SPI) && !HAS_MAXTC_LIBRARIES +#if (TEMP_SENSOR_0_USES_SW_SPI || TEMP_SENSOR_1_USES_SW_SPI || TEMP_SENSOR_2_USES_SW_SPI) && !HAS_MAXTC_LIBRARIES #include "../libs/private_spi.h" #define HAS_MAXTC_SW_SPI 1 @@ -130,12 +133,18 @@ #if PIN_EXISTS(TEMP_0_MOSI) #define SW_SPI_MOSI_PIN TEMP_0_MOSI_PIN #endif - #else + #elif TEMP_SENSOR_1_USES_SW_SPI #define SW_SPI_SCK_PIN TEMP_1_SCK_PIN #define SW_SPI_MISO_PIN TEMP_1_MISO_PIN #if PIN_EXISTS(TEMP_1_MOSI) #define SW_SPI_MOSI_PIN TEMP_1_MOSI_PIN #endif + #elif TEMP_SENSOR_2_USES_SW_SPI + #define SW_SPI_SCK_PIN TEMP_2_SCK_PIN + #define SW_SPI_MISO_PIN TEMP_2_MISO_PIN + #if PIN_EXISTS(TEMP_2_MOSI) + #define SW_SPI_MOSI_PIN TEMP_2_MOSI_PIN + #endif #endif #ifndef SW_SPI_MOSI_PIN #define SW_SPI_MOSI_PIN SD_MOSI_PIN @@ -256,6 +265,9 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED); #if TEMP_SENSOR_IS_MAX(1, 6675) MAXTC_INIT(1, 6675); #endif + #if TEMP_SENSOR_IS_MAX(2, 6675) + MAXTC_INIT(2, 6675); + #endif #endif #if HAS_MAX31855_LIBRARY @@ -265,12 +277,16 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED); #if TEMP_SENSOR_IS_MAX(1, 31855) MAXTC_INIT(1, 31855); #endif + #if TEMP_SENSOR_IS_MAX(2, 31855) + MAXTC_INIT(2, 31855); + #endif #endif // MAX31865 always uses a library, unlike '55 & 6675 #if HAS_MAX31865 #define _MAX31865_0_SW TEMP_SENSOR_0_USES_SW_SPI #define _MAX31865_1_SW TEMP_SENSOR_1_USES_SW_SPI + #define _MAX31865_2_SW TEMP_SENSOR_2_USES_SW_SPI #if TEMP_SENSOR_IS_MAX(0, 31865) MAXTC_INIT(0, 31865); @@ -278,9 +294,13 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED); #if TEMP_SENSOR_IS_MAX(1, 31865) MAXTC_INIT(1, 31865); #endif + #if TEMP_SENSOR_IS_MAX(2, 31865) + MAXTC_INIT(2, 31865); + #endif #undef _MAX31865_0_SW #undef _MAX31865_1_SW + #undef _MAX31865_2_SW #endif #undef MAXTC_INIT @@ -541,6 +561,7 @@ volatile bool Temperature::raw_temps_ready = false; #endif #if MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED > 1 + #define MULTI_MAX_CONSECUTIVE_LOW_TEMP_ERR 1 uint8_t Temperature::consecutive_low_temperature_error[HOTENDS] = { 0 }; #endif @@ -1866,6 +1887,10 @@ void Temperature::task() { if (degHotend(1) > _MIN(HEATER_1_MAXTEMP, TEMP_SENSOR_1_MAX_TC_TMAX - 1.0)) max_temp_error(H_E1); if (degHotend(1) < _MAX(HEATER_1_MINTEMP, TEMP_SENSOR_1_MAX_TC_TMIN + .01)) min_temp_error(H_E1); #endif + #if TEMP_SENSOR_IS_MAX_TC(2) + if (degHotend(2) > _MIN(HEATER_2_MAXTEMP, TEMP_SENSOR_2_MAX_TC_TMAX - 1.0)) max_temp_error(H_E2); + if (degHotend(2) < _MAX(HEATER_2_MINTEMP, TEMP_SENSOR_2_MAX_TC_TMIN + .01)) min_temp_error(H_E2); + #endif #if TEMP_SENSOR_IS_MAX_TC(REDUNDANT) if (degRedundant() > TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX - 1.0) max_temp_error(H_REDUNDANT); if (degRedundant() < TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN + .01) min_temp_error(H_REDUNDANT); @@ -2112,6 +2137,15 @@ void Temperature::task() { case 2: #if TEMP_SENSOR_2_IS_CUSTOM return user_thermistor_to_deg_c(CTI_HOTEND_2, raw); + #elif TEMP_SENSOR_IS_MAX_TC(2) + #if TEMP_SENSOR_0_IS_MAX31865 + return TERN(LIB_INTERNAL_MAX31865, + max31865_2.temperature(raw), + max31865_2.temperature(MAX31865_SENSOR_OHMS_2, MAX31865_CALIBRATION_OHMS_2) + ); + #else + return (int16_t)raw * 0.25; + #endif #elif TEMP_SENSOR_2_IS_AD595 return TEMP_AD595(raw); #elif TEMP_SENSOR_2_IS_AD8495 @@ -2281,6 +2315,8 @@ void Temperature::task() { return TERN(TEMP_SENSOR_REDUNDANT_IS_MAX31865, max31865_0.temperature(raw), (int16_t)raw * 0.25); #elif TEMP_SENSOR_IS_MAX_TC(REDUNDANT) && REDUNDANT_TEMP_MATCH(SOURCE, E1) return TERN(TEMP_SENSOR_REDUNDANT_IS_MAX31865, max31865_1.temperature(raw), (int16_t)raw * 0.25); + #elif TEMP_SENSOR_IS_MAX_TC(REDUNDANT) && REDUNDANT_TEMP_MATCH(SOURCE, E2) + return TERN(TEMP_SENSOR_REDUNDANT_IS_MAX31865, max31865_2.temperature(raw), (int16_t)raw * 0.25); #elif TEMP_SENSOR_REDUNDANT_IS_THERMISTOR SCAN_THERMISTOR_TABLE(TEMPTABLE_REDUNDANT, TEMPTABLE_REDUNDANT_LEN); #elif TEMP_SENSOR_REDUNDANT_IS_AD595 @@ -2316,6 +2352,9 @@ void Temperature::updateTemperaturesFromRawValues() { #if TEMP_SENSOR_IS_MAX_TC(1) temp_hotend[1].setraw(READ_MAX_TC(1)); #endif + #if TEMP_SENSOR_IS_MAX_TC(2) + temp_hotend[2].setraw(READ_MAX_TC(2)); + #endif #if TEMP_SENSOR_IS_MAX_TC(REDUNDANT) temp_redundant.setraw(READ_MAX_TC(HEATER_ID(TEMP_SENSOR_REDUNDANT_SOURCE))); #endif @@ -2347,9 +2386,14 @@ void Temperature::updateTemperaturesFromRawValues() { #else , TEMPDIR(1) #endif - #if HOTENDS > 2 + #if TEMP_SENSOR_IS_ANY_MAX_TC(2) + , 0 + #else + , TEMPDIR(2) + #endif + #if HOTENDS > 3 #define _TEMPDIR(N) , TEMPDIR(N) - REPEAT_S(2, HOTENDS, _TEMPDIR) + REPEAT_S(3, HOTENDS, _TEMPDIR) #endif #endif }; @@ -2362,15 +2406,12 @@ void Temperature::updateTemperaturesFromRawValues() { const bool heater_on = temp_hotend[e].target > 0; if (heater_on && ((neg && r > temp_range[e].raw_min) || (pos && r < temp_range[e].raw_min))) { - #if MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED > 1 - if (++consecutive_low_temperature_error[e] >= MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED) - #endif - min_temp_error((heater_id_t)e); + if (TERN1(MULTI_MAX_CONSECUTIVE_LOW_TEMP_ERR, ++consecutive_low_temperature_error[e] >= MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED)) + min_temp_error((heater_id_t)e); + } + else { + TERN_(MULTI_MAX_CONSECUTIVE_LOW_TEMP_ERR, consecutive_low_temperature_error[e] = 0); } - #if MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED > 1 - else - consecutive_low_temperature_error[e] = 0; - #endif } #endif // HAS_HOTEND @@ -2432,6 +2473,9 @@ void Temperature::init() { #if TEMP_SENSOR_IS_ANY_MAX_TC(1) && PIN_EXISTS(TEMP_1_CS) OUT_WRITE(TEMP_1_CS_PIN, HIGH); #endif + #if TEMP_SENSOR_IS_ANY_MAX_TC(2) && PIN_EXISTS(TEMP_2_CS) + OUT_WRITE(TEMP_2_CS_PIN, HIGH); + #endif // Setup objects for library-based polling of MAX TCs #if HAS_MAXTC_LIBRARIES @@ -2459,6 +2503,18 @@ void Temperature::init() { OPTARG(LIB_INTERNAL_MAX31865, MAX31865_SENSOR_OHMS_1, MAX31865_CALIBRATION_OHMS_1, MAX31865_WIRE_OHMS_1) ); #endif + + #if TEMP_SENSOR_IS_MAX(2, 6675) && HAS_MAX6675_LIBRARY + max6675_2.begin(); + #elif TEMP_SENSOR_IS_MAX(2, 31855) && HAS_MAX31855_LIBRARY + max31855_2.begin(); + #elif TEMP_SENSOR_IS_MAX(2, 31865) + max31865_2.begin( + MAX31865_WIRES(MAX31865_SENSOR_WIRES_2) // MAX31865_2WIRE, MAX31865_3WIRE, MAX31865_4WIRE + OPTARG(LIB_INTERNAL_MAX31865, MAX31865_SENSOR_OHMS_2, MAX31865_CALIBRATION_OHMS_2, MAX31865_WIRE_OHMS_2) + ); + #endif + #undef MAX31865_WIRES #undef _MAX31865_WIRES #endif @@ -2491,6 +2547,15 @@ void Temperature::init() { #endif )); #endif + #if PIN_EXISTS(TEMP_2_TR_ENABLE) + OUT_WRITE(TEMP_2_TR_ENABLE_PIN, ( + #if TEMP_SENSOR_IS_ANY_MAX_TC(2) + HIGH + #else + LOW + #endif + )); + #endif #if ENABLED(MPCTEMP) HOTEND_LOOP() temp_hotend[e].modeled_block_temp = NAN; @@ -3009,25 +3074,29 @@ void Temperature::disable_all_heaters() { // Needed to return the correct temp when this is called between readings static raw_adc_t max_tc_temp_previous[MAX_TC_COUNT] = { 0 }; #define THERMO_TEMP(I) max_tc_temp_previous[I] - #define THERMO_SEL(A,B) (hindex ? (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) + #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) #else // When we have only 1 max tc, THERMO_SEL will pick the appropriate sensor // variable, and MAXTC_*() macros will be hardcoded to the correct CS pin. constexpr uint8_t hindex = 0; #define THERMO_TEMP(I) max_tc_temp #if TEMP_SENSOR_IS_ANY_MAX_TC(0) - #define THERMO_SEL(A,B) A + #define THERMO_SEL(A,B,C) A #define MAXTC_CS_WRITE(V) WRITE(TEMP_0_CS_PIN, V) - #else - #define THERMO_SEL(A,B) B + #elif TEMP_SENSOR_IS_ANY_MAX_TC(1) + #define THERMO_SEL(A,B,C) B #define MAXTC_CS_WRITE(V) WRITE(TEMP_1_CS_PIN, V) + #elif TEMP_SENSOR_IS_ANY_MAX_TC(2) + #define THERMO_SEL(A,B,C) C + #define MAXTC_CS_WRITE(V) WRITE(TEMP_2_CS_PIN, V) #endif #endif static TERN(HAS_MAX31855, uint32_t, uint16_t) max_tc_temp = THERMO_SEL( TEMP_SENSOR_0_MAX_TC_TMAX, - TEMP_SENSOR_1_MAX_TC_TMAX + TEMP_SENSOR_1_MAX_TC_TMAX, + TEMP_SENSOR_2_MAX_TC_TMAX ); static uint8_t max_tc_errors[MAX_TC_COUNT] = { 0 }; @@ -3062,17 +3131,17 @@ void Temperature::disable_all_heaters() { MAXTC_CS_WRITE(HIGH); // Disable MAXTC #else #if HAS_MAX6675_LIBRARY - MAX6675 &max6675ref = THERMO_SEL(max6675_0, max6675_1); + MAX6675 &max6675ref = THERMO_SEL(max6675_0, max6675_1, max6675_2); max_tc_temp = max6675ref.readRaw16(); #endif #if HAS_MAX31855_LIBRARY - MAX31855 &max855ref = THERMO_SEL(max31855_0, max31855_1); + MAX31855 &max855ref = THERMO_SEL(max31855_0, max31855_1, max31855_2); max_tc_temp = max855ref.readRaw32(); #endif #if HAS_MAX31865 - MAX31865 &max865ref = THERMO_SEL(max31865_0, max31865_1); + MAX31865 &max865ref = THERMO_SEL(max31865_0, max31865_1, max31865_2); max_tc_temp = TERN(LIB_INTERNAL_MAX31865, max865ref.readRaw(), max865ref.readRTD_with_Fault()); #endif #endif @@ -3117,7 +3186,7 @@ void Temperature::disable_all_heaters() { #endif // Set thermocouple above max temperature (TMAX) - max_tc_temp = THERMO_SEL(TEMP_SENSOR_0_MAX_TC_TMAX, TEMP_SENSOR_1_MAX_TC_TMAX) << (MAX_TC_DISCARD_BITS + 1); + max_tc_temp = THERMO_SEL(TEMP_SENSOR_0_MAX_TC_TMAX, TEMP_SENSOR_1_MAX_TC_TMAX, TEMP_SENSOR_2_MAX_TC_TMAX) << (MAX_TC_DISCARD_BITS + 1); } } else { @@ -3155,6 +3224,10 @@ void Temperature::update_raw_temperatures() { temp_hotend[1].update(); #endif + #if HAS_TEMP_ADC_2 && !TEMP_SENSOR_IS_MAX_TC(2) + temp_hotend[2].update(); + #endif + #if HAS_TEMP_ADC_REDUNDANT && !TEMP_SENSOR_IS_MAX_TC(REDUNDANT) temp_redundant.update(); #endif From 2cad4420fdd0bbc10da521cc6cdf8e65c5a021fb Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sun, 23 Oct 2022 00:34:38 +0000 Subject: [PATCH 027/109] [cron] Bump distribution date (2022-10-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 5b21d2209e..87c29ae7ea 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-10-22" +//#define STRING_DISTRIBUTION_DATE "2022-10-23" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 05776b4a80..a96140bbc1 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-10-22" + #define STRING_DISTRIBUTION_DATE "2022-10-23" #endif /** From aaf34fa96bf3da9cf7c95a41ccb7e5bc441dbd20 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 22 Oct 2022 23:35:31 -0500 Subject: [PATCH 028/109] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20M593=20report?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/feature/input_shaping/M593.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Marlin/src/gcode/feature/input_shaping/M593.cpp b/Marlin/src/gcode/feature/input_shaping/M593.cpp index 84301963cb..e1e99ca51b 100644 --- a/Marlin/src/gcode/feature/input_shaping/M593.cpp +++ b/Marlin/src/gcode/feature/input_shaping/M593.cpp @@ -30,13 +30,14 @@ void GcodeSuite::M593_report(const bool forReplay/*=true*/) { report_heading_etc(forReplay, F("Input Shaping")); #if HAS_SHAPING_X - SERIAL_ECHO_MSG("M593 X" + SERIAL_ECHOLNPGM(" M593 X" " F", stepper.get_shaping_frequency(X_AXIS), " D", stepper.get_shaping_damping_ratio(X_AXIS) ); #endif #if HAS_SHAPING_Y - SERIAL_ECHO_MSG("M593 Y" + TERN_(HAS_SHAPING_X, report_echo_start(forReplay)); + SERIAL_ECHOLNPGM(" M593 Y" " F", stepper.get_shaping_frequency(Y_AXIS), " D", stepper.get_shaping_damping_ratio(Y_AXIS) ); From 248236b1a763b02f7f15ec8cb6f39bd301aaa956 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Mon, 24 Oct 2022 00:36:39 +0000 Subject: [PATCH 029/109] [cron] Bump distribution date (2022-10-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 87c29ae7ea..1738b263d6 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-10-23" +//#define STRING_DISTRIBUTION_DATE "2022-10-24" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index a96140bbc1..0fefc64297 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-10-23" + #define STRING_DISTRIBUTION_DATE "2022-10-24" #endif /** From cf2311f768b939940a1846c3930c95bb7119eb46 Mon Sep 17 00:00:00 2001 From: Manuel McLure Date: Mon, 24 Oct 2022 14:25:47 -0700 Subject: [PATCH 030/109] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20spurious=20"bad=20?= =?UTF-8?q?command"=20(#24923)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/bedlevel/ubl/ubl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.cpp b/Marlin/src/feature/bedlevel/ubl/ubl.cpp index 2aa50be34d..f2af1445b1 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl.cpp @@ -260,7 +260,7 @@ bool unified_bed_leveling::sanity_check() { */ void GcodeSuite::M1004() { - #define ALIGN_GCODE TERN(Z_STEPPER_AUTO_ALIGN, "G34", "") + #define ALIGN_GCODE TERN(Z_STEPPER_AUTO_ALIGN, "G34\n", "") #define PROBE_GCODE TERN(HAS_BED_PROBE, "G29P1\nG29P3", "G29P4R") #if HAS_HOTEND @@ -280,7 +280,7 @@ bool unified_bed_leveling::sanity_check() { #endif process_subcommands_now(FPSTR(G28_STR)); // Home - process_subcommands_now(F(ALIGN_GCODE "\n" // Align multi z axis if available + process_subcommands_now(F(ALIGN_GCODE // Align multi z axis if available PROBE_GCODE "\n" // Build mesh with available hardware "G29P3\nG29P3")); // Ensure mesh is complete by running smart fill twice From 81f88fefdc1d32fade897ddd0daff604c92b5da0 Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Mon, 24 Oct 2022 17:44:52 -0400 Subject: [PATCH 031/109] =?UTF-8?q?=F0=9F=90=9B=20Fix=20FTDUI=20Status=20S?= =?UTF-8?q?creen=20Timeout=20(#24899)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Conditionals_post.h | 4 ++-- .../ftdi_eve_touch_ui/generic/base_screen.cpp | 18 +++++++++++------- .../ftdi_eve_touch_ui/generic/base_screen.h | 2 +- Marlin/src/lcd/marlinui.cpp | 4 ++-- Marlin/src/lcd/marlinui.h | 8 ++++---- Marlin/src/lcd/menu/menu.cpp | 6 +++--- 6 files changed, 23 insertions(+), 19 deletions(-) diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 5f54039392..9f41390db9 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -3689,13 +3689,13 @@ #endif #endif -#if HAS_MARLINUI_MENU +#if EITHER(HAS_MARLINUI_MENU, TOUCH_UI_FTDI_EVE) // LCD timeout to status screen default is 15s #ifndef LCD_TIMEOUT_TO_STATUS #define LCD_TIMEOUT_TO_STATUS 15000 #endif #if LCD_TIMEOUT_TO_STATUS - #define SCREENS_CAN_TIME_OUT 1 + #define HAS_SCREEN_TIMEOUT 1 #endif #endif diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/base_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/base_screen.cpp index 0a8bebea3c..4e5a3fec2f 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/base_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/base_screen.cpp @@ -45,15 +45,16 @@ bool BaseScreen::buttonStyleCallback(CommandProcessor &cmd, uint8_t tag, uint8_t return false; } - #if SCREENS_CAN_TIME_OUT + #if HAS_SCREEN_TIMEOUT if (EventLoop::get_pressed_tag() != 0) { + #if ENABLED(TOUCH_UI_DEBUG) + SERIAL_ECHO_MSG("buttonStyleCallback, resetting timeout"); + #endif reset_menu_timeout(); } #endif - if (buttonIsPressed(tag)) { - options = OPT_FLAT; - } + if (buttonIsPressed(tag)) options = OPT_FLAT; if (style & cmd.STYLE_DISABLED) { cmd.tag(0); @@ -65,7 +66,10 @@ bool BaseScreen::buttonStyleCallback(CommandProcessor &cmd, uint8_t tag, uint8_t } void BaseScreen::onIdle() { - #if SCREENS_CAN_TIME_OUT + #if HAS_SCREEN_TIMEOUT + if (EventLoop::get_pressed_tag() != 0) + reset_menu_timeout(); + if ((millis() - last_interaction) > LCD_TIMEOUT_TO_STATUS) { reset_menu_timeout(); #if ENABLED(TOUCH_UI_DEBUG) @@ -77,10 +81,10 @@ void BaseScreen::onIdle() { } void BaseScreen::reset_menu_timeout() { - TERN_(SCREENS_CAN_TIME_OUT, last_interaction = millis()); + TERN_(HAS_SCREEN_TIMEOUT, last_interaction = millis()); } -#if SCREENS_CAN_TIME_OUT +#if HAS_SCREEN_TIMEOUT uint32_t BaseScreen::last_interaction; #endif diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/base_screen.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/base_screen.h index 030fa51a2a..4b29bf1e41 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/base_screen.h +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/base_screen.h @@ -27,7 +27,7 @@ class BaseScreen : public UIScreen { protected: - #if SCREENS_CAN_TIME_OUT + #if HAS_SCREEN_TIMEOUT static uint32_t last_interaction; #endif diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index c885e83845..0dfe60d8e4 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -316,7 +316,7 @@ void MarlinUI::init() { #endif #endif - #if SCREENS_CAN_TIME_OUT + #if HAS_SCREEN_TIMEOUT bool MarlinUI::defer_return_to_status; millis_t MarlinUI::return_to_status_ms = 0; #endif @@ -1171,7 +1171,7 @@ void MarlinUI::init() { NOLESS(max_display_update_time, millis() - ms); } - #if SCREENS_CAN_TIME_OUT + #if HAS_SCREEN_TIMEOUT // Return to Status Screen after a timeout if (on_status_screen() || defer_return_to_status) reset_status_timeout(ms); diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index b1a98248bb..ec19f8bd34 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -545,7 +545,7 @@ public: #endif static void reset_status_timeout(const millis_t ms) { - TERN(SCREENS_CAN_TIME_OUT, return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS, UNUSED(ms)); + TERN(HAS_SCREEN_TIMEOUT, return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS, UNUSED(ms)); } #if HAS_MARLINUI_MENU @@ -596,11 +596,11 @@ public: #endif FORCE_INLINE static bool screen_is_sticky() { - return TERN1(SCREENS_CAN_TIME_OUT, defer_return_to_status); + return TERN1(HAS_SCREEN_TIMEOUT, defer_return_to_status); } FORCE_INLINE static void defer_status_screen(const bool defer=true) { - TERN(SCREENS_CAN_TIME_OUT, defer_return_to_status = defer, UNUSED(defer)); + TERN(HAS_SCREEN_TIMEOUT, defer_return_to_status = defer, UNUSED(defer)); } static void goto_previous_screen_no_defer() { @@ -778,7 +778,7 @@ public: private: - #if SCREENS_CAN_TIME_OUT + #if HAS_SCREEN_TIMEOUT static millis_t return_to_status_ms; static bool defer_return_to_status; #else diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp index 7ae1078f4d..6389383d28 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -61,7 +61,7 @@ typedef struct { screenFunc_t menu_function; // The screen's function uint32_t encoder_position; // The position of the encoder int8_t top_line, items; // The amount of scroll, and the number of items - #if SCREENS_CAN_TIME_OUT + #if HAS_SCREEN_TIMEOUT bool sticky; // The screen is sticky #endif } menuPosition; @@ -89,7 +89,7 @@ void MarlinUI::return_to_status() { goto_screen(status_screen); } void MarlinUI::push_current_screen() { if (screen_history_depth < COUNT(screen_history)) - screen_history[screen_history_depth++] = { currentScreen, encoderPosition, encoderTopLine, screen_items OPTARG(SCREENS_CAN_TIME_OUT, screen_is_sticky()) }; + screen_history[screen_history_depth++] = { currentScreen, encoderPosition, encoderTopLine, screen_items OPTARG(HAS_SCREEN_TIMEOUT, screen_is_sticky()) }; } void MarlinUI::_goto_previous_screen(TERN_(TURBO_BACK_MENU_ITEM, const bool is_back/*=false*/)) { @@ -102,7 +102,7 @@ void MarlinUI::_goto_previous_screen(TERN_(TURBO_BACK_MENU_ITEM, const bool is_b is_back ? 0 : sh.top_line, sh.items ); - defer_status_screen(TERN_(SCREENS_CAN_TIME_OUT, sh.sticky)); + defer_status_screen(TERN_(HAS_SCREEN_TIMEOUT, sh.sticky)); } else return_to_status(); From f4dc9d572be3b9858539a5115f275e4b6e626f8e Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Tue, 25 Oct 2022 10:47:23 +1300 Subject: [PATCH 032/109] =?UTF-8?q?=F0=9F=90=9B=20Fix=20move=5Fextruder=5F?= =?UTF-8?q?servo=20(#24908)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/tool_change.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index 80aedd3bdd..cd18462be3 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -115,7 +115,7 @@ void move_extruder_servo(const uint8_t e) { planner.synchronize(); - if ((EXTRUDERS & 1) && e < EXTRUDERS - 1) { + if (e < EXTRUDERS) { servo[_SERVO_NR(e)].move(servo_angles[_SERVO_NR(e)][e & 1]); safe_delay(500); } From 6e1f0be215235c96113c74a6fda345e11626ce28 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 24 Oct 2022 17:04:55 -0500 Subject: [PATCH 033/109] =?UTF-8?q?=F0=9F=A9=B9=20Allow=20for=20last=20non?= =?UTF-8?q?-servo=20extruder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/tool_change.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index cd18462be3..a0939d155a 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -115,7 +115,8 @@ void move_extruder_servo(const uint8_t e) { planner.synchronize(); - if (e < EXTRUDERS) { + constexpr bool evenExtruders = !(EXTRUDERS & 1); + if (evenExtruders || e < EXTRUDERS - 1) { servo[_SERVO_NR(e)].move(servo_angles[_SERVO_NR(e)][e & 1]); safe_delay(500); } From 6b4d7b9151d260d3109ca857d084e3ca0cd8b048 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 25 Oct 2022 00:37:23 +0000 Subject: [PATCH 034/109] [cron] Bump distribution date (2022-10-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 1738b263d6..91f86174d3 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-10-24" +//#define STRING_DISTRIBUTION_DATE "2022-10-25" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 0fefc64297..32bb738d24 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-10-24" + #define STRING_DISTRIBUTION_DATE "2022-10-25" #endif /** From a9fe4473134c1765ba21d5947f5bf7cb504f553a Mon Sep 17 00:00:00 2001 From: Justin Hartmann Date: Sat, 29 Oct 2022 19:37:36 -0400 Subject: [PATCH 035/109] =?UTF-8?q?=F0=9F=A9=B9=20Buttons=20Followup=20(#2?= =?UTF-8?q?4935)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #24878 --- Marlin/src/lcd/buttons.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Marlin/src/lcd/buttons.h b/Marlin/src/lcd/buttons.h index cb6348dc2d..67b7aa3944 100644 --- a/Marlin/src/lcd/buttons.h +++ b/Marlin/src/lcd/buttons.h @@ -191,19 +191,19 @@ #define _BUTTON_PRESSED_UP false #endif #if BUTTON_EXISTS(DOWN) - #define _BUTTON_PRESSED_DWN _BUTTON_PRESSED(DOWN) + #define _BUTTON_PRESSED_DOWN _BUTTON_PRESSED(DOWN) #else - #define _BUTTON_PRESSED_DWN false + #define _BUTTON_PRESSED_DOWN false #endif #if BUTTON_EXISTS(LEFT) - #define _BUTTON_PRESSED_LFT _BUTTON_PRESSED(LEFT) + #define _BUTTON_PRESSED_LEFT _BUTTON_PRESSED(LEFT) #else - #define _BUTTON_PRESSED_LFT false + #define _BUTTON_PRESSED_LEFT false #endif #if BUTTON_EXISTS(RIGHT) - #define _BUTTON_PRESSED_RT _BUTTON_PRESSED(RIGHT) + #define _BUTTON_PRESSED_RIGHT _BUTTON_PRESSED(RIGHT) #else - #define _BUTTON_PRESSED_RT false + #define _BUTTON_PRESSED_RIGHT false #endif #if BUTTON_EXISTS(BACK) #define _BUTTON_PRESSED_BACK _BUTTON_PRESSED(BACK) From d3e3a640921225828a817d0da06fa26083ef0062 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Sat, 29 Oct 2022 16:39:26 -0700 Subject: [PATCH 036/109] =?UTF-8?q?=F0=9F=94=A7=20Update=20Display=20Sleep?= =?UTF-8?q?=20LCD=20Check=20(#24934)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/SanityCheck.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 744e68a5bb..63b719f1c2 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -3118,7 +3118,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS * Display Sleep is not supported by these common displays */ #if HAS_DISPLAY_SLEEP - #if ANY(IS_U8GLIB_LM6059_AF, IS_U8GLIB_ST7565_64128, REPRAPWORLD_GRAPHICAL_LCD, FYSETC_MINI, CR10_STOCKDISPLAY, ENDER2_STOCKDISPLAY, MINIPANEL) + #if ANY(IS_U8GLIB_LM6059_AF, IS_U8GLIB_ST7565_64128, REPRAPWORLD_GRAPHICAL_LCD, FYSETC_MINI_12864, CR10_STOCKDISPLAY, MINIPANEL) #error "DISPLAY_SLEEP_MINUTES is not supported by your display." #elif !WITHIN(DISPLAY_SLEEP_MINUTES, 0, 255) #error "DISPLAY_SLEEP_MINUTES must be between 0 and 255." From 1ef6ddccbee4119e4b2c870554a77d4062c6e22e Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sun, 30 Oct 2022 12:42:36 +1300 Subject: [PATCH 037/109] =?UTF-8?q?=F0=9F=93=8C=20Remove=20unused=20RX/TX?= =?UTF-8?q?=20pins=20(#24932)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/pins_postprocess.h | 70 ++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/Marlin/src/pins/pins_postprocess.h b/Marlin/src/pins/pins_postprocess.h index c3c217557b..7656037f3d 100644 --- a/Marlin/src/pins/pins_postprocess.h +++ b/Marlin/src/pins/pins_postprocess.h @@ -307,6 +307,76 @@ #define E7_CS_PIN -1 #endif +// +// Destroy stepper driver RX and TX pins when set to -1 +// +#if !PIN_EXISTS(Z2_SERIAL_TX) + #undef Z2_SERIAL_TX_PIN +#endif +#if !PIN_EXISTS(Z2_SERIAL_RX) + #undef Z2_SERIAL_RX_PIN +#endif +#if !PIN_EXISTS(Z3_SERIAL_TX) + #undef Z3_SERIAL_TX_PIN +#endif +#if !PIN_EXISTS(Z3_SERIAL_RX) + #undef Z3_SERIAL_RX_PIN +#endif +#if !PIN_EXISTS(Z4_SERIAL_TX) + #undef Z4_SERIAL_TX_PIN +#endif +#if !PIN_EXISTS(Z4_SERIAL_RX) + #undef Z4_SERIAL_RX_PIN +#endif +#if !PIN_EXISTS(X2_SERIAL_TX) + #undef X2_SERIAL_TX_PIN +#endif +#if !PIN_EXISTS(X2_SERIAL_RX) + #undef X2_SERIAL_RX_PIN +#endif +#if !PIN_EXISTS(Y2_SERIAL_TX) + #undef Y2_SERIAL_TX_PIN +#endif +#if !PIN_EXISTS(Y2_SERIAL_RX) + #undef Y2_SERIAL_RX_PIN +#endif +#if !PIN_EXISTS(I_SERIAL_TX) + #undef I_SERIAL_TX_PIN +#endif +#if !PIN_EXISTS(I_SERIAL_RX) + #undef I_SERIAL_RX_PIN +#endif +#if !PIN_EXISTS(J_SERIAL_TX) + #undef J_SERIAL_TX_PIN +#endif +#if !PIN_EXISTS(J_SERIAL_RX) + #undef J_SERIAL_RX_PIN +#endif +#if !PIN_EXISTS(K_SERIAL_TX) + #undef K_SERIAL_TX_PIN +#endif +#if !PIN_EXISTS(K_SERIAL_RX) + #undef K_SERIAL_RX_PIN +#endif +#if !PIN_EXISTS(U_SERIAL_TX) + #undef U_SERIAL_TX_PIN +#endif +#if !PIN_EXISTS(U_SERIAL_RX) + #undef U_SERIAL_RX_PIN +#endif +#if !PIN_EXISTS(V_SERIAL_TX) + #undef V_SERIAL_TX_PIN +#endif +#if !PIN_EXISTS(V_SERIAL_RX) + #undef V_SERIAL_RX_PIN +#endif +#if !PIN_EXISTS(W_SERIAL_TX) + #undef W_SERIAL_TX_PIN +#endif +#if !PIN_EXISTS(W_SERIAL_RX) + #undef W_SERIAL_RX_PIN +#endif + #ifndef FAN_PIN #define FAN_PIN -1 #endif From 846f88526f78b39a6bff3cbf3d27d1dabf21ad68 Mon Sep 17 00:00:00 2001 From: Giuliano Zaro <3684609+GMagician@users.noreply.github.com> Date: Sun, 30 Oct 2022 01:45:33 +0200 Subject: [PATCH 038/109] =?UTF-8?q?=F0=9F=8C=90=20Update=20Italian=20langu?= =?UTF-8?q?age=20(#24915)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/language/language_it.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index 0c1b3a8cee..1fcf07dbc7 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -178,7 +178,7 @@ namespace Language_it { LSTR MSG_MESH_AMAX = _UxGT("Massimizza area"); LSTR MSG_MESH_CENTER = _UxGT("Area centrale"); LSTR MSG_MESH_EDIT_Z = _UxGT("Valore di Z"); - LSTR MSG_MESH_CANCEL = _UxGT("Mesh cancellato"); + LSTR MSG_MESH_CANCEL = _UxGT("Mesh cancellata"); LSTR MSG_CUSTOM_COMMANDS = _UxGT("Comandi personaliz."); LSTR MSG_M48_TEST = _UxGT("Test sonda M48"); LSTR MSG_M48_POINT = _UxGT("Punto M48"); @@ -251,6 +251,7 @@ namespace Language_it { LSTR MSG_UBL_SMART_FILLIN = _UxGT("Riempimento Smart"); LSTR MSG_UBL_FILLIN_MESH = _UxGT("Riempimento Mesh"); LSTR MSG_UBL_MESH_FILLED = _UxGT("Pts mancanti riempiti"); + LSTR MSG_UBL_MESH_INVALID = _UxGT("Mesh non valida"); LSTR MSG_UBL_INVALIDATE_ALL = _UxGT("Invalida Tutto"); LSTR MSG_UBL_INVALIDATE_CLOSEST = _UxGT("Invalid.Punto Vicino"); LSTR MSG_UBL_FINE_TUNE_ALL = _UxGT("Ritocca Tutto"); @@ -395,6 +396,11 @@ namespace Language_it { LSTR MSG_AMAX_EN = _UxGT("Acc.Massima *"); LSTR MSG_A_RETRACT = _UxGT("A-Ritrazione"); LSTR MSG_A_TRAVEL = _UxGT("A-Spostamento"); + LSTR MSG_INPUT_SHAPING = _UxGT("Input Shaping"); + LSTR MSG_SHAPING_X_FREQ = _UxGT("Frequenza ") STR_X; + LSTR MSG_SHAPING_Y_FREQ = _UxGT("Frequenza ") STR_Y; + LSTR MSG_SHAPING_X_ZETA = _UxGT("Smorzamento ") STR_X; + LSTR MSG_SHAPING_Y_ZETA = _UxGT("Smorzamento ") STR_Y; LSTR MSG_XY_FREQUENCY_LIMIT = _UxGT("Frequenza max"); LSTR MSG_XY_FREQUENCY_FEEDRATE = _UxGT("Feed min"); LSTR MSG_STEPS_PER_MM = _UxGT("Passi/mm"); @@ -414,6 +420,12 @@ namespace Language_it { LSTR MSG_FILAMENT_DIAM_E = _UxGT("Diam. filo *"); LSTR MSG_FILAMENT_UNLOAD = _UxGT("Rimuovi mm"); LSTR MSG_FILAMENT_LOAD = _UxGT("Carica mm"); + LSTR MSG_SEGMENTS_PER_SECOND = _UxGT("Segmenti/Sec"); + LSTR MSG_DRAW_MIN_X = _UxGT("Min X area disegno"); + LSTR MSG_DRAW_MAX_X = _UxGT("Max X area disegno"); + LSTR MSG_DRAW_MIN_Y = _UxGT("Min Y area disegno"); + LSTR MSG_DRAW_MAX_Y = _UxGT("Max Y area disegno"); + LSTR MSG_MAX_BELT_LEN = _UxGT("Lungh.max cinghia"); LSTR MSG_ADVANCE_K = _UxGT("K Avanzamento"); LSTR MSG_ADVANCE_K_E = _UxGT("K Avanzamento *"); LSTR MSG_CONTRAST = _UxGT("Contrasto LCD"); @@ -506,9 +518,10 @@ namespace Language_it { LSTR MSG_TOOL_CHANGE = _UxGT("Cambio utensile"); LSTR MSG_TOOL_CHANGE_ZLIFT = _UxGT("Risalita Z"); LSTR MSG_SINGLENOZZLE_PRIME_SPEED = _UxGT("Velocità innesco"); + LSTR MSG_SINGLENOZZLE_WIPE_RETRACT = _UxGT("Ritrazione pulizia"); LSTR MSG_SINGLENOZZLE_RETRACT_SPEED = _UxGT("Velocità ritrazione"); LSTR MSG_FILAMENT_PARK_ENABLED = _UxGT("Parcheggia testa"); - LSTR MSG_SINGLENOZZLE_UNRETRACT_SPEED = _UxGT("Recover Speed"); + LSTR MSG_SINGLENOZZLE_UNRETRACT_SPEED = _UxGT("Veloc. di recupero"); LSTR MSG_SINGLENOZZLE_FAN_SPEED = _UxGT("Velocità ventola"); LSTR MSG_SINGLENOZZLE_FAN_TIME = _UxGT("Tempo ventola"); LSTR MSG_TOOL_MIGRATION_ON = _UxGT("Auto ON"); From c1bc34daa7322ba4c82f9fefebd401b47996485d Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sun, 30 Oct 2022 00:36:21 +0000 Subject: [PATCH 039/109] [cron] Bump distribution date (2022-10-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 91f86174d3..65b25abd3d 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-10-25" +//#define STRING_DISTRIBUTION_DATE "2022-10-30" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 32bb738d24..f9edbef19d 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-10-25" + #define STRING_DISTRIBUTION_DATE "2022-10-30" #endif /** From 4bee77d470062b3588008156cd0140fc98de8cee Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Sat, 29 Oct 2022 23:35:12 -0400 Subject: [PATCH 040/109] =?UTF-8?q?=E2=9C=A8=20Tenlog=20MB1V23=20IDEX=20bo?= =?UTF-8?q?ard=20(#24896)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Makefile | 16 +- Marlin/src/core/boards.h | 15 +- Marlin/src/pins/pins.h | 2 + Marlin/src/pins/ramps/pins_TENLOG_MB1_V23.h | 155 ++++++++++++++++++++ 4 files changed, 174 insertions(+), 14 deletions(-) create mode 100644 Marlin/src/pins/ramps/pins_TENLOG_MB1_V23.h diff --git a/Marlin/Makefile b/Marlin/Makefile index c72c1d5896..ca7cacaa6a 100644 --- a/Marlin/Makefile +++ b/Marlin/Makefile @@ -307,20 +307,22 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1154) else ifeq ($(HARDWARE_MOTHERBOARD),1155) # Tenlog D3 Hero IDEX printer else ifeq ($(HARDWARE_MOTHERBOARD),1156) -# Ramps S 1.2 by Sakul.cz (Power outputs: Hotend0, Hotend1, Fan, Bed) +# Tenlog D3,5,6 Pro IDEX printers else ifeq ($(HARDWARE_MOTHERBOARD),1157) -# Ramps S 1.2 by Sakul.cz (Power outputs: Hotend0, Hotend1, Hotend2, Bed) +# Ramps S 1.2 by Sakul.cz (Power outputs: Hotend0, Hotend1, Fan, Bed) else ifeq ($(HARDWARE_MOTHERBOARD),1158) -# Ramps S 1.2 by Sakul.cz (Power outputs: Hotend, Fan0, Fan1, Bed) +# Ramps S 1.2 by Sakul.cz (Power outputs: Hotend0, Hotend1, Hotend2, Bed) else ifeq ($(HARDWARE_MOTHERBOARD),1159) -# Longer LK1 PRO / Alfawise U20 Pro (PRO version) +# Ramps S 1.2 by Sakul.cz (Power outputs: Hotend, Fan0, Fan1, Bed) else ifeq ($(HARDWARE_MOTHERBOARD),1160) -# Longer LKx PRO / Alfawise Uxx Pro (PRO version) +# Longer LK1 PRO / Alfawise U20 Pro (PRO version) else ifeq ($(HARDWARE_MOTHERBOARD),1161) -# Zonestar zrib V5.3 (Chinese RAMPS replica) +# Longer LKx PRO / Alfawise Uxx Pro (PRO version) else ifeq ($(HARDWARE_MOTHERBOARD),1162) -# Pxmalion Core I3 +# Zonestar zrib V5.3 (Chinese RAMPS replica) else ifeq ($(HARDWARE_MOTHERBOARD),1163) +# Pxmalion Core I3 +else ifeq ($(HARDWARE_MOTHERBOARD),1164) # # RAMBo and derivatives diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index c993b9df0e..b5f5b037f9 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -110,13 +110,14 @@ #define BOARD_COPYMASTER_3D 1154 // Copymaster 3D #define BOARD_ORTUR_4 1155 // Ortur 4 #define BOARD_TENLOG_D3_HERO 1156 // Tenlog D3 Hero IDEX printer -#define BOARD_RAMPS_S_12_EEFB 1157 // Ramps S 1.2 by Sakul.cz (Power outputs: Hotend0, Hotend1, Fan, Bed) -#define BOARD_RAMPS_S_12_EEEB 1158 // Ramps S 1.2 by Sakul.cz (Power outputs: Hotend0, Hotend1, Hotend2, Bed) -#define BOARD_RAMPS_S_12_EFFB 1159 // Ramps S 1.2 by Sakul.cz (Power outputs: Hotend, Fan0, Fan1, Bed) -#define BOARD_LONGER3D_LK1_PRO 1160 // Longer LK1 PRO / Alfawise U20 Pro (PRO version) -#define BOARD_LONGER3D_LKx_PRO 1161 // Longer LKx PRO / Alfawise Uxx Pro (PRO version) -#define BOARD_ZRIB_V53 1162 // Zonestar zrib V5.3 (Chinese RAMPS replica) -#define BOARD_PXMALION_CORE_I3 1163 // Pxmalion Core I3 +#define BOARD_TENLOG_MB1_V23 1157 // Tenlog D3, D5, D6 IDEX Printer +#define BOARD_RAMPS_S_12_EEFB 1158 // Ramps S 1.2 by Sakul.cz (Power outputs: Hotend0, Hotend1, Fan, Bed) +#define BOARD_RAMPS_S_12_EEEB 1159 // Ramps S 1.2 by Sakul.cz (Power outputs: Hotend0, Hotend1, Hotend2, Bed) +#define BOARD_RAMPS_S_12_EFFB 1160 // Ramps S 1.2 by Sakul.cz (Power outputs: Hotend, Fan0, Fan1, Bed) +#define BOARD_LONGER3D_LK1_PRO 1161 // Longer LK1 PRO / Alfawise U20 Pro (PRO version) +#define BOARD_LONGER3D_LKx_PRO 1162 // Longer LKx PRO / Alfawise Uxx Pro (PRO version) +#define BOARD_ZRIB_V53 1163 // Zonestar zrib V5.3 (Chinese RAMPS replica) +#define BOARD_PXMALION_CORE_I3 1164 // Pxmalion Core I3 // // RAMBo and derivatives diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 046957e1ba..909ae992a9 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -195,6 +195,8 @@ #include "ramps/pins_ORTUR_4.h" // ATmega2560 env:mega2560 #elif MB(TENLOG_D3_HERO) #include "ramps/pins_TENLOG_D3_HERO.h" // ATmega2560 env:mega2560 +#elif MB(TENLOG_MB1_V23) + #include "ramps/pins_TENLOG_MB1_V23.h" // ATmega2560 env:mega2560 #elif MB(MKS_GEN_L_V21) #include "ramps/pins_MKS_GEN_L_V21.h" // ATmega2560 env:mega2560 #elif MB(RAMPS_S_12_EEFB, RAMPS_S_12_EEEB, RAMPS_S_12_EFFB) diff --git a/Marlin/src/pins/ramps/pins_TENLOG_MB1_V23.h b/Marlin/src/pins/ramps/pins_TENLOG_MB1_V23.h new file mode 100644 index 0000000000..b3f7d5f216 --- /dev/null +++ b/Marlin/src/pins/ramps/pins_TENLOG_MB1_V23.h @@ -0,0 +1,155 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * Tenlog pin assignments + */ + +#define REQUIRE_MEGA2560 +#include "env_validate.h" + +#if HOTENDS > 2 || E_STEPPERS > 2 + #error "Tenlog supports up to 2 hotends / E steppers." +#endif + +#define BOARD_INFO_NAME "Tenlog MB1 V2.3" +#define DEFAULT_MACHINE_NAME BOARD_INFO_NAME + +// +// Limit Switches +// +#define X_MIN_PIN 3 +#define X_MAX_PIN 2 +#define Y_MIN_PIN 14 +//#define Y_MAX_PIN 15 // Connected to "DJ" plug on extruder heads +#define Z_MIN_PIN 18 +#if ENABLED(BLTOUCH) + #define SERVO0_PIN 19 +#else + #define Z_MAX_PIN 19 +#endif + +// +// Steppers +// +#define X_STEP_PIN 54 +#define X_DIR_PIN 55 +#define X_ENABLE_PIN 38 + +#define X2_STEP_PIN 36 +#define X2_DIR_PIN 34 +#define X2_ENABLE_PIN 30 + +#define Y_STEP_PIN 60 +#define Y_DIR_PIN 61 +#define Y_ENABLE_PIN 56 + +#define Z_STEP_PIN 46 +#define Z_DIR_PIN 48 +#define Z_ENABLE_PIN 62 + +#define Z2_STEP_PIN 65 +#define Z2_DIR_PIN 66 +#define Z2_ENABLE_PIN 64 + +#define E0_STEP_PIN 57 +#define E0_DIR_PIN 58 +#define E0_ENABLE_PIN 59 + +#define E1_STEP_PIN 26 +#define E1_DIR_PIN 28 +#define E1_ENABLE_PIN 24 + +// +// Temperature Sensors +// +#define TEMP_0_PIN 15 // Analog Input +#define TEMP_1_PIN 13 // Analog Input +#define TEMP_BED_PIN 14 // Analog Input + +// +// Heaters / Fans +// +#define HEATER_0_PIN 11 +#define HEATER_1_PIN 10 +#define HEATER_BED_PIN 8 + +#define FAN_PIN 9 +#define FAN2_PIN 5 // Normally this would be a servo pin + +//#define NUM_RUNOUT_SENSORS 0 +#define FIL_RUNOUT_PIN 15 +//#define FIL_RUNOUT2_PIN 21 + +// +// PSU and Powerloss Recovery +// +#if ENABLED(PSU_CONTROL) + #define PS_ON_PIN 40 // The M80/M81 PSU pin for boards v2.1-2.3 +#endif + +// +// Misc. Functions +// +//#define CASE_LIGHT_PIN 5 +//#ifndef LED_PIN +// #define LED_PIN 13 +//#endif + +#if HAS_CUTTER + //#define SPINDLE_LASER_PWM_PIN -1 // Hardware PWM + //#define SPINDLE_LASER_ENA_PIN 4 // Pullup! +#endif + +// Use the RAMPS 1.4 Analog input 5 on the AUX2 connector +//#define FILWIDTH_PIN 5 // Analog Input + +#define SDSS 53 +#define SD_DETECT_PIN 49 + +// +// LCD / Controller +// + +//#if IS_RRD_SC + +//#ifndef BEEPER_PIN +// #define BEEPER_PIN -1 +//#endif + +#define LCD_PINS_RS -1 +#define LCD_PINS_ENABLE -1 +#define LCD_PINS_D4 -1 +#define LCD_PINS_D5 -1 +#define LCD_PINS_D6 -1 +#define LCD_PINS_D7 -1 + +//#define BTN_EN1 31 +//#define BTN_EN2 33 +//#define BTN_ENC 35 + +//#ifndef KILL_PIN +// #define KILL_PIN 41 +//#endif + +//#endif // IS_RRD_SC From b20db2e1a30c6fc8a929f25739a2e6d6e2b599e2 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sun, 30 Oct 2022 16:45:08 +1300 Subject: [PATCH 041/109] =?UTF-8?q?=F0=9F=93=8C=20ZRIB=20V52-V53=20Servo?= =?UTF-8?q?=20Pins=20(#24880)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/ramps/pins_ZRIB_V52.h | 19 +++++++++++-------- Marlin/src/pins/ramps/pins_ZRIB_V53.h | 12 +++--------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/Marlin/src/pins/ramps/pins_ZRIB_V52.h b/Marlin/src/pins/ramps/pins_ZRIB_V52.h index 2df789cd6f..44e0beaa9f 100644 --- a/Marlin/src/pins/ramps/pins_ZRIB_V52.h +++ b/Marlin/src/pins/ramps/pins_ZRIB_V52.h @@ -47,6 +47,16 @@ #define E2_DIR_PIN 5 #define E2_ENABLE_PIN 22 +// +// Servos / XS3 Connector +// +#ifndef SERVO0_PIN + #define SERVO0_PIN 65 // PWM +#endif +#ifndef SERVO1_PIN + #define SERVO1_PIN 66 // PWM +#endif + #include "pins_MKS_BASE_common.h" // ... RAMPS /** @@ -78,20 +88,13 @@ * | GND | * ========== * - * XS3 Connector + * Servos / XS3 Connector * ================= * | 65 | GND | 5V | (65) PK3 ** Pin86 ** A11 * |----|-----|----| * | 66 | GND | 5V | (66) PK4 ** Pin85 ** A12 * ================= * - * Servos Connector - * ================= - * | 11 | GND | 5V | (11) PB5 ** Pin24 ** PWM11 - * |----|-----|----| - * | 12 | GND | 5V | (12) PB6 ** Pin25 ** PWM12 - * ================= - * * ICSP * ================= * | 5V | 51 | GND | (51) PB2 ** Pin21 ** SPI_MOSI diff --git a/Marlin/src/pins/ramps/pins_ZRIB_V53.h b/Marlin/src/pins/ramps/pins_ZRIB_V53.h index cae71f7a8f..7a5cf14791 100644 --- a/Marlin/src/pins/ramps/pins_ZRIB_V53.h +++ b/Marlin/src/pins/ramps/pins_ZRIB_V53.h @@ -62,10 +62,10 @@ // Servos / XS3 Connector // #ifndef SERVO0_PIN - #define SERVO0_PIN 11 // Analog Output + #define SERVO0_PIN 65 // PWM #endif #ifndef SERVO1_PIN - #define SERVO1_PIN 12 // Analog Output + #define SERVO1_PIN 66 // PWM #endif // @@ -424,18 +424,12 @@ * |--------| Power * | GND | * ========== - * XS3 Connector + * Servos / XS3 Connector * ================= * | 65 | GND | 5V | (65) PK3 ** Pin86 ** A11 * |----|-----|----| * | 66 | GND | 5V | (66) PK4 ** Pin85 ** A12 * ================= - * XS3/Servos Connector - * ================= - * | 11 | GND | 5V | (11) PB5 ** Pin24 ** PWM11 - * |----|-----|----| - * | 12 | GND | 5V | (12) PB6 ** Pin25 ** PWM12 - * ================= * ICSP * ================= * | 5V | 51 | GND | (51) PB2 ** Pin21 ** SPI_MOSI From 622e7952143f401e84dfff934cdc0a53c5f5d2a5 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 30 Oct 2022 15:41:19 -0500 Subject: [PATCH 042/109] =?UTF-8?q?=F0=9F=8E=A8=20Format=20some=20lib-uhs3?= =?UTF-8?q?=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../USB_HOST_SHIELD/USB_HOST_SHIELD_INLINE.h | 1564 ++++++++--------- 1 file changed, 781 insertions(+), 783 deletions(-) diff --git a/Marlin/src/sd/usb_flashdrive/lib-uhs3/UHS_host/USB_HOST_SHIELD/USB_HOST_SHIELD_INLINE.h b/Marlin/src/sd/usb_flashdrive/lib-uhs3/UHS_host/USB_HOST_SHIELD/USB_HOST_SHIELD_INLINE.h index 6cfc0152d0..57352a3518 100644 --- a/Marlin/src/sd/usb_flashdrive/lib-uhs3/UHS_host/USB_HOST_SHIELD/USB_HOST_SHIELD_INLINE.h +++ b/Marlin/src/sd/usb_flashdrive/lib-uhs3/UHS_host/USB_HOST_SHIELD/USB_HOST_SHIELD_INLINE.h @@ -1,270 +1,272 @@ -/* Copyright (C) 2015-2016 Andrew J. Kroll - and -Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. - -This software may be distributed and modified under the terms of the GNU -General Public License version 2 (GPL2) as publishe7d by the Free Software -Foundation and appearing in the file GPL2.TXT included in the packaging of -this file. Please note that GPL2 Section 2[b] requires that all works based -on this software must also be made publicly available under the terms of -the GPL2 ("Copyleft"). - -Contact information -------------------- - -Circuits At Home, LTD -Web : https://www.circuitsathome.com -e-mail : support@circuitsathome.com +/* + * Copyright (C) 2015-2016 Andrew J. Kroll + * and + * Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + * + * This software may be distributed and modified under the terms of the GNU + * General Public License version 2 (GPL2) as publishe7d by the Free Software + * Foundation and appearing in the file GPL2.TXT included in the packaging of + * this file. Please note that GPL2 Section 2[b] requires that all works based + * on this software must also be made publicly available under the terms of + * the GPL2 ("Copyleft"). + * + * Contact information + * ------------------- + * + * Circuits At Home, LTD + * Web : https://www.circuitsathome.com + * e-mail : support@circuitsathome.com + * */ #if defined(USB_HOST_SHIELD_H) && !defined(USB_HOST_SHIELD_LOADED) #define USB_HOST_SHIELD_LOADED + #include #ifndef digitalPinToInterrupt -#error digitalPinToInterrupt not defined, complain to your board maintainer. + #error digitalPinToInterrupt not defined, complain to your board maintainer. #endif #if USB_HOST_SHIELD_USE_ISR -// allow two slots. this makes the maximum allowed shield count TWO -// for AVRs this is limited to pins 2 and 3 ONLY -// for all other boards, one odd and one even pin number is allowed. -static MAX3421E_HOST *ISReven; -static MAX3421E_HOST *ISRodd; + // allow two slots. this makes the maximum allowed shield count TWO + // for AVRs this is limited to pins 2 and 3 ONLY + // for all other boards, one odd and one even pin number is allowed. + static MAX3421E_HOST *ISReven; + static MAX3421E_HOST *ISRodd; -static void UHS_NI call_ISReven() { - ISReven->ISRTask(); -} + static void UHS_NI call_ISReven() { + ISReven->ISRTask(); + } -static void UHS_NI call_ISRodd() { - UHS_PIN_WRITE(LED_BUILTIN, HIGH); - ISRodd->ISRTask(); -} + static void UHS_NI call_ISRodd() { + UHS_PIN_WRITE(LED_BUILTIN, HIGH); + ISRodd->ISRTask(); + } #endif void UHS_NI MAX3421E_HOST::resume_host() { - // Used on MCU that lack control of IRQ priority (AVR). - // Resumes ISRs. - // NOTE: you must track the state yourself! -#ifdef __AVR__ - noInterrupts(); - if(irq_pin & 1) { - ISRodd = this; - attachInterrupt(UHS_GET_DPI(irq_pin), call_ISRodd, IRQ_SENSE); - } else { - ISReven = this; - attachInterrupt(UHS_GET_DPI(irq_pin), call_ISReven, IRQ_SENSE); - } - interrupts(); -#endif - + // Used on MCU that lack control of IRQ priority (AVR). + // Resumes ISRs. + // NOTE: you must track the state yourself! + #ifdef __AVR__ + noInterrupts(); + if (irq_pin & 1) { + ISRodd = this; + attachInterrupt(UHS_GET_DPI(irq_pin), call_ISRodd, IRQ_SENSE); + } else { + ISReven = this; + attachInterrupt(UHS_GET_DPI(irq_pin), call_ISReven, IRQ_SENSE); + } + interrupts(); + #endif } + /* write single byte into MAX3421e register */ void UHS_NI MAX3421E_HOST::regWr(uint8_t reg, uint8_t data) { - SPIclass.beginTransaction(MAX3421E_SPI_Settings); - MARLIN_UHS_WRITE_SS(LOW); - SPIclass.transfer(reg | 0x02); - SPIclass.transfer(data); - MARLIN_UHS_WRITE_SS(HIGH); - SPIclass.endTransaction(); + SPIclass.beginTransaction(MAX3421E_SPI_Settings); + MARLIN_UHS_WRITE_SS(LOW); + SPIclass.transfer(reg | 0x02); + SPIclass.transfer(data); + MARLIN_UHS_WRITE_SS(HIGH); + SPIclass.endTransaction(); } - /* multiple-byte write */ /* returns a pointer to memory position after last written */ uint8_t* UHS_NI MAX3421E_HOST::bytesWr(uint8_t reg, uint8_t nbytes, uint8_t *data_p) { - SPIclass.beginTransaction(MAX3421E_SPI_Settings); - MARLIN_UHS_WRITE_SS(LOW); - SPIclass.transfer(reg | 0x02); - //printf("%2.2x :", reg); + SPIclass.beginTransaction(MAX3421E_SPI_Settings); + MARLIN_UHS_WRITE_SS(LOW); + SPIclass.transfer(reg | 0x02); + //printf("%2.2x :", reg); - while(nbytes) { - SPIclass.transfer(*data_p); - //printf("%2.2x ", *data_p); - nbytes--; - data_p++; // advance data pointer - } - MARLIN_UHS_WRITE_SS(HIGH); - SPIclass.endTransaction(); - //printf("\r\n"); - return (data_p); + while (nbytes) { + SPIclass.transfer(*data_p); + //printf("%2.2x ", *data_p); + nbytes--; + data_p++; // advance data pointer + } + MARLIN_UHS_WRITE_SS(HIGH); + SPIclass.endTransaction(); + //printf("\r\n"); + return (data_p); } + /* GPIO write */ /*GPIO byte is split between 2 registers, so two writes are needed to write one byte */ /* GPOUT bits are in the low nybble. 0-3 in IOPINS1, 4-7 in IOPINS2 */ void UHS_NI MAX3421E_HOST::gpioWr(uint8_t data) { - regWr(rIOPINS1, data); - data >>= 4; - regWr(rIOPINS2, data); - return; + regWr(rIOPINS1, data); + data >>= 4; + regWr(rIOPINS2, data); + return; } /* single host register read */ uint8_t UHS_NI MAX3421E_HOST::regRd(uint8_t reg) { - SPIclass.beginTransaction(MAX3421E_SPI_Settings); - MARLIN_UHS_WRITE_SS(LOW); - SPIclass.transfer(reg); - uint8_t rv = SPIclass.transfer(0); - MARLIN_UHS_WRITE_SS(HIGH); - SPIclass.endTransaction(); - return (rv); + SPIclass.beginTransaction(MAX3421E_SPI_Settings); + MARLIN_UHS_WRITE_SS(LOW); + SPIclass.transfer(reg); + uint8_t rv = SPIclass.transfer(0); + MARLIN_UHS_WRITE_SS(HIGH); + SPIclass.endTransaction(); + return (rv); } /* multiple-byte register read */ /* returns a pointer to a memory position after last read */ uint8_t* UHS_NI MAX3421E_HOST::bytesRd(uint8_t reg, uint8_t nbytes, uint8_t *data_p) { - SPIclass.beginTransaction(MAX3421E_SPI_Settings); - MARLIN_UHS_WRITE_SS(LOW); - SPIclass.transfer(reg); - while(nbytes) { - *data_p++ = SPIclass.transfer(0); - nbytes--; - } - MARLIN_UHS_WRITE_SS(HIGH); - SPIclass.endTransaction(); - return ( data_p); + SPIclass.beginTransaction(MAX3421E_SPI_Settings); + MARLIN_UHS_WRITE_SS(LOW); + SPIclass.transfer(reg); + while (nbytes) { + *data_p++ = SPIclass.transfer(0); + nbytes--; + } + MARLIN_UHS_WRITE_SS(HIGH); + SPIclass.endTransaction(); + return ( data_p); } /* GPIO read. See gpioWr for explanation */ /* GPIN pins are in high nybbles of IOPINS1, IOPINS2 */ uint8_t UHS_NI MAX3421E_HOST::gpioRd() { - uint8_t gpin = 0; - gpin = regRd(rIOPINS2); //pins 4-7 - gpin &= 0xF0; //clean lower nybble - gpin |= (regRd(rIOPINS1) >> 4); //shift low bits and OR with upper from previous operation. - return ( gpin); + uint8_t gpin = 0; + gpin = regRd(rIOPINS2); // pins 4-7 + gpin &= 0xF0; // clean lower nybble + gpin |= (regRd(rIOPINS1) >> 4); // shift low bits and OR with upper from previous operation. + return (gpin); } /* reset MAX3421E. Returns number of microseconds it took for PLL to stabilize after reset - or zero if PLL haven't stabilized in 65535 cycles */ +or zero if PLL haven't stabilized in 65535 cycles */ uint16_t UHS_NI MAX3421E_HOST::reset() { - uint16_t i = 0; + uint16_t i = 0; - // Initiate chip reset - regWr(rUSBCTL, bmCHIPRES); - regWr(rUSBCTL, 0x00); + // Initiate chip reset + regWr(rUSBCTL, bmCHIPRES); + regWr(rUSBCTL, 0x00); - int32_t now; - uint32_t expires = micros() + 65535; + int32_t now; + uint32_t expires = micros() + 65535; - // Enable full-duplex SPI so we can read rUSBIRQ - regWr(rPINCTL, bmFDUPSPI); - while((int32_t)(micros() - expires) < 0L) { - if((regRd(rUSBIRQ) & bmOSCOKIRQ)) { - break; - } - } - now = (int32_t)(micros() - expires); - if(now < 0L) { - i = 65535 + now; // Note this subtracts, as now is negative - } - return (i); + // Enable full-duplex SPI so we can read rUSBIRQ + regWr(rPINCTL, bmFDUPSPI); + while ((int32_t)(micros() - expires) < 0L) { + if ((regRd(rUSBIRQ) & bmOSCOKIRQ)) { + break; + } + } + now = (int32_t)(micros() - expires); + if (now < 0L) { + i = 65535 + now; // Note this subtracts, as now is negative + } + return (i); } void UHS_NI MAX3421E_HOST::VBUS_changed() { - /* modify USB task state because Vbus changed or unknown */ - uint8_t speed = 1; - //printf("\r\n\r\n\r\n\r\nSTATE %2.2x -> ", usb_task_state); - switch(vbusState) { - case LSHOST: // Low speed - - speed = 0; - // Intentional fall-through - case FSHOST: // Full speed - // Start device initialization if we are not initializing - // Resets to the device cause an IRQ - // usb_task_state == UHS_USB_HOST_STATE_RESET_NOT_COMPLETE; - //if((usb_task_state & UHS_USB_HOST_STATE_MASK) != UHS_USB_HOST_STATE_DETACHED) { - ReleaseChildren(); - if(!doingreset) { - if(usb_task_state == UHS_USB_HOST_STATE_RESET_NOT_COMPLETE) { - usb_task_state = UHS_USB_HOST_STATE_WAIT_BUS_READY; - } else if(usb_task_state != UHS_USB_HOST_STATE_WAIT_BUS_READY) { - usb_task_state = UHS_USB_HOST_STATE_DEBOUNCE; - } - } - sof_countdown = 0; - break; - case SE1: //illegal state - sof_countdown = 0; - doingreset = false; - ReleaseChildren(); - usb_task_state = UHS_USB_HOST_STATE_ILLEGAL; - break; - case SE0: //disconnected - default: - sof_countdown = 0; - doingreset = false; - ReleaseChildren(); - usb_task_state = UHS_USB_HOST_STATE_IDLE; - break; + /* modify USB task state because Vbus changed or unknown */ + uint8_t speed = 1; + //printf("\r\n\r\n\r\n\r\nSTATE %2.2x -> ", usb_task_state); + switch (vbusState) { + case LSHOST: // Low speed + speed = 0; + // Intentional fall-through + case FSHOST: // Full speed + // Start device initialization if we are not initializing + // Resets to the device cause an IRQ + // usb_task_state == UHS_USB_HOST_STATE_RESET_NOT_COMPLETE; + //if ((usb_task_state & UHS_USB_HOST_STATE_MASK) != UHS_USB_HOST_STATE_DETACHED) { + ReleaseChildren(); + if (!doingreset) { + if (usb_task_state == UHS_USB_HOST_STATE_RESET_NOT_COMPLETE) { + usb_task_state = UHS_USB_HOST_STATE_WAIT_BUS_READY; + } else if (usb_task_state != UHS_USB_HOST_STATE_WAIT_BUS_READY) { + usb_task_state = UHS_USB_HOST_STATE_DEBOUNCE; } - usb_host_speed = speed; - //printf("0x%2.2x\r\n\r\n\r\n\r\n", usb_task_state); - return; -}; + } + sof_countdown = 0; + break; + case SE1: // illegal state + sof_countdown = 0; + doingreset = false; + ReleaseChildren(); + usb_task_state = UHS_USB_HOST_STATE_ILLEGAL; + break; + case SE0: // disconnected + default: + sof_countdown = 0; + doingreset = false; + ReleaseChildren(); + usb_task_state = UHS_USB_HOST_STATE_IDLE; + break; + } + usb_host_speed = speed; + //printf("0x%2.2x\r\n\r\n\r\n\r\n", usb_task_state); + return; +} /** - * Probe bus to determine device presence and speed, - * then switch host to detected speed. + * Probe bus to determine device presence and speed, + * then switch host to detected speed. */ void UHS_NI MAX3421E_HOST::busprobe() { - uint8_t bus_sample; - uint8_t tmpdata; - bus_sample = regRd(rHRSL); //Get J,K status - bus_sample &= (bmJSTATUS | bmKSTATUS); //zero the rest of the byte - switch(bus_sample) { //start full-speed or low-speed host - case(bmJSTATUS): - // Serial.println("J"); - if((regRd(rMODE) & bmLOWSPEED) == 0) { - regWr(rMODE, MODE_FS_HOST); // start full-speed host - vbusState = FSHOST; - } else { - regWr(rMODE, MODE_LS_HOST); // start low-speed host - vbusState = LSHOST; - } - #ifdef USB_HOST_MANUAL_POLL - enable_frame_irq(true); - #endif - tmpdata = regRd(rMODE) | bmSOFKAENAB; // start SOF generation - regWr(rHIRQ, bmFRAMEIRQ); // see data sheet. - regWr(rMODE, tmpdata); - break; - case(bmKSTATUS): - // Serial.println("K"); - if((regRd(rMODE) & bmLOWSPEED) == 0) { - regWr(rMODE, MODE_LS_HOST); // start low-speed host - vbusState = LSHOST; - } else { - regWr(rMODE, MODE_FS_HOST); // start full-speed host - vbusState = FSHOST; - } - #ifdef USB_HOST_MANUAL_POLL - enable_frame_irq(true); - #endif - tmpdata = regRd(rMODE) | bmSOFKAENAB; // start SOF generation - regWr(rHIRQ, bmFRAMEIRQ); // see data sheet. - regWr(rMODE, tmpdata); - break; - case(bmSE1): //illegal state - // Serial.println("I"); - regWr(rMODE, bmDPPULLDN | bmDMPULLDN | bmHOST); - vbusState = SE1; - // sofevent = false; - break; - case(bmSE0): //disconnected state - // Serial.println("D"); - regWr(rMODE, bmDPPULLDN | bmDMPULLDN | bmHOST); - vbusState = SE0; - // sofevent = false; - break; - }//end switch( bus_sample ) + uint8_t bus_sample; + uint8_t tmpdata; + bus_sample = regRd(rHRSL); // Get J,K status + bus_sample &= (bmJSTATUS | bmKSTATUS); // zero the rest of the byte + switch (bus_sample) { // start full-speed or low-speed host + case bmJSTATUS: + // Serial.println("J"); + if ((regRd(rMODE) & bmLOWSPEED) == 0) { + regWr(rMODE, MODE_FS_HOST); // start full-speed host + vbusState = FSHOST; + } else { + regWr(rMODE, MODE_LS_HOST); // start low-speed host + vbusState = LSHOST; + } + #ifdef USB_HOST_MANUAL_POLL + enable_frame_irq(true); + #endif + tmpdata = regRd(rMODE) | bmSOFKAENAB; // start SOF generation + regWr(rHIRQ, bmFRAMEIRQ); // see data sheet. + regWr(rMODE, tmpdata); + break; + case bmKSTATUS: + // Serial.println("K"); + if ((regRd(rMODE) & bmLOWSPEED) == 0) { + regWr(rMODE, MODE_LS_HOST); // start low-speed host + vbusState = LSHOST; + } else { + regWr(rMODE, MODE_FS_HOST); // start full-speed host + vbusState = FSHOST; + } + #ifdef USB_HOST_MANUAL_POLL + enable_frame_irq(true); + #endif + tmpdata = regRd(rMODE) | bmSOFKAENAB; // start SOF generation + regWr(rHIRQ, bmFRAMEIRQ); // see data sheet. + regWr(rMODE, tmpdata); + break; + case bmSE1: // illegal state + // Serial.println("I"); + regWr(rMODE, bmDPPULLDN | bmDMPULLDN | bmHOST); + vbusState = SE1; + // sofevent = false; + break; + case bmSE0: // disconnected state + // Serial.println("D"); + regWr(rMODE, bmDPPULLDN | bmDMPULLDN | bmHOST); + vbusState = SE0; + // sofevent = false; + break; + } // end switch ( bus_sample ) } /** @@ -274,146 +276,145 @@ void UHS_NI MAX3421E_HOST::busprobe() { * @return 0 on success, -1 on error */ int16_t UHS_NI MAX3421E_HOST::Init(int16_t mseconds) { - usb_task_state = UHS_USB_HOST_STATE_INITIALIZE; //set up state machine - // Serial.print("MAX3421E 'this' USB Host @ 0x"); - // Serial.println((uint32_t)this, HEX); - // Serial.print("MAX3421E 'this' USB Host Address Pool @ 0x"); - // Serial.println((uint32_t)GetAddressPool(), HEX); - Init_dyn_SWI(); - UHS_printf_HELPER_init(); - noInterrupts(); -#ifdef ARDUINO_AVR_ADK - // For Mega ADK, which has a Max3421e on-board, - // set MAX_RESET to output mode, and then set it to HIGH - // PORTJ bit 2 - if(irq_pin == 54) { - DDRJ |= 0x04; // output - PORTJ |= 0x04; // HIGH + usb_task_state = UHS_USB_HOST_STATE_INITIALIZE; //set up state machine + //Serial.print("MAX3421E 'this' USB Host @ 0x"); + //Serial.println((uint32_t)this, HEX); + //Serial.print("MAX3421E 'this' USB Host Address Pool @ 0x"); + //Serial.println((uint32_t)GetAddressPool(), HEX); + Init_dyn_SWI(); + UHS_printf_HELPER_init(); + noInterrupts(); + #ifdef ARDUINO_AVR_ADK + // For Mega ADK, which has a Max3421e on-board, + // set MAX_RESET to output mode, and then set it to HIGH + // PORTJ bit 2 + if (irq_pin == 54) { + DDRJ |= 0x04; // output + PORTJ |= 0x04; // HIGH + } + #endif + SPIclass.begin(); + #ifdef ARDUINO_AVR_ADK + if (irq_pin == 54) { + DDRE &= ~0x20; // input + PORTE |= 0x20; // pullup + } else + #endif + pinMode(irq_pin, INPUT_PULLUP); + //UHS_PIN_WRITE(irq_pin, HIGH); + pinMode(ss_pin, OUTPUT); + MARLIN_UHS_WRITE_SS(HIGH); + + #ifdef USB_HOST_SHIELD_TIMING_PIN + pinMode(USB_HOST_SHIELD_TIMING_PIN, OUTPUT); + // My counter/timer can't work on an inverted gate signal + // so we gate using a high pulse -- AJK + UHS_PIN_WRITE(USB_HOST_SHIELD_TIMING_PIN, LOW); + #endif + interrupts(); + + #if USB_HOST_SHIELD_USE_ISR + int intr = digitalPinToInterrupt(irq_pin); + if (intr == NOT_AN_INTERRUPT) { + #ifdef ARDUINO_AVR_ADK + if (irq_pin == 54) + intr = 6; + else + #endif + return (-2); + } + SPIclass.usingInterrupt(intr); + #else + SPIclass.usingInterrupt(255); + #endif + #ifndef NO_AUTO_SPEED + // test to get to reset acceptance. + uint32_t spd = UHS_MAX3421E_SPD; + again: + MAX3421E_SPI_Settings = SPISettings(spd, MSBFIRST, SPI_MODE0); + if (reset() == 0) { + MAX_HOST_DEBUG(PSTR("Fail SPI speed %lu\r\n"), spd); + if (spd > 1999999) { + spd -= 1000000; + goto again; + } + return (-1); + } else { + // reset passes, does 64k? + uint8_t sample_wr = 0; + uint8_t sample_rd = 0; + uint8_t gpinpol_copy = regRd(rGPINPOL); + for (uint16_t j = 0; j < 65535; j++) { + regWr(rGPINPOL, sample_wr); + sample_rd = regRd(rGPINPOL); + if (sample_rd != sample_wr) { + MAX_HOST_DEBUG(PSTR("Fail SPI speed %lu\r\n"), spd); + if (spd > 1999999) { + spd -= 1000000; + goto again; + } + return (-1); } -#endif - SPIclass.begin(); -#ifdef ARDUINO_AVR_ADK - if(irq_pin == 54) { - DDRE &= ~0x20; // input - PORTE |= 0x20; // pullup - } else -#endif - pinMode(irq_pin, INPUT_PULLUP); - //UHS_PIN_WRITE(irq_pin, HIGH); - pinMode(ss_pin, OUTPUT); - MARLIN_UHS_WRITE_SS(HIGH); + sample_wr++; + } + regWr(rGPINPOL, gpinpol_copy); + } -#ifdef USB_HOST_SHIELD_TIMING_PIN - pinMode(USB_HOST_SHIELD_TIMING_PIN, OUTPUT); - // My counter/timer can't work on an inverted gate signal - // so we gate using a high pulse -- AJK - UHS_PIN_WRITE(USB_HOST_SHIELD_TIMING_PIN, LOW); -#endif - interrupts(); + MAX_HOST_DEBUG(PSTR("Pass SPI speed %lu\r\n"), spd); + #endif -#if USB_HOST_SHIELD_USE_ISR - int intr = digitalPinToInterrupt(irq_pin); - if(intr == NOT_AN_INTERRUPT) { -#ifdef ARDUINO_AVR_ADK - if(irq_pin == 54) - intr = 6; - else -#endif - return (-2); - } - SPIclass.usingInterrupt(intr); -#else - SPIclass.usingInterrupt(255); -#endif -#ifndef NO_AUTO_SPEED - // test to get to reset acceptance. - uint32_t spd = UHS_MAX3421E_SPD; -again: - MAX3421E_SPI_Settings = SPISettings(spd, MSBFIRST, SPI_MODE0); - if(reset() == 0) { - MAX_HOST_DEBUG(PSTR("Fail SPI speed %lu\r\n"), spd); - if(spd > 1999999) { - spd -= 1000000; - goto again; - } - return (-1); - } else { - // reset passes, does 64k? - uint8_t sample_wr = 0; - uint8_t sample_rd = 0; - uint8_t gpinpol_copy = regRd(rGPINPOL); - for(uint16_t j = 0; j < 65535; j++) { - regWr(rGPINPOL, sample_wr); - sample_rd = regRd(rGPINPOL); - if(sample_rd != sample_wr) { - MAX_HOST_DEBUG(PSTR("Fail SPI speed %lu\r\n"), spd); - if(spd > 1999999) { - spd -= 1000000; - goto again; - } - return (-1); - } - sample_wr++; - } - regWr(rGPINPOL, gpinpol_copy); - } + if (reset() == 0) { // OSCOKIRQ hasn't asserted in time + MAX_HOST_DEBUG(PSTR("OSCOKIRQ hasn't asserted in time")); + return ( -1); + } - MAX_HOST_DEBUG(PSTR("Pass SPI speed %lu\r\n"), spd); -#endif + /* MAX3421E - full-duplex SPI, interrupt kind, vbus off */ + regWr(rPINCTL, (bmFDUPSPI | bmIRQ_SENSE | GPX_VBDET)); - if(reset() == 0) { //OSCOKIRQ hasn't asserted in time - MAX_HOST_DEBUG(PSTR("OSCOKIRQ hasn't asserted in time")); - return ( -1); - } + // Delay a minimum of 1 second to ensure any capacitors are drained. + // 1 second is required to make sure we do not smoke a Microdrive! + if (mseconds != INT16_MIN) { + if (mseconds < 1000) mseconds = 1000; + delay(mseconds); // We can't depend on SOF timer here. + } - /* MAX3421E - full-duplex SPI, interrupt kind, vbus off */ - regWr(rPINCTL, (bmFDUPSPI | bmIRQ_SENSE | GPX_VBDET)); + regWr(rMODE, bmDPPULLDN | bmDMPULLDN | bmHOST); // set pull-downs, Host - // Delay a minimum of 1 second to ensure any capacitors are drained. - // 1 second is required to make sure we do not smoke a Microdrive! - if(mseconds != INT16_MIN) { - if(mseconds < 1000) mseconds = 1000; - delay(mseconds); // We can't depend on SOF timer here. - } + // Enable interrupts on the MAX3421e + regWr(rHIEN, IRQ_CHECK_MASK); + // Enable interrupt pin on the MAX3421e, set pulse width for edge + regWr(rCPUCTL, (bmIE | bmPULSEWIDTH)); - regWr(rMODE, bmDPPULLDN | bmDMPULLDN | bmHOST); // set pull-downs, Host + /* check if device is connected */ + regWr(rHCTL, bmSAMPLEBUS); // sample USB bus + while (!(regRd(rHCTL) & bmSAMPLEBUS)); // wait for sample operation to finish - // Enable interrupts on the MAX3421e - regWr(rHIEN, IRQ_CHECK_MASK); - // Enable interrupt pin on the MAX3421e, set pulse width for edge - regWr(rCPUCTL, (bmIE | bmPULSEWIDTH)); + busprobe(); // check if anything is connected + VBUS_changed(); - /* check if device is connected */ - regWr(rHCTL, bmSAMPLEBUS); // sample USB bus - while(!(regRd(rHCTL) & bmSAMPLEBUS)); //wait for sample operation to finish + // GPX pin on. This is done here so that a change is detected if we have a switch connected. + /* MAX3421E - full-duplex SPI, interrupt kind, vbus on */ + regWr(rPINCTL, (bmFDUPSPI | bmIRQ_SENSE)); + regWr(rHIRQ, bmBUSEVENTIRQ); // see data sheet. + regWr(rHCTL, bmBUSRST); // issue bus reset to force generate yet another possible IRQ - busprobe(); //check if anything is connected - VBUS_changed(); - - // GPX pin on. This is done here so that a change is detected if we have a switch connected. - /* MAX3421E - full-duplex SPI, interrupt kind, vbus on */ - regWr(rPINCTL, (bmFDUPSPI | bmIRQ_SENSE)); - regWr(rHIRQ, bmBUSEVENTIRQ); // see data sheet. - regWr(rHCTL, bmBUSRST); // issue bus reset to force generate yet another possible IRQ - - -#if USB_HOST_SHIELD_USE_ISR - // Attach ISR to service IRQ from MAX3421e - noInterrupts(); - if(irq_pin & 1) { - ISRodd = this; - attachInterrupt(UHS_GET_DPI(irq_pin), call_ISRodd, IRQ_SENSE); - } else { - ISReven = this; - attachInterrupt(UHS_GET_DPI(irq_pin), call_ISReven, IRQ_SENSE); - } - interrupts(); -#endif - //printf("\r\nrPINCTL 0x%2.2X\r\n", rPINCTL); - //printf("rCPUCTL 0x%2.2X\r\n", rCPUCTL); - //printf("rHIEN 0x%2.2X\r\n", rHIEN); - //printf("irq_pin %i\r\n", irq_pin); - return 0; + #if USB_HOST_SHIELD_USE_ISR + // Attach ISR to service IRQ from MAX3421e + noInterrupts(); + if (irq_pin & 1) { + ISRodd = this; + attachInterrupt(UHS_GET_DPI(irq_pin), call_ISRodd, IRQ_SENSE); + } else { + ISReven = this; + attachInterrupt(UHS_GET_DPI(irq_pin), call_ISReven, IRQ_SENSE); + } + interrupts(); + #endif + //printf("\r\nrPINCTL 0x%2.2X\r\n", rPINCTL); + //printf("rCPUCTL 0x%2.2X\r\n", rCPUCTL); + //printf("rHIEN 0x%2.2X\r\n", rHIEN); + //printf("irq_pin %i\r\n", irq_pin); + return 0; } /** @@ -426,41 +427,41 @@ again: * @return 0 on success */ uint8_t UHS_NI MAX3421E_HOST::SetAddress(uint8_t addr, uint8_t ep, UHS_EpInfo **ppep, uint16_t &nak_limit) { - UHS_Device *p = addrPool.GetUsbDevicePtr(addr); + UHS_Device *p = addrPool.GetUsbDevicePtr(addr); - if(!p) - return UHS_HOST_ERROR_NO_ADDRESS_IN_POOL; + if (!p) + return UHS_HOST_ERROR_NO_ADDRESS_IN_POOL; - if(!p->epinfo) - return UHS_HOST_ERROR_NULL_EPINFO; + if (!p->epinfo) + return UHS_HOST_ERROR_NULL_EPINFO; - *ppep = getEpInfoEntry(addr, ep); + *ppep = getEpInfoEntry(addr, ep); - if(!*ppep) - return UHS_HOST_ERROR_NO_ENDPOINT_IN_TABLE; + if (!*ppep) + return UHS_HOST_ERROR_NO_ENDPOINT_IN_TABLE; - nak_limit = (0x0001UL << (((*ppep)->bmNakPower > UHS_USB_NAK_MAX_POWER) ? UHS_USB_NAK_MAX_POWER : (*ppep)->bmNakPower)); - nak_limit--; - /* - USBTRACE2("\r\nAddress: ", addr); - USBTRACE2(" EP: ", ep); - USBTRACE2(" NAK Power: ",(*ppep)->bmNakPower); - USBTRACE2(" NAK Limit: ", nak_limit); - USBTRACE("\r\n"); - */ - regWr(rPERADDR, addr); //set peripheral address + nak_limit = (0x0001UL << (((*ppep)->bmNakPower > UHS_USB_NAK_MAX_POWER) ? UHS_USB_NAK_MAX_POWER : (*ppep)->bmNakPower)); + nak_limit--; + /* + USBTRACE2("\r\nAddress: ", addr); + USBTRACE2(" EP: ", ep); + USBTRACE2(" NAK Power: ",(*ppep)->bmNakPower); + USBTRACE2(" NAK Limit: ", nak_limit); + USBTRACE("\r\n"); + */ + regWr(rPERADDR, addr); // set peripheral address - uint8_t mode = regRd(rMODE); + uint8_t mode = regRd(rMODE); - //Serial.print("\r\nMode: "); - //Serial.println( mode, HEX); - //Serial.print("\r\nLS: "); - //Serial.println(p->speed, HEX); + //Serial.print("\r\nMode: "); + //Serial.println( mode, HEX); + //Serial.print("\r\nLS: "); + //Serial.println(p->speed, HEX); - // Set bmLOWSPEED and bmHUBPRE in case of low-speed device, reset them otherwise - regWr(rMODE, (p->speed) ? mode & ~(bmHUBPRE | bmLOWSPEED) : mode | bmLOWSPEED | hub_present); + // Set bmLOWSPEED and bmHUBPRE in case of low-speed device, reset them otherwise + regWr(rMODE, (p->speed) ? mode & ~(bmHUBPRE | bmLOWSPEED) : mode | bmLOWSPEED | hub_present); - return 0; + return 0; } /** @@ -473,71 +474,70 @@ uint8_t UHS_NI MAX3421E_HOST::SetAddress(uint8_t addr, uint8_t ep, UHS_EpInfo ** * @return 0 on success */ uint8_t UHS_NI MAX3421E_HOST::InTransfer(UHS_EpInfo *pep, uint16_t nak_limit, uint16_t *nbytesptr, uint8_t *data) { - uint8_t rcode = 0; - uint8_t pktsize; + uint8_t rcode = 0; + uint8_t pktsize; - uint16_t nbytes = *nbytesptr; - MAX_HOST_DEBUG(PSTR("Requesting %i bytes "), nbytes); - uint8_t maxpktsize = pep->maxPktSize; + uint16_t nbytes = *nbytesptr; + MAX_HOST_DEBUG(PSTR("Requesting %i bytes "), nbytes); + uint8_t maxpktsize = pep->maxPktSize; - *nbytesptr = 0; - regWr(rHCTL, (pep->bmRcvToggle) ? bmRCVTOG1 : bmRCVTOG0); //set toggle value + *nbytesptr = 0; + regWr(rHCTL, (pep->bmRcvToggle) ? bmRCVTOG1 : bmRCVTOG0); // set toggle value - // use a 'break' to exit this loop - while(1) { - rcode = dispatchPkt(MAX3421E_tokIN, pep->epAddr, nak_limit); //IN packet to EP-'endpoint'. Function takes care of NAKS. -#if 0 - // This issue should be resolved now. - if(rcode == UHS_HOST_ERROR_TOGERR) { - //MAX_HOST_DEBUG(PSTR("toggle wrong\r\n")); - // yes, we flip it wrong here so that next time it is actually correct! - pep->bmRcvToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 0 : 1; - regWr(rHCTL, (pep->bmRcvToggle) ? bmRCVTOG1 : bmRCVTOG0); //set toggle value - continue; - } -#endif - if(rcode) { - //MAX_HOST_DEBUG(PSTR(">>>>>>>> Problem! dispatchPkt %2.2x\r\n"), rcode); - break; //should be 0, indicating ACK. Else return error code. - } - /* check for RCVDAVIRQ and generate error if not present */ - /* the only case when absence of RCVDAVIRQ makes sense is when toggle error occurred. Need to add handling for that */ - if((regRd(rHIRQ) & bmRCVDAVIRQ) == 0) { - //MAX_HOST_DEBUG(PSTR(">>>>>>>> Problem! NO RCVDAVIRQ!\r\n")); - rcode = 0xF0; //receive error - break; - } - pktsize = regRd(rRCVBC); //number of received bytes - MAX_HOST_DEBUG(PSTR("Got %i bytes \r\n"), pktsize); + // use a 'break' to exit this loop + while (1) { + rcode = dispatchPkt(MAX3421E_tokIN, pep->epAddr, nak_limit); // IN packet to EP-'endpoint'. Function takes care of NAKS. + #if 0 + // This issue should be resolved now. + if (rcode == UHS_HOST_ERROR_TOGERR) { + //MAX_HOST_DEBUG(PSTR("toggle wrong\r\n")); + // yes, we flip it wrong here so that next time it is actually correct! + pep->bmRcvToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 0 : 1; + regWr(rHCTL, (pep->bmRcvToggle) ? bmRCVTOG1 : bmRCVTOG0); // set toggle value + continue; + } + #endif + if (rcode) { + //MAX_HOST_DEBUG(PSTR(">>>>>>>> Problem! dispatchPkt %2.2x\r\n"), rcode); + break; // should be 0, indicating ACK. Else return error code. + } + /* check for RCVDAVIRQ and generate error if not present */ + /* the only case when absence of RCVDAVIRQ makes sense is when toggle error occurred. Need to add handling for that */ + if ((regRd(rHIRQ) & bmRCVDAVIRQ) == 0) { + //MAX_HOST_DEBUG(PSTR(">>>>>>>> Problem! NO RCVDAVIRQ!\r\n")); + rcode = 0xF0; // receive error + break; + } + pktsize = regRd(rRCVBC); // number of received bytes + MAX_HOST_DEBUG(PSTR("Got %i bytes \r\n"), pktsize); - if(pktsize > nbytes) { //certain devices send more than asked - //MAX_HOST_DEBUG(PSTR(">>>>>>>> Warning: wanted %i bytes but got %i.\r\n"), nbytes, pktsize); - pktsize = nbytes; - } + if (pktsize > nbytes) { // certain devices send more than asked + //MAX_HOST_DEBUG(PSTR(">>>>>>>> Warning: wanted %i bytes but got %i.\r\n"), nbytes, pktsize); + pktsize = nbytes; + } - int16_t mem_left = (int16_t)nbytes - *((int16_t*)nbytesptr); + int16_t mem_left = (int16_t)nbytes - *((int16_t*)nbytesptr); - if(mem_left < 0) - mem_left = 0; + if (mem_left < 0) + mem_left = 0; - data = bytesRd(rRCVFIFO, ((pktsize > mem_left) ? mem_left : pktsize), data); + data = bytesRd(rRCVFIFO, ((pktsize > mem_left) ? mem_left : pktsize), data); - regWr(rHIRQ, bmRCVDAVIRQ); // Clear the IRQ & free the buffer - *nbytesptr += pktsize; // add this packet's byte count to total transfer length + regWr(rHIRQ, bmRCVDAVIRQ); // Clear the IRQ & free the buffer + *nbytesptr += pktsize; // add this packet's byte count to total transfer length - /* The transfer is complete under two conditions: */ - /* 1. The device sent a short packet (L.T. maxPacketSize) */ - /* 2. 'nbytes' have been transferred. */ - if((pktsize < maxpktsize) || (*nbytesptr >= nbytes)) // have we transferred 'nbytes' bytes? - { - // Save toggle value - pep->bmRcvToggle = ((regRd(rHRSL) & bmRCVTOGRD)) ? 1 : 0; - //MAX_HOST_DEBUG(PSTR("\r\n")); - rcode = 0; - break; - } // if - } //while( 1 ) - return ( rcode); + /* The transfer is complete under two conditions: */ + /* 1. The device sent a short packet (L.T. maxPacketSize) */ + /* 2. 'nbytes' have been transferred. */ + if ((pktsize < maxpktsize) || (*nbytesptr >= nbytes)) { // have we transferred 'nbytes' bytes? + // Save toggle value + pep->bmRcvToggle = ((regRd(rHRSL) & bmRCVTOGRD)) ? 1 : 0; + //MAX_HOST_DEBUG(PSTR("\r\n")); + rcode = 0; + break; + } // if + } // while( 1 ) + return (rcode); } /** @@ -550,72 +550,72 @@ uint8_t UHS_NI MAX3421E_HOST::InTransfer(UHS_EpInfo *pep, uint16_t nak_limit, ui * @return 0 on success */ uint8_t UHS_NI MAX3421E_HOST::OutTransfer(UHS_EpInfo *pep, uint16_t nak_limit, uint16_t nbytes, uint8_t *data) { - uint8_t rcode = UHS_HOST_ERROR_NONE; - uint8_t retry_count; - uint8_t *data_p = data; //local copy of the data pointer - uint16_t bytes_tosend; - uint16_t nak_count; - uint16_t bytes_left = nbytes; + uint8_t rcode = UHS_HOST_ERROR_NONE; + uint8_t retry_count; + uint8_t *data_p = data; // local copy of the data pointer + uint16_t bytes_tosend; + uint16_t nak_count; + uint16_t bytes_left = nbytes; - uint8_t maxpktsize = pep->maxPktSize; + uint8_t maxpktsize = pep->maxPktSize; - if(maxpktsize < 1 || maxpktsize > 64) - return UHS_HOST_ERROR_BAD_MAX_PACKET_SIZE; + if (maxpktsize < 1 || maxpktsize > 64) + return UHS_HOST_ERROR_BAD_MAX_PACKET_SIZE; - unsigned long timeout = millis() + UHS_HOST_TRANSFER_MAX_MS; + unsigned long timeout = millis() + UHS_HOST_TRANSFER_MAX_MS; - regWr(rHCTL, (pep->bmSndToggle) ? bmSNDTOG1 : bmSNDTOG0); //set toggle value + regWr(rHCTL, (pep->bmSndToggle) ? bmSNDTOG1 : bmSNDTOG0); // set toggle value - while(bytes_left) { - SYSTEM_OR_SPECIAL_YIELD(); - retry_count = 0; - nak_count = 0; - bytes_tosend = (bytes_left >= maxpktsize) ? maxpktsize : bytes_left; - bytesWr(rSNDFIFO, bytes_tosend, data_p); //filling output FIFO - regWr(rSNDBC, bytes_tosend); //set number of bytes - regWr(rHXFR, (MAX3421E_tokOUT | pep->epAddr)); //dispatch packet - while(!(regRd(rHIRQ) & bmHXFRDNIRQ)); //wait for the completion IRQ - regWr(rHIRQ, bmHXFRDNIRQ); //clear IRQ - rcode = (regRd(rHRSL) & 0x0F); + while (bytes_left) { + SYSTEM_OR_SPECIAL_YIELD(); + retry_count = 0; + nak_count = 0; + bytes_tosend = (bytes_left >= maxpktsize) ? maxpktsize : bytes_left; + bytesWr(rSNDFIFO, bytes_tosend, data_p); // filling output FIFO + regWr(rSNDBC, bytes_tosend); // set number of bytes + regWr(rHXFR, (MAX3421E_tokOUT | pep->epAddr)); // dispatch packet + while (!(regRd(rHIRQ) & bmHXFRDNIRQ)); // wait for the completion IRQ + regWr(rHIRQ, bmHXFRDNIRQ); // clear IRQ + rcode = (regRd(rHRSL) & 0x0F); - while(rcode && ((long)(millis() - timeout) < 0L)) { - switch(rcode) { - case UHS_HOST_ERROR_NAK: - nak_count++; - if(nak_limit && (nak_count == nak_limit)) - goto breakout; - break; - case UHS_HOST_ERROR_TIMEOUT: - retry_count++; - if(retry_count == UHS_HOST_TRANSFER_RETRY_MAXIMUM) - goto breakout; - break; - case UHS_HOST_ERROR_TOGERR: - // yes, we flip it wrong here so that next time it is actually correct! - pep->bmSndToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 0 : 1; - regWr(rHCTL, (pep->bmSndToggle) ? bmSNDTOG1 : bmSNDTOG0); //set toggle value - break; - default: - goto breakout; - }//switch( rcode + while (rcode && ((long)(millis() - timeout) < 0L)) { + switch (rcode) { + case UHS_HOST_ERROR_NAK: + nak_count++; + if (nak_limit && (nak_count == nak_limit)) + goto breakout; + break; + case UHS_HOST_ERROR_TIMEOUT: + retry_count++; + if (retry_count == UHS_HOST_TRANSFER_RETRY_MAXIMUM) + goto breakout; + break; + case UHS_HOST_ERROR_TOGERR: + // yes, we flip it wrong here so that next time it is actually correct! + pep->bmSndToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 0 : 1; + regWr(rHCTL, (pep->bmSndToggle) ? bmSNDTOG1 : bmSNDTOG0); // set toggle value + break; + default: + goto breakout; + } // switch (rcode - /* process NAK according to Host out NAK bug */ - regWr(rSNDBC, 0); - regWr(rSNDFIFO, *data_p); - regWr(rSNDBC, bytes_tosend); - regWr(rHXFR, (MAX3421E_tokOUT | pep->epAddr)); //dispatch packet - while(!(regRd(rHIRQ) & bmHXFRDNIRQ)); //wait for the completion IRQ - regWr(rHIRQ, bmHXFRDNIRQ); //clear IRQ - rcode = (regRd(rHRSL) & 0x0F); - SYSTEM_OR_SPECIAL_YIELD(); - }//while( rcode && .... - bytes_left -= bytes_tosend; - data_p += bytes_tosend; - }//while( bytes_left... -breakout: + /* process NAK according to Host out NAK bug */ + regWr(rSNDBC, 0); + regWr(rSNDFIFO, *data_p); + regWr(rSNDBC, bytes_tosend); + regWr(rHXFR, (MAX3421E_tokOUT | pep->epAddr)); // dispatch packet + while (!(regRd(rHIRQ) & bmHXFRDNIRQ)); // wait for the completion IRQ + regWr(rHIRQ, bmHXFRDNIRQ); // clear IRQ + rcode = (regRd(rHRSL) & 0x0F); + SYSTEM_OR_SPECIAL_YIELD(); + } // while (rcode && .... + bytes_left -= bytes_tosend; + data_p += bytes_tosend; + } // while (bytes_left... + breakout: - pep->bmSndToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 1 : 0; //bmSNDTOG1 : bmSNDTOG0; //update toggle - return ( rcode); //should be 0 in all cases + pep->bmSndToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 1 : 0; // bmSNDTOG1 : bmSNDTOG0; // update toggle + return (rcode); // should be 0 in all cases } /** @@ -633,45 +633,44 @@ breakout: /* return codes 0x00-0x0F are HRSLT( 0x00 being success ), 0xFF means timeout */ uint8_t UHS_NI MAX3421E_HOST::dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit) { - unsigned long timeout = millis() + UHS_HOST_TRANSFER_MAX_MS; - uint8_t tmpdata; - uint8_t rcode = UHS_HOST_ERROR_NONE; - uint8_t retry_count = 0; - uint16_t nak_count = 0; + unsigned long timeout = millis() + UHS_HOST_TRANSFER_MAX_MS; + uint8_t tmpdata; + uint8_t rcode = UHS_HOST_ERROR_NONE; + uint8_t retry_count = 0; + uint16_t nak_count = 0; - for(;;) { - regWr(rHXFR, (token | ep)); //launch the transfer - while((long)(millis() - timeout) < 0L) //wait for transfer completion - { - SYSTEM_OR_SPECIAL_YIELD(); - tmpdata = regRd(rHIRQ); + for (;;) { + regWr(rHXFR, (token | ep)); // launch the transfer + while (long(millis() - timeout) < 0L) { // wait for transfer completion + SYSTEM_OR_SPECIAL_YIELD(); + tmpdata = regRd(rHIRQ); - if(tmpdata & bmHXFRDNIRQ) { - regWr(rHIRQ, bmHXFRDNIRQ); //clear the interrupt - //rcode = 0x00; - break; - }//if( tmpdata & bmHXFRDNIRQ + if (tmpdata & bmHXFRDNIRQ) { + regWr(rHIRQ, bmHXFRDNIRQ); // clear the interrupt + //rcode = 0x00; + break; + } // if (tmpdata & bmHXFRDNIRQ - }//while ( millis() < timeout + } // while (millis() < timeout - rcode = (regRd(rHRSL) & 0x0F); //analyze transfer result + rcode = (regRd(rHRSL) & 0x0F); // analyze transfer result - switch(rcode) { - case UHS_HOST_ERROR_NAK: - nak_count++; - if(nak_limit && (nak_count == nak_limit)) - return (rcode); - delayMicroseconds(200); - break; - case UHS_HOST_ERROR_TIMEOUT: - retry_count++; - if(retry_count == UHS_HOST_TRANSFER_RETRY_MAXIMUM) - return (rcode); - break; - default: - return (rcode); - }//switch( rcode - } + switch (rcode) { + case UHS_HOST_ERROR_NAK: + nak_count++; + if (nak_limit && (nak_count == nak_limit)) + return (rcode); + delayMicroseconds(200); + break; + case UHS_HOST_ERROR_TIMEOUT: + retry_count++; + if (retry_count == UHS_HOST_TRANSFER_RETRY_MAXIMUM) + return (rcode); + break; + default: + return (rcode); + } // switch (rcode) + } } // @@ -679,325 +678,324 @@ uint8_t UHS_NI MAX3421E_HOST::dispatchPkt(uint8_t token, uint8_t ep, uint16_t na // UHS_EpInfo * UHS_NI MAX3421E_HOST::ctrlReqOpen(uint8_t addr, uint64_t Request, uint8_t *dataptr) { - uint8_t rcode; - UHS_EpInfo *pep = NULL; - uint16_t nak_limit = 0; - rcode = SetAddress(addr, 0, &pep, nak_limit); + uint8_t rcode; + UHS_EpInfo *pep = NULL; + uint16_t nak_limit = 0; + rcode = SetAddress(addr, 0, &pep, nak_limit); - if(!rcode) { + if (!rcode) { - bytesWr(rSUDFIFO, 8, (uint8_t*)(&Request)); //transfer to setup packet FIFO + bytesWr(rSUDFIFO, 8, (uint8_t*)(&Request)); // transfer to setup packet FIFO - rcode = dispatchPkt(MAX3421E_tokSETUP, 0, nak_limit); //dispatch packet - if(!rcode) { - if(dataptr != NULL) { - if(((Request)/* bmReqType*/ & 0x80) == 0x80) { - pep->bmRcvToggle = 1; //bmRCVTOG1; - } else { - pep->bmSndToggle = 1; //bmSNDTOG1; - } - } - } else { - pep = NULL; - } + rcode = dispatchPkt(MAX3421E_tokSETUP, 0, nak_limit); // dispatch packet + if (!rcode) { + if (dataptr != NULL) { + if (((Request)/* bmReqType*/ & 0x80) == 0x80) { + pep->bmRcvToggle = 1; //bmRCVTOG1; + } else { + pep->bmSndToggle = 1; //bmSNDTOG1; } - return pep; + } + } else { + pep = NULL; + } + } + return pep; } uint8_t UHS_NI MAX3421E_HOST::ctrlReqRead(UHS_EpInfo *pep, uint16_t *left, uint16_t *read, uint16_t nbytes, uint8_t *dataptr) { - *read = 0; - uint16_t nak_limit = 0; - MAX_HOST_DEBUG(PSTR("ctrlReqRead left: %i\r\n"), *left); - if(*left) { -again: - *read = nbytes; - uint8_t rcode = InTransfer(pep, nak_limit, read, dataptr); - if(rcode == UHS_HOST_ERROR_TOGERR) { - // yes, we flip it wrong here so that next time it is actually correct! - pep->bmRcvToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 0 : 1; - goto again; - } + *read = 0; + uint16_t nak_limit = 0; + MAX_HOST_DEBUG(PSTR("ctrlReqRead left: %i\r\n"), *left); + if (*left) { + again: + *read = nbytes; + uint8_t rcode = InTransfer(pep, nak_limit, read, dataptr); + if (rcode == UHS_HOST_ERROR_TOGERR) { + // yes, we flip it wrong here so that next time it is actually correct! + pep->bmRcvToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 0 : 1; + goto again; + } - if(rcode) { - MAX_HOST_DEBUG(PSTR("ctrlReqRead ERROR: %2.2x, left: %i, read %i\r\n"), rcode, *left, *read); - return rcode; - } - *left -= *read; - MAX_HOST_DEBUG(PSTR("ctrlReqRead left: %i, read %i\r\n"), *left, *read); - } - return 0; + if (rcode) { + MAX_HOST_DEBUG(PSTR("ctrlReqRead ERROR: %2.2x, left: %i, read %i\r\n"), rcode, *left, *read); + return rcode; + } + *left -= *read; + MAX_HOST_DEBUG(PSTR("ctrlReqRead left: %i, read %i\r\n"), *left, *read); + } + return 0; } uint8_t UHS_NI MAX3421E_HOST::ctrlReqClose(UHS_EpInfo *pep, uint8_t bmReqType, uint16_t left, uint16_t nbytes, uint8_t *dataptr) { - uint8_t rcode = 0; + uint8_t rcode = 0; - //MAX_HOST_DEBUG(PSTR("Closing")); - if(((bmReqType & 0x80) == 0x80) && pep && left && dataptr) { - MAX_HOST_DEBUG(PSTR("ctrlReqRead Sinking %i\r\n"), left); - // If reading, sink the rest of the data. - while(left) { - uint16_t read = nbytes; - rcode = InTransfer(pep, 0, &read, dataptr); - if(rcode == UHS_HOST_ERROR_TOGERR) { - // yes, we flip it wrong here so that next time it is actually correct! - pep->bmRcvToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 0 : 1; - continue; - } - if(rcode) break; - left -= read; - if(read < nbytes) break; - } - } - if(!rcode) { - // Serial.println("Dispatching"); - rcode = dispatchPkt(((bmReqType & 0x80) == 0x80) ? MAX3421E_tokOUTHS : MAX3421E_tokINHS, 0, 0); //GET if direction - // } else { - // Serial.println("Bypassed Dispatch"); - } - return rcode; + //MAX_HOST_DEBUG(PSTR("Closing")); + if (((bmReqType & 0x80) == 0x80) && pep && left && dataptr) { + MAX_HOST_DEBUG(PSTR("ctrlReqRead Sinking %i\r\n"), left); + // If reading, sink the rest of the data. + while (left) { + uint16_t read = nbytes; + rcode = InTransfer(pep, 0, &read, dataptr); + if (rcode == UHS_HOST_ERROR_TOGERR) { + // yes, we flip it wrong here so that next time it is actually correct! + pep->bmRcvToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 0 : 1; + continue; + } + if (rcode) break; + left -= read; + if (read < nbytes) break; + } + } + if (!rcode) { + //Serial.println("Dispatching"); + rcode = dispatchPkt(((bmReqType & 0x80) == 0x80) ? MAX3421E_tokOUTHS : MAX3421E_tokINHS, 0, 0); //GET if direction + //} else { + //Serial.println("Bypassed Dispatch"); + } + return rcode; } /** * Bottom half of the ISR task */ void UHS_NI MAX3421E_HOST::ISRbottom() { - uint8_t x; - // Serial.print("Enter "); - // Serial.print((uint32_t)this,HEX); - // Serial.print(" "); - // Serial.println(usb_task_state, HEX); + uint8_t x; + // Serial.print("Enter "); + // Serial.print((uint32_t)this,HEX); + // Serial.print(" "); + // Serial.println(usb_task_state, HEX); - DDSB(); - if(condet) { - VBUS_changed(); -#if USB_HOST_SHIELD_USE_ISR - noInterrupts(); -#endif - condet = false; -#if USB_HOST_SHIELD_USE_ISR - interrupts(); -#endif + DDSB(); + if (condet) { + VBUS_changed(); + #if USB_HOST_SHIELD_USE_ISR + noInterrupts(); + #endif + condet = false; + #if USB_HOST_SHIELD_USE_ISR + interrupts(); + #endif + } + switch (usb_task_state) { + case UHS_USB_HOST_STATE_INITIALIZE: + // should never happen... + MAX_HOST_DEBUG(PSTR("UHS_USB_HOST_STATE_INITIALIZE\r\n")); + busprobe(); + VBUS_changed(); + break; + case UHS_USB_HOST_STATE_DEBOUNCE: + MAX_HOST_DEBUG(PSTR("UHS_USB_HOST_STATE_DEBOUNCE\r\n")); + // This seems to not be needed. The host controller has debounce built in. + sof_countdown = UHS_HOST_DEBOUNCE_DELAY_MS; + usb_task_state = UHS_USB_HOST_STATE_DEBOUNCE_NOT_COMPLETE; + break; + case UHS_USB_HOST_STATE_DEBOUNCE_NOT_COMPLETE: + MAX_HOST_DEBUG(PSTR("UHS_USB_HOST_STATE_DEBOUNCE_NOT_COMPLETE\r\n")); + if (!sof_countdown) usb_task_state = UHS_USB_HOST_STATE_RESET_DEVICE; + break; + case UHS_USB_HOST_STATE_RESET_DEVICE: + MAX_HOST_DEBUG(PSTR("UHS_USB_HOST_STATE_RESET_DEVICE\r\n")); + busevent = true; + usb_task_state = UHS_USB_HOST_STATE_RESET_NOT_COMPLETE; + regWr(rHIRQ, bmBUSEVENTIRQ); // see data sheet. + regWr(rHCTL, bmBUSRST); // issue bus reset + break; + case UHS_USB_HOST_STATE_RESET_NOT_COMPLETE: + MAX_HOST_DEBUG(PSTR("UHS_USB_HOST_STATE_RESET_NOT_COMPLETE\r\n")); + if (!busevent) usb_task_state = UHS_USB_HOST_STATE_WAIT_BUS_READY; + break; + case UHS_USB_HOST_STATE_WAIT_BUS_READY: + MAX_HOST_DEBUG(PSTR("UHS_USB_HOST_STATE_WAIT_BUS_READY\r\n")); + usb_task_state = UHS_USB_HOST_STATE_CONFIGURING; + break; // don't fall through + + case UHS_USB_HOST_STATE_CONFIGURING: + usb_task_state = UHS_USB_HOST_STATE_CHECK; + x = Configuring(0, 1, usb_host_speed); + usb_error = x; + if (usb_task_state == UHS_USB_HOST_STATE_CHECK) { + if (x) { + MAX_HOST_DEBUG(PSTR("Error 0x%2.2x"), x); + if (x == UHS_HOST_ERROR_JERR) { + usb_task_state = UHS_USB_HOST_STATE_IDLE; + } else if (x != UHS_HOST_ERROR_DEVICE_INIT_INCOMPLETE) { + usb_error = x; + usb_task_state = UHS_USB_HOST_STATE_ERROR; + } + } else + usb_task_state = UHS_USB_HOST_STATE_CONFIGURING_DONE; + } + break; + + case UHS_USB_HOST_STATE_CHECK: + // Serial.println((uint32_t)__builtin_return_address(0), HEX); + break; + case UHS_USB_HOST_STATE_CONFIGURING_DONE: + usb_task_state = UHS_USB_HOST_STATE_RUNNING; + break; + + #ifdef USB_HOST_MANUAL_POLL + case UHS_USB_HOST_STATE_RUNNING: + case UHS_USB_HOST_STATE_ERROR: + case UHS_USB_HOST_STATE_IDLE: + case UHS_USB_HOST_STATE_ILLEGAL: + enable_frame_irq(false); + break; + #else + case UHS_USB_HOST_STATE_RUNNING: + Poll_Others(); + for (x = 0; (usb_task_state == UHS_USB_HOST_STATE_RUNNING) && (x < UHS_HOST_MAX_INTERFACE_DRIVERS); x++) { + if (devConfig[x]) { + if (devConfig[x]->bPollEnable) devConfig[x]->Poll(); + } } - switch(usb_task_state) { - case UHS_USB_HOST_STATE_INITIALIZE: - // should never happen... - MAX_HOST_DEBUG(PSTR("UHS_USB_HOST_STATE_INITIALIZE\r\n")); - busprobe(); - VBUS_changed(); - break; - case UHS_USB_HOST_STATE_DEBOUNCE: - MAX_HOST_DEBUG(PSTR("UHS_USB_HOST_STATE_DEBOUNCE\r\n")); - // This seems to not be needed. The host controller has debounce built in. - sof_countdown = UHS_HOST_DEBOUNCE_DELAY_MS; - usb_task_state = UHS_USB_HOST_STATE_DEBOUNCE_NOT_COMPLETE; - break; - case UHS_USB_HOST_STATE_DEBOUNCE_NOT_COMPLETE: - MAX_HOST_DEBUG(PSTR("UHS_USB_HOST_STATE_DEBOUNCE_NOT_COMPLETE\r\n")); - if(!sof_countdown) usb_task_state = UHS_USB_HOST_STATE_RESET_DEVICE; - break; - case UHS_USB_HOST_STATE_RESET_DEVICE: - MAX_HOST_DEBUG(PSTR("UHS_USB_HOST_STATE_RESET_DEVICE\r\n")); - busevent = true; - usb_task_state = UHS_USB_HOST_STATE_RESET_NOT_COMPLETE; - regWr(rHIRQ, bmBUSEVENTIRQ); // see data sheet. - regWr(rHCTL, bmBUSRST); // issue bus reset - break; - case UHS_USB_HOST_STATE_RESET_NOT_COMPLETE: - MAX_HOST_DEBUG(PSTR("UHS_USB_HOST_STATE_RESET_NOT_COMPLETE\r\n")); - if(!busevent) usb_task_state = UHS_USB_HOST_STATE_WAIT_BUS_READY; - break; - case UHS_USB_HOST_STATE_WAIT_BUS_READY: - MAX_HOST_DEBUG(PSTR("UHS_USB_HOST_STATE_WAIT_BUS_READY\r\n")); - usb_task_state = UHS_USB_HOST_STATE_CONFIGURING; - break; // don't fall through - - case UHS_USB_HOST_STATE_CONFIGURING: - usb_task_state = UHS_USB_HOST_STATE_CHECK; - x = Configuring(0, 1, usb_host_speed); - usb_error = x; - if(usb_task_state == UHS_USB_HOST_STATE_CHECK) { - if(x) { - MAX_HOST_DEBUG(PSTR("Error 0x%2.2x"), x); - if(x == UHS_HOST_ERROR_JERR) { - usb_task_state = UHS_USB_HOST_STATE_IDLE; - } else if(x != UHS_HOST_ERROR_DEVICE_INIT_INCOMPLETE) { - usb_error = x; - usb_task_state = UHS_USB_HOST_STATE_ERROR; - } - } else - usb_task_state = UHS_USB_HOST_STATE_CONFIGURING_DONE; - } - break; - - case UHS_USB_HOST_STATE_CHECK: - // Serial.println((uint32_t)__builtin_return_address(0), HEX); - break; - case UHS_USB_HOST_STATE_CONFIGURING_DONE: - usb_task_state = UHS_USB_HOST_STATE_RUNNING; - break; - #ifdef USB_HOST_MANUAL_POLL - case UHS_USB_HOST_STATE_RUNNING: - case UHS_USB_HOST_STATE_ERROR: - case UHS_USB_HOST_STATE_IDLE: - case UHS_USB_HOST_STATE_ILLEGAL: - enable_frame_irq(false); - break; - #else - case UHS_USB_HOST_STATE_RUNNING: - Poll_Others(); - for(x = 0; (usb_task_state == UHS_USB_HOST_STATE_RUNNING) && (x < UHS_HOST_MAX_INTERFACE_DRIVERS); x++) { - if(devConfig[x]) { - if(devConfig[x]->bPollEnable) devConfig[x]->Poll(); - } - } - // fall thru - #endif - default: - // Do nothing - break; - } // switch( usb_task_state ) - DDSB(); -#if USB_HOST_SHIELD_USE_ISR - if(condet) { - VBUS_changed(); - noInterrupts(); - condet = false; - interrupts(); - } -#endif -#ifdef USB_HOST_SHIELD_TIMING_PIN - // My counter/timer can't work on an inverted gate signal - // so we gate using a high pulse -- AJK - UHS_PIN_WRITE(USB_HOST_SHIELD_TIMING_PIN, LOW); -#endif - //usb_task_polling_disabled--; - EnablePoll(); - DDSB(); + // fall thru + #endif + default: + // Do nothing + break; + } // switch ( usb_task_state ) + DDSB(); + #if USB_HOST_SHIELD_USE_ISR + if (condet) { + VBUS_changed(); + noInterrupts(); + condet = false; + interrupts(); + } + #endif + #ifdef USB_HOST_SHIELD_TIMING_PIN + // My counter/timer can't work on an inverted gate signal + // so we gate using a high pulse -- AJK + UHS_PIN_WRITE(USB_HOST_SHIELD_TIMING_PIN, LOW); + #endif + //usb_task_polling_disabled--; + EnablePoll(); + DDSB(); } /* USB main task. Services the MAX3421e */ #if !USB_HOST_SHIELD_USE_ISR - -void UHS_NI MAX3421E_HOST::ISRTask() { -} -void UHS_NI MAX3421E_HOST::Task() + void UHS_NI MAX3421E_HOST::ISRTask() {} + void UHS_NI MAX3421E_HOST::Task() #else + void UHS_NI MAX3421E_HOST::Task() { + #ifdef USB_HOST_MANUAL_POLL + if (usb_task_state == UHS_USB_HOST_STATE_RUNNING) { + noInterrupts(); + for (uint8_t x = 0; x < UHS_HOST_MAX_INTERFACE_DRIVERS; x++) + if (devConfig[x] && devConfig[x]->bPollEnable) + devConfig[x]->Poll(); + interrupts(); + } + #endif + } -void UHS_NI MAX3421E_HOST::Task() { -#ifdef USB_HOST_MANUAL_POLL - if(usb_task_state == UHS_USB_HOST_STATE_RUNNING) { - noInterrupts(); - for(uint8_t x = 0; x < UHS_HOST_MAX_INTERFACE_DRIVERS; x++) - if(devConfig[x] && devConfig[x]->bPollEnable) - devConfig[x]->Poll(); - interrupts(); - } -#endif -} - -void UHS_NI MAX3421E_HOST::ISRTask() + void UHS_NI MAX3421E_HOST::ISRTask() #endif { - DDSB(); + DDSB(); -#ifndef SWI_IRQ_NUM - suspend_host(); -#if USB_HOST_SHIELD_USE_ISR - // Enable interrupts - interrupts(); -#endif -#endif + #ifndef SWI_IRQ_NUM + suspend_host(); + #if USB_HOST_SHIELD_USE_ISR + // Enable interrupts + interrupts(); + #endif + #endif - counted = false; - if(!MARLIN_UHS_READ_IRQ()) { - uint8_t HIRQALL = regRd(rHIRQ); //determine interrupt source - uint8_t HIRQ = HIRQALL & IRQ_CHECK_MASK; - uint8_t HIRQ_sendback = 0x00; + counted = false; + if (!MARLIN_UHS_READ_IRQ()) { + uint8_t HIRQALL = regRd(rHIRQ); // determine interrupt source + uint8_t HIRQ = HIRQALL & IRQ_CHECK_MASK; + uint8_t HIRQ_sendback = 0x00; - if((HIRQ & bmCONDETIRQ) || (HIRQ & bmBUSEVENTIRQ)) { - MAX_HOST_DEBUG - (PSTR("\r\nBEFORE CDIRQ %s BEIRQ %s resetting %s state 0x%2.2x\r\n"), - (HIRQ & bmCONDETIRQ) ? "T" : "F", - (HIRQ & bmBUSEVENTIRQ) ? "T" : "F", - doingreset ? "T" : "F", - usb_task_state - ); - } - // ALWAYS happens BEFORE or WITH CONDETIRQ - if(HIRQ & bmBUSEVENTIRQ) { - HIRQ_sendback |= bmBUSEVENTIRQ; - if(!doingreset) condet = true; - busprobe(); - busevent = false; - } + if ((HIRQ & bmCONDETIRQ) || (HIRQ & bmBUSEVENTIRQ)) { + MAX_HOST_DEBUG + (PSTR("\r\nBEFORE CDIRQ %s BEIRQ %s resetting %s state 0x%2.2x\r\n"), + (HIRQ & bmCONDETIRQ) ? "T" : "F", + (HIRQ & bmBUSEVENTIRQ) ? "T" : "F", + doingreset ? "T" : "F", + usb_task_state + ); + } + // ALWAYS happens BEFORE or WITH CONDETIRQ + if (HIRQ & bmBUSEVENTIRQ) { + HIRQ_sendback |= bmBUSEVENTIRQ; + if (!doingreset) condet = true; + busprobe(); + busevent = false; + } - if(HIRQ & bmCONDETIRQ) { - HIRQ_sendback |= bmCONDETIRQ; - if(!doingreset) condet = true; - busprobe(); - } + if (HIRQ & bmCONDETIRQ) { + HIRQ_sendback |= bmCONDETIRQ; + if (!doingreset) condet = true; + busprobe(); + } -#if 1 - if((HIRQ & bmCONDETIRQ) || (HIRQ & bmBUSEVENTIRQ)) { - MAX_HOST_DEBUG - (PSTR("\r\nAFTER CDIRQ %s BEIRQ %s resetting %s state 0x%2.2x\r\n"), - (HIRQ & bmCONDETIRQ) ? "T" : "F", - (HIRQ & bmBUSEVENTIRQ) ? "T" : "F", - doingreset ? "T" : "F", - usb_task_state - ); - } -#endif + #if 1 + if ((HIRQ & bmCONDETIRQ) || (HIRQ & bmBUSEVENTIRQ)) { + MAX_HOST_DEBUG + (PSTR("\r\nAFTER CDIRQ %s BEIRQ %s resetting %s state 0x%2.2x\r\n"), + (HIRQ & bmCONDETIRQ) ? "T" : "F", + (HIRQ & bmBUSEVENTIRQ) ? "T" : "F", + doingreset ? "T" : "F", + usb_task_state + ); + } + #endif - if(HIRQ & bmFRAMEIRQ) { - HIRQ_sendback |= bmFRAMEIRQ; - if(sof_countdown) { - sof_countdown--; - counted = true; - } - sofevent = false; - } + if (HIRQ & bmFRAMEIRQ) { + HIRQ_sendback |= bmFRAMEIRQ; + if (sof_countdown) { + sof_countdown--; + counted = true; + } + sofevent = false; + } - //MAX_HOST_DEBUG(PSTR("\r\n%s%s%s\r\n"), - // sof_countdown ? "T" : "F", - // counted ? "T" : "F", - // usb_task_polling_disabled? "T" : "F"); - DDSB(); - regWr(rHIRQ, HIRQ_sendback); -#ifndef SWI_IRQ_NUM - resume_host(); -#if USB_HOST_SHIELD_USE_ISR + //MAX_HOST_DEBUG(PSTR("\r\n%s%s%s\r\n"), + // sof_countdown ? "T" : "F", + // counted ? "T" : "F", + // usb_task_polling_disabled? "T" : "F"); + DDSB(); + regWr(rHIRQ, HIRQ_sendback); + #ifndef SWI_IRQ_NUM + resume_host(); + #if USB_HOST_SHIELD_USE_ISR // Disable interrupts noInterrupts(); -#endif -#endif - if(!sof_countdown && !counted && !usb_task_polling_disabled) { - DisablePoll(); - //usb_task_polling_disabled++; -#ifdef USB_HOST_SHIELD_TIMING_PIN - // My counter/timer can't work on an inverted gate signal - // so we gate using a high pulse -- AJK - UHS_PIN_WRITE(USB_HOST_SHIELD_TIMING_PIN, HIGH); -#endif + #endif + #endif + if (!sof_countdown && !counted && !usb_task_polling_disabled) { + DisablePoll(); + //usb_task_polling_disabled++; + #ifdef USB_HOST_SHIELD_TIMING_PIN + // My counter/timer can't work on an inverted gate signal + // so we gate using a high pulse -- AJK + UHS_PIN_WRITE(USB_HOST_SHIELD_TIMING_PIN, HIGH); + #endif -#ifdef SWI_IRQ_NUM - // MAX_HOST_DEBUG(PSTR("--------------- Doing SWI ----------------")); - exec_SWI(this); -#else -#if USB_HOST_SHIELD_USE_ISR - // Enable interrupts - interrupts(); -#endif /* USB_HOST_SHIELD_USE_ISR */ - ISRbottom(); -#endif /* SWI_IRQ_NUM */ - } - } + #ifdef SWI_IRQ_NUM + //MAX_HOST_DEBUG(PSTR("--------------- Doing SWI ----------------")); + exec_SWI(this); + #else + #if USB_HOST_SHIELD_USE_ISR + // Enable interrupts + interrupts(); + #endif + ISRbottom(); + #endif /* SWI_IRQ_NUM */ + } + } } #if 0 -DDSB(); + DDSB(); #endif + #else -#error "Never include USB_HOST_SHIELD_INLINE.h, include UHS_host.h instead" + #error "Never include USB_HOST_SHIELD_INLINE.h, include UHS_host.h instead" #endif From bfa5e9b584205a475fcf4b979df03e0a5a8d7749 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Mon, 31 Oct 2022 00:30:33 +0000 Subject: [PATCH 043/109] [cron] Bump distribution date (2022-10-31) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 65b25abd3d..6c1dc08b9a 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-10-30" +//#define STRING_DISTRIBUTION_DATE "2022-10-31" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index f9edbef19d..d28ff5dacc 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-10-30" + #define STRING_DISTRIBUTION_DATE "2022-10-31" #endif /** From 1c2d37eb0b65cc8e7aae486732c24b7a835ae890 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 1 Nov 2022 17:14:18 -0500 Subject: [PATCH 044/109] =?UTF-8?q?=F0=9F=8E=A8=20Update=20SAMD51=20header?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/SAMD51/HAL.cpp | 9 +++++++-- Marlin/src/HAL/SAMD51/HAL.h | 9 +++++++-- Marlin/src/HAL/SAMD51/HAL_SPI.cpp | 9 +++++++-- Marlin/src/HAL/SAMD51/MarlinSerial_AGCM4.cpp | 9 +++++++-- Marlin/src/HAL/SAMD51/MarlinSerial_AGCM4.h | 9 +++++++-- Marlin/src/HAL/SAMD51/SAMD51.h | 9 +++++++-- Marlin/src/HAL/SAMD51/Servo.cpp | 9 +++++++-- Marlin/src/HAL/SAMD51/ServoTimers.h | 9 +++++++-- Marlin/src/HAL/SAMD51/eeprom_flash.cpp | 9 +++++++-- Marlin/src/HAL/SAMD51/eeprom_qspi.cpp | 9 +++++++-- Marlin/src/HAL/SAMD51/eeprom_wired.cpp | 9 +++++++-- Marlin/src/HAL/SAMD51/endstop_interrupts.h | 9 +++++++-- Marlin/src/HAL/SAMD51/fastio.h | 9 +++++++-- Marlin/src/HAL/SAMD51/inc/SanityCheck.h | 10 ++++++++-- Marlin/src/HAL/SAMD51/pinsDebug.h | 9 +++++++-- Marlin/src/HAL/SAMD51/spi_pins.h | 9 +++++++-- Marlin/src/HAL/SAMD51/timers.cpp | 9 +++++++-- Marlin/src/HAL/SAMD51/timers.h | 9 +++++++-- 18 files changed, 127 insertions(+), 36 deletions(-) diff --git a/Marlin/src/HAL/SAMD51/HAL.cpp b/Marlin/src/HAL/SAMD51/HAL.cpp index bd1c98bfa1..8c102b643d 100644 --- a/Marlin/src/HAL/SAMD51/HAL.cpp +++ b/Marlin/src/HAL/SAMD51/HAL.cpp @@ -1,8 +1,9 @@ /** * Marlin 3D Printer Firmware - * * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + * + * 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 @@ -18,6 +19,10 @@ * along with this program. If not, see . * */ + +/** + * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + */ #ifdef __SAMD51__ #include "../../inc/MarlinConfig.h" diff --git a/Marlin/src/HAL/SAMD51/HAL.h b/Marlin/src/HAL/SAMD51/HAL.h index 79ba8021f4..fe29d6c7f4 100644 --- a/Marlin/src/HAL/SAMD51/HAL.h +++ b/Marlin/src/HAL/SAMD51/HAL.h @@ -1,8 +1,9 @@ /** * Marlin 3D Printer Firmware - * * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + * + * 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 @@ -20,6 +21,10 @@ */ #pragma once +/** + * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + */ + #define CPU_32_BIT #include "../shared/Marduino.h" diff --git a/Marlin/src/HAL/SAMD51/HAL_SPI.cpp b/Marlin/src/HAL/SAMD51/HAL_SPI.cpp index 77f4d5ecd5..58fdfe9499 100644 --- a/Marlin/src/HAL/SAMD51/HAL_SPI.cpp +++ b/Marlin/src/HAL/SAMD51/HAL_SPI.cpp @@ -1,8 +1,9 @@ /** * Marlin 3D Printer Firmware - * * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + * + * 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 @@ -19,6 +20,10 @@ * */ +/** + * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + */ + /** * Hardware and software SPI implementations are included in this file. * diff --git a/Marlin/src/HAL/SAMD51/MarlinSerial_AGCM4.cpp b/Marlin/src/HAL/SAMD51/MarlinSerial_AGCM4.cpp index a16ea2f758..baa7a38503 100644 --- a/Marlin/src/HAL/SAMD51/MarlinSerial_AGCM4.cpp +++ b/Marlin/src/HAL/SAMD51/MarlinSerial_AGCM4.cpp @@ -1,8 +1,9 @@ /** * Marlin 3D Printer Firmware - * * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + * + * 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 @@ -18,6 +19,10 @@ * along with this program. If not, see . * */ + +/** + * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + */ #ifdef ADAFRUIT_GRAND_CENTRAL_M4 /** diff --git a/Marlin/src/HAL/SAMD51/MarlinSerial_AGCM4.h b/Marlin/src/HAL/SAMD51/MarlinSerial_AGCM4.h index ac5a379398..1044d9fcd0 100644 --- a/Marlin/src/HAL/SAMD51/MarlinSerial_AGCM4.h +++ b/Marlin/src/HAL/SAMD51/MarlinSerial_AGCM4.h @@ -1,8 +1,9 @@ /** * Marlin 3D Printer Firmware - * * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + * + * 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 @@ -20,6 +21,10 @@ */ #pragma once +/** + * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + */ + #include "../../core/serial_hook.h" typedef Serial1Class UartT; diff --git a/Marlin/src/HAL/SAMD51/SAMD51.h b/Marlin/src/HAL/SAMD51/SAMD51.h index 783956140d..8cc19d7155 100644 --- a/Marlin/src/HAL/SAMD51/SAMD51.h +++ b/Marlin/src/HAL/SAMD51/SAMD51.h @@ -1,8 +1,9 @@ /** * Marlin 3D Printer Firmware - * * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + * + * 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 @@ -20,6 +21,10 @@ */ #pragma once +/** + * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + */ + #define SYNC(sc) while (sc) { \ asm(""); \ } diff --git a/Marlin/src/HAL/SAMD51/Servo.cpp b/Marlin/src/HAL/SAMD51/Servo.cpp index 665322fe24..e533eee301 100644 --- a/Marlin/src/HAL/SAMD51/Servo.cpp +++ b/Marlin/src/HAL/SAMD51/Servo.cpp @@ -1,8 +1,9 @@ /** * Marlin 3D Printer Firmware - * * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + * + * 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 @@ -19,6 +20,10 @@ * */ +/** + * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + */ + /** * This comes from Arduino library which at the moment is buggy and uncompilable */ diff --git a/Marlin/src/HAL/SAMD51/ServoTimers.h b/Marlin/src/HAL/SAMD51/ServoTimers.h index 948d515356..47e0a190aa 100644 --- a/Marlin/src/HAL/SAMD51/ServoTimers.h +++ b/Marlin/src/HAL/SAMD51/ServoTimers.h @@ -1,8 +1,9 @@ /** * Marlin 3D Printer Firmware - * * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + * + * 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 @@ -20,6 +21,10 @@ */ #pragma once +/** + * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + */ + #define _useTimer1 #define _useTimer2 diff --git a/Marlin/src/HAL/SAMD51/eeprom_flash.cpp b/Marlin/src/HAL/SAMD51/eeprom_flash.cpp index 871bf22b7f..7d5518956c 100644 --- a/Marlin/src/HAL/SAMD51/eeprom_flash.cpp +++ b/Marlin/src/HAL/SAMD51/eeprom_flash.cpp @@ -1,8 +1,9 @@ /** * Marlin 3D Printer Firmware - * * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + * + * 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 @@ -18,6 +19,10 @@ * along with this program. If not, see . * */ + +/** + * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + */ #ifdef __SAMD51__ #include "../../inc/MarlinConfig.h" diff --git a/Marlin/src/HAL/SAMD51/eeprom_qspi.cpp b/Marlin/src/HAL/SAMD51/eeprom_qspi.cpp index faa7637197..1c82ede040 100644 --- a/Marlin/src/HAL/SAMD51/eeprom_qspi.cpp +++ b/Marlin/src/HAL/SAMD51/eeprom_qspi.cpp @@ -1,8 +1,9 @@ /** * Marlin 3D Printer Firmware - * * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + * + * 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 @@ -18,6 +19,10 @@ * along with this program. If not, see . * */ + +/** + * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + */ #ifdef __SAMD51__ #include "../../inc/MarlinConfig.h" diff --git a/Marlin/src/HAL/SAMD51/eeprom_wired.cpp b/Marlin/src/HAL/SAMD51/eeprom_wired.cpp index 3481fe539c..7a03d4eaa3 100644 --- a/Marlin/src/HAL/SAMD51/eeprom_wired.cpp +++ b/Marlin/src/HAL/SAMD51/eeprom_wired.cpp @@ -1,8 +1,9 @@ /** * Marlin 3D Printer Firmware - * * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + * + * 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 @@ -18,6 +19,10 @@ * along with this program. If not, see . * */ + +/** + * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + */ #ifdef __SAMD51__ #include "../../inc/MarlinConfig.h" diff --git a/Marlin/src/HAL/SAMD51/endstop_interrupts.h b/Marlin/src/HAL/SAMD51/endstop_interrupts.h index 2f02f404f5..e0e811c3a0 100644 --- a/Marlin/src/HAL/SAMD51/endstop_interrupts.h +++ b/Marlin/src/HAL/SAMD51/endstop_interrupts.h @@ -1,8 +1,9 @@ /** * Marlin 3D Printer Firmware - * * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + * + * 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 @@ -20,6 +21,10 @@ */ #pragma once +/** + * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + */ + /** * Endstop interrupts for ATMEL SAMD51 based targets. * diff --git a/Marlin/src/HAL/SAMD51/fastio.h b/Marlin/src/HAL/SAMD51/fastio.h index 79aede5790..0acf481317 100644 --- a/Marlin/src/HAL/SAMD51/fastio.h +++ b/Marlin/src/HAL/SAMD51/fastio.h @@ -1,8 +1,9 @@ /** * Marlin 3D Printer Firmware - * * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + * + * 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 @@ -20,6 +21,10 @@ */ #pragma once +/** + * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + */ + /** * Fast IO functions for SAMD51 */ diff --git a/Marlin/src/HAL/SAMD51/inc/SanityCheck.h b/Marlin/src/HAL/SAMD51/inc/SanityCheck.h index 1b876c947d..ae1bc2f3ef 100644 --- a/Marlin/src/HAL/SAMD51/inc/SanityCheck.h +++ b/Marlin/src/HAL/SAMD51/inc/SanityCheck.h @@ -1,8 +1,9 @@ /** * Marlin 3D Printer Firmware - * * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + * + * 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 @@ -18,6 +19,11 @@ * along with this program. If not, see . * */ +#pragma once + +/** + * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + */ /** * Test SAMD51 specific configuration values for errors at compile-time. diff --git a/Marlin/src/HAL/SAMD51/pinsDebug.h b/Marlin/src/HAL/SAMD51/pinsDebug.h index 639c4cd66e..94f91c77bc 100644 --- a/Marlin/src/HAL/SAMD51/pinsDebug.h +++ b/Marlin/src/HAL/SAMD51/pinsDebug.h @@ -1,8 +1,9 @@ /** * Marlin 3D Printer Firmware - * * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + * + * 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 @@ -20,6 +21,10 @@ */ #pragma once +/** + * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + */ + #define NUMBER_PINS_TOTAL PINS_COUNT #define digitalRead_mod(p) extDigitalRead(p) diff --git a/Marlin/src/HAL/SAMD51/spi_pins.h b/Marlin/src/HAL/SAMD51/spi_pins.h index 2a667bcaa1..f1e4fd4302 100644 --- a/Marlin/src/HAL/SAMD51/spi_pins.h +++ b/Marlin/src/HAL/SAMD51/spi_pins.h @@ -1,8 +1,9 @@ /** * Marlin 3D Printer Firmware - * * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + * + * 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 @@ -20,6 +21,10 @@ */ #pragma once +/** + * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + */ + #ifdef ADAFRUIT_GRAND_CENTRAL_M4 /* diff --git a/Marlin/src/HAL/SAMD51/timers.cpp b/Marlin/src/HAL/SAMD51/timers.cpp index 1ad0e36073..7a211eb36a 100644 --- a/Marlin/src/HAL/SAMD51/timers.cpp +++ b/Marlin/src/HAL/SAMD51/timers.cpp @@ -1,8 +1,9 @@ /** * Marlin 3D Printer Firmware - * * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + * + * 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 @@ -18,6 +19,10 @@ * along with this program. If not, see . * */ + +/** + * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + */ #ifdef __SAMD51__ // -------------------------------------------------------------------------- diff --git a/Marlin/src/HAL/SAMD51/timers.h b/Marlin/src/HAL/SAMD51/timers.h index 86e980c566..86c3241892 100644 --- a/Marlin/src/HAL/SAMD51/timers.h +++ b/Marlin/src/HAL/SAMD51/timers.h @@ -1,8 +1,9 @@ /** * Marlin 3D Printer Firmware - * * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + * + * 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 @@ -20,6 +21,10 @@ */ #pragma once +/** + * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + */ + #include // -------------------------------------------------------------------------- From cd7fa1fdba10512779d9ba4fcdf7070b47cd4445 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Wed, 2 Nov 2022 00:29:17 +0000 Subject: [PATCH 045/109] [cron] Bump distribution date (2022-11-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 6c1dc08b9a..dfc428354a 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-10-31" +//#define STRING_DISTRIBUTION_DATE "2022-11-02" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index d28ff5dacc..28d9fdd5ce 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-10-31" + #define STRING_DISTRIBUTION_DATE "2022-11-02" #endif /** From c57925029471a4ce9acf2d96a5fda4d088b3e172 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 3 Nov 2022 21:29:22 -0500 Subject: [PATCH 046/109] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Mor?= =?UTF-8?q?e=20direct=20encoder=20spin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/buttons.h | 7 ------- Marlin/src/lcd/e3v2/common/encoder.cpp | 24 ++++++++++++------------ Marlin/src/lcd/marlinui.cpp | 8 ++++---- 3 files changed, 16 insertions(+), 23 deletions(-) diff --git a/Marlin/src/lcd/buttons.h b/Marlin/src/lcd/buttons.h index 67b7aa3944..58471239bb 100644 --- a/Marlin/src/lcd/buttons.h +++ b/Marlin/src/lcd/buttons.h @@ -38,13 +38,6 @@ #define HAS_SLOW_BUTTONS 1 #endif -#if HAS_ENCODER_WHEEL - #define ENCODER_PHASE_0 0 - #define ENCODER_PHASE_1 2 - #define ENCODER_PHASE_2 3 - #define ENCODER_PHASE_3 1 -#endif - #if EITHER(HAS_DIGITAL_BUTTONS, HAS_DWIN_E3V2) // Wheel spin pins where BA is 00, 10, 11, 01 (1 bit always changes) #define BLEN_A 0 diff --git a/Marlin/src/lcd/e3v2/common/encoder.cpp b/Marlin/src/lcd/e3v2/common/encoder.cpp index f14d63e7b5..5081e27690 100644 --- a/Marlin/src/lcd/e3v2/common/encoder.cpp +++ b/Marlin/src/lcd/e3v2/common/encoder.cpp @@ -96,21 +96,21 @@ EncoderState Encoder_ReceiveAnalyze() { } if (newbutton != lastEncoderBits) { switch (newbutton) { - case ENCODER_PHASE_0: - if (lastEncoderBits == ENCODER_PHASE_3) temp_diff++; - else if (lastEncoderBits == ENCODER_PHASE_1) temp_diff--; + case 0: + if (lastEncoderBits == 1) temp_diff++; + else if (lastEncoderBits == 2) temp_diff--; break; - case ENCODER_PHASE_1: - if (lastEncoderBits == ENCODER_PHASE_0) temp_diff++; - else if (lastEncoderBits == ENCODER_PHASE_2) temp_diff--; + case 2: + if (lastEncoderBits == 0) temp_diff++; + else if (lastEncoderBits == 3) temp_diff--; break; - case ENCODER_PHASE_2: - if (lastEncoderBits == ENCODER_PHASE_1) temp_diff++; - else if (lastEncoderBits == ENCODER_PHASE_3) temp_diff--; + case 3: + if (lastEncoderBits == 2) temp_diff++; + else if (lastEncoderBits == 1) temp_diff--; break; - case ENCODER_PHASE_3: - if (lastEncoderBits == ENCODER_PHASE_2) temp_diff++; - else if (lastEncoderBits == ENCODER_PHASE_0) temp_diff--; + case 1: + if (lastEncoderBits == 3) temp_diff++; + else if (lastEncoderBits == 0) temp_diff--; break; } lastEncoderBits = newbutton; diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 0dfe60d8e4..5991806b7b 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -1382,10 +1382,10 @@ void MarlinUI::init() { if (buttons & EN_B) enc |= B10; if (enc != lastEncoderBits) { switch (enc) { - case ENCODER_PHASE_0: ENCODER_SPIN(ENCODER_PHASE_3, ENCODER_PHASE_1); break; - case ENCODER_PHASE_1: ENCODER_SPIN(ENCODER_PHASE_0, ENCODER_PHASE_2); break; - case ENCODER_PHASE_2: ENCODER_SPIN(ENCODER_PHASE_1, ENCODER_PHASE_3); break; - case ENCODER_PHASE_3: ENCODER_SPIN(ENCODER_PHASE_2, ENCODER_PHASE_0); break; + case 0: ENCODER_SPIN(1, 2); break; + case 2: ENCODER_SPIN(0, 3); break; + case 3: ENCODER_SPIN(2, 1); break; + case 1: ENCODER_SPIN(3, 0); break; } #if BOTH(HAS_MARLINUI_MENU, AUTO_BED_LEVELING_UBL) external_encoder(); From 32fa577d256eac7bbd8f53c857eaed123d6bf9dd Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 4 Nov 2022 06:06:27 +0000 Subject: [PATCH 047/109] [cron] Bump distribution date (2022-11-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 dfc428354a..f3d1b2cc53 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-11-02" +//#define STRING_DISTRIBUTION_DATE "2022-11-04" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 28d9fdd5ce..ff30431d90 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-11-02" + #define STRING_DISTRIBUTION_DATE "2022-11-04" #endif /** From a80d2f065e31248a10d3c8b1c4d4492f6b6196fc Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 4 Nov 2022 20:00:56 -0500 Subject: [PATCH 048/109] =?UTF-8?q?=F0=9F=A9=B9=20leds.update=20needed=20f?= =?UTF-8?q?or=20reset=5Ftimeout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #23590 --- Marlin/src/feature/leds/leds.h | 14 ++++++++------ buildroot/tests/rambo | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Marlin/src/feature/leds/leds.h b/Marlin/src/feature/leds/leds.h index 8649dd014f..572fd0dfac 100644 --- a/Marlin/src/feature/leds/leds.h +++ b/Marlin/src/feature/leds/leds.h @@ -107,6 +107,13 @@ typedef struct LEDColor { class LEDLights { public: + #if ANY(LED_CONTROL_MENU, PRINTER_EVENT_LEDS, CASE_LIGHT_IS_COLOR_LED) + static LEDColor color; // last non-off color + static bool lights_on; // the last set color was "on" + #else + static constexpr bool lights_on = true; + #endif + LEDLights() {} // ctor static void setup(); // init() @@ -142,15 +149,10 @@ public: static LEDColor get_color() { return lights_on ? color : LEDColorOff(); } #endif - #if ANY(LED_CONTROL_MENU, PRINTER_EVENT_LEDS, CASE_LIGHT_IS_COLOR_LED) - static LEDColor color; // last non-off color - static bool lights_on; // the last set color was "on" - #endif - #if ENABLED(LED_CONTROL_MENU) static void toggle(); // swap "off" with color #endif - #if EITHER(LED_CONTROL_MENU, CASE_LIGHT_USE_RGB_LED) + #if EITHER(LED_CONTROL_MENU, CASE_LIGHT_USE_RGB_LED) || LED_POWEROFF_TIMEOUT > 0 static void update() { set_color(color); } #endif diff --git a/buildroot/tests/rambo b/buildroot/tests/rambo index de6cdc7129..9a017c971f 100755 --- a/buildroot/tests/rambo +++ b/buildroot/tests/rambo @@ -32,7 +32,7 @@ opt_enable USE_ZMAX_PLUG REPRAP_DISCOUNT_SMART_CONTROLLER LCD_PROGRESS_BAR LCD_P SKEW_CORRECTION SKEW_CORRECTION_FOR_Z SKEW_CORRECTION_GCODE \ BACKLASH_COMPENSATION BACKLASH_GCODE BAUD_RATE_GCODE BEZIER_CURVE_SUPPORT \ FWRETRACT ARC_P_CIRCLES CNC_WORKSPACE_PLANES CNC_COORDINATE_SYSTEMS \ - PSU_CONTROL PS_OFF_CONFIRM PS_OFF_SOUND POWER_OFF_WAIT_FOR_COOLDOWN \ + PSU_CONTROL LED_POWEROFF_TIMEOUT PS_OFF_CONFIRM PS_OFF_SOUND POWER_OFF_WAIT_FOR_COOLDOWN \ POWER_LOSS_RECOVERY POWER_LOSS_PIN POWER_LOSS_STATE POWER_LOSS_RECOVER_ZHOME POWER_LOSS_ZHOME_POS \ SLOW_PWM_HEATERS THERMAL_PROTECTION_CHAMBER LIN_ADVANCE ADVANCE_K_EXTRA \ HOST_ACTION_COMMANDS HOST_PROMPT_SUPPORT PINS_DEBUGGING MAX7219_DEBUG M114_DETAIL From 726321bc845bb45628a62158059157b455c9d39b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 4 Nov 2022 20:10:59 -0500 Subject: [PATCH 049/109] =?UTF-8?q?=F0=9F=A9=B9=20MAX=20Thermocouple=20fol?= =?UTF-8?q?lowup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #24898 --- Marlin/src/inc/Conditionals_LCD.h | 7 +++++-- Marlin/src/module/temperature.cpp | 14 ++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index b21eca30b2..c1b43d2fc0 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -1020,8 +1020,11 @@ #endif // Helper macros for extruder and hotend arrays -#define EXTRUDER_LOOP() for (int8_t e = 0; e < EXTRUDERS; e++) -#define HOTEND_LOOP() for (int8_t e = 0; e < HOTENDS; e++) +#define _EXTRUDER_LOOP(E) for (int8_t E = 0; E < EXTRUDERS; E++) +#define EXTRUDER_LOOP() _EXTRUDER_LOOP(e) +#define _HOTEND_LOOP(H) for (int8_t H = 0; H < HOTENDS; H++) +#define HOTEND_LOOP() _HOTEND_LOOP(e) + #define ARRAY_BY_EXTRUDERS(V...) ARRAY_N(EXTRUDERS, V) #define ARRAY_BY_EXTRUDERS1(v1) ARRAY_N_1(EXTRUDERS, v1) #define ARRAY_BY_HOTENDS(V...) ARRAY_N(HOTENDS, V) diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 8843582f4e..37996a80ea 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -2374,7 +2374,7 @@ void Temperature::updateTemperaturesFromRawValues() { TERN_(HAS_POWER_MONITOR, power_monitor.capture_values()); #if HAS_HOTEND - static constexpr int8_t temp_dir[] = { + static constexpr int8_t temp_dir[HOTENDS] = { #if TEMP_SENSOR_IS_ANY_MAX_TC(0) 0 #else @@ -2386,19 +2386,21 @@ void Temperature::updateTemperaturesFromRawValues() { #else , TEMPDIR(1) #endif + #endif + #if HOTENDS > 2 #if TEMP_SENSOR_IS_ANY_MAX_TC(2) , 0 #else , TEMPDIR(2) #endif - #if HOTENDS > 3 - #define _TEMPDIR(N) , TEMPDIR(N) - REPEAT_S(3, HOTENDS, _TEMPDIR) - #endif + #endif + #if HOTENDS > 3 + #define _TEMPDIR(N) , TEMPDIR(N) + REPEAT_S(3, HOTENDS, _TEMPDIR) #endif }; - LOOP_L_N(e, COUNT(temp_dir)) { + HOTEND_LOOP() { const raw_adc_t r = temp_hotend[e].getraw(); const bool neg = temp_dir[e] < 0, pos = temp_dir[e] > 0; if ((neg && r < temp_range[e].raw_max) || (pos && r > temp_range[e].raw_max)) From e86c78379a4df1351d10d5b1e19312a894cb331b Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 5 Nov 2022 06:05:56 +0000 Subject: [PATCH 050/109] [cron] Bump distribution date (2022-11-05) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index f3d1b2cc53..55f0e421fe 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-11-04" +//#define STRING_DISTRIBUTION_DATE "2022-11-05" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index ff30431d90..9b40482ff2 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-11-04" + #define STRING_DISTRIBUTION_DATE "2022-11-05" #endif /** From 885e923bffc29caaf002ac4cf35e780d3a923634 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 6 Nov 2022 23:49:38 -0600 Subject: [PATCH 051/109] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20EEPROM=20write=20f?= =?UTF-8?q?or=20!LIN=5FADVANCE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #24963 Followup to #24821 --- Marlin/src/module/settings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index f76b5afe74..a090b140ad 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -1421,7 +1421,7 @@ void MarlinSettings::postprocess() { EEPROM_WRITE(planner.extruder_advance_K); #else dummyf = 0; - for (uint8_t q = _MAX(EXTRUDERS, 1); q--;) EEPROM_WRITE(dummyf); + for (uint8_t q = DISTINCT_E; q--;) EEPROM_WRITE(dummyf); #endif } From c209626bda49f0e8bf9c7ccaf75eacc5f709a930 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Mon, 7 Nov 2022 06:06:50 +0000 Subject: [PATCH 052/109] [cron] Bump distribution date (2022-11-07) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 55f0e421fe..9c43d75aa2 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-11-05" +//#define STRING_DISTRIBUTION_DATE "2022-11-07" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 9b40482ff2..3480bce555 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-11-05" + #define STRING_DISTRIBUTION_DATE "2022-11-07" #endif /** From 3985d269397e59bd69e5169d7cc3d2542af88086 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 9 Nov 2022 20:54:17 -0600 Subject: [PATCH 053/109] =?UTF-8?q?=F0=9F=90=9B=20Fix=20recalculate=5Fmax?= =?UTF-8?q?=5Fe=5Fjerk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/planner.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index cfd7b45516..32b5a8795b 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -988,7 +988,7 @@ class Planner { FORCE_INLINE static void recalculate_max_e_jerk() { const float prop = junction_deviation_mm * SQRT(0.5) / (1.0f - SQRT(0.5)); EXTRUDER_LOOP() - max_e_jerk[E_INDEX_N(e)] = SQRT(prop * settings.max_acceleration_mm_per_s2[E_INDEX_N(e)]); + max_e_jerk[E_INDEX_N(e)] = SQRT(prop * settings.max_acceleration_mm_per_s2[E_AXIS_N(e)]); } #endif From 4d913fbf337ad5cbace9ba638bc95101a9cc7ab3 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Thu, 10 Nov 2022 06:06:37 +0000 Subject: [PATCH 054/109] [cron] Bump distribution date (2022-11-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 9c43d75aa2..e9c5a460a5 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-11-07" +//#define STRING_DISTRIBUTION_DATE "2022-11-10" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 3480bce555..2e616e9c14 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-11-07" + #define STRING_DISTRIBUTION_DATE "2022-11-10" #endif /** From d123ea7346c4a72b08e82e7c876a97296d5c8090 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 11 Nov 2022 16:09:26 -0600 Subject: [PATCH 055/109] =?UTF-8?q?=F0=9F=8E=A8=20Prefer=20axis=20element?= =?UTF-8?q?=20over=20index?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/e3v2/creality/dwin.cpp | 8 ++++---- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 16 ++++++++-------- Marlin/src/lcd/e3v2/proui/dwin.cpp | 16 ++++++++-------- .../generic/move_axis_screen.cpp | 2 +- .../src/lcd/extui/mks_ui/draw_jerk_settings.cpp | 8 ++++---- Marlin/src/lcd/extui/mks_ui/draw_number_key.cpp | 16 ++++++++-------- 6 files changed, 33 insertions(+), 33 deletions(-) diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index 1232c8e0c9..08d928684a 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp @@ -3395,11 +3395,11 @@ void Draw_Max_Accel_Menu() { Draw_Back_First(); LOOP_L_N(i, 3 + ENABLED(HAS_HOTEND)) Draw_Menu_Line(i + 1, ICON_MaxSpeedJerkX + i); - Draw_Edit_Float3(1, planner.max_jerk[X_AXIS] * MINUNITMULT); - Draw_Edit_Float3(2, planner.max_jerk[Y_AXIS] * MINUNITMULT); - Draw_Edit_Float3(3, planner.max_jerk[Z_AXIS] * MINUNITMULT); + Draw_Edit_Float3(1, planner.max_jerk.x * MINUNITMULT); + Draw_Edit_Float3(2, planner.max_jerk.y * MINUNITMULT); + Draw_Edit_Float3(3, planner.max_jerk.z * MINUNITMULT); #if HAS_HOTEND - Draw_Edit_Float3(4, planner.max_jerk[E_AXIS] * MINUNITMULT); + Draw_Edit_Float3(4, planner.max_jerk.e * MINUNITMULT); #endif } #endif diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 21f93c6b98..cba90c7ac5 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -2465,35 +2465,35 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ case JERK_X: if (draw) { Draw_Menu_Item(row, ICON_MaxSpeedJerkX, F("X Axis")); - Draw_Float(planner.max_jerk[X_AXIS], row, false, 10); + Draw_Float(planner.max_jerk.x, row, false, 10); } else - Modify_Value(planner.max_jerk[X_AXIS], 0, default_max_jerk[X_AXIS] * 2, 10); + Modify_Value(planner.max_jerk.x, 0, default_max_jerk[X_AXIS] * 2, 10); break; case JERK_Y: if (draw) { Draw_Menu_Item(row, ICON_MaxSpeedJerkY, F("Y Axis")); - Draw_Float(planner.max_jerk[Y_AXIS], row, false, 10); + Draw_Float(planner.max_jerk.y, row, false, 10); } else - Modify_Value(planner.max_jerk[Y_AXIS], 0, default_max_jerk[Y_AXIS] * 2, 10); + Modify_Value(planner.max_jerk.y, 0, default_max_jerk[Y_AXIS] * 2, 10); break; case JERK_Z: if (draw) { Draw_Menu_Item(row, ICON_MaxSpeedJerkZ, F("Z Axis")); - Draw_Float(planner.max_jerk[Z_AXIS], row, false, 10); + Draw_Float(planner.max_jerk.z, row, false, 10); } else - Modify_Value(planner.max_jerk[Z_AXIS], 0, default_max_jerk[Z_AXIS] * 2, 10); + Modify_Value(planner.max_jerk.z, 0, default_max_jerk[Z_AXIS] * 2, 10); break; #if HAS_HOTEND case JERK_E: if (draw) { Draw_Menu_Item(row, ICON_MaxSpeedJerkE, F("Extruder")); - Draw_Float(planner.max_jerk[E_AXIS], row, false, 10); + Draw_Float(planner.max_jerk.e, row, false, 10); } else - Modify_Value(planner.max_jerk[E_AXIS], 0, default_max_jerk[E_AXIS] * 2, 10); + Modify_Value(planner.max_jerk.e, 0, default_max_jerk[E_AXIS] * 2, 10); break; #endif } diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 06768ed18f..fcceb2d52d 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -2654,11 +2654,11 @@ void SetMaxAccelZ() { HMI_value.axis = Z_AXIS, SetIntOnClick(MIN_MAXACCELERATION #if HAS_CLASSIC_JERK void ApplyMaxJerk() { planner.set_max_jerk(HMI_value.axis, MenuData.Value / MINUNITMULT); } - void SetMaxJerkX() { HMI_value.axis = X_AXIS, SetFloatOnClick(MIN_MAXJERK, max_jerk_edit_values[X_AXIS], UNITFDIGITS, planner.max_jerk[X_AXIS], ApplyMaxJerk); } - void SetMaxJerkY() { HMI_value.axis = Y_AXIS, SetFloatOnClick(MIN_MAXJERK, max_jerk_edit_values[Y_AXIS], UNITFDIGITS, planner.max_jerk[Y_AXIS], ApplyMaxJerk); } - void SetMaxJerkZ() { HMI_value.axis = Z_AXIS, SetFloatOnClick(MIN_MAXJERK, max_jerk_edit_values[Z_AXIS], UNITFDIGITS, planner.max_jerk[Z_AXIS], ApplyMaxJerk); } + void SetMaxJerkX() { HMI_value.axis = X_AXIS, SetFloatOnClick(MIN_MAXJERK, max_jerk_edit_values[X_AXIS], UNITFDIGITS, planner.max_jerk.x, ApplyMaxJerk); } + void SetMaxJerkY() { HMI_value.axis = Y_AXIS, SetFloatOnClick(MIN_MAXJERK, max_jerk_edit_values[Y_AXIS], UNITFDIGITS, planner.max_jerk.y, ApplyMaxJerk); } + void SetMaxJerkZ() { HMI_value.axis = Z_AXIS, SetFloatOnClick(MIN_MAXJERK, max_jerk_edit_values[Z_AXIS], UNITFDIGITS, planner.max_jerk.z, ApplyMaxJerk); } #if HAS_HOTEND - void SetMaxJerkE() { HMI_value.axis = E_AXIS; SetFloatOnClick(MIN_MAXJERK, max_jerk_edit_values[E_AXIS], UNITFDIGITS, planner.max_jerk[E_AXIS], ApplyMaxJerk); } + void SetMaxJerkE() { HMI_value.axis = E_AXIS; SetFloatOnClick(MIN_MAXJERK, max_jerk_edit_values[E_AXIS], UNITFDIGITS, planner.max_jerk.e, ApplyMaxJerk); } #endif #endif @@ -3641,11 +3641,11 @@ void Draw_MaxAccel_Menu() { SetMenuTitle({1, 16, 28, 13}, GET_TEXT_F(MSG_JERK)); MenuItemsPrepare(5); BACK_ITEM(Draw_Motion_Menu); - EDIT_ITEM_F(ICON_MaxSpeedJerkX, MSG_VA_JERK, onDrawMaxJerkX, SetMaxJerkX, &planner.max_jerk[X_AXIS]); - EDIT_ITEM_F(ICON_MaxSpeedJerkY, MSG_VB_JERK, onDrawMaxJerkY, SetMaxJerkY, &planner.max_jerk[Y_AXIS]); - EDIT_ITEM_F(ICON_MaxSpeedJerkZ, MSG_VC_JERK, onDrawMaxJerkZ, SetMaxJerkZ, &planner.max_jerk[Z_AXIS]); + EDIT_ITEM_F(ICON_MaxSpeedJerkX, MSG_VA_JERK, onDrawMaxJerkX, SetMaxJerkX, &planner.max_jerk.x); + EDIT_ITEM_F(ICON_MaxSpeedJerkY, MSG_VB_JERK, onDrawMaxJerkY, SetMaxJerkY, &planner.max_jerk.y); + EDIT_ITEM_F(ICON_MaxSpeedJerkZ, MSG_VC_JERK, onDrawMaxJerkZ, SetMaxJerkZ, &planner.max_jerk.z); #if HAS_HOTEND - EDIT_ITEM_F(ICON_MaxSpeedJerkE, MSG_VE_JERK, onDrawMaxJerkE, SetMaxJerkE, &planner.max_jerk[E_AXIS]); + EDIT_ITEM_F(ICON_MaxSpeedJerkE, MSG_VE_JERK, onDrawMaxJerkE, SetMaxJerkE, &planner.max_jerk.e); #endif } CurrentMenu->draw(); diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/move_axis_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/move_axis_screen.cpp index a3c3b503d8..e077eb371a 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/move_axis_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/move_axis_screen.cpp @@ -113,7 +113,7 @@ bool BaseMoveAxisScreen::onTouchHeld(uint8_t tag) { void BaseMoveAxisScreen::raiseZtoTop() { constexpr xyze_feedrate_t homing_feedrate = HOMING_FEEDRATE_MM_M; - setAxisPosition_mm(Z_MAX_POS - 5, Z, homing_feedrate[Z_AXIS]); + setAxisPosition_mm(Z_MAX_POS - 5, Z, homing_feedrate.z); } float BaseMoveAxisScreen::getManualFeedrate(uint8_t axis, float increment_mm) { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_jerk_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_jerk_settings.cpp index a680976d96..a070cae15f 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_jerk_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_jerk_settings.cpp @@ -74,16 +74,16 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { void lv_draw_jerk_settings() { scr = lv_screen_create(JERK_UI, machine_menu.JerkConfTitle); - dtostrf(planner.max_jerk[X_AXIS], 1, 1, public_buf_l); + dtostrf(planner.max_jerk.x, 1, 1, public_buf_l); lv_screen_menu_item_1_edit(scr, machine_menu.X_Jerk, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_JERK_X, 0, public_buf_l); - dtostrf(planner.max_jerk[Y_AXIS], 1, 1, public_buf_l); + dtostrf(planner.max_jerk.y, 1, 1, public_buf_l); lv_screen_menu_item_1_edit(scr, machine_menu.Y_Jerk, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_JERK_Y, 1, public_buf_l); - dtostrf(planner.max_jerk[Z_AXIS], 1, 1, public_buf_l); + dtostrf(planner.max_jerk.z, 1, 1, public_buf_l); lv_screen_menu_item_1_edit(scr, machine_menu.Z_Jerk, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_JERK_Z, 2, public_buf_l); - dtostrf(planner.max_jerk[E_AXIS], 1, 1, public_buf_l); + dtostrf(planner.max_jerk.e, 1, 1, public_buf_l); lv_screen_menu_item_1_edit(scr, machine_menu.E_Jerk, PARA_UI_POS_X, PARA_UI_POS_Y * 4, event_handler, ID_JERK_E, 3, public_buf_l); lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X, PARA_UI_BACK_POS_Y, event_handler, ID_JERK_RETURN, true); diff --git a/Marlin/src/lcd/extui/mks_ui/draw_number_key.cpp b/Marlin/src/lcd/extui/mks_ui/draw_number_key.cpp index deed037248..850a409a18 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_number_key.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_number_key.cpp @@ -119,22 +119,22 @@ static void disp_key_value() { case XJerk: #if HAS_CLASSIC_JERK - dtostrf(planner.max_jerk[X_AXIS], 1, 1, public_buf_m); + dtostrf(planner.max_jerk.x, 1, 1, public_buf_m); #endif break; case YJerk: #if HAS_CLASSIC_JERK - dtostrf(planner.max_jerk[Y_AXIS], 1, 1, public_buf_m); + dtostrf(planner.max_jerk.y, 1, 1, public_buf_m); #endif break; case ZJerk: #if HAS_CLASSIC_JERK - dtostrf(planner.max_jerk[Z_AXIS], 1, 1, public_buf_m); + dtostrf(planner.max_jerk.z, 1, 1, public_buf_m); #endif break; case EJerk: #if HAS_CLASSIC_JERK - dtostrf(planner.max_jerk[E_AXIS], 1, 1, public_buf_m); + dtostrf(planner.max_jerk.e, 1, 1, public_buf_m); #endif break; @@ -307,10 +307,10 @@ static void set_value_confirm() { case ZMaxFeedRate: planner.settings.max_feedrate_mm_s[Z_AXIS] = atof(key_value); break; case E0MaxFeedRate: planner.settings.max_feedrate_mm_s[E_AXIS] = atof(key_value); break; case E1MaxFeedRate: planner.settings.max_feedrate_mm_s[E_AXIS_N(1)] = atof(key_value); break; - case XJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk[X_AXIS] = atof(key_value)); break; - case YJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk[Y_AXIS] = atof(key_value)); break; - case ZJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk[Z_AXIS] = atof(key_value)); break; - case EJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk[E_AXIS] = atof(key_value)); break; + case XJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk.x = atof(key_value)); break; + case YJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk.y = atof(key_value)); break; + case ZJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk.z = atof(key_value)); break; + case EJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk.e = atof(key_value)); break; case Xstep: planner.settings.axis_steps_per_mm[X_AXIS] = atof(key_value); planner.refresh_positioning(); break; case Ystep: planner.settings.axis_steps_per_mm[Y_AXIS] = atof(key_value); planner.refresh_positioning(); break; case Zstep: planner.settings.axis_steps_per_mm[Z_AXIS] = atof(key_value); planner.refresh_positioning(); break; From e1423a874045f53ae9854f4b57a43696e99fee90 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 12 Nov 2022 00:40:15 +0000 Subject: [PATCH 056/109] [cron] Bump distribution date (2022-11-12) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index e9c5a460a5..24632292a9 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-11-10" +//#define STRING_DISTRIBUTION_DATE "2022-11-12" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 2e616e9c14..a9df01cc6e 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-11-10" + #define STRING_DISTRIBUTION_DATE "2022-11-12" #endif /** From 739556905575e967e10b1e164ae549be28772964 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 11 Nov 2022 20:35:07 -0600 Subject: [PATCH 057/109] =?UTF-8?q?=F0=9F=90=9B=20Fix=20Anycubic=20/=20Tri?= =?UTF-8?q?gorilla=20pins,=20etc.=20(#24971)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/powerloss.h | 3 + Marlin/src/gcode/config/M43.cpp | 11 +- Marlin/src/gcode/feature/advance/M900.cpp | 1 + Marlin/src/inc/Conditionals_post.h | 510 ++---------------- .../lcd/extui/anycubic_chiron/chiron_tft.cpp | 11 - Marlin/src/pins/pinsDebug_list.h | 3 + Marlin/src/pins/pins_postprocess.h | 491 +++++++++++++++++ Marlin/src/pins/ramps/pins_RAMPS.h | 12 +- Marlin/src/pins/ramps/pins_TRIGORILLA_14.h | 104 ++-- 9 files changed, 606 insertions(+), 540 deletions(-) diff --git a/Marlin/src/feature/powerloss.h b/Marlin/src/feature/powerloss.h index 33d9dc007c..4bf0c06e2d 100644 --- a/Marlin/src/feature/powerloss.h +++ b/Marlin/src/feature/powerloss.h @@ -153,6 +153,9 @@ class PrintJobRecovery { static void prepare(); static void setup() { + #if PIN_EXISTS(OUTAGECON) + OUT_WRITE(OUTAGECON_PIN, HIGH); + #endif #if PIN_EXISTS(POWER_LOSS) #if ENABLED(POWER_LOSS_PULLUP) SET_INPUT_PULLUP(POWER_LOSS_PIN); diff --git a/Marlin/src/gcode/config/M43.cpp b/Marlin/src/gcode/config/M43.cpp index cff143d571..5807844012 100644 --- a/Marlin/src/gcode/config/M43.cpp +++ b/Marlin/src/gcode/config/M43.cpp @@ -313,9 +313,16 @@ void GcodeSuite::M43() { // 'P' Get the range of pins to test or watch uint8_t first_pin = PARSED_PIN_INDEX('P', 0), - last_pin = parser.seenval('P') ? first_pin : (NUMBER_PINS_TOTAL) - 1; + last_pin = parser.seenval('L') ? PARSED_PIN_INDEX('L', 0) : parser.seenval('P') ? first_pin : (NUMBER_PINS_TOTAL) - 1; - if (first_pin > last_pin) return; + NOMORE(first_pin, (NUMBER_PINS_TOTAL) - 1); + NOMORE(last_pin, (NUMBER_PINS_TOTAL) - 1); + + if (first_pin > last_pin) { + const uint8_t f = first_pin; + first_pin = last_pin; + last_pin = f; + } // 'I' to ignore protected pins const bool ignore_protection = parser.boolval('I'); diff --git a/Marlin/src/gcode/feature/advance/M900.cpp b/Marlin/src/gcode/feature/advance/M900.cpp index 50d968627b..8c0da41801 100644 --- a/Marlin/src/gcode/feature/advance/M900.cpp +++ b/Marlin/src/gcode/feature/advance/M900.cpp @@ -50,6 +50,7 @@ void GcodeSuite::M900() { #if EXTRUDERS < 2 constexpr uint8_t tool_index = 0; + UNUSED(tool_index); #else const uint8_t tool_index = parser.intval('T', active_extruder); if (tool_index >= EXTRUDERS) { diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 9f41390db9..1e0daeb567 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -926,56 +926,8 @@ #define X2_MAX_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING #elif X2_USE_ENDSTOP == _ZMAX_ #define X2_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING - #else - #define X2_MAX_ENDSTOP_INVERTING false #endif #endif - #if !defined(X2_MAX_PIN) && !defined(X2_STOP_PIN) - #if X2_USE_ENDSTOP == _XMIN_ - #define X2_MAX_PIN X_MIN_PIN - #elif X2_USE_ENDSTOP == _XMAX_ - #define X2_MAX_PIN X_MAX_PIN - #elif X2_USE_ENDSTOP == _XSTOP_ - #define X2_MAX_PIN X_STOP_PIN - #elif X2_USE_ENDSTOP == _YMIN_ - #define X2_MAX_PIN Y_MIN_PIN - #elif X2_USE_ENDSTOP == _YMAX_ - #define X2_MAX_PIN Y_MAX_PIN - #elif X2_USE_ENDSTOP == _YSTOP_ - #define X2_MAX_PIN Y_STOP_PIN - #elif X2_USE_ENDSTOP == _ZMIN_ - #define X2_MAX_PIN Z_MIN_PIN - #elif X2_USE_ENDSTOP == _ZMAX_ - #define X2_MAX_PIN Z_MAX_PIN - #elif X2_USE_ENDSTOP == _ZSTOP_ - #define X2_MAX_PIN Z_STOP_PIN - #elif X2_USE_ENDSTOP == _XDIAG_ - #define X2_MAX_PIN X_DIAG_PIN - #elif X2_USE_ENDSTOP == _YDIAG_ - #define X2_MAX_PIN Y_DIAG_PIN - #elif X2_USE_ENDSTOP == _ZDIAG_ - #define X2_MAX_PIN Z_DIAG_PIN - #elif X2_USE_ENDSTOP == _E0DIAG_ - #define X2_MAX_PIN E0_DIAG_PIN - #elif X2_USE_ENDSTOP == _E1DIAG_ - #define X2_MAX_PIN E1_DIAG_PIN - #elif X2_USE_ENDSTOP == _E2DIAG_ - #define X2_MAX_PIN E2_DIAG_PIN - #elif X2_USE_ENDSTOP == _E3DIAG_ - #define X2_MAX_PIN E3_DIAG_PIN - #elif X2_USE_ENDSTOP == _E4DIAG_ - #define X2_MAX_PIN E4_DIAG_PIN - #elif X2_USE_ENDSTOP == _E5DIAG_ - #define X2_MAX_PIN E5_DIAG_PIN - #elif X2_USE_ENDSTOP == _E6DIAG_ - #define X2_MAX_PIN E6_DIAG_PIN - #elif X2_USE_ENDSTOP == _E7DIAG_ - #define X2_MAX_PIN E7_DIAG_PIN - #endif - #endif - #ifndef X2_MIN_ENDSTOP_INVERTING - #define X2_MIN_ENDSTOP_INVERTING false - #endif #else #ifndef X2_MIN_ENDSTOP_INVERTING #if X2_USE_ENDSTOP == _XMIN_ @@ -990,56 +942,14 @@ #define X2_MIN_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING #elif X2_USE_ENDSTOP == _ZMAX_ #define X2_MIN_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING - #else - #define X2_MIN_ENDSTOP_INVERTING false #endif #endif - #if !defined(X2_MIN_PIN) && !defined(X2_STOP_PIN) - #if X2_USE_ENDSTOP == _XMIN_ - #define X2_MIN_PIN X_MIN_PIN - #elif X2_USE_ENDSTOP == _XMAX_ - #define X2_MIN_PIN X_MAX_PIN - #elif X2_USE_ENDSTOP == _XSTOP_ - #define X2_MIN_PIN X_STOP_PIN - #elif X2_USE_ENDSTOP == _YMIN_ - #define X2_MIN_PIN Y_MIN_PIN - #elif X2_USE_ENDSTOP == _YMAX_ - #define X2_MIN_PIN Y_MAX_PIN - #elif X2_USE_ENDSTOP == _YSTOP_ - #define X2_MIN_PIN Y_STOP_PIN - #elif X2_USE_ENDSTOP == _ZMIN_ - #define X2_MIN_PIN Z_MIN_PIN - #elif X2_USE_ENDSTOP == _ZMAX_ - #define X2_MIN_PIN Z_MAX_PIN - #elif X2_USE_ENDSTOP == _ZSTOP_ - #define X2_MIN_PIN Z_STOP_PIN - #elif X2_USE_ENDSTOP == _XDIAG_ - #define X2_MIN_PIN X_DIAG_PIN - #elif X2_USE_ENDSTOP == _YDIAG_ - #define X2_MIN_PIN Y_DIAG_PIN - #elif X2_USE_ENDSTOP == _ZDIAG_ - #define X2_MIN_PIN Z_DIAG_PIN - #elif X2_USE_ENDSTOP == _E0DIAG_ - #define X2_MIN_PIN E0_DIAG_PIN - #elif X2_USE_ENDSTOP == _E1DIAG_ - #define X2_MIN_PIN E1_DIAG_PIN - #elif X2_USE_ENDSTOP == _E2DIAG_ - #define X2_MIN_PIN E2_DIAG_PIN - #elif X2_USE_ENDSTOP == _E3DIAG_ - #define X2_MIN_PIN E3_DIAG_PIN - #elif X2_USE_ENDSTOP == _E4DIAG_ - #define X2_MIN_PIN E4_DIAG_PIN - #elif X2_USE_ENDSTOP == _E5DIAG_ - #define X2_MIN_PIN E5_DIAG_PIN - #elif X2_USE_ENDSTOP == _E6DIAG_ - #define X2_MIN_PIN E6_DIAG_PIN - #elif X2_USE_ENDSTOP == _E7DIAG_ - #define X2_MIN_PIN E7_DIAG_PIN - #endif - #endif - #ifndef X2_MAX_ENDSTOP_INVERTING - #define X2_MAX_ENDSTOP_INVERTING false - #endif + #endif + #ifndef X2_MAX_ENDSTOP_INVERTING + #define X2_MAX_ENDSTOP_INVERTING false + #endif + #ifndef X2_MIN_ENDSTOP_INVERTING + #define X2_MIN_ENDSTOP_INVERTING false #endif #endif @@ -1061,56 +971,8 @@ #define Y2_MAX_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING #elif Y2_USE_ENDSTOP == _ZMAX_ #define Y2_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING - #else - #define Y2_MAX_ENDSTOP_INVERTING false #endif #endif - #if !defined(Y2_MAX_PIN) && !defined(Y2_STOP_PIN) - #if Y2_USE_ENDSTOP == _XMIN_ - #define Y2_MAX_PIN X_MIN_PIN - #elif Y2_USE_ENDSTOP == _XMAX_ - #define Y2_MAX_PIN X_MAX_PIN - #elif Y2_USE_ENDSTOP == _XSTOP_ - #define Y2_MAX_PIN X_STOP_PIN - #elif Y2_USE_ENDSTOP == _YMIN_ - #define Y2_MAX_PIN Y_MIN_PIN - #elif Y2_USE_ENDSTOP == _YMAX_ - #define Y2_MAX_PIN Y_MAX_PIN - #elif Y2_USE_ENDSTOP == _YSTOP_ - #define Y2_MAX_PIN Y_STOP_PIN - #elif Y2_USE_ENDSTOP == _ZMIN_ - #define Y2_MAX_PIN Z_MIN_PIN - #elif Y2_USE_ENDSTOP == _ZMAX_ - #define Y2_MAX_PIN Z_MAX_PIN - #elif Y2_USE_ENDSTOP == _ZSTOP_ - #define Y2_MAX_PIN Z_STOP_PIN - #elif Y2_USE_ENDSTOP == _XDIAG_ - #define Y2_MAX_PIN X_DIAG_PIN - #elif Y2_USE_ENDSTOP == _YDIAG_ - #define Y2_MAX_PIN Y_DIAG_PIN - #elif Y2_USE_ENDSTOP == _ZDIAG_ - #define Y2_MAX_PIN Z_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E0DIAG_ - #define Y2_MAX_PIN E0_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E1DIAG_ - #define Y2_MAX_PIN E1_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E2DIAG_ - #define Y2_MAX_PIN E2_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E3DIAG_ - #define Y2_MAX_PIN E3_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E4DIAG_ - #define Y2_MAX_PIN E4_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E5DIAG_ - #define Y2_MAX_PIN E5_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E6DIAG_ - #define Y2_MAX_PIN E6_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E7DIAG_ - #define Y2_MAX_PIN E7_DIAG_PIN - #endif - #endif - #ifndef Y2_MIN_ENDSTOP_INVERTING - #define Y2_MIN_ENDSTOP_INVERTING false - #endif #else #ifndef Y2_MIN_ENDSTOP_INVERTING #if Y2_USE_ENDSTOP == _XMIN_ @@ -1125,56 +987,14 @@ #define Y2_MIN_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING #elif Y2_USE_ENDSTOP == _ZMAX_ #define Y2_MIN_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING - #else - #define Y2_MIN_ENDSTOP_INVERTING false #endif #endif - #if !defined(Y2_MIN_PIN) && !defined(Y2_STOP_PIN) - #if Y2_USE_ENDSTOP == _XMIN_ - #define Y2_MIN_PIN X_MIN_PIN - #elif Y2_USE_ENDSTOP == _XMAX_ - #define Y2_MIN_PIN X_MAX_PIN - #elif Y2_USE_ENDSTOP == _XSTOP_ - #define Y2_MIN_PIN X_STOP_PIN - #elif Y2_USE_ENDSTOP == _YMIN_ - #define Y2_MIN_PIN Y_MIN_PIN - #elif Y2_USE_ENDSTOP == _YMAX_ - #define Y2_MIN_PIN Y_MAX_PIN - #elif Y2_USE_ENDSTOP == _YSTOP_ - #define Y2_MIN_PIN Y_STOP_PIN - #elif Y2_USE_ENDSTOP == _ZMIN_ - #define Y2_MIN_PIN Z_MIN_PIN - #elif Y2_USE_ENDSTOP == _ZMAX_ - #define Y2_MIN_PIN Z_MAX_PIN - #elif Y2_USE_ENDSTOP == _ZSTOP_ - #define Y2_MIN_PIN Z_STOP_PIN - #elif Y2_USE_ENDSTOP == _XDIAG_ - #define Y2_MIN_PIN X_DIAG_PIN - #elif Y2_USE_ENDSTOP == _YDIAG_ - #define Y2_MIN_PIN Y_DIAG_PIN - #elif Y2_USE_ENDSTOP == _ZDIAG_ - #define Y2_MIN_PIN Z_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E0DIAG_ - #define Y2_MIN_PIN E0_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E1DIAG_ - #define Y2_MIN_PIN E1_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E2DIAG_ - #define Y2_MIN_PIN E2_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E3DIAG_ - #define Y2_MIN_PIN E3_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E4DIAG_ - #define Y2_MIN_PIN E4_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E5DIAG_ - #define Y2_MIN_PIN E5_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E6DIAG_ - #define Y2_MIN_PIN E6_DIAG_PIN - #elif Y2_USE_ENDSTOP == _E7DIAG_ - #define Y2_MIN_PIN E7_DIAG_PIN - #endif - #endif - #ifndef Y2_MAX_ENDSTOP_INVERTING - #define Y2_MAX_ENDSTOP_INVERTING false - #endif + #endif + #ifndef Y2_MAX_ENDSTOP_INVERTING + #define Y2_MAX_ENDSTOP_INVERTING false + #endif + #ifndef Y2_MIN_ENDSTOP_INVERTING + #define Y2_MIN_ENDSTOP_INVERTING false #endif #endif @@ -1197,56 +1017,8 @@ #define Z2_MAX_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING #elif Z2_USE_ENDSTOP == _ZMAX_ #define Z2_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING - #else - #define Z2_MAX_ENDSTOP_INVERTING false #endif #endif - #if !defined(Z2_MAX_PIN) && !defined(Z2_STOP_PIN) - #if Z2_USE_ENDSTOP == _XMIN_ - #define Z2_MAX_PIN X_MIN_PIN - #elif Z2_USE_ENDSTOP == _XMAX_ - #define Z2_MAX_PIN X_MAX_PIN - #elif Z2_USE_ENDSTOP == _XSTOP_ - #define Z2_MAX_PIN X_STOP_PIN - #elif Z2_USE_ENDSTOP == _YMIN_ - #define Z2_MAX_PIN Y_MIN_PIN - #elif Z2_USE_ENDSTOP == _YMAX_ - #define Z2_MAX_PIN Y_MAX_PIN - #elif Z2_USE_ENDSTOP == _YSTOP_ - #define Z2_MAX_PIN Y_STOP_PIN - #elif Z2_USE_ENDSTOP == _ZMIN_ - #define Z2_MAX_PIN Z_MIN_PIN - #elif Z2_USE_ENDSTOP == _ZMAX_ - #define Z2_MAX_PIN Z_MAX_PIN - #elif Z2_USE_ENDSTOP == _ZSTOP_ - #define Z2_MAX_PIN Z_STOP_PIN - #elif Z2_USE_ENDSTOP == _XDIAG_ - #define Z2_MAX_PIN X_DIAG_PIN - #elif Z2_USE_ENDSTOP == _YDIAG_ - #define Z2_MAX_PIN Y_DIAG_PIN - #elif Z2_USE_ENDSTOP == _ZDIAG_ - #define Z2_MAX_PIN Z_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E0DIAG_ - #define Z2_MAX_PIN E0_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E1DIAG_ - #define Z2_MAX_PIN E1_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E2DIAG_ - #define Z2_MAX_PIN E2_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E3DIAG_ - #define Z2_MAX_PIN E3_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E4DIAG_ - #define Z2_MAX_PIN E4_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E5DIAG_ - #define Z2_MAX_PIN E5_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E6DIAG_ - #define Z2_MAX_PIN E6_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E7DIAG_ - #define Z2_MAX_PIN E7_DIAG_PIN - #endif - #endif - #ifndef Z2_MIN_ENDSTOP_INVERTING - #define Z2_MIN_ENDSTOP_INVERTING false - #endif #else #ifndef Z2_MIN_ENDSTOP_INVERTING #if Z2_USE_ENDSTOP == _XMIN_ @@ -1261,56 +1033,14 @@ #define Z2_MIN_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING #elif Z2_USE_ENDSTOP == _ZMAX_ #define Z2_MIN_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING - #else - #define Z2_MIN_ENDSTOP_INVERTING false #endif #endif - #ifndef Z2_MIN_PIN - #if Z2_USE_ENDSTOP == _XMIN_ - #define Z2_MIN_PIN X_MIN_PIN - #elif Z2_USE_ENDSTOP == _XMAX_ - #define Z2_MIN_PIN X_MAX_PIN - #elif Z2_USE_ENDSTOP == _XSTOP_ - #define Z2_MIN_PIN X_STOP_PIN - #elif Z2_USE_ENDSTOP == _YMIN_ - #define Z2_MIN_PIN Y_MIN_PIN - #elif Z2_USE_ENDSTOP == _YMAX_ - #define Z2_MIN_PIN Y_MAX_PIN - #elif Z2_USE_ENDSTOP == _YSTOP_ - #define Z2_MIN_PIN Y_STOP_PIN - #elif Z2_USE_ENDSTOP == _ZMIN_ - #define Z2_MIN_PIN Z_MIN_PIN - #elif Z2_USE_ENDSTOP == _ZMAX_ - #define Z2_MIN_PIN Z_MAX_PIN - #elif Z2_USE_ENDSTOP == _ZSTOP_ - #define Z2_MIN_PIN Z_STOP_PIN - #elif Z2_USE_ENDSTOP == _XDIAG_ - #define Z2_MIN_PIN X_DIAG_PIN - #elif Z2_USE_ENDSTOP == _YDIAG_ - #define Z2_MIN_PIN Y_DIAG_PIN - #elif Z2_USE_ENDSTOP == _ZDIAG_ - #define Z2_MIN_PIN Z_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E0DIAG_ - #define Z2_MIN_PIN E0_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E1DIAG_ - #define Z2_MIN_PIN E1_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E2DIAG_ - #define Z2_MIN_PIN E2_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E3DIAG_ - #define Z2_MIN_PIN E3_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E4DIAG_ - #define Z2_MIN_PIN E4_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E5DIAG_ - #define Z2_MIN_PIN E5_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E6DIAG_ - #define Z2_MIN_PIN E6_DIAG_PIN - #elif Z2_USE_ENDSTOP == _E7DIAG_ - #define Z2_MIN_PIN E7_DIAG_PIN - #endif - #endif - #ifndef Z2_MAX_ENDSTOP_INVERTING - #define Z2_MAX_ENDSTOP_INVERTING false - #endif + #endif + #ifndef Z2_MAX_ENDSTOP_INVERTING + #define Z2_MAX_ENDSTOP_INVERTING false + #endif + #ifndef Z2_MIN_ENDSTOP_INVERTING + #define Z2_MIN_ENDSTOP_INVERTING false #endif #if NUM_Z_STEPPERS >= 3 @@ -1328,56 +1058,8 @@ #define Z3_MAX_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING #elif Z3_USE_ENDSTOP == _ZMAX_ #define Z3_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING - #else - #define Z3_MAX_ENDSTOP_INVERTING false #endif #endif - #ifndef Z3_MAX_PIN - #if Z3_USE_ENDSTOP == _XMIN_ - #define Z3_MAX_PIN X_MIN_PIN - #elif Z3_USE_ENDSTOP == _XMAX_ - #define Z3_MAX_PIN X_MAX_PIN - #elif Z3_USE_ENDSTOP == _XSTOP_ - #define Z3_MAX_PIN X_STOP_PIN - #elif Z3_USE_ENDSTOP == _YMIN_ - #define Z3_MAX_PIN Y_MIN_PIN - #elif Z3_USE_ENDSTOP == _YMAX_ - #define Z3_MAX_PIN Y_MAX_PIN - #elif Z3_USE_ENDSTOP == _YSTOP_ - #define Z3_MAX_PIN Y_STOP_PIN - #elif Z3_USE_ENDSTOP == _ZMIN_ - #define Z3_MAX_PIN Z_MIN_PIN - #elif Z3_USE_ENDSTOP == _ZMAX_ - #define Z3_MAX_PIN Z_MAX_PIN - #elif Z3_USE_ENDSTOP == _ZSTOP_ - #define Z3_MAX_PIN Z_STOP_PIN - #elif Z3_USE_ENDSTOP == _XDIAG_ - #define Z3_MAX_PIN X_DIAG_PIN - #elif Z3_USE_ENDSTOP == _YDIAG_ - #define Z3_MAX_PIN Y_DIAG_PIN - #elif Z3_USE_ENDSTOP == _ZDIAG_ - #define Z3_MAX_PIN Z_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E0DIAG_ - #define Z3_MAX_PIN E0_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E1DIAG_ - #define Z3_MAX_PIN E1_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E2DIAG_ - #define Z3_MAX_PIN E2_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E3DIAG_ - #define Z3_MAX_PIN E3_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E4DIAG_ - #define Z3_MAX_PIN E4_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E5DIAG_ - #define Z3_MAX_PIN E5_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E6DIAG_ - #define Z3_MAX_PIN E6_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E7DIAG_ - #define Z3_MAX_PIN E7_DIAG_PIN - #endif - #endif - #ifndef Z3_MIN_ENDSTOP_INVERTING - #define Z3_MIN_ENDSTOP_INVERTING false - #endif #else #ifndef Z3_MIN_ENDSTOP_INVERTING #if Z3_USE_ENDSTOP == _XMIN_ @@ -1392,56 +1074,14 @@ #define Z3_MIN_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING #elif Z3_USE_ENDSTOP == _ZMAX_ #define Z3_MIN_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING - #else - #define Z3_MIN_ENDSTOP_INVERTING false #endif #endif - #ifndef Z3_MIN_PIN - #if Z3_USE_ENDSTOP == _XMIN_ - #define Z3_MIN_PIN X_MIN_PIN - #elif Z3_USE_ENDSTOP == _XMAX_ - #define Z3_MIN_PIN X_MAX_PIN - #elif Z3_USE_ENDSTOP == _XSTOP_ - #define Z3_MIN_PIN X_STOP_PIN - #elif Z3_USE_ENDSTOP == _YMIN_ - #define Z3_MIN_PIN Y_MIN_PIN - #elif Z3_USE_ENDSTOP == _YMAX_ - #define Z3_MIN_PIN Y_MAX_PIN - #elif Z3_USE_ENDSTOP == _YSTOP_ - #define Z3_MIN_PIN Y_STOP_PIN - #elif Z3_USE_ENDSTOP == _ZMIN_ - #define Z3_MIN_PIN Z_MIN_PIN - #elif Z3_USE_ENDSTOP == _ZMAX_ - #define Z3_MIN_PIN Z_MAX_PIN - #elif Z3_USE_ENDSTOP == _ZSTOP_ - #define Z3_MIN_PIN Z_STOP_PIN - #elif Z3_USE_ENDSTOP == _XDIAG_ - #define Z3_MIN_PIN X_DIAG_PIN - #elif Z3_USE_ENDSTOP == _YDIAG_ - #define Z3_MIN_PIN Y_DIAG_PIN - #elif Z3_USE_ENDSTOP == _ZDIAG_ - #define Z3_MIN_PIN Z_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E0DIAG_ - #define Z3_MIN_PIN E0_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E1DIAG_ - #define Z3_MIN_PIN E1_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E2DIAG_ - #define Z3_MIN_PIN E2_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E3DIAG_ - #define Z3_MIN_PIN E3_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E4DIAG_ - #define Z3_MIN_PIN E4_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E5DIAG_ - #define Z3_MIN_PIN E5_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E6DIAG_ - #define Z3_MIN_PIN E6_DIAG_PIN - #elif Z3_USE_ENDSTOP == _E7DIAG_ - #define Z3_MIN_PIN E7_DIAG_PIN - #endif - #endif - #ifndef Z3_MAX_ENDSTOP_INVERTING - #define Z3_MAX_ENDSTOP_INVERTING false - #endif + #endif + #ifndef Z3_MAX_ENDSTOP_INVERTING + #define Z3_MAX_ENDSTOP_INVERTING false + #endif + #ifndef Z3_MIN_ENDSTOP_INVERTING + #define Z3_MIN_ENDSTOP_INVERTING false #endif #endif @@ -1460,56 +1100,8 @@ #define Z4_MAX_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING #elif Z4_USE_ENDSTOP == _ZMAX_ #define Z4_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING - #else - #define Z4_MAX_ENDSTOP_INVERTING false #endif #endif - #ifndef Z4_MAX_PIN - #if Z4_USE_ENDSTOP == _XMIN_ - #define Z4_MAX_PIN X_MIN_PIN - #elif Z4_USE_ENDSTOP == _XMAX_ - #define Z4_MAX_PIN X_MAX_PIN - #elif Z4_USE_ENDSTOP == _XSTOP_ - #define Z4_MAX_PIN X_STOP_PIN - #elif Z4_USE_ENDSTOP == _YMIN_ - #define Z4_MAX_PIN Y_MIN_PIN - #elif Z4_USE_ENDSTOP == _YMAX_ - #define Z4_MAX_PIN Y_MAX_PIN - #elif Z4_USE_ENDSTOP == _YSTOP_ - #define Z4_MAX_PIN Y_STOP_PIN - #elif Z4_USE_ENDSTOP == _ZMIN_ - #define Z4_MAX_PIN Z_MIN_PIN - #elif Z4_USE_ENDSTOP == _ZMAX_ - #define Z4_MAX_PIN Z_MAX_PIN - #elif Z4_USE_ENDSTOP == _ZSTOP_ - #define Z4_MAX_PIN Z_STOP_PIN - #elif Z4_USE_ENDSTOP == _XDIAG_ - #define Z4_MAX_PIN X_DIAG_PIN - #elif Z4_USE_ENDSTOP == _YDIAG_ - #define Z4_MAX_PIN Y_DIAG_PIN - #elif Z4_USE_ENDSTOP == _ZDIAG_ - #define Z4_MAX_PIN Z_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E0DIAG_ - #define Z4_MAX_PIN E0_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E1DIAG_ - #define Z4_MAX_PIN E1_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E2DIAG_ - #define Z4_MAX_PIN E2_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E3DIAG_ - #define Z4_MAX_PIN E3_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E4DIAG_ - #define Z4_MAX_PIN E4_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E5DIAG_ - #define Z4_MAX_PIN E5_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E6DIAG_ - #define Z4_MAX_PIN E6_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E7DIAG_ - #define Z4_MAX_PIN E7_DIAG_PIN - #endif - #endif - #ifndef Z4_MIN_ENDSTOP_INVERTING - #define Z4_MIN_ENDSTOP_INVERTING false - #endif #else #ifndef Z4_MIN_ENDSTOP_INVERTING #if Z4_USE_ENDSTOP == _XMIN_ @@ -1524,56 +1116,14 @@ #define Z4_MIN_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING #elif Z4_USE_ENDSTOP == _ZMAX_ #define Z4_MIN_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING - #else - #define Z4_MIN_ENDSTOP_INVERTING false #endif #endif - #ifndef Z4_MIN_PIN - #if Z4_USE_ENDSTOP == _XMIN_ - #define Z4_MIN_PIN X_MIN_PIN - #elif Z4_USE_ENDSTOP == _XMAX_ - #define Z4_MIN_PIN X_MAX_PIN - #elif Z4_USE_ENDSTOP == _XSTOP_ - #define Z4_MIN_PIN X_STOP_PIN - #elif Z4_USE_ENDSTOP == _YMIN_ - #define Z4_MIN_PIN Y_MIN_PIN - #elif Z4_USE_ENDSTOP == _YMAX_ - #define Z4_MIN_PIN Y_MAX_PIN - #elif Z4_USE_ENDSTOP == _YSTOP_ - #define Z4_MIN_PIN Y_STOP_PIN - #elif Z4_USE_ENDSTOP == _ZMIN_ - #define Z4_MIN_PIN Z_MIN_PIN - #elif Z4_USE_ENDSTOP == _ZMAX_ - #define Z4_MIN_PIN Z_MAX_PIN - #elif Z4_USE_ENDSTOP == _ZSTOP_ - #define Z4_MIN_PIN Z_STOP_PIN - #elif Z4_USE_ENDSTOP == _XDIAG_ - #define Z4_MIN_PIN X_DIAG_PIN - #elif Z4_USE_ENDSTOP == _YDIAG_ - #define Z4_MIN_PIN Y_DIAG_PIN - #elif Z4_USE_ENDSTOP == _ZDIAG_ - #define Z4_MIN_PIN Z_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E0DIAG_ - #define Z4_MIN_PIN E0_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E1DIAG_ - #define Z4_MIN_PIN E1_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E2DIAG_ - #define Z4_MIN_PIN E2_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E3DIAG_ - #define Z4_MIN_PIN E3_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E4DIAG_ - #define Z4_MIN_PIN E4_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E5DIAG_ - #define Z4_MIN_PIN E5_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E6DIAG_ - #define Z4_MIN_PIN E6_DIAG_PIN - #elif Z4_USE_ENDSTOP == _E7DIAG_ - #define Z4_MIN_PIN E7_DIAG_PIN - #endif - #endif - #ifndef Z4_MAX_ENDSTOP_INVERTING - #define Z4_MAX_ENDSTOP_INVERTING false - #endif + #endif + #ifndef Z4_MAX_ENDSTOP_INVERTING + #define Z4_MAX_ENDSTOP_INVERTING false + #endif + #ifndef Z4_MIN_ENDSTOP_INVERTING + #define Z4_MIN_ENDSTOP_INVERTING false #endif #endif diff --git a/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp b/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp index 285729cc15..4be023df0a 100644 --- a/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp +++ b/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp @@ -72,17 +72,6 @@ void ChironTFT::Startup() { live_Zoffset = 0.0; file_menu = AC_menu_file; - // Setup pins for powerloss detection - // Two IO pins are connected on the Trigorilla Board - // On a power interruption the OUTAGECON_PIN goes low. - - #if ENABLED(POWER_LOSS_RECOVERY) - OUT_WRITE(OUTAGECON_PIN, HIGH); - #endif - - // Filament runout is handled by Marlin settings in Configuration.h - // opt_set FIL_RUNOUT_STATE HIGH // Pin state indicating that filament is NOT present. - // opt_enable FIL_RUNOUT_PULLUP TFTSer.begin(115200); // Wait for the TFT panel to initialize and finish the animation diff --git a/Marlin/src/pins/pinsDebug_list.h b/Marlin/src/pins/pinsDebug_list.h index 077c94a60f..39e07c739a 100644 --- a/Marlin/src/pins/pinsDebug_list.h +++ b/Marlin/src/pins/pinsDebug_list.h @@ -883,6 +883,9 @@ #if PIN_EXISTS(SAFE_POWER) REPORT_NAME_DIGITAL(__LINE__, SAFE_POWER_PIN) #endif +#if PIN_EXISTS(OUTAGECON) + REPORT_NAME_DIGITAL(__LINE__, OUTAGECON_PIN) +#endif #if PIN_EXISTS(POWER_LOSS) REPORT_NAME_DIGITAL(__LINE__, POWER_LOSS_PIN) #endif diff --git a/Marlin/src/pins/pins_postprocess.h b/Marlin/src/pins/pins_postprocess.h index 7656037f3d..1e5265b596 100644 --- a/Marlin/src/pins/pins_postprocess.h +++ b/Marlin/src/pins/pins_postprocess.h @@ -1857,6 +1857,497 @@ #undef Z4_MAX_PIN #endif +/** + * X_DUAL_ENDSTOPS endstop reassignment + */ +#if ENABLED(X_DUAL_ENDSTOPS) + #if X_HOME_TO_MAX + #ifndef X2_MAX_PIN + #if PIN_EXISTS(X2_STOP) + #define X2_MAX_PIN X2_STOP_PIN + #elif X2_USE_ENDSTOP == _XMIN_ + #define X2_MAX_PIN X_MIN_PIN + #elif X2_USE_ENDSTOP == _XMAX_ + #define X2_MAX_PIN X_MAX_PIN + #elif X2_USE_ENDSTOP == _XSTOP_ + #define X2_MAX_PIN X_STOP_PIN + #elif X2_USE_ENDSTOP == _YMIN_ + #define X2_MAX_PIN Y_MIN_PIN + #elif X2_USE_ENDSTOP == _YMAX_ + #define X2_MAX_PIN Y_MAX_PIN + #elif X2_USE_ENDSTOP == _YSTOP_ + #define X2_MAX_PIN Y_STOP_PIN + #elif X2_USE_ENDSTOP == _ZMIN_ + #define X2_MAX_PIN Z_MIN_PIN + #elif X2_USE_ENDSTOP == _ZMAX_ + #define X2_MAX_PIN Z_MAX_PIN + #elif X2_USE_ENDSTOP == _ZSTOP_ + #define X2_MAX_PIN Z_STOP_PIN + #elif X2_USE_ENDSTOP == _XDIAG_ + #define X2_MAX_PIN X_DIAG_PIN + #elif X2_USE_ENDSTOP == _YDIAG_ + #define X2_MAX_PIN Y_DIAG_PIN + #elif X2_USE_ENDSTOP == _ZDIAG_ + #define X2_MAX_PIN Z_DIAG_PIN + #elif X2_USE_ENDSTOP == _E0DIAG_ + #define X2_MAX_PIN E0_DIAG_PIN + #elif X2_USE_ENDSTOP == _E1DIAG_ + #define X2_MAX_PIN E1_DIAG_PIN + #elif X2_USE_ENDSTOP == _E2DIAG_ + #define X2_MAX_PIN E2_DIAG_PIN + #elif X2_USE_ENDSTOP == _E3DIAG_ + #define X2_MAX_PIN E3_DIAG_PIN + #elif X2_USE_ENDSTOP == _E4DIAG_ + #define X2_MAX_PIN E4_DIAG_PIN + #elif X2_USE_ENDSTOP == _E5DIAG_ + #define X2_MAX_PIN E5_DIAG_PIN + #elif X2_USE_ENDSTOP == _E6DIAG_ + #define X2_MAX_PIN E6_DIAG_PIN + #elif X2_USE_ENDSTOP == _E7DIAG_ + #define X2_MAX_PIN E7_DIAG_PIN + #endif + #endif + #else + #ifndef X2_MIN_PIN + #if PIN_EXISTS(X2_STOP) + #define X2_MIN_PIN X2_STOP_PIN + #elif X2_USE_ENDSTOP == _XMIN_ + #define X2_MIN_PIN X_MIN_PIN + #elif X2_USE_ENDSTOP == _XMAX_ + #define X2_MIN_PIN X_MAX_PIN + #elif X2_USE_ENDSTOP == _XSTOP_ + #define X2_MIN_PIN X_STOP_PIN + #elif X2_USE_ENDSTOP == _YMIN_ + #define X2_MIN_PIN Y_MIN_PIN + #elif X2_USE_ENDSTOP == _YMAX_ + #define X2_MIN_PIN Y_MAX_PIN + #elif X2_USE_ENDSTOP == _YSTOP_ + #define X2_MIN_PIN Y_STOP_PIN + #elif X2_USE_ENDSTOP == _ZMIN_ + #define X2_MIN_PIN Z_MIN_PIN + #elif X2_USE_ENDSTOP == _ZMAX_ + #define X2_MIN_PIN Z_MAX_PIN + #elif X2_USE_ENDSTOP == _ZSTOP_ + #define X2_MIN_PIN Z_STOP_PIN + #elif X2_USE_ENDSTOP == _XDIAG_ + #define X2_MIN_PIN X_DIAG_PIN + #elif X2_USE_ENDSTOP == _YDIAG_ + #define X2_MIN_PIN Y_DIAG_PIN + #elif X2_USE_ENDSTOP == _ZDIAG_ + #define X2_MIN_PIN Z_DIAG_PIN + #elif X2_USE_ENDSTOP == _E0DIAG_ + #define X2_MIN_PIN E0_DIAG_PIN + #elif X2_USE_ENDSTOP == _E1DIAG_ + #define X2_MIN_PIN E1_DIAG_PIN + #elif X2_USE_ENDSTOP == _E2DIAG_ + #define X2_MIN_PIN E2_DIAG_PIN + #elif X2_USE_ENDSTOP == _E3DIAG_ + #define X2_MIN_PIN E3_DIAG_PIN + #elif X2_USE_ENDSTOP == _E4DIAG_ + #define X2_MIN_PIN E4_DIAG_PIN + #elif X2_USE_ENDSTOP == _E5DIAG_ + #define X2_MIN_PIN E5_DIAG_PIN + #elif X2_USE_ENDSTOP == _E6DIAG_ + #define X2_MIN_PIN E6_DIAG_PIN + #elif X2_USE_ENDSTOP == _E7DIAG_ + #define X2_MIN_PIN E7_DIAG_PIN + #endif + #endif + #endif +#endif + +/** + * Y_DUAL_ENDSTOPS endstop reassignment + */ +#if ENABLED(Y_DUAL_ENDSTOPS) + #if Y_HOME_TO_MAX + #ifndef Y2_MAX_PIN + #if PIN_EXISTS(Y2_STOP) + #define Y2_MAX_PIN Y2_STOP_PIN + #elif Y2_USE_ENDSTOP == _XMIN_ + #define Y2_MAX_PIN X_MIN_PIN + #elif Y2_USE_ENDSTOP == _XMAX_ + #define Y2_MAX_PIN X_MAX_PIN + #elif Y2_USE_ENDSTOP == _XSTOP_ + #define Y2_MAX_PIN X_STOP_PIN + #elif Y2_USE_ENDSTOP == _YMIN_ + #define Y2_MAX_PIN Y_MIN_PIN + #elif Y2_USE_ENDSTOP == _YMAX_ + #define Y2_MAX_PIN Y_MAX_PIN + #elif Y2_USE_ENDSTOP == _YSTOP_ + #define Y2_MAX_PIN Y_STOP_PIN + #elif Y2_USE_ENDSTOP == _ZMIN_ + #define Y2_MAX_PIN Z_MIN_PIN + #elif Y2_USE_ENDSTOP == _ZMAX_ + #define Y2_MAX_PIN Z_MAX_PIN + #elif Y2_USE_ENDSTOP == _ZSTOP_ + #define Y2_MAX_PIN Z_STOP_PIN + #elif Y2_USE_ENDSTOP == _XDIAG_ + #define Y2_MAX_PIN X_DIAG_PIN + #elif Y2_USE_ENDSTOP == _YDIAG_ + #define Y2_MAX_PIN Y_DIAG_PIN + #elif Y2_USE_ENDSTOP == _ZDIAG_ + #define Y2_MAX_PIN Z_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E0DIAG_ + #define Y2_MAX_PIN E0_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E1DIAG_ + #define Y2_MAX_PIN E1_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E2DIAG_ + #define Y2_MAX_PIN E2_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E3DIAG_ + #define Y2_MAX_PIN E3_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E4DIAG_ + #define Y2_MAX_PIN E4_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E5DIAG_ + #define Y2_MAX_PIN E5_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E6DIAG_ + #define Y2_MAX_PIN E6_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E7DIAG_ + #define Y2_MAX_PIN E7_DIAG_PIN + #endif + #endif + #else + #ifndef Y2_MIN_PIN + #if PIN_EXISTS(Y2_STOP) + #define Y2_MIN_PIN Y2_STOP_PIN + #elif Y2_USE_ENDSTOP == _XMIN_ + #define Y2_MIN_PIN X_MIN_PIN + #elif Y2_USE_ENDSTOP == _XMAX_ + #define Y2_MIN_PIN X_MAX_PIN + #elif Y2_USE_ENDSTOP == _XSTOP_ + #define Y2_MIN_PIN X_STOP_PIN + #elif Y2_USE_ENDSTOP == _YMIN_ + #define Y2_MIN_PIN Y_MIN_PIN + #elif Y2_USE_ENDSTOP == _YMAX_ + #define Y2_MIN_PIN Y_MAX_PIN + #elif Y2_USE_ENDSTOP == _YSTOP_ + #define Y2_MIN_PIN Y_STOP_PIN + #elif Y2_USE_ENDSTOP == _ZMIN_ + #define Y2_MIN_PIN Z_MIN_PIN + #elif Y2_USE_ENDSTOP == _ZMAX_ + #define Y2_MIN_PIN Z_MAX_PIN + #elif Y2_USE_ENDSTOP == _ZSTOP_ + #define Y2_MIN_PIN Z_STOP_PIN + #elif Y2_USE_ENDSTOP == _XDIAG_ + #define Y2_MIN_PIN X_DIAG_PIN + #elif Y2_USE_ENDSTOP == _YDIAG_ + #define Y2_MIN_PIN Y_DIAG_PIN + #elif Y2_USE_ENDSTOP == _ZDIAG_ + #define Y2_MIN_PIN Z_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E0DIAG_ + #define Y2_MIN_PIN E0_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E1DIAG_ + #define Y2_MIN_PIN E1_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E2DIAG_ + #define Y2_MIN_PIN E2_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E3DIAG_ + #define Y2_MIN_PIN E3_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E4DIAG_ + #define Y2_MIN_PIN E4_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E5DIAG_ + #define Y2_MIN_PIN E5_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E6DIAG_ + #define Y2_MIN_PIN E6_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E7DIAG_ + #define Y2_MIN_PIN E7_DIAG_PIN + #endif + #endif + #endif +#endif + +/** + * Z_MULTI_ENDSTOPS endstop reassignment + */ +#if ENABLED(Z_MULTI_ENDSTOPS) + + #if Z_HOME_TO_MAX + #ifndef Z2_MAX_PIN + #if PIN_EXISTS(Z2_STOP) + #define Z2_MAX_PIN Z2_STOP_PIN + #elif Z2_USE_ENDSTOP == _XMIN_ + #define Z2_MAX_PIN X_MIN_PIN + #elif Z2_USE_ENDSTOP == _XMAX_ + #define Z2_MAX_PIN X_MAX_PIN + #elif Z2_USE_ENDSTOP == _XSTOP_ + #define Z2_MAX_PIN X_STOP_PIN + #elif Z2_USE_ENDSTOP == _YMIN_ + #define Z2_MAX_PIN Y_MIN_PIN + #elif Z2_USE_ENDSTOP == _YMAX_ + #define Z2_MAX_PIN Y_MAX_PIN + #elif Z2_USE_ENDSTOP == _YSTOP_ + #define Z2_MAX_PIN Y_STOP_PIN + #elif Z2_USE_ENDSTOP == _ZMIN_ + #define Z2_MAX_PIN Z_MIN_PIN + #elif Z2_USE_ENDSTOP == _ZMAX_ + #define Z2_MAX_PIN Z_MAX_PIN + #elif Z2_USE_ENDSTOP == _ZSTOP_ + #define Z2_MAX_PIN Z_STOP_PIN + #elif Z2_USE_ENDSTOP == _XDIAG_ + #define Z2_MAX_PIN X_DIAG_PIN + #elif Z2_USE_ENDSTOP == _YDIAG_ + #define Z2_MAX_PIN Y_DIAG_PIN + #elif Z2_USE_ENDSTOP == _ZDIAG_ + #define Z2_MAX_PIN Z_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E0DIAG_ + #define Z2_MAX_PIN E0_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E1DIAG_ + #define Z2_MAX_PIN E1_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E2DIAG_ + #define Z2_MAX_PIN E2_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E3DIAG_ + #define Z2_MAX_PIN E3_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E4DIAG_ + #define Z2_MAX_PIN E4_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E5DIAG_ + #define Z2_MAX_PIN E5_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E6DIAG_ + #define Z2_MAX_PIN E6_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E7DIAG_ + #define Z2_MAX_PIN E7_DIAG_PIN + #endif + #endif + #else + #ifndef Z2_MIN_PIN + #if PIN_EXISTS(Z2_STOP) + #define Z2_MIN_PIN Z2_STOP_PIN + #elif Z2_USE_ENDSTOP == _XMIN_ + #define Z2_MIN_PIN X_MIN_PIN + #elif Z2_USE_ENDSTOP == _XMAX_ + #define Z2_MIN_PIN X_MAX_PIN + #elif Z2_USE_ENDSTOP == _XSTOP_ + #define Z2_MIN_PIN X_STOP_PIN + #elif Z2_USE_ENDSTOP == _YMIN_ + #define Z2_MIN_PIN Y_MIN_PIN + #elif Z2_USE_ENDSTOP == _YMAX_ + #define Z2_MIN_PIN Y_MAX_PIN + #elif Z2_USE_ENDSTOP == _YSTOP_ + #define Z2_MIN_PIN Y_STOP_PIN + #elif Z2_USE_ENDSTOP == _ZMIN_ + #define Z2_MIN_PIN Z_MIN_PIN + #elif Z2_USE_ENDSTOP == _ZMAX_ + #define Z2_MIN_PIN Z_MAX_PIN + #elif Z2_USE_ENDSTOP == _ZSTOP_ + #define Z2_MIN_PIN Z_STOP_PIN + #elif Z2_USE_ENDSTOP == _XDIAG_ + #define Z2_MIN_PIN X_DIAG_PIN + #elif Z2_USE_ENDSTOP == _YDIAG_ + #define Z2_MIN_PIN Y_DIAG_PIN + #elif Z2_USE_ENDSTOP == _ZDIAG_ + #define Z2_MIN_PIN Z_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E0DIAG_ + #define Z2_MIN_PIN E0_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E1DIAG_ + #define Z2_MIN_PIN E1_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E2DIAG_ + #define Z2_MIN_PIN E2_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E3DIAG_ + #define Z2_MIN_PIN E3_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E4DIAG_ + #define Z2_MIN_PIN E4_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E5DIAG_ + #define Z2_MIN_PIN E5_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E6DIAG_ + #define Z2_MIN_PIN E6_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E7DIAG_ + #define Z2_MIN_PIN E7_DIAG_PIN + #endif + #endif + #endif + + #if NUM_Z_STEPPERS >= 3 + #if Z_HOME_TO_MAX + #ifndef Z3_MAX_PIN + #if PIN_EXISTS(Z3_STOP) + #define Z3_MAX_PIN Z3_STOP_PIN + #elif Z3_USE_ENDSTOP == _XMIN_ + #define Z3_MAX_PIN X_MIN_PIN + #elif Z3_USE_ENDSTOP == _XMAX_ + #define Z3_MAX_PIN X_MAX_PIN + #elif Z3_USE_ENDSTOP == _XSTOP_ + #define Z3_MAX_PIN X_STOP_PIN + #elif Z3_USE_ENDSTOP == _YMIN_ + #define Z3_MAX_PIN Y_MIN_PIN + #elif Z3_USE_ENDSTOP == _YMAX_ + #define Z3_MAX_PIN Y_MAX_PIN + #elif Z3_USE_ENDSTOP == _YSTOP_ + #define Z3_MAX_PIN Y_STOP_PIN + #elif Z3_USE_ENDSTOP == _ZMIN_ + #define Z3_MAX_PIN Z_MIN_PIN + #elif Z3_USE_ENDSTOP == _ZMAX_ + #define Z3_MAX_PIN Z_MAX_PIN + #elif Z3_USE_ENDSTOP == _ZSTOP_ + #define Z3_MAX_PIN Z_STOP_PIN + #elif Z3_USE_ENDSTOP == _XDIAG_ + #define Z3_MAX_PIN X_DIAG_PIN + #elif Z3_USE_ENDSTOP == _YDIAG_ + #define Z3_MAX_PIN Y_DIAG_PIN + #elif Z3_USE_ENDSTOP == _ZDIAG_ + #define Z3_MAX_PIN Z_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E0DIAG_ + #define Z3_MAX_PIN E0_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E1DIAG_ + #define Z3_MAX_PIN E1_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E2DIAG_ + #define Z3_MAX_PIN E2_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E3DIAG_ + #define Z3_MAX_PIN E3_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E4DIAG_ + #define Z3_MAX_PIN E4_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E5DIAG_ + #define Z3_MAX_PIN E5_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E6DIAG_ + #define Z3_MAX_PIN E6_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E7DIAG_ + #define Z3_MAX_PIN E7_DIAG_PIN + #endif + #endif + #else + #ifndef Z3_MIN_PIN + #if PIN_EXISTS(Z3_STOP) + #define Z3_MIN_PIN Z3_STOP_PIN + #elif Z3_USE_ENDSTOP == _XMIN_ + #define Z3_MIN_PIN X_MIN_PIN + #elif Z3_USE_ENDSTOP == _XMAX_ + #define Z3_MIN_PIN X_MAX_PIN + #elif Z3_USE_ENDSTOP == _XSTOP_ + #define Z3_MIN_PIN X_STOP_PIN + #elif Z3_USE_ENDSTOP == _YMIN_ + #define Z3_MIN_PIN Y_MIN_PIN + #elif Z3_USE_ENDSTOP == _YMAX_ + #define Z3_MIN_PIN Y_MAX_PIN + #elif Z3_USE_ENDSTOP == _YSTOP_ + #define Z3_MIN_PIN Y_STOP_PIN + #elif Z3_USE_ENDSTOP == _ZMIN_ + #define Z3_MIN_PIN Z_MIN_PIN + #elif Z3_USE_ENDSTOP == _ZMAX_ + #define Z3_MIN_PIN Z_MAX_PIN + #elif Z3_USE_ENDSTOP == _ZSTOP_ + #define Z3_MIN_PIN Z_STOP_PIN + #elif Z3_USE_ENDSTOP == _XDIAG_ + #define Z3_MIN_PIN X_DIAG_PIN + #elif Z3_USE_ENDSTOP == _YDIAG_ + #define Z3_MIN_PIN Y_DIAG_PIN + #elif Z3_USE_ENDSTOP == _ZDIAG_ + #define Z3_MIN_PIN Z_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E0DIAG_ + #define Z3_MIN_PIN E0_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E1DIAG_ + #define Z3_MIN_PIN E1_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E2DIAG_ + #define Z3_MIN_PIN E2_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E3DIAG_ + #define Z3_MIN_PIN E3_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E4DIAG_ + #define Z3_MIN_PIN E4_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E5DIAG_ + #define Z3_MIN_PIN E5_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E6DIAG_ + #define Z3_MIN_PIN E6_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E7DIAG_ + #define Z3_MIN_PIN E7_DIAG_PIN + #endif + #endif + #endif + #endif + + #if NUM_Z_STEPPERS >= 4 + #if Z_HOME_TO_MAX + #ifndef Z4_MAX_PIN + #if PIN_EXISTS(Z4_STOP) + #define Z4_MAX_PIN Z4_STOP_PIN + #elif Z4_USE_ENDSTOP == _XMIN_ + #define Z4_MAX_PIN X_MIN_PIN + #elif Z4_USE_ENDSTOP == _XMAX_ + #define Z4_MAX_PIN X_MAX_PIN + #elif Z4_USE_ENDSTOP == _XSTOP_ + #define Z4_MAX_PIN X_STOP_PIN + #elif Z4_USE_ENDSTOP == _YMIN_ + #define Z4_MAX_PIN Y_MIN_PIN + #elif Z4_USE_ENDSTOP == _YMAX_ + #define Z4_MAX_PIN Y_MAX_PIN + #elif Z4_USE_ENDSTOP == _YSTOP_ + #define Z4_MAX_PIN Y_STOP_PIN + #elif Z4_USE_ENDSTOP == _ZMIN_ + #define Z4_MAX_PIN Z_MIN_PIN + #elif Z4_USE_ENDSTOP == _ZMAX_ + #define Z4_MAX_PIN Z_MAX_PIN + #elif Z4_USE_ENDSTOP == _ZSTOP_ + #define Z4_MAX_PIN Z_STOP_PIN + #elif Z4_USE_ENDSTOP == _XDIAG_ + #define Z4_MAX_PIN X_DIAG_PIN + #elif Z4_USE_ENDSTOP == _YDIAG_ + #define Z4_MAX_PIN Y_DIAG_PIN + #elif Z4_USE_ENDSTOP == _ZDIAG_ + #define Z4_MAX_PIN Z_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E0DIAG_ + #define Z4_MAX_PIN E0_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E1DIAG_ + #define Z4_MAX_PIN E1_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E2DIAG_ + #define Z4_MAX_PIN E2_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E3DIAG_ + #define Z4_MAX_PIN E3_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E4DIAG_ + #define Z4_MAX_PIN E4_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E5DIAG_ + #define Z4_MAX_PIN E5_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E6DIAG_ + #define Z4_MAX_PIN E6_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E7DIAG_ + #define Z4_MAX_PIN E7_DIAG_PIN + #endif + #endif + #else + #ifndef Z4_MIN_PIN + #if PIN_EXISTS(Z4_STOP) + #define Z4_MIN_PIN Z4_STOP_PIN + #elif Z4_USE_ENDSTOP == _XMIN_ + #define Z4_MIN_PIN X_MIN_PIN + #elif Z4_USE_ENDSTOP == _XMAX_ + #define Z4_MIN_PIN X_MAX_PIN + #elif Z4_USE_ENDSTOP == _XSTOP_ + #define Z4_MIN_PIN X_STOP_PIN + #elif Z4_USE_ENDSTOP == _YMIN_ + #define Z4_MIN_PIN Y_MIN_PIN + #elif Z4_USE_ENDSTOP == _YMAX_ + #define Z4_MIN_PIN Y_MAX_PIN + #elif Z4_USE_ENDSTOP == _YSTOP_ + #define Z4_MIN_PIN Y_STOP_PIN + #elif Z4_USE_ENDSTOP == _ZMIN_ + #define Z4_MIN_PIN Z_MIN_PIN + #elif Z4_USE_ENDSTOP == _ZMAX_ + #define Z4_MIN_PIN Z_MAX_PIN + #elif Z4_USE_ENDSTOP == _ZSTOP_ + #define Z4_MIN_PIN Z_STOP_PIN + #elif Z4_USE_ENDSTOP == _XDIAG_ + #define Z4_MIN_PIN X_DIAG_PIN + #elif Z4_USE_ENDSTOP == _YDIAG_ + #define Z4_MIN_PIN Y_DIAG_PIN + #elif Z4_USE_ENDSTOP == _ZDIAG_ + #define Z4_MIN_PIN Z_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E0DIAG_ + #define Z4_MIN_PIN E0_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E1DIAG_ + #define Z4_MIN_PIN E1_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E2DIAG_ + #define Z4_MIN_PIN E2_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E3DIAG_ + #define Z4_MIN_PIN E3_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E4DIAG_ + #define Z4_MIN_PIN E4_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E5DIAG_ + #define Z4_MIN_PIN E5_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E6DIAG_ + #define Z4_MIN_PIN E6_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E7DIAG_ + #define Z4_MIN_PIN E7_DIAG_PIN + #endif + #endif + #endif + #endif + +#endif // Z_MULTI_ENDSTOPS + // // Default DOGLCD SPI delays // diff --git a/Marlin/src/pins/ramps/pins_RAMPS.h b/Marlin/src/pins/ramps/pins_RAMPS.h index a0edb01a2a..7b0ae64cfc 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS.h +++ b/Marlin/src/pins/ramps/pins_RAMPS.h @@ -233,16 +233,22 @@ #define HEATER_0_PIN MOSFET_A_PIN #if FET_ORDER_EFB // Hotend, Fan, Bed - #define HEATER_BED_PIN MOSFET_C_PIN + #ifndef HEATER_BED_PIN + #define HEATER_BED_PIN MOSFET_C_PIN + #endif #elif FET_ORDER_EEF // Hotend, Hotend, Fan #define HEATER_1_PIN MOSFET_B_PIN #elif FET_ORDER_EEB // Hotend, Hotend, Bed #define HEATER_1_PIN MOSFET_B_PIN - #define HEATER_BED_PIN MOSFET_C_PIN + #ifndef HEATER_BED_PIN + #define HEATER_BED_PIN MOSFET_C_PIN + #endif #elif FET_ORDER_EFF // Hotend, Fan, Fan #define FAN1_PIN MOSFET_C_PIN #elif DISABLED(FET_ORDER_SF) // Not Spindle, Fan (i.e., "EFBF" or "EFBE") - #define HEATER_BED_PIN MOSFET_C_PIN + #ifndef HEATER_BED_PIN + #define HEATER_BED_PIN MOSFET_C_PIN + #endif #if EITHER(HAS_MULTI_HOTEND, HEATERS_PARALLEL) #define HEATER_1_PIN MOSFET_D_PIN #else diff --git a/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h b/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h index b685ff0094..1156804b7c 100644 --- a/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h +++ b/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h @@ -40,78 +40,94 @@ // // PWM FETS // -#if EITHER(FET_ORDER_EEF, FET_ORDER_EEB) - #define MOSFET_B_PIN 45 // HEATER1 -#elif FET_ORDER_EFB - #define MOSFET_B_PIN 9 // FAN0 -#else - #define MOSFET_B_PIN 7 // FAN1 -#endif - -#if FET_ORDER_EEB - #define MOSFET_C_PIN 8 // BED -#elif FET_ORDER_EFB - #if DISABLED(ANYCUBIC_LCD_CHIRON) - #define MOSFET_C_PIN 8 - #else - #define MOSFET_C_PIN 45 - #endif -#else // EEF, EFF - #define MOSFET_C_PIN 9 -#endif - -#if FET_ORDER_EEB - #define FAN_PIN 9 // Override pin 4 in pins_RAMPS.h -#endif +#define MOSFET_B_PIN 45 // HEATER1 // // Heaters / Fans // -#if ANY(FET_ORDER_EEF, FET_ORDER_EEB, FET_ORDER_EFB) - #define FAN1_PIN 7 -#endif -#define FAN2_PIN 44 +#define FAN_PIN 9 // FAN0 +#define FAN1_PIN 7 // FAN1 +#define FAN2_PIN 44 // FAN2 #ifndef E0_AUTO_FAN_PIN - #define E0_AUTO_FAN_PIN 44 // Used in Anycubic Kossel example config -#endif -#if ENABLED(ANYCUBIC_LCD_I3MEGA) - #define CONTROLLER_FAN_PIN 7 + #define E0_AUTO_FAN_PIN FAN2_PIN #endif // -// AnyCubic standard pin mappings +// AnyCubic pin mappings +// +// Define the appropriate mapping option in Configuration.h: +// - TRIGORILLA_MAPPING_CHIRON +// - TRIGORILLA_MAPPING_I3MEGA // -// On most printers, endstops are NOT all wired to the appropriate pins on the Trigorilla board. -// For instance, on a Chiron, Y axis goes to an aux connector. -// There are also other things that have been wired in creative ways. -// To enable PIN definitions for a specific printer model, #define the appropriate symbol after -// MOTHERBOARD in Configuration.h // // Limit Switches // //#define ANYCUBIC_4_MAX_PRO_ENDSTOPS - #if ENABLED(ANYCUBIC_4_MAX_PRO_ENDSTOPS) #define X_MAX_PIN 43 #define Y_STOP_PIN 19 -#elif EITHER(ANYCUBIC_LCD_CHIRON, ANYCUBIC_LCD_I3MEGA) - #define Y_STOP_PIN 42 - #define Z2_MIN_PIN 43 +#elif EITHER(TRIGORILLA_MAPPING_CHIRON, TRIGORILLA_MAPPING_I3MEGA) + // Chiron uses AUX header for Y and Z endstops + #define Y_STOP_PIN 42 // AUX + #define Z_STOP_PIN 43 // AUX + #define Z2_MIN_PIN 18 // Z- + #ifndef Z_MIN_PROBE_PIN #define Z_MIN_PROBE_PIN 2 #endif - #ifndef FIL_RUNOUT_PIN - #if ENABLED(ANYCUBIC_LCD_CHIRON) + + #define CONTROLLER_FAN_PIN FAN1_PIN + + #if ENABLED(POWER_LOSS_RECOVERY) + #define OUTAGETEST_PIN 79 + #define OUTAGECON_PIN 58 + #endif + + #if ENABLED(TRIGORILLA_MAPPING_CHIRON) + #ifndef FIL_RUNOUT_PIN #define FIL_RUNOUT_PIN 33 - #else + #endif + + // Chiron swaps the Z stepper connections + #define Z_STEP_PIN 36 + #define Z_DIR_PIN 34 + #define Z_ENABLE_PIN 30 + #define Z_CS_PIN 44 + + #define Z2_STEP_PIN 46 + #define Z2_DIR_PIN 48 + #define Z2_ENABLE_PIN 62 + #define Z2_CS_PIN 40 + + #define HEATER_BED_PIN MOSFET_B_PIN // HEATER1 + #else + #ifndef FIL_RUNOUT_PIN #define FIL_RUNOUT_PIN 19 #endif #endif +#endif + +#if EITHER(ANYCUBIC_LCD_CHIRON, ANYCUBIC_LCD_I3MEGA) #define BEEPER_PIN 31 #define SD_DETECT_PIN 49 #endif +#if HAS_TMC_UART + #ifndef X_SERIAL_TX_PIN + #define X_SERIAL_TX_PIN SERVO1_PIN + #endif + #ifndef Y_SERIAL_TX_PIN + #define Y_SERIAL_TX_PIN SERVO0_PIN + #endif + #ifndef Z_SERIAL_TX_PIN + #define Z_SERIAL_TX_PIN SERVO3_PIN + #endif + #ifndef E0_SERIAL_TX_PIN + #define E0_SERIAL_TX_PIN SERVO2_PIN + #endif +#endif + #include "pins_RAMPS.h" // From dbd5dc4eb7a828d20fe902e9768c8710caf16754 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sun, 13 Nov 2022 00:23:31 +0000 Subject: [PATCH 058/109] [cron] Bump distribution date (2022-11-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 24632292a9..eeba47a9f6 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-11-12" +//#define STRING_DISTRIBUTION_DATE "2022-11-13" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index a9df01cc6e..7b61aeee4e 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-11-12" + #define STRING_DISTRIBUTION_DATE "2022-11-13" #endif /** From abc931629fa58e0b5aecfbaa9d7fa0c36adb65b6 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Mon, 14 Nov 2022 17:45:28 +1300 Subject: [PATCH 059/109] =?UTF-8?q?=F0=9F=A9=B9=20Allow=20max=20endstops?= =?UTF-8?q?=20MKS=20Monster=208=20V2=20(#24944)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V1.h | 2 ++ Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V2.h | 8 +++++++- Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_common.h | 2 -- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V1.h b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V1.h index 7163625e40..50fe790dc3 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V1.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V1.h @@ -26,7 +26,9 @@ // // Limit Switches // +#define X_MIN_PIN PA14 #define X_MAX_PIN PA13 +#define Y_MIN_PIN PA15 #define Y_MAX_PIN PC5 // diff --git a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V2.h b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V2.h index 9c012999b3..b3d6d48d9f 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V2.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V2.h @@ -23,6 +23,12 @@ #define BOARD_INFO_NAME "MKS Monster8 V2" +// +// Limit Switches +// +#define X_STOP_PIN PA14 +#define Y_STOP_PIN PA15 + // // Steppers // @@ -52,6 +58,6 @@ #define WIFI_RESET_PIN PD14 // MKS ESP WIFI RESET PIN #endif -#define NEOPIXEL_PIN PC5 +#define NEOPIXEL_PIN PC5 #include "pins_MKS_MONSTER8_common.h" diff --git a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_common.h b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_common.h index 8a9b72225d..b1031de8d5 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_common.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_common.h @@ -64,8 +64,6 @@ #define E4_DIAG_PIN -1 // Driver7 diag signal is not connected // Limit Switches for endstops -#define X_MIN_PIN PA14 -#define Y_MIN_PIN PA15 #define Z_MIN_PIN PB13 #define Z_MAX_PIN PB12 From 16faa2950a19396325f35c447bfa2b6231fc6d12 Mon Sep 17 00:00:00 2001 From: Pascal de Bruijn Date: Mon, 14 Nov 2022 05:59:25 +0100 Subject: [PATCH 060/109] =?UTF-8?q?=F0=9F=9A=B8=20M306:=20Indicate=20MPC?= =?UTF-8?q?=20Autotune=20(#24949)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/temp/M306.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Marlin/src/gcode/temp/M306.cpp b/Marlin/src/gcode/temp/M306.cpp index 7978922ff4..c6b700eac3 100644 --- a/Marlin/src/gcode/temp/M306.cpp +++ b/Marlin/src/gcode/temp/M306.cpp @@ -25,6 +25,7 @@ #if ENABLED(MPCTEMP) #include "../gcode.h" +#include "../../lcd/marlinui.h" #include "../../module/temperature.h" /** @@ -42,7 +43,12 @@ */ void GcodeSuite::M306() { - if (parser.seen_test('T')) { thermalManager.MPC_autotune(); return; } + if (parser.seen_test('T')) { + LCD_MESSAGE(MSG_MPC_AUTOTUNE); + thermalManager.MPC_autotune(); + ui.reset_status(); + return; + } if (parser.seen("ACFPRH")) { const heater_id_t hid = (heater_id_t)parser.intval('E', 0); From e283f15720bcdfca56a989beffc8328fda42c018 Mon Sep 17 00:00:00 2001 From: Justin Hartmann Date: Mon, 14 Nov 2022 00:50:02 -0500 Subject: [PATCH 061/109] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20Overlord=20compile?= =?UTF-8?q?=20(#24947)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/leds/leds.cpp | 12 ------------ Marlin/src/feature/leds/leds.h | 12 ++++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Marlin/src/feature/leds/leds.cpp b/Marlin/src/feature/leds/leds.cpp index 1c6d9ab090..3753235ab5 100644 --- a/Marlin/src/feature/leds/leds.cpp +++ b/Marlin/src/feature/leds/leds.cpp @@ -30,18 +30,6 @@ #include "leds.h" -#if ENABLED(BLINKM) - #include "blinkm.h" -#endif - -#if ENABLED(PCA9632) - #include "pca9632.h" -#endif - -#if ENABLED(PCA9533) - #include "pca9533.h" -#endif - #if EITHER(CASE_LIGHT_USE_RGB_LED, CASE_LIGHT_USE_NEOPIXEL) #include "../../feature/caselight.h" #endif diff --git a/Marlin/src/feature/leds/leds.h b/Marlin/src/feature/leds/leds.h index 572fd0dfac..c6137b45c3 100644 --- a/Marlin/src/feature/leds/leds.h +++ b/Marlin/src/feature/leds/leds.h @@ -40,6 +40,18 @@ #undef _NEOPIXEL_INCLUDE_ #endif +#if ENABLED(BLINKM) + #include "blinkm.h" +#endif + +#if ENABLED(PCA9533) + #include "pca9533.h" +#endif + +#if ENABLED(PCA9632) + #include "pca9632.h" +#endif + /** * LEDcolor type for use with leds.set_color */ From 14966c0ba29f356c267348a045690359a9750da6 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Mon, 14 Nov 2022 06:23:44 +0000 Subject: [PATCH 062/109] [cron] Bump distribution date (2022-11-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 eeba47a9f6..e71389b9e3 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-11-13" +//#define STRING_DISTRIBUTION_DATE "2022-11-14" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 7b61aeee4e..0961fe4e13 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-11-13" + #define STRING_DISTRIBUTION_DATE "2022-11-14" #endif /** From d62fbfbce63d9762162307417fc22c5258331c13 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 14 Nov 2022 02:26:31 -0600 Subject: [PATCH 063/109] =?UTF-8?q?=F0=9F=90=9B=20Fix=20M808=20starting=20?= =?UTF-8?q?count?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reported by adcurtin on Discord --- Marlin/src/feature/repeat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/feature/repeat.cpp b/Marlin/src/feature/repeat.cpp index 165f71fd0f..fed7ac0908 100644 --- a/Marlin/src/feature/repeat.cpp +++ b/Marlin/src/feature/repeat.cpp @@ -42,7 +42,7 @@ void Repeat::add_marker(const uint32_t sdpos, const uint16_t count) { SERIAL_ECHO_MSG("!Too many markers."); else { marker[index].sdpos = sdpos; - marker[index].counter = count ?: -1; + marker[index].counter = count ? count - 1 : -1; index++; DEBUG_ECHOLNPGM("Add Marker ", index, " at ", sdpos, " (", count, ")"); } From 00156a3e3139179d505b685809736481d65fa5d4 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Mon, 14 Nov 2022 21:35:24 +1300 Subject: [PATCH 064/109] =?UTF-8?q?=F0=9F=A9=B9=20Fix=202=20thermocouples?= =?UTF-8?q?=20(#24982)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #24898 --- Marlin/src/module/temperature.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 37996a80ea..8742cf36df 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -3076,8 +3076,13 @@ void Temperature::disable_all_heaters() { // Needed to return the correct temp when this is called between readings static raw_adc_t max_tc_temp_previous[MAX_TC_COUNT] = { 0 }; #define THERMO_TEMP(I) max_tc_temp_previous[I] - #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) + #if MAX_TC_COUNT > 2 + #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 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 // When we have only 1 max tc, THERMO_SEL will pick the appropriate sensor // variable, and MAXTC_*() macros will be hardcoded to the correct CS pin. From 8298a477e1f1fa6188788448eec3f349c1ba93de Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 15 Nov 2022 00:24:38 +0000 Subject: [PATCH 065/109] [cron] Bump distribution date (2022-11-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 e71389b9e3..5618d2bd26 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-11-14" +//#define STRING_DISTRIBUTION_DATE "2022-11-15" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 0961fe4e13..1589937808 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-11-14" + #define STRING_DISTRIBUTION_DATE "2022-11-15" #endif /** From e3e07354d5ff98293f87d532fdd1c384d8e0b2e2 Mon Sep 17 00:00:00 2001 From: Marcio T Date: Mon, 21 Nov 2022 16:25:56 -0700 Subject: [PATCH 066/109] Fix FAST_PWM_FAN / TouchUI with NO_MOTION_BEFORE_HOMING (#25005) Fix regressions from #20323, #23463 --- Marlin/src/HAL/AVR/fast_pwm.cpp | 10 +++++----- Marlin/src/lcd/extui/ui_api.cpp | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Marlin/src/HAL/AVR/fast_pwm.cpp b/Marlin/src/HAL/AVR/fast_pwm.cpp index 0a384172c3..e440315e00 100644 --- a/Marlin/src/HAL/AVR/fast_pwm.cpp +++ b/Marlin/src/HAL/AVR/fast_pwm.cpp @@ -146,11 +146,11 @@ void MarlinHAL::set_pwm_frequency(const pin_t pin, const uint16_t f_desired) { LIMIT(res_pc_temp, 1U, maxtop); // Calculate frequencies of test prescaler and resolution values - const uint32_t f_diff = _MAX(f, f_desired) - _MIN(f, f_desired), - f_fast_temp = (F_CPU) / (p * (1 + res_fast_temp)), - f_fast_diff = _MAX(f_fast_temp, f_desired) - _MIN(f_fast_temp, f_desired), - f_pc_temp = (F_CPU) / (2 * p * res_pc_temp), - f_pc_diff = _MAX(f_pc_temp, f_desired) - _MIN(f_pc_temp, f_desired); + const int f_diff = ABS(f - int(f_desired)), + f_fast_temp = (F_CPU) / (p * (1 + res_fast_temp)), + f_fast_diff = ABS(f_fast_temp - int(f_desired)), + f_pc_temp = (F_CPU) / (2 * p * res_pc_temp), + f_pc_diff = ABS(f_pc_temp - int(f_desired)); if (f_fast_diff < f_diff && f_fast_diff <= f_pc_diff) { // FAST values are closest to desired f // Set the Wave Generation Mode to FAST PWM diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index 967fb1021d..4422e8115d 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -375,9 +375,9 @@ namespace ExtUI { bool canMove(const axis_t axis) { switch (axis) { #if IS_KINEMATIC || ENABLED(NO_MOTION_BEFORE_HOMING) - case X: return axis_should_home(X_AXIS); - OPTCODE(HAS_Y_AXIS, case Y: return axis_should_home(Y_AXIS)) - OPTCODE(HAS_Z_AXIS, case Z: return axis_should_home(Z_AXIS)) + case X: return !axis_should_home(X_AXIS); + OPTCODE(HAS_Y_AXIS, case Y: return !axis_should_home(Y_AXIS)) + OPTCODE(HAS_Z_AXIS, case Z: return !axis_should_home(Z_AXIS)) #else case X: case Y: case Z: return true; #endif From f49731251cec502c4e37a7398d784aba485a16d9 Mon Sep 17 00:00:00 2001 From: phigjm <39876427+phigjm@users.noreply.github.com> Date: Tue, 22 Nov 2022 00:41:14 +0100 Subject: [PATCH 067/109] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20SERVICE=5FINTERVAL?= =?UTF-8?q?=20reset=20(#24888)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/printcounter.cpp | 6 +++--- Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V2.h | 4 ++-- Marlin/src/sd/cardreader.cpp | 18 +++++++++--------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Marlin/src/module/printcounter.cpp b/Marlin/src/module/printcounter.cpp index ad6f4eff68..3b6239c667 100644 --- a/Marlin/src/module/printcounter.cpp +++ b/Marlin/src/module/printcounter.cpp @@ -314,13 +314,13 @@ void PrintCounter::reset() { void PrintCounter::resetServiceInterval(const int index) { switch (index) { #if SERVICE_INTERVAL_1 > 0 - case 1: data.nextService1 = SERVICE_INTERVAL_SEC_1; + case 1: data.nextService1 = SERVICE_INTERVAL_SEC_1; break; #endif #if SERVICE_INTERVAL_2 > 0 - case 2: data.nextService2 = SERVICE_INTERVAL_SEC_2; + case 2: data.nextService2 = SERVICE_INTERVAL_SEC_2; break; #endif #if SERVICE_INTERVAL_3 > 0 - case 3: data.nextService3 = SERVICE_INTERVAL_SEC_3; + case 3: data.nextService3 = SERVICE_INTERVAL_SEC_3; break; #endif } saveStats(); diff --git a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V2.h b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V2.h index b3d6d48d9f..13e912d970 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V2.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V2.h @@ -53,8 +53,8 @@ // //#define WIFI_SERIAL 1// USART1 #if ENABLED(MKS_WIFI_MODULE) - #define WIFI_IO0_PIN PB14 // MKS ESP WIFI IO0 PIN - #define WIFI_IO1_PIN PB15 // MKS ESP WIFI IO1 PIN + #define WIFI_IO0_PIN PB14 // MKS ESP WIFI IO0 PIN + #define WIFI_IO1_PIN PB15 // MKS ESP WIFI IO1 PIN #define WIFI_RESET_PIN PD14 // MKS ESP WIFI RESET PIN #endif diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index 085ae9541c..07255f7e7f 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -330,15 +330,15 @@ void CardReader::printListing(SdFile parent, const char * const prepend, const SERIAL_CHAR(' '); SERIAL_ECHO(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)); - print_hex_word(crmodTime); - } + 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)); + print_hex_word(crmodTime); + } #if ENABLED(LONG_FILENAME_HOST_SUPPORT) if (includeLong) { SERIAL_CHAR(' '); From 8542e9a0852ffd699dc876b387587bea48500186 Mon Sep 17 00:00:00 2001 From: EvilGremlin <22657714+EvilGremlin@users.noreply.github.com> Date: Tue, 22 Nov 2022 02:45:57 +0300 Subject: [PATCH 068/109] =?UTF-8?q?=F0=9F=94=A7=20Check=20Delta=20homing?= =?UTF-8?q?=20direction=20(#24865)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/SanityCheck.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 63b719f1c2..7f663791f8 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1644,8 +1644,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS * Delta requirements */ #if ENABLED(DELTA) - #if NONE(USE_XMAX_PLUG, USE_YMAX_PLUG, USE_ZMAX_PLUG) - #error "You probably want to use Max Endstops for DELTA!" + #if ANY(X_HOME_TO_MIN, Y_HOME_TO_MIN, Z_HOME_TO_MIN) + #error "DELTA kinematics require homing "XYZ" axes to MAX. Set [XYZ]_HOME_DIR to 1." #elif ENABLED(ENABLE_LEVELING_FADE_HEIGHT) && DISABLED(AUTO_BED_LEVELING_BILINEAR) && !UBL_SEGMENTED #error "ENABLE_LEVELING_FADE_HEIGHT on DELTA requires AUTO_BED_LEVELING_BILINEAR or AUTO_BED_LEVELING_UBL." #elif ENABLED(DELTA_AUTO_CALIBRATION) && !(HAS_BED_PROBE || HAS_MARLINUI_MENU) From 393660334d58d65e9e0d5a174f77f8d3e3b52165 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Tue, 22 Nov 2022 12:47:27 +1300 Subject: [PATCH 069/109] =?UTF-8?q?=F0=9F=90=9B=20MKS=5FMINI=5F12864=20on?= =?UTF-8?q?=20SKR=201.3=20needs=20FORCE=5FSOFT=5FSPI=20(#24850)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h index 031a42f798..243aca7a72 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h @@ -423,6 +423,7 @@ #define DOGLCD_A0 EXP1_07_PIN #define DOGLCD_SCK EXP2_02_PIN #define DOGLCD_MOSI EXP2_06_PIN + #define FORCE_SOFT_SPI #elif ENABLED(ENDER2_STOCKDISPLAY) From 59e19898ce301af0bc870d61e34372fcda594aa5 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 22 Nov 2022 00:24:30 +0000 Subject: [PATCH 070/109] [cron] Bump distribution date (2022-11-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 5618d2bd26..a0a5659a80 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-11-15" +//#define STRING_DISTRIBUTION_DATE "2022-11-22" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 1589937808..f3e9c6f27e 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-11-15" + #define STRING_DISTRIBUTION_DATE "2022-11-22" #endif /** From 9c092ed0fcbe4f96300c9f2ecafa903cec54ca73 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sat, 26 Nov 2022 14:17:24 +1300 Subject: [PATCH 071/109] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20planner=20typo=20(?= =?UTF-8?q?#24977)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/planner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index dce9160664..0128d90f0f 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -2167,7 +2167,7 @@ bool Planner::_populate_block( sq(steps_dist_mm.x), + sq(steps_dist_mm.y), + sq(steps_dist_mm.z), + sq(steps_dist_mm.i), + sq(steps_dist_mm.j), + sq(steps_dist_mm.k), + sq(steps_dist_mm.u), + sq(steps_dist_mm.v), + sq(steps_dist_mm.w) - ); + ) #elif ENABLED(FOAMCUTTER_XYUV) #if HAS_J_AXIS // Special 5 axis kinematics. Return the largest distance move from either X/Y or I/J plane From 1d809168db5d14f57dea5e1b266d8a9c177f9e3d Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sat, 26 Nov 2022 16:40:24 +1300 Subject: [PATCH 072/109] =?UTF-8?q?=F0=9F=93=BA=20FYSETC=5FMINI=5F12864=5F?= =?UTF-8?q?2=5F1=20with=20BTT=5FSKR=5FE3=5FDIP=20(#24986)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h | 123 ++++++++++++++---- 1 file changed, 97 insertions(+), 26 deletions(-) diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h index f9c9de4f03..075258991d 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h @@ -166,19 +166,28 @@ * EXP1 */ +#define EXP1_01_PIN PA15 +#define EXP1_02_PIN PB6 +#define EXP1_03_PIN PA9 +#define EXP1_04_PIN -1 // RESET +#define EXP1_05_PIN PA10 +#define EXP1_06_PIN PB9 +#define EXP1_07_PIN PB8 +#define EXP1_08_PIN PB7 + #if HAS_WIRED_LCD #if ENABLED(CR10_STOCKDISPLAY) - #define BEEPER_PIN PA15 + #define BEEPER_PIN EXP1_01_PIN - #define BTN_ENC PB6 - #define BTN_EN1 PA9 - #define BTN_EN2 PA10 + #define BTN_ENC EXP1_02_PIN + #define BTN_EN1 EXP1_03_PIN + #define BTN_EN2 EXP1_05_PIN - #define LCD_PINS_RS PB8 - #define LCD_PINS_ENABLE PB7 - #define LCD_PINS_D4 PB9 + #define LCD_PINS_RS EXP1_07_PIN + #define LCD_PINS_ENABLE EXP1_08_PIN + #define LCD_PINS_D4 EXP1_06_PIN #elif ENABLED(ZONESTAR_LCD) // ANET A8 LCD Controller - Must convert to 3.3V - CONNECTING TO 5V WILL DAMAGE THE BOARD! @@ -186,12 +195,12 @@ #error "CAUTION! ZONESTAR_LCD requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_DIP.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" #endif - #define LCD_PINS_RS PB9 - #define LCD_PINS_ENABLE PB6 - #define LCD_PINS_D4 PB8 - #define LCD_PINS_D5 PA10 - #define LCD_PINS_D6 PA9 - #define LCD_PINS_D7 PA15 + #define LCD_PINS_RS EXP1_06_PIN + #define LCD_PINS_ENABLE EXP1_02_PIN + #define LCD_PINS_D4 EXP1_07_PIN + #define LCD_PINS_D5 EXP1_05_PIN + #define LCD_PINS_D6 EXP1_03_PIN + #define LCD_PINS_D7 EXP1_01_PIN #define ADC_KEYPAD_PIN PA1 // Repurpose servo pin for ADC - CONNECTING TO 5V WILL DAMAGE THE BOARD! #elif EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY) @@ -207,19 +216,81 @@ * EXP1 */ - #define BTN_ENC PB6 - #define BTN_EN1 PA9 - #define BTN_EN2 PA10 + #define BTN_ENC EXP1_02_PIN + #define BTN_EN1 EXP1_03_PIN + #define BTN_EN2 EXP1_05_PIN - #define DOGLCD_CS PB8 - #define DOGLCD_A0 PB9 - #define DOGLCD_SCK PA15 - #define DOGLCD_MOSI PB7 + #define DOGLCD_CS EXP1_07_PIN + #define DOGLCD_A0 EXP1_06_PIN + #define DOGLCD_SCK EXP1_01_PIN + #define DOGLCD_MOSI EXP1_08_PIN #define FORCE_SOFT_SPI #define LCD_BACKLIGHT_PIN -1 + #elif ENABLED(FYSETC_MINI_12864_2_1) + + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! FYSETC_MINI_12864_2_1 and it's clones require wiring modifications. See 'pins_BTT_SKR_MINI_E3_DIP.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif + #if SD_CONNECTION_IS(LCD) + #error "The LCD SD Card is not supported with this configuration." + #endif + + /** + * FYSETC_MINI_12864_2_1 / MKS_MINI_12864_V3 / BTT_MINI_12864_V1 display pinout + * + * Board Display + * ------ ------ + * (NEOPIXEL) PA15 | 1 2 | PB6 (BTN_ENC) 5V |10 9 | GND + * (BTN_EN2) PA9 | 3 4 | RESET -- | 8 7 | -- + * (BTN_EN1) PA10 5 6 | PB9 (LCD_RESET) NEOPIXEL | 6 5 LCD RESET + * (LCD_A0) PB8 | 7 8 | PB7 (LCD_CS) LCD_A0 | 4 3 | LCD_CS + * GND | 9 10 | 5V BTN_ENC | 2 1 | BEEP + * ------ ------ + * EXP1 EXP1 + * + * + * ----- ------ + * | 1 | RST -- |10 9 | -- + * | 2 | PA3 RX2 RESET_BTN | 8 7 | SD_DETECT + * | 3 | PA2 TX2 LCD_MOSI | 6 5 EN2 + * | 4 | GND -- | 4 3 | EN1 + * | 5 | 5V LCD_SCK | 2 1 | -- + * ----- ------ + * TFT EXP2 + + * + * Needs custom cable. + * + * BOARD EXP1 NEOPIXEL <--> LCD EXP1 NEOPIXEL + * BOARD EXP1 BTN_ENC <--> LCD EXP1 BTN_ENC + * BOARD EXP1 BTN_EN2 <--> LCD EXP2 EN2 + * BOARD EXP1 RESET <--> LCD EXP2 RESET_BTN + * BOARD EXP1 BTN_EN1 <--> LCD EXP2 EN1 + * BOARD EXP1 LCD_RESET <--> LCD EXP1 LCD RESET + * BOARD EXP1 LCD_A0 <--> LCD EXP1 LCD_A0 + * BOARD EXP1 LCD_CS <--> LCD EXP1 LCD_CS + * BOARD TFT RX2 <--> LCD EXP2 LCD_MOSI + * BOARD TFT TX2 <--> LCD EXP2 LCD_SCK + */ + + #define NEOPIXEL_PIN EXP1_01_PIN + #define BTN_ENC EXP1_02_PIN + #define BTN_EN1 EXP1_03_PIN + #define BTN_EN2 EXP1_05_PIN + #define LCD_RESET_PIN EXP1_06_PIN + #define BEEPER_PIN -1 + #define DOGLCD_A0 EXP1_07_PIN + #define DOGLCD_CS EXP1_08_PIN + + #define DOGLCD_SCK PA2 + #define DOGLCD_MOSI PA3 + + #define LCD_BACKLIGHT_PIN -1 + #define FORCE_SOFT_SPI + #else - #error "Only CR10_STOCKDISPLAY, ZONESTAR_LCD, ENDER2_STOCKDISPLAY, MKS_MINI_12864, and MKS_LCD12864A/B are currently supported on the BIGTREE_SKR_E3_DIP." + #error "Only CR10_STOCKDISPLAY, ZONESTAR_LCD, ENDER2_STOCKDISPLAY, MKS_MINI_12864, FYSETC_MINI_12864_2_1 and MKS_LCD12864A/B are currently supported on the BIGTREE_SKR_E3_DIP." #endif #endif // HAS_WIRED_LCD @@ -260,10 +331,10 @@ #define CLCD_SPI_BUS 1 // SPI1 connector - #define BEEPER_PIN PB6 + #define BEEPER_PIN EXP1_02_PIN - #define CLCD_MOD_RESET PA9 - #define CLCD_SPI_CS PB8 + #define CLCD_MOD_RESET EXP1_03_PIN + #define CLCD_SPI_CS EXP1_07_PIN #endif // TOUCH_UI_FTDI_EVE && LCD_FYSETC_TFT81050 @@ -281,8 +352,8 @@ #define SD_MISO_PIN PA6 #define SD_MOSI_PIN PA7 #elif SD_CONNECTION_IS(LCD) && BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) - #define SD_DETECT_PIN PA15 - #define SD_SS_PIN PA10 + #define SD_DETECT_PIN EXP1_01_PIN + #define SD_SS_PIN EXP1_05_PIN #elif SD_CONNECTION_IS(CUSTOM_CABLE) #error "SD CUSTOM_CABLE is not compatible with SKR E3 DIP." #endif From 1e5b34187e48ab19631540be48116e1a3e9b07f1 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Sat, 26 Nov 2022 04:41:49 +0100 Subject: [PATCH 073/109] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20Fix=20Robin=20nano?= =?UTF-8?q?=20env=20typo=20(#24993)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/pins.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 909ae992a9..ef73b3c8c0 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -516,7 +516,7 @@ #elif MB(MKS_ROBIN_NANO) #include "stm32f1/pins_MKS_ROBIN_NANO.h" // STM32F1 env:mks_robin_nano_v1v2 env:mks_robin_nano_v1v2_maple env:mks_robin_nano_v1v2_usbmod #elif MB(MKS_ROBIN_NANO_V2) - #include "stm32f1/pins_MKS_ROBIN_NANO_V2.h" // STM32F1 env:mks_robin_nano_v1v2 env:mks_robin_nano3_v1v2_maple + #include "stm32f1/pins_MKS_ROBIN_NANO_V2.h" // STM32F1 env:mks_robin_nano_v1v2 env:mks_robin_nano_v1v2_maple #elif MB(MKS_ROBIN_LITE) #include "stm32f1/pins_MKS_ROBIN_LITE.h" // STM32F1 env:mks_robin_lite env:mks_robin_lite_maple #elif MB(MKS_ROBIN_LITE3) From 93a297ba3b81b46d6f18de36f78198cbb5b764be Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 26 Nov 2022 06:05:45 +0000 Subject: [PATCH 074/109] [cron] Bump distribution date (2022-11-26) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index a0a5659a80..252fb0f513 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-11-22" +//#define STRING_DISTRIBUTION_DATE "2022-11-26" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index f3e9c6f27e..30ff927bf0 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-11-22" + #define STRING_DISTRIBUTION_DATE "2022-11-26" #endif /** From 74474c8a818745f1324aa5e22e59c361b4dff609 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sat, 26 Nov 2022 19:21:47 +1300 Subject: [PATCH 075/109] =?UTF-8?q?=F0=9F=94=A7=20Fix=20TPARA=20(=E2=80=A6?= =?UTF-8?q?SCARA,=20DELTA)=20settings=20(#25016)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 32 +++++++++---------- .../src/feature/bedlevel/ubl/ubl_motion.cpp | 4 +-- Marlin/src/inc/Conditionals_post.h | 6 ++-- Marlin/src/inc/SanityCheck.h | 2 ++ Marlin/src/module/scara.cpp | 2 +- Marlin/src/module/settings.cpp | 6 +--- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 87a98298a5..7f625c04f8 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -879,7 +879,7 @@ //#define POLARGRAPH #if ENABLED(POLARGRAPH) #define POLARGRAPH_MAX_BELT_LEN 1035.0 - #define POLAR_SEGMENTS_PER_SECOND 5 + #define DEFAULT_SEGMENTS_PER_SECOND 5 #endif // @section delta @@ -891,28 +891,28 @@ // Make delta curves from many straight lines (linear interpolation). // This is a trade-off between visible corners (not enough segments) // and processor overload (too many expensive sqrt calls). - #define DELTA_SEGMENTS_PER_SECOND 200 + #define DEFAULT_SEGMENTS_PER_SECOND 200 // After homing move down to a height where XY movement is unconstrained //#define DELTA_HOME_TO_SAFE_ZONE // Delta calibration menu - // uncomment to add three points calibration menu option. + // Add three-point calibration to the MarlinUI menu. // See http://minow.blogspot.com/index.html#4918805519571907051 //#define DELTA_CALIBRATION_MENU - // uncomment to add G33 Delta Auto-Calibration (Enable EEPROM_SETTINGS to store results) + // G33 Delta Auto-Calibration. Enable EEPROM_SETTINGS to store results. //#define DELTA_AUTO_CALIBRATION - // NOTE NB all values for DELTA_* values MUST be floating point, so always have a decimal point in them - #if ENABLED(DELTA_AUTO_CALIBRATION) - // set the default number of probe points : n*n (1 -> 7) + // Default number of probe points : n*n (1 -> 7) #define DELTA_CALIBRATION_DEFAULT_POINTS 4 #endif + // NOTE: All values for DELTA_* values MUST be floating point, so always have a decimal point in them + #if EITHER(DELTA_AUTO_CALIBRATION, DELTA_CALIBRATION_MENU) - // Set the steprate for papertest probing + // Step size for paper-test probing #define PROBE_MANUALLY_STEP 0.05 // (mm) #endif @@ -957,7 +957,7 @@ //#define MP_SCARA #if EITHER(MORGAN_SCARA, MP_SCARA) // If movement is choppy try lowering this value - #define SCARA_SEGMENTS_PER_SECOND 200 + #define DEFAULT_SEGMENTS_PER_SECOND 200 // Length of inner and outer support arms. Measure arm lengths precisely. #define SCARA_LINKAGE_1 150 // (mm) @@ -993,18 +993,18 @@ // Enable for TPARA kinematics and configure below //#define AXEL_TPARA #if ENABLED(AXEL_TPARA) - #define DEBUG_ROBOT_KINEMATICS - #define ROBOT_SEGMENTS_PER_SECOND 200 + #define DEBUG_TPARA_KINEMATICS + #define DEFAULT_SEGMENTS_PER_SECOND 200 // Length of inner and outer support arms. Measure arm lengths precisely. - #define ROBOT_LINKAGE_1 120 // (mm) - #define ROBOT_LINKAGE_2 120 // (mm) + #define TPARA_LINKAGE_1 120 // (mm) + #define TPARA_LINKAGE_2 120 // (mm) // SCARA tower offset (position of Tower relative to bed zero position) // This needs to be reasonably accurate as it defines the printbed position in the SCARA space. - #define ROBOT_OFFSET_X 0 // (mm) - #define ROBOT_OFFSET_Y 0 // (mm) - #define ROBOT_OFFSET_Z 0 // (mm) + #define TPARA_OFFSET_X 0 // (mm) + #define TPARA_OFFSET_Y 0 // (mm) + #define TPARA_OFFSET_Z 0 // (mm) #define SCARA_FEEDRATE_SCALING // Convert XY feedrate from mm/s to degrees/s on the fly diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp index 56c48650f1..96c30a0efd 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp @@ -336,9 +336,9 @@ #if IS_SCARA #define DELTA_SEGMENT_MIN_LENGTH 0.25 // SCARA minimum segment size is 0.25mm #elif ENABLED(DELTA) - #define DELTA_SEGMENT_MIN_LENGTH 0.10 // mm (still subject to DELTA_SEGMENTS_PER_SECOND) + #define DELTA_SEGMENT_MIN_LENGTH 0.10 // mm (still subject to DEFAULT_SEGMENTS_PER_SECOND) #elif ENABLED(POLARGRAPH) - #define DELTA_SEGMENT_MIN_LENGTH 0.10 // mm (still subject to DELTA_SEGMENTS_PER_SECOND) + #define DELTA_SEGMENT_MIN_LENGTH 0.10 // mm (still subject to DEFAULT_SEGMENTS_PER_SECOND) #else // CARTESIAN #ifdef LEVELED_SEGMENT_LENGTH #define DELTA_SEGMENT_MIN_LENGTH LEVELED_SEGMENT_LENGTH diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 1e0daeb567..f6e76d1a6e 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -275,10 +275,12 @@ */ #if IS_SCARA #undef SLOWDOWN - #if DISABLED(AXEL_TPARA) + #if ENABLED(AXEL_TPARA) + #define SCARA_PRINTABLE_RADIUS (TPARA_LINKAGE_1 + TPARA_LINKAGE_2) + #else #define QUICK_HOME + #define SCARA_PRINTABLE_RADIUS (SCARA_LINKAGE_1 + SCARA_LINKAGE_2) #endif - #define SCARA_PRINTABLE_RADIUS (SCARA_LINKAGE_1 + SCARA_LINKAGE_2) #endif /** diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 7f663791f8..2d8c7ca1c6 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -654,6 +654,8 @@ #error "SHOW_SD_PERCENT is now SHOW_PROGRESS_PERCENT." #elif defined(EXTRA_LIN_ADVANCE_K) #error "EXTRA_LIN_ADVANCE_K is now ADVANCE_K_EXTRA." +#elif defined(POLAR_SEGMENTS_PER_SECOND) || defined(DELTA_SEGMENTS_PER_SECOND) || defined(SCARA_SEGMENTS_PER_SECOND) || defined(TPARA_SEGMENTS_PER_SECOND) + #error "(POLAR|DELTA|SCARA|TPARA)_SEGMENTS_PER_SECOND is now DEFAULT_SEGMENTS_PER_SECOND." #endif // L64xx stepper drivers have been removed diff --git a/Marlin/src/module/scara.cpp b/Marlin/src/module/scara.cpp index bc42b85fbe..4c42ace884 100644 --- a/Marlin/src/module/scara.cpp +++ b/Marlin/src/module/scara.cpp @@ -37,7 +37,7 @@ #include "../MarlinCore.h" #endif -float segments_per_second = TERN(AXEL_TPARA, TPARA_SEGMENTS_PER_SECOND, SCARA_SEGMENTS_PER_SECOND); +float segments_per_second = DEFAULT_SEGMENTS_PER_SECOND; #if EITHER(MORGAN_SCARA, MP_SCARA) diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index a090b140ad..5d1ef71d66 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -3044,11 +3044,7 @@ void MarlinSettings::reset() { // #if IS_KINEMATIC - segments_per_second = ( - TERN_(DELTA, DELTA_SEGMENTS_PER_SECOND) - TERN_(IS_SCARA, SCARA_SEGMENTS_PER_SECOND) - TERN_(POLARGRAPH, POLAR_SEGMENTS_PER_SECOND) - ); + segments_per_second = DEFAULT_SEGMENTS_PER_SECOND; #if ENABLED(DELTA) const abc_float_t adj = DELTA_ENDSTOP_ADJ, dta = DELTA_TOWER_ANGLE_TRIM, ddr = DELTA_DIAGONAL_ROD_TRIM_TOWER; delta_height = DELTA_HEIGHT; From 86276a6dd2c5e7f8f7a3c6e02c6d08af11f64998 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Sat, 26 Nov 2022 08:23:24 +0100 Subject: [PATCH 076/109] =?UTF-8?q?=F0=9F=9A=B8=20COLOR=5FUI=20sleep=20tim?= =?UTF-8?q?eout=20/=20setting=20(#24994)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/marlinui.cpp | 24 ++++++++++++++-------- Marlin/src/lcd/menu/menu_configuration.cpp | 2 +- Marlin/src/lcd/tft/touch.cpp | 22 +++++++++++--------- Marlin/src/lcd/tft/touch.h | 2 +- Marlin/src/module/settings.cpp | 2 +- 5 files changed, 31 insertions(+), 21 deletions(-) diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 5991806b7b..cdda7ca85a 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -196,12 +196,15 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; uint8_t MarlinUI::sleep_timeout_minutes; // Initialized by settings.load() millis_t MarlinUI::screen_timeout_millis = 0; - #if DISABLED(TFT_COLOR_UI) - void MarlinUI::refresh_screen_timeout() { - screen_timeout_millis = sleep_timeout_minutes ? millis() + sleep_timeout_minutes * 60UL * 1000UL : 0; - sleep_display(false); - } + void MarlinUI::refresh_screen_timeout() { + screen_timeout_millis = sleep_timeout_minutes ? millis() + sleep_timeout_minutes * 60UL * 1000UL : 0; + sleep_display(false); + } + + #if !HAS_TOUCH_SLEEP && !HAS_MARLINUI_U8GLIB // without DOGM (COLOR_UI) + void MarlinUI::sleep_display(const bool sleep) {} // if unimplemented #endif + #endif void MarlinUI::init() { @@ -731,6 +734,11 @@ void MarlinUI::init() { void MarlinUI::wakeup_screen() { TERN(HAS_TOUCH_BUTTONS, touchBt.wakeUp(), touch.wakeUp()); } + #if HAS_DISPLAY_SLEEP && !HAS_MARLINUI_U8GLIB // without DOGM (COLOR_UI) + void MarlinUI::sleep_display(const bool sleep) { + if (!sleep) wakeup_screen(); // relay extra wake up events + } + #endif #endif void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) { @@ -1071,7 +1079,7 @@ void MarlinUI::init() { #if LCD_BACKLIGHT_TIMEOUT_MINS refresh_backlight_timeout(); - #elif HAS_DISPLAY_SLEEP && DISABLED(TFT_COLOR_UI) + #elif HAS_DISPLAY_SLEEP refresh_screen_timeout(); #endif @@ -1184,9 +1192,9 @@ void MarlinUI::init() { WRITE(LCD_BACKLIGHT_PIN, LOW); // Backlight off backlight_off_ms = 0; } - #elif HAS_DISPLAY_SLEEP && DISABLED(TFT_COLOR_UI) + #elif HAS_DISPLAY_SLEEP if (screen_timeout_millis && ELAPSED(ms, screen_timeout_millis)) - sleep_display(true); + sleep_display(); #endif // Change state of drawing flag between screen updates diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp index 1ac12656dd..7ae199dfd6 100644 --- a/Marlin/src/lcd/menu/menu_configuration.cpp +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -550,7 +550,7 @@ void menu_configuration() { // #if LCD_BACKLIGHT_TIMEOUT_MINS EDIT_ITEM(uint8, MSG_SCREEN_TIMEOUT, &ui.backlight_timeout_minutes, ui.backlight_timeout_min, ui.backlight_timeout_max, ui.refresh_backlight_timeout); - #elif HAS_DISPLAY_SLEEP && DISABLED(TFT_COLOR_UI) + #elif HAS_DISPLAY_SLEEP EDIT_ITEM(uint8, MSG_SCREEN_TIMEOUT, &ui.sleep_timeout_minutes, ui.sleep_timeout_min, ui.sleep_timeout_max, ui.refresh_screen_timeout); #endif diff --git a/Marlin/src/lcd/tft/touch.cpp b/Marlin/src/lcd/tft/touch.cpp index 824b269924..6bfc0a8abd 100644 --- a/Marlin/src/lcd/tft/touch.cpp +++ b/Marlin/src/lcd/tft/touch.cpp @@ -43,7 +43,7 @@ int16_t Touch::x, Touch::y; touch_control_t Touch::controls[]; touch_control_t *Touch::current_control; uint16_t Touch::controls_count; -millis_t Touch::last_touch_ms = 0, +millis_t Touch::next_touch_ms = 0, Touch::time_to_hold, Touch::repeat_delay, Touch::touch_time; @@ -83,8 +83,8 @@ void Touch::idle() { // Return if Touch::idle is called within the same millisecond const millis_t now = millis(); - if (last_touch_ms == now) return; - last_touch_ms = now; + if (now <= next_touch_ms) return; + next_touch_ms = now; if (get_point(&_x, &_y)) { #if HAS_RESUME_CONTINUE @@ -97,18 +97,18 @@ void Touch::idle() { } #endif - ui.reset_status_timeout(last_touch_ms); + ui.reset_status_timeout(now); if (touch_time) { #if ENABLED(TOUCH_SCREEN_CALIBRATION) - if (touch_control_type == NONE && ELAPSED(last_touch_ms, touch_time + TOUCH_SCREEN_HOLD_TO_CALIBRATE_MS) && ui.on_status_screen()) + if (touch_control_type == NONE && ELAPSED(now, touch_time + TOUCH_SCREEN_HOLD_TO_CALIBRATE_MS) && ui.on_status_screen()) ui.goto_screen(touch_screen_calibration); #endif return; } - if (time_to_hold == 0) time_to_hold = last_touch_ms + MINIMUM_HOLD_TIME; - if (PENDING(last_touch_ms, time_to_hold)) return; + if (time_to_hold == 0) time_to_hold = now + MINIMUM_HOLD_TIME; + if (PENDING(now, time_to_hold)) return; if (x != 0 && y != 0) { if (current_control) { @@ -133,7 +133,7 @@ void Touch::idle() { } if (!current_control) - touch_time = last_touch_ms; + touch_time = now; } x = _x; y = _y; @@ -252,8 +252,8 @@ void Touch::touch(touch_control_t *control) { void Touch::hold(touch_control_t *control, millis_t delay) { current_control = control; if (delay) { - repeat_delay = delay > MIN_REPEAT_DELAY ? delay : MIN_REPEAT_DELAY; - time_to_hold = last_touch_ms + repeat_delay; + repeat_delay = _MAX(delay, MIN_REPEAT_DELAY); + time_to_hold = next_touch_ms + repeat_delay; } ui.refresh(); } @@ -301,6 +301,8 @@ bool Touch::get_point(int16_t *x, int16_t *y) { #elif PIN_EXISTS(TFT_BACKLIGHT) WRITE(TFT_BACKLIGHT_PIN, HIGH); #endif + next_touch_ms = millis() + 100; + safe_delay(20); } next_sleep_ms = millis() + SEC_TO_MS(ui.sleep_timeout_minutes * 60); } diff --git a/Marlin/src/lcd/tft/touch.h b/Marlin/src/lcd/tft/touch.h index 6021a840b6..fd5d9fd737 100644 --- a/Marlin/src/lcd/tft/touch.h +++ b/Marlin/src/lcd/tft/touch.h @@ -103,7 +103,7 @@ class Touch { static touch_control_t *current_control; static uint16_t controls_count; - static millis_t last_touch_ms, time_to_hold, repeat_delay, touch_time; + static millis_t next_touch_ms, time_to_hold, repeat_delay, touch_time; static TouchControlType touch_control_type; static bool get_point(int16_t *x, int16_t *y); diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 5d1ef71d66..921b0d91cb 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -658,7 +658,7 @@ void MarlinSettings::postprocess() { #if LCD_BACKLIGHT_TIMEOUT_MINS ui.refresh_backlight_timeout(); - #elif HAS_DISPLAY_SLEEP && DISABLED(TFT_COLOR_UI) + #elif HAS_DISPLAY_SLEEP ui.refresh_screen_timeout(); #endif } From 8f9d98937889515861ff03d2559f9f87da5392d2 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sun, 27 Nov 2022 00:24:12 +0000 Subject: [PATCH 077/109] [cron] Bump distribution date (2022-11-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 252fb0f513..4f1ea59776 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-11-26" +//#define STRING_DISTRIBUTION_DATE "2022-11-27" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 30ff927bf0..fed821c193 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-11-26" + #define STRING_DISTRIBUTION_DATE "2022-11-27" #endif /** From 50e3e4d8628aeb2e2d106e341b9244e272965796 Mon Sep 17 00:00:00 2001 From: Thomas Buck Date: Sun, 27 Nov 2022 01:59:13 +0100 Subject: [PATCH 078/109] =?UTF-8?q?=F0=9F=9A=B8=20Optional=20Cutter/Laser?= =?UTF-8?q?=20status=20for=20HD44780=20(#25003)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/power_monitor.cpp | 6 +- Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp | 4 +- Marlin/src/lcd/HD44780/marlinui_HD44780.cpp | 184 +++++++++++++------- Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp | 19 +- Marlin/src/lcd/dogm/lcdprint_u8g.cpp | 2 +- Marlin/src/lcd/dogm/marlinui_DOGM.cpp | 24 +-- Marlin/src/lcd/dogm/status_screen_DOGM.cpp | 26 +-- Marlin/src/lcd/dogm/u8g_fontutf8.cpp | 2 +- Marlin/src/lcd/dogm/u8g_fontutf8.h | 2 +- Marlin/src/lcd/e3v2/marlinui/ui_common.cpp | 8 +- Marlin/src/lcd/language/language_en.h | 1 + Marlin/src/lcd/lcdprint.cpp | 2 +- Marlin/src/lcd/menu/menu_bed_corners.cpp | 2 +- Marlin/src/lcd/menu/menu_configuration.cpp | 2 +- Marlin/src/lcd/menu/menu_password.cpp | 4 +- Marlin/src/lcd/menu/menu_spindle_laser.cpp | 2 +- Marlin/src/lcd/menu/menu_tune.cpp | 4 +- buildroot/tests/BIGTREE_SKR_PRO | 2 +- buildroot/tests/mega2560 | 6 +- 19 files changed, 178 insertions(+), 124 deletions(-) diff --git a/Marlin/src/feature/power_monitor.cpp b/Marlin/src/feature/power_monitor.cpp index 5a9db1ec24..e3c3e58fc4 100644 --- a/Marlin/src/feature/power_monitor.cpp +++ b/Marlin/src/feature/power_monitor.cpp @@ -53,7 +53,7 @@ PowerMonitor power_monitor; // Single instance - this calls the constructor void PowerMonitor::draw_current() { const float amps = getAmps(); lcd_put_u8str(amps < 100 ? ftostr31ns(amps) : ui16tostr4rj((uint16_t)amps)); - lcd_put_lchar('A'); + lcd_put_u8str(F("A")); } #endif @@ -61,7 +61,7 @@ PowerMonitor power_monitor; // Single instance - this calls the constructor void PowerMonitor::draw_voltage() { const float volts = getVolts(); lcd_put_u8str(volts < 100 ? ftostr31ns(volts) : ui16tostr4rj((uint16_t)volts)); - lcd_put_lchar('V'); + lcd_put_u8str(F("V")); } #endif @@ -69,7 +69,7 @@ PowerMonitor power_monitor; // Single instance - this calls the constructor void PowerMonitor::draw_power() { const float power = getPower(); lcd_put_u8str(power < 100 ? ftostr31ns(power) : ui16tostr4rj((uint16_t)power)); - lcd_put_lchar('W'); + lcd_put_u8str(F("W")); } #endif diff --git a/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp b/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp index fe31c21e39..48f5f97133 100644 --- a/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp +++ b/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp @@ -56,9 +56,9 @@ typedef struct _hd44780_charmap_t { } hd44780_charmap_t; #ifdef __AVR__ - #define IV(a) U##a + #define IV(a) lchar_t(U##a) #else - #define IV(a) L##a + #define IV(a) lchar_t(L##a) #endif static const hd44780_charmap_t g_hd44780_charmap_device[] PROGMEM = { diff --git a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp index ba222897fc..ffbca8def6 100644 --- a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp +++ b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp @@ -58,6 +58,10 @@ #include "../../feature/bedlevel/bedlevel.h" #endif +#if HAS_CUTTER + #include "../../feature/spindle_laser.h" +#endif + // // Create LCD instance and chipset-specific information // @@ -406,7 +410,7 @@ void MarlinUI::clear_lcd() { lcd.clear(); } void lcd_erase_line(const lcd_uint_t line) { lcd_moveto(0, line); for (uint8_t i = LCD_WIDTH + 1; --i;) - lcd_put_lchar(' '); + lcd_put_u8str(F(" ")); } // Scroll the PSTR 'text' in a 'len' wide field for 'time' milliseconds at position col,line @@ -414,7 +418,7 @@ void MarlinUI::clear_lcd() { lcd.clear(); } uint8_t slen = utf8_strlen(ftxt); if (slen < len) { lcd_put_u8str_max(col, line, ftxt, len); - for (; slen < len; ++slen) lcd_put_lchar(' '); + for (; slen < len; ++slen) lcd_put_u8str(F(" ")); safe_delay(time); } else { @@ -426,7 +430,7 @@ void MarlinUI::clear_lcd() { lcd.clear(); } lcd_put_u8str_max_P(col, line, p, len); // Fill with spaces - for (uint8_t ix = slen - i; ix < len; ++ix) lcd_put_lchar(' '); + for (uint8_t ix = slen - i; ix < len; ++ix) lcd_put_u8str(F(" ")); // Delay safe_delay(dly); @@ -440,9 +444,9 @@ void MarlinUI::clear_lcd() { lcd.clear(); } static void logo_lines(FSTR_P const extra) { int16_t indent = (LCD_WIDTH - 8 - utf8_strlen(extra)) / 2; - lcd_put_lchar(indent, 0, '\x00'); lcd_put_u8str(F( "------" )); lcd_put_lchar('\x01'); + lcd_put_lchar(indent, 0, '\x00'); lcd_put_u8str(F( "------" )); lcd_put_u8str(F("\x01")); lcd_put_u8str(indent, 1, F("|Marlin|")); lcd_put_u8str(extra); - lcd_put_lchar(indent, 2, '\x02'); lcd_put_u8str(F( "------" )); lcd_put_lchar('\x03'); + lcd_put_lchar(indent, 2, '\x02'); lcd_put_u8str(F( "------" )); lcd_put_u8str(F("\x03")); } void MarlinUI::show_bootscreen() { @@ -522,7 +526,15 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const lcd_put_u8str(value); } - +/** + * @brief Draw current and target for a heater/cooler + * @details Print at the current LCD position the current/target for a single heater, + * blinking the target temperature of an idle heater has timed out. + * + * @param heater_id The heater ID, such as 0, 1, ..., H_BED, H_CHAMBER, etc. + * @param prefix A char to draw in front (e.g., a thermometer or icon) + * @param blink Flag to show the blink state instead of the regular state + */ FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char prefix, const bool blink) { #if HAS_HEATED_BED const bool isBed = TERN(HAS_HEATED_CHAMBER, heater_id == H_BED, heater_id < 0); @@ -535,75 +547,74 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char pr if (prefix >= 0) lcd_put_lchar(prefix); lcd_put_u8str(t1 < 0 ? "err" : i16tostr3rj(t1)); - lcd_put_lchar('/'); + lcd_put_u8str(F("/")); #if !HEATER_IDLE_HANDLER UNUSED(blink); #else - if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) { - lcd_put_lchar(' '); - if (t2 >= 10) lcd_put_lchar(' '); - if (t2 >= 100) lcd_put_lchar(' '); - } + if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) + lcd_put_u8str(F(" ")); else #endif lcd_put_u8str(i16tostr3left(t2)); if (prefix >= 0) { lcd_put_lchar(LCD_STR_DEGREE[0]); - lcd_put_lchar(' '); - if (t2 < 10) lcd_put_lchar(' '); + lcd_put_u8str(F(" ")); + if (t2 < 10) lcd_put_u8str(F(" ")); } } #if HAS_COOLER -FORCE_INLINE void _draw_cooler_status(const char prefix, const bool blink) { - const celsius_t t2 = thermalManager.degTargetCooler(); - if (prefix >= 0) lcd_put_lchar(prefix); + FORCE_INLINE void _draw_cooler_status(const char prefix, const bool blink) { + const celsius_t t2 = thermalManager.degTargetCooler(); - lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegCooler())); - lcd_put_lchar('/'); + if (prefix >= 0) lcd_put_lchar(prefix); - #if !HEATER_IDLE_HANDLER - UNUSED(blink); - #else - if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) { - lcd_put_lchar(' '); - if (t2 >= 10) lcd_put_lchar(' '); - if (t2 >= 100) lcd_put_lchar(' '); + lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegCooler())); + lcd_put_u8str(F("/")); + + #if !HEATER_IDLE_HANDLER + UNUSED(blink); + #else + if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) { + lcd_put_u8str(F(" ")); + if (t2 >= 10) lcd_put_u8str(F(" ")); + if (t2 >= 100) lcd_put_u8str(F(" ")); + } + else + #endif + lcd_put_u8str(i16tostr3left(t2)); + + if (prefix >= 0) { + lcd_put_lchar(LCD_STR_DEGREE[0]); + lcd_put_u8str(F(" ")); + if (t2 < 10) lcd_put_u8str(F(" ")); } - else - #endif - lcd_put_u8str(i16tostr3left(t2)); - - if (prefix >= 0) { - lcd_put_lchar(LCD_STR_DEGREE[0]); - lcd_put_lchar(' '); - if (t2 < 10) lcd_put_lchar(' '); } -} -#endif + +#endif // HAS_COOLER #if ENABLED(LASER_COOLANT_FLOW_METER) FORCE_INLINE void _draw_flowmeter_status() { - lcd_put_u8str("~"); + lcd_put_u8str(F("~")); lcd_put_u8str(ftostr11ns(cooler.flowrate)); - lcd_put_lchar('L'); + lcd_put_u8str(F("L")); } #endif #if ENABLED(I2C_AMMETER) FORCE_INLINE void _draw_ammeter_status() { - lcd_put_u8str(" "); + lcd_put_u8str(F(" ")); ammeter.read(); if (ammeter.current <= 0.999f) { lcd_put_u8str(ui16tostr3rj(uint16_t(ammeter.current * 1000 + 0.5f))); - lcd_put_u8str("mA"); + lcd_put_u8str(F("mA")); } else { lcd_put_u8str(ftostr12ns(ammeter.current)); - lcd_put_lchar('A'); + lcd_put_u8str(F("A")); } } #endif @@ -612,6 +623,36 @@ FORCE_INLINE void _draw_bed_status(const bool blink) { _draw_heater_status(H_BED, TERN0(HAS_LEVELING, blink && planner.leveling_active) ? '_' : LCD_STR_BEDTEMP[0], blink); } +#if HAS_CUTTER + + FORCE_INLINE void _draw_cutter_status() { + lcd_put_u8str(TERN(LASER_FEATURE, GET_TEXT_F(MSG_LASER), GET_TEXT_F(MSG_CUTTER))); + lcd_put_u8str(F(": ")); + + #if CUTTER_UNIT_IS(RPM) + lcd_put_u8str(ftostr61rj(float(cutter.unitPower) / 1000)); + lcd_put_u8str(F("K")); + #else + lcd_put_u8str(cutter_power2str(cutter.unitPower)); + #if CUTTER_UNIT_IS(PERCENT) + lcd_put_u8str(F("%")); + #endif + #endif + + lcd_put_u8str(F(" ")); + lcd_put_u8str(cutter.enabled() ? GET_TEXT_F(MSG_LCD_ON) : GET_TEXT_F(MSG_LCD_OFF)); + lcd_put_u8str(F(" ")); + + switch (cutter.cutter_mode) { + case CUTTER_MODE_STANDARD: lcd_put_u8str(F("S")); break; + case CUTTER_MODE_CONTINUOUS: lcd_put_u8str(F("C")); break; + case CUTTER_MODE_DYNAMIC: lcd_put_u8str(F("D")); break; + case CUTTER_MODE_ERROR: lcd_put_u8str(F("!")); break; + } + } + +#endif // HAS_CUTTER + #if ENABLED(LCD_PROGRESS_BAR) void MarlinUI::draw_progress_bar(const uint8_t percent) { @@ -654,7 +695,7 @@ void MarlinUI::draw_status_message(const bool blink) { lcd_put_u8str(ftostr12ns(filwidth.measured_mm)); lcd_put_u8str(F(" V")); lcd_put_u8str(i16tostr3rj(planner.volumetric_percent(parser.volumetric_enabled))); - lcd_put_lchar('%'); + lcd_put_u8str(F("%")); return; } @@ -673,7 +714,7 @@ void MarlinUI::draw_status_message(const bool blink) { lcd_put_u8str(status_message); // Fill the rest with spaces - while (slen < LCD_WIDTH) { lcd_put_lchar(' '); ++slen; } + while (slen < LCD_WIDTH) { lcd_put_u8str(F(" ")); ++slen; } } else { // String is larger than the available space in screen. @@ -687,11 +728,11 @@ void MarlinUI::draw_status_message(const bool blink) { // If the remaining string doesn't completely fill the screen if (rlen < LCD_WIDTH) { uint8_t chars = LCD_WIDTH - rlen; // Amount of space left in characters - lcd_put_lchar(' '); // Always at 1+ spaces left, draw a space + lcd_put_u8str(F(" ")); // Always at 1+ spaces left, draw a space if (--chars) { // Draw a second space if there's room - lcd_put_lchar(' '); + lcd_put_u8str(F(" ")); if (--chars) { // Draw a third space if there's room - lcd_put_lchar(' '); + lcd_put_u8str(F(" ")); if (--chars) lcd_put_u8str_max(status_message, chars); // Print a second copy of the message } @@ -712,10 +753,7 @@ void MarlinUI::draw_status_message(const bool blink) { lcd_put_u8str_max(status_message, LCD_WIDTH); // Fill the rest with spaces if there are missing spaces - while (slen < LCD_WIDTH) { - lcd_put_lchar(' '); - ++slen; - } + for (; slen < LCD_WIDTH; ++slen) lcd_put_u8str(F(" ")); #endif } @@ -732,7 +770,7 @@ void MarlinUI::draw_status_message(const bool blink) { lcd_moveto(pc, pr); lcd_put_u8str(F(TERN(IS_SD_PRINTING, "SD", "P:"))); lcd_put_u8str(TERN(PRINT_PROGRESS_SHOW_DECIMALS, permyriadtostr4(ui.get_progress_permyriad()), ui8tostr3rj(progress))); - lcd_put_lchar('%'); + lcd_put_u8str(F("%")); } } #endif @@ -828,6 +866,15 @@ void MarlinUI::draw_status_screen() { lcd_moveto(8, 0); _draw_bed_status(blink); #endif + + #elif HAS_CUTTER + + // + // Cutter Status + // + lcd_moveto(0, 0); + _draw_cutter_status(); + #endif #else // LCD_WIDTH >= 20 @@ -848,6 +895,15 @@ void MarlinUI::draw_status_screen() { lcd_moveto(10, 0); _draw_bed_status(blink); #endif + + #elif HAS_CUTTER + + // + // Cutter Status + // + lcd_moveto(0, 0); + _draw_cutter_status(); + #endif TERN_(HAS_COOLER, _draw_cooler_status('*', blink)); @@ -920,7 +976,7 @@ void MarlinUI::draw_status_screen() { else { const xy_pos_t lpos = current_position.asLogical(); _draw_axis_value(X_AXIS, ftostr4sign(lpos.x), blink); - lcd_put_lchar(' '); + lcd_put_u8str(F(" ")); _draw_axis_value(Y_AXIS, ftostr4sign(lpos.y), blink); } @@ -945,7 +1001,7 @@ void MarlinUI::draw_status_screen() { lcd_put_lchar(0, 2, LCD_STR_FEEDRATE[0]); lcd_put_u8str(i16tostr3rj(feedrate_percentage)); - lcd_put_lchar('%'); + lcd_put_u8str(F("%")); #if LCD_WIDTH >= 20 @@ -978,7 +1034,7 @@ void MarlinUI::draw_status_screen() { } lcd_put_lchar(c); lcd_put_u8str(i16tostr3rj(per)); - lcd_put_lchar('%'); + lcd_put_u8str(F("%")); #endif #endif @@ -1017,7 +1073,7 @@ void MarlinUI::draw_status_screen() { lcd_put_lchar(LCD_WIDTH - 9, 1, LCD_STR_FEEDRATE[0]); lcd_put_u8str(i16tostr3rj(feedrate_percentage)); - lcd_put_lchar('%'); + lcd_put_u8str(F("%")); // ========== Line 3 ========== @@ -1075,18 +1131,18 @@ void MarlinUI::draw_status_screen() { vlen = vstr ? utf8_strlen(vstr) : 0; if (style & SS_CENTER) { int8_t pad = (LCD_WIDTH - plen - vlen) / 2; - while (--pad >= 0) { lcd_put_lchar(' '); n--; } + while (--pad >= 0) { lcd_put_u8str(F(" ")); n--; } } if (plen) n = lcd_put_u8str(fstr, itemIndex, itemStringC, itemStringF, n); if (vlen) n -= lcd_put_u8str_max(vstr, n); - for (; n > 0; --n) lcd_put_lchar(' '); + for (; n > 0; --n) lcd_put_u8str(F(" ")); } // Draw a generic menu item with pre_char (if selected) and post_char void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char pre_char, const char post_char) { lcd_put_lchar(0, row, sel ? pre_char : ' '); uint8_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2); - for (; n; --n) lcd_put_lchar(' '); + for (; n; --n) lcd_put_u8str(F(" ")); lcd_put_lchar(post_char); } @@ -1096,8 +1152,8 @@ void MarlinUI::draw_status_screen() { lcd_put_lchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' '); uint8_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2 - vlen); if (vlen) { - lcd_put_lchar(':'); - for (; n; --n) lcd_put_lchar(' '); + lcd_put_u8str(F(":")); + for (; n; --n) lcd_put_u8str(F(" ")); if (pgm) lcd_put_u8str_P(inStr); else lcd_put_u8str(inStr); } } @@ -1107,7 +1163,7 @@ void MarlinUI::draw_status_screen() { ui.encoder_direction_normal(); uint8_t n = lcd_put_u8str(0, 1, ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 1); if (value) { - lcd_put_lchar(':'); n--; + lcd_put_u8str(F(":")); n--; const uint8_t len = utf8_strlen(value) + 1; // Plus one for a leading space const lcd_uint_t valrow = n < len ? 2 : 1; // Value on the next row if it won't fit lcd_put_lchar(LCD_WIDTH - len, valrow, ' '); // Right-justified, padded, leading space @@ -1134,7 +1190,7 @@ void MarlinUI::draw_status_screen() { lcd_put_lchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' '); constexpr uint8_t maxlen = LCD_WIDTH - 2; uint8_t n = maxlen - lcd_put_u8str_max(ui.scrolled_filename(theCard, maxlen, row, sel), maxlen); - for (; n; --n) lcd_put_lchar(' '); + for (; n; --n) lcd_put_u8str(F(" ")); lcd_put_lchar(isDir ? LCD_STR_FOLDER[0] : ' '); } @@ -1466,9 +1522,9 @@ void MarlinUI::draw_status_screen() { */ lcd_put_lchar(_LCD_W_POS, 0, '('); lcd_put_u8str(ui8tostr3rj(x_plot)); - lcd_put_lchar(','); + lcd_put_u8str(F(",")); lcd_put_u8str(ui8tostr3rj(y_plot)); - lcd_put_lchar(')'); + lcd_put_u8str(F(")")); #if LCD_HEIGHT <= 3 // 16x2 or 20x2 display diff --git a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp index 029a04bf97..1418edf5d1 100644 --- a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp +++ b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp @@ -523,17 +523,14 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const #if !HEATER_IDLE_HANDLER UNUSED(blink); #else - if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) { - lcd_put_lchar(' '); - if (t2 >= 10) lcd_put_lchar(' '); - if (t2 >= 100) lcd_put_lchar(' '); - } + if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) + lcd_put_u8str(F(" ")); else #endif lcd_put_u8str(i16tostr3left(t2)); - lcd_put_lchar(' '); - if (t2 < 10) lcd_put_lchar(' '); + lcd_put_u8str(F(" ")); + if (t2 < 10) lcd_put_u8str(F(" ")); if (t2) picBits |= ICON_TEMP1; else picBits &= ~ICON_TEMP1; @@ -545,7 +542,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const FORCE_INLINE void _draw_flowmeter_status() { lcd_moveto(5, 5); lcd_put_u8str(F("FLOW")); - lcd_moveto(7, 6); lcd_put_lchar('L'); + lcd_moveto(7, 6); lcd_put_u8str(F("L")); lcd_moveto(6, 7); lcd_put_u8str(ftostr11ns(cooler.flowrate)); if (cooler.flowrate) picBits |= ICON_FAN; @@ -564,7 +561,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const { lcd_put_u8str("mA"); lcd_moveto(10, 7); - lcd_put_lchar(' '); lcd_put_u8str(ui16tostr3rj(uint16_t(ammeter.current * 1000 + 0.5f))); + lcd_put_u8str(F(" ")); lcd_put_u8str(ui16tostr3rj(uint16_t(ammeter.current * 1000 + 0.5f))); } else { lcd_put_u8str(" A"); @@ -585,9 +582,9 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const #if CUTTER_UNIT_IS(RPM) lcd_moveto(16, 6); lcd_put_u8str(F("RPM")); lcd_moveto(15, 7); lcd_put_u8str(ftostr31ns(float(cutter.unitPower) / 1000)); - lcd_put_lchar('K'); + lcd_put_u8str(F("K")); #elif CUTTER_UNIT_IS(PERCENT) - lcd_moveto(17, 6); lcd_put_lchar('%'); + lcd_moveto(17, 6); lcd_put_u8str(F("%")); lcd_moveto(18, 7); lcd_put_u8str(cutter_power2str(cutter.unitPower)); #else lcd_moveto(17, 7); lcd_put_u8str(cutter_power2str(cutter.unitPower)); diff --git a/Marlin/src/lcd/dogm/lcdprint_u8g.cpp b/Marlin/src/lcd/dogm/lcdprint_u8g.cpp index 48b2e92a11..74a49b0950 100644 --- a/Marlin/src/lcd/dogm/lcdprint_u8g.cpp +++ b/Marlin/src/lcd/dogm/lcdprint_u8g.cpp @@ -34,7 +34,7 @@ int lcd_put_lchar_max(const lchar_t &c, const pixel_len_t max_length) { return u8g_GetFontBBXWidth(u8g.getU8g()); } u8g_uint_t x = u8g.getPrintCol(), y = u8g.getPrintRow(), - ret = uxg_DrawWchar(u8g.getU8g(), x, y, c, max_length); + ret = uxg_DrawLchar(u8g.getU8g(), x, y, c, max_length); u8g.setPrintPos(x + ret, y); return ret; } diff --git a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp index b72a1ac926..1a86058b94 100644 --- a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp +++ b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp @@ -372,9 +372,9 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop lcd_put_lchar(LCD_PIXEL_WIDTH - 11 * (MENU_FONT_WIDTH), y2, 'E'); lcd_put_lchar((char)('1' + extruder)); - lcd_put_lchar(' '); + lcd_put_u8str(F(" ")); lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegHotend(extruder))); - lcd_put_lchar('/'); + lcd_put_u8str(F("/")); if (get_blink() || !thermalManager.heater_idle[extruder].timed_out) lcd_put_u8str(i16tostr3rj(thermalManager.degTargetHotend(extruder))); @@ -420,12 +420,12 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop vlen = vstr ? utf8_strlen(vstr) : 0; if (style & SS_CENTER) { int pad = (LCD_PIXEL_WIDTH - plen - vlen * MENU_FONT_WIDTH) / MENU_FONT_WIDTH / 2; - while (--pad >= 0) n -= lcd_put_lchar(' '); + while (--pad >= 0) n -= lcd_put_u8str(F(" ")); } if (plen) n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, n / (MENU_FONT_WIDTH)) * (MENU_FONT_WIDTH); if (vlen) n -= lcd_put_u8str_max(vstr, n); - while (n > MENU_FONT_WIDTH) n -= lcd_put_lchar(' '); + while (n > MENU_FONT_WIDTH) n -= lcd_put_u8str(F(" ")); } } @@ -433,9 +433,9 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char, const char post_char) { if (mark_as_selected(row, sel)) { pixel_len_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 1) * (MENU_FONT_WIDTH); - while (n > MENU_FONT_WIDTH) n -= lcd_put_lchar(' '); + while (n > MENU_FONT_WIDTH) n -= lcd_put_u8str(F(" ")); lcd_put_lchar(LCD_PIXEL_WIDTH - (MENU_FONT_WIDTH), row_y2, post_char); - lcd_put_lchar(' '); + lcd_put_u8str(F(" ")); } } @@ -448,8 +448,8 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop pixel_len_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2 - vallen * prop) * (MENU_FONT_WIDTH); if (vallen) { - lcd_put_lchar(':'); - while (n > MENU_FONT_WIDTH) n -= lcd_put_lchar(' '); + lcd_put_u8str(F(":")); + while (n > MENU_FONT_WIDTH) n -= lcd_put_u8str(F(" ")); lcd_moveto(LCD_PIXEL_WIDTH - _MAX((MENU_FONT_WIDTH) * vallen, pixelwidth + 2), row_y2); if (pgm) lcd_put_u8str_P(inStr); else lcd_put_u8str(inStr); } @@ -493,7 +493,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop // If a value is included, print a colon, then print the value right-justified if (value) { - lcd_put_lchar(':'); + lcd_put_u8str(F(":")); if (extra_row) { // Assume that value is numeric (with no descender) baseline += EDIT_FONT_ASCENT + 2; @@ -535,7 +535,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop if (isDir) lcd_put_lchar(LCD_STR_FOLDER[0]); const pixel_len_t pixw = maxlen * (MENU_FONT_WIDTH); pixel_len_t n = pixw - lcd_put_u8str_max(ui.scrolled_filename(theCard, maxlen, row, sel), pixw); - while (n > MENU_FONT_WIDTH) n -= lcd_put_lchar(' '); + while (n > MENU_FONT_WIDTH) n -= lcd_put_u8str(F(" ")); } } @@ -612,9 +612,9 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop if (PAGE_CONTAINS(LCD_PIXEL_HEIGHT - (INFO_FONT_HEIGHT - 1), LCD_PIXEL_HEIGHT)) { lcd_put_lchar(5, LCD_PIXEL_HEIGHT, '('); u8g.print(x_plot); - lcd_put_lchar(','); + lcd_put_u8str(F(",")); u8g.print(y_plot); - lcd_put_lchar(')'); + lcd_put_u8str(F(")")); // Show the location value lcd_put_u8str_P(74, LCD_PIXEL_HEIGHT, Z_LBL); diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp index 83f492e124..4283ab59cb 100644 --- a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp @@ -455,7 +455,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const void MarlinUI::drawPercent() { if (progress_string[0]) { lcd_put_u8str(progress_x_pos, EXTRAS_BASELINE, progress_string); - lcd_put_lchar('%'); + lcd_put_u8str(F("%")); } } #endif @@ -705,7 +705,7 @@ void MarlinUI::draw_status_screen() { lcd_put_u8str(STATUS_CUTTER_TEXT_X, STATUS_CUTTER_TEXT_Y, cutter_power2str(cutter.unitPower)); #elif CUTTER_UNIT_IS(RPM) lcd_put_u8str(STATUS_CUTTER_TEXT_X - 2, STATUS_CUTTER_TEXT_Y, ftostr61rj(float(cutter.unitPower) / 1000)); - lcd_put_lchar('K'); + lcd_put_u8str(F("K")); #else lcd_put_u8str(STATUS_CUTTER_TEXT_X, STATUS_CUTTER_TEXT_Y, cutter_power2str(cutter.unitPower)); #endif @@ -892,7 +892,7 @@ void MarlinUI::draw_status_screen() { set_font(FONT_STATUSMENU); lcd_put_u8str(12, EXTRAS_2_BASELINE, i16tostr3rj(feedrate_percentage)); - lcd_put_lchar('%'); + lcd_put_u8str(F("%")); // // Filament sensor display if SD is disabled @@ -900,7 +900,7 @@ void MarlinUI::draw_status_screen() { #if ENABLED(FILAMENT_LCD_DISPLAY) && DISABLED(SDSUPPORT) lcd_put_u8str(56, EXTRAS_2_BASELINE, wstring); lcd_put_u8str(102, EXTRAS_2_BASELINE, mstring); - lcd_put_lchar('%'); + lcd_put_u8str(F("%")); set_font(FONT_MENU); lcd_put_lchar(47, EXTRAS_2_BASELINE, LCD_STR_FILAM_DIA[0]); // lcd_put_u8str(F(LCD_STR_FILAM_DIA)); lcd_put_lchar(93, EXTRAS_2_BASELINE, LCD_STR_FILAM_MUL[0]); @@ -917,12 +917,12 @@ void MarlinUI::draw_status_screen() { // Alternate Status message and Filament display if (ELAPSED(millis(), next_filament_display)) { lcd_put_u8str(F(LCD_STR_FILAM_DIA)); - lcd_put_lchar(':'); + lcd_put_u8str(F(":")); lcd_put_u8str(wstring); lcd_put_u8str(F(" " LCD_STR_FILAM_MUL)); - lcd_put_lchar(':'); + lcd_put_u8str(F(":")); lcd_put_u8str(mstring); - lcd_put_lchar('%'); + lcd_put_u8str(F("%")); return; } #endif @@ -955,7 +955,7 @@ void MarlinUI::draw_status_message(const bool blink) { if (slen <= lcd_width) { // The string fits within the line. Print with no scrolling lcd_put_u8str(status_message); - while (slen < lcd_width) { lcd_put_lchar(' '); ++slen; } + while (slen < lcd_width) { lcd_put_u8str(F(" ")); ++slen; } } else { // String is longer than the available space @@ -973,14 +973,14 @@ void MarlinUI::draw_status_message(const bool blink) { // If the remaining string doesn't completely fill the screen if (rlen < lcd_width) { uint8_t chars = lcd_width - rlen; // Amount of space left in characters - lcd_put_lchar(' '); // Always at 1+ spaces left, draw a space + lcd_put_u8str(F(" ")); // Always at 1+ spaces left, draw a space if (--chars) { // Draw a second space if there's room - lcd_put_lchar(' '); + lcd_put_u8str(F(" ")); if (--chars) { // Draw a third space if there's room - lcd_put_lchar(' '); + lcd_put_u8str(F(" ")); if (--chars) { // Print a second copy of the message lcd_put_u8str_max(status_message, pixel_width - (rlen + 2) * (MENU_FONT_WIDTH)); - lcd_put_lchar(' '); + lcd_put_u8str(F(" ")); } } } @@ -995,7 +995,7 @@ void MarlinUI::draw_status_message(const bool blink) { lcd_put_u8str_max(status_message, pixel_width); // Fill the rest with spaces - for (; slen < lcd_width; ++slen) lcd_put_lchar(' '); + for (; slen < lcd_width; ++slen) lcd_put_u8str(F(" ")); #endif // !STATUS_MESSAGE_SCROLLING diff --git a/Marlin/src/lcd/dogm/u8g_fontutf8.cpp b/Marlin/src/lcd/dogm/u8g_fontutf8.cpp index d5e0e5baff..e9d1535096 100644 --- a/Marlin/src/lcd/dogm/u8g_fontutf8.cpp +++ b/Marlin/src/lcd/dogm/u8g_fontutf8.cpp @@ -161,7 +161,7 @@ static int fontgroup_cb_draw_u8g(void *userdata, const font_t *fnt_current, cons * * Draw a UTF-8 string at the specified position */ -unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, const lchar_t &wc, pixel_len_t max_width) { +unsigned int uxg_DrawLchar(u8g_t *pu8g, unsigned int x, unsigned int y, const lchar_t &wc, pixel_len_t max_width) { struct _uxg_drawu8_data_t data; font_group_t *group = &g_fontgroup_root; const font_t *fnt_default = uxg_GetFont(pu8g); diff --git a/Marlin/src/lcd/dogm/u8g_fontutf8.h b/Marlin/src/lcd/dogm/u8g_fontutf8.h index 0109b6674c..660eb28ffe 100644 --- a/Marlin/src/lcd/dogm/u8g_fontutf8.h +++ b/Marlin/src/lcd/dogm/u8g_fontutf8.h @@ -26,7 +26,7 @@ typedef struct _uxg_fontinfo_t { int uxg_SetUtf8Fonts(const uxg_fontinfo_t * fntinfo, int number); // fntinfo is type of PROGMEM -unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, const lchar_t &ch, const pixel_len_t max_length); +unsigned int uxg_DrawLchar(u8g_t *pu8g, unsigned int x, unsigned int y, const lchar_t &ch, const pixel_len_t max_length); unsigned int uxg_DrawUtf8Str(u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, const pixel_len_t max_length); unsigned int uxg_DrawUtf8StrP(u8g_t *pu8g, unsigned int x, unsigned int y, PGM_P utf8_msg, const pixel_len_t max_length); diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp index ab21c7be4a..560b30be0a 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp @@ -213,7 +213,7 @@ void MarlinUI::draw_status_message(const bool blink) { lcd_put_u8str(status_message); // Fill the rest with spaces - while (slen < max_status_chars) { lcd_put_lchar(' '); ++slen; } + while (slen < max_status_chars) { lcd_put_u8str(F(" ")); ++slen; } } } else { @@ -227,10 +227,10 @@ void MarlinUI::draw_status_message(const bool blink) { // If the string doesn't completely fill the line... if (rlen < max_status_chars) { - lcd_put_lchar('.'); // Always at 1+ spaces left, draw a dot + lcd_put_u8str(F(".")); // Always at 1+ spaces left, draw a dot uint8_t chars = max_status_chars - rlen; // Amount of space left in characters if (--chars) { // Draw a second dot if there's space - lcd_put_lchar('.'); + lcd_put_u8str(F(".")); if (--chars) lcd_put_u8str_max(status_message, chars); // Print a second copy of the message } @@ -254,7 +254,7 @@ void MarlinUI::draw_status_message(const bool blink) { lcd_put_u8str_max(status_message, max_status_chars); // Fill the rest with spaces if there are missing spaces - while (slen < max_status_chars) { lcd_put_lchar(' '); ++slen; } + while (slen < max_status_chars) { lcd_put_u8str(F(" ")); ++slen; } } #endif diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index c888207ed1..8db5032bf3 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -332,6 +332,7 @@ namespace Language_en { LSTR MSG_COOLER = _UxGT("Laser Coolant"); LSTR MSG_COOLER_TOGGLE = _UxGT("Toggle Cooler"); LSTR MSG_FLOWMETER_SAFETY = _UxGT("Flow Safety"); + LSTR MSG_CUTTER = _UxGT("Cutter"); LSTR MSG_LASER = _UxGT("Laser"); LSTR MSG_FAN_SPEED = _UxGT("Fan Speed"); LSTR MSG_FAN_SPEED_N = _UxGT("Fan Speed ~"); diff --git a/Marlin/src/lcd/lcdprint.cpp b/Marlin/src/lcd/lcdprint.cpp index 7757379ac9..650824e553 100644 --- a/Marlin/src/lcd/lcdprint.cpp +++ b/Marlin/src/lcd/lcdprint.cpp @@ -52,7 +52,7 @@ lcd_uint_t lcd_put_u8str_P(PGM_P const ptpl, const int8_t ind, const char *cstr/ if (!wc) break; if (wc == '=' || wc == '~' || wc == '*') { if (ind >= 0) { - if (wc == '*') { lcd_put_lchar('E'); n--; } + if (wc == '*') { lcd_put_u8str(F("E")); n--; } if (n) { int8_t inum = ind + ((wc == '=') ? 0 : LCD_FIRST_TOOL); if (inum >= 10) { diff --git a/Marlin/src/lcd/menu/menu_bed_corners.cpp b/Marlin/src/lcd/menu/menu_bed_corners.cpp index c4a63dafc6..0e0051e65d 100644 --- a/Marlin/src/lcd/menu/menu_bed_corners.cpp +++ b/Marlin/src/lcd/menu/menu_bed_corners.cpp @@ -178,7 +178,7 @@ static void _lcd_level_bed_corners_get_next_position() { lcd_put_u8str(GET_TEXT_F(MSG_BED_TRAMMING_GOOD_POINTS)); IF_ENABLED(TFT_COLOR_UI, lcd_moveto(12, cy)); lcd_put_u8str(GOOD_POINTS_TO_STR(good_points)); - lcd_put_lchar('/'); + lcd_put_u8str(F("/")); lcd_put_u8str(GOOD_POINTS_TO_STR(nr_edge_points)); } diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp index 7ae199dfd6..e50cd69f63 100644 --- a/Marlin/src/lcd/menu/menu_configuration.cpp +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -79,7 +79,7 @@ void menu_advanced_settings(); LIMIT(bar_percent, 0, 100); ui.encoderPosition = 0; MenuItem_static::draw(0, GET_TEXT_F(MSG_PROGRESS_BAR_TEST), SS_DEFAULT|SS_INVERT); - lcd_put_int((LCD_WIDTH) / 2 - 2, LCD_HEIGHT - 2, bar_percent); lcd_put_lchar('%'); + lcd_put_int((LCD_WIDTH) / 2 - 2, LCD_HEIGHT - 2, bar_percent); lcd_put_u8str(F("%")); lcd_moveto(0, LCD_HEIGHT - 1); ui.draw_progress_bar(bar_percent); } diff --git a/Marlin/src/lcd/menu/menu_password.cpp b/Marlin/src/lcd/menu/menu_password.cpp index d29b77311f..b50194d60d 100644 --- a/Marlin/src/lcd/menu/menu_password.cpp +++ b/Marlin/src/lcd/menu/menu_password.cpp @@ -61,10 +61,10 @@ void Password::menu_password_entry() { FSTR_P const label = GET_TEXT_F(MSG_ENTER_DIGIT); EDIT_ITEM_F(uint8, label, &editable.uint8, 0, 9, digit_entered); MENU_ITEM_ADDON_START(utf8_strlen(label) + 1); - lcd_put_lchar(' '); + lcd_put_u8str(F(" ")); lcd_put_lchar('1' + digit_no); SETCURSOR_X(LCD_WIDTH - 2); - lcd_put_lchar('>'); + lcd_put_u8str(F(">")); MENU_ITEM_ADDON_END(); ACTION_ITEM(MSG_START_OVER, start_over); diff --git a/Marlin/src/lcd/menu/menu_spindle_laser.cpp b/Marlin/src/lcd/menu/menu_spindle_laser.cpp index a6f99546f6..de16316987 100644 --- a/Marlin/src/lcd/menu/menu_spindle_laser.cpp +++ b/Marlin/src/lcd/menu/menu_spindle_laser.cpp @@ -79,7 +79,7 @@ EDIT_ITEM_FAST(CUTTER_MENU_PULSE_TYPE, MSG_LASER_PULSE_MS, &cutter.testPulse, LASER_TEST_PULSE_MIN, LASER_TEST_PULSE_MAX); ACTION_ITEM(MSG_LASER_FIRE_PULSE, cutter.test_fire_pulse); #if ENABLED(HAL_CAN_SET_PWM_FREQ) && SPINDLE_LASER_FREQUENCY - EDIT_ITEM_FAST(CUTTER_MENU_FREQUENCY_TYPE, MSG_CUTTER_FREQUENCY, &cutter.frequency, 2000, 80000, cutter.refresh_frequency); + EDIT_ITEM_FAST(CUTTER_MENU_FREQUENCY_TYPE, MSG_CUTTER_FREQUENCY, &cutter.frequency, 2000, 65535, cutter.refresh_frequency); #endif #endif END_MENU(); diff --git a/Marlin/src/lcd/menu/menu_tune.cpp b/Marlin/src/lcd/menu/menu_tune.cpp index 79d87bb6ca..423af4e5a1 100644 --- a/Marlin/src/lcd/menu/menu_tune.cpp +++ b/Marlin/src/lcd/menu/menu_tune.cpp @@ -76,12 +76,12 @@ #if ENABLED(TFT_COLOR_UI) lcd_moveto(4, 3); lcd_put_u8str(GET_TEXT_F(MSG_BABYSTEP_TOTAL)); - lcd_put_lchar(':'); + lcd_put_u8str(F(":")); lcd_moveto(10, 3); #else lcd_moveto(0, TERN(HAS_MARLINUI_U8GLIB, LCD_PIXEL_HEIGHT - MENU_FONT_DESCENT, LCD_HEIGHT - 1)); lcd_put_u8str(GET_TEXT_F(MSG_BABYSTEP_TOTAL)); - lcd_put_lchar(':'); + lcd_put_u8str(F(":")); #endif lcd_put_u8str(BABYSTEP_TO_STR(mps * babystep.axis_total[BS_TOTAL_IND(axis)])); } diff --git a/buildroot/tests/BIGTREE_SKR_PRO b/buildroot/tests/BIGTREE_SKR_PRO index 2f1075c7ef..3ffc9857a8 100755 --- a/buildroot/tests/BIGTREE_SKR_PRO +++ b/buildroot/tests/BIGTREE_SKR_PRO @@ -27,7 +27,7 @@ opt_set MOTHERBOARD BOARD_BTT_SKR_PRO_V1_1 SERIAL_PORT -1 \ SPINDLE_LASER_PWM_PIN HEATER_1_PIN SPINDLE_LASER_ENA_PIN HEATER_2_PIN \ TEMP_SENSOR_COOLER 1000 TEMP_COOLER_PIN PD13 opt_enable LASER_FEATURE LASER_SAFETY_TIMEOUT_MS REPRAP_DISCOUNT_SMART_CONTROLLER -exec_test $1 $2 "BigTreeTech SKR Pro | Laser (Percent) | Cooling | LCD" "$3" +exec_test $1 $2 "BigTreeTech SKR Pro | HD44780 | Laser (Percent) | Cooling | LCD" "$3" # clean up restore_configs diff --git a/buildroot/tests/mega2560 b/buildroot/tests/mega2560 index 333be2f0fa..18a6ea88c9 100755 --- a/buildroot/tests/mega2560 +++ b/buildroot/tests/mega2560 @@ -268,12 +268,12 @@ opt_set MOTHERBOARD BOARD_RAMPS_14_EFB opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER \ SET_PROGRESS_MANUALLY SET_PROGRESS_PERCENT SET_REMAINING_TIME SET_INTERACTION_TIME M73_REPORT \ SHOW_PROGRESS_PERCENT SHOW_ELAPSED_TIME SHOW_REMAINING_TIME SHOW_INTERACTION_TIME PRINT_PROGRESS_SHOW_DECIMALS -exec_test $1 $2 "MEGA2560 RAMPS | 12864 | progress rotation" "$3" +exec_test $1 $2 "MEGA2560 RAMPS | 128x64 | progress rotation" "$3" opt_enable LIGHTWEIGHT_UI -exec_test $1 $2 "MEGA2560 RAMPS | 12864 LIGHTWEIGHT_UI | progress rotation" "$3" +exec_test $1 $2 "MEGA2560 RAMPS | 128x64 LIGHTWEIGHT_UI | progress rotation" "$3" opt_disable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER -exec_test $1 $2 "MEGA2560 RAMPS | 44780 | progress rotation" "$3" +exec_test $1 $2 "MEGA2560 RAMPS | HD44780 | progress rotation" "$3" # clean up restore_configs From 5f831768a2576edc679fe06d9bf41c090fced8e1 Mon Sep 17 00:00:00 2001 From: mikemerryguy <57319047+mikemerryguy@users.noreply.github.com> Date: Sat, 26 Nov 2022 20:14:05 -0500 Subject: [PATCH 079/109] =?UTF-8?q?=F0=9F=9A=B8=20Add=2050mm=20manual=20mo?= =?UTF-8?q?ve=20(#24884)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/language/language_an.h | 1 + Marlin/src/lcd/language/language_bg.h | 1 + Marlin/src/lcd/language/language_ca.h | 1 + Marlin/src/lcd/language/language_cz.h | 1 + Marlin/src/lcd/language/language_da.h | 1 + Marlin/src/lcd/language/language_de.h | 1 + Marlin/src/lcd/language/language_el.h | 1 + Marlin/src/lcd/language/language_el_gr.h | 1 + Marlin/src/lcd/language/language_en.h | 2 ++ Marlin/src/lcd/language/language_es.h | 1 + Marlin/src/lcd/language/language_eu.h | 1 + Marlin/src/lcd/language/language_fi.h | 1 + Marlin/src/lcd/language/language_fr.h | 2 ++ Marlin/src/lcd/language/language_gl.h | 1 + Marlin/src/lcd/language/language_hr.h | 1 + Marlin/src/lcd/language/language_hu.h | 2 ++ Marlin/src/lcd/language/language_it.h | 2 ++ Marlin/src/lcd/language/language_jp_kana.h | 1 + Marlin/src/lcd/language/language_zh_TW.h | 1 + Marlin/src/lcd/menu/menu_motion.cpp | 25 ++++++++++++++++--- .../src/pins/stm32f4/pins_MKS_MONSTER8_V2.h | 8 +++--- 21 files changed, 49 insertions(+), 7 deletions(-) diff --git a/Marlin/src/lcd/language/language_an.h b/Marlin/src/lcd/language/language_an.h index 37c90c34da..8e65f38012 100644 --- a/Marlin/src/lcd/language/language_an.h +++ b/Marlin/src/lcd/language/language_an.h @@ -90,6 +90,7 @@ namespace Language_an { LSTR MSG_MOVE_01MM = _UxGT("Mover 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Mover 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Mover 10mm"); + LSTR MSG_MOVE_50MM = _UxGT("Mover 50mm"); LSTR MSG_MOVE_100MM = _UxGT("Mover 100mm"); LSTR MSG_SPEED = _UxGT("Velocidat"); LSTR MSG_BED_Z = _UxGT("Base Z"); diff --git a/Marlin/src/lcd/language/language_bg.h b/Marlin/src/lcd/language/language_bg.h index 038df3eccb..312ada7b10 100644 --- a/Marlin/src/lcd/language/language_bg.h +++ b/Marlin/src/lcd/language/language_bg.h @@ -79,6 +79,7 @@ namespace Language_bg { LSTR MSG_MOVE_01MM = _UxGT("Премести с 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Премести с 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Премести с 10mm"); + LSTR MSG_MOVE_50MM = _UxGT("Премести с 50mm"); LSTR MSG_MOVE_100MM = _UxGT("Премести с 100mm"); LSTR MSG_SPEED = _UxGT("Скорост"); LSTR MSG_BED_Z = _UxGT("Bed Z"); diff --git a/Marlin/src/lcd/language/language_ca.h b/Marlin/src/lcd/language/language_ca.h index 54b968ede2..d3a1c2eac1 100644 --- a/Marlin/src/lcd/language/language_ca.h +++ b/Marlin/src/lcd/language/language_ca.h @@ -90,6 +90,7 @@ namespace Language_ca { LSTR MSG_MOVE_01MM = _UxGT("Mou 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Mou 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Mou 10mm"); + LSTR MSG_MOVE_50MM = _UxGT("Mou 50mm"); LSTR MSG_MOVE_100MM = _UxGT("Mou 100mm"); LSTR MSG_SPEED = _UxGT("Velocitat"); LSTR MSG_BED_Z = _UxGT("Llit Z"); diff --git a/Marlin/src/lcd/language/language_cz.h b/Marlin/src/lcd/language/language_cz.h index 9c5bafc96e..50d490a6c2 100644 --- a/Marlin/src/lcd/language/language_cz.h +++ b/Marlin/src/lcd/language/language_cz.h @@ -240,6 +240,7 @@ namespace Language_cz { LSTR MSG_MOVE_01MM = _UxGT("Posunout o 0,1mm"); LSTR MSG_MOVE_1MM = _UxGT("Posunout o 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Posunout o 10mm"); + LSTR MSG_MOVE_50MM = _UxGT("Posunout o 50mm"); LSTR MSG_MOVE_100MM = _UxGT("Posunout o 100mm"); LSTR MSG_SPEED = _UxGT("Rychlost"); LSTR MSG_BED_Z = _UxGT("Výška podl."); diff --git a/Marlin/src/lcd/language/language_da.h b/Marlin/src/lcd/language/language_da.h index b4afca9d99..4078c413d1 100644 --- a/Marlin/src/lcd/language/language_da.h +++ b/Marlin/src/lcd/language/language_da.h @@ -81,6 +81,7 @@ namespace Language_da { LSTR MSG_MOVE_01MM = _UxGT("Flyt 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Flyt 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Flyt 10mm"); + LSTR MSG_MOVE_50MM = _UxGT("Flyt 50mm"); LSTR MSG_MOVE_100MM = _UxGT("Flyt 100mm"); LSTR MSG_SPEED = _UxGT("Hastighed"); LSTR MSG_BED_Z = _UxGT("Plade Z"); diff --git a/Marlin/src/lcd/language/language_de.h b/Marlin/src/lcd/language/language_de.h index 9939ea3f44..c2af37fc77 100644 --- a/Marlin/src/lcd/language/language_de.h +++ b/Marlin/src/lcd/language/language_de.h @@ -301,6 +301,7 @@ namespace Language_de { LSTR MSG_MOVE_01MM = _UxGT(" 0,1 mm"); LSTR MSG_MOVE_1MM = _UxGT(" 1,0 mm"); LSTR MSG_MOVE_10MM = _UxGT(" 10,0 mm"); + LSTR MSG_MOVE_50MM = _UxGT(" 50,0 mm"); LSTR MSG_MOVE_100MM = _UxGT("100,0 mm"); LSTR MSG_MOVE_0001IN = _UxGT("0.001 in"); LSTR MSG_MOVE_001IN = _UxGT("0.010 in"); diff --git a/Marlin/src/lcd/language/language_el.h b/Marlin/src/lcd/language/language_el.h index 41b73ddc57..2d7c42b2fa 100644 --- a/Marlin/src/lcd/language/language_el.h +++ b/Marlin/src/lcd/language/language_el.h @@ -99,6 +99,7 @@ namespace Language_el { LSTR MSG_MOVE_01MM = _UxGT("Μετακίνηση 0,1 μμ"); LSTR MSG_MOVE_1MM = _UxGT("Μετακίνηση 1 μμ"); LSTR MSG_MOVE_10MM = _UxGT("Μετακίνηση 10 μμ"); + LSTR MSG_MOVE_50MM = _UxGT("Μετακίνηση 50 μμ"); LSTR MSG_MOVE_100MM = _UxGT("Μετακίνηση 100 μμ"); LSTR MSG_SPEED = _UxGT("Ταχύτητα"); LSTR MSG_BED_Z = _UxGT("Επ. Εκτύπωσης Z"); diff --git a/Marlin/src/lcd/language/language_el_gr.h b/Marlin/src/lcd/language/language_el_gr.h index 7306aab123..a76870d2a3 100644 --- a/Marlin/src/lcd/language/language_el_gr.h +++ b/Marlin/src/lcd/language/language_el_gr.h @@ -88,6 +88,7 @@ namespace Language_el_gr { LSTR MSG_MOVE_01MM = _UxGT("Μετακίνηση 0,1 μμ"); LSTR MSG_MOVE_1MM = _UxGT("Μετακίνηση 1 μμ"); LSTR MSG_MOVE_10MM = _UxGT("Μετακίνηση 10 μμ"); + LSTR MSG_MOVE_50MM = _UxGT("Μετακίνηση 50 μμ"); LSTR MSG_MOVE_100MM = _UxGT("Μετακίνηση 100 μμ"); LSTR MSG_SPEED = _UxGT("Ταχύτητα"); LSTR MSG_BED_Z = _UxGT("Κλίνη Z"); diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 8db5032bf3..2ecf2def12 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -316,10 +316,12 @@ namespace Language_en { LSTR MSG_MOVE_01MM = _UxGT("Move 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Move 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Move 10mm"); + LSTR MSG_MOVE_50MM = _UxGT("Move 50mm"); LSTR MSG_MOVE_100MM = _UxGT("Move 100mm"); LSTR MSG_MOVE_0001IN = _UxGT("Move 0.001in"); LSTR MSG_MOVE_001IN = _UxGT("Move 0.01in"); LSTR MSG_MOVE_01IN = _UxGT("Move 0.1in"); + LSTR MSG_MOVE_05IN = _UxGT("Move 0.5in"); LSTR MSG_MOVE_1IN = _UxGT("Move 1.0in"); LSTR MSG_SPEED = _UxGT("Speed"); LSTR MSG_BED_Z = _UxGT("Bed Z"); diff --git a/Marlin/src/lcd/language/language_es.h b/Marlin/src/lcd/language/language_es.h index 5f88f8426d..5422a8117b 100644 --- a/Marlin/src/lcd/language/language_es.h +++ b/Marlin/src/lcd/language/language_es.h @@ -234,6 +234,7 @@ namespace Language_es { LSTR MSG_MOVE_01MM = _UxGT("Mover 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Mover 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Mover 10mm"); + LSTR MSG_MOVE_50MM = _UxGT("Mover 50mm"); LSTR MSG_MOVE_100MM = _UxGT("Mover 100mm"); LSTR MSG_SPEED = _UxGT("Velocidad"); LSTR MSG_BED_Z = _UxGT("Cama Z"); diff --git a/Marlin/src/lcd/language/language_eu.h b/Marlin/src/lcd/language/language_eu.h index 210fdbdc16..77c8dbe2d8 100644 --- a/Marlin/src/lcd/language/language_eu.h +++ b/Marlin/src/lcd/language/language_eu.h @@ -143,6 +143,7 @@ namespace Language_eu { LSTR MSG_MOVE_01MM = _UxGT("Mugitu 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Mugitu 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Mugitu 10mm"); + LSTR MSG_MOVE_50MM = _UxGT("Mugitu 50mm"); LSTR MSG_MOVE_100MM = _UxGT("Mugitu 100mm"); LSTR MSG_SPEED = _UxGT("Abiadura"); LSTR MSG_BED_Z = _UxGT("Z Ohea"); diff --git a/Marlin/src/lcd/language/language_fi.h b/Marlin/src/lcd/language/language_fi.h index ff1c23eee7..300da9b956 100644 --- a/Marlin/src/lcd/language/language_fi.h +++ b/Marlin/src/lcd/language/language_fi.h @@ -76,6 +76,7 @@ namespace Language_fi { LSTR MSG_MOVE_01MM = _UxGT("Liikuta 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Liikuta 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Liikuta 10mm"); + LSTR MSG_MOVE_50MM = _UxGT("Liikuta 50mm"); LSTR MSG_MOVE_100MM = _UxGT("Liikuta 100mm"); LSTR MSG_SPEED = _UxGT("Nopeus"); LSTR MSG_NOZZLE = _UxGT("Suutin"); diff --git a/Marlin/src/lcd/language/language_fr.h b/Marlin/src/lcd/language/language_fr.h index 05e69a583f..ed4c7ca9af 100644 --- a/Marlin/src/lcd/language/language_fr.h +++ b/Marlin/src/lcd/language/language_fr.h @@ -238,10 +238,12 @@ namespace Language_fr { LSTR MSG_MOVE_01MM = _UxGT("Déplacer 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Déplacer 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Déplacer 10mm"); + LSTR MSG_MOVE_50MM = _UxGT("Déplacer 50mm"); LSTR MSG_MOVE_100MM = _UxGT("Déplacer 100mm"); LSTR MSG_MOVE_0001IN = _UxGT("Déplacer 0.001\""); LSTR MSG_MOVE_001IN = _UxGT("Déplacer 0.01\""); LSTR MSG_MOVE_01IN = _UxGT("Déplacer 0.1\""); + LSTR MSG_MOVE_05IN = _UxGT("Déplacer 0.5\""); LSTR MSG_MOVE_1IN = _UxGT("Déplacer 1\""); LSTR MSG_SPEED = _UxGT("Vitesse"); LSTR MSG_BED_Z = _UxGT("Lit Z"); diff --git a/Marlin/src/lcd/language/language_gl.h b/Marlin/src/lcd/language/language_gl.h index 9ae64f0809..005c6cc5d0 100644 --- a/Marlin/src/lcd/language/language_gl.h +++ b/Marlin/src/lcd/language/language_gl.h @@ -231,6 +231,7 @@ namespace Language_gl { LSTR MSG_MOVE_01MM = _UxGT("Mover 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Mover 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Mover 10mm"); + LSTR MSG_MOVE_50MM = _UxGT("Mover 50mm"); LSTR MSG_MOVE_100MM = _UxGT("Mover 100mm"); LSTR MSG_SPEED = _UxGT("Velocidade"); LSTR MSG_BED_Z = _UxGT("Cama Z"); diff --git a/Marlin/src/lcd/language/language_hr.h b/Marlin/src/lcd/language/language_hr.h index 08ff6cc38c..7ca0f5405a 100644 --- a/Marlin/src/lcd/language/language_hr.h +++ b/Marlin/src/lcd/language/language_hr.h @@ -86,6 +86,7 @@ namespace Language_hr { LSTR MSG_MOVE_01MM = _UxGT("Miči 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Miči 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Miči 10mm"); + LSTR MSG_MOVE_50MM = _UxGT("Miči 50mm"); LSTR MSG_MOVE_100MM = _UxGT("Miči 100mm"); LSTR MSG_SPEED = _UxGT("Brzina"); LSTR MSG_BED_Z = _UxGT("Bed Z"); diff --git a/Marlin/src/lcd/language/language_hu.h b/Marlin/src/lcd/language/language_hu.h index eebcb759e5..09fb71876f 100644 --- a/Marlin/src/lcd/language/language_hu.h +++ b/Marlin/src/lcd/language/language_hu.h @@ -264,10 +264,12 @@ namespace Language_hu { LSTR MSG_MOVE_01MM = _UxGT("Mozgás 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Mozgás 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Mozgás 10mm"); + LSTR MSG_MOVE_50MM = _UxGT("Mozgás 50mm"); LSTR MSG_MOVE_100MM = _UxGT("Mozgás 100mm"); LSTR MSG_MOVE_0001IN = _UxGT("Mozgás 0.025mm"); LSTR MSG_MOVE_001IN = _UxGT("Mozgás 0.254mm"); LSTR MSG_MOVE_01IN = _UxGT("Mozgás 2.54mm"); + LSTR MSG_MOVE_05IN = _UxGT("Mozgás 12.7mm"); LSTR MSG_MOVE_1IN = _UxGT("Mozgáá 25.4mm"); LSTR MSG_SPEED = _UxGT("Sebesség"); LSTR MSG_BED_Z = _UxGT("Z ágy"); diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index 1fcf07dbc7..def1b98343 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -313,10 +313,12 @@ namespace Language_it { LSTR MSG_MOVE_01MM = _UxGT("Muovi di 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Muovi di 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Muovi di 10mm"); + LSTR MSG_MOVE_50MM = _UxGT("Muovi di 50mm"); LSTR MSG_MOVE_100MM = _UxGT("Muovi di 100mm"); LSTR MSG_MOVE_0001IN = _UxGT("Muovi di 0.001\""); LSTR MSG_MOVE_001IN = _UxGT("Muovi di 0.01\""); LSTR MSG_MOVE_01IN = _UxGT("Muovi di 0.1\""); + LSTR MSG_MOVE_05IN = _UxGT("Muovi di 0.5\""); LSTR MSG_MOVE_1IN = _UxGT("Muovi di 1\""); LSTR MSG_SPEED = _UxGT("Velocità"); LSTR MSG_BED_Z = _UxGT("Piatto Z"); diff --git a/Marlin/src/lcd/language/language_jp_kana.h b/Marlin/src/lcd/language/language_jp_kana.h index bc8c9ba40e..2f75b88759 100644 --- a/Marlin/src/lcd/language/language_jp_kana.h +++ b/Marlin/src/lcd/language/language_jp_kana.h @@ -99,6 +99,7 @@ namespace Language_jp_kana { LSTR MSG_MOVE_01MM = _UxGT("0.1mm イドウ"); // "Move 0.1mm" LSTR MSG_MOVE_1MM = _UxGT(" 1mm イドウ"); // "Move 1mm" LSTR MSG_MOVE_10MM = _UxGT(" 10mm イドウ"); // "Move 10mm" + LSTR MSG_MOVE_50MM = _UxGT(" 50mm イドウ"); // "Move 50mm" LSTR MSG_MOVE_100MM = _UxGT(" 100mm イドウ"); // "Move 100mm" LSTR MSG_SPEED = _UxGT("ソクド"); // "Speed" LSTR MSG_BED_Z = _UxGT("Zオフセット"); // "Bed Z" diff --git a/Marlin/src/lcd/language/language_zh_TW.h b/Marlin/src/lcd/language/language_zh_TW.h index 4eba832c4f..2aa3554fe8 100644 --- a/Marlin/src/lcd/language/language_zh_TW.h +++ b/Marlin/src/lcd/language/language_zh_TW.h @@ -226,6 +226,7 @@ namespace Language_zh_TW { LSTR MSG_MOVE_01MM = _UxGT("移動 0.1 mm"); // "Move 0.1mm" LSTR MSG_MOVE_1MM = _UxGT("移動 1 mm"); // "Move 1mm" LSTR MSG_MOVE_10MM = _UxGT("移動 10 mm"); // "Move 10mm" + LSTR MSG_MOVE_50MM = _UxGT("移動 50 mm"); // "Move 50mm" LSTR MSG_MOVE_100MM = _UxGT("移動 100 mm"); // "Move 100mm" LSTR MSG_SPEED = _UxGT("速率"); // "Speed" LSTR MSG_BED_Z = _UxGT("熱床Z"); // "Bed Z" diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index 3c2917cb71..4d8cc71553 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -28,7 +28,13 @@ #if HAS_MARLINUI_MENU -#define LARGE_AREA_TEST ((X_BED_SIZE) >= 1000 || TERN0(HAS_Y_AXIS, (Y_BED_SIZE) >= 1000) || TERN0(HAS_Z_AXIS, (Z_MAX_POS) >= 1000)) +#if ENABLED(TRULY_LARGE_AREA) + #define LARGE_AREA_TEST true +#elif ENABLED(SLIM_LCD_MENUS) + #define LARGE_AREA_TEST false +#else + #define LARGE_AREA_TEST ((X_BED_SIZE) >= 1000 || TERN0(HAS_Y_AXIS, (Y_BED_SIZE) >= 1000) || TERN0(HAS_Z_AXIS, (Z_MAX_POS) >= 1000)) +#endif #include "menu_item.h" #include "menu_addon.h" @@ -150,13 +156,19 @@ void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int BACK_ITEM(MSG_MOVE_AXIS); if (parser.using_inch_units()) { - if (LARGE_AREA_TEST) SUBMENU(MSG_MOVE_1IN, []{ _goto_manual_move(IN_TO_MM(1.000f)); }); + if (LARGE_AREA_TEST) { + SUBMENU(MSG_MOVE_1IN, []{ _goto_manual_move(IN_TO_MM(1.000f)); }); + SUBMENU(MSG_MOVE_05IN, []{ _goto_manual_move(IN_TO_MM(0.500f)); }); + } SUBMENU(MSG_MOVE_01IN, []{ _goto_manual_move(IN_TO_MM(0.100f)); }); SUBMENU(MSG_MOVE_001IN, []{ _goto_manual_move(IN_TO_MM(0.010f)); }); SUBMENU(MSG_MOVE_0001IN, []{ _goto_manual_move(IN_TO_MM(0.001f)); }); } else { - if (LARGE_AREA_TEST) SUBMENU(MSG_MOVE_100MM, []{ _goto_manual_move(100); }); + if (LARGE_AREA_TEST) { + SUBMENU(MSG_MOVE_100MM, []{ _goto_manual_move(100); }); + SUBMENU(MSG_MOVE_50MM, []{ _goto_manual_move(50); }); + } SUBMENU(MSG_MOVE_10MM, []{ _goto_manual_move(10); }); SUBMENU(MSG_MOVE_1MM, []{ _goto_manual_move( 1); }); SUBMENU(MSG_MOVE_01MM, []{ _goto_manual_move( 0.1f); }); @@ -356,6 +368,13 @@ void menu_motion() { GCODES_ITEM(MSG_MANUAL_STOW, F("M402")); #endif + // + // Probe Offset Wizard + // + #if ENABLED(PROBE_OFFSET_WIZARD) + SUBMENU(MSG_PROBE_WIZARD, goto_probe_offset_wizard); + #endif + // // Assisted Bed Tramming // diff --git a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V2.h b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V2.h index 13e912d970..d70e935f0a 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V2.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V2.h @@ -53,11 +53,11 @@ // //#define WIFI_SERIAL 1// USART1 #if ENABLED(MKS_WIFI_MODULE) - #define WIFI_IO0_PIN PB14 // MKS ESP WIFI IO0 PIN - #define WIFI_IO1_PIN PB15 // MKS ESP WIFI IO1 PIN - #define WIFI_RESET_PIN PD14 // MKS ESP WIFI RESET PIN + #define WIFI_IO0_PIN PB14 // MKS ESP WIFI IO0 PIN + #define WIFI_IO1_PIN PB15 // MKS ESP WIFI IO1 PIN + #define WIFI_RESET_PIN PD14 // MKS ESP WIFI RESET PIN #endif -#define NEOPIXEL_PIN PC5 +#define NEOPIXEL_PIN PC5 #include "pins_MKS_MONSTER8_common.h" From a13f3cb8892d68a423b956249bc35f2f5e7d19f3 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sun, 27 Nov 2022 14:22:08 +1300 Subject: [PATCH 080/109] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20UBL=20menu=20compi?= =?UTF-8?q?le=20(#25020)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/menu/menu_ubl.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Marlin/src/lcd/menu/menu_ubl.cpp b/Marlin/src/lcd/menu/menu_ubl.cpp index f26e5b2984..d6f42faa55 100644 --- a/Marlin/src/lcd/menu/menu_ubl.cpp +++ b/Marlin/src/lcd/menu/menu_ubl.cpp @@ -35,6 +35,9 @@ #include "../../module/planner.h" #include "../../module/settings.h" #include "../../feature/bedlevel/bedlevel.h" +#if HAS_HOTEND + #include "../../module/temperature.h" +#endif static int16_t ubl_storage_slot = 0, custom_hotend_temp = 150, From 909442cb88b5efcc99755a899b7081d0fb766c2f Mon Sep 17 00:00:00 2001 From: Vasily Evseenko Date: Sun, 27 Nov 2022 04:26:40 +0300 Subject: [PATCH 081/109] =?UTF-8?q?=F0=9F=8D=BB=20Fix=20Z=20increase=20on?= =?UTF-8?q?=20toolchange=20without=20UBL=20(#22942)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/bedlevel/bedlevel.cpp | 1 + Marlin/src/module/tool_change.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Marlin/src/feature/bedlevel/bedlevel.cpp b/Marlin/src/feature/bedlevel/bedlevel.cpp index 1658b536d3..03b67745ec 100644 --- a/Marlin/src/feature/bedlevel/bedlevel.cpp +++ b/Marlin/src/feature/bedlevel/bedlevel.cpp @@ -57,6 +57,7 @@ bool leveling_is_valid() { * Enable: Current position = "unleveled" physical position */ void set_bed_leveling_enabled(const bool enable/*=true*/) { + DEBUG_SECTION(log_sble, "set_bed_leveling_enabled", DEBUGGING(LEVELING)); const bool can_change = TERN1(AUTO_BED_LEVELING_BILINEAR, !enable || leveling_is_valid()); diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index a0939d155a..7322098c0b 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -1157,8 +1157,8 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { const uint8_t old_tool = active_extruder; const bool can_move_away = !no_move && !idex_full_control; - #if HAS_LEVELING - // Set current position to the physical position + #if ENABLED(AUTO_BED_LEVELING_UBL) + // Workaround for UBL mesh boundary, possibly? TEMPORARY_BED_LEVELING_STATE(false); #endif From e354e1c48f107db784fc2da3a2e2077aec04a31e Mon Sep 17 00:00:00 2001 From: Radek <46979052+radek8@users.noreply.github.com> Date: Sun, 27 Nov 2022 02:31:44 +0100 Subject: [PATCH 082/109] =?UTF-8?q?=F0=9F=90=9B=20Fix=20SKR=20mini=20E2=20?= =?UTF-8?q?V2=20+=20BTT=5FMINI=5F12864=5FV1=20(#24827)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/bigtreetech/BIGTREETECH-SKR-mini-E3/issues/686#issuecomment-1296545443 --- .../pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h | 43 ++++++++++++----- .../stm32f1/pins_BTT_SKR_MINI_E3_common.h | 48 ++++++++----------- 2 files changed, 50 insertions(+), 41 deletions(-) diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h index b5fddc4d74..c0428279f0 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h @@ -21,7 +21,9 @@ */ #pragma once -#define SKR_MINI_E3_V2 +#ifndef BOARD_INFO_NAME + #define BOARD_INFO_NAME "BTT SKR Mini E3 V2.0" +#endif #define BOARD_CUSTOM_BUILD_FLAGS -DTONE_CHANNEL=4 -DTONE_TIMER=4 -DTIMER_TONE=4 @@ -29,33 +31,50 @@ #if NO_EEPROM_SELECTED #define I2C_EEPROM #define SOFT_I2C_EEPROM - #define MARLIN_EEPROM_SIZE 0x1000 // 4K - #define I2C_SDA_PIN PB7 - #define I2C_SCL_PIN PB6 + #define MARLIN_EEPROM_SIZE 0x1000 // 4K + #define I2C_SDA_PIN PB7 + #define I2C_SCL_PIN PB6 #undef NO_EEPROM_SELECTED #endif -#include "pins_BTT_SKR_MINI_E3_common.h" +#define FAN_PIN PC6 -#ifndef BOARD_INFO_NAME - #define BOARD_INFO_NAME "BTT SKR Mini E3 V2.0" -#endif +// +// USB connect control +// +#define USB_CONNECT_PIN PA14 + +/** + * SKR Mini E3 V2.0 + * ------ + * (BEEPER) PB5 | 1 2 | PA15 (BTN_ENC) + * (BTN_EN1) PA9 | 3 4 | RESET + * (BTN_EN2) PA10 5 6 | PB9 (LCD_D4) + * (LCD_RS) PB8 | 7 8 | PB15 (LCD_EN) + * GND | 9 10 | 5V + * ------ + * EXP1 + */ +#define EXP1_02_PIN PA15 +#define EXP1_08_PIN PB15 + +#include "pins_BTT_SKR_MINI_E3_common.h" // Release PA13/PA14 (led, usb control) from SWD pins #define DISABLE_DEBUG #ifndef NEOPIXEL_PIN - #define NEOPIXEL_PIN PA8 // LED driving pin + #define NEOPIXEL_PIN PA8 // LED driving pin #endif #ifndef PS_ON_PIN - #define PS_ON_PIN PC13 // Power Supply Control + #define PS_ON_PIN PC13 // Power Supply Control #endif -#define FAN1_PIN PC7 +#define FAN1_PIN PC7 #ifndef CONTROLLER_FAN_PIN - #define CONTROLLER_FAN_PIN FAN1_PIN + #define CONTROLLER_FAN_PIN FAN1_PIN #endif #if HAS_TMC_UART diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h index c4a8971265..8ed09417f0 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h @@ -100,38 +100,31 @@ #define HEATER_0_PIN PC8 // "HE" #define HEATER_BED_PIN PC9 // "HB" -#ifdef SKR_MINI_E3_V2 - #define FAN_PIN PC6 -#else +#ifndef FAN_PIN #define FAN_PIN PA8 // "FAN0" #endif // // USB connect control // -#ifdef SKR_MINI_E3_V2 - #define USB_CONNECT_PIN PA14 -#else +#ifndef USB_CONNECT_PIN #define USB_CONNECT_PIN PC13 #endif #define USB_CONNECT_INVERTING false /** - * SKR Mini E3 V1.0, V1.2 SKR Mini E3 V2.0 - * ------ ------ - * (BEEPER) PB5 | 1 2 | PB6 (BTN_ENC) (BEEPER) PB5 | 1 2 | PA15 (BTN_ENC) - * (BTN_EN1) PA9 | 3 4 | RESET (BTN_EN1) PA9 | 3 4 | RESET - * (BTN_EN2) PA10 5 6 | PB9 (LCD_D4) (BTN_EN2) PA10 5 6 | PB9 (LCD_D4) - * (LCD_RS) PB8 | 7 8 | PB7 (LCD_EN) (LCD_RS) PB8 | 7 8 | PB15 (LCD_EN) - * GND | 9 10 | 5V GND | 9 10 | 5V - * ------ ------ - * EXP1 EXP1 + * SKR Mini E3 V1.0, V1.2 + * ------ + * (BEEPER) PB5 | 1 2 | PB6 (BTN_ENC) + * (BTN_EN1) PA9 | 3 4 | RESET + * (BTN_EN2) PA10 5 6 | PB9 (LCD_D4) + * (LCD_RS) PB8 | 7 8 | PB7 (LCD_EN) + * GND | 9 10 | 5V + * ------ + * EXP1 */ -#ifdef SKR_MINI_E3_V2 - #define EXP1_02_PIN PA15 - #define EXP1_08_PIN PB15 -#else +#ifndef EXP1_02_PIN #define EXP1_02_PIN PB6 #define EXP1_08_PIN PB7 #endif @@ -269,8 +262,8 @@ * * --- ------ * RST | 1 | (MISO) |10 9 | SCK - * (RX2) PA2 | 2 | BTN_EN1 | 8 7 | (SS) - * (TX2) PA3 | 3 | BTN_EN2 | 6 5 | MOSI + * (RX2) PA3 | 2 | BTN_EN1 | 8 7 | (SS) + * (TX2) PA2 | 3 | BTN_EN2 | 6 5 | MOSI * GND | 4 | (CD) | 4 3 | (RST) * 5V | 5 | (GND) | 2 1 | (KILL) * --- ------ @@ -285,24 +278,21 @@ * EXP1-8 ----------- EXP2-6 EN2 * EXP1-7 ----------- EXP1-5 RED * EXP1-6 ----------- EXP2-8 EN1 - * EXP1-5 ----------- EXP1-6 LCD_RST - * EXP1-4 ----------- n/c + * EXP1-5 ----------- n/c + * EXP1-4 ----------- EXP1-6 RESET * EXP1-3 ----------- EXP1-8 LCD_CS * EXP1-2 ----------- EXP1-9 ENC * EXP1-1 ----------- EXP1-7 LCD_A0 * - * TFT-2 ----------- EXP2-9 SCK - * TFT-3 ----------- EXP2-5 MOSI + * TFT-2 ----------- EXP2-5 SCK + * TFT-3 ----------- EXP2-9 MOSI * * for backlight configuration see steps 2 (V2.1) and 3 in https://wiki.fysetc.com/Mini12864_Panel/ */ - #define LCD_PINS_RS EXP1_03_PIN // CS - #define LCD_PINS_ENABLE PA3 // MOSI #define LCD_BACKLIGHT_PIN -1 #define NEOPIXEL_PIN EXP1_07_PIN - #define LCD_CONTRAST 255 - #define LCD_RESET_PIN EXP1_05_PIN + #define LCD_CONTRAST 255 #define DOGLCD_CS EXP1_03_PIN #define DOGLCD_A0 EXP1_01_PIN From cc1069a3f00fb4422bf372e409e95849c1c8322e Mon Sep 17 00:00:00 2001 From: Manuel McLure Date: Sat, 26 Nov 2022 18:30:59 -0800 Subject: [PATCH 083/109] =?UTF-8?q?=F0=9F=94=A7=20Merge=20TMC26X=20with=20?= =?UTF-8?q?TMC=20config=20(#24373)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 244 ++++++------------------- Marlin/src/core/drivers.h | 2 + Marlin/src/core/types.h | 2 + Marlin/src/inc/Conditionals_adv.h | 3 +- Marlin/src/inc/SanityCheck.h | 11 ++ Marlin/src/module/stepper/TMC26X.cpp | 2 +- Marlin/src/module/stepper/trinamic.cpp | 2 - 7 files changed, 74 insertions(+), 192 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 9a54b10b82..246664ff2a 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -2669,167 +2669,33 @@ //#define FILAMENT_UNLOAD_ALL_EXTRUDERS // Allow M702 to unload all extruders above a minimum target temp (as set by M302) #endif -/** - * TMC26X Stepper Driver options - * - * The TMC26XStepper library is required for this stepper driver. - * https://github.com/trinamic/TMC26XStepper - * @section tmc/tmc26x - */ -#if HAS_DRIVER(TMC26X) - - #if AXIS_DRIVER_TYPE_X(TMC26X) - #define X_MAX_CURRENT 1000 // (mA) - #define X_SENSE_RESISTOR 91 // (mOhms) - #define X_MICROSTEPS 16 // Number of microsteps - #endif - - #if AXIS_DRIVER_TYPE_X2(TMC26X) - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS X_MICROSTEPS - #endif - - #if AXIS_DRIVER_TYPE_Y(TMC26X) - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 - #endif - - #if AXIS_DRIVER_TYPE_Y2(TMC26X) - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS Y_MICROSTEPS - #endif - - #if AXIS_DRIVER_TYPE_Z(TMC26X) - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 - #endif - - #if AXIS_DRIVER_TYPE_Z2(TMC26X) - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS Z_MICROSTEPS - #endif - - #if AXIS_DRIVER_TYPE_Z3(TMC26X) - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS Z_MICROSTEPS - #endif - - #if AXIS_DRIVER_TYPE_Z4(TMC26X) - #define Z4_MAX_CURRENT 1000 - #define Z4_SENSE_RESISTOR 91 - #define Z4_MICROSTEPS Z_MICROSTEPS - #endif - - #if AXIS_DRIVER_TYPE_I(TMC26X) - #define I_MAX_CURRENT 1000 - #define I_SENSE_RESISTOR 91 - #define I_MICROSTEPS 16 - #endif - - #if AXIS_DRIVER_TYPE_J(TMC26X) - #define J_MAX_CURRENT 1000 - #define J_SENSE_RESISTOR 91 - #define J_MICROSTEPS 16 - #endif - - #if AXIS_DRIVER_TYPE_K(TMC26X) - #define K_MAX_CURRENT 1000 - #define K_SENSE_RESISTOR 91 - #define K_MICROSTEPS 16 - #endif - - #if AXIS_DRIVER_TYPE_U(TMC26X) - #define U_MAX_CURRENT 1000 - #define U_SENSE_RESISTOR 91 - #define U_MICROSTEPS 16 - #endif - - #if AXIS_DRIVER_TYPE_V(TMC26X) - #define V_MAX_CURRENT 1000 - #define V_SENSE_RESISTOR 91 - #define V_MICROSTEPS 16 - #endif - - #if AXIS_DRIVER_TYPE_W(TMC26X) - #define W_MAX_CURRENT 1000 - #define W_SENSE_RESISTOR 91 - #define W_MICROSTEPS 16 - #endif - - #if AXIS_DRIVER_TYPE_E0(TMC26X) - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 - #endif - - #if AXIS_DRIVER_TYPE_E1(TMC26X) - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS E0_MICROSTEPS - #endif - - #if AXIS_DRIVER_TYPE_E2(TMC26X) - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS E0_MICROSTEPS - #endif - - #if AXIS_DRIVER_TYPE_E3(TMC26X) - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS E0_MICROSTEPS - #endif - - #if AXIS_DRIVER_TYPE_E4(TMC26X) - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS E0_MICROSTEPS - #endif - - #if AXIS_DRIVER_TYPE_E5(TMC26X) - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS E0_MICROSTEPS - #endif - - #if AXIS_DRIVER_TYPE_E6(TMC26X) - #define E6_MAX_CURRENT 1000 - #define E6_SENSE_RESISTOR 91 - #define E6_MICROSTEPS E0_MICROSTEPS - #endif - - #if AXIS_DRIVER_TYPE_E7(TMC26X) - #define E7_MAX_CURRENT 1000 - #define E7_SENSE_RESISTOR 91 - #define E7_MICROSTEPS E0_MICROSTEPS - #endif - -#endif // TMC26X +// @section tmc_smart /** - * To use TMC2130, TMC2160, TMC2660, TMC5130, TMC5160 stepper drivers in SPI mode - * connect your SPI pins to the hardware SPI interface on your board and define - * the required CS pins in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 - * pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.). - * You may also use software SPI if you wish to use general purpose IO pins. + * Trinamic Smart Drivers * - * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN - * to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without - * a resistor. - * The drivers can also be used with hardware serial. + * To use TMC2130, TMC2160, TMC2660, TMC5130, TMC5160 stepper drivers in SPI mode: + * - Connect your SPI pins to the Hardware SPI interface on the board. + * Some boards have simple jumper connections! See your board's documentation. + * - Define the required Stepper CS pins in your `pins_MYBOARD.h` file. + * (See the RAMPS pins, for example.) + * - You can also use Software SPI with GPIO pins instead of Hardware SPI. + * + * To use TMC220x stepper drivers with Serial UART: + * - Connect PDN_UART to the #_SERIAL_TX_PIN through a 1K resistor. + * For reading capabilities also connect PDN_UART to #_SERIAL_RX_PIN with no resistor. + * Some boards have simple jumper connections! See your board's documentation. + * - These drivers can also be used with Hardware Serial. + * + * The TMC26XStepper library is required for TMC26X stepper drivers. + * https://github.com/MarlinFirmware/TMC26XStepper + * + * The TMCStepper library is required for other TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper * - * TMCStepper library is required to use TMC stepper drivers. - * https://github.com/teemuatlut/TMCStepper * @section tmc/config */ -#if HAS_TRINAMIC_CONFIG +#if HAS_TRINAMIC_CONFIG || HAS_TMC26X #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current @@ -2839,17 +2705,17 @@ */ #define INTERPOLATE true - #if AXIS_IS_TMC(X) + #if AXIS_IS_TMC_CONFIG(X) #define X_CURRENT 800 // (mA) RMS current. Multiply by 1.414 for peak current. #define X_CURRENT_HOME X_CURRENT // (mA) RMS current for sensorless homing #define X_MICROSTEPS 16 // 0..256 - #define X_RSENSE 0.11 + #define X_RSENSE 0.11 // Multiplied x1000 for TMC26X #define X_CHAIN_POS -1 // -1..0: Not chained. 1: MCU MOSI connected. 2: Next in chain, ... //#define X_INTERPOLATE true // Enable to override 'INTERPOLATE' for the X axis //#define X_HOLD_MULTIPLIER 0.5 // Enable to override 'HOLD_MULTIPLIER' for the X axis #endif - #if AXIS_IS_TMC(X2) + #if AXIS_IS_TMC_CONFIG(X2) #define X2_CURRENT 800 #define X2_CURRENT_HOME X2_CURRENT #define X2_MICROSTEPS X_MICROSTEPS @@ -2859,7 +2725,7 @@ //#define X2_HOLD_MULTIPLIER 0.5 #endif - #if AXIS_IS_TMC(Y) + #if AXIS_IS_TMC_CONFIG(Y) #define Y_CURRENT 800 #define Y_CURRENT_HOME Y_CURRENT #define Y_MICROSTEPS 16 @@ -2869,7 +2735,7 @@ //#define Y_HOLD_MULTIPLIER 0.5 #endif - #if AXIS_IS_TMC(Y2) + #if AXIS_IS_TMC_CONFIG(Y2) #define Y2_CURRENT 800 #define Y2_CURRENT_HOME Y2_CURRENT #define Y2_MICROSTEPS Y_MICROSTEPS @@ -2879,7 +2745,7 @@ //#define Y2_HOLD_MULTIPLIER 0.5 #endif - #if AXIS_IS_TMC(Z) + #if AXIS_IS_TMC_CONFIG(Z) #define Z_CURRENT 800 #define Z_CURRENT_HOME Z_CURRENT #define Z_MICROSTEPS 16 @@ -2889,7 +2755,7 @@ //#define Z_HOLD_MULTIPLIER 0.5 #endif - #if AXIS_IS_TMC(Z2) + #if AXIS_IS_TMC_CONFIG(Z2) #define Z2_CURRENT 800 #define Z2_CURRENT_HOME Z2_CURRENT #define Z2_MICROSTEPS Z_MICROSTEPS @@ -2899,7 +2765,7 @@ //#define Z2_HOLD_MULTIPLIER 0.5 #endif - #if AXIS_IS_TMC(Z3) + #if AXIS_IS_TMC_CONFIG(Z3) #define Z3_CURRENT 800 #define Z3_CURRENT_HOME Z3_CURRENT #define Z3_MICROSTEPS Z_MICROSTEPS @@ -2909,7 +2775,7 @@ //#define Z3_HOLD_MULTIPLIER 0.5 #endif - #if AXIS_IS_TMC(Z4) + #if AXIS_IS_TMC_CONFIG(Z4) #define Z4_CURRENT 800 #define Z4_CURRENT_HOME Z4_CURRENT #define Z4_MICROSTEPS Z_MICROSTEPS @@ -2919,7 +2785,7 @@ //#define Z4_HOLD_MULTIPLIER 0.5 #endif - #if AXIS_IS_TMC(I) + #if AXIS_IS_TMC_CONFIG(I) #define I_CURRENT 800 #define I_CURRENT_HOME I_CURRENT #define I_MICROSTEPS 16 @@ -2929,7 +2795,7 @@ //#define I_HOLD_MULTIPLIER 0.5 #endif - #if AXIS_IS_TMC(J) + #if AXIS_IS_TMC_CONFIG(J) #define J_CURRENT 800 #define J_CURRENT_HOME J_CURRENT #define J_MICROSTEPS 16 @@ -2939,7 +2805,7 @@ //#define J_HOLD_MULTIPLIER 0.5 #endif - #if AXIS_IS_TMC(K) + #if AXIS_IS_TMC_CONFIG(K) #define K_CURRENT 800 #define K_CURRENT_HOME K_CURRENT #define K_MICROSTEPS 16 @@ -2949,7 +2815,7 @@ //#define K_HOLD_MULTIPLIER 0.5 #endif - #if AXIS_IS_TMC(U) + #if AXIS_IS_TMC_CONFIG(U) #define U_CURRENT 800 #define U_CURRENT_HOME U_CURRENT #define U_MICROSTEPS 8 @@ -2959,7 +2825,7 @@ //#define U_HOLD_MULTIPLIER 0.5 #endif - #if AXIS_IS_TMC(V) + #if AXIS_IS_TMC_CONFIG(V) #define V_CURRENT 800 #define V_CURRENT_HOME V_CURRENT #define V_MICROSTEPS 8 @@ -2969,7 +2835,7 @@ //#define V_HOLD_MULTIPLIER 0.5 #endif - #if AXIS_IS_TMC(W) + #if AXIS_IS_TMC_CONFIG(W) #define W_CURRENT 800 #define W_CURRENT_HOME W_CURRENT #define W_MICROSTEPS 8 @@ -2979,7 +2845,7 @@ //#define W_HOLD_MULTIPLIER 0.5 #endif - #if AXIS_IS_TMC(E0) + #if AXIS_IS_TMC_CONFIG(E0) #define E0_CURRENT 800 #define E0_MICROSTEPS 16 #define E0_RSENSE 0.11 @@ -2988,7 +2854,7 @@ //#define E0_HOLD_MULTIPLIER 0.5 #endif - #if AXIS_IS_TMC(E1) + #if AXIS_IS_TMC_CONFIG(E1) #define E1_CURRENT 800 #define E1_MICROSTEPS E0_MICROSTEPS #define E1_RSENSE 0.11 @@ -2997,7 +2863,7 @@ //#define E1_HOLD_MULTIPLIER 0.5 #endif - #if AXIS_IS_TMC(E2) + #if AXIS_IS_TMC_CONFIG(E2) #define E2_CURRENT 800 #define E2_MICROSTEPS E0_MICROSTEPS #define E2_RSENSE 0.11 @@ -3006,7 +2872,7 @@ //#define E2_HOLD_MULTIPLIER 0.5 #endif - #if AXIS_IS_TMC(E3) + #if AXIS_IS_TMC_CONFIG(E3) #define E3_CURRENT 800 #define E3_MICROSTEPS E0_MICROSTEPS #define E3_RSENSE 0.11 @@ -3015,7 +2881,7 @@ //#define E3_HOLD_MULTIPLIER 0.5 #endif - #if AXIS_IS_TMC(E4) + #if AXIS_IS_TMC_CONFIG(E4) #define E4_CURRENT 800 #define E4_MICROSTEPS E0_MICROSTEPS #define E4_RSENSE 0.11 @@ -3024,7 +2890,7 @@ //#define E4_HOLD_MULTIPLIER 0.5 #endif - #if AXIS_IS_TMC(E5) + #if AXIS_IS_TMC_CONFIG(E5) #define E5_CURRENT 800 #define E5_MICROSTEPS E0_MICROSTEPS #define E5_RSENSE 0.11 @@ -3033,7 +2899,7 @@ //#define E5_HOLD_MULTIPLIER 0.5 #endif - #if AXIS_IS_TMC(E6) + #if AXIS_IS_TMC_CONFIG(E6) #define E6_CURRENT 800 #define E6_MICROSTEPS E0_MICROSTEPS #define E6_RSENSE 0.11 @@ -3042,7 +2908,7 @@ //#define E6_HOLD_MULTIPLIER 0.5 #endif - #if AXIS_IS_TMC(E7) + #if AXIS_IS_TMC_CONFIG(E7) #define E7_CURRENT 800 #define E7_MICROSTEPS E0_MICROSTEPS #define E7_RSENSE 0.11 @@ -3144,15 +3010,17 @@ * Use Trinamic's ultra quiet stepping mode. * When disabled, Marlin will use spreadCycle stepping mode. */ - #define STEALTHCHOP_XY - #define STEALTHCHOP_Z - #define STEALTHCHOP_I - #define STEALTHCHOP_J - #define STEALTHCHOP_K - #define STEALTHCHOP_U - #define STEALTHCHOP_V - #define STEALTHCHOP_W - #define STEALTHCHOP_E + #if HAS_STEALTHCHOP + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_I + #define STEALTHCHOP_J + #define STEALTHCHOP_K + #define STEALTHCHOP_U + #define STEALTHCHOP_V + #define STEALTHCHOP_W + #define STEALTHCHOP_E + #endif /** * Optimize spreadCycle chopper parameters by using predefined parameter sets @@ -3335,7 +3203,7 @@ */ #define TMC_ADV() { } -#endif // HAS_TRINAMIC_CONFIG +#endif // HAS_TRINAMIC_CONFIG || HAS_TMC26X // @section i2cbus diff --git a/Marlin/src/core/drivers.h b/Marlin/src/core/drivers.h index 8cf03d342a..72a7d1f4b7 100644 --- a/Marlin/src/core/drivers.h +++ b/Marlin/src/core/drivers.h @@ -125,6 +125,8 @@ || AXIS_DRIVER_TYPE(A,TMC2660) \ || AXIS_DRIVER_TYPE(A,TMC5130) || AXIS_DRIVER_TYPE(A,TMC5160) ) +#define AXIS_IS_TMC_CONFIG(A) ( AXIS_IS_TMC(A) || AXIS_DRIVER_TYPE(A,TMC26X) ) + // Test for a driver that uses SPI - this allows checking whether a _CS_ pin // is considered sensitive #define AXIS_HAS_SPI(A) ( AXIS_DRIVER_TYPE(A,TMC2130) || AXIS_DRIVER_TYPE(A,TMC2160) \ diff --git a/Marlin/src/core/types.h b/Marlin/src/core/types.h index 4497ff49af..0281dea08c 100644 --- a/Marlin/src/core/types.h +++ b/Marlin/src/core/types.h @@ -36,6 +36,8 @@ struct IF { typedef R type; }; template struct IF { typedef L type; }; +#define ALL_AXIS_NAMES X, X2, Y, Y2, Z, Z2, Z3, Z4, I, J, K, U, V, W, E0, E1, E2, E3, E4, E5, E6, E7 + #define NUM_AXIS_GANG(V...) GANG_N(NUM_AXES, V) #define NUM_AXIS_CODE(V...) CODE_N(NUM_AXES, V) #define NUM_AXIS_LIST(V...) LIST_N(NUM_AXES, V) diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index dd69e61c92..d1b7a342d6 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -994,8 +994,8 @@ #undef CALIBRATION_MEASURE_IMIN #undef CALIBRATION_MEASURE_IMAX #if NUM_AXES < 3 - #undef Z_IDLE_HEIGHT #undef STEALTHCHOP_Z + #undef Z_IDLE_HEIGHT #undef Z_PROBE_SLED #undef Z_SAFE_HOMING #undef HOME_Z_FIRST @@ -1005,6 +1005,7 @@ #undef CNC_WORKSPACE_PLANES #if NUM_AXES < 2 #undef STEALTHCHOP_Y + #undef QUICK_HOME #endif #endif #endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 2d8c7ca1c6..685411c20b 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -681,6 +681,17 @@ constexpr float arm[] = AXIS_RELATIVE_MODES; static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _LOGICAL_AXES_STR "elements."); +// Consolidate TMC26X, validate migration (#24373) +#define _ISMAX_1(A) defined(A##_MAX_CURRENT) +#define _ISSNS_1(A) defined(A##_SENSE_RESISTOR) +#if DO(ISMAX,||,ALL_AXIS_NAMES) + #error "*_MAX_CURRENT is now set with *_CURRENT." +#elif DO(ISSNS,||,ALL_AXIS_NAMES) + #error "*_SENSE_RESISTOR (in Milli-Ohms) is now set with *_RSENSE (in Ohms), so you must divide values by 1000." +#endif +#undef _ISMAX_1 +#undef _ISSNS_1 + /** * Probe temp compensation requirements */ diff --git a/Marlin/src/module/stepper/TMC26X.cpp b/Marlin/src/module/stepper/TMC26X.cpp index 52d84f8410..f46163ea2d 100644 --- a/Marlin/src/module/stepper/TMC26X.cpp +++ b/Marlin/src/module/stepper/TMC26X.cpp @@ -34,7 +34,7 @@ #include "TMC26X.h" -#define _TMC26X_DEFINE(ST) TMC26XStepper stepper##ST(200, ST##_CS_PIN, ST##_STEP_PIN, ST##_DIR_PIN, ST##_MAX_CURRENT, ST##_SENSE_RESISTOR) +#define _TMC26X_DEFINE(ST) TMC26XStepper stepper##ST(200, ST##_CS_PIN, ST##_STEP_PIN, ST##_DIR_PIN, ST##_CURRENT, int(ST##_RSENSE * 1000)) #if AXIS_DRIVER_TYPE_X(TMC26X) _TMC26X_DEFINE(X); diff --git a/Marlin/src/module/stepper/trinamic.cpp b/Marlin/src/module/stepper/trinamic.cpp index bf36f83cd8..48ce020d3d 100644 --- a/Marlin/src/module/stepper/trinamic.cpp +++ b/Marlin/src/module/stepper/trinamic.cpp @@ -1023,8 +1023,6 @@ void reset_trinamic_drivers() { // 2. For each axis in use, static_assert using a constexpr function, which counts the // number of matching/conflicting axis. If the value is not exactly 1, fail. -#define ALL_AXIS_NAMES X, X2, Y, Y2, Z, Z2, Z3, Z4, I, J, K, U, V, W, E0, E1, E2, E3, E4, E5, E6, E7 - #if ANY_AXIS_HAS(HW_SERIAL) // Hardware serial names are compared as strings, since actually resolving them cannot occur in a constexpr. // Using a fixed-length character array for the port name allows this to be constexpr compatible. From 60931719d898d435cc63b6c7baa5d301c289717c Mon Sep 17 00:00:00 2001 From: Marcio T Date: Sat, 26 Nov 2022 20:11:14 -0700 Subject: [PATCH 084/109] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20ADVANCE=5FK=20+=20?= =?UTF-8?q?DISTINCT=5FE=5FFACTORS=20sanity=20check=20(#25007)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/SanityCheck.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 685411c20b..766b69fcb9 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1353,7 +1353,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #if ENABLED(LIN_ADVANCE) #if DISTINCT_E > 1 constexpr float lak[] = ADVANCE_K; - static_assert(COUNT(lak) < DISTINCT_E, "The ADVANCE_K array has too many elements (i.e., more than " STRINGIFY(DISTINCT_E) ")."); + static_assert(COUNT(lak) <= DISTINCT_E, "The ADVANCE_K array has too many elements (i.e., more than " STRINGIFY(DISTINCT_E) ")."); #define _LIN_ASSERT(N) static_assert(N >= COUNT(lak) || WITHIN(lak[N], 0, 10), "ADVANCE_K values must be from 0 to 10 (Changed in LIN_ADVANCE v1.5, Marlin 1.1.9)."); REPEAT(DISTINCT_E, _LIN_ASSERT) #undef _LIN_ASSERT From 84ae7d5f729d66af9c11066bc789d9cafe61e36f Mon Sep 17 00:00:00 2001 From: studiodyne <42887851+studiodyne@users.noreply.github.com> Date: Sun, 27 Nov 2022 04:29:13 +0100 Subject: [PATCH 085/109] =?UTF-8?q?=F0=9F=90=9B=20Fix=20MILLISECONDS=5FPRE?= =?UTF-8?q?HEAT=5FTIME=20/=20mintemp=20(#24967)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/SanityCheck.h | 4 ++-- Marlin/src/module/temperature.cpp | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 766b69fcb9..b2e4dc9de0 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2330,8 +2330,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #endif #if MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED < 5 #error "Thermistor 66 requires MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED ≥ 5." - #elif MILLISECONDS_PREHEAT_TIME < 30000 - #error "Thermistor 66 requires MILLISECONDS_PREHEAT_TIME ≥ 30000." + #elif MILLISECONDS_PREHEAT_TIME < 15000 + #error "Thermistor 66 requires MILLISECONDS_PREHEAT_TIME ≥ 15000, but 30000 or higher is recommended." #endif #undef _BAD_MINTEMP #endif diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 8742cf36df..fb3953841b 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -2406,8 +2406,15 @@ void Temperature::updateTemperaturesFromRawValues() { if ((neg && r < temp_range[e].raw_max) || (pos && r > temp_range[e].raw_max)) max_temp_error((heater_id_t)e); + /** + // DEBUG PREHEATING TIME + SERIAL_ECHOLNPGM("\nExtruder = ", e, " Preheat On/Off = ", is_preheating(e)); + const float test_is_preheating = (preheat_end_time[HOTEND_INDEX] - millis()) * 0.001f; + if (test_is_preheating < 31) SERIAL_ECHOLNPGM("Extruder = ", e, " Preheat remaining time = ", test_is_preheating, "s", "\n"); + //*/ + const bool heater_on = temp_hotend[e].target > 0; - if (heater_on && ((neg && r > temp_range[e].raw_min) || (pos && r < temp_range[e].raw_min))) { + if (heater_on && !is_preheating(e) && ((neg && r > temp_range[e].raw_min) || (pos && r < temp_range[e].raw_min))) { if (TERN1(MULTI_MAX_CONSECUTIVE_LOW_TEMP_ERR, ++consecutive_low_temperature_error[e] >= MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED)) min_temp_error((heater_id_t)e); } From 463f35e0f20ddcf265b46e20f61b10b57104aae0 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Mon, 28 Nov 2022 00:21:21 +0000 Subject: [PATCH 086/109] [cron] Bump distribution date (2022-11-28) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 4f1ea59776..96d2569478 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-11-27" +//#define STRING_DISTRIBUTION_DATE "2022-11-28" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index fed821c193..f287a8541d 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-11-27" + #define STRING_DISTRIBUTION_DATE "2022-11-28" #endif /** From d4d1112ae8bb65d8b7c9f74d1a8586b893e57b1d Mon Sep 17 00:00:00 2001 From: Trivalik <3148279+trivalik@users.noreply.github.com> Date: Mon, 28 Nov 2022 02:06:44 +0100 Subject: [PATCH 087/109] =?UTF-8?q?=F0=9F=90=9B=20Fix=20missing=20va=5Fend?= =?UTF-8?q?=20in=20UnwPrintf=20(#25027)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/shared/backtrace/unwarm.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Marlin/src/HAL/shared/backtrace/unwarm.cpp b/Marlin/src/HAL/shared/backtrace/unwarm.cpp index adbcca69cc..e72a02e487 100644 --- a/Marlin/src/HAL/shared/backtrace/unwarm.cpp +++ b/Marlin/src/HAL/shared/backtrace/unwarm.cpp @@ -33,8 +33,9 @@ void UnwPrintf(const char *format, ...) { va_list args; - va_start( args, format ); - vprintf(format, args ); + va_start(args, format); + vprintf(format, args); + va_end(args); } #endif From 89334caa526f2d300eee834d34d06d8f837a57d5 Mon Sep 17 00:00:00 2001 From: tombrazier <68918209+tombrazier@users.noreply.github.com> Date: Mon, 28 Nov 2022 03:38:15 +0000 Subject: [PATCH 088/109] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Input=20Shaping=20?= =?UTF-8?q?improvements=20(#24951)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 31 +- .../src/gcode/feature/input_shaping/M593.cpp | 21 +- Marlin/src/gcode/gcode.cpp | 2 +- Marlin/src/gcode/gcode.h | 4 +- Marlin/src/inc/Conditionals_adv.h | 18 +- Marlin/src/inc/SanityCheck.h | 14 +- Marlin/src/lcd/language/language_en.h | 8 +- Marlin/src/lcd/menu/menu_advanced.cpp | 34 +- Marlin/src/module/planner.cpp | 15 +- Marlin/src/module/planner.h | 6 +- Marlin/src/module/settings.cpp | 22 +- Marlin/src/module/stepper.cpp | 392 ++++++++++-------- Marlin/src/module/stepper.h | 262 +++++++----- buildroot/tests/mega2560 | 4 +- ini/features.ini | 2 +- 15 files changed, 468 insertions(+), 367 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 246664ff2a..c168240e24 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1062,12 +1062,14 @@ * * Zero Vibration (ZV) Input Shaping for X and/or Y movements. * - * This option uses a lot of SRAM for the step buffer, which is proportional - * to the largest step rate possible for any axis. If the build fails due to + * This option uses a lot of SRAM for the step buffer, which is related to the + * largest step rate possible for the shaped axes. If the build fails due to * low SRAM the buffer size may be reduced by setting smaller values for - * DEFAULT_AXIS_STEPS_PER_UNIT and/or DEFAULT_MAX_FEEDRATE. Runtime editing - * of max feedrate (M203) or resonant frequency (M593) may result feedrate - * being capped to prevent buffer overruns. + * DEFAULT_AXIS_STEPS_PER_UNIT and/or DEFAULT_MAX_FEEDRATE. Disabling + * ADAPTIVE_STEP_SMOOTHING and reducing the step rate for non-shaped axes may + * also reduce the buffer sizes. Runtime editing of max feedrate (M203) or + * resonant frequency (M593) may result in input shaping losing effectiveness + * during high speed movements to prevent buffer overruns. * * Tune with M593 D F: * @@ -1077,13 +1079,18 @@ * X<1> Set the given parameters only for the X axis. * Y<1> Set the given parameters only for the Y axis. */ -//#define INPUT_SHAPING -#if ENABLED(INPUT_SHAPING) - #define SHAPING_FREQ_X 40 // (Hz) The dominant resonant frequency of the X axis. - #define SHAPING_FREQ_Y 40 // (Hz) The dominant resonant frequency of the Y axis. - #define SHAPING_ZETA_X 0.3f // Damping ratio of the X axis (range: 0.0 = no damping to 1.0 = critical damping). - #define SHAPING_ZETA_Y 0.3f // Damping ratio of the Y axis (range: 0.0 = no damping to 1.0 = critical damping). - //#define SHAPING_MENU // Add a menu to the LCD to set shaping parameters. +//#define INPUT_SHAPING_X +//#define INPUT_SHAPING_Y +#if EITHER(INPUT_SHAPING_X, INPUT_SHAPING_Y) + #if ENABLED(INPUT_SHAPING_X) + #define SHAPING_FREQ_X 40 // (Hz) The default dominant resonant frequency on the X axis. + #define SHAPING_ZETA_X 0.15f // Damping ratio of the X axis (range: 0.0 = no damping to 1.0 = critical damping). + #endif + #if ENABLED(INPUT_SHAPING_Y) + #define SHAPING_FREQ_Y 40 // (Hz) The default dominant resonant frequency on the Y axis. + #define SHAPING_ZETA_Y 0.15f // Damping ratio of the Y axis (range: 0.0 = no damping to 1.0 = critical damping). + #endif + //#define SHAPING_MENU // Add a menu to the LCD to set shaping parameters. #endif #define AXIS_RELATIVE_MODES { false, false, false, false } diff --git a/Marlin/src/gcode/feature/input_shaping/M593.cpp b/Marlin/src/gcode/feature/input_shaping/M593.cpp index e1e99ca51b..040710f3e5 100644 --- a/Marlin/src/gcode/feature/input_shaping/M593.cpp +++ b/Marlin/src/gcode/feature/input_shaping/M593.cpp @@ -22,21 +22,21 @@ #include "../../../inc/MarlinConfig.h" -#if ENABLED(INPUT_SHAPING) +#if HAS_SHAPING #include "../../gcode.h" #include "../../../module/stepper.h" void GcodeSuite::M593_report(const bool forReplay/*=true*/) { report_heading_etc(forReplay, F("Input Shaping")); - #if HAS_SHAPING_X + #if ENABLED(INPUT_SHAPING_X) SERIAL_ECHOLNPGM(" M593 X" " F", stepper.get_shaping_frequency(X_AXIS), " D", stepper.get_shaping_damping_ratio(X_AXIS) ); #endif - #if HAS_SHAPING_Y - TERN_(HAS_SHAPING_X, report_echo_start(forReplay)); + #if ENABLED(INPUT_SHAPING_Y) + TERN_(INPUT_SHAPING_X, report_echo_start(forReplay)); SERIAL_ECHOLNPGM(" M593 Y" " F", stepper.get_shaping_frequency(Y_AXIS), " D", stepper.get_shaping_damping_ratio(Y_AXIS) @@ -55,10 +55,10 @@ void GcodeSuite::M593_report(const bool forReplay/*=true*/) { void GcodeSuite::M593() { if (!parser.seen_any()) return M593_report(); - const bool seen_X = TERN0(HAS_SHAPING_X, parser.seen_test('X')), - seen_Y = TERN0(HAS_SHAPING_Y, parser.seen_test('Y')), - for_X = seen_X || TERN0(HAS_SHAPING_X, (!seen_X && !seen_Y)), - for_Y = seen_Y || TERN0(HAS_SHAPING_Y, (!seen_X && !seen_Y)); + const bool seen_X = TERN0(INPUT_SHAPING_X, parser.seen_test('X')), + seen_Y = TERN0(INPUT_SHAPING_Y, parser.seen_test('Y')), + for_X = seen_X || TERN0(INPUT_SHAPING_X, (!seen_X && !seen_Y)), + for_Y = seen_Y || TERN0(INPUT_SHAPING_Y, (!seen_X && !seen_Y)); if (parser.seen('D')) { const float zeta = parser.value_float(); @@ -72,12 +72,13 @@ void GcodeSuite::M593() { if (parser.seen('F')) { const float freq = parser.value_float(); - if (freq > 0) { + constexpr float max_freq = float(uint32_t(STEPPER_TIMER_RATE) / 2) / shaping_time_t(-2); + if (freq == 0.0f || freq > max_freq) { if (for_X) stepper.set_shaping_frequency(X_AXIS, freq); if (for_Y) stepper.set_shaping_frequency(Y_AXIS, freq); } else - SERIAL_ECHO_MSG("?Frequency (F) must be greater than 0"); + SERIAL_ECHOLNPGM("?Frequency (F) must be greater than ", max_freq, " or 0 to disable"); } } diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index ff066ed678..bb859d8026 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -933,7 +933,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 575: M575(); break; // M575: Set serial baudrate #endif - #if ENABLED(INPUT_SHAPING) + #if HAS_SHAPING case 593: M593(); break; // M593: Set Input Shaping parameters #endif diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 0ce8ab3902..5d56e53dd5 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -259,7 +259,7 @@ * M554 - Get or set IP gateway. (Requires enabled Ethernet port) * M569 - Enable stealthChop on an axis. (Requires at least one _DRIVER_TYPE to be TMC2130/2160/2208/2209/5130/5160) * M575 - Change the serial baud rate. (Requires BAUD_RATE_GCODE) - * M593 - Get or set input shaping parameters. (Requires INPUT_SHAPING) + * M593 - Get or set input shaping parameters. (Requires INPUT_SHAPING_[XY]) * M600 - Pause for filament change: "M600 X Y Z E L". (Requires ADVANCED_PAUSE_FEATURE) * M603 - Configure filament change: "M603 T U L". (Requires ADVANCED_PAUSE_FEATURE) * M605 - Set Dual X-Carriage movement mode: "M605 S [X] [R]". (Requires DUAL_X_CARRIAGE) @@ -1081,7 +1081,7 @@ private: static void M575(); #endif - #if ENABLED(INPUT_SHAPING) + #if HAS_SHAPING static void M593(); static void M593_report(const bool forReplay=true); #endif diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index d1b7a342d6..367f7f2324 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -1120,15 +1120,11 @@ #endif // Input shaping -#if ENABLED(INPUT_SHAPING) - #if !HAS_Y_AXIS - #undef SHAPING_FREQ_Y - #undef SHAPING_BUFFER_Y - #endif - #ifdef SHAPING_FREQ_X - #define HAS_SHAPING_X 1 - #endif - #ifdef SHAPING_FREQ_Y - #define HAS_SHAPING_Y 1 - #endif +#if !HAS_Y_AXIS + #undef INPUT_SHAPING_Y + #undef SHAPING_FREQ_Y + #undef SHAPING_BUFFER_Y +#endif +#if EITHER(INPUT_SHAPING_X, INPUT_SHAPING_Y) + #define HAS_SHAPING 1 #endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index b2e4dc9de0..42f1409739 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -4271,14 +4271,14 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive."); #endif // Check requirements for Input Shaping -#if ENABLED(INPUT_SHAPING) && defined(__AVR__) - #if HAS_SHAPING_X +#if HAS_SHAPING && defined(__AVR__) + #if ENABLED(INPUT_SHAPING_X) #if F_CPU > 16000000 static_assert((SHAPING_FREQ_X) * 2 * 0x10000 >= (STEPPER_TIMER_RATE), "SHAPING_FREQ_X is below the minimum (20) for AVR 20MHz."); #else static_assert((SHAPING_FREQ_X) * 2 * 0x10000 >= (STEPPER_TIMER_RATE), "SHAPING_FREQ_X is below the minimum (16) for AVR 16MHz."); #endif - #elif HAS_SHAPING_Y + #elif ENABLED(INPUT_SHAPING_Y) #if F_CPU > 16000000 static_assert((SHAPING_FREQ_Y) * 2 * 0x10000 >= (STEPPER_TIMER_RATE), "SHAPING_FREQ_Y is below the minimum (20) for AVR 20MHz."); #else @@ -4287,12 +4287,8 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive."); #endif #endif -#if ENABLED(INPUT_SHAPING) - #if ENABLED(DIRECT_STEPPING) - #error "INPUT_SHAPING cannot currently be used with DIRECT_STEPPING." - #elif ENABLED(LASER_FEATURE) - #error "INPUT_SHAPING cannot currently be used with LASER_FEATURE." - #endif +#if BOTH(HAS_SHAPING, DIRECT_STEPPING) + #error "INPUT_SHAPING_[XY] cannot currently be used with DIRECT_STEPPING." #endif // Misc. Cleanup diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 2ecf2def12..45861a8252 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -403,10 +403,10 @@ namespace Language_en { LSTR MSG_A_RETRACT = _UxGT("Retract Accel"); LSTR MSG_A_TRAVEL = _UxGT("Travel Accel"); LSTR MSG_INPUT_SHAPING = _UxGT("Input Shaping"); - LSTR MSG_SHAPING_X_FREQ = STR_X _UxGT(" frequency"); - LSTR MSG_SHAPING_Y_FREQ = STR_Y _UxGT(" frequency"); - LSTR MSG_SHAPING_X_ZETA = STR_X _UxGT(" damping"); - LSTR MSG_SHAPING_Y_ZETA = STR_Y _UxGT(" damping"); + LSTR MSG_SHAPING_ENABLE = _UxGT("Enable @ shaping"); + LSTR MSG_SHAPING_DISABLE = _UxGT("Disable @ shaping"); + LSTR MSG_SHAPING_FREQ = _UxGT("@ frequency"); + LSTR MSG_SHAPING_ZETA = _UxGT("@ damping"); LSTR MSG_XY_FREQUENCY_LIMIT = _UxGT("XY Freq Limit"); LSTR MSG_XY_FREQUENCY_FEEDRATE = _UxGT("Min FR Factor"); LSTR MSG_STEPS_PER_MM = _UxGT("Steps/mm"); diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 9d6d79efd7..875e74e8bb 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -545,24 +545,28 @@ void menu_backlash(); START_MENU(); BACK_ITEM(MSG_ADVANCED_SETTINGS); - // M593 F Frequency - #if HAS_SHAPING_X + // M593 F Frequency and D Damping ratio + #if ENABLED(INPUT_SHAPING_X) editable.decimal = stepper.get_shaping_frequency(X_AXIS); - EDIT_ITEM_FAST(float61, MSG_SHAPING_X_FREQ, &editable.decimal, min_frequency, 200.0f, []{ stepper.set_shaping_frequency(X_AXIS, editable.decimal); }); + if (editable.decimal) { + ACTION_ITEM_N(X_AXIS, MSG_SHAPING_DISABLE, []{ stepper.set_shaping_frequency(X_AXIS, 0.0f); }); + EDIT_ITEM_FAST_N(float61, X_AXIS, MSG_SHAPING_FREQ, &editable.decimal, min_frequency, 200.0f, []{ stepper.set_shaping_frequency(X_AXIS, editable.decimal); }); + editable.decimal = stepper.get_shaping_damping_ratio(X_AXIS); + EDIT_ITEM_FAST_N(float42_52, X_AXIS, MSG_SHAPING_ZETA, &editable.decimal, 0.0f, 1.0f, []{ stepper.set_shaping_damping_ratio(X_AXIS, editable.decimal); }); + } + else + ACTION_ITEM_N(X_AXIS, MSG_SHAPING_ENABLE, []{ stepper.set_shaping_frequency(X_AXIS, SHAPING_FREQ_X); }); #endif - #if HAS_SHAPING_Y + #if ENABLED(INPUT_SHAPING_Y) editable.decimal = stepper.get_shaping_frequency(Y_AXIS); - EDIT_ITEM_FAST(float61, MSG_SHAPING_Y_FREQ, &editable.decimal, min_frequency, 200.0f, []{ stepper.set_shaping_frequency(Y_AXIS, editable.decimal); }); - #endif - - // M593 D Damping ratio - #if HAS_SHAPING_X - editable.decimal = stepper.get_shaping_damping_ratio(X_AXIS); - EDIT_ITEM_FAST(float42_52, MSG_SHAPING_X_ZETA, &editable.decimal, 0.0f, 1.0f, []{ stepper.set_shaping_damping_ratio(X_AXIS, editable.decimal); }); - #endif - #if HAS_SHAPING_Y - editable.decimal = stepper.get_shaping_damping_ratio(Y_AXIS); - EDIT_ITEM_FAST(float42_52, MSG_SHAPING_Y_ZETA, &editable.decimal, 0.0f, 1.0f, []{ stepper.set_shaping_damping_ratio(Y_AXIS, editable.decimal); }); + if (editable.decimal) { + ACTION_ITEM_N(Y_AXIS, MSG_SHAPING_DISABLE, []{ stepper.set_shaping_frequency(Y_AXIS, 0.0f); }); + EDIT_ITEM_FAST_N(float61, Y_AXIS, MSG_SHAPING_FREQ, &editable.decimal, min_frequency, 200.0f, []{ stepper.set_shaping_frequency(Y_AXIS, editable.decimal); }); + editable.decimal = stepper.get_shaping_damping_ratio(Y_AXIS); + EDIT_ITEM_FAST_N(float42_52, Y_AXIS, MSG_SHAPING_ZETA, &editable.decimal, 0.0f, 1.0f, []{ stepper.set_shaping_damping_ratio(Y_AXIS, editable.decimal); }); + } + else + ACTION_ITEM_N(Y_AXIS, MSG_SHAPING_ENABLE, []{ stepper.set_shaping_frequency(Y_AXIS, SHAPING_FREQ_Y); }); #endif END_MENU(); diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 0128d90f0f..ed85045098 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1724,6 +1724,13 @@ float Planner::triggered_position_mm(const AxisEnum axis) { return result * mm_per_step[axis]; } +bool Planner::busy() { + return (has_blocks_queued() || cleaning_buffer_counter + || TERN0(EXTERNAL_CLOSED_LOOP_CONTROLLER, CLOSED_LOOP_WAITING()) + || TERN0(HAS_SHAPING, stepper.input_shaping_busy()) + ); +} + void Planner::finish_and_disable() { while (has_blocks_queued() || cleaning_buffer_counter) idle(); stepper.disable_all_steppers(); @@ -2483,14 +2490,6 @@ bool Planner::_populate_block( #endif // XY_FREQUENCY_LIMIT - #if ENABLED(INPUT_SHAPING) - const float top_freq = _MIN(float(0x7FFFFFFFL) - OPTARG(HAS_SHAPING_X, stepper.get_shaping_frequency(X_AXIS)) - OPTARG(HAS_SHAPING_Y, stepper.get_shaping_frequency(Y_AXIS))), - max_factor = (top_freq * float(shaping_dividends - 3) * 2.0f) / block->nominal_rate; - NOMORE(speed_factor, max_factor); - #endif - // Correct the speed if (speed_factor < 1.0f) { current_speed *= speed_factor; diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index 32b5a8795b..dcfdb1c28e 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -930,11 +930,7 @@ class Planner { static float triggered_position_mm(const AxisEnum axis); // Blocks are queued, or we're running out moves, or the closed loop controller is waiting - static bool busy() { - return (has_blocks_queued() || cleaning_buffer_counter - || TERN0(EXTERNAL_CLOSED_LOOP_CONTROLLER, CLOSED_LOOP_WAITING()) - ); - } + static bool busy(); // Block until all buffered steps are executed / cleaned static void synchronize(); diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 921b0d91cb..4ae4c19922 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -580,11 +580,11 @@ typedef struct SettingsDataStruct { // // Input Shaping // - #if HAS_SHAPING_X + #if ENABLED(INPUT_SHAPING_X) float shaping_x_frequency, // M593 X F shaping_x_zeta; // M593 X D #endif - #if HAS_SHAPING_Y + #if ENABLED(INPUT_SHAPING_Y) float shaping_y_frequency, // M593 Y F shaping_y_zeta; // M593 Y D #endif @@ -1617,12 +1617,12 @@ void MarlinSettings::postprocess() { // // Input Shaping /// - #if ENABLED(INPUT_SHAPING) - #if HAS_SHAPING_X + #if HAS_SHAPING + #if ENABLED(INPUT_SHAPING_X) EEPROM_WRITE(stepper.get_shaping_frequency(X_AXIS)); EEPROM_WRITE(stepper.get_shaping_damping_ratio(X_AXIS)); #endif - #if HAS_SHAPING_Y + #if ENABLED(INPUT_SHAPING_Y) EEPROM_WRITE(stepper.get_shaping_frequency(Y_AXIS)); EEPROM_WRITE(stepper.get_shaping_damping_ratio(Y_AXIS)); #endif @@ -2602,7 +2602,7 @@ void MarlinSettings::postprocess() { // // Input Shaping // - #if HAS_SHAPING_X + #if ENABLED(INPUT_SHAPING_X) { float _data[2]; EEPROM_READ(_data); @@ -2611,7 +2611,7 @@ void MarlinSettings::postprocess() { } #endif - #if HAS_SHAPING_Y + #if ENABLED(INPUT_SHAPING_Y) { float _data[2]; EEPROM_READ(_data); @@ -3389,12 +3389,12 @@ void MarlinSettings::reset() { // // Input Shaping // - #if ENABLED(INPUT_SHAPING) - #if HAS_SHAPING_X + #if HAS_SHAPING + #if ENABLED(INPUT_SHAPING_X) stepper.set_shaping_frequency(X_AXIS, SHAPING_FREQ_X); stepper.set_shaping_damping_ratio(X_AXIS, SHAPING_ZETA_X); #endif - #if HAS_SHAPING_Y + #if ENABLED(INPUT_SHAPING_Y) stepper.set_shaping_frequency(Y_AXIS, SHAPING_FREQ_Y); stepper.set_shaping_damping_ratio(Y_AXIS, SHAPING_ZETA_Y); #endif @@ -3650,7 +3650,7 @@ void MarlinSettings::reset() { // // Input Shaping // - TERN_(INPUT_SHAPING, gcode.M593_report(forReplay)); + TERN_(HAS_SHAPING, gcode.M593_report(forReplay)); // // Linear Advance diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 6cc40ccece..74e761dc64 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -232,17 +232,25 @@ uint32_t Stepper::advance_divisor = 0, Stepper::la_advance_steps = 0; #endif -#if ENABLED(INPUT_SHAPING) - shaping_time_t DelayTimeManager::now = 0; - ParamDelayQueue Stepper::shaping_dividend_queue; - DelayQueue Stepper::shaping_queue; - #if HAS_SHAPING_X - shaping_time_t DelayTimeManager::delay_x; - ShapeParams Stepper::shaping_x; +#if HAS_SHAPING + shaping_time_t ShapingQueue::now = 0; + shaping_time_t ShapingQueue::times[shaping_echoes]; + shaping_echo_axis_t ShapingQueue::echo_axes[shaping_echoes]; + uint16_t ShapingQueue::tail = 0; + + #if ENABLED(INPUT_SHAPING_X) + shaping_time_t ShapingQueue::delay_x; + shaping_time_t ShapingQueue::peek_x_val = shaping_time_t(-1); + uint16_t ShapingQueue::head_x = 0; + uint16_t ShapingQueue::_free_count_x = shaping_echoes - 1; + ShapeParams Stepper::shaping_x; #endif - #if HAS_SHAPING_Y - shaping_time_t DelayTimeManager::delay_y; - ShapeParams Stepper::shaping_y; + #if ENABLED(INPUT_SHAPING_Y) + shaping_time_t ShapingQueue::delay_y; + shaping_time_t ShapingQueue::peek_y_val = shaping_time_t(-1); + uint16_t ShapingQueue::head_y = 0; + uint16_t ShapingQueue::_free_count_y = shaping_echoes - 1; + ShapeParams Stepper::shaping_y; #endif #endif @@ -1479,20 +1487,10 @@ void Stepper::isr() { // Enable ISRs to reduce USART processing latency hal.isr_on(); - #if ENABLED(INPUT_SHAPING) - // Speed limiting should ensure the buffers never get full. But if somehow they do, stutter rather than overflow. - if (!nextMainISR) { - TERN_(HAS_SHAPING_X, if (shaping_dividend_queue.free_count_x() == 0) nextMainISR = shaping_dividend_queue.peek_x() + 1); - TERN_(HAS_SHAPING_Y, if (shaping_dividend_queue.free_count_y() == 0) NOLESS(nextMainISR, shaping_dividend_queue.peek_y() + 1)); - TERN_(HAS_SHAPING_X, if (shaping_queue.free_count_x() < steps_per_isr) NOLESS(nextMainISR, shaping_queue.peek_x() + 1)); - TERN_(HAS_SHAPING_Y, if (shaping_queue.free_count_y() < steps_per_isr) NOLESS(nextMainISR, shaping_queue.peek_y() + 1)); - } - #endif + TERN_(HAS_SHAPING, shaping_isr()); // Do Shaper stepping, if needed if (!nextMainISR) pulse_phase_isr(); // 0 = Do coordinated axes Stepper pulses - TERN_(INPUT_SHAPING, shaping_isr()); // Do Shaper stepping, if needed - #if ENABLED(LIN_ADVANCE) if (!nextAdvanceISR) { // 0 = Do Linear Advance E Stepper pulses advance_isr(); @@ -1523,10 +1521,8 @@ void Stepper::isr() { const uint32_t interval = _MIN( uint32_t(HAL_TIMER_TYPE_MAX), // Come back in a very long time nextMainISR // Time until the next Pulse / Block phase - OPTARG(HAS_SHAPING_X, shaping_dividend_queue.peek_x()) // Time until next input shaping dividend change for X - OPTARG(HAS_SHAPING_Y, shaping_dividend_queue.peek_y()) // Time until next input shaping dividend change for Y - OPTARG(HAS_SHAPING_X, shaping_queue.peek_x()) // Time until next input shaping echo for X - OPTARG(HAS_SHAPING_Y, shaping_queue.peek_y()) // Time until next input shaping echo for Y + OPTARG(INPUT_SHAPING_X, ShapingQueue::peek_x()) // Time until next input shaping echo for X + OPTARG(INPUT_SHAPING_Y, ShapingQueue::peek_y()) // Time until next input shaping echo for Y OPTARG(LIN_ADVANCE, nextAdvanceISR) // Come back early for Linear Advance? OPTARG(INTEGRATED_BABYSTEPPING, nextBabystepISR) // Come back early for Babystepping? ); @@ -1539,16 +1535,9 @@ void Stepper::isr() { // nextMainISR -= interval; - - TERN_(INPUT_SHAPING, DelayTimeManager::decrement_delays(interval)); - - #if ENABLED(LIN_ADVANCE) - if (nextAdvanceISR != LA_ADV_NEVER) nextAdvanceISR -= interval; - #endif - - #if ENABLED(INTEGRATED_BABYSTEPPING) - if (nextBabystepISR != BABYSTEP_NEVER) nextBabystepISR -= interval; - #endif + TERN_(HAS_SHAPING, ShapingQueue::decrement_delays(interval)); + TERN_(LIN_ADVANCE, if (nextAdvanceISR != LA_ADV_NEVER) nextAdvanceISR -= interval); + TERN_(INTEGRATED_BABYSTEPPING, if (nextBabystepISR != BABYSTEP_NEVER) nextBabystepISR -= interval); /** * This needs to avoid a race-condition caused by interleaving @@ -1636,11 +1625,16 @@ void Stepper::pulse_phase_isr() { abort_current_block = false; if (current_block) { discard_current_block(); - #if ENABLED(INPUT_SHAPING) - shaping_dividend_queue.purge(); - shaping_queue.purge(); - TERN_(HAS_SHAPING_X, delta_error.x = 0); - TERN_(HAS_SHAPING_Y, delta_error.y = 0); + #if HAS_SHAPING + ShapingQueue::purge(); + #if ENABLED(INPUT_SHAPING_X) + shaping_x.delta_error = 0; + shaping_x.last_block_end_pos = count_position.x; + #endif + #if ENABLED(INPUT_SHAPING_Y) + shaping_y.delta_error = 0; + shaping_y.last_block_end_pos = count_position.y; + #endif #endif } } @@ -1676,31 +1670,48 @@ void Stepper::pulse_phase_isr() { #define PULSE_PREP(AXIS) do{ \ delta_error[_AXIS(AXIS)] += advance_dividend[_AXIS(AXIS)]; \ step_needed[_AXIS(AXIS)] = (delta_error[_AXIS(AXIS)] >= 0); \ - if (step_needed[_AXIS(AXIS)]) { \ - count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \ + if (step_needed[_AXIS(AXIS)]) \ delta_error[_AXIS(AXIS)] -= advance_divisor; \ - } \ }while(0) - #define PULSE_PREP_SHAPING(AXIS, DIVIDEND) do{ \ - delta_error[_AXIS(AXIS)] += (DIVIDEND); \ - if ((MAXDIR(AXIS) && delta_error[_AXIS(AXIS)] <= -0x30000000L) || (MINDIR(AXIS) && delta_error[_AXIS(AXIS)] >= 0x30000000L)) { \ - TBI(last_direction_bits, _AXIS(AXIS)); \ - DIR_WAIT_BEFORE(); \ - SET_STEP_DIR(AXIS); \ - DIR_WAIT_AFTER(); \ - } \ - step_needed[_AXIS(AXIS)] = (MAXDIR(AXIS) && delta_error[_AXIS(AXIS)] >= 0x10000000L) || \ - (MINDIR(AXIS) && delta_error[_AXIS(AXIS)] <= -0x10000000L); \ + // With input shaping, direction changes can happen with almost only + // AWAIT_LOW_PULSE() and DIR_WAIT_BEFORE() between steps. To work around + // the TMC2208 / TMC2225 shutdown bug (#16076), add a half step hysteresis + // in each direction. This results in the position being off by half an + // average half step during travel but correct at the end of each segment. + #if AXIS_DRIVER_TYPE_X(TMC2208) || AXIS_DRIVER_TYPE_X(TMC2208_STANDALONE) + #define HYSTERESIS_X 64 + #else + #define HYSTERESIS_X 0 + #endif + #if AXIS_DRIVER_TYPE_Y(TMC2208) || AXIS_DRIVER_TYPE_Y(TMC2208_STANDALONE) + #define HYSTERESIS_Y 64 + #else + #define HYSTERESIS_Y 0 + #endif + #define _HYSTERESIS(AXIS) HYSTERESIS_##AXIS + #define HYSTERESIS(AXIS) _HYSTERESIS(AXIS) + + #define PULSE_PREP_SHAPING(AXIS, DELTA_ERROR, DIVIDEND) do{ \ if (step_needed[_AXIS(AXIS)]) { \ - count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \ - delta_error[_AXIS(AXIS)] += MAXDIR(AXIS) ? -0x20000000L : 0x20000000L; \ + DELTA_ERROR += (DIVIDEND); \ + if ((MAXDIR(AXIS) && DELTA_ERROR <= -(64 + HYSTERESIS(AXIS))) || (MINDIR(AXIS) && DELTA_ERROR >= (64 + HYSTERESIS(AXIS)))) { \ + { USING_TIMED_PULSE(); START_TIMED_PULSE(); AWAIT_LOW_PULSE(); } \ + TBI(last_direction_bits, _AXIS(AXIS)); \ + DIR_WAIT_BEFORE(); \ + SET_STEP_DIR(AXIS); \ + DIR_WAIT_AFTER(); \ + } \ + step_needed[_AXIS(AXIS)] = DELTA_ERROR <= -(64 + HYSTERESIS(AXIS)) || DELTA_ERROR >= (64 + HYSTERESIS(AXIS)); \ + if (step_needed[_AXIS(AXIS)]) \ + DELTA_ERROR += MAXDIR(AXIS) ? -128 : 128; \ } \ }while(0) // Start an active pulse if needed #define PULSE_START(AXIS) do{ \ if (step_needed[_AXIS(AXIS)]) { \ + count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \ _APPLY_STEP(AXIS, !_INVERT_STEP_PIN(AXIS), 0); \ } \ }while(0) @@ -1819,22 +1830,12 @@ void Stepper::pulse_phase_isr() { #endif // DIRECT_STEPPING if (!is_page) { - TERN_(INPUT_SHAPING, shaping_queue.enqueue()); - // Determine if pulses are needed #if HAS_X_STEP - #if HAS_SHAPING_X - PULSE_PREP_SHAPING(X, advance_dividend.x); - #else - PULSE_PREP(X); - #endif + PULSE_PREP(X); #endif #if HAS_Y_STEP - #if HAS_SHAPING_Y - PULSE_PREP_SHAPING(Y, advance_dividend.y); - #else - PULSE_PREP(Y); - #endif + PULSE_PREP(Y); #endif #if HAS_Z_STEP PULSE_PREP(Z); @@ -1871,6 +1872,24 @@ void Stepper::pulse_phase_isr() { } #endif #endif + + #if HAS_SHAPING + // record an echo if a step is needed in the primary bresenham + const bool x_step = TERN0(INPUT_SHAPING_X, shaping_x.enabled && step_needed[X_AXIS]), + y_step = TERN0(INPUT_SHAPING_Y, shaping_y.enabled && step_needed[Y_AXIS]); + if (x_step || y_step) + ShapingQueue::enqueue(x_step, TERN0(INPUT_SHAPING_X, shaping_x.forward), y_step, TERN0(INPUT_SHAPING_Y, shaping_y.forward)); + + // do the first part of the secondary bresenham + #if ENABLED(INPUT_SHAPING_X) + if (shaping_x.enabled) + PULSE_PREP_SHAPING(X, shaping_x.delta_error, shaping_x.factor1 * (shaping_x.forward ? 1 : -1)); + #endif + #if ENABLED(INPUT_SHAPING_Y) + if (shaping_y.enabled) + PULSE_PREP_SHAPING(Y, shaping_y.delta_error, shaping_y.factor1 * (shaping_y.forward ? 1 : -1)); + #endif + #endif } #if ISR_MULTI_STEPS @@ -1910,7 +1929,10 @@ void Stepper::pulse_phase_isr() { #endif #if ENABLED(MIXING_EXTRUDER) - if (step_needed.e) E_STEP_WRITE(mixer.get_next_stepper(), !INVERT_E_STEP_PIN); + if (step_needed.e) { + count_position[E_AXIS] += count_direction[E_AXIS]; + E_STEP_WRITE(mixer.get_next_stepper(), !INVERT_E_STEP_PIN); + } #elif HAS_E0_STEP PULSE_START(E); #endif @@ -1965,55 +1987,59 @@ void Stepper::pulse_phase_isr() { } while (--events_to_do); } -#if ENABLED(INPUT_SHAPING) +#if HAS_SHAPING void Stepper::shaping_isr() { - xyze_bool_t step_needed{0}; + xy_bool_t step_needed{0}; - const bool shapex = TERN0(HAS_SHAPING_X, !shaping_queue.peek_x()), - shapey = TERN0(HAS_SHAPING_Y, !shaping_queue.peek_y()); + // Clear the echoes that are ready to process. If the buffers are too full and risk overflo, also apply echoes early. + TERN_(INPUT_SHAPING_X, step_needed[X_AXIS] = !ShapingQueue::peek_x() || ShapingQueue::free_count_x() < steps_per_isr); + TERN_(INPUT_SHAPING_Y, step_needed[Y_AXIS] = !ShapingQueue::peek_y() || ShapingQueue::free_count_y() < steps_per_isr); - #if HAS_SHAPING_X - if (!shaping_dividend_queue.peek_x()) shaping_x.dividend = shaping_dividend_queue.dequeue_x(); - #endif - #if HAS_SHAPING_Y - if (!shaping_dividend_queue.peek_y()) shaping_y.dividend = shaping_dividend_queue.dequeue_y(); - #endif + if (bool(step_needed)) while (true) { + #if ENABLED(INPUT_SHAPING_X) + if (step_needed[X_AXIS]) { + const bool forward = ShapingQueue::dequeue_x(); + PULSE_PREP_SHAPING(X, shaping_x.delta_error, shaping_x.factor2 * (forward ? 1 : -1)); + PULSE_START(X); + } + #endif - #if HAS_SHAPING_X - if (shapex) { - shaping_queue.dequeue_x(); - PULSE_PREP_SHAPING(X, shaping_x.dividend); - PULSE_START(X); + #if ENABLED(INPUT_SHAPING_Y) + if (step_needed[Y_AXIS]) { + const bool forward = ShapingQueue::dequeue_y(); + PULSE_PREP_SHAPING(Y, shaping_y.delta_error, shaping_y.factor2 * (forward ? 1 : -1)); + PULSE_START(Y); + } + #endif + + TERN_(I2S_STEPPER_STREAM, i2s_push_sample()); + + USING_TIMED_PULSE(); + if (bool(step_needed)) { + #if ISR_MULTI_STEPS + START_TIMED_PULSE(); + AWAIT_HIGH_PULSE(); + #endif + #if ENABLED(INPUT_SHAPING_X) + PULSE_STOP(X); + #endif + #if ENABLED(INPUT_SHAPING_Y) + PULSE_STOP(Y); + #endif } - #endif - #if HAS_SHAPING_Y - if (shapey) { - shaping_queue.dequeue_y(); - PULSE_PREP_SHAPING(Y, shaping_y.dividend); - PULSE_START(Y); - } - #endif + TERN_(INPUT_SHAPING_X, step_needed[X_AXIS] = !ShapingQueue::peek_x() || ShapingQueue::free_count_x() < steps_per_isr); + TERN_(INPUT_SHAPING_Y, step_needed[Y_AXIS] = !ShapingQueue::peek_y() || ShapingQueue::free_count_y() < steps_per_isr); - TERN_(I2S_STEPPER_STREAM, i2s_push_sample()); + if (!bool(step_needed)) break; - if (shapex || shapey) { - #if ISR_MULTI_STEPS - USING_TIMED_PULSE(); - START_TIMED_PULSE(); - AWAIT_HIGH_PULSE(); - #endif - #if HAS_SHAPING_X - if (shapex) PULSE_STOP(X); - #endif - #if HAS_SHAPING_Y - if (shapey) PULSE_STOP(Y); - #endif + START_TIMED_PULSE(); + AWAIT_LOW_PULSE(); } } -#endif // INPUT_SHAPING +#endif // HAS_SHAPING // Calculate timer interval, with all limits applied. uint32_t Stepper::calc_timer_interval(uint32_t step_rate) { @@ -2462,79 +2488,55 @@ uint32_t Stepper::block_phase_isr() { acceleration_time = deceleration_time = 0; #if ENABLED(ADAPTIVE_STEP_SMOOTHING) - uint8_t oversampling = 0; // Assume no axis smoothing (via oversampling) + oversampling_factor = 0; // Assume no axis smoothing (via oversampling) // Decide if axis smoothing is possible uint32_t max_rate = current_block->nominal_rate; // Get the step event rate while (max_rate < MIN_STEP_ISR_FREQUENCY) { // As long as more ISRs are possible... max_rate <<= 1; // Try to double the rate if (max_rate < MIN_STEP_ISR_FREQUENCY) // Don't exceed the estimated ISR limit - ++oversampling; // Increase the oversampling (used for left-shift) + ++oversampling_factor; // Increase the oversampling (used for left-shift) } - oversampling_factor = oversampling; // For all timer interval calculations - #else - constexpr uint8_t oversampling = 0; #endif // Based on the oversampling factor, do the calculations - step_event_count = current_block->step_event_count << oversampling; + step_event_count = current_block->step_event_count << oversampling_factor; // Initialize Bresenham delta errors to 1/2 - #if HAS_SHAPING_X - const int32_t old_delta_error_x = delta_error.x; - #endif - #if HAS_SHAPING_Y - const int32_t old_delta_error_y = delta_error.y; - #endif delta_error = TERN_(LIN_ADVANCE, la_delta_error =) -int32_t(step_event_count); // Calculate Bresenham dividends and divisors advance_dividend = (current_block->steps << 1).asLong(); advance_divisor = step_event_count << 1; - // for input shaped axes, advance_divisor is replaced with 0x40000000 - // and steps are repeated twice so dividends have to be scaled and halved - // and the dividend is directional, i.e. signed - TERN_(HAS_SHAPING_X, advance_dividend.x = (uint64_t(current_block->steps.x) << 29) / step_event_count); - TERN_(HAS_SHAPING_X, if (TEST(current_block->direction_bits, X_AXIS)) advance_dividend.x *= -1); - TERN_(HAS_SHAPING_X, if (!shaping_queue.empty_x()) SET_BIT_TO(current_block->direction_bits, X_AXIS, TEST(last_direction_bits, X_AXIS))); - TERN_(HAS_SHAPING_Y, advance_dividend.y = (uint64_t(current_block->steps.y) << 29) / step_event_count); - TERN_(HAS_SHAPING_Y, if (TEST(current_block->direction_bits, Y_AXIS)) advance_dividend.y *= -1); - TERN_(HAS_SHAPING_Y, if (!shaping_queue.empty_y()) SET_BIT_TO(current_block->direction_bits, Y_AXIS, TEST(last_direction_bits, Y_AXIS))); + #if ENABLED(INPUT_SHAPING_X) + if (shaping_x.enabled) { + const int64_t steps = TEST(current_block->direction_bits, X_AXIS) ? -int64_t(current_block->steps.x) : int64_t(current_block->steps.x); + shaping_x.last_block_end_pos += steps; - // The scaling operation above introduces rounding errors which must now be removed. - // For this segment, there will be step_event_count calls to the Bresenham logic and the same number of echoes. - // For each pair of calls to the Bresenham logic, delta_error will increase by advance_dividend modulo 0x20000000 - // so (e.g. for x) delta_error.x will end up changing by (advance_dividend.x * step_event_count) % 0x20000000. - // For a divisor which is a power of 2, modulo is the same as as a bitmask, i.e. - // (advance_dividend.x * step_event_count) & 0x1FFFFFFF. - // This segment's final change in delta_error should actually be zero so we need to increase delta_error by - // 0 - ((advance_dividend.x * step_event_count) & 0x1FFFFFFF) - // And this needs to be adjusted to the range -0x10000000 to 0x10000000. - // Adding and subtracting 0x10000000 inside the outside the modulo achieves this. - TERN_(HAS_SHAPING_X, delta_error.x = old_delta_error_x + 0x10000000L - ((0x10000000L + advance_dividend.x * step_event_count) & 0x1FFFFFFFUL)); - TERN_(HAS_SHAPING_Y, delta_error.y = old_delta_error_y + 0x10000000L - ((0x10000000L + advance_dividend.y * step_event_count) & 0x1FFFFFFFUL)); - - // when there is damping, the signal and its echo have different amplitudes - #if ENABLED(HAS_SHAPING_X) - const int32_t echo_x = shaping_x.factor * (advance_dividend.x >> 7); - #endif - #if ENABLED(HAS_SHAPING_Y) - const int32_t echo_y = shaping_y.factor * (advance_dividend.y >> 7); + // If there are any remaining echos unprocessed, then direction change must + // be delayed and processed in PULSE_PREP_SHAPING. This will cause half a step + // to be missed, which will need recovering and this can be done through shaping_x.remainder. + shaping_x.forward = !TEST(current_block->direction_bits, X_AXIS); + if (!ShapingQueue::empty_x()) SET_BIT_TO(current_block->direction_bits, X_AXIS, TEST(last_direction_bits, X_AXIS)); + } #endif - // plan the change of values for advance_dividend for the input shaping echoes - TERN_(INPUT_SHAPING, shaping_dividend_queue.enqueue(TERN0(HAS_SHAPING_X, echo_x), TERN0(HAS_SHAPING_Y, echo_y))); - - // apply the adjustment to the primary signal - TERN_(HAS_SHAPING_X, advance_dividend.x -= echo_x); - TERN_(HAS_SHAPING_Y, advance_dividend.y -= echo_y); + // Y follows the same logic as X (but the comments aren't repeated) + #if ENABLED(INPUT_SHAPING_Y) + if (shaping_y.enabled) { + const int64_t steps = TEST(current_block->direction_bits, Y_AXIS) ? -int64_t(current_block->steps.y) : int64_t(current_block->steps.y); + shaping_y.last_block_end_pos += steps; + shaping_y.forward = !TEST(current_block->direction_bits, Y_AXIS); + if (!ShapingQueue::empty_y()) SET_BIT_TO(current_block->direction_bits, Y_AXIS, TEST(last_direction_bits, Y_AXIS)); + } + #endif // No step events completed so far step_events_completed = 0; // Compute the acceleration and deceleration points - accelerate_until = current_block->accelerate_until << oversampling; - decelerate_after = current_block->decelerate_after << oversampling; + accelerate_until = current_block->accelerate_until << oversampling_factor; + decelerate_after = current_block->decelerate_after << oversampling_factor; TERN_(MIXING_EXTRUDER, mixer.stepper_setup(current_block->b_color)); @@ -2548,7 +2550,7 @@ uint32_t Stepper::block_phase_isr() { #endif if (current_block->la_advance_rate) { // apply LA scaling and discount the effect of frequency scaling - la_dividend = (advance_dividend.e << current_block->la_scaling) << oversampling; + la_dividend = (advance_dividend.e << current_block->la_scaling) << oversampling_factor; } #endif @@ -2974,7 +2976,8 @@ void Stepper::init() { #endif } -#if ENABLED(INPUT_SHAPING) +#if HAS_SHAPING + /** * Calculate a fixed point factor to apply to the signal and its echo * when shaping an axis. @@ -2983,41 +2986,68 @@ void Stepper::init() { // from the damping ratio, get a factor that can be applied to advance_dividend for fixed point maths // for ZV, we use amplitudes 1/(1+K) and K/(1+K) where K = exp(-zeta * M_PI / sqrt(1.0f - zeta * zeta)) // which can be converted to 1:7 fixed point with an excellent fit with a 3rd order polynomial - float shaping_factor; - if (zeta <= 0.0f) shaping_factor = 64.0f; - else if (zeta >= 1.0f) shaping_factor = 0.0f; + float factor2; + if (zeta <= 0.0f) factor2 = 64.0f; + else if (zeta >= 1.0f) factor2 = 0.0f; else { - shaping_factor = 64.44056192 + -99.02008832 * zeta; + factor2 = 64.44056192 + -99.02008832 * zeta; const float zeta2 = zeta * zeta; - shaping_factor += -7.58095488 * zeta2; + factor2 += -7.58095488 * zeta2; const float zeta3 = zeta2 * zeta; - shaping_factor += 43.073216 * zeta3; + factor2 += 43.073216 * zeta3; + factor2 = floor(factor2); } const bool was_on = hal.isr_state(); hal.isr_off(); - TERN_(HAS_SHAPING_X, if (axis == X_AXIS) { shaping_x.factor = floor(shaping_factor); shaping_x.zeta = zeta; }) - TERN_(HAS_SHAPING_Y, if (axis == Y_AXIS) { shaping_y.factor = floor(shaping_factor); shaping_y.zeta = zeta; }) + TERN_(INPUT_SHAPING_X, if (axis == X_AXIS) { shaping_x.factor2 = factor2; shaping_x.factor1 = 128 - factor2; shaping_x.zeta = zeta; }) + TERN_(INPUT_SHAPING_Y, if (axis == Y_AXIS) { shaping_y.factor2 = factor2; shaping_y.factor1 = 128 - factor2; shaping_y.zeta = zeta; }) if (was_on) hal.isr_on(); } float Stepper::get_shaping_damping_ratio(const AxisEnum axis) { - TERN_(HAS_SHAPING_X, if (axis == X_AXIS) return shaping_x.zeta); - TERN_(HAS_SHAPING_Y, if (axis == Y_AXIS) return shaping_y.zeta); + TERN_(INPUT_SHAPING_X, if (axis == X_AXIS) return shaping_x.zeta); + TERN_(INPUT_SHAPING_Y, if (axis == Y_AXIS) return shaping_y.zeta); return -1; } void Stepper::set_shaping_frequency(const AxisEnum axis, const float freq) { - TERN_(HAS_SHAPING_X, if (axis == X_AXIS) { DelayTimeManager::set_delay(axis, float(uint32_t(STEPPER_TIMER_RATE) / 2) / freq); shaping_x.frequency = freq; }) - TERN_(HAS_SHAPING_Y, if (axis == Y_AXIS) { DelayTimeManager::set_delay(axis, float(uint32_t(STEPPER_TIMER_RATE) / 2) / freq); shaping_y.frequency = freq; }) + // enabling or disabling shaping whilst moving can result in lost steps + Planner::synchronize(); + + const bool was_on = hal.isr_state(); + hal.isr_off(); + + const shaping_time_t delay = freq ? float(uint32_t(STEPPER_TIMER_RATE) / 2) / freq : shaping_time_t(-1); + #if ENABLED(INPUT_SHAPING_X) + if (axis == X_AXIS) { + ShapingQueue::set_delay(X_AXIS, delay); + shaping_x.frequency = freq; + shaping_x.enabled = !!freq; + shaping_x.delta_error = 0; + shaping_x.last_block_end_pos = count_position.x; + } + #endif + #if ENABLED(INPUT_SHAPING_Y) + if (axis == Y_AXIS) { + ShapingQueue::set_delay(Y_AXIS, delay); + shaping_y.frequency = freq; + shaping_y.enabled = !!freq; + shaping_y.delta_error = 0; + shaping_y.last_block_end_pos = count_position.y; + } + #endif + + if (was_on) hal.isr_on(); } float Stepper::get_shaping_frequency(const AxisEnum axis) { - TERN_(HAS_SHAPING_X, if (axis == X_AXIS) return shaping_x.frequency); - TERN_(HAS_SHAPING_Y, if (axis == Y_AXIS) return shaping_y.frequency); + TERN_(INPUT_SHAPING_X, if (axis == X_AXIS) return shaping_x.frequency); + TERN_(INPUT_SHAPING_Y, if (axis == Y_AXIS) return shaping_y.frequency); return -1; } -#endif + +#endif // HAS_SHAPING /** * Set the stepper positions directly in steps @@ -3029,6 +3059,13 @@ void Stepper::init() { * derive the current XYZE position later on. */ void Stepper::_set_position(const abce_long_t &spos) { + #if ENABLED(INPUT_SHAPING_X) + const int32_t x_shaping_delta = count_position.x - shaping_x.last_block_end_pos; + #endif + #if ENABLED(INPUT_SHAPING_Y) + const int32_t y_shaping_delta = count_position.y - shaping_y.last_block_end_pos; + #endif + #if ANY(IS_CORE, MARKFORGED_XY, MARKFORGED_YX) #if CORE_IS_XY // corexy positioning @@ -3058,6 +3095,19 @@ void Stepper::_set_position(const abce_long_t &spos) { // default non-h-bot planning count_position = spos; #endif + + #if ENABLED(INPUT_SHAPING_X) + if (shaping_x.enabled) { + count_position.x += x_shaping_delta; + shaping_x.last_block_end_pos = spos.x; + } + #endif + #if ENABLED(INPUT_SHAPING_Y) + if (shaping_y.enabled) { + count_position.y += y_shaping_delta; + shaping_y.last_block_end_pos = spos.y; + } + #endif } /** @@ -3097,6 +3147,8 @@ void Stepper::set_axis_position(const AxisEnum a, const int32_t &v) { #endif count_position[a] = v; + TERN_(INPUT_SHAPING_X, if (a == X_AXIS) shaping_x.last_block_end_pos = v); + TERN_(INPUT_SHAPING_Y, if (a == Y_AXIS) shaping_y.last_block_end_pos = v); #ifdef __AVR__ // Reenable Stepper ISR diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h index 5b634c52e4..f29bb346d1 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -75,8 +75,8 @@ */ #define TIMER_READ_ADD_AND_STORE_CYCLES 34UL - // The base ISR takes 792 cycles - #define ISR_BASE_CYCLES 792UL + // The base ISR + #define ISR_BASE_CYCLES 770UL // Linear advance base time is 64 cycles #if ENABLED(LIN_ADVANCE) @@ -92,21 +92,25 @@ #define ISR_S_CURVE_CYCLES 0UL #endif + // Input shaping base time + #if HAS_SHAPING + #define ISR_SHAPING_BASE_CYCLES 180UL + #else + #define ISR_SHAPING_BASE_CYCLES 0UL + #endif + // Stepper Loop base cycles #define ISR_LOOP_BASE_CYCLES 4UL - // To start the step pulse, in the worst case takes - #define ISR_START_STEPPER_CYCLES 13UL - // And each stepper (start + stop pulse) takes in worst case - #define ISR_STEPPER_CYCLES 16UL + #define ISR_STEPPER_CYCLES 100UL #else // Cycles to perform actions in START_TIMED_PULSE #define TIMER_READ_ADD_AND_STORE_CYCLES 13UL - // The base ISR takes 752 cycles - #define ISR_BASE_CYCLES 752UL + // The base ISR + #define ISR_BASE_CYCLES 1000UL // Linear advance base time is 32 cycles #if ENABLED(LIN_ADVANCE) @@ -122,12 +126,16 @@ #define ISR_S_CURVE_CYCLES 0UL #endif + // Input shaping base time + #if HAS_SHAPING + #define ISR_SHAPING_BASE_CYCLES 290UL + #else + #define ISR_SHAPING_BASE_CYCLES 0UL + #endif + // Stepper Loop base cycles #define ISR_LOOP_BASE_CYCLES 32UL - // To start the step pulse, in the worst case takes - #define ISR_START_STEPPER_CYCLES 57UL - // And each stepper (start + stop pulse) takes in worst case #define ISR_STEPPER_CYCLES 88UL @@ -202,8 +210,12 @@ #error "Expected at least one of MINIMUM_STEPPER_PULSE or MAXIMUM_STEPPER_RATE to be defined" #endif -// But the user could be enforcing a minimum time, so the loop time is -#define ISR_LOOP_CYCLES (ISR_LOOP_BASE_CYCLES + _MAX(MIN_STEPPER_PULSE_CYCLES, MIN_ISR_LOOP_CYCLES)) +// The loop takes the base time plus the time for all the bresenham logic for R pulses plus the time +// between pulses for (R-1) pulses. But the user could be enforcing a minimum time so the loop time is: +#define ISR_LOOP_CYCLES(R) ((ISR_LOOP_BASE_CYCLES + MIN_ISR_LOOP_CYCLES + MIN_STEPPER_PULSE_CYCLES) * (R - 1) + _MAX(MIN_ISR_LOOP_CYCLES, MIN_STEPPER_PULSE_CYCLES)) + +// Model input shaping as an extra loop call +#define ISR_SHAPING_LOOP_CYCLES(R) ((TERN0(HAS_SHAPING, ISR_LOOP_BASE_CYCLES) + TERN0(INPUT_SHAPING_X, ISR_X_STEPPER_CYCLES) + TERN0(INPUT_SHAPING_Y, ISR_Y_STEPPER_CYCLES)) * (R) + (MIN_ISR_LOOP_CYCLES) * (R - 1)) // If linear advance is enabled, then it is handled separately #if ENABLED(LIN_ADVANCE) @@ -228,7 +240,7 @@ #endif // Now estimate the total ISR execution time in cycles given a step per ISR multiplier -#define ISR_EXECUTION_CYCLES(R) (((ISR_BASE_CYCLES + ISR_S_CURVE_CYCLES + (ISR_LOOP_CYCLES) * (R) + ISR_LA_BASE_CYCLES + ISR_LA_LOOP_CYCLES)) / (R)) +#define ISR_EXECUTION_CYCLES(R) (((ISR_BASE_CYCLES + ISR_S_CURVE_CYCLES + ISR_SHAPING_BASE_CYCLES + ISR_LOOP_CYCLES(R) + ISR_SHAPING_LOOP_CYCLES(R) + ISR_LA_BASE_CYCLES + ISR_LA_LOOP_CYCLES)) / (R)) // The maximum allowable stepping frequency when doing x128-x1 stepping (in Hz) #define MAX_STEP_ISR_FREQUENCY_128X ((F_CPU) / ISR_EXECUTION_CYCLES(128)) @@ -312,116 +324,142 @@ constexpr ena_mask_t enable_overlap[] = { //static_assert(!any_enable_overlap(), "There is some overlap."); -#if ENABLED(INPUT_SHAPING) - - typedef IF::type shaping_time_t; +#if HAS_SHAPING // These constexpr are used to calculate the shaping queue buffer sizes constexpr xyze_float_t max_feedrate = DEFAULT_MAX_FEEDRATE; constexpr xyze_float_t steps_per_unit = DEFAULT_AXIS_STEPS_PER_UNIT; - constexpr float max_steprate = _MAX(LOGICAL_AXIS_LIST( - max_feedrate.e * steps_per_unit.e, - max_feedrate.x * steps_per_unit.x, - max_feedrate.y * steps_per_unit.y, - max_feedrate.z * steps_per_unit.z, - max_feedrate.i * steps_per_unit.i, - max_feedrate.j * steps_per_unit.j, - max_feedrate.k * steps_per_unit.k, - max_feedrate.u * steps_per_unit.u, - max_feedrate.v * steps_per_unit.v, - max_feedrate.w * steps_per_unit.w - )); - constexpr uint16_t shaping_dividends = max_steprate / _MIN(0x7FFFFFFFL OPTARG(HAS_SHAPING_X, SHAPING_FREQ_X) OPTARG(HAS_SHAPING_Y, SHAPING_FREQ_Y)) / 2 + 3; - constexpr uint16_t shaping_segments = max_steprate / (MIN_STEPS_PER_SEGMENT) / _MIN(0x7FFFFFFFL OPTARG(HAS_SHAPING_X, SHAPING_FREQ_X) OPTARG(HAS_SHAPING_Y, SHAPING_FREQ_Y)) / 2 + 3; + // MIN_STEP_ISR_FREQUENCY is known at compile time on AVRs and any reduction in SRAM is welcome + #ifdef __AVR__ + constexpr float max_isr_rate = _MAX( + LOGICAL_AXIS_LIST( + max_feedrate.e * steps_per_unit.e, + max_feedrate.x * steps_per_unit.x, + max_feedrate.y * steps_per_unit.y, + max_feedrate.z * steps_per_unit.z, + max_feedrate.i * steps_per_unit.i, + max_feedrate.j * steps_per_unit.j, + max_feedrate.k * steps_per_unit.k, + max_feedrate.u * steps_per_unit.u, + max_feedrate.v * steps_per_unit.v, + max_feedrate.w * steps_per_unit.w + ) + OPTARG(ADAPTIVE_STEP_SMOOTHING, MIN_STEP_ISR_FREQUENCY) + ); + constexpr float max_step_rate = _MIN(max_isr_rate, + TERN0(INPUT_SHAPING_X, max_feedrate.x * steps_per_unit.x) + + TERN0(INPUT_SHAPING_Y, max_feedrate.y * steps_per_unit.y) + ); + #else + constexpr float max_step_rate = TERN0(INPUT_SHAPING_X, max_feedrate.x * steps_per_unit.x) + + TERN0(INPUT_SHAPING_Y, max_feedrate.y * steps_per_unit.y); + #endif + constexpr uint16_t shaping_echoes = max_step_rate / _MIN(0x7FFFFFFFL OPTARG(INPUT_SHAPING_X, SHAPING_FREQ_X) OPTARG(INPUT_SHAPING_Y, SHAPING_FREQ_Y)) / 2 + 3; - class DelayTimeManager { + typedef IF::type shaping_time_t; + enum shaping_echo_t { ECHO_NONE = 0, ECHO_FWD = 1, ECHO_BWD = 2 }; + struct shaping_echo_axis_t { + #if ENABLED(INPUT_SHAPING_X) + shaping_echo_t x:2; + #endif + #if ENABLED(INPUT_SHAPING_Y) + shaping_echo_t y:2; + #endif + }; + + class ShapingQueue { private: - static shaping_time_t now; - #ifdef HAS_SHAPING_X - static shaping_time_t delay_x; + static shaping_time_t now; + static shaping_time_t times[shaping_echoes]; + static shaping_echo_axis_t echo_axes[shaping_echoes]; + static uint16_t tail; + + #if ENABLED(INPUT_SHAPING_X) + static shaping_time_t delay_x; // = shaping_time_t(-1) to disable queueing + static shaping_time_t peek_x_val; + static uint16_t head_x; + static uint16_t _free_count_x; #endif - #ifdef HAS_SHAPING_Y - static shaping_time_t delay_y; + #if ENABLED(INPUT_SHAPING_Y) + static shaping_time_t delay_y; // = shaping_time_t(-1) to disable queueing + static shaping_time_t peek_y_val; + static uint16_t head_y; + static uint16_t _free_count_y; #endif + public: - static void decrement_delays(const shaping_time_t interval) { now += interval; } + static void decrement_delays(const shaping_time_t interval) { + now += interval; + TERN_(INPUT_SHAPING_X, if (peek_x_val != shaping_time_t(-1)) peek_x_val -= interval); + TERN_(INPUT_SHAPING_Y, if (peek_y_val != shaping_time_t(-1)) peek_y_val -= interval); + } static void set_delay(const AxisEnum axis, const shaping_time_t delay) { - TERN_(HAS_SHAPING_X, if (axis == X_AXIS) delay_x = delay); - TERN_(HAS_SHAPING_Y, if (axis == Y_AXIS) delay_y = delay); + TERN_(INPUT_SHAPING_X, if (axis == X_AXIS) delay_x = delay); + TERN_(INPUT_SHAPING_Y, if (axis == Y_AXIS) delay_y = delay); } - }; - - template - class DelayQueue : public DelayTimeManager { - protected: - shaping_time_t times[SIZE]; - uint16_t tail = 0 OPTARG(HAS_SHAPING_X, head_x = 0) OPTARG(HAS_SHAPING_Y, head_y = 0); - - public: - void enqueue() { + static void enqueue(const bool x_step, const bool x_forward, const bool y_step, const bool y_forward) { + TERN_(INPUT_SHAPING_X, if (head_x == tail && x_step) peek_x_val = delay_x); + TERN_(INPUT_SHAPING_Y, if (head_y == tail && y_step) peek_y_val = delay_y); times[tail] = now; - if (++tail == SIZE) tail = 0; + TERN_(INPUT_SHAPING_X, echo_axes[tail].x = x_step ? (x_forward ? ECHO_FWD : ECHO_BWD) : ECHO_NONE); + TERN_(INPUT_SHAPING_Y, echo_axes[tail].y = y_step ? (y_forward ? ECHO_FWD : ECHO_BWD) : ECHO_NONE); + if (++tail == shaping_echoes) tail = 0; + TERN_(INPUT_SHAPING_X, _free_count_x--); + TERN_(INPUT_SHAPING_Y, _free_count_y--); + TERN_(INPUT_SHAPING_X, if (echo_axes[head_x].x == ECHO_NONE) dequeue_x()); + TERN_(INPUT_SHAPING_Y, if (echo_axes[head_y].y == ECHO_NONE) dequeue_y()); } - #ifdef HAS_SHAPING_X - shaping_time_t peek_x() { - if (head_x != tail) return times[head_x] + delay_x - now; - else return shaping_time_t(-1); + #if ENABLED(INPUT_SHAPING_X) + static shaping_time_t peek_x() { return peek_x_val; } + static bool dequeue_x() { + bool forward = echo_axes[head_x].x == ECHO_FWD; + do { + _free_count_x++; + if (++head_x == shaping_echoes) head_x = 0; + } while (head_x != tail && echo_axes[head_x].x == ECHO_NONE); + peek_x_val = head_x == tail ? shaping_time_t(-1) : times[head_x] + delay_x - now; + return forward; } - void dequeue_x() { if (++head_x == SIZE) head_x = 0; } - bool empty_x() { return head_x == tail; } - uint16_t free_count_x() { return head_x > tail ? head_x - tail - 1 : head_x + SIZE - tail - 1; } + static bool empty_x() { return head_x == tail; } + static uint16_t free_count_x() { return _free_count_x; } #endif - #ifdef HAS_SHAPING_Y - shaping_time_t peek_y() { - if (head_y != tail) return times[head_y] + delay_y - now; - else return shaping_time_t(-1); + #if ENABLED(INPUT_SHAPING_Y) + static shaping_time_t peek_y() { return peek_y_val; } + static bool dequeue_y() { + bool forward = echo_axes[head_y].y == ECHO_FWD; + do { + _free_count_y++; + if (++head_y == shaping_echoes) head_y = 0; + } while (head_y != tail && echo_axes[head_y].y == ECHO_NONE); + peek_y_val = head_y == tail ? shaping_time_t(-1) : times[head_y] + delay_y - now; + return forward; } - void dequeue_y() { if (++head_y == SIZE) head_y = 0; } - bool empty_y() { return head_y == tail; } - uint16_t free_count_y() { return head_y > tail ? head_y - tail - 1 : head_y + SIZE - tail - 1; } + static bool empty_y() { return head_y == tail; } + static uint16_t free_count_y() { return _free_count_y; } #endif - void purge() { auto temp = TERN_(HAS_SHAPING_X, head_x) = TERN_(HAS_SHAPING_Y, head_y) = tail; UNUSED(temp);} - }; - - class ParamDelayQueue : public DelayQueue { - private: - #ifdef HAS_SHAPING_X - int32_t params_x[shaping_segments]; - #endif - #ifdef HAS_SHAPING_Y - int32_t params_y[shaping_segments]; - #endif - - public: - void enqueue(const int32_t param_x, const int32_t param_y) { - TERN(HAS_SHAPING_X, params_x[DelayQueue::tail] = param_x, UNUSED(param_x)); - TERN(HAS_SHAPING_Y, params_y[DelayQueue::tail] = param_y, UNUSED(param_y)); - DelayQueue::enqueue(); + static void purge() { + const auto st = shaping_time_t(-1); + #if ENABLED(INPUT_SHAPING_X) + head_x = tail; _free_count_x = shaping_echoes - 1; peek_x_val = st; + #endif + #if ENABLED(INPUT_SHAPING_Y) + head_y = tail; _free_count_y = shaping_echoes - 1; peek_y_val = st; + #endif } - #ifdef HAS_SHAPING_X - const int32_t dequeue_x() { - const int32_t result = params_x[DelayQueue::head_x]; - DelayQueue::dequeue_x(); - return result; - } - #endif - #ifdef HAS_SHAPING_Y - const int32_t dequeue_y() { - const int32_t result = params_y[DelayQueue::head_y]; - DelayQueue::dequeue_y(); - return result; - } - #endif }; struct ShapeParams { float frequency; float zeta; - uint8_t factor; - int32_t dividend; + bool enabled; + int16_t delta_error = 0; // delta_error for seconday bresenham mod 128 + uint8_t factor1; + uint8_t factor2; + bool forward; + int32_t last_block_end_pos = 0; }; -#endif // INPUT_SHAPING +#endif // HAS_SHAPING // // Stepper class definition @@ -527,13 +565,11 @@ class Stepper { static bool bezier_2nd_half; // If Bézier curve has been initialized or not #endif - #if ENABLED(INPUT_SHAPING) - static ParamDelayQueue shaping_dividend_queue; - static DelayQueue shaping_queue; - #if HAS_SHAPING_X + #if HAS_SHAPING + #if ENABLED(INPUT_SHAPING_X) static ShapeParams shaping_x; #endif - #if HAS_SHAPING_Y + #if ENABLED(INPUT_SHAPING_Y) static ShapeParams shaping_y; #endif #endif @@ -597,7 +633,7 @@ class Stepper { // The stepper block processing ISR phase static uint32_t block_phase_isr(); - #if ENABLED(INPUT_SHAPING) + #if HAS_SHAPING static void shaping_isr(); #endif @@ -620,6 +656,20 @@ class Stepper { // Check if the given block is busy or not - Must not be called from ISR contexts static bool is_block_busy(const block_t * const block); + #if HAS_SHAPING + // Check whether the stepper is processing any input shaping echoes + static bool input_shaping_busy() { + const bool was_on = hal.isr_state(); + hal.isr_off(); + + const bool result = TERN0(INPUT_SHAPING_X, !ShapingQueue::empty_x()) || TERN0(INPUT_SHAPING_Y, !ShapingQueue::empty_y()); + + if (was_on) hal.isr_on(); + + return result; + } + #endif + // Get the position of a stepper, in steps static int32_t position(const AxisEnum axis); @@ -754,7 +804,7 @@ class Stepper { set_directions(); } - #if ENABLED(INPUT_SHAPING) + #if HAS_SHAPING static void set_shaping_damping_ratio(const AxisEnum axis, const float zeta); static float get_shaping_damping_ratio(const AxisEnum axis); static void set_shaping_frequency(const AxisEnum axis, const float freq); diff --git a/buildroot/tests/mega2560 b/buildroot/tests/mega2560 index 18a6ea88c9..4167c3e4bf 100755 --- a/buildroot/tests/mega2560 +++ b/buildroot/tests/mega2560 @@ -80,9 +80,9 @@ opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO MIXING_STEPPERS 5 LCD_LANGUAGE ru \ FIL_RUNOUT2_PIN 16 FIL_RUNOUT3_PIN 17 FIL_RUNOUT4_PIN 4 FIL_RUNOUT5_PIN 5 opt_enable MIXING_EXTRUDER GRADIENT_MIX GRADIENT_VTOOL CR10_STOCKDISPLAY \ USE_CONTROLLER_FAN CONTROLLER_FAN_EDITABLE CONTROLLER_FAN_IGNORE_Z \ - FILAMENT_RUNOUT_SENSOR ADVANCED_PAUSE_FEATURE NOZZLE_PARK_FEATURE INPUT_SHAPING + FILAMENT_RUNOUT_SENSOR ADVANCED_PAUSE_FEATURE NOZZLE_PARK_FEATURE INPUT_SHAPING_X INPUT_SHAPING_Y opt_disable DISABLE_INACTIVE_EXTRUDER -exec_test $1 $2 "Azteeg X3 | Mixing Extruder (x5) | Gradient Mix | Greek" "$3" +exec_test $1 $2 "Azteeg X3 | Mixing Extruder (x5) | Gradient Mix | Input Shaping | Greek" "$3" # # Test SPEAKER with BOARD_BQ_ZUM_MEGA_3D and BQ_LCD_SMART_CONTROLLER diff --git a/ini/features.ini b/ini/features.ini index 7c8fd2fd8f..e376e2757e 100644 --- a/ini/features.ini +++ b/ini/features.ini @@ -187,7 +187,7 @@ HAS_DUPLICATION_MODE = src_filter=+ PHOTO_GCODE = src_filter=+ CONTROLLER_FAN_EDITABLE = src_filter=+ -INPUT_SHAPING = src_filter=+ +HAS_SHAPING = src_filter=+ GCODE_MACROS = src_filter=+ GRADIENT_MIX = src_filter=+ HAS_SAVED_POSITIONS = src_filter=+ + From f3108e87f1470e5d03df28f17b8cb9a8b6493ca7 Mon Sep 17 00:00:00 2001 From: Chris Bagwell Date: Sun, 27 Nov 2022 21:40:11 -0600 Subject: [PATCH 089/109] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20More=20SCURVE=20cy?= =?UTF-8?q?cles=20on=20unoptimized=20cortex-m0=20(#24955)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/stepper.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h index f29bb346d1..6d9814b4df 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -87,7 +87,11 @@ // S curve interpolation adds 40 cycles #if ENABLED(S_CURVE_ACCELERATION) - #define ISR_S_CURVE_CYCLES 40UL + #ifdef STM32G0B1xx + #define ISR_S_CURVE_CYCLES 500UL + #else + #define ISR_S_CURVE_CYCLES 40UL + #endif #else #define ISR_S_CURVE_CYCLES 0UL #endif From a8d7c8c89d4719c84b90bc16f01b31854995eebc Mon Sep 17 00:00:00 2001 From: Taylor Talkington Date: Sun, 27 Nov 2022 22:41:27 -0500 Subject: [PATCH 090/109] =?UTF-8?q?=E2=9C=A8=20Ender-3=20V2=20DWIN=20for?= =?UTF-8?q?=20BTT=20Octopus=20V1.1=20(#24983)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Conditionals_adv.h | 2 +- .../pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 367f7f2324..bf1088afc8 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -1078,7 +1078,7 @@ */ #ifndef LCD_SERIAL_PORT #if HAS_DWIN_E3V2 || IS_DWIN_MARLINUI || HAS_DGUS_LCD - #if MB(BTT_SKR_MINI_E3_V1_0, BTT_SKR_MINI_E3_V1_2, BTT_SKR_MINI_E3_V2_0, BTT_SKR_MINI_E3_V3_0, BTT_SKR_E3_TURBO) + #if MB(BTT_SKR_MINI_E3_V1_0, BTT_SKR_MINI_E3_V1_2, BTT_SKR_MINI_E3_V2_0, BTT_SKR_MINI_E3_V3_0, BTT_SKR_E3_TURBO, BTT_OCTOPUS_V1_1) #define LCD_SERIAL_PORT 1 #elif MB(CREALITY_V24S1_301, CREALITY_V24S1_301F4, CREALITY_V423, MKS_ROBIN) #define LCD_SERIAL_PORT 2 // Creality Ender3S1, MKS Robin diff --git a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h index 35287050b8..4bf1073ae4 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h @@ -429,6 +429,30 @@ #define TFTGLCD_CS EXP2_03_PIN #endif +#elif HAS_DWIN_E3V2 || IS_DWIN_MARLINUI + /** + * ------ ------ --- + * | 1 2 | | 1 2 | 1 | + * | 3 4 | RX | 3 4 | TX | 2 | RX + * ENT 5 6 | BEEP ENT 5 6 | BEEP | 3 | TX + * B | 7 8 | A B | 7 8 | A | 4 | + * GND | 9 10 | VCC GND | 9 10 | VCC 5 | + * ------ ------ --- + * EXP1 DWIN TFT + * + * DWIN pins are labeled as printed on DWIN PCB. GND, VCC, A, B, ENT & BEEP can be connected in the same + * orientation as the existing plug/DWIN to EXP1. TX/RX need to be connected to the TFT port, with TX->RX, RX->TX. + */ + + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! Ender-3 V2 display requires a custom cable. See 'pins_BTT_OCTOPUS_V1_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif + + #define BEEPER_PIN EXP1_06_PIN + #define BTN_EN1 EXP1_08_PIN + #define BTN_EN2 EXP1_07_PIN + #define BTN_ENC EXP1_05_PIN + #elif HAS_WIRED_LCD #define BEEPER_PIN EXP1_01_PIN From 791de408857258f448c7462d7b296a3f526f2c5d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 27 Nov 2022 23:23:00 -0600 Subject: [PATCH 091/109] =?UTF-8?q?=F0=9F=90=9B=20Fix=20G-code=20resend=20?= =?UTF-8?q?race=20condition?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As pointed out in #24972 by @silycr, but simplified. --- Marlin/src/gcode/queue.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Marlin/src/gcode/queue.cpp b/Marlin/src/gcode/queue.cpp index a390a46d8e..c951fc6333 100644 --- a/Marlin/src/gcode/queue.cpp +++ b/Marlin/src/gcode/queue.cpp @@ -469,8 +469,11 @@ void GCodeQueue::get_serial_commands() { const long gcode_N = strtol(npos + 1, nullptr, 10); + // The line number must be in the correct sequence. if (gcode_N != serial.last_N + 1 && !M110) { - // In case of error on a serial port, don't prevent other serial port from making progress + // A request-for-resend line was already in transit so we got two - oops! + if (WITHIN(gcode_N, serial.last_N - 1, serial.last_N)) continue; + // A corrupted line or too high, indicating a lost line gcode_line_error(F(STR_ERR_LINE_NO), p); break; } @@ -480,13 +483,11 @@ void GCodeQueue::get_serial_commands() { uint8_t checksum = 0, count = uint8_t(apos - command); while (count) checksum ^= command[--count]; if (strtol(apos + 1, nullptr, 10) != checksum) { - // In case of error on a serial port, don't prevent other serial port from making progress gcode_line_error(F(STR_ERR_CHECKSUM_MISMATCH), p); break; } } else { - // In case of error on a serial port, don't prevent other serial port from making progress gcode_line_error(F(STR_ERR_NO_CHECKSUM), p); break; } From 600591b18dc002c102108008ff5b3f7101737eb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=88=E3=83=88=E3=82=82?= <85485984+ElectronicsArchiver@users.noreply.github.com> Date: Sun, 27 Nov 2022 23:52:06 -0500 Subject: [PATCH 092/109] =?UTF-8?q?=F0=9F=93=9D=20Formatted=20Team=20Overv?= =?UTF-8?q?iew=20(#25029)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 53 +++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 640aaeed2c..2b78af5093 100644 --- a/README.md +++ b/README.md @@ -91,16 +91,49 @@ Marlin is constantly improving thanks to a huge number of contributors from all Regular users can open and close their own issues, but only the administrators can do project-related things like add labels, merge changes, set milestones, and kick trolls. The current Marlin admin team consists of: - - Scott Lahteine [[@thinkyhead](https://github.com/thinkyhead)] - USA - Project Maintainer   [💸 Donate](https://www.thinkyhead.com/donate-to-marlin) - - Roxanne Neufeld [[@Roxy-3D](https://github.com/Roxy-3D)] - USA - - Keith Bennett [[@thisiskeithb](https://github.com/thisiskeithb)] - USA   [💸 Donate](https://github.com/sponsors/thisiskeithb) - - Peter Ellens [[@ellensp](https://github.com/ellensp)] - New Zealand   [💸 Donate](https://ko-fi.com/ellensp) - - Victor Oliveira [[@rhapsodyv](https://github.com/rhapsodyv)] - Brazil - - Chris Pepper [[@p3p](https://github.com/p3p)] - UK - - Jason Smith [[@sjasonsmith](https://github.com/sjasonsmith)] - USA - - Luu Lac [[@shitcreek](https://github.com/shitcreek)] - USA - - Bob Kuhn [[@Bob-the-Kuhn](https://github.com/Bob-the-Kuhn)] - USA - - Erik van der Zalm [[@ErikZalm](https://github.com/ErikZalm)] - Netherlands   [💸 Donate](https://flattr.com/submit/auto?user_id=ErikZalm&url=https://github.com/MarlinFirmware/Marlin&title=Marlin&language=&tags=github&category=software) + + + +
Project Maintainer
+ + 🇺🇸  **Scott Lahteine** +       [@thinkyhead](https://github.com/thinkyhead) +       [  Donate 💸  ](https://www.thinkyhead.com/donate-to-marlin) + + + + 🇺🇸  **Roxanne Neufeld** +       [@Roxy-3D](https://github.com/Roxy-3D) + + 🇺🇸  **Keith Bennett** +       [@thisiskeithb](https://github.com/thisiskeithb) +       [  Donate 💸  ](https://github.com/sponsors/thisiskeithb) + + 🇺🇸  **Jason Smith** +       [@sjasonsmith](https://github.com/sjasonsmith) + + + + 🇧🇷  **Victor Oliveira** +       [@rhapsodyv](https://github.com/rhapsodyv) + + 🇬🇧  **Chris Pepper** +       [@p3p](https://github.com/p3p) + +🇳🇿  **Peter Ellens** +       [@ellensp](https://github.com/ellensp) +       [  Donate 💸  ](https://ko-fi.com/ellensp) + + + + 🇺🇸  **Bob Kuhn** +       [@Bob-the-Kuhn](https://github.com/Bob-the-Kuhn) + + 🇳🇱  **Erik van der Zalm** +       [@ErikZalm](https://github.com/ErikZalm) +       [  Donate 💸  ](https://flattr.com/submit/auto?user_id=ErikZalm&url=https://github.com/MarlinFirmware/Marlin&title=Marlin&language=&tags=github&category=software) + +
## License From 01e23af7d8d606888accfd0a4c9b3331f2f53b7e Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 29 Nov 2022 00:24:07 +0000 Subject: [PATCH 093/109] [cron] Bump distribution date (2022-11-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 96d2569478..43874f6ea1 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-11-28" +//#define STRING_DISTRIBUTION_DATE "2022-11-29" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index f287a8541d..9443b16b34 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-11-28" + #define STRING_DISTRIBUTION_DATE "2022-11-29" #endif /** From b6794f6a7e076d3276a3589dbcd4ebc3eea1a44e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 1 Dec 2022 23:39:17 -0600 Subject: [PATCH 094/109] =?UTF-8?q?=F0=9F=8E=A8=20Misc.=20cleanup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/bltouch.cpp | 2 -- Marlin/src/feature/pause.cpp | 8 ++------ buildroot/share/scripts/upload.py | 4 +--- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/Marlin/src/feature/bltouch.cpp b/Marlin/src/feature/bltouch.cpp index 10d3131aed..fe56341a47 100644 --- a/Marlin/src/feature/bltouch.cpp +++ b/Marlin/src/feature/bltouch.cpp @@ -38,8 +38,6 @@ bool BLTouch::od_5v_mode; // Initialized by settings.load, 0 = Open Drai #include "../module/servo.h" #include "../module/probe.h" -void stop(); - #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) #include "../core/debug_out.h" diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index 1c2ea59d4d..91d25d7187 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -472,9 +472,7 @@ bool pause_print(const_float_t retract, const xyz_pos_t &park_point, const bool if (unload_length) unload_filament(unload_length, show_lcd, PAUSE_MODE_CHANGE_FILAMENT); - #if ENABLED(DUAL_X_CARRIAGE) - set_duplication_enabled(saved_ext_dup_mode, saved_ext); - #endif + TERN_(DUAL_X_CARRIAGE, set_duplication_enabled(saved_ext_dup_mode, saved_ext)); // Disable the Extruder for manual change disable_active_extruder(); @@ -580,9 +578,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep } idle_no_sleep(); } - #if ENABLED(DUAL_X_CARRIAGE) - set_duplication_enabled(saved_ext_dup_mode, saved_ext); - #endif + TERN_(DUAL_X_CARRIAGE, set_duplication_enabled(saved_ext_dup_mode, saved_ext)); } /** diff --git a/buildroot/share/scripts/upload.py b/buildroot/share/scripts/upload.py index caa1fbae23..af15a82590 100644 --- a/buildroot/share/scripts/upload.py +++ b/buildroot/share/scripts/upload.py @@ -189,9 +189,7 @@ def Upload(source, target, env): 'BOARD_CREALITY_V427', 'BOARD_CREALITY_V431', 'BOARD_CREALITY_V452', 'BOARD_CREALITY_V453', 'BOARD_CREALITY_V24S1'] # "upload_random_name": generate a random 8.3 firmware filename to upload - upload_random_filename = marlin_motherboard in ['BOARD_CREALITY_V4', 'BOARD_CREALITY_V4210', 'BOARD_CREALITY_V422', 'BOARD_CREALITY_V423', - 'BOARD_CREALITY_V427', 'BOARD_CREALITY_V431', 'BOARD_CREALITY_V452', 'BOARD_CREALITY_V453', - 'BOARD_CREALITY_V24S1'] and not marlin_long_filename_host_support + upload_random_filename = upload_delete_old_bins and not marlin_long_filename_host_support try: From d1f09f23e52974ee7654f8ccc073da4bfef68d5a Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 2 Dec 2022 06:05:54 +0000 Subject: [PATCH 095/109] [cron] Bump distribution date (2022-12-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 43874f6ea1..42f7877740 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-11-29" +//#define STRING_DISTRIBUTION_DATE "2022-12-02" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 9443b16b34..85e698c72c 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-11-29" + #define STRING_DISTRIBUTION_DATE "2022-12-02" #endif /** From f7ca7a92d13dda78acf71510b7d971d0ffdff829 Mon Sep 17 00:00:00 2001 From: kisslorand <50251547+kisslorand@users.noreply.github.com> Date: Fri, 2 Dec 2022 08:19:34 +0200 Subject: [PATCH 096/109] =?UTF-8?q?=F0=9F=9A=B8=20G30=20move=20to=20logica?= =?UTF-8?q?l=20XY=20(#24953)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/types.h | 6 +++--- Marlin/src/gcode/probe/G30.cpp | 23 +++++++++++++---------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Marlin/src/core/types.h b/Marlin/src/core/types.h index 0281dea08c..61c182448e 100644 --- a/Marlin/src/core/types.h +++ b/Marlin/src/core/types.h @@ -309,9 +309,9 @@ typedef abce_float_t abce_pos_t; void toLogical(xy_pos_t &raw); void toLogical(xyz_pos_t &raw); void toLogical(xyze_pos_t &raw); -void toNative(xy_pos_t &raw); -void toNative(xyz_pos_t &raw); -void toNative(xyze_pos_t &raw); +void toNative(xy_pos_t &lpos); +void toNative(xyz_pos_t &lpos); +void toNative(xyze_pos_t &lpos); // // Paired XY coordinates, counters, flags, etc. diff --git a/Marlin/src/gcode/probe/G30.cpp b/Marlin/src/gcode/probe/G30.cpp index e474ffe9d6..6893d4bec2 100644 --- a/Marlin/src/gcode/probe/G30.cpp +++ b/Marlin/src/gcode/probe/G30.cpp @@ -58,16 +58,13 @@ void GcodeSuite::G30() { tool_change(0); #endif - const xy_pos_t pos = { parser.linearval('X', current_position.x + probe.offset_xy.x), - parser.linearval('Y', current_position.y + probe.offset_xy.y) }; + // Convert the given logical position to native position + const xy_pos_t pos = { + parser.seenval('X') ? RAW_X_POSITION(parser.value_linear_units()) : current_position.x, + parser.seenval('Y') ? RAW_Y_POSITION(parser.value_linear_units()) : current_position.y + }; - if (!probe.can_reach(pos)) { - #if ENABLED(DWIN_LCD_PROUI) - SERIAL_ECHOLNF(GET_EN_TEXT_F(MSG_ZPROBE_OUT)); - LCD_MESSAGE(MSG_ZPROBE_OUT); - #endif - } - else { + if (probe.can_reach(pos)) { // Disable leveling so the planner won't mess with us TERN_(HAS_LEVELING, set_bed_leveling_enabled(false)); @@ -83,7 +80,7 @@ void GcodeSuite::G30() { const float measured_z = probe.probe_at_point(pos, raise_after, 1); TERN_(HAS_PTC, ptc.set_enabled(true)); if (!isnan(measured_z)) { - SERIAL_ECHOLNPGM("Bed X: ", pos.x, " Y: ", pos.y, " Z: ", measured_z); + SERIAL_ECHOLNPGM("Bed X: ", pos.asLogical().x, " Y: ", pos.asLogical().y, " Z: ", measured_z); #if EITHER(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) char msg[31], str_1[6], str_2[6], str_3[6]; sprintf_P(msg, PSTR("X:%s, Y:%s, Z:%s"), @@ -102,6 +99,12 @@ void GcodeSuite::G30() { report_current_position(); } + else { + #if ENABLED(DWIN_LCD_PROUI) + SERIAL_ECHOLNF(GET_EN_TEXT_F(MSG_ZPROBE_OUT)); + LCD_MESSAGE(MSG_ZPROBE_OUT); + #endif + } // Restore the active tool TERN_(HAS_MULTI_HOTEND, tool_change(old_tool_index)); From be380be8fbf77278d502b24950f8ef4fa9ec0f5a Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 3 Dec 2022 00:19:44 +0000 Subject: [PATCH 097/109] [cron] Bump distribution date (2022-12-03) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 42f7877740..1af0b0830a 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-12-02" +//#define STRING_DISTRIBUTION_DATE "2022-12-03" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 85e698c72c..bfa8011c10 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-12-02" + #define STRING_DISTRIBUTION_DATE "2022-12-03" #endif /** From 464cc9bea946279c38cf53edce177fb6aeb8c0a4 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sun, 4 Dec 2022 14:05:22 +1300 Subject: [PATCH 098/109] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20MSG=5FMOVE=5FN=5FM?= =?UTF-8?q?M=20substitution=20(#25043)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/language/language_el.h | 2 +- Marlin/src/lcd/language/language_el_gr.h | 2 +- Marlin/src/lcd/language/language_ru.h | 2 +- Marlin/src/lcd/language/language_uk.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Marlin/src/lcd/language/language_el.h b/Marlin/src/lcd/language/language_el.h index 2d7c42b2fa..57af804147 100644 --- a/Marlin/src/lcd/language/language_el.h +++ b/Marlin/src/lcd/language/language_el.h @@ -95,7 +95,7 @@ namespace Language_el { LSTR MSG_MOVE_N = _UxGT("Μετακίνηση @"); LSTR MSG_MOVE_E = _UxGT("Εξωθητής"); LSTR MSG_MOVE_EN = _UxGT("Εξωθητής *"); - LSTR MSG_MOVE_N_MM = _UxGT("Μετακίνηση %s μμ"); + LSTR MSG_MOVE_N_MM = _UxGT("Μετακίνηση $μμ"); LSTR MSG_MOVE_01MM = _UxGT("Μετακίνηση 0,1 μμ"); LSTR MSG_MOVE_1MM = _UxGT("Μετακίνηση 1 μμ"); LSTR MSG_MOVE_10MM = _UxGT("Μετακίνηση 10 μμ"); diff --git a/Marlin/src/lcd/language/language_el_gr.h b/Marlin/src/lcd/language/language_el_gr.h index a76870d2a3..08f647f705 100644 --- a/Marlin/src/lcd/language/language_el_gr.h +++ b/Marlin/src/lcd/language/language_el_gr.h @@ -84,7 +84,7 @@ namespace Language_el_gr { LSTR MSG_MOVE_N = _UxGT("Μετακίνηση @"); LSTR MSG_MOVE_E = _UxGT("Εξωθητήρας"); LSTR MSG_MOVE_EN = _UxGT("Εξωθητήρας *"); - LSTR MSG_MOVE_N_MM = _UxGT("Μετακίνηση %s μμ"); + LSTR MSG_MOVE_N_MM = _UxGT("Μετακίνηση $μμ"); LSTR MSG_MOVE_01MM = _UxGT("Μετακίνηση 0,1 μμ"); LSTR MSG_MOVE_1MM = _UxGT("Μετακίνηση 1 μμ"); LSTR MSG_MOVE_10MM = _UxGT("Μετακίνηση 10 μμ"); diff --git a/Marlin/src/lcd/language/language_ru.h b/Marlin/src/lcd/language/language_ru.h index c9b4683bb2..ec9ddfa7f6 100644 --- a/Marlin/src/lcd/language/language_ru.h +++ b/Marlin/src/lcd/language/language_ru.h @@ -336,7 +336,7 @@ namespace Language_ru { LSTR MSG_MOVE_E = _UxGT("Экструдер"); LSTR MSG_MOVE_EN = _UxGT("Экструдер *"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("Сопло не нагрето"); - LSTR MSG_MOVE_N_MM = _UxGT("Движение %sмм"); + LSTR MSG_MOVE_N_MM = _UxGT("Движение $мм"); LSTR MSG_MOVE_01MM = _UxGT("Движение 0.1мм"); LSTR MSG_MOVE_1MM = _UxGT("Движение 1мм"); LSTR MSG_MOVE_10MM = _UxGT("Движение 10мм"); diff --git a/Marlin/src/lcd/language/language_uk.h b/Marlin/src/lcd/language/language_uk.h index ccdcb21ddf..6b4ebc79cd 100644 --- a/Marlin/src/lcd/language/language_uk.h +++ b/Marlin/src/lcd/language/language_uk.h @@ -337,7 +337,7 @@ namespace Language_uk { LSTR MSG_MOVE_E = _UxGT("Екструдер"); LSTR MSG_MOVE_EN = _UxGT("Екструдер *"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("Сопло дуже холодне"); - LSTR MSG_MOVE_N_MM = _UxGT("Рух %sмм"); + LSTR MSG_MOVE_N_MM = _UxGT("Рух $мм"); LSTR MSG_MOVE_01MM = _UxGT("Рух 0.1мм"); LSTR MSG_MOVE_1MM = _UxGT("Рух 1мм"); LSTR MSG_MOVE_10MM = _UxGT("Рух 10мм"); From 229dba6d4c4bf492463f6ae26d13991adbc8bc56 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sun, 4 Dec 2022 14:09:02 +1300 Subject: [PATCH 099/109] =?UTF-8?q?=F0=9F=94=A8=20Update=20renamed.ini=20(?= =?UTF-8?q?#25042)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ini/renamed.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ini/renamed.ini b/ini/renamed.ini index 5785bfac67..fa154f3a0f 100644 --- a/ini/renamed.ini +++ b/ini/renamed.ini @@ -57,10 +57,10 @@ extends = renamed # Renamed to STM32F103VE_GTM32_maple extends = renamed -[env:mks_robin_nano_35] +[env:mks_robin_nano35] # Renamed to mks_robin_nano_v1v2 extends = renamed -[env:mks_robin_nano_35_maple] +[env:mks_robin_nano35_maple] # Renamed to mks_robin_nano_v1v2_maple extends = renamed From 0f08f7ab858497e9f96b21366981854ab3e2332c Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 3 Dec 2022 19:18:03 -0600 Subject: [PATCH 100/109] =?UTF-8?q?=F0=9F=8E=A8=20Trailing=20whitespace?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h | 4 +- README.md | 40 +++++++++---------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h index 4bf1073ae4..b3d97ae059 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h @@ -435,8 +435,8 @@ * | 1 2 | | 1 2 | 1 | * | 3 4 | RX | 3 4 | TX | 2 | RX * ENT 5 6 | BEEP ENT 5 6 | BEEP | 3 | TX - * B | 7 8 | A B | 7 8 | A | 4 | - * GND | 9 10 | VCC GND | 9 10 | VCC 5 | + * B | 7 8 | A B | 7 8 | A | 4 | + * GND | 9 10 | VCC GND | 9 10 | VCC 5 | * ------ ------ --- * EXP1 DWIN TFT * diff --git a/README.md b/README.md index 2b78af5093..a13fc3fd98 100644 --- a/README.md +++ b/README.md @@ -95,42 +95,42 @@ Regular users can open and close their own issues, but only the administrators c Project Maintainer - 🇺🇸  **Scott Lahteine** -       [@thinkyhead](https://github.com/thinkyhead) + 🇺🇸  **Scott Lahteine** +       [@thinkyhead](https://github.com/thinkyhead)       [  Donate 💸  ](https://www.thinkyhead.com/donate-to-marlin) - 🇺🇸  **Roxanne Neufeld** -       [@Roxy-3D](https://github.com/Roxy-3D) - - 🇺🇸  **Keith Bennett** -       [@thisiskeithb](https://github.com/thisiskeithb) + 🇺🇸  **Roxanne Neufeld** +       [@Roxy-3D](https://github.com/Roxy-3D) + + 🇺🇸  **Keith Bennett** +       [@thisiskeithb](https://github.com/thisiskeithb)       [  Donate 💸  ](https://github.com/sponsors/thisiskeithb) - - 🇺🇸  **Jason Smith** + + 🇺🇸  **Jason Smith**       [@sjasonsmith](https://github.com/sjasonsmith) - 🇧🇷  **Victor Oliveira** + 🇧🇷  **Victor Oliveira**       [@rhapsodyv](https://github.com/rhapsodyv) - - 🇬🇧  **Chris Pepper** + + 🇬🇧  **Chris Pepper**       [@p3p](https://github.com/p3p) - -🇳🇿  **Peter Ellens** -       [@ellensp](https://github.com/ellensp) + +🇳🇿  **Peter Ellens** +       [@ellensp](https://github.com/ellensp)       [  Donate 💸  ](https://ko-fi.com/ellensp) - 🇺🇸  **Bob Kuhn** + 🇺🇸  **Bob Kuhn**       [@Bob-the-Kuhn](https://github.com/Bob-the-Kuhn) - - 🇳🇱  **Erik van der Zalm** -       [@ErikZalm](https://github.com/ErikZalm) -       [  Donate 💸  ](https://flattr.com/submit/auto?user_id=ErikZalm&url=https://github.com/MarlinFirmware/Marlin&title=Marlin&language=&tags=github&category=software) + + 🇳🇱  **Erik van der Zalm** +       [@ErikZalm](https://github.com/ErikZalm) +       [  Donate 💸  ](https://flattr.com/submit/auto?user_id=ErikZalm&url=https://github.com/MarlinFirmware/Marlin&title=Marlin&language=&tags=github&category=software) From d46e87b00e1f9b4e52cbafd3437d28c02b7fe309 Mon Sep 17 00:00:00 2001 From: Taylor Talkington Date: Sat, 3 Dec 2022 20:20:19 -0500 Subject: [PATCH 101/109] =?UTF-8?q?=F0=9F=A9=B9=20Ender=203v2=20DWIN=20Mar?= =?UTF-8?q?linUI=20Fixup=20(#24984)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/e3v2/common/dwin_api.cpp | 2 +- Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/lcd/e3v2/common/dwin_api.cpp b/Marlin/src/lcd/e3v2/common/dwin_api.cpp index 79998219a9..f3abaf25c9 100644 --- a/Marlin/src/lcd/e3v2/common/dwin_api.cpp +++ b/Marlin/src/lcd/e3v2/common/dwin_api.cpp @@ -234,7 +234,7 @@ void DWIN_Frame_AreaMove(uint8_t mode, uint8_t dir, uint16_t dis, // *string: The string // rlimit: To limit the drawn string length void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const char * const string, uint16_t rlimit/*=0xFFFF*/) { - #if NONE(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) + #if NONE(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI, IS_DWIN_MARLINUI) DWIN_Draw_Rectangle(1, bColor, x, y, x + (fontWidth(size) * strlen_P(string)), y + fontHeight(size)); #endif constexpr uint8_t widthAdjust = 0; diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp index 0bd1b2ff2a..73de275f9c 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp @@ -453,7 +453,7 @@ void MarlinUI::draw_status_screen() { DWIN_Draw_String( false, font16x32, Percent_Color, Color_Bg_Black, pb_left + (pb_width - dwin_string.length * 16) / 2, - pb_top + (pb_height - 32) / 2, + pb_top + (pb_height - 32) / 2 - 1, S(dwin_string.string()) ); #endif From 5c3d87a951cee94ce3d5ac500079da705a274be4 Mon Sep 17 00:00:00 2001 From: tombrazier <68918209+tombrazier@users.noreply.github.com> Date: Sun, 4 Dec 2022 02:14:31 +0000 Subject: [PATCH 102/109] =?UTF-8?q?=F0=9F=90=9B=20Fix=20TMC5160=20+=20Inpu?= =?UTF-8?q?t=20Shaping=20overcurrent=20(#25050)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/stepper.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 74e761dc64..46b21a20b6 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -1679,12 +1679,14 @@ void Stepper::pulse_phase_isr() { // the TMC2208 / TMC2225 shutdown bug (#16076), add a half step hysteresis // in each direction. This results in the position being off by half an // average half step during travel but correct at the end of each segment. - #if AXIS_DRIVER_TYPE_X(TMC2208) || AXIS_DRIVER_TYPE_X(TMC2208_STANDALONE) + #if AXIS_DRIVER_TYPE_X(TMC2208) || AXIS_DRIVER_TYPE_X(TMC2208_STANDALONE) || \ + AXIS_DRIVER_TYPE_X(TMC5160) || AXIS_DRIVER_TYPE_X(TMC5160_STANDALONE) #define HYSTERESIS_X 64 #else #define HYSTERESIS_X 0 #endif - #if AXIS_DRIVER_TYPE_Y(TMC2208) || AXIS_DRIVER_TYPE_Y(TMC2208_STANDALONE) + #if AXIS_DRIVER_TYPE_Y(TMC2208) || AXIS_DRIVER_TYPE_Y(TMC2208_STANDALONE) || \ + AXIS_DRIVER_TYPE_Y(TMC5160) || AXIS_DRIVER_TYPE_Y(TMC5160_STANDALONE) #define HYSTERESIS_Y 64 #else #define HYSTERESIS_Y 0 From 4d03c258dcd33bb0939cee38f42216e546f06d0f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 3 Dec 2022 20:19:18 -0600 Subject: [PATCH 103/109] =?UTF-8?q?=F0=9F=94=A8=20Fix=20CI=20Test=20clean?= =?UTF-8?q?=20step?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/share/PlatformIO/scripts/pioutil.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildroot/share/PlatformIO/scripts/pioutil.py b/buildroot/share/PlatformIO/scripts/pioutil.py index 5ae28a62f3..cc3db33df4 100644 --- a/buildroot/share/PlatformIO/scripts/pioutil.py +++ b/buildroot/share/PlatformIO/scripts/pioutil.py @@ -6,7 +6,7 @@ def is_pio_build(): from SCons.Script import DefaultEnvironment env = DefaultEnvironment() - return not env.IsIntegrationDump() + return not env.IsIntegrationDump() and not env.IsCleanTarget() def get_pio_version(): from platformio import util From 3ba9387479b115e7e21f33b3cd2d3e153209520e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 3 Dec 2022 20:49:46 -0600 Subject: [PATCH 104/109] =?UTF-8?q?=F0=9F=8E=A8=20Misc.=20cleanup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/calibrate/M48.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/gcode/calibrate/M48.cpp b/Marlin/src/gcode/calibrate/M48.cpp index 8b6ea0bf1f..825f3713f4 100644 --- a/Marlin/src/gcode/calibrate/M48.cpp +++ b/Marlin/src/gcode/calibrate/M48.cpp @@ -112,7 +112,7 @@ void GcodeSuite::M48() { set_bed_leveling_enabled(false); #endif - TERN_(HAS_PTC, ptc.set_enabled(!parser.seen('C') || parser.value_bool())); + TERN_(HAS_PTC, ptc.set_enabled(parser.boolval('C', true)); // Work with reasonable feedrates remember_feedrate_scaling_off(); From 76ed9b1c7c7bde5d4d6fa8b86d24fb7897c6532f Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sun, 4 Dec 2022 06:08:00 +0000 Subject: [PATCH 105/109] [cron] Bump distribution date (2022-12-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 1af0b0830a..b2b1b0aa8d 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-12-03" +//#define STRING_DISTRIBUTION_DATE "2022-12-04" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index bfa8011c10..e2344eade9 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-12-03" + #define STRING_DISTRIBUTION_DATE "2022-12-04" #endif /** From 6d1d5e4e6a13b055e78aebbae98eda1868051522 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 4 Dec 2022 15:35:45 -0600 Subject: [PATCH 106/109] =?UTF-8?q?=F0=9F=94=A8=20Fix=20CI=20Test=20clean?= =?UTF-8?q?=20step=20(2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/share/PlatformIO/scripts/pioutil.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/buildroot/share/PlatformIO/scripts/pioutil.py b/buildroot/share/PlatformIO/scripts/pioutil.py index cc3db33df4..18e6dba928 100644 --- a/buildroot/share/PlatformIO/scripts/pioutil.py +++ b/buildroot/share/PlatformIO/scripts/pioutil.py @@ -6,7 +6,8 @@ def is_pio_build(): from SCons.Script import DefaultEnvironment env = DefaultEnvironment() - return not env.IsIntegrationDump() and not env.IsCleanTarget() + if "IsCleanTarget" in dir(env) and env.IsCleanTarget(): return False + return not env.IsIntegrationDump() def get_pio_version(): from platformio import util From dab43a762718af1d23e1422d751eb312cafcb17e Mon Sep 17 00:00:00 2001 From: kisslorand <50251547+kisslorand@users.noreply.github.com> Date: Mon, 5 Dec 2022 00:04:11 +0200 Subject: [PATCH 107/109] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20Fix=20missing=20)?= =?UTF-8?q?=20(#25055)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/calibrate/M48.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/gcode/calibrate/M48.cpp b/Marlin/src/gcode/calibrate/M48.cpp index 825f3713f4..bfb3b64007 100644 --- a/Marlin/src/gcode/calibrate/M48.cpp +++ b/Marlin/src/gcode/calibrate/M48.cpp @@ -112,7 +112,7 @@ void GcodeSuite::M48() { set_bed_leveling_enabled(false); #endif - TERN_(HAS_PTC, ptc.set_enabled(parser.boolval('C', true)); + TERN_(HAS_PTC, ptc.set_enabled(parser.boolval('C', true))); // Work with reasonable feedrates remember_feedrate_scaling_off(); From 1cd6bf7ef5b5a38a7809dfc5d931e8e003da7d22 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Mon, 5 Dec 2022 01:39:43 +0000 Subject: [PATCH 108/109] [cron] Bump distribution date (2022-12-05) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index b2b1b0aa8d..db51a0fd33 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2022-12-04" +//#define STRING_DISTRIBUTION_DATE "2022-12-05" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index e2344eade9..99a85fb3f6 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-12-04" + #define STRING_DISTRIBUTION_DATE "2022-12-05" #endif /** From cadb1a073d56470b6e45a90f1790a7894cc89361 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Mon, 5 Dec 2022 16:38:23 +1300 Subject: [PATCH 109/109] =?UTF-8?q?=F0=9F=90=9B=20Fix=20Fast=20PWM=20on=20?= =?UTF-8?q?AVR=20(#25030)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #25005 --- Marlin/src/HAL/AVR/fast_pwm.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Marlin/src/HAL/AVR/fast_pwm.cpp b/Marlin/src/HAL/AVR/fast_pwm.cpp index e440315e00..d361aaab38 100644 --- a/Marlin/src/HAL/AVR/fast_pwm.cpp +++ b/Marlin/src/HAL/AVR/fast_pwm.cpp @@ -146,11 +146,11 @@ void MarlinHAL::set_pwm_frequency(const pin_t pin, const uint16_t f_desired) { LIMIT(res_pc_temp, 1U, maxtop); // Calculate frequencies of test prescaler and resolution values - const int f_diff = ABS(f - int(f_desired)), - f_fast_temp = (F_CPU) / (p * (1 + res_fast_temp)), - f_fast_diff = ABS(f_fast_temp - int(f_desired)), - f_pc_temp = (F_CPU) / (2 * p * res_pc_temp), - f_pc_diff = ABS(f_pc_temp - int(f_desired)); + const uint16_t f_fast_temp = (F_CPU) / (p * (1 + res_fast_temp)), + f_pc_temp = (F_CPU) / (2 * p * res_pc_temp); + const int f_diff = _MAX(f, f_desired) - _MIN(f, f_desired), + f_fast_diff = _MAX(f_fast_temp, f_desired) - _MIN(f_fast_temp, f_desired), + f_pc_diff = _MAX(f_pc_temp, f_desired) - _MIN(f_pc_temp, f_desired); if (f_fast_diff < f_diff && f_fast_diff <= f_pc_diff) { // FAST values are closest to desired f // Set the Wave Generation Mode to FAST PWM