Rev 124 | Rev 138 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 124 | Rev 127 | ||
---|---|---|---|
1 | /*#######################################################################################*/ |
1 | /*#######################################################################################*/ |
2 | /* !!! THIS IS NOT FREE SOFTWARE !!! */ |
2 | /* !!! THIS IS NOT FREE SOFTWARE !!! */ |
3 | /*#######################################################################################*/ |
3 | /*#######################################################################################*/ |
4 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
4 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5 | // + Copyright (c) 2008 Ingo Busker, Holger Buss |
5 | // + Copyright (c) 2008 Ingo Busker, Holger Buss |
6 | // + Nur für den privaten Gebrauch |
6 | // + Nur für den privaten Gebrauch |
7 | // + FOR NON COMMERCIAL USE ONLY |
7 | // + FOR NON COMMERCIAL USE ONLY |
8 | // + www.MikroKopter.com |
8 | // + www.MikroKopter.com |
9 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
9 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
10 | // + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
10 | // + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
11 | // + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
11 | // + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
12 | // + Sollten direkte oder indirekte kommerzielle Absichten verfolgt werden, ist mit uns (info@mikrokopter.de) Kontakt |
12 | // + Sollten direkte oder indirekte kommerzielle Absichten verfolgt werden, ist mit uns (info@mikrokopter.de) Kontakt |
13 | // + bzgl. der Nutzungsbedingungen aufzunehmen. |
13 | // + bzgl. der Nutzungsbedingungen aufzunehmen. |
14 | // + Eine kommerzielle Nutzung ist z.B.Verkauf von MikroKoptern, Bestückung und Verkauf von Platinen oder Bausätzen, |
14 | // + Eine kommerzielle Nutzung ist z.B.Verkauf von MikroKoptern, Bestückung und Verkauf von Platinen oder Bausätzen, |
15 | // + Verkauf von Luftbildaufnahmen, usw. |
15 | // + Verkauf von Luftbildaufnahmen, usw. |
16 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
16 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
17 | // + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
17 | // + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
18 | // + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
18 | // + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
19 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
19 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
20 | // + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
20 | // + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
21 | // + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
21 | // + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
22 | // + eindeutig als Ursprung verlinkt werden |
22 | // + eindeutig als Ursprung verlinkt werden |
23 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
23 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
24 | // + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
24 | // + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
25 | // + Benutzung auf eigene Gefahr |
25 | // + Benutzung auf eigene Gefahr |
26 | // + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
26 | // + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
27 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
27 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
28 | // + Die PORTIERUNG der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
28 | // + Die PORTIERUNG der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
29 | // + mit unserer Zustimmung zulässig |
29 | // + mit unserer Zustimmung zulässig |
30 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
30 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
31 | // + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
31 | // + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
32 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
32 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
33 | // + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
33 | // + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
34 | // + this list of conditions and the following disclaimer. |
34 | // + this list of conditions and the following disclaimer. |
35 | // + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
35 | // + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
36 | // + from this software without specific prior written permission. |
36 | // + from this software without specific prior written permission. |
37 | // + * The use of this project (hardware, software, binary files, sources and documentation) is only permitted |
37 | // + * The use of this project (hardware, software, binary files, sources and documentation) is only permitted |
38 | // + for non-commercial use (directly or indirectly) |
38 | // + for non-commercial use (directly or indirectly) |
39 | // + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
39 | // + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
40 | // + with our written permission |
40 | // + with our written permission |
41 | // + * If sources or documentations are redistributet on other webpages, out webpage (http://www.MikroKopter.de) must be |
41 | // + * If sources or documentations are redistributet on other webpages, out webpage (http://www.MikroKopter.de) must be |
42 | // + clearly linked as origin |
42 | // + clearly linked as origin |
43 | // + * PORTING this software (or part of it) to systems (other than hardware from www.mikrokopter.de) is NOT allowed |
43 | // + * PORTING this software (or part of it) to systems (other than hardware from www.mikrokopter.de) is NOT allowed |
44 | // |
44 | // |
45 | // + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
45 | // + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
46 | // + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
46 | // + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
47 | // + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
47 | // + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
48 | // + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
48 | // + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
49 | // + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
49 | // + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
50 | // + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
50 | // + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
51 | // + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
51 | // + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
52 | // + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
52 | // + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
53 | // + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
53 | // + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
54 | // + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
54 | // + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
55 | // + POSSIBILITY OF SUCH DAMAGE. |
55 | // + POSSIBILITY OF SUCH DAMAGE. |
56 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
56 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
57 | #include <stdlib.h> |
57 | #include <stdlib.h> |
58 | #include "91x_lib.h" |
58 | #include "91x_lib.h" |
59 | #include "printf_P.h" |
59 | #include "printf_P.h" |
60 | #include "main.h" |
60 | #include "main.h" |
61 | #include "ubx.h" |
61 | #include "ubx.h" |
62 | #include "GPS.h" |
62 | #include "GPS.h" |
63 | #include "timer1.h" |
63 | #include "timer1.h" |
64 | #include "i2c.h" |
64 | #include "i2c.h" |
65 | #include "spi_slave.h" |
65 | #include "spi_slave.h" |
66 | #include "menu.h" |
66 | #include "menu.h" |
67 | #include "uart1.h" |
67 | #include "uart1.h" |
68 | 68 | ||
69 | s8 DisplayBuff[DISPLAYBUFFSIZE] = "Hello World"; |
69 | s8 DisplayBuff[DISPLAYBUFFSIZE] = "Hello World"; |
70 | u8 DispPtr = 0; |
70 | u8 DispPtr = 0; |
71 | 71 | ||
72 | u8 MenuItem = 0; |
72 | u8 MenuItem = 0; |
73 | u8 MaxMenuItem = 14; |
73 | u8 MaxMenuItem = 14; |
74 | u8 RemoteKeys = 0; |
74 | u8 RemoteKeys = 0; |
75 | 75 | ||
76 | #define KEY1 0x01 |
76 | #define KEY1 0x01 |
77 | #define KEY2 0x02 |
77 | #define KEY2 0x02 |
78 | #define KEY3 0x04 |
78 | #define KEY3 0x04 |
79 | #define KEY4 0x08 |
79 | #define KEY4 0x08 |
80 | #define KEY5 0x10 |
80 | #define KEY5 0x10 |
81 | 81 | ||
82 | /************************************/ |
82 | /************************************/ |
83 | /* Clear LCD Buffer */ |
83 | /* Clear LCD Buffer */ |
84 | /************************************/ |
84 | /************************************/ |
85 | void LCD_Clear(void) |
85 | void LCD_Clear(void) |
86 | { |
86 | { |
87 | u8 i; |
87 | u8 i; |
88 | for( i = 0; i < DISPLAYBUFFSIZE; i++) DisplayBuff[i] = ' '; |
88 | for( i = 0; i < DISPLAYBUFFSIZE; i++) DisplayBuff[i] = ' '; |
89 | } |
89 | } |
90 | 90 | ||
91 | 91 | ||
92 | /************************************/ |
92 | /************************************/ |
93 | /* Update Menu on LCD */ |
93 | /* Update Menu on LCD */ |
94 | /************************************/ |
94 | /************************************/ |
95 | // Display with 20 characters in 4 lines |
95 | // Display with 20 characters in 4 lines |
96 | void LCD_PrintMenu(void) |
96 | void LCD_PrintMenu(void) |
97 | { |
97 | { |
98 | s32 i1,i2; |
98 | s32 i1,i2; |
99 | u8 sign; |
99 | u8 sign; |
100 | if(RemoteKeys & KEY1) { if(MenuItem) MenuItem--; else MenuItem = MaxMenuItem;} |
100 | if(RemoteKeys & KEY1) { if(MenuItem) MenuItem--; else MenuItem = MaxMenuItem;} |
101 | if(RemoteKeys & KEY2) { if(MenuItem == MaxMenuItem) MenuItem = 0; else MenuItem++;} |
101 | if(RemoteKeys & KEY2) { if(MenuItem == MaxMenuItem) MenuItem = 0; else MenuItem++;} |
102 | if((RemoteKeys & KEY1) && (RemoteKeys & KEY2)) MenuItem = 0; |
102 | if((RemoteKeys & KEY1) && (RemoteKeys & KEY2)) MenuItem = 0; |
103 | 103 | ||
104 | LCD_Clear(); |
104 | LCD_Clear(); |
105 | if(MenuItem > MaxMenuItem) MenuItem = MaxMenuItem; |
105 | if(MenuItem > MaxMenuItem) MenuItem = MaxMenuItem; |
106 | // print menu item number in the upper right corner |
106 | // print menu item number in the upper right corner |
107 | if(MenuItem < 10) |
107 | if(MenuItem < 10) |
108 | { |
108 | { |
109 | LCD_printfxy(17,0,"[%i]",MenuItem); |
109 | LCD_printfxy(17,0,"[%i]",MenuItem); |
110 | } |
110 | } |
111 | else |
111 | else |
112 | { |
112 | { |
113 | LCD_printfxy(16,0,"[%i]",MenuItem); |
113 | LCD_printfxy(16,0,"[%i]",MenuItem); |
114 | } |
114 | } |
115 | 115 | ||
116 | switch(MenuItem) |
116 | switch(MenuItem) |
117 | { |
117 | { |
118 | // Version Info |
118 | // Version Info |
119 | case 0: |
119 | case 0: |
120 | LCD_printfxy(0,0,"++ Navi-Ctrl ++"); |
120 | LCD_printfxy(0,0,"++ Navi-Ctrl ++"); |
121 | LCD_printfxy(0,1," V%d.%d%c ", VERSION_MAJOR, VERSION_MINOR, 'a'+ VERSION_PATCH); |
121 | LCD_printfxy(0,1," V%d.%d%c ", VERSION_MAJOR, VERSION_MINOR, 'a'+ VERSION_PATCH); |
122 | if(ErrorCode) LCD_printfxy(11,1," Err:%d",ErrorCode) else LCD_printfxy(11,1," "); |
122 | if(ErrorCode) LCD_printfxy(11,1," Err:%d",ErrorCode) else LCD_printfxy(11,1," "); |
123 | LCD_printfxy(0,2,"%s",ErrorMSG); |
123 | LCD_printfxy(0,2,"%s",ErrorMSG); |
124 | LCD_printfxy(0,3,"(c) Buss, Busker"); |
124 | LCD_printfxy(0,3,"(c) Buss, Busker"); |
125 | break; |
125 | break; |
126 | case 1: |
126 | case 1: |
127 | if (GPSData.Status == INVALID) |
127 | if (GPSData.Status == INVALID) |
128 | { |
128 | { |
129 | LCD_printfxy(0,0,"No GPS data"); |
129 | LCD_printfxy(0,0,"No GPS data"); |
130 | LCD_printfxy(0,1,"Lon: "); |
130 | LCD_printfxy(0,1,"Lon: "); |
131 | LCD_printfxy(0,2,"Lat: "); |
131 | LCD_printfxy(0,2,"Lat: "); |
132 | LCD_printfxy(0,3,"Alt: "); |
132 | LCD_printfxy(0,3,"Alt: "); |
133 | } |
133 | } |
134 | else // newdata or processed |
134 | else // newdata or processed |
135 | { |
135 | { |
136 | LCD_printfxy(0,0,"Sat:%02d ", GPSData.NumOfSats); |
136 | LCD_printfxy(0,0,"Sat:%02d ", GPSData.NumOfSats); |
137 | switch (GPSData.SatFix) |
137 | switch (GPSData.SatFix) |
138 | { |
138 | { |
139 | case SATFIX_NONE: |
139 | case SATFIX_NONE: |
140 | LCD_printfxy(7,0,"Fix:No"); |
140 | LCD_printfxy(7,0,"NoFix"); |
141 | break; |
141 | break; |
142 | case SATFIX_2D: |
142 | case SATFIX_2D: |
143 | LCD_printfxy(7,0,"Fix:2D"); |
143 | LCD_printfxy(7,0,"2DFix"); |
144 | break; |
144 | break; |
145 | case SATFIX_3D: |
145 | case SATFIX_3D: |
146 | LCD_printfxy(7,0,"Fix:3D"); |
146 | LCD_printfxy(7,0,"3DFix"); |
147 | break; |
147 | break; |
148 | default: |
148 | default: |
149 | LCD_printfxy(7,0,"Fix:??"); |
149 | LCD_printfxy(7,0,"??Fix"); |
150 | break; |
150 | break; |
151 | } |
151 | } |
152 | if(GPSData.Flags & FLAG_DIFFSOLN) |
152 | if(GPSData.Flags & FLAG_DIFFSOLN) |
153 | { |
153 | { |
154 | LCD_printfxy(13,0,"SBAS"); |
154 | LCD_printfxy(12,0,"/DGPS"); |
155 | } |
155 | } |
156 | else |
156 | else |
157 | { |
157 | { |
158 | LCD_printfxy(13,0," "); |
158 | LCD_printfxy(12,0," "); |
159 | } |
159 | } |
160 | 160 | ||
161 | if(GPSData.Position.Longitude < 0) sign = '-'; |
161 | if(GPSData.Position.Longitude < 0) sign = '-'; |
162 | else sign = '+'; |
162 | else sign = '+'; |
163 | i1 = abs(GPSData.Position.Longitude)/10000000L; |
163 | i1 = abs(GPSData.Position.Longitude)/10000000L; |
164 | i2 = abs(GPSData.Position.Longitude)%10000000L; |
164 | i2 = abs(GPSData.Position.Longitude)%10000000L; |
165 | LCD_printfxy(0,1,"Lon:%c%03ld.%07ld deg",sign, i1, i2); |
165 | LCD_printfxy(0,1,"Lon:%c%03ld.%07ld deg",sign, i1, i2); |
166 | if(GPSData.Position.Latitude < 0) sign = '-'; |
166 | if(GPSData.Position.Latitude < 0) sign = '-'; |
167 | else sign = '+'; |
167 | else sign = '+'; |
168 | i1 = abs(GPSData.Position.Latitude)/10000000L; |
168 | i1 = abs(GPSData.Position.Latitude)/10000000L; |
169 | i2 = abs(GPSData.Position.Latitude)%10000000L; |
169 | i2 = abs(GPSData.Position.Latitude)%10000000L; |
170 | LCD_printfxy(0,2,"Lat:%c%03ld.%07ld deg",sign, i1, i2); |
170 | LCD_printfxy(0,2,"Lat:%c%03ld.%07ld deg",sign, i1, i2); |
171 | if(GPSData.Position.Altitude < 0) sign = '-'; |
171 | if(GPSData.Position.Altitude < 0) sign = '-'; |
172 | else sign = '+'; |
172 | else sign = '+'; |
173 | i1 = abs(GPSData.Position.Altitude)/1000L; |
173 | i1 = abs(GPSData.Position.Altitude)/1000L; |
174 | i2 = abs(GPSData.Position.Altitude)%1000L; |
174 | i2 = abs(GPSData.Position.Altitude)%1000L; |
175 | LCD_printfxy(0,3,"Alt:%c%04ld.%03ld m", sign, i1, i2); |
175 | LCD_printfxy(0,3,"Alt:%c%04ld.%03ld m", sign, i1, i2); |
176 | } |
176 | } |
177 | break; |
177 | break; |
178 | case 2: |
178 | case 2: |
179 | if (GPSData.Status == INVALID) |
179 | if (GPSData.Status == INVALID) |
180 | { |
180 | { |
181 | LCD_printfxy(0,0,"No GPS data"); |
181 | LCD_printfxy(0,0,"No GPS data"); |
182 | LCD_printfxy(0,1,"Speed N: "); |
182 | LCD_printfxy(0,1,"Speed N: "); |
183 | LCD_printfxy(0,2,"Speed E: "); |
183 | LCD_printfxy(0,2,"Speed E: "); |
184 | LCD_printfxy(0,3,"Speed T: "); |
184 | LCD_printfxy(0,3,"Speed T: "); |
185 | } |
185 | } |
186 | else // newdata or processed |
186 | else // newdata or processed |
187 | { |
187 | { |
188 | LCD_printfxy(0,0,"Sat:%02d ", GPSData.NumOfSats); |
188 | LCD_printfxy(0,0,"Sat:%02d ", GPSData.NumOfSats); |
189 | switch (GPSData.SatFix) |
189 | switch (GPSData.SatFix) |
190 | { |
190 | { |
191 | case SATFIX_NONE: |
191 | case SATFIX_NONE: |
192 | LCD_printfxy(7,0,"Fix:No"); |
192 | LCD_printfxy(7,0,"NoFix"); |
193 | break; |
193 | break; |
194 | case SATFIX_2D: |
194 | case SATFIX_2D: |
195 | LCD_printfxy(7,0,"Fix:2D"); |
195 | LCD_printfxy(7,0,"2DFix"); |
196 | break; |
196 | break; |
197 | case SATFIX_3D: |
197 | case SATFIX_3D: |
198 | LCD_printfxy(7,0,"Fix:3D"); |
198 | LCD_printfxy(7,0,"3DFix"); |
199 | break; |
199 | break; |
200 | default: |
200 | default: |
201 | LCD_printfxy(7,0,"Fix:??"); |
201 | LCD_printfxy(7,0,"??Fix"); |
202 | break; |
202 | break; |
203 | } |
203 | } |
204 | if(GPSData.Flags & FLAG_DIFFSOLN) |
204 | if(GPSData.Flags & FLAG_DIFFSOLN) |
205 | { |
205 | { |
206 | LCD_printfxy(13,0,"SBAS"); |
206 | LCD_printfxy(12,0,"/DGPS"); |
207 | } |
207 | } |
208 | else |
208 | else |
209 | { |
209 | { |
210 | LCD_printfxy(13,0," "); |
210 | LCD_printfxy(12,0," "); |
211 | } |
211 | } |
212 | 212 | ||
213 | LCD_printfxy(0,1,"Speed N: %+4ld cm/s",GPSData.Speed_North); |
213 | LCD_printfxy(0,1,"Speed N: %+4ld cm/s",GPSData.Speed_North); |
214 | LCD_printfxy(0,2,"Speed E: %+4ld cm/s",GPSData.Speed_East); |
214 | LCD_printfxy(0,2,"Speed E: %+4ld cm/s",GPSData.Speed_East); |
215 | LCD_printfxy(0,3,"Speed T: %+4ld cm/s",GPSData.Speed_Top); |
215 | LCD_printfxy(0,3,"Speed T: %+4ld cm/s",GPSData.Speed_Top); |
216 | } |
216 | } |
217 | break; |
217 | break; |
218 | case 3: |
218 | case 3: |
219 | LCD_printfxy(0,0,"GPS UTC Time"); |
219 | LCD_printfxy(0,0,"GPS UTC Time"); |
220 | if (!SystemTime.Valid) |
220 | if (!SystemTime.Valid) |
221 | { |
221 | { |
222 | LCD_printfxy(0,0,"GPS UTC Time"); |
222 | LCD_printfxy(0,0,"GPS UTC Time"); |
223 | LCD_printfxy(0,1," "); |
223 | LCD_printfxy(0,1," "); |
224 | LCD_printfxy(0,2," No time data! "); |
224 | LCD_printfxy(0,2," No time data! "); |
225 | LCD_printfxy(0,3," "); |
225 | LCD_printfxy(0,3," "); |
226 | } |
226 | } |
227 | else // newdata or processed |
227 | else // newdata or processed |
228 | { |
228 | { |
229 | LCD_printfxy(0,1," "); |
229 | LCD_printfxy(0,1," "); |
230 | LCD_printfxy(0,2,"Date: %02i/%02i/%04i",SystemTime.Month, SystemTime.Day, SystemTime.Year); |
230 | LCD_printfxy(0,2,"Date: %02i/%02i/%04i",SystemTime.Month, SystemTime.Day, SystemTime.Year); |
231 | LCD_printfxy(0,3,"Time: %02i:%02i:%02i.%03i", SystemTime.Hour, SystemTime.Min, SystemTime.Sec, SystemTime.mSec); |
231 | LCD_printfxy(0,3,"Time: %02i:%02i:%02i.%03i", SystemTime.Hour, SystemTime.Min, SystemTime.Sec, SystemTime.mSec); |
232 | 232 | ||
233 | } |
233 | } |
234 | break; |
234 | break; |
235 | case 4: // Navi Params 1 from FC |
235 | case 4: // Navi Params 1 from FC |
236 | LCD_printfxy(0,0,"NaviMode: %3i" , Parameter.NaviGpsModeControl); |
236 | LCD_printfxy(0,0,"NaviMode: %3i" , Parameter.NaviGpsModeControl); |
237 | LCD_printfxy(0,1,"G :%3i P :%3i ",Parameter.NaviGpsGain, Parameter.NaviGpsP); |
237 | LCD_printfxy(0,1,"G :%3i P :%3i ",Parameter.NaviGpsGain, Parameter.NaviGpsP); |
238 | LCD_printfxy(0,2,"I :%3i D :%3i ",Parameter.NaviGpsI, Parameter.NaviGpsD); |
238 | LCD_printfxy(0,2,"I :%3i D :%3i ",Parameter.NaviGpsI, Parameter.NaviGpsD); |
239 | LCD_printfxy(0,3,"ACC:%3i SAT:%3i ",Parameter.NaviGpsACC, Parameter.NaviGpsMinSat); |
239 | LCD_printfxy(0,3,"ACC:%3i SAT:%3i ",Parameter.NaviGpsACC, Parameter.NaviGpsMinSat); |
240 | break; |
240 | break; |
241 | case 5: // Navi Params 2 from FC |
241 | case 5: // Navi Params 2 from FC |
242 | LCD_printfxy(0,0,"Stick TS: %3i", Parameter.NaviStickThreshold); |
242 | LCD_printfxy(0,0,"Stick TS: %3i", Parameter.NaviStickThreshold); |
243 | LCD_printfxy(0,1,"MaxRadius: %3i m", Parameter.NaviOperatingRadius); |
243 | LCD_printfxy(0,1,"MaxRadius: %3i m", Parameter.NaviOperatingRadius); |
244 | LCD_printfxy(0,2,"WindCorr: %3i", Parameter.NaviWindCorrection); |
244 | LCD_printfxy(0,2,"WindCorr: %3i", Parameter.NaviWindCorrection); |
245 | LCD_printfxy(0,3,"SpeedComp: %3i", Parameter.NaviSpeedCompensation); |
245 | LCD_printfxy(0,3,"SpeedComp: %3i", Parameter.NaviSpeedCompensation); |
246 | break; |
246 | break; |
247 | case 6: // Navi Params 3 from FC |
247 | case 6: // Navi Params 3 from FC |
248 | LCD_printfxy(0,0,"Angle-Limit: %3i", Parameter.NaviAngleLimitation); |
248 | LCD_printfxy(0,0,"Angle-Limit: %3i", Parameter.NaviAngleLimitation); |
249 | LCD_printfxy(0,1," P-Limit: %3i", Parameter.NaviGpsPLimit); |
249 | LCD_printfxy(0,1," P-Limit: %3i", Parameter.NaviGpsPLimit); |
250 | LCD_printfxy(0,2," I-Limit: %3i", Parameter.NaviGpsILimit); |
250 | LCD_printfxy(0,2," I-Limit: %3i", Parameter.NaviGpsILimit); |
251 | LCD_printfxy(0,3," D-Limit: %3i", Parameter.NaviGpsDLimit); |
251 | LCD_printfxy(0,3," D-Limit: %3i", Parameter.NaviGpsDLimit); |
252 | break; |
252 | break; |
253 | case 7: |
253 | case 7: |
254 | LCD_printfxy(0,0,"Home Position"); |
254 | LCD_printfxy(0,0,"Home Position"); |
255 | if(GPS_HomePosition.Status == INVALID) |
255 | if(GPS_HomePosition.Status == INVALID) |
256 | { |
256 | { |
257 | LCD_printfxy(0,1," "); |
257 | LCD_printfxy(0,1," "); |
258 | LCD_printfxy(0,2," Is not set. "); |
258 | LCD_printfxy(0,2," Is not set. "); |
259 | LCD_printfxy(0,3," "); |
259 | LCD_printfxy(0,3," "); |
260 | } |
260 | } |
261 | else |
261 | else |
262 | { |
262 | { |
263 | if(GPS_HomePosition.Longitude < 0) sign = '-'; |
263 | if(GPS_HomePosition.Longitude < 0) sign = '-'; |
264 | else sign = '+'; |
264 | else sign = '+'; |
265 | i1 = abs(GPS_HomePosition.Longitude)/10000000L; |
265 | i1 = abs(GPS_HomePosition.Longitude)/10000000L; |
266 | i2 = abs(GPS_HomePosition.Longitude)%10000000L; |
266 | i2 = abs(GPS_HomePosition.Longitude)%10000000L; |
267 | LCD_printfxy(0,1,"Lon:%c%03ld.%07ld deg",sign, i1, i2); |
267 | LCD_printfxy(0,1,"Lon:%c%03ld.%07ld deg",sign, i1, i2); |
268 | if(GPS_HomePosition.Latitude < 0) sign = '-'; |
268 | if(GPS_HomePosition.Latitude < 0) sign = '-'; |
269 | else sign = '+'; |
269 | else sign = '+'; |
270 | i1 = abs(GPS_HomePosition.Latitude)/10000000L; |
270 | i1 = abs(GPS_HomePosition.Latitude)/10000000L; |
271 | i2 = abs(GPS_HomePosition.Latitude)%10000000L; |
271 | i2 = abs(GPS_HomePosition.Latitude)%10000000L; |
272 | LCD_printfxy(0,2,"Lat:%c%03ld.%07ld deg",sign, i1, i2); |
272 | LCD_printfxy(0,2,"Lat:%c%03ld.%07ld deg",sign, i1, i2); |
273 | if(GPS_HomePosition.Altitude < 0) sign = '-'; |
273 | if(GPS_HomePosition.Altitude < 0) sign = '-'; |
274 | else sign = '+'; |
274 | else sign = '+'; |
275 | i1 = abs(GPS_HomePosition.Altitude)/1000L; |
275 | i1 = abs(GPS_HomePosition.Altitude)/1000L; |
276 | i2 = abs(GPS_HomePosition.Altitude)%1000L; |
276 | i2 = abs(GPS_HomePosition.Altitude)%1000L; |
277 | LCD_printfxy(0,3,"Alt:%c%04ld.%03ld m",sign, i1, i2); |
277 | LCD_printfxy(0,3,"Alt:%c%04ld.%03ld m",sign, i1, i2); |
278 | } |
278 | } |
279 | break; |
279 | break; |
280 | case 8: // RC stick controls from FC |
280 | case 8: // RC stick controls from FC |
281 | LCD_printfxy(0,0,"RC-Sticks" ); |
281 | LCD_printfxy(0,0,"RC-Sticks" ); |
282 | LCD_printfxy(0,1,"Ni:%4i Ro:%4i ",FC.StickNick, FC.StickRoll); |
282 | LCD_printfxy(0,1,"Ni:%4i Ro:%4i ",FC.StickNick, FC.StickRoll); |
283 | LCD_printfxy(0,2,"Gs:%4i Ya:%4i ",FC.StickGas, FC.StickYaw); |
283 | LCD_printfxy(0,2,"Gs:%4i Ya:%4i ",FC.StickGas, FC.StickYaw); |
284 | break; |
284 | break; |
285 | case 9: // RC poti controls from FC |
285 | case 9: // RC poti controls from FC |
286 | LCD_printfxy(0,0,"RC-Potis" ); |
286 | LCD_printfxy(0,0,"RC-Potis" ); |
287 | LCD_printfxy(0,1,"Po1:%3i Po2:%3i ",FC.Poti1, FC.Poti2); |
287 | LCD_printfxy(0,1,"Po1:%3i Po2:%3i ",FC.Poti1, FC.Poti2); |
288 | LCD_printfxy(0,2,"Po3:%3i Po4:%3i ",FC.Poti3, FC.Poti4); |
288 | LCD_printfxy(0,2,"Po3:%3i Po4:%3i ",FC.Poti3, FC.Poti4); |
289 | break; |
289 | break; |
290 | case 10: // attitude from FC |
290 | case 10: // attitude from FC |
291 | if(FromFlightCtrl.AngleNick < 0) sign = '-'; |
291 | if(FromFlightCtrl.AngleNick < 0) sign = '-'; |
292 | else sign = '+'; |
292 | else sign = '+'; |
293 | i1 = abs(FromFlightCtrl.AngleNick)/10; |
293 | i1 = abs(FromFlightCtrl.AngleNick)/10; |
294 | i2 = abs(FromFlightCtrl.AngleNick)%10; |
294 | i2 = abs(FromFlightCtrl.AngleNick)%10; |
295 | LCD_printfxy(0,0,"GyroNick:%c%03i.%01i", sign, i1, i2); |
295 | LCD_printfxy(0,0,"GyroNick:%c%03i.%01i", sign, i1, i2); |
296 | if(FromFlightCtrl.AngleRoll < 0) sign = '-'; |
296 | if(FromFlightCtrl.AngleRoll < 0) sign = '-'; |
297 | else sign = '+'; |
297 | else sign = '+'; |
298 | i1 = abs(FromFlightCtrl.AngleRoll)/10; |
298 | i1 = abs(FromFlightCtrl.AngleRoll)/10; |
299 | i2 = abs(FromFlightCtrl.AngleRoll)%10; |
299 | i2 = abs(FromFlightCtrl.AngleRoll)%10; |
300 | LCD_printfxy(0,1,"GyroRoll:%c%03i.%01i", sign, i1, i2); |
300 | LCD_printfxy(0,1,"GyroRoll:%c%03i.%01i", sign, i1, i2); |
301 | if(FromFlightCtrl.AccNick < 0) sign = '-'; |
301 | if(FromFlightCtrl.AccNick < 0) sign = '-'; |
302 | else sign = '+'; |
302 | else sign = '+'; |
303 | i1 = abs(FromFlightCtrl.AccNick)/10; |
303 | i1 = abs(FromFlightCtrl.AccNick)/10; |
304 | i2 = abs(FromFlightCtrl.AccNick)%10; |
304 | i2 = abs(FromFlightCtrl.AccNick)%10; |
305 | LCD_printfxy(0,2," AccNick:%c%03i.%01i", sign, i1, i2); |
305 | LCD_printfxy(0,2," AccNick:%c%03i.%01i", sign, i1, i2); |
306 | if(FromFlightCtrl.AccRoll < 0) sign = '-'; |
306 | if(FromFlightCtrl.AccRoll < 0) sign = '-'; |
307 | else sign = '+'; |
307 | else sign = '+'; |
308 | i1 = abs(FromFlightCtrl.AccRoll)/10; |
308 | i1 = abs(FromFlightCtrl.AccRoll)/10; |
309 | i2 = abs(FromFlightCtrl.AccRoll)%10; |
309 | i2 = abs(FromFlightCtrl.AccRoll)%10; |
310 | LCD_printfxy(0,3," AccRoll:%c%03i.%01i", sign, i1, i2); |
310 | LCD_printfxy(0,3," AccRoll:%c%03i.%01i", sign, i1, i2); |
311 | break; |
311 | break; |
312 | case 11: // gyros from FC |
312 | case 11: // gyros from FC |
313 | LCD_printfxy(0,0,"GyroNick: %4i", FromFlightCtrl.GyroNick); |
313 | LCD_printfxy(0,0,"GyroNick: %4i", FromFlightCtrl.GyroNick); |
314 | LCD_printfxy(0,1,"GyroRoll: %4i", FromFlightCtrl.GyroRoll); |
314 | LCD_printfxy(0,1,"GyroRoll: %4i", FromFlightCtrl.GyroRoll); |
315 | LCD_printfxy(0,2,"GyroYaw: %4i", FromFlightCtrl.GyroYaw); |
315 | LCD_printfxy(0,2,"GyroYaw: %4i", FromFlightCtrl.GyroYaw); |
316 | break; |
316 | break; |
317 | case 12: // Remote Control Level from FC |
317 | case 12: // Remote Control Level from FC |
318 | LCD_printfxy(0,0,"RC-Level: %3i", FC.RC_Quality); |
318 | LCD_printfxy(0,0,"RC-Level: %3i", FC.RC_Quality); |
319 | LCD_printfxy(0,1,"Ubat: %3i.%1i V", FC.UBat/10, FC.UBat%10); |
319 | LCD_printfxy(0,1,"Ubat: %3i.%1i V", FC.UBat/10, FC.UBat%10); |
320 | LCD_printfxy(0,2,"CompHeading: %3i", I2C_Heading.Heading); |
320 | LCD_printfxy(0,2,"CompHeading: %3i", I2C_Heading.Heading); |
321 | LCD_printfxy(0,3,"GyroHeading: %3i", FromFlightCtrl.GyroHeading/10); |
321 | LCD_printfxy(0,3,"GyroHeading: %3i", FromFlightCtrl.GyroHeading/10); |
322 | break; |
322 | break; |
323 | case 13: // User Parameter |
323 | case 13: // User Parameter |
324 | LCD_printfxy(0,0,"UP1:%3i UP2:%3i ",Parameter.User1,Parameter.User2); |
324 | LCD_printfxy(0,0,"UP1:%3i UP2:%3i ",Parameter.User1,Parameter.User2); |
325 | LCD_printfxy(0,1,"UP3:%3i UP4:%3i ",Parameter.User3,Parameter.User4); |
325 | LCD_printfxy(0,1,"UP3:%3i UP4:%3i ",Parameter.User3,Parameter.User4); |
326 | LCD_printfxy(0,2,"UP5:%3i UP6:%3i ",Parameter.User5,Parameter.User6); |
326 | LCD_printfxy(0,2,"UP5:%3i UP6:%3i ",Parameter.User5,Parameter.User6); |
327 | LCD_printfxy(0,3,"UP7:%3i UP8:%3i ",Parameter.User7,Parameter.User8); |
327 | LCD_printfxy(0,3,"UP7:%3i UP8:%3i ",Parameter.User7,Parameter.User8); |
328 | break; |
328 | break; |
329 | case 14: // MK3MAG |
329 | case 14: // MK3MAG |
330 | I2C1_SendCommand(I2C_CMD_READ_MAG); |
330 | I2C1_SendCommand(I2C_CMD_READ_MAG); |
331 | LCD_printfxy(0,0,"MK3MAG V%i.%i%c",MK3MAG_Version.Major, MK3MAG_Version.Minor, 'a'+ MK3MAG_Version.Patch); |
331 | LCD_printfxy(0,0,"MK3MAG V%i.%i%c",MK3MAG_Version.Major, MK3MAG_Version.Minor, 'a'+ MK3MAG_Version.Patch); |
332 | LCD_printfxy(0,1,"MagX: %4i ",I2C_Mag.MagX); |
332 | LCD_printfxy(0,1,"MagX: %4i ",I2C_Mag.MagX); |
333 | LCD_printfxy(0,2,"MagY: %4i ",I2C_Mag.MagY); |
333 | LCD_printfxy(0,2,"MagY: %4i ",I2C_Mag.MagY); |
334 | LCD_printfxy(0,3,"MagZ: %4i ",I2C_Mag.MagZ); |
334 | LCD_printfxy(0,3,"MagZ: %4i ",I2C_Mag.MagZ); |
335 | break; |
335 | break; |
336 | default: |
336 | default: |
337 | MaxMenuItem = MenuItem - 1; |
337 | MaxMenuItem = MenuItem - 1; |
338 | MenuItem = 0; |
338 | MenuItem = 0; |
339 | break; |
339 | break; |
340 | } |
340 | } |
341 | RemoteKeys = 0; |
341 | RemoteKeys = 0; |
342 | } |
342 | } |
343 | 343 |