Okundu Omeni
/
wifi-https-ble-sm-uart-atcmd-5-13-1
this is using the mbed os version 5-13-1
Diff: source/WiFiManager.cpp
- Branch:
- PassingRegression
- Revision:
- 126:9bc33f8b57d5
- Parent:
- 125:d2830421006c
- Child:
- 127:a21788227ca6
--- a/source/WiFiManager.cpp Thu Jun 20 20:46:25 2019 +0000 +++ b/source/WiFiManager.cpp Sun Jul 07 20:36:41 2019 +0000 @@ -276,6 +276,7 @@ while(secCount++ < WIFI_CONNECT_TIMEOUT_SECS && is_connected==false){ wait(1); // wait 1 sec } + wifiCmd = WIFI_CMD_NONE; if(is_connected==false){ if(outputBuffersAvailable() == false) // first free it { @@ -290,7 +291,6 @@ else { sendATresponseString(AT_CONNECT_RESP); } - wifiCmd = WIFI_CMD_NONE; wifiBusy = 0; break; } @@ -303,6 +303,7 @@ } wifiBusy = 1; error = disconnect(); + wifiCmd = WIFI_CMD_NONE; if(error >= 0) { int secCount = 0; @@ -324,11 +325,9 @@ // attempt reconnection if always connected scheme is set if(internet_config->connectionScheme == ALWAYS_CONNECTED) { - wifiCmd = WIFI_CMD_NONE; setNextCommand(WIFI_CMD_CONNECT); } } - wifiCmd = WIFI_CMD_NONE; wifiBusy = 0; break; } @@ -349,7 +348,7 @@ callback_semaphore.wait(); #endif int msecCount = 0; - while(!backgroundTaskCompleted && msecCount < 2000) + while(!backgroundTaskCompleted && msecCount < 1000) { msecCount++; wait_ms(10); @@ -1008,19 +1007,13 @@ int i = 0; responseBytes[i++] = IPv4_CONNECTION; // connect type IPv4 responseBytes[i++] = TCP_PROTOCOL; // Protocol = TCP - dbg_printf(LOG, "Buffer available \r\n"); if(is_connected && result>=0) { memcpy(&responseBytes[i], address->get_ip_bytes(), 4); // remote IPv4 address - dbg_printf(LOG, "IP Address OK \r\n"); strcpy(internet_config->remote_IPv4Address, address->get_ip_address()); - dbg_printf(LOG, "Remote IP address OK \r\n"); i +=4; uint16_t port = address->get_port(); - delete address; - dbg_printf(LOG, "Port OK \r\n"); internet_config->remote_port = port; - dbg_printf(LOG, "Remote port OK \r\n"); memcpy(&responseBytes[i], &port, 2); // remote IPv4 port # i +=2; // local IPv4 address @@ -1036,7 +1029,6 @@ responseBytes[i++] = 0; responseBytes[i] = 0; printBufferInHex(responseBytes, HOSTNAME_RESPONSE_LEN); - dbg_printf(LOG, "About to send response bytes... \r\n"); sendATresponseBytes(CONNECT_EVENT, HOSTNAME_RESPONSE_LEN); } else