|
@@ -899,18 +899,15 @@ namespace parkMonitor.server
|
|
|
/// <param name="value"></param>
|
|
|
public void UpdateLaserStatus(int addr, int value)
|
|
|
{
|
|
|
- if (enable_status_check)
|
|
|
+ int status_addr = laser_status_address;
|
|
|
+ if (addr == status_addr)
|
|
|
{
|
|
|
- int status_addr = laser_status_address;
|
|
|
- if (addr == status_addr)
|
|
|
+ laserMsg.status = value;
|
|
|
+ //UILogServer.ins.log(value.ToString());
|
|
|
+ //系统异常状态复位
|
|
|
+ if (value != 5 && disordered)
|
|
|
{
|
|
|
- laserMsg.status = value;
|
|
|
- //UILogServer.ins.log(value.ToString());
|
|
|
- //系统异常状态复位
|
|
|
- if (value != 5 && disordered)
|
|
|
- {
|
|
|
- disordered = false;
|
|
|
- }
|
|
|
+ disordered = false;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -982,53 +979,45 @@ namespace parkMonitor.server
|
|
|
}
|
|
|
if (plc != null)
|
|
|
{
|
|
|
- lock (laserMsg)
|
|
|
+ laser_rescan_countdown--;
|
|
|
+ //停车指令置0
|
|
|
+ PLCNode pn = new PLCNode(laser_start_address.ToString(), "0");
|
|
|
+ plc.SetMessage(pn);
|
|
|
+ //未终止重测,车未开走,停车指令归零后置1
|
|
|
+ if (!laserMsg.abort_rescan)
|
|
|
{
|
|
|
- laser_rescan_countdown--;
|
|
|
- //停车指令置0
|
|
|
- PLCNode pn = new PLCNode(laser_start_address.ToString(), "0");
|
|
|
- plc.SetMessage(pn);
|
|
|
- //未终止重测,车未开走,停车指令归零后置1
|
|
|
- if (!laserMsg.abort_rescan)
|
|
|
+ UILogServer.ins.error("激光" + laserMsg.id + "计算异常,重新测量");
|
|
|
+ //重测检测心跳
|
|
|
+ Task rescan_wait_heartbeat = Task.Factory.StartNew(() =>
|
|
|
{
|
|
|
- UILogServer.ins.error("激光" + laserMsg.id + "计算异常,重新测量");
|
|
|
- //重测检测心跳
|
|
|
- Task rescan_wait_heartbeat = Task.Factory.StartNew(() =>
|
|
|
+ MyTimer mt = new MyTimer();
|
|
|
+ mt.StartTiming();
|
|
|
+ while (laserMsg.status != 254 && laserMsg.status != 255)
|
|
|
{
|
|
|
- MyTimer mt = new MyTimer();
|
|
|
- mt.StartTiming();
|
|
|
- while (laserMsg.status != 254 && laserMsg.status != 255)
|
|
|
+ Thread.Sleep(1000);
|
|
|
+ mt.EndTiming();
|
|
|
+ int activationCount = 0;
|
|
|
+ if (mt.IsLonger(15, 1, false, out activationCount))
|
|
|
{
|
|
|
- Thread.Sleep(1000);
|
|
|
- mt.EndTiming();
|
|
|
- int activationCount = 0;
|
|
|
- if (mt.IsLonger(15, 1, false, out activationCount))
|
|
|
+ if (activationCount == 1)
|
|
|
{
|
|
|
- if (activationCount == 1)
|
|
|
- {
|
|
|
- UILogServer.ins.info("重测前未获得心跳,继续等待");
|
|
|
- }
|
|
|
- if (MyTimer.restart && !mt.rolledBack)
|
|
|
- {
|
|
|
- mt.rolledBack = true;
|
|
|
- UILogServer.ins.error("发起重测前超时未能获取摆扫激光心跳,请检查设备");
|
|
|
- }
|
|
|
+ UILogServer.ins.info("重测前未获得心跳,继续等待");
|
|
|
+ }
|
|
|
+ if (MyTimer.restart && !mt.rolledBack)
|
|
|
+ {
|
|
|
+ mt.rolledBack = true;
|
|
|
+ UILogServer.ins.error("发起重测前超时未能获取摆扫激光心跳,请检查设备");
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
- UILogServer.ins.log("获得心跳,准备发起重测");
|
|
|
- rescan_wait_heartbeat.Wait();
|
|
|
- pn = new PLCNode(laser_start_address.ToString(), "1");
|
|
|
- plc.SetMessage(pn);
|
|
|
- laserMsg.status = value;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- laserMsg.status = 6;
|
|
|
- }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ UILogServer.ins.log("获得心跳,准备发起重测");
|
|
|
+ rescan_wait_heartbeat.Wait();
|
|
|
+ pn = new PLCNode(laser_start_address.ToString(), "1");
|
|
|
+ plc.SetMessage(pn);
|
|
|
}
|
|
|
- Thread.Sleep(500);
|
|
|
}
|
|
|
+ Thread.Sleep(500);
|
|
|
enable_status_check = true;
|
|
|
});
|
|
|
}
|