-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
feat: verify packet is not an older packet #112
Conversation
src/bthome_ble/parser.py
Outdated
elif ( | ||
last_packet_id is not None | ||
and new_packet_id <= last_packet_id | ||
and last_packet_id - new_packet_id < 128 | ||
): |
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.
I'd make this a named function to better show intent and document with a docstring its handling the packet id wrapping
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.
I also moved the logic for comparing packet time to make it clear what are the conditions for dropping a packet
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #112 +/- ##
==========================================
+ Coverage 80.92% 81.28% +0.36%
==========================================
Files 6 6
Lines 519 529 +10
Branches 79 82 +3
==========================================
+ Hits 420 430 +10
Misses 78 78
Partials 21 21 ☔ View full report in Codecov by Sentry. |
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.
Looks good to me, some small remarks. Thanks!
Co-authored-by: Ernst Klamer <[email protected]>
No description provided.