- RegulValve ADC Open/Close values calibration implemented

- 'More' button added to ComponentCfgCtrl-s
- Dataflow from ComponentParametersDlg to components: CfgChangeHandler
- Dataflow from components to ComponentParametersDlg: CmdResponseHandler
- Detection of parameter changes and appropriate MesssageBox display:
  1.warning message when component configuration change requires program restart
  2.confirmation message box when any configuration changes would be lost
This commit is contained in:
Milan Hanajik
2015-01-03 14:45:58 +01:00
parent d9b1bc8b4a
commit 0160dc965d
49 changed files with 1461 additions and 452 deletions
@@ -29,6 +29,56 @@ namespace TBF.BenchControl.Elde.RegulValve
get { return controlBoard.RValvePosition(Idx1); }
}
#region Configuration Change Handling
public static void OnCfgChange(object sender, CfgChangeArgs args)
{
if (CfgChangeHandler == null) return;
try { CfgChangeHandler(sender, args); }
catch (Exception e) { log.Error("CfgChangeHandler(...) failed", e); }
}
public static event EventHandler<CfgChangeArgs> CfgChangeHandler;
public override void StartChangeHandler()
{
CfgChangeHandler += delegate(object sender, CfgChangeArgs args)
{
RegulValveCfg tmpcfg = args.Cfg as RegulValveCfg;
if (tmpcfg != null && tmpcfg.Name.Equals(Name))
{
if (args.Command == CfgChangeCmd.CfgChange)
{
RegulValveCfg.PidCoef = tmpcfg.PidCoef;
RegulValveCfg.StableTimeMs = tmpcfg.StableTimeMs;
RegulValveCfg.FlowStableSec = tmpcfg.FlowStableSec;
}
else if (args.Command == CfgChangeCmd.RVOpenStep)
{
controlBoard.ValveMove(Idx1, RegulValveMode.PulseWidth, new float[2] { 0.05f, 0.05f }, StableTime);
// TODO: avoid conflicts
// TOTEST
}
else if (args.Command == CfgChangeCmd.RVCloseStep)
{
controlBoard.ValveMove(Idx1, RegulValveMode.PulseWidth, new float[2] { -0.05f, -0.05f }, StableTime);
// TODO: avoid conflicts
// TOTEST
}
else if (args.Command == CfgChangeCmd.GetRVAdc1 || args.Command == CfgChangeCmd.GetRVAdc2)
{
int adc = (int)controlBoard.AnalogInputRaw(Idx1, 0);
// TOTEST
RegulValveCfgCtrl.OnCmdResponse(this, new CmdResponseArgs(args.Command, adc));
}
}
};
}
#endregion Configuration Change Handling
public RegulValve(RegulValveCfg cfg, IList<Generic.IComponent> components)
: base(cfg)
{