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:
16
main.c
16
main.c
@ -53,15 +53,17 @@ int main(void)
|
||||
// reset to finish the initialization process.
|
||||
if (sys.abort) {
|
||||
|
||||
// Retain last known machine position. If the system abort occurred while in motion, machine
|
||||
// position is not guaranteed, since a hard stop can cause the steppers to lose steps. Always
|
||||
// perform a feedhold before an abort, if maintaining accurate machine position is required.
|
||||
// Retain last known machine position and work coordinate offset(s). If the system abort
|
||||
// occurred while in motion, machine position is not guaranteed, since a hard stop can cause
|
||||
// the steppers to lose steps. Always perform a feedhold before an abort, if maintaining
|
||||
// accurate machine position is required.
|
||||
// TODO: Report last position and coordinate offset to users to help relocate origins. Future
|
||||
// releases will auto-reset the machine position back to [0,0,0] if an abort is used while
|
||||
// grbl is moving the machine.
|
||||
int32_t last_position[3]; // last_coord_offset[3];
|
||||
int32_t last_position[3];
|
||||
double last_coord_system[N_COORDINATE_SYSTEM][3];
|
||||
memcpy(last_position, sys.position, sizeof(sys.position)); // last_position[] = sys.position[]
|
||||
// memcpy(last_coord_offset, sys.coord_offset, sizeof(sys.coord_offset)); // last_coord_offset[] = sys.coord_offset[]
|
||||
memcpy(last_coord_system, sys.coord_system, sizeof(sys.coord_system)); // last_coord_system[] = sys.coord_system[]
|
||||
|
||||
// Reset system.
|
||||
memset(&sys, 0, sizeof(sys)); // Clear all system variables
|
||||
@ -74,8 +76,9 @@ int main(void)
|
||||
limits_init();
|
||||
st_reset(); // Clear stepper subsystem variables.
|
||||
|
||||
// Reload last known machine position. Coordinate offsets are reset per NIST RS274-NGC protocol.
|
||||
// Reload last known machine position and work systems. G92 coordinate offsets are reset.
|
||||
memcpy(sys.position, last_position, sizeof(last_position)); // sys.position[] = last_position[]
|
||||
memcpy(sys.coord_system, last_coord_system, sizeof(last_coord_system)); // sys.coord_system[] = last_coord_system[]
|
||||
gc_set_current_position(last_position[X_AXIS],last_position[Y_AXIS],last_position[Z_AXIS]);
|
||||
plan_set_current_position(last_position[X_AXIS],last_position[Y_AXIS],last_position[Z_AXIS]);
|
||||
|
||||
@ -85,6 +88,7 @@ int main(void)
|
||||
#ifdef CYCLE_AUTO_START
|
||||
sys.auto_start = true;
|
||||
#endif
|
||||
// TODO: Install G20/G21 unit default into settings and load appropriate settings.
|
||||
}
|
||||
|
||||
protocol_execute_runtime();
|
||||
|
Reference in New Issue
Block a user