Skip to content

Commit

Permalink
Fix DustCover open/close
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-englmaier committed Dec 16, 2024
1 parent fb54605 commit 548be65
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions drivers/focuser/alluna_tcs2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@ void AllunaTCS2::TimerHit()
receiveDone();
ParkCapSP.setState(IPS_OK);
ParkCapSP.apply();
getDustCover();
break;
default: // unexpected output
LOGF_INFO("TimerHit: unexpected response (%s)", res);
Expand Down Expand Up @@ -844,33 +845,43 @@ bool AllunaTCS2::getDustCover()
ParkCapSP[CAP_UNPARK].setState((value == 1) ? ISS_ON : ISS_OFF);
ParkCapSP[CAP_PARK ].setState((value != 1) ? ISS_ON : ISS_OFF);
ParkCapSP.setState(IPS_OK);
ParkCapSP.apply();

return true;
}

IPState AllunaTCS2::ParkCap()
{
if (ParkCapSP[CAP_PARK].getState() == ISS_OFF)
if (ParkCapSP[CAP_PARK].getState() == ISS_ON)
{
if (setDustCover()) // toggle state of dust cover
LOG_INFO("Toggle");
if (setDustCover()) { // toggle state of dust cover
isCoverMoving = true;
return IPS_BUSY;
}
else
return IPS_ALERT;
}
getDustCover();

// Cover already parked, nothing to do
return IPS_OK;
}

IPState AllunaTCS2::UnParkCap()
{
if (ParkCapSP[CAP_UNPARK].getState() == ISS_OFF)
LOGF_INFO("UnParkCap called, state is %d %d", ParkCapSP[CAP_PARK].getState(), ParkCapSP[CAP_UNPARK].getState());
if (ParkCapSP[CAP_UNPARK].getState() == ISS_ON)
{
if (setDustCover()) // toggle state of dust cover
LOG_INFO("Toggle");
if (setDustCover()) { // toggle state of dust cover
isCoverMoving = true;
return IPS_BUSY;
}
else
return IPS_ALERT;
}
getDustCover();

// Cover already unparked, nothing to do
return IPS_OK;
Expand Down

0 comments on commit 548be65

Please sign in to comment.