Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src/lib/drivers/magnetometer/PX4Magnetometer.cpp: Workaround for sens… #818

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/lib/drivers/magnetometer/PX4Magnetometer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,16 @@ PX4Magnetometer::PX4Magnetometer(uint32_t device_id, enum Rotation rotation) :
_device_id{device_id},
_rotation{rotation}
{
_sensor_pub.advertise();
// Publish initial 0 data just for the sensors module to find
// this device, in case "sensors" module start up before initialization
// of the magnetometer is not fully complete

// TODO: This is a workaround. The "sensors" module should find the mags
// which start publishing data later

sensor_mag_s report = {};
report.device_id = _device_id;
_sensor_pub.publish(report);
}

PX4Magnetometer::~PX4Magnetometer()
Expand Down
Loading