void LoadDefaults() {
  uint8_t i;
  // PID CONTROLLER 1
	conf.pid[ROLL].P8     = 06;  conf.pid[ROLL].I8    = 05; conf.pid[ROLL].D8     = 04;
	conf.pid[PITCH].P8    = 06; conf.pid[PITCH].I8    = 05; conf.pid[PITCH].D8    = 04;
	conf.pid[PIDLEVEL].P8 = 02; conf.pid[PIDLEVEL].I8 = 02; conf.pid[PIDLEVEL].D8 = 02;

    conf.pid[YAW].P8      = 10;  conf.pid[YAW].I8     = 05;  conf.pid[YAW].D8     = 0;
    conf.pid[PIDALT].P8   = 64; conf.pid[PIDALT].I8   = 25; conf.pid[PIDALT].D8   = 24;

    conf.pid[PIDPOS].P8  = POSHOLD_P * 100;     conf.pid[PIDPOS].I8    = POSHOLD_I * 100;       conf.pid[PIDPOS].D8    = 0;
    conf.pid[PIDPOSR].P8 = POSHOLD_RATE_P * 10; conf.pid[PIDPOSR].I8   = POSHOLD_RATE_I * 100;  conf.pid[PIDPOSR].D8   = POSHOLD_RATE_D * 1000;
    conf.pid[PIDNAVR].P8 = NAV_P * 10;          conf.pid[PIDNAVR].I8   = NAV_I * 100;           conf.pid[PIDNAVR].D8   = NAV_D * 1000;
  
    conf.pid[PIDMAG].P8   = 40;

    conf.pid[PIDVEL].P8 = 0;      conf.pid[PIDVEL].I8 = 0;    conf.pid[PIDVEL].D8 = 0;

    conf.rcRate8 = 80; conf.rcExpo8 = 50;
	conf.rollPitchRate = 40;
	conf.yawRate = 40;
	conf.dynThrPID = 0;
	conf.thrMid8 = 50; conf.thrExpo8 = 0;
	for(i=0;i<CHECKBOXITEMS;i++) {conf.activate[i] = 0;}
	conf.angleTrim[0] = 0; conf.angleTrim[1] = 0;
	conf.powerTrigger1 = 0;

  update_constants(); // this will also write to eeprom
}
Beispiel #2
0
void LoadDefaults() {
  uint8_t i;
  #ifdef SUPPRESS_DEFAULTS_FROM_GUI
    // do nothing
  #elif defined(MY_PRIVATE_DEFAULTS)
    // #include MY_PRIVATE_DEFAULTS
    // do that at the last possible moment, so we can override virtually all defaults and constants
  #else
    #if PID_CONTROLLER == 1
      conf.pid[ROLL].P8     = 33;  conf.pid[ROLL].I8    = 30; conf.pid[ROLL].D8     = 23;
      conf.pid[PITCH].P8    = 33; conf.pid[PITCH].I8    = 30; conf.pid[PITCH].D8    = 23;
      conf.pid[PIDLEVEL].P8 = 90; conf.pid[PIDLEVEL].I8 = 10; conf.pid[PIDLEVEL].D8 = 100;
    #elif PID_CONTROLLER == 2
      conf.pid[ROLL].P8     = 28;  conf.pid[ROLL].I8    = 10; conf.pid[ROLL].D8     = 7;
      conf.pid[PITCH].P8    = 28; conf.pid[PITCH].I8    = 10; conf.pid[PITCH].D8    = 7;
      conf.pid[PIDLEVEL].P8 = 30; conf.pid[PIDLEVEL].I8 = 32; conf.pid[PIDLEVEL].D8 = 0;
    #endif
    conf.pid[YAW].P8      = 68;  conf.pid[YAW].I8     = 45;  conf.pid[YAW].D8     = 0;
    conf.pid[PIDALT].P8   = 64; conf.pid[PIDALT].I8   = 25; conf.pid[PIDALT].D8   = 24;

    conf.pid[PIDPOS].P8  = POSHOLD_P * 100;     conf.pid[PIDPOS].I8    = POSHOLD_I * 100;       conf.pid[PIDPOS].D8    = 0;
    conf.pid[PIDPOSR].P8 = POSHOLD_RATE_P * 10; conf.pid[PIDPOSR].I8   = POSHOLD_RATE_I * 100;  conf.pid[PIDPOSR].D8   = POSHOLD_RATE_D * 1000;
    conf.pid[PIDNAVR].P8 = NAV_P * 10;          conf.pid[PIDNAVR].I8   = NAV_I * 100;           conf.pid[PIDNAVR].D8   = NAV_D * 1000;
  
    conf.pid[PIDMAG].P8   = 40;

    //conf.pid[PIDVEL].P8 = 0;      conf.pid[PIDVEL].I8 = 0;    conf.pid[PIDVEL].D8 = 0;
    conf.pid[PIDVEL].P8 = 32;      conf.pid[PIDVEL].I8 = 20;    conf.pid[PIDVEL].D8 = 0;  //for optflow max P=5, I = 0,020, D is unused

    conf.rcRate8 = 90; conf.rcExpo8 = 65;
    conf.rollPitchRate = 0;
    conf.yawRate = 0;
    conf.dynThrPID = 0;
    conf.thrMid8 = 50; conf.thrExpo8 = 0;
    for(i=0;i<CHECKBOXITEMS;i++) {conf.activate[i] = 0;}
    conf.angleTrim[0] = 0; conf.angleTrim[1] = 0;
    conf.powerTrigger1 = 0;
  #endif // SUPPRESS_DEFAULTS_FROM_GUI
  #if defined(SERVO)
    static int8_t sr[8] = SERVO_RATES;
    #ifdef SERVO_MIN
      static int16_t smin[8] = SERVO_MIN;
      static int16_t smax[8] = SERVO_MAX;
      static int16_t smid[8] = SERVO_MID;
    #endif
    for(i=0;i<8;i++) {
      #ifdef SERVO_MIN
        conf.servoConf[i].min = smin[i];
        conf.servoConf[i].max = smax[i];
        conf.servoConf[i].middle = smid[i];
      #else
        conf.servoConf[i].min = 1020;
        conf.servoConf[i].max = 2000;
        conf.servoConf[i].middle = 1500;
      #endif
      conf.servoConf[i].rate = sr[i];
    }
  #else                   //if no servo defined then zero out the config variables to prevent passing false data to the gui.
//    for(i=0;i<8;i++) {
//        conf.servoConf[i].min = 0;
//        conf.servoConf[i].max = 0;
//        conf.servoConf[i].middle = 0;
//        conf.servoConf[i].rate = 0;
//      }
  #endif
  #ifdef FIXEDWING
    conf.dynThrPID = 50;
    conf.rcExpo8   =  0;
  #endif
  update_constants(); // this will also write to eeprom
}
Beispiel #3
0
void LoadDefaults() {
  uint8_t i;
  #ifdef SUPPRESS_DEFAULTS_FROM_GUI
    // do nothing
  #elif defined(MY_PRIVATE_DEFAULTS)
    // #include MY_PRIVATE_DEFAULTS
    // do that at the last possible moment, so we can override virtually all defaults and constants
  #else
	conf.pidset[0][PID_ROLL].P8     = 33;  conf.pidset[0][PID_ROLL].I8    = 30; conf.pidset[0][PID_ROLL].D8     = 23;
	conf.pidset[0][PID_PITCH].P8    = 33; conf.pidset[0][PID_PITCH].I8    = 30; conf.pidset[0][PID_PITCH].D8    = 23;
	conf.pidset[0][PID_LEVEL].P8 = 90; conf.pidset[0][PID_LEVEL].I8 = 10; conf.pidset[0][PID_LEVEL].D8 = 100;

    conf.pidset[1][PID_ROLL].P8  = 40; conf.pidset[1][PID_ROLL].I8  = 26; conf.pidset[1][PID_ROLL].D8  = 15;
    conf.pidset[1][PID_PITCH].P8 = 40; conf.pidset[1][PID_PITCH].I8 = 26; conf.pidset[1][PID_PITCH].D8 = 15;
    conf.pidset[1][PID_LEVEL].P8 = 50; conf.pidset[1][PID_LEVEL].I8 = 50; conf.pidset[1][PID_LEVEL].D8 = 0;

    // load oldskool values
    conf.pid[PIDROLL].P8  = conf.pidset[0][PID_ROLL].P8;  conf.pid[PIDROLL].I8  = conf.pidset[0][PID_ROLL].I8;  conf.pid[PIDROLL].D8  = conf.pidset[0][PID_ROLL].D8; 
    conf.pid[PIDPITCH].P8 = conf.pidset[0][PID_PITCH].P8; conf.pid[PIDPITCH].I8 = conf.pidset[0][PID_PITCH].I8; conf.pid[PIDPITCH].D8 = conf.pidset[0][PID_PITCH].D8;
    conf.pid[PIDLEVEL].P8 = conf.pidset[0][PID_LEVEL].P8; conf.pid[PIDLEVEL].I8 = conf.pidset[0][PID_LEVEL].I8; conf.pid[PIDLEVEL].D8 = conf.pidset[0][PID_LEVEL].D8;
    
    // common
    conf.pid[PIDYAW].P8   = 68; conf.pid[PIDYAW].I8   = 45; conf.pid[PIDYAW].D8   = 0;
    conf.pid[PIDALT].P8   = 64; conf.pid[PIDALT].I8   = 25; conf.pid[PIDALT].D8   = 24;

    conf.pid[PIDPOS].P8  = POSHOLD_P * 100;     conf.pid[PIDPOS].I8    = POSHOLD_I * 100;       conf.pid[PIDPOS].D8    = 0;
    conf.pid[PIDPOSR].P8 = POSHOLD_RATE_P * 10; conf.pid[PIDPOSR].I8   = POSHOLD_RATE_I * 100;  conf.pid[PIDPOSR].D8   = POSHOLD_RATE_D * 1000;
    conf.pid[PIDNAVR].P8 = NAV_P * 10;          conf.pid[PIDNAVR].I8   = NAV_I * 100;           conf.pid[PIDNAVR].D8   = NAV_D * 1000;
  
    conf.pid[PIDMAG].P8   = 40;

    conf.pid[PIDVEL].P8 = 0;      conf.pid[PIDVEL].I8 = 0;    conf.pid[PIDVEL].D8 = 0;

    conf.rcRate8 = 100; conf.rcExpo8 = 35;
    conf.rollPitchRate = 50;
    conf.yawRate = 40;
    conf.dynThrPID = 0;
    conf.thrMid8 = 50; conf.thrExpo8 = 20;
    for(i=0;i<CHECKBOXITEMS;i++) {conf.activate[i] = 0;}
    conf.angleTrim[0] = 0; conf.angleTrim[1] = 0;
    conf.powerTrigger1 = 0;
  #endif // SUPPRESS_DEFAULTS_FROM_GUI
  #if defined(SERVO)
    static int8_t sr[8] = SERVO_RATES;
    #ifdef SERVO_MIN
      static int16_t smin[8] = SERVO_MIN;
      static int16_t smax[8] = SERVO_MAX;
      static int16_t smid[8] = SERVO_MID;
    #endif
    for(i=0;i<8;i++) {
      #ifdef SERVO_MIN
        conf.servoConf[i].min = smin[i];
        conf.servoConf[i].max = smax[i];
        conf.servoConf[i].middle = smid[i];
      #else
        conf.servoConf[i].min = 1020;
        conf.servoConf[i].max = 2000;
        conf.servoConf[i].middle = 1500;
      #endif
      conf.servoConf[i].rate = sr[i];
    }
  #endif
  #ifdef FIXEDWING
    conf.dynThrPID = 50;
    conf.rcExpo8   =  0;
  #endif
  update_constants(); // this will also write to eeprom
}