From ce8530303e7042bb58c67772ecd9c32586df1fdb Mon Sep 17 00:00:00 2001 From: murmur Date: Thu, 19 Dec 2024 23:33:30 +0800 Subject: [PATCH] add log and update writeCMD --- protocol.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/protocol.c b/protocol.c index f43b7a3..588b11b 100644 --- a/protocol.c +++ b/protocol.c @@ -172,7 +172,22 @@ void updateInitStatus(InitStatus_t status) { * @param txLen 发送数据长度 */ void writeCMD(uint8_t *txBuf, uint16_t txLen) { - HAL_UART_Transmit(&huart2, txBuf, txLen, 1000); + for(uint16_t i = 0; i < txLen; i++) { + printf("%02X ", txBuf[i]); + } + printf("\r\n"); + // HAL_GPIO_WritePin(DIR2_GPIO_Port, DIR2_Pin, GPIO_PIN_SET); + // HAL_UART_Transmit(&huart2, txBuf, txLen, 100); + // HAL_GPIO_WritePin(DIR2_GPIO_Port, DIR2_Pin, GPIO_PIN_RESET); + transDataToMotorValve(txBuf, txLen); + uint8_t rxBuf[30] = {0}; + uint16_t rxLen = 0; + HAL_UART_Receive(&huart2, rxBuf, rxLen, 100); + for(uint16_t i = 0; i < rxLen; i++) { + printf("%02X ", rxBuf[i]); + } + printf("\r\n"); + // transDataToMotorValve(txBuf, txLen); } /**