mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
* simplified alertIf()
* refactored TimeSeriesData to top-level class
This commit is contained in:
parent
de3e4bc27c
commit
ac834922de
5 changed files with 82 additions and 91 deletions
|
|
@ -21,12 +21,12 @@ protected:
|
|||
void onSensorDataRead() override {
|
||||
float batt_voltage = getVoltage(TELEM_CHANNEL_SELF);
|
||||
|
||||
recordData(battery_data, batt_voltage); // record battery
|
||||
alertIfLow(low_batt, batt_voltage, 3.4f, "Battery low!");
|
||||
battery_data.recordData(getRTCClock(), batt_voltage); // record battery
|
||||
alertIf(batt_voltage < 3.4f, low_batt, "Battery low!");
|
||||
}
|
||||
|
||||
int querySeriesData(uint32_t start_secs_ago, uint32_t end_secs_ago, MinMaxAvg dest[], int max_num) override {
|
||||
calcDataMinMaxAvg(battery_data, start_secs_ago, end_secs_ago, &dest[0], TELEM_CHANNEL_SELF, LPP_VOLTAGE);
|
||||
battery_data.calcDataMinMaxAvg(getRTCClock(), start_secs_ago, end_secs_ago, &dest[0], TELEM_CHANNEL_SELF, LPP_VOLTAGE);
|
||||
return 1;
|
||||
}
|
||||
/* ======================================================================= */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue