-
Notifications
You must be signed in to change notification settings - Fork 187
fix(api): Use the get_histogram retry mechanism instead of the AsyncResponseSerial one. #19679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(api): Use the get_histogram retry mechanism instead of the AsyncResponseSerial one. #19679
Conversation
…esponseSerial one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good but I think we can just not commit the serial connection changes if they don't alter behavior at all, makes the pr smaller. If they do change behavior, let's add tests before merging.
self, command: CommandBuilder, retries: int = 0, timeout: Optional[float] = None | ||
self, | ||
command: CommandBuilder, | ||
retries: Optional[int] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does retries needs to be optional if we are always setting it to 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Because we want to have a distinction between
None
,0
, and>0
values. - We also dont set the value to 0, when we use
retries or self._number_of_retries
, Whenretries
is "0" which is a falsy value, it will set the retries toself._number_of_retries
which in the case of the stacker is 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
Yeah, we need the serial connection changes so that "0" is a valid value. As it stands today, "0" is a falsy value, and when using "retries or self._number_of_retries" will always be false and set the value to |
Overview
The
GET_TOF_MEASUREMENT = "M226"
GCODE for the Flex Stacker has a built-in frame caching mechanism, so the host can request the current frame to be resent in case of a timeout, invalid packet, etc. By default, theM226
GCODE sends the next frame, unless we add theR
element when requesting the frame. Which means that if internally this packet is retried, then it will request the NEXT frame when we are expecting the previous. Since we have this built-in mechanism, let's disable retries when sending the "M226" GCODE in the_get_tof_histogram_frame
method and instead rely on the retry mechanism in theget_tof_histogram
method.Closes: RABR-834
Test Plan and Hands on Testing
R
element in case of timeout or parsing error.Changelog
AsyncSerialConnection.send_data
kwargretries
from int toOptional[int] = None
retries
is not None instead of theor
operator, so that0
is considered a valid value.retries=0
in the_get_tof_histogram_frame
function when sending the "M226" GCODEReview requests
Risk assessment