Commit 15dea6b6 authored by Darren Lines's avatar Darren Lines
Browse files

Reconfigured Advanced Tuning

The Advanced Tuning page has been reconfigured. It now will show only relevant settings based on the platform. Fixed Wing and Multirotor have their own top sections. Other platforms see both those sections as a fall-back, The bottom section (generic) is visible for all platforms. There is no replication on any views.

I have also updated the code to use the new data-setting method. Though this seems to have added some lag in loading times.
parent 9d74c1db
...@@ -2363,13 +2363,16 @@ ...@@ -2363,13 +2363,16 @@
"message": "Programming" "message": "Programming"
}, },
"tabAdvancedTuning": { "tabAdvancedTuning": {
"message": "Advanced tuning" "message": "Advanced Tuning"
}, },
"advancedTuningSave": { "advancedTuningSave": {
"message": "Save and Reboot" "message": "Save and Reboot"
}, },
"tabAdvancedTuningTitle": { "tabAdvancedTuningTitle": {
"message": "Advanced tuning" "message": "Advanced Tuning"
},
"tabAdvancedTuningGenericTitle": {
"message": "Advanced Tuning: Generic settings"
}, },
"presetApplyHead": { "presetApplyHead": {
"message": "Applies following settings:" "message": "Applies following settings:"
...@@ -2549,19 +2552,31 @@ ...@@ -2549,19 +2552,31 @@
"message": "Max. throttle" "message": "Max. throttle"
}, },
"maxBankAngle": { "maxBankAngle": {
"message": "Max. bank angle [degrees]" "message": "Max. navigation bank angle [degrees]"
}, },
"maxBankAngleHelp": { "maxBankAngleHelp": {
"message": "Maximum banking angle in navigation modes. Constrained by maximum ROLL angle in PID tuning tab." "message": "Maximum banking angle in navigation modes. Constrained by maximum ROLL angle in PID tuning tab."
}, },
"maxClimbAngle": { "maxClimbAngle": {
"message": "Max. climb angle [degrees]" "message": "Max. navigation climb angle [degrees]"
}, },
"maxClimbAngleHelp": { "maxClimbAngleHelp": {
"message": "Maximum climb angle in navigation modes. Constrained by maximum PITCH angle in PID tuning tab." "message": "Maximum climb angle in navigation modes. Constrained by maximum PITCH angle in PID tuning tab."
}, },
"navManualClimbRate": {
"message": "Max. Alt-hold climb rate [cm/s]"
},
"navManualClimbRateHelp": {
"message": "Maximum climb/descent rate firmware is allowed when processing pilot input for ALTHOLD control mode [cm/s]"
},
"navAutoClimbRate": {
"message": "Max. navigation climb rate [cm/s]"
},
"navAutoClimbRateHelp": {
"message": "Maximum climb/descent rate that UAV is allowed to reach during navigation modes. [cm/s]"
},
"maxDiveAngle": { "maxDiveAngle": {
"message": "Max. dive angle [degrees]" "message": "Max. navigation dive angle [degrees]"
}, },
"maxDiveAngleHelp": { "maxDiveAngleHelp": {
"message": "Maximum dive angle in navigation modes. Constrained by maximum PITCH angle in PID tuning tab." "message": "Maximum dive angle in navigation modes. Constrained by maximum PITCH angle in PID tuning tab."
...@@ -2599,6 +2614,36 @@ ...@@ -2599,6 +2614,36 @@
"controlSmoothnessHelp": { "controlSmoothnessHelp": {
"message": "How smoothly the autopilot controls the airplane to correct the navigation error [0-9]." "message": "How smoothly the autopilot controls the airplane to correct the navigation error [0-9]."
}, },
"powerConfiguration": {
"message": "Battery Estimation Settings"
},
"idlePower": {
"message": "Idle power [cW]"
},
"idlePowerHelp": {
"message": "Power draw at zero throttle used for remaining flight time/distance estimation in 0.01W unit"
},
"cruisePower": {
"message": "Cruise power [cW]"
},
"cruisePowerHelp": {
"message": "Power draw at cruise throttle used for remaining flight time/distance estimation in 0.01W unit"
},
"cruiseSpeed": {
"message": "Cruise speed [cm/s]"
},
"cruiseSpeedHelp": {
"message": "Speed for the plane/wing at cruise throttle used for remaining flight time/distance estimation in cm/s"
},
"rthEnergyMargin": {
"message": "RTH energy margin [%]"
},
"rthEnergyMarginHelp": {
"message": "Energy margin wanted after getting home (percent of battery energy capacity). Use for the remaining flight time/distance calculation."
},
"generalNavigationSettings": {
"message": "General Navigation Settings"
},
"waypointConfiguration": { "waypointConfiguration": {
"message": "Waypoint Navigation Settings" "message": "Waypoint Navigation Settings"
}, },
......
...@@ -67,6 +67,12 @@ var CONFIG, ...@@ -67,6 +67,12 @@ var CONFIG,
var FC = { var FC = {
MAX_SERVO_RATE: 125, MAX_SERVO_RATE: 125,
MIN_SERVO_RATE: 0, MIN_SERVO_RATE: 0,
isAirplane: function () {
return (MIXER_CONFIG.platformType == PLATFORM_AIRPLANE);
},
isMultirotor: function () {
return (MIXER_CONFIG.platformType == PLATFORM_MULTIROTOR || MIXER_CONFIG.platformType == PLATFORM_TRICOPTER);
},
isRpyFfComponentUsed: function () { isRpyFfComponentUsed: function () {
return (MIXER_CONFIG.platformType == PLATFORM_AIRPLANE || MIXER_CONFIG.platformType == PLATFORM_ROVER || MIXER_CONFIG.platformType == PLATFORM_BOAT) || ((MIXER_CONFIG.platformType == PLATFORM_MULTIROTOR || MIXER_CONFIG.platformType == PLATFORM_TRICOPTER) && semver.gte(CONFIG.flightControllerVersion, "2.6.0")); return (MIXER_CONFIG.platformType == PLATFORM_AIRPLANE || MIXER_CONFIG.platformType == PLATFORM_ROVER || MIXER_CONFIG.platformType == PLATFORM_BOAT) || ((MIXER_CONFIG.platformType == PLATFORM_MULTIROTOR || MIXER_CONFIG.platformType == PLATFORM_TRICOPTER) && semver.gte(CONFIG.flightControllerVersion, "2.6.0"));
}, },
...@@ -74,7 +80,7 @@ var FC = { ...@@ -74,7 +80,7 @@ var FC = {
return true; // Currently all platforms use D term return true; // Currently all platforms use D term
}, },
isCdComponentUsed: function () { isCdComponentUsed: function () {
return MIXER_CONFIG.platformType == PLATFORM_MULTIROTOR || MIXER_CONFIG.platformType == PLATFORM_TRICOPTER; return (MIXER_CONFIG.platformType == PLATFORM_MULTIROTOR || MIXER_CONFIG.platformType == PLATFORM_TRICOPTER);
}, },
resetState: function () { resetState: function () {
SENSOR_STATUS = { SENSOR_STATUS = {
......
This diff is collapsed.
...@@ -4,109 +4,33 @@ TABS.advanced_tuning = {}; ...@@ -4,109 +4,33 @@ TABS.advanced_tuning = {};
TABS.advanced_tuning.initialize = function (callback) { TABS.advanced_tuning.initialize = function (callback) {
var loadChainer = new MSPChainerClass(),
saveChainer = new MSPChainerClass();
if (GUI.active_tab != 'advanced_tuning') { if (GUI.active_tab != 'advanced_tuning') {
GUI.active_tab = 'advanced_tuning'; GUI.active_tab = 'advanced_tuning';
googleAnalytics.sendAppView('AdvancedTuning'); googleAnalytics.sendAppView('AdvancedTuning');
} }
loadChainer.setChain([ loadHtml();
mspHelper.loadNavPosholdConfig,
mspHelper.loadPositionEstimationConfig,
mspHelper.loadRthAndLandConfig,
mspHelper.loadFwConfig,
mspHelper.loadBrakingConfig
]);
loadChainer.setExitPoint(loadHtml);
loadChainer.execute();
saveChainer.setChain([
mspHelper.saveNavPosholdConfig,
mspHelper.savePositionEstimationConfig,
mspHelper.saveRthAndLandConfig,
mspHelper.saveFwConfig,
mspHelper.saveBrakingConfig,
mspHelper.saveToEeprom
]);
saveChainer.setExitPoint(reboot);
function loadHtml() { function loadHtml() {
GUI.load("./tabs/advanced_tuning.html", Settings.processHtml(function () { GUI.load("./tabs/advanced_tuning.html", Settings.processHtml(function () {
var $userControlMode = $('#user-control-mode'), if (FC.isAirplane()) {
$useMidThrottle = $("#use-mid-throttle"), $('.airplaneTuning').show();
$rthClimbFirst = $('#rth-climb-first'), $('.multirotorTuning').hide();
$rthClimbIgnoreEmergency = $('#rthClimbIgnoreEmergency'), $('.notFixedWingTuning').hide();
$rthTailFirst = $('#rthTailFirst'), } else if (FC.isMultirotor()) {
$rthAllowLanding = $('#rthAllowLanding'), $('.airplaneTuning').hide();
$rthAltControlMode = $('#rthAltControlMode'); $('.multirotorTuning').show();
$('.notFixedWingTuning').show();
$rthClimbFirst.prop("checked", RTH_AND_LAND_CONFIG.rthClimbFirst); } else {
$rthClimbFirst.change(function () { $('.airplaneTuning').show();
if ($(this).is(":checked")) { $('.multirotorTuning').show();
RTH_AND_LAND_CONFIG.rthClimbFirst = 1; $('.notFixedWingTuning').show();
} else { }
RTH_AND_LAND_CONFIG.rthClimbFirst = 0;
}
});
$rthClimbFirst.change();
$rthClimbIgnoreEmergency.prop("checked", RTH_AND_LAND_CONFIG.rthClimbIgnoreEmergency);
$rthClimbIgnoreEmergency.change(function () {
if ($(this).is(":checked")) {
RTH_AND_LAND_CONFIG.rthClimbIgnoreEmergency = 1;
} else {
RTH_AND_LAND_CONFIG.rthClimbIgnoreEmergency = 0;
}
});
$rthClimbIgnoreEmergency.change();
$rthTailFirst.prop("checked", RTH_AND_LAND_CONFIG.rthTailFirst);
$rthTailFirst.change(function () {
if ($(this).is(":checked")) {
RTH_AND_LAND_CONFIG.rthTailFirst = 1;
} else {
RTH_AND_LAND_CONFIG.rthTailFirst = 0;
}
});
$rthTailFirst.change();
GUI.fillSelect($rthAltControlMode, FC.getRthAltControlMode(), RTH_AND_LAND_CONFIG.rthAltControlMode);
$rthAltControlMode.val(RTH_AND_LAND_CONFIG.rthAltControlMode);
$rthAltControlMode.change(function () {
RTH_AND_LAND_CONFIG.rthAltControlMode = $rthAltControlMode.val();
});
GUI.fillSelect($rthAllowLanding, FC.getRthAllowLanding(), RTH_AND_LAND_CONFIG.rthAllowLanding);
$rthAllowLanding.val(RTH_AND_LAND_CONFIG.rthAllowLanding);
$rthAllowLanding.change(function () {
RTH_AND_LAND_CONFIG.rthAllowLanding = $rthAllowLanding.val();
});
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();
GUI.simpleBind(); GUI.simpleBind();
localize(); localize();
$('#advanced-tuning-save-button').click(function () {
saveChainer.execute();
});
$('a.save').click(function () { $('a.save').click(function () {
Settings.saveInputs().then(function () { Settings.saveInputs().then(function () {
...@@ -117,6 +41,7 @@ TABS.advanced_tuning.initialize = function (callback) { ...@@ -117,6 +41,7 @@ TABS.advanced_tuning.initialize = function (callback) {
setTimeout(function () { setTimeout(function () {
$(self).html(oldText); $(self).html(oldText);
}, 2000); }, 2000);
reboot();
}); });
}); });
GUI.content_ready(callback); GUI.content_ready(callback);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment