Skip to content

Commit

Permalink
Another fix to esp8266 hostname stuff.
Browse files Browse the repository at this point in the history
git-svn-id: svn://192.168.1.10/public/Zimodem@17338 0d6f1817-ed0e-0410-87c9-987e46238f29
  • Loading branch information
bozimmerman committed Nov 3, 2018
1 parent 6b14ca5 commit 24baa76
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions zimodem/zimodem.ino
Expand Up @@ -217,6 +217,15 @@ static void s_pinWrite(uint8_t pinNo, uint8_t value)
}
}

static void setHostName(const char *hname)
{
#ifdef ZIMODEM_ESP32
//tcpip_adapter_set_hostname(TCPIP_ADAPTER_IF_STA, hname.c_str());
#else
WiFi.hostname(hname);
#endif
}

static bool connectWifi(const char* ssid, const char* password)
{
while(WiFi.status() == WL_CONNECTED)
Expand All @@ -226,15 +235,11 @@ static bool connectWifi(const char* ssid, const char* password)
yield();
}
if(hostname.length() > 0)
{
#ifdef ZIMODEM_ESP32
//tcpip_adapter_set_hostname(TCPIP_ADAPTER_IF_STA, hostname.c_str());
#else
WiFi.hostname(hostname);
#endif
}
setHostName(hostname.c_str());
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
if(hostname.length() > 0)
setHostName(hostname.c_str());
bool amConnected = (WiFi.status() == WL_CONNECTED) && (strcmp(WiFi.localIP().toString().c_str(), "0.0.0.0")!=0);
int WiFiCounter = 0;
while ((!amConnected) && (WiFiCounter < 30))
Expand Down

0 comments on commit 24baa76

Please sign in to comment.