From dade712f0e5eaa15f3703aa58bea3dc3a64056fd Mon Sep 17 00:00:00 2001 From: Sonny Jeon Date: Thu, 24 Sep 2015 11:35:27 -0600 Subject: [PATCH] Updated G28/G30 intermediate motion behavior. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - G28 and G30’s behavior has been updated from the old NIST g-code standard to LinuxCNC’s. Previously when an intermediate motion was programmed, the NIST standard would move all axes to the final G28/30 stored coordinates. LinuxCNC states it only moves the axes specified in the command. For example, suppose G28’s stored position is (x,y,z) = (1,2,3) for simplicity, and we want to do an automated z-axis tool retraction and then park at the x,y location. `G28 G91 Z5` will first move the Z axis 5mm(or inches) up, then move Z to position 3 in machine coordinates. Next, the command `G28 G91 X0 Y0` would skip the intermediate move since distance is zero, but then move only the x and y axes to machine coordinates 1 and 2, respectively. The z-axis wouldn’t move in this case, since it wasn’t specified. This change is intended to make Grbl more LinuxCNC compatible while making commands, like the shown tool retraction, much easier to implement. --- README.md | 2 ++ doc/log/commit_log_v0.9i.txt | 9 +++++++++ grbl/gcode.c | 31 +++++++++++++++++++------------ grbl/grbl.h | 2 +- 4 files changed, 31 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 2db84de..1cc8055 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,8 @@ Grbl includes full acceleration management with look ahead. That means the contr - New '$' Grbl settings for max and min spindle rpm. Allows for tweaking the PWM output to more closely match true spindle rpm. When max rpm is set to zero or less than min rpm, the PWM pin D11 will act like a simple enable on/off output. +- Updated G28 and G30 behavior from NIST to LinuxCNC g-code description. In short, if a intermediate motion is specified, only the axes specified will move to the stored coordinates, not all axes as before. + - A few bug fixes and lots of refactoring to make the code more efficient and flexible. diff --git a/doc/log/commit_log_v0.9i.txt b/doc/log/commit_log_v0.9i.txt index 92d2e8e..548e29e 100644 --- a/doc/log/commit_log_v0.9i.txt +++ b/doc/log/commit_log_v0.9i.txt @@ -1,3 +1,12 @@ +---------------- +Date: 2015-09-05 +Author: Sonny Jeon +Subject: Parking motion bug fix. + +- Parking motion would intermittently complete the queued tool path +upon resuming in certain scenarios. Now fixed. + + ---------------- Date: 2015-08-29 Author: Sonny Jeon diff --git a/grbl/gcode.c b/grbl/gcode.c index 7507f4b..270f813 100644 --- a/grbl/gcode.c +++ b/grbl/gcode.c @@ -615,19 +615,26 @@ uint8_t gc_execute_line(char *line) // Check remaining non-modal commands for errors. switch (gc_block.non_modal_command) { - case NON_MODAL_GO_HOME_0: - // [G28 Errors]: Cutter compensation is enabled. - // Retreive G28 go-home position data (in machine coordinates) from EEPROM - if (!axis_words) { axis_command = AXIS_COMMAND_NONE; } // Set to none if no intermediate motion. - if (!settings_read_coord_data(SETTING_INDEX_G28,parameter_data)) { FAIL(STATUS_SETTING_READ_FAIL); } + case NON_MODAL_GO_HOME_0: // G28 + case NON_MODAL_GO_HOME_1: // G30 + // [G28/30 Errors]: Cutter compensation is enabled. + // Retreive G28/30 go-home position data (in machine coordinates) from EEPROM + if (gc_block.non_modal_command == NON_MODAL_GO_HOME_0) { + if (!settings_read_coord_data(SETTING_INDEX_G28,parameter_data)) { FAIL(STATUS_SETTING_READ_FAIL); } + } else { // == NON_MODAL_GO_HOME_1 + if (!settings_read_coord_data(SETTING_INDEX_G30,parameter_data)) { FAIL(STATUS_SETTING_READ_FAIL); } + } + if (axis_words) { + // Move only the axes specified in secondary move. + for (idx=0; idx