From e3a5319e3c855925e7218fc0204f6705a935c3ef Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 22 Oct 2025 15:04:42 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Misc.=20cleanup,=20probe=20FR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/tmc_util.cpp | 10 ++--- Marlin/src/gcode/calibrate/G34_M422.cpp | 6 +-- Marlin/src/module/endstops.cpp | 5 --- Marlin/src/module/endstops.h | 2 +- Marlin/src/module/ft_motion.cpp | 7 ++++ Marlin/src/module/ft_motion.h | 2 +- Marlin/src/module/motion.cpp | 2 +- Marlin/src/module/motion.h | 4 +- Marlin/src/module/planner.cpp | 2 +- Marlin/src/module/settings.cpp | 2 +- Marlin/src/module/stepper.cpp | 50 +++++++------------------ 11 files changed, 36 insertions(+), 56 deletions(-) diff --git a/Marlin/src/feature/tmc_util.cpp b/Marlin/src/feature/tmc_util.cpp index 06ee4c9e93..b1fc69f88a 100644 --- a/Marlin/src/feature/tmc_util.cpp +++ b/Marlin/src/feature/tmc_util.cpp @@ -973,14 +973,14 @@ TMC_REPORT("[mm/s]\t", TMC_TPWMTHRS_MMS); TMC_REPORT("OT prewarn", TMC_DEBUG_OTPW); #if ENABLED(MONITOR_DRIVER_STATUS) - TMC_REPORT("triggered\n OTP\t", TMC_OTPW_TRIGGERED); + TMC_REPORT("OTPW trig.\t", TMC_OTPW_TRIGGERED); #endif #if HAS_TMC220x - TMC_REPORT("pwm scale sum", TMC_PWM_SCALE_SUM); - TMC_REPORT("pwm scale auto", TMC_PWM_SCALE_AUTO); - TMC_REPORT("pwm offset auto", TMC_PWM_OFS_AUTO); - TMC_REPORT("pwm grad auto", TMC_PWM_GRAD_AUTO); + TMC_REPORT("pwm scale sum", TMC_PWM_SCALE_SUM); + TMC_REPORT("pwm scale auto", TMC_PWM_SCALE_AUTO); + TMC_REPORT("pwm offset auto", TMC_PWM_OFS_AUTO); + TMC_REPORT("pwm grad auto", TMC_PWM_GRAD_AUTO); #endif TMC_REPORT("off time", TMC_TOFF); diff --git a/Marlin/src/gcode/calibrate/G34_M422.cpp b/Marlin/src/gcode/calibrate/G34_M422.cpp index aba828d6dd..1ac58cc894 100644 --- a/Marlin/src/gcode/calibrate/G34_M422.cpp +++ b/Marlin/src/gcode/calibrate/G34_M422.cpp @@ -236,10 +236,8 @@ void GcodeSuite::G34() { Z_TWEEN_SAFE_CLEARANCE // z_clearance ); - if (DEBUGGING(LEVELING)) { - DEBUG_ECHOLNPGM_P(PSTR("Probing X"), ppos.x, SP_Y_STR, ppos.y); - DEBUG_ECHOLNPGM("Height = ", z_probed_height); - } + if (DEBUGGING(LEVELING)) + DEBUG_ECHOLN(F("Probing X"), ppos.x, FPSTR(SP_Y_STR), ppos.y, F(" Height = "), z_probed_height); if (isnan(z_probed_height)) { SERIAL_ECHOLNPGM(STR_ERR_PROBING_FAILED); diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index b0ad431476..a12e432003 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -309,11 +309,6 @@ void Endstops::enable(const bool onoff) { resync(); } -// Disable / Enable endstops based on ENSTOPS_ONLY_FOR_HOMING and global enable -void Endstops::not_homing() { - enabled = enabled_globally; -} - #if ENABLED(VALIDATE_HOMING_ENDSTOPS) // If the last move failed to trigger an endstop, call kill void Endstops::validate_homing_move() { diff --git a/Marlin/src/module/endstops.h b/Marlin/src/module/endstops.h index 40975632ff..ab124c3536 100644 --- a/Marlin/src/module/endstops.h +++ b/Marlin/src/module/endstops.h @@ -246,7 +246,7 @@ class Endstops { static void enable(const bool onoff=true); // Disable / Enable endstops based on ENSTOPS_ONLY_FOR_HOMING and global enable - static void not_homing(); + static void not_homing() { enabled = enabled_globally; } #if ENABLED(VALIDATE_HOMING_ENDSTOPS) // If the last move failed to trigger an endstop, call kill diff --git a/Marlin/src/module/ft_motion.cpp b/Marlin/src/module/ft_motion.cpp index a72fe13fd6..cd0c162668 100644 --- a/Marlin/src/module/ft_motion.cpp +++ b/Marlin/src/module/ft_motion.cpp @@ -20,6 +20,13 @@ * */ +/** + * ft_motion.cpp - Singleton to execute Fixed Time Motion planning + * + * Fixed-Time Motion concept contributed by Ulendo with integration and + * overhaul optimizations by @thinkyhead, @narno2202, @dbuezas. + */ + #include "../inc/MarlinConfig.h" #if ENABLED(FT_MOTION) diff --git a/Marlin/src/module/ft_motion.h b/Marlin/src/module/ft_motion.h index 11f85aea53..a6b3e5fc58 100644 --- a/Marlin/src/module/ft_motion.h +++ b/Marlin/src/module/ft_motion.h @@ -145,7 +145,7 @@ class FTMotion { #if HAS_FTM_SHAPING // Refresh gains and indices used by shaping functions. - static void update_shaping_params(void); + static void update_shaping_params(); #endif #if ENABLED(FTM_SMOOTHING) diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index d7967f6aaf..1282e605eb 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -190,7 +190,7 @@ xyz_pos_t cartes; xyz_pos_t workspace_offset{0}; #endif -#if HAS_ABL_NOT_UBL +#if ABL_USES_GRID feedRate_t xy_probe_feedrate_mm_s = MMM_TO_MMS(XY_PROBE_FEEDRATE); #endif diff --git a/Marlin/src/module/motion.h b/Marlin/src/module/motion.h index 39da94a46e..e74562728d 100644 --- a/Marlin/src/module/motion.h +++ b/Marlin/src/module/motion.h @@ -62,7 +62,9 @@ extern xyz_pos_t cartes; extern abce_pos_t delta; #endif -#if HAS_ABL_NOT_UBL +// Determine XY_PROBE_FEEDRATE_MM_S - The feedrate used between Probe Points +#if ABL_USES_GRID + // ABL LINEAR and BILINEAR use 'G29 S' value, or MMM_TO_MMS(XY_PROBE_FEEDRATE) extern feedRate_t xy_probe_feedrate_mm_s; #define XY_PROBE_FEEDRATE_MM_S xy_probe_feedrate_mm_s #elif defined(XY_PROBE_FEEDRATE) diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index b088c0b392..f5507da7a5 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -3065,7 +3065,7 @@ bool Planner::buffer_line(const xyze_pos_t &cart, const feedRate_t fr_mm_s feedRate_t calculated_feedrate = fr_mm_s; const xyz_pos_t diff = delta - position_float; if (!NEAR_ZERO(diff.b)) { - if (delta.a <= POLAR_FAST_RADIUS ) + if (delta.a <= POLAR_FAST_RADIUS) calculated_feedrate = settings.max_feedrate_mm_s[Y_AXIS]; else { // Normalized vector of movement diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index e72a2d14ac..63f69d13c2 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -2518,7 +2518,7 @@ void MarlinSettings::postprocess() { #if HAS_TRINAMIC_CONFIG - #define SET_CURR(Q) stepper##Q.rms_current(currents.Q ? currents.Q : Q##_CURRENT) + #define SET_CURR(Q) stepper##Q.rms_current(currents.Q ?: Q##_CURRENT) if (!validating) { TERN_(X_IS_TRINAMIC, SET_CURR(X)); TERN_(Y_IS_TRINAMIC, SET_CURR(Y)); diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 8bf839c39c..20415265b1 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -21,33 +21,25 @@ */ /** - * stepper.cpp - A singleton object to execute motion plans using stepper motors - * Marlin Firmware + * stepper.cpp - Singleton to execute motion plans using stepper motors * - * Derived from Grbl - * Copyright (c) 2009-2011 Simen Svale Skogsrud + * Marlin uses the Bresenham algorithm. For a detailed explanation of theory and + * method see https://www.cs.helsinki.fi/group/goa/mallinnus/lines/bresenh.html * - * Grbl is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Grbl is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Grbl. If not, see . - */ - -/** * Timer calculations informed by the 'RepRap cartesian firmware' by Zack Smith * and Philipp Tiefenbacher. + * + * Jerk controlled movements planner added Apr 2018 by Eduardo José Tagle. + * Equations based on Synthethos TinyG2 sources, but the fixed-point + * implementation is new, as we are running the ISR with a variable period. + * Also implemented the Bézier velocity curve evaluation in ARM assembler, + * to avoid impacting ISR speed. + * + * Fixed-Time Motion concept contributed by Ulendo with integration and + * overhaul optimizations by @thinkyhead, @narno2202, @dbuezas. */ -/** - * __________________________ +/** __________________________ * /| |\ _________________ ^ * / | | \ /| |\ | * / | | \ / | | \ s @@ -70,19 +62,6 @@ * - Reset the trapezoid generator. */ -/** - * Marlin uses the Bresenham algorithm. For a detailed explanation of theory and - * method see https://www.cs.helsinki.fi/group/goa/mallinnus/lines/bresenh.html - */ - -/** - * Jerk controlled movements planner added Apr 2018 by Eduardo José Tagle. - * Equations based on Synthethos TinyG2 sources, but the fixed-point - * implementation is new, as we are running the ISR with a variable period. - * Also implemented the Bézier velocity curve evaluation in ARM assembler, - * to avoid impacting ISR speed. - */ - #include "stepper.h" Stepper stepper; // Singleton @@ -3590,8 +3569,7 @@ void Stepper::report_positions() { if (last_set_direction != last_direction_bits) { // Apply directions (generally applying to the entire linear move) - #define _FTM_APPLY_DIR(A) if (last_direction_bits.A != last_set_direction.A) \ - SET_STEP_DIR(A); + #define _FTM_APPLY_DIR(A) if (last_direction_bits.A != last_set_direction.A) SET_STEP_DIR(A); LOGICAL_AXIS_MAP(_FTM_APPLY_DIR); last_set_direction = last_direction_bits;