1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 12:55:19 +03:00

Merge pull request #7181 from hydra/fix-msp-flash-read

Fix MSP flash read
This commit is contained in:
Michael Keller 2019-01-17 01:53:36 +13:00 committed by GitHub
commit e0fc9300ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -382,6 +382,8 @@ static void serializeDataflashReadReply(sbuf_t *dst, uint32_t address, const uin
#endif
if (compressionMethod == NO_COMPRESSION) {
uint16_t *readLenPtr = (uint16_t *)sbufPtr(dst);
if (!useLegacyFormat) {
// new format supports variable read lengths
sbufWriteU16(dst, readLen);
@ -390,6 +392,11 @@ static void serializeDataflashReadReply(sbuf_t *dst, uint32_t address, const uin
const int bytesRead = flashfsReadAbs(address, sbufPtr(dst), readLen);
if (!useLegacyFormat) {
// update the 'read length' with the actual amount read from flash.
*readLenPtr = bytesRead;
}
sbufAdvance(dst, bytesRead);
if (useLegacyFormat) {