Skip to content

sensecap solar: add poweroff/shutdown support and nrf52 PM parity - #1873

Merged
ripplebiz merged 2 commits into
meshcore-dev:mainfrom
Specter242:codex/sensecap-solar-led-poweroff-parity
Mar 12, 2026
Merged

sensecap solar: add poweroff/shutdown support and nrf52 PM parity#1873
ripplebiz merged 2 commits into
meshcore-dev:mainfrom
Specter242:codex/sensecap-solar-led-poweroff-parity

Conversation

@Specter242

@Specter242 Specter242 commented Feb 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Add SenseCAP Solar repeater power-management parity for software shutdown:

  • Add board-level power management hooks for SenseCAP Solar (initiateShutdown, powerOff) with button-based wake/system-off behavior.
  • Enable required SenseCAP Solar variant defines for NRF52 power-management.
  • Add SenseCAP Solar LED/wiring parity updates:
    • update LoRa TX LED pin mapping (P_LORA_TX_LED) from 12 to 11 for board wiring parity,
    • explicitly switch LED_GREEN and LED_BLUE off in powerOff() before entering system-off.
  • Add CLI aliases: poweroff and shutdown.
  • Add stability/usability fixes for real device behavior:
    • configure wake button with pull-up in system-off to avoid floating/false wake,
    • add SenseCAP Solar repeater long-press user-button shutdown (hold ~1.5s).
  • Update NRF52 power-management support docs matrix for SenseCAP Solar.

Why

SenseCAP Solar repeater firmware lacked a practical software power-off path and CLI shutdown command. This improves battery-device operability and aligns behavior with expected NRF52 power-management support.

Fixes #1872
Related to #1145

Validation

  • ~/.local/bin/pio run -e SenseCap_Solar_repeater (SUCCESS)
  • Verified firmware links and artifacts are produced for the target environment.

@willumpie82

Copy link
Copy Markdown
Contributor

I checked out your firmware, thanks for implementing. (this is really helpfull when swapping e.g. the antenna

What I see that you changed the LED behaviour, and that the blue LED is always on goes off on 'poweroff", Is that intentionally? this will drain the battery of the node

@ripplebiz

Copy link
Copy Markdown
Member

Can you change the base branch of this PR to 'dev' then I can merge.

@Specter242

Copy link
Copy Markdown
Contributor Author

I'll take care of these in the next few days. I'm on a job right now.

@mvdbosch

Copy link
Copy Markdown

So how is this functionality supposed to work?

I am running v1.15.0 and I spend like 2 hours playing with the power button to get it to power down - so I can safely box the repeater for storage (and disconnect the antenna).

Expected behavior would be to press the button 3-10 secs. and the unit goes offline till the button is pressed again shortly.

@nwithan8

nwithan8 commented Jun 8, 2026

Copy link
Copy Markdown

So how is this functionality supposed to work?

I am running v1.15.0 and I spend like 2 hours playing with the power button to get it to power down - so I can safely box the repeater for storage (and disconnect the antenna).

Expected behavior would be to press the button 3-10 secs. and the unit goes offline till the button is pressed again shortly.

Hold the User button for 1.5 seconds: https://github.com/meshcore-dev/MeshCore/pull/1873/changes#diff-10a0092562d43e5bb73a25560e519d6106a0d09b143204ed36ae90d8a3ad24aaR136

@IoTThinks IoTThinks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

poweroff CLI will not work for most NRF52 repeaters.
We need to fix the powerOff() for many NRF52 repeaters.

powerOff CLI only works for SenseCap solar if NRF52 power management is enabled as it calls a custom code.

Comment thread src/helpers/CommonCLI.cpp
void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, char* reply) {
if (memcmp(command, "reboot", 6) == 0) {
if (memcmp(command, "poweroff", 8) == 0 || memcmp(command, "shutdown", 8) == 0) {
_board->powerOff(); // doesn't return

@IoTThinks IoTThinks Jun 17, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is correct but not enough to power off for most NRF52 repeaters including SenseCap Solar repeater with NRF52 MANAGEMENT disabled.

This is because powerOff() for most NRF52 boards will call sd_power_system_off() which only valid for BLE companions.
NRF52 repeaters do not use softdevice.

By introducing "poweroff", the bug in current powerOff for NRF52 boards is accidentaly exposed.

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.

SenseCAP Solar repeater: add poweroff/shutdown support and NRF52 power-management parity

6 participants