Subversion Repositories FlightCtrl

Rev

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

Rev 973 Rev 983
Line 53... Line 53...
53
unsigned char Motor_Vorne,Motor_Hinten,Motor_Rechts,Motor_Links, Count;
53
unsigned char Motor_Vorne,Motor_Hinten,Motor_Rechts,Motor_Links, Count;
54
unsigned char MotorWert[5];
54
unsigned char MotorWert[5];
55
unsigned char SenderOkay = 0;
55
unsigned char SenderOkay = 0;
56
unsigned int I2CTimeout = 100;
56
unsigned int I2CTimeout = 100;
57
char MotorenEin = 0;
57
char MotorenEin = 0;
-
 
58
unsigned int  modell_fliegt = 0;
Line 58... Line 59...
58
 
59
 
59
extern unsigned long maxDistance;
60
extern unsigned long maxDistance;
60
extern signed int GPS_Nick,  GPS_Roll;
61
extern signed int GPS_Nick,  GPS_Roll;
Line 73... Line 74...
73
  @post             -
74
  @post             -
74
  @author         Michael Walter  
75
  @author         Michael Walter  
75
**************************************************************************** */
76
**************************************************************************** */
76
void SetNeutral(void)
77
void SetNeutral(void)
77
{
78
{
-
 
79
  beeptime = 2000;
78
  Delay_ms(1000);
80
  Delay_ms(1000);
79
  if((EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG))  // Höhenregelung aktiviert?
81
  if((EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG))  // Höhenregelung aktiviert?
80
  {    
82
  {    
81
    if((AdWertAirPressure_Raw > 950) || (AdWertAirPressure_Raw < 750))
83
    if((AdWertAirPressure_Raw > 950) || (AdWertAirPressure_Raw < 750))
82
    {
84
    {
Line 165... Line 167...
165
  {
167
  {
166
    DeltaAltitude = CurrentAltitude - LastAltitude;
168
    DeltaAltitude = CurrentAltitude - LastAltitude;
167
    LastAltitude = CurrentAltitude;
169
    LastAltitude = CurrentAltitude;
168
  }
170
  }
169
  AirPressureCnt++;
171
  AirPressureCnt++;
170
 
172
 
-
 
173
  if(modell_fliegt < 0x250)
-
 
174
  {
171
  //if ((GPS_Roll == 0 && GPS_Nick == 0) || (maxDistance / 10 > 10))
175
    //if ((GPS_Roll == 0 && GPS_Nick == 0) || (maxDistance / 10 > 10))
-
 
176
    AdNeutralNick = 0.998F * AdNeutralNick + 0.002F * AdWertNick_Raw;
-
 
177
    AdNeutralRoll = 0.998F * AdNeutralRoll + 0.002F * AdWertRoll_Raw;
-
 
178
    if (abs(StickGier) < 15 || MotorenEin == 0)
-
 
179
    {
-
 
180
      AdNeutralGier = 0.998F * AdNeutralGier + 0.002F * AdWertGier_Raw;
-
 
181
    }
-
 
182
  }
-
 
183
  else if(modell_fliegt < 0x2000)
172
  {
184
  {
-
 
185
    //if ((GPS_Roll == 0 && GPS_Nick == 0) || (maxDistance / 10 > 10))
173
    AdNeutralNick = 0.999F * AdNeutralNick + 0.001F * AdWertNick_Raw;
186
    AdNeutralNick = 0.999F * AdNeutralNick + 0.001F * AdWertNick_Raw;
174
    AdNeutralRoll = 0.999F * AdNeutralRoll + 0.001F * AdWertRoll_Raw;
187
    AdNeutralRoll = 0.999F * AdNeutralRoll + 0.001F * AdWertRoll_Raw;
175
    if (abs(StickGier) < 15 || MotorenEin == 0)
188
    if (abs(StickGier) < 15 || MotorenEin == 0)
176
    {
189
    {
177
       AdNeutralGier = 0.999F * AdNeutralGier + 0.001F * AdWertGier_Raw;
190
      AdNeutralGier = 0.999F * AdNeutralGier + 0.001F * AdWertGier_Raw;
-
 
191
    }
-
 
192
  }
-
 
193
  else
-
 
194
  {
-
 
195
    AdNeutralNick = 0.9995F * AdNeutralNick + 0.0005F * AdWertNick_Raw;
-
 
196
    AdNeutralRoll = 0.9995F * AdNeutralRoll + 0.0005F * AdWertRoll_Raw;
-
 
197
    if (abs(StickGier) < 15 || MotorenEin == 0)
-
 
198
    {
-
 
199
      AdNeutralGier = 0.9995F * AdNeutralGier + 0.0005F * AdWertGier_Raw;
178
    }
200
    }
179
  }
201
  }
Line 180... Line 202...
180
 
202
 
181
#if 1
203
#if 1
Line 185... Line 207...
185
 
207
 
186
  DebugOut.Analog[9] = AdNeutralNick;
208
  DebugOut.Analog[9] = AdNeutralNick;
187
  DebugOut.Analog[10] = AdNeutralRoll;
209
  DebugOut.Analog[10] = AdNeutralRoll;
188
  DebugOut.Analog[11] = AdNeutralGier;
210
  DebugOut.Analog[11] = AdNeutralGier;
189
#endif
211
#endif
190
 
212
 
191
  AccumulatedRoll = 0;
213
  AccumulatedRoll = 0;
192
  AccumulatedRoll_cnt = 0;
214
  AccumulatedRoll_cnt = 0;
193
  AccumulatedNick = 0;
215
  AccumulatedNick = 0;
194
  AccumulatedNick_cnt = 0;
216
  AccumulatedNick_cnt = 0;
Line 256... Line 278...
256
**************************************************************************** */
278
**************************************************************************** */
257
void RemoteControl(void)
279
void RemoteControl(void)
258
{
280
{
259
  static unsigned char delay_neutral = 0;
281
  static unsigned char delay_neutral = 0;
260
  static unsigned char delay_einschalten = 0,delay_ausschalten = 0;
282
  static unsigned char delay_einschalten = 0,delay_ausschalten = 0;
261
  static unsigned int  modell_fliegt = 0;
-
 
Line 262... Line 283...
262
 
283
 
263
  // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
284
  // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
264
  // Gaswert ermitteln
285
  // Gaswert ermitteln
265
  // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
286
  // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++