From 09e514602ea7fe8e6bcdc35fbb1ceeb26c9f3159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Fri, 25 Sep 2026 20:10:14 +0200 Subject: [PATCH] feat(variants): add L1 Pro 1W battery curve and brightness levels (#11972) - Add OCV_ARRAY for the L1 Pro 1W battery. - Let variants override the brightness menu levels via SCREEN_BRIGHTNESS_LEVEL_{MEDIUM,HIGH,VERY_HIGH}; defaults unchanged. - Set L1 Pro 1W brightness levels to 100/160/255. - Drop USE_SSD1306 from the L1 Pro 1W variant; USE_SH1106 is set in configuration.h. --- src/graphics/draw/MenuHandler.cpp | 21 ++++++++++++++----- .../seeed_wio_tracker_L1_Pro_1W/variant.h | 6 +++++- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/graphics/draw/MenuHandler.cpp b/src/graphics/draw/MenuHandler.cpp index da723eb6c0..0876f39f7f 100644 --- a/src/graphics/draw/MenuHandler.cpp +++ b/src/graphics/draw/MenuHandler.cpp @@ -2314,15 +2314,26 @@ void menuHandler::BuzzerModeMenu() screen->showOverlayBanner(bannerOptions); } +// Variants may override these in variant.h. +#ifndef SCREEN_BRIGHTNESS_LEVEL_MEDIUM +#define SCREEN_BRIGHTNESS_LEVEL_MEDIUM 64 +#endif +#ifndef SCREEN_BRIGHTNESS_LEVEL_HIGH +#define SCREEN_BRIGHTNESS_LEVEL_HIGH 128 +#endif +#ifndef SCREEN_BRIGHTNESS_LEVEL_VERY_HIGH +#define SCREEN_BRIGHTNESS_LEVEL_VERY_HIGH 255 +#endif + void menuHandler::BrightnessPickerMenu() { static const char *optionsArray[] = {"Back", "Low", "Medium", "High"}; // Get current brightness level to set initial selection int currentSelection = 1; // Default to Medium - if (uiconfig.screen_brightness >= 255) { + if (uiconfig.screen_brightness >= SCREEN_BRIGHTNESS_LEVEL_VERY_HIGH) { currentSelection = 3; // Very High - } else if (uiconfig.screen_brightness >= 128) { + } else if (uiconfig.screen_brightness >= SCREEN_BRIGHTNESS_LEVEL_HIGH) { currentSelection = 2; // High } else { currentSelection = 1; // Medium @@ -2334,11 +2345,11 @@ void menuHandler::BrightnessPickerMenu() bannerOptions.optionsCount = 4; bannerOptions.bannerCallback = [](int selected) -> void { if (selected == 1) { // Medium - uiconfig.screen_brightness = 64; + uiconfig.screen_brightness = SCREEN_BRIGHTNESS_LEVEL_MEDIUM; } else if (selected == 2) { // High - uiconfig.screen_brightness = 128; + uiconfig.screen_brightness = SCREEN_BRIGHTNESS_LEVEL_HIGH; } else if (selected == 3) { // Very High - uiconfig.screen_brightness = 255; + uiconfig.screen_brightness = SCREEN_BRIGHTNESS_LEVEL_VERY_HIGH; } if (selected != 0) { // Not "Back" diff --git a/variants/nrf52840/seeed_wio_tracker_L1_Pro_1W/variant.h b/variants/nrf52840/seeed_wio_tracker_L1_Pro_1W/variant.h index 75bfe887b6..2bee3b406d 100644 --- a/variants/nrf52840/seeed_wio_tracker_L1_Pro_1W/variant.h +++ b/variants/nrf52840/seeed_wio_tracker_L1_Pro_1W/variant.h @@ -89,7 +89,10 @@ static const uint8_t SDA = PIN_WIRE_SDA; static const uint8_t SCL = PIN_WIRE_SCL; #define HAS_SCREEN 1 -#define USE_SSD1306 1 + +#define SCREEN_BRIGHTNESS_LEVEL_MEDIUM 100 +#define SCREEN_BRIGHTNESS_LEVEL_HIGH 160 +#define SCREEN_BRIGHTNESS_LEVEL_VERY_HIGH 255 // SPI Configuration (SX1262) #define SPI_INTERFACES_COUNT 1 @@ -124,6 +127,7 @@ static const uint8_t SCL = PIN_WIRE_SCL; #define ADC_MULTIPLIER 2.0 #define BATTERY_PIN PIN_VBAT #define AREF_VOLTAGE 3.6 +#define OCV_ARRAY 4200, 4050, 3990, 3890, 3800, 3720, 3630, 3530, 3420, 3300, 3100 // We rely on the nrf52840 USB controller to tell us if we are hooked to a power supply #define NRF_APM