From 2b30e53ab56b48a172f23b8767bad4fda1660378 Mon Sep 17 00:00:00 2001 From: Paul Nykiel Date: Sun, 5 Apr 2020 12:29:12 +0200 Subject: [PATCH] Fixed a bug in the output filter --- Filters/OutputFilter/OutputFilter.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Filters/OutputFilter/OutputFilter.cpp b/Filters/OutputFilter/OutputFilter.cpp index ca19288..e250a8a 100644 --- a/Filters/OutputFilter/OutputFilter.cpp +++ b/Filters/OutputFilter/OutputFilter.cpp @@ -50,14 +50,20 @@ namespace filter { networkOutPkg.setChannel(1, static_cast(control.state.altitudeAboveGround * 10)); networkOutPkg.setChannel(2, static_cast(control.state.lat * 10)); networkOutPkg.setChannel(3, static_cast(control.state.lon * 10)); - networkOutPkg.setChannel(4, static_cast(control.state.roll*2 + 500)); - networkOutPkg.setChannel(5, static_cast(control.state.pitch*2 + 500)); - networkOutPkg.setChannel(6, static_cast(control.state.yaw*2 + 500)); + networkOutPkg.setChannel(4, static_cast(control.state.roll * 2 + 500)); + networkOutPkg.setChannel(5, static_cast(control.state.pitch * 2 + 500)); + networkOutPkg.setChannel(6, static_cast(control.state.yaw * 2 + 500)); networkOutPkg.setChannel(7, static_cast(control.state.speed * 10)); networkOutPkg.setChannel(8, static_cast(control.state.altitude)); - networkOutPkg.setChannel(9, static_cast(control.state.accX * 10) + 500); - networkOutPkg.setChannel(10, static_cast(control.state.accY * 10) + 500); - networkOutPkg.setChannel(11, static_cast(control.state.accZ * 10) + 500); + networkOutPkg.setChannel(9, + static_cast(static_cast(control.state.accX * 10) + + 500)); + networkOutPkg.setChannel(10, + static_cast(static_cast(control.state.accY * 10) + + 500)); + networkOutPkg.setChannel(11, + static_cast(static_cast(control.state.accZ * 10) + + 500)); networkOutPkg.setChannel(12, static_cast(control.state.pdbPackage.voltageVcc * 50)); flightControllerOut.put(serialOutPkg);