Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 308 → Rev 309

/branches/MergedVersionsByOsiair/alpha/v064JokoGPSNick666MM3Acc/compass.c
63,8 → 63,8
return; // Jetzt gehts weiter in SIGNAL (SIG_SPI)
case MM3_TILT: // Zeitnahe Speicherung der aktuellen Neigung in °
MM3.NickGrad = asin_i((float)Aktuell_ax/EE_Parameter.UserParam1*200);
MM3.RollGrad = asin_i((float)Aktuell_ay/EE_Parameter.UserParam2*200);
MM3.NickGrad = asin_i((float)Aktuell_ax/220*200);
MM3.RollGrad = asin_i((float)Aktuell_ay/220*200);
MM3.AXIS = MM3_X;
MM3.STATE = MM3_RESET;
140,7 → 140,9
cos_roll = cos_f(MM3.RollGrad);
// Neigungskompensation
x_corr = (cos_nick * MM3.x_axis) + (((sin_roll * MM3.y_axis) - (cos_roll * MM3.z_axis)) * sin_nick);
//x_corr = (cos_nick * MM3.x_axis) + (((sin_roll * MM3.y_axis) - (cos_roll * MM3.z_axis)) * sin_nick);
x_corr = (cos_nick * MM3.x_axis) - (((sin_roll * MM3.y_axis) - (cos_roll * MM3.z_axis)) * sin_nick);
y_corr = ((cos_roll * MM3.y_axis) + (sin_roll * MM3.z_axis));
// Winkelberechnung
/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\version system\flightcontrol\branches\MergedVersionsByOsiair\alpha\v064JokoGPSNick666Acc\main.c" Position="343 108 875 484" LineCol="155 0" State="Maximized"/><File00001 Name="E:\hubi\ufo\mickrokopter\a Versions\version system\flightcontrol\branches\MergedVersionsByOsiair\alpha\v064JokoGPSNick666Acc\compass.c" Position="333 69 1045 622" LineCol="25 0" State="Maximized"/><File00002 Name="E:\hubi\ufo\mickrokopter\a Versions\version system\flightcontrol\branches\MergedVersionsByOsiair\alpha\v064JokoGPSNick666Acc\compass.h" Position="368 130 914 498" LineCol="0 0" State="Maximized"/><File00003 Name="E:\hubi\ufo\mickrokopter\a Versions\version system\flightcontrol\branches\MergedVersionsByOsiair\alpha\v064JokoGPSNick666Acc\fc.c" Position="336 71 1182 830" LineCol="834 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\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>
/branches/MergedVersionsByOsiair/alpha/v064JokoGPSNick666MM3Acc/timer0.c
3,11 → 3,16
volatile unsigned int CountMilliseconds = 0;
volatile static unsigned int tim_main;
volatile unsigned char UpdateMotor = 0;
volatile unsigned int beeptime = 0;
volatile unsigned int cntKompass = 0;
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,
23,16 → 28,17
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)
87,15 → 93,21
 
if (!cntKompass--) // Aufruf mit 25 Hz
{
KompassValue = MM3_heading();
KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360) - 180;
KompassValue = (MM3_heading());
 
if (KompassValue < 0 ) { KompassValue = 380+MM3_heading();}
if (KompassValue > 359) { KompassValue = 359;}
 
KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360);
 
cntKompass = 320;
}
}
}
 
//}
}
 
 
void Timer_Init(void)
162,6 → 174,7
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;
}