Merge branch 'bugfix-sonar-drift' of git://github.com/nebbian/cleanflight into nebbian-bugfix-sonar-drift

This commit is contained in:
Dominic Clifton 2015-04-14 19:45:54 +01:00
commit beef2e87d7
1 changed files with 6 additions and 6 deletions

View File

@ -89,10 +89,10 @@ static void applyMultirotorAltHold(void)
// multirotor alt hold // multirotor alt hold
if (rcControlsConfig->alt_hold_fast_change) { if (rcControlsConfig->alt_hold_fast_change) {
// rapid alt changes // rapid alt changes
if (ABS(rcCommand[THROTTLE] - initialThrottleHold) > rcControlsConfig->alt_hold_deadband) { if (ABS(rcData[THROTTLE] - initialThrottleHold) > rcControlsConfig->alt_hold_deadband) {
errorVelocityI = 0; errorVelocityI = 0;
isAltHoldChanged = 1; isAltHoldChanged = 1;
rcCommand[THROTTLE] += (rcCommand[THROTTLE] > initialThrottleHold) ? -rcControlsConfig->alt_hold_deadband : rcControlsConfig->alt_hold_deadband; rcCommand[THROTTLE] += (rcData[THROTTLE] > initialThrottleHold) ? -rcControlsConfig->alt_hold_deadband : rcControlsConfig->alt_hold_deadband;
} else { } else {
if (isAltHoldChanged) { if (isAltHoldChanged) {
AltHold = EstAlt; AltHold = EstAlt;
@ -102,9 +102,9 @@ static void applyMultirotorAltHold(void)
} }
} else { } else {
// slow alt changes, mostly used for aerial photography // slow alt changes, mostly used for aerial photography
if (ABS(rcCommand[THROTTLE] - initialThrottleHold) > rcControlsConfig->alt_hold_deadband) { if (ABS(rcData[THROTTLE] - initialThrottleHold) > rcControlsConfig->alt_hold_deadband) {
// set velocity proportional to stick movement +100 throttle gives ~ +50 cm/s // set velocity proportional to stick movement +100 throttle gives ~ +50 cm/s
setVelocity = (rcCommand[THROTTLE] - initialThrottleHold) / 2; setVelocity = (rcData[THROTTLE] - initialThrottleHold) / 2;
velocityControl = 1; velocityControl = 1;
isAltHoldChanged = 1; isAltHoldChanged = 1;
} else if (isAltHoldChanged) { } else if (isAltHoldChanged) {
@ -145,7 +145,7 @@ void updateAltHoldState(void)
if (!FLIGHT_MODE(BARO_MODE)) { if (!FLIGHT_MODE(BARO_MODE)) {
ENABLE_FLIGHT_MODE(BARO_MODE); ENABLE_FLIGHT_MODE(BARO_MODE);
AltHold = EstAlt; AltHold = EstAlt;
initialThrottleHold = rcCommand[THROTTLE]; initialThrottleHold = rcData[THROTTLE];
errorVelocityI = 0; errorVelocityI = 0;
altHoldThrottleAdjustment = 0; altHoldThrottleAdjustment = 0;
} }
@ -162,7 +162,7 @@ void updateSonarAltHoldState(void)
if (!FLIGHT_MODE(SONAR_MODE)) { if (!FLIGHT_MODE(SONAR_MODE)) {
ENABLE_FLIGHT_MODE(SONAR_MODE); ENABLE_FLIGHT_MODE(SONAR_MODE);
AltHold = EstAlt; AltHold = EstAlt;
initialThrottleHold = rcCommand[THROTTLE]; initialThrottleHold = rcData[THROTTLE];
errorVelocityI = 0; errorVelocityI = 0;
altHoldThrottleAdjustment = 0; altHoldThrottleAdjustment = 0;
} }