Skip to content

Commit 95b4734

Browse files
Merge pull request #103 from OpenAstroTech/rename-headless-to-display-type
Renamed HEADLESS_CLIENT to DISPLAY_TYPE
2 parents afe448e + 69ade79 commit 95b4734

24 files changed

+93
-95
lines changed

.github/workflows/platformio.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
jobs:
1212
build:
13-
name: ${{ matrix.board }} STEPPER=${{ matrix.stepper }} DRIVER=${{ matrix.driver }} GPS=${{ matrix.gps }} GYRO=${{ matrix.gyro }} ALTAZ=${{ matrix.azalt }} HEADLESS=${{ matrix.headless }}
13+
name: ${{ matrix.board }} STEPPER=${{ matrix.stepper }} DRIVER=${{ matrix.driver }} GPS=${{ matrix.gps }} GYRO=${{ matrix.gyro }} ALTAZ=${{ matrix.azalt }} DISPLAY=${{ matrix.display }}
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
@@ -20,7 +20,7 @@ jobs:
2020
gps: [0, 1]
2121
gyro: [0, 1]
2222
azalt: [0, 1]
23-
headless: [0, 1]
23+
display: [0, 1]
2424
exclude:
2525
- { stepper: 1, driver: 0 } # NEMA17 & ULN2003
2626
- { stepper: 0, driver: 1 } # 28BYJ48 & GENERIC
@@ -30,6 +30,7 @@ jobs:
3030
- { board: esp32, gps: 1 }
3131
- { board: esp32, gyro: 1 }
3232
- { board: esp32, azalt: 1 }
33+
- { board: esp32, display: 1 }
3334

3435
steps:
3536
- uses: actions/checkout@v1
@@ -50,4 +51,4 @@ jobs:
5051
-D USE_GPS=${{ matrix.gps }}
5152
-D USE_GYRO_LEVEL=${{ matrix.gyro }}
5253
-D AZIMUTH_ALTITUDE_MOTORS=${{ matrix.azalt }}
53-
-D HEADLESS_CLIENT=${{ matrix.headless }}
54+
-D DISPLAY_TYPE=${{ matrix.display }}

Software/Arduino code/OpenAstroTracker/Configuration.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@
4040
#define NORTHERN_HEMISPHERE 1
4141
#endif
4242

43+
// Used display
44+
#ifndef DISPLAY_TYPE
45+
#define DISPLAY_TYPE DISPLAY_TYPE_LCD_KEYPAD
46+
#endif
47+
4348
// Used RA wheel version. Unless you printed your OAT before March 2020, you're using
4449
// a version 2 or higher (software only differentiates between 1 and more than 1)
4550
#ifndef RA_WHEEL_VERSION

Software/Arduino code/OpenAstroTracker/Configuration_adv.hpp

Lines changed: 16 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
#include "Configuration.hpp"
44

5+
/**
6+
* This file contains advanced configurations. Edit values here only if you know what you are doing. Invalid values
7+
* can lead to OAT misbehaving very bad and in worst case could even lead to hardware damage. The default values here
8+
* were chosen after many tests and can are currently concidered to work the best.
9+
**/
10+
511
// This is how many steps your stepper needs for a full rotation.
612
#if RA_STEPPER_TYPE == STEPPER_TYPE_28BYJ48
713
#define RA_STEPPER_SPR 4096 // 28BYJ-48 = 4096 | NEMA 0.9° = 400 | NEMA 1.8° = 200
@@ -122,29 +128,6 @@
122128
#define DISPLAY_UPDATE_TIME 200
123129

124130

125-
////////////////////////////
126-
//
127-
// HEADLESS CLIENT
128-
// If you do not have a LCD shield on your Arduino Mega, set this to 1 on the line below. This is
129-
// useful if you are always going to run the mount from a laptop anyway.
130-
#ifndef HEADLESS_CLIENT
131-
#define HEADLESS_CLIENT 0
132-
#endif
133-
134-
////////////////////////////
135-
//
136-
// ARDUINO RGB LCD SHIELD I2C
137-
// There are two different chips supported by the LiquidTWI2 library,
138-
// check the marking on your shield
139-
#define I2C_DISPLAY 0
140-
#define I2C_TYPE_MCP23008 0
141-
#define I2C_TYPE_MCP23017 1
142-
143-
#ifdef __AVR_ATmega328P__ // UNO must use headless
144-
#undef HEADLESS_CLIENT
145-
#define HEADLESS_CLIENT 1
146-
#endif
147-
148131
////////////////////////////
149132
//
150133
// LCD BUTTON TEST
@@ -169,7 +152,8 @@
169152
#define ALTITUDE_ARC_SECONDS_PER_STEP (0.61761f)
170153
#define ALTITUDE_STEPS_PER_ARC_MINUTE (60.0f/ALTITUDE_ARC_SECONDS_PER_STEP)
171154

172-
#if HEADLESS_CLIENT == 0 // <-- Ignore this line
155+
#if DISPLAY_TYPE > 0
156+
173157
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
174158
// ///
175159
// FEATURE SUPPORT SECTION ///
@@ -180,9 +164,6 @@
180164
// and disable features to help manage memory usage.
181165
// If you run the tracker with an Arduino Mega, you can set all the features to 1.
182166
//
183-
// If you would like to drive your OAT mount with only the LCD Shield, or are on a Uno,
184-
// you should set SUPPORT_SERIAL_CONTROL to 0
185-
//
186167
// If you feel comfortable with configuring the OAT at startup manually, you should set
187168
// SUPPORT_GUIDED_STARTUP to 0 (maybe after you've used it for a while you know what to do).
188169
//
@@ -206,14 +187,17 @@
206187
// Set this to 1 to support INFO menu that displays various pieces of information about the mount.
207188
#define SUPPORT_INFO_DISPLAY 1
208189

209-
// Set this to 1 to support Serial Meade LX200 protocol support
210-
#define SUPPORT_SERIAL_CONTROL 1
211-
212-
#endif // HEADLESS_CLIENT <-- Ignore this
190+
#endif // DISPLAY_TYPE
213191

192+
// Enable Meade protocol communication over serial
193+
#ifdef __AVR_ATmega328P__
194+
#define SUPPORT_SERIAL_CONTROL 0
195+
#else
196+
#define SUPPORT_SERIAL_CONTROL 1
197+
#endif
214198

215199

216-
#if defined(ESP8266) || defined(ESP32) // <-- ignore this line
200+
#if defined(ESP8266) || defined(ESP32)
217201
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
218202
// //////////
219203
// WIFI SETTINGS //////////
@@ -223,8 +207,6 @@
223207
//
224208
// Define some things, dont change: ///
225209
#define ESPBOARD
226-
#undef HEADLESS_CLIENT
227-
#define HEADLESS_CLIENT 1
228210
// #define BLUETOOTH_ENABLED
229211
#define WIFI_ENABLED
230212
#if defined(ESP8266)
@@ -315,15 +297,6 @@
315297
#error "Sorry, Arduino Uno only supports 28BYJ48 steppers."
316298
#endif
317299

318-
319-
320-
////////////////////////////
321-
// Misc stuff, ignore
322-
323-
#if HEADLESS_CLIENT == 1
324-
#define SUPPORT_SERIAL_CONTROL 1
325-
#endif
326-
327300
// Set this to 1 this to enable the heating menu
328301
// NOTE: Heating is currently not supported!
329302
#define SUPPORT_HEATING 0
Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,35 @@
11
#pragma once
22

3-
/*
4-
* This file contains constants that should not be changed.
5-
*/
3+
/**
4+
* This file contains constants that SHOULD NOT BE CHANGED by oat users!
5+
* If you are a developer and want to add new hardware support, add a
6+
* proper definition here with increased value.
7+
**/
68

7-
// Supported stepper models, do not modify these values.
8-
#define STEPPER_TYPE_28BYJ48 0
9-
#define STEPPER_TYPE_NEMA17 1
9+
/**
10+
* Supported display types. Use one of these values for DISPLAY_TYPE configuration matching your used display.
11+
*
12+
* DISPLAY_TYPE_NONE: No display. Use this if you don't use any display.
13+
* DISPLAY_TYPE_LCD_KEYPAD: 1602 LCD Keypad shield which can be mounted directly to an Arduino UNO / Mega boards.
14+
* Example: https://www.digikey.com/en/products/detail/dfrobot/DFR0009/7597118
15+
* DISPLAY_TYPE_LCD_KEYPAD_I2C_MCP23008: RGB LCD Keypad shield based on the MCP23008 I/O Expander. It can be mounted
16+
* directly to an Arduino UNO / Mega boards and controlled over I2C.
17+
* DISPLAY_TYPE_LCD_KEYPAD_I2C_MCP23017: RGB LCD Keypad shield based on the MCP23017 I/O Expander. It can be mounted
18+
* directly to an Arduino UNO / Mega boards and controlled over I2C.
19+
**/
20+
#define DISPLAY_TYPE_NONE 0
21+
#define DISPLAY_TYPE_LCD_KEYPAD 1
22+
#define DISPLAY_TYPE_LCD_KEYPAD_I2C_MCP23008 2
23+
#define DISPLAY_TYPE_LCD_KEYPAD_I2C_MCP23017 3
1024

11-
// Supported stepper driver models, do not modify these values.
12-
#define DRIVER_TYPE_ULN2003 0
13-
#define DRIVER_TYPE_GENERIC 1
14-
#define DRIVER_TYPE_TMC2209_STANDALONE 2
15-
#define DRIVER_TYPE_TMC2209_UART 3
1625

26+
// Supported stepper models
27+
#define STEPPER_TYPE_28BYJ48 0
28+
#define STEPPER_TYPE_NEMA17 1
29+
30+
31+
// Supported stepper driver models
32+
#define DRIVER_TYPE_ULN2003 0
33+
#define DRIVER_TYPE_GENERIC 1
34+
#define DRIVER_TYPE_TMC2209_STANDALONE 2
35+
#define DRIVER_TYPE_TMC2209_UART 3

Software/Arduino code/OpenAstroTracker/src/LcdMenu.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@
22
#include "EPROMStore.hpp"
33
#include "LcdMenu.hpp"
44

5-
#if HEADLESS_CLIENT == 0
5+
#if DISPLAY_TYPE > 0
66

77
// Class that drives the LCD screen with a menu
88
// You add a string and an id item and this class handles the display and navigation
99
// Create a new menu, using the given number of LCD display columns and rows
10-
#if I2C_DISPLAY == 0
10+
#if DISPLAY_TYPE == DISPLAY_TYPE_LCD_KEYPAD
1111
LcdMenu::LcdMenu(byte cols, byte rows, int maxItems) : _lcd(8, 9, 4, 5, 6, 7)
1212
{
1313
_cols = cols;
1414
_rows = rows;
1515
_maxItems = maxItems;
1616
}
17-
#else
17+
#elif DISPLAY_TYPE == DISPLAY_TYPE_LCD_KEYPAD_I2C_MCP23008 || DISPLAY_TYPE == DISPLAY_TYPE_LCD_KEYPAD_I2C_MCP23017
1818
LcdMenu::LcdMenu(byte cols, byte rows, int maxItems) : _lcd(0x20)
1919
{
20-
#if I2C_DISPLAY == 1 && I2C_TYPE_MCP23017 == 1
20+
#if DISPLAY_TYPE == DISPLAY_TYPE_LCD_KEYPAD_I2C_MCP23017
2121
_lcd.setMCPType(LTI_TYPE_MCP23017);
22-
#elif I2C_DISPLAY == 1 && I2C_TYPE_MCP23008 == 1
22+
#elif DISPLAY_TYPE == DISPLAY_TYPE_LCD_KEYPAD_I2C_MCP23008
2323
_lcd.setMCPType(LTI_TYPE_MCP23008);
2424
#endif
2525

@@ -44,7 +44,7 @@ void LcdMenu::startup()
4444
_lastDisplay[1] = "";
4545
_menuItems = new MenuItem *[_maxItems];
4646

47-
#if I2C_DISPLAY == 1 // TODO, store custom color
47+
#if DISPLAY_TYPE == DISPLAY_TYPE_LCD_KEYPAD_I2C_MCP23008 || DISPLAY_TYPE == DISPLAY_TYPE_LCD_KEYPAD_I2C_MCP23017
4848
_lcd.setBacklight(RED);
4949
#endif
5050

@@ -264,7 +264,7 @@ void LcdMenu::printAt(int col, int row, char ch)
264264
printChar(ch);
265265
}
266266

267-
#if I2C_DISPLAY == 1
267+
#if DISPLAY_TYPE == DISPLAY_TYPE_LCD_KEYPAD_I2C_MCP23008 || DISPLAY_TYPE == DISPLAY_TYPE_LCD_KEYPAD_I2C_MCP23017
268268
uint8_t LcdMenu::readButtons()
269269
{
270270
return _lcd.readButtons();

Software/Arduino code/OpenAstroTracker/src/LcdMenu.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
#include <Arduino.h>
44
#include "../Configuration_adv.hpp"
55

6-
#if HEADLESS_CLIENT == 0 && I2C_DISPLAY == 1
7-
#include <LiquidTWI2.h>
8-
#elif HEADLESS_CLIENT == 0 && I2C_DISPLAY == 0
6+
#if DISPLAY_TYPE == DISPLAY_TYPE_LCD_KEYPAD
97
#include <LiquidCrystal.h>
8+
#elif DISPLAY_TYPE == DISPLAY_TYPE_LCD_KEYPAD_I2C_MCP23008 || DISPLAY_TYPE == DISPLAY_TYPE_LCD_KEYPAD_I2C_MCP23017
9+
#include <LiquidTWI2.h>
1010
#endif
1111

12-
1312
// A single menu item (like RA, HEAT, POL, etc.)
1413
// The ID is just a number, it has no relevance for the order of the items
1514
// The display is what is shown on the menu.
@@ -77,7 +76,7 @@ class LcdMenu {
7776
// Print a character at a specific position
7877
void printAt(int col, int row, char ch);
7978

80-
#if I2C_DISPLAY == 1
79+
#if DISPLAY_TYPE == DISPLAY_TYPE_LCD_KEYPAD_I2C_MCP23008 || DISPLAY_TYPE == DISPLAY_TYPE_LCD_KEYPAD_I2C_MCP23017
8180
uint8_t readButtons();
8281
#endif
8382

@@ -86,17 +85,18 @@ class LcdMenu {
8685
void printChar(char ch);
8786

8887
private:
89-
#if HEADLESS_CLIENT == 0
88+
#if DISPLAY_TYPE > 0
9089

9190
byte _cols;
9291
byte _rows;
9392
byte _maxItems;
9493

95-
#if I2C_DISPLAY == 0
94+
#if DISPLAY_TYPE == DISPLAY_TYPE_LCD_KEYPAD
9695
LiquidCrystal _lcd; // The LCD screen that we'll display the menu on
97-
#else
96+
#elif DISPLAY_TYPE == DISPLAY_TYPE_LCD_KEYPAD_I2C_MCP23008 || DISPLAY_TYPE == DISPLAY_TYPE_LCD_KEYPAD_I2C_MCP23017
9897
LiquidTWI2 _lcd; // The LCD screen that we'll display the menu on
9998
#endif
99+
100100
MenuItem** _menuItems; // The first menu item (linked list)
101101
byte _numMenuItems;
102102
byte _activeMenuIndex;

Software/Arduino code/OpenAstroTracker/src/MeadeCommandProcessor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ MeadeCommandProcessor* MeadeCommandProcessor::instance() {
447447
MeadeCommandProcessor::MeadeCommandProcessor(Mount* mount, LcdMenu* lcdMenu) {
448448
_mount = mount;
449449

450-
// In HEADLESS_CLIENT mode, the lcdMenu is just an empty shell class to save having to null check everywhere
450+
// In case of DISPLAY_TYPE_NONE mode, the lcdMenu is just an empty shell class to save having to null check everywhere
451451
_lcdMenu = lcdMenu;
452452
}
453453

Software/Arduino code/OpenAstroTracker/src/Mount.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2259,7 +2259,7 @@ void Mount::moveSteppersTo(float targetRA, float targetDEC) {
22592259
//
22602260
/////////////////////////////////
22612261
void Mount::displayStepperPosition() {
2262-
#if HEADLESS_CLIENT == 0
2262+
#if DISPLAY_TYPE > 0
22632263

22642264
String disp;
22652265

@@ -2323,7 +2323,7 @@ void Mount::displayStepperPosition() {
23232323
//
23242324
/////////////////////////////////
23252325
void Mount::displayStepperPositionThrottled() {
2326-
#if HEADLESS_CLIENT == 0
2326+
#if DISPLAY_TYPE > 0
23272327
long elapsed = millis() - _lastDisplayUpdate;
23282328
if (elapsed > DISPLAY_UPDATE_TIME) {
23292329
displayStepperPosition();

Software/Arduino code/OpenAstroTracker/src/Mount.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef _MOUNT_HPP_
22
#define _MOUNT_HPP_
33

4-
#if HEADLESS_CLIENT == 0
4+
#if DISPLAY_TYPE > 0
55
#include <LiquidCrystal.h>
66
#endif
77

Software/Arduino code/OpenAstroTracker/src/Utility.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ class LcdButtons {
179179
private:
180180
void checkKey() {
181181

182-
#if HEADLESS_CLIENT == 0
183-
#if I2C_DISPLAY == 1
182+
#if DISPLAY_TYPE > 0
183+
#if DISPLAY_TYPE == DISPLAY_TYPE_LCD_KEYPAD_I2C_MCP23008 || DISPLAY_TYPE == DISPLAY_TYPE_LCD_KEYPAD_I2C_MCP23017
184184
uint8_t buttons = _lcdMenu->readButtons();
185185
_currentKey = btnNONE;
186186
if (buttons)

0 commit comments

Comments
 (0)