Continuing to port my Wemos D1 program to Wemos Lolin32, I have a new issue:
To configure my Wemos Wifi I start this one as AP and connect to it via Telnet in order to configure the final Wifi Client credential.
This works perfect with Wemos D1, however the same configuration with LOLIN results is a deadlock of 30 sec before it reacts to the Telnet session.
See below the simplest program I could made to highlight the issue.
Wemos starts as an Access Point with SSID HA_COOR (default IP address 192.168.4.1, passpharse coordinator)
I use my PC to connect the AP HA_COOR with the appropriate credential (and wait until connected).
Then I start a Telnet session to 192.168.4.1, (which is instantaneous acknowledged by a Wemos D1), however with the ESP32 version this takes systematically 30 sec before acknowledgement.
I did use the statement haServer.setNoDelay(true); , but this has no influence.
Can someone explain me this phenomenon or indicate me the new sequence I should use for a LOLIN32
Thanks in advance
Robert
Code: Select all
#include <WiFi.h> // ESP32 WiFi library
/* Default configuration while WiFi Coordinator Station is not set-up */
const char* ssid = "HA_COOR"; // Default SSID in AP mode
const char* password = "coordinator"; // Default passphrase in AP mode
static WiFiClient haClient;
static IPAddress myLocalIp (192,168,4,1); // Coordinator IP address AP mode
static IPAddress myGatewayIp (0,0,0,0); // Server default IP router's gateway address:
static IPAddress mySubnet (255,255,255,0); // Server subnet mask
WiFiServer haServer(23); // Temporary Server definition while getting the WIFI credentials
void setup()
{
Serial.begin(115200);
WiFi.mode(WIFI_AP); // Ensure WiFi module is defined as Access Point
WiFi.softAPConfig(myLocalIp, myGatewayIp, mySubnet); // Configure the AP with the default IP parameters
WiFi.softAP(ssid,password); // Configure the AP with the default credentials
haServer.begin(); // Start the Telnet server
haServer.setNoDelay(true); // ?????
Serial.println ("\nEntering in Access Point mode for credential configuration, wait for connection...");
}
void loop ()
{
if (haServer.hasClient())
{
haClient = haServer.available();
if (haClient.connected())
{
Serial.print ("Connected to: "); Serial.println (haClient.remoteIP());
}
}
haClient.print("Enter Home AP SSID (max 32 char.): ");// Send the SSID message to the Client
delay (1000);
}