Rev 2142 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2142 | Rev 2143 | ||
---|---|---|---|
Line 55... | Line 55... | ||
55 | for (uint8_t axis=0; axis<3; axis++) { |
55 | for (uint8_t axis=0; axis<3; axis++) { |
56 | maxError[axis] = (int32_t)staticParams.gyroPID[axis].iMax * GYRO_DEG_FACTOR; |
56 | maxError[axis] = (int32_t)staticParams.gyroPID[axis].iMax * GYRO_DEG_FACTOR; |
57 | } |
57 | } |
58 | } |
58 | } |
Line -... | Line 59... | ||
- | 59 | ||
- | 60 | // min = 10 max = 12, speed = 11 shold make 50/50 cycle. |
|
- | 61 | void updateAirspeedIndicatorLEDs(void) { |
|
- | 62 | static uint8_t flashPrescaler = 0; |
|
- | 63 | static uint8_t flashCnt = 0; |
|
- | 64 | ||
- | 65 | flashPrescaler++; |
|
- | 66 | if (flashPrescaler == 10) { |
|
- | 67 | flashPrescaler = 0; |
|
- | 68 | ||
- | 69 | if (airspeedVelocity <= staticParams.minFlashAirspeed) { |
|
- | 70 | debugOut.digital[0] &= ~DEBUG_AIRSPEED; |
|
- | 71 | debugOut.digital[1] &= ~DEBUG_AIRSPEED; |
|
- | 72 | return; |
|
- | 73 | } |
|
- | 74 | if (airspeedVelocity >= staticParams.maxFlashAirspeed) { |
|
- | 75 | debugOut.digital[0] |= DEBUG_AIRSPEED; |
|
- | 76 | debugOut.digital[1] |= DEBUG_AIRSPEED; |
|
- | 77 | return; |
|
- | 78 | } |
|
- | 79 | ||
- | 80 | uint8_t span = staticParams.maxFlashAirspeed - staticParams.minFlashAirspeed; // is 2 |
|
- | 81 | uint8_t speed = airspeedVelocity - staticParams.minFlashAirspeed; // is 1 |
|
- | 82 | ||
- | 83 | if (flashCnt > speed) { |
|
- | 84 | debugOut.digital[0] &= ~DEBUG_AIRSPEED; |
|
- | 85 | debugOut.digital[1] &= ~DEBUG_AIRSPEED; |
|
- | 86 | } else { |
|
- | 87 | debugOut.digital[0] |= DEBUG_AIRSPEED; |
|
- | 88 | debugOut.digital[1] |= DEBUG_AIRSPEED; |
|
- | 89 | } |
|
- | 90 | ||
- | 91 | flashCnt++; |
|
- | 92 | if (flashCnt >= span) flashCnt = 0; |
|
- | 93 | } |
|
- | 94 | } |
|
59 | 95 | ||
60 | // Normal at airspeed = 10. |
96 | // Normal at airspeed = 10. |
61 | uint8_t calcAirspeedPID(uint8_t pid) { |
97 | uint8_t calcAirspeedPID(uint8_t pid) { |
62 | if (!(staticParams.bitConfig & CFG_USE_AIRSPEED_PID)) { |
98 | if (!(staticParams.bitConfig & CFG_USE_AIRSPEED_PID)) { |
63 | return pid; |
99 | return pid; |