feat: add runtime display rotation setting for e-ink builds

Adds Settings > Display > Rotation (0°/90°/180°/270°) that persists to
NodePrefs and is applied on startup. Falls back to compile-time
DISPLAY_ROTATION when the field is missing from an older prefs file.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-05-22 09:58:33 +02:00
co-authored by Claude Sonnet 4.6
parent cffe960f3f
commit 6a3b8e3135
8 changed files with 51 additions and 1 deletions
@@ -15,6 +15,9 @@ class SettingsScreen : public UIScreen {
CLOCK_SECONDS,
CLOCK_FORMAT,
FONT,
#if defined(EINK_DISPLAY_MODEL)
ROTATION,
#endif
// Sound section
SECTION_SOUND,
BUZZER,
@@ -321,6 +324,14 @@ class SettingsScreen : public UIScreen {
display.print("Font");
display.setCursor(VAL_X, y);
display.print((p && p->use_lemon_font) ? "Lemon" : "Default");
#if defined(EINK_DISPLAY_MODEL)
} else if (item == ROTATION) {
display.print("Rotation");
display.setCursor(VAL_X, y);
{ static const char* ROT_LABELS[] = { "0deg", "90deg", "180deg", "270deg" };
uint8_t r = p ? (p->display_rotation & 3) : 0;
display.print(ROT_LABELS[r]); }
#endif
} else if (item == DM_FILTER) {
display.print("DM");
display.setCursor(VAL_X, y);
@@ -517,6 +528,14 @@ public:
_dirty = true;
return true;
}
#if defined(EINK_DISPLAY_MODEL)
if (_selected == ROTATION && p && (left || right || enter)) {
p->display_rotation = (p->display_rotation + (left ? 3 : 1)) & 3;
_task->applyRotation();
_dirty = true;
return true;
}
#endif
if (_selected == DM_FILTER && p && (left || right || enter)) {
p->dm_show_all = p->dm_show_all ? 0 : 1;
_dirty = true;