📄 lcd2.c
字号:
byte dsp_line_new;
byte max_lcd_text_line;
dsp_line_new = Lcd_Text.dsp_line_end;
if (Lcd_Mode == LCD_10_INCH)
max_lcd_text_line = DISP_LCD_TEXT_LINE;
else
max_lcd_text_line = DISP_LCD_TEXT_LINE7;
if (key == KD_PAGE_DOWN)
{
dsp_line_new += max_lcd_text_line - 1;
}
else if (key == KD_PAGE_UP)
{
if (dsp_line_new > max_lcd_text_line-1 + max_lcd_text_line)
dsp_line_new -= max_lcd_text_line - 1;
else
dsp_line_new = max_lcd_text_line - 1;
}
else if (key == KD_DOWN)
{
dsp_line_new += 1;
}
else if (key == KD_UP)
{
if (dsp_line_new > max_lcd_text_line-1 + 1)
dsp_line_new -= 1;
else
dsp_line_new = max_lcd_text_line - 1;
}
if (dsp_line_new+1 > Lcd_Text.max_line)
dsp_line_new = Lcd_Text.max_line - 1;
Lcd_Text.dsp_line_new = dsp_line_new;
Lcd_Disp_Text_Buff(BUF_ID_LCD_TEXT); /* Update the display */
}
/*
重新把显示文本的改成最开始的显示窗口
*/
static void Lcd_Text_Rewind(void)
{
byte dsp_line_new = DISP_LCD_TEXT_LINE - 1;
if (Lcd_Mode == LCD_10_INCH)
dsp_line_new = DISP_LCD_TEXT_LINE - 1;
else
dsp_line_new = DISP_LCD_TEXT_LINE7 - 1;
if (dsp_line_new+1 > Lcd_Text.max_line)
dsp_line_new = Lcd_Text.max_line - 1;
Lcd_Text.dsp_line_new = dsp_line_new;
}
/* 设置文本框实时刷新 */
void Lcd_Set_Text_Refresh(void)
{
if (Refresh_Bourn)
Refresh_Bourn--;
if (Refresh_Bourn == 0)
{
Lcd_Text_Refresh = TRUE;
Lcd_Text_Rewind();
Lcd_Disp_Text_Buff(BUF_ID_LCD_TEXT);
}
}
/* 设置文本框不刷新显示 */
void Lcd_Cls_Text_Refresh(void)
{
Lcd_Text_Refresh = FALSE;
Refresh_Bourn++;
}
/* Open the text refresh */
void Lcd_Opn_Text_Refresh(void)
{
Refresh_Bourn = 0;
Lcd_Text_Refresh = TRUE;
Lcd_Text_Rewind();
// Lcd_Disp_Text_Buff(BUF_ID_LCD_TEXT);
}
/*
Check clearing the ISP sure or not
*/
BOOL Chk_Isp_Sure(void)
{
word key;
BOOL rtn;
Lcd_Init_Pop_Text(POP_ID_SEL);
Lcd_Send_Text_Buff_Str(BUF_ID_POP_TEXT, 1, "SOFTWARE ISP!", ALIGN_MID);
Lcd_Disp_Text_Buff(BUF_ID_POP_TEXT);
Lcd_Send_Text_Buff_Str(BUF_ID_POP_TEXT, 1, Str_Null, ALIGN_MID);
Lcd_Disp_Text_Buff(BUF_ID_POP_TEXT);
Lcd_Send_Text_Buff_Str(BUF_ID_POP_TEXT, 1, "Are you sure do the", ALIGN_LEFT);
Lcd_Disp_Text_Buff(BUF_ID_POP_TEXT);
Lcd_Send_Text_Buff_Str(BUF_ID_POP_TEXT, 1, "ISP operation?", ALIGN_LEFT);
Lcd_Disp_Text_Buff(BUF_ID_POP_TEXT);
key = GetKey();
if (key == KD_SEL_YES)
rtn = TRUE;
else
rtn = FALSE;
Lcd_Res_Pop_Text();
return rtn;
}
/*----------------------------------------------------------------------------*
弹出一个窗口, 显示结帐成功的信息
*----------------------------------------------------------------------------*/
void Lcd_Disp_Successful_Info(byte *str1, byte *str2)
{
byte step = 0;
int delay_cnt;
byte con_flag;
Lcd_Init_Pop_Text(POP_ID_NOR);
Lcd_Init_Cash_Spec();
do {
if (step&0x01)
{
Rst_Pop_Text();
Lcd_Disp_Text_Buff(BUF_ID_POP_TEXT);
}
else
{
Lcd_Send_Text_Buff_Str(BUF_ID_POP_TEXT, 1, str1, ALIGN_MID);
Lcd_Disp_Text_Buff(BUF_ID_POP_TEXT);
Lcd_Send_Text_Buff_Str(BUF_ID_POP_TEXT, 1, Str_Null, ALIGN_MID);
Lcd_Disp_Text_Buff(BUF_ID_POP_TEXT);
Lcd_Send_Text_Buff_Str(BUF_ID_POP_TEXT, 1, str2, ALIGN_LEFT);
Lcd_Disp_Text_Buff(BUF_ID_POP_TEXT);
}
if (step == 0)
delay_cnt = 5000;
else
delay_cnt = 1000;
con_flag = CndtDelay2(delay_cnt);
step++;
if (step == 7)
con_flag = FALSE;
} while(con_flag);
Clr_Key_Buff();
Lcd_Res_Cash_Spec(); /* 还原Cash的特殊标志 */
Lcd_Res_Pop_Text();
}
/*
Set the LCD display color
*/
void Lcd_Set_Color(byte color)
{
if (color == LCD_COLORFUL)
LCD_COLOR = LCD_COLORFUL;
else // color == LCD_GRAY
LCD_COLOR = LCD_GRAY;
}
/*
Set the LCD display type, the 7" or the 10" type
*/
void Lcd_Set_Mode(byte mode)
{
if (mode == LCD_10_INCH) {
Lcd_Mode = LCD_10_INCH;
disint();
Lcd_Mode_Int = LCD_10_INCH;
enint();
}
else { // mode == LCD_7_INCH)
Lcd_Mode = LCD_7_INCH;
disint();
Lcd_Mode_Int = LCD_7_INCH;
enint();
}
}
word ts_get_logi(word key)
{
key = (key>>8);
return (key-1);
}
/*--------------------------------------------------------------------------*
dipslay the dept on the LCD by the [dept shift] key
*--------------------------------------------------------------------------*/
void Lcd_Shift_Exchange(word key)
{
WORD Start_KEY;
WORD End_KEY;
WORD i;
WORD posi;
if(key == KD_DPSF)
{
Start_KEY = KD_DP_ST;
End_KEY = KD_DP_END;
}
else if(key == KD_DPLUSF)
{
Start_KEY = KD_DPLU_ST;
End_KEY = KD_DPLU_END;
}
else
return;
for(posi = 0;posi< MAX_LAYOUT_KEY; posi++)
{
if((Ts_Key_Tab[posi] >= Start_KEY)&&(Ts_Key_Tab[posi] <= End_KEY))
Lcd_Draw_Btn(posi, BTN_ID_KEY_EX);
}
}
/*
对PLU进行翻页处理
!!!注意,这里为了处理上的方便,定义虚拟按键的位置就是PLU按键的位置,
即比如PLU按键是从第十二个按键开始,则虚拟按键也从第十二个位置开始与PLU按键一一对应
*/
void Do_Page_PLU(void)
{
word key;
word idx;
word idx2 = 0;
byte i;
word j;
byte cnt;
byte posi;
byte size;
word *tmp;
posi = PLU_KEY_START_POSI;
key = Ts_Key_Tab[posi];
idx = Vir_Key[key - KD_VIRTUAL_ST].idx;
for (j = 0; j < Linked_Cnt; j++) // Get the idx2, also the sequence number of Linked_PLU
{
if (idx == Linked_PLU[j])
{
idx2 = j;
break;
}
}
tmp = (word *)Ts_Key_Tab;
// 取得翻页后的Idx
if (InCmd == KD_PAGE_LEFT_PLU)
{
idx2 = (idx2 + Linked_Cnt - PLU_KEY_INC) % Linked_Cnt;
}
else if (InCmd == KD_PAGE_RIGHT_PLU)
{
idx2 = (idx2 + PLU_KEY_INC) % Linked_Cnt;
}
else if (InCmd == KD_NULL)
{
idx2 = 0;
}
idx = Linked_PLU[idx2];
// 更新键盘表并更新显示. 注意, 更新键盘表是一个很重要的操作
for (cnt = 0, i = PLU_KEY_START_POSI; cnt < PLU_KEY_INC; cnt++, i++)
{
key = i + KD_VIRTUAL_ST;
Vir_Key[i].idx = idx;
Vir_Key[i].fill_color = plu[idx].fill_color;
Vir_Key[i].font_color = plu[idx].font_color;
idx2 = (idx2 + 1) % Linked_Cnt;
idx = Linked_PLU[idx2];
tmp[posi] = key;
Lcd_Draw_Btn(posi, BTN_ID_KEY);
posi++;
}
tmp[posi] = KD_PAGE_LEFT_PLU;
Lcd_Draw_Btn(posi, BTN_ID_KEY);
posi++;
tmp[posi] = KD_PAGE_RIGHT_PLU;
Lcd_Draw_Btn(posi, BTN_ID_KEY);
posi++;
}
/*
对Cooking Message进行翻页处理
!!!注意,这里为了处理上的方便,定义虚拟按键的位置就是PLU按键的位置,
即比如PLU按键是从第十二个按键开始,则虚拟按键也从第十二个位置开始与PLU按键一一对应
*/
void Do_Page_CM(void)
{
word key;
word idx;
word idx2 = 0;
byte i;
byte cnt;
byte posi;
byte size;
word *tmp;
posi = CM_KEY_START_POSI;
key = Ts_Key_Tab[posi];
idx = Vir_Key[key - KD_VIRTUAL_ST].idx;
for (i = 0; i < CM_Cnt; i++) // Get the idx2, also the sequence number of cooking message
{
if (idx == CkMsg[i])
{
idx2 = i;
break;
}
}
tmp = (word *)Ts_Key_Tab;
// 取得翻页后的Idx
if (InCmd == KD_PAGE_LEFT_CM)
{
idx2 = (idx2 + CM_Cnt - CM_KEY_INC) % CM_Cnt;
}
else if (InCmd == KD_PAGE_RIGHT_CM)
{
idx2 = (idx2 + CM_KEY_INC) % CM_Cnt;
}
else if (InCmd == KD_NULL)
{
idx2 = 0;
}
idx = CkMsg[idx2];
#if 1
// 更新键盘表并更新显示. 注意, 更新键盘表是一个很重要的操作
for (cnt = 0, i = CM_KEY_START_POSI; cnt < CM_KEY_INC; cnt++, i++)
{
key = i + KD_VIRTUAL_ST;
if (idx == VIRTUAL_KEY_IDX_NULL2)
Vir_Key[i].idx = VIRTUAL_KEY_IDX_NULL;
else
Vir_Key[i].idx = idx;
Vir_Key[i].fill_color = BLUE;
Vir_Key[i].font_color = LIGHTCYAN;
idx2 = (idx2 + 1) % CM_Cnt;
idx = CkMsg[idx2];
tmp[posi] = key;
Lcd_Draw_Btn(posi, BTN_ID_KEY);
posi++;
}
tmp[posi] = KD_PAGE_LEFT_CM;
Lcd_Draw_Btn(posi, BTN_ID_KEY);
posi++;
tmp[posi] = KD_PAGE_RIGHT_CM;
Lcd_Draw_Btn(posi, BTN_ID_KEY);
posi++;
#endif
}
/*
对部门进行翻页处理
*/
void Do_Page_Dept(void)
{
word key;
word idx;
byte i;
byte posi;
byte size;
word *tmp;
posi = DEPT_KEY_START_POSI;
key = Ts_Key_Tab[posi];
idx = key - KD_DP_ST;
tmp = (word *)Ts_Key_Tab;
// 取得翻页后的Idx
if (InCmd == KD_PAGE_LEFT_DEPT)
{
idx = (idx + Max_Dept_No - DEPT_KEY_INC) % Max_Dept_No;
}
else if (InCmd == KD_PAGE_RIGHT_DEPT)
{
idx = (idx + DEPT_KEY_INC) % Max_Dept_No;
}
else if (InCmd == KD_NULL)
{
idx = 0;
}
// 更新键盘表并更新显示. 注意, 更新键盘表是一个很重要的操作
for (i = 0; i < DEPT_KEY_INC; i++)
{
key = idx + KD_DP_ST;
idx = (idx + 1) % Max_Dept_No;
tmp[posi] = key;
Lcd_Draw_Btn(posi, BTN_ID_KEY);
posi++;
}
tmp[posi] = KD_PAGE_LEFT_DEPT;
Lcd_Draw_Btn(posi, BTN_ID_KEY);
posi++;
tmp[posi] = KD_PAGE_RIGHT_DEPT;
Lcd_Draw_Btn(posi, BTN_ID_KEY);
posi++;
}
/*
对台进行翻页处理
*/
void Do_Page_Table(void)
{
word key;
word idx;
byte i;
byte posi;
byte size;
word *tmp;
posi = TABLE_KEY_START_POSI;
key = Ts_Key_Tab[posi];
idx = key - KD_DTABLE_ST;
tmp = (word *)Ts_Key_Tab;
// 取得翻页后的Idx
if (InCmd == KD_PAGE_LEFT_TABLE)
{
idx = (idx + Real_Table_No - TABLE_KEY_INC) % Real_Table_No;
}
else if (InCmd == KD_PAGE_RIGHT_TABLE)
{
idx = (idx + TABLE_KEY_INC) % Real_Table_No;
}
else if (InCmd == KD_NULL)
{
idx = 0;
}
// 更新键盘表并更新显示. 注意, 更新键盘表是一个很重要的操作
for (i = 0; i < TABLE_KEY_INC; i++)
{
key = idx + KD_DTABLE_ST;
idx = (idx + 1) % Real_Table_No;
tmp[posi] = key;
Lcd_Draw_Btn(posi, BTN_ID_KEY);
posi++;
}
}
/*
对服务员进行翻页处理
*/
void Do_Page_Waiter(void)
{
word key;
word idx;
byte i;
byte posi;
byte size;
word *tmp;
posi = WAITER_KEY_START_POSI;
key = Ts_Key_Tab[posi];
idx = key - KD_WAITER_ST;
tmp = (word *)Ts_Key_Tab;
// 取得翻页后的Idx
if (InCmd == KD_PAGE_LEFT_WAITER)
{
idx = (idx + Max_Waiter_No - WAITER_KEY_INC) % Max_Waiter_No;
}
else if (InCmd == KD_PAGE_RIGHT_WAITER)
{
idx = (idx + WAITER_KEY_INC) % Max_Waiter_No;
}
else if (InCmd == KD_NULL)
{
idx = 0;
}
// 更新键盘表并更新显示. 注意, 更新键盘表是一个很重要的操作
for (i = 0; i < WAITER_KEY_INC; i++)
{
key = idx + KD_WAITER_ST;
idx = (idx + 1) % Max_Waiter_No;
tmp[posi] = key;
Lcd_Draw_Btn(posi, BTN_ID_KEY);
posi++;
}
tmp[posi] = KD_PAGE_BACK_TABLE;
Lcd_Draw_Btn(posi, BTN_ID_KEY);
posi++;
tmp[posi] = KD_PAGE_LEFT_WAITER;
Lcd_Draw_Btn(posi, BTN_ID_KEY);
posi++;
tmp[posi] = KD_PAGE_RIGHT_WAITER;
Lcd_Draw_Btn(posi, BTN_ID_KEY);
posi++;
}
void Do_Virtual_Key(void)
{
byte idx;
idx = InCmd - KD_VIRTUAL_ST;
if (Vir_Key[idx].idx == VIRTUAL_KEY_IDX_NULL) /* The null key, do nothing */
{
return;
}
if (Vir_Key[idx].id == VIR_KEY_PLU)
{
numcnt = 1;
lnum = Vir_Key[idx].idx + 1;
Do_PLU();
}
else if (Vir_Key[idx].id == VIR_KEY_CM)
{
Do_CM(Vir_Key[idx].idx);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -