From 2ba0bfe2b19dad16be25494bbddd1c89faf0337a Mon Sep 17 00:00:00 2001 From: Michal Buzik Date: Wed, 3 Jun 2026 12:45:03 +0200 Subject: [PATCH] Enhance `PrepareSlotQ3Calibration` and `WriteSlotQ3Calibration` methods with improved logging, refined error handling, and additional debug details for `iHead` operations. --- .../iPerlCommunication/iPerlCommunicationForm.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/TBF/Rig/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs b/TBF/Rig/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs index f986243da..465ab5858 100644 --- a/TBF/Rig/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs +++ b/TBF/Rig/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs @@ -1060,23 +1060,25 @@ namespace TBF.Rig.TestMethods.iPerlCommunication } var gciFullLoginResult = iHead.OptoHeadTest.PrepareQ3Calibration(cfg, NextTest, wm); - if (!string.IsNullOrEmpty(resultStr) && - resultStr.Equals(TBF.Rig.RegisterReaders.GenesisRegReader.communication.OptoHeadTest.ResultOk)) + log.Debug($"PrepareSlotQ3Calibration(threadId: {threadId}, iHead: {iHead?.Name}) result:{gciFullLoginResult}"); + if (!string.IsNullOrEmpty(gciFullLoginResult) && + gciFullLoginResult.Equals(TBF.Rig.RegisterReaders.GenesisRegReader.communication.OptoHeadTest.ResultOk)) { - log.DebugFormat("PrepareQ3Calibration successfull threadId={0}", threadId); + log.DebugFormat("PrepareQ3Calibration successfull threadId={0} head={1}", threadId, iHead?.Name); resultStr = string.Format($"Write Q3 Calibration: OK"); // note Q3 calibration is done error = CommErr.None; } else { + log.DebugFormat("PrepareQ3Calibration failed threadId={0} head={1}", threadId, iHead?.Name); resultStr = "Write Q3 Calibration: Failed"; } return error; }catch (Exception ex) { - log.ErrorFormat("PrepareSlotQ3Calibration() threadId={0}, Error: {1}", threadId, ex.Message); + log.ErrorFormat("PrepareSlotQ3Calibration() threadId={0}, iHead: {1}, Error: {2}", threadId,iHead, ex.Message); return CommErr.FailedPrepare; } } @@ -1116,8 +1118,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication } var gciFullLoginResult = iHead.OptoHeadTest.WriteQ3Calibration(cfg, BeforeTest, wm); - if (!string.IsNullOrEmpty(resultStr) && - resultStr.Equals(TBF.Rig.RegisterReaders.GenesisRegReader.communication.OptoHeadTest.ResultOk)) + if (!string.IsNullOrEmpty(gciFullLoginResult) && + gciFullLoginResult.Equals(TBF.Rig.RegisterReaders.GenesisRegReader.communication.OptoHeadTest.ResultOk)) { log.Debug("SlotLogin successful"); resultStr = string.Format($"Write Q3 Calibration: OK"); @@ -1749,6 +1751,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication } else { + log.Debug("Wait for finish workerThreads 2seconds"); /// Wait until all threads are finished workerThreads[data.ThreadId].Join(2000); NormalClose();