From a42c99e28446f77c92e1ade5a5d0b7e73bb3ddf5 Mon Sep 17 00:00:00 2001 From: hyx Date: Thu, 7 May 2026 23:06:17 +0800 Subject: [PATCH] remove heartbeat and PackOutputData for key and scan data --- App/Version.h | 2 +- App/communication.c | 2 +- App/main.c | 26 ++++++++++++++------------ App/outprompts.c | 23 +++++++++++++---------- Key/Key.c | 35 +++++++++++++++++++++++++---------- Key/Key.h | 1 + USB/USB_main.c | 12 ++++++------ User/DefaultCfg.c | 4 ++-- 8 files changed, 63 insertions(+), 42 deletions(-) diff --git a/App/Version.h b/App/Version.h index 3191e03..96ddbd5 100644 --- a/App/Version.h +++ b/App/Version.h @@ -6,7 +6,7 @@ #endif -#define CVERSION "1-3-3" +#define CVERSION "1-3-9" #define VERSIONLEN 5 #define DEVICEMOD "SQ01-PDD-D1" diff --git a/App/communication.c b/App/communication.c index c61ac5e..7f0aab4 100644 --- a/App/communication.c +++ b/App/communication.c @@ -155,7 +155,7 @@ void PackOutputData(uint8_t type) */ void ReportData(int barType) { - PackOutputData(gPackType); +// PackOutputData(gPackType); AppUSBSendData(gOutputBuf, gOutputLen); ClearOutputLen(); SetSysPackType(); diff --git a/App/main.c b/App/main.c index d4db5fb..7bc3a71 100644 --- a/App/main.c +++ b/App/main.c @@ -114,9 +114,10 @@ int main(void) AppTIMxInterrupt(TIM6,2);//keyboard use - if(gConfgBuf.heartbeatInterval==0xff||gConfgBuf.heartbeatInterval==0)gConfgBuf.heartbeatInterval=3; - HeartBeatTime = gConfgBuf.heartbeatInterval*1000; - HeartBeatTick = TMC_GetTick(); +// if(gConfgBuf.heartbeatInterval==0xff||gConfgBuf.heartbeatInterval==0)gConfgBuf.heartbeatInterval=3; +// HeartBeatTime = gConfgBuf.heartbeatInterval*1000; +// HeartBeatTick = TMC_GetTick(); +// startShowDevicemod(); while(1) { @@ -136,15 +137,16 @@ int main(void) gCfgUpdateFlag = 0; } + //通信接收命令,指令分发 nCmdCount = 0; - while(RecieveData(&comData)) - { - CommunicationCmdHandle(&comData); - Delay_us(1000); - nCmdCount++; - if(nCmdCount>100)break; - } +// while(RecieveData(&comData)) +// { +// CommunicationCmdHandle(&comData); +// Delay_us(1000); +// nCmdCount++; +// if(nCmdCount>100)break; +// } //扫码成功,指令分发 if(ScanModeReceiveData(&codeBar) == TRUE) @@ -155,7 +157,7 @@ int main(void) } } - CheckHeartBeat(); +// CheckHeartBeat(); gFunTrace = 38; @@ -240,7 +242,7 @@ void HardwareInit(void) //串口初始化 AppUartInit(gConfgBuf.uartBaudRate, UART_PARITY_MODE_NONE); //USB初始化 - gConfgBuf.comunitationType = USBDEVTYPE_VSP; + gConfgBuf.comunitationType = USBDEVTYPE_HIDKBD; AppUSBInit(gConfgBuf.comunitationType); //蜂鸣器初始化 AppBuzzerInit(); diff --git a/App/outprompts.c b/App/outprompts.c index 907589c..b9685ec 100644 --- a/App/outprompts.c +++ b/App/outprompts.c @@ -395,16 +395,19 @@ void PayCodeReport(BarData *pCode) } else { //扫码数据输出 - if(!gReceiveKey) - { - SetPackType(PACK_TYPEA); - SetOutputData((uint8_t *)"NOKEY", 5); - ReportData(pCode->bartype); - } else { - SetOutputData((uint8_t *)"SCAN", 4); - SetOutputData((uint8_t *)POSOUTBUF, dataLen); - ReportData(pCode->bartype); - } +// if(!gReceiveKey) +// { +// SetPackType(PACK_TYPEA); +// SetOutputData((uint8_t *)"NOKEY", 5); +// ReportData(pCode->bartype); +// } else { +// SetOutputData((uint8_t *)"SCAN", 4); +// SetOutputData((uint8_t *)POSOUTBUF, dataLen); +// ReportData(pCode->bartype); +// } +// SetOutputData((uint8_t *)"SCAN", 4); + SetOutputData((uint8_t *)POSOUTBUF, dataLen); + ReportData(pCode->bartype); } #if(SUPPORT_VOICE) diff --git a/Key/Key.c b/Key/Key.c index 4ab185f..98509d9 100644 --- a/Key/Key.c +++ b/Key/Key.c @@ -428,6 +428,16 @@ uint8_t Fn88ShowDevicemod(BarData *pCode) return TMC_NONE; } +uint8_t startShowDevicemod(void) +{ + ClearOutputLen(); + SetOutputData((uint8_t *)"DEVICEMOD",9); + SetPackType(PACK_TYPEA); + SetOutputData(DEVICEMOD,DEVICEMODLEN); + ReportData(Communication_Id); + return TMC_NONE; +} + uint8_t ChangeToCom(BarData *pCode) { if(USBVirtualCOM(pCode)==TMC_OK) @@ -793,15 +803,20 @@ void Key_SendData(void) dat[j] = 0; } - if(!gReceiveKey) - { - SetPackType(PACK_TYPEA); - SetOutputData((uint8_t *)"NOKEY",5); - ReportData(Communication_Id); - } else { - SetOutputData((uint8_t *)"KEY",3); - SetOutputData((uint8_t *)dat, j); - ReportData(Communication_Id); - } +// if(!gReceiveKey) +// { +// SetPackType(PACK_TYPEA); +// SetOutputData((uint8_t *)"NOKEY",5); +// ReportData(Communication_Id); +// } else { +// SetOutputData((uint8_t *)"KEY",3); +// SetOutputData((uint8_t *)dat, j); +// ReportData(Communication_Id); +// } + +// SetOutputData((uint8_t *)"KEY",3); + SetOutputData((uint8_t *)dat, j); + SetOutputData((uint8_t *)"\r",2); + ReportData(Communication_Id); } diff --git a/Key/Key.h b/Key/Key.h index 4a999c0..f5e636e 100644 --- a/Key/Key.h +++ b/Key/Key.h @@ -109,6 +109,7 @@ void Key_Init(void); void Key_Event(void); void Key_SendData(void); void Key_Wait(void); +uint8_t startShowDevicemod(void); #ifdef __cplusplus } diff --git a/USB/USB_main.c b/USB/USB_main.c index 07fc9e8..b1a44bd 100644 --- a/USB/USB_main.c +++ b/USB/USB_main.c @@ -60,7 +60,7 @@ void AppUSBSendData(u8* buf, u32 len) return; } -/* + if(g_bUsbDevType == USBDEVTYPE_HIDPOS) { //check if suspend @@ -146,8 +146,8 @@ void AppUSBSendData(u8* buf, u32 len) { usbVspSendChars(buf, len); } -*/ - usbVspSendChars(buf, len); + +// usbVspSendChars(buf, len); } @@ -163,7 +163,7 @@ void AppUSBSendData(u8* buf, u32 len) u32 AppUSBReceiveData(u8 *buf, u32 bufSize) { u32 len = 0; -/* + if(g_bUsbDevType == USBDEVTYPE_HIDPOS) { len = usbHidPosRecvChars(buf, bufSize); @@ -176,8 +176,8 @@ u32 AppUSBReceiveData(u8 *buf, u32 bufSize) { len = usbVspRecvChars(buf, bufSize); } -*/ - len = usbVspRecvChars(buf, bufSize); + +// len = usbVspRecvChars(buf, bufSize); return len; } diff --git a/User/DefaultCfg.c b/User/DefaultCfg.c index 70625fb..9c117a4 100644 --- a/User/DefaultCfg.c +++ b/User/DefaultCfg.c @@ -15,7 +15,7 @@ CfgSetting const DefaultCfg = CFG_EXIST_FLAG, 0x00, //SN ON, //设置码是否开启 - USBDEVTYPE_VSP, //0:uart 1:HIDKBD 2:VSP 3:HIDPOS + USBDEVTYPE_HIDKBD, //0:uart 1:HIDKBD 2:VSP 3:HIDPOS BAUDRATE_115200, //支持9600,14400,38400,56000,57600,115200,128000,256000等 VOICE_FINISH_DINGDONG, //0:叮咚;1:扫码完成,开始打印;2:扫码成功 @@ -111,7 +111,7 @@ CfgSetting const DefaultCfg = 0xFF, //支持的输入码制类型:0:GBK 2:UTF8 FF:自动识别 0x00, //支持的输出码制类型:0:GBK 1:UNICODE 2:UTF8 0x01, //是否支持发票模式 0:不支持 1:支持 - 0x00, //结束符 0:无 1:换行回车 2:回车 3:TAB键 4:换行 + 0x02, //结束符 0:无 1:换行回车 2:回车 3:TAB键 4:换行 0x00, //扫码成功后在数据前添加数据的长度 0x00, //扫码成功后在数据后添加数据的长度 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //扫码成功后在数据前添加的数据