public void SetValue(string channel, bool value) { HCState = SHCUIControlState.LOCAL; stateRecord.digitals[channel] = value; SetDigitalLine(channel, value); setValuesDisplayedOnUI(stateRecord); HCState = SHCUIControlState.OFF; }
/// <summary> /// These SetValue functions are for giving commands to the hc from another program, while keeping the hc in control of hardware. /// Use this if you want the HC to keep control, but you want to control the HC from some other program /// </summary> public void SetValue(string channel, double value) { HCState = SHCUIControlState.LOCAL; stateRecord.analogs[channel] = value; SetAnalogOutput(channel, value, false); setValuesDisplayedOnUI(stateRecord); HCState = SHCUIControlState.OFF; }
public void SetValue(string channel, double value, bool useCalibration) { stateRecord.analogs[channel] = value; HCState = SHCUIControlState.LOCAL; SetAnalogOutput(channel, value, useCalibration); setValuesDisplayedOnUI(stateRecord); HCState = SHCUIControlState.OFF; }
public void Start() { // make the digital analogTasks. The function "CreateDigitalTask" is defined later //e.g CreateDigitalTask("notEOnOff"); // CreateDigitalTask("eOnOff"); //This is to keep track of the various things which the HC controls. analogTasks = new Dictionary <string, Task>(); stateRecord = new hardwareState(); stateRecord.analogs = new Dictionary <string, double>(); stateRecord.digitals = new Dictionary <string, bool>(); tstage = new Parker404XR("ASRL1::INSTR", profilesPath + "TranslationStageInitFile.txt"); CreateDigitalTask("aom0enable"); CreateDigitalTask("aom1enable"); CreateDigitalTask("aom2enable"); CreateDigitalTask("aom3enable"); CreateDigitalTask("shutterenable"); // make the analog output analogTasks. The function "CreateAnalogOutputTask" is defined later //e.g. bBoxAnalogOutputTask = CreateAnalogOutputTask("b"); // steppingBBiasAnalogOutputTask = CreateAnalogOutputTask("steppingBBias"); CreateAnalogOutputTask("aom0amplitude"); CreateAnalogOutputTask("aom0frequency"); CreateAnalogOutputTask("aom1amplitude"); CreateAnalogOutputTask("aom1frequency"); CreateAnalogOutputTask("aom2amplitude"); CreateAnalogOutputTask("aom2frequency"); CreateAnalogOutputTask("aom3amplitude"); CreateAnalogOutputTask("aom3frequency"); CreateAnalogOutputTask("coil0current"); CreateAnalogOutputTask("coil1current"); CreateAnalogInputTask("laserLockErrorSignal", -10, 10); CreateAnalogInputTask("chamber1Pressure"); CreateAnalogInputTask("chamber2Pressure"); // make the control controlWindow controlWindow = new ControlWindow(); controlWindow.controller = this; HCState = SHCUIControlState.OFF; Application.Run(controlWindow); }
/// <summary> /// This is used when you want another program to take control of some/all of the hardware. The hc then just saves the /// last hardware state, then prevents you from making any changes to the UI. Use this if your other program wants direct control of hardware. /// </summary> public void StartRemoteControl() { if (HCState == SHCUIControlState.OFF) { if (!ImageController.IsCameraFree()) { StopCameraStream(); } StoreParameters(profilesPath + "tempParameters.bin"); HCState = SHCUIControlState.REMOTE; controlWindow.UpdateUIState(HCState); controlWindow.WriteToConsole("Remoting Started!"); } else { MessageBox.Show("Controller is busy"); } }
public void StopRemoteControl() { try { controlWindow.WriteToConsole("Remoting Stopped!"); setValuesDisplayedOnUI(loadParameters(profilesPath + "tempParameters.bin")); if (System.IO.File.Exists(profilesPath + "tempParameters.bin")) { System.IO.File.Delete(profilesPath + "tempParameters.bin"); } } catch (Exception) { controlWindow.WriteToConsole("Unable to load Parameters."); } HCState = SHCUIControlState.OFF; controlWindow.UpdateUIState(HCState); ApplyRecordedStateToHardware(); }
private void applyToHardware(hardwareState state) { if (state.analogs.Count != 0 || state.digitals.Count != 0) { if (HCState == SHCUIControlState.OFF) { HCState = SHCUIControlState.LOCAL; controlWindow.UpdateUIState(HCState); applyAnalogs(state); applyDigitals(state); HCState = SHCUIControlState.OFF; controlWindow.UpdateUIState(HCState); controlWindow.WriteToConsole("Update finished!"); } } else { controlWindow.WriteToConsole("The values on the UI are identical to those on the controller's records. Hardware must be up to date."); } }
public void StopRemoteControl() { try { controlWindow.WriteToConsole("Remoting Stopped!"); setValuesDisplayedOnUI(loadParameters(profilesPath + "tempParameters.bin")); if (System.IO.File.Exists(profilesPath + "tempParameters.bin")) { System.IO.File.Delete(profilesPath + "tempParameters.bin"); } } catch (Exception) { controlWindow.WriteToConsole("Unable to load Parameters."); } HCState = SHCUIControlState.OFF; controlWindow.UpdateUIState(HCState); ApplyRecordedStateToHardware(); }
private void applyToHardware(hardwareState state) { if (state.analogs.Count != 0 || state.digitals.Count != 0) { if (HCState == SHCUIControlState.OFF) { HCState = SHCUIControlState.LOCAL; controlWindow.UpdateUIState(HCState); applyAnalogs(state); applyDigitals(state); HCState = SHCUIControlState.OFF; controlWindow.UpdateUIState(HCState); controlWindow.WriteToConsole("Update finished!"); } } else { controlWindow.WriteToConsole("The values on the UI are identical to those on the controller's records. Hardware must be up to date."); } }
/// <summary> /// This is used when you want another program to take control of some/all of the hardware. The hc then just saves the /// last hardware state, then prevents you from making any changes to the UI. Use this if your other program wants direct control of hardware. /// </summary> public void StartRemoteControl() { if (HCState == SHCUIControlState.OFF) { if (!ImageController.IsCameraFree()) { StopCameraStream(); } StoreParameters(profilesPath + "tempParameters.bin"); HCState = SHCUIControlState.REMOTE; controlWindow.UpdateUIState(HCState); controlWindow.WriteToConsole("Remoting Started!"); } else { MessageBox.Show("Controller is busy"); } }
public void Start() { // make the digital analogTasks. The function "CreateDigitalTask" is defined later //e.g CreateDigitalTask("notEOnOff"); // CreateDigitalTask("eOnOff"); //This is to keep track of the various things which the HC controls. analogTasks = new Dictionary<string, Task>(); stateRecord = new hardwareState(); stateRecord.analogs = new Dictionary<string, double>(); stateRecord.digitals = new Dictionary<string, bool>(); tstage = new Parker404XR("ASRL1::INSTR", profilesPath + "TranslationStageInitFile.txt"); CreateDigitalTask("aom0enable"); CreateDigitalTask("aom1enable"); CreateDigitalTask("aom2enable"); CreateDigitalTask("aom3enable"); CreateDigitalTask("shutterenable"); // make the analog output analogTasks. The function "CreateAnalogOutputTask" is defined later //e.g. bBoxAnalogOutputTask = CreateAnalogOutputTask("b"); // steppingBBiasAnalogOutputTask = CreateAnalogOutputTask("steppingBBias"); CreateAnalogOutputTask("aom0amplitude"); CreateAnalogOutputTask("aom0frequency"); CreateAnalogOutputTask("aom1amplitude"); CreateAnalogOutputTask("aom1frequency"); CreateAnalogOutputTask("aom2amplitude"); CreateAnalogOutputTask("aom2frequency"); CreateAnalogOutputTask("aom3amplitude"); CreateAnalogOutputTask("aom3frequency"); CreateAnalogOutputTask("coil0current"); CreateAnalogOutputTask("coil1current"); CreateAnalogInputTask("laserLockErrorSignal", -10, 10); CreateAnalogInputTask("chamber1Pressure"); CreateAnalogInputTask("chamber2Pressure"); // make the control controlWindow controlWindow = new ControlWindow(); controlWindow.controller = this; HCState = SHCUIControlState.OFF; Application.Run(controlWindow); }
public void SetValue(string channel, bool value) { HCState = SHCUIControlState.LOCAL; stateRecord.digitals[channel] = value; SetDigitalLine(channel, value); setValuesDisplayedOnUI(stateRecord); HCState = SHCUIControlState.OFF; }
public void SetValue(string channel, double value, bool useCalibration) { stateRecord.analogs[channel] = value; HCState = SHCUIControlState.LOCAL; SetAnalogOutput(channel, value, useCalibration); setValuesDisplayedOnUI(stateRecord); HCState = SHCUIControlState.OFF; }
/// <summary> /// These SetValue functions are for giving commands to the hc from another program, while keeping the hc in control of hardware. /// Use this if you want the HC to keep control, but you want to control the HC from some other program /// </summary> public void SetValue(string channel, double value) { HCState = SHCUIControlState.LOCAL; stateRecord.analogs[channel] = value; SetAnalogOutput(channel, value, false); setValuesDisplayedOnUI(stateRecord); HCState = SHCUIControlState.OFF; }