Skip to content

Commit adf283b

Browse files
V1.7.11 - Updates
- Changed all #defines and #ifdefs to use use numbers and #if statements. Makes it easier to see what to configure instead of everything looking like comments.
1 parent 2aec8fa commit adf283b

21 files changed

+105
-99
lines changed

Software/Arduino code/OpenAstroTracker/Globals.hpp

Lines changed: 48 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -57,33 +57,17 @@ extern byte PolarisRASecond;
5757
// Set to 1 to reverse the direction of DEC motor
5858
#define INVERT_DEC_DIR 0
5959

60-
////////////////////////////////////////////////////////////////
61-
//
62-
// FEATURE SUPPORT SECTION
63-
//
64-
// Since the Arduino Uno has very little memory (32KB code, 2KB data) all features
65-
// stretch the Uno a little too far. So in order to save memory we allow you to enable
66-
// and disable features to help manage memory usage.
67-
// If you run the tracker with an Arduino Mega, you can uncomment all the features.
68-
//
69-
// If you would like to drive your OAT mount with only the LCD Shield,
70-
// you should comment out SUPPORT_SERIAL_CONTROL
71-
//
72-
// If you feel comfortable with configuring the OAT at startup manually, you should comment
73-
// out SUPPORT_GUIDED_STARTUP (maybe after you've used it for a while you know what to do).
74-
//
75-
// The POI menu can take a little data memory and you may not need it. If not, you can comment
76-
// out SUPPORT_POINTS_OF_INTEREST
77-
//
78-
////////////////////////////////////////////////////////////////
79-
80-
// If you do not have a LCD shield on your Arduino Uno, uncomment the line below. This is
60+
// If you do not have a LCD shield on your Arduino Uno, set this to 1 on the line below. This is
8161
// useful if you are always going to run the mount from a laptop anyway.
82-
// #define HEADLESS_CLIENT
62+
#define HEADLESS_CLIENT 0
63+
64+
// This is set to 1 for boards that do not support interrupt timers
65+
#define RUN_STEPPERS_IN_MAIN_LOOP 0
8366

8467
#if defined(ESP8266) || defined(ESP32)
8568
#define ESPBOARD
86-
#define HEADLESS_CLIENT
69+
#undef HEADLESS_CLIENT
70+
#define HEADLESS_CLIENT 1
8771
#define WIFI_ENABLED
8872
#define INFRA_SSID "yourSSID"
8973
#define INFRA_WPAKEY "yourWPAkey"
@@ -94,39 +78,60 @@ extern byte PolarisRASecond;
9478
// 2 - Attempt Infrastructure, Fail over to AP Mode.
9579
#define WIFI_MODE 2
9680
#if defined(ESP8266)
97-
#define RUN_STEPPERS_IN_MAIN_LOOP
81+
#undef RUN_STEPPERS_IN_MAIN_LOOP
82+
#define RUN_STEPPERS_IN_MAIN_LOOP 1
9883
#endif
9984
#endif
10085

10186

102-
// Uncomment this to enable the heating menu
87+
////////////////////////////////////////////////////////////////
88+
//
89+
// FEATURE SUPPORT SECTION
90+
//
91+
// Since the Arduino Uno has very little memory (32KB code, 2KB data) all features
92+
// stretch the Uno a little too far. So in order to save memory we allow you to enable
93+
// and disable features to help manage memory usage.
94+
// If you run the tracker with an Arduino Mega, you can set all the features to 1.
95+
//
96+
// If you would like to drive your OAT mount with only the LCD Shield, or are on a Uno,
97+
// you should set SUPPORT_SERIAL_CONTROL to 0
98+
//
99+
// If you feel comfortable with configuring the OAT at startup manually, you should set
100+
// SUPPORT_GUIDED_STARTUP to 0 (maybe after you've used it for a while you know what to do).
101+
//
102+
// The POI menu can take a little data memory and you may not need it. If not, you can set
103+
// SUPPORT_POINTS_OF_INTEREST to 0
104+
//
105+
////////////////////////////////////////////////////////////////
106+
107+
// Set this to 1 this to enable the heating menu
103108
// NOTE: Heating is currently not supported!
104-
// #define SUPPORT_HEATING
109+
#define SUPPORT_HEATING 0
105110

106-
#ifndef HEADLESS_CLIENT
111+
#if HEADLESS_CLIENT == 0
107112

108-
// Uncomment to support Guided Startup
109-
#define SUPPORT_GUIDED_STARTUP
113+
// Set this to 1 to support Guided Startup
114+
#define SUPPORT_GUIDED_STARTUP 1
110115

111-
// Uncomment to support full GO (was POI) menu.
112-
// If this is commented out you still have a GO menu that has Home and Park.
113-
#define SUPPORT_POINTS_OF_INTEREST
116+
// Set this to 1 to support full GO (was POI) menu.
117+
// If this is set to 0 you still have a GO menu that has Home and Park.
118+
#define SUPPORT_POINTS_OF_INTEREST 1
114119

115-
// Uncomment to support CTRL menu, allowing you to manually slew the mount with the buttons.
116-
#define SUPPORT_MANUAL_CONTROL
120+
// Set this to 1 to support CTRL menu, allowing you to manually slew the mount with the buttons.
121+
#define SUPPORT_MANUAL_CONTROL 1
117122

118-
// Uncomment to support CAL menu, allowing you to calibrate various things
119-
#define SUPPORT_CALIBRATION
123+
// Set this to 1 to support CAL menu, allowing you to calibrate various things
124+
#define SUPPORT_CALIBRATION 1
120125

121-
// Uncomment to support INFO menu that displays various pieces of information about the mount.
122-
#define SUPPORT_INFO_DISPLAY
126+
// Set this to 1 to support INFO menu that displays various pieces of information about the mount.
127+
#define SUPPORT_INFO_DISPLAY 1
123128

124-
// Uncomment to support Serial Meade LX200 protocol support
125-
#define SUPPORT_SERIAL_CONTROL
129+
// Set this to 1 to support Serial Meade LX200 protocol support
130+
#define SUPPORT_SERIAL_CONTROL 1
126131

127132
#else
128133
// If we are making a headleass (no screen, no keyboard) client, always enable Serial.
129-
#define SUPPORT_SERIAL_CONTROL
130-
#endif
134+
#define SUPPORT_SERIAL_CONTROL 1
135+
#endif // HEADLESS_CLIENT
131136

132-
#endif
137+
#endif // _GLOBALS_HPP

Software/Arduino code/OpenAstroTracker/LcdMenu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "Utility.hpp"
22
#include "LcdMenu.hpp"
33

4-
#ifndef HEADLESS_CLIENT
4+
#if HEADLESS_CLIENT == 0
55

66
// Class that drives the LCD screen with a menu
77
// You add a string and an id item and this class handles the display and navigation

Software/Arduino code/OpenAstroTracker/LcdMenu.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define _LCDMENU_HPP_
33

44
#include <Arduino.h>
5-
#ifndef HEADLESS_CLIENT
5+
#if HEADLESS_CLIENT == 0
66
#include <LiquidCrystal.h>
77
#endif
88
#include "Globals.hpp"
@@ -69,7 +69,7 @@ class LcdMenu {
6969
void printChar(char ch);
7070

7171
private:
72-
#ifndef HEADLESS_CLIENT
72+
#if HEADLESS_CLIENT == 0
7373
LiquidCrystal _lcd; // The LCD screen that we'll display the menu on
7474
MenuItem** _menuItems; // The first menu item (linked list)
7575
byte _numMenuItems;

Software/Arduino code/OpenAstroTracker/MeadeCommandProcessor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ MeadeCommandProcessor* MeadeCommandProcessor::instance() {
364364
MeadeCommandProcessor::MeadeCommandProcessor(Mount* mount, LcdMenu* lcdMenu) {
365365
_mount = mount;
366366

367-
// In HEADLESS_CLIENT, the lcdMenu is just an empty shell class to save having to null check everywhere
367+
// In HEADLESS_CLIENT mode, the lcdMenu is just an empty shell class to save having to null check everywhere
368368
_lcdMenu = lcdMenu;
369369
}
370370

Software/Arduino code/OpenAstroTracker/Mount.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ void Mount::readPersistentData()
127127
{
128128
// Read the magic marker byte and state
129129
int marker = EEPROM.read(4) + EEPROM.read(5) * 256;
130-
#ifdef DEBUG_MODE
130+
#if DEBUG_LEVEL&DEBUG_MOUNT_VERBOSE
131131
logv("EEPROM: Marker: %x ", marker);
132132
#endif
133133

@@ -218,7 +218,7 @@ void Mount::writePersistentData(int which, int val)
218218
break;
219219
}
220220

221-
#ifdef DEBUG_MODE
221+
#if DEBUG_LEVEL&DEBUG_MOUNT_VERBOSE
222222
logv("EEPROM Write: New Marker is 0xBE, flag is %x (%d)", flag, flag);
223223
#endif
224224

@@ -1196,7 +1196,7 @@ void Mount::loop() {
11961196

11971197
// Since some of the boards cannot process timer interrupts at the required
11981198
// speed (or at all), we'll just stick to deterministic calls here.
1199-
#ifdef RUN_STEPPERS_IN_MAIN_LOOP
1199+
#if RUN_STEPPERS_IN_MAIN_LOOP == 1
12001200
interruptLoop();
12011201
#endif
12021202

@@ -1533,7 +1533,7 @@ void Mount::moveSteppersTo(float targetRA, float targetDEC) {
15331533
//
15341534
/////////////////////////////////
15351535
void Mount::displayStepperPosition() {
1536-
#ifndef HEADLESS_CLIENT
1536+
#if HEADLESS_CLIENT == 0
15371537

15381538
String disp;
15391539

@@ -1563,7 +1563,7 @@ void Mount::displayStepperPosition() {
15631563
_lcdMenu->printMenu(String(scratchBuffer));
15641564
}
15651565
else {
1566-
#ifdef SUPPORT_SERIAL_CONTROL
1566+
#if SUPPORT_SERIAL_CONTROL == 1
15671567
if (inSerialControl) {
15681568
sprintf(scratchBuffer, " RA: %s", RAString(LCD_STRING | CURRENT_STRING).c_str());
15691569
_lcdMenu->setCursor(0, 0);
@@ -1592,7 +1592,7 @@ void Mount::displayStepperPosition() {
15921592
//
15931593
/////////////////////////////////
15941594
void Mount::displayStepperPositionThrottled() {
1595-
#ifndef HEADLESS_CLIENT
1595+
#if HEADLESS_CLIENT == 0
15961596
long elapsed = millis() - _lastDisplayUpdate;
15971597
if (elapsed > DISPLAY_UPDATE_TIME) {
15981598
displayStepperPosition();

Software/Arduino code/OpenAstroTracker/OpenAstroTracker.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
#include "Globals.hpp"
2020

21-
String version = "V1.7.10";
21+
String version = "V1.7.11";
2222

2323
///////////////////////////////////////////////////////////////////////////
2424
// Please see the Globals.h file for configuration of the firmware.

Software/Arduino code/OpenAstroTracker/OpenAstroTracker.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Configuration is now done in OpenAstroTracker.hpp and Globals.hpp
12
#include "OpenAstroTracker.hpp"
23
#include "a_inits.hpp"
34
#include "b_setup.hpp"

Software/Arduino code/OpenAstroTracker/a_inits.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@
179179
// How many menu items at most?
180180
#define MAXMENUITEMS 10
181181

182-
#ifdef SUPPORT_GUIDED_STARTUP
182+
#if SUPPORT_GUIDED_STARTUP == 1
183183
bool inStartup = true; // Start with a guided startup
184184
#else
185185
bool inStartup = false; // Start with a guided startup
@@ -204,7 +204,7 @@ int DECselect;
204204
// HA variables
205205
int HAselect;
206206

207-
#ifdef SUPPORT_HEATING
207+
#if SUPPORT_HEATING == 1
208208
// HEAT menu variables
209209
int heatselect; // Which stepper are we changing?
210210
int RAheat = 0; // Are we heating the RA stepper?

Software/Arduino code/OpenAstroTracker/b_setup.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void finishSetup()
133133
lcdMenu.printMenu("OpenAstroTracker");
134134
lcdMenu.setCursor(0, 1);
135135
lcdMenu.printMenu(" " + version);
136-
#ifndef HEADLESS_CLIENT
136+
#if HEADLESS_CLIENT == 0
137137
unsigned long now = millis();
138138
#endif
139139
// Create the command processor singleton
@@ -181,32 +181,32 @@ void finishSetup()
181181
// Start the tracker.
182182
mount.startSlewing(TRACKING);
183183

184-
#ifndef HEADLESS_CLIENT
184+
#if HEADLESS_CLIENT == 0
185185
// Create the LCD top-level menu items
186186
lcdMenu.addItem("RA", RA_Menu);
187187
lcdMenu.addItem("DEC", DEC_Menu);
188188

189-
#ifdef SUPPORT_POINTS_OF_INTEREST
189+
#if SUPPORT_POINTS_OF_INTEREST == 1
190190
lcdMenu.addItem("GO", POI_Menu);
191191
#else
192192
lcdMenu.addItem("GO", Home_Menu);
193193
#endif
194194

195195
lcdMenu.addItem("HA", HA_Menu);
196196

197-
#ifdef SUPPORT_HEATING
197+
#if SUPPORT_HEATING == 1
198198
lcdMenu.addItem("HEA", Heat_Menu);
199199
#endif
200200

201-
#ifdef SUPPORT_MANUAL_CONTROL
201+
#if SUPPORT_MANUAL_CONTROL == 1
202202
lcdMenu.addItem("CTRL", Control_Menu);
203203
#endif
204204

205-
#ifdef SUPPORT_CALIBRATION
205+
#if SUPPORT_CALIBRATION == 1
206206
lcdMenu.addItem("CAL", Calibration_Menu);
207207
#endif
208208

209-
#ifdef SUPPORT_INFO_DISPLAY
209+
#if SUPPORT_INFO_DISPLAY == 1
210210
lcdMenu.addItem("INFO", Status_Menu);
211211
#endif
212212

Software/Arduino code/OpenAstroTracker/c65_startup.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22

3-
#ifndef HEADLESS_CLIENT
4-
#ifdef SUPPORT_GUIDED_STARTUP
3+
#if HEADLESS_CLIENT == 0
4+
#if SUPPORT_GUIDED_STARTUP == 1
55
//////////////////////////////////////////////////////////////
66
// This file contains the Starup 'wizard' that guides you through initial setup
77

0 commit comments

Comments
 (0)