From 326d42647ffe8767d97ca60f147c3f6db5213a65 Mon Sep 17 00:00:00 2001
From: Ankur
Date: Wed, 17 Dec 2014 16:41:59 +0530
Subject: [PATCH 01/16] Fixed Intialization Warnings
-Reordered some variable intializations to remove warnings related to order of initializations.
Change-Id: Ibf56efd6f19c11229a18fbe6a613ffcf2b172a16
---
src/geo/geo_sensor_hal.cpp | 6 +++---
src/libsensord/csensor_event_listener.cpp | 2 +-
src/linear_accel/linear_accel_sensor.cpp | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/geo/geo_sensor_hal.cpp b/src/geo/geo_sensor_hal.cpp
index d742b26..21a2276 100755
--- a/src/geo/geo_sensor_hal.cpp
+++ b/src/geo/geo_sensor_hal.cpp
@@ -40,13 +40,13 @@ using std::ifstream;
#define GAUSS_TO_UTESLA(val) ((val) * 100.0f)
geo_sensor_hal::geo_sensor_hal()
-: m_x(0)
+: m_polling_interval(POLL_1HZ_MS)
+, m_x(0)
, m_y(0)
, m_z(0)
, m_hdst(0)
-, m_node_handle(-1)
-, m_polling_interval(POLL_1HZ_MS)
, m_fired_time(INITIAL_TIME)
+, m_node_handle(-1)
{
const string sensorhub_interval_node_name = "mag_poll_delay";
csensor_config &config = csensor_config::get_instance();
diff --git a/src/libsensord/csensor_event_listener.cpp b/src/libsensord/csensor_event_listener.cpp
index e093f21..78e705e 100755
--- a/src/libsensord/csensor_event_listener.cpp
+++ b/src/libsensord/csensor_event_listener.cpp
@@ -30,8 +30,8 @@ using std::pair;
csensor_event_listener::csensor_event_listener()
: m_client_id(CLIENT_ID_INVALID)
-, m_thread_state(THREAD_STATE_TERMINATE)
, m_poller(NULL)
+, m_thread_state(THREAD_STATE_TERMINATE)
, m_hup_observer(NULL)
{
}
diff --git a/src/linear_accel/linear_accel_sensor.cpp b/src/linear_accel/linear_accel_sensor.cpp
index f975733..96e6cce 100755
--- a/src/linear_accel/linear_accel_sensor.cpp
+++ b/src/linear_accel/linear_accel_sensor.cpp
@@ -53,8 +53,8 @@
#define LINEAR_ACCEL_ENABLED 3
linear_accel_sensor::linear_accel_sensor()
-: m_gravity_sensor(NULL)
-, m_accel_sensor(NULL)
+: m_accel_sensor(NULL)
+, m_gravity_sensor(NULL)
, m_x(INITIAL_VALUE)
, m_y(INITIAL_VALUE)
, m_z(INITIAL_VALUE)
--
2.7.4
From c169c4e8efbe517eeb2a55f51d45e70df6047753 Mon Sep 17 00:00:00 2001
From: Ankur
Date: Thu, 18 Dec 2014 16:13:02 +0530
Subject: [PATCH 02/16] Fixed Compilation warnings related to Intialization
-Error fixed: Variable was being used before intialization
-Testing will be done once the test cases are completed.
Change-Id: I5316bce003717d97f6e3cd65a909d94e1c84ad0c
---
src/gravity/gravity_sensor.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/gravity/gravity_sensor.cpp b/src/gravity/gravity_sensor.cpp
index acb73a6..64e39e7 100755
--- a/src/gravity/gravity_sensor.cpp
+++ b/src/gravity/gravity_sensor.cpp
@@ -218,6 +218,8 @@ int gravity_sensor::get_sensor_data(const unsigned int event_type, sensor_data_t
sensor_data_t orientation_data;
float pitch, roll, azimuth;
+ m_orientation_sensor->get_sensor_data(ORIENTATION_EVENT_RAW_DATA_REPORT_ON_TIME, orientation_data);
+
azimuth = orientation_data.values[0];
pitch = orientation_data.values[1];
roll = orientation_data.values[2];
@@ -231,8 +233,6 @@ int gravity_sensor::get_sensor_data(const unsigned int event_type, sensor_data_t
if (event_type != GRAVITY_EVENT_RAW_DATA_REPORT_ON_TIME)
return -1;
- m_orientation_sensor->get_sensor_data(ORIENTATION_EVENT_RAW_DATA_REPORT_ON_TIME, orientation_data);
-
data.accuracy = SENSOR_ACCURACY_GOOD;
data.timestamp = get_timestamp();
if ((roll >= (M_PI/2)-DEVIATION && roll <= (M_PI/2)+DEVIATION) ||
--
2.7.4
From ed04630ae99f42a3a9ba4116b91f1f2c32ae88be Mon Sep 17 00:00:00 2001
From: Ankur
Date: Thu, 18 Dec 2014 18:54:40 +0530
Subject: [PATCH 03/16] Fixed implicit declaration warnings
-Fixed warnings related to implicit delcaration of strcmp() function.
Error: missing #include from the files which are using the function strcmp
Change-Id: Ia8c3fec21b7f622543b646063ec9718f5b1cba83
---
test/src/accelerometer.c | 1 +
test/src/gyro.c | 1 +
test/src/pressure.c | 1 +
test/src/proxi.c | 1 +
4 files changed, 4 insertions(+)
diff --git a/test/src/accelerometer.c b/test/src/accelerometer.c
index 09028e4..c7ea6e6 100644
--- a/test/src/accelerometer.c
+++ b/test/src/accelerometer.c
@@ -22,6 +22,7 @@
#include
#include
#include
+#include
static GMainLoop *mainloop;
diff --git a/test/src/gyro.c b/test/src/gyro.c
index 884507b..ae34d95 100644
--- a/test/src/gyro.c
+++ b/test/src/gyro.c
@@ -23,6 +23,7 @@
#include
#include
#include
+#include
static GMainLoop *mainloop;
diff --git a/test/src/pressure.c b/test/src/pressure.c
index 0ac4e6d..e3ed4b4 100644
--- a/test/src/pressure.c
+++ b/test/src/pressure.c
@@ -23,6 +23,7 @@
#include
#include
#include
+#include
static GMainLoop *mainloop;
diff --git a/test/src/proxi.c b/test/src/proxi.c
index 7ed2d64..9ac965f 100644
--- a/test/src/proxi.c
+++ b/test/src/proxi.c
@@ -23,6 +23,7 @@
#include
#include
#include
+#include
static GMainLoop *mainloop;
--
2.7.4
From 00f95bdf1671616c0d60e2d2b1c56ee38a3bae59 Mon Sep 17 00:00:00 2001
From: Ankur
Date: Thu, 18 Dec 2014 19:28:45 +0530
Subject: [PATCH 04/16] Removed warnings related to unintialized variables
-Warnings related to variables being used without initialization. Intialized the variables.
Actually, the variables were not beng used without initialization but the cases where the variables are being used are mutually exclusive.
So, varaibles have to be intialized to some intial value to remove the warning.
Change-Id: I4041e9d3256c40acb8cdbebbc810275123601603
---
src/shared/csensor_event_dispatcher.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/shared/csensor_event_dispatcher.cpp b/src/shared/csensor_event_dispatcher.cpp
index f9f90d5..f00332d 100755
--- a/src/shared/csensor_event_dispatcher.cpp
+++ b/src/shared/csensor_event_dispatcher.cpp
@@ -189,8 +189,8 @@ void csensor_event_dispatcher::dispatch_event(void)
void csensor_event_dispatcher::send_sensor_events(void* events, int event_cnt, bool is_hub_event)
{
- sensor_event_t *sensor_events;
- sensorhub_event_t *sensor_hub_events;
+ sensor_event_t *sensor_events = NULL;
+ sensorhub_event_t *sensor_hub_events = NULL;
cclient_info_manager& client_info_manager = get_client_info_manager();
const int RESERVED_CLIENT_CNT = 20;
--
2.7.4
From cb35b6dd8a1f44a8f103fdbcebae5b0dcf4bbbf5 Mon Sep 17 00:00:00 2001
From: Ankur
Date: Thu, 18 Dec 2014 19:44:49 +0530
Subject: [PATCH 05/16] Added missing function call
- Missing Function call to sf_stop() in one of the test cases - linear_acceleration.c
- Also, it was leading to a warning about use before intialization warning.
Change-Id: Ic0df7b6334945ac62048fee9ddcdb32fdf0fcba9
---
test/src/linear_acceleration.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/test/src/linear_acceleration.c b/test/src/linear_acceleration.c
index 5e157e5..e45f4cc 100755
--- a/test/src/linear_acceleration.c
+++ b/test/src/linear_acceleration.c
@@ -94,6 +94,8 @@ int main(int argc,char **argv)
sf_unregister_event(handle, event);
+ stop_handle = sf_stop(handle);
+
if (stop_handle < 0) {
printf("Error\n\n");
return -1;
--
2.7.4
From b713babd37d30a84b9239b619dc8477c899d09d5 Mon Sep 17 00:00:00 2001
From: Ankur
Date: Thu, 18 Dec 2014 19:58:08 +0530
Subject: [PATCH 06/16] Removed missing parantheses warning
-Added missing parantheses arounf an assignment in a condition.
-Removed Missing Parantheses Warning.
Change-Id: Ib7814ef31a911896e868b11cfc057284573bee7a
---
src/shared/sensor_plugin_loader.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/shared/sensor_plugin_loader.cpp b/src/shared/sensor_plugin_loader.cpp
index 09f6711..8aa70d1 100755
--- a/src/shared/sensor_plugin_loader.cpp
+++ b/src/shared/sensor_plugin_loader.cpp
@@ -227,7 +227,7 @@ bool sensor_plugin_loader::get_paths_from_dir(const string &dir_path, vectord_name);
if (equal(PLUGIN_POSTFIX.rbegin(), PLUGIN_POSTFIX.rend(), name.rbegin())) {
--
2.7.4
From ecde90333a1ea21280753978b2b08fb46975f20f Mon Sep 17 00:00:00 2001
From: Ramasamy
Date: Fri, 19 Dec 2014 11:11:18 +0530
Subject: [PATCH 07/16] Adding description for Measurement update system
Adding description for the sensor fusion measurement update system
in html documentation.
Change-Id: I7dc24f7940cfb8d607313fe9b3cd405abf1666e2
---
.../design/documentation/sensor_fusion.htm | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/sensor_fusion/design/documentation/sensor_fusion.htm b/src/sensor_fusion/design/documentation/sensor_fusion.htm
index 231b129..0003b4b 100755
--- a/src/sensor_fusion/design/documentation/sensor_fusion.htm
+++ b/src/sensor_fusion/design/documentation/sensor_fusion.htm
@@ -140,9 +140,9 @@ previous time instant and a '0' specifies it as an initialization value.
-
The accelerometer and magnetometer data are normalized based on equations (3)
+
The accelerometer and magnetometer data are normalized based on equations (3)
and (4) to obtain the calibrated accelerometer data (Ax, Ay, Az) and magnetometer
-data (Mx, My, Mz).