diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2012-08-31 14:38:55 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2012-08-31 14:38:55 +0200 |
commit | 39fd8b9cdaed430ddf45e5a4f052645831e35d25 (patch) | |
tree | 8939d94cb8960a9e5a4b7ca15463b0db3563ff8d /apps | |
parent | 4ba8036d8080da3cf5b1e81a65943ab603e4a1b9 (diff) | |
download | px4-firmware-39fd8b9cdaed430ddf45e5a4f052645831e35d25.tar.gz px4-firmware-39fd8b9cdaed430ddf45e5a4f052645831e35d25.tar.bz2 px4-firmware-39fd8b9cdaed430ddf45e5a4f052645831e35d25.zip |
Fixed minor compile warnings (just warnings, no effect on execution) in BMA180
Diffstat (limited to 'apps')
-rw-r--r-- | apps/drivers/bma180/bma180.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/apps/drivers/bma180/bma180.cpp b/apps/drivers/bma180/bma180.cpp index 63039c084..8cd7f6a7c 100644 --- a/apps/drivers/bma180/bma180.cpp +++ b/apps/drivers/bma180/bma180.cpp @@ -668,14 +668,14 @@ void BMA180::measure() { /* BMA180 measurement registers */ -#pragma pack(push, 1) - struct { - uint8_t cmd; - uint16_t x; - uint16_t y; - uint16_t z; - } raw_report; -#pragma pack(pop) +// #pragma pack(push, 1) +// struct { +// uint8_t cmd; +// int16_t x; +// int16_t y; +// int16_t z; +// } raw_report; +// #pragma pack(pop) accel_report *report = &_reports[_next_report]; @@ -686,7 +686,7 @@ BMA180::measure() * Fetch the full set of measurements from the BMA180 in one pass; * starting from the X LSB. */ - raw_report.cmd = ADDR_ACC_X_LSB; + //raw_report.cmd = ADDR_ACC_X_LSB; // XXX PX4DEV transfer((uint8_t *)&raw_report, (uint8_t *)&raw_report, sizeof(raw_report)); /* @@ -701,7 +701,6 @@ BMA180::measure() /* * y of board is x of sensor and x of board is -y of sensor * perform only the axis assignment here. - * The y axis is inverted four lines down from y to -y * Two non-value bits are discarded directly */ report->y_raw = (((int16_t)read_reg(ADDR_ACC_X_LSB+1)) << 8) | (read_reg(ADDR_ACC_X_LSB));// XXX PX4DEV raw_report.x; @@ -713,8 +712,8 @@ BMA180::measure() report->y_raw = (report->y_raw >> 2); report->z_raw = (report->z_raw >> 2); - /* invert y axis, watching the int16 overflow */ - report->y_raw = (report->y_raw == INT16_MIN) ? INT16_MAX : -report->y_raw; + /* invert y axis, due to 14 bit data no overflow can occur in the negation */ + report->y_raw = -report->y_raw; report->x = ((report->x_raw * _accel_range_scale) - _accel_scale.x_offset) * _accel_scale.x_scale; report->y = ((report->y_raw * _accel_range_scale) - _accel_scale.y_offset) * _accel_scale.y_scale; |