diff --git a/src/FirmwarePlugin/APM/APMFirmwarePlugin.cc b/src/FirmwarePlugin/APM/APMFirmwarePlugin.cc index c8c9a76aba56a7a67bdda618158a589f5cdb340f..df059a4fec4a1de9c5b3a740a2a1a1a3ecf2e036 100644 --- a/src/FirmwarePlugin/APM/APMFirmwarePlugin.cc +++ b/src/FirmwarePlugin/APM/APMFirmwarePlugin.cc @@ -228,13 +228,6 @@ bool APMFirmwarePlugin::setFlightMode(const QString& flightMode, uint8_t* base_m return found; } -int APMFirmwarePlugin::manualControlReservedButtonCount(void) -{ - // We don't know whether the firmware is going to used any of these buttons. - // So reserve them all. - return -1; -} - void APMFirmwarePlugin::_handleIncomingParamValue(Vehicle* vehicle, mavlink_message_t* message) { Q_UNUSED(vehicle); diff --git a/src/FirmwarePlugin/APM/APMFirmwarePlugin.h b/src/FirmwarePlugin/APM/APMFirmwarePlugin.h index bac34679a75151a1e54e6f5e002e7603784a2a3f..3abab25ee0976d6ab31f5cd4dd6f51926bf358cb 100644 --- a/src/FirmwarePlugin/APM/APMFirmwarePlugin.h +++ b/src/FirmwarePlugin/APM/APMFirmwarePlugin.h @@ -90,7 +90,6 @@ public: void pauseVehicle (Vehicle* vehicle) override; void guidedModeRTL (Vehicle* vehicle) override; void guidedModeChangeAltitude (Vehicle* vehicle, double altitudeChange) override; - int manualControlReservedButtonCount(void) override; bool adjustIncomingMavlinkMessage (Vehicle* vehicle, mavlink_message_t* message) override; void adjustOutgoingMavlinkMessage (Vehicle* vehicle, LinkInterface* outgoingLink, mavlink_message_t* message) override; virtual void initializeStreamRates (Vehicle* vehicle); diff --git a/src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.cc b/src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.cc index a77f5e50b541cb5682c3c070e8dc674bdc1b11df..eb0fe9378efb06a5c22f6313f47ef1df0ac48f73 100644 --- a/src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.cc +++ b/src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.cc @@ -164,11 +164,6 @@ int ArduSubFirmwarePlugin::remapParamNameHigestMinorVersionNumber(int majorVersi return majorVersionNumber == 3 ? 6 : Vehicle::versionNotSetValue; } -int ArduSubFirmwarePlugin::manualControlReservedButtonCount(void) -{ - return 0; -} - void ArduSubFirmwarePlugin::initializeStreamRates(Vehicle* vehicle) { vehicle->requestDataStream(MAV_DATA_STREAM_RAW_SENSORS, 2); vehicle->requestDataStream(MAV_DATA_STREAM_EXTENDED_STATUS, 2); diff --git a/src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.h b/src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.h index 1d69bfbfb854760a37e0b16f8c5d874a7f60819f..6a356059a18728fc12bcbd658f61aa941da127eb 100644 --- a/src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.h +++ b/src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.h @@ -110,9 +110,6 @@ public: QList supportedMissionCommands(void) final; - // Overrides from FirmwarePlugin - int manualControlReservedButtonCount(void) final; - int defaultJoystickTXMode(void) final { return 3; } void initializeStreamRates(Vehicle* vehicle) override final; diff --git a/src/FirmwarePlugin/FirmwarePlugin.cc b/src/FirmwarePlugin/FirmwarePlugin.cc index db2a86969394f52d3033e41e4e42a1e4d2c43960..b7cfadff634b3a3cee4b3c8f3038e3db3a7133b5 100644 --- a/src/FirmwarePlugin/FirmwarePlugin.cc +++ b/src/FirmwarePlugin/FirmwarePlugin.cc @@ -115,13 +115,6 @@ bool FirmwarePlugin::setFlightMode(const QString& flightMode, uint8_t* base_mode return false; } -int FirmwarePlugin::manualControlReservedButtonCount(void) -{ - // We don't know whether the firmware is going to used any of these buttons. - // So reserve them all. - return -1; -} - int FirmwarePlugin::defaultJoystickTXMode(void) { return 2; diff --git a/src/FirmwarePlugin/FirmwarePlugin.h b/src/FirmwarePlugin/FirmwarePlugin.h index 81d2d2abcd7e0e9a4fc87b1142ae2756b4c70a6b..bcae4c08b7d33b688987469028e945fff0ca98bf 100644 --- a/src/FirmwarePlugin/FirmwarePlugin.h +++ b/src/FirmwarePlugin/FirmwarePlugin.h @@ -146,14 +146,6 @@ public: /// @param altitudeChange If > 0, go up by amount specified, if < 0, go down by amount specified virtual void guidedModeChangeAltitude(Vehicle* vehicle, double altitudeChange); - /// FIXME: This isn't quite correct being here. All code for Joystick suvehicleTypepport is currently firmware specific - /// not just this. I'm going to try to change that. If not, this will need to be removed. - /// Returns the number of buttons which are reserved for firmware use in the MANUAL_CONTROL mavlink - /// message. For example PX4 Flight Stack reserves the first 8 buttons to simulate rc switches. - /// The remainder can be assigned to Vehicle actions. - /// @return -1: reserver all buttons, >0 number of buttons to reserve - virtual int manualControlReservedButtonCount(void); - /// Default tx mode to apply to joystick axes /// TX modes are as outlined here: http://www.rc-airplane-world.com/rc-transmitter-modes.html virtual int defaultJoystickTXMode(void); diff --git a/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc b/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc index 7b19ebf5c07fef25514a649149032b44b34cbbc8..44eb73ff104ccf7c074ddc815264a15a20bb8c8d 100644 --- a/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc +++ b/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc @@ -225,11 +225,6 @@ bool PX4FirmwarePlugin::setFlightMode(const QString& flightMode, uint8_t* base_m return found; } -int PX4FirmwarePlugin::manualControlReservedButtonCount(void) -{ - return 0; // 0 buttons reserved for rc switch simulation -} - bool PX4FirmwarePlugin::isCapable(const Vehicle *vehicle, FirmwareCapabilities capabilities) { int available = SetFlightModeCapability | PauseVehicleCapability | GuidedModeCapability; diff --git a/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.h b/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.h index 2c8059b61361edacda90a4d1d17947de254c05d3..c70b43a0b504ad05107665f1d95c4b2b60d9299f 100644 --- a/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.h +++ b/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.h @@ -52,7 +52,6 @@ public: double minimumTakeoffAltitude (Vehicle* vehicle) override; void startMission (Vehicle* vehicle) override; bool isGuidedMode (const Vehicle* vehicle) const override; - int manualControlReservedButtonCount(void) override; void initializeVehicle (Vehicle* vehicle) override; bool sendHomePositionToVehicle (void) override; void addMetaDataToFact (QObject* parameterMetaData, Fact* fact, MAV_TYPE vehicleType) override; diff --git a/src/Joystick/Joystick.cc b/src/Joystick/Joystick.cc index e06d9d550257beaa5ee0a828f8517cc0b8564d47..6249995d1926c55dbd1a951158859ff886896898 100644 --- a/src/Joystick/Joystick.cc +++ b/src/Joystick/Joystick.cc @@ -516,12 +516,6 @@ void Joystick::run(void) // Set up button pressed information - // We only send the buttons the firmwware has reserved - int reservedButtonCount = _activeVehicle->manualControlReservedButtonCount(); - if (reservedButtonCount == -1) { - reservedButtonCount = _totalButtonCount; - } - quint16 newButtonBits = 0; // New set of button which are down quint16 buttonPressedBits = 0; // Buttons pressed for manualControl signal @@ -536,12 +530,9 @@ void Joystick::run(void) // Button was up last time through, but is now down which indicates a button press qCDebug(JoystickLog) << "button triggered" << buttonIndex; - if (buttonIndex >= reservedButtonCount) { - // Button is above firmware reserved set - QString buttonAction =_rgButtonActions[buttonIndex]; - if (!buttonAction.isEmpty()) { - _buttonAction(buttonAction); - } + QString buttonAction =_rgButtonActions[buttonIndex]; + if (!buttonAction.isEmpty()) { + _buttonAction(buttonAction); } } @@ -554,6 +545,7 @@ void Joystick::run(void) qCDebug(JoystickValuesLog) << "name:roll:pitch:yaw:throttle" << name() << roll << -pitch << yaw << throttle; + // NOTE: The buttonPressedBits going to MANUAL_CONTROL are currently used by ArduSub. emit manualControl(roll, -pitch, yaw, throttle, buttonPressedBits, _activeVehicle->joystickMode()); } diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index 4b9b33ef6e71b62d3c19c916f666fd761cffff64..56a2762fc6705f9ed94a1cc9eb9b5658dd70fe0f 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -2214,11 +2214,6 @@ void Vehicle::resetMessages() } } -int Vehicle::manualControlReservedButtonCount(void) -{ - return _firmwarePlugin->manualControlReservedButtonCount(); -} - void Vehicle::_loadSettings(void) { if (!_active) { diff --git a/src/Vehicle/Vehicle.h b/src/Vehicle/Vehicle.h index b330984442289aba2681bde17bca3ad7ae07baf1..7bb9072a0340612f06fbf07e6ad4cc195e424c59 100644 --- a/src/Vehicle/Vehicle.h +++ b/src/Vehicle/Vehicle.h @@ -691,12 +691,6 @@ public: /// Resets link status counters Q_INVOKABLE void resetCounters (); - /// Returns the number of buttons which are reserved for firmware use in the MANUAL_CONTROL mavlink - /// message. For example PX4 Flight Stack reserves the first 8 buttons to simulate rc switches. - /// The remainder can be assigned to Vehicle actions. - /// @return -1: reserver all buttons, >0 number of buttons to reserve - Q_PROPERTY(int manualControlReservedButtonCount READ manualControlReservedButtonCount CONSTANT) - // Called when the message drop-down is invoked to clear current count Q_INVOKABLE void resetMessages(); @@ -821,8 +815,6 @@ public: /// Provides access to the Firmware Plugin for this Vehicle FirmwarePlugin* firmwarePlugin(void) { return _firmwarePlugin; } - int manualControlReservedButtonCount(void); - MissionManager* missionManager(void) { return _missionManager; } GeoFenceManager* geoFenceManager(void) { return _geoFenceManager; } RallyPointManager* rallyPointManager(void) { return _rallyPointManager; } diff --git a/src/VehicleSetup/JoystickConfig.qml b/src/VehicleSetup/JoystickConfig.qml index 396a1edcaa2967150a34e2a2f519f7d775f17ec3..db6c1a4af40f6ac2a99991e9a95497087a69f4a8 100644 --- a/src/VehicleSetup/JoystickConfig.qml +++ b/src/VehicleSetup/JoystickConfig.qml @@ -620,20 +620,13 @@ SetupPage { width: parent.width spacing: ScreenTools.defaultFontPixelHeight / 3 - QGCLabel { - visible: _activeVehicle.manualControlReservedButtonCount != 0 - text: qsTr("Buttons 0-%1 reserved for firmware use").arg(reservedButtonCount) - - property int reservedButtonCount: _activeVehicle.manualControlReservedButtonCount == -1 ? _activeJoystick.totalButtonCount : _activeVehicle.manualControlReservedButtonCount - } - Repeater { id: buttonActionRepeater model: _activeJoystick ? Math.min(_activeJoystick.totalButtonCount, _maxButtons) : 0 Row { spacing: ScreenTools.defaultFontPixelWidth - visible: (_activeVehicle.manualControlReservedButtonCount == -1 ? false : modelData >= _activeVehicle.manualControlReservedButtonCount) && !_activeVehicle.supportsJSButton + visible: !_activeVehicle.supportsJSButton property bool pressed