Rev 1775 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1775 | Rev 1796 | ||
---|---|---|---|
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 | - | ||
63 | #if (defined (USE_MK3MAG)) |
- | |
64 | #include "ubx.h" |
- | |
65 | #endif |
- | |
66 | 62 | ||
67 | #if (!defined (USE_MK3MAG)) |
63 | #if (!defined (USE_MK3MAG)) |
68 | uint8_t MaxMenuItem = 13; |
64 | uint8_t MaxMenuItem = 13; |
69 | #else |
65 | #else |
70 | #ifdef USE_MK3MAG |
66 | #ifdef USE_MK3MAG |
71 | uint8_t MaxMenuItem = 14; |
67 | uint8_t MaxMenuItem = 14; |
72 | #endif |
68 | #endif |
73 | #endif |
69 | #endif |
74 | uint8_t MenuItem = 0; |
70 | uint8_t MenuItem = 0; |
75 | uint8_t RemoteKeys = 0; |
71 | uint8_t RemoteKeys = 0; |
76 | 72 | ||
77 | #define KEY1 0x01 |
73 | #define KEY1 0x01 |
78 | #define KEY2 0x02 |
74 | #define KEY2 0x02 |
79 | #define KEY3 0x04 |
75 | #define KEY3 0x04 |
80 | #define KEY4 0x08 |
76 | #define KEY4 0x08 |
81 | #define KEY5 0x10 |
77 | #define KEY5 0x10 |
82 | 78 | ||
83 | #define DISPLAYBUFFSIZE 80 |
79 | #define DISPLAYBUFFSIZE 80 |
84 | int8_t DisplayBuff[DISPLAYBUFFSIZE] = "Hello World"; |
80 | int8_t DisplayBuff[DISPLAYBUFFSIZE] = "Hello World"; |
85 | uint8_t DispPtr = 0; |
81 | uint8_t DispPtr = 0; |
86 | 82 | ||
87 | 83 | ||
88 | /************************************/ |
84 | /************************************/ |
89 | /* Clear LCD Buffer */ |
85 | /* Clear LCD Buffer */ |
90 | /************************************/ |
86 | /************************************/ |
91 | void LCD_Clear(void) |
87 | void LCD_Clear(void) |
92 | { |
88 | { |
93 | uint8_t i; |
89 | uint8_t i; |
94 | for( i = 0; i < DISPLAYBUFFSIZE; i++) DisplayBuff[i] = ' '; |
90 | for( i = 0; i < DISPLAYBUFFSIZE; i++) DisplayBuff[i] = ' '; |
95 | } |
91 | } |
96 | 92 | ||
97 | 93 | ||
98 | /************************************/ |
94 | /************************************/ |
99 | /* Update Menu on LCD */ |
95 | /* Update Menu on LCD */ |
100 | /************************************/ |
96 | /************************************/ |
101 | // Display with 20 characters in 4 lines |
97 | // Display with 20 characters in 4 lines |
102 | void LCD_PrintMenu(void) { |
98 | void LCD_PrintMenu(void) { |
103 | if(RemoteKeys & KEY1) { |
99 | if(RemoteKeys & KEY1) { |
104 | if(MenuItem) MenuItem--; |
100 | if(MenuItem) MenuItem--; |
105 | else MenuItem = MaxMenuItem; |
101 | else MenuItem = MaxMenuItem; |
106 | } |
102 | } |
107 | 103 | ||
108 | if(RemoteKeys & KEY2) { |
104 | if(RemoteKeys & KEY2) { |
109 | if(MenuItem == MaxMenuItem) MenuItem = 0; |
105 | if(MenuItem == MaxMenuItem) MenuItem = 0; |
110 | else MenuItem++; |
106 | else MenuItem++; |
111 | } |
107 | } |
112 | if((RemoteKeys & KEY1) && (RemoteKeys & KEY2)) MenuItem = 0; |
108 | if((RemoteKeys & KEY1) && (RemoteKeys & KEY2)) MenuItem = 0; |
113 | 109 | ||
114 | LCD_Clear(); |
110 | LCD_Clear(); |
115 | 111 | ||
116 | if(MenuItem > MaxMenuItem) MenuItem = MaxMenuItem; |
112 | if(MenuItem > MaxMenuItem) MenuItem = MaxMenuItem; |
117 | // print menu item number in the upper right corner |
113 | // print menu item number in the upper right corner |
118 | if(MenuItem < 10) { |
114 | if(MenuItem < 10) { |
119 | LCD_printfxy(17,0,"[%i]",MenuItem); |
115 | LCD_printfxy(17,0,"[%i]",MenuItem); |
120 | } else { |
116 | } else { |
121 | LCD_printfxy(16,0,"[%i]",MenuItem); |
117 | LCD_printfxy(16,0,"[%i]",MenuItem); |
122 | } |
118 | } |
123 | 119 | ||
124 | switch(MenuItem) { |
120 | switch(MenuItem) { |
125 | case 0:// Version Info Menu Item |
121 | case 0:// Version Info Menu Item |
126 | LCD_printfxy(0,0,"+ MikroKopter +"); |
122 | LCD_printfxy(0,0,"+ MikroKopter +"); |
127 | LCD_printfxy(0,1,"HW:V%d.%d SW:%d.%d%c",BoardRelease/10,BoardRelease%10,VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH+'a'); |
123 | LCD_printfxy(0,1,"HW:V%d.%d SW:%d.%d%c",BoardRelease/10,BoardRelease%10,VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH+'a'); |
128 | LCD_printfxy(0,2,"Setting: %d %s", getActiveParamSet(), Mixer.Name); |
124 | LCD_printfxy(0,2,"Setting: %d %s", getActiveParamSet(), Mixer.Name); |
129 | if(I2CTimeout < 6) { |
125 | if(I2CTimeout < 6) { |
130 | LCD_printfxy(0,3,"I2C Error!!!"); |
126 | LCD_printfxy(0,3,"I2C Error!!!"); |
131 | } else if (missingMotor) { |
127 | } else if (missingMotor) { |
132 | LCD_printfxy(0,3,"Missing BL-Ctrl:%d", missingMotor); |
128 | LCD_printfxy(0,3,"Missing BL-Ctrl:%d", missingMotor); |
133 | } |
129 | } |
134 | else LCD_printfxy(0,3,"(c) Holger Buss"); |
130 | else LCD_printfxy(0,3,"(c) Holger Buss"); |
135 | break; |
131 | break; |
136 | /* |
132 | /* |
137 | case 1:// Height Control Menu Item |
133 | case 1:// Height Control Menu Item |
138 | if(staticParams.GlobalConfig & CFG_HEIGHT_CONTROL) { |
134 | if(staticParams.GlobalConfig & CFG_HEIGHT_CONTROL) { |
139 | LCD_printfxy(0,0,"Height: %5i",ReadingHeight); |
135 | LCD_printfxy(0,0,"Height: %5i",ReadingHeight); |
140 | LCD_printfxy(0,1,"Set Point: %5i",SetPointHeight); |
136 | LCD_printfxy(0,1,"Set Point: %5i",SetPointHeight); |
141 | LCD_printfxy(0,2,"Air Press.:%5i",0); |
137 | LCD_printfxy(0,2,"Air Press.:%5i",0); |
142 | LCD_printfxy(0,3,"Offset :%5i",0); |
138 | LCD_printfxy(0,3,"Offset :%5i",0); |
143 | } |
139 | } |
144 | else |
140 | else |
145 | { |
141 | { |
146 | LCD_printfxy(0,1,"No "); |
142 | LCD_printfxy(0,1,"No "); |
147 | LCD_printfxy(0,2,"Height Control"); |
143 | LCD_printfxy(0,2,"Height Control"); |
148 | } |
144 | } |
149 | break; |
145 | break; |
150 | */ |
146 | */ |
151 | case 2:// Attitude Menu Item |
147 | case 2:// Attitude Menu Item |
152 | LCD_printfxy(0,0,"Attitude"); |
148 | LCD_printfxy(0,0,"Attitude"); |
153 | LCD_printfxy(0,1,"Nick: %5i", angle[PITCH] / GYRO_DEG_FACTOR_PITCHROLL); |
149 | LCD_printfxy(0,1,"Nick: %5i", angle[PITCH] / GYRO_DEG_FACTOR_PITCHROLL); |
154 | LCD_printfxy(0,2,"Roll: %5i", angle[ROLL ] / GYRO_DEG_FACTOR_PITCHROLL); |
150 | LCD_printfxy(0,2,"Roll: %5i", angle[ROLL ] / GYRO_DEG_FACTOR_PITCHROLL); |
155 | LCD_printfxy(0,3,"Heading: %5i", compassHeading); |
151 | LCD_printfxy(0,3,"Heading: %5i", compassHeading); |
156 | break; |
152 | break; |
157 | case 3:// Remote Control Channel Menu Item |
153 | case 3:// Remote Control Channel Menu Item |
158 | LCD_printfxy(0,0,"C1:%4i C2:%4i ",PPM_in[1],PPM_in[2]); |
154 | LCD_printfxy(0,0,"C1:%4i C2:%4i ",PPM_in[1],PPM_in[2]); |
159 | LCD_printfxy(0,1,"C3:%4i C4:%4i ",PPM_in[3],PPM_in[4]); |
155 | LCD_printfxy(0,1,"C3:%4i C4:%4i ",PPM_in[3],PPM_in[4]); |
160 | LCD_printfxy(0,2,"C5:%4i C6:%4i ",PPM_in[5],PPM_in[6]); |
156 | LCD_printfxy(0,2,"C5:%4i C6:%4i ",PPM_in[5],PPM_in[6]); |
161 | LCD_printfxy(0,3,"C7:%4i C8:%4i ",PPM_in[7],PPM_in[8]); |
157 | LCD_printfxy(0,3,"C7:%4i C8:%4i ",PPM_in[7],PPM_in[8]); |
162 | break; |
158 | break; |
163 | case 4:// Remote Control Mapping Menu Item |
159 | case 4:// Remote Control Mapping Menu Item |
164 | LCD_printfxy(0,0,"Ni:%4i Ro:%4i ",PPM_in[staticParams.ChannelAssignment[CH_PITCH]],PPM_in[staticParams.ChannelAssignment[CH_ROLL]]); |
160 | LCD_printfxy(0,0,"Ni:%4i Ro:%4i ",PPM_in[staticParams.ChannelAssignment[CH_PITCH]],PPM_in[staticParams.ChannelAssignment[CH_ROLL]]); |
165 | LCD_printfxy(0,1,"Gs:%4i Ya:%4i ",PPM_in[staticParams.ChannelAssignment[CH_THROTTLE]],PPM_in[staticParams.ChannelAssignment[CH_YAW]]); |
161 | LCD_printfxy(0,1,"Gs:%4i Ya:%4i ",PPM_in[staticParams.ChannelAssignment[CH_THROTTLE]],PPM_in[staticParams.ChannelAssignment[CH_YAW]]); |
166 | LCD_printfxy(0,2,"P1:%4i P2:%4i ",PPM_in[staticParams.ChannelAssignment[CH_POTS]],PPM_in[staticParams.ChannelAssignment[CH_POTS+1]]); |
162 | LCD_printfxy(0,2,"P1:%4i P2:%4i ",PPM_in[staticParams.ChannelAssignment[CH_POTS]],PPM_in[staticParams.ChannelAssignment[CH_POTS+1]]); |
167 | LCD_printfxy(0,3,"P3:%4i P4:%4i ",PPM_in[staticParams.ChannelAssignment[CH_POTS+2]],PPM_in[staticParams.ChannelAssignment[CH_POTS+3]]); |
163 | LCD_printfxy(0,3,"P3:%4i P4:%4i ",PPM_in[staticParams.ChannelAssignment[CH_POTS+2]],PPM_in[staticParams.ChannelAssignment[CH_POTS+3]]); |
168 | break; |
164 | break; |
169 | /* |
165 | /* |
170 | case 5:// Gyro Sensor Menu Item |
166 | case 5:// Gyro Sensor Menu Item |
171 | LCD_printfxy(0,0,"Gyro - Sensor"); |
167 | LCD_printfxy(0,0,"Gyro - Sensor"); |
172 | switch(BoardRelease) { |
168 | switch(BoardRelease) { |
173 | case 10: |
169 | case 10: |
174 | LCD_printfxy(0,1,"Nick %4i (%3i.%i)", AdValueGyroNick - HiResNickOffset / HIRES_GYRO_AMPLIFY, HiResNickOffset / HIRES_GYRO_AMPLIFY, HiResNickOffset % HIRES_GYRO_AMPLIFY); |
170 | LCD_printfxy(0,1,"Nick %4i (%3i.%i)", AdValueGyroNick - HiResNickOffset / HIRES_GYRO_AMPLIFY, HiResNickOffset / HIRES_GYRO_AMPLIFY, HiResNickOffset % HIRES_GYRO_AMPLIFY); |
175 | LCD_printfxy(0,2,"Roll %4i (%3i.%i)", AdValueGyroRoll - HiResRollOffset / HIRES_GYRO_AMPLIFY, HiResRollOffset / HIRES_GYRO_AMPLIFY, HiResRollOffset % HIRES_GYRO_AMPLIFY); |
171 | LCD_printfxy(0,2,"Roll %4i (%3i.%i)", AdValueGyroRoll - HiResRollOffset / HIRES_GYRO_AMPLIFY, HiResRollOffset / HIRES_GYRO_AMPLIFY, HiResRollOffset % HIRES_GYRO_AMPLIFY); |
176 | LCD_printfxy(0,3,"Yaw %4i (%3i)", AdValueGyroYaw , YawOffset); |
172 | LCD_printfxy(0,3,"Yaw %4i (%3i)", AdValueGyroYaw , YawOffset); |
177 | break; |
173 | break; |
178 | case 11: |
174 | case 11: |
179 | case 12: |
175 | case 12: |
180 | case 20: // divice Offests by 2 becuse 2 samples are added in adc isr |
176 | case 20: // divice Offests by 2 becuse 2 samples are added in adc isr |
181 | LCD_printfxy(0,1,"Nick %4i (%3i.%i)",0, HiResNickOffset / (HIRES_GYRO_AMPLIFY * 2), (HiResNickOffset % (HIRES_GYRO_AMPLIFY * 2)) / 2); // division by 2 to push the reminder below 10 (15/2 = 7) |
177 | LCD_printfxy(0,1,"Nick %4i (%3i.%i)",0, HiResNickOffset / (HIRES_GYRO_AMPLIFY * 2), (HiResNickOffset % (HIRES_GYRO_AMPLIFY * 2)) / 2); // division by 2 to push the reminder below 10 (15/2 = 7) |
182 | LCD_printfxy(0,2,"Roll %4i (%3i.%i)",0, HiResRollOffset / (HIRES_GYRO_AMPLIFY * 2), (HiResRollOffset % (HIRES_GYRO_AMPLIFY * 2)) / 2); // division by 2 to push the reminder below 10 (15/2 = 7) |
178 | LCD_printfxy(0,2,"Roll %4i (%3i.%i)",0, HiResRollOffset / (HIRES_GYRO_AMPLIFY * 2), (HiResRollOffset % (HIRES_GYRO_AMPLIFY * 2)) / 2); // division by 2 to push the reminder below 10 (15/2 = 7) |
183 | LCD_printfxy(0,3,"Yaw %4i (%3i)",YawOffset - AdValueGyroYaw , YawOffset/2); |
179 | LCD_printfxy(0,3,"Yaw %4i (%3i)",YawOffset - AdValueGyroYaw , YawOffset/2); |
184 | break; |
180 | break; |
185 | |
181 | |
186 | case 13: |
182 | case 13: |
187 | default: // divice Offests by 2 becuse 2 samples are added in adc isr |
183 | default: // divice Offests by 2 becuse 2 samples are added in adc isr |
188 | LCD_printfxy(0,1,"Nick %4i (%3i.%i)(%3i)",0, HiResNickOffset / (HIRES_GYRO_AMPLIFY * 2), (HiResNickOffset % (HIRES_GYRO_AMPLIFY * 2))/2, 0); // division by 2 to push the reminder below 10 (15/2 = 7) |
184 | LCD_printfxy(0,1,"Nick %4i (%3i.%i)(%3i)",0, HiResNickOffset / (HIRES_GYRO_AMPLIFY * 2), (HiResNickOffset % (HIRES_GYRO_AMPLIFY * 2))/2, 0); // division by 2 to push the reminder below 10 (15/2 = 7) |
189 | LCD_printfxy(0,2,"Roll %4i (%3i.%i)(%3i)",0, HiResRollOffset / (HIRES_GYRO_AMPLIFY * 2), (HiResRollOffset % (HIRES_GYRO_AMPLIFY * 2))/2, 0); // division by 2 to push the reminder below 10 (15/2 = 7) |
185 | LCD_printfxy(0,2,"Roll %4i (%3i.%i)(%3i)",0, HiResRollOffset / (HIRES_GYRO_AMPLIFY * 2), (HiResRollOffset % (HIRES_GYRO_AMPLIFY * 2))/2, 0); // division by 2 to push the reminder below 10 (15/2 = 7) |
190 | LCD_printfxy(0,3,"Yaw %4i (%3i)(%3i)",YawOffset - AdValueGyroYaw , YawOffset/2, 0); |
186 | LCD_printfxy(0,3,"Yaw %4i (%3i)(%3i)",YawOffset - AdValueGyroYaw , YawOffset/2, 0); |
191 | break; |
187 | break; |
192 | } |
188 | } |
193 | break; |
189 | break; |
194 | case 6:// Acceleration Sensor Menu Item |
190 | case 6:// Acceleration Sensor Menu Item |
195 | LCD_printfxy(0,0,"ACC - Sensor"); |
191 | LCD_printfxy(0,0,"ACC - Sensor"); |
196 | LCD_printfxy(0,1,"Nick %4i (%3i)",0,0); // factor 2 because of adding 2 samples in ADC ISR |
192 | LCD_printfxy(0,1,"Nick %4i (%3i)",0,0); // factor 2 because of adding 2 samples in ADC ISR |
197 | LCD_printfxy(0,2,"Roll %4i (%3i)",0,0); // factor 2 because of adding 2 samples in ADC ISR |
193 | LCD_printfxy(0,2,"Roll %4i (%3i)",0,0); // factor 2 because of adding 2 samples in ADC ISR |
198 | LCD_printfxy(0,3,"Height %4i (%3i)",0,0); |
194 | LCD_printfxy(0,3,"Height %4i (%3i)",0,0); |
199 | break; |
195 | break; |
200 | */ |
196 | */ |
201 | case 7:// Battery Voltage / Remote Control Level |
197 | case 7:// Battery Voltage / Remote Control Level |
202 | LCD_printfxy(0,1,"Voltage: %3i.%1iV",UBat/10, UBat%10); |
198 | LCD_printfxy(0,1,"Voltage: %3i.%1iV",UBat/10, UBat%10); |
203 | LCD_printfxy(0,2,"RC-Level: %5i",RC_Quality); |
199 | LCD_printfxy(0,2,"RC-Level: %5i",RC_Quality); |
204 | break; |
200 | break; |
205 | case 8:// Compass Menu Item |
201 | case 8:// Compass Menu Item |
206 | LCD_printfxy(0,0,"Compass "); |
202 | LCD_printfxy(0,0,"Compass "); |
207 | LCD_printfxy(0,1,"Course: %5i", compassCourse); |
203 | LCD_printfxy(0,1,"Course: %5i", compassCourse); |
208 | LCD_printfxy(0,2,"Heading: %5i", compassHeading); |
204 | LCD_printfxy(0,2,"Heading: %5i", compassHeading); |
209 | LCD_printfxy(0,3,"OffCourse: %5i", compassOffCourse); |
205 | LCD_printfxy(0,3,"OffCourse: %5i", compassOffCourse); |
210 | break; |
206 | break; |
211 | case 9:// Poti Menu Item |
207 | case 9:// Poti Menu Item |
212 | LCD_printfxy(0,0,"Po1: %3i Po5: %3i" ,variables[0], variables[4]); //PPM24-Extesion |
208 | LCD_printfxy(0,0,"Po1: %3i Po5: %3i" ,variables[0], variables[4]); //PPM24-Extesion |
213 | LCD_printfxy(0,1,"Po2: %3i Po6: %3i" ,variables[1], variables[5]); //PPM24-Extesion |
209 | LCD_printfxy(0,1,"Po2: %3i Po6: %3i" ,variables[1], variables[5]); //PPM24-Extesion |
214 | LCD_printfxy(0,2,"Po3: %3i Po7: %3i" ,variables[2], variables[6]); //PPM24-Extesion |
210 | LCD_printfxy(0,2,"Po3: %3i Po7: %3i" ,variables[2], variables[6]); //PPM24-Extesion |
215 | LCD_printfxy(0,3,"Po4: %3i Po8: %3i" ,variables[3], variables[7]); //PPM24-Extesion |
211 | LCD_printfxy(0,3,"Po4: %3i Po8: %3i" ,variables[3], variables[7]); //PPM24-Extesion |
216 | break; |
212 | break; |
217 | /* |
213 | /* |
218 | case 10:// Servo Menu Item |
214 | case 10:// Servo Menu Item |
219 | LCD_printfxy(0,0,"Servo " ); |
215 | LCD_printfxy(0,0,"Servo " ); |
220 | LCD_printfxy(0,1,"Setpoint %3i",dynamicParams.ServoNickControl); |
216 | LCD_printfxy(0,1,"Setpoint %3i",dynamicParams.ServoNickControl); |
221 | LCD_printfxy(0,2,"Position: %3i",ServoNickValue); |
217 | LCD_printfxy(0,2,"Position: %3i",ServoNickValue); |
222 | LCD_printfxy(0,3,"Range:%3i-%3i",staticParams.ServoNickMin, staticParams.ServoNickMax); |
218 | LCD_printfxy(0,3,"Range:%3i-%3i",staticParams.ServoNickMin, staticParams.ServoNickMax); |
223 | break; |
219 | break; |
224 | */ |
220 | */ |
225 | case 11://Extern Control |
221 | case 11://Extern Control |
226 | LCD_printfxy(0,0,"ExternControl " ); |
222 | LCD_printfxy(0,0,"ExternControl " ); |
227 | LCD_printfxy(0,1,"Ni:%4i Ro:%4i ", externalControl.pitch, externalControl.roll); |
223 | LCD_printfxy(0,1,"Ni:%4i Ro:%4i ", externalControl.pitch, externalControl.roll); |
228 | LCD_printfxy(0,2,"Gs:%4i Ya:%4i ", externalControl.throttle, externalControl.yaw); |
224 | LCD_printfxy(0,2,"Gs:%4i Ya:%4i ", externalControl.throttle, externalControl.yaw); |
229 | LCD_printfxy(0,3,"Hi:%4i Cf:%4i ", externalControl.height, externalControl.config); |
225 | LCD_printfxy(0,3,"Hi:%4i Cf:%4i ", externalControl.height, externalControl.config); |
230 | break; |
226 | break; |
231 | 227 | ||
232 | case 12://BL Communication errors |
228 | case 12://BL Communication errors |
233 | LCD_printfxy(0,0,"BL-Ctrl Errors " ); |
229 | LCD_printfxy(0,0,"BL-Ctrl Errors " ); |
234 | LCD_printfxy(0,1," %3d %3d %3d %3d ",motor[0].Error,motor[1].Error,motor[2].Error,motor[3].Error); |
230 | LCD_printfxy(0,1," %3d %3d %3d %3d ",motor[0].Error,motor[1].Error,motor[2].Error,motor[3].Error); |
235 | LCD_printfxy(0,2," %3d %3d %3d %3d ",motor[4].Error,motor[5].Error,motor[6].Error,motor[7].Error); |
231 | LCD_printfxy(0,2," %3d %3d %3d %3d ",motor[4].Error,motor[5].Error,motor[6].Error,motor[7].Error); |
236 | LCD_printfxy(0,3," %3d %3d %3d %3d ",motor[8].Error,motor[9].Error,motor[10].Error,motor[11].Error); |
232 | LCD_printfxy(0,3," %3d %3d %3d %3d ",motor[8].Error,motor[9].Error,motor[10].Error,motor[11].Error); |
237 | break; |
233 | break; |
238 | 234 | ||
239 | case 13://BL Overview |
235 | case 13://BL Overview |
240 | LCD_printfxy(0,0,"BL-Ctrl found " ); |
236 | LCD_printfxy(0,0,"BL-Ctrl found " ); |
241 | LCD_printfxy(0,1," %c %c %c %c ",motor[0].Present + '-',motor[1].Present + '-',motor[2].Present + '-',motor[3].Present + '-'); |
237 | LCD_printfxy(0,1," %c %c %c %c ",motor[0].Present + '-',motor[1].Present + '-',motor[2].Present + '-',motor[3].Present + '-'); |
242 | LCD_printfxy(0,2," %c %c %c %c ",motor[4].Present + '-',motor[5].Present + '-',motor[6].Present + '-',motor[7].Present + '-'); |
238 | LCD_printfxy(0,2," %c %c %c %c ",motor[4].Present + '-',motor[5].Present + '-',motor[6].Present + '-',motor[7].Present + '-'); |
243 | LCD_printfxy(0,3," %c - - - ",motor[8].Present + '-'); |
239 | LCD_printfxy(0,3," %c - - - ",motor[8].Present + '-'); |
244 | if(motor[9].Present) LCD_printfxy(4,3,"10"); |
240 | if(motor[9].Present) LCD_printfxy(4,3,"10"); |
245 | if(motor[10].Present) LCD_printfxy(8,3,"11"); |
241 | if(motor[10].Present) LCD_printfxy(8,3,"11"); |
246 | if(motor[11].Present) LCD_printfxy(12,3,"12"); |
242 | if(motor[11].Present) LCD_printfxy(12,3,"12"); |
247 | break; |
243 | break; |
248 | 244 | ||
249 | #if (defined (USE_MK3MAG)) |
245 | #if (defined (USE_MK3MAG)) |
250 | case 14://GPS Lat/Lon coords |
246 | case 14://GPS Lat/Lon coords |
251 | if (GPSInfo.status == INVALID) { |
247 | if (GPSInfo.status == INVALID) { |
252 | LCD_printfxy(0,0,"No GPS data!"); |
248 | LCD_printfxy(0,0,"No GPS data!"); |
253 | } else { |
249 | } else { |
254 | switch (GPSInfo.satfix) |
250 | switch (GPSInfo.satfix) |
255 | { |
251 | { |
256 | case SATFIX_NONE: |
252 | case SATFIX_NONE: |
257 | LCD_printfxy(0,0,"Sats: %d Fix: No", GPSInfo.satnum); |
253 | LCD_printfxy(0,0,"Sats: %d Fix: No", GPSInfo.satnum); |
258 | break; |
254 | break; |
259 | case SATFIX_2D: |
255 | case SATFIX_2D: |
260 | LCD_printfxy(0,0,"Sats: %d Fix: 2D", GPSInfo.satnum); |
256 | LCD_printfxy(0,0,"Sats: %d Fix: 2D", GPSInfo.satnum); |
261 | break; |
257 | break; |
262 | case SATFIX_3D: |
258 | case SATFIX_3D: |
263 | LCD_printfxy(0,0,"Sats: %d Fix: 3D", GPSInfo.satnum); |
259 | LCD_printfxy(0,0,"Sats: %d Fix: 3D", GPSInfo.satnum); |
264 | break; |
260 | break; |
265 | default: |
261 | default: |
266 | LCD_printfxy(0,0,"Sats: %d Fix: ??", GPSInfo.satnum); |
262 | LCD_printfxy(0,0,"Sats: %d Fix: ??", GPSInfo.satnum); |
267 | break; |
263 | break; |
268 | } |
264 | } |
269 | int16_t i1,i2,i3; |
265 | int16_t i1,i2,i3; |
270 | i1 = (int16_t)(GPSInfo.longitude/10000000L); |
266 | i1 = (int16_t)(GPSInfo.longitude/10000000L); |
271 | i2 = abs((int16_t)((GPSInfo.longitude%10000000L)/10000L)); |
267 | i2 = abs((int16_t)((GPSInfo.longitude%10000000L)/10000L)); |
272 | i3 = abs((int16_t)(((GPSInfo.longitude%10000000L)%10000L)/10L)); |
268 | i3 = abs((int16_t)(((GPSInfo.longitude%10000000L)%10000L)/10L)); |
273 | LCD_printfxy(0,1,"Lon: %d.%03d%03d deg",i1, i2, i3); |
269 | LCD_printfxy(0,1,"Lon: %d.%03d%03d deg",i1, i2, i3); |
274 | i1 = (int16_t)(GPSInfo.latitude/10000000L); |
270 | i1 = (int16_t)(GPSInfo.latitude/10000000L); |
275 | i2 = abs((int16_t)((GPSInfo.latitude%10000000L)/10000L)); |
271 | i2 = abs((int16_t)((GPSInfo.latitude%10000000L)/10000L)); |
276 | i3 = abs((int16_t)(((GPSInfo.latitude%10000000L)%10000L)/10L)); |
272 | i3 = abs((int16_t)(((GPSInfo.latitude%10000000L)%10000L)/10L)); |
277 | LCD_printfxy(0,2,"Lat: %d.%03d%03d deg",i1, i2, i3); |
273 | LCD_printfxy(0,2,"Lat: %d.%03d%03d deg",i1, i2, i3); |
278 | i1 = (int16_t)(GPSInfo.altitude/1000L); |
274 | i1 = (int16_t)(GPSInfo.altitude/1000L); |
279 | i2 = abs((int16_t)(GPSInfo.altitude%1000L)); |
275 | i2 = abs((int16_t)(GPSInfo.altitude%1000L)); |
280 | LCD_printfxy(0,3,"Alt: %d.%03d m",i1, i2); |
276 | LCD_printfxy(0,3,"Alt: %d.%03d m",i1, i2); |
281 | } |
277 | } |
282 | break; |
278 | break; |
283 | #endif |
279 | #endif |
284 | 280 | ||
285 | default: |
281 | default: |
286 | MaxMenuItem = MenuItem - 1; |
282 | MaxMenuItem = MenuItem - 1; |
287 | MenuItem = 0; |
283 | MenuItem = 0; |
288 | break; |
284 | break; |
289 | } |
285 | } |
290 | RemoteKeys = 0; |
286 | RemoteKeys = 0; |
291 | } |
287 | } |
292 | 288 |