feat: add DeviceUIConfig.screen_rotation - #1026
Open
attakygit wants to merge 1 commit into
Open
Conversation
The color UI has no way to persist a screen rotation, so a device that can render both a landscape and a portrait layout has to pick one at build time. The value is a quarter-turn count relative to the device's built-in display orientation, so ROTATION_0 means every existing device keeps behaving exactly as it does today. It is read at boot, which is why changing it requires a restart: a layout tree cannot be rebuilt in place once the view has cached its object pointers.
📝 WalkthroughWalkthroughThe device UI protobuf now supports color UI screen rotation. The configuration includes a ChangesScreen rotation configuration
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
3 tasks
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.
What does this PR do?
Adds a persisted screen rotation to
DeviceUIConfigso the color UI can offerorientation as a runtime setting instead of a build-time choice.
Today a device that can render both the 320x240 and the 240x320 layout has to
pick one at compile time via
VIEW_320x240/VIEW_240x320. There is nowhereto store a user's choice, so the only way to change orientation is to reflash.
The device-ui side that consumes this field is implemented and hardware-tested;
see the companion PR linked below.
The field
Quarter turns relative to the device's built-in display orientation, not
absolute panel rotations.
ROTATION_0is the existing behaviour. Every device that never sets thisfield keeps rendering exactly as it does today, and the default value of an
unset proto3 enum is 0, so no migration is involved.
LV_DISPLAY_ROTATION_*and themasking already used for
MESHTASTIC_FB_ROTATIONin device-ui Deprecate MyNodeInfo fields: max_channels, message_timeout_msec, has_wifi, channel_utilization, and air_util_tx #355 — sameconcept, same numbering, different transport.
cannot be rebuilt in place once the view has cached its object pointers. The
comment says so.
Why in the proto rather than firmware-side
Open question for you, and I'm happy either way:
DeviceUIConfigis where every other persisted MUI setting already lives(brightness, theme, language, touch calibration), and it reaches the firmware
through the existing
storeUIConfigpath, so device-ui needs no new plumbingand the phone app could surface it later.
The alternative is a firmware-owned byte with device-ui exposing a small
load/store hook. That avoids touching the wire format entirely, at the cost of a
private file, no app visibility, and a
GIT_TAG/submodule bump chain to get thegenerated bindings anywhere.
If you'd rather not spend a field number on this, say so and I'll redo it the
firmware-owned way — the device-ui implementation is unaffected apart from where
it reads and writes the value.
Checklist
buf formatcleanCompanion PR
device-ui implementation: meshtastic/device-ui#359
Summary by CodeRabbit