add'l format

This commit is contained in:
Scott Lahteine 2025-01-11 22:48:49 -06:00
parent ac980da146
commit 990b2d14f1
2 changed files with 25 additions and 23 deletions

View file

@ -4557,28 +4557,28 @@ void Stepper::report_positions() {
#if ENABLED(FREEZE_FEATURE)
void Stepper::set_frozen_solid(bool state) {
if (state != is_frozen_solid()) {
set_frozen_flag(state, FROZEN_SOLID);
void Stepper::set_frozen_solid(const bool state) {
if (state != is_frozen_solid()) return;
#if ENABLED(LASER_FEATURE)
if (state) {
frozen_last_laser_power = cutter.last_power_applied;
cutter.apply_power(0); // No movement in dynamic mode so turn Laser off
}
else {
cutter.apply_power(frozen_last_laser_power); // Restore frozen laser power
}
#endif
}
set_frozen_flag(state, FROZEN_SOLID);
#if ENABLED(LASER_FEATURE)
if (state) {
frozen_last_laser_power = cutter.last_power_applied;
cutter.apply_power(0); // No movement in dynamic mode so turn Laser off
}
else {
cutter.apply_power(frozen_last_laser_power); // Restore frozen laser power
}
#endif
}
void Stepper::check_frozen_time(uint32_t &step_rate) {
//If frozen_time is 0 there is no need to modify the current step_rate
// If frozen_time is 0 there is no need to modify the current step_rate
if (!frozen_time) return;
#if ENABLED(S_CURVE_ACCELERATION)
//If the machine is configured to use S_CURVE_ACCELERATION standard ramp acceleration
// If the machine is configured to use S_CURVE_ACCELERATION standard ramp acceleration
// rate will not have been calculated at this point
if (!current_block->acceleration_rate) {
current_block->acceleration_rate = (uint32_t)(current_block->acceleration_steps_per_s2 * (float(1UL << 24) / (STEPPER_TIMER_RATE)));
@ -4628,8 +4628,10 @@ void Stepper::report_positions() {
// If frozen state is deactivated during the deceleration phase we need to double our acceleration efforts
if (!is_frozen_triggered()) {
if (frozen_time) {
if (frozen_time > interval * 2) frozen_time -= interval * 2;
else frozen_time = 0;
if (frozen_time > interval * 2)
frozen_time -= interval * 2;
else
frozen_time = 0;
}
set_frozen_solid(false);
}

View file

@ -293,7 +293,7 @@ constexpr ena_mask_t enable_overlap[] = {
FREEZE_DECELERATION,
FREEZE_CRUISE
};
enum FrozenState { FROZEN_SLOWING, FROZEN_SOLID };
enum FrozenState { FROZEN_TRIGGERED, FROZEN_SOLID };
#endif
//
@ -345,8 +345,8 @@ class Stepper {
#endif
#if ENABLED(FREEZE_FEATURE)
static inline void set_frozen_triggered(bool state) { set_frozen_flag(state, FROZEN_SLOWING); }
static inline bool is_frozen_triggered() { return TEST(frozen_state, FROZEN_SLOWING); }
static void set_frozen_triggered(const bool state) { set_frozen_flag(state, FROZEN_TRIGGERED); }
static bool is_frozen_triggered() { return TEST(frozen_state, FROZEN_TRIGGERED); }
#endif
#if ENABLED(NONLINEAR_EXTRUSION)
@ -748,9 +748,9 @@ class Stepper {
#endif
static void check_frozen_time(uint32_t &step_rate);
static void check_frozen_state(const FreezePhase type, const uint32_t interval);
static inline void set_frozen_flag(bool state, uint8_t flag) { SET_BIT_TO(frozen_state, flag, state); }
static inline void set_frozen_solid(bool state);
static inline bool is_frozen_solid() { return TEST(frozen_state, FROZEN_SOLID); }
static void set_frozen_flag(const bool state, const uint8_t flag) { SET_BIT_TO(frozen_state, flag, state); }
static void set_frozen_solid(const bool state);
static bool is_frozen_solid() { return TEST(frozen_state, FROZEN_SOLID); }
#endif // FREEZE_FEATURE
};