add log and update writeCMD

This commit is contained in:
murmur 2024-12-19 23:33:30 +08:00
parent e4ee1c0eec
commit ce8530303e

View File

@ -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);
}
/**