sensecap solar: add poweroff/shutdown support and nrf52 PM parity - #1873
Conversation
|
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 |
|
Can you change the base branch of this PR to 'dev' then I can merge. |
|
I'll take care of these in the next few days. I'm on a job right now. |
|
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 |
| 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 |
There was a problem hiding this comment.
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.
Summary
Add SenseCAP Solar repeater power-management parity for software shutdown:
initiateShutdown,powerOff) with button-based wake/system-off behavior.P_LORA_TX_LED) from12to11for board wiring parity,LED_GREENandLED_BLUEoff inpowerOff()before entering system-off.poweroffandshutdown.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)