Rev 231 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 231 | Rev 274 | ||
---|---|---|---|
Line 5... | Line 5... | ||
5 | // + see the File "License.txt" for further Informations |
5 | // + see the File "License.txt" for further Informations |
6 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
6 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
Line 7... | Line 7... | ||
7 | 7 | ||
8 | #include <stdlib.h> |
8 | #include <stdlib.h> |
9 | #include <inttypes.h> |
- | |
10 | #include "main.h" |
9 | #include <inttypes.h> |
11 | #include "uart0.h" |
10 | #include "uart0.h" |
12 | #include "printf_P.h" |
11 | #include "printf_P.h" |
- | 12 | #include "ubx.h" |
|
Line 13... | Line 13... | ||
13 | #include "ubx.h" |
13 | #include "timer0.h" |
14 | 14 | ||
15 | uint8_t MaxMenuItem = 1; |
15 | uint8_t MaxMenuItem = 3; |
Line 16... | Line 16... | ||
16 | uint8_t MenuItem = 0; |
16 | uint8_t MenuItem = 0; |
17 | uint8_t RemoteKeys = 0; |
17 | uint8_t RemoteKeys = 0; |
Line 43... | Line 43... | ||
43 | /* Update Menu on LCD */ |
43 | /* Update Menu on LCD */ |
44 | /************************************/ |
44 | /************************************/ |
45 | // Display with 20 characters in 4 lines |
45 | // Display with 20 characters in 4 lines |
46 | void LCD_PrintMenu(void) |
46 | void LCD_PrintMenu(void) |
47 | { |
47 | { |
- | 48 | int32_t i1,i2; |
|
- | 49 | uint8_t sign; |
|
- | 50 | ||
48 | if(RemoteKeys & KEY1) |
51 | if(RemoteKeys & KEY1) |
49 | { |
52 | { |
50 | if(MenuItem) MenuItem--; |
53 | if(MenuItem) MenuItem--; |
51 | else MenuItem = MaxMenuItem; |
54 | else MenuItem = MaxMenuItem; |
52 | } |
55 | } |
Line 81... | Line 84... | ||
81 | LCD_printfxy(0,1,"HW: Follow-Me"); |
84 | LCD_printfxy(0,1,"HW: Follow-Me"); |
82 | #endif |
85 | #endif |
83 | LCD_printfxy(0,2,"SW: %d.%d%c", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH+'a'); |
86 | LCD_printfxy(0,2,"SW: %d.%d%c", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH+'a'); |
84 | LCD_printfxy(0,3," "); |
87 | LCD_printfxy(0,3," "); |
85 | break; |
88 | break; |
- | 89 | case 1: |
|
- | 90 | if (GPSData.Status == INVALID) |
|
86 | 91 | { |
|
- | 92 | LCD_printfxy(0,0,"No GPS data"); |
|
- | 93 | LCD_printfxy(0,1,"Lon: "); |
|
- | 94 | LCD_printfxy(0,2,"Lat: "); |
|
- | 95 | LCD_printfxy(0,3,"Alt: "); |
|
- | 96 | } |
|
87 | case 1://GPS Lat/Lon coords |
97 | else // newdata or processed |
- | 98 | { |
|
88 | if (GPSInfo.status == INVALID) |
99 | switch (GPSData.SatFix) |
89 | { |
100 | { |
- | 101 | case SATFIX_NONE: |
|
90 | LCD_printfxy(0,0,"No GPS data!"); |
102 | LCD_printfxy(0,0,"Sats:%02d Fix:None", GPSData.NumOfSats); |
- | 103 | break; |
|
- | 104 | case SATFIX_2D: |
|
- | 105 | LCD_printfxy(0,0,"Sats:%02d Fix:2D ", GPSData.NumOfSats); |
|
- | 106 | break; |
|
- | 107 | case SATFIX_3D: |
|
- | 108 | LCD_printfxy(0,0,"Sats:%02d Fix:3D ", GPSData.NumOfSats); |
|
- | 109 | break; |
|
- | 110 | default: |
|
- | 111 | LCD_printfxy(0,0,"Sats:%02d Fix:?? ", GPSData.NumOfSats); |
|
- | 112 | break; |
|
91 | } |
113 | } |
- | 114 | if(GPSData.Position.Longitude < 0) sign = '-'; |
|
- | 115 | else sign = '+'; |
|
- | 116 | i1 = abs(GPSData.Position.Longitude)/10000000L; |
|
- | 117 | i2 = abs(GPSData.Position.Longitude)%10000000L; |
|
- | 118 | LCD_printfxy(0,1,"Lon:%c%03ld.%07ld deg",sign, i1, i2); |
|
- | 119 | if(GPSData.Position.Latitude < 0) sign = '-'; |
|
- | 120 | else sign = '+'; |
|
- | 121 | i1 = abs(GPSData.Position.Latitude)/10000000L; |
|
- | 122 | i2 = abs(GPSData.Position.Latitude)%10000000L; |
|
- | 123 | LCD_printfxy(0,2,"Lat:%c%03ld.%07ld deg",sign, i1, i2); |
|
- | 124 | if(GPSData.Position.Altitude < 0) sign = '-'; |
|
- | 125 | else sign = '+'; |
|
- | 126 | i1 = abs(GPSData.Position.Altitude)/1000L; |
|
- | 127 | i2 = abs(GPSData.Position.Altitude)%1000L; |
|
- | 128 | LCD_printfxy(0,3,"Alt:%c%04ld.%03ld m", sign, i1, i2); |
|
- | 129 | } |
|
92 | else |
130 | break; |
- | 131 | case 2: |
|
- | 132 | if (GPSData.Status == INVALID) |
|
- | 133 | { |
|
- | 134 | LCD_printfxy(0,0,"No GPS data"); |
|
- | 135 | LCD_printfxy(0,1,"Speed N: "); |
|
- | 136 | LCD_printfxy(0,2,"Speed E: "); |
|
- | 137 | LCD_printfxy(0,3,"Speed T: "); |
|
- | 138 | } |
|
- | 139 | else // newdata or processed |
|
- | 140 | { |
|
- | 141 | switch (GPSData.SatFix) |
|
93 | { |
142 | { |
94 | switch (GPSInfo.satfix) |
- | |
95 | { |
- | |
96 | case SATFIX_NONE: |
143 | case SATFIX_NONE: |
97 | LCD_printfxy(0,0,"Sats: %d Fix: No", GPSInfo.satnum); |
144 | LCD_printfxy(0,0,"Sats:%02d Fix:None", GPSData.NumOfSats); |
98 | break; |
145 | break; |
99 | case SATFIX_2D: |
146 | case SATFIX_2D: |
100 | LCD_printfxy(0,0,"Sats: %d Fix: 2D", GPSInfo.satnum); |
147 | LCD_printfxy(0,0,"Sats:%02d Fix:2D ", GPSData.NumOfSats); |
101 | break; |
148 | break; |
102 | case SATFIX_3D: |
149 | case SATFIX_3D: |
103 | LCD_printfxy(0,0,"Sats: %d Fix: 3D", GPSInfo.satnum); |
150 | LCD_printfxy(0,0,"Sats:%02d Fix:3D ", GPSData.NumOfSats); |
104 | break; |
151 | break; |
105 | default: |
152 | default: |
106 | LCD_printfxy(0,0,"Sats: %d Fix: ??", GPSInfo.satnum); |
153 | LCD_printfxy(0,0,"Sats:%02d Fix:?? ", GPSData.NumOfSats); |
107 | break; |
154 | break; |
108 | } |
- | |
109 | int16_t i1,i2,i3; |
- | |
110 | i1 = (int16_t)(GPSInfo.longitude/10000000L); |
- | |
111 | i2 = abs((int16_t)((GPSInfo.longitude%10000000L)/10000L)); |
- | |
112 | i3 = abs((int16_t)(((GPSInfo.longitude%10000000L)%10000L)/10L)); |
- | |
113 | LCD_printfxy(0,1,"Lon: %d.%.3d%.3d deg",i1, i2, i3); |
- | |
114 | i1 = (int16_t)(GPSInfo.latitude/10000000L); |
- | |
115 | i2 = abs((int16_t)((GPSInfo.latitude%10000000L)/10000L)); |
- | |
116 | i3 = abs((int16_t)(((GPSInfo.latitude%10000000L)%10000L)/10L)); |
- | |
117 | LCD_printfxy(0,2,"Lat: %d.%.3d%.3d deg",i1, i2, i3); |
- | |
118 | i1 = (int16_t)(GPSInfo.altitude/1000L); |
- | |
119 | i2 = abs((int16_t)(GPSInfo.altitude%1000L)); |
- | |
120 | LCD_printfxy(0,3,"Alt: %d.%.3d m",i1, i2); |
- | |
121 | } |
155 | } |
- | 156 | LCD_printfxy(0,1,"Speed N: %+4ld cm/s",GPSData.Speed_North); |
|
- | 157 | LCD_printfxy(0,2,"Speed E: %+4ld cm/s",GPSData.Speed_East); |
|
- | 158 | LCD_printfxy(0,3,"Speed T: %+4ld cm/s",GPSData.Speed_Top); |
|
- | 159 | } |
|
122 | break; |
160 | break; |
- | 161 | case 3: |
|
- | 162 | LCD_printfxy(0,0,"GPS UTC Time"); |
|
- | 163 | if (!SystemTime.Valid) |
|
- | 164 | { |
|
- | 165 | LCD_printfxy(0,1," "); |
|
- | 166 | LCD_printfxy(0,2," No time data! "); |
|
- | 167 | LCD_printfxy(0,3," "); |
|
- | 168 | } |
|
- | 169 | else // newdata or processed |
|
- | 170 | { |
|
- | 171 | LCD_printfxy(0,1," "); |
|
- | 172 | LCD_printfxy(0,2,"Date: %02i/%02i/%04i",SystemTime.Month, SystemTime.Day, SystemTime.Year); |
|
- | 173 | LCD_printfxy(0,3,"Time: %02i:%02i:%02i.%03i", SystemTime.Hour, SystemTime.Min, SystemTime.Sec, SystemTime.mSec); |
|
- | 174 | } |
|
- | 175 | break; |
|
Line 123... | Line 176... | ||
123 | 176 | ||
124 | default: MaxMenuItem = MenuItem - 1; |
177 | default: MaxMenuItem = MenuItem - 1; |
125 | MenuItem = 0; |
178 | MenuItem = 0; |
126 | break; |
179 | break; |