Skip to content

Commit fe77cdd

Browse files
V1.7.08 - Updates
- Added support for Meade command :Rx# to set slew rates. - Switched some #defines over to numerical values, so they don't need to be commented out. - Overhauled the debug output to use bits to indicate subsystems to spew debug output for.
1 parent b78c2d2 commit fe77cdd

16 files changed

+232
-160
lines changed

Software/Arduino code/OpenAstroTracker/DayTime.cpp

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

229229
void DegreeTime::checkHours() {
230230
if (hours > 0) {
231-
#ifdef DEBUG_MODE
231+
#if DEBUG_LEVEL&DEBUG_GENERAL
232232
logv("CheckHours: Degrees is more than 0, clamping");
233233
#endif
234234
hours = 0;
235235
}
236236
if (hours < -180) {
237-
#ifdef DEBUG_MODE
237+
#if DEBUG_LEVEL&DEBUG_GENERAL
238238
logv("CheckHours: Degrees is less than -180, clamping");
239239
#endif
240240
hours = -180;

Software/Arduino code/OpenAstroTracker/Globals.hpp

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,40 @@ extern String version;
2222
extern byte PolarisRAHour;
2323
extern byte PolarisRAMinute;
2424
extern byte PolarisRASecond;
25-
// Comment this out to save some code space
26-
// #define DEBUG_MODE
27-
#ifdef DEBUG_MODE
28-
// #define SEND_PERIODIC_UPDATES
29-
#endif
30-
// Uncomment to run a key diagnostic. No tracker functions are on at all.
31-
// #define LCD_BUTTON_TEST
32-
33-
// Uncomment to reverse the direction of RA motor
34-
// #define INVERT_RA_DIR
3525

36-
// Uncomment to reverse the direction of DEC motor
37-
// #define INVERT_DEC_DIR
26+
// Debugging output control
27+
// Each bit in the debug level specifies a kind of debug to enable.
28+
#define DEBUG_NONE 0x00
29+
#define DEBUG_INFO 0x01
30+
#define DEBUG_SERIAL 0x02
31+
#define DEBUG_WIFI 0x04
32+
#define DEBUG_MOUNT 0x08
33+
#define DEBUG_MOUNT_VERBOSE 0x10
34+
#define DEBUG_GENERAL 0x20
35+
36+
// Bit Name Output
37+
// 0 DEBUG_INFO General output, like startup variables and status
38+
// 1 DEBUG_SERIAL Serial commands and replies
39+
// 2 DEBUG_WIFI Wifi related output
40+
// 3 DEBUG_MOUNT Mount processing output
41+
// 4 DEBUG_MOUNT_VERBOSE Verbose mount processing (coordinates, etc)
42+
// 5 DEBUG_GENERAL Other misc. output
43+
44+
// Set this to specify the amount of debug output OAT should send to the serial port.
45+
// Note that if you use an app to control OAT, ANY debug output will likely confuse that app.
46+
// Debug output is useful if you are using Wifi to control the OAT or if you are issuing
47+
// manual commands via a terminal.
48+
// #define DEBUG_LEVEL (DEBUG_SERIAL|DEBUG_WIFI|DEBUG_INFO|DEBUG_MOUNT)
49+
#define DEBUG_LEVEL (DEBUG_NONE)
50+
51+
// Set this to 1 to run a key diagnostic. No tracker functions are on at all.
52+
#define LCD_BUTTON_TEST 0
53+
54+
// Set to 1 to reverse the direction of RA motor
55+
#define INVERT_RA_DIR 0
56+
57+
// Set to 1 to reverse the direction of DEC motor
58+
#define INVERT_DEC_DIR 0
3859

3960
////////////////////////////////////////////////////////////////
4061
//
@@ -64,10 +85,10 @@ extern byte PolarisRASecond;
6485
#define ESPBOARD
6586
#define HEADLESS_CLIENT
6687
#define WIFI_ENABLED
67-
#define INFRA_SSID "yourSSID"
68-
#define INFRA_WPAKEY "yourWPAKey"
88+
#define INFRA_SSID "Clutchplate"
89+
#define INFRA_WPAKEY "36FA8A7748"
6990
#define OAT_WPAKEY "superSecret"
70-
#define HOSTNAME "OATerScope"
91+
#define HOSTNAME "OATScope"
7192
// 0 - Infrastructure Only - Connecting to a Router
7293
// 1 - AP Mode Only - Acting as a Router
7394
// 2 - Attempt Infrastructure, Fail over to AP Mode.

Software/Arduino code/OpenAstroTracker/InterruptCallback.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,26 +87,26 @@ bool InterruptCallback::setInterval(float intervalMs, interrupt_callback_p callb
8787
timerAlarmWrite(_timer, (uint64_t)(intervalMs * 1000.0f), true);
8888
timerAlarmEnable(_timer);
8989
90-
#ifdef DEBUG_MODE
90+
#if DEBUG_LEVEL&DEBUG_INFO
9191
Serial.println("Setup ESP32 Timer");
92-
#endif // DEBUG_MODE
92+
#endif
9393
9494
return true;
9595
}
9696
9797
void InterruptCallback::stop(){
98-
#ifdef DEBUG_MODE
98+
#if DEBUG_LEVEL&DEBUG_INFO
9999
Serial.println("Stop ESP32 Timer");
100-
#endif // DEBUG_MODE
100+
#endif
101101
if (timerAlarmEnabled(_timer)) {
102102
timerAlarmDisable(_timer);
103103
}
104104
}
105105
106106
void InterruptCallback::start(){
107-
#ifdef DEBUG_MODE
107+
#if DEBUG_LEVEL&DEBUG_INFO
108108
Serial.println("Start ESP32 Timer");
109-
#endif // DEBUG_MODE
109+
#endif
110110
if (!timerAlarmEnabled(_timer)){
111111
timerAlarmEnable(_timer);
112112
}

Software/Arduino code/OpenAstroTracker/MeadeCommandProcessor.cpp

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +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-
#ifdef DEBUG_MODE
477+
#if DEBUG_LEVEL&DEBUG_MEADE
478478
logv("MeadeSetInfo: Received Target DEC: %s", _mount->targetDEC().ToString());
479479
#endif
480480
return "1";
@@ -492,7 +492,7 @@ String MeadeCommandProcessor::handleMeadeSetInfo(String inCmd) {
492492
if ((inCmd[3] == ':') && (inCmd[6] == ':'))
493493
{
494494
_mount->targetRA().set(inCmd.substring(1, 3).toInt(), inCmd.substring(4, 6).toInt(), inCmd.substring(7, 9).toInt());
495-
#ifdef DEBUG_MODE
495+
#if DEBUG_LEVEL&DEBUG_MEADE
496496
logv("MeadeSetInfo: Received Target RA: %s", _mount->targetRA().ToString());
497497
#endif
498498
return "1";
@@ -513,7 +513,7 @@ String MeadeCommandProcessor::handleMeadeSetInfo(String inCmd) {
513513
}
514514

515515
DayTime lst(hLST, minLST, secLST);
516-
#ifdef DEBUG_MODE
516+
#if DEBUG_LEVEL&DEBUG_MEADE
517517
logv("MeadeSetInfo: Received LST: %d:%d:%d", hLST, minLST, secLST);
518518
#endif
519519
_mount->setLST(lst);
@@ -527,7 +527,7 @@ String MeadeCommandProcessor::handleMeadeSetInfo(String inCmd) {
527527
// Set HA
528528
int hHA = inCmd.substring(1, 3).toInt();
529529
int minHA = inCmd.substring(4, 6).toInt();
530-
#ifdef DEBUG_MODE
530+
#if DEBUG_LEVEL&DEBUG_MEADE
531531
logv("MeadeSetInfo: Received HA: %d:%d:%d", hHA, minHA, 0);
532532
#endif
533533
_mount->setHA(DayTime(hHA, minHA, 0));
@@ -794,11 +794,11 @@ String MeadeCommandProcessor::handleMeadeQuit(String inCmd) {
794794
// Set Slew Rates
795795
/////////////////////////////
796796
String MeadeCommandProcessor::handleMeadeSetSlewRate(String inCmd) {
797-
switch (inCmd[1]) {
798-
case 'S': // Slew - Fastest
799-
case 'M': // Find - 2nd Fastest
800-
case 'C': // Center - 2nd Slowest
801-
case 'G': // Guide - Slowest
797+
switch (inCmd[0]) {
798+
case 'S': _mount->setSlewRate(4); break; // Slew - Fastest
799+
case 'M': _mount->setSlewRate(3); break; // Find - 2nd Fastest
800+
case 'C': _mount->setSlewRate(2); break; // Center - 2nd Slowest
801+
case 'G': _mount->setSlewRate(1); break; // Guide - Slowest
802802
default:
803803
break;
804804
}
@@ -807,6 +807,9 @@ String MeadeCommandProcessor::handleMeadeSetSlewRate(String inCmd) {
807807

808808
String MeadeCommandProcessor::processCommand(String inCmd) {
809809
if (inCmd[0] == ':') {
810+
#if DEBUG_LEVEL&DEBUG_MEADE
811+
logv("MEADE: Received command '%s'", inCmd.c_str());
812+
#endif
810813
char command = inCmd[1];
811814
inCmd = inCmd.substring(2);
812815
switch (command) {
@@ -820,7 +823,8 @@ String MeadeCommandProcessor::processCommand(String inCmd) {
820823
case 'R': return handleMeadeSetSlewRate(inCmd);
821824
case 'X': return handleMeadeExtraCommands(inCmd);
822825
default:
823-
#ifdef DEBUG_MODE
826+
#if DEBUG_LEVEL&DEBUG_MEADE
827+
logv("MEADE: Received unknown command '%s'", inCmd.c_str());
824828
Serial.println("Unknown Command in MeadeCommandProcessor::processCommand " + inCmd);
825829
return "";
826830
#endif

0 commit comments

Comments
 (0)