Subversion Repositories FlightCtrl

Rev

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

Rev 1927 Rev 2025
Line 59... Line 59...
59
/*  Neutral Readings                                                    */
59
/*  Neutral Readings                                                    */
60
/************************************************************************/
60
/************************************************************************/
61
#define CONTROL_CONFIG_SCALE 10
61
#define CONTROL_CONFIG_SCALE 10
Line 62... Line 62...
62
 
62
 
63
void flight_setNeutral() {
-
 
64
  MKFlags |= MKFLAG_CALIBRATE;
63
void flight_setNeutral() {
65
  // not really used here any more.
64
  // not really used here any more.
66
  controlMixer_initVariables();
65
  controlMixer_initVariables();
Line 67... Line 66...
67
}
66
}
Line 157... Line 156...
157
  /* Stick signals are positive and gyros are negative...                 */
156
  /* Stick signals are positive and gyros are negative...                 */
158
  /************************************************************************/
157
  /************************************************************************/
159
  IPart[PITCH] = error[PITCH]; // * some factor configurable.
158
  IPart[PITCH] = error[PITCH]; // * some factor configurable.
160
  IPart[ROLL] = error[ROLL];
159
  IPart[ROLL] = error[ROLL];
161
    // TODO: Add ipart. Or add/subtract depending, not sure.
160
    // TODO: Add ipart. Or add/subtract depending, not sure.
162
  term[PITCH] = control[CONTROL_ELEVATOR] + (staticParams.ControlSigns & 1 ? PDPart[PITCH] : -PDPart[PITCH]);
161
  term[PITCH] = control[CONTROL_ELEVATOR] + (staticParams.servoDirections & SERVO_DIRECTION_ELEVATOR ? PDPart[PITCH] : -PDPart[PITCH]);
163
  term[ROLL] = control[CONTROL_AILERONS] + (staticParams.ControlSigns & 2 ? PDPart[ROLL] : -PDPart[ROLL]);
162
  term[ROLL] = control[CONTROL_AILERONS] + (staticParams.servoDirections & SERVO_DIRECTION_AILERONS ? PDPart[ROLL] : -PDPart[ROLL]);
164
  yawTerm = control[CONTROL_RUDDER] + (staticParams.ControlSigns & 4 ? PDPartYaw : -PDPartYaw);
163
  yawTerm = control[CONTROL_RUDDER] + (staticParams.servoDirections & SERVO_DIRECTION_RUDDER ? PDPartYaw : -PDPartYaw);
Line 165... Line 164...
165
 
164
 
166
  // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
165
  // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
167
  // Universal Mixer
166
  // Universal Mixer
168
  // Each (pitch, roll, throttle, yaw) term is in the range [0..255 * CONTROL_SCALING].
167
  // Each (pitch, roll, throttle, yaw) term is in the range [0..255 * CONTROL_SCALING].