📄 funclcd.c
字号:
}
else
{
Status_Beep();
}
}
}
//===========================================================================================
// 子菜单处理事件
//===========================================================================================
//系统设置菜单处理,菜单序号:0
//Function: Simple_Lanague,TaiWan_Lanague,English_Lanague
//Description: Display System infomation
//Parameters: NO.
//Call: HzDisplay,Msingle_font_pattern,Display_Pic
//Returns: NO.
//=================================================
//背光设置
void LcdLightProc(void)
{
bool First_bool = FALSE;
uint8 inum = 0;
uint8 tempv = 0;
uint8 tcol = 72;
uint8 KeyTempValue;
Display_Line(2,0,8,0,ShowTip[3]);
Delay_Ret(T0_6S);
while(1)
{
Msingle_font_pattern(English_Offset[Light_DelayTime/10], 4, tcol, 1);
Msingle_font_pattern(English_Offset[Light_DelayTime%10], 4, tcol+8, 1);
if(ret_Flag)
{
ClearRAM(0,8);
break;
}
KeyTempValue=KeyScan();
if(KeyTempValue==NOKEY_PRESS)
continue;
NoDelay_Ret();
Light_On();
if(KeyTempValue==PAGEUP)
{
Light_DelayTime++;
if(Light_DelayTime>60)Light_DelayTime=0x00;
}
else if(KeyTempValue==PAGEDOWN)
{
if(Light_DelayTime==0x00)Light_DelayTime=60;
Light_DelayTime--;
}
else if(KeyTempValue==ENTER)
{
if (Light_DelayTime==T0_NOUSE)
{
LightOnOff = FALSE;
Light_DT = 0x00;
}
else
{
LightOnOff = TRUE;
Light_DT = (uint16)((Light_DelayTime*100));
Light_DT = Light_DT/TIME_VMS;
}
//保存数据
W_ByteToDS1302_RAM(Light_RAMAddr,Light_DelayTime);
}
else if(KeyTempValue==BACK)
{
ClearRAM(0,8);
return;
}
else
{ //按键无效
Status_Beep();
}
}
}
//===========================================================================================
//按键音设置
void BeepProc(void)
{
uint8 keyTempValue;
uint8 Key_Flag=0x01;
HzDisplay(kai,0,32,1);
HzDisplay(guan,2,32, 0);
Delay_Ret(T0_6S);
while(1)
{
if(ret_Flag)
{
ClearRAM(0,8);
break;
}
keyTempValue=KeyScan();
if(keyTempValue==NOKEY_PRESS)
continue;
NoDelay_Ret();
Light_On();
if(keyTempValue==PAGEUP)
{
Key_Flag=BEEP_OPEN;
HzDisplay(kai,0,32,1);
HzDisplay(guan,2,32, 0);
}
else if(keyTempValue==PAGEDOWN)
{
Key_Flag=BEEP_CLOSE;
HzDisplay(kai,0,32,0);
HzDisplay(guan,2,32, 1);
}
else if(keyTempValue==ENTER)
{
//保存
W_ByteToDS1302_RAM(Beep_RAMAddr,Key_Flag); //按键音关
if(Key_Flag==BEEP_OPEN)
BeepOnOff=TRUE;
else
BeepOnOff=FALSE;
}
else if(keyTempValue==BACK)
{
//返回上一级菜单
ClearRAM(0,8);
return;
}
else
{
//按键无效
Status_Beep();
}
}
}
//删除打铃点
void DelTimer()
{
uint8 kv,temp=0,TimerCount;
Display_Line(0,16,6,0,ShowTip[8]);
Display_Line(4,32,3,0,ShowTip[5]);
TimerCount=EepromRead(Timers);
Delay_Ret(T0_6S);
while(1)
{
if(ret_Flag)
{
ClearRAM(0,8);
break;
}
Msingle_font_pattern (English_Offset[temp/10],4,88,1);
Msingle_font_pattern (English_Offset[temp%10],4,96,1);
kv=KeyScan();
if(kv==NOKEY_PRESS)continue;
NoDelay_Ret();
Light_On();
switch(kv)
{
case MOVE:
break;
case ESC:
ClearRAM(0,8);
return;
case ENTER://要加提示,目前未加
if(temp==37)
{//清除所有设定点数
for(temp=0x10;temp<160;temp++)
{
EepromWrite(temp,0x00);
TimerArray[temp].BitEnable=0x11;
}
temp=0x00;
}
else
{//清除指定点数
TimerArray[temp].BitEnable=0x11;
}
break;
default:
if(kv==PAGEUP)temp++;
else if(kv==PAGEDOWN&&temp>0)temp--;
if(temp>TimerCount)temp=0;
else if(temp<=0)temp=37;
break;
}
}
}
//查看打铃点设置
void ViewTimer()
{
uint8 kv,temp=0,temp0=0,tempp=0,hh,mm,TimerCount,tt;
bit n_flag=1,m_flag=0,h_flag=0,Change_Flag=0;
Display_Line(0,0,6,0,ShowTip[11]);//已设置点数:
TimerCount=EepromRead(Timers);
Msingle_font_pattern (English_Offset[TimerCount/10],0,88,0);
Msingle_font_pattern (English_Offset[TimerCount%10],0,96,0);
hh=TimerArray[0].Hour;
mm=TimerArray[0].Minute;
Delay_Ret(T0_6S);
if(TimerCount==0x00)
{
while(!ret_Flag)
{
if(KeyScan()!=NOKEY_PRESS)break;
}
ClearRAM(0,8);
return;
}
Display_Line(2,16,3,0,ShowTip[5]);
Display_Line(4,16,3,0,ShowTip[9]);
Msingle_font_pattern (mh,4,80,0);
while(1)
{
if(ret_Flag)
{
ClearRAM(0,8);
break;
}
Msingle_font_pattern (English_Offset[tempp/10],2,64,n_flag);
Msingle_font_pattern (English_Offset[tempp%10],2,72,n_flag);
tt=hh>>4&0x0F;
Msingle_font_pattern (English_Offset[tt],4,64,h_flag);
tt=hh&0x0F;
Msingle_font_pattern (English_Offset[tt],4,72,h_flag);
tt=mm>>4&0x0F;
Msingle_font_pattern (English_Offset[tt],4,88,m_flag);
tt=mm&0x0F;
Msingle_font_pattern (English_Offset[tt],4,96,m_flag);
kv=KeyScan();
if(kv==NOKEY_PRESS)continue;
NoDelay_Ret();
Light_On();
ClearRAM(6,8);
switch(kv)
{
case MOVE:
temp0++;
if(temp0>2)temp0=0;
if(temp0==0)
{
n_flag=1;m_flag=0;h_flag=0;
}
else if(temp0==1)
{
n_flag=0;m_flag=0;h_flag=1;
}
else
{
n_flag=0;m_flag=1;h_flag=0;
}
break;
case ESC:
ClearRAM(0,8);
return;
case ENTER://要加提示,目前未加
if(Change_Flag)
{
for(temp=0;temp<TimerCount;temp++)
{
if(TimerArray[temp].Hour==hh&&TimerArray[temp].Minute==mm)
{
TimerArray[temp].BitEnable=0xAA;//恢复打铃
Display_Line(6,16,6,0,ShowTip[6]);//提示打铃已设置
Status_Beep();
goto ViewExit;
}
}
TimerArray[tempp].BitEnable=0xAA;
TimerArray[tempp].Hour=hh;
TimerArray[tempp].Minute=mm;
tempp=TimerValue+TimerCount*3;
EepromWrite(tempp,0xAA);
EepromWrite(tempp+1,hh);
EepromWrite(tempp+2,mm);
}
ViewExit: break;
default:
if(temp0==1)
{
temp=((hh>>4)&0x0F)*10+(hh&0x0F);
}
else if(temp0==2)
{
temp=((mm>>4)&0x0F)*10+(mm&0x0F);
}
else
{
temp=tempp;
}
if(kv==PAGEUP)temp++;
else if(kv==PAGEDOWN&&temp>0)temp--;
if(temp0==0)
{
if(temp>=TimerCount)temp=0;
else if(temp<=0)temp=TimerCount-1;
tempp=temp;
hh=TimerArray[temp].Hour;
mm=TimerArray[temp].Minute;
Change_Flag=0;
}
else if(temp0==1)
{
if(temp>23)temp=0;
else if(temp<=0)temp=23;
hh=temp/10;
hh=((hh<<4)&0xF0)+temp%10;
Change_Flag=1;
}
else
{
if(temp>59)temp=0;
else if(temp<=0)temp=59;
mm=temp/10;
mm=((mm<<4)&0xF0)+temp%10;
Change_Flag=1;
}
break;
}
}
}
//===========================================================================================
//功能函数
//===========================================================================================
//==========================================================
//口令设置菜单处理函数
//菜单序号:5
//Function: Date_Set
// Time_Set
// Auto_Set
//Description: Display System infomation
//Parameters: NO.
//Call: HzDisplay,Msingle_font_pattern,Display_Pic
//Returns: NO.
//=================================================
//口令校验
bool PwdCheck(void)
{
bool Pwd_Right=FALSE;
uint8 kv=0;
uint8 kvt[6]={0,0,0,0,0,0};
uint8 pwdtimes=0,tempv=0;
uint8 *fh=space1;
ClearRAM(0,8);
Display_Line(2,0,6,0,ShowTip[2]);
Delay_Ret(T0_6S);
while(1)
{
if(tempv>0)Display_cursor(xinghao,4, 24+tempv*8, 0);
Display_cursor(fh,4, 32+tempv*8, 1);
if(ret_Flag)
{
ClearRAM(0,8);
return FALSE;
}
kv=KeyScan();
if(kv==NOKEY_PRESS)continue;
NoDelay_Ret();
Light_On();
if(kv==ENTER)
{
//口令最长为6位
if(tempv==6)
{
Pwd_Right=TRUE;
for(kv=0;kv<6;kv++)
{
if(kvt[kv]!=PwdChar[kv])
{
Pwd_Right=FALSE;
break;
}
}
}
else
{
Pwd_Right=FALSE;
}
if(!Pwd_Right)
{
PERR:
//显示'口令错误,请重试!'
pwdtimes++;
if(pwdtimes>3)
{
//是否;加一对话框提示?
ClearRAM(0,8);
return FALSE;
}
else
{
ClearRAM(0,8);
Display_Line(3,32,5,0,ShowTip[1]);
}
while(KeyScan()==NOKEY_PRESS)
{
if(ret_Flag)
{
ClearRAM(0,8);
return FALSE;
}
}
ClearRAM(0,8);
Display_Line(2,0,6,0,ShowTip[2]);
fh=space1;
tempv=0;
}
else
{
Beep(1);
return TRUE;
}
}
else if(kv==ESC)
{
ClearRAM(0,8);
return FALSE;
}
else
{
kvt[tempv]=kv;
tempv++;
if(tempv>6)goto PERR;
}
}
}
//打铃程序
void OpenSystem(uint8 hh,uint8 mm)
{
uint8 tempvar,tempvar1,iLoop;
static uint8 LastTimer=0xFF;
tempvar=EepromRead(TimerFlag);
tempvar1=EepromRead(TimerFlag+1);
if(tempvar!=0x55 || tempvar1!=0xAA)return;
tempvar=EepromRead(Timers);
for(iLoop=0;iLoop<tempvar;iLoop++)
{
if(TimerArray[iLoop].BitEnable==0xAA&&
TimerArray[iLoop].Hour==hh&&
TimerArray[iLoop].Minute==mm)
{
if(LastTimer==mm)break;
LastTimer=mm;
BeepLing();
}
}
if(LastTimer!=mm)LastTimer=0xFF;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -