Rev 577 | Rev 581 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 577 | Rev 578 | ||
---|---|---|---|
Line 80... | Line 80... | ||
80 | ToFlightCtrl_t ToFlightCtrl; |
80 | ToFlightCtrl_t ToFlightCtrl; |
81 | #define SPI0_TIMEOUT 2500 //ms |
81 | #define SPI0_TIMEOUT 2500 //ms |
82 | volatile u32 SPI0_Timeout = 0; |
82 | volatile u32 SPI0_Timeout = 0; |
83 | u8 Logging_FCStatusFlags1 = 0,Logging_FCStatusFlags2 = 0; |
83 | u8 Logging_FCStatusFlags1 = 0,Logging_FCStatusFlags2 = 0; |
84 | u8 SpeakHoTT = 0; |
84 | u8 SpeakHoTT = 0; |
- | 85 | u32 LoggingGasFilter = 0, LoggingGasCnt = 0; |
|
Line 85... | Line 86... | ||
85 | 86 | ||
86 | // tx packet buffer |
87 | // tx packet buffer |
87 | #define SPI_TXBUFFER_LEN (2 + sizeof(ToFlightCtrl)) // 2 bytes at start are for synchronization |
88 | #define SPI_TXBUFFER_LEN (2 + sizeof(ToFlightCtrl)) // 2 bytes at start are for synchronization |
88 | volatile u8 SPI_TxBuffer[SPI_TXBUFFER_LEN + 10]; |
89 | volatile u8 SPI_TxBuffer[SPI_TXBUFFER_LEN + 10]; |
Line 129... | Line 130... | ||
129 | s16 CompassSetpointCorrected = 0; // The compass setpoint that the FC tries to keep - corrected with the magnetic declination |
130 | s16 CompassSetpointCorrected = 0; // The compass setpoint that the FC tries to keep - corrected with the magnetic declination |
130 | s16 CompassSetpoint = 0; // in 0,1° |
131 | s16 CompassSetpoint = 0; // in 0,1° |
131 | s16 SimulatedDirection = 0; // only for flight simulation |
132 | s16 SimulatedDirection = 0; // only for flight simulation |
132 | u8 AmountOfMotors = 0; |
133 | u8 AmountOfMotors = 0; |
133 | u16 FlugMinutenGesamt; |
134 | u16 FlugMinutenGesamt; |
134 | - | ||
- | 135 | u8 HoverGas = 0; |
|
135 | //-------------------------------------------------------------- |
136 | //-------------------------------------------------------------- |
136 | void SSP0_IRQHandler(void) |
137 | void SSP0_IRQHandler(void) |
137 | { |
138 | { |
138 | static u8 rxchksum = 0; |
139 | static u8 rxchksum = 0; |
139 | u8 rxdata; |
140 | u8 rxdata; |
Line 407... | Line 408... | ||
407 | ToFlightCtrl.Param.Byte[5] = NaviData.WaypointNumber; // number of stored waypoints |
408 | ToFlightCtrl.Param.Byte[5] = NaviData.WaypointNumber; // number of stored waypoints |
408 | ToFlightCtrl.Param.Int[3] = NaviData.TargetPositionDeviation.Distance / 10; |
409 | ToFlightCtrl.Param.Int[3] = NaviData.TargetPositionDeviation.Distance / 10; |
409 | ToFlightCtrl.Param.Byte[8] = NaviData.TargetHoldTime; // time in s to stay at the given target, counts down to 0 if target has been reached |
410 | ToFlightCtrl.Param.Byte[8] = NaviData.TargetHoldTime; // time in s to stay at the given target, counts down to 0 if target has been reached |
410 | ToFlightCtrl.Param.Byte[9] = ToFC_MaxWpListIndex; |
411 | ToFlightCtrl.Param.Byte[9] = ToFC_MaxWpListIndex; |
411 | ToFlightCtrl.Param.sInt[5] = GyroCompassCorrected / 10; // Bytes 10 & 11 |
412 | ToFlightCtrl.Param.sInt[5] = GyroCompassCorrected / 10; // Bytes 10 & 11 |
- | 413 | ||
412 | SpeakHoTT = 0; |
414 | SpeakHoTT = 0; |
413 | break; |
415 | break; |
Line 414... | Line 416... | ||
414 | 416 | ||
415 | case SPI_NCCMD_GPSINFO: |
417 | case SPI_NCCMD_GPSINFO: |
Line 755... | Line 757... | ||
755 | CHK_POTI_MM(Parameter.NaviGpsDLimit,FromFlightCtrl.Param.Byte[8],0,255); |
757 | CHK_POTI_MM(Parameter.NaviGpsDLimit,FromFlightCtrl.Param.Byte[8],0,255); |
756 | FC.RC_Quality = FromFlightCtrl.Param.Byte[9]; |
758 | FC.RC_Quality = FromFlightCtrl.Param.Byte[9]; |
757 | NaviData.RC_Quality = FC.RC_Quality; |
759 | NaviData.RC_Quality = FC.RC_Quality; |
758 | NC_Wait_for_LED = FromFlightCtrl.Param.Byte[10]; |
760 | NC_Wait_for_LED = FromFlightCtrl.Param.Byte[10]; |
759 | NaviData.Gas = (FC.BAT_Voltage * (u32) FromFlightCtrl.Param.Byte[11]) / (u32) Parameter.LowVoltageWarning; |
761 | NaviData.Gas = (FC.BAT_Voltage * (u32) FromFlightCtrl.Param.Byte[11]) / (u32) Parameter.LowVoltageWarning; |
- | 762 | LoggingGasFilter += (u32) FromFlightCtrl.Param.Byte[11]; |
|
- | 763 | LoggingGasCnt++; |
|
760 | break; |
764 | break; |
Line 761... | Line 765... | ||
761 | 765 | ||
762 | case SPI_FCCMD_SERVOS: |
766 | case SPI_FCCMD_SERVOS: |
763 | FC.BAT_UsedCapacity = FromFlightCtrl.Param.Int[0]; |
767 | FC.BAT_UsedCapacity = FromFlightCtrl.Param.Int[0]; |
Line 802... | Line 806... | ||
802 | break; |
806 | break; |
803 | case SPI_FCCMD_NEUTRAL: |
807 | case SPI_FCCMD_NEUTRAL: |
804 | FC.AdNeutralNick = FromFlightCtrl.Param.Int[0]; |
808 | FC.AdNeutralNick = FromFlightCtrl.Param.Int[0]; |
805 | FC.AdNeutralRoll = FromFlightCtrl.Param.Int[1]; |
809 | FC.AdNeutralRoll = FromFlightCtrl.Param.Int[1]; |
806 | FC.AdNeutralYaw = FromFlightCtrl.Param.Int[2]; |
810 | FC.AdNeutralYaw = FromFlightCtrl.Param.Int[2]; |
807 | Parameter.Driftkomp = FromFlightCtrl.Param.Byte[6]; |
811 | Parameter.Driftkomp = FromFlightCtrl.Param.Byte[6]; |
- | 812 | HoverGas = FromFlightCtrl.Param.Byte[7]; |
|
808 | break; |
813 | break; |
809 | default: |
814 | default: |
810 | break; |
815 | break; |
811 | } |
816 | } |
812 | DebugOut.Analog[0] = FromFlightCtrl.AngleNick; |
817 | DebugOut.Analog[0] = FromFlightCtrl.AngleNick; |