mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-16 04:45:18 +03:00
Support large MSP_DATAFLASH_READ payloads
This commit is contained in:
parent
42e6941edd
commit
57da32d30b
2 changed files with 50 additions and 28 deletions
|
@ -9145,8 +9145,19 @@ var mspHelper = (function (gui) {
|
|||
* of the returned data to the given callback (or null for the data if an error occured).
|
||||
*/
|
||||
self.dataflashRead = function (address, onDataCallback) {
|
||||
MSP.send_message(MSPCodes.MSP_DATAFLASH_READ, [address & 0xFF, (address >> 8) & 0xFF, (address >> 16) & 0xFF, (address >> 24) & 0xFF],
|
||||
false, function (response) {
|
||||
var buffer = [];
|
||||
buffer.push(address & 0xFF);
|
||||
buffer.push((address >> 8) & 0xFF);
|
||||
buffer.push((address >> 16) & 0xFF);
|
||||
buffer.push((address >> 24) & 0xFF);
|
||||
|
||||
// For API > 2.0.0 we support requesting payload size - request 4KiB and let firmware decide what actual size to send
|
||||
if (CONFIG.apiVersion && semver.gte(CONFIG.apiVersion, "2.0.0")) {
|
||||
buffer.push(lowByte(4096));
|
||||
buffer.push(highByte(4096));
|
||||
}
|
||||
|
||||
MSP.send_message(MSPCodes.MSP_DATAFLASH_READ, buffer, false, function (response) {
|
||||
var chunkAddress = response.data.getUint32(0, 1);
|
||||
|
||||
// Verify that the address of the memory returned matches what the caller asked for
|
||||
|
|
|
@ -1592,8 +1592,19 @@ var mspHelper = (function (gui) {
|
|||
* of the returned data to the given callback (or null for the data if an error occured).
|
||||
*/
|
||||
self.dataflashRead = function (address, onDataCallback) {
|
||||
MSP.send_message(MSPCodes.MSP_DATAFLASH_READ, [address & 0xFF, (address >> 8) & 0xFF, (address >> 16) & 0xFF, (address >> 24) & 0xFF],
|
||||
false, function (response) {
|
||||
var buffer = [];
|
||||
buffer.push(address & 0xFF);
|
||||
buffer.push((address >> 8) & 0xFF);
|
||||
buffer.push((address >> 16) & 0xFF);
|
||||
buffer.push((address >> 24) & 0xFF);
|
||||
|
||||
// For API > 2.0.0 we support requesting payload size - request 4KiB and let firmware decide what actual size to send
|
||||
if (CONFIG.apiVersion && semver.gte(CONFIG.apiVersion, "2.0.0")) {
|
||||
buffer.push(lowByte(4096));
|
||||
buffer.push(highByte(4096));
|
||||
}
|
||||
|
||||
MSP.send_message(MSPCodes.MSP_DATAFLASH_READ, buffer, false, function (response) {
|
||||
var chunkAddress = response.data.getUint32(0, 1);
|
||||
|
||||
// Verify that the address of the memory returned matches what the caller asked for
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue