Subversion Repositories FlightCtrl

Rev

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

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