Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 420 → Rev 446

/branches/salvo_gps/Basis_V0066c/trunk/timer0.c
7,7 → 7,13
volatile unsigned int beeptime = 0;
unsigned int BeepMuster = 0xffff;
int ServoValue = 0;
 
//Salvo 8.9.2007
volatile uint8_t Kompass_Neuer_Wert= 0;
volatile unsigned int Kompass_Value_Old = 0;
// Salvo End
//Salvo 21.9.2007
short unsigned int Kompass_present= 0; //>0 bedeutet dass der Kompass vorhanden ist
// Salvo End
enum {
STOP = 0,
CK = 1,
19,7 → 25,12
T0_RISING_EDGE = 7
};
 
 
// Aenderungen von Peter Muehlenbrock ("Salvo") Stand 21.9.2007
/*
Driftkompensation fuer Gyros verbessert
Linearsensor mit fixem Neutralwert
Ersatzkompass abgeleitet aus Magnetkompass und Giergyro fuer nahezu neigungsubhaengige Kompassfunktion
*/
SIGNAL (SIG_OVERFLOW0) // 8kHz
{
static unsigned char cnt_1ms = 1,cnt = 0;
28,6 → 39,7
 
if(!cnt--)
{
if (Kompass_present > 0) Kompass_present--; //Runterzaehlen. Wenn 0 ist der Kompass nicht vorhanden
cnt = 9;
cnt_1ms++;
cnt_1ms %= 2;
62,7 → 74,7
else PORTC &= ~(1<<7);
}
if(EE_Parameter.GlobalConfig & CFG_KOMPASS_AKTIV)
// if(EE_Parameter.GlobalConfig & CFG_KOMPASS_AKTIV)
{
if(PINC & 0x10)
{
72,12 → 84,28
{
if((cntKompass) && (cntKompass < 4000))
{
KompassValue = cntKompass;
// Salvo Kompassoffset 30.8.2007 und 21.9.2007 ***********
Kompass_present = 255;
Kompass_Value_Old = KompassValue;
KompassValue = cntKompass -KOMPASS_OFFSET;
 
if (KompassValue < 0)
{
KompassValue += 360;
}
if (KompassValue >= 360)
{
KompassValue -= 360;
}
// Salvo End
}
// if(cntKompass < 10) cntKompass = 10;
// KompassValue = (unsigned long)((unsigned long)(cntKompass-10)*720L + 1L) / 703L;
KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360) - 180;
cntKompass = 0;
//Salvo 13.9.2007 Ok Erkennung des Magnetkompasses
Kompass_Neuer_Wert = 1;
// Salvo End
cntKompass = 0;
}
}
}