From bff9ddf067b9d34e1fbe1368da7da83eaa89d991 Mon Sep 17 00:00:00 2001 From: Jasem Mutlaq Date: Wed, 4 Oct 2023 12:36:48 +0300 Subject: [PATCH] Do not turn cooler on if target temperature is higher than current --- drivers/ccd/ccd_simulator.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/ccd/ccd_simulator.cpp b/drivers/ccd/ccd_simulator.cpp index 385f878a96..556ccc2ecf 100644 --- a/drivers/ccd/ccd_simulator.cpp +++ b/drivers/ccd/ccd_simulator.cpp @@ -311,9 +311,10 @@ int CCDSim::SetTemperature(double temperature) return 1; } - CoolerS[0].s = ISS_ON; - CoolerS[1].s = ISS_OFF; - CoolerSP.s = IPS_BUSY; + auto isCooling = TemperatureRequest < temperature; + CoolerS[0].s = isCooling ? ISS_ON : ISS_OFF; + CoolerS[1].s = isCooling ? ISS_OFF : ISS_ON; + CoolerSP.s = isCooling ? IPS_BUSY : IPS_IDLE; IDSetSwitch(&CoolerSP, nullptr); return 0; }