diff --git a/drivers/telescope/lx200_OnStep.cpp b/drivers/telescope/lx200_OnStep.cpp index f89db90b37..cd11e4b25c 100644 --- a/drivers/telescope/lx200_OnStep.cpp +++ b/drivers/telescope/lx200_OnStep.cpp @@ -5457,3 +5457,28 @@ IPState LX200_OnStep::ExecuteHomeAction(TelescopeHomeAction action) return IPS_ALERT; } + +bool LX200_OnStep::Handshake() +{ + if (checkConnection()) + { + return true; + } + + /* OnStepX has a tendency to start up in an unresponsive state + * due to grabage in the serial buffer. Try to reset it by sending + * the :GVP# command repeatedly. + * + * First sending should result in a '0' response, the second in + * 'OnStep' so the 2nd sending should return with a failure. + */ + if(sendOnStepCommand(":GVP#")) + { + if(!sendOnStepCommand(":GVP#")) + { + return checkConnection(); + } + } + + return false; +} diff --git a/drivers/telescope/lx200_OnStep.h b/drivers/telescope/lx200_OnStep.h index 27a3db7221..f5ee26685c 100644 --- a/drivers/telescope/lx200_OnStep.h +++ b/drivers/telescope/lx200_OnStep.h @@ -180,6 +180,7 @@ class LX200_OnStep : public LX200Generic, public INDI::WeatherInterface, public virtual bool updateProperties() override; virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override; virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override; + virtual bool Handshake() override; protected: virtual void getBasicData() override; @@ -506,7 +507,4 @@ class LX200_OnStep : public LX200Generic, public INDI::WeatherInterface, public private: int currentCatalog; int currentSubCatalog; - - - };