/branches/v0.60_MicroMag3_Nick666/trunc/compass.c |
---|
33,6 → 33,7 |
PORTD &= ~(1<<PD3); // J5 auf Low |
// Init Statemachine |
MM3.AXIS = MM3_X; |
MM3.STATE = MM3_RESET; |
60,7 → 61,7 |
else if (MM3.AXIS == MM3_Y) SPDR = 0x32; // Micromag Period Select ist auf 256 (0x30) |
else if (MM3.AXIS == MM3_Z) SPDR = 0x33; // 1: x-Achse, 2: Y-Achse, 3: Z-Achse |
MM3.DRDY = SetDelay(5); // Laut Datenblatt max. Zeit bis Messung fertig (bei PS 256 eigentlich 4 ms) |
MM3.DRDY = SetDelay(8); // Laut Datenblatt max. Zeit bis Messung fertig (bei PS 256 eigentlich 4 ms) |
MM3.STATE = MM3_WAIT_DRDY; |
return; |
195,7 → 196,7 |
float sin_nick, cos_nick, sin_roll, cos_roll; |
float x_corr, y_corr; |
signed int x_axis,y_axis,z_axis, heading; |
unsigned int div_faktor; |
uint16_t div_faktor; |
div_faktor = (uint16_t)EE_Parameter.UserParam1 * 8; |
/branches/v0.60_MicroMag3_Nick666/trunc/math.c |
---|
106,7 → 106,7 |
return (sinus*m*n); |
} |
/* |
const uint8_t pgm_asin[201] PROGMEM = {0,0,1,1,1,1,2,2,2,3,3,3,3,4,4,4,5,5,5,5,6,6,6,7,7,7,7,8,8,8,9,9,9,9,10,10,10,11,11,11,12,12,12,12,13,13,13,14,14,14,14,15,15,15,16,16,16,17,17,17,17,18,18,18,19,19,19,20,20,20,20,21,21,21,22,22,22,23,23,23,24,24,24,25,25,25,25,26,26,26,27,27,27,28,28,28,29,29,29,30,30,30,31,31,31,32,32,32,33,33,33,34,34,34,35,35,35,36,36,37,37,37,38,38,38,39,39,39,40,40,41,41,41,42,42,42,43,43,44,44,44,45,45,46,46,46,47,47,48,48,49,49,49,50,50,51,51,52,52,53,53,54,54,55,55,56,56,57,57,58,58,59,59,60,60,61,62,62,63,64,64,65,66,66,67,68,68,69,70,71,72,73,74,75,76,77,79,80,82,84,90}; |
//############################################################################ |
123,3 → 123,4 |
return (pgm_read_byte(&pgm_asin[i]) * m); |
} |
*/ |
/branches/v0.60_MicroMag3_Nick666/trunc/math.h |
---|
8,4 → 8,4 |
extern signed int atan2_i(signed int x, signed int y); |
extern float cos_f(signed int winkel); |
extern float sin_f(signed int winkel); |
extern int8_t asin_i(signed int i); |
//extern int8_t asin_i(signed int i); |
/branches/v0.60_MicroMag3_Nick666/trunc/timer0.c |
---|
50,7 → 50,7 |
{ |
int heading; |
heading = heading_MM3(); |
KompassValue = (KompassValue * 7 + heading) / 8; // Filtern |
KompassValue = (KompassValue * 3 + heading) / 4; // Filtern |
KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360) - 180; |
cntKompass = 980; |
} |