Triffid_Hunter Wrote:
> Any suggestions or insights?
If you haven't done so already, I'd suggest searching the entire solution for Serial commands; I would suspect the code uses that class to perform all IO.
For my own rewrite, I plan on keeping things as simple as possible, discarding G code entirely; I want to make the required parse logic take as small as foot print as possible. I've listed a rough outline of the commands I plan on adding:
"R {control-ids} {cr}"
- abort any current action and activity; clear spline buffers, etc.
- reset and home controllers specified by {control-ids}.
- Each {control-id} will be alphanumeric. Up to 36 controllers supported by protocol.
- "R.{cr}" to acknowledge reset recieved and started.
- "R{control-id}.OK{cr}" as each control is homed and ready.
- could be used as an idle 'ping' test with "R{cr}", which should halt all activity and generate a simple "R.{cr}" response.
"S{sid} {steps} {control-id}{spline} {control-id}{spline} ...{cr}"
- add spline path to buffer for controllers specified by each {cid}.
- implicitly add controls not specified as constant based on their last known position.
- {sid} arbitrary; used only for host to identify spline as it completes (except for special "?" which is a query command).
- {steps} and {spline} use some encoding scheme. Planning some compression to reduce bandwidth and processing needs base 32 or base 64 encoding.
- begins executing as soon as all prior activity has completed.
- "S{sid}.{cr}" to acknowledge reciept and (possibly pending) execution.
- "S{sid}!{cr}" to acknowledge reciept and (possibly pending) execution, and buffer full; don't send any more splines until one completes.
- "S{sid}.OK{cr}" as each spline completes; new buffer space available for new spline .
"S? {cr}"
- query spline execution and buffer.
- "S.{current-step} {sid}{sid}{sid}{sid}{cr}" to indicate current spline execution status.
- {current-step} the step index for the spline currently being executed.
- {sid}... the current buffered splines, the first one the one currently being executed.
- "S.{cr}" if engine idling.
"V{cr}"
- respond with firmware version
- "V.{version} {human readable description}{cr}"
"C{control-id}{cr}"
- respond with control state for control {id}.
- "C{control-id}.{type}.{state}{cr}"
- {type} will be an alphanumeric code for stepper, pid driver, on/off, etc.
- {state} will specify current control state; current desired target and current reading, etc. Probably use base64 like encoding, as per all numbers.
At any time, the controller can send an error indication:
- "E{severity}.{id} {text}{cr}"
- {severity} 0 (minimal keep trucking if you want) to 9 (send the machine to the recycler.)
- {id} a firmware version specific code identifying the exact error.
- {text} a human readable string so they can more quickly figure out what went wrong via a timestamped log file.