diff --git a/esp8266/wifi.cpp b/esp8266/wifi.cpp index bfc9b668..06c1d203 100644 --- a/esp8266/wifi.cpp +++ b/esp8266/wifi.cpp @@ -69,6 +69,14 @@ char * WIFI_CONFIG::mac2str(uint8_t mac [WL_MAC_ADDR_LENGTH]) return macstr; } +//just simple helper to convert IP address to string +char * WIFI_CONFIG::ip2str(IPAddress Ip ) +{ + static char ipstr [16]; + if (0>sprintf(ipstr, "%i.%i.%i.%i",Ip[0],Ip[1],Ip[2],Ip[3])) strcpy (ipstr, "0.0.0.0"); + return ipstr; +} + //Read configuration settings and apply them bool WIFI_CONFIG::Setup() { diff --git a/esp8266/wifi.h b/esp8266/wifi.h index 29522a48..d8f2dc05 100644 --- a/esp8266/wifi.h +++ b/esp8266/wifi.h @@ -29,6 +29,7 @@ class WIFI_CONFIG public: bool Setup(); char * mac2str(uint8_t mac [WL_MAC_ADDR_LENGTH]); + char * ip2str(IPAddress Ip ); void configAP(IPAddress local_ip, IPAddress gateway, IPAddress subnet); private: byte split_ip (char * ptr,byte * part);