Add min/max/avg history queries to repeaters
Move TimeSeriesData from simple_sensor into src/helpers and drive it with monotonic uptime, so RTC changes cannot stall recording or break queries. Keep the old RTCClock* overloads as deprecated for custom sensor sketches. Record 24h of battery, noise floor, TX/RX airtime % and MCU temperature on repeaters and answer the existing 0x04 min/max/avg request using the same format as sensor nodes. No packets are sent by this feature. REPEATER_HISTORY_SLOTS=0 removes it; default off on STM32/RP2040. Add native tests for TimeSeriesData and document the request and channels.
This commit is contained in:
1 parent
9f10793f7a
commit
64f75005b5
14 files changed
+530
-85
No files matched your search
@@ -37,6 +37,22 @@
|
||||
#include <helpers/RoutingPolicy.h>
|
||||
#include "RateLimiter.h"
|
||||
|
||||
#ifndef REPEATER_HISTORY_SLOTS
|
||||
#if defined(STM32_PLATFORM) || defined(RP2040_PLATFORM)
|
||||
#define REPEATER_HISTORY_SLOTS 0
|
||||
#else
|
||||
#define REPEATER_HISTORY_SLOTS 288
|
||||
#endif
|
||||
#endif
|
||||
#ifndef REPEATER_HISTORY_INTERVAL_SECS
|
||||
#define REPEATER_HISTORY_INTERVAL_SECS 300
|
||||
#endif
|
||||
|
||||
#if REPEATER_HISTORY_SLOTS > 0
|
||||
#include <helpers/TimeSeriesData.h>
|
||||
static_assert(REPEATER_HISTORY_INTERVAL_SECS > 0, "History interval must be positive");
|
||||
#endif
|
||||
|
||||
#ifdef WITH_BRIDGE
|
||||
extern AbstractBridge* bridge;
|
||||
#endif
|
||||
@@ -82,6 +98,16 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
|
||||
FILESYSTEM* _fs;
|
||||
uint32_t last_millis;
|
||||
uint64_t uptime_millis;
|
||||
#if REPEATER_HISTORY_SLOTS > 0
|
||||
// Dedicated history channels 200..204; environment telemetry occupies 1..17.
|
||||
enum { HISTORY_BATTERY = 200, HISTORY_NOISE, HISTORY_TX, HISTORY_RX, HISTORY_TEMPERATURE };
|
||||
TimeSeriesData battery_history, noise_history, tx_history, rx_history, temperature_history;
|
||||
uint32_t history_last_secs, history_battery_secs, history_airtime_secs;
|
||||
uint32_t history_tx_millis, history_rx_millis;
|
||||
float history_battery_total;
|
||||
uint32_t history_battery_count;
|
||||
void recordHistory();
|
||||
#endif
|
||||
unsigned long next_local_advert, next_flood_advert;
|
||||
bool _logging;
|
||||
NodePrefs _prefs;
|
||||
|
||||
Reference in new issue
Block a user