Rev 1805 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1805 | Rev 1821 | ||
---|---|---|---|
1 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2 | // + Copyright (c) 04.2007 Holger Buss |
2 | // + Copyright (c) 04.2007 Holger Buss |
3 | // + Nur für den privaten Gebrauch |
3 | // + Nur für den privaten Gebrauch |
4 | // + www.MikroKopter.com |
4 | // + www.MikroKopter.com |
5 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
6 | // + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
6 | // + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
7 | // + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
7 | // + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
8 | // + Sollten direkte oder indirekte kommerzielle Absichten verfolgt werden, ist mit uns (info@mikrokopter.de) Kontakt |
8 | // + Sollten direkte oder indirekte kommerzielle Absichten verfolgt werden, ist mit uns (info@mikrokopter.de) Kontakt |
9 | // + bzgl. der Nutzungsbedingungen aufzunehmen. |
9 | // + bzgl. der Nutzungsbedingungen aufzunehmen. |
10 | // + Eine kommerzielle Nutzung ist z.B.Verkauf von MikroKoptern, Bestückung und Verkauf von Platinen oder Bausätzen, |
10 | // + Eine kommerzielle Nutzung ist z.B.Verkauf von MikroKoptern, Bestückung und Verkauf von Platinen oder Bausätzen, |
11 | // + Verkauf von Luftbildaufnahmen, usw. |
11 | // + Verkauf von Luftbildaufnahmen, usw. |
12 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
12 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
13 | // + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
13 | // + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
14 | // + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
14 | // + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
15 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
15 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
16 | // + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
16 | // + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
17 | // + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
17 | // + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
18 | // + eindeutig als Ursprung verlinkt werden |
18 | // + eindeutig als Ursprung verlinkt werden |
19 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
19 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
20 | // + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
20 | // + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
21 | // + Benutzung auf eigene Gefahr |
21 | // + Benutzung auf eigene Gefahr |
22 | // + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
22 | // + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
23 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
23 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
24 | // + Die Portierung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
24 | // + Die Portierung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
25 | // + mit unserer Zustimmung zulässig |
25 | // + mit unserer Zustimmung zulässig |
26 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
26 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
27 | // + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
27 | // + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
28 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
28 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29 | // + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
29 | // + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
30 | // + this list of conditions and the following disclaimer. |
30 | // + this list of conditions and the following disclaimer. |
31 | // + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
31 | // + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
32 | // + from this software without specific prior written permission. |
32 | // + from this software without specific prior written permission. |
33 | // + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
33 | // + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
34 | // + for non-commercial use (directly or indirectly) |
34 | // + for non-commercial use (directly or indirectly) |
35 | // + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
35 | // + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
36 | // + with our written permission |
36 | // + with our written permission |
37 | // + * If sources or documentations are redistributet on other webpages, out webpage (http://www.MikroKopter.de) must be |
37 | // + * If sources or documentations are redistributet on other webpages, out webpage (http://www.MikroKopter.de) must be |
38 | // + clearly linked as origin |
38 | // + clearly linked as origin |
39 | // + * porting to systems other than hardware from www.mikrokopter.de is not allowed |
39 | // + * porting to systems other than hardware from www.mikrokopter.de is not allowed |
40 | // + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
40 | // + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
41 | // + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
41 | // + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
42 | // + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
42 | // + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
43 | // + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
43 | // + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
44 | // + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
44 | // + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
45 | // + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
45 | // + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
46 | // + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
46 | // + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
47 | // + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
47 | // + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
48 | // + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
48 | // + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
49 | // + POSSIBILITY OF SUCH DAMAGE. |
49 | // + POSSIBILITY OF SUCH DAMAGE. |
50 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
50 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
51 | #include <stdlib.h> |
51 | #include <stdlib.h> |
52 | #include <inttypes.h> |
52 | #include <inttypes.h> |
53 | #include "eeprom.h" |
53 | #include "eeprom.h" |
54 | #include "timer2.h" |
54 | #include "timer2.h" |
55 | #include "rc.h" |
55 | #include "rc.h" |
56 | #include "externalControl.h" |
56 | #include "externalControl.h" |
57 | #include "uart0.h" |
57 | #include "uart0.h" |
58 | #include "printf_P.h" |
58 | #include "printf_P.h" |
59 | #include "analog.h" |
59 | #include "analog.h" |
60 | #include "twimaster.h" |
60 | #include "twimaster.h" |
61 | #include "attitude.h" |
61 | #include "attitude.h" |
62 | 62 | ||
63 | #if (!defined (USE_NAVICTRL)) |
63 | #if (!defined (USE_NAVICTRL)) |
64 | uint8_t MaxMenuItem = 13; |
64 | uint8_t MaxMenuItem = 13; |
65 | #else |
65 | #else |
66 | #ifdef USE_NAVICTRL |
66 | #ifdef USE_NAVICTRL |
67 | #include "gps.c" |
67 | #include "gps.c" |
68 | uint8_t MaxMenuItem = 14; |
68 | uint8_t MaxMenuItem = 14; |
69 | #endif |
69 | #endif |
70 | #endif |
70 | #endif |
71 | uint8_t MenuItem = 0; |
71 | uint8_t MenuItem = 0; |
72 | uint8_t RemoteKeys = 0; |
72 | uint8_t RemoteKeys = 0; |
73 | 73 | ||
74 | #define KEY1 0x01 |
74 | #define KEY1 0x01 |
75 | #define KEY2 0x02 |
75 | #define KEY2 0x02 |
76 | #define KEY3 0x04 |
76 | #define KEY3 0x04 |
77 | #define KEY4 0x08 |
77 | #define KEY4 0x08 |
78 | #define KEY5 0x10 |
78 | #define KEY5 0x10 |
79 | 79 | ||
80 | #define DISPLAYBUFFSIZE 80 |
80 | #define DISPLAYBUFFSIZE 80 |
81 | int8_t DisplayBuff[DISPLAYBUFFSIZE] = "Hello World"; |
81 | int8_t DisplayBuff[DISPLAYBUFFSIZE] = "Hello World"; |
82 | uint8_t DispPtr = 0; |
82 | uint8_t DispPtr = 0; |
83 | - | ||
84 | 83 | ||
85 | /************************************/ |
84 | /************************************/ |
86 | /* Clear LCD Buffer */ |
85 | /* Clear LCD Buffer */ |
87 | /************************************/ |
86 | /************************************/ |
88 | void LCD_Clear(void) { |
87 | void LCD_Clear(void) { |
89 | uint8_t i; |
88 | uint8_t i; |
90 | for( i = 0; i < DISPLAYBUFFSIZE; i++) DisplayBuff[i] = ' '; |
89 | for (i = 0; i < DISPLAYBUFFSIZE; i++) |
- | 90 | DisplayBuff[i] = ' '; |
|
91 | } |
91 | } |
92 | - | ||
93 | 92 | ||
94 | /************************************/ |
93 | /************************************/ |
95 | /* Update Menu on LCD */ |
94 | /* Update Menu on LCD */ |
96 | /************************************/ |
95 | /************************************/ |
97 | // Display with 20 characters in 4 lines |
96 | // Display with 20 characters in 4 lines |
98 | void LCD_PrintMenu(void) { |
97 | void LCD_PrintMenu(void) { |
245 | #if (defined (USE_NAVICTRL)) |
255 | #if (defined (USE_NAVICTRL)) |
246 | case 14://GPS Lat/Lon coords |
256 | case 14://GPS Lat/Lon coords |
247 | if (GPSInfo.status == INVALID) { |
257 | if (GPSInfo.status == INVALID) { |
248 | LCD_printfxy(0,0,"No GPS data!"); |
258 | LCD_printfxy(0,0,"No GPS data!"); |
249 | } else { |
259 | } else { |
250 | switch (GPSInfo.satfix) |
260 | switch (GPSInfo.satfix) |
251 | { |
261 | { |
252 | case SATFIX_NONE: |
262 | case SATFIX_NONE: |
253 | LCD_printfxy(0,0,"Sats: %d Fix: No", GPSInfo.satnum); |
263 | LCD_printfxy(0,0,"Sats: %d Fix: No", GPSInfo.satnum); |
254 | break; |
264 | break; |
255 | case SATFIX_2D: |
265 | case SATFIX_2D: |
256 | LCD_printfxy(0,0,"Sats: %d Fix: 2D", GPSInfo.satnum); |
266 | LCD_printfxy(0,0,"Sats: %d Fix: 2D", GPSInfo.satnum); |
257 | break; |
267 | break; |
258 | case SATFIX_3D: |
268 | case SATFIX_3D: |
259 | LCD_printfxy(0,0,"Sats: %d Fix: 3D", GPSInfo.satnum); |
269 | LCD_printfxy(0,0,"Sats: %d Fix: 3D", GPSInfo.satnum); |
- | 270 | break; |
|
- | 271 | default: |
|
- | 272 | LCD_printfxy(0,0,"Sats: %d Fix: ??", GPSInfo.satnum); |
|
- | 273 | break; |
|
- | 274 | } |
|
- | 275 | int16_t i1,i2,i3; |
|
- | 276 | i1 = (int16_t)(GPSInfo.longitude/10000000L); |
|
- | 277 | i2 = abs((int16_t)((GPSInfo.longitude%10000000L)/10000L)); |
|
- | 278 | i3 = abs((int16_t)(((GPSInfo.longitude%10000000L)%10000L)/10L)); |
|
- | 279 | LCD_printfxy(0,1,"Lon: %d.%03d%03d deg",i1, i2, i3); |
|
- | 280 | i1 = (int16_t)(GPSInfo.latitude/10000000L); |
|
- | 281 | i2 = abs((int16_t)((GPSInfo.latitude%10000000L)/10000L)); |
|
- | 282 | i3 = abs((int16_t)(((GPSInfo.latitude%10000000L)%10000L)/10L)); |
|
- | 283 | LCD_printfxy(0,2,"Lat: %d.%03d%03d deg",i1, i2, i3); |
|
- | 284 | i1 = (int16_t)(GPSInfo.altitude/1000L); |
|
- | 285 | i2 = abs((int16_t)(GPSInfo.altitude%1000L)); |
|
- | 286 | LCD_printfxy(0,3,"Alt: %d.%03d m",i1, i2); |
|
- | 287 | } |
|
260 | break; |
288 | break; |
- | 289 | #endif |
|
- | 290 | ||
261 | default: |
291 | default: |
262 | LCD_printfxy(0,0,"Sats: %d Fix: ??", GPSInfo.satnum); |
292 | MaxMenuItem = MenuItem - 1; |
- | 293 | MenuItem = 0; |
|
263 | break; |
294 | break; |
264 | } |
295 | } |
265 | int16_t i1,i2,i3; |
- | |
266 | i1 = (int16_t)(GPSInfo.longitude/10000000L); |
- | |
267 | i2 = abs((int16_t)((GPSInfo.longitude%10000000L)/10000L)); |
- | |
268 | i3 = abs((int16_t)(((GPSInfo.longitude%10000000L)%10000L)/10L)); |
- | |
269 | LCD_printfxy(0,1,"Lon: %d.%03d%03d deg",i1, i2, i3); |
- | |
270 | i1 = (int16_t)(GPSInfo.latitude/10000000L); |
- | |
271 | i2 = abs((int16_t)((GPSInfo.latitude%10000000L)/10000L)); |
- | |
272 | i3 = abs((int16_t)(((GPSInfo.latitude%10000000L)%10000L)/10L)); |
- | |
273 | LCD_printfxy(0,2,"Lat: %d.%03d%03d deg",i1, i2, i3); |
- | |
274 | i1 = (int16_t)(GPSInfo.altitude/1000L); |
- | |
275 | i2 = abs((int16_t)(GPSInfo.altitude%1000L)); |
- | |
276 | LCD_printfxy(0,3,"Alt: %d.%03d m",i1, i2); |
- | |
277 | } |
- | |
278 | break; |
- | |
279 | #endif |
- | |
280 | - | ||
281 | default: |
- | |
282 | MaxMenuItem = MenuItem - 1; |
- | |
283 | MenuItem = 0; |
- | |
284 | break; |
- | |
285 | } |
- | |
286 | RemoteKeys = 0; |
296 | RemoteKeys = 0; |
287 | } |
297 | } |
288 | 298 |