Skip to content

Commit 42de738

Browse files
V1.6.58 - Updates
- Fixed DEC pin definitions - Added new Serial command :XGN# that gets the network settings (if there's a ESP8266 board with a WiFi connection) - Fixed the bug that was causing inverted RA (e.g. 12hr offset in Stellarium)
1 parent 82e42ad commit 42de738

File tree

6 files changed

+43
-9
lines changed

6 files changed

+43
-9
lines changed

Software/Arduino code/OpenAstroTracker/MeadeCommandProcessor.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "MeadeCommandProcessor.h"
22
#include "Globals.h"
33
#include "Utility.h"
4+
#include "WifiControl.hpp"
45

56
/////////////////////////////////////////////////////////////////////////////////////////
67
//
@@ -228,6 +229,12 @@
228229
// Get the current HA of the mount.
229230
// Returns: HHMMSS
230231
//
232+
// :XGN#
233+
// Get network settings
234+
// Gets the current status of the Wifi connection. Reply only available when running on ESP8266 boards.
235+
// Returns: 1,<stats>,<hostname>,<ip>:<port># - if Wifi is enabled
236+
// Returns: 0,# - if Wifi is not enabled
237+
//
231238
// :XGL#
232239
// Get LST
233240
// Get the current LST of the mount.
@@ -604,6 +611,13 @@ String MeadeCommandProcessor::handleMeadeExtraCommands(String inCmd) {
604611
sprintf(scratchBuffer, "%02d%02d%02d#", _mount->LST().getHours(), _mount->LST().getMinutes(), _mount->LST().getSeconds());
605612
return String(scratchBuffer);
606613
}
614+
else if (inCmd[1] == 'N') {
615+
#ifdef WIFI_ENABLED
616+
return wifiControl.getStatus() + "#";
617+
#endif
618+
619+
return "0,#";
620+
}
607621
}
608622
else if (inCmd[0] == 'S') { // Set RA/DEC steps/deg, speedfactor
609623
if (inCmd[1] == 'R') {

Software/Arduino code/OpenAstroTracker/Mount.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ const DayTime Mount::currentRA() const {
403403
logv("CurrentRA: ZeroPos : %s", _zeroPosRA.ToString());
404404
logv("CurrentRA: POS (+zp) : %s", DayTime(hourPos).ToString());
405405
#endif
406-
if (_stepperDEC->currentPosition() > 0)
406+
if (_stepperDEC->currentPosition() < 0)
407407
{
408408
hourPos += 12;
409409
if (hourPos > 24) hourPos -= 24;

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.57";
19+
String version = "V1.6.58";
2020

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

Software/Arduino code/OpenAstroTracker/WifiControl.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ void WifiControl::setup() {
3131
}
3232
}
3333

34-
3534
void WifiControl::startInfrastructureMode()
3635
{
3736
#ifdef DEBUG_MODE
@@ -69,6 +68,15 @@ String wifiStatus(int status){
6968
return "#"+String(status);
7069
}
7170

71+
String WifiControl::getStatus()
72+
{
73+
String result = "1," + wifiStatus(WiFi.status()) + ",";
74+
result += WiFi.hostname() + ",";
75+
result += WiFi.localIP().toString() + ":" + String(_tcpServer->port());
76+
77+
return result;
78+
}
79+
7280
void WifiControl::loop()
7381
{
7482

@@ -81,7 +89,7 @@ void WifiControl::loop()
8189
_tcpServer = new WiFiServer(4030);
8290
_tcpServer->begin();
8391
_tcpServer->setNoDelay(true);
84-
#ifdef DEBUG_MODE
92+
#ifdef DEBUG_MODE
8593
Serial.println("Server status is "+ wifiStatus( _tcpServer->status()));
8694
#endif
8795
_udp = new WiFiUDP();

Software/Arduino code/OpenAstroTracker/WifiControl.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class WifiControl {
1414
WifiControl(Mount* mount, LcdMenu* lcdMenu);
1515
void setup();
1616
void loop();
17-
17+
String getStatus();
1818
private:
1919
void startInfrastructureMode();
2020
void startAccessPointMode();
@@ -33,4 +33,7 @@ class WifiControl {
3333
long _infraStart = 0;
3434
int _infraWait = 30000; // 30 second timeout for
3535
};
36+
37+
extern WifiControl wifiControl;
38+
3639
#endif

Software/Arduino code/OpenAstroTracker/a_inits.ino

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
//SoftwareSerial BT(10,11);
1818

19+
///////////////////////////////////////////////////////////////////////////
20+
// ESP8266 Wifi Board (NodeMCU)
21+
///////////////////////////////////////////////////////////////////////////
1922
#ifdef ESP8266
2023
// RA Motor pins
2124
#ifdef INVERT_RA_DIR
@@ -50,6 +53,9 @@
5053
#define st4East SD3
5154
#endif
5255

56+
///////////////////////////////////////////////////////////////////////////
57+
// Arduino Uno
58+
///////////////////////////////////////////////////////////////////////////
5359
#ifdef __AVR_ATmega328P__ // normal Arduino Mapping
5460
// RA Motor pins
5561
#ifdef INVERT_RA_DIR
@@ -78,6 +84,9 @@
7884
#endif
7985
#endif
8086

87+
///////////////////////////////////////////////////////////////////////////
88+
// Arduino Mega
89+
///////////////////////////////////////////////////////////////////////////
8190
#ifdef __AVR_ATmega2560__ // Arduino Mega
8291
// RA Motor pins
8392
#ifdef INVERT_RA_DIR
@@ -95,13 +104,13 @@
95104
// DEC Motor pins
96105
#ifdef INVERT_DEC_DIR
97106
#define DECmotorPin1 30 // IN1 auf ULN2003 driver 2
98-
#define DECmotorPin2 32 // IN2 auf ULN2003 driver 2
99-
#define DECmotorPin3 34 // IN3 auf ULN2003 driver 2
107+
#define DECmotorPin3 32 // IN2 auf ULN2003 driver 2
108+
#define DECmotorPin2 34 // IN3 auf ULN2003 driver 2
100109
#define DECmotorPin4 36 // IN4 auf ULN2003 driver 2
101110
#else
102111
#define DECmotorPin1 36 // IN1 auf ULN2003 driver 2
103-
#define DECmotorPin2 34 // IN2 auf ULN2003 driver 2
104-
#define DECmotorPin3 32 // IN3 auf ULN2003 driver 2
112+
#define DECmotorPin3 34 // IN2 auf ULN2003 driver 2
113+
#define DECmotorPin2 32 // IN3 auf ULN2003 driver 2
105114
#define DECmotorPin4 30 // IN4 auf ULN2003 driver 2
106115
#endif
107116
#endif

0 commit comments

Comments
 (0)