fix functions

This commit is contained in:
CSSC-WORK\murmur 2024-12-23 17:37:25 +08:00
parent bea2eea42e
commit 79f802e4b5

View File

@ -719,14 +719,14 @@ void (*readValve2Reg)(uint8_t index, uint16_t reg) = ReadPump2Reg;
/** /**
* 1 * 1
* *
* @param index * @param id id
* @param reg * @param reg
* @return * @return
*/ */
uint16_t ReadValve1InputReg(uint8_t index, uint16_t reg) uint16_t ReadValve1InputReg(uint8_t id, uint16_t reg)
{ {
uint8_t data[8] = {0}; uint8_t data[8] = {0};
data[0] = index; data[0] = id;
data[1] = RTU_FUNC_READ_INPUT_REG; data[1] = RTU_FUNC_READ_INPUT_REG;
FillBigEndian16(&data[2], reg); FillBigEndian16(&data[2], reg);
FillBigEndian16(&data[4], 1); FillBigEndian16(&data[4], 1);
@ -746,14 +746,14 @@ uint16_t ReadValve1InputReg(uint8_t index, uint16_t reg)
/** /**
* 2 * 2
* *
* @param index * @param id id
* @param reg * @param reg
* @return * @return
*/ */
uint32_t ReadValve2InputReg(uint8_t index, uint16_t reg) uint32_t ReadValve2InputReg(uint8_t id, uint16_t reg)
{ {
uint8_t data[8] = {0}; uint8_t data[8] = {0};
data[0] = index; data[0] = id;
data[1] = RTU_FUNC_READ_INPUT_REG; data[1] = RTU_FUNC_READ_INPUT_REG;
FillBigEndian16(&data[2], reg); FillBigEndian16(&data[2], reg);
FillBigEndian16(&data[4], 2); FillBigEndian16(&data[4], 2);
@ -922,11 +922,12 @@ static uint8_t SetValveHomeTime(uint8_t index, uint16_t time) {
* @return () * @return ()
*/ */
static uint32_t ReadValvePos(uint8_t index) { static uint32_t ReadValvePos(uint8_t index) {
return ReadValve2InputReg(index, RTU_VALVE_CMD_POS); return ReadValve2InputReg(dp.valve[index].id, RTU_VALVE_CMD_POS);
} }
/** /**
* *
* @param index
* @return 0: 1: 2: * @return 0: 1: 2:
*/ */
static uint8_t valveCheckBTOResult(uint8_t index, uint32_t startTime) static uint8_t valveCheckBTOResult(uint8_t index, uint32_t startTime)
@ -938,7 +939,7 @@ static uint8_t valveCheckBTOResult(uint8_t index, uint32_t startTime)
return 2; return 2;
} }
uint16_t rst = ReadValve1InputReg(index,RTU_VALVE_CMD_SC); uint16_t rst = ReadValve1InputReg(dp.valve[index].id,RTU_VALVE_CMD_SC);
// 如果原点回归完成状态字第12位会从0变为1 // 如果原点回归完成状态字第12位会从0变为1
// 如果原点回归失败状态字第13位会从0变为1。 // 如果原点回归失败状态字第13位会从0变为1。
// 此外也可以附加判断电机当前位置是否在0附近的200个脉冲以内。 // 此外也可以附加判断电机当前位置是否在0附近的200个脉冲以内。
@ -1304,17 +1305,6 @@ static uint8_t HandleSoftStop(uint8_t *rxBuf, uint16_t rxLen) {
return 0; return 0;
} }
/**
*
*
* @param rxBuf
* @param rxLen
*/
void ProcessMotorMsg(uint8_t *rxBuf, uint16_t rxLen) {
// 实现电机消息处理逻辑
log_d("ProcessMotorMsg");
}
/** /**
* *
* :+(2Byte)+(1Byte)+(NByte)+CRC16校验位+ * :+(2Byte)+(1Byte)+(NByte)+CRC16校验位+