From 20fa65c92667a8b842c2aa69eac69804b4e2948b Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Fri, 15 Nov 2024 10:55:55 +0100 Subject: [PATCH] Slightly re-tuned temp and water controllers --- wash/src/wash/control/ControllerTemp.java | 6 +++--- wash/src/wash/control/ControllerWater.java | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/wash/src/wash/control/ControllerTemp.java b/wash/src/wash/control/ControllerTemp.java index afd0b8b..724e570 100644 --- a/wash/src/wash/control/ControllerTemp.java +++ b/wash/src/wash/control/ControllerTemp.java @@ -24,7 +24,7 @@ public final class ControllerTemp extends ActorThread { public void run() { while (true) { try { - temp = receiveWithTimeout(10000 / Settings.SPEEDUP); + temp = receiveWithTimeout(30000 / Settings.SPEEDUP); // If there is a new message, swap if (temp != null) { @@ -39,7 +39,7 @@ public final class ControllerTemp extends ActorThread { switch (heaterState) { case Order.TEMP_SET_40 -> { - if (io.getTemperature() <= 39) { + if (io.getTemperature() <= 38.5) { io.heat(true); } else { io.heat(false); @@ -48,7 +48,7 @@ public final class ControllerTemp extends ActorThread { } } case Order.TEMP_SET_60 -> { - if (io.getTemperature() <= 59) { + if (io.getTemperature() <= 58.5) { io.heat(true); } else { io.heat(false); diff --git a/wash/src/wash/control/ControllerWater.java b/wash/src/wash/control/ControllerWater.java index 6dcf200..fe3c4e8 100644 --- a/wash/src/wash/control/ControllerWater.java +++ b/wash/src/wash/control/ControllerWater.java @@ -46,13 +46,14 @@ public class ControllerWater extends ActorThread { case Order.WATER_DRAIN -> { io.drain(true); io.fill(false); + // WARNING: Float comparison if (io.getWaterLevel() == 0 && !ackSent) sendAck(); } case Order.WATER_FILL -> { io.drain(false); - if (io.getWaterLevel() < 19) + if (io.getWaterLevel() < 10) io.fill(true); else { io.fill(false); @@ -64,6 +65,9 @@ public class ControllerWater extends ActorThread { case Order.WATER_IDLE -> { io.drain(false); io.fill(false); + if (!ackSent) { + sendAck(); + } } default -> { continue;