sensors: vehicle_magnetometer combine extra _vehicle_magnetometer_pub

This commit is contained in:
Daniel Agar
2021-01-30 21:09:11 -05:00
parent ce76c84ce2
commit 6a4835bbcc
2 changed files with 4 additions and 5 deletions
@@ -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;
@@ -92,8 +92,7 @@ private:
uORB::Publication<sensor_preflight_mag_s> _sensor_preflight_mag_pub{ORB_ID(sensor_preflight_mag)};
uORB::Publication<vehicle_magnetometer_s> _vehicle_magnetometer_pub{ORB_ID(vehicle_magnetometer)};
uORB::PublicationMulti<vehicle_magnetometer_s> _vehicle_magnetometer_multi_pub[MAX_SENSOR_COUNT] {
uORB::PublicationMulti<vehicle_magnetometer_s> _vehicle_magnetometer_pub[MAX_SENSOR_COUNT] {
{ORB_ID(vehicle_magnetometer)},
{ORB_ID(vehicle_magnetometer)},
{ORB_ID(vehicle_magnetometer)},