Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7d9537e
freeze_feature
Switchleg1 Dec 16, 2024
3532a57
update
DerAndere1 Jan 4, 2026
15d23f0
corrects missing 'acceleration_rate'
DerAndere1 Jan 4, 2026
9f81cfb
Adds acceleration_rate in planner.h when S_CURVE acceleration is bein…
Switchleg1 Dec 16, 2024
e0b5215
Optimizations
Switchleg1 Dec 18, 2024
bc6a5a1
Adds option to turn off laser
Switchleg1 Dec 19, 2024
67c1e61
optimizations and bug fixes
Switchleg1 Dec 20, 2024
7fc1beb
Format
thinkyhead Jan 12, 2025
e9ee860
general cleanup, test with s-curve
thinkyhead Jan 12, 2025
7381464
add'l format
thinkyhead Jan 12, 2025
709cd93
refine config
thinkyhead Jan 12, 2025
2b7eb61
fix test
thinkyhead Jan 13, 2025
95ff8a0
Replace REALTIME_RAMPING with FREEZE_FEATURE
DerAndere1 Jan 4, 2026
c02cb9f
USE_FREEZE_PIN => NO_FREEZE_PIN
DerAndere1 Jan 4, 2026
55f8856
fix test
DerAndere1 Jan 4, 2026
8ea13ef
fix
DerAndere1 Jan 4, 2026
22c40db
fixip
DerAndere1 Jan 4, 2026
26beaf7
fixup
DerAndere1 Jan 4, 2026
086915b
fix LIN_ADVANCE, whitespace
DerAndere1 Jan 4, 2026
6739dbc
FREEZE_FEATURE => SOFT_FEED_HOLD
DerAndere1 Jan 4, 2026
c281c43
fix FREEZE_FEATURE
DerAndere1 Jan 6, 2026
44748b5
fix
DerAndere1 Jan 6, 2026
ab38e07
Make frozen_state public without SOFT_FEED_HOLD
DerAndere1 Jan 6, 2026
59381d3
fix
DerAndere1 Jan 7, 2026
9deef93
initial cleanup, review
thinkyhead Jan 18, 2026
4b7bdc4
Merge branch 'bugfix-2.1.x' into pr/28265
thinkyhead Jan 18, 2026
4deb95c
frozen_state implicit init
thinkyhead Jan 18, 2026
9c07f13
simplify
thinkyhead Jan 18, 2026
d55bdda
section
thinkyhead Jan 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 31 additions & 8 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2826,8 +2826,8 @@
*
* Adds support for commands:
* S000 : Report State and Position while moving.
* P000 : Instant Pause / Hold while moving.
* R000 : Resume from Pause / Hold.
* P000 : Instant Pause / Hold while moving. Enable SOFT_FEED_HOLD for soft deceleration.
* R000 : Resume from Pause / Hold. Enable SOFT_FEED_HOLD for soft acceleration.
*
* - During Hold all Emergency Parser commands are available, as usual.
* - Enable NANODLP_Z_SYNC and NANODLP_ALL_AXIS for move command end-state reports.
Expand Down Expand Up @@ -4457,15 +4457,38 @@
#endif

/**
* Instant freeze / unfreeze functionality
* Potentially useful for rapid stop that allows being resumed. Halts stepper movement.
* Note this does NOT pause spindles, lasers, fans, heaters or any other auxiliary device.
* @section interface
* Freeze / Unfreeze
*
* Pause / Hold that keeps power available and does not stop the spindle can be initiated by
* the FREEZE_PIN. Halts instantly (default) or performs a soft feed hold that decelerates and
* halts movement at FREEZE_JERK (requires SOFT_FEED_HOLD).
* Motion can be resumed by using the FREEZE_PIN.
*
* NOTE: Controls Laser PWM but does NOT pause Spindle, Fans, Heaters or other devices.
* @section freeze
*/
//#define FREEZE_FEATURE
#if ENABLED(FREEZE_FEATURE)
//#define FREEZE_PIN 41 // Override the default (KILL) pin here
#define FREEZE_STATE LOW // State of pin indicating freeze
//#define FREEZE_PIN -1 // Override the default (KILL) pin here
#define FREEZE_STATE LOW // State of pin indicating freeze
#endif

#if ANY(FREEZE_FEATURE, REALTIME_REPORTING_COMMANDS)
/**
* Command P000 (REALTIME_REPORTING_COMMANDS and EMERGENCY_PARSER) or
* FREEZE_PIN (FREEZE_FEATURE) initiates a soft feed hold that keeps
* power available and does not stop the spindle.
*
* The soft feed hold decelerates and halts movement at FREEZE_JERK.
* Motion can be resumed with command R000 (requires REALTIME_REPORTING_COMMANDS) or
* by using the FREEZE_PIN (requires FREEZE_FEATURE).
*
* NOTE: Affects Laser PWM but DOES NOT pause Spindle, Fans, Heaters or other devices.
*/
//#define SOFT_FEED_HOLD
#if ENABLED(SOFT_FEED_HOLD)
#define FREEZE_JERK 2 // (mm/s) Completely halt when motion has decelerated below this value
#endif
#endif

/**
Expand Down
16 changes: 13 additions & 3 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,10 @@
#include "feature/rs485.h"
#endif

#if ENABLED(SOFT_FEED_HOLD)
#include "feature/e_parser.h"
#endif

/**
* Spin in place here while keeping temperature processing alive
*/
Expand Down Expand Up @@ -514,8 +518,14 @@ void Marlin::manage_inactivity(const bool no_stepper_sleep/*=false*/) {
}
#endif

#if ENABLED(FREEZE_FEATURE)
stepper.frozen = READ(FREEZE_PIN) == FREEZE_STATE;
// Handle the FREEZE button
#if ANY(FREEZE_FEATURE, SOFT_FEED_HOLD)
stepper.set_frozen_triggered(
TERN0(FREEZE_FEATURE, READ(FREEZE_PIN) == FREEZE_STATE)
#if ALL(SOFT_FEED_HOLD, REALTIME_REPORTING_COMMANDS)
|| realtime_ramping_pause_flag
#endif
);
#endif

#if HAS_HOME
Expand Down Expand Up @@ -1221,7 +1231,7 @@ void setup() {
#endif
#endif

#if ENABLED(FREEZE_FEATURE)
#if ENABLED(FREEZE_FEATURE) && DISABLED(NO_FREEZE_PIN)
SETUP_LOG("FREEZE_PIN");
#if FREEZE_STATE
SET_INPUT_PULLDOWN(FREEZE_PIN);
Expand Down
8 changes: 6 additions & 2 deletions Marlin/src/feature/e_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ EmergencyParser emergency_parser;
void quickresume_stepper();
#endif

#if ENABLED(SOFT_FEED_HOLD)
bool realtime_ramping_pause_flag = false;
#endif

void EmergencyParser::update(EmergencyParser::State &state, const uint8_t c) {
auto uppercase = [](char c) {
return TERN0(GCODE_CASE_INSENSITIVE, WITHIN(c, 'a', 'z')) ? c + 'A' - 'a' : c;
Expand Down Expand Up @@ -223,8 +227,8 @@ void EmergencyParser::update(EmergencyParser::State &state, const uint8_t c) {
#endif
#if ENABLED(REALTIME_REPORTING_COMMANDS)
case EP_GRBL_STATUS: report_current_position_moving(); break;
case EP_GRBL_PAUSE: quickpause_stepper(); break;
case EP_GRBL_RESUME: quickresume_stepper(); break;
case EP_GRBL_PAUSE: TERN(SOFT_FEED_HOLD, realtime_ramping_pause_flag = true, quickpause_stepper()); break;
case EP_GRBL_RESUME: TERN(SOFT_FEED_HOLD, realtime_ramping_pause_flag = false, quickresume_stepper()); break;
#endif
#if ENABLED(SOFT_RESET_VIA_SERIAL)
case EP_KILL: hal.reboot(); break;
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/feature/e_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,7 @@ class EmergencyParser {
};

extern EmergencyParser emergency_parser;

#if ENABLED(SOFT_FEED_HOLD)
extern bool realtime_ramping_pause_flag;
#endif
5 changes: 3 additions & 2 deletions Marlin/src/inc/Conditionals-5-post.h
Original file line number Diff line number Diff line change
Expand Up @@ -3047,9 +3047,10 @@
#endif

// User Interface
#if ENABLED(FREEZE_FEATURE) && !PIN_EXISTS(FREEZE) && PIN_EXISTS(KILL)
#if ENABLED(FREEZE_FEATURE) && DISABLED(NO_FREEZE_PIN) && !PIN_EXISTS(FREEZE) && PIN_EXISTS(KILL)
#define FREEZE_PIN KILL_PIN
#elif PIN_EXISTS(KILL) && TERN1(FREEZE_FEATURE, KILL_PIN != FREEZE_PIN)
#define FREEZE_STOLE_KILL_PIN_WARNING 1
#elif PIN_EXISTS(KILL) && TERN1(HAS_FREEZE_PIN, KILL_PIN != FREEZE_PIN)
#define HAS_KILL 1
#endif
#if PIN_EXISTS(HOME)
Expand Down
12 changes: 8 additions & 4 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,12 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
/**
* Instant Freeze
*/
#if ENABLED(FREEZE_FEATURE) && !(PIN_EXISTS(FREEZE) && defined(FREEZE_STATE))
#error "FREEZE_FEATURE requires both FREEZE_PIN and FREEZE_STATE."
#if ENABLED(SOFT_FEED_HOLD) && !defined(FREEZE_JERK)
#error "SOFT_FEED_HOLD requires FREEZE_JERK."
#elif ENABLED(FREEZE_FEATURE) && DISABLED(NO_FREEZE_PIN) && !(defined(FREEZE_PIN) && defined(FREEZE_STATE))
#error "FREEZE_FEATURE requires FREEZE_PIN and FREEZE_STATE."
#elif ENABLED(NO_FREEZE_PIN) && !(defined(REALTIME_REPORTING_COMMANDS))
#error "NO_FREEZE_PIN requires REALTIME_REPORTING_COMMANDS."
#endif

/**
Expand Down Expand Up @@ -4501,8 +4505,8 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive."
#error "SMOOTH_LIN_ADVANCE is not yet available in FT_MOTION. Disable NO_STANDARD_MOTION if you require it."
#elif ENABLED(MIXING_EXTRUDER)
#error "MIXING_EXTRUDER is not yet available in FT_MOTION. Disable NO_STANDARD_MOTION if you require it."
#elif ENABLED(FREEZE_FEATURE)
#error "FREEZE_FEATURE is not yet available in FT_MOTION. Disable NO_STANDARD_MOTION if you require it."
#elif ENABLED(SOFT_FEED_HOLD)
#error "SOFT_FEED_HOLD is not yet available in FT_MOTION. Disable NO_STANDARD_MOTION if you require it."
#elif ENABLED(DIRECT_STEPPING)
#error "DIRECT_STEPPING is not yet available in FT_MOTION. Disable NO_STANDARD_MOTION if you require it."
#elif ENABLED(DIFFERENTIAL_EXTRUDER)
Expand Down
7 changes: 7 additions & 0 deletions Marlin/src/inc/Warnings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1005,3 +1005,10 @@
#elif !RECOMMEND_REINIT_NOISY_LCD && ENABLED(REINIT_NOISY_LCD)
#warning "REINIT_NOISY_LCD is probably not required with your LCD controller model."
#endif

/**
* FREEZE_FEATURE may override the KILL_PIN
*/
#if FREEZE_STOLE_KILL_PIN_WARNING
#warning "FREEZE_FEATURE uses KILL_PIN replacing the KILL button. Define a separate FREEZE_PIN if you don't want this behavior."
#endif
3 changes: 3 additions & 0 deletions Marlin/src/module/planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2428,6 +2428,9 @@ bool Planner::_populate_block(
block->acceleration_steps_per_s2 = accel;
#if DISABLED(S_CURVE_ACCELERATION)
block->acceleration_rate = uint32_t(accel * (float(_BV32(24)) / (STEPPER_TIMER_RATE)));
#elif ENABLED(SOFT_FEED_HOLD)
// No need to waste time calculating the linear acceleration rate until the freeze_pin is triggered, leave this 0
block->acceleration_rate = 0;
#endif
#endif
block->acceleration = accel / steps_per_mm;
Expand Down
3 changes: 2 additions & 1 deletion Marlin/src/module/planner.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ typedef struct PlannerBlock {
#if ENABLED(S_CURVE_ACCELERATION)
uint32_t acceleration_time_inverse, // Inverse of acceleration and deceleration periods, expressed as integer. Scale depends on CPU being used
deceleration_time_inverse;
#elif HAS_STANDARD_MOTION
#endif
#if ENABLED(HAS_STANDARD_MOTION) && (DISABLED(S_CURVE_ACCELERATION) || ENABLED(FREEZE_FEATURE))
uint32_t acceleration_rate; // Acceleration rate in (2^24 steps)/timer_ticks*s
#endif

Expand Down
Loading
Loading