Public Access
- EcdsaVerifier (mbedTLS, embedded public key) and EspOtaSink (writes the inactive app slot, esp_ota_end validates the image, then sets the boot partition) - UpdateService: listens on TCP 3232 (and mDNS roro9stack-<id>) while Wi-Fi is Connected; streams into UpdateParser; replies OK/ERR to the sender; remembers the pending version so a Rollback is reported after the reboot - Probation (host-tested): confirm after the first frame + 30 s + Wi-Fi (if configured); roll back if configured Wi-Fi never connects in 3 min - Main loop: full-screen progress while receiving; restart once installed, waiting up to 60 s for Text Entry to end - Settings > Firmware: version, Probation status, push address and name, and the .ota files in /updates on the SD card to install - StorageService.runJob() runs work on the storage task (SD installs) - wifi status prints IP and running version; RORO_TEST_CRASH test hook Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
46 lines
1.6 KiB
C++
46 lines
1.6 KiB
C++
#include "screen.h"
|
|
|
|
#include <M5Cardputer.h>
|
|
|
|
#include "fonts.h"
|
|
|
|
namespace roro {
|
|
|
|
bool Screen::begin() {
|
|
canvas_.setColorDepth(8); // RGB332: saves 32 KB of RAM (M1 Q46); theme colours are converted
|
|
canvas_.setPsram(false);
|
|
return canvas_.createSprite(theme::kWidth, theme::kHeight) != nullptr;
|
|
}
|
|
|
|
void Screen::render(AppManager& apps, const StatusInfo& status, const Toast* toast) {
|
|
canvas_.fillSprite(theme::kBackground);
|
|
const auto& area = theme::kContent;
|
|
canvas_.setClipRect(area.x, area.y, area.w, area.h);
|
|
apps.foreground().draw(canvas_);
|
|
canvas_.clearClipRect();
|
|
widgets::statusBar(canvas_, status);
|
|
if (toast) widgets::toast(canvas_, *toast);
|
|
canvas_.pushSprite(&M5Cardputer.Display, 0, 0);
|
|
}
|
|
|
|
void Screen::renderUpdate(const std::string& title, const std::string& detail, int percent) {
|
|
canvas_.fillSprite(theme::kBackground);
|
|
canvas_.setTextDatum(top_center);
|
|
canvas_.setFont(&fonts::bold);
|
|
canvas_.setTextColor(theme::kAccent);
|
|
canvas_.drawString(title.c_str(), theme::kWidth / 2, 34);
|
|
canvas_.setFont(&fonts::body);
|
|
canvas_.setTextColor(theme::kText);
|
|
canvas_.drawString(detail.c_str(), theme::kWidth / 2, 56);
|
|
if (percent >= 0) {
|
|
const int x = 20, y = 82, w = theme::kWidth - 40, h = 12;
|
|
canvas_.drawRect(x, y, w, h, theme::kMuted);
|
|
canvas_.fillRect(x + 1, y + 1, (w - 2) * percent / 100, h - 2, theme::kAccent);
|
|
canvas_.drawString((std::to_string(percent) + "%").c_str(), theme::kWidth / 2, y + 18);
|
|
}
|
|
canvas_.setTextDatum(top_left);
|
|
canvas_.pushSprite(&M5Cardputer.Display, 0, 0);
|
|
}
|
|
|
|
} // namespace roro
|