1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

LP-230 Remove magic number using enumCount

This commit is contained in:
Laurent Lalanne 2016-02-19 20:13:05 +01:00
parent 220eb033d9
commit 076961a603
2 changed files with 7 additions and 5 deletions

View File

@ -4,6 +4,7 @@ import UAVTalk.SystemSettings 1.0
import UAVTalk.SystemAlarms 1.0
import UAVTalk.FlightStatus 1.0
import UAVTalk.VtolPathFollowerSettings 1.0 as VtolPathFollowerSettings
import UAVTalk.StabilizationDesired 1.0
import "../common.js" as Utils
import "../uav.js" as UAV

View File

@ -70,7 +70,6 @@ function defaultPosition() {
return Qt.vector3d(qmlWidget.longitude, qmlWidget.latitude, qmlWidget.altitude);
}
/*
* System
*
@ -176,7 +175,6 @@ function oplmLinkState() {
return ["Disabled", "Enabled", "Disconnected", "Connecting", "Connected"][opLinkStatus.linkState];
}
/*
* Battery
*
@ -304,12 +302,15 @@ function flightModeColor() {
function thrustMode() {
return !isFlightModeAssisted() ? stabilizationDesired.stabilizationModeThrust :
(isFlightModeAssisted() && isVtolOrMultirotor() && isVtolPathFollowerSettingsThrustAuto()) ? 12 :
(isFlightModeAssisted() && isFixedWing()) ? 12 : 0;
(isFlightModeAssisted() && isVtolOrMultirotor() && isVtolPathFollowerSettingsThrustAuto()) ?
StabilizationDesiredConstants.StabilizationModeCount : (isFlightModeAssisted() && isFixedWing()) ?
StabilizationDesiredConstants.StabilizationModeCount : 0;
}
function thrustModeName() {
return ["MANUAL", " ", " ", " ", " ", " ", " ", " ", " ",
// Last "Auto" Thrust mode is added to UAVO enum list
// Lower case modes are never displayed/used for Thrust
return ["MANUAL", "rate", "ratetrainer", "attitude", "axislock", "weakleveling", "virtualbar", "acro+ ", "rattitude",
"ALT HOLD", "ALT VARIO", "CRUISECTRL", "AUTO"][thrustMode()]
}