Subversion Repositories FlightCtrl

Rev

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

Rev 2136 Rev 2141
Line 101... Line 101...
101
        if (signal != 0) {
101
        if (signal != 0) {
102
          RC_buffer[channel] = 0; // reset to flag value already used.
102
          RC_buffer[channel] = 0; // reset to flag value already used.
103
      if ((signal >= TIME(0.8)) && (signal < TIME(2.2))) {
103
      if ((signal >= TIME(0.8)) && (signal < TIME(2.2))) {
104
        signal -= (TIME(1.5) - 128 + channelMap.HWTrim);
104
        signal -= (TIME(1.5) - 128 + channelMap.HWTrim);
105
        if (abs(signal - PPM_in[channel]) < TIME(0.05)) {
105
        if (abs(signal - PPM_in[channel]) < TIME(0.05)) {
106
                // With 7 channels and 50 frames/sec, we get 350 channel values/sec.
106
                // With 7 channels and 50 frames/sec, weget 350 channel values/sec.
107
          if (RCQuality < 200)
107
          if (RCQuality < 200)
108
            RCQuality += 2;
108
            RCQuality += 2;
109
        }
109
        }
110
        PPM_in[channel] = signal;
110
        PPM_in[channel] = signal;
111
      }
111
      }
Line 175... Line 175...
175
 */
175
 */
176
int16_t RC_getVariable(uint8_t varNum) {
176
int16_t RC_getVariable(uint8_t varNum) {
177
  if (varNum < 4) {
177
  if (varNum < 4) {
178
    // 0th variable is 5th channel (1-based) etc.
178
    // 0th variable is 5th channel (1-based) etc.
179
    int16_t result = (RCChannel(varNum + CH_POTS) / 6) + channelMap.variableOffset;
179
    int16_t result = (RCChannel(varNum + CH_POTS) / 6) + channelMap.variableOffset;
180
    if (varNum<2) debugOut.analog[18+varNum] = result;
-
 
181
    return result;
180
    return result;
182
  }
181
  }
183
  /*
182
  /*
184
   * Let's just say:
183
   * Let's just say:
185
   * The RC variable i is hardwired to channel i, i>=4
184
   * The RC variable i is hardwired to channel i, i>=4
186
   */
185
   */
187
  return (PPM_in[varNum] >> 3) + channelMap.variableOffset;
186
  return (PPM_in[varNum] / 6) + channelMap.variableOffset;
188
}
187
}
Line 189... Line 188...
189
 
188
 
190
uint8_t RC_getSignalQuality(void) {
189
uint8_t RC_getSignalQuality(void) {
191
  if (RCQuality >= 160)
190
  if (RCQuality >= 160)
Line 203... Line 202...
203
  rcTrim.trim[CH_RUDDER]   = RCChannel(CH_RUDDER);
202
  rcTrim.trim[CH_RUDDER]   = RCChannel(CH_RUDDER);
204
  rcTrim.trim[CH_THROTTLE] = 0;
203
  rcTrim.trim[CH_THROTTLE] = 0;
205
}
204
}
Line 206... Line 205...
206
 
205
 
207
int16_t RC_getZeroThrottle(void) {
206
int16_t RC_getZeroThrottle(void) {
208
        return TIME (1.0f);
207
        return TIME (0.95f);
Line 209... Line 208...
209
}
208
}
210
 
209
 
211
void RC_setZeroTrim(void) {
210
void RC_setZeroTrim(void) {