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:
parent
ab41bae071
commit
80d602ef7b
@ -108,6 +108,8 @@ float decay;
|
|||||||
float velocity_decay;
|
float velocity_decay;
|
||||||
bool running = false;
|
bool running = false;
|
||||||
float error;
|
float error;
|
||||||
|
float switchThrottle;
|
||||||
|
float smoothed_altitude;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Module thread, should not return.
|
* Module thread, should not return.
|
||||||
@ -191,12 +193,14 @@ static void altitudeHoldTask(void *parameters)
|
|||||||
FlightStatusGet(&flightStatus);
|
FlightStatusGet(&flightStatus);
|
||||||
|
|
||||||
if(flightStatus.FlightMode == FLIGHTSTATUS_FLIGHTMODE_ALTITUDEHOLD && !running) {
|
if(flightStatus.FlightMode == FLIGHTSTATUS_FLIGHTMODE_ALTITUDEHOLD && !running) {
|
||||||
BaroAltitudeConnectQueue(queue);
|
|
||||||
// Copy the current throttle as a starting point for integral
|
// Copy the current throttle as a starting point for integral
|
||||||
StabilizationDesiredThrottleGet(&throttleIntegral);
|
StabilizationDesiredThrottleGet(&throttleIntegral);
|
||||||
BaroAltitudeAltitudeGet(&lastAltitude);
|
switchThrottle = throttleIntegral;
|
||||||
error = 0;
|
error = 0;
|
||||||
|
velocity = 0;
|
||||||
running = true;
|
running = true;
|
||||||
|
BaroAltitudeAltitudeGet(&lastAltitude);
|
||||||
|
BaroAltitudeConnectQueue(queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (ev.obj == AltitudeHoldDesiredHandle()) {
|
} else if (ev.obj == AltitudeHoldDesiredHandle()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user