Subversion Repositories FlightCtrl

Rev

Rev 2103 | Rev 2108 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2103 Rev 2104
Line 17... Line 17...
17
uint8_t boardRelease;
17
uint8_t boardRelease;
18
uint8_t requiredMotors;
18
uint8_t requiredMotors;
Line 19... Line 19...
19
 
19
 
Line 20... Line -...
20
VersionInfo_t versionInfo;
-
 
21
 
20
VersionInfo_t versionInfo;
22
// MK flags. TODO: Replace by enum. State machine.
21
 
Line 23... Line 22...
23
FlightMode_t currentFlightMode = FLIGHT_MODE_MANUAL;
22
FlightMode_t currentFlightMode = FLIGHT_MODE_MANUAL;
24
volatile uint8_t isMotorRunning = 0;
23
volatile uint8_t isMotorRunning = 0;
-
 
24
 
-
 
25
const MMXLATION XLATIONS[] = {
-
 
26
{offsetof(ParamSet_t, externalControl), offsetof(DynamicParams_t, externalControl),0,255},
-
 
27
 
-
 
28
{offsetof(ParamSet_t, gyroPID[0].P), offsetof(DynamicParams_t, gyroPID[0].P),0,255},
-
 
29
{offsetof(ParamSet_t, gyroPID[0].I), offsetof(DynamicParams_t, gyroPID[0].I),0,255},
-
 
30
{offsetof(ParamSet_t, gyroPID[0].D), offsetof(DynamicParams_t, gyroPID[0].D),0,255},
-
 
31
 
-
 
32
{offsetof(ParamSet_t, gyroPID[1].P), offsetof(DynamicParams_t, gyroPID[1].P),0,255},
-
 
33
{offsetof(ParamSet_t, gyroPID[1].I), offsetof(DynamicParams_t, gyroPID[1].I),0,255},
-
 
34
{offsetof(ParamSet_t, gyroPID[1].D), offsetof(DynamicParams_t, gyroPID[1].D),0,255},
-
 
35
 
-
 
36
{offsetof(ParamSet_t, gyroPID[2].P), offsetof(DynamicParams_t, gyroPID[2].P),0,255},
25
 
37
{offsetof(ParamSet_t, gyroPID[2].I), offsetof(DynamicParams_t, gyroPID[2].I),0,255},
26
const MMXLATION XLATIONS[] = {
38
{offsetof(ParamSet_t, gyroPID[2].D), offsetof(DynamicParams_t, gyroPID[2].D),0,255},
27
{offsetof(ParamSet_t, externalControl), offsetof(DynamicParams_t, externalControl),0,255},
39
 
28
{offsetof(ParamSet_t, servoConfigurations[0].manualControl), offsetof(DynamicParams_t, servoManualControl[0]),0,255},
40
{offsetof(ParamSet_t, servoConfigurations[0].manualControl), offsetof(DynamicParams_t, servoManualControl[0]),0,255},
29
{offsetof(ParamSet_t, servoConfigurations[1].manualControl), offsetof(DynamicParams_t, servoManualControl[1]),0,255},
41
{offsetof(ParamSet_t, servoConfigurations[1].manualControl), offsetof(DynamicParams_t, servoManualControl[1]),0,255},
Line 102... Line 114...
102
  RED_OFF;
114
  RED_OFF;
103
  GRN_OFF;
115
  GRN_OFF;
104
}
116
}
Line 105... Line 117...
105
 
117
 
-
 
118
void configuration_setFlightParameters(uint8_t newFlightMode) {
106
void configuration_setFlightParameters(uint8_t newFlightMode) {
119
        currentFlightMode = newFlightMode;
107
        flight_updateFlightParametersToFlightMode(currentFlightMode = newFlightMode);
120
        flight_updateFlightParametersToFlightMode();
Line 108... Line 121...
108
}
121
}
109
 
122
 
110
// Called after a change in configuration parameters, as a hook for modules to take over changes.
123
// Called after a change in configuration parameters, as a hook for modules to take over changes.
Line 134... Line 147...
134
  // Battery warning and emergency flight
147
  // Battery warning and emergency flight
135
  staticParams.batteryVoltageWarning = 101;  // 3.7 each for 3S
148
  staticParams.batteryVoltageWarning = 101;  // 3.7 each for 3S
136
  staticParams.emergencyThrottle = 35;
149
  staticParams.emergencyThrottle = 35;
137
  staticParams.emergencyFlightDuration = 30;
150
  staticParams.emergencyFlightDuration = 30;
Line -... Line 151...
-
 
151
 
-
 
152
  for (uint8_t i=0; i<3; i++) {
-
 
153
          staticParams.gyroPID[i].P = 80;
-
 
154
          staticParams.gyroPID[i].I = 80;
-
 
155
          staticParams.gyroPID[i].D = 40;
-
 
156
  }
138
 
157
 
139
  staticParams.stickIElevator = 80;
158
  staticParams.stickIElevator = 80;
140
  staticParams.stickIAilerons = 120;
159
  staticParams.stickIAilerons = 120;
Line 141... Line 160...
141
  staticParams.stickIRudder = 40;
160
  staticParams.stickIRudder = 40;
Line 159... Line 178...
159
  for (uint8_t i=0; i<8; i++) {
178
  for (uint8_t i=0; i<8; i++) {
160
    staticParams.userParams[i] = i;
179
    staticParams.userParams[i] = i;
161
  }
180
  }
Line 162... Line 181...
162
 
181
 
163
  staticParams.bitConfig =
182
  staticParams.bitConfig =
Line 164... Line 183...
164
    CFG_GYRO_SATURATION_PREVENTION | CFG_COMPASS_ENABLED;
183
    CFG_GYRO_SATURATION_PREVENTION;
165
 
184
 
Line 166... Line 185...
166
  memcpy(staticParams.name, "Default\0", 6);
185
  memcpy(staticParams.name, "Default\0", 6);