Rev 1949 | Rev 2008 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1949 | Rev 1972 | ||
---|---|---|---|
1 | // ######################## SPI - FlightCtrl ################### |
1 | // ######################## SPI - FlightCtrl ################### |
2 | #include "main.h" |
2 | #include "main.h" |
3 | #include "eeprom.h" |
3 | #include "eeprom.h" |
4 | 4 | ||
5 | //struct str_ToNaviCtrl_Version ToNaviCtrl_Version; |
5 | //struct str_ToNaviCtrl_Version ToNaviCtrl_Version; |
6 | //struct str_FromNaviCtrl_Version FromNaviCtrl_Version; |
6 | //struct str_FromNaviCtrl_Version FromNaviCtrl_Version; |
7 | struct str_ToNaviCtrl ToNaviCtrl; |
7 | struct str_ToNaviCtrl ToNaviCtrl; |
8 | struct str_FromNaviCtrl FromNaviCtrl; |
8 | struct str_FromNaviCtrl FromNaviCtrl; |
9 | struct str_FromNaviCtrl_Value FromNaviCtrl_Value; |
9 | struct str_FromNaviCtrl_Value FromNaviCtrl_Value; |
10 | struct str_SPI_VersionInfo NC_Version; |
10 | struct str_SPI_VersionInfo NC_Version; |
11 | struct str_GPSInfo GPSInfo; |
11 | struct str_GPSInfo GPSInfo; |
12 | 12 | ||
13 | unsigned char SPI_BufferIndex; |
13 | unsigned char SPI_BufferIndex; |
14 | unsigned char SPI_RxBufferIndex; |
14 | unsigned char SPI_RxBufferIndex; |
15 | signed char FromNC_Rotate_C = 32, FromNC_Rotate_S = 0; |
15 | signed char FromNC_Rotate_C = 32, FromNC_Rotate_S = 0; |
16 | 16 | ||
17 | volatile unsigned char SPI_Buffer[sizeof(FromNaviCtrl)]; |
17 | volatile unsigned char SPI_Buffer[sizeof(FromNaviCtrl)]; |
18 | unsigned char *SPI_TX_Buffer; |
18 | unsigned char *SPI_TX_Buffer; |
19 | 19 | ||
20 | unsigned char SPITransferCompleted, SPI_ChkSum; |
20 | unsigned char SPITransferCompleted, SPI_ChkSum; |
21 | unsigned char SPI_RxDataValid,NaviDataOkay = 250; |
21 | unsigned char SPI_RxDataValid,NaviDataOkay = 250; |
22 | 22 | ||
23 | unsigned char SPI_CommandSequence[] = {SPI_FCCMD_STICK, SPI_FCCMD_USER, SPI_FCCMD_PARAMETER1, SPI_FCCMD_STICK, SPI_FCCMD_MISC, SPI_FCCMD_VERSION, SPI_FCCMD_STICK, SPI_FCCMD_SERVOS, SPI_FCCMD_ACCU}; |
23 | unsigned char SPI_CommandSequence[] = {SPI_FCCMD_STICK, SPI_FCCMD_USER, SPI_FCCMD_PARAMETER1, SPI_FCCMD_STICK, SPI_FCCMD_MISC, SPI_FCCMD_VERSION, SPI_FCCMD_STICK, SPI_FCCMD_SERVOS, SPI_FCCMD_ACCU}; |
24 | unsigned char SPI_CommandCounter = 0; |
24 | unsigned char SPI_CommandCounter = 0; |
25 | unsigned char NC_ErrorCode = 0; |
25 | unsigned char NC_ErrorCode = 0; |
26 | unsigned char NC_GPS_ModeCharacter = ' '; |
26 | unsigned char NC_GPS_ModeCharacter = ' '; |
- | 27 | unsigned char EarthMagneticField = 0; |
|
- | 28 | unsigned char EarthMagneticInclination = 0, EarthMagneticInclinationTheoretic = 0; |
|
27 | signed int POI_KameraNick = 0; // in 0,1° |
29 | signed int POI_KameraNick = 0; // in 0,1° |
28 | vector16_t MagVec = {0,0,0}; |
30 | vector16_t MagVec = {0,0,0}; |
29 | 31 | ||
30 | #ifdef USE_SPI_COMMUNICATION |
32 | #ifdef USE_SPI_COMMUNICATION |
31 | 33 | ||
32 | //------------------------------------------------------ |
34 | //------------------------------------------------------ |
33 | void SPI_MasterInit(void) |
35 | void SPI_MasterInit(void) |
34 | { |
36 | { |
35 | DDR_SPI |= (1<<DD_MOSI)|(1<<DD_SCK); // Set MOSI and SCK output, all others input |
37 | DDR_SPI |= (1<<DD_MOSI)|(1<<DD_SCK); // Set MOSI and SCK output, all others input |
36 | SLAVE_SELECT_DDR_PORT |= (1 << SPI_SLAVE_SELECT); |
38 | SLAVE_SELECT_DDR_PORT |= (1 << SPI_SLAVE_SELECT); |
37 | 39 | ||
38 | SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR1)|(0<<SPR0)|(0<<SPIE); // Enable SPI, Master, set clock rate fck/64 |
40 | SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR1)|(0<<SPR0)|(0<<SPIE); // Enable SPI, Master, set clock rate fck/64 |
39 | SPSR = 0;//(1<<SPI2X); |
41 | SPSR = 0;//(1<<SPI2X); |
40 | 42 | ||
41 | SLAVE_SELECT_PORT |= (1 << SPI_SLAVE_SELECT); |
43 | SLAVE_SELECT_PORT |= (1 << SPI_SLAVE_SELECT); |
42 | SPITransferCompleted = 1; |
44 | SPITransferCompleted = 1; |
43 | 45 | ||
44 | //SPDR = 0x00; // dummy write |
46 | //SPDR = 0x00; // dummy write |
45 | 47 | ||
46 | ToNaviCtrl.Sync1 = 0xAA; |
48 | ToNaviCtrl.Sync1 = 0xAA; |
47 | ToNaviCtrl.Sync2 = 0x83; |
49 | ToNaviCtrl.Sync2 = 0x83; |
48 | 50 | ||
49 | ToNaviCtrl.Command = SPI_FCCMD_USER; |
51 | ToNaviCtrl.Command = SPI_FCCMD_USER; |
50 | ToNaviCtrl.IntegralNick = 0; |
52 | ToNaviCtrl.IntegralNick = 0; |
51 | ToNaviCtrl.IntegralRoll = 0; |
53 | ToNaviCtrl.IntegralRoll = 0; |
52 | FromNaviCtrl_Value.SerialDataOkay = 0; |
54 | FromNaviCtrl_Value.SerialDataOkay = 0; |
53 | SPI_RxDataValid = 0; |
55 | SPI_RxDataValid = 0; |
54 | 56 | ||
55 | } |
57 | } |
56 | 58 | ||
57 | //------------------------------------------------------ |
59 | //------------------------------------------------------ |
58 | void SPI_StartTransmitPacket(void) |
60 | void SPI_StartTransmitPacket(void) |
59 | { |
61 | { |
60 | //if ((SLAVE_SELECT_PORT & (1 << SPI_SLAVE_SELECT)) == 0) return; // transfer of prev. packet not completed |
62 | //if ((SLAVE_SELECT_PORT & (1 << SPI_SLAVE_SELECT)) == 0) return; // transfer of prev. packet not completed |
61 | if (!SPITransferCompleted) return; |
63 | if (!SPITransferCompleted) return; |
62 | // _delay_us(30); |
64 | // _delay_us(30); |
63 | 65 | ||
64 | SLAVE_SELECT_PORT &= ~(1 << SPI_SLAVE_SELECT); // SelectSlave |
66 | SLAVE_SELECT_PORT &= ~(1 << SPI_SLAVE_SELECT); // SelectSlave |
65 | SPI_TX_Buffer = (unsigned char *) &ToNaviCtrl; |
67 | SPI_TX_Buffer = (unsigned char *) &ToNaviCtrl; |
66 | 68 | ||
67 | ToNaviCtrl.Command = SPI_CommandSequence[SPI_CommandCounter++]; |
69 | ToNaviCtrl.Command = SPI_CommandSequence[SPI_CommandCounter++]; |
68 | if (SPI_CommandCounter >= sizeof(SPI_CommandSequence)) SPI_CommandCounter = 0; |
70 | if (SPI_CommandCounter >= sizeof(SPI_CommandSequence)) SPI_CommandCounter = 0; |
69 | 71 | ||
70 | SPITransferCompleted = 0; |
72 | SPITransferCompleted = 0; |
71 | UpdateSPI_Buffer(); // update buffer |
73 | UpdateSPI_Buffer(); // update buffer |
72 | 74 | ||
73 | SPI_BufferIndex = 1; |
75 | SPI_BufferIndex = 1; |
74 | //ebugOut.Analog[16]++; |
76 | //ebugOut.Analog[16]++; |
75 | // -- Debug-Output --- |
77 | // -- Debug-Output --- |
76 | //---- |
78 | //---- |
77 | asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); |
79 | asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); |
78 | asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); |
80 | asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); |
79 | asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); |
81 | asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); |
80 | ToNaviCtrl.Chksum = ToNaviCtrl.Sync1; |
82 | ToNaviCtrl.Chksum = ToNaviCtrl.Sync1; |
81 | SPDR = ToNaviCtrl.Sync1; // Start transmission |
83 | SPDR = ToNaviCtrl.Sync1; // Start transmission |
82 | // SLAVE_SELECT_PORT |= (1 << SPI_SLAVE_SELECT); // DeselectSlave |
84 | // SLAVE_SELECT_PORT |= (1 << SPI_SLAVE_SELECT); // DeselectSlave |
83 | 85 | ||
84 | } |
86 | } |
85 | 87 | ||
86 | //------------------------------------------------------ |
88 | //------------------------------------------------------ |
87 | //SIGNAL(SIG_SPI) |
89 | //SIGNAL(SIG_SPI) |
88 | void SPI_TransmitByte(void) |
90 | void SPI_TransmitByte(void) |
89 | { |
91 | { |
90 | static unsigned char SPI_RXState = 0; |
92 | static unsigned char SPI_RXState = 0; |
91 | unsigned char rxdata; |
93 | unsigned char rxdata; |
92 | static unsigned char rxchksum; |
94 | static unsigned char rxchksum; |
93 | 95 | ||
94 | if (SPITransferCompleted) return; |
96 | if (SPITransferCompleted) return; |
95 | if (!(SPSR & (1 << SPIF))) return; |
97 | if (!(SPSR & (1 << SPIF))) return; |
96 | SendSPI = 4; |
98 | SendSPI = 4; |
97 | 99 | ||
98 | // _delay_us(30); |
100 | // _delay_us(30); |
99 | SLAVE_SELECT_PORT |= (1 << SPI_SLAVE_SELECT); // DeselectSlave |
101 | SLAVE_SELECT_PORT |= (1 << SPI_SLAVE_SELECT); // DeselectSlave |
100 | 102 | ||
101 | rxdata = SPDR; |
103 | rxdata = SPDR; |
102 | switch ( SPI_RXState) |
104 | switch ( SPI_RXState) |
103 | { |
105 | { |
104 | case 0: |
106 | case 0: |
105 | 107 | ||
106 | SPI_RxBufferIndex = 0; |
108 | SPI_RxBufferIndex = 0; |
107 | rxchksum = rxdata; |
109 | rxchksum = rxdata; |
108 | if (rxdata == 0x81 ) { SPI_RXState = 1; } // 1. Syncbyte ok |
110 | if (rxdata == 0x81 ) { SPI_RXState = 1; } // 1. Syncbyte ok |
109 | 111 | ||
110 | break; |
112 | break; |
111 | 113 | ||
112 | case 1: |
114 | case 1: |
113 | if (rxdata == 0x55) { rxchksum += rxdata; SPI_RXState = 2; } // 2. Syncbyte ok |
115 | if (rxdata == 0x55) { rxchksum += rxdata; SPI_RXState = 2; } // 2. Syncbyte ok |
114 | else SPI_RXState = 0; |
116 | else SPI_RXState = 0; |
115 | break; |
117 | break; |
116 | 118 | ||
117 | case 2: |
119 | case 2: |
118 | SPI_Buffer[SPI_RxBufferIndex++]= rxdata; // get data |
120 | SPI_Buffer[SPI_RxBufferIndex++]= rxdata; // get data |
119 | //DebugOut.Analog[19]++; |
121 | //DebugOut.Analog[19]++; |
120 | if (SPI_RxBufferIndex >= sizeof(FromNaviCtrl)) |
122 | if (SPI_RxBufferIndex >= sizeof(FromNaviCtrl)) |
121 | { |
123 | { |
122 | 124 | ||
123 | if (rxdata == rxchksum) |
125 | if (rxdata == rxchksum) |
124 | { |
126 | { |
125 | unsigned char *ptr = (unsigned char *)&FromNaviCtrl; |
127 | unsigned char *ptr = (unsigned char *)&FromNaviCtrl; |
126 | memcpy(ptr, (unsigned char *) SPI_Buffer, sizeof(SPI_Buffer)); |
128 | memcpy(ptr, (unsigned char *) SPI_Buffer, sizeof(SPI_Buffer)); |
127 | SPI_RxDataValid = 1; |
129 | SPI_RxDataValid = 1; |
128 | } |
130 | } |
129 | else |
131 | else |
130 | { |
132 | { |
131 | SPI_RxDataValid = 0; |
133 | SPI_RxDataValid = 0; |
132 | } |
134 | } |
133 | 135 | ||
134 | 136 | ||
135 | SPI_RXState = 0; |
137 | SPI_RXState = 0; |
136 | } |
138 | } |
137 | else rxchksum += rxdata; |
139 | else rxchksum += rxdata; |
138 | break; |
140 | break; |
139 | 141 | ||
140 | } |
142 | } |
141 | 143 | ||
142 | if (SPI_BufferIndex < sizeof(ToNaviCtrl)) |
144 | if (SPI_BufferIndex < sizeof(ToNaviCtrl)) |
143 | { |
145 | { |
144 | SLAVE_SELECT_PORT &= ~(1 << SPI_SLAVE_SELECT); // SelectSlave |
146 | SLAVE_SELECT_PORT &= ~(1 << SPI_SLAVE_SELECT); // SelectSlave |
145 | asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); |
147 | asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); |
146 | asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); |
148 | asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); |
147 | asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); |
149 | asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); |
148 | 150 | ||
149 | SPDR = SPI_TX_Buffer[SPI_BufferIndex]; |
151 | SPDR = SPI_TX_Buffer[SPI_BufferIndex]; |
150 | ToNaviCtrl.Chksum += SPI_TX_Buffer[SPI_BufferIndex]; |
152 | ToNaviCtrl.Chksum += SPI_TX_Buffer[SPI_BufferIndex]; |
151 | // SLAVE_SELECT_PORT |= (1 << SPI_SLAVE_SELECT); // DeselectSlave |
153 | // SLAVE_SELECT_PORT |= (1 << SPI_SLAVE_SELECT); // DeselectSlave |
152 | 154 | ||
153 | } |
155 | } |
154 | else SPITransferCompleted = 1; |
156 | else SPITransferCompleted = 1; |
155 | 157 | ||
156 | SPI_BufferIndex++; |
158 | SPI_BufferIndex++; |
157 | } |
159 | } |
158 | 160 | ||
159 | 161 | ||
160 | //------------------------------------------------------ |
162 | //------------------------------------------------------ |
161 | void UpdateSPI_Buffer(void) |
163 | void UpdateSPI_Buffer(void) |
162 | { |
164 | { |
163 | signed int tmp; |
165 | signed int tmp; |
164 | static unsigned char motorindex; |
166 | static unsigned char motorindex; |
165 | ToNaviCtrl.IntegralNick = (int) (IntegralNick / (long)(EE_Parameter.GyroAccFaktor * 4)); |
167 | ToNaviCtrl.IntegralNick = (int) (IntegralNick / (long)(EE_Parameter.GyroAccFaktor * 4)); |
166 | ToNaviCtrl.IntegralRoll = (int) (IntegralRoll / (long)(EE_Parameter.GyroAccFaktor * 4)); |
168 | ToNaviCtrl.IntegralRoll = (int) (IntegralRoll / (long)(EE_Parameter.GyroAccFaktor * 4)); |
167 | ToNaviCtrl.GyroCompass = (10 * ErsatzKompass) / GIER_GRAD_FAKTOR; |
169 | ToNaviCtrl.GyroCompass = (10 * ErsatzKompass) / GIER_GRAD_FAKTOR; |
168 | ToNaviCtrl.GyroGier = (signed int) AdNeutralGier - AdWertGier; |
170 | ToNaviCtrl.GyroGier = (signed int) AdNeutralGier - AdWertGier; |
169 | ToNaviCtrl.AccNick = ((int) ACC_AMPLIFY * (NaviAccNick / NaviCntAcc))/4; |
171 | ToNaviCtrl.AccNick = ((int) ACC_AMPLIFY * (NaviAccNick / NaviCntAcc))/4; |
170 | ToNaviCtrl.AccRoll = ((int) ACC_AMPLIFY * (NaviAccRoll / NaviCntAcc))/4; |
172 | ToNaviCtrl.AccRoll = ((int) ACC_AMPLIFY * (NaviAccRoll / NaviCntAcc))/4; |
171 | NaviCntAcc = 0; NaviAccNick = 0; NaviAccRoll = 0; |
173 | NaviCntAcc = 0; NaviAccNick = 0; NaviAccRoll = 0; |
172 | // ToNaviCtrl.User8 = Parameter_UserParam8; |
174 | // ToNaviCtrl.User8 = Parameter_UserParam8; |
173 | // ToNaviCtrl.CalState = WinkelOut.CalcState; |
175 | // ToNaviCtrl.CalState = WinkelOut.CalcState; |
174 | switch(ToNaviCtrl.Command) // |
176 | switch(ToNaviCtrl.Command) // |
175 | { |
177 | { |
176 | case SPI_FCCMD_USER: |
178 | case SPI_FCCMD_USER: |
177 | ToNaviCtrl.Param.Byte[0] = Parameter_UserParam1; |
179 | ToNaviCtrl.Param.Byte[0] = Parameter_UserParam1; |
178 | ToNaviCtrl.Param.Byte[1] = Parameter_UserParam2; |
180 | ToNaviCtrl.Param.Byte[1] = Parameter_UserParam2; |
179 | ToNaviCtrl.Param.Byte[2] = Parameter_UserParam3; |
181 | ToNaviCtrl.Param.Byte[2] = Parameter_UserParam3; |
180 | ToNaviCtrl.Param.Byte[3] = Parameter_UserParam4; |
182 | ToNaviCtrl.Param.Byte[3] = Parameter_UserParam4; |
181 | ToNaviCtrl.Param.Byte[4] = Parameter_UserParam5; |
183 | ToNaviCtrl.Param.Byte[4] = Parameter_UserParam5; |
182 | ToNaviCtrl.Param.Byte[5] = Parameter_UserParam6; |
184 | ToNaviCtrl.Param.Byte[5] = Parameter_UserParam6; |
183 | ToNaviCtrl.Param.Byte[6] = Parameter_UserParam7; |
185 | ToNaviCtrl.Param.Byte[6] = Parameter_UserParam7; |
184 | ToNaviCtrl.Param.Byte[7] = Parameter_UserParam8; |
186 | ToNaviCtrl.Param.Byte[7] = Parameter_UserParam8; |
185 | ToNaviCtrl.Param.Byte[8] = FC_StatusFlags; |
187 | ToNaviCtrl.Param.Byte[8] = FC_StatusFlags; |
186 | FC_StatusFlags &= ~(FC_STATUS_CALIBRATE | FC_STATUS_START); |
188 | FC_StatusFlags &= ~(FC_STATUS_CALIBRATE | FC_STATUS_START); |
187 | ToNaviCtrl.Param.Byte[9] = GetActiveParamSet(); |
189 | ToNaviCtrl.Param.Byte[9] = GetActiveParamSet(); |
188 | ToNaviCtrl.Param.Byte[10] = EE_Parameter.ComingHomeAltitude; |
190 | ToNaviCtrl.Param.Byte[10] = EE_Parameter.ComingHomeAltitude; |
189 | ToNaviCtrl.Param.Byte[11] = FC_StatusFlags2; |
191 | ToNaviCtrl.Param.Byte[11] = FC_StatusFlags2; |
190 | break; |
192 | break; |
191 | 193 | ||
192 | case SPI_FCCMD_ACCU: |
194 | case SPI_FCCMD_ACCU: |
193 | ToNaviCtrl.Param.Int[0] = Capacity.ActualCurrent; // 0.1A |
195 | ToNaviCtrl.Param.Int[0] = Capacity.ActualCurrent; // 0.1A |
194 | ToNaviCtrl.Param.Int[1] = Capacity.UsedCapacity; // mAh |
196 | ToNaviCtrl.Param.Int[1] = Capacity.UsedCapacity; // mAh |
195 | ToNaviCtrl.Param.Byte[4] = (unsigned char) UBat; // 0.1V |
197 | ToNaviCtrl.Param.Byte[4] = (unsigned char) UBat; // 0.1V |
196 | ToNaviCtrl.Param.Byte[5] = (unsigned char) BattLowVoltageWarning; //0.1V |
198 | ToNaviCtrl.Param.Byte[5] = (unsigned char) BattLowVoltageWarning; //0.1V |
197 | ToNaviCtrl.Param.Byte[6] = VarioCharacter; |
199 | ToNaviCtrl.Param.Byte[6] = VarioCharacter; |
198 | ToNaviCtrl.Param.Byte[7] = Parameter_GlobalConfig; |
200 | ToNaviCtrl.Param.Byte[7] = Parameter_GlobalConfig; |
199 | ToNaviCtrl.Param.Byte[8] = Parameter_ExtraConfig; |
201 | ToNaviCtrl.Param.Byte[8] = Parameter_ExtraConfig; |
200 | ToNaviCtrl.Param.Byte[9] = motorindex; |
202 | ToNaviCtrl.Param.Byte[9] = motorindex; |
201 | ToNaviCtrl.Param.Byte[10] = Motor[motorindex].Temperature; |
203 | ToNaviCtrl.Param.Byte[10] = Motor[motorindex].Temperature; |
202 | ToNaviCtrl.Param.Byte[11] = Motor[motorindex++].Current; |
204 | ToNaviCtrl.Param.Byte[11] = Motor[motorindex++].Current; |
203 | motorindex %= 12; |
205 | motorindex %= 12; |
204 | break; |
206 | break; |
205 | case SPI_FCCMD_PARAMETER1: |
207 | case SPI_FCCMD_PARAMETER1: |
206 | ToNaviCtrl.Param.Byte[0] = EE_Parameter.NaviGpsModeControl; // Parameters for the Naviboard |
208 | ToNaviCtrl.Param.Byte[0] = EE_Parameter.NaviGpsModeControl; // Parameters for the Naviboard |
207 | ToNaviCtrl.Param.Byte[1] = EE_Parameter.NaviGpsGain; |
209 | ToNaviCtrl.Param.Byte[1] = EE_Parameter.NaviGpsGain; |
208 | ToNaviCtrl.Param.Byte[2] = EE_Parameter.NaviGpsP; |
210 | ToNaviCtrl.Param.Byte[2] = EE_Parameter.NaviGpsP; |
209 | ToNaviCtrl.Param.Byte[3] = EE_Parameter.NaviGpsI; |
211 | ToNaviCtrl.Param.Byte[3] = EE_Parameter.NaviGpsI; |
210 | ToNaviCtrl.Param.Byte[4] = EE_Parameter.NaviGpsD; |
212 | ToNaviCtrl.Param.Byte[4] = EE_Parameter.NaviGpsD; |
211 | ToNaviCtrl.Param.Byte[5] = EE_Parameter.NaviGpsACC; |
213 | ToNaviCtrl.Param.Byte[5] = EE_Parameter.NaviGpsACC; |
212 | ToNaviCtrl.Param.Byte[6] = EE_Parameter.NaviGpsMinSat; |
214 | ToNaviCtrl.Param.Byte[6] = EE_Parameter.NaviGpsMinSat; |
213 | ToNaviCtrl.Param.Byte[7] = EE_Parameter.NaviStickThreshold; |
215 | ToNaviCtrl.Param.Byte[7] = EE_Parameter.NaviStickThreshold; |
214 | ToNaviCtrl.Param.Byte[8] = EE_Parameter.NaviOperatingRadius; |
216 | ToNaviCtrl.Param.Byte[8] = EE_Parameter.NaviOperatingRadius; |
215 | ToNaviCtrl.Param.Byte[9] = EE_Parameter.NaviWindCorrection; |
217 | ToNaviCtrl.Param.Byte[9] = EE_Parameter.NaviWindCorrection; |
216 | ToNaviCtrl.Param.Byte[10] = EE_Parameter.NaviAccCompensation; |
218 | ToNaviCtrl.Param.Byte[10] = EE_Parameter.NaviAccCompensation; |
217 | ToNaviCtrl.Param.Byte[11] = EE_Parameter.NaviAngleLimitation; |
219 | ToNaviCtrl.Param.Byte[11] = EE_Parameter.NaviAngleLimitation; |
218 | break; |
220 | break; |
219 | 221 | ||
220 | case SPI_FCCMD_STICK: |
222 | case SPI_FCCMD_STICK: |
221 | cli(); |
223 | cli(); |
222 | tmp = PPM_in[EE_Parameter.Kanalbelegung[K_GAS]]; if(tmp > 127) tmp = 127; else if(tmp < -127) tmp = -127; |
224 | tmp = PPM_in[EE_Parameter.Kanalbelegung[K_GAS]]; if(tmp > 127) tmp = 127; else if(tmp < -127) tmp = -127; |
223 | ToNaviCtrl.Param.Byte[0] = (char) tmp; |
225 | ToNaviCtrl.Param.Byte[0] = (char) tmp; |
224 | tmp = PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]; if(tmp > 127) tmp = 127; else if(tmp < -127) tmp = -127; |
226 | tmp = PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]; if(tmp > 127) tmp = 127; else if(tmp < -127) tmp = -127; |
225 | ToNaviCtrl.Param.Byte[1] = (char) tmp; |
227 | ToNaviCtrl.Param.Byte[1] = (char) tmp; |
226 | tmp = PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]]; if(tmp > 127) tmp = 127; else if(tmp < -127) tmp = -127; |
228 | tmp = PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]]; if(tmp > 127) tmp = 127; else if(tmp < -127) tmp = -127; |
227 | ToNaviCtrl.Param.Byte[2] = (char) tmp; |
229 | ToNaviCtrl.Param.Byte[2] = (char) tmp; |
228 | tmp = PPM_in[EE_Parameter.Kanalbelegung[K_NICK]]; if(tmp > 127) tmp = 127; else if(tmp < -127) tmp = -127; |
230 | tmp = PPM_in[EE_Parameter.Kanalbelegung[K_NICK]]; if(tmp > 127) tmp = 127; else if(tmp < -127) tmp = -127; |
229 | sei(); |
231 | sei(); |
230 | ToNaviCtrl.Param.Byte[3] = (char) tmp; |
232 | ToNaviCtrl.Param.Byte[3] = (char) tmp; |
231 | ToNaviCtrl.Param.Byte[4] = (unsigned char) Poti[0]; |
233 | ToNaviCtrl.Param.Byte[4] = (unsigned char) Poti[0]; |
232 | ToNaviCtrl.Param.Byte[5] = (unsigned char) Poti[1]; |
234 | ToNaviCtrl.Param.Byte[5] = (unsigned char) Poti[1]; |
233 | ToNaviCtrl.Param.Byte[6] = (unsigned char) Poti[2]; |
235 | ToNaviCtrl.Param.Byte[6] = (unsigned char) Poti[2]; |
234 | ToNaviCtrl.Param.Byte[7] = (unsigned char) Poti[3]; |
236 | ToNaviCtrl.Param.Byte[7] = (unsigned char) Poti[3]; |
235 | ToNaviCtrl.Param.Byte[8] = (unsigned char) Poti[4]; |
237 | ToNaviCtrl.Param.Byte[8] = (unsigned char) Poti[4]; |
236 | ToNaviCtrl.Param.Byte[9] = (unsigned char) Poti[5]; |
238 | ToNaviCtrl.Param.Byte[9] = (unsigned char) Poti[5]; |
237 | ToNaviCtrl.Param.Byte[10] = (unsigned char) Poti[6]; |
239 | ToNaviCtrl.Param.Byte[10] = (unsigned char) Poti[6]; |
238 | ToNaviCtrl.Param.Byte[11] = (unsigned char) Poti[7]; |
240 | ToNaviCtrl.Param.Byte[11] = (unsigned char) Poti[7]; |
239 | break; |
241 | break; |
240 | case SPI_FCCMD_MISC: |
242 | case SPI_FCCMD_MISC: |
241 | if(WinkelOut.CalcState > 5) |
243 | if(WinkelOut.CalcState > 5) |
242 | { |
244 | { |
243 | WinkelOut.CalcState = 0; |
245 | WinkelOut.CalcState = 0; |
244 | ToNaviCtrl.Param.Byte[0] = 5; |
246 | ToNaviCtrl.Param.Byte[0] = 5; |
245 | } |
247 | } |
246 | else ToNaviCtrl.Param.Byte[0] = WinkelOut.CalcState; |
248 | else ToNaviCtrl.Param.Byte[0] = WinkelOut.CalcState; |
247 | ToNaviCtrl.Param.Byte[1] = EE_Parameter.NaviPH_LoginTime; |
249 | ToNaviCtrl.Param.Byte[1] = EE_Parameter.NaviPH_LoginTime; |
248 | ToNaviCtrl.Param.Int[1] = (int)(HoehenWert/5); |
250 | ToNaviCtrl.Param.Int[1] = (int)(HoehenWert/5); |
249 | ToNaviCtrl.Param.Int[2] = (int)(SollHoehe/5); |
251 | ToNaviCtrl.Param.Int[2] = (int)(SollHoehe/5); |
250 | ToNaviCtrl.Param.Byte[6] = EE_Parameter.NaviGpsPLimit; |
252 | ToNaviCtrl.Param.Byte[6] = EE_Parameter.NaviGpsPLimit; |
251 | ToNaviCtrl.Param.Byte[7] = EE_Parameter.NaviGpsILimit; |
253 | ToNaviCtrl.Param.Byte[7] = EE_Parameter.NaviGpsILimit; |
252 | ToNaviCtrl.Param.Byte[8] = EE_Parameter.NaviGpsDLimit; |
254 | ToNaviCtrl.Param.Byte[8] = EE_Parameter.NaviGpsDLimit; |
253 | ToNaviCtrl.Param.Byte[9] = (unsigned char) SenderOkay; |
255 | ToNaviCtrl.Param.Byte[9] = (unsigned char) SenderOkay; |
254 | ToNaviCtrl.Param.Byte[10] = (unsigned char) PPM_in[0]; |
256 | ToNaviCtrl.Param.Byte[10] = (unsigned char) PPM_in[0]; |
255 | ToNaviCtrl.Param.Byte[11] = DebugOut.Analog[7] / 4; //GasMischanteil |
257 | ToNaviCtrl.Param.Byte[11] = DebugOut.Analog[7] / 4; //GasMischanteil |
256 | break; |
258 | break; |
257 | case SPI_FCCMD_VERSION: |
259 | case SPI_FCCMD_VERSION: |
258 | ToNaviCtrl.Param.Byte[0] = VERSION_MAJOR; |
260 | ToNaviCtrl.Param.Byte[0] = VERSION_MAJOR; |
259 | ToNaviCtrl.Param.Byte[1] = VERSION_MINOR; |
261 | ToNaviCtrl.Param.Byte[1] = VERSION_MINOR; |
260 | ToNaviCtrl.Param.Byte[2] = VERSION_PATCH; |
262 | ToNaviCtrl.Param.Byte[2] = VERSION_PATCH; |
261 | ToNaviCtrl.Param.Byte[3] = NC_SPI_COMPATIBLE; |
263 | ToNaviCtrl.Param.Byte[3] = NC_SPI_COMPATIBLE; |
262 | ToNaviCtrl.Param.Byte[4] = PlatinenVersion; |
264 | ToNaviCtrl.Param.Byte[4] = PlatinenVersion; |
263 | ToNaviCtrl.Param.Byte[5] = VersionInfo.HardwareError[0]; |
265 | ToNaviCtrl.Param.Byte[5] = VersionInfo.HardwareError[0]; |
264 | ToNaviCtrl.Param.Byte[6] = VersionInfo.HardwareError[1]; |
266 | ToNaviCtrl.Param.Byte[6] = VersionInfo.HardwareError[1]; |
265 | VersionInfo.HardwareError[0] = 0; |
267 | VersionInfo.HardwareError[0] = 0; |
266 | VersionInfo.HardwareError[1] &= FC_ERROR1_MIXER; |
268 | VersionInfo.HardwareError[1] &= FC_ERROR1_MIXER; |
267 | ToNaviCtrl.Param.Byte[7] = VersionInfo.HardwareError[2]; |
269 | ToNaviCtrl.Param.Byte[7] = VersionInfo.HardwareError[2]; |
268 | ToNaviCtrl.Param.Byte[8] = VersionInfo.HardwareError[3]; |
270 | ToNaviCtrl.Param.Byte[8] = VersionInfo.HardwareError[3]; |
269 | ToNaviCtrl.Param.Byte[9] = VersionInfo.HardwareError[4]; |
271 | ToNaviCtrl.Param.Byte[9] = VersionInfo.HardwareError[4]; |
270 | ToNaviCtrl.Param.Byte[10] = EE_Parameter.OrientationAngle; |
272 | ToNaviCtrl.Param.Byte[10] = EE_Parameter.OrientationAngle; |
271 | break; |
273 | break; |
272 | case SPI_FCCMD_SERVOS: |
274 | case SPI_FCCMD_SERVOS: |
273 | ToNaviCtrl.Param.Byte[0] = EE_Parameter.ServoNickRefresh; // Parameters for the Servo Control |
275 | ToNaviCtrl.Param.Byte[0] = EE_Parameter.ServoNickRefresh; // Parameters for the Servo Control |
274 | ToNaviCtrl.Param.Byte[1] = EE_Parameter.ServoCompInvert; |
276 | ToNaviCtrl.Param.Byte[1] = EE_Parameter.ServoCompInvert; |
275 | ToNaviCtrl.Param.Byte[2] = Parameter_ServoNickControl; |
277 | ToNaviCtrl.Param.Byte[2] = Parameter_ServoNickControl; |
276 | ToNaviCtrl.Param.Byte[3] = EE_Parameter.ServoNickComp; |
278 | ToNaviCtrl.Param.Byte[3] = EE_Parameter.ServoNickComp; |
277 | ToNaviCtrl.Param.Byte[4] = EE_Parameter.ServoNickMin; |
279 | ToNaviCtrl.Param.Byte[4] = EE_Parameter.ServoNickMin; |
278 | ToNaviCtrl.Param.Byte[5] = EE_Parameter.ServoNickMax; |
280 | ToNaviCtrl.Param.Byte[5] = EE_Parameter.ServoNickMax; |
279 | ToNaviCtrl.Param.Byte[6] = Parameter_ServoRollControl; |
281 | ToNaviCtrl.Param.Byte[6] = Parameter_ServoRollControl; |
280 | ToNaviCtrl.Param.Byte[7] = EE_Parameter.ServoRollComp; |
282 | ToNaviCtrl.Param.Byte[7] = EE_Parameter.ServoRollComp; |
281 | ToNaviCtrl.Param.Byte[8] = EE_Parameter.ServoRollMin; |
283 | ToNaviCtrl.Param.Byte[8] = EE_Parameter.ServoRollMin; |
282 | ToNaviCtrl.Param.Byte[9] = EE_Parameter.ServoRollMax; |
284 | ToNaviCtrl.Param.Byte[9] = EE_Parameter.ServoRollMax; |
283 | ToNaviCtrl.Param.Byte[10] = Capacity.MinOfMaxPWM; |
285 | ToNaviCtrl.Param.Byte[10] = Capacity.MinOfMaxPWM; |
284 | ToNaviCtrl.Param.Byte[11] = DebugOut.Analog[28]; // I2C-Error counter |
286 | ToNaviCtrl.Param.Byte[11] = DebugOut.Analog[28]; // I2C-Error counter |
285 | break; |
287 | break; |
286 | } |
288 | } |
287 | 289 | ||
288 | if(SPI_RxDataValid) |
290 | if(SPI_RxDataValid) |
289 | { |
291 | { |
290 | NaviDataOkay = 250; |
292 | NaviDataOkay = 250; |
291 | CalculateCompassTimer = 1; |
293 | CalculateCompassTimer = 1; |
292 | if(abs(FromNaviCtrl.GPS_Nick) < 512 && abs(FromNaviCtrl.GPS_Roll) < 512 && (EE_Parameter.GlobalConfig & CFG_GPS_AKTIV)) |
294 | if(abs(FromNaviCtrl.GPS_Nick) < 512 && abs(FromNaviCtrl.GPS_Roll) < 512 && (EE_Parameter.GlobalConfig & CFG_GPS_AKTIV)) |
293 | { |
295 | { |
294 | GPS_Nick = FromNaviCtrl.GPS_Nick; |
296 | GPS_Nick = FromNaviCtrl.GPS_Nick; |
295 | GPS_Roll = FromNaviCtrl.GPS_Roll; |
297 | GPS_Roll = FromNaviCtrl.GPS_Roll; |
296 | } |
298 | } |
297 | 299 | ||
298 | // update compass readings |
300 | // update compass readings |
299 | // MagVec.x = FromNaviCtrl.MagVecX; |
301 | // MagVec.x = FromNaviCtrl.MagVecX; |
300 | // MagVec.y = FromNaviCtrl.MagVecY; |
302 | // MagVec.y = FromNaviCtrl.MagVecY; |
301 | // MagVec.z = FromNaviCtrl.MagVecZ; |
303 | // MagVec.z = FromNaviCtrl.MagVecZ; |
302 | 304 | ||
303 | if(FromNaviCtrl.CompassValue <= 360) KompassValue = FromNaviCtrl.CompassValue; |
305 | if(FromNaviCtrl.CompassValue <= 360) KompassValue = FromNaviCtrl.CompassValue; |
304 | // KompassRichtung = ((540 + KompassValue - KompassSollWert) % 360) - 180; |
306 | // KompassRichtung = ((540 + KompassValue - KompassSollWert) % 360) - 180; |
305 | 307 | ||
306 | if(FromNaviCtrl.BeepTime > beeptime /*&& !WinkelOut.CalcState*/) beeptime = FromNaviCtrl.BeepTime; |
308 | if(FromNaviCtrl.BeepTime > beeptime /*&& !WinkelOut.CalcState*/) beeptime = FromNaviCtrl.BeepTime; |
307 | switch (FromNaviCtrl.Command) |
309 | switch (FromNaviCtrl.Command) |
308 | { |
310 | { |
309 | case SPI_NCCMD_KALMAN: |
311 | case SPI_NCCMD_KALMAN: |
310 | FromNaviCtrl_Value.Kalman_K = FromNaviCtrl.Param.sByte[0]; |
312 | FromNaviCtrl_Value.Kalman_K = FromNaviCtrl.Param.sByte[0]; |
311 | FromNaviCtrl_Value.Kalman_MaxFusion = FromNaviCtrl.Param.sByte[1]; |
313 | FromNaviCtrl_Value.Kalman_MaxFusion = FromNaviCtrl.Param.sByte[1]; |
312 | FromNaviCtrl_Value.Kalman_MaxDrift = FromNaviCtrl.Param.sByte[2]; |
314 | FromNaviCtrl_Value.Kalman_MaxDrift = FromNaviCtrl.Param.sByte[2]; |
313 | KompassFusion = FromNaviCtrl.Param.sByte[3]; |
315 | KompassFusion = FromNaviCtrl.Param.sByte[3]; |
314 | FromNaviCtrl_Value.GpsZ = FromNaviCtrl.Param.Byte[4]; |
316 | FromNaviCtrl_Value.GpsZ = FromNaviCtrl.Param.Byte[4]; |
315 | FromNC_Rotate_C = FromNaviCtrl.Param.Byte[5]; |
317 | FromNC_Rotate_C = FromNaviCtrl.Param.Byte[5]; |
316 | FromNC_Rotate_S = FromNaviCtrl.Param.Byte[6]; |
318 | FromNC_Rotate_S = FromNaviCtrl.Param.Byte[6]; |
317 | GPS_Aid_StickMultiplikator = FromNaviCtrl.Param.Byte[7]; |
319 | GPS_Aid_StickMultiplikator = FromNaviCtrl.Param.Byte[7]; |
318 | if(CareFree && FromNaviCtrl.Param.sInt[4] >= 0) |
320 | if(CareFree && FromNaviCtrl.Param.sInt[4] >= 0) |
319 | { |
321 | { |
320 | KompassSollWert = FromNaviCtrl.Param.sInt[4]; // bei Carefree kann NC den Kompass-Sollwinkel vorgeben |
322 | KompassSollWert = FromNaviCtrl.Param.sInt[4]; // bei Carefree kann NC den Kompass-Sollwinkel vorgeben |
321 | if(EE_Parameter.CamOrientation) // Kamera angle is not front |
323 | if(EE_Parameter.CamOrientation) // Kamera angle is not front |
322 | { |
324 | { |
323 | KompassSollWert += 360 - ((unsigned int) EE_Parameter.CamOrientation * 15); |
325 | KompassSollWert += 360 - ((unsigned int) EE_Parameter.CamOrientation * 15); |
324 | KompassSollWert %= 360; |
326 | KompassSollWert %= 360; |
325 | } |
327 | } |
326 | } |
328 | } |
327 | POI_KameraNick = (POI_KameraNick + FromNaviCtrl.Param.sInt[5]) / 2; // FromNaviCtrl.Param.sInt[5]; // Nickwinkel |
329 | POI_KameraNick = (POI_KameraNick + FromNaviCtrl.Param.sInt[5]) / 2; // FromNaviCtrl.Param.sInt[5]; // Nickwinkel |
328 | break; |
330 | break; |
329 | case SPI_NCCMD_VERSION: |
331 | case SPI_NCCMD_VERSION: |
330 | NC_Version.Major = FromNaviCtrl.Param.Byte[0]; |
332 | NC_Version.Major = FromNaviCtrl.Param.Byte[0]; |
331 | NC_Version.Minor = FromNaviCtrl.Param.Byte[1]; |
333 | NC_Version.Minor = FromNaviCtrl.Param.Byte[1]; |
332 | NC_Version.Patch = FromNaviCtrl.Param.Byte[2]; |
334 | NC_Version.Patch = FromNaviCtrl.Param.Byte[2]; |
333 | NC_Version.Compatible = FromNaviCtrl.Param.Byte[3]; |
335 | NC_Version.Compatible = FromNaviCtrl.Param.Byte[3]; |
334 | NC_Version.Hardware = FromNaviCtrl.Param.Byte[4]; |
336 | NC_Version.Hardware = FromNaviCtrl.Param.Byte[4]; |
335 | DebugOut.Status[0] |= FromNaviCtrl.Param.Byte[5]; |
337 | DebugOut.Status[0] |= FromNaviCtrl.Param.Byte[5]; |
336 | DebugOut.Status[1] = (DebugOut.Status[1] & (0x01|0x02)) | (FromNaviCtrl.Param.Byte[6] & (0x04 | 0x08)); |
338 | DebugOut.Status[1] = (DebugOut.Status[1] & (0x01|0x02)) | (FromNaviCtrl.Param.Byte[6] & (0x04 | 0x08)); |
337 | NC_ErrorCode = FromNaviCtrl.Param.Byte[7]; |
339 | NC_ErrorCode = FromNaviCtrl.Param.Byte[7]; |
338 | NC_GPS_ModeCharacter = FromNaviCtrl.Param.Byte[8]; |
340 | NC_GPS_ModeCharacter = FromNaviCtrl.Param.Byte[8]; |
339 | FromNaviCtrl_Value.SerialDataOkay = FromNaviCtrl.Param.Byte[9]; |
341 | FromNaviCtrl_Value.SerialDataOkay = FromNaviCtrl.Param.Byte[9]; |
- | 342 | // = FromNaviCtrl.Param.Byte[10]; |
|
- | 343 | // = FromNaviCtrl.Param.Byte[11]; |
|
340 | break; |
344 | break; |
341 | case SPI_NCCMD_GPSINFO: |
345 | case SPI_NCCMD_GPSINFO: |
342 | GPSInfo.Flags = FromNaviCtrl.Param.Byte[0]; |
346 | GPSInfo.Flags = FromNaviCtrl.Param.Byte[0]; |
343 | GPSInfo.NumOfSats = FromNaviCtrl.Param.Byte[1]; |
347 | GPSInfo.NumOfSats = FromNaviCtrl.Param.Byte[1]; |
344 | GPSInfo.SatFix = FromNaviCtrl.Param.Byte[2]; |
348 | GPSInfo.SatFix = FromNaviCtrl.Param.Byte[2]; |
345 | GPSInfo.Speed = FromNaviCtrl.Param.Byte[3]; |
349 | GPSInfo.Speed = FromNaviCtrl.Param.Byte[3]; |
346 | GPSInfo.HomeDistance = FromNaviCtrl.Param.Int[2]; |
350 | GPSInfo.HomeDistance = FromNaviCtrl.Param.Int[2]; |
347 | GPSInfo.HomeBearing = FromNaviCtrl.Param.sInt[3]; |
351 | GPSInfo.HomeBearing = FromNaviCtrl.Param.sInt[3]; |
348 | PPM_in[25] = (signed char) FromNaviCtrl.Param.Byte[8]; // WP_EVENT-Channel-Value |
352 | PPM_in[25] = (signed char) FromNaviCtrl.Param.Byte[8]; // WP_EVENT-Channel-Value |
349 | FromNC_AltitudeSpeed = FromNaviCtrl.Param.Byte[9]; |
353 | FromNC_AltitudeSpeed = FromNaviCtrl.Param.Byte[9]; |
350 | FromNC_AltitudeSetpoint = (long) FromNaviCtrl.Param.sInt[5] * 10; // in cm |
354 | FromNC_AltitudeSetpoint = (long) FromNaviCtrl.Param.sInt[5] * 10; // in cm |
351 | break; |
355 | break; |
- | 356 | case SPI_MISC: |
|
- | 357 | EarthMagneticField = FromNaviCtrl.Param.Byte[0]; |
|
- | 358 | EarthMagneticInclination = FromNaviCtrl.Param.Byte[1]; |
|
- | 359 | EarthMagneticInclinationTheoretic = FromNaviCtrl.Param.Byte[2]; |
|
- | 360 | break; |
|
- | 361 | ||
352 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
362 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
353 | case SPI_NCCMD_HOTT_DATA: |
363 | case SPI_NCCMD_HOTT_DATA: |
354 | if(EE_Parameter.Receiver == RECEIVER_HOTT) NC_Fills_HoTT_Telemety(); |
364 | if(EE_Parameter.Receiver == RECEIVER_HOTT) NC_Fills_HoTT_Telemety(); |
355 | break; |
365 | break; |
356 | #endif |
366 | #endif |
357 | 367 | ||
358 | // 0 = 0,1 |
368 | // 0 = 0,1 |
359 | // 1 = 2,3 |
369 | // 1 = 2,3 |
360 | // 2 = 4,5 |
370 | // 2 = 4,5 |
361 | // 3 = 6,7 |
371 | // 3 = 6,7 |
362 | // 4 = 8,9 |
372 | // 4 = 8,9 |
363 | // 5 = 10,11 |
373 | // 5 = 10,11 |
364 | default: |
374 | default: |
365 | break; |
375 | break; |
366 | } |
376 | } |
367 | } |
377 | } |
368 | else |
378 | else |
369 | { |
379 | { |
370 | // KompassValue = 0; |
380 | // KompassValue = 0; |
371 | // KompassRichtung = 0; |
381 | // KompassRichtung = 0; |
372 | GPS_Nick = 0; |
382 | GPS_Nick = 0; |
373 | GPS_Roll = 0; |
383 | GPS_Roll = 0; |
374 | } |
384 | } |
375 | } |
385 | } |
376 | 386 | ||
377 | #endif |
387 | #endif |
378 | 388 | ||
379 | 389 | ||
380 | 390 |