feat: power manager with battery monitoring, LED warnings, and sleep modes
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
15
src/main.cpp
15
src/main.cpp
@@ -3,9 +3,11 @@
|
||||
#include "config.h"
|
||||
#include "settings.h"
|
||||
#include "wifi_manager.h"
|
||||
#include "power_manager.h"
|
||||
|
||||
SettingsManager settingsManager;
|
||||
WiFiManager wifiManager;
|
||||
PowerManager powerManager;
|
||||
|
||||
void setup() {
|
||||
auto cfg = M5.config();
|
||||
@@ -14,21 +16,18 @@ void setup() {
|
||||
Serial.begin(115200);
|
||||
Serial.println("[main] Immich Frame booting...");
|
||||
|
||||
pinMode(PIN_AUDIO_PWR_EN, OUTPUT);
|
||||
digitalWrite(PIN_AUDIO_PWR_EN, LOW);
|
||||
pinMode(PIN_SPK_EN, OUTPUT);
|
||||
digitalWrite(PIN_SPK_EN, LOW);
|
||||
|
||||
powerManager.begin();
|
||||
settingsManager.begin();
|
||||
wifiManager.begin(settingsManager);
|
||||
|
||||
Serial.printf("[main] WiFi mode: %s, IP: %s\n",
|
||||
wifiManager.isAPMode() ? "AP" : "Station",
|
||||
wifiManager.getIP().c_str());
|
||||
Serial.printf("[main] Battery: %d%%, Charging: %s\n",
|
||||
powerManager.getBatteryPercent(),
|
||||
powerManager.isCharging() ? "yes" : "no");
|
||||
Serial.println("[main] Boot complete");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
M5.update();
|
||||
powerManager.updateBatteryLED();
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user