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

LP-183 convert Qml files to use new UAV object syntax

This commit is contained in:
Philippe Renon 2015-11-29 16:48:23 +01:00
parent d2d1b9a5f9
commit 96088ce831
10 changed files with 266 additions and 227 deletions

View File

@ -1,10 +1,14 @@
import QtQuick 2.0 import QtQuick 2.0
import UAVTalk.PositionState 1.0
import UAVTalk.NedAccel 1.0
import UAVTalk.PathDesired 1.0
Item { Item {
id: sceneItem id: sceneItem
property variant sceneSize property variant sceneSize
property real altitude : -qmlWidget.altitudeFactor * PositionState.Down property real altitude : -qmlWidget.altitudeFactor * positionState.down
SvgElementImage { SvgElementImage {
id: altitude_window id: altitude_window
@ -60,7 +64,7 @@ Item {
elementName: "altitude-vector" elementName: "altitude-vector"
sceneSize: sceneItem.sceneSize sceneSize: sceneItem.sceneSize
height: -NedAccel.Down * altitude_scale.height/10 height: -nedAccel.down * altitude_scale.height / 10
anchors.left: parent.left anchors.left: parent.left
anchors.bottom: parent.verticalCenter anchors.bottom: parent.verticalCenter
@ -70,12 +74,12 @@ Item {
id: altitude_waypoint id: altitude_waypoint
elementName: "altitude-waypoint" elementName: "altitude-waypoint"
sceneSize: sceneItem.sceneSize sceneSize: sceneItem.sceneSize
visible: PathDesired.End_Down !== 0.0 visible: (pathDesired.endDown != 0.0)
anchors.left: parent.left anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: -altitude_scale.height/10 * (PositionState.Down - PathDesired.End_Down) * qmlWidget.altitudeFactor anchors.verticalCenterOffset: -altitude_scale.height / 10 * (positionState.Down - pathDesired.endDown) * qmlWidget.altitudeFactor
} }
} }

View File

@ -1,5 +1,11 @@
import QtQuick 2.0 import QtQuick 2.0
import "." import "."
import UAVTalk.AttitudeState 1.0
import UAVTalk.PositionState 1.0
import UAVTalk.PathDesired 1.0
import UAVTalk.TakeOffLocation 1.0
import "common.js" as Utils import "common.js" as Utils
Item { Item {
@ -32,7 +38,7 @@ Item {
x: Math.floor(scaledBounds.x * sceneItem.width) x: Math.floor(scaledBounds.x * sceneItem.width)
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
rotation: -AttitudeState.Yaw rotation: -attitudeState.yaw
transformOrigin: Item.Center transformOrigin: Item.Center
smooth: true smooth: true
@ -47,11 +53,11 @@ Item {
x: Math.floor(scaledBounds.x * sceneItem.width) x: Math.floor(scaledBounds.x * sceneItem.width)
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
property real home_degrees: 180/3.1415 * Math.atan2(TakeOffLocation.East - PositionState.East, TakeOffLocation.North - PositionState.North) property real home_degrees: 180 / 3.1415 * Math.atan2(takeOffLocation.east - positionState.east, takeOffLocation.north - positionState.north)
rotation: -AttitudeState.Yaw + home_degrees rotation: -attitudeState.yaw + home_degrees
transformOrigin: Item.Bottom transformOrigin: Item.Bottom
visible: Utils.toInt(TakeOffLocation.Status) == 0 visible: (takeOffLocation.status == Status.Valid)
} }
@ -63,13 +69,14 @@ Item {
x: Math.floor(scaledBounds.x * sceneItem.width) x: Math.floor(scaledBounds.x * sceneItem.width)
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
property real course_degrees: 180/3.1415 * Math.atan2(PathDesired.End_East - PositionState.East, PathDesired.End_North - PositionState.North) property real course_degrees: 180 / 3.1415 * Math.atan2(pathDesired.endEast - positionState.east, pathDesired.endNorth - positionState.north)
rotation: -AttitudeState.Yaw + course_degrees rotation: -attitudeState.yaw + course_degrees
transformOrigin: Item.Center transformOrigin: Item.Center
smooth: true smooth: true
visible: PathDesired.End_East !== 0.0 && PathDesired.End_East !== 0.0 // FIXME : why test endEast twice?
visible: ((pathDesired.endEast != 0.0) && (pathDesired.endEast != 0.0))
} }
@ -86,7 +93,7 @@ Item {
Text { Text {
id: compass_text id: compass_text
text: Math.floor(AttitudeState.Yaw).toFixed() text: Math.floor(attitudeState.yaw).toFixed()
color: "white" color: "white"
font { font {
family: pt_bold.name family: pt_bold.name

View File

@ -1,4 +1,16 @@
import QtQuick 2.0 import QtQuick 2.0
import UAVTalk.HwSettings 1.0
import UAVTalk.SystemAlarms 1.0
import UAVTalk.VelocityState 1.0
import UAVTalk.TakeOffLocation 1.0
import UAVTalk.PathDesired 1.0
import UAVTalk.WaypointActive 1.0
import UAVTalk.GPSPositionSensor 1.0 as GPSPositionSensor
import UAVTalk.GPSSatellites 1.0
import UAVTalk.FlightBatterySettings 1.0
import UAVTalk.FlightBatteryState 1.0
import "common.js" as Utils import "common.js" as Utils
Item { Item {
@ -19,29 +31,29 @@ Item {
property bool init_dist: false property bool init_dist: false
property real home_heading: 180/3.1415 * Math.atan2(TakeOffLocation.East - PositionState.East, property real home_heading: 180 / 3.1415 * Math.atan2(takeOffLocation.east - positionState.east,
TakeOffLocation.North - PositionState.North) takeOffLocation.north - positionState.north)
property real home_distance: Math.sqrt(Math.pow((TakeOffLocation.East - PositionState.East),2) + property real home_distance: Math.sqrt(Math.pow((takeOffLocation.east - positionState.east), 2) +
Math.pow((TakeOffLocation.North - PositionState.North),2)) Math.pow((takeOffLocation.north - positionState.north), 2))
property real wp_heading: 180/3.1415 * Math.atan2(PathDesired.End_East - PositionState.East, property real wp_heading: 180 / 3.1415 * Math.atan2(pathDesired.endEast - positionState.east,
PathDesired.End_North - PositionState.North) pathDesired.endNorth - positionState.north)
property real wp_distance: Math.sqrt(Math.pow((PathDesired.End_East - PositionState.East),2) + property real wp_distance: Math.sqrt(Math.pow((pathDesired.endEast - positionState.east), 2) +
Math.pow(( PathDesired.End_North - PositionState.North),2)) Math.pow((pathDesired.endNorth - positionState.north), 2))
property real current_velocity: Math.sqrt(Math.pow(VelocityState.North,2)+Math.pow(VelocityState.East,2)) property real current_velocity: Math.sqrt(Math.pow(velocityState.north, 2) + Math.pow(velocityState.east, 2))
property real home_eta: (home_distance > 0 && current_velocity > 0 ? Math.round(home_distance/current_velocity) : 0) property real home_eta: (home_distance > 0 && current_velocity > 0 ? Math.round(home_distance / current_velocity) : 0)
property real home_eta_h: (home_eta > 0 ? Math.floor(home_eta / 3600) : 0 ) property real home_eta_h: (home_eta > 0 ? Math.floor(home_eta / 3600) : 0 )
property real home_eta_m: (home_eta > 0 ? Math.floor((home_eta - home_eta_h*3600)/60) : 0) property real home_eta_m: (home_eta > 0 ? Math.floor((home_eta - home_eta_h * 3600) / 60) : 0)
property real home_eta_s: (home_eta > 0 ? Math.floor(home_eta - home_eta_h*3600 - home_eta_m*60) : 0) property real home_eta_s: (home_eta > 0 ? Math.floor(home_eta - home_eta_h * 3600 - home_eta_m * 60) : 0)
property real wp_eta: (wp_distance > 0 && current_velocity > 0 ? Math.round(wp_distance/current_velocity) : 0) property real wp_eta: (wp_distance > 0 && current_velocity > 0 ? Math.round(wp_distance/current_velocity) : 0)
property real wp_eta_h: (wp_eta > 0 ? Math.floor(wp_eta / 3600) : 0 ) property real wp_eta_h: (wp_eta > 0 ? Math.floor(wp_eta / 3600) : 0 )
property real wp_eta_m: (wp_eta > 0 ? Math.floor((wp_eta - wp_eta_h*3600)/60) : 0) property real wp_eta_m: (wp_eta > 0 ? Math.floor((wp_eta - wp_eta_h * 3600) / 60) : 0)
property real wp_eta_s: (wp_eta > 0 ? Math.floor(wp_eta - wp_eta_h*3600 - wp_eta_m*60) : 0) property real wp_eta_s: (wp_eta > 0 ? Math.floor(wp_eta - wp_eta_h * 3600 - wp_eta_m * 60) : 0)
function reset_distance() { function reset_distance() {
total_distance = 0; total_distance = 0;
@ -49,8 +61,8 @@ Item {
function compute_distance(posEast,posNorth) { function compute_distance(posEast,posNorth) {
if (total_distance == 0 && !init_dist) { init_dist = "true"; posEast_old = posEast; posNorth_old = posNorth; } if (total_distance == 0 && !init_dist) { init_dist = "true"; posEast_old = posEast; posNorth_old = posNorth; }
if (posEast > posEast_old+3 || posEast < posEast_old-3 || posNorth > posNorth_old+3 || posNorth < posNorth_old-3) { if (posEast > posEast_old+3 || posEast < posEast_old - 3 || posNorth > posNorth_old + 3 || posNorth < posNorth_old - 3) {
total_distance += Math.sqrt(Math.pow((posEast - posEast_old ),2) + Math.pow((posNorth - posNorth_old),2)); total_distance += Math.sqrt(Math.pow((posEast - posEast_old ), 2) + Math.pow((posNorth - posNorth_old), 2));
total_distance_km = total_distance / 1000; total_distance_km = total_distance / 1000;
posEast_old = posEast; posEast_old = posEast;
@ -76,14 +88,14 @@ Item {
// //
property real bar_width: (info_bg.height + info_bg.width) / 110 property real bar_width: (info_bg.height + info_bg.width) / 110
property int satsInView: Utils.toInt(GPSSatellites.SatsInView) property int satsInView: gpsSatellites.satsInView
property variant gps_tooltip: "Altitude : "+GPSPositionSensor.Altitude.toFixed(2) +"m\n"+ property variant gps_tooltip: "Altitude : " + gpsPositionSensor.altitude.toFixed(2) + "m\n" +
"H/V/P DOP : "+GPSPositionSensor.HDOP.toFixed(2)+"/"+GPSPositionSensor.VDOP.toFixed(2)+"/"+GPSPositionSensor.PDOP.toFixed(2)+"m\n"+ "H/V/P DOP : " + gpsPositionSensor.hdop.toFixed(2) + "/" + gpsPositionSensor.vdop.toFixed(2) + "/" + gpsPositionSensor.pdop.toFixed(2) + "m\n" +
satsInView+" Sats in view" satsInView + " Sats in view"
Repeater { Repeater {
id: satNumberBar id: satNumberBar
property int satNumber : Utils.toInt(GPSPositionSensor.Satellites) property int satNumber : gpsPositionSensor.satellites
model: 13 model: 13
Rectangle { Rectangle {
@ -95,9 +107,9 @@ Item {
text: gps_tooltip text: gps_tooltip
} }
x: Math.round((bar_width*4.5) + (bar_width * 1.6 * index)) x: Math.round((bar_width * 4.5) + (bar_width * 1.6 * index))
height: bar_width * index * 0.6 height: bar_width * index * 0.6
y: (bar_width*8) - height y: (bar_width * 8) - height
color: "green" color: "green"
opacity: satNumberBar.satNumber >= minSatNumber ? 1 : 0.4 opacity: satNumberBar.satNumber >= minSatNumber ? 1 : 0.4
} }
@ -112,10 +124,10 @@ Item {
} }
Text { Text {
property int satNumber : Utils.toInt(GPSPositionSensor.Satellites) property int satNumber : gpsPositionSensor.satellites
text: [satNumber > 5 ? " " + satNumber.toString() + " sats - " : ""] + text: [satNumber > 5 ? " " + satNumber.toString() + " sats - " : ""] +
["NO GPS", "NO FIX", "2D", "3D"][Utils.toInt(GPSPositionSensor.Status)] ["NO GPS", "NO FIX", "2D", "3D"][gpsPositionSensor.status]
anchors.centerIn: parent anchors.centerIn: parent
font.pixelSize: parent.height*1.3 font.pixelSize: parent.height*1.3
font.family: pt_bold.name font.family: pt_bold.name
@ -144,7 +156,7 @@ Item {
width: scaledBounds.width * sceneItem.width width: scaledBounds.width * sceneItem.width
height: scaledBounds.height * sceneItem.height height: scaledBounds.height * sceneItem.height
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
visible: Utils.toInt(SystemAlarms.Alarm_PathPlan) == 1 visible: (systemAlarms.alarmPathPlan == Alarm.OK)
} }
SvgElementPositionItem { SvgElementPositionItem {
@ -153,7 +165,7 @@ Item {
width: scaledBounds.width * sceneItem.width width: scaledBounds.width * sceneItem.width
height: scaledBounds.height * sceneItem.height height: scaledBounds.height * sceneItem.height
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
visible: Utils.toInt(SystemAlarms.Alarm_PathPlan) == 1 visible: (systemAlarms.alarmPathPlan == Alarm.OK)
Text { Text {
text: " "+wp_heading.toFixed(1)+"°" text: " "+wp_heading.toFixed(1)+"°"
@ -174,7 +186,7 @@ Item {
width: scaledBounds.width * sceneItem.width width: scaledBounds.width * sceneItem.width
height: scaledBounds.height * sceneItem.height height: scaledBounds.height * sceneItem.height
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
visible: Utils.toInt(SystemAlarms.Alarm_PathPlan) == 1 visible: (systemAlarms.alarmPathPlan == Alarm.OK)
Text { Text {
text: " "+wp_distance.toFixed(0)+" m" text: " "+wp_distance.toFixed(0)+" m"
@ -195,7 +207,7 @@ Item {
width: scaledBounds.width * sceneItem.width width: scaledBounds.width * sceneItem.width
height: scaledBounds.height * sceneItem.height height: scaledBounds.height * sceneItem.height
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
visible: Utils.toInt(SystemAlarms.Alarm_PathPlan) == 1 visible: (systemAlarms.alarmPathPlan == Alarm.OK)
MouseArea { id: total_dist_mouseArea; anchors.fill: parent; cursorShape: Qt.PointingHandCursor; onClicked: reset_distance()} MouseArea { id: total_dist_mouseArea; anchors.fill: parent; cursorShape: Qt.PointingHandCursor; onClicked: reset_distance()}
@ -213,7 +225,7 @@ Item {
Timer { Timer {
interval: 1000; running: true; repeat: true; interval: 1000; running: true; repeat: true;
onTriggered: {if (Utils.toInt(GPSPositionSensor.Status) == 3) compute_distance(PositionState.East,PositionState.North)} onTriggered: { if (gpsPositionSensor.status == GPSPositionSensor.Status.Fix3D) compute_distance(positionState.east, positionState.north) }
} }
} }
@ -223,7 +235,7 @@ Item {
width: scaledBounds.width * sceneItem.width width: scaledBounds.width * sceneItem.width
height: scaledBounds.height * sceneItem.height height: scaledBounds.height * sceneItem.height
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
visible: Utils.toInt(SystemAlarms.Alarm_PathPlan) == 1 visible: (systemAlarms.alarmPathPlan == Alarm.OK)
Text { Text {
text: Utils.formatTime(wp_eta_h) + ":" + Utils.formatTime(wp_eta_m) + ":" + Utils.formatTime(wp_eta_s) text: Utils.formatTime(wp_eta_h) + ":" + Utils.formatTime(wp_eta_m) + ":" + Utils.formatTime(wp_eta_s)
@ -244,10 +256,10 @@ Item {
width: scaledBounds.width * sceneItem.width width: scaledBounds.width * sceneItem.width
height: scaledBounds.height * sceneItem.height height: scaledBounds.height * sceneItem.height
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
visible: Utils.toInt(SystemAlarms.Alarm_PathPlan) == 1 visible: (systemAlarms.alarmPathPlan == Alarm.OK)
Text { Text {
text: (WaypointActive.Index+1)+" / "+PathPlan.WaypointCount text: (waypointActive.index + 1) + " / " + pathPlan.waypointCount
anchors.centerIn: parent anchors.centerIn: parent
color: "cyan" color: "cyan"
@ -265,10 +277,10 @@ Item {
width: scaledBounds.width * sceneItem.width width: scaledBounds.width * sceneItem.width
height: scaledBounds.height * sceneItem.height height: scaledBounds.height * sceneItem.height
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
visible: Utils.toInt(SystemAlarms.Alarm_PathPlan) == 1 visible: (systemAlarms.alarmPathPlan == Alarm.OK)
Text { Text {
text: ["GOTO ENDPOINT","FOLLOW VECTOR","CIRCLE RIGHT","CIRCLE LEFT","FIXED ATTITUDE","SET ACCESSORY","DISARM ALARM","LAND","BRAKE","VELOCITY","AUTO TAKEOFF"][Utils.toInt(PathDesired.Mode)] text: ["GOTO ENDPOINT","FOLLOW VECTOR","CIRCLE RIGHT","CIRCLE LEFT","FIXED ATTITUDE","SET ACCESSORY","DISARM ALARM","LAND","BRAKE","VELOCITY","AUTO TAKEOFF"][pathDesired.mode]
anchors.centerIn: parent anchors.centerIn: parent
color: "cyan" color: "cyan"
@ -291,11 +303,11 @@ Item {
width: scaledBounds.width * sceneItem.width width: scaledBounds.width * sceneItem.width
height: scaledBounds.height * sceneItem.height height: scaledBounds.height * sceneItem.height
y: scaledBounds.y * sceneItem.height y: scaledBounds.y * sceneItem.height
visible: (Utils.toInt(SystemAlarms.Alarm_PathPlan) != 1) && (Utils.toInt(HwSettings.OptionalModules_Battery) == 1) visible: ((systemAlarms.alarmPathPlan != Alarm.OK) && (hwSettings.optionalModulesBattery == OptionalModules.Enabled))
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: Utils.toInt(FlightBatterySettings.NbCells) > 0 ? info.batColors[Utils.toInt(SystemAlarms.Alarm_Battery)] : "black" color: (flightBatterySettings.nbCells > 0) ? info.batColors[systemAlarms.alarmBattery] : "black"
} }
} }
@ -306,7 +318,7 @@ Item {
width: scaledBounds.width * sceneItem.width width: scaledBounds.width * sceneItem.width
height: scaledBounds.height * sceneItem.height height: scaledBounds.height * sceneItem.height
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
visible: (Utils.toInt(SystemAlarms.Alarm_PathPlan) != 1) && (Utils.toInt(HwSettings.OptionalModules_Battery) == 1) visible: ((systemAlarms.alarmPathPlan != Alarm.OK) && (hwSettings.optionalModulesBattery == OptionalModules.Enabled))
} }
SvgElementPositionItem { SvgElementPositionItem {
@ -317,14 +329,14 @@ Item {
width: scaledBounds.width * sceneItem.width width: scaledBounds.width * sceneItem.width
height: scaledBounds.height * sceneItem.height height: scaledBounds.height * sceneItem.height
y: scaledBounds.y * sceneItem.height y: scaledBounds.y * sceneItem.height
visible: (Utils.toInt(SystemAlarms.Alarm_PathPlan) != 1) && (Utils.toInt(HwSettings.OptionalModules_Battery) == 1) visible: ((systemAlarms.alarmPathPlan != Alarm.OK) && (hwSettings.optionalModulesBattery == OptionalModules.Enabled))
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: "transparent" color: "transparent"
Text { Text {
text: FlightBatteryState.Voltage.toFixed(2) text: flightBatteryState.voltage.toFixed(2)
anchors.centerIn: parent anchors.centerIn: parent
color: "white" color: "white"
font { font {
@ -344,14 +356,14 @@ Item {
width: scaledBounds.width * sceneItem.width width: scaledBounds.width * sceneItem.width
height: scaledBounds.height * sceneItem.height height: scaledBounds.height * sceneItem.height
y: scaledBounds.y * sceneItem.height y: scaledBounds.y * sceneItem.height
visible: (Utils.toInt(SystemAlarms.Alarm_PathPlan) != 1) && (Utils.toInt(HwSettings.OptionalModules_Battery) == 1) visible: ((systemAlarms.alarmPathPlan != Alarm.OK) && (hwSettings.optionalModulesBattery == OptionalModules.Enabled))
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: "transparent" color: "transparent"
Text { Text {
text: FlightBatteryState.Current.toFixed(2) text: flightBatteryState.current.toFixed(2)
anchors.centerIn: parent anchors.centerIn: parent
color: "white" color: "white"
font { font {
@ -371,7 +383,7 @@ Item {
width: scaledBounds.width * sceneItem.width width: scaledBounds.width * sceneItem.width
height: scaledBounds.height * sceneItem.height height: scaledBounds.height * sceneItem.height
y: scaledBounds.y * sceneItem.height y: scaledBounds.y * sceneItem.height
visible: (Utils.toInt(SystemAlarms.Alarm_PathPlan) != 1) && (Utils.toInt(HwSettings.OptionalModules_Battery) == 1) visible: ((systemAlarms.alarmPathPlan != Alarm.OK) && (hwSettings.optionalModulesBattery == OptionalModules.Enabled))
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
@ -380,23 +392,23 @@ Item {
text: "Reset consumed energy" text: "Reset consumed energy"
} }
MouseArea { MouseArea {
id: reset_consumed_energy_mouseArea; id: reset_consumed_energy_mouseArea;
anchors.fill: parent; anchors.fill: parent;
cursorShape: Qt.PointingHandCursor; cursorShape: Qt.PointingHandCursor;
onClicked: qmlWidget.resetConsumedEnergy(); onClicked: qmlWidget.resetConsumedEnergy();
} }
// Alarm based on FlightBatteryState.EstimatedFlightTime < 120s orange, < 60s red // Alarm based on flightBatteryState.estimatedFlightTime < 120s orange, < 60s red
color: (FlightBatteryState.EstimatedFlightTime <= 120 && FlightBatteryState.EstimatedFlightTime > 60 ? "orange" : color: ((flightBatteryState.estimatedFlightTime <= 120) && (flightBatteryState.estimatedFlightTime > 60)) ? "orange" :
(FlightBatteryState.EstimatedFlightTime <= 60 ? "red": info.batColors[Utils.toInt(SystemAlarms.Alarm_Battery)])) (flightBatteryState.estimatedFlightTime <= 60) ? "red" : info.batColors[systemAlarms.alarmBattery]
border.color: "white" border.color: "white"
border.width: topbattery_volt.width * 0.01 border.width: topbattery_volt.width * 0.01
radius: border.width * 4 radius: border.width * 4
Text { Text {
text: FlightBatteryState.ConsumedEnergy.toFixed(0) text: flightBatteryState.consumedEnergy.toFixed(0)
anchors.centerIn: parent anchors.centerIn: parent
color: "white" color: "white"
font { font {
@ -417,7 +429,7 @@ Item {
width: scaledBounds.width * sceneItem.width width: scaledBounds.width * sceneItem.width
height: scaledBounds.height * sceneItem.height height: scaledBounds.height * sceneItem.height
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
visible: Utils.toInt(SystemAlarms.Alarm_PathPlan) != 1 visible: (systemAlarms.alarmPathPlan != Alarm.OK)
} }
SvgElementPositionItem { SvgElementPositionItem {
@ -426,7 +438,7 @@ Item {
width: scaledBounds.width * sceneItem.width width: scaledBounds.width * sceneItem.width
height: scaledBounds.height * sceneItem.height height: scaledBounds.height * sceneItem.height
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
visible: Utils.toInt(SystemAlarms.Alarm_PathPlan) != 1 visible: (systemAlarms.alarmPathPlan != Alarm.OK)
TooltipArea { TooltipArea {
text: "Reset distance counter" text: "Reset distance counter"
@ -448,7 +460,7 @@ Item {
Timer { Timer {
interval: 1000; running: true; repeat: true; interval: 1000; running: true; repeat: true;
onTriggered: {if (Utils.toInt(GPSPositionSensor.Status) == 3) compute_distance(PositionState.East,PositionState.North)} onTriggered: { if (gpsPositionSensor.status == GPSPositionSensor.Status.Fix3D) compute_distance(positionState.east, positionState.north) }
} }
} }
@ -467,7 +479,7 @@ Item {
states: State { states: State {
name: "fading" name: "fading"
when: Utils.toInt(TakeOffLocation.Status) == 0 when: (takeOffLocation.status == Status.Valid)
PropertyChanges { target: home_bg; x: Math.floor(scaledBounds.x * sceneItem.width) - home_bg.width; } PropertyChanges { target: home_bg; x: Math.floor(scaledBounds.x * sceneItem.width) - home_bg.width; }
} }
@ -488,7 +500,7 @@ Item {
states: State { states: State {
name: "fading_heading" name: "fading_heading"
when: Utils.toInt(TakeOffLocation.Status) == 0 when: (takeOffLocation.status == Status.Valid)
PropertyChanges { target: home_heading_text; x: Math.floor(scaledBounds.x * sceneItem.width) - home_bg.width; } PropertyChanges { target: home_heading_text; x: Math.floor(scaledBounds.x * sceneItem.width) - home_bg.width; }
} }
@ -519,7 +531,7 @@ Item {
states: State { states: State {
name: "fading_distance" name: "fading_distance"
when: Utils.toInt(TakeOffLocation.Status) == 0 when: (takeOffLocation.status == Status.Valid)
PropertyChanges { target: home_distance_text; x: Math.floor(scaledBounds.x * sceneItem.width) - home_bg.width; } PropertyChanges { target: home_distance_text; x: Math.floor(scaledBounds.x * sceneItem.width) - home_bg.width; }
} }
@ -550,7 +562,7 @@ Item {
states: State { states: State {
name: "fading_distance" name: "fading_distance"
when: Utils.toInt(TakeOffLocation.Status) == 0 when: (takeOffLocation.status == Status.Valid)
PropertyChanges { target: home_eta_text; x: Math.floor(scaledBounds.x * sceneItem.width) - home_bg.width; } PropertyChanges { target: home_eta_text; x: Math.floor(scaledBounds.x * sceneItem.width) - home_bg.width; }
} }

View File

@ -1,14 +1,25 @@
import QtQuick 2.0 import QtQuick 2.0
import UAVTalk.SystemSettings 1.0
import UAVTalk.RevoSettings 1.0
import UAVTalk.SystemAlarms 1.0
import UAVTalk.FlightBatteryState 1.0
import UAVTalk.GPSPositionSensor 1.0
import UAVTalk.ManualControlCommand 1.0
import UAVTalk.MagState 1.0
import UAVTalk.ReceiverStatus 1.0
import UAVTalk.OPLinkStatus 1.0
import "common.js" as Utils import "common.js" as Utils
Item { Item {
id: panels id: panels
property variant sceneSize property variant sceneSize
property real est_flight_time: Math.round(FlightBatteryState.EstimatedFlightTime) property real est_flight_time: Math.round(flightBatteryState.estimatedFlightTime)
property real est_time_h: (est_flight_time > 0 ? Math.floor(est_flight_time / 3600) : 0 ) property real est_time_h: (est_flight_time > 0) ? Math.floor(est_flight_time / 3600) : 0
property real est_time_m: (est_flight_time > 0 ? Math.floor((est_flight_time - est_time_h*3600)/60) : 0) property real est_time_m: (est_flight_time > 0) ? Math.floor((est_flight_time - est_time_h * 3600) / 60) : 0
property real est_time_s: (est_flight_time > 0 ? Math.floor(est_flight_time - est_time_h*3600 - est_time_m*60) : 0) property real est_time_s: (est_flight_time > 0) ? Math.floor(est_flight_time - est_time_h * 3600 - est_time_m * 60) : 0
// //
// Panel functions // Panel functions
@ -72,16 +83,16 @@ Item {
property real smeter_angle property real smeter_angle
property real memory_free : SystemStats.HeapRemaining > 1024 ? SystemStats.HeapRemaining / 1024 : SystemStats.HeapRemaining property real memory_free : (systemStats.heapRemaining > 1024) ? systemStats.heapRemaining / 1024 : systemStats.heapRemaining
// Needed to get correctly int8 value // Needed to get correctly int8 value
property int cpuTemp : SystemStats.CPUTemp property int cpuTemp : systemStats.cpuTemp
// Needed to get correctly int8 value, reset value (-127) on disconnect // Needed to get correctly int8 value, reset value (-127) on disconnect
property int oplm0_db: telemetry_link == 1 ? OPLinkStatus.PairSignalStrengths_0 : -127 property int oplm0_db: (telemetry_link == 1) ? opLinkStatus.pairSignalStrengths0 : -127
property int oplm1_db: telemetry_link == 1 ? OPLinkStatus.PairSignalStrengths_1 : -127 property int oplm1_db: (telemetry_link == 1) ? opLinkStatus.pairSignalStrengths1 : -127
property int oplm2_db: telemetry_link == 1 ? OPLinkStatus.PairSignalStrengths_2 : -127 property int oplm2_db: (telemetry_link == 1) ? opLinkStatus.pairSignalStrengths2 : -127
property int oplm3_db: telemetry_link == 1 ? OPLinkStatus.PairSignalStrengths_3 : -127 property int oplm3_db: (telemetry_link == 1) ? opLinkStatus.pairSignalStrengths3 : -127
property real telemetry_sum property real telemetry_sum
property real telemetry_sum_old property real telemetry_sum_old
@ -90,9 +101,10 @@ Item {
// Hack : check if telemetry is active. Works with real link and log replay // Hack : check if telemetry is active. Works with real link and log replay
function telemetry_check() { function telemetry_check() {
telemetry_sum = OPLinkStatus.RXRate + OPLinkStatus.RXRate // FIXME : why rxRate + rxRate?
telemetry_sum = opLinkStatus.rxRate + opLinkStatus.rxRate
if (telemetry_sum != telemetry_sum_old || Utils.toInt(OPLinkStatus.LinkState) == 4) { if (telemetry_sum != telemetry_sum_old || (opLinkStatus.linkState == LinkState.Connected)) {
telemetry_link = 1 telemetry_link = 1
} else { } else {
telemetry_link = 0 telemetry_link = 0
@ -133,7 +145,7 @@ Item {
} }
property int smeter_filter property int smeter_filter
property variant oplm_pair_id : OPLinkStatus.PairIDs_0 property variant oplm_pair_id : opLinkStatus.pairIDs0
function select_oplm(index){ function select_oplm(index){
smeter_filter0.running = false; smeter_filter0.running = false;
@ -145,22 +157,22 @@ Item {
case 0: case 0:
smeter_filter0.running = true; smeter_filter0.running = true;
smeter_filter = 0; smeter_filter = 0;
oplm_pair_id = OPLinkStatus.PairIDs_0 oplm_pair_id = opLinkStatus.pairIDs0
break; break;
case 1: case 1:
smeter_filter1.running = true; smeter_filter1.running = true;
smeter_filter = 1; smeter_filter = 1;
oplm_pair_id = OPLinkStatus.PairIDs_1 oplm_pair_id = opLinkStatus.pairIDs1
break; break;
case 2: case 2:
smeter_filter2.running = true; smeter_filter2.running = true;
smeter_filter = 2; smeter_filter = 2;
oplm_pair_id = OPLinkStatus.PairIDs_2 oplm_pair_id = opLinkStatus.pairIDs2
break; break;
case 3: case 3:
smeter_filter3.running = true; smeter_filter3.running = true;
smeter_filter = 3; smeter_filter = 3;
oplm_pair_id = OPLinkStatus.PairIDs_3 oplm_pair_id = opLinkStatus.pairIDs3
break; break;
} }
} }
@ -210,7 +222,7 @@ Item {
elementName: "panel-open-icon" elementName: "panel-open-icon"
sceneSize: panels.sceneSize sceneSize: panels.sceneSize
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
z: close_bg.z+1 z: close_bg.z + 1
opacity: show_panels == true ? 0 : 1 opacity: show_panels == true ? 0 : 1
states: State { states: State {
@ -233,7 +245,7 @@ Item {
elementName: "close-panel-mousearea" elementName: "close-panel-mousearea"
sceneSize: panels.sceneSize sceneSize: panels.sceneSize
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
z: close_bg.z+100 z: close_bg.z + 100
TooltipArea { TooltipArea {
text: show_panels == true ? "Close panels" : "Open panels" text: show_panels == true ? "Close panels" : "Open panels"
@ -242,7 +254,7 @@ Item {
MouseArea { MouseArea {
id: hidedisp_close; id: hidedisp_close;
anchors.fill: parent; anchors.fill: parent;
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: close_panels() onClicked: close_panels()
} }
@ -289,7 +301,7 @@ Item {
elementName: "rc-input-labels" elementName: "rc-input-labels"
sceneSize: panels.sceneSize sceneSize: panels.sceneSize
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
z: rc_input_bg.z+1 z: rc_input_bg.z + 1
states: State { states: State {
name: "fading" name: "fading"
@ -298,9 +310,9 @@ Item {
} }
transitions: Transition { transitions: Transition {
SequentialAnimation { SequentialAnimation {
PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value } PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
} }
} }
} }
@ -309,7 +321,7 @@ Item {
elementName: "rc-input-panel-mousearea" elementName: "rc-input-panel-mousearea"
sceneSize: panels.sceneSize sceneSize: panels.sceneSize
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
z: rc_input_bg.z+1 z: rc_input_bg.z + 1
TooltipArea { TooltipArea {
text: "RC panel" text: "RC panel"
@ -329,9 +341,9 @@ Item {
} }
transitions: Transition { transitions: Transition {
SequentialAnimation { SequentialAnimation {
PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value } PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
} }
} }
} }
@ -342,7 +354,7 @@ Item {
z: rc_input_bg.z+2 z: rc_input_bg.z+2
width: scaledBounds.width * sceneItem.width width: scaledBounds.width * sceneItem.width
height: (scaledBounds.height * sceneItem.height) * (ManualControlCommand.Throttle) height: (scaledBounds.height * sceneItem.height) * (manualControlCommand.throttle)
x: scaledBounds.x * sceneItem.width x: scaledBounds.x * sceneItem.width
y: (scaledBounds.y * sceneItem.height) - rc_throttle.height + (scaledBounds.height * sceneItem.height) y: (scaledBounds.y * sceneItem.height) - rc_throttle.height + (scaledBounds.height * sceneItem.height)
@ -356,9 +368,9 @@ Item {
} }
transitions: Transition { transitions: Transition {
SequentialAnimation { SequentialAnimation {
PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value } PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
} }
} }
} }
@ -371,13 +383,13 @@ Item {
width: scaledBounds.width * sceneItem.width width: scaledBounds.width * sceneItem.width
height: scaledBounds.height * sceneItem.height height: scaledBounds.height * sceneItem.height
y: (scaledBounds.y * sceneItem.height) + (ManualControlCommand.Pitch * rc_stick.width * 2.5) y: (scaledBounds.y * sceneItem.height) + (manualControlCommand.pitch * rc_stick.width * 2.5)
smooth: true smooth: true
//rotate it around his center //rotate it around his center
transform: Rotation { transform: Rotation {
angle: ManualControlCommand.Yaw * 90 angle: manualControlCommand.yaw * 90
origin.y : rc_stick.height / 2 origin.y : rc_stick.height / 2
origin.x : rc_stick.width / 2 origin.x : rc_stick.width / 2
} }
@ -385,13 +397,13 @@ Item {
states: State { states: State {
name: "fading" name: "fading"
when: show_panels == true when: show_panels == true
PropertyChanges { target: rc_stick; x: Math.floor(scaledBounds.x * sceneItem.width) + (ManualControlCommand.Roll * rc_stick.width * 2.5) + offset_value; } PropertyChanges { target: rc_stick; x: Math.floor(scaledBounds.x * sceneItem.width) + (manualControlCommand.roll * rc_stick.width * 2.5) + offset_value; }
} }
transitions: Transition { transitions: Transition {
SequentialAnimation { SequentialAnimation {
PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value } PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
} }
} }
} }
@ -413,9 +425,9 @@ Item {
} }
transitions: Transition { transitions: Transition {
SequentialAnimation { SequentialAnimation {
PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value } PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
} }
} }
} }
@ -423,7 +435,7 @@ Item {
id: battery_volt id: battery_volt
sceneSize: panels.sceneSize sceneSize: panels.sceneSize
elementName: "battery-volt-text" elementName: "battery-volt-text"
z: battery_bg.z+1 z: battery_bg.z + 1
width: scaledBounds.width * sceneItem.width width: scaledBounds.width * sceneItem.width
height: scaledBounds.height * sceneItem.height height: scaledBounds.height * sceneItem.height
@ -443,13 +455,13 @@ Item {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: panels.batColors[Utils.toInt(SystemAlarms.Alarm_Battery)] color: panels.batColors[systemAlarms.alarmBattery]
border.color: "white" border.color: "white"
border.width: battery_volt.width * 0.01 border.width: battery_volt.width * 0.01
radius: border.width * 4 radius: border.width * 4
Text { Text {
text: FlightBatteryState.Voltage.toFixed(2) text: flightBatteryState.voltage.toFixed(2)
anchors.centerIn: parent anchors.centerIn: parent
color: "white" color: "white"
font { font {
@ -484,13 +496,13 @@ Item {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: panels.batColors[Utils.toInt(SystemAlarms.Alarm_Battery)] color: panels.batColors[systemAlarms.alarmBattery]
border.color: "white" border.color: "white"
border.width: battery_volt.width * 0.01 border.width: battery_volt.width * 0.01
radius: border.width * 4 radius: border.width * 4
Text { Text {
text: FlightBatteryState.Current.toFixed(2) text: flightBatteryState.current.toFixed(2)
anchors.centerIn: parent anchors.centerIn: parent
color: "white" color: "white"
font { font {
@ -531,24 +543,24 @@ Item {
visible: display_bat == true ? 1 : 0 visible: display_bat == true ? 1 : 0
} }
MouseArea { MouseArea {
id: reset_panel_consumed_energy_mouseArea; id: reset_panel_consumed_energy_mouseArea;
anchors.fill: parent; anchors.fill: parent;
cursorShape: Qt.PointingHandCursor; cursorShape: Qt.PointingHandCursor;
visible: display_bat == true ? 1 : 0 visible: display_bat == true ? 1 : 0
onClicked: qmlWidget.resetConsumedEnergy(); onClicked: qmlWidget.resetConsumedEnergy();
} }
// Alarm based on FlightBatteryState.EstimatedFlightTime < 120s orange, < 60s red // Alarm based on flightBatteryState.estimatedFlightTime < 120s orange, < 60s red
color: (FlightBatteryState.EstimatedFlightTime <= 120 && FlightBatteryState.EstimatedFlightTime > 60 ? "orange" : color: (flightBatteryState.estimatedFlightTime <= 120 && flightBatteryState.estimatedFlightTime > 60 ? "orange" :
(FlightBatteryState.EstimatedFlightTime <= 60 ? "red": panels.batColors[Utils.toInt(SystemAlarms.Alarm_Battery)])) (flightBatteryState.estimatedFlightTime <= 60 ? "red": panels.batColors[systemAlarms.alarmBattery]))
border.color: "white" border.color: "white"
border.width: battery_volt.width * 0.01 border.width: battery_volt.width * 0.01
radius: border.width * 4 radius: border.width * 4
Text { Text {
text: FlightBatteryState.ConsumedEnergy.toFixed(0) text: flightBatteryState.consumedEnergy.toFixed(0)
anchors.centerIn: parent anchors.centerIn: parent
color: "white" color: "white"
font { font {
@ -583,24 +595,24 @@ Item {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
//color: panels.batColors[Utils.toInt(SystemAlarms.Alarm_Battery)] //color: panels.batColors[systemAlarms.alarmBattery]
TooltipArea { TooltipArea {
text: "Reset consumed energy" text: "Reset consumed energy"
visible: display_bat == true ? 1 : 0 visible: display_bat == true ? 1 : 0
} }
MouseArea { MouseArea {
id: reset_panel_consumed_energy_mouseArea2; id: reset_panel_consumed_energy_mouseArea2;
anchors.fill: parent; anchors.fill: parent;
cursorShape: Qt.PointingHandCursor; cursorShape: Qt.PointingHandCursor;
visible: display_bat == true ? 1 : 0 visible: display_bat == true ? 1 : 0
onClicked: qmlWidget.resetConsumedEnergy(); onClicked: qmlWidget.resetConsumedEnergy();
} }
// Alarm based on FlightBatteryState.EstimatedFlightTime < 120s orange, < 60s red // Alarm based on flightBatteryState.estimatedFlightTime < 120s orange, < 60s red
color: (FlightBatteryState.EstimatedFlightTime <= 120 && FlightBatteryState.EstimatedFlightTime > 60 ? "orange" : color: (flightBatteryState.estimatedFlightTime <= 120) && (flightBatteryState.estimatedFlightTime > 60) ? "orange" :
(FlightBatteryState.EstimatedFlightTime <= 60 ? "red": panels.batColors[Utils.toInt(SystemAlarms.Alarm_Battery)])) (flightBatteryState.estimatedFlightTime <= 60) ? "red" : panels.batColors[systemAlarms.alarmBattery]
border.color: "white" border.color: "white"
border.width: battery_volt.width * 0.01 border.width: battery_volt.width * 0.01
@ -698,7 +710,7 @@ Item {
elementName: "smeter-bg" elementName: "smeter-bg"
sceneSize: panels.sceneSize sceneSize: panels.sceneSize
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
z: oplm_bg.z+1 z: oplm_bg.z + 1
states: State { states: State {
name: "fading" name: "fading"
@ -718,7 +730,7 @@ Item {
elementName: "smeter-scale" elementName: "smeter-scale"
sceneSize: panels.sceneSize sceneSize: panels.sceneSize
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
z: oplm_bg.z+2 z: oplm_bg.z + 2
states: State { states: State {
name: "fading" name: "fading"
@ -738,7 +750,7 @@ Item {
elementName: "smeter-needle" elementName: "smeter-needle"
sceneSize: panels.sceneSize sceneSize: panels.sceneSize
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
z: oplm_bg.z+3 z: oplm_bg.z + 3
states: State { states: State {
name: "fading" name: "fading"
@ -766,7 +778,7 @@ Item {
width: smeter_scale.width * 1.09 width: smeter_scale.width * 1.09
//anchors.horizontalCenter: smeter_scale //anchors.horizontalCenter: smeter_scale
z: oplm_bg.z+4 z: oplm_bg.z + 4
states: State { states: State {
name: "fading" name: "fading"
@ -788,7 +800,7 @@ Item {
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
width: smeter_mask.width width: smeter_mask.width
z: oplm_bg.z+5 z: oplm_bg.z + 5
states: State { states: State {
name: "fading" name: "fading"
@ -807,7 +819,7 @@ Item {
model: 4 model: 4
SvgElementImage { SvgElementImage {
z: oplm_bg.z+5 z: oplm_bg.z + 5
property variant idButton_oplm: "oplm_button_" + index property variant idButton_oplm: "oplm_button_" + index
property variant idButton_oplm_mousearea: "oplm_button_mousearea" + index property variant idButton_oplm_mousearea: "oplm_button_mousearea" + index
property variant button_color: "button"+index+"_color" property variant button_color: "button"+index+"_color"
@ -853,7 +865,7 @@ Item {
elementName: "oplm-id-label" elementName: "oplm-id-label"
sceneSize: panels.sceneSize sceneSize: panels.sceneSize
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
z: oplm_bg.z+6 z: oplm_bg.z + 6
states: State { states: State {
name: "fading" name: "fading"
@ -872,7 +884,7 @@ Item {
id: oplm_id_text id: oplm_id_text
sceneSize: panels.sceneSize sceneSize: panels.sceneSize
elementName: "oplm-id-text" elementName: "oplm-id-text"
z: oplm_bg.z+7 z: oplm_bg.z + 7
width: scaledBounds.width * sceneItem.width width: scaledBounds.width * sceneItem.width
height: scaledBounds.height * sceneItem.height height: scaledBounds.height * sceneItem.height
@ -908,7 +920,7 @@ Item {
elementName: "rx-quality-label" elementName: "rx-quality-label"
sceneSize: panels.sceneSize sceneSize: panels.sceneSize
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
z: oplm_bg.z+8 z: oplm_bg.z + 8
states: State { states: State {
name: "fading" name: "fading"
@ -927,7 +939,7 @@ Item {
id: rx_quality_text id: rx_quality_text
sceneSize: panels.sceneSize sceneSize: panels.sceneSize
elementName: "rx-quality-text" elementName: "rx-quality-text"
z: oplm_bg.z+9 z: oplm_bg.z + 9
width: scaledBounds.width * sceneItem.width width: scaledBounds.width * sceneItem.width
height: scaledBounds.height * sceneItem.height height: scaledBounds.height * sceneItem.height
@ -946,7 +958,7 @@ Item {
} }
Text { Text {
text: Utils.toInt(ReceiverStatus.Quality) > 0 ? Utils.toInt(ReceiverStatus.Quality)+"%" : "?? %" text: (receiverStatus.quality > 0) ? receiverStatus.quality + "%" : "?? %"
anchors.centerIn: parent anchors.centerIn: parent
color: "white" color: "white"
font { font {
@ -1018,7 +1030,7 @@ Item {
elementName: "system-frame-type" elementName: "system-frame-type"
sceneSize: panels.sceneSize sceneSize: panels.sceneSize
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
z: system_bg.z+1 z: system_bg.z + 1
states: State { states: State {
name: "fading" name: "fading"
@ -1035,7 +1047,7 @@ Item {
Text { Text {
text: ["FixedWing", "FixedWingElevon", "FixedWingVtail", "VTOL", "HeliCP", "QuadX", "QuadP", text: ["FixedWing", "FixedWingElevon", "FixedWingVtail", "VTOL", "HeliCP", "QuadX", "QuadP",
"Hexa+", "Octo+", "Custom", "HexaX", "HexaH", "OctoV", "OctoCoaxP", "OctoCoaxX", "OctoX", "HexaCoax", "Hexa+", "Octo+", "Custom", "HexaX", "HexaH", "OctoV", "OctoCoaxP", "OctoCoaxX", "OctoX", "HexaCoax",
"Tricopter", "GroundVehicleCar", "GroundVehicleDiff", "GroundVehicleMoto"][Utils.toInt(SystemSettings.AirframeType)] "Tricopter", "GroundVehicleCar", "GroundVehicleDiff", "GroundVehicleMoto"][systemSettings.airframeType]
anchors.right: parent.right anchors.right: parent.right
color: "white" color: "white"
font { font {
@ -1051,7 +1063,7 @@ Item {
elementName: "system-cpu-load-temp" elementName: "system-cpu-load-temp"
sceneSize: panels.sceneSize sceneSize: panels.sceneSize
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
z: system_bg.z+1 z: system_bg.z + 1
states: State { states: State {
name: "fading" name: "fading"
@ -1067,8 +1079,7 @@ Item {
Text { Text {
// Coptercontrol detect with mem free : Only display Cpu load, no temperature available. // Coptercontrol detect with mem free : Only display Cpu load, no temperature available.
text: Utils.toInt(SystemStats.CPULoad)+"%"+ text: systemStats.cpuLoad + "%" + [(systemStats.heapRemaining < 3000) ? "" : " | " + cpuTemp + "°C"]
[SystemStats.HeapRemaining < 3000 ? "" : " | "+cpuTemp+"°C"]
anchors.right: parent.right anchors.right: parent.right
color: "white" color: "white"
font { font {
@ -1084,7 +1095,7 @@ Item {
elementName: "system-mem-free" elementName: "system-mem-free"
sceneSize: panels.sceneSize sceneSize: panels.sceneSize
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
z: system_bg.z+1 z: system_bg.z + 1
states: State { states: State {
name: "fading" name: "fading"
@ -1099,7 +1110,7 @@ Item {
} }
Text { Text {
text: SystemStats.HeapRemaining > 1024 ? memory_free.toFixed(2) +"Kb" : memory_free +"bytes" text: (systemStats.heapRemaining > 1024) ? memory_free.toFixed(2) +"Kb" : memory_free +"bytes"
anchors.right: parent.right anchors.right: parent.right
color: "white" color: "white"
font { font {
@ -1115,7 +1126,7 @@ Item {
elementName: "system-attitude-estimation-algo" elementName: "system-attitude-estimation-algo"
sceneSize: panels.sceneSize sceneSize: panels.sceneSize
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
z: system_bg.z+1 z: system_bg.z + 1
states: State { states: State {
name: "fading" name: "fading"
@ -1130,7 +1141,7 @@ Item {
} }
Text { Text {
text: ["None", "Basic (No Nav)", "CompMag", "Comp+Mag+GPS", "EKFIndoor", "GPS Nav (INS13)"][Utils.toInt(RevoSettings.FusionAlgorithm)] text: ["None", "Basic (No Nav)", "CompMag", "Comp+Mag+GPS", "EKFIndoor", "GPS Nav (INS13)"][revoSettings.fusionAlgorithm]
anchors.right: parent.right anchors.right: parent.right
color: "white" color: "white"
font { font {
@ -1146,7 +1157,7 @@ Item {
elementName: "system-mag-used" elementName: "system-mag-used"
sceneSize: panels.sceneSize sceneSize: panels.sceneSize
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
z: system_bg.z+1 z: system_bg.z + 1
states: State { states: State {
name: "fading" name: "fading"
@ -1161,7 +1172,7 @@ Item {
} }
Text { Text {
text: ["Invalid", "OnBoard", "External"][Utils.toInt(MagState.Source)] text: ["Invalid", "OnBoard", "External"][magState.source]
anchors.right: parent.right anchors.right: parent.right
color: "white" color: "white"
font { font {
@ -1177,7 +1188,7 @@ Item {
elementName: "system-gps-type" elementName: "system-gps-type"
sceneSize: panels.sceneSize sceneSize: panels.sceneSize
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
z: system_bg.z+1 z: system_bg.z + 1
states: State { states: State {
name: "fading" name: "fading"
@ -1192,7 +1203,7 @@ Item {
} }
Text { Text {
text: ["Unknown", "NMEA", "UBX", "UBX7", "UBX8"][Utils.toInt(GPSPositionSensor.SensorType)] text: ["Unknown", "NMEA", "UBX", "UBX7", "UBX8"][gpsPositionSensor.sensorType]
anchors.right: parent.right anchors.right: parent.right
color: "white" color: "white"
font { font {
@ -1208,7 +1219,7 @@ Item {
elementName: "system-panel-mousearea" elementName: "system-panel-mousearea"
sceneSize: panels.sceneSize sceneSize: panels.sceneSize
y: Math.floor(scaledBounds.y * sceneItem.height) y: Math.floor(scaledBounds.y * sceneItem.height)
z: system_bg.z+1 z: system_bg.z + 1
TooltipArea { TooltipArea {
text: "System panel" text: "System panel"

View File

@ -1,5 +1,7 @@
import QtQuick 2.0 import QtQuick 2.0
import UAVTalk.AttitudeState 1.0
Item { Item {
id: worldView id: worldView
property real horizontCenter : horizontCenterItem.horizontCenter property real horizontCenter : horizontCenterItem.horizontCenter
@ -32,10 +34,10 @@ Item {
x: Math.round((world.parent.width - world.width)/2) x: Math.round((world.parent.width - world.width)/2)
// y is centered around world_center element // y is centered around world_center element
y: Math.round(horizontCenter - world.height/2 + y: Math.round(horizontCenter - world.height/2 +
AttitudeState.Pitch*world.pitch1DegHeight) attitudeState.pitch * world.pitch1DegHeight)
}, },
Rotation { Rotation {
angle: -AttitudeState.Roll angle: -attitudeState.roll
origin.x : world.parent.width/2 origin.x : world.parent.width/2
origin.y : horizontCenter origin.y : horizontCenter
} }
@ -58,7 +60,7 @@ Item {
sceneSize: background.sceneSize sceneSize: background.sceneSize
anchors.centerIn: parent anchors.centerIn: parent
border: 1 border: 1
smooth: true smooth: true
} }
} }
@ -72,7 +74,7 @@ Item {
width: Math.floor(scaledBounds.width * sceneItem.width) width: Math.floor(scaledBounds.width * sceneItem.width)
height: Math.floor(scaledBounds.height * sceneItem.height) height: Math.floor(scaledBounds.height * sceneItem.height)
rotation: -AttitudeState.Roll rotation: -attitudeState.roll
transformOrigin: Item.Center transformOrigin: Item.Center
smooth: true smooth: true
@ -85,7 +87,7 @@ Item {
sceneSize: background.sceneSize sceneSize: background.sceneSize
anchors.centerIn: parent anchors.centerIn: parent
//see comment for world transform //see comment for world transform
anchors.verticalCenterOffset: AttitudeState.Pitch*world.pitch1DegHeight anchors.verticalCenterOffset: attitudeState.pitch * world.pitch1DegHeight
border: 64 //sometimes numbers are excluded from bounding rect border: 64 //sometimes numbers are excluded from bounding rect
smooth: true smooth: true

View File

@ -1,12 +1,15 @@
import QtQuick 2.0 import QtQuick 2.0
import "." import "."
import UAVTalk.AttitudeState 1.0
Item { Item {
id: sceneItem id: sceneItem
property variant sceneSize property variant sceneSize
property real horizontCenter property real horizontCenter
onHorizontCenterChanged: console.log("horizont center:"+horizontCenter) //onHorizontCenterChanged: console.log("horizont center:" + horizontCenter)
SvgElementImage { SvgElementImage {
id: rollscale id: rollscale
@ -21,11 +24,11 @@ Item {
smooth: true smooth: true
//rotate it around the center of horizon // rotate it around the center of horizon
transform: Rotation { transform: Rotation {
angle: -AttitudeState.Roll angle: -attitudeState.roll
origin.y : rollscale.height*2.4 origin.y : rollscale.height * 2.4
origin.x : rollscale.width/2 origin.x : rollscale.width / 2
} }
} }

View File

@ -1,10 +1,12 @@
import QtQuick 2.0 import QtQuick 2.0
import UAVTalk.VelocityState 1.0
import UAVTalk.PathDesired 1.0
Item { Item {
id: sceneItem id: sceneItem
property variant sceneSize property variant sceneSize
property real groundSpeed : qmlWidget.speedFactor * Math.sqrt(Math.pow(VelocityState.North,2)+ property real groundSpeed : qmlWidget.speedFactor * Math.sqrt(Math.pow(velocityState.north, 2) + Math.pow(velocityState.east, 2))
Math.pow(VelocityState.East,2))
SvgElementImage { SvgElementImage {
id: speed_window id: speed_window
@ -63,12 +65,12 @@ Item {
id: speed_waypoint id: speed_waypoint
elementName: "speed-waypoint" elementName: "speed-waypoint"
sceneSize: sceneItem.sceneSize sceneSize: sceneItem.sceneSize
visible: PathDesired.EndingVelocity !== 0.0 visible: (pathDesired.endingVelocity != 0.0)
anchors.right: parent.right anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: speed_scale.height/10 * (sceneItem.groundSpeed - (PathDesired.EndingVelocity * qmlWidget.speedFactor)) anchors.verticalCenterOffset: speed_scale.height / 10 * (sceneItem.groundSpeed - (pathDesired.endingVelocity * qmlWidget.speedFactor))
} }
} }

View File

@ -1,4 +1,8 @@
import QtQuick 2.0 import QtQuick 2.0
import UAVTalk.FlightStatus 1.0
import UAVTalk.VelocityDesired 1.0
import "common.js" as Utils import "common.js" as Utils
Item { Item {
@ -8,7 +12,7 @@ Item {
Timer { Timer {
interval: 100; running: true; repeat: true interval: 100; running: true; repeat: true
onTriggered: vert_velocity = (0.9 * vert_velocity) + (0.1 * VelocityState.Down) onTriggered: vert_velocity = (0.9 * vert_velocity) + (0.1 * velocityState.down)
} }
SvgElementImage { SvgElementImage {
@ -23,12 +27,12 @@ Item {
y: scaledBounds.y * sceneItem.height y: scaledBounds.y * sceneItem.height
smooth: true smooth: true
visible: VelocityDesired.Down !== 0.0 && Utils.toInt(FlightStatus.FlightMode) > 7 visible: ((velocityDesired.down != 0.0) && (flightStatus.flightMode > FlightMode.PositionHold))
//rotate it around the center // rotate it around the center
transform: Rotation { transform: Rotation {
angle: -VelocityDesired.Down * 5 angle: -velocityDesired.down * 5
origin.y : vsi_waypoint.height / 2 origin.y : vsi_waypoint.height / 2
origin.x : vsi_waypoint.width * 33 origin.x : vsi_waypoint.width * 33
} }
} }
@ -36,7 +40,7 @@ Item {
SvgElementImage { SvgElementImage {
id: vsi_scale_meter id: vsi_scale_meter
visible: qmlWidget.altitudeUnit == "m" visible: (qmlWidget.altitudeUnit == "m")
elementName: "vsi-scale-meter" elementName: "vsi-scale-meter"
sceneSize: sceneItem.sceneSize sceneSize: sceneItem.sceneSize
@ -48,7 +52,7 @@ Item {
SvgElementImage { SvgElementImage {
id: vsi_scale_ft id: vsi_scale_ft
visible: qmlWidget.altitudeUnit == "ft" visible: (qmlWidget.altitudeUnit == "ft")
elementName: "vsi-scale-ft" elementName: "vsi-scale-ft"
sceneSize: sceneItem.sceneSize sceneSize: sceneItem.sceneSize
@ -70,10 +74,10 @@ Item {
smooth: true smooth: true
//rotate it around the center // rotate it around the center
transform: Rotation { transform: Rotation {
angle: -vert_velocity * 5 angle: -vert_velocity * 5
origin.y : vsi_arrow.height / 2 origin.y : vsi_arrow.height / 2
origin.x : vsi_arrow.width * 3.15 origin.x : vsi_arrow.width * 3.15
} }
} }
@ -84,7 +88,7 @@ Item {
sceneSize: sceneItem.sceneSize sceneSize: sceneItem.sceneSize
Text { Text {
text: qmlWidget.altitudeUnit == "m" ? "m/s" : "ft/s" text: (qmlWidget.altitudeUnit == "m") ? "m/s" : "ft/s"
color: "cyan" color: "cyan"
font { font {
family: pt_bold.name family: pt_bold.name

View File

@ -1,39 +1,42 @@
import QtQuick 2.0 import QtQuick 2.0
import UAVTalk.SystemSettings 1.0
import UAVTalk.SystemAlarms 1.0
import UAVTalk.FlightStatus 1.0
import UAVTalk.VtolPathFollowerSettings 1.0
import "common.js" as Utils import "common.js" as Utils
Item { Item {
id: warnings id: warnings
property variant sceneSize property variant sceneSize
// Uninitialised, OK, Warning, Error, Critical
// Uninitialised, OK, Warning, Error, Critical
property variant statusColors : ["gray", "green", "red", "red", "red"] property variant statusColors : ["gray", "green", "red", "red", "red"]
// DisArmed , Arming, Armed // DisArmed , Arming, Armed
property variant armColors : ["gray", "orange", "green"] property variant armColors : ["gray", "orange", "green"]
// All 'manual modes' are green, 'assisted' modes in cyan // All 'manual modes' are green, 'assisted' modes in cyan
// "MANUAL","STAB 1","STAB 2", "STAB 3", "STAB 4", "STAB 5", "STAB 6", // "MANUAL","STAB 1","STAB 2", "STAB 3", "STAB 4", "STAB 5", "STAB 6",
// "POS HOLD", "COURSELOCK","VEL ROAM", "HOME LEASH", "ABS POS", "RTB", "LAND", "PATHPLAN", "POI", "AUTOCRUISE", "AUTOTAKEOFF" // "POS HOLD", "COURSELOCK","VEL ROAM", "HOME LEASH", "ABS POS", "RTB", "LAND", "PATHPLAN", "POI", "AUTOCRUISE", "AUTOTAKEOFF"
property variant flightmodeColors : ["gray", "green", "green", "green", "green", "green", "green", property variant flightmodeColors : ["gray", "green", "green", "green", "green", "green", "green",
"cyan", "cyan", "cyan", "cyan", "cyan", "cyan", "cyan", "cyan", "cyan", "cyan", "cyan"] "cyan", "cyan", "cyan", "cyan", "cyan", "cyan", "cyan", "cyan", "cyan", "cyan", "cyan"]
// Manual,Rate,RateTrainer,Attitude,AxisLock,WeakLeveling,VirtualBar,Acro+,Rattitude, // Manual,Rate,RateTrainer,Attitude,AxisLock,WeakLeveling,VirtualBar,Acro+,Rattitude,
// AltitudeHold,AltitudeVario,CruiseControl" + Auto mode (VTOL/Wing pathfollower) // AltitudeHold,AltitudeVario,CruiseControl" + Auto mode (VTOL/Wing pathfollower)
// grey : 'disabled' modes // grey : 'disabled' modes
property variant thrustmodeColors : ["green", "grey", "grey", "grey", "grey", "grey", "grey", "grey", "grey",
property variant thrustmodeColors : ["green", "grey", "grey", "grey", "grey", "grey", "grey", "grey", "grey",
"green", "green", "green", "cyan"] "green", "green", "green", "cyan"]
// SystemSettings.AirframeType 3 - 17 : VtolPathFollower, check ThrustControl // systemSettings.airframeType 3 - 17 : VtolPathFollower, check ThrustControl
property var thrust_mode: (flightStatus.flightMode < FlightMode.PositionHold) ? stabilizationDesired.stabilizationModeThrust :
property var thrust_mode: Utils.toInt(FlightStatus.FlightMode) < 7 ? Utils.toInt(StabilizationDesired.StabilizationMode_Thrust) : (flightStatus.flightMode >= FlightMode.PositionHold) && (systemSettings.airframeType > AirframeType.FixedWingVtail) &&
Utils.toInt(FlightStatus.FlightMode) > 6 && Utils.toInt(SystemSettings.AirframeType) > 2 && (systemSettings.airframeType < AirframeType.GroundVehicleCar) && (vtolPathFollowerSettings.thrustControl == ThrustControl.Auto) ? 12 :
Utils.toInt(SystemSettings.AirframeType) < 18 && Utils.toInt(VtolPathFollowerSettings.ThrustControl) == 1 ? 12 : (flightStatus.flightMode >= FlightMode.PositionHold) && (systemSettings.airframeType < AirframeType.VTOL) ? 12 : 0
Utils.toInt(FlightStatus.FlightMode) > 6 && Utils.toInt(SystemSettings.AirframeType) < 3 ? 12: 0
property real flight_time: Math.round(systemStats.flightTime / 1000)
property real flight_time: Math.round(SystemStats.FlightTime / 1000)
property real time_h: (flight_time > 0 ? Math.floor(flight_time / 3600) : 0 ) property real time_h: (flight_time > 0 ? Math.floor(flight_time / 3600) : 0 )
property real time_m: (flight_time > 0 ? Math.floor((flight_time - time_h*3600)/60) : 0) property real time_m: (flight_time > 0 ? Math.floor((flight_time - time_h*3600)/60) : 0)
property real time_s: (flight_time > 0 ? Math.floor(flight_time - time_h*3600 - time_m*60) : 0) property real time_s: (flight_time > 0 ? Math.floor(flight_time - time_h*3600 - time_m*60) : 0)
@ -57,7 +60,7 @@ Item {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: (SystemStats.FlightTime > 0 ? "green" : "grey") color: (systemStats.flightTime > 0) ? "green" : "grey"
Text { Text {
anchors.centerIn: parent anchors.centerIn: parent
@ -82,11 +85,11 @@ Item {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: warnings.armColors[Utils.toInt(FlightStatus.Armed)] color: warnings.armColors[flightStatus.armed]
Text { Text {
anchors.centerIn: parent anchors.centerIn: parent
text: ["DISARMED","ARMING","ARMED"][Utils.toInt(FlightStatus.Armed)] text: ["DISARMED","ARMING","ARMED"][flightStatus.armed]
font { font {
family: pt_bold.name family: pt_bold.name
pixelSize: Math.floor(parent.height * 0.74) pixelSize: Math.floor(parent.height * 0.74)
@ -107,7 +110,7 @@ Item {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: warnings.statusColors[Utils.toInt(SystemAlarms.Alarm_ManualControl)] color: warnings.statusColors[systemAlarms.alarmManualControl]
Text { Text {
anchors.centerIn: parent anchors.centerIn: parent
@ -130,11 +133,11 @@ Item {
x: scaledBounds.x * sceneItem.width x: scaledBounds.x * sceneItem.width
y: scaledBounds.y * sceneItem.height y: scaledBounds.y * sceneItem.height
property bool warningActive: (Utils.toInt(SystemAlarms.Alarm_BootFault) > 1 || property bool warningActive: ((systemAlarms.alarmBootFault > Alarm.OK) ||
Utils.toInt(SystemAlarms.Alarm_OutOfMemory) > 1 || (systemAlarms.alarmOutOfMemory > Alarm.OK) ||
Utils.toInt(SystemAlarms.Alarm_StackOverflow) > 1 || (systemAlarms.alarmStackOverflow > Alarm.OK) ||
Utils.toInt(SystemAlarms.Alarm_CPUOverload) > 1 || (systemAlarms.alarmCPUOverload > Alarm.OK) ||
Utils.toInt(SystemAlarms.Alarm_EventSystem) > 1) (systemAlarms.alarmEventSystem > Alarm.OK))
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: parent.warningActive ? "red" : "red" color: parent.warningActive ? "red" : "red"
@ -164,7 +167,7 @@ Item {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: warnings.statusColors[Utils.toInt(SystemAlarms.Alarm_Guidance)] color: warnings.statusColors[systemAlarms.alarmGuidance]
Text { Text {
anchors.centerIn: parent anchors.centerIn: parent
@ -189,14 +192,14 @@ Item {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: warnings.flightmodeColors[Utils.toInt(FlightStatus.FlightMode)] color: warnings.flightmodeColors[flightStatus.flightMode]
// Manual,Stabilized1,Stabilized2,Stabilized3,Stabilized4,Stabilized5,Stabilized6,PositionHold,CourseLock, // Manual,Stabilized1,Stabilized2,Stabilized3,Stabilized4,Stabilized5,Stabilized6,PositionHold,CourseLock,
// VelocityRoam,HomeLeash,AbsolutePosition,ReturnToBase,Land,PathPlanner,POI,AutoCruise,AutoTakeoff // VelocityRoam,HomeLeash,AbsolutePosition,ReturnToBase,Land,PathPlanner,POI,AutoCruise,AutoTakeoff
Text { Text {
anchors.centerIn: parent anchors.centerIn: parent
text: ["MANUAL","STAB 1","STAB 2", "STAB 3", "STAB 4", "STAB 5", "STAB 6", "POS HOLD", "COURSELOCK", text: ["MANUAL","STAB 1","STAB 2", "STAB 3", "STAB 4", "STAB 5", "STAB 6", "POS HOLD", "COURSELOCK",
"VEL ROAM", "HOME LEASH", "ABS POS", "RTB", "LAND", "PATHPLAN", "POI", "AUTOCRUISE", "AUTOTAKEOFF"][Utils.toInt(FlightStatus.FlightMode)] "VEL ROAM", "HOME LEASH", "ABS POS", "RTB", "LAND", "PATHPLAN", "POI", "AUTOCRUISE", "AUTOTAKEOFF"][flightStatus.flightMode]
font { font {
family: pt_bold.name family: pt_bold.name
pixelSize: Math.floor(parent.height * 0.74) pixelSize: Math.floor(parent.height * 0.74)
@ -217,15 +220,14 @@ Item {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: Utils.toInt(FlightStatus.FlightMode) < 1 ? "grey" : warnings.thrustmodeColors[thrust_mode] color: (flightStatus.flightMode == FlightMode.Manual) ? "grey" : warnings.thrustmodeColors[thrust_mode]
// Manual,Rate,RateTrainer,Attitude,AxisLock,WeakLeveling,VirtualBar,Acro+,Rattitude, // Manual,Rate,RateTrainer,Attitude,AxisLock,WeakLeveling,VirtualBar,Acro+,Rattitude,
// AltitudeHold,AltitudeVario,CruiseControl // AltitudeHold,AltitudeVario,CruiseControl
// grey : 'disabled' modes // grey : 'disabled' modes
Text { Text {
anchors.centerIn: parent anchors.centerIn: parent
text: ["MANUAL"," "," ", " ", " ", " ", " ", " ", " ", text: ["MANUAL"," "," ", " ", " ", " ", " ", " ", " ", "ALT HOLD", "ALT VARIO", "CRUISECTRL", "AUTO"][thrust_mode]
"ALT HOLD", "ALT VARIO", "CRUISECTRL", "AUTO"][thrust_mode]
font { font {
family: pt_bold.name family: pt_bold.name
pixelSize: Math.floor(parent.height * 0.74) pixelSize: Math.floor(parent.height * 0.74)
@ -240,7 +242,7 @@ Item {
elementName: "warning-gps" elementName: "warning-gps"
sceneSize: warnings.sceneSize sceneSize: warnings.sceneSize
visible: Utils.toInt(SystemAlarms.Alarm_GPS) > 1 visible: (systemAlarms.alarmGPS > Alarm.OK)
} }
SvgElementImage { SvgElementImage {
@ -248,6 +250,6 @@ Item {
elementName: "warning-attitude" elementName: "warning-attitude"
sceneSize: warnings.sceneSize sceneSize: warnings.sceneSize
anchors.centerIn: background.centerIn anchors.centerIn: background.centerIn
visible: Utils.toInt(SystemAlarms.Alarm_Attitude) > 1 visible: (systemAlarms.alarmAttitude > Alarm.OK)
} }
} }

View File

@ -5,14 +5,6 @@
// //
// Librepilot // Librepilot
// *********************** // ***********************
//
// qml/js treats qint8 as a char, necessary to convert it back to integer value
function toInt(enum_value) {
if (Object.prototype.toString.call(enum_value) == "[object String]") {
return enum_value.charCodeAt(0);
}
return enum_value;
}
// Format time // Format time
function formatTime(time) { function formatTime(time) {