private void StartScan() { KillScan(); PhysicalSwitch.AssignSwitch(0, ctrSwitch0.Type, ctrSwitch0.Parameter); if (rdoTwo.Checked) { PhysicalSwitch.AssignSwitch(1, ctrSwitch1.Type, ctrSwitch1.Parameter); } else { PhysicalSwitch.AssignSwitch(1, PhysicalSwitch.Types.Null, 0); } m_Engine = Engine.Create((Engine.Methods)cmbMethods.SelectedValue); // note must be created before Logical bit to get switch count, but Initialised after the switches are available pnlTest.Engine = m_Engine; if (rdoTwo.Checked) { Logical.CreateSwitches(Logical.Number.Two, m_Engine); } else if (m_Engine.NumberSwitchInputs == 2) { Logical.CreateSwitches(Logical.Number.ShortLong, m_Engine); } else { Logical.CreateSwitches(Logical.Number.One, m_Engine); } m_Engine.Initialise(); ctrDiagram.Construct(m_Engine); PhysicalSwitch.MasterSwitch = PhysicalSwitch.MasterModes.On; m_Engine.StartScanning(); }
public override void Initialise() { // unlike most engines this will also create switches PhysicalSwitch.AssignSwitch(0, PhysicalSwitch.Types.Pointer, (int)m_Method); if (m_Method == Methods.DwellAveragePointer) { Logical.CreateSwitches(Logical.Number.PassThrough, this); (PhysicalSwitch.Switch(0) as PointerDwellAverageSwitch).Engine = this; } else { Logical.CreateSwitches(m_Dwell ? Logical.Number.DwellOnly : Logical.Number.One, this); } base.Initialise(); // must be AFTER switches assigned }