From 587c585ba617304c841f294742ab9d459da608a0 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 31 Jan 2024 16:54:24 +1100 Subject: [PATCH] Don't unmount the sd card as aggressively --- src/system_fsm/running.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/system_fsm/running.cpp b/src/system_fsm/running.cpp index 60103086..14c5f28b 100644 --- a/src/system_fsm/running.cpp +++ b/src/system_fsm/running.cpp @@ -65,9 +65,11 @@ void Running::react(const SdDetectChanged& ev) { if (!sStorage && mountStorage()) { events::Ui().Dispatch(StorageMounted{}); } - } else { - unmountStorage(); } + // Don't automatically unmount, since this event seems to occasionally happen + // supriously. FIXME: Why? + // (It doesn't matter too much; by the time we get this event the SD card has + // already been disconnected electrically.) } void Running::react(const SamdUsbMscChanged& ev) { @@ -144,6 +146,7 @@ auto Running::mountStorage() -> bool { } auto Running::unmountStorage() -> void { + ESP_LOGW(kTag, "unmounting storage"); sServices->database({}); sStorage.reset(); }