-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds ramp acceleration to FREEZE_FEATURE #27592
base: bugfix-2.1.x
Are you sure you want to change the base?
Conversation
This allows the freeze_feature to use acceleration when triggering freeze_pin
I apologize for the multiple updates. Copying over from another branch it appears I missed a few lines. |
Prevents calculating unnecessary linear acceleration rate during path planning when using s_curve_acceleration. General cleanup and commented out feature by default in configuration.
This wording will also need to be adjusted (or options/defaults changed) since it will no longer be "instant": Marlin/Marlin/Configuration_adv.h Line 4292 in 4eb8a87
|
User has the option of turning the laser off when motion is halted regardless of laser mode. Once motion starts previous laser power is restored. Also makes changes to feature description in config_adv.h
If freeze is triggered when machine is stationary it immediately sets solid flag.
d0323a9
to
ac980da
Compare
@@ -500,7 +500,7 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) { | |||
#endif | |||
|
|||
#if ENABLED(FREEZE_FEATURE) | |||
stepper.frozen = READ(FREEZE_PIN) == FREEZE_STATE; | |||
stepper.set_frozen_triggered(READ(FREEZE_PIN) == FREEZE_STATE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that without some debounce this state will oscillate, and will be reset if the pin is released. It will be simpler to set the frozen state with a single trigger of the pin and then not reset it to 0 when the pin is un-triggered, but if that is too sensitive then some debounce logic can help. It depends on the use case for freeze and the kind of switch that it's attached to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes though bouncing only affects whether the machine is accelerating or decelerating for the duration of the bounce and since it does not violate the machine abilities do we care? I have been using similar code on my CNC router using a standard rocker switch on ramps/AVR for the past month and a half and it's served me well without any noticable stuttering.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also want to be able to restart the machine after a freeze condition. Some scenarios include material build up in the tool, also incorrect gcode where we would like to clear the current buffer (and current move) and restart without having to redial the machine back in as in the case of using the kill method. I had implemented this in repetier years ago and plan to complete this function in Marlin when I have a chance.
Simply removes the FREEZE_FEATURE instant halt code and adds a linear ramp of deceleration when pin is triggered and acceleration back to full speed on deactivation. Acceleration values are based on the current planner blocks and final jerk is set within the configuration file.
This is achieved by intercepting the calculated step_rate during Step::block_phase_isr() on each planner block stages (init/accel/decel/cruise) by tracking the time accumulated since triggering the freeze pin.
For example here is the deceleration implementation:
#if ENABLED(FREEZE_FEATURE)
if(frozen_time) check_frozen_time(step_rate);
#endif
// step_rate to timer interval and steps per stepper isr
interval = calc_multistep_timer_interval(step_rate << oversampling_factor);
deceleration_time += interval;
#if ENABLED(FREEZE_FEATURE)
check_frozen_pin(1, interval);
#endif
-->
Requirements
Should work on all boards, has been tested on mega2560.
Benefits
Prevents skipped steps when trying to pause a machine.
Configurations
Configuration_Adv.h
#define FREEZE_FEATURE
#if ENABLED(FREEZE_FEATURE)
#define FREEZE_PIN 5 // Override the default (KILL) pin here
#define FREEZE_JERK 2 // Completely halt when motion has decelerated below this value
#define FREEZE_STATE LOW // State of pin indicating freeze
#endif
adds FREEZE_JERK as in the example above