📄 menu_task_motor.c
字号:
Lcd_Draw_Echar(char_buf2,44,2+i*14,1);
}
}
Lcd_Display_Executive();
NU_Sleep(200*NU_TICKS);
Delay_Key();
switch(key_current)
{
case 0x55aa:
k=0;
break;
case KESC: return;
case KDOWN:
{
if(value_counter<total_value-1)
{
if(current_y>=2)
{
value_counter++;
current_y=2;
pvalue_disp[0] = pvalue_disp[1];
pvalue_disp[1] = pvalue_disp[2];
pvalue_disp[2] = pvalue[value_counter];
}
else
{
current_y++;
value_counter++;
}
}
}
break;
case KUP:
{
if(current_y<=0)
{
if(value_counter>0)
{
value_counter--;
current_y=0;
pvalue_disp[2]= pvalue_disp[1];
pvalue_disp[1]= pvalue_disp[0];
pvalue_disp[0]= pvalue[value_counter];
}
}
else
{
current_y--;
value_counter--;
}
}
continue;
}
}
}
/********************************************************************************/
/* 修改保护定值子程序 2002-3-22 */
/* 入口: ( ) 出口:无返回值 */
/* 说明: */
/* */
/********************************************************************************/
void Change_Setting()
{
int counter,temp,current_menu;
MENU Sub_Menu[3];
MENU *pMENU;
/*----------- MENU_0 -------------*/
pMENU = (MENU *)&Sub_Menu[0];
pMENU -> menu_index_num = 0;
pMENU -> x_offset = ICON_X0;
pMENU -> y_offset = ICON_Y0;
pMENU -> icon_pointer1 = pIcon8_set_zone;
pMENU -> menu_text = "区号";
pMENU -> menu_help = "[定值区]:修改定值区号";
pMENU -> menu_file = Change_Zone1;
/*----------- MENU_1 -------------*/
pMENU = (MENU *)&Sub_Menu[1];
pMENU -> menu_index_num = 1;
pMENU -> x_offset = ICON_X1;
pMENU -> y_offset = ICON_Y1;
pMENU -> icon_pointer1 = pIcon1_Setting;
pMENU -> menu_text = "定值";
pMENU -> menu_help = "[定值]:查看修改定值";
pMENU -> menu_file = Change_Setting1;
/*----------- MENU_2 -------------*/
pMENU = (MENU *)&Sub_Menu[2];
pMENU -> menu_index_num = 2;
pMENU -> x_offset = ICON_X2;
pMENU -> y_offset = ICON_Y2;
pMENU -> icon_pointer1 = pIcon9_yaban;
pMENU -> menu_text = "压板";
pMENU -> menu_help = "[压板]:压板投退";
pMENU -> menu_file = LP_Status;
current_menu=0;
while(1)
{
Lcd_Clear_Memory();
for(counter=0;counter<3;counter++)
{
pMENU = (MENU *)&Sub_Menu[counter];
if(pMENU->menu_index_num == current_menu)
{
Lcd_Draw_Icon(pMENU->icon_pointer1,pMENU->x_offset,pMENU->y_offset,0);
Lcd_Draw_Cchar(pMENU->menu_text,pMENU->x_offset, pMENU->y_offset+36,1);
Lcd_Draw_Line(pMENU->x_offset,pMENU->y_offset+53,pMENU->x_offset+32,pMENU->y_offset+53,1);
Lcd_Draw_Line(pMENU->x_offset,pMENU->y_offset+54,pMENU->x_offset+32,pMENU->y_offset+54,1);
}
else
{
Lcd_Draw_Icon(pMENU->icon_pointer1,pMENU->x_offset,pMENU->y_offset,1);
Lcd_Draw_Cchar(pMENU->menu_text,pMENU->x_offset, pMENU->y_offset+36,1);
}
}
Lcd_Display_Executive();
Delay_Key();
switch(key_current)
{
case KESC: return;
case KDOWN:
case KRIGHT:
if(current_menu <2)
{
current_menu++;
}
break;
case KUP:
case KLEFT:
if(current_menu)
{
current_menu--;
}
break;
case KCR:
pMENU=(MENU *)&Sub_Menu[current_menu];
(*(pMENU -> menu_file))();
break;
}
}
}
/********************************************************************************/
/* 切换定值区子程序 2002-3-22 */
/* 入口: ( ) 出口:= */
/* 说明: =1--MAXCPUs 模块号 */
/* =QUIT 退出 */
/********************************************************************************/
void Change_Setting1()
{
char *pchar2="查看修改定值";
int temp,zone;
while(1)
{
temp = Password();
if(temp==QUIT)break;
if(temp!=EQU)
{
Message_Error();
continue;
}
else
{
zone=Select_Set_Zone(pchar2);
if(zone==QUIT)break;
if((zone>=0)&&(zone<SETTING_MAX_ZONE))
{
Select_Protect(zone,Select_Sets);
}
break;
}
}
}
void Message_Error()
{
char *pchar1="密码错误";
char *pchar2="请重新输入!";
Lcd_Clear_Memory();
Lcd_Draw_Cchar(pchar1,32,14,1);
Lcd_Draw_Cchar(pchar2,16,34,1);
Lcd_Display_Executive();
NU_Sleep(1000*NU_TICKS);
}
/********************************************************************************/
/* 检查密码子程序 2002-3-22 */
/* 入口: ( ) 出口:无返回值 */
/* 说明: */
/* */
/********************************************************************************/
int Password()
{
char *pchar1="请输入密码:";
int password,current_x,old_x,value;
char pass_buf[6];
current_x=0;
password=0;
value=0;
while(1)
{
Lcd_Clear_Memory();
Lcd_Draw_Cchar(pchar1,16,16,1);
sprintf(pass_buf,"%03d",password);
Lcd_Draw_Echar(pass_buf,52,40,1);
switch(current_x)
{
case 0: Lcd_Draw_Line(69,48,76,48,1);break;
case 1: Lcd_Draw_Line(61,48,67,48,1);break;
case 2: Lcd_Draw_Line(52,48,59,48,1);break;
}
Lcd_Display_Executive();
Delay_Key();
if(key_current==KESC){value=QUIT;break;}
if((key_current==KRIGHT)||(key_current==KDOWN))
{
if(current_x>0)
current_x--;
continue;
}
if((key_current==KLEFT)||(key_current==KUP))
{
if(current_x<2)
current_x++;
continue;
}
if(key_current==KINC)
{
switch(current_x)
{
case 0:
{
password+=1;
break;
}
case 1:
{
password+=10;
break;
}
case 2:
{
password+=100;
break;
}
}
if(password>999)password=999;
continue;
}
if(key_current==KDEC)
{
switch(current_x)
{
case 0:
{
password-=1;
break;
}
case 1:
{
password-=10;
break;
}
case 2:
{
password-=100;
break;
}
}
if(password<0)password=0;
continue;
}
if(key_current==KCR)
{
if(password==(password_backup&0xff))
{
value=EQU;
}
else if(password==FACTORY_PASS)
{
value=HIDE_EQU;
}
else
{
value=NOT_EQU;
}
return(value);
}
}
}
/********************************************************************************/
/* 选择模块号子程序 2002-3-22 */
/* 入口: ( ) 出口:= */
/* 说明: */
/* */
/********************************************************************************/
int Select_Set_Zone(char *pChar)
{
char *pchar1="请输入定值区号:";
char *pchar2=pChar;
int zone,current_x,value,temp;
char zone_buf[5];
current_x=0;
value=0;
if((iLONC_SetZoneNum>=SET_ZONE)||(iLONC_SetZoneNum<0))
{
iLONC_SetZoneNum=0;
uSaveRequest |= SAVE_SETZONE;
}
zone=iLONC_SetZoneNum;
while(1)
{
Lcd_Clear_Memory();
Lcd_Draw_Line(0,45,127,44,1);
Lcd_Draw_Line(0,63,127,63,1);
Lcd_Draw_Cchar(pchar1,0,4,1);
Lcd_Draw_Cchar(pchar2,16,46,1);
sprintf(zone_buf,"%02d",zone);
Lcd_Draw_Echar(zone_buf,54,28,1);
switch(current_x)
{
case 1: Lcd_Draw_Line(54,37,61,37,1);break;
case 0: Lcd_Draw_Line(63,37,70,37,1);break;
default:break;
}
Lcd_Display_Executive();
Delay_Key();
if(key_current==KESC)
{
value=QUIT;
break;
}
if(key_current==KRIGHT)
{
if(current_x==1)
current_x=0;
continue;
}
if(key_current==KLEFT)
{
if(current_x==0)
current_x=1;
continue;
}
if(key_current==KINC)
{
switch(current_x)
{
case 0:zone+=1;break;
case 1:zone+=10;break;
default :break;
}
if(zone>=SETTING_MAX_ZONE)
zone=0;
continue;
}
if(key_current==KDEC)
{
switch(current_x)
{
case 0:zone-=1;break;
case 1:zone-=10;break;
default:break;
}
if(zone<0)
zone=SETTING_MAX_ZONE-1;
continue;
}
if(key_current==KCR)
{
value=zone;
return(value);
}
}
}
/********************************************************************************/
/* 修改保护子程序 2001-12-3 */
/* 入口: ( ) 出口:无返回值 */
/* 说明: */
/* */
/********************************************************************************/
void Select_Protect(int set_zone,void (*pfile)())
{
int i,pointer,current_y,protect_counter,zone;
PROTECT *pPROTECT[3];
char char_buf[3];
char *pchar1="没有保护数据!";
zone=set_zone;
if(PRO_Total_Protect==0)
{
Lcd_Clear_Memory();
Lcd_Draw_Cchar(pchar1,8,24,1);
Lcd_Display_Executive();
NU_Sleep(1000*NU_TICKS);
return;
}
pointer=0;
pPROTECT[0] = PRO_Created_Protect_List;
while((pointer<=2-1)&&(pointer<PRO_Total_Protect-1))
{
pPROTECT[pointer+1]= pPROTECT[pointer] -> pro_link_next;
pointer++;
}
current_y = 0;
protect_counter=0;
while(1)
{
Lcd_Clear_Memory();
for(i=0;i<=pointer;i++)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -