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

Avoid synchronous flushes to flash during Blackbox shutdown

This commit is contained in:
Nicholas Sherlock 2015-02-15 23:23:53 +13:00
parent acd4745a4e
commit d6911e8b86
5 changed files with 15 additions and 8 deletions

View file

@ -295,12 +295,14 @@ static void flashfsAdvanceTailInBuffer(uint32_t delta)
/**
* If the flash is ready to accept writes, flush the buffer to it, otherwise schedule
* a flush for later and return immediately.
*
* Returns true if all data in the buffer has been flushed to the device.
*/
void flashfsFlushAsync()
bool flashfsFlushAsync()
{
if (flashfsBufferIsEmpty()) {
shouldFlush = false;
return; // Nothing to flush
return true; // Nothing to flush
}
uint8_t const * buffers[2];
@ -312,6 +314,8 @@ void flashfsFlushAsync()
flashfsAdvanceTailInBuffer(bytesWritten);
shouldFlush = !flashfsBufferIsEmpty();
return flashfsBufferIsEmpty();
}
/**