Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 315 → Rev 316

/branches/MergedVersionsByOsiair/alpha/v064JokoGPSNick666MM3Acc/timer0.c
3,16 → 3,11
volatile unsigned int CountMilliseconds = 0;
volatile static unsigned int tim_main;
volatile unsigned char UpdateMotor = 0;
volatile unsigned int cntKompass = 0;
volatile unsigned int beeptime = 0;
volatile unsigned int cntKompass = 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,
28,17 → 23,16
SIGNAL (SIG_OVERFLOW0) // 8kHz
{
static unsigned char cnt_1ms = 1,cnt = 0;
unsigned char pieper_ein = 0;
// TCNT0 -= 250;//TIMER_RELOAD_VALUE;
 
if(!cnt--)
{
// if (Kompass_present > 0) Kompass_present--; //Runterzaehlen. Wenn 0 ist der Kompass nicht vorhanden
cnt = 9;
cnt_1ms++;
cnt_1ms %= 2;
if(!cnt_1ms) UpdateMotor = 1;
CountMilliseconds++;
if(Timeout) Timeout--;
}
 
if(beeptime > 1)
68,27 → 62,15
else PORTC &= ~(1<<7);
}
if(EE_Parameter.GlobalConfig & CFG_KOMPASS_AKTIV || EE_Parameter.GlobalConfig & CFG_GPS_AKTIV) //Abfrage um GPS_AKTIV erweitert, damit auch bei nur eingeschaltetem GPS OHNE Kompass der benötigte Kompassvalue berechnet wird (200907Kr)
if(EE_Parameter.GlobalConfig & CFG_KOMPASS_AKTIV)
{
// if(PINC & 0x10)
// {
// cntKompass++;
// }
// else
// {
// if((cntKompass) && (cntKompass < 4000))
// {
// KompassValue = cntKompass;
// }
// if(cntKompass < 10) cntKompass = 10;
// KompassValue = (unsigned long)((unsigned long)(cntKompass-10)*720L + 1L) / 703L;
// KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360) - 180;
// cntKompass = 0;
// }
// }
//
// if(EE_Parameter.GlobalConfig & CFG_KOMPASS_AKTIV)
// {
if(PINC & 0x10)
{
cntKompass++;
}
else
{
MM3_timer0(); // Kompass auslesen
 
if (!cntKompass--) // Aufruf mit 25 Hz
101,14 → 83,11
 
KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360);
 
cntKompass = 320;
}
}
 
cntKompass = 640;
}
}
}
}
 
 
void Timer_Init(void)
175,7 → 154,6
if(ServoValue < EE_Parameter.ServoNickMin) ServoValue = EE_Parameter.ServoNickMin;
else if(ServoValue > EE_Parameter.ServoNickMax) ServoValue = EE_Parameter.ServoNickMax;
 
//DebugOut.Analog[10] = ServoValue;
OCR2A = ServoValue;// + 75;
timer = EE_Parameter.ServoNickRefresh;
}