[Feature Request] GCode to check if file exists
-
Would it be possible to add a new GCode that could simply check if file exists and return a boolean?
At the moment I'm using M36 for that. However, when performing a lot of M36s commands Duet starts to return something like this:
[object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object]
I'm guessing that it's just too much JSON data for Duet to handle so it returns the
[object Object]
-
@AndMaz I would have thought it would be better to sort out whatever the problem is with M36 rather than adding another specialised gcode command. Perhaps you could post an example program that generates the M36 error you are seeing along with details of the firmware setup you are using to run it.
-
@AndMaz Can't you use
echo fileexists("/sys/config.g")
? That just returnstrue
orfalse
, although it requires 3.5-b1 or later. -
@gloomyandy thank you for the reply.
I'm working on custom OTA update solution. After uploading all the files I want to validate that everything is where it should be. To avoid making more than 100 HTTP reqs, 1 per file, I have a
validate.g
that's basically just contains a lot ofM36 <file-path>
.So I just call
validate.g
and then collect the response from the/rr_reply
. Then the idea is to scan the contents and check if there's anything with err:1 message. If yes, then something bad happened.The problem that I'm facing is the following:
- If I make a requests to
/rr_reply
every 1 sec. I miss some results. I'm assuming that's because M36 response it too verbose so it fills Duet's/rr_reply
buffer - If I make requests to
/rr_reply
every 200 milisecs the HTTP server dies (sometimes) or returns[object Object]
I've tried different intervals to collect /rr_reply but so far no success. I also tried to modify the
validate.g
and to add G4 between M36 calls also without success. - If I make a requests to
-
@chrishamm Totally forgot about that one. Thank you. I'll give it a go
-
@chrishamm tested and it works great. Super fast when compared to M36. Thank you again for your help
-
-