> When I run nozzle unload in Openpnp, the script executes before the nozzle reaches the nozzle changer. I'm sure this has something to do with gcodeAsyncDriver.
This is exactly right.
openpnp and your machine run asynchronously. openpnp races ahead,
planning and executing the next steps of the process, and openpnp only
stops to wait for the machine to catch up when it needs an input from
the machine, for example a camera image for a vision check.
> But I have no idea how to fix this. M400 doesn't help. I've attached the logs.
Thats close, but you need to use a higher level API for "machine
coordination". In this case I think WaitForStandstill coordination
will do what you want.
https://github.com/openpnp/openpnp/wiki/Motion-Planner#custom-scripts
Alternatively there might be a duet-specific solution. I dont know
what your M42 command is doing. But there may be an alternative which
allows the duet to manage the synchronisation here. Hopefully some
duet users can help out.