summaryrefslogtreecommitdiffstats
path: root/kstars/kstars/indi
diff options
context:
space:
mode:
Diffstat (limited to 'kstars/kstars/indi')
-rw-r--r--kstars/kstars/indi/apogee/ApnCamera.cpp170
-rw-r--r--kstars/kstars/indi/apogee/CameraIO_Linux.h50
-rw-r--r--kstars/kstars/indi/fli/libfli.c4
-rw-r--r--kstars/kstars/indi/fli_ccd.c464
4 files changed, 344 insertions, 344 deletions
diff --git a/kstars/kstars/indi/apogee/ApnCamera.cpp b/kstars/kstars/indi/apogee/ApnCamera.cpp
index 457722b5..0cba7f39 100644
--- a/kstars/kstars/indi/apogee/ApnCamera.cpp
+++ b/kstars/kstars/indi/apogee/ApnCamera.cpp
@@ -33,7 +33,7 @@ bool CApnCamera::Expose( double Duration, bool Light )
ULONG ExpTime;
unsigned short BitsPerPixel(0);
unsigned short UnbinnedRoiX;
- unsigned short UnbinnedRoiY;
+ unsigned short UnbinnedRoiY;
unsigned short PreRoiSkip, PostRoiSkip;
unsigned short PreRoiRows, PostRoiRows;
unsigned short PreRoiVBinning, PostRoiVBinning;
@@ -61,7 +61,7 @@ bool CApnCamera::Expose( double Duration, bool Light )
PostRoiSkip = m_ApnSensorInfo->m_TotalColumns -
m_ApnSensorInfo->m_ClampColumns -
- PreRoiSkip -
+ PreRoiSkip -
UnbinnedRoiX;
TotalHPixels = UnbinnedRoiX + PreRoiSkip + PostRoiSkip + m_ApnSensorInfo->m_ClampColumns;
@@ -71,9 +71,9 @@ bool CApnCamera::Expose( double Duration, bool Light )
UnbinnedRoiY = m_RoiPixelsV * m_RoiBinningV;
- PreRoiRows = m_ApnSensorInfo->m_UnderscanRows +
+ PreRoiRows = m_ApnSensorInfo->m_UnderscanRows +
m_RoiStartY;
-
+
PostRoiRows = m_ApnSensorInfo->m_TotalRows -
PreRoiRows -
UnbinnedRoiY;
@@ -133,14 +133,14 @@ bool CApnCamera::Expose( double Duration, bool Light )
{
PreRoiVBinning += PreRoiRows;
PostRoiVBinning = PostRoiRows;
-
+
PreRoiVBinning |= FPGA_BIT_ARRAY_FASTDUMP;
PostRoiVBinning |= FPGA_BIT_ARRAY_FASTDUMP;
-
+
PreRoiRows = 1;
PostRoiRows = 1;
}
-
+
// Issue the reset
RoiRegBuffer[0] = FPGA_REG_COMMAND_B;
@@ -151,7 +151,7 @@ bool CApnCamera::Expose( double Duration, bool Light )
RoiRegData[1] = PreRoiSkip;
RoiRegBuffer[2] = FPGA_REG_ROI_COUNT;
- // Number of ROI pixels. Adjust the 12bit operation here to account for an extra
+ // Number of ROI pixels. Adjust the 12bit operation here to account for an extra
// 10 pixel shift as a result of the A/D conversion.
if ( m_DataBits == Apn_Resolution_SixteenBit )
{
@@ -282,7 +282,7 @@ bool CApnCamera::StopExposure( bool DigitizeData )
return true;
}
-
+
unsigned short CApnCamera::GetExposurePixelsH()
{
@@ -365,10 +365,10 @@ void CApnCamera::write_ForceShutterOpen( bool ForceShutterOpen )
{
unsigned short RegVal;
Read( FPGA_REG_OP_A, RegVal );
-
+
if ( ForceShutterOpen )
RegVal |= FPGA_BIT_FORCE_SHUTTER;
- else
+ else
RegVal &= ~FPGA_BIT_FORCE_SHUTTER;
Write( FPGA_REG_OP_A, RegVal );
@@ -492,7 +492,7 @@ void CApnCamera::write_CameraMode( Apn_CameraMode CameraMode )
Write( FPGA_REG_OP_A, RegVal );
break;
}
-
+
switch ( CameraMode )
{
case Apn_CameraMode_Normal:
@@ -525,7 +525,7 @@ void CApnCamera::write_DataBits( Apn_Resolution BitResolution )
if ( m_CameraInterface == Apn_Interface_NET )
{
- // The network interface is 16bpp only. Changing the resolution
+ // The network interface is 16bpp only. Changing the resolution
// for network cameras has no effect.
return;
}
@@ -537,7 +537,7 @@ void CApnCamera::write_DataBits( Apn_Resolution BitResolution )
// Change bit setting after the reset
Read( FPGA_REG_OP_A, RegVal );
-
+
if ( BitResolution == Apn_Resolution_TwelveBit )
RegVal |= FPGA_BIT_DIGITIZATION_RES;
@@ -547,7 +547,7 @@ void CApnCamera::write_DataBits( Apn_Resolution BitResolution )
Write( FPGA_REG_OP_A, RegVal );
m_DataBits = BitResolution;
-
+
LoadClampPattern();
LoadSkipPattern();
LoadRoiPattern( m_RoiBinningH );
@@ -578,16 +578,16 @@ Apn_Status CApnCamera::read_ImagingStatus()
if ( (m_pvtStatusReg & FPGA_BIT_STATUS_IMAGING_ACTIVE) != 0 )
Active = true;
-
+
if ( (m_pvtStatusReg & FPGA_BIT_STATUS_IMAGE_EXPOSING) != 0 )
Exposing = true;
-
+
if ( (m_pvtStatusReg & FPGA_BIT_STATUS_IMAGE_DONE) != 0 )
Done = true;
-
+
if ( (m_pvtStatusReg & FPGA_BIT_STATUS_FLUSHING) != 0 )
Flushing = true;
-
+
if ( (m_pvtStatusReg & FPGA_BIT_STATUS_WAITING_TRIGGER) != 0 )
WaitOnTrigger = true;
@@ -714,7 +714,7 @@ Apn_LedState CApnCamera::read_LedState( unsigned short LedId )
if ( LedId == 0 ) // LED A
RetVal = m_pvtLedStateA;
-
+
if ( LedId == 1 ) // LED B
RetVal = m_pvtLedStateB;
@@ -779,7 +779,7 @@ Apn_CoolerStatus CApnCamera::read_CoolerStatus()
if ( (m_pvtStatusReg & FPGA_BIT_STATUS_TEMP_AT_TEMP) != 0 )
CoolerAtTemp = true;
-
+
if ( (m_pvtStatusReg & FPGA_BIT_STATUS_TEMP_ACTIVE) != 0 )
CoolerActive = true;
@@ -816,7 +816,7 @@ double CApnCamera::read_CoolerSetPoint()
double TempVal;
Read( FPGA_REG_TEMP_DESIRED, RegVal );
-
+
RegVal &= 0x0FFF;
TempVal = ( RegVal - APN_TEMP_SETPOINT_ZERO_POINT ) * APN_TEMP_DEGREES_PER_BIT;
@@ -828,7 +828,7 @@ void CApnCamera::write_CoolerSetPoint( double SetPoint )
{
unsigned short RegVal;
double TempVal;
-
+
TempVal = SetPoint;
@@ -839,7 +839,7 @@ void CApnCamera::write_CoolerSetPoint( double SetPoint )
TempVal = APN_TEMP_SETPOINT_MAX;
RegVal = (unsigned short)( (TempVal / APN_TEMP_DEGREES_PER_BIT) + APN_TEMP_SETPOINT_ZERO_POINT );
-
+
Write( FPGA_REG_TEMP_DESIRED, RegVal );
}
@@ -852,7 +852,7 @@ void CApnCamera::write_CoolerBackoffPoint( double BackoffPoint )
{
unsigned short RegVal;
double TempVal;
-
+
TempVal = BackoffPoint;
// BackoffPoint must be a positive number!
@@ -868,7 +868,7 @@ void CApnCamera::write_CoolerBackoffPoint( double BackoffPoint )
m_pvtCoolerBackoffPoint = TempVal;
RegVal = (unsigned short)( TempVal / APN_TEMP_DEGREES_PER_BIT );
-
+
Write( FPGA_REG_TEMP_BACKOFF, RegVal );
}
@@ -902,7 +902,7 @@ double CApnCamera::read_TempCCD()
TempAvg = (unsigned short)(TempTotal / don);
- m_pvtCurrentCcdTemp = ( (TempAvg - APN_TEMP_SETPOINT_ZERO_POINT)
+ m_pvtCurrentCcdTemp = ( (TempAvg - APN_TEMP_SETPOINT_ZERO_POINT)
* APN_TEMP_DEGREES_PER_BIT );
return m_pvtCurrentCcdTemp;
@@ -931,7 +931,7 @@ double CApnCamera::read_TempHeatsink()
TempAvg = (unsigned short)(TempTotal / don);
- m_pvtCurrentHeatsinkTemp = ( (TempAvg - APN_TEMP_HEATSINK_ZERO_POINT)
+ m_pvtCurrentHeatsinkTemp = ( (TempAvg - APN_TEMP_HEATSINK_ZERO_POINT)
* APN_TEMP_DEGREES_PER_BIT );
return m_pvtCurrentHeatsinkTemp;
@@ -957,11 +957,11 @@ void CApnCamera::write_FanMode( Apn_FanMode FanMode )
OpRegA |= FPGA_BIT_TEMP_SUSPEND;
Write( FPGA_REG_OP_A, OpRegA );
- do
- {
+ do
+ {
Read( FPGA_REG_GENERAL_STATUS, RegVal );
} while ( (RegVal & FPGA_BIT_STATUS_TEMP_SUSPEND_ACK) == 0 );
-
+
}
switch ( FanMode )
@@ -1006,7 +1006,7 @@ double CApnCamera::read_ShutterStrobePosition()
void CApnCamera::write_ShutterStrobePosition( double Position )
{
unsigned short RegVal;
-
+
if ( Position < APN_STROBE_POSITION_MIN )
Position = APN_STROBE_POSITION_MIN;
@@ -1032,7 +1032,7 @@ void CApnCamera::write_ShutterStrobePeriod( double Period )
RegVal = (unsigned short)((Period - APN_STROBE_PERIOD_MIN) / APN_PERIOD_TIMER_RESOLUTION);
Write( FPGA_REG_SHUTTER_STROBE_PERIOD, RegVal );
-
+
m_pvtShutterStrobePeriod = Period;
}
@@ -1060,7 +1060,7 @@ bool CApnCamera::read_VariableSequenceDelay()
unsigned short RegVal;
Read( FPGA_REG_OP_A, RegVal );
// variable delay occurs when the bit is 0
- return ( (RegVal & FPGA_BIT_DELAY_MODE) == 0 );
+ return ( (RegVal & FPGA_BIT_DELAY_MODE) == 0 );
}
void CApnCamera::write_VariableSequenceDelay( bool VariableSequenceDelay )
@@ -1088,7 +1088,7 @@ void CApnCamera::write_ImageCount( unsigned short Count )
Count = 1;
Write( FPGA_REG_IMAGE_COUNT, Count );
-
+
m_pvtImageCount = Count;
}
@@ -1182,7 +1182,7 @@ void CApnCamera::write_TDIRate( double TdiRate )
if ( TdiRate < APN_TDI_RATE_MIN )
TdiRate = APN_TDI_RATE_MIN;
-
+
if ( TdiRate > APN_TDI_RATE_MAX )
TdiRate = APN_TDI_RATE_MAX;
@@ -1289,15 +1289,15 @@ void CApnCamera::write_TestLedBrightness( double TestLedBrightness )
OpRegA |= FPGA_BIT_TEMP_SUSPEND;
Write( FPGA_REG_OP_A, OpRegA );
- do
- {
+ do
+ {
Read( FPGA_REG_GENERAL_STATUS, RegVal );
} while ( (RegVal & FPGA_BIT_STATUS_TEMP_SUSPEND_ACK) == 0 );
-
+
}
RegVal = (unsigned short)( (double)FPGA_MASK_LED_ILLUMINATION * (TestLedBrightness/100.0) );
-
+
Write( FPGA_REG_LED_DRIVE, RegVal );
Read( FPGA_REG_OP_B, RegVal );
@@ -1332,7 +1332,7 @@ long CApnCamera::LoadVerticalPattern()
RegData |= FPGA_BIT_VRAM_ENABLE;
Write( FPGA_REG_OP_B, RegData );
- WriteMultiSRMD( FPGA_REG_VRAM_INPUT,
+ WriteMultiSRMD( FPGA_REG_VRAM_INPUT,
m_ApnSensorInfo->m_VerticalPattern.PatternData,
m_ApnSensorInfo->m_VerticalPattern.NumElements );
@@ -1356,14 +1356,14 @@ long CApnCamera::LoadClampPattern()
if ( m_DataBits == Apn_Resolution_SixteenBit )
{
- WriteHorizontalPattern( &m_ApnSensorInfo->m_ClampPatternSixteen,
- FPGA_REG_HCLAMP_INPUT,
+ WriteHorizontalPattern( &m_ApnSensorInfo->m_ClampPatternSixteen,
+ FPGA_REG_HCLAMP_INPUT,
1 );
}
else if ( m_DataBits == Apn_Resolution_TwelveBit )
{
- WriteHorizontalPattern( &m_ApnSensorInfo->m_ClampPatternTwelve,
- FPGA_REG_HCLAMP_INPUT,
+ WriteHorizontalPattern( &m_ApnSensorInfo->m_ClampPatternTwelve,
+ FPGA_REG_HCLAMP_INPUT,
1 );
}
@@ -1387,14 +1387,14 @@ long CApnCamera::LoadSkipPattern()
if ( m_DataBits == Apn_Resolution_SixteenBit )
{
- WriteHorizontalPattern( &m_ApnSensorInfo->m_SkipPatternSixteen,
- FPGA_REG_HSKIP_INPUT,
+ WriteHorizontalPattern( &m_ApnSensorInfo->m_SkipPatternSixteen,
+ FPGA_REG_HSKIP_INPUT,
1 );
}
else if ( m_DataBits == Apn_Resolution_TwelveBit )
{
- WriteHorizontalPattern( &m_ApnSensorInfo->m_SkipPatternTwelve,
- FPGA_REG_HSKIP_INPUT,
+ WriteHorizontalPattern( &m_ApnSensorInfo->m_SkipPatternTwelve,
+ FPGA_REG_HSKIP_INPUT,
1 );
}
@@ -1418,14 +1418,14 @@ long CApnCamera::LoadRoiPattern( unsigned short binning )
if ( m_DataBits == Apn_Resolution_SixteenBit )
{
- WriteHorizontalPattern( &m_ApnSensorInfo->m_RoiPatternSixteen,
- FPGA_REG_HRAM_INPUT,
+ WriteHorizontalPattern( &m_ApnSensorInfo->m_RoiPatternSixteen,
+ FPGA_REG_HRAM_INPUT,
binning );
}
else if ( m_DataBits == Apn_Resolution_TwelveBit )
{
- WriteHorizontalPattern( &m_ApnSensorInfo->m_RoiPatternTwelve,
- FPGA_REG_HRAM_INPUT,
+ WriteHorizontalPattern( &m_ApnSensorInfo->m_RoiPatternTwelve,
+ FPGA_REG_HRAM_INPUT,
binning );
}
@@ -1438,8 +1438,8 @@ long CApnCamera::LoadRoiPattern( unsigned short binning )
}
-long CApnCamera::WriteHorizontalPattern( APN_HPATTERN_FILE *Pattern,
- unsigned short RamReg,
+long CApnCamera::WriteHorizontalPattern( APN_HPATTERN_FILE *Pattern,
+ unsigned short RamReg,
unsigned short Binning )
{
unsigned short i;
@@ -1463,7 +1463,7 @@ long CApnCamera::WriteHorizontalPattern( APN_HPATTERN_FILE *Pattern,
DataArray[Index] = Pattern->RefPatternData[i];
Index++;
}
-
+
for ( i=0; i<Pattern->BinNumElements[BinNumber]; i++ )
{
DataArray[Index] = Pattern->BinPatternData[BinNumber][i];
@@ -1493,8 +1493,8 @@ long CApnCamera::InitDefaults()
unsigned short PreRoiRows, PostRoiRows;
unsigned short PreRoiVBinning, PostRoiVBinning;
- unsigned short UnbinnedRoiY; //Qt::Vertical ROI pixels
-
+ unsigned short UnbinnedRoiY; // Vertical ROI pixels
+
// Read the Camera ID register
Read( FPGA_REG_CAMERA_ID, CameraID );
@@ -1640,7 +1640,7 @@ long CApnCamera::InitDefaults()
// printf("ReportedGainTwelveBit = %lf\n",m_ApnSensorInfo->m_ReportedGainTwelveBit);
printf("ReportedGainSixteenBit = %lf\n",m_ApnSensorInfo->m_ReportedGainSixteenBit);
printf("MinSuggestedExpTime = %lf\n",m_ApnSensorInfo->m_MinSuggestedExpTime);
- printf("CoolingSupported = %u\n",m_ApnSensorInfo->m_CoolingSupported);
+ printf("CoolingSupported = %u\n",m_ApnSensorInfo->m_CoolingSupported);
printf("RegulatedCoolingSupported = %u\n",m_ApnSensorInfo->m_RegulatedCoolingSupported);
printf("TempSetPoint = %lf\n",m_ApnSensorInfo->m_TempSetPoint);
// printf("TempRegRate = %u\n",m_ApnSensorInfo->m_TempRegRate);
@@ -1675,21 +1675,21 @@ long CApnCamera::InitDefaults()
LoadRoiPattern( m_RoiBinningH );
// Program default camera settings
- Write( FPGA_REG_CLAMP_COUNT, m_ApnSensorInfo->m_ClampColumns );
- Write( FPGA_REG_PREROI_SKIP_COUNT, m_ApnSensorInfo->m_PreRoiSkipColumns );
- Write( FPGA_REG_ROI_COUNT, m_ApnSensorInfo->m_ImagingColumns );
+ Write( FPGA_REG_CLAMP_COUNT, m_ApnSensorInfo->m_ClampColumns );
+ Write( FPGA_REG_PREROI_SKIP_COUNT, m_ApnSensorInfo->m_PreRoiSkipColumns );
+ Write( FPGA_REG_ROI_COUNT, m_ApnSensorInfo->m_ImagingColumns );
Write( FPGA_REG_POSTROI_SKIP_COUNT, m_ApnSensorInfo->m_PostRoiSkipColumns +
- m_ApnSensorInfo->m_OverscanColumns );
-
+ m_ApnSensorInfo->m_OverscanColumns );
+
// Since the default state of m_DigitizeOverscan is false, set the count to zero.
- Write( FPGA_REG_OVERSCAN_COUNT, 0x0 );
+ Write( FPGA_REG_OVERSCAN_COUNT, 0x0 );
// Now calculate the vertical settings
UnbinnedRoiY = m_RoiPixelsV * m_RoiBinningV;
- PreRoiRows = m_ApnSensorInfo->m_UnderscanRows +
+ PreRoiRows = m_ApnSensorInfo->m_UnderscanRows +
m_RoiStartY;
-
+
PostRoiRows = m_ApnSensorInfo->m_TotalRows -
PreRoiRows -
UnbinnedRoiY;
@@ -1714,14 +1714,14 @@ long CApnCamera::InitDefaults()
}
// Program the vertical settings
- Write( FPGA_REG_A1_ROW_COUNT, PreRoiRows );
+ Write( FPGA_REG_A1_ROW_COUNT, PreRoiRows );
Write( FPGA_REG_A1_VBINNING, PreRoiVBinning );
-
- Write( FPGA_REG_A2_ROW_COUNT, m_RoiPixelsV );
- Write( FPGA_REG_A2_VBINNING, (m_RoiBinningV | FPGA_BIT_ARRAY_DIGITIZE) );
-
- Write( FPGA_REG_A3_ROW_COUNT, PostRoiRows );
- Write( FPGA_REG_A3_VBINNING, PostRoiVBinning );
+
+ Write( FPGA_REG_A2_ROW_COUNT, m_RoiPixelsV );
+ Write( FPGA_REG_A2_VBINNING, (m_RoiBinningV | FPGA_BIT_ARRAY_DIGITIZE) );
+
+ Write( FPGA_REG_A3_ROW_COUNT, PostRoiRows );
+ Write( FPGA_REG_A3_VBINNING, PostRoiVBinning );
Write( FPGA_REG_VFLUSH_BINNING, m_ApnSensorInfo->m_VFlushBinning );
@@ -1738,8 +1738,8 @@ long CApnCamera::InitDefaults()
{
Read( FPGA_REG_OP_A, RegVal );
- RegVal |= FPGA_BIT_DISABLE_H_CLK;
-
+ RegVal |= FPGA_BIT_DISABLE_H_CLK;
+
Write( FPGA_REG_OP_A, RegVal );
}
@@ -1765,7 +1765,7 @@ long CApnCamera::InitDefaults()
write_FanMode( Apn_FanMode_Medium );
// Initialize the LED states and the LED mode. There is nothing to output
- // to the device since we issued our CLEAR early in the init() process, and
+ // to the device since we issued our CLEAR early in the init() process, and
// we are now in a known state.
m_pvtLedStateA = Apn_LedState_Expose;
m_pvtLedStateB = Apn_LedState_Expose;
@@ -1790,7 +1790,7 @@ long CApnCamera::InitDefaults()
m_pvtImageInProgress = false;
m_pvtImageReady = false;
-
+
return 0;
}
@@ -1840,9 +1840,9 @@ void CApnCamera::UpdateGeneralStatus()
// Read the general status register of the device
- QueryStatusRegs( StatusReg,
- HeatsinkTempReg,
- CcdTempReg,
+ QueryStatusRegs( StatusReg,
+ HeatsinkTempReg,
+ CcdTempReg,
CoolerDriveReg,
VoltageReg,
TdiCounterReg,
@@ -1859,13 +1859,13 @@ void CApnCamera::UpdateGeneralStatus()
m_pvtCoolerDrive = 100.0;
else
m_pvtCoolerDrive = ( (double)(CoolerDriveReg - 600) / 2600.0 ) * 100.0;
-
- m_pvtCurrentCcdTemp = ( (CcdTempReg - APN_TEMP_SETPOINT_ZERO_POINT)
+
+ m_pvtCurrentCcdTemp = ( (CcdTempReg - APN_TEMP_SETPOINT_ZERO_POINT)
* APN_TEMP_DEGREES_PER_BIT );
- m_pvtCurrentHeatsinkTemp = ( (HeatsinkTempReg - APN_TEMP_HEATSINK_ZERO_POINT)
+ m_pvtCurrentHeatsinkTemp = ( (HeatsinkTempReg - APN_TEMP_HEATSINK_ZERO_POINT)
* APN_TEMP_DEGREES_PER_BIT );
-
+
m_pvtInputVoltage = VoltageReg * APN_VOLTAGE_RESOLUTION;
// Update ShutterState
diff --git a/kstars/kstars/indi/apogee/CameraIO_Linux.h b/kstars/kstars/indi/apogee/CameraIO_Linux.h
index e61ad838..47b08f43 100644
--- a/kstars/kstars/indi/apogee/CameraIO_Linux.h
+++ b/kstars/kstars/indi/apogee/CameraIO_Linux.h
@@ -157,7 +157,7 @@ public:
long ReadLine( long SkipPixels, long Pixels, unsigned short* pLineBuffer );
long Write( unsigned short reg, unsigned short val );
long Read( unsigned short reg, unsigned short& val );
-
+
////////////////////////////////////////////////////////////
// Camera Settings
@@ -173,27 +173,27 @@ public:
// 7: image ready
bool read_Present(); // True if camera is present, false otherwise.
-
+
bool read_Shutter(); // Current shutter state, true = open, false = closed.
void write_Shutter( bool val );
-
+
bool read_ForceShutterOpen(); // True: Forces shutter permanently open. False: allows
void write_ForceShutterOpen( bool val ); // normal shutter operation.
bool read_LongCable(); // Long cable mode.
- void write_LongCable( bool val );
+ void write_LongCable( bool val );
short read_Mode(); // First four bits map to Mode bits used for
void write_Mode( short val ); // special functions or camera configurations.
short read_TestBits(); // First four bits to Test bits used for
void write_TestBits( short val ); // troubleshooting.
-
+
short read_Test2Bits(); // First four bits map to Test2 bits used for
void write_Test2Bits( short val ); // special functions or camera configurations.
bool read_FastReadout(); // Fast readout mode (used for focusing).
- void write_FastReadout( bool val ); // True means fast focus is on
+ void write_FastReadout( bool val ); // True means fast focus is on
bool read_UseTrigger(); // Triggered exposure mode.
void write_UseTrigger( bool val ); // True means triggered exposure is on.
@@ -201,15 +201,15 @@ public:
bool m_HighPriority; // Bost thread priority level during download
short m_PPRepeat; // Delay used on parallel port systems.
-
+
short m_DataBits; // Digitization resolution, 8 - 18.
bool m_FastShutter; // Capable of 0.001 sec exposure resolution
bool m_GuiderRelays; // Capable of outputing autoguider signals
- short m_MaxBinX, m_MaxBinY; // Maximum binning factors
-
+ short m_MaxBinX, m_MaxBinY; // Maximum binning factors
+
double m_MaxExposure; // Maximum exposure length
double m_MinExposure; // Minimum exposure length
@@ -219,7 +219,7 @@ public:
// Cooler Settings
// N.B. DAC units = ( m_TempScale * CoolerSetPoint (deg. C ) ) + m_TempCalibration;
// N.B. Temperature (deg. C) = (DAC units - m_TempCalibration) / m_TempScale
-
+
double read_CoolerSetPoint(); // Returns/sets setpoint temperature in degrees
void write_CoolerSetPoint( double val ); // Celcius.
@@ -229,7 +229,7 @@ public:
void write_CoolerMode( Camera_CoolerMode val );
double read_Temperature(); // Current temperature in degrees Celcius.
-
+
bool m_TempControl; // Temperature can be externally controlled
short m_TempCalibration; // Temperature calibration factor.
double m_TempScale; // Temperature scaling factor.
@@ -238,20 +238,20 @@ public:
// Exposure Settings
// The following variables are latched in Expose method, until next Reset or GetImage
- short m_BinX, m_BinY; //Qt::Horizontal and vertical binning.
+ short m_BinX, m_BinY; // Horizontal and vertical binning.
short m_StartX, m_StartY; // Zero based subframe start position in unbinned pixels.
short m_NumX, m_NumY; // Subframe size in binned pixels.
////////////////////////////////////////////////////////////
// Geometry Settings
// The following variables are latched in Expose method, until next Reset or GetImage
-
+
short m_Columns, m_Rows; // Total columns/rows on CCD (physical).
short m_ImgColumns, m_ImgRows; // Unbinned columns/rows in imaging area
short m_SkipC, m_SkipR; // Deleted data columns/rows not to be displayed or saved
- short m_HFlush, m_VFlush; //Qt::Horizontal/Vertical flush binning.
+ short m_HFlush, m_VFlush; // Horizontal/Vertical flush binning.
short m_BIC, m_BIR; // Before Image Column/Row count (dark non-imaging pixels).
-
+
////////////////////////////////////////////////////////////
// CCD Settings
@@ -291,7 +291,7 @@ public:
// Move the filterwheel to the home position - failure indicates no filterwheel
//attached or broken filterwheel
bool FilterHome();
-
+
// Move filterwheel to the given slot
void FilterSet( short Slot );
@@ -341,7 +341,7 @@ public:
bool m_WaitingforLine; // camera is clocking and digitizing a row of data
short m_RegisterOffset; // Offset from base address used in parallel port systems.
-
+
short m_FilterPosition; // Current filter position
short m_FilterStepPos; // Current filter position in our internal array
@@ -350,9 +350,9 @@ public:
Camera_Interface m_Interface; // String acronyms may be used in INI file.
// 0 or ISA: Industry Standard Architecture bus
- // 1 or PPI: Parallel Port Interface
+ // 1 or PPI: Parallel Port Interface
// 2 or PCI: Peripheral Component Interface
-
+
Camera_SensorType m_SensorType; // 0 or CCD: Charge Coupled Device
// 1 or CMOS: Complementary Metal-Oxide-Silicon
@@ -367,12 +367,12 @@ public:
// 7: At set point
// Latched public variables used during Exposure..GetImage sequence
- short m_ExposureBinX, m_ExposureBinY; //Qt::Horizontal and vertical binning.
+ short m_ExposureBinX, m_ExposureBinY; // Horizontal and vertical binning.
short m_ExposureStartX, m_ExposureStartY; // Subframe start position in unbinned pixels.
short m_ExposureNumX, m_ExposureNumY; // Subframe size in binned pixels.
short m_ExposureColumns, m_ExposureRows; // Total columns/rows on CCD (physical).
short m_ExposureSkipC, m_ExposureSkipR; // Deleted data columns/rows not to be displayed or saved to disk.
- short m_ExposureHFlush, m_ExposureVFlush; //Qt::Horizontal/Vertical flush binning.
+ short m_ExposureHFlush, m_ExposureVFlush; // Horizontal/Vertical flush binning.
short m_ExposureBIC, m_ExposureBIR; // Before Image Column/Row count (dark non-imaging pixels).
unsigned short m_ExposureAIC; // Calculated After Image Column count (dark non-imaging pixels).
unsigned short m_ExposureRemainingLines; // Number of lines to be clocked out by GetImage
@@ -381,17 +381,17 @@ public:
////////////////////////////////////////////////////////////
// Write register shadow variables
unsigned short m_RegShadow[ NumWriteRegisters ];
-
+
unsigned short m_FastShutterBits_Mode; // Mask to enable fast shutter mode
unsigned short m_FastShutterBits_Test; // Mask to enable fast shutter mode
-
+
////////////////////////////////////////////////////////////
// Internal helper routines
void LoadLineCounter( unsigned short rows );
void LoadColumnLayout( unsigned short aic, unsigned short bic, unsigned short pixels );
void LoadTimerAndBinning( double Duration, unsigned short HBin, unsigned short VBin );
-
+
void StartFlushing();
void StopFlushing();
@@ -408,7 +408,7 @@ private:
#ifdef WITHPPI
inline void RegisterSelect( unsigned short reg );
inline unsigned short INPW();
- inline void OUTPW( unsigned short val );
+ inline void OUTPW( unsigned short val );
#endif
};
diff --git a/kstars/kstars/indi/fli/libfli.c b/kstars/kstars/indi/fli/libfli.c
index 701115b2..68df7945 100644
--- a/kstars/kstars/indi/fli/libfli.c
+++ b/kstars/kstars/indi/fli/libfli.c
@@ -554,7 +554,7 @@ LIBFLIAPI FLISetImageArea(flidev_t dev, long ul_x, long ul_y,
@param dev Camera to set horizontal bin factor of.
- @param hbinQt::Horizontal bin factor.
+ @param hbin Horizontal bin factor.
@return Zero on success.
@return Non-zero on failure.
@@ -577,7 +577,7 @@ LIBFLIAPI FLISetHBin(flidev_t dev, long hbin)
@param dev Camera to set vertical bin factor of.
- @param vbinQt::Vertical bin factor.
+ @param vbin Vertical bin factor.
@return Zero on success.
@return Non-zero on failure.
diff --git a/kstars/kstars/indi/fli_ccd.c b/kstars/kstars/indi/fli_ccd.c
index 70a1aceb..ac5eac45 100644
--- a/kstars/kstars/indi/fli_ccd.c
+++ b/kstars/kstars/indi/fli_ccd.c
@@ -76,8 +76,8 @@ extern int errno;
#define MAX_CCD_TEMP 45 /* Max CCD temperature */
#define MIN_CCD_TEMP -55 /* Min CCD temperature */
-#define MAX_X_BIN 16. /* MaxQt::Horizontal binning */
-#define MAX_Y_BIN 16. /* MaxQt::Vertical binning */
+#define MAX_X_BIN 16. /* Max Horizontal binning */
+#define MAX_Y_BIN 16. /* Max Vertical binning */
#define MAX_PIXELS 4096 /* Max number of pixels in one dimension */
#define POLLMS 1000 /* Polling time (ms) */
#define TEMP_THRESHOLD .25 /* Differential temperature threshold (C)*/
@@ -147,21 +147,21 @@ static INumber FrameN[] = {
{ "WIDTH", "Width", "%.0f", 0., MAX_PIXELS, 1., 0., 0, 0, 0},
{ "HEIGHT", "Height", "%.0f",0., MAX_PIXELS, 1., 0., 0, 0, 0}};
static INumberVectorProperty FrameNP = { mydev, "CCD_FRAME", "Frame", IMAGE_GROUP, IP_RW, 60, IPS_IDLE, FrameN, NARRAY(FrameN), "", 0};
-
- /* Binning */
+
+ /* Binning */
static INumber BinningN[] = {
{ "HOR_BIN", "X", "%0.f", 1., MAX_X_BIN, 1., 1., 0, 0, 0},
{ "VER_BIN", "Y", "%0.f", 1., MAX_Y_BIN, 1., 1., 0, 0, 0}};
static INumberVectorProperty BinningNP = { mydev, "CCD_BINNING", "Binning", IMAGE_GROUP, IP_RW, 60, IPS_IDLE, BinningN, NARRAY(BinningN), "", 0};
-
+
/* Exposure time */
static INumber ExposeTimeN[] = {{ "EXPOSE_DURATION", "Duration (s)", "%5.2f", 0., 36000., .5, 1., 0, 0, 0}};
static INumberVectorProperty ExposeTimeNP = { mydev, "CCD_EXPOSE_DURATION", "Expose", EXPOSE_GROUP, IP_RW, 60, IPS_IDLE, ExposeTimeN, NARRAY(ExposeTimeN), "", 0};
-
+
/* Temperature control */
static INumber TemperatureN[] = { {"TEMPERATURE", "Temperature", "%+06.2f", MIN_CCD_TEMP, MAX_CCD_TEMP, .2, 0., 0, 0, 0}};
static INumberVectorProperty TemperatureNP = { mydev, "CCD_TEMPERATURE", "Temperature (C)", EXPOSE_GROUP, IP_RW, 60, IPS_IDLE, TemperatureN, NARRAY(TemperatureN), "", 0};
-
+
/* Pixel size (µm) */
static INumber PixelSizeN[] = {
{ "Width", "", "%.0f", 0. , 0., 0., 0., 0, 0, 0},
@@ -180,30 +180,30 @@ void ISInit()
if (isInit)
return;
-
+
/* USB by default {USB, SERIAL, PARALLEL, INET} */
portSwitchIndex = 0;
-
+
FLIImg = malloc (sizeof(img_t));
-
+
if (FLIImg == NULL)
{
IDMessage(mydev, "Error: unable to initialize driver. Low memory.");
IDLog("Error: unable to initialize driver. Low memory.");
return;
}
-
+
IEAddTimer (POLLMS, ISPoll, NULL);
isInit = 1;
-
+
}
void ISGetProperties (const char *dev)
-{
+{
ISInit();
-
+
if (dev && strcmp (mydev, dev))
return;
@@ -211,48 +211,48 @@ void ISGetProperties (const char *dev)
IDDefSwitch(&PowerSP, NULL);
IDDefSwitch(&PortSP, NULL);
IDDefBLOB(&imageBP, NULL);
-
+
/* Expose */
- IDDefSwitch(&FrameTypeSP, NULL);
+ IDDefSwitch(&FrameTypeSP, NULL);
IDDefNumber(&ExposeTimeNP, NULL);
IDDefNumber(&TemperatureNP, NULL);
-
+
/* Image Group */
IDDefNumber(&FrameNP, NULL);
IDDefNumber(&BinningNP, NULL);
-
+
}
void ISNewBLOB (const char *dev, const char *name, int sizes[], char *blobs[], char *formats[], char *names[], int n)
{
dev=dev;name=name;sizes=sizes;blobs=blobs;formats=formats;names=names;n=n;
}
-
+
void ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n)
{
long err;
int i;
ISwitch *sp;
-
+
/* ignore if not ours */
if (dev && strcmp (dev, mydev))
return;
-
+
ISInit();
-
+
/* Port type */
if (!strcmp (name, PortSP.name))
{
- PortSP.s = IPS_IDLE;
+ PortSP.s = IPS_IDLE;
IUResetSwitches(&PortSP);
IUUpdateSwitches(&PortSP, states, names, n);
portSwitchIndex = getOnSwitch(&PortSP);
-
- PortSP.s = IPS_OK;
+
+ PortSP.s = IPS_OK;
IDSetSwitch(&PortSP, NULL);
return;
}
-
+
/* Connection */
if (!strcmp (name, PowerSP.name))
{
@@ -261,25 +261,25 @@ void ISNewSwitch (const char *dev, const char *name, ISState *states, char *name
connectCCD();
return;
}
-
+
/* Frame Type */
if (!strcmp(FrameTypeSP.name, name))
{
if (checkPowerS(&FrameTypeSP))
return;
-
+
FrameTypeSP.s = IPS_IDLE;
-
+
for (i = 0; i < n ; i++)
{
sp = IUFindSwitch(&FrameTypeSP, names[i]);
-
+
if (!sp)
{
IDSetSwitch(&FrameTypeSP, "Unknown error. %s is not a member of %s property.", names[0], name);
return;
}
-
+
/* NORMAL, BIAS, or FLAT */
if ( (sp == &FrameTypeS[LIGHT_FRAME] || sp == &FrameTypeS[FLAT_FRAME]) && states[i] == ISS_ON)
{
@@ -287,7 +287,7 @@ void ISNewSwitch (const char *dev, const char *name, ISState *states, char *name
FLIImg->frameType = LIGHT_FRAME;
else
FLIImg->frameType = FLAT_FRAME;
-
+
if ((err = FLISetFrameType(fli_dev, FLI_FRAME_TYPE_NORMAL) ))
{
IUResetSwitches(&FrameTypeSP);
@@ -296,9 +296,9 @@ void ISNewSwitch (const char *dev, const char *name, ISState *states, char *name
IDLog("FLISetFrameType() failed. %s.\n", strerror((int)-err));
return;
}
-
+
IUResetSwitches(&FrameTypeSP);
- sp->s = ISS_ON;
+ sp->s = ISS_ON;
FrameTypeSP.s = IPS_OK;
IDSetSwitch(&FrameTypeSP, NULL);
break;
@@ -306,12 +306,12 @@ void ISNewSwitch (const char *dev, const char *name, ISState *states, char *name
/* DARK AND BIAS */
else if ( (sp == &FrameTypeS[DARK_FRAME] || sp == &FrameTypeS[BIAS_FRAME]) && states[i] == ISS_ON)
{
-
+
if (sp == &FrameTypeS[DARK_FRAME])
FLIImg->frameType = DARK_FRAME;
else
FLIImg->frameType = BIAS_FRAME;
-
+
if ((err = FLISetFrameType(fli_dev, FLI_FRAME_TYPE_DARK) ))
{
IUResetSwitches(&FrameTypeSP);
@@ -320,32 +320,32 @@ void ISNewSwitch (const char *dev, const char *name, ISState *states, char *name
IDLog("FLISetFrameType() failed. %s.\n", strerror((int)-err));
return;
}
-
+
IUResetSwitches(&FrameTypeSP);
sp->s = ISS_ON;
FrameTypeSP.s = IPS_OK;
IDSetSwitch(&FrameTypeSP, NULL);
break;
}
-
+
} /* For loop */
-
+
return;
}
-
+
}
void ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n)
{
ISInit();
-
- /* ignore if not ours */
+
+ /* ignore if not ours */
if (dev && strcmp (mydev, dev))
return;
/* suppress warning */
n=n; dev=dev; name=name; names=names; texts=texts;
-
+
}
@@ -359,9 +359,9 @@ void ISNewNumber (const char *dev, const char *name, double values[], char *name
/* ignore if not ours */
if (dev && strcmp (dev, mydev))
return;
-
+
ISInit();
-
+
/* Exposure time */
if (!strcmp (ExposeTimeNP.name, name))
{
@@ -377,7 +377,7 @@ void ISNewNumber (const char *dev, const char *name, double values[], char *name
IDLog("FLICancelExposure() failed. %s.\n", strerror((int)-err));
return;
}
-
+
ExposeTimeNP.s = IPS_IDLE;
ExposeTimeN[0].value = 0;
@@ -385,96 +385,96 @@ void ISNewNumber (const char *dev, const char *name, double values[], char *name
IDLog("Exposure Cancelled.\n");
return;
}
-
+
ExposeTimeNP.s = IPS_IDLE;
-
+
np = IUFindNumber(&ExposeTimeNP, names[0]);
-
+
if (!np)
{
IDSetNumber(&ExposeTimeNP, "Error: %s is not a member of %s property.", names[0], name);
return;
}
-
+
np->value = values[0];
FLIImg->expose = (int) (values[0] * 1000.);
-
- /* Set duration */
+
+ /* Set duration */
if ( (err = FLISetExposureTime(fli_dev, np->value * 1000.) ))
{
IDSetNumber(&ExposeTimeNP, "FLISetExposureTime() failed. %s.\n", strerror((int)-err));
IDLog("FLISetExposureTime() failed. %s.\n", strerror((int)-err));
return;
}
-
+
IDLog("Exposure Time (ms) is: %g\n", np->value * 1000.);
-
+
handleExposure(NULL);
return;
- }
-
-
+ }
+
+
if (!strcmp(TemperatureNP.name, name))
{
if (checkPowerN(&TemperatureNP))
return;
-
+
TemperatureNP.s = IPS_IDLE;
-
+
np = IUFindNumber(&TemperatureNP, names[0]);
-
+
if (!np)
{
IDSetNumber(&TemperatureNP, "Unknown error. %s is not a member of %s property.", names[0], name);
return;
}
-
+
if (values[0] < MIN_CCD_TEMP || values[0] > MAX_CCD_TEMP)
{
IDSetNumber(&TemperatureNP, "Error: valid range of temperature is from %d to %d", MIN_CCD_TEMP, MAX_CCD_TEMP);
return;
}
-
+
if ( (err = FLISetTemperature(fli_dev, values[0])))
{
IDSetNumber(&TemperatureNP, "FLISetTemperature() failed. %s.", strerror((int)-err));
IDLog("FLISetTemperature() failed. %s.", strerror((int)-err));
return;
}
-
+
FLICam->temperature = values[0];
TemperatureNP.s = IPS_BUSY;
-
+
IDSetNumber(&TemperatureNP, "Setting CCD temperature to %+06.2f C", values[0]);
IDLog("Setting CCD temperature to %+06.2f C\n", values[0]);
return;
}
-
+
if (!strcmp(FrameNP.name, name))
{
int nset=0;
-
+
if (checkPowerN(&FrameNP))
return;
-
+
FrameNP.s = IPS_IDLE;
-
+
for (i=0; i < n ; i++)
{
np = IUFindNumber(&FrameNP, names[i]);
-
+
if (!np)
{
IDSetNumber(&FrameNP, "Unknown error. %s is not a member of %s property.", names[0], name);
return;
}
-
+
/* X or Width */
if (np == &FrameN[0] || np==&FrameN[2])
{
if (values[i] < 0 || values[i] > FLICam->width)
break;
-
+
nset++;
np->value = values[i];
}
@@ -483,53 +483,53 @@ void ISNewNumber (const char *dev, const char *name, double values[], char *name
{
if (values[i] < 0 || values[i] > FLICam->height)
break;
-
+
nset++;
np->value = values[i];
}
}
-
+
if (nset < 4)
{
IDSetNumber(&FrameNP, "Invalid range. Valid range is (0,0) - (%0d,%0d)", FLICam->width, FLICam->height);
IDLog("Invalid range. Valid range is (0,0) - (%0d,%0d)", FLICam->width, FLICam->height);
- return;
+ return;
}
-
+
if (setImageArea(errmsg))
{
IDSetNumber(&FrameNP, "%s", errmsg);
return;
}
-
+
FrameNP.s = IPS_OK;
-
- /* Adjusting image width and height */
+
+ /* Adjusting image width and height */
FLIImg->width = FrameN[2].value;
FLIImg->height = FrameN[3].value;
-
+
IDSetNumber(&FrameNP, NULL);
-
+
} /* end FrameNP */
-
-
+
+
if (!strcmp(BinningNP.name, name))
{
if (checkPowerN(&BinningNP))
return;
-
+
BinningNP.s = IPS_IDLE;
-
+
for (i=0 ; i < n ; i++)
{
np = IUFindNumber(&BinningNP, names[i]);
-
+
if (!np)
{
IDSetNumber(&BinningNP, "Unknown error. %s is not a member of %s property.", names[0], name);
return;
}
-
+
/* X binning */
if (np == &BinningN[0])
{
@@ -539,14 +539,14 @@ void ISNewNumber (const char *dev, const char *name, double values[], char *name
IDLog("Error: Valid X bin values are from 1 to %g", MAX_X_BIN);
return;
}
-
+
if ( (err = FLISetHBin(fli_dev, values[i])))
{
IDSetNumber(&BinningNP, "FLISetHBin() failed. %s.", strerror((int)-err));
IDLog("FLISetHBin() failed. %s.", strerror((int)-err));
return;
}
-
+
np->value = values[i];
}
else if (np == &BinningN[1])
@@ -557,33 +557,33 @@ void ISNewNumber (const char *dev, const char *name, double values[], char *name
IDLog("Error: Valid X bin values are from 1 to %g", MAX_Y_BIN);
return;
}
-
+
if ( (err = FLISetVBin(fli_dev, values[i])))
{
IDSetNumber(&BinningNP, "FLISetVBin() failed. %s.", strerror((int)-err));
IDLog("FLISetVBin() failed. %s.", strerror((int)-err));
return;
}
-
+
np->value = values[i];
}
} /* end for */
-
+
if (setImageArea(errmsg))
{
IDSetNumber(&BinningNP, errmsg, NULL);
IDLog("%s", errmsg);
return;
}
-
+
BinningNP.s = IPS_OK;
-
+
IDLog("Binning is: %.0f x %.0f\n", BinningN[0].value, BinningN[1].value);
-
+
IDSetNumber(&BinningNP, NULL);
return;
}
-
+
}
@@ -592,72 +592,72 @@ void ISPoll(void *p)
long err;
long timeleft;
double ccdTemp;
-
+
if (!isCCDConnected())
{
IEAddTimer (POLLMS, ISPoll, NULL);
return;
}
-
+
/*IDLog("In Poll.\n");*/
-
+
switch (ExposeTimeNP.s)
{
case IPS_IDLE:
break;
-
+
case IPS_OK:
break;
-
+
case IPS_BUSY:
if ( (err = FLIGetExposureStatus(fli_dev, &timeleft)))
- {
- ExposeTimeNP.s = IPS_IDLE;
+ {
+ ExposeTimeNP.s = IPS_IDLE;
ExposeTimeN[0].value = 0;
-
+
IDSetNumber(&ExposeTimeNP, "FLIGetExposureStatus() failed. %s.", strerror((int)-err));
IDLog("FLIGetExposureStatus() failed. %s.\n", strerror((int)-err));
break;
}
-
+
/*ExposeProgressN[0].value = (timeleft / 1000.);*/
-
+
if (timeleft > 0)
{
ExposeTimeN[0].value = timeleft / 1000.;
- IDSetNumber(&ExposeTimeNP, NULL);
+ IDSetNumber(&ExposeTimeNP, NULL);
break;
}
/*{
IDSetNumber(&ExposeProgressNP, NULL);
break;
}*/
-
+
/* We're done exposing */
- ExposeTimeNP.s = IPS_IDLE;
+ ExposeTimeNP.s = IPS_IDLE;
ExposeTimeN[0].value = 0;
/*ExposeProgressNP.s = IPS_IDLE;*/
IDSetNumber(&ExposeTimeNP, "Exposure done, downloading image...");
IDLog("Exposure done, downloading image...\n");
/*IDSetNumber(&ExposeProgressNP, NULL);*/
-
+
/* grab and save image */
if (grabImage())
break;
-
- /* Multiple image exposure
+
+ /* Multiple image exposure
if ( imagesLeft > 0)
- {
+ {
IDMessage(mydev, "Image #%d will be taken in %0.f seconds.", imageCount+1, DelayN[0].value);
IDLog("Image #%d will be taken in %0.f seconds.", imageCount+1, DelayN[0].value);
IEAddTimer (DelayN[0].value * 1000., handleExposure, NULL);
}*/
break;
-
+
case IPS_ALERT:
break;
}
-
+
switch (TemperatureNP.s)
{
case IPS_IDLE:
@@ -669,14 +669,14 @@ void ISPoll(void *p)
IDLog("FLIGetTemperature() failed. %s.", strerror((int)-err));
return;
}
-
+
if (fabs(TemperatureN[0].value - ccdTemp) >= TEMP_THRESHOLD)
{
TemperatureN[0].value = ccdTemp;
IDSetNumber(&TemperatureNP, NULL);
}
break;
-
+
case IPS_BUSY:
if ((err = FLIGetTemperature(fli_dev, &ccdTemp)))
{
@@ -685,20 +685,20 @@ void ISPoll(void *p)
IDLog("FLIGetTemperature() failed. %s.", strerror((int)-err));
return;
}
-
+
if (fabs(FLICam->temperature - ccdTemp) <= TEMP_THRESHOLD)
TemperatureNP.s = IPS_OK;
-
+
TemperatureN[0].value = ccdTemp;
IDSetNumber(&TemperatureNP, NULL);
break;
-
+
case IPS_ALERT:
break;
}
-
- p=p;
-
+
+ p=p;
+
IEAddTimer (POLLMS, ISPoll, NULL);
}
@@ -706,35 +706,35 @@ void ISPoll(void *p)
We compensate for binning. */
int setImageArea(char errmsg[])
{
-
+
long x_1, y_1, x_2, y_2;
long err;
-
+
/* Add the X and Y offsets */
x_1 = FrameN[0].value + FLICam->Visible_Area[0];
y_1 = FrameN[1].value + FLICam->Visible_Area[1];
-
+
x_2 = x_1 + (FrameN[2].value / BinningN[0].value);
y_2 = y_1 + (FrameN[3].value / BinningN[1].value);
-
+
if (x_2 > FLICam->Visible_Area[2])
x_2 = FLICam->Visible_Area[2];
-
+
if (y_2 > FLICam->Visible_Area[3])
y_2 = FLICam->Visible_Area[3];
-
+
IDLog("The Final image area is (%ld, %ld), (%ld, %ld)\n", x_1, y_1, x_2, y_2);
-
+
FLIImg->width = x_2 - x_1;
FLIImg->height = y_2 - y_1;
-
+
if ( (err = FLISetImageArea(fli_dev, x_1, y_1, x_2, y_2) ))
{
snprintf(errmsg, ERRMSG_SIZE, "FLISetImageArea() failed. %s.\n", strerror((int)-err));
IDLog("%s", errmsg);
return -1;
}
-
+
return 0;
}
@@ -747,26 +747,26 @@ int grabImage()
int img_size,i, fd;
char errmsg[ERRMSG_SIZE];
char filename[] = "/tmp/fitsXXXXXX";
-
+
if ((fd = mkstemp(filename)) < 0)
- {
+ {
IDMessage(mydev, "Error making temporary filename.");
IDLog("Error making temporary filename.\n");
return -1;
}
close(fd);
-
+
img_size = FLIImg->width * FLIImg->height * sizeof(unsigned short);
-
+
FLIImg->img = malloc (img_size);
-
+
if (FLIImg->img == NULL)
{
IDMessage(mydev, "Not enough memory to store image.");
IDLog("Not enough memory to store image.\n");
return -1;
}
-
+
for (i=0; i < FLIImg->height ; i++)
{
if ( (err = FLIGrabRow(fli_dev, &FLIImg->img[i * FLIImg->width], FLIImg->width)))
@@ -777,12 +777,12 @@ int grabImage()
return -1;
}
}
-
+
IDMessage(mydev, "Download complete.\n");
-
+
/*err = (ImageFormatS[0].s == ISS_ON) ? writeFITS(FileNameT[0].text, errmsg) : writeRAW(FileNameT[0].text, errmsg);*/
err = writeFITS(filename, errmsg);
-
+
if (err)
{
free(FLIImg->img);
@@ -792,7 +792,7 @@ int grabImage()
free(FLIImg->img);
return 0;
-
+
}
int writeFITS(const char* filename, char errmsg[])
@@ -801,20 +801,20 @@ int writeFITS(const char* filename, char errmsg[])
int i, j, bpp, bpsl, width, height;
long nbytes;
FITS_HDU_LIST *hdu;
-
+
ofp = fits_open (filename, "w");
if (!ofp)
{
snprintf(errmsg, ERRMSG_SIZE, "Error: cannot open file for writing.");
return (-1);
}
-
+
width = FLIImg->width;
height = FLIImg->height;
bpp = sizeof(unsigned short); /* Bytes per Pixel */
bpsl = bpp * FLIImg->width; /* Bytes per Line */
nbytes = 0;
-
+
hdu = create_fits_header (ofp, width, height, bpp);
if (hdu == NULL)
{
@@ -826,42 +826,42 @@ int writeFITS(const char* filename, char errmsg[])
snprintf(errmsg, ERRMSG_SIZE, "Error: writing to FITS header failed.");
return (-1);
}
-
+
/* Convert buffer to BIG endian */
for (i=0; i < FLIImg->height; i++)
for (j=0 ; j < FLIImg->width; j++)
FLIImg->img[FLIImg->width * i + j] = getBigEndian( (FLIImg->img[FLIImg->width * i + j]) );
-
+
for (i= 0; i < FLIImg->height ; i++)
{
fwrite(FLIImg->img + (i * FLIImg->width), 2, FLIImg->width, ofp->fp);
nbytes += bpsl;
}
-
+
nbytes = nbytes % FITS_RECORD_SIZE;
if (nbytes)
{
while (nbytes++ < FITS_RECORD_SIZE)
putc (0, ofp->fp);
}
-
+
if (ferror (ofp->fp))
{
snprintf(errmsg, ERRMSG_SIZE, "Error: write error occured");
return (-1);
}
-
- fits_close (ofp);
-
+
+ fits_close (ofp);
+
/* Success */
ExposeTimeNP.s = IPS_OK;
/*IDSetNumber(&ExposeTimeNP, "FITS image written to %s", filename);
IDLog("FITS image written to '%s'\n", filename);*/
IDSetNumber(&ExposeTimeNP, NULL);
IDLog("Loading FITS image...\n");
-
+
uploadFile(filename);
-
+
return 0;
}
@@ -874,44 +874,44 @@ void uploadFile(const char* filename)
unsigned int i =0, nr = 0;
uLongf compressedBytes=0;
uLong totalBytes;
- struct stat stat_p;
-
+ struct stat stat_p;
+
if ( -1 == stat (filename, &stat_p))
- {
- IDLog(" Error occoured attempting to stat file.\n");
- return;
+ {
+ IDLog(" Error occoured attempting to stat file.\n");
+ return;
}
-
+
totalBytes = stat_p.st_size;
fitsData = (unsigned char *) malloc (sizeof(unsigned char) * totalBytes);
compressedData = (unsigned char *) malloc (sizeof(unsigned char) * totalBytes + totalBytes / 64 + 16 + 3);
-
+
if (fitsData == NULL || compressedData == NULL)
{
IDLog("Error! low memory. Unable to initialize fits buffers.\n");
return;
}
-
+
fitsFile = fopen(filename, "r");
-
+
if (fitsFile == NULL)
return;
-
- /* #1 Read file from disk */
+
+ /* #1 Read file from disk */
for (i=0; i < totalBytes; i+= nr)
{
nr = fread(fitsData + i, 1, totalBytes - i, fitsFile);
-
+
if (nr <= 0)
{
IDLog("Error reading temporary FITS file.\n");
return;
}
}
-
+
compressedBytes = sizeof(char) * totalBytes + totalBytes / 64 + 16 + 3;
-
- /* #2 Compress it */
+
+ /* #2 Compress it */
r = compress2(compressedData, &compressedBytes, fitsData, totalBytes, 9);
if (r != Z_OK)
{
@@ -919,7 +919,7 @@ void uploadFile(const char* filename)
IDLog("internal error - compression failed: %d\n", r);
return;
}
-
+
/* #3 Send it */
imageB.blob = compressedData;
imageB.bloblen = compressedBytes;
@@ -927,20 +927,20 @@ void uploadFile(const char* filename)
strcpy(imageB.format, ".fits.z");
imageBP.s = IPS_OK;
IDSetBLOB (&imageBP, NULL);
-
- free (fitsData);
+
+ free (fitsData);
free (compressedData);
-
+
}
/* Initiates the exposure procedure */
void handleExposure(void *p)
{
long err;
-
+
/* no warning */
p=p;
-
+
/* BIAS frame is the same as DARK but with minimum period. i.e. readout from camera electronics.
*/
if (FLIImg->frameType == BIAS_FRAME)
@@ -953,7 +953,7 @@ void handleExposure(void *p)
return;
}
}
-
+
if ((err = FLIExposeFrame(fli_dev)))
{
ExposeTimeNP.s = IPS_IDLE;
@@ -961,11 +961,11 @@ void handleExposure(void *p)
IDLog("FLIExposeFrame() failed. %s.\n", strerror((int)-err));
return;
}
-
+
ExposeTimeNP.s = IPS_BUSY;
-
+
IDSetNumber(&ExposeTimeNP, "Taking a %g seconds frame...", FLIImg->expose / 1000.);
-
+
IDLog("Taking a frame...\n");
}
@@ -977,7 +977,7 @@ void getBasicData()
long err;
IDLog("In getBasicData()\n");
-
+
if ((err = FLIGetModel (fli_dev, buff, 2048)))
{
IDMessage(mydev, "FLIGetModel() failed. %s.", strerror((int)-err));
@@ -992,18 +992,18 @@ void getBasicData()
IDLog("malloc() failed.");
return;
}
-
+
strcpy(FLICam->model, buff);
}
-
+
if (( err = FLIGetHWRevision(fli_dev, &FLICam->HWRevision)))
{
IDMessage(mydev, "FLIGetHWRevision() failed. %s.", strerror((int)-err));
IDLog("FLIGetHWRevision() failed. %s.\n", strerror((int)-err));
-
+
return;
}
-
+
if (( err = FLIGetFWRevision(fli_dev, &FLICam->FWRevision)))
{
IDMessage(mydev, "FLIGetFWRevision() failed. %s.", strerror((int)-err));
@@ -1017,32 +1017,32 @@ void getBasicData()
IDLog("FLIGetPixelSize() failed. %s.\n", strerror((int)-err));
return;
}
-
+
FLICam->x_pixel_size *= 1e6;
- FLICam->y_pixel_size *= 1e6;
-
+ FLICam->y_pixel_size *= 1e6;
+
if (( err = FLIGetArrayArea(fli_dev, &FLICam->Array_Area[0], &FLICam->Array_Area[1], &FLICam->Array_Area[2], &FLICam->Array_Area[3])))
{
IDMessage(mydev, "FLIGetArrayArea() failed. %s.", strerror((int)-err));
IDLog("FLIGetArrayArea() failed. %s.\n", strerror((int)-err));
return;
}
-
+
if (( err = FLIGetVisibleArea( fli_dev, &FLICam->Visible_Area[0], &FLICam->Visible_Area[1], &FLICam->Visible_Area[2], &FLICam->Visible_Area[3])))
{
IDMessage(mydev, "FLIGetVisibleArea() failed. %s.", strerror((int)-err));
IDLog("FLIGetVisibleArea() failed. %s.\n", strerror((int)-err));
}
-
+
if (( err = FLIGetTemperature(fli_dev, &FLICam->temperature)))
{
IDMessage(mydev, "FLIGetTemperature() failed. %s.", strerror((int)-err));
IDLog("FLIGetTemperature() failed. %s.\n", strerror((int)-err));
return;
}
-
+
IDLog("The CCD Temperature is %f.\n", FLICam->temperature);
-
+
PixelSizeN[0].value = FLICam->x_pixel_size; /* Pixel width (um) */
PixelSizeN[1].value = FLICam->y_pixel_size; /* Pixel height (um) */
TemperatureN[0].value = FLICam->temperature; /* CCD chip temperatre (degrees C) */
@@ -1050,31 +1050,31 @@ void getBasicData()
FrameN[1].value = 0; /* Y */
FrameN[2].value = FLICam->Visible_Area[2] - FLICam->Visible_Area[0]; /* Frame Width */
FrameN[3].value = FLICam->Visible_Area[3] - FLICam->Visible_Area[1]; /* Frame Height */
-
+
FLICam->width = FLIImg->width = FrameN[2].value;
FLICam->height = FLIImg->width = FrameN[3].value;
-
+
BinningN[0].value = BinningN[1].value = 1;
-
+
IDLog("The Camera Width is %d ---- %d\n", (int) FLICam->width, (int) FrameN[2].value);
IDLog("The Camera Height is %d ---- %d\n", (int) FLICam->height, (int) FrameN[3].value);
-
+
IDSetNumber(&PixelSizeNP, NULL);
IDSetNumber(&TemperatureNP, NULL);
IDSetNumber(&FrameNP, NULL);
IDSetNumber(&BinningNP, NULL);
-
+
IDLog("Exiting getBasicData()\n");
-
+
}
int manageDefaults(char errmsg[])
{
long err;
int exposeTimeMS;
-
+
exposeTimeMS = (int) (ExposeTimeN[0].value * 1000.);
-
+
IDLog("Setting default exposure time of %d ms.\n", exposeTimeMS);
if ( (err = FLISetExposureTime(fli_dev, exposeTimeMS) ))
{
@@ -1082,7 +1082,7 @@ int manageDefaults(char errmsg[])
IDLog(errmsg, NULL);
return -1;
}
-
+
/* Default frame type is NORMAL */
if ( (err = FLISetFrameType(fli_dev, FLI_FRAME_TYPE_NORMAL) ))
{
@@ -1090,7 +1090,7 @@ int manageDefaults(char errmsg[])
IDLog(errmsg, NULL);
return -1;
}
-
+
/* X horizontal binning */
if ( (err = FLISetHBin(fli_dev, BinningN[0].value) ))
{
@@ -1098,7 +1098,7 @@ int manageDefaults(char errmsg[])
IDLog(errmsg, NULL);
return -1;
}
-
+
/* Y vertical binning */
if ( (err = FLISetVBin(fli_dev, BinningN[1].value) ))
{
@@ -1106,18 +1106,18 @@ int manageDefaults(char errmsg[])
IDLog(errmsg, NULL);
return -1;
}
-
+
IDLog("Setting default binning %f x %f.\n", BinningN[0].value, BinningN[1].value);
-
+
FLISetNFlushes(fli_dev, NFLUSHES);
-
+
/* Set image area */
if (setImageArea(errmsg))
return -1;
-
+
/* Success */
return 0;
-
+
}
int getOnSwitch(ISwitchVectorProperty *sp)
@@ -1141,7 +1141,7 @@ int checkPowerS(ISwitchVectorProperty *sp)
IDMessage (mydev, "Cannot change property %s while the CCD is offline.", sp->name);
else
IDMessage (mydev, "Cannot change property %s while the CCD is offline.", sp->label);
-
+
sp->s = IPS_IDLE;
IDSetSwitch(sp, NULL);
return -1;
@@ -1158,7 +1158,7 @@ int checkPowerN(INumberVectorProperty *np)
IDMessage (mydev, "Cannot change property %s while the CCD is offline.", np->name);
else
IDMessage (mydev, "Cannot change property %s while the CCD is offline.", np->label);
-
+
np->s = IPS_IDLE;
IDSetNumber(np, NULL);
return -1;
@@ -1176,7 +1176,7 @@ int checkPowerT(ITextVectorProperty *tp)
IDMessage (mydev, "Cannot change property %s while the CCD is offline.", tp->name);
else
IDMessage (mydev, "Cannot change property %s while the CCD is offline.", tp->label);
-
+
tp->s = IPS_IDLE;
IDSetText(tp, NULL);
return -1;
@@ -1190,9 +1190,9 @@ void connectCCD()
{
long err;
char errmsg[ERRMSG_SIZE];
-
+
IDLog ("In ConnectCCD\n");
-
+
/* USB by default {USB, SERIAL, PARALLEL, INET} */
switch (PowerS[0].s)
{
@@ -1217,7 +1217,7 @@ void connectCCD()
IDLog("Error: FLIOpen() failed. %s.\n", strerror( (int) -err));
return;
}
-
+
/* Sucess! */
PowerS[0].s = ISS_ON;
PowerS[1].s = ISS_OFF;
@@ -1233,7 +1233,7 @@ void connectCCD()
}
break;
-
+
case ISS_OFF:
PowerS[0].s = ISS_OFF;
PowerS[1].s = ISS_ON;
@@ -1261,7 +1261,7 @@ int findcam(flidomain_t domain)
{
char **tmplist;
long err;
-
+
IDLog("In find Camera, the domain is %ld\n", domain);
if (( err = FLIList(domain | FLIDEVICE_CAMERA, &tmplist)))
@@ -1269,7 +1269,7 @@ int findcam(flidomain_t domain)
IDLog("FLIList() failed. %s\n", strerror((int)-err));
return -1;
}
-
+
if (tmplist != NULL && tmplist[0] != NULL)
{
int i;
@@ -1292,9 +1292,9 @@ int findcam(flidomain_t domain)
break;
}
}
-
+
FLICam->domain = domain;
-
+
switch (domain)
{
case FLIDOMAIN_PARALLEL_PORT:
@@ -1316,15 +1316,15 @@ int findcam(flidomain_t domain)
default:
FLICam->dname = strdup("Unknown domain");
}
-
+
FLICam->name = strdup(tmplist[0]);
-
+
if ((err = FLIFreeList(tmplist)))
{
IDLog("FLIFreeList() failed. %s.\n", strerror((int)-err));
return -1;
}
-
+
} /* end if */
else
{
@@ -1333,7 +1333,7 @@ int findcam(flidomain_t domain)
IDLog("FLIFreeList() failed. %s.\n", strerror((int)-err));
return -1;
}
-
+
return -1;
}
@@ -1349,13 +1349,13 @@ FITS_HDU_LIST * create_fits_header (FITS_FILE *ofp, uint width, uint height, uin
char ts[32];
struct tm *tp;
time_t t;
-
+
time (&t);
tp = gmtime (&t);
strftime (ts, sizeof(ts), "%Y-%m-%dT%H:%M:%S", tp);
-
+
snprintf(obsDate, 80, "DATE-OBS= '%s' /Observation Date UTC", ts);
-
+
hdulist = fits_add_hdu (ofp);
if (hdulist == NULL) return (NULL);
@@ -1373,7 +1373,7 @@ FITS_HDU_LIST * create_fits_header (FITS_FILE *ofp, uint width, uint height, uin
hdulist->bzero = 0.0;
hdulist->used.bscale = 1;
hdulist->bscale = 1.0;
-
+
sprintf(temp_s, "CCD-TEMP= %g / degrees celcius", TemperatureN[0].value);
sprintf(expose_s, "EXPOSURE= %d / milliseconds", FLIImg->expose);
sprintf(binning_s, "BINNING = '(%g x %g)'", BinningN[0].value, BinningN[1].value);
@@ -1393,14 +1393,14 @@ FITS_HDU_LIST * create_fits_header (FITS_FILE *ofp, uint width, uint height, uin
strcpy(frame_s, "FRAME = 'Dark'");
break;
}
-
- fits_add_card (hdulist, frame_s);
+
+ fits_add_card (hdulist, frame_s);
fits_add_card (hdulist, temp_s);
fits_add_card (hdulist, expose_s);
fits_add_card (hdulist, pixel_s);
fits_add_card (hdulist, ( char* ) "INSTRUME= 'Finger Lakes Instruments'");
fits_add_card (hdulist, obsDate);
-
+
return (hdulist);
}
@@ -1408,14 +1408,14 @@ double min()
{
double lmin = FLIImg->img[0];
int ind=0, i, j;
-
+
for (i= 0; i < FLIImg->height ; i++)
for (j= 0; j < FLIImg->width; j++)
{
ind = (i * FLIImg->width) + j;
if (FLIImg->img[ind] < lmin) lmin = FLIImg->img[ind];
}
-
+
return lmin;
}
@@ -1423,13 +1423,13 @@ double max()
{
double lmax = FLIImg->img[0];
int ind=0, i, j;
-
+
for (i= 0; i < FLIImg->height ; i++)
for (j= 0; j < FLIImg->width; j++)
{
ind = (i * FLIImg->width) + j;
if (FLIImg->img[ind] > lmax) lmax = FLIImg->img[ind];
}
-
+
return lmax;
}