1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-18 08:54:15 +01:00

Switch order of some commands to make sure it loads the correct hover throttle

This commit is contained in:
James Cotton 2012-02-08 20:47:10 -06:00
parent ab41bae071
commit 80d602ef7b

View File

@ -108,6 +108,8 @@ float decay;
float velocity_decay;
bool running = false;
float error;
float switchThrottle;
float smoothed_altitude;
/**
* Module thread, should not return.
@ -191,12 +193,14 @@ static void altitudeHoldTask(void *parameters)
FlightStatusGet(&flightStatus);
if(flightStatus.FlightMode == FLIGHTSTATUS_FLIGHTMODE_ALTITUDEHOLD && !running) {
BaroAltitudeConnectQueue(queue);
// Copy the current throttle as a starting point for integral
StabilizationDesiredThrottleGet(&throttleIntegral);
BaroAltitudeAltitudeGet(&lastAltitude);
switchThrottle = throttleIntegral;
error = 0;
velocity = 0;
running = true;
BaroAltitudeAltitudeGet(&lastAltitude);
BaroAltitudeConnectQueue(queue);
}
} else if (ev.obj == AltitudeHoldDesiredHandle()) {