Skip to content

Commit

Permalink
src/drivers/magnetometer/bosch/bmm350/BMM350.cpp: Publish initial 0 d…
Browse files Browse the repository at this point in the history
…ata to register mags in module start order

Magnetometer numbers are allocated in the order when the first data gets published to sesors module.

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.

Therefor, publish some dummy data right after successful probe of the driver

Signed-off-by: Jukka Laitinen <[email protected]>
  • Loading branch information
jlaitine committed Nov 18, 2024
1 parent 8daafb7 commit 05459a2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/drivers/magnetometer/bosch/bmm350/BMM350.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ int BMM350::probe()
PX4_DEBUG("CHIP_ID: 0x%02hhX", chip_id);

if (chip_id == chip_identification_number) {
// Publish something already to get IDs allocated in start order

_px4_mag.set_temperature(0);
_px4_mag.update(hrt_absolute_time(), 0, 0, 0);

return PX4_OK;
}
}
Expand Down

0 comments on commit 05459a2

Please sign in to comment.