Slightly re-tuned temp and water controllers

This commit is contained in:
Imbus 2024-11-15 10:55:55 +01:00
parent 1f880a1167
commit 20fa65c926
2 changed files with 8 additions and 4 deletions

View file

@ -24,7 +24,7 @@ public final class ControllerTemp extends ActorThread<WashingMessage> {
public void run() { public void run() {
while (true) { while (true) {
try { try {
temp = receiveWithTimeout(10000 / Settings.SPEEDUP); temp = receiveWithTimeout(30000 / Settings.SPEEDUP);
// If there is a new message, swap // If there is a new message, swap
if (temp != null) { if (temp != null) {
@ -39,7 +39,7 @@ public final class ControllerTemp extends ActorThread<WashingMessage> {
switch (heaterState) { switch (heaterState) {
case Order.TEMP_SET_40 -> { case Order.TEMP_SET_40 -> {
if (io.getTemperature() <= 39) { if (io.getTemperature() <= 38.5) {
io.heat(true); io.heat(true);
} else { } else {
io.heat(false); io.heat(false);
@ -48,7 +48,7 @@ public final class ControllerTemp extends ActorThread<WashingMessage> {
} }
} }
case Order.TEMP_SET_60 -> { case Order.TEMP_SET_60 -> {
if (io.getTemperature() <= 59) { if (io.getTemperature() <= 58.5) {
io.heat(true); io.heat(true);
} else { } else {
io.heat(false); io.heat(false);

View file

@ -46,13 +46,14 @@ public class ControllerWater extends ActorThread<WashingMessage> {
case Order.WATER_DRAIN -> { case Order.WATER_DRAIN -> {
io.drain(true); io.drain(true);
io.fill(false); io.fill(false);
// WARNING: Float comparison
if (io.getWaterLevel() == 0 && !ackSent) if (io.getWaterLevel() == 0 && !ackSent)
sendAck(); sendAck();
} }
case Order.WATER_FILL -> { case Order.WATER_FILL -> {
io.drain(false); io.drain(false);
if (io.getWaterLevel() < 19) if (io.getWaterLevel() < 10)
io.fill(true); io.fill(true);
else { else {
io.fill(false); io.fill(false);
@ -64,6 +65,9 @@ public class ControllerWater extends ActorThread<WashingMessage> {
case Order.WATER_IDLE -> { case Order.WATER_IDLE -> {
io.drain(false); io.drain(false);
io.fill(false); io.fill(false);
if (!ackSent) {
sendAck();
}
} }
default -> { default -> {
continue; continue;