Skip to content

Commit cdea5ce

Browse files
committed
Switched to using F() macro for debug messages
1 parent b3c7ddc commit cdea5ce

File tree

9 files changed

+153
-114
lines changed

9 files changed

+153
-114
lines changed

AlignEq.ino

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,21 @@ void TGeoAlign::init() {
3131
// remember the alignment between sessions
3232
void TGeoAlign::readCoe() {
3333
ax1Cor=nv.readFloat(EE_ax1Cor);
34-
if (ax1Cor < -360 || ax1Cor > 360) { ax1Cor=0.0; DL("ERR, readCoe(): bad NV ax1Cor"); }
34+
if (ax1Cor < -360 || ax1Cor > 360) { ax1Cor=0.0; DLF("ERR, readCoe(): bad NV ax1Cor"); }
3535
ax2Cor=nv.readFloat(EE_ax2Cor);
36-
if (ax2Cor < -360 || ax2Cor > 360) { ax2Cor=0.0; DL("ERR, readCoe(): bad NV ax2Cor"); }
36+
if (ax2Cor < -360 || ax2Cor > 360) { ax2Cor=0.0; DLF("ERR, readCoe(): bad NV ax2Cor"); }
3737
dfCor=nv.readFloat(EE_dfCor); // dfCor is ffCor for fork mounts
38-
if (dfCor < -10 || dfCor > 10) { dfCor=0.0; DL("ERR, readCoe(): bad NV dfCor"); }
38+
if (dfCor < -10 || dfCor > 10) { dfCor=0.0; DLF("ERR, readCoe(): bad NV dfCor"); }
3939
tfCor=nv.readFloat(EE_tfCor);
40-
if (tfCor < -10 || tfCor > 10) { tfCor=0.0; DL("ERR, readCoe(): bad NV tfCor"); }
40+
if (tfCor < -10 || tfCor > 10) { tfCor=0.0; DLF("ERR, readCoe(): bad NV tfCor"); }
4141
doCor=nv.readFloat(EE_doCor);
42-
if (doCor < -10 || doCor > 10) { doCor=0.0; DL("ERR, readCoe(): bad NV doCor"); }
42+
if (doCor < -10 || doCor > 10) { doCor=0.0; DLF("ERR, readCoe(): bad NV doCor"); }
4343
pdCor=nv.readFloat(EE_pdCor);
44-
if (pdCor < -10 || pdCor > 10) { pdCor=0.0; DL("ERR, readCoe(): bad NV pdCor"); }
44+
if (pdCor < -10 || pdCor > 10) { pdCor=0.0; DLF("ERR, readCoe(): bad NV pdCor"); }
4545
altCor=nv.readFloat(EE_altCor);
46-
if (altCor < -10 || altCor > 10) { altCor=0.0; DL("ERR, readCoe(): bad NV altCor"); }
46+
if (altCor < -10 || altCor > 10) { altCor=0.0; DLF("ERR, readCoe(): bad NV altCor"); }
4747
azmCor=nv.readFloat(EE_azmCor);
48-
if (azmCor < -10 || azmCor > 10) { azmCor=0.0; DL("ERR, readCoe(): bad NV azmCor"); }
48+
if (azmCor < -10 || azmCor > 10) { azmCor=0.0; DLF("ERR, readCoe(): bad NV azmCor"); }
4949
}
5050

5151
void TGeoAlign::writeCoe() {

AlignHor.ino

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,21 @@ void TGeoAlignH::init() {
3131
// remember the alignment between sessions
3232
void TGeoAlignH::readCoe() {
3333
ax1Cor=nv.readFloat(EE_ax1Cor);
34-
if (ax1Cor < -360 || ax1Cor > 360) { ax1Cor=0.0; DL("ERR, readCoe(): bad NV ax1Cor"); }
34+
if (ax1Cor < -360 || ax1Cor > 360) { ax1Cor=0.0; DLF("ERR, readCoe(): bad NV ax1Cor"); }
3535
ax2Cor=nv.readFloat(EE_ax2Cor);
36-
if (ax2Cor < -360 || ax2Cor > 360) { ax2Cor=0.0; DL("ERR, readCoe(): bad NV ax2Cor"); }
36+
if (ax2Cor < -360 || ax2Cor > 360) { ax2Cor=0.0; DLF("ERR, readCoe(): bad NV ax2Cor"); }
3737
dfCor=nv.readFloat(EE_dfCor); // dfCor is ffCor for fork mounts
38-
if (dfCor < -10 || dfCor > 10) { dfCor=0.0; DL("ERR, readCoe(): bad NV dfCor"); }
38+
if (dfCor < -10 || dfCor > 10) { dfCor=0.0; DLF("ERR, readCoe(): bad NV dfCor"); }
3939
tfCor=nv.readFloat(EE_tfCor);
40-
if (tfCor < -10 || tfCor > 10) { tfCor=0.0; DL("ERR, readCoe(): bad NV tfCor"); }
40+
if (tfCor < -10 || tfCor > 10) { tfCor=0.0; DLF("ERR, readCoe(): bad NV tfCor"); }
4141
doCor=nv.readFloat(EE_doCor);
42-
if (doCor < -10 || doCor > 10) { doCor=0.0; DL("ERR, readCoe(): bad NV doCor"); }
42+
if (doCor < -10 || doCor > 10) { doCor=0.0; DLF("ERR, readCoe(): bad NV doCor"); }
4343
pdCor=nv.readFloat(EE_pdCor);
44-
if (pdCor < -10 || pdCor > 10) { pdCor=0.0; DL("ERR, readCoe(): bad NV pdCor"); }
44+
if (pdCor < -10 || pdCor > 10) { pdCor=0.0; DLF("ERR, readCoe(): bad NV pdCor"); }
4545
altCor=nv.readFloat(EE_altCor);
46-
if (altCor < -10 || altCor > 10) { altCor=0.0; DL("ERR, readCoe(): bad NV altCor"); }
46+
if (altCor < -10 || altCor > 10) { altCor=0.0; DLF("ERR, readCoe(): bad NV altCor"); }
4747
azmCor=nv.readFloat(EE_azmCor);
48-
if (azmCor < -10 || azmCor > 10) { azmCor=0.0; DL("ERR, readCoe(): bad NV azmCor"); }
48+
if (azmCor < -10 || azmCor > 10) { azmCor=0.0; DLF("ERR, readCoe(): bad NV azmCor"); }
4949
}
5050

5151
void TGeoAlignH::writeCoe() {

Command.ino

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,11 +1018,11 @@ void processCommands() {
10181018
case 'F':
10191019
for (int x=0; x <= E2END+16; x++) {
10201020
if (x < 8 || x > E2END+8) {
1021-
if (x%8 == 0) D("-----------");
1022-
D("--");
1021+
if (x%8 == 0) DF("-----------");
1022+
DF("--");
10231023
if (x%8 == 7) DL();
10241024
} else {
1025-
if (x%8 == 0) { D(":SXFF,"); char s[8]; sprintf(s,"%04d=",x/8); D(s); }
1025+
if (x%8 == 0) { DF(":SXFF,"); char s[8]; sprintf(s,"%04d=",x/8); D(s); }
10261026
int v=nv.read(x-8);
10271027
if (v < 16) D(0); DebugSer.print(v,HEX);
10281028
if (x%8 == 7) DL("#");
@@ -2117,13 +2117,13 @@ void processCommands() {
21172117
if (command[1] >= '0' && command[1] <= '3' && parameter[0] == 0) {
21182118
currentSite=command[1]-'0'; nv.update(EE_currentSite,currentSite); booleanReply=false;
21192119
double f=nv.readFloat(EE_sites+currentSite*25+0);
2120-
if (f < -90 || f > 90) { f=0.0; DL("ERR, processCommands(): bad NV latitude"); }
2120+
if (f < -90 || f > 90) { f=0.0; DLF("ERR, processCommands(): bad NV latitude"); }
21212121
setLatitude(f);
21222122
longitude=nv.readFloat(EE_sites+currentSite*25+4);
2123-
if (longitude < -360 || longitude > 360) { longitude=0.0; DL("ERR, processCommands(): bad NV longitude"); }
2123+
if (longitude < -360 || longitude > 360) { longitude=0.0; DLF("ERR, processCommands(): bad NV longitude"); }
21242124
timeZone=nv.read(EE_sites+currentSite*25+8)-128;
21252125
timeZone=decodeTimeZone(timeZone);
2126-
if (timeZone < -12 || timeZone > 14) { timeZone=0.0; DL("ERR, processCommands(): bad NV timeZone"); }
2126+
if (timeZone < -12 || timeZone > 14) { timeZone=0.0; DLF("ERR, processCommands(): bad NV timeZone"); }
21272127
updateLST(jd2last(JD,UT1,false));
21282128
} else
21292129
if (command[1] == '?') {
@@ -2229,7 +2229,12 @@ void decMinLimit() {
22292229
if (trackingState == TrackingMoveTo) { if (!abortSlew) abortSlew=StartAbortSlew; trackingState = TrackingNone; } else {
22302230
if (getInstrPierSide() == PierSideWest && guideDirAxis2 == 'n' ) guideDirAxis2='b'; else
22312231
if (getInstrPierSide() == PierSideEast && guideDirAxis2 == 's' ) guideDirAxis2='b'; else
2232-
if (guideDirAxis2 == 0 && generalError != ERR_DEC) trackingState = TrackingNone;
2232+
if (guideDirAxis2 == 0 && generalError != ERR_DEC) {
2233+
if (trackingState != TrackingNone) {
2234+
trackingState=TrackingNone;
2235+
DLF("WRN, decMinLimit(): Limit exceeded tracking/slewing stopped");
2236+
}
2237+
}
22332238
}
22342239
}
22352240

@@ -2238,7 +2243,12 @@ void decMaxLimit() {
22382243
if (trackingState == TrackingMoveTo) { if (!abortSlew) abortSlew=StartAbortSlew; trackingState = TrackingNone; } else {
22392244
if (getInstrPierSide() == PierSideWest && guideDirAxis2 == 's' ) guideDirAxis2='b'; else
22402245
if (getInstrPierSide() == PierSideEast && guideDirAxis2 == 'n' ) guideDirAxis2='b'; else
2241-
if (guideDirAxis2 == 0 && generalError != ERR_DEC) trackingState = TrackingNone;
2246+
if (guideDirAxis2 == 0 && generalError != ERR_DEC) {
2247+
if (trackingState != TrackingNone) {
2248+
trackingState=TrackingNone;
2249+
DLF("WRN, decMaxLimit(): Limit exceeded tracking/slewing stopped");
2250+
}
2251+
}
22422252
}
22432253
}
22442254

@@ -2247,15 +2257,24 @@ void stopLimit() {
22472257
if (trackingState == TrackingMoveTo) {
22482258
if (!abortSlew) abortSlew=StartAbortSlew;
22492259
} else {
2250-
trackingState=TrackingNone;
2251-
if (spiralGuide) stopGuideSpiral();
2260+
if (spiralGuide) stopGuideSpiral(); else {
2261+
if (trackingState != TrackingNone) {
2262+
trackingState=TrackingNone;
2263+
DLF("WRN, stopLimit(): Limit exceeded tracking/goto stopped");
2264+
}
2265+
}
22522266
}
22532267
}
22542268

22552269
// stops all motion including guiding
22562270
void hardLimit() {
22572271
stopSlewing();
2258-
if (trackingState != TrackingMoveTo) trackingState=TrackingNone;
2272+
if (trackingState != TrackingMoveTo) {
2273+
if (trackingState != TrackingNone) {
2274+
trackingState=TrackingNone;
2275+
DLF("WRN, hardLimit(): Limit exceeded tracking/slewing stopped");
2276+
}
2277+
}
22592278
}
22602279

22612280
// calculate the checksum and add to string

Goto.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ CommandErrors goTo(double thisTargetAxis1, double thisTargetAxis2, double altTar
389389

390390
axis1DriverGotoMode();
391391
axis2DriverGotoMode();
392-
392+
393+
VLF("MSG: Goto started");
393394
return CE_NONE;
394395
}

Home.ino

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -31,27 +31,30 @@ void checkHome() {
3131
if (findHomeMode == FH_DONE && guideDirAxis1 == 0 && guideDirAxis2 == 0) {
3232
findHomeMode=FH_OFF;
3333

34-
#if AXIS2_TANGENT_ARM == ON
35-
trackingState=abortTrackingState;
36-
cli();
37-
targetAxis2.part.m = 0; targetAxis2.part.f = 0;
38-
posAxis2 = 0;
39-
sei();
40-
#else
41-
// at the polar home position
42-
InitStartPosition();
43-
atHome=true;
44-
#endif
34+
VLF("MSG: Homing done");
35+
#if AXIS2_TANGENT_ARM == ON
36+
trackingState=abortTrackingState;
37+
cli();
38+
targetAxis2.part.m = 0; targetAxis2.part.f = 0;
39+
posAxis2 = 0;
40+
sei();
41+
#else
42+
// at the polar home position
43+
InitStartPosition();
44+
atHome=true;
45+
#endif
4546
}
4647
}
4748

4849
void StopAxis1() {
4950
guideDirAxis1='b';
51+
VLF("MSG: Homing limit detected, stopping guide on Axis1");
5052
if (guideDirAxis2 != 'n' && guideDirAxis2 != 's') { if (findHomeMode == FH_SLOW) findHomeMode=FH_DONE; if (findHomeMode == FH_FAST) findHomeMode=FH_IDLE; }
5153
}
5254

5355
void StopAxis2() {
5456
guideDirAxis2='b';
57+
VLF("MSG: Homing limit detected, stopping guide on Axis2");
5558
if (guideDirAxis1 != 'e' && guideDirAxis1 != 'w') { if (findHomeMode == FH_SLOW) findHomeMode=FH_DONE; if (findHomeMode == FH_FAST) findHomeMode=FH_IDLE; }
5659
}
5760
#endif
@@ -82,11 +85,11 @@ CommandErrors goHome(boolean fast) {
8285

8386
// start guides
8487
if (fast) {
88+
#if AXIS2_TANGENT_ARM != ON
89+
// make sure tracking is disabled
90+
trackingState=TrackingNone;
91+
#endif
8592

86-
#if AXIS2_TANGENT_ARM != ON
87-
// make sure tracking is disabled
88-
trackingState=TrackingNone;
89-
#endif
9093
// make sure motors are powered on
9194
enableStepperDrivers();
9295

@@ -95,19 +98,21 @@ CommandErrors goHome(boolean fast) {
9598
findHomeTimeout=millis()+(unsigned long)(secPerDeg*180.0*1000.0);
9699

97100
// 8=HalfMaxRate
98-
#if AXIS2_TANGENT_ARM != ON
99-
e=startGuideAxis1(a1,8,0);
100-
#endif
101-
if (e == CE_NONE) e=startGuideAxis2(a2,8,0,true);
101+
#if AXIS2_TANGENT_ARM != ON
102+
e=startGuideAxis1(a1,8,0);
103+
#endif
104+
105+
if (e == CE_NONE) { VLF("MSG: Homing started phase 1"); e=startGuideAxis2(a2,8,0,true); } else { stopGuideAxis1(); VLF("MSG: Homing failed"); }
102106
} else {
103107
findHomeMode=FH_SLOW;
104108
findHomeTimeout=millis()+30000UL;
105109

106110
// 7=48x sidereal
107-
#if AXIS2_TANGENT_ARM != ON
108-
e=startGuideAxis1(a1,7,0);
109-
#endif
110-
if (e == CE_NONE) e=startGuideAxis2(a2,7,0,true);
111+
#if AXIS2_TANGENT_ARM != ON
112+
e=startGuideAxis1(a1,7,0);
113+
#endif
114+
115+
if (e == CE_NONE) { e=startGuideAxis2(a2,7,0,true); VLF("MSG: Homing started phase 2"); } else { stopGuideAxis1(); VLF("MSG: Homing failed"); }
111116
}
112117
if (e != CE_NONE) stopSlewing();
113118
return e;
@@ -127,7 +132,7 @@ CommandErrors goHome(boolean fast) {
127132
e=goTo(homePositionAxis1,homePositionAxis2,homePositionAxis1,homePositionAxis2,PierSideEast);
128133
#endif
129134

130-
if (e == CE_NONE) homeMount=true; else trackingState=abortTrackingState;
135+
if (e == CE_NONE) { VLF("MSG: Homing started"); homeMount=true; } else { VLF("MSG: Homing failed"); trackingState=abortTrackingState; }
131136
return e;
132137
#endif
133138
}
@@ -161,13 +166,13 @@ CommandErrors setHome() {
161166

162167
// reset PEC, unless we have an index to recover from this
163168
pecRecorded=nv.read(EE_pecRecorded);
164-
if (pecRecorded != true && pecRecorded != false) { pecRecorded=false; DL("ERR, setHome(): bad NV pecRecorded"); }
169+
if (pecRecorded != true && pecRecorded != false) { pecRecorded=false; DLF("ERR, setHome(): bad NV pecRecorded"); }
165170
#if PEC_SENSE == OFF
166171
pecStatus=IgnorePEC;
167172
nv.write(EE_pecStatus,pecStatus);
168173
#else
169174
pecStatus=nv.read(EE_pecStatus);
170-
if (pecStatus < PEC_STATUS_FIRST || pecStatus > PEC_STATUS_LAST) { pecStatus=IgnorePEC; DL("ERR, setHome(): bad NV pecStatus"); }
175+
if (pecStatus < PEC_STATUS_FIRST || pecStatus > PEC_STATUS_LAST) { pecStatus=IgnorePEC; DLF("ERR, setHome(): bad NV pecStatus"); }
171176
#endif
172177
if (!pecRecorded) pecStatus=IgnorePEC;
173178

0 commit comments

Comments
 (0)