Rev 480 | Rev 483 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 480 | Rev 482 | ||
---|---|---|---|
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 684... | Line 683... | ||
684 | //$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 |
685 | //$GPGGA,092120.20,,,,,0,00,99.99,,,,,,*6C |
684 | //$GPGGA,092120.20,,,,,0,00,99.99,,,,,,*6C |
686 | //http://www.kowoma.de/gps/zusatzerklaerungen/NMEA.htm |
685 | //http://www.kowoma.de/gps/zusatzerklaerungen/NMEA.htm |
687 | void CreateNmeaGGA(void) |
686 | void CreateNmeaGGA(void) |
688 | { |
687 | { |
689 | unsigned char array[200], i = 0, crc = 0, x; |
688 | u8 array[200], i = 0, crc = 0, x; |
690 | long tmp1, tmp2; |
689 | s32 tmp1, tmp2; |
- | 690 | ||
691 | i += sprintf(array, "$GPGGA,"); |
691 | i += sprintf(array, "$GPGGA,"); |
692 | // +++++++++++++++++++++++++++++++++++++++++++ |
692 | // +++++++++++++++++++++++++++++++++++++++++++ |
693 | if(SystemTime.Valid) |
693 | if(SystemTime.Valid) |
694 | { |
694 | { |
695 | i += sprintf(&array[i], "%02d%02d%02d.%02d,",SystemTime.Hour,SystemTime.Min,SystemTime.Sec,SystemTime.mSec/10); |
695 | i += sprintf(&array[i], "%02d%02d%02d.%02d,", SystemTime.Hour, SystemTime.Min, SystemTime.Sec, SystemTime.mSec/10); |
Line 700... | Line 700... | ||
700 | } |
700 | } |
701 | // +++++++++++++++++++++++++++++++++++++++++++ |
701 | // +++++++++++++++++++++++++++++++++++++++++++ |
702 | if(GPSData.Flags & FLAG_GPSFIXOK) |
702 | if(GPSData.Flags & FLAG_GPSFIXOK) |
703 | { |
703 | { |
704 | tmp1 = abs(GPSData.Position.Latitude)/10000000L; |
704 | tmp1 = abs(GPSData.Position.Latitude)/10000000L; |
705 | i += sprintf(&array[i],"%02d",(int)tmp1); |
705 | i += sprintf(&array[i],"%02d",(s16)tmp1); |
Line 706... | Line 706... | ||
706 | 706 | ||
707 | tmp1 = abs(GPSData.Position.Latitude)%10000000L; |
707 | tmp1 = abs(GPSData.Position.Latitude)%10000000L; |
708 | tmp1 *= 6; // in Minuten |
708 | tmp1 *= 6; // in Minuten |
709 | tmp2 = tmp1 / 1000000L; |
709 | tmp2 = tmp1 / 1000000L; |
710 | i += sprintf(&array[i],"%02d",(int)tmp2); |
710 | i += sprintf(&array[i],"%02d", (s16)tmp2); |
711 | tmp2 = tmp1 % 1000000L; |
711 | tmp2 = tmp1 % 1000000L; |
712 | tmp2 /= 10; // eine Stelle zu viel |
712 | tmp2 /= 10; // eine Stelle zu viel |
Line 713... | Line 713... | ||
713 | i += sprintf(&array[i],".%05d,",(int)tmp2); |
713 | i += sprintf(&array[i],".%05d,", (s16)tmp2); |
714 | 714 | ||
715 | if(GPSData.Position.Latitude >= 0) i += sprintf(&array[i],"N,"); |
715 | if(GPSData.Position.Latitude >= 0) i += sprintf(&array[i],"N,"); |
Line 716... | Line 716... | ||
716 | else i += sprintf(&array[i],"S,"); |
716 | else i += sprintf(&array[i],"S,"); |
717 | // +++++++++++++++++++++++++++++++++++++++++++ |
717 | // +++++++++++++++++++++++++++++++++++++++++++ |
Line 718... | Line 718... | ||
718 | 718 | ||
719 | tmp1 = abs(GPSData.Position.Longitude)/10000000L; |
719 | tmp1 = abs(GPSData.Position.Longitude)/10000000L; |
720 | i += sprintf(&array[i],"%03d",(int)tmp1); |
720 | i += sprintf(&array[i],"%03d", (s16)tmp1); |
721 | 721 | ||
722 | tmp1 = abs(GPSData.Position.Longitude)%10000000L; |
722 | tmp1 = abs(GPSData.Position.Longitude)%10000000L; |
723 | tmp1 *= 6; // in Minuten |
723 | tmp1 *= 6; // in Minuten |
724 | tmp2 = tmp1 / 1000000L; |
724 | tmp2 = tmp1 / 1000000L; |
Line 725... | Line 725... | ||
725 | i += sprintf(&array[i],"%02d",(int)tmp2); |
725 | i += sprintf(&array[i],"%02d", (s16)tmp2); |
726 | tmp2 = tmp1 % 1000000L; |
726 | tmp2 = tmp1 % 1000000L; |
727 | tmp2 /= 10; // eine Stelle zu viel |
727 | tmp2 /= 10; // eine Stelle zu viel |
728 | i += sprintf(&array[i],".%05d,",(int)tmp2); |
728 | i += sprintf(&array[i],".%05d,", (s16)tmp2); |
729 | 729 | ||
730 | 730 | ||
731 | if(GPSData.Position.Longitude >= 0) i += sprintf(&array[i],"E,"); |
731 | if(GPSData.Position.Longitude >= 0) i += sprintf(&array[i],"E,"); |
732 | else i += sprintf(&array[i],"W,"); |
732 | else i += sprintf(&array[i],"W,"); |
733 | i += sprintf(&array[i],"%d,",GPSData.SatFix); |
733 | i += sprintf(&array[i],"%d,",GPSData.SatFix); |
734 | i += sprintf(&array[i],"%d,",GPSData.NumOfSats); |
734 | i += sprintf(&array[i],"%d,",GPSData.NumOfSats); |
735 | i += sprintf(&array[i],"%d.%d,",GPSData.Position_Accuracy/100,abs(GPSData.Position_Accuracy%100)); |
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); |
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 |
737 | tmp1 = NaviData.Altimeter / 2; // in dm |
Line 755... | Line 755... | ||
755 | //$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 |
756 | //$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 757... | Line 757... | ||
757 | 757 | ||
758 | void CreateNmeaRMC(void) |
758 | void CreateNmeaRMC(void) |
759 | { |
759 | { |
760 | unsigned char array[200], i = 0, crc = 0, x; |
760 | u8 array[200], i = 0, crc = 0, x; |
761 | int tmp_int; |
761 | s16 tmp_int; |
762 | long tmp1, tmp2; |
762 | s32 tmp1, tmp2; |
763 | // +++++++++++++++++++++++++++++++++++++++++++ |
763 | // +++++++++++++++++++++++++++++++++++++++++++ |
764 | i += sprintf(array, "$GPRMC,"); |
764 | i += sprintf(array, "$GPRMC,"); |
765 | // +++++++++++++++++++++++++++++++++++++++++++ |
765 | // +++++++++++++++++++++++++++++++++++++++++++ |
766 | if(SystemTime.Valid) |
766 | if(SystemTime.Valid) |
Line 773... | Line 773... | ||
773 | } |
773 | } |
774 | if(GPSData.Flags & FLAG_GPSFIXOK) |
774 | if(GPSData.Flags & FLAG_GPSFIXOK) |
775 | { |
775 | { |
776 | // +++++++++++++++++++++++++++++++++++++++++++ |
776 | // +++++++++++++++++++++++++++++++++++++++++++ |
777 | tmp1 = abs(GPSData.Position.Latitude)/10000000L; |
777 | tmp1 = abs(GPSData.Position.Latitude)/10000000L; |
778 | i += sprintf(&array[i],"A,%02d",(int)tmp1); // Status: A = Okay V = Warnung |
778 | i += sprintf(&array[i],"A,%02d", (s16)tmp1); // Status: A = Okay V = Warnung |
Line 779... | Line 779... | ||
779 | 779 | ||
780 | tmp1 = abs(GPSData.Position.Latitude)%10000000L; |
780 | tmp1 = abs(GPSData.Position.Latitude)%10000000L; |
781 | tmp1 *= 6; // in Minuten |
781 | tmp1 *= 6; // in Minuten |
782 | tmp2 = tmp1 / 1000000L; |
782 | tmp2 = tmp1 / 1000000L; |
783 | i += sprintf(&array[i],"%02d",(int)tmp2); |
783 | i += sprintf(&array[i],"%02d", (s16)tmp2); |
784 | tmp2 = tmp1 % 1000000L; |
784 | tmp2 = tmp1 % 1000000L; |
785 | tmp2 /= 10; // eine Stelle zu viel |
785 | tmp2 /= 10; // eine Stelle zu viel |
786 | i += sprintf(&array[i],".%05d,",(int)tmp2); |
786 | i += sprintf(&array[i],".%05d,", (s16)tmp2); |
787 | if(GPSData.Position.Latitude >= 0) i += sprintf(&array[i],"N,"); |
787 | if(GPSData.Position.Latitude >= 0) i += sprintf(&array[i],"N,"); |
788 | else i += sprintf(&array[i],"S,"); |
788 | else i += sprintf(&array[i],"S,"); |
789 | // +++++++++++++++++++++++++++++++++++++++++++ |
789 | // +++++++++++++++++++++++++++++++++++++++++++ |
790 | tmp1 = abs(GPSData.Position.Longitude)/10000000L; |
790 | tmp1 = abs(GPSData.Position.Longitude)/10000000L; |
Line 791... | Line 791... | ||
791 | i += sprintf(&array[i],"%03d",(int)tmp1); |
791 | i += sprintf(&array[i],"%03d", (s16)tmp1); |
792 | 792 | ||
793 | tmp1 = abs(GPSData.Position.Longitude)%10000000L; |
793 | tmp1 = abs(GPSData.Position.Longitude)%10000000L; |
794 | tmp1 *= 6; // in Minuten |
794 | tmp1 *= 6; // in Minuten |
795 | tmp2 = tmp1 / 1000000L; |
795 | tmp2 = tmp1 / 1000000L; |
796 | i += sprintf(&array[i],"%02d",(int)tmp2); |
796 | i += sprintf(&array[i],"%02d", (s16)tmp2); |
797 | tmp2 = tmp1 % 1000000L; |
797 | tmp2 = tmp1 % 1000000L; |
798 | tmp2 /= 10; // eine Stelle zu viel |
798 | tmp2 /= 10; // eine Stelle zu viel |
799 | i += sprintf(&array[i],".%05d,",(int)tmp2); |
799 | i += sprintf(&array[i],".%05d,", (s16)tmp2); |
800 | if(GPSData.Position.Longitude >= 0) i += sprintf(&array[i],"E,"); |
800 | if(GPSData.Position.Longitude >= 0) i += sprintf(&array[i],"E,"); |
801 | else i += sprintf(&array[i],"W,"); |
801 | else i += sprintf(&array[i],"W,"); |
802 | // +++++++++++++++++++++++++++++++++++++++++++ |
802 | // +++++++++++++++++++++++++++++++++++++++++++ |