From f890c82c97fcbc3da7878ac0843eabf2b73db458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Wed, 25 Jan 2017 13:40:34 +0100 Subject: [PATCH] mc_att_control_main: remove unnecessary memset for _sensor_correction --- src/modules/mc_att_control/mc_att_control_main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/mc_att_control/mc_att_control_main.cpp b/src/modules/mc_att_control/mc_att_control_main.cpp index ae67a6045c..8e939618fe 100644 --- a/src/modules/mc_att_control/mc_att_control_main.cpp +++ b/src/modules/mc_att_control/mc_att_control_main.cpp @@ -536,8 +536,7 @@ MulticopterAttitudeControl::MulticopterAttitudeControl() : _ts_opt_recovery = new TailsitterRecovery(); } - /* initialize thermal corrections as we might not immediately get a topic update */ - memset(&_sensor_correction, 0, sizeof(_sensor_correction)); + /* initialize thermal corrections as we might not immediately get a topic update (only non-zero values) */ for (unsigned i = 0; i < 3; i++) { // used scale factors to unity _sensor_correction.gyro_scale_0[i] = 1.0f; @@ -1007,6 +1006,7 @@ MulticopterAttitudeControl::control_attitude_rates(float dt) rates(0) = (_sensor_gyro.x - _sensor_correction.gyro_offset_2[0]) * _sensor_correction.gyro_scale_2[0]; rates(1) = (_sensor_gyro.x - _sensor_correction.gyro_offset_2[1]) * _sensor_correction.gyro_scale_2[1]; rates(2) = (_sensor_gyro.x - _sensor_correction.gyro_offset_2[2]) * _sensor_correction.gyro_scale_2[2]; + } else { rates(0) = _sensor_gyro.x; rates(1) = _sensor_gyro.y;