Skip to content

Commit 9890ea0

Browse files
author
openastrotech
committed
update arduino to 1.6.54a from /oatcontrol
1 parent 1ee3264 commit 9890ea0

36 files changed

+3050
-1452
lines changed
-26.4 KB
Binary file not shown.

Software/Arduino code/OpenAstroTracker/DayTime.cpp

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ DayTime::DayTime(long ms) {
3232
ms = (ms - secs) / 60;
3333
mins = (int)(ms % 60);
3434
ms = (ms - mins) / 60;
35-
hours = (int)ms ;
35+
hours = (int)ms;
3636
}
3737

3838
DayTime::DayTime(float timeInHours) {
@@ -43,31 +43,31 @@ DayTime::DayTime(float timeInHours) {
4343
secs = floor(timeInHours);
4444
}
4545

46-
int DayTime::getHours() {
46+
int DayTime::getHours() const {
4747
return hours;
4848
}
4949

50-
int DayTime::getMinutes() {
50+
int DayTime::getMinutes() const {
5151
return mins;
5252
}
5353

54-
int DayTime::getSeconds() {
54+
int DayTime::getSeconds() const {
5555
return secs;
5656
}
5757

58-
float DayTime::getTotalHours() {
58+
float DayTime::getTotalHours() const {
5959
return 1.0f * getHours() + ((float)getMinutes() / 60.0f) + ((float)getSeconds() / 3600.0f);
6060
}
6161

62-
float DayTime::getTotalMinutes() {
62+
float DayTime::getTotalMinutes() const {
6363
return 60.0f * getHours() + (float)getMinutes() + ((float)getSeconds() / 60.0f);
6464
}
6565

66-
float DayTime::getTotalSeconds() {
66+
float DayTime::getTotalSeconds() const {
6767
return 3600.0f * getHours() + (float)getMinutes() * 60.0f + (float)getSeconds();
6868
}
6969

70-
int DayTime::getTime(int& h, int& m, int& s) {
70+
int DayTime::getTime(int& h, int& m, int& s) const {
7171
h = hours;
7272
m = mins;
7373
s = secs;
@@ -95,8 +95,9 @@ void DayTime::addHours(int deltaHours) {
9595

9696
void DayTime::checkHours() {
9797
while (hours >= hourWrap) {
98-
hours -= hourWrap;
98+
hours -= hourWrap;
9999
}
100+
100101
while (hours < 0) {
101102
hours += hourWrap;
102103
}
@@ -106,11 +107,12 @@ void DayTime::checkHours() {
106107
void DayTime::addMinutes(int deltaMins) {
107108
mins += deltaMins;
108109
while (mins > 59) {
109-
mins -= 60;
110+
mins -= 60;
110111
addHours(1);
111112
}
112-
while (mins < 0) {
113-
mins += 60;
113+
114+
while (mins < 0) {
115+
mins += 60;
114116
addHours(-1);
115117
}
116118
}
@@ -122,6 +124,7 @@ void DayTime::addSeconds(long deltaSecs) {
122124
secs -= 60;
123125
addMinutes(1);
124126
}
127+
125128
while (secs < 0) {
126129
secs += 60;
127130
addMinutes(-1);
@@ -156,39 +159,45 @@ void DayTime::subtractTime(const DayTime& other)
156159
String DayTime::ToString()
157160
{
158161
char achBuf[12];
159-
char*p = achBuf;
162+
char* p = achBuf;
160163

161164
if (hours < 10) {
162165
*p++ = '0';
163-
} else {
166+
}
167+
else {
164168
*p++ = '0' + (hours / 10);
165169
}
170+
166171
*p++ = '0' + (hours % 10);
167172

168173
*p++ = ':';
169174
if (mins < 10) {
170175
*p++ = '0';
171-
} else {
176+
}
177+
else {
172178
*p++ = '0' + (mins / 10);
173179
}
180+
174181
*p++ = '0' + (mins % 10);
175182
*p++ = ':';
176183
if (secs < 10) {
177184
*p++ = '0';
178-
} else {
185+
}
186+
else {
179187
*p++ = '0' + (secs / 10);
180188
}
189+
181190
*p++ = '0' + (secs % 10);
182191
*p++ = '\0';
183192
return String(achBuf);
184193
}
185194

186195

187-
DegreeTime::DegreeTime(): DayTime() {
196+
DegreeTime::DegreeTime() : DayTime() {
188197
hourWrap = 180;
189198
}
190199

191-
DegreeTime::DegreeTime(const DegreeTime& other): DayTime(other) { }
200+
DegreeTime::DegreeTime(const DegreeTime& other) : DayTime(other) { }
192201
DegreeTime::DegreeTime(int h, int m, int s) : DayTime(h, m, s) { }
193202
DegreeTime::DegreeTime(float inDegrees) : DayTime(inDegrees) { }
194203

@@ -204,15 +213,16 @@ int DegreeTime::getPrintDegrees() {
204213
return NORTHERN_HEMISPHERE ? hours + 90 : hours - 90;
205214
}
206215

207-
float DegreeTime::getTotalDegrees() {
216+
float DegreeTime::getTotalDegrees() const {
208217
return getTotalHours();
209218
}
210219

211220
void DegreeTime::checkHours() {
212221
if (NORTHERN_HEMISPHERE) {
213222
if (hours > 0) hours = 0;
214223
if (hours < -180) hours = -180;
215-
} else {
224+
}
225+
else {
216226
if (hours > 180) hours = 180;
217227
if (hours < 0) hours = 0;
218228
}

Software/Arduino code/OpenAstroTracker/DayTime.hpp

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -8,82 +8,82 @@
88
// addition of hours, minutes, seconds, other times and conversion to string.
99

1010
class DayTime {
11-
protected:
12-
int hours;
13-
int mins;
14-
int secs;
15-
int hourWrap = 24;
11+
protected:
12+
int hours;
13+
int mins;
14+
int secs;
15+
int hourWrap = 24;
1616

17-
public:
18-
DayTime();
17+
public:
18+
DayTime();
1919

20-
DayTime(const DayTime& other);
21-
DayTime(int h, int m, int s);
20+
DayTime(const DayTime& other);
21+
DayTime(int h, int m, int s);
2222

23-
// From milliseconds. Does not handle days!
24-
DayTime(long ms);
23+
// From milliseconds. Does not handle days!
24+
DayTime(long ms);
2525

26-
// From hours
27-
DayTime(float timeInHours);
26+
// From hours
27+
DayTime(float timeInHours);
2828

29-
int getHours();
30-
int getMinutes();
31-
int getSeconds();
32-
float getTotalHours();
33-
float getTotalMinutes();
34-
float getTotalSeconds();
29+
int getHours() const;
30+
int getMinutes() const;
31+
int getSeconds() const;
32+
float getTotalHours() const;
33+
float getTotalMinutes() const;
34+
float getTotalSeconds() const;
3535

36-
int getTime(int& h, int& m, int& s);
37-
void set(int h, int m, int s);
38-
void set(const DayTime& other);
36+
int getTime(int& h, int& m, int& s) const;
37+
void set(int h, int m, int s);
38+
void set(const DayTime& other);
3939

40-
// Add hours, wrapping days (which are not tracked). Negative or positive.
41-
virtual void addHours(int deltaHours);
40+
// Add hours, wrapping days (which are not tracked). Negative or positive.
41+
virtual void addHours(int deltaHours);
4242

43-
// Add minutes, wrapping hours if needed
44-
void addMinutes(int deltaMins);
43+
// Add minutes, wrapping hours if needed
44+
void addMinutes(int deltaMins);
4545

46-
// Add seconds, wrapping minutes and hours if needed
47-
void addSeconds(long deltaSecs);
46+
// Add seconds, wrapping minutes and hours if needed
47+
void addSeconds(long deltaSecs);
4848

49-
// Add time components, wrapping seconds, minutes and hours if needed
50-
void addTime(int deltaHours, int deltaMinutes, int deltaSeconds);
49+
// Add time components, wrapping seconds, minutes and hours if needed
50+
void addTime(int deltaHours, int deltaMinutes, int deltaSeconds);
5151

52-
// Add another time, wrapping seconds, minutes and hours if needed
53-
void addTime(const DayTime& other);
54-
// Subtract another time, wrapping seconds, minutes and hours if needed
52+
// Add another time, wrapping seconds, minutes and hours if needed
53+
void addTime(const DayTime& other);
54+
// Subtract another time, wrapping seconds, minutes and hours if needed
5555

56-
void subtractTime(const DayTime& other);
56+
void subtractTime(const DayTime& other);
5757

58-
// Convert to a standard string (like 14:45:06)
59-
String ToString();
58+
// Convert to a standard string (like 14:45:06)
59+
String ToString();
6060
//protected:
61-
virtual void checkHours();
61+
virtual void checkHours();
6262
};
6363

6464
class DegreeTime : public DayTime {
65-
public:
66-
DegreeTime();
67-
DegreeTime(const DegreeTime& other);
68-
DegreeTime(int h, int m, int s);
69-
DegreeTime(float inDegrees);
65+
public:
66+
DegreeTime();
67+
DegreeTime(const DegreeTime& other);
68+
DegreeTime(int h, int m, int s);
69+
DegreeTime(float inDegrees);
7070

71-
// Add degrees, clamp at 90
72-
void addDegrees(int deltaDegrees);
71+
// Add degrees, clamp at 90
72+
void addDegrees(int deltaDegrees);
7373

74-
// Get degrees component
75-
int getDegrees();
74+
// Get degrees component
75+
int getDegrees();
7676

77-
// Get degrees for printing component
78-
int getPrintDegrees();
77+
// Get degrees for printing component
78+
int getPrintDegrees();
7979

80-
// Get total degrees
81-
float getTotalDegrees();
80+
// Get total degrees
81+
float getTotalDegrees() const;
8282
//protected:
83-
virtual void checkHours() override;
83+
virtual void checkHours() override;
8484

85-
private:
86-
void clampDegrees();
85+
private:
86+
void clampDegrees();
8787
};
8888

8989
#endif

Software/Arduino code/OpenAstroTracker/Globals.c

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include "Globals.h"
2+
#include <EEPROM.h>
3+
4+
void EEPROMupdate(int loc, byte val)
5+
{
6+
if (EEPROM.read(loc)!=val)
7+
{
8+
EEPROM.write(loc,val);
9+
}
10+
}

Software/Arduino code/OpenAstroTracker/Globals.h

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
#define _GLOBALS_H_
33

44
#include <Arduino.h>
5+
#include <WString.h>
6+
7+
void EEPROMupdate(int loc, byte val);
58

69
// Set to 1 if you are in the northern hemisphere.
710
#define NORTHERN_HEMISPHERE 1
@@ -11,7 +14,10 @@
1114

1215
// Make some variables in the sketch files available to the C++ code.
1316
extern bool inSerialControl;
14-
17+
extern String version;
18+
extern int PolarisRAHour;
19+
extern int PolarisRAMinute;
20+
extern int PolarisRASecond;
1521
// Comment this out to save some code space
1622
// #define DEBUG_MODE
1723

@@ -42,27 +48,46 @@ extern bool inSerialControl;
4248
// useful if you are always going to run the mount from a laptop anyway.
4349
// #define HEADLESS_CLIENT
4450

51+
#ifdef ESP8266
52+
#define HEADLESS_CLIENT
53+
#define WIFI_ENABLED
54+
#define INFRA_SSID "yourSSID"
55+
#define INFRA_WPAKEY "yourWPAKey"
56+
#define OAT_WPAKEY "superSecret"
57+
#define HOSTNAME "OATerScope"
58+
// 0 - Infrastructure Only - Connecting to a Router
59+
// 1 - AP Mode Only - Acting as a Router
60+
// 2 - Attempt Infrastructure, Fail over to AP Mode.
61+
#define WIFI_MODE 2
62+
#endif
63+
64+
4565
// Uncomment this to enable the heating menu
4666
// NOTE: Heating is currently not supported!
4767
// #define SUPPORT_HEATING
4868

49-
// Uncomment to support Guided Startup
50-
#define SUPPORT_GUIDED_STARTUP
69+
#ifndef HEADLESS_CLIENT
5170

52-
// Uncomment to support full GO (was POI) menu.
53-
// If this is commented out you still have a GO menu that has Home and Park.
54-
#define SUPPORT_POINTS_OF_INTEREST
71+
// Uncomment to support Guided Startup
72+
#define SUPPORT_GUIDED_STARTUP
5573

56-
// Uncomment to support CTRL menu, allowing you to manually slew the mount with the buttons.
57-
#define SUPPORT_MANUAL_CONTROL
74+
// Uncomment to support full GO (was POI) menu.
75+
// If this is commented out you still have a GO menu that has Home and Park.
76+
#define SUPPORT_POINTS_OF_INTEREST
5877

78+
// Uncomment to support CTRL menu, allowing you to manually slew the mount with the buttons.
79+
#define SUPPORT_MANUAL_CONTROL
80+
81+
// Uncomment to support CAL menu, allowing you to calibrate various things
82+
#define SUPPORT_CALIBRATION
83+
84+
#endif
5985
// Uncomment to support INFO menu that displays various pieces of information about the mount.
6086
// #define SUPPORT_INFO_DISPLAY
6187

6288
// Uncomment to support Serial Meade LX200 protocol support
6389
// #define SUPPORT_SERIAL_CONTROL
6490

65-
6691
// If we are making a headleass (no screen, no keyboard) client, always enable Serial.
6792
#ifdef HEADLESS_CLIENT
6893
#define SUPPORT_SERIAL_CONTROL

0 commit comments

Comments
 (0)