/************************** Copyright (c) **********************************
|
** FUZHOU FUGUANG ELECTRONICS Co.,LTD.
|
** ¸£Öݸ£¹âµç×ÓÓÐÏÞ¹«Ë¾
|
** http://www.fuguang.com
|
**
|
**-------------- File Info -------------------------------------------------
|
** File name: AdjustValuePage.c
|
** Last modified Date: 2008-11-16
|
** Last Version: 1.0
|
** Descriptions: AdjustValuePage functions
|
**
|
**--------------------------------------------------------------------------
|
** 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: AdjustValuePage functions
|
**
|
***************************************************************************/
|
//
|
|
#include "AdjustValuePage.h"
|
#include <avr/pgmspace.h>
|
#include "Delay.h"
|
#include "M64ADC_Driver.h"
|
#include "MessageBox.h"
|
#include "WorkingPage.h"
|
#include "ChargePage.h"
|
#include "CRC16.h"
|
#include "NRF905_Driver.h"
|
#include "SYSSetPage.h"
|
#include "AD7843_Driver.h"
|
#include "TFT_Driver.h"
|
#include "MessageBox.h"
|
#include "KeyBoard_Driver.h"
|
|
|
|
|
extern SYS_State GB_SYS_State;
|
extern FBO_Data GB_FBO_Data;
|
extern unsigned int GB_TestingParm[16];
|
|
#if(SoftLanguage == CN)
|
const prog_uchar AdjVPText[8][5] =
|
{
|
{57, 63,202,203, 59},//²âÁ¿Ð£×¼
|
{83, 84, 56, 86, 59},//ÔÚÏßµçѹ
|
{68, 69, 56, 86, 59},//×é¶Ëµçѹ
|
{54, 56, 56, 82, 59},//·ÅµçµçÁ÷
|
{55, 56, 56, 82, 59},//³äµçµçÁ÷
|
{206,207,56, 82, 59},//ǯ¿ÚµçÁ÷
|
{193,194,57, 63, 59},//ζȲâÁ¿
|
{ 70, 71,56, 86, 59},//µ¥Ìåµçѹ
|
};
|
//
|
|
const prog_uchar AdjMonomerVolResText[3][9] =
|
{
|
{70, 71, 56, 86, 202, 203, 219, 220, 137},//µ¥ÌåµçѹУ׼³É¹¦!
|
{70, 71, 56, 86, 202, 203, 221, 222, 137},//µ¥ÌåµçѹУ׼ʧ°Ü!
|
{143,144,70, 71, 158, 159, 221, 222, 137},//Á¬½Óµ¥ÌåÄ£¿éʧ°Ü£¡
|
};
|
//
|
|
const prog_uchar AdjVPButtonItem[10][2] =
|
{
|
{ 54, 56},//·Åµç
|
{ 55, 56},//³äµç
|
{ 80, 81},//Í£Ö¹
|
{ 99, 100},//Ó¦ÓÃ
|
{ 52, 53},//Í˳ö
|
{ 97, 98},//È¡Ïû
|
{115, 101},//-
|
{114, 101},//+
|
{202, 203},//У׼
|
{ 50, 51},//Ñ¡Ôñ
|
};
|
//
|
#else
|
const prog_uchar AdjVPText[8][13] =
|
{
|
{103,59,71,68,60,76,74,61,70,59}, //²âÁ¿Ð£×¼10
|
{0}, //ÔÚÏßµçѹ
|
{106,59,75,76,14,62,76,79,75,75,87,26}, //×é¶Ëµçѹ12
|
{111,74,70,0,76,59,67,76,91,63,59,26}, //·ÅµçµçÁ÷12
|
{111,74,70,0,67,59,76,91,63,59,26}, //³äµçµçÁ÷11
|
{111,74,70,0,70,71,64,85,64,69,26}, //ǯ¿ÚµçÁ÷11
|
{111,64,72,75,64,76,59,78,79,76,59,26}, //ζȲâÁ¿
|
{106,59,75,76,14,89,71,26}, //µ¥Ìåµçѹ8
|
};
|
//
|
|
const prog_uchar AdjMonomerVolResText[3][45] =
|
{
|
{103,59,71,68,60,76,74,61,70,59,0,73,59,75,76,91,66,64,73,68,91,0,89,71,64,72,64,73,78,59,0,61,87,75,74,71,73,64,73,59,1},
|
//"Calibrate battvol succeed!",µ¥ÌåµçѹУ׼³É¹¦!41
|
{103,59,71,68,60,76,74,61,70,59,0,73,59,75,76,91,66,64,73,68,91,0,89,71,64,72,64,73,78,59,0,73,64,0,61,87,75,74,71,73,64,73,59,1},
|
//"Faild to calibrate battvol!",µ¥ÌåµçѹУ׼ʧ°Ü!44
|
{108,76,74,61,64,76,88,0,75,74,63,70,71,90,83,64,73,68,64,0,77,64,73,77,74,76,59,1},
|
//"wireless module error!",Á¬½Óµ¥ÌåÄ£¿éʧ°Ü£¡28
|
};
|
//
|
|
const prog_uchar AdjVPButtonItem[10][9] =
|
{
|
{109,59,67,76,91,63}, //·Åµç5
|
{105,74,73,68,78,74,76},//³äµç7
|
{110,78,74,75}, //Í£Ö¹4
|
{110,74,81,76,59,73}, //Ó¦ÓÃ6
|
{94,87,81,74,63}, //Í˳ö5
|
{107,78,72,64,73,59}, //È¡Ïû6
|
{13},//-
|
{11},//+
|
{103,59,71,68,60,76}, //У׼6
|
{101,67,72,64,73,68,78,88}, //ÐÞ¸Ä8
|
};
|
//
|
const prog_uchar APNumber[] =
|
{
|
"#",//No
|
};
|
|
const prog_uchar APAlarm[2][50] =
|
{
|
{59,61,78,74,72,59,78, 0,61,87,70,71,1},//¶Ï·Æ÷ÒѶϿª
|
{108,74,66,59,71,79,69,77,78,59,12,61,70,71,90,83,68,78,64,0,59,61,78,74,72,59,78,0,38,16,12,38,17,1},
|
//"Please Turn ON The Switch F1!", //Çë±ÕºÏ¶Ï·Æ÷F1!--31+3
|
};
|
//
|
#endif
|
//
|
|
|
static unsigned char (*AdjVPParentPage)(void) = DSPAdjVPage;
|
static unsigned char (*AdjVPChildPage)(void) = DSPAdjVPage;
|
static unsigned char AdjItemIndex = 0; //µ±Ç°´¦ÓÚУ׼µÄÏîÄ¿
|
static unsigned char AdjVPWorkState = AdjVPStopped; //±¾Ò³Ã湤×÷״̬(·Åµç,³äµç,Í£Ö¹)
|
static unsigned char AdjMonomerIndex = 0; //У׼µÄµ¥ÌåË÷Òý
|
static unsigned int TempAdjValue = 1024; //У׼Êý¾Ý»º´æÆ÷
|
static unsigned int AdjMonomerVol = 0; //±»Ð£×¼µÄµ¥ÌåÕæÊµÖµ
|
|
|
//----------------------- ÏÔʾ¸Ã½çÃæ ---------------------------------------
|
unsigned char DSPAdjVPage(void)
|
{
|
DisableCustomInput();
|
if(AdjVPChildPage != GB_SYS_State.CurrentPage)//ÅжÏÊÇ·ñ´Ó×ÓÒ³Ãæ·µ»Ø
|
{
|
AdjVPParentPage = GB_SYS_State.CurrentPage;
|
}
|
GB_SYS_State.CurrentPage = DSPAdjVPage;
|
GB_SYS_State.GetInput = GetAdjVPageButtonDown;
|
|
AdjItemIndex = 0;
|
if(AdjMonomerIndex > GB_FBO_Data.BattSum-1)
|
{
|
AdjMonomerIndex = GB_FBO_Data.BattSum-1;
|
}
|
if(GB_FBO_Data.BattSum == 0)
|
{
|
AdjMonomerIndex = 0;
|
}
|
|
AdjMonomerVol = GB_FBO_Data.SingleVol[AdjMonomerIndex];
|
|
DSP16x24Str(AdjVPText[0], 10, 16, 24, 16, blue, yellow);
|
#if(SoftLanguage == CN)
|
DrawLine(24, 42, 12, 0, blue, white, linebold, 2);
|
#else
|
DrawLine(24, 42, 20, 0, blue, white, linebold, 2);
|
#endif
|
|
DrawAdjVPageText(AdjItemIndex);
|
|
UpdateAdjVPValue();
|
DrawAdjVPControlButton(AdjItemIndex, AdjVPWorkState);
|
|
//InitDisChargePower();20151021 È¥µô
|
SetPowerSwitchEnabled();
|
|
return 0;
|
}
|
//
|
|
//------------------------ ÏÔʾµ±Ç°µçÁ÷µçѹֵ ---------------------------------------
|
void UpdateAdjVPValue(void)
|
{
|
//###################### Çë×¢ÒâÔ¤±àÒëÇø ####################################
|
#if(MashineType == FBO48CT)
|
PrintValue(1, 1, GetOnlineVol(), "B", 16, 280, 96, blue, white); //ÔÚÏßµçѹ
|
#endif
|
//###################### Çë×¢ÒâÔ¤±àÒëÇø ####################################
|
|
PrintValue(1, 1, GetInnerSumVol(), " B", 16, 280, 128, blue, white);//×é¶Ëµçѹ
|
PrintValue(1, 1, GetDisChargeI(), " A", 16, 280, 160, blue, white); //·ÅµçµçÁ÷
|
PrintValue(1, 1, GetChargeI(), " A", 16, 280, 192, blue, white); //³äµçµçÁ÷
|
PrintValue(1, 1, GetExternalI(), " A", 16, 280, 224, blue, white); //ǯ¿ÚµçÁ÷
|
DSPTemperature(280, 256, white); //ζȼì²â
|
GetAndDSPMonomerVol(AdjMonomerIndex, AdjMonomerVol); //µ¥Ìåµçѹ
|
}
|
//
|
|
|
//------------------------ µ¥ÌåµçѹÏÔʾºÍУ׼ ------------------------------
|
void GetAndDSPMonomerVol(const unsigned char index, const unsigned int vol)
|
{
|
DSP24x24Str(APNumber, 10, 16, 260, 288, blue, white);//NO
|
PrintValue(2, 0, index+1, "-", 16, 280, 288, blue, white);//000#
|
PrintValue(0, 3, vol, " B", 16, 350, 288, blue, white); //000#
|
}
|
unsigned char ExeAdjMonomerVol(const unsigned char index, const unsigned int vol)
|
{
|
unsigned char TX_ADDR[4] = {0xAB,0xCD,0x00,0x00}; //slave addr
|
RFData m_RFDataTX,m_RFDataRX;
|
unsigned char error = 0;
|
// unsigned char fcolor = green7;
|
unsigned int TXmoduladdr = 0;
|
// unsigned int RXmoduladdr = 0;
|
unsigned char ModifyIndex = 0;
|
|
ModifyIndex = index%4; //µ¥ÌåÄ£¿éÖеĵ¥ÌåºÅ
|
|
TXmoduladdr = index/4 + 1;//µ¥ÌåÄ£¿éµØÖ·
|
|
TX_ADDR[3] = (unsigned char)TXmoduladdr;
|
TX_ADDR[2] = (unsigned char)(TXmoduladdr>>8);
|
|
m_RFDataTX.Addr[0] = 0xAB;
|
m_RFDataTX.Addr[1] = 0xCD;
|
m_RFDataTX.Addr[2] = 0xFF;
|
m_RFDataTX.Addr[3] = GetMasterADDR();
|
m_RFDataTX.CMD = 0x00A3;
|
|
m_RFDataTX.VolData[0] = 0;
|
m_RFDataTX.VolData[1] = 0;
|
m_RFDataTX.VolData[2] = 0;
|
m_RFDataTX.VolData[3] = 0;
|
if(GetMonomerOrder() == 0) //µ¥ÌåÄ£¿éµç³ØË³Ðò:½µÐò
|
{
|
m_RFDataTX.VolData[0] = GB_FBO_Data.SingleVol[(TXmoduladdr-1)*4];
|
m_RFDataTX.VolData[1] = GB_FBO_Data.SingleVol[(TXmoduladdr-1)*4+1];
|
m_RFDataTX.VolData[2] = GB_FBO_Data.SingleVol[(TXmoduladdr-1)*4+2];
|
m_RFDataTX.VolData[3] = GB_FBO_Data.SingleVol[(TXmoduladdr-1)*4+3];
|
|
if(((index/4)%GetEachGroupModule()) != (GetEachGroupModule()-1))//²»ÊÇ×îºóÒ»¸öµ¥ÌåÄ£¿é
|
m_RFDataTX.VolData[ModifyIndex] = vol;
|
else
|
{
|
switch(GetEachGroupBattSum() % 4)
|
{
|
case 0: m_RFDataTX.VolData[ModifyIndex] = vol; break;
|
case 1: m_RFDataTX.VolData[3+ModifyIndex] = vol; break;
|
case 2: m_RFDataTX.VolData[2+ModifyIndex] = vol; break;
|
case 3: m_RFDataTX.VolData[1+ModifyIndex] = vol; break;
|
}
|
}
|
}
|
else //µ¥ÌåÄ£¿éµç³ØË³Ðò:ÉýÐò
|
{
|
m_RFDataTX.VolData[3] = GB_FBO_Data.SingleVol[(TXmoduladdr-1)*4];
|
m_RFDataTX.VolData[2] = GB_FBO_Data.SingleVol[(TXmoduladdr-1)*4+1];
|
m_RFDataTX.VolData[1] = GB_FBO_Data.SingleVol[(TXmoduladdr-1)*4+2];
|
m_RFDataTX.VolData[0] = GB_FBO_Data.SingleVol[(TXmoduladdr-1)*4+3];
|
m_RFDataTX.VolData[3-ModifyIndex] = vol;
|
}
|
|
error = ExchangeMonomerData(TX_ADDR, &m_RFDataTX, &m_RFDataRX);
|
if(error == 0)
|
{
|
GB_FBO_Data.SingleVol[AdjMonomerIndex] = AdjMonomerVol;
|
}
|
|
//---------------- ÏÔʾµ¥ÌåµçѹУ׼½á¹û --------------------------------
|
if(error > 0)
|
{
|
BuzzerBeep(500);
|
}
|
AdjVPChildPage = DSPMessageBoxNull;
|
if(error == 0)
|
DSPMessageBox1(AdjMonomerVolResText[error], 41, MB_OK, BeepNull);
|
else if(error == 1)
|
DSPMessageBox1(AdjMonomerVolResText[error], 44, MB_OK, BeepNull);
|
else
|
DSPMessageBox(AdjMonomerVolResText[error], 28, MB_OK, BeepNull);
|
return error;
|
}
|
//
|
|
//------------------------- »æÖÆ´¥ÃþÆÁ°´Å¥ ---------------------------------
|
void DrawAdjVPControlButton(const unsigned char index, const unsigned char state)
|
{
|
unsigned char fcl = white;
|
|
if(state == AdjVPStopped)
|
{
|
DrawButtonH48(2, AdjVPButtonItem[0], 6, 14, 4, 24, 400, gray1, white); //·Åµç
|
//###################### Çë×¢ÒâÔ¤±àÒëÇø ############################
|
#if(MashineType == FBO48CT)
|
DrawButtonH48(2, AdjVPButtonItem[1], 2, 30, 23, 149, 400, gray1, white); //³äµç
|
#else
|
DrawButtonH481(2, AdjVPButtonItem[1], 7, 12, 5, 149, 400, gray1, gray2); //³äµç
|
#endif
|
//###################### Çë×¢ÒâÔ¤±àÒëÇø ############################
|
DrawButtonH48(2, AdjVPButtonItem[2], 4, 14, 17, 274, 400, gray1, gray2); //Í£Ö¹
|
}
|
else
|
{
|
DrawButtonH48(2, AdjVPButtonItem[0], 6, 14, 4, 24, 400, gray1, gray2); //·Åµç
|
DrawButtonH481(2, AdjVPButtonItem[1], 7, 12, 5, 149, 400, gray1, gray2); //³äµç
|
DrawButtonH48(2, AdjVPButtonItem[2],4, 14, 17, 274, 400, gray1, white); //Í£Ö¹
|
}
|
|
DrawButtonH48(2, AdjVPButtonItem[4], 5, 14, 10, 524, 400, gray1, red); //Í˳ö
|
|
if(AdjItemIndex > 0)
|
fcl = white;
|
else fcl = gray2;
|
|
DrawButtonH48(2, AdjVPButtonItem[5], 6, 14, 1, 524, 306, gray1, fcl); //È¡Ïû
|
DrawButtonH48(2, AdjVPButtonItem[6], 1, 30, 40, 524, 220, gray1, fcl); //-
|
DrawButtonH48(2, AdjVPButtonItem[7], 1, 30, 40, 524, 134, gray1, fcl); //+
|
|
if(AdjItemIndex == 0)
|
{
|
DrawButtonH48(2, AdjVPButtonItem[8], 6, 14, 6, 524, 48, gray1, white); //ÐÞ¸Ä
|
DrawButtonH48(2, AdjVPButtonItem[3], 6, 14, 3, 399, 400, gray1, gray2); //Ó¦ÓÃ
|
}
|
else
|
{
|
DrawButtonH481(2, AdjVPButtonItem[9], 8, 11, 2, 524, 48, gray1, white); //Ñ¡Ôñ
|
DrawButtonH48(2, AdjVPButtonItem[3], 6, 14, 3, 399, 400, gray1, white); //Ó¦ÓÃ
|
}
|
}
|
|
void DrawAdjVPageText(const unsigned char index)
|
{
|
for(unsigned char n=0; n<7; n++)
|
{
|
//###################### Çë×¢ÒâÔ¤±àÒëÇø ############################
|
#if(MashineType == FBO48CT)
|
if((n+1 == index) || ((index==8)&&(n==6)))
|
DSP24x24Str(AdjVPText[n+1], 5, 24, 160,96+32*n, white, blue);
|
else DSP24x24Str(AdjVPText[n+1], 5, 24, 160,96+32*n, blue, green7);
|
#else
|
if(n > 0)
|
{
|
if((n+1 == index) || ((index==8)&&(n==6)))
|
DSP16x24Str(AdjVPText[n+1], 12, 16, 60,96+32*n, white, blue);
|
else DSP16x24Str(AdjVPText[n+1], 12, 16, 60,96+32*n, blue, green7);
|
}
|
#endif
|
//###################### Çë×¢ÒâÔ¤±àÒëÇø ############################
|
}
|
//------------------ »æÖÆÏ»®Ïß ---------------------------
|
DrawLine(280, 314, 24, 0, blue, blue, linebold, 2);
|
if(index == 7)
|
{
|
DrawLine(280, 314, 8, 0, blue, green7, linebold, 2);
|
}
|
else if(index == 8)
|
{
|
DrawLine(360, 314, 14, 0, blue, green7, linebold, 2);
|
}
|
}
|
//
|
|
//------------------------ »ñÈ¡ºÍ´¦Àí°´Å¥ÊäÈë ------------------------------
|
void GetAdjVPageButtonDown(void)
|
{
|
static unsigned char lastkey = ButtonNull;
|
static unsigned char getlastkeycount = 0;
|
static unsigned int schedule = 0;
|
unsigned char touched_item;
|
|
schedule++;
|
|
//------------- ÔÚУ׼·ÅµçµçÁ÷¹ý³ÌÖÐÎȶ¨·ÅµçµçÁ÷ -----------------------
|
if((AdjVPWorkState==AdjVPDischarge) && ((schedule%16)==0))
|
{
|
//ControlCurrent(GB_FBO_Data.SumCurrent, GB_TestingParm[4]*10);
|
ControlCurrent(GB_FBO_Data.SumCurrent, GB_FBO_Data.SumVoltage);
|
}
|
|
if((schedule%128) == 0)
|
{
|
UpdateAdjVPValue();
|
}
|
|
touched_item = GetTouchLocal();
|
|
if(touched_item == ButtonNull) //Èç¹û°´¼üΪ¿ÕÔòÖ±½Ó·µ»Ø;
|
{
|
lastkey = ButtonNull;
|
if(getlastkeycount > 0)
|
{
|
getlastkeycount = 0;
|
}
|
return;
|
}
|
else if(touched_item != lastkey)//Èç¹ûµ±Ç°°´¼üÓëÉÏÒ»¸ö°´¼ü²»Ïàͬ;
|
{
|
getlastkeycount = 0; //ÇåÁãÁ¬Ðø°´¼üµÄ¼ÆÊý;
|
}
|
lastkey = touched_item;
|
if(getlastkeycount < 40) //ÉèÖÃÁ¬Ðø°´¼üµÄ¼ÆÊý²»´óÓÚ40;
|
getlastkeycount++;
|
|
//--------------- Èç¹ûûÓÐÏîÄ¿´¦ÓÚУ׼״̬,½ûÓÃÏà¹Ø°´Å¥ ----------------
|
if(AdjItemIndex == 0)
|
{
|
if((touched_item==Button3) || (touched_item==Button5)
|
|| (touched_item==Button6) || (touched_item==Button7))
|
{
|
return;
|
}
|
}
|
|
//---------------------- "·Åµç"¼ü --------------------------
|
if((touched_item==Button0) && (AdjVPWorkState==AdjVPStopped))
|
{
|
if(GetButtonIsBeep(0) == BeepIsWork)
|
BuzzerBeep(100);
|
|
SetPowerSwitchEnabled();
|
AdjVPChildPage = DSPMessageBoxNull;
|
DSPMessageBox1(APAlarm[1],34, MB_OK, BeepNull);
|
|
if(ROK5_1)
|
{
|
SetPowerSwitchDisabled();
|
AdjVPChildPage = DSPMessageBoxNull;
|
DSPMessageBox(APAlarm[0], 13, MB_OK, FDMonomerVolLimit);
|
return;
|
}
|
GB_SYS_State.TestType = TestTypeDischarge; //ÉèÖòâÊÔÀàÐÍΪ·Åµç
|
AdjVPWorkState = AdjVPDischarge;
|
OpenDisChargePower(Stopped);
|
DrawAdjVPControlButton(AdjItemIndex, AdjVPWorkState);
|
_delay_ms(100);
|
}
|
|
//###################### Çë×¢ÒâÔ¤±àÒëÇø ############################
|
#if(MashineType == FBO48CT)
|
//---------------------- "³äµç"¼ü --------------------------
|
else if((touched_item==Button1) && (AdjVPWorkState==AdjVPStopped))
|
{
|
if(GetButtonIsBeep(0) == BeepIsWork)
|
BuzzerBeep(100);
|
GB_SYS_State.TestType = TestTypeCharge; //ÉèÖòâÊÔÀàÐÍΪ³äµç
|
AdjVPWorkState = AdjVPCharge;
|
OpenChargePower(CPLargeCharging);
|
DrawAdjVPControlButton(AdjItemIndex, AdjVPWorkState);
|
_delay_ms(100);
|
}
|
#endif
|
//###################### Çë×¢ÒâÔ¤±àÒëÇø ############################
|
|
//---------------------- "Í£Ö¹"¼ü --------------------------
|
else if((touched_item==Button2) && (AdjVPWorkState!=AdjVPStopped))
|
{
|
if(GetButtonIsBeep(0) == BeepIsWork)
|
BuzzerBeep(100);
|
if(AdjVPWorkState == AdjVPDischarge)
|
{
|
CloseDisChargePower(Stopped);
|
}
|
else
|
{
|
CloseChargePower();
|
}
|
AdjVPWorkState = AdjVPStopped;
|
DrawAdjVPControlButton(AdjItemIndex, AdjVPWorkState);
|
_delay_ms(100);
|
return;
|
}
|
//--------------------- "Ó¦ÓÃ"¼ü ---------------------------
|
else if((touched_item==Button3) && (AdjItemIndex>0))
|
{
|
if(GetButtonIsBeep(0) == BeepIsWork)
|
BuzzerBeep(100);
|
if(AdjItemIndex < 7)
|
{
|
SetADCAdjustValue(AdjItemIndex+1, TempAdjValue, 1);
|
AdjItemIndex = 0;
|
}
|
else
|
{
|
ExeAdjMonomerVol(AdjMonomerIndex, AdjMonomerVol);
|
}
|
|
DrawAdjVPageText(AdjItemIndex);
|
DrawAdjVPControlButton(AdjItemIndex, AdjVPWorkState);
|
_delay_ms(100);
|
}
|
//--------------------- "Í˳ö"¼ü ---------------------------
|
else if(touched_item == Button4)
|
{
|
if(GetButtonIsBeep(0) == BeepIsWork)
|
BuzzerBeep(100);
|
AdjItemIndex = 0;
|
GetADCAdjustValue(0, 1); //»Ö¸´ÔУ׼ֵ
|
if(AdjVPWorkState == AdjVPDischarge)
|
{
|
CloseDisChargePower(Stopped);
|
}
|
else if(AdjVPWorkState == AdjVPCharge)
|
{
|
CloseChargePower();
|
}
|
AdjVPWorkState = AdjVPStopped;
|
BackColorCH();
|
AdjVPParentPage();
|
AdjVPParentPage = DSPAdjVPage; //»Ö¸´¸¸Ò³ÃæÖ¸ÕëΪ×Ô¼ºµÄÒ³Ãæ
|
|
SetPowerSwitchDisabled();
|
return;
|
}
|
//-------------- "ÐÞ¸Ä/Ñ¡Ôñ" -------------------------------
|
else if(touched_item == Button8)
|
{
|
if(GetButtonIsBeep(0) == BeepIsWork)
|
BuzzerBeep(100);
|
|
//###################### Çë×¢ÒâÔ¤±àÒëÇø ############################
|
#if(MashineType == FBO48CT)
|
AdjItemIndex++;
|
if(AdjItemIndex >= 9)
|
AdjItemIndex = 1;
|
#else
|
if(AdjItemIndex == 0)
|
AdjItemIndex = 2;
|
else AdjItemIndex++;
|
if(AdjItemIndex >= 9)
|
AdjItemIndex = 2;
|
#endif
|
//###################### Çë×¢ÒâÔ¤±àÒëÇø ############################
|
if(AdjItemIndex < 7)
|
{
|
TempAdjValue = GetADCAdjustValue(AdjItemIndex+1, 0);//»ñÈ¡µ±Ç°Ð£×¼²ÎÊý
|
}
|
DrawAdjVPageText(AdjItemIndex);
|
DrawAdjVPControlButton(AdjItemIndex, AdjVPWorkState);
|
_delay_ms(100);
|
}
|
//---------------- "+1"¼ü ----------------------------------
|
else if(touched_item == Button7)
|
{
|
if(getlastkeycount == 1)
|
{
|
if(GetButtonIsBeep(0) == BeepIsWork)
|
BuzzerBeep(100);
|
if(AdjItemIndex < 7)
|
{
|
if(TempAdjValue > 796)
|
TempAdjValue--;
|
|
SetADCAdjustValue(AdjItemIndex+1, TempAdjValue, 0);
|
}
|
else if((AdjItemIndex==7) && (GB_FBO_Data.BattSum>0))
|
{
|
if(AdjMonomerIndex++ >= GB_FBO_Data.BattSum-1)
|
AdjMonomerIndex = 0;
|
|
AdjMonomerVol = GB_FBO_Data.SingleVol[AdjMonomerIndex];
|
}
|
else if(AdjItemIndex == 8)
|
{
|
if(AdjMonomerVol < 16000)
|
AdjMonomerVol++;
|
}
|
|
UpdateAdjVPValue();
|
}
|
if(getlastkeycount >= 4)
|
{
|
getlastkeycount = 0;
|
return;
|
}
|
}
|
//---------------- "-1"¼ü ---------------------------------
|
else if(touched_item == Button6)
|
{
|
if(getlastkeycount == 1)
|
{
|
if(GetButtonIsBeep(0) == BeepIsWork)
|
BuzzerBeep(100);
|
if(AdjItemIndex < 7)
|
{
|
if(TempAdjValue < 1252)
|
TempAdjValue++;
|
|
SetADCAdjustValue(AdjItemIndex+1, TempAdjValue, 0);
|
}
|
else if((AdjItemIndex==7) && (GB_FBO_Data.BattSum>0))
|
{
|
if(AdjMonomerIndex-- <= 0)
|
AdjMonomerIndex = GB_FBO_Data.BattSum-1;
|
|
AdjMonomerVol = GB_FBO_Data.SingleVol[AdjMonomerIndex];
|
}
|
else if(AdjItemIndex == 8)
|
{
|
if(AdjMonomerVol > 1600)
|
AdjMonomerVol--;
|
}
|
|
UpdateAdjVPValue();
|
}
|
if(getlastkeycount >= 4)
|
{
|
getlastkeycount = 0;
|
return;
|
}
|
}
|
//------------------- "È¡Ïû"¼ü -----------------------------
|
else if(touched_item == Button5)
|
{
|
if(GetButtonIsBeep(0) == BeepIsWork)
|
BuzzerBeep(100);
|
AdjItemIndex = 0;
|
DrawAdjVPageText(AdjItemIndex);
|
GetADCAdjustValue(AdjItemIndex, 1);//»Ö¸´ÔУ׼ֵ
|
DrawAdjVPControlButton(AdjItemIndex, AdjVPWorkState);
|
_delay_ms(100);
|
}
|
|
if(getlastkeycount == 0)
|
{
|
_delay_ms(150);//ÑÓʱ100msºóÍ˳ö,ÒÔÃâ°´¼üË«»÷Ì«¿ì
|
}
|
}
|
//
|
unsigned int GetAdjVPWorkState(void)
|
{
|
return AdjVPWorkState;
|
}
|