diff --git a/changelog.md b/changelog.md index 0cf6dd9..df71c3f 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,23 @@ ## grblHAL changelog +Build 20250329 + +Core: + +* Fix for feedhold during G33 and G76 synchronized motion not beeing delayed until motion completed. + +* "Hardened" new optimized code to ensure initial motion is going in the correct direction. + +Drivers: + +* Most: harmonized handling of HAL stepper go idle call. + +Plugins: + +* Motors, odometer: updated for 20250328 core changes. + +--- + Build 20250328 Core: diff --git a/grbl.h b/grbl.h index 89fde8c..94337cf 100644 --- a/grbl.h +++ b/grbl.h @@ -42,7 +42,7 @@ #else #define GRBL_VERSION "1.1f" #endif -#define GRBL_BUILD 20250328 +#define GRBL_BUILD 20250329 #define GRBL_URL "https://github.com/grblHAL" diff --git a/motion_control.c b/motion_control.c index 721b4ff..2ef64b6 100644 --- a/motion_control.c +++ b/motion_control.c @@ -742,6 +742,9 @@ void mc_thread (plan_line_data_t *pl_data, float *position, gc_thread_data *thre return; } + if(!protocol_buffer_synchronize() && state_get() != STATE_IDLE) // Wait until any previous moves are finished. + return; + pl_data->condition.rapid_motion = On; // Set rapid motion condition flag and pl_data->spindle.state.synchronized = Off; // disable spindle sync for retract & reposition diff --git a/protocol.c b/protocol.c index 0748e87..9952710 100644 --- a/protocol.c +++ b/protocol.c @@ -646,13 +646,6 @@ bool protocol_exec_rt_system (void) rt_exec &= ~(EXEC_STOP|EXEC_STATUS_REPORT|EXEC_GCODE_REPORT|EXEC_PID_REPORT|EXEC_TLO_REPORT|EXEC_RT_COMMAND); // clear requests already processed - if(sys.flags.feed_hold_pending) { - if(rt_exec & EXEC_CYCLE_START) - sys.flags.feed_hold_pending = Off; - else if(!sys.override.control.feed_hold_disable) - rt_exec |= EXEC_FEED_HOLD; - } - // Let state machine handle any remaining requests if(rt_exec) state_update(rt_exec); diff --git a/state_machine.c b/state_machine.c index dcf465b..62ffcdf 100644 --- a/state_machine.c +++ b/state_machine.c @@ -245,6 +245,10 @@ void state_set (sys_state_t new_state) sys_state = pending_state = new_state; park.flags.value = 0; stateHandler = state_idle; + if(sys.flags.feed_hold_pending) { + pending_state = STATE_HOLD; + system_set_exec_state_flag(EXEC_FEED_HOLD); + } break; case STATE_CYCLE: @@ -298,16 +302,16 @@ void state_set (sys_state_t new_state) break; case STATE_HOLD: - if (sys.override.control.sync && sys.override.control.feed_hold_disable) - sys.flags.feed_hold_pending = On; - if (!((sys_state & STATE_JOG) || sys.override.control.feed_hold_disable)) { - if (!initiate_hold(new_state)) { + if(!((sys_state & STATE_JOG) || sys.override.control.feed_hold_disable) || + (pending_state == STATE_HOLD && sys.flags.feed_hold_pending)) { + if(!initiate_hold(new_state)) { sys.holding_state = Hold_Complete; stateHandler = state_await_resume; } sys_state = new_state; sys.flags.feed_hold_pending = Off; - } + } else if(sys.override.control.sync && sys.override.control.feed_hold_disable) + sys.flags.feed_hold_pending = On; break; case STATE_SAFETY_DOOR: diff --git a/stepper.c b/stepper.c index 93caa7f..09678ac 100644 --- a/stepper.c +++ b/stepper.c @@ -195,7 +195,10 @@ void st_wake_up (void) // cancel any pending steppers deenergize //st.exec_block = NULL; stepping = true; + st.dir_out.bits = 0; sys.steppers_deenergize = false; + + hal.stepper.go_idle(true); // Reset step & dir outputs hal.stepper.wake_up(); } @@ -529,9 +532,7 @@ void st_reset (void) if(hal.probe.configure) hal.probe.configure(false, false); - // Initialize stepper driver idle state, clear step and direction port pins. - st_go_idle(); - // hal.stepper.go_idle(true); + st_go_idle(); // Initialize stepper driver idle state. // NOTE: buffer indices starts from 1 for simpler driver coding! @@ -556,13 +557,9 @@ void st_reset (void) pl_block = NULL; // Planner block pointer used by segment buffer segment_buffer_tail = segment_buffer_head = &segment_buffer[0]; // empty = tail - axes_signals_t dir_out = st.dir_out; - memset(&prep, 0, sizeof(st_prep_t)); memset(&st, 0, sizeof(stepper_t)); - st.dir_out = dir_out; - #ifdef ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING // TODO: move to driver? // AMASS_LEVEL0: Normal operation. No AMASS. No upper cutoff frequency. Starts at LEVEL1 cutoff frequency.