Skip to content

Commit 48545b8

Browse files
V1.6.27 - Updates
- Added a directive to compile a headless client. This removes support for the shield (LCD and keyboard). - Added the Meade commands to support target-less slew in Serial.
1 parent 395e659 commit 48545b8

18 files changed

+105
-143
lines changed

Software/Arduino code/OpenAstroTracker/Globals.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,16 @@ extern bool inSerialControl;
3838
//
3939
////////////////////////////////////////////////////////////////
4040

41+
// If you do not have a LCD shield on your Arduino Uno, uncomment the line below. This is
42+
// useful if you are always going to run the mount from a laptop anyway.
43+
// #define HEADLESS_CLIENT
44+
4145
// Uncomment this to enable the heating menu
4246
// NOTE: Heating is currently not supported!
4347
// #define SUPPORT_HEATING
4448

4549
// Uncomment to support Guided Startup
46-
//#define SUPPORT_GUIDED_STARTUP
50+
#define SUPPORT_GUIDED_STARTUP
4751

4852
// Uncomment to support full GO (was POI) menu.
4953
// If this is commented out you still have a GO menu that has Home and Park.
@@ -53,9 +57,15 @@ extern bool inSerialControl;
5357
#define SUPPORT_MANUAL_CONTROL
5458

5559
// Uncomment to support INFO menu that displays various pieces of information about the mount.
56-
//#define SUPPORT_INFO_DISPLAY
60+
#define SUPPORT_INFO_DISPLAY
5761

5862
// Uncomment to support Serial Meade LX200 protocol support
63+
// #define SUPPORT_SERIAL_CONTROL
64+
65+
66+
// If we are making a headleass (no screen, no keyboard) client, always enable Serial.
67+
#ifdef HEADLESS_CLIENT
5968
#define SUPPORT_SERIAL_CONTROL
69+
#endif
6070

6171
#endif

Software/Arduino code/OpenAstroTracker/LcdMenu.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#include "Utility.h"
22
#include "LcdMenu.hpp"
33

4+
#ifndef HEADLESS_CLIENT
5+
46
// Class that drives the LCD screen with a menu
57
// You add a string and an id item and this class handles the display and navigation
68
// Create a new menu, using the given number of LCD display columns and rows
@@ -235,3 +237,33 @@ byte LcdMenu::MinutesBitmap[8] = {
235237
B00000,
236238
B00000
237239
};
240+
#else
241+
242+
LcdMenu::LcdMenu(byte cols, byte rows, int maxItems) {
243+
}
244+
245+
MenuItem* LcdMenu::findById(byte id) {
246+
return NULL;
247+
}
248+
249+
void LcdMenu::addItem(const char *disp, byte id) {}
250+
251+
byte LcdMenu::getActive() {
252+
return 0;
253+
}
254+
255+
void LcdMenu::setActive(byte id) {}
256+
257+
void LcdMenu::setCursor(byte col, byte row) {}
258+
259+
void LcdMenu::clear() {}
260+
261+
void LcdMenu::setNextActive() {}
262+
263+
void LcdMenu::updateDisplay() {}
264+
265+
void LcdMenu::printMenu(String line) {}
266+
267+
void LcdMenu::printChar(char ch) {}
268+
269+
#endif

Software/Arduino code/OpenAstroTracker/LcdMenu.hpp

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

44
#include <Arduino.h>
5+
#ifndef HEADLESS_CLIENT
56
#include <LiquidCrystal.h>
7+
#endif
68
#include "Globals.h"
79

810
// A single menu item (like RA, HEAT, POL, etc.)
@@ -67,6 +69,7 @@ class LcdMenu {
6769
void printChar(char ch);
6870

6971
private:
72+
#ifndef HEADLESS_CLIENT
7073
LiquidCrystal _lcd; // The LCD screen that we'll display the menu on
7174
MenuItem** _menuItems; // The first menu item (linked list)
7275
byte _numMenuItems;
@@ -89,6 +92,7 @@ class LcdMenu {
8992
static byte DownArrowBitmap[8];
9093
static byte DegreesBitmap[8];
9194
static byte MinutesBitmap[8];
95+
#endif
9296
};
9397

9498
#endif

Software/Arduino code/OpenAstroTracker/Mount.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "LcdMenu.hpp"
2+
23
#include "Mount.hpp"
34

45
//mountstatus
@@ -860,6 +861,8 @@ void Mount::moveSteppersTo(float targetRA, float targetDEC) {
860861
//
861862
/////////////////////////////////
862863
void Mount::displayStepperPosition() {
864+
#ifndef HEADLESS_CLIENT
865+
863866
String disp ;
864867

865868
if ((abs(_totalDECMove) > 0.001) && (abs(_totalRAMove) > 0.001)) {
@@ -914,6 +917,7 @@ void Mount::displayStepperPosition() {
914917
_lcdMenu->printMenu(disp);
915918
#endif
916919
}
920+
#endif
917921
}
918922

919923
/////////////////////////////////
@@ -922,11 +926,13 @@ void Mount::displayStepperPosition() {
922926
//
923927
/////////////////////////////////
924928
void Mount::displayStepperPositionThrottled() {
929+
#ifndef HEADLESS_CLIENT
925930
long elapsed = millis() - _lastDisplayUpdate;
926931
if (elapsed > DISPLAY_UPDATE_TIME) {
927932
displayStepperPosition();
928933
_lastDisplayUpdate = millis();
929934
}
935+
#endif
930936
}
931937

932938
/////////////////////////////////

Software/Arduino code/OpenAstroTracker/OpenAstroTracker.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717
#include "Globals.h"
1818

19-
String version = "V1.6.26";
19+
String version = "V1.6.27";
2020

2121
///////////////////////////////////////////////////////////////////////////
2222
// Please see the Globals.h file for configuration of the firmware.

Software/Arduino code/OpenAstroTracker/b_setup.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ void setup() {
5656
// Start the tracker.
5757
mount.startSlewing(TRACKING);
5858

59+
#ifndef HEADLESS_CLIENT
5960
// Create the LCD top-level menu items
6061
lcdMenu.addItem("RA", RA_Menu);
6162
lcdMenu.addItem("DEC", DEC_Menu);
@@ -87,6 +88,7 @@ void setup() {
8788
}
8889

8990
lcdMenu.updateDisplay();
91+
#endif
9092

9193
#ifdef DEBUG_MODE
9294
Serial.println("SetupDone");

Software/Arduino code/OpenAstroTracker/c65_startup.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#ifndef HEADLESS_CLIENT
12
#ifdef SUPPORT_GUIDED_STARTUP
23
//////////////////////////////////////////////////////////////
34
// This file contains the Starup 'wizard' that guides you through initial setup
@@ -122,3 +123,4 @@ void prinStartupMenu() {
122123
}
123124
}
124125
#endif
126+
#endif
Lines changed: 2 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
#ifndef HEADLESS_CLIENT
22
bool processRAKeys() {
33
byte key;
44
bool waitForRelease = true;
@@ -52,141 +52,4 @@ void printRASubmenu() {
5252
lcdMenu.printMenu(mount.RAString(LCDMENU_STRING | TARGET_STRING, RAselect));
5353
}
5454
}
55-
56-
57-
/*
58-
WIP for complete OO-ification of code.
59-
60-
class Processor
61-
{
62-
Processor *_nextProcessor;
63-
int _numSubMenuItems;
64-
int _currentSubMenu;
65-
66-
public:
67-
Processor(int numSubMenuItems)
68-
{
69-
_numSubMenuItems = numSubMenuItems;
70-
_currentSubMenu = 0;
71-
_nextProcessor = nullptr;
72-
}
73-
74-
void setNext(Processor *nextProcessor) {
75-
_nextProcessor = nextProcessor;
76-
}
77-
virtual const char *display() = 0;
78-
virtual void onDownKeyPressed() {}
79-
virtual void onUpKeyPressed() {}
80-
virtual void onLeftKeyPressed() {
81-
adjustSubMenu();
82-
}
83-
virtual void onRightKeyPressed() { }
84-
virtual void onSelectKeyPressed() {}
85-
virtual void onKeyReleased(int key) {}
86-
virtual void onIdle() {}
87-
void adjustSubMenu(int by = 1)
88-
{
89-
_currentSubMenu = adjustWrap(_currentSubMenu, by, 0, _numSubMenuItems);
90-
}
91-
};
92-
93-
class ProcessRA : Processor
94-
{
95-
public:
96-
ProcessRA() : Processor(3)
97-
{
98-
}
99-
const char *display()
100-
{
101-
return "RA";
102-
}
103-
104-
void onDownKeyPressed()
105-
{
106-
}
107-
108-
void onUpKeyPressed()
109-
{
110-
}
111-
112-
void onLeftKeyPressed()
113-
{
114-
}
115-
116-
void onRightKeyPressed()
117-
{
118-
}
119-
120-
void onSelectKeyPressed()
121-
{
122-
}
123-
124-
void onIdle()
125-
{
126-
}
127-
};
128-
129-
class MenuProcessor
130-
{
131-
Processor *_firstProcessor;
132-
Processor *_lastProcessor;
133-
Processor *_activeProcessor;
134-
int _lastKeyState;
135-
136-
public:
137-
MenuProcessor()
138-
{
139-
_firstProcessor = nullptr;
140-
_lastProcessor = nullptr;
141-
_activeProcessor = nullptr;
142-
_lastKeyState = btnNONE;
143-
}
144-
145-
void loop()
146-
{
147-
int keyState = read_LCD_buttons();
148-
if ((_lastKeyState == btnNONE) && (keyState != btnNONE))
149-
{
150-
switch (keyState)
151-
{
152-
case btnUP:
153-
_activeProcessor->onUpKeyPressed();
154-
break;
155-
case btnDOWN:
156-
_activeProcessor->onDownKeyPressed();
157-
break;
158-
case btnLEFT:
159-
_activeProcessor->onLeftKeyPressed();
160-
break;
161-
case btnRIGHT:
162-
_activeProcessor->onRightKeyPressed();
163-
break;
164-
case btnSELECT:
165-
_activeProcessor->onSelectKeyPressed();
166-
break;
167-
}
168-
_lastKeyState = keyState;
169-
}
170-
else if ((_lastKeyState != btnNONE) && (keyState == btnNONE))
171-
{
172-
_activeProcessor->onKeyReleased(_lastKeyState);
173-
}
174-
else if ((_lastKeyState == btnNONE) && (keyState == btnNONE))
175-
{
176-
_activeProcessor->onIdle();
177-
}
178-
}
179-
180-
void addProcessor(Processor *processor)
181-
{
182-
if (_firstProcessor == nullptr)
183-
{
184-
_firstProcessor = processor;
185-
}
186-
else
187-
{
188-
_firstProcessor->setNext(processor);
189-
}
190-
}
191-
};
192-
*/
55+
#endif

Software/Arduino code/OpenAstroTracker/c71_menuDEC.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
#ifndef HEADLESS_CLIENT
22
bool processDECKeys() {
33
byte key;
44
bool waitForRelease = true;
@@ -51,3 +51,4 @@ void printDECSubmenu() {
5151
lcdMenu.printMenu(mount.DECString(LCDMENU_STRING | TARGET_STRING, DECselect));
5252
}
5353
}
54+
#endif

Software/Arduino code/OpenAstroTracker/c722_menuPOI.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#ifndef HEADLESS_CLIENT
12
#ifdef SUPPORT_POINTS_OF_INTEREST
23
struct PointOfInterest {
34
char* pDisplay;
@@ -79,3 +80,4 @@ void printPOISubmenu() {
7980
}
8081
}
8182
#endif
83+
#endif

0 commit comments

Comments
 (0)