Rev 457 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | ingob | 1 | /*#######################################################################################*/ |
2 | /* !!! THIS IS NOT FREE SOFTWARE !!! */ |
||
3 | /*#######################################################################################*/ |
||
4 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
5 | // + Copyright (c) 2008 Ingo Busker, Holger Buss |
||
171 | ingob | 6 | // + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
1 | ingob | 7 | // + FOR NON COMMERCIAL USE ONLY |
8 | // + www.MikroKopter.com |
||
9 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
41 | ingob | 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. |
||
12 | // + Sollten direkte oder indirekte kommerzielle Absichten verfolgt werden, ist mit uns (info@mikrokopter.de) Kontakt |
||
13 | // + bzgl. der Nutzungsbedingungen aufzunehmen. |
||
1 | ingob | 14 | // + Eine kommerzielle Nutzung ist z.B.Verkauf von MikroKoptern, Bestückung und Verkauf von Platinen oder Bausätzen, |
15 | // + Verkauf von Luftbildaufnahmen, usw. |
||
16 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
41 | ingob | 17 | // + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
1 | ingob | 18 | // + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
19 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
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" |
||
22 | // + eindeutig als Ursprung verlinkt werden |
||
23 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
24 | // + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
||
25 | // + Benutzung auf eigene Gefahr |
||
26 | // + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
||
27 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
171 | ingob | 28 | // + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
1 | ingob | 29 | // + mit unserer Zustimmung zulässig |
30 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
31 | // + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
||
32 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
41 | ingob | 33 | // + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
1 | ingob | 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 |
||
36 | // + from this software without specific prior written permission. |
||
41 | ingob | 37 | // + * The use of this project (hardware, software, binary files, sources and documentation) is only permitted |
1 | ingob | 38 | // + for non-commercial use (directly or indirectly) |
41 | ingob | 39 | // + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
1 | ingob | 40 | // + with our written permission |
41 | ingob | 41 | // + * If sources or documentations are redistributet on other webpages, out webpage (http://www.MikroKopter.de) must be |
42 | // + clearly linked as origin |
||
171 | ingob | 43 | // + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
1 | ingob | 44 | // |
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 |
||
47 | // + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||
48 | // + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
||
49 | // + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||
50 | // + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||
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 |
||
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 |
||
41 | ingob | 55 | // + POSSIBILITY OF SUCH DAMAGE. |
1 | ingob | 56 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
41 | ingob | 57 | #include <stdlib.h> |
58 | #include "91x_lib.h" |
||
1 | ingob | 59 | #include "main.h" |
264 | killagreg | 60 | #include "led.h" |
41 | ingob | 61 | #include "ubx.h" |
62 | #include "GPS.h" |
||
119 | killagreg | 63 | #include "timer1.h" |
242 | killagreg | 64 | #include "compass.h" |
41 | ingob | 65 | #include "spi_slave.h" |
66 | #include "menu.h" |
||
67 | #include "uart1.h" |
||
267 | holgerb | 68 | #include "ncmag.h" |
380 | holgerb | 69 | #include "logging.h" |
426 | holgerb | 70 | #include "settings.h" |
1 | ingob | 71 | |
72 | u8 DispPtr = 0; |
||
201 | killagreg | 73 | s8 DisplayBuff[DISPLAYBUFFSIZE]; |
1 | ingob | 74 | |
201 | killagreg | 75 | |
41 | ingob | 76 | u8 MenuItem = 0; |
453 | holgerb | 77 | u8 MaxMenuItem = 21; |
41 | ingob | 78 | |
203 | killagreg | 79 | void Menu_Putchar(char c) |
80 | { |
||
81 | if(DispPtr < DISPLAYBUFFSIZE) DisplayBuff[DispPtr++] = c; ; |
||
82 | } |
||
83 | |||
201 | killagreg | 84 | void Menu_Clear(void) |
1 | ingob | 85 | { |
201 | killagreg | 86 | u8 i; |
87 | for( i = 0; i < DISPLAYBUFFSIZE; i++) DisplayBuff[i] = ' '; |
||
1 | ingob | 88 | } |
89 | |||
24 | StephanB | 90 | |
41 | ingob | 91 | // Display with 20 characters in 4 lines |
201 | killagreg | 92 | void Menu_Update(u8 Keys) |
41 | ingob | 93 | { |
94 | s32 i1,i2; |
||
51 | killagreg | 95 | u8 sign; |
41 | ingob | 96 | |
201 | killagreg | 97 | if(Keys & KEY1) { if(MenuItem > 0) MenuItem--; else MenuItem = MaxMenuItem;} |
98 | if(Keys & KEY2) { if(MenuItem == MaxMenuItem) MenuItem = 0; else MenuItem++;} |
||
99 | if((Keys & KEY1) && (Keys & KEY2)) MenuItem = 0; |
||
41 | ingob | 100 | if(MenuItem > MaxMenuItem) MenuItem = MaxMenuItem; |
201 | killagreg | 101 | Menu_Clear(); |
41 | ingob | 102 | // print menu item number in the upper right corner |
103 | if(MenuItem < 10) |
||
104 | { |
||
105 | LCD_printfxy(17,0,"[%i]",MenuItem); |
||
106 | } |
||
201 | killagreg | 107 | else // Menuitem >= 10 |
41 | ingob | 108 | { |
109 | LCD_printfxy(16,0,"[%i]",MenuItem); |
||
110 | } |
||
111 | |||
112 | switch(MenuItem) |
||
113 | { |
||
114 | // Version Info |
||
115 | case 0: |
||
116 | LCD_printfxy(0,0,"++ Navi-Ctrl ++"); |
||
264 | killagreg | 117 | LCD_printfxy(0,1,"HW V%d.%d SW V%d.%d%c", Version_HW/10, Version_HW%10, VERSION_MAJOR, VERSION_MINOR, 'a'+ VERSION_PATCH); |
321 | holgerb | 118 | |
264 | killagreg | 119 | if(ErrorCode) |
120 | { |
||
121 | LCD_printfxy(0,2,"Error: %d",ErrorCode); |
||
122 | LCD_printfxy(0,3,"%s",ErrorMSG); |
||
123 | } |
||
321 | holgerb | 124 | else |
380 | holgerb | 125 | { |
126 | LCD_printfxy(0,3,"(c) HiSystems GmbH"); |
||
321 | holgerb | 127 | LCD_printfxy(0,2,"%s",ErrorMSG); |
128 | } |
||
41 | ingob | 129 | break; |
130 | case 1: |
||
131 | if (GPSData.Status == INVALID) |
||
132 | { |
||
133 | LCD_printfxy(0,0,"No GPS data"); |
||
134 | LCD_printfxy(0,1,"Lon: "); |
||
135 | LCD_printfxy(0,2,"Lat: "); |
||
136 | LCD_printfxy(0,3,"Alt: "); |
||
137 | } |
||
138 | else // newdata or processed |
||
139 | { |
||
122 | killagreg | 140 | LCD_printfxy(0,0,"Sat:%02d ", GPSData.NumOfSats); |
41 | ingob | 141 | switch (GPSData.SatFix) |
142 | { |
||
143 | case SATFIX_NONE: |
||
127 | killagreg | 144 | LCD_printfxy(7,0,"NoFix"); |
41 | ingob | 145 | break; |
146 | case SATFIX_2D: |
||
127 | killagreg | 147 | LCD_printfxy(7,0,"2DFix"); |
41 | ingob | 148 | break; |
149 | case SATFIX_3D: |
||
127 | killagreg | 150 | LCD_printfxy(7,0,"3DFix"); |
41 | ingob | 151 | break; |
152 | default: |
||
127 | killagreg | 153 | LCD_printfxy(7,0,"??Fix"); |
41 | ingob | 154 | break; |
155 | } |
||
121 | killagreg | 156 | if(GPSData.Flags & FLAG_DIFFSOLN) |
157 | { |
||
127 | killagreg | 158 | LCD_printfxy(12,0,"/DGPS"); |
121 | killagreg | 159 | } |
160 | else |
||
161 | { |
||
127 | killagreg | 162 | LCD_printfxy(12,0," "); |
121 | killagreg | 163 | } |
164 | |||
51 | killagreg | 165 | if(GPSData.Position.Longitude < 0) sign = '-'; |
166 | else sign = '+'; |
||
53 | killagreg | 167 | i1 = abs(GPSData.Position.Longitude)/10000000L; |
168 | i2 = abs(GPSData.Position.Longitude)%10000000L; |
||
54 | killagreg | 169 | LCD_printfxy(0,1,"Lon:%c%03ld.%07ld deg",sign, i1, i2); |
51 | killagreg | 170 | if(GPSData.Position.Latitude < 0) sign = '-'; |
171 | else sign = '+'; |
||
53 | killagreg | 172 | i1 = abs(GPSData.Position.Latitude)/10000000L; |
173 | i2 = abs(GPSData.Position.Latitude)%10000000L; |
||
54 | killagreg | 174 | LCD_printfxy(0,2,"Lat:%c%03ld.%07ld deg",sign, i1, i2); |
51 | killagreg | 175 | if(GPSData.Position.Altitude < 0) sign = '-'; |
176 | else sign = '+'; |
||
53 | killagreg | 177 | i1 = abs(GPSData.Position.Altitude)/1000L; |
178 | i2 = abs(GPSData.Position.Altitude)%1000L; |
||
54 | killagreg | 179 | LCD_printfxy(0,3,"Alt:%c%04ld.%03ld m", sign, i1, i2); |
41 | ingob | 180 | } |
181 | break; |
||
182 | case 2: |
||
183 | if (GPSData.Status == INVALID) |
||
184 | { |
||
185 | LCD_printfxy(0,0,"No GPS data"); |
||
186 | LCD_printfxy(0,1,"Speed N: "); |
||
187 | LCD_printfxy(0,2,"Speed E: "); |
||
188 | LCD_printfxy(0,3,"Speed T: "); |
||
189 | } |
||
190 | else // newdata or processed |
||
191 | { |
||
124 | killagreg | 192 | LCD_printfxy(0,0,"Sat:%02d ", GPSData.NumOfSats); |
41 | ingob | 193 | switch (GPSData.SatFix) |
194 | { |
||
195 | case SATFIX_NONE: |
||
127 | killagreg | 196 | LCD_printfxy(7,0,"NoFix"); |
41 | ingob | 197 | break; |
198 | case SATFIX_2D: |
||
127 | killagreg | 199 | LCD_printfxy(7,0,"2DFix"); |
41 | ingob | 200 | break; |
201 | case SATFIX_3D: |
||
127 | killagreg | 202 | LCD_printfxy(7,0,"3DFix"); |
41 | ingob | 203 | break; |
204 | default: |
||
127 | killagreg | 205 | LCD_printfxy(7,0,"??Fix"); |
41 | ingob | 206 | break; |
207 | } |
||
124 | killagreg | 208 | if(GPSData.Flags & FLAG_DIFFSOLN) |
209 | { |
||
127 | killagreg | 210 | LCD_printfxy(12,0,"/DGPS"); |
124 | killagreg | 211 | } |
212 | else |
||
213 | { |
||
127 | killagreg | 214 | LCD_printfxy(12,0," "); |
124 | killagreg | 215 | } |
216 | |||
41 | ingob | 217 | LCD_printfxy(0,1,"Speed N: %+4ld cm/s",GPSData.Speed_North); |
218 | LCD_printfxy(0,2,"Speed E: %+4ld cm/s",GPSData.Speed_East); |
||
219 | LCD_printfxy(0,3,"Speed T: %+4ld cm/s",GPSData.Speed_Top); |
||
220 | } |
||
221 | break; |
||
222 | case 3: |
||
223 | LCD_printfxy(0,0,"GPS UTC Time"); |
||
224 | if (!SystemTime.Valid) |
||
225 | { |
||
226 | LCD_printfxy(0,1," "); |
||
227 | LCD_printfxy(0,2," No time data! "); |
||
228 | LCD_printfxy(0,3," "); |
||
229 | } |
||
230 | else // newdata or processed |
||
231 | { |
||
232 | LCD_printfxy(0,1," "); |
||
233 | LCD_printfxy(0,2,"Date: %02i/%02i/%04i",SystemTime.Month, SystemTime.Day, SystemTime.Year); |
||
234 | LCD_printfxy(0,3,"Time: %02i:%02i:%02i.%03i", SystemTime.Hour, SystemTime.Min, SystemTime.Sec, SystemTime.mSec); |
||
235 | } |
||
236 | break; |
||
59 | killagreg | 237 | case 4: // Navi Params 1 from FC |
41 | ingob | 238 | LCD_printfxy(0,0,"NaviMode: %3i" , Parameter.NaviGpsModeControl); |
239 | LCD_printfxy(0,1,"G :%3i P :%3i ",Parameter.NaviGpsGain, Parameter.NaviGpsP); |
||
240 | LCD_printfxy(0,2,"I :%3i D :%3i ",Parameter.NaviGpsI, Parameter.NaviGpsD); |
||
241 | LCD_printfxy(0,3,"ACC:%3i SAT:%3i ",Parameter.NaviGpsACC, Parameter.NaviGpsMinSat); |
||
242 | break; |
||
59 | killagreg | 243 | case 5: // Navi Params 2 from FC |
244 | LCD_printfxy(0,0,"Stick TS: %3i", Parameter.NaviStickThreshold); |
||
351 | holgerb | 245 | LCD_printfxy(0,1,"MaxRadius: %3im", DebugOut.Analog[4]); |
59 | killagreg | 246 | LCD_printfxy(0,2,"WindCorr: %3i", Parameter.NaviWindCorrection); |
327 | holgerb | 247 | LCD_printfxy(0,3,"AccComp: %3i", Parameter.NaviSpeedCompensation); |
59 | killagreg | 248 | break; |
249 | case 6: // Navi Params 3 from FC |
||
250 | LCD_printfxy(0,0,"Angle-Limit: %3i", Parameter.NaviAngleLimitation); |
||
251 | LCD_printfxy(0,1," P-Limit: %3i", Parameter.NaviGpsPLimit); |
||
252 | LCD_printfxy(0,2," I-Limit: %3i", Parameter.NaviGpsILimit); |
||
253 | LCD_printfxy(0,3," D-Limit: %3i", Parameter.NaviGpsDLimit); |
||
254 | break; |
||
351 | holgerb | 255 | case 7: // Max Ranges |
256 | LCD_printfxy(0,0,"Maximum flying "); |
||
355 | holgerb | 257 | LCD_printfxy(0,1,"Range: %4im ", AbsoluteFlyingRange); |
357 | holgerb | 258 | LCD_printfxy(0,2,"Descend: %4im ", AutoDescendRange); |
355 | holgerb | 259 | LCD_printfxy(0,3,"Altitude:%4im ", AbsoluteFlyingAltitude); |
260 | if(!AbsoluteFlyingRange) LCD_printfxy(9,1,"disabled"); |
||
261 | if(!AutoDescendRange) LCD_printfxy(9,2,"disabled"); |
||
262 | if(!AbsoluteFlyingAltitude) LCD_printfxy(9,3,"disabled"); |
||
351 | holgerb | 263 | break; |
264 | case 8: |
||
41 | ingob | 265 | LCD_printfxy(0,0,"Home Position"); |
215 | killagreg | 266 | if(NaviData.HomePosition.Status == INVALID) |
41 | ingob | 267 | { |
268 | LCD_printfxy(0,1," "); |
||
269 | LCD_printfxy(0,2," Is not set. "); |
||
270 | LCD_printfxy(0,3," "); |
||
271 | } |
||
272 | else |
||
273 | { |
||
215 | killagreg | 274 | if(NaviData.HomePosition.Longitude < 0) sign = '-'; |
51 | killagreg | 275 | else sign = '+'; |
215 | killagreg | 276 | i1 = abs(NaviData.HomePosition.Longitude)/10000000L; |
277 | i2 = abs(NaviData.HomePosition.Longitude)%10000000L; |
||
55 | killagreg | 278 | LCD_printfxy(0,1,"Lon:%c%03ld.%07ld deg",sign, i1, i2); |
215 | killagreg | 279 | if(NaviData.HomePosition.Latitude < 0) sign = '-'; |
51 | killagreg | 280 | else sign = '+'; |
215 | killagreg | 281 | i1 = abs(NaviData.HomePosition.Latitude)/10000000L; |
282 | i2 = abs(NaviData.HomePosition.Latitude)%10000000L; |
||
55 | killagreg | 283 | LCD_printfxy(0,2,"Lat:%c%03ld.%07ld deg",sign, i1, i2); |
215 | killagreg | 284 | if(NaviData.HomePosition.Altitude < 0) sign = '-'; |
51 | killagreg | 285 | else sign = '+'; |
215 | killagreg | 286 | i1 = abs(NaviData.HomePosition.Altitude)/1000L; |
287 | i2 = abs(NaviData.HomePosition.Altitude)%1000L; |
||
54 | killagreg | 288 | LCD_printfxy(0,3,"Alt:%c%04ld.%03ld m",sign, i1, i2); |
41 | ingob | 289 | } |
290 | break; |
||
351 | holgerb | 291 | case 9: |
318 | holgerb | 292 | LCD_printfxy(0,0,"Target Position"); |
293 | if(NaviData.TargetPosition.Status == INVALID) |
||
294 | { |
||
295 | LCD_printfxy(0,1," "); |
||
296 | LCD_printfxy(0,2," Is not set. "); |
||
297 | LCD_printfxy(0,3," "); |
||
298 | } |
||
299 | else |
||
300 | { |
||
301 | if(NaviData.TargetPosition.Longitude < 0) sign = '-'; |
||
302 | else sign = '+'; |
||
303 | i1 = abs(NaviData.TargetPosition.Longitude)/10000000L; |
||
304 | i2 = abs(NaviData.TargetPosition.Longitude)%10000000L; |
||
305 | LCD_printfxy(0,1,"Lon:%c%03ld.%07ld deg",sign, i1, i2); |
||
306 | if(NaviData.TargetPosition.Latitude < 0) sign = '-'; |
||
307 | else sign = '+'; |
||
308 | i1 = abs(NaviData.TargetPosition.Latitude)/10000000L; |
||
309 | i2 = abs(NaviData.TargetPosition.Latitude)%10000000L; |
||
310 | LCD_printfxy(0,2,"Lat:%c%03ld.%07ld deg",sign, i1, i2); |
||
311 | if(NaviData.HomePosition.Altitude < 0) sign = '-'; |
||
312 | else sign = '+'; |
||
313 | i1 = abs(NaviData.TargetPosition.Altitude)/1000L; |
||
314 | i2 = abs(NaviData.TargetPosition.Altitude)%1000L; |
||
315 | LCD_printfxy(0,3,"Alt:%c%04ld.%03ld m",sign, i1, i2); |
||
316 | } |
||
317 | break; |
||
351 | holgerb | 318 | case 10: // RC stick controls from FC |
41 | ingob | 319 | LCD_printfxy(0,0,"RC-Sticks" ); |
320 | LCD_printfxy(0,1,"Ni:%4i Ro:%4i ",FC.StickNick, FC.StickRoll); |
||
321 | LCD_printfxy(0,2,"Gs:%4i Ya:%4i ",FC.StickGas, FC.StickYaw); |
||
322 | break; |
||
351 | holgerb | 323 | case 11: // RC poti controls from FC |
190 | killagreg | 324 | LCD_printfxy(0,0,"RC-Potis 1" ); |
325 | LCD_printfxy(0,1,"Po1:%3i Po2:%3i ",FC.Poti[0], FC.Poti[1]); |
||
326 | LCD_printfxy(0,2,"Po3:%3i Po4:%3i ",FC.Poti[2], FC.Poti[3]); |
||
41 | ingob | 327 | break; |
351 | holgerb | 328 | case 12: // RC poti controls from FC |
190 | killagreg | 329 | LCD_printfxy(0,0,"RC-Potis 2" ); |
330 | LCD_printfxy(0,1,"Po5:%3i Po6:%3i ",FC.Poti[4], FC.Poti[5]); |
||
331 | LCD_printfxy(0,2,"Po7:%3i Po8:%3i ",FC.Poti[6], FC.Poti[7]); |
||
332 | break; |
||
351 | holgerb | 333 | case 13: // attitude from FC |
66 | killagreg | 334 | if(FromFlightCtrl.AngleNick < 0) sign = '-'; |
335 | else sign = '+'; |
||
336 | i1 = abs(FromFlightCtrl.AngleNick)/10; |
||
337 | i2 = abs(FromFlightCtrl.AngleNick)%10; |
||
201 | killagreg | 338 | LCD_printfxy(0,0,"GyroNick:%c%03ld.%01ld", sign, i1, i2); |
66 | killagreg | 339 | if(FromFlightCtrl.AngleRoll < 0) sign = '-'; |
340 | else sign = '+'; |
||
341 | i1 = abs(FromFlightCtrl.AngleRoll)/10; |
||
342 | i2 = abs(FromFlightCtrl.AngleRoll)%10; |
||
201 | killagreg | 343 | LCD_printfxy(0,1,"GyroRoll:%c%03ld.%01ld", sign, i1, i2); |
67 | killagreg | 344 | if(FromFlightCtrl.AccNick < 0) sign = '-'; |
345 | else sign = '+'; |
||
346 | i1 = abs(FromFlightCtrl.AccNick)/10; |
||
347 | i2 = abs(FromFlightCtrl.AccNick)%10; |
||
201 | killagreg | 348 | LCD_printfxy(0,2," AccNick:%c%03ld.%01ld", sign, i1, i2); |
67 | killagreg | 349 | if(FromFlightCtrl.AccRoll < 0) sign = '-'; |
350 | else sign = '+'; |
||
351 | i1 = abs(FromFlightCtrl.AccRoll)/10; |
||
352 | i2 = abs(FromFlightCtrl.AccRoll)%10; |
||
201 | killagreg | 353 | LCD_printfxy(0,3," AccRoll:%c%03ld.%01ld", sign, i1, i2); |
41 | ingob | 354 | break; |
351 | holgerb | 355 | case 14: // gyros from FC |
41 | ingob | 356 | LCD_printfxy(0,0,"GyroNick: %4i", FromFlightCtrl.GyroNick); |
357 | LCD_printfxy(0,1,"GyroRoll: %4i", FromFlightCtrl.GyroRoll); |
||
358 | LCD_printfxy(0,2,"GyroYaw: %4i", FromFlightCtrl.GyroYaw); |
||
359 | break; |
||
351 | holgerb | 360 | case 15: // Remote Control Level from FC |
41 | ingob | 361 | LCD_printfxy(0,0,"RC-Level: %3i", FC.RC_Quality); |
206 | killagreg | 362 | LCD_printfxy(0,1,"Ubat: %2i.%1i V", FC.BAT_Voltage/10, FC.BAT_Voltage%10); |
254 | killagreg | 363 | LCD_printfxy(0,2,"CompHeading: %3i", Compass_Heading); |
153 | killagreg | 364 | if(GeoMagDec < 0) sign = '-'; |
365 | else sign = '+'; |
||
366 | LCD_printfxy(0,3,"GeoMagDec: %c%i.%1i", sign, abs(GeoMagDec)/10,abs(GeoMagDec)%10); |
||
41 | ingob | 367 | break; |
351 | holgerb | 368 | case 16: // User Parameter |
153 | killagreg | 369 | LCD_printfxy(0,0,"UP1:%3i UP2:%3i",Parameter.User1,Parameter.User2); |
370 | LCD_printfxy(0,1,"UP3:%3i UP4:%3i",Parameter.User3,Parameter.User4); |
||
371 | LCD_printfxy(0,2,"UP5:%3i UP6:%3i",Parameter.User5,Parameter.User6); |
||
372 | LCD_printfxy(0,3,"UP7:%3i UP8:%3i",Parameter.User7,Parameter.User8); |
||
41 | ingob | 373 | break; |
380 | holgerb | 374 | case 17: // User Parameter |
426 | holgerb | 375 | LCD_printfxy(0,0,"SD-Card Logs"); |
380 | holgerb | 376 | LCD_printfxy(0,1,"GPX:%4i (%3ims) ",Logged_GPX_Counter,LogCfg.GPX_Interval); |
377 | LCD_printfxy(0,2,"KML:%4i (%3ims) ",Logged_KML_Counter,LogCfg.KML_Interval); |
||
378 | break; |
||
379 | case 18: // magnetic field |
||
292 | killagreg | 380 | if(Compass_CalState) |
254 | killagreg | 381 | { |
292 | killagreg | 382 | LCD_printfxy(0,0,"Calibration:"); |
383 | LCD_printfxy(0,1,"Step %d/", Compass_CalState); |
||
384 | LCD_printfxy(0,2,"X %4i Y %4i Z %4i",MagVector.X,MagVector.Y,MagVector.Z); |
||
385 | LCD_printfxy(9,3,"(ESC)(NEXT)"); |
||
386 | switch(Compass_CalState) |
||
254 | killagreg | 387 | { |
292 | killagreg | 388 | case 1: |
389 | case 3: |
||
390 | LCD_printfxy(7,1,"pause"); |
||
391 | break; |
||
392 | |||
393 | case 2: |
||
394 | LCD_printfxy(7,1,"horizontal"); |
||
395 | break; |
||
396 | |||
397 | case 4: |
||
398 | LCD_printfxy(7,1,"vertical"); |
||
399 | break; |
||
400 | |||
401 | case 5: |
||
402 | LCD_printfxy(7,1,"data saved"); |
||
403 | LCD_printfxy(8,3," (END) "); |
||
404 | break; |
||
405 | |||
406 | default: |
||
407 | break; |
||
254 | killagreg | 408 | } |
409 | } |
||
292 | killagreg | 410 | else |
254 | killagreg | 411 | { |
330 | holgerb | 412 | if(GeoMagDec < 0) sign = '-'; |
413 | else sign = '+'; |
||
254 | killagreg | 414 | LCD_printfxy(0,0,"Magnetic Field"); |
292 | killagreg | 415 | LCD_printfxy(0,1,"X:%5i",MagVector.X); |
416 | LCD_printfxy(0,2,"Y:%5i",MagVector.Y); |
||
417 | LCD_printfxy(0,3,"Z:%5i",MagVector.Z); |
||
330 | holgerb | 418 | LCD_printfxy(8,1,"Field:%3i",EarthMagneticField/5); |
338 | holgerb | 419 | // LCD_printfxy(8,2,"Dec:%c%i.%1i", sign, abs(GeoMagDec)/10,abs(GeoMagDec)%10); |
420 | // LCD_printfxy(8,3,"Inc:%2i", EarthMagneticInclination); |
||
292 | killagreg | 421 | LCD_printfxy(15,3,"(CAL)"); |
422 | } |
||
423 | if(Keys & KEY4) // next step |
||
424 | { |
||
425 | if(Compass_CalState <5) Compass_SetCalState(Compass_CalState+1); |
||
426 | else Compass_SetCalState(0); |
||
427 | } |
||
428 | if(Keys & KEY3)Compass_SetCalState(0); // cancel |
||
41 | ingob | 429 | break; |
380 | holgerb | 430 | case 19: |
345 | holgerb | 431 | if(GeoMagDec < 0) sign = '-'; |
432 | else sign = '+'; |
||
338 | holgerb | 433 | LCD_printfxy(0,0,"Magnetic Field"); |
434 | LCD_printfxy(0,1,"Field:%3i (Percent)",EarthMagneticField/5); |
||
435 | LCD_printfxy(0,2,"Declination:%c%i.%1i ", sign, abs(GeoMagDec)/10,abs(GeoMagDec)%10); |
||
436 | LCD_printfxy(0,3,"Inclination:%2i (%2i)", EarthMagneticInclination, EarthMagneticInclinationTheoretic); |
||
437 | break; |
||
453 | holgerb | 438 | case 20: |
426 | holgerb | 439 | LCD_printfxy(0,0,"SD-Setting "); |
440 | LCD_printfxy(0,2,"WP-Dynamic:%4i ",WaypointAcceleration); |
||
441 | break; |
||
453 | holgerb | 442 | case 21: |
443 | LCD_printfxy(0,0,"CPU Processing "); |
||
457 | holgerb | 444 | LCD_printfxy(0,2,"GPS-Data: %2i.%iHz ",FreqNewGpsDataIn5Sec/10, FreqNewGpsDataIn5Sec%10); |
445 | LCD_printfxy(0,3,"GPS-Update:%2i.%iHz ",FreqGpsProcessedIn5Sec/10, FreqGpsProcessedIn5Sec%10); |
||
446 | if(FreqNewGpsDataIn5Sec >= 48 && FreqNewGpsDataIn5Sec <= 52) LCD_printfxy(18,2,"OK") else LCD_printfxy(18,2,"!!"); |
||
447 | if(FreqGpsProcessedIn5Sec >= 350) LCD_printfxy(18,3,"OK") else LCD_printfxy(18,3,"!!"); |
||
453 | holgerb | 448 | break; |
41 | ingob | 449 | default: |
201 | killagreg | 450 | //MaxMenuItem = MenuItem - 1; |
41 | ingob | 451 | MenuItem = 0; |
452 | break; |
||
1 | ingob | 453 | } |
454 | } |