Public Access
The Storage App browses the SD card: folders first with sizes and dates, three sorts, one item at a time with a clipboard (c, x, v), rename, delete after counting what's inside, new folder, details. A listing holds 256 entries and says when a folder has more. FileOps does the card's work for the App and the console alike, one operation at a time on the storage task in turns of about 150 ms, so Logs and Captures are still written during a long copy. A copy shows progress, can be cancelled (what it wrote is taken back) and compares sizes after. The read-only rules are checked there: the firmware's top-level folders, /gemini/cache, and files being written (a Track, a Capture, an upload, today's IRC Logs). A listing reads the folder straight from FatFs: through the Arduino File, 329 entries took over two seconds. Viewers by type: text read a screen at a time whatever the file's size (logs open at the end), a hex dump, a Capture's packets as the LoRa Scanner lists them, a Track's summary, and an Update File checked as an install would check it, without writing anything. Tab shows any file as hex or text. Settings > Storage is gone: usage, Storage Clean-up and Erase are the App's Maintenance, behind a warning. The Storage Warning points there. The Clock sets the system time whatever its source, so files are dated correctly with a GNSS Fix alone (Q137). Console: cp, mv, mkdir, du, cancel; rm takes folders and follows the rules; ls shows dates; Debug Builds get `sd fill`. 424 host tests. Checked on the device: docs/milestones/F1.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
74 lines
2.0 KiB
C++
74 lines
2.0 KiB
C++
#pragma once
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "app.h"
|
|
#include "app_manager.h"
|
|
#include "dialog_model.h"
|
|
#include "event_bus.h"
|
|
#include "line_editor.h"
|
|
#include "list_model.h"
|
|
#include "services/battery_service.h"
|
|
#include "services/clock_service.h"
|
|
#include "services/storage_service.h"
|
|
#include "apps/firmware_page.h"
|
|
#include "apps/wifi_settings_page.h"
|
|
#include "settings_menu.h"
|
|
#include "ui/theme.h"
|
|
|
|
namespace roro {
|
|
|
|
struct SettingsAppDeps {
|
|
Settings& settings;
|
|
EventBus& bus;
|
|
AppManager& apps;
|
|
BatteryService& battery;
|
|
StorageService& storage;
|
|
ClockService& clock;
|
|
WifiService& wifi;
|
|
SavedNetworks& savedNetworks;
|
|
UpdateService& update;
|
|
};
|
|
|
|
// Settings: every user-facing setting, plus the Wi-Fi, Firmware and About pages.
|
|
class SettingsApp : public App {
|
|
public:
|
|
explicit SettingsApp(const SettingsAppDeps& deps)
|
|
: d_(deps),
|
|
menu_(deps.settings),
|
|
wifiPage_(deps.settings, deps.savedNetworks, deps.wifi, deps.bus),
|
|
firmwarePage_(deps.update, deps.wifi, deps.storage) {}
|
|
void onEnter() override;
|
|
bool onKey(const KeyEvent& e) override;
|
|
void update(uint32_t nowMs) override;
|
|
bool textEntryActive() const override {
|
|
return page_ == Page::Text || (page_ == Page::Wifi && wifiPage_.textEntryActive());
|
|
}
|
|
void draw(Canvas& c) override;
|
|
|
|
private:
|
|
enum class Page { Menu, Text, Choice, About, Wifi, Firmware };
|
|
|
|
bool onMenuKey(const KeyEvent& e);
|
|
bool onTextKey(const KeyEvent& e);
|
|
bool onChoiceKey(const KeyEvent& e);
|
|
bool onAboutKey(const KeyEvent& e);
|
|
void warn(const std::string& text);
|
|
std::vector<std::string> aboutLines() const;
|
|
|
|
SettingsAppDeps d_;
|
|
SettingsMenu menu_;
|
|
WifiSettingsPage wifiPage_;
|
|
FirmwarePage firmwarePage_;
|
|
Page page_ = Page::Menu;
|
|
ListModel list_{theme::kContent.h / theme::kLineHeight};
|
|
ListModel choices_{theme::kContent.h / theme::kLineHeight};
|
|
LineEditor editor_{39};
|
|
int editingRow_ = 0;
|
|
uint32_t lastRefreshMs_ = 0;
|
|
};
|
|
|
|
} // namespace roro
|