Commit 76d2d867 authored by khancyr's avatar khancyr

Joystick: make negativethrust visible by firmwarePlugin

parent 8f1ee3c9
...@@ -129,6 +129,12 @@ bool FirmwarePlugin::supportsThrottleModeCenterZero(void) ...@@ -129,6 +129,12 @@ bool FirmwarePlugin::supportsThrottleModeCenterZero(void)
return true; return true;
} }
bool FirmwarePlugin::supportsNegativeThrust(void)
{
// By default, this is not supported
return false;
}
bool FirmwarePlugin::supportsManualControl(void) bool FirmwarePlugin::supportsManualControl(void)
{ {
return false; return false;
......
...@@ -158,6 +158,10 @@ public: ...@@ -158,6 +158,10 @@ public:
/// throttle. /// throttle.
virtual bool supportsThrottleModeCenterZero(void); virtual bool supportsThrottleModeCenterZero(void);
/// Returns true if the vehicle and firmware supports the use of negative thrust
/// Typically supported rover.
virtual bool supportsNegativeThrust(void);
/// Returns true if the firmware supports the use of the MAVlink "MANUAL_CONTROL" message. /// Returns true if the firmware supports the use of the MAVlink "MANUAL_CONTROL" message.
/// By default, this returns false unless overridden in the firmware plugin. /// By default, this returns false unless overridden in the firmware plugin.
virtual bool supportsManualControl(void); virtual bool supportsManualControl(void);
......
...@@ -463,7 +463,7 @@ void Joystick::run(void) ...@@ -463,7 +463,7 @@ void Joystick::run(void)
// Adjust throttle to 0:1 range // Adjust throttle to 0:1 range
if (_throttleMode == ThrottleModeCenterZero && _activeVehicle->supportsThrottleModeCenterZero()) { if (_throttleMode == ThrottleModeCenterZero && _activeVehicle->supportsThrottleModeCenterZero()) {
if (!_negativeThrust) { if (!_activeVehicle->supportsNegativeThrust() || !_negativeThrust) {
throttle = std::max(0.0f, throttle); throttle = std::max(0.0f, throttle);
} }
} else { } else {
......
...@@ -2118,6 +2118,11 @@ bool Vehicle::supportsThrottleModeCenterZero(void) const ...@@ -2118,6 +2118,11 @@ bool Vehicle::supportsThrottleModeCenterZero(void) const
return _firmwarePlugin->supportsThrottleModeCenterZero(); return _firmwarePlugin->supportsThrottleModeCenterZero();
} }
bool Vehicle::supportsNegativeThrust(void) const
{
return _firmwarePlugin->supportsNegativeThrust();
}
bool Vehicle::supportsRadio(void) const bool Vehicle::supportsRadio(void) const
{ {
return _firmwarePlugin->supportsRadio(); return _firmwarePlugin->supportsRadio();
......
...@@ -284,6 +284,7 @@ public: ...@@ -284,6 +284,7 @@ public:
Q_PROPERTY(bool sub READ sub NOTIFY vehicleTypeChanged) Q_PROPERTY(bool sub READ sub NOTIFY vehicleTypeChanged)
Q_PROPERTY(bool supportsManualControl READ supportsManualControl CONSTANT) Q_PROPERTY(bool supportsManualControl READ supportsManualControl CONSTANT)
Q_PROPERTY(bool supportsThrottleModeCenterZero READ supportsThrottleModeCenterZero CONSTANT) Q_PROPERTY(bool supportsThrottleModeCenterZero READ supportsThrottleModeCenterZero CONSTANT)
Q_PROPERTY(bool supportsNegativeThrust READ supportsNegativeThrust CONSTANT)
Q_PROPERTY(bool supportsJSButton READ supportsJSButton CONSTANT) Q_PROPERTY(bool supportsJSButton READ supportsJSButton CONSTANT)
Q_PROPERTY(bool supportsRadio READ supportsRadio CONSTANT) Q_PROPERTY(bool supportsRadio READ supportsRadio CONSTANT)
Q_PROPERTY(bool supportsMotorInterference READ supportsMotorInterference CONSTANT) Q_PROPERTY(bool supportsMotorInterference READ supportsMotorInterference CONSTANT)
...@@ -522,6 +523,7 @@ public: ...@@ -522,6 +523,7 @@ public:
bool supportsManualControl(void) const; bool supportsManualControl(void) const;
bool supportsThrottleModeCenterZero(void) const; bool supportsThrottleModeCenterZero(void) const;
bool supportsNegativeThrust(void) const;
bool supportsRadio(void) const; bool supportsRadio(void) const;
bool supportsJSButton(void) const; bool supportsJSButton(void) const;
bool supportsMotorInterference(void) const; bool supportsMotorInterference(void) const;
......
...@@ -455,6 +455,7 @@ SetupPage { ...@@ -455,6 +455,7 @@ SetupPage {
} }
QGCCheckBox { QGCCheckBox {
visible: _activeVehicle.supportsNegativeThrust
id: negativeThrust id: negativeThrust
text: qsTr("Allow negative Thrust") text: qsTr("Allow negative Thrust")
checked: _activeJoystick ? _activeJoystick.negativeThrust : false checked: _activeJoystick ? _activeJoystick.negativeThrust : false
......
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