mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-11-22 03:17:07 +00:00
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
4deb88dfe8
commit
25c1867bbd
14 files changed
+530
-85
No files matched your search
@@ -21,13 +21,14 @@ protected:
|
||||
void onSensorDataRead() override {
|
||||
float batt_voltage = getVoltage(TELEM_CHANNEL_SELF);
|
||||
|
||||
battery_data.recordData(getRTCClock(), batt_voltage); // record battery
|
||||
battery_data.recordData(getUptimeSeconds(), batt_voltage); // record battery
|
||||
alertIf(batt_voltage < 3.4f, critical_batt, HIGH_PRI_ALERT, "Battery is critical!");
|
||||
alertIf(batt_voltage < 3.6f, low_batt, LOW_PRI_ALERT, "Battery is low");
|
||||
}
|
||||
|
||||
int querySeriesData(uint32_t start_secs_ago, uint32_t end_secs_ago, MinMaxAvg dest[], int max_num) override {
|
||||
battery_data.calcMinMaxAvg(getRTCClock(), start_secs_ago, end_secs_ago, &dest[0], TELEM_CHANNEL_SELF, LPP_VOLTAGE);
|
||||
battery_data.calcMinMaxAvg(getUptimeSeconds(), start_secs_ago, end_secs_ago, &dest[0], TELEM_CHANNEL_SELF,
|
||||
LPP_VOLTAGE);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user