Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
304 | ingob | 1 | // ######################## SPI - FlightCtrl ################### |
2 | #include "main.h" |
||
1622 | killagreg | 3 | #include "eeprom.h" |
304 | ingob | 4 | |
5 | |||
823 | ingob | 6 | //struct str_ToNaviCtrl_Version ToNaviCtrl_Version; |
7 | //struct str_FromNaviCtrl_Version FromNaviCtrl_Version; |
||
8 | struct str_ToNaviCtrl ToNaviCtrl; |
||
9 | struct str_FromNaviCtrl FromNaviCtrl; |
||
978 | hbuss | 10 | struct str_FromNaviCtrl_Value FromNaviCtrl_Value; |
1448 | killagreg | 11 | struct str_SPI_VersionInfo NC_Version; |
1451 | killagreg | 12 | struct str_GPSInfo GPSInfo; |
708 | ingob | 13 | |
304 | ingob | 14 | unsigned char SPI_BufferIndex; |
708 | ingob | 15 | unsigned char SPI_RxBufferIndex; |
1668 | holgerb | 16 | signed char FromNC_Rotate_C = 32, FromNC_Rotate_S = 0; |
606 | ingob | 17 | |
882 | hbuss | 18 | volatile unsigned char SPI_Buffer[sizeof(FromNaviCtrl)]; |
823 | ingob | 19 | unsigned char *SPI_TX_Buffer; |
708 | ingob | 20 | |
617 | ingob | 21 | unsigned char SPITransferCompleted, SPI_ChkSum; |
1690 | holgerb | 22 | unsigned char SPI_RxDataValid,NaviDataOkay = 250; |
720 | ingob | 23 | |
1509 | killagreg | 24 | 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}; |
823 | ingob | 25 | unsigned char SPI_CommandCounter = 0; |
1703 | holgerb | 26 | unsigned char NC_ErrorCode = 0; |
1840 | holgerb | 27 | signed int POI_KameraNick = 0; // in 0,1° |
823 | ingob | 28 | |
597 | ingob | 29 | #ifdef USE_SPI_COMMUNICATION |
691 | ingob | 30 | |
304 | ingob | 31 | //------------------------------------------------------ |
32 | void SPI_MasterInit(void) |
||
33 | { |
||
1051 | killagreg | 34 | DDR_SPI |= (1<<DD_MOSI)|(1<<DD_SCK); // Set MOSI and SCK output, all others input |
304 | ingob | 35 | SLAVE_SELECT_DDR_PORT |= (1 << SPI_SLAVE_SELECT); |
1051 | killagreg | 36 | |
37 | SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR1)|(0<<SPR0)|(0<<SPIE); // Enable SPI, Master, set clock rate fck/64 |
||
723 | hbuss | 38 | SPSR = 0;//(1<<SPI2X); |
1051 | killagreg | 39 | |
40 | SLAVE_SELECT_PORT |= (1 << SPI_SLAVE_SELECT); |
||
606 | ingob | 41 | SPITransferCompleted = 1; |
1051 | killagreg | 42 | |
708 | ingob | 43 | //SPDR = 0x00; // dummy write |
1051 | killagreg | 44 | |
823 | ingob | 45 | ToNaviCtrl.Sync1 = 0xAA; |
46 | ToNaviCtrl.Sync2 = 0x83; |
||
1051 | killagreg | 47 | |
1448 | killagreg | 48 | ToNaviCtrl.Command = SPI_FCCMD_USER; |
823 | ingob | 49 | ToNaviCtrl.IntegralNick = 0; |
50 | ToNaviCtrl.IntegralRoll = 0; |
||
1215 | hbuss | 51 | FromNaviCtrl_Value.SerialDataOkay = 0; |
1051 | killagreg | 52 | SPI_RxDataValid = 0; |
53 | |||
304 | ingob | 54 | } |
55 | |||
56 | //------------------------------------------------------ |
||
823 | ingob | 57 | void SPI_StartTransmitPacket(void) |
304 | ingob | 58 | { |
606 | ingob | 59 | //if ((SLAVE_SELECT_PORT & (1 << SPI_SLAVE_SELECT)) == 0) return; // transfer of prev. packet not completed |
60 | if (!SPITransferCompleted) return; |
||
1051 | killagreg | 61 | // _delay_us(30); |
62 | |||
304 | ingob | 63 | SLAVE_SELECT_PORT &= ~(1 << SPI_SLAVE_SELECT); // SelectSlave |
823 | ingob | 64 | SPI_TX_Buffer = (unsigned char *) &ToNaviCtrl; |
1051 | killagreg | 65 | |
823 | ingob | 66 | ToNaviCtrl.Command = SPI_CommandSequence[SPI_CommandCounter++]; |
67 | if (SPI_CommandCounter >= sizeof(SPI_CommandSequence)) SPI_CommandCounter = 0; |
||
1051 | killagreg | 68 | |
606 | ingob | 69 | SPITransferCompleted = 0; |
304 | ingob | 70 | UpdateSPI_Buffer(); // update buffer |
823 | ingob | 71 | |
304 | ingob | 72 | SPI_BufferIndex = 1; |
1051 | killagreg | 73 | //ebugOut.Analog[16]++; |
304 | ingob | 74 | // -- Debug-Output --- |
75 | //---- |
||
691 | ingob | 76 | asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); |
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"); |
||
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"); |
||
823 | ingob | 79 | ToNaviCtrl.Chksum = ToNaviCtrl.Sync1; |
1051 | killagreg | 80 | SPDR = ToNaviCtrl.Sync1; // Start transmission |
691 | ingob | 81 | // SLAVE_SELECT_PORT |= (1 << SPI_SLAVE_SELECT); // DeselectSlave |
82 | |||
304 | ingob | 83 | } |
84 | |||
85 | //------------------------------------------------------ |
||
86 | //SIGNAL(SIG_SPI) |
||
87 | void SPI_TransmitByte(void) |
||
88 | { |
||
708 | ingob | 89 | static unsigned char SPI_RXState = 0; |
1051 | killagreg | 90 | unsigned char rxdata; |
708 | ingob | 91 | static unsigned char rxchksum; |
1051 | killagreg | 92 | |
691 | ingob | 93 | if (SPITransferCompleted) return; |
304 | ingob | 94 | if (!(SPSR & (1 << SPIF))) return; |
1051 | killagreg | 95 | SendSPI = 4; |
96 | |||
97 | // _delay_us(30); |
||
606 | ingob | 98 | SLAVE_SELECT_PORT |= (1 << SPI_SLAVE_SELECT); // DeselectSlave |
1051 | killagreg | 99 | |
708 | ingob | 100 | rxdata = SPDR; |
101 | switch ( SPI_RXState) |
||
102 | { |
||
1051 | killagreg | 103 | case 0: |
104 | |||
105 | SPI_RxBufferIndex = 0; |
||
106 | rxchksum = rxdata; |
||
107 | if (rxdata == 0x81 ) { SPI_RXState = 1; } // 1. Syncbyte ok |
||
108 | |||
708 | ingob | 109 | break; |
110 | |||
1051 | killagreg | 111 | case 1: |
112 | if (rxdata == 0x55) { rxchksum += rxdata; SPI_RXState = 2; } // 2. Syncbyte ok |
||
113 | else SPI_RXState = 0; |
||
114 | break; |
||
115 | |||
708 | ingob | 116 | case 2: |
117 | SPI_Buffer[SPI_RxBufferIndex++]= rxdata; // get data |
||
118 | //DebugOut.Analog[19]++; |
||
1051 | killagreg | 119 | if (SPI_RxBufferIndex >= sizeof(FromNaviCtrl)) |
120 | { |
||
121 | |||
708 | ingob | 122 | if (rxdata == rxchksum) |
123 | { |
||
823 | ingob | 124 | unsigned char *ptr = (unsigned char *)&FromNaviCtrl; |
1051 | killagreg | 125 | |
708 | ingob | 126 | memcpy(ptr, (unsigned char *) SPI_Buffer, sizeof(SPI_Buffer)); |
1051 | killagreg | 127 | |
128 | SPI_RxDataValid = 1; |
||
129 | } |
||
130 | else SPI_RxDataValid = 0; |
||
131 | |||
132 | SPI_RXState = 0; |
||
708 | ingob | 133 | } |
1051 | killagreg | 134 | else rxchksum += rxdata; |
135 | break; |
||
136 | |||
137 | } |
||
138 | |||
139 | if (SPI_BufferIndex < sizeof(ToNaviCtrl)) |
||
140 | { |
||
606 | ingob | 141 | SLAVE_SELECT_PORT &= ~(1 << SPI_SLAVE_SELECT); // SelectSlave |
691 | ingob | 142 | asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); |
143 | asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); |
||
144 | asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); |
||
1051 | killagreg | 145 | |
708 | ingob | 146 | SPDR = SPI_TX_Buffer[SPI_BufferIndex]; |
823 | ingob | 147 | ToNaviCtrl.Chksum += SPI_TX_Buffer[SPI_BufferIndex]; |
691 | ingob | 148 | // SLAVE_SELECT_PORT |= (1 << SPI_SLAVE_SELECT); // DeselectSlave |
149 | |||
606 | ingob | 150 | } |
1051 | killagreg | 151 | else SPITransferCompleted = 1; |
152 | |||
304 | ingob | 153 | SPI_BufferIndex++; |
154 | } |
||
155 | |||
691 | ingob | 156 | |
304 | ingob | 157 | //------------------------------------------------------ |
158 | void UpdateSPI_Buffer(void) |
||
159 | { |
||
846 | hbuss | 160 | signed int tmp; |
1171 | hbuss | 161 | ToNaviCtrl.IntegralNick = (int) (IntegralNick / (long)(EE_Parameter.GyroAccFaktor * 4)); |
162 | ToNaviCtrl.IntegralRoll = (int) (IntegralRoll / (long)(EE_Parameter.GyroAccFaktor * 4)); |
||
163 | ToNaviCtrl.GyroCompass = (10 * ErsatzKompass) / GIER_GRAD_FAKTOR; |
||
1664 | holgerb | 164 | ToNaviCtrl.GyroGier = (signed int) AdNeutralGier - AdWertGier; |
1171 | hbuss | 165 | ToNaviCtrl.AccNick = ((int) ACC_AMPLIFY * (NaviAccNick / NaviCntAcc))/4; |
166 | ToNaviCtrl.AccRoll = ((int) ACC_AMPLIFY * (NaviAccRoll / NaviCntAcc))/4; |
||
819 | hbuss | 167 | NaviCntAcc = 0; NaviAccNick = 0; NaviAccRoll = 0; |
823 | ingob | 168 | // ToNaviCtrl.User8 = Parameter_UserParam8; |
169 | // ToNaviCtrl.CalState = WinkelOut.CalcState; |
||
1051 | killagreg | 170 | switch(ToNaviCtrl.Command) // |
823 | ingob | 171 | { |
1448 | killagreg | 172 | case SPI_FCCMD_USER: |
823 | ingob | 173 | ToNaviCtrl.Param.Byte[0] = Parameter_UserParam1; |
174 | ToNaviCtrl.Param.Byte[1] = Parameter_UserParam2; |
||
175 | ToNaviCtrl.Param.Byte[2] = Parameter_UserParam3; |
||
176 | ToNaviCtrl.Param.Byte[3] = Parameter_UserParam4; |
||
177 | ToNaviCtrl.Param.Byte[4] = Parameter_UserParam5; |
||
178 | ToNaviCtrl.Param.Byte[5] = Parameter_UserParam6; |
||
179 | ToNaviCtrl.Param.Byte[6] = Parameter_UserParam7; |
||
921 | hbuss | 180 | ToNaviCtrl.Param.Byte[7] = Parameter_UserParam8; |
1765 | killagreg | 181 | ToNaviCtrl.Param.Byte[8] = FC_StatusFlags; |
182 | FC_StatusFlags &= ~(FC_STATUS_CALIBRATE | FC_STATUS_START); |
||
1622 | killagreg | 183 | ToNaviCtrl.Param.Byte[9] = GetActiveParamSet(); |
1668 | holgerb | 184 | ToNaviCtrl.Param.Byte[10] = ControlHeading; |
921 | hbuss | 185 | break; |
1241 | killagreg | 186 | |
1508 | killagreg | 187 | case SPI_FCCMD_ACCU: |
188 | ToNaviCtrl.Param.Int[0] = Capacity.ActualCurrent; // 0.1A |
||
189 | ToNaviCtrl.Param.Int[1] = Capacity.UsedCapacity; // mAh |
||
190 | ToNaviCtrl.Param.Byte[4] = (unsigned char) UBat; // 0.1V |
||
191 | ToNaviCtrl.Param.Byte[5] = (unsigned char) BattLowVoltageWarning; //0.1V |
||
192 | break; |
||
193 | |||
1448 | killagreg | 194 | case SPI_FCCMD_PARAMETER1: |
993 | hbuss | 195 | ToNaviCtrl.Param.Byte[0] = EE_Parameter.NaviGpsModeControl; // Parameters for the Naviboard |
1051 | killagreg | 196 | ToNaviCtrl.Param.Byte[1] = EE_Parameter.NaviGpsGain; |
197 | ToNaviCtrl.Param.Byte[2] = EE_Parameter.NaviGpsP; |
||
198 | ToNaviCtrl.Param.Byte[3] = EE_Parameter.NaviGpsI; |
||
199 | ToNaviCtrl.Param.Byte[4] = EE_Parameter.NaviGpsD; |
||
200 | ToNaviCtrl.Param.Byte[5] = EE_Parameter.NaviGpsACC; |
||
201 | ToNaviCtrl.Param.Byte[6] = EE_Parameter.NaviGpsMinSat; |
||
202 | ToNaviCtrl.Param.Byte[7] = EE_Parameter.NaviStickThreshold; |
||
993 | hbuss | 203 | ToNaviCtrl.Param.Byte[8] = EE_Parameter.NaviOperatingRadius; |
204 | ToNaviCtrl.Param.Byte[9] = EE_Parameter.NaviWindCorrection; |
||
205 | ToNaviCtrl.Param.Byte[10] = EE_Parameter.NaviSpeedCompensation; |
||
1064 | hbuss | 206 | ToNaviCtrl.Param.Byte[11] = EE_Parameter.NaviAngleLimitation; |
823 | ingob | 207 | break; |
1241 | killagreg | 208 | |
1448 | killagreg | 209 | case SPI_FCCMD_STICK: |
1320 | hbuss | 210 | cli(); |
871 | hbuss | 211 | tmp = PPM_in[EE_Parameter.Kanalbelegung[K_GAS]]; if(tmp > 127) tmp = 127; else if(tmp < -127) tmp = -127; |
846 | hbuss | 212 | ToNaviCtrl.Param.Byte[0] = (char) tmp; |
871 | hbuss | 213 | tmp = PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]; if(tmp > 127) tmp = 127; else if(tmp < -127) tmp = -127; |
846 | hbuss | 214 | ToNaviCtrl.Param.Byte[1] = (char) tmp; |
871 | hbuss | 215 | tmp = PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]]; if(tmp > 127) tmp = 127; else if(tmp < -127) tmp = -127; |
846 | hbuss | 216 | ToNaviCtrl.Param.Byte[2] = (char) tmp; |
871 | hbuss | 217 | tmp = PPM_in[EE_Parameter.Kanalbelegung[K_NICK]]; if(tmp > 127) tmp = 127; else if(tmp < -127) tmp = -127; |
1320 | hbuss | 218 | sei(); |
846 | hbuss | 219 | ToNaviCtrl.Param.Byte[3] = (char) tmp; |
1377 | hbuss | 220 | ToNaviCtrl.Param.Byte[4] = (unsigned char) Poti[0]; |
221 | ToNaviCtrl.Param.Byte[5] = (unsigned char) Poti[1]; |
||
222 | ToNaviCtrl.Param.Byte[6] = (unsigned char) Poti[2]; |
||
223 | ToNaviCtrl.Param.Byte[7] = (unsigned char) Poti[3]; |
||
224 | ToNaviCtrl.Param.Byte[8] = (unsigned char) Poti[4]; |
||
225 | ToNaviCtrl.Param.Byte[9] = (unsigned char) Poti[5]; |
||
226 | ToNaviCtrl.Param.Byte[10] = (unsigned char) Poti[6]; |
||
227 | ToNaviCtrl.Param.Byte[11] = (unsigned char) Poti[7]; |
||
1241 | killagreg | 228 | break; |
1448 | killagreg | 229 | case SPI_FCCMD_MISC: |
1241 | killagreg | 230 | if(WinkelOut.CalcState > 5) |
231 | { |
||
232 | WinkelOut.CalcState = 0; |
||
233 | ToNaviCtrl.Param.Byte[0] = 5; |
||
234 | } |
||
235 | else ToNaviCtrl.Param.Byte[0] = WinkelOut.CalcState; |
||
1312 | hbuss | 236 | ToNaviCtrl.Param.Byte[1] = EE_Parameter.NaviPH_LoginTime; |
1662 | killagreg | 237 | ToNaviCtrl.Param.Int[1] = (int)(HoehenWert/5); |
1312 | hbuss | 238 | ToNaviCtrl.Param.Int[2] = (int)(SollHoehe/5); |
239 | ToNaviCtrl.Param.Byte[6] = EE_Parameter.NaviGpsPLimit; |
||
240 | ToNaviCtrl.Param.Byte[7] = EE_Parameter.NaviGpsILimit; |
||
241 | ToNaviCtrl.Param.Byte[8] = EE_Parameter.NaviGpsDLimit; |
||
1377 | hbuss | 242 | ToNaviCtrl.Param.Byte[9] = (unsigned char) SenderOkay; |
1600 | killagreg | 243 | ToNaviCtrl.Param.Byte[10] = (unsigned char) PPM_in[0]; |
1377 | hbuss | 244 | ToNaviCtrl.Param.Byte[11] = DebugOut.Analog[7] / 4; //GasMischanteil |
1241 | killagreg | 245 | break; |
1448 | killagreg | 246 | case SPI_FCCMD_VERSION: |
247 | ToNaviCtrl.Param.Byte[0] = VERSION_MAJOR; |
||
248 | ToNaviCtrl.Param.Byte[1] = VERSION_MINOR; |
||
249 | ToNaviCtrl.Param.Byte[2] = VERSION_PATCH; |
||
250 | ToNaviCtrl.Param.Byte[3] = NC_SPI_COMPATIBLE; |
||
1241 | killagreg | 251 | ToNaviCtrl.Param.Byte[4] = PlatinenVersion; |
1702 | holgerb | 252 | ToNaviCtrl.Param.Byte[5] = VersionInfo.HardwareError[0]; |
253 | ToNaviCtrl.Param.Byte[6] = VersionInfo.HardwareError[1]; |
||
254 | ToNaviCtrl.Param.Byte[7] = VersionInfo.HardwareError[2]; |
||
1765 | killagreg | 255 | ToNaviCtrl.Param.Byte[8] = VersionInfo.HardwareError[3]; |
256 | ToNaviCtrl.Param.Byte[9] = VersionInfo.HardwareError[4]; |
||
1241 | killagreg | 257 | break; |
1448 | killagreg | 258 | case SPI_FCCMD_SERVOS: |
1241 | killagreg | 259 | ToNaviCtrl.Param.Byte[0] = EE_Parameter.ServoNickRefresh; // Parameters for the Servo Control |
260 | ToNaviCtrl.Param.Byte[1] = EE_Parameter.ServoCompInvert; |
||
261 | ToNaviCtrl.Param.Byte[2] = Parameter_ServoNickControl; |
||
262 | ToNaviCtrl.Param.Byte[3] = EE_Parameter.ServoNickComp; |
||
263 | ToNaviCtrl.Param.Byte[4] = EE_Parameter.ServoNickMin; |
||
264 | ToNaviCtrl.Param.Byte[5] = EE_Parameter.ServoNickMax; |
||
265 | ToNaviCtrl.Param.Byte[6] = Parameter_ServoRollControl; |
||
266 | ToNaviCtrl.Param.Byte[7] = EE_Parameter.ServoRollComp; |
||
267 | ToNaviCtrl.Param.Byte[8] = EE_Parameter.ServoRollMin; |
||
268 | ToNaviCtrl.Param.Byte[9] = EE_Parameter.ServoRollMax; |
||
269 | break; |
||
270 | } |
||
271 | |||
1215 | hbuss | 272 | if(SPI_RxDataValid) |
1051 | killagreg | 273 | { |
1536 | killagreg | 274 | NaviDataOkay = 250; |
1839 | holgerb | 275 | CalculateCompassTimer = 1; |
855 | hbuss | 276 | if(abs(FromNaviCtrl.GPS_Nick) < 512 && abs(FromNaviCtrl.GPS_Roll) < 512 && (EE_Parameter.GlobalConfig & CFG_GPS_AKTIV)) |
854 | hbuss | 277 | { |
823 | ingob | 278 | GPS_Nick = FromNaviCtrl.GPS_Nick; |
279 | GPS_Roll = FromNaviCtrl.GPS_Roll; |
||
854 | hbuss | 280 | } |
1690 | holgerb | 281 | |
282 | if(FromNaviCtrl.CompassValue <= 360) KompassValue = FromNaviCtrl.CompassValue; |
||
1837 | holgerb | 283 | KompassRichtung = ((540 + KompassValue - KompassSollWert) % 360) - 180; |
1051 | killagreg | 284 | |
1834 | holgerb | 285 | if(FromNaviCtrl.BeepTime > beeptime /*&& !WinkelOut.CalcState*/) beeptime = FromNaviCtrl.BeepTime; |
1051 | killagreg | 286 | |
823 | ingob | 287 | switch (FromNaviCtrl.Command) |
288 | { |
||
1448 | killagreg | 289 | case SPI_NCCMD_KALMAN: |
1231 | killagreg | 290 | FromNaviCtrl_Value.Kalman_K = FromNaviCtrl.Param.sByte[0]; |
291 | FromNaviCtrl_Value.Kalman_MaxFusion = FromNaviCtrl.Param.sByte[1]; |
||
292 | FromNaviCtrl_Value.Kalman_MaxDrift = FromNaviCtrl.Param.sByte[2]; |
||
293 | FromNaviCtrl_Value.SerialDataOkay = FromNaviCtrl.Param.Byte[3]; |
||
1283 | hbuss | 294 | FromNaviCtrl_Value.GpsZ = FromNaviCtrl.Param.Byte[4]; |
1664 | holgerb | 295 | FromNC_Rotate_C = FromNaviCtrl.Param.Byte[5]; |
296 | FromNC_Rotate_S = FromNaviCtrl.Param.Byte[6]; |
||
1837 | holgerb | 297 | // = FromNaviCtrl.Param.Byte[7]; noch frei |
1848 | holgerb | 298 | POI_KameraNick = (POI_KameraNick + FromNaviCtrl.Param.sInt[5]) / 2; // Nickwinkel |
1850 | holgerb | 299 | if(CareFree && FromNaviCtrl.Param.sInt[4] >= 0) |
1840 | holgerb | 300 | { |
301 | KompassSollWert = FromNaviCtrl.Param.sInt[4]; // bei Carefree kann NC den Kompass-Sollwinkel vorgeben |
||
302 | } |
||
1231 | killagreg | 303 | break; |
1448 | killagreg | 304 | case SPI_NCCMD_VERSION: |
305 | NC_Version.Major = FromNaviCtrl.Param.Byte[0]; |
||
306 | NC_Version.Minor = FromNaviCtrl.Param.Byte[1]; |
||
307 | NC_Version.Patch = FromNaviCtrl.Param.Byte[2]; |
||
308 | NC_Version.Compatible = FromNaviCtrl.Param.Byte[3]; |
||
309 | NC_Version.Hardware = FromNaviCtrl.Param.Byte[4]; |
||
1702 | holgerb | 310 | DebugOut.Status[0] |= FromNaviCtrl.Param.Byte[5]; |
1703 | holgerb | 311 | NC_ErrorCode = FromNaviCtrl.Param.Byte[6]; |
1702 | holgerb | 312 | DebugOut.Status[1] = (DebugOut.Status[1] & (0x01|0x02)) | (FromNaviCtrl.Param.Byte[6] & (0x04 | 0x08)); |
1448 | killagreg | 313 | break; |
1451 | killagreg | 314 | |
315 | case SPI_NCCMD_GPSINFO: |
||
316 | GPSInfo.Flags = FromNaviCtrl.Param.Byte[0]; |
||
317 | GPSInfo.NumOfSats = FromNaviCtrl.Param.Byte[1]; |
||
318 | GPSInfo.SatFix = FromNaviCtrl.Param.Byte[2]; |
||
1690 | holgerb | 319 | GPSInfo.Speed = FromNaviCtrl.Param.Byte[3]; |
1787 | holgerb | 320 | GPSInfo.HomeDistance = FromNaviCtrl.Param.Int[2]; |
1472 | killagreg | 321 | GPSInfo.HomeBearing = FromNaviCtrl.Param.sInt[3]; |
1790 | holgerb | 322 | PPM_in[25] = (signed char) FromNaviCtrl.Param.Byte[8]; // WP_EVENT-Channel-Value |
1451 | killagreg | 323 | break; |
324 | |||
823 | ingob | 325 | default: |
1451 | killagreg | 326 | break; |
823 | ingob | 327 | } |
720 | ingob | 328 | } |
329 | else |
||
330 | { |
||
819 | hbuss | 331 | // KompassValue = 0; |
332 | // KompassRichtung = 0; |
||
720 | ingob | 333 | GPS_Nick = 0; |
334 | GPS_Roll = 0; |
||
335 | } |
||
304 | ingob | 336 | } |
337 | |||
597 | ingob | 338 | #endif |
304 | ingob | 339 | |
340 |