BuiltIn.Valve initialization changed.
This commit is contained in:
@@ -47,17 +47,15 @@ namespace TBF.Rig.BuiltIn.Valve
|
|||||||
valveCfg = cfg as ValveCfg;
|
valveCfg = cfg as ValveCfg;
|
||||||
|
|
||||||
controlBoard = TbfComponents.FindComponent(cfg.ParentName, components) as TBF.Rig.ControlBoard.IControlBoard;
|
controlBoard = TbfComponents.FindComponent(cfg.ParentName, components) as TBF.Rig.ControlBoard.IControlBoard;
|
||||||
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
if (controlBoard == null) throw new Exception(string.Format("Cannot find the parent of {0}", Name));
|
||||||
|
|
||||||
if (valveCfg.CoupledToName != null)
|
if (!string.IsNullOrEmpty(valveCfg.CoupledToName))
|
||||||
{
|
{
|
||||||
coupledTo = (IValve)TbfComponents.FindComponent(valveCfg.CoupledToName, components);
|
coupledTo = (IValve)TbfComponents.FindComponent(valveCfg.CoupledToName, components);
|
||||||
|
if (coupledTo == null) throw new Exception(string.Format("Cannot find the coupled valve {0}", valveCfg.CoupledToName));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (valveCfg.BitNr < 0 || valveCfg.BitNr >= 128)
|
if (valveCfg.BitNr < 0 || valveCfg.BitNr > 127) throw new ArgumentOutOfRangeException("Invalid bit number");
|
||||||
{
|
|
||||||
throw new ArgumentOutOfRangeException("position");
|
|
||||||
}
|
|
||||||
Mask = (((UInt128)1) << valveCfg.BitNr);
|
Mask = (((UInt128)1) << valveCfg.BitNr);
|
||||||
|
|
||||||
log.Warn(this.ToString());
|
log.Warn(this.ToString());
|
||||||
|
|||||||
Reference in New Issue
Block a user