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

Successfully blackbox logged 46kB of flawless log data on the bench

Data read back using MSP
This commit is contained in:
Nicholas Sherlock 2015-01-31 00:35:17 +13:00
parent ebff1bdcd7
commit f7d227a208
2 changed files with 16 additions and 7 deletions

View file

@ -401,9 +401,17 @@ void flashfsWrite(const uint8_t *data, unsigned int len)
*/
int flashfsRead(uint8_t *data, unsigned int len)
{
int result = m25p16_readBytes(tailAddress, data, len);
int bytesRead;
flashfsSetTailAddress(tailAddress + result);
// Did caller try to read past the end of the volume?
if (tailAddress + len > flashfsGetSize()) {
// Truncate their request
len = flashfsGetSize() - tailAddress;
}
return result;
bytesRead = m25p16_readBytes(tailAddress, data, len);
flashfsSetTailAddress(tailAddress + bytesRead);
return bytesRead;
}