From e18a1014b37f79a07ab54a95a2292dedc8377579 Mon Sep 17 00:00:00 2001 From: dlwalter Date: Mon, 19 Aug 2019 10:44:32 -0700 Subject: [PATCH] added logic to encode NAN as INT16_MAX to transfer to IO from FMU changed px4io control check to isnan from not isfinite changed logic to isnan from NOT isfinite for NAN encoding style fix removed extra lines another style fix another style fix another style fix fixed some merge duplication style fixes --- src/drivers/px4io/px4io.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index b66c4a68c768..015a1d27d2dc 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -1305,14 +1305,14 @@ PX4IO::io_set_control_state(unsigned group) /* ensure FLOAT_TO_REG does not produce an integer overflow */ const float ctrl = math::constrain(controls.control[i], -1.0f, 1.0f); - if (!isfinite(ctrl)) { + if (isnan(ctrl)) { + //Encode NAN as INT16_MAX for disarm passthrough regs[i] = INT16_MAX; } else { regs[i] = FLOAT_TO_REG(ctrl); } - } if (!_test_fmu_fail) {