remove heartbeat and PackOutputData for key and scan data

This commit is contained in:
hyx 2026-05-07 23:06:17 +08:00
parent 7017c4c821
commit a42c99e284
8 changed files with 63 additions and 42 deletions

View File

@ -6,7 +6,7 @@
#endif #endif
#define CVERSION "1-3-3" #define CVERSION "1-3-9"
#define VERSIONLEN 5 #define VERSIONLEN 5
#define DEVICEMOD "SQ01-PDD-D1" #define DEVICEMOD "SQ01-PDD-D1"

View File

@ -155,7 +155,7 @@ void PackOutputData(uint8_t type)
*/ */
void ReportData(int barType) void ReportData(int barType)
{ {
PackOutputData(gPackType); // PackOutputData(gPackType);
AppUSBSendData(gOutputBuf, gOutputLen); AppUSBSendData(gOutputBuf, gOutputLen);
ClearOutputLen(); ClearOutputLen();
SetSysPackType(); SetSysPackType();

View File

@ -114,9 +114,10 @@ int main(void)
AppTIMxInterrupt(TIM6,2);//keyboard use AppTIMxInterrupt(TIM6,2);//keyboard use
if(gConfgBuf.heartbeatInterval==0xff||gConfgBuf.heartbeatInterval==0)gConfgBuf.heartbeatInterval=3; // if(gConfgBuf.heartbeatInterval==0xff||gConfgBuf.heartbeatInterval==0)gConfgBuf.heartbeatInterval=3;
HeartBeatTime = gConfgBuf.heartbeatInterval*1000; // HeartBeatTime = gConfgBuf.heartbeatInterval*1000;
HeartBeatTick = TMC_GetTick(); // HeartBeatTick = TMC_GetTick();
// startShowDevicemod();
while(1) while(1)
{ {
@ -136,15 +137,16 @@ int main(void)
gCfgUpdateFlag = 0; gCfgUpdateFlag = 0;
} }
//通信接收命令,指令分发 //通信接收命令,指令分发
nCmdCount = 0; nCmdCount = 0;
while(RecieveData(&comData)) // while(RecieveData(&comData))
{ // {
CommunicationCmdHandle(&comData); // CommunicationCmdHandle(&comData);
Delay_us(1000); // Delay_us(1000);
nCmdCount++; // nCmdCount++;
if(nCmdCount>100)break; // if(nCmdCount>100)break;
} // }
//扫码成功,指令分发 //扫码成功,指令分发
if(ScanModeReceiveData(&codeBar) == TRUE) if(ScanModeReceiveData(&codeBar) == TRUE)
@ -155,7 +157,7 @@ int main(void)
} }
} }
CheckHeartBeat(); // CheckHeartBeat();
gFunTrace = 38; gFunTrace = 38;
@ -240,7 +242,7 @@ void HardwareInit(void)
//串口初始化 //串口初始化
AppUartInit(gConfgBuf.uartBaudRate, UART_PARITY_MODE_NONE); AppUartInit(gConfgBuf.uartBaudRate, UART_PARITY_MODE_NONE);
//USB初始化 //USB初始化
gConfgBuf.comunitationType = USBDEVTYPE_VSP; gConfgBuf.comunitationType = USBDEVTYPE_HIDKBD;
AppUSBInit(gConfgBuf.comunitationType); AppUSBInit(gConfgBuf.comunitationType);
//蜂鸣器初始化 //蜂鸣器初始化
AppBuzzerInit(); AppBuzzerInit();

View File

@ -395,16 +395,19 @@ void PayCodeReport(BarData *pCode)
} else { } else {
//扫码数据输出 //扫码数据输出
if(!gReceiveKey) // if(!gReceiveKey)
{ // {
SetPackType(PACK_TYPEA); // SetPackType(PACK_TYPEA);
SetOutputData((uint8_t *)"NOKEY", 5); // SetOutputData((uint8_t *)"NOKEY", 5);
ReportData(pCode->bartype); // ReportData(pCode->bartype);
} else { // } else {
SetOutputData((uint8_t *)"SCAN", 4); // SetOutputData((uint8_t *)"SCAN", 4);
SetOutputData((uint8_t *)POSOUTBUF, dataLen); // SetOutputData((uint8_t *)POSOUTBUF, dataLen);
ReportData(pCode->bartype); // ReportData(pCode->bartype);
} // }
// SetOutputData((uint8_t *)"SCAN", 4);
SetOutputData((uint8_t *)POSOUTBUF, dataLen);
ReportData(pCode->bartype);
} }
#if(SUPPORT_VOICE) #if(SUPPORT_VOICE)

View File

@ -428,6 +428,16 @@ uint8_t Fn88ShowDevicemod(BarData *pCode)
return TMC_NONE; 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) uint8_t ChangeToCom(BarData *pCode)
{ {
if(USBVirtualCOM(pCode)==TMC_OK) if(USBVirtualCOM(pCode)==TMC_OK)
@ -793,15 +803,20 @@ void Key_SendData(void)
dat[j] = 0; dat[j] = 0;
} }
if(!gReceiveKey) // if(!gReceiveKey)
{ // {
SetPackType(PACK_TYPEA); // SetPackType(PACK_TYPEA);
SetOutputData((uint8_t *)"NOKEY",5); // SetOutputData((uint8_t *)"NOKEY",5);
ReportData(Communication_Id); // ReportData(Communication_Id);
} else { // } else {
SetOutputData((uint8_t *)"KEY",3); // SetOutputData((uint8_t *)"KEY",3);
SetOutputData((uint8_t *)dat, j); // SetOutputData((uint8_t *)dat, j);
ReportData(Communication_Id); // ReportData(Communication_Id);
} // }
// SetOutputData((uint8_t *)"KEY",3);
SetOutputData((uint8_t *)dat, j);
SetOutputData((uint8_t *)"\r",2);
ReportData(Communication_Id);
} }

View File

@ -109,6 +109,7 @@ void Key_Init(void);
void Key_Event(void); void Key_Event(void);
void Key_SendData(void); void Key_SendData(void);
void Key_Wait(void); void Key_Wait(void);
uint8_t startShowDevicemod(void);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -60,7 +60,7 @@ void AppUSBSendData(u8* buf, u32 len)
return; return;
} }
/*
if(g_bUsbDevType == USBDEVTYPE_HIDPOS) if(g_bUsbDevType == USBDEVTYPE_HIDPOS)
{ {
//check if suspend //check if suspend
@ -146,8 +146,8 @@ void AppUSBSendData(u8* buf, u32 len)
{ {
usbVspSendChars(buf, 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 AppUSBReceiveData(u8 *buf, u32 bufSize)
{ {
u32 len = 0; u32 len = 0;
/*
if(g_bUsbDevType == USBDEVTYPE_HIDPOS) if(g_bUsbDevType == USBDEVTYPE_HIDPOS)
{ {
len = usbHidPosRecvChars(buf, bufSize); 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); // len = usbVspRecvChars(buf, bufSize);
return len; return len;
} }

View File

@ -15,7 +15,7 @@ CfgSetting const DefaultCfg =
CFG_EXIST_FLAG, CFG_EXIST_FLAG,
0x00, //SN 0x00, //SN
ON, //设置码是否开启 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等 BAUDRATE_115200, //支持9600,14400,38400,56000,57600,115200,128000,256000等
VOICE_FINISH_DINGDONG, //0:叮咚1:扫码完成开始打印2:扫码成功 VOICE_FINISH_DINGDONG, //0:叮咚1:扫码完成开始打印2:扫码成功
@ -111,7 +111,7 @@ CfgSetting const DefaultCfg =
0xFF, //支持的输入码制类型0GBK 2UTF8 FF:自动识别 0xFF, //支持的输入码制类型0GBK 2UTF8 FF:自动识别
0x00, //支持的输出码制类型0GBK 1UNICODE 2UTF8 0x00, //支持的输出码制类型0GBK 1UNICODE 2UTF8
0x01, //是否支持发票模式 0不支持 1支持 0x01, //是否支持发票模式 0不支持 1支持
0x00, //结束符 0无 1换行回车 2回车 3TAB键 4换行 0x02, //结束符 0无 1换行回车 2回车 3TAB键 4换行
0x00, //扫码成功后在数据前添加数据的长度 0x00, //扫码成功后在数据前添加数据的长度
0x00, //扫码成功后在数据后添加数据的长度 0x00, //扫码成功后在数据后添加数据的长度
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //扫码成功后在数据前添加的数据 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //扫码成功后在数据前添加的数据