Files
roro9stack/src/apps/firmware_page.h
T
twislaandClaude Opus 5.5 7fe8b3d22a
CI / build (pull_request) Successful in 7m22s
Site / build (pull_request) Successful in 14s
Help: Fn+h lists the keys of the screen you're on, and no screen names its keys any more (#69)
Fn+h on any screen, text fields included, and ? outside Text Entry, open a
panel over the content area: the screen's own keys, then the ones that work
everywhere. Every App declares its keys for the state it is in (pages,
viewers, dialogs and text fields answer for themselves); the App manager
opens the panel and takes every key while it is open.

About 30 hint lines are gone, from every App. What stays on a screen is
state. The first-start Setup keeps its hints and teaches the key; a device
set up before gets one Toast, once. The guide and the FAQ open with it.
`key help` over the consoles.

476 host tests (8 new). Checked on the device with key help and screenshots:
the Launcher, all nine Apps and several of their states. 8.5 KB of flash and
40 bytes of static RAM. Decisions Q196 to Q203 in docs/milestones/U1.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
2026-10-07 01:29:51 +02:00

72 lines
2.2 KiB
C++

#pragma once
#include <memory>
#include <mutex>
#include <string>
#include <vector>
#include "dialog_model.h"
#include "key_event.h"
#include "key_help.h"
#include "list_model.h"
#include "release_info.h"
#include "services/storage_service.h"
#include "services/update_service.h"
#include "services/wifi_service.h"
#include "ui/canvas.h"
#include "ui/theme.h"
namespace roro {
// Settings → Firmware: the running version and its Probation, where to push Firmware Updates, the
// project's releases on Gitea (the latest, and the ten before it), and the Update Files on the SD
// card (in /updates) to install from.
class FirmwarePage {
public:
FirmwarePage(UpdateService& update, WifiService& wifi, StorageService& storage)
: update_(update), wifi_(wifi), storage_(storage) {}
void enter();
bool onKey(const KeyEvent& e); // false: leave the page
void draw(Canvas& c);
void help(std::vector<KeyHelp>& out) const;
const char* helpTitle() const;
private:
enum Row { kVersion, kStatus, kAddress, kLatest, kOlder, kSdHeader, kFixed };
enum class View { Main, Release, Older };
enum class Ask { None, SdFile, Release };
std::vector<std::string> files();
std::string latestText(bool& warn) const;
void openRelease(const release::Release& r);
bool installable(std::string& why) const; // the shown release: can it be installed from here?
void drawMain(Canvas& c);
void drawRelease(Canvas& c);
void drawOlder(Canvas& c);
void say(const std::string& text);
UpdateService& update_;
WifiService& wifi_;
StorageService& storage_;
ListModel list_{theme::kContent.h / theme::kLineHeight};
ListModel older_{(theme::kContent.h - 11) / theme::kLineHeight}; // above the hint line
std::unique_ptr<DialogModel> confirm_;
Ask ask_ = Ask::None;
View view_ = View::Main;
release::Release shown_; // the release page
std::vector<release::Release> olderReleases_;
uint32_t olderSeq_ = 0;
int shownTop_ = 0;
std::string message_;
uint32_t messageMs_ = 0;
// Filled on the storage task.
std::mutex lock_;
std::vector<std::string> files_;
bool listed_ = false;
};
} // namespace roro