Repeater (SenseCAP Solar): battery thresholds settable at runtime, and a cutoff that switches a running node off before the cell runs flat
pub-release / release (push) Successful in 34m55s
pub-release / release (push) Successful in 34m55s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0066d073db
commit
be46cfa5fb
10 files changed
+392
-19
No files matched your search
+40
-16
@@ -170,29 +170,53 @@ a half-drained `rxlog`/`pktlog` page would otherwise wait for the next
|
||||
connection event — the bridge drains those on a 2-minute duty cycle, so a slower
|
||||
drain directly costs collected frames.
|
||||
|
||||
## A mast that runs flat (boot protection)
|
||||
## A mast that runs flat: bootlock and cutoff
|
||||
|
||||
A panel that gets no direct sun in winter (remote-mast faces east, 11/2026:
|
||||
-50 mV a day from mid-November with consumption unchanged) eventually drains
|
||||
the cell. Without protection the node then browns out, and every bit of
|
||||
light restarts it on a cell that cannot hold it -- a boot loop at the edge.
|
||||
the cell. Without protection the node runs until the brown-out, and every bit
|
||||
of light then restarts it on a cell that cannot hold it -- a boot loop at the
|
||||
edge, with the cell deep-discharged on the way.
|
||||
|
||||
`SenseCap_Solar_repeater` builds with `NRF52_POWER_MANAGEMENT` (upstream code,
|
||||
wired in `variants/sensecap_solar`, only the switch was off): at boot the
|
||||
node reads the battery and, below **3.3 V** (`PWRMGT_VOLTAGE_BOOTLOCK`), goes to
|
||||
SYSTEMOFF with the LPCOMP armed on the battery input; it wakes when the
|
||||
battery rises past the comparator threshold (3/8 VDD, ~3.4-3.7 V on the cell
|
||||
per `variant.h`) and boots normally. USB power skips the check.
|
||||
wired in `variants/sensecap_solar`) and `PWRMGT_RUNTIME` (ours), which gives
|
||||
two thresholds, both saved on the node and settable from the console or as an
|
||||
admin over the mesh:
|
||||
|
||||
What it does **not** do: switch off a running node as the battery falls --
|
||||
nothing in the firmware calls the runtime low-voltage shutdown. It protects
|
||||
the restart, not the discharge. The clock goes back to the build epoch after
|
||||
such a restart, as after any power loss (`gps duty` resyncs it, `time` sets it).
|
||||
| | default | |
|
||||
|---|---|---|
|
||||
| `set pwr.bootlock <mV>\|off` | 3300 mV (`variant.h`) | at boot, below it the node goes to SYSTEMOFF and the LPCOMP wakes it when the battery recovers |
|
||||
| `set pwr.cutoff <mV>\|off` | off | while running, three readings in a row (one a minute) below it switch the node off into the same SYSTEMOFF |
|
||||
| `get pwr` | | both, the battery now and at boot, USB, the reason of the last switch-off |
|
||||
|
||||
**Not yet verified on hardware**: the thresholds come from `variant.h`. Bench
|
||||
test with an adjustable supply on the battery terminals: boot at 3.2 V must
|
||||
stay dark, raising it to ~3.8 V must wake the node by itself; `get boot`
|
||||
then shows `RESETREAS=0x00020000` (bit 17, wake from LPCOMP).
|
||||
The cutoff must stay below the bootlock -- a node switched off at the cutoff
|
||||
starts again only past the bootlock, which is the hysteresis (e.g. cutoff
|
||||
3400, bootlock 3600). The node refuses a threshold above the battery voltage
|
||||
at that moment (it would lock itself out of a mast), USB power disarms the
|
||||
cutoff and skips the boot check, a reading under 1 V counts as an ADC glitch.
|
||||
The values live in `/pwr_guard`, not in the prefs; without the file the build
|
||||
defaults apply (`PWRMGT_BOOTLOCK_DEFAULT`, `PWRMGT_CUTOFF_DEFAULT`).
|
||||
|
||||
The wake level is not one of the thresholds: it is the LPCOMP comparing the
|
||||
battery divider with 3/8 VDD, ~3.4-3.7 V on the cell per `variant.h`, fixed in
|
||||
hardware steps. A bootlock above it means the node wakes, checks, and sleeps
|
||||
again until the cell is past the bootlock -- harmless, each wake is a few ms.
|
||||
The clock goes back to the build epoch after such a restart, as after any
|
||||
power loss (`gps duty` resyncs it, `time` sets it).
|
||||
|
||||
Why upstream has it off: a fixed 3.3 V lock kept LiFePO4 and LTO nodes from
|
||||
booting (#2377, v1.18.0); a chemistry-aware version is open as #2088 (FS read
|
||||
before the check, per-chemistry thresholds). Ours is narrower -- one board
|
||||
with a known Li-ion cell, two numbers, `off` for either -- and has to be
|
||||
reconciled with #2088 if that lands.
|
||||
|
||||
**Not yet verified on hardware**: the logic has host tests
|
||||
(`test/test_low_voltage_guard`), the thresholds and the wake level do not.
|
||||
Bench test with an adjustable supply on the battery terminals: boot at 3.2 V
|
||||
must stay dark; raising it to ~3.8 V must wake the node by itself (`get boot`
|
||||
then shows `RESETREAS=0x00020000`, bit 17, wake from LPCOMP); with a cutoff
|
||||
set, lowering the supply below it must switch the node off within ~3 minutes
|
||||
and `get pwr` after the wake must say `last off: Low Voltage`.
|
||||
|
||||
## Measuring this yourself — two traps
|
||||
|
||||
|
||||
@@ -163,6 +163,7 @@ console shows its state.
|
||||
| `set radio.rxps off\|on\|balanced\|max`, `level <1-10> [preamble 16\|32]` / `get radio.rxps` | all, SX1262 only (`WITH_RX_POWERSAVING`, in the releases) | RX duty cycle: the radio sleeps between short listening windows. **Off by default.** `max` saved ~2.3 mA on the bench, but a mast on the live mesh lost 16 % of its reception -- see cli_commands.md and [power.md](power.md) |
|
||||
| `set batt.icon on\|off`, `set batt.icon.lo\|hi <mV>` | all | battery level as an icon at the end of the advertised name (off by default; with a name too long for it the icon is left out, and the reply says so) |
|
||||
| `gps duty ...` | GPS boards | the receiver runs only around a clock sync; see cli_commands.md |
|
||||
| `get pwr`, `set pwr.bootlock <mV>\|off`, `set pwr.cutoff <mV>\|off` | SenseCAP Solar repeater (`PWRMGT_RUNTIME`) | battery thresholds: don't start below the bootlock, switch a running node off below the cutoff (cutoff < bootlock, none above the battery right now); saved on the node, see [power.md](power.md) |
|
||||
| `clkreboot` | all | reset the clock to the build epoch and reboot -- the only way to move a clock backwards (`time` and `clock sync` refuse to) |
|
||||
|
||||
## Sensors
|
||||
@@ -192,7 +193,8 @@ The ones that change what a node does; set in `platformio.ini` /
|
||||
| `ACL_TS_MAX_AHEAD` | `86400` (s) | a client timestamp further ahead of the node's clock is not stored as the replay floor |
|
||||
| `LOCKED_NODE` | unset | a node that keeps its secrets from whoever holds it: `get prv.key`, `get guest.password` and `get bridge.secret` answer `Error: locked build` to everyone (USB and BLE console, an admin over the mesh); a companion serves only paired BLE (USB, UART and WiFi get the device info and nothing else) and its rescue CLI refuses `set pin`. Only half of it: [locked-bootloader.md](locked-bootloader.md) |
|
||||
| `LOGIN_FAIL_MAX`, `LOGIN_FAIL_SECS` | `4`, `180` (s) | after that many wrong passwords in the window no password is checked until it ends (an admin already in the ACL always gets in) |
|
||||
| `NRF52_POWER_MANAGEMENT` | upstream: off; on in `SenseCap_Solar_repeater` (the masts) | boot protection: below `PWRMGT_VOLTAGE_BOOTLOCK` (SenseCAP: 3300 mV) the node does not start but sleeps in SYSTEMOFF until the battery recovers. Only at boot, nothing switches off a running node -- see [power.md](power.md) |
|
||||
| `NRF52_POWER_MANAGEMENT`, `PWRMGT_RUNTIME` | upstream: off; on in `SenseCap_Solar_repeater` (the masts) | boot protection, and with `PWRMGT_RUNTIME` the runtime `pwr.bootlock` / `pwr.cutoff` above |
|
||||
| `PWRMGT_BOOTLOCK_DEFAULT`, `PWRMGT_CUTOFF_DEFAULT` | `PWRMGT_VOLTAGE_BOOTLOCK` (SenseCAP 3300), `0` (mV) | thresholds for a node without `/pwr_guard` |
|
||||
|
||||
Prefs saved on the node override the build defaults: a reflash keeps what a
|
||||
node already has; only a new node or one after `erase` takes them.
|
||||
Reference in new issue
Block a user