Skip to content

Commit

Permalink
hide battery monitoring if no battery is available (#705)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelscholle committed Jun 15, 2024
1 parent 46cc915 commit 92e5b3e
Show file tree
Hide file tree
Showing 50 changed files with 64 additions and 47 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ build-*
*.so.*
*.dll
*.dylib
.qtc_clangd

# Qt-es
object_script.*.Release
Expand Down
2 changes: 2 additions & 0 deletions QOpenHD.pro
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ BASEDIR = $$IN_PWD
LANGUAGE = C++
CONFIG += c++17
CONFIG+=sdk_no_version_check
CONFIG += resources_big

TRANSLATIONS = translations/QOpenHD_en.ts \
translations/QOpenHD_de.ts \
translations/QOpenHD_ru.ts \
Expand Down
15 changes: 14 additions & 1 deletion qml/ui/configpopup/qopenhd_settings/AppWidgetSettingsView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,23 @@ ScrollView {
}
}*/


SettingsCategory{
m_description: "OHD LINK / STREAMING WIDGETS"

SettingBaseElement{
m_short_description: "Show Widgets"
Switch {
width: 32
height: elementHeight
anchors.rightMargin: Qt.inputMethod.visible ? 96 : 36

anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
checked: settings.show_widgets
onCheckedChanged: settings.show_widgets = checked
}
}

SettingBaseElement{
m_short_description: "Show Downlink RSSI"
m_long_description: "RSSI / Stats about downlink"
Expand Down
1 change: 1 addition & 0 deletions qml/ui/elements/AppSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ Settings {
// Note that low fps like on embedded devices also adds some latency - because of that, default to 100ms here
property int smoothing: 33

property bool show_widgets: true
property bool show_downlink_rssi: true
//Const10
property bool downlink_show_dbm_and_packets_per_card: true
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/AirBatteryWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ BaseWidget {
width: 96
height: 55

visible: settings.show_air_battery
visible: settings.show_air_battery && settings.show_widgets

widgetIdentifier: "air_battery_widget"
bw_verbose_name: "AIR BATTERY (FC)"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/AirspeedTempWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ BaseWidget {
width: 30
height: 30

visible: settings.show_airspeed_temp
visible: settings.show_airspeed_temp && settings.show_widgets

widgetIdentifier: "airspeed_temp_widget"
bw_verbose_name: "AIRSPEED SENSOR TEMP"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/AltitudeSecondWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ BaseWidget {
defaultYOffset: 64
dragging: false

visible: settings.show_altitude_second
visible: settings.show_altitude_second && settings.show_widgets

widgetIdentifier: "altitude_second_widget"
bw_verbose_name: "SECOND ALTITUDE"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/AltitudeWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ BaseWidget {
defaultXOffset: 40
defaultVCenter: true

visible: settings.altitude_ladder_show
visible: settings.altitude_ladder_show && settings.show_widgets

widgetIdentifier: "altitude_widget"
bw_verbose_name: "ALTITUDE"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/AoaWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ BaseWidget {
defaultXOffset: 60
defaultVCenter: true

visible: settings.show_aoa
visible: settings.show_aoa && settings.show_widgets

widgetIdentifier: "aoa_widget"
bw_verbose_name: "ANGLE OF ATTACK"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/ArrowWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ BaseWidget {
height: 48
defaultYOffset: 135

visible: settings.show_arrow
visible: settings.show_arrow && settings.show_widgets

widgetIdentifier: "arrow_widget"
bw_verbose_name: "HOME ARROW"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/ControlWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ BaseWidget {
width: 100
height: 50

visible: settings.show_control
visible: settings.show_control && settings.show_widgets

widgetIdentifier: "control_widget"
bw_verbose_name: "CONTROL INPUTS"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/DevStreamingInfo.qml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Item {
anchors.top: parent.top
anchors.left: parent.left
anchors.topMargin: 100
visible: settings.show_dev_stats_overlay && !sidebar.m_extra_is_visible
visible: settings.show_dev_stats_overlay && !sidebar.m_extra_is_visible && settings.show_widgets

Column{
width: parent.width
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/DistanceSensorWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ BaseWidget {
defaultYOffset: 128+40
dragging: false

visible: settings.show_distance_sensor_widget
visible: settings.show_distance_sensor_widget && settings.show_widgets

widgetIdentifier: "distance_sensor_widget"
bw_verbose_name: "DISTANCE SENSOR"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/EscTempWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ BaseWidget {
width: 30
height: 30

visible: settings.show_esc_temp
visible: settings.show_esc_temp && settings.show_widgets

widgetIdentifier: "esc_temp_widget"
bw_verbose_name: "EST TEMPERATURE"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/ExampleWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ BaseWidget {

visible: settings.show_example_widget

widgetIdentifier: "example_widget"
widgetIdentifier: "example_widget" && settings.show_widgets

defaultAlignment: 0
defaultXOffset: 92
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/FlightDistanceWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ BaseWidget {
width: 96
height: 24

visible: settings.show_flight_distance
visible: settings.show_flight_distance && settings.show_widgets

widgetIdentifier: "flight_distance_widget"
bw_verbose_name: "TOTAL FLIGHT DISTANCE"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/FlightMahKmWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ BaseWidget {
width: 130
height: 24

visible: settings.show_flight_mah_km
visible: settings.show_flight_mah_km && settings.show_widgets

widgetIdentifier: "flight_mah_km_widget"
bw_verbose_name: "EFFICIENCY IN MAH/KM"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/FlightMahWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ BaseWidget {
width: 96
height: 24

visible: settings.show_flight_mah
visible: settings.show_flight_mah && settings.show_widgets

widgetIdentifier: "flight_mah_widget"
bw_verbose_name: "MAH (FC CONSUMED)"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/FlightModeWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ BaseWidget {
width: 212
height: 48

visible: settings.show_flight_mode
visible: settings.show_flight_mode && settings.show_widgets

widgetIdentifier: "flight_mode_widget"
bw_verbose_name: "FLIGHT MODE"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/FlightTimeWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ BaseWidget {
width: 96
height: 24

visible: settings.show_flight_time
visible: settings.show_flight_time && settings.show_widgets

widgetIdentifier: "flight_time_widget"
bw_verbose_name: "FLIGHT TIME"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/FpvWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ BaseWidget {
width: 50
height: 55

visible: settings.show_flight_path_vector
visible: settings.show_flight_path_vector && settings.show_widgets

widgetIdentifier: "fpv_widget"
bw_verbose_name: "FLIGHT PATH VECTOR"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/GPIOWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ BaseWidget {
width: 64
height: 64

visible: settings.show_gpio
visible: settings.show_gpio && settings.show_widgets

widgetIdentifier: "gpio_widget"

Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/GPSWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ BaseWidget {
width: 96
height: 24

visible: settings.show_gps
visible: settings.show_gps && settings.show_widgets

widgetIdentifier: "gps_widget"
bw_verbose_name: "GPS WIDGET"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/GroundPowerWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ BaseWidget {
width: 96
height: 55

visible: settings.show_ground_battery
visible: settings.show_ground_battery && settings.show_widgets && _ohdSystemGround.ina219_current_milliamps !== -1

widgetIdentifier: "ground_battery_widget"
bw_verbose_name: "GROUND BATTERY"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/HeadingWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ BaseWidget {
width: 48
height: 48

visible: settings.show_heading
visible: settings.show_heading && settings.show_widgets

defaultYOffset: 50

Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/HomeDistanceWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ BaseWidget {
width: 96
height: 24

visible: settings.show_home_distance
visible: settings.show_home_distance && settings.show_widgets

widgetIdentifier: "home_distance_widget"
bw_verbose_name: "HOME DISTANCE"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/HorizonWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ BaseWidget {
width: 250
height: 48

visible: settings.show_horizon
visible: settings.show_horizon && settings.show_widgets

widgetIdentifier: "horizon_widget"
bw_verbose_name: "ARTIFICIAL HORIZON"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/ImuTempWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ BaseWidget {
width: 30
height: 30

visible: settings.show_imu_temp
visible: settings.show_imu_temp && settings.show_widgets

widgetIdentifier: "imu_temp_widget"
bw_verbose_name: "IMU TEMPERATURE"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/LinkDownRSSIWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ BaseWidget {
width: 112
height: 48

visible: settings.show_downlink_rssi
visible: settings.show_downlink_rssi && settings.show_widgets

widgetIdentifier: "downlink_rssi_widget"
bw_verbose_name: "DOWNLINK/GND RSSI"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/LinkUpRSSIWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ BaseWidget {
width: 112
height: 48

visible: settings.show_uplink_rssi
visible: settings.show_uplink_rssi && settings.show_widgets

widgetIdentifier: "uplink_rssi_widget"
bw_verbose_name: "UPLINK/AIR RSSI"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/MessageHUD.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ BaseWidget {
width: 480
height: 5*25 // Up to 5 simultaneous messages

visible: settings.show_message_hud
visible: settings.show_message_hud && settings.show_widgets

widgetIdentifier: "message_hud_widget"

Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/MissionWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ BaseWidget {
width: 96
height: 25

visible: settings.show_mission
visible: settings.show_mission && settings.show_widgets

widgetIdentifier: "mission_widget"
bw_verbose_name: "MISSIONS"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/PerformanceHorizonWidget2.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ BaseWidget {
width: 250
height: 48

visible: settings.show_performance_horizon
visible: settings.show_performance_horizon && settings.show_widgets

widgetIdentifier: "horizon_performance2"
bw_verbose_name: "ARTIFICIAL HORIZON 2"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/PressTempWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ BaseWidget {
width: 30
height: 30

visible: settings.show_press_temp
visible: settings.show_press_temp && settings.show_widgets

widgetIdentifier: "press_temp_widget"
bw_verbose_name: "PREASSURE SENSOR TEMP"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/QRenderStatsWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ BaseWidget {
width: 50
height: 48

visible: settings.qrenderstats_show
visible: settings.qrenderstats_show && settings.show_widgets

widgetIdentifier: "q_render_stats_widget"

Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/RCRssiWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ BaseWidget {
width: 50
height: 30

visible: settings.show_rc_rssi
visible: settings.show_rc_rssi && settings.show_widgets

widgetIdentifier: "rc_rssi_widget"
bw_verbose_name: "RC RSSI"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/RollWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ BaseWidget {
width: 100
height: 30

visible: settings.bank_angle_indicator_widget_show
visible: settings.bank_angle_indicator_widget_show && settings.show_widgets

widgetIdentifier: "roll_widget"
bw_verbose_name: "BANK ANGLE INDICATOR"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/SOCStatusWidgetAir.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SOCStatusWidgetGeneric {
width: 112
height: 24

visible: settings.show_air_status
visible: settings.show_air_status && settings.show_widgets

defaultAlignment: 1
defaultXOffset: 128
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/SOCStatusWidgetGeneric.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ BaseWidget {
width: 112
height: 24

visible: settings.show_air_status
visible: settings.show_air_status && settings.show_widgets

widgetIdentifier: "air_status_widget"
bw_verbose_name: "CPU LOAD AIR"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/SOCStatusWidgetGround.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SOCStatusWidgetGeneric {
width: 112
height: 24

visible: settings.show_ground_status
visible: settings.show_ground_status && settings.show_widgets

defaultAlignment: 1
defaultXOffset: 128
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/SpeedSecondWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ BaseWidget {
defaultYOffset: 128
dragging: false

visible: settings.show_speed_second && !sidebar.m_is_active
visible: settings.show_speed_second && !sidebar.m_is_active && settings.show_widgets

widgetIdentifier: "speed_second_widget"
bw_verbose_name: "SECOND SPEED"
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/SpeedWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ BaseWidget {
width: 64
height: 24

visible: settings.speed_ladder_show && !sidebar.m_is_active
visible: settings.speed_ladder_show && !sidebar.m_is_active && settings.show_widgets

defaultXOffset: 20
defaultVCenter: true
Expand Down
Loading

0 comments on commit 92e5b3e

Please sign in to comment.