Skip to content

Commit

Permalink
Set setpoint after turning cooler on in case some cams require that o…
Browse files Browse the repository at this point in the history
…rder
  • Loading branch information
daleghent committed Nov 1, 2024
1 parent ec11bfa commit cab0ef6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/event_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2089,7 +2089,6 @@ static void get_calibration_data(JObj& response, const json_value *params)

static void set_cooler_state(JObj& response, const json_value *params)
{
bool ret;
Params p("enabled", params);
const json_value *val = p.param("enabled");
bool enable;
Expand All @@ -2111,21 +2110,22 @@ static void set_cooler_state(JObj& response, const json_value *params)
return;
}

if (!pCamera->SetCoolerOn(enable))
{
response << jrpc_error(1, "failed to set cooler state");
}

if (enable)
{
double setpt = pConfig->Profile.GetDouble("/camera/CoolerSetpt", 10.0);
ret = pCamera->SetCoolerSetpoint(setpt);
if (!ret)
if (!pCamera->SetCoolerSetpoint(setpt));
{
response << jrpc_error(1, "failed to set cooler setpoint");
return;
}
}

if (pCamera->SetCoolerOn(enable))
response << jrpc_result(0);
else
response << jrpc_error(1, "failed to set cooler state");
response << jrpc_result(0);
}

static void get_cooler_status(JObj& response, const json_value *params)
Expand Down

0 comments on commit cab0ef6

Please sign in to comment.