Extended position reporting with both home and work coordinates. Home position now retained after reset. Other minor changes/fixes.
- Grbl now tracks both home and work (G92) coordinate systems and does live updates when G92 is called. - Rudimentary home and work position status reporting. Works but still under major construction. - Updated the main streaming script. Has a disabled periodic timer for querying status reports, disabled only because the Python timer doesn't consistently restart after the script exits. Add here only for user testing. - Fixed a bug to prevent an endless serial_write loop during status reports. - Refactored the planner variables to make it more clear what they are and make it easier for clear them.
This commit is contained in:
16
main.c
16
main.c
@ -43,6 +43,7 @@ int main(void)
|
||||
serial_init(BAUD_RATE); // Setup serial baud rate and interrupts
|
||||
st_init(); // Setup stepper pins and interrupt timers
|
||||
|
||||
memset(&sys, 0, sizeof(sys)); // Clear all system variables
|
||||
sys.abort = true; // Set abort to complete initialization
|
||||
|
||||
while(1) {
|
||||
@ -51,10 +52,21 @@ int main(void)
|
||||
// Once here, it is safe to re-initialize the system. At startup, the system will automatically
|
||||
// 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.
|
||||
int32_t last_position[3];
|
||||
memcpy(last_position, sys.position, sizeof(sys.position)); // last_position[] = sys.position[]
|
||||
|
||||
// Clear all system variables
|
||||
memset(&sys, 0, sizeof(sys));
|
||||
|
||||
|
||||
// Update last known machine position. Set the post-abort work position as the origin [0,0,0],
|
||||
// which corresponds to the g-code parser and planner positions after re-initialization.
|
||||
memcpy(sys.position, last_position, sizeof(last_position)); // sys.position[] = last_position[]
|
||||
memcpy(sys.coord_offset, last_position, sizeof(last_position)); // sys.coord_offset[] = last_position[]
|
||||
|
||||
// Reset system.
|
||||
serial_reset_read_buffer(); // Clear serial read buffer
|
||||
settings_init(); // Load grbl settings from EEPROM
|
||||
|
Reference in New Issue
Block a user