mirror of
https://github.com/meshtastic/firmware.git
synced 2026-10-09 06:31:35 -04:00
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.
This commit is contained in:
1 parent
20284840a8
commit
09e514602e
2 files changed
+21
-6
No files matched your search
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in new issue
Block a user