?? error.c
字號:
#include "ecrsys.h"
#include "data.h"
#include "disp.h"
#include "ftype.h"
#include "string.h"
#include "sysdata.h"
const int Error_Type_Tabl[];
const char *Prn_Error_Tabl[];
const char Str_Error[];
/************************************************************************/
/*----------------------------------------------------------------------*
Display the error message and wait for the cler.
*----------------------------------------------------------------------*/
void errorType(word type)
{
char error_str[MAX_LCD_NUM];
char i;
byte j;
word tmp;
if(MainMode == X_OFF) /* LOCK mode, return */
return;
if (!Lcd_Err_Flag) {
Lcd_Err_Flag = 1;
Lcd_Err_Type(type, Str_Null);
}
Lcm_Disp_Clr(LCM_LINE_2 ,FALSE);
for(i = 0; i < ERROR_TYPE_NUM; i ++)
{
if(Error_Type_Tabl[i] == type)
break;
}
if(i < ERROR_TYPE_NUM)
{
// 目前,需保存第一行要顯示的數據。
dis_sto_last_disp();
Lcm_Disp_Str(Prn_Error_Tabl[i], LCM_LINE_2, ALIGN_MID, FALSE);
en_sto_last_disp();
en_res_last_disp();
}
if(type >= 1000)
errorMsg(Disp_Err_Abnormal);
else
{
error_str[0] = 'E';
// BcdtoAsc()
tmp = type;
for(i = 3; i > 0; i --)
{
j = tmp%10;
tmp /= 10;
error_str[i] = j + '0';
}
error_str[4] = '\0';
if((type != 999) && (type != 997))
errorMsg(error_str);
else
{
bellcnt = 0xFF; /* Long bell */
Clr_Period();
Clr_Dsp_Data();
VFDDisplay(error_str, NOTCLEARD, LEFT);
}
}
if (Lcd_Err_Flag) {
Lcd_Err_Flag = 0;
Lcd_Res_Pop_Text();
}
}
/*----------------------------------------------------------------------*
Display the error message and wait for the clear 3 times.
*----------------------------------------------------------------------*/
void errorType_Ex(word type)
{
char error_str[MAX_LCD_NUM];
char i;
byte j;
word tmp;
if(MainMode == X_OFF) /* LOCK mode, return */
return;
if (!Lcd_Err_Flag) {
Lcd_Err_Flag = 1;
Lcd_Err_Type(type, Str_Null);
}
Lcm_Disp_Clr(LCM_LINE_2 ,FALSE);
for(i = 0; i < ERROR_TYPE_NUM; i ++)
{
if(Error_Type_Tabl[i] == type)
break;
}
if(i < ERROR_TYPE_NUM)
{
dis_sto_last_disp();
Lcm_Disp_Str(Prn_Error_Tabl[i], LCM_LINE_2, ALIGN_MID, FALSE);
en_sto_last_disp();
en_res_last_disp();
}
if(type >= 1000)
errorMsg_Ex(Disp_Err_Abnormal);
else
{
error_str[0] = 'E';
// BcdtoAsc()
tmp = type;
for(i = 3; i > 0; i --)
{
j = tmp%10;
tmp /= 10;
error_str[i] = j + '0';
}
error_str[4] = '\0';
if((type != 999) && (type != 997))
errorMsg_Ex(error_str);
else
{
bellcnt = 0xFF; /* Long bell */
Clr_Period();
Clr_Dsp_Data();
VFDDisplay(error_str, NOTCLEARD, LEFT);
}
}
if (Lcd_Err_Flag) {
Lcd_Err_Flag = 0;
Lcd_Res_Pop_Text();
}
}
/******************************************************************************
* display massage and wait for clear, then clear display
******************************************************************************/
void errorMsg_Ex(char *str)
{
// if(pass_flag == 1)
// return;
// if(MainMode == X_OFF) /* LOCK mode, return */
// return;
// if ( ((MainMode == REGISTER)||(MainMode == TRAINING)) && (currclerk == NUL_VLU)
// && (sysflag->clerk_mode)/* || (MainMode == ZREPORT && z_scrt_flag) */)
// return;
// #ifdef VER_RSNT /* Support the restaurant function */
// if(waiter_input_flag)
// return;
// #endif /* End VER_RSNT */
if (!Lcd_Err_Flag) {
Lcd_Err_Flag = 1;
Lcd_Err_Type(0, str);
}
Clr_Period();
Disp_Spec_Period(); /* Dispaly the special period */
VFDDisplay(str, CLEARD, LEFT); /* Display the error information */
bellcnt = 0xFE;
// while (GetKey()!= KD_CLEAR);
// while(TRUE)
{
byte cnt = 0;
word key;
while(TRUE)
{
key = GetKey();
switch(key)
{
case KD_CLEAR:
cnt ++;
break;
case KD_SURE:
cnt++;
break;
case KD_RETURN:
cnt++;
break;
default:
cnt = 0;
break;
}
if(cnt == 3)
break;
}
}
InCmd=KD_CLEAR; /* Press the CLEAR key */
LCD_Back_Set();
{
if(!sysflag->tax_shift_mode)
Clr_Tax_Flag();
Clr_Staus_Flag();
}
Disp_Mode();
Clr_Dsp_Data();
RightDisp(0L,sysflag->sysdots); /* Display the zero to the LCD, indicate it has clear the error */
Lcd_Tl_Input_Disp(TL_INPUT_CLEAR, 0);
if (chk_res_last_disp()) {
dis_res_last_disp();
Lcm_Disp_Last_Line(LCM_LINE_2);
}
if (Lcd_Err_Flag) {
Lcd_Err_Flag = 0;
Lcd_Res_Pop_Text();
}
}
byte Chk_Word(char src_char)
{
if((src_char == '-') || (src_char == '_') || (src_char == '\'')) /* The word's connective character */
return (OK);
if((src_char >= '0') && (src_char <= '9')) /* Digit string */
return (OK);
if(((src_char >= 'A') && (src_char <= 'Z')) || ((src_char >= 'a') && (src_char <= 'z'))) /* The word's letter */
return (OK);
return (NG);
}
/*----------------------------------------------------------------------*
Print the all errores explanation.
*----------------------------------------------------------------------*/
void prn_All_Error(void)
{
byte i;
byte len; /* The current print string length */
byte inc; /* The increment */
char *cur_str; /* The current print string */
int error_type;
byte spec_char_cnt; /* 全角字符的統計, 用于更改為其他國家語言的時候, 可能出現全角字符 */
byte j;
// memcpy(prn_Buf+1, Str_Error, MAX_PRN_LEN);
xtr_strcpy(prn_Buf+1, Str_Error); /* Modified on 2004-04-07 16:42 */
prn_Buf[0] = DB_HEIGT_PRN;
print();
Line_Feed(1);
for(i = 0; i < ERROR_TYPE_NUM; i ++)
{
error_type = Error_Type_Tabl[i]; /* Print the error type */
// prn_Buf[1] = error_type/100%10 + '0';
// prn_Buf[2] = error_type/10%10 + '0';
// prn_Buf[3] = error_type/1%10 + '0';
LongtoAsc(prn_Buf+1, error_type, 3);
prn_Buf[4] = ':';
cur_str = (char *)(Prn_Error_Tabl[i]); /* Print the error description */
len = strlen(cur_str);
while(len != 0)
{
inc = MAX_PRN_LEN-5; /* The one line length */
if(len <= inc) /* The leave length is less than the one line length(27) */
{
memcpy(prn_Buf+6, cur_str, len);
print();
len = 0;
inc = 0;
break;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -