Mercurial > public > hwos_code
diff src/compass.c @ 628:cd58f7fc86db
3.05 stable work
author | heinrichsweikamp |
---|---|
date | Thu, 19 Sep 2019 12:01:29 +0200 |
parents | c40025d8e750 |
children | bc214815deb2 |
line wrap: on
line diff
--- a/src/compass.c Sun Jun 30 23:22:32 2019 +0200 +++ b/src/compass.c Thu Sep 19 12:01:29 2019 +0200 @@ -247,7 +247,7 @@ //---- Calculate sine and cosine of roll angle Phi ----------------------- sincos(accel_DZ_f, accel_DY_f, &sin, &cos); - + //---- rotate by roll angle (-Phi) --------------------------------------- iBfy = imul(iBpy, cos) - imul(iBpz, sin); iBpz = imul(iBpy, sin) + imul(iBpz, cos); @@ -255,7 +255,7 @@ //---- calculate sin and cosine of pitch angle Theta --------------------- sincos(Gz, -accel_DX_f, &sin, &cos); // NOTE: changed sin sign - + /* correct cosine if pitch not in range -90 to 90 degrees */ if( cos < 0 ) cos = -cos;