Enhance PrepareSlotQ3Calibration and WriteSlotQ3Calibration methods with improved logging, refined error handling, and additional debug details for iHead operations.

This commit is contained in:
Michal Buzik 2026-06-03 12:45:03 +02:00
parent 13490009a3
commit 2ba0bfe2b1

View File

@ -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();