Skip to content

Commit f330d9d

Browse files
committed
Refactoring
Better function naming style consistancy
1 parent 1ad4dd7 commit f330d9d

15 files changed

+138
-138
lines changed

Align.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class TGeoAlignH
4444
void writeCoe();
4545
bool isReady();
4646
bool addStar(int I, int N, double RA, double Dec);
47-
void HorToInstr(double Alt, double Azm, double *Alt1, double *Azm1, int PierSide);
48-
void InstrToHor(double Alt, double Azm, double *Alt1, double *Azm1, int PierSide);
47+
void horToInstr(double Alt, double Azm, double *Alt1, double *Azm1, int PierSide);
48+
void instrToHor(double Alt, double Azm, double *Alt1, double *Azm1, int PierSide);
4949
void autoModel(int n, bool start);
5050

5151
private:
@@ -104,8 +104,8 @@ class TGeoAlign
104104
void writeCoe();
105105
bool isReady();
106106
bool addStar(int I, int N, double RA, double Dec);
107-
void EquToInstr(double Lat, double HA, double Dec, double *HA1, double *Dec1, int PierSide);
108-
void InstrToEqu(double Lat, double HA, double Dec, double *HA1, double *Dec1, int PierSide);
107+
void equToInstr(double Lat, double HA, double Dec, double *HA1, double *Dec1, int PierSide);
108+
void instrToEqu(double Lat, double HA, double Dec, double *HA1, double *Dec1, int PierSide);
109109
void autoModel(int n, bool start);
110110

111111
private:

AlignEq.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ void TGeoAlign::autoModel(int n, bool start) {
362362
}
363363

364364
// takes the topocentric refracted coordinates and applies corrections to arrive at instrument equatorial coordinates
365-
void TGeoAlign::EquToInstr(double Lat, double HA, double Dec, double *HA1, double *Dec1, int PierSide) {
365+
void TGeoAlign::equToInstr(double Lat, double HA, double Dec, double *HA1, double *Dec1, int PierSide) {
366366
double p=1.0; if (PierSide==PierSideWest) p=-1.0;
367367

368368
if (Dec>90.0) Dec=90.0;
@@ -427,7 +427,7 @@ void TGeoAlign::EquToInstr(double Lat, double HA, double Dec, double *HA1, doubl
427427
}
428428

429429
// takes the instrument equatorial coordinates and applies corrections to arrive at topocentric refracted coordinates
430-
void TGeoAlign::InstrToEqu(double Lat, double HA, double Dec, double *HA1, double *Dec1, int PierSide) {
430+
void TGeoAlign::instrToEqu(double Lat, double HA, double Dec, double *HA1, double *Dec1, int PierSide) {
431431
double p=1.0; if (PierSide==PierSideWest) p=-1.0;
432432

433433
HA =HA +ax1Cor;

AlignHor.ino

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ the pdCor term is 100% in HA
7777
// RA, Dec (all in degrees)
7878
bool TGeoAlignH::addStar(int I, int N, double RA, double Dec) {
7979
double a,z;
80-
EquToHor(haRange(LST()*15.0-RA),Dec,&a,&z);
80+
equToHor(haRange(LST()*15.0-RA),Dec,&a,&z);
8181

8282
// First star:
8383
// Near the celestial equator (Dec=0, HA=0), telescope West of the pier if multi-star align
@@ -88,15 +88,15 @@ bool TGeoAlignH::addStar(int I, int N, double RA, double Dec) {
8888

8989
mount[I-1].azm=getInstrAxis1();
9090
mount[I-1].alt=getInstrAxis2();
91-
HorToEqu(mount[I-1].alt,mount[I-1].azm,&mount[I-1].ha,&mount[I-1].dec);
91+
horToEqu(mount[I-1].alt,mount[I-1].azm,&mount[I-1].ha,&mount[I-1].dec);
9292
mount[I-1].azm=mount[I-1].azm/Rad;
9393
mount[I-1].alt=mount[I-1].alt/Rad;
9494
mount[I-1].ha=degRange(mount[I-1].ha)/Rad;
9595
mount[I-1].dec=mount[I-1].dec/Rad;
9696

9797
actual[I-1].ha =haRange(LST()*15.0-RA);
9898
actual[I-1].dec=Dec;
99-
EquToHor(actual[I-1].ha,actual[I-1].dec,&actual[I-1].alt,&actual[I-1].azm);
99+
equToHor(actual[I-1].ha,actual[I-1].dec,&actual[I-1].alt,&actual[I-1].azm);
100100
actual[I-1].alt=actual[I-1].alt/Rad;
101101
actual[I-1].azm=actual[I-1].azm/Rad;
102102
actual[I-1].ha =degRange(actual[I-1].ha)/Rad;
@@ -375,7 +375,7 @@ void TGeoAlignH::autoModel(int n, bool start) {
375375
}
376376
}
377377

378-
void TGeoAlignH::HorToInstr(double Alt, double Azm, double *Alt1, double *Azm1, int PierSide) {
378+
void TGeoAlignH::horToInstr(double Alt, double Azm, double *Alt1, double *Azm1, int PierSide) {
379379
double p=1.0; if (PierSide==PierSideWest) p=-1.0;
380380

381381
double cosLat=cos(90.0/Rad); double sinLat=sin(90.0/Rad);
@@ -442,7 +442,7 @@ void TGeoAlignH::HorToInstr(double Alt, double Azm, double *Alt1, double *Azm1,
442442
}
443443

444444
// takes the instrument equatorial coordinates and applies corrections to arrive at topocentric refracted coordinates
445-
void TGeoAlignH::InstrToHor(double Alt, double Azm, double *Alt1, double *Azm1, int PierSide) {
445+
void TGeoAlignH::instrToHor(double Alt, double Azm, double *Alt1, double *Azm1, int PierSide) {
446446
double p=1.0; if (PierSide==PierSideWest) p=-1.0;
447447

448448
double cosLat=cos(90.0/Rad); double sinLat=sin(90.0/Rad);

Astro.ino

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ double jd2last(double JulianDay, double ut1, bool updateRTC) {
215215
}
216216

217217
// passes Local Apparent Sidereal Time to stepper timer
218-
void update_lst(double t) {
218+
void updateLST(double t) {
219219
long lst1=(t/24.0)*8640000.0;
220220

221221
// set the local sidereal time
@@ -266,7 +266,7 @@ double encodeTimeZone(double tz) {
266266

267267
// convert equatorial coordinates to horizon
268268
// this takes approx. 1.4mS on a 16MHz Mega2560
269-
void EquToHor(double HA, double Dec, double *Alt, double *Azm) {
269+
void equToHor(double HA, double Dec, double *Alt, double *Azm) {
270270
while (HA<0.0) HA=HA+360.0;
271271
while (HA>=360.0) HA=HA-360.0;
272272
HA =HA/Rad;
@@ -282,7 +282,7 @@ void EquToHor(double HA, double Dec, double *Alt, double *Azm) {
282282

283283
// convert horizon coordinates to equatorial
284284
// this takes approx. 1.4mS
285-
void HorToEqu(double Alt, double Azm, double *HA, double *Dec) {
285+
void horToEqu(double Alt, double Azm, double *HA, double *Dec) {
286286
while (Azm<0) Azm=Azm+360.0;
287287
while (Azm>=360.0) Azm=Azm-360.0;
288288
Alt = Alt/Rad;
@@ -302,7 +302,7 @@ void HorToEqu(double Alt, double Azm, double *HA, double *Dec) {
302302
// _deltaAxis1/2 are in arc-seconds/second
303303
double _deltaAxis1=15.0,_deltaAxis2=0.0;
304304

305-
void SetDeltaTrackingRate() {
305+
void setDeltaTrackingRate() {
306306
#ifndef MOUNT_TYPE_ALTAZM
307307
if ((rateCompensation!=RC_REFR_BOTH) && (rateCompensation!=RC_FULL_BOTH)) _deltaAxis2=0.0;
308308
#endif
@@ -316,25 +316,25 @@ void SetDeltaTrackingRate() {
316316
}
317317

318318
double _currentRate=1.0;
319-
void SetTrackingRate(double r) {
319+
void setTrackingRate(double r) {
320320
_currentRate=r;
321321
#ifndef MOUNT_TYPE_ALTAZM
322322
_deltaAxis1=r*15.0;
323323
_deltaAxis2=0.0;
324324
#endif
325325
}
326326

327-
double GetTrackingRate() {
327+
double getTrackingRate() {
328328
return _currentRate;
329329
}
330330

331-
double GetStepsPerSecondAxis1() {
331+
double getStepsPerSecondAxis1() {
332332
double s=(((double)StepsPerDegreeAxis1/240.0)*(_deltaAxis1/15.0));
333333
if (s<8.0) s=8.0;
334334
return s;
335335
}
336336

337-
double GetStepsPerSecondAxis2() {
337+
double getStepsPerSecondAxis2() {
338338
double s=(((double)StepsPerDegreeAxis2/240.0)*(_deltaAxis2/15.0));
339339
if (s<8.0) s=8.0;
340340
return s;
@@ -343,7 +343,7 @@ double GetStepsPerSecondAxis2() {
343343
// -----------------------------------------------------------------------------------------------------------------------------
344344
// Low overhead altitude calculation, 16 calls to complete
345345

346-
boolean do_fastalt_calc() {
346+
boolean doFastAltCalc() {
347347
boolean done=false;
348348

349349
static byte ac_step = 0;
@@ -394,16 +394,16 @@ boolean do_fastalt_calc() {
394394
// Refraction adjusted tracking
395395

396396
// returns the amount of refraction (in arcminutes) at the given true altitude (degrees), pressure (millibars), and temperature (celsius)
397-
double TrueRefrac(double Alt, double Pressure=1010.0, double Temperature=10.0) {
397+
double trueRefrac(double Alt, double Pressure=1010.0, double Temperature=10.0) {
398398
double TPC=(Pressure/1010.0) * (283.0/(273.0+Temperature));
399399
double r=( ( 1.02*cot( (Alt+(10.3/(Alt+5.11)))/Rad ) ) ) * TPC; if (r<0.0) r=0.0;
400400
return r;
401401
}
402402

403403
// returns the amount of refraction (in arcminutes) at the given apparent altitude (degrees), pressure (millibars), and temperature (celsius)
404-
double ApparentRefrac(double Alt, double Pressure=1010.0, double Temperature=10.0) {
405-
double r=TrueRefrac(Alt,Pressure,Temperature);
406-
r=TrueRefrac(Alt-(r/60.0),Pressure,Temperature);
404+
double apparentRefrac(double Alt, double Pressure=1010.0, double Temperature=10.0) {
405+
double r=trueRefrac(Alt,Pressure,Temperature);
406+
r=trueRefrac(Alt-(r/60.0),Pressure,Temperature);
407407
return r;
408408
}
409409

@@ -415,8 +415,8 @@ double ztr(double a) {
415415
double Alt1=a+0.25; if (Alt1<0.0) Alt1=0.0;
416416
double Alt2=a-0.25; if (Alt2<0.0) Alt2=0.0;
417417

418-
double Alt1_ = Alt1 - ( TrueRefrac(Alt1) / 60.0 );
419-
double Alt2_ = Alt2 - ( TrueRefrac(Alt2) / 60.0 );
418+
double Alt1_ = Alt1 - ( trueRefrac(Alt1) / 60.0 );
419+
double Alt2_ = Alt2 - ( trueRefrac(Alt2) / 60.0 );
420420

421421
double x=15.0 * ((double)(( Alt1 - Alt2 ) / ( Alt1_ - Alt2_ ))); if (x>15.0) x=15.0;
422422
return x;
@@ -431,7 +431,7 @@ double ztr(double a) {
431431
#define RefractionRateRange 10
432432
#endif
433433

434-
boolean do_refractionRate_calc() {
434+
boolean doRefractionRateCalc() {
435435
boolean done=false;
436436
static boolean ot=false;
437437

@@ -462,24 +462,24 @@ boolean do_refractionRate_calc() {
462462
// get the instrument coordinates
463463
if ((rr_step==10) || (rr_step==110)) {
464464
if (ot) {
465-
Align.EquToInstr(latitude,rr_HA,rr_Dec,&rr_HA,&rr_Dec,getInstrPierSide());
465+
Align.equToInstr(latitude,rr_HA,rr_Dec,&rr_HA,&rr_Dec,getInstrPierSide());
466466
rr_HA+=indexAxis1; rr_Dec+=indexAxis2;
467467
}
468468
}
469469

470470
// get the Horizon coords
471471
if ((rr_step==15) || (rr_step==115)) {
472-
EquToHor(rr_HA,rr_Dec,&rr_Alt,&rr_Azm);
472+
equToHor(rr_HA,rr_Dec,&rr_Alt,&rr_Azm);
473473
} else
474474

475475
// apply refraction
476476
if ((rr_step==20) || (rr_step==120)) {
477-
rr_Alt+=ApparentRefrac(rr_Alt,ambient.getPressure(),ambient.getTemperature())/60.0;
477+
rr_Alt+=apparentRefrac(rr_Alt,ambient.getPressure(),ambient.getTemperature())/60.0;
478478
} else
479479

480480
// convert back to the Equtorial coords
481481
if ((rr_step==25) || (rr_step==125)) {
482-
HorToEqu(rr_Alt,rr_Azm,&rr_HA1,&rr_Dec1);
482+
horToEqu(rr_Alt,rr_Azm,&rr_HA1,&rr_Dec1);
483483
if (rr_HA1>180.0) rr_HA1-=360.0; // HA range +/-180
484484
} else
485485

@@ -525,7 +525,7 @@ boolean do_refractionRate_calc() {
525525

526526
#define AltAzTrackingRange 10 // distance in arc-min (10) ahead of and behind the current Equ position, used for rate calculation
527527

528-
boolean do_altAzmRate_calc() {
528+
boolean doHorRateCalc() {
529529
boolean done=false;
530530

531531
static int az_step=0;
@@ -560,7 +560,7 @@ boolean do_altAzmRate_calc() {
560560

561561
// convert to Equatorial coords
562562
if ((az_step==5)) {
563-
HorToEqu(az_Alt,az_Azm,&az_HA1,&az_Dec1);
563+
horToEqu(az_Alt,az_Azm,&az_HA1,&az_Dec1);
564564
} else
565565

566566
// look ahead of and behind the current position
@@ -572,7 +572,7 @@ boolean do_altAzmRate_calc() {
572572

573573
// each back to the Horizon coords
574574
if ((az_step==15) || (az_step==115)) {
575-
EquToHor(az_HA,az_Dec,&az_Alt,&az_Azm);
575+
equToHor(az_HA,az_Dec,&az_Alt,&az_Azm);
576576
if (az_Azm>180.0) az_Azm-=360.0;
577577
if (az_Azm<-180.0) az_Azm+=360.0;
578578

@@ -660,7 +660,7 @@ double cot(double n) {
660660
}
661661

662662
// Acceleration rate calculation
663-
void SetAccelerationRates(double maxRate) {
663+
void setAccelerationRates(double maxRate) {
664664

665665
// set the new guide acceleration rate
666666
slewRateX = (RateToXPerSec/(maxRate/16.0))*5.0; // 5x for exponential factor average rate

0 commit comments

Comments
 (0)