Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove one bit of resolution of time period in gyro integration.
This should make overflows less likely, may need another bit of resolution
less at one point.
  • Loading branch information
balrog-kun committed Jun 26, 2011
1 parent 9aa9fad commit 851de05
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ahrs.c
Expand Up @@ -69,8 +69,8 @@ static void gyro_ahrs_update(void) {
* longer than some 30ms, if it is too long this may overflow.
*/
#define TIME_RES 2 /* 1+1 because adc_values are doubled */
#define DIFF_RES 3
#define REF_RES (DIFF_RES + 7)
#define DIFF_RES 4
#define REF_RES (DIFF_RES + 6)
diff = (diff/* + (1 << (DIFF_RES - 1))*/) >> DIFF_RES;
rel_roll += (int32_t) ((((int32_t) (int16_t) x << REF_RES) - x_ref) *
diff + (1 << (REF_RES - DIFF_RES + TIME_RES - 1))) >>
Expand Down

0 comments on commit 851de05

Please sign in to comment.