Subversion Repositories FlightCtrl

Rev

Rev 1960 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1960 Rev 2018
Line 59... Line 59...
59
#include "analog.h"
59
#include "analog.h"
60
#include "twimaster.h"
60
#include "twimaster.h"
61
#include "attitude.h"
61
#include "attitude.h"
Line 62... Line 62...
62
 
62
 
63
#if (!defined (USE_NAVICTRL))
63
#if (!defined (USE_NAVICTRL))
64
uint8_t MaxMenuItem = 13;
64
uint8_t maxMenuItem = 13;
65
#else
65
#else
66
#ifdef USE_NAVICTRL
66
#ifdef USE_NAVICTRL
67
#include "gps.c"
67
#include "gps.c"
68
uint8_t MaxMenuItem = 14;
68
uint8_t maxMenuItem = 14;
69
#endif
69
#endif
70
#endif
70
#endif
71
uint8_t MenuItem = 0;
71
uint8_t menuItem = 0;
Line 72... Line 72...
72
uint8_t RemoteKeys = 0;
72
uint8_t remoteKeys = 0;
73
 
73
 
74
#define KEY1    0x01
74
#define KEY1    0x01
75
#define KEY2    0x02
75
#define KEY2    0x02
76
#define KEY3    0x04
76
#define KEY3    0x04
Line 77... Line 77...
77
#define KEY4    0x08
77
#define KEY4    0x08
78
#define KEY5    0x10
78
#define KEY5    0x10
79
 
79
 
Line 80... Line 80...
80
#define DISPLAYBUFFSIZE 80
80
#define DISPLAYBUFFSIZE 80
81
int8_t DisplayBuff[DISPLAYBUFFSIZE] = "Hello World";
81
int8_t displayBuff[DISPLAYBUFFSIZE] = "Hello World";
82
uint8_t DispPtr = 0;
82
uint8_t dispPtr = 0;
83
 
83
 
84
/************************************/
84
/************************************/
85
/*        Clear LCD Buffer          */
85
/*        Clear LCD Buffer          */
86
/************************************/
86
/************************************/
87
void LCD_Clear(void) {
87
void LCD_clear(void) {
Line 88... Line 88...
88
        uint8_t i;
88
        uint8_t i;
89
        for (i = 0; i < DISPLAYBUFFSIZE; i++)
89
        for (i = 0; i < DISPLAYBUFFSIZE; i++)
90
                DisplayBuff[i] = ' ';
90
                displayBuff[i] = ' ';
91
}
91
}
92
 
92
 
93
/************************************/
93
/************************************/
94
/*        Update Menu on LCD        */
94
/*        Update Menu on LCD        */
95
/************************************/
95
/************************************/
96
// Display with 20 characters in 4 lines
96
// Display with 20 characters in 4 lines
97
void LCD_PrintMenu(void) {
97
void LCD_printMenu(void) {
98
        if (RemoteKeys & KEY1) {
98
        if (remoteKeys & KEY1) {
Line 99... Line 99...
99
                if (MenuItem)
99
                if (menuItem)
100
                        MenuItem--;
100
                        menuItem--;
101
                else
101
                else
102
                        MenuItem = MaxMenuItem;
102
                        menuItem = maxMenuItem;
103
        }
103
        }
104
 
104
 
105
        if (RemoteKeys & KEY2) {
105
        if (remoteKeys & KEY2) {
106
                if (MenuItem == MaxMenuItem)
106
                if (menuItem == maxMenuItem)
Line 107... Line 107...
107
                        MenuItem = 0;
107
                        menuItem = 0;
Line 108... Line 108...
108
                else
108
                else
109
                        MenuItem++;
109
                        menuItem++;
110
        }
110
        }
111
        if ((RemoteKeys & KEY1) && (RemoteKeys & KEY2))
111
        if ((remoteKeys & KEY1) && (remoteKeys & KEY2))
112
                MenuItem = 0;
112
                menuItem = 0;
113
 
113
 
114
        LCD_Clear();
114
        LCD_clear();
115
 
115
 
Line 116... Line 116...
116
        if (MenuItem > MaxMenuItem)
116
        if (menuItem > maxMenuItem)
117
                MenuItem = MaxMenuItem;
117
                menuItem = maxMenuItem;
118
        // print menu item number in the upper right corner
118
        // print menu item number in the upper right corner
119
        if (MenuItem < 10) {
119
        if (menuItem < 10) {
120
                LCD_printfxy(17,0,"[%i]",MenuItem);
120
                LCD_printfxy(17,0,"[%i]", menuItem);
121
        } else {
121
        } else {
Line 287... Line 287...
287
                }
287
                }
288
                break;
288
                break;
289
#endif
289
#endif
Line 290... Line 290...
290
 
290
 
291
        default:
291
        default:
292
                MaxMenuItem = MenuItem - 1;
292
                maxMenuItem = menuItem - 1;
293
                MenuItem = 0;
293
                menuItem = 0;
294
                break;
294
                break;
295
        }
295
        }
296
        RemoteKeys = 0;
296
        remoteKeys = 0;