@ -734,6 +734,7 @@ var mspHelper = (function (gui) {
case MSPCodes . MSP _SET _RX _MAP :
console . log ( 'RCMAP saved' ) ;
break ;
case MSPCodes . MSP _BF _CONFIG :
BF _CONFIG . mixerConfiguration = data . getUint8 ( 0 ) ;
BF _CONFIG . features = data . getUint32 ( 1 , true ) ;
@ -744,6 +745,7 @@ var mspHelper = (function (gui) {
BF _CONFIG . currentscale = data . getInt16 ( 12 , true ) ;
BF _CONFIG . currentoffset = data . getInt16 ( 14 , true ) ;
break ;
case MSPCodes . MSP _SET _BF _CONFIG :
console . log ( 'BF_CONFIG saved' ) ;
break ;
@ -753,10 +755,22 @@ var mspHelper = (function (gui) {
BOARD _ALIGNMENT . pitch = data . getInt16 ( 2 , true ) ; // -180 - 360
BOARD _ALIGNMENT . yaw = data . getInt16 ( 4 , true ) ; // -180 - 360
break ;
case MSPCodes . MSP _SET _BOARD _ALIGNMENT :
console . log ( 'MSP_SET_BOARD_ALIGNMENT saved' ) ;
break ;
case MSPCodes . MSP _CURRENT _METER _CONFIG :
CURRENT _METER _CONFIG . scale = data . getInt16 ( 0 , true ) ;
CURRENT _METER _CONFIG . offset = data . getInt16 ( 2 , true ) ;
CURRENT _METER _CONFIG . type = data . getUint8 ( 4 ) ;
CURRENT _METER _CONFIG . capacity = data . getInt16 ( 5 , true ) ;
break ;
case MSPCodes . MSP _SET _CURRENT _METER _CONFIG :
console . log ( 'MSP_SET_CURRENT_METER_CONFIG saved' ) ;
break ;
case MSPCodes . MSP _SET _REBOOT :
console . log ( 'Reboot request accepted' ) ;
break ;
@ -810,28 +824,6 @@ var mspHelper = (function (gui) {
console . log ( 'Channel forwarding saved' ) ;
break ;
case MSPCodes . MSP _CF _SERIAL _CONFIG :
SERIAL _CONFIG . ports = [ ] ;
var bytesPerPort = 1 + 2 + 4 ;
var serialPortCount = data . byteLength / bytesPerPort ;
for ( i = 0 ; i < serialPortCount ; i ++ ) {
var BAUD _RATES = mspHelper . BAUD _RATES _post1 _6 _3 ;
var serialPort = {
identifier : data . getUint8 ( offset ) ,
functions : mspHelper . serialPortFunctionMaskToFunctions ( data . getUint16 ( offset + 1 , true ) ) ,
msp _baudrate : BAUD _RATES [ data . getUint8 ( offset + 3 ) ] ,
sensors _baudrate : BAUD _RATES [ data . getUint8 ( offset + 4 ) ] ,
telemetry _baudrate : BAUD _RATES [ data . getUint8 ( offset + 5 ) ] ,
blackbox _baudrate : BAUD _RATES [ data . getUint8 ( offset + 6 ) ]
} ;
offset += bytesPerPort ;
SERIAL _CONFIG . ports . push ( serialPort ) ;
}
break ;
case MSPCodes . MSP2 _CF _SERIAL _CONFIG :
SERIAL _CONFIG . ports = [ ] ;
var bytesPerPort = 1 + 4 + 4 ;
@ -854,7 +846,6 @@ var mspHelper = (function (gui) {
}
break ;
case MSPCodes . MSP _SET _CF _SERIAL _CONFIG :
case MSPCodes . MSP2 _SET _CF _SERIAL _CONFIG :
console . log ( 'Serial config saved' ) ;
break ;
@ -1579,6 +1570,16 @@ var mspHelper = (function (gui) {
buffer . push ( specificByte ( BOARD _ALIGNMENT . yaw , 1 ) ) ;
break ;
case MSPCodes . MSP _SET _CURRENT _METER _CONFIG :
buffer . push ( specificByte ( CURRENT _METER _CONFIG . scale , 0 ) ) ;
buffer . push ( specificByte ( CURRENT _METER _CONFIG . scale , 1 ) ) ;
buffer . push ( specificByte ( CURRENT _METER _CONFIG . offset , 0 ) ) ;
buffer . push ( specificByte ( CURRENT _METER _CONFIG . offset , 1 ) ) ;
buffer . push ( CURRENT _METER _CONFIG . type ) ;
buffer . push ( specificByte ( CURRENT _METER _CONFIG . capacity , 0 ) ) ;
buffer . push ( specificByte ( CURRENT _METER _CONFIG . capacity , 1 ) ) ;
break ;
case MSPCodes . MSP _SET _BF _CONFIG :
buffer . push ( BF _CONFIG . mixerConfiguration ) ;
buffer . push ( specificByte ( BF _CONFIG . features , 0 ) ) ;
@ -1832,24 +1833,6 @@ var mspHelper = (function (gui) {
}
break ;
case MSPCodes . MSP _SET _CF _SERIAL _CONFIG :
for ( i = 0 ; i < SERIAL _CONFIG . ports . length ; i ++ ) {
var serialPort = SERIAL _CONFIG . ports [ i ] ;
buffer . push ( serialPort . identifier ) ;
var functionMask = mspHelper . SERIAL _PORT _FUNCTIONSToMask ( serialPort . functions ) ;
buffer . push ( specificByte ( functionMask , 0 ) ) ;
buffer . push ( specificByte ( functionMask , 1 ) ) ;
var BAUD _RATES = mspHelper . BAUD _RATES _post1 _6 _3 ;
buffer . push ( BAUD _RATES . indexOf ( serialPort . msp _baudrate ) ) ;
buffer . push ( BAUD _RATES . indexOf ( serialPort . sensors _baudrate ) ) ;
buffer . push ( BAUD _RATES . indexOf ( serialPort . telemetry _baudrate ) ) ;
buffer . push ( BAUD _RATES . indexOf ( serialPort . blackbox _baudrate ) ) ;
}
break ;
case MSPCodes . MSP2 _SET _CF _SERIAL _CONFIG :
for ( i = 0 ; i < SERIAL _CONFIG . ports . length ; i ++ ) {
var serialPort = SERIAL _CONFIG . ports [ i ] ;
@ -2827,6 +2810,10 @@ var mspHelper = (function (gui) {
self . loadBoardAlignment = function ( callback ) {
MSP . send _message ( MSPCodes . MSP _BOARD _ALIGNMENT , false , false , callback ) ;
} ;
self . loadCurrentMeterConfig = function ( callback ) {
MSP . send _message ( MSPCodes . MSP _CURRENT _METER _CONFIG , false , false , callback ) ;
} ;
self . queryFcStatus = function ( callback ) {
MSP . send _message ( MSPCodes . MSPV2 _INAV _STATUS , false , false , callback ) ;
@ -2931,6 +2918,10 @@ var mspHelper = (function (gui) {
self . saveBfConfig = function ( callback ) {
MSP . send _message ( MSPCodes . MSP _SET _BF _CONFIG , mspHelper . crunch ( MSPCodes . MSP _SET _BF _CONFIG ) , false , callback ) ;
} ;
self . saveCurrentMeterConfig = function ( callback ) {
MSP . send _message ( MSPCodes . MSP _SET _CURRENT _METER _CONFIG , mspHelper . crunch ( MSPCodes . MSP _SET _CURRENT _METER _CONFIG ) , false , callback ) ;
} ;
self . saveBoardAlignment = function ( callback ) {
MSP . send _message ( MSPCodes . MSP _SET _BOARD _ALIGNMENT , mspHelper . crunch ( MSPCodes . MSP _SET _BOARD _ALIGNMENT ) , false , callback ) ;