@ -68,13 +68,23 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
}
function load _sensor _alignment ( ) {
var next _callback = load _html ;
var next _callback = load AdvancedConfig ;
if ( semver . gte ( CONFIG . apiVersion , "1.15.0" ) ) {
MSP . send _message ( MSP _codes . MSP _SENSOR _ALIGNMENT , false , false , next _callback ) ;
} else {
next _callback ( ) ;
}
}
function loadAdvancedConfig ( ) {
var next _callback = load _html ;
if ( semver . gte ( CONFIG . flightControllerVersion , "1.3.0" ) ) {
MSP . send _message ( MSP _codes . MSP _ADVANCED _CONFIG , false , false , next _callback ) ;
} else {
next _callback ( ) ;
}
}
//Update Analog/Battery Data
function load _analog ( ) {
MSP . send _message ( MSP _codes . MSP _ANALOG , false , false , function ( ) {
@ -138,10 +148,15 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
{ bit : 15 , group : 'rssi' , name : 'RSSI_ADC' } ,
{ bit : 16 , group : 'other' , name : 'LED_STRIP' } ,
{ bit : 17 , group : 'other' , name : 'DISPLAY' } ,
{ bit : 18 , group : 'esc' , name : 'ONESHOT125' , haveTip : true } ,
{ bit : 19 , group : 'other' , name : 'BLACKBOX' , haveTip : true }
] ;
if ( semver . lt ( CONFIG . flightControllerVersion , "1.3.0" ) ) {
features . push (
{ bit : 18 , group : 'esc' , name : 'ONESHOT125' , haveTip : true }
) ;
}
if ( semver . gte ( CONFIG . apiVersion , "1.12.0" ) ) {
features . push (
{ bit : 20 , group : 'other' , name : 'CHANNEL_FORWARDING' }
@ -436,6 +451,99 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
$ ( 'input[name="currentoffset"]' ) . val ( BF _CONFIG . currentoffset ) ;
$ ( 'input[name="multiwiicurrentoutput"]' ) . prop ( 'checked' , MISC . multiwiicurrentoutput ) ;
var escProtocols = {
0 : {
name : "STANDARD" ,
defaultRate : 400 ,
rates : {
50 : "50Hz" ,
400 : "400Hz"
}
} ,
1 : {
name : "ONESHOT125" ,
defaultRate : 1000 ,
rates : {
400 : "400Hz" ,
1000 : "1kHz" ,
2000 : "2kHz"
}
} ,
2 : {
name : "ONESHOT42" ,
defaultRate : 2000 ,
rates : {
400 : "400Hz" ,
1000 : "1kHz" ,
2000 : "2kHz" ,
4000 : "4kHz" ,
8000 : "8kHz"
}
} ,
3 : {
name : "MULTISHOT" ,
defaultRate : 2000 ,
rates : {
400 : "400Hz" ,
1000 : "1kHz" ,
2000 : "2kHz" ,
4000 : "4kHz" ,
8000 : "8kHz"
}
} ,
4 : {
name : "BRUSHED" ,
defaultRate : 8000 ,
rates : {
8000 : "8kHz" ,
16000 : "16kHz" ,
32000 : "32kHz"
}
}
} ;
function buildMotorRates ( ) {
var protocolData = escProtocols [ ADVANCED _CONFIG . motorPwmProtocol ] ;
$escRate . find ( 'option' ) . remove ( ) ;
for ( var i in protocolData . rates ) {
if ( protocolData . rates . hasOwnProperty ( i ) ) {
$escRate . append ( '<option value="' + i + '">' + protocolData . rates [ i ] + '</option>' ) ;
}
}
}
if ( semver . gte ( CONFIG . flightControllerVersion , "1.3.0" ) ) {
var $escProtocol = $ ( '#esc-protocol' ) ;
var $escRate = $ ( '#esc-rate' ) ;
for ( var i in escProtocols ) {
if ( escProtocols . hasOwnProperty ( i ) ) {
var protocolData = escProtocols [ i ] ;
$escProtocol . append ( '<option value="' + i + '">' + protocolData . name + '</option>' ) ;
}
}
buildMotorRates ( ) ;
$escProtocol . val ( ADVANCED _CONFIG . motorPwmProtocol ) ;
$escRate . val ( ADVANCED _CONFIG . motorPwmRate ) ;
$escProtocol . change ( function ( ) {
ADVANCED _CONFIG . motorPwmProtocol = $ ( this ) . val ( ) ;
buildMotorRates ( ) ;
ADVANCED _CONFIG . motorPwmRate = escProtocols [ ADVANCED _CONFIG . motorPwmProtocol ] . defaultRate ;
$escRate . val ( ADVANCED _CONFIG . motorPwmRate ) ;
} ) ;
$escRate . change ( function ( ) {
ADVANCED _CONFIG . motorPwmRate = $ ( this ) . val ( ) ;
} ) ;
$ ( "#esc-protocols" ) . show ( ) ;
}
//fill 3D
if ( semver . lt ( CONFIG . apiVersion , "1.14.0" ) ) {
$ ( '.tab-configuration .3d' ) . hide ( ) ;
@ -605,7 +713,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
}
function save _rx _config ( ) {
var next _callback = save _to _eeprom ;
var next _callback = save AdvancedConfig ;
if ( semver . gte ( CONFIG . apiVersion , "1.21.0" ) ) {
MSP . send _message ( MSP _codes . MSP _SET _RX _CONFIG , MSP . crunch ( MSP _codes . MSP _SET _RX _CONFIG ) , false , next _callback ) ;
} else {
@ -613,6 +721,15 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
}
}
function saveAdvancedConfig ( ) {
var next _callback = save _to _eeprom ;
if ( semver . gte ( CONFIG . flightControllerVersion , "1.3.0" ) ) {
MSP . send _message ( MSP _codes . MSP _SET _ADVANCED _CONFIG , MSP . crunch ( MSP _codes . MSP _SET _ADVANCED _CONFIG ) , false , next _callback ) ;
} else {
next _callback ( ) ;
}
}
function save _to _eeprom ( ) {
MSP . send _message ( MSP _codes . MSP _EEPROM _WRITE , false , false , reboot ) ;
}