From f8a07f3c165b2eb20e5fd3fe0796d0122568f759 Mon Sep 17 00:00:00 2001 From: Jacob Walser Date: Tue, 24 Jan 2017 17:06:50 -0500 Subject: [PATCH] Disable joystick TX mode selection during calibration --- src/VehicleSetup/JoystickConfig.qml | 4 ++++ src/VehicleSetup/JoystickConfigController.cc | 4 +++- src/VehicleSetup/JoystickConfigController.h | 4 ++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/VehicleSetup/JoystickConfig.qml b/src/VehicleSetup/JoystickConfig.qml index 2e243a7ef..ce68595db 100644 --- a/src/VehicleSetup/JoystickConfig.qml +++ b/src/VehicleSetup/JoystickConfig.qml @@ -659,6 +659,7 @@ SetupPage { exclusiveGroup: modeGroup text: "1" checked: controller.transmitterMode == 1 + enabled: !controller.calibrating onClicked: controller.transmitterMode = 1 } @@ -667,6 +668,7 @@ SetupPage { exclusiveGroup: modeGroup text: "2" checked: controller.transmitterMode == 2 + enabled: !controller.calibrating onClicked: controller.transmitterMode = 2 } @@ -675,6 +677,7 @@ SetupPage { exclusiveGroup: modeGroup text: "3" checked: controller.transmitterMode == 3 + enabled: !controller.calibrating onClicked: controller.transmitterMode = 3 } @@ -683,6 +686,7 @@ SetupPage { exclusiveGroup: modeGroup text: "4" checked: controller.transmitterMode == 4 + enabled: !controller.calibrating onClicked: controller.transmitterMode = 4 } diff --git a/src/VehicleSetup/JoystickConfigController.cc b/src/VehicleSetup/JoystickConfigController.cc index 13bdd5641..4af0546dd 100644 --- a/src/VehicleSetup/JoystickConfigController.cc +++ b/src/VehicleSetup/JoystickConfigController.cc @@ -597,6 +597,7 @@ void JoystickConfigController::_startCalibration(void) _currentStep = 0; _setupCurrentState(); + emit calibratingChanged(); } /// @brief Cancels the calibration process, setting things back to initial state. @@ -615,6 +616,7 @@ void JoystickConfigController::_stopCalibration(void) _skipButton->setEnabled(false); _setHelpImage(_imageCenter); + emit calibratingChanged(); } /// @brief Saves the current axis values, so that we can detect when the use moves an input. @@ -810,7 +812,7 @@ void JoystickConfigController::setTransmitterMode(int mode) { if (mode > 0 && mode <= 4) { _transmitterMode = mode; - if (_currentStep != -1) { + if (_currentStep != -1) { // This should never be true, mode selection is disabled during calibration const stateMachineEntry* state = _getStateMachineEntry(_currentStep); _setHelpImage(state->image); } else { diff --git a/src/VehicleSetup/JoystickConfigController.h b/src/VehicleSetup/JoystickConfigController.h index ba6ee8960..c0c709c72 100644 --- a/src/VehicleSetup/JoystickConfigController.h +++ b/src/VehicleSetup/JoystickConfigController.h @@ -71,6 +71,7 @@ public: Q_PROPERTY(int transmitterMode READ transmitterMode WRITE setTransmitterMode NOTIFY transmitterModeChanged) Q_PROPERTY(QString imageHelp MEMBER _imageHelp NOTIFY imageHelpChanged) + Q_PROPERTY(bool calibrating READ calibrating NOTIFY calibratingChanged) Q_INVOKABLE void cancelButtonClicked(void); Q_INVOKABLE void skipButtonClicked(void); @@ -104,6 +105,8 @@ public: int transmitterMode(void) { return _transmitterMode; } void setTransmitterMode(int mode); + + bool calibrating(void) { return _currentStep != -1; } signals: void axisValueChanged(int axis, int value); @@ -132,6 +135,7 @@ signals: void imageHelpChanged(QString source); void transmitterModeChanged(int mode); + void calibratingChanged(void); // @brief Signalled when in unit test mode and a message box should be displayed by the next button void nextButtonMessageBoxDisplayed(void); -- 2.22.0