Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 1408 → Rev 1409

/branches/V0.76g_VarMotorSmoothing/fc.c
163,7 → 163,7
#define LIMIT_MAX(value, max) {if(value > max) value = max;}
#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 MotorSmoothing(int neu, int alt) //orginal
{
int motor;
if(neu > alt) motor = (1*(int)alt + neu) / 2;
172,6 → 172,45
return(motor);
}
 
 
 
 
 
 
int MotorSmoothing2(int neu, int alt) // MartinW, nur bei ansteigenden Werten
{
int motor;
if(neu > alt) motor = (1*(int)alt + neu) / 2;
else motor = neu;
return(motor);
}
 
int MotorSmoothing3(int neu, int alt) // MartinW, absteigende Werte können variiert werden
{
int motor;
if(Parameter_UserParam2 < 39) Parameter_UserParam2= 40; //von 50% bis ...
if(neu > alt) motor = (1*(int)alt + neu) / 2;
else motor = neu + ((alt - neu)*1 / (Parameter_UserParam2/20));
return(motor);
}
 
int MotorSmoothing4(int neu, int alt) // MartinW, an und absteigendes Filter 50%/50%
{
int motor;
if(Parameter_UserParam2 < 39) Parameter_UserParam2= 40;
if(neu > alt) motor = (1*(int)alt + neu) / 2;
else motor = neu + ((alt - neu)*1 / 2);
return(motor);
}
 
 
 
 
 
 
 
void Piep(unsigned char Anzahl, unsigned int dauer)
{
if(MotorenEin) return; //auf keinen Fall im Flug!
1589,7 → 1628,41
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
if(Parameter_UserParam1 < 51) // MartinW, orginales MotorSmoothing
{
tmp_motorwert[i] = MotorSmoothing(tmp_int,tmp_motorwert[i]); // Filter
 
}
if(Parameter_UserParam1 < 101 && Parameter_UserParam1 > 50) // MartinW, nur bei ansteigenden Werten
{
tmp_motorwert[i] = MotorSmoothing2(tmp_int,tmp_motorwert[i]); // Filter
 
}
if(Parameter_UserParam1 < 201 && Parameter_UserParam1 > 100) // MartinW, mit ansteigendem und absteigendem Filter up50%/down50%
{
tmp_motorwert[i] = MotorSmoothing4(tmp_int,tmp_motorwert[i]); // Filter
 
}
if(Parameter_UserParam1 > 200) // MartinW, Variabel, mit Parameter_UserParam2
{
tmp_motorwert[i] = MotorSmoothing3(tmp_int,tmp_motorwert[i]); // Filter
 
}
tmp_int = tmp_motorwert[i] / STICK_GAIN;
CHECK_MIN_MAX(tmp_int,MIN_GAS,MAX_GAS);
Motor[i] = tmp_int;
/branches/V0.76g_VarMotorSmoothing/menu.c
45,7 → 45,7
{
case 0:
LCD_printfxy(0,0,"+ MikroKopter +");
LCD_printfxy(0,1,"HW:V%d.%d SW:%d.%d%c",PlatinenVersion/10,PlatinenVersion%10, VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH +'a');
LCD_printfxy(0,1,"HW:V%d.%d SW:%d.%d%c vMS",PlatinenVersion/10,PlatinenVersion%10, VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH +'a');
LCD_printfxy(0,2,"Setting:%d %s",GetActiveParamSetNumber(),Mixer.Name);
if(I2CTimeout < 6) LCD_printfxy(0,3,"I2C ERROR!!!")
else
/branches/V0.76g_VarMotorSmoothing/version.txt
338,5 → 338,25
0.76g H.Buss 10.11.2009
- Casting-Fehler in der Gas-Berechnung
 
MartinW, 11.2009
Motorsmoothing Funktion einstellbar, siehe http://forum.mikrokopter.de/topic-10116-1.html
1. Potiwert 0...50 orginal MS
2. Potiwert 51...100 MS nur bei ansteigenden Werten
3. Potiwert 101...200 MS mit korrigiert, wirkt bei auf-und absteigenden Werten
4. Potiwert 201...250 variable MS mit Userparameter2, auf 50% bis 10% bei absteigenden Motorwerten anstatt 0%.
 
wenn Userparameter1; Potiwert 201...max ist:
wird bei einem Sprung der Motoransteuerung von 100% auf 0% runter auf;
10% = neu + ((alt - neu)/10) (Poti=200...219, Userparameter2)
11% = neu + ((alt - neu)/9 ) (Poti=180...199)
12% = neu + ((alt - neu)/8 ) (Poti=160...179)
14% = neu + ((alt - neu)/7 ) (Poti=140...159)
16% = neu + ((alt - neu)/6 ) (Poti=120..139)
20% = neu + ((alt - neu)/5 ) (Poti=100...119)
25% = neu + ((alt - neu)/4 ) (Poti=80...99)
33% = neu + ((alt - neu)/3 ) (Poti=60...79)
50% = neu + ((alt - neu)/2 ) (Poti=00...59)
geregelt, anstatt wie orginal zuerst auf 0% und erst dann wieder hoch.