Subversion Repositories FlightCtrl

Rev

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

Rev 690 Rev 711
Line 104... Line 104...
104
        else // within the PPM frame
104
        else // within the PPM frame
105
        {
105
        {
106
        if(index < 10) // channel limit is 9 because of the frame length of 22.5 ms
106
        if(index < 10) // channel limit is 9 because of the frame length of 22.5 ms
107
        {
107
        {
108
                        // check for valid signal length (0.8 ms < signal < 2.1984 ms)
108
                        // check for valid signal length (0.8 ms < signal < 2.1984 ms)
-
 
109
                        // signal range is from 1.0ms/3.2us = 312 to 2.0ms/3.2us = 625
109
            if((signal > 250) && (signal < 687))
110
            if((signal > 250) && (signal < 687))
110
            {
111
            {
-
 
112
                                // shift signal to zero symmetric range  -154 to 159
111
                signal -= 466; // offset of 1.4912 ms ??? (469 * 3.2µs = 1.5008 ms)
113
                signal -= 466; // offset of 1.4912 ms ??? (469 * 3.2µs = 1.5008 ms)
112
                // check for stable signal
114
                // check for stable signal
113
                // the deviation of the current signal level from the average must be less than 6 (aprox. 1%)
115
                // the deviation of the current signal level from the average must be less than 6 (aprox. 1%)
114
                if(abs(signal - PPM_in[index]) < 6)
116
                if(abs(signal - PPM_in[index]) < 6)
115
                {
117
                {
116
                                        // a good signal condition increases SenderOkay by 10
118
                                        // a good signal condition increases SenderOkay by 10
117
                                        // SignalOkay is decremented every 2 ms in timer0.c
119
                                        // SignalOkay is decremented every 2 ms in main.c
118
                                        // this variable is a level for the average rate of noiseless signal
120
                                        // this variable is a level for the average rate of a noiseless rc signal
119
                                        if(SenderOkay < 200) SenderOkay += 10;
121
                                        if(SenderOkay < 200) SenderOkay += 10;
120
                                }
122
                                }
121
                                // calculate exponential history for signal
123
                                // calculate exponential history for signal
122
                tmp = (3 * (PPM_in[index]) + signal) / 4;
124
                tmp = (3 * (PPM_in[index]) + signal) / 4;
123
                if(tmp > signal+1) tmp--; else
125
                if(tmp > signal+1) tmp--; else