Skip to content

Commit

Permalink
Joining FP1 and FP2 into single FP driver (#2114)
Browse files Browse the repository at this point in the history
Co-authored-by: Pavle Gartner <info@deepskydad.com>
  • Loading branch information
DeepSkyDad and Pavle Gartner committed Sep 18, 2024
1 parent 69343d3 commit a013edf
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 37 deletions.
4 changes: 2 additions & 2 deletions drivers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -761,8 +761,8 @@
<driver name="MyDCP4ESP32">indi_mydcp4esp32</driver>
<version>1.0</version>
</device>
<device label="DeepSkyDad FP1" manufacturer="DeepSkyDad">
<driver name="DeepSkyDad FP1">indi_deepskydad_fp1</driver>
<device label="DeepSkyDad FP" manufacturer="DeepSkyDad">
<driver name="DeepSkyDad FP">indi_deepskydad_fp</driver>
<version>1.0</version>
</device>
<device label="DeepSkyDad FR1" manufacturer="DeepSkyDad">
Expand Down
12 changes: 6 additions & 6 deletions drivers/auxiliary/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,13 @@ add_executable(indi_mydcp4esp32 ${mydcp4esp32_SRC})
target_link_libraries(indi_mydcp4esp32 indidriver)
install(TARGETS indi_mydcp4esp32 RUNTIME DESTINATION bin)

# ########## Deep Sky Dad FP1 ###############
SET(deepskydad_fp1_SRC
deepskydad_fp1.cpp)
# ########## Deep Sky Dad FP ###############
SET(deepskydad_fp_SRC
deepskydad_fp.cpp)

add_executable(indi_deepskydad_fp1 ${deepskydad_fp1_SRC})
target_link_libraries(indi_deepskydad_fp1 indidriver)
install(TARGETS indi_deepskydad_fp1 RUNTIME DESTINATION bin)
add_executable(indi_deepskydad_fp ${deepskydad_fp_SRC})
target_link_libraries(indi_deepskydad_fp indidriver)
install(TARGETS indi_deepskydad_fp RUNTIME DESTINATION bin)

# ########## GIOTTO ###############
SET(giotto_SRC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
file called LICENSE.
*******************************************************************************/

#include "deepskydad_fp1.h"
#include "deepskydad_fp.h"

#include "indicom.h"
#include "connectionplugins/connectionserial.h"
Expand All @@ -33,19 +33,19 @@
#include <inttypes.h>
#include <sys/ioctl.h>

// We declare an auto pointer to DeepSkyDadFP1.
static std::unique_ptr<DeepSkyDadFP1> dsdFp1(new DeepSkyDadFP1());
// We declare an auto pointer to DeepSkyDadFP.
static std::unique_ptr<DeepSkyDadFP> dsdFp(new DeepSkyDadFP());

#define FLAT_CMD 40
#define FLAT_RES 40
#define FLAT_TIMEOUT 3

DeepSkyDadFP1::DeepSkyDadFP1() : LightBoxInterface(this), DustCapInterface(this)
DeepSkyDadFP::DeepSkyDadFP() : LightBoxInterface(this), DustCapInterface(this)
{
setVersion(1, 1);
}

bool DeepSkyDadFP1::initProperties()
bool DeepSkyDadFP::initProperties()
{
INDI::DefaultDevice::initProperties();

Expand Down Expand Up @@ -88,15 +88,15 @@ bool DeepSkyDadFP1::initProperties()
return true;
}

void DeepSkyDadFP1::ISGetProperties(const char *dev)
void DeepSkyDadFP::ISGetProperties(const char *dev)
{
INDI::DefaultDevice::ISGetProperties(dev);

// Get Light box properties
LI::ISGetProperties(dev);
}

bool DeepSkyDadFP1::updateProperties()
bool DeepSkyDadFP::updateProperties()
{
INDI::DefaultDevice::updateProperties();

Expand All @@ -121,12 +121,12 @@ bool DeepSkyDadFP1::updateProperties()
return true;
}

const char *DeepSkyDadFP1::getDefaultName()
const char *DeepSkyDadFP::getDefaultName()
{
return "Deep Sky Dad FP1";
return "Deep Sky Dad FP";
}

bool DeepSkyDadFP1::Handshake()
bool DeepSkyDadFP::Handshake()
{
PortFD = serialConnection->getPortFD();
if (!ping())
Expand All @@ -141,15 +141,15 @@ bool DeepSkyDadFP1::Handshake()
return true;
}

bool DeepSkyDadFP1::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
bool DeepSkyDadFP::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
{
if (LI::processNumber(dev, name, values, names, n))
return true;

return INDI::DefaultDevice::ISNewNumber(dev, name, values, names, n);
}

bool DeepSkyDadFP1::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
bool DeepSkyDadFP::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
{
if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
{
Expand All @@ -160,7 +160,7 @@ bool DeepSkyDadFP1::ISNewText(const char *dev, const char *name, char *texts[],
return INDI::DefaultDevice::ISNewText(dev, name, texts, names, n);
}

bool DeepSkyDadFP1::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
bool DeepSkyDadFP::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
{
if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
{
Expand Down Expand Up @@ -208,14 +208,14 @@ bool DeepSkyDadFP1::ISNewSwitch(const char *dev, const char *name, ISState *stat
return INDI::DefaultDevice::ISNewSwitch(dev, name, states, names, n);
}

bool DeepSkyDadFP1::ISSnoopDevice(XMLEle *root)
bool DeepSkyDadFP::ISSnoopDevice(XMLEle *root)
{
LI::snoop(root);

return INDI::DefaultDevice::ISSnoopDevice(root);
}

bool DeepSkyDadFP1::saveConfigItems(FILE *fp)
bool DeepSkyDadFP::saveConfigItems(FILE *fp)
{
INDI::DefaultDevice::saveConfigItems(fp);

Expand All @@ -224,7 +224,7 @@ bool DeepSkyDadFP1::saveConfigItems(FILE *fp)
return LI::saveConfigItems(fp);
}

bool DeepSkyDadFP1::ping()
bool DeepSkyDadFP::ping()
{
char response[FLAT_RES] = {0};

Expand All @@ -234,7 +234,7 @@ bool DeepSkyDadFP1::ping()
return true;
}

void DeepSkyDadFP1::TimerHit()
void DeepSkyDadFP::TimerHit()
{
if (!isConnected())
return;
Expand All @@ -244,7 +244,7 @@ void DeepSkyDadFP1::TimerHit()
SetTimer(getCurrentPollingPeriod());
}

bool DeepSkyDadFP1::getStartupData()
bool DeepSkyDadFP::getStartupData()
{
bool rc1 = getFirmwareVersion();
bool rc2 = getStatus();
Expand All @@ -253,7 +253,7 @@ bool DeepSkyDadFP1::getStartupData()
return (rc1 && rc2 && rc3);
}

IPState DeepSkyDadFP1::ParkCap()
IPState DeepSkyDadFP::ParkCap()
{
char response[FLAT_RES];
if (!sendCommand("[STRG270]", response) || !sendCommand("[SMOV]", response))
Expand All @@ -269,7 +269,7 @@ IPState DeepSkyDadFP1::ParkCap()
return IPS_ALERT;
}

IPState DeepSkyDadFP1::UnParkCap()
IPState DeepSkyDadFP::UnParkCap()
{
char response[FLAT_RES];
if (!sendCommand("[STRG0]", response) || !sendCommand("[SMOV]", response))
Expand All @@ -285,7 +285,7 @@ IPState DeepSkyDadFP1::UnParkCap()
return IPS_ALERT;
}

bool DeepSkyDadFP1::EnableLightBox(bool enable)
bool DeepSkyDadFP::EnableLightBox(bool enable)
{
char command[FLAT_CMD];
char response[FLAT_RES];
Expand All @@ -304,7 +304,7 @@ bool DeepSkyDadFP1::EnableLightBox(bool enable)
return false;
}

bool DeepSkyDadFP1::getStatus()
bool DeepSkyDadFP::getStatus()
{
char response[FLAT_RES];

Expand Down Expand Up @@ -484,7 +484,7 @@ bool DeepSkyDadFP1::getStatus()
return true;
}

bool DeepSkyDadFP1::getFirmwareVersion()
bool DeepSkyDadFP::getFirmwareVersion()
{
char response[FLAT_RES] = {0};
if (!sendCommand("[GFRM]", response))
Expand All @@ -498,7 +498,7 @@ bool DeepSkyDadFP1::getFirmwareVersion()
return true;
}

bool DeepSkyDadFP1::getBrightness()
bool DeepSkyDadFP::getBrightness()
{
char response[FLAT_RES] = {0};
if (!sendCommand("[GLBR]", response))
Expand All @@ -523,7 +523,7 @@ bool DeepSkyDadFP1::getBrightness()
return true;
}

bool DeepSkyDadFP1::SetLightBoxBrightness(uint16_t value)
bool DeepSkyDadFP::SetLightBoxBrightness(uint16_t value)
{
char command[FLAT_CMD] = {0};
char response[FLAT_RES] = {0};
Expand All @@ -541,7 +541,7 @@ bool DeepSkyDadFP1::SetLightBoxBrightness(uint16_t value)
return true;
}

bool DeepSkyDadFP1::sendCommand(const char *cmd, char *res)
bool DeepSkyDadFP::sendCommand(const char *cmd, char *res)
{
int nbytes_written = 0, nbytes_read = 0, rc = -1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ namespace Connection
class Serial;
}

class DeepSkyDadFP1 : public INDI::DefaultDevice, public INDI::LightBoxInterface, public INDI::DustCapInterface
class DeepSkyDadFP : public INDI::DefaultDevice, public INDI::LightBoxInterface, public INDI::DustCapInterface
{
public:
DeepSkyDadFP1();
virtual ~DeepSkyDadFP1() = default;
DeepSkyDadFP();
virtual ~DeepSkyDadFP() = default;

typedef enum { Off, On, OnIfFlapOpenOrLedActive } HeaterMode;

Expand Down

0 comments on commit a013edf

Please sign in to comment.