Rev 2051 | Rev 2160 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2051 | Rev 2052 | ||
---|---|---|---|
Line 6... | Line 6... | ||
6 | #define _ATTITUDE_H |
6 | #define _ATTITUDE_H |
Line 7... | Line 7... | ||
7 | 7 | ||
Line 8... | Line 8... | ||
8 | #include <inttypes.h> |
8 | #include <inttypes.h> |
9 | - | ||
10 | #include "analog.h" |
- | |
11 | 9 | ||
Line 12... | Line 10... | ||
12 | // For debugging only. |
10 | #include "analog.h" |
13 | #include "uart0.h" |
11 | #include "timer0.h" |
14 | 12 | ||
15 | /* |
13 | /* |
Line 25... | Line 23... | ||
25 | #define ROLLOVER_HYSTERESIS 0L |
23 | #define ROLLOVER_HYSTERESIS 0L |
Line 26... | Line 24... | ||
26 | 24 | ||
27 | /* |
25 | /* |
28 | * The frequency at which numerical integration takes place. 488 in original code. |
26 | * The frequency at which numerical integration takes place. 488 in original code. |
29 | */ |
27 | */ |
Line 30... | Line 28... | ||
30 | #define INTEGRATION_FREQUENCY 488 |
28 | #define INTEGRATION_FREQUENCY F_MAINLOOP |
31 | 29 | ||
32 | /* |
30 | /* |
33 | * Gyro readings are divided by this before being used in attitude control. This will scale them |
31 | * Gyro readings are divided by this before being used in attitude control. This will scale them |
Line 57... | Line 55... | ||
57 | Examples: |
55 | Examples: |
58 | FC1.3: GYRO_DEG_FACTOR_PITCHROLL = 2545 |
56 | FC1.3: GYRO_DEG_FACTOR_PITCHROLL = 2545 |
59 | FC2.0: GYRO_DEG_FACTOR_PITCHROLL = 2399 |
57 | FC2.0: GYRO_DEG_FACTOR_PITCHROLL = 2399 |
60 | My InvenSense copter: GYRO_DEG_FACTOR_PITCHROLL = 1333 |
58 | My InvenSense copter: GYRO_DEG_FACTOR_PITCHROLL = 1333 |
61 | */ |
59 | */ |
- | 60 | //#define GYRO_PITCHROLL_CORRECTION GYRO_PITCHROLL_CORRECTION_should_be_overridden_with_a_-D_at_compile_time |
|
62 | #define GYRO_DEG_FACTOR_PITCHROLL (uint16_t)(GYRO_RATE_FACTOR_PITCHROLL * INTEGRATION_FREQUENCY * GYRO_PITCHROLL_CORRECTION / HIRES_GYRO_INTEGRATION_FACTOR) |
61 | #define GYRO_DEG_FACTOR_PITCHROLL (uint16_t)(GYRO_RATE_FACTOR_PITCHROLL * INTEGRATION_FREQUENCY * GYRO_PITCHROLL_CORRECTION / HIRES_GYRO_INTEGRATION_FACTOR) |
63 | #define GYRO_DEG_FACTOR_YAW (uint16_t)(GYRO_RATE_FACTOR_YAW * INTEGRATION_FREQUENCY * GYRO_YAW_CORRECTION) |
62 | #define GYRO_DEG_FACTOR_YAW (uint16_t)(GYRO_RATE_FACTOR_YAW * INTEGRATION_FREQUENCY * GYRO_YAW_CORRECTION) |
Line 64... | Line 63... | ||
64 | 63 | ||
65 | /* |
64 | /* |