diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 02b0718c8d..ca05ff7f72 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1202,7 +1202,8 @@ */ //#define INPUT_SHAPING_X //#define INPUT_SHAPING_Y -#if ANY(INPUT_SHAPING_X, INPUT_SHAPING_Y) +//#define INPUT_SHAPING_Z +#if ANY(INPUT_SHAPING_X, INPUT_SHAPING_Y, INPUT_SHAPING_Z) #if ENABLED(INPUT_SHAPING_X) #define SHAPING_FREQ_X 40.0 // (Hz) The default dominant resonant frequency on the X axis. #define SHAPING_ZETA_X 0.15 // Damping ratio of the X axis (range: 0.0 = no damping to 1.0 = critical damping). @@ -1211,6 +1212,10 @@ #define SHAPING_FREQ_Y 40.0 // (Hz) The default dominant resonant frequency on the Y axis. #define SHAPING_ZETA_Y 0.15 // Damping ratio of the Y axis (range: 0.0 = no damping to 1.0 = critical damping). #endif + #if ENABLED(INPUT_SHAPING_Z) + #define SHAPING_FREQ_Z 40.0 // (Hz) The default dominant resonant frequency on the Z axis. + #define SHAPING_ZETA_Z 0.15 // Damping ratio of the Z axis (range: 0.0 = no damping to 1.0 = critical damping). + #endif //#define SHAPING_MIN_FREQ 20.0 // (Hz) By default the minimum of the shaping frequencies. Override to affect SRAM usage. //#define SHAPING_MAX_STEPRATE 10000 // By default the maximum total step rate of the shaped axes. Override to affect SRAM usage. //#define SHAPING_MENU // Add a menu to the LCD to set shaping parameters. diff --git a/Marlin/Version.h b/Marlin/Version.h index 55664693f4..b417d7875e 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 "2024-05-18" +//#define STRING_DISTRIBUTION_DATE "2024-05-22" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/HAL/DUE/usb/sd_mmc_spi_mem.cpp b/Marlin/src/HAL/DUE/usb/sd_mmc_spi_mem.cpp index 65a926ff36..e64c6755bf 100644 --- a/Marlin/src/HAL/DUE/usb/sd_mmc_spi_mem.cpp +++ b/Marlin/src/HAL/DUE/usb/sd_mmc_spi_mem.cpp @@ -18,30 +18,30 @@ extern "C" { void sd_mmc_spi_mem_init() { } -Ctrl_status sd_mmc_spi_test_unit_ready() { - #ifdef DISABLE_DUE_SD_MMC - return CTRL_NO_PRESENT; - #endif - if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted()) - return CTRL_NO_PRESENT; - return CTRL_GOOD; -} - -// NOTE: This function is defined as returning the address of the last block -// in the card, which is cardSize() - 1 -Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector) { - if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted()) - return CTRL_NO_PRESENT; - *nb_sector = card.diskIODriver()->cardSize() - 1; - return CTRL_GOOD; +inline bool media_ready() { + return IS_SD_INSERTED() && !IS_SD_PRINTING() && !IS_SD_FILE_OPEN() && card.isMounted(); } bool sd_mmc_spi_unload(bool) { return true; } bool sd_mmc_spi_wr_protect() { return false; } -bool sd_mmc_spi_removal() { - return (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted()); +bool sd_mmc_spi_removal() { return !media_ready(); } + +Ctrl_status sd_mmc_spi_test_unit_ready() { + #ifdef DISABLE_DUE_SD_MMC + return CTRL_NO_PRESENT; + #endif + if (!media_ready()) return CTRL_NO_PRESENT; + return CTRL_GOOD; +} + +// NOTE: This function is defined as returning the address of the last block +// in the card, which is cardSize() - 1 +Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector) { + if (!media_ready()) return CTRL_NO_PRESENT; + *nb_sector = card.diskIODriver()->cardSize() - 1; + return CTRL_GOOD; } #if ACCESS_USB == true @@ -61,8 +61,7 @@ Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) { #ifdef DISABLE_DUE_SD_MMC return CTRL_NO_PRESENT; #endif - if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted()) - return CTRL_NO_PRESENT; + if (!media_ready()) return CTRL_NO_PRESENT; #ifdef DEBUG_MMC { @@ -101,8 +100,7 @@ Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) { #ifdef DISABLE_DUE_SD_MMC return CTRL_NO_PRESENT; #endif - if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted()) - return CTRL_NO_PRESENT; + if (!media_ready()) return CTRL_NO_PRESENT; #ifdef DEBUG_MMC { diff --git a/Marlin/src/HAL/DUE/usb/sd_mmc_spi_mem.h b/Marlin/src/HAL/DUE/usb/sd_mmc_spi_mem.h index c0d3c925e8..464d106e52 100644 --- a/Marlin/src/HAL/DUE/usb/sd_mmc_spi_mem.h +++ b/Marlin/src/HAL/DUE/usb/sd_mmc_spi_mem.h @@ -74,7 +74,7 @@ //! //! @brief This function initializes the hw/sw resources required to drive the SD_MMC_SPI. //!/ -extern void sd_mmc_spi_mem_init(void); +void sd_mmc_spi_mem_init(); //! //! @brief This function tests the state of the SD_MMC memory and sends it to the Host. @@ -87,7 +87,7 @@ extern void sd_mmc_spi_mem_init(void); //! Media not present -> CTRL_NO_PRESENT //! Media has changed -> CTRL_BUSY //!/ -extern Ctrl_status sd_mmc_spi_test_unit_ready(void); +Ctrl_status sd_mmc_spi_test_unit_ready(); //! //! @brief This function gives the address of the last valid sector. @@ -98,7 +98,7 @@ extern Ctrl_status sd_mmc_spi_test_unit_ready(void); //! Media ready -> CTRL_GOOD //! Media not present -> CTRL_NO_PRESENT //!/ -extern Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector); +Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector); /*! \brief Unload/Load the SD/MMC card selected * @@ -109,7 +109,7 @@ extern Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector); * * \return \c true if unload/load done success. */ -extern bool sd_mmc_spi_unload(bool unload); +bool sd_mmc_spi_unload(bool unload); //! //! @brief This function returns the write protected status of the memory. @@ -120,14 +120,14 @@ extern bool sd_mmc_spi_unload(bool unload); //! //! @return false -> the memory is not write-protected (always) //!/ -extern bool sd_mmc_spi_wr_protect(void); +bool sd_mmc_spi_wr_protect(); //! //! @brief This function tells if the memory has been removed or not. //! //! @return false -> The memory isn't removed //! -extern bool sd_mmc_spi_removal(void); +bool sd_mmc_spi_removal(); //---- ACCESS DATA FUNCTIONS ---- @@ -147,7 +147,7 @@ extern bool sd_mmc_spi_removal(void); //! It is ready -> CTRL_GOOD //! A error occur -> CTRL_FAIL //! -extern Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector); +Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector); //! This function initializes the SD/MMC memory for a write operation //! @@ -161,7 +161,7 @@ extern Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector); //! It is ready -> CTRL_GOOD //! An error occurs -> CTRL_FAIL //! -extern Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector); +Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector); #endif // #if ACCESS_USB == true diff --git a/Marlin/src/HAL/HC32/app_config.h b/Marlin/src/HAL/HC32/app_config.h index 79518c13f6..fb291419fc 100644 --- a/Marlin/src/HAL/HC32/app_config.h +++ b/Marlin/src/HAL/HC32/app_config.h @@ -65,7 +65,7 @@ #define REDIRECT_PRINTF_TO_SERIAL 1 // F_CPU must be known at compile time, but on HC32F460 it's not. -// Thus we assume HCLK to be 200MHz, as that's what is configured in +// Thus we assume HCLK to be 200MHz, as that's what is configured in // 'core_hook_sysclock_init' in 'sysclock.cpp'. // If you face issues with this assumption, please double-check with the values // printed by 'MarlinHAL::HAL_clock_frequencies_dump'. diff --git a/Marlin/src/HAL/STM32/MarlinSerial.h b/Marlin/src/HAL/STM32/MarlinSerial.h index 4ab1e4e75a..d9311a98da 100644 --- a/Marlin/src/HAL/STM32/MarlinSerial.h +++ b/Marlin/src/HAL/STM32/MarlinSerial.h @@ -53,6 +53,7 @@ inline void begin(unsigned long baud) { begin(baud, SERIAL_8N1); } void _rx_complete_irq(serial_t *obj); + FORCE_INLINE static uint8_t buffer_overruns() { return 0; } // Not implemented. Void to avoid platform-dependent code. protected: usart_rx_callback_t _rx_callback; diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 4ccb414dfe..1c90e3c734 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -469,6 +469,11 @@ #define BOARD_FYSETC_CHEETAH_V30 5250 // FYSETC Cheetah V3.0 (STM32F446RC) #define BOARD_BLACKBEEZMINI_V1 5251 // BlackBeezMini V1 (STM32F401CCU6) +// +// Other ARM Cortex-M4 +// +#define BOARD_CREALITY_CR4NS 5300 // Creality CR4NS200320C13 (GD32F303RET6) as found in the Ender-3 V3 SE + // // ARM Cortex-M7 // diff --git a/Marlin/src/core/language.h b/Marlin/src/core/language.h index 82ed6cc549..ad84966453 100644 --- a/Marlin/src/core/language.h +++ b/Marlin/src/core/language.h @@ -135,6 +135,7 @@ #define STR_BUSY_PAUSED_FOR_USER "busy: paused for user" #define STR_BUSY_PAUSED_FOR_INPUT "busy: paused for input" #define STR_Z_MOVE_COMP "Z_move_comp" +#define STR_LINE_NO "Line: " #define STR_RESEND "Resend: " #define STR_UNKNOWN_COMMAND "Unknown command: \"" #define STR_ACTIVE_EXTRUDER "Active Extruder: " diff --git a/Marlin/src/feature/bedlevel/bdl/bdl.cpp b/Marlin/src/feature/bedlevel/bdl/bdl.cpp index d469bb0c06..7e9d583cc1 100644 --- a/Marlin/src/feature/bedlevel/bdl/bdl.cpp +++ b/Marlin/src/feature/bedlevel/bdl/bdl.cpp @@ -46,10 +46,16 @@ BDS_Leveling bdl; #define DEBUG_OUT ENABLED(DEBUG_OUT_BD) #include "../../../core/debug_out.h" -// M102 S-5 Read raw Calibrate data -// M102 S-6 Start Calibrate -// M102 S4 Set the adjustable Z height value (e.g., 'M102 S4' means it will do adjusting while the Z height <= 0.4mm , disable with 'M102 S0'.) -// M102 S-1 Read sensor information +/** + * M102 S<#> : Set adjustable Z height in 0.1mm units (10ths of a mm) + * (e.g., 'M102 S4' enables adjusting for Z <= 0.4mm) + * M102 S0 : Disable adjustable Z height + * + * M102 S-1 : Read BDsensor version + * M102 S-2 : Read BDsensor distance value + * M102 S-5 : Read raw Calibration data + * M102 S-6 : Start Calibration + */ #define MAX_BD_HEIGHT 4.0f #define CMD_READ_VERSION 1016 diff --git a/Marlin/src/gcode/bedlevel/G42.cpp b/Marlin/src/gcode/bedlevel/G42.cpp index cb5ed97406..193131ee4c 100644 --- a/Marlin/src/gcode/bedlevel/G42.cpp +++ b/Marlin/src/gcode/bedlevel/G42.cpp @@ -32,6 +32,12 @@ /** * G42: Move X & Y axes to mesh coordinates (I & J) + * + * Parameters: + * F : Feedrate in mm/min + * I : X axis point index + * J : Y axis point index + * P : Flag to put the prove at the given point */ void GcodeSuite::G42() { if (MOTION_CONDITIONS) { diff --git a/Marlin/src/gcode/feature/input_shaping/M593.cpp b/Marlin/src/gcode/feature/input_shaping/M593.cpp index 249536efff..6ce942e4ee 100644 --- a/Marlin/src/gcode/feature/input_shaping/M593.cpp +++ b/Marlin/src/gcode/feature/input_shaping/M593.cpp @@ -44,6 +44,15 @@ void GcodeSuite::M593_report(const bool forReplay/*=true*/) { " D", stepper.get_shaping_damping_ratio(Y_AXIS) ); #endif + #if ENABLED(INPUT_SHAPING_Z) + #if ANY(INPUT_SHAPING_X, INPUT_SHAPING_Y) + report_echo_start(forReplay); + #endif + SERIAL_ECHOLNPGM(" M593 Z" + " F", stepper.get_shaping_frequency(Z_AXIS), + " D", stepper.get_shaping_damping_ratio(Z_AXIS) + ); + #endif } /** @@ -59,14 +68,17 @@ void GcodeSuite::M593() { 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)); + seen_Z = TERN0(INPUT_SHAPING_Z, parser.seen_test('Z')), + for_X = seen_X || TERN0(INPUT_SHAPING_X, (!seen_X && !seen_Y && !seen_Z)), + for_Y = seen_Y || TERN0(INPUT_SHAPING_Y, (!seen_X && !seen_Y && !seen_Z)), + for_Z = seen_Z || TERN0(INPUT_SHAPING_Z, (!seen_X && !seen_Y && !seen_Z)); 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); + if (for_Z) stepper.set_shaping_damping_ratio(Z_AXIS, zeta); } else SERIAL_ECHO_MSG("?Zeta (D) value out of range (0-1)"); @@ -78,6 +90,7 @@ void GcodeSuite::M593() { if (freq == 0.0f || freq > min_freq) { if (for_X) stepper.set_shaping_frequency(X_AXIS, freq); if (for_Y) stepper.set_shaping_frequency(Y_AXIS, freq); + if (for_Z) stepper.set_shaping_frequency(Z_AXIS, freq); } else SERIAL_ECHOLNPGM(GCODE_ERR_MSG("Frequency (F) must be greater than ", min_freq, " or 0 to disable")); diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 8004187903..1e3ec7c7f1 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -143,7 +143,7 @@ * R Wait for extruder current temp to reach target temp. ** Wait for heating or cooling. ** * If AUTOTEMP is enabled, S B F. Exit autotemp by any M109 without F * - * M110 - Set the current line number. (Used by host printing) + * M110 - Get or set the current line number. (Used by host printing) * M111 - Set debug flags: "M111 S". See flag bits defined in enum.h. * M112 - Full Shutdown. * diff --git a/Marlin/src/gcode/host/M110.cpp b/Marlin/src/gcode/host/M110.cpp index 2634b19897..c2655dfd20 100644 --- a/Marlin/src/gcode/host/M110.cpp +++ b/Marlin/src/gcode/host/M110.cpp @@ -24,11 +24,19 @@ #include "../queue.h" // for last_N /** - * M110: Set Current Line Number + * M110: Get or set Current Line Number + * + * Parameters: + * N Number to set as last-processed command + * + * Without parameters: + * Report the last-processed (not last-received or last-enqueued) command + * (To purge the queue and resume from this line, the host should use 'M999' instead.) */ void GcodeSuite::M110() { if (parser.seenval('N')) queue.set_current_line_number(parser.value_long()); - + else + SERIAL_ECHOLNPGM(STR_LINE_NO, queue.get_current_line_number()); } diff --git a/Marlin/src/gcode/probe/G38.cpp b/Marlin/src/gcode/probe/G38.cpp index 1f22cc84ed..d57eb9b59e 100644 --- a/Marlin/src/gcode/probe/G38.cpp +++ b/Marlin/src/gcode/probe/G38.cpp @@ -55,7 +55,7 @@ inline bool G38_run_probe() { } #endif - planner.synchronize(); // wait until the machine is idle + planner.synchronize(); // Wait until the machine is idle // Move flag value #if ENABLED(G38_PROBE_AWAY) diff --git a/Marlin/src/gcode/probe/M951.cpp b/Marlin/src/gcode/probe/M951.cpp index 93feffdce9..db0278e431 100644 --- a/Marlin/src/gcode/probe/M951.cpp +++ b/Marlin/src/gcode/probe/M951.cpp @@ -54,6 +54,21 @@ void mpe_settings_init() { mpe_settings_report(); } +/** + * M951: Magnetic Parking Extruder + * + * Parameters: + * L : Set X[0] position + * R : Set X[1] position + * I : Set grab distance + * J : Set slow feedrate + * H : Set fast feedrate + * D : Set travel feedrate + * C : Set compensation factor + * + * With no parameters report the current settings. + * + */ void GcodeSuite::M951() { if (parser.seenval('L')) mpe_settings.parking_xpos[0] = parser.value_linear_units(); if (parser.seenval('R')) mpe_settings.parking_xpos[1] = parser.value_linear_units(); diff --git a/Marlin/src/gcode/queue.h b/Marlin/src/gcode/queue.h index 7281a48bb7..07e08493d1 100644 --- a/Marlin/src/gcode/queue.h +++ b/Marlin/src/gcode/queue.h @@ -212,6 +212,11 @@ public: */ static void set_current_line_number(long n) { serial_state[ring_buffer.command_port().index].last_N = n; } + /** + * Get the current line number for the last received command + */ + static long get_current_line_number() { return serial_state[ring_buffer.command_port().index].last_N; } + #if ENABLED(BUFFER_MONITORING) private: diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index de3d8d2b24..8e5814f5f2 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -112,8 +112,8 @@ #undef DISABLE_IDLE_X #undef INPUT_SHAPING_X #undef SAFE_BED_LEVELING_START_X - #undef SHAPING_BUFFER_X #undef SHAPING_FREQ_X + #undef SHAPING_ZETA_X #undef STEALTHCHOP_X #endif @@ -128,8 +128,8 @@ #undef INPUT_SHAPING_Y #undef QUICK_HOME #undef SAFE_BED_LEVELING_START_Y - #undef SHAPING_BUFFER_Y #undef SHAPING_FREQ_Y + #undef SHAPING_ZETA_Y #undef STEALTHCHOP_Y #undef STEP_STATE_Y #endif @@ -142,8 +142,11 @@ #undef ENABLE_LEVELING_FADE_HEIGHT #undef HOME_Z_FIRST #undef HOMING_Z_WITH_PROBE + #undef INPUT_SHAPING_Z #undef NUM_Z_STEPPERS #undef SAFE_BED_LEVELING_START_Z + #undef SHAPING_FREQ_Z + #undef SHAPING_ZETA_Z #undef STEALTHCHOP_Z #undef STEP_STATE_Z #undef Z_IDLE_HEIGHT @@ -1311,7 +1314,8 @@ * currently HAL.h must be included ahead of pins.h. */ #if LCD_IS_SERIAL_HOST && !defined(LCD_SERIAL_PORT) - #if MB(MKS_MONSTER8_V1, 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_MINI_E3_V3_0_1, BTT_SKR_E3_TURBO, BTT_OCTOPUS_V1_1, AQUILA_V101) + #if MB(MKS_MONSTER8_V1, 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_MINI_E3_V3_0_1, BTT_SKR_E3_TURBO, BTT_OCTOPUS_V1_1, BTT_SKR_V3_0, BTT_SKR_V3_0_EZ, AQUILA_V101) + #define LCD_SERIAL_PORT 1 #elif MB(CREALITY_V24S1_301, CREALITY_V24S1_301F4, CREALITY_F401RE, CREALITY_V423, CREALITY_CR4NTXXC10, MKS_ROBIN, PANOWIN_CUTLASS, KODAMA_BARDO) #define LCD_SERIAL_PORT 2 @@ -1337,7 +1341,7 @@ #endif // Input shaping -#if ANY(INPUT_SHAPING_X, INPUT_SHAPING_Y) +#if ANY(INPUT_SHAPING_X, INPUT_SHAPING_Y, INPUT_SHAPING_Z) #define HAS_ZV_SHAPING 1 #endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 9d59e59686..96b373fe42 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -4218,7 +4218,12 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive." */ #if HAS_ZV_SHAPING #if ENABLED(DELTA) - #error "Input Shaping is not compatible with DELTA kinematics." + #if !ALL(INPUT_SHAPING_X, INPUT_SHAPING_Y, INPUT_SHAPING_Z) + #error "INPUT_SHAPING_X, INPUT_SHAPING_Y and INPUT_SHAPING_Z must all be enabled for DELTA." + #else + static_assert(SHAPING_FREQ_X == SHAPING_FREQ_Y && SHAPING_FREQ_Y == SHAPING_FREQ_Z, "SHAPING_FREQ_X, SHAPING_FREQ_Y and SHAPING_FREQ_Z must be the same for DELTA."); + static_assert(SHAPING_ZETA_X == SHAPING_ZETA_Y && SHAPING_ZETA_Y == SHAPING_ZETA_Z, "SHAPING_ZETA_X, SHAPING_ZETA_Y and SHAPING_ZETA_Z must be the same for DELTA."); + #endif #elif ENABLED(SCARA) #error "Input Shaping is not compatible with SCARA kinematics." #elif ENABLED(TPARA) @@ -4230,9 +4235,19 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive." #elif ENABLED(DIRECT_STEPPING) #error "Input Shaping is not compatible with DIRECT_STEPPING." #elif ALL(INPUT_SHAPING_X, CORE_IS_XZ) - #error "INPUT_SHAPING_X is not supported with COREXZ." + #if !ALL(INPUT_SHAPING_X, INPUT_SHAPING_Z) + #error "INPUT_SHAPING_X and INPUT_SHAPING_Z must both be enabled for COREXZ." + #else + static_assert(SHAPING_FREQ_X == SHAPING_FREQ_Z, "SHAPING_FREQ_X and SHAPING_FREQ_Z must be the same for COREXZ."); + static_assert(SHAPING_ZETA_X == SHAPING_ZETA_Z, "SHAPING_ZETA_X and SHAPING_ZETA_Z must be the same for COREXZ."); + #endif #elif ALL(INPUT_SHAPING_Y, CORE_IS_YZ) - #error "INPUT_SHAPING_Y is not supported with COREYZ." + #if !ALL(INPUT_SHAPING_Y, INPUT_SHAPING_Z) + #error "INPUT_SHAPING_Y and INPUT_SHAPING_Z must both be enabled for COREYZ." + #else + static_assert(SHAPING_FREQ_Y == SHAPING_FREQ_Z, "SHAPING_FREQ_Y and SHAPING_FREQ_Z must be the same for COREYZ."); + static_assert(SHAPING_ZETA_Y == SHAPING_ZETA_Z, "SHAPING_ZETA_Y and SHAPING_ZETA_Z must be the same for COREYZ."); + #endif #elif ANY(CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX) #if !ALL(INPUT_SHAPING_X, INPUT_SHAPING_Y) #error "INPUT_SHAPING_X and INPUT_SHAPING_Y must both be enabled for COREXY, COREYX, or MARKFORGED_*." @@ -4247,6 +4262,7 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive." #else TERN_(INPUT_SHAPING_X, static_assert((SHAPING_FREQ_X) > 0, "SHAPING_FREQ_X must be > 0 or SHAPING_MIN_FREQ must be set.")); TERN_(INPUT_SHAPING_Y, static_assert((SHAPING_FREQ_Y) > 0, "SHAPING_FREQ_Y must be > 0 or SHAPING_MIN_FREQ must be set.")); + TERN_(INPUT_SHAPING_Z, static_assert((SHAPING_FREQ_Z) > 0, "SHAPING_FREQ_Z must be > 0 or SHAPING_MIN_FREQ must be set.")); #endif #ifdef __AVR__ #if ENABLED(INPUT_SHAPING_X) @@ -4263,6 +4279,13 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive." static_assert((SHAPING_FREQ_Y) == 0 || (SHAPING_FREQ_Y) * 2 * 0x10000 >= (STEPPER_TIMER_RATE), "SHAPING_FREQ_Y is below the minimum (16) for AVR 16MHz."); #endif #endif + #if ENABLED(INPUT_SHAPING_Z) + #if F_CPU > 16000000 + static_assert((SHAPING_FREQ_Z) == 0 || (SHAPING_FREQ_Z) * 2 * 0x10000 >= (STEPPER_TIMER_RATE), "SHAPING_FREQ_Z is below the minimum (20) for AVR 20MHz."); + #else + static_assert((SHAPING_FREQ_Z) == 0 || (SHAPING_FREQ_Z) * 2 * 0x10000 >= (STEPPER_TIMER_RATE), "SHAPING_FREQ_Z is below the minimum (16) for AVR 16MHz."); + #endif + #endif #endif #endif diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 523ce48cca..54a4ca100a 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 "2024-05-18" + #define STRING_DISTRIBUTION_DATE "2024-05-22" #endif /** diff --git a/Marlin/src/inc/Warnings.cpp b/Marlin/src/inc/Warnings.cpp index 50d49b43b4..8fc775d4c2 100644 --- a/Marlin/src/inc/Warnings.cpp +++ b/Marlin/src/inc/Warnings.cpp @@ -788,8 +788,13 @@ /** * Input Shaping */ -#if HAS_ZV_SHAPING && ANY(CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX) - #warning "Input Shaping for CORE / MARKFORGED kinematic axes is still experimental." +#if HAS_ZV_SHAPING + #if ANY(CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX) + #warning "Input Shaping for CORE / MARKFORGED kinematic axes is still experimental." + #endif + #if ENABLED(I2S_STEPPER_STREAM) + #warning "Input Shaping has not been tested with I2S_STEPPER_STREAM." + #endif #endif /** diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index debe3b5de0..18c97adb3a 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -3478,6 +3478,13 @@ void drawTuneMenu() { void setShapingYZeta() { hmiValue.axis = Y_AXIS; setFloatOnClick(0, 1, 2, stepper.get_shaping_damping_ratio(Y_AXIS), applyShapingZeta); } #endif + #if ENABLED(INPUT_SHAPING_Z) + void onDrawShapingZFreq(MenuItem* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, stepper.get_shaping_frequency(Z_AXIS)); } + void onDrawShapingZZeta(MenuItem* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, stepper.get_shaping_damping_ratio(Z_AXIS)); } + void setShapingZFreq() { hmiValue.axis = Z_AXIS; setFloatOnClick(0, 200, 2, stepper.get_shaping_frequency(Z_AXIS), applyShapingFreq); } + void setShapingZZeta() { hmiValue.axis = Z_AXIS; setFloatOnClick(0, 1, 2, stepper.get_shaping_damping_ratio(Z_AXIS), applyShapingZeta); } + #endif + void drawInputShaping_menu() { checkkey = ID_Menu; if (SET_MENU(inputShapingMenu, MSG_INPUT_SHAPING, 5)) { @@ -3490,6 +3497,10 @@ void drawTuneMenu() { MENU_ITEM(ICON_ShapingY, MSG_SHAPING_B_FREQ, onDrawShapingYFreq, setShapingYFreq); MENU_ITEM(ICON_ShapingY, MSG_SHAPING_B_ZETA, onDrawShapingYZeta, setShapingYZeta); #endif + #if ENABLED(INPUT_SHAPING_Z) + MENU_ITEM(ICON_ShapingZ, MSG_SHAPING_C_FREQ, onDrawShapingZFreq, setShapingZFreq); + MENU_ITEM(ICON_ShapingZ, MSG_SHAPING_C_ZETA, onDrawShapingZZeta, setShapingZZeta); + #endif } updateMenu(inputShapingMenu); } diff --git a/Marlin/src/lcd/e3v2/proui/proui_extui.cpp b/Marlin/src/lcd/e3v2/proui/proui_extui.cpp index d7aad208cc..ae85a5a60c 100644 --- a/Marlin/src/lcd/e3v2/proui/proui_extui.cpp +++ b/Marlin/src/lcd/e3v2/proui/proui_extui.cpp @@ -65,8 +65,8 @@ namespace ExtUI { void onIdle() {} void onPrinterKilled(FSTR_P const error, FSTR_P const component) {} - void onMediaInserted() {} - void onMediaError() {} + void onMediaMounted() {} + void onMediaError() {} void onMediaRemoved() {} void onHeatingError(const heater_id_t heater_id) { diff --git a/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp b/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp index 78a8ffa3a2..b983fa3740 100644 --- a/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp +++ b/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp @@ -45,9 +45,9 @@ namespace ExtUI { chiron.printerKilled(error, component); } - void onMediaInserted() { chiron.mediaEvent(AC_media_inserted); } - void onMediaError() { chiron.mediaEvent(AC_media_error); } - void onMediaRemoved() { chiron.mediaEvent(AC_media_removed); } + void onMediaMounted() { chiron.mediaEvent(AC_media_inserted); } + void onMediaError() { chiron.mediaEvent(AC_media_error); } + void onMediaRemoved() { chiron.mediaEvent(AC_media_removed); } void onHeatingError(const heater_id_t header_id) {} void onMinTempError(const heater_id_t header_id) {} diff --git a/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp b/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp index 5e80b79acf..9e38face6f 100644 --- a/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp +++ b/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp @@ -564,8 +564,8 @@ void ChironTFT::panelInfo(uint8_t req) { } break; case 8: // A8 Get SD Card list A8 S0 - if (!isMediaInserted()) safe_delay(500); - if (!isMediaInserted()) // Make sure the card is removed + if (!isMediaMounted()) safe_delay(500); + if (!isMediaMounted()) // Make sure the card is removed tftSendLn(AC_msg_no_sd_card); else if (panel_command[3] == 'S') sendFileList( atoi( &panel_command[4] ) ); diff --git a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp index 79738fab10..7070c22602 100644 --- a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp +++ b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp @@ -39,7 +39,7 @@ namespace ExtUI { void onIdle() { anycubicTFT.onCommandScan(); } void onPrinterKilled(FSTR_P const error, FSTR_P const component) { anycubicTFT.onKillTFT(); } - void onMediaInserted() { anycubicTFT.onSDCardStateChange(true); } + void onMediaMounted() { anycubicTFT.onSDCardStateChange(true); } void onMediaError() { anycubicTFT.onSDCardError(); } void onMediaRemoved() { anycubicTFT.onSDCardStateChange(false); } diff --git a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp index abd32aa88c..66792ce5ca 100644 --- a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp +++ b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp @@ -138,8 +138,8 @@ void AnycubicTFT::onKillTFT() { SENDLINE_DBG_PGM("J11", "TFT Serial Debug: Kill command... J11"); } -void AnycubicTFT::onSDCardStateChange(bool isInserted) { - DEBUG_ECHOLNPGM("TFT Serial Debug: onSDCardStateChange event triggered...", isInserted); +void AnycubicTFT::onSDCardStateChange(bool isMounted) { + DEBUG_ECHOLNPGM("TFT Serial Debug: onSDCardStateChange event triggered...", isMounted); doSDCardStateCheck(); } @@ -363,7 +363,7 @@ void AnycubicTFT::renderCurrentFileList() { SENDLINE_PGM("FN "); // Filelist start - if (!isMediaInserted() && !specialMenu) { + if (!isMediaMounted() && !specialMenu) { SENDLINE_DBG_PGM("J02", "TFT Serial Debug: No SD Card mounted to render Current File List... J02"); SENDLINE_PGM(" 0) { FileList currentFileList; if ((selectedDirectory[0] == '.') && (selectedDirectory[1] == '.')) { @@ -883,12 +883,12 @@ void AnycubicTFT::getCommandFromTFT() { } void AnycubicTFT::doSDCardStateCheck() { - #if ALL(HAS_MEDIA, HAS_SD_DETECT) - bool isInserted = isMediaInserted(); - if (isInserted) - SENDLINE_DBG_PGM("J00", "TFT Serial Debug: SD card state changed... isInserted"); + #if HAS_MEDIA + const bool isMounted = isMediaMounted(); + if (isMounted) + SENDLINE_DBG_PGM("J00", "TFT Serial Debug: SD card state changed... isMounted"); else - SENDLINE_DBG_PGM("J01", "TFT Serial Debug: SD card state changed... !isInserted"); + SENDLINE_DBG_PGM("J01", "TFT Serial Debug: SD card state changed... !isMounted"); #endif } diff --git a/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp index 9fc9156f29..9be00411cc 100644 --- a/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp +++ b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp @@ -1268,7 +1268,7 @@ namespace Anycubic { break; case 4: // page refresh - if (!isMediaInserted()) safe_delay(500); + if (!isMediaMounted()) safe_delay(500); filenavigator.reset(); diff --git a/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp b/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp index b21bee7a7a..4b18b0a380 100644 --- a/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp +++ b/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp @@ -45,9 +45,9 @@ namespace ExtUI { dgus.printerKilled(error, component); } - void onMediaInserted() { dgus.mediaEvent(AC_media_inserted); } - void onMediaError() { dgus.mediaEvent(AC_media_error); } - void onMediaRemoved() { dgus.mediaEvent(AC_media_removed); } + void onMediaMounted() { dgus.mediaEvent(AC_media_inserted); } + void onMediaError() { dgus.mediaEvent(AC_media_error); } + void onMediaRemoved() { dgus.mediaEvent(AC_media_removed); } void onHeatingError(const heater_id_t header_id) {} void onMinTempError(const heater_id_t header_id) {} diff --git a/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp index 6b1632bfec..00876f10e1 100644 --- a/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp @@ -264,7 +264,7 @@ void DGUSScreenHandler::sendHeaterStatusToDisplay(DGUS_VP_Variable &var) { void DGUSScreenHandler::screenChangeHookIfSD(DGUS_VP_Variable &var, void *val_ptr) { // default action executed when there is a SD card, but not printing - if (ExtUI::isMediaInserted() && !ExtUI::isPrintingFromMedia()) { + if (ExtUI::isMediaMounted() && !ExtUI::isPrintingFromMedia()) { screenChangeHook(var, val_ptr); dgus.requestScreen(current_screenID); return; @@ -279,7 +279,7 @@ void DGUSScreenHandler::sendHeaterStatusToDisplay(DGUS_VP_Variable &var) { } // Don't let the user in the dark why there is no reaction. - if (!ExtUI::isMediaInserted()) { + if (!ExtUI::isMediaMounted()) { setStatusMessage(GET_TEXT_F(MSG_NO_MEDIA)); return; } diff --git a/Marlin/src/lcd/extui/dgus/dgus_extui.cpp b/Marlin/src/lcd/extui/dgus/dgus_extui.cpp index 2bc6e0d461..adc78caf07 100644 --- a/Marlin/src/lcd/extui/dgus/dgus_extui.cpp +++ b/Marlin/src/lcd/extui/dgus/dgus_extui.cpp @@ -48,9 +48,9 @@ namespace ExtUI { while (!screen.loop()); // Wait while anything is left to be sent } - void onMediaInserted() { TERN_(HAS_MEDIA, screen.sdCardInserted()); } - void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); } - void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); } + void onMediaMounted() { TERN_(HAS_MEDIA, screen.sdCardInserted()); } + void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); } + void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); } void onHeatingError(const heater_id_t header_id) {} void onMinTempError(const heater_id_t header_id) {} diff --git a/Marlin/src/lcd/extui/dgus_e3s1pro/DGUSDisplay.cpp b/Marlin/src/lcd/extui/dgus_e3s1pro/DGUSDisplay.cpp index b897466c6a..571626aa77 100644 --- a/Marlin/src/lcd/extui/dgus_e3s1pro/DGUSDisplay.cpp +++ b/Marlin/src/lcd/extui/dgus_e3s1pro/DGUSDisplay.cpp @@ -337,8 +337,8 @@ void DGUSDisplay::processRx() { size_t DGUSDisplay::getFreeTxBuffer() { return ( - #ifdef LCD_SERIAL_GET_TX_BUFFER_FREE - LCD_SERIAL_GET_TX_BUFFER_FREE() + #ifdef LCD_SERIAL_TX_BUFFER_FREE + LCD_SERIAL_TX_BUFFER_FREE() #else SIZE_MAX #endif diff --git a/Marlin/src/lcd/extui/dgus_e3s1pro/DGUSReturnKeyCodeHandler.cpp b/Marlin/src/lcd/extui/dgus_e3s1pro/DGUSReturnKeyCodeHandler.cpp index 342fa46cf3..0cc011b2f9 100644 --- a/Marlin/src/lcd/extui/dgus_e3s1pro/DGUSReturnKeyCodeHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_e3s1pro/DGUSReturnKeyCodeHandler.cpp @@ -72,7 +72,7 @@ void DGUSReturnKeyCodeHandler::Command_MenuSelect(DGUS_VP &vp, void *data) { break; case DGUS_Data::MenuSelectCommand::Print: - if (ExtUI::isMediaInserted()) { + if (ExtUI::isMediaMounted()) { dgus_sdcard_handler.Reset(); screen.triggerScreenChange(DGUS_ScreenID::FILE1); } @@ -241,7 +241,7 @@ void DGUSReturnKeyCodeHandler::Command_CheckOK(DGUS_VP &vp, void *data) { #endif // HAS_FILAMENT_SENSOR case DGUS_Data::CheckOKCommand::SDCardCheck_Yes: - if (ExtUI::isMediaInserted()) { + if (ExtUI::isMediaMounted()) { dgus_sdcard_handler.Reset(); screen.triggerScreenChange(DGUS_ScreenID::FILE1); } diff --git a/Marlin/src/lcd/extui/dgus_e3s1pro/DGUSTxHandler.cpp b/Marlin/src/lcd/extui/dgus_e3s1pro/DGUSTxHandler.cpp index 3a9ca9c762..c717740791 100644 --- a/Marlin/src/lcd/extui/dgus_e3s1pro/DGUSTxHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_e3s1pro/DGUSTxHandler.cpp @@ -84,7 +84,7 @@ void DGUSTxHandler::levelingProgressIcon(DGUS_VP &vp) { #endif void DGUSTxHandler::sdCardInsertionStatus(DGUS_VP &vp) { - const uint16_t data = ExtUI::isMediaInserted() ? 1 : 0; + const uint16_t data = ExtUI::isMediaMounted() ? 1 : 0; dgus.write((uint16_t)vp.addr, Endianness::toBE(data)); } diff --git a/Marlin/src/lcd/extui/dgus_e3s1pro/dgus_e3s1pro_extui.cpp b/Marlin/src/lcd/extui/dgus_e3s1pro/dgus_e3s1pro_extui.cpp index f3f4ff961c..3b3f6db5b2 100644 --- a/Marlin/src/lcd/extui/dgus_e3s1pro/dgus_e3s1pro_extui.cpp +++ b/Marlin/src/lcd/extui/dgus_e3s1pro/dgus_e3s1pro_extui.cpp @@ -55,9 +55,9 @@ namespace ExtUI { screen.printerKilled(error, component); } - void onMediaInserted() { TERN_(HAS_MEDIA, screen.sdCardInserted()); } - void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); } - void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); } + void onMediaMounted() { TERN_(HAS_MEDIA, screen.sdCardInserted()); } + void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); } + void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); } void onHeatingError(const heater_id_t header_id) {} void onMinTempError(const heater_id_t header_id) {} diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.cpp index 3127268180..741c36fde6 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.cpp @@ -334,8 +334,8 @@ void DGUSDisplay::processRx() { size_t DGUSDisplay::getFreeTxBuffer() { return ( - #ifdef LCD_SERIAL_GET_TX_BUFFER_FREE - LCD_SERIAL_GET_TX_BUFFER_FREE() + #ifdef LCD_SERIAL_TX_BUFFER_FREE + LCD_SERIAL_TX_BUFFER_FREE() #else SIZE_MAX #endif diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp index a93832da30..d408b49e83 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp @@ -49,7 +49,7 @@ void DGUSRxHandler::screenChange(DGUS_VP &vp, void *data_ptr) { #if HAS_MEDIA IF_DISABLED(HAS_SD_DETECT, card.mount()); - if (!ExtUI::isMediaInserted()) { + if (!ExtUI::isMediaMounted()) { screen.setStatusMessage(GET_TEXT_F(MSG_NO_MEDIA)); return; } diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp index 181d1ae34c..bb31a1d71a 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp @@ -149,7 +149,7 @@ void DGUSScreenHandler::loop() { void DGUSScreenHandler::printerKilled(FSTR_P const error, FSTR_P const component) { setMessageLine(error, 1); setMessageLine(component, 2); - setMessageLinePGM(NUL_STR, 3); + setMessageLine_P(NUL_STR, 3); setMessageLine(GET_TEXT_F(MSG_PLEASE_RESET), 4); dgus.playSound(3, 1, 200); @@ -158,10 +158,10 @@ void DGUSScreenHandler::printerKilled(FSTR_P const error, FSTR_P const component } void DGUSScreenHandler::userConfirmRequired(const char * const msg) { - setMessageLinePGM(NUL_STR, 1); + setMessageLine_P(NUL_STR, 1); setMessageLine(msg, 2); - setMessageLinePGM(NUL_STR, 3); - setMessageLinePGM(NUL_STR, 4); + setMessageLine_P(NUL_STR, 3); + setMessageLine_P(NUL_STR, 4); dgus.playSound(3); @@ -351,7 +351,7 @@ void DGUSScreenHandler::setMessageLine(const char * const msg, const uint8_t lin } } -void DGUSScreenHandler::setMessageLinePGM(PGM_P const msg, const uint8_t line) { +void DGUSScreenHandler::setMessageLine_P(PGM_P const msg, const uint8_t line) { switch (line) { default: return; case 1: @@ -389,10 +389,10 @@ void DGUSScreenHandler::showWaitScreen(const DGUS_ScreenID return_screenID, cons } void DGUSScreenHandler::showWaitScreen(FSTR_P const msg, const DGUS_ScreenID return_screenID, const bool has_continue/*=false*/) { - setMessageLinePGM(NUL_STR, 1); + setMessageLine_P(NUL_STR, 1); setMessageLine(msg, 2); - setMessageLinePGM(NUL_STR, 3); - setMessageLinePGM(NUL_STR, 4); + setMessageLine_P(NUL_STR, 3); + setMessageLine_P(NUL_STR, 4); showWaitScreen(return_screenID, has_continue); } diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h index ed8b163d87..d233ed6fe3 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h @@ -70,8 +70,8 @@ public: #endif static void setMessageLine(const char * const msg, const uint8_t line); - static void setMessageLinePGM(PGM_P const msg, const uint8_t line); - static void setMessageLine(FSTR_P const msg, const uint8_t line) { setMessageLinePGM(FTOP(msg), line); } + static void setMessageLine_P(PGM_P const msg, const uint8_t line); + static void setMessageLine(FSTR_P const msg, const uint8_t line) { setMessageLine_P(FTOP(msg), line); } static void setStatusMessage(const char* msg, const millis_t duration=DGUS_STATUS_EXPIRATION_MS); static void setStatusMessage(FSTR_P const msg, const millis_t duration=DGUS_STATUS_EXPIRATION_MS); diff --git a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp index fad878a212..9aeb06dba1 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp @@ -50,7 +50,7 @@ namespace ExtUI { screen.printerKilled(error, component); } - void onMediaInserted() { TERN_(HAS_MEDIA, screen.sdCardInserted()); } + void onMediaMounted() { TERN_(HAS_MEDIA, screen.sdCardInserted()); } void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); } void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); } diff --git a/Marlin/src/lcd/extui/example/example.cpp b/Marlin/src/lcd/extui/example/example.cpp index fb033b9655..05d4730149 100644 --- a/Marlin/src/lcd/extui/example/example.cpp +++ b/Marlin/src/lcd/extui/example/example.cpp @@ -48,7 +48,7 @@ namespace ExtUI { void onIdle() {} void onPrinterKilled(FSTR_P const error, FSTR_P const component) {} - void onMediaInserted() {} + void onMediaMounted() {} void onMediaError() {} void onMediaRemoved() {} diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/status_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/status_screen.cpp index 9fb56bce11..72a1d739f4 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/status_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/status_screen.cpp @@ -244,7 +244,7 @@ void StatusScreen::draw_overlay_icons(draw_mode_t what) { void StatusScreen::draw_buttons(draw_mode_t what) { int16_t x, y, h, v; - const bool has_media = isMediaInserted() && !isPrintingFromMedia(); + const bool has_media = isMediaMounted() && !isPrintingFromMedia(); CommandProcessor cmd; PolyUI ui(cmd, what); diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.cpp index 421d90bf7f..b273ac7dde 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.cpp @@ -227,8 +227,8 @@ void StatusScreen::draw_buttons(draw_mode_t what) { if (what & FOREGROUND) { int16_t x, y, w, h; - const bool can_print = !isPrinting() && isMediaInserted() && isFileSelected(); - const bool can_select = !isPrinting() && isMediaInserted(); + const bool can_print = !isPrinting() && isMediaMounted() && isFileSelected(); + const bool can_select = !isPrinting() && isMediaMounted(); const bool sdOrHostPrinting = ExtUI::isPrinting(); const bool sdOrHostPaused = ExtUI::isPrintingPaused(); @@ -284,7 +284,7 @@ void StatusScreen::draw_file(draw_mode_t what) { .cmd (BITMAP_SIZE (File_Icon_Info)) .icon(ICON_POS(x, y, w, h), File_Icon_Info, icon_scale); - if (!isMediaInserted()) + if (!isMediaMounted()) draw_text_with_ellipsis(cmd, TEXT_POS(x, y, w, h), F("No media present"), OPT_CENTERY, font_small); else if (isFileSelected()) { FileList list; @@ -311,7 +311,7 @@ void StatusScreen::draw_message(draw_mode_t what, const char *message) { } bool StatusScreen::isFileSelected() { - if (!isMediaInserted()) return false; + if (!isMediaMounted()) return false; FileList list; if (list.isDir()) return false; const char *filename = list.filename(); @@ -431,7 +431,7 @@ void StatusScreen::onIdle() { } } -void StatusScreen::onMediaInserted() { +void StatusScreen::onMediaMounted() { if (AT_SCREEN(StatusScreen)) setStatusMessage(GET_TEXT_F(MSG_MEDIA_INSERTED)); } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.h index 57cf2308ab..4833bbd941 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.h +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.h @@ -58,6 +58,6 @@ class StatusScreen : public BaseScreen, public CachedScreen 9) autoHomeIconNum = 0; } - if (isMediaInserted()) { + if (isMediaMounted()) { const uint16_t currPage = fileIndex == 0 ? 1 : CEIL(float(fileIndex) / float(DISPLAY_FILES)) + 1, maxPageAdd = filenavigator.folderdepth ? 1 : 0, maxPages = CEIL(float(filenavigator.maxFiles() + maxPageAdd) / float(DISPLAY_FILES) ); @@ -1488,7 +1488,7 @@ void RTS::handleData() { } break; case Filename: { - if (isMediaInserted() && recdat.addr == FilenameChs) { + if (isMediaMounted() && recdat.addr == FilenameChs) { recordcount = recdat.data[0] - 1; if (filenavigator.currentindex == 0 && filenavigator.folderdepth > 0 && (fileIndex + recordcount) == 0) { @@ -1521,7 +1521,7 @@ void RTS::handleData() { } } else if (recdat.addr == FilenamePlay) { - if (recdat.data[0] == 1 && isMediaInserted()) { // for sure + if (recdat.data[0] == 1 && isMediaMounted()) { // for sure printFile(filenavigator.getIndexName(fileIndex + recordcount)); for (int16_t j = 0; j < 10; j++) // clean screen. diff --git a/Marlin/src/lcd/extui/malyan/malyan_extui.cpp b/Marlin/src/lcd/extui/malyan/malyan_extui.cpp index 9287091cfe..3ed4678a41 100644 --- a/Marlin/src/lcd/extui/malyan/malyan_extui.cpp +++ b/Marlin/src/lcd/extui/malyan/malyan_extui.cpp @@ -141,7 +141,7 @@ namespace ExtUI { // Not needed for Malyan LCD void onStatusChanged(const char * const) {} - void onMediaInserted() {} + void onMediaMounted() {} void onMediaError() {} void onMediaRemoved() {} diff --git a/Marlin/src/lcd/extui/nextion/nextion_extui.cpp b/Marlin/src/lcd/extui/nextion/nextion_extui.cpp index 3b8d88bad7..570624afcc 100644 --- a/Marlin/src/lcd/extui/nextion/nextion_extui.cpp +++ b/Marlin/src/lcd/extui/nextion/nextion_extui.cpp @@ -39,7 +39,7 @@ namespace ExtUI { void onIdle() { nextion.idleLoop(); } void onPrinterKilled(FSTR_P const error, FSTR_P const component) { nextion.printerKilled(error, component); } - void onMediaInserted() {} + void onMediaMounted() {} void onMediaError() {} void onMediaRemoved() {} diff --git a/Marlin/src/lcd/extui/nextion/nextion_tft.cpp b/Marlin/src/lcd/extui/nextion/nextion_tft.cpp index 0474328650..9ebd783124 100644 --- a/Marlin/src/lcd/extui/nextion/nextion_tft.cpp +++ b/Marlin/src/lcd/extui/nextion/nextion_tft.cpp @@ -210,8 +210,8 @@ void NextionTFT::panelInfo(uint8_t req) { case 1: // Get SD Card list if (!isPrinting()) { - if (!isMediaInserted()) safe_delay(500); - if (!isMediaInserted()) { // Make sure the card is removed + if (!isMediaMounted()) safe_delay(500); + if (!isMediaMounted()) { // Make sure the card is removed //SEND_TXT("tmppage.M117", msg_no_sd_card); } else if (nextion_command[3] == 'S') diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index 74463bdf5c..5c7246d4cd 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -1169,7 +1169,7 @@ namespace ExtUI { return isPrinting() && (isPrintingFromMediaPaused() || print_job_timer.isPaused()); } - bool isMediaInserted() { return TERN0(HAS_MEDIA, IS_SD_INSERTED()); } + bool isMediaMounted() { return TERN0(HAS_MEDIA, card.isMounted()); } // Pause/Resume/Stop are implemented in MarlinUI void pausePrint() { ui.pause_print(); } diff --git a/Marlin/src/lcd/extui/ui_api.h b/Marlin/src/lcd/extui/ui_api.h index 8202f7be8d..7065e21f8f 100644 --- a/Marlin/src/lcd/extui/ui_api.h +++ b/Marlin/src/lcd/extui/ui_api.h @@ -100,7 +100,7 @@ namespace ExtUI { /** * The Extensible UI API is a utility class that can be used to implement: - * - An LCD view that responds to standard events, e.g., onMediaInserted(...) + * - An LCD view that responds to standard events, e.g., onMediaMounted(...) * - An LCD that polls firmware states and settings in a standard manner. * (e.g., With tool indexes and extruder indexes). * - Standard hooks to send data to a serial-based controller. @@ -451,7 +451,7 @@ namespace ExtUI { * Media access routines * Use these to operate on files */ - bool isMediaInserted(); + bool isMediaMounted(); bool isPrintingFromMediaPaused(); bool isPrintingFromMedia(); bool isPrinting(); @@ -486,7 +486,7 @@ namespace ExtUI { void onStartup(); void onIdle(); - void onMediaInserted(); + void onMediaMounted(); void onMediaError(); void onMediaRemoved(); diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 930a87a520..5b83f0c6bf 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -1647,11 +1647,11 @@ void MarlinUI::host_notify(const char * const cstr) { // // Send the status line as a host notification // - void MarlinUI::_set_status(const char * const cstr, const bool, const bool pgm) { - host_notify(cstr); + void MarlinUI::_set_status(const char * const ustr, const bool, const bool pgm) { + host_notify(ustr); } - void MarlinUI::_set_alert(const char * const cstr, const int8_t, const bool pgm) { - host_notify(cstr); + void MarlinUI::_set_alert(const char * const ustr, const int8_t, const bool pgm) { + host_notify(ustr); } void MarlinUI::_set_status_and_level(const char * const ustr, const int8_t=0, const bool pgm) { pgm ? host_notify_P(ustr) : host_notify(ustr); @@ -1835,7 +1835,7 @@ void MarlinUI::host_notify(const char * const cstr) { if (status) { if (old_status < 2) { #if ENABLED(EXTENSIBLE_UI) - ExtUI::onMediaInserted(); + ExtUI::onMediaMounted(); #elif ENABLED(BROWSE_MEDIA_ON_INSERT) clear_menu_history(); quick_feedback(); diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index 53300a4400..835102546d 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -182,7 +182,7 @@ typedef bool (*statusResetFunc_t)(); static bool constexpr processing = false; #endif static void task(); - static void soon(const AxisEnum axis OPTARG(MULTI_E_MANUAL, const int8_t eindex=active_extruder)); + static void soon(const AxisEnum move_axis OPTARG(MULTI_E_MANUAL, const int8_t eindex=active_extruder)); }; void lcd_move_axis(const AxisEnum); @@ -370,7 +370,7 @@ public: static constexpr uint8_t get_progress_percent() { return 0; } #endif - static void host_notify_P(PGM_P const fstr); + static void host_notify_P(PGM_P const pstr); static void host_notify(FSTR_P const fstr) { host_notify_P(FTOP(fstr)); } static void host_notify(const char * const cstr); diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 38d56bf912..b7825949c0 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -559,28 +559,20 @@ void menu_backlash(); BACK_ITEM(MSG_ADVANCED_SETTINGS); // M593 F Frequency and D Damping ratio - #if ENABLED(INPUT_SHAPING_X) - editable.decimal = stepper.get_shaping_frequency(X_AXIS); - if (editable.decimal) { - ACTION_ITEM_N(X_AXIS, MSG_SHAPING_DISABLE, []{ stepper.set_shaping_frequency(X_AXIS, 0.0f); ui.refresh(); }); - EDIT_ITEM_FAST_N(float41, 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) ?: (SHAPING_MIN_FREQ)); ui.refresh(); }); - #endif - #if ENABLED(INPUT_SHAPING_Y) - editable.decimal = stepper.get_shaping_frequency(Y_AXIS); - if (editable.decimal) { - ACTION_ITEM_N(Y_AXIS, MSG_SHAPING_DISABLE, []{ stepper.set_shaping_frequency(Y_AXIS, 0.0f); ui.refresh(); }); - EDIT_ITEM_FAST_N(float41, 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) ?: (SHAPING_MIN_FREQ)); ui.refresh(); }); - #endif + #define SHAPING_MENU_FOR_AXIS(AXIS) \ + editable.decimal = stepper.get_shaping_frequency(AXIS); \ + if (editable.decimal) { \ + ACTION_ITEM_N(AXIS, MSG_SHAPING_DISABLE, []{ stepper.set_shaping_frequency(AXIS, 0.0f); ui.refresh(); }); \ + EDIT_ITEM_FAST_N(float41, AXIS, MSG_SHAPING_FREQ, &editable.decimal, min_frequency, 200.0f, []{ stepper.set_shaping_frequency(AXIS, editable.decimal); }); \ + editable.decimal = stepper.get_shaping_damping_ratio(AXIS); \ + EDIT_ITEM_FAST_N(float42_52, AXIS, MSG_SHAPING_ZETA, &editable.decimal, 0.0f, 1.0f, []{ stepper.set_shaping_damping_ratio(AXIS, editable.decimal); }); \ + } \ + else \ + ACTION_ITEM_N(AXIS, MSG_SHAPING_ENABLE, []{ stepper.set_shaping_frequency(AXIS, (SHAPING_FREQ_X) ?: (SHAPING_MIN_FREQ)); ui.refresh(); }); + + TERN_(INPUT_SHAPING_X, SHAPING_MENU_FOR_AXIS(X_AXIS)) + TERN_(INPUT_SHAPING_Y, SHAPING_MENU_FOR_AXIS(Y_AXIS)) + TERN_(INPUT_SHAPING_Z, SHAPING_MENU_FOR_AXIS(Z_AXIS)) END_MENU(); } diff --git a/Marlin/src/lcd/menu/menu_bed_tramming.cpp b/Marlin/src/lcd/menu/menu_bed_tramming.cpp index f33b8b812c..d749763808 100644 --- a/Marlin/src/lcd/menu/menu_bed_tramming.cpp +++ b/Marlin/src/lcd/menu/menu_bed_tramming.cpp @@ -176,6 +176,9 @@ static void _lcd_goto_next_corner() { uint8_t cy = TERN(TFT_COLOR_UI, 3, LCD_HEIGHT - 1), y = LCD_ROW_Y(cy); + // Enable font background for DWIN + TERN_(IS_DWIN_MARLINUI, dwin_font.solid = true); + // Display # of good points found vs total needed if (PAGE_CONTAINS(y - (MENU_FONT_HEIGHT), y)) { SETCURSOR(TERN(TFT_COLOR_UI, 2, 0), cy); diff --git a/Marlin/src/lcd/tft/images/time_elapsed_32x32x4.cpp b/Marlin/src/lcd/tft/images/time_elapsed_32x32x4.cpp index 74947f9ce5..9976870032 100644 --- a/Marlin/src/lcd/tft/images/time_elapsed_32x32x4.cpp +++ b/Marlin/src/lcd/tft/images/time_elapsed_32x32x4.cpp @@ -17,7 +17,8 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - **/ + * + */ #include "../../../inc/MarlinConfigPre.h" diff --git a/Marlin/src/lcd/tft/images/time_remaining_32x32x4.cpp b/Marlin/src/lcd/tft/images/time_remaining_32x32x4.cpp index aa3db49164..60930bc2af 100644 --- a/Marlin/src/lcd/tft/images/time_remaining_32x32x4.cpp +++ b/Marlin/src/lcd/tft/images/time_remaining_32x32x4.cpp @@ -17,7 +17,8 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - **/ + * + */ #include "../../../inc/MarlinConfigPre.h" diff --git a/Marlin/src/lcd/tft/touch.cpp b/Marlin/src/lcd/tft/touch.cpp index 8ebfc91409..7fc5f2fa21 100644 --- a/Marlin/src/lcd/tft/touch.cpp +++ b/Marlin/src/lcd/tft/touch.cpp @@ -217,7 +217,7 @@ void Touch::touch(touch_control_t *control) { static uint8_t fan, fan_speed; fan = 0; fan_speed = thermalManager.fan_speed[fan]; - MenuItem_percent::action(GET_TEXT_F(MSG_FIRST_FAN_SPEED), &fan_speed, 0, 255, []{ thermalManager.set_fan_speed(fan, fan_speed); }); + MenuItem_percent::action(GET_TEXT_F(MSG_FIRST_FAN_SPEED), &fan_speed, 0, 255, []{ thermalManager.set_fan_speed(fan, fan_speed); TERN_(LASER_SYNCHRONOUS_M106_M107, planner.buffer_sync_block(BLOCK_BIT_SYNC_FANS));}); break; case FEEDRATE: ui.clear_lcd(); diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 17b8ae4d72..a9f2f888bf 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -634,6 +634,10 @@ typedef struct SettingsDataStruct { float shaping_y_frequency, // M593 Y F shaping_y_zeta; // M593 Y D #endif + #if ENABLED(INPUT_SHAPING_Z) + float shaping_z_frequency, // M593 Z F + shaping_z_zeta; // M593 Z D + #endif // // HOTEND_IDLE_TIMEOUT @@ -1731,6 +1735,10 @@ void MarlinSettings::postprocess() { EEPROM_WRITE(stepper.get_shaping_frequency(Y_AXIS)); EEPROM_WRITE(stepper.get_shaping_damping_ratio(Y_AXIS)); #endif + #if ENABLED(INPUT_SHAPING_Z) + EEPROM_WRITE(stepper.get_shaping_frequency(Z_AXIS)); + EEPROM_WRITE(stepper.get_shaping_damping_ratio(Z_AXIS)); + #endif #endif // @@ -2813,22 +2821,33 @@ void MarlinSettings::postprocess() { // #if ENABLED(INPUT_SHAPING_X) { - float _data[2]; + struct { float freq, damp; } _data; EEPROM_READ(_data); if (!validating) { - stepper.set_shaping_frequency(X_AXIS, _data[0]); - stepper.set_shaping_damping_ratio(X_AXIS, _data[1]); + stepper.set_shaping_frequency(X_AXIS, _data.freq); + stepper.set_shaping_damping_ratio(X_AXIS, _data.damp); } } #endif #if ENABLED(INPUT_SHAPING_Y) { - float _data[2]; + struct { float freq, damp; } _data; EEPROM_READ(_data); if (!validating) { - stepper.set_shaping_frequency(Y_AXIS, _data[0]); - stepper.set_shaping_damping_ratio(Y_AXIS, _data[1]); + stepper.set_shaping_frequency(Y_AXIS, _data.freq); + stepper.set_shaping_damping_ratio(Y_AXIS, _data.damp); + } + } + #endif + + #if ENABLED(INPUT_SHAPING_Z) + { + struct { float freq, damp; } _data; + EEPROM_READ(_data); + if (!validating) { + stepper.set_shaping_frequency(Z_AXIS, _data.freq); + stepper.set_shaping_damping_ratio(Z_AXIS, _data.damp); } } #endif @@ -3665,6 +3684,10 @@ void MarlinSettings::reset() { stepper.set_shaping_frequency(Y_AXIS, SHAPING_FREQ_Y); stepper.set_shaping_damping_ratio(Y_AXIS, SHAPING_ZETA_Y); #endif + #if ENABLED(INPUT_SHAPING_Z) + stepper.set_shaping_frequency(Z_AXIS, SHAPING_FREQ_Z); + stepper.set_shaping_damping_ratio(Z_AXIS, SHAPING_ZETA_Z); + #endif #endif // diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 33c9b59367..89b1968ae4 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -281,20 +281,16 @@ uint32_t Stepper::advance_divisor = 0, 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 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 + #define SHAPING_VAR_DEFS(AXIS) \ + shaping_time_t ShapingQueue::delay_##AXIS; \ + shaping_time_t ShapingQueue::_peek_##AXIS = shaping_time_t(-1); \ + uint16_t ShapingQueue::head_##AXIS = 0; \ + uint16_t ShapingQueue::_free_count_##AXIS = shaping_echoes - 1; \ + ShapeParams Stepper::shaping_##AXIS; + + TERN_(INPUT_SHAPING_X, SHAPING_VAR_DEFS(x)) + TERN_(INPUT_SHAPING_Y, SHAPING_VAR_DEFS(y)) + TERN_(INPUT_SHAPING_Z, SHAPING_VAR_DEFS(z)) #endif #if ENABLED(BABYSTEPPING) @@ -1645,6 +1641,7 @@ void Stepper::isr() { interval = _MIN(nextMainISR, uint32_t(HAL_TIMER_TYPE_MAX)); // Time until the next Pulse / Block phase TERN_(INPUT_SHAPING_X, NOMORE(interval, ShapingQueue::peek_x())); // Time until next input shaping echo for X TERN_(INPUT_SHAPING_Y, NOMORE(interval, ShapingQueue::peek_y())); // Time until next input shaping echo for Y + TERN_(INPUT_SHAPING_Z, NOMORE(interval, ShapingQueue::peek_z())); // Time until next input shaping echo for Z TERN_(LIN_ADVANCE, NOMORE(interval, nextAdvanceISR)); // Come back early for Linear Advance? TERN_(BABYSTEPPING, NOMORE(interval, nextBabystepISR)); // Come back early for Babystepping? @@ -1789,6 +1786,10 @@ void Stepper::pulse_phase_isr() { shaping_y.delta_error = 0; shaping_y.last_block_end_pos = count_position.y; #endif + #if ENABLED(INPUT_SHAPING_Z) + shaping_z.delta_error = 0; + shaping_z.last_block_end_pos = count_position.z; + #endif #endif } } @@ -1848,6 +1849,12 @@ void Stepper::pulse_phase_isr() { #else #define HYSTERESIS_Y 0 #endif + #if AXIS_DRIVER_TYPE_Z(TMC2208) || AXIS_DRIVER_TYPE_Z(TMC2208_STANDALONE) || \ + AXIS_DRIVER_TYPE_Z(TMC5160) || AXIS_DRIVER_TYPE_Z(TMC5160_STANDALONE) + #define HYSTERESIS_Z 64 + #else + #define HYSTERESIS_Z 0 + #endif #define _HYSTERESIS(AXIS) HYSTERESIS_##AXIS #define HYSTERESIS(AXIS) _HYSTERESIS(AXIS) @@ -2040,9 +2047,10 @@ void Stepper::pulse_phase_isr() { #if HAS_ZV_SHAPING // record an echo if a step is needed in the primary bresenham const bool x_step = TERN0(INPUT_SHAPING_X, step_needed.x && shaping_x.enabled), - y_step = TERN0(INPUT_SHAPING_Y, step_needed.y && shaping_y.enabled); - 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)); + y_step = TERN0(INPUT_SHAPING_Y, step_needed.y && shaping_y.enabled), + z_step = TERN0(INPUT_SHAPING_Z, step_needed.z && shaping_z.enabled); + if (x_step || y_step || z_step) + ShapingQueue::enqueue(x_step, TERN0(INPUT_SHAPING_X, shaping_x.forward), y_step, TERN0(INPUT_SHAPING_Y, shaping_y.forward), z_step, TERN0(INPUT_SHAPING_Z, shaping_z.forward)); // do the first part of the secondary bresenham #if ENABLED(INPUT_SHAPING_X) @@ -2053,6 +2061,10 @@ void Stepper::pulse_phase_isr() { if (y_step) PULSE_PREP_SHAPING(Y, shaping_y.delta_error, shaping_y.forward ? shaping_y.factor1 : -shaping_y.factor1); #endif + #if ENABLED(INPUT_SHAPING_Z) + if (z_step) + PULSE_PREP_SHAPING(Z, shaping_z.delta_error, shaping_z.forward ? shaping_z.factor1 : -shaping_z.factor1); + #endif #endif } @@ -2159,6 +2171,7 @@ void Stepper::pulse_phase_isr() { // Clear the echoes that are ready to process. If the buffers are too full and risk overflow, also apply echoes early. TERN_(INPUT_SHAPING_X, step_needed.x = !ShapingQueue::peek_x() || ShapingQueue::free_count_x() < steps_per_isr); TERN_(INPUT_SHAPING_Y, step_needed.y = !ShapingQueue::peek_y() || ShapingQueue::free_count_y() < steps_per_isr); + TERN_(INPUT_SHAPING_Z, step_needed.z = !ShapingQueue::peek_z() || ShapingQueue::free_count_z() < steps_per_isr); if (bool(step_needed)) while (true) { #if ENABLED(INPUT_SHAPING_X) @@ -2177,6 +2190,14 @@ void Stepper::pulse_phase_isr() { } #endif + #if ENABLED(INPUT_SHAPING_Z) + if (step_needed.z) { + const bool forward = ShapingQueue::dequeue_z(); + PULSE_PREP_SHAPING(Z, shaping_z.delta_error, (forward ? shaping_z.factor2 : -shaping_z.factor2)); + PULSE_START(Z); + } + #endif + TERN_(I2S_STEPPER_STREAM, i2s_push_sample()); USING_TIMED_PULSE(); @@ -2191,10 +2212,14 @@ void Stepper::pulse_phase_isr() { #if ENABLED(INPUT_SHAPING_Y) PULSE_STOP(Y); #endif + #if ENABLED(INPUT_SHAPING_Z) + PULSE_STOP(Z); + #endif } TERN_(INPUT_SHAPING_X, step_needed.x = !ShapingQueue::peek_x() || ShapingQueue::free_count_x() < steps_per_isr); TERN_(INPUT_SHAPING_Y, step_needed.y = !ShapingQueue::peek_y() || ShapingQueue::free_count_y() < steps_per_isr); + TERN_(INPUT_SHAPING_Z, step_needed.z = !ShapingQueue::peek_z() || ShapingQueue::free_count_z() < steps_per_isr); if (!bool(step_needed)) break; @@ -2743,7 +2768,7 @@ hal_timer_t Stepper::block_phase_isr() { } #endif - // Y follows the same logic as X (but the comments aren't repeated) + // Y and Z follow the same logic as X (but the comments aren't repeated) #if ENABLED(INPUT_SHAPING_Y) if (shaping_y.enabled) { const int64_t steps = current_block->direction_bits.y ? int64_t(current_block->steps.y) : -int64_t(current_block->steps.y); @@ -2753,6 +2778,15 @@ hal_timer_t Stepper::block_phase_isr() { } #endif + #if ENABLED(INPUT_SHAPING_Z) + if (shaping_z.enabled) { + const int64_t steps = current_block->direction_bits.z ? int64_t(current_block->steps.z) : -int64_t(current_block->steps.z); + shaping_z.last_block_end_pos += steps; + shaping_z.forward = current_block->direction_bits.z; + if (!ShapingQueue::empty_z()) current_block->direction_bits.z = last_direction_bits.z; + } + #endif + // No step events completed so far step_events_completed = 0; @@ -3255,12 +3289,14 @@ void Stepper::init() { hal.isr_off(); 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; }) + TERN_(INPUT_SHAPING_Z, if (axis == Z_AXIS) { shaping_z.factor2 = factor2; shaping_z.factor1 = 128 - factor2; shaping_z.zeta = zeta; }) if (was_on) hal.isr_on(); } float Stepper::get_shaping_damping_ratio(const AxisEnum axis) { TERN_(INPUT_SHAPING_X, if (axis == X_AXIS) return shaping_x.zeta); TERN_(INPUT_SHAPING_Y, if (axis == Y_AXIS) return shaping_y.zeta); + TERN_(INPUT_SHAPING_Z, if (axis == Z_AXIS) return shaping_z.zeta); return -1; } @@ -3272,24 +3308,18 @@ void Stepper::init() { 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; + #define SHAPING_SET_FREQ_FOR_AXIS(AXISN, AXISL) \ + if (axis == AXISN) { \ + ShapingQueue::set_delay(AXISN, delay); \ + shaping_##AXISL.frequency = freq; \ + shaping_##AXISL.enabled = !!freq; \ + shaping_##AXISL.delta_error = 0; \ + shaping_##AXISL.last_block_end_pos = count_position.AXISL; \ } - #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 + + TERN_(INPUT_SHAPING_X, SHAPING_SET_FREQ_FOR_AXIS(X_AXIS, x)) + TERN_(INPUT_SHAPING_Y, SHAPING_SET_FREQ_FOR_AXIS(Y_AXIS, y)) + TERN_(INPUT_SHAPING_Z, SHAPING_SET_FREQ_FOR_AXIS(Z_AXIS, z)) if (was_on) hal.isr_on(); } @@ -3297,6 +3327,7 @@ void Stepper::init() { float Stepper::get_shaping_frequency(const AxisEnum axis) { TERN_(INPUT_SHAPING_X, if (axis == X_AXIS) return shaping_x.frequency); TERN_(INPUT_SHAPING_Y, if (axis == Y_AXIS) return shaping_y.frequency); + TERN_(INPUT_SHAPING_Z, if (axis == Z_AXIS) return shaping_z.frequency); return -1; } @@ -3318,6 +3349,9 @@ void Stepper::_set_position(const abce_long_t &spos) { #if ENABLED(INPUT_SHAPING_Y) const int32_t y_shaping_delta = count_position.y - shaping_y.last_block_end_pos; #endif + #if ENABLED(INPUT_SHAPING_Z) + const int32_t z_shaping_delta = count_position.z - shaping_z.last_block_end_pos; + #endif #if ANY(IS_CORE, MARKFORGED_XY, MARKFORGED_YX) // Core equations follow the form of the dA and dB equations at https://www.corexy.com/theory.html @@ -3358,6 +3392,12 @@ void Stepper::_set_position(const abce_long_t &spos) { shaping_y.last_block_end_pos = spos.y; } #endif + #if ENABLED(INPUT_SHAPING_Z) + if (shaping_z.enabled) { + count_position.z += z_shaping_delta; + shaping_z.last_block_end_pos = spos.z; + } + #endif } /** @@ -3399,6 +3439,7 @@ void Stepper::set_axis_position(const AxisEnum a, const int32_t &v) { 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); + TERN_(INPUT_SHAPING_Z, if (a == Z_AXIS) shaping_z.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 7c4e093d82..b13a92892e 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -143,7 +143,8 @@ constexpr ena_mask_t enable_overlap[] = { constexpr float _ISDASU[] = DEFAULT_AXIS_STEPS_PER_UNIT; constexpr feedRate_t _ISDMF[] = DEFAULT_MAX_FEEDRATE; constexpr float max_shaped_rate = TERN0(INPUT_SHAPING_X, _ISDMF[X_AXIS] * _ISDASU[X_AXIS]) + - TERN0(INPUT_SHAPING_Y, _ISDMF[Y_AXIS] * _ISDASU[Y_AXIS]); + TERN0(INPUT_SHAPING_Y, _ISDMF[Y_AXIS] * _ISDASU[Y_AXIS]) + + TERN0(INPUT_SHAPING_Z, _ISDMF[Z_AXIS] * _ISDASU[Z_AXIS]); #if defined(__AVR__) || !defined(ADAPTIVE_STEP_SMOOTHING) // MIN_STEP_ISR_FREQUENCY is known at compile time on AVRs and any reduction in SRAM is welcome template constexpr float max_isr_rate() { @@ -159,7 +160,7 @@ constexpr ena_mask_t enable_overlap[] = { #endif #ifndef SHAPING_MIN_FREQ - #define SHAPING_MIN_FREQ _MIN(__FLT_MAX__ OPTARG(INPUT_SHAPING_X, SHAPING_FREQ_X) OPTARG(INPUT_SHAPING_Y, SHAPING_FREQ_Y)) + #define SHAPING_MIN_FREQ _MIN(__FLT_MAX__ OPTARG(INPUT_SHAPING_X, SHAPING_FREQ_X) OPTARG(INPUT_SHAPING_Y, SHAPING_FREQ_Y) OPTARG(INPUT_SHAPING_Z, SHAPING_FREQ_Z)) #endif constexpr float shaping_min_freq = SHAPING_MIN_FREQ; constexpr uint16_t shaping_echoes = FLOOR(max_step_rate / shaping_min_freq / 2) + 3; @@ -169,6 +170,7 @@ constexpr ena_mask_t enable_overlap[] = { struct shaping_echo_axis_t { TERN_(INPUT_SHAPING_X, shaping_echo_t x:2); TERN_(INPUT_SHAPING_Y, shaping_echo_t y:2); + TERN_(INPUT_SHAPING_Z, shaping_echo_t z:2); }; class ShapingQueue { @@ -178,96 +180,89 @@ constexpr ena_mask_t enable_overlap[] = { 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 - #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 + #define SHAPING_QUEUE_AXIS_VARS(AXIS) \ + static shaping_time_t delay_##AXIS; /* = shaping_time_t(-1) to disable queueing*/ \ + static shaping_time_t _peek_##AXIS; \ + static uint16_t head_##AXIS; \ + static uint16_t _free_count_##AXIS; + + TERN_(INPUT_SHAPING_X, SHAPING_QUEUE_AXIS_VARS(x)) + TERN_(INPUT_SHAPING_Y, SHAPING_QUEUE_AXIS_VARS(y)) + TERN_(INPUT_SHAPING_Z, SHAPING_QUEUE_AXIS_VARS(z)) public: 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); + TERN_(INPUT_SHAPING_X, if (_peek_x != shaping_time_t(-1)) _peek_x -= interval); + TERN_(INPUT_SHAPING_Y, if (_peek_y != shaping_time_t(-1)) _peek_y -= interval); + TERN_(INPUT_SHAPING_Z, if (_peek_z != shaping_time_t(-1)) _peek_z -= interval); } static void set_delay(const AxisEnum axis, const shaping_time_t delay) { TERN_(INPUT_SHAPING_X, if (axis == X_AXIS) delay_x = delay); TERN_(INPUT_SHAPING_Y, if (axis == Y_AXIS) delay_y = delay); + TERN_(INPUT_SHAPING_Z, if (axis == Z_AXIS) delay_z = delay); } - static void enqueue(const bool x_step, const bool x_forward, const bool y_step, const bool y_forward) { - #if ENABLED(INPUT_SHAPING_X) - if (x_step) { - if (head_x == tail) peek_x_val = delay_x; - echo_axes[tail].x = x_forward ? ECHO_FWD : ECHO_BWD; - _free_count_x--; + + static void enqueue(const bool x_step, const bool x_forward, const bool y_step, const bool y_forward, const bool z_step, const bool z_forward) { + #define SHAPING_QUEUE_ENQUEUE(AXIS) \ + if (AXIS##_step) { \ + if (head_##AXIS == tail) _peek_##AXIS = delay_##AXIS; \ + echo_axes[tail].AXIS = AXIS##_forward ? ECHO_FWD : ECHO_BWD; \ + _free_count_##AXIS--; \ + } \ + else { \ + echo_axes[tail].AXIS = ECHO_NONE; \ + if (head_##AXIS != tail) \ + _free_count_##AXIS--; \ + else if (++head_##AXIS == shaping_echoes) \ + head_##AXIS = 0; \ } - else { - echo_axes[tail].x = ECHO_NONE; - if (head_x != tail) - _free_count_x--; - else if (++head_x == shaping_echoes) - head_x = 0; - } - #endif - #if ENABLED(INPUT_SHAPING_Y) - if (y_step) { - if (head_y == tail) peek_y_val = delay_y; - echo_axes[tail].y = y_forward ? ECHO_FWD : ECHO_BWD; - _free_count_y--; - } - else { - echo_axes[tail].y = ECHO_NONE; - if (head_y != tail) - _free_count_y--; - else if (++head_y == shaping_echoes) - head_y = 0; - } - #endif + + TERN_(INPUT_SHAPING_X, SHAPING_QUEUE_ENQUEUE(x)) + TERN_(INPUT_SHAPING_Y, SHAPING_QUEUE_ENQUEUE(y)) + TERN_(INPUT_SHAPING_Z, SHAPING_QUEUE_ENQUEUE(z)) + times[tail] = now; if (++tail == shaping_echoes) tail = 0; } + + #define SHAPING_QUEUE_DEQUEUE(AXIS) \ + bool forward = echo_axes[head_##AXIS].AXIS == ECHO_FWD; \ + do { \ + _free_count_##AXIS++; \ + if (++head_##AXIS == shaping_echoes) head_##AXIS = 0; \ + } while (head_##AXIS != tail && echo_axes[head_##AXIS].AXIS == ECHO_NONE); \ + _peek_##AXIS = head_##AXIS == tail ? shaping_time_t(-1) : times[head_##AXIS] + delay_##AXIS - now; \ + return forward; + #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; - } + static shaping_time_t peek_x() { return _peek_x; } + static bool dequeue_x() { SHAPING_QUEUE_DEQUEUE(x) } static bool empty_x() { return head_x == tail; } static uint16_t free_count_x() { return _free_count_x; } #endif #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; - } + static shaping_time_t peek_y() { return _peek_y; } + static bool dequeue_y() { SHAPING_QUEUE_DEQUEUE(y) } static bool empty_y() { return head_y == tail; } static uint16_t free_count_y() { return _free_count_y; } #endif + #if ENABLED(INPUT_SHAPING_Z) + static shaping_time_t peek_z() { return _peek_z; } + static bool dequeue_z() { SHAPING_QUEUE_DEQUEUE(z) } + static bool empty_z() { return head_z == tail; } + static uint16_t free_count_z() { return _free_count_z; } + #endif 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; + head_x = tail; _free_count_x = shaping_echoes - 1; _peek_x = st; #endif #if ENABLED(INPUT_SHAPING_Y) - head_y = tail; _free_count_y = shaping_echoes - 1; peek_y_val = st; + head_y = tail; _free_count_y = shaping_echoes - 1; _peek_y = st; + #endif + #if ENABLED(INPUT_SHAPING_Z) + head_z = tail; _free_count_z = shaping_echoes - 1; _peek_z = st; #endif } }; @@ -420,6 +415,9 @@ class Stepper { #if ENABLED(INPUT_SHAPING_Y) static ShapeParams shaping_y; #endif + #if ENABLED(INPUT_SHAPING_Z) + static ShapeParams shaping_z; + #endif #endif #if ENABLED(LIN_ADVANCE) @@ -517,7 +515,7 @@ class Stepper { 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()); + const bool result = TERN0(INPUT_SHAPING_X, !ShapingQueue::empty_x()) || TERN0(INPUT_SHAPING_Y, !ShapingQueue::empty_y()) || TERN0(INPUT_SHAPING_Z, !ShapingQueue::empty_z()); if (was_on) hal.isr_on(); diff --git a/Marlin/src/module/stepper/cycles.h b/Marlin/src/module/stepper/cycles.h index dae9e7c62c..0089124eed 100644 --- a/Marlin/src/module/stepper/cycles.h +++ b/Marlin/src/module/stepper/cycles.h @@ -188,7 +188,7 @@ #define ISR_LOOP_CYCLES(R) ((ISR_LOOP_BASE_CYCLES + MIN_ISR_LOOP_CYCLES + MIN_STEPPER_PULSE_CYCLES) * ((1UL << 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_ZV_SHAPING, (ISR_LOOP_BASE_CYCLES + TERN0(INPUT_SHAPING_X, ISR_X_STEPPER_CYCLES) + TERN0(INPUT_SHAPING_Y, ISR_Y_STEPPER_CYCLES)) << R)) +#define ISR_SHAPING_LOOP_CYCLES(R) (TERN0(HAS_ZV_SHAPING, (ISR_LOOP_BASE_CYCLES + TERN0(INPUT_SHAPING_X, ISR_X_STEPPER_CYCLES) + TERN0(INPUT_SHAPING_Y, ISR_Y_STEPPER_CYCLES) + TERN0(INPUT_SHAPING_Z, ISR_Z_STEPPER_CYCLES)) << R)) // If linear advance is enabled, then it is handled separately #if ENABLED(LIN_ADVANCE) diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 95d2da38f1..16b43f62f0 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -1303,8 +1303,10 @@ int16_t Temperature::getHeaterPower(const heater_id_t heater_id) { #if HAS_COOLER case H_COOLER: return temp_cooler.soft_pwm_amount; #endif - default: - return TERN0(HAS_HOTEND, temp_hotend[heater_id].soft_pwm_amount); + #if HAS_HOTEND + case 0 ... HOTENDS - 1: return temp_hotend[heater_id].soft_pwm_amount; + #endif + default: return 0; } } diff --git a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h b/Marlin/src/pins/native/pins_RAMPS_NATIVE.h similarity index 85% rename from Marlin/src/pins/linux/pins_RAMPS_LINUX.h rename to Marlin/src/pins/native/pins_RAMPS_NATIVE.h index d50229ec53..f08dc3c3ed 100644 --- a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h +++ b/Marlin/src/pins/native/pins_RAMPS_NATIVE.h @@ -22,31 +22,11 @@ #pragma once /** - * Arduino Mega with RAMPS v1.4 (or v1.3) pin assignments - * - * Applies to the following boards: - * - * RAMPS_14_EFB (Hotend, Fan, Bed) - * RAMPS_14_EEB (Hotend0, Hotend1, Bed) - * RAMPS_14_EFF (Hotend, Fan0, Fan1) - * RAMPS_14_EEF (Hotend0, Hotend1, Fan) - * RAMPS_14_SF (Spindle, Controller Fan) - * - * RAMPS_13_EFB (Hotend, Fan, Bed) - * RAMPS_13_EEB (Hotend0, Hotend1, Bed) - * RAMPS_13_EFF (Hotend, Fan0, Fan1) - * RAMPS_13_EEF (Hotend0, Hotend1, Fan) - * RAMPS_13_SF (Spindle, Controller Fan) - * - * Other pins_MYBOARD.h files may override these defaults - * - * Differences between - * RAMPS_13 | RAMPS_14 - * 7 | 11 + * Native with a RAMPS like board with additional pins */ #ifndef BOARD_INFO_NAME - #define BOARD_INFO_NAME "RAMPS 1.4" + #define BOARD_INFO_NAME "RAMPS Native" #endif #ifndef DEFAULT_MACHINE_NAME @@ -60,28 +40,24 @@ // // Servos // -#ifdef IS_RAMPS_13 - #define SERVO0_PIN 7 // RAMPS_13 // Will conflict with BTN_EN2 on LCD_I2C_VIKI -#else - #define SERVO0_PIN 11 -#endif -#define SERVO1_PIN 6 -#define SERVO2_PIN 5 +#define SERVO0_PIN 151 +#define SERVO1_PIN 152 +#define SERVO2_PIN 153 #ifndef SERVO3_PIN - #define SERVO3_PIN 4 + #define SERVO3_PIN 154 #endif // // Limit Switches // -#define X_MIN_PIN 3 +#define X_MIN_PIN 155 #ifndef X_MAX_PIN - #define X_MAX_PIN 2 + #define X_MAX_PIN 156 #endif -#define Y_MIN_PIN 14 -#define Y_MAX_PIN 15 -#define Z_MIN_PIN 18 -#define Z_MAX_PIN 19 +#define Y_MIN_PIN 157 +#define Y_MAX_PIN 158 +#define Z_MIN_PIN 159 +#define Z_MAX_PIN 160 // // Z Probe (when not Z_MIN_PIN) @@ -128,24 +104,60 @@ #define E1_CS_PIN 44 #endif -#define Z4_STEP_PIN 13 -#define Z4_DIR_PIN 71 -#define Z4_ENABLE_PIN 12 +#define E2_STEP_PIN 100 +#define E2_DIR_PIN 101 +#define E2_ENABLE_PIN 102 +#ifndef E2_CS_PIN + #define E2_CS_PIN 103 +#endif -#define Z2_STEP_PIN 4 -#define Z2_DIR_PIN 5 -#define Z2_ENABLE_PIN 6 +#define E3_STEP_PIN 104 +#define E3_DIR_PIN 105 +#define E3_ENABLE_PIN 106 +#ifndef E3_CS_PIN + #define E3_CS_PIN 107 +#endif -#define Z3_STEP_PIN 12 -#define Z3_DIR_PIN 40 -#define Z3_ENABLE_PIN 44 +#define E4_STEP_PIN 108 +#define E4_DIR_PIN 109 +#define E4_ENABLE_PIN 110 +#ifndef E4_CS_PIN + #define E4_CS_PIN 111 +#endif + +#define E5_STEP_PIN 112 +#define E5_DIR_PIN 113 +#define E5_ENABLE_PIN 114 +#ifndef E5_CS_PIN + #define E5_CS_PIN 115 +#endif + +#define E6_STEP_PIN 116 +#define E6_DIR_PIN 117 +#define E6_ENABLE_PIN 118 +#ifndef E6_CS_PIN + #define E6_CS_PIN 119 +#endif + +#define E7_STEP_PIN 120 +#define E7_DIR_PIN 121 +#define E7_ENABLE_PIN 122 +#ifndef E7_CS_PIN + #define E7_CS_PIN 123 +#endif // // Temperature Sensors // #define TEMP_0_PIN 0 // Analog Input #define TEMP_1_PIN 1 // Analog Input -#define TEMP_BED_PIN 2 // Analog Input +#define TEMP_2_PIN 2 // Analog Input +#define TEMP_3_PIN 3 // Analog Input +#define TEMP_4_PIN 4 // Analog Input +#define TEMP_5_PIN 5 // Analog Input +#define TEMP_6_PIN 6 // Analog Input +#define TEMP_7_PIN 7 // Analog Input +#define TEMP_BED_PIN 8 // Analog Input // SPI for MAX Thermocouple #if !HAS_MEDIA @@ -157,48 +169,26 @@ // // Heaters / Fans // -#ifndef MOSFET_A_PIN - #define MOSFET_A_PIN 10 -#endif -#ifndef MOSFET_B_PIN - #define MOSFET_B_PIN 9 -#endif -#ifndef MOSFET_C_PIN - #define MOSFET_C_PIN 8 -#endif -#ifndef MOSFET_D_PIN - #define MOSFET_D_PIN -1 -#endif - -#define HEATER_0_PIN MOSFET_A_PIN - -#if FET_ORDER_EFB // Hotend, Fan, Bed - #define FAN0_PIN MOSFET_B_PIN - #define HEATER_BED_PIN MOSFET_C_PIN -#elif FET_ORDER_EEF // Hotend, Hotend, Fan - #define HEATER_1_PIN MOSFET_B_PIN - #define FAN0_PIN MOSFET_C_PIN -#elif FET_ORDER_EEB // Hotend, Hotend, Bed - #define HEATER_1_PIN MOSFET_B_PIN - #define HEATER_BED_PIN MOSFET_C_PIN -#elif FET_ORDER_EFF // Hotend, Fan, Fan - #define FAN0_PIN MOSFET_B_PIN - #define FAN1_PIN MOSFET_C_PIN -#elif FET_ORDER_SF // Spindle, Fan - #define FAN0_PIN MOSFET_C_PIN -#else // Non-specific are "EFB" (i.e., "EFBF" or "EFBE") - #define FAN0_PIN MOSFET_B_PIN - #define HEATER_BED_PIN MOSFET_C_PIN - #if HOTENDS == 1 && DISABLED(HEATERS_PARALLEL) - #define FAN1_PIN MOSFET_D_PIN - #else - #define HEATER_1_PIN MOSFET_D_PIN - #endif -#endif +#define HEATER_0_PIN 10 +#define HEATER_1_PIN 9 +#define HEATER_2_PIN 8 +#define HEATER_3_PIN 125 +#define HEATER_4_PIN 126 +#define HEATER_5_PIN 127 +#define HEATER_6_PIN 128 +#define HEATER_7_PIN 129 +#define HEATER_BED_PIN 108 #ifndef FAN0_PIN - #define FAN0_PIN 4 // IO pin. Buffer needed + #define FAN0_PIN 161 // IO pin. Buffer needed #endif +#define FAN1_PIN 162 // IO pin. Buffer needed +#define FAN2_PIN 163 // IO pin. Buffer needed +#define FAN3_PIN 164 // IO pin. Buffer needed +#define FAN4_PIN 165 // IO pin. Buffer needed +#define FAN5_PIN 166 // IO pin. Buffer needed +#define FAN6_PIN 167 // IO pin. Buffer needed +#define FAN7_PIN 168 // IO pin. Buffer needed // // Misc. Functions @@ -737,3 +727,7 @@ #endif // IS_NEWPANEL #endif // HAS_WIRED_LCD + +#ifndef KILL_PIN + #define KILL_PIN EXP2_08_PIN +#endif diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 836c78a47e..b03f77fa51 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -719,6 +719,8 @@ #include "gd32f1/pins_VOXELAB_AQUILA.h" // GD32F1, N32G4, STM32F1 env:GD32F103RC_voxelab_maple env:N32G455RE_voxelab_maple env:STM32F103RE_creality_maple env:STM32F103RE_creality #elif MB(SPRINGER_CONTROLLER) #include "stm32f1/pins_ORCA_3D_SPRINGER.h" // STM32F1 env:STM32F103VC_orca3d +#elif MB(CREALITY_CR4NS) + #include "stm32f1/pins_CREALITY_CR4NS.h" // STM32F1 env:STM32F103RE_creality env:STM32F103RE_creality_maple // // ARM Cortex-M4F @@ -933,7 +935,7 @@ // #elif MB(SIMULATED) - #include "linux/pins_RAMPS_LINUX.h" // Native or Simulation lin:linux_native mac:simulator_macos_debug mac:simulator_macos_release win:simulator_windows lin:simulator_linux_debug lin:simulator_linux_release + #include "native/pins_RAMPS_NATIVE.h" // Native or Simulation lin:linux_native mac:simulator_macos_debug mac:simulator_macos_release win:simulator_windows lin:simulator_linux_debug lin:simulator_linux_release #else diff --git a/Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h b/Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h index d2ad928066..e2cd6f6b55 100644 --- a/Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h +++ b/Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h @@ -579,21 +579,21 @@ // Default TMC slave addresses #ifndef X_SLAVE_ADDRESS - #define X_SLAVE_ADDRESS 0b00 + #define X_SLAVE_ADDRESS 0 #endif #ifndef Y_SLAVE_ADDRESS - #define Y_SLAVE_ADDRESS 0b01 + #define Y_SLAVE_ADDRESS 1 #endif #ifndef Z_SLAVE_ADDRESS - #define Z_SLAVE_ADDRESS 0b10 + #define Z_SLAVE_ADDRESS 2 #endif #ifndef E0_SLAVE_ADDRESS - #define E0_SLAVE_ADDRESS 0b11 + #define E0_SLAVE_ADDRESS 3 #endif - static_assert(X_SLAVE_ADDRESS == 0b00, "X_SLAVE_ADDRESS must be 0b00 for BOARD_BRICOLEMON_LITE_V1_0."); - static_assert(Y_SLAVE_ADDRESS == 0b01, "Y_SLAVE_ADDRESS must be 0b01 for BOARD_BRICOLEMON_LITE_V1_0."); - static_assert(Z_SLAVE_ADDRESS == 0b10, "Z_SLAVE_ADDRESS must be 0b10 for BOARD_BRICOLEMON_LITE_V1_0."); - static_assert(E0_SLAVE_ADDRESS == 0b11, "E0_SLAVE_ADDRESS must be 0b11 for BOARD_BRICOLEMON_LITE_V1_0."); + static_assert(X_SLAVE_ADDRESS == 0, "X_SLAVE_ADDRESS must be 0 for BOARD_BRICOLEMON_LITE_V1_0."); + static_assert(Y_SLAVE_ADDRESS == 1, "Y_SLAVE_ADDRESS must be 1 for BOARD_BRICOLEMON_LITE_V1_0."); + static_assert(Z_SLAVE_ADDRESS == 2, "Z_SLAVE_ADDRESS must be 2 for BOARD_BRICOLEMON_LITE_V1_0."); + static_assert(E0_SLAVE_ADDRESS == 3, "E0_SLAVE_ADDRESS must be 3 for BOARD_BRICOLEMON_LITE_V1_0."); // Reduce baud rate to improve software serial reliability #ifndef TMC_BAUD_RATE diff --git a/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h b/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h index 8dfad8dc56..31997f7fdc 100644 --- a/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h +++ b/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h @@ -634,25 +634,25 @@ // Default TMC slave addresses #ifndef X_SLAVE_ADDRESS - #define X_SLAVE_ADDRESS 0b00 + #define X_SLAVE_ADDRESS 0 #endif #ifndef Y_SLAVE_ADDRESS - #define Y_SLAVE_ADDRESS 0b01 + #define Y_SLAVE_ADDRESS 1 #endif #ifndef Z_SLAVE_ADDRESS - #define Z_SLAVE_ADDRESS 0b10 + #define Z_SLAVE_ADDRESS 2 #endif #ifndef E0_SLAVE_ADDRESS - #define E0_SLAVE_ADDRESS 0b11 + #define E0_SLAVE_ADDRESS 3 #endif #ifndef E1_SLAVE_ADDRESS - #define E1_SLAVE_ADDRESS 0b00 + #define E1_SLAVE_ADDRESS 0 #endif - static_assert(X_SLAVE_ADDRESS == 0b00, "X_SLAVE_ADDRESS must be 0b00 for BOARD_BRICOLEMON_V1_0."); - static_assert(Y_SLAVE_ADDRESS == 0b01, "Y_SLAVE_ADDRESS must be 0b01 for BOARD_BRICOLEMON_V1_0."); - static_assert(Z_SLAVE_ADDRESS == 0b10, "Z_SLAVE_ADDRESS must be 0b10 for BOARD_BRICOLEMON_V1_0."); - static_assert(E0_SLAVE_ADDRESS == 0b11, "E0_SLAVE_ADDRESS must be 0b11 for BOARD_BRICOLEMON_V1_0."); - static_assert(E1_SLAVE_ADDRESS == 0b00, "E1_SLAVE_ADDRESS must be 0b00 for BOARD_BRICOLEMON_V1_0."); + static_assert(X_SLAVE_ADDRESS == 0, "X_SLAVE_ADDRESS must be 0 for BOARD_BRICOLEMON_V1_0."); + static_assert(Y_SLAVE_ADDRESS == 1, "Y_SLAVE_ADDRESS must be 1 for BOARD_BRICOLEMON_V1_0."); + static_assert(Z_SLAVE_ADDRESS == 2, "Z_SLAVE_ADDRESS must be 2 for BOARD_BRICOLEMON_V1_0."); + static_assert(E0_SLAVE_ADDRESS == 3, "E0_SLAVE_ADDRESS must be 3 for BOARD_BRICOLEMON_V1_0."); + static_assert(E1_SLAVE_ADDRESS == 0, "E1_SLAVE_ADDRESS must be 0 for BOARD_BRICOLEMON_V1_0."); // Reduce baud rate to improve software serial reliability #ifndef TMC_BAUD_RATE diff --git a/Marlin/src/pins/samd/pins_MINITRONICS20.h b/Marlin/src/pins/samd/pins_MINITRONICS20.h index 85583b62b9..dfbc24487d 100644 --- a/Marlin/src/pins/samd/pins_MINITRONICS20.h +++ b/Marlin/src/pins/samd/pins_MINITRONICS20.h @@ -511,25 +511,25 @@ // Default TMC slave addresses #ifndef X_SLAVE_ADDRESS - #define X_SLAVE_ADDRESS 0b00 + #define X_SLAVE_ADDRESS 0 #endif #ifndef Y_SLAVE_ADDRESS - #define Y_SLAVE_ADDRESS 0b01 + #define Y_SLAVE_ADDRESS 1 #endif #ifndef Z_SLAVE_ADDRESS - #define Z_SLAVE_ADDRESS 0b10 + #define Z_SLAVE_ADDRESS 2 #endif #ifndef E0_SLAVE_ADDRESS - #define E0_SLAVE_ADDRESS 0b11 + #define E0_SLAVE_ADDRESS 3 #endif #ifndef E1_SLAVE_ADDRESS - #define E1_SLAVE_ADDRESS 0b00 + #define E1_SLAVE_ADDRESS 0 #endif - static_assert(X_SLAVE_ADDRESS == 0b00, "X_SLAVE_ADDRESS must be 0b00 for BOARD_MINITRONICS20."); - static_assert(Y_SLAVE_ADDRESS == 0b01, "Y_SLAVE_ADDRESS must be 0b01 for BOARD_MINITRONICS20."); - static_assert(Z_SLAVE_ADDRESS == 0b10, "Z_SLAVE_ADDRESS must be 0b10 for BOARD_MINITRONICS20."); - static_assert(E0_SLAVE_ADDRESS == 0b11, "E0_SLAVE_ADDRESS must be 0b11 for BOARD_MINITRONICS20."); - static_assert(E1_SLAVE_ADDRESS == 0b00, "E1_SLAVE_ADDRESS must be 0b00 for BOARD_MINITRONICS20."); + static_assert(X_SLAVE_ADDRESS == 0, "X_SLAVE_ADDRESS must be 0 for BOARD_MINITRONICS20."); + static_assert(Y_SLAVE_ADDRESS == 1, "Y_SLAVE_ADDRESS must be 1 for BOARD_MINITRONICS20."); + static_assert(Z_SLAVE_ADDRESS == 2, "Z_SLAVE_ADDRESS must be 2 for BOARD_MINITRONICS20."); + static_assert(E0_SLAVE_ADDRESS == 3, "E0_SLAVE_ADDRESS must be 3 for BOARD_MINITRONICS20."); + static_assert(E1_SLAVE_ADDRESS == 0, "E1_SLAVE_ADDRESS must be 0 for BOARD_MINITRONICS20."); // Reduce baud rate to improve software serial reliability #ifndef TMC_BAUD_RATE diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_CR4NS.h b/Marlin/src/pins/stm32f1/pins_CREALITY_CR4NS.h new file mode 100644 index 0000000000..5ff033e684 --- /dev/null +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_CR4NS.h @@ -0,0 +1,135 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * Creality CREALITY_CR4NS (GD32F303RET6) board pin assignments + * Sold as "Creality Ender-3 V3 SE CR4NS200320C13 Motherboard" + * Preliminary support for the Professional Firmwware + */ + +#include "env_validate.h" + +#if HOTENDS > 1 || E_STEPPERS > 1 + #error "CR4NS200320C13 only supports one hotend / E-stepper." +#endif + +// Validate stepper driver selections. +//#if !AXIS_DRIVER_TYPE_X(TMC2208) || !AXIS_DRIVER_TYPE_Y(TMC2208) || !AXIS_DRIVER_TYPE_Z(TMC2208) || !AXIS_DRIVER_TYPE_E0(TMC2208) +// #error "This board has onboard TMC2208 drivers for X, Y, Z, and E0." +//#endif + +#ifndef BOARD_INFO_NAME + #define BOARD_INFO_NAME "CR4NS200320C13" +#endif +#ifndef DEFAULT_MACHINE_NAME + #define DEFAULT_MACHINE_NAME "Ender-3 V3 SE" +#endif +#define BOARD_WEBSITE_URL "www.creality.com" + +// +// Servos +// +#ifndef SERVO0_PIN + #define SERVO0_PIN PC14 +#endif + +#ifndef Z_MIN_PROBE_PIN + #define Z_MIN_PROBE_PIN PC13 // BLTouch IN +#endif + +// +// Limit Switches +// +//#ifndef Z_STOP_PIN +// #define Z_STOP_PIN PA15 // else PA7 +//#endif + +// +// Filament Runout Sensor +// +#ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN PC15 // "Pulled-high" +#endif + +// +// Heaters / Fans +// +#define HEATER_BED_PIN PB2 // HOT BED +#define FAN1_PIN PC1 // extruder fan +//#define FAN2_PIN PB1 // Controller fan FET + +// +// Auto fans +// +//#ifndef CONTROLLER_FAN_PIN +// #define CONTROLLER_FAN_PIN FAN2_PIN +//#endif + +#if HAS_TMC_UART + // Reduce baud rate to improve software serial reliability + #define TMC_BAUD_RATE 19200 + + // Software serial + #define X_SERIAL_TX_PIN PB12 + #define X_SERIAL_RX_PIN X_SERIAL_TX_PIN + + #define Y_SERIAL_TX_PIN PB13 + #define Y_SERIAL_RX_PIN Y_SERIAL_TX_PIN + + #define Z_SERIAL_TX_PIN PB14 + #define Z_SERIAL_RX_PIN Z_SERIAL_TX_PIN + +#endif // HAS_TMC_UART + +#if ANY(RET6_12864_LCD, HAS_DWIN_E3V2, IS_DWIN_MARLINUI) + + /** + * LCD PIN OUT + * ------ + * NC | 1 2 | NC + * RX | 3 4 | TX + * EN 5 6 | BEEP + * B | 7 8 | A + * GND | 9 10 | +5V + * ------ + */ + #define EXP3_01_PIN -1 + #define EXP3_02_PIN -1 + #define EXP3_03_PIN PA2 + #define EXP3_04_PIN PA3 + #define EXP3_05_PIN PB1 + #define EXP3_06_PIN -1 + #define EXP3_07_PIN PA12 + #define EXP3_08_PIN PA11 + + #ifndef BEEPER_PIN + #define BEEPER_PIN EXP1_06_PIN // BEEP + #endif + + #define BTN_ENC EXP1_05_PIN // EN + #define BTN_EN1 EXP1_08_PIN // A + #define BTN_EN2 EXP1_07_PIN // B + +#endif + +#include "pins_CREALITY_V4.h" diff --git a/Marlin/src/pins/stm32g0/pins_BTT_EBB42_V1_1.h b/Marlin/src/pins/stm32g0/pins_BTT_EBB42_V1_1.h index df2ab4652e..ffa644c88c 100644 --- a/Marlin/src/pins/stm32g0/pins_BTT_EBB42_V1_1.h +++ b/Marlin/src/pins/stm32g0/pins_BTT_EBB42_V1_1.h @@ -106,9 +106,9 @@ // Default TMC slave addresses #ifndef E0_SLAVE_ADDRESS - #define E0_SLAVE_ADDRESS 0b00 + #define E0_SLAVE_ADDRESS 0 #endif - static_assert(E0_SLAVE_ADDRESS == 0b00, "E0_SLAVE_ADDRESS must be 0b00 for BOARD_BTT_EBB42_V1_1."); + static_assert(E0_SLAVE_ADDRESS == 0, "E0_SLAVE_ADDRESS must be 0 for BOARD_BTT_EBB42_V1_1."); #endif // diff --git a/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h b/Marlin/src/pins/stm32h7/pins_BTT_SKR_V3_0_common.h index 1d63f40e4c..b679921863 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 @@ -440,6 +440,29 @@ #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_SKR_V3_0_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 diff --git a/Marlin/src/sd/SdBaseFile.cpp b/Marlin/src/sd/SdBaseFile.cpp index f878118d2f..3963043ca6 100644 --- a/Marlin/src/sd/SdBaseFile.cpp +++ b/Marlin/src/sd/SdBaseFile.cpp @@ -253,7 +253,7 @@ bool SdBaseFile::exists(const char *name) { * * \return For success fgets() returns the length of the string in \a str. * If no data is read, fgets() returns zero for EOF or -1 if an error occurred. - **/ + */ int16_t SdBaseFile::fgets(char *str, int16_t num, char *delim) { char ch; int16_t n = 0; diff --git a/README.md b/README.md index 373444a164..b11a1193b9 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ GPL-V3.0 License Contributors Last Release Date - CI Status + CI Status GitHub Sponsors
Follow MarlinFirmware on Mastodon diff --git a/buildroot/share/cmake/CMakeLists.txt b/buildroot/share/cmake/CMakeLists.txt index 09b5b6f1bf..5f15d26680 100644 --- a/buildroot/share/cmake/CMakeLists.txt +++ b/buildroot/share/cmake/CMakeLists.txt @@ -20,7 +20,7 @@ cmake_minimum_required(VERSION 3.5) # and add the path to the module path # #====================================================================# -set(SCRIPT_BRANCH 1.0.2) #Set to wanted marlin-cmake release tag or branch +set(SCRIPT_BRANCH 1.0.2) # Set to wanted marlin-cmake release tag or branch if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/marlin-cmake) @@ -88,7 +88,7 @@ file(WRITE "${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/Platform/Arduino.cmake" "${NE set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/modules) #====================================================================# -# Custom path to Arduino SDK can be set here. # +# Custom path to Arduino SDK can be set here # # It can also be set from command line. eg.: # # cmake .. -DARDUINO_SDK_PATH="/path/to/arduino-1.x.x" # #====================================================================# @@ -113,14 +113,14 @@ set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/toolchain/Arduin # If you receive this error: # # 'Unknown CMake command "_cmake_record_install_prefix".' # # # -# Go to the file in your CMake directory. # +# Go to the file in your CMake directory # # # # For Windows: cmake\Modules\Platform\WindowsPaths.cmake # # For Linux: cmake/Modules/Platform/UnixPaths.cmake # # # # Comment out "_cmake_record_install_prefix()" # # - OR - # -# Add "include(CMakeSystemSpecificInformation)" above the line. # +# Add "include(CMakeSystemSpecificInformation)" above the line # # # #====================================================================# project(Marlin C CXX) diff --git a/buildroot/share/scripts/pinsformat.py b/buildroot/share/scripts/pinsformat.py index e4bd69d855..7b041c86fc 100755 --- a/buildroot/share/scripts/pinsformat.py +++ b/buildroot/share/scripts/pinsformat.py @@ -271,7 +271,7 @@ def process_text(txt): elif tryUndef(wDict): pass #undef ... elif tryCond(wDict): pass #if|ifdef|ifndef|elif ... - out += wDict['line'] + '\n' + out += wDict['line'].rstrip() + '\n' return re.sub('\n\n$', '\n', re.sub(r'\n\n+', '\n\n', out)) diff --git a/buildroot/tests/mega2560 b/buildroot/tests/mega2560 index 97d12090c2..d61f17b51c 100755 --- a/buildroot/tests/mega2560 +++ b/buildroot/tests/mega2560 @@ -96,7 +96,7 @@ opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO MIXING_STEPPERS 5 LCD_LANGUAGE ru \ opt_enable MIXING_EXTRUDER GRADIENT_MIX GRADIENT_VTOOL CR10_STOCKDISPLAY \ USE_CONTROLLER_FAN CONTROLLER_FAN_EDITABLE CONTROLLER_FAN_IGNORE_Z \ XY_AFTER_HOMING EVENT_GCODE_AFTER_HOMING \ - FILAMENT_RUNOUT_SENSOR ADVANCED_PAUSE_FEATURE NOZZLE_PARK_FEATURE INPUT_SHAPING_X INPUT_SHAPING_Y + FILAMENT_RUNOUT_SENSOR ADVANCED_PAUSE_FEATURE NOZZLE_PARK_FEATURE INPUT_SHAPING_X INPUT_SHAPING_Y INPUT_SHAPING_Z opt_disable DISABLE_OTHER_EXTRUDERS exec_test $1 $2 "Azteeg X3 | Mixing Extruder (x5) | Gradient Mix | Input Shaping | Russian" "$3" diff --git a/ini/native.ini b/ini/native.ini index 28c558d39f..0a13b8f300 100644 --- a/ini/native.ini +++ b/ini/native.ini @@ -58,11 +58,11 @@ debug_build_flags = -fstack-protector-strong -g -g3 -ggdb lib_compat_mode = off build_src_filter = ${common.default_src_filter} + lib_deps = ${common.lib_deps} - MarlinSimUI=https://github.com/p3p/MarlinSimUI/archive/66a2b82c8f.zip - Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/c6b319f447.zip - LiquidCrystal=https://github.com/p3p/LiquidCrystal/archive/322fb5fc23.zip -extra_scripts = ${common.extra_scripts} - pre:buildroot/share/PlatformIO/scripts/simulator.py + MarlinSimUI=https://github.com/p3p/MarlinSimUI/archive/66a2b82c8f.zip + Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/c6b319f447.zip + LiquidCrystal=https://github.com/p3p/LiquidCrystal/archive/322fb5fc23.zip +extra_scripts = ${common.extra_scripts} + pre:buildroot/share/PlatformIO/scripts/simulator.py [simulator_linux] extends = simulator_common diff --git a/test/003-extruders_3_runout.ini b/test/003-extruders_3_runout.ini index 4bd91e8b7c..e473faeec3 100644 --- a/test/003-extruders_3_runout.ini +++ b/test/003-extruders_3_runout.ini @@ -12,15 +12,6 @@ motherboard = BOARD_SIMULATED extruders = 3 temp_sensor_1 = 1 temp_sensor_2 = 1 -temp_2_pin = 4 # dummy -temp_3_pin = 4 # dummy -heater_2_pin = 4 # dummy -e2_step_pin = 4 # dummy -e2_dir_pin = 4 # dummy -e2_enable_pin = 4 # dummy -e3_step_pin = 4 # dummy -e3_dir_pin = 4 # dummy -e3_enable_pin = 4 # dummy num_runout_sensors = 3 filament_runout_sensor = on fil_runout_pin = 4 # dummy