feat: power manager with battery monitoring, LED warnings, and sleep modes
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
25
src/power_manager.h
Normal file
25
src/power_manager.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "config.h"
|
||||
|
||||
class PowerManager {
|
||||
public:
|
||||
void begin();
|
||||
uint8_t getBatteryPercent();
|
||||
bool isCharging();
|
||||
void updateBatteryLED();
|
||||
void flashLED(uint8_t r, uint8_t g, uint8_t b, uint16_t duration_ms = LED_PULSE_DURATION_MS);
|
||||
void enterDeepSleep();
|
||||
void enableLightSleep();
|
||||
void disableEPDPower();
|
||||
void enableEPDPower();
|
||||
|
||||
private:
|
||||
uint8_t _lastBatteryPct = 100;
|
||||
unsigned long _lastLEDPulse = 0;
|
||||
uint8_t _ledBrightness = DEFAULT_LED_BRIGHTNESS;
|
||||
|
||||
void setLED(uint8_t index, uint8_t r, uint8_t g, uint8_t b);
|
||||
void clearLEDs();
|
||||
};
|
||||
Reference in New Issue
Block a user