From 8f6982860f8aa2d1ca2f0db0250065ecccbc6f6f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 13 Mar 2015 20:46:32 +1100 Subject: [PATCH] AP_Compass: fixed devid for 2nd compass --- libraries/AP_Compass/AP_Compass_PX4.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/AP_Compass/AP_Compass_PX4.cpp b/libraries/AP_Compass/AP_Compass_PX4.cpp index f491913bc4..1c57946c1d 100644 --- a/libraries/AP_Compass/AP_Compass_PX4.cpp +++ b/libraries/AP_Compass/AP_Compass_PX4.cpp @@ -80,11 +80,11 @@ bool AP_Compass_PX4::init(void) } for (uint8_t i=0; i<_num_sensors; i++) { + _instance[i] = register_compass(); + // get device id set_dev_id(_instance[i], ioctl(_mag_fd[i], DEVIOCGDEVICEID, 0)); - _instance[i] = register_compass(); - // average over up to 20 samples if (ioctl(_mag_fd[i], SENSORIOCSQUEUEDEPTH, 20) != 0) { hal.console->printf("Failed to setup compass queue\n");