Skip to content

Commit

Permalink
Fix flash_scan (betaflight#13789)
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveCEvans authored Jul 31, 2024
1 parent 6e0855c commit 2525be9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/io/flashfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,6 @@ void flashfsInit(void)
bool flashfsVerifyEntireFlash(void)
{
flashfsEraseCompletely();
flashfsInit();

uint32_t address = 0;
flashfsSeekAbs(address);
Expand All @@ -645,8 +644,12 @@ bool flashfsVerifyEntireFlash(void)
for (address = 0; address < testLimit; address += bufferSize) {
tfp_sprintf(buffer, "%08x >> **0123456789ABCDEF**", address);
flashfsWrite((uint8_t*)buffer, strlen(buffer), true);
if ((address % 0x10000) == 0) {
LED0_TOGGLE;
}
// Don't overwrite the buffer if the FLASH is busy writing
flashfsFlushSync();
}
flashfsFlushSync();
flashfsClose();

char expectedBuffer[bufferSize + 1];
Expand All @@ -664,6 +667,9 @@ bool flashfsVerifyEntireFlash(void)
if (result != 0 || bytesRead != bufferSize) {
verificationFailures++;
}
if ((address % 0x10000) == 0) {
LED0_TOGGLE;
}
}
return verificationFailures == 0;
}
Expand Down

0 comments on commit 2525be9

Please sign in to comment.