From 92afa7c258670ea0c22998c8068cd42f212ad1b8 Mon Sep 17 00:00:00 2001
From: Julian Oes <julian@oes.ch>
Date: Sun, 24 Apr 2016 10:27:05 +0200
Subject: [PATCH] mag_calibration: bugfix for device ID of mag

The device ID is defined as a uint32_t in the driver and topic but
stored as a int32_t param. It is therefore sufficient if the device ID
is not 0 in order to be valid.
---
 src/modules/commander/mag_calibration.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/modules/commander/mag_calibration.cpp b/src/modules/commander/mag_calibration.cpp
index dec79faffe..ce8addc61a 100644
--- a/src/modules/commander/mag_calibration.cpp
+++ b/src/modules/commander/mag_calibration.cpp
@@ -352,7 +352,7 @@ static calibrate_return mag_calibration_worker(detect_orientation_return orienta
 		px4_pollfd_struct_t fds[max_mags];
 		size_t fd_count = 0;
 		for (size_t cur_mag=0; cur_mag<max_mags; cur_mag++) {
-			if (worker_data->sub_mag[cur_mag] >= 0 && device_ids[cur_mag] > 0) {
+			if (worker_data->sub_mag[cur_mag] >= 0 && device_ids[cur_mag] != 0) {
 				fds[fd_count].fd = worker_data->sub_mag[cur_mag];
 				fds[fd_count].events = POLLIN;
 				fd_count++;
-- 
GitLab