/trunk/eeprom.c |
---|
163,7 → 163,7 |
EE_Parameter.Gyro_Gier_I = 150; // Wert : 0-247 |
EE_Parameter.UnterspannungsWarnung = 33; // Wert : 0-247 ( Automatische Zellenerkennung bei < 50) |
EE_Parameter.NotGas = 35; // Wert : 0-247 // Gaswert bei Empangsverlust |
EE_Parameter.NotGasZeit = 30; // Wert : 0-247 // Zeit bis auf NotGas geschaltet wird, wg. Rx-Problemen |
EE_Parameter.NotGasZeit = 60; // Wert : 0-247 // Zeit bis auf NotGas geschaltet wird, wg. Rx-Problemen |
EE_Parameter.I_Faktor = 32; |
EE_Parameter.UserParam1 = 0; // zur freien Verwendung |
EE_Parameter.UserParam2 = 0; // zur freien Verwendung |
269,7 → 269,7 |
EE_Parameter.Gyro_Gier_I = 120; // Wert : 0-247 |
EE_Parameter.UnterspannungsWarnung = 33; // Wert : 0-247 ( Automatische Zellenerkennung bei < 50) |
EE_Parameter.NotGas = 35; // Wert : 0-247 // Gaswert bei Empangsverlust |
EE_Parameter.NotGasZeit = 30; // Wert : 0-247 // Zeit bis auf NotGas geschaltet wird, wg. Rx-Problemen |
EE_Parameter.NotGasZeit = 60; // Wert : 0-247 // Zeit bis auf NotGas geschaltet wird, wg. Rx-Problemen |
EE_Parameter.I_Faktor = 32; |
EE_Parameter.UserParam1 = 0; // zur freien Verwendung |
EE_Parameter.UserParam2 = 0; // zur freien Verwendung |
374,7 → 374,7 |
EE_Parameter.Gyro_Gier_I = 120; // Wert : 0-247 |
EE_Parameter.UnterspannungsWarnung = 33; // Wert : 0-247 ( Automatische Zellenerkennung bei < 50) |
EE_Parameter.NotGas = 35; // Wert : 0-247 // Gaswert bei Empangsverlust |
EE_Parameter.NotGasZeit = 20; // Wert : 0-247 // Zeit bis auf NotGas geschaltet wird, wg. Rx-Problemen |
EE_Parameter.NotGasZeit = 60; // Wert : 0-247 // Zeit bis auf NotGas geschaltet wird, wg. Rx-Problemen |
EE_Parameter.I_Faktor = 16; |
EE_Parameter.UserParam1 = 0; // zur freien Verwendung |
EE_Parameter.UserParam2 = 0; // zur freien Verwendung |
/trunk/fc.c |
---|
101,7 → 101,7 |
long SollHoehe = 0; |
int LageKorrekturRoll = 0,LageKorrekturNick = 0; |
//float Ki = FAKTOR_I; |
int Ki = 10300 / 33; |
int Ki = (10300/2) / 33; |
unsigned char Looping_Nick = 0,Looping_Roll = 0; |
unsigned char Looping_Links = 0, Looping_Rechts = 0, Looping_Unten = 0, Looping_Oben = 0; |
164,15 → 164,6 |
#define LIMIT_MIN_MAX(value, min, max) {if(value <= min) value = min; else if(value >= max) value = max;} |
int MotorSmoothing(int neu, int alt) |
{ |
int motor; |
if(neu > alt) motor = (1*(int)alt + neu) / 2; |
else motor = neu - (alt - neu)*1; |
//if(Poti2 < 20) return(neu); |
return(motor); |
} |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// Debugwerte zuordnen |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
568,6 → 559,7 |
void ParameterZuordnung(void) |
//############################################################################ |
{ |
#define CHK_POTI(b,a) {if(a < 248) b = a; else b = Poti[255 - a];} |
#define CHK_POTI_MM(b,a,min,max) {CHK_POTI(b,a); LIMIT_MIN_MAX(b, min, max);} |
606,7 → 598,7 |
// CHK_POTI(Parameter_AchsGegenKopplung1,EE_Parameter.AchsGegenKopplung1,0,255); |
CHK_POTI(Parameter_DynamicStability,EE_Parameter.DynamicStability); |
CHK_POTI(Parameter_ExternalControl,EE_Parameter.ExternalControl); |
Ki = 10300 / (Parameter_I_Faktor + 1); |
Ki = (10300 / 2) / (Parameter_I_Faktor + 1); |
MAX_GAS = EE_Parameter.Gas_Max; |
MIN_GAS = EE_Parameter.Gas_Min; |
} |
1617,7 → 1609,7 |
if(SummeNick < -(16000L * STICK_GAIN)) SummeNick = -(16000L * STICK_GAIN); |
pd_ergebnis_nick = DiffNick + SummeNick / Ki; // PI-Regler für Nick |
// Motor Vorn |
tmp_int = (long)((long)Parameter_DynamicStability * (long)(GasMischanteil + abs(GierMischanteil)/2)) / 64; |
tmp_int = (long)((long)Parameter_DynamicStability * (long)(GasMischanteil + abs(GierMischanteil)/2)) / (64/2); |
if(pd_ergebnis_nick > tmp_int) pd_ergebnis_nick = tmp_int; |
if(pd_ergebnis_nick < -tmp_int) pd_ergebnis_nick = -tmp_int; |
1630,7 → 1622,7 |
if(SummeRoll > (STICK_GAIN * 16000L)) SummeRoll = (STICK_GAIN * 16000L); |
if(SummeRoll < -(16000L * STICK_GAIN)) SummeRoll = -(16000L * STICK_GAIN); |
pd_ergebnis_roll = DiffRoll + SummeRoll / Ki; // PI-Regler für Roll |
tmp_int = (long)((long)Parameter_DynamicStability * (long)(GasMischanteil + abs(GierMischanteil)/2)) / 64; |
tmp_int = (long)((long)Parameter_DynamicStability * (long)(GasMischanteil + abs(GierMischanteil)/2)) / (64/2); |
if(pd_ergebnis_roll > tmp_int) pd_ergebnis_roll = tmp_int; |
if(pd_ergebnis_roll < -tmp_int) pd_ergebnis_roll = -tmp_int; |
1642,15 → 1634,28 |
signed int tmp_int; |
if(Mixer.Motor[i][0] > 0) |
{ |
tmp_int = ((long)GasMischanteil * Mixer.Motor[i][0]) / 64L; |
tmp_int += ((long)pd_ergebnis_nick * Mixer.Motor[i][1]) / 64L; |
tmp_int += ((long)pd_ergebnis_roll * Mixer.Motor[i][2]) / 64L; |
tmp_int += ((long)GierMischanteil * Mixer.Motor[i][3]) / 64L; |
tmp_motorwert[i] = MotorSmoothing(tmp_int,tmp_motorwert[i]); // Filter |
tmp_int = tmp_motorwert[i] / 4; |
Motor[i].SetPointLowerBits = tmp_motorwert[i] % 4; |
LIMIT_MIN_MAX(tmp_int,MIN_GAS,MAX_GAS); |
Motor[i].SetPoint = tmp_int; |
// Gas |
if(Mixer.Motor[i][0] == 64) tmp_int = GasMischanteil * 2; else tmp_int = ((long)GasMischanteil * Mixer.Motor[i][0]) / 32L; |
// Nick |
if(Mixer.Motor[i][1] == 64) tmp_int += pd_ergebnis_nick; |
else if(Mixer.Motor[i][1] == -64) tmp_int -= pd_ergebnis_nick; |
else tmp_int += ((long)pd_ergebnis_nick * Mixer.Motor[i][1]) / 64L; |
// Roll |
if(Mixer.Motor[i][2] == 64) tmp_int += pd_ergebnis_roll; |
else if(Mixer.Motor[i][2] == -64) tmp_int -= pd_ergebnis_roll; |
else tmp_int += ((long)pd_ergebnis_roll * Mixer.Motor[i][2]) / 64L; |
// Gier |
if(Mixer.Motor[i][3] == 64) tmp_int += GierMischanteil * 2; |
else if(Mixer.Motor[i][3] == -64) tmp_int -= GierMischanteil * 2; |
else tmp_int += ((long)GierMischanteil * Mixer.Motor[i][3]) / 32L; |
if(tmp_int > tmp_motorwert[i]) tmp_int = (tmp_motorwert[i] + tmp_int) / 2; // MotorSmoothing |
else tmp_int = 2 * tmp_int - tmp_motorwert[i]; // MotorSmoothing |
LIMIT_MIN_MAX(tmp_int,MIN_GAS * 8,MAX_GAS * 8); |
Motor[i].SetPoint = tmp_int / 8; |
Motor[i].SetPointLowerBits = tmp_int % 8; |
tmp_motorwert[i] = tmp_int; |
} |
else |
{ |
/trunk/fc.h |
---|
27,7 → 27,6 |
#define Poti7 Poti[6] |
#define Poti8 Poti[7] |
extern volatile unsigned char FCFlags; |
extern volatile unsigned int I2CTimeout; |
extern unsigned char Sekunde,Minute; |
/trunk/libfc1284.a |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/libfc644.a |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/main.c |
---|
145,7 → 145,7 |
WDTCSR |= (1<<WDCE)|(1<<WDE); |
WDTCSR = 0; |
beeptime = 2000; |
beeptime = 2500; |
StickGier = 0; PPM_in[K_GAS] = 0;StickRoll = 0; StickNick = 0; |
if(PlatinenVersion >= 20) GIER_GRAD_FAKTOR = 1160; else GIER_GRAD_FAKTOR = 1291; // unterschiedlich für ME und ENC |
ROT_OFF; |
170,9 → 170,9 |
// Check connected BL-Ctrls |
BLFlags |= BLFLAG_READ_VERSION; |
UpdateMotor = 0; |
motorread = 0; |
SendMotorData(); |
while(!UpdateMotor); |
motorread = 0; |
printf("\n\rFound BL-Ctrl: "); |
timer = SetDelay(4000); |
for(i=0; i < MAX_MOTORS; i++) |
192,8 → 192,8 |
if(Motor[i].State & MOTOR_STATE_PRESENT_MASK) |
{ |
printf("%d",i+1); |
if(Motor[i].Version & MOTOR_STATE_NEW_PROTOCOL_MASK) printf("(new) "); |
else printf(" "); |
// if(Motor[i].Version & MOTOR_STATE_NEW_PROTOCOL_MASK) printf("(new) "); |
// else printf(" "); |
} |
} |
for(i=0; i < MAX_MOTORS; i++) |
226,8 → 226,9 |
ExternControl.Digital[0] = 0x55; |
FlugMinuten = GetParamWord(PID_FLIGHT_MINUTES); |
FlugMinutenGesamt = GetParamWord(PID_FLIGHT_MINUTES_TOTAL); |
FlugMinuten = (unsigned int)GetParamByte(PID_FLIGHT_MINUTES) * 256 + (unsigned int)GetParamByte(PID_FLIGHT_MINUTES + 1); |
FlugMinutenGesamt = (unsigned int)GetParamByte(PID_FLIGHT_MINUTES_TOTAL) * 256 + (unsigned int)GetParamByte(PID_FLIGHT_MINUTES_TOTAL + 1); |
// FlugMinutenGesamt = GetParamWord(PID_FLIGHT_MINUTES_TOTAL); |
if( (FlugMinutenGesamt == 0xFFFF) || (FlugMinuten == 0xFFFF) ) |
{ |
263,13 → 264,10 |
} |
if(UpdateMotor && AdReady) // ReglerIntervall |
{ |
J3High; |
UpdateMotor=0; |
if(WinkelOut.CalcState) CalMk3Mag(); |
else MotorRegler(); |
SendMotorData(); |
J3Low; |
if(UpdateMotor) DebugOut.Analog[17]++; |
ROT_OFF; |
if(SenderOkay) SenderOkay--; |
else |
359,8 → 357,10 |
timer2 = 0; |
FlugMinuten++; |
FlugMinutenGesamt++; |
SetParamWord(PID_FLIGHT_MINUTES_TOTAL, FlugMinutenGesamt); |
SetParamWord(PID_FLIGHT_MINUTES, FlugMinuten); |
SetParamByte(PID_FLIGHT_MINUTES,FlugMinuten / 256); |
SetParamByte(PID_FLIGHT_MINUTES+1,FlugMinuten % 256); |
SetParamByte(PID_FLIGHT_MINUTES_TOTAL,FlugMinutenGesamt / 256); |
SetParamByte(PID_FLIGHT_MINUTES_TOTAL+1,FlugMinutenGesamt % 256); |
timer = SetDelay(20); // falls "timer += 20;" mal nicht geht |
} |
} |
/trunk/menu.c |
---|
11,7 → 11,7 |
char DisplayBuff[80] = "Hello World"; |
unsigned char DispPtr = 0; |
unsigned char MaxMenue = 16; |
unsigned char MaxMenue = 17; |
unsigned char MenuePunkt = 0; |
unsigned char RemoteKeys = 0; |
/trunk/twimaster.c |
---|
68,7 → 68,6 |
{ |
static unsigned char missing_motor = 0, byte_counter = 0, crc = 0, read_more = 0, motorread_temperature = 0; |
static unsigned char *pTxBuff; |
J4High; |
switch(twi_state++) |
{ |
87,7 → 86,7 |
break; |
case 1: |
i2c_write_byte(Motor[motor].SetPoint); |
if(!(Motor[motor].Version & MOTOR_STATE_NEW_PROTOCOL_MASK) ) |
if(!(Motor[motor].Version & MOTOR_STATE_NEW_PROTOCOL_MASK) || RequiredMotors > 6) |
{ |
twi_state = 4; //jump over sending more data |
} |