1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-24 00:35:18 +03:00

[Horus] SD hot mount if removed when the radio is ON

This commit is contained in:
Bertrand Songis 2016-08-31 23:06:02 +02:00
parent 90e8748e12
commit 830593d62e
14 changed files with 27 additions and 7 deletions

View file

@ -413,23 +413,30 @@ void perMain()
#if defined(RAMBACKUP)
if (unexpectedShutdown) {
lcd->clear();
lcdDrawText(LCD_W/2, LCD_H/2-20, "EMERGENCY MODE", DBLSIZE|CENTERED|TEXT_BGCOLOR);
lcdRefresh();
drawFatalErrorScreen(STR_EMERGENCY_MODE);
return;
}
#endif
#if defined(PCBHORUS)
// TODO if it is OK on HORUS it could be ported to all other boards
// But in this case it's needed to define sdMount for all boards, because sdInit also initializes the SD mutex
static uint32_t sdcard_present_before = SD_CARD_PRESENT();
uint32_t sdcard_present_now = SD_CARD_PRESENT();
if (sdcard_present_now && !sdcard_present_before) {
sdMount();
}
sdcard_present_before = sdcard_present_now;
#endif
#if !defined(EEPROM)
// In case the SD card is removed during the session
if (!SD_CARD_PRESENT()) {
lcd->clear();
lcdDrawText(LCD_W/2, LCD_H/2-20, STR_NO_SDCARD, DBLSIZE|CENTERED|TEXT_BGCOLOR);
lcdRefresh();
drawFatalErrorScreen(STR_NO_SDCARD);
return;
}
#endif
#if defined(USB_MASS_STORAGE)
if (usbPlugged()) {
// disable access to menus