1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-02 06:04:39 -04:00

Rotator Controller: Add additional gamepad calibration and functionality

This commit is contained in:
Jon Beniston
2023-08-05 12:33:01 +01:00
parent 83834674c0
commit 2d7c572040
22 changed files with 1063 additions and 204 deletions
@@ -22,6 +22,23 @@
#include "inputcontroller.h"
double InputController::getAxisCalibratedValue(int axis, InputControllerSettings *settings, bool highSensitvity)
{
double value = getAxisValue(axis);
double absValue = abs(value);
double l = settings->m_deadzone[axis] / 100.0;
if (absValue < l) {
// Set to 0 if in deadzone
value = 0.0;
} else {
// Rescale to [0,1] if outside of deadzone
absValue = (absValue - l) / (1.0 - l);
// Negate if original value was negative
value = (value < 0.0) ? -absValue : absValue;
}
return value * (highSensitvity ? settings->m_highSensitivity : settings->m_lowSensitivity) / 100.0;
}
InputControllerManager* InputControllerManager::m_instance = nullptr;
QStringList InputControllerManager::getAllControllers()