more pf532 health statuses - #42
Merged
Merged
Conversation
Test Results142 tests 142 ✅ 19s ⏱️ Results for commit c16d8c3. ♻️ This comment has been updated with latest results. |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds a comprehensive, non-blocking health reporting system for the PN532 RFID reader, allowing the health endpoint to report detailed status without ever touching the I2C bus. The changes introduce new state tracking, update logic in the initialization and read loop, extend the public health page, and add thorough tests to ensure correctness.
PN532 Health State Tracking and Reporting:
server/state.pyto track firmware version, SAM configuration, last poll time, hardware presence, and IRQ status, all set from the init probe and read loop, never by live I2C reads. Also added a newget_pn532_health()method to derive overall health from this pushed state. [1] [2]start.pyto push PN532 health state during initialization (_init_pn532) and on every successful poll in the RFID read loop, ensuring the health page reflects real-time status without bus contention. [1] [2]Health Page and API Improvements:
routes_public.py) to display a detailed PN532 health table, including firmware, SAM config, read-loop status, and IRQ state, with color-coded results. Added a helper function to render these rows. [1] [2] [3]Testing:
TestPN532Healthtest class intest_health_server.pyto verify all combinations of health state, including healthy, degraded, unavailable, stale poll, and IRQ wiring scenarios.These changes ensure the PN532 health endpoint is fast, reliable, and never blocks on hardware, greatly improving observability and robustness.