From 1f2fa3f54d4a7b5a2f601c4c947a06476342e3bd Mon Sep 17 00:00:00 2001 From: patrick.xu <patrick.xu@broconcentric.com> Date: 星期五, 22 一月 2021 09:23:06 +0800 Subject: [PATCH] 1. gocator驱动将system.stop移到system.ReceiveData之后 2. 修改测量完成后状态切换逻辑,避免安全光线等干扰 3. 添加设备异常输出日志记录 4. 产品结果输出时做硬盘文件记录 --- src/Bro.Device.Gocator/GocatorDriver.cs | 60 ++++++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 38 insertions(+), 22 deletions(-) diff --git a/src/Bro.Device.Gocator/GocatorDriver.cs b/src/Bro.Device.Gocator/GocatorDriver.cs index a45de96..ba3546f 100644 --- a/src/Bro.Device.Gocator/GocatorDriver.cs +++ b/src/Bro.Device.Gocator/GocatorDriver.cs @@ -218,23 +218,17 @@ public override IImageSet Snapshot(IOperationConfig config) { + GocatorOperationConfig opConfig = config as GocatorOperationConfig; if (!IIConfig.IsAsyncMode) { - if (config is GocatorOperationConfig opConfig) + if (opConfig.IsOpenConnection) { - if (opConfig.IsOpenConnection) - { - system.Start(); - } - else - { - system.Stop(); - } + system.Start(); + } - if (!opConfig.IsSnapshotAction) - { - return null; - } + if (!opConfig.IsSnapshotAction) + { + return null; } } @@ -258,6 +252,11 @@ } else { + if (!opConfig.IsSnapshotAction) + { + return null; + } + try { dataSet = system.ReceiveData(IIConfig.SnapshotTimeout); @@ -266,6 +265,15 @@ { LogAsync(DateTime.Now, $"{Name}鑾峰彇鍥惧儚寮傚父", ex.GetExceptionMessage()); return null; + } + } + + if (!IIConfig.IsAsyncMode) + { + if (!opConfig.IsOpenConnection) + { + system.Stop(); + sensor.Flush(); } } @@ -535,21 +543,29 @@ }); } - public override void ClearImageSet(IImageSet set) - { - if (set.IsOriginSaved && set.IsFitSaved && set.IsAddtionalSaved) - { - (set as GoImageSet).HImage_2?.Dispose(); - (set as GoImageSet).HImage_2 = null; - } + //public override void ClearImageSet(IImageSet set) + //{ + // if (set.IsOriginSaved && set.IsFitSaved && set.IsAddtionalSaved) + // { + // (set as GoImageSet).HImage_2?.Dispose(); + // (set as GoImageSet).HImage_2 = null; + // } - base.ClearImageSet(set); - } + // base.ClearImageSet(set); + //} #endregion } public class GoImageSet : ImageSet { public HImage HImage_2 { get; set; } + + public override void Dispose() + { + base.Dispose(); + + HImage_2?.Dispose(); + HImage_2 = null; + } } } -- Gitblit v1.8.0