领胜LDS 键盘AOI检测项目
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)
                    {
                        system.Start();
                    }
                    else
                    {
                        system.Stop();
                    }
                    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;
        }
    }
}