Tweaks and minor bug fixes. Added purge buffer command.

- Added a purge buffer (and lock) command. This is an advanced option
to clear any queued blocks in the buffer in the event of system
position being lost or homed. These queued blocks will likely not move
correctly if not purged. In typical use, the purging command releases
the homing axes lock in case a user need to move the axes off their
hard limit switches, but position is not guaranteed. Homing is advised
immediately after.

- Created a system-wide sync current position function. Cleans up some
of the repetitive tasks in various places in the code that do the same
thing.

- Removed the clear all switches command '$S'. Not really needed and
helped clean up a sync call.

- Other minor tweaks. Readme updated slightly..
This commit is contained in:
Sonny Jeon
2012-11-04 08:44:54 -07:00
parent 4c711a4af7
commit 8c0106c247
12 changed files with 59 additions and 52 deletions

16
main.c
View File

@ -76,12 +76,14 @@ int main(void)
limits_init();
st_reset(); // Clear stepper subsystem variables.
// Set cleared gcode and planner positions to current system position, which is only
// cleared upon startup, not a reset/abort. If Grbl does not know or ensure its position,
// a feedback message will be sent back to the user to let them know.
gc_set_current_position(sys.position[X_AXIS],sys.position[Y_AXIS],sys.position[Z_AXIS]);
plan_set_current_position(sys.position[X_AXIS],sys.position[Y_AXIS],sys.position[Z_AXIS]);
// Sync cleared gcode and planner positions to current system position, which is only
// cleared upon startup, not a reset/abort. If Grbl does not know or can ensure its
// position, a feedback message will be sent back to the user to let them know. Also,
// if position is lost and homing is enabled, the axes motions will be locked, and
// user must either perform the homing cycle '$H' or purge the system locks '$P' to
// resume.
sys_sync_current_position();
// Reset system variables
sys.abort = false;
sys.execute = 0;
@ -91,7 +93,7 @@ int main(void)
sys.state = STATE_IDLE;
}
if (bit_istrue(settings.flags,BITFLAG_AUTO_START)) { sys.auto_start = true; }
// Execute user startup script
protocol_execute_startup();
}