G54 work coordinate support (w/ G10,G92.1). Re-factored g-code parser with error checking. Minor compiler compatibility changes.

- G54 work coordinate system support. Up to 6 work coordinate systems
(G54-G59) available as a compile-time option.

- G10 command added to set work coordinate offsets from machine
position.

- G92/G92.1 position offsets and cancellation support. Properly follows
NIST standard rules with other systems.

- G53 absolute override now works correctly with new coordinate systems.

- Revamped g-code parser with robust error checking. Providing user
feedback with bad commands. Follows NIST standards.

- Planner module slightly changed to only expected position movements
in terms of machine coordinates only. This was to simplify coordinate
system handling, which is done solely by the g-code parser.

- Upon grbl system abort, machine position and work positions are
retained, while G92 offsets are reset per NIST standards.

- Compiler compatibility update for _delay_us().

- Updated README.
This commit is contained in:
Sonny Jeon
2012-02-11 11:59:35 -07:00
parent b51e902530
commit 567fbf93ed
15 changed files with 351 additions and 180 deletions

View File

@ -21,6 +21,7 @@
#ifndef nuts_bolts_h
#define nuts_bolts_h
#include <config.h>
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
@ -70,8 +71,13 @@ typedef struct {
int32_t position[3]; // Real-time machine (aka home) position vector in steps.
// NOTE: This may need to be a volatile variable, if problems arise.
int32_t coord_offset[3]; // Retains the G92 coordinate offset (work coordinates) relative to
// machine zero in steps.
uint8_t coord_select; // Active work coordinate system number. Default: 0=G54.
double coord_system[N_COORDINATE_SYSTEM][3]; // Work coordinate systems (G54+). Stores offset from
// absolute machine position in mm.
// Rows: Work system number (0=G54,1=G55,...5=G59), Columns: XYZ Offsets
double coord_offset[3]; // Retains the G92 coordinate offset (work coordinates) relative to
// machine zero in mm.
volatile uint8_t cycle_start; // Cycle start flag. Set by stepper subsystem or main program.
volatile uint8_t execute; // Global system runtime executor bitflag variable. See EXEC bitmasks.
@ -86,4 +92,7 @@ int read_double(char *line, uint8_t *char_counter, double *double_ptr);
// Delays variable-defined milliseconds. Compiler compatibility fix for _delay_ms().
void delay_ms(uint16_t ms);
// Delays variable-defined microseconds. Compiler compatibility fix for _delay_us().
void delay_us(uint16_t us);
#endif