forked from indilib/indi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtcfs.h
120 lines (101 loc) · 3.62 KB
/
tcfs.h
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
/*
INDI Driver for Optec TCF-S Focuser
Copyright (C) 2010 Jasem Mutlaq ([email protected])
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#pragma once
#include "indifocuser.h"
#include <string>
#define TCFS_MAX_CMD 16
#define TCFS_ERROR_BUFFER 1024
class TCFS : public INDI::Focuser
{
public:
enum TCFSCommand
{
FMMODE, // Focuser Manual Mode
FFMODE, // Focuser Free Mode
FAMODE, // Focuser Auto-A Mode
FBMODE, // Focuser Auto-B Mode
FCENTR, // Focus Center
FIN, // Focuser In “nnnn”
FOUT, // Focuser Out “nnnn”
FPOSRO, // Focuser Position Read Out
FTMPRO, // Focuser Temperature Read Out
FSLEEP, // Focuser Sleep
FWAKUP, // Focuser Wake Up
FHOME, // Focuser Home Command
FRSLOP, // Focuser Read Slope Command
FLSLOP, // Focuser Load Slope Command
FQUIET, // Focuser Quiet Command
FDELAY, // Focuser Load Delay Command
FRSIGN, // Focuser Read Slope Sign Command
FLSIGN, // Focuser Load Slope Sign Command
FFWVER, // Focuser Firmware Version
};
enum TCFSMode
{
MANUAL,
MODE_A,
MODE_B
};
enum TCFSError
{
NO_ERROR,
ER_1,
ER_2,
ER_3
};
TCFS();
virtual ~TCFS() = default;
// Standard INDI interface fucntions
virtual bool Handshake();
virtual bool Disconnect();
const char *getDefaultName();
virtual bool initProperties();
virtual bool updateProperties();
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n);
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n);
virtual bool saveConfigItems(FILE *fp);
protected:
virtual IPState MoveAbsFocuser(uint32_t targetTicks);
virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks);
virtual void TimerHit();
void GetFocusParams();
bool SetManualMode();
private:
bool read_tcfs(char *response, bool silent = false);
bool dispatch_command(TCFSCommand command_type, int val=0, TCFSMode m=MANUAL);
INumber FocusModeAN[3];
INumberVectorProperty FocusModeANP;
INumber FocusModeBN[3];
INumberVectorProperty FocusModeBNP;
ISwitch FocusTelemetryS[2];
ISwitchVectorProperty FocusTelemetrySP;
ISwitch FocusModeS[3];
ISwitchVectorProperty FocusModeSP;
ISwitch FocusPowerS[2];
ISwitchVectorProperty FocusPowerSP;
ISwitch FocusGotoS[4];
ISwitchVectorProperty FocusGotoSP;
INumber FocusTemperatureN[1];
INumberVectorProperty FocusTemperatureNP;
ISwitch FocusStartModeS[3];
ISwitchVectorProperty FocusStartModeSP;
unsigned int simulated_position { 3000 };
float simulated_temperature { 25.4 };
TCFSMode currentMode;
unsigned int targetTicks { 0 };
unsigned int targetPosition { 0 };
bool isTCFS3 { false };
};