forked from Archive/PX4-Autopilot
mpu9250 : fill correct device ID into uORB topic
This commit is contained in:
parent
d7611cac89
commit
302e2372cf
|
@ -227,7 +227,7 @@ MPU9250_mag::_measure(struct ak8963_regs data)
|
|||
mrb.range_ga = 48.0f;
|
||||
mrb.scaling = _mag_range_scale;
|
||||
mrb.temperature = _parent->_last_temperature;
|
||||
mrb.device_id = _parent->get_device_id().devid;
|
||||
mrb.device_id = _parent->_mag->_device_id.devid;
|
||||
|
||||
mrb.error_count = perf_event_count(_mag_errors);
|
||||
|
||||
|
|
|
@ -592,14 +592,8 @@ calibrate_return mag_calibrate_all(orb_advert_t *mavlink_log_pub)
|
|||
|
||||
// Lock in to correct ORB instance
|
||||
bool found_cur_mag = false;
|
||||
for(unsigned i = 0; i < orb_mag_count; i++) {
|
||||
worker_data.sub_mag[cur_mag] = orb_subscribe_multi(ORB_ID(sensor_mag), cur_mag);
|
||||
|
||||
if (worker_data.sub_mag[cur_mag] < 0) {
|
||||
calibration_log_critical(mavlink_log_pub, "[cal] Mag #%u not found, abort", cur_mag);
|
||||
result = calibrate_return_error;
|
||||
break;
|
||||
}
|
||||
for(unsigned i = 0; i < orb_mag_count && !found_cur_mag; i++) {
|
||||
worker_data.sub_mag[cur_mag] = orb_subscribe_multi(ORB_ID(sensor_mag), i);
|
||||
|
||||
struct mag_report report;
|
||||
orb_copy(ORB_ID(sensor_mag), worker_data.sub_mag[cur_mag], &report);
|
||||
|
@ -613,7 +607,6 @@ calibrate_return mag_calibrate_all(orb_advert_t *mavlink_log_pub)
|
|||
if(report.device_id == device_ids[cur_mag]) {
|
||||
// Device IDs match, correct ORB instance for this mag
|
||||
found_cur_mag = true;
|
||||
break;
|
||||
} else {
|
||||
orb_unsubscribe(worker_data.sub_mag[cur_mag]);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue