Apparently the magnetometer on ECS sends an invalid first event
[x,y,z]=[0,0,0]. This is confusing the calibration and makes the entire
data invalid. Therefore the first calibration attempt always fails thus
wasting a lot of time.
Change-Id: Ibad68b2d4b4740ab7da6f5400426ffee5c29d6c5
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
if (cal_data == NULL)
return -1;
+ /* Discard the point if not valid */
+ if (data[0] == 0 && data[1] == 0 && data[2] == 0)
+ return -1;
+
#ifdef DBG_RAW_DATA
if (raw_data && raw_data_count < MAX_RAW_DATA_COUNT) {
fprintf(raw_data, "%f %f %f\n", (double)data[0], (double)data[1],