Skip to content

Commit

Permalink
SX driver fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
polakovic committed Apr 8, 2018
1 parent 7815e1a commit 08c4775
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 41 deletions.
43 changes: 4 additions & 39 deletions 3rdparty/indi-sx/sxccd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,34 +55,6 @@ static void cleanup()
}
}

//static void deinterlace(unsigned short *data, int width, int height)
//{
// int row, column;
// long *averages = (long *)malloc((height + 1) * sizeof(long));
// for (row = 0; row < height; row++)
// {
// long average = 0;
// int r = row * width;
// for (column = 0; column < width; column++)
// {
// average += data[r + column];
// }
// averages[row] = average;
// }
// averages[row] = averages[row - 1];
// for (row = 1; row < height; row += 2)
// {
// double q = (averages[row]) / ((averages[row - 1] + averages[row + 1]) / 2.0);
// int r = row * width;
// for (column = 0; column < width; column++)
// {
// int c = r + column;
// data[c] = (unsigned short)(data[c] / q);
// }
// }
// free(averages);
//}

void ISInit()
{
static bool isInit = false;
Expand Down Expand Up @@ -269,7 +241,7 @@ bool SXCCD::initProperties()

// we can expose less than 0.01 seconds at a time
// and we need to for an allsky in daytime
PrimaryCCD.setMinMaxStep("CCD_EXPOSURE", "CCD_EXPOSURE_VALUE", 0.0001, 3600, 0.0001, true);
PrimaryCCD.setMinMaxStep("CCD_EXPOSURE", "CCD_EXPOSURE_VALUE", 0.0001, 3600, 0.0001, false);

return true;
}
Expand All @@ -279,6 +251,7 @@ bool SXCCD::updateProperties()
INDI::CCD::updateProperties();
if (isConnected())
{
SetupParms();
if (HasCooler)
defineSwitch(&CoolerSP);
if (HasShutter)
Expand Down Expand Up @@ -316,12 +289,6 @@ bool SXCCD::UpdateCCDFrame(int x, int y, int w, int h)

// Set UNBINNED coords
PrimaryCCD.setFrame(x, y, w, h);
int nbuf;
// this is pixel count
nbuf = (w * h) / (PrimaryCCD.getBinX() * PrimaryCCD.getBinY()) * PrimaryCCD.getBPP() / 8;
// leave a little extra at the end
nbuf += 512;
PrimaryCCD.setFrameBufferSize(nbuf);

return true;
}
Expand Down Expand Up @@ -349,10 +316,7 @@ bool SXCCD::Connect()
{
int rc = sxOpen(device, &handle);
if (rc >= 0)
{
getCameraParams();
return true;
}
}
return false;
}
Expand All @@ -366,7 +330,7 @@ bool SXCCD::Disconnect()
return true;
}

void SXCCD::getCameraParams()
void SXCCD::SetupParms()
{
struct t_sxccd_params params;
model = sxGetCameraModel(handle);
Expand All @@ -386,6 +350,7 @@ void SXCCD::getCameraParams()
params.height = 2016;
}
SetCCDParams(params.width, params.height, params.bits_per_pixel, params.pix_width, params.pix_height);

int nbuf = params.width * params.height;
if (params.bits_per_pixel == 16)
nbuf *= 2;
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/indi-sx/sxccd.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class SXCCD : public INDI::CCD
protected:
const char *getDefaultName();
bool initProperties();
void getCameraParams();
void SetupParms();
bool updateProperties();
bool UpdateCCDFrame(int x, int y, int w, int h);
bool UpdateCCDBin(int hor, int ver);
Expand Down
2 changes: 1 addition & 1 deletion libindi/libs/indibase/defaultdevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ void DefaultDevice::setConnected(bool status, IPState state, const char *msg)

svp->s = state;

IDSetSwitch(svp, "%s", msg);
IDSetSwitch(svp, msg);
}

// This is a helper function
Expand Down
4 changes: 4 additions & 0 deletions macosx/INDI Server/INDI Server.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
594499601C136C9100E0E281 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 5944995F1C136C9100E0E281 /* libz.tbd */; };
594499611C136CE300E0E281 /* indi_asi.xml in Resources */ = {isa = PBXBuildFile; fileRef = 594499471C13643F00E0E281 /* indi_asi.xml */; };
594499641C136E9F00E0E281 /* indi_asi_ccd in Copy Files (33 items) (53 items) */ = {isa = PBXBuildFile; fileRef = 594499451C1363C400E0E281 /* indi_asi_ccd */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
5947FA822078FBE400C34391 /* lx200telescope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5947FA812078FBE200C34391 /* lx200telescope.cpp */; };
59499FA21E61E97600567CAD /* usbfocusv3.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59499FA01E61E96B00567CAD /* usbfocusv3.cpp */; };
59499FAD1E61EA4600567CAD /* libindi.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9DDA43A91A8CD3190004AA95 /* libindi.dylib */; };
59499FAE1E61EA4600567CAD /* libnova.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9DDA422C1A8CB6920004AA95 /* libnova.dylib */; };
Expand Down Expand Up @@ -3546,6 +3547,7 @@
5944994B1C13651F00E0E281 /* libASICamera2.lib */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libASICamera2.lib; path = mac/libASICamera2.lib; sourceTree = "<group>"; };
5944995A1C136C0400E0E281 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; };
5944995F1C136C9100E0E281 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
5947FA812078FBE200C34391 /* lx200telescope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lx200telescope.cpp; sourceTree = "<group>"; };
59499FA01E61E96B00567CAD /* usbfocusv3.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = usbfocusv3.cpp; sourceTree = "<group>"; };
59499FA31E61EA2D00567CAD /* hitecastrodcfocuser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = hitecastrodcfocuser.cpp; sourceTree = "<group>"; };
59499FB31E61EA4600567CAD /* indi_hitecastrodc_focus */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = indi_hitecastrodc_focus; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -5768,6 +5770,7 @@
9D75D5381A8D135B008AA08A /* telescope */ = {
isa = PBXGroup;
children = (
5947FA812078FBE200C34391 /* lx200telescope.cpp */,
5949E153205596C100B62867 /* pmc8.cpp */,
5949E152205596C100B62867 /* pmc8driver.cpp */,
5949E14F2055963900B62867 /* paramount.cpp */,
Expand Down Expand Up @@ -9197,6 +9200,7 @@
9D75D5821A8D16F7008AA08A /* lx200autostar.cpp in Sources */,
5949E138205592E000B62867 /* lx200ap_experimental.cpp in Sources */,
591BFB411F2944BC00BA7BBD /* lx200gotonova.cpp in Sources */,
5947FA822078FBE400C34391 /* lx200telescope.cpp in Sources */,
5944982C1C135B3600E0E281 /* lx200pulsar2.cpp in Sources */,
9D75D5841A8D16F7008AA08A /* lx200generic.cpp in Sources */,
5949E137205592E000B62867 /* ioptronHC8406.cpp in Sources */,
Expand Down

0 comments on commit 08c4775

Please sign in to comment.