Skip to content

Commit b91f9ad

Browse files
committed
try to fix
1 parent ffc3e80 commit b91f9ad

File tree

1 file changed

+30
-14
lines changed

1 file changed

+30
-14
lines changed

src/js/msp/MSPHelper.js

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2441,6 +2441,21 @@ MspHelper.prototype.setRawRx = function (channels) {
24412441
MSP.send_message(MSPCodes.MSP_SET_RAW_RC, buffer, false);
24422442
};
24432443

2444+
/**
2445+
* Set raw Rx values over MSP protocol.
2446+
*
2447+
* Channels is an array of 16-bit unsigned integer channel values to be sent. 8 channels is probably the maximum.
2448+
*/
2449+
MspHelper.prototype.setRawRx = function (channels) {
2450+
const buffer = [];
2451+
2452+
for (let i = 0; i < channels.length; i++) {
2453+
buffer.push16(channels[i]);
2454+
}
2455+
2456+
MSP.send_message(MSPCodes.MSP_SET_RAW_RC, buffer, false);
2457+
};
2458+
24442459
/**
24452460
* Send a request to read a block of data from the dataflash at the given address and pass that address and a dataview
24462461
* of the returned data to the given callback (or null for the data if an error occurred).
@@ -2500,25 +2515,26 @@ MspHelper.prototype.dataflashRead = function(address, blockSize, onDataCallback)
25002515
}
25012516
}
25022517

2503-
if (!payloadView && response && response.data) {
2504-
// CRC fail or decompression failed, but we still have raw data
2505-
const headerSize = 7;
2506-
payloadView = new DataView(response.data.buffer, response.data.byteOffset + headerSize);
2507-
console.warn(`CRC failed at address ${address}, delivering raw data anyway`);
2508-
}
2518+
if (!payloadView && response && response.data) {
2519+
// CRC fail or decompression failed, but we still have raw data
2520+
const headerSize = 7;
2521+
payloadView = new DataView(response.data.buffer, response.data.byteOffset + headerSize);
2522+
console.warn(`CRC failed at address ${address}, delivering raw data anyway`);
2523+
}
25092524

2510-
// Always deliver the block
2511-
onDataCallback(address, payloadView);
2525+
// Always deliver the block
2526+
onDataCallback(address, payloadView);
25122527

2513-
if (payloadView) {
2514-
console.log(`Block at ${address} received (${payloadView.byteLength} bytes)`);
2515-
} else {
2516-
console.warn(`No data available at address ${address}`);
2517-
}
2528+
if (payloadView) {
2529+
console.log(`Block at ${address} received (${payloadView.byteLength} bytes)`);
2530+
} else {
2531+
console.warn(`No data available at address ${address}`);
2532+
}
25182533

2519-
}); // end of send_message callback
2534+
}); // end of send_message callback
25202535
}; // end of dataflashRead
25212536

2537+
25222538
MspHelper.prototype.sendAdjustmentRanges = function (onCompleteCallback) {
25232539
let nextFunction = send_next_adjustment_range;
25242540

0 commit comments

Comments
 (0)