Skip to content

Commit

Permalink
add version mismatch button(s)
Browse files Browse the repository at this point in the history
  • Loading branch information
Consti10 committed Sep 19, 2023
1 parent 65c98d9 commit 91d3531
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 22 deletions.
6 changes: 5 additions & 1 deletion app/telemetry/models/wificard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ static QString card_driver_type_as_string(int type){
WiFiCard::WiFiCard(bool is_air,int card_idx,QObject *parent)
: QObject{parent},m_is_air_card(is_air),m_card_idx(card_idx)
{

}


WiFiCard &WiFiCard::instance_gnd(int index)
{
if(index==0){
Expand Down Expand Up @@ -94,6 +94,10 @@ void WiFiCard::process_mavlink(const mavlink_openhd_stats_monitor_mode_wifi_card
}
set_card_type(msg.card_type);
set_card_type_as_string(card_driver_type_as_string(msg.card_type));
const int card_type=msg.card_type;
bool supported = false;
if(card_type==1 || card_type==3)supported=true;
set_card_type_supported(supported);
}

int WiFiCard::helper_get_gnd_curr_best_rssi()
Expand Down
1 change: 1 addition & 0 deletions app/telemetry/models/wificard.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class WiFiCard : public QObject
//
L_RO_PROP(int,card_type,set_card_type,-1) // -1 = no info available yet, otherwise, openhd card type (0..?)
L_RO_PROP(QString,card_type_as_string,set_card_type_as_string,"N/A")
L_RO_PROP(int,card_type_supported,set_card_type_supported,false)
public:
explicit WiFiCard(bool is_air,int card_idx,QObject *parent = nullptr);
static constexpr int N_CARDS=4;
Expand Down
1 change: 1 addition & 0 deletions qml/qml.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -251,5 +251,6 @@
<file>ui/configpopup/openhd_settings/FreqComboBoxRow.qml</file>
<file>ui/configpopup/status/QOpenHDVersionCard.qml</file>
<file>ui/elements/CardToast.qml</file>
<file>ui/elements/ButtonYellow.qml</file>
</qresource>
</RCC>
8 changes: 5 additions & 3 deletions qml/ui/configpopup/openhd_settings/MavlinkParamEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ Rectangle{
color: "white"
font.bold: true
font.pixelSize: 18
horizontalAlignment: Qt.AlignCenter
horizontalAlignment: Qt.AlignHCenter
Layout.alignment: Qt.AlignCenter
}

Expand All @@ -291,8 +291,8 @@ Rectangle{
font.pixelSize: 12
text: qsTr(parameterId+" "+get_param_type_readable())
color: "white"
horizontalAlignment: Qt.AlignCenter
// dafuq https://stackoverflow.com/questions/35799944/text-type-alignment
horizontalAlignment: Qt.AlignHCenter
Layout.alignment: Qt.AlignCenter
}
Button {
Expand Down Expand Up @@ -452,10 +452,12 @@ Rectangle{
if(instanceMavlinkSettingsModel.get_param_requires_manual_reboot(parameterId)){
_messageBoxInstance.set_text_and_show("Please reboot to apply")
}
var argh=paramValueType==0 ? (""+value_int) : (""+value_string);
parameterEditor.visible=false
_qopenhd.show_toast("Set "+parameterId+" to ["+argh+"]");
}else{
console.log("Update failed")
_messageBoxInstance.set_text_and_show(res);
_qopenhd.show_toast(res,true);
}
set_description_enabled(false)
}
Expand Down
4 changes: 2 additions & 2 deletions qml/ui/configpopup/openhd_settings/MavlinkParamPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ Rectangle {
Text {
anchors.verticalCenter: parent.verticalCenter
//font.pixelSize: 20
width:150
width:160
text: model.unique_id
font.bold: true
//color: settings.screen_settings_openhd_parameters_transparent ? "green" : "black"
Expand All @@ -135,7 +135,7 @@ Rectangle {
styleColor: settings.color_glow
}
Text {
width:150
width:160
//font.pixelSize: 20
text: model.extraValue
font.bold: true
Expand Down
2 changes: 2 additions & 0 deletions qml/ui/configpopup/status/PanelStatus.qml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ Rectangle {
width: parent.width
height: parent.height
contentHeight: mainItem.height
//contentWidth: mainItem.width
clip: true
//ScrollBar.vertical.policy: ScrollBar.AlwaysOn
ScrollBar.vertical.interactive: true

Item {
id: mainItem
//width: 1024
width: parent.width
height: 500

Expand Down
71 changes: 57 additions & 14 deletions qml/ui/configpopup/status/StatusCardBodyOpenHD.qml
Original file line number Diff line number Diff line change
Expand Up @@ -73,28 +73,24 @@ ColumnLayout {
"\nPlease update QOpenHD / your Ground station.";
return ret;
}
function get_show_warning_qopenhd_openhd_ground_version_mismatch(){
if(m_version==="N/A")return false;
if(m_version!==m_qopenhd_version)return true;
return false;
function get_text_openhd_air_ground_version_mismatch(){
var ret="Your version of OpenHD AIR ["+m_qopenhd_version+"] is incompatible with OpenHD GROUND: ["+_ohdSystemGround.openhd_version+"]"+
"\nPlease update your AIR / GROUND unit.";
return ret;
}

property int text_minHeight: 30
property int column_preferred_height: 50

property int left_part_preferred_with: 120
property int left_part_preferred_with: 100

RowLayout{
Layout.fillWidth: true
Layout.minimumHeight: text_minHeight
spacing: 6
Text {
Layout.preferredWidth: left_part_preferred_with
text: qsTr("OpenHD Version:")
}
Text {
text: m_version
visible: !(m_version==="N/A")
text: qsTr("OHD Version:")
}
Button{
text: "N/A"
Expand All @@ -104,11 +100,32 @@ ColumnLayout {
Layout.minimumHeight: text_minHeight
height: text_minHeight
}
ButtonIconWarning{
Text {
text: m_version
visible: !(m_version==="N/A") && !b_version_warning.visible
}
ButtonYellow{
text: m_version
id: b_version_warning
onClicked: {
_messageBoxInstance.set_text_and_show(get_text_qopenhd_openhd_ground_version_mismatch())
var text_warning= m_is_ground ? get_text_qopenhd_openhd_ground_version_mismatch() : get_text_openhd_air_ground_version_mismatch()
_messageBoxInstance.set_text_and_show(text_warning)
}
visible: {
if(m_is_ground){
// Show if ground reported version is valid and there is a mismatch OpenHD ground / QOpenHD
if(_ohdSystemGround.openhd_version=="N/A"){
return false;
}
return _ohdSystemGround.openhd_version != m_qopenhd_version;
}else{
// Show if ground and air reported version is valid and there is a mismatch
if(_ohdSystemGround.openhd_version=="N/A" || _ohdSystemAir.openhd_version=="N/A"){
return false;
}
return _ohdSystemGround.openhd_version != _ohdSystemAir.openhd_version
}
}
visible: m_is_ground && get_show_warning_qopenhd_openhd_ground_version_mismatch()
Layout.preferredHeight: text_minHeight
Layout.minimumHeight: text_minHeight
height: text_minHeight
Expand Down Expand Up @@ -149,6 +166,31 @@ ColumnLayout {
}
Text {
text: get_cards_text()
visible: !b_unsupported_cards_warning.visible
}
ButtonYellow{
id: b_unsupported_cards_warning
text: get_cards_text()
onClicked: {
var message="Using unsupported card(s) has side effects like non-working frequency changes, no uplink gnd-air or bad range. Be warned !";
_messageBoxInstance.set_text_and_show(message);
}
visible: {
if(m_is_ground){
if(_wifi_card_gnd0.alive && !_wifi_card_gnd0.card_type_supported)return true;
if(_wifi_card_gnd1.alive && !_wifi_card_gnd1.card_type_supported)return true;
if(_wifi_card_gnd2.alive && !_wifi_card_gnd2.card_type_supported)return true;
if(_wifi_card_gnd3.alive && !_wifi_card_gnd3.card_type_supported)return true;
return false;
}
// On air, there is nonly one card´
if(_wifi_card_air.alive && !_wifi_card_air.card_type_supported){
return true;
}
return false;
}
Layout.preferredHeight: text_minHeight
Layout.minimumHeight: text_minHeight
}
}
RowLayout{
Expand All @@ -168,7 +210,8 @@ ColumnLayout {
return false;
}
}
ButtonIconWarning{
ButtonYellow{
text: gnd_uplink_state_text()
onClicked: {
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."
Expand Down
2 changes: 0 additions & 2 deletions qml/ui/elements/ButtonIconWarning.qml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import QtQuick.Controls.Material 2.12
// Used to hint at something's wrong -
// Warning icon and yellow color
Button {
//text: "INFO"
text: "\uf071"
font.family: "Font Awesome 5 Free"
Material.background:Material.Lime
//highlighted: true
}
9 changes: 9 additions & 0 deletions qml/ui/elements/ButtonYellow.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Dialogs 1.0
import QtQuick.Controls.Material 2.12

// Yellow (Lime) background
Button {
Material.background:Material.Lime
}

0 comments on commit 91d3531

Please sign in to comment.