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.
pull/1/head
Sonny Jeon 2015-09-24 11:35:27 -06:00
rodzic 965e337405
commit dade712f0e
4 zmienionych plików z 31 dodań i 13 usunięć

Wyświetl plik

@ -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.

Wyświetl plik

@ -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

Wyświetl plik

@ -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<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;
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); }
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.
// NOTE: If axis words are passed here, they are interpreted as an implicit motion mode.
break;

Wyświetl plik

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