msgs/sensor_mag: remove unused raw, add timestamp_asmple, shrink error count

- move mpu9250 sensitivity handling back to driver (this isn't common)
This commit is contained in:
Daniel Agar
2020-06-22 10:11:22 -04:00
parent d9102ce54c
commit 22daa26955
5 changed files with 46 additions and 50 deletions
+3 -5
View File
@@ -148,7 +148,7 @@ bool MPU9250_mag::_measure(const hrt_abstime &timestamp_sample, const ak8963_reg
int16_t x = combine(data.HXH, data.HXL);
int16_t y = -combine(data.HYH, data.HYL);
int16_t z = -combine(data.HZH, data.HZL);
_px4_mag.update(timestamp_sample, x, y, z);
_px4_mag.update(timestamp_sample, x * _ak8963_ASA[0], y * _ak8963_ASA[1], z * _ak8963_ASA[2]);
return true;
}
@@ -244,19 +244,17 @@ MPU9250_mag::ak8963_read_adjustments()
write_reg_through_mpu9250(AK8963REG_CNTL1, AK8963_POWERDOWN_MODE);
float ak8963_ASA[3] {};
for (int i = 0; i < 3; i++) {
if (0 != response[i] && 0xff != response[i]) {
ak8963_ASA[i] = ((float)(response[i] - 128) / 256.0f) + 1.0f;
_ak8963_ASA[i] = ((float)(response[i] - 128) / 256.0f) + 1.0f;
} else {
return false;
}
}
_px4_mag.set_sensitivity(ak8963_ASA[0], ak8963_ASA[1], ak8963_ASA[2]);
return true;
}
+2
View File
@@ -147,6 +147,8 @@ private:
MPU9250 *_parent;
float _ak8963_ASA[3] {1.f, 1.f, 1.f};
bool _mag_reading_data{false};
perf_counter_t _mag_overruns;