Add PlantSchemeWindow
This commit is contained in:
@@ -9,7 +9,7 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
protected bool IsRunning = true;
|
||||
protected Thread? BackgroundThread;
|
||||
|
||||
public event EventHandler<EventArgs>? Update;
|
||||
public event EventHandler<PlantEventArgs>? Update;
|
||||
|
||||
protected bool ActuatorsChanged = false;
|
||||
protected PamhagenPlc.ActuatorStates Actuators;
|
||||
@@ -48,13 +48,14 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
public bool IsBeltActive => Actuators.Belt;
|
||||
public bool IsAuger1Active => Actuators.Auger1;
|
||||
public bool IsAuger2Active => Actuators.Auger2;
|
||||
public bool IsWasteDisposalActive => IsBeltActive || IsAuger1Active || IsAuger2Active;
|
||||
public bool IsGradationPumpActive => Actuators.GradationPump;
|
||||
|
||||
public PamhagenPlant(string portName) {
|
||||
Plc = new(portName);
|
||||
}
|
||||
|
||||
protected virtual void RaiseUpdateEvent(EventArgs evt) {
|
||||
protected virtual void RaiseUpdateEvent(PlantEventArgs evt) {
|
||||
App.MainDispatcher.BeginInvoke(() => Update?.Invoke(this, evt));
|
||||
}
|
||||
|
||||
@@ -81,7 +82,7 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
ActuatorsChanged = false;
|
||||
}
|
||||
Sensors = await Plc.ReadInputs();
|
||||
RaiseUpdateEvent(EventArgs.Empty);
|
||||
RaiseUpdateEvent(new());
|
||||
} catch (Exception exc) {
|
||||
var str = "Bei der SPS ist ein Fehler aufgetreten:\n\n" + exc.Message;
|
||||
if (exc.InnerException != null) str += "\n\n" + exc.InnerException.Message;
|
||||
@@ -220,6 +221,18 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
Actuators.Auger2 = false;
|
||||
}
|
||||
|
||||
public void StartWasteDisposal() {
|
||||
StartBelt();
|
||||
StartAuger1();
|
||||
StartAuger2();
|
||||
}
|
||||
|
||||
public void StopWasteDisposal() {
|
||||
StopBelt();
|
||||
StopAuger1();
|
||||
StopAuger2();
|
||||
}
|
||||
|
||||
public void StartGradationPump() {
|
||||
Actuators.GradationPump = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user