Rev 487 | Rev 490 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 487 | Rev 489 | ||
---|---|---|---|
Line 5... | Line 5... | ||
5 | // + www.MikroKopter.com |
5 | // + www.MikroKopter.com |
6 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
6 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7 | // + Software Nutzungsbedingungen (english version: see below) |
7 | // + Software Nutzungsbedingungen (english version: see below) |
8 | // + der Fa. HiSystems GmbH, Flachsmeerstrasse 2, 26802 Moormerland - nachfolgend Lizenzgeber genannt - |
8 | // + der Fa. HiSystems GmbH, Flachsmeerstrasse 2, 26802 Moormerland - nachfolgend Lizenzgeber genannt - |
9 | // + Der Lizenzgeber räumt dem Kunden ein nicht-ausschließliches, zeitlich und räumlich* unbeschränktes Recht ein, die im den |
9 | // + Der Lizenzgeber räumt dem Kunden ein nicht-ausschließliches, zeitlich und räumlich* unbeschränktes Recht ein, die im den |
10 | // + Mikrocontroller verwendete Firmware für die Hardware Flight-Ctrl, Navi-Ctrl, BL-Ctrl, MK3Mag & PC-Programm MikroKopter-Tool |
10 | // + Mikrocontroller verwendete Firmware für die Hardware Flight-Ctrl, Navi-Ctrl, BL-Ctrl, MK3Mag & PC-Programm MikroKopter-Tool |
11 | // + - nachfolgend Software genannt - nur für private Zwecke zu nutzen. |
11 | // + - nachfolgend Software genannt - nur für private Zwecke zu nutzen. |
12 | // + Der Einsatz dieser Software ist nur auf oder mit Produkten des Lizenzgebers zulässig. |
12 | // + Der Einsatz dieser Software ist nur auf oder mit Produkten des Lizenzgebers zulässig. |
13 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
13 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
14 | // + Die vom Lizenzgeber gelieferte Software ist urheberrechtlich geschützt. Alle Rechte an der Software sowie an sonstigen im |
14 | // + Die vom Lizenzgeber gelieferte Software ist urheberrechtlich geschützt. Alle Rechte an der Software sowie an sonstigen im |
15 | // + Rahmen der Vertragsanbahnung und Vertragsdurchführung überlassenen Unterlagen stehen im Verhältnis der Vertragspartner ausschließlich dem Lizenzgeber zu. |
15 | // + Rahmen der Vertragsanbahnung und Vertragsdurchführung überlassenen Unterlagen stehen im Verhältnis der Vertragspartner ausschließlich dem Lizenzgeber zu. |
16 | // + Die in der Software enthaltenen Copyright-Vermerke, Markenzeichen, andere Rechtsvorbehalte, Seriennummern sowie |
16 | // + Die in der Software enthaltenen Copyright-Vermerke, Markenzeichen, andere Rechtsvorbehalte, Seriennummern sowie |
17 | // + sonstige der Programmidentifikation dienenden Merkmale dürfen vom Kunden nicht verändert oder unkenntlich gemacht werden. |
17 | // + sonstige der Programmidentifikation dienenden Merkmale dürfen vom Kunden nicht verändert oder unkenntlich gemacht werden. |
18 | // + Der Kunde trifft angemessene Vorkehrungen für den sicheren Einsatz der Software. Er wird die Software gründlich auf deren |
18 | // + Der Kunde trifft angemessene Vorkehrungen für den sicheren Einsatz der Software. Er wird die Software gründlich auf deren |
19 | // + Verwendbarkeit zu dem von ihm beabsichtigten Zweck testen, bevor er diese operativ einsetzt. |
19 | // + Verwendbarkeit zu dem von ihm beabsichtigten Zweck testen, bevor er diese operativ einsetzt. |
20 | // + Die Haftung des Lizenzgebers wird - soweit gesetzlich zulässig - begrenzt in Höhe des typischen und vorhersehbaren |
20 | // + Die Haftung des Lizenzgebers wird - soweit gesetzlich zulässig - begrenzt in Höhe des typischen und vorhersehbaren |
21 | // + Schadens. Die gesetzliche Haftung bei Personenschäden und nach dem Produkthaftungsgesetz bleibt unberührt. Dem Lizenzgeber steht jedoch der Einwand |
21 | // + Schadens. Die gesetzliche Haftung bei Personenschäden und nach dem Produkthaftungsgesetz bleibt unberührt. Dem Lizenzgeber steht jedoch der Einwand |
22 | // + des Mitverschuldens offen. |
22 | // + des Mitverschuldens offen. |
23 | // + Der Kunde trifft angemessene Vorkehrungen für den Fall, dass die Software ganz oder teilweise nicht ordnungsgemäß arbeitet. |
23 | // + Der Kunde trifft angemessene Vorkehrungen für den Fall, dass die Software ganz oder teilweise nicht ordnungsgemäß arbeitet. |
24 | // + Er wird die Software gründlich auf deren Verwendbarkeit zu dem von ihm beabsichtigten Zweck testen, bevor er diese operativ einsetzt. |
24 | // + Er wird die Software gründlich auf deren Verwendbarkeit zu dem von ihm beabsichtigten Zweck testen, bevor er diese operativ einsetzt. |
25 | // + Der Kunde wird er seine Daten vor Einsatz der Software nach dem Stand der Technik sichern. |
25 | // + Der Kunde wird er seine Daten vor Einsatz der Software nach dem Stand der Technik sichern. |
26 | // + Der Kunde ist darüber unterrichtet, dass der Lizenzgeber seine Daten im zur Vertragsdurchführung erforderlichen Umfang |
26 | // + Der Kunde ist darüber unterrichtet, dass der Lizenzgeber seine Daten im zur Vertragsdurchführung erforderlichen Umfang |
Line 30... | Line 30... | ||
30 | // + Hinweis: Informationen über erweiterte Nutzungsrechte (wie z.B. Nutzung für nicht-private Zwecke) sind auf Anfrage per Email an info(@)hisystems.de verfügbar. |
30 | // + Hinweis: Informationen über erweiterte Nutzungsrechte (wie z.B. Nutzung für nicht-private Zwecke) sind auf Anfrage per Email an info(@)hisystems.de verfügbar. |
31 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
31 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
32 | // + Software LICENSING TERMS |
32 | // + Software LICENSING TERMS |
33 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
33 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
34 | // + of HiSystems GmbH, Flachsmeerstrasse 2, 26802 Moormerland, Germany - the Licensor - |
34 | // + of HiSystems GmbH, Flachsmeerstrasse 2, 26802 Moormerland, Germany - the Licensor - |
35 | // + The Licensor grants the customer a non-exclusive license to use the microcontroller firmware of the Flight-Ctrl, Navi-Ctrl, BL-Ctrl, and MK3Mag hardware |
35 | // + The Licensor grants the customer a non-exclusive license to use the microcontroller firmware of the Flight-Ctrl, Navi-Ctrl, BL-Ctrl, and MK3Mag hardware |
36 | // + (the Software) exclusively for private purposes. The License is unrestricted with respect to time and territory*. |
36 | // + (the Software) exclusively for private purposes. The License is unrestricted with respect to time and territory*. |
37 | // + The Software may only be used with the Licensor's products. |
37 | // + The Software may only be used with the Licensor's products. |
38 | // + The Software provided by the Licensor is protected by copyright. With respect to the relationship between the parties to this |
38 | // + The Software provided by the Licensor is protected by copyright. With respect to the relationship between the parties to this |
39 | // + agreement, all rights pertaining to the Software and other documents provided during the preparation and execution of this |
39 | // + agreement, all rights pertaining to the Software and other documents provided during the preparation and execution of this |
40 | // + agreement shall be the property of the Licensor. |
40 | // + agreement shall be the property of the Licensor. |
Line 61... | Line 61... | ||
61 | #include "91x_lib.h" |
61 | #include "91x_lib.h" |
62 | #include "main.h" |
62 | #include "main.h" |
63 | #include "config.h" |
63 | #include "config.h" |
64 | #include "menu.h" |
64 | #include "menu.h" |
65 | #include "GPS.h" |
65 | #include "GPS.h" |
66 | #include "i2c0.h" |
- | |
67 | #include "i2c1.h" |
66 | #include "i2c.h" |
68 | #include "uart0.h" |
67 | #include "uart0.h" |
69 | #include "uart1.h" |
68 | #include "uart1.h" |
70 | #include "uart2.h" |
69 | #include "uart2.h" |
71 | #include "timer1.h" |
70 | #include "timer1.h" |
72 | #include "timer2.h" |
71 | #include "timer2.h" |
Line 160... | Line 159... | ||
160 | "I2C Error ", |
159 | "I2C Error ", |
161 | "I2C Okay ", //15 |
160 | "I2C Okay ", //15 |
162 | "16 ", |
161 | "16 ", |
163 | "17 ", |
162 | "17 ", |
164 | "18 ", |
163 | "18 ", |
165 | "19 ", // SD-Card-time |
164 | "19 ", // SD-Card-time |
166 | "EarthMagnet [%] ", //20 |
165 | "EarthMagnet [%] ", //20 |
167 | "Ground Speed ", // "Z_Speed ", |
166 | "Ground Speed ", // "Z_Speed ", |
168 | "N_Speed ", |
167 | "N_Speed ", |
169 | "E_Speed ", |
168 | "E_Speed ", |
170 | "Magnet X ", |
169 | "Magnet X ", |
Line 246... | Line 245... | ||
246 | UART_StructInit(&UART_InitStructure); |
245 | UART_StructInit(&UART_InitStructure); |
247 | UART_InitStructure.UART_WordLength = UART_WordLength_8D; |
246 | UART_InitStructure.UART_WordLength = UART_WordLength_8D; |
248 | UART_InitStructure.UART_StopBits = UART_StopBits_1; |
247 | UART_InitStructure.UART_StopBits = UART_StopBits_1; |
249 | UART_InitStructure.UART_Parity = UART_Parity_No ; |
248 | UART_InitStructure.UART_Parity = UART_Parity_No ; |
250 | UART_InitStructure.UART_BaudRate = UART1_BAUD_RATE; |
249 | UART_InitStructure.UART_BaudRate = UART1_BAUD_RATE; |
251 | UART_InitStructure.UART_HardwareFlowControl = UART_HardwareFlowControl_None; |
250 | UART_InitStructure. UART_HardwareFlowControl = UART_HardwareFlowControl_None; |
252 | UART_InitStructure.UART_Mode = UART_Mode_Tx_Rx; |
251 | UART_InitStructure.UART_Mode = UART_Mode_Tx_Rx; |
253 | // AVOID_I2C_COLLISION UART_InitStructure.UART_FIFO = UART_FIFO_Disable; |
- | |
254 | // AVOID_I2C_COLLISION UART_InitStructure.UART_TxFIFOLevel = UART_FIFOLevel_1_8; // FIFO size 16 bytes, FIFO level 2 bytes |
- | |
255 | UART_InitStructure.UART_FIFO = UART_FIFO_Enable; |
252 | UART_InitStructure.UART_FIFO = UART_FIFO_Enable; |
256 | UART_InitStructure.UART_TxFIFOLevel = UART_FIFOLevel_1_2; |
253 | UART_InitStructure.UART_TxFIFOLevel = UART_FIFOLevel_1_2; |
257 | UART_InitStructure.UART_RxFIFOLevel = UART_FIFOLevel_1_2; // FIFO size 16 bytes, FIFO level 8 bytes |
254 | UART_InitStructure.UART_RxFIFOLevel = UART_FIFOLevel_1_2; // FIFO size 16 bytes, FIFO level 8 bytes |
Line 258... | Line 255... | ||
258 | 255 | ||
259 | UART_DeInit(UART1); // reset uart 1 to default |
256 | UART_DeInit(UART1); // reset uart 1 to default |
260 | UART_Init(UART1, &UART_InitStructure); // initialize uart 1 |
257 | UART_Init(UART1, &UART_InitStructure); // initialize uart 1 |
261 | // enable uart 1 interrupts selective |
258 | // enable uart 1 interrupts selective |
Line 275... | Line 272... | ||
275 | UART_VersionInfo.SWMajor = VERSION_MAJOR; |
272 | UART_VersionInfo.SWMajor = VERSION_MAJOR; |
276 | UART_VersionInfo.SWMinor = VERSION_MINOR; |
273 | UART_VersionInfo.SWMinor = VERSION_MINOR; |
277 | UART_VersionInfo.SWPatch = VERSION_PATCH; |
274 | UART_VersionInfo.SWPatch = VERSION_PATCH; |
278 | UART_VersionInfo.ProtoMajor = VERSION_SERIAL_MAJOR; |
275 | UART_VersionInfo.ProtoMajor = VERSION_SERIAL_MAJOR; |
279 | UART_VersionInfo.ProtoMinor = VERSION_SERIAL_MINOR; |
276 | UART_VersionInfo.ProtoMinor = VERSION_SERIAL_MINOR; |
280 | UART_VersionInfo.HWMajor = Version_HW & 0x7f; |
277 | UART_VersionInfo.HWMajor = Version_HW & 0x7F; |
281 | UART_VersionInfo.reserved2 = 0; |
278 | UART_VersionInfo.reserved2 = 0; |
282 | UART_VersionInfo.Flags = 0; |
279 | UART_VersionInfo.Flags = 0; |
283 | NaviData.Version = NAVIDATA_VERSION; |
280 | NaviData.Version = NAVIDATA_VERSION; |
Line 284... | Line 281... | ||
284 | 281 | ||
285 | UART1_PutString("\r\n UART1 init...ok"); |
282 | UART1_PutString("\r\n UART1 init...ok"); |
Line 414... | Line 411... | ||
414 | switch(SerialMsg.Address) // check for Slave Address |
411 | switch(SerialMsg.Address) // check for Slave Address |
415 | { |
412 | { |
416 | case NC_ADDRESS: // own Slave Address |
413 | case NC_ADDRESS: // own Slave Address |
417 | switch(SerialMsg.CmdID) |
414 | switch(SerialMsg.CmdID) |
418 | { |
415 | { |
419 | case 't': // request for the GPS time |
416 | case 't': // request for the GPS time |
420 | UART1_Request_SystemTime = TRUE; |
417 | UART1_Request_SystemTime = TRUE; |
421 | break; |
418 | break; |
Line 422... | Line 419... | ||
422 | 419 | ||
423 | case 'f': // ftp command |
420 | case 'f': // ftp command |
424 | UART1_Request_FTP = SerialMsg.pData[0]; |
421 | UART1_Request_FTP = SerialMsg.pData[0]; |
425 | //if (UART1_Request_FTP == FTP_CMD_SET_CWD || UART1_Request_FTP == FTP_CMD_GET_FILE) |
422 | //if (UART1_Request_FTP == FTP_CMD_SET_CWD || UART1_Request_FTP == FTP_CMD_GET_FILE) |
426 | memcpy(&FTP_data, &SerialMsg.pData[1], sizeof(FTP_data)); // copy ftp parameter |
423 | memcpy(&FTP_data, &SerialMsg.pData[1], sizeof(FTP_data)); // copy ftp parameter |
Line 427... | Line 424... | ||
427 | break; |
424 | break; |
428 | 425 | ||
Line 497... | Line 494... | ||
497 | GPS_pWaypoint = PointList_WPBegin(); |
494 | GPS_pWaypoint = PointList_WPBegin(); |
498 | UART1_Request_WritePoint = 0; // return new point count |
495 | UART1_Request_WritePoint = 0; // return new point count |
499 | } |
496 | } |
500 | else |
497 | else |
501 | { // update WP in list at index |
498 | { // update WP in list at index |
502 | if(pPoint->Index > MaxNumberOfWaypoints) |
499 | if(pPoint->Index > MaxNumberOfWaypoints) |
503 | { |
500 | { |
504 | UART1_Request_WritePoint = 254; |
501 | UART1_Request_WritePoint = 254; |
505 | pPoint->Index = MaxNumberOfWaypoints; |
502 | pPoint->Index = MaxNumberOfWaypoints; |
506 | } |
503 | } |
507 | else |
504 | else |
508 | UART1_Request_WritePoint = PointList_SetAt(pPoint); |
505 | UART1_Request_WritePoint = PointList_SetAt(pPoint); |
509 | if(FC.StatusFlags & FC_STATUS_FLY) PointList_WPActive(TRUE); |
506 | if(FC.StatusFlags & FC_STATUS_FLY) PointList_WPActive(TRUE); |
510 | if(UART1_Request_WritePoint == pPoint->Index) |
507 | if(UART1_Request_WritePoint == pPoint->Index) |
511 | { |
508 | { |
512 | BeepTime = 500; |
509 | BeepTime = 500; |
Line 653... | Line 650... | ||
653 | /**************************************************************/ |
650 | /**************************************************************/ |
654 | void UART1_Transmit(void) |
651 | void UART1_Transmit(void) |
655 | { |
652 | { |
656 | u8 tmp_tx; |
653 | u8 tmp_tx; |
657 | if(DebugUART != UART1) return; |
654 | if(DebugUART != UART1) return; |
658 | // AVOID_I2C_COLLISION if(I2C0_State != I2C_STATE_IDLE) return; |
- | |
659 | // if something has to be send and the txd fifo is not full |
655 | // if something has to be send and the txd fifo is not full |
660 | if(UART1_tx_buffer.Locked == TRUE) |
656 | if(UART1_tx_buffer.Locked == TRUE) |
661 | { |
657 | { |
662 | // while there is some space in the tx fifo |
658 | // while there is some space in the tx fifo |
663 | while(UART_GetFlagStatus(UART1, UART_FLAG_TxFIFOFull) != SET) |
659 | while(UART_GetFlagStatus(UART1, UART_FLAG_TxFIFOFull) != SET) |
Line 687... | Line 683... | ||
687 | //$GPGGA,191410,4735.5634,N,00739.3538,E,1,04,4.4,351.5,M,48.0,M,,*45 |
683 | //$GPGGA,191410,4735.5634,N,00739.3538,E,1,04,4.4,351.5,M,48.0,M,,*45 |
688 | //$GPGGA,092120.20,,,,,0,00,99.99,,,,,,*6C |
684 | //$GPGGA,092120.20,,,,,0,00,99.99,,,,,,*6C |
689 | //http://www.kowoma.de/gps/zusatzerklaerungen/NMEA.htm |
685 | //http://www.kowoma.de/gps/zusatzerklaerungen/NMEA.htm |
690 | void CreateNmeaGGA(void) |
686 | void CreateNmeaGGA(void) |
691 | { |
687 | { |
692 | unsigned char array[200], i = 0, crc = 0, x; |
688 | u8 array[200], i = 0, crc = 0, x; |
693 | long tmp1, tmp2; |
689 | s32 tmp1, tmp2; |
694 | i += sprintf(array, "$GPGGA,"); |
- | |
695 | // +++++++++++++++++++++++++++++++++++++++++++ |
- | |
696 | if(SystemTime.Valid) |
- | |
697 | { |
- | |
698 | i += sprintf(&array[i], "%02d%02d%02d.%02d,",SystemTime.Hour,SystemTime.Min,SystemTime.Sec,SystemTime.mSec/10); |
- | |
699 | } |
- | |
700 | else |
- | |
701 | { |
- | |
702 | i += sprintf(&array[i], ","); |
- | |
703 | } |
- | |
704 | // +++++++++++++++++++++++++++++++++++++++++++ |
- | |
705 | if(GPSData.Flags & FLAG_GPSFIXOK) |
- | |
706 | { |
- | |
707 | tmp1 = abs(GPSData.Position.Latitude)/10000000L; |
- | |
708 | i += sprintf(&array[i],"%02d",(int)tmp1); |
- | |
709 | - | ||
710 | tmp1 = abs(GPSData.Position.Latitude)%10000000L; |
- | |
711 | tmp1 *= 6; // in Minuten |
- | |
712 | tmp2 = tmp1 / 1000000L; |
- | |
713 | i += sprintf(&array[i],"%02d",(int)tmp2); |
- | |
714 | tmp2 = tmp1 % 1000000L; |
- | |
715 | tmp2 /= 10; // eine Stelle zu viel |
- | |
716 | i += sprintf(&array[i],".%05d,",(int)tmp2); |
- | |
717 | - | ||
718 | if(GPSData.Position.Latitude >= 0) i += sprintf(&array[i],"N,"); |
- | |
719 | else i += sprintf(&array[i],"S,"); |
- | |
720 | // +++++++++++++++++++++++++++++++++++++++++++ |
- | |
721 | - | ||
722 | tmp1 = abs(GPSData.Position.Longitude)/10000000L; |
- | |
723 | i += sprintf(&array[i],"%03d",(int)tmp1); |
- | |
724 | - | ||
725 | tmp1 = abs(GPSData.Position.Longitude)%10000000L; |
- | |
726 | tmp1 *= 6; // in Minuten |
- | |
727 | tmp2 = tmp1 / 1000000L; |
- | |
728 | i += sprintf(&array[i],"%02d",(int)tmp2); |
- | |
729 | tmp2 = tmp1 % 1000000L; |
- | |
730 | tmp2 /= 10; // eine Stelle zu viel |
- | |
731 | i += sprintf(&array[i],".%05d,",(int)tmp2); |
- | |
732 | - | ||
733 | - | ||
734 | if(GPSData.Position.Longitude >= 0) i += sprintf(&array[i],"E,"); |
- | |
735 | else i += sprintf(&array[i],"W,"); |
- | |
736 | i += sprintf(&array[i],"%d,",GPSData.SatFix); |
- | |
737 | i += sprintf(&array[i],"%d,",GPSData.NumOfSats); |
- | |
738 | i += sprintf(&array[i],"%d.%d,",GPSData.Position_Accuracy/100,abs(GPSData.Position_Accuracy%100)); |
- | |
739 | // i += sprintf(&array[i],"%d.%d,M,",GPSData.Position.Altitude/1000,abs(GPSData.Position.Altitude%1000)/100); |
- | |
740 | tmp1 = NaviData.Altimeter / 2; // in dm |
- | |
741 | i += sprintf(&array[i],"%d.%d,M,",tmp1 / 10,abs(tmp1 % 10)); |
- | |
742 | i += sprintf(&array[i],",,,*"); |
- | |
743 | } |
- | |
744 | else |
- | |
745 | { |
- | |
746 | i += sprintf(&array[i], ",,,,%d,00,99.99,,,,,,*",GPSData.NumOfSats); |
- | |
747 | } |
- | |
748 | for(x=1; x<i-1; x++) |
- | |
749 | { |
- | |
750 | crc ^= array[x]; |
- | |
751 | } |
- | |
752 | i += sprintf(&array[i], "%02x%c%c",crc,0x0d,0x0a); |
- | |
753 | AddSerialData(&UART1_tx_buffer,array,i); |
- | |
Line -... | Line 690... | ||
- | 690 | ||
- | 691 | i += sprintf(array, "$GPGGA,"); |
|
- | 692 | // +++++++++++++++++++++++++++++++++++++++++++ |
|
- | 693 | if(SystemTime.Valid) |
|
- | 694 | { |
|
- | 695 | i += sprintf(&array[i], "%02d%02d%02d.%02d,", SystemTime.Hour, SystemTime.Min, SystemTime.Sec, SystemTime.mSec/10); |
|
- | 696 | } |
|
- | 697 | else |
|
- | 698 | { |
|
- | 699 | i += sprintf(&array[i], ","); |
|
- | 700 | } |
|
- | 701 | // +++++++++++++++++++++++++++++++++++++++++++ |
|
- | 702 | if(GPSData.Flags & FLAG_GPSFIXOK) |
|
- | 703 | { |
|
- | 704 | tmp1 = abs(GPSData.Position.Latitude)/10000000L; |
|
- | 705 | i += sprintf(&array[i],"%02d",(s16)tmp1); |
|
- | 706 | ||
- | 707 | tmp1 = abs(GPSData.Position.Latitude)%10000000L; |
|
- | 708 | tmp1 *= 6; // in Minuten |
|
- | 709 | tmp2 = tmp1 / 1000000L; |
|
- | 710 | i += sprintf(&array[i],"%02d", (s16)tmp2); |
|
- | 711 | tmp2 = tmp1 % 1000000L; |
|
- | 712 | tmp2 /= 10; // eine Stelle zu viel |
|
- | 713 | i += sprintf(&array[i],".%05d,", (s16)tmp2); |
|
- | 714 | ||
- | 715 | if(GPSData.Position.Latitude >= 0) i += sprintf(&array[i],"N,"); |
|
- | 716 | else i += sprintf(&array[i],"S,"); |
|
- | 717 | // +++++++++++++++++++++++++++++++++++++++++++ |
|
- | 718 | ||
- | 719 | tmp1 = abs(GPSData.Position.Longitude)/10000000L; |
|
- | 720 | i += sprintf(&array[i],"%03d", (s16)tmp1); |
|
- | 721 | ||
- | 722 | tmp1 = abs(GPSData.Position.Longitude)%10000000L; |
|
- | 723 | tmp1 *= 6; // in Minuten |
|
- | 724 | tmp2 = tmp1 / 1000000L; |
|
- | 725 | i += sprintf(&array[i],"%02d", (s16)tmp2); |
|
- | 726 | tmp2 = tmp1 % 1000000L; |
|
- | 727 | tmp2 /= 10; // eine Stelle zu viel |
|
- | 728 | i += sprintf(&array[i],".%05d,", (s16)tmp2); |
|
- | 729 | ||
- | 730 | ||
- | 731 | if(GPSData.Position.Longitude >= 0) i += sprintf(&array[i],"E,"); |
|
- | 732 | else i += sprintf(&array[i],"W,"); |
|
- | 733 | i += sprintf(&array[i],"%d,",GPSData.SatFix); |
|
- | 734 | i += sprintf(&array[i],"%d,",GPSData.NumOfSats); |
|
- | 735 | i += sprintf(&array[i],"%d.%d,",(s16)(GPSData.Position_Accuracy/100),abs(GPSData.Position_Accuracy%100)); |
|
- | 736 | // i += sprintf(&array[i],"%d.%d,M,",GPSData.Position.Altitude/1000,abs(GPSData.Position.Altitude%1000)/100); |
|
- | 737 | tmp1 = NaviData.Altimeter / 2; // in dm |
|
- | 738 | i += sprintf(&array[i],"%d.%d,M,",(s16)tmp1 / 10,abs((s16)tmp1 % 10)); |
|
- | 739 | i += sprintf(&array[i],",,,*"); |
|
- | 740 | } |
|
- | 741 | else |
|
- | 742 | { |
|
- | 743 | i += sprintf(&array[i], ",,,,%d,00,99.99,,,,,,*",GPSData.NumOfSats); |
|
- | 744 | } |
|
- | 745 | for(x = 1; x < i-1; x++) |
|
- | 746 | { |
|
- | 747 | crc ^= array[x]; |
|
- | 748 | } |
|
- | 749 | i += sprintf(&array[i], "%02x%c%c",crc,0x0d,0x0a); |
|
- | 750 | AddSerialData(&UART1_tx_buffer,array,i); |
|
754 | 751 | ||
755 | // +++++++++++++++++++++++++++++++++++++++++++ |
752 | // +++++++++++++++++++++++++++++++++++++++++++ |
Line 756... | Line 753... | ||
756 | } |
753 | } |
757 | 754 | ||
Line 758... | Line 755... | ||
758 | //$GPRMC,162614.123,A,5230.5900,N,01322.3900,E,10.0,90.0,131006,1.2,E,A*13 |
755 | //$GPRMC,162614.123,A,5230.5900,N,01322.3900,E,10.0,90.0,131006,1.2,E,A*13 |
759 | //$GPRMC,HHMMSS.sss,A,BBBB.BBBB,b,LLLLL.LLLL,l,GG.G,RR.R,DDMMYY,M.M,m,F*PP |
756 | //$GPRMC,HHMMSS.sss,A,BBBB.BBBB,b,LLLLL.LLLL,l,GG.G,RR.R,DDMMYY,M.M,m,F*PP |
Line 898... | Line 895... | ||
898 | else ToFlightCtrl.Param.Byte[2] = 0; // 1 = S |
895 | else ToFlightCtrl.Param.Byte[2] = 0; // 1 = S |
899 | i1 = abs(GPSData.Position.Longitude)/10000000L; |
896 | i1 = abs(GPSData.Position.Longitude)/10000000L; |
Line 941... | Line 938... | ||
941 | u8 errorcode = FTP_ERROR_NONE; |
938 | u8 errorcode = FTP_ERROR_NONE; |
942 | if(FC.StatusFlags & FC_STATUS_MOTOR_RUN) errorcode = FTP_ERROR_MOTOR_RUN; |
939 | if(FC.StatusFlags & FC_STATUS_MOTOR_RUN) errorcode = FTP_ERROR_MOTOR_RUN; |
943 | else if (!Partition.IsValid) errorcode = FTP_ERROR_NO_SDCARD; |
940 | else if (!Partition.IsValid) errorcode = FTP_ERROR_NO_SDCARD; |
Line 944... | Line 941... | ||
944 | 941 | ||
945 | if (!errorcode) CheckFTPCommand(UART1_Request_FTP); |
942 | if (!errorcode) CheckFTPCommand(UART1_Request_FTP); |
946 | else |
943 | else |
947 | { |
944 | { |
948 | u8 cmd = FTP_CMD_ERROR; |
945 | u8 cmd = FTP_CMD_ERROR; |
949 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'F', NC_ADDRESS, 2, &cmd, 1, &errorcode, 1); |
946 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'F', NC_ADDRESS, 2, &cmd, 1, &errorcode, 1); |