Subversion Repositories NaviCtrl

Rev

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

Rev 386 Rev 388
Line 293... Line 293...
293
        if(SPI_RxBuffer_Request)
293
        if(SPI_RxBuffer_Request)
294
        {
294
        {
295
                // avoid sending data via SPI during the update of the  ToFlightCtrl structure
295
                // avoid sending data via SPI during the update of the  ToFlightCtrl structure
296
                VIC_ITCmd(SSP0_ITLine, DISABLE); // disable SPI interrupt
296
                VIC_ITCmd(SSP0_ITLine, DISABLE); // disable SPI interrupt
297
                ToFlightCtrl.CompassHeading = Compass_Heading;
297
                ToFlightCtrl.CompassHeading = Compass_Heading;
298
//ToFlightCtrl.CompassHeading += 360 + ((s32) Poti8 - 128);
-
 
299
//ToFlightCtrl.CompassHeading %= 360;
-
 
300
                DebugOut.Analog[10] = ToFlightCtrl.CompassHeading;
298
                DebugOut.Analog[10] = ToFlightCtrl.CompassHeading;
301
                if(ToFlightCtrl.CompassHeading >= 0) ToFlightCtrl.CompassHeading = (360 + ToFlightCtrl.CompassHeading + FromFlightCtrl.GyroYaw / 12) % 360;
299
                if(ToFlightCtrl.CompassHeading >= 0) ToFlightCtrl.CompassHeading = (360 + ToFlightCtrl.CompassHeading + FromFlightCtrl.GyroYaw / 12) % 360;
302
//              ToFlightCtrl.MagVecX = MagVector.X;
300
//              ToFlightCtrl.MagVecX = MagVector.X;
303
//              ToFlightCtrl.MagVecY = MagVector.Y;
301
//              ToFlightCtrl.MagVecY = MagVector.Y;
304
                ToFlightCtrl.MagVecZ = MagVector.Z;
302
                ToFlightCtrl.MagVecZ = MagVector.Z;
Line 399... Line 397...
399
                                else
397
                                else
400
                                {
398
                                {
401
                                        ToFlightCtrl.Param.sInt[5] = (s16)ToFC_AltitudeSetpoint;
399
                                        ToFlightCtrl.Param.sInt[5] = (s16)ToFC_AltitudeSetpoint;
402
                                }
400
                                }
403
                                break;
401
                                break;
404
/*
-
 
405
typedef struct
-
 
406
{
-
 
407
  unsigned char StartByte;  //0         // 0x7C
-
 
408
  unsigned char Packet_ID;  //1         // 0x89  - Vario ID
-
 
409
  unsigned char WarnBeep;   //2         // Anzahl der Töne 0..36
-
 
410
  unsigned char Heading;        //3     // 1 = 2°
-
 
411
  unsigned int Speed;           //4+5   // in km/h
-
 
412
  unsigned char Lat_North;      //6    
-
 
413
  unsigned char Lat_G;      //7
-
 
414
  unsigned char Lat_M;      //8
-
 
415
  unsigned char Lat_Sek1;       //9    
-
 
416
  unsigned char Lat_Sek2;       //10    
-
 
417
  unsigned char Lon_East;       //11    
-
 
418
  unsigned char Lon_G;      //12
-
 
419
  unsigned char Lon_M;      //13
-
 
420
  unsigned char Lon_Sek1;       //14    
-
 
421
  unsigned char Lon_Sek2;       //15    
-
 
422
  unsigned int Distance;        //16+17    // 9000 = 0m
-
 
423
  unsigned int Altitude;        //18+19    // 500 = 0m
-
 
424
  unsigned int m_sec;           //20+21    // 3000 = 0
-
 
425
  unsigned int m_3sec;          //22+23    // 3000 = 0
-
 
426
  unsigned int m_10sec;         //24+25    // 3000 = 0
-
 
427
  unsigned char NullByte;       // 0x00
-
 
428
  unsigned char NullByte1;      // 0x00
-
 
429
  unsigned char EndByte;                // 0x7D
-
 
430
} GPSPacket_t;
-
 
431
*/
-
 
432
/*
-
 
433
typedef struct
-
 
434
{
-
 
435
  unsigned char StartByte;      //0 0x7C
-
 
436
  unsigned char Packet_ID;      //1 HOTT_GENERAL_PACKET_ID     
-
 
437
  unsigned char WarnBeep;       //2 Anzahl der Töne 0..36
-
 
438
  unsigned char VoltageCell1;   //3 208 = 4,16V  (Voltage * 50 = Wert)
-
 
439
  unsigned char VoltageCell2;   //4
-
 
440
  unsigned char VoltageCell3;   //5
-
 
441
  unsigned char VoltageCell4;   //6
-
 
442
  unsigned char VoltageCell5;   //7
-
 
443
  unsigned char VoltageCell6;   //8
-
 
444
  unsigned int  Battery1;               //9   51  = 5,1V
-
 
445
  unsigned int  Battery2;               //11  51  = 5,1V
-
 
446
  unsigned char Temperature1;   //13  44 = 24°C, 0 = -20°C
-
 
447
  unsigned char Temperature2;   //14  44 = 24°C, 0 = -20°C
-
 
448
  unsigned char FuelPercent;    //15
-
 
449
    signed int  FuelCapacity;   //16
-
 
450
  unsigned int  Rpm;  
-
 
451
  unsigned int  Altitude;      
-
 
452
  unsigned int  m_sec;              // 3000 = 0
-
 
453
  unsigned char m_3sec;             // 120 = 0
-
 
454
  unsigned int  Current;                // 1 = 0.1A
-
 
455
  unsigned int  InputVoltage;   // 66  = 6,6V
-
 
456
  unsigned int  Capacity;               // 1  = 10mAh
-
 
457
  unsigned char NullByte1;      // 0x00
-
 
458
  unsigned char NullByte2;      // 0x00
-
 
459
  unsigned char EndByte;                // 0x7D
-
 
460
} HoTTGeneral_t;
-
 
461
*/
-
 
462
                        case SPI_NCCMD_HOTT_INFO:
402
                        case SPI_NCCMD_HOTT_INFO:
463
                                switch(hott_index++)
403
                                switch(hott_index++)
464
                                {
404
                                {
465
                                case 0:
405
                                case 0:
466
                                        //Dezimalgrad            --> Grad mit Dezimalminuten     --> Grad, Minuten, Sekunden
406
                                        //Dezimalgrad            --> Grad mit Dezimalminuten     --> Grad, Minuten, Sekunden
Line 580... Line 520...
580
                                         else                                                                                            // Ansonsten die aktuelle Richtung übernehmen
520
                                         else                                                                                            // Ansonsten die aktuelle Richtung übernehmen
581
                                          HeadFreeStartAngle = (3600 + FromFlightCtrl.GyroHeading /*+ Parameter.OrientationAngle * 150*/) % 3600; // in 0.1°      
521
                                          HeadFreeStartAngle = (3600 + FromFlightCtrl.GyroHeading /*+ Parameter.OrientationAngle * 150*/) % 3600; // in 0.1°      
582
                                        }
522
                                        }
583
                                }
523
                                }
Line 584... Line -...
584
 
-
 
585
//DebugOut.Analog[16] = HeadFreeStartAngle;
-
 
586
 
524
 
587
                                Parameter.ActiveSetting = FromFlightCtrl.Param.Byte[9];
525
                                Parameter.ActiveSetting = FromFlightCtrl.Param.Byte[9];
588
                                DebugOut.Analog[5] = FC.StatusFlags;
526
                                DebugOut.Analog[5] = FC.StatusFlags;
589
                                NaviData.FCStatusFlags = FC.StatusFlags;
527
                                NaviData.FCStatusFlags = FC.StatusFlags;
590
                                FC.StatusFlags2 = FromFlightCtrl.Param.Byte[11];
528
                                FC.StatusFlags2 = FromFlightCtrl.Param.Byte[11];
Line 729... Line 667...
729
 
667
 
730
 
668
 
731
/*
669
/*
732
//+++++++++++++++++++++++++++++++++++++++++++++++++++
-
 
733
*/
-
 
734
/*
-
 
735
if(Parameter.User8 < 100) FC.StatusFlags = 0;
-
 
736
else
-
 
737
if(Parameter.User8 < 150) FC.StatusFlags = FC_STATUS_START;
-
 
738
else FC.StatusFlags = FC_STATUS_FLY | FC_STATUS_MOTOR_RUN;
-
 
739
BL_MinOfMaxPWM = 255;
670
//+++++++++++++++++++++++++++++++++++++++++++++++++++
740
*/
671
*/
741
                GPS_Navigation(&GPSData, &(ToFlightCtrl.GPSStick));
672
                GPS_Navigation(&GPSData, &(ToFlightCtrl.GPSStick));
742
                ClearFCStatusFlags = 1;
673
                ClearFCStatusFlags = 1;
743
                if(counter)
674
                if(counter)