Parking motion bug fix.
- Parking motion would intermittently complete the queued tool path upon resuming in certain scenarios. Now fixed.
This commit is contained in:
62
grbl/gcode.c
62
grbl/gcode.c
@ -1034,37 +1034,37 @@ uint8_t gc_execute_line(char *line)
|
||||
// refill and can only be resumed by the cycle start run-time command.
|
||||
gc_state.modal.program_flow = gc_block.modal.program_flow;
|
||||
if (gc_state.modal.program_flow) {
|
||||
protocol_buffer_synchronize(); // Sync and finish all remaining buffered motions before moving on.
|
||||
if (gc_state.modal.program_flow == PROGRAM_FLOW_PAUSED) {
|
||||
if (sys.state != STATE_CHECK_MODE) {
|
||||
bit_true_atomic(sys.rt_exec_state, EXEC_FEED_HOLD); // Use feed hold for program pause.
|
||||
protocol_execute_realtime(); // Execute suspend.
|
||||
}
|
||||
} else { // == PROGRAM_FLOW_COMPLETED
|
||||
// Upon program complete, only a subset of g-codes reset to certain defaults, according to
|
||||
// LinuxCNC's program end descriptions and testing. Only modal groups [G-code 1,2,3,5,7,12]
|
||||
// and [M-code 7,8,9] reset to [G1,G17,G90,G94,G40,G54,M5,M9,M48]. The remaining modal groups
|
||||
// [G-code 4,6,8,10,13,14,15] and [M-code 4,5,6] and the modal words [F,S,T,H] do not reset.
|
||||
gc_state.modal.motion = MOTION_MODE_LINEAR;
|
||||
gc_state.modal.plane_select = PLANE_SELECT_XY;
|
||||
gc_state.modal.distance = DISTANCE_MODE_ABSOLUTE;
|
||||
gc_state.modal.feed_rate = FEED_RATE_MODE_UNITS_PER_MIN;
|
||||
// gc_state.modal.cutter_comp = CUTTER_COMP_DISABLE; // Not supported.
|
||||
gc_state.modal.coord_select = 0; // G54
|
||||
gc_state.modal.spindle = SPINDLE_DISABLE;
|
||||
gc_state.modal.coolant = COOLANT_DISABLE;
|
||||
// gc_state.modal.override = OVERRIDE_DISABLE; // Not supported.
|
||||
|
||||
// Execute coordinate change and spindle/coolant stop.
|
||||
if (sys.state != STATE_CHECK_MODE) {
|
||||
if (!(settings_read_coord_data(gc_state.modal.coord_select,coordinate_data))) { FAIL(STATUS_SETTING_READ_FAIL); }
|
||||
memcpy(gc_state.coord_system,coordinate_data,sizeof(coordinate_data));
|
||||
spindle_stop();
|
||||
coolant_stop();
|
||||
}
|
||||
|
||||
report_feedback_message(MESSAGE_PROGRAM_END);
|
||||
}
|
||||
protocol_buffer_synchronize(); // Sync and finish all remaining buffered motions before moving on.
|
||||
if (gc_state.modal.program_flow == PROGRAM_FLOW_PAUSED) {
|
||||
if (sys.state != STATE_CHECK_MODE) {
|
||||
bit_true_atomic(sys.rt_exec_state, EXEC_FEED_HOLD); // Use feed hold for program pause.
|
||||
protocol_execute_realtime(); // Execute suspend.
|
||||
}
|
||||
} else { // == PROGRAM_FLOW_COMPLETED
|
||||
// Upon program complete, only a subset of g-codes reset to certain defaults, according to
|
||||
// LinuxCNC's program end descriptions and testing. Only modal groups [G-code 1,2,3,5,7,12]
|
||||
// and [M-code 7,8,9] reset to [G1,G17,G90,G94,G40,G54,M5,M9,M48]. The remaining modal groups
|
||||
// [G-code 4,6,8,10,13,14,15] and [M-code 4,5,6] and the modal words [F,S,T,H] do not reset.
|
||||
gc_state.modal.motion = MOTION_MODE_LINEAR;
|
||||
gc_state.modal.plane_select = PLANE_SELECT_XY;
|
||||
gc_state.modal.distance = DISTANCE_MODE_ABSOLUTE;
|
||||
gc_state.modal.feed_rate = FEED_RATE_MODE_UNITS_PER_MIN;
|
||||
// gc_state.modal.cutter_comp = CUTTER_COMP_DISABLE; // Not supported.
|
||||
gc_state.modal.coord_select = 0; // G54
|
||||
gc_state.modal.spindle = SPINDLE_DISABLE;
|
||||
gc_state.modal.coolant = COOLANT_DISABLE;
|
||||
// gc_state.modal.override = OVERRIDE_DISABLE; // Not supported.
|
||||
|
||||
// Execute coordinate change and spindle/coolant stop.
|
||||
if (sys.state != STATE_CHECK_MODE) {
|
||||
if (!(settings_read_coord_data(gc_state.modal.coord_select,coordinate_data))) { FAIL(STATUS_SETTING_READ_FAIL); }
|
||||
memcpy(gc_state.coord_system,coordinate_data,sizeof(coordinate_data));
|
||||
spindle_stop();
|
||||
coolant_stop();
|
||||
}
|
||||
|
||||
report_feedback_message(MESSAGE_PROGRAM_END);
|
||||
}
|
||||
gc_state.modal.program_flow = PROGRAM_FLOW_RUNNING; // Reset program flow.
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user