From 0f9ce916ef3a1c8c5fd232a3e69c905ee46b9466 Mon Sep 17 00:00:00 2001 From: Consti10 Date: Sun, 21 Apr 2024 15:15:20 +0200 Subject: [PATCH 1/4] work on x20 temp widget --- qml/qml.qrc | 1 + qml/ui/HUDOverlayGrid.qml | 4 ++++ qml/ui/widgets/X20OverheatWidget.qml | 16 ++++++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 qml/ui/widgets/X20OverheatWidget.qml diff --git a/qml/qml.qrc b/qml/qml.qrc index 979ce22a2..2528562a9 100644 --- a/qml/qml.qrc +++ b/qml/qml.qrc @@ -311,5 +311,6 @@ ui/sidebar/BaseJoyEditElement2.qml ui/sidebar/MavlinkChoiceElement2.qml ui/sidebar/MappedMavlinkChoices.qml + ui/widgets/X20OverheatWidget.qml diff --git a/qml/ui/HUDOverlayGrid.qml b/qml/ui/HUDOverlayGrid.qml index 6749213dc..b7c9b08ec 100644 --- a/qml/ui/HUDOverlayGrid.qml +++ b/qml/ui/HUDOverlayGrid.qml @@ -496,6 +496,10 @@ Item { MessageHUD { id: messageHUD } + + X20OverheatWidget{ + + } } // Extra element - allows customizing the OSD color(s) and more diff --git a/qml/ui/widgets/X20OverheatWidget.qml b/qml/ui/widgets/X20OverheatWidget.qml new file mode 100644 index 000000000..5a7121f5c --- /dev/null +++ b/qml/ui/widgets/X20OverheatWidget.qml @@ -0,0 +1,16 @@ +import QtQuick 2.12 + +Item { + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.bottomMargin: 30 + width: 100 + height: 30 + + Text{ + anchors.fill: parent + text: "LOOOL \ue040" + font.pixelSize: 15 + color: "red" + } +} From 22316453b15f2783fc3b68df7296ce99f61530a0 Mon Sep 17 00:00:00 2001 From: Consti10 Date: Mon, 22 Apr 2024 10:00:48 +0200 Subject: [PATCH 2/4] add x20 overheat warning --- app/telemetry/models/aohdsystem.cpp | 1 + app/telemetry/models/aohdsystem.h | 2 ++ qml/ui/widgets/X20OverheatWidget.qml | 50 +++++++++++++++++++++++++--- 3 files changed, 49 insertions(+), 4 deletions(-) diff --git a/app/telemetry/models/aohdsystem.cpp b/app/telemetry/models/aohdsystem.cpp index 677049012..648a90003 100644 --- a/app/telemetry/models/aohdsystem.cpp +++ b/app/telemetry/models/aohdsystem.cpp @@ -429,6 +429,7 @@ void AOHDSystem::process_x3(const mavlink_openhd_stats_wb_video_air_t &msg){ set_tx_is_currently_dropping_packets(false); } } + set_video_disabled_due_to_overheating(msg.dummy0); } void AOHDSystem::process_x3b(const mavlink_openhd_stats_wb_video_air_fec_performance_t &msg) diff --git a/app/telemetry/models/aohdsystem.h b/app/telemetry/models/aohdsystem.h index c1dd0ea1d..f40c7f73c 100644 --- a/app/telemetry/models/aohdsystem.h +++ b/app/telemetry/models/aohdsystem.h @@ -125,6 +125,8 @@ class AOHDSystem : public QObject L_RO_PROP(int,air_reported_fc_sys_id,set_air_reported_fc_sys_id,-1) // L_RO_PROP(bool,dirty_air_has_secondary_cam,set_dirty_air_has_secondary_cam,false) + // x20 only right now + L_RO_PROP(int,video_disabled_due_to_overheating,set_video_disabled_due_to_overheating,-1) public: Q_INVOKABLE QString get_rate_for_mcs_bw(int mcs,int bw); private: diff --git a/qml/ui/widgets/X20OverheatWidget.qml b/qml/ui/widgets/X20OverheatWidget.qml index 5a7121f5c..00837aa31 100644 --- a/qml/ui/widgets/X20OverheatWidget.qml +++ b/qml/ui/widgets/X20OverheatWidget.qml @@ -3,14 +3,56 @@ import QtQuick 2.12 Item { anchors.right: parent.right anchors.bottom: parent.bottom - anchors.bottomMargin: 30 + anchors.bottomMargin: 120 + anchors.rightMargin: 20 width: 100 height: 30 + // 0 - all okay + // 1 - warning, soon overheating + // 2 - error, overheating protection on (Video disabled) + property int m_x20_state: { + return 1; + if(_ohdSystemAir.video_disabled_due_to_overheating<0){ + return 0; // Unknown + } + if(_ohdSystemAir.video_disabled_due_to_overheating==1){ + return 2; + } + if(_ohdSystemAir.curr_soc_temp_degree>=71){ + return 1; + } + return 0; + } + + Rectangle{ + anchors.fill: parent + color: "black" + opacity: 0.8; + visible: m_x20_state>0; + border.width: 2 + border.color: text_field.color + } + Text{ + id: text_field + visible: m_x20_state>0; anchors.fill: parent - text: "LOOOL \ue040" - font.pixelSize: 15 - color: "red" + text: { + if(m_x20_state==0)return ""; + if(m_x20_state==1)return "\uf2c7"+" \uf46a"+" !" + return "\uf2c7"+" \uf46a"+" \uf4e2" + } + color: { + if(m_x20_state==1)return "orange"; + if(m_x20_state==2)return "red"; + return "white"; + } + font.pixelSize: 16 + font.family: "Font Awesome 5 Free" + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + style: Text.Outline + styleColor: "white" } } From 3e143e7aac932553cf13672300c0862a42e94438 Mon Sep 17 00:00:00 2001 From: Consti10 Date: Mon, 22 Apr 2024 10:01:15 +0200 Subject: [PATCH 3/4] add x20 overheat warning --- qml/ui/widgets/X20OverheatWidget.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qml/ui/widgets/X20OverheatWidget.qml b/qml/ui/widgets/X20OverheatWidget.qml index 00837aa31..0c534a546 100644 --- a/qml/ui/widgets/X20OverheatWidget.qml +++ b/qml/ui/widgets/X20OverheatWidget.qml @@ -12,7 +12,7 @@ Item { // 1 - warning, soon overheating // 2 - error, overheating protection on (Video disabled) property int m_x20_state: { - return 1; + //return 1; if(_ohdSystemAir.video_disabled_due_to_overheating<0){ return 0; // Unknown } From 64e44cf097278759da48691b0b4783d5d074d4f3 Mon Sep 17 00:00:00 2001 From: Consti10 Date: Mon, 22 Apr 2024 10:04:50 +0200 Subject: [PATCH 4/4] add x20 overheat warning --- qml/ui/widgets/X20OverheatWidget.qml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qml/ui/widgets/X20OverheatWidget.qml b/qml/ui/widgets/X20OverheatWidget.qml index 0c534a546..3b369da01 100644 --- a/qml/ui/widgets/X20OverheatWidget.qml +++ b/qml/ui/widgets/X20OverheatWidget.qml @@ -13,6 +13,10 @@ Item { // 2 - error, overheating protection on (Video disabled) property int m_x20_state: { //return 1; + if(_ohdSystemAir.ohd_platform_type!=30){ + // only on x20 + return 0; + } if(_ohdSystemAir.video_disabled_due_to_overheating<0){ return 0; // Unknown }