Merge pull request #108 from iNavFlight/advanced-tuning-tab

Advanced tuning tab
pull/120/head
Paweł Spychalski 8 years ago committed by GitHub
commit 5643c9f312

@ -1919,6 +1919,15 @@
"presetApplyDescription": {
"message": "Preset overwrites selected configuration values including mixer, filtering, PIDs and other. Settings like: flight modes, radio settings, failsafe and OSD are not changed. Applied values should <strong>NOT</strong> treated as final values, but entry points for final tuning. <br> Always check new configuration before flying!"
},
"tabAdvancedTuning": {
"message": "Advanced tuning"
},
"advancedTuningSave": {
"message": "Save and Reboot"
},
"tabAdvancedTuningTitle": {
"message": "Advanced tuning"
},
"presetApplyHead": {
"message": "Applies following settings:"
},
@ -1957,5 +1966,69 @@
},
"dtermNotchCutoffHelp": {
"message": "Defines band of filter. <br><br>Has to be kept below notch filter frequency."
},
"positionHoldConfiguration": {
"message": "Basic Navigation Settings"
},
"userControlMode": {
"message": "User Control Mode"
},
"posholdMaxSpeed": {
"message": "Max. navigation speed [cm/s]"
},
"posholdMaxManualSpeed": {
"message": "Max. CRUISE speed [cm/s]"
},
"posholdMaxClimbRate": {
"message": "Max. navigation climb rate [cm/s]"
},
"posholdMaxManualClimbRate": {
"message": "Max. ALTHOLD climb rate [cm/s]"
},
"posholdMaxBankAngle": {
"message": "Multirotor max. banking angle [deg]"
},
"posholdHoverThrottle": {
"message": "Hover throttle"
},
"posholdHoverMidThrottle": {
"message": "Use mid. throttle for ALTHOLD"
},
"positionEstimatorConfiguration": {
"message": "Position Estimator"
},
"w_z_baro_p": {
"message": "Vertical Position Baro Weight"
},
"w_z_gps_p": {
"message": "Vertical Position GPS Weight"
},
"w_z_gps_v": {
"message": "Vertical Speed GPS Weight"
},
"w_xy_gps_p": {
"message": "Horizontal Position GPS Weight"
},
"w_xy_gps_v": {
"message": "Horizontal Speed GPS Weight"
},
"positionEstimatorConfigurationDisclaimer": {
"message": "Those value should be changed very carefully. In most cases there is not need to change them. For advanced users only!"
},
"gps_min_sats": {
"message": "Min. GPS sats for valid fix"
},
"use_gps_velned": {
"message": "Use GPS data for velocity calculation"
},
"use_gps_velned_help": {
"message": "Defined if iNav should use velocity data provided by GPS module for doing position and speed estimation. If set to OFF iNav will fallback to calculating velocity from GPS coordinates. Using native velocity data may improve performance on some GPS modules. Some GPS modules introduce significant delay and using native velocity may actually result in much worse performance."
},
"w_z_baro_p_help": {
"message": "When this value is set to <strong>0</strong>, barometer is not used for altitude computation"
},
"w_z_gos_p_help": {
"message": "When this value is set to <strong>0</strong>, GPS is not used for altitude computation"
}
}

@ -708,5 +708,11 @@ var FC = {
}
return retVal;
},
getUserControlMode: function () {
return [
"Attitude",
"Cruise"
]
}
};

@ -36,7 +36,8 @@ var GUI_control = function () {
'servos',
'setup',
'osd',
'profiles'
'profiles',
'advanced_tuning'
];
this.allowedTabs = this.defaultAllowedTabsWhenDisconnected;

@ -901,11 +901,11 @@ var mspHelper = (function (gui) {
break;
case MSPCodes.MSP_POSITION_ESTIMATION_CONFIG:
POSITION_ESTIMATOR.w_z_baro_p = data.getUint16(0, true);
POSITION_ESTIMATOR.w_z_gps_p = data.getUint16(2, true);
POSITION_ESTIMATOR.w_z_gps_v = data.getUint16(4, true);
POSITION_ESTIMATOR.w_xy_gps_p = data.getUint16(6, true);
POSITION_ESTIMATOR.w_xy_gps_v = data.getUint16(8, true);
POSITION_ESTIMATOR.w_z_baro_p = data.getUint16(0, true) / 100;
POSITION_ESTIMATOR.w_z_gps_p = data.getUint16(2, true) / 100;
POSITION_ESTIMATOR.w_z_gps_v = data.getUint16(4, true) / 100;
POSITION_ESTIMATOR.w_xy_gps_p = data.getUint16(6, true) / 100;
POSITION_ESTIMATOR.w_xy_gps_v = data.getUint16(8, true) / 100;
POSITION_ESTIMATOR.gps_min_sats = data.getUint8(10);
POSITION_ESTIMATOR.use_gps_velned = data.getUint8(11);
break;
@ -1234,20 +1234,20 @@ var mspHelper = (function (gui) {
break;
case MSPCodes.MSP_SET_POSITION_ESTIMATION_CONFIG:
buffer.push(lowByte(POSITION_ESTIMATOR.w_z_baro_p));
buffer.push(highByte(POSITION_ESTIMATOR.w_z_baro_p));
buffer.push(lowByte(POSITION_ESTIMATOR.w_z_baro_p * 100));
buffer.push(highByte(POSITION_ESTIMATOR.w_z_baro_p * 100));
buffer.push(lowByte(POSITION_ESTIMATOR.w_z_gps_p));
buffer.push(highByte(POSITION_ESTIMATOR.w_z_gps_p));
buffer.push(lowByte(POSITION_ESTIMATOR.w_z_gps_p * 100));
buffer.push(highByte(POSITION_ESTIMATOR.w_z_gps_p * 100));
buffer.push(lowByte(POSITION_ESTIMATOR.w_z_gps_v));
buffer.push(highByte(POSITION_ESTIMATOR.w_z_gps_v));
buffer.push(lowByte(POSITION_ESTIMATOR.w_z_gps_v * 100));
buffer.push(highByte(POSITION_ESTIMATOR.w_z_gps_v * 100));
buffer.push(lowByte(POSITION_ESTIMATOR.w_xy_gps_p));
buffer.push(highByte(POSITION_ESTIMATOR.w_xy_gps_p));
buffer.push(lowByte(POSITION_ESTIMATOR.w_xy_gps_p * 100));
buffer.push(highByte(POSITION_ESTIMATOR.w_xy_gps_p * 100));
buffer.push(lowByte(POSITION_ESTIMATOR.w_xy_gps_v));
buffer.push(highByte(POSITION_ESTIMATOR.w_xy_gps_v));
buffer.push(lowByte(POSITION_ESTIMATOR.w_xy_gps_v * 100));
buffer.push(highByte(POSITION_ESTIMATOR.w_xy_gps_v * 100));
buffer.push(POSITION_ESTIMATOR.gps_min_sats);
buffer.push(POSITION_ESTIMATOR.use_gps_velned);
@ -1971,5 +1971,37 @@ var mspHelper = (function (gui) {
}
};
self.loadNavPosholdConfig = function (callback) {
if (semver.gte(CONFIG.flightControllerVersion, "1.6.0")) {
MSP.send_message(MSPCodes.MSP_NAV_POSHOLD, false, false, callback);
} else {
callback();
}
};
self.saveNavPosholdConfig = function (callback) {
if (semver.gte(CONFIG.flightControllerVersion, "1.6.0")) {
MSP.send_message(MSPCodes.MSP_SET_NAV_POSHOLD, mspHelper.crunch(MSPCodes.MSP_SET_NAV_POSHOLD), false, callback);
} else {
callback();
}
};
self.loadPositionEstimationConfig = function (callback) {
if (semver.gte(CONFIG.flightControllerVersion, "1.6.0")) {
MSP.send_message(MSPCodes.MSP_POSITION_ESTIMATION_CONFIG, false, false, callback);
} else {
callback();
}
};
self.savePositionEstimationConfig = function (callback) {
if (semver.gte(CONFIG.flightControllerVersion, "1.6.0")) {
MSP.send_message(MSPCodes.MSP_SET_POSITION_ESTIMATION_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_POSITION_ESTIMATION_CONFIG), false, callback);
} else {
callback();
}
};
return self;
})(GUI);

@ -265,6 +265,7 @@ function onOpen(openInfo) {
*/
if (semver.lt(CONFIG.flightControllerVersion, "1.6.0")) {
GUI.allowedTabs.splice(GUI.allowedTabs.indexOf('profiles'), 1);
GUI.allowedTabs.splice(GUI.allowedTabs.indexOf('advanced_tuning'), 1);
}
onConnect();
@ -294,23 +295,25 @@ function onOpen(openInfo) {
console.log('Failed to open serial port');
GUI.log(chrome.i18n.getMessage('serialPortOpenFail'));
$('div#connectbutton a.connect_state').text(chrome.i18n.getMessage('connect'));
$('div#connectbutton a.connect').removeClass('active');
var $connectButton = $('#connectbutton');
$connectButton.find('.connect_state').text(chrome.i18n.getMessage('connect'));
$connectButton.find('.connect').removeClass('active');
// unlock port select & baud
$('#port, #baud, #delay').prop('disabled', false);
// reset data
$('div#connectbutton a.connect').data("clicks", false);
$connectButton.find('.connect').data("clicks", false);
}
}
function onConnect() {
helper.timeout.remove('connecting'); // kill connecting timer
$('div#connectbutton a.connect_state').text(chrome.i18n.getMessage('disconnect')).addClass('active');
$('div#connectbutton a.connect').addClass('active');
$('#tabs ul.mode-disconnected').hide();
$('#tabs ul.mode-connected').show();
$('#connectbutton a.connect_state').text(chrome.i18n.getMessage('disconnect')).addClass('active');
$('#connectbutton a.connect').addClass('active');
$('.mode-disconnected').hide();
$('.mode-connected').show();
MSP.send_message(MSPCodes.MSP_DATAFLASH_SUMMARY, false, false);
@ -333,8 +336,8 @@ function onClosed(result) {
GUI.log(chrome.i18n.getMessage('serialPortClosedFail'));
}
$('#tabs ul.mode-connected').hide();
$('#tabs ul.mode-disconnected').show();
$('.mode-connected').hide();
$('.mode-disconnected').show();
$('#sensor-status').hide();
$('#portsinput').show();
@ -456,35 +459,6 @@ function lowByte(num) {
return 0x00FF & num;
}
function update_dataflash_global() {
var supportsDataflash = DATAFLASH.totalSize > 0;
if (supportsDataflash) {
$(".noflash_global").css({
display: 'none'
});
$(".dataflash-contents_global").css({
display: 'block'
});
$(".dataflash-free_global").css({
width: (100 - (DATAFLASH.totalSize - DATAFLASH.usedSize) / DATAFLASH.totalSize * 100) + "%",
display: 'block'
});
$(".dataflash-free_global div").text('Dataflash: free ' + formatFilesize(DATAFLASH.totalSize - DATAFLASH.usedSize));
} else {
$(".noflash_global").css({
display: 'block'
});
$(".dataflash-contents_global").css({
display: 'none'
});
}
}
function specificByte(num, pos) {
return 0x000000FF & (num >> (8 * pos));
}

@ -1907,4 +1907,8 @@ select {
.jBox-Tooltip {
max-width: 180px;
}
.spacebottom {
margin-bottom: 15px;
}

@ -29,6 +29,7 @@
<link type="text/css" rel="stylesheet" href="./tabs/transponder.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/osd.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/profiles.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/advanced_tuning.css" media="all" />
<link type="text/css" rel="stylesheet" href="./css/opensans_webfontkit/fonts.css" media="all" />
<link type="text/css" rel="stylesheet" href="./css/dropdown-lists/css/style_lists.css" media="all" />
<link type="text/css" rel="stylesheet" href="./js/libraries/switchery/switchery.css" media="all" />
@ -92,6 +93,7 @@
<script type="text/javascript" src="./tabs/transponder.js"></script>
<script type="text/javascript" src="./tabs/osd.js"></script>
<script type="text/javascript" src="./tabs/profiles.js"></script>
<script type="text/javascript" src="./tabs/advanced_tuning.js"></script>
<script type="text/javascript" src="./js/eventFrequencyAnalyzer.js"></script>
<script type="text/javascript" src="./js/periodicStatusUpdater.js"></script>
<title></title>
@ -232,6 +234,7 @@
<li class="tab_configuration"><a href="#" data-i18n="tabConfiguration" class="tabicon ic_config" title="Configuration"></a></li>
<li class="tab_failsafe"><a href="#" data-i18n="tabFailsafe" class="tabicon ic_failsafe" title="Failsafe"></a></li>
<li class="tab_pid_tuning"><a href="#" data-i18n="tabPidTuning" class="tabicon ic_pid" title="PID Tuning"></a></li>
<li class="tab_advanced_tuning"><a href="#" data-i18n="tabAdvancedTuning" class="tabicon ic_advanced" title="Advanced Tuning"></a></li>
<li class="tab_receiver"><a href="#" data-i18n="tabReceiver" class="tabicon ic_rx" title="Receiver"></a></li>
<li class="tab_auxiliary"><a href="#" data-i18n="tabAuxiliary" class="tabicon ic_modes" title="Modes"></a></li>
<li class="tab_adjustments"><a href="#" data-i18n="tabAdjustments" class="tabicon ic_adjust" title="Adjustments"></a></li>

@ -181,6 +181,9 @@ $(document).ready(function () {
case 'onboard_logging':
TABS.onboard_logging.initialize(content_ready);
break;
case 'advanced_tuning':
TABS.advanced_tuning.initialize(content_ready);
break;
case 'cli':
TABS.cli.initialize(content_ready);
break;

@ -112,7 +112,3 @@
.tab-adjustments .adjustment .functionSwitchChannel {
width: 5%;
}
.tab-adjustments .spacebottom {
margin-bottom: 15px;
}

@ -0,0 +1,135 @@
<div class="tab-configuration tab-advanced-tuning toolbar_fixed_bottom">
<div class="content_wrapper">
<div class="tab_title" data-i18n="tabAdvancedTuningTitle">Advanced tuning</div>
<div class="leftWrapper">
<div class="config-section gui_box grey">
<div class="gui_box_titlebar">
<div class="spacer_box_title" data-i18n="positionHoldConfiguration"></div>
</div>
<div class="spacer_box">
<div class="select">
<select id="user-control-mode"></select>
<label for="user-control-mode"> <span data-i18n="userControlMode"></span></label>
</div>
<div class="number">
<input id="max-speed" type="number" data-simple-bind="NAV_POSHOLD.maxSpeed" step="1" min="10" max="2000">
<label for="max-speed">
<span data-i18n="posholdMaxSpeed"></span>
</label>
</div>
<div class="number">
<input id="max-manual-speed" type="number" data-simple-bind="NAV_POSHOLD.maxManualSpeed" step="1" min="10" max="2000">
<label for="max-manual-speed">
<span data-i18n="posholdMaxManualSpeed"></span>
</label>
</div>
<div class="number">
<input id="max-climb-rate" type="number" data-simple-bind="NAV_POSHOLD.maxClimbRate" step="1" min="10" max="2000">
<label for="max-climb-rate">
<span data-i18n="posholdMaxClimbRate"></span>
</label>
</div>
<div class="number">
<input id="max-manual-climb-rate" type="number" data-simple-bind="NAV_POSHOLD.maxManualClimbRate" step="1" min="10" max="2000">
<label for="max-manual-climb-rate">
<span data-i18n="posholdMaxManualClimbRate"></span>
</label>
</div>
<div class="number">
<input id="max-bank-angle" type="number" data-simple-bind="NAV_POSHOLD.maxBankAngle" step="1" min="15" max="45">
<label for="max-bank-angle">
<span data-i18n="posholdMaxBankAngle"></span>
</label>
</div>
<div class="checkbox">
<input type="checkbox" id="use-mid-throttle" class="toggle" />
<label for="use-mid-throttle">
<span data-i18n="posholdHoverMidThrottle"></span>
</label>
</div>
<div class="number">
<input id="hover-throttle" type="number" data-simple-bind="NAV_POSHOLD.hoverThrottle" step="1" min="1000" max="2000">
<label for="hover-throttle">
<span data-i18n="posholdHoverThrottle"></span>
</label>
</div>
</div>
</div>
</div>
<div class="rightWrapper">
<div class="config-section gui_box grey">
<div class="gui_box_titlebar">
<div class="spacer_box_title" data-i18n="positionEstimatorConfiguration"></div>
</div>
<div class="spacer_box">
<div class="note spacebottom">
<div class="note_spacer" >
<p data-i18n="positionEstimatorConfigurationDisclaimer"></p>
</div>
</div>
<div class="number">
<input id="w_z_baro_p" type="number" data-simple-bind="POSITION_ESTIMATOR.w_z_baro_p" step="0.01" min="0" max="10">
<label for="w_z_baro_p">
<span data-i18n="w_z_baro_p"></span>
</label>
<div class="helpicon cf_tip" data-i18n_title="w_z_baro_p_help"></div>
</div>
<div class="number">
<input id="w_z_gps_p" type="number" data-simple-bind="POSITION_ESTIMATOR.w_z_gps_p" step="0.01" min="0" max="10">
<label for="w_z_gps_p">
<span data-i18n="w_z_gps_p"></span>
</label>
<div class="helpicon cf_tip" data-i18n_title="w_z_gos_p_help"></div>
</div>
<div class="number">
<input id="w_z_gps_v" type="number" data-simple-bind="POSITION_ESTIMATOR.w_z_gps_v" step="0.01" min="0" max="10">
<label for="w_z_gps_v">
<span data-i18n="w_z_gps_v"></span>
</label>
</div>
<div class="number">
<input id="w_xy_gps_p" type="number" data-simple-bind="POSITION_ESTIMATOR.w_xy_gps_p" step="0.01" min="0" max="10">
<label for="w_xy_gps_p">
<span data-i18n="w_xy_gps_p"></span>
</label>
</div>
<div class="number">
<input id="w_xy_gps_v" type="number" data-simple-bind="POSITION_ESTIMATOR.w_xy_gps_v" step="0.01" min="0" max="10">
<label for="w_xy_gps_v">
<span data-i18n="w_xy_gps_v"></span>
</label>
</div>
<div class="number">
<input id="gps_min_sats" type="number" data-simple-bind="POSITION_ESTIMATOR.gps_min_sats" step="1" min="5" max="10">
<label for="gps_min_sats">
<span data-i18n="gps_min_sats"></span>
</label>
</div>
<div class="checkbox">
<input type="checkbox" id="use_gps_velned" class="toggle" />
<label for="use_gps_velned">
<span data-i18n="use_gps_velned"></span>
</label>
<div class="helpicon cf_tip" data-i18n_title="use_gps_velned_help"></div>
</div>
</div>
</div>
</div>
<div class="clear-both"></div>
</div>
<div class="content_toolbar">
<div class="btn save_btn">
<a id="advanced-tuning-save-button" class="save" href="#" data-i18n="advancedTuningSave"></a>
</div>
</div>
</div>

@ -0,0 +1,93 @@
'use strict';
TABS.advanced_tuning = {};
TABS.advanced_tuning.initialize = function (callback) {
var loadChainer = new MSPChainerClass(),
saveChainer = new MSPChainerClass();
if (GUI.active_tab != 'advanced_tuning') {
GUI.active_tab = 'advanced_tuning';
googleAnalytics.sendAppView('AdvancedTuning');
}
loadChainer.setChain([
mspHelper.loadNavPosholdConfig,
mspHelper.loadPositionEstimationConfig
]);
loadChainer.setExitPoint(loadHtml);
loadChainer.execute();
saveChainer.setChain([
mspHelper.saveNavPosholdConfig,
mspHelper.savePositionEstimationConfig,
mspHelper.saveToEeprom
]);
saveChainer.setExitPoint(reboot);
function loadHtml() {
$('#content').load("./tabs/advanced_tuning.html", processHtml);
}
function reboot() {
//noinspection JSUnresolvedVariable
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
GUI.tab_switch_cleanup(function () {
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, reinitialize);
});
}
function reinitialize() {
//noinspection JSUnresolvedVariable
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
GUI.handleReconnect($('.tab_advanced_tuning a'));
}
function processHtml() {
var $userControlMode = $('#user-control-mode'),
$useMidThrottle = $("#use-mid-throttle"),
$useGpsVelned = $('#use_gps_velned');
GUI.fillSelect($userControlMode, FC.getUserControlMode(), NAV_POSHOLD.userControlMode);
$userControlMode.val(NAV_POSHOLD.userControlMode);
$userControlMode.change(function () {
NAV_POSHOLD.userControlMode = $userControlMode.val();
});
$useMidThrottle.prop("checked", NAV_POSHOLD.useThrottleMidForAlthold);
$useMidThrottle.change(function () {
if ($(this).is(":checked")) {
NAV_POSHOLD.useThrottleMidForAlthold = 1;
} else {
NAV_POSHOLD.useThrottleMidForAlthold = 0;
}
});
$useMidThrottle.change();
$useGpsVelned.prop("checked", POSITION_ESTIMATOR.use_gps_velned);
$useGpsVelned.change(function () {
if ($(this).is(":checked")) {
POSITION_ESTIMATOR.use_gps_velned = 1;
} else {
POSITION_ESTIMATOR.use_gps_velned = 0;
}
});
$useGpsVelned.change();
GUI.simpleBind();
localize();
$('#advanced-tuning-save-button').click(function () {
saveChainer.execute();
});
GUI.content_ready(callback);
}
};
TABS.advanced_tuning.cleanup = function (callback) {
if (callback) callback();
};

@ -193,11 +193,6 @@
line-height: 28px;
}
.tab-auxiliary .spacebottom {
margin-bottom: 15px;
}
@media only screen and (max-width: 1055px) , only screen and (max-device-width: 1055px) {
.tab-auxiliary .fixed_band {
width: calc(100% - -30px);

@ -20,6 +20,7 @@
font-weight: bold;
}
.config-section .number input,
.tab-configuration .number input {
width: 65px;
padding-left: 3px;
@ -38,10 +39,12 @@
background-color: #ececec;
}
.config-section input,
.tab-configuration input {
float: left;
}
.config-section .spacer_box,
.tab-configuration .spacer_box {
padding-bottom: 10px;
float: left;
@ -62,6 +65,8 @@
border-bottom: 1px solid #ddd;
}
.config-section .number,
.config-section .select,
.tab-configuration .number,
.tab-configuration .select,
.tab-configuration .radio,
@ -75,6 +80,8 @@ hr {
float: left;
}
.config-section .number:last-child,
.config-section .select:last-child,
.tab-configuration .number:last-child,
.tab-configuration .select:last-child,
.tab-configuration .radio:last-child,

@ -425,8 +425,4 @@
position: absolute;
z-index: 100;
border: 1px dotted white;
}
.tab-led-strip .spacebottom {
margin-bottom: 20px;
}

@ -90,10 +90,6 @@
border-right: 0px;
}
.tab-ports .spacebottom {
margin-bottom: 20px;
}
@media only screen and (max-width: 1055px) , only screen and (max-device-width: 1055px) {
.tab-ports table thead tr:first-child {
font-size: 12px;

Loading…
Cancel
Save