| 1 |
/* |
| 2 |
FLI CCD |
| 3 |
INDI Interface for Finger Lakes Instrument CCDs |
| 4 |
Copyright (C) 2003-2016 Jasem Mutlaq ([email protected]) |
| 5 |
|
| 6 |
This library is free software; you can redistribute it and/or |
| 7 |
modify it under the terms of the GNU Lesser General Public |
| 8 |
License as published by the Free Software Foundation; either |
| 9 |
version 2.1 of the License, or (at your option) any later version. |
| 10 |
|
| 11 |
This library is distributed in the hope that it will be useful, |
| 12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
Lesser General Public License for more details. |
| 15 |
|
| 16 |
You should have received a copy of the GNU Lesser General Public |
| 17 |
License along with this library; if not, write to the Free Software |
| 18 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 |
|
| 20 |
2016.05.16: Added CCD Cooler Power (JM) |
| 21 |
|
| 22 |
*/ |
| 23 |
|
| 24 |
#pragma once |
| 25 |
|
| 26 |
#include <libfli.h> |
| 27 |
#include <indiccd.h> |
| 28 |
#include <iostream> |
| 29 |
|
| 30 |
using namespace std; |
| 31 |
|
| 32 |
class FLICCD : public INDI::CCD |
| 33 |
{ |
| 34 |
public: |
| 35 |
FLICCD(); |
| 36 |
virtual ~FLICCD() override; |
| 37 |
|
| 38 |
const char *getDefaultName() override; |
| 39 |
|
| 40 |
bool initProperties() override; |
| 41 |
void ISGetProperties(const char *dev) override; |
| 42 |
bool updateProperties() override; |
| 43 |
|
| 44 |
bool Connect() override; |
| 45 |
bool Disconnect() override; |
| 46 |
|
| 47 |
bool StartExposure(float duration) override; |
| 48 |
bool AbortExposure() override; |
| 49 |
|
| 50 |
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override; |
| 51 |
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override; |
| 52 |
|
| 53 |
protected: |
| 54 |
virtual void TimerHit() override; |
| 55 |
virtual int SetTemperature(double temperature) override; |
| 56 |
virtual bool UpdateCCDFrame(int x, int y, int w, int h) override; |
| 57 |
virtual bool UpdateCCDBin(int binx, int biny) override; |
| 58 |
virtual bool UpdateCCDFrameType(INDI::CCDChip::CCD_FRAME fType) override; |
| 59 |
|
| 60 |
virtual void debugTriggered(bool enable) override; |
| 61 |
virtual bool saveConfigItems(FILE *fp) override; |
| 62 |
|
| 63 |
private: |
| 64 |
// Find FLI CCD |
| 65 |
bool findFLICCD(flidomain_t domain); |
| 66 |
|
| 67 |
// Calculate Time until exposure is complete |
| 68 |
float calcTimeLeft(); |
| 69 |
|
| 70 |
// Fetch image row by row from the CCD |
| 71 |
bool grabImage(); |
| 72 |
|
| 73 |
// Get initial CCD values upon connection |
| 74 |
bool setupParams(); |
| 75 |
|
| 76 |
typedef struct cam_t |
| 77 |
{ |
| 78 |
flidomain_t domain; |
| 79 |
char *dname; |
| 80 |
char *name; |
| 81 |
char model[32] = {0}; |
| 82 |
long HWRevision; |
| 83 |
long FWRevision; |
| 84 |
double x_pixel_size; |
| 85 |
double y_pixel_size; |
| 86 |
long Array_Area[4]; |
| 87 |
long Visible_Area[4]; |
| 88 |
int width, height; |
| 89 |
double temperature; |
| 90 |
} cam_t; |
| 91 |
|
| 92 |
ISwitch PortS[4]; |
| 93 |
ISwitchVectorProperty PortSP; |
| 94 |
|
| 95 |
IText CamInfoT[3] {}; |
| 96 |
ITextVectorProperty CamInfoTP; |
| 97 |
|
| 98 |
INumber CoolerN[1]; |
| 99 |
INumberVectorProperty CoolerNP; |
| 100 |
|
| 101 |
INumber FlushN[1]; |
| 102 |
INumberVectorProperty FlushNP; |
| 103 |
|
| 104 |
ISwitch BackgroundFlushS[2]; |
| 105 |
ISwitchVectorProperty BackgroundFlushSP; |
| 106 |
|
| 107 |
ISwitch *CameraModeS = nullptr; |
| 108 |
ISwitchVectorProperty CameraModeSP; |
| 109 |
|
| 110 |
int timerID = 0; |
| 111 |
|
| 112 |
// Exposure timing |
| 113 |
struct timeval ExpStart; |
| 114 |
float ExposureRequest {0}; |
| 115 |
|
| 116 |
flidev_t fli_dev; |
| 117 |
cam_t FLICam; |
| 118 |
|
| 119 |
// Simulation mode |
| 120 |
bool sim = false; |
| 121 |
}; |