Rev 1612 | Rev 1646 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1612 | Rev 1645 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | #include "analog.h" |
3 | #include "analog.h" |
4 | #include "twimaster.h" |
4 | #include "twimaster.h" |
5 | #include "configuration.h" |
5 | #include "configuration.h" |
6 | #include "timer0.h" |
6 | #include "timer0.h" |
Line -... | Line 7... | ||
- | 7 | ||
7 | 8 | const uint8_t GYROS_REVERSE[2] = {0,0}; |
|
8 | #define PITCHROLL_MINLIMIT GYRO_SUMMATION_FACTOR_PITCHROLL * 510 |
9 | #define PITCHROLL_MINLIMIT GYRO_SUMMATION_FACTOR_PITCHROLL * 510 |
Line 9... | Line 10... | ||
9 | #define PITCHROLL_MAXLIMIT GYRO_SUMMATION_FACTOR_PITCHROLL * 515 |
10 | #define PITCHROLL_MAXLIMIT GYRO_SUMMATION_FACTOR_PITCHROLL * 515 |
10 | 11 | ||
Line 23... | Line 24... | ||
23 | // If all 3 axis are in range, shorten the remaining number of iterations. |
24 | // If all 3 axis are in range, shorten the remaining number of iterations. |
24 | if(numberOfAxesInRange == 3 && i > 10) i = 9; |
25 | if(numberOfAxesInRange == 3 && i > 10) i = 9; |
Line 25... | Line 26... | ||
25 | 26 | ||
Line 26... | Line 27... | ||
26 | numberOfAxesInRange = 0; |
27 | numberOfAxesInRange = 0; |
27 | 28 | ||
28 | if(rawPitchGyroSum < PITCHROLL_MINLIMIT) DACValues[DAC_PITCH]--; |
29 | if(rawGyroSum[PITCH] < PITCHROLL_MINLIMIT) DACValues[PITCH]--; |
Line 29... | Line 30... | ||
29 | else if(rawPitchGyroSum > PITCHROLL_MAXLIMIT) DACValues[DAC_PITCH]++; |
30 | else if(rawGyroSum[PITCH] > PITCHROLL_MAXLIMIT) DACValues[PITCH]++; |
30 | else numberOfAxesInRange++; |
31 | else numberOfAxesInRange++; |
31 | 32 | ||
Line 32... | Line 33... | ||
32 | if(rawRollGyroSum < PITCHROLL_MINLIMIT) DACValues[DAC_ROLL]--; |
33 | if(rawGyroSum[ROLL] < PITCHROLL_MINLIMIT) DACValues[ROLL]--; |
33 | else if(rawRollGyroSum > PITCHROLL_MAXLIMIT) DACValues[DAC_ROLL]++; |
34 | else if(rawGyroSum[ROLL] > PITCHROLL_MAXLIMIT) DACValues[ROLL]++; |
34 | else numberOfAxesInRange++; |
35 | else numberOfAxesInRange++; |
Line 35... | Line 36... | ||
35 | 36 | ||
36 | if(rawYawGyroSum < GYRO_SUMMATION_FACTOR_YAW * 510) DACValues[DAC_YAW]--; |
37 | if(rawYawGyroSum < GYRO_SUMMATION_FACTOR_YAW * 510) DACValues[DAC_YAW]--; |
37 | else if(rawYawGyroSum > GYRO_SUMMATION_FACTOR_YAW * 515) DACValues[DAC_YAW]++ ; |
38 | else if(rawYawGyroSum > GYRO_SUMMATION_FACTOR_YAW * 515) DACValues[DAC_YAW]++ ; |
38 | else numberOfAxesInRange++; |
39 | else numberOfAxesInRange++; |
39 | 40 | ||
40 | if(DACValues[DAC_PITCH] < 10) { |
41 | if(DACValues[PITCH] < 10) { |
41 | /* GyroDefectNick = 1; */ DACValues[DAC_PITCH] = 10; |
42 | /* GyroDefectNick = 1; */ DACValues[PITCH] = 10; |
42 | } else if(DACValues[DAC_PITCH] > 245) { |
43 | } else if(DACValues[PITCH] > 245) { |
43 | /* GyroDefectNick = 1; */ DACValues[DAC_PITCH] = 245; |
44 | /* GyroDefectNick = 1; */ DACValues[PITCH] = 245; |
44 | } |
45 | } |
45 | if(DACValues[DAC_ROLL] < 10) { |
46 | if(DACValues[DAC_ROLL] < 10) { |
46 | /* GyroDefectRoll = 1; */ DACValues[DAC_ROLL] = 10; |
47 | /* GyroDefectRoll = 1; */ DACValues[ROLL] = 10; |
47 | } else if(DACValues[DAC_ROLL] > 245) { |
48 | } else if(DACValues[DAC_ROLL] > 245) { |
48 | /* GyroDefectRoll = 1; */ DACValues[DAC_ROLL] = 245; |
49 | /* GyroDefectRoll = 1; */ DACValues[ROLL] = 245; |