Rev 44 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 44 | Rev 171 | ||
---|---|---|---|
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 / 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 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 this software (or part of it) to systems (other than 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 "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 "timer.h" |
63 | #include "timer.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 = 12; |
73 | u8 MaxMenuItem = 12; |
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 | if(RemoteKeys & KEY1) { if(MenuItem) MenuItem--; else MenuItem = MaxMenuItem;} |
99 | if(RemoteKeys & KEY1) { if(MenuItem) MenuItem--; else MenuItem = MaxMenuItem;} |
100 | if(RemoteKeys & KEY2) { if(MenuItem == MaxMenuItem) MenuItem = 0; else MenuItem++;} |
100 | if(RemoteKeys & KEY2) { if(MenuItem == MaxMenuItem) MenuItem = 0; else MenuItem++;} |
101 | if((RemoteKeys & KEY1) && (RemoteKeys & KEY2)) MenuItem = 0; |
101 | if((RemoteKeys & KEY1) && (RemoteKeys & KEY2)) MenuItem = 0; |
102 | 102 | ||
103 | LCD_Clear(); |
103 | LCD_Clear(); |
104 | if(MenuItem > MaxMenuItem) MenuItem = MaxMenuItem; |
104 | if(MenuItem > MaxMenuItem) MenuItem = MaxMenuItem; |
105 | // print menu item number in the upper right corner |
105 | // print menu item number in the upper right corner |
106 | if(MenuItem < 10) |
106 | if(MenuItem < 10) |
107 | { |
107 | { |
108 | LCD_printfxy(17,0,"[%i]",MenuItem); |
108 | LCD_printfxy(17,0,"[%i]",MenuItem); |
109 | } |
109 | } |
110 | else |
110 | else |
111 | { |
111 | { |
112 | LCD_printfxy(16,0,"[%i]",MenuItem); |
112 | LCD_printfxy(16,0,"[%i]",MenuItem); |
113 | } |
113 | } |
114 | 114 | ||
115 | switch(MenuItem) |
115 | switch(MenuItem) |
116 | { |
116 | { |
117 | // Version Info |
117 | // Version Info |
118 | case 0: |
118 | case 0: |
119 | LCD_printfxy(0,0,"++ Navi-Ctrl ++"); |
119 | LCD_printfxy(0,0,"++ Navi-Ctrl ++"); |
120 | LCD_printfxy(0,1," V%d.%d%c ", VERSION_MAJOR, VERSION_MINOR, 'a'+ VERSION_PATCH); |
120 | LCD_printfxy(0,1," V%d.%d%c ", VERSION_MAJOR, VERSION_MINOR, 'a'+ VERSION_PATCH); |
121 | if(ErrorCode) LCD_printfxy(11,1," Err:%d",ErrorCode) else LCD_printfxy(11,1," "); |
121 | if(ErrorCode) LCD_printfxy(11,1," Err:%d",ErrorCode) else LCD_printfxy(11,1," "); |
122 | LCD_printfxy(0,2,"%s",ErrorMSG); |
122 | LCD_printfxy(0,2,"%s",ErrorMSG); |
123 | LCD_printfxy(0,3,"(c) Buss, Busker"); |
123 | LCD_printfxy(0,3,"(c) Buss, Busker"); |
124 | break; |
124 | break; |
125 | case 1: |
125 | case 1: |
126 | if (GPSData.Status == INVALID) |
126 | if (GPSData.Status == INVALID) |
127 | { |
127 | { |
128 | LCD_printfxy(0,0,"No GPS data"); |
128 | LCD_printfxy(0,0,"No GPS data"); |
129 | LCD_printfxy(0,1,"Lon: "); |
129 | LCD_printfxy(0,1,"Lon: "); |
130 | LCD_printfxy(0,2,"Lat: "); |
130 | LCD_printfxy(0,2,"Lat: "); |
131 | LCD_printfxy(0,3,"Alt: "); |
131 | LCD_printfxy(0,3,"Alt: "); |
132 | } |
132 | } |
133 | else // newdata or processed |
133 | else // newdata or processed |
134 | { |
134 | { |
135 | switch (GPSData.SatFix) |
135 | switch (GPSData.SatFix) |
136 | { |
136 | { |
137 | case SATFIX_NONE: |
137 | case SATFIX_NONE: |
138 | LCD_printfxy(0,0,"Sats:%02d Fix:None", GPSData.NumOfSats); |
138 | LCD_printfxy(0,0,"Sats:%02d Fix:None", GPSData.NumOfSats); |
139 | break; |
139 | break; |
140 | case SATFIX_2D: |
140 | case SATFIX_2D: |
141 | LCD_printfxy(0,0,"Sats:%02d Fix:2D ", GPSData.NumOfSats); |
141 | LCD_printfxy(0,0,"Sats:%02d Fix:2D ", GPSData.NumOfSats); |
142 | break; |
142 | break; |
143 | case SATFIX_3D: |
143 | case SATFIX_3D: |
144 | LCD_printfxy(0,0,"Sats:%02d Fix:3D ", GPSData.NumOfSats); |
144 | LCD_printfxy(0,0,"Sats:%02d Fix:3D ", GPSData.NumOfSats); |
145 | break; |
145 | break; |
146 | default: |
146 | default: |
147 | LCD_printfxy(0,0,"Sats:%02d Fix:?? ", GPSData.NumOfSats); |
147 | LCD_printfxy(0,0,"Sats:%02d Fix:?? ", GPSData.NumOfSats); |
148 | break; |
148 | break; |
149 | } |
149 | } |
150 | i1 = GPSData.Position.Longitude/10000000L; |
150 | i1 = GPSData.Position.Longitude/10000000L; |
151 | i2 = abs(GPSData.Position.Longitude%10000000L); |
151 | i2 = abs(GPSData.Position.Longitude%10000000L); |
152 | LCD_printfxy(0,1,"Lon:%+3ld.%07ld deg",i1, i2); |
152 | LCD_printfxy(0,1,"Lon:%+3ld.%07ld deg",i1, i2); |
153 | i1 = GPSData.Position.Latitude/10000000L; |
153 | i1 = GPSData.Position.Latitude/10000000L; |
154 | i2 = abs(GPSData.Position.Latitude%10000000L); |
154 | i2 = abs(GPSData.Position.Latitude%10000000L); |
155 | LCD_printfxy(0,2,"Lat:%+3ld.%07ld deg",i1, i2); |
155 | LCD_printfxy(0,2,"Lat:%+3ld.%07ld deg",i1, i2); |
156 | i1 = GPSData.Position.Altitude/1000L; |
156 | i1 = GPSData.Position.Altitude/1000L; |
157 | i2 = abs(GPSData.Position.Altitude%1000L); |
157 | i2 = abs(GPSData.Position.Altitude%1000L); |
158 | LCD_printfxy(0,3,"Alt:%4ld.%03ld m",i1, i2); |
158 | LCD_printfxy(0,3,"Alt:%4ld.%03ld m",i1, i2); |
159 | } |
159 | } |
160 | break; |
160 | break; |
161 | case 2: |
161 | case 2: |
162 | if (GPSData.Status == INVALID) |
162 | if (GPSData.Status == INVALID) |
163 | { |
163 | { |
164 | LCD_printfxy(0,0,"No GPS data"); |
164 | LCD_printfxy(0,0,"No GPS data"); |
165 | LCD_printfxy(0,1,"Speed N: "); |
165 | LCD_printfxy(0,1,"Speed N: "); |
166 | LCD_printfxy(0,2,"Speed E: "); |
166 | LCD_printfxy(0,2,"Speed E: "); |
167 | LCD_printfxy(0,3,"Speed T: "); |
167 | LCD_printfxy(0,3,"Speed T: "); |
168 | } |
168 | } |
169 | else // newdata or processed |
169 | else // newdata or processed |
170 | { |
170 | { |
171 | switch (GPSData.SatFix) |
171 | switch (GPSData.SatFix) |
172 | { |
172 | { |
173 | case SATFIX_NONE: |
173 | case SATFIX_NONE: |
174 | LCD_printfxy(0,0,"Sats:%02d Fix:None", GPSData.NumOfSats); |
174 | LCD_printfxy(0,0,"Sats:%02d Fix:None", GPSData.NumOfSats); |
175 | break; |
175 | break; |
176 | case SATFIX_2D: |
176 | case SATFIX_2D: |
177 | LCD_printfxy(0,0,"Sats:%02d Fix:2D ", GPSData.NumOfSats); |
177 | LCD_printfxy(0,0,"Sats:%02d Fix:2D ", GPSData.NumOfSats); |
178 | break; |
178 | break; |
179 | case SATFIX_3D: |
179 | case SATFIX_3D: |
180 | LCD_printfxy(0,0,"Sats:%02d Fix:3D ", GPSData.NumOfSats); |
180 | LCD_printfxy(0,0,"Sats:%02d Fix:3D ", GPSData.NumOfSats); |
181 | break; |
181 | break; |
182 | default: |
182 | default: |
183 | LCD_printfxy(0,0,"Sats:%02d Fix:?? ", GPSData.NumOfSats); |
183 | LCD_printfxy(0,0,"Sats:%02d Fix:?? ", GPSData.NumOfSats); |
184 | break; |
184 | break; |
185 | } |
185 | } |
186 | LCD_printfxy(0,1,"Speed N: %+4ld cm/s",GPSData.Speed_North); |
186 | LCD_printfxy(0,1,"Speed N: %+4ld cm/s",GPSData.Speed_North); |
187 | LCD_printfxy(0,2,"Speed E: %+4ld cm/s",GPSData.Speed_East); |
187 | LCD_printfxy(0,2,"Speed E: %+4ld cm/s",GPSData.Speed_East); |
188 | LCD_printfxy(0,3,"Speed T: %+4ld cm/s",GPSData.Speed_Top); |
188 | LCD_printfxy(0,3,"Speed T: %+4ld cm/s",GPSData.Speed_Top); |
189 | } |
189 | } |
190 | break; |
190 | break; |
191 | case 3: |
191 | case 3: |
192 | LCD_printfxy(0,0,"GPS UTC Time"); |
192 | LCD_printfxy(0,0,"GPS UTC Time"); |
193 | if (!SystemTime.Valid) |
193 | if (!SystemTime.Valid) |
194 | { |
194 | { |
195 | LCD_printfxy(0,0,"GPS UTC Time"); |
195 | LCD_printfxy(0,0,"GPS UTC Time"); |
196 | LCD_printfxy(0,1," "); |
196 | LCD_printfxy(0,1," "); |
197 | LCD_printfxy(0,2," No time data! "); |
197 | LCD_printfxy(0,2," No time data! "); |
198 | LCD_printfxy(0,3," "); |
198 | LCD_printfxy(0,3," "); |
199 | } |
199 | } |
200 | else // newdata or processed |
200 | else // newdata or processed |
201 | { |
201 | { |
202 | LCD_printfxy(0,1," "); |
202 | LCD_printfxy(0,1," "); |
203 | LCD_printfxy(0,2,"Date: %02i/%02i/%04i",SystemTime.Month, SystemTime.Day, SystemTime.Year); |
203 | LCD_printfxy(0,2,"Date: %02i/%02i/%04i",SystemTime.Month, SystemTime.Day, SystemTime.Year); |
204 | LCD_printfxy(0,3,"Time: %02i:%02i:%02i.%03i", SystemTime.Hour, SystemTime.Min, SystemTime.Sec, SystemTime.mSec); |
204 | LCD_printfxy(0,3,"Time: %02i:%02i:%02i.%03i", SystemTime.Hour, SystemTime.Min, SystemTime.Sec, SystemTime.mSec); |
205 | 205 | ||
206 | } |
206 | } |
207 | break; |
207 | break; |
208 | case 4: // Navi Params from FC |
208 | case 4: // Navi Params from FC |
209 | LCD_printfxy(0,0,"NaviMode: %3i" , Parameter.NaviGpsModeControl); |
209 | LCD_printfxy(0,0,"NaviMode: %3i" , Parameter.NaviGpsModeControl); |
210 | LCD_printfxy(0,1,"G :%3i P :%3i ",Parameter.NaviGpsGain, Parameter.NaviGpsP); |
210 | LCD_printfxy(0,1,"G :%3i P :%3i ",Parameter.NaviGpsGain, Parameter.NaviGpsP); |
211 | LCD_printfxy(0,2,"I :%3i D :%3i ",Parameter.NaviGpsI, Parameter.NaviGpsD); |
211 | LCD_printfxy(0,2,"I :%3i D :%3i ",Parameter.NaviGpsI, Parameter.NaviGpsD); |
212 | LCD_printfxy(0,3,"ACC:%3i SAT:%3i ",Parameter.NaviGpsACC, Parameter.NaviGpsMinSat); |
212 | LCD_printfxy(0,3,"ACC:%3i SAT:%3i ",Parameter.NaviGpsACC, Parameter.NaviGpsMinSat); |
213 | break; |
213 | break; |
214 | case 5: |
214 | case 5: |
215 | LCD_printfxy(0,0,"Home Position"); |
215 | LCD_printfxy(0,0,"Home Position"); |
216 | if(GPS_HomePosition.Status == INVALID) |
216 | if(GPS_HomePosition.Status == INVALID) |
217 | { |
217 | { |
218 | LCD_printfxy(0,1," "); |
218 | LCD_printfxy(0,1," "); |
219 | LCD_printfxy(0,2," Is not set. "); |
219 | LCD_printfxy(0,2," Is not set. "); |
220 | LCD_printfxy(0,3," "); |
220 | LCD_printfxy(0,3," "); |
221 | } |
221 | } |
222 | else |
222 | else |
223 | { |
223 | { |
224 | i1 = GPS_HomePosition.Longitude/10000000L; |
224 | i1 = GPS_HomePosition.Longitude/10000000L; |
225 | i2 = abs(GPS_HomePosition.Longitude%10000000L); |
225 | i2 = abs(GPS_HomePosition.Longitude%10000000L); |
226 | LCD_printfxy(0,1,"Lon: %3ld.%07ld deg",i1, i2); |
226 | LCD_printfxy(0,1,"Lon: %3ld.%07ld deg",i1, i2); |
227 | i1 = GPS_HomePosition.Latitude/10000000L; |
227 | i1 = GPS_HomePosition.Latitude/10000000L; |
228 | i2 = abs(GPS_HomePosition.Latitude%10000000L); |
228 | i2 = abs(GPS_HomePosition.Latitude%10000000L); |
229 | LCD_printfxy(0,2,"Lat: %3ld.%07ld deg",i1, i2); |
229 | LCD_printfxy(0,2,"Lat: %3ld.%07ld deg",i1, i2); |
230 | i1 = GPS_HomePosition.Altitude/1000L; |
230 | i1 = GPS_HomePosition.Altitude/1000L; |
231 | i2 = abs(GPS_HomePosition.Altitude%1000L); |
231 | i2 = abs(GPS_HomePosition.Altitude%1000L); |
232 | LCD_printfxy(0,3,"Alt:%4ld.%03ld m",i1, i2); |
232 | LCD_printfxy(0,3,"Alt:%4ld.%03ld m",i1, i2); |
233 | } |
233 | } |
234 | break; |
234 | break; |
235 | case 6: // RC stick controls from FC |
235 | case 6: // RC stick controls from FC |
236 | LCD_printfxy(0,0,"RC-Sticks" ); |
236 | LCD_printfxy(0,0,"RC-Sticks" ); |
237 | LCD_printfxy(0,1,"Ni:%4i Ro:%4i ",FC.StickNick, FC.StickRoll); |
237 | LCD_printfxy(0,1,"Ni:%4i Ro:%4i ",FC.StickNick, FC.StickRoll); |
238 | LCD_printfxy(0,2,"Gs:%4i Ya:%4i ",FC.StickGas, FC.StickYaw); |
238 | LCD_printfxy(0,2,"Gs:%4i Ya:%4i ",FC.StickGas, FC.StickYaw); |
239 | break; |
239 | break; |
240 | case 7: // RC poti controls from FC |
240 | case 7: // RC poti controls from FC |
241 | LCD_printfxy(0,0,"RC-Potis" ); |
241 | LCD_printfxy(0,0,"RC-Potis" ); |
242 | LCD_printfxy(0,1,"Po1:%3i Po2:%3i ",FC.Poti1, FC.Poti2); |
242 | LCD_printfxy(0,1,"Po1:%3i Po2:%3i ",FC.Poti1, FC.Poti2); |
243 | LCD_printfxy(0,2,"Po3:%3i Po4:%3i ",FC.Poti3, FC.Poti4); |
243 | LCD_printfxy(0,2,"Po3:%3i Po4:%3i ",FC.Poti3, FC.Poti4); |
244 | break; |
244 | break; |
245 | case 8: // attitude from FC |
245 | case 8: // attitude from FC |
246 | LCD_printfxy(0,0,"IntNick: %5i", FromFlightCtrl.IntegralNick); |
246 | LCD_printfxy(0,0,"IntNick: %5i", FromFlightCtrl.IntegralNick); |
247 | LCD_printfxy(0,1,"IntRoll: %5i", FromFlightCtrl.IntegralRoll); |
247 | LCD_printfxy(0,1,"IntRoll: %5i", FromFlightCtrl.IntegralRoll); |
248 | LCD_printfxy(0,2,"AccNick: %5i", FromFlightCtrl.AccNick); |
248 | LCD_printfxy(0,2,"AccNick: %5i", FromFlightCtrl.AccNick); |
249 | LCD_printfxy(0,3,"AccRoll: %5i", FromFlightCtrl.AccRoll); |
249 | LCD_printfxy(0,3,"AccRoll: %5i", FromFlightCtrl.AccRoll); |
250 | break; |
250 | break; |
251 | case 9: // gyros from FC |
251 | case 9: // gyros from FC |
252 | LCD_printfxy(0,0,"GyroNick: %4i", FromFlightCtrl.GyroNick); |
252 | LCD_printfxy(0,0,"GyroNick: %4i", FromFlightCtrl.GyroNick); |
253 | LCD_printfxy(0,1,"GyroRoll: %4i", FromFlightCtrl.GyroRoll); |
253 | LCD_printfxy(0,1,"GyroRoll: %4i", FromFlightCtrl.GyroRoll); |
254 | LCD_printfxy(0,2,"GyroYaw: %4i", FromFlightCtrl.GyroYaw); |
254 | LCD_printfxy(0,2,"GyroYaw: %4i", FromFlightCtrl.GyroYaw); |
255 | break; |
255 | break; |
256 | case 10: // Remote Control Level from FC |
256 | case 10: // Remote Control Level from FC |
257 | LCD_printfxy(0,0,"RC-Level: %3i", FC.RC_Quality); |
257 | LCD_printfxy(0,0,"RC-Level: %3i", FC.RC_Quality); |
258 | LCD_printfxy(0,1,"Ubat: %3i", FC.UBat); |
258 | LCD_printfxy(0,1,"Ubat: %3i", FC.UBat); |
259 | LCD_printfxy(0,2,"CompHeading: %3i", I2C_Heading.Heading); |
259 | LCD_printfxy(0,2,"CompHeading: %3i", I2C_Heading.Heading); |
260 | LCD_printfxy(0,3,"GyroHeading: %3i", FromFlightCtrl.GyroHeading); |
260 | LCD_printfxy(0,3,"GyroHeading: %3i", FromFlightCtrl.GyroHeading); |
261 | break; |
261 | break; |
262 | case 11: // User Parameter |
262 | case 11: // User Parameter |
263 | LCD_printfxy(0,0,"UP1:%3i UP2:%3i ",Parameter.User1,Parameter.User2); |
263 | LCD_printfxy(0,0,"UP1:%3i UP2:%3i ",Parameter.User1,Parameter.User2); |
264 | LCD_printfxy(0,1,"UP3:%3i UP4:%3i ",Parameter.User3,Parameter.User4); |
264 | LCD_printfxy(0,1,"UP3:%3i UP4:%3i ",Parameter.User3,Parameter.User4); |
265 | LCD_printfxy(0,2,"UP5:%3i UP6:%3i ",Parameter.User5,Parameter.User6); |
265 | LCD_printfxy(0,2,"UP5:%3i UP6:%3i ",Parameter.User5,Parameter.User6); |
266 | LCD_printfxy(0,3,"UP7:%3i UP8:%3i ",Parameter.User7,Parameter.User8); |
266 | LCD_printfxy(0,3,"UP7:%3i UP8:%3i ",Parameter.User7,Parameter.User8); |
267 | break; |
267 | break; |
268 | case 12: // MK3MAG |
268 | case 12: // MK3MAG |
269 | I2C1_SendCommand(I2C_CMD_READ_MAG); |
269 | I2C1_SendCommand(I2C_CMD_READ_MAG); |
270 | LCD_printfxy(0,0,"MK3MAG V%i.%i%c",MK3MAG_Version.Major, MK3MAG_Version.Minor, 'a'+ MK3MAG_Version.Patch); |
270 | LCD_printfxy(0,0,"MK3MAG V%i.%i%c",MK3MAG_Version.Major, MK3MAG_Version.Minor, 'a'+ MK3MAG_Version.Patch); |
271 | LCD_printfxy(0,1,"MagX: %4i ",I2C_Mag.MagX); |
271 | LCD_printfxy(0,1,"MagX: %4i ",I2C_Mag.MagX); |
272 | LCD_printfxy(0,2,"MagY: %4i ",I2C_Mag.MagY); |
272 | LCD_printfxy(0,2,"MagY: %4i ",I2C_Mag.MagY); |
273 | LCD_printfxy(0,3,"MagZ: %4i ",I2C_Mag.MagZ); |
273 | LCD_printfxy(0,3,"MagZ: %4i ",I2C_Mag.MagZ); |
274 | break; |
274 | break; |
275 | default: |
275 | default: |
276 | MaxMenuItem = MenuItem - 1; |
276 | MaxMenuItem = MenuItem - 1; |
277 | MenuItem = 0; |
277 | MenuItem = 0; |
278 | break; |
278 | break; |
279 | } |
279 | } |
280 | RemoteKeys = 0; |
280 | RemoteKeys = 0; |
281 | } |
281 | } |
282 | 282 |