Updated G28/G30 intermediate motion behavior.

- 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.
This commit is contained in:
Sonny Jeon 2015-09-24 11:35:27 -06:00
parent 965e337405
commit dade712f0e
4 changed files with 31 additions and 13 deletions

View File

@ -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. - 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. - A few bug fixes and lots of refactoring to make the code more efficient and flexible.

View File

@ -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 Date: 2015-08-29
Author: Sonny Jeon Author: Sonny Jeon

View File

@ -615,19 +615,26 @@ uint8_t gc_execute_line(char *line)
// Check remaining non-modal commands for errors. // Check remaining non-modal commands for errors.
switch (gc_block.non_modal_command) { switch (gc_block.non_modal_command) {
case NON_MODAL_GO_HOME_0: case NON_MODAL_GO_HOME_0: // G28
// [G28 Errors]: Cutter compensation is enabled. case NON_MODAL_GO_HOME_1: // G30
// Retreive G28 go-home position data (in machine coordinates) from EEPROM // [G28/30 Errors]: Cutter compensation is enabled.
if (!axis_words) { axis_command = AXIS_COMMAND_NONE; } // Set to none if no intermediate motion. // 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); } if (!settings_read_coord_data(SETTING_INDEX_G28,parameter_data)) { FAIL(STATUS_SETTING_READ_FAIL); }
break; } else { // == NON_MODAL_GO_HOME_1
case NON_MODAL_GO_HOME_1:
// [G30 Errors]: Cutter compensation is enabled.
// Retreive G30 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_G30,parameter_data)) { FAIL(STATUS_SETTING_READ_FAIL); } 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<N_AXIS; idx++) {
if (!(axis_words & (1<<idx))) { parameter_data[idx] = gc_state.position[idx]; }
}
} else {
axis_command = AXIS_COMMAND_NONE; // Set to none if no intermediate motion.
}
break; break;
case NON_MODAL_SET_HOME_0: case NON_MODAL_SET_HOME_1: case NON_MODAL_SET_HOME_0: // G28.1
case NON_MODAL_SET_HOME_1: // G30.1
// [G28.1/30.1 Errors]: Cutter compensation is enabled. // [G28.1/30.1 Errors]: Cutter compensation is enabled.
// NOTE: If axis words are passed here, they are interpreted as an implicit motion mode. // NOTE: If axis words are passed here, they are interpreted as an implicit motion mode.
break; break;

View File

@ -23,7 +23,7 @@
// Grbl versioning system // Grbl versioning system
#define GRBL_VERSION "1.0b" #define GRBL_VERSION "1.0b"
#define GRBL_VERSION_BUILD "20150902" #define GRBL_VERSION_BUILD "20150924"
// Define standard libraries used by Grbl. // Define standard libraries used by Grbl.
#include <avr/io.h> #include <avr/io.h>