Subversion Repositories FlightCtrl

Rev

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

Rev 2138 Rev 2139
Line 1... Line 1...
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 "controlMixer.h"
5
#include "rc.h"
6
#include "rc.h"
6
#include "output.h"
7
#include "output.h"
7
#include "flight.h"
8
#include "flight.h"
Line 8... Line 9...
8
 
9
 
Line 32... Line 33...
32
 
33
 
33
{offsetof(ParamSet_t, gyroPID[2].P), offsetof(DynamicParams_t, gyroPID[2].P),0,255},
34
{offsetof(ParamSet_t, gyroPID[2].P), offsetof(DynamicParams_t, gyroPID[2].P),0,255},
34
{offsetof(ParamSet_t, gyroPID[2].I), offsetof(DynamicParams_t, gyroPID[2].I),0,255},
35
{offsetof(ParamSet_t, gyroPID[2].I), offsetof(DynamicParams_t, gyroPID[2].I),0,255},
Line 35... Line -...
35
{offsetof(ParamSet_t, gyroPID[2].D), offsetof(DynamicParams_t, gyroPID[2].D),0,255},
-
 
36
 
-
 
37
{offsetof(ParamSet_t, gimbalServoConfigurations[0].manualControl), offsetof(DynamicParams_t, gimbalServoManualControl[0]),0,255},
36
{offsetof(ParamSet_t, gyroPID[2].D), offsetof(DynamicParams_t, gyroPID[2].D),0,255},
38
{offsetof(ParamSet_t, gimbalServoConfigurations[1].manualControl), offsetof(DynamicParams_t, gimbalServoManualControl[1]),0,255},
37
 
39
{offsetof(ParamSet_t, outputFlash[0].timing), offsetof(DynamicParams_t, output0Timing),0,255},
38
{offsetof(ParamSet_t, outputFlash[0].timing), offsetof(DynamicParams_t, output0Timing),0,255},
Line 40... Line 39...
40
{offsetof(ParamSet_t, outputFlash[1].timing), offsetof(DynamicParams_t, output1Timing),0,255},
39
{offsetof(ParamSet_t, outputFlash[1].timing), offsetof(DynamicParams_t, output1Timing),0,255},
Line 88... Line 87...
88
  staticParams.airspeedCorrection = 1;
87
  staticParams.airspeedCorrection = 1;
89
  staticParams.isFlyingThreshold = 100;
88
  staticParams.isFlyingThreshold = 100;
Line 90... Line 89...
90
 
89
 
91
  // Servos
90
  // Servos
92
  staticParams.servoCount = 7;
91
  staticParams.servoCount = 7;
93
  staticParams.servosReverse = CONTROL_SERVO_REVERSE_AILERONS;
-
 
94
 
92
  staticParams.servos[CONTROL_ELEVATOR].reverse = 0;
95
  staticParams.gimbalServoMaxManualSpeed = 10;
-
 
96
  for (uint8_t i=0; i<2; i++) {
-
 
97
    staticParams.gimbalServoConfigurations[i].manualControl = 128;
-
 
98
    staticParams.gimbalServoConfigurations[i].stabilizationFactor = 0;
-
 
99
    staticParams.gimbalServoConfigurations[i].minValue = 32;
-
 
100
    staticParams.gimbalServoConfigurations[i].maxValue = 224;
93
  staticParams.servos[CONTROL_AILERONS].reverse = 1;
101
    staticParams.gimbalServoConfigurations[i].flags = 0;
-
 
Line 102... Line 94...
102
  }
94
  staticParams.servos[CONTROL_RUDDER].reverse = 0;
103
 
95
 
Line 104... Line 96...
104
  // Battery warning and emergency flight
96
  // Battery warning and emergency flight
105
  staticParams.batteryWarningVoltage = 101;  // 3.7 each for 3S
97
  staticParams.batteryWarningVoltage = 101;  // 3.7 each for 3S
106
 
98
 
107
  for (uint8_t i=0; i<3; i++) {
99
  for (uint8_t i=0; i<3; i++) {
108
          staticParams.gyroPID[i].P = 40;
100
          staticParams.gyroPID[i].P = 40;
109
          staticParams.gyroPID[i].I = 40;
101
          staticParams.gyroPID[i].I = 40;
Line 110... Line 102...
110
          staticParams.gyroPID[i].D = 40;
102
          staticParams.gyroPID[i].D = 40;
111
          staticParams.gyroPID[i].iMax = 45;
103
          staticParams.gyroPID[i].iMax = 60;
112
  }
104
  }
Line 156... Line 148...
156
/***************************************************/
148
/***************************************************/
157
/*    Default Values for R/C Channels              */
149
/*    Default Values for R/C Channels              */
158
/***************************************************/
150
/***************************************************/
159
void channelMap_default(void) {
151
void channelMap_default(void) {
160
  channelMap.RCPolarity = 1;
152
  channelMap.RCPolarity = 1;
161
  channelMap.HWTrim = 110;
153
  channelMap.HWTrim = 10;
162
  channelMap.variableOffset = 131;
154
  channelMap.variableOffset = 131;
163
  channelMap.channels[CH_ELEVATOR] = 1;
155
  channelMap.channels[CH_ELEVATOR] = 1;
164
  channelMap.channels[CH_AILERONS] = 0;
156
  channelMap.channels[CH_AILERONS] = 0;
165
  channelMap.channels[CH_THROTTLE] = 2;
157
  channelMap.channels[CH_THROTTLE] = 2;
166
  channelMap.channels[CH_RUDDER]   = 3;
158
  channelMap.channels[CH_RUDDER]   = 3;