plotink
plotink copied to clipboard
Make `ebb3_serial` more robust
In general the diff looks more dramatic than the changes really are, due to some refactoring I did early on to avoid making the same changes multiple times in different places. The vast majority of the time, no changes to behavior should be noted (other than some error messages being slightly modified).
Summary of changes:
- Retry sending certain commands/queries up to 3 times. Retries are only attempted if re-sending the command will not cause motor position errors (i.e., the EBB sent an error message indicating that the command/query was not understood OR plotink timed out waiting for a response from the EBB AND the command/query is idempotent).
- Add a counter for total number of retries in a plot. Not currently reported to the user anywhere.
- Previously the code assumed that serial.Serial.readline always returned a full line. This turns out to have been a faulty assumption, so I fixed that.
- Made the code more robust to getting out-of-sync with the EBB, by reading as much output from the EBB as is available (up to a maximum number of polls).
@oskay ready to merge