diff --git a/custom-example/res/Custom/Widgets/CustomVehicleButton.qml b/custom-example/res/Custom/Widgets/CustomVehicleButton.qml index bc1d9609e7a..698d1be011a 100644 --- a/custom-example/res/Custom/Widgets/CustomVehicleButton.qml +++ b/custom-example/res/Custom/Widgets/CustomVehicleButton.qml @@ -61,7 +61,7 @@ Button { width: height sourceSize.height: parent.height fillMode: Image.PreserveAspectFit - color: qgcPal.buttonText + color: button.checked ? qgcPal.buttonHighlightText : qgcPal.buttonText source: "/qmlimages/PaperPlane.svg" anchors.verticalCenter: parent.verticalCenter } @@ -71,13 +71,13 @@ Button { QGCLabel { text: qsTr("Vehicle ") + (vehicle ? vehicle.id : qsTr("None")) font.family: ScreenTools.demiboldFontFamily - color: qgcPal.buttonText + color: button.checked ? qgcPal.buttonHighlightText : qgcPal.buttonText } Row { spacing: ScreenTools.defaultFontPixelWidth QGCLabel { text: vehicle ? vehicle.flightMode : qsTr("None") - color: qgcPal.buttonText + color: button.checked ? qgcPal.buttonHighlightText : qgcPal.buttonText } Rectangle { height: ScreenTools.defaultFontPixelHeight * 0.5 diff --git a/custom-example/res/CustomFlyView.qml b/custom-example/res/CustomFlyView.qml index 80ec26b83ac..936159cd715 100644 --- a/custom-example/res/CustomFlyView.qml +++ b/custom-example/res/CustomFlyView.qml @@ -491,7 +491,7 @@ Item { id: multiVehicleSelector spacing: ScreenTools.defaultFontPixelWidth anchors.bottom: parent.bottom - anchors.bottomMargin: ScreenTools.defaultFontPixelWidth + anchors.bottomMargin: ScreenTools.defaultFontPixelWidth * 1.5 anchors.right: parent.right anchors.rightMargin: ScreenTools.defaultFontPixelWidth visible: QGroundControl.multiVehicleManager.vehicles.count > 1 @@ -501,6 +501,9 @@ Item { property var _vehicle: QGroundControl.multiVehicleManager.vehicles.get(modelData) vehicle: _vehicle checked: (_vehicle && activeVehicle) ? _vehicle.id === activeVehicle.id : false + onClicked: { + QGroundControl.multiVehicleManager.activeVehicle = _vehicle + } } } } diff --git a/custom-example/src/CustomPlugin.cc b/custom-example/src/CustomPlugin.cc index 7d70631411a..d09e09f68a8 100644 --- a/custom-example/src/CustomPlugin.cc +++ b/custom-example/src/CustomPlugin.cc @@ -281,7 +281,7 @@ CustomPlugin::paletteOverride(QString colorName, QGCPalette::PaletteColorInfo_t& colorInfo[QGCPalette::Light][QGCPalette::ColorGroupDisabled] = QColor("#9d9d9d"); } else if (colorName == QStringLiteral("buttonHighlight")) { - colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#6EF880"); + colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#F3BC5E"); colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupDisabled] = QColor("#222a35"); colorInfo[QGCPalette::Light][QGCPalette::ColorGroupEnabled] = QColor("#edcfb4"); colorInfo[QGCPalette::Light][QGCPalette::ColorGroupDisabled] = QColor("#e4e4e4"); @@ -299,9 +299,9 @@ CustomPlugin::paletteOverride(QString colorName, QGCPalette::PaletteColorInfo_t& colorInfo[QGCPalette::Light][QGCPalette::ColorGroupDisabled] = QColor("#585858"); } else if (colorName == QStringLiteral("primaryButtonText")) { - colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#ffffff"); + colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#29313A"); colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupDisabled] = QColor("#777c89"); - colorInfo[QGCPalette::Light][QGCPalette::ColorGroupEnabled] = QColor("#ffffff"); + colorInfo[QGCPalette::Light][QGCPalette::ColorGroupEnabled] = QColor("#29313A"); colorInfo[QGCPalette::Light][QGCPalette::ColorGroupDisabled] = QColor("#cad0d0"); } else if (colorName == QStringLiteral("textField")) { diff --git a/src/comm/MockLink.cc b/src/comm/MockLink.cc index f75e8ade47d..c5dfffd891f 100644 --- a/src/comm/MockLink.cc +++ b/src/comm/MockLink.cc @@ -104,6 +104,7 @@ MockLink::MockLink(SharedLinkConfigurationPointer& config) _adsbVehicleCoordinate = QGeoCoordinate(_vehicleLatitude, _vehicleLongitude).atDistanceAndAzimuth(1000, _adsbAngle); _adsbVehicleCoordinate.setAltitude(100); + _runningTime.start(); } MockLink::~MockLink(void) @@ -176,6 +177,7 @@ void MockLink::_run1HzTasks(void) _sendHighLatency2(); } else { _sendVibration(); + _sendSysStatus(); _sendADSBVehicles(); if (!qgcApp()->runningUnitTests()) { // Sending RC Channels during unit test breaks RC tests which does it's own RC simulation @@ -357,6 +359,28 @@ void MockLink::_sendHighLatency2(void) respondWithMavlinkMessage(msg); } +void MockLink::_sendSysStatus(void) +{ + if(_batteryRemaining > 50) { + _batteryRemaining = static_cast(100 - (_runningTime.elapsed() / 1000)); + } + mavlink_message_t msg; + mavlink_msg_sys_status_pack_chan( + _vehicleSystemId, + _vehicleComponentId, + static_cast(_mavlinkChannel), + &msg, + 0, // onboard_control_sensors_present + 0, // onboard_control_sensors_enabled + 0, // onboard_control_sensors_health + 250, // load + 4200 * 4, // voltage_battery + 8000, // current_battery + _batteryRemaining, // battery_remaining + 0,0,0,0,0,0); + respondWithMavlinkMessage(msg); +} + void MockLink::_sendVibration(void) { mavlink_message_t msg; diff --git a/src/comm/MockLink.h b/src/comm/MockLink.h index 0d3bee32345..a8186866d34 100644 --- a/src/comm/MockLink.h +++ b/src/comm/MockLink.h @@ -196,6 +196,7 @@ private slots: void _sendHomePosition(void); void _sendGpsRawInt(void); void _sendVibration(void); + void _sendSysStatus(void); void _sendStatusTextMessages(void); void _respondWithAutopilotVersion(void); void _sendRCChannels(void); @@ -226,6 +227,9 @@ private slots: uint32_t _mavCustomMode; uint8_t _mavState; + QTime _runningTime; + int8_t _batteryRemaining = 100; + MAV_AUTOPILOT _firmwareType; MAV_TYPE _vehicleType; double _vehicleLatitude;