aboutsummaryrefslogtreecommitdiff
path: root/src/modules/commander/accelerometer_calibration.cpp
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2014-06-30 10:04:34 +0200
committerLorenz Meier <lm@inf.ethz.ch>2014-06-30 10:04:34 +0200
commit6aed623b6c2490c43bc6c36fbcef36f9181f7c8c (patch)
tree9852c4389a23bd06dda3fd0534985a3d537c0602 /src/modules/commander/accelerometer_calibration.cpp
parent154f14e7476780799108e16bc3c296f0ade85f7b (diff)
parent857b843d445f59f2dc393e4d5f879fc56f77a0e0 (diff)
downloadpx4-firmware-6aed623b6c2490c43bc6c36fbcef36f9181f7c8c.tar.gz
px4-firmware-6aed623b6c2490c43bc6c36fbcef36f9181f7c8c.tar.bz2
px4-firmware-6aed623b6c2490c43bc6c36fbcef36f9181f7c8c.zip
Merge branch 'master' of github.com:PX4/Firmware into power_enforce
Diffstat (limited to 'src/modules/commander/accelerometer_calibration.cpp')
-rw-r--r--src/modules/commander/accelerometer_calibration.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/modules/commander/accelerometer_calibration.cpp b/src/modules/commander/accelerometer_calibration.cpp
index 7180048ff..24da452b1 100644
--- a/src/modules/commander/accelerometer_calibration.cpp
+++ b/src/modules/commander/accelerometer_calibration.cpp
@@ -158,6 +158,8 @@ int calculate_calibration_values(float accel_ref[6][3], float accel_T[3][3], flo
int do_accel_calibration(int mavlink_fd)
{
+ int fd;
+
mavlink_log_info(mavlink_fd, CAL_STARTED_MSG, sensor_name);
struct accel_scale accel_scale = {
@@ -172,7 +174,7 @@ int do_accel_calibration(int mavlink_fd)
int res = OK;
/* reset all offsets to zero and all scales to one */
- int fd = open(ACCEL_DEVICE_PATH, 0);
+ fd = open(ACCEL_DEVICE_PATH, 0);
res = ioctl(fd, ACCELIOCSSCALE, (long unsigned int)&accel_scale);
close(fd);
@@ -223,7 +225,7 @@ int do_accel_calibration(int mavlink_fd)
if (res == OK) {
/* apply new scaling and offsets */
- int fd = open(ACCEL_DEVICE_PATH, 0);
+ fd = open(ACCEL_DEVICE_PATH, 0);
res = ioctl(fd, ACCELIOCSSCALE, (long unsigned int)&accel_scale);
close(fd);