|
@@ -2,7 +2,7 @@
|
|
* @Author : ChenJie
|
|
* @Author : ChenJie
|
|
* @Date : 2021-10-14 09:27:15
|
|
* @Date : 2021-10-14 09:27:15
|
|
* @LastEditors : ChenJie
|
|
* @LastEditors : ChenJie
|
|
- * @LastEditTime : 2021-11-15 11:52:28
|
|
|
|
|
|
+ * @LastEditTime : 2021-11-15 15:05:06
|
|
* @Description : file content
|
|
* @Description : file content
|
|
* @FilePath : \PLAT\project\ec616_0h00\apps\qx_app\src\AppTaskUart.c
|
|
* @FilePath : \PLAT\project\ec616_0h00\apps\qx_app\src\AppTaskUart.c
|
|
*/
|
|
*/
|
|
@@ -154,22 +154,16 @@ static void UartTask(void *arg)
|
|
PROC_UART_STATE_SWITCH(PROCESS_UART_STATE_IDLE);
|
|
PROC_UART_STATE_SWITCH(PROCESS_UART_STATE_IDLE);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- else if (Uart_Recv_LEN == 1) //接收的数据校验不过
|
|
|
|
- {
|
|
|
|
- UartRecvFlag = 0;
|
|
|
|
- //UartRecvFlagCounter++;
|
|
|
|
- }
|
|
|
|
- else //没有接收到数据
|
|
|
|
|
|
+ else //没有接收到数据或数据有误
|
|
{
|
|
{
|
|
UartRecvFlag = 0;
|
|
UartRecvFlag = 0;
|
|
UartRecvFlagCounter++;
|
|
UartRecvFlagCounter++;
|
|
}
|
|
}
|
|
- if (UartRecvFlagCounter >= 15)
|
|
|
|
|
|
+ if (UartRecvFlagCounter >= 10)
|
|
{
|
|
{
|
|
UartRecvFlagCounter = 0;
|
|
UartRecvFlagCounter = 0;
|
|
- uartBattInfoDecode(UartAnswerData.data);
|
|
|
|
UartErrorFlag = 1;
|
|
UartErrorFlag = 1;
|
|
- PROC_UART_STATE_SWITCH(PROCESS_UART_STATE_INTI);
|
|
|
|
|
|
+ uartBattInfoDecode(UartAnswerData.data);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
@@ -451,13 +445,13 @@ UINT8 UartAppTrasmit(UINT8 *pSend, UINT32 sendLen, UINT8 *pRead, UINT32 readLen,
|
|
CRC_chk_buffer = crc_chk(pRead, UartData.len - 2);
|
|
CRC_chk_buffer = crc_chk(pRead, UartData.len - 2);
|
|
if (*(pRead + 0) != 0x01 || CRC_Rece_buffer != CRC_chk_buffer)
|
|
if (*(pRead + 0) != 0x01 || CRC_Rece_buffer != CRC_chk_buffer)
|
|
{
|
|
{
|
|
- hal_uart_hardware_config_t hwConfig = {
|
|
|
|
- ARM_POWER_FULL,
|
|
|
|
- ARM_USART_MODE_ASYNCHRONOUS | ARM_USART_DATA_BITS_8 |
|
|
|
|
- ARM_USART_PARITY_NONE | ARM_USART_STOP_BITS_1 |
|
|
|
|
- ARM_USART_FLOW_CONTROL_NONE,
|
|
|
|
- 9600U};
|
|
|
|
|
|
+ hal_uart_hardware_config_t hwConfig = {ARM_POWER_FULL,
|
|
|
|
+ ARM_USART_MODE_ASYNCHRONOUS | ARM_USART_DATA_BITS_8 |
|
|
|
|
+ ARM_USART_PARITY_NONE | ARM_USART_STOP_BITS_1 |
|
|
|
|
+ ARM_USART_FLOW_CONTROL_NONE,
|
|
|
|
+ 9600U};
|
|
HAL_UART_ResetUartSetting(PORT_USART_1, &hwConfig, TRUE);
|
|
HAL_UART_ResetUartSetting(PORT_USART_1, &hwConfig, TRUE);
|
|
|
|
+ osDelay(500);
|
|
memset(pRead, 0x00, readLen);
|
|
memset(pRead, 0x00, readLen);
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|