Browse Source

未检测到液面时,忽略错误

master
sige 2 years ago
parent
commit
d0f9d2579b
  1. 11
      src/main/java/com/dreamworks/boditech/driver/actuator/ActArmZMotor.java
  2. 23
      src/main/java/com/dreamworks/boditech/driver/connection/ComWebsocketClient.java

11
src/main/java/com/dreamworks/boditech/driver/actuator/ActArmZMotor.java

@ -25,7 +25,16 @@ public class ActArmZMotor extends ActMotor {
}
armZPosition += armZStep;
if ( armZPosition > armZMax ) {
throw new AppRuntimeException(AppError.DEVICE_LIQUID_LEVEL_DETECT_FAILED);
// @TODO : 先不抛异常了 以后再处理
// 如果这里抛出异常那么后续的步骤需要判断要不要正常执行, 以及这中情况如何处理 ~~~
// - 直接抛出异常后续步骤不执行 这样不行后面还要把试管帽盖上所以不能这么暴力 ~~~
// - 标记一下任务错误后续步骤判断一下 理论上可以 ~~~
// - 那么 如果是样本为空跳过当前试管没问题 如果是大缓冲液为空 那后面的试管都要跳过就没意义了 ~~~
// - 再假设 如果大缓冲液为空 要求补充大缓冲液 但是这个时候没有相同批次的了 所以又没法解决了 ~~~
// - 另外一种情况假设我探测到试管底部发现液面了 还是没法获取到要求的采样量 但是说明书上有一句说样本不足是会导致结果不准确的感觉就是忽略掉这个错误了 ~~~
// throw new AppRuntimeException(AppError.DEVICE_LIQUID_LEVEL_DETECT_FAILED);
armZPosition -= armZStep;
break;
}
} while ( true );

23
src/main/java/com/dreamworks/boditech/driver/connection/ComWebsocketClient.java

@ -44,6 +44,13 @@ public class ComWebsocketClient extends WebSocketClient {
if ( requestItem.isResponseReceived ) {
return ;
}
if ( requestItem.timeoutCount < 3 ) {
requestItem.timeoutCount ++;
write(requestItem.parameter);
return ;
}
LOG.info("device -- timeout");
requestItem.response = null;
requestItem.errorCode = ClientRequest.ERROR_CODE_TIMEOUT;
@ -55,10 +62,7 @@ public class ComWebsocketClient extends WebSocketClient {
timer.schedule(timerTask, 3000);
synchronized (requestItem) {
String cmd = MyByteBuffer.toHex(request.parameter);
cmd = cmd.replace(" ","");
LOG.info("device => {}", cmd);
this.send(cmd);
this.write(requestItem.parameter);
try {
requestItem.wait();
} catch (InterruptedException e) {
@ -68,6 +72,17 @@ public class ComWebsocketClient extends WebSocketClient {
}
/**
* write message to device
* @param message message
*/
public void write( ByteBuffer message ) {
String cmd = MyByteBuffer.toHex(message);
cmd = cmd.replace(" ","");
LOG.info("device => {}", cmd);
this.send(cmd);
}
/**
* event handler for receiving text message from device
* @param text message from device
*/

Loading…
Cancel
Save