Subversion Repositories FlightCtrl

Rev

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

Rev 2051 Rev 2052
Line 53... Line 53...
53
#include <stddef.h>
53
#include <stddef.h>
54
#include <string.h>
54
#include <string.h>
55
#include "configuration.h"
55
#include "configuration.h"
56
#include "sensors.h"
56
#include "sensors.h"
57
#include "rc.h"
57
#include "rc.h"
58
//#include "uart0.h"
-
 
59
#include "output.h"
58
#include "output.h"
Line 60... Line 59...
60
 
59
 
61
int16_t variables[VARIABLE_COUNT];
60
int16_t variables[VARIABLE_COUNT];
62
ParamSet_t staticParams;
61
ParamSet_t staticParams;
Line 85... Line 84...
85
#define SET_POT_MM(b,a,min,max) {if (a>=255-VARIABLE_COUNT) b=variables[a+VARIABLE_COUNT-255]; else b=a; if(b<=min) b=min; else if(b>=max) b=max;}
84
#define SET_POT_MM(b,a,min,max) {if (a>=255-VARIABLE_COUNT) b=variables[a+VARIABLE_COUNT-255]; else b=a; if(b<=min) b=min; else if(b>=max) b=max;}
86
#define SET_POT(b,a) {if (a>=255-VARIABLE_COUNT) b=variables[a+VARIABLE_COUNT-255]; else b=a;}
85
#define SET_POT(b,a) {if (a>=255-VARIABLE_COUNT) b=variables[a+VARIABLE_COUNT-255]; else b=a;}
87
  SET_POT_MM(dynamicParams.gyroP, staticParams.gyroP, 5, 200);
86
  SET_POT_MM(dynamicParams.gyroP, staticParams.gyroP, 5, 200);
88
  SET_POT(dynamicParams.gyroI, staticParams.gyroI);
87
  SET_POT(dynamicParams.gyroI, staticParams.gyroI);
89
  SET_POT(dynamicParams.gyroD, staticParams.gyroD);
88
  SET_POT(dynamicParams.gyroD, staticParams.gyroD);
90
  SET_POT(dynamicParams.compassFixedHeading,staticParams.compassFixedHeading);
89
  //SET_POT(dynamicParams.compassControlHeading,staticParams.compassControlHeading);
Line 91... Line 90...
91
 
90
 
92
  SET_POT(dynamicParams.externalControl, staticParams.externalControl);
91
  SET_POT(dynamicParams.externalControl, staticParams.externalControl);
93
  SET_POT(dynamicParams.dynamicStability,staticParams.dynamicStability);
92
  SET_POT(dynamicParams.dynamicStability,staticParams.dynamicStability);
Line 249... Line 248...
249
  staticParams.dynamicStability = 50;
248
  staticParams.dynamicStability = 50;
250
  staticParams.maxAccVector = 10;
249
  staticParams.maxAccVector = 10;
251
  staticParams.IFactor = 32;
250
  staticParams.IFactor = 32;
252
  staticParams.yawIFactor = 100;  
251
  staticParams.yawIFactor = 100;  
253
  staticParams.compassYawCorrection = 64;
252
  staticParams.compassYawCorrection = 64;
254
  staticParams.compassFixedHeading = 0;
253
  staticParams.compassP = 50;
255
  staticParams.levelCorrection[0] = staticParams.levelCorrection[1] = 128;
254
  staticParams.levelCorrection[0] = staticParams.levelCorrection[1] = 128;
Line 256... Line 255...
256
 
255
 
257
  // Servos
256
  // Servos
258
  staticParams.servoCount = 7;
257
  staticParams.servoCount = 7;
Line 292... Line 291...
292
  for (uint8_t i=0; i<8; i++) {
291
  for (uint8_t i=0; i<8; i++) {
293
    staticParams.userParams[i] = 0;
292
    staticParams.userParams[i] = 0;
294
  }
293
  }
Line 295... Line 294...
295
 
294
 
296
  staticParams.bitConfig =
295
  staticParams.bitConfig =
Line 297... Line 296...
297
    CFG_GYRO_SATURATION_PREVENTION | CFG_HEADING_HOLD | CFG_COMPASS_ACTIVE;
296
    CFG_GYRO_SATURATION_PREVENTION | CFG_COMPASS_ENABLED;
298
 
297
 
Line 299... Line 298...
299
  memcpy(staticParams.name, "Default\0", 6);
298
  memcpy(staticParams.name, "Default\0", 6);