mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-27 13:03:33 +08:00
sensors: vehicle_magnetometer combine extra _vehicle_magnetometer_pub
This commit is contained in:
@@ -308,7 +308,7 @@ void VehicleMagnetometer::Run()
|
||||
// advertise outputs in order if publishing all
|
||||
if (!_param_sens_mag_mode.get()) {
|
||||
for (int instance = 0; instance < uorb_index; instance++) {
|
||||
_vehicle_magnetometer_multi_pub[instance].advertise();
|
||||
_vehicle_magnetometer_pub[instance].advertise();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -463,11 +463,11 @@ void VehicleMagnetometer::Publish(uint8_t instance, bool multi)
|
||||
out.timestamp = hrt_absolute_time();
|
||||
|
||||
if (multi) {
|
||||
_vehicle_magnetometer_multi_pub[instance].publish(out);
|
||||
_vehicle_magnetometer_pub[instance].publish(out);
|
||||
|
||||
} else {
|
||||
// otherwise only ever publish the first instance
|
||||
_vehicle_magnetometer_pub.publish(out);
|
||||
_vehicle_magnetometer_pub[0].publish(out);
|
||||
}
|
||||
|
||||
_last_publication_timestamp[instance] = out.timestamp;
|
||||
|
||||
Reference in New Issue
Block a user