mtecs: improve logic readability

This commit is contained in:
Thomas Gubler 2014-06-26 07:47:46 +02:00
parent 6d8dfd78f1
commit 831a3d4ed1
1 changed files with 3 additions and 8 deletions

View File

@ -199,8 +199,8 @@ int mTecs::updateFlightPathAngleAcceleration(float flightPathAngle, float flight
} }
/* Set special ouput limiters if we are not in TECS_MODE_NORMAL */ /* Set special ouput limiters if we are not in TECS_MODE_NORMAL */
BlockOutputLimiter *outputLimiterThrottle = NULL; // NULL --> use standard inflight limits BlockOutputLimiter *outputLimiterThrottle = &_controlTotalEnergy.getOutputLimiter();
BlockOutputLimiter *outputLimiterPitch = NULL; // NULL --> use standard inflight limits BlockOutputLimiter *outputLimiterPitch = &_controlEnergyDistribution.getOutputLimiter();
if (mode == TECS_MODE_TAKEOFF) { if (mode == TECS_MODE_TAKEOFF) {
outputLimiterThrottle = &_BlockOutputLimiterTakeoffThrottle; //XXX: accept prelaunch values from launchdetector outputLimiterThrottle = &_BlockOutputLimiterTakeoffThrottle; //XXX: accept prelaunch values from launchdetector
outputLimiterPitch = &_BlockOutputLimiterTakeoffPitch; outputLimiterPitch = &_BlockOutputLimiterTakeoffPitch;
@ -218,12 +218,7 @@ int mTecs::updateFlightPathAngleAcceleration(float flightPathAngle, float flight
/* Apply overrride given by the limitOverride argument (this is used for limits which are not given by /* Apply overrride given by the limitOverride argument (this is used for limits which are not given by
* parameters such as pitch limits with takeoff waypoints or throttle limits when the launchdetector * parameters such as pitch limits with takeoff waypoints or throttle limits when the launchdetector
* is running) */ * is running) */
bool limitApplied = limitOverride.applyOverride(outputLimiterThrottle == NULL ? bool limitApplied = limitOverride.applyOverride(*outputLimiterThrottle, *outputLimiterPitch);
_controlTotalEnergy.getOutputLimiter() :
*outputLimiterThrottle,
outputLimiterPitch == NULL ?
_controlEnergyDistribution.getOutputLimiter() :
*outputLimiterPitch);
/* Write part of the status message */ /* Write part of the status message */
_status.airspeedDerivativeSp = airspeedDerivativeSp; _status.airspeedDerivativeSp = airspeedDerivativeSp;