Skip to content

RAK3401: powerOff() override + AIN1 SENSE LOW wake from SYSTEMOFF 🤖🤖#2642

Open
disq wants to merge 1 commit into
meshcore-dev:devfrom
disq:rak3401-ain1-wake
Open

RAK3401: powerOff() override + AIN1 SENSE LOW wake from SYSTEMOFF 🤖🤖#2642
disq wants to merge 1 commit into
meshcore-dev:devfrom
disq:rak3401-ain1-wake

Conversation

@disq
Copy link
Copy Markdown

@disq disq commented May 28, 2026

Two board-level pieces from @dorfman2's #2414 that are useful for any RAK3401 firmware, not just the repeater variant that PR targets.

What this changes

  1. RAK3401Board::powerOff() override (variants/rak3401/RAK3401Board.h) — routes _board->powerOff() through initiateShutdown(SHUTDOWN_REASON_USER) so the shutdown reason is properly tagged in GPREGRET2 instead of falling through to the base class default.

  2. AIN1 GPIO SENSE LOW config in initiateShutdown() (variants/rak3401/RAK3401Board.cpp) — when an env defines PIN_USER_BTN_ANA, configure that pin with pull-up + SENSE_Low before entering SYSTEMOFF, so pressing the AIN1 button wakes the board from the off state via the GPIO LATCH/SENSE mechanism. Waits for button release first (level-triggered SENSE would otherwise wake immediately if the user is still holding the button when we arm it).

What this does NOT include

The repeater-specific UI redesign, status screen, and simple_repeater/main.cpp button handler from #2414 are out of scope here — the companion_radio UI tree already has its own equivalent button handling in examples/companion_radio/ui-new/UITask.cpp. This PR cleanly lifts only the universally-beneficial board-level pieces; #2414 can land independently with the repeater UI work on top.

Testing

Verified on RAK3401 + RAK19007 + companion_radio_ble build:

  • _board->powerOff() from the companion UI menu correctly enters SYSTEMOFF.
  • Pressing the AIN1 button wakes the board cleanly; subsequent boot is normal.

🤖 Generated with Claude Code

Two board-level pieces from dorfman2's PR meshcore-dev#2414 that are useful for any
RAK3401 firmware, not just the repeater variant the PR targets:

1. RAK3401Board::powerOff() override — routes _board->powerOff() through
   initiateShutdown(SHUTDOWN_REASON_USER) so the shutdown reason is
   properly tagged in GPREGRET2 instead of falling through to the base
   class default.

2. AIN1 GPIO SENSE LOW config in initiateShutdown() — when an env defines
   PIN_USER_BTN_ANA, configure that pin with pull-up + SENSE LOW before
   entering SYSTEMOFF, so pressing the AIN1 button wakes the board from
   the off state via the GPIO LATCH/SENSE mechanism. Waits for button
   release first (level-triggered SENSE would otherwise wake immediately
   if the user is still holding the button when we arm it).

The repeater-specific UI redesign, status screen, and simple_repeater
main.cpp button handler from the same PR are out of scope here; the
companion radio UI tree already has its own equivalent button handling
in examples/companion_radio/ui-new/UITask.cpp.

Co-Authored-By: dorfman2 <noreply@github.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@disq disq changed the title RAK3401: powerOff() override + AIN1 SENSE LOW wake from SYSTEMOFF RAK3401: powerOff() override + AIN1 SENSE LOW wake from SYSTEMOFF 🤖🤖 May 28, 2026
@dorfman2
Copy link
Copy Markdown

Ah @disq I see what you meant now. I was too focused on the UI portion of the code. Would love to see this implemented!

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.

2 participants