Storage: format the SD card as one FAT32 partition

Repartitions the whole card (f_fdisk + f_mkfs) on the storage task.
Temporarily triggered from the diagnostics screen by typing FORMAT and
Enter; moves to Settings > Storage in step 7.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
2026-10-02 10:17:41 +02:00
co-authored by Claude Opus 5.5
parent 44de78ea62
commit 36ebd23417
3 changed files with 56 additions and 3 deletions
+9 -1
View File
@@ -12,21 +12,29 @@ namespace roro {
// Runs on its own task: a failed mount blocks for seconds and must never stall the UI.
class StorageService : public Service {
public:
explicit StorageService(EventBus& bus) : monitor_(bus) {}
explicit StorageService(EventBus& bus) : monitor_(bus), bus_(bus) {}
const char* name() const override { return "storage"; }
void start() override;
void stop() override;
StorageState state() const;
// Erases the whole card: one partition spanning the card, formatted FAT32. Runs on the storage
// task; the result arrives as a Notification. Returns false if a format is already pending.
bool requestFormat();
bool formatting() const { return formatRequested_; }
private:
static constexpr uint32_t kPollMs = 15000;
static void taskEntry(void* self);
void poll();
bool mount();
void format();
StorageMonitor monitor_;
bool mounted_ = false;
EventBus& bus_;
volatile bool formatRequested_ = false;
TaskHandle_t task_ = nullptr;
mutable SemaphoreHandle_t lock_ = nullptr;
};