From 4d62dd893b92c2698416d105400fbd7c1c4ad8e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Thu, 6 Apr 2017 10:40:03 +0200 Subject: [PATCH] tap_esc: handle lockdown & manual_lockdown -> kill switch --- src/drivers/tap_esc/tap_esc.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/drivers/tap_esc/tap_esc.cpp b/src/drivers/tap_esc/tap_esc.cpp index a337a001a0..ac4706d984 100644 --- a/src/drivers/tap_esc/tap_esc.cpp +++ b/src/drivers/tap_esc/tap_esc.cpp @@ -665,15 +665,15 @@ TAP_ESC::cycle() /* iterate actuators */ for (unsigned i = 0; i < num_outputs; i++) { /* last resort: catch NaN, INF and out-of-band errors */ - if (i < _outputs.noutputs && - PX4_ISFINITE(_outputs.output[i])) { + if (i < _outputs.noutputs && PX4_ISFINITE(_outputs.output[i]) + && !_armed.lockdown && !_armed.manual_lockdown) { /* scale for PWM output 1200 - 1900us */ _outputs.output[i] = (RPMMAX + RPMMIN) / 2 + ((RPMMAX - RPMMIN) / 2) * _outputs.output[i]; math::constrain(_outputs.output[i], (float)RPMMIN, (float)RPMMAX); } else { /* - * Value is NaN, INF - stop the motor. + * Value is NaN, INF, or we are in lockdown - stop the motor. * This will be clearly visible on the servo status and will limit the risk of accidentally * spinning motors. It would be deadly in flight. */ @@ -787,7 +787,6 @@ TAP_ESC::cycle() } } - /* do not obey the lockdown value, as lockdown is for PWMSim */ _is_armed = _armed.armed; }