Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | ingob | 1 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2 | // + Copyright (c) 04.2007 Holger Buss |
||
3 | // + only for non-profit use |
||
4 | // + www.MikroKopter.com |
||
5 | // + see the File "License.txt" for further Informations |
||
6 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
685 | killagreg | 7 | |
8 | |||
9 | #include <inttypes.h> |
||
1 | ingob | 10 | #include "main.h" |
685 | killagreg | 11 | #include "timer2.h" |
12 | #include "fc.h" |
||
13 | #include "rc.h" |
||
14 | #include "uart.h" |
||
15 | #include "printf_P.h" |
||
16 | #include "analog.h" |
||
17 | #include "_Settings.h" |
||
1 | ingob | 18 | |
685 | killagreg | 19 | uint16_t TestInt = 0; |
20 | #define ARRAYSIZE 10 |
||
21 | uint8_t Array[ARRAYSIZE] = {1,2,3,4,5,6,7,8,9,10}; |
||
22 | #define DISPLAYBUFFSIZE 80 |
||
23 | int8_t DisplayBuff[DISPLAYBUFFSIZE] = "Hello World"; |
||
24 | uint8_t DispPtr = 0; |
||
25 | uint8_t RemoteButtons = 0; |
||
1 | ingob | 26 | |
27 | #define KEY1 0x01 |
||
28 | #define KEY2 0x02 |
||
29 | #define KEY3 0x04 |
||
30 | #define KEY4 0x08 |
||
31 | #define KEY5 0x10 |
||
32 | |||
685 | killagreg | 33 | /************************************/ |
34 | /* Clear LCD Buffer */ |
||
35 | /************************************/ |
||
36 | void LCD_Clear(void) |
||
1 | ingob | 37 | { |
685 | killagreg | 38 | uint8_t i; |
39 | for( i = 0; i < DISPLAYBUFFSIZE; i++) DisplayBuff[i] = ' '; |
||
1 | ingob | 40 | } |
41 | |||
685 | killagreg | 42 | |
43 | /************************************/ |
||
44 | /* Update Menu on LCD */ |
||
45 | /************************************/ |
||
46 | // Display with 20 characters in 4 lines |
||
47 | void LCD_PrintMenu(void) |
||
1 | ingob | 48 | { |
685 | killagreg | 49 | static uint8_t MaxMenuItem = 11, MenuItem=0; |
683 | killagreg | 50 | |
685 | killagreg | 51 | // if KEY1 is activated goto previous menu item |
52 | if(RemoteButtons & KEY1) |
||
53 | { |
||
54 | if(MenuItem) MenuItem--; |
||
55 | else MenuItem = MaxMenuItem; |
||
56 | LCD_Clear(); |
||
57 | RemotePollDisplayLine = -1; |
||
58 | } |
||
59 | // if KEY2 is activated goto next menu item |
||
60 | if(RemoteButtons & KEY2) |
||
61 | { |
||
62 | if (MenuItem == MaxMenuItem) MenuItem = 0; |
||
63 | else MenuItem++; |
||
64 | LCD_Clear(); |
||
65 | RemotePollDisplayLine = -1; |
||
66 | } |
||
67 | |||
68 | // if KEY1 and KEY2 is activated goto initial menu item |
||
69 | if((RemoteButtons & KEY1) && (RemoteButtons & KEY2)) MenuItem = 0; |
||
70 | |||
71 | // print menu item number in the upper right corner |
||
72 | if(MenuItem < 10) |
||
73 | { |
||
74 | LCD_printfxy(17,0,"[%i]",MenuItem); |
||
75 | } |
||
76 | else |
||
77 | { |
||
78 | LCD_printfxy(16,0,"[%i]",MenuItem); |
||
79 | } |
||
80 | |||
81 | switch(MenuItem) |
||
82 | { |
||
83 | case 0:// Version Info Menu Item |
||
595 | hbuss | 84 | LCD_printfxy(0,0,"+ MikroKopter +"); |
685 | killagreg | 85 | LCD_printfxy(0,1,"HW:V%d.%d SW:%d.%d%c",BoardRelease/10,BoardRelease%10,VERSION_HAUPTVERSION, VERSION_NEBENVERSION,VERSION_INDEX+'a'); |
86 | LCD_printfxy(0,2,"Setting: %d ", GetActiveParamSetNumber()); |
||
1 | ingob | 87 | LCD_printfxy(0,3,"(c) Holger Buss"); |
88 | break; |
||
685 | killagreg | 89 | case 1:// Hight Control Menu Item |
1 | ingob | 90 | if(EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG) |
683 | killagreg | 91 | { |
1 | ingob | 92 | LCD_printfxy(0,0,"Hoehe: %5i",HoehenWert); |
93 | LCD_printfxy(0,1,"SollHoehe: %5i",SollHoehe); |
||
94 | LCD_printfxy(0,2,"Luftdruck: %5i",MessLuftdruck); |
||
95 | LCD_printfxy(0,3,"Off : %5i",DruckOffsetSetting); |
||
96 | } |
||
683 | killagreg | 97 | else |
98 | { |
||
1 | ingob | 99 | LCD_printfxy(0,1,"Keine "); |
100 | LCD_printfxy(0,2,"Höhenregelung"); |
||
101 | } |
||
683 | killagreg | 102 | |
1 | ingob | 103 | break; |
685 | killagreg | 104 | case 2:// Attitude Menu Item |
1 | ingob | 105 | LCD_printfxy(0,0,"akt. Lage"); |
106 | LCD_printfxy(0,1,"Nick: %5i",IntegralNick/1024); |
||
107 | LCD_printfxy(0,2,"Roll: %5i",IntegralRoll/1024); |
||
108 | LCD_printfxy(0,3,"Kompass: %5i",KompassValue); |
||
109 | break; |
||
685 | killagreg | 110 | case 3:// Remote Control Channel Menu Item |
1 | ingob | 111 | LCD_printfxy(0,0,"K1:%4i K2:%4i ",PPM_in[1],PPM_in[2]); |
112 | LCD_printfxy(0,1,"K3:%4i K4:%4i ",PPM_in[3],PPM_in[4]); |
||
113 | LCD_printfxy(0,2,"K5:%4i K6:%4i ",PPM_in[5],PPM_in[6]); |
||
31 | ingob | 114 | LCD_printfxy(0,3,"K7:%4i K8:%4i ",PPM_in[7],PPM_in[8]); |
1 | ingob | 115 | break; |
685 | killagreg | 116 | case 4:// Remote Control Mapping Menu Item |
1 | ingob | 117 | LCD_printfxy(0,0,"Ni:%4i Ro:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_NICK]],PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]]); |
118 | LCD_printfxy(0,1,"Gs:%4i Gi:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_GAS]],PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]); |
||
119 | LCD_printfxy(0,2,"P1:%4i P2:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_POTI1]],PPM_in[EE_Parameter.Kanalbelegung[K_POTI2]]); |
||
31 | ingob | 120 | LCD_printfxy(0,3,"P3:%4i P4:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_POTI3]],PPM_in[EE_Parameter.Kanalbelegung[K_POTI4]]); |
1 | ingob | 121 | break; |
685 | killagreg | 122 | case 5:// Gyro Sensor Menu Item |
1 | ingob | 123 | LCD_printfxy(0,0,"Gyro - Sensor"); |
685 | killagreg | 124 | if(BoardRelease == 10) |
401 | hbuss | 125 | { |
683 | killagreg | 126 | LCD_printfxy(0,1,"Nick %4i (%3i)",AdValueGyrNick - AdNeutralNick, AdNeutralNick); |
127 | LCD_printfxy(0,2,"Roll %4i (%3i)",AdValueGyrRoll - AdNeutralRoll, AdNeutralRoll); |
||
395 | hbuss | 128 | LCD_printfxy(0,3,"Gier %4i (%3i)",MesswertGier, AdNeutralGier); |
401 | hbuss | 129 | } |
683 | killagreg | 130 | else |
401 | hbuss | 131 | { |
683 | killagreg | 132 | LCD_printfxy(0,1,"Nick %4i (%3i)",AdValueGyrNick - AdNeutralNick, AdNeutralNick/2); |
133 | LCD_printfxy(0,2,"Roll %4i (%3i)",AdValueGyrRoll - AdNeutralRoll, AdNeutralRoll/2); |
||
401 | hbuss | 134 | LCD_printfxy(0,3,"Gier %4i (%3i)",MesswertGier, AdNeutralGier/2); |
135 | } |
||
1 | ingob | 136 | break; |
685 | killagreg | 137 | case 6:// Acceleration Sensor Menu Item |
1 | ingob | 138 | LCD_printfxy(0,0,"ACC - Sensor"); |
683 | killagreg | 139 | LCD_printfxy(0,1,"Nick %4i (%3i)",AdValueAccNick,NeutralAccX); |
140 | LCD_printfxy(0,2,"Roll %4i (%3i)",AdValueAccRoll,NeutralAccY); |
||
395 | hbuss | 141 | LCD_printfxy(0,3,"Hoch %4i (%3i)",Mittelwert_AccHoch/*accumulate_AccHoch / messanzahl_AccHoch*/,(int)NeutralAccZ); |
1 | ingob | 142 | break; |
685 | killagreg | 143 | case 7:// Accumulator Voltage / Remote Control Level |
1 | ingob | 144 | LCD_printfxy(0,1,"Spannung: %5i",UBat); |
145 | LCD_printfxy(0,2,"Empf.Pegel:%5i",SenderOkay); |
||
146 | break; |
||
685 | killagreg | 147 | case 8:// Compass Menu Item |
1 | ingob | 148 | LCD_printfxy(0,0,"Kompass "); |
149 | LCD_printfxy(0,1,"Richtung: %5i",KompassRichtung); |
||
150 | LCD_printfxy(0,2,"Messwert: %5i",KompassValue); |
||
151 | LCD_printfxy(0,3,"Start: %5i",KompassStartwert); |
||
152 | break; |
||
685 | killagreg | 153 | case 9:// Poti Menu Item |
1 | ingob | 154 | LCD_printfxy(0,0,"Poti1: %3i",Poti1); |
155 | LCD_printfxy(0,1,"Poti2: %3i",Poti2); |
||
156 | LCD_printfxy(0,2,"Poti3: %3i",Poti3); |
||
157 | LCD_printfxy(0,3,"Poti4: %3i",Poti4); |
||
158 | break; |
||
685 | killagreg | 159 | case 10:// Servo Menu Item |
1 | ingob | 160 | LCD_printfxy(0,0,"Servo " ); |
161 | LCD_printfxy(0,1,"Setpoint %3i",Parameter_ServoNickControl); |
||
162 | LCD_printfxy(0,2,"Stellung: %3i",ServoValue); |
||
163 | LCD_printfxy(0,3,"Range:%3i-%3i",EE_Parameter.ServoNickMin,EE_Parameter.ServoNickMax); |
||
164 | break; |
||
685 | killagreg | 165 | case 11://Extern Control |
595 | hbuss | 166 | LCD_printfxy(0,0,"ExternControl " ); |
167 | LCD_printfxy(0,1,"Ni:%4i Ro:%4i ",ExternControl.Nick,ExternControl.Roll); |
||
168 | LCD_printfxy(0,2,"Gs:%4i Gi:%4i ",ExternControl.Gas,ExternControl.Gier); |
||
169 | LCD_printfxy(0,3,"Hi:%4i Cf:%4i ",ExternControl.Hight,ExternControl.Config); |
||
170 | break; |
||
685 | killagreg | 171 | default: MaxMenuItem = MenuItem - 1; |
172 | MenuItem = 0; |
||
1 | ingob | 173 | break; |
174 | } |
||
685 | killagreg | 175 | RemoteButtons = 0; |
304 | ingob | 176 | } |