@ -19,6 +19,20 @@ TABS.advanced_tuning.initialize = function (callback) {
loadHtml ( ) ;
function save _to _eeprom ( ) {
console . log ( 'save_to_eeprom' ) ;
MSP . send _message ( MSPCodes . MSP _EEPROM _WRITE , false , false , function ( ) {
GUI . log ( i18n . getMessage ( 'eepromSaved' ) ) ;
GUI . tab _switch _cleanup ( function ( ) {
MSP . send _message ( MSPCodes . MSP _SET _REBOOT , false , false , function ( ) {
GUI . log ( i18n . getMessage ( 'deviceRebooting' ) ) ;
GUI . handleReconnect ( $ ( '.tab_advanced_tuning a' ) ) ;
} ) ;
} ) ;
} ) ;
}
function loadHtml ( ) {
GUI . load ( path . join ( _ _dirname , "advanced_tuning.html" ) , Settings . processHtml ( function ( ) {
@ -68,35 +82,12 @@ TABS.advanced_tuning.initialize = function (callback) {
TABS . advanced _tuning . checkRequirements _LinearDescent ( ) ;
$ ( 'a.save' ) . on ( 'click' , function ( ) {
Settings . saveInputs ( ) . then ( function ( ) {
var self = this ;
MSP . promise ( MSPCodes . MSP _EEPROM _WRITE ) ;
var oldText = $ ( this ) . text ( ) ;
$ ( this ) . html ( "Saved" ) ;
setTimeout ( function ( ) {
$ ( self ) . html ( oldText ) ;
} , 2000 ) ;
reboot ( ) ;
} ) ;
Settings . saveInputs ( save _to _eeprom ) ;
} ) ;
GUI . content _ready ( callback ) ;
} ) ) ;
}
function reboot ( ) {
//noinspection JSUnresolvedVariable
GUI . log ( i18n . getMessage ( 'configurationEepromSaved' ) ) ;
GUI . tab _switch _cleanup ( function ( ) {
MSP . send _message ( MSPCodes . MSP _SET _REBOOT , false , false , reinitialize ) ;
} ) ;
}
function reinitialize ( ) {
//noinspection JSUnresolvedVariable
GUI . log ( i18n . getMessage ( 'deviceRebooting' ) ) ;
GUI . handleReconnect ( $ ( '.tab_advanced_tuning a' ) ) ;
}
} ;