Rev 461 | Rev 463 | Go to most recent revision | Show entire file | Ignore 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 441... | Line 448... | ||
441 | case SPI_NCCMD_HOTT_INFO: |
448 | case SPI_NCCMD_HOTT_INFO: |
442 | switch(hott_index++) |
449 | switch(hott_index++) |
443 | { |
450 | { |
444 | case 0: |
451 | case 0: |
445 | //Dezimalgrad --> Grad mit Dezimalminuten --> Grad, Minuten, Sekunden |
452 | //Dezimalgrad --> Grad mit Dezimalminuten --> Grad, Minuten, Sekunden |
446 | //53.285788 7.4847269 --> N53° 17.14728 E7° 29.08362 --> N53° 17' 8.837" E7° 29' 5.017" |
453 | //53.28 5788 7.4847269 --> N53° 17.14728 E7° 29.08362 --> N53° 17' 8.837" E7° 29' 5.017" |
447 | ToFlightCtrl.Param.Byte[11] = HOTT_GPS_PACKET_ID; |
454 | ToFlightCtrl.Param.Byte[11] = HOTT_GPS_PACKET_ID; |
448 | ToFlightCtrl.Param.Byte[0] = 3+3; // index +3, weil bei HoTT V4 3 Bytes eingeschoben wurden |
455 | ToFlightCtrl.Param.Byte[0] = 3+3; // index +3, weil bei HoTT V4 3 Bytes eingeschoben wurden |
449 | ToFlightCtrl.Param.Byte[1] = 9-1; // how many |
456 | ToFlightCtrl.Param.Byte[1] = 9-1; // how many |
450 | //----------------------------- |
457 | //----------------------------- |
451 | ToFlightCtrl.Param.Byte[2] = FromFlightCtrl.GyroHeading / 20;//NaviData.HomePositionDeviation.Bearing / 2; |
458 | ToFlightCtrl.Param.Byte[2] = FromFlightCtrl.GyroHeading / 20;//NaviData.HomePositionDeviation.Bearing / 2; |
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; |
512 | break; |
546 | break; |