Skip to content

Brightness settings, Never options for power stages, darker dim, USB status - #79

Merged
thePunderWoman merged 2 commits into
mainfrom
display-led-brightness
Oct 25, 2026
Merged

thePunderWoman merged 2 commits into
mainfrom
display-led-brightness

Conversation

@thePunderWoman

@thePunderWoman thePunderWoman commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

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)

  • Screen and LED rows, each 10%–100% in steps of 10 (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%.
  • The stick now also gives the menu Left/Right. Only the axis pushed further fires, so a diagonal push doesn't change the row and the value together, and both axes must return to center before it fires again.
  • Screen: contrast scales linearly to 0xFF. The default is 80% (0xCC), close to the old 0xCF look. 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.
  • LED: 100% is capped at about 30% duty, because full drive was too bright. The default is 10%.
  • Both are saved under new NVS keys (scrPct, ledPct). The old LED key held a Low/Medium/High index, so an existing LED setting resets to the default once.

Power Management

  • Mode row removed. OLED Dim, OLED Off, XBee sleep and Auto off each have a Never option. The first two are prefixed "OLED" so OLED Off isn't confused with Auto off.
  • A Never stage is skipped and adds no delay. The other stages still run in order, each timed from the previous stage in use. For example, Off on Never with XBee sleep set lets the radio sleep while the screen stays on. To allow that, PowerTier became PowerState (screen full/dim/off plus XBee asleep). Light sleep still needs both the screen off and the XBee asleep.
  • Defaults: every idle stage Never, with a 5-minute auto off. This matches the old "Always on" default.
  • Migration: a saved mode is 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

  • The Battery complication reads Battery: 100% USB when USB is detected and Battery: 99% chg while charging. Serial telemetry adds USB host connected / power only / not detected.
  • VBUS isn't wired to any GPIO (only to the charger's IN pin), so USB is inferred from a connected USB host or the charger reporting charging. A power-only supply after charging finishes reads the same as battery, which is acceptable since it only affects this display.

Testing

  • New 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 the USB / chg suffixes.
  • pio test -e native: 379 tests pass. gcovr 98.6% lines. pio run -e esp32s3 builds.

Not yet tried on hardware: the dim drive and the brightness curves need checking on a real panel.

🤖 Generated with Claude Code

thePunderWoman and others added 2 commits October 24, 2026 18:59
- 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>
@thePunderWoman thePunderWoman changed the title Add screen and LED brightness settings, kept on wake Brightness settings, Never options for power stages, darker dim, USB status Oct 25, 2026
@thePunderWoman
thePunderWoman merged commit e29d966 into main Oct 25, 2026
3 checks passed
@thePunderWoman
thePunderWoman deleted the display-led-brightness branch October 25, 2026 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant