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:
Maxwell committed 2026-11-08 16:34:54 +02:00
1 parent 9f10793f7a
commit 64f75005b5
14 files changed
+530 -85

No files matched your search

+4 -1
View File
@@ -3,7 +3,7 @@
#include <Arduino.h> // needed for PlatformIO
#include <Mesh.h>
#include "TimeSeriesData.h"
#include <helpers/TimeSeriesData.h>
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
#include <InternalFileSystem.h>
@@ -88,6 +88,7 @@ public:
void sendFloodReply(mesh::Packet* packet, unsigned long delay_millis, uint8_t path_hash_size);
protected:
uint32_t getUptimeSeconds() const { return uptime_millis / 1000; }
// current telemetry data queries
float getVoltage(uint8_t channel) { return getTelemValue(channel, LPP_VOLTAGE); }
float getCurrent(uint8_t channel) { return getTelemValue(channel, LPP_CURRENT); }
@@ -154,6 +155,8 @@ private:
RegionEntry* load_stack[8];
TransportKey default_scope;
uint32_t last_read_time;
uint32_t last_millis;
uint64_t uptime_millis;
int matching_peer_indexes[MAX_SEARCH_RESULTS];
int num_alert_tasks;
Trigger* alert_tasks[MAX_CONCURRENT_ALERTS];