Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelscholle committed Jan 21, 2025
1 parent b1fd955 commit 6f1c5dd
Show file tree
Hide file tree
Showing 10 changed files with 107 additions and 76 deletions.
2 changes: 1 addition & 1 deletion app/telemetry/models/aohdsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class AOHDSystem : public QObject
L_RO_PROP(QString,battery_gauge,set_battery_gauge,"\uf091")
// needs to be queried explicitly (not continous fire and forget)
L_RO_PROP(QString,openhd_version,set_openhd_version,"N/A")
L_RO_PROP(QString,last_ping_result_openhd,set_last_ping_result_openhd,"N/A")
L_RO_PROP(QString,last_ping_result_openhd,set_last_ping_result_openhd," ")
L_RO_PROP(bool,is_alive,set_is_alive,false)
//
L_RO_PROP(int,current_rx_rssi,set_current_rx_rssi,-128)
Expand Down
2 changes: 1 addition & 1 deletion app/telemetry/models/fcmavlinksystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class FCMavlinkSystem : public QObject
//
L_RO_PROP(QString,mav_type_str,set_mav_type_str,"UNKNOWN");
L_RO_PROP(QString,autopilot_type_str,set_autopilot_type_str,"UNKNOWN"); //R.n Generic (inav), ardu and pixhawk
L_RO_PROP(QString, last_ping_result_flight_ctrl,set_last_ping_result_flight_ctrl,"NA")
L_RO_PROP(QString, last_ping_result_flight_ctrl,set_last_ping_result_flight_ctrl,"N/A")
// update rate: here we keep track of how often we get the "MAVLINK_MSG_ID_ATTITUDE" messages.
// (since it controlls the art. horizon). This is pretty much the only thing we perhaps need to manually set the update rate on
L_RO_PROP(float,curr_update_rate_mavlink_message_attitude,set_curr_update_rate_mavlink_message_attitude,-1)
Expand Down
18 changes: 9 additions & 9 deletions app/telemetry/models/wificard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@
static std::string wifi_card_type_to_string(const int card_type) {
switch (card_type) {
case 0:
return "RTL88X2AU";
return "88X2AU";
case 1:
return "RTL88X2BU";
return "88X2BU";
case 2:
return "RTL88X2CU";
return "88X2CU";
case 3:
return "RTL88X2EU";
return "88X2EU";
case 4:
return "ERR_RTL_88X2AU";
return "OPENHD_8852BU";
case 5:
return "ERR_RTL_88X2AU";
return "ERR_88X2AU";
case 6:
return "ERR_RTL_88X2BU";
return "ERR_88X2BU";
case 7:
return "ATHEROS";
case 8:
Expand All @@ -33,9 +33,9 @@ static std::string wifi_card_type_to_string(const int card_type) {
case 11:
return "BROADCOM";
case 12:
return "8852BU";
return "INTERNAL";
case 13:
return "EMULATED";
return "QUALCOMM";
default:
return "UNKNOWN";
}
Expand Down
2 changes: 1 addition & 1 deletion app/util/qopenhd.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class QOpenHD : public QObject
// Tries to mimic android toast as much as possible
//
Q_INVOKABLE void show_toast(QString message,bool long_toast=false);
L_RO_PROP(QString,version_string,set_version_string,"2.6.2-evo");
L_RO_PROP(QString,version_string,set_version_string,"2.6.3-evo");
//
// Shows a message popup to the user that needs to be clicked away - use sparingly
//
Expand Down
4 changes: 2 additions & 2 deletions qml/ui/configpopup/status/StatusCardBodyFC.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Column {

property bool m_is_alive: _fcMavlinkSystem.is_alive
function get_alive_text(){
return m_is_alive ? "Yes" : "NOT ALIVE !"
return m_is_alive ? "Yes" : "No"
}
function get_alive_text_color(){
//return m_is_alive ? "green" : "red"
Expand Down Expand Up @@ -48,7 +48,7 @@ Column {

StatusCardRow{
m_left_text: qsTr("SysID:")
m_right_text: _fcMavlinkSystem.for_osd_sys_id == -1 ? "na" : qsTr(""+_fcMavlinkSystem.for_osd_sys_id)
m_right_text: _fcMavlinkSystem.for_osd_sys_id == -1 ? "N/A" : qsTr(""+_fcMavlinkSystem.for_osd_sys_id)
}
// Padding
Item{
Expand Down
136 changes: 85 additions & 51 deletions qml/ui/configpopup/status/StatusCardBodyOpenHD.qml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ Column {
property var m_model: m_is_ground ? _ohdSystemGround : _ohdSystemAir

property string m_version: m_model.openhd_version
property string m_last_ping: m_model.last_ping_result_openhd
property bool m_is_alive: m_model.is_alive
property string m_qopenhd_version: _qopenhd.version_string

Expand Down Expand Up @@ -72,7 +71,7 @@ Column {
}

StatusCardRow{
m_left_text: qsTr("OHD Version:")
m_left_text: qsTr("Version:")
m_right_text: m_version
m_has_error: {
if(m_is_ground){
Expand All @@ -93,69 +92,99 @@ Column {
var text_warning= m_is_ground ? get_text_qopenhd_openhd_ground_version_mismatch() : get_text_openhd_air_ground_version_mismatch()
return text_warning;
}
m_look_shit_on_error: true
m_error_view: true
}
StatusCardRow{
m_left_text: qsTr("Ping:")
m_right_text: m_last_ping
m_right_text_color: m_last_ping === "N/A" ? "#DC143C" : "green"
}
StatusCardRow{
m_left_text: qsTr(m_is_ground ? "Link HW:" : "Link HW:")
StatusCardRow {
m_left_text: qsTr("Link:")

m_right_text: {
if(m_is_ground){
if(!_ohdSystemGround.is_alive){
return "N/A";
function pingToMsString(pingValue) {
var pingNum = parseFloat(pingValue)

// If it's not a number (NaN) or zero, return an empty string
if (isNaN(pingNum) || pingNum === 0) {
return ""
}
var alive_count=get_gnd_active_cards();
if(alive_count==0) return "WAITING";
if(alive_count==1) return _wifi_card_gnd0.card_type_as_string;
return ""+alive_count+"x ARRAY";
}else{
// On air, we always have only one card
if(! _wifi_card_air.alive){
return "N/A";

// Otherwise, convert to an integer (or leave as a string)
// e.g., rounding down to remove decimals
return Math.floor(pingNum).toString()
}

if (m_is_ground) {
if (!_ohdSystemGround.is_alive) {
return "N/A"
}
var alive_count = get_gnd_active_cards()
if (alive_count === 0) {
return "waiting"
}
if (alive_count === 1) {
return _wifi_card_gnd0.card_type_as_string
}
var pingStrGnd = pingToMsString(m_model.last_ping_result_openhd)
if (pingStrGnd !== "") {
return alive_count + "x array " + pingStrGnd + " ms"
} else {
return alive_count + "x array"
}
} else {
if (!_wifi_card_air.alive) {
return "n/a"
}
var pingStrAir = pingToMsString(m_model.last_ping_result_openhd)
var cardTypeStr = _wifi_card_air.card_type_as_string
if (pingStrAir !== "") {
return cardTypeStr + " " + pingStrAir + " ms"
} else {
return cardTypeStr
}
return _wifi_card_air.card_type_as_string
}
}

m_has_error: {
var show_message_card_unsupported=false;
if(m_is_ground){
if(_wifi_card_gnd0.alive && !_wifi_card_gnd0.card_type_supported){
show_message_card_unsupported=true;
var show_message_card_unsupported = false
if (m_is_ground) {
if (_wifi_card_gnd0.alive && !_wifi_card_gnd0.card_type_supported) {
show_message_card_unsupported = true
}
}else{
if(_wifi_card_air.alive && ! _wifi_card_air.card_type_supported){
show_message_card_unsupported=true;
} else {
if (_wifi_card_air.alive && !_wifi_card_air.card_type_supported) {
show_message_card_unsupported = true
}
}
return show_message_card_unsupported;
return show_message_card_unsupported
}

m_error_text: {
var message="Using unsupported card(s) has side effects like non-working frequency changes, no uplink gnd-air or bad range. Be warned !";
return message;
var message = "Using unsupported card(s) has side effects like non-working frequency changes, no uplink gnd-air or bad range. be warned !"
return message
}
m_look_shit_on_error: true;

m_error_view: true
}
// StatusCardRow{
// visible: m_is_ground
// m_left_text: "Uplink:"
// m_right_text: {
// return gnd_uplink_state_text()
// }
// m_has_error: {
// return m_right_text=="ERROR"
// }
// m_error_text: {
// var message="Looks like your uplink (GND to AIR) is not functional - please use a supported card on your GND station"+
// " and make sure passive (listen only) mode is disabled on your ground station."
// return message;
// }
// }
StatusCardRow{
visible: m_is_ground
m_left_text: "Uplink:"
m_right_text: {
return gnd_uplink_state_text()
}
m_has_error: {
return m_right_text=="ERROR"
}
m_error_text: {
var message="Looks like your uplink (GND to AIR) is not functional - please use a supported card on your GND station"+
" and make sure passive (listen only) mode is disabled on your ground station."
return message;
}
m_left_text: "Hidden:"
m_right_text: "No"
}
StatusCardRow{
visible: !m_is_ground
m_left_text: "FC SYSID:"
m_left_text: "SysId:"
m_right_text: {
var air_fc_sys_id=_ohdSystemAir.air_reported_fc_sys_id;
if(air_fc_sys_id==-1){
Expand All @@ -182,7 +211,7 @@ Column {
if(air_fc_sys_id==0 || air_fc_sys_id==1)return false;
return true;
}
m_look_shit_on_error: true;
m_error_view: true;
}
StatusCardRow{
m_left_text: "WiFi HS:"
Expand Down Expand Up @@ -222,17 +251,22 @@ Column {
}
StatusCardRow{
visible: m_is_ground;
m_left_text: "EXTERNAL DEVICES:"
m_left_text: "Shared:"
m_right_text: {
if(_ohdSystemGround.external_devices_count<0){
return "N/A";
return "No";
}
if(_ohdSystemGround.external_devices_count==0){
return "NONE";
return "Yes";
}
return _ohdSystemGround.external_devices_count+"x";
}
}
StatusCardRow{
visible: false;
m_left_text: "Licence:"
m_right_text: "Community"
}

// Padding
Item{
Expand Down
12 changes: 5 additions & 7 deletions qml/ui/configpopup/status/StatusCardRow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ Item {

property string m_error_text: "NONE"

// If this is set to true, the UI looks intentionally shit
// because it is an error that should be resolved by the user
// as quick as possible
property bool m_look_shit_on_error: false
property bool m_error_view: false

// For debugging
/*Rectangle{
Expand Down Expand Up @@ -100,7 +97,7 @@ Item {
padding: 4
}
MouseArea {
enabled: m_has_error && !m_look_shit_on_error
enabled: m_has_error && !m_error_view
anchors.fill: parent
onClicked: {
_messageBoxInstance.set_text_and_show(m_error_text)
Expand All @@ -111,6 +108,7 @@ Item {
width: parent.width-left_part.width
height: parent.height
anchors.left: left_part.right
anchors.leftMargin: -10
anchors.top: left_part.top
text: m_right_text
background: Rectangle {
Expand All @@ -119,11 +117,11 @@ Item {
anchors.left: parent.left
anchors.leftMargin: 5
opacity: .3
color: right_part_button.hovered ? "lightgrey" : "transparent" // Only look shit when hovered
color: right_part_button.hovered ? "lightgrey" : "transparent"
}
//Material.accent: Material.Red
//highlighted: true
visible: m_has_error && m_look_shit_on_error
visible: m_has_error && m_error_view
onClicked: {
_messageBoxInstance.set_text_and_show(m_error_text)
}
Expand Down
3 changes: 1 addition & 2 deletions qml/ui/elements/BigClickableText.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import OpenHD 1.0


// Element for showing the user a (big) settings text that should be clicked to be edited
// Big buttons look shit, so we have this alternative
Button{
id: button
width:180
Expand All @@ -22,7 +21,7 @@ Button{
anchors.left: parent.left
anchors.leftMargin: 1
opacity: 1.0
color: button.hovered ? "lightgrey" : "transparent" // Only look shit when hovered
color: button.hovered ? "lightgrey" : "transparent"
}

}
2 changes: 1 addition & 1 deletion qml/ui/elements/SimpleLeftRightText.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Item {
Text {
text: m_right_text
color: m_right_text_color;
font.bold: true;
font.bold: false;
height: parent.height
font.pixelSize: detailPanelFontPixels;
anchors.right: parent.right
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/sidebar/Panel7Status.qml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ SideBarBasePanel {
Layout.alignment: Qt.AlignHCenter
override_text_left: "Chipset AIR:"
override_color_right: _ohdSystemAir.is_alive ? "#20b383" : "#df4c7c"
override_text_right: _ohdSystemAir.is_alive ? _ohdSystemAir.card_type_as_string : "Not connected"
// override_text_right: _ohdSystemAir.is_alive ? _ohdSystemAir.card_type_as_string : "Not connected"
}
InfoElement2 {
Layout.alignment: Qt.AlignHCenter
Expand Down

0 comments on commit 6f1c5dd

Please sign in to comment.