Subversion Repositories FlightCtrl

Rev

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

Rev 1954 Rev 1966
Line 156... Line 156...
156
unsigned char Parameter_NaviWindCorrection;
156
unsigned char Parameter_NaviWindCorrection;
157
unsigned char Parameter_NaviSpeedCompensation;
157
unsigned char Parameter_NaviSpeedCompensation;
158
unsigned char Parameter_ExternalControl;
158
unsigned char Parameter_ExternalControl;
159
unsigned char Parameter_GlobalConfig;
159
unsigned char Parameter_GlobalConfig;
160
unsigned char Parameter_ExtraConfig;
160
unsigned char Parameter_ExtraConfig;
161
unsigned char Parameter_MaximumAltitude = 40;
161
unsigned char Parameter_MaximumAltitude;
162
unsigned char Parameter_Servo3,Parameter_Servo4,Parameter_Servo5;
162
unsigned char Parameter_Servo3,Parameter_Servo4,Parameter_Servo5;
163
unsigned char CareFree = 0;
163
unsigned char CareFree = 0;
164
const signed char sintab[31] = { 0, 2, 4, 6, 7, 8, 8, 8, 7, 6, 4, 2, 0, -2, -4, -6, -7, -8, -8, -8, -7, -6, -4, -2, 0, 2, 4, 6, 7, 8, 8}; // 15° steps
164
const signed char sintab[31] = { 0, 2, 4, 6, 7, 8, 8, 8, 7, 6, 4, 2, 0, -2, -4, -6, -7, -8, -8, -8, -7, -6, -4, -2, 0, 2, 4, 6, 7, 8, 8}; // 15° steps
Line 165... Line 165...
165
 
165
 
Line 213... Line 213...
213
 
213
 
214
 
214
 
215
void Piep(unsigned char Anzahl, unsigned int dauer)
215
void Piep(unsigned char Anzahl, unsigned int dauer)
-
 
216
{
216
{
217
 if(MotorenEin) return; //auf keinen Fall im Flug!
217
 if(MotorenEin) return; //auf keinen Fall im Flug!
218
GRN_OFF;
218
 while(Anzahl--)
219
 while(Anzahl--)
219
 {
220
 {
220
  beeptime = dauer;
221
  beeptime = dauer;
221
  while(beeptime);
222
  while(beeptime);
-
 
223
  Delay_ms(dauer * 2);
222
  Delay_ms(dauer * 2);
224
 }
Line 223... Line 225...
223
 }
225
GRN_ON;
224
}
226
}
225
 
227
 
Line 649... Line 651...
649
         beeptime = 15000;
651
         beeptime = 15000;
650
         BeepMuster = 0xA400;
652
         BeepMuster = 0xA400;
651
         CareFree = 0;
653
         CareFree = 0;
652
    }
654
    }
653
 if(CareFree) { FC_StatusFlags2 |= FC_STATUS2_CAREFREE; if(Parameter_AchsKopplung1 < 210) Parameter_AchsKopplung1 += 30;} else FC_StatusFlags2 &= ~FC_STATUS2_CAREFREE;
655
 if(CareFree) { FC_StatusFlags2 |= FC_STATUS2_CAREFREE; if(Parameter_AchsKopplung1 < 210) Parameter_AchsKopplung1 += 30;} else FC_StatusFlags2 &= ~FC_STATUS2_CAREFREE;
654
// Limit the maximum Altitude
-
 
655
 if(Parameter_MaximumAltitude) if(SollHoehe/100 > Parameter_MaximumAltitude) SollHoehe = (long) Parameter_MaximumAltitude * 100L;
-
 
656
}
656
}
Line 657... Line 657...
657
 
657
 
658
//############################################################################
658
//############################################################################
659
//
659
//
Line 735... Line 735...
735
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
735
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
736
                if(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] > 75)  // Neutralwerte
736
                if(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] > 75)  // Neutralwerte
737
                    {
737
                    {
738
                    if(++delay_neutral > 200)  // nicht sofort
738
                    if(++delay_neutral > 200)  // nicht sofort
739
                        {
739
                        {
740
                        GRN_OFF;
-
 
741
                        MotorenEin = 0;
740
                        MotorenEin = 0;
742
                        delay_neutral = 0;
741
                        delay_neutral = 0;
743
                        modell_fliegt = 0;
742
                        modell_fliegt = 0;
744
                        if(PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > 70 || abs(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]]) > 70)
743
                        if(PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > 70 || abs(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]]) > 70)
745
                        {
744
                        {
Line 777... Line 776...
777
                 else
776
                 else
778
                if(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] < -75)  // ACC Neutralwerte speichern
777
                if(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] < -75)  // ACC Neutralwerte speichern
779
                    {
778
                    {
780
                    if(++delay_neutral > 200)  // nicht sofort
779
                    if(++delay_neutral > 200)  // nicht sofort
781
                        {
780
                        {
782
                        GRN_OFF;
-
 
783
                        MotorenEin = 0;
781
                        MotorenEin = 0;
784
                        delay_neutral = 0;
782
                        delay_neutral = 0;
785
                        modell_fliegt = 0;
783
                        modell_fliegt = 0;
786
                        SetNeutral(1);
784
                        SetNeutral(1);
787
                        calibration_done = 1;
785
                        calibration_done = 1;
Line 1464... Line 1462...
1464
                                        {
1462
                                        {
1465
                                                FC_StatusFlags &= ~FC_STATUS_VARIO_TRIM_DOWN;
1463
                                                FC_StatusFlags &= ~FC_STATUS_VARIO_TRIM_DOWN;
1466
                                                SollHoehe = HoehenWert; // update setpoint to current heigth
1464
                                                SollHoehe = HoehenWert; // update setpoint to current heigth
1467
                                        }
1465
                                        }
1468
                                        FC_StatusFlags |= FC_STATUS_VARIO_TRIM_UP;
1466
                                        FC_StatusFlags |= FC_STATUS_VARIO_TRIM_UP;
-
 
1467
                                        // Limit the maximum Altitude
1469
                                        AltitudeSetpointTrimming = abs(StickGas - (StickGasHover + HEIGHT_CONTROL_STICKTHRESHOLD));
1468
                                        if(Parameter_MaximumAltitude && (SollHoehe/100 > Parameter_MaximumAltitude)) AltitudeSetpointTrimming = 0;
-
 
1469
                                        else
-
 
1470
                                        {
-
 
1471
//                                      SollHoehe = (long) Parameter_MaximumAltitude * 100L;
1470
//                                      HeightTrimming += abs(StickGas - (StickGasHover - HEIGHT_CONTROL_STICKTHRESHOLD));
1472
//                                      HeightTrimming += abs(StickGas - (StickGasHover - HEIGHT_CONTROL_STICKTHRESHOLD));
-
 
1473
                                        AltitudeSetpointTrimming = abs(StickGas - (StickGasHover + HEIGHT_CONTROL_STICKTHRESHOLD));
1471
                                        VarioCharacter = '+';
1474
                                        VarioCharacter = '+';
-
 
1475
                                        }
1472
                                        WaypointTrimming = 0;
1476
                                        WaypointTrimming = 0;
1473
                                } // gas stick is below hoover point
1477
                                } // gas stick is below hoover point
1474
                                else if(StickGas < (StickGasHover - HEIGHT_CONTROL_STICKTHRESHOLD) && !BaroAtLowerLimit )
1478
                                else if(StickGas < (StickGasHover - HEIGHT_CONTROL_STICKTHRESHOLD) && !BaroAtLowerLimit )
1475
                                {
1479
                                {
1476
                                        if(FC_StatusFlags & FC_STATUS_VARIO_TRIM_UP)
1480
                                        if(FC_StatusFlags & FC_STATUS_VARIO_TRIM_UP)
Line 1536... Line 1540...
1536
                                         {
1540
                                         {
1537
                                          if(abs(FromNC_AltitudeSetpoint - SollHoehe) < 10) SollHoehe = FromNC_AltitudeSetpoint;
1541
                                          if(abs(FromNC_AltitudeSetpoint - SollHoehe) < 10) SollHoehe = FromNC_AltitudeSetpoint;
1538
                                          else SollHoehe += WaypointTrimming;
1542
                                          else SollHoehe += WaypointTrimming;
1539
                                          }
1543
                                          }
1540
                                        else
1544
                                        else
1541
                                       
1545
                                          {
1542
                                        if(HeightTrimming > 0)  SollHoehe += EE_Parameter.Hoehe_Verstaerkung / 3;
1546
                                          if(HeightTrimming > 0)        SollHoehe += EE_Parameter.Hoehe_Verstaerkung / 3;
1543
                                        else                    SollHoehe -= EE_Parameter.Hoehe_Verstaerkung / 3;
1547
                                          else                    SollHoehe -= EE_Parameter.Hoehe_Verstaerkung / 3;
-
 
1548
                                          }
1544
                                        HeightTrimming = 0;
1549
                                        HeightTrimming = 0;
1545
                                        LIMIT_MIN_MAX(SollHoehe, (HoehenWert-1024), (HoehenWert+1024)); // max. 10m Unterschied
1550
                                        LIMIT_MIN_MAX(SollHoehe, (HoehenWert-1024), (HoehenWert+1024)); // max. 10m Unterschied
1546
                                        if(Parameter_ExtraConfig & CFG2_VARIO_BEEP) beeptime = 100;
1551
                                        if(Parameter_ExtraConfig & CFG2_VARIO_BEEP) beeptime = 100;
1547
                                        //update hoover gas stick value when setpoint is shifted
1552
                                        //update hoover gas stick value when setpoint is shifted
1548
                       if(!EE_Parameter.Hoehe_StickNeutralPoint && FromNC_AltitudeSpeed == 0)
1553
                       if(!EE_Parameter.Hoehe_StickNeutralPoint && FromNC_AltitudeSpeed == 0)