Subversion Repositories FlightCtrl

Rev

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

Rev 2404 Rev 2407
Line 613... Line 613...
613
         {
613
         {
614
          I2C_TransferActive = 0; // enable for the next time
614
          I2C_TransferActive = 0; // enable for the next time
615
         }
615
         }
616
        else
616
        else
617
    {
617
    {
618
     motor_write = 0;
618
//     motor_write = 0;
619
     I2C_Start(TWI_STATE_MOTOR_TX); //Start I2C Interrupt Mode
619
     I2C_Start(TWI_STATE_MOTOR_TX); //Start I2C Interrupt Mode
620
        }
620
        }
621
}
621
}
Line 622... Line 622...
622
 
622
 
Line 1017... Line 1017...
1017
                                                        HoehenWert = 0;
1017
                                                        HoehenWert = 0;
1018
                                                        SummenHoehe = 0;
1018
                                                        SummenHoehe = 0;
1019
                                                        if((PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > -100 || abs(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]]) < 100) && EE_Parameter.MotorSafetySwitch == 0) delay_einschalten = 0;
1019
                                                        if((PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > -100 || abs(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]]) < 100) && EE_Parameter.MotorSafetySwitch == 0) delay_einschalten = 0;
1020
                                                        if(++delay_einschalten > 253)
1020
                                                        if(++delay_einschalten > 253)
1021
                                                        {
1021
                                                        {
1022
if((abs(MesswertGier) > 32 || abs(MesswertNick) > 20) || abs(MesswertRoll) > 20)  CalibrationDone = 0; // dann ist der Gyro defekt, schlecht kalibriert oder der MK dreht sich
1022
                                                                if((abs(MesswertGier) > 32 || abs(MesswertNick) > 20) || abs(MesswertRoll) > 20)  CalibrationDone = 0; // dann ist der Gyro defekt, schlecht kalibriert oder der MK dreht sich
1023
                                                                delay_einschalten = 0;
1023
                                                                delay_einschalten = 0;
1024
                                                                if(!VersionInfo.HardwareError[0] && CalibrationDone && !NC_ErrorCode)
1024
                                                                if(!VersionInfo.HardwareError[0] && CalibrationDone && !NC_ErrorCode)
1025
                                                                {
1025
                                                                {
1026
                                                                        modell_fliegt = 1;
1026
                                                                        modell_fliegt = 1;
1027
                                                                        MotorenEin = 1;
1027
                                                                        MotorenEin = 1;
Line 1251... Line 1251...
1251
   if(FC_StatusFlags2 & FC_STATUS2_RC_FAILSAVE_ACTIVE)
1251
   if(FC_StatusFlags2 & FC_STATUS2_RC_FAILSAVE_ACTIVE)
1252
   {
1252
   {
1253
    StickNick = -GPS_Nick;
1253
    StickNick = -GPS_Nick;
1254
    StickRoll = -GPS_Roll;
1254
    StickRoll = -GPS_Roll;
1255
        StickGas = StickGasHover;
1255
        StickGas = StickGasHover;
-
 
1256
    StickGier = 0;
1256
        Parameter_GlobalConfig &= ~(CFG_HEADING_HOLD | CFG_DREHRATEN_BEGRENZER);
1257
        Parameter_GlobalConfig &= ~(CFG_HEADING_HOLD | CFG_DREHRATEN_BEGRENZER);
1257
        Parameter_GlobalConfig |= CFG_HOEHENREGELUNG | CFG_ACHSENKOPPLUNG_AKTIV | CFG_KOMPASS_AKTIV | CFG_GPS_AKTIV | CFG_HOEHEN_SCHALTER | CFG_GPS_AKTIV;
1258
        Parameter_GlobalConfig |= CFG_HOEHENREGELUNG | CFG_ACHSENKOPPLUNG_AKTIV | CFG_KOMPASS_AKTIV | CFG_GPS_AKTIV | CFG_HOEHEN_SCHALTER | CFG_GPS_AKTIV;
1258
        Parameter_ExtraConfig &= ~(CFG2_HEIGHT_LIMIT | CFG_LEARNABLE_CAREFREE | CFG2_VARIO_BEEP);
1259
        Parameter_ExtraConfig &= ~(CFG2_HEIGHT_LIMIT | CFG_LEARNABLE_CAREFREE | CFG2_VARIO_BEEP);
1259
        Parameter_HoehenSchalter = 200; // switch on
1260
        Parameter_HoehenSchalter = 200; // switch on
1260
   }
1261
   }
Line 1625... Line 1626...
1625
 
1626
 
1626
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1627
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1627
// Höhenregelung
1628
// Höhenregelung
1628
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1629
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
 
1630
  GasMischanteil *= STICK_GAIN;
1629
  GasMischanteil *= STICK_GAIN;
1631
 if(BytegapSPI == 0)  SPI_TransmitByte();
1630
        // if height control is activated
1632
        // if height control is activated
1631
 if((Parameter_GlobalConfig & CFG_HOEHENREGELUNG) && !(Looping_Roll || Looping_Nick) && !(VersionInfo.HardwareError[0] & 0x7F))  // Höhenregelung
1633
 if((Parameter_GlobalConfig & CFG_HOEHENREGELUNG) && !(Looping_Roll || Looping_Nick) && !(VersionInfo.HardwareError[0] & 0x7F))  // Höhenregelung
1632
        {
1634
        {
1633
                #define HOVER_GAS_AVERAGE 16384L                // 16384 * 2ms = 32s averaging
1635
                #define HOVER_GAS_AVERAGE 16384L                // 16384 * 2ms = 32s averaging
Line 2108... Line 2110...
2108
        GasMischanteil = (MIN_GAS + 10) * STICK_GAIN;
2110
        GasMischanteil = (MIN_GAS + 10) * STICK_GAIN;
2109
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
2111
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
2110
        if(Capacity.MinOfMaxPWM < 40) SpeakHoTT = SPEAK_ERR_MOTOR;
2112
        if(Capacity.MinOfMaxPWM < 40) SpeakHoTT = SPEAK_ERR_MOTOR;
2111
#endif
2113
#endif
2112
   }
2114
   }
-
 
2115
 
-
 
2116
 if(BytegapSPI == 0)  SPI_TransmitByte();
2113
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2117
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2114
// + Mischer und PI-Regler
2118
// + Mischer und PI-Regler
2115
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2119
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2116
  DebugOut.Analog[7] = GasMischanteil;
2120
  DebugOut.Analog[7] = GasMischanteil;
2117
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2121
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++