Subversion Repositories FlightCtrl

Rev

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

Rev 2676 Rev 2679
Line 63... Line 63...
63
unsigned char ActiveParamSet = 3;
63
unsigned char ActiveParamSet = 3;
64
unsigned char LipoCells = 4;
64
unsigned char LipoCells = 4;
65
unsigned char IamMaster = 0;
65
unsigned char IamMaster = 0;
66
unsigned char Delete_Stoppflag_Timer = 0;
66
unsigned char Delete_Stoppflag_Timer = 0;
67
unsigned char OEM_String[17] =  "Booting... \0\0\0\0\0";
67
unsigned char OEM_String[17] =  "Booting... \0\0\0\0\0";
68
 
-
 
-
 
68
unsigned char TouchDownTimer = 0;
Line 69... Line 69...
69
 
69
 
70
void PrintLine(void)
70
void PrintLine(void)
71
{
71
{
72
 printf("\r\n===================================");
72
 printf("\r\n===================================");
Line 710... Line 710...
710
 
710
 
711
                                // +++++++++++++++++++++++++++++++++
711
                                // +++++++++++++++++++++++++++++++++
712
                                // Sekundentakt
712
                                // Sekundentakt
713
                if(++second == 49)
713
                if(++second == 49)
-
 
714
                                 {
-
 
715
                                   static long altitudeOld = 0;
-
 
716
                                   static char threeseconds = 3;
714
                                 {
717
                                   
715
                                   second = 0;
718
                                   second = 0;
716
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
719
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
717
                                   if(ShowSettingNameTime) ShowSettingNameTime--;
720
                                   if(ShowSettingNameTime) ShowSettingNameTime--;
718
                                   if(Show_Load_Time) Show_Load_Time--;
721
                                   if(Show_Load_Time) Show_Load_Time--;
719
                                   if(Show_Store_Time) Show_Store_Time--;
722
                                   if(Show_Store_Time) Show_Store_Time--;
720
                                   if(ShowCmpsCalibrateTime) ShowCmpsCalibrateTime--;
723
                                   if(ShowCmpsCalibrateTime) ShowCmpsCalibrateTime--;
721
                                   if(Delete_Stoppflag_Timer) Delete_Stoppflag_Timer--; else FC_StatusFlags3 &= ~FC_STATUS3_MOTORS_STOPPED_BY_RC;
724
                                   if(Delete_Stoppflag_Timer) Delete_Stoppflag_Timer--; else FC_StatusFlags3 &= ~FC_STATUS3_MOTORS_STOPPED_BY_RC;
-
 
725
#endif                             
-
 
726
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
 
727
// + for auto switch - off
-
 
728
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
 
729
                                        if(--threeseconds == 0)
-
 
730
                                         {
-
 
731
                                          int AltitudeDeviationPer3Seconds = 0;
-
 
732
                                          threeseconds = 3;
-
 
733
                                          AltitudeDeviationPer3Seconds = HoehenWert - altitudeOld;
-
 
734
                                          altitudeOld = HoehenWert;
-
 
735
                                          if(abs(AltitudeDeviationPer3Seconds) > 90) TouchDownTimer = 0;
-
 
736
                                          if(!MotorenEin) TouchDownTimer = 0;
-
 
737
                                         }
-
 
738
                                        if(ACC_AltitudeControl && HoehenReglerAktiv && (SollHoehe < (HoehenWert-1100)) && !(VersionInfo.HardwareError[0] & FC_ERROR0_PRESSURE)) // 11m unter Sollwert
-
 
739
                                         {
-
 
740
                                          if(TouchDownTimer < 255) TouchDownTimer++;
-
 
741
                                         }
-
 
742
                                        else TouchDownTimer = 0;
-
 
743
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
 
744
                                if(      (NC_To_FC_Flags & NC_TO_FC_SWITCHOFF_IF_LANDED) ||             // for auto landing waypoints points 
-
 
745
                                         (NC_To_FC_Flags & NC_TO_FC_FAILSAFE_LANDING) ||                // for RC failsafe
-
 
746
                                         (LowVoltageLandingActive) ||                                                   // undervoltage
-
 
747
                                         (FC_StatusFlags2 & FC_STATUS2_AUTO_LANDING)                    // Auto landing by switch
-
 
748
                                         )
-
 
749
                     {
-
 
750
                                        if(TouchDownTimer == 6)   SpeakHoTT = SPEAK_SINKING;
-
 
751
                                        else
-
 
752
                                        if(TouchDownTimer == 9)  
-
 
753
                                         {
-
 
754
                                          SpeakHoTT = SPEAK_LANDING;
-
 
755
                                         }
-
 
756
                                        else
-
 
757
                                        if(TouchDownTimer == 16)
-
 
758
                                         {
-
 
759
                                                FC_StatusFlags3 |= FC_STATUS3_MOTORS_STOPPED_BY_RC; // that informs the slave to disarm the Motors
-
 
760
                                                Delete_Stoppflag_Timer = 2; // 1-2 seconds
-
 
761
                                                MotorenEin = 0;
-
 
762
                                                modell_fliegt = 0;
-
 
763
                                                FC_StatusFlags &= ~(FC_STATUS_EMERGENCY_LANDING | FC_STATUS_FLY);
-
 
764
                                                SpeakHoTT = SPEAK_MK_OFF;
-
 
765
                                        }
-
 
766
                                 }     
-
 
767
                                 else TouchDownTimer = 0;
-
 
768
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
722
#endif                             
769
 
723
                                   if(SerialChannelDataOkay) if(--SerialChannelDataOkay == 0) InitSerialPoti();
770
                                   if(SerialChannelDataOkay) if(--SerialChannelDataOkay == 0) InitSerialPoti();
724
                                   if(NC_To_FC_Flags & NC_TO_FC_FAILSAFE_LANDING)  ServoFailsafeActive = SERVO_FS_TIME;
771
                                   if(NC_To_FC_Flags & NC_TO_FC_FAILSAFE_LANDING)  ServoFailsafeActive = SERVO_FS_TIME;
725
                                   else
772
                                   else