mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-07 17:35:22 +08:00
df_bmp280_wrapper: don't advertise garbage
This commit is contained in:
@@ -115,16 +115,6 @@ DfBmp280Wrapper::~DfBmp280Wrapper()
|
||||
|
||||
int DfBmp280Wrapper::start()
|
||||
{
|
||||
// TODO: don't publish garbage here
|
||||
baro_report baro_report = {};
|
||||
_baro_topic = orb_advertise_multi(ORB_ID(sensor_baro), &baro_report,
|
||||
&_baro_orb_class_instance, ORB_PRIO_DEFAULT);
|
||||
|
||||
if (_baro_topic == nullptr) {
|
||||
PX4_ERR("sensor_baro advert fail");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Init device and start sensor. */
|
||||
int ret = init();
|
||||
|
||||
@@ -197,7 +187,10 @@ int DfBmp280Wrapper::_publish(struct baro_sensor_data &data)
|
||||
// TODO: when is this ever blocked?
|
||||
if (!(m_pub_blocked)) {
|
||||
|
||||
if (_baro_topic != nullptr) {
|
||||
if (_baro_topic == nullptr) {
|
||||
_baro_topic = orb_advertise_multi(ORB_ID(sensor_baro), &baro_report,
|
||||
&_baro_orb_class_instance, ORB_PRIO_DEFAULT);
|
||||
} else {
|
||||
orb_publish(ORB_ID(sensor_baro), _baro_topic, &baro_report);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user