Skip to content

feat(rak3401): AIN1 button for status screen and shutdown#2414

Open
dorfman2 wants to merge 1 commit intomeshcore-dev:mainfrom
dorfman2:feature/rak3401-ain1-button-and-ui
Open

feat(rak3401): AIN1 button for status screen and shutdown#2414
dorfman2 wants to merge 1 commit intomeshcore-dev:mainfrom
dorfman2:feature/rak3401-ain1-button-and-ui

Conversation

@dorfman2
Copy link
Copy Markdown

@dorfman2 dorfman2 commented Apr 27, 2026

AIN1 Button for Status Screen and Shutdown (RAK3401) 🤖🤖

Adds physical button support on AIN1 (pin 31) for the RAK3401 1W repeater, designed for use with a 3D printed portable case that incorporates an Omron-style limit switch as a user button.

Note from the Human: I combined these two feature into to a single PR, but am happy to split this out and discuss further. This is a specific use case where a repeater is being deployed at a festival, and isn't "set & forget." I do think switch functionality could be inherent on this board, as long as we maintain the normally open logic, similar to the OLED screen (always on, but doesn't always physically exist).

Button Actions

  • 0.5s hold → Status screen (uptime, battery voltage, percentage, gauge bar, charging indicator)
  • 5s hold → Graceful shutdown with "Shutting down..." message, then NRF52 SYSTEMOFF
  • Press while off → Wake from SYSTEMOFF via GPIO SENSE

Screenshots

Home Screen Status Screen Final Hardware Build
IMG_9866 IMG_9867 IMG_9869

NOTE: Screen does auto-off to save power as in the current code, but uploading photos of the screen black is decidedly not helpful.

UI Changes

  • Redesigned repeater screens with angular theme for small OLEDs
  • Inverted header bars, horizontal rule separators, label:value layout
  • Full-width battery gauge bar with percentage
  • Charging indicator (plug icon + "CHG") when USB power detected via isExternalPowered()

Hardware Changes

  • PIN_USER_BTN_ANA=31 build flag for RAK_3401_repeater
  • Public powerOff() override on RAK3401Board delegating to initiateShutdown(SHUTDOWN_REASON_USER)
  • GPIO SENSE LOW wake configured on AIN1 before SYSTEMOFF
  • Waits for button release before entering SYSTEMOFF to prevent immediate wake

Notes

  • Uses digitalRead instead of analogRead — nRF52 SAADC disconnects INPUT_PULLUP during conversion
  • Battery percentage: linear mapping 3.0V (0%) → 4.2V (100%) for single-cell 3.7V LiPo
  • UI changes are in examples/simple_repeater/UITask.* which affects all repeater variants

Case Design

https://www.printables.com/model/1627139-case-for-rak-wisblock-1-watt-starter-kit

Made as a portable case for the RAK Wisblock 1 Watt starter kit. This case accommodates a very large battery (10000mAh or 15000mAh, 60mm x 110mm x 10mm) and incorporates a standard 128x64 OLED screen, standard micro toggle for power, an Omron style limit switch for user button, and two SMA antenna holes.

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