Subversion Repositories FlightCtrl

Rev

Rev 1077 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1077 Rev 1078
Line 13... Line 13...
13
#include "fc.h"
13
#include "fc.h"
14
#include "rc.h"
14
#include "rc.h"
15
#include "uart.h"
15
#include "uart.h"
16
#include "printf_P.h"
16
#include "printf_P.h"
17
#include "analog.h"
17
#include "analog.h"
-
 
18
 
18
#ifdef USE_KILLAGREG
19
#ifdef USE_KILLAGREG
19
#include "mm3.h"
20
#include "mm3.h"
20
#endif
21
#endif
-
 
22
 
21
#if (defined (USE_KILLAGREG) || defined (USE_MK3MAG))
23
#if (defined (USE_KILLAGREG) || defined (USE_MK3MAG))
22
#include "ubx.h"
24
#include "ubx.h"
23
#endif
25
#endif
-
 
26
 
24
#include "_Settings.h"
27
#include "_Settings.h"
Line -... Line 28...
-
 
28
 
-
 
29
#if (!defined (USE_KILLAGREG) && !defined (USE_MK3MAG))
-
 
30
uint8_t MaxMenuItem = 11;
-
 
31
#else
-
 
32
#ifdef USE_MK3MAG
-
 
33
uint8_t MaxMenuItem = 12;
Line 25... Line 34...
25
 
34
#endif
26
 
35
 
27
#define ARRAYSIZE 10
36
#ifdef USE_KILLAGREG
28
uint8_t Array[ARRAYSIZE] = {1,2,3,4,5,6,7,8,9,10};
-
 
-
 
37
uint8_t MaxMenuItem = 14;
29
#define DISPLAYBUFFSIZE 80
38
#endif
30
int8_t DisplayBuff[DISPLAYBUFFSIZE] = "Hello World";
39
#endif
Line 31... Line 40...
31
uint8_t DispPtr = 0;
40
uint8_t MenuItem = 0;
32
uint8_t RemoteButtons = 0;
41
uint8_t RemoteKeys = 0;
33
 
42
 
34
#define KEY1    0x01
43
#define KEY1    0x01
35
#define KEY2    0x02
44
#define KEY2    0x02
Line -... Line 45...
-
 
45
#define KEY3    0x04
-
 
46
#define KEY4    0x08
-
 
47
#define KEY5    0x10
-
 
48
 
-
 
49
 
-
 
50
 
-
 
51
#define DISPLAYBUFFSIZE 80
36
#define KEY3    0x04
52
int8_t DisplayBuff[DISPLAYBUFFSIZE] = "Hello World";
37
#define KEY4    0x08
53
uint8_t DispPtr = 0;
38
#define KEY5    0x10
54
 
39
 
55
 
40
/************************************/
56
/************************************/
Line 51... Line 67...
51
/*        Update Menu on LCD        */
67
/*        Update Menu on LCD        */
52
/************************************/
68
/************************************/
53
// Display with 20 characters in 4 lines
69
// Display with 20 characters in 4 lines
54
void LCD_PrintMenu(void)
70
void LCD_PrintMenu(void)
55
{
71
{
56
 
-
 
57
  #if (!defined (USE_KILLAGREG) && !defined (USE_MK3MAG))
-
 
58
  static uint8_t MaxMenuItem = 11;
-
 
59
  #else
-
 
60
  #ifdef USE_MK3MAG
-
 
61
  static uint8_t MaxMenuItem = 12;
-
 
62
  #endif
-
 
63
  #ifdef USE_KILLAGREG
-
 
64
  static uint8_t MaxMenuItem = 14;
-
 
65
  #endif
-
 
66
  #endif
-
 
67
  static uint8_t MenuItem=0;
-
 
68
 
-
 
69
  //  if KEY1 is activated goto previous menu item
-
 
70
  if(RemoteButtons & KEY1)
72
        if(RemoteKeys & KEY1)
71
  {
73
        {
72
          if(MenuItem) MenuItem--;
74
                if(MenuItem) MenuItem--;
73
          else MenuItem = MaxMenuItem;
75
                else MenuItem = MaxMenuItem;
74
          LCD_Clear();
-
 
75
          RemotePollDisplayLine = -1;
-
 
76
  }
76
        }
77
  // if KEY2 is activated goto next menu item
-
 
78
  if(RemoteButtons & KEY2)
77
        if(RemoteKeys  & KEY2)
79
  {
78
        {
80
          if (MenuItem == MaxMenuItem) MenuItem = 0;
79
                if(MenuItem == MaxMenuItem) MenuItem = 0;
81
          else MenuItem++;
80
                else MenuItem++;
82
          LCD_Clear();
-
 
83
          RemotePollDisplayLine = -1;
-
 
84
   }
81
        }
-
 
82
        if((RemoteKeys  & KEY1) && (RemoteKeys  & KEY2)) MenuItem = 0;
85
 
83
 
86
  // if KEY1 and KEY2 is activated goto initial menu item
84
        LCD_Clear();
87
  if((RemoteButtons & KEY1) && (RemoteButtons & KEY2)) MenuItem = 0;
-
 
88
 
85
 
-
 
86
        if(MenuItem > MaxMenuItem) MenuItem = MaxMenuItem;
89
  // print menu item number in the upper right corner
87
        // print menu item number in the upper right corner
90
  if(MenuItem < 10)
88
        if(MenuItem < 10)
91
  {
89
        {
92
          LCD_printfxy(17,0,"[%i]",MenuItem);
90
          LCD_printfxy(17,0,"[%i]",MenuItem);
93
  }
91
        }
94
  else
92
        else
95
  {
93
        {
96
          LCD_printfxy(16,0,"[%i]",MenuItem);
94
          LCD_printfxy(16,0,"[%i]",MenuItem);
97
  }
95
        }
Line 98... Line 96...
98
 
96
 
99
  switch(MenuItem)
97
        switch(MenuItem)
100
  {
98
        {
101
    case 0:// Version Info Menu Item
99
    case 0:// Version Info Menu Item
102
           LCD_printfxy(0,0,"+ MikroKopter +");
100
           LCD_printfxy(0,0,"+ MikroKopter +");
103
           LCD_printfxy(0,1,"HW:V%d.%d SW:%d.%d%c",BoardRelease/10,BoardRelease%10,VERSION_MAJOR, VERSION_MINOR,VERSION_INDEX+'a');
101
           LCD_printfxy(0,1,"HW:V%d.%d SW:%d.%d%c",BoardRelease/10,BoardRelease%10,VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH+'a');
104
           LCD_printfxy(0,2,"Setting: %d ", GetActiveParamSet());
102
           LCD_printfxy(0,2,"Setting: %d ", GetActiveParamSet());
105
           LCD_printfxy(0,3,"(c) Holger Buss");
103
           LCD_printfxy(0,3,"(c) Holger Buss");
106
           break;
104
           break;
107
    case 1:// Height Control Menu Item
105
    case 1:// Height Control Menu Item
Line 135... Line 133...
135
           LCD_printfxy(0,0,"Ni:%4i  Ro:%4i ",PPM_in[ParamSet.ChannelAssignment[CH_NICK]],PPM_in[ParamSet.ChannelAssignment[CH_ROLL]]);
133
           LCD_printfxy(0,0,"Ni:%4i  Ro:%4i ",PPM_in[ParamSet.ChannelAssignment[CH_NICK]],PPM_in[ParamSet.ChannelAssignment[CH_ROLL]]);
136
           LCD_printfxy(0,1,"Gs:%4i  Ya:%4i ",PPM_in[ParamSet.ChannelAssignment[CH_GAS]],PPM_in[ParamSet.ChannelAssignment[CH_YAW]]);
134
           LCD_printfxy(0,1,"Gs:%4i  Ya:%4i ",PPM_in[ParamSet.ChannelAssignment[CH_GAS]],PPM_in[ParamSet.ChannelAssignment[CH_YAW]]);
137
           LCD_printfxy(0,2,"P1:%4i  P2:%4i ",PPM_in[ParamSet.ChannelAssignment[CH_POTI1]],PPM_in[ParamSet.ChannelAssignment[CH_POTI2]]);
135
           LCD_printfxy(0,2,"P1:%4i  P2:%4i ",PPM_in[ParamSet.ChannelAssignment[CH_POTI1]],PPM_in[ParamSet.ChannelAssignment[CH_POTI2]]);
138
           LCD_printfxy(0,3,"P3:%4i  P4:%4i ",PPM_in[ParamSet.ChannelAssignment[CH_POTI3]],PPM_in[ParamSet.ChannelAssignment[CH_POTI4]]);
136
           LCD_printfxy(0,3,"P3:%4i  P4:%4i ",PPM_in[ParamSet.ChannelAssignment[CH_POTI3]],PPM_in[ParamSet.ChannelAssignment[CH_POTI4]]);
139
           break;
137
           break;
140
    case 5:// Gyro Sensor Menu Item
138
        case 5:// Gyro Sensor Menu Item
141
           LCD_printfxy(0,0,"Gyro - Sensor");
139
           LCD_printfxy(0,0,"Gyro - Sensor");
142
           switch(BoardRelease)
140
           switch(BoardRelease)
143
           {
141
           {
144
                        case 10:
142
                        case 10:
145
                           LCD_printfxy(0,1,"Nick %4i (%3i)",AdValueGyrNick - AdNeutralNick, AdNeutralNick);
143
                           LCD_printfxy(0,1,"Nick %4i (%3i)",AdValueGyrNick - AdNeutralNick, AdNeutralNick);
146
                           LCD_printfxy(0,2,"Roll %4i (%3i)",AdValueGyrRoll - AdNeutralRoll, AdNeutralRoll);
144
                           LCD_printfxy(0,2,"Roll %4i (%3i)",AdValueGyrRoll - AdNeutralRoll, AdNeutralRoll);
147
                           LCD_printfxy(0,3,"Yaw  %4i (%3i)",AdNeutralYaw  - AdValueGyrYaw , AdNeutralYaw);
145
                           LCD_printfxy(0,3,"Yaw  %4i (%3i)",AdNeutralYaw  - AdValueGyrYaw , AdNeutralYaw);
148
                           break;
146
                           break;
Line 149... Line 147...
149
 
147
 
-
 
148
                        case 11:
-
 
149
                        case 12:
150
                        case 11:
150
                        case 20:
151
                           LCD_printfxy(0,1,"Nick %4i (%3i)",AdValueGyrNick - AdNeutralNick, AdNeutralNick/2);
151
                           LCD_printfxy(0,1,"Nick %4i (%3i)",AdValueGyrNick - AdNeutralNick, AdNeutralNick/2);
152
                           LCD_printfxy(0,2,"Roll %4i (%3i)",AdValueGyrRoll - AdNeutralRoll, AdNeutralRoll/2);
152
                           LCD_printfxy(0,2,"Roll %4i (%3i)",AdValueGyrRoll - AdNeutralRoll, AdNeutralRoll/2);
153
                           LCD_printfxy(0,3,"Yaw  %4i (%3i)",AdNeutralYaw  - AdValueGyrYaw , AdNeutralYaw/2);
153
                           LCD_printfxy(0,3,"Yaw  %4i (%3i)",AdNeutralYaw  - AdValueGyrYaw , AdNeutralYaw/2);
Line 154... Line 154...
154
                           break;
154
                           break;
155
 
155
 
156
                        case 12:
156
                        case 13:
157
                        default:
157
                        default:
158
                           LCD_printfxy(0,1,"Nick %4i (%3i)(%3i)",AdValueGyrNick - AdNeutralNick, AdNeutralNick/2, AnalogOffsetNick);
158
                           LCD_printfxy(0,1,"Nick %4i (%3i)(%3i)",AdValueGyrNick - AdNeutralNick, AdNeutralNick/2, AnalogOffsetNick);
159
                           LCD_printfxy(0,2,"Roll %4i (%3i)(%3i)",AdValueGyrRoll - AdNeutralRoll, AdNeutralRoll/2, AnalogOffsetRoll);
159
                           LCD_printfxy(0,2,"Roll %4i (%3i)(%3i)",AdValueGyrRoll - AdNeutralRoll, AdNeutralRoll/2, AnalogOffsetRoll);
Line 251... Line 251...
251
 
251
 
252
    default: MaxMenuItem = MenuItem - 1;
252
    default: MaxMenuItem = MenuItem - 1;
253
             MenuItem = 0;
253
             MenuItem = 0;
254
           break;
254
           break;
255
    }
255
    }
256
        RemoteButtons = 0;
256
    RemoteKeys = 0;