From 65e51a09828907bf941ef74fc4dee4b6659e2e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hermann=20Bj=C3=B6rgvin=20Haraldsson?= Date: Sat, 30 May 2026 18:53:46 +0000 Subject: [PATCH] display: rotation flash ramps back to user brightness The post-rotation brightness ramp targeted a hard-coded 200 (the old default), which reset whatever the user had chosen via PWR-short-press after every IMU rotation. Read brightness_get() instead and scale the 4-step ramp (30/60/85/100%) toward that target. Co-Authored-By: Claude Opus 4.7 --- firmware/src/boards/waveshare_amoled_216/display.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/firmware/src/boards/waveshare_amoled_216/display.cpp b/firmware/src/boards/waveshare_amoled_216/display.cpp index 14b8561..a1cf7b7 100644 --- a/firmware/src/boards/waveshare_amoled_216/display.cpp +++ b/firmware/src/boards/waveshare_amoled_216/display.cpp @@ -1,5 +1,6 @@ #include "../../hal/display_hal.h" #include "../../hal/imu_hal.h" +#include "../../brightness.h" #include "board.h" #include #include @@ -119,8 +120,11 @@ void display_hal_tick(void) { if (now - ramp_last < 25) return; ramp_last = now; - static const uint8_t levels[] = {60, 120, 170, 200}; - display_hal_set_brightness(levels[ramp_step - 1]); + // Ramp back to the user's chosen brightness (not a hardcoded level), so a + // physical rotation doesn't reset what they set via PWR-short-press. + static const uint8_t pct[] = {30, 60, 85, 100}; + uint8_t target = brightness_get(); + display_hal_set_brightness((uint8_t)(((uint16_t)target * pct[ramp_step - 1]) / 100)); if (ramp_step >= 4) ramp_step = 0; else ramp_step++; }