From 93a83789f0fa5ff3ca3bae0291651056f7c6b2f3 Mon Sep 17 00:00:00 2001 From: cottongin Date: Mon, 3 Aug 2026 11:01:04 -0400 Subject: [PATCH] fix: add reboot endpoint and test documentation Co-authored-by: Cursor --- src/web_server.cpp | 7 +++++++ test/README.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 test/README.md diff --git a/src/web_server.cpp b/src/web_server.cpp index c24f51f..59f6de3 100644 --- a/src/web_server.cpp +++ b/src/web_server.cpp @@ -135,6 +135,13 @@ void AppWebServer::setupAPIRoutes() { delay(100); _power->enterDeepSleep(); }); + + _server.on("/api/action/reboot", HTTP_POST, + [](AsyncWebServerRequest* req) { + req->send(200, "application/json", "{\"ok\":true,\"msg\":\"Rebooting...\"}"); + delay(500); + ESP.restart(); + }); } void AppWebServer::setupStaticFiles() { diff --git a/test/README.md b/test/README.md new file mode 100644 index 0000000..d825fed --- /dev/null +++ b/test/README.md @@ -0,0 +1,44 @@ +# Testing + +## Native Tests (host machine) + +Run algorithm tests that don't require hardware: + +```bash +pio test -e native +``` + +Tests: + +- `test_photo_queue.cpp` — queue cycling, favorites weighting +- `test_image_pipeline.cpp` — nearest color, dithering correctness + +## On-Device Testing + +Flash and monitor: + +```bash +pio run -e m5stack-papercolor -t upload && pio device monitor +``` + +### Verification Checklist + +- [ ] Device boots and prints version to serial +- [ ] AP mode activates on first boot +- [ ] Captive portal serves setup page at 192.168.4.1 +- [ ] WiFi credentials save and device reboots to station mode +- [ ] mDNS resolves at papercolor.local +- [ ] Web UI dashboard shows battery/WiFi/uptime +- [ ] Albums page lists Immich albums +- [ ] Album selection persists across reboots +- [ ] Photos download and display correctly +- [ ] Portrait photos pair side-by-side +- [ ] Slideshow advances at configured interval +- [ ] BTN_UP: next photo (LED flashes white) +- [ ] BTN_TOP: random photo (LED flashes white) +- [ ] BTN_DOWN: pause/play toggle +- [ ] BTN_TOP+BTN_DOWN 3s: deep sleep +- [ ] BTN_UP 5s: factory reset +- [ ] Battery LED: orange at 25%, red at 10% +- [ ] OTA upload succeeds via web UI +- [ ] Device recovers from WiFi disconnect (reconnect on next cycle)