mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-03 06:11:36 +08:00
DF driver wrappers: advertise with actual data
This commit is contained in:
@@ -259,16 +259,7 @@ int DfMpu9250Wrapper::start()
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (_mag_enabled == true) {
|
||||
// TODO: don't publish garbage here
|
||||
mag_report mag_report = {};
|
||||
_mag_topic = orb_advertise_multi(ORB_ID(sensor_mag), &mag_report,
|
||||
&_mag_orb_class_instance, ORB_PRIO_DEFAULT);
|
||||
|
||||
if (_mag_topic == nullptr) {
|
||||
PX4_ERR("sensor_mag advert fail");
|
||||
return -1;
|
||||
}
|
||||
if (_mag_enabled) {
|
||||
}
|
||||
|
||||
/* Subscribe to param update topic. */
|
||||
@@ -707,8 +698,14 @@ int DfMpu9250Wrapper::_publish(struct imu_sensor_data &data)
|
||||
orb_publish(ORB_ID(sensor_accel), _accel_topic, &accel_report);
|
||||
}
|
||||
|
||||
if ((_mag_topic != nullptr) && (_mag_enabled == true)) {
|
||||
orb_publish(ORB_ID(sensor_mag), _mag_topic, &mag_report);
|
||||
if (_mag_enabled) {
|
||||
|
||||
if (_mag_topic == nullptr) {
|
||||
_mag_topic = orb_advertise_multi(ORB_ID(sensor_mag), &mag_report,
|
||||
&_mag_orb_class_instance, ORB_PRIO_LOW);
|
||||
} else {
|
||||
orb_publish(ORB_ID(sensor_mag), _mag_topic, &mag_report);
|
||||
}
|
||||
}
|
||||
|
||||
/* Notify anyone waiting for data. */
|
||||
|
||||
Reference in New Issue
Block a user