@ -253,14 +253,14 @@ void JoystickConfigController::_inputCenterWaitBegin(Joystick::AxisFunction_t fu
@@ -253,14 +253,14 @@ void JoystickConfigController::_inputCenterWaitBegin(Joystick::AxisFunction_t fu
_nextButton - > setEnabled ( true ) ;
}
bool JoystickConfigController : : _stickSettleComplete ( int value )
bool JoystickConfigController : : _stickSettleComplete ( int axis , int value )
{
// We are waiting for the stick to settle out to a max position
if ( abs ( _stickDetectValue - value ) > _calSettleDelta ) {
// Stick is moving too much to consider stopped
qCDebug ( JoystickConfigControllerLog ) < < " _stickSettleComplete still moving, _stickDetectValue:value " < < _stickDetectValue < < value ;
qCDebug ( JoystickConfigControllerLog ) < < " _stickSettleComplete still moving, axis: _stickDetectValue:value " < < axis < < _stickDetectValue < < value ;
_stickDetectValue = value ;
_stickDetectSettleStarted = false ;
@ -272,12 +272,13 @@ bool JoystickConfigController::_stickSettleComplete(int value)
@@ -272,12 +272,13 @@ bool JoystickConfigController::_stickSettleComplete(int value)
if ( _stickDetectSettleElapsed . elapsed ( ) > _stickDetectSettleMSecs ) {
// Stick has stayed positioned in one place long enough, detection is complete.
qCDebug ( JoystickConfigControllerLog ) < < " _stickSettleComplete detection complete, axis:_stickDetectValue:value " < < axis < < _stickDetectValue < < value ;
return true ;
}
} else {
// Start waiting for the stick to stay settled for _stickDetectSettleWaitMSecs msecs
qCDebug ( JoystickConfigControllerLog ) < < " _stickSettleComplete starting settle timer, _stickDetectValue:value " < < _stickDetectValue < < value ;
qCDebug ( JoystickConfigControllerLog ) < < " _stickSettleComplete starting settle timer, axis: _stickDetectValue:value " < < axis < < _stickDetectValue < < value ;
_stickDetectSettleStarted = true ;
_stickDetectSettleElapsed . start ( ) ;
@ -310,11 +311,9 @@ void JoystickConfigController::_inputStickDetect(Joystick::AxisFunction_t functi
@@ -310,11 +311,9 @@ void JoystickConfigController::_inputStickDetect(Joystick::AxisFunction_t functi
_stickDetectValue = value ;
}
} else if ( axis = = _stickDetectAxis ) {
if ( _stickSettleComplete ( value ) ) {
if ( _stickSettleComplete ( axis , value ) ) {
AxisInfo * info = & _rgAxisInfo [ axis ] ;
qCDebug ( JoystickConfigControllerLog ) < < " _inputStickDetect settle complete, function:axis:value " < < function < < axis < < value ;
// Stick detection is complete. Stick should be at max position.
// Map the axis to the function
_rgFunctionAxisMapping [ function ] = axis ;
@ -322,7 +321,6 @@ void JoystickConfigController::_inputStickDetect(Joystick::AxisFunction_t functi
@@ -322,7 +321,6 @@ void JoystickConfigController::_inputStickDetect(Joystick::AxisFunction_t functi
// Axis should be at max value, if it is below initial set point the the axis is reversed.
info - > reversed = value < _axisValueSave [ axis ] ;
qCDebug ( JoystickConfigControllerLog ) < < " _inputStickDetect reversed:value:_axisValueSave " < < info - > reversed < < value < < _axisValueSave [ axis ] ;
if ( info - > reversed ) {
_rgAxisInfo [ axis ] . axisMin = value ;
@ -330,6 +328,8 @@ void JoystickConfigController::_inputStickDetect(Joystick::AxisFunction_t functi
@@ -330,6 +328,8 @@ void JoystickConfigController::_inputStickDetect(Joystick::AxisFunction_t functi
_rgAxisInfo [ axis ] . axisMax = value ;
}
qCDebug ( JoystickConfigControllerLog ) < < " _inputStickDetect saving values, function:axis:value:reversed:_axisValueSave " < < function < < axis < < value < < info - > reversed < < _axisValueSave [ axis ] ;
_signalAllAttiudeValueChanges ( ) ;
_advanceState ( ) ;
@ -339,6 +339,8 @@ void JoystickConfigController::_inputStickDetect(Joystick::AxisFunction_t functi
@@ -339,6 +339,8 @@ void JoystickConfigController::_inputStickDetect(Joystick::AxisFunction_t functi
void JoystickConfigController : : _inputStickMin ( Joystick : : AxisFunction_t function , int axis , int value )
{
qCDebug ( JoystickConfigControllerLog ) < < " _inputStickMin function:axis:value " < < function < < axis < < value ;
// We only care about the axis mapped to the function we are working on
if ( _rgFunctionAxisMapping [ function ] ! = axis ) {
return ;
@ -351,18 +353,20 @@ void JoystickConfigController::_inputStickMin(Joystick::AxisFunction_t function,
@@ -351,18 +353,20 @@ void JoystickConfigController::_inputStickMin(Joystick::AxisFunction_t function,
_stickDetectAxis = axis ;
_stickDetectInitialValue = value ;
_stickDetectValue = value ;
qCDebug ( JoystickConfigControllerLog ) < < " _inputStickMin detected movement _stickDetectAxis:_stickDetectInitialValue " < < _stickDetectAxis < < _stickDetectInitialValue ;
}
} else {
if ( value < _calCenterPoint - _calMoveDelta ) {
_stickDetectAxis = axis ;
_stickDetectInitialValue = value ;
_stickDetectValue = value ;
qCDebug ( JoystickConfigControllerLog ) < < " _inputStickMin detected movement _stickDetectAxis:_stickDetectInitialValue " < < _stickDetectAxis < < _stickDetectInitialValue ;
}
}
} else {
// We are waiting for the selected axis to settle out
if ( _stickSettleComplete ( value ) ) {
if ( _stickSettleComplete ( axis , value ) ) {
AxisInfo * info = & _rgAxisInfo [ axis ] ;
// Stick detection is complete. Stick should be at min position.
@ -376,8 +380,8 @@ void JoystickConfigController::_inputStickMin(Joystick::AxisFunction_t function,
@@ -376,8 +380,8 @@ void JoystickConfigController::_inputStickMin(Joystick::AxisFunction_t function,
if ( function = = Joystick : : throttleFunction ) {
_rgAxisInfo [ axis ] . axisTrim = value ;
}
// XXX to support configs which can reverse they need to check a reverse
// flag here and not do this.
qCDebug ( JoystickConfigControllerLog ) < < " _inputStickMin saving values, function:axis:value:reversed " < < function < < axis < < value < < info - > reversed ;
_advanceState ( ) ;
}
@ -386,6 +390,8 @@ void JoystickConfigController::_inputStickMin(Joystick::AxisFunction_t function,
@@ -386,6 +390,8 @@ void JoystickConfigController::_inputStickMin(Joystick::AxisFunction_t function,
void JoystickConfigController : : _inputCenterWait ( Joystick : : AxisFunction_t function , int axis , int value )
{
qCDebug ( JoystickConfigControllerLog ) < < " _inputCenterWait function:axis:value " < < function < < axis < < value ;
// We only care about the axis mapped to the function we are working on
if ( _rgFunctionAxisMapping [ function ] ! = axis ) {
return ;
@ -399,9 +405,10 @@ void JoystickConfigController::_inputCenterWait(Joystick::AxisFunction_t functio
@@ -399,9 +405,10 @@ void JoystickConfigController::_inputCenterWait(Joystick::AxisFunction_t functio
_stickDetectAxis = axis ;
_stickDetectInitialValue = value ;
_stickDetectValue = value ;
qCDebug ( JoystickConfigControllerLog ) < < " _inputStickMin detected possible center _stickDetectAxis:_stickDetectInitialValue " < < _stickDetectAxis < < _stickDetectInitialValue ;
}
} else {
if ( _stickSettleComplete ( value ) ) {
if ( _stickSettleComplete ( axis , value ) ) {
_advanceState ( ) ;
}
}