Commit 2c51837f authored by Don Gagne's avatar Don Gagne

Carry over RCCal fix to Stable

parent 456c972a
......@@ -438,8 +438,9 @@ void PX4RCCalibrationTest::_channelHomePosition(void)
_mockUAS->emitRemoteControlChannelRawChanged(i, (float)PX4RCCalibration::_rcCalPWMCenterPoint);
}
// Throttle to low position (throttle is not reversed)/
_mockUAS->emitRemoteControlChannelRawChanged(_rgFunctionChannelMap[PX4RCCalibration::rcCalFunctionThrottle], _testMinValue);
// Throttle to min - 1 (throttle is not reversed). We do this so that the trim value is below the min value. This should end up
// being validated and raised to min value. If not, something is wrong with RC Cal code.
_mockUAS->emitRemoteControlChannelRawChanged(_rgFunctionChannelMap[PX4RCCalibration::rcCalFunctionThrottle], _testMinValue - 1);
}
void PX4RCCalibrationTest::_validateParameters(void)
......
......@@ -860,7 +860,14 @@ void PX4RCCalibration::_validateCalibration(void)
case rcCalFunctionYaw:
case rcCalFunctionRoll:
case rcCalFunctionPitch:
// Make sure trim is within min/max
if (info->rcTrim < info->rcMin) {
info->rcTrim = info->rcMin;
} else if (info->rcTrim > info->rcMax) {
info->rcTrim = info->rcMax;
}
break;
default:
// Non-attitude control channels have calculated trim
info->rcTrim = info->rcMin + ((info->rcMax - info->rcMin) / 2);
......@@ -881,7 +888,6 @@ void PX4RCCalibration::_validateCalibration(void)
/// @brief Saves the rc calibration values to the board parameters.
/// @param trimsOnly true: write only trim values, false: write all calibration values
void PX4RCCalibration::_writeCalibration(void)
{
if (!_mav) return;
......
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