Rev 2086 | Rev 2089 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2086 | Rev 2088 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #include <inttypes.h> |
1 | #include <inttypes.h> |
2 | #include "analog.h" |
2 | #include "analog.h" |
3 | #include "attitude.h" |
3 | #include "attitude.h" |
4 | #include "configuration.h" |
4 | #include "configuration.h" |
5 | #include "controlMixer.h" |
5 | #include "controlMixer.h" |
6 | - | ||
7 | // for digital / LED debug. |
6 | // for digital / LED debug. |
8 | #include "output.h" |
7 | #include "output.h" |
Line 9... | Line 8... | ||
9 | 8 | ||
10 | // For scope debugging only! |
9 | // For scope debugging only! |
Line 11... | Line 10... | ||
11 | #include "rc.h" |
10 | #include "rc.h" |
Line 12... | Line 11... | ||
12 | 11 | ||
Line -... | Line 12... | ||
- | 12 | #define INTEGRAL_LIMIT 100000 |
|
- | 13 | ||
- | 14 | #define LATCH_TIME 3 |
|
- | 15 | ||
- | 16 | // This will translate a height value to a target height in centimeters. |
|
- | 17 | // Currently: One step is 50 cm and zero is 5 meters below the takeoff altitude. With max. 255 steps the max. |
|
13 | #define INTEGRAL_LIMIT 100000 |
18 | // target height is then about 120m. |
14 | 19 | #define HEIGHT_GAIN 50L |
|
Line 15... | Line 20... | ||
15 | #define LATCH_TIME 3 |
20 | #define HEIGHT_FORMULA(x) ((x) * HEIGHT_GAIN - 500L) |
16 | 21 | ||
Line 62... | Line 67... | ||
62 | // Switch is OFF. |
67 | // Switch is OFF. |
63 | setHeightLatch = 0; |
68 | setHeightLatch = 0; |
64 | } |
69 | } |
65 | } else { |
70 | } else { |
66 | // Switch is not activated; take the "max-height" as the target height. |
71 | // Switch is not activated; take the "max-height" as the target height. |
67 | setHeight = (uint16_t) dynamicParams.heightSetting * 25L - 500L; // should be: 100 (or make a param out of it) |
72 | setHeight = (uint16_t) (HEIGHT_FORMULA(dynamicParams.heightSetting)); // should be: 100 (or make a param out of it) |
68 | } |
73 | } |
Line 69... | Line 74... | ||
69 | 74 | ||
70 | /* |
75 | /* |
71 | if (++heightRampingTimer == INTEGRATION_FREQUENCY / 10) { |
76 | if (++heightRampingTimer == INTEGRATION_FREQUENCY / 10) { |
Line 105... | Line 110... | ||
105 | } |
110 | } |
Line 106... | Line 111... | ||
106 | 111 | ||
107 | if (hc_testOscTimer < staticParams.heightControlTestOscPeriod/2) |
112 | if (hc_testOscTimer < staticParams.heightControlTestOscPeriod/2) |
108 | targetHeight = setHeight; |
113 | targetHeight = setHeight; |
109 | else |
114 | else |
Line 110... | Line 115... | ||
110 | targetHeight = setHeight + (uint16_t)staticParams.heightControlTestOscAmplitude * 25L; |
115 | targetHeight = setHeight + (uint16_t)staticParams.heightControlTestOscAmplitude * HEIGHT_GAIN; |
111 | 116 | ||
112 | //if (staticParams.) |
117 | //if (staticParams.) |
113 | // height, in meters (so the division factor is: 100) |
118 | // height, in meters (so the division factor is: 100) |