summaryrefslogtreecommitdiffstats
path: root/kstars/kstars/indi/apogee/ApnCamera_Linux.cpp
blob: cce9ba37b9808c2cf8bc1a641e6f48c46eecb3e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
// ApnCamera.cpp: extras from the CCameraIO class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"

#include "ApnCamera.h"
#include "ApnCamTable.h"
//#include "tcl.h"
//#include "ccd.h"


// Determine if camera is present
// True if camera is present, false otherwise.
bool CApnCamera::read_Present()
{
	// OutputDebugString( "read_Present()" );

	USHORT ApStatus;
	USHORT DatumA;
	USHORT DatumB;
	char	szMsg[80];

	DatumA		= 0x0;
	DatumB		= 0x0;
	ApStatus	= 0;

	Write( FPGA_REG_SCRATCH, 0x8086 );
	Read( FPGA_REG_SCRATCH, DatumA );

	Write( FPGA_REG_SCRATCH, 0x1F2F );
	Read( FPGA_REG_SCRATCH, DatumB );

	if ( (DatumA != 0x8086) || (DatumB != 0x1F2F) )
	{
		// OutputDebugString( "read_Present FAILED." );
		sprintf( szMsg, "read_Present FAILED.  DatumA:  0x%X   DatumB:  0x%X", DatumA, DatumB );
		// OutputDebugString( szMsg );
		return false;
	}

	// OutputDebugString( "read_Present SUCCESS" );

	return true;
}

bool CApnCamera::sensorInfo()
{
	strcpy(m_Sensor,m_ApnSensorInfo->m_Sensor);
	strcpy(m_CameraModel,m_ApnSensorInfo->m_CameraModel);
	m_CameraId	= 	m_ApnSensorInfo->m_CameraId;
	m_InterlineCCD 	= 	m_ApnSensorInfo->m_InterlineCCD;
	m_SupportsSerialA =	m_ApnSensorInfo->m_SupportsSerialA;
	m_SupportsSerialB	=	m_ApnSensorInfo->m_SupportsSerialB;
	m_SensorTypeCCD		=m_ApnSensorInfo->m_SensorTypeCCD;
	m_TotalColumns	=m_ApnSensorInfo->m_TotalColumns;
	m_ImagingColumns=	m_ApnSensorInfo->m_ImagingColumns;
	m_ClampColumns=	m_ApnSensorInfo->m_ClampColumns;
	m_PreRoiSkipColumns	=m_ApnSensorInfo->m_PreRoiSkipColumns;
	m_PostRoiSkipColumns=	m_ApnSensorInfo->m_PostRoiSkipColumns;
	m_OverscanColumns	=m_ApnSensorInfo->m_OverscanColumns;
	m_TotalRows	=m_ApnSensorInfo->m_TotalRows;
	m_ImagingRows	=m_ApnSensorInfo->m_ImagingRows;
	m_UnderscanRows=	m_ApnSensorInfo->m_UnderscanRows;
	m_OverscanRows	=m_ApnSensorInfo->m_OverscanRows;
	m_VFlushBinning	=m_ApnSensorInfo->m_VFlushBinning;
	m_HFlushDisable		=m_ApnSensorInfo->m_HFlushDisable;
	m_ShutterCloseDelay=	m_ApnSensorInfo->m_ShutterCloseDelay;
	m_PixelSizeX	=	m_ApnSensorInfo->m_PixelSizeX;
	m_PixelSizeY	=	m_ApnSensorInfo->m_PixelSizeY;
	m_Color	=	m_ApnSensorInfo->m_Color;
//	m_ReportedGainTwelveBit	=	m_ApnSensorInfo->m_ReportedGainTwelveBit;
	m_ReportedGainSixteenBit=		m_ApnSensorInfo->m_ReportedGainSixteenBit;
	m_MinSuggestedExpTime	=	m_ApnSensorInfo->m_MinSuggestedExpTime;
//	m_TempRegRate	=m_ApnSensorInfo->m_TempRegRate;
	m_TempRampRateOne	=m_ApnSensorInfo->m_TempRampRateOne;
	m_TempRampRateTwo	=m_ApnSensorInfo->m_TempRampRateTwo;
	m_DefaultGainTwelveBit	=m_ApnSensorInfo->m_DefaultGainTwelveBit;
	m_DefaultOffsetTwelveBit=	m_ApnSensorInfo->m_DefaultOffsetTwelveBit;
	m_DefaultRVoltage	=m_ApnSensorInfo->m_DefaultRVoltage;
	return true;

}

#if 0
bool CApnCamera::BufferImage(char *bufferName )
{
    unsigned short *pImageData;
    bool status; 
    short cols,rows,hbin,vbin;
    unsigned short xSize, ySize;
    unsigned long count;

    cols = m_pvtExposurePixelsH;
    rows = m_pvtExposurePixelsV;

    /* ALTA code has already applied binning calculations*/
    hbin = 1;
    vbin = 1;

    pImageData = (unsigned short *)CCD_locate_buffer(bufferName, 2 , cols, rows, hbin, vbin );
    if (pImageData == NULL) {
       return 0;
    }
    
    status = GetImageData(pImageData, xSize, ySize, count);
    return status;
}



bool CApnCamera::BufferDriftScan(char *bufferName, int delay, int rowCount, int nblock , int npipe)
{
    unsigned short *pImageData, *ptr;
    bool status; 
    int irow;
    short cols,rows,hbin,vbin;

    cols = m_pvtExposurePixelsH;
    rows = rowCount;
    hbin = m_RoiBinningH;
    vbin = 1;
    return 1;
}

#endif