Subversion Repositories FlightCtrl

Rev

Rev 308 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 308 Rev 309
Line 12... Line 12...
12
 
12
 
13
Please note: All the other files for the project "Mikrokopter" by H. Buss are under the license (license_buss.txt) published by www.mikrokopter.de
13
Please note: All the other files for the project "Mikrokopter" by H. Buss are under the license (license_buss.txt) published by www.mikrokopter.de
Line 14... Line 14...
14
*/
14
*/
-
 
15
 
Line 15... Line 16...
15
 
16
#include "main.h"
Line 16... Line 17...
16
#include "main.h"
17
#include "math.h"
Line 61... Line 62...
61
        case MM3_WAIT_DRDY:
62
        case MM3_WAIT_DRDY:
62
                if (CheckDelay(MM3.DRDY)) {SPDR = 0x00;MM3.STATE = MM3_DRDY;} // Irgendwas ins SPDR, damit Übertragung ausgelöst wird, wenn Wartezeit vorbei
63
                if (CheckDelay(MM3.DRDY)) {SPDR = 0x00;MM3.STATE = MM3_DRDY;} // Irgendwas ins SPDR, damit Übertragung ausgelöst wird, wenn Wartezeit vorbei
63
                return;         // Jetzt gehts weiter in SIGNAL (SIG_SPI)
64
                return;         // Jetzt gehts weiter in SIGNAL (SIG_SPI)
Line 64... Line 65...
64
       
65
       
65
        case MM3_TILT:          // Zeitnahe Speicherung der aktuellen Neigung in °
66
        case MM3_TILT:          // Zeitnahe Speicherung der aktuellen Neigung in °
66
                MM3.NickGrad = asin_i((float)Aktuell_ax/220*200);
67
                MM3.NickGrad = IntegralNick/(120*8);
Line 67... Line 68...
67
                MM3.RollGrad = asin_i((float)Aktuell_ay/220*200);
68
                MM3.RollGrad = IntegralRoll/(120*8);
68
               
69
               
69
                MM3.AXIS = MM3_X;
70
                MM3.AXIS = MM3_X;
70
                MM3.STATE = MM3_RESET;
71
                MM3.STATE = MM3_RESET;
Line 132... Line 133...
132
        float sin_nick, cos_nick, sin_roll, cos_roll;
133
        float sin_nick, cos_nick, sin_roll, cos_roll;
133
        signed int x_corr, y_corr;
134
        signed int x_corr, y_corr;
134
        signed int heading;
135
        signed int heading;
Line 135... Line 136...
135
               
136
               
136
        // Berechung von sinus und cosinus
137
        // Berechung von sinus und cosinus
137
        sin_nick = sin_i(MM3.NickGrad);
138
        sin_nick = sin_f(MM3.NickGrad);
138
        cos_nick = cos_i(MM3.NickGrad);
139
        cos_nick = cos_f(MM3.NickGrad);
139
        sin_roll = sin_i(MM3.RollGrad);
140
        sin_roll = sin_f(MM3.RollGrad);
Line 140... Line 141...
140
        cos_roll = cos_i(MM3.RollGrad);      
141
        cos_roll = cos_f(MM3.RollGrad);      
141
       
142
       
142
    // Neigungskompensation
143
    // Neigungskompensation