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/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..3b369da01 --- /dev/null +++ b/qml/ui/widgets/X20OverheatWidget.qml @@ -0,0 +1,62 @@ +import QtQuick 2.12 + +Item { + anchors.right: parent.right + anchors.bottom: parent.bottom + 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.ohd_platform_type!=30){ + // only on x20 + return 0; + } + 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: { + 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" + } +}