Closed kameyer226 closed 2 years ago
See branch called "timeout" for a possible code
aserial very specifically uses 0 timeout to avoid blocking
Can you give a specific reason why you need this functionality?
Motorized pumps seem to at very least temporarily halt serial communication when user pushes buttons on it, was looking to see if it was just temporary by adding a timeout. I can diagnose further.
timeout on aserial will not address that problem at all...
timeout on a serial object causes it to wait for incoming data, not pause if the data is there or on writes.
aserial does not have timeout so that time is not spent waiting, though it will continue to process if it is not immediately available.
In any case, not the solution to the problem you are trying to solve.
you can put waits between commands for the individual daemon.
For instance, this is what we do with newport:
we buffer all outgoing requests (actually across multiple daemons which share the serial interface)
and dispense them 1 by 1 with at least a 10 ms wait between each
It does look like that is the best thing to do, how many of our serial devices use the Dispatcher and Queues so far?
Its a pattern I've used on several occasions, can't quite recall how many, but generally those that use the same serial connection to connect to multiple daemons like newport or thorlabs.
It carries with it some complexities to do with timing and ensuring busy state does not toggle inappropriately, but once ironed out I tend to like it. (@untzag may disagree with me on that, though... it can take some ironing out)
I've thought about standardizing that in some way and bringing it either up into core or an optional dependency we control, but just hasn't been the priority
Looking into use of
timeout
kwarg at child level rather than parent level...doesaserial
timeout even work properly if we specified non-zero value?