Skip to content

Commit

Permalink
Add delay possibility for lx200 driver pulse command, and have the ge… (
Browse files Browse the repository at this point in the history
  • Loading branch information
amendolajamie authored Dec 16, 2022
1 parent ce2aef3 commit f743772
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
6 changes: 5 additions & 1 deletion drivers/telescope/lx200driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1650,7 +1650,7 @@ int MoveTo(int fd, int direction)
return 0;
}

int SendPulseCmd(int fd, int direction, int duration_msec)
int SendPulseCmd(int fd, int direction, int duration_msec, bool wait_after_command, int max_wait_ms)
{
DEBUGFDEVICE(lx200Name, DBG_SCOPE, "<%s>", __FUNCTION__);
int nbytes_write = 0;
Expand Down Expand Up @@ -1691,6 +1691,10 @@ int SendPulseCmd(int fd, int direction, int duration_msec)
tty_write_string(fd, cmd, &nbytes_write);

tcflush(fd, TCIFLUSH);

if(wait_after_command){
usleep((duration_msec>max_wait_ms) ? max_wait_ms*1000 : duration_msec*1000);
}
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/telescope/lx200driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ int selectTrackingMode(int fd, int trackMode);
/* Is Slew complete? 0 if complete, 1 if in progress, otherwise return an error */
int isSlewComplete(int fd);
/* Send Pulse-Guide command (timed guide move), two valid directions can be stacked */
int SendPulseCmd(int fd, int direction, int duration_msec);
int SendPulseCmd(int fd, int direction, int duration_msec, bool wait_after_command=false, int max_wait_ms=1000);

/**************************************************************************
Other Commands
Expand Down
5 changes: 5 additions & 0 deletions drivers/telescope/lx200gemini.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1527,6 +1527,11 @@ bool LX200Gemini::getGeminiProperty(uint32_t propertyNumber, char* value)
return true;
}

int LX200Gemini::SendPulseCmd(int8_t direction, uint32_t duration_msec)
{
return ::SendPulseCmd(PortFD, direction, duration_msec, true, 1000);
}

bool LX200Gemini::setGeminiProperty(uint32_t propertyNumber, char* value)
{
int rc = TTY_OK;
Expand Down
3 changes: 3 additions & 0 deletions drivers/telescope/lx200gemini.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ class LX200Gemini : public LX200Generic

virtual bool saveConfigItems(FILE *fp) override;

// Guide Pulse Commands
virtual int SendPulseCmd(int8_t direction, uint32_t duration_msec) override;

private:
void syncPec();
void syncSideOfPier();
Expand Down

0 comments on commit f743772

Please sign in to comment.