📄 protest.c
字号:
/*
* Module: PROTEST.C
* Modified by: X.C.Zheng WeiHua
* Modified on: Date: 03-8-11 14:03
* Copyright(c) WeiHua Tech Ltd.
*/
#include "ecrsys.h"
#include "ftype.h"
#include "sysdata.h"
#include "data.h"
#include "disp.h"
#include <string.h>
#include "lcm.h"
#include "Tft_disp.h"
#include "font.h"
#include <stdio.h>
/*************************************************************************
Evaluate the data to a dafault value
*************************************************************************/
void protest(void)
{
byte i; /* The circular temporary variable */
word j; /* The circular temporary variable */
byte desc_len; /* The description's length */
byte tmp_ary[MAX_PRN_LEN+1]; /* The temporary array */
Lcd_Set_Color(LCD_COLORFUL); /* 默认为用彩色的显示 */
// close motor first & open LCM BL
WMTOR = 0;
LcmBlOn();
/*** Showing an action to the LCD indicate doing the all clear operation ***/
Clr_Period();
Clr_Dsp_Data();
disp_Char_Str(Disp_Init_Start,4);
Delay(500);
Insert_Char('.', 8);
Delay(500);
Insert_Char('.', 9);
Delay(400);
Insert_Char('.', 10);
Delay(300);
CMOS_Illegal(); /* Reset the CMOS illegal flag */
/*** Initialize the date and time a default value ***/
SOFT_YEAR = 6;
SOFT_MONTH = 1;
SOFT_DAY = 1;
SOFT_HOUR = 12;
SOFT_MINUTE = 0;
SOFT_SECOND = 0;
#if SW_VER == SW_NE2
{
// 设置冬令时/夏令时标志.
DATE date;
date.Year = SOFT_YEAR;
date.Month = SOFT_MONTH;
date.Day = SOFT_DAY;
Rtc_SetWeek(date);
SetTimeFlag(date);
}
#endif
// Init_tsstart();
/*** Set some flags and some setings a default value ***/
Clr_All_Rpt_Flag();
Flag_Prgm_Head = 0;
continue_sale_flag = 0x55;
// currclerk = NUL_VLU;
currclerk = 1;
shift_flag[0] = 0;
shift_flag[1] = 0;
shift_flag[2] = 0;
shift_flag[3] = 0;
Tax_Emp_Flag = 0;
hard_plu_mode = 0;/* The default is not the hard PLU mode */
Shift_Dept_mode = 0;
Flag_Prn_Head = FALSE;
Max_TnsBf_Len = MAX_TNSBF_LEN;
Prn_SetHeatTime(0);
#ifdef VER_RSNT /* Support the restaurant function */
Open_flag = 0; /* Not in the open table mode */
Ack_Send_KP = 0;
KP_Prn_Head = FALSE;
#endif /* End VER_RSNT */
// BaudRate = BRG_576; /* The default baud rate of the PORT0 */
#ifdef RCPT_REPRN /* Support the receipt reprint function */
Rcpt_RePrn_Cnt = 0;
Rcpt_Reprn_Flag = 0;
#endif /* End RCPT_REPRN */
Trng_Flag = 0;
NetAmtBak = 0;
InitTrans();
// port_sel = (DEV_TYPE_SCANNER<<4)|(DEV_TYPE_KP); /* PORT0 is for the scanner function */
// save_flag = 0x00;
prn_tab_pre_flag = 0;
DeptShiftFlag = 0;
DPLUShiftFlag = 0;
/************************************/
init_ori_str(); /* Initial the all string */
/************************************/
/*-------------------*/ /* The serial port related variable */
Rst_Ser_Port();
/*-------------------*/
prePrnLine = 0;
#ifdef PC_COMM
#ifdef ELEC_JRNL
Clr_EJ_Para();
#endif
#endif
SetDftPrn(); /* Set the default print type */
/*** Initialize the system flag a deafult value ***/
Rst_Sysflag(0xff);
Age_Limit[0] = 18;
Age_Limit[1] = 21;
/*** Clear the reports data ***/
memset((void*)&report,0,sizeof(REPORT));
memset((void*)&PTD_report,0,sizeof(REPORT));
(report.NRGT).dots = sysflag->sysdots;
(report.NRGT).sign = POSITIVE;
(PTD_report.NRGT).dots = sysflag->sysdots;
(PTD_report.NRGT).sign = POSITIVE;
memset(Hour_Rept,0,24*sizeof(REPT));
// Rp_Auto_Space = 2; /* 默认为保留两个空格 */
Rp_Auto_Space = 0;
fl_kp_tm_out = FALSE;
/*** Set the other long_term data a default value ***/
/**********************************************************************
***********************************************************************
**********************************************************************/
#ifndef WD1VER /* The Version of WD1-E */
Max_Dept_No = DFT_DEPT_CNT;
Max_Clerk_No = DFT_CLERK_CNT;
#ifdef VER_RSNT /* Support the restaurant function */
#if DFT_WORK_MODE == RETAIL
Max_Table_No = 0;
Real_Table_No = 0;
Max_Waiter_No = 0;
work_mode = RETAIL; /* Work in retail mode */
Max_TnsBf_Len = MAX_TNSBF_LEN;
#else /* DFT_WORK_MODE == RSNT */
Max_Table_No = DFT_TABLE_CNT*MAX_SPLIT_TABLE;
Real_Table_No = DFT_TABLE_CNT;
Max_Waiter_No = DFT_WAITER_CNT;//DFT_WAITER_CNT;
work_mode = RSNT; /* Work in restaurant mode */
Max_TnsBf_Len = MAX_TABLE_BUFF_NUM;
#endif /* End DFT_WORK_MODE == RETAIL */
#endif /* End VER_RSNT */
// #ifdef ELEC_JRNL /* Support the electronic journal function */
// Max_Sale_Jrnl_No = DFT_SALE_JRNL_CNT;
// Max_Dc_Jrnl_No = DFT_DC_JRNL_CNT;
// Max_Rm_Jrnl_No = DFT_RM_JRNL_CNT;
// #endif /* End ELEC_JRNL */
Max_Plu_No = ((dword)ALLOC_END_ADDR - ALLOC_START_ADDR + 1
- ((dword)Max_Dept_No)*sizeof(DEPTDEF) - ((dword)Max_Clerk_No)*sizeof(CLERKDEF)
#ifdef VER_RSNT /* Support the restaurant function */
- ((dword)Max_Table_No)*sizeof(TABLEDEF) - ((dword)Max_Waiter_No)*sizeof(WAITERDEF)
#endif /* End VER_RSNT */
// #ifdef ELEC_JRNL /* Support the electronic journal function */
// - ((dword)Max_Sale_Jrnl_No)*sizeof(TRANSBUFFDEF) - ((dword)Max_Dc_Jrnl_No)*sizeof(TRANSBUFFDEF)
// - ((dword)Max_Rm_Jrnl_No)*sizeof(TRANSBUFFDEF)
// #endif /* End ELEC_JRNL */
)
/ sizeof(PLUDEF);
if(Max_Plu_No > MAX_PLU_CNT)
Max_Plu_No = MAX_PLU_CNT;
Mem_Alloc(); /* Allocate the memory */
#endif /* End WD1VER */
Init_Alloc(1); /* Initialize the allocate area */
/**********************************************************************
***********************************************************************
**********************************************************************/
Rst_Prog_Other(1); /* Reset the other program data to default */
#ifndef ROYAL
#if SW_VER == SW_WD2
for(j = 0; j < MSG_HEAD_LINES; j ++)
Prn_InitDesc(&Wlcm_Msg[j][2], MAX_PRN_LEN, Str_Null, NM_FONT_PRN, NM_FONT_PRN);
Prn_InitDesc(&Wlcm_Msg[0][2], MAX_PRN_LEN, Str_WlcmMsg1, DB_WIDTH_PRN, DB_WIDTH_PRN);
Prn_InitDesc(&Wlcm_Msg[1][2], MAX_PRN_LEN, Str_WlcmMsg2, DB_WIDTH_PRN, DB_WIDTH_PRN);
for(j = 0; j < MSG_BTM_LINES; j ++)
Prn_InitDesc(&Btm_Msg[j][2], MAX_PRN_LEN, Str_Null, NM_FONT_PRN, NM_FONT_PRN);
#else
#if 0
for(j = 0; j < MSG_HEAD_LINES; j ++)
{
strcpy(tmp_ary, Str_WlcmMsg);
tmp_ary[16-1] = (j+1)/10 + '0';
tmp_ary[17-1] = (j+1)%10 + '0';
Prn_InitDesc(&Wlcm_Msg[j][2], MAX_PRN_LEN, tmp_ary, NM_FONT_PRN, NM_FONT_PRN);
}
for(j = 0; j < MSG_BTM_LINES; j ++)
Prn_InitDesc(&Btm_Msg[j][2], MAX_PRN_LEN, Str_Null, NM_FONT_PRN, NM_FONT_PRN);
Prn_InitDesc(&Btm_Msg[0][2], MAX_PRN_LEN, Str_BtmMsg1, NM_FONT_PRN, NM_FONT_PRN);
Prn_InitDesc(&Btm_Msg[1][2], MAX_PRN_LEN, Str_BtmMsg2, NM_FONT_PRN, NM_FONT_PRN);
Prn_InitDesc(&Btm_Msg[2][2], MAX_PRN_LEN, Str_BtmMsg3, NM_FONT_PRN, NM_FONT_PRN);
#endif
Prn_InitDesc(&Wlcm_Msg[0][2], MAX_PRN_LEN, Str_WlcmMsg1, DB_WIDTH_PRN, DB_WIDTH_PRN);
Prn_InitDesc(&Wlcm_Msg[1][2], MAX_PRN_LEN, Str_WlcmMsg2, DB_WIDTH_PRN, DB_WIDTH_PRN);
for(j = 2; j < MSG_HEAD_LINES; j ++)
Prn_InitDesc(&Wlcm_Msg[j][2], MAX_PRN_LEN, Str_Null, NM_FONT_PRN, NM_FONT_PRN);
for(j = 0; j < MSG_BTM_LINES; j ++)
Prn_InitDesc(&Btm_Msg[j][2], MAX_PRN_LEN, Str_Null, NM_FONT_PRN, NM_FONT_PRN);
#endif
#else
for(j = 0; j < MSG_HEAD_LINES; j ++)
// Prn_InitDesc(&Wlcm_Msg[j][2], MAX_PRN_LEN, Str_RoyalMsg[j], NM_FONT_PRN, NM_FONT_PRN);
Prn_InitDesc(&Wlcm_Msg[j][2], MAX_PRN_LEN, Str_Null, NM_FONT_PRN, NM_FONT_PRN);
for(j = 0; j < MSG_BTM_LINES; j ++)
Prn_InitDesc(&Btm_Msg[j][2], MAX_PRN_LEN, Str_Null, NM_FONT_PRN, NM_FONT_PRN);
#endif
for(j = 0; j < MAX_KP_SFX_NUM; j ++)
{
if(j < DFT_CM_CNT)
{
desc_len = strlen(Str_CM_Default[j]);
if(desc_len > MAX_PRN_LEN)
desc_len = MAX_PRN_LEN;
memcpy(KP_Sfx_Desc[j], Str_CM_Default[j],desc_len);
KP_Sfx_Desc[j][desc_len] = '\0';
}
else
{
KP_Sfx_Desc[j][0] = '\0';
}
// memset(KP_Sfx_Desc[j], ' ', MAX_PRN_LEN);
// desc_len = desc_cpy(KP_Sfx_Desc[j], Str_Sfx_Cmt_Desc, 2);
// KP_Sfx_Desc[j][desc_len] = (j+1)/10 + '0';
// KP_Sfx_Desc[j][desc_len+1] = (j+1)%10 + '0';
// memset(KP_Sfx_Desc[j], ' ', MAX_PRN_LEN);
// desc_len = strlen(Str_Sfx_Cmt_Desc);
// memcpy(KP_Sfx_Desc[j], Str_Sfx_Cmt_Desc, desc_len);
// KP_Sfx_Desc[j][desc_len] = (j+1)/10 + '0';
// KP_Sfx_Desc[j][desc_len+1] = (j+1)%10 + '0';
}
/* Ininialize the control lock */
#if 0
i = Get_Scan_Lock(); /* Get the scan result */
if(i != X_OFF) /* When no hard control lock, the scan result is equal to the LOCK value */
{
sysflag->soft_lock_flag = 0; /* Use the hard control lock */
}
else
{
Clr_Dsp_Data();
// VFDDisplay(Disp_Init_Lock_Choice, NOTCLEARD, LEFT);
Lcm_Disp_Str(Disp_Init_Lock_Choice, LCM_LINE_1, ALIGN_MID, FALSE);
if(Phy_Sure() == OK) /* YES, used the soft control lock mode */
sysflag->soft_lock_flag = 1;
else
sysflag->soft_lock_flag = 0;
}
DEBUG_TMP(
// #if 0
// CurrMode = MainMode = currmodeInt = PROGRAM;
// #else
CurrMode = MainMode = currmodeInt = REGISTER;
// #endif
)
#endif
sysflag->soft_lock_flag = 0;
CurrMode = MainMode = currmodeInt = PROGRAM; /* 默认可在编程模式下面 */
key_matrx_init(0);/* Set the keyboard the default layout */
key_matrx_init(1);
key_matrx_init(2);
/* Initialize the touch screen and LCD */
Rst_Ts_Lcd();
Lcd_Set_Mode(LCD_10_INCH);
#ifdef ELEC_JRNL /* Support the electronic journal function */
Delay(100);
if(Atv_Log_Judge() == TRUE)
{
Max_Sale_Jrnl_No = DFT_SALE_JRNL_CNT;
Max_Dc_Jrnl_No = DFT_DC_JRNL_CNT;
Max_Rm_Jrnl_No = DFT_RM_JRNL_CNT;
Log_Recovery(); /* Recovery the log from the flash */
}
else // NG
{
for(i = 0; i < 3; i ++)
{
if(Fls_SectorErase(1-1) == OK)
break;
}
if(i == 3) /* 若擦除三次都不成功, 表明Flash已经损坏, 无法继续下去 */
{
errorType(ERR_FLASH_DAMAGE);
while(1);
}
else
{
Atv_Log_Write(); /* Write the active log flag byte */
if(Atv_Log_Judge() == TRUE)
{
Init_Jrnl_Para(1); /* Initial the journal parameter */
}
else
{
errorType_Ex(ERR_FLASH_EXIST); /* 表明Flash不存在 */
Init_Jrnl_Para(0);
}
}
memset(RA_Cash,0x20,MAX_DESC_LEN);
memset(RA_Check,0x20,MAX_DESC_LEN);
memset(RA_Charge,0x20,MAX_DESC_LEN);
memset(RA_Misc,0x20,MAX_DESC_LEN);
memset(PO_Cash,0x20,MAX_DESC_LEN);
memset(PO_Check,0x20,MAX_DESC_LEN);
memset(PO_Charge,0x20,MAX_DESC_LEN);
memset(PO_Misc,0x20,MAX_DESC_LEN);
memcpy(RA_Cash, Str_RA_Cash, strlen(RA_Cash));
memcpy(RA_Check, Str_RA_Check, strlen(Str_RA_Check));
memcpy(RA_Charge, Str_RA_Charge, strlen(Str_RA_Charge));
memcpy(RA_Misc, Str_RA_Misc, strlen(Str_RA_Misc));
memcpy(PO_Cash, Str_PO_Cash, strlen(Str_PO_Cash));
memcpy(PO_Check, Str_PO_Check, strlen(Str_PO_Check));
memcpy(PO_Charge, Str_PO_Charge, strlen(Str_PO_Charge));
memcpy(PO_Misc, Str_PO_Misc, strlen(Str_PO_Misc));
RA_Cash[MAX_DESC_LEN] = '\0';
RA_Check[MAX_DESC_LEN] = '\0';
RA_Charge[MAX_DESC_LEN] = '\0';
RA_Misc[MAX_DESC_LEN] = '\0';
PO_Cash[MAX_DESC_LEN] = '\0';
PO_Check[MAX_DESC_LEN] = '\0';
PO_Charge[MAX_DESC_LEN] = '\0';
PO_Misc[MAX_DESC_LEN] = '\0';
/* The old judge sentences */
// if(Fls_SectorErase(1-1) != OK)
// {
// errorType(ERR_FLASH_EXIST);
// Init_Jrnl_Para(0);
// }
// else
// {
// Atv_Log_Write(); /* Write the active log flag byte */
// if(Atv_Log_Judge() == TRUE)
// {
// Init_Jrnl_Para(1); /* Initial the journal parameter */
// }
// else
// {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -