Skip to content

Commit

Permalink
Add error message if the driver cannot find the camera either by inde…
Browse files Browse the repository at this point in the history
…x alone or configuration name
  • Loading branch information
knro committed Aug 27, 2021
1 parent 93da2f9 commit 8f97c60
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions indi-asi/asi_single_ccd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,26 @@ void ASISingleCamera::ISGetProperties(const char *dev)
bool ASISingleCamera::initProperties()
{
if (initCameraFromConfig())
{
m_ConfigCameraFound = true;
setDeviceName(mCameraName.c_str());
}

return ASIBase::initProperties();
}

bool ASISingleCamera::Connect()
{
if (!m_ConfigCameraFound)
{
LOG_WARN("Failed to find camera. Please check USB and power connections.");
return false;
}

return ASIBase::Connect();

}

bool ASISingleCamera::ISNewSwitch(const char *dev, const char *name, ISState * states, char *names[], int n)
{
if (dev != nullptr && !strcmp(dev, getDeviceName()))
Expand Down
2 changes: 2 additions & 0 deletions indi-asi/asi_single_ccd.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class ASISingleCamera : public ASIBase

virtual const char *getDefaultName() override;

virtual bool Connect() override;
virtual void ISGetProperties(const char *dev) override;
virtual bool initProperties() override;

Expand All @@ -57,4 +58,5 @@ class ASISingleCamera : public ASIBase
private:
const std::string CamerasListFile;
std::map<std::string, std::string> m_ConfigCameras;
bool m_ConfigCameraFound {false};
};

0 comments on commit 8f97c60

Please sign in to comment.