From 859f2d9591867bd579605e151a574879e7b5942c Mon Sep 17 00:00:00 2001 From: schneider Date: Sat, 17 Dec 2011 22:25:21 +0100 Subject: [PATCH] format fs when filesystem is broken --- firmware/filesystem/util.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/firmware/filesystem/util.c b/firmware/filesystem/util.c index 5fd246a..f89d2d8 100644 --- a/firmware/filesystem/util.c +++ b/firmware/filesystem/util.c @@ -21,7 +21,23 @@ const char* f_get_rc_string (FRESULT rc) { void fsInit(){ + FRESULT i; + DIR dir; /* Directory object */ f_mount(0, &FatFs); + + i = f_opendir(&dir, "0:"); + + if( i == FR_NO_FILESYSTEM ){ + lcdPrintln("Could not mount"); + lcdPrintln("filesystem."); + lcdPrintln("Formating..."); + lcdRefresh(); + format_formatDF(); + lcdPrintln("done"); + lcdPrintln("Please reboot"); + lcdRefresh(); + while(1); + } }; void fsReInit(){