Skip to content

Commit

Permalink
Merge pull request #691 from OpenHD/consti-dev
Browse files Browse the repository at this point in the history
X20 overheat / overheat protection widget
  • Loading branch information
Consti10 authored Apr 22, 2024
2 parents 0d7273e + 64e44cf commit 1b1c1c2
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/telemetry/models/aohdsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions app/telemetry/models/aohdsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions qml/qml.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -311,5 +311,6 @@
<file>ui/sidebar/BaseJoyEditElement2.qml</file>
<file>ui/sidebar/MavlinkChoiceElement2.qml</file>
<file>ui/sidebar/MappedMavlinkChoices.qml</file>
<file>ui/widgets/X20OverheatWidget.qml</file>
</qresource>
</RCC>
4 changes: 4 additions & 0 deletions qml/ui/HUDOverlayGrid.qml
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,10 @@ Item {
MessageHUD {
id: messageHUD
}

X20OverheatWidget{

}
}

// Extra element - allows customizing the OSD color(s) and more
Expand Down
62 changes: 62 additions & 0 deletions qml/ui/widgets/X20OverheatWidget.qml
Original file line number Diff line number Diff line change
@@ -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"
}
}

0 comments on commit 1b1c1c2

Please sign in to comment.