From c16eb9821bb08c73cb6204c718d37ef111e1bf1e Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Sun, 23 Apr 2017 02:08:34 +0200 Subject: [PATCH 1/2] LP-510 Fix OPLM panel display and SMeter --- ground/gcs/src/share/qml/js/uav.js | 8 ++ ground/gcs/src/share/qml/pfd/Panels.qml | 131 +----------------------- 2 files changed, 13 insertions(+), 126 deletions(-) diff --git a/ground/gcs/src/share/qml/js/uav.js b/ground/gcs/src/share/qml/js/uav.js index 789a9f52f..4ae549713 100644 --- a/ground/gcs/src/share/qml/js/uav.js +++ b/ground/gcs/src/share/qml/js/uav.js @@ -229,6 +229,14 @@ function isOplmConnected() { return (opLinkStatus.linkState == OPLinkStatus.LinkState.Connected); } +function OplmRSSI() { + return (opLinkStatus.rssi); +} + +function OplmDeviceID() { + return (opLinkStatus.deviceID); +} + function magSourceName() { var auxMagTypeText = ["GPSv9", "Flexi", "I2C", "DJI"]; var magStateSourceText = ["Invalid", "OnBoard", "ExtMag"]; diff --git a/ground/gcs/src/share/qml/pfd/Panels.qml b/ground/gcs/src/share/qml/pfd/Panels.qml index e9a865de0..563fdf561 100644 --- a/ground/gcs/src/share/qml/pfd/Panels.qml +++ b/ground/gcs/src/share/qml/pfd/Panels.qml @@ -85,11 +85,8 @@ Item { property real smeter_angle - // Needed to get correctly int8 value, reset value (-127) on disconnect - property int oplm0_db: (telemetry_link == 1) ? opLinkStatus.pairSignalStrengths0 : -127 - property int oplm1_db: (telemetry_link == 1) ? opLinkStatus.pairSignalStrengths1 : -127 - property int oplm2_db: (telemetry_link == 1) ? opLinkStatus.pairSignalStrengths2 : -127 - property int oplm3_db: (telemetry_link == 1) ? opLinkStatus.pairSignalStrengths3 : -127 + // Needed to get correctly int8 value + property int oplm_rssi: UAV.OplmRSSI() property real telemetry_sum property real telemetry_sum_old @@ -117,62 +114,11 @@ Item { // Filtering for S-meter. Smeter range -127dB <--> -13dB = S9+60dB Timer { - id: smeter_filter0 + id: smeter_filter interval: 100; running: true; repeat: true - onTriggered: smeter_angle = (0.90 * smeter_angle) + (0.1 * (oplm0_db + 13)) + onTriggered: smeter_angle = (0.90 * smeter_angle) + (0.1 * (oplm_rssi + 13)) } - Timer { - id: smeter_filter1 - interval: 100; repeat: true - onTriggered: smeter_angle = (0.90 * smeter_angle) + (0.1 * (oplm1_db + 13)) - } - - Timer { - id: smeter_filter2 - interval: 100; repeat: true - onTriggered: smeter_angle = (0.90 * smeter_angle) + (0.1 * (oplm2_db + 13)) - } - - Timer { - id: smeter_filter3 - interval: 100; repeat: true - onTriggered: smeter_angle = (0.90 * smeter_angle) + (0.1 * (oplm3_db + 13)) - } - - property int smeter_filter - property variant oplm_pair_id : opLinkStatus.pairIDs0 - - function select_oplm(index){ - smeter_filter0.running = false; - smeter_filter1.running = false; - smeter_filter2.running = false; - smeter_filter3.running = false; - - switch(index) { - case 0: - smeter_filter0.running = true; - smeter_filter = 0; - oplm_pair_id = opLinkStatus.pairIDs0 - break; - case 1: - smeter_filter1.running = true; - smeter_filter = 1; - oplm_pair_id = opLinkStatus.pairIDs1 - break; - case 2: - smeter_filter2.running = true; - smeter_filter = 2; - oplm_pair_id = opLinkStatus.pairIDs2 - break; - case 3: - smeter_filter3.running = true; - smeter_filter = 3; - oplm_pair_id = opLinkStatus.pairIDs3 - break; - } - } - // End Functions // // Start Drawing @@ -783,73 +729,6 @@ Item { } } - SvgElementImage { - id: oplm_button_bg - elementName: "oplm-button-bg" - sceneSize: panels.sceneSize - y: Math.floor(scaledBounds.y * sceneItem.height) - width: smeter_mask.width - - z: oplm_bg.z + 5 - - states: State { - name: "fading" - when: show_panels == true - PropertyChanges { target: oplm_button_bg; x: Math.floor(scaledBounds.x * sceneItem.width) + offset_value; } - } - - transitions: Transition { - SequentialAnimation { - PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration } - } - } - } - - Repeater { - model: 4 - - SvgElementImage { - z: oplm_bg.z + 5 - property variant idButton_oplm: "oplm_button_" + index - property variant idButton_oplm_mousearea: "oplm_button_mousearea" + index - property variant button_color: "button"+index+"_color" - - id: idButton_oplm - - elementName: "oplm-button-" + index - sceneSize: panels.sceneSize - - Rectangle { - anchors.fill: parent - border.color: "red" - border.width: parent.width * 0.04 - radius: border.width*3 - color: "transparent" - opacity: smeter_filter == index ? 0.5 : 0 - } - - MouseArea { - id: idButton_oplm_mousearea; - anchors.fill: parent; - cursorShape: Qt.PointingHandCursor; - visible: display_oplm == true ? 1 : 0 - onClicked: select_oplm(index) - } - - states: State { - name: "fading" - when: show_panels == true - PropertyChanges { target: idButton_oplm; x: Math.floor(scaledBounds.x * sceneItem.width) + offset_value; } - } - - transitions: Transition { - SequentialAnimation { - PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration } - } - } - } - } - SvgElementImage { id: oplm_id_label elementName: "oplm-id-label" @@ -893,7 +772,7 @@ Item { } Text { - text: oplm_pair_id > 0 ? oplm_pair_id.toString(16) : "-- -- -- --" + text: UAV.OplmDeviceID() > 0 ? UAV.OplmDeviceID().toString(16) : "-- -- -- --" anchors.centerIn: parent color: "white" font { From 1d04b95323bc4cbf824d456b7072116014630314 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Fri, 5 May 2017 19:44:18 +0200 Subject: [PATCH 2/2] LP-510 Changes from review - Add some limits and conditions for Rssi and S-Meter --- ground/gcs/src/share/qml/js/uav.js | 8 ++++---- ground/gcs/src/share/qml/pfd/Panels.qml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ground/gcs/src/share/qml/js/uav.js b/ground/gcs/src/share/qml/js/uav.js index 4ae549713..d01500e86 100644 --- a/ground/gcs/src/share/qml/js/uav.js +++ b/ground/gcs/src/share/qml/js/uav.js @@ -229,12 +229,12 @@ function isOplmConnected() { return (opLinkStatus.linkState == OPLinkStatus.LinkState.Connected); } -function OplmRSSI() { - return (opLinkStatus.rssi); +function oplmRSSI() { + return (opLinkStatus.rssi > -13) ? -13 : opLinkStatus.rssi; } -function OplmDeviceID() { - return (opLinkStatus.deviceID); +function oplmDeviceID() { + return opLinkStatus.deviceID; } function magSourceName() { diff --git a/ground/gcs/src/share/qml/pfd/Panels.qml b/ground/gcs/src/share/qml/pfd/Panels.qml index 563fdf561..69c1513a8 100644 --- a/ground/gcs/src/share/qml/pfd/Panels.qml +++ b/ground/gcs/src/share/qml/pfd/Panels.qml @@ -86,7 +86,7 @@ Item { property real smeter_angle // Needed to get correctly int8 value - property int oplm_rssi: UAV.OplmRSSI() + property int oplm_rssi: telemetry_link ? UAV.oplmRSSI() : -127 property real telemetry_sum property real telemetry_sum_old @@ -772,7 +772,7 @@ Item { } Text { - text: UAV.OplmDeviceID() > 0 ? UAV.OplmDeviceID().toString(16) : "-- -- -- --" + text: (UAV.oplmDeviceID() > 0) ? UAV.oplmDeviceID().toString(16) : "-- -- -- --" anchors.centerIn: parent color: "white" font {