Unverified Commit c46a52ae authored by Paweł Spychalski's avatar Paweł Spychalski Committed by GitHub
Browse files

Merge pull request #1226 from MrD-RC/rearrange-advanced-tuning-page

Rearrange advanced tuning page
parents 6bdd8f88 6aebf2f0
......@@ -2363,13 +2363,16 @@
"message": "Programming"
},
"tabAdvancedTuning": {
"message": "Advanced tuning"
"message": "Advanced Tuning"
},
"advancedTuningSave": {
"message": "Save and Reboot"
},
"tabAdvancedTuningTitle": {
"message": "Advanced tuning"
"message": "Advanced Tuning"
},
"tabAdvancedTuningGenericTitle": {
"message": "Generic settings"
},
"presetApplyHead": {
"message": "Applies following settings:"
......@@ -2549,19 +2552,31 @@
"message": "Max. throttle"
},
"maxBankAngle": {
"message": "Max. bank angle [degrees]"
"message": "Max. navigation bank angle [degrees]"
},
"maxBankAngleHelp": {
"message": "Maximum banking angle in navigation modes. Constrained by maximum ROLL angle in PID tuning tab."
},
"maxClimbAngle": {
"message": "Max. climb angle [degrees]"
"message": "Max. navigation climb angle [degrees]"
},
"maxClimbAngleHelp": {
"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": {
"message": "Max. dive angle [degrees]"
"message": "Max. navigation dive angle [degrees]"
},
"maxDiveAngleHelp": {
"message": "Maximum dive angle in navigation modes. Constrained by maximum PITCH angle in PID tuning tab."
......@@ -2599,6 +2614,36 @@
"controlSmoothnessHelp": {
"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": {
"message": "Waypoint Navigation Settings"
},
......
......@@ -67,6 +67,12 @@ var CONFIG,
var FC = {
MAX_SERVO_RATE: 125,
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 () {
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 = {
return true; // Currently all platforms use D term
},
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 () {
SENSOR_STATUS = {
......
This diff is collapsed.
......@@ -4,110 +4,40 @@ 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,
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);
loadHtml();
function loadHtml() {
GUI.load("./tabs/advanced_tuning.html", Settings.processHtml(function () {
var $userControlMode = $('#user-control-mode'),
$useMidThrottle = $("#use-mid-throttle"),
$rthClimbFirst = $('#rth-climb-first'),
$rthClimbIgnoreEmergency = $('#rthClimbIgnoreEmergency'),
$rthTailFirst = $('#rthTailFirst'),
$rthAllowLanding = $('#rthAllowLanding'),
$rthAltControlMode = $('#rthAltControlMode');
$rthClimbFirst.prop("checked", RTH_AND_LAND_CONFIG.rthClimbFirst);
$rthClimbFirst.change(function () {
if ($(this).is(":checked")) {
RTH_AND_LAND_CONFIG.rthClimbFirst = 1;
} 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;
if (FC.isAirplane()) {
$('.airplaneTuning').show();
$('.airplaneTuningTitle').show();
$('.multirotorTuning').hide();
$('.multirotorTuningTitle').hide();
$('.notFixedWingTuning').hide();
} else if (FC.isMultirotor()) {
$('.airplaneTuning').hide();
$('.airplaneTuningTitle').hide();
$('.multirotorTuning').show();
$('.multirotorTuningTitle').show();
$('.notFixedWingTuning').show();
} else {
RTH_AND_LAND_CONFIG.rthTailFirst = 0;
$('.airplaneTuning').show();
$('.airplaneTuningTitle').hide();
$('.multirotorTuning').show();
$('.multirotorTuningTitle').hide();
$('.notFixedWingTuning').show();
}
});
$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();
localize();
$('#advanced-tuning-save-button').click(function () {
saveChainer.execute();
});
$('a.save').click(function () {
Settings.saveInputs().then(function () {
var self = this;
......@@ -117,6 +47,7 @@ TABS.advanced_tuning.initialize = function (callback) {
setTimeout(function () {
$(self).html(oldText);
}, 2000);
reboot();
});
});
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