From d0ea4e887620cd23525bc8cd0c4a5f4b612f4309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Wed, 25 Jan 2017 14:53:44 +0100 Subject: [PATCH] accelerometer_calibration: cleanup --- src/modules/commander/accelerometer_calibration.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/modules/commander/accelerometer_calibration.cpp b/src/modules/commander/accelerometer_calibration.cpp index 8c3196cb4f..977282dc5e 100644 --- a/src/modules/commander/accelerometer_calibration.cpp +++ b/src/modules/commander/accelerometer_calibration.cpp @@ -320,11 +320,10 @@ int do_accel_calibration(orb_advert_t *mavlink_log_pub) int32_t handle; float val; for (unsigned axis_index = 0; axis_index < 3; axis_index++) { - handle = -1; val = 0.0f; (void)sprintf(str, "TC_A%u_X0_%u", sensor_correction.accel_mapping[uorb_index], axis_index); handle = param_find(str); - param_get(handle, &(val)); + param_get(handle, &val); if (axis_index == 0) { val += accel_scale.x_offset; } else if (axis_index == 1) { @@ -332,14 +331,13 @@ int do_accel_calibration(orb_advert_t *mavlink_log_pub) } else if (axis_index == 2) { val += accel_scale.z_offset; } - failed |= (PX4_OK != param_set_no_notification(param_find(str), &(val))); + failed |= (PX4_OK != param_set_no_notification(handle, &val)); } for (unsigned axis_index = 0; axis_index < 3; axis_index++) { - handle = -1; val = 1.0f; (void)sprintf(str, "TC_A%u_SCL_%u", sensor_correction.accel_mapping[uorb_index], axis_index); handle = param_find(str); - param_get(handle, &(val)); + param_get(handle, &val); if (axis_index == 0) { val *= accel_scale.x_scale; } else if (axis_index == 1) { @@ -347,7 +345,7 @@ int do_accel_calibration(orb_advert_t *mavlink_log_pub) } else if (axis_index == 2) { val *= accel_scale.z_scale; } - failed |= (PX4_OK != param_set_no_notification(param_find(str), &(val))); + failed |= (PX4_OK != param_set_no_notification(handle, &val)); } // Ensure the calibration values used the driver are at default settings