Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RC PWM joystick buttons override #10431

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
4 changes: 2 additions & 2 deletions CodingStyle.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
* (c) 2009-2022 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
Expand Down Expand Up @@ -31,7 +31,7 @@ Q_DECLARE_LOGGING_CATEGORY(CodingStyleLog)

/// Here is the class documentation. Class names are PascalCase. If you override any of the Qt base classes to provide
/// generic base implementations for widespread use prefix the class name with QGC. For example:
/// QGCMessageBox - is a QGC special vesion of Qt MessageBox
/// QGCMessageBox - is a QGC special version of Qt MessageBox
/// QGCPalette - is a QGC special version of Qt Palette
/// For normal single use classes do no prefix them name with QGC.

Expand Down
42 changes: 42 additions & 0 deletions custom-example/custom.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
message(STATUS "Adding Custom Plugin")

# you can disable usb camera
set(QGC_DISABLE_UVC OFF)

# disable video streaming
set(DISABLE_VIDEOSTREAMING OFF)
# disable video streaming
set(QGC_DISABLE_MAVLINK_INSPECTOR OFF )

# disable airmap
set(DISABLE_AIRMAP OFF)

# disable Ardupilot mavlink dialect
set(QGC_DISABLE_APM_MAVLINK ON)
# disable Ardupilot firmware plugin
set(QGC_DISABLE_APM_PLUGIN ON)
# disable PX4 firmware plugin
# set(QGC_DISABLE_PX4_PLUGIN ON)
# disable Ardupilot firmware plugin factory
set(QGC_DISABLE_APM_PLUGIN_FACTORY ON)
# disable PX4 firmware plugin factory
set(QGC_DISABLE_PX4_PLUGIN_FACTORY ON)

set(CUSTOMCLASS "CustomPlugin")
set(CUSTOMHEADER \"CustomPlugin.h\")

set(CUSTOM_SRC_PATH ${CMAKE_CURRENT_SOURCE_DIR}/custom/src)

include_directories(${CUSTOM_SRC_PATH})
include_directories(${CUSTOM_SRC_PATH}/FirmwarePlugin)
include_directories(${CUSTOM_SRC_PATH}/AutoPilotPlugin)

set(CUSTOM_SRC
${CUSTOM_SRC_PATH}/CustomPlugin.cc
${CUSTOM_SRC_PATH}/AutoPilotPlugin/CustomAutoPilotPlugin.cc
${CUSTOM_SRC_PATH}/FirmwarePlugin/CustomFirmwarePlugin.cc
${CUSTOM_SRC_PATH}/FirmwarePlugin/CustomFirmwarePluginFactory.cc
)


set(CUSTOM_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/custom/custom.qrc)
5 changes: 4 additions & 1 deletion qgroundcontrol.pro
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ iOSBuild {
# disable both the Plugin and PluginFactory entries. To include custom support
# for an existing plugin type disable PluginFactory only. Then provide you own
# implementation of FirmwarePluginFactory and use the FirmwarePlugin and
# AutoPilotPlugin classes as the base clase for your derived plugin
# AutoPilotPlugin classes as the base class for your derived plugin
# implementation.

contains (CONFIG, QGC_DISABLE_APM_PLUGIN) {
Expand Down Expand Up @@ -1376,6 +1376,9 @@ contains (CONFIG, DISABLE_VIDEOSTREAMING) {
}

!VideoEnabled {
# TODO bzd here propably should go:
# DEFINES -= QGC_GST_STREAMING

INCLUDEPATH += \
src/VideoReceiver

Expand Down
2 changes: 1 addition & 1 deletion qgroundcontrol.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
<file alias="QGroundControl/Controls/TerrainStatus.qml">src/PlanView/TerrainStatus.qml</file>
<file alias="QGroundControl/Controls/TakeoffItemMapVisual.qml">src/PlanView/TakeoffItemMapVisual.qml</file>
<file alias="QGroundControl/Controls/ToolStrip.qml">src/QmlControls/ToolStrip.qml</file>
<file alias="QGroundControl/Controls/ToolStripHoverButton.qml">src/QmlControls/ToolStripHoverButton.qml</file>
<file alias="QGroundControl/Controls/ToolStripHoverButton.qml">src/QmlControls/ToolStripHoverButton.qml</file>
<file alias="QGroundControl/Controls/TransectStyleComplexItemEditor.qml">src/PlanView/TransectStyleComplexItemEditor.qml</file>
<file alias="QGroundControl/Controls/TransectStyleComplexItemStats.qml">src/PlanView/TransectStyleComplexItemStats.qml</file>
<file alias="QGroundControl/Controls/TransectStyleComplexItemTabBar.qml">src/PlanView/TransectStyleComplexItemTabBar.qml</file>
Expand Down
14 changes: 11 additions & 3 deletions src/AnalyzeView/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ if(BUILD_TESTING)
)
endif()

if (NOT QGC_DISABLE_MAVLINK_INSPECTOR)
set(MAVLINK_INSPECTOR_SRC
MAVLinkInspectorController.cc
MAVLinkInspectorController.h
)
set(MAVLINK_INSPECTOR_QML
MAVLinkInspectorPage.qml)
endif()

add_library(AnalyzeView
ExifParser.cc
ExifParser.h
Expand All @@ -16,8 +25,7 @@ add_library(AnalyzeView
LogDownloadController.h
MavlinkConsoleController.cc
MavlinkConsoleController.h
MAVLinkInspectorController.cc
MAVLinkInspectorController.h
${MAVLINK_INSPECTOR_SRC}
PX4LogParser.cc
PX4LogParser.h
ULogParser.cc
Expand All @@ -33,7 +41,7 @@ add_custom_target(AnalyzeViewQml
GeoTagPage.qml
LogDownloadPage.qml
MavlinkConsolePage.qml
MAVLinkInspectorPage.qml
${MAVLINK_INSPECTOR_QML}
VibrationPage.qml
)

Expand Down
2 changes: 2 additions & 0 deletions src/AnalyzeView/MAVLinkInspectorController.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class QGCMAVLinkMessage : public QObject {
Q_PROPERTY(QString name READ name CONSTANT)
Q_PROPERTY(qreal messageHz READ messageHz NOTIFY freqChanged)
Q_PROPERTY(quint64 count READ count NOTIFY countChanged)
Q_PROPERTY(int mavlinkVer READ mavlinkVer CONSTANT)
Q_PROPERTY(QmlObjectListModel* fields READ fields CONSTANT)
Q_PROPERTY(bool fieldSelected READ fieldSelected NOTIFY fieldSelectedChanged)
Q_PROPERTY(bool selected READ selected NOTIFY selectedChanged)
Expand All @@ -107,6 +108,7 @@ class QGCMAVLinkMessage : public QObject {
QString name () { return _name; }
qreal messageHz () const{ return _messageHz; }
quint64 count () const{ return _count; }
int mavlinkVer () const{ return _message.magic == 0xFE ? 1 : 2; }
quint64 lastCount () const{ return _lastCount; }
QmlObjectListModel* fields () { return &_fields; }
bool fieldSelected () const{ return _fieldSelected; }
Expand Down
6 changes: 6 additions & 0 deletions src/AnalyzeView/MAVLinkInspectorPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ AnalyzePage {
QGCLabel {
text: curMessage ? curMessage.count : ""
}
QGCLabel {
text: qsTr("Mavlink ver:")
}
QGCLabel {
text: curMessage ? curMessage.mavlinkVer : ""
}
}
Item { height: ScreenTools.defaultFontPixelHeight; width: 1 }
//---------------------------------------------------------
Expand Down
150 changes: 89 additions & 61 deletions src/AutoPilotPlugins/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,75 @@

add_subdirectory(APM)
add_subdirectory(Common)
add_subdirectory(PX4)

add_library(AutoPilotPlugins
APM/APMAirframeComponent.cc
APM/APMAirframeComponentController.cc
APM/APMAutoPilotPlugin.cc
APM/APMCameraComponent.cc
APM/APMCompassCal.cc
APM/APMFlightModesComponent.cc
APM/APMFlightModesComponentController.cc
APM/APMFollowComponent.cc
APM/APMFollowComponentController.cc
APM/APMHeliComponent.cc
APM/APMLightsComponent.cc
APM/APMMotorComponent.cc
APM/APMPowerComponent.cc
APM/APMRadioComponent.cc
APM/APMSafetyComponent.cc
APM/APMSensorsComponent.cc
APM/APMSensorsComponentController.cc
APM/APMSubFrameComponent.cc
APM/APMSubMotorComponentController.cc
APM/APMTuningComponent.cc
if (NOT QGC_DISABLE_PX4_PLUGIN)
add_subdirectory(PX4)

set(PX4FirmwarePlugin
PX4/ActuatorComponent.cc
PX4/ActuatorComponent.h
PX4/AirframeComponentAirframes.cc
PX4/AirframeComponentAirframes.h
PX4/AirframeComponent.cc
PX4/AirframeComponentController.cc
PX4/AirframeComponentController.h
PX4/AirframeComponent.h
PX4/CameraComponent.cc
PX4/CameraComponent.h
PX4/FlightModesComponent.cc
PX4/FlightModesComponent.h
PX4/PowerComponent.cc
PX4/PowerComponentController.cc
PX4/PowerComponentController.h
PX4/PowerComponent.h
PX4/PX4AirframeLoader.cc
PX4/PX4AirframeLoader.h
PX4/PX4AutoPilotPlugin.cc
PX4/PX4AutoPilotPlugin.h
PX4/PX4FlightBehavior.cc
PX4/PX4FlightBehavior.h
PX4/PX4RadioComponent.cc
PX4/PX4RadioComponent.h
PX4/PX4SimpleFlightModesController.cc
PX4/PX4SimpleFlightModesController.h
PX4/PX4TuningComponent.cc
PX4/PX4TuningComponent.h
PX4/SafetyComponent.cc
PX4/SafetyComponent.h
PX4/SensorsComponent.cc
PX4/SensorsComponentController.cc
PX4/SensorsComponentController.h
PX4/SensorsComponent.h
)
endif()

if (NOT QGC_DISABLE_APM_PLUGIN)
add_subdirectory(APM)

set(APMFirmwarePlugin
APM/APMAirframeComponent.cc
APM/APMAirframeComponentController.cc
APM/APMAutoPilotPlugin.cc
APM/APMCameraComponent.cc
APM/APMCompassCal.cc
APM/APMFlightModesComponent.cc
APM/APMFlightModesComponentController.cc
APM/APMFollowComponent.cc
APM/APMFollowComponentController.cc
APM/APMHeliComponent.cc
APM/APMLightsComponent.cc
APM/APMMotorComponent.cc
APM/APMPowerComponent.cc
APM/APMRadioComponent.cc
APM/APMSafetyComponent.cc
APM/APMSensorsComponent.cc
APM/APMSensorsComponentController.cc
APM/APMSubFrameComponent.cc
APM/APMSubMotorComponentController.cc
APM/APMTuningComponent.cc
APM/APMRemoteSupportComponent.cc
)
endif()

add_library(AutoPilotPlugins
Common/ESP8266Component.cc
Common/ESP8266ComponentController.cc
Common/MotorComponent.cc
Expand All @@ -34,42 +79,9 @@ add_library(AutoPilotPlugins

Generic/GenericAutoPilotPlugin.cc

PX4/ActuatorComponent.cc
PX4/ActuatorComponent.h
PX4/AirframeComponentAirframes.cc
PX4/AirframeComponentAirframes.h
PX4/AirframeComponent.cc
PX4/AirframeComponentController.cc
PX4/AirframeComponentController.h
PX4/AirframeComponent.h
PX4/CameraComponent.cc
PX4/CameraComponent.h
PX4/FlightModesComponent.cc
PX4/FlightModesComponent.h
PX4/PowerComponent.cc
PX4/PowerComponentController.cc
PX4/PowerComponentController.h
PX4/PowerComponent.h
PX4/PX4AirframeLoader.cc
PX4/PX4AirframeLoader.h
PX4/PX4AutoPilotPlugin.cc
PX4/PX4AutoPilotPlugin.h
PX4/PX4FlightBehavior.cc
PX4/PX4FlightBehavior.h
PX4/PX4RadioComponent.cc
PX4/PX4RadioComponent.h
PX4/PX4SimpleFlightModesController.cc
PX4/PX4SimpleFlightModesController.h
PX4/PX4TuningComponent.cc
PX4/PX4TuningComponent.h
PX4/SafetyComponent.cc
PX4/SafetyComponent.h
PX4/SensorsComponent.cc
PX4/SensorsComponentController.cc
PX4/SensorsComponentController.h
PX4/SensorsComponent.h

AutoPilotPlugin.cc
${APMFirmwarePlugin}
${PX4FirmwarePlugin}
)

target_link_libraries(AutoPilotPlugins
Expand All @@ -81,7 +93,23 @@ target_include_directories(AutoPilotPlugins
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC
APM
Common
PX4
)

if (NOT QGC_DISABLE_APM_PLUGIN)
target_include_directories(AutoPilotPlugins
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC
APM
)
endif()

if (NOT QGC_DISABLE_PX4_PLUGIN)
target_include_directories(AutoPilotPlugins
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC
PX4
)
endif()
6 changes: 6 additions & 0 deletions src/FirmwarePlugin/APM/APMFirmwarePlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ bool APMFirmwarePlugin::_handleIncomingStatusText(Vehicle* /*vehicle*/, mavlink_
// and lower the severity on them so that they don't pop in the users face.

QString messageText = _getMessageText(message);
qDebug(APMFirmwarePluginLog) << "StatusText: " << messageText;
if (messageText.contains("Place vehicle") || messageText.contains("Calibration successful")) {
_adjustCalibrationMessageSeverity(message);
return true;
Expand Down Expand Up @@ -1073,3 +1074,8 @@ QMutex& APMFirmwarePlugin::_reencodeMavlinkChannelMutex()
static QMutex _mutex{};
return _mutex;
}

bool APMFirmwarePlugin::supportsRcChannelOverride(void)
{
return true;
}
3 changes: 2 additions & 1 deletion src/FirmwarePlugin/APM/APMFirmwarePlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ class APMFirmwarePlugin : public FirmwarePlugin
QObject* _loadParameterMetaData (const QString& metaDataFile) override;
QString brandImageIndoor (const Vehicle* vehicle) const override { Q_UNUSED(vehicle); return QStringLiteral("/qmlimages/APM/BrandImage"); }
QString brandImageOutdoor (const Vehicle* vehicle) const override { Q_UNUSED(vehicle); return QStringLiteral("/qmlimages/APM/BrandImage"); }
QString getHobbsMeter (Vehicle* vehicle) override;
QString getHobbsMeter (Vehicle* vehicle) override;
bool hasGripper (const Vehicle* vehicle) const override;
const QVariantList& toolIndicators (const Vehicle* vehicle) override;
bool supportsRcChannelOverride(void) override;

protected:
/// All access to singleton is through stack specific implementation
Expand Down