-
Notifications
You must be signed in to change notification settings - Fork 1
TinyG Status Reports
Status reports return the dynamic gcode model state so the UI can know what's happening in the machine. They can be automatically generated by the system and they can be requested directly.
The following variables can be reported in a status report
Request | Response | Description
---------|--------------|-------------
vel | velocity | actual velocity - may be different than programmed feed rate
line | line_number | either the Gcode line number (N word), or the auto-generated line count if N's are no present
feed | feed_rate | gcode programmed feed rate (F word)
stat | machine_state | 0=reset, 2=stop, 3=end, 4=run, 5=hold, 6=homing
unit | units_mode | 0=inch, 1=mm
coor | coordinate_system | 0=g53, 1=g54, 2=g55, 3=g56, 4=g57, 5=g58, 6=g59
momo | motion_mode | 0=traverse, 1=straight feed, 2=cw arc, 3=ccw arc
plan | plane_select | 0=XY plane, 1=XZ plane, 2=YZ plane
path | path_control_mode | 0=exact stop, 1=exact path, 2=continuous
dist | distance_mode | 0=absolute distance, 1=incremental distance
frmo | feed_rate_mode | 0=units-per-minute-mode, 1=inverse-time-mode
gc | gcode_block | gcode block currently being run
posx | x work position | X work position in prevailing units (mm or inch)
posy | y work position
posz | z work position
posa | a work position
posb | b work position
posc | c work position
mpox | x absolute position | X machine position in absolute coordinate system (mm or inch). Also Y,Z,A,B,C
g92x | g92x | G92 origin offset for X axis (also Y,Z,A,B,C)
Additionally, any valid token may be listed in a status report. For example, "g54x" will return the X offset in the G54 coordiante system (coordinate system #1). "fv" would return the firmware version.
are parent/child objects with a "sr" parent and one or more child NV pairs, as in the example below.
{"sr": {"line":1245, "xpos":23.4352, "ypos":-9.4386, "zpos":0.125, "vel":600, "unit":"1", "stat":"5"}"f":[1,0,19,2131]}}
The following use-cases are supported:
*SET status report fields. The elements to be included in a status reports may be specified by setting values to 'true'. The elements will be returned on subsequent SR requests in the order they were provided in the SET command. (I know, dictionaries are supposed to be unordered, but the firmware will record and return back the attributes in the order listed). There is no incremental setting of elements - all attributes are reset and must be specified in a single SET command. For example, the string below could be used to set up the status report in the example above, and eliminate any previously recorded settings. Note that the 'true' term is not in quotes - it is actually the JSON value for true, not a string that says "true". Examples:
{"sr":{"line":true,"xpos":true, "ypos":true,"zpos":true, "vel":true, "unit":true, "stat":true}}
{"status_report":{"line":true,"xpos":true, "ypos":true,"zpos":true, "vel":true, "unit":true, "stat":true}} - this is the same as the above but using the friendly name
*GET an on-demand status report - this will return a single status report. All forms below are equivalent. The first two use friendly names, the last two use mnemonic tokens.
{"status_report":""}
{"status_report":null} the 'null' value is used instead of "" in this case. Either are accepted.
{"sr":""}
{"sr":null}
*Request an ad-hoc report. An ad-hoc query for one or more name/value pairs can be performed. This is technically not a "status report", but it's useful. This is really just multiple GET requests in a single JSON object.
{"line":"","xpos":"","ypos":"","zpos":"","vel":"","unit":"","stat":""} request GETS for the listed values
{"line":1245, "xpos":23.4352, "ypos":-9.4386, "zpos":0.125, "vel":600, "unit":"mm", "stat":"run"} returns the NV pairs. Note the absence of the SR parent object.
*Automatic status reports. Status reports may also be automatically generated by setting the status report interval to a non-zero value. Reports will be generated during movement every N milliseconds, and at the end of each Gcode bloack that causes a movement, and when the machine has stopped (i.e. at the end of the final move in the buffer).
{"status_interval":0} disable automatic status reports
{"status_interval":200} request status reports every 200 ms during movement
{"si":200} same as above