Subversion Repositories FlightCtrl

Rev

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

Rev 1435 Rev 1479
Line 155... Line 155...
155
int MaxStickNick = 0,MaxStickRoll = 0;
155
int MaxStickNick = 0,MaxStickRoll = 0;
156
unsigned int  modell_fliegt = 0;
156
unsigned int  modell_fliegt = 0;
157
volatile unsigned char FCFlags = 0;
157
volatile unsigned char FCFlags = 0;
158
long GIER_GRAD_FAKTOR = 1291;
158
long GIER_GRAD_FAKTOR = 1291;
159
signed int KopplungsteilNickRoll,KopplungsteilRollNick;
159
signed int KopplungsteilNickRoll,KopplungsteilRollNick;
160
unsigned char RequiredMotors = 4;
-
 
161
unsigned char Motor[MAX_MOTORS];
-
 
162
signed int tmp_motorwert[MAX_MOTORS];
160
signed int tmp_motorwert[MAX_MOTORS];
163
unsigned char LoadHandler = 0;
161
unsigned char LoadHandler = 0;
164
#define LIMIT_MIN(value, min) {if(value <= min) value = min;}
162
#define LIMIT_MIN(value, min) {if(value <= min) value = min;}
165
#define LIMIT_MAX(value, max) {if(value >= max) value = max;}
163
#define LIMIT_MAX(value, max) {if(value >= max) value = max;}
166
#define LIMIT_MIN_MAX(value, min, max) {if(value <= min) value = min; else if(value >= max) value = max;}
164
#define LIMIT_MIN_MAX(value, min, max) {if(value <= min) value = min; else if(value >= max) value = max;}
Line 479... Line 477...
479
        {
477
        {
480
         FCFlags &= ~(FCFLAG_MOTOR_RUN | FCFLAG_FLY);
478
         FCFlags &= ~(FCFLAG_MOTOR_RUN | FCFLAG_FLY);
481
                 for(i=0;i<MAX_MOTORS;i++)
479
                 for(i=0;i<MAX_MOTORS;i++)
482
                  {
480
                  {
483
                   if(!PC_MotortestActive)  MotorTest[i] = 0;
481
                   if(!PC_MotortestActive)  MotorTest[i] = 0;
484
                   Motor[i] = MotorTest[i];
482
                   Motor[i].SetPoint = MotorTest[i];
485
                  }
483
                  }
486
          if(PC_MotortestActive) PC_MotortestActive--;
484
          if(PC_MotortestActive) PC_MotortestActive--;
487
        }
485
        }
488
        else FCFlags |= FCFLAG_MOTOR_RUN;
486
        else FCFlags |= FCFLAG_MOTOR_RUN;
Line 489... Line 487...
489
 
487
 
490
    DebugOut.Analog[12] = Motor[0];
488
    DebugOut.Analog[12] = Motor[0].SetPoint;
491
    DebugOut.Analog[13] = Motor[1];
489
    DebugOut.Analog[13] = Motor[1].SetPoint;
492
    DebugOut.Analog[14] = Motor[3];
490
    DebugOut.Analog[14] = Motor[3].SetPoint;
Line 493... Line 491...
493
    DebugOut.Analog[15] = Motor[2];
491
    DebugOut.Analog[15] = Motor[2].SetPoint;
494
 
492
 
495
    //Start I2C Interrupt Mode
493
    //Start I2C Interrupt Mode
496
    twi_state = 0;
494
    twi_state = 0;
Line 1601... Line 1599...
1601
    tmp_int += ((long)pd_ergebnis_roll * Mixer.Motor[i][2]) / 64L;
1599
    tmp_int += ((long)pd_ergebnis_roll * Mixer.Motor[i][2]) / 64L;
1602
    tmp_int += ((long)GierMischanteil * Mixer.Motor[i][3]) / 64L;
1600
    tmp_int += ((long)GierMischanteil * Mixer.Motor[i][3]) / 64L;
1603
    tmp_motorwert[i] = MotorSmoothing(tmp_int,tmp_motorwert[i]);  // Filter
1601
    tmp_motorwert[i] = MotorSmoothing(tmp_int,tmp_motorwert[i]);  // Filter
1604
        tmp_int = tmp_motorwert[i] / STICK_GAIN;
1602
        tmp_int = tmp_motorwert[i] / STICK_GAIN;
1605
        CHECK_MIN_MAX(tmp_int,MIN_GAS,MAX_GAS);
1603
        CHECK_MIN_MAX(tmp_int,MIN_GAS,MAX_GAS);
1606
    Motor[i] = tmp_int;
1604
    Motor[i].SetPoint = tmp_int;
1607
   }
1605
   }
1608
   else Motor[i] = 0;
1606
   else Motor[i].SetPoint = 0;
1609
 }
1607
 }
1610
/*
-
 
1611
if(Poti1 > 20)  Motor1 = 0;
-
 
1612
if(Poti1 > 90)  Motor6 = 0;
-
 
1613
if(Poti1 > 140) Motor2 = 0;
-
 
1614
//if(Poti1 > 200) Motor7 = 0;
-
 
1615
*/
-
 
1616
}
1608
}