Commit f8a07f3c authored by Jacob Walser's avatar Jacob Walser

Disable joystick TX mode selection during calibration

parent 21099441
...@@ -659,6 +659,7 @@ SetupPage { ...@@ -659,6 +659,7 @@ SetupPage {
exclusiveGroup: modeGroup exclusiveGroup: modeGroup
text: "1" text: "1"
checked: controller.transmitterMode == 1 checked: controller.transmitterMode == 1
enabled: !controller.calibrating
onClicked: controller.transmitterMode = 1 onClicked: controller.transmitterMode = 1
} }
...@@ -667,6 +668,7 @@ SetupPage { ...@@ -667,6 +668,7 @@ SetupPage {
exclusiveGroup: modeGroup exclusiveGroup: modeGroup
text: "2" text: "2"
checked: controller.transmitterMode == 2 checked: controller.transmitterMode == 2
enabled: !controller.calibrating
onClicked: controller.transmitterMode = 2 onClicked: controller.transmitterMode = 2
} }
...@@ -675,6 +677,7 @@ SetupPage { ...@@ -675,6 +677,7 @@ SetupPage {
exclusiveGroup: modeGroup exclusiveGroup: modeGroup
text: "3" text: "3"
checked: controller.transmitterMode == 3 checked: controller.transmitterMode == 3
enabled: !controller.calibrating
onClicked: controller.transmitterMode = 3 onClicked: controller.transmitterMode = 3
} }
...@@ -683,6 +686,7 @@ SetupPage { ...@@ -683,6 +686,7 @@ SetupPage {
exclusiveGroup: modeGroup exclusiveGroup: modeGroup
text: "4" text: "4"
checked: controller.transmitterMode == 4 checked: controller.transmitterMode == 4
enabled: !controller.calibrating
onClicked: controller.transmitterMode = 4 onClicked: controller.transmitterMode = 4
} }
......
...@@ -597,6 +597,7 @@ void JoystickConfigController::_startCalibration(void) ...@@ -597,6 +597,7 @@ void JoystickConfigController::_startCalibration(void)
_currentStep = 0; _currentStep = 0;
_setupCurrentState(); _setupCurrentState();
emit calibratingChanged();
} }
/// @brief Cancels the calibration process, setting things back to initial state. /// @brief Cancels the calibration process, setting things back to initial state.
...@@ -615,6 +616,7 @@ void JoystickConfigController::_stopCalibration(void) ...@@ -615,6 +616,7 @@ void JoystickConfigController::_stopCalibration(void)
_skipButton->setEnabled(false); _skipButton->setEnabled(false);
_setHelpImage(_imageCenter); _setHelpImage(_imageCenter);
emit calibratingChanged();
} }
/// @brief Saves the current axis values, so that we can detect when the use moves an input. /// @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) ...@@ -810,7 +812,7 @@ void JoystickConfigController::setTransmitterMode(int mode)
{ {
if (mode > 0 && mode <= 4) { if (mode > 0 && mode <= 4) {
_transmitterMode = mode; _transmitterMode = mode;
if (_currentStep != -1) { if (_currentStep != -1) { // This should never be true, mode selection is disabled during calibration
const stateMachineEntry* state = _getStateMachineEntry(_currentStep); const stateMachineEntry* state = _getStateMachineEntry(_currentStep);
_setHelpImage(state->image); _setHelpImage(state->image);
} else { } else {
......
...@@ -71,6 +71,7 @@ public: ...@@ -71,6 +71,7 @@ public:
Q_PROPERTY(int transmitterMode READ transmitterMode WRITE setTransmitterMode NOTIFY transmitterModeChanged) Q_PROPERTY(int transmitterMode READ transmitterMode WRITE setTransmitterMode NOTIFY transmitterModeChanged)
Q_PROPERTY(QString imageHelp MEMBER _imageHelp NOTIFY imageHelpChanged) Q_PROPERTY(QString imageHelp MEMBER _imageHelp NOTIFY imageHelpChanged)
Q_PROPERTY(bool calibrating READ calibrating NOTIFY calibratingChanged)
Q_INVOKABLE void cancelButtonClicked(void); Q_INVOKABLE void cancelButtonClicked(void);
Q_INVOKABLE void skipButtonClicked(void); Q_INVOKABLE void skipButtonClicked(void);
...@@ -104,6 +105,8 @@ public: ...@@ -104,6 +105,8 @@ public:
int transmitterMode(void) { return _transmitterMode; } int transmitterMode(void) { return _transmitterMode; }
void setTransmitterMode(int mode); void setTransmitterMode(int mode);
bool calibrating(void) { return _currentStep != -1; }
signals: signals:
void axisValueChanged(int axis, int value); void axisValueChanged(int axis, int value);
...@@ -132,6 +135,7 @@ signals: ...@@ -132,6 +135,7 @@ signals:
void imageHelpChanged(QString source); void imageHelpChanged(QString source);
void transmitterModeChanged(int mode); 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 // @brief Signalled when in unit test mode and a message box should be displayed by the next button
void nextButtonMessageBoxDisplayed(void); void nextButtonMessageBoxDisplayed(void);
......
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