Rev 1236 | Rev 1243 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1236 | Rev 1241 | ||
---|---|---|---|
Line 16... | Line 16... | ||
16 | unsigned char *SPI_TX_Buffer; |
16 | unsigned char *SPI_TX_Buffer; |
Line 17... | Line 17... | ||
17 | 17 | ||
18 | unsigned char SPITransferCompleted, SPI_ChkSum; |
18 | unsigned char SPITransferCompleted, SPI_ChkSum; |
Line 19... | Line 19... | ||
19 | unsigned char SPI_RxDataValid,NaviDataOkay = 0; |
19 | unsigned char SPI_RxDataValid,NaviDataOkay = 0; |
20 | 20 | ||
Line 21... | Line 21... | ||
21 | unsigned char SPI_CommandSequence[] = { SPI_CMD_USER, SPI_CMD_STICK, SPI_CMD_PARAMETER1, SPI_CMD_STICK, SPI_CMD_MISC, SPI_CMD_VERSION }; |
21 | unsigned char SPI_CommandSequence[] = { SPI_CMD_USER, SPI_CMD_STICK, SPI_CMD_PARAMETER1, SPI_CMD_STICK, SPI_CMD_MISC, SPI_CMD_VERSION, SPI_CMD_SERVOS }; |
Line 22... | Line 22... | ||
22 | unsigned char SPI_CommandCounter = 0; |
22 | unsigned char SPI_CommandCounter = 0; |
Line 185... | Line 185... | ||
185 | MikroKopterFlags &= ~(FLAG_CALIBRATE | FLAG_START); |
185 | MikroKopterFlags &= ~(FLAG_CALIBRATE | FLAG_START); |
186 | ToNaviCtrl.Param.Byte[9] = (unsigned char) UBat; |
186 | ToNaviCtrl.Param.Byte[9] = (unsigned char) UBat; |
187 | ToNaviCtrl.Param.Byte[10] =(unsigned char) BattLowVoltageWarning; |
187 | ToNaviCtrl.Param.Byte[10] =(unsigned char) BattLowVoltageWarning; |
188 | ToNaviCtrl.Param.Byte[11] =(unsigned char) eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET]); |
188 | ToNaviCtrl.Param.Byte[11] =(unsigned char) eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET]); |
189 | break; |
189 | break; |
- | 190 | ||
190 | case SPI_CMD_PARAMETER1: |
191 | case SPI_CMD_PARAMETER1: |
191 | ToNaviCtrl.Param.Byte[0] = EE_Parameter.NaviGpsModeControl; // Parameters for the Naviboard |
192 | ToNaviCtrl.Param.Byte[0] = EE_Parameter.NaviGpsModeControl; // Parameters for the Naviboard |
192 | ToNaviCtrl.Param.Byte[1] = EE_Parameter.NaviGpsGain; |
193 | ToNaviCtrl.Param.Byte[1] = EE_Parameter.NaviGpsGain; |
193 | ToNaviCtrl.Param.Byte[2] = EE_Parameter.NaviGpsP; |
194 | ToNaviCtrl.Param.Byte[2] = EE_Parameter.NaviGpsP; |
194 | ToNaviCtrl.Param.Byte[3] = EE_Parameter.NaviGpsI; |
195 | ToNaviCtrl.Param.Byte[3] = EE_Parameter.NaviGpsI; |
Line 199... | Line 200... | ||
199 | ToNaviCtrl.Param.Byte[8] = EE_Parameter.NaviOperatingRadius; |
200 | ToNaviCtrl.Param.Byte[8] = EE_Parameter.NaviOperatingRadius; |
200 | ToNaviCtrl.Param.Byte[9] = EE_Parameter.NaviWindCorrection; |
201 | ToNaviCtrl.Param.Byte[9] = EE_Parameter.NaviWindCorrection; |
201 | ToNaviCtrl.Param.Byte[10] = EE_Parameter.NaviSpeedCompensation; |
202 | ToNaviCtrl.Param.Byte[10] = EE_Parameter.NaviSpeedCompensation; |
202 | ToNaviCtrl.Param.Byte[11] = EE_Parameter.NaviAngleLimitation; |
203 | ToNaviCtrl.Param.Byte[11] = EE_Parameter.NaviAngleLimitation; |
203 | break; |
204 | break; |
- | 205 | ||
204 | case SPI_CMD_STICK: |
206 | case SPI_CMD_STICK: |
205 | tmp = PPM_in[EE_Parameter.Kanalbelegung[K_GAS]]; if(tmp > 127) tmp = 127; else if(tmp < -127) tmp = -127; |
207 | tmp = PPM_in[EE_Parameter.Kanalbelegung[K_GAS]]; if(tmp > 127) tmp = 127; else if(tmp < -127) tmp = -127; |
206 | ToNaviCtrl.Param.Byte[0] = (char) tmp; |
208 | ToNaviCtrl.Param.Byte[0] = (char) tmp; |
207 | tmp = PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]; if(tmp > 127) tmp = 127; else if(tmp < -127) tmp = -127; |
209 | tmp = PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]; if(tmp > 127) tmp = 127; else if(tmp < -127) tmp = -127; |
208 | ToNaviCtrl.Param.Byte[1] = (char) tmp; |
210 | ToNaviCtrl.Param.Byte[1] = (char) tmp; |
Line 213... | Line 215... | ||
213 | ToNaviCtrl.Param.Byte[4] = (unsigned char) Poti1; |
215 | ToNaviCtrl.Param.Byte[4] = (unsigned char) Poti1; |
214 | ToNaviCtrl.Param.Byte[5] = (unsigned char) Poti2; |
216 | ToNaviCtrl.Param.Byte[5] = (unsigned char) Poti2; |
215 | ToNaviCtrl.Param.Byte[6] = (unsigned char) Poti3; |
217 | ToNaviCtrl.Param.Byte[6] = (unsigned char) Poti3; |
216 | ToNaviCtrl.Param.Byte[7] = (unsigned char) Poti4; |
218 | ToNaviCtrl.Param.Byte[7] = (unsigned char) Poti4; |
217 | ToNaviCtrl.Param.Byte[8] = (unsigned char) SenderOkay; |
219 | ToNaviCtrl.Param.Byte[8] = (unsigned char) SenderOkay; |
218 | break; |
220 | break; |
219 | case SPI_CMD_MISC: |
- | |
220 | if(WinkelOut.CalcState > 5) |
- | |
221 | { |
- | |
222 | WinkelOut.CalcState = 0; |
- | |
223 | ToNaviCtrl.Param.Byte[0] = 5; |
- | |
224 | } |
- | |
225 | else ToNaviCtrl.Param.Byte[0] = WinkelOut.CalcState; |
- | |
226 | ToNaviCtrl.Param.Int[1] = HoehenWert; |
- | |
227 | ToNaviCtrl.Param.Byte[1] = EE_Parameter.NaviPH_LoginTime; |
- | |
228 | ToNaviCtrl.Param.Byte[4] = EE_Parameter.NaviGpsPLimit; |
- | |
229 | ToNaviCtrl.Param.Byte[5] = EE_Parameter.NaviGpsILimit; |
- | |
230 | ToNaviCtrl.Param.Byte[6] = EE_Parameter.NaviGpsDLimit; |
- | |
231 | break; |
- | |
Line -... | Line 221... | ||
- | 221 | ||
- | 222 | case SPI_CMD_MISC: |
|
- | 223 | if(WinkelOut.CalcState > 5) |
|
- | 224 | { |
|
- | 225 | WinkelOut.CalcState = 0; |
|
- | 226 | ToNaviCtrl.Param.Byte[0] = 5; |
|
- | 227 | } |
|
- | 228 | else ToNaviCtrl.Param.Byte[0] = WinkelOut.CalcState; |
|
- | 229 | ToNaviCtrl.Param.Int[1] = HoehenWert; |
|
- | 230 | ToNaviCtrl.Param.Byte[1] = EE_Parameter.NaviPH_LoginTime; |
|
- | 231 | ToNaviCtrl.Param.Byte[4] = EE_Parameter.NaviGpsPLimit; |
|
- | 232 | ToNaviCtrl.Param.Byte[5] = EE_Parameter.NaviGpsILimit; |
|
- | 233 | ToNaviCtrl.Param.Byte[6] = EE_Parameter.NaviGpsDLimit; |
|
- | 234 | break; |
|
232 | 235 | ||
233 | case SPI_CMD_VERSION: |
236 | case SPI_CMD_VERSION: |
234 | ToNaviCtrl.Param.Byte[0] = SPI_VersionInfo.Major; |
237 | ToNaviCtrl.Param.Byte[0] = SPI_VersionInfo.Major; |
235 | ToNaviCtrl.Param.Byte[1] = SPI_VersionInfo.Minor; |
238 | ToNaviCtrl.Param.Byte[1] = SPI_VersionInfo.Minor; |
236 | ToNaviCtrl.Param.Byte[2] = SPI_VersionInfo.Patch; |
239 | ToNaviCtrl.Param.Byte[2] = SPI_VersionInfo.Patch; |
237 | ToNaviCtrl.Param.Byte[3] = SPI_VersionInfo.Compatible; |
240 | ToNaviCtrl.Param.Byte[3] = SPI_VersionInfo.Compatible; |
- | 241 | ToNaviCtrl.Param.Byte[4] = PlatinenVersion; |
|
- | 242 | break; |
|
- | 243 | ||
- | 244 | case SPI_CMD_SERVOS: |
|
- | 245 | ToNaviCtrl.Param.Byte[0] = EE_Parameter.ServoNickRefresh; // Parameters for the Servo Control |
|
- | 246 | ToNaviCtrl.Param.Byte[1] = EE_Parameter.ServoCompInvert; |
|
- | 247 | ToNaviCtrl.Param.Byte[2] = Parameter_ServoNickControl; |
|
- | 248 | ToNaviCtrl.Param.Byte[3] = EE_Parameter.ServoNickComp; |
|
- | 249 | ToNaviCtrl.Param.Byte[4] = EE_Parameter.ServoNickMin; |
|
- | 250 | ToNaviCtrl.Param.Byte[5] = EE_Parameter.ServoNickMax; |
|
- | 251 | ToNaviCtrl.Param.Byte[6] = Parameter_ServoRollControl; |
|
- | 252 | ToNaviCtrl.Param.Byte[7] = EE_Parameter.ServoRollComp; |
|
- | 253 | ToNaviCtrl.Param.Byte[8] = EE_Parameter.ServoRollMin; |
|
238 | ToNaviCtrl.Param.Byte[4] = PlatinenVersion; |
254 | ToNaviCtrl.Param.Byte[9] = EE_Parameter.ServoRollMax; |
- | 255 | break; |
|
239 | break; |
256 | |
Line 240... | Line 257... | ||
240 | } |
257 | } |
Line 241... | Line 258... | ||
241 | 258 | ||
242 | sei(); |
259 | sei(); |
Line 261... | Line 278... | ||
261 | FromNaviCtrl_Value.Kalman_MaxFusion = FromNaviCtrl.Param.sByte[1]; |
278 | FromNaviCtrl_Value.Kalman_MaxFusion = FromNaviCtrl.Param.sByte[1]; |
262 | FromNaviCtrl_Value.Kalman_MaxDrift = FromNaviCtrl.Param.sByte[2]; |
279 | FromNaviCtrl_Value.Kalman_MaxDrift = FromNaviCtrl.Param.sByte[2]; |
263 | FromNaviCtrl_Value.SerialDataOkay = FromNaviCtrl.Param.Byte[3]; |
280 | FromNaviCtrl_Value.SerialDataOkay = FromNaviCtrl.Param.Byte[3]; |
264 | break; |
281 | break; |
Line 265... | Line -... | ||
265 | - | ||
266 | case SPI_EXTCTRL: |
- | |
267 | ExternControl.Digital[0] = FromNaviCtrl.Param.Byte[0]; |
- | |
268 | ExternControl.Digital[1] = FromNaviCtrl.Param.Byte[1]; |
- | |
269 | ExternControl.RemoteTasten = FromNaviCtrl.Param.Byte[2]; |
- | |
270 | ExternControl.Nick = FromNaviCtrl.Param.sByte[3]; |
- | |
271 | ExternControl.Roll = FromNaviCtrl.Param.sByte[4]; |
- | |
272 | ExternControl.Gier = FromNaviCtrl.Param.sByte[5]; |
- | |
273 | ExternControl.Gas = FromNaviCtrl.Param.Byte[6]; |
- | |
274 | ExternControl.Hight = FromNaviCtrl.Param.sByte[7]; |
- | |
275 | ExternControl.free = FromNaviCtrl.Param.Byte[8]; |
- | |
276 | ExternControl.Frame = FromNaviCtrl.Param.Byte[9]; |
- | |
277 | ExternControl.Config = FromNaviCtrl.Param.Byte[10]; |
- | |
278 | break; |
- | |
279 | 282 | ||
280 | default: |
283 | default: |
281 | break; |
284 | break; |
282 | } |
285 | } |
283 | } |
286 | } |