Skip to content

Commit

Permalink
Added Bayer filter support for color cameras (#15)
Browse files Browse the repository at this point in the history
* Added Bayer filter support for color cameras

* Update changelog
  • Loading branch information
karlrees authored and knro committed Nov 5, 2019
1 parent e587d04 commit 26bc351
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
6 changes: 6 additions & 0 deletions debian/indi-sx/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
indi-sx (1.14) bionic; urgency=low

* Added Bayer filter support option for color cameras

-- Karl Rees <[email protected]> Mon, 04 Nov 2019 17:45:00 +0300

indi-sx (1.13) bionic; urgency=low

* New release
Expand Down
38 changes: 38 additions & 0 deletions indi-sx/sxccd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
Copyright (c) 2012-2013 Cloudmakers, s. r. o.
All Rights Reserved.
Bayer Support Added by Karl Rees, Copyright(c) 2019
Code is based on SX INDI Driver by Gerry Rozema and Jasem Mutlaq
Copyright(c) 2010 Gerry Rozema.
Copyright(c) 2012 Jasem Mutlaq.
Expand Down Expand Up @@ -192,6 +194,7 @@ SXCCD::SXCCD(DEVICE device, const char *name)
HasCooler = false;
HasST4Port = false;
HasGuideHead = false;
HasColor = false;
ExposureTimerID = 0;
DidFlush = false;
DidLatch = false;
Expand Down Expand Up @@ -238,6 +241,12 @@ bool SXCCD::initProperties()
IUFillSwitch(&ShutterS[1], "SHUTTER_OFF", "Manual close", ISS_ON);
IUFillSwitchVector(&ShutterSP, ShutterS, 2, getDeviceName(), "CCD_SHUTTER", "Shutter", OPTIONS_TAB, IP_RW,
ISR_1OFMANY, 60, IPS_IDLE);
//Adding switch to let user indicate whether the CCD has a Bayer filter, since I do not know which models beyond UltraStar C actually do
IUFillSwitch(&BayerS[0], "BAYER_TRUE", "True", ISS_OFF);
IUFillSwitch(&BayerS[1], "BAYER_FALSE", "False", ISS_ON);
IUFillSwitchVector(&BayerSP, BayerS, 2, getDeviceName(), "CCD_BAYER_FILTER", "Bayer Filter", IMAGE_SETTINGS_TAB, IP_RW, ISR_1OFMANY,
60, IPS_IDLE);
IUSaveText(&BayerT[2], "RGGB");

// we can expose less than 0.01 seconds at a time
// and we need to for an allsky in daytime
Expand All @@ -256,13 +265,19 @@ bool SXCCD::updateProperties()
defineSwitch(&CoolerSP);
if (HasShutter)
defineSwitch(&ShutterSP);
if (HasColor) {
defineSwitch(&BayerSP);
}
}
else
{
if (HasCooler)
deleteProperty(CoolerSP.name);
if (HasShutter)
deleteProperty(ShutterSP.name);
if (HasColor) {
deleteProperty(BayerSP.name);
}
}
return true;
}
Expand Down Expand Up @@ -325,6 +340,7 @@ bool SXCCD::Connect()
HasCooler = params.extra_caps & SXUSB_CAPS_COOLER;
HasShutter = params.extra_caps & SXUSB_CAPS_SHUTTER;
HasST4Port = params.extra_caps & SXCCD_CAPS_STAR2K;
HasColor = sxIsColor(model);

uint32_t cap = CCD_CAN_ABORT | CCD_CAN_SUBFRAME | CCD_CAN_BIN;

Expand Down Expand Up @@ -826,7 +842,29 @@ bool SXCCD::ISNewSwitch(const char *dev, const char *name, ISState *states, char
IDSetNumber(&TemperatureNP, nullptr);
result = true;
}
else if (strcmp(name, BayerSP.name) == 0)
{
IUUpdateSwitch(&BayerSP, states, names, n);
BayerSP.s = IPS_OK;
IDSetSwitch(&BayerSP, nullptr);
if (BayerS[0].s == ISS_ON) {
SetCCDCapability(GetCCDCapability() | CCD_HAS_BAYER);
defineText(&BayerTP);
}
else {
SetCCDCapability(GetCCDCapability() & ~CCD_HAS_BAYER);
deleteProperty(BayerTP.name);
}
result = true;
}
else
result = INDI::CCD::ISNewSwitch(dev, name, states, names, n);
return result;
}

bool SXCCD::saveConfigItems(FILE *fp)
{
INDI::CCD::saveConfigItems(fp);
IUSaveConfigSwitch(fp, &BayerSP);
return true;
}
6 changes: 6 additions & 0 deletions indi-sx/sxccd.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
Copyright (c) 2012-2013 Cloudmakers, s. r. o.
All Rights Reserved.
Bayer Support Added by Karl Rees, Copyright(c) 2019
Code is based on SX INDI Driver by Gerry Rozema and Jasem Mutlaq
Copyright(c) 2010 Gerry Rozema.
Copyright(c) 2012 Jasem Mutlaq.
Expand Down Expand Up @@ -51,6 +53,8 @@ class SXCCD : public INDI::CCD
ISwitchVectorProperty CoolerSP;
ISwitch ShutterS[2];
ISwitchVectorProperty ShutterSP;
ISwitch BayerS[2];
ISwitchVectorProperty BayerSP;
float TemperatureRequest;
float TemperatureReported;
float ExposureTimeLeft;
Expand Down Expand Up @@ -84,6 +88,7 @@ class SXCCD : public INDI::CCD
void GuideExposureTimerHit();
void WEGuiderTimerHit();
void NSGuiderTimerHit();
bool saveConfigItems(FILE *fp);
IPState GuideWest(uint32_t ms);
IPState GuideEast(uint32_t ms);
IPState GuideNorth(uint32_t ms);
Expand All @@ -94,6 +99,7 @@ class SXCCD : public INDI::CCD
bool HasShutter;
bool HasST4Port;
bool HasGuideHead;
bool HasColor;
SXCCD(DEVICE device, const char *name);
virtual ~SXCCD();
void debugTriggered(bool enable);
Expand Down
2 changes: 1 addition & 1 deletion indi-sx/sxconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
#pragma once

#define VERSION_MAJOR 1
#define VERSION_MINOR 13
#define VERSION_MINOR 14

0 comments on commit 26bc351

Please sign in to comment.