Rev 461 | Rev 463 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 461 | Rev 462 | ||
---|---|---|---|
Line 289... | Line 289... | ||
289 | static u32 timeout = 0; |
289 | static u32 timeout = 0; |
290 | static u8 counter = 50,hott_index = 0, last_error_code = 0, enable_injecting = 0; |
290 | static u8 counter = 50,hott_index = 0, last_error_code = 0, enable_injecting = 0; |
291 | static s16 last_wp_event = 0; |
291 | static s16 last_wp_event = 0; |
292 | s16 tmp; |
292 | s16 tmp; |
293 | s32 i1,i2; |
293 | s32 i1,i2; |
- | 294 | /* |
|
- | 295 | union |
|
294 | 296 | { |
|
- | 297 | unsigned char Byte[4]; |
|
- | 298 | unsigned int Int[2]; |
|
- | 299 | unsigned long Long; |
|
- | 300 | } Temp; |
|
- | 301 | */ |
|
295 | SPIWatchDog = 3500; // stop communication to FC after this timeout |
302 | SPIWatchDog = 3500; // stop communication to FC after this timeout |
296 | if(SPI_RxBuffer_Request) |
303 | if(SPI_RxBuffer_Request) |
297 | { |
304 | { |
298 | // avoid sending data via SPI during the update of the ToFlightCtrl structure |
305 | // avoid sending data via SPI during the update of the ToFlightCtrl structure |
299 | VIC_ITCmd(SSP0_ITLine, DISABLE); // disable SPI interrupt |
306 | VIC_ITCmd(SSP0_ITLine, DISABLE); // disable SPI interrupt |
Line 502... | Line 509... | ||
502 | ToFlightCtrl.Param.Byte[11] = HOTT_GENERAL_PACKET_ID; |
509 | ToFlightCtrl.Param.Byte[11] = HOTT_GENERAL_PACKET_ID; |
503 | ToFlightCtrl.Param.Byte[0] = 5+3; // index // +3, weil bei HoTT V4 3 Bytes eingeschoben wurden |
510 | ToFlightCtrl.Param.Byte[0] = 5+3; // index // +3, weil bei HoTT V4 3 Bytes eingeschoben wurden |
504 | ToFlightCtrl.Param.Byte[1] = 2; // how many |
511 | ToFlightCtrl.Param.Byte[1] = 2; // how many |
505 | ToFlightCtrl.Param.Byte[2] = EarthMagneticField / (5 * 2); |
512 | ToFlightCtrl.Param.Byte[2] = EarthMagneticField / (5 * 2); |
506 | ToFlightCtrl.Param.Byte[3] = EarthMagneticInclination / 2; |
513 | ToFlightCtrl.Param.Byte[3] = EarthMagneticInclination / 2; |
- | 514 | break; |
|
- | 515 | case 3: |
|
- | 516 | ToFlightCtrl.Param.Byte[11] = JETI_GPS_PACKET_ID1; |
|
- | 517 | ToFlightCtrl.Param.Byte[0] = 0; // index |
|
- | 518 | ToFlightCtrl.Param.Byte[1] = 4; // how many |
|
- | 519 | //JetiExData[14].Value = 53 * 0x10000 + 23467; |
|
- | 520 | if(GPSData.Position.Latitude < 0) ToFlightCtrl.Param.Byte[5] = 0x40; |
|
- | 521 | else ToFlightCtrl.Param.Byte[5] = 0x00; |
|
- | 522 | ToFlightCtrl.Param.Byte[4] = abs(GPSData.Position.Latitude)/10000000L; |
|
- | 523 | i2 = abs(GPSData.Position.Latitude)%10000000L; |
|
- | 524 | i2 *= 6; |
|
- | 525 | i2 /= 1000; |
|
- | 526 | ToFlightCtrl.Param.Byte[3] = i2 / 256; |
|
- | 527 | ToFlightCtrl.Param.Byte[2] = i2 % 256; |
|
- | 528 | break; |
|
- | 529 | case 4: |
|
- | 530 | ToFlightCtrl.Param.Byte[11] = JETI_GPS_PACKET_ID2; |
|
- | 531 | ToFlightCtrl.Param.Byte[0] = 0; // index |
|
- | 532 | ToFlightCtrl.Param.Byte[1] = 4; // how many |
|
- | 533 | if(GPSData.Position.Latitude < 0) ToFlightCtrl.Param.Byte[5] = 0x60; |
|
- | 534 | else ToFlightCtrl.Param.Byte[5] = 0x20; |
|
- | 535 | ToFlightCtrl.Param.Byte[4] = abs(GPSData.Position.Longitude)/10000000L; |
|
- | 536 | i2 = abs(GPSData.Position.Longitude)%10000000L; |
|
- | 537 | i2 *= 6; |
|
- | 538 | i2 /= 1000; |
|
- | 539 | ToFlightCtrl.Param.Byte[3] = i2 / 256; |
|
- | 540 | ToFlightCtrl.Param.Byte[2] = i2 % 256; |
|
507 | hott_index = 0; |
541 | hott_index = 0; |
508 | break; |
542 | break; |
509 | default: |
543 | default: |
510 | ToFlightCtrl.Param.Byte[0] = 255; |
544 | ToFlightCtrl.Param.Byte[0] = 255; |
511 | hott_index = 0; |
545 | hott_index = 0; |