From 20ff30c6ce4fa21783602fb2ccc0fe43d5088af0 Mon Sep 17 00:00:00 2001 From: Jukka Laitinen Date: Mon, 18 Nov 2024 11:15:18 +0200 Subject: [PATCH] src/lib/drivers/magnetometer/PX4Magnetometer.cpp: Advertise the orb when creating magnetometer driver instance This ensures that magnetometers instance numbers are allocated in the driver start order. It is problematic if the magnetometers get different IDs on different HW even if the start order of the drivers in the init scripts is the same. Signed-off-by: Jukka Laitinen --- src/lib/drivers/magnetometer/PX4Magnetometer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/drivers/magnetometer/PX4Magnetometer.cpp b/src/lib/drivers/magnetometer/PX4Magnetometer.cpp index 40907d870d6d..d13133ef14f8 100644 --- a/src/lib/drivers/magnetometer/PX4Magnetometer.cpp +++ b/src/lib/drivers/magnetometer/PX4Magnetometer.cpp @@ -40,6 +40,7 @@ PX4Magnetometer::PX4Magnetometer(uint32_t device_id, enum Rotation rotation) : _device_id{device_id}, _rotation{rotation} { + _sensor_pub.advertise(); } PX4Magnetometer::~PX4Magnetometer()