Fix for "Wifi in station mode sometimes enters loops of repeatedly joining... #420"

Fix for Wifi in station mode sometimes enters loops of repeatedly joining... #420
This commit is contained in:
Jm Casler
2020-09-19 16:38:59 -07:00
parent 945f726b65
commit 464a42258f
4 changed files with 64 additions and 41 deletions

View File

@@ -8,7 +8,9 @@
WebServer webserver(80);
struct message {
const uint16_t maxMessages = 50;
struct message_t {
char sender[10];
char message[250];
int32_t gpsLat;
@@ -17,7 +19,12 @@ struct message {
bool fromMe;
};
struct message arrayMessages[50];
struct messages_t
{
message_t history[maxMessages]; // 900 positions to save up to 1200 seconds (15 minutes). uInt for each temerature sensor, Input and Setpoint.
};
messages_t messages_history;
String something = "";
String sender = "";
@@ -50,6 +57,7 @@ void initWebServer()
void handleJSONChatHistory()
{
int i;
String out = "";
out += "{\n";
@@ -61,6 +69,14 @@ void handleJSONChatHistory()
out += "\"" + something + "\"";
out += "]\n";
for (i = 0; i < maxMessages; i++) {
out += "[";
out += "\"" + String(messages_history.history[i].sender) + "\"";
out += ",";
out += "\"" + String(messages_history.history[i].message) + "\"";
out += "]\n";
}
out += "\n";
out += " }\n";
out += "}\n";