|
TB2026-YDS Firmware
|
Screen (display) settings: brightness slider + auto-sleep delay. More...
#include "screen_settings.h"#include "navigator.h"#include "status_bar.h"#include "gfx.h"#include "settings.h"#include "display_oled.h"#include "power.h"#include <stdio.h>#include <string.h>Macros | |
| #define | NVS_KEY "oled_bri" |
| #define | BRI_MIN 2 /* keep the UI legible at the low end */ |
| #define | BRI_MAX DISPLAY_OLED_BRIGHTNESS_MAX /* 15 */ |
| #define | BRI_DFLT BRI_MAX /* first boot: full brightness (init default) */ |
| #define | ACCENT gfx_rgb(255, 0, 0) /* Settings identity colour (see root_menu) */ |
| #define | DIM gfx_rgb(110, 110, 110) |
| #define | N_SLEEP (int)(sizeof k_sleep_presets / sizeof k_sleep_presets[0]) |
| #define | BRI_HDR_Y 44 |
| #define | BAR_X 18 |
| #define | BAR_W 140 |
| #define | BAR_Y 66 |
| #define | BAR_H 6 |
| #define | VAL_Y (BAR_Y + 18) |
| #define | SLEEP_TITLE_Y 116 |
| #define | SLEEP_VAL_Y 134 |
Enumerations | |
| enum | { ZONE_BRI = 0 , ZONE_SLEEP , N_ZONES } |
Functions | |
| void | screen_settings_restore (void) |
| Restore the saved brightness from NVS and apply it to the panel. | |
| screen_t * | screen_settings_screen (void) |
| Get the singleton Screen settings screen, ready to push onto the navigator. | |
Screen (display) settings: brightness slider + auto-sleep delay.
Two vertically stacked zones; UP/DOWN moves the focus between them:
The bottom of the brightness range is floored at BRI_MIN (never 0): a fully dimmed panel would be unreadable, leaving the user unable to see the slider to raise it back. The sleep delay is persisted through the power service on BACK, only if it actually moved (Rule 13: no NVS write per scroll step).
| #define ACCENT gfx_rgb(255, 0, 0) /* Settings identity colour (see root_menu) */ |
| #define BAR_H 6 |
| #define BAR_W 140 |
| #define BAR_X 18 |
| #define BAR_Y 66 |
| #define BRI_DFLT BRI_MAX /* first boot: full brightness (init default) */ |
| #define BRI_HDR_Y 44 |
| #define BRI_MAX DISPLAY_OLED_BRIGHTNESS_MAX /* 15 */ |
| #define BRI_MIN 2 /* keep the UI legible at the low end */ |
| #define DIM gfx_rgb(110, 110, 110) |
| #define N_SLEEP (int)(sizeof k_sleep_presets / sizeof k_sleep_presets[0]) |
| #define NVS_KEY "oled_bri" |
| #define SLEEP_TITLE_Y 116 |
| #define SLEEP_VAL_Y 134 |
| #define VAL_Y (BAR_Y + 18) |
| void screen_settings_restore | ( | void | ) |
Restore the saved brightness from NVS and apply it to the panel.
Call once at boot, after display_oled_init() (the panel must be up). Falls back to full brightness when nothing is stored yet.
| screen_t * screen_settings_screen | ( | void | ) |
Get the singleton Screen settings screen, ready to push onto the navigator.