mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-29 03:36:07 +08:00
Fixed minor compile warnings (just warnings, no effect on execution) in BMA180
This commit is contained in:
@@ -668,14 +668,14 @@ void
|
|||||||
BMA180::measure()
|
BMA180::measure()
|
||||||
{
|
{
|
||||||
/* BMA180 measurement registers */
|
/* BMA180 measurement registers */
|
||||||
#pragma pack(push, 1)
|
// #pragma pack(push, 1)
|
||||||
struct {
|
// struct {
|
||||||
uint8_t cmd;
|
// uint8_t cmd;
|
||||||
uint16_t x;
|
// int16_t x;
|
||||||
uint16_t y;
|
// int16_t y;
|
||||||
uint16_t z;
|
// int16_t z;
|
||||||
} raw_report;
|
// } raw_report;
|
||||||
#pragma pack(pop)
|
// #pragma pack(pop)
|
||||||
|
|
||||||
accel_report *report = &_reports[_next_report];
|
accel_report *report = &_reports[_next_report];
|
||||||
|
|
||||||
@@ -686,7 +686,7 @@ BMA180::measure()
|
|||||||
* Fetch the full set of measurements from the BMA180 in one pass;
|
* Fetch the full set of measurements from the BMA180 in one pass;
|
||||||
* starting from the X LSB.
|
* 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));
|
// 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
|
* y of board is x of sensor and x of board is -y of sensor
|
||||||
* perform only the axis assignment here.
|
* 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
|
* 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;
|
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->y_raw = (report->y_raw >> 2);
|
||||||
report->z_raw = (report->z_raw >> 2);
|
report->z_raw = (report->z_raw >> 2);
|
||||||
|
|
||||||
/* invert y axis, watching the int16 overflow */
|
/* invert y axis, due to 14 bit data no overflow can occur in the negation */
|
||||||
report->y_raw = (report->y_raw == INT16_MIN) ? INT16_MAX : -report->y_raw;
|
report->y_raw = -report->y_raw;
|
||||||
|
|
||||||
report->x = ((report->x_raw * _accel_range_scale) - _accel_scale.x_offset) * _accel_scale.x_scale;
|
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;
|
report->y = ((report->y_raw * _accel_range_scale) - _accel_scale.y_offset) * _accel_scale.y_scale;
|
||||||
|
|||||||
Reference in New Issue
Block a user