Repository navigation
Brightness settings, Never options for power stages, darker dim, USB status - #79
Merged
Merged
Conversation
- New Brightness menu (after Display Config) with Screen and LED rows. The LED row moves there from Power Management; both values live in PowerConfig and save through the existing Power Config path. - Screen brightness Low / Medium / High sets the SSD1306 contrast (High is 0xCF, the old default). The dim tier still drops to contrast 0, but waking now returns to the user's level instead of Adafruit_SSD1306's fixed default, which dim(false) always restored. Changes apply immediately, at boot, and when the low-battery countdown forces the screen on. - Status LED levels lowered from 20% / 50% / 100% to about 4% / 12% / 30%: full drive was too bright. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brightness - Screen and LED brightness are now 10%-100% in steps of 10 (brightness_level.h). On the Brightness screen, stick left/right steps the selected row down/up and stops at the ends; Enter steps up and wraps. The stick now also feeds menu Left/Right: only the axis pushed further fires, and both axes must return to center to rearm. - Screen: contrast scales linearly to 0xFF; default 80% (~0xCC, close to the old 0xCF). LED: 100% is the old High cap (~30% duty); default 10%. Saved under new NVS keys, so an old Low/Medium/High LED setting resets to the default once. Power management - Removed the Mode row. OLED Dim, OLED Off, XBee sleep and Auto off each gain a Never option. A Never stage is skipped and adds no delay; the rest still run in order, so the XBee can sleep with the screen on. PowerTier becomes PowerState (screen state + XBee asleep). Light sleep still needs the screen off and the XBee asleep. - Defaults are every idle stage Never with a 5-minute auto off, the old "Always on". A saved mode is converted on load (applyLegacyPowerMode()) and dropped on the next save. - Dim also shortens precharge and lowers VCOMH, since contrast 0 alone barely dimmed the panel. Values are starting points to tune on hardware. USB status - The Battery complication shows "USB" when USB is detected and "chg" while charging; Serial telemetry adds the USB status. VBUS isn't wired to a GPIO, so USB is inferred from a connected USB host or the charger reporting charging; a power-only supply after charge-done looks like battery. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds screen and LED brightness settings in 10% steps, replaces the Power Management mode with a Never option on each stage, makes the dim stage much darker, and shows when USB is connected.
Changes
Brightness menu (main menu, after Display Config)
brightness_level.h). Up/Down picks a row, stick left/right steps it down/up (stopping at 10% and 100%), and Enter steps up, wrapping 100% back to 10%.0xFF. The default is 80% (0xCC), close to the old0xCFlook. Waking from dim returns to your level;Adafruit_SSD1306::dim(false)always restored the library's fixed default. Your level is also applied at boot, on menu changes, and when the low-battery countdown forces the screen on.scrPct,ledPct). The old LED key held a Low/Medium/High index, so an existing LED setting resets to the default once.Power Management
PowerTierbecamePowerState(screen full/dim/off plus XBee asleep). Light sleep still needs both the screen off and the XBee asleep.modeis converted on load (applyLegacyPowerMode()): stages that mode left out become Never, so an updated controller behaves as before. The key is removed on the next save.Darker dim
Contrast 0 alone (all
dim()does) barely dimmed the panel. The dim stage now also shortens precharge (0xD9→0x11) and drops VCOMH to its lowest level (0xDB→0x00), aiming for roughly a tenth of normal brightness. Panels vary, so these values are a starting point to tune.USB status
Battery: 100% USBwhen USB is detected andBattery: 99% chgwhile charging. Serial telemetry addsUSB host connected/power only/not detected.Testing
test_brightness_level: sanitizing, stepping, the stops at each end, and Enter's wrap.test_screen_brightness: contrast curve, default near the old look, dim drive, and waking back to the setting (regression for waking to the library default).test_power_management: Never per stage, skipped stages adding no delay, XBee sleeping with the screen on, Never auto off, legacy-mode migration, and the new state names and light-sleep rules.test_menu: left/right stepping and its ends, stick X navigation and diagonal handling, Never cycling, and rendering.test_battery/test_complications: USB inference and theUSB/chgsuffixes.pio test -e native: 379 tests pass. gcovr 98.6% lines.pio run -e esp32s3builds.Not yet tried on hardware: the dim drive and the brightness curves need checking on a real panel.
🤖 Generated with Claude Code