Subversion Repositories FlightCtrl

Rev

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

Rev 1100 Rev 1171
Line 36... Line 36...
36
unsigned char ConfirmFrame;
36
unsigned char ConfirmFrame;
37
struct str_DebugOut    DebugOut;
37
struct str_DebugOut    DebugOut;
38
struct str_ExternControl  ExternControl;
38
struct str_ExternControl  ExternControl;
39
struct str_VersionInfo VersionInfo;
39
struct str_VersionInfo VersionInfo;
40
struct str_WinkelOut WinkelOut;
40
struct str_WinkelOut WinkelOut;
-
 
41
struct str_Data3D Data3D;
Line 41... Line 42...
41
 
42
 
42
int Debug_Timer,Kompass_Timer;
43
int Debug_Timer,Kompass_Timer,Timer3D;
Line 43... Line 44...
43
unsigned int DebugDataIntervall = 200;
44
unsigned int DebugDataIntervall = 200, Intervall3D = 0;
44
 
45
 
45
const unsigned char ANALOG_TEXT[32][16] =
46
const unsigned char ANALOG_TEXT[32][16] =
46
{
47
{
Line 362... Line 363...
362
                        // 'K' comand placed here only for compatibility to old MK3MAG software, that does not send the right Slave Address
363
                        // 'K' comand placed here only for compatibility to old MK3MAG software, that does not send the right Slave Address
363
                        case 'K':// Kompasswert
364
                        case 'K':// Kompasswert
364
                                        memcpy((unsigned char *)&KompassValue , (unsigned char *)pRxData, sizeof(KompassValue));
365
                                        memcpy((unsigned char *)&KompassValue , (unsigned char *)pRxData, sizeof(KompassValue));
365
                                        KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360) - 180;
366
                                        KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360) - 180;
366
                                        break;
367
                                        break;
367
 
-
 
368
                        case 'a':// Texte der Analogwerte
368
                        case 'a':// Texte der Analogwerte
369
                                        DebugTextAnforderung = pRxData[0];
369
                                        DebugTextAnforderung = pRxData[0];
370
                                        if (DebugTextAnforderung > 31) DebugTextAnforderung = 31;
370
                                        if (DebugTextAnforderung > 31) DebugTextAnforderung = 31;
371
                                        PcZugriff = 255;
371
                                        PcZugriff = 255;
372
                                        break;
372
                                        break;
373
 
-
 
374
                        case 'b':
373
                        case 'b':
375
                                        memcpy((unsigned char *)&ExternControl, (unsigned char *)pRxData, sizeof(ExternControl));
374
                                        memcpy((unsigned char *)&ExternControl, (unsigned char *)pRxData, sizeof(ExternControl));
376
                                        ConfirmFrame = ExternControl.Frame;
375
                                        ConfirmFrame = ExternControl.Frame;
377
                                        PcZugriff = 255;
376
                                        PcZugriff = 255;
378
                                        break;
377
                                        break;
-
 
378
                        case 'c': // Poll the 3D-Data
-
 
379
                    if(!Intervall3D) { if(pRxData[0]) Timer3D = SetDelay(pRxData[0] * 10);}
-
 
380
                                        Intervall3D = pRxData[0] * 10;
-
 
381
                                        break;
379
                        case 'd': // Poll the debug data
382
                        case 'd': // Poll the debug data
380
                                        DebugDataIntervall = pRxData[0] * 10;
383
                                        DebugDataIntervall = pRxData[0] * 10;
381
                                        if (DebugDataIntervall > 0) DebugDataAnforderung = 1;
384
                                        if(DebugDataIntervall > 0) DebugDataAnforderung = 1;
382
                                        break;
385
                                        break;
Line 383... Line 386...
383
 
386
 
384
                        case 'h':// x-1 Displayzeilen
387
                        case 'h':// x-1 Displayzeilen
385
                                PcZugriff = 255;
388
                                PcZugriff = 255;
Line 493... Line 496...
493
        if(GetExternalControl && UebertragungAbgeschlossen)           // Bei Get werden die vom PC einstellbaren Werte vom PC zurückgelesen
496
        if(GetExternalControl && UebertragungAbgeschlossen)           // Bei Get werden die vom PC einstellbaren Werte vom PC zurückgelesen
494
        {
497
        {
495
                SendOutData('G',MeineSlaveAdresse, 1, (unsigned char *) &ExternControl, sizeof(ExternControl));
498
                SendOutData('G',MeineSlaveAdresse, 1, (unsigned char *) &ExternControl, sizeof(ExternControl));
496
                GetExternalControl = 0;
499
                GetExternalControl = 0;
497
        }
500
        }
498
 
-
 
499
    if((CheckDelay(Kompass_Timer)) && UebertragungAbgeschlossen)
501
    if((CheckDelay(Kompass_Timer)) && UebertragungAbgeschlossen)
500
         {
502
         {
501
                  WinkelOut.Winkel[0] = (int) (IntegralNick / 130);  // etwa in 0.1 Grad
503
                  WinkelOut.Winkel[0] = (int) (IntegralNick / (EE_Parameter.GyroAccFaktor * 4));  // etwa in 0.1 Grad
502
                  WinkelOut.Winkel[1] = (int) (IntegralRoll / 130);  // etwa in 0.1 Grad
504
                  WinkelOut.Winkel[1] = (int) (IntegralRoll / (EE_Parameter.GyroAccFaktor * 4));  // etwa in 0.1 Grad
503
                  WinkelOut.UserParameter[0] = Parameter_UserParam1;
505
                  WinkelOut.UserParameter[0] = Parameter_UserParam1;
504
                  WinkelOut.UserParameter[1] = Parameter_UserParam2;
506
                  WinkelOut.UserParameter[1] = Parameter_UserParam2;
505
          SendOutData('w', MK3MAG_ADDRESS, 1, (unsigned char *) &WinkelOut,sizeof(WinkelOut));
507
          SendOutData('w', MK3MAG_ADDRESS, 1, (unsigned char *) &WinkelOut,sizeof(WinkelOut));
506
          if(WinkelOut.CalcState > 4)  WinkelOut.CalcState = 6; // wird dann in SPI auf Null gesetzt
508
          if(WinkelOut.CalcState > 4)  WinkelOut.CalcState = 6; // wird dann in SPI auf Null gesetzt
507
          Kompass_Timer = SetDelay(99);
509
          Kompass_Timer = SetDelay(99);
508
         }
510
         }
509
    if((( DebugDataIntervall>0 && CheckDelay(Debug_Timer)) || DebugDataAnforderung) && UebertragungAbgeschlossen)
511
    if(((DebugDataIntervall>0 && CheckDelay(Debug_Timer)) || DebugDataAnforderung) && UebertragungAbgeschlossen)
510
         {
512
         {
511
          SendOutData('D', FC_ADDRESS, 1, (unsigned char *) &DebugOut,sizeof(DebugOut));
513
          SendOutData('D', FC_ADDRESS, 1, (unsigned char *) &DebugOut,sizeof(DebugOut));
512
          DebugDataAnforderung = 0;
514
          DebugDataAnforderung = 0;
513
          if(DebugDataIntervall>0) Debug_Timer = SetDelay(DebugDataIntervall);
515
          if(DebugDataIntervall>0) Debug_Timer = SetDelay(DebugDataIntervall);
514
         }
516
         }
-
 
517
    if(Intervall3D > 0 && CheckDelay(Timer3D) && UebertragungAbgeschlossen)
-
 
518
         {
-
 
519
                  Data3D.Winkel[0] = (int) (IntegralNick / (EE_Parameter.GyroAccFaktor * 4));  // etwa in 0.1 Grad
-
 
520
                  Data3D.Winkel[1] = (int) (IntegralRoll / (EE_Parameter.GyroAccFaktor * 4));  // etwa in 0.1 Grad
-
 
521
          Data3D.Winkel[2] = (int) ((10 * ErsatzKompass) / GIER_GRAD_FAKTOR);
-
 
522
          SendOutData('C', FC_ADDRESS, 1, (unsigned char *) &Data3D,sizeof(Data3D));
-
 
523
          Timer3D = SetDelay(Intervall3D);
-
 
524
         }
515
    if(DebugTextAnforderung != 255) // Texte für die Analogdaten
525
    if(DebugTextAnforderung != 255) // Texte für die Analogdaten
516
     {
526
     {
517
      SendOutData('A', FC_ADDRESS, 2, (unsigned char *)&DebugTextAnforderung, sizeof(DebugTextAnforderung),(unsigned char *) ANALOG_TEXT[DebugTextAnforderung], 16);
527
      SendOutData('A', FC_ADDRESS, 2, (unsigned char *)&DebugTextAnforderung, sizeof(DebugTextAnforderung),(unsigned char *) ANALOG_TEXT[DebugTextAnforderung], 16);
518
      DebugTextAnforderung = 255;
528
      DebugTextAnforderung = 255;
519
         }
529
         }