I've used DSF-Python to create some custom-m-codes that have dynamic function (checking entries in a database and executing different movements based on them). This has been working well, except I've crashed the machine several times due to hitting pause/resume when the macros are in a larger gcode file. It's unclear at what point the machine is pausing, and often some moves (like a necessary clearance) are skipped during resume.
I've been using this code to run movements from within the InterceptConnection
loop:
cmd_conn.perform_simple_code(cmds, channel=CodeChannel.File)
Sometimes cmds is a single command, and sometimes a few commands separated by newline.
I'm also using this code to run macros:
(perform_simple_code('M98 P"/macros/test.g"', channel=CodeChannel.File)
The issue i'm experiencing with pauses might be coming from any of these three ways to execute codes, so I'm thinking it would be best to compartmentalize each set of commands into a dynamically written macro. Then I could implement the normal macro M98 R1/0
to achieve predictable pausing results. I'm wondering if this is the ideal way to go about this, or if anyone has any better ideas.
This brings me to my second question of writing macro files dynamically. I get a lot of errors when trying to write files in the /opt/dsf/sd/macros/
folder. In the past I made some chmod
changes which allowed me to read/write in those folders, but it filled DWC with red errors about incorrect permissions. I'm on a fresh install now and would rather not do that again.
I could make some post requests to upload/delete a macro but it seems simpler to just write the files with python if I can get the permissions right. What would be the recommended way of freeing up the permissions of those files and folders? Would it be best to create a DSF plugin instead?
Thanks,
T