Changes as per the reviews on the previous patches 04/35704/2
authorAnkur <ankur29.garg@samsung.com>
Mon, 23 Feb 2015 13:30:17 +0000 (19:00 +0530)
committerAnkur Garg <ankur29.garg@samsung.com>
Mon, 23 Feb 2015 13:26:01 +0000 (05:26 -0800)
As per the reviews on the previous patches, submitting a patch with all the changes suggested in the reviews.

Tested on RD-PQ device

Change-Id: I15e79bdd0331c17908cc62fa523bab188cc28295

src/libsensord/sensor_geomagnetic_rv.h
src/sensor_fusion/euler_angles.h
src/sensor_fusion/matrix.cpp
src/sensor_fusion/orientation_filter.cpp
src/sensor_fusion/quaternion.cpp
src/sensor_fusion/vector.cpp

index 73106ae..3deaaa2 100755 (executable)
@@ -48,6 +48,4 @@ enum geomagnetic_rv_event_type {
 }
 #endif
 
-#endif
-//! End of a file
-
+#endif /* __SENSOR_GEOMAGNETIC_RV_H__ */
index 061dfb1..9e2f607 100644 (file)
@@ -29,7 +29,7 @@
 template <typename TYPE>
 class euler_angles {
 public:
-       vect<TYPE,EULER_SIZE> m_ang;
+       vect<TYPE, EULER_SIZE> m_ang;
 
        euler_angles();
        euler_angles(const TYPE roll, const TYPE pitch, const TYPE azimuth);
index 9d483f2..62f0555 100755 (executable)
@@ -51,9 +51,9 @@ TYPE_ROW_COL matrix<TYPE, ROW, COL> matrix<TYPE, ROW, COL>::operator =(const mat
                return *this;
        }
 
-       for (int p = 0; p < ROW; p++)
-               for (int q = 0; q < COL; q++)
-                       m_mat[p][q] = m.m_mat[p][q];
+       for (int i = 0; i < ROW; i++)
+               for (int j = 0; j < COL; j++)
+                       m_mat[i][j] = m.m_mat[i][j];
 
        return *this;
 }
index 2bf7865..76febbb 100644 (file)
@@ -84,7 +84,7 @@ inline void orientation_filter<TYPE>::init_accel_gyro_mag_data(const sensor_data
        m_magnetic.m_data = magnetic.m_data;
 
        if (m_gyro.m_time_stamp != 0 && gyro.m_time_stamp != 0)
-               sample_interval_gyro =  gyro.m_time_stamp - m_gyro.m_time_stamp;
+               sample_interval_gyro = gyro.m_time_stamp - m_gyro.m_time_stamp;
 
        m_gyro_dt = sample_interval_gyro * US2S;
 
index caf2950..9d28f58 100755 (executable)
@@ -30,7 +30,7 @@ template <typename T> int sgn(T val) {
 
 template <typename T> T mag(T val) {
        if (val < 0)
-               return val * (T)-1;
+               return val * static_cast<T>(-1);
        else
                return val;
 }
index 2fc932a..5174035 100644 (file)
@@ -21,7 +21,7 @@
 
 TYPE_SIZE vect<TYPE, SIZE>::vect(void)
 {
-       for(int i=0;i<SIZE;i++)
+       for (int i = 0; i < SIZE; i++)
                m_vec[i] = 0;
 }
 
@@ -46,20 +46,18 @@ TYPE_SIZE vect<TYPE, SIZE>::~vect()
 TYPE_SIZE vect<TYPE, SIZE> vect<TYPE, SIZE>::operator =(const vect<TYPE, SIZE>& v)
 {
        if (this == &v)
-       {
                return *this;
-       }
+
        for (int q = 0; q < SIZE; q++)
                m_vec[q] = v.m_vec[q];
-                       return *this;
+
+       return *this;
 }
 
 T_S ostream& operator <<(ostream& dout, vect<T, S>& v)
 {
        for (int j = 0; j < S; j++)
-       {
                dout << v.m_vec[j] << "\t";
-       }
 
        dout << endl;
 
@@ -114,12 +112,8 @@ T_S_R_C matrix<T, R, S> operator *(const matrix<T, R, C> m, const vect<T, S> v)
        matrix<T,R,S> m1;
 
        for (int i = 0; i < R; i++)
-       {
                for (int j = 0; j < S; j++)
-               {
                        m1.m_mat[i][j] = m.m_mat[i][0] * v.m_vec[j];
-               }
-       }
 
        return m1;
 }