From 328ad9eeee8b5f3ea7c139491ede47b9b3a4f13f Mon Sep 17 00:00:00 2001 From: nanthony21 Date: Fri, 30 Mar 2018 20:14:18 -0500 Subject: [PATCH] joystick.outputMode is redundant since the vehicle class has its own "joystickEnabled" --- src/Joystick/Joystick.cc | 12 +----------- src/Joystick/Joystick.h | 4 ---- src/VehicleSetup/JoystickConfig.qml | 11 ++--------- 3 files changed, 3 insertions(+), 24 deletions(-) diff --git a/src/Joystick/Joystick.cc b/src/Joystick/Joystick.cc index c21a843d0..cb7a00b61 100644 --- a/src/Joystick/Joystick.cc +++ b/src/Joystick/Joystick.cc @@ -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) 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) { diff --git a/src/Joystick/Joystick.h b/src/Joystick/Joystick.h index 6394848ad..d3469903f 100644 --- a/src/Joystick/Joystick.h +++ b/src/Joystick/Joystick.h @@ -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: /// 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: static int _transmitterMode; bool _calibrationMode; - bool _outputEnabled; int* _rgAxisValues; Calibration_t* _rgCalibration; diff --git a/src/VehicleSetup/JoystickConfig.qml b/src/VehicleSetup/JoystickConfig.qml index d5112b14d..5895ab3fc 100644 --- a/src/VehicleSetup/JoystickConfig.qml +++ b/src/VehicleSetup/JoystickConfig.qml @@ -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 -- 2.22.0