Public Access
Keys: one table file for the device's help panel and the website's key tables (#72)
Every screen's keys are constant tables in lib/core/src/app_keys.h (52 of them, each under an `// id: Title` comment). An App's help() picks the table of the state it is in. site/tools/gen_dev_docs.py reads the same file and writes site/data/keys.toml; the `keys` shortcode shows a screen's tables on its guide page, and /guide/keys/ shows all of them. The Site job fails when the data file is out of date or a page asks for a table that doesn't exist, and now also runs when app_keys.h changes. A key added to an App shows up on the website without anyone editing a page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
#include "app_keys.h"
|
||||
#include "file_viewer.h"
|
||||
|
||||
#include <Arduino.h>
|
||||
@@ -266,27 +267,15 @@ void FileViewer::openPacket(int index) {
|
||||
}
|
||||
|
||||
void FileViewer::help(std::vector<KeyHelp>& out) const {
|
||||
if (confirm_) return help::dialog(out);
|
||||
if (confirm_) return keys::add(out, keys::kDialog);
|
||||
switch (mode_) {
|
||||
case Mode::Packet:
|
||||
out.push_back({"; .", "scroll"});
|
||||
out.push_back({"Enter", "back to the packets"});
|
||||
return;
|
||||
case Mode::Text:
|
||||
case Mode::Hex:
|
||||
out.push_back({"; .", "a line up, down"});
|
||||
out.push_back({", /", "a page up, down"});
|
||||
out.push_back({"t b", "the top, the end"});
|
||||
if (mode_ == Mode::Text) out.push_back({"e", "edit it (up to 16 KB)"});
|
||||
break;
|
||||
case Mode::Pcap:
|
||||
help::list(out, "the packet");
|
||||
out.push_back({", /", "a page up, down"});
|
||||
break;
|
||||
case Mode::Ota: out.push_back({"Enter", "install it, if it's genuine"}); break;
|
||||
case Mode::Gpx: break;
|
||||
case Mode::Text: keys::add(out, keys::kViewerText); break;
|
||||
case Mode::Hex: keys::add(out, keys::kViewerHex); break;
|
||||
case Mode::Pcap: keys::add(out, keys::kViewerPcap); break;
|
||||
case Mode::Packet: keys::add(out, keys::kViewerPacket); break;
|
||||
case Mode::Gpx: keys::add(out, keys::kViewerGpx); break;
|
||||
case Mode::Ota: keys::add(out, keys::kViewerOta); break;
|
||||
}
|
||||
out.push_back({"Tab", mode_ != base_ ? "back to the file's own view" : base_ == Mode::Hex || base_ == Mode::Gpx ? "the file as text" : "the file as hex"});
|
||||
}
|
||||
|
||||
bool FileViewer::onKey(const KeyEvent& e) {
|
||||
|
||||
Reference in New Issue
Block a user