whycyhl
2022-05-05 94861120b14313f81fc666e612c48c9e8a81f1e7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
/************************** Copyright (c) **********************************
**                 FUZHOU FUGUANG ELECTRONICS Co.,LTD.
**                        ¸£Öݸ£¹âµç×ÓÓÐÏÞ¹«Ë¾
**                       http://www.fuguang.com
**
**-------------- File Info -------------------------------------------------
** File name:            MainMenu.c
** Last modified Date:  2008-11-16
** Last Version:        1.0
** Descriptions:        Display the main menu after after the logo
**
**--------------------------------------------------------------------------
** Created by:            mxpopstar
** Created date:        2008-11-16
** Version:                1.0
** Descriptions:        The original version
**
**--------------------------------------------------------------------------
** Modified by:            mxpopstar
** Modified date:        2008-11-20
** Version:
** Descriptions:        Display the main menu after after the logo
**
***************************************************************************/
//
#include "MainMenu.h"
#include "Define.h"
#include "FileManage.h"
#include "WorkingPage.h"
#include "TFT_Driver.h"
#include "Buzzer_Driver.h"
#include "AD7843_Driver.h"
#include "DS1302_Driver.h"
#include "SingleVol.h"
#include "ChargePage.h"
#include "AboutPage.h"
#include "SYSSetPage.h"
#include "SelectForm.h"
#include "NRF905_Driver.h"
#include "MessageBox.h"
 
extern FBO_Data GB_FBO_Data;
extern SYS_State GB_SYS_State;
extern unsigned int GB_TestingParm[13];
 
//###################### Çë×¢ÒâÔ¤±àÒëÇø ####################################
#if(MashineType == FBO48CT)
const prog_uchar MenuCaption[1][11] = 
{
    #if(MashineCurr == 300)
    "FBO-4830CT"
    #else
    "FBO-4815CT"
    #endif
};
#else
const prog_uchar MenuCaption[12] = 
{
    #if(BCTVTYPE == 6)
    "BCT-60/120"
    #else
    "BCT-300/120"
    #endif
};
#endif
//###################### Çë×¢ÒâÔ¤±àÒëÇø ####################################
//
 
#if(SoftLanguage==CN) 
const prog_uchar MenuMCZeroText[1][7] = 
{
    {70, 71, 36, 63, 188, 0, 137},//µ¥ÌåÊýÁ¿Îª0!
};
//
 
const prog_uchar MenuVersionText[1][4] = 
{
    {31, 5, 181, 4}// V5.4
};
//
 
const prog_uchar MenuText[6][4] = 
{
    { 0,  2,  3,  4},//"·Åµç²âÊÔ"
    { 1,  2,  35, 3},//"³äµç¼à²â"
    {17,  6,  7,  8},//"Êý¾Ý¹ÜÀí"
    { 9,  5, 10, 11},//"ϵͳÉèÖÃ"
    {12, 13, 14, 15},//"²é¿´µ¥Ìå"
    {16, 17, 18, 19},//"²ÎÊýÔ¤ÖÃ"
};
const prog_uchar MenuButton[3][2] =
{    
    {50,  51},//Ñ¡Ôñ
    {45,  46},//È·¶¨
    {101,101},// 
};
 
#else
const prog_uchar MenuMCZeroText[1][22] = 
{
    {103,74,71,13,61,74,0,89,71,64,72,64,73,78,74,61,0,16,1},
    //"Battery Count is 0!",19
};
//
 
const prog_uchar MenuVersionText[10] = 
{
    "V2.0A"//"V6.4"//½â¾öµ¥ÌåÅäÖÃ//2017-5-18Ð޸Ġ½«°æ±¾Éý¼¶ÎªV2.0A£¨¶¨ÖƱíÒªÇó£©
};
//
const prog_uchar MenuText[6][14] = //RU¡£
{
    {109,59,67,76,91,63},                     //"·Åµç²âÊÔ"6
    {100,59,76,91,63},                         //"³äµç¼à²â"5
    {96,59,73,73,87,64},                     //"Êý¾Ý¹ÜÀí"6
    {106,59,77,78,76,74,69,70,59},             //"ϵͳÉèÖÃ"9
    {108,76,74,77,72,74,78,76},                 //"²é¿´µ¥Ìå"8
    {108,76,64,63,79,77,78,59,73,74,61,70,68},//"²ÎÊýÔ¤ÖÃ"13
};
const prog_uchar MenuButton[3][8] =
{    
    {94,87,60,74,76},        //Ñ¡Ôñ5
    {94,61,74,63},             //È·¶¨4
    "    " // 
};
#endif
//
 
static unsigned char MenuItemIndex = MenuItem0;
 
unsigned char DSPMainMenu(void)
{        
    DisableCustomInput();
    GB_SYS_State.CurrentPage = DSPMainMenu;
    GB_SYS_State.GetInput = GetMenuSelected;
    DisableMonomerVolGether();
    DSPMainMenuText(MenuItemIndex);
    DrawButtonH48(2, MenuButton[0], 5, 16, 8, 149, 400, gray1, white);//Ñ¡Ôñ
    DrawButtonH48(2, MenuButton[1], 4, 16, 18, 399, 400, gray1, white);//È·¶¨    
    return 0;
}
//
 
void DSPMainMenuText(unsigned char select)
{
    unsigned char fcolor,bcolor;
    
    //###################### Çë×¢ÒâÔ¤±àÒëÇø ################################
    #if(ProductionType == Production_STD)
        #if(MashineType == FBO48CT)
        DSP16x24Str(MenuCaption[0], 10, 16, 24, 24, blue, yellow);//FBO-4815CT
        DrawLine(24, 50, 20, 0,    blue, white, linebold, 2);
        DSP24x24Str(MenuVersionText[0], 5, 12, 208, 30, blue, red);//V-3.1
        #else
        DSP24x24Str(MenuCaption, 11, 16, 24, 24, blue, yellow);//IDCE-4815CT
        DrawLine(24, 50, 22, 0,    blue, white, linebold, 2);
        DSP24x24StrS(MenuVersionText, 5, 16, 224, 30, blue, red);//V-3.1
        #endif
    #else
        DSP24x24Str(MenuVersionText[0], 5, 12, 24, 30, blue, red);//V-3.1
    #endif    
    //###################### Çë×¢ÒâÔ¤±àÒëÇø ################################
    
    if(select == MenuItem0)    {fcolor = white; bcolor = green5;}
    else{fcolor = white; bcolor = gray1;}
    DrawButtonH48(4, MenuButton[2], 0, 30, 23, 72, 92, bcolor, fcolor);//5¸ö°´Å¥    
    #if(SoftLanguage == CN)
        DSP32x32Str(MenuText[0], 4, 48, 80, 100, bcolor, white); //·Åµç²âÊÔ
    #else
        DSP16x24Str(MenuText[0], 6, 14, 120, 104, bcolor, white); 
    #endif
    
    if(select == MenuItem1)    {fcolor = white; bcolor = green5;}
    else{fcolor = white; bcolor = gray1;}
    DrawButtonH48(4, MenuButton[2], 0, 30, 23, 368, 92, bcolor, fcolor);//5¸ö°´Å¥
    #if(SoftLanguage == CN)
        DSP32x32Str(MenuText[1], 4, 48, 376, 100, bcolor, white); //³äµç²âÊÔ
    #else
        DSP16x24Str(MenuText[1], 5, 14, 425, 104, bcolor, white); 
    #endif
    
    if(select == MenuItem2)    {fcolor = white; bcolor = green5;}
    else{fcolor = white; bcolor = gray1;}    
    DrawButtonH48(4, MenuButton[2], 0, 30, 23, 72, 192, bcolor, fcolor);//5¸ö°´Å¥    
    #if(SoftLanguage == CN)
        DSP32x32Str(MenuText[2], 4, 48, 80, 200, bcolor, white); //Êý¾Ý¹ÜÀí
    #else
        DSP16x24Str(MenuText[2], 6, 14, 120, 204, bcolor, white); 
    #endif
    
    if(select == MenuItem3)    {fcolor = white; bcolor = green5;}
    else{fcolor = white; bcolor = gray1;}    
    DrawButtonH48(4, MenuButton[2], 0, 30, 23, 368, 192, bcolor, fcolor);//5¸ö°´Å¥
    #if(SoftLanguage == CN)
        DSP32x32Str(MenuText[3], 4, 48, 376, 200, bcolor, white);//²ÎÊýÉèÖÃ
    #else
        DSP16x24Str(MenuText[3], 9, 14, 400, 204, bcolor, white); 
    #endif
    
    if(select == MenuItem4)    {fcolor = white; bcolor = green5;}
    else{fcolor = white; bcolor = gray1;}
    DrawButtonH48(4, MenuButton[2], 0, 30, 23, 72, 292, bcolor, fcolor);//5¸ö°´Å¥
    #if(SoftLanguage == CN)
        DSP32x32Str(MenuText[4], 4, 48, 80, 300, bcolor, white);//²é¿´µ¥Ìå
    #else
        DSP16x24Str(MenuText[4], 8, 14, 110, 304, bcolor, white); 
    #endif
    
    if(select == MenuItem5)    {fcolor = white; bcolor = green5;}
    else{fcolor = white; bcolor = gray1;}
    DrawButtonH48(4, MenuButton[2], 0, 30, 23, 368, 292, bcolor, fcolor);//5¸ö°´Å¥    
    #if(SoftLanguage == CN)
        DSP32x32Str(MenuText[5], 4, 48, 376, 300, bcolor, white);//¹ØÓÚ±¾»ú
    #else
        DSP16x24Str(MenuText[5], 13, 14, 375, 304, bcolor, white); 
    #endif
}
//
 
void GetMenuSelected(void)
{        
    static unsigned char lastkey = ButtonNull;
    static unsigned char getlastkeycount = 0;
    unsigned char touched_item;    
    
    touched_item = GetTouchLocal();    
    if(touched_item == ButtonNull)//Èç¹û°´¼üΪ¿ÕÔòÖ±½Ó·µ»Ø;
    {
        getlastkeycount = 0;
        lastkey = ButtonNull;
        return;
    }
    //------------------ ´¦Àí°´¼ü --------------------
    if(touched_item == Button1)     //Ñ¡Ôñ
    {        
        if(GetButtonIsBeep(0) == BeepIsWork)
            BuzzerBeep(100);
        MenuItemIndex++; 
        if(MenuItemIndex > MenuItem5)
        {
            MenuItemIndex = MenuItem0;
        }
        DSPMainMenuText(MenuItemIndex);    
        _delay_ms(100);
        return;
    }
    else if(touched_item == Button3) //È·¶¨
    {
        if(GetButtonIsBeep(0) == BeepIsWork)
            BuzzerBeep(100);
        touched_item = MenuItemIndex;
        RespondMenuKeyboard(&MenuItemIndex, touched_item);    
        return;
    }
    
    if((touched_item==lastkey) && (getlastkeycount<10))
    {
        getlastkeycount++;
    }
    lastkey = touched_item;    
    if(getlastkeycount > 0)
    {
        return;
    }
    if((touched_item>=MenuItem0) && (touched_item<=MenuItem5))
    {
        if(GetButtonIsBeep(0) == BeepIsWork)
            BuzzerBeep(100);
        RespondMenuKeyboard(&MenuItemIndex, touched_item);
        _delay_ms(50);
    }            
}
//
 
void RespondMenuKeyboard(unsigned char *index, const unsigned char touchitem)
{
    switch(touchitem)
    {
        //------------------ ´¦Àí°´¼ü --------------------
        case MenuItem0://·Åµç²âÊÔ                
                        if(*index == MenuItem0)
                        {
                            //############# Çë×¢ÒâÔ¤±àÒëÇø #################
                            #if(MashineType == FBO48CT)
                            BackColorCH();
                            DSPSelectForm();
                            #else
                            GB_TestingParm[0] = 0;    
                            GB_TestingParm[1] = 0;
                            BackColorCH();                                
                            DSPWorkingPage();
                            #endif
                            //############# Çë×¢ÒâÔ¤±àÒëÇø #################
                            return;
                        }            
                        break;
        case MenuItem1://³äµç¼à²â            
                        if(*index == MenuItem1)
                        {
                            BackColorCH();
                            DSPChargePage();
                            return;
                        }
                        break;    
        case MenuItem2://Êý¾Ý¹ÜÀí                
                        if(*index == MenuItem2)
                        {
                            BackColorCH();
                            DSPFileManagePage();
                            return;
                        }            
                        break;
        case MenuItem3://ϵͳÉèÖà           
                        if(*index == MenuItem3)
                        {                            
                            BackColorCH();
                            DSPSYSSetPage();
                            return;
                        }            
                        break;
        case MenuItem4://²é¿´µ¥Ìå                
                        if(*index == MenuItem4)
                        {
                            if(GB_FBO_Data.BattSum == 0)
                            {
                                DSPMessageBox(MenuMCZeroText[0], 19, MB_OK, BeepNull);
                                return;
                            }
                            BackColorCH();
                            DSPSingleVolData();
                            return;
                        }            
                        break;
        case MenuItem5://¹ØÓÚ±¾»ú                
                        if(MenuItemIndex == MenuItem5)
                        {                                            
                            BackColorCH();
                            DSPAboutPage();
                            return;
                        }            
                        break;    
    }
            
    MenuItemIndex = touchitem;
    DSPMainMenuText(MenuItemIndex);        
}
//
 
/*********************** END OF FILE (MainMenu.c)**************************/