Commit 0890a571 authored by PhiBo's avatar PhiBo 🚀

Fix bug in wifi info

parent de81be18
......@@ -47,17 +47,18 @@ void handleInfoWiFiSTA()
char buffer[129];
JsonObject& root = jsonBuffer.createObject();
IPAddress tmp_ip;
char tmp[16];
char tmp_buf_ip[16];
char tmp_buf_netmask[16];
if(WiFi.status() == WL_CONNECTED) {
root["connected"] = true;
tmp_ip = WiFi.localIP();
sprintf(tmp, "%d.%d.%d.%d", tmp_ip[0], tmp_ip[1], tmp_ip[2], tmp_ip[3]);
root["ip"] = tmp;
sprintf(tmp_buf_ip, "%d.%d.%d.%d", tmp_ip[0], tmp_ip[1], tmp_ip[2], tmp_ip[3]);
root["ip"] = tmp_buf_ip;
tmp_ip = WiFi.subnetMask();
sprintf(tmp, "%d.%d.%d.%d", tmp_ip[0], tmp_ip[1], tmp_ip[2], tmp_ip[3]);
root["netmask"] = tmp;
sprintf(tmp_buf_netmask, "%d.%d.%d.%d", tmp_ip[0], tmp_ip[1], tmp_ip[2], tmp_ip[3]);
root["netmask"] = tmp_buf_netmask;
} else {
root["connected"] = false;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment