Fix SDcard size and format issue (#5004)

* - fix overflow in SDcard size computation
- fix format function
- implement more informative format error handling

* Move to a function
This commit is contained in:
3djc
2017-06-14 23:33:31 +02:00
committed by Bertrand Songis
parent 547606b44e
commit 656daa75fa
4 changed files with 38 additions and 14 deletions
@@ -174,14 +174,10 @@ void menuRadioSdManager(event_t _event)
#if defined(CPUARM)
audioQueue.stopSD();
#endif
BYTE work[_MAX_SS];
if (f_mkfs(0, FM_FAT32, 0, work, sizeof(work)) == FR_OK) {
if(sdCardFormat()) {
f_chdir("/");
REFRESH_FILES();
}
else {
POPUP_WARNING(STR_SDCARD_ERROR);
}
}
#if LCD_DEPTH > 1
@@ -190,7 +186,7 @@ void menuRadioSdManager(event_t _event)
event_t event = (EVT_KEY_MASK(_event) == KEY_ENTER ? 0 : _event);
SIMPLE_MENU(SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD, menuTabGeneral, MENU_RADIO_SD_MANAGER, HEADER_LINE + reusableBuffer.sdmanager.count);
switch (_event) {
case EVT_ENTRY:
f_chdir(ROOT_PATH);
@@ -199,11 +195,11 @@ void menuRadioSdManager(event_t _event)
lastPos = -1;
#endif
break;
case EVT_ENTRY_UP:
menuVerticalOffset = reusableBuffer.sdmanager.offset;
break;
#if defined(PCBTARANIS)
case EVT_KEY_LONG(KEY_MENU):
if (!READ_ONLY() && s_editMode == 0) {