This commit is contained in:
Joshua King
2026-02-10 21:31:36 -05:00
parent b2752b8f72
commit 08a2ee0852
6 changed files with 64 additions and 20 deletions

View File

@@ -10,6 +10,7 @@ public:
int percent() const { return _percent; }
float voltage() const { return _voltage; }
bool isLow() const { return _isLow; }
bool isCharging() const { return _isCharging; }
bool shouldBlink() const;
// For display
@@ -18,6 +19,7 @@ public:
private:
static constexpr int PIN_BATTERY_ADC = 2; // Voltage divider input
static constexpr int PIN_LBO = 5; // PowerBoost LBO pin
static constexpr int PIN_CHG = 4; // PowerBoost CHG pin (LOW when charging)
static constexpr unsigned long CHECK_INTERVAL_MS = 2000;
static constexpr int SAMPLES = 10; // Number of ADC samples to average
@@ -33,6 +35,7 @@ private:
int _percent = 100;
float _voltage = 3.7;
bool _isLow = false;
bool _isCharging = false;
unsigned long _lastCheckMs = 0;
float readBatteryVoltage();