Commit 41a99412 authored by nanthony21's avatar nanthony21 Committed by Nick Anthony

Made deadband adjustable by click and drag.

parent 9dd91ffc
......@@ -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
......
......@@ -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) {
......
......@@ -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);
......
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