Subversion Repositories FlightCtrl

Rev

Rev 1179 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1179 Rev 1180
1
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2
// + Copyright (c) 04.2007 Holger Buss
2
// + Copyright (c) 04.2007 Holger Buss
3
// + only for non-profit use
3
// + Nur für den privaten Gebrauch
4
// + www.MikroKopter.com
4
// + www.MikroKopter.com
5
// + see the File "License.txt" for further Informations
-
 
6
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
 
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.
-
 
8
// + Sollten direkte oder indirekte kommerzielle Absichten verfolgt werden, ist mit uns (info@mikrokopter.de) Kontakt
-
 
9
// + bzgl. der Nutzungsbedingungen aufzunehmen.
-
 
10
// + Eine kommerzielle Nutzung ist z.B.Verkauf von MikroKoptern, Bestückung und Verkauf von Platinen oder Bausätzen,
-
 
11
// + Verkauf von Luftbildaufnahmen, usw.
7
 
-
 
-
 
12
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
 
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
-
 
15
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
 
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"
-
 
18
// + eindeutig als Ursprung verlinkt werden
-
 
19
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
 
20
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion
-
 
21
// + Benutzung auf eigene Gefahr
-
 
22
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden
-
 
23
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
 
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
-
 
26
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
 
27
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen
-
 
28
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
 
29
// + Redistributions of source code (with or without modifications) must retain the above copyright notice,
-
 
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
-
 
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
-
 
34
// +     for non-commercial use (directly or indirectly)
-
 
35
// +     Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted
-
 
36
// +     with our written permission
-
 
37
// +   * If sources or documentations are redistributet on other webpages, out webpage (http://www.MikroKopter.de) must be
-
 
38
// +     clearly linked as origin
-
 
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"
-
 
41
// +  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-
 
42
// +  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-
 
43
// +  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-
 
44
// +  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-
 
45
// +  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-
 
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)
-
 
48
// +  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-
 
49
// +  POSSIBILITY OF SUCH DAMAGE.
-
 
50
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
8
#include <stdlib.h>
51
#include <stdlib.h>
9
#include <inttypes.h>
52
#include <inttypes.h>
10
#include "main.h"
53
#include "main.h"
11
#include "eeprom.h"
54
#include "eeprom.h"
12
#include "timer2.h"
55
#include "timer2.h"
13
#include "fc.h"
56
#include "fc.h"
14
#include "rc.h"
57
#include "rc.h"
15
#include "uart.h"
58
#include "uart0.h"
16
#include "printf_P.h"
59
#include "printf_P.h"
17
#include "analog.h"
60
#include "analog.h"
18
 
61
 
19
#ifdef USE_KILLAGREG
62
#ifdef USE_KILLAGREG
20
#include "mm3.h"
63
#include "mm3.h"
21
#endif
64
#endif
22
 
65
 
23
#if (defined (USE_KILLAGREG) || defined (USE_MK3MAG))
66
#if (defined (USE_KILLAGREG) || defined (USE_MK3MAG))
24
#include "ubx.h"
67
#include "ubx.h"
25
#endif
68
#endif
26
 
-
 
27
#include "_Settings.h"
-
 
28
 
69
 
29
#if (!defined (USE_KILLAGREG) && !defined (USE_MK3MAG))
70
#if (!defined (USE_KILLAGREG) && !defined (USE_MK3MAG))
30
uint8_t MaxMenuItem = 11;
71
uint8_t MaxMenuItem = 11;
31
#else
72
#else
32
#ifdef USE_MK3MAG
73
#ifdef USE_MK3MAG
33
uint8_t MaxMenuItem = 12;
74
uint8_t MaxMenuItem = 12;
34
#endif
75
#endif
35
 
76
 
36
#ifdef USE_KILLAGREG
77
#ifdef USE_KILLAGREG
37
uint8_t MaxMenuItem = 14;
78
uint8_t MaxMenuItem = 14;
38
#endif
79
#endif
39
#endif
80
#endif
40
uint8_t MenuItem = 0;
81
uint8_t MenuItem = 0;
41
uint8_t RemoteKeys = 0;
82
uint8_t RemoteKeys = 0;
42
 
83
 
43
#define KEY1    0x01
84
#define KEY1    0x01
44
#define KEY2    0x02
85
#define KEY2    0x02
45
#define KEY3    0x04
86
#define KEY3    0x04
46
#define KEY4    0x08
87
#define KEY4    0x08
47
#define KEY5    0x10
88
#define KEY5    0x10
48
 
89
 
49
 
90
 
50
 
91
 
51
#define DISPLAYBUFFSIZE 80
92
#define DISPLAYBUFFSIZE 80
52
int8_t DisplayBuff[DISPLAYBUFFSIZE] = "Hello World";
93
int8_t DisplayBuff[DISPLAYBUFFSIZE] = "Hello World";
53
uint8_t DispPtr = 0;
94
uint8_t DispPtr = 0;
54
 
95
 
55
 
96
 
56
/************************************/
97
/************************************/
57
/*        Clear LCD Buffer          */
98
/*        Clear LCD Buffer          */
58
/************************************/
99
/************************************/
59
void LCD_Clear(void)
100
void LCD_Clear(void)
60
{
101
{
61
 uint8_t i;
102
 uint8_t i;
62
 for( i = 0; i < DISPLAYBUFFSIZE; i++) DisplayBuff[i] = ' ';
103
 for( i = 0; i < DISPLAYBUFFSIZE; i++) DisplayBuff[i] = ' ';
63
}
104
}
64
 
105
 
65
 
106
 
66
/************************************/
107
/************************************/
67
/*        Update Menu on LCD        */
108
/*        Update Menu on LCD        */
68
/************************************/
109
/************************************/
69
// Display with 20 characters in 4 lines
110
// Display with 20 characters in 4 lines
70
void LCD_PrintMenu(void)
111
void LCD_PrintMenu(void)
71
{
112
{
72
        if(RemoteKeys & KEY1)
113
        if(RemoteKeys & KEY1)
73
        {
114
        {
74
                if(MenuItem) MenuItem--;
115
                if(MenuItem) MenuItem--;
75
                else MenuItem = MaxMenuItem;
116
                else MenuItem = MaxMenuItem;
76
        }
117
        }
77
        if(RemoteKeys  & KEY2)
118
        if(RemoteKeys  & KEY2)
78
        {
119
        {
79
                if(MenuItem == MaxMenuItem) MenuItem = 0;
120
                if(MenuItem == MaxMenuItem) MenuItem = 0;
80
                else MenuItem++;
121
                else MenuItem++;
81
        }
122
        }
82
        if((RemoteKeys  & KEY1) && (RemoteKeys  & KEY2)) MenuItem = 0;
123
        if((RemoteKeys  & KEY1) && (RemoteKeys  & KEY2)) MenuItem = 0;
83
 
124
 
84
        LCD_Clear();
125
        LCD_Clear();
85
 
126
 
86
        if(MenuItem > MaxMenuItem) MenuItem = MaxMenuItem;
127
        if(MenuItem > MaxMenuItem) MenuItem = MaxMenuItem;
87
        // print menu item number in the upper right corner
128
        // print menu item number in the upper right corner
88
        if(MenuItem < 10)
129
        if(MenuItem < 10)
89
        {
130
        {
90
          LCD_printfxy(17,0,"[%i]",MenuItem);
131
          LCD_printfxy(17,0,"[%i]",MenuItem);
91
        }
132
        }
92
        else
133
        else
93
        {
134
        {
94
          LCD_printfxy(16,0,"[%i]",MenuItem);
135
          LCD_printfxy(16,0,"[%i]",MenuItem);
95
        }
136
        }
96
 
137
 
97
        switch(MenuItem)
138
        switch(MenuItem)
98
        {
139
        {
99
    case 0:// Version Info Menu Item
140
    case 0:// Version Info Menu Item
100
           LCD_printfxy(0,0,"+ MikroKopter +");
141
           LCD_printfxy(0,0,"+ MikroKopter +");
101
           LCD_printfxy(0,1,"HW:V%d.%d SW:%d.%d%c",BoardRelease/10,BoardRelease%10,VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH+'a');
142
           LCD_printfxy(0,1,"HW:V%d.%d SW:%d.%d%c",BoardRelease/10,BoardRelease%10,VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH+'a');
-
 
143
           #ifndef USE_QUADRO
-
 
144
                   LCD_printfxy(0,2,"OCTO    Setting: %d ", GetActiveParamSet());
-
 
145
           #else
102
           LCD_printfxy(0,2,"Setting: %d ", GetActiveParamSet());
146
           LCD_printfxy(0,2,"QUADRO  Setting: %d ", GetActiveParamSet());
-
 
147
           #endif
103
           LCD_printfxy(0,3,"(c) Holger Buss");
148
           LCD_printfxy(0,3,"(c) Holger Buss");
104
           break;
149
           break;
105
    case 1:// Height Control Menu Item
150
    case 1:// Height Control Menu Item
106
          if(ParamSet.GlobalConfig & CFG_HEIGHT_CONTROL)
151
          if(ParamSet.GlobalConfig & CFG_HEIGHT_CONTROL)
107
           {
152
           {
108
           LCD_printfxy(0,0,"Height:    %5i",ReadingHeight);
153
           LCD_printfxy(0,0,"Height:    %5i",ReadingHeight);
109
           LCD_printfxy(0,1,"Set Point: %5i",SetPointHeight);
154
           LCD_printfxy(0,1,"Set Point: %5i",SetPointHeight);
110
           LCD_printfxy(0,2,"Air Press.:%5i",ReadingAirPressure);
155
           LCD_printfxy(0,2,"Air Press.:%5i",ReadingAirPressure);
111
           LCD_printfxy(0,3,"Offset    :%5i",PressureSensorOffset);
156
           LCD_printfxy(0,3,"Offset    :%5i",PressureSensorOffset);
112
           }
157
           }
113
           else
158
           else
114
           {
159
           {
115
           LCD_printfxy(0,1,"No ");
160
           LCD_printfxy(0,1,"No ");
116
           LCD_printfxy(0,2,"Height Control");
161
           LCD_printfxy(0,2,"Height Control");
117
           }
162
           }
118
 
163
 
119
           break;
164
           break;
120
    case 2:// Attitude Menu Item
165
    case 2:// Attitude Menu Item
121
           LCD_printfxy(0,0,"Attitude");
166
           LCD_printfxy(0,0,"Attitude");
122
           LCD_printfxy(0,1,"Nick:      %5i",IntegralNick/1024);
167
           LCD_printfxy(0,1,"Nick:      %5i",IntegralGyroNick/1024);
123
           LCD_printfxy(0,2,"Roll:      %5i",IntegralRoll/1024);
168
           LCD_printfxy(0,2,"Roll:      %5i",IntegralGyroRoll/1024);
124
           LCD_printfxy(0,3,"Heading:   %5i",CompassHeading);
169
           LCD_printfxy(0,3,"Heading:   %5i",CompassHeading);
125
           break;
170
           break;
126
    case 3:// Remote Control Channel Menu Item
171
    case 3:// Remote Control Channel Menu Item
127
           LCD_printfxy(0,0,"C1:%4i  C2:%4i ",PPM_in[1],PPM_in[2]);
172
           LCD_printfxy(0,0,"C1:%4i  C2:%4i ",PPM_in[1],PPM_in[2]);
128
           LCD_printfxy(0,1,"C3:%4i  C4:%4i ",PPM_in[3],PPM_in[4]);
173
           LCD_printfxy(0,1,"C3:%4i  C4:%4i ",PPM_in[3],PPM_in[4]);
129
           LCD_printfxy(0,2,"C5:%4i  C6:%4i ",PPM_in[5],PPM_in[6]);
174
           LCD_printfxy(0,2,"C5:%4i  C6:%4i ",PPM_in[5],PPM_in[6]);
130
           LCD_printfxy(0,3,"C7:%4i  C8:%4i ",PPM_in[7],PPM_in[8]);
175
           LCD_printfxy(0,3,"C7:%4i  C8:%4i ",PPM_in[7],PPM_in[8]);
131
           break;
176
           break;
132
    case 4:// Remote Control Mapping Menu Item
177
    case 4:// Remote Control Mapping Menu Item
133
           LCD_printfxy(0,0,"Ni:%4i  Ro:%4i ",PPM_in[ParamSet.ChannelAssignment[CH_NICK]],PPM_in[ParamSet.ChannelAssignment[CH_ROLL]]);
178
           LCD_printfxy(0,0,"Ni:%4i  Ro:%4i ",PPM_in[ParamSet.ChannelAssignment[CH_NICK]],PPM_in[ParamSet.ChannelAssignment[CH_ROLL]]);
134
           LCD_printfxy(0,1,"Gs:%4i  Ya:%4i ",PPM_in[ParamSet.ChannelAssignment[CH_GAS]],PPM_in[ParamSet.ChannelAssignment[CH_YAW]]);
179
           LCD_printfxy(0,1,"Gs:%4i  Ya:%4i ",PPM_in[ParamSet.ChannelAssignment[CH_GAS]],PPM_in[ParamSet.ChannelAssignment[CH_YAW]]);
135
           LCD_printfxy(0,2,"P1:%4i  P2:%4i ",PPM_in[ParamSet.ChannelAssignment[CH_POTI1]],PPM_in[ParamSet.ChannelAssignment[CH_POTI2]]);
180
           LCD_printfxy(0,2,"P1:%4i  P2:%4i ",PPM_in[ParamSet.ChannelAssignment[CH_POTI1]],PPM_in[ParamSet.ChannelAssignment[CH_POTI2]]);
136
           LCD_printfxy(0,3,"P3:%4i  P4:%4i ",PPM_in[ParamSet.ChannelAssignment[CH_POTI3]],PPM_in[ParamSet.ChannelAssignment[CH_POTI4]]);
181
           LCD_printfxy(0,3,"P3:%4i  P4:%4i ",PPM_in[ParamSet.ChannelAssignment[CH_POTI3]],PPM_in[ParamSet.ChannelAssignment[CH_POTI4]]);
137
           break;
182
           break;
138
        case 5:// Gyro Sensor Menu Item
183
        case 5:// Gyro Sensor Menu Item
139
           LCD_printfxy(0,0,"Gyro - Sensor");
184
           LCD_printfxy(0,0,"Gyro - Sensor");
140
           switch(BoardRelease)
185
           switch(BoardRelease)
141
           {
186
           {
142
                        case 10:
187
                        case 10:
143
                           LCD_printfxy(0,1,"Nick %4i (%3i)",AdValueGyrNick - AdNeutralNick, AdNeutralNick);
188
                           LCD_printfxy(0,1,"Nick %4i (%3i.%i)",AdValueGyroNick - BiasHiResGyroNick / HIRES_GYRO_AMPLIFY, BiasHiResGyroNick / HIRES_GYRO_AMPLIFY, BiasHiResGyroNick % HIRES_GYRO_AMPLIFY);
144
                           LCD_printfxy(0,2,"Roll %4i (%3i)",AdValueGyrRoll - AdNeutralRoll, AdNeutralRoll);
189
                           LCD_printfxy(0,2,"Roll %4i (%3i.%i)",AdValueGyroRoll - BiasHiResGyroRoll / HIRES_GYRO_AMPLIFY, BiasHiResGyroRoll / HIRES_GYRO_AMPLIFY, BiasHiResGyroRoll % HIRES_GYRO_AMPLIFY);
145
                           LCD_printfxy(0,3,"Yaw  %4i (%3i)",AdNeutralYaw  - AdValueGyrYaw , AdNeutralYaw);
190
                           LCD_printfxy(0,3,"Yaw  %4i (%3i)",AdBiasGyroYaw  - AdValueGyroYaw , AdBiasGyroYaw);
146
                           break;
191
                           break;
147
 
192
 
148
                        case 11:
193
                        case 11:
149
                        case 12:
194
                        case 12:
150
                        case 20:
195
                        case 20: // divice Offests by 2 becuse 2 samples are added in adc isr
151
                           LCD_printfxy(0,1,"Nick %4i (%3i)",AdValueGyrNick - AdNeutralNick, AdNeutralNick/2);
196
                           LCD_printfxy(0,1,"Nick %4i (%3i.%i)",AdValueGyroNick - BiasHiResGyroNick/HIRES_GYRO_AMPLIFY, BiasHiResGyroNick / (HIRES_GYRO_AMPLIFY * 2), (BiasHiResGyroNick % (HIRES_GYRO_AMPLIFY * 2)) / 2); // division by 2 to push the reminder below 10 (15/2 = 7)
152
                           LCD_printfxy(0,2,"Roll %4i (%3i)",AdValueGyrRoll - AdNeutralRoll, AdNeutralRoll/2);
197
                           LCD_printfxy(0,2,"Roll %4i (%3i.%i)",AdValueGyroRoll - BiasHiResGyroRoll/HIRES_GYRO_AMPLIFY, BiasHiResGyroRoll / (HIRES_GYRO_AMPLIFY * 2), (BiasHiResGyroRoll % (HIRES_GYRO_AMPLIFY * 2)) / 2); // division by 2 to push the reminder below 10 (15/2 = 7)
153
                           LCD_printfxy(0,3,"Yaw  %4i (%3i)",AdNeutralYaw  - AdValueGyrYaw , AdNeutralYaw/2);
198
                           LCD_printfxy(0,3,"Yaw  %4i (%3i)",AdBiasGyroYaw  - AdValueGyroYaw , AdBiasGyroYaw/2);
154
                           break;
199
                           break;
155
 
200
 
156
                        case 13:
201
                        case 13:
157
                        default:
202
                        default: // divice Offests by 2 becuse 2 samples are added in adc isr
158
                           LCD_printfxy(0,1,"Nick %4i (%3i)(%3i)",AdValueGyrNick - AdNeutralNick, AdNeutralNick/2, AnalogOffsetNick);
203
                           LCD_printfxy(0,1,"Nick %4i (%3i.%i)(%3i)",AdValueGyroNick - BiasHiResGyroNick/HIRES_GYRO_AMPLIFY, BiasHiResGyroNick / (HIRES_GYRO_AMPLIFY * 2), (BiasHiResGyroNick % (HIRES_GYRO_AMPLIFY * 2))/2, DacOffsetGyroNick); // division by 2 to push the reminder below 10 (15/2 = 7)
159
                           LCD_printfxy(0,2,"Roll %4i (%3i)(%3i)",AdValueGyrRoll - AdNeutralRoll, AdNeutralRoll/2, AnalogOffsetRoll);
204
                           LCD_printfxy(0,2,"Roll %4i (%3i.%i)(%3i)",AdValueGyroRoll - BiasHiResGyroRoll/HIRES_GYRO_AMPLIFY, BiasHiResGyroRoll / (HIRES_GYRO_AMPLIFY * 2), (BiasHiResGyroRoll % (HIRES_GYRO_AMPLIFY * 2))/2, DacOffsetGyroRoll); // division by 2 to push the reminder below 10 (15/2 = 7)
160
                           LCD_printfxy(0,3,"Yaw  %4i (%3i)(%3i)",AdNeutralYaw  - AdValueGyrYaw , AdNeutralYaw/2 , AnalogOffsetYaw );
205
                           LCD_printfxy(0,3,"Yaw  %4i (%3i)(%3i)",AdBiasGyroYaw  - AdValueGyroYaw , AdBiasGyroYaw/2, DacOffsetGyroYaw );
161
                           break;
206
                           break;
162
          }
207
          }
163
          break;
208
          break;
164
    case 6:// Acceleration Sensor Menu Item
209
    case 6:// Acceleration Sensor Menu Item
165
           LCD_printfxy(0,0,"ACC - Sensor");
210
           LCD_printfxy(0,0,"ACC - Sensor");
166
           LCD_printfxy(0,1,"Nick   %4i (%3i)",AdValueAccNick, NeutralAccX);
211
           LCD_printfxy(0,1,"Nick   %4i (%3i)",AdValueAccNick/2, AdBiasAccNick/2); // factor 2 because of adding 2 samples in ADC ISR
167
           LCD_printfxy(0,2,"Roll   %4i (%3i)",AdValueAccRoll, NeutralAccY);
212
           LCD_printfxy(0,2,"Roll   %4i (%3i)",AdValueAccRoll/2, AdBiasAccRoll/2); // factor 2 because of adding 2 samples in ADC ISR
168
           LCD_printfxy(0,3,"Height %4i (%3i)",Mean_AccTop, (int)NeutralAccZ);
213
           LCD_printfxy(0,3,"Height %4i (%3i)",AdValueAccTop, (int16_t)AdBiasAccTop);
169
           break;
214
           break;
170
    case 7:// Accumulator Voltage / Remote Control Level
215
    case 7:// Accumulator Voltage / Remote Control Level
171
           LCD_printfxy(0,1,"Voltage:  %5i",UBat);
216
           LCD_printfxy(0,1,"Voltage:  %3i.%1iV",UBat/10, UBat%10);
172
           LCD_printfxy(0,2,"RC-Level: %5i",RC_Quality);
217
           LCD_printfxy(0,2,"RC-Level: %5i",RC_Quality);
173
           break;
218
           break;
174
    case 8:// Compass Menu Item
219
    case 8:// Compass Menu Item
175
           LCD_printfxy(0,0,"Compass       ");
220
           LCD_printfxy(0,0,"Compass       ");
176
           LCD_printfxy(0,1,"Course:    %5i",CompassCourse);
221
           LCD_printfxy(0,1,"Course:    %5i",CompassCourse);
177
           LCD_printfxy(0,2,"Heading:   %5i",CompassHeading);
222
           LCD_printfxy(0,2,"Heading:   %5i",CompassHeading);
178
           LCD_printfxy(0,3,"OffCourse: %5i",CompassOffCourse);
223
           LCD_printfxy(0,3,"OffCourse: %5i",CompassOffCourse);
179
           break;
224
           break;
180
    case 9:// Poti Menu Item
225
    case 9:// Poti Menu Item
181
                   LCD_printfxy(0,0,"Po1: %3i Po5: %3i" ,Poti1,Poti5); //PPM24-Extesion
226
                   LCD_printfxy(0,0,"Po1: %3i Po5: %3i" ,Poti1,Poti5); //PPM24-Extesion
182
                   LCD_printfxy(0,1,"Po2: %3i Po6: %3i" ,Poti2,Poti6); //PPM24-Extesion
227
                   LCD_printfxy(0,1,"Po2: %3i Po6: %3i" ,Poti2,Poti6); //PPM24-Extesion
183
                   LCD_printfxy(0,2,"Po3: %3i Po7: %3i" ,Poti3,Poti7); //PPM24-Extesion
228
                   LCD_printfxy(0,2,"Po3: %3i Po7: %3i" ,Poti3,Poti7); //PPM24-Extesion
184
                   LCD_printfxy(0,3,"Po4: %3i Po8: %3i" ,Poti4,Poti8); //PPM24-Extesion
229
                   LCD_printfxy(0,3,"Po4: %3i Po8: %3i" ,Poti4,Poti8); //PPM24-Extesion
185
           break;
230
           break;
186
    case 10:// Servo Menu Item
231
    case 10:// Servo Menu Item
187
           LCD_printfxy(0,0,"Servo  " );
232
           LCD_printfxy(0,0,"Servo  " );
188
           LCD_printfxy(0,1,"Setpoint  %3i",FCParam.ServoNickControl);
233
           LCD_printfxy(0,1,"Setpoint  %3i",FCParam.ServoNickControl);
189
           LCD_printfxy(0,2,"Position: %3i",ServoValue);
234
           LCD_printfxy(0,2,"Position: %3i",ServoNickValue);
190
           LCD_printfxy(0,3,"Range:%3i-%3i",ParamSet.ServoNickMin, ParamSet.ServoNickMax);
235
           LCD_printfxy(0,3,"Range:%3i-%3i",ParamSet.ServoNickMin, ParamSet.ServoNickMax);
191
           break;
236
           break;
192
    case 11://Extern Control
237
    case 11://Extern Control
193
           LCD_printfxy(0,0,"ExternControl  " );
238
           LCD_printfxy(0,0,"ExternControl  " );
194
           LCD_printfxy(0,1,"Ni:%4i  Ro:%4i ",ExternControl.Nick, ExternControl.Roll);
239
           LCD_printfxy(0,1,"Ni:%4i  Ro:%4i ",ExternControl.Nick, ExternControl.Roll);
195
           LCD_printfxy(0,2,"Gs:%4i  Ya:%4i ",ExternControl.Gas, ExternControl.Yaw);
240
           LCD_printfxy(0,2,"Gs:%4i  Ya:%4i ",ExternControl.Gas, ExternControl.Yaw);
196
           LCD_printfxy(0,3,"Hi:%4i  Cf:%4i ",ExternControl.Height, ExternControl.Config);
241
           LCD_printfxy(0,3,"Hi:%4i  Cf:%4i ",ExternControl.Height, ExternControl.Config);
197
           break;
242
           break;
198
 
243
 
199
    #if (defined (USE_KILLAGREG) || defined (USE_MK3MAG))
244
    #if (defined (USE_KILLAGREG) || defined (USE_MK3MAG))
200
        case 12://GPS Lat/Lon coords
245
        case 12://GPS Lat/Lon coords
201
                        if (GPSInfo.status == INVALID)
246
                        if (GPSInfo.status == INVALID)
202
                        {
247
                        {
203
                                LCD_printfxy(0,0,"No GPS data!");
248
                                LCD_printfxy(0,0,"No GPS data!");
204
                        }
249
                        }
205
                        else
250
                        else
206
                        {
251
                        {
207
                                switch (GPSInfo.satfix)
252
                                switch (GPSInfo.satfix)
208
                                {
253
                                {
209
                                case SATFIX_NONE:
254
                                case SATFIX_NONE:
210
                                        LCD_printfxy(0,0,"Sats: %d Fix: No", GPSInfo.satnum);
255
                                        LCD_printfxy(0,0,"Sats: %d Fix: No", GPSInfo.satnum);
211
                                        break;
256
                                        break;
212
                                case SATFIX_2D:
257
                                case SATFIX_2D:
213
                                        LCD_printfxy(0,0,"Sats: %d Fix: 2D", GPSInfo.satnum);
258
                                        LCD_printfxy(0,0,"Sats: %d Fix: 2D", GPSInfo.satnum);
214
                                        break;
259
                                        break;
215
                                case SATFIX_3D:
260
                                case SATFIX_3D:
216
                                        LCD_printfxy(0,0,"Sats: %d Fix: 3D", GPSInfo.satnum);
261
                                        LCD_printfxy(0,0,"Sats: %d Fix: 3D", GPSInfo.satnum);
217
                                        break;
262
                                        break;
218
                                default:
263
                                default:
219
                                        LCD_printfxy(0,0,"Sats: %d Fix: ??", GPSInfo.satnum);
264
                                        LCD_printfxy(0,0,"Sats: %d Fix: ??", GPSInfo.satnum);
220
                                        break;
265
                                        break;
221
                                }
266
                                }
222
                                int16_t i1,i2,i3;
267
                                int16_t i1,i2,i3;
223
                                i1 = (int16_t)(GPSInfo.longitude/10000000L);
268
                                i1 = (int16_t)(GPSInfo.longitude/10000000L);
224
                                i2 = abs((int16_t)((GPSInfo.longitude%10000000L)/10000L));
269
                                i2 = abs((int16_t)((GPSInfo.longitude%10000000L)/10000L));
225
                                i3 = abs((int16_t)(((GPSInfo.longitude%10000000L)%10000L)/10L));
270
                                i3 = abs((int16_t)(((GPSInfo.longitude%10000000L)%10000L)/10L));
226
                                LCD_printfxy(0,1,"Lon: %d.%.3d%.3d deg",i1, i2, i3);
271
                                LCD_printfxy(0,1,"Lon: %d.%.3d%.3d deg",i1, i2, i3);
227
                                i1 = (int16_t)(GPSInfo.latitude/10000000L);
272
                                i1 = (int16_t)(GPSInfo.latitude/10000000L);
228
                                i2 = abs((int16_t)((GPSInfo.latitude%10000000L)/10000L));
273
                                i2 = abs((int16_t)((GPSInfo.latitude%10000000L)/10000L));
229
                                i3 = abs((int16_t)(((GPSInfo.latitude%10000000L)%10000L)/10L));
274
                                i3 = abs((int16_t)(((GPSInfo.latitude%10000000L)%10000L)/10L));
230
                                LCD_printfxy(0,2,"Lat: %d.%.3d%.3d deg",i1, i2, i3);
275
                                LCD_printfxy(0,2,"Lat: %d.%.3d%.3d deg",i1, i2, i3);
231
                                i1 = (int16_t)(GPSInfo.altitude/1000L);
276
                                i1 = (int16_t)(GPSInfo.altitude/1000L);
232
                                i2 = abs((int16_t)(GPSInfo.altitude%1000L));
277
                                i2 = abs((int16_t)(GPSInfo.altitude%1000L));
233
                                LCD_printfxy(0,3,"Alt: %d.%.3d m",i1, i2);
278
                                LCD_printfxy(0,3,"Alt: %d.%.3d m",i1, i2);
234
                        }
279
                        }
235
                        break;
280
                        break;
236
        #endif
281
        #endif
237
        #ifdef USE_KILLAGREG
282
        #ifdef USE_KILLAGREG
238
        case 13:// MM3 Kompass
283
        case 13:// MM3 Kompass
239
                        LCD_printfxy(0,0,"MM3 Offset");
284
                        LCD_printfxy(0,0,"MM3 Offset");
240
                        LCD_printfxy(0,1,"X_Offset:  %3i",MM3_calib.X_off);
285
                        LCD_printfxy(0,1,"X_Offset:  %3i",MM3_calib.X_off);
241
                        LCD_printfxy(0,2,"Y_Offset:  %3i",MM3_calib.Y_off);
286
                        LCD_printfxy(0,2,"Y_Offset:  %3i",MM3_calib.Y_off);
242
                        LCD_printfxy(0,3,"Z_Offset:  %3i",MM3_calib.Z_off);
287
                        LCD_printfxy(0,3,"Z_Offset:  %3i",MM3_calib.Z_off);
243
                        break;
288
                        break;
244
        case 14://MM3 Range
289
        case 14://MM3 Range
245
                        LCD_printfxy(0,0,"MM3 Range");
290
                        LCD_printfxy(0,0,"MM3 Range");
246
                        LCD_printfxy(0,1,"X_Range:  %4i",MM3_calib.X_range);
291
                        LCD_printfxy(0,1,"X_Range:  %4i",MM3_calib.X_range);
247
                        LCD_printfxy(0,2,"Y_Range:  %4i",MM3_calib.Y_range);
292
                        LCD_printfxy(0,2,"Y_Range:  %4i",MM3_calib.Y_range);
248
                        LCD_printfxy(0,3,"Z_Range:  %4i",MM3_calib.Z_range);
293
                        LCD_printfxy(0,3,"Z_Range:  %4i",MM3_calib.Z_range);
249
                        break;
294
                        break;
250
        #endif
295
        #endif
251
 
296
 
252
    default: MaxMenuItem = MenuItem - 1;
297
    default: MaxMenuItem = MenuItem - 1;
253
             MenuItem = 0;
298
             MenuItem = 0;
254
           break;
299
           break;
255
    }
300
    }
256
    RemoteKeys = 0;
301
    RemoteKeys = 0;
257
}
302
}
258
 
303