Skip to content

companion_radio: wake display on USB connect 🤖🤖#2656

Open
disq wants to merge 1 commit into
meshcore-dev:devfrom
disq:claude/suspicious-chaum-1a6a11
Open

companion_radio: wake display on USB connect 🤖🤖#2656
disq wants to merge 1 commit into
meshcore-dev:devfrom
disq:claude/suspicious-chaum-1a6a11

Conversation

@disq
Copy link
Copy Markdown

@disq disq commented Jun 1, 2026

What

Light up the screen when external (USB) power is newly connected, as if a key had been pressed.

  • A new _was_ext_powered member tracks the previous power state, so the wake only fires on the rising edge (ext_powered && !_was_ext_powered).
  • It's seeded from the current state in begin(), so booting while already powered does not trigger a spurious wake.
  • The wake only acts when the screen is currently off (!_display->isOn()), so an already-lit display is left untouched — no timer extension, no injected input.
  • By default the screen auto-offs normally afterwards. The existing opt-in KEEP_DISPLAY_ON_USB is what keeps it lit while powered; the two compose cleanly.

Applied consistently across all three companion_radio UI variants: ui-new, ui-orig, ui-tiny (mirroring the existing KEEP_DISPLAY_ON_USB placement).

Why

When a device is sitting with its screen off and you plug it into USB, it's natural to expect the display to wake so you can see status — without having to also press a button.

Notes for reviewers

  • isExternalPowered() is only implemented on NRF52 (VBUS detect); it returns false on other platforms, so this feature is effectively NRF52-only and inert elsewhere — no behavior change on ESP32 targets.
  • The wake is unconditional (not behind its own #define), unlike KEEP_DISPLAY_ON_USB: a momentary wake doesn't carry the OLED burn-in risk that gated the keep-on feature. Happy to gate it behind a flag if preferred.
  • Build-verified on NRF52: GAT562_30S_Mesh_Kit_companion_radio_usb (ui-new) and Xiao_nrf52_companion_radio_usb (ui-orig). The LilyGo_T-Echo_Card env (ui-tiny) has a pre-existing genericBuzzer link error unrelated to this change (fails identically on the unmodified tree); the ui-tiny code is structurally identical to ui-new.

🤖 Generated with Claude Code

Light up the screen when external (USB) power is newly connected, as if a
key had been pressed. A new _was_ext_powered member tracks the previous
power state so the wake only fires on the rising edge, and it is seeded
from the current state in begin() so booting while already powered does
not trigger a spurious wake.

The wake only acts when the screen is currently off, so an already-lit
display is left untouched (no timer extension, no injected input). By
default the screen auto-offs normally afterwards; the existing
KEEP_DISPLAY_ON_USB opt-in is what keeps it lit while powered, and the two
compose cleanly.

Applied consistently across the ui-new, ui-orig and ui-tiny variants.
isExternalPowered() is only implemented on NRF52, so this is effectively
NRF52-only and inert on other targets.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@disq disq changed the title companion_radio: wake display on USB connect companion_radio: wake display on USB connect 🤖🤖 Jun 1, 2026
@disq disq changed the base branch from main to dev June 1, 2026 10:51
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