Rev 588 | Rev 617 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 588 | Rev 589 | ||
---|---|---|---|
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 / NON-COMMERCIAL USE ONLY |
6 | // + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
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 oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
28 | // + Die Portierung oder Nutzung 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 the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
43 | // + * porting the sources to other systems or using the software on other systems (except 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 "main.h" |
59 | #include "main.h" |
60 | #include "led.h" |
60 | #include "led.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 "compass.h" |
64 | #include "compass.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 | #include "ncmag.h" |
68 | #include "ncmag.h" |
69 | #include "logging.h" |
69 | #include "logging.h" |
70 | #include "settings.h" |
70 | #include "settings.h" |
71 | #include "sdc.h" |
71 | #include "sdc.h" |
72 | 72 | ||
73 | u8 DispPtr = 0; |
73 | u8 DispPtr = 0; |
74 | s8 DisplayBuff[DISPLAYBUFFSIZE]; |
74 | s8 DisplayBuff[DISPLAYBUFFSIZE]; |
75 | 75 | ||
76 | 76 | ||
77 | u8 MenuItem = 0; |
77 | u8 MenuItem = 0; |
78 | u8 MaxMenuItem = 27; |
78 | u8 MaxMenuItem = 27; |
79 | 79 | ||
80 | void Menu_Putchar(char c) |
80 | void Menu_Putchar(char c) |
81 | { |
81 | { |
82 | if(DispPtr < DISPLAYBUFFSIZE) DisplayBuff[DispPtr++] = c; ; |
82 | if(DispPtr < DISPLAYBUFFSIZE) DisplayBuff[DispPtr++] = c; ; |
83 | } |
83 | } |
84 | 84 | ||
85 | void Menu_Clear(void) |
85 | void Menu_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 | // Display with 20 characters in 4 lines |
91 | // Display with 20 characters in 4 lines |
92 | void Menu_Update(u8 Keys) |
92 | void Menu_Update(u8 Keys) |
93 | { |
93 | { |
94 | s32 i1,i2; |
94 | s32 i1,i2; |
95 | u8 sign; |
95 | u8 sign; |
96 | 96 | ||
97 | if(Keys & KEY1) { if(MenuItem > 0) MenuItem--; else MenuItem = MaxMenuItem;} |
97 | if(Keys & KEY1) { if(MenuItem > 0) MenuItem--; else MenuItem = MaxMenuItem;} |
98 | if(Keys & KEY2) { if(MenuItem == MaxMenuItem) MenuItem = 0; else MenuItem++;} |
98 | if(Keys & KEY2) { if(MenuItem == MaxMenuItem) MenuItem = 0; else MenuItem++;} |
99 | if((Keys & KEY1) && (Keys & KEY2)) MenuItem = 0; |
99 | if((Keys & KEY1) && (Keys & KEY2)) MenuItem = 0; |
100 | if(MenuItem > MaxMenuItem) MenuItem = MaxMenuItem; |
100 | if(MenuItem > MaxMenuItem) MenuItem = MaxMenuItem; |
101 | Menu_Clear(); |
101 | Menu_Clear(); |
102 | // print menu item number in the upper right corner |
102 | // print menu item number in the upper right corner |
103 | if(MenuItem < 10) |
103 | if(MenuItem < 10) |
104 | { |
104 | { |
105 | LCD_printfxy(17,0,"[%i]",MenuItem); |
105 | LCD_printfxy(17,0,"[%i]",MenuItem); |
106 | } |
106 | } |
107 | else // Menuitem >= 10 |
107 | else // Menuitem >= 10 |
108 | { |
108 | { |
109 | LCD_printfxy(16,0,"[%i]",MenuItem); |
109 | LCD_printfxy(16,0,"[%i]",MenuItem); |
110 | } |
110 | } |
111 | 111 | ||
112 | switch(MenuItem) |
112 | switch(MenuItem) |
113 | { |
113 | { |
114 | // Version Info |
114 | // Version Info |
115 | case 0: |
115 | case 0: |
116 | LCD_printfxy(0,0,"++ Navi-Ctrl ++"); |
116 | LCD_printfxy(0,0,"++ Navi-Ctrl ++"); |
117 | LCD_printfxy(0,1,"HW V%d.%d SW V%d.%02d%c", UART_VersionInfo.HWMajor/10, UART_VersionInfo.HWMajor%10, VERSION_MAJOR, VERSION_MINOR, 'a'+ VERSION_PATCH); |
117 | LCD_printfxy(0,1,"HW V%d.%d SW V%d.%02d%c", UART_VersionInfo.HWMajor/10, UART_VersionInfo.HWMajor%10, VERSION_MAJOR, VERSION_MINOR, 'a'+ VERSION_PATCH); |
118 | if(FC.StatusFlags3 & FC_STATUS3_REDUNDANCE) LCD_printfxy(19,1,"R"); |
118 | if(FC.StatusFlags3 & FC_STATUS3_REDUNDANCE) LCD_printfxy(19,1,"R"); |
119 | if(ErrorCode) |
119 | if(ErrorCode) |
120 | { |
120 | { |
121 | LCD_printfxy(0,2,"Error: %d",ErrorCode); |
121 | LCD_printfxy(0,2,"Error: %d",ErrorCode); |
122 | LCD_printfxy(0,3,"%s",ErrorMSG); |
122 | LCD_printfxy(0,3,"%s",ErrorMSG); |
123 | } |
123 | } |
124 | else |
124 | else |
125 | { |
125 | { |
126 | LCD_printfxy(0,2,"%s",ErrorMSG); |
126 | LCD_printfxy(0,2,"%s",ErrorMSG); |
127 | LCD_printfxy(0,3,"(c) HiSystems GmbH"); |
127 | LCD_printfxy(0,3,"(c) HiSystems GmbH"); |
128 | } |
128 | } |
129 | if(FC.StatusFlags3 & FC_STATUS3_BOAT) LCD_printfxy(16,2,"BOAT"); |
129 | if(FC.StatusFlags3 & FC_STATUS3_BOAT) LCD_printfxy(16,2,"BOAT"); |
130 | break; |
130 | break; |
131 | case 1: |
131 | case 1: |
132 | if (GPSData.Status == INVALID) |
132 | if (GPSData.Status == INVALID) |
133 | { |
133 | { |
134 | LCD_printfxy(0,0,"No GPS data"); |
134 | LCD_printfxy(0,0,"No GPS data"); |
135 | LCD_printfxy(0,1,"Lon: "); |
135 | LCD_printfxy(0,1,"Lon: "); |
136 | LCD_printfxy(0,2,"Lat: "); |
136 | LCD_printfxy(0,2,"Lat: "); |
137 | LCD_printfxy(0,3,"Alt: "); |
137 | LCD_printfxy(0,3,"Alt: "); |
138 | } |
138 | } |
139 | else // newdata or processed |
139 | else // newdata or processed |
140 | { |
140 | { |
141 | LCD_printfxy(0,0,"Sat:%02d ", GPSData.NumOfSats); |
141 | LCD_printfxy(0,0,"Sat:%02d ", GPSData.NumOfSats); |
142 | switch (GPSData.SatFix) |
142 | switch (GPSData.SatFix) |
143 | { |
143 | { |
144 | case SATFIX_NONE: |
144 | case SATFIX_NONE: |
145 | LCD_printfxy(7,0,"NoFix"); |
145 | LCD_printfxy(7,0,"NoFix"); |
146 | break; |
146 | break; |
147 | case SATFIX_2D: |
147 | case SATFIX_2D: |
148 | LCD_printfxy(7,0,"2DFix"); |
148 | LCD_printfxy(7,0,"2DFix"); |
149 | break; |
149 | break; |
150 | case SATFIX_3D: |
150 | case SATFIX_3D: |
151 | LCD_printfxy(7,0,"3DFix"); |
151 | LCD_printfxy(7,0,"3DFix"); |
152 | break; |
152 | break; |
153 | default: |
153 | default: |
154 | LCD_printfxy(7,0,"??Fix"); |
154 | LCD_printfxy(7,0,"??Fix"); |
155 | break; |
155 | break; |
156 | } |
156 | } |
157 | if(GPSData.Flags & FLAG_DIFFSOLN) |
157 | if(GPSData.Flags & FLAG_DIFFSOLN) |
158 | { |
158 | { |
159 | LCD_printfxy(12,0,"/DGPS"); |
159 | LCD_printfxy(12,0,"/DGPS"); |
160 | } |
160 | } |
161 | else |
161 | else |
162 | { |
162 | { |
163 | LCD_printfxy(12,0," "); |
163 | LCD_printfxy(12,0," "); |
164 | } |
164 | } |
165 | 165 | ||
166 | if(GPSData.Position.Longitude < 0) sign = '-'; |
166 | if(GPSData.Position.Longitude < 0) sign = '-'; |
167 | else sign = '+'; |
167 | else sign = '+'; |
168 | i1 = abs(GPSData.Position.Longitude)/10000000L; |
168 | i1 = abs(GPSData.Position.Longitude)/10000000L; |
169 | i2 = abs(GPSData.Position.Longitude)%10000000L; |
169 | i2 = abs(GPSData.Position.Longitude)%10000000L; |
170 | LCD_printfxy(0,1,"Lon:%c%03ld.%07ld deg",sign, i1, i2); |
170 | LCD_printfxy(0,1,"Lon:%c%03ld.%07ld deg",sign, i1, i2); |
171 | if(GPSData.Position.Latitude < 0) sign = '-'; |
171 | if(GPSData.Position.Latitude < 0) sign = '-'; |
172 | else sign = '+'; |
172 | else sign = '+'; |
173 | i1 = abs(GPSData.Position.Latitude)/10000000L; |
173 | i1 = abs(GPSData.Position.Latitude)/10000000L; |
174 | i2 = abs(GPSData.Position.Latitude)%10000000L; |
174 | i2 = abs(GPSData.Position.Latitude)%10000000L; |
175 | LCD_printfxy(0,2,"Lat:%c%03ld.%07ld deg",sign, i1, i2); |
175 | LCD_printfxy(0,2,"Lat:%c%03ld.%07ld deg",sign, i1, i2); |
176 | if(GPSData.Position.Altitude < 0) sign = '-'; |
176 | if(GPSData.Position.Altitude < 0) sign = '-'; |
177 | else sign = '+'; |
177 | else sign = '+'; |
178 | i1 = abs(GPSData.Position.Altitude)/1000L; |
178 | i1 = abs(GPSData.Position.Altitude)/1000L; |
179 | i2 = abs(GPSData.Position.Altitude)%1000L; |
179 | i2 = abs(GPSData.Position.Altitude)%1000L; |
180 | LCD_printfxy(0,3,"Alt:%c%04ld.%03ld m", sign, i1, i2); |
180 | LCD_printfxy(0,3,"Alt:%c%04ld.%03ld m", sign, i1, i2); |
181 | } |
181 | } |
182 | break; |
182 | break; |
183 | case 2: |
183 | case 2: |
184 | if (GPSData.Status == INVALID) |
184 | if (GPSData.Status == INVALID) |
185 | { |
185 | { |
186 | LCD_printfxy(0,0,"No GPS data"); |
186 | LCD_printfxy(0,0,"No GPS data"); |
187 | LCD_printfxy(0,1,"Speed N: "); |
187 | LCD_printfxy(0,1,"Speed N: "); |
188 | LCD_printfxy(0,2,"Speed E: "); |
188 | LCD_printfxy(0,2,"Speed E: "); |
189 | LCD_printfxy(0,3,"Speed T: "); |
189 | LCD_printfxy(0,3,"Speed T: "); |
190 | } |
190 | } |
191 | else // newdata or processed |
191 | else // newdata or processed |
192 | { |
192 | { |
193 | LCD_printfxy(0,0,"Sat:%02d ", GPSData.NumOfSats); |
193 | LCD_printfxy(0,0,"Sat:%02d ", GPSData.NumOfSats); |
194 | switch (GPSData.SatFix) |
194 | switch (GPSData.SatFix) |
195 | { |
195 | { |
196 | case SATFIX_NONE: |
196 | case SATFIX_NONE: |
197 | LCD_printfxy(7,0,"NoFix"); |
197 | LCD_printfxy(7,0,"NoFix"); |
198 | break; |
198 | break; |
199 | case SATFIX_2D: |
199 | case SATFIX_2D: |
200 | LCD_printfxy(7,0,"2DFix"); |
200 | LCD_printfxy(7,0,"2DFix"); |
201 | break; |
201 | break; |
202 | case SATFIX_3D: |
202 | case SATFIX_3D: |
203 | LCD_printfxy(7,0,"3DFix"); |
203 | LCD_printfxy(7,0,"3DFix"); |
204 | break; |
204 | break; |
205 | default: |
205 | default: |
206 | LCD_printfxy(7,0,"??Fix"); |
206 | LCD_printfxy(7,0,"??Fix"); |
207 | break; |
207 | break; |
208 | } |
208 | } |
209 | if(GPSData.Flags & FLAG_DIFFSOLN) |
209 | if(GPSData.Flags & FLAG_DIFFSOLN) |
210 | { |
210 | { |
211 | LCD_printfxy(12,0,"/DGPS"); |
211 | LCD_printfxy(12,0,"/DGPS"); |
212 | } |
212 | } |
213 | else |
213 | else |
214 | { |
214 | { |
215 | LCD_printfxy(12,0," "); |
215 | LCD_printfxy(12,0," "); |
216 | } |
216 | } |
217 | 217 | ||
218 | LCD_printfxy(0,1,"Speed N: %+4ld cm/s",GPSData.Speed_North); |
218 | LCD_printfxy(0,1,"Speed N: %+4ld cm/s",GPSData.Speed_North); |
219 | LCD_printfxy(0,2,"Speed E: %+4ld cm/s",GPSData.Speed_East); |
219 | LCD_printfxy(0,2,"Speed E: %+4ld cm/s",GPSData.Speed_East); |
220 | LCD_printfxy(0,3,"Speed T: %+4ld cm/s",GPSData.Speed_Top); |
220 | LCD_printfxy(0,3,"Speed T: %+4ld cm/s",GPSData.Speed_Top); |
221 | } |
221 | } |
222 | break; |
222 | break; |
223 | case 3: |
223 | case 3: |
224 | LCD_printfxy(0,0,"GPS UTC Time"); |
224 | LCD_printfxy(0,0,"GPS UTC Time"); |
225 | if (!SystemTime.Valid) |
225 | if (!SystemTime.Valid) |
226 | { |
226 | { |
227 | LCD_printfxy(0,1," "); |
227 | LCD_printfxy(0,1," "); |
228 | LCD_printfxy(0,2," No time data! "); |
228 | LCD_printfxy(0,2," No time data! "); |
229 | LCD_printfxy(0,3," "); |
229 | LCD_printfxy(0,3," "); |
230 | } |
230 | } |
231 | else // newdata or processed |
231 | else // newdata or processed |
232 | { |
232 | { |
233 | LCD_printfxy(0,1," "); |
233 | LCD_printfxy(0,1," "); |
234 | LCD_printfxy(0,2,"Date: %02i/%02i/%04i",SystemTime.Month, SystemTime.Day, SystemTime.Year); |
234 | LCD_printfxy(0,2,"Date: %02i/%02i/%04i",SystemTime.Month, SystemTime.Day, SystemTime.Year); |
235 | LCD_printfxy(0,3,"Time: %02i:%02i:%02i.%03i", SystemTime.Hour, SystemTime.Min, SystemTime.Sec, SystemTime.mSec); |
235 | LCD_printfxy(0,3,"Time: %02i:%02i:%02i.%03i", SystemTime.Hour, SystemTime.Min, SystemTime.Sec, SystemTime.mSec); |
236 | } |
236 | } |
237 | break; |
237 | break; |
238 | case 4: // Navi Params 1 from FC |
238 | case 4: // Navi Params 1 from FC |
239 | LCD_printfxy(0,0,"NaviMode: %3i" , Parameter.NaviGpsModeControl); |
239 | LCD_printfxy(0,0,"NaviMode: %3i" , Parameter.NaviGpsModeControl); |
240 | LCD_printfxy(0,1,"G :%3i P :%3i ",Parameter.NaviGpsGain, Parameter.NaviGpsP); |
240 | LCD_printfxy(0,1,"G :%3i P :%3i ",Parameter.NaviGpsGain, Parameter.NaviGpsP); |
241 | LCD_printfxy(0,2,"I :%3i D :%3i ",Parameter.NaviGpsI, Parameter.NaviGpsD); |
241 | LCD_printfxy(0,2,"I :%3i D :%3i ",Parameter.NaviGpsI, Parameter.NaviGpsD); |
242 | LCD_printfxy(0,3,"ACC:%3i SAT:%3i ",Parameter.NaviGpsACC, Parameter.NaviGpsMinSat); |
242 | LCD_printfxy(0,3,"ACC:%3i SAT:%3i ",Parameter.NaviGpsACC, Parameter.NaviGpsMinSat); |
243 | break; |
243 | break; |
244 | case 5: // Navi Params 2 from FC |
244 | case 5: // Navi Params 2 from FC |
245 | LCD_printfxy(0,0,"Stick TS: %3i", Parameter.NaviStickThreshold); |
245 | LCD_printfxy(0,0,"Stick TS: %3i", Parameter.NaviStickThreshold); |
246 | LCD_printfxy(0,1,"WP_Radius: %3im",MaxWP_Radius_in_m); |
246 | LCD_printfxy(0,1,"WP_Radius: %3im",MaxWP_Radius_in_m); |
247 | LCD_printfxy(0,2,"WindCorr: %3i", Parameter.NaviWindCorrection); |
247 | LCD_printfxy(0,2,"WindCorr: %3i", Parameter.NaviWindCorrection); |
248 | LCD_printfxy(0,3,"AccComp: %3i", Parameter.NaviSpeedCompensation); |
248 | LCD_printfxy(0,3,"AccComp: %3i", Parameter.NaviSpeedCompensation); |
249 | break; |
249 | break; |
250 | case 6: // Navi Params 3 from FC |
250 | case 6: // Navi Params 3 from FC |
251 | LCD_printfxy(0,0,"Angle-Limit: %3i", Parameter.NaviAngleLimitation); |
251 | LCD_printfxy(0,0,"Angle-Limit: %3i", Parameter.NaviAngleLimitation); |
252 | LCD_printfxy(0,1," P-Limit: %3i", Parameter.NaviGpsPLimit); |
252 | LCD_printfxy(0,1," P-Limit: %3i", Parameter.NaviGpsPLimit); |
253 | LCD_printfxy(0,2," I-Limit: %3i", Parameter.NaviGpsILimit); |
253 | LCD_printfxy(0,2," I-Limit: %3i", Parameter.NaviGpsILimit); |
254 | LCD_printfxy(0,3," D-Limit: %3i", Parameter.NaviGpsDLimit); |
254 | LCD_printfxy(0,3," D-Limit: %3i", Parameter.NaviGpsDLimit); |
255 | break; |
255 | break; |
256 | case 7: // Max Ranges |
256 | case 7: // Max Ranges |
257 | LCD_printfxy(0,0,"Maximum flying "); |
257 | LCD_printfxy(0,0,"Maximum flying "); |
258 | LCD_printfxy(0,1,"Range: %4im ", AbsoluteFlyingRange_m); |
258 | LCD_printfxy(0,1,"Range: %4im ", AbsoluteFlyingRange_m); |
259 | LCD_printfxy(0,2,"Descend: %4im ", AutoDescendRange_m); |
259 | LCD_printfxy(0,2,"Descend: %4im ", AutoDescendRange_m); |
260 | LCD_printfxy(0,3,"Altitude:%4im ", AbsoluteFlyingAltitude); |
260 | LCD_printfxy(0,3,"Altitude:%4im ", AbsoluteFlyingAltitude); |
261 | if(!AbsoluteFlyingRange_m) LCD_printfxy(9,1,"disabled"); |
261 | if(!AbsoluteFlyingRange_m) LCD_printfxy(9,1,"disabled"); |
262 | if(!AutoDescendRange_m) LCD_printfxy(9,2,"disabled"); |
262 | if(!AutoDescendRange_m) LCD_printfxy(9,2,"disabled"); |
263 | if(!AbsoluteFlyingAltitude) LCD_printfxy(9,3,"disabled"); |
263 | if(!AbsoluteFlyingAltitude) LCD_printfxy(9,3,"disabled"); |
264 | break; |
264 | break; |
265 | case 8: |
265 | case 8: |
266 | LCD_printfxy(0,0,"Home Position"); |
266 | LCD_printfxy(0,0,"Home Position"); |
267 | if(NaviData.HomePosition.Status == INVALID) |
267 | if(NaviData.HomePosition.Status == INVALID) |
268 | { |
268 | { |
269 | LCD_printfxy(0,1," "); |
269 | LCD_printfxy(0,1," "); |
270 | LCD_printfxy(0,2," Is not set. "); |
270 | LCD_printfxy(0,2," Is not set. "); |
271 | LCD_printfxy(0,3," "); |
271 | LCD_printfxy(0,3," "); |
272 | } |
272 | } |
273 | else |
273 | else |
274 | { |
274 | { |
275 | if(NaviData.HomePosition.Longitude < 0) sign = '-'; |
275 | if(NaviData.HomePosition.Longitude < 0) sign = '-'; |
276 | else sign = '+'; |
276 | else sign = '+'; |
277 | i1 = abs(NaviData.HomePosition.Longitude)/10000000L; |
277 | i1 = abs(NaviData.HomePosition.Longitude)/10000000L; |
278 | i2 = abs(NaviData.HomePosition.Longitude)%10000000L; |
278 | i2 = abs(NaviData.HomePosition.Longitude)%10000000L; |
279 | LCD_printfxy(0,1,"Lon:%c%03ld.%07ld deg",sign, i1, i2); |
279 | LCD_printfxy(0,1,"Lon:%c%03ld.%07ld deg",sign, i1, i2); |
280 | if(NaviData.HomePosition.Latitude < 0) sign = '-'; |
280 | if(NaviData.HomePosition.Latitude < 0) sign = '-'; |
281 | else sign = '+'; |
281 | else sign = '+'; |
282 | i1 = abs(NaviData.HomePosition.Latitude)/10000000L; |
282 | i1 = abs(NaviData.HomePosition.Latitude)/10000000L; |
283 | i2 = abs(NaviData.HomePosition.Latitude)%10000000L; |
283 | i2 = abs(NaviData.HomePosition.Latitude)%10000000L; |
284 | LCD_printfxy(0,2,"Lat:%c%03ld.%07ld deg",sign, i1, i2); |
284 | LCD_printfxy(0,2,"Lat:%c%03ld.%07ld deg",sign, i1, i2); |
285 | if(NaviData.HomePosition.Altitude < 0) sign = '-'; |
285 | if(NaviData.HomePosition.Altitude < 0) sign = '-'; |
286 | else sign = '+'; |
286 | else sign = '+'; |
287 | i1 = abs(NaviData.HomePosition.Altitude)/1000L; |
287 | i1 = abs(NaviData.HomePosition.Altitude)/1000L; |
288 | i2 = abs(NaviData.HomePosition.Altitude)%1000L; |
288 | i2 = abs(NaviData.HomePosition.Altitude)%1000L; |
289 | LCD_printfxy(0,3,"Alt:%c%04ld.%03ldm",sign, i1, i2); |
289 | LCD_printfxy(0,3,"Alt:%c%04ld.%1dm",sign, i1, i2/1000); |
290 | switch(Parameter.HomeYawMode) |
290 | switch(Parameter.HomeYawMode) |
291 | { |
291 | { |
292 | case NO_CHANGE: LCD_printfxy(17,3,"(-)"); break; |
292 | case NO_CHANGE: LCD_printfxy(17,3,"(-)"); break; |
293 | case FRONT_TO_HOME: LCD_printfxy(17,3,"(F)"); break; |
293 | case FRONT_TO_HOME: LCD_printfxy(17,3,"(F)"); break; |
294 | case REAR_TO_HOME: LCD_printfxy(17,3,"(R)"); break; |
294 | case REAR_TO_HOME: LCD_printfxy(17,3,"(R)"); break; |
295 | case LIKE_AT_START: LCD_printfxy(17,3,"(S)"); break; |
295 | case LIKE_AT_START: LCD_printfxy(17,3,"(S)"); break; |
296 | } |
296 | } |
297 | } |
297 | } |
298 | break; |
298 | break; |
299 | case 9: |
299 | case 9: |
300 | LCD_printfxy(0,0,"Target Position"); |
300 | LCD_printfxy(0,0,"Target Position"); |
301 | if(NaviData.TargetPosition.Status == INVALID) |
301 | if(NaviData.TargetPosition.Status == INVALID) |
302 | { |
302 | { |
303 | LCD_printfxy(0,1," "); |
303 | LCD_printfxy(0,1," "); |
304 | LCD_printfxy(0,2," Is not set. "); |
304 | LCD_printfxy(0,2," Is not set. "); |
305 | LCD_printfxy(0,3," "); |
305 | LCD_printfxy(0,3," "); |
306 | } |
306 | } |
307 | else |
307 | else |
308 | { |
308 | { |
309 | if(NaviData.TargetPosition.Longitude < 0) sign = '-'; |
309 | if(NaviData.TargetPosition.Longitude < 0) sign = '-'; |
310 | else sign = '+'; |
310 | else sign = '+'; |
311 | i1 = abs(NaviData.TargetPosition.Longitude)/10000000L; |
311 | i1 = abs(NaviData.TargetPosition.Longitude)/10000000L; |
312 | i2 = abs(NaviData.TargetPosition.Longitude)%10000000L; |
312 | i2 = abs(NaviData.TargetPosition.Longitude)%10000000L; |
313 | LCD_printfxy(0,1,"Lon:%c%03ld.%07ld deg",sign, i1, i2); |
313 | LCD_printfxy(0,1,"Lon:%c%03ld.%07ld deg",sign, i1, i2); |
314 | if(NaviData.TargetPosition.Latitude < 0) sign = '-'; |
314 | if(NaviData.TargetPosition.Latitude < 0) sign = '-'; |
315 | else sign = '+'; |
315 | else sign = '+'; |
316 | i1 = abs(NaviData.TargetPosition.Latitude)/10000000L; |
316 | i1 = abs(NaviData.TargetPosition.Latitude)/10000000L; |
317 | i2 = abs(NaviData.TargetPosition.Latitude)%10000000L; |
317 | i2 = abs(NaviData.TargetPosition.Latitude)%10000000L; |
318 | LCD_printfxy(0,2,"Lat:%c%03ld.%07ld deg",sign, i1, i2); |
318 | LCD_printfxy(0,2,"Lat:%c%03ld.%07ld deg",sign, i1, i2); |
319 | if(NaviData.HomePosition.Altitude < 0) sign = '-'; |
319 | if(NaviData.HomePosition.Altitude < 0) sign = '-'; |
320 | else sign = '+'; |
320 | else sign = '+'; |
321 | i1 = abs(NaviData.TargetPosition.Altitude)/1000L; |
321 | i1 = abs(NaviData.TargetPosition.Altitude)/1000L; |
322 | i2 = abs(NaviData.TargetPosition.Altitude)%1000L; |
322 | i2 = abs(NaviData.TargetPosition.Altitude)%1000L; |
323 | LCD_printfxy(0,3,"Alt:%c%04ld.%03ldm",sign, i1, i2); |
323 | LCD_printfxy(0,3,"Alt:%c%04ld.%03ldm",sign, i1, i2); |
324 | } |
324 | } |
325 | break; |
325 | break; |
326 | case 10: // RC stick controls from FC |
326 | case 10: // RC stick controls from FC |
327 | LCD_printfxy(0,0,"RC-Sticks" ); |
327 | LCD_printfxy(0,0,"RC-Sticks" ); |
328 | LCD_printfxy(0,1,"Ni:%4i Ro:%4i ",FC.StickNick, FC.StickRoll); |
328 | LCD_printfxy(0,1,"Ni:%4i Ro:%4i ",FC.StickNick, FC.StickRoll); |
329 | LCD_printfxy(0,2,"Gs:%4i Ya:%4i ",FC.StickGas, FC.StickYaw); |
329 | LCD_printfxy(0,2,"Gs:%4i Ya:%4i ",FC.StickGas, FC.StickYaw); |
330 | LCD_printfxy(0,3,"RC-Level: %3i", FC.RC_Quality); // Remote Control Level from FC |
330 | LCD_printfxy(0,3,"RC-Level: %3i", FC.RC_Quality); // Remote Control Level from FC |
331 | break; |
331 | break; |
332 | case 11: // RC poti controls from FC |
332 | case 11: // RC poti controls from FC |
333 | LCD_printfxy(0,0,"RC-Potis 1" ); |
333 | LCD_printfxy(0,0,"RC-Potis 1" ); |
334 | LCD_printfxy(0,1,"Po1:%3i Po2:%3i ",FC.Poti[0], FC.Poti[1]); |
334 | LCD_printfxy(0,1,"Po1:%3i Po2:%3i ",FC.Poti[0], FC.Poti[1]); |
335 | LCD_printfxy(0,2,"Po3:%3i Po4:%3i ",FC.Poti[2], FC.Poti[3]); |
335 | LCD_printfxy(0,2,"Po3:%3i Po4:%3i ",FC.Poti[2], FC.Poti[3]); |
336 | break; |
336 | break; |
337 | case 12: // RC poti controls from FC |
337 | case 12: // RC poti controls from FC |
338 | LCD_printfxy(0,0,"RC-Potis 2" ); |
338 | LCD_printfxy(0,0,"RC-Potis 2" ); |
339 | LCD_printfxy(0,1,"Po5:%3i Po6:%3i ",FC.Poti[4], FC.Poti[5]); |
339 | LCD_printfxy(0,1,"Po5:%3i Po6:%3i ",FC.Poti[4], FC.Poti[5]); |
340 | LCD_printfxy(0,2,"Po7:%3i Po8:%3i ",FC.Poti[6], FC.Poti[7]); |
340 | LCD_printfxy(0,2,"Po7:%3i Po8:%3i ",FC.Poti[6], FC.Poti[7]); |
341 | break; |
341 | break; |
342 | case 13: // attitude from FC |
342 | case 13: // attitude from FC |
343 | if(FromFlightCtrl.AngleNick < 0) sign = '-'; |
343 | if(FromFlightCtrl.AngleNick < 0) sign = '-'; |
344 | else sign = '+'; |
344 | else sign = '+'; |
345 | i1 = abs(FromFlightCtrl.AngleNick)/10; |
345 | i1 = abs(FromFlightCtrl.AngleNick)/10; |
346 | i2 = abs(FromFlightCtrl.AngleNick)%10; |
346 | i2 = abs(FromFlightCtrl.AngleNick)%10; |
347 | LCD_printfxy(0,0,"GyroNick:%c%03ld.%01ld", sign, i1, i2); |
347 | LCD_printfxy(0,0,"GyroNick:%c%03ld.%01ld", sign, i1, i2); |
348 | if(FromFlightCtrl.AngleRoll < 0) sign = '-'; |
348 | if(FromFlightCtrl.AngleRoll < 0) sign = '-'; |
349 | else sign = '+'; |
349 | else sign = '+'; |
350 | i1 = abs(FromFlightCtrl.AngleRoll)/10; |
350 | i1 = abs(FromFlightCtrl.AngleRoll)/10; |
351 | i2 = abs(FromFlightCtrl.AngleRoll)%10; |
351 | i2 = abs(FromFlightCtrl.AngleRoll)%10; |
352 | LCD_printfxy(0,1,"GyroRoll:%c%03ld.%01ld", sign, i1, i2); |
352 | LCD_printfxy(0,1,"GyroRoll:%c%03ld.%01ld", sign, i1, i2); |
353 | if(FromFlightCtrl.AccNick < 0) sign = '-'; |
353 | if(FromFlightCtrl.AccNick < 0) sign = '-'; |
354 | else sign = '+'; |
354 | else sign = '+'; |
355 | i1 = abs(FromFlightCtrl.AccNick)/10; |
355 | i1 = abs(FromFlightCtrl.AccNick)/10; |
356 | i2 = abs(FromFlightCtrl.AccNick)%10; |
356 | i2 = abs(FromFlightCtrl.AccNick)%10; |
357 | LCD_printfxy(0,2," AccNick:%c%03ld.%01ld", sign, i1, i2); |
357 | LCD_printfxy(0,2," AccNick:%c%03ld.%01ld", sign, i1, i2); |
358 | if(FromFlightCtrl.AccRoll < 0) sign = '-'; |
358 | if(FromFlightCtrl.AccRoll < 0) sign = '-'; |
359 | else sign = '+'; |
359 | else sign = '+'; |
360 | i1 = abs(FromFlightCtrl.AccRoll)/10; |
360 | i1 = abs(FromFlightCtrl.AccRoll)/10; |
361 | i2 = abs(FromFlightCtrl.AccRoll)%10; |
361 | i2 = abs(FromFlightCtrl.AccRoll)%10; |
362 | LCD_printfxy(0,3," AccRoll:%c%03ld.%01ld", sign, i1, i2); |
362 | LCD_printfxy(0,3," AccRoll:%c%03ld.%01ld", sign, i1, i2); |
363 | break; |
363 | break; |
364 | case 14: // gyros from FC |
364 | case 14: // gyros from FC |
365 | LCD_printfxy(0,0,"GyroNick: %4i", FromFlightCtrl.GyroNick); |
365 | LCD_printfxy(0,0,"GyroNick: %4i", FromFlightCtrl.GyroNick); |
366 | LCD_printfxy(0,1,"GyroRoll: %4i", FromFlightCtrl.GyroRoll); |
366 | LCD_printfxy(0,1,"GyroRoll: %4i", FromFlightCtrl.GyroRoll); |
367 | LCD_printfxy(0,2,"GyroYaw: %4i", FromFlightCtrl.GyroYaw); |
367 | LCD_printfxy(0,2,"GyroYaw: %4i", FromFlightCtrl.GyroYaw); |
368 | if(FC_is_Calibrated) LCD_printfxy(0,3,"Calibrated ") |
368 | if(FC_is_Calibrated) LCD_printfxy(0,3,"Calibrated ") |
369 | else LCD_printfxy(0,3,"not calibrated"); |
369 | else LCD_printfxy(0,3,"not calibrated"); |
370 | break; |
370 | break; |
371 | case 15: |
371 | case 15: |
372 | LCD_printfxy(0,0,"Compass: %3i", FromFlightCtrl.GyroHeading / 10); |
372 | LCD_printfxy(0,0,"Compass: %3i", FromFlightCtrl.GyroHeading / 10); |
373 | LCD_printfxy(0,1,"Man.-Offset:%3i", FC.FromFC_CompassOffset / 10); |
373 | LCD_printfxy(0,1,"Man.-Offset:%3i", FC.FromFC_CompassOffset / 10); |
374 | if(FC.FromFC_DisableDeclination) |
374 | if(FC.FromFC_DisableDeclination) |
375 | { |
375 | { |
376 | LCD_printfxy(0,2,"Mag.Declinat.:disabl"); |
376 | LCD_printfxy(0,2,"Mag.Declinat.:disabl"); |
377 | } |
377 | } |
378 | else |
378 | else |
379 | { |
379 | { |
380 | if(GeoMagDec < 0) sign = '-'; |
380 | if(GeoMagDec < 0) sign = '-'; |
381 | else sign = '+'; |
381 | else sign = '+'; |
382 | LCD_printfxy(0,2,"Mag.Declinat.:%c%i.%1i", sign, abs(GeoMagDec)/10,abs(GeoMagDec)%10); |
382 | LCD_printfxy(0,2,"Mag.Declinat.:%c%i.%1i", sign, abs(GeoMagDec)/10,abs(GeoMagDec)%10); |
383 | } |
383 | } |
384 | LCD_printfxy(0,3,"True Compass: %3i", GyroCompassCorrected/10); |
384 | LCD_printfxy(0,3,"True Compass: %3i", GyroCompassCorrected/10); |
385 | break; |
385 | break; |
386 | case 16: // User Parameter |
386 | case 16: // User Parameter |
387 | LCD_printfxy(0,0,"UP1:%3i UP2:%3i",Parameter.User1,Parameter.User2); |
387 | LCD_printfxy(0,0,"UP1:%3i UP2:%3i",Parameter.User1,Parameter.User2); |
388 | LCD_printfxy(0,1,"UP3:%3i UP4:%3i",Parameter.User3,Parameter.User4); |
388 | LCD_printfxy(0,1,"UP3:%3i UP4:%3i",Parameter.User3,Parameter.User4); |
389 | LCD_printfxy(0,2,"UP5:%3i UP6:%3i",Parameter.User5,Parameter.User6); |
389 | LCD_printfxy(0,2,"UP5:%3i UP6:%3i",Parameter.User5,Parameter.User6); |
390 | LCD_printfxy(0,3,"UP7:%3i UP8:%3i",Parameter.User7,Parameter.User8); |
390 | LCD_printfxy(0,3,"UP7:%3i UP8:%3i",Parameter.User7,Parameter.User8); |
391 | break; |
391 | break; |
392 | case 17: // User Parameter |
392 | case 17: // User Parameter |
393 | LCD_printfxy(0,0,"SD-Card Logs"); |
393 | LCD_printfxy(0,0,"SD-Card Logs"); |
394 | if(SDCardInfo.Valid == 1) |
394 | if(SDCardInfo.Valid == 1) |
395 | { |
395 | { |
396 | LCD_printfxy(0,1,"GPX:%4i (%3ims) ",Logged_GPX_Counter,LogCfg.GPX_Interval); |
396 | LCD_printfxy(0,1,"GPX:%4i (%3ims) ",Logged_GPX_Counter,LogCfg.GPX_Interval); |
397 | LCD_printfxy(0,2,"KML:%4i (%3ims) ",Logged_KML_Counter,LogCfg.KML_Interval); |
397 | LCD_printfxy(0,2,"KML:%4i (%3ims) ",Logged_KML_Counter,LogCfg.KML_Interval); |
398 | } |
398 | } |
399 | else |
399 | else |
400 | LCD_printfxy(0,1,"no card in slot "); |
400 | LCD_printfxy(0,1,"no card in slot "); |
401 | break; |
401 | break; |
402 | case 18: // magnetic field |
402 | case 18: // magnetic field |
403 | if(Compass_CalState) |
403 | if(Compass_CalState) |
404 | { |
404 | { |
405 | LCD_printfxy(0,0,"Calibration:"); |
405 | LCD_printfxy(0,0,"Calibration:"); |
406 | LCD_printfxy(0,1,"Step %d/", Compass_CalState); |
406 | LCD_printfxy(0,1,"Step %d/", Compass_CalState); |
407 | LCD_printfxy(0,2,"X %4i Y %4i Z %4i",MagVector.X,MagVector.Y,MagVector.Z); |
407 | LCD_printfxy(0,2,"X %4i Y %4i Z %4i",MagVector.X,MagVector.Y,MagVector.Z); |
408 | LCD_printfxy(9,3,"(ESC)(NEXT)"); |
408 | LCD_printfxy(9,3,"(ESC)(NEXT)"); |
409 | switch(Compass_CalState) |
409 | switch(Compass_CalState) |
410 | { |
410 | { |
411 | case 1: |
411 | case 1: |
412 | case 3: |
412 | case 3: |
413 | LCD_printfxy(7,1,"pause"); |
413 | LCD_printfxy(7,1,"pause"); |
414 | break; |
414 | break; |
415 | 415 | ||
416 | case 2: |
416 | case 2: |
417 | LCD_printfxy(7,1,"horizontal"); |
417 | LCD_printfxy(7,1,"horizontal"); |
418 | break; |
418 | break; |
419 | 419 | ||
420 | case 4: |
420 | case 4: |
421 | LCD_printfxy(7,1,"vertical"); |
421 | LCD_printfxy(7,1,"vertical"); |
422 | break; |
422 | break; |
423 | 423 | ||
424 | case 5: |
424 | case 5: |
425 | LCD_printfxy(7,1,"data saved"); |
425 | LCD_printfxy(7,1,"data saved"); |
426 | LCD_printfxy(8,3," (END) "); |
426 | LCD_printfxy(8,3," (END) "); |
427 | break; |
427 | break; |
428 | 428 | ||
429 | default: |
429 | default: |
430 | break; |
430 | break; |
431 | } |
431 | } |
432 | } |
432 | } |
433 | else |
433 | else |
434 | { |
434 | { |
435 | if(GeoMagDec < 0) sign = '-'; |
435 | if(GeoMagDec < 0) sign = '-'; |
436 | else sign = '+'; |
436 | else sign = '+'; |
437 | LCD_printfxy(0,0,"Magnetic Field"); |
437 | LCD_printfxy(0,0,"Magnetic Field"); |
438 | LCD_printfxy(0,1,"X:%5i",MagVector.X); |
438 | LCD_printfxy(0,1,"X:%5i",MagVector.X); |
439 | LCD_printfxy(0,2,"Y:%5i",MagVector.Y); |
439 | LCD_printfxy(0,2,"Y:%5i",MagVector.Y); |
440 | LCD_printfxy(0,3,"Z:%5i",MagVector.Z); |
440 | LCD_printfxy(0,3,"Z:%5i",MagVector.Z); |
441 | LCD_printfxy(8,1,"Field:%3i",EarthMagneticField/5); |
441 | LCD_printfxy(8,1,"Field:%3i",EarthMagneticField/5); |
442 | if(Compass_I2CPort == NCMAG_PORT_EXTERN) LCD_printfxy(11,2,"Extern") |
442 | if(Compass_I2CPort == NCMAG_PORT_EXTERN) LCD_printfxy(11,2,"Extern") |
443 | else LCD_printfxy(11,2,"Intern"); |
443 | else LCD_printfxy(11,2,"Intern"); |
444 | // LCD_printfxy(8,2,"Dec:%c%i.%1i", sign, abs(GeoMagDec)/10,abs(GeoMagDec)%10); |
444 | // LCD_printfxy(8,2,"Dec:%c%i.%1i", sign, abs(GeoMagDec)/10,abs(GeoMagDec)%10); |
445 | // LCD_printfxy(8,3,"Inc:%2i", EarthMagneticInclination); |
445 | // LCD_printfxy(8,3,"Inc:%2i", EarthMagneticInclination); |
446 | LCD_printfxy(15,3,"(CAL)"); |
446 | LCD_printfxy(15,3,"(CAL)"); |
447 | } |
447 | } |
448 | if(Keys & KEY4) // next step |
448 | if(Keys & KEY4) // next step |
449 | { |
449 | { |
450 | if(Compass_CalState <5) Compass_SetCalState(Compass_CalState+1); |
450 | if(Compass_CalState <5) Compass_SetCalState(Compass_CalState+1); |
451 | else Compass_SetCalState(0); |
451 | else Compass_SetCalState(0); |
452 | } |
452 | } |
453 | if(Keys & KEY3)Compass_SetCalState(0); // cancel |
453 | if(Keys & KEY3)Compass_SetCalState(0); // cancel |
454 | break; |
454 | break; |
455 | case 19: |
455 | case 19: |
456 | if(GeoMagDec < 0) sign = '-'; |
456 | if(GeoMagDec < 0) sign = '-'; |
457 | else sign = '+'; |
457 | else sign = '+'; |
458 | LCD_printfxy(0,0,"Magnetic Field"); |
458 | LCD_printfxy(0,0,"Magnetic Field"); |
459 | LCD_printfxy(0,1,"Field:%3i (Percent)",EarthMagneticField/5); |
459 | LCD_printfxy(0,1,"Field:%3i (Percent)",EarthMagneticField/5); |
460 | LCD_printfxy(0,2,"Declination:%c%i.%1i ", sign, abs(GeoMagDec)/10,abs(GeoMagDec)%10); |
460 | LCD_printfxy(0,2,"Declination:%c%i.%1i ", sign, abs(GeoMagDec)/10,abs(GeoMagDec)%10); |
461 | LCD_printfxy(0,3,"Inclination:%2i (%2i)", EarthMagneticInclination, EarthMagneticInclinationTheoretic); |
461 | LCD_printfxy(0,3,"Inclination:%2i (%2i)", EarthMagneticInclination, EarthMagneticInclinationTheoretic); |
462 | break; |
462 | break; |
463 | case 20: |
463 | case 20: |
464 | LCD_printfxy(0,0,"SD-Setting "); |
464 | LCD_printfxy(0,0,"SD-Setting "); |
465 | LCD_printfxy(0,2,"WP-Dynamic:%4i ",WaypointAcceleration); |
465 | LCD_printfxy(0,2,"WP-Dynamic:%4i ",WaypointAcceleration); |
466 | break; |
466 | break; |
467 | case 21: |
467 | case 21: |
468 | LCD_printfxy(0,0,"CPU Processing "); |
468 | LCD_printfxy(0,0,"CPU Processing "); |
469 | LCD_printfxy(0,2,"GPS-Data: %2i.%iHz ",FreqNewGpsDataIn5Sec/10, FreqNewGpsDataIn5Sec%10); |
469 | LCD_printfxy(0,2,"GPS-Data: %2i.%iHz ",FreqNewGpsDataIn5Sec/10, FreqNewGpsDataIn5Sec%10); |
470 | LCD_printfxy(0,3,"GPS-Update:%2i.%iHz ",FreqGpsProcessedIn5Sec/10, FreqGpsProcessedIn5Sec%10); |
470 | LCD_printfxy(0,3,"GPS-Update:%2i.%iHz ",FreqGpsProcessedIn5Sec/10, FreqGpsProcessedIn5Sec%10); |
471 | if(FreqNewGpsDataIn5Sec >= 48 && FreqNewGpsDataIn5Sec <= 52) LCD_printfxy(18,2,"OK") else LCD_printfxy(18,2,"!!"); |
471 | if(FreqNewGpsDataIn5Sec >= 48 && FreqNewGpsDataIn5Sec <= 52) LCD_printfxy(18,2,"OK") else LCD_printfxy(18,2,"!!"); |
472 | if(FreqGpsProcessedIn5Sec >= 350) LCD_printfxy(18,3,"OK") else LCD_printfxy(18,3,"!!"); |
472 | if(FreqGpsProcessedIn5Sec >= 350) LCD_printfxy(18,3,"OK") else LCD_printfxy(18,3,"!!"); |
473 | break; |
473 | break; |
474 | case 22: |
474 | case 22: |
475 | LCD_printfxy(0,0,"BL Current" ); |
475 | LCD_printfxy(0,0,"BL Current" ); |
476 | LCD_printfxy(11,3,"(in 0.1A)" ); |
476 | LCD_printfxy(11,3,"(in 0.1A)" ); |
477 | for(i1 = 0; i1 < 3; i1++) |
477 | for(i1 = 0; i1 < 3; i1++) |
478 | { |
478 | { |
479 | LCD_printfxy(0,i1+1,"%3d %3d %3d %3d ",BL3_Current(i1*4),BL3_Current(i1*4+1),BL3_Current(i1*4+2),BL3_Current(i1*4+3)); |
479 | LCD_printfxy(0,i1+1,"%3d %3d %3d %3d ",BL3_Current(i1*4),BL3_Current(i1*4+1),BL3_Current(i1*4+2),BL3_Current(i1*4+3)); |
480 | if(Motor[4 + i1 * 4].State == 0) break; |
480 | if(Motor[4 + i1 * 4].State == 0) break; |
481 | } |
481 | } |
482 | break; |
482 | break; |
483 | 483 | ||
484 | case 23: |
484 | case 23: |
485 | LCD_printfxy(0,0,"Ext. Compass" ); |
485 | LCD_printfxy(0,0,"Ext. Compass" ); |
486 | if(Compass_I2CPort == NCMAG_PORT_EXTERN) |
486 | if(Compass_I2CPort == NCMAG_PORT_EXTERN) |
487 | { |
487 | { |
488 | u8 tmp; |
488 | u8 tmp; |
489 | LCD_printfxy(0,1,"ACC X Y Z"); |
489 | LCD_printfxy(0,1,"ACC X Y Z"); |
490 | LCD_printfxy(0,2," %5d %5d %5d", AccVector.X/40, AccVector.Y/40, AccVector.Z/40); |
490 | LCD_printfxy(0,2," %5d %5d %5d", AccVector.X/40, AccVector.Y/40, AccVector.Z/40); |
491 | tmp = NCMAG_GetOrientationFromAcc(); |
491 | tmp = NCMAG_GetOrientationFromAcc(); |
492 | LCD_printfxy(0,3,"Orientat.: "); |
492 | LCD_printfxy(0,3,"Orientat.: "); |
493 | if(!tmp) LCD_printfxy(11,3,"??") else LCD_printfxy(11,3,"%2d",tmp); |
493 | if(!tmp) LCD_printfxy(11,3,"??") else LCD_printfxy(11,3,"%2d",tmp); |
494 | LCD_printfxy(15,3,"(%d)",NCMAG_Orientation); |
494 | LCD_printfxy(15,3,"(%d)",NCMAG_Orientation); |
495 | } |
495 | } |
496 | else |
496 | else |
497 | { |
497 | { |
498 | LCD_printfxy(0,1,"Not connected"); |
498 | LCD_printfxy(0,1,"Not connected"); |
499 | } |
499 | } |
500 | break; |
500 | break; |
501 | 501 | ||
502 | case 24: |
502 | case 24: |
503 | { |
503 | { |
504 | static u8 index = 1; |
504 | static u8 index = 1; |
505 | if(Keys & KEY3) // next step |
505 | if(Keys & KEY3) // next step |
506 | { |
506 | { |
507 | if(index < ToFC_MaxWpListIndex) index++; |
507 | if(index < ToFC_MaxWpListIndex) index++; |
508 | else index = 1; |
508 | else index = 1; |
509 | } |
509 | } |
510 | if(Keys & KEY4) FromFC_LoadWP_List = index; |
510 | if(Keys & KEY4) FromFC_LoadWP_List = index; |
511 | LCD_printfxy(0,0,"Load WPL (fix)" ); |
511 | LCD_printfxy(0,0,"Load WPL (fix)" ); |
512 | LCD_printfxy(0,1,"Name: %s", WPL_Store.Name); |
512 | LCD_printfxy(0,1,"Name: %s", WPL_Store.Name); |
513 | // 12345678901234567890 |
513 | // 12345678901234567890 |
514 | LCD_printfxy(0,2,"Points Index "); |
514 | LCD_printfxy(0,2,"Points Index "); |
515 | LCD_printfxy(0,3," %3d %3d LOAD", PointList_GetCount(), index); |
515 | LCD_printfxy(0,3," %3d %3d LOAD", PointList_GetCount(), index); |
516 | } |
516 | } |
517 | break; |
517 | break; |
518 | case 25: |
518 | case 25: |
519 | { |
519 | { |
520 | static u8 index = 1; |
520 | static u8 index = 1; |
521 | if(Keys & KEY3) |
521 | if(Keys & KEY3) |
522 | { |
522 | { |
523 | if(index < ToFC_MaxWpListIndex) index++; |
523 | if(index < ToFC_MaxWpListIndex) index++; |
524 | else index = 1; |
524 | else index = 1; |
525 | } |
525 | } |
526 | LCD_printfxy(0,0,"Load WPL (Rel)" ); |
526 | LCD_printfxy(0,0,"Load WPL (Rel)" ); |
527 | LCD_printfxy(0,1,"Name: %s", WPL_Store.Name); |
527 | LCD_printfxy(0,1,"Name: %s", WPL_Store.Name); |
528 | // 12345678901234567890 |
528 | // 12345678901234567890 |
529 | LCD_printfxy(0,2,"Points Index "); |
529 | LCD_printfxy(0,2,"Points Index "); |
530 | if(GPSData.SatFix == SATFIX_3D) |
530 | if(GPSData.SatFix == SATFIX_3D) |
531 | { |
531 | { |
532 | LCD_printfxy(0,3," %3d %3d LOAD", PointList_GetCount(), index); |
532 | LCD_printfxy(0,3," %3d %3d LOAD", PointList_GetCount(), index); |
533 | if(Keys & KEY4) FromFC_LoadWP_List = index | 0x80; |
533 | if(Keys & KEY4) FromFC_LoadWP_List = index | 0x80; |
534 | } |
534 | } |
535 | else LCD_printfxy(0,3," No Satfix ! ", index); |
535 | else LCD_printfxy(0,3," No Satfix ! ", index); |
536 | 536 | ||
537 | } |
537 | } |
538 | break; |
538 | break; |
539 | case 26: |
539 | case 26: |
540 | { |
540 | { |
541 | static u8 index = 1; |
541 | static u8 index = 1; |
542 | if(Keys & KEY3) |
542 | if(Keys & KEY3) |
543 | { |
543 | { |
544 | if(index < ToFC_MaxWpListIndex) index++; |
544 | if(index < ToFC_MaxWpListIndex) index++; |
545 | else index = 1; |
545 | else index = 1; |
546 | } |
546 | } |
547 | if(Keys & KEY4) FromFC_Load_SinglePoint = index; |
547 | if(Keys & KEY4) FromFC_Load_SinglePoint = index; |
548 | LCD_printfxy(0,0,"Load Point" ); |
548 | LCD_printfxy(0,0,"Load Point" ); |
549 | LCD_printfxy(0,1,"Name: %s", WPL_Store.Name); |
549 | LCD_printfxy(0,1,"Name: %s", WPL_Store.Name); |
550 | // 12345678901234567890 |
550 | // 12345678901234567890 |
551 | // LCD_printfxy(0,2,"Points Index "); |
551 | // LCD_printfxy(0,2,"Points Index "); |
552 | LCD_printfxy(0,3,"Number: %3d (LOAD)", index); |
552 | LCD_printfxy(0,3,"Number: %3d (LOAD)", index); |
553 | } |
553 | } |
554 | break; |
554 | break; |
555 | case 27: |
555 | case 27: |
556 | { |
556 | { |
557 | static u8 index = 1; |
557 | static u8 index = 1; |
558 | if(Keys & KEY3) |
558 | if(Keys & KEY3) |
559 | { |
559 | { |
560 | if(index < ToFC_MaxWpListIndex) index++; |
560 | if(index < ToFC_MaxWpListIndex) index++; |
561 | else index = 1; |
561 | else index = 1; |
562 | } |
562 | } |
563 | LCD_printfxy(0,0,"Save Point" ); |
563 | LCD_printfxy(0,0,"Save Point" ); |
564 | LCD_printfxy(0,1,"Alt: %3dm", NaviData.Altimeter/20); |
564 | LCD_printfxy(0,1,"Alt: %3dm", NaviData.Altimeter/20); |
565 | // 12345678901234567890 |
565 | // 12345678901234567890 |
566 | LCD_printfxy(0,2,"Dir: %3d ", CompassSetpointCorrected/10); |
566 | LCD_printfxy(0,2,"Dir: %3d ", CompassSetpointCorrected/10); |
567 | if(GPSData.SatFix == SATFIX_3D) |
567 | if(GPSData.SatFix == SATFIX_3D) |
568 | { |
568 | { |
569 | LCD_printfxy(0,3,"Number: %3d (SAVE)", index); |
569 | LCD_printfxy(0,3,"Number: %3d (SAVE)", index); |
570 | if(Keys & KEY4) FromFC_Save_SinglePoint = index; |
570 | if(Keys & KEY4) FromFC_Save_SinglePoint = index; |
571 | } |
571 | } |
572 | else LCD_printfxy(0,3," No Satfix ! ", index); |
572 | else LCD_printfxy(0,3," No Satfix ! ", index); |
573 | } |
573 | } |
574 | break; |
574 | break; |
575 | default: |
575 | default: |
576 | //MaxMenuItem = MenuItem - 1; |
576 | //MaxMenuItem = MenuItem - 1; |
577 | MenuItem = 0; |
577 | MenuItem = 0; |
578 | break; |
578 | break; |
579 | } |
579 | } |
580 | } |
580 | } |
581 | 581 |