Subversion Repositories NaviCtrl

Rev

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

Rev 548 Rev 567
Line 126... Line 126...
126
s16 POI_KameraNick = 0;
126
s16 POI_KameraNick = 0;
127
u8 NC_Wait_for_LED = 0;
127
u8 NC_Wait_for_LED = 0;
128
s16 GyroCompassCorrected = 0; // corrected with the magnetic declination
128
s16 GyroCompassCorrected = 0; // corrected with the magnetic declination
129
s16 CompassSetpointCorrected = 0; // The compass setpoint that the FC tries to keep - corrected with the magnetic declination
129
s16 CompassSetpointCorrected = 0; // The compass setpoint that the FC tries to keep - corrected with the magnetic declination
130
s16 CompassSetpoint = 0;          // in 0,1°
130
s16 CompassSetpoint = 0;          // in 0,1°
-
 
131
s16 SimulatedDirection = 0;     // only for flight simulation
131
u8 AmountOfMotors = 0;
132
u8 AmountOfMotors = 0;
132
u16 FlugMinutenGesamt;
133
u16 FlugMinutenGesamt;
Line 133... Line 134...
133
 
134
 
134
//--------------------------------------------------------------
135
//--------------------------------------------------------------
Line 595... Line 596...
595
                                Parameter.User5 = FromFlightCtrl.Param.Byte[4];
596
                                Parameter.User5 = FromFlightCtrl.Param.Byte[4];
596
                                Parameter.User6 = FromFlightCtrl.Param.Byte[5];
597
                                Parameter.User6 = FromFlightCtrl.Param.Byte[5];
597
                                Parameter.User7 = FromFlightCtrl.Param.Byte[6];
598
                                Parameter.User7 = FromFlightCtrl.Param.Byte[6];
598
                                Parameter.User8 = FromFlightCtrl.Param.Byte[7];
599
                                Parameter.User8 = FromFlightCtrl.Param.Byte[7];
Line -... Line 600...
-
 
600
 
-
 
601
                                FC.RealStatusFlags = FromFlightCtrl.Param.Byte[8];
-
 
602
                                if(FC.RealStatusFlags & FC_STATUS_MOTOR_RUN) SimulationFlags = 0; // stop the simulation if the motors would really start
599
 
603
 
600
                                if(ClearFCStatusFlags)
604
                                if(!(SimulationFlags & SIMULATION_ACTIVE))
-
 
605
                                {
-
 
606
                                        if(ClearFCStatusFlags)
601
                                {
607
                                        {
602
                                        FC.StatusFlags = 0;
608
                                                FC.StatusFlags = 0;
-
 
609
                                                ClearFCStatusFlags = 0;
603
                                        ClearFCStatusFlags = 0;
610
                                        }
604
                                }
611
                                }
605
                                FC.StatusFlags |= FromFlightCtrl.Param.Byte[8];
612
                                FC.StatusFlags |= FC.RealStatusFlags;
606
                                if(FC.StatusFlags & FC_STATUS_CALIBRATE && !FCCalibActive)
613
                                if(FC.StatusFlags & FC_STATUS_CALIBRATE && !FCCalibActive)
607
                                {
-
 
608
//                                      HeadFreeStartAngle = (3600 + Compass_Heading * 10 - GeoMagDec) % 3600;
614
                                {
609
                                        HeadFreeStartAngle = (3600 + Compass_Heading * 10 + GeoMagDec) % 3600;
615
                                        HeadFreeStartAngle = (3600 + Compass_Heading * 10 + GeoMagDec) % 3600;
610
                                        Compass_Init();
616
                                        Compass_Init();
611
                                        FCCalibActive = 10;
617
                                        FCCalibActive = 10;
612
                                        FC_is_Calibrated = 0;
618
                                        FC_is_Calibrated = 0;
Line 622... Line 628...
622
                                                }
628
                                                }
623
                                        }
629
                                        }
624
                                }
630
                                }
625
                                if(FC.StatusFlags & FC_STATUS_START)
631
                                if(FC.StatusFlags & FC_STATUS_START)
626
                                {
632
                                {
627
//                                      if(Compass_Heading != -1) HeadFreeStartAngle = (3600 + Compass_Heading * 10 - GeoMagDec) % 3600; else
-
 
628
                                        if(Compass_Heading != -1) HeadFreeStartAngle = (3600 + Compass_Heading * 10 + GeoMagDec) % 3600;
633
                                        if(Compass_Heading != -1) HeadFreeStartAngle = (3600 + Compass_Heading * 10 + GeoMagDec) % 3600;
629
                                        else HeadFreeStartAngle = GyroCompassCorrected;
634
                                        else HeadFreeStartAngle = GyroCompassCorrected;
630
                                }
635
                                }
Line 631... Line 636...
631
 
636
 
Line 680... Line 685...
680
                                if(FromFC_VarioCharacter == '+' || FromFC_VarioCharacter == '-') // manual setpoint clears the NC-Parameter command
685
                                if(FromFC_VarioCharacter == '+' || FromFC_VarioCharacter == '-') // manual setpoint clears the NC-Parameter command
681
                                {
686
                                {
682
                                        NCParams_ClearValue(NCPARAMS_ALTITUDE_RATE);
687
                                        NCParams_ClearValue(NCPARAMS_ALTITUDE_RATE);
683
                                }
688
                                }
684
                                NaviData.UBat = FC.BAT_Voltage;
689
                                NaviData.UBat = FC.BAT_Voltage;
685
                                NaviData.Current = FC.BAT_Current;
690
                                if(!(SimulationFlags & SIMULATION_ACTIVE)) NaviData.Current = FC.BAT_Current;
686
                                NaviData.UsedCapacity = FC.BAT_UsedCapacity;
691
                                NaviData.UsedCapacity = FC.BAT_UsedCapacity;
687
                                break;
692
                                break;
688
                        case SPI_FCCMD_PARAMETER1:
693
                        case SPI_FCCMD_PARAMETER1:
689
                                Parameter.LowVoltageWarning = FromFlightCtrl.Param.Byte[0];
694
                                Parameter.LowVoltageWarning = FromFlightCtrl.Param.Byte[0];
690
                                CHK_POTI_MM(Parameter.NaviGpsGain,FromFlightCtrl.Param.Byte[1],0,255);
695
                                CHK_POTI_MM(Parameter.NaviGpsGain,FromFlightCtrl.Param.Byte[1],0,255);
Line 740... Line 745...
740
                                         }
745
                                         }
741
//                                       else CompassCalState = 0;
746
//                                       else CompassCalState = 0;
742
                                }
747
                                }
743
                                Parameter.NaviPH_LoginTime = FromFlightCtrl.Param.Byte[1];
748
                                Parameter.NaviPH_LoginTime = FromFlightCtrl.Param.Byte[1];
744
                                NaviData.Variometer = (NaviData.Variometer + 2 * (FromFlightCtrl.Param.sInt[1] - NaviData.Altimeter)) / 2; // provisorisch
749
                                NaviData.Variometer = (NaviData.Variometer + 2 * (FromFlightCtrl.Param.sInt[1] - NaviData.Altimeter)) / 2; // provisorisch
745
                                NaviData.Altimeter = FromFlightCtrl.Param.sInt[1]; // in 5cm
750
                                FC.Altimeter = FromFlightCtrl.Param.sInt[1]; // in 5cm
746
                                NaviData.SetpointAltitude = FromFlightCtrl.Param.sInt[2]; // in 5cm
751
                                if(!(SimulationFlags & SIMULATION_ACTIVE)) NaviData.SetpointAltitude = FromFlightCtrl.Param.sInt[2]; // in 5cm
747
                                CHK_POTI_MM(Parameter.NaviGpsPLimit,FromFlightCtrl.Param.Byte[6],0,255);
752
                                CHK_POTI_MM(Parameter.NaviGpsPLimit,FromFlightCtrl.Param.Byte[6],0,255);
748
                                CHK_POTI_MM(Parameter.NaviGpsILimit,FromFlightCtrl.Param.Byte[7],0,255);
753
                                CHK_POTI_MM(Parameter.NaviGpsILimit,FromFlightCtrl.Param.Byte[7],0,255);
749
                                CHK_POTI_MM(Parameter.NaviGpsDLimit,FromFlightCtrl.Param.Byte[8],0,255);
754
                                CHK_POTI_MM(Parameter.NaviGpsDLimit,FromFlightCtrl.Param.Byte[8],0,255);
750
                                FC.RC_Quality   = FromFlightCtrl.Param.Byte[9];
755
                                FC.RC_Quality   = FromFlightCtrl.Param.Byte[9];
751
                                NaviData.RC_Quality = FC.RC_Quality;
756
                                NaviData.RC_Quality = FC.RC_Quality;
752
                                NC_Wait_for_LED = FromFlightCtrl.Param.Byte[10];
757
                                NC_Wait_for_LED = FromFlightCtrl.Param.Byte[10];
753
//                              FC.RC_RSSI              = FromFlightCtrl.Param.Byte[10];
-
 
754
//                              if(!FC.RC_RSSI) NaviData.RC_Quality = FC.RC_Quality; else NaviData.RC_Quality = FC.RC_RSSI;
-
 
755
//                              NaviData.RC_RSSI = FC.RC_RSSI;
-
 
756
                                NaviData.Gas    = (FC.BAT_Voltage * (u32) FromFlightCtrl.Param.Byte[11]) / (u32) Parameter.LowVoltageWarning;
758
                                NaviData.Gas    = (FC.BAT_Voltage * (u32) FromFlightCtrl.Param.Byte[11]) / (u32) Parameter.LowVoltageWarning;
757
                                break;
759
                                break;
Line 758... Line 760...
758
 
760
 
759
                        case SPI_FCCMD_SERVOS:
761
                        case SPI_FCCMD_SERVOS: