Merge pull request #3520 from DanNixon/cms_bb_flash_reset_status_after_erase

Ensure storage device status is reset after erasing flash via CMS
This commit is contained in:
Martin Budden 2017-07-15 09:45:23 +01:00 committed by GitHub
commit f249bc93fa
1 changed files with 25 additions and 23 deletions

View File

@ -52,29 +52,6 @@
#include "io/flashfs.h"
#include "io/beeper.h"
#ifdef USE_FLASHFS
static long cmsx_EraseFlash(displayPort_t *pDisplay, const void *ptr)
{
UNUSED(ptr);
displayClearScreen(pDisplay);
displayWrite(pDisplay, 5, 3, "ERASING FLASH...");
displayResync(pDisplay); // Was max7456RefreshAll(); Why at this timing?
flashfsEraseCompletely();
while (!flashfsIsReady()) {
delay(100);
}
beeper(BEEPER_BLACKBOX_ERASE);
displayClearScreen(pDisplay);
displayResync(pDisplay); // Was max7456RefreshAll(); wedges during heavy SPI?
return 0;
}
#endif // USE_FLASHFS
static const char * const cmsx_BlackboxDeviceNames[] = {
"NONE",
"FLASH ",
@ -163,6 +140,31 @@ static void cmsx_Blackbox_GetDeviceStatus()
tfp_sprintf(cmsx_BlackboxDeviceStorageFree, "%ld%s", storageFree, unit);
}
#ifdef USE_FLASHFS
static long cmsx_EraseFlash(displayPort_t *pDisplay, const void *ptr)
{
UNUSED(ptr);
displayClearScreen(pDisplay);
displayWrite(pDisplay, 5, 3, "ERASING FLASH...");
displayResync(pDisplay); // Was max7456RefreshAll(); Why at this timing?
flashfsEraseCompletely();
while (!flashfsIsReady()) {
delay(100);
}
beeper(BEEPER_BLACKBOX_ERASE);
displayClearScreen(pDisplay);
displayResync(pDisplay); // Was max7456RefreshAll(); wedges during heavy SPI?
// Update storage device status to show new used space amount
cmsx_Blackbox_GetDeviceStatus();
return 0;
}
#endif // USE_FLASHFS
static long cmsx_Blackbox_onEnter(void)
{
cmsx_Blackbox_GetDeviceStatus();