Subversion Repositories FlightCtrl

Rev

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

Rev 1980 Rev 1986
Line 144... Line 144...
144
  controls[index] = newValue;
144
  controls[index] = newValue;
145
  tmp -= newValue;
145
  tmp -= newValue;
146
  tmp /= 2;
146
  tmp /= 2;
147
  tmp = tmp * tmp;
147
  tmp = tmp * tmp;
148
  // tmp += (newValue >= 0) ? newValue : -newValue;
148
  // tmp += (newValue >= 0) ? newValue : -newValue;
-
 
149
  /*
149
  if (controlActivity + (uint16_t)tmp >= controlActivity)
150
  if (controlActivity + (uint16_t)tmp >= controlActivity)
150
    controlActivity += tmp;
151
    controlActivity += tmp;
151
  else controlActivity = 0xffff;
152
  else controlActivity = 0xffff;
-
 
153
  */
-
 
154
  if (controlActivity + (uint16_t)tmp < 32768)
-
 
155
    controlActivity += tmp;
152
}
156
}
Line 153... Line 157...
153
 
157
 
154
#define CADAMPING 10
158
#define CADAMPING 10
155
void dampenControlActivity(void) {
159
void dampenControlActivity(void) {
Line 182... Line 186...
182
  updateControlAndMeasureControlActivity(CONTROL_PITCH, RC_PRTY[CONTROL_PITCH] + EC_PRTY[CONTROL_PITCH]);
186
  updateControlAndMeasureControlActivity(CONTROL_PITCH, RC_PRTY[CONTROL_PITCH] + EC_PRTY[CONTROL_PITCH]);
183
  updateControlAndMeasureControlActivity(CONTROL_ROLL, RC_PRTY[CONTROL_ROLL] + EC_PRTY[CONTROL_ROLL]);
187
  updateControlAndMeasureControlActivity(CONTROL_ROLL, RC_PRTY[CONTROL_ROLL] + EC_PRTY[CONTROL_ROLL]);
184
  updateControlAndMeasureControlActivity(CONTROL_YAW, RC_PRTY[CONTROL_YAW] + EC_PRTY[CONTROL_YAW]);
188
  updateControlAndMeasureControlActivity(CONTROL_YAW, RC_PRTY[CONTROL_YAW] + EC_PRTY[CONTROL_YAW]);
185
  dampenControlActivity();
189
  dampenControlActivity();
Line 186... Line 190...
186
 
190
 
Line 187... Line 191...
187
  //debugOut.analog[14] = controlActivity/10;
191
  debugOut.analog[17] = controlActivity/10;
188
 
192
 
Line 189... Line 193...
189
  tempThrottle = HC_getThrottle(RC_PRTY[CONTROL_THROTTLE] + EC_PRTY[CONTROL_THROTTLE]);
193
  tempThrottle = HC_getThrottle(RC_PRTY[CONTROL_THROTTLE] + EC_PRTY[CONTROL_THROTTLE]);