Skip to content

Handle unavailable touch and IMU hardware - #18

Merged
PurpleSentinel merged 1 commit into
v3from
feature/issue-11-safe-peripheral-init
Aug 9, 2026
Merged

Handle unavailable touch and IMU hardware#18
PurpleSentinel merged 1 commit into
v3from
feature/issue-11-safe-peripheral-init

Conversation

@PurpleSentinel

Copy link
Copy Markdown
Contributor

Summary

  • classify peripheral I2C failures and unexpected chip identities
  • retry transient touchscreen initialization failures before a controlled, actionable stop
  • initialize the QMI8658 only when Launch Mode needs it and fall back to normal timing when it is unavailable
  • handle launch-time IMU read failures without crashing
  • document the peripheral failure policy and deployment requirements

Root cause

The QMI8658 driver returned an undefined NULL value for an unexpected chip ID, the touch driver could return a partially initialized object, and startup constructed the IMU even when Launch Mode was disabled. Missing or incompatible hardware could therefore produce undefined-name errors or later crashes.

Impact

The required touchscreen now either initializes completely or stops safely after bounded retries. The optional IMU can fail without preventing standard swipe-down timing, while serial and on-screen messages explain the hardware problem.

Validation

  • python -m unittest discover -s tests -v - 59 tests passed
  • deployed and boot-tested on the connected Waveshare RP2040-Touch-LCD-1.28
  • detected CST816T revision 1 and QMI8658 revision 124
  • verified clean startup with saved Launch Mode sensitivity 0.5

Closes #11

@PurpleSentinel
PurpleSentinel marked this pull request as ready for review August 9, 2026 22:29
@PurpleSentinel
PurpleSentinel merged commit ec5d82e into v3 Aug 9, 2026
2 checks passed
@PurpleSentinel
PurpleSentinel deleted the feature/issue-11-safe-peripheral-init branch August 10, 2026 19:36
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.

Handle missing touch and IMU hardware without undefined-name crashes

2 participants