/trunk/analog.c |
---|
122,11 → 122,12 |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + correction of the altitude error in higher altitudes |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
CalAthmospheare = 16; |
CalAthmospheare = 15; // re-claibrated from 16 to 15 at 2.09 -> the baro-Altimeter was about 7% too high |
if(ACC_AltitudeControl) |
{ |
if(PlatinenVersion < 23) { if(off < 140) CalAthmospheare += (160 - off) / 26; } |
else { if(off < 170) CalAthmospheare += (188 - off) / 19; } |
// else { if(off < 170) CalAthmospheare += (188 - off) / 19; } |
else { if(off < 170) CalAthmospheare += (188 - off) / 15; } // rescaled at 2.09 |
} |
Luftdruck = MessLuftdruck * CalAthmospheare; |
#endif |
353,12 → 354,17 |
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
if(ACC_AltitudeControl) |
{ |
// ExpandBaroStep = BaroStep * (long)ExpandBaro; // wird in fc.c aufgerufen |
// tmpLuftdruck = MessLuftdruck - BaroStep * (long)ExpandBaro; // -523 counts per offset step |
tmpLuftdruck = MessLuftdruck - ExpandBaroStep; // -523 counts per offset step |
Luftdruck -= Luftdruck / CalAthmospheare; // 16 |
Luftdruck += tmpLuftdruck; |
HoehenWert_Mess = StartLuftdruck - Luftdruck; // cm |
if(BaroExpandActive) |
{ |
if(BaroExpandActive < 10) Luftdruck = tmpLuftdruck * CalAthmospheare; |
} |
else |
{ |
Luftdruck -= Luftdruck / CalAthmospheare; // 16 |
Luftdruck += tmpLuftdruck; |
HoehenWert_Mess = StartLuftdruck - Luftdruck; // cm |
} |
} |
else |
#endif |
367,8 → 373,6 |
if(++messanzahl_Druck >= 16) // war bis 0.86 "18" |
{ |
signed int tmp; |
// Luftdruck = (7 * Luftdruck + tmpLuftdruck - (16 * BaroStep) * (long)ExpandBaro + 4) / 8; // -523.19 counts per 10 counts offset step |
// ExpandBaroStep = (16 * BaroStep) * (long)ExpandBaro - 4; // wird in fc.c aufgerufen |
Luftdruck = (7 * Luftdruck + tmpLuftdruck - ExpandBaroStep) / 8; // -523.19 counts per 10 counts offset step |
HoehenWert_Mess = StartLuftdruck - Luftdruck; |
SummenHoehe -= SummenHoehe/SM_FILTER; |
/trunk/fc.c |
---|
80,6 → 80,7 |
volatile long Mess_Integral_Hoch = 0; |
int KompassValue = -1; |
int KompassSollWert = 0; |
int NC_CompassSetpoint = -1; |
//int KompassRichtung = 0; |
char CalculateCompassTimer = 100; |
unsigned char KompassFusion = 32; |
397,6 → 398,7 |
Mess_IntegralRoll = IntegralRoll; |
Mess_Integral_Gier = 0; |
KompassSollWert = KompassValue; |
NC_CompassSetpoint = -1; |
KompassSignalSchlecht = 100; |
Umschlag180Nick = ((long) EE_Parameter.WinkelUmschlagNick * 2500L) + 15000L; |
Umschlag180Roll = ((long) EE_Parameter.WinkelUmschlagRoll * 2500L) + 15000L; |
450,6 → 452,15 |
DebugOut.Analog[28] = 0; // I2C-Counter |
CalcExpandBaroStep(); |
if(FC_StatusFlags3 & FC_STATUS3_BOAT && !EE_Parameter.Driftkomp) EE_Parameter.Driftkomp = 4; |
/* |
//+++++++++++++++++++++++++++++++++++++++++++ |
//For testing the expandBaro at 30m |
ExpandBaro -= 1; |
OCR0A = DruckOffsetSetting - OPA_OFFSET_STEP * ExpandBaro; // increase offset to shift ADC down |
OCR0B = 255 - OCR0A; |
CalcExpandBaroStep(); |
//+++++++++++++++++++++++++++++++++++++++++++ |
*/ |
return(sucess); |
} |
1479,14 → 1490,6 |
{ |
GierGyroFehler += fehler; |
if(NeueKompassRichtungMerken) NeueKompassRichtungMerken--; |
/* if(NeueKompassRichtungMerken) |
{ |
if(--NeueKompassRichtungMerken == 0) |
{ |
KompassSollWert = ErsatzKompassInGrad; |
} |
} |
*/ |
} |
// Kompass fusionieren |
if(!KompassSignalSchlecht) ErsatzKompass += (fehler * KompassFusion) / korrektur; |
1593,7 → 1596,11 |
OCR0A = DruckOffsetSetting - OPA_OFFSET_STEP * ExpandBaro; // increase offset to shift ADC down |
OCR0B = 255 - OCR0A; |
beeptime = 300; |
BaroExpandActive = 350; |
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
if(ACC_AltitudeControl) BaroExpandActive = 50; |
else |
#endif |
BaroExpandActive = 350; |
CalcExpandBaroStep(); |
} |
else |
1611,7 → 1618,11 |
OCR0A = DruckOffsetSetting - OPA_OFFSET_STEP * ExpandBaro; // decrease offset to shift ADC up |
OCR0B = 255 - OCR0A; |
beeptime = 300; |
BaroExpandActive = 350; |
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
if(ACC_AltitudeControl) BaroExpandActive = 50; |
else |
#endif |
BaroExpandActive = 350; |
CalcExpandBaroStep(); |
} |
else |
1629,6 → 1640,7 |
{ |
// now clear the D-values |
VarioMeter = 0; |
cli(); |
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
if(ACC_AltitudeControl) ACC_AltitudeFusion(1); // init |
else SummenHoehe = HoehenWert * SM_FILTER; |
1635,6 → 1647,7 |
#else |
SummenHoehe = HoehenWert * SM_FILTER; |
#endif |
sei(); |
BaroExpandActive--; |
} |
// if height control is activated by an rc channel |
/trunk/fc.h |
---|
80,7 → 80,7 |
extern volatile long Mess_Integral_Hoch; |
extern long Integral_Gier,Mess_Integral_Gier,Mess_Integral_Gier2; |
extern int KompassValue; |
extern int KompassSollWert; |
extern int KompassSollWert,NC_CompassSetpoint; |
extern int KompassRichtung; |
extern char CalculateCompassTimer; |
extern unsigned char KompassFusion; |
155,5 → 155,6 |
extern unsigned char LowVoltageLandingActive; |
extern unsigned char LowVoltageHomeActive; |
extern unsigned char Parameter_MaximumAltitude; |
extern char NeueKompassRichtungMerken; |
#endif //_FC_H |
/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 |
---|
395,6 → 395,22 |
static unsigned char second; |
timer += 20; // 20 ms interval |
CalcNickServoValue(); |
// ++++++++++++++++++++++++++++ |
// + New direction setpoint from NC |
if(NC_CompassSetpoint != -1) |
{ |
int diff; |
if(!NeueKompassRichtungMerken && (KompassSollWert != NC_CompassSetpoint) && CareFree) |
{ |
diff = ((540 + (KompassSollWert - NC_CompassSetpoint)) % 360) - 180; |
if(diff > 2) diff = 2; // max. 2° in 20ms = 100°/sec |
else |
if(diff < -2) diff = -2; |
KompassSollWert -= diff; |
} |
else NC_CompassSetpoint = -1; |
} |
// ++++++++++++++++++++++++++++ |
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
if(EE_Parameter.Receiver == RECEIVER_HOTT) HoTT_Menu(); |
else |
/trunk/makefile |
---|
5,7 → 5,7 |
F_CPU = 20000000 |
#------------------------------------------------------------------- |
VERSION_MAJOR = 2 |
VERSION_MINOR = 8 |
VERSION_MINOR = 9 |
VERSION_PATCH = 0 |
VERSION_SERIAL_MAJOR = 11 # Serial Protocol to KopterTool -> do not change! |
VERSION_SERIAL_MINOR = 0 # Serial Protocol |
/trunk/spi.c |
---|
344,7 → 344,6 |
// MagVec.z = FromNaviCtrl.MagVecZ; |
if(FromNaviCtrl.CompassValue <= 360) KompassValue = FromNaviCtrl.CompassValue; |
// KompassRichtung = ((540 + KompassValue - KompassSollWert) % 360) - 180; |
if(FromNaviCtrl.BeepTime > beeptime && !DisableRcOffBeeping) beeptime = FromNaviCtrl.BeepTime; |
switch (FromNaviCtrl.Command) |
358,16 → 357,9 |
FromNC_Rotate_C = FromNaviCtrl.Param.Byte[5]; |
FromNC_Rotate_S = FromNaviCtrl.Param.Byte[6]; |
GPS_Aid_StickMultiplikator = FromNaviCtrl.Param.Byte[7]; |
if(CareFree && FromNaviCtrl.Param.sInt[4] >= 0) |
if(FromNaviCtrl.Param.sInt[4] >= 0) |
{ |
KompassSollWert = FromNaviCtrl.Param.sInt[4]; // bei Carefree kann NC den Kompass-Sollwinkel vorgeben |
/* |
if(EE_Parameter.CamOrientation) // Kamera angle is not front |
{ |
KompassSollWert += 360 - ((unsigned int) EE_Parameter.CamOrientation * 15); |
KompassSollWert %= 360; |
} |
*/ |
NC_CompassSetpoint = FromNaviCtrl.Param.sInt[4]; // bei Carefree kann NC den Kompass-Sollwinkel vorgeben |
} |
POI_KameraNick = (POI_KameraNick + FromNaviCtrl.Param.sInt[5]) / 2; // FromNaviCtrl.Param.sInt[5]; // Nickwinkel |
break; |
/trunk/timer0.c |
---|
144,7 → 144,6 |
{ |
cntKompass += cntKompass / 41; |
if(cntKompass > 10) KompassValue = cntKompass - 10; else KompassValue = 0; |
// KompassRichtung = ((540 + KompassValue - KompassSollWert) % 360) - 180; |
} |
cntKompass = 0; |
} |
/trunk/uart.c |
---|
372,7 → 372,6 |
{ |
case 'K':// Kompasswert |
memcpy((unsigned char *)&KompassValue , (unsigned char *)pRxData, sizeof(KompassValue)); |
// KompassRichtung = ((540 + KompassValue - KompassSollWert) % 360) - 180; |
break; |
case 't':// Motortest |
if(AnzahlEmpfangsBytes > 20) memcpy(&MotorTest[0], (unsigned char *)pRxData, sizeof(MotorTest)); |
612,7 → 611,6 |
// 'K' comand placed here only for compatibility to old MK3MAG software, that does not send the right Slave Address |
case 'K':// Kompasswert |
memcpy((unsigned char *)&KompassValue , (unsigned char *)pRxData, sizeof(KompassValue)); |
// KompassRichtung = ((540 + KompassValue - KompassSollWert) % 360) - 180; |
break; |
case 'a':// Texte der Analogwerte |
DebugTextAnforderung = pRxData[0]; |
/trunk/version.txt |
---|
749,10 → 749,12 |
2.09a (10.11.2014) |
- New data structure of ExternalControl |
- Internal Copies of the Channel values |
- NC-Yawing rate limited to 100°/sec |
- ExpandBaro faster -> 80ms instead of 700ms |
- Altitude measurement re-calibrated (the measured value was about 5% too high) |
toDo: |
- CalAthmospheare nachführen |
- ExpandBaro kürzer? |