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
@@ -19,6 +19,11 @@
|
||||
// get radio.txstall TX stall watchdog: threshold, queue, time without TX
|
||||
// set radio.txstall <min> 0/off = disabled; RAM only, RADIO_TXSTALL_MIN at boot
|
||||
// get boot why the board last reset, and the hardfault record
|
||||
// get pwr battery thresholds, battery now and at boot, last shutdown
|
||||
// set pwr.bootlock <mV> don't start below it, sleep until the battery recovers
|
||||
// set pwr.cutoff <mV> switch a running node off below it; 0/off = disabled
|
||||
// (both only with -D PWRMGT_RUNTIME, nRF52 power management,
|
||||
// see helpers/LowVoltageGuard.h)
|
||||
//
|
||||
// Wiring (see simple_sensor/main.cpp):
|
||||
// setup(): maint.printBootDiag() early, maint.begin(fs, prefs, cb) after the
|
||||
@@ -34,6 +39,11 @@
|
||||
#include <helpers/FwUpdate.h>
|
||||
#endif
|
||||
#include <helpers/RadioSilenceWatchdog.h>
|
||||
#include <helpers/LowVoltageGuard.h>
|
||||
#if defined(NRF52_PLATFORM) && defined(NRF52_POWER_MANAGEMENT) && defined(PWRMGT_RUNTIME)
|
||||
#include <helpers/NRF52Board.h>
|
||||
#define NODE_PWR_GUARD 1
|
||||
#endif
|
||||
#include <helpers/radiolib/RadioLibWrappers.h>
|
||||
|
||||
class NodeMaintenance {
|
||||
@@ -77,6 +87,13 @@ private:
|
||||
void txStallTick(int tx_queued, int tx_due);
|
||||
bool txStallCommand(const char* command, char* reply);
|
||||
void dfuTick();
|
||||
#ifdef NODE_PWR_GUARD
|
||||
void pwrBegin();
|
||||
void pwrTick();
|
||||
void pwrSave();
|
||||
bool pwrCommand(const char* command, char* reply);
|
||||
NRF52Board& nrf() { return static_cast<NRF52Board&>(_board); }
|
||||
#endif
|
||||
|
||||
mesh::MainBoard& _board;
|
||||
RadioLibWrapper& _radio;
|
||||
@@ -90,6 +107,9 @@ private:
|
||||
RadioSilenceWatchdog _silence;
|
||||
uint32_t _silence_reboots = 0;
|
||||
RadioSilenceWatchdog _txstall; // same staging, `activity` = packets sent
|
||||
#ifdef NODE_PWR_GUARD
|
||||
LowVoltageGuard _pwr;
|
||||
#endif
|
||||
int _tx_queued = -1, _tx_due = -1;
|
||||
|
||||
unsigned long _dfu_at = 0; // 0 = nothing armed
|
||||
|
||||
Reference in new issue
Block a user