aboutsummaryrefslogtreecommitdiff
path: root/src/modules/sensors/sensors.cpp
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2015-02-09 13:58:49 +0100
committerLorenz Meier <lm@inf.ethz.ch>2015-02-09 22:56:25 +0100
commit3a436498507974f7286d6d18d27c1f8bd1f5f9e8 (patch)
tree9c192603ce7a610f12dd18cc7c06396e6ecab3bf /src/modules/sensors/sensors.cpp
parent8b5e54f7650b15cf0dd868f3d4acf76fdeefe2b8 (diff)
downloadpx4-firmware-3a436498507974f7286d6d18d27c1f8bd1f5f9e8.tar.gz
px4-firmware-3a436498507974f7286d6d18d27c1f8bd1f5f9e8.tar.bz2
px4-firmware-3a436498507974f7286d6d18d27c1f8bd1f5f9e8.zip
sensors app: Fix loading of calibration params
Diffstat (limited to 'src/modules/sensors/sensors.cpp')
-rw-r--r--src/modules/sensors/sensors.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/modules/sensors/sensors.cpp b/src/modules/sensors/sensors.cpp
index 61dd4ebe2..82671372d 100644
--- a/src/modules/sensors/sensors.cpp
+++ b/src/modules/sensors/sensors.cpp
@@ -1363,7 +1363,7 @@ Sensors::parameter_update_poll(bool forced)
/* initially status is ok per config */
failed = false;
- (void)sprintf(str, "CAL_GYRO%u_ID", s);
+ (void)sprintf(str, "CAL_GYRO%u_ID", i);
int device_id;
failed |= (OK != param_get(param_find(str), &device_id));
@@ -1395,9 +1395,10 @@ Sensors::parameter_update_poll(bool forced)
res = ioctl(fd, GYROIOCSSCALE, (long unsigned int)&gscale);
if (res) {
warnx(CAL_FAILED_APPLY_CAL_MSG);
+ } else {
+ gyro_count++;
+ config_ok = true;
}
- gyro_count++;
- config_ok = true;
}
break;
}
@@ -1429,7 +1430,7 @@ Sensors::parameter_update_poll(bool forced)
/* initially status is ok per config */
failed = false;
- (void)sprintf(str, "CAL_ACC%u_ID", s);
+ (void)sprintf(str, "CAL_ACC%u_ID", i);
int device_id;
failed |= (OK != param_get(param_find(str), &device_id));
@@ -1461,9 +1462,10 @@ Sensors::parameter_update_poll(bool forced)
res = ioctl(fd, ACCELIOCSSCALE, (long unsigned int)&gscale);
if (res) {
warnx(CAL_FAILED_APPLY_CAL_MSG);
+ } else {
+ accel_count++;
+ config_ok = true;
}
- accel_count++;
- config_ok = true;
}
break;
}
@@ -1495,7 +1497,7 @@ Sensors::parameter_update_poll(bool forced)
/* initially status is ok per config */
failed = false;
- (void)sprintf(str, "CAL_MAG%u_ID", s);
+ (void)sprintf(str, "CAL_MAG%u_ID", i);
int device_id;
failed |= (OK != param_get(param_find(str), &device_id));
@@ -1527,9 +1529,10 @@ Sensors::parameter_update_poll(bool forced)
res = ioctl(fd, MAGIOCSSCALE, (long unsigned int)&gscale);
if (res) {
warnx(CAL_FAILED_APPLY_CAL_MSG);
+ } else {
+ mag_count++;
+ config_ok = true;
}
- mag_count++;
- config_ok = true;
}
break;
}