a1ex avatar a1ex committed a3aa646

fio-ml: fix and refactor startup warnings; on 5D3, default to SD card if you insert two ML cards

Comments (0)

Files changed (1)

 }
 #endif
 
+static void startup_warning(char* msg)
+{
+    /* note: this function is called before load_fonts, so in order to print something, we need to load them */
+    load_fonts();
+    
+    if (!DISPLAY_IS_ON)
+    {
+        /* force playback mode if we start with display off */
+        SetGUIRequestMode(1);
+        msleep(1000);
+    }
+    
+    bmp_printf(FONT_LARGE, 0, 0, msg);
+    redraw_after(5000);
+}
+
 void find_ml_card()
 {
     int ml_cf = is_dir("A:/ML");
     {
         /* autoexec.bin gets loaded from the SD card first */
         ML_CARD = &available_cards[CARD_B];
-
-        /* note: this function is called before load_fonts, so in order to print something, we need to load them */
-        load_fonts();
-        clrscr();
-        bmp_printf(FONT_CANON, 0, 0, "Two ML cards - loading from SD.");
-        msleep(1000);
+        startup_warning("ML on both cards, loading from SD.");
     }
     else
     {
-        load_fonts();
-        clrscr();
-        for (int i = 0; i < 5; i++)
-        {
-            bmp_printf(FONT_CANON, 0, 0, "Could not find ML files.");
-            msleep(1000);
-            beep();
-        }
-        redraw_after(2000);
+        startup_warning("Could not find ML files.");
     }
 }
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.