Skip to content

Commit

Permalink
Move max rc channels into mavlink
Browse files Browse the repository at this point in the history
  • Loading branch information
HTRamsey committed May 5, 2024
1 parent d976f1c commit a0fa603
Show file tree
Hide file tree
Showing 36 changed files with 78 additions and 100 deletions.
6 changes: 4 additions & 2 deletions src/AutoPilotPlugins/APM/APMFlightModesComponentController.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

#include "APMFlightModesComponentController.h"
#include "FactSystem.h"
#include "Fact.h"
#include "Vehicle.h"

#include <QtCore/QVariant>
#include <QtQml/QQmlEngine>
Expand All @@ -21,7 +23,7 @@ const char* APMFlightModesComponentController::_superSimpleParamName = "SUPER_S

APMFlightModesComponentController::APMFlightModesComponentController(void)
: _activeFlightMode (0)
, _channelCount (Vehicle::cMaxRcChannels)
, _channelCount (QGCMAVLink::maxRcChannels)
, _simpleMode (SimpleModeStandard)
, _simpleModeFact (parameterExists(-1, _simpleParamName) ? getParameterFact(-1, _simpleParamName) : nullptr)
, _superSimpleModeFact (parameterExists(-1, _superSimpleParamName) ? getParameterFact(-1, _superSimpleParamName) : nullptr)
Expand Down Expand Up @@ -75,7 +77,7 @@ APMFlightModesComponentController::APMFlightModesComponentController(void)
}

/// Connected to Vehicle::rcChannelsChanged signal
void APMFlightModesComponentController::_rcChannelsChanged(int channelCount, int pwmValues[Vehicle::cMaxRcChannels])
void APMFlightModesComponentController::_rcChannelsChanged(int channelCount, int pwmValues[QGCMAVLink::maxRcChannels])
{
int flightModeChannel = 4;

Expand Down
4 changes: 2 additions & 2 deletions src/AutoPilotPlugins/APM/APMFlightModesComponentController.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <QtCore/QStringList>

#include "FactPanelController.h"
#include "Vehicle.h"
#include "QGCMAVLink.h"

/// MVC Controller for FlightModesComponent.qml.
class APMFlightModesComponentController : public FactPanelController
Expand Down Expand Up @@ -56,7 +56,7 @@ class APMFlightModesComponentController : public FactPanelController
void superSimpleModeEnabledChanged (void);

private slots:
void _rcChannelsChanged (int channelCount, int pwmValues[Vehicle::cMaxRcChannels]);
void _rcChannelsChanged (int channelCount, int pwmValues[QGCMAVLink::maxRcChannels]);
void _updateSimpleParamsFromSimpleMode (void);
void _setupSimpleModeEnabled (void);

Expand Down
5 changes: 3 additions & 2 deletions src/AutoPilotPlugins/APM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,20 @@ qt_add_library(APMAutoPilotPlugin STATIC

target_link_libraries(APMAutoPilotPlugin
PRIVATE
VehicleActuators
APMFirmwarePlugin
AutoPilotPlugins
FactSystem
QGC
Settings
Utilities
Vehicle
VehicleActuators
PUBLIC
Qt6::Core
Qt6::Quick
Comms
CommonAutoPilotPlugin
FactControls
Vehicle
VehicleSetup
)

Expand Down
2 changes: 2 additions & 0 deletions src/AutoPilotPlugins/Common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ target_link_libraries(CommonAutoPilotPlugin
FactSystem
QGC
Utilities
Vehicle
PUBLIC
Qt6::Core
Qt6::Network
Qt6::Quick
Comms
FactControls
VehicleSetup
)
Expand Down
4 changes: 3 additions & 1 deletion src/AutoPilotPlugins/Common/RadioComponentController.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include "RadioComponentController.h"
#include "QGCApplication.h"
#include "FactSystem.h"
#include "Fact.h"
#include "Vehicle.h"
#include "QGCLoggingCategory.h"

#include <QtCore/QSettings>
Expand Down Expand Up @@ -224,7 +226,7 @@ void RadioComponentController::_setupCurrentState(void)
}

/// Connected to Vehicle::rcChannelsChanged signal
void RadioComponentController::_rcChannelsChanged(int channelCount, int pwmValues[Vehicle::cMaxRcChannels])
void RadioComponentController::_rcChannelsChanged(int channelCount, int pwmValues[QGCMAVLink::maxRcChannels])
{
for (int channel=0; channel<channelCount; channel++) {
int channelValue = pwmValues[channel];
Expand Down
5 changes: 3 additions & 2 deletions src/AutoPilotPlugins/Common/RadioComponentController.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
#pragma once

#include "FactPanelController.h"
#include "Vehicle.h"
#include "QGCMAVLink.h"

#include <QtCore/QLoggingCategory>
#include <QtCore/QElapsedTimer>
#include <QtQuick/QQuickItem>

Q_DECLARE_LOGGING_CATEGORY(RadioComponentControllerLog)
Expand Down Expand Up @@ -138,7 +139,7 @@ class RadioComponentController : public FactPanelController
void throttleReversedCalFailure(void);

private slots:
void _rcChannelsChanged(int channelCount, int pwmValues[Vehicle::cMaxRcChannels]);
void _rcChannelsChanged(int channelCount, int pwmValues[QGCMAVLink::maxRcChannels]);

private:
/// @brief These identify the various controls functions. They are also used as indices into the _rgFunctioInfo
Expand Down
1 change: 1 addition & 0 deletions src/AutoPilotPlugins/PX4/ActuatorComponent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "ActuatorComponent.h"
#include "QGCApplication.h"
#include "GeometryImage.h"
#include "Actuators/Actuators.h"

#include <QtQml/QQmlApplicationEngine>

Expand Down
4 changes: 2 additions & 2 deletions src/AutoPilotPlugins/PX4/ActuatorComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
#pragma once

#include "VehicleComponent.h"
#include "Actuators/Actuators.h"

class Actuators;

class ActuatorComponent : public VehicleComponent
{
Expand All @@ -36,4 +37,3 @@ class ActuatorComponent : public VehicleComponent
const QString _name;
Actuators& _actuators;
};

5 changes: 1 addition & 4 deletions src/AutoPilotPlugins/PX4/AirframeComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
****************************************************************************/


#ifndef AIRFRAMECOMPONENT_H
#define AIRFRAMECOMPONENT_H
#pragma once

#include "VehicleComponent.h"

Expand Down Expand Up @@ -40,5 +39,3 @@ class AirframeComponent : public VehicleComponent
const QString _name;
QVariantList _summaryItems;
};

#endif
5 changes: 1 addition & 4 deletions src/AutoPilotPlugins/PX4/AirframeComponentAirframes.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
/// @file
/// @author Don Gagne <[email protected]>

#ifndef AIRFRAMECOMPONENTAIRFRAMES_H
#define AIRFRAMECOMPONENTAIRFRAMES_H
#pragma once

#include <QtCore/QList>
#include <QtCore/QMap>
Expand Down Expand Up @@ -41,5 +40,3 @@ class AirframeComponentAirframes

private:
};

#endif
5 changes: 1 addition & 4 deletions src/AutoPilotPlugins/PX4/AirframeComponentController.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
/// @file
/// @author Don Gagne <[email protected]>

#ifndef AIRFRAMECOMPONENTCONTROLLER_H
#define AIRFRAMECOMPONENTCONTROLLER_H
#pragma once

#include <QtCore/QObject>
#include <QtCore/QVariant>
Expand Down Expand Up @@ -98,5 +97,3 @@ class AirframeType : public QObject
QString _imageResource;
QVariantList _airframes;
};

#endif
8 changes: 4 additions & 4 deletions src/AutoPilotPlugins/PX4/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ qt_add_library(PX4AutoPilotPlugin STATIC

target_link_libraries(PX4AutoPilotPlugin
PRIVATE
Comms
FactSystem
QGC
Utilities
Vehicle
VehicleActuators
PUBLIC
Qt6::Core
Qt6::Quick
AutoPilotPlugins
CommonAutoPilotPlugin
Comms
FactControls
FactSystem
Vehicle
VehicleActuators
VehicleSetup
)

Expand Down
5 changes: 1 addition & 4 deletions src/AutoPilotPlugins/PX4/CameraComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
****************************************************************************/


#ifndef CameraComponent_H
#define CameraComponent_H
#pragma once

#include "VehicleComponent.h"

Expand Down Expand Up @@ -42,5 +41,3 @@ class CameraComponent : public VehicleComponent
const QString _name;
QVariantList _summaryItems;
};

#endif
5 changes: 1 addition & 4 deletions src/AutoPilotPlugins/PX4/FlightModesComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
****************************************************************************/


#ifndef FLIGHTMODESCOMPONENT_H
#define FLIGHTMODESCOMPONENT_H
#pragma once

#include "VehicleComponent.h"

Expand Down Expand Up @@ -40,5 +39,3 @@ class FlightModesComponent : public VehicleComponent
const QString _name;
QVariantList _summaryItems;
};

#endif
5 changes: 1 addition & 4 deletions src/AutoPilotPlugins/PX4/PX4AirframeLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
****************************************************************************/


#ifndef PX4AIRFRAMELOADER_H
#define PX4AIRFRAMELOADER_H
#pragma once

#include <QtCore/QObject>
#include <QtCore/QMap>
Expand Down Expand Up @@ -52,5 +51,3 @@ class PX4AirframeLoader : QObject
static bool _airframeMetaDataLoaded; ///< true: parameter meta data already loaded
static QMap<QString, FactMetaData*> _mapParameterName2FactMetaData; ///< Maps from a parameter name to FactMetaData
};

#endif // PX4AIRFRAMELOADER_H
1 change: 1 addition & 0 deletions src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "FactSystem.h"
#include "ParameterManager.h"
#include "Vehicle.h"
#include "Actuators.h"
#include "ActuatorComponent.h"

/// @file
Expand Down
5 changes: 1 addition & 4 deletions src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
****************************************************************************/


#ifndef PX4AUTOPILOT_H
#define PX4AUTOPILOT_H
#pragma once

#include "AutoPilotPlugin.h"
#include "ActuatorComponent.h"
Expand Down Expand Up @@ -66,5 +65,3 @@ class PX4AutoPilotPlugin : public AutoPilotPlugin
private:
QVariantList _components;
};

#endif
5 changes: 1 addition & 4 deletions src/AutoPilotPlugins/PX4/PX4RadioComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
****************************************************************************/


#ifndef PX4RadioComponent_H
#define PX4RadioComponent_H
#pragma once

#include "VehicleComponent.h"

Expand All @@ -36,5 +35,3 @@ class PX4RadioComponent : public VehicleComponent
const QString _name;
QVariantList _summaryItems;
};

#endif
6 changes: 4 additions & 2 deletions src/AutoPilotPlugins/PX4/PX4SimpleFlightModesController.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@

#include "PX4SimpleFlightModesController.h"
#include "FactSystem.h"
#include "Fact.h"
#include "Vehicle.h"

PX4SimpleFlightModesController::PX4SimpleFlightModesController(void)
: _activeFlightMode(0)
, _channelCount(Vehicle::cMaxRcChannels)
, _channelCount(QGCMAVLink::maxRcChannels)

{
QStringList usedParams;
Expand All @@ -28,7 +30,7 @@ PX4SimpleFlightModesController::PX4SimpleFlightModesController(void)
}

/// Connected to Vehicle::rcChannelsChanged signal
void PX4SimpleFlightModesController::_rcChannelsChanged(int channelCount, int pwmValues[Vehicle::cMaxRcChannels])
void PX4SimpleFlightModesController::_rcChannelsChanged(int channelCount, int pwmValues[QGCMAVLink::maxRcChannels])
{
_rcChannelValues.clear();
for (int i=0; i<channelCount; i++) {
Expand Down
9 changes: 3 additions & 6 deletions src/AutoPilotPlugins/PX4/PX4SimpleFlightModesController.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
****************************************************************************/


#ifndef PX4SimpleFlightModesController_H
#define PX4SimpleFlightModesController_H
#pragma once

#include "FactPanelController.h"
#include "Vehicle.h"
#include "QGCMAVLink.h"

/// MVC Controller for PX4SimpleFlightModes.qml
class PX4SimpleFlightModesController : public FactPanelController
Expand All @@ -34,12 +33,10 @@ class PX4SimpleFlightModesController : public FactPanelController
void rcChannelValuesChanged(void);

private slots:
void _rcChannelsChanged(int channelCount, int pwmValues[Vehicle::cMaxRcChannels]);
void _rcChannelsChanged(int channelCount, int pwmValues[QGCMAVLink::maxRcChannels]);

private:
int _activeFlightMode;
int _channelCount;
QVariantList _rcChannelValues;
};

#endif
5 changes: 1 addition & 4 deletions src/AutoPilotPlugins/PX4/PX4TuningComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
****************************************************************************/


#ifndef PX4TuningComponent_H
#define PX4TuningComponent_H
#pragma once

#include "VehicleComponent.h"

Expand Down Expand Up @@ -37,5 +36,3 @@ class PX4TuningComponent : public VehicleComponent
private:
const QString _name;
};

#endif
5 changes: 1 addition & 4 deletions src/AutoPilotPlugins/PX4/PowerComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
****************************************************************************/


#ifndef PowerComponent_H
#define PowerComponent_H
#pragma once

#include "VehicleComponent.h"

Expand Down Expand Up @@ -41,5 +40,3 @@ class PowerComponent : public VehicleComponent
const QString _name;
QVariantList _summaryItems;
};

#endif
Loading

0 comments on commit a0fa603

Please sign in to comment.