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:
commit
e0fc9300ed
1 changed files with 7 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue