aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2015-03-25 22:57:32 -0700
committerLorenz Meier <lm@inf.ethz.ch>2015-03-25 22:57:32 -0700
commitb3c45e7178e5a00195445f34a9c2ef35dfe90570 (patch)
treea99088699df3b279329463fd0dd1b4db5901f265
parentcb8e32f8332957a6b0e9d46feb0f9b3589ccddae (diff)
downloadpx4-firmware-b3c45e7178e5a00195445f34a9c2ef35dfe90570.tar.gz
px4-firmware-b3c45e7178e5a00195445f34a9c2ef35dfe90570.tar.bz2
px4-firmware-b3c45e7178e5a00195445f34a9c2ef35dfe90570.zip
LSM303D: Temp support
-rw-r--r--src/drivers/lsm303d/lsm303d.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/drivers/lsm303d/lsm303d.cpp b/src/drivers/lsm303d/lsm303d.cpp
index 11a046a8d..e594c92a1 100644
--- a/src/drivers/lsm303d/lsm303d.cpp
+++ b/src/drivers/lsm303d/lsm303d.cpp
@@ -1640,7 +1640,7 @@ LSM303D::mag_measure()
float yraw_f = mag_report.y_raw;
float zraw_f = mag_report.z_raw;
- // apply user specified rotation
+ /* apply user specified rotation */
rotate_3f(_rotation, xraw_f, yraw_f, zraw_f);
mag_report.x = ((xraw_f * _mag_range_scale) - _mag_scale.x_offset) * _mag_scale.x_scale;
@@ -1650,13 +1650,14 @@ LSM303D::mag_measure()
mag_report.range_ga = (float)_mag_range_ga;
mag_report.error_count = perf_event_count(_bad_registers) + perf_event_count(_bad_values);
- // remember the temperature. The datasheet isn't clear, but it
- // seems to be a signed offset from 25 degrees C in units of 0.125C
- _last_temperature = 25 + (raw_mag_report.temperature*0.125f);
+ /* remember the temperature. The datasheet isn't clear, but it
+ * seems to be a signed offset from 25 degrees C in units of 0.125C
+ */
+ _last_temperature = 25 + (raw_mag_report.temperature * 0.125f);
+ mag_report.temperature = _last_temperature;
_mag_reports->force(&mag_report);
- /* XXX please check this poll_notify, is it the right one? */
/* notify anyone waiting for data */
poll_notify(POLLIN);
@@ -1693,7 +1694,7 @@ LSM303D::print_info()
(unsigned)_checked_values[i]);
}
}
- ::printf("temperature: %.2f\n", _last_temperature);
+ ::printf("temperature: %.2f\n", (double)_last_temperature);
}
void