Subversion Repositories FlightCtrl

Rev

Rev 2141 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2141 Rev 2142
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, weget 350 channel values/sec.
106
                // With 7 channels and 50 frames/sec, we get 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 136... Line 136...
136
        }
136
        }
Line 137... Line 137...
137
 
137
 
Line 138... Line 138...
138
        int16_t channel = RCChannel(CH_THROTTLE);
138
        int16_t channel = RCChannel(CH_THROTTLE);
-
 
139
 
139
 
140
        if (channel <= -TIME(0.55)) {
140
        if (channel <= -TIME(0.55)) {
141
          debugOut.analog[17] = 1;
141
          int16_t aux = RCChannel(COMMAND_CHANNEL_HORIZONTAL);
142
          int16_t aux = RCChannel(COMMAND_CHANNEL_HORIZONTAL);
142
          if (abs(aux) >= TIME(0.3)) // If we pull on the stick, it is gyrocal. Else it is RC cal.
143
          if (abs(aux) >= TIME(0.3)) // If we pull on the stick, it is gyrocal. Else it is RC cal.
143
                lastRCCommand = COMMAND_GYROCAL;
144
                lastRCCommand = COMMAND_GYROCAL;
144
          else
145
          else
-
 
146
                lastRCCommand = COMMAND_RCCAL;
145
                lastRCCommand = COMMAND_RCCAL;
147
        } else {
146
        } else {
148
          debugOut.analog[17] = 0;
147
          lastRCCommand = COMMAND_NONE;
149
          lastRCCommand = COMMAND_NONE;
148
        }
150
        }
Line 202... Line 204...
202
  rcTrim.trim[CH_RUDDER]   = RCChannel(CH_RUDDER);
204
  rcTrim.trim[CH_RUDDER]   = RCChannel(CH_RUDDER);
203
  rcTrim.trim[CH_THROTTLE] = 0;
205
  rcTrim.trim[CH_THROTTLE] = 0;
204
}
206
}
Line 205... Line 207...
205
 
207
 
206
int16_t RC_getZeroThrottle(void) {
208
int16_t RC_getZeroThrottle(void) {
207
        return TIME (0.95f);
209
        return TIME (1.0f);
Line 208... Line 210...
208
}
210
}
209
 
211
 
210
void RC_setZeroTrim(void) {
212
void RC_setZeroTrim(void) {