From 64d152a4513bb98bbb8382430458f1d02fdcdb1b Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Wed, 27 Jan 2021 12:14:33 +0100 Subject: [PATCH] Refactor some IP addresses --- tasmota/xdrv_50_filesystem.ino | 18 +++++++++--------- tasmota/xdrv_81_esp32_webcam.ino | 4 ++-- tasmota/xdrv_82_esp32_ethernet.ino | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tasmota/xdrv_50_filesystem.ino b/tasmota/xdrv_50_filesystem.ino index f42dd2ff6..90fdad9bf 100644 --- a/tasmota/xdrv_50_filesystem.ino +++ b/tasmota/xdrv_50_filesystem.ino @@ -413,7 +413,7 @@ const char UFS_FORM_FILE_UPGc[] PROGMEM = "
" D_FS_SIZE " %s MB - " D_FS_FREE " %s MB"; const char UFS_FORM_FILE_UPGc1[] PROGMEM = - "   %s"; + "   %s"; const char UFS_FORM_FILE_UPGc2[] PROGMEM = "
"; @@ -436,11 +436,11 @@ const char UFS_FORM_SDC_DIRd[] PROGMEM = const char UFS_FORM_SDC_DIRb[] PROGMEM = "
%s %s %8d %s
"; const char UFS_FORM_SDC_HREF[] PROGMEM = - "http://%s/ufsd?download=%s/%s"; + "http://%_I/ufsd?download=%s/%s"; #ifdef GUI_TRASH_FILE const char UFS_FORM_SDC_HREFdel[] PROGMEM = - //"🗑"; - "🔥"; // 🔥 + //"🗑"; + "🔥"; // 🔥 #endif // GUI_TRASH_FILE void UfsDirectory(void) { @@ -492,7 +492,7 @@ void UfsDirectory(void) { WSContentSend_PD(UFS_FORM_FILE_UPGc, WebColor(COL_TEXT), ts, fs); if (ufs_dir) { - WSContentSend_P(UFS_FORM_FILE_UPGc1, WiFi.localIP().toString().c_str(), (ufs_dir == 1)?2:1, (ufs_dir == 1)?PSTR("SDCard"):PSTR("FlashFS")); + WSContentSend_P(UFS_FORM_FILE_UPGc1, (uint32_t)WiFi.localIP(), (ufs_dir == 1)?2:1, (ufs_dir == 1)?PSTR("SDCard"):PSTR("FlashFS")); } WSContentSend_P(UFS_FORM_FILE_UPGc2); @@ -520,7 +520,7 @@ void UfsListDir(char *path, uint8_t depth) { if (dir) { dir.rewindDirectory(); if (strlen(path)>1) { - snprintf_P(npath, sizeof(npath), PSTR("http://%s/ufsd?download=%s"), WiFi.localIP().toString().c_str(), path); + ext_snprintf_P(npath, sizeof(npath), PSTR("http://%_I/ufsd?download=%s"), (uint32_t)WiFi.localIP(), path); for (uint32_t cnt = strlen(npath) - 1; cnt > 0; cnt--) { if (npath[cnt] == '/') { if (npath[cnt - 1] == '=') { @@ -562,7 +562,7 @@ void UfsListDir(char *path, uint8_t depth) { sprintf(cp, format, ep); if (entry.isDirectory()) { - snprintf_P(npath, sizeof(npath), UFS_FORM_SDC_HREF, WiFi.localIP().toString().c_str(), pp, ep); + snprintf_P(npath, sizeof(npath), UFS_FORM_SDC_HREF, (uint32_t)WiFi.localIP(), pp, ep); WSContentSend_P(UFS_FORM_SDC_DIRd, npath, ep, name); uint8_t plen = strlen(path); if (plen > 1) { @@ -574,12 +574,12 @@ void UfsListDir(char *path, uint8_t depth) { } else { #ifdef GUI_TRASH_FILE char delpath[128]; - snprintf_P(delpath, sizeof(delpath), UFS_FORM_SDC_HREFdel, WiFi.localIP().toString().c_str(), pp, ep); + snprintf_P(delpath, sizeof(delpath), UFS_FORM_SDC_HREFdel, (uint32_t)WiFi.localIP(), pp, ep); #else char delpath[2]; delpath[0]=0; #endif // GUI_TRASH_FILE - snprintf_P(npath, sizeof(npath), UFS_FORM_SDC_HREF, WiFi.localIP().toString().c_str(), pp, ep); + snprintf_P(npath, sizeof(npath), UFS_FORM_SDC_HREF, (uint32_t)WiFi.localIP(), pp, ep); WSContentSend_P(UFS_FORM_SDC_DIRb, npath, ep, name, tstr.c_str(), entry.size(), delpath); } } diff --git a/tasmota/xdrv_81_esp32_webcam.ino b/tasmota/xdrv_81_esp32_webcam.ino index 97f88b9d3..f7a5a5713 100644 --- a/tasmota/xdrv_81_esp32_webcam.ino +++ b/tasmota/xdrv_81_esp32_webcam.ino @@ -918,8 +918,8 @@ void WcShowStream(void) { delay(50); // Give the webcam webserver some time to prepare the stream } if (Wc.CamServer && Wc.up) { - WSContentSend_P(PSTR("

Webcam stream

"), - WiFi.localIP().toString().c_str()); + WSContentSend_P(PSTR("

Webcam stream

"), + (uint32_t)WiFi.localIP()); } } } diff --git a/tasmota/xdrv_82_esp32_ethernet.ino b/tasmota/xdrv_82_esp32_ethernet.ino index c537fae05..a14a84116 100644 --- a/tasmota/xdrv_82_esp32_ethernet.ino +++ b/tasmota/xdrv_82_esp32_ethernet.ino @@ -93,8 +93,8 @@ void EthernetEvent(WiFiEvent_t event) { ETH.linkSpeed(), (ETH.fullDuplex()) ? " Full Duplex" : ""); break; case SYSTEM_EVENT_ETH_GOT_IP: - AddLog(LOG_LEVEL_DEBUG, PSTR("ETH: Mac %s, IPAddress %s, Hostname %s"), - ETH.macAddress().c_str(), ETH.localIP().toString().c_str(), eth_hostname); + AddLog(LOG_LEVEL_DEBUG, PSTR("ETH: Mac %s, IPAddress %_I, Hostname %s"), + ETH.macAddress().c_str(), (uint32_t)ETH.localIP(), eth_hostname); Settings.ipv4_address[1] = (uint32_t)ETH.gatewayIP(); Settings.ipv4_address[2] = (uint32_t)ETH.subnetMask(); Settings.ipv4_address[3] = (uint32_t)ETH.dnsIP();