Subversion Repositories FlightCtrl

Rev

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

Rev 2071 Rev 2073
Line 109... Line 109...
109
    if (index < MAX_CHANNELS) { // PPM24 supports 12 channels
109
    if (index < MAX_CHANNELS) { // PPM24 supports 12 channels
110
      // check for valid signal length (0.8 ms < signal < 2.1984 ms)
110
      // check for valid signal length (0.8 ms < signal < 2.1984 ms)
111
      // signal range is from 1.0ms/3.2us = 312 to 2.0ms/3.2us = 625
111
      // signal range is from 1.0ms/3.2us = 312 to 2.0ms/3.2us = 625
112
      if ((signal > 250) && (signal < 687)) {
112
      if ((signal > 250) && (signal < 687)) {
113
        // shift signal to zero symmetric range  -154 to 159
113
        // shift signal to zero symmetric range  -154 to 159
114
        signal -= 470; // offset of 1.4912 ms ??? (469 * 3.2us = 1.5008 ms)
114
        signal -= 475; // offset of 1.4912 ms ??? (469 * 3.2us = 1.5008 ms)
115
        // check for stable signal
115
        // check for stable signal
116
        if (abs(signal - PPM_in[index]) < 6) {
116
        if (abs(signal - PPM_in[index]) < 6) {
117
          if (RCQuality < 200)
117
          if (RCQuality < 200)
118
            RCQuality += 10;
118
            RCQuality += 10;
119
          else
119
          else
Line 129... Line 129...
129
        //  }
129
        //  }
130
        } else
130
        } else
131
          tmp = signal;
131
          tmp = signal;
132
        // calculate signal difference on good signal level
132
        // calculate signal difference on good signal level
133
        if (RCQuality >= 195)
133
        if (RCQuality >= 195)
134
          PPM_diff[index] = ((tmp - PPM_in[index]) / 3) * 3; // cut off lower 3 bit for nois reduction
134
          PPM_diff[index] = signal - PPM_in[index]; //((tmp - PPM_in[index]) / 3) * 3; // cut off lower 3 bit for nois reduction
135
        else
135
        else
136
          PPM_diff[index] = 0;
136
          PPM_diff[index] = 0;
137
        PPM_in[index] = tmp; // update channel value
137
        PPM_in[index] = tmp; // update channel value
138
      }
138
      }
139
      index++; // next channel
139
      index++; // next channel