Footer Status Code 40

From the original Synthetos forum (2011–2025)

Started by jpistorino on in TinyG Support. 3 replies, last activity Oct 1, 2014.

#

I am writing a JSON interface to the TinyG in C++.
In the response after trying to send a homing command, I am getting a status code of 40 and the command does not execute. This is not one of the status code documented at: https://github.com/synthetos/TinyG/wiki/TinyG-Status-Codes

Here is a little print out form my code (Sent and Received are mine).

Serial Port Opened.
Sent:{"sr":null}

Received:{"r":{"sr":{"line":0,"posx":0.000,"posy":0.000,"posz":0.000,"posa":0.000,"feed":0.00,"vel":0.00,"unit":1,"coor":1,"dist":0,"frmo":0,"momo":0,"stat":1},"f":[1,0,12,9195]}}
Sent:{"qv":null}

Received:{"r":{"qv":0,"f":[1,0,12,7578]}}
Sent:{"G28.2":"X0 Y0"}

Received:{"r":{"g28.2":"x0y0","f":[1,40,18,2000]}}

What is status code 40?

Thanks,
James

#

Hi,
try {"gc":"g28.2x0y0"}

You seem to be using a rather old firmware version like 380.x, where tinyg.h contained:
#define STAT_UNRECOGNIZED_COMMAND 40 // parser didn't recognize the command

Recent versions respond with status 100, which is:
#define STAT_UNRECOGNIZED_NAME 100 // parser didn't recognize the name

I recommend using the newest version, especially for a developer.

Staff #

chmr is correct, you should be developing on the edge branch at this point. But that won't solve your issue. A number of points:

- {“G28.2″:”X0 Y0″} is - indeed - an unrecognized command. Here is the correct way to send a Gcode command in JSON:
https://github.com/synthetos/TinyG/wiki/JSON-Details#gcode-in-json-mode

The command should be {"gc":"g28.2 x0 y0"} --- or some variant. Spaces and cases don't matter.

- You can also run the JSON in relaxed mode, in which case the command would be {gc:"g28.2 x0 y0"}.
See:
https://github.com/synthetos/TinyG/wiki/TinyG-Configuration-for-Firmware-Version-0.97#js---set-json-syntax

- Many UI's do not wrap the Gcode blocks, but just send them directly. This is OK, too. So this works as well:
g28.2 x0 y0

#

Thanks. That got it working.

It is generous to call me a "developer."
More like a guy that knows enough to be dangerous.

I am using the version that came on my TinyG v8 but I will switch over to the edge version.

Thanks again.

This topic is from the original forum (October 2014). Your reply starts a new discussion linked to it.

Reply

Different problem? Ask a new question

Back to TinyG Support or latest activity.