Is there an easier (more resource friendly) way to verify that a move has been completed with the roboclaw? Currently, I issue the command, then loop continuously waiting for the buffer to decrease to 0. I could be doing other things while waiting for the command to complete. In this application it could be many seconds to minutes for a command to complete. The below works, but I could be interfacing the operator, controlling another motor, watching my EOT switches! etc.
I'm running motor 2 in this example. Motor 1 is a don't care.
Code:
TRAVERSELOOP
'READ BUFFER DEPTH
R1COMMAND = 47
HSEROUT [R1ADDRESS, R1COMMAND]
HSERIN [R1BUFFER1, R1BUFFER2, R1CRC]
PAUSE 1
'WAIT FOR MOTION COMMAND TO COMPLETE
IF R1BUFFER2 <> 0 THEN TRAVERSELOOP
My random thought for the day is some kind of state machine. I would still read the buffer depth, only, I would be reading it in the main program, not the subroutine. When it went to 0, i would return to the subroutine with the next stage of movement, based on what the previous movement was. This way everything else remains operational, but it's still just a buffer reading loop.