Skip to content

Add continuous automatic display orientation - #65

Merged
PurpleSentinel merged 1 commit into
v4.1from
feature/issue-64-auto-rotation
Aug 10, 2026
Merged

Add continuous automatic display orientation#65
PurpleSentinel merged 1 commit into
v4.1from
feature/issue-64-auto-rotation

Conversation

@PurpleSentinel

Copy link
Copy Markdown
Contributor

Summary

  • add an Auto rotation choice alongside the existing fixed orientations
  • use filtered QMI8658 gravity data to keep the display upright while the device rotates
  • rotate LCD output and touch coordinates together without interrupting an active timer
  • share the IMU between Auto rotation, G mode, and Launch mode, with graceful fallback if it is unavailable
  • update configuration guidance, deployment documentation, and automated coverage

Why

Drivers can mount or rotate the device in any supported orientation while keeping every screen and touch target upright. Fixed rotation remains available for installations that do not want sensor-driven orientation.

Hardware and memory handling

Connected-device validation exposed heap fragmentation when battery.py was first imported after Auto rotation had allocated its filter state, despite roughly 61 KB of total free memory. Battery support is now preloaded before filtered sampling begins and retained across Timer-mode transitions, avoiding the allocation failure without adding another framebuffer.

Impact

  • existing numeric DISPLAY_ROTATION_DEG values remain compatible
  • selecting Auto stores "auto" in the existing setting
  • ambiguous motion or a near-horizontal device retains the last stable orientation
  • sensor failure freezes the last orientation while fixed rotation and timer operation remain available

Validation

  • python -m unittest discover -s tests — 136 tests passed
  • fixed-orientation and Auto startup paths tested on the connected Waveshare RP2040 under MicroPython 1.21.0
  • two Auto cold-start runs completed both splash screens and reached Timer Mode without a traceback
  • original on-device user settings restored after validation

Closes#64

@PurpleSentinel
PurpleSentinel merged commit ae5493a into v4.1Aug 10, 2026
2 checks passed
@PurpleSentinel
PurpleSentinel deleted the feature/issue-64-auto-rotation branch August 10, 2026 19:36
Sign up for freeto 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.

2 participants

@PurpleSentinel@markr-sqr