Subversion Repositories FlightCtrl

Rev

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

Rev 1272 Rev 1276
Line 50... Line 50...
50
        if((signal > 1100) && (signal < 8000))   
50
        if((signal > 1100) && (signal < 8000))   
51
        {
51
        {
52
        tmpChannels = index;
52
        tmpChannels = index;
53
        if(tmpChannels >= 4 && Channels == tmpChannels)  
53
        if(tmpChannels >= 4 && Channels == tmpChannels)  
54
                 {
54
                 {
55
          if(okay_cnt > 5)
55
          if(okay_cnt > 10)
56
                   {
56
                   {
57
                   NewPpmData = 0;  // Null bedeutet: Neue Daten
57
                   NewPpmData = 0;  // Null bedeutet: Neue Daten
58
                   for(index = 0; index < 11; index++)
58
                   for(index = 0; index < 11; index++)
59
                    {
59
                    {
60
                         if(okay_cnt > 30)
60
                         if(okay_cnt > 30)
Line 66... Line 66...
66
                     PPM_diff[index] = ppm_diff[index];
66
                     PPM_diff[index] = ppm_diff[index];
67
                    }
67
                    }
68
                   }
68
                   }
69
          if(okay_cnt < 255) okay_cnt++;
69
          if(okay_cnt < 255) okay_cnt++;
70
                 }
70
                 }
71
         else okay_cnt = 0;
71
         else
-
 
72
                  if(okay_cnt > 100) okay_cnt = 10; else okay_cnt = 0;
72
        index = 1;             
73
        index = 1;             
73
        if(!MotorenEin) Channels = tmpChannels;
74
        if(!MotorenEin) Channels = tmpChannels;
74
        }
75
        }
75
        else
76
        else
76
        {
77
        {
Line 80... Line 81...
80
                {
81
                {
81
                signal -= 466;
82
                signal -= 466;
82
                // Stabiles Signal
83
                // Stabiles Signal
83
                if((abs(signal - ppm_in[index]) < 6))
84
                if((abs(signal - ppm_in[index]) < 6))
84
                                 {
85
                                 {
85
                                  if(okay_cnt > 25) { if(SenderOkay < 200) SenderOkay += 10; else SenderOkay = 200;}
86
                                  if(okay_cnt > 25)  SenderOkay += 10;
86
                                  else
87
                                  else
-
 
88
                                  if(okay_cnt > 10)  SenderOkay += 2;
87
                                  if(okay_cnt > 10) { if(SenderOkay < 200) SenderOkay += 2; else SenderOkay = 200;}
89
                                  if(SenderOkay > 200) SenderOkay = 200;
88
                                 }
90
                                 }
89
                tmp = (3 * (ppm_in[index]) + signal) / 4;  
91
                tmp = (3 * (ppm_in[index]) + signal) / 4;  
90
                if(tmp > signal+1) tmp--; else
92
                if(tmp > signal+1) tmp--; else
91
                if(tmp < signal-1) tmp++;
93
                if(tmp < signal-1) tmp++;
92
                if(SenderOkay >= 190)  ppm_diff[index] = ((tmp - ppm_in[index]) / 3) * 3;
94
                if(SenderOkay >= 190)  ppm_diff[index] = ((tmp - ppm_in[index]) / 3) * 3;
Line 98... Line 100...
98
            if(index == 6) J4High; else J4Low;  // Servosignal an J4 anlegen
100
            if(index == 6) J4High; else J4Low;  // Servosignal an J4 anlegen
99
            if(index == 7) J5High; else J5Low;  // Servosignal an J5 anlegen 
101
            if(index == 7) J5High; else J5Low;  // Servosignal an J5 anlegen 
100
          }
102
          }
101
                  else ROT_ON;
103
                  else ROT_ON;
102
                  if(index < 20) index++;
104
                  if(index < 20) index++;
103
                  else
105
          else
-
 
106
                  if(index == 20)
104
                  {
107
                  {
105
                   unsigned char i;
108
            unsigned char i;
-
 
109
                    index = 30;
106
            for(i=0;i<11;i++) // restore from older data
110
            for(i=0;i<11;i++) // restore from older data
107
                         {
111
                         {
108
                      PPM_in[i] = old_ppm_in[index];
112
                      PPM_in[i] = old_ppm_in[i];
109
                      PPM_diff[index] = 0;
113
                      PPM_diff[i] = 0;
110
                          okay_cnt = 0;
114
//                        okay_cnt /= 2;
111
                 }
115
                 }
112
                  }
116
                  }
113
            }
117
            }
114
DebugOut.Analog[16] = okay_cnt;
118
 DebugOut.Analog[16] = okay_cnt;
115
//DebugOut.Analog[17] = PPM_in[2];
119
 DebugOut.Analog[17] = PPM_in[2];
116
}
120
}
Line 117... Line 121...
117
 
121
 
118
/*
122
/*
119
//############################################################################
123
//############################################################################