Subversion Repositories FlightCtrl

Rev

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

Rev 2160 Rev 2164
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
MotorMixer_t motorMixer;
13
MotorMixer_t motorMixer;
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 (MCU_TYPE==atmega644)
74
#if (MCU_TYPE==atmega644)
75
        CPUType=ATMEGA644;
75
        CPUType=ATMEGA644;
76
#else
76
#else
77
  if((UCSR1A == 0x20) && (UCSR1C == 0x06)) CPUType = ATMEGA644P;  // initial Values for 644P after reset
77
  if((UCSR1A == 0x20) && (UCSR1C == 0x06)) CPUType = ATMEGA644P;  // initial Values for 644P after reset
78
  else CPUType = ATMEGA644;
78
  else CPUType = ATMEGA644;
79
#endif
79
#endif
80
}
80
}
81
 
81
 
82
/*
82
/*
83
 * Automatic detection of hardware components is not supported in this development-oriented
83
 * Automatic detection of hardware components is not supported in this development-oriented
84
 * FC firmware. It would go against the point of it: To enable alternative hardware
84
 * FC firmware. It would go against the point of it: To enable alternative hardware
85
 * configurations with otherwise unsupported components. Instead, one should write
85
 * configurations with otherwise unsupported components. Instead, one should write
86
 * custom code + adjust constants for the new hardware, and include the relevant code
86
 * custom code + adjust constants for the new hardware, and include the relevant code
87
 * from the makefile.
87
 * from the makefile.
88
 * However - we still do detect the board release. Reason: Otherwise it would be too
88
 * However - we still do detect the board release. Reason: Otherwise it would be too
89
 * tedious to have to modify the code for how to turn on and off LEDs when deploying
89
 * tedious to have to modify the code for how to turn on and off LEDs when deploying
90
 * on different HW version....
90
 * on different HW version....
91
 */
91
 */
92
void setBoardRelease(void) {
92
void setBoardRelease(void) {
93
  // the board release is coded via the pull up or down the 2 status LED
93
  // the board release is coded via the pull up or down the 2 status LED
94
 
94
 
95
  PORTB &= ~((1 << PORTB1)|(1 << PORTB0)); // set tristate
95
  PORTB &= ~((1 << PORTB1)|(1 << PORTB0)); // set tristate
96
  DDRB  &= ~((1 << DDB0)|(1 << DDB0)); // set port direction as input
96
  DDRB  &= ~((1 << DDB0)|(1 << DDB0)); // set port direction as input
97
 
97
 
98
  _delay_loop_2(1000); // make some delay
98
  _delay_loop_2(1000); // make some delay
99
 
99
 
100
  switch( PINB & ((1<<PINB1)|(1<<PINB0))) {
100
  switch( PINB & ((1<<PINB1)|(1<<PINB0))) {
101
    case 0x00:
101
    case 0x00:
102
      boardRelease = 10; // 1.0
102
      boardRelease = 10; // 1.0
103
      break;
103
      break;
104
    case 0x01:
104
    case 0x01:
105
      boardRelease = 11; // 1.1 or 1.2
105
      boardRelease = 11; // 1.1 or 1.2
106
      break;
106
      break;
107
    case 0x02:
107
    case 0x02:
108
      boardRelease = 20; // 2.0
108
      boardRelease = 20; // 2.0
109
      break;
109
      break;
110
    case 0x03:
110
    case 0x03:
111
      boardRelease = 13; // 1.3
111
      boardRelease = 13; // 1.3
112
      break;
112
      break;
113
    default:
113
    default:
114
      break;
114
      break;
115
    }
115
    }
116
  // set LED ports as output
116
  // set LED ports as output
117
  DDRB |= (1<<DDB1)|(1<<DDB0);
117
  DDRB |= (1<<DDB1)|(1<<DDB0);
118
  RED_OFF;
118
  RED_OFF;
119
  GRN_OFF;
119
  GRN_OFF;
120
}
120
}
121
 
121
 
122
void configuration_setNormalFlightParameters(void) {
122
void configuration_setNormalFlightParameters(void) {
123
  flight_setParameters(staticParams.IFactor, dynamicParams.gyroP,
123
  flight_setParameters(staticParams.IFactor, dynamicParams.gyroP,
124
      staticParams.bitConfig & CFG_HEADING_HOLD ? 0 : dynamicParams.gyroI,
124
      staticParams.bitConfig & CFG_HEADING_HOLD ? 0 : dynamicParams.gyroI,
125
      dynamicParams.gyroP, staticParams.yawIFactor);
125
      dynamicParams.gyroP, staticParams.yawIFactor);
126
}
126
}
127
 
127
 
128
void configuration_setFailsafeFlightParameters(void) {
128
void configuration_setFailsafeFlightParameters(void) {
129
  flight_setParameters(0, 90, 120, 90, 120);
129
  flight_setParameters(0, 90, 120, 90, 120);
130
}
130
}
131
 
131
 
132
// Called after a change in configuration parameters, as a hook for modules to take over changes.
132
// Called after a change in configuration parameters, as a hook for modules to take over changes.
133
void configuration_paramSetDidChange(void) {
133
void configuration_paramSetDidChange(void) {
134
  // This should be OK to do here as long as we don't change parameters during emergency flight. We don't.
134
  // This should be OK to do here as long as we don't change parameters during emergency flight. We don't.
135
  configuration_setNormalFlightParameters();
135
  configuration_setNormalFlightParameters();
136
  // Immediately load changes to output, and also signal the paramset change.
136
  // Immediately load changes to output, and also signal the paramset change.
137
  output_init();
137
  output_init();
138
}
138
}
139
 
139
 
140
void setOtherDefaults(void) {
140
void setOtherDefaults(void) {
141
  // Height Control
141
  // Height Control
142
  staticParams.airpressureFilterConstant = 8;
142
  staticParams.airpressureFilterConstant = 8;
143
  //staticParams.airpressureWindowLength = 0;
143
  //staticParams.airpressureWindowLength = 0;
144
  staticParams.airpressureAccZCorrection = 128+56;
144
  staticParams.airpressureAccZCorrection = 128+56;
145
  staticParams.heightP = 10;
145
  staticParams.heightP = 10;
146
  staticParams.heightD = 30;
146
  staticParams.heightD = 30;
147
  staticParams.heightSetting = 251;
147
  staticParams.heightSetting = 251;
148
  staticParams.heightControlMaxThrottleChange = 10;
148
  staticParams.heightControlMaxThrottleChange = 10;
149
 
149
 
150
  // Control
150
  // Control
151
  staticParams.stickP = 8;
151
  staticParams.stickP = 8;
152
  staticParams.stickD = 12;
152
  staticParams.stickD = 12;
153
  staticParams.stickYawP = 12;
153
  staticParams.stickYawP = 12;
154
  staticParams.stickThrottleD = 12;
154
  staticParams.stickThrottleD = 12;
155
  staticParams.minThrottle = 8;
155
  staticParams.minThrottle = 8;
156
  staticParams.maxThrottle = 230;
156
  staticParams.maxThrottle = 230;
157
  staticParams.externalControl = 0;
157
  staticParams.externalControl = 0;
158
  staticParams.attitudeControl = 0;
158
  staticParams.attitudeControl = 0;
159
  staticParams.motorSmoothing = 0;
159
  staticParams.motorSmoothing = 0;
160
 
160
 
161
  staticParams.gyroP = 60;
161
  staticParams.gyroP = 60;
162
  staticParams.gyroI = 80;
162
  staticParams.gyroI = 80;
163
  staticParams.gyroD = 4;
163
  staticParams.gyroD = 4;
164
 
164
 
165
  // set by gyro-specific code: gyro_setDefaults().
165
  // set by gyro-specific code: gyro_setDefaults().
166
  // staticParams.zerothOrderCorrection = 
166
  // staticParams.zerothOrderCorrection = 
167
  // staticParams.driftCompDivider = 
167
  // staticParams.driftCompDivider = 
168
  // staticParams.driftCompLimit = 
168
  // staticParams.driftCompLimit = 
169
 
169
 
170
  staticParams.dynamicStability = 50;
170
  staticParams.dynamicStability = 50;
171
  staticParams.IFactor = 52;
171
  staticParams.IFactor = 52;
172
  staticParams.yawIFactor = 100;  
172
  staticParams.yawIFactor = 100;  
173
  staticParams.compassYawCorrection = 64;
173
  staticParams.compassYawCorrection = 64;
174
  staticParams.compassP = 50;
174
  staticParams.compassP = 50;
175
  staticParams.levelCorrection[0] = staticParams.levelCorrection[1] = 128;
175
  staticParams.levelCorrection[0] = staticParams.levelCorrection[1] = 128;
176
 
176
 
177
  // Servos
177
  // Servos
178
  staticParams.servoCount = 7;
178
  staticParams.servoCount = 7;
179
  staticParams.servoManualMaxSpeed = 10;
179
  staticParams.servoManualMaxSpeed = 10;
180
  for (uint8_t i=0; i<2; i++) {
180
  for (uint8_t i=0; i<2; i++) {
181
    staticParams.servoConfigurations[i].manualControl = 128;
181
    staticParams.servoConfigurations[i].manualControl = 128;
182
    staticParams.servoConfigurations[i].stabilizationFactor = 0;
182
    staticParams.servoConfigurations[i].stabilizationFactor = 0;
183
    staticParams.servoConfigurations[i].minValue = 32;
183
    staticParams.servoConfigurations[i].minValue = 32;
184
    staticParams.servoConfigurations[i].maxValue = 224;
184
    staticParams.servoConfigurations[i].maxValue = 224;
185
    staticParams.servoConfigurations[i].flags = 0;
185
    staticParams.servoConfigurations[i].flags = 0;
186
  }
186
  }
187
 
187
 
188
  // Battery warning and emergency flight
188
  // Battery warning and emergency flight
189
  staticParams.batteryVoltageWarning = 101;  // 3.7 each for 3S
189
  staticParams.batteryVoltageWarning = 101;  // 3.7 each for 3S
190
  staticParams.emergencyThrottle = 35;
190
  staticParams.emergencyThrottle = 35;
191
  staticParams.emergencyFlightDuration = 30;
191
  staticParams.emergencyFlightDuration = 30;
192
 
192
 
193
  // Outputs
193
  // Outputs
194
  staticParams.outputFlash[0].bitmask = 1; //0b01011111;
194
  staticParams.outputFlash[0].bitmask = 1; //0b01011111;
195
  staticParams.outputFlash[0].timing = 15;
195
  staticParams.outputFlash[0].timing = 15;
196
  staticParams.outputFlash[1].bitmask = 3; //0b11110011;
196
  staticParams.outputFlash[1].bitmask = 3; //0b11110011;
197
  staticParams.outputFlash[1].timing = 15;
197
  staticParams.outputFlash[1].timing = 15;
198
 
198
 
199
  staticParams.outputDebugMask = DEBUG_ACC0THORDER;
199
  staticParams.outputDebugMask = DEBUG_ACC0THORDER;
200
  staticParams.outputFlags   = OUTPUTFLAGS_FLASH_0_AT_BEEP | OUTPUTFLAGS_FLASH_1_AT_BEEP | OUTPUTFLAGS_USE_ONBOARD_LEDS;
200
  staticParams.outputFlags   = OUTPUTFLAGS_FLASH_0_AT_BEEP | OUTPUTFLAGS_FLASH_1_AT_BEEP | OUTPUTFLAGS_USE_ONBOARD_LEDS;
201
 
201
 
202
  staticParams.naviMode = 0; // free.
202
  staticParams.naviMode = 0; // free.
203
  staticParams.airpressureWindowLength = 0;
203
  staticParams.airpressureWindowLength = 0;
204
  staticParams.airpressureDWindowLength = 24;
204
  staticParams.airpressureDWindowLength = 24;
205
 
205
 
206
  staticParams.heightControlMaxIntegralIn = 125;
206
  staticParams.heightControlMaxIntegralIn = 125;
207
  staticParams.heightControlMaxIntegralOut = 75;
207
  staticParams.heightControlMaxIntegralOut = 75;
208
  staticParams.heightControlMaxThrottleChange = 75;
208
  staticParams.heightControlMaxThrottleChange = 75;
209
  staticParams.heightControlTestOscPeriod = 0;
209
  staticParams.heightControlTestOscPeriod = 0;
210
  staticParams.heightControlTestOscAmplitude = 0;
210
  staticParams.heightControlTestOscAmplitude = 0;
211
}
211
}
212
 
212
 
213
/***************************************************/
213
/***************************************************/
214
/*    Default Values for parameter set 1           */
214
/*    Default Values for parameter set 1           */
215
/***************************************************/
215
/***************************************************/
216
void paramSet_default(uint8_t setnumber) {
216
void paramSet_default(uint8_t setnumber) {
217
  setOtherDefaults();
217
  setOtherDefaults();
218
 
218
 
219
  for (uint8_t i=0; i<8; i++) {
219
  for (uint8_t i=0; i<8; i++) {
220
    staticParams.userParams[i] = i;
220
    staticParams.userParams[i] = i;
221
  }
221
  }
222
 
222
 
223
  staticParams.bitConfig = CFG_GYRO_SATURATION_PREVENTION;
223
  staticParams.bitConfig = CFG_GYRO_SATURATION_PREVENTION;
224
 
224
 
225
  memcpy(staticParams.name, "Default\0", 6);
225
  memcpy(staticParams.name, "Default\0", 6);
226
}
226
}
227
 
227
 
228
void IMUConfig_default(void) {
228
void IMUConfig_default(void) {
229
  IMUConfig.gyroPIDFilterConstant = 1;
229
  IMUConfig.gyroPIDFilterConstant = 1;
230
  IMUConfig.gyroDWindowLength = 3;
230
  IMUConfig.gyroDWindowLength = 3;
231
  // IMUConfig.gyroDFilterConstant = 1;
231
  // IMUConfig.gyroDFilterConstant = 1;
232
  IMUConfig.accFilterConstant = 10;
232
  IMUConfig.accFilterConstant = 10;
233
  IMUConfig.rateTolerance = 120;
233
  IMUConfig.rateTolerance = 120;
234
  IMUConfig.gyroActivityDamping = 24;
234
  IMUConfig.gyroActivityDamping = 24;
235
 
235
 
236
  gyro_setDefaultParameters();
236
  gyro_setDefaultParameters();
237
}
237
}
238
 
238
 
239
/***************************************************/
239
/***************************************************/
240
/*    Default Values for Mixer Table               */
240
/*    Default Values for Mixer Table               */
241
/***************************************************/
241
/***************************************************/
242
void motorMixer_default(void) { // Quadro
242
void motorMixer_default(void) { // Quadro
243
  uint8_t i;
243
  uint8_t i;
244
  // clear mixer table (but preset throttle)
244
  // clear mixer table (but preset throttle)
245
  for (i = 0; i < MAX_MOTORS; i++) {
245
  for (i = 0; i < MAX_MOTORS; i++) {
246
    motorMixer.matrix[i][MIX_THROTTLE] = i < 4 ? 64 : 0;
246
    motorMixer.matrix[i][MIX_THROTTLE] = i < 4 ? 64 : 0;
247
    motorMixer.matrix[i][MIX_PITCH] = 0;
247
    motorMixer.matrix[i][MIX_PITCH] = 0;
248
    motorMixer.matrix[i][MIX_ROLL] = 0;
248
    motorMixer.matrix[i][MIX_ROLL] = 0;
249
    motorMixer.matrix[i][MIX_YAW] = 0;
249
    motorMixer.matrix[i][MIX_YAW] = 0;
250
    motorMixer.matrix[i][MIX_OPPOSITE_MOTOR] = (uint8_t)-1;
250
    motorMixer.matrix[i][MIX_OPPOSITE_MOTOR] = (uint8_t)-1;
251
  }
251
  }
252
  /*
252
  /*
253
  // default = Quadro+
253
  // default = Quadro+
254
  motorMixer.matrix[0][MIX_PITCH] = +64;
254
  motorMixer.matrix[0][MIX_PITCH] = +64;
255
  motorMixer.matrix[0][MIX_YAW] = +64;
255
  motorMixer.matrix[0][MIX_YAW] = +64;
256
  motorMixer.matrix[0][MIX_OPPOSITE_MOTOR] = 1;
256
  motorMixer.matrix[0][MIX_OPPOSITE_MOTOR] = 1;
257
 
257
 
258
  motorMixer.matrix[1][MIX_PITCH] = -64;
258
  motorMixer.matrix[1][MIX_PITCH] = -64;
259
  motorMixer.matrix[1][MIX_YAW] = +64;
259
  motorMixer.matrix[1][MIX_YAW] = +64;
260
  motorMixer.matrix[1][MIX_OPPOSITE_MOTOR] = 0;
260
  motorMixer.matrix[1][MIX_OPPOSITE_MOTOR] = 0;
261
 
261
 
262
  motorMixer.matrix[2][MIX_ROLL] = -64;
262
  motorMixer.matrix[2][MIX_ROLL] = -64;
263
  motorMixer.matrix[2][MIX_YAW] = -64;
263
  motorMixer.matrix[2][MIX_YAW] = -64;
264
  motorMixer.matrix[2][MIX_OPPOSITE_MOTOR] = 3;
264
  motorMixer.matrix[2][MIX_OPPOSITE_MOTOR] = 3;
265
 
265
 
266
  motorMixer.matrix[3][MIX_ROLL] = +64;
266
  motorMixer.matrix[3][MIX_ROLL] = +64;
267
  motorMixer.matrix[3][MIX_YAW] = -64;
267
  motorMixer.matrix[3][MIX_YAW] = -64;
268
  motorMixer.matrix[3][MIX_OPPOSITE_MOTOR] = 2;
268
  motorMixer.matrix[3][MIX_OPPOSITE_MOTOR] = 2;
269
 
269
 
270
  memcpy(motorMixer.name, "Quadro +\0", 9);
270
  memcpy(motorMixer.name, "Quadro +\0", 9);
271
  */
271
  */
272
 
272
 
273
  // default = Quadro
273
  // default = Quadro
274
  motorMixer.matrix[0][MIX_PITCH] = +64;
274
  motorMixer.matrix[0][MIX_PITCH] = +64;
275
  motorMixer.matrix[0][MIX_ROLL] = +64;
275
  motorMixer.matrix[0][MIX_ROLL] = +64;
276
  motorMixer.matrix[0][MIX_YAW] = +64;
276
  motorMixer.matrix[0][MIX_YAW] = +64;
277
  motorMixer.matrix[0][MIX_OPPOSITE_MOTOR] = 1;
277
  motorMixer.matrix[0][MIX_OPPOSITE_MOTOR] = 1;
278
 
278
 
279
  motorMixer.matrix[1][MIX_PITCH] = -64;
279
  motorMixer.matrix[1][MIX_PITCH] = -64;
280
  motorMixer.matrix[1][MIX_ROLL] = -64;
280
  motorMixer.matrix[1][MIX_ROLL] = -64;
281
  motorMixer.matrix[1][MIX_YAW] = +64;
281
  motorMixer.matrix[1][MIX_YAW] = +64;
282
  motorMixer.matrix[1][MIX_OPPOSITE_MOTOR] = 0;
282
  motorMixer.matrix[1][MIX_OPPOSITE_MOTOR] = 0;
283
 
283
 
284
  motorMixer.matrix[2][MIX_PITCH] = +64;
284
  motorMixer.matrix[2][MIX_PITCH] = +64;
285
  motorMixer.matrix[2][MIX_ROLL] = -64;
285
  motorMixer.matrix[2][MIX_ROLL] = -64;
286
  motorMixer.matrix[2][MIX_YAW] = -64;
286
  motorMixer.matrix[2][MIX_YAW] = -64;
287
  motorMixer.matrix[2][MIX_OPPOSITE_MOTOR] = 3;
287
  motorMixer.matrix[2][MIX_OPPOSITE_MOTOR] = 3;
288
 
288
 
289
  motorMixer.matrix[3][MIX_PITCH] = -64;
289
  motorMixer.matrix[3][MIX_PITCH] = -64;
290
  motorMixer.matrix[3][MIX_ROLL] = +64;
290
  motorMixer.matrix[3][MIX_ROLL] = +64;
291
  motorMixer.matrix[3][MIX_YAW] = -64;
291
  motorMixer.matrix[3][MIX_YAW] = -64;
292
  motorMixer.matrix[3][MIX_OPPOSITE_MOTOR] = 2;
292
  motorMixer.matrix[3][MIX_OPPOSITE_MOTOR] = 2;
293
 
293
 
294
  memcpy(motorMixer.name, "Quadro X\0", 9);
294
  memcpy(motorMixer.name, "Quadro X\0", 9);
295
}
295
}
296
 
296
 
297
/***************************************************/
297
/***************************************************/
298
/*    Default Values for R/C Channels              */
298
/*    Default Values for R/C Channels              */
299
/***************************************************/
299
/***************************************************/
300
void channelMap_default(void) {
300
void channelMap_default(void) {
301
  channelMap.RCPolarity = 1;
301
  channelMap.RCPolarity = 0;
302
  channelMap.channels[CH_PITCH]    = 1;
302
  channelMap.channels[CH_PITCH]    = 1;
303
  channelMap.channels[CH_ROLL]     = 0;
303
  channelMap.channels[CH_ROLL]     = 0;
304
  channelMap.channels[CH_THROTTLE] = 2;
304
  channelMap.channels[CH_THROTTLE] = 2;
305
  channelMap.channels[CH_YAW]      = 3;
305
  channelMap.channels[CH_YAW]      = 3;
306
  channelMap.channels[CH_POTS + 0] = 4;
306
  channelMap.channels[CH_POTS + 0] = 4;
307
  channelMap.channels[CH_POTS + 1] = 5;
307
  channelMap.channels[CH_POTS + 1] = 5;
308
  channelMap.channels[CH_POTS + 2] = 6;
308
  channelMap.channels[CH_POTS + 2] = 6;
309
  channelMap.channels[CH_POTS + 3] = 7;
309
  channelMap.channels[CH_POTS + 3] = 7;
310
}
310
}
311
 
311