From 050fed6e9af26988da9d57d554e4c432496c3ed3 Mon Sep 17 00:00:00 2001 From: travis-farmer Date: Fri, 3 Nov 2023 13:40:48 -0400 Subject: [PATCH] crashes --- Wifi_NINA.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Wifi_NINA.cpp b/Wifi_NINA.cpp index ba57f00..46acfd4 100644 --- a/Wifi_NINA.cpp +++ b/Wifi_NINA.cpp @@ -184,7 +184,7 @@ bool WifiNINA::setup(const char *SSid, strMac += String(mac[i], HEX); } - DIAG(F("MAC address: %x:%x:%x:%x:%X;%x"), mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); + DIAG(F("MAC address: %x:%x:%x:%x:%x:%x"), mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); strMac.remove(0,9); strMac.replace(":",""); @@ -200,7 +200,7 @@ bool WifiNINA::setup(const char *SSid, channel) == WL_AP_LISTENING) { DIAG(F("Wifi AP SSID %s PASS %s"),strSSID.c_str(),havePassword ? password : strPass.c_str()); ip = WiFi.localIP(); - DIAG(F("Wifi AP IP %s"),ip); + DIAG(F("Wifi AP IP %d.%d.%d.%d"),ip[0], ip[1], ip[2], ip[3]); wifiUp = true; APmode = true; } else { @@ -370,14 +370,14 @@ const char *wlerror[] = { } }*/ -WiFiClient * clients[MAX_CLIENTS]; // nulled in setup +WiFiClient clients[MAX_CLIENTS]; // nulled in setup void WifiNINA::checkForNewClient() { auto newClient=server->available(); if (!newClient) return; for (byte clientId=0; clientIdconnected()) { - DIAG(F("Remove client %d"), clientId); - CommandDistributor::forget(clientId); - //delete c; //TJF: this causes a crash when client drops.. commenting out for now. - clients[clientId]=nullptr; - } + if(c && !c.connected()) { + DIAG(F("Remove client %d"), clientId); + CommandDistributor::forget(clientId); + //delete c; //TJF: this causes a crash when client drops.. commenting out for now. + //clients[clientId]=NULL; // TJF: what to do... what to do... + } } } @@ -401,11 +401,11 @@ void WifiNINA::checkForClientInput() { for (byte clientId=0; clientIdavailable(); + auto len=c.available(); if (len) { // read data from client byte cmd[len+1]; - for(int i=0; iread(); + for(int i=0; iwrite(outboundRing->read()); + for (int i=0;iread()); } void WifiNINA::loop() {