You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/frameworks/sdcard-manager.md
+40Lines changed: 40 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -221,6 +221,46 @@ class RetroLauncher(Activity):
221
221
222
222
([View on GitHub](https://github.com/MicroPythonOS/MicroPythonOS/blob/main/internal_filesystem/apps/com.micropythonos.doom_launcher/retrogo_launcher.py#L122))
223
223
224
+
### Handling Mount Failures
225
+
226
+
When `mount()` returns `False`, you may want to ask the user before attempting a destructive format:
227
+
228
+
```python
229
+
from mpos import SDCardManager
230
+
import lvgl as lv
231
+
232
+
233
+
defensure_sd_mounted():
234
+
"""Mount SD card, with confirmation dialog for format on failure."""
235
+
if SDCardManager.mount():
236
+
returnTrue
237
+
238
+
mbox = lv.msgbox()
239
+
mbox.add_title("SD Card Error")
240
+
mbox.add_text("Could not mount SD card.\n\nFormat it now?\nAll data will be lost.")
0 commit comments