diff --git a/RBcore/client_setting.c b/RBcore/client_setting.c index 48b8740..170f1e1 100644 --- a/RBcore/client_setting.c +++ b/RBcore/client_setting.c @@ -51,7 +51,6 @@ static PV_struct_define decoded_PV = { 0 }; *----------------------------------------------*/ int check_PV(char *_pBuffer, uint32_t _iSize) { - if (_iSize < 4) return -1; if (_pBuffer[0] != 0x55) return -1; if (_pBuffer[1] != 0x55) return -1; @@ -63,7 +62,7 @@ int check_PV(char *_pBuffer, uint32_t _iSize) } else { - return -1; + return 0; } } diff --git a/RBcore/drv_interface.c b/RBcore/drv_interface.c index 1577cbe..af47fed 100644 --- a/RBcore/drv_interface.c +++ b/RBcore/drv_interface.c @@ -241,7 +241,6 @@ void Read_PV(void *argument) while(1) { rd_ComRead(g_ptlpuart, pcBuffer, 64); - Rd_Delay(10); } } @@ -291,6 +290,7 @@ void Drv_InterfaceInit(void) TUartUserData *ptUartUserData = UART_userdata_init(0, -1, 512); g_ptlpuart = rd_ComCreate(check_PV, decode_PV, LPUART_PV_Send, ptUartUserData->m_buf_size, ptUartUserData); UART_IT_init(g_ptlpuart); + rd_ComSetRecvTime(g_ptlpuart, 1500);// PV平均一到两秒发一条,这里超时时间设置为1.5秒 const osThreadAttr_t Read_PV_attributes = { .name = "Read_PV",