Issues sensor reading and wait for reply via USB
-
Can anyone tell me of a reasonable way to read from a sensor and get a reply back (programmatically) via USB? I have many commands queued up, and I have no way of knowing if the machine is ready to take my sensor reading (is in position). So, I need to issue the command, and once the queue of commands gets around to processing it, I need to get the sensor value.
-
@drivetrainsystems USB is a serial channel so there is always the problem that commands you send get delayed when the motion queue is full. We've considered adding a second CDC channel over the USB interface on Duet 3 boards to alleviate this, however very few people use USB to control 3D printers using Duet because network control is more convenient.
You can retrieve sensor status over USB using the M409 command to extract the status from the object model. The response includes the parameters of the query, so if more than one response is outstanding you can distinguish the responses.
-
@dc42 does the REST API not queue commands, but wait for a return value of sensor readings?
-
@drivetrainsystems when you refer to the REST API do you mean the network interface?
-
@dc42 I'm referring to DuetSoftwareFramework/REST-API, but I'm interested in any interface that will let me know when a given command is finished executing and/or let me find the result of a given command.
-
@drivetrainsystems if you are using a Single Board Computer attached to the Duet using SPI then you can read the object model from Duet Software Framework, either in a plugin or via the REST API.