Commit fa519897 authored by Lorenz Meier's avatar Lorenz Meier

Joystick: Fix magic numbers with integer overflow

parent 2b4453e5
......@@ -124,7 +124,7 @@ void Joystick::_loadSettings(void)
calibration->min = settings.value(minTpl.arg(axis), -32768).toInt(&convertOk);
badSettings |= !convertOk;
calibration->max = settings.value(maxTpl.arg(axis), 32768).toInt(&convertOk);
calibration->max = settings.value(maxTpl.arg(axis), 32767).toInt(&convertOk);
badSettings |= !convertOk;
calibration->reversed = settings.value(revTpl.arg(axis), false).toBool();
......
......@@ -32,9 +32,9 @@ QGC_LOGGING_CATEGORY(JoystickConfigControllerLog, "JoystickConfigControllerLog")
const int JoystickConfigController::_updateInterval = 150; ///< Interval for timer which updates radio channel widgets
const int JoystickConfigController::_calCenterPoint = 0;
const int JoystickConfigController::_calValidMinValue = -32768; ///< Largest valid minimum axis value
const int JoystickConfigController::_calValidMaxValue = 32768; ///< Smallest valid maximum axis value
const int JoystickConfigController::_calValidMaxValue = 32767; ///< Smallest valid maximum axis value
const int JoystickConfigController::_calDefaultMinValue = -32768; ///< Default value for Min if not set
const int JoystickConfigController::_calDefaultMaxValue = 32768; ///< Default value for Max if not set
const int JoystickConfigController::_calDefaultMaxValue = 32767; ///< Default value for Max if not set
const int JoystickConfigController::_calRoughCenterDelta = 500; ///< Delta around center point which is considered to be roughly centered
const int JoystickConfigController::_calMoveDelta = 32768/2; ///< Amount of delta past center which is considered stick movement
const int JoystickConfigController::_calSettleDelta = 100; ///< Amount of delta which is considered no stick movement
......
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