Skip to content

Commit 05935ea

Browse files
V1.7.21 - Updates
- Implemented INDI Handshake on Wifi
1 parent 834f613 commit 05935ea

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

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.20";
21+
String version = "V1.7.21";
2222

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

Software/Arduino code/OpenAstroTracker/WifiControl.cpp

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,24 @@ void WifiControl::infraToAPFailover() {
134134

135135
void WifiControl::tcpLoop() {
136136
if (client && client.connected()) {
137+
unsigned char buffer[2];
137138
while (client.available()) {
138-
String cmd = client.readStringUntil('#');
139-
LOGV2(DEBUG_WIFI,"WifiTCP: Query <-- %s#", cmd.c_str());
140-
String retVal = _cmdProcessor->processCommand(cmd);
141-
142-
if (retVal != "") {
143-
client.write(retVal.c_str());
144-
LOGV2(DEBUG_WIFI,"WifiTCP: Reply --> %s", retVal.c_str());
139+
// Peek first byte and check for ACK (0x06) handshake
140+
client.read(buffer, 1);
141+
if (buffer[0] == 0x06) {
142+
LOGV1(DEBUG_WIFI,"WifiTCP: Query <-- Handshake request");
143+
client.write("1");
144+
LOGV1(DEBUG_WIFI,"WifiTCP: Reply --> 1");
145+
}
146+
else {
147+
String cmd = String(buffer[0]) + client.readStringUntil('#');
148+
LOGV2(DEBUG_WIFI,"WifiTCP: Query <-- %s#", cmd.c_str());
149+
String retVal = _cmdProcessor->processCommand(cmd);
150+
151+
if (retVal != "") {
152+
client.write(retVal.c_str());
153+
LOGV2(DEBUG_WIFI,"WifiTCP: Reply --> %s", retVal.c_str());
154+
}
145155
}
146156

147157
_mount->loop();

0 commit comments

Comments
 (0)