Add an hourly emergency battery sleep schedule for infrastructure nodes
This commit is contained in:
1 parent
744692fb93
commit
0c7dec9f19
30 files changed
+2020
-33
No files matched your search
@@ -3,6 +3,10 @@
|
||||
#include <Arduino.h> // needed for PlatformIO
|
||||
#include <Mesh.h>
|
||||
#include <helpers/PowerSavingDiagnostics.h>
|
||||
#include <helpers/EmergencyOtaWork.h>
|
||||
#if MESH_ENABLE_EMERGENCY_POWER && defined(ENABLE_OTA)
|
||||
#include <helpers/ota/OtaContext.h>
|
||||
#endif
|
||||
|
||||
#include "TimeSeriesData.h"
|
||||
|
||||
@@ -86,6 +90,18 @@ public:
|
||||
const char* getRole() override { return FIRMWARE_ROLE; }
|
||||
const char* getNodeName() { return _prefs.node_name; }
|
||||
NodePrefs* getNodePrefs() { return &_prefs; }
|
||||
#if MESH_ENABLE_EMERGENCY_POWER
|
||||
mesh::power::EmergencyOtaWork _emergency_ota_work;
|
||||
CommonCLI& getPowerCLI() { return _cli; }
|
||||
bool emergencyPowerBusy() const {
|
||||
#if defined(ENABLE_OTA)
|
||||
if (_emergency_ota_work.busy(mesh::ota::ota_context_if_active(), millis())) return true;
|
||||
#endif
|
||||
return hasPendingOtaApply() || _cli.hasPendingRadioSettings()
|
||||
|| _cli.hasActiveUserGpioTimer() || dirty_contacts_expiry != 0
|
||||
|| (saved_radio_apply_pending && !temp_radio_applied);
|
||||
}
|
||||
#endif
|
||||
uint32_t getPowerSaveSleepSeconds(uint32_t max_secs) const;
|
||||
uint32_t getPowerSaveSleepMilliseconds(uint32_t max_ms) const;
|
||||
bool isTrackerModeEnabled() const {
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <helpers/HostKiss.h>
|
||||
#include <helpers/MorseLoopPolicy.h>
|
||||
#include <helpers/PowerManagementUtils.h>
|
||||
#include <helpers/EmergencyPowerRuntime.h>
|
||||
#if defined(NRF52_PLATFORM) && MESH_ENABLE_SENSOR_TRACKER
|
||||
#include <utility/SoftwareTimer.h>
|
||||
static SoftwareTimer tracker_wake_timer;
|
||||
@@ -412,6 +413,18 @@ void loop() {
|
||||
mesh::power::serviceRegulatorSettings();
|
||||
board.loop(); // let the board feed its watchdog, run periodic housekeeping
|
||||
|
||||
#if MESH_ENABLE_EMERGENCY_POWER
|
||||
static mesh::power::EmergencyPowerRuntime emergency_power;
|
||||
#if defined(ESP32_PLATFORM)
|
||||
board.servicePowerTestControls();
|
||||
#endif
|
||||
rtc_clock.tick();
|
||||
#ifdef HAS_EXTERNAL_WATCHDOG
|
||||
external_watchdog.loop();
|
||||
#endif
|
||||
if (emergency_power.service(the_mesh, radio_driver, board,
|
||||
the_mesh.getPowerCLI(), command[0], the_mesh.emergencyPowerBusy())) return;
|
||||
#endif
|
||||
the_mesh.loop();
|
||||
const bool morse_timing = mesh::morseTimingActive(&radio_driver);
|
||||
#if defined(USE_LR2021)
|
||||
@@ -442,7 +455,9 @@ void loop() {
|
||||
#endif
|
||||
|
||||
#if defined(ESP32_PLATFORM)
|
||||
#if !MESH_ENABLE_EMERGENCY_POWER
|
||||
board.servicePowerTestControls();
|
||||
#endif
|
||||
mesh::esp32::serviceCpuFrequencyPolicy(board, the_mesh.getNodePrefs()->cpu_freq_mhz,
|
||||
the_mesh.getNodePrefs()->powersaving_enabled != 0, millis(), false, the_mesh.isDualRadioActive());
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user