diff options
author | Thomas Gubler <thomasgubler@gmail.com> | 2014-06-26 07:47:46 +0200 |
---|---|---|
committer | Thomas Gubler <thomasgubler@gmail.com> | 2014-06-26 07:47:46 +0200 |
commit | 831a3d4ed14bc068ee086c5190af96ad809f67d7 (patch) | |
tree | 4e99eed31603c7a465212bc32b535722e55d40b4 /src/modules/fw_pos_control_l1/mtecs | |
parent | 6d8dfd78f11fdff038f7f7504c507d25429db195 (diff) | |
download | px4-firmware-831a3d4ed14bc068ee086c5190af96ad809f67d7.tar.gz px4-firmware-831a3d4ed14bc068ee086c5190af96ad809f67d7.tar.bz2 px4-firmware-831a3d4ed14bc068ee086c5190af96ad809f67d7.zip |
mtecs: improve logic readability
Diffstat (limited to 'src/modules/fw_pos_control_l1/mtecs')
-rw-r--r-- | src/modules/fw_pos_control_l1/mtecs/mTecs.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/modules/fw_pos_control_l1/mtecs/mTecs.cpp b/src/modules/fw_pos_control_l1/mtecs/mTecs.cpp index 03353cbc1..48c9079a4 100644 --- a/src/modules/fw_pos_control_l1/mtecs/mTecs.cpp +++ b/src/modules/fw_pos_control_l1/mtecs/mTecs.cpp @@ -199,8 +199,8 @@ int mTecs::updateFlightPathAngleAcceleration(float flightPathAngle, float flight } /* Set special ouput limiters if we are not in TECS_MODE_NORMAL */ - BlockOutputLimiter *outputLimiterThrottle = NULL; // NULL --> use standard inflight limits - BlockOutputLimiter *outputLimiterPitch = NULL; // NULL --> use standard inflight limits + BlockOutputLimiter *outputLimiterThrottle = &_controlTotalEnergy.getOutputLimiter(); + BlockOutputLimiter *outputLimiterPitch = &_controlEnergyDistribution.getOutputLimiter(); if (mode == TECS_MODE_TAKEOFF) { outputLimiterThrottle = &_BlockOutputLimiterTakeoffThrottle; //XXX: accept prelaunch values from launchdetector 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 * parameters such as pitch limits with takeoff waypoints or throttle limits when the launchdetector * is running) */ - bool limitApplied = limitOverride.applyOverride(outputLimiterThrottle == NULL ? - _controlTotalEnergy.getOutputLimiter() : - *outputLimiterThrottle, - outputLimiterPitch == NULL ? - _controlEnergyDistribution.getOutputLimiter() : - *outputLimiterPitch); + bool limitApplied = limitOverride.applyOverride(*outputLimiterThrottle, *outputLimiterPitch); /* Write part of the status message */ _status.airspeedDerivativeSp = airspeedDerivativeSp; |