/branches/MergedVersionsByOsiair/alpha/v064JokoGPSNick666MM3Acc/compass.h |
---|
35,6 → 35,6 |
// Die Werte der Kompasskalibrierung |
// OFFSET: (Maximaler Wert + minimaler Wert) / 2 |
#define OFF_X 0 |
#define OFF_Y 0 |
#define OFF_Z 0 |
#define OFF_X -11 |
#define OFF_Y 30 |
#define OFF_Z 18 |
/branches/MergedVersionsByOsiair/alpha/v064JokoGPSNick666MM3Acc/flight-ctrl_mega644_v0_64.aws |
---|
1,0 → 0,0 |
<AVRWorkspace><IOSettings><CurrentRegisters/></IOSettings><part name="ATMEGA644"/><Files><File00000 Name="E:\hubi\ufo\mickrokopter\a Versions\eigene versionen\Kompass + GPS\Flight-Ctrl_V0_64_3_GPS_work_Jochenaccvonhand\main.c" Position="344 108 876 484" LineCol="155 0" State="Maximized"/><File00001 Name="E:\hubi\ufo\mickrokopter\a Versions\eigene versionen\Kompass + GPS\Flight-Ctrl_V0_64_3_GPS_work_Jochenaccvonhand\compass.c" Position="336 71 1048 624" LineCol="25 63" State="Maximized"/><File00002 Name="E:\hubi\ufo\mickrokopter\a Versions\eigene versionen\Kompass + GPS\Flight-Ctrl_V0_64_3_GPS_work_Jochenaccvonhand\compass.h" Position="371 132 917 500" LineCol="0 0" State="Maximized"/><File00003 Name="E:\hubi\ufo\mickrokopter\a Versions\eigene versionen\Kompass + GPS\Flight-Ctrl_V0_64_3_GPS_work_Jochenaccvonhand\fc.c" Position="330 67 1042 620" LineCol="834 0" State="Maximized"/><File00004 Name="E:\hubi\ufo\mickrokopter\a Versions\eigene versionen\Kompass + GPS\Flight-Ctrl_V0_64_3_GPS_work_Jochenaccvonhand\analog.c" Position="428 182 978 554" LineCol="0 0" State="Maximized"/></Files></AVRWorkspace> |
<AVRWorkspace><IOSettings><CurrentRegisters/></IOSettings><part name="ATMEGA644"/><Files><File00000 Name="E:\hubi\ufo\mickrokopter\a Versions\eigene versionen\Kompass + GPS\v064JokoGPSNick666Acc\main.c" Position="341 108 873 484" LineCol="155 0" State="Maximized"/><File00001 Name="E:\hubi\ufo\mickrokopter\a Versions\eigene versionen\Kompass + GPS\v064JokoGPSNick666Acc\compass.c" Position="327 65 1039 618" LineCol="25 0" State="Maximized"/><File00002 Name="E:\hubi\ufo\mickrokopter\a Versions\eigene versionen\Kompass + GPS\v064JokoGPSNick666Acc\compass.h" Position="362 126 908 494" LineCol="0 0" State="Maximized"/><File00003 Name="E:\hubi\ufo\mickrokopter\a Versions\eigene versionen\Kompass + GPS\v064JokoGPSNick666Acc\fc.c" Position="336 71 1182 830" LineCol="834 0" State="Maximized"/></Files></AVRWorkspace> |
/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; |
} |