feat: add deep sleep batch caching, wake log, and log viewer tools
- Batch-fetch asset IDs in deep sleep mode with NVS caching to reduce network calls and improve battery life (configurable batch size 1-50) - Add wake_log module: persistent CSV log of each photo cycle surviving reboots and deep sleep, with download/clear via web UI - Add browser-based log viewer and log comparison tools (tools/) - Update .gitignore to exclude .cursor/, chat-summaries/, wake_*.csv, and .DS_Store Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -189,6 +189,22 @@ void AppWebServer::setupAPIRoutes() {
|
||||
req->send(200, "application/json", "{\"ok\":true,\"msg\":\"RTC synced\"}");
|
||||
});
|
||||
|
||||
// Wake log endpoints
|
||||
_server.on("/api/log", HTTP_GET,
|
||||
[](AsyncWebServerRequest* req) {
|
||||
if (LittleFS.exists("/wake_log.csv")) {
|
||||
req->send(LittleFS, "/wake_log.csv", "text/csv");
|
||||
} else {
|
||||
req->send(200, "text/csv", "");
|
||||
}
|
||||
});
|
||||
|
||||
_server.on("/api/log/clear", HTTP_POST,
|
||||
[](AsyncWebServerRequest* req) {
|
||||
LittleFS.remove("/wake_log.csv");
|
||||
req->send(200, "application/json", "{\"ok\":true,\"msg\":\"Log cleared\"}");
|
||||
});
|
||||
|
||||
_server.on("/api/action/reboot", HTTP_POST,
|
||||
[](AsyncWebServerRequest* req) {
|
||||
req->send(200, "application/json", "{\"ok\":true,\"msg\":\"Rebooting...\"}");
|
||||
@@ -300,6 +316,7 @@ void AppWebServer::handleGetSettings(AsyncWebServerRequest* request) {
|
||||
doc["immich_url"] = s.immich_url;
|
||||
doc["immich_key"] = s.immich_key;
|
||||
doc["albums_json"] = s.albums_json;
|
||||
doc["timer_batch_size"] = s.timer_batch_size;
|
||||
|
||||
String response;
|
||||
serializeJson(doc, response);
|
||||
@@ -334,6 +351,10 @@ void AppWebServer::handlePostSettings(AsyncWebServerRequest* request,
|
||||
if (!doc["show_battery"].isNull()) s.show_battery = doc["show_battery"];
|
||||
if (!doc["immich_url"].isNull()) s.immich_url = doc["immich_url"].as<String>();
|
||||
if (!doc["immich_key"].isNull()) s.immich_key = doc["immich_key"].as<String>();
|
||||
if (!doc["timer_batch_size"].isNull()) {
|
||||
uint8_t v = doc["timer_batch_size"];
|
||||
s.timer_batch_size = constrain(v, 1, 50);
|
||||
}
|
||||
|
||||
_settings->save(s);
|
||||
request->send(200, "application/json", "{\"ok\":true}");
|
||||
|
||||
Reference in New Issue
Block a user