feat(battery): add option to smooth power for more stable time_remaining estimates

This commit is contained in:
Benji-clm
2026-01-09 13:02:28 +00:00
parent 06484547d1
commit 7f63a905a1
2 changed files with 35 additions and 1 deletions
+6
View File
@@ -9,6 +9,7 @@
#include <sys/poll.h>
#include <algorithm>
#include <chrono>
#include <fstream>
#include <string>
#include <vector>
@@ -51,6 +52,11 @@ class Battery : public ALabel {
bool warnFirstTime_{true};
bool weightedAverage_{true};
const Bar& bar_;
bool smoothPowerEnable_{false};
double time_constant_s_{260.0};
double smooth_power_{0.0}; // µW
std::chrono::steady_clock::time_point last_t_{std::chrono::steady_clock::now()};
std::string old_status_raw_{""};
util::SleeperThread thread_;
util::SleeperThread thread_battery_update_;