Skip to content

Commit 9e07451

Browse files
V1.7.12 - Updates
- Converted all logv() calls to LOGVn() calls that compile out, but don't need to enclosed in #if..#endif statements - Fixed a bug introduced in 1.7.11 that prevented normal functioning of the OAT steppers.
1 parent adf283b commit 9e07451

File tree

13 files changed

+158
-300
lines changed

13 files changed

+158
-300
lines changed

Software/Arduino code/OpenAstroTracker/DayTime.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,16 +228,12 @@ float DegreeTime::getTotalDegrees() const {
228228

229229
void DegreeTime::checkHours() {
230230
if (hours > 0) {
231-
#if DEBUG_LEVEL&DEBUG_GENERAL
232-
logv("CheckHours: Degrees is more than 0, clamping");
233-
#endif
231+
LOGV1(DEBUG_GENERAL, "CheckHours: Degrees is more than 0, clamping");
234232
hours = 0;
235233
}
236234
if (hours < -180) {
237-
#if DEBUG_LEVEL&DEBUG_GENERAL
238-
logv("CheckHours: Degrees is less than -180, clamping");
239-
#endif
240-
hours = -180;
235+
LOGV1(DEBUG_GENERAL, "CheckHours: Degrees is less than -180, clamping");
236+
hours = -180;
241237
}
242238
}
243239

Software/Arduino code/OpenAstroTracker/Globals.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ extern byte PolarisRASecond;
3232
#define DEBUG_MOUNT 0x08
3333
#define DEBUG_MOUNT_VERBOSE 0x10
3434
#define DEBUG_GENERAL 0x20
35+
#define DEBUG_MEADE 0x40
36+
#define DEBUG_ANY 0x7F
3537

3638
// Bit Name Output
3739
// 0 DEBUG_INFO General output, like startup variables and status
@@ -40,12 +42,14 @@ extern byte PolarisRASecond;
4042
// 3 DEBUG_MOUNT Mount processing output
4143
// 4 DEBUG_MOUNT_VERBOSE Verbose mount processing (coordinates, etc)
4244
// 5 DEBUG_GENERAL Other misc. output
45+
// 6 DEBUG_MEADE Meade command handling output
4346

4447
// Set this to specify the amount of debug output OAT should send to the serial port.
4548
// Note that if you use an app to control OAT, ANY debug output will likely confuse that app.
4649
// Debug output is useful if you are using Wifi to control the OAT or if you are issuing
4750
// manual commands via a terminal.
48-
// #define DEBUG_LEVEL (DEBUG_SERIAL|DEBUG_WIFI|DEBUG_INFO|DEBUG_MOUNT)
51+
// #define DEBUG_LEVEL (DEBUG_SERIAL|DEBUG_WIFI|DEBUG_INFO|DEBUG_MOUNT|DEBUG_GENERAL)
52+
// #define DEBUG_LEVEL (DEBUG_ANY)
4953
#define DEBUG_LEVEL (DEBUG_NONE)
5054

5155
// Set this to 1 to run a key diagnostic. No tracker functions are on at all.

Software/Arduino code/OpenAstroTracker/InterruptCallback.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,26 +87,20 @@ bool InterruptCallback::setInterval(float intervalMs, interrupt_callback_p callb
8787
timerAlarmWrite(_timer, (uint64_t)(intervalMs * 1000.0f), true);
8888
timerAlarmEnable(_timer);
8989
90-
#if DEBUG_LEVEL&DEBUG_INFO
91-
Serial.println("Setup ESP32 Timer");
92-
#endif
90+
LOGV1(DEBUG_INFO, "Setup ESP32 Timer");
9391
9492
return true;
9593
}
9694
9795
void InterruptCallback::stop(){
98-
#if DEBUG_LEVEL&DEBUG_INFO
99-
Serial.println("Stop ESP32 Timer");
100-
#endif
96+
LOGV1(DEBUG_INFO, "Stop ESP32 Timer");
10197
if (timerAlarmEnabled(_timer)) {
10298
timerAlarmDisable(_timer);
10399
}
104100
}
105101
106102
void InterruptCallback::start(){
107-
#if DEBUG_LEVEL&DEBUG_INFO
108-
Serial.println("Start ESP32 Timer");
109-
#endif
103+
LOGV1(DEBUG_INFO, "Start ESP32 Timer");
110104
if (!timerAlarmEnabled(_timer)){
111105
timerAlarmEnable(_timer);
112106
}

Software/Arduino code/OpenAstroTracker/MeadeCommandProcessor.cpp

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -474,9 +474,7 @@ String MeadeCommandProcessor::handleMeadeSetInfo(String inCmd) {
474474
deg = -90 - deg;
475475
}
476476
_mount->targetDEC().set(deg, inCmd.substring(5, 7).toInt(), inCmd.substring(8, 10).toInt());
477-
#if DEBUG_LEVEL&DEBUG_MEADE
478-
logv("MeadeSetInfo: Received Target DEC: %s", _mount->targetDEC().ToString());
479-
#endif
477+
LOGV2(DEBUG_MEADE, "MEADE: SetInfo: Received Target DEC: %s", _mount->targetDEC().ToString());
480478
return "1";
481479
}
482480
else {
@@ -492,9 +490,7 @@ String MeadeCommandProcessor::handleMeadeSetInfo(String inCmd) {
492490
if ((inCmd[3] == ':') && (inCmd[6] == ':'))
493491
{
494492
_mount->targetRA().set(inCmd.substring(1, 3).toInt(), inCmd.substring(4, 6).toInt(), inCmd.substring(7, 9).toInt());
495-
#if DEBUG_LEVEL&DEBUG_MEADE
496-
logv("MeadeSetInfo: Received Target RA: %s", _mount->targetRA().ToString());
497-
#endif
493+
LOGV2(DEBUG_MEADE, "MEADE: SetInfo: Received Target RA: %s", _mount->targetRA().ToString());
498494
return "1";
499495
}
500496
else {
@@ -513,9 +509,7 @@ String MeadeCommandProcessor::handleMeadeSetInfo(String inCmd) {
513509
}
514510

515511
DayTime lst(hLST, minLST, secLST);
516-
#if DEBUG_LEVEL&DEBUG_MEADE
517-
logv("MeadeSetInfo: Received LST: %d:%d:%d", hLST, minLST, secLST);
518-
#endif
512+
LOGV4(DEBUG_MEADE, "MEADE: SetInfo: Received LST: %d:%d:%d", hLST, minLST, secLST);
519513
_mount->setLST(lst);
520514
}
521515
else if (inCmd[1] == 'P') {
@@ -527,9 +521,7 @@ String MeadeCommandProcessor::handleMeadeSetInfo(String inCmd) {
527521
// Set HA
528522
int hHA = inCmd.substring(1, 3).toInt();
529523
int minHA = inCmd.substring(4, 6).toInt();
530-
#if DEBUG_LEVEL&DEBUG_MEADE
531-
logv("MeadeSetInfo: Received HA: %d:%d:%d", hHA, minHA, 0);
532-
#endif
524+
LOGV4(DEBUG_MEADE, "MEADE: SetInfo: Received HA: %d:%d:%d", hHA, minHA, 0);
533525
_mount->setHA(DayTime(hHA, minHA, 0));
534526
}
535527

@@ -807,9 +799,7 @@ String MeadeCommandProcessor::handleMeadeSetSlewRate(String inCmd) {
807799

808800
String MeadeCommandProcessor::processCommand(String inCmd) {
809801
if (inCmd[0] == ':') {
810-
#if DEBUG_LEVEL&DEBUG_MEADE
811-
logv("MEADE: Received command '%s'", inCmd.c_str());
812-
#endif
802+
LOGV2(DEBUG_MEADE, "MEADE: Received command '%s'", inCmd.c_str());
813803
char command = inCmd[1];
814804
inCmd = inCmd.substring(2);
815805
switch (command) {
@@ -823,11 +813,7 @@ String MeadeCommandProcessor::processCommand(String inCmd) {
823813
case 'R': return handleMeadeSetSlewRate(inCmd);
824814
case 'X': return handleMeadeExtraCommands(inCmd);
825815
default:
826-
#if DEBUG_LEVEL&DEBUG_MEADE
827-
logv("MEADE: Received unknown command '%s'", inCmd.c_str());
828-
Serial.println("Unknown Command in MeadeCommandProcessor::processCommand " + inCmd);
829-
return "";
830-
#endif
816+
LOGV2(DEBUG_MEADE, "MEADE: Received unknown command '%s'", inCmd.c_str());
831817
break;
832818
}
833819
}

0 commit comments

Comments
 (0)