Subversion Repositories NaviCtrl

Rev

Rev 215 | Rev 238 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 215 Rev 234
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 "ubx.h"
60
#include "ubx.h"
61
#include "GPS.h"
61
#include "GPS.h"
62
#include "timer1.h"
62
#include "timer1.h"
63
#include "i2c.h"
63
#include "i2c.h"
64
#include "spi_slave.h"
64
#include "spi_slave.h"
65
#include "menu.h"
65
#include "menu.h"
66
#include "uart1.h"
66
#include "uart1.h"
67
 
67
 
68
u8 DispPtr = 0;
68
u8 DispPtr = 0;
69
s8 DisplayBuff[DISPLAYBUFFSIZE];
69
s8 DisplayBuff[DISPLAYBUFFSIZE];
70
 
70
 
71
 
71
 
72
u8 MenuItem = 0;
72
u8 MenuItem = 0;
73
u8 MaxMenuItem = 15;
73
u8 MaxMenuItem = 15;
74
 
74
 
75
 
75
 
76
 
76
 
77
void Menu_Putchar(char c)
77
void Menu_Putchar(char c)
78
{
78
{
79
   if(DispPtr < DISPLAYBUFFSIZE) DisplayBuff[DispPtr++] = c; ;
79
   if(DispPtr < DISPLAYBUFFSIZE) DisplayBuff[DispPtr++] = c; ;
80
}
80
}
81
 
81
 
82
void Menu_Clear(void)
82
void Menu_Clear(void)
83
{
83
{
84
        u8 i;
84
        u8 i;
85
        for( i = 0; i < DISPLAYBUFFSIZE; i++) DisplayBuff[i] = ' ';
85
        for( i = 0; i < DISPLAYBUFFSIZE; i++) DisplayBuff[i] = ' ';
86
}
86
}
87
 
87
 
88
 
88
 
89
// Display with 20 characters in 4 lines
89
// Display with 20 characters in 4 lines
90
void Menu_Update(u8 Keys)
90
void Menu_Update(u8 Keys)
91
{
91
{
92
        s32 i1,i2;
92
        s32 i1,i2;
93
        u8 sign;
93
        u8 sign;
94
 
94
 
95
        if(Keys & KEY1) { if(MenuItem > 0) MenuItem--; else MenuItem = MaxMenuItem;}
95
        if(Keys & KEY1) { if(MenuItem > 0) MenuItem--; else MenuItem = MaxMenuItem;}
96
        if(Keys & KEY2) { if(MenuItem == MaxMenuItem) MenuItem = 0; else MenuItem++;}
96
        if(Keys & KEY2) { if(MenuItem == MaxMenuItem) MenuItem = 0; else MenuItem++;}
97
        if((Keys & KEY1) && (Keys & KEY2)) MenuItem = 0;
97
        if((Keys & KEY1) && (Keys & KEY2)) MenuItem = 0;
98
        if(MenuItem > MaxMenuItem) MenuItem = MaxMenuItem;
98
        if(MenuItem > MaxMenuItem) MenuItem = MaxMenuItem;
99
        Menu_Clear();
99
        Menu_Clear();
100
        // print menu item number in the upper right corner
100
        // print menu item number in the upper right corner
101
        if(MenuItem < 10)
101
        if(MenuItem < 10)
102
        {
102
        {
103
                LCD_printfxy(17,0,"[%i]",MenuItem);
103
                LCD_printfxy(17,0,"[%i]",MenuItem);
104
        }
104
        }
105
        else // Menuitem >= 10
105
        else // Menuitem >= 10
106
        {
106
        {
107
                LCD_printfxy(16,0,"[%i]",MenuItem);
107
                LCD_printfxy(16,0,"[%i]",MenuItem);
108
        }
108
        }
109
 
109
 
110
        switch(MenuItem)
110
        switch(MenuItem)
111
        {
111
        {
112
                // Version Info
112
                // Version Info
113
                case 0:
113
                case 0:
114
                        LCD_printfxy(0,0,"++  Navi-Ctrl  ++");
114
                        LCD_printfxy(0,0,"++  Navi-Ctrl  ++");
115
                        LCD_printfxy(0,1," V%d.%d%c ", VERSION_MAJOR, VERSION_MINOR, 'a'+ VERSION_PATCH);
115
                        LCD_printfxy(0,1," V%d.%d%c ", VERSION_MAJOR, VERSION_MINOR, 'a'+ VERSION_PATCH);
116
            if(ErrorCode) LCD_printfxy(11,1," Err:%d",(u16)ErrorCode) else LCD_printfxy(11,1,"       ");
116
            if(ErrorCode) LCD_printfxy(11,1," Err:%d",ErrorCode) else LCD_printfxy(11,1,"       ");
117
            LCD_printfxy(0,2,"%s",ErrorMSG);
117
            LCD_printfxy(0,2,"%s",ErrorMSG);
118
                        LCD_printfxy(0,3,"(c) Buss, Busker");
118
                        LCD_printfxy(0,3,"(c) Buss, Busker");
119
                        break;
119
                        break;
120
                case 1:
120
                case 1:
121
                        if (GPSData.Status == INVALID)
121
                        if (GPSData.Status == INVALID)
122
                        {
122
                        {
123
                                LCD_printfxy(0,0,"No GPS data");
123
                                LCD_printfxy(0,0,"No GPS data");
124
                                LCD_printfxy(0,1,"Lon:                ");
124
                                LCD_printfxy(0,1,"Lon:                ");
125
                                LCD_printfxy(0,2,"Lat:                ");
125
                                LCD_printfxy(0,2,"Lat:                ");
126
                                LCD_printfxy(0,3,"Alt:                ");
126
                                LCD_printfxy(0,3,"Alt:                ");
127
                        }
127
                        }
128
                        else // newdata or processed
128
                        else // newdata or processed
129
                        {
129
                        {
130
                                LCD_printfxy(0,0,"Sat:%02d ", GPSData.NumOfSats);
130
                                LCD_printfxy(0,0,"Sat:%02d ", GPSData.NumOfSats);
131
                                switch (GPSData.SatFix)
131
                                switch (GPSData.SatFix)
132
                                {
132
                                {
133
                                case SATFIX_NONE:
133
                                case SATFIX_NONE:
134
                                        LCD_printfxy(7,0,"NoFix");
134
                                        LCD_printfxy(7,0,"NoFix");
135
                                        break;
135
                                        break;
136
                                case SATFIX_2D:
136
                                case SATFIX_2D:
137
                                        LCD_printfxy(7,0,"2DFix");
137
                                        LCD_printfxy(7,0,"2DFix");
138
                                        break;
138
                                        break;
139
                                case SATFIX_3D:
139
                                case SATFIX_3D:
140
                                        LCD_printfxy(7,0,"3DFix");
140
                                        LCD_printfxy(7,0,"3DFix");
141
                                        break;
141
                                        break;
142
                                default:
142
                                default:
143
                                        LCD_printfxy(7,0,"??Fix");
143
                                        LCD_printfxy(7,0,"??Fix");
144
                                        break;
144
                                        break;
145
                                }
145
                                }
146
                                if(GPSData.Flags & FLAG_DIFFSOLN)
146
                                if(GPSData.Flags & FLAG_DIFFSOLN)
147
                                {
147
                                {
148
                                        LCD_printfxy(12,0,"/DGPS");
148
                                        LCD_printfxy(12,0,"/DGPS");
149
                                }
149
                                }
150
                                else
150
                                else
151
                                {
151
                                {
152
                                        LCD_printfxy(12,0,"     ");
152
                                        LCD_printfxy(12,0,"     ");
153
                                }
153
                                }
154
 
154
 
155
                                if(GPSData.Position.Longitude < 0) sign = '-';
155
                                if(GPSData.Position.Longitude < 0) sign = '-';
156
                                else sign = '+';
156
                                else sign = '+';
157
                                i1 = abs(GPSData.Position.Longitude)/10000000L;
157
                                i1 = abs(GPSData.Position.Longitude)/10000000L;
158
                                i2 = abs(GPSData.Position.Longitude)%10000000L;
158
                                i2 = abs(GPSData.Position.Longitude)%10000000L;
159
                                LCD_printfxy(0,1,"Lon:%c%03ld.%07ld deg",sign, i1, i2);
159
                                LCD_printfxy(0,1,"Lon:%c%03ld.%07ld deg",sign, i1, i2);
160
                                if(GPSData.Position.Latitude < 0) sign = '-';
160
                                if(GPSData.Position.Latitude < 0) sign = '-';
161
                                else sign = '+';
161
                                else sign = '+';
162
                                i1 = abs(GPSData.Position.Latitude)/10000000L;
162
                                i1 = abs(GPSData.Position.Latitude)/10000000L;
163
                                i2 = abs(GPSData.Position.Latitude)%10000000L;
163
                                i2 = abs(GPSData.Position.Latitude)%10000000L;
164
                                LCD_printfxy(0,2,"Lat:%c%03ld.%07ld deg",sign, i1, i2);
164
                                LCD_printfxy(0,2,"Lat:%c%03ld.%07ld deg",sign, i1, i2);
165
                                if(GPSData.Position.Altitude < 0) sign = '-';
165
                                if(GPSData.Position.Altitude < 0) sign = '-';
166
                                else sign = '+';
166
                                else sign = '+';
167
                                i1 = abs(GPSData.Position.Altitude)/1000L;
167
                                i1 = abs(GPSData.Position.Altitude)/1000L;
168
                                i2 = abs(GPSData.Position.Altitude)%1000L;
168
                                i2 = abs(GPSData.Position.Altitude)%1000L;
169
                                LCD_printfxy(0,3,"Alt:%c%04ld.%03ld m", sign, i1, i2);
169
                                LCD_printfxy(0,3,"Alt:%c%04ld.%03ld m", sign, i1, i2);
170
                        }
170
                        }
171
                        break;
171
                        break;
172
                case 2:
172
                case 2:
173
                        if (GPSData.Status == INVALID)
173
                        if (GPSData.Status == INVALID)
174
                        {
174
                        {
175
                                LCD_printfxy(0,0,"No GPS data");
175
                                LCD_printfxy(0,0,"No GPS data");
176
                                LCD_printfxy(0,1,"Speed N:            ");
176
                                LCD_printfxy(0,1,"Speed N:            ");
177
                                LCD_printfxy(0,2,"Speed E:            ");
177
                                LCD_printfxy(0,2,"Speed E:            ");
178
                                LCD_printfxy(0,3,"Speed T:            ");
178
                                LCD_printfxy(0,3,"Speed T:            ");
179
                        }
179
                        }
180
                        else // newdata or processed
180
                        else // newdata or processed
181
                        {
181
                        {
182
                                LCD_printfxy(0,0,"Sat:%02d ", GPSData.NumOfSats);
182
                                LCD_printfxy(0,0,"Sat:%02d ", GPSData.NumOfSats);
183
                                switch (GPSData.SatFix)
183
                                switch (GPSData.SatFix)
184
                                {
184
                                {
185
                                case SATFIX_NONE:
185
                                case SATFIX_NONE:
186
                                        LCD_printfxy(7,0,"NoFix");
186
                                        LCD_printfxy(7,0,"NoFix");
187
                                        break;
187
                                        break;
188
                                case SATFIX_2D:
188
                                case SATFIX_2D:
189
                                        LCD_printfxy(7,0,"2DFix");
189
                                        LCD_printfxy(7,0,"2DFix");
190
                                        break;
190
                                        break;
191
                                case SATFIX_3D:
191
                                case SATFIX_3D:
192
                                        LCD_printfxy(7,0,"3DFix");
192
                                        LCD_printfxy(7,0,"3DFix");
193
                                        break;
193
                                        break;
194
                                default:
194
                                default:
195
                                        LCD_printfxy(7,0,"??Fix");
195
                                        LCD_printfxy(7,0,"??Fix");
196
                                        break;
196
                                        break;
197
                                }
197
                                }
198
                                if(GPSData.Flags & FLAG_DIFFSOLN)
198
                                if(GPSData.Flags & FLAG_DIFFSOLN)
199
                                {
199
                                {
200
                                        LCD_printfxy(12,0,"/DGPS");
200
                                        LCD_printfxy(12,0,"/DGPS");
201
                                }
201
                                }
202
                                else
202
                                else
203
                                {
203
                                {
204
                                        LCD_printfxy(12,0,"     ");
204
                                        LCD_printfxy(12,0,"     ");
205
                                }
205
                                }
206
 
206
 
207
                                LCD_printfxy(0,1,"Speed N: %+4ld cm/s",GPSData.Speed_North);
207
                                LCD_printfxy(0,1,"Speed N: %+4ld cm/s",GPSData.Speed_North);
208
                                LCD_printfxy(0,2,"Speed E: %+4ld cm/s",GPSData.Speed_East);
208
                                LCD_printfxy(0,2,"Speed E: %+4ld cm/s",GPSData.Speed_East);
209
                                LCD_printfxy(0,3,"Speed T: %+4ld cm/s",GPSData.Speed_Top);
209
                                LCD_printfxy(0,3,"Speed T: %+4ld cm/s",GPSData.Speed_Top);
210
                        }
210
                        }
211
                        break;
211
                        break;
212
                case 3:
212
                case 3:
213
                        LCD_printfxy(0,0,"GPS UTC Time");
213
                        LCD_printfxy(0,0,"GPS UTC Time");
214
                        if (!SystemTime.Valid)
214
                        if (!SystemTime.Valid)
215
                        {
215
                        {
216
                                LCD_printfxy(0,1,"                    ");
216
                                LCD_printfxy(0,1,"                    ");
217
                                LCD_printfxy(0,2,"  No time data!     ");
217
                                LCD_printfxy(0,2,"  No time data!     ");
218
                                LCD_printfxy(0,3,"                    ");
218
                                LCD_printfxy(0,3,"                    ");
219
                        }
219
                        }
220
                        else // newdata or processed
220
                        else // newdata or processed
221
                        {
221
                        {
222
                                LCD_printfxy(0,1,"                    ");
222
                                LCD_printfxy(0,1,"                    ");
223
                                LCD_printfxy(0,2,"Date: %02i/%02i/%04i",SystemTime.Month, SystemTime.Day, SystemTime.Year);
223
                                LCD_printfxy(0,2,"Date: %02i/%02i/%04i",SystemTime.Month, SystemTime.Day, SystemTime.Year);
224
                                LCD_printfxy(0,3,"Time: %02i:%02i:%02i.%03i", SystemTime.Hour, SystemTime.Min, SystemTime.Sec, SystemTime.mSec);
224
                                LCD_printfxy(0,3,"Time: %02i:%02i:%02i.%03i", SystemTime.Hour, SystemTime.Min, SystemTime.Sec, SystemTime.mSec);
225
                        }
225
                        }
226
                        break;
226
                        break;
227
                case 4: // Navi Params 1 from FC
227
                case 4: // Navi Params 1 from FC
228
                        LCD_printfxy(0,0,"NaviMode: %3i" ,  Parameter.NaviGpsModeControl);
228
                        LCD_printfxy(0,0,"NaviMode: %3i" ,  Parameter.NaviGpsModeControl);
229
            LCD_printfxy(0,1,"G  :%3i P  :%3i ",Parameter.NaviGpsGain, Parameter.NaviGpsP);
229
            LCD_printfxy(0,1,"G  :%3i P  :%3i ",Parameter.NaviGpsGain, Parameter.NaviGpsP);
230
            LCD_printfxy(0,2,"I  :%3i D  :%3i ",Parameter.NaviGpsI, Parameter.NaviGpsD);
230
            LCD_printfxy(0,2,"I  :%3i D  :%3i ",Parameter.NaviGpsI, Parameter.NaviGpsD);
231
                    LCD_printfxy(0,3,"ACC:%3i SAT:%3i ",Parameter.NaviGpsACC, Parameter.NaviGpsMinSat);
231
                    LCD_printfxy(0,3,"ACC:%3i SAT:%3i ",Parameter.NaviGpsACC, Parameter.NaviGpsMinSat);
232
                        break;
232
                        break;
233
                case 5: // Navi Params 2 from FC
233
                case 5: // Navi Params 2 from FC
234
                        LCD_printfxy(0,0,"Stick TS:  %3i", Parameter.NaviStickThreshold);
234
                        LCD_printfxy(0,0,"Stick TS:  %3i", Parameter.NaviStickThreshold);
235
            LCD_printfxy(0,1,"MaxRadius: %3i m", NaviData.OperatingRadius);
235
            LCD_printfxy(0,1,"MaxRadius: %3i m", NaviData.OperatingRadius);
236
            LCD_printfxy(0,2,"WindCorr:  %3i", Parameter.NaviWindCorrection);
236
            LCD_printfxy(0,2,"WindCorr:  %3i", Parameter.NaviWindCorrection);
237
                    LCD_printfxy(0,3,"SpeedComp: %3i", Parameter.NaviSpeedCompensation);
237
                    LCD_printfxy(0,3,"SpeedComp: %3i", Parameter.NaviSpeedCompensation);
238
                        break;
238
                        break;
239
                case 6: // Navi Params 3 from FC
239
                case 6: // Navi Params 3 from FC
240
                        LCD_printfxy(0,0,"Angle-Limit: %3i", Parameter.NaviAngleLimitation);
240
                        LCD_printfxy(0,0,"Angle-Limit: %3i", Parameter.NaviAngleLimitation);
241
            LCD_printfxy(0,1,"    P-Limit: %3i", Parameter.NaviGpsPLimit);
241
            LCD_printfxy(0,1,"    P-Limit: %3i", Parameter.NaviGpsPLimit);
242
            LCD_printfxy(0,2,"    I-Limit: %3i", Parameter.NaviGpsILimit);
242
            LCD_printfxy(0,2,"    I-Limit: %3i", Parameter.NaviGpsILimit);
243
                    LCD_printfxy(0,3,"    D-Limit: %3i", Parameter.NaviGpsDLimit);
243
                    LCD_printfxy(0,3,"    D-Limit: %3i", Parameter.NaviGpsDLimit);
244
                        break;
244
                        break;
245
                case 7:
245
                case 7:
246
                        LCD_printfxy(0,0,"Home Position");
246
                        LCD_printfxy(0,0,"Home Position");
247
                        if(NaviData.HomePosition.Status == INVALID)
247
                        if(NaviData.HomePosition.Status == INVALID)
248
                        {
248
                        {
249
                                LCD_printfxy(0,1,"                     ");
249
                                LCD_printfxy(0,1,"                     ");
250
                                LCD_printfxy(0,2,"    Is not set.      ");
250
                                LCD_printfxy(0,2,"    Is not set.      ");
251
                                LCD_printfxy(0,3,"                     ");
251
                                LCD_printfxy(0,3,"                     ");
252
                        }
252
                        }
253
                        else
253
                        else
254
                        {
254
                        {
255
                                if(NaviData.HomePosition.Longitude < 0) sign = '-';
255
                                if(NaviData.HomePosition.Longitude < 0) sign = '-';
256
                                else sign = '+';
256
                                else sign = '+';
257
                                i1 = abs(NaviData.HomePosition.Longitude)/10000000L;
257
                                i1 = abs(NaviData.HomePosition.Longitude)/10000000L;
258
                                i2 = abs(NaviData.HomePosition.Longitude)%10000000L;
258
                                i2 = abs(NaviData.HomePosition.Longitude)%10000000L;
259
                                LCD_printfxy(0,1,"Lon:%c%03ld.%07ld deg",sign, i1, i2);
259
                                LCD_printfxy(0,1,"Lon:%c%03ld.%07ld deg",sign, i1, i2);
260
                                if(NaviData.HomePosition.Latitude < 0) sign = '-';
260
                                if(NaviData.HomePosition.Latitude < 0) sign = '-';
261
                                else sign = '+';
261
                                else sign = '+';
262
                                i1 = abs(NaviData.HomePosition.Latitude)/10000000L;
262
                                i1 = abs(NaviData.HomePosition.Latitude)/10000000L;
263
                                i2 = abs(NaviData.HomePosition.Latitude)%10000000L;
263
                                i2 = abs(NaviData.HomePosition.Latitude)%10000000L;
264
                                LCD_printfxy(0,2,"Lat:%c%03ld.%07ld deg",sign, i1, i2);
264
                                LCD_printfxy(0,2,"Lat:%c%03ld.%07ld deg",sign, i1, i2);
265
                                if(NaviData.HomePosition.Altitude < 0) sign = '-';
265
                                if(NaviData.HomePosition.Altitude < 0) sign = '-';
266
                                else sign = '+';
266
                                else sign = '+';
267
                                i1 = abs(NaviData.HomePosition.Altitude)/1000L;
267
                                i1 = abs(NaviData.HomePosition.Altitude)/1000L;
268
                                i2 = abs(NaviData.HomePosition.Altitude)%1000L;
268
                                i2 = abs(NaviData.HomePosition.Altitude)%1000L;
269
                                LCD_printfxy(0,3,"Alt:%c%04ld.%03ld m",sign, i1, i2);
269
                                LCD_printfxy(0,3,"Alt:%c%04ld.%03ld m",sign, i1, i2);
270
                        }
270
                        }
271
                        break;
271
                        break;
272
                case 8: // RC stick controls from FC
272
                case 8: // RC stick controls from FC
273
                        LCD_printfxy(0,0,"RC-Sticks" );
273
                        LCD_printfxy(0,0,"RC-Sticks" );
274
            LCD_printfxy(0,1,"Ni:%4i  Ro:%4i ",FC.StickNick, FC.StickRoll);
274
            LCD_printfxy(0,1,"Ni:%4i  Ro:%4i ",FC.StickNick, FC.StickRoll);
275
            LCD_printfxy(0,2,"Gs:%4i  Ya:%4i ",FC.StickGas, FC.StickYaw);
275
            LCD_printfxy(0,2,"Gs:%4i  Ya:%4i ",FC.StickGas, FC.StickYaw);
276
                        break;
276
                        break;
277
                case 9: // RC poti controls from FC
277
                case 9: // RC poti controls from FC
278
                        LCD_printfxy(0,0,"RC-Potis 1" );
278
                        LCD_printfxy(0,0,"RC-Potis 1" );
279
            LCD_printfxy(0,1,"Po1:%3i  Po2:%3i ",FC.Poti[0], FC.Poti[1]);
279
            LCD_printfxy(0,1,"Po1:%3i  Po2:%3i ",FC.Poti[0], FC.Poti[1]);
280
            LCD_printfxy(0,2,"Po3:%3i  Po4:%3i ",FC.Poti[2], FC.Poti[3]);
280
            LCD_printfxy(0,2,"Po3:%3i  Po4:%3i ",FC.Poti[2], FC.Poti[3]);
281
                        break;
281
                        break;
282
                case 10: // RC poti controls from FC
282
                case 10: // RC poti controls from FC
283
                        LCD_printfxy(0,0,"RC-Potis 2" );
283
                        LCD_printfxy(0,0,"RC-Potis 2" );
284
            LCD_printfxy(0,1,"Po5:%3i  Po6:%3i ",FC.Poti[4], FC.Poti[5]);
284
            LCD_printfxy(0,1,"Po5:%3i  Po6:%3i ",FC.Poti[4], FC.Poti[5]);
285
            LCD_printfxy(0,2,"Po7:%3i  Po8:%3i ",FC.Poti[6], FC.Poti[7]);
285
            LCD_printfxy(0,2,"Po7:%3i  Po8:%3i ",FC.Poti[6], FC.Poti[7]);
286
                        break;
286
                        break;
287
                case 11: // attitude from FC
287
                case 11: // attitude from FC
288
                        if(FromFlightCtrl.AngleNick < 0) sign = '-';
288
                        if(FromFlightCtrl.AngleNick < 0) sign = '-';
289
                        else sign = '+';
289
                        else sign = '+';
290
                        i1 = abs(FromFlightCtrl.AngleNick)/10;
290
                        i1 = abs(FromFlightCtrl.AngleNick)/10;
291
                        i2 = abs(FromFlightCtrl.AngleNick)%10;
291
                        i2 = abs(FromFlightCtrl.AngleNick)%10;
292
                        LCD_printfxy(0,0,"GyroNick:%c%03ld.%01ld", sign, i1, i2);
292
                        LCD_printfxy(0,0,"GyroNick:%c%03ld.%01ld", sign, i1, i2);
293
                        if(FromFlightCtrl.AngleRoll < 0) sign = '-';
293
                        if(FromFlightCtrl.AngleRoll < 0) sign = '-';
294
                        else sign = '+';
294
                        else sign = '+';
295
                        i1 = abs(FromFlightCtrl.AngleRoll)/10;
295
                        i1 = abs(FromFlightCtrl.AngleRoll)/10;
296
                        i2 = abs(FromFlightCtrl.AngleRoll)%10;
296
                        i2 = abs(FromFlightCtrl.AngleRoll)%10;
297
            LCD_printfxy(0,1,"GyroRoll:%c%03ld.%01ld", sign, i1, i2);
297
            LCD_printfxy(0,1,"GyroRoll:%c%03ld.%01ld", sign, i1, i2);
298
                        if(FromFlightCtrl.AccNick < 0) sign = '-';
298
                        if(FromFlightCtrl.AccNick < 0) sign = '-';
299
                        else sign = '+';
299
                        else sign = '+';
300
                        i1 = abs(FromFlightCtrl.AccNick)/10;
300
                        i1 = abs(FromFlightCtrl.AccNick)/10;
301
                        i2 = abs(FromFlightCtrl.AccNick)%10;
301
                        i2 = abs(FromFlightCtrl.AccNick)%10;
302
                        LCD_printfxy(0,2," AccNick:%c%03ld.%01ld", sign, i1, i2);
302
                        LCD_printfxy(0,2," AccNick:%c%03ld.%01ld", sign, i1, i2);
303
                        if(FromFlightCtrl.AccRoll < 0) sign = '-';
303
                        if(FromFlightCtrl.AccRoll < 0) sign = '-';
304
                        else sign = '+';
304
                        else sign = '+';
305
                        i1 = abs(FromFlightCtrl.AccRoll)/10;
305
                        i1 = abs(FromFlightCtrl.AccRoll)/10;
306
                        i2 = abs(FromFlightCtrl.AccRoll)%10;
306
                        i2 = abs(FromFlightCtrl.AccRoll)%10;
307
            LCD_printfxy(0,3," AccRoll:%c%03ld.%01ld", sign, i1, i2);
307
            LCD_printfxy(0,3," AccRoll:%c%03ld.%01ld", sign, i1, i2);
308
                        break;
308
                        break;
309
                case 12: // gyros from FC
309
                case 12: // gyros from FC
310
                        LCD_printfxy(0,0,"GyroNick:  %4i", FromFlightCtrl.GyroNick);
310
                        LCD_printfxy(0,0,"GyroNick:  %4i", FromFlightCtrl.GyroNick);
311
            LCD_printfxy(0,1,"GyroRoll:  %4i", FromFlightCtrl.GyroRoll);
311
            LCD_printfxy(0,1,"GyroRoll:  %4i", FromFlightCtrl.GyroRoll);
312
                        LCD_printfxy(0,2,"GyroYaw:   %4i", FromFlightCtrl.GyroYaw);
312
                        LCD_printfxy(0,2,"GyroYaw:   %4i", FromFlightCtrl.GyroYaw);
313
                        break;
313
                        break;
314
                case 13: // Remote Control Level from FC
314
                case 13: // Remote Control Level from FC
315
            LCD_printfxy(0,0,"RC-Level:    %3i", FC.RC_Quality);
315
            LCD_printfxy(0,0,"RC-Level:    %3i", FC.RC_Quality);
316
                        LCD_printfxy(0,1,"Ubat:        %2i.%1i V", FC.BAT_Voltage/10, FC.BAT_Voltage%10);
316
                        LCD_printfxy(0,1,"Ubat:        %2i.%1i V", FC.BAT_Voltage/10, FC.BAT_Voltage%10);
317
                        LCD_printfxy(0,2,"CompHeading: %3i", I2C_Heading.Heading);
317
                        LCD_printfxy(0,2,"CompHeading: %3i", I2C_Heading.Heading);
318
                        if(GeoMagDec < 0) sign = '-';
318
                        if(GeoMagDec < 0) sign = '-';
319
                        else sign = '+';
319
                        else sign = '+';
320
                        LCD_printfxy(0,3,"GeoMagDec:  %c%i.%1i", sign, abs(GeoMagDec)/10,abs(GeoMagDec)%10);
320
                        LCD_printfxy(0,3,"GeoMagDec:  %c%i.%1i", sign, abs(GeoMagDec)/10,abs(GeoMagDec)%10);
321
            break;
321
            break;
322
                case 14: // User Parameter
322
                case 14: // User Parameter
323
                        LCD_printfxy(0,0,"UP1:%3i  UP2:%3i",Parameter.User1,Parameter.User2);
323
                        LCD_printfxy(0,0,"UP1:%3i  UP2:%3i",Parameter.User1,Parameter.User2);
324
                        LCD_printfxy(0,1,"UP3:%3i  UP4:%3i",Parameter.User3,Parameter.User4);
324
                        LCD_printfxy(0,1,"UP3:%3i  UP4:%3i",Parameter.User3,Parameter.User4);
325
                        LCD_printfxy(0,2,"UP5:%3i  UP6:%3i",Parameter.User5,Parameter.User6);
325
                        LCD_printfxy(0,2,"UP5:%3i  UP6:%3i",Parameter.User5,Parameter.User6);
326
                        LCD_printfxy(0,3,"UP7:%3i  UP8:%3i",Parameter.User7,Parameter.User8);
326
                        LCD_printfxy(0,3,"UP7:%3i  UP8:%3i",Parameter.User7,Parameter.User8);
327
                        break;
327
                        break;
328
                case 15: // MK3MAG
328
                case 15: // MK3MAG
329
                        I2C1_SendCommand(I2C_CMD_READ_MAG);
329
                        I2C1_SendCommand(I2C_CMD_READ_MAG);
330
                        LCD_printfxy(0,0,"MK3MAG V%i.%i%c",MK3MAG_Version.Major, MK3MAG_Version.Minor, 'a'+ MK3MAG_Version.Patch);
330
                        LCD_printfxy(0,0,"MK3MAG V%i.%i%c",MK3MAG_Version.Major, MK3MAG_Version.Minor, 'a'+ MK3MAG_Version.Patch);
331
                        LCD_printfxy(0,1,"MagX: %4i ",I2C_Mag.MagX);
331
                        LCD_printfxy(0,1,"MagX: %4i ",I2C_Mag.MagX);
332
                        LCD_printfxy(0,2,"MagY: %4i ",I2C_Mag.MagY);
332
                        LCD_printfxy(0,2,"MagY: %4i ",I2C_Mag.MagY);
333
                        LCD_printfxy(0,3,"MagZ: %4i ",I2C_Mag.MagZ);
333
                        LCD_printfxy(0,3,"MagZ: %4i ",I2C_Mag.MagZ);
334
                        break;
334
                        break;
335
                default:
335
                default:
336
                        //MaxMenuItem = MenuItem - 1;
336
                        //MaxMenuItem = MenuItem - 1;
337
                        MenuItem = 0;
337
                        MenuItem = 0;
338
                        break;
338
                        break;
339
    }
339
    }
340
}
340
}
341
 
341