Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 1960 → Rev 1961

/branches/dongfang_FC_rewrite/configuration.c
55,11 → 55,11
#include "sensors.h"
#include "rc.h"
 
int16_t variables[8] = {0,0,0,0,0,0,0,0};
int16_t variables[VARIABLE_COUNT];
paramset_t staticParams;
channelMap_t channelMap;
mixerMatrix_t mixerMatrix;
dynamicParam_t dynamicParams; // = {48,251,16,58,64,8,150,150,2,10,{0,0,0,0,0,0,0,0},100,70,90,65,64,100,0,0,0};
dynamicParam_t dynamicParams;
uint8_t CPUType = ATMEGA644;
uint8_t boardRelease = 13;
uint8_t requiredMotors;
70,8 → 70,8
 
void configuration_applyVariablesToParams(void) {
uint8_t i;
#define SET_POT_MM(b,a,min,max) {if (a<255) {if (a>=251) b=variables[a-251]; else b=a;} if(b<=min) b=min; else if(b>=max) b=max;}
#define SET_POT(b,a) { if (a<255) {if (a>=251) b=variables[a-251]; else b=a;}}
#define SET_POT_MM(b,a,min,max) {if (a<255) {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;}
#define SET_POT(b,a) { if (a<255) {if (a>=255-VARIABLE_COUNT) b=variables[a+VARIABLE_COUNT-255]; else b=a;}}
SET_POT_MM(dynamicParams.gyroP, staticParams.gyroP, 5, 200);
SET_POT(dynamicParams.gyroI, staticParams.gyroI);
SET_POT(dynamicParams.gyroD, staticParams.gyroD);
104,11 → 104,11
}
 
const XLATION XLATIONS[] = {
// {offsetof(paramset_t, MaxHeight), offsetof(dynamicParam_t, MaxHeight)},
{offsetof(paramset_t, heightSetting), offsetof(dynamicParam_t, heightSetting)},
};
 
const MMXLATION MMXLATIONS[] = {
// {offsetof(paramset_t, HeightD), offsetof(dynamicParam_t, HeightD),0,100},
{offsetof(paramset_t, heightD), offsetof(dynamicParam_t, heightD),0,100},
};
 
uint8_t configuration_applyVariableToParam(uint8_t src, uint8_t min, uint8_t max) {
150,7 → 150,7
 
uint8_t getCPUType(void) { // works only after reset or power on when the registers have default values
uint8_t CPUType = ATMEGA644;
if( (UCSR1A == 0x20) && (UCSR1C == 0x06) ) CPUType = ATMEGA644P; // initial Values for 644P after reset
//if((UCSR1A == 0x20) && (UCSR1C == 0x06)) CPUType = ATMEGA644P; // initial Values for 644P after reset
return CPUType;
}
 
202,9 → 202,8
staticParams.heightP = 10;
staticParams.heightD = 30;
staticParams.heightSetting = 251;
staticParams.heightMaxThrottleChange = 10;
staticParams.heightControlMaxThrottleChange = 10;
staticParams.heightSlewRate = 4;
staticParams.heightACCEffect = 30;
// Control
staticParams.stickP = 8;
225,7 → 224,7
staticParams.gyroI = 80;
staticParams.gyroD = 4;
// set by gyro code.
// set by gyro-specific code: gyro_setDefaults().
// staticParams.zerothOrderCorrection =
// staticParams.driftCompDivider =
// staticParams.driftCompLimit =
253,9 → 252,9
staticParams.emergencyFlightDuration = 30;
 
// Outputs
staticParams.outputFlash[0].bitmask = 0b01011111;
staticParams.outputFlash[0].bitmask = 1; //0b01011111;
staticParams.outputFlash[0].timing = 15;
staticParams.outputFlash[1].bitmask = 0b11110011;
staticParams.outputFlash[1].bitmask = 3; //0b11110011;
staticParams.outputFlash[1].timing = 15;
 
staticParams.outputFlags = 0;
273,9 → 272,7
}
 
staticParams.bitConfig =
CFG_GYRO_SATURATION_PREVENTION |
CFG_HEADING_HOLD;
staticParams.bitConfig2 = 0;
CFG_GYRO_SATURATION_PREVENTION | CFG_HEADING_HOLD;
 
memcpy(staticParams.name, "Default\0", 6);
}