Subversion Repositories FlightCtrl

Rev

Rev 35 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 35 Rev 127
Line 9... Line 9...
9
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
9
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Line 10... Line 10...
10
 
10
 
11
#include "rc.h"
11
#include "rc.h"
Line 12... Line 12...
12
#include "main.h"
12
#include "main.h"
13
 
13
 
14
volatile int PPM_in[11];
14
volatile int PPM_in[15];
Line 15... Line 15...
15
volatile int PPM_diff[11];  // das diffenzierte Stick-Signal
15
volatile int PPM_diff[15];  // das diffenzierte Stick-Signal
16
volatile unsigned char NewPpmData = 1;
16
volatile unsigned char NewPpmData = 1;
17
 
17
 
Line 48... Line 48...
48
               
48
               
49
        signal = (unsigned int) ICR1 - AltICR;         
49
        signal = (unsigned int) ICR1 - AltICR;         
Line 50... Line 50...
50
        AltICR = ICR1; 
50
        AltICR = ICR1; 
51
       
51
       
52
    //Syncronisationspause?
52
    //Syncronisationspause?
53
        if ((signal > 1500) && (signal < 8000))  
53
        if ((signal > 1000) && (signal < 5000))  
54
        {
54
        {
55
        index = 1;             
55
        index = 1;             
Line 56... Line 56...
56
        NewPpmData = 0;  // Null bedeutet: Neue Daten
56
        NewPpmData = 0;  // Null bedeutet: Neue Daten
57
//        OCR2A = Poti2/2 + 80;
57
//        OCR2A = Poti2/2 + 80;
58
       
58
       
59
        }
59
        }
60
        else
60
        else
61
        {
61
        {
62
        if(index < 10)
62
        if(index < 14)
63
            {
63
            {
-
 
64
            if((signal > 250) && (signal < 687))
64
            if((signal > 250) && (signal < 687))
65
            {
-
 
66
                signal -= 466; // Stabiles Signal
65
                {
67
               
-
 
68
                if(abs(signal - PPM_in[index]) < 6)
66
                signal -= 466;
69
                                {
67
                // Stabiles Signal
70
                                        if(SenderOkay < 200) SenderOkay += 10;
68
                if(abs(signal - PPM_in[index]) < 6) { if(SenderOkay < 200) SenderOkay += 10;}
71
                                }
69
                signal = (3 * (PPM_in[index]) + signal) / 4;  
72
                signal = (3 * (PPM_in[index]) + signal) / 4;  
70
                //373 entspricht ca. 1.5ms also Mittelstellung
73
                //373 entspricht ca. 1.5ms also Mittelstellung
71
                PPM_diff[index] = signal - PPM_in[index];
74
                PPM_diff[index] = signal - PPM_in[index];
72
                PPM_in[index] = signal;
-
 
73
                }
-
 
74
            index++;  
-
 
75
    /*     if(index == 5) PORTD |= 0x20; else PORTD &= ~0x20;  // Servosignal an J3 anlegen
75
                PPM_in[index] = signal;
76
         if(index == 6) PORTD |= 0x10; else PORTD &= ~0x10;  // Servosignal an J4 anlegen
76
            }
77
         if(index == 7) PORTD |= 0x08; else PORTD &= ~0x08;  // Servosignal an J5 anlegen */
77
            index++;