From 5bd28cd840219ee8d5c54575fb0f12e94e1d1921 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sat, 25 Oct 2025 06:04:16 +1300 Subject: [PATCH 01/27] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20ZONESTAR=5F12864OLED?= =?UTF-8?q?=20build=20(et.al.)=20(#28137)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/dogm/u8g/u8g_dev_ssd1306_sh1106_128x64_SWSPI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/lcd/dogm/u8g/u8g_dev_ssd1306_sh1106_128x64_SWSPI.cpp b/Marlin/src/lcd/dogm/u8g/u8g_dev_ssd1306_sh1106_128x64_SWSPI.cpp index fae4b78aec..e55a450406 100644 --- a/Marlin/src/lcd/dogm/u8g/u8g_dev_ssd1306_sh1106_128x64_SWSPI.cpp +++ b/Marlin/src/lcd/dogm/u8g/u8g_dev_ssd1306_sh1106_128x64_SWSPI.cpp @@ -87,7 +87,7 @@ static const uint8_t u8g_dev_ssd13xx_HAL_sleep_on[] PROGMEM = { U8G_ESC_ADR(0), // Instruction mode U8G_ESC_CS(1), // Enable chip - SH1106_ON(0) // Display off + SH1106_ON(0), // Display off U8G_ESC_CS(0), // Disable chip U8G_ESC_END // End of sequence }; From 14b5d5ba84c9fd80dfe4d4ee5d2fee011ffe4b08 Mon Sep 17 00:00:00 2001 From: Andrew <18502096+classicrocker883@users.noreply.github.com> Date: Fri, 24 Oct 2025 20:05:59 -0400 Subject: [PATCH 02/27] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Fix,?= =?UTF-8?q?=20improve=20test=20scripts=20(#28136)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Makefile | 2 +- buildroot/bin/ci_src_filter | 4 +++- buildroot/bin/restore_configs | 43 +++++++++++++++++++---------------- 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index db1066b2ef..f3e4d80b36 100644 --- a/Makefile +++ b/Makefile @@ -67,7 +67,7 @@ marlin: .PHONY: marlin clean: - rm -r .pio/build + rm -rf .pio/build* tests-single-ci: export GIT_RESET_HARD=true diff --git a/buildroot/bin/ci_src_filter b/buildroot/bin/ci_src_filter index 1043e57d81..566e3e1e95 100755 --- a/buildroot/bin/ci_src_filter +++ b/buildroot/bin/ci_src_filter @@ -6,7 +6,9 @@ set -e FN="platformio.ini" if [[ $1 == "-n" ]]; then - awk '/default_src_filter/ { sub("default_src_filter", "org_src_filter"); print "default_src_filter = +"; } 1' $FN > $FN~ && mv $FN~ $FN + if ! grep -q "org_src_filter" "$FN"; then + awk '/default_src_filter/ { sub("default_src_filter", "org_src_filter"); print "default_src_filter = +"; } 1' $FN > $FN~ && mv $FN~ $FN + fi else git checkout $FN 2>/dev/null fi diff --git a/buildroot/bin/restore_configs b/buildroot/bin/restore_configs index 0bbd36fd1c..041ef045da 100755 --- a/buildroot/bin/restore_configs +++ b/buildroot/bin/restore_configs @@ -3,31 +3,34 @@ import os, sys, subprocess files_to_remove = [ - "Marlin/_Bootscreen.h", - "Marlin/_Statusscreen.h", - "marlin_config.json", - ".pio/build/mc.zip" + "Marlin/_Bootscreen.h", + "Marlin/_Statusscreen.h", + "marlin_config.json", + ".pio/build/mc.zip" ] for file in files_to_remove: - if os.path.exists(file): - os.remove(file) + if os.path.exists(file): + os.remove(file) def use_example_configs(): - try: - subprocess.run(['use_example_configs'], check=True) - except FileNotFoundError: - print("use_example_configs not found, skipping.") - pass + try: + subprocess.run(['use_example_configs'], check=True) + except FileNotFoundError: + try: + subprocess.run(['./buildroot/bin/use_example_configs'], check=True) + except FileNotFoundError: + print("use_example_configs not found, skipping.") + pass if len(sys.argv) > 1 and sys.argv[1] in ['-d', '--default']: - use_example_configs() + use_example_configs() else: - files_to_checkout = [ - "Marlin/Configuration.h", - "Marlin/Configuration_adv.h", - "Marlin/config.ini", - "Marlin/src/pins/*/pins_*.h" - ] - for file in files_to_checkout: - subprocess.run(["git", "checkout", file], stderr=subprocess.DEVNULL) + files_to_checkout = [ + "Marlin/Configuration.h", + "Marlin/Configuration_adv.h", + "Marlin/config.ini", + "Marlin/src/pins/*/pins_*.h" + ] + for file in files_to_checkout: + subprocess.run(["git", "checkout", file], stderr=subprocess.DEVNULL) From 2c57b184daf6013d3f3057431f21c00e2f2e0492 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 25 Oct 2025 00:30:02 +0000 Subject: [PATCH 03/27] [cron] Bump distribution date (2025-10-25) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index d45979e25a..d4d67d233d 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2025-10-24" +//#define STRING_DISTRIBUTION_DATE "2025-10-25" /** * The protocol for communication to the host. Protocol indicates communication diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 791b387b82..1b2656f995 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2025-10-24" + #define STRING_DISTRIBUTION_DATE "2025-10-25" #endif /** From 4cab99e1d1100fcf1cd5afbc5a2bbc33e0d32eea Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 24 Oct 2025 22:43:24 -0500 Subject: [PATCH 04/27] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Fix,?= =?UTF-8?q?=20improve=20test=20scripts=20(2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/bin/use_example_configs | 177 +++++++++++++++--------------- 1 file changed, 90 insertions(+), 87 deletions(-) diff --git a/buildroot/bin/use_example_configs b/buildroot/bin/use_example_configs index 08b32d67f6..7ff6272b3c 100755 --- a/buildroot/bin/use_example_configs +++ b/buildroot/bin/use_example_configs @@ -21,115 +21,118 @@ DEBUGGING = False CONFIG_FILES = ("Configuration.h", "Configuration_adv.h", "_Bootscreen.h", "_Statusscreen.h") def debug_print(s): - if DEBUGGING: print(s) + if DEBUGGING: print(s) def get_current_branch(): - try: - result = subprocess.run(['git', 'branch'], capture_output=True, text=True, check=True) - for line in result.stdout.splitlines(): - if line.startswith('*'): - return line[2:] - except subprocess.CalledProcessError: - return None + try: + result = subprocess.run(['git', 'branch'], capture_output=True, text=True, check=True) + for line in result.stdout.splitlines(): + if line.startswith('*'): + return line[2:] + except subprocess.CalledProcessError: + return None def sparse_checkout(branch, config_path, repo_url="https://github.com/MarlinFirmware/Configurations.git"): - configs_dir = Path("ConfigurationsRepo") - config_subdir = f"config/{config_path}" + configs_dir = Path("ConfigurationsRepo") + config_subdir = f"config/{config_path}" - if not configs_dir.exists(): - # Step 1: Clone with no checkout - subprocess.run([ - "git", "clone", "--depth", "1", "--filter=blob:none", "--sparse", - "--branch", branch, repo_url, str(configs_dir) - ], check=True) + if not configs_dir.exists(): + # Step 1: Clone with no checkout + subprocess.run([ + "git", "clone", "--depth", "1", "--filter=blob:none", "--sparse", + "--branch", branch, repo_url, str(configs_dir) + ], check=True) - # Step 2: Enable sparse checkout and set the folder - subprocess.run(["git", "sparse-checkout", "set", config_subdir], cwd=str(configs_dir), check=True) - # Step 3: Pull the latest for that branch/folder - subprocess.run(["git", "pull"], cwd=str(configs_dir), check=True) + # Step 2: Enable sparse checkout and set the folder + subprocess.run(["git", "sparse-checkout", "set", config_subdir], cwd=str(configs_dir), check=True) + # Step 3: Pull the latest for that branch/folder + subprocess.run(["git", "pull"], cwd=str(configs_dir), check=True) def copy_config_files(branch, config_path, dest_dir): - sparse_checkout(branch, config_path) + sparse_checkout(branch, config_path) - src_dir = Path("ConfigurationsRepo") / "config" / config_path - for fname in CONFIG_FILES: - src_file = src_dir / fname - if src_file.exists(): - dest_file = dest_dir / fname - debug_print(f"Copying {src_file} to {dest_file}") - dest_file.write_bytes(src_file.read_bytes()) - else: - debug_print(f"{fname} not found in {src_dir}") + src_dir = Path("ConfigurationsRepo") / "config" / config_path + for fname in CONFIG_FILES: + src_file = src_dir / fname + if src_file.exists(): + dest_file = dest_dir / fname + debug_print(f"Copying {src_file} to {dest_file}") + dest_file.write_bytes(src_file.read_bytes()) + else: + debug_print(f"{fname} not found in {src_dir}") def fetch_config_files(branch, config_path, dest_dir): - config_path_url = config_path.replace(' ', '%20') - base_url = f"https://raw.githubusercontent.com/MarlinFirmware/Configurations/{branch}/config/{config_path_url}" + config_path_url = config_path.replace(' ', '%20') + base_url = f"https://raw.githubusercontent.com/MarlinFirmware/Configurations/{branch}/config/{config_path_url}" - for file in CONFIG_FILES: - url = f"{base_url}/{file}" - dest_file = dest_dir / file - if os.getenv('DEBUG', '0') == '1': - debug_print(f"Fetching {file} from {url} to {dest_file}") - - try: - urllib.request.urlretrieve(url, dest_file) - except urllib.error.HTTPError as e: - if e.code == 404: + for file in CONFIG_FILES: + url = f"{base_url}/{file}" + dest_file = dest_dir / file if os.getenv('DEBUG', '0') == '1': - print(f"File {file} not found (404), skipping.") - else: - raise + debug_print(f"Fetching {file} from {url} to {dest_file}") + + try: + urllib.request.urlretrieve(url, dest_file) + except urllib.error.HTTPError as e: + if e.code == 404: + if os.getenv('DEBUG', '0') == '1': + print(f"File {file} not found (404), skipping.") + else: + raise def fetch_configs(branch, config_path): - print(f"Fetching {config_path} configurations from {branch}...") + print(f"Fetching {config_path} configurations from {branch}...") - marlin_dir = Path("Marlin") - if not marlin_dir.exists(): - print(f"Directory 'Marlin' not found at the current location.") - sys.exit(1) + marlin_dir = Path("Marlin") + if not marlin_dir.exists(): + print(f"Directory 'Marlin' not found at the current location.") + sys.exit(1) - if os.environ.get('GITHUB_ACTIONS'): # Running on GitHub ? - copy_config_files(branch, config_path, marlin_dir) - else: - fetch_config_files(branch, config_path, marlin_dir) + if os.environ.get('GITHUB_ACTIONS'): # Running on GitHub ? + copy_config_files(branch, config_path, marlin_dir) + else: + fetch_config_files(branch, config_path, marlin_dir) def main(): - branch = get_current_branch() - if not branch: - print("Not a git repository or no branch found.") - sys.exit(1) + branch = get_current_branch() + if not branch: + print("Not a git repository or no branch found.") + sys.exit(1) - if branch.startswith("bugfix-2."): - branch = branch - elif branch.endswith("-2.1.x") or branch == "2.1.x": - branch = "latest-2.1.x" - elif branch.endswith("-2.0.x") or branch == "2.0.x": - branch = "latest-2.0.x" - elif branch.endswith("-1.1.x") or branch == "1.1.x": - branch = "latest-1.1.x" - elif branch.endswith("-1.0.x") or branch == "1.0.x": - branch = "latest-1.0.x" - else: - branch = "bugfix-2.1.x" - - if len(sys.argv) > 1: - arg = sys.argv[1] - if ':' in arg: - part1, part2 = arg.split(':', 1) - config_path = part2 - branch = part1 + if branch.startswith("bugfix-2."): + branch = branch + elif branch.endswith("-2.1.x") or branch == "2.1.x": + branch = "latest-2.1.x" + elif branch.endswith("-2.0.x") or branch == "2.0.x": + branch = "latest-2.0.x" + elif branch.endswith("-1.1.x") or branch == "1.1.x": + branch = "latest-1.1.x" + elif branch.endswith("-1.0.x") or branch == "1.0.x": + branch = "latest-1.0.x" else: - config_path = arg - config_path = 'examples/'+config_path - else: - config_path = "default" + branch = "bugfix-2.1.x" - try: - subprocess.run(['restore_configs'], check=True) - except FileNotFoundError: - print("restore_configs not found, skipping.") + if len(sys.argv) > 1: + arg = sys.argv[1] + if ':' in arg: + part1, part2 = arg.split(':', 1) + config_path = part2 + branch = part1 + else: + config_path = arg + config_path = 'examples/'+config_path + else: + config_path = "default" - fetch_configs(branch, config_path) + try: + subprocess.run(['restore_configs'], check=True) + except FileNotFoundError: + try: + subprocess.run(['restore_configs'], check=True) + except FileNotFoundError: + print("restore_configs not found, skipping.") + + fetch_configs(branch, config_path) if __name__ == "__main__": - main() + main() From 52a4954b8a050e5f2596569116644c7ca863d45a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 25 Oct 2025 01:13:41 -0500 Subject: [PATCH 05/27] =?UTF-8?q?=F0=9F=90=9B=20FT=20Motion=20respect=20li?= =?UTF-8?q?nearAdvEna=20flag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/planner.cpp | 7 ++++--- Marlin/src/module/stepper.cpp | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index f5507da7a5..99df08205d 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -2415,9 +2415,10 @@ bool Planner::_populate_block( * Check the appropriate K value for Standard or Fixed-Time Motion. */ if (esteps && dm.e) { - const bool ftm_active = TERN0(FTM_HAS_LIN_ADVANCE, ftMotion.cfg.active); + const bool ftm_active = TERN0(FTM_HAS_LIN_ADVANCE, ftMotion.cfg.active), + ftm_la_active = TERN0(FTM_HAS_LIN_ADVANCE, ftm_active && ftMotion.cfg.linearAdvEna); const float advK = ftm_active - ? TERN0(FTM_HAS_LIN_ADVANCE, ftMotion.cfg.linearAdvK) + ? (ftm_la_active ? TERN0(FTM_HAS_LIN_ADVANCE, ftMotion.cfg.linearAdvK) : 0) : TERN0(HAS_ROUGH_LIN_ADVANCE, extruder_advance_K[E_INDEX_N(extruder)]); if (advK) { float e_D_ratio = (target_float.e - position_float.e) / @@ -2437,7 +2438,7 @@ bool Planner::_populate_block( const uint32_t max_accel_steps_per_s2 = (MAX_E_JERK(extruder) / (advK * e_D_ratio)) * steps_per_mm; if (accel > max_accel_steps_per_s2) { accel = max_accel_steps_per_s2; - if (TERN0(LA_DEBUG, DEBUGGING(INFO))) SERIAL_ECHOLNPGM("Acceleration limited."); + if (TERN0(LA_DEBUG, DEBUGGING(INFO))) SERIAL_ECHOLNPGM("Acceleration limited to max_accel_steps_per_s2 (", max_accel_steps_per_s2, ")"); } } } diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 20415265b1..6be58e7bb5 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -2438,6 +2438,7 @@ hal_timer_t Stepper::block_phase_isr() { acceleration_time += interval; deceleration_time = 0; // Reset since we're doing acceleration first. + // Apply Nonlinear Extrusion, if enabled calc_nonlinear_e(acc_step_rate << oversampling_factor); #if HAS_ROUGH_LIN_ADVANCE @@ -2502,6 +2503,7 @@ hal_timer_t Stepper::block_phase_isr() { interval = calc_multistep_timer_interval(step_rate << oversampling_factor); deceleration_time += interval; + // Apply Nonlinear Extrusion, if enabled calc_nonlinear_e(step_rate << oversampling_factor); #if HAS_ROUGH_LIN_ADVANCE @@ -2555,6 +2557,7 @@ hal_timer_t Stepper::block_phase_isr() { TERN_(SMOOTH_LIN_ADVANCE, curr_step_rate = current_block->nominal_rate;) deceleration_time = ticks_nominal / 2; + // Apply Nonlinear Extrusion, if enabled calc_nonlinear_e(current_block->nominal_rate << oversampling_factor); #if HAS_ROUGH_LIN_ADVANCE @@ -2826,6 +2829,7 @@ hal_timer_t Stepper::block_phase_isr() { // Initialize ac/deceleration time as if half the time passed. acceleration_time = deceleration_time = interval / 2; + // Apply Nonlinear Extrusion, if enabled calc_nonlinear_e(current_block->initial_rate << oversampling_factor); #if ENABLED(LIN_ADVANCE) From 0f6f125724d451043da9164cc8f202c82d475699 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 25 Oct 2025 01:18:27 -0500 Subject: [PATCH 06/27] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Fix,?= =?UTF-8?q?=20improve=20test=20scripts=20[3]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/bin/use_example_configs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildroot/bin/use_example_configs b/buildroot/bin/use_example_configs index 7ff6272b3c..401e15da61 100755 --- a/buildroot/bin/use_example_configs +++ b/buildroot/bin/use_example_configs @@ -128,7 +128,7 @@ def main(): subprocess.run(['restore_configs'], check=True) except FileNotFoundError: try: - subprocess.run(['restore_configs'], check=True) + subprocess.run(['./buildroot/bin/restore_configs'], check=True) except FileNotFoundError: print("restore_configs not found, skipping.") From 51ce1a147d5dab0cd1beec314f0ed85fd8c3a3f3 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 25 Oct 2025 01:48:10 -0500 Subject: [PATCH 07/27] =?UTF-8?q?=F0=9F=94=A7=20FT=20Motion=20n00b=20warni?= =?UTF-8?q?ngs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Warnings.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Marlin/src/inc/Warnings.cpp b/Marlin/src/inc/Warnings.cpp index dddada62ec..38711e4fca 100644 --- a/Marlin/src/inc/Warnings.cpp +++ b/Marlin/src/inc/Warnings.cpp @@ -932,6 +932,12 @@ #if ENABLED(FTM_HOME_AND_PROBE) && DELAY_BEFORE_PROBING <= 25 #warning "A longer DELAY_BEFORE_PROBING is recommended when using a probe with FT_MOTION." #endif + #if ENABLED(NONLINEAR_EXTRUSION) + #warning "NONLINEAR_EXTRUSION does not (currently) operate when FT_MOTION is the active motion system." + #endif + #if ENABLED(LIN_ADVANCE) + #warning "Be aware that FT_MOTION K factor (M493 K) is a separate setting from LIN_ADVANCE K factor (M900 K)." + #endif #endif /** From 47727cf0ae4a0914b5791ee653e2f7646f40b272 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 25 Oct 2025 15:56:55 -0500 Subject: [PATCH 08/27] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20TFT=20Color=20UI=20(?= =?UTF-8?q?#28140)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #28103 --- Marlin/src/HAL/STM32/tft/tft_fsmc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/HAL/STM32/tft/tft_fsmc.cpp b/Marlin/src/HAL/STM32/tft/tft_fsmc.cpp index faf7d2b048..70caef6778 100644 --- a/Marlin/src/HAL/STM32/tft/tft_fsmc.cpp +++ b/Marlin/src/HAL/STM32/tft/tft_fsmc.cpp @@ -182,7 +182,7 @@ void TFT_FSMC::abort() { } void TFT_FSMC::transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count) { - if (DMAtx.Init.PeriphInc != memoryIncrease) { + if (!__IS_DMA_CONFIGURED(&DMAtx) || DMAtx.Init.PeriphInc != memoryIncrease) { DMAtx.Init.PeriphInc = memoryIncrease; HAL_DMA_Init(&DMAtx); } @@ -191,7 +191,7 @@ void TFT_FSMC::transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t cou } void TFT_FSMC::transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count) { - if (DMAtx.Init.PeriphInc != memoryIncrease) { + if (!__IS_DMA_CONFIGURED(&DMAtx) || DMAtx.Init.PeriphInc != memoryIncrease) { DMAtx.Init.PeriphInc = memoryIncrease; HAL_DMA_Init(&DMAtx); } From d09bf9d088c97bd808a459d709291bd5377ca18c Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sun, 26 Oct 2025 00:33:31 +0000 Subject: [PATCH 09/27] [cron] Bump distribution date (2025-10-26) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index d4d67d233d..e1cba4d014 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2025-10-25" +//#define STRING_DISTRIBUTION_DATE "2025-10-26" /** * The protocol for communication to the host. Protocol indicates communication diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 1b2656f995..53dc6f00f2 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2025-10-25" + #define STRING_DISTRIBUTION_DATE "2025-10-26" #endif /** From 49b11f949065dd501dcb2450d8c28888d2641528 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sun, 26 Oct 2025 15:58:11 +1300 Subject: [PATCH 10/27] =?UTF-8?q?=F0=9F=94=A7=20ZONESTAR=20ZM3E2=20shared?= =?UTF-8?q?=20MS1|2=20pins=20(#28126)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Conditionals-5-post.h | 6 +- Marlin/src/inc/SanityCheck.h | 11 + Marlin/src/module/stepper/control.cpp | 500 +++++++++++++------------- 3 files changed, 274 insertions(+), 243 deletions(-) diff --git a/Marlin/src/inc/Conditionals-5-post.h b/Marlin/src/inc/Conditionals-5-post.h index 3d248f7b29..67c0135d19 100644 --- a/Marlin/src/inc/Conditionals-5-post.h +++ b/Marlin/src/inc/Conditionals-5-post.h @@ -3063,13 +3063,17 @@ #define HAS_MOTOR_CURRENT_PWM 1 #endif +#if PINS_EXIST(MS1, MS2) + #define HAS_SHARED_MICROSTEPPING_PINS 1 +#endif + #if ANY(HAS_Z_MS_PINS, HAS_Z2_MS_PINS, HAS_Z3_MS_PINS, HAS_Z4_MS_PINS) #define HAS_SOME_Z_MS_PINS 1 #endif #if ANY(HAS_E0_MS_PINS, HAS_E1_MS_PINS, HAS_E2_MS_PINS, HAS_E3_MS_PINS, HAS_E4_MS_PINS, HAS_E5_MS_PINS, HAS_E6_MS_PINS, HAS_E7_MS_PINS) #define HAS_SOME_E_MS_PINS 1 #endif -#if ANY(HAS_X_MS_PINS, HAS_X2_MS_PINS, HAS_Y_MS_PINS, HAS_Y2_MS_PINS, HAS_SOME_Z_MS_PINS, HAS_I_MS_PINS, HAS_J_MS_PINS, HAS_K_MS_PINS, HAS_U_MS_PINS, HAS_V_MS_PINS, HAS_W_MS_PINS, HAS_SOME_E_MS_PINS) +#if ANY(HAS_X_MS_PINS, HAS_X2_MS_PINS, HAS_Y_MS_PINS, HAS_Y2_MS_PINS, HAS_SOME_Z_MS_PINS, HAS_I_MS_PINS, HAS_J_MS_PINS, HAS_K_MS_PINS, HAS_U_MS_PINS, HAS_V_MS_PINS, HAS_W_MS_PINS, HAS_SOME_E_MS_PINS, HAS_SHARED_MICROSTEPPING_PINS) #define HAS_MICROSTEPS 1 #else #undef MICROSTEP_MODES diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 15043d8102..d8dc9a3843 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -4531,6 +4531,17 @@ static_assert(WITHIN(MULTISTEPPING_LIMIT, 1, 128) && IS_POWER_OF_2(MULTISTEPPING #error "CONFIGURABLE_MACHINE_NAME requires GCODE_QUOTED_STRINGS." #endif +/** + * Shared Microstepping Pins Sanity Check + */ +#if HAS_SHARED_MICROSTEPPING_PINS + static constexpr uint8_t _microstep_modes[] = MICROSTEP_MODES, mm0 = _microstep_modes[0]; + static_assert( + _microstep_modes[1] == mm0 && _microstep_modes[2] == mm0 && _microstep_modes[3] == mm0 && _microstep_modes[4] == mm0 && _microstep_modes[5] == mm0, + "When using shared microstepping pins (MS1_PIN and MS2_PIN), all MICROSTEP_MODES values must be identical." + ); +#endif + // Misc. Cleanup #undef _TEST_PWM #undef _NUM_AXES_STR diff --git a/Marlin/src/module/stepper/control.cpp b/Marlin/src/module/stepper/control.cpp index 4d4b6b351f..ec7ec878c4 100644 --- a/Marlin/src/module/stepper/control.cpp +++ b/Marlin/src/module/stepper/control.cpp @@ -361,252 +361,268 @@ #endif #endif + #if HAS_SHARED_MICROSTEPPING_PINS + SET_OUTPUT(MS1_PIN); SET_OUTPUT(MS2_PIN); + #endif + static const uint8_t microstep_modes[] = MICROSTEP_MODES; - for (uint16_t i = 0; i < COUNT(microstep_modes); i++) - microstep_mode(i, microstep_modes[i]); + #if HAS_SHARED_MICROSTEPPING_PINS + // When using shared microstepping pins, set microstepping once for all drivers + microstep_mode(0, microstep_modes[0]); + #else + for (uint16_t i = 0; i < COUNT(microstep_modes); i++) + microstep_mode(i, microstep_modes[i]); + #endif } void Stepper::microstep_ms(const uint8_t driver, const int8_t ms1, const int8_t ms2, const int8_t ms3) { - if (ms1 >= 0) switch (driver) { - #if HAS_X_MS_PINS || HAS_X2_MS_PINS - case X_AXIS: - #if HAS_X_MS_PINS - WRITE(X_MS1_PIN, ms1); - #endif - #if HAS_X2_MS_PINS - WRITE(X2_MS1_PIN, ms1); - #endif - break; - #endif - #if HAS_Y_MS_PINS || HAS_Y2_MS_PINS - case Y_AXIS: - #if HAS_Y_MS_PINS - WRITE(Y_MS1_PIN, ms1); - #endif - #if HAS_Y2_MS_PINS - WRITE(Y2_MS1_PIN, ms1); - #endif - break; - #endif - #if HAS_SOME_Z_MS_PINS - case Z_AXIS: - #if HAS_Z_MS_PINS - WRITE(Z_MS1_PIN, ms1); - #endif - #if HAS_Z2_MS_PINS - WRITE(Z2_MS1_PIN, ms1); - #endif - #if HAS_Z3_MS_PINS - WRITE(Z3_MS1_PIN, ms1); - #endif - #if HAS_Z4_MS_PINS - WRITE(Z4_MS1_PIN, ms1); - #endif - break; - #endif - #if HAS_I_MS_PINS - case I_AXIS: WRITE(I_MS1_PIN, ms1); break; - #endif - #if HAS_J_MS_PINS - case J_AXIS: WRITE(J_MS1_PIN, ms1); break; - #endif - #if HAS_K_MS_PINS - case K_AXIS: WRITE(K_MS1_PIN, ms1); break; - #endif - #if HAS_U_MS_PINS - case U_AXIS: WRITE(U_MS1_PIN, ms1); break; - #endif - #if HAS_V_MS_PINS - case V_AXIS: WRITE(V_MS1_PIN, ms1); break; - #endif - #if HAS_W_MS_PINS - case W_AXIS: WRITE(W_MS1_PIN, ms1); break; - #endif - #if HAS_E0_MS_PINS - case E_AXIS: WRITE(E0_MS1_PIN, ms1); break; - #endif - #if HAS_E1_MS_PINS - case (E_AXIS + 1): WRITE(E1_MS1_PIN, ms1); break; - #endif - #if HAS_E2_MS_PINS - case (E_AXIS + 2): WRITE(E2_MS1_PIN, ms1); break; - #endif - #if HAS_E3_MS_PINS - case (E_AXIS + 3): WRITE(E3_MS1_PIN, ms1); break; - #endif - #if HAS_E4_MS_PINS - case (E_AXIS + 4): WRITE(E4_MS1_PIN, ms1); break; - #endif - #if HAS_E5_MS_PINS - case (E_AXIS + 5): WRITE(E5_MS1_PIN, ms1); break; - #endif - #if HAS_E6_MS_PINS - case (E_AXIS + 6): WRITE(E6_MS1_PIN, ms1); break; - #endif - #if HAS_E7_MS_PINS - case (E_AXIS + 7): WRITE(E7_MS1_PIN, ms1); break; - #endif - } - if (ms2 >= 0) switch (driver) { - #if HAS_X_MS_PINS || HAS_X2_MS_PINS - case X_AXIS: - #if HAS_X_MS_PINS - WRITE(X_MS2_PIN, ms2); - #endif - #if HAS_X2_MS_PINS - WRITE(X2_MS2_PIN, ms2); - #endif - break; - #endif - #if HAS_Y_MS_PINS || HAS_Y2_MS_PINS - case Y_AXIS: - #if HAS_Y_MS_PINS - WRITE(Y_MS2_PIN, ms2); - #endif - #if HAS_Y2_MS_PINS - WRITE(Y2_MS2_PIN, ms2); - #endif - break; - #endif - #if HAS_SOME_Z_MS_PINS - case Z_AXIS: - #if HAS_Z_MS_PINS - WRITE(Z_MS2_PIN, ms2); - #endif - #if HAS_Z2_MS_PINS - WRITE(Z2_MS2_PIN, ms2); - #endif - #if HAS_Z3_MS_PINS - WRITE(Z3_MS2_PIN, ms2); - #endif - #if HAS_Z4_MS_PINS - WRITE(Z4_MS2_PIN, ms2); - #endif - break; - #endif - #if HAS_I_MS_PINS - case I_AXIS: WRITE(I_MS2_PIN, ms2); break; - #endif - #if HAS_J_MS_PINS - case J_AXIS: WRITE(J_MS2_PIN, ms2); break; - #endif - #if HAS_K_MS_PINS - case K_AXIS: WRITE(K_MS2_PIN, ms2); break; - #endif - #if HAS_U_MS_PINS - case U_AXIS: WRITE(U_MS2_PIN, ms2); break; - #endif - #if HAS_V_MS_PINS - case V_AXIS: WRITE(V_MS2_PIN, ms2); break; - #endif - #if HAS_W_MS_PINS - case W_AXIS: WRITE(W_MS2_PIN, ms2); break; - #endif - #if HAS_E0_MS_PINS - case E_AXIS: WRITE(E0_MS2_PIN, ms2); break; - #endif - #if HAS_E1_MS_PINS - case (E_AXIS + 1): WRITE(E1_MS2_PIN, ms2); break; - #endif - #if HAS_E2_MS_PINS - case (E_AXIS + 2): WRITE(E2_MS2_PIN, ms2); break; - #endif - #if HAS_E3_MS_PINS - case (E_AXIS + 3): WRITE(E3_MS2_PIN, ms2); break; - #endif - #if HAS_E4_MS_PINS - case (E_AXIS + 4): WRITE(E4_MS2_PIN, ms2); break; - #endif - #if HAS_E5_MS_PINS - case (E_AXIS + 5): WRITE(E5_MS2_PIN, ms2); break; - #endif - #if HAS_E6_MS_PINS - case (E_AXIS + 6): WRITE(E6_MS2_PIN, ms2); break; - #endif - #if HAS_E7_MS_PINS - case (E_AXIS + 7): WRITE(E7_MS2_PIN, ms2); break; - #endif - } - if (ms3 >= 0) switch (driver) { - #if HAS_X_MS_PINS || HAS_X2_MS_PINS - case X_AXIS: - #if HAS_X_MS_PINS && PIN_EXISTS(X_MS3) - WRITE(X_MS3_PIN, ms3); - #endif - #if HAS_X2_MS_PINS && PIN_EXISTS(X2_MS3) - WRITE(X2_MS3_PIN, ms3); - #endif - break; - #endif - #if HAS_Y_MS_PINS || HAS_Y2_MS_PINS - case Y_AXIS: - #if HAS_Y_MS_PINS && PIN_EXISTS(Y_MS3) - WRITE(Y_MS3_PIN, ms3); - #endif - #if HAS_Y2_MS_PINS && PIN_EXISTS(Y2_MS3) - WRITE(Y2_MS3_PIN, ms3); - #endif - break; - #endif - #if HAS_SOME_Z_MS_PINS - case Z_AXIS: - #if HAS_Z_MS_PINS && PIN_EXISTS(Z_MS3) - WRITE(Z_MS3_PIN, ms3); - #endif - #if HAS_Z2_MS_PINS && PIN_EXISTS(Z2_MS3) - WRITE(Z2_MS3_PIN, ms3); - #endif - #if HAS_Z3_MS_PINS && PIN_EXISTS(Z3_MS3) - WRITE(Z3_MS3_PIN, ms3); - #endif - #if HAS_Z4_MS_PINS && PIN_EXISTS(Z4_MS3) - WRITE(Z4_MS3_PIN, ms3); - #endif - break; - #endif - #if HAS_I_MS_PINS && PIN_EXISTS(I_MS3) - case I_AXIS: WRITE(I_MS3_PIN, ms3); break; - #endif - #if HAS_J_MS_PINS && PIN_EXISTS(J_MS3) - case J_AXIS: WRITE(J_MS3_PIN, ms3); break; - #endif - #if HAS_K_MS_PINS && PIN_EXISTS(K_MS3) - case K_AXIS: WRITE(K_MS3_PIN, ms3); break; - #endif - #if HAS_U_MS_PINS && PIN_EXISTS(U_MS3) - case U_AXIS: WRITE(U_MS3_PIN, ms3); break; - #endif - #if HAS_V_MS_PINS && PIN_EXISTS(V_MS3) - case V_AXIS: WRITE(V_MS3_PIN, ms3); break; - #endif - #if HAS_W_MS_PINS && PIN_EXISTS(W_MS3) - case W_AXIS: WRITE(W_MS3_PIN, ms3); break; - #endif - #if HAS_E0_MS_PINS && PIN_EXISTS(E0_MS3) - case E_AXIS: WRITE(E0_MS3_PIN, ms3); break; - #endif - #if HAS_E1_MS_PINS && PIN_EXISTS(E1_MS3) - case (E_AXIS + 1): WRITE(E1_MS3_PIN, ms3); break; - #endif - #if HAS_E2_MS_PINS && PIN_EXISTS(E2_MS3) - case (E_AXIS + 2): WRITE(E2_MS3_PIN, ms3); break; - #endif - #if HAS_E3_MS_PINS && PIN_EXISTS(E3_MS3) - case (E_AXIS + 3): WRITE(E3_MS3_PIN, ms3); break; - #endif - #if HAS_E4_MS_PINS && PIN_EXISTS(E4_MS3) - case (E_AXIS + 4): WRITE(E4_MS3_PIN, ms3); break; - #endif - #if HAS_E5_MS_PINS && PIN_EXISTS(E5_MS3) - case (E_AXIS + 5): WRITE(E5_MS3_PIN, ms3); break; - #endif - #if HAS_E6_MS_PINS && PIN_EXISTS(E6_MS3) - case (E_AXIS + 6): WRITE(E6_MS3_PIN, ms3); break; - #endif - #if HAS_E7_MS_PINS && PIN_EXISTS(E7_MS3) - case (E_AXIS + 7): WRITE(E7_MS3_PIN, ms3); break; - #endif - } + #if HAS_SHARED_MICROSTEPPING_PINS + // Use shared microstepping pins for all drivers + if (ms1 >= 0) WRITE(MS1_PIN, ms1); + if (ms2 >= 0) WRITE(MS2_PIN, ms2); + // MS3 is not shared, handled per-driver below + #else // !HAS_SHARED_MICROSTEPPING_PINS + if (ms1 >= 0) switch (driver) { + #if HAS_X_MS_PINS || HAS_X2_MS_PINS + case X_AXIS: + #if HAS_X_MS_PINS + WRITE(X_MS1_PIN, ms1); + #endif + #if HAS_X2_MS_PINS + WRITE(X2_MS1_PIN, ms1); + #endif + break; + #endif + #if HAS_Y_MS_PINS || HAS_Y2_MS_PINS + case Y_AXIS: + #if HAS_Y_MS_PINS + WRITE(Y_MS1_PIN, ms1); + #endif + #if HAS_Y2_MS_PINS + WRITE(Y2_MS1_PIN, ms1); + #endif + break; + #endif + #if HAS_SOME_Z_MS_PINS + case Z_AXIS: + #if HAS_Z_MS_PINS + WRITE(Z_MS1_PIN, ms1); + #endif + #if HAS_Z2_MS_PINS + WRITE(Z2_MS1_PIN, ms1); + #endif + #if HAS_Z3_MS_PINS + WRITE(Z3_MS1_PIN, ms1); + #endif + #if HAS_Z4_MS_PINS + WRITE(Z4_MS1_PIN, ms1); + #endif + break; + #endif + #if HAS_I_MS_PINS + case I_AXIS: WRITE(I_MS1_PIN, ms1); break; + #endif + #if HAS_J_MS_PINS + case J_AXIS: WRITE(J_MS1_PIN, ms1); break; + #endif + #if HAS_K_MS_PINS + case K_AXIS: WRITE(K_MS1_PIN, ms1); break; + #endif + #if HAS_U_MS_PINS + case U_AXIS: WRITE(U_MS1_PIN, ms1); break; + #endif + #if HAS_V_MS_PINS + case V_AXIS: WRITE(V_MS1_PIN, ms1); break; + #endif + #if HAS_W_MS_PINS + case W_AXIS: WRITE(W_MS1_PIN, ms1); break; + #endif + #if HAS_E0_MS_PINS + case E_AXIS: WRITE(E0_MS1_PIN, ms1); break; + #endif + #if HAS_E1_MS_PINS + case (E_AXIS + 1): WRITE(E1_MS1_PIN, ms1); break; + #endif + #if HAS_E2_MS_PINS + case (E_AXIS + 2): WRITE(E2_MS1_PIN, ms1); break; + #endif + #if HAS_E3_MS_PINS + case (E_AXIS + 3): WRITE(E3_MS1_PIN, ms1); break; + #endif + #if HAS_E4_MS_PINS + case (E_AXIS + 4): WRITE(E4_MS1_PIN, ms1); break; + #endif + #if HAS_E5_MS_PINS + case (E_AXIS + 5): WRITE(E5_MS1_PIN, ms1); break; + #endif + #if HAS_E6_MS_PINS + case (E_AXIS + 6): WRITE(E6_MS1_PIN, ms1); break; + #endif + #if HAS_E7_MS_PINS + case (E_AXIS + 7): WRITE(E7_MS1_PIN, ms1); break; + #endif + } + if (ms2 >= 0) switch (driver) { + #if HAS_X_MS_PINS || HAS_X2_MS_PINS + case X_AXIS: + #if HAS_X_MS_PINS + WRITE(X_MS2_PIN, ms2); + #endif + #if HAS_X2_MS_PINS + WRITE(X2_MS2_PIN, ms2); + #endif + break; + #endif + #if HAS_Y_MS_PINS || HAS_Y2_MS_PINS + case Y_AXIS: + #if HAS_Y_MS_PINS + WRITE(Y_MS2_PIN, ms2); + #endif + #if HAS_Y2_MS_PINS + WRITE(Y2_MS2_PIN, ms2); + #endif + break; + #endif + #if HAS_SOME_Z_MS_PINS + case Z_AXIS: + #if HAS_Z_MS_PINS + WRITE(Z_MS2_PIN, ms2); + #endif + #if HAS_Z2_MS_PINS + WRITE(Z2_MS2_PIN, ms2); + #endif + #if HAS_Z3_MS_PINS + WRITE(Z3_MS2_PIN, ms2); + #endif + #if HAS_Z4_MS_PINS + WRITE(Z4_MS2_PIN, ms2); + #endif + break; + #endif + #if HAS_I_MS_PINS + case I_AXIS: WRITE(I_MS2_PIN, ms2); break; + #endif + #if HAS_J_MS_PINS + case J_AXIS: WRITE(J_MS2_PIN, ms2); break; + #endif + #if HAS_K_MS_PINS + case K_AXIS: WRITE(K_MS2_PIN, ms2); break; + #endif + #if HAS_U_MS_PINS + case U_AXIS: WRITE(U_MS2_PIN, ms2); break; + #endif + #if HAS_V_MS_PINS + case V_AXIS: WRITE(V_MS2_PIN, ms2); break; + #endif + #if HAS_W_MS_PINS + case W_AXIS: WRITE(W_MS2_PIN, ms2); break; + #endif + #if HAS_E0_MS_PINS + case E_AXIS: WRITE(E0_MS2_PIN, ms2); break; + #endif + #if HAS_E1_MS_PINS + case (E_AXIS + 1): WRITE(E1_MS2_PIN, ms2); break; + #endif + #if HAS_E2_MS_PINS + case (E_AXIS + 2): WRITE(E2_MS2_PIN, ms2); break; + #endif + #if HAS_E3_MS_PINS + case (E_AXIS + 3): WRITE(E3_MS2_PIN, ms2); break; + #endif + #if HAS_E4_MS_PINS + case (E_AXIS + 4): WRITE(E4_MS2_PIN, ms2); break; + #endif + #if HAS_E5_MS_PINS + case (E_AXIS + 5): WRITE(E5_MS2_PIN, ms2); break; + #endif + #if HAS_E6_MS_PINS + case (E_AXIS + 6): WRITE(E6_MS2_PIN, ms2); break; + #endif + #if HAS_E7_MS_PINS + case (E_AXIS + 7): WRITE(E7_MS2_PIN, ms2); break; + #endif + } + if (ms3 >= 0) switch (driver) { + #if HAS_X_MS_PINS || HAS_X2_MS_PINS + case X_AXIS: + #if HAS_X_MS_PINS && PIN_EXISTS(X_MS3) + WRITE(X_MS3_PIN, ms3); + #endif + #if HAS_X2_MS_PINS && PIN_EXISTS(X2_MS3) + WRITE(X2_MS3_PIN, ms3); + #endif + break; + #endif + #if HAS_Y_MS_PINS || HAS_Y2_MS_PINS + case Y_AXIS: + #if HAS_Y_MS_PINS && PIN_EXISTS(Y_MS3) + WRITE(Y_MS3_PIN, ms3); + #endif + #if HAS_Y2_MS_PINS && PIN_EXISTS(Y2_MS3) + WRITE(Y2_MS3_PIN, ms3); + #endif + break; + #endif + #if HAS_SOME_Z_MS_PINS + case Z_AXIS: + #if HAS_Z_MS_PINS && PIN_EXISTS(Z_MS3) + WRITE(Z_MS3_PIN, ms3); + #endif + #if HAS_Z2_MS_PINS && PIN_EXISTS(Z2_MS3) + WRITE(Z2_MS3_PIN, ms3); + #endif + #if HAS_Z3_MS_PINS && PIN_EXISTS(Z3_MS3) + WRITE(Z3_MS3_PIN, ms3); + #endif + #if HAS_Z4_MS_PINS && PIN_EXISTS(Z4_MS3) + WRITE(Z4_MS3_PIN, ms3); + #endif + break; + #endif + #if HAS_I_MS_PINS && PIN_EXISTS(I_MS3) + case I_AXIS: WRITE(I_MS3_PIN, ms3); break; + #endif + #if HAS_J_MS_PINS && PIN_EXISTS(J_MS3) + case J_AXIS: WRITE(J_MS3_PIN, ms3); break; + #endif + #if HAS_K_MS_PINS && PIN_EXISTS(K_MS3) + case K_AXIS: WRITE(K_MS3_PIN, ms3); break; + #endif + #if HAS_U_MS_PINS && PIN_EXISTS(U_MS3) + case U_AXIS: WRITE(U_MS3_PIN, ms3); break; + #endif + #if HAS_V_MS_PINS && PIN_EXISTS(V_MS3) + case V_AXIS: WRITE(V_MS3_PIN, ms3); break; + #endif + #if HAS_W_MS_PINS && PIN_EXISTS(W_MS3) + case W_AXIS: WRITE(W_MS3_PIN, ms3); break; + #endif + #if HAS_E0_MS_PINS && PIN_EXISTS(E0_MS3) + case E_AXIS: WRITE(E0_MS3_PIN, ms3); break; + #endif + #if HAS_E1_MS_PINS && PIN_EXISTS(E1_MS3) + case (E_AXIS + 1): WRITE(E1_MS3_PIN, ms3); break; + #endif + #if HAS_E2_MS_PINS && PIN_EXISTS(E2_MS3) + case (E_AXIS + 2): WRITE(E2_MS3_PIN, ms3); break; + #endif + #if HAS_E3_MS_PINS && PIN_EXISTS(E3_MS3) + case (E_AXIS + 3): WRITE(E3_MS3_PIN, ms3); break; + #endif + #if HAS_E4_MS_PINS && PIN_EXISTS(E4_MS3) + case (E_AXIS + 4): WRITE(E4_MS3_PIN, ms3); break; + #endif + #if HAS_E5_MS_PINS && PIN_EXISTS(E5_MS3) + case (E_AXIS + 5): WRITE(E5_MS3_PIN, ms3); break; + #endif + #if HAS_E6_MS_PINS && PIN_EXISTS(E6_MS3) + case (E_AXIS + 6): WRITE(E6_MS3_PIN, ms3); break; + #endif + #if HAS_E7_MS_PINS && PIN_EXISTS(E7_MS3) + case (E_AXIS + 7): WRITE(E7_MS3_PIN, ms3); break; + #endif + } + #endif // !HAS_SHARED_MICROSTEPPING_PINS } // MS1 MS2 MS3 Stepper Driver Microstepping mode table From 908d30d4cef112ab0272e6bdaa1a58d3dc6c1eb1 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 26 Oct 2025 01:36:21 -0500 Subject: [PATCH 11/27] =?UTF-8?q?=F0=9F=8E=A8=20Some=20chmod=20ug-x?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 0 Marlin/src/pins/rambo/pins_RAMBO_THINKERV2.h | 0 Marlin/src/pins/ramps/pins_PANOWIN_CUTLASS.h | 0 Marlin/src/pins/stm32f1/pins_CHITU3D_V9.h | 0 buildroot/share/PlatformIO/ldscripts/mks_robin_mini.ld | 0 buildroot/share/PlatformIO/ldscripts/mks_robin_nano.ld | 0 .../PlatformIO/variants/MARLIN_TH3D_EZBOARD_V2/hal_conf_extra.h | 0 .../PlatformIO/variants/marlin_maple_CHITU_F103/ld/common.inc | 0 .../PlatformIO/variants/marlin_maple_CHITU_F103/ld/extra_libs.inc | 0 .../variants/marlin_maple_CHITU_F103/ld/stm32f103z_dfu.ld | 0 .../PlatformIO/variants/marlin_maple_CHITU_F103/ld/stm32f103zc.ld | 0 .../PlatformIO/variants/marlin_maple_CHITU_F103/ld/stm32f103zd.ld | 0 .../PlatformIO/variants/marlin_maple_CHITU_F103/ld/stm32f103ze.ld | 0 .../variants/marlin_maple_CHITU_F103/ld/vector_symbols.inc | 0 .../PlatformIO/variants/marlin_maple_CHITU_F103/wirish/start.S | 0 .../PlatformIO/variants/marlin_maple_CHITU_F103/wirish/start_c.c | 0 .../PlatformIO/variants/marlin_maple_CHITU_F103/wirish/syscalls.c | 0 buildroot/share/git/README.md | 0 buildroot/web-ui/data/www/chart.min.js | 0 19 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 .gitignore mode change 100755 => 100644 Marlin/src/pins/rambo/pins_RAMBO_THINKERV2.h mode change 100755 => 100644 Marlin/src/pins/ramps/pins_PANOWIN_CUTLASS.h mode change 100755 => 100644 Marlin/src/pins/stm32f1/pins_CHITU3D_V9.h mode change 100755 => 100644 buildroot/share/PlatformIO/ldscripts/mks_robin_mini.ld mode change 100755 => 100644 buildroot/share/PlatformIO/ldscripts/mks_robin_nano.ld mode change 100755 => 100644 buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_V2/hal_conf_extra.h mode change 100755 => 100644 buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/common.inc mode change 100755 => 100644 buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/extra_libs.inc mode change 100755 => 100644 buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/stm32f103z_dfu.ld mode change 100755 => 100644 buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/stm32f103zc.ld mode change 100755 => 100644 buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/stm32f103zd.ld mode change 100755 => 100644 buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/stm32f103ze.ld mode change 100755 => 100644 buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/vector_symbols.inc mode change 100755 => 100644 buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/wirish/start.S mode change 100755 => 100644 buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/wirish/start_c.c mode change 100755 => 100644 buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/wirish/syscalls.c mode change 100755 => 100644 buildroot/share/git/README.md mode change 100755 => 100644 buildroot/web-ui/data/www/chart.min.js diff --git a/.gitignore b/.gitignore old mode 100755 new mode 100644 diff --git a/Marlin/src/pins/rambo/pins_RAMBO_THINKERV2.h b/Marlin/src/pins/rambo/pins_RAMBO_THINKERV2.h old mode 100755 new mode 100644 diff --git a/Marlin/src/pins/ramps/pins_PANOWIN_CUTLASS.h b/Marlin/src/pins/ramps/pins_PANOWIN_CUTLASS.h old mode 100755 new mode 100644 diff --git a/Marlin/src/pins/stm32f1/pins_CHITU3D_V9.h b/Marlin/src/pins/stm32f1/pins_CHITU3D_V9.h old mode 100755 new mode 100644 diff --git a/buildroot/share/PlatformIO/ldscripts/mks_robin_mini.ld b/buildroot/share/PlatformIO/ldscripts/mks_robin_mini.ld old mode 100755 new mode 100644 diff --git a/buildroot/share/PlatformIO/ldscripts/mks_robin_nano.ld b/buildroot/share/PlatformIO/ldscripts/mks_robin_nano.ld old mode 100755 new mode 100644 diff --git a/buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_V2/hal_conf_extra.h b/buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_V2/hal_conf_extra.h old mode 100755 new mode 100644 diff --git a/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/common.inc b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/common.inc old mode 100755 new mode 100644 diff --git a/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/extra_libs.inc b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/extra_libs.inc old mode 100755 new mode 100644 diff --git a/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/stm32f103z_dfu.ld b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/stm32f103z_dfu.ld old mode 100755 new mode 100644 diff --git a/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/stm32f103zc.ld b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/stm32f103zc.ld old mode 100755 new mode 100644 diff --git a/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/stm32f103zd.ld b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/stm32f103zd.ld old mode 100755 new mode 100644 diff --git a/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/stm32f103ze.ld b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/stm32f103ze.ld old mode 100755 new mode 100644 diff --git a/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/vector_symbols.inc b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/ld/vector_symbols.inc old mode 100755 new mode 100644 diff --git a/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/wirish/start.S b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/wirish/start.S old mode 100755 new mode 100644 diff --git a/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/wirish/start_c.c b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/wirish/start_c.c old mode 100755 new mode 100644 diff --git a/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/wirish/syscalls.c b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/wirish/syscalls.c old mode 100755 new mode 100644 diff --git a/buildroot/share/git/README.md b/buildroot/share/git/README.md old mode 100755 new mode 100644 diff --git a/buildroot/web-ui/data/www/chart.min.js b/buildroot/web-ui/data/www/chart.min.js old mode 100755 new mode 100644 From 6918959c07bae03a07072b6dddaf70801ce9a505 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 26 Oct 2025 16:07:17 -0500 Subject: [PATCH 12/27] =?UTF-8?q?=F0=9F=93=9D=20Comment=20for=20'M900=20U'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/feature/advance/M900.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Marlin/src/gcode/feature/advance/M900.cpp b/Marlin/src/gcode/feature/advance/M900.cpp index 7b92cad9d2..ac6a5246aa 100644 --- a/Marlin/src/gcode/feature/advance/M900.cpp +++ b/Marlin/src/gcode/feature/advance/M900.cpp @@ -41,6 +41,9 @@ * With ADVANCE_K_EXTRA: * S<0/1> Activate slot 0 or 1. * L Set secondary advance K factor (Slot 1). + * + * With SMOOTH_LIN_ADVANCE: + * U Set a tau value for LA smoothing */ void GcodeSuite::M900() { From d7550018e317268f06cd01b58e38a3c3245ec3c8 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Mon, 27 Oct 2025 00:43:00 +0000 Subject: [PATCH 13/27] [cron] Bump distribution date (2025-10-27) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index e1cba4d014..6ff97e922e 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2025-10-26" +//#define STRING_DISTRIBUTION_DATE "2025-10-27" /** * The protocol for communication to the host. Protocol indicates communication diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 53dc6f00f2..56cb8b5518 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2025-10-26" + #define STRING_DISTRIBUTION_DATE "2025-10-27" #endif /** From f635a9d0c362d3263c44704aba041b99fff1c847 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 26 Oct 2025 23:37:39 -0500 Subject: [PATCH 14/27] =?UTF-8?q?=F0=9F=8E=A8=20=20Negation=20without=20re?= =?UTF-8?q?petition?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/serial_base.h | 2 +- Marlin/src/gcode/calibrate/G34_M422.cpp | 2 +- .../lcd/extui/dgus/fysetc/DGUSScreenHandler.cpp | 2 +- .../lcd/extui/dgus/hiprecy/DGUSScreenHandler.cpp | 2 +- .../src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp | 2 +- .../lcd/extui/dgus/origin/DGUSScreenHandler.cpp | 2 +- .../src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp | 6 +++--- Marlin/src/lcd/menu/game/brickout.cpp | 14 +++++++------- Marlin/src/module/stepper.cpp | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Marlin/src/core/serial_base.h b/Marlin/src/core/serial_base.h index a8700f3d23..07bed55b35 100644 --- a/Marlin/src/core/serial_base.h +++ b/Marlin/src/core/serial_base.h @@ -228,7 +228,7 @@ struct SerialBase { // Handle negative numbers if (number < 0.0) { write('-'); - number = -number; + number *= -1; } // Round correctly so that print(1.999, 2) prints as "2.00" diff --git a/Marlin/src/gcode/calibrate/G34_M422.cpp b/Marlin/src/gcode/calibrate/G34_M422.cpp index 1ac58cc894..6c367ad882 100644 --- a/Marlin/src/gcode/calibrate/G34_M422.cpp +++ b/Marlin/src/gcode/calibrate/G34_M422.cpp @@ -390,7 +390,7 @@ void GcodeSuite::G34() { // Decreasing accuracy was detected so move was inverted. // Will match reversed Z steppers on dual steppers. Triple will need more work to map. if (adjustment_reverse) { - z_align_move = -z_align_move; + z_align_move *= -1; if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> Z", zstepper + 1, " correction reversed to ", z_align_move); } #endif diff --git a/Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.cpp index be0e60a8df..f4c7db544b 100644 --- a/Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.cpp @@ -205,7 +205,7 @@ void DGUSScreenHandler::handleManualMove(DGUS_VP_Variable &var, void *val_ptr) { const uint16_t backup_speed = MMS_TO_MMM(feedrate_mm_s); char sign[] = "\0"; int16_t value = movevalue / 100; - if (movevalue < 0) { value = -value; sign[0] = '-'; } + if (movevalue < 0) { value *= -1; sign[0] = '-'; } int16_t fraction = ABS(movevalue) % 100; snprintf_P(buf, 32, PSTR("G0 %c%s%d.%02d F%d"), axiscode, sign, value, fraction, speed); queue.enqueue_one_now(buf); diff --git a/Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.cpp index 297c71f8a9..a62d3a2ffc 100644 --- a/Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.cpp @@ -207,7 +207,7 @@ void DGUSScreenHandler::handleManualMove(DGUS_VP_Variable &var, void *val_ptr) { const uint16_t backup_speed = MMS_TO_MMM(feedrate_mm_s); char sign[] = "\0"; int16_t value = movevalue / 100; - if (movevalue < 0) { value = -value; sign[0] = '-'; } + if (movevalue < 0) { value *= -1; sign[0] = '-'; } int16_t fraction = ABS(movevalue) % 100; snprintf_P(buf, 32, PSTR("G0 %c%s%d.%02d F%d"), axiscode, sign, value, fraction, speed); queue.enqueue_one_now(buf); diff --git a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp index 010e1be381..2965d75da3 100644 --- a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp @@ -778,7 +778,7 @@ void DGUSScreenHandler::handleManualMove(DGUS_VP_Variable &var, void *val_ptr) { char buf[32]; // G1 X9999.99 F12345 char sign[] = "\0"; int16_t value = movevalue / 100; - if (movevalue < 0) { value = -value; sign[0] = '-'; } + if (movevalue < 0) { value *= -1; sign[0] = '-'; } const int16_t fraction = ABS(movevalue) % 100; snprintf_P(buf, 32, PSTR("G0 %c%s%d.%02d F%d"), axiscode, sign, value, fraction, speed); queue.enqueue_one_now(buf); diff --git a/Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.cpp index 0afc8a25ad..ac73c8cf65 100644 --- a/Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.cpp @@ -207,7 +207,7 @@ void DGUSScreenHandler::handleManualMove(DGUS_VP_Variable &var, void *val_ptr) { const uint16_t backup_speed = MMS_TO_MMM(feedrate_mm_s); char sign[] = "\0"; int16_t value = movevalue / 100; - if (movevalue < 0) { value = -value; sign[0] = '-'; } + if (movevalue < 0) { value *= -1; sign[0] = '-'; } int16_t fraction = ABS(movevalue) % 100; snprintf_P(buf, 32, PSTR("G0 %c%s%d.%02d F%d"), axiscode, sign, value, fraction, speed); queue.enqueue_one_now(buf); diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp index e195654caa..6b2caadba0 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp @@ -676,11 +676,11 @@ void DGUSRxHandler::moveStep(DGUS_VP &vp, void *data_ptr) { switch (direction) { default: return; - case DGUS_Data::MoveDirection::XM: offset = -offset; + case DGUS_Data::MoveDirection::XM: offset *= -1; case DGUS_Data::MoveDirection::XP: axis = ExtUI::X; break; - case DGUS_Data::MoveDirection::YM: offset = -offset; + case DGUS_Data::MoveDirection::YM: offset *= -1; case DGUS_Data::MoveDirection::YP: axis = ExtUI::Y; break; - case DGUS_Data::MoveDirection::ZM: offset = -offset; + case DGUS_Data::MoveDirection::ZM: offset *= -1; case DGUS_Data::MoveDirection::ZP: axis = ExtUI::Z; break; } diff --git a/Marlin/src/lcd/menu/game/brickout.cpp b/Marlin/src/lcd/menu/game/brickout.cpp index 061e4e89c8..7b596a156f 100644 --- a/Marlin/src/lcd/menu/game/brickout.cpp +++ b/Marlin/src/lcd/menu/game/brickout.cpp @@ -53,7 +53,7 @@ void reset_ball() { bdat.ballv = FTOF(1.3f); bdat.ballh = -FTOF(1.25f); uint8_t bx = bdat.paddle_x + (PADDLE_W) / 2 + ball_dist; - if (bx >= GAME_WIDTH - 10) { bx -= ball_dist * 2; bdat.ballh = -bdat.ballh; } + if (bx >= GAME_WIDTH - 10) { bx -= ball_dist * 2; bdat.ballh *= -1; } bdat.ballx = BTOF(bx); bdat.hit_dir = -1; } @@ -71,10 +71,10 @@ void BrickoutGame::game_screen() { // Provisionally update the ball position const fixed_t newx = bdat.ballx + bdat.ballh, newy = bdat.bally + bdat.ballv; // current next position if (!WITHIN(newx, 0, BTOF(GAME_WIDTH - 1))) { // out in x? - bdat.ballh = -bdat.ballh; _BUZZ(5, 220); // bounce x + bdat.ballh *= -1; _BUZZ(5, 220); // bounce x } if (newy < 0) { // out in y? - bdat.ballv = -bdat.ballv; _BUZZ(5, 280); // bounce v + bdat.ballv *= -1; _BUZZ(5, 280); // bounce v bdat.hit_dir = 1; } // Did the ball go below the bottom? @@ -96,8 +96,8 @@ void BrickoutGame::game_screen() { // If bricks are gone, go to reset state if (!--bdat.brick_count) game_state = 2; // Bounce the ball cleverly - if ((bdat.ballv < 0) == (bdat.hit_dir < 0)) { bdat.ballv = -bdat.ballv; bdat.ballh += fixed_t(random(-16, 16)); _BUZZ(5, 880); } - else { bdat.ballh = -bdat.ballh; bdat.ballv += fixed_t(random(-16, 16)); _BUZZ(5, 640); } + if ((bdat.ballv < 0) == (bdat.hit_dir < 0)) { bdat.ballv *= -1; bdat.ballh += fixed_t(random(-16, 16)); _BUZZ(5, 880); } + else { bdat.ballh *= -1; bdat.ballv += fixed_t(random(-16, 16)); _BUZZ(5, 640); } } } // Is the ball moving down and in paddle range? @@ -107,13 +107,13 @@ void BrickoutGame::game_screen() { if (WITHIN(diff, 0, PADDLE_W - 1)) { // Reverse Y direction - bdat.ballv = -bdat.ballv; _BUZZ(3, 880); + bdat.ballv *= -1; _BUZZ(3, 880); bdat.hit_dir = -1; // Near edges affects X velocity const bool is_left_edge = (diff <= 1); if (is_left_edge || diff >= PADDLE_W-1 - 1) { - if ((bdat.ballh > 0) == is_left_edge) bdat.ballh = -bdat.ballh; + if ((bdat.ballh > 0) == is_left_edge) bdat.ballh *= -1; } else if (diff <= 3) { bdat.ballh += fixed_t(random(-64, 0)); diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 6be58e7bb5..cc0401cc6c 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -2515,7 +2515,7 @@ hal_timer_t Stepper::block_phase_isr() { if (forward_e != motor_direction(E_AXIS)) { last_direction_bits.toggle(E_AXIS); - count_direction.e = -count_direction.e; + count_direction.e *= -1; DIR_WAIT_BEFORE(); @@ -2876,7 +2876,7 @@ hal_timer_t Stepper::block_phase_isr() { la_interval = calc_timer_interval(uint32_t(ABS(step_rate))); if (forward_e != motor_direction(E_AXIS)) { last_direction_bits.toggle(E_AXIS); - count_direction.e = -count_direction.e; + count_direction.e *= -1; DIR_WAIT_BEFORE(); E_APPLY_DIR(forward_e, false); TERN_(FT_MOTION, last_set_direction = last_direction_bits); From 97b5c2d3eaecd808cee9fd888b4f70b6def88376 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 27 Oct 2025 11:12:44 -0500 Subject: [PATCH 15/27] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Fix,?= =?UTF-8?q?=20extend=20'types.h'=20operators?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/types.h | 65 +++++++++++++++++++++++++---------- Marlin/src/module/stepper.cpp | 2 +- 2 files changed, 47 insertions(+), 20 deletions(-) diff --git a/Marlin/src/core/types.h b/Marlin/src/core/types.h index 99a4e31a5d..cac42da06e 100644 --- a/Marlin/src/core/types.h +++ b/Marlin/src/core/types.h @@ -547,13 +547,13 @@ struct XYval { FI constexpr T large() const { return _MAX(x, y); } // Explicit copy and copies with conversion - FI constexpr XYval copy() const { return *this; } - FI constexpr XYval ABS() const { return { T(_ABS(x)), T(_ABS(y)) }; } - FI constexpr XYval asInt() const { return { int16_t(x), int16_t(y) }; } - FI constexpr XYval asLong() const { return { int32_t(x), int32_t(y) }; } - FI constexpr XYval ROUNDL() const { return { int32_t(LROUND(x)), int32_t(LROUND(y)) }; } - FI constexpr XYval asFloat() const { return { static_cast(x), static_cast(y) }; } - FI constexpr XYval reciprocal() const { return { _RECIP(x), _RECIP(y) }; } + FI constexpr XYval copy() const { return *this; } + FI constexpr XYval ABS() const { return { T(_ABS(x)), T(_ABS(y)) }; } + FI constexpr XYval asInt16() const { return { int16_t(x), int16_t(y) }; } + FI constexpr XYval asInt32() const { return { int32_t(x), int32_t(y) }; } + FI constexpr XYval ROUNDL() const { return { int32_t(LROUND(x)), int32_t(LROUND(y)) }; } + FI constexpr XYval asFloat() const { return { static_cast(x), static_cast(y) }; } + FI constexpr XYval reciprocal() const { return { _RECIP(x), _RECIP(y) }; } // Marlin workspace shifting is done with G92 and M206 FI XYval asLogical() const { XYval o = asFloat(); toLogical(o); return o; } @@ -625,6 +625,11 @@ struct XYval { FI bool operator!=(const XYval &rs) const { return !operator==(rs); } FI bool operator!=(const XYZval &rs) const { return !operator==(rs); } FI bool operator!=(const XYZEval &rs) const { return !operator==(rs); } + + // Exact comparison to a single value + FI bool operator==(const T &p) const { return x == p && y == p; } + FI bool operator!=(const T &p) const { return !operator==(p); } + }; // @@ -701,8 +706,8 @@ struct XYZval { // Explicit copy and copies with conversion FI constexpr XYZval copy() const { XYZval o = *this; return o; } FI constexpr XYZval ABS() const { return NUM_AXIS_ARRAY(T(_ABS(x)), T(_ABS(y)), T(_ABS(z)), T(_ABS(i)), T(_ABS(j)), T(_ABS(k)), T(_ABS(u)), T(_ABS(v)), T(_ABS(w))); } - FI constexpr XYZval asInt() const { return NUM_AXIS_ARRAY(int16_t(x), int16_t(y), int16_t(z), int16_t(i), int16_t(j), int16_t(k), int16_t(u), int16_t(v), int16_t(w)); } - FI constexpr XYZval asLong() const { return NUM_AXIS_ARRAY(int32_t(x), int32_t(y), int32_t(z), int32_t(i), int32_t(j), int32_t(k), int32_t(u), int32_t(v), int32_t(w)); } + FI constexpr XYZval asInt16() const { return NUM_AXIS_ARRAY(int16_t(x), int16_t(y), int16_t(z), int16_t(i), int16_t(j), int16_t(k), int16_t(u), int16_t(v), int16_t(w)); } + FI constexpr XYZval asInt32() const { return NUM_AXIS_ARRAY(int32_t(x), int32_t(y), int32_t(z), int32_t(i), int32_t(j), int32_t(k), int32_t(u), int32_t(v), int32_t(w)); } FI constexpr XYZval ROUNDL() const { return NUM_AXIS_ARRAY(int32_t(LROUND(x)), int32_t(LROUND(y)), int32_t(LROUND(z)), int32_t(LROUND(i)), int32_t(LROUND(j)), int32_t(LROUND(k)), int32_t(LROUND(u)), int32_t(LROUND(v)), int32_t(LROUND(w))); } FI constexpr XYZval asFloat() const { return NUM_AXIS_ARRAY(static_cast(x), static_cast(y), static_cast(z), static_cast(i), static_cast(j), static_cast(k), static_cast(u), static_cast(v), static_cast(w)); } FI constexpr XYZval reciprocal() const { return NUM_AXIS_ARRAY(_RECIP(x), _RECIP(y), _RECIP(z), _RECIP(i), _RECIP(j), _RECIP(k), _RECIP(u), _RECIP(v), _RECIP(w)); } @@ -772,8 +777,13 @@ struct XYZval { FI XYZval& operator<<=(const int &p) { NUM_AXIS_CODE(_LSE(x), _LSE(y), _LSE(z), _LSE(i), _LSE(j), _LSE(k), _LSE(u), _LSE(v), _LSE(w)); return *this; } // Exact comparisons. For floats a "NEAR" operation may be better. - FI bool operator==(const XYZEval &rs) const { return true NUM_AXIS_GANG(&& x == rs.x, && y == rs.y, && z == rs.z, && i == rs.i, && j == rs.j, && k == rs.k, && u == rs.u, && v == rs.v, && w == rs.w); } + FI bool operator==(const XYZEval &rs) const { return ENABLED(HAS_X_AXIS) NUM_AXIS_GANG(&& x == rs.x, && y == rs.y, && z == rs.z, && i == rs.i, && j == rs.j, && k == rs.k, && u == rs.u, && v == rs.v, && w == rs.w); } FI bool operator!=(const XYZEval &rs) const { return !operator==(rs); } + + // Exact comparison to a single value + FI bool operator==(const T &p) const { return ENABLED(HAS_X_AXIS) NUM_AXIS_GANG(&& x == p, && y == p, && z == p, && i == p, && j == p, && k == p, && u == p, && v == p, && w == p); } + FI bool operator!=(const T &p) const { return !operator==(p); } + }; // @@ -849,13 +859,16 @@ struct XYZEval { FI constexpr T large() const { return _MAX(LOGICAL_AXIS_LIST(e, x, y, z, i, j, k, u, v, w)); } // Explicit copy and copies with conversion - FI constexpr XYZEval copy() const { XYZEval v = *this; return v; } - FI constexpr XYZEval ABS() const { return LOGICAL_AXIS_ARRAY(T(_ABS(e)), T(_ABS(x)), T(_ABS(y)), T(_ABS(z)), T(_ABS(i)), T(_ABS(j)), T(_ABS(k)), T(_ABS(u)), T(_ABS(v)), T(_ABS(w))); } - FI constexpr XYZEval asInt() const { return LOGICAL_AXIS_ARRAY(int16_t(e), int16_t(x), int16_t(y), int16_t(z), int16_t(i), int16_t(j), int16_t(k), int16_t(u), int16_t(v), int16_t(w)); } - FI constexpr XYZEval asLong() const { return LOGICAL_AXIS_ARRAY(int32_t(e), int32_t(x), int32_t(y), int32_t(z), int32_t(i), int32_t(j), int32_t(k), int32_t(u), int32_t(v), int32_t(w)); } - FI constexpr XYZEval ROUNDL() const { return LOGICAL_AXIS_ARRAY(int32_t(LROUND(e)), int32_t(LROUND(x)), int32_t(LROUND(y)), int32_t(LROUND(z)), int32_t(LROUND(i)), int32_t(LROUND(j)), int32_t(LROUND(k)), int32_t(LROUND(u)), int32_t(LROUND(v)), int32_t(LROUND(w))); } - FI constexpr XYZEval asFloat() const { return LOGICAL_AXIS_ARRAY(static_cast(e), static_cast(x), static_cast(y), static_cast(z), static_cast(i), static_cast(j), static_cast(k), static_cast(u), static_cast(v), static_cast(w)); } - FI constexpr XYZEval reciprocal() const { return LOGICAL_AXIS_ARRAY(_RECIP(e), _RECIP(x), _RECIP(y), _RECIP(z), _RECIP(i), _RECIP(j), _RECIP(k), _RECIP(u), _RECIP(v), _RECIP(w)); } + FI constexpr XYZEval copy() const { XYZEval v = *this; return v; } + FI constexpr XYZEval ABS() const { return LOGICAL_AXIS_ARRAY(T(_ABS(e)), T(_ABS(x)), T(_ABS(y)), T(_ABS(z)), T(_ABS(i)), T(_ABS(j)), T(_ABS(k)), T(_ABS(u)), T(_ABS(v)), T(_ABS(w))); } + FI constexpr XYZEval asInt16() const { return LOGICAL_AXIS_ARRAY(int16_t(e), int16_t(x), int16_t(y), int16_t(z), int16_t(i), int16_t(j), int16_t(k), int16_t(u), int16_t(v), int16_t(w)); } + FI constexpr XYZEval asInt32() const { return LOGICAL_AXIS_ARRAY(int32_t(e), int32_t(x), int32_t(y), int32_t(z), int32_t(i), int32_t(j), int32_t(k), int32_t(u), int32_t(v), int32_t(w)); } + FI constexpr XYZEval asUInt32() const { return LOGICAL_AXIS_ARRAY(uint32_t(e), uint32_t(x), uint32_t(y), uint32_t(z), uint32_t(i), uint32_t(j), uint32_t(k), uint32_t(u), uint32_t(v), uint32_t(w)); } + FI constexpr XYZEval asInt64() const { return LOGICAL_AXIS_ARRAY(int64_t(e), int64_t(x), int64_t(y), int64_t(z), int64_t(i), int64_t(j), int64_t(k), int64_t(u), int64_t(v), int64_t(w)); } + FI constexpr XYZEval asUInt64() const { return LOGICAL_AXIS_ARRAY(uint64_t(e), uint64_t(x), uint64_t(y), uint64_t(z), uint64_t(i), uint64_t(j), uint64_t(k), uint64_t(u), uint64_t(v), uint64_t(w)); } + FI constexpr XYZEval ROUNDL() const { return LOGICAL_AXIS_ARRAY(int32_t(LROUND(e)), int32_t(LROUND(x)), int32_t(LROUND(y)), int32_t(LROUND(z)), int32_t(LROUND(i)), int32_t(LROUND(j)), int32_t(LROUND(k)), int32_t(LROUND(u)), int32_t(LROUND(v)), int32_t(LROUND(w))); } + FI constexpr XYZEval asFloat() const { return LOGICAL_AXIS_ARRAY(static_cast(e), static_cast(x), static_cast(y), static_cast(z), static_cast(i), static_cast(j), static_cast(k), static_cast(u), static_cast(v), static_cast(w)); } + FI constexpr XYZEval reciprocal() const { return LOGICAL_AXIS_ARRAY(_RECIP(e), _RECIP(x), _RECIP(y), _RECIP(z), _RECIP(i), _RECIP(j), _RECIP(k), _RECIP(u), _RECIP(v), _RECIP(w)); } // Marlin workspace shifting is done with G92 and M206 FI XYZEval asLogical() const { XYZEval o = asFloat(); toLogical(o); return o; } @@ -889,7 +902,10 @@ struct XYZEval { FI constexpr XYZEval operator- (const XYZEval &rs) const { return LOGICAL_AXIS_ARRAY(T(e - rs.e), T(x - rs.x), T(y - rs.y), T(z - rs.z), T(i - rs.i), T(j - rs.j), T(k - rs.k), T(u - rs.u), T(v - rs.v), T(w - rs.w)); } FI constexpr XYZEval operator* (const XYZEval &rs) const { return LOGICAL_AXIS_ARRAY(T(e * rs.e), T(x * rs.x), T(y * rs.y), T(z * rs.z), T(i * rs.i), T(j * rs.j), T(k * rs.k), T(u * rs.u), T(v * rs.v), T(w * rs.w)); } FI constexpr XYZEval operator/ (const XYZEval &rs) const { return LOGICAL_AXIS_ARRAY(T(e / rs.e), T(x / rs.x), T(y / rs.y), T(z / rs.z), T(i / rs.i), T(j / rs.j), T(k / rs.k), T(u / rs.u), T(v / rs.v), T(w / rs.w)); } + FI constexpr XYZEval operator+ (const uint32_t &p) const { return LOGICAL_AXIS_ARRAY(T(e + p), T(x + p), T(y + p), T(z + p), T(i + p), T(j + p), T(k + p), T(u + p), T(v + p), T(w + p)); } FI constexpr XYZEval operator* (const float &p) const { return LOGICAL_AXIS_ARRAY(T(e * p), T(x * p), T(y * p), T(z * p), T(i * p), T(j * p), T(k * p), T(u * p), T(v * p), T(w * p)); } + FI constexpr XYZEval operator* (const uint32_t &p) const { return LOGICAL_AXIS_ARRAY(T(e * p), T(x * p), T(y * p), T(z * p), T(i * p), T(j * p), T(k * p), T(u * p), T(v * p), T(w * p)); } + FI constexpr XYZEval operator& (const int64_t &p) const { return LOGICAL_AXIS_ARRAY(T(e & p), T(x & p), T(y & p), T(z & p), T(i & p), T(j & p), T(k & p), T(u & p), T(v & p), T(w & p)); } FI constexpr XYZEval operator* (const int &p) const { return LOGICAL_AXIS_ARRAY(e * p, x * p, y * p, z * p, i * p, j * p, k * p, u * p, v * p, w * p); } FI constexpr XYZEval operator/ (const float &p) const { return LOGICAL_AXIS_ARRAY(T(e / p), T(x / p), T(y / p), T(z / p), T(i / p), T(j / p), T(k / p), T(u / p), T(v / p), T(w / p)); } FI constexpr XYZEval operator/ (const int &p) const { return LOGICAL_AXIS_ARRAY(e / p, x / p, y / p, z / p, i / p, j / p, k / p, u / p, v / p, w / p); } @@ -920,14 +936,22 @@ struct XYZEval { FI XYZEval& operator<<=(const int &p) { LOGICAL_AXIS_CODE(_LSE(e), _LSE(x), _LSE(y), _LSE(z), _LSE(i), _LSE(j), _LSE(k), _LSE(u), _LSE(v), _LSE(w)); return *this; } // Exact comparisons. For floats a "NEAR" operation may be better. - FI bool operator==(const XYZval &rs) const { return true NUM_AXIS_GANG(&& x == rs.x, && y == rs.y, && z == rs.z, && i == rs.i, && j == rs.j, && k == rs.k, && u == rs.u, && v == rs.v, && w == rs.w); } - FI bool operator==(const XYZEval &rs) const { return true LOGICAL_AXIS_GANG(&& e == rs.e, && x == rs.x, && y == rs.y, && z == rs.z, && i == rs.i, && j == rs.j, && k == rs.k, && u == rs.u, && v == rs.v, && w == rs.w); } + FI bool operator==(const XYZval &rs) const { return ENABLED(HAS_X_AXIS) NUM_AXIS_GANG(&& x == rs.x, && y == rs.y, && z == rs.z, && i == rs.i, && j == rs.j, && k == rs.k, && u == rs.u, && v == rs.v, && w == rs.w); } + FI bool operator==(const XYZEval &rs) const { return ANY(HAS_X_AXIS, HAS_EXTRUDERS) LOGICAL_AXIS_GANG(&& e == rs.e, && x == rs.x, && y == rs.y, && z == rs.z, && i == rs.i, && j == rs.j, && k == rs.k, && u == rs.u, && v == rs.v, && w == rs.w); } FI bool operator!=(const XYZval &rs) const { return !operator==(rs); } FI bool operator!=(const XYZEval &rs) const { return !operator==(rs); } + + // Exact comparison to a single value + FI bool operator==(const T &p) const { return ENABLED(HAS_X_AXIS) LOGICAL_AXIS_GANG(&& e == p, && x == p, && y == p, && z == p, && i == p, && j == p, && k == p, && u == p, && v == p, && w == p); } + FI bool operator!=(const T &p) const { return !operator==(p); } + }; #include // for memset +// +// Axis indexed arrays of type T (x[SIZE], y[SIZE], etc.) +// template struct XYZarray { typedef T el[SIZE]; @@ -1027,6 +1051,9 @@ struct XYZEarray { FI XYZEval operator[](const int n) const { return XYZval(LOGICAL_AXIS_ARRAY(e[n], x[n], y[n], z[n], i[n], j[n], k[n], u[n], v[n], w[n])); } }; +// +// Axes mapped to bits in a mask of minimum size, bits_t(NUM_AXIS_HEADS) +// class AxisBits { public: typedef bits_t(NUM_AXIS_HEADS) el; diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index cc0401cc6c..3025cb83bd 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -2699,7 +2699,7 @@ hal_timer_t Stepper::block_phase_isr() { TERN_(HAS_ROUGH_LIN_ADVANCE, la_delta_error = delta_error); // Calculate Bresenham dividends and divisors - advance_dividend = (current_block->steps << 1).asLong(); + advance_dividend = (current_block->steps << 1).asInt32(); advance_divisor = step_event_count << 1; #if ENABLED(INPUT_SHAPING_X) From 3a9394c3082cc12932e97b38a812c0a7a0ef12bc Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 27 Oct 2025 11:13:40 -0500 Subject: [PATCH 16/27] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Sync?= =?UTF-8?q?=20blocks=20'const'=20hint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/planner.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index 0ad68352ee..b6fdc2fc6f 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -209,12 +209,12 @@ typedef struct PlannerBlock { volatile block_flags_t flag; // Block flags - bool is_sync_pos() { return flag.sync_position; } - bool is_sync_fan() { return TERN0(LASER_SYNCHRONOUS_M106_M107, flag.sync_fans); } - bool is_sync_pwr() { return TERN0(LASER_POWER_SYNC, flag.sync_laser_pwr); } - bool is_sync() { return is_sync_pos() || is_sync_fan() || is_sync_pwr(); } - bool is_page() { return TERN0(DIRECT_STEPPING, flag.page); } - bool is_move() { return !(is_sync() || is_page()); } + bool is_sync_pos() const { return flag.sync_position; } + bool is_sync_fan() const { return TERN0(LASER_SYNCHRONOUS_M106_M107, flag.sync_fans); } + bool is_sync_pwr() const { return TERN0(LASER_POWER_SYNC, flag.sync_laser_pwr); } + bool is_sync() const { return is_sync_pos() || is_sync_fan() || is_sync_pwr(); } + bool is_page() const { return TERN0(DIRECT_STEPPING, flag.page); } + bool is_move() const { return !(is_sync() || is_page()); } // Fields used by the motion planner to manage acceleration float nominal_speed, // The nominal speed for this block in (mm/sec) From 42dc89ad32f40f4cff55b9650647aae5d2d4724a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 27 Oct 2025 11:39:01 -0500 Subject: [PATCH 17/27] =?UTF-8?q?=F0=9F=94=A8=20Use=20'which'=20in=20Makef?= =?UTF-8?q?ile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #28141 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f3e4d80b36..68c522e5b6 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ UNIT_TEST_CONFIG ?= default # Find a Python 3 interpreter ifeq ($(OS),Windows_NT) # Windows: use `where` – fall back through the three common names - PYTHON := $(shell where python 2>nul || where python3 2>nul || where py 2>nul) + PYTHON := $(shell which python 2>nul || which python3 2>nul || which py 2>nul) # Windows: Use cmd tools to find pins files PINS_RAW := $(shell cmd //c "dir /s /b Marlin\src\pins\*.h 2>nul | findstr /r ".*Marlin\\\\src\\\\pins\\\\.*\\\\pins_.*\.h"") PINS := $(subst \,/,$(PINS_RAW)) From 7c760bd232a1ddb0a195fc031bd7cd4974c93411 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 27 Oct 2025 13:31:30 -0500 Subject: [PATCH 18/27] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Misc.?= =?UTF-8?q?=20MMU3=20tweaks,=20less=20STL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/feature/mmu3/mmu3_protocol_logic.cpp | 22 +++++++++---------- Marlin/src/feature/mmu3/mmu3_protocol_logic.h | 19 +--------------- 2 files changed, 12 insertions(+), 29 deletions(-) diff --git a/Marlin/src/feature/mmu3/mmu3_protocol_logic.cpp b/Marlin/src/feature/mmu3/mmu3_protocol_logic.cpp index cf74e669b8..4323925b6b 100644 --- a/Marlin/src/feature/mmu3/mmu3_protocol_logic.cpp +++ b/Marlin/src/feature/mmu3/mmu3_protocol_logic.cpp @@ -707,7 +707,7 @@ namespace MMU3 { } bool ProtocolLogic::Elapsed(uint32_t timeout) const { - return _millis() >= (lastUARTActivityMs + timeout); + return ELAPSED(_millis(), lastUARTActivityMs + timeout); } void ProtocolLogic::RecordUARTActivity() { @@ -716,7 +716,7 @@ namespace MMU3 { void ProtocolLogic::RecordReceivedByte(uint8_t c) { lastReceivedBytes[lrb] = c; - lrb = (lrb + 1) % lastReceivedBytes.size(); + lrb = (lrb + 1) % COUNT(lastReceivedBytes); } constexpr char NibbleToChar(uint8_t c) { @@ -728,13 +728,13 @@ namespace MMU3 { } void ProtocolLogic::FormatLastReceivedBytes(char *dst) { - for (uint8_t i = 0; i < lastReceivedBytes.size(); ++i) { - uint8_t b = lastReceivedBytes[(lrb - i - 1) % lastReceivedBytes.size()]; + for (uint8_t i = 0; i < COUNT(lastReceivedBytes); ++i) { + uint8_t b = lastReceivedBytes[(COUNT(lastReceivedBytes) - 1 + (lrb - i)) % COUNT(lastReceivedBytes)]; dst[i * 3] = NibbleToChar(b >> 4); dst[i * 3 + 1] = NibbleToChar(b & 0xf); dst[i * 3 + 2] = ' '; } - dst[(lastReceivedBytes.size() - 1) * 3 + 2] = 0; // terminate properly + dst[(COUNT(lastReceivedBytes) - 1) * 3 + 2] = 0; // terminate properly } void ProtocolLogic::FormatLastResponseMsgAndClearLRB(char *dst) { @@ -777,18 +777,18 @@ namespace MMU3 { } void ProtocolLogic::LogError(const char *reason_P) { - char lrb[lastReceivedBytes.size() * 3]; - FormatLastReceivedBytes(lrb); + char _lrb[COUNT(lastReceivedBytes) * 3]; + FormatLastReceivedBytes(_lrb); MMU2_ERROR_MSGRPGM(reason_P); SERIAL_ECHOPGM(", last bytes: "); - SERIAL_ECHOLN(lrb); + SERIAL_ECHOLN(_lrb); } void ProtocolLogic::LogResponse() { - char lrb[lastReceivedBytes.size()]; - FormatLastResponseMsgAndClearLRB(lrb); - MMU2_ECHO_MSGLN(lrb); + char _lrb[COUNT(lastReceivedBytes)]; + FormatLastResponseMsgAndClearLRB(_lrb); + MMU2_ECHO_MSGLN(_lrb); } StepStatus ProtocolLogic::SuppressShortDropOuts(const char *msg_P, StepStatus ss) { diff --git a/Marlin/src/feature/mmu3/mmu3_protocol_logic.h b/Marlin/src/feature/mmu3/mmu3_protocol_logic.h index 2fef77c276..30f9c5d0d5 100644 --- a/Marlin/src/feature/mmu3/mmu3_protocol_logic.h +++ b/Marlin/src/feature/mmu3/mmu3_protocol_logic.h @@ -36,24 +36,8 @@ #include "mmu_hw/buttons.h" #include "mmu_hw/registers.h" #include "mmu3_protocol.h" - - // #include std array is not available on AVR ... we need to "fake" it - namespace std { - template - class array { - T data[N]; - public: - array() = default; - inline constexpr T *begin() const { return data; } - inline constexpr T *end() const { return data + N; } - static constexpr uint8_t size() { return N; } - inline T &operator[](uint8_t i) { return data[i]; } - }; - } // std - #else // !__AVR__ - #include #include "mmu_hw/error_codes.h" #include "mmu_hw/progress_codes.h" @@ -351,8 +335,7 @@ namespace MMU3 { Protocol protocol; //!< protocol codec - std::array lastReceivedBytes; //!< remembers the last few bytes of incoming communication for diagnostic purposes - uint8_t lrb; + uint8_t lrb, lastReceivedBytes[16]; //!< keep the last few bytes of incoming communication for diagnostic purposes ErrorCode errorCode; //!< last received error code from the MMU ProgressCode progressCode; //!< last received progress code from the MMU From c941ce1a5bda4a4cea0994fc9337b1715874e9f3 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 27 Oct 2025 13:39:17 -0500 Subject: [PATCH 19/27] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Simpl?= =?UTF-8?q?er=20type=20conversion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/types.h | 61 ++++++++++++++++++++++++++++------- Marlin/src/module/stepper.cpp | 2 +- 2 files changed, 50 insertions(+), 13 deletions(-) diff --git a/Marlin/src/core/types.h b/Marlin/src/core/types.h index cac42da06e..d20a23aba3 100644 --- a/Marlin/src/core/types.h +++ b/Marlin/src/core/types.h @@ -549,12 +549,21 @@ struct XYval { // Explicit copy and copies with conversion FI constexpr XYval copy() const { return *this; } FI constexpr XYval ABS() const { return { T(_ABS(x)), T(_ABS(y)) }; } - FI constexpr XYval asInt16() const { return { int16_t(x), int16_t(y) }; } - FI constexpr XYval asInt32() const { return { int32_t(x), int32_t(y) }; } FI constexpr XYval ROUNDL() const { return { int32_t(LROUND(x)), int32_t(LROUND(y)) }; } - FI constexpr XYval asFloat() const { return { static_cast(x), static_cast(y) }; } FI constexpr XYval reciprocal() const { return { _RECIP(x), _RECIP(y) }; } + // Conversion to other types + template + constexpr XYval as() const { + return XYval{ static_cast(x), static_cast(y) }; + } + FI constexpr XYval asInt16() const { return as(); } + FI constexpr XYval asInt32() const { return as(); } + FI constexpr XYval asUInt32() const { return as(); } + FI constexpr XYval asInt64() const { return as(); } + FI constexpr XYval asUInt64() const { return as(); } + FI constexpr XYval asFloat() const { return as(); } + // Marlin workspace shifting is done with G92 and M206 FI XYval asLogical() const { XYval o = asFloat(); toLogical(o); return o; } FI XYval asNative() const { XYval o = asFloat(); toNative(o); return o; } @@ -706,12 +715,27 @@ struct XYZval { // Explicit copy and copies with conversion FI constexpr XYZval copy() const { XYZval o = *this; return o; } FI constexpr XYZval ABS() const { return NUM_AXIS_ARRAY(T(_ABS(x)), T(_ABS(y)), T(_ABS(z)), T(_ABS(i)), T(_ABS(j)), T(_ABS(k)), T(_ABS(u)), T(_ABS(v)), T(_ABS(w))); } - FI constexpr XYZval asInt16() const { return NUM_AXIS_ARRAY(int16_t(x), int16_t(y), int16_t(z), int16_t(i), int16_t(j), int16_t(k), int16_t(u), int16_t(v), int16_t(w)); } - FI constexpr XYZval asInt32() const { return NUM_AXIS_ARRAY(int32_t(x), int32_t(y), int32_t(z), int32_t(i), int32_t(j), int32_t(k), int32_t(u), int32_t(v), int32_t(w)); } FI constexpr XYZval ROUNDL() const { return NUM_AXIS_ARRAY(int32_t(LROUND(x)), int32_t(LROUND(y)), int32_t(LROUND(z)), int32_t(LROUND(i)), int32_t(LROUND(j)), int32_t(LROUND(k)), int32_t(LROUND(u)), int32_t(LROUND(v)), int32_t(LROUND(w))); } - FI constexpr XYZval asFloat() const { return NUM_AXIS_ARRAY(static_cast(x), static_cast(y), static_cast(z), static_cast(i), static_cast(j), static_cast(k), static_cast(u), static_cast(v), static_cast(w)); } FI constexpr XYZval reciprocal() const { return NUM_AXIS_ARRAY(_RECIP(x), _RECIP(y), _RECIP(z), _RECIP(i), _RECIP(j), _RECIP(k), _RECIP(u), _RECIP(v), _RECIP(w)); } + // Conversion to other types + template + constexpr XYZval as() const { + return XYZval{ + NUM_AXIS_LIST( + static_cast(x), static_cast(y), static_cast(z), + static_cast(i), static_cast(j), static_cast(k), + static_cast(u), static_cast(v), static_cast(w) + ) + }; + } + FI constexpr XYZval asInt16() const { return as(); } + FI constexpr XYZval asInt32() const { return as(); } + FI constexpr XYZval asUInt32() const { return as(); } + FI constexpr XYZval asInt64() const { return as(); } + FI constexpr XYZval asUInt64() const { return as(); } + FI constexpr XYZval asFloat() const { return as(); } + // Marlin workspace shifting is done with G92 and M206 FI XYZval asLogical() const { XYZval o = asFloat(); toLogical(o); return o; } FI XYZval asNative() const { XYZval o = asFloat(); toNative(o); return o; } @@ -861,15 +885,28 @@ struct XYZEval { // Explicit copy and copies with conversion FI constexpr XYZEval copy() const { XYZEval v = *this; return v; } FI constexpr XYZEval ABS() const { return LOGICAL_AXIS_ARRAY(T(_ABS(e)), T(_ABS(x)), T(_ABS(y)), T(_ABS(z)), T(_ABS(i)), T(_ABS(j)), T(_ABS(k)), T(_ABS(u)), T(_ABS(v)), T(_ABS(w))); } - FI constexpr XYZEval asInt16() const { return LOGICAL_AXIS_ARRAY(int16_t(e), int16_t(x), int16_t(y), int16_t(z), int16_t(i), int16_t(j), int16_t(k), int16_t(u), int16_t(v), int16_t(w)); } - FI constexpr XYZEval asInt32() const { return LOGICAL_AXIS_ARRAY(int32_t(e), int32_t(x), int32_t(y), int32_t(z), int32_t(i), int32_t(j), int32_t(k), int32_t(u), int32_t(v), int32_t(w)); } - FI constexpr XYZEval asUInt32() const { return LOGICAL_AXIS_ARRAY(uint32_t(e), uint32_t(x), uint32_t(y), uint32_t(z), uint32_t(i), uint32_t(j), uint32_t(k), uint32_t(u), uint32_t(v), uint32_t(w)); } - FI constexpr XYZEval asInt64() const { return LOGICAL_AXIS_ARRAY(int64_t(e), int64_t(x), int64_t(y), int64_t(z), int64_t(i), int64_t(j), int64_t(k), int64_t(u), int64_t(v), int64_t(w)); } - FI constexpr XYZEval asUInt64() const { return LOGICAL_AXIS_ARRAY(uint64_t(e), uint64_t(x), uint64_t(y), uint64_t(z), uint64_t(i), uint64_t(j), uint64_t(k), uint64_t(u), uint64_t(v), uint64_t(w)); } FI constexpr XYZEval ROUNDL() const { return LOGICAL_AXIS_ARRAY(int32_t(LROUND(e)), int32_t(LROUND(x)), int32_t(LROUND(y)), int32_t(LROUND(z)), int32_t(LROUND(i)), int32_t(LROUND(j)), int32_t(LROUND(k)), int32_t(LROUND(u)), int32_t(LROUND(v)), int32_t(LROUND(w))); } - FI constexpr XYZEval asFloat() const { return LOGICAL_AXIS_ARRAY(static_cast(e), static_cast(x), static_cast(y), static_cast(z), static_cast(i), static_cast(j), static_cast(k), static_cast(u), static_cast(v), static_cast(w)); } FI constexpr XYZEval reciprocal() const { return LOGICAL_AXIS_ARRAY(_RECIP(e), _RECIP(x), _RECIP(y), _RECIP(z), _RECIP(i), _RECIP(j), _RECIP(k), _RECIP(u), _RECIP(v), _RECIP(w)); } + // Conversion to other types + template + constexpr XYZEval as() const { + return XYZEval{ + LOGICAL_AXIS_LIST( + static_cast(e), + static_cast(x), static_cast(y), static_cast(z), + static_cast(i), static_cast(j), static_cast(k), + static_cast(u), static_cast(v), static_cast(w) + ) + }; + } + FI constexpr XYZEval asInt16() const { return as(); } + FI constexpr XYZEval asInt32() const { return as(); } + FI constexpr XYZEval asUInt32() const { return as(); } + FI constexpr XYZEval asInt64() const { return as(); } + FI constexpr XYZEval asUInt64() const { return as(); } + FI constexpr XYZEval asFloat() const { return as(); } + // Marlin workspace shifting is done with G92 and M206 FI XYZEval asLogical() const { XYZEval o = asFloat(); toLogical(o); return o; } FI XYZEval asNative() const { XYZEval o = asFloat(); toNative(o); return o; } diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 3025cb83bd..a16d1e72e3 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -2699,7 +2699,7 @@ hal_timer_t Stepper::block_phase_isr() { TERN_(HAS_ROUGH_LIN_ADVANCE, la_delta_error = delta_error); // Calculate Bresenham dividends and divisors - advance_dividend = (current_block->steps << 1).asInt32(); + advance_dividend = current_block->steps << 1; // narrowing conversion advance_divisor = step_event_count << 1; #if ENABLED(INPUT_SHAPING_X) From e1e13ad72c267c7bf9d396350013b1ec4e2ff423 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 27 Oct 2025 16:10:35 -0500 Subject: [PATCH 20/27] =?UTF-8?q?=F0=9F=8E=A8=20The=20Ultraviolet=20Apostr?= =?UTF-8?q?ophe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/AVR/registers.h | 8 +++--- Marlin/src/HAL/AVR/timers.h | 2 +- Marlin/src/HAL/DUE/timers.h | 2 +- Marlin/src/HAL/ESP32/HAL.h | 8 +++--- Marlin/src/HAL/ESP32/Servo.cpp | 2 +- Marlin/src/HAL/ESP32/timers.h | 6 ++-- Marlin/src/HAL/HC32/timers.h | 2 +- Marlin/src/HAL/LINUX/timers.h | 2 +- Marlin/src/HAL/LPC1768/timers.h | 2 +- Marlin/src/HAL/NATIVE_SIM/timers.h | 8 +++--- Marlin/src/HAL/RP2040/timers.h | 4 +-- Marlin/src/HAL/SAMD21/timers.h | 2 +- Marlin/src/HAL/SAMD51/timers.h | 2 +- Marlin/src/HAL/STM32F1/timers.h | 2 +- Marlin/src/HAL/TEENSY31_32/timers.h | 2 +- Marlin/src/HAL/TEENSY35_36/timers.h | 2 +- Marlin/src/HAL/TEENSY40_41/timers.h | 2 +- Marlin/src/feature/mmu3/mmu3.cpp | 2 +- Marlin/src/sd/Sd2Card.cpp | 8 +++--- Marlin/tests/core/test_macros.cpp | 42 ++++++++++++++-------------- Marlin/tests/feature/test_runout.cpp | 2 +- 21 files changed, 56 insertions(+), 56 deletions(-) diff --git a/Marlin/src/HAL/AVR/registers.h b/Marlin/src/HAL/AVR/registers.h index 64c0955c3e..0eac4888cd 100644 --- a/Marlin/src/HAL/AVR/registers.h +++ b/Marlin/src/HAL/AVR/registers.h @@ -93,15 +93,15 @@ namespace AVRHelpers { typedef T type; }; template - struct voltype { + struct voltype { typedef uint8_t type; }; template - struct voltype { + struct voltype { typedef uint16_t type; }; template - struct voltype { + struct voltype { typedef uint32_t type; }; @@ -2007,7 +2007,7 @@ inline void _ATmega_resetperipherals() { #if defined(__AVR_TRM01__) || defined(__AVR_TRM02__) || defined(__AVR_TRM03__) || defined(__AVR_TRM05__) _EEAR._EEAR = 0; - dwrite(_EEDR, (uint8_t)0u); + dwrite(_EEDR, (uint8_t)0U); #endif #if defined(__AVR_TRM01__) || defined(__AVR_TRM02__) || defined(__AVR_TRM03__) || defined(__AVR_TRM04__) || defined(__AVR_TRM05__) diff --git a/Marlin/src/HAL/AVR/timers.h b/Marlin/src/HAL/AVR/timers.h index 94b17f3102..0e1d7f2ba3 100644 --- a/Marlin/src/HAL/AVR/timers.h +++ b/Marlin/src/HAL/AVR/timers.h @@ -28,7 +28,7 @@ // ------------------------ typedef uint16_t hal_timer_t; -#define HAL_TIMER_TYPE_MAX 0xFFFF +#define HAL_TIMER_TYPE_MAX 0xFFFFU // ------------------------ // Defines diff --git a/Marlin/src/HAL/DUE/timers.h b/Marlin/src/HAL/DUE/timers.h index db5d83a06f..9316552ff5 100644 --- a/Marlin/src/HAL/DUE/timers.h +++ b/Marlin/src/HAL/DUE/timers.h @@ -34,7 +34,7 @@ #define FORCE_INLINE __attribute__((always_inline)) inline typedef uint32_t hal_timer_t; -#define HAL_TIMER_TYPE_MAX 0xFFFFFFFF +#define HAL_TIMER_TYPE_MAX 0xFFFFFFFFUL #define HAL_TIMER_PRESCALER 2 #define HAL_TIMER_RATE ((F_CPU) / (HAL_TIMER_PRESCALER)) // frequency of timers peripherals diff --git a/Marlin/src/HAL/ESP32/HAL.h b/Marlin/src/HAL/ESP32/HAL.h index baa03d8a76..36b8ea53fc 100644 --- a/Marlin/src/HAL/ESP32/HAL.h +++ b/Marlin/src/HAL/ESP32/HAL.h @@ -64,10 +64,10 @@ #define CRITICAL_SECTION_END() portEXIT_CRITICAL(&hal.spinlock) #define HAL_CAN_SET_PWM_FREQ // This HAL supports PWM Frequency adjustment -#define PWM_FREQUENCY 1000u // Default PWM frequency when set_pwm_duty() is called without set_pwm_frequency() -#define PWM_RESOLUTION 10u // Default PWM bit resolution -#define CHANNEL_MAX_NUM 15u // max PWM channel # to allocate (7 to only use low speed, 15 to use low & high) -#define MAX_PWM_IOPIN 33u // hardware pwm pins < 34 +#define PWM_FREQUENCY 1000U // Default PWM frequency when set_pwm_duty() is called without set_pwm_frequency() +#define PWM_RESOLUTION 10U // Default PWM bit resolution +#define CHANNEL_MAX_NUM 15U // max PWM channel # to allocate (7 to only use low speed, 15 to use low & high) +#define MAX_PWM_IOPIN 33U // hardware pwm pins < 34 #ifndef MAX_EXPANDER_BITS #define MAX_EXPANDER_BITS 32 // I2S expander bit width (max 32) #endif diff --git a/Marlin/src/HAL/ESP32/Servo.cpp b/Marlin/src/HAL/ESP32/Servo.cpp index ca3950d07f..3a2c11832d 100644 --- a/Marlin/src/HAL/ESP32/Servo.cpp +++ b/Marlin/src/HAL/ESP32/Servo.cpp @@ -35,7 +35,7 @@ Servo::Servo() {} int8_t Servo::attach(const int inPin) { if (inPin > 0) pin = inPin; - channel = get_pwm_channel(pin, 50u, 16u); + channel = get_pwm_channel(pin, 50U, 16U); return channel; // -1 if no PWM avail. } diff --git a/Marlin/src/HAL/ESP32/timers.h b/Marlin/src/HAL/ESP32/timers.h index 3f336fbfc9..03c343af98 100644 --- a/Marlin/src/HAL/ESP32/timers.h +++ b/Marlin/src/HAL/ESP32/timers.h @@ -30,7 +30,7 @@ #define FORCE_INLINE __attribute__((always_inline)) inline typedef uint64_t hal_timer_t; -#define HAL_TIMER_TYPE_MAX 0xFFFFFFFFFFFFFFFFULL +#define HAL_TIMER_TYPE_MAX 0xFFFF'FFFF'FFFF'FFFFULL #ifndef MF_TIMER_STEP #define MF_TIMER_STEP 0 // Timer Index for Stepper @@ -52,12 +52,12 @@ typedef uint64_t hal_timer_t; #if ENABLED(I2S_STEPPER_STREAM) #define STEPPER_TIMER_PRESCALE 1 - #define STEPPER_TIMER_RATE 250000 // 250khz, 4µs pulses of i2s word clock + #define STEPPER_TIMER_RATE 250'000 // 250khz, 4µs pulses of i2s word clock #else #define STEPPER_TIMER_PRESCALE 40 #define STEPPER_TIMER_RATE ((HAL_TIMER_RATE) / (STEPPER_TIMER_PRESCALE)) // frequency of stepper timer, 2MHz #endif -#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs +#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1'000'000) // stepper timer ticks per µs #define STEP_TIMER_MIN_INTERVAL 8 // minimum time in µs between stepper interrupts diff --git a/Marlin/src/HAL/HC32/timers.h b/Marlin/src/HAL/HC32/timers.h index e5ab3f21f5..d03a5f9630 100644 --- a/Marlin/src/HAL/HC32/timers.h +++ b/Marlin/src/HAL/HC32/timers.h @@ -27,7 +27,7 @@ // typedef Timer0 *timer_channel_t; typedef uint16_t hal_timer_t; -#define HAL_TIMER_TYPE_MAX 0xFFFF +#define HAL_TIMER_TYPE_MAX 0xFFFFU // // Timer instances diff --git a/Marlin/src/HAL/LINUX/timers.h b/Marlin/src/HAL/LINUX/timers.h index 2b29edce0b..d75519ed3e 100644 --- a/Marlin/src/HAL/LINUX/timers.h +++ b/Marlin/src/HAL/LINUX/timers.h @@ -34,7 +34,7 @@ #define FORCE_INLINE __attribute__((always_inline)) inline typedef uint32_t hal_timer_t; -#define HAL_TIMER_TYPE_MAX 0xFFFFFFFF +#define HAL_TIMER_TYPE_MAX 0xFFFFFFFFUL #define HAL_TIMER_RATE ((SystemCoreClock) / 4) // frequency of timers peripherals diff --git a/Marlin/src/HAL/LPC1768/timers.h b/Marlin/src/HAL/LPC1768/timers.h index bae01703ed..8c0a39158e 100644 --- a/Marlin/src/HAL/LPC1768/timers.h +++ b/Marlin/src/HAL/LPC1768/timers.h @@ -57,7 +57,7 @@ #define _HAL_TIMER_ISR(T) __HAL_TIMER_ISR(T) typedef uint32_t hal_timer_t; -#define HAL_TIMER_TYPE_MAX 0xFFFFFFFF +#define HAL_TIMER_TYPE_MAX 0xFFFFFFFFUL #define HAL_TIMER_RATE ((F_CPU) / 4) // frequency of timers peripherals diff --git a/Marlin/src/HAL/NATIVE_SIM/timers.h b/Marlin/src/HAL/NATIVE_SIM/timers.h index d46e8e7b94..43aecf427b 100644 --- a/Marlin/src/HAL/NATIVE_SIM/timers.h +++ b/Marlin/src/HAL/NATIVE_SIM/timers.h @@ -34,7 +34,7 @@ #define FORCE_INLINE __attribute__((always_inline)) inline typedef uint64_t hal_timer_t; -#define HAL_TIMER_TYPE_MAX 0xFFFFFFFFFFFFFFFF +#define HAL_TIMER_TYPE_MAX 0xFFFF'FFFF'FFFF'FFFFULL #define HAL_TIMER_RATE ((SystemCoreClock) / 4) // frequency of timers peripherals @@ -52,11 +52,11 @@ typedef uint64_t hal_timer_t; #endif #define SYSTICK_TIMER_FREQUENCY 1000 -#define TEMP_TIMER_RATE 1000000 -#define TEMP_TIMER_FREQUENCY 1000 // temperature interrupt frequency +#define TEMP_TIMER_RATE 1'000'000 +#define TEMP_TIMER_FREQUENCY 1000 // temperature interrupt frequency #define STEPPER_TIMER_RATE HAL_TIMER_RATE // frequency of stepper timer (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE) -#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs +#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1'000'000) // stepper timer ticks per µs #define STEPPER_TIMER_PRESCALE (CYCLES_PER_MICROSECOND / STEPPER_TIMER_TICKS_PER_US) #define PULSE_TIMER_RATE STEPPER_TIMER_RATE // frequency of pulse timer diff --git a/Marlin/src/HAL/RP2040/timers.h b/Marlin/src/HAL/RP2040/timers.h index 512c6ba465..4d11804361 100644 --- a/Marlin/src/HAL/RP2040/timers.h +++ b/Marlin/src/HAL/RP2040/timers.h @@ -41,9 +41,9 @@ #define _HAL_TIMER_ISR(T) __HAL_TIMER_ISR(T) typedef uint64_t hal_timer_t; -#define HAL_TIMER_TYPE_MAX 0xFFFFFFFFFFFFFFFF +#define HAL_TIMER_TYPE_MAX 0xFFFF'FFFF'FFFF'FFFFULL -#define HAL_TIMER_RATE (1000000ull) // fixed value as we use a microsecond timesource +#define HAL_TIMER_RATE (1'000'000ULL) // fixed value as we use a microsecond timesource #ifndef MF_TIMER_STEP #define MF_TIMER_STEP 0 // Timer Index for Stepper #endif diff --git a/Marlin/src/HAL/SAMD21/timers.h b/Marlin/src/HAL/SAMD21/timers.h index 303ccbdc50..a4faabb8e8 100644 --- a/Marlin/src/HAL/SAMD21/timers.h +++ b/Marlin/src/HAL/SAMD21/timers.h @@ -33,7 +33,7 @@ // -------------------------------------------------------------------------- typedef uint32_t hal_timer_t; -#define HAL_TIMER_TYPE_MAX 0xFFFFFFFF +#define HAL_TIMER_TYPE_MAX 0xFFFFFFFFUL #define HAL_TIMER_RATE F_CPU // frequency of timers peripherals diff --git a/Marlin/src/HAL/SAMD51/timers.h b/Marlin/src/HAL/SAMD51/timers.h index 86c3241892..59817453aa 100644 --- a/Marlin/src/HAL/SAMD51/timers.h +++ b/Marlin/src/HAL/SAMD51/timers.h @@ -32,7 +32,7 @@ // -------------------------------------------------------------------------- typedef uint32_t hal_timer_t; -#define HAL_TIMER_TYPE_MAX 0xFFFFFFFF +#define HAL_TIMER_TYPE_MAX 0xFFFFFFFFUL #define HAL_TIMER_RATE F_CPU // frequency of timers peripherals diff --git a/Marlin/src/HAL/STM32F1/timers.h b/Marlin/src/HAL/STM32F1/timers.h index 89a609c2c3..456278db2f 100644 --- a/Marlin/src/HAL/STM32F1/timers.h +++ b/Marlin/src/HAL/STM32F1/timers.h @@ -40,7 +40,7 @@ */ typedef uint16_t hal_timer_t; -#define HAL_TIMER_TYPE_MAX 0xFFFF +#define HAL_TIMER_TYPE_MAX 0xFFFFU #define HAL_TIMER_RATE uint32_t(F_CPU) // frequency of timers peripherals diff --git a/Marlin/src/HAL/TEENSY31_32/timers.h b/Marlin/src/HAL/TEENSY31_32/timers.h index 3bbc2421e0..aeb8f2388a 100644 --- a/Marlin/src/HAL/TEENSY31_32/timers.h +++ b/Marlin/src/HAL/TEENSY31_32/timers.h @@ -34,7 +34,7 @@ #define FORCE_INLINE __attribute__((always_inline)) inline typedef uint32_t hal_timer_t; -#define HAL_TIMER_TYPE_MAX 0xFFFFFFFF +#define HAL_TIMER_TYPE_MAX 0xFFFFFFFFUL #define FTM0_TIMER_PRESCALE 8 #define FTM1_TIMER_PRESCALE 4 diff --git a/Marlin/src/HAL/TEENSY35_36/timers.h b/Marlin/src/HAL/TEENSY35_36/timers.h index 3536b62265..3a836ba44e 100644 --- a/Marlin/src/HAL/TEENSY35_36/timers.h +++ b/Marlin/src/HAL/TEENSY35_36/timers.h @@ -34,7 +34,7 @@ #define FORCE_INLINE __attribute__((always_inline)) inline typedef uint32_t hal_timer_t; -#define HAL_TIMER_TYPE_MAX 0xFFFFFFFF +#define HAL_TIMER_TYPE_MAX 0xFFFFFFFFUL #define FTM0_TIMER_PRESCALE 8 #define FTM1_TIMER_PRESCALE 4 diff --git a/Marlin/src/HAL/TEENSY40_41/timers.h b/Marlin/src/HAL/TEENSY40_41/timers.h index fc160ab8b8..277a7f318d 100644 --- a/Marlin/src/HAL/TEENSY40_41/timers.h +++ b/Marlin/src/HAL/TEENSY40_41/timers.h @@ -34,7 +34,7 @@ #define FORCE_INLINE __attribute__((always_inline)) inline typedef uint32_t hal_timer_t; -#define HAL_TIMER_TYPE_MAX 0xFFFFFFFE +#define HAL_TIMER_TYPE_MAX 0xFFFFFFFEUL #define GPT_TIMER_RATE (F_CPU / 4) // 150MHz (Can't use F_BUS_ACTUAL because it's extern volatile) diff --git a/Marlin/src/feature/mmu3/mmu3.cpp b/Marlin/src/feature/mmu3/mmu3.cpp index de91916b56..0d69758487 100644 --- a/Marlin/src/feature/mmu3/mmu3.cpp +++ b/Marlin/src/feature/mmu3/mmu3.cpp @@ -867,7 +867,7 @@ namespace MMU3 { nozzle_timer.start(); LogEchoEvent(F("Cooling Timeout started")); } - else if (nozzle_timer.duration() > (PAUSE_PARK_NOZZLE_TIMEOUT * 1000ul)) { // mins->msec. + else if (nozzle_timer.duration() > (PAUSE_PARK_NOZZLE_TIMEOUT * 1000UL)) { // mins->msec. mmu_print_saved &= ~(SavedState::CooldownPending); mmu_print_saved |= SavedState::Cooldown; thermal_setTargetHotend(0); diff --git a/Marlin/src/sd/Sd2Card.cpp b/Marlin/src/sd/Sd2Card.cpp index 25fc35e6ab..97157f9718 100644 --- a/Marlin/src/sd/Sd2Card.cpp +++ b/Marlin/src/sd/Sd2Card.cpp @@ -42,22 +42,22 @@ #if DISABLED(SD_NO_DEFAULT_TIMEOUT) #ifndef SD_INIT_TIMEOUT - #define SD_INIT_TIMEOUT 2000u // (ms) Init timeout + #define SD_INIT_TIMEOUT 2000U // (ms) Init timeout #elif SD_INIT_TIMEOUT < 0 #error "SD_INIT_TIMEOUT must be greater than or equal to 0." #endif #ifndef SD_ERASE_TIMEOUT - #define SD_ERASE_TIMEOUT 10000u // (ms) Erase timeout + #define SD_ERASE_TIMEOUT 10000U // (ms) Erase timeout #elif SD_ERASE_TIMEOUT < 0 #error "SD_ERASE_TIMEOUT must be greater than or equal to 0." #endif #ifndef SD_READ_TIMEOUT - #define SD_READ_TIMEOUT 300u // (ms) Read timeout + #define SD_READ_TIMEOUT 300U // (ms) Read timeout #elif SD_READ_TIMEOUT < 0 #error "SD_READ_TIMEOUT must be greater than or equal to 0." #endif #ifndef SD_WRITE_TIMEOUT - #define SD_WRITE_TIMEOUT 600u // (ms) Write timeout + #define SD_WRITE_TIMEOUT 600U // (ms) Write timeout #elif SD_WRITE_TIMEOUT < 0 #error "SD_WRITE_TIMEOUT must be greater than or equal to 0." #endif diff --git a/Marlin/tests/core/test_macros.cpp b/Marlin/tests/core/test_macros.cpp index bb269dec2b..75a1e88f71 100644 --- a/Marlin/tests/core/test_macros.cpp +++ b/Marlin/tests/core/test_macros.cpp @@ -251,14 +251,14 @@ MARLIN_TEST(macros_numeric, NOLESS_int) { MARLIN_TEST(macros_numeric, NOLESS_uint) { // Scenario 1: Input was already acceptable - unsigned int b = 8u; - NOLESS(b, 5u); - TEST_ASSERT_EQUAL(8u, b); + unsigned int b = 8U; + NOLESS(b, 5U); + TEST_ASSERT_EQUAL(8U, b); // Original scenario: Input was less than the limit - b = 5u; - NOLESS(b, 10u); - TEST_ASSERT_EQUAL(10u, b); + b = 5U; + NOLESS(b, 10U); + TEST_ASSERT_EQUAL(10U, b); } MARLIN_TEST(macros_numeric, NOLESS_float) { @@ -310,14 +310,14 @@ MARLIN_TEST(macros_numeric, NOMORE_int) { MARLIN_TEST(macros_numeric, NOMORE_uint) { // Scenario 1: Input was already acceptable - unsigned int b = 8u; - NOMORE(b, 10u); - TEST_ASSERT_EQUAL(8u, b); + unsigned int b = 8U; + NOMORE(b, 10U); + TEST_ASSERT_EQUAL(8U, b); // Original scenario: Input was more than the limit - b = 15u; - NOMORE(b, 10u); - TEST_ASSERT_EQUAL(10u, b); + b = 15U; + NOMORE(b, 10U); + TEST_ASSERT_EQUAL(10U, b); } MARLIN_TEST(macros_numeric, NOMORE_float) { @@ -383,17 +383,17 @@ MARLIN_TEST(macros_numeric, LIMIT_int) { } MARLIN_TEST(macros_numeric, LIMIT_uint) { - unsigned int b = 15u; - LIMIT(b, 10u, 20u); - TEST_ASSERT_EQUAL(15u, b); + unsigned int b = 15U; + LIMIT(b, 10U, 20U); + TEST_ASSERT_EQUAL(15U, b); - b = 5u; - LIMIT(b, 10u, 20u); - TEST_ASSERT_EQUAL(10u, b); + b = 5U; + LIMIT(b, 10U, 20U); + TEST_ASSERT_EQUAL(10U, b); - b = 25u; - LIMIT(b, 10u, 20u); - TEST_ASSERT_EQUAL(20u, b); + b = 25U; + LIMIT(b, 10U, 20U); + TEST_ASSERT_EQUAL(20U, b); } MARLIN_TEST(macros_numeric, LIMIT_float) { diff --git a/Marlin/tests/feature/test_runout.cpp b/Marlin/tests/feature/test_runout.cpp index 2719446437..296e70916d 100644 --- a/Marlin/tests/feature/test_runout.cpp +++ b/Marlin/tests/feature/test_runout.cpp @@ -29,7 +29,7 @@ MARLIN_TEST(runout, poll_runout_states) { FilamentSensorBase sensor; // Expected default value is one bit set for each extruder - uint8_t expected = static_cast(~(~0u << NUM_RUNOUT_SENSORS)); + uint8_t expected = static_cast(~(~0U << NUM_RUNOUT_SENSORS)); TEST_ASSERT_EQUAL(expected, sensor.poll_runout_states()); } From bfb543021721f4c35aa79300101defcd8305fcea Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 27 Oct 2025 16:36:55 -0500 Subject: [PATCH 21/27] =?UTF-8?q?=F0=9F=94=A8=20Comments=20for=20newer=20c?= =?UTF-8?q?ompilers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/SanityCheck.h | 3 +++ ini/due.ini | 9 +++++---- ini/stm32-common.ini | 13 +++++++------ ini/stm32f1-maple.ini | 12 +++--------- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index d8dc9a3843..a8467ac606 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -40,6 +40,9 @@ #error "Marlin requires C++11 support (gcc >= 4.7, Arduino IDE >= 1.6.8). Please upgrade your toolchain." #endif +// Emit the GCC version +//static_assert(false, "GCC version: " STRINGIFY(__GNUC__) "." STRINGIFY(__GNUC_MINOR__) "." STRINGIFY(__GNUC_PATCHLEVEL__)); + // Strings for sanity check messages #define _NUM_AXES_STR NUM_AXIS_GANG("X ", "Y ", "Z ", "I ", "J ", "K ", "U ", "V ", "W ") #define _LOGICAL_AXES_STR LOGICAL_AXIS_GANG("E ", "X ", "Y ", "Z ", "I ", "J ", "K ", "U ", "V ", "W ") diff --git a/ini/due.ini b/ini/due.ini index 7e4017e257..12a0005ffc 100644 --- a/ini/due.ini +++ b/ini/due.ini @@ -16,10 +16,11 @@ # - RADDS # [env:DUE] -platform = atmelsam -board = due -build_src_filter = ${common.default_src_filter} + + -build_flags = -DWATCHDOG_PIO_RESET +platform = atmelsam +#platform_packages = toolchain-gccarmnoneeabi@1.120301.0 # Otherwise it's GCC 7.2.1 +board = due +build_src_filter = ${common.default_src_filter} + + +build_flags = -DWATCHDOG_PIO_RESET [env:DUE_USB] extends = env:DUE diff --git a/ini/stm32-common.ini b/ini/stm32-common.ini index 12c07ef824..2ba6baed1b 100644 --- a/ini/stm32-common.ini +++ b/ini/stm32-common.ini @@ -10,14 +10,15 @@ #################################### [common_stm32] -platform = ststm32@~12.1 -board_build.core = stm32 -build_flags = ${common.build_flags} -std=gnu++14 +platform = ststm32@~12.1 +#platform_packages = toolchain-gccarmnoneeabi@1.100301.220327 # Otherwise it's GCC 9.2.1 +board_build.core = stm32 +build_flags = ${common.build_flags} -std=gnu++14 -DHAL_STM32 -DPLATFORM_M997_SUPPORT -DUSBCON -DUSBD_USE_CDC -DTIM_IRQ_PRIO=13 -DADC_RESOLUTION=12 -build_unflags = -std=gnu++11 -build_src_filter = ${common.default_src_filter} + - + -extra_scripts = ${common.extra_scripts} +build_unflags = -std=gnu++11 +build_src_filter = ${common.default_src_filter} + - + +extra_scripts = ${common.extra_scripts} pre:buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py custom_marlin.HAS_LTDC_TFT = build_src_filter=+ custom_marlin.HAS_FSMC_TFT = build_src_filter=+ diff --git a/ini/stm32f1-maple.ini b/ini/stm32f1-maple.ini index dd72b8980c..304102351d 100644 --- a/ini/stm32f1-maple.ini +++ b/ini/stm32f1-maple.ini @@ -33,7 +33,7 @@ lib_ignore = SPI, FreeRTOS701, FreeRTOS821 lib_deps = ${common.lib_deps} SoftwareSerialM platform_packages = tool-stm32duino - toolchain-gccarmnoneeabi@1.100301.220327 + toolchain-gccarmnoneeabi@1.120301.0 # Otherwise it's GCC 7.2.1 extra_scripts = ${common.extra_scripts} pre:buildroot/share/PlatformIO/scripts/fix_framework_weakness.py pre:buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py @@ -65,7 +65,8 @@ monitor_speed = 115200 [env:STM32F103RC_meeb_maple] extends = env:STM32F103RC_maple board = marlin_maple_MEEB_3DP -platform_packages = platformio/tool-dfuutil@~1.11.0 +platform_packages = ${env:STM32F103RC_maple.platform_packages} + platformio/tool-dfuutil@~1.11.0 build_flags = ${env:STM32F103RC_maple.build_flags} -DDEBUG_LEVEL=0 -DSS_TIMER=4 @@ -93,7 +94,6 @@ extends = env:STM32F103RC_maple extra_scripts = ${env:STM32F103RC_maple.extra_scripts} buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py build_flags = ${env:STM32F103RC_maple.build_flags} -DDEBUG_LEVEL=0 -platform_packages = toolchain-gccarmnoneeabi@1.90301.200702 lib_ldf_mode = chain debug_tool = stlink upload_protocol = serial @@ -109,7 +109,6 @@ extends = env:STM32F103RC_maple board_build.address = 0x08007000 board_build.ldscript = STM32F103RC_SKR_MINI_256K.ld build_flags = ${env:STM32F103RC_maple.build_flags} -DDEBUG_LEVEL=0 -DSS_TIMER=4 -platform_packages = toolchain-gccarmnoneeabi@1.90301.200702 monitor_speed = 115200 [env:STM32F103RC_btt_USB_maple] @@ -136,7 +135,6 @@ upload_protocol = jlink [env:STM32F103RC_creality_maple] extends = env:STM32F103RC_maple build_flags = ${env:STM32F103RC_maple.build_flags} -DTEMP_TIMER_CHAN=4 -platform_packages = toolchain-gccarmnoneeabi@1.90301.200702 board_build.address = 0x08007000 board_build.ldscript = creality256k.ld board_build.rename = firmware-{date}-{time}.bin @@ -160,7 +158,6 @@ board_build.ldscript = crealityPro.ld [env:GD32F103RC_voxelab_maple] extends = env:STM32F103RC_maple build_flags = ${env:STM32F103RC_maple.build_flags} -DTEMP_TIMER_CHAN=4 -platform_packages = toolchain-gccarmnoneeabi@1.90301.200702 board_build.address = 0x08007000 board_build.ldscript = creality256k.ld debug_tool = jlink @@ -170,7 +167,6 @@ upload_protocol = jlink extends = env:STM32F103RE_maple build_flags = ${env:STM32F103RE_maple.build_flags} -DTEMP_TIMER_CHAN=4 -DVOXELAB_N32 -DSDCARD_FLASH_LIMIT_256K -platform_packages = toolchain-gccarmnoneeabi@1.90301.200702 board_build.address = 0x08007000 board_build.ldscript = creality.ld debug_tool = jlink @@ -393,13 +389,11 @@ lib_ignore = Adafruit NeoPixel, SPI, SailfishLCD, SailfishRGB_LED [env:STM32F103RC_ZM3E2_USB_maple] extends = ZONESTAR_ZM3E_maple -platform_packages = toolchain-gccarmnoneeabi@1.90301.200702 board = genericSTM32F103RC board_build.ldscript = ZONESTAR_ZM3E_256K.ld [env:STM32F103VC_ZM3E4_USB_maple] extends = ZONESTAR_ZM3E_maple -platform_packages = toolchain-gccarmnoneeabi@1.90301.200702 board = genericSTM32F103VC board_build.ldscript = ZONESTAR_ZM3E_256K.ld build_flags = ${ZONESTAR_ZM3E_maple.build_flags} -DTONE_TIMER=1 -DTONE_CHANNEL=2 From 41c860dce1b1cbe58b3f3227119effaf01801ffc Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 28 Oct 2025 00:30:25 +0000 Subject: [PATCH 22/27] [cron] Bump distribution date (2025-10-28) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 6ff97e922e..576454feff 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2025-10-27" +//#define STRING_DISTRIBUTION_DATE "2025-10-28" /** * The protocol for communication to the host. Protocol indicates communication diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 56cb8b5518..6e6ae70a6c 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2025-10-27" + #define STRING_DISTRIBUTION_DATE "2025-10-28" #endif /** From db279967da7a8c07bfed564640de95665ddf2fe2 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 27 Oct 2025 20:55:28 -0500 Subject: [PATCH 23/27] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Simpl?= =?UTF-8?q?er=20type=20conversion=20(defer!)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/types.h | 61 +++++++---------------------------- Marlin/src/module/stepper.cpp | 2 +- 2 files changed, 13 insertions(+), 50 deletions(-) diff --git a/Marlin/src/core/types.h b/Marlin/src/core/types.h index d20a23aba3..cac42da06e 100644 --- a/Marlin/src/core/types.h +++ b/Marlin/src/core/types.h @@ -549,21 +549,12 @@ struct XYval { // Explicit copy and copies with conversion FI constexpr XYval copy() const { return *this; } FI constexpr XYval ABS() const { return { T(_ABS(x)), T(_ABS(y)) }; } + FI constexpr XYval asInt16() const { return { int16_t(x), int16_t(y) }; } + FI constexpr XYval asInt32() const { return { int32_t(x), int32_t(y) }; } FI constexpr XYval ROUNDL() const { return { int32_t(LROUND(x)), int32_t(LROUND(y)) }; } + FI constexpr XYval asFloat() const { return { static_cast(x), static_cast(y) }; } FI constexpr XYval reciprocal() const { return { _RECIP(x), _RECIP(y) }; } - // Conversion to other types - template - constexpr XYval as() const { - return XYval{ static_cast(x), static_cast(y) }; - } - FI constexpr XYval asInt16() const { return as(); } - FI constexpr XYval asInt32() const { return as(); } - FI constexpr XYval asUInt32() const { return as(); } - FI constexpr XYval asInt64() const { return as(); } - FI constexpr XYval asUInt64() const { return as(); } - FI constexpr XYval asFloat() const { return as(); } - // Marlin workspace shifting is done with G92 and M206 FI XYval asLogical() const { XYval o = asFloat(); toLogical(o); return o; } FI XYval asNative() const { XYval o = asFloat(); toNative(o); return o; } @@ -715,27 +706,12 @@ struct XYZval { // Explicit copy and copies with conversion FI constexpr XYZval copy() const { XYZval o = *this; return o; } FI constexpr XYZval ABS() const { return NUM_AXIS_ARRAY(T(_ABS(x)), T(_ABS(y)), T(_ABS(z)), T(_ABS(i)), T(_ABS(j)), T(_ABS(k)), T(_ABS(u)), T(_ABS(v)), T(_ABS(w))); } + FI constexpr XYZval asInt16() const { return NUM_AXIS_ARRAY(int16_t(x), int16_t(y), int16_t(z), int16_t(i), int16_t(j), int16_t(k), int16_t(u), int16_t(v), int16_t(w)); } + FI constexpr XYZval asInt32() const { return NUM_AXIS_ARRAY(int32_t(x), int32_t(y), int32_t(z), int32_t(i), int32_t(j), int32_t(k), int32_t(u), int32_t(v), int32_t(w)); } FI constexpr XYZval ROUNDL() const { return NUM_AXIS_ARRAY(int32_t(LROUND(x)), int32_t(LROUND(y)), int32_t(LROUND(z)), int32_t(LROUND(i)), int32_t(LROUND(j)), int32_t(LROUND(k)), int32_t(LROUND(u)), int32_t(LROUND(v)), int32_t(LROUND(w))); } + FI constexpr XYZval asFloat() const { return NUM_AXIS_ARRAY(static_cast(x), static_cast(y), static_cast(z), static_cast(i), static_cast(j), static_cast(k), static_cast(u), static_cast(v), static_cast(w)); } FI constexpr XYZval reciprocal() const { return NUM_AXIS_ARRAY(_RECIP(x), _RECIP(y), _RECIP(z), _RECIP(i), _RECIP(j), _RECIP(k), _RECIP(u), _RECIP(v), _RECIP(w)); } - // Conversion to other types - template - constexpr XYZval as() const { - return XYZval{ - NUM_AXIS_LIST( - static_cast(x), static_cast(y), static_cast(z), - static_cast(i), static_cast(j), static_cast(k), - static_cast(u), static_cast(v), static_cast(w) - ) - }; - } - FI constexpr XYZval asInt16() const { return as(); } - FI constexpr XYZval asInt32() const { return as(); } - FI constexpr XYZval asUInt32() const { return as(); } - FI constexpr XYZval asInt64() const { return as(); } - FI constexpr XYZval asUInt64() const { return as(); } - FI constexpr XYZval asFloat() const { return as(); } - // Marlin workspace shifting is done with G92 and M206 FI XYZval asLogical() const { XYZval o = asFloat(); toLogical(o); return o; } FI XYZval asNative() const { XYZval o = asFloat(); toNative(o); return o; } @@ -885,28 +861,15 @@ struct XYZEval { // Explicit copy and copies with conversion FI constexpr XYZEval copy() const { XYZEval v = *this; return v; } FI constexpr XYZEval ABS() const { return LOGICAL_AXIS_ARRAY(T(_ABS(e)), T(_ABS(x)), T(_ABS(y)), T(_ABS(z)), T(_ABS(i)), T(_ABS(j)), T(_ABS(k)), T(_ABS(u)), T(_ABS(v)), T(_ABS(w))); } + FI constexpr XYZEval asInt16() const { return LOGICAL_AXIS_ARRAY(int16_t(e), int16_t(x), int16_t(y), int16_t(z), int16_t(i), int16_t(j), int16_t(k), int16_t(u), int16_t(v), int16_t(w)); } + FI constexpr XYZEval asInt32() const { return LOGICAL_AXIS_ARRAY(int32_t(e), int32_t(x), int32_t(y), int32_t(z), int32_t(i), int32_t(j), int32_t(k), int32_t(u), int32_t(v), int32_t(w)); } + FI constexpr XYZEval asUInt32() const { return LOGICAL_AXIS_ARRAY(uint32_t(e), uint32_t(x), uint32_t(y), uint32_t(z), uint32_t(i), uint32_t(j), uint32_t(k), uint32_t(u), uint32_t(v), uint32_t(w)); } + FI constexpr XYZEval asInt64() const { return LOGICAL_AXIS_ARRAY(int64_t(e), int64_t(x), int64_t(y), int64_t(z), int64_t(i), int64_t(j), int64_t(k), int64_t(u), int64_t(v), int64_t(w)); } + FI constexpr XYZEval asUInt64() const { return LOGICAL_AXIS_ARRAY(uint64_t(e), uint64_t(x), uint64_t(y), uint64_t(z), uint64_t(i), uint64_t(j), uint64_t(k), uint64_t(u), uint64_t(v), uint64_t(w)); } FI constexpr XYZEval ROUNDL() const { return LOGICAL_AXIS_ARRAY(int32_t(LROUND(e)), int32_t(LROUND(x)), int32_t(LROUND(y)), int32_t(LROUND(z)), int32_t(LROUND(i)), int32_t(LROUND(j)), int32_t(LROUND(k)), int32_t(LROUND(u)), int32_t(LROUND(v)), int32_t(LROUND(w))); } + FI constexpr XYZEval asFloat() const { return LOGICAL_AXIS_ARRAY(static_cast(e), static_cast(x), static_cast(y), static_cast(z), static_cast(i), static_cast(j), static_cast(k), static_cast(u), static_cast(v), static_cast(w)); } FI constexpr XYZEval reciprocal() const { return LOGICAL_AXIS_ARRAY(_RECIP(e), _RECIP(x), _RECIP(y), _RECIP(z), _RECIP(i), _RECIP(j), _RECIP(k), _RECIP(u), _RECIP(v), _RECIP(w)); } - // Conversion to other types - template - constexpr XYZEval as() const { - return XYZEval{ - LOGICAL_AXIS_LIST( - static_cast(e), - static_cast(x), static_cast(y), static_cast(z), - static_cast(i), static_cast(j), static_cast(k), - static_cast(u), static_cast(v), static_cast(w) - ) - }; - } - FI constexpr XYZEval asInt16() const { return as(); } - FI constexpr XYZEval asInt32() const { return as(); } - FI constexpr XYZEval asUInt32() const { return as(); } - FI constexpr XYZEval asInt64() const { return as(); } - FI constexpr XYZEval asUInt64() const { return as(); } - FI constexpr XYZEval asFloat() const { return as(); } - // Marlin workspace shifting is done with G92 and M206 FI XYZEval asLogical() const { XYZEval o = asFloat(); toLogical(o); return o; } FI XYZEval asNative() const { XYZEval o = asFloat(); toNative(o); return o; } diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index a16d1e72e3..3025cb83bd 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -2699,7 +2699,7 @@ hal_timer_t Stepper::block_phase_isr() { TERN_(HAS_ROUGH_LIN_ADVANCE, la_delta_error = delta_error); // Calculate Bresenham dividends and divisors - advance_dividend = current_block->steps << 1; // narrowing conversion + advance_dividend = (current_block->steps << 1).asInt32(); advance_divisor = step_event_count << 1; #if ENABLED(INPUT_SHAPING_X) From 89a43a8b1ac00ed3f45b422748a5a0cd4839ca8d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 27 Oct 2025 21:38:04 -0500 Subject: [PATCH 24/27] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Same?= =?UTF-8?q?=20types=20conversion=20suite?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/types.h | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/Marlin/src/core/types.h b/Marlin/src/core/types.h index cac42da06e..fab32dea9b 100644 --- a/Marlin/src/core/types.h +++ b/Marlin/src/core/types.h @@ -549,12 +549,17 @@ struct XYval { // Explicit copy and copies with conversion FI constexpr XYval copy() const { return *this; } FI constexpr XYval ABS() const { return { T(_ABS(x)), T(_ABS(y)) }; } - FI constexpr XYval asInt16() const { return { int16_t(x), int16_t(y) }; } - FI constexpr XYval asInt32() const { return { int32_t(x), int32_t(y) }; } FI constexpr XYval ROUNDL() const { return { int32_t(LROUND(x)), int32_t(LROUND(y)) }; } - FI constexpr XYval asFloat() const { return { static_cast(x), static_cast(y) }; } FI constexpr XYval reciprocal() const { return { _RECIP(x), _RECIP(y) }; } + // Conversion to other types + FI constexpr XYval asInt16() const { return { int16_t(x), int16_t(y) }; } + FI constexpr XYval asInt32() const { return { int32_t(x), int32_t(y) }; } + FI constexpr XYval asUInt32() const { return { uint32_t(x), uint32_t(y) }; } + FI constexpr XYval asInt64() const { return { int64_t(x), int64_t(y) }; } + FI constexpr XYval asUInt64() const { return { uint64_t(x), uint64_t(y) }; } + FI constexpr XYval asFloat() const { return { static_cast(x), static_cast(y) }; } + // Marlin workspace shifting is done with G92 and M206 FI XYval asLogical() const { XYval o = asFloat(); toLogical(o); return o; } FI XYval asNative() const { XYval o = asFloat(); toNative(o); return o; } @@ -706,12 +711,17 @@ struct XYZval { // Explicit copy and copies with conversion FI constexpr XYZval copy() const { XYZval o = *this; return o; } FI constexpr XYZval ABS() const { return NUM_AXIS_ARRAY(T(_ABS(x)), T(_ABS(y)), T(_ABS(z)), T(_ABS(i)), T(_ABS(j)), T(_ABS(k)), T(_ABS(u)), T(_ABS(v)), T(_ABS(w))); } - FI constexpr XYZval asInt16() const { return NUM_AXIS_ARRAY(int16_t(x), int16_t(y), int16_t(z), int16_t(i), int16_t(j), int16_t(k), int16_t(u), int16_t(v), int16_t(w)); } - FI constexpr XYZval asInt32() const { return NUM_AXIS_ARRAY(int32_t(x), int32_t(y), int32_t(z), int32_t(i), int32_t(j), int32_t(k), int32_t(u), int32_t(v), int32_t(w)); } FI constexpr XYZval ROUNDL() const { return NUM_AXIS_ARRAY(int32_t(LROUND(x)), int32_t(LROUND(y)), int32_t(LROUND(z)), int32_t(LROUND(i)), int32_t(LROUND(j)), int32_t(LROUND(k)), int32_t(LROUND(u)), int32_t(LROUND(v)), int32_t(LROUND(w))); } - FI constexpr XYZval asFloat() const { return NUM_AXIS_ARRAY(static_cast(x), static_cast(y), static_cast(z), static_cast(i), static_cast(j), static_cast(k), static_cast(u), static_cast(v), static_cast(w)); } FI constexpr XYZval reciprocal() const { return NUM_AXIS_ARRAY(_RECIP(x), _RECIP(y), _RECIP(z), _RECIP(i), _RECIP(j), _RECIP(k), _RECIP(u), _RECIP(v), _RECIP(w)); } + // Conversion to other types + FI constexpr XYZval asInt16() const { return NUM_AXIS_ARRAY(int16_t(x), int16_t(y), int16_t(z), int16_t(i), int16_t(j), int16_t(k), int16_t(u), int16_t(v), int16_t(w)); } + FI constexpr XYZval asInt32() const { return NUM_AXIS_ARRAY(int32_t(x), int32_t(y), int32_t(z), int32_t(i), int32_t(j), int32_t(k), int32_t(u), int32_t(v), int32_t(w)); } + FI constexpr XYZval asUInt32() const { return NUM_AXIS_ARRAY(uint32_t(x), uint32_t(y), uint32_t(z), uint32_t(i), uint32_t(j), uint32_t(k), uint32_t(u), uint32_t(v), uint32_t(w)); } + FI constexpr XYZval asInt64() const { return NUM_AXIS_ARRAY(int64_t(x), int64_t(y), int64_t(z), int64_t(i), int64_t(j), int64_t(k), int64_t(u), int64_t(v), int64_t(w)); } + FI constexpr XYZval asUInt64() const { return NUM_AXIS_ARRAY(uint64_t(x), uint64_t(y), uint64_t(z), uint64_t(i), uint64_t(j), uint64_t(k), uint64_t(u), uint64_t(v), uint64_t(w)); } + FI constexpr XYZval asFloat() const { return NUM_AXIS_ARRAY(static_cast(x), static_cast(y), static_cast(z), static_cast(i), static_cast(j), static_cast(k), static_cast(u), static_cast(v), static_cast(w)); } + // Marlin workspace shifting is done with G92 and M206 FI XYZval asLogical() const { XYZval o = asFloat(); toLogical(o); return o; } FI XYZval asNative() const { XYZval o = asFloat(); toNative(o); return o; } @@ -861,14 +871,16 @@ struct XYZEval { // Explicit copy and copies with conversion FI constexpr XYZEval copy() const { XYZEval v = *this; return v; } FI constexpr XYZEval ABS() const { return LOGICAL_AXIS_ARRAY(T(_ABS(e)), T(_ABS(x)), T(_ABS(y)), T(_ABS(z)), T(_ABS(i)), T(_ABS(j)), T(_ABS(k)), T(_ABS(u)), T(_ABS(v)), T(_ABS(w))); } + FI constexpr XYZEval ROUNDL() const { return LOGICAL_AXIS_ARRAY(int32_t(LROUND(e)), int32_t(LROUND(x)), int32_t(LROUND(y)), int32_t(LROUND(z)), int32_t(LROUND(i)), int32_t(LROUND(j)), int32_t(LROUND(k)), int32_t(LROUND(u)), int32_t(LROUND(v)), int32_t(LROUND(w))); } + FI constexpr XYZEval reciprocal() const { return LOGICAL_AXIS_ARRAY(_RECIP(e), _RECIP(x), _RECIP(y), _RECIP(z), _RECIP(i), _RECIP(j), _RECIP(k), _RECIP(u), _RECIP(v), _RECIP(w)); } + + // Conversion to other types FI constexpr XYZEval asInt16() const { return LOGICAL_AXIS_ARRAY(int16_t(e), int16_t(x), int16_t(y), int16_t(z), int16_t(i), int16_t(j), int16_t(k), int16_t(u), int16_t(v), int16_t(w)); } FI constexpr XYZEval asInt32() const { return LOGICAL_AXIS_ARRAY(int32_t(e), int32_t(x), int32_t(y), int32_t(z), int32_t(i), int32_t(j), int32_t(k), int32_t(u), int32_t(v), int32_t(w)); } FI constexpr XYZEval asUInt32() const { return LOGICAL_AXIS_ARRAY(uint32_t(e), uint32_t(x), uint32_t(y), uint32_t(z), uint32_t(i), uint32_t(j), uint32_t(k), uint32_t(u), uint32_t(v), uint32_t(w)); } FI constexpr XYZEval asInt64() const { return LOGICAL_AXIS_ARRAY(int64_t(e), int64_t(x), int64_t(y), int64_t(z), int64_t(i), int64_t(j), int64_t(k), int64_t(u), int64_t(v), int64_t(w)); } FI constexpr XYZEval asUInt64() const { return LOGICAL_AXIS_ARRAY(uint64_t(e), uint64_t(x), uint64_t(y), uint64_t(z), uint64_t(i), uint64_t(j), uint64_t(k), uint64_t(u), uint64_t(v), uint64_t(w)); } - FI constexpr XYZEval ROUNDL() const { return LOGICAL_AXIS_ARRAY(int32_t(LROUND(e)), int32_t(LROUND(x)), int32_t(LROUND(y)), int32_t(LROUND(z)), int32_t(LROUND(i)), int32_t(LROUND(j)), int32_t(LROUND(k)), int32_t(LROUND(u)), int32_t(LROUND(v)), int32_t(LROUND(w))); } FI constexpr XYZEval asFloat() const { return LOGICAL_AXIS_ARRAY(static_cast(e), static_cast(x), static_cast(y), static_cast(z), static_cast(i), static_cast(j), static_cast(k), static_cast(u), static_cast(v), static_cast(w)); } - FI constexpr XYZEval reciprocal() const { return LOGICAL_AXIS_ARRAY(_RECIP(e), _RECIP(x), _RECIP(y), _RECIP(z), _RECIP(i), _RECIP(j), _RECIP(k), _RECIP(u), _RECIP(v), _RECIP(w)); } // Marlin workspace shifting is done with G92 and M206 FI XYZEval asLogical() const { XYZEval o = asFloat(); toLogical(o); return o; } From 5249d1036996ebb2f4d0d8ad3281e4680c38accc Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Wed, 29 Oct 2025 00:32:37 +0000 Subject: [PATCH 25/27] [cron] Bump distribution date (2025-10-29) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 576454feff..650b942c08 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2025-10-28" +//#define STRING_DISTRIBUTION_DATE "2025-10-29" /** * The protocol for communication to the host. Protocol indicates communication diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 6e6ae70a6c..445ea6994f 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2025-10-28" + #define STRING_DISTRIBUTION_DATE "2025-10-29" #endif /** From fa4b73ee047b5ad1f7c66c8a9c46b512e542ef06 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 28 Oct 2025 19:45:50 -0500 Subject: [PATCH 26/27] =?UTF-8?q?=F0=9F=93=9D=20Document=20Marlin=20config?= =?UTF-8?q?=20includes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/MarlinConfig.h | 19 ++++++++++++++++--- Marlin/src/inc/MarlinConfigPre.h | 25 ++++++++++++++++++++++--- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/Marlin/src/inc/MarlinConfig.h b/Marlin/src/inc/MarlinConfig.h index f962a5ff5c..70f34944c9 100644 --- a/Marlin/src/inc/MarlinConfig.h +++ b/Marlin/src/inc/MarlinConfig.h @@ -21,9 +21,22 @@ */ #pragma once -// -// Prefix header for all Marlin sources -// +/** + * MarlinConfig.h + * + * Prefix header for all Marlin sources. Includes the following: + * + * Conditionals-6-type.h + * MarlinConfigPre-6-type.h + * Conditionals-5-post.h + * MarlinConfigPre.h + * ... (see the file) ... + * HAL.h + * pins.h + * HAL/timers.h + * HAL/spi_pins.h + * types.h + */ #include "Conditionals-6-type.h" diff --git a/Marlin/src/inc/MarlinConfigPre.h b/Marlin/src/inc/MarlinConfigPre.h index 6abd9e1ea6..e89471f578 100644 --- a/Marlin/src/inc/MarlinConfigPre.h +++ b/Marlin/src/inc/MarlinConfigPre.h @@ -21,9 +21,28 @@ */ #pragma once -// -// Prefix header to acquire configurations -// +/** + * MarlinConfigPre.h + * + * Prefix header to acquire Configurations. Includes the following: + * + * Conditionals-1-axes.h + * MarlinConfigPre-1-axes.h + * Config.h + * macros.h + * boards.h + * Configuration.h (if not Config.h) + * HAL/platforms.h + * Version.h + * Conditionals-2-LCD.h + * Conditionals-3-etc.h + * Conditionals-4-adv.h + * MarlinConfigPre-4-adv.h + * Conditionals-3-etc.h (as above) + * drivers.h + * Configuration_adv.h (if not Config.h) + */ + #include "Conditionals-1-axes.h" #include "Conditionals-2-LCD.h" #include "Conditionals-3-etc.h" From 93394f1ff54678ca5965ef6116ddd1211e8f9314 Mon Sep 17 00:00:00 2001 From: Skruppy Date: Wed, 29 Oct 2025 03:01:17 +0100 Subject: [PATCH 27/27] =?UTF-8?q?=E2=9C=A8=20Use=20TMC=20SoftwareSerial=20?= =?UTF-8?q?only=20if=20required=20(#28145)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/AVR/inc/SanityCheck.h | 2 +- Marlin/src/inc/Conditionals-5-post.h | 2 ++ ini/features.ini | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Marlin/src/HAL/AVR/inc/SanityCheck.h b/Marlin/src/HAL/AVR/inc/SanityCheck.h index 85ee683685..08fe21d4f8 100644 --- a/Marlin/src/HAL/AVR/inc/SanityCheck.h +++ b/Marlin/src/HAL/AVR/inc/SanityCheck.h @@ -95,7 +95,7 @@ /** * The Trinamic library includes SoftwareSerial.h, leading to a compile error. */ -#if ALL(HAS_TRINAMIC_CONFIG, ENDSTOP_INTERRUPTS_FEATURE) +#if ALL(HAS_TMC_SW_SERIAL, ENDSTOP_INTERRUPTS_FEATURE) #error "TMCStepper includes SoftwareSerial.h which is incompatible with ENDSTOP_INTERRUPTS_FEATURE. Disable ENDSTOP_INTERRUPTS_FEATURE to continue." #endif diff --git a/Marlin/src/inc/Conditionals-5-post.h b/Marlin/src/inc/Conditionals-5-post.h index 67c0135d19..6e5fa8de6c 100644 --- a/Marlin/src/inc/Conditionals-5-post.h +++ b/Marlin/src/inc/Conditionals-5-post.h @@ -1867,6 +1867,8 @@ #endif #if ANY_AXIS_HAS(SW_SERIAL) #define HAS_TMC_SW_SERIAL 1 +#elif HAS_TRINAMIC_CONFIG + #define HAS_TMC_WITHOUT_SW_SERIAL 1 #endif #ifndef SERIAL_FLOAT_PRECISION #define SERIAL_FLOAT_PRECISION 2 diff --git a/ini/features.ini b/ini/features.ini index 3799c2864c..c3fc6df537 100644 --- a/ini/features.ini +++ b/ini/features.ini @@ -20,8 +20,9 @@ MARLIN_TEST_BUILD = build_src_filter=+ POSTMORTEM_DEBUGGING = build_src_filter=+ + build_flags=-funwind-tables MKS_WIFI_MODULE = QRCode=https://github.com/makerbase-mks/QRCode/archive/261c5a696a.zip -HAS_TRINAMIC_CONFIG = TMCStepper=https://github.com/MarlinFirmware/TMCStepper/archive/v0.8.8.zip +HAS_TRINAMIC_CONFIG = TMCStepper=https://github.com/MarlinFirmware/TMCStepper/archive/v0.8.9.zip build_src_filter=+ + + + + +HAS_TMC_WITHOUT_SW_SERIAL = build_flags=-DTMCSTEPPER_SW_SERIAL=false HAS_STEPPER_CONTROL = build_src_filter=+ HAS_T(RINAMIC_CONFIG|MC_SPI) = build_src_filter=+ EDITABLE_HOMING_CURRENT = build_src_filter=+