Browse Source

joystick.outputMode is redundant since the vehicle class has its own "joystickEnabled"

QGC4.4
nanthony21 7 years ago
parent
commit
328ad9eeee
  1. 12
      src/Joystick/Joystick.cc
  2. 4
      src/Joystick/Joystick.h
  3. 11
      src/VehicleSetup/JoystickConfig.qml

12
src/Joystick/Joystick.cc

@ -445,7 +445,7 @@ void Joystick::run(void) @@ -445,7 +445,7 @@ void Joystick::run(void)
}
}
if (_outputEnabled && _calibrated) {
if (_activeVehicle->joystickEnabled() && _calibrated) {
int axis = _rgFunctionAxis[rollFunction];
float roll = _adjustRange(_rgAxisValues[axis], _rgCalibration[axis], _deadband);
@ -798,18 +798,8 @@ void Joystick::setCalibrationMode(bool calibrating) @@ -798,18 +798,8 @@ void Joystick::setCalibrationMode(bool calibrating)
else if (_pollingStartedForCalibration) {
stopPolling();
}
if (calibrating){
setOutputEnabled(false); //Disable the joystick output before calibrating
}
else if (!calibrating && _calibrated){
setOutputEnabled(true); //Enable joystick output after calibration
}
}
void Joystick::setOutputEnabled(bool enabled){
_outputEnabled = enabled;
emit outputEnabledChanged(_outputEnabled);
}
void Joystick::_buttonAction(const QString& action)
{

4
src/Joystick/Joystick.h

@ -61,7 +61,6 @@ public: @@ -61,7 +61,6 @@ public:
Q_PROPERTY(QString name READ name CONSTANT)
Q_PROPERTY(bool calibrated MEMBER _calibrated NOTIFY calibratedChanged)
Q_PROPERTY(bool outputEnabled MEMBER _outputEnabled WRITE setOutputEnabled NOTIFY outputEnabledChanged)
Q_PROPERTY(int totalButtonCount READ totalButtonCount CONSTANT)
Q_PROPERTY(int axisCount READ axisCount CONSTANT)
@ -129,11 +128,9 @@ public: @@ -129,11 +128,9 @@ public:
/// Set the current calibration mode
void setCalibrationMode(bool calibrating);
void setOutputEnabled(bool enabled);
signals:
void calibratedChanged(bool calibrated);
void outputEnabledChanged(bool enabled);
// The raw signals are only meant for use by calibration
void rawAxisValueChanged(int index, int value);
@ -202,7 +199,6 @@ protected: @@ -202,7 +199,6 @@ protected:
static int _transmitterMode;
bool _calibrationMode;
bool _outputEnabled;
int* _rgAxisValues;
Calibration_t* _rgCalibration;

11
src/VehicleSetup/JoystickConfig.qml

@ -366,15 +366,8 @@ SetupPage { @@ -366,15 +366,8 @@ SetupPage {
id: enabledCheckBox
enabled: _activeJoystick ? _activeJoystick.calibrated : false
text: _activeJoystick ? _activeJoystick.calibrated ? qsTr("Enable joystick input") : qsTr("Enable not allowed (Calibrate First)") : ""
onClicked: _activeJoystick.outputEnabled = checked
Connections {
target: _activeJoystick
onOutputEnabledChanged: {
enabledCheckBox.checked=enabled
}
}
checked: _activeVehicle.joystickEnabled
onClicked: _activeVehicle.joystickEnabled = checked
Connections {
target: joystickManager

Loading…
Cancel
Save