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
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
/************************** Copyright (c) **********************************
**                 FUZHOU FUGUANG ELECTRONICS Co.,LTD.
**                        ¸£Öݸ£¹âµç×ÓÓÐÏÞ¹«Ë¾
**                       http://www.fuguang.com
**
**-------------- File Info -------------------------------------------------
** File name:            SingleVol.c
** Last modified Date:  2008-11-16
** Last Version:        1.0
** Descriptions:        Display the monomer voltage data and graphy
**
**--------------------------------------------------------------------------
** 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 monomer voltage data and graphy
**
***************************************************************************/
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
#include <avr/pgmspace.h>
#include "SingleVol.h"
#include "MainMenu.h"
#include "TFT_Driver.h"
#include "Buzzer_Driver.h"
#include "AD7843_Driver.h"
#include "SYSSetPage.h"
#include "NRF905_Driver.h"
#include "WorkingPage.h"
#include "ChargePage.h"
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
#if(SoftLanguage == CN)
extern const prog_uchar _16_24[59][48];
#else
extern const prog_uchar _16_24[126][48];
extern const prog_uchar _12_16[126][24];
#endif
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
extern FBO_Data GB_FBO_Data;
extern SYS_State GB_SYS_State;
extern unsigned int GB_TestingParm[13];
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
const prog_uchar SPBMP[2][1] = 
{
    {26},//¡ü
    {27},//¡ú
};
//
 
#if(SoftLanguage==CN) 
const prog_uchar STextItem[4][4] = 
{
    {70, 71, 56, 86},//"µ¥Ìåµçѹ"
    {91, 93, 59,156},//×î¸ß£º#
    {91, 92, 59,156},//×îµÍ£º#
    {56, 201,68, 59},//µç³Ø×飺
};
 
const prog_uchar SButtonItem[5][2] =
{    
    { 48,  49},//ÏÂÒ³
    { 47,  49},//ÉÏÒ³
    { 36,  37},//Êý¾Ý
    {110, 111},//ͼÐÎ
    { 52,  53},//Í˳ö
};
#elif(SoftLanguage==EN)
const prog_uchar STextItem[4][10] = 
{
    {0},//"µ¥Ìåµçѹ"
    {105,59,70,77,26,125},    //×î¸ß#6
    {105,68,73,26,125},        //×îµÍ£º#5
    {95,76,79,75,75,59,26},    //µç³Ø×飺7
};    
const prog_uchar SButtonItem[5][8] =
{
    {94,75,64,76,64,63},    //ÏÂÒ³6
    {106,59,67,59,63},        //ÉÏÒ³5
    {111,59,60,71,68,82,59},//Êý¾Ý7
    {95,76,59,80,68,70},//ͼÐÎ6
    {94,87,81,74,63},    //Í˳ö5
};
const prog_uchar SVPNumber[] = 
{
    "#",//No
};
#endif
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
static unsigned char (*SVPParentPage)(void) = DSPSingleVolData;
static unsigned char (*SVPChildPage)(void) = DSPSingleVolData;
static unsigned char SVDspMode = mode_data;
static unsigned int OringinMonomerVol[500] = {0};
static unsigned int MonomerIndex = 0;
static unsigned int PageMonomerSum = 24;
static unsigned int MonomerSum = 250;
static unsigned int MonomervolType = 200;
static unsigned int monomerlowvol1 = 180;
static unsigned int monomerhighvol1 = 220;
static unsigned int monomerlowvol2 = 180;
static unsigned int monomerhighvol2 = 220;
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
unsigned char DSPSingleVolData(void)
{
    DisableCustomInput();
    
    if(SVPChildPage != GB_SYS_State.CurrentPage)
    {
        SVPParentPage = GB_SYS_State.CurrentPage;//±£´æ¸¸Ò³ÃæÖ¸Õë
        MonomerIndex = 0;
    }
    SVPChildPage = DSPSingleVolData; 
    GB_SYS_State.CurrentPage = DSPSingleVolData; //½«µ¥ÌåÒ³ÃæÉèΪµ±Ç°Ò³Ãæ
    GB_SYS_State.GetInput = GetSingleVolMenuSelected;
    
    if(MonomerIndex >= MonomerSum)
    {
        MonomerIndex = 0;
    }
    
    if(SVPParentPage == DSPMainMenu)
    {
        EnableMonomerVolGether();
    }
    
    if((GB_SYS_State.WorkState==Stopped) && (GetMonomerVolGetherState()==1))
    {
        ClearOringinMonomerVol();
    }
    
    DSP16x24Str(STextItem[1], 6, 14, 24, 12, blue, green7);//×î¸ßµ¥Ìå
    DSP16x24Str(STextItem[2], 5, 16, 368, 12, blue, red);  //×îµÍµ¥Ìå
    DSP16x24Str(STextItem[3], 7, 14, 24, 360, blue, white);//µç³Ø×飺
    
    if(SVDspMode == mode_data)
    {
        UpdateSingleVolData(GB_FBO_Data.SingleVol);
        DrawLine(24, 42, 75, 0,    blue, white, linebold, 2);
    }
    else
    {
        DrawRects();
    }
    
    DrawSingleVolPageButton();
    
    return 0;
}
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
void DrawSingleVolPageButton(void)
{
    unsigned char fcl1,fcl2,fcl3;
    if((GB_FBO_Data.BattGroup>1)||(GB_FBO_Data.BattSum>24))
        fcl1 = white;
    else fcl1 = gray2;
 
    if(SVDspMode == mode_data)
    {
        fcl2 = gray2;
        fcl3 = white;
    }
    else
    {
        fcl2 = white;
        fcl3 = gray2;
    }
    
    DrawButtonH48(2, SButtonItem[0], 6, 14, 3, 24, 400, gray1, fcl1);            //ÏÂÒ³
    DrawButtonH48(2, SButtonItem[1], 5, 14, 10, 24+125*1, 400, gray1, fcl1);    //ÉÏÒ³
    DrawButtonH481(2, SButtonItem[2], 7, 12, 3, 24+125*2, 400, gray1, fcl2);    //Êý¾Ý
    DrawButtonH48(2, SButtonItem[3], 6, 14, 3, 24+125*3, 400, gray1, fcl3);        //ͼÐÎ
    DrawButtonH48(2, SButtonItem[4], 5, 14, 10, 24+125*4, 400, gray1, red);        //Í˳ö
}
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
void UpdateMaxMinVol(void)
{
    unsigned char index = MonomerIndex/GetEachGroupBattSum();
    PrintValue(2, 0, GetMonomerMaxIndex(index)+1, "-", 16,  112, 12, blue, green7); //×î¸ßµ¥ÌåË÷Òý
    PrintValue(0, 3, GetMonomerMaxVol(index), "B", 16,  176, 12, blue, green7);     //×î¸ßµ¥Ìåµçѹֵ
    PrintValue(2, 0, GetMonomerMinIndex(index)+1, "-", 16,  448, 12, blue, red);    //×îµÍµ¥ÌåË÷Òý
    PrintValue(0, 3, GetMonomerMinVol(index), "B", 16,  512, 12, blue, red);        //×îµÍµ¥Ìåµçѹֵ
    #if(SoftLanguage == CN)
    PrintValueEx(4, 0, index+1, 16, 120, 360, blue, white);
    #else
    PrintValue(4, 0, index+1, "", 16, 120, 360, blue, white);
    #endif
}
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
void SetMonomerSum(const unsigned int eachgroupbattsum, const unsigned char group)
{
    MonomerSum = eachgroupbattsum*group;
    SetModuleSum(eachgroupbattsum, group);
}
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
void SetMonomerVolType(void)
{
    unsigned char index = MonomerIndex/GetEachGroupBattSum();
    if(GetMonomerMaxVol(index) < 1800)//¼ÓÈë1.2Vµç³Øµ²
    {
        monomerhighvol2 = 160;
        monomerhighvol1 = 140;
        MonomervolType = 120;    //¼ÓÈë1.2Vµç³Øµ²
        monomerlowvol1 = 100;
        monomerlowvol2 = 80;
    }
    else if(GetMonomerMaxVol(index) < 3000)
    {
        monomerhighvol2 = 240;
        monomerhighvol1 = 220;
        MonomervolType = 200;
        monomerlowvol1 = 180;
        monomerlowvol2 = 160;
    }
    else if(GetMonomerMaxVol(index) > 9000)
    {
        monomerhighvol2 = 1440;
        monomerhighvol1 = 1320;
        MonomervolType = 1200;
        monomerlowvol1 = 1080;
        monomerlowvol2 = 960;
    }
    else 
    {
        monomerhighvol2 = 720;
        monomerhighvol1 = 660; 
        MonomervolType = 600;
        monomerlowvol1 = 540;
        monomerlowvol2 = 480;
    }
}
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
void SetOringinMonomerVol(const unsigned int *voldata)
{
    unsigned int n = 0;
    for(n=0; n<MonomerSum; n++)
    {
        OringinMonomerVol[n] = voldata[n];
    }
}
void ClearOringinMonomerVol(void)
{
    unsigned int n = 0;
    for(n=0; n<MonomerSum; n++)
    {
        OringinMonomerVol[n] = 0;
    }
}
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
void UpdateSingleVolData(const unsigned int *voldata)
{
    unsigned int index,x,y;    
    unsigned int from_index = MonomerIndex;
    unsigned char Fcolor;//ǰ¾°É«
    unsigned char group = MonomerIndex/GetEachGroupBattSum();
 
    PageMonomerSum = GetEachGroupBattSum() - (MonomerIndex%GetEachGroupBattSum());
    if(PageMonomerSum > 24) 
        PageMonomerSum = 24;
 
    UpdateMaxMinVol();
    SetMonomerVolType();
    
    Write_CMD(0x04);//ÉèÖñ³¾°É«
    Write_TFT_Data(blue);
    
    for(x=0; x<3; x++)
    {
        for(y=0; y<8; y++)
        {
            index = from_index+y+x*8;
            
            if(voldata[index] <= GetMonomerMinVol(group))
                Fcolor = red;
            else if(voldata[index] >= GetMonomerMaxVol(group))
                Fcolor = green7;
            else if((voldata[index]<=monomerlowvol1*10) && (voldata[index]>GetMonomerMinVol(group)))
                Fcolor = purple;
            else Fcolor = yellow;
            
            Write_CMD(0x02);//ÉèÖÃǰ¾°É«
            Write_TFT_Data(Fcolor);
            Write_CMD(0x01);//Ö¸ÕëÑØxÖá·½ÏòÒÆ¶¯,8µãдģʽ
            
            if(y+x*8 >= PageMonomerSum)
            {
                DSP16x24( 24+213*x, 60+38*y, _16_24[0]);    //"#"
                DSP16x24( 40+213*x, 60+38*y, _16_24[0]);
                DSP16x24( 56+213*x, 60+38*y, _16_24[0]);
                DSP16x24( 72+213*x, 60+38*y, _16_24[0]);    
                DSP16x24( 88+213*x, 60+38*y, _16_24[0]);    //"-"
                DSP16x24(104+213*x, 60+38*y, _16_24[0]);
                DSP16x24(120+213*x, 60+38*y, _16_24[0]);
                DSP16x24(136+213*x, 60+38*y, _16_24[0]);//"."
                DSP16x24(152+213*x, 60+38*y, _16_24[0]);
                DSP16x24(168+213*x, 60+38*y, _16_24[0]);
                DSP16x24(184+213*x, 60+38*y, _16_24[0]);
            }
            else
            {
                unsigned int go = index+1-group*24;
                index = from_index+y+x*8;
                go = (index % GetEachGroupBattSum()) + 1;
                
                DSP16x24( 24+213*x, 60+38*y, _16_24[' '-0x20]);    //"#"
                DSP16x24( 24+213*x, 60+38*y, _16_24[125]);    //"#"
                DSP16x24( 40+213*x, 60+38*y, _16_24[(go)/100+0x10]);
                DSP16x24( 56+213*x, 60+38*y, _16_24[((go)%100)/10+0x10]);
                DSP16x24( 72+213*x, 60+38*y, _16_24[(go)%10+0x10]);    
                DSP16x24( 88+213*x, 60+38*y, _16_24['-'-0x20]);    //"-"
                DSP16x24(104+213*x, 60+38*y, _16_24[voldata[index]/10000+0x10]);
                DSP16x24(120+213*x, 60+38*y, _16_24[(voldata[index]%10000)/1000+0x10]);
                DSP16x24(136+213*x, 60+38*y, _16_24['.'-0x20]);//"."
                DSP16x24(152+213*x, 60+38*y, _16_24[(voldata[index]%1000)/100+0x10]);
                DSP16x24(168+213*x, 60+38*y, _16_24[(voldata[index]%100)/10+0x10]);
                DSP16x24(184+213*x, 60+38*y, _16_24[voldata[index]%10+0x10]);
            }
        }
    }
}
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
void QuitSingleVolPage(void)
{
    BackColorCH();
    SVPParentPage();
    SVPParentPage = DSPSingleVolData;  //»Ö¸´¸¸Ò³ÃæÖ¸ÕëΪ×Ô¼ºµÄÒ³Ãæ;
}
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
void GetSingleVolMenuSelected(void)
{
    static unsigned int count = 0;
    unsigned char touched_item = ButtonNull;
    
    if(count++ % 256 == 0)
    {
        if(SVDspMode == mode_data)
            UpdateSingleVolData(GB_FBO_Data.SingleVol);
        else
            UpdateSVGraph(GB_FBO_Data.SingleVol);
    }
    
    touched_item = GetTouchLocal();
    
    if(touched_item == Button4)                    //Í˳ö
    {
        if(GetButtonIsBeep(0) == BeepIsWork)
                BuzzerBeep(100);
        BackColorCH();
        SVPParentPage();
        SVPParentPage = DSPSingleVolData;        //»Ö¸´¸¸Ò³ÃæÖ¸ÕëΪ×Ô¼ºµÄÒ³Ãæ;
    }
    else if((touched_item==Button3) && (SVDspMode==mode_data))    //ͼÐÎ
    {
        if(GetButtonIsBeep(0) == BeepIsWork)
                BuzzerBeep(100);
        SVDspMode = mode_graph;
        BackColorCH();
        DSPSingleVolData();    
        _delay_ms(100);
    }
    else if((touched_item==Button2) && (SVDspMode==mode_graph)) //Êý¾Ý
    {
        if(GetButtonIsBeep(0) == BeepIsWork)
                BuzzerBeep(100);
        SVDspMode = mode_data;
        BackColorCH();
        DSPSingleVolData();
        _delay_ms(100);
    }
    else if((touched_item==Button1) && ((GB_FBO_Data.BattGroup>1)||(GB_FBO_Data.BattSum>24)))  //ÉÏÒ³
    {
        if(GetButtonIsBeep(0) == BeepIsWork)
                BuzzerBeep(100);
        if(MonomerIndex == 0)
        {
            if((GetEachGroupBattSum()>0) && (GetEachGroupBattSum()<=24))
                MonomerIndex = MonomerSum-GetEachGroupBattSum();
            else if((GetEachGroupBattSum()%24) > 0)
                MonomerIndex = MonomerSum-(GetEachGroupBattSum()%24);
            else MonomerIndex = MonomerSum-24;
        }
        else
        {
            if(((MonomerIndex%GetEachGroupBattSum())>=24) || ((GetEachGroupBattSum()%24)==0))
                MonomerIndex -= 24;
            else MonomerIndex -= GetEachGroupBattSum()%24;
        }
        
        if(SVDspMode == mode_data)
            UpdateSingleVolData(GB_FBO_Data.SingleVol);
        else
            UpdateSVGraph(GB_FBO_Data.SingleVol);
        
        _delay_ms(100);
    }
    else if((touched_item==Button0) && ((GB_FBO_Data.BattGroup>1)||(GB_FBO_Data.BattSum>24))) //ÏÂÒ³
    {
        if(GetButtonIsBeep(0) == BeepIsWork)
                BuzzerBeep(100);
        
        MonomerIndex += PageMonomerSum;
        if(MonomerIndex < PageMonomerSum)
            MonomerIndex = 0;
        if(MonomerIndex >= MonomerSum)
            MonomerIndex = 0;
        
        if(SVDspMode == mode_data)
            UpdateSingleVolData(GB_FBO_Data.SingleVol);
        else
            UpdateSVGraph(GB_FBO_Data.SingleVol);
        
        _delay_ms(100);
    }
}
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
void DrawRects(void)
{
    unsigned char n;
    
    for(n=0; n<5; n++)
    {
        if(n < 4)
            DrawButtonH48(2, SButtonItem[n], 2, 30, 23, 24+125*n, 400, gray1, white);//4¸ö°´Å¥
        else
            DrawButtonH48(2, SButtonItem[n], 2, 30, 23, 24+125*n, 400, gray1, red);//Í˳ö
    }
    
    DSP8x11Str(SPBMP[0], 1, 8, 60, 44, blue, white);//¡ü
    DrawLine(63, 49, 35, 1, blue, white, linebold, 2); //»­×Ý×ø±ê
    DSP8x11Str(SPBMP[1], 1, 8, 625, 324, blue, white);//¡ú
    DrawLine(63, 329, 71, 0, blue, white, linebold, 2);//»­ºá×ø±ê
    
    for(n=1; n<5; n++)
        DrawLine(80+23*(n*5-1), 329, 1, 1, blue, white, linebold, 1); //»­ºá×ø±ê¿Ì¶È
    for(n=1; n<5; n++)
        DSP8x11Value(2, 0, n*5+MonomerIndex, "", 8, 76+23*(n*5-1), 340, blue, white); //»­ºá×ø±ê¿Ì¶ÈÖµ
    
    DrawLine(56, 54, 1, 0, blue, green7, linebold, 1); //»­×Ý×ø±ê¿Ì¶È:ÉÏÏÞÖµ
    DrawLine(56, 121, 1, 0, blue, green7, linebold, 1); //»­×Ý×ø±ê¿Ì¶È:ÉÏÏÞÖµ
    DrawLine(56, 188, 1, 0, blue, yellow, linebold, 1); //»­×Ý×ø±ê¿Ì¶È:±ê×¼Öµ
    DrawLine(56, 255, 1, 0, blue, red, linebold, 1);     //»­×Ý×ø±ê¿Ì¶È:ÏÂÏÞÖµ
    DrawLine(56, 322, 1, 0, blue, red, linebold, 1);     //»­×Ý×ø±ê¿Ì¶È:ÏÂÏÞÖµ
    
    DrawLine(64, 54, 71, 0, blue, green7, linedot, 1); //»­×Ý×ø±êÐéÏß:ÉÏÏÞÖµ
    DrawLine(64, 121, 71, 0, blue, green7, linedot, 1); //»­×Ý×ø±êÐéÏß:ÉÏÏÞÖµ
    DrawLine(64, 188, 71, 0, blue, yellow, linedot, 1); //»­×Ý×ø±êÐéÏß:±ê×¼Öµ
    DrawLine(64, 255, 71, 0, blue, red, linedot, 1);     //»­×Ý×ø±êÐéÏß:ÏÂÏÞÖµ
    DrawLine(64, 322, 71, 0, blue, red, linedot, 1);     //»­×Ý×ø±êÐéÏß:ÏÂÏÞÖµ
    
    SetMonomerVolType();
    
    DSP8x11Value(1, 2, monomerhighvol2, "", 8, 12, 50, blue, green7);//»­×Ý×ø±ê¿Ì¶È:ÉÏÏÞÖµ
    DSP8x11Value(1, 2, monomerhighvol1, "", 8, 12, 117, blue, green7);//»­×Ý×ø±ê¿Ì¶È:ÉÏÏÞÖµ
    DSP8x11Value(1, 2, MonomervolType, "", 8, 12, 184, blue, yellow); //»­×Ý×ø±ê¿Ì¶È:±ê×¼Öµ
    DSP8x11Value(1, 2, monomerlowvol1, "", 8, 12, 251, blue, red);     //»­×Ý×ø±ê¿Ì¶È:ÏÂÏÞÖµ
    DSP8x11Value(1, 2, monomerlowvol2, "", 8, 12, 318, blue, red);     //»­×Ý×ø±ê¿Ì¶È:ÏÂÏÞÖµ
    
    UpdateSVGraph(GB_FBO_Data.SingleVol);
}
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
unsigned int GetRectValue(const unsigned int vol, const unsigned int voltype)
{
    unsigned int res = 0;
    //------------ Í¼ÐÎ×î´ó¸ß¶È280 -----------
    switch(voltype)
    {
        case 1:    if(vol >= 779)//¼ÓÈë1.2Vµç³Øµ²
                {
                    res = (vol-779) / 3;
                }
                break;
        case 2:    if(vol >= 1579)
                {
                    res = (vol-1579) / 3;
                }
                break;
        case 6: if(vol >= 4737)
                {
                    res = (vol-4737) / 9;
                }
                break;
        case 12:if(vol >= 9474)
                {
                    res = (vol-9474) / 18;
                }
                break;
        default:break;
    }
    
    if(res > 280)
        res = 280;
    
    return res;
}
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
void UpdateSVGraph(const unsigned int *voldata)
{
    unsigned char Fcolor;
    unsigned int from_index = MonomerIndex;
    unsigned char group = MonomerIndex/GetEachGroupBattSum();
 
    PageMonomerSum = GetEachGroupBattSum() - (MonomerIndex%GetEachGroupBattSum());
    if(PageMonomerSum > 24)
        PageMonomerSum = 24;
    
    UpdateMaxMinVol();
    
    for(unsigned char n=0; n<24; n++)
    {
        unsigned int res;
        unsigned int oringinres;
        if(n < PageMonomerSum)
        {
            res = GetRectValue(voldata[from_index+n], MonomervolType/100);
            if(voldata[from_index+n] <= GetMonomerMinVol(group))
                Fcolor = red;
            else if(voldata[from_index+n] >= GetMonomerMaxVol(group))
                Fcolor = green7;
            else Fcolor = yellow;
            
            oringinres = GetRectValue(OringinMonomerVol[from_index+n], MonomervolType/100);
            
            if(GB_SYS_State.TestType == TestTypeDischarge)
            {
                DrawARect(72+23*n, 328, res, blue, Fcolor);
                if(res <= oringinres)
                {
                    DrawARect(72+23*n, 328-res, oringinres-res, blue, purple);
                    DrawARect(72+23*n, 328-oringinres, 280-oringinres, blue, blue);
                }
                else DrawARect(72+23*n, 328-res, 280-res, blue, blue);
            }
            else
            {
                DrawARect(72+23*n, 328, oringinres, blue, purple);
                if(res >= oringinres)
                {
                    DrawARect(72+23*n, 328-oringinres, res-oringinres, blue, Fcolor);
                    DrawARect(72+23*n, 328-res, 280-res, blue, blue);
                }
                else DrawARect(72+23*n, 328-oringinres, 280-oringinres, blue, blue);
            }    
        }    
        else DrawARect(72+23*n, 328, 280, blue, blue);
    }
 
    for(unsigned char n=1; n<5; n++)
    {
        DSP24x24StrS(SVPNumber, 10, 16, 59+23*(n*5-1), 339, blue, white);//NO
        DSP8x11Value(2, 0, n*5+(MonomerIndex%GetEachGroupBattSum()), " ", 8, 76+23*(n*5-1), 340, blue, white); //»­ºá×ø±ê¿Ì¶ÈÖµ
    }
}
//--------------------------------------------------------------------------------------------------
/********************************* END OF FILE (SingleVol.c)***************************************/
//--------------------------------------------------------------------------------------------------