forked from hjd1964/OnStep
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Align.h
152 lines (128 loc) · 3.39 KB
/
Align.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
// -----------------------------------------------------------------------------------
// PROGRAM FOR POINTING A TELESCOPE BY T. TAKI
//
// CONVERSION TO C++/Arduino BY Howard Dutton, 10/12/2016
byte alignNumStars = 0;
byte alignThisStar = 0;
#ifdef MOUNT_TYPE_ALTAZM
typedef struct {
double HA;
double Dec;
double Alt;
double Az;
} align_coord_t;
class TAlign
{
public:
TAlign();
~TAlign();
void init();
bool isReady();
void addStar(int I, int N, double B, double D, double H, double F);
void EquToInstr(double B, double D, double *H, double *F);
void InstrToEqu(double H, double F, double *B, double *D);
private:
double Z1;
double Z2;
double Z3;
boolean t_ready;
double W;
double Q[4][4];
double V[4][4];
double R[4][4];
double X[4][4];
double Y[4][4];
align_coord_t AlignStars[10];
void t_deter_sub();
void t_angle_sub(double *F, double *H);
void t_sub1(double F, double H);
void t_sub2(double F, double H);
void bestZ3(int I, double nrange, double range, double incr);
};
TAlign Align;
#endif
#ifndef ALIGN_GOTOASSIST_ON
// -----------------------------------------------------------------------------------
// GEOMETRIC ALIGN FOR EQUATORIAL MOUNTS
//
typedef struct {
double HA;
double Dec;
double HA1;
double Dec1;
} align_coord2_t;
class TGeoAlign
{
public:
double altCor;
double azmCor;
double doCor;
double pdCor;
double dfCor;
double tfCor;
TGeoAlign();
~TGeoAlign();
void init();
void readCoe();
void writeCoe();
bool isReady();
bool addStar(int I, int N, double RA, double Dec);
void EquToInstr(double Lat, double HA, double Dec, double *HA1, double *Dec1);
void InstrToEqu(double Lat, double HA, double Dec, double *HA1, double *Dec1);
private:
boolean geo_ready;
double avgDec;
double avgHA;
align_coord2_t AlignStars[4];
};
TGeoAlign GeoAlign;
#else
// -----------------------------------------------------------------------------------
// GEOMETRIC ALIGN FOR EQUATORIAL MOUNTS2
//
typedef struct {
double ha;
double dec;
int side;
} align_coord2_t;
class TGeoAlign
{
public:
double altCor;
double azmCor;
double doCor;
double pdCor;
double dfCor;
double tfCor;
TGeoAlign();
~TGeoAlign();
void init();
void readCoe();
void writeCoe();
bool isReady();
bool addStar(int I, int N, double RA, double Dec);
void EquToInstr(double Lat, double HA, double Dec, double *HA1, double *Dec1);
void InstrToEqu(double Lat, double HA, double Dec, double *HA1, double *Dec1);
private:
boolean geo_ready;
double avgDec;
double avgHA;
long num,l;
long Ff,Df;
double best_deo, best_pd, best_pz, best_pe, best_ohw, best_odw, best_ohe, best_ode, best_tf, best_df, best_ff;
double h1,d1;
double avg_ha,avg_dec;
double dist,sumd,rms;
double best_dist;
double ohe,ode,ohw,odw,dh;
double sd,sh,sum1;
double max_dist;
align_coord2_t mount[9];
align_coord2_t actual[9];
align_coord2_t delta[9];
void correct(double ha, double dec, double pierSide, double sf, double _deo, double _pd, double _pz, double _pe, double _da, double _ff, double _tf, double *h1, double *d1);
void do_search(double sf, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int p9);
void autoModel(int n);
};
TGeoAlign GeoAlign;
#endif