- Camera ROI DebugLevel inheritance fixed/improved, parent can be Off
- avoid empty lines in logs after SendCommand, SendCalibData, ValveMove logs
This commit is contained in:
parent
ea59dd0932
commit
c767512fad
@ -41,7 +41,10 @@ namespace TBF.BenchControl.Cameras.CameraRoi
|
||||
if (cfg.DebugLevel != Entities.DebugMode.Off)
|
||||
{
|
||||
camera = TbfComponents.FindComponent(cfg.ParentName, components) as GenericDevices.ICamera;
|
||||
if (camera == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
if ((camera == null) && (cfg.DebugLevel != Entities.DebugMode.Inherit))
|
||||
{
|
||||
throw new Exception("Cannot find " + Name + " parent");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -108,7 +108,7 @@ namespace TBF.BenchControl.Elde
|
||||
//TBF.UiBridge.Bridge.OnLog(this, string.Format("{0} SendCalibData(COM{1}) rvCalib[0,0]={2} rvCalib[0,1]={3} rvCalib[1,0]={4} rvCalib[1,1]={5}\r\n",
|
||||
// DateTime.Now.ToLongTimeString(), usedCom,
|
||||
// rvCalib[0,0], rvCalib[0,1], rvCalib[1,0], rvCalib[1,1]));
|
||||
log.InfoFormat("SendCalibData(COM{0}) rvCalib[0,0]={1} rvCalib[0,1]={2} rvCalib[1,0]={3} rvCalib[1,1]={4}\r\n",
|
||||
log.InfoFormat("SendCalibData(COM{0}) rvCalib[0,0]={1} rvCalib[0,1]={2} rvCalib[1,0]={3} rvCalib[1,1]={4}",
|
||||
usedCom, rvCalib[0,0], rvCalib[0,1], rvCalib[1,0], rvCalib[1,1]);
|
||||
#if (DN100)
|
||||
ctrlBrdComponent.ExternalCom = true;
|
||||
@ -148,7 +148,7 @@ namespace TBF.BenchControl.Elde
|
||||
// valveMode,
|
||||
// valveValue[0],
|
||||
// valveValue[1]));
|
||||
log.InfoFormat("ValveMove({0}, {1}, [{2}, {3}])\r\n", valveNo, valveMode, valveValue[0], valveValue[1]);
|
||||
log.InfoFormat("ValveMove(#={0}, md={1}, [{2}, {3}])", valveNo, valveMode, valveValue[0], valveValue[1]);
|
||||
|
||||
ctrlBrdComponent.ValveMove((byte)valveNo, (byte)valveMode, valveValue);
|
||||
}
|
||||
@ -204,7 +204,7 @@ namespace TBF.BenchControl.Elde
|
||||
// regConst,
|
||||
// shortImp,
|
||||
// stopDevs));
|
||||
log.InfoFormat("SendCommand({0}, {1}, {2}, {3}, {4}, {5}, [{6},{7}], {8}, {9}, {10})\r\n",
|
||||
log.InfoFormat("SendCommand(Cmd={0}, Ref={1}, 0x{2}, Total={3}, TM={4}, filt={5}, FM=[{6},{7}], Reg={8}, ShrtImp={9}, Stop={10})",
|
||||
cmd,
|
||||
refFlowMeterNr,
|
||||
route.ToString("X"),
|
||||
|
||||
@ -82,13 +82,26 @@ namespace TBF.BenchControl
|
||||
.ComponentFromCmpntCfg(BenchControl.TbfComponents.CmpntCfgFromCmpntEntity(entity), components);
|
||||
|
||||
/// Inherit DebugMode from the parent (if any)
|
||||
if (cmpnt.Cfg.DebugLevel != Entities.DebugMode.Inherit && cmpnt.Cfg is IChildComponentCfg &&
|
||||
if ((cmpnt.Cfg.DebugLevel == Entities.DebugMode.Inherit) &&
|
||||
(cmpnt.Cfg is IChildComponentCfg) &&
|
||||
!string.IsNullOrEmpty(cmpnt.Cfg.ParentName))
|
||||
{
|
||||
bool inherited = false;
|
||||
foreach (var par in components)
|
||||
{
|
||||
if (par.Cfg.Name.Equals(cmpnt.Cfg.ParentName)) { cmpnt.Cfg.DebugLevel = par.Cfg.DebugLevel; break; }
|
||||
if (par.Cfg.Name.Equals(cmpnt.Cfg.ParentName))
|
||||
{
|
||||
/// Parent found, inherit the debug mode
|
||||
cmpnt.Cfg.DebugLevel = par.Cfg.DebugLevel;
|
||||
inherited = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!inherited)
|
||||
{
|
||||
/// Applied when the parent is (most likely) in DebugMode.Off
|
||||
cmpnt.Cfg.DebugLevel = Entities.DebugMode.Off;
|
||||
}
|
||||
}
|
||||
|
||||
if (cmpnt.Cfg.DebugLevel != Entities.DebugMode.Off) components.Add(cmpnt);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user