Commit 94f84a56 authored by DoinLakeFlyer's avatar DoinLakeFlyer

parent 29c19c08
...@@ -81,12 +81,13 @@ public: ...@@ -81,12 +81,13 @@ public:
/// free when no longer needed. /// free when no longer needed.
virtual QList<VehicleComponent*> componentsForVehicle(AutoPilotPlugin* vehicle); virtual QList<VehicleComponent*> componentsForVehicle(AutoPilotPlugin* vehicle);
/// Returns the list of available flight modes. Flight modes can be different in normal/advanced ui mode. /// Returns the list of available flight modes for the Fly View dropdown. This may or may not be the full
/// list available from the firmware. Call will be made again if advanced mode changes.
virtual QStringList flightModes(Vehicle* /*vehicle*/) { return QStringList(); }
/// Returns the list of additional flight modes to add to the list for joystick button actions.
/// Call will be made again if advanced mode changes. /// Call will be made again if advanced mode changes.
virtual QStringList flightModes(Vehicle* vehicle) { virtual QStringList extraJoystickFlightModes(Vehicle* /*vehicle*/) { return QStringList(); }
Q_UNUSED(vehicle);
return QStringList();
}
/// Returns the name for this flight mode. Flight mode names must be human readable as well as audio speakable. /// Returns the name for this flight mode. Flight mode names must be human readable as well as audio speakable.
/// @param base_mode Base mode from mavlink HEARTBEAT message /// @param base_mode Base mode from mavlink HEARTBEAT message
......
...@@ -972,7 +972,7 @@ void Joystick::_executeButtonAction(const QString& action, bool buttonDown) ...@@ -972,7 +972,7 @@ void Joystick::_executeButtonAction(const QString& action, bool buttonDown)
if (buttonDown) emit setVtolInFwdFlight(true); if (buttonDown) emit setVtolInFwdFlight(true);
} else if (action == _buttonActionVTOLMultiRotor) { } else if (action == _buttonActionVTOLMultiRotor) {
if (buttonDown) emit setVtolInFwdFlight(false); if (buttonDown) emit setVtolInFwdFlight(false);
} else if (_activeVehicle->flightModes().contains(action)) { } else if (_activeVehicle->flightModes().contains(action) || _activeVehicle->extraJoystickFlightModes().contains(action)) {
if (buttonDown) emit setFlightMode(action); if (buttonDown) emit setFlightMode(action);
} else if(action == _buttonActionContinuousZoomIn || action == _buttonActionContinuousZoomOut) { } else if(action == _buttonActionContinuousZoomIn || action == _buttonActionContinuousZoomOut) {
if (buttonDown) { if (buttonDown) {
...@@ -1072,6 +1072,10 @@ void Joystick::_buildActionList(Vehicle* activeVehicle) ...@@ -1072,6 +1072,10 @@ void Joystick::_buildActionList(Vehicle* activeVehicle)
foreach(auto mode, list) { foreach(auto mode, list) {
_assignableButtonActions.append(new AssignableButtonAction(this, mode)); _assignableButtonActions.append(new AssignableButtonAction(this, mode));
} }
list = activeVehicle->extraJoystickFlightModes();
foreach(auto mode, list) {
_assignableButtonActions.append(new AssignableButtonAction(this, mode));
}
} }
_assignableButtonActions.append(new AssignableButtonAction(this, _buttonActionVTOLFixedWing)); _assignableButtonActions.append(new AssignableButtonAction(this, _buttonActionVTOLFixedWing));
_assignableButtonActions.append(new AssignableButtonAction(this, _buttonActionVTOLMultiRotor)); _assignableButtonActions.append(new AssignableButtonAction(this, _buttonActionVTOLMultiRotor));
......
...@@ -2375,6 +2375,11 @@ QStringList Vehicle::flightModes(void) ...@@ -2375,6 +2375,11 @@ QStringList Vehicle::flightModes(void)
return _firmwarePlugin->flightModes(this); return _firmwarePlugin->flightModes(this);
} }
QStringList Vehicle::extraJoystickFlightModes(void)
{
return _firmwarePlugin->extraJoystickFlightModes(this);
}
QString Vehicle::flightMode(void) const QString Vehicle::flightMode(void) const
{ {
return _firmwarePlugin->flightMode(_base_mode, _custom_mode); return _firmwarePlugin->flightMode(_base_mode, _custom_mode);
......
...@@ -542,6 +542,7 @@ public: ...@@ -542,6 +542,7 @@ public:
Q_PROPERTY(bool autoDisarm READ autoDisarm NOTIFY autoDisarmChanged) Q_PROPERTY(bool autoDisarm READ autoDisarm NOTIFY autoDisarmChanged)
Q_PROPERTY(bool flightModeSetAvailable READ flightModeSetAvailable CONSTANT) Q_PROPERTY(bool flightModeSetAvailable READ flightModeSetAvailable CONSTANT)
Q_PROPERTY(QStringList flightModes READ flightModes NOTIFY flightModesChanged) Q_PROPERTY(QStringList flightModes READ flightModes NOTIFY flightModesChanged)
Q_PROPERTY(QStringList extraJoystickFlightModes READ extraJoystickFlightModes NOTIFY flightModesChanged)
Q_PROPERTY(QString flightMode READ flightMode WRITE setFlightMode NOTIFY flightModeChanged) Q_PROPERTY(QString flightMode READ flightMode WRITE setFlightMode NOTIFY flightModeChanged)
Q_PROPERTY(bool hilMode READ hilMode WRITE setHilMode NOTIFY hilModeChanged) Q_PROPERTY(bool hilMode READ hilMode WRITE setHilMode NOTIFY hilModeChanged)
Q_PROPERTY(TrajectoryPoints* trajectoryPoints MEMBER _trajectoryPoints CONSTANT) Q_PROPERTY(TrajectoryPoints* trajectoryPoints MEMBER _trajectoryPoints CONSTANT)
...@@ -851,10 +852,11 @@ public: ...@@ -851,10 +852,11 @@ public:
bool armed () { return _armed; } bool armed () { return _armed; }
void setArmed (bool armed); void setArmed (bool armed);
bool flightModeSetAvailable(void); bool flightModeSetAvailable (void);
QStringList flightModes(void); QStringList flightModes (void);
QString flightMode(void) const; QStringList extraJoystickFlightModes (void);
void setFlightMode(const QString& flightMode); QString flightMode (void) const;
void setFlightMode (const QString& flightMode);
QString priorityLinkName(void) const; QString priorityLinkName(void) const;
QVariantList links(void) const; QVariantList links(void) const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment