Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to DDW driver #1344

Merged
merged 1 commit into from
Feb 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 30 additions & 7 deletions drivers/dome/ddw_dome.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ DDW::DDW()
{
setVersion(1, 0);
SetDomeCapability(DOME_CAN_ABORT | DOME_CAN_ABS_MOVE | DOME_CAN_PARK | DOME_HAS_SHUTTER);
setDomeConnection(CONNECTION_SERIAL);
}

bool DDW::initProperties()
Expand Down Expand Up @@ -153,6 +154,9 @@ bool DDW::Handshake()
return false;

parseGINF(response.c_str());
cmdState = IDLE;
DomeAbsPosNP.s = IPS_OK;
IDSetNumber(&DomeAbsPosNP, nullptr);
return true;
}

Expand Down Expand Up @@ -296,8 +300,6 @@ void DDW::parseGINF(const char *response)
homeAz = 360.0 * homepos / ticksPerRev;

DomeAbsPosN[0].value = 360.0 * azimuth / ticksPerRev;
DomeAbsPosNP.s = IPS_OK;
IDSetNumber(&DomeAbsPosNP, nullptr);

DomeShutterSP.s = IPS_OK;
IUResetSwitch(&DomeShutterSP);
Expand Down Expand Up @@ -371,7 +373,6 @@ void DDW::TimerHit()

// Update current position
DomeAbsPosN[0].value = 359.0 * tick / ticksPerRev;
DomeAbsPosNP.s = IPS_OK;
IDSetNumber(&DomeAbsPosNP, nullptr);
break;
}
Expand Down Expand Up @@ -418,23 +419,38 @@ void DDW::TimerHit()
{
// First phase of parking done, now move to park position
cmdState = IDLE;
MoveAbs(GetAxis1Park());
DomeAbsPosNP.s = MoveAbs(GetAxis1Park());
}
else
{
SetParked(true);
cmdState = IDLE;
DomeAbsPosNP.s = IPS_OK;
}
break;
case DOME_UNPARKING:
SetParked(false);
cmdState = IDLE;
break;
default:
if(gotoPending && cmdState == MOVING)
{
cmdState = IDLE; // Set state so move goes through
MoveAbs(gotoTarget);
gotoPending = false;
}
else
{
cmdState = IDLE;
// Movement now over
DomeAbsPosNP.s = IPS_OK;
}
break;
}
cmdState = IDLE;
IDSetNumber(&DomeAbsPosNP, nullptr);
break;
default:
LOGF_ERROR("Unknown respose character %c", response[0]);
LOGF_ERROR("Unknown response character %c", response[0]);
break;
}
}
Expand All @@ -448,7 +464,14 @@ IPState DDW::MoveAbs(double az)
{
LOGF_DEBUG("MoveAbs (%f)", az);

if (cmdState != IDLE)
if (cmdState == MOVING)
{
LOG_DEBUG("Dome already moving, latching the new move command");
gotoTarget = az;
gotoPending = true;
return IPS_BUSY;
}
else if (cmdState != IDLE)
{
LOG_ERROR("Dome needs to be idle to issue moves");
return IPS_ALERT;
Expand Down
3 changes: 3 additions & 0 deletions drivers/dome/ddw_dome.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ class DDW : public INDI::Dome

int fwVersion{ -1 };

double gotoTarget { 0 };
bool gotoPending { false };

enum
{
IDLE,
Expand Down