Rev 2116 | Rev 2125 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2116 | Rev 2119 | ||
---|---|---|---|
Line 2... | Line 2... | ||
2 | #include <stddef.h> |
2 | #include <stddef.h> |
3 | #include <string.h> |
3 | #include <string.h> |
4 | #include "configuration.h" |
4 | #include "configuration.h" |
5 | #include "rc.h" |
5 | #include "rc.h" |
6 | #include "output.h" |
6 | #include "output.h" |
- | 7 | #include "sensors.h" |
|
7 | #include "flight.h" |
8 | #include "flight.h" |
Line 8... | Line 9... | ||
8 | 9 | ||
9 | int16_t variables[VARIABLE_COUNT]; |
10 | int16_t variables[VARIABLE_COUNT]; |
10 | ParamSet_t staticParams; |
11 | ParamSet_t staticParams; |
Line 34... | Line 35... | ||
34 | 35 | ||
35 | {offsetof(ParamSet_t, gyroPID[2].P), offsetof(DynamicParams_t, gyroPID[2].P),0,255}, |
36 | {offsetof(ParamSet_t, gyroPID[2].P), offsetof(DynamicParams_t, gyroPID[2].P),0,255}, |
36 | {offsetof(ParamSet_t, gyroPID[2].I), offsetof(DynamicParams_t, gyroPID[2].I),0,255}, |
37 | {offsetof(ParamSet_t, gyroPID[2].I), offsetof(DynamicParams_t, gyroPID[2].I),0,255}, |
Line 37... | Line 38... | ||
37 | {offsetof(ParamSet_t, gyroPID[2].D), offsetof(DynamicParams_t, gyroPID[2].D),0,255}, |
38 | {offsetof(ParamSet_t, gyroPID[2].D), offsetof(DynamicParams_t, gyroPID[2].D),0,255}, |
38 | 39 | ||
39 | {offsetof(ParamSet_t, servoConfigurations[0].manualControl), offsetof(DynamicParams_t, servoManualControl[0]),0,255}, |
40 | {offsetof(ParamSet_t, gimbalServoConfigurations[0].manualControl), offsetof(DynamicParams_t, gimbalServoManualControl[0]),0,255}, |
40 | {offsetof(ParamSet_t, servoConfigurations[1].manualControl), offsetof(DynamicParams_t, servoManualControl[1]),0,255}, |
41 | {offsetof(ParamSet_t, gimbalServoConfigurations[1].manualControl), offsetof(DynamicParams_t, gimbalServoManualControl[1]),0,255}, |
41 | {offsetof(ParamSet_t, outputFlash[0].timing), offsetof(DynamicParams_t, output0Timing),0,255}, |
42 | {offsetof(ParamSet_t, outputFlash[0].timing), offsetof(DynamicParams_t, output0Timing),0,255}, |
Line 42... | Line 43... | ||
42 | {offsetof(ParamSet_t, outputFlash[1].timing), offsetof(DynamicParams_t, output1Timing),0,255}, |
43 | {offsetof(ParamSet_t, outputFlash[1].timing), offsetof(DynamicParams_t, output1Timing),0,255}, |
Line 135... | Line 136... | ||
135 | staticParams.airspeedCorrection = 100; |
136 | staticParams.airspeedCorrection = 100; |
136 | staticParams.isFlyingThreshold = 100; |
137 | staticParams.isFlyingThreshold = 100; |
Line 137... | Line 138... | ||
137 | 138 | ||
138 | // Servos |
139 | // Servos |
- | 140 | staticParams.servoCount = 7; |
|
- | 141 | staticParams.servosReverse = CONTROL_SERVO_REVERSE_ELEVATOR | CONTROL_SERVO_REVERSE_RUDDER; |
|
139 | staticParams.servoCount = 7; |
142 | |
140 | staticParams.servoManualMaxSpeed = 10; |
143 | staticParams.gimbalServoMaxManualSpeed = 10; |
141 | for (uint8_t i=0; i<2; i++) { |
144 | for (uint8_t i=0; i<2; i++) { |
142 | staticParams.servoConfigurations[i].manualControl = 128; |
145 | staticParams.gimbalServoConfigurations[i].manualControl = 128; |
143 | staticParams.servoConfigurations[i].stabilizationFactor = 0; |
146 | staticParams.gimbalServoConfigurations[i].stabilizationFactor = 0; |
144 | staticParams.servoConfigurations[i].minValue = 32; |
147 | staticParams.gimbalServoConfigurations[i].minValue = 32; |
145 | staticParams.servoConfigurations[i].maxValue = 224; |
148 | staticParams.gimbalServoConfigurations[i].maxValue = 224; |
146 | staticParams.servoConfigurations[i].flags = 0; |
149 | staticParams.gimbalServoConfigurations[i].flags = 0; |
Line 147... | Line 150... | ||
147 | } |
150 | } |
148 | 151 | ||
149 | // Battery warning and emergency flight |
- | |
150 | staticParams.batteryVoltageWarning = 101; // 3.7 each for 3S |
- | |
Line 151... | Line 152... | ||
151 | staticParams.emergencyThrottle = 35; |
152 | // Battery warning and emergency flight |
152 | staticParams.emergencyFlightDuration = 30; |
153 | staticParams.batteryWarningVoltage = 101; // 3.7 each for 3S |
153 | 154 | ||
154 | for (uint8_t i=0; i<3; i++) { |
155 | for (uint8_t i=0; i<3; i++) { |
155 | staticParams.gyroPID[i].P = 80; |
156 | staticParams.gyroPID[i].P = 80; |
156 | staticParams.gyroPID[i].I = 80; |
157 | staticParams.gyroPID[i].I = 80; |
Line 157... | Line 158... | ||
157 | staticParams.gyroPID[i].D = 40; |
158 | staticParams.gyroPID[i].D = 40; |
158 | staticParams.gyroPID[i].iMax = 45; |
159 | staticParams.gyroPID[i].iMax = 30; |
159 | } |
160 | } |
Line 160... | Line 161... | ||
160 | 161 | ||
161 | staticParams.stickIElevator = 80; |
162 | staticParams.stickIElevator = 60; |
162 | staticParams.stickIAilerons = 120; |
163 | staticParams.stickIAilerons = 80; |
163 | staticParams.stickIRudder = 40; |
164 | staticParams.stickIRudder = 25; |
Line 191... | Line 192... | ||
191 | void IMUConfig_default(void) { |
192 | void IMUConfig_default(void) { |
192 | IMUConfig.gyroPIDFilterConstant = 1; |
193 | IMUConfig.gyroPIDFilterConstant = 1; |
193 | IMUConfig.gyroDFilterConstant = 1; |
194 | IMUConfig.gyroDFilterConstant = 1; |
194 | IMUConfig.rateTolerance = 120; |
195 | IMUConfig.rateTolerance = 120; |
195 | IMUConfig.gyroDWindowLength = 3; |
196 | IMUConfig.gyroDWindowLength = 3; |
196 | IMUConfig.gyroQuadrant = 0; |
197 | IMUConfig.gyroQuadrant = 2; |
197 | IMUConfig.imuReversedFlags = 0; |
198 | IMUConfig.imuReversedFlags = 0; |
198 | gyro_setDefaultParameters(); |
199 | gyro_setDefaultParameters(); |
199 | } |
200 | } |
Line 200... | Line 201... | ||
200 | 201 | ||
201 | /***************************************************/ |
202 | /***************************************************/ |
202 | /* Default Values for R/C Channels */ |
203 | /* Default Values for R/C Channels */ |
203 | /***************************************************/ |
204 | /***************************************************/ |
- | 205 | void channelMap_default(void) { |
|
204 | void channelMap_default(void) { |
206 | channelMap.RCPolarity = 1; |
- | 207 | channelMap.trim = 192; |
|
205 | channelMap.trim = 0; |
208 | channelMap.variableOffset = 128; |
206 | channelMap.channels[CH_ELEVATOR] = 1; |
209 | channelMap.channels[CH_ELEVATOR] = 1; |
207 | channelMap.channels[CH_AILERONS] = 0; |
210 | channelMap.channels[CH_AILERONS] = 0; |
208 | channelMap.channels[CH_THROTTLE] = 2; |
211 | channelMap.channels[CH_THROTTLE] = 2; |
209 | channelMap.channels[CH_RUDDER] = 3; |
212 | channelMap.channels[CH_RUDDER] = 3; |