1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-23 16:25:19 +03:00

MSP_IDENT removed from usage

This commit is contained in:
Pawel Spychalski (DzikuVx) 2017-01-19 19:52:57 +01:00
parent e7a3647459
commit 93a4dd1b84
11 changed files with 212 additions and 292 deletions

View file

@ -803,7 +803,7 @@ function configuration_restore(callback) {
GUI.log(chrome.i18n.getMessage('deviceRebooting')); GUI.log(chrome.i18n.getMessage('deviceRebooting'));
helper.timeout.add('waiting_for_bootup', function waiting_for_bootup() { helper.timeout.add('waiting_for_bootup', function waiting_for_bootup() {
MSP.send_message(MSPCodes.MSP_IDENT, false, false, function () { MSP.send_message(MSPCodes.MSP_STATUS, false, false, function () {
GUI.log(chrome.i18n.getMessage('deviceReady')); GUI.log(chrome.i18n.getMessage('deviceReady'));
if (callback) callback(); if (callback) callback();

View file

@ -61,7 +61,7 @@ var MSPCodes = {
MSP_SET_SENSOR_CONFIG: 97, MSP_SET_SENSOR_CONFIG: 97,
// Multiwii MSP commands // Multiwii MSP commands
MSP_IDENT: 100, MSP_IDENT: 100, //deprecated, do not use
MSP_STATUS: 101, MSP_STATUS: 101,
MSP_RAW_IMU: 102, MSP_RAW_IMU: 102,
MSP_SERVO: 103, MSP_SERVO: 103,

View file

@ -1731,6 +1731,11 @@ var mspHelper = (function (gui) {
/* /*
* Basic sending methods used for chaining purposes * Basic sending methods used for chaining purposes
*/ */
/**
* @deprecated
* @param callback
*/
self.loadMspIdent = function (callback) { self.loadMspIdent = function (callback) {
MSP.send_message(MSPCodes.MSP_IDENT, false, false, callback); MSP.send_message(MSPCodes.MSP_IDENT, false, false, callback);
}; };

View file

@ -36,7 +36,7 @@ $(document).ready(function () {
} else { } else {
helper.timeout.add('waiting_for_bootup', function waiting_for_bootup() { helper.timeout.add('waiting_for_bootup', function waiting_for_bootup() {
MSP.send_message(MSPCodes.MSP_IDENT, false, false, function () { MSP.send_message(MSPCodes.MSP_STATUS, false, false, function () {
//noinspection JSUnresolvedVariable //noinspection JSUnresolvedVariable
GUI.log(chrome.i18n.getMessage('deviceReady')); GUI.log(chrome.i18n.getMessage('deviceReady'));
//noinspection JSValidateTypes //noinspection JSValidateTypes

View file

@ -13,7 +13,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
var loadChainer = new MSPChainerClass(); var loadChainer = new MSPChainerClass();
loadChainer.setChain([ loadChainer.setChain([
mspHelper.loadMspIdent,
mspHelper.loadBfConfig, mspHelper.loadBfConfig,
mspHelper.loadMisc, mspHelper.loadMisc,
mspHelper.loadArmingConfig, mspHelper.loadArmingConfig,

View file

@ -4,60 +4,34 @@
<div class="cf_doc_version_bt"> <div class="cf_doc_version_bt">
<a id="button-documentation" href="https://github.com/iNavFlight/inav/releases" target="_blank"></a> <a id="button-documentation" href="https://github.com/iNavFlight/inav/releases" target="_blank"></a>
</div> </div>
<div class="note newpane"> <div class="note">
<div class="note_spacer"> <div class="note_spacer">
<p i18n="failsafeFeaturesHelpNew"></p> <p data-i18n="failsafeFeaturesHelpNew"></p>
</p>
</div>
</div>
<div class="note oldpane">
<div class="note_spacer">
<p i18n="failsafeFeaturesHelpOld"></p>
</p>
</div> </div>
</div> </div>
<div class="leftWrapper"> <div class="leftWrapper">
<div class="gui_box grey oldpane"> <div class="gui_box grey">
<div class="gui_box_titlebar"> <div class="gui_box_titlebar">
<div class="spacer_box_title" i18n="failsafePaneTitleOld"></div> <div class="spacer_box_title" data-i18n="failsafePulsrangeTitle"></div>
</div> <div class="helpicon cf_tip" data-i18n_title="failsafePulsrangeHelp"></div>
<div class="spacer_box">
<div class="checkbox">
<div class="numberspacer" >
<input type="checkbox" name="failsafe_feature" class="feature toggle rxFailsafe" id="failsafe_feature" />
</div>
<label for="failsafe_feature"><span i18n="failsafeFeatureItemOld"></span>
</label>
</div>
<div class="number">
<label> <input type="number" name="failsafe_throttle_old" min="0" max="2000" /> <span
i18n="failsafeThrottleItemOld"></span>
</label>
</div>
</div>
</div>
<div class="gui_box grey newpane">
<div class="gui_box_titlebar">
<div class="spacer_box_title" i18n="failsafePulsrangeTitle"></div>
<div class="helpicon cf_tip" i18n_title="failsafePulsrangeHelp"></div>
</div> </div>
<div class="spacer_box"> <div class="spacer_box">
<div class="number"> <div class="number">
<label> <input type="number" name="rx_min_usec" min="750" max="2250" /> <span <label> <input type="number" name="rx_min_usec" min="750" max="2250" /> <span
i18n="failsafeRxMinUsecItem"></span> data-i18n="failsafeRxMinUsecItem"></span>
</label> </label>
</div> </div>
<div class="number"> <div class="number">
<label> <input type="number" name="rx_max_usec" min="750" max="2250" /> <span <label> <input type="number" name="rx_max_usec" min="750" max="2250" /> <span
i18n="failsafeRxMaxUsecItem"></span> data-i18n="failsafeRxMaxUsecItem"></span>
</label> </label>
</div> </div>
</div> </div>
</div> </div>
<div class="gui_box grey stage1 newpane"> <div class="gui_box grey stage1">
<div class="gui_box_titlebar"> <div class="gui_box_titlebar">
<div class="spacer_box_title" i18n="failsafeChannelFallbackSettingsTitle"></div> <div class="spacer_box_title" data-i18n="failsafeChannelFallbackSettingsTitle"></div>
<div class="helpicon cf_tip" i18n_title="failsafeChannelFallbackSettingsHelp"></div> <div class="helpicon cf_tip" data-i18n_title="failsafeChannelFallbackSettingsHelp"></div>
</div> </div>
<div class="spacer_box"> <div class="spacer_box">
<div class="activechannellist"> <div class="activechannellist">
@ -67,67 +41,67 @@
</div> </div>
</div> </div>
<div class="rightWrapper"> <div class="rightWrapper">
<div class="gui_box grey newpane"> <div class="gui_box grey">
<div class="gui_box_titlebar"> <div class="gui_box_titlebar">
<div class="spacer_box_title" i18n="failsafeStageTwoSettingsTitle"></div> <div class="spacer_box_title" data-i18n="failsafeStageTwoSettingsTitle"></div>
</div> </div>
<div class="spacer_box"> <div class="spacer_box">
<div class="checkbox"> <div class="checkbox">
<div class="numberspacer" > <div class="numberspacer" >
<input type="checkbox" name="failsafe_feature_new" class="feature toggle rxFailsafe" id="failsafe_feature_new" /> <input type="checkbox" name="failsafe_feature_new" class="feature toggle rxFailsafe" id="failsafe_feature_new" />
</div> </div>
<label for="failsafe_feature_new"><span i18n="failsafeFeatureItem"></span> <label for="failsafe_feature_new"><span data-i18n="failsafeFeatureItem"></span>
</label> </label>
<div class="helpicon cf_tip" i18n_title="failsafeFeatureHelp"></div> <div class="helpicon cf_tip" data-i18n_title="failsafeFeatureHelp"></div>
</div> </div>
<div class="checkbox stage2"> <div class="checkbox stage2">
<div class="numberspacer" > <div class="numberspacer" >
<input type="checkbox" name="failsafe_kill_switch" class="toggle" id="failsafe_kill_switch" /> <input type="checkbox" name="failsafe_kill_switch" class="toggle" id="failsafe_kill_switch" />
</div> </div>
<label for="failsafe_kill_switch"><span i18n="failsafeKillSwitchItem"></span> <label for="failsafe_kill_switch"><span data-i18n="failsafeKillSwitchItem"></span>
</label> </label>
<div class="helpicon cf_tip" i18n_title="failsafeKillSwitchHelp"></div> <div class="helpicon cf_tip" data-i18n_title="failsafeKillSwitchHelp"></div>
</div> </div>
<div class="number stage2"> <div class="number stage2">
<label> <input type="number" name="failsafe_delay" min="0" max="2000" /> <span <label> <input type="number" name="failsafe_delay" min="0" max="2000" /> <span
i18n="failsafeDelayItem"></span> data-i18n="failsafeDelayItem"></span>
</label> </label>
<div class="helpicon cf_tip" i18n_title="failsafeDelayHelp"></div> <div class="helpicon cf_tip" data-i18n_title="failsafeDelayHelp"></div>
</div> </div>
<div class="number stage2"> <div class="number stage2">
<label> <input type="number" name="failsafe_throttle_low_delay" min="0" max="2000" /> <span <label> <input type="number" name="failsafe_throttle_low_delay" min="0" max="2000" /> <span
i18n="failsafeThrottleLowItem"></span> data-i18n="failsafeThrottleLowItem"></span>
</label> </label>
<div class="helpicon cf_tip" i18n_title="failsafeThrottleLowHelp"></div> <div class="helpicon cf_tip" data-i18n_title="failsafeThrottleLowHelp"></div>
</div> </div>
<!-- radio buttons --> <!-- radio buttons -->
<div class="subline stage2" i18n="failsafeSubTitle1"></div> <div class="subline stage2" data-i18n="failsafeSubTitle1"></div>
<div class="radioarea pro1 stage2"> <div class="radioarea pro1 stage2">
<div class="radiobuttons"><input class="procedure" id="drop" name="group1" type="radio"/> <div class="radiobuttons"><input class="procedure" id="drop" name="group1" type="radio"/>
<label for="drop" i18n="failsafeProcedureItemSelect2"></label> <label for="drop" data-i18n="failsafeProcedureItemSelect2"></label>
</div> </div>
</div> </div>
<div class="radioarea pro2 stage2"> <div class="radioarea pro2 stage2">
<div class="radiobuttons"><input class="procedure" id="land" name="group1" type="radio" checked/> <div class="radiobuttons"><input class="procedure" id="land" name="group1" type="radio" checked/>
<label for="land" i18n="failsafeProcedureItemSelect1"></label> <label for="land" data-i18n="failsafeProcedureItemSelect1"></label>
</div> </div>
<div class="proceduresettings"> <div class="proceduresettings">
<div class="number"> <div class="number">
<label> <input type="number" name="failsafe_throttle" min="0" max="2000" /> <span <label> <input type="number" name="failsafe_throttle" min="0" max="2000" /> <span
i18n="failsafeThrottleItem"></span> data-i18n="failsafeThrottleItem"></span>
</label> </label>
</div> </div>
<div class="number"> <div class="number">
<label> <input type="number" name="failsafe_off_delay" min="0" max="2000" /> <span <label> <input type="number" name="failsafe_off_delay" min="0" max="2000" /> <span
i18n="failsafeOffDelayItem"></span> data-i18n="failsafeOffDelayItem"></span>
</label> </label>
<div class="helpicon cf_tip" i18n_title="failsafeOffDelayHelp"></div> <div class="helpicon cf_tip" data-i18n_title="failsafeOffDelayHelp"></div>
</div> </div>
</div> </div>
</div> </div>
<div class="radioarea pro4 stage2"> <div class="radioarea pro4 stage2">
<div class="radiobuttons"><input class="procedure" id="rth" name="group1" type="radio"/> <div class="radiobuttons"><input class="procedure" id="rth" name="group1" type="radio"/>
<label for="rth" i18n="failsafeProcedureItemSelect3"></label> <label for="rth" data-i18n="failsafeProcedureItemSelect3"></label>
</div> </div>
</div> </div>
</div> </div>
@ -136,7 +110,7 @@
</div> </div>
<div class="content_toolbar"> <div class="content_toolbar">
<div class="btn save_btn"> <div class="btn save_btn">
<a class="save" href="#" i18n="configurationButtonSave"></a> <a class="save" href="#" data-i18n="configurationButtonSave"></a>
</div> </div>
</div> </div>
</div> </div>

View file

@ -3,7 +3,6 @@
TABS.failsafe = {}; TABS.failsafe = {};
TABS.failsafe.initialize = function (callback, scrollPosition) { TABS.failsafe.initialize = function (callback, scrollPosition) {
var self = this;
if (GUI.active_tab != 'failsafe') { if (GUI.active_tab != 'failsafe') {
GUI.active_tab = 'failsafe'; GUI.active_tab = 'failsafe';
@ -38,7 +37,6 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
MSP.send_message(MSPCodes.MSP_RC, false, false, load_config); MSP.send_message(MSPCodes.MSP_RC, false, false, load_config);
} }
// BEGIN Support for pre API version 1.15.0
function load_config() { function load_config() {
MSP.send_message(MSPCodes.MSP_BF_CONFIG, false, false, load_misc); MSP.send_message(MSPCodes.MSP_BF_CONFIG, false, false, load_misc);
} }
@ -46,22 +44,12 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
function load_misc() { function load_misc() {
MSP.send_message(MSPCodes.MSP_MISC, false, false, load_html); MSP.send_message(MSPCodes.MSP_MISC, false, false, load_html);
} }
// END (Support for pre API version 1.15.0
function load_html() { function load_html() {
$('#content').load("./tabs/failsafe.html", process_html); $('#content').load("./tabs/failsafe.html", process_html);
} }
var apiVersionGte1_15_0 = semver.gte(CONFIG.apiVersion, "1.15.0"); load_rx_config();
// Uncomment next line for testing older functionality on newer API version
//apiVersionGte1_15_0 = false;
if(apiVersionGte1_15_0) {
MSP.send_message(MSPCodes.MSP_IDENT, false, false, load_rx_config);
} else {
MSP.send_message(MSPCodes.MSP_IDENT, false, false, load_config);
}
function process_html() { function process_html() {
var failsafeFeature; var failsafeFeature;
@ -69,62 +57,50 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
// translate to user-selected language // translate to user-selected language
localize(); localize();
// Conditionally hide the old or the new control pane's // generate labels for assigned aux modes
if(apiVersionGte1_15_0) { var auxAssignment = [],
var oldPane = $('div.oldpane'); i,
oldPane.prop("disabled", true); element;
oldPane.hide();
} else { for (var channelIndex = 0; channelIndex < RC.active_channels - 4; channelIndex++) {
var newPane = $('div.newpane'); auxAssignment.push("");
newPane.prop("disabled", true);
newPane.hide();
} }
if(apiVersionGte1_15_0) { for (var modeIndex = 0; modeIndex < AUX_CONFIG.length; modeIndex++) {
// generate labels for assigned aux modes
var auxAssignment = [],
i,
element;
for (var channelIndex = 0; channelIndex < RC.active_channels - 4; channelIndex++) { var modeId = AUX_CONFIG_IDS[modeIndex];
auxAssignment.push("");
}
for (var modeIndex = 0; modeIndex < AUX_CONFIG.length; modeIndex++) { // scan mode ranges to find assignments
for (var modeRangeIndex = 0; modeRangeIndex < MODE_RANGES.length; modeRangeIndex++) {
var modeRange = MODE_RANGES[modeRangeIndex];
var modeId = AUX_CONFIG_IDS[modeIndex]; if (modeRange.id != modeId) {
continue;
// scan mode ranges to find assignments
for (var modeRangeIndex = 0; modeRangeIndex < MODE_RANGES.length; modeRangeIndex++) {
var modeRange = MODE_RANGES[modeRangeIndex];
if (modeRange.id != modeId) {
continue;
}
var range = modeRange.range;
if (!(range.start < range.end)) {
continue; // invalid!
}
auxAssignment[modeRange.auxChannelIndex] += "<span class=\"modename\">" + AUX_CONFIG[modeIndex] + "</span>";
} }
var range = modeRange.range;
if (!(range.start < range.end)) {
continue; // invalid!
}
auxAssignment[modeRange.auxChannelIndex] += "<span class=\"modename\">" + AUX_CONFIG[modeIndex] + "</span>";
} }
}
// generate full channel list // generate full channel list
var channelNames = [ var channelNames = [
chrome.i18n.getMessage('controlAxisRoll'), chrome.i18n.getMessage('controlAxisRoll'),
chrome.i18n.getMessage('controlAxisPitch'), chrome.i18n.getMessage('controlAxisPitch'),
chrome.i18n.getMessage('controlAxisYaw'), chrome.i18n.getMessage('controlAxisYaw'),
chrome.i18n.getMessage('controlAxisThrottle') chrome.i18n.getMessage('controlAxisThrottle')
], ],
fullChannels_e = $('div.activechannellist'), fullChannels_e = $('div.activechannellist'),
aux_index = 1, aux_index = 1,
aux_assignment_index = 0; aux_assignment_index = 0;
for (i = 0; i < RXFAIL_CONFIG.length; i++) { for (i = 0; i < RXFAIL_CONFIG.length; i++) {
if (i < channelNames.length) { if (i < channelNames.length) {
fullChannels_e.append('\ fullChannels_e.append('\
<div class="number">\ <div class="number">\
<div class="channelprimary">\ <div class="channelprimary">\
<span>' + channelNames[i] + '</span>\ <span>' + channelNames[i] + '</span>\
@ -137,8 +113,8 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
</div>\ </div>\
</div>\ </div>\
'); ');
} else { } else {
fullChannels_e.append('\ fullChannels_e.append('\
<div class="number">\ <div class="number">\
<div class="channelauxiliary">\ <div class="channelauxiliary">\
<span class="channelname">' + chrome.i18n.getMessage("controlAxisAux" + (aux_index++)) + '</span>\ <span class="channelname">' + chrome.i18n.getMessage("controlAxisAux" + (aux_index++)) + '</span>\
@ -153,169 +129,147 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
<div class="auxiliary"><input type="number" name="aux_value" min="750" max="2250" id="' + i + '"/></div>\ <div class="auxiliary"><input type="number" name="aux_value" min="750" max="2250" id="' + i + '"/></div>\
</div>\ </div>\
'); ');
}
} }
var channel_mode_array = [];
$('.number', fullChannels_e).each(function () {
channel_mode_array.push($('select.aux_set' , this));
});
var channel_value_array = [];
$('.number', fullChannels_e).each(function () {
channel_value_array.push($('input[name="aux_value"]' , this));
});
var channelMode = $('select.aux_set');
var channelValue = $('input[name="aux_value"]');
// UI hooks
channelMode.change(function () {
var currentMode = parseInt($(this).val());
var i = parseInt($(this).prop("id"));
RXFAIL_CONFIG[i].mode = currentMode;
if (currentMode == 2) {
channel_value_array[i].prop("disabled", false);
channel_value_array[i].show();
} else {
channel_value_array[i].prop("disabled", true);
channel_value_array[i].hide();
}
});
// UI hooks
channelValue.change(function () {
var i = parseInt($(this).prop("id"));
RXFAIL_CONFIG[i].value = parseInt($(this).val());
});
// for some odd reason chrome 38+ changes scroll according to the touched select element
// i am guessing this is a bug, since this wasn't happening on 37
// code below is a temporary fix, which we will be able to remove in the future (hopefully)
$('#content').scrollTop((scrollPosition) ? scrollPosition : 0);
// fill stage 1 Valid Pulse Range Settings
$('input[name="rx_min_usec"]').val(RX_CONFIG.rx_min_usec);
$('input[name="rx_max_usec"]').val(RX_CONFIG.rx_max_usec);
// fill fallback settings (mode and value) for all channels
for (i = 0; i < RXFAIL_CONFIG.length; i++) {
channel_value_array[i].val(RXFAIL_CONFIG[i].value);
channel_mode_array[i].val(RXFAIL_CONFIG[i].mode);
channel_mode_array[i].change();
}
// fill stage 2 fields
failsafeFeature = $('input[name="failsafe_feature_new"]');
failsafeFeature.change(function () {
if ($(this).is(':checked')) {
$('div.stage2').show();
} else {
$('div.stage2').hide();
}
});
failsafeFeature.prop('checked', bit_check(BF_CONFIG.features, 8));
failsafeFeature.change();
$('input[name="failsafe_throttle"]').val(FAILSAFE_CONFIG.failsafe_throttle);
$('input[name="failsafe_off_delay"]').val(FAILSAFE_CONFIG.failsafe_off_delay);
$('input[name="failsafe_throttle_low_delay"]').val(FAILSAFE_CONFIG.failsafe_throttle_low_delay);
$('input[name="failsafe_delay"]').val(FAILSAFE_CONFIG.failsafe_delay);
// set stage 2 failsafe procedure
$('input[type="radio"].procedure').change(function () {
var element = $(this),
checked = element.is(':checked'),
id = element.attr('id');
switch(id) {
case 'drop':
if (checked) {
$('input[name="failsafe_throttle"]').prop("disabled", true);
$('input[name="failsafe_off_delay"]').prop("disabled", true);
}
break;
case 'land':
if (checked) {
$('input[name="failsafe_throttle"]').prop("disabled", false);
$('input[name="failsafe_off_delay"]').prop("disabled", false);
}
break;
}
});
switch(FAILSAFE_CONFIG.failsafe_procedure) {
default:
case 0:
element = $('input[id="land"]') ;
element.prop('checked', true);
element.change();
break;
case 1:
element = $('input[id="drop"]');
element.prop('checked', true);
element.change();
break;
case 2:
element = $('input[id="rth"]');
element.prop('checked', true);
element.change();
break;
}
// set stage 2 kill switch option
$('input[name="failsafe_kill_switch"]').prop('checked', FAILSAFE_CONFIG.failsafe_kill_switch);
} else {
// set FAILSAFE feature option (pre API 1.15.0)
failsafeFeature = $('input[name="failsafe_feature"]');
failsafeFeature.prop('checked', bit_check(BF_CONFIG.features, 8));
// fill failsafe_throttle field (pre API 1.15.0)
$('input[name="failsafe_throttle_old"]').val(MISC.failsafe_throttle);
} }
var channel_mode_array = [];
$('.number', fullChannels_e).each(function () {
channel_mode_array.push($('select.aux_set', this));
});
var channel_value_array = [];
$('.number', fullChannels_e).each(function () {
channel_value_array.push($('input[name="aux_value"]', this));
});
var channelMode = $('select.aux_set');
var channelValue = $('input[name="aux_value"]');
// UI hooks
channelMode.change(function () {
var currentMode = parseInt($(this).val());
var i = parseInt($(this).prop("id"));
RXFAIL_CONFIG[i].mode = currentMode;
if (currentMode == 2) {
channel_value_array[i].prop("disabled", false);
channel_value_array[i].show();
} else {
channel_value_array[i].prop("disabled", true);
channel_value_array[i].hide();
}
});
// UI hooks
channelValue.change(function () {
var i = parseInt($(this).prop("id"));
RXFAIL_CONFIG[i].value = parseInt($(this).val());
});
// for some odd reason chrome 38+ changes scroll according to the touched select element
// i am guessing this is a bug, since this wasn't happening on 37
// code below is a temporary fix, which we will be able to remove in the future (hopefully)
$('#content').scrollTop((scrollPosition) ? scrollPosition : 0);
// fill stage 1 Valid Pulse Range Settings
$('input[name="rx_min_usec"]').val(RX_CONFIG.rx_min_usec);
$('input[name="rx_max_usec"]').val(RX_CONFIG.rx_max_usec);
// fill fallback settings (mode and value) for all channels
for (i = 0; i < RXFAIL_CONFIG.length; i++) {
channel_value_array[i].val(RXFAIL_CONFIG[i].value);
channel_mode_array[i].val(RXFAIL_CONFIG[i].mode);
channel_mode_array[i].change();
}
// fill stage 2 fields
failsafeFeature = $('input[name="failsafe_feature_new"]');
failsafeFeature.change(function () {
if ($(this).is(':checked')) {
$('div.stage2').show();
} else {
$('div.stage2').hide();
}
});
failsafeFeature.prop('checked', bit_check(BF_CONFIG.features, 8));
failsafeFeature.change();
$('input[name="failsafe_throttle"]').val(FAILSAFE_CONFIG.failsafe_throttle);
$('input[name="failsafe_off_delay"]').val(FAILSAFE_CONFIG.failsafe_off_delay);
$('input[name="failsafe_throttle_low_delay"]').val(FAILSAFE_CONFIG.failsafe_throttle_low_delay);
$('input[name="failsafe_delay"]').val(FAILSAFE_CONFIG.failsafe_delay);
// set stage 2 failsafe procedure
$('input[type="radio"].procedure').change(function () {
var element = $(this),
checked = element.is(':checked'),
id = element.attr('id');
switch (id) {
case 'drop':
if (checked) {
$('input[name="failsafe_throttle"]').prop("disabled", true);
$('input[name="failsafe_off_delay"]').prop("disabled", true);
}
break;
case 'land':
if (checked) {
$('input[name="failsafe_throttle"]').prop("disabled", false);
$('input[name="failsafe_off_delay"]').prop("disabled", false);
}
break;
}
});
switch (FAILSAFE_CONFIG.failsafe_procedure) {
default:
case 0:
element = $('input[id="land"]');
element.prop('checked', true);
element.change();
break;
case 1:
element = $('input[id="drop"]');
element.prop('checked', true);
element.change();
break;
case 2:
element = $('input[id="rth"]');
element.prop('checked', true);
element.change();
break;
}
// set stage 2 kill switch option
$('input[name="failsafe_kill_switch"]').prop('checked', FAILSAFE_CONFIG.failsafe_kill_switch);
$('a.save').click(function () { $('a.save').click(function () {
// gather data that doesn't have automatic change event bound // gather data that doesn't have automatic change event bound
if(apiVersionGte1_15_0) { RX_CONFIG.rx_min_usec = parseInt($('input[name="rx_min_usec"]').val());
RX_CONFIG.rx_min_usec = parseInt($('input[name="rx_min_usec"]').val()); RX_CONFIG.rx_max_usec = parseInt($('input[name="rx_max_usec"]').val());
RX_CONFIG.rx_max_usec = parseInt($('input[name="rx_max_usec"]').val());
// get FAILSAFE feature option (>= API 1.15.0) // get FAILSAFE feature option (>= API 1.15.0)
if ($('input[name="failsafe_feature_new"]').is(':checked')) { if ($('input[name="failsafe_feature_new"]').is(':checked')) {
BF_CONFIG.features = bit_set(BF_CONFIG.features, 8); BF_CONFIG.features = bit_set(BF_CONFIG.features, 8);
} else {
BF_CONFIG.features = bit_clear(BF_CONFIG.features, 8);
}
FAILSAFE_CONFIG.failsafe_throttle = parseInt($('input[name="failsafe_throttle"]').val());
FAILSAFE_CONFIG.failsafe_off_delay = parseInt($('input[name="failsafe_off_delay"]').val());
FAILSAFE_CONFIG.failsafe_throttle_low_delay = parseInt($('input[name="failsafe_throttle_low_delay"]').val());
FAILSAFE_CONFIG.failsafe_delay = parseInt($('input[name="failsafe_delay"]').val());
if( $('input[id="land"]').is(':checked')) {
FAILSAFE_CONFIG.failsafe_procedure = 0;
} else if( $('input[id="drop"]').is(':checked')) {
FAILSAFE_CONFIG.failsafe_procedure = 1;
} else if( $('input[id="rth"]').is(':checked')) {
FAILSAFE_CONFIG.failsafe_procedure = 2;
}
FAILSAFE_CONFIG.failsafe_kill_switch = $('input[name="failsafe_kill_switch"]').is(':checked') ? 1 : 0;
} else { } else {
// get FAILSAFE feature option (pre API 1.15.0) BF_CONFIG.features = bit_clear(BF_CONFIG.features, 8);
if ($('input[name="failsafe_feature"]').is(':checked')) {
BF_CONFIG.features = bit_set(BF_CONFIG.features, 8);
} else {
BF_CONFIG.features = bit_clear(BF_CONFIG.features, 8);
}
// get failsafe_throttle field value (pre API 1.15.0)
MISC.failsafe_throttle = parseInt($('input[name="failsafe_throttle_old"]').val());
} }
FAILSAFE_CONFIG.failsafe_throttle = parseInt($('input[name="failsafe_throttle"]').val());
FAILSAFE_CONFIG.failsafe_off_delay = parseInt($('input[name="failsafe_off_delay"]').val());
FAILSAFE_CONFIG.failsafe_throttle_low_delay = parseInt($('input[name="failsafe_throttle_low_delay"]').val());
FAILSAFE_CONFIG.failsafe_delay = parseInt($('input[name="failsafe_delay"]').val());
if ($('input[id="land"]').is(':checked')) {
FAILSAFE_CONFIG.failsafe_procedure = 0;
} else if ($('input[id="drop"]').is(':checked')) {
FAILSAFE_CONFIG.failsafe_procedure = 1;
} else if ($('input[id="rth"]').is(':checked')) {
FAILSAFE_CONFIG.failsafe_procedure = 2;
}
FAILSAFE_CONFIG.failsafe_kill_switch = $('input[name="failsafe_kill_switch"]').is(':checked') ? 1 : 0;
function save_failssafe_config() { function save_failssafe_config() {
MSP.send_message(MSPCodes.MSP_SET_FAILSAFE_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_FAILSAFE_CONFIG), false, save_rxfail_config); MSP.send_message(MSPCodes.MSP_SET_FAILSAFE_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_FAILSAFE_CONFIG), false, save_rxfail_config);
} }
@ -328,12 +282,6 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
MSP.send_message(MSPCodes.MSP_SET_BF_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_BF_CONFIG), false, save_to_eeprom); MSP.send_message(MSPCodes.MSP_SET_BF_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_BF_CONFIG), false, save_to_eeprom);
} }
// BEGIN pre API 1.15.0 save functions
function save_misc() {
MSP.send_message(MSPCodes.MSP_SET_MISC, mspHelper.crunch(MSPCodes.MSP_SET_MISC), false, save_to_eeprom);
}
// END pre API 1.15.0 save functions
function save_to_eeprom() { function save_to_eeprom() {
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, reboot); MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, reboot);
} }
@ -341,7 +289,7 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
function reboot() { function reboot() {
GUI.log(chrome.i18n.getMessage('configurationEepromSaved')); GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
GUI.tab_switch_cleanup(function() { GUI.tab_switch_cleanup(function () {
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, reinitialize); MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, reinitialize);
}); });
} }
@ -351,11 +299,7 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
GUI.handleReconnect($('.tab_failsafe a')); GUI.handleReconnect($('.tab_failsafe a'));
} }
if(apiVersionGte1_15_0) { MSP.send_message(MSPCodes.MSP_SET_RX_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_RX_CONFIG), false, save_failssafe_config);
MSP.send_message(MSPCodes.MSP_SET_RX_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_RX_CONFIG), false, save_failssafe_config);
} else {
MSP.send_message(MSPCodes.MSP_SET_BF_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_BF_CONFIG), false, save_misc);
}
}); });
GUI.content_ready(callback); GUI.content_ready(callback);

View file

@ -178,7 +178,7 @@ TABS.motors.initialize = function (callback) {
$motorsEnableTestMode.prop('checked', false); $motorsEnableTestMode.prop('checked', false);
$motorsEnableTestMode.prop('disabled', true); $motorsEnableTestMode.prop('disabled', true);
update_model(CONFIG.multiType); update_model(BF_CONFIG.mixerConfiguration);
// Always start with default/empty sensor data array, clean slate all // Always start with default/empty sensor data array, clean slate all
initSensorData(); initSensorData();

View file

@ -256,7 +256,6 @@ TABS.profiles.initialize = function (callback, scrollPosition) {
} }
loadChainer.setChain([ loadChainer.setChain([
mspHelper.loadMspIdent,
mspHelper.loadBfConfig, mspHelper.loadBfConfig,
mspHelper.loadLoopTime, mspHelper.loadLoopTime,
mspHelper.loadINAVPidConfig, mspHelper.loadINAVPidConfig,

View file

@ -39,11 +39,11 @@ TABS.servos.initialize = function (callback) {
$('#content').load("./tabs/servos.html", process_html); $('#content').load("./tabs/servos.html", process_html);
} }
MSP.send_message(MSPCodes.MSP_IDENT, false, false, get_servo_configurations); get_servo_configurations();
function update_ui() { function update_ui() {
if (semver.lt(CONFIG.apiVersion, "1.12.0") || SERVO_CONFIG.length == 0) { if (SERVO_CONFIG.length == 0) {
$(".tab-servos").removeClass("supported"); $(".tab-servos").removeClass("supported");
return; return;

View file

@ -16,7 +16,6 @@ TABS.setup.initialize = function (callback) {
var loadChainer = new MSPChainerClass(); var loadChainer = new MSPChainerClass();
loadChainer.setChain([ loadChainer.setChain([
mspHelper.loadMspIdent,
mspHelper.loadBfConfig, mspHelper.loadBfConfig,
mspHelper.loadMisc mspHelper.loadMisc
]); ]);
@ -274,7 +273,7 @@ TABS.setup.initialize3D = function () {
// //
// load the model including materials // load the model including materials
if (useWebGlRenderer) { if (useWebGlRenderer) {
model_file = mixerList[CONFIG.multiType - 1].model; model_file = mixerList[BF_CONFIG.mixerConfiguration - 1].model;
} else { } else {
model_file = 'fallback' model_file = 'fallback'
} }