From dbf1cc45025387dd175a44b9df63afff7f33e889 Mon Sep 17 00:00:00 2001 From: Patrick Porlan Date: Wed, 2 Jul 2014 14:18:11 +0200 Subject: [PATCH] STPK-1429 Minor tweak to compass calibration data save point Was being saved each time the magnetometer reference count was decremented. Doing it when it reaches zero is probably enough. Issue: STPK-1429 Change-Id: Ia465821cbf1ec22c5645753b6289e368d7ef2bd8 Signed-off-by: Patrick Porlan --- control.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/control.c b/control.c index d9e1ea2..a7de562 100644 --- a/control.c +++ b/control.c @@ -234,9 +234,6 @@ int adjust_counters (int s, int enabled) ALOGI("Disabling sensor %d (iio device %d: %s)\n", s, dev_num, sensor_info[s].friendly_name); - if (sensor_type == SENSOR_TYPE_MAGNETIC_FIELD) - compass_store_data(&sensor_info[s]); - sensor_info[s].enable_count--; if (sensor_info[s].enable_count > 0) @@ -244,6 +241,9 @@ int adjust_counters (int s, int enabled) /* Sensor disabled, lower report available flag */ sensor_info[s].report_pending = 0; + + if (sensor_type == SENSOR_TYPE_MAGNETIC_FIELD) + compass_store_data(&sensor_info[s]); } /* We changed the state of a sensor - adjust per iio device counters */ -- 2.11.0