From 965e337405b58e1fd7248b8f7a84d4cf570686dd Mon Sep 17 00:00:00 2001 From: Sonny Jeon Date: Sat, 5 Sep 2015 13:34:40 -0600 Subject: [PATCH] Parking motion bug fix. - Parking motion would intermittently complete the queued tool path upon resuming in certain scenarios. Now fixed. --- doc/log/commit_log_v0.9i.txt | 9 ++++++ grbl/gcode.c | 62 ++++++++++++++++++------------------ grbl/grbl.h | 2 +- grbl/limits.c | 62 ++++++++++++++++++------------------ grbl/stepper.c | 20 +++++++----- 5 files changed, 84 insertions(+), 71 deletions(-) diff --git a/doc/log/commit_log_v0.9i.txt b/doc/log/commit_log_v0.9i.txt index db96690..92d2e8e 100644 --- a/doc/log/commit_log_v0.9i.txt +++ b/doc/log/commit_log_v0.9i.txt @@ -1,3 +1,12 @@ +---------------- +Date: 2015-08-29 +Author: Sonny Jeon +Subject: Optional line number reporting bug fix. + +- Fixed a bug where it would not compile when USE_LINE_NUMBERS was +enabled. + + ---------------- Date: 2015-08-27 Author: Sonny Jeon diff --git a/grbl/gcode.c b/grbl/gcode.c index c47808e..7507f4b 100644 --- a/grbl/gcode.c +++ b/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. } diff --git a/grbl/grbl.h b/grbl/grbl.h index 5d86de2..ac5f894 100644 --- a/grbl/grbl.h +++ b/grbl/grbl.h @@ -23,7 +23,7 @@ // Grbl versioning system #define GRBL_VERSION "1.0b" -#define GRBL_VERSION_BUILD "20150829" +#define GRBL_VERSION_BUILD "20150902" // Define standard libraries used by Grbl. #include diff --git a/grbl/limits.c b/grbl/limits.c index 8991ec5..b061a53 100644 --- a/grbl/limits.c +++ b/grbl/limits.c @@ -72,10 +72,10 @@ uint8_t limits_get_state() uint8_t pin = (LIMIT_PIN & LIMIT_MASK); if (bit_isfalse(settings.flags,BITFLAG_INVERT_LIMIT_PINS)) { pin ^= LIMIT_MASK; } if (pin) { - uint8_t idx; - for (idx=0; idxmillimeters; prep.req_mm_increment = REQ_MM_INCREMENT_SCALAR/prep.step_per_mm; prep.dt_remainder = 0.0; // Reset for new segment block - + if (sys.step_control & STEP_CONTROL_EXECUTE_HOLD) { // New block loaded mid-hold. Override planner block entry speed to enforce deceleration. prep.current_speed = prep.exit_speed; @@ -648,7 +652,7 @@ void st_prep_buffer() prep.current_speed = sqrt(pl_block->entry_speed_sqr); } } - + /* --------------------------------------------------------------------------------- Compute the velocity profile of a new planner block based on its entry and exit speeds, or recompute the profile of a partially-completed planner block if the