-
Notifications
You must be signed in to change notification settings - Fork 296
Job Exception Handling
DEV PAGE: This page is a discussion about implementation. This is not intended to be end-user data, and G2 may or may not implement what's discussed there.
Character | Operation | Description
------|------------|---------
! | Feedhold | Start a feedhold. Ignored if already in a feedhold
~ | End Feedhold | Resume from feedhold. Ignored if not in feedhold
% | Queue Flush | Flush remaining moves during feedhold. Ignored if not in feedhold
^d | Kill Job | Trigger ALARM to kill current job. Send {clear:n} to end ALARM
^x | Reset Board | Perform hardware reset to restart the board
-
Stop a Single Move - Feedhold + queue flush
!%
is used to terminate a single move in cases such as homing, probing, and some forms of jogging. A!%
will transition the system to a STOP. At this point the controlling program in the firmware, or on the host can perform the next action. -
Stop Multiple Moves - In some jogging implementations multiple moves may be queued up as part of a single jogging move. In this case a
!%
needs to take the system to a STOP, but not before draining all other moves that are queued before the%
. It is possible that the sender has filled the planner buffer, serial input RX buffer, USB internal buffers, and even host-based buffers for this single jog move. All these moves need to be flushed before transitioning to a STOP. -
Kill Job - Terminate the rest of the job and indicate that all new commands are to be ignored until some point defined by the host. This needs to be able to drain all queued buffers, potentially as far back as the host without having the tool do anything unpredictable (there could be multiple megabytes of data backed up on the host side). This is complicated by needing to work for both single endpoint and dual endpoints (separate control and data channels). Some cases:
-
Single USB endpoint - gcode commands and ! and % chars share the same channel. ! and % "jump the queue" once they are received by the board.
-
Dual USB endpoints - one channel is control (! and %), the other is data (gcode). We need to have some way of draining the queued buffers, potentially as far back as the host without having the tool do anything unpredictable. There could be multiple megabytes of data backed up on the host side.
-
For an SD-card data channel, the solution may be as easy as "close the file". In fact, that would be the behavior we should emulate with the dual-usb.
-
Reset System - Do a hard reset if the controller is unresponsive or has entered a SHUTDOWN state.
Additional considerations:
- The % character is commonly used at the beginning and end of a gcode file to delimit the file.
-
We do NOT plan on supporting running two Gcode files concatenated. Or, at least, we don't plan on adding any special handling for that case.
-
We don't need any special handling in these cases. M2 and M30 handle the "end-of-job" case, and should be used for that purpose.
-
The % character is used by some gcode generators (InkScape, for example) as a start-comment character.
-
Using % as a "buffer flush" doesn't make any sense without a ! "feed hold" proceeding it.
- % Handling [cases 1 and 2]: Implement the following behaviors
- Intercept % in the serial stream and act on it immediately
- If the system is in FEEDHOLD (or has one requested) this sets a flag to request queue flush
- If the system is in ALARM and has a single USB channel, transition to STOP (this is an auto-clear)
- Otherwise the % is ignored
- Replace the % with a ; in the serial stream. This allows the % to act as a start-comment character for Gcode comments (supporting the Inkscape comment case), and prevents a % comment from masquerading as an autoclear.
Note: There is no equivalent auto-clear for dual channel USB, which is expected to use a more integrated jogging mechanism (in development).
-
Control-d [case (3) - Kill Job]: Add a new control character end-of-transmission / control-d / ^d. This will set an ALARM state which stops motion and spindle, clears internal planner queues and rejects all queued and incoming commands until a {clear:n} (or $clear) is received. ^d is intercepted by the serial system and is NOT queued, so it is acted on immediately on receipt.
-
Control-x [case (4) - Kill Job]: Resets the board, exiting a SHUTDOWN state. A shutdown is unrecoverable and requires a reset.
The current V9 USB serial port implementation relies on the USB hardware's buffers, and only reads data from those buffers as the system can parse them. This doesn't allow for immediate-processing of special characters !%~
nor does it adhere to the byte-counting flow-control methods. Programs written to use the byte-counting of V8 and that only use a single channel will likely see a "lock up" where the single channel no longer responds to incoming data if only once channel is opened.
In order to solve this, we will add an additional serial buffer to the USB Serial on V9, mimicking the behavior of the V8.
Getting Started Pages
- Home
- What is g2core?
- Who uses g2core?
- Jerk-Controlled Motion
- Getting Started with g2core
- Connecting to g2core
- Configuring g2core
- Flashing g2core
- Troubleshooting
Reference Pages
- Gcodes
- Mcodes
- Text Mode
- JSON Communications
- GPIO Digital IO
- Alarms & Exceptions
- Power Management
- Coordinate Systems
- Status Reports
- Status Codes
- G2 Communications
- Tool Offsets and Selection
- Probing
- Feedhold, Resume, Job Kill
- Marlin Compatibility
- 9 Axis UVW Operation
- gQuintic Specs
Discussion Topics
- Roadmap
- GPIO for 1.X Releases
- Toolheads
- Raster Streaming Prototol
- g2core REST Interface
- Gcode Parsing
- G2 3DP Dialect
- Consensus Gcode
- Digital DRO
- Overview of Motion Processing
Developer Pages
- Development & Contribution
- Branching and Release - DRAFT
- Getting Started with g2core Development
- Project Structure & Motate
- Compiling G2
- OSX w/Xcode
- OSX/Linux Command Line
- Windows10 w/AtmelStudio7
- Debugging G2 on OSX
- Board and Machine Profiles
- Arduino Due Pinout
- Arduino DUE External Interfaces
- Diagnostics
- Debugging w/Motate Pins
- Development Troubleshooting
- g2core Communications
- Git Procedures
- Windows 10 / VMware 8 Issues
- Dual Endpoint USB Internals
- G2core License
- VSCode Setup
- Compatibility Axioms
- Wiki History