jes notes Index Gallery . 4th axis Anniversary Clocks Blog ideas Micro-machining CNC milling machine Paint colours CNC Router Shaft passers Snap issues Software ideas Stepper motor clock Toy ideas Watchmaking Wildflowers
2024-01-17
Last modified: 2024-01-17 20:58:55
< 2024-01-16 2024-01-19 >
G-code sender
Some more thoughts:
It would be good to have some indication of the length of the Grbl look-ahead planner buffer.
The code for streaming G-code should eventually use the "character-counting" technique, see https://github.com/gnea/grbl/blob/master/doc/markdown/interface.md
But also, when you pause a job, you need to know exactly what line it was working on when it stopped.
To start with we can just use "Simple Send-Response" of course.
Check whether the planner buffer, or the serial receive buffer, are longer in Grblhal. In fact can we query these
from the device itself?
Some Grblhal notes in https://github.com/grblHAL/core/wiki/For-sender-developers
There are a few caveats with the "character-counting" technique:
- you can't send anything while grbl is writing to the eeprom because the serial RX interrupt is disabled
- if there is an error on a line then grbl will report the error but then will continue trying to execute the rest of the lines
in the buffer
Auto-connect should be optional, in case you have other serial devices you don't want it talking to255
Even if you use "Simple Send-Response", is there a way to work out which lines have actually executed, rather
than just been put in the planning buffer? Is there even a way to work out how much is in the planning buffer?
Detecting Grbl:
- connect to the serial port, see if it replies with a welcome message
- if it sends a grbl welcome message, it's grbl
- if it sends an unidentified message, it's something else
- if it sends nothing, send a carriage return
- if it replies "ok", then send a "?"
- if it replies with a status report, then it's grbl, else it's some other serial device
OK, if you enable bit 2 in $10 then you get a field like Bf:15,128
, showing the available space in the
planner buffer and serial receive buffer. Obviously the first one we receive (before we send anything) tells us the total size.
You can find out if the probe pin is triggered because you'll get a Pn:P
in a status report.
There is an option to enable line number reporting in the status report, but it seems off by default.
Modes I'll want:
- startup: enable auto-connect, manual connect
- normal: cycle start, feed hold, stop job, open file, reload file, follow outline, disconnect, clear alarms, modify DRO
- file selector: up/down navigates file list, typing filters the filenames, enter selects
- MDI: MDI input is focused, up/down explores history, ^R searches history, enter submits, some sort of warning if you are typing in MDI while job is sending
- Jog: arrow keys jog X/Y, pgup/pgdn jogs Z, P toggles whether probe stops motion, F enters "feed select" mode, I enters "increment select" mode, shift makes it move at full rapid
- feed select: numeric input to set jog feed rate
- increment select: numeric input to set jog increment
- overrides: F to select feed override, R to select rapid override, S to select spindle override, up/down changes by 1%, shift makes it change by 10%
- console: show raw serial I/O
- gcode: show the gcode listing, which line we're working on, and let me "run from line"
I'll always want visible:
- machine state (status, DRO, computed DTG, computed Vel per axis, feed rate, spindle speed, alarms, probe state, active G/M codes, buffer sizes)
- MDI
- the most interesting key shortcuts that are currently active
In modes, I'll want to see:
- startup: status of auto-connect, input box for manual serial port selection
- normal: 2d plot of toolpath
- file selector: obviously a listing of files in the currently-active directory, probably sorted by most-recent first
- MDI: current intput, history of my inputs
- Jog: 2d plot of toolpath for reference, current jog feed rate & jog increment & status of "rapid jog" via shift key
- numeric input: what I'm setting, existing value, formula I'm typing, computed value
- overrides: the three options and current values for them
- console: live view of the active traffic
- gcode: show the gcode listing, scrollable, and let me edit it?
Almost everything should be doable with the mouse, by clicking on a button labelled with the keyboard key that actuates
it. Would be cool if pressing the keyboard key triggers the button click animation.
< 2024-01-16 2024-01-19 >