mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
LP-181 Compatible Qt5.4 / Qt5.5 - Added file for javascript functions
This commit is contained in:
parent
3e6313e95e
commit
df841fda29
@ -1,5 +1,6 @@
|
|||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import "."
|
import "."
|
||||||
|
import "common.js" as Utils
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: sceneItem
|
id: sceneItem
|
||||||
@ -50,7 +51,7 @@ Item {
|
|||||||
|
|
||||||
rotation: -AttitudeState.Yaw + home_degrees
|
rotation: -AttitudeState.Yaw + home_degrees
|
||||||
transformOrigin: Item.Bottom
|
transformOrigin: Item.Bottom
|
||||||
visible: TakeOffLocation.Status == 0
|
visible: Utils.toInt(TakeOffLocation.Status) == 0
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
|
import "common.js" as Utils
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: info
|
id: info
|
||||||
@ -7,11 +8,6 @@ Item {
|
|||||||
// Uninitialised, Ok, Warning, Critical, Error
|
// Uninitialised, Ok, Warning, Critical, Error
|
||||||
property variant batColors : ["black", "green", "orange", "red", "red"]
|
property variant batColors : ["black", "green", "orange", "red", "red"]
|
||||||
|
|
||||||
// qml/js treats qint8 as a char, necessary to convert it back to integer value
|
|
||||||
function qint8toInt(qint8_value) {
|
|
||||||
return String(qint8_value).charCodeAt(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Waypoint functions
|
// Waypoint functions
|
||||||
//
|
//
|
||||||
@ -63,15 +59,6 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatTime(time) {
|
|
||||||
if (time === 0)
|
|
||||||
return "00"
|
|
||||||
if (time < 10)
|
|
||||||
return "0" + time;
|
|
||||||
else
|
|
||||||
return time.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
// End Functions
|
// End Functions
|
||||||
//
|
//
|
||||||
// Start Drawing
|
// Start Drawing
|
||||||
@ -89,14 +76,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: qint8toInt(GPSSatellites.SatsInView)
|
property int satsInView: Utils.toInt(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 : qint8toInt(GPSPositionSensor.Satellites)
|
property int satNumber : Utils.toInt(GPSPositionSensor.Satellites)
|
||||||
|
|
||||||
model: 13
|
model: 13
|
||||||
Rectangle {
|
Rectangle {
|
||||||
@ -125,10 +112,10 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
property int satNumber : qint8toInt(GPSPositionSensor.Satellites)
|
property int satNumber : Utils.toInt(GPSPositionSensor.Satellites)
|
||||||
|
|
||||||
text: [satNumber > 5 ? " " + satNumber.toString() + " sats - " : ""] +
|
text: [satNumber > 5 ? " " + satNumber.toString() + " sats - " : ""] +
|
||||||
["NO GPS", "NO FIX", "2D", "3D"][qint8toInt(GPSPositionSensor.Status)]
|
["NO GPS", "NO FIX", "2D", "3D"][Utils.toInt(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
|
||||||
@ -157,7 +144,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: qint8toInt(SystemAlarms.Alarm_PathPlan) == 1
|
visible: Utils.toInt(SystemAlarms.Alarm_PathPlan) == 1
|
||||||
}
|
}
|
||||||
|
|
||||||
SvgElementPositionItem {
|
SvgElementPositionItem {
|
||||||
@ -166,7 +153,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: qint8toInt(SystemAlarms.Alarm_PathPlan) == 1
|
visible: Utils.toInt(SystemAlarms.Alarm_PathPlan) == 1
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: " "+wp_heading.toFixed(1)+"°"
|
text: " "+wp_heading.toFixed(1)+"°"
|
||||||
@ -187,7 +174,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: qint8toInt(SystemAlarms.Alarm_PathPlan) == 1
|
visible: Utils.toInt(SystemAlarms.Alarm_PathPlan) == 1
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: " "+wp_distance.toFixed(0)+" m"
|
text: " "+wp_distance.toFixed(0)+" m"
|
||||||
@ -208,7 +195,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: qint8toInt(SystemAlarms.Alarm_PathPlan) == 1
|
visible: Utils.toInt(SystemAlarms.Alarm_PathPlan) == 1
|
||||||
|
|
||||||
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()}
|
||||||
|
|
||||||
@ -226,7 +213,7 @@ Item {
|
|||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
interval: 1000; running: true; repeat: true;
|
interval: 1000; running: true; repeat: true;
|
||||||
onTriggered: {if (qint8toInt(GPSPositionSensor.Status) == 3) compute_distance(PositionState.East,PositionState.North)}
|
onTriggered: {if (Utils.toInt(GPSPositionSensor.Status) == 3) compute_distance(PositionState.East,PositionState.North)}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,10 +223,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: qint8toInt(SystemAlarms.Alarm_PathPlan) == 1
|
visible: Utils.toInt(SystemAlarms.Alarm_PathPlan) == 1
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: formatTime(wp_eta_h) + ":" + formatTime(wp_eta_m) + ":" + formatTime(wp_eta_s)
|
text: Utils.formatTime(wp_eta_h) + ":" + Utils.formatTime(wp_eta_m) + ":" + Utils.formatTime(wp_eta_s)
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: "cyan"
|
color: "cyan"
|
||||||
|
|
||||||
@ -257,7 +244,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: qint8toInt(SystemAlarms.Alarm_PathPlan) == 1
|
visible: Utils.toInt(SystemAlarms.Alarm_PathPlan) == 1
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: (WaypointActive.Index+1)+" / "+PathPlan.WaypointCount
|
text: (WaypointActive.Index+1)+" / "+PathPlan.WaypointCount
|
||||||
@ -278,10 +265,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: qint8toInt(SystemAlarms.Alarm_PathPlan) == 1
|
visible: Utils.toInt(SystemAlarms.Alarm_PathPlan) == 1
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: ["GOTO ENDPOINT","FOLLOW VECTOR","CIRCLE RIGHT","CIRCLE LEFT","FIXED ATTITUDE","SET ACCESSORY","DISARM ALARM","LAND","BRAKE","VELOCITY","AUTO TAKEOFF"][qint8toInt(PathDesired.Mode)]
|
text: ["GOTO ENDPOINT","FOLLOW VECTOR","CIRCLE RIGHT","CIRCLE LEFT","FIXED ATTITUDE","SET ACCESSORY","DISARM ALARM","LAND","BRAKE","VELOCITY","AUTO TAKEOFF"][Utils.toInt(PathDesired.Mode)]
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: "cyan"
|
color: "cyan"
|
||||||
|
|
||||||
@ -304,11 +291,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: (qint8toInt(SystemAlarms.Alarm_PathPlan) != 1) && (qint8toInt(HwSettings.OptionalModules_Battery) == 1)
|
visible: (Utils.toInt(SystemAlarms.Alarm_PathPlan) != 1) && (Utils.toInt(HwSettings.OptionalModules_Battery) == 1)
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: FlightBatterySettings.NbCells > 0 ? info.batColors[qint8toInt(SystemAlarms.Alarm_Battery)] : "black"
|
color: Utils.toInt(FlightBatterySettings.NbCells) > 0 ? info.batColors[Utils.toInt(SystemAlarms.Alarm_Battery)] : "black"
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -319,7 +306,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: (qint8toInt(SystemAlarms.Alarm_PathPlan) != 1) && (qint8toInt(HwSettings.OptionalModules_Battery) == 1)
|
visible: (Utils.toInt(SystemAlarms.Alarm_PathPlan) != 1) && (Utils.toInt(HwSettings.OptionalModules_Battery) == 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
SvgElementPositionItem {
|
SvgElementPositionItem {
|
||||||
@ -330,7 +317,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: (qint8toInt(SystemAlarms.Alarm_PathPlan) != 1) && (qint8toInt(HwSettings.OptionalModules_Battery) == 1)
|
visible: (Utils.toInt(SystemAlarms.Alarm_PathPlan) != 1) && (Utils.toInt(HwSettings.OptionalModules_Battery) == 1)
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@ -357,7 +344,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: (qint8toInt(SystemAlarms.Alarm_PathPlan) != 1) && (qint8toInt(HwSettings.OptionalModules_Battery) == 1)
|
visible: (Utils.toInt(SystemAlarms.Alarm_PathPlan) != 1) && (Utils.toInt(HwSettings.OptionalModules_Battery) == 1)
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@ -384,7 +371,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: (qint8toInt(SystemAlarms.Alarm_PathPlan) != 1) && (qint8toInt(HwSettings.OptionalModules_Battery) == 1)
|
visible: (Utils.toInt(SystemAlarms.Alarm_PathPlan) != 1) && (Utils.toInt(HwSettings.OptionalModules_Battery) == 1)
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@ -402,7 +389,7 @@ Item {
|
|||||||
|
|
||||||
// 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[qint8toInt(SystemAlarms.Alarm_Battery)]))
|
(FlightBatteryState.EstimatedFlightTime <= 60 ? "red": info.batColors[Utils.toInt(SystemAlarms.Alarm_Battery)]))
|
||||||
|
|
||||||
border.color: "white"
|
border.color: "white"
|
||||||
border.width: topbattery_volt.width * 0.01
|
border.width: topbattery_volt.width * 0.01
|
||||||
@ -430,7 +417,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: qint8toInt(SystemAlarms.Alarm_PathPlan) != 1
|
visible: Utils.toInt(SystemAlarms.Alarm_PathPlan) != 1
|
||||||
}
|
}
|
||||||
|
|
||||||
SvgElementPositionItem {
|
SvgElementPositionItem {
|
||||||
@ -439,7 +426,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: qint8toInt(SystemAlarms.Alarm_PathPlan) != 1
|
visible: Utils.toInt(SystemAlarms.Alarm_PathPlan) != 1
|
||||||
|
|
||||||
TooltipArea {
|
TooltipArea {
|
||||||
text: "Reset distance counter"
|
text: "Reset distance counter"
|
||||||
@ -461,7 +448,7 @@ Item {
|
|||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
interval: 1000; running: true; repeat: true;
|
interval: 1000; running: true; repeat: true;
|
||||||
onTriggered: {if (qint8toInt(GPSPositionSensor.Status) == 3) compute_distance(PositionState.East,PositionState.North)}
|
onTriggered: {if (Utils.toInt(GPSPositionSensor.Status) == 3) compute_distance(PositionState.East,PositionState.North)}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -480,7 +467,7 @@ Item {
|
|||||||
|
|
||||||
states: State {
|
states: State {
|
||||||
name: "fading"
|
name: "fading"
|
||||||
when: qint8toInt(TakeOffLocation.Status) == 0
|
when: Utils.toInt(TakeOffLocation.Status) == 0
|
||||||
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; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -501,7 +488,7 @@ Item {
|
|||||||
|
|
||||||
states: State {
|
states: State {
|
||||||
name: "fading_heading"
|
name: "fading_heading"
|
||||||
when: qint8toInt(TakeOffLocation.Status) == 0
|
when: Utils.toInt(TakeOffLocation.Status) == 0
|
||||||
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; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -532,7 +519,7 @@ Item {
|
|||||||
|
|
||||||
states: State {
|
states: State {
|
||||||
name: "fading_distance"
|
name: "fading_distance"
|
||||||
when: qint8toInt(TakeOffLocation.Status) == 0
|
when: Utils.toInt(TakeOffLocation.Status) == 0
|
||||||
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; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -563,7 +550,7 @@ Item {
|
|||||||
|
|
||||||
states: State {
|
states: State {
|
||||||
name: "fading_distance"
|
name: "fading_distance"
|
||||||
when: qint8toInt(TakeOffLocation.Status) == 0
|
when: Utils.toInt(TakeOffLocation.Status) == 0
|
||||||
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; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -574,7 +561,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: formatTime(home_eta_h) + ":" + formatTime(home_eta_m) + ":" + formatTime(home_eta_s)
|
text: Utils.formatTime(home_eta_h) + ":" + Utils.formatTime(home_eta_m) + ":" + Utils.formatTime(home_eta_s)
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: "cyan"
|
color: "cyan"
|
||||||
font {
|
font {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
|
import "common.js" as Utils
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: panels
|
id: panels
|
||||||
@ -9,20 +10,6 @@ Item {
|
|||||||
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)
|
||||||
|
|
||||||
function formatTime(time) {
|
|
||||||
if (time === 0)
|
|
||||||
return "00"
|
|
||||||
if (time < 10)
|
|
||||||
return "0" + time;
|
|
||||||
else
|
|
||||||
return time.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
// qml/js treats qint8 as a char, necessary to convert it back to integer value
|
|
||||||
function qint8toInt(qint8_value) {
|
|
||||||
return String(qint8_value).charCodeAt(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Panel functions
|
// Panel functions
|
||||||
//
|
//
|
||||||
@ -105,7 +92,7 @@ Item {
|
|||||||
function telemetry_check() {
|
function telemetry_check() {
|
||||||
telemetry_sum = OPLinkStatus.RXRate + OPLinkStatus.RXRate
|
telemetry_sum = OPLinkStatus.RXRate + OPLinkStatus.RXRate
|
||||||
|
|
||||||
if (telemetry_sum != telemetry_sum_old || qint8toInt(OPLinkStatus.LinkState) == 4) {
|
if (telemetry_sum != telemetry_sum_old || Utils.toInt(OPLinkStatus.LinkState) == 4) {
|
||||||
telemetry_link = 1
|
telemetry_link = 1
|
||||||
} else {
|
} else {
|
||||||
telemetry_link = 0
|
telemetry_link = 0
|
||||||
@ -456,7 +443,7 @@ Item {
|
|||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: panels.batColors[qint8toInt(SystemAlarms.Alarm_Battery)]
|
color: panels.batColors[Utils.toInt(SystemAlarms.Alarm_Battery)]
|
||||||
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
|
||||||
@ -497,7 +484,7 @@ Item {
|
|||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: panels.batColors[qint8toInt(SystemAlarms.Alarm_Battery)]
|
color: panels.batColors[Utils.toInt(SystemAlarms.Alarm_Battery)]
|
||||||
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
|
||||||
@ -554,7 +541,7 @@ Item {
|
|||||||
|
|
||||||
// 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[qint8toInt(SystemAlarms.Alarm_Battery)]))
|
(FlightBatteryState.EstimatedFlightTime <= 60 ? "red": panels.batColors[Utils.toInt(SystemAlarms.Alarm_Battery)]))
|
||||||
|
|
||||||
border.color: "white"
|
border.color: "white"
|
||||||
border.width: battery_volt.width * 0.01
|
border.width: battery_volt.width * 0.01
|
||||||
@ -596,7 +583,7 @@ Item {
|
|||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
//color: panels.batColors[qint8toInt(SystemAlarms.Alarm_Battery)]
|
//color: panels.batColors[Utils.toInt(SystemAlarms.Alarm_Battery)]
|
||||||
|
|
||||||
TooltipArea {
|
TooltipArea {
|
||||||
text: "Reset consumed energy"
|
text: "Reset consumed energy"
|
||||||
@ -613,14 +600,14 @@ Item {
|
|||||||
|
|
||||||
// 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[qint8toInt(SystemAlarms.Alarm_Battery)]))
|
(FlightBatteryState.EstimatedFlightTime <= 60 ? "red": panels.batColors[Utils.toInt(SystemAlarms.Alarm_Battery)]))
|
||||||
|
|
||||||
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: formatTime(est_time_h) + ":" + formatTime(est_time_m) + ":" + formatTime(est_time_s)
|
text: Utils.formatTime(est_time_h) + ":" + Utils.formatTime(est_time_m) + ":" + Utils.formatTime(est_time_s)
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: "white"
|
color: "white"
|
||||||
font {
|
font {
|
||||||
@ -959,7 +946,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: qint8toInt(ReceiverStatus.Quality) > 0 ? qint8toInt(ReceiverStatus.Quality)+"%" : "?? %"
|
text: Utils.toInt(ReceiverStatus.Quality) > 0 ? Utils.toInt(ReceiverStatus.Quality)+"%" : "?? %"
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: "white"
|
color: "white"
|
||||||
font {
|
font {
|
||||||
@ -1048,7 +1035,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"][qint8toInt(SystemSettings.AirframeType)]
|
"Tricopter", "GroundVehicleCar", "GroundVehicleDiff", "GroundVehicleMoto"][Utils.toInt(SystemSettings.AirframeType)]
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
color: "white"
|
color: "white"
|
||||||
font {
|
font {
|
||||||
@ -1080,7 +1067,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: qint8toInt(SystemStats.CPULoad)+"%"+
|
text: Utils.toInt(SystemStats.CPULoad)+"%"+
|
||||||
[SystemStats.HeapRemaining < 3000 ? "" : " | "+cpuTemp+"°C"]
|
[SystemStats.HeapRemaining < 3000 ? "" : " | "+cpuTemp+"°C"]
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
color: "white"
|
color: "white"
|
||||||
@ -1143,7 +1130,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: ["None", "Basic (No Nav)", "CompMag", "Comp+Mag+GPS", "EKFIndoor", "GPS Nav (INS13)"][qint8toInt(RevoSettings.FusionAlgorithm)]
|
text: ["None", "Basic (No Nav)", "CompMag", "Comp+Mag+GPS", "EKFIndoor", "GPS Nav (INS13)"][Utils.toInt(RevoSettings.FusionAlgorithm)]
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
color: "white"
|
color: "white"
|
||||||
font {
|
font {
|
||||||
@ -1174,7 +1161,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: ["Invalid", "OnBoard", "External"][qint8toInt(MagState.Source)]
|
text: ["Invalid", "OnBoard", "External"][Utils.toInt(MagState.Source)]
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
color: "white"
|
color: "white"
|
||||||
font {
|
font {
|
||||||
@ -1205,7 +1192,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: ["Unknown", "NMEA", "UBX", "UBX7", "UBX8"][qint8toInt(GPSPositionSensor.SensorType)]
|
text: ["Unknown", "NMEA", "UBX", "UBX7", "UBX8"][Utils.toInt(GPSPositionSensor.SensorType)]
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
color: "white"
|
color: "white"
|
||||||
font {
|
font {
|
||||||
|
@ -1,67 +0,0 @@
|
|||||||
import QtQuick 2.0
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: sceneItem
|
|
||||||
property variant sceneSize
|
|
||||||
|
|
||||||
//telemetry status arrow
|
|
||||||
SvgElementImage {
|
|
||||||
id: telemetry_status
|
|
||||||
elementName: "gcstelemetry-"+statusName
|
|
||||||
sceneSize: sceneItem.sceneSize
|
|
||||||
|
|
||||||
property string statusName : ["Disconnected","HandshakeReq","HandshakeAck","Connected"][GCSTelemetryStats.Status]
|
|
||||||
|
|
||||||
scaledBounds: svgRenderer.scaledElementBounds("pfd.svg", "gcstelemetry-Disconnected")
|
|
||||||
x: Math.floor(scaledBounds.x * sceneItem.width)
|
|
||||||
y: Math.floor(scaledBounds.y * sceneItem.height)
|
|
||||||
}
|
|
||||||
|
|
||||||
//telemetry rate text
|
|
||||||
Text {
|
|
||||||
id: telemetry_rate
|
|
||||||
text: GCSTelemetryStats.TxDataRate.toFixed()+"/"+GCSTelemetryStats.RxDataRate.toFixed()
|
|
||||||
color: "white"
|
|
||||||
font.family: pt_bold.name
|
|
||||||
font.pixelSize: telemetry_status.height * 0.75
|
|
||||||
|
|
||||||
anchors.top: telemetry_status.bottom
|
|
||||||
anchors.horizontalCenter: telemetry_status.horizontalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
id: gps_text
|
|
||||||
text: "GPS: " + GPSPositionSensor.Satellites + "\nPDP: " + Math.round(GPSPositionSensor.PDOP*10)/10
|
|
||||||
color: "white"
|
|
||||||
font.family: pt_bold.name
|
|
||||||
font.pixelSize: telemetry_status.height * 0.75
|
|
||||||
|
|
||||||
visible: GPSPositionSensor.Satellites > 0
|
|
||||||
|
|
||||||
property variant scaledBounds: svgRenderer.scaledElementBounds("pfd.svg", "gps-txt")
|
|
||||||
x: Math.floor(scaledBounds.x * sceneItem.width)
|
|
||||||
y: Math.floor(scaledBounds.y * sceneItem.height)
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
id: battery_text
|
|
||||||
|
|
||||||
text: FlightBatteryState.Voltage.toFixed(2)+" V\n" +
|
|
||||||
FlightBatteryState.Current.toFixed(2)+" A\n" +
|
|
||||||
FlightBatteryState.ConsumedEnergy.toFixed()+" mAh"
|
|
||||||
|
|
||||||
|
|
||||||
color: "white"
|
|
||||||
font.family: pt_bold.name
|
|
||||||
|
|
||||||
//I think it should be pixel size,
|
|
||||||
//but making it more consistent with C++ version instead
|
|
||||||
font.pointSize: scaledBounds.height * sceneItem.height
|
|
||||||
|
|
||||||
visible: FlightBatteryState.Voltage > 0 || FlightBatteryState.Current > 0
|
|
||||||
|
|
||||||
property variant scaledBounds: svgRenderer.scaledElementBounds("pfd.svg", "battery-txt")
|
|
||||||
x: Math.floor(scaledBounds.x * sceneItem.width)
|
|
||||||
y: Math.floor(scaledBounds.y * sceneItem.height)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +1,5 @@
|
|||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
|
import "common.js" as Utils
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: sceneItem
|
id: sceneItem
|
||||||
@ -22,7 +23,7 @@ Item {
|
|||||||
y: scaledBounds.y * sceneItem.height
|
y: scaledBounds.y * sceneItem.height
|
||||||
|
|
||||||
smooth: true
|
smooth: true
|
||||||
visible: VelocityDesired.Down !== 0.0 && FlightStatus.FlightMode > 7
|
visible: VelocityDesired.Down !== 0.0 && Utils.toInt(FlightStatus.FlightMode) > 7
|
||||||
|
|
||||||
//rotate it around the center
|
//rotate it around the center
|
||||||
transform: Rotation {
|
transform: Rotation {
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
|
import "common.js" as Utils
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: warnings
|
id: warnings
|
||||||
|
|
||||||
// qml/js treats qint8 as a char, necessary to convert it back to integer value
|
|
||||||
function qint8toInt(qint8_value) {
|
|
||||||
return String(qint8_value).charCodeAt(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
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"]
|
||||||
@ -31,10 +27,10 @@ Item {
|
|||||||
|
|
||||||
// SystemSettings.AirframeType 3 - 17 : VtolPathFollower, check ThrustControl
|
// SystemSettings.AirframeType 3 - 17 : VtolPathFollower, check ThrustControl
|
||||||
|
|
||||||
property var thrust_mode: qint8toInt(FlightStatus.FlightMode) < 7 ? qint8toInt(StabilizationDesired.StabilizationMode_Thrust) :
|
property var thrust_mode: Utils.toInt(FlightStatus.FlightMode) < 7 ? Utils.toInt(StabilizationDesired.StabilizationMode_Thrust) :
|
||||||
qint8toInt(FlightStatus.FlightMode) > 6 && qint8toInt(SystemSettings.AirframeType) > 2 &&
|
Utils.toInt(FlightStatus.FlightMode) > 6 && Utils.toInt(SystemSettings.AirframeType) > 2 &&
|
||||||
qint8toInt(SystemSettings.AirframeType) < 18 && qint8toInt(VtolPathFollowerSettings.ThrustControl) == 1 ? 12 :
|
Utils.toInt(SystemSettings.AirframeType) < 18 && Utils.toInt(VtolPathFollowerSettings.ThrustControl) == 1 ? 12 :
|
||||||
qint8toInt(FlightStatus.FlightMode) > 6 && qint8toInt(SystemSettings.AirframeType) < 3 ? 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)
|
||||||
@ -42,15 +38,6 @@ Item {
|
|||||||
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)
|
||||||
|
|
||||||
function formatTime(time) {
|
|
||||||
if (time === 0)
|
|
||||||
return "00"
|
|
||||||
if (time < 10)
|
|
||||||
return "0" + time;
|
|
||||||
else
|
|
||||||
return time.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
SvgElementImage {
|
SvgElementImage {
|
||||||
id: warning_bg
|
id: warning_bg
|
||||||
elementName: "warnings-bg"
|
elementName: "warnings-bg"
|
||||||
@ -74,7 +61,7 @@ Item {
|
|||||||
|
|
||||||
Text {
|
Text {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: formatTime(time_h) + ":" + formatTime(time_m) + ":" + formatTime(time_s)
|
text: Utils.formatTime(time_h) + ":" + Utils.formatTime(time_m) + ":" + Utils.formatTime(time_s)
|
||||||
font {
|
font {
|
||||||
family: pt_bold.name
|
family: pt_bold.name
|
||||||
pixelSize: Math.floor(parent.height * 0.8)
|
pixelSize: Math.floor(parent.height * 0.8)
|
||||||
@ -95,11 +82,11 @@ Item {
|
|||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: warnings.armColors[qint8toInt(FlightStatus.Armed)]
|
color: warnings.armColors[Utils.toInt(FlightStatus.Armed)]
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: ["DISARMED","ARMING","ARMED"][qint8toInt(FlightStatus.Armed)]
|
text: ["DISARMED","ARMING","ARMED"][Utils.toInt(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)
|
||||||
@ -120,7 +107,7 @@ Item {
|
|||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: warnings.statusColors[qint8toInt(SystemAlarms.Alarm_ManualControl)]
|
color: warnings.statusColors[Utils.toInt(SystemAlarms.Alarm_ManualControl)]
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
@ -143,11 +130,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: (qint8toInt(SystemAlarms.Alarm_BootFault) > 1 ||
|
property bool warningActive: (Utils.toInt(SystemAlarms.Alarm_BootFault) > 1 ||
|
||||||
qint8toInt(SystemAlarms.Alarm_OutOfMemory) > 1 ||
|
Utils.toInt(SystemAlarms.Alarm_OutOfMemory) > 1 ||
|
||||||
qint8toInt(SystemAlarms.Alarm_StackOverflow) > 1 ||
|
Utils.toInt(SystemAlarms.Alarm_StackOverflow) > 1 ||
|
||||||
qint8toInt(SystemAlarms.Alarm_CPUOverload) > 1 ||
|
Utils.toInt(SystemAlarms.Alarm_CPUOverload) > 1 ||
|
||||||
qint8toInt(SystemAlarms.Alarm_EventSystem) > 1)
|
Utils.toInt(SystemAlarms.Alarm_EventSystem) > 1)
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: parent.warningActive ? "red" : "red"
|
color: parent.warningActive ? "red" : "red"
|
||||||
@ -177,7 +164,7 @@ Item {
|
|||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: warnings.statusColors[qint8toInt(SystemAlarms.Alarm_Guidance)]
|
color: warnings.statusColors[Utils.toInt(SystemAlarms.Alarm_Guidance)]
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
@ -202,14 +189,14 @@ Item {
|
|||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: warnings.flightmodeColors[qint8toInt(FlightStatus.FlightMode)]
|
color: warnings.flightmodeColors[Utils.toInt(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"][qint8toInt(FlightStatus.FlightMode)]
|
"VEL ROAM", "HOME LEASH", "ABS POS", "RTB", "LAND", "PATHPLAN", "POI", "AUTOCRUISE", "AUTOTAKEOFF"][Utils.toInt(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)
|
||||||
@ -230,7 +217,7 @@ Item {
|
|||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: qint8toInt(FlightStatus.FlightMode) < 1 ? "grey" : warnings.thrustmodeColors[thrust_mode]
|
color: Utils.toInt(FlightStatus.FlightMode) < 1 ? "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
|
||||||
@ -253,7 +240,7 @@ Item {
|
|||||||
elementName: "warning-gps"
|
elementName: "warning-gps"
|
||||||
sceneSize: warnings.sceneSize
|
sceneSize: warnings.sceneSize
|
||||||
|
|
||||||
visible: qint8toInt(SystemAlarms.Alarm_GPS) > 1
|
visible: Utils.toInt(SystemAlarms.Alarm_GPS) > 1
|
||||||
}
|
}
|
||||||
|
|
||||||
SvgElementImage {
|
SvgElementImage {
|
||||||
@ -261,6 +248,6 @@ Item {
|
|||||||
elementName: "warning-attitude"
|
elementName: "warning-attitude"
|
||||||
sceneSize: warnings.sceneSize
|
sceneSize: warnings.sceneSize
|
||||||
anchors.centerIn: background.centerIn
|
anchors.centerIn: background.centerIn
|
||||||
visible: qint8toInt(SystemAlarms.Alarm_Attitude) > 1
|
visible: Utils.toInt(SystemAlarms.Alarm_Attitude) > 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
26
ground/gcs/src/share/pfd/default/common.js
Normal file
26
ground/gcs/src/share/pfd/default/common.js
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// ***********************
|
||||||
|
// common.js
|
||||||
|
//
|
||||||
|
// Common javascript utils
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
function formatTime(time) {
|
||||||
|
if (time === 0)
|
||||||
|
return "00"
|
||||||
|
if (time < 10)
|
||||||
|
return "0" + time;
|
||||||
|
else
|
||||||
|
return time.toString();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user