mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 21:35:44 +03:00
Show "dataflash unsupported" for old versions missing new MSP commands
This commit is contained in:
parent
ed285992da
commit
d0ae8dd921
1 changed files with 12 additions and 4 deletions
16
js/msp.js
16
js/msp.js
|
@ -675,10 +675,18 @@ var MSP = {
|
||||||
console.log('Led strip config saved');
|
console.log('Led strip config saved');
|
||||||
break;
|
break;
|
||||||
case MSP_codes.MSP_DATAFLASH_SUMMARY:
|
case MSP_codes.MSP_DATAFLASH_SUMMARY:
|
||||||
DATAFLASH.ready = (data.getUint8(0) & 1) != 0;
|
if (data.byteLength >= 13) {
|
||||||
DATAFLASH.sectors = data.getUint32(1, 1);
|
DATAFLASH.ready = (data.getUint8(0) & 1) != 0;
|
||||||
DATAFLASH.totalSize = data.getUint32(5, 1);
|
DATAFLASH.sectors = data.getUint32(1, 1);
|
||||||
DATAFLASH.usedSize = data.getUint32(9, 1);
|
DATAFLASH.totalSize = data.getUint32(5, 1);
|
||||||
|
DATAFLASH.usedSize = data.getUint32(9, 1);
|
||||||
|
} else {
|
||||||
|
// Firmware version too old to support MSP_DATAFLASH_SUMMARY
|
||||||
|
DATAFLASH.ready = false;
|
||||||
|
DATAFLASH.sectors = 0;
|
||||||
|
DATAFLASH.totalSize = 0;
|
||||||
|
DATAFLASH.usedSize = 0;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case MSP_codes.MSP_DATAFLASH_READ:
|
case MSP_codes.MSP_DATAFLASH_READ:
|
||||||
// No-op, let callback handle it
|
// No-op, let callback handle it
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue