From 8238a11758e2a55cd684b737b1e37d8bbbc37e30 Mon Sep 17 00:00:00 2001 From: murmur Date: Sat, 4 Jan 2025 13:49:06 +0800 Subject: [PATCH] update log --- protocol.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/protocol.c b/protocol.c index f4e90ab..ededcf2 100644 --- a/protocol.c +++ b/protocol.c @@ -213,7 +213,7 @@ void processReceivedData(uint8_t len) * @return 0:成功 其他:失败 */ static uint8_t writeCMD(uint8_t *txBuf, uint16_t txLen) { - elog_hexdump("writeCMD", 16, txBuf, txLen); + // elog_hexdump("writeCMD", 16, txBuf, txLen); transDataToMotorValve(txBuf, txLen); @@ -243,6 +243,7 @@ static uint8_t writeCMD(uint8_t *txBuf, uint16_t txLen) { uint16_t rxLen = txLen; uint8_t ret = readDataFromMotorValve(rxBuf, rxLen, READ_ACK_TIMEOUT); if(memcmp(rxBuf,txBuf,2) != 0) { + elog_hexdump("writeCMD", 16, txBuf, txLen); log_e("READ ACK ERROR:[%s]", ackError[ret]); elog_hexdump("GET DATA", 16, rxBuf, rxLen); systemStatus.rst += 1;//结果计数 @@ -327,13 +328,14 @@ uint16_t ReadPump1Reg(uint8_t id, uint16_t reg) { uint16_t crc = CalculateCRC16(data, 6); // 小端序填充 memcpy(&data[6], &crc, 2); - elog_hexdump("writeCMD", 16, data, sizeof(data)); + transDataToMotorValve(data, 8); uint8_t rxBuf[30] = {0}; uint16_t rxLen = 7; uint8_t ret = readDataFromMotorValve(rxBuf, rxLen, READ_ACK_TIMEOUT); if(memcmp(rxBuf,data,2) != 0) { + elog_hexdump("writeCMD", 16, data, sizeof(data)); log_e("READ ACK ERROR:[%s]", ackError[ret]); elog_hexdump("GET DATA", 16, rxBuf, rxLen); systemStatus.rst += 1;//结果计数 @@ -358,13 +360,14 @@ uint32_t ReadPump2Reg(uint8_t id, uint16_t reg) { uint16_t crc = CalculateCRC16(data, 6); // 小端序填充 memcpy(&data[6], &crc, 2); - elog_hexdump("writeCMD", 16, data, sizeof(data)); + transDataToMotorValve(data, sizeof(data)); uint8_t rxBuf[30] = {0}; uint16_t rxLen = 9; uint8_t ret = readDataFromMotorValve(rxBuf, rxLen, READ_ACK_TIMEOUT*10); if(memcmp(rxBuf,data,2) != 0) { + elog_hexdump("writeCMD", 16, data, sizeof(data)); log_e("READ ACK ERROR:[%s]", ackError[ret]); elog_hexdump("GET DATA", 16, rxBuf, rxLen); systemStatus.rst += 1;//结果计数 @@ -771,10 +774,10 @@ uint8_t InitPump(void) { SetPumpJogAcc(index, dp.pump[index].accel); SetPumpJogDec(index, dp.pump[index].decel); - SetPumpJogSpeed(index, systemStatus.pumpsSpeed[index]); + SetPumpJogSpeed(index, systemStatus.pumpsCfgSpeed[index]); SetPumpStepAcc(index, dp.pump[index].accel); SetPumpStepDec(index, dp.pump[index].decel); - SetPumpStepSpeed(index, systemStatus.pumpsSpeed[index]); + SetPumpStepSpeed(index, systemStatus.pumpsCfgSpeed[index]); if (rst != systemStatus.rst) { log_e("InitPump %s failed!", dp.pump[index].name); @@ -896,13 +899,14 @@ uint32_t ReadValve2InputReg(uint8_t id, uint16_t reg) uint16_t crc = CalculateCRC16(data, 6); // 小端序填充 memcpy(&data[6], &crc, 2); - elog_hexdump("writeCMD", 16, data, sizeof(data)); + transDataToMotorValve(data, sizeof(data)); uint8_t rxBuf[30] = {0}; uint16_t rxLen = 9; uint8_t hrst = readDataFromMotorValve(rxBuf, rxLen, READ_ACK_TIMEOUT*2); if(memcmp(rxBuf, data, 2) != 0) { + elog_hexdump("writeCMD", 16, data, sizeof(data)); log_e("READ ACK ERROR:[%s]", ackError[hrst]); elog_hexdump("GET DATA", 16, rxBuf, rxLen); return 0xffffffff; @@ -1405,7 +1409,7 @@ void updateSystemStatus(void) updateVPInfo(); updatePumpStatus(); updateValveStatus(); - dumpSystemStatus(); + // dumpSystemStatus(); } /**