Subversion Repositories FlightCtrl

Rev

Rev 2092 | Rev 2156 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2092 Rev 2095
1
#include <util/delay.h>
1
#include <util/delay.h>
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 "sensors.h"
5
#include "sensors.h"
6
#include "rc.h"
6
#include "rc.h"
7
#include "output.h"
7
#include "output.h"
8
#include "flight.h"
8
#include "flight.h"
9
 
9
 
10
int16_t variables[VARIABLE_COUNT];
10
int16_t variables[VARIABLE_COUNT];
11
ParamSet_t staticParams;
11
ParamSet_t staticParams;
12
channelMap_t channelMap;
12
channelMap_t channelMap;
13
mixerMatrix_t mixerMatrix;
13
mixerMatrix_t mixerMatrix;
14
IMUConfig_t IMUConfig;
14
IMUConfig_t IMUConfig;
15
volatile DynamicParams_t dynamicParams;
15
volatile DynamicParams_t dynamicParams;
16
 
16
 
17
uint8_t CPUType;
17
uint8_t CPUType;
18
uint8_t boardRelease;
18
uint8_t boardRelease;
19
uint8_t requiredMotors;
19
uint8_t requiredMotors;
20
 
20
 
21
VersionInfo_t versionInfo;
21
VersionInfo_t versionInfo;
22
 
22
 
23
// MK flags. TODO: Replace by enum. State machine.
23
// MK flags. TODO: Replace by enum. State machine.
24
uint16_t isFlying = 0;
24
uint16_t isFlying = 0;
25
volatile uint8_t MKFlags = 0;
25
volatile uint8_t MKFlags = 0;
26
 
26
 
27
const MMXLATION XLATIONS[] = {
27
const MMXLATION XLATIONS[] = {
28
{offsetof(ParamSet_t, levelCorrection[0]), offsetof(DynamicParams_t, levelCorrection[0]),0,255},
28
{offsetof(ParamSet_t, levelCorrection[0]), offsetof(DynamicParams_t, levelCorrection[0]),0,255},
29
{offsetof(ParamSet_t, levelCorrection[1]), offsetof(DynamicParams_t, levelCorrection[1]),0,255},
29
{offsetof(ParamSet_t, levelCorrection[1]), offsetof(DynamicParams_t, levelCorrection[1]),0,255},
30
{offsetof(ParamSet_t, gyroP), offsetof(DynamicParams_t, gyroP),0,255},
30
{offsetof(ParamSet_t, gyroP), offsetof(DynamicParams_t, gyroP),0,255},
31
{offsetof(ParamSet_t, gyroI), offsetof(DynamicParams_t, gyroI),0,255},
31
{offsetof(ParamSet_t, gyroI), offsetof(DynamicParams_t, gyroI),0,255},
32
{offsetof(ParamSet_t, gyroD), offsetof(DynamicParams_t, gyroD),0,255},
32
{offsetof(ParamSet_t, gyroD), offsetof(DynamicParams_t, gyroD),0,255},
33
{offsetof(ParamSet_t, attitudeControl), offsetof(DynamicParams_t, attitudeControl),0,255},
33
{offsetof(ParamSet_t, attitudeControl), offsetof(DynamicParams_t, attitudeControl),0,255},
34
{offsetof(ParamSet_t, externalControl), offsetof(DynamicParams_t, externalControl),0,255},
34
{offsetof(ParamSet_t, externalControl), offsetof(DynamicParams_t, externalControl),0,255},
35
{offsetof(ParamSet_t, dynamicStability), offsetof(DynamicParams_t, dynamicStability),0,255},
35
{offsetof(ParamSet_t, dynamicStability), offsetof(DynamicParams_t, dynamicStability),0,255},
36
{offsetof(ParamSet_t, heightP), offsetof(DynamicParams_t, heightP),0,255},
36
{offsetof(ParamSet_t, heightP), offsetof(DynamicParams_t, heightP),0,255},
37
{offsetof(ParamSet_t, heightI), offsetof(DynamicParams_t, heightI),0,255},
37
{offsetof(ParamSet_t, heightI), offsetof(DynamicParams_t, heightI),0,255},
38
{offsetof(ParamSet_t, heightD), offsetof(DynamicParams_t, heightD),0,255},
38
{offsetof(ParamSet_t, heightD), offsetof(DynamicParams_t, heightD),0,255},
39
{offsetof(ParamSet_t, heightSetting), offsetof(DynamicParams_t, heightSetting),0,255},
39
{offsetof(ParamSet_t, heightSetting), offsetof(DynamicParams_t, heightSetting),0,255},
40
{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},
41
{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},
42
{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},
43
{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},
44
{offsetof(ParamSet_t, naviMode), offsetof(DynamicParams_t, naviMode),0,255}};
44
{offsetof(ParamSet_t, naviMode), offsetof(DynamicParams_t, naviMode),0,255}};
45
 
45
 
46
uint8_t configuration_applyVariableToParam(uint8_t src, uint8_t min, uint8_t max) {
46
uint8_t configuration_applyVariableToParam(uint8_t src, uint8_t min, uint8_t max) {
47
  uint8_t result;
47
  uint8_t result;
48
  if (src>=(256-VARIABLE_COUNT)) result = variables[src-(256-VARIABLE_COUNT)];
48
  if (src>=(256-VARIABLE_COUNT)) result = variables[src-(256-VARIABLE_COUNT)];
49
  else result = src;
49
  else result = src;
50
  if (result < min) result = min;
50
  if (result < min) result = min;
51
  else if (result > max) result = max;
51
  else if (result > max) result = max;
52
  return result;
52
  return result;
53
}
53
}
54
 
54
 
55
void configuration_applyVariablesToParams(void) {
55
void configuration_applyVariablesToParams(void) {
56
  uint8_t i, src;
56
  uint8_t i, src;
57
  uint8_t* pointerToTgt;
57
  uint8_t* pointerToTgt;
58
 
58
 
59
  for(i=0; i<sizeof(XLATIONS)/sizeof(MMXLATION); i++) {
59
  for(i=0; i<sizeof(XLATIONS)/sizeof(MMXLATION); i++) {
60
    src = *((uint8_t*)(&staticParams) + XLATIONS[i].sourceIdx);
60
    src = *((uint8_t*)(&staticParams) + XLATIONS[i].sourceIdx);
61
    pointerToTgt = (uint8_t*)(&dynamicParams) + XLATIONS[i].targetIdx;
61
    pointerToTgt = (uint8_t*)(&dynamicParams) + XLATIONS[i].targetIdx;
62
    *pointerToTgt = configuration_applyVariableToParam(src, XLATIONS[i].min, XLATIONS[i].max);
62
    *pointerToTgt = configuration_applyVariableToParam(src, XLATIONS[i].min, XLATIONS[i].max);
63
  }
63
  }
64
 
64
 
65
  // User parameters are always variable.
65
  // User parameters are always variable.
66
  for (i=0; i<sizeof(staticParams.userParams); i++) {
66
  for (i=0; i<sizeof(staticParams.userParams); i++) {
67
    src = *((uint8_t*)(&staticParams) + offsetof(ParamSet_t, userParams) + i);
67
    src = *((uint8_t*)(&staticParams) + offsetof(ParamSet_t, userParams) + i);
68
    pointerToTgt = (uint8_t*)(&dynamicParams) + offsetof(DynamicParams_t, userParams) + i;
68
    pointerToTgt = (uint8_t*)(&dynamicParams) + offsetof(DynamicParams_t, userParams) + i;
69
    *pointerToTgt = configuration_applyVariableToParam(src, 0, 255);
69
    *pointerToTgt = configuration_applyVariableToParam(src, 0, 255);
70
  }
70
  }
71
}
71
}
72
 
72
 
73
void setCPUType(void) {   // works only after reset or power on when the registers have default values
73
void setCPUType(void) {   // works only after reset or power on when the registers have default values
74
  if((UCSR1A == 0x20) && (UCSR1C == 0x06)) CPUType = ATMEGA644P;  // initial Values for 644P after reset
74
  if((UCSR1A == 0x20) && (UCSR1C == 0x06)) CPUType = ATMEGA644P;  // initial Values for 644P after reset
75
  else CPUType = ATMEGA644;
75
  else CPUType = ATMEGA644;
76
}
76
}
77
 
77
 
78
/*
78
/*
79
 * Automatic detection of hardware components is not supported in this development-oriented
79
 * Automatic detection of hardware components is not supported in this development-oriented
80
 * FC firmware. It would go against the point of it: To enable alternative hardware
80
 * FC firmware. It would go against the point of it: To enable alternative hardware
81
 * configurations with otherwise unsupported components. Instead, one should write
81
 * configurations with otherwise unsupported components. Instead, one should write
82
 * custom code + adjust constants for the new hardware, and include the relevant code
82
 * custom code + adjust constants for the new hardware, and include the relevant code
83
 * from the makefile.
83
 * from the makefile.
84
 * However - we still do detect the board release. Reason: Otherwise it would be too
84
 * However - we still do detect the board release. Reason: Otherwise it would be too
85
 * tedious to have to modify the code for how to turn on and off LEDs when deploying
85
 * tedious to have to modify the code for how to turn on and off LEDs when deploying
86
 * on different HW version....
86
 * on different HW version....
87
 */
87
 */
88
void setBoardRelease(void) {
88
void setBoardRelease(void) {
89
  // the board release is coded via the pull up or down the 2 status LED
89
  // the board release is coded via the pull up or down the 2 status LED
90
 
90
 
91
  PORTB &= ~((1 << PORTB1)|(1 << PORTB0)); // set tristate
91
  PORTB &= ~((1 << PORTB1)|(1 << PORTB0)); // set tristate
92
  DDRB  &= ~((1 << DDB0)|(1 << DDB0)); // set port direction as input
92
  DDRB  &= ~((1 << DDB0)|(1 << DDB0)); // set port direction as input
93
 
93
 
94
  _delay_loop_2(1000); // make some delay
94
  _delay_loop_2(1000); // make some delay
95
 
95
 
96
  switch( PINB & ((1<<PINB1)|(1<<PINB0))) {
96
  switch( PINB & ((1<<PINB1)|(1<<PINB0))) {
97
    case 0x00:
97
    case 0x00:
98
      boardRelease = 10; // 1.0
98
      boardRelease = 10; // 1.0
99
      break;
99
      break;
100
    case 0x01:
100
    case 0x01:
101
      boardRelease = 11; // 1.1 or 1.2
101
      boardRelease = 11; // 1.1 or 1.2
102
      break;
102
      break;
103
    case 0x02:
103
    case 0x02:
104
      boardRelease = 20; // 2.0
104
      boardRelease = 20; // 2.0
105
      break;
105
      break;
106
    case 0x03:
106
    case 0x03:
107
      boardRelease = 13; // 1.3
107
      boardRelease = 13; // 1.3
108
      break;
108
      break;
109
    default:
109
    default:
110
      break;
110
      break;
111
    }
111
    }
112
  // set LED ports as output
112
  // set LED ports as output
113
  DDRB |= (1<<DDB1)|(1<<DDB0);
113
  DDRB |= (1<<DDB1)|(1<<DDB0);
114
  RED_OFF;
114
  RED_OFF;
115
  GRN_OFF;
115
  GRN_OFF;
116
}
116
}
117
 
117
 
118
void configuration_setNormalFlightParameters(void) {
118
void configuration_setNormalFlightParameters(void) {
119
  flight_setParameters(staticParams.IFactor, dynamicParams.gyroP,
119
  flight_setParameters(staticParams.IFactor, dynamicParams.gyroP,
120
      staticParams.bitConfig & CFG_HEADING_HOLD ? 0 : dynamicParams.gyroI,
120
      staticParams.bitConfig & CFG_HEADING_HOLD ? 0 : dynamicParams.gyroI,
121
      dynamicParams.gyroP, staticParams.yawIFactor);
121
      dynamicParams.gyroP, staticParams.yawIFactor);
122
}
122
}
123
 
123
 
124
void configuration_setFailsafeFlightParameters(void) {
124
void configuration_setFailsafeFlightParameters(void) {
125
  flight_setParameters(0, 90, 120, 90, 120);
125
  flight_setParameters(0, 90, 120, 90, 120);
126
}
126
}
127
 
127
 
128
// Called after a change in configuration parameters, as a hook for modules to take over changes.
128
// Called after a change in configuration parameters, as a hook for modules to take over changes.
129
void configuration_paramSetDidChange(void) {
129
void configuration_paramSetDidChange(void) {
130
  // This should be OK to do here as long as we don't change parameters during emergency flight. We don't.
130
  // This should be OK to do here as long as we don't change parameters during emergency flight. We don't.
131
  configuration_setNormalFlightParameters();
131
  configuration_setNormalFlightParameters();
132
  // Immediately load changes to output, and also signal the paramset change.
132
  // Immediately load changes to output, and also signal the paramset change.
133
  output_init();
133
  output_init();
134
}
134
}
135
 
135
 
136
void setOtherDefaults(void) {
136
void setOtherDefaults(void) {
137
  // Height Control
137
  // Height Control
138
  staticParams.airpressureFilterConstant = 8;
138
  staticParams.airpressureFilterConstant = 8;
139
  //staticParams.airpressureWindowLength = 0;
139
  //staticParams.airpressureWindowLength = 0;
140
  staticParams.airpressureAccZCorrection = 128+56;
140
  staticParams.airpressureAccZCorrection = 128+56;
141
  staticParams.heightP = 10;
141
  staticParams.heightP = 10;
142
  staticParams.heightD = 30;
142
  staticParams.heightD = 30;
143
  staticParams.heightSetting = 251;
143
  staticParams.heightSetting = 251;
144
  staticParams.heightControlMaxThrottleChange = 10;
144
  staticParams.heightControlMaxThrottleChange = 10;
145
 
145
 
146
  // Control
146
  // Control
147
  staticParams.stickP = 8;
147
  staticParams.stickP = 8;
148
  staticParams.stickD = 12;
148
  staticParams.stickD = 12;
149
  staticParams.stickYawP = 12;
149
  staticParams.stickYawP = 12;
150
  staticParams.stickThrottleD = 12;
150
  staticParams.stickThrottleD = 12;
151
  staticParams.minThrottle = 8;
151
  staticParams.minThrottle = 8;
152
  staticParams.maxThrottle = 230;
152
  staticParams.maxThrottle = 230;
153
  staticParams.externalControl = 0;
153
  staticParams.externalControl = 0;
154
  staticParams.motorSmoothing = 0;
154
  staticParams.motorSmoothing = 0;
155
 
155
 
156
  staticParams.gyroP = 60;
156
  staticParams.gyroP = 60;
157
  staticParams.gyroI = 80;
157
  staticParams.gyroI = 80;
158
  staticParams.gyroD = 4;
158
  staticParams.gyroD = 4;
159
 
159
 
160
  // set by gyro-specific code: gyro_setDefaults().
160
  // set by gyro-specific code: gyro_setDefaults().
161
  // staticParams.zerothOrderCorrection = 
161
  // staticParams.zerothOrderCorrection = 
162
  // staticParams.driftCompDivider = 
162
  // staticParams.driftCompDivider = 
163
  // staticParams.driftCompLimit = 
163
  // staticParams.driftCompLimit = 
164
 
164
 
165
  staticParams.dynamicStability = 50;
165
  staticParams.dynamicStability = 50;
166
  staticParams.IFactor = 52;
166
  staticParams.IFactor = 52;
167
  staticParams.yawIFactor = 100;  
167
  staticParams.yawIFactor = 100;  
168
  staticParams.compassYawCorrection = 64;
168
  staticParams.compassYawCorrection = 64;
169
  staticParams.compassP = 50;
169
  staticParams.compassP = 50;
170
  staticParams.levelCorrection[0] = staticParams.levelCorrection[1] = 128;
170
  staticParams.levelCorrection[0] = staticParams.levelCorrection[1] = 128;
171
 
171
 
172
  // Servos
172
  // Servos
173
  staticParams.servoCount = 7;
173
  staticParams.servoCount = 7;
174
  staticParams.servoManualMaxSpeed = 10;
174
  staticParams.servoManualMaxSpeed = 10;
175
  for (uint8_t i=0; i<2; i++) {
175
  for (uint8_t i=0; i<2; i++) {
176
    staticParams.servoConfigurations[i].manualControl = 128;
176
    staticParams.servoConfigurations[i].manualControl = 128;
177
    staticParams.servoConfigurations[i].stabilizationFactor = 0;
177
    staticParams.servoConfigurations[i].stabilizationFactor = 0;
178
    staticParams.servoConfigurations[i].minValue = 32;
178
    staticParams.servoConfigurations[i].minValue = 32;
179
    staticParams.servoConfigurations[i].maxValue = 224;
179
    staticParams.servoConfigurations[i].maxValue = 224;
180
    staticParams.servoConfigurations[i].flags = 0;
180
    staticParams.servoConfigurations[i].flags = 0;
181
  }
181
  }
182
 
182
 
183
  // Battery warning and emergency flight
183
  // Battery warning and emergency flight
184
  staticParams.batteryVoltageWarning = 101;  // 3.7 each for 3S
184
  staticParams.batteryVoltageWarning = 101;  // 3.7 each for 3S
185
  staticParams.emergencyThrottle = 35;
185
  staticParams.emergencyThrottle = 35;
186
  staticParams.emergencyFlightDuration = 30;
186
  staticParams.emergencyFlightDuration = 30;
187
 
187
 
188
  // Outputs
188
  // Outputs
189
  staticParams.outputFlash[0].bitmask = 1; //0b01011111;
189
  staticParams.outputFlash[0].bitmask = 1; //0b01011111;
190
  staticParams.outputFlash[0].timing = 15;
190
  staticParams.outputFlash[0].timing = 15;
191
  staticParams.outputFlash[1].bitmask = 3; //0b11110011;
191
  staticParams.outputFlash[1].bitmask = 3; //0b11110011;
192
  staticParams.outputFlash[1].timing = 15;
192
  staticParams.outputFlash[1].timing = 15;
193
 
193
 
194
  staticParams.outputDebugMask = 8;
194
  staticParams.outputDebugMask = 8;
195
  staticParams.outputFlags   = OUTPUTFLAGS_FLASH_0_AT_BEEP | OUTPUTFLAGS_FLASH_1_AT_BEEP | OUTPUTFLAGS_USE_ONBOARD_LEDS;
195
  staticParams.outputFlags   = OUTPUTFLAGS_FLASH_0_AT_BEEP | OUTPUTFLAGS_FLASH_1_AT_BEEP | OUTPUTFLAGS_USE_ONBOARD_LEDS;
196
 
196
 
197
  staticParams.naviMode = 0; // free.
197
  staticParams.naviMode = 0; // free.
198
  staticParams.airpressureWindowLength = 0;
198
  staticParams.airpressureWindowLength = 0;
199
  staticParams.airpressureDWindowLength = 24;
199
  staticParams.airpressureDWindowLength = 24;
200
 
200
 
201
  staticParams.heightControlMaxIntegralIn = 125;
201
  staticParams.heightControlMaxIntegralIn = 125;
202
  staticParams.heightControlMaxIntegralOut = 75;
202
  staticParams.heightControlMaxIntegralOut = 75;
203
  staticParams.heightControlMaxThrottleChange = 75;
203
  staticParams.heightControlMaxThrottleChange = 75;
204
  staticParams.heightControlTestOscPeriod = 0;
204
  staticParams.heightControlTestOscPeriod = 0;
205
  staticParams.heightControlTestOscAmplitude = 0;
205
  staticParams.heightControlTestOscAmplitude = 0;
206
}
206
}
207
 
207
 
208
/***************************************************/
208
/***************************************************/
209
/*    Default Values for parameter set 1           */
209
/*    Default Values for parameter set 1           */
210
/***************************************************/
210
/***************************************************/
211
void paramSet_default(uint8_t setnumber) {
211
void paramSet_default(uint8_t setnumber) {
212
  setOtherDefaults();
212
  setOtherDefaults();
213
 
213
 
214
  for (uint8_t i=0; i<8; i++) {
214
  for (uint8_t i=0; i<8; i++) {
215
    staticParams.userParams[i] = i;
215
    staticParams.userParams[i] = i;
216
  }
216
  }
217
 
217
 
218
  staticParams.bitConfig =
218
  staticParams.bitConfig =
219
    CFG_GYRO_SATURATION_PREVENTION | CFG_COMPASS_ENABLED;
219
    CFG_GYRO_SATURATION_PREVENTION | CFG_COMPASS_ENABLED;
220
 
220
 
221
  memcpy(staticParams.name, "Default\0", 6);
221
  memcpy(staticParams.name, "Default\0", 6);
222
}
222
}
223
 
223
 
224
void IMUConfig_default(void) {
224
void IMUConfig_default(void) {
225
  IMUConfig.gyroPIDFilterConstant = 1;
225
  IMUConfig.gyroPIDFilterConstant = 1;
-
 
226
  IMUConfig.gyroDWindowLength = 3;
226
  IMUConfig.gyroDFilterConstant = 1;
227
  IMUConfig.gyroDFilterConstant = 1;
227
  IMUConfig.accFilterConstant = 10;
228
  IMUConfig.accFilterConstant = 10;
228
  IMUConfig.rateTolerance = 120;
229
  IMUConfig.rateTolerance = 120;
229
  IMUConfig.yawRateFactor = 4;
230
  IMUConfig.gyroActivityDamping = 24;
230
 
231
 
231
  gyro_setDefaultParameters();
232
  gyro_setDefaultParameters();
232
}
233
}
233
 
234
 
234
/***************************************************/
235
/***************************************************/
235
/*    Default Values for Mixer Table               */
236
/*    Default Values for Mixer Table               */
236
/***************************************************/
237
/***************************************************/
237
void mixerMatrix_default(void) { // Quadro 
238
void mixerMatrix_default(void) { // Quadro 
238
  uint8_t i;
239
  uint8_t i;
239
  // mixerMatric.revision = EEMIXER_REVISION;
240
  // mixerMatric.revision = EEMIXER_REVISION;
240
  // clear mixer table (but preset throttle)
241
  // clear mixer table (but preset throttle)
241
  for (i = 0; i < 16; i++) {
242
  for (i = 0; i < 16; i++) {
242
    mixerMatrix.motor[i][MIX_THROTTLE] = i < 4 ? 64 : 0;
243
    mixerMatrix.motor[i][MIX_THROTTLE] = i < 4 ? 64 : 0;
243
    mixerMatrix.motor[i][MIX_PITCH] = 0;
244
    mixerMatrix.motor[i][MIX_PITCH] = 0;
244
    mixerMatrix.motor[i][MIX_ROLL] = 0;
245
    mixerMatrix.motor[i][MIX_ROLL] = 0;
245
    mixerMatrix.motor[i][MIX_YAW] = 0;
246
    mixerMatrix.motor[i][MIX_YAW] = 0;
246
  }
247
  }
247
  // default = Quadro
248
  // default = Quadro
248
  mixerMatrix.motor[0][MIX_PITCH] = +64;
249
  mixerMatrix.motor[0][MIX_PITCH] = +64;
249
  mixerMatrix.motor[0][MIX_YAW] = +64;
250
  mixerMatrix.motor[0][MIX_YAW] = +64;
250
  mixerMatrix.motor[1][MIX_PITCH] = -64;
251
  mixerMatrix.motor[1][MIX_PITCH] = -64;
251
  mixerMatrix.motor[1][MIX_YAW] = +64;
252
  mixerMatrix.motor[1][MIX_YAW] = +64;
252
  mixerMatrix.motor[2][MIX_ROLL] = -64;
253
  mixerMatrix.motor[2][MIX_ROLL] = -64;
253
  mixerMatrix.motor[2][MIX_YAW] = -64;
254
  mixerMatrix.motor[2][MIX_YAW] = -64;
254
  mixerMatrix.motor[3][MIX_ROLL] = +64;
255
  mixerMatrix.motor[3][MIX_ROLL] = +64;
255
  mixerMatrix.motor[3][MIX_YAW] = -64;
256
  mixerMatrix.motor[3][MIX_YAW] = -64;
256
  memcpy(mixerMatrix.name, "Quadro\0", 7);
257
  memcpy(mixerMatrix.name, "Quadro\0", 7);
257
 
258
 
258
  /*
259
  /*
259
  // default = X
260
  // default = X
260
  mixerMatrix.motor[0][MIX_PITCH] = +45;
261
  mixerMatrix.motor[0][MIX_PITCH] = +45;
261
  mixerMatrix.motor[0][MIX_ROLL]  = +45;
262
  mixerMatrix.motor[0][MIX_ROLL]  = +45;
262
  mixerMatrix.motor[0][MIX_YAW]   = +64;
263
  mixerMatrix.motor[0][MIX_YAW]   = +64;
263
 
264
 
264
  mixerMatrix.motor[1][MIX_PITCH] = -45;
265
  mixerMatrix.motor[1][MIX_PITCH] = -45;
265
  mixerMatrix.motor[1][MIX_ROLL]  = -45;
266
  mixerMatrix.motor[1][MIX_ROLL]  = -45;
266
  mixerMatrix.motor[1][MIX_YAW]   = +64;
267
  mixerMatrix.motor[1][MIX_YAW]   = +64;
267
 
268
 
268
  mixerMatrix.motor[2][MIX_PITCH] = +45;
269
  mixerMatrix.motor[2][MIX_PITCH] = +45;
269
  mixerMatrix.motor[2][MIX_ROLL]  = -45;
270
  mixerMatrix.motor[2][MIX_ROLL]  = -45;
270
  mixerMatrix.motor[2][MIX_YAW]   = -64;
271
  mixerMatrix.motor[2][MIX_YAW]   = -64;
271
 
272
 
272
  mixerMatrix.motor[3][MIX_PITCH] = -45;
273
  mixerMatrix.motor[3][MIX_PITCH] = -45;
273
  mixerMatrix.motor[3][MIX_ROLL]  = +45;
274
  mixerMatrix.motor[3][MIX_ROLL]  = +45;
274
  mixerMatrix.motor[3][MIX_YAW]   = -64;
275
  mixerMatrix.motor[3][MIX_YAW]   = -64;
275
  */
276
  */
276
 
277
 
277
  memcpy(mixerMatrix.name, "X\0", 7);
278
  memcpy(mixerMatrix.name, "X\0", 7);
278
}
279
}
279
 
280
 
280
/***************************************************/
281
/***************************************************/
281
/*    Default Values for R/C Channels              */
282
/*    Default Values for R/C Channels              */
282
/***************************************************/
283
/***************************************************/
283
void channelMap_default(void) {
284
void channelMap_default(void) {
284
  channelMap.channels[CH_PITCH]    = 1;
285
  channelMap.channels[CH_PITCH]    = 1;
285
  channelMap.channels[CH_ROLL]     = 0;
286
  channelMap.channels[CH_ROLL]     = 0;
286
  channelMap.channels[CH_THROTTLE] = 2;
287
  channelMap.channels[CH_THROTTLE] = 2;
287
  channelMap.channels[CH_YAW]      = 3;
288
  channelMap.channels[CH_YAW]      = 3;
288
  channelMap.channels[CH_POTS + 0] = 4;
289
  channelMap.channels[CH_POTS + 0] = 4;
289
  channelMap.channels[CH_POTS + 1] = 5;
290
  channelMap.channels[CH_POTS + 1] = 5;
290
  channelMap.channels[CH_POTS + 2] = 6;
291
  channelMap.channels[CH_POTS + 2] = 6;
291
  channelMap.channels[CH_POTS + 3] = 7;
292
  channelMap.channels[CH_POTS + 3] = 7;
292
}
293
}
293
 
294