can I send multi-line gcode commands via API
See example:
G91
G0 X0.1
G90
M117 .1 mm Right
This my attempt so far. Single commands seem to work fine like this:
curl "http://len01.local:3344/printer/api/MPCNC?apikey=6bd3ec92-9acf-4cf4-b8b3-410f1ca6a298&a=send&data={"cmd":"G0 X10"}"
What am I missing?
G91
G0 X0.1
G90
M117 .1 mm Right
#!/bin/bash
FILE="$1"
PRE=$(urlencode "{\"cmd\":\"")
COMMANDS=$(urlencode $(cat $FILE))
POST=$(urlencode "\"}")
PAYLOAD="${PRE}${COMMANDS}${POST}"
echo "$PAYLOAD"
curl "http://len01.local:3344/printer/api/MPCNC?apikey=6bd3ec92-9acf-4cf4-b8b3-410f1ca6a298&a=send&data=${PAYLOAD}"
This my attempt so far. Single commands seem to work fine like this:
curl "http://len01.local:3344/printer/api/MPCNC?apikey=6bd3ec92-9acf-4cf4-b8b3-410f1ca6a298&a=send&data={"cmd":"G0 X10"}"
What am I missing?
Comments
cat jog+x.1.gcode
How does your payload look like? Newline is %0a urlencoded, so are they included or did the newlines get stripped in bash handling?