Welcome to mirror list, hosted at ThFree Co, Russian Federation.

JSON responses.md - github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 28eb9caa2b5f8b32e2fed5e9b51808d35195255f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
# List of RepRapFirmware JSON Responses

This document describes the four big JSON responses which are used to report status and configuration details.
For a list of HTTP-related JSON responses, see [HTTP requests](HTTP%20requests.md).

In these responses the following conditions apply:

- Booleans represented as 0 (false) or 1 (true)
- Indices pointing to another resource *might* not be valid. This is due to possible limitations of the CAN expansion board management
- ADC readings are reported on a scale of 0 to 1000
- Lengths are reported in mm
- Speeds are reported in mm/s
- Times are reported in seconds
- Temperatures are reported in Celsius

## Standard Status Response (Type 1)

This status response contains various fields that are expected to change frequently. These values are also included in the type 2 and 3 status responses.

```
{
	"status": "O",
	"coords": {
		"axesHomed": [0, 0, 0],
		"wpl": 1,
		"xyz": [0.000, 0.000, 0.000],
		"machine": [0.000, 0.000, 0.000],
		"extr": []
	},
	"speeds": {
		"requested": 0.0,
		"top": 0.0
	},
	"currentTool": -1,
	"output": {
		"beepDuration": 1234,
		"beepFrequency": 4567,
		"message": "Test message",
		"msgBox": {
			"msg": "my message",
			"title": "optional title",
			"mode": 0,
			"seq": 5,
			"timeout": 10.0,
			"controls": 0
		}
	},
	"params": {
		"atxPower": -1,
		"fanPercent": [-100],
		"speedFactor": 100.0,
		"extrFactors": [],
		"babystep": 0.000,
		"seq": 1
	},
	"sensors": {
		"probeValue": 1000,
		"probeSecondary": 1000,
		"fanRPM": [-1]
	},
	"temps": {
		"bed": {
			"current": -273.1,
			"active": -273.1,
			"standby": -273.1,
			"state": 0,
			"heater": 0
		},
		"current": [-273.1],
		"state": [0],
		"tools": {
			"active": [],
			"standby": []
		},
		"extra": []
	},
	"time": 596.0,
	"scanner": {
		"status": "D",
		"progress": 0.0
	},
	"spindles": [],
	"laser": 0.0
}
```

### Machine Status

The `status` field provides a single character for the machine status. It may have one of the following values:

| Status character | Status |
| ---------------- | ------ |
| C | Reading configuration file |
| F | Flashing new firmware |
| H | Halted (after emergency stop) |
| O | Off (powered down, low input voltage) |
| D | Pausing print (decelerating) |
| R | Resuming print (after pause) |
| S | Print paused (stopped) |
| M | Simulating a (print) file |
| P | Printing |
| T | Changing tool |
| B | Busy (executing macro, moving) |

Values higher in the table also have a higher priority. So, for example, tool changes are not reported while a print is in progress.

### Coordinates

- `coords/wpl` (optional): Selected workplace (see G10 and G54 to G59.3). May not be present if the board does not support workplaces
- `cords/xyz`: User coordinates of the axes (i.e. with tool offsets applied)
- `coords/machine`: Mchine coordinate of the axes (i.e. without tool offsets applied)
- `coords/extr` Total amount of filament extruded per extruder drive (with extrusion factors applied). See also `extrRaw` in response type 3

### Output

RepRapFirmware may request output via the client application. Only if this is the case, the `output` field is present.

#### Beeps

If no PanelDue is attached, beeps (see M300) are reported via the `beepDuration` and `beepFrequency` fields.
These fields are not present if M300 was not used.

#### Output message

A user may want to output a generic message via M117. If this is the case, the message string is reported via the `message` field.

#### Message boxes

RepRapFirmware allows a user to use message boxes if required. These message boxes may be configured via M291/M292.
The corresponding values can be found in the optional `msgBox` field. See the documentation of M291 for further details.

- `msgBox/controls` is a bitmap of configured axis controls (X = 1, Y = 2, Z = 4 etc.)
- `msgBox/seq` is incremented whenever M291 is used
- `msgBox/timeout` is the time left for displaying this message box or 0.0 if it does not time out

### Temperatures

Slow heaters like `temps/bed`, `temps/chamber`, and `temps/cabinet` (second chamber) have the following properties:

- `current`: Current heater temperature
- `active`: Target temperature when turned on (in active state)
- `standby`: Target temperature when in standby mode
- `state`: State of the heater. See below
- `heater`: Index of the assigned heater

The fields `temps/bed`, `temps/chamber`, and `temps/cabinet` may not be present if no bed and/or chamber is configured.

- `temps/current`: Array of heater temperatures
- `temps/state`: Array of heater states
- `temps/tools/active`: Array holding arrays of configured active heater temperatures. Tools may have multiple heaters assigned
- `temps/tools/standby`: Array holding arrays of configured standby heater temperatures

#### Heater states

| Heater state | Meaning | Description |
| ------------ | ------- | ----------- |
| 0 | off | Heater is turned off |
| 1 | standby | Heater is in standby mode |
| 2 | active | Heater is active |
| 3 | fault | Heater fault occurred |
| 4 | tuning | Heater is being tuned |
| 5 | offline | Remote heater from an expansion board is not available |

#### Extra heaters

Extra heaters represent custom sensor and can be found in `temps/tools/extra`. Every extra heater is reported in the following format:

```
{
	"name": "MCU",
	"temp": 34.7
}
```

### Scanner

RepRapFirmware may support an external interface for 3D scanners. This field is not be present if scanner support is not enabled in the firmware,
hence this field may not be present either. There are two fields for this interface in the status response:

- `status`: Status of the external 3D scanner. See below
- `progress`: Progress of the current operation (0.0 to 100.0)

Possible scanner states:

| Status character | State |
| ---------------- | ----- |
| D | Disconnected |
| I | Idle |
| S | Scanning |
| P | Post processing |
| C | Calibrating |
| U | Uploading |

### Spindles

The `spindles` field may be only present if the machine is in `CNC` mode or if the advanced status respone (type 2) is queried.

It provides a list of configured spindles in the format

```
{
	"current": 0.0,
	"active": 0.0,
	"tool": 0
}
```

where `current` is the current RPM, `active` the target RPM, and `tool` the number of the assigned tool.

### Other fields

- `speeds/requested`: Requested feedrate of the current move
- `speeds/top`: Top feedrate of the current move
- `currentTool`: Selected tool number (not index) or -1 if none is selected
- `params/atxPower`: ATX power state. This may be -1 if ATX power is not configured
- `params/fanPercent`: Fan percent (0.0 to 100.0). If the fan is disabled, this may be negative (-1)
- `params/speedFactor`: Speed factor override. 100% equals 100.0 and this is always greater than 0.0
- `params/extrFactors`: Extrusion factor override values. Values of 100% equals 100.0 and they are always greater than 0.0
- `params/babystep`: Z babystepping amount
- `sensors/probeValue`: ADC reading of the Z probe
- `sensors/probeSecondary` (optional): Seconday probe ADC reading if the probe is modulated. This field is not present if the probe is unmodulated
- `sensors/fanRPM`: Array of fan RPMs, values may be negative if not configured
- `time`: Time in seconds since the machine started. May be used to detect firmware resets
- `laser` (optional): PWM value of the attached laser. This field is only present if the machine is in `Laser` mode

## Advanced Status Response (Type 2)

This status response type provides fields that may change but not as frequently as those in the standard status response.

```
{
	"params": {
		"fanNames": [""],
	},
	"temps": {
		"names": [""}
	},
	...
	"coldExtrudeTemp": 160.0,
	"coldRetractTemp": 90.0,
	"compensation": "None",
	"controllableFans": 0,
	"tempLimit": 290.0,
	"endstops": 0,
	"firmwareName": "RepRapFirmware for Duet 3 v0.6",
	"firmwareVersion": "3.0beta12+1",
	"geometry": "cartesian",
	"axes": 3,
	"totalAxes": 3,
	"axisNames": "XYZ",
	"volumes": 1,
	"mountedVolumes": 0,
	"mode": "FFF",
	"name": "duet3",
	"probe": {
		"threshold": 500,
		"height": 0.70,
		"type": 0
	},
	"tools": [],
	"mcutemp": {
		"min": 24.0,
		"cur": 37.4,
		"max": 37.6
	},
	"vin": {
		"min": 0.2,
		"cur": 0.3,
		"max": 0.3
	},
	"v12": {
		"min": 0.2,
		"cur": 0.2,
		"max": 0.2
	}
}
```

### Geometry

The current geometry is reported as part of the `geometry` field. The following geometries are supported:

| Value | Geometry |
| ----- | -------- |
| cartesian | Cartesian |
| coreXY | CoreXY |
| coreXYU | CoreXYU |
| coreXYUV | CoreXYUV |
| coreXZ | CoreXZ |
| markForged | markForged |
| Hangprinter | Hangprinter |
| delta | Linear delta |
| Polar | Polar |
| Rotary delta | Rotary delta |
| Scara | Scara |

If the geometry is unknown, `unknown` is reported.

### Machine mode

It is possible to choose between `FFF`, `CNC`, and `Laser` mode. As a consequence, the following values are reported as part of the `mode` field:

| Value | Mode |
| ----- | ---- |
| FFF | 3D printing mode |
| CNC | CNC mode |
| Laser | Laser cutting/engraving mode |


### Probe

The `probe` field may not be present if no Z probe is configured. If it is, it provides the following fields:

- `probe/threshold`: Threshold value for the Z probe to be triggered
- `probe/height`: Z height of the Z probe when triggered
- `probe/type`: Probe type. See below

Possible probe types are:

| Probe type | Name |
| ---------- | ---- |
| 0 | No probe |
| 1 | Simple analog probe |
| 2 | Dumb modulated probe |
| 3 | Alternate analog probe |
| 4 | E0 switch **deprecated** |
| 5 | Digital probe |
| 6 | E1 switch **deprecated** |
| 7 | Z switch **deprecated** |
| 8 | Unfiltered digital probe |
| 9 | BLTouch |
| 10 | Z motor stall detection |

### Tool mapping

In order to figure out the mapping between heaters and tools, the tool mapping is reported as part of the advanced status response.
The tool mapping is reported as an array of items like

```
{
	"number": 0,
	"name": "",
	"heaters": [],
	"drives": [],
	"axisMap": [[0],[1]],
	"fans": 1,
	"filament": "PLA",
	"offsets": [0.00, 0.00, 0.00]
}
```

where

- `number`: Tool number (T*n*)
- `name`: Optional tool name or `""` if none is configured
- `heaters`: List of assigned heater indices
- `drives`: List of assigned drives
- `axisMap`: XY axis mapping. Mapped X axes are reported in the first item and mapped Y axes in the second one
- `fans`: Bitmap of the mapped tool fans (controllable by `M106` without `P` parameter)
- `filament` (optional): Name of the loaded filament
- `offsets`: Tool offsets. The size of this array equals the number of visible axes

### Other fields

- `params/fanNames`: Array of custom fan names. Every fan name defaults to `""` if no custom name has been configured
- `temps/names`: Custom names of the heaters. This is `""` for every heater that does not have a custom name
- `coldExtrudeTemp`: Minimum temperature for extrusions
- `coldRetractTemp`: Minimum temperature for retractions
- `compensation`: Current type of bed compensation. May be either `Mesh`, `n Point` (where n is the number of probe points), or `None`
- `controllableFans`: Bitmap of fans that are user-controllable. This excludes thermostatic fans
- `tempLimit`: Maximum allowed heater temperature of the heater protection items. This is used for scaling the temperature chart on the web interface
- `endstops`: Bitmap of currently triggered axis endstops
- `firmwareName`: Name of the firmware **deprecated - see config response**
- `firmwareVersion`: Version of the firmware **deprecated - see config response**
- `axes`: Number of visible axes
- `totalAxes`: Number of total axes
- `axisNames`: Letters of the visible axes
- `volumes`: Total number of supported volumes
- `mountedVolumes`: Bitmap of mounted volumes (1 = drive 0, 2 = drive 2, ...)
- `name`: Hostname of the machine
- `mcutemp` (optional): Minimum, current, and maximum MCU temperatures
- `vin` (optional): Minimum, current, and maximum input voltage
- `v12` (optional): Minimum, current, and maximum voltage on the 12V rail

## Print Status Response (Type 3)

This status response type provides extra details about the file being processed. The format is

```
{
	...
	"currentLayer": 0,
	"currentLayerTime": 0.0,
	"extrRaw": [],
	"fractionPrinted": 0.0,
	"filePosition": 0,
	"firstLayerDuration": 0.0,
	"firstLayerHeight": 0.00,
	"printDuration": 0.0,
	"warmUpDuration": 0.0,
	"timesLeft": {
		"file": 0.0,
		"filament": 0.0,
		"layer": 0.0
	}
}
```

where the fields are:

- `currentLayer`: Number of the current layer being printed
- `currentLayerTime`: Time of the current layer
- `extrRaw`: Total amount of extruded filament without extrusion multipliers applied. This is useful to estimate the print progress
- `fractionPrinted`: Fraction of the file printed on a scale of 0.0 to 100.0. This equals `filePosition / fileSize`
- `filePosition`: Byte position of the file being printed
- `firstLayerDuration`: Duration of the first layer or 0.0 if unknown
- `firstLayerHeight`: Height of the first layer
- `printDuration`: Total print duration (excluding pause times) 
- `warmUpDuration`: Time needed to warm up the heaters
- `timesLeft/file`: Estimation for the time left based on the file consumption
- `timesLeft/filament`: Estimation for the time left based on the filament consumption
- `timesLeft/layer`: Estimation for the time left based on the layer times

## Configuration response

In addition to the responses above, the config response provides values that are not expected to change unless the machine is reconfigured.
Note that a user may choose to reconfigure the machine at any time. The config response comes in the following format:

```
{
	"axisMins": [0.0, 0.0, 0.0],
	"axisMaxes": [220.0, 200.0, 180.0],
	"accelerations": [1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0],
	"currents": [800.0, 1000.0, 800.0, 1000.0, 800.0, 800.0, 8000, 800.0],
	"firmwareElectronics": "Duet 3 MB6HC",
	"firmwareName": "RepRapFirmware",
	"boardName": "MB6HC",
	"firmwareVersion": "3.0beta12+1",
	"dwsVersion": "1.24",
	"firmwareDate": "2019-11-05b1",
	"idleCurrentFactor": 35.0,
	"idleTimeout": 30.0,
	"minFeedrates": [10.0, 10.0, 0.5, 0.33, 0.33, 0.33, 0.33, 0.33],
	"maxFeedrates": [250.0, 250.0, 3.0, 60.0, 60.0, 60.0, 60.0, 60.0]
}
```

The following fields are reported:

- `axisMins`: Minima of the visible axes
- `axisMaxes`: Maxima of the visible axes
- `accelerations`: Accelerations of the drives
- `currents`: Configured motor currents
- `firmwareElectronics`: Name of the firmware electronics
- `firmwareName`: Name of the firmware (usually RepRapFirmware)
- `boardName` (optional): Short name of the board, only applicable for Duet 3. May be `MB6HC` for Duet v0.6 or `MBP05` for the Duet v0.5 prototype
- `firmwareVersion`: Version string of the firmware
- `dwsVersion` (optional): Version of the DuetWiFiSocketServer (only Duet WiFi)
- `firmwareDate`: Indicates when the firmware was built
- `idleCurrentFactor`: Motor currents are reduced by this factor when the motors are idle
- `idleTimeout`: Motor current reduction is performed after this time in seconds
- `minFeedrates`: Minimum feedrates of the drives
- `maxFeedrates`: Maximum feedrates of the drives