This commit is contained in:
murmur 2024-12-13 17:56:20 +08:00
parent 7831469c66
commit 72fd77581d

View File

@ -421,24 +421,24 @@ static uint8_t SetPumpStepTarget(uint8_t index, uint32_t target) {
}
/**
*
*
* FL(feed length)
*
* @param index
* @return 0: :
*/
static uint8_t PumpRelativePositionControl(uint8_t index) {
static uint8_t StartPumpRelativeMove(uint8_t index) {
WritePump1Reg(index, RTU_PUMP_CMD_CO, 0x0066);
}
/**
* 使
* 使
* FP(feed position)
*
* @param index
* @return 0: :
*/
static uint8_t PumpAbsolutePositionControl(uint8_t index) {
static uint8_t StartPumpAbsoluteMove(uint8_t index) {
WritePump1Reg(index, RTU_PUMP_CMD_CO, 0x0067);
}
@ -585,19 +585,19 @@ void UpdatePumpStatus() {
uint8_t InitPump(void) {
// 初始化泵
log_e("InitPump");
WriteJogAcc(dp.pump[0].id, dp.pump[0].maxAccel);
WriteJogDec(dp.pump[0].id, dp.pump[0].maxDecel);
WriteJogSpeed(dp.pump[0].id, dp.pump[0].maxSpeed);
WriteStepAcc(dp.pump[0].id, dp.pump[0].maxAccel);
WriteStepDec(dp.pump[0].id, dp.pump[0].maxDecel);
WriteStepSpeed(dp.pump[0].id, dp.pump[0].maxSpeed);
SetPumpJogAcc(dp.pump[0].id, dp.pump[0].maxAccel);
SetPumpJogDec(dp.pump[0].id, dp.pump[0].maxDecel);
SetPumpJogSpeed(dp.pump[0].id, dp.pump[0].maxSpeed);
SetPumpStepAcc(dp.pump[0].id, dp.pump[0].maxAccel);
SetPumpStepDec(dp.pump[0].id, dp.pump[0].maxDecel);
SetPumpStepSpeed(dp.pump[0].id, dp.pump[0].maxSpeed);
WriteJogAcc(dp.pump[1].id, dp.pump[1].maxAccel);
WriteJogDec(dp.pump[1].id, dp.pump[1].maxDecel);
WriteJogSpeed(dp.pump[1].id, dp.pump[1].maxSpeed);
WriteStepAcc(dp.pump[1].id, dp.pump[1].maxAccel);
WriteStepDec(dp.pump[1].id, dp.pump[1].maxDecel);
WriteStepSpeed(dp.pump[1].id, dp.pump[1].maxSpeed);
SetPumpJogAcc(dp.pump[1].id, dp.pump[1].maxAccel);
SetPumpJogDec(dp.pump[1].id, dp.pump[1].maxDecel);
SetPumpJogSpeed(dp.pump[1].id, dp.pump[1].maxSpeed);
SetPumpStepAcc(dp.pump[1].id, dp.pump[1].maxAccel);
SetPumpStepDec(dp.pump[1].id, dp.pump[1].maxDecel);
SetPumpStepSpeed(dp.pump[1].id, dp.pump[1].maxSpeed);
}
@ -996,6 +996,9 @@ static uint8_t HandlePumpSpeedControl(uint8_t *Buff, uint8_t len) {
return 0;
}
SetPumpJogSpeed(index, speed);
SetPumpStepSpeed(index, speed);
updatePumpSpeedStatus(index, speed);
dp.pump[index].maxSpeed = speed;
index = Buff[2];
speed = Buff[3];
@ -1004,6 +1007,9 @@ static uint8_t HandlePumpSpeedControl(uint8_t *Buff, uint8_t len) {
return 0;
}
SetPumpJogSpeed(index, speed);
SetPumpStepSpeed(index, speed);
updatePumpSpeedStatus(index, speed);
dp.pump[index].maxSpeed = speed;
return 1;
}
@ -1024,6 +1030,7 @@ static uint8_t HandlePumpStepControl(uint8_t *Buff, uint8_t len) {
uint8_t index = Buff[0];
int32_t step = (Buff[1]<<24) | (Buff[2]<<16) | (Buff[3]<<8) | Buff[4];
SetPumpStepTarget(index, step);
StartPumpRelativeMove(index);
return 0;
}
@ -1049,8 +1056,8 @@ static uint8_t HandleSoftStop(uint8_t *rxBuf, uint16_t rxLen) {
// 急停状态
StopPump(0);
StopPump(1);
StopPumpJog(0);
StopPumpJog(1);
// StopPumpJog(0);
// StopPumpJog(1);
updateEmergencyStop(ESTOP_PRESSED);
}
return 0;