@@ -2441,6 +2441,21 @@ MspHelper.prototype.setRawRx = function (channels) {
2441
2441
MSP . send_message ( MSPCodes . MSP_SET_RAW_RC , buffer , false ) ;
2442
2442
} ;
2443
2443
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
+
2444
2459
/**
2445
2460
* Send a request to read a block of data from the dataflash at the given address and pass that address and a dataview
2446
2461
* 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)
2500
2515
}
2501
2516
}
2502
2517
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
+ }
2509
2524
2510
- // Always deliver the block
2511
- onDataCallback ( address , payloadView ) ;
2525
+ // Always deliver the block
2526
+ onDataCallback ( address , payloadView ) ;
2512
2527
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
+ }
2518
2533
2519
- } ) ; // end of send_message callback
2534
+ } ) ; // end of send_message callback
2520
2535
} ; // end of dataflashRead
2521
2536
2537
+
2522
2538
MspHelper . prototype . sendAdjustmentRanges = function ( onCompleteCallback ) {
2523
2539
let nextFunction = send_next_adjustment_range ;
2524
2540
0 commit comments