mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-01 02:41:36 +08:00
only advertise range topic of px4flow board if it is the primary range device (#5390)
this allows selecting another range device such as a lidar by starting that app first
This commit is contained in:
committed by
Lorenz Meier
parent
a1627fad9a
commit
ebce93f338
@@ -245,11 +245,16 @@ PX4FLOW::init()
|
|||||||
/* get a publish handle on the range finder topic */
|
/* get a publish handle on the range finder topic */
|
||||||
struct distance_sensor_s ds_report = {};
|
struct distance_sensor_s ds_report = {};
|
||||||
|
|
||||||
_distance_sensor_topic = orb_advertise_multi(ORB_ID(distance_sensor), &ds_report,
|
if (_class_instance == CLASS_DEVICE_PRIMARY) {
|
||||||
&_orb_class_instance, ORB_PRIO_HIGH);
|
_distance_sensor_topic = orb_advertise_multi(ORB_ID(distance_sensor), &ds_report,
|
||||||
|
&_orb_class_instance, ORB_PRIO_HIGH);
|
||||||
|
|
||||||
if (_distance_sensor_topic == nullptr) {
|
if (_distance_sensor_topic == nullptr) {
|
||||||
DEVICE_LOG("failed to create distance_sensor object. Did you start uOrb?");
|
DEVICE_LOG("failed to create distance_sensor object. Did you start uOrb?");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
DEVICE_LOG("not primary range device, not advertising");
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = OK;
|
ret = OK;
|
||||||
|
|||||||
Reference in New Issue
Block a user