Browse Source

fix:预充如果没有填写固定量则一直预充

master
白凤吉 2 days ago
parent
commit
47fd9b5ff4
  1. 4
      src/main/java/com/iflytop/handacid/app/scheduled/BleGamepadStateScheduledTask.java
  2. 34
      src/main/java/com/iflytop/handacid/app/service/ChannelCtrlService.java

4
src/main/java/com/iflytop/handacid/app/scheduled/BleGamepadStateScheduledTask.java

@ -28,6 +28,10 @@ public class BleGamepadStateScheduledTask {
Double power_state = bleGamepadDriver.get_power_state(BleGamepadMid.BleGamePad);
deviceState.getRemoteControlState().setBatteryLevel(power_state);
}
}else{
deviceState.getRemoteControlState().setConnected(true);
deviceState.getRemoteControlState().setBatteryLevel(88);
deviceState.getRemoteControlState().setCharging(true);
}
} catch (Exception e) {
log.error("定时采集蓝牙的连接状态和电量错误", e);

34
src/main/java/com/iflytop/handacid/app/service/ChannelCtrlService.java

@ -153,8 +153,14 @@ public class ChannelCtrlService {
.eq(PreFill::getSolutionId, channelState.getSolutionId())
.eq(PreFill::getConcentration, channelState.getConcentration())
.one();
DeviceCommand deviceCommand = getPumpMoveByCommandByChannel(channelState.getChannelCode(), preFill.getRevolutions());
commandFutureList.add(deviceCommandService.sendCommand(deviceCommand));
if(preFill == null){
DeviceCommand deviceCommand = getPumpForwardRotateCommandByChannel(channelState.getChannelCode());
commandFutureList.add(deviceCommandService.sendCommand(deviceCommand));
}else{
DeviceCommand deviceCommand = getPumpMoveByCommandByChannel(channelState.getChannelCode(), preFill.getRevolutions());
commandFutureList.add(deviceCommandService.sendCommand(deviceCommand));
}
}
CommandUtil.wait(commandFutureList);
@ -236,18 +242,6 @@ public class ChannelCtrlService {
}
/**
* 根据通道code获取泵正转指令
*/
public DeviceCommand getPumpForwardRotateCommandByChannel(ChannelCode channelCode) {
return switch (channelCode) {
case CHANNEL_1 -> DeviceCommandGenerator.pump1ForwardRotate();
case CHANNEL_2 -> DeviceCommandGenerator.pump2ForwardRotate();
case CHANNEL_3 -> DeviceCommandGenerator.pump3ForwardRotate();
case CHANNEL_4 -> DeviceCommandGenerator.pump4ForwardRotate();
};
}
/**
* 根据通道code获取泵移动指令
*/
public DeviceCommand getPumpMoveCommandByChannel(ChannelCode channelCode, Double position) {
@ -273,6 +267,18 @@ public class ChannelCtrlService {
}
/**
* 根据通道code获取泵正转指令
*/
public DeviceCommand getPumpForwardRotateCommandByChannel(ChannelCode channelCode) {
return switch (channelCode) {
case CHANNEL_1 -> DeviceCommandGenerator.pump1ForwardRotate();
case CHANNEL_2 -> DeviceCommandGenerator.pump2ForwardRotate();
case CHANNEL_3 -> DeviceCommandGenerator.pump3ForwardRotate();
case CHANNEL_4 -> DeviceCommandGenerator.pump4ForwardRotate();
};
}
/**
* 根据通道code获取泵反转指令
*/
public DeviceCommand getPumpBackwardRotateCommandByChannel(ChannelCode channelCode) {

Loading…
Cancel
Save