Repository navigation
Conversation
…eshcore-dev#1411) Add hardware button power management for RAK4631 and Muziworks R1 builds, and resolve immediate wakeup from SYSTEMOFF sleep (supersedes meshcore-dev#2701). Key Changes: - Button Power-Down: Monitor BOARD_BUTTON_PIN (WB_A1 / PIN_USER_BTN_ANA) in RAK4631Board::loop(). A 3-second long press illuminates the green LED (PIN_LED1) as power-down confirmation (leaving the blue LED for BLE status) and initiates deep sleep upon button release. - Debounce & Release Settle: Wait for stable button release before power down, and enforce a 50ms settle window before arming SENSE LOW. - Radio Isolation: Detach RadioLib interrupts (DIO1, BUSY) and reset SX1262 pins to default prior to disabling SX126X_POWER_EN. This prevents the collapsing power rail from triggering a false GPIO DETECT interrupt. - BLE Graceful Disconnect: Disconnect active BLE connections and stop advertising before entering sleep so companion apps disconnect cleanly. - LATCH Clearing: Disable SENSE on non-button pins and clear NRF_P0/P1 LATCH registers right before entering SYSTEMOFF, preventing immediate auto-wake. Hardware Testing: - Verified on a physical Muziworks R1 unit (RAK4631 + WisBlock base with hardware button on WB_A1 / Pin 31). - Confirmed normal BLE operation, 3-second long-press detection with green LED indicator, graceful mobile app disconnect, and sustained SYSTEMOFF deep sleep with all LEDs off (no spurious or immediate wakeups). - Confirmed wake from sleep via reset button back to full operational state. Fixes meshcore-dev#1411 Supersedes meshcore-dev#2701
This branch has not been deployed
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
This PR implements hardware button power management for RAK4631 / Muziworks R1 hardware, enabling deep sleep power-down via long-press, and fixes the immediate wakeup from
SYSTEMOFF(superseding #2701).Background & Root Cause
WB_A1/ Pin 31) had no hardware button power-off monitoring inrak4631.SYSTEMOFFpreviously triggered an immediate reboot (RESETREAS=0x00010000, GPIO DETECT) because:DIO1andBUSYfired as the SX1262 power rail collapsed.LATCHregisters.Key Changes
BOARD_BUTTON_PIN(WB_A1/PIN_USER_BTN_ANA) inRAK4631Board::loop(). A 3-second long press illuminates the green LED (PIN_LED1) as confirmation (leaving the blue LED for BLE status) and initiates deep sleep upon button release.NRF_GPIO_PIN_SENSE_LOW.detachInterrupt()and reset SX1262 pins to default prior to pullingSX126X_POWER_ENlow. Disable SENSE on all non-button pins.Bluefruit.disconnect()) and stop advertising before entering sleep.0xFFFFFFFFtoNRF_P0->LATCHandNRF_P1->LATCHright before enteringSYSTEMOFF.variants/rak4631/. Other variants and newer Muziworks hardware (muzi_base,muziworks_r1_neo) remain untouched. All RAK4631 build targets (BLE, USB, Repeater, Room Server, Terminal Chat) compile cleanly.Hardware Testing
Closes #1411
Supersedes #2701