Skip to content

more pf532 health statuses - #42

Merged
lastlink merged 7 commits into
mainfrom
f/power_mode_updates
Jun 14, 2026
Merged

lastlink merged 7 commits into
mainfrom
f/power_mode_updates

Conversation

@lastlink

Copy link
Copy Markdown
Collaborator

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:

  • Added new state variables and update functions in server/state.py to 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 new get_pn532_health() method to derive overall health from this pushed state. [1] [2]
  • Updated start.py to 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:

  • Extended the public health page (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]
  • Updated module exports and imports to make new state update and health retrieval functions available where needed. [1] [2] [3]

Testing:

  • Added a new TestPN532Health test class in test_health_server.py to 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.

@github-actions

github-actions Bot commented Jun 14, 2026

Copy link
Copy Markdown

Test Results

142 tests   142 ✅  19s ⏱️
 18 suites    0 💤
 18 files      0 ❌

Results for commit c16d8c3.

♻️ This comment has been updated with latest results.

@lastlink
lastlink merged commit 0bc4e79 into main Jun 14, 2026
5 checks passed
@lastlink
lastlink deleted the f/power_mode_updates branch June 14, 2026 11:53

This branch was previously deployed

1 inactive deployment
production c16d8c3f Deployed Jun 14, 2026 by lastlink via Deploy to production #32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant