Correctly implemented programs
This commit is contained in:
parent
81ee61c779
commit
3d5b098595
2 changed files with 17 additions and 4 deletions
|
@ -47,16 +47,23 @@ public final class WashingProgram1 extends ActorThread<WashingMessage> {
|
|||
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<WashingMessage> {
|
|||
// 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<WashingMessage> {
|
|||
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);
|
||||
|
||||
|
|
|
@ -48,6 +48,9 @@ public final class WashingProgram2 extends ActorThread<WashingMessage> {
|
|||
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<WashingMessage> {
|
|||
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<WashingMessage> {
|
|||
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.
|
||||
|
|
Loading…
Reference in a new issue