diff --git a/src/VehicleSetup/JoystickConfig.qml b/src/VehicleSetup/JoystickConfig.qml index ba35a3bdca10ec4dc9562279195748d9534177b5..adf391f22bb23bfea832fab38502351127ace32e 100644 --- a/src/VehicleSetup/JoystickConfig.qml +++ b/src/VehicleSetup/JoystickConfig.qml @@ -796,7 +796,28 @@ SetupPage { property real defaultTextWidth: ScreenTools.defaultFontPixelWidth property bool mapped: true readonly property bool reversed: false + + + MouseArea { + id: deadbandMouseArea + anchors.fill: parent.item + + property real startY + + onPressed: { + startY = mouseY + } + onPositionChanged: { + var newValue = parent.item.deadbandValue + (startY - mouseY)*15 + if ((newValue > 0) && (newValue <32768)){parent.item.deadbandValue=newValue;} + startY = mouseY + } + onReleased: { + controller.setDeadbandValue(modelData,parent.item.deadbandValue) + } + } } + } } } // Column - Axis Monitor diff --git a/src/VehicleSetup/JoystickConfigController.cc b/src/VehicleSetup/JoystickConfigController.cc index 6168ce338f5052136ad9fc2fe9014fc7daa0846b..67a3ffa1ea6805f84aaeda0eb6f1216c79a5c90c 100644 --- a/src/VehicleSetup/JoystickConfigController.cc +++ b/src/VehicleSetup/JoystickConfigController.cc @@ -71,6 +71,15 @@ void JoystickConfigController::start(void) _stopCalibration(); } +void JoystickConfigController::setDeadbandValue(int axis, int value) +{ + _axisDeadbandChanged(axis,value); + Joystick* joystick = _joystickManager->activeJoystick(); + Joystick::Calibration_t calibration = joystick->getCalibration(axis); + calibration.deadband = value; + joystick->setCalibration(axis,calibration); +} + JoystickConfigController::~JoystickConfigController() { if(_activeJoystick) { diff --git a/src/VehicleSetup/JoystickConfigController.h b/src/VehicleSetup/JoystickConfigController.h index d0e1faf231b5324ca8cb6eac1b024b3010f6cb4b..19d826d8c3a973412b134244a0e1217f0deecf71 100644 --- a/src/VehicleSetup/JoystickConfigController.h +++ b/src/VehicleSetup/JoystickConfigController.h @@ -67,6 +67,7 @@ public: Q_INVOKABLE void skipButtonClicked(void); Q_INVOKABLE void nextButtonClicked(void); Q_INVOKABLE void start(void); + Q_INVOKABLE void setDeadbandValue(int axis, int value); bool rollAxisMapped(void); bool pitchAxisMapped(void);