Subversion Repositories FlightCtrl

Rev

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

Rev 2601 Rev 2606
Line 361... Line 361...
361
         AdNeutralGier = (gier_neutral+NEUTRAL_FILTER/2) / (NEUTRAL_FILTER);
361
         AdNeutralGier = (gier_neutral+NEUTRAL_FILTER/2) / (NEUTRAL_FILTER);
362
     NeutralAccZ = (acc_z_neutral+NEUTRAL_FILTER/2) / (NEUTRAL_FILTER);
362
     NeutralAccZ = (acc_z_neutral+NEUTRAL_FILTER/2) / (NEUTRAL_FILTER);
Line 363... Line 363...
363
 
363
 
364
     StartNeutralRoll = AdNeutralRoll;
364
     StartNeutralRoll = AdNeutralRoll;
365
     StartNeutralNick = AdNeutralNick;
-
 
-
 
365
     StartNeutralNick = AdNeutralNick;
366
 
366
         VersionInfo.HardwareError[1] &= ~FC_ERROR1_ACC_NOT_CAL;
367
     if(AdjustmentMode == 2)
367
     if(AdjustmentMode == 2)
368
     {
368
     {
369
            NeutralAccX = abs(Mittelwert_AccNick) / (2*ACC_AMPLIFY);
369
            NeutralAccX = abs(Mittelwert_AccNick) / (2*ACC_AMPLIFY);
370
            NeutralAccY = abs(Mittelwert_AccRoll) / (2*ACC_AMPLIFY);
370
            NeutralAccY = abs(Mittelwert_AccRoll) / (2*ACC_AMPLIFY);
Line 380... Line 380...
380
                if(((unsigned int) NeutralAccX > 2048) || ((unsigned int) NeutralAccY > 2048)/* || ((unsigned int) NeutralAccZ > 1024)*/)
380
                if(((unsigned int) NeutralAccX > 2048) || ((unsigned int) NeutralAccY > 2048)/* || ((unsigned int) NeutralAccZ > 1024)*/)
381
                {
381
                {
382
                        printf("\n\rACC not calibrated!\r\n");
382
                        printf("\n\rACC not calibrated!\r\n");
383
                        NeutralAccX = abs(Mittelwert_AccNick) / (2*ACC_AMPLIFY);
383
                        NeutralAccX = abs(Mittelwert_AccNick) / (2*ACC_AMPLIFY);
384
                        NeutralAccY = abs(Mittelwert_AccRoll) / (2*ACC_AMPLIFY);
384
                        NeutralAccY = abs(Mittelwert_AccRoll) / (2*ACC_AMPLIFY);
-
 
385
                        VersionInfo.HardwareError[1] |= FC_ERROR1_ACC_NOT_CAL;
385
                        sucess = 0;
386
                        sucess = 0;
386
                }
387
                }
Line 387... Line 388...
387
 
388
 
388
        // restore from eeprom
389
        // restore from eeprom
Line 1182... Line 1183...
1182
 
1183
 
1183
                                                                if(!VersionInfo.HardwareError[0] && CalibrationDone && !NC_ErrorCode)
1184
                                                                if(!VersionInfo.HardwareError[0] && CalibrationDone && !NC_ErrorCode)
1184
                                                                {
1185
                                                                {
1185
                                                                        modell_fliegt = 1;
1186
                                                                        modell_fliegt = 1;
-
 
1187
                                                                        MotorenEin = 1;
1186
                                                                        MotorenEin = 1;
1188
                                                                        FC_StatusFlags3 &= ~FC_STATUS3_MOTORS_STOPPED_BY_RC;
1187
                                                                        sollGier = 0;
1189
                                                                        sollGier = 0;
1188
                                                                        Mess_Integral_Gier = 0;
1190
                                                                        Mess_Integral_Gier = 0;
1189
                                                                        Mess_Integral_Gier2 = 0;
1191
                                                                        Mess_Integral_Gier2 = 0;
1190
                                                                        Mess_IntegralNick = EE_Parameter.GyroAccFaktor * (long)Mittelwert_AccNick;
1192
                                                                        Mess_IntegralNick = EE_Parameter.GyroAccFaktor * (long)Mittelwert_AccNick;
1191
                                                                        Mess_IntegralRoll = EE_Parameter.GyroAccFaktor * (long)Mittelwert_AccRoll;
1193
                                                                        Mess_IntegralRoll = EE_Parameter.GyroAccFaktor * (long)Mittelwert_AccRoll;
1192
                                                                        SummeNick = 0;
1194
                                                                        SummeNick = 0;
1193
                                                                        SummeRoll = 0;
1195
                                                                        SummeRoll = 0;
1194
//                                                                      ControlHeading = (((int) EE_Parameter.OrientationAngle * 15 + KompassValue) % 360) / 2;
1196
//                                                                      ControlHeading = (((int) EE_Parameter.OrientationAngle * 15 + KompassValue) % 360) / 2;
-
 
1197
                                                                        NeueKompassRichtungMerken = 100; // 2 sekunden
-
 
1198
                                                                    NC_CompassSetpoint = -1;
1195
                                                                        NeueKompassRichtungMerken = 100; // 2 sekunden
1199
                                                                        NCForcesNewDirection = 0; // allows Yawing without CareFree (Yawing at Coming Home)
1196
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
1200
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
1197
                                                                        SpeakHoTT = SPEAK_STARTING;
1201
                                                                        SpeakHoTT = SPEAK_STARTING;
1198
#endif
1202
#endif
1199
                                                                }
1203
                                                                }
Line 1228... Line 1232...
1228
                                                          StickNick = 0;
1232
                                                          StickNick = 0;
1229
                                                          StickRoll = 0;
1233
                                                          StickRoll = 0;
1230
                                                        }
1234
                                                        }
1231
                                                        if(++delay_ausschalten > 250)  // nicht sofort
1235
                                                        if(++delay_ausschalten > 250)  // nicht sofort
1232
                                                        {
1236
                                                        {
-
 
1237
                                                                if(MotorenEin) FC_StatusFlags3 |= FC_STATUS3_MOTORS_STOPPED_BY_RC; // that informs the slave to disarm the Motors
1233
                                                                MotorenEin = 0;
1238
                                                                MotorenEin = 0;
1234
                                                                delay_ausschalten = 0;
1239
                                                                delay_ausschalten = 0;
1235
                                                                modell_fliegt = 0;
1240
                                                                modell_fliegt = 0;
1236
                                                                FC_StatusFlags2 &= ~(FC_STATUS2_WAIT_FOR_TAKEOFF | FC_STATUS2_AUTO_STARTING | FC_STATUS2_AUTO_LANDING);
1241
                                                                FC_StatusFlags2 &= ~(FC_STATUS2_WAIT_FOR_TAKEOFF | FC_STATUS2_AUTO_STARTING | FC_STATUS2_AUTO_LANDING);
1237
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
1242
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))