public void Stop(string reason) { ShutterState prev = State; bool openPinWasOn = openPin.isOn; bool closePinWasOn = closePin.isOn; if (openPinWasOn || closePinWasOn) { openPin.SetOff(); closePin.SetOff(); activityMonitor.EndActivity(ActivityMonitor.ActivityType.Shutter, new Activity.ShutterActivity.EndParams() { endState = Activity.State.Succeeded, endReason = reason, percentOpen = PercentOpen, }); webClient.SetPacing(WebClient.Pacing.Slow); #region debug debugger.WriteLine(Debugger.DebugLevel.DebugShutter, "Stop: was moving (openPin: {0}, closePin: {1})", openPinWasOn.ToString(), closePinWasOn.ToString()); #endregion } else { #region debug debugger.WriteLine(Debugger.DebugLevel.DebugShutter, "Stop: was NOT moving."); #endregion } }
public void StartStopping(string reason) { if (_state.IsSet(State.Flags.Stopping)) { return; } _state.Set(State.Flags.Stopping); #region debug debugger.WriteLine(Debugger.DebugLevel.DebugFocuser, "StartStopping: Started stopping at {0} (new _state: {1}, reason: {2}) ...", Position, _state, reason); #endregion if (Simulated) { encoder.stopMoving(); } pinUp.SetOff(); pinDown.SetOff(); Thread.Sleep(50); }
public void init() { if (_initialized) { return; } try { openPin = new WisePin("ShutterOpen", hw.domeboard, DigitalPortType.FirstPortA, 0, DigitalPortDirection.DigitalOut, controlled: true); closePin = new WisePin("ShutterClose", hw.domeboard, DigitalPortType.FirstPortA, 1, DigitalPortDirection.DigitalOut, controlled: true); } catch (Exception ex) { debugger.WriteLine(Debugger.DebugLevel.DebugShutter, "WiseDomeShutter.init: Exception: {0}.", ex.Message); } try { openPin.SetOff(); closePin.SetOff(); } catch (Hardware.Hardware.MaintenanceModeException) { } ReadProfile(); if (ShutterWebClientEnabled && _ipAddress != string.Empty) { webClient = new WebClient(_ipAddress, this); } shutterPins = new List <WisePin> { openPin, closePin }; _state = ShutterState.shutterError; _initialized = true; }