Index: CMakeLists.txt =================================================================== --- CMakeLists.txt (revision 2036) +++ CMakeLists.txt (working copy) @@ -24,7 +24,9 @@ ${CMAKE_CURRENT_SOURCE_DIR}/DsiDevice.cpp ${CMAKE_CURRENT_SOURCE_DIR}/DsiDeviceFactory.cpp ${CMAKE_CURRENT_SOURCE_DIR}/DsiPro.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/DsiColor.cpp ${CMAKE_CURRENT_SOURCE_DIR}/DsiProII.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/DsiColorII.cpp ${CMAKE_CURRENT_SOURCE_DIR}/DsiTypes.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Util.cpp ) Index: DsiColor.cpp =================================================================== --- DsiColor.cpp (revision 0) +++ DsiColor.cpp (working copy) @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2009, Roland Roberts + * Copyright (c) 2015, Ben Gilsrud + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "DsiColor.h" +#include "DsiDevice.h" + +using namespace DSI; + +void +DsiColor::initImager(const char *devname) +{ + + command(DeviceCommand::SET_ROW_COUNT_EVEN, read_height_even); + command(DeviceCommand::SET_ROW_COUNT_ODD, read_height_odd); + + if (is_high_gain) + sendRegister(AdRegister::CONFIGURATION, 0x58); + else + sendRegister(AdRegister::CONFIGURATION, 0xd8); + + sendRegister(AdRegister::MUX_CONFIG, 0xc0); + + /* Sigh. "Interestingly," it would appear that you MUST take at least one + * throw-away image or else GET_EXP_TIMER_COUNT won't work on "real" + * exposures. Sounds like a firmware bug to me, but not something we can + * do anything about. Although MaximDL uses 4 exposures of 1000 ticks + * (100 ms) each, this shorter exposure works just fine. + */ + for (int i = 0; i < 1; i++) { + unsigned char *foo = getImage(1); + delete [] foo; + } +} + +DsiColor::DsiColor(const char *devname) : Device(devname) +{ + // color_type = ColorType.NONE; + is_high_gain = true; + + is_color = true; + + /* Turn off test mode so we can actually return an image */ + test_pattern = false; + + /* The DSI Color I cannot be put into 2x2 binning mode. */ + is_binnable = false; + + + /* Sony lists the pixel size a 9.6x7.5 microns. Craig Stark, in a note at + * http://www.skyinsight.com/wiki/ regarding the Orion Star Shoot, points + * out that that size does not fill the size of the chip. I'm not sure we + * care; I think all we care about is the pixel-to-pixel center distance + * as this determines how the final image has to be scaled to have a 1:1 + * aspect ratio for display. + */ + aspect_ratio = 0.78125; + + read_width = 537; + read_height_even = 253; + read_height_odd = 252; + read_height = read_height_even + read_height_odd; + + read_bpp = 2; + + image_width = 508; + image_height = 488; + image_offset_x = 23; + image_offset_y = 13; + pixel_size_x = 9.6; + pixel_size_y = 7.5; + + exposure_time = 10; + + initImager(); + +} + +DsiColor::~DsiColor() +{ +} Index: DsiColor.h =================================================================== --- DsiColor.h (revision 0) +++ DsiColor.h (working copy) @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2009, Roland Roberts + * Copyright (c) 2015, Ben Gilsrud + * + */ + +#ifndef __DsiColor_hh +#define __DsiColor_hh + +#include "DsiDevice.h" + +namespace DSI { + + class DsiColor : public Device { + + private: + + protected: + + void initImager(const char *devname = 0); + + public: + + DsiColor(const char *devname = 0); + ~DsiColor(); + }; +}; + +#endif /* __DsiColor_hh */ + Index: DsiColorII.cpp =================================================================== --- DsiColorII.cpp (revision 0) +++ DsiColorII.cpp (working copy) @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2009, Roland Roberts + * Copyright (c) 2015, Ben Gilsrud + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "DsiColorII.h" + +using namespace DSI; + +void +DsiColorII::initImager(const char *devname) +{ + + command(DeviceCommand::SET_ROW_COUNT_EVEN, read_height_even); + command(DeviceCommand::SET_ROW_COUNT_ODD, read_height_odd); + + if (is_high_gain) + sendRegister(AdRegister::CONFIGURATION, 0x58); + else + sendRegister(AdRegister::CONFIGURATION, 0xd8); + + sendRegister(AdRegister::MUX_CONFIG, 0xc0); + + /* Sigh. "Interestingly," it would appear that you MUST take at least one + * throw-away image or else GET_EXP_TIMER_COUNT won't work on "real" + * exposures. Sounds like a firmware bug to me, but not something we can + * do anything about. Although MaximDL uses 4 exposures of 1000 ticks + * (100 ms) each, this shorter exposure works just fine. + */ + for (int i = 0; i < 1; i++) { + unsigned char *foo = getImage(1); + delete [] foo; + } +} + +DsiColorII::DsiColorII(const char *devname) : Device(devname) +{ + // color_type = ColorType.NONE; + is_high_gain = true; + + is_color = true; + + /* Turn off test mode so we can actually return an image */ + test_pattern = false; + + is_binnable = false; + + aspect_ratio = 0.78125; + + read_width = 795; + read_height_even = 299; + read_height_odd = 298; + read_height = read_height_even + read_height_odd; + + read_bpp = 2; + + image_width = 748; + image_height = 577; + image_offset_x = 30; + image_offset_y = 13; + + timeout_response = 1000; + timeout_request = 1000; + timeout_image = 5000; + pixel_size_x = 8.6; + pixel_size_y = 8.3; + + exposure_time = 10; + + initImager(); +} + +DsiColorII::~DsiColorII() {} Index: DsiColorII.h =================================================================== --- DsiColorII.h (revision 0) +++ DsiColorII.h (working copy) @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2009, Roland Roberts + * Copyright (c) 2015, Ben Gilsrud + * + */ + +#ifndef __DsiColorII_hh +#define __DsiColorII_hh + +#include "DsiDevice.h" + +namespace DSI { + + class DsiColorII : public Device { + + private: + + protected: + + void initImager(const char *devname = 0); + + public: + + DsiColorII(const char *devname = 0); + ~DsiColorII(); + }; +}; + +#endif /* __DsiColorII_hh */ + Index: DsiDevice.h =================================================================== --- DsiDevice.h (revision 2036) +++ DsiDevice.h (working copy) @@ -174,6 +174,7 @@ virtual unsigned int getImageOffsetY() { return image_offset_y; }; virtual float getPixelSizeX() { return pixel_size_x; }; virtual float getPixelSizeY() { return pixel_size_y; }; + virtual bool isColor() { return is_color; }; virtual void abortExposure(); virtual unsigned int getAdRegister(DSI::AdRegister reg); Index: DsiDeviceFactory.cpp =================================================================== --- DsiDeviceFactory.cpp (revision 2036) +++ DsiDeviceFactory.cpp (working copy) @@ -15,7 +15,9 @@ #include "DsiDeviceFactory.h" #include "DsiPro.h" +#include "DsiColor.h" #include "DsiProII.h" +#include "DsiColorII.h" #include "DsiException.h" using namespace std; @@ -45,6 +47,15 @@ if (ccdChipName == "ICX429ALL") return new DSI::DsiProII(devname); + if (ccdChipName == "ICX429AKL") + return new DSI::DsiColorII(devname); + + if (ccdChipName == "ICX404AK") { + return new DSI::DsiColor(devname); + } else { + return new DSI::DsiColor(devname); + } + return 0; } Index: dsi_ccd.cpp =================================================================== --- dsi_ccd.cpp (revision 2036) +++ dsi_ccd.cpp (working copy) @@ -102,6 +102,7 @@ ***************************************************************************************/ bool DSICCD::Connect() { + CCDCapability cap; string ccd; dsi = DSI::DeviceFactory::getInstance(NULL); if (!dsi) { @@ -117,8 +118,25 @@ DEBUG(INDI::Logger::DBG_SESSION, "Found a DSI Pro!"); } else if (ccd == "ICX429ALL") { DEBUG(INDI::Logger::DBG_SESSION, "Found a DSI Pro II!"); + } else if (ccd == "ICX429AKL") { + DEBUG(INDI::Logger::DBG_SESSION, "Found a DSI Color II!"); + } else if (ccd == "ICX404AK") { + DEBUG(INDI::Logger::DBG_SESSION, "Found a DSI Color!"); + } else { + DEBUGF(INDI::Logger::DBG_SESSION, "Found a DSI with an unknown CCD: %s", ccd.c_str()); } + cap.canAbort = true; + cap.canBin = false; + cap.canSubFrame = false; + cap.hasCooler = false; + cap.hasGuideHead= false; + cap.hasShutter = false; + cap.hasST4Port = false; + cap.hasBayer = dsi->isColor(); + + SetCCDCapability(&cap); + return true; } @@ -149,8 +167,6 @@ ***************************************************************************************/ bool DSICCD::initProperties() { - CCDCapability cap; - // Must init parent properties first! INDI::CCD::initProperties(); @@ -161,17 +177,7 @@ IUFillNumber(GainN, "GAIN", "Gain", "%d", 0, 63, 1, 0); IUFillNumberVector(&GainNP, GainN, 1, getDeviceName(), "GAIN", "Gain", IMAGE_SETTINGS_TAB, IP_RW, 0, IPS_IDLE); - cap.canAbort = true; - cap.canBin = false; - cap.canSubFrame = false; - cap.hasCooler = false; - cap.hasGuideHead= false; - cap.hasShutter = false; - cap.hasST4Port = false; - cap.hasBayer = false; - SetCCDCapability(&cap); - return true; }