From 3d5b098595038fb643a41ba287fb8dcf41a976df Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Fri, 15 Nov 2024 10:56:12 +0100 Subject: [PATCH] Correctly implemented programs --- wash/src/wash/program/WashingProgram1.java | 12 +++++++++++- wash/src/wash/program/WashingProgram2.java | 9 ++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/wash/src/wash/program/WashingProgram1.java b/wash/src/wash/program/WashingProgram1.java index 581ce97..34086a2 100644 --- a/wash/src/wash/program/WashingProgram1.java +++ b/wash/src/wash/program/WashingProgram1.java @@ -47,16 +47,23 @@ public final class WashingProgram1 extends ActorThread { temp.send(new WashingMessage(this, TEMP_SET_40)); receive(); + spin.send(new WashingMessage(this, SPIN_SLOW)); + receive(); + // Keep the temperature for 30 min Thread.sleep(30 * 60000 / Settings.SPEEDUP); // Drain temp.send(new WashingMessage(this, TEMP_IDLE)); receive(); + spin.send(new WashingMessage(this, SPIN_OFF)); + receive(); water.send(new WashingMessage(this, WATER_DRAIN)); receive(); // Rinse 5*2 minutes in cold water + spin.send(new WashingMessage(this, SPIN_SLOW)); + receive(); for(int a = 0; a < 5; a++) { water.send(new WashingMessage(this, WATER_FILL)); receive(); @@ -70,7 +77,7 @@ public final class WashingProgram1 extends ActorThread { // Centrifuge for five minutes spin.send(new WashingMessage(this, SPIN_FAST)); receive(); - Thread.sleep(5 * 60000 / Settings.SPEEDUP); + Thread.sleep(10 * 60000 / Settings.SPEEDUP); spin.send(new WashingMessage(this, SPIN_OFF)); receive(); @@ -81,6 +88,9 @@ public final class WashingProgram1 extends ActorThread { water.send(new WashingMessage(this, WATER_DRAIN)); receive(); + water.send(new WashingMessage(this, WATER_IDLE)); + receive(); + // Now that the barrel has stopped, it is safe to open the hatch. io.lock(false); diff --git a/wash/src/wash/program/WashingProgram2.java b/wash/src/wash/program/WashingProgram2.java index 860801d..04b52ab 100644 --- a/wash/src/wash/program/WashingProgram2.java +++ b/wash/src/wash/program/WashingProgram2.java @@ -48,6 +48,9 @@ public final class WashingProgram2 extends ActorThread { temp.send(new WashingMessage(this, TEMP_SET_40)); receive(); + spin.send(new WashingMessage(this, SPIN_SLOW)); + receive(); + // Keep the temperature for 20 min Thread.sleep(20 * 60000 / Settings.SPEEDUP); @@ -72,7 +75,7 @@ public final class WashingProgram2 extends ActorThread { receive(); // Rinse 5*2 minutes in cold water - for(int a = 0; a < 5; a++) { + for(int a = 0; a <= 5; a++) { water.send(new WashingMessage(this, WATER_FILL)); receive(); @@ -90,10 +93,10 @@ public final class WashingProgram2 extends ActorThread { spin.send(new WashingMessage(this, SPIN_OFF)); receive(); - temp.send(new WashingMessage(this, TEMP_IDLE)); + water.send(new WashingMessage(this, WATER_DRAIN)); receive(); - water.send(new WashingMessage(this, WATER_DRAIN)); + water.send(new WashingMessage(this, WATER_IDLE)); receive(); // Now that the barrel has stopped, it is safe to open the hatch.