From ff08501b396c0e5ab5c9b51db4640bea08dd4ff2 Mon Sep 17 00:00:00 2001 From: polarduck-dev Date: Mon, 18 Jan 2021 15:32:58 +0000 Subject: [PATCH 1/3] fixed IPv6 address acquisition --- platformio.ini | 2 +- tasmota/my_user_config.h | 8 ++-- tasmota/settings.h | 2 +- tasmota/settings.ino | 8 ++-- tasmota/support.ino | 8 ++-- tasmota/support_command.ino | 14 +++---- tasmota/support_device_groups.ino | 15 ++----- tasmota/support_wifi.ino | 57 +++++++++------------------ tasmota/user_config_override_sample.h | 12 +++--- tasmota/xdrv_01_webserver.ino | 6 +-- tasmota/xdrv_10_scripter.ino | 9 +---- tasmota/xdrv_82_ethernet.ino | 6 +-- 12 files changed, 56 insertions(+), 91 deletions(-) diff --git a/platformio.ini b/platformio.ini index 12ccfcc90..6de5f5f55 100644 --- a/platformio.ini +++ b/platformio.ini @@ -133,7 +133,7 @@ build_flags = ${esp_defaults.build_flags} -DBEARSSL_SSL_BASIC ; NONOSDK22x_190703 = 2.2.2-dev(38a443e) -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190703 - -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH + -DPIO_FRAMEWORK_ARDUINO_LWIP2_IPV6_HIGHER_BANDWIDTH ; VTABLES in Flash -DVTABLES_IN_FLASH ; remove the 4-bytes alignment for PSTR() diff --git a/tasmota/my_user_config.h b/tasmota/my_user_config.h index 8cf0316f8..b66d04a31 100644 --- a/tasmota/my_user_config.h +++ b/tasmota/my_user_config.h @@ -65,10 +65,10 @@ #define BOOT_LOOP_OFFSET 1 // [SetOption36] Number of boot loops before starting restoring defaults (0 = disable, 1..200 = boot loops offset) // -- Wifi ---------------------------------------- -#define WIFI_IP_ADDRESS "0.0.0.0" // [IpAddress1] Set to 0.0.0.0 for using DHCP or enter a static IP address -#define WIFI_GATEWAY "192.168.1.1" // [IpAddress2] If not using DHCP set Gateway IP address -#define WIFI_SUBNETMASK "255.255.255.0" // [IpAddress3] If not using DHCP set Network mask -#define WIFI_DNS "192.168.1.1" // [IpAddress4] If not using DHCP set DNS IP address (might be equal to WIFI_GATEWAY) +#define WIFI_IPV4_ADDRESS "0.0.0.0" // [IpAddress1] Set to 0.0.0.0 for using DHCP or enter a static IP address +#define WIFI_IPV4_GATEWAY "192.168.1.1" // [IpAddress2] If not using DHCP set Gateway IP address +#define WIFI_IPV4_SUBNETMASK "255.255.255.0" // [IpAddress3] If not using DHCP set Network mask +#define WIFI_IPV4_DNS "192.168.1.1" // [IpAddress4] If not using DHCP set DNS IP address (might be equal to WIFI_GATEWAY) #define STA_SSID1 "" // [Ssid1] Wifi SSID #define STA_PASS1 "" // [Password1] Wifi password diff --git a/tasmota/settings.h b/tasmota/settings.h index 32d8b8871..5a5317673 100644 --- a/tasmota/settings.h +++ b/tasmota/settings.h @@ -497,7 +497,7 @@ struct { uint8_t ina219_mode; // 531 uint16_t pulse_timer[MAX_PULSETIMERS]; // 532 uint16_t button_debounce; // 542 - uint32_t ip_address[4]; // 544 + uint32_t ipv4_address[4]; // 544 unsigned long energy_kWhtotal; // 554 char ex_mqtt_fulltopic[100]; // 558 Free since 8.0.0.1 diff --git a/tasmota/settings.ino b/tasmota/settings.ino index b2d438df6..5421e7c8a 100644 --- a/tasmota/settings.ino +++ b/tasmota/settings.ino @@ -812,10 +812,10 @@ void SettingsDefaultSet2(void) flag3.use_wifi_rescan |= WIFI_SCAN_REGULARLY; Settings.wifi_output_power = 170; Settings.param[P_ARP_GRATUITOUS] = WIFI_ARP_INTERVAL; - ParseIp(&Settings.ip_address[0], WIFI_IP_ADDRESS); - ParseIp(&Settings.ip_address[1], WIFI_GATEWAY); - ParseIp(&Settings.ip_address[2], WIFI_SUBNETMASK); - ParseIp(&Settings.ip_address[3], WIFI_DNS); + ParseIPv4(&Settings.ipv4_address[0], WIFI_IPV4_ADDRESS); + ParseIPv4(&Settings.ipv4_address[1], WIFI_IPV4_GATEWAY); + ParseIPv4(&Settings.ipv4_address[2], WIFI_IPV4_SUBNETMASK); + ParseIPv4(&Settings.ipv4_address[3], WIFI_IPV4_DNS); Settings.sta_config = WIFI_CONFIG_TOOL; // Settings.sta_active = 0; SettingsUpdateText(SET_STASSID1, PSTR(STA_SSID1)); diff --git a/tasmota/support.ino b/tasmota/support.ino index 0d5ce5b94..730778d48 100644 --- a/tasmota/support.ino +++ b/tasmota/support.ino @@ -655,13 +655,11 @@ uint8_t Shortcut(void) bool ValidIpAddress(const char* str) { - const char* p = str; - - while (*p && ((*p == '.') || ((*p >= '0') && (*p <= '9')))) { p++; } - return (*p == '\0'); + IPAddress ip_address; + return ip_address.fromString(str); } -bool ParseIp(uint32_t* addr, const char* str) +bool ParseIPv4(uint32_t* addr, const char* str) { uint8_t *part = (uint8_t*)addr; uint8_t i; diff --git a/tasmota/support_command.ino b/tasmota/support_command.ino index 1c5e32474..98b198216 100644 --- a/tasmota/support_command.ino +++ b/tasmota/support_command.ino @@ -510,8 +510,8 @@ void CmndStatus(void) Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS5_NETWORK "\":{\"" D_CMND_HOSTNAME "\":\"%s\",\"" D_CMND_IPADDRESS "\":\"%s\",\"" D_JSON_GATEWAY "\":\"%s\",\"" D_JSON_SUBNETMASK "\":\"%s\",\"" D_JSON_DNSSERVER "\":\"%s\",\"" D_JSON_MAC "\":\"%s\",\"" D_CMND_WEBSERVER "\":%d,\"" D_CMND_WIFICONFIG "\":%d,\"" D_CMND_WIFIPOWER "\":%s}}"), - NetworkHostname(), NetworkAddress().toString().c_str(), IPAddress(Settings.ip_address[1]).toString().c_str(), - IPAddress(Settings.ip_address[2]).toString().c_str(), IPAddress(Settings.ip_address[3]).toString().c_str(), NetworkMacAddress().c_str(), + NetworkHostname(), NetworkAddress().toString().c_str(), IPAddress(Settings.ipv4_address[1]).toString().c_str(), + IPAddress(Settings.ipv4_address[2]).toString().c_str(), IPAddress(Settings.ipv4_address[3]).toString().c_str(), NetworkMacAddress().c_str(), Settings.webserver, Settings.sta_config, WifiGetOutputPower().c_str()); MqttPublishPrefixTopic_P(STAT, PSTR(D_CMND_STATUS "5")); } @@ -1497,18 +1497,18 @@ void CmndIpAddress(void) snprintf_P(stemp1, sizeof(stemp1), PSTR(" %s"), NetworkAddress().toString().c_str()); ResponseClear(); for (uint32_t i = 0; i < 4; i++) { - ResponseAppend_P(PSTR("%c\"%s%d\":\"%s%s\""), (i) ? ',' : '{', XdrvMailbox.command, i +1, IPAddress(Settings.ip_address[i]).toString().c_str(), (0 == i) ? stemp1:""); + ResponseAppend_P(PSTR("%c\"%s%d\":\"%s%s\""), (i) ? ',' : '{', XdrvMailbox.command, i +1, IPAddress(Settings.ipv4_address[i]).toString().c_str(), (0 == i) ? stemp1:""); } ResponseJsonEnd(); } else { - uint32_t address; - if (ParseIp(&address, XdrvMailbox.data)) { - Settings.ip_address[XdrvMailbox.index -1] = address; + uint32_t ipv4_address; + if (ParseIPv4(&ipv4_address, XdrvMailbox.data)) { + Settings.ipv4_address[XdrvMailbox.index -1] = ipv4_address; // TasmotaGlobal.restart_flag = 2; } char stemp1[TOPSZ]; snprintf_P(stemp1, sizeof(stemp1), PSTR(" %s"), NetworkAddress().toString().c_str()); - Response_P(S_JSON_COMMAND_INDEX_SVALUE_SVALUE, XdrvMailbox.command, XdrvMailbox.index, IPAddress(Settings.ip_address[XdrvMailbox.index -1]).toString().c_str(), (1 == XdrvMailbox.index) ? stemp1:""); + Response_P(S_JSON_COMMAND_INDEX_SVALUE_SVALUE, XdrvMailbox.command, XdrvMailbox.index, IPAddress(Settings.ipv4_address[XdrvMailbox.index -1]).toString().c_str(), (1 == XdrvMailbox.index) ? stemp1:""); } } } diff --git a/tasmota/support_device_groups.ino b/tasmota/support_device_groups.ino index e5b00cba2..5ab856cd6 100644 --- a/tasmota/support_device_groups.ino +++ b/tasmota/support_device_groups.ino @@ -66,13 +66,6 @@ bool device_groups_up = false; bool building_status_message = false; bool ignore_dgr_sends = false; -char * IPAddressToString(const IPAddress& ip_address) -{ - static char buffer[16]; - sprintf_P(buffer, PSTR("%u.%u.%u.%u"), ip_address[0], ip_address[1], ip_address[2], ip_address[3]); - return buffer; -} - uint8_t * BeginDeviceGroupMessage(struct device_group * device_group, uint16_t flags, bool hold_sequence = false) { uint8_t * message_ptr = &device_group->message[device_group->message_header_length]; @@ -225,7 +218,7 @@ void SendReceiveDeviceGroupMessage(struct device_group * device_group, struct de flags |= *message_ptr++ << 8; // Initialize the log buffer. - log_length = sprintf(log_buffer, PSTR("DGR: %s %s message %s %s: seq=%u, flags=%u"), (received ? PSTR("Received") : PSTR("Sending")), device_group->group_name, (received ? PSTR("from") : PSTR("to")), (device_group_member ? IPAddressToString(device_group_member->ip_address) : received ? PSTR("local") : PSTR("network")), message_sequence, flags); + log_length = sprintf(log_buffer, PSTR("DGR: %s %s message %s %s: seq=%u, flags=%u"), (received ? PSTR("Received") : PSTR("Sending")), device_group->group_name, (received ? PSTR("from") : PSTR("to")), (device_group_member ? device_group_member->ip_address.toString().c_str() : received ? PSTR("local") : PSTR("network")), message_sequence, flags); log_ptr = log_buffer + log_length; log_remaining = sizeof(log_buffer) - log_length; @@ -777,7 +770,7 @@ void ProcessDeviceGroupMessage(uint8_t * message, int message_length) } device_group_member->ip_address = remote_ip; *flink = device_group_member; - AddLog_P(LOG_LEVEL_DEBUG, PSTR("DGR: Member %s added"), IPAddressToString(remote_ip)); + AddLog_P(LOG_LEVEL_DEBUG, PSTR("DGR: Member %s added"), remote_ip.toString().c_str()); break; } else if (device_group_member->ip_address == remote_ip) { @@ -797,7 +790,7 @@ void DeviceGroupStatus(uint8_t device_group_index) struct device_group * device_group = &device_groups[device_group_index]; buffer[0] = buffer[1] = 0; for (struct device_group_member * device_group_member = device_group->device_group_members; device_group_member; device_group_member = device_group_member->flink) { - snprintf_P(buffer, sizeof(buffer), PSTR("%s,{\"IPAddress\":\"%s\",\"ResendCount\":%u,\"LastRcvdSeq\":%u,\"LastAckedSeq\":%u}"), buffer, IPAddressToString(device_group_member->ip_address), device_group_member->unicast_count, device_group_member->received_sequence, device_group_member->acked_sequence); + snprintf_P(buffer, sizeof(buffer), PSTR("%s,{\"IPAddress\":\"%s\",\"ResendCount\":%u,\"LastRcvdSeq\":%u,\"LastAckedSeq\":%u}"), buffer, device_group_member->ip_address.toString().c_str(), device_group_member->unicast_count, device_group_member->received_sequence, device_group_member->acked_sequence); member_count++; } Response_P(PSTR("{\"" D_CMND_DEVGROUPSTATUS "\":{\"Index\":%u,\"GroupName\":\"%s\",\"MessageSeq\":%u,\"MemberCount\":%d,\"Members\":[%s]}}"), device_group_index, device_group->group_name, device_group->outgoing_sequence, member_count, &buffer[1]); @@ -874,7 +867,7 @@ AddLog_P(LOG_LEVEL_DEBUG, PSTR("DGR: Checking next_check_time=%u, now=%u"), next if ((long)(now - device_group->member_timeout_time) >= 0) { *flink = device_group_member->flink; free(device_group_member); - AddLog_P(LOG_LEVEL_DEBUG, PSTR("DGR: Member %s removed"), IPAddressToString(device_group_member->ip_address)); + AddLog_P(LOG_LEVEL_DEBUG, PSTR("DGR: Member %s removed"), device_group_member->ip_address.toString().c_str()); continue; } diff --git a/tasmota/support_wifi.ino b/tasmota/support_wifi.ino index 15f5e10c2..ca2180b77 100644 --- a/tasmota/support_wifi.ino +++ b/tasmota/support_wifi.ino @@ -203,8 +203,8 @@ void WifiBegin(uint8_t flag, uint8_t channel) if (!strlen(SettingsText(SET_STASSID1 + Settings.sta_active))) { Settings.sta_active ^= 1; // Skip empty SSID } - if (Settings.ip_address[0]) { - WiFi.config(Settings.ip_address[0], Settings.ip_address[1], Settings.ip_address[2], Settings.ip_address[3]); // Set static IP + if (Settings.ipv4_address[0]) { + WiFi.config(Settings.ipv4_address[0], Settings.ipv4_address[1], Settings.ipv4_address[2], Settings.ipv4_address[3]); // Set static IP } WiFi.hostname(TasmotaGlobal.hostname); @@ -228,9 +228,9 @@ void WifiBegin(uint8_t flag, uint8_t channel) AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI "Got IPv6 global address %s"), addr.toString().c_str()); break; // IPv6 is mandatory but stop after 15 seconds } - delay(500); // Loop until real IPv6 address is aquired or too many tries failed - cfgcnt++; } + delay(500); // Loop until real IPv6 address is aquired or too many tries failed + cfgcnt++; } #endif // LWIP_IPV6=1 } @@ -361,16 +361,6 @@ void WifiSetState(uint8_t state) } #if LWIP_IPV6 -bool WifiCheckIPv6(void) -{ - bool ipv6_global=false; - - for (auto a : addrList) { - if(!a.isLocal() && a.isV6()) ipv6_global=true; - } - return ipv6_global; -} - String WifiGetIPv6(void) { for (auto a : addrList) { @@ -378,35 +368,30 @@ String WifiGetIPv6(void) } return ""; } - -bool WifiCheckIPAddrStatus(void) // Return false for 169.254.x.x or fe80::/64 -{ - bool ip_global=false; - - for (auto a : addrList) { - if(!a.isLocal()) ip_global=true; - } - return ip_global; -} #endif // LWIP_IPV6=1 +// Check to see if we have any routable IP address +inline bool WifiCheck_hasIP(IPAddress const & ip_address) +{ +#ifdef LWIP2_IPV6 + return !a.isLocal(); +#else + return static_cast(ip_address) != 0; +#endif +} + void WifiCheckIp(void) { -#if LWIP_IPV6 - if(WifiCheckIPAddrStatus()) { - Wifi.status = WL_CONNECTED; -#else - if ((WL_CONNECTED == WiFi.status()) && (static_cast(WiFi.localIP()) != 0)) { -#endif // LWIP_IPV6=1 + if ((WL_CONNECTED == WiFi.status()) && WifiCheck_hasIP(WiFi.localIP())) { WifiSetState(1); Wifi.counter = WIFI_CHECK_SEC; Wifi.retry = Wifi.retry_init; if (Wifi.status != WL_CONNECTED) { AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECTED)); // AddLog_P(LOG_LEVEL_INFO, PSTR("Wifi: Set IP addresses")); - Settings.ip_address[1] = (uint32_t)WiFi.gatewayIP(); - Settings.ip_address[2] = (uint32_t)WiFi.subnetMask(); - Settings.ip_address[3] = (uint32_t)WiFi.dnsIP(); + Settings.ipv4_address[1] = (uint32_t)WiFi.gatewayIP(); + Settings.ipv4_address[2] = (uint32_t)WiFi.subnetMask(); + Settings.ipv4_address[3] = (uint32_t)WiFi.dnsIP(); // Save current AP parameters for quick reconnect Settings.wifi_channel = WiFi.channel(); @@ -521,11 +506,7 @@ void WifiCheck(uint8_t param) Wifi.counter = WIFI_CHECK_SEC; WifiCheckIp(); } -#if LWIP_IPV6 - if (WifiCheckIPAddrStatus()) { -#else - if ((WL_CONNECTED == WiFi.status()) && (static_cast(WiFi.localIP()) != 0) && !Wifi.config_type) { -#endif // LWIP_IPV6=1 + if ((WL_CONNECTED == WiFi.status()) && WifiCheck_hasIP(WiFi.localIP()) && !Wifi.config_type) { WifiSetState(1); if (Settings.flag3.use_wifi_rescan) { // SetOption57 - Scan wifi network every 44 minutes for configured AP's if (!(TasmotaGlobal.uptime % (60 * WIFI_RESCAN_MINUTES))) { diff --git a/tasmota/user_config_override_sample.h b/tasmota/user_config_override_sample.h index d33e5fc75..df151f9b2 100644 --- a/tasmota/user_config_override_sample.h +++ b/tasmota/user_config_override_sample.h @@ -68,18 +68,18 @@ Examples : // Ie: export PLATFORMIO_BUILD_FLAGS='-DUSE_CONFIG_OVERRIDE -DMY_IP="192.168.1.99" -DMY_GW="192.168.1.1" -DMY_DNS="192.168.1.1"' #ifdef MY_IP -#undef WIFI_IP_ADDRESS -#define WIFI_IP_ADDRESS MY_IP // Set to 0.0.0.0 for using DHCP or enter a static IP address +#undef WIFI_IPV4_ADDRESS +#define WIFI_IPV4_ADDRESS MY_IP // Set to 0.0.0.0 for using DHCP or enter a static IP address #endif #ifdef MY_GW -#undef WIFI_GATEWAY -#define WIFI_GATEWAY MY_GW // if not using DHCP set Gateway IP address +#undef WIFI_IPV4_GATEWAY +#define WIFI_IPV4_GATEWAY MY_GW // if not using DHCP set Gateway IP address #endif #ifdef MY_DNS -#undef WIFI_DNS -#define WIFI_DNS MY_DNS // If not using DHCP set DNS IP address (might be equal to WIFI_GATEWAY) +#undef WIFI_IPV4_DNS +#define WIFI_IPV4_DNS MY_DNS // If not using DHCP set DNS IP address (might be equal to WIFI_GATEWAY) #endif */ diff --git a/tasmota/xdrv_01_webserver.ino b/tasmota/xdrv_01_webserver.ino index 42cbf1af4..c7791653e 100644 --- a/tasmota/xdrv_01_webserver.ino +++ b/tasmota/xdrv_01_webserver.ino @@ -2110,9 +2110,9 @@ void HandleInformation(void) } } if (!TasmotaGlobal.global_state.network_down) { - WSContentSend_P(PSTR("}1" D_GATEWAY "}2%s"), IPAddress(Settings.ip_address[1]).toString().c_str()); - WSContentSend_P(PSTR("}1" D_SUBNET_MASK "}2%s"), IPAddress(Settings.ip_address[2]).toString().c_str()); - WSContentSend_P(PSTR("}1" D_DNS_SERVER "}2%s"), IPAddress(Settings.ip_address[3]).toString().c_str()); + WSContentSend_P(PSTR("}1" D_GATEWAY "}2%s"), IPAddress(Settings.ipv4_address[1]).toString().c_str()); + WSContentSend_P(PSTR("}1" D_SUBNET_MASK "}2%s"), IPAddress(Settings.ipv4_address[2]).toString().c_str()); + WSContentSend_P(PSTR("}1" D_DNS_SERVER "}2%s"), IPAddress(Settings.ipv4_address[3]).toString().c_str()); } if ((WiFi.getMode() >= WIFI_AP) && (static_cast(WiFi.softAPIP()) != 0)) { WSContentSend_P(PSTR("}1
}2
")); diff --git a/tasmota/xdrv_10_scripter.ino b/tasmota/xdrv_10_scripter.ino index cd07098f8..a04131ae5 100755 --- a/tasmota/xdrv_10_scripter.ino +++ b/tasmota/xdrv_10_scripter.ino @@ -477,13 +477,6 @@ bool event_handeled = false; IPAddress last_udp_ip; WiFiUDP Script_PortUdp; -#ifndef USE_DEVICE_GROUPS -char * IPAddressToString(const IPAddress& ip_address) { - static char ipbuffer[16]; - sprintf_P(ipbuffer, PSTR("%u.%u.%u.%u"), ip_address[0], ip_address[1], ip_address[2], ip_address[3]); - return ipbuffer; -} -#endif //USE_DEVICE_GROUPS #endif //USE_SCRIPT_GLOBVARS int16_t last_findex; @@ -2525,7 +2518,7 @@ chknext: } #ifdef USE_SCRIPT_GLOBVARS if (!strncmp(vname, "luip", 4)) { - if (sp) strlcpy(sp, IPAddressToString(last_udp_ip), glob_script_mem.max_ssize); + if (sp) strlcpy(sp, last_udp_ip.toString().c_str(), glob_script_mem.max_ssize); goto strexit; } #endif //USE_SCRIPT_GLOBVARS diff --git a/tasmota/xdrv_82_ethernet.ino b/tasmota/xdrv_82_ethernet.ino index 7d7ae3c59..d169b3e2e 100644 --- a/tasmota/xdrv_82_ethernet.ino +++ b/tasmota/xdrv_82_ethernet.ino @@ -95,9 +95,9 @@ void EthernetEvent(WiFiEvent_t event) { case SYSTEM_EVENT_ETH_GOT_IP: AddLog_P(LOG_LEVEL_DEBUG, PSTR("ETH: Mac %s, IPAddress %s, Hostname %s"), ETH.macAddress().c_str(), ETH.localIP().toString().c_str(), eth_hostname); - Settings.ip_address[1] = (uint32_t)ETH.gatewayIP(); - Settings.ip_address[2] = (uint32_t)ETH.subnetMask(); - Settings.ip_address[3] = (uint32_t)ETH.dnsIP(); + Settings.ipv4_address[1] = (uint32_t)ETH.gatewayIP(); + Settings.ipv4_address[2] = (uint32_t)ETH.subnetMask(); + Settings.ipv4_address[3] = (uint32_t)ETH.dnsIP(); TasmotaGlobal.global_state.eth_down = 0; break; case SYSTEM_EVENT_ETH_DISCONNECTED: From e14f464a236654c52557d3b0be1e4fb3270462c0 Mon Sep 17 00:00:00 2001 From: polarduck-dev <77441368+polarduck-dev@users.noreply.github.com> Date: Tue, 19 Jan 2021 16:33:06 +0000 Subject: [PATCH 2/3] Removed IPV4 from the existing macros so the change is externally minimal --- platformio.ini | 2 +- tasmota/my_user_config.h | 8 ++++---- tasmota/settings.ino | 8 ++++---- tasmota/user_config_override_sample.h | 12 ++++++------ 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/platformio.ini b/platformio.ini index 6de5f5f55..12ccfcc90 100644 --- a/platformio.ini +++ b/platformio.ini @@ -133,7 +133,7 @@ build_flags = ${esp_defaults.build_flags} -DBEARSSL_SSL_BASIC ; NONOSDK22x_190703 = 2.2.2-dev(38a443e) -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190703 - -DPIO_FRAMEWORK_ARDUINO_LWIP2_IPV6_HIGHER_BANDWIDTH + -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH ; VTABLES in Flash -DVTABLES_IN_FLASH ; remove the 4-bytes alignment for PSTR() diff --git a/tasmota/my_user_config.h b/tasmota/my_user_config.h index b66d04a31..8cf0316f8 100644 --- a/tasmota/my_user_config.h +++ b/tasmota/my_user_config.h @@ -65,10 +65,10 @@ #define BOOT_LOOP_OFFSET 1 // [SetOption36] Number of boot loops before starting restoring defaults (0 = disable, 1..200 = boot loops offset) // -- Wifi ---------------------------------------- -#define WIFI_IPV4_ADDRESS "0.0.0.0" // [IpAddress1] Set to 0.0.0.0 for using DHCP or enter a static IP address -#define WIFI_IPV4_GATEWAY "192.168.1.1" // [IpAddress2] If not using DHCP set Gateway IP address -#define WIFI_IPV4_SUBNETMASK "255.255.255.0" // [IpAddress3] If not using DHCP set Network mask -#define WIFI_IPV4_DNS "192.168.1.1" // [IpAddress4] If not using DHCP set DNS IP address (might be equal to WIFI_GATEWAY) +#define WIFI_IP_ADDRESS "0.0.0.0" // [IpAddress1] Set to 0.0.0.0 for using DHCP or enter a static IP address +#define WIFI_GATEWAY "192.168.1.1" // [IpAddress2] If not using DHCP set Gateway IP address +#define WIFI_SUBNETMASK "255.255.255.0" // [IpAddress3] If not using DHCP set Network mask +#define WIFI_DNS "192.168.1.1" // [IpAddress4] If not using DHCP set DNS IP address (might be equal to WIFI_GATEWAY) #define STA_SSID1 "" // [Ssid1] Wifi SSID #define STA_PASS1 "" // [Password1] Wifi password diff --git a/tasmota/settings.ino b/tasmota/settings.ino index 5421e7c8a..60c303452 100644 --- a/tasmota/settings.ino +++ b/tasmota/settings.ino @@ -812,10 +812,10 @@ void SettingsDefaultSet2(void) flag3.use_wifi_rescan |= WIFI_SCAN_REGULARLY; Settings.wifi_output_power = 170; Settings.param[P_ARP_GRATUITOUS] = WIFI_ARP_INTERVAL; - ParseIPv4(&Settings.ipv4_address[0], WIFI_IPV4_ADDRESS); - ParseIPv4(&Settings.ipv4_address[1], WIFI_IPV4_GATEWAY); - ParseIPv4(&Settings.ipv4_address[2], WIFI_IPV4_SUBNETMASK); - ParseIPv4(&Settings.ipv4_address[3], WIFI_IPV4_DNS); + ParseIPv4(&Settings.ipv4_address[0], WIFI_IP_ADDRESS); + ParseIPv4(&Settings.ipv4_address[1], WIFI_GATEWAY); + ParseIPv4(&Settings.ipv4_address[2], WIFI_SUBNETMASK); + ParseIPv4(&Settings.ipv4_address[3], WIFI_DNS); Settings.sta_config = WIFI_CONFIG_TOOL; // Settings.sta_active = 0; SettingsUpdateText(SET_STASSID1, PSTR(STA_SSID1)); diff --git a/tasmota/user_config_override_sample.h b/tasmota/user_config_override_sample.h index df151f9b2..cf5f27a25 100644 --- a/tasmota/user_config_override_sample.h +++ b/tasmota/user_config_override_sample.h @@ -68,18 +68,18 @@ Examples : // Ie: export PLATFORMIO_BUILD_FLAGS='-DUSE_CONFIG_OVERRIDE -DMY_IP="192.168.1.99" -DMY_GW="192.168.1.1" -DMY_DNS="192.168.1.1"' #ifdef MY_IP -#undef WIFI_IPV4_ADDRESS -#define WIFI_IPV4_ADDRESS MY_IP // Set to 0.0.0.0 for using DHCP or enter a static IP address +#undef WIFI_IP_ADDRESS +#define WIFI_IP_ADDRESS MY_IP // Set to 0.0.0.0 for using DHCP or enter a static IP address #endif #ifdef MY_GW -#undef WIFI_IPV4_GATEWAY -#define WIFI_IPV4_GATEWAY MY_GW // if not using DHCP set Gateway IP address +#undef WIFI_GATEWAY +#define WIFI_GATEWAY MY_GW // if not using DHCP set Gateway IP address #endif #ifdef MY_DNS -#undef WIFI_IPV4_DNS -#define WIFI_IPV4_DNS MY_DNS // If not using DHCP set DNS IP address (might be equal to WIFI_GATEWAY) +#undef WIFI_DNS +#define WIFI_DNS MY_DNS // If not using DHCP set DNS IP address (might be equal to WIFI_GATEWAY) #endif */ From be74a768fbabeaef66a02dee795298971544611b Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Wed, 20 Jan 2021 10:44:10 +0100 Subject: [PATCH 3/3] Update support_wifi.ino Correct inifinite loop as timeout would never trigger --- tasmota/support_wifi.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasmota/support_wifi.ino b/tasmota/support_wifi.ino index c56b93e49..4c37b074a 100644 --- a/tasmota/support_wifi.ino +++ b/tasmota/support_wifi.ino @@ -228,9 +228,9 @@ void WifiBegin(uint8_t flag, uint8_t channel) AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI "Got IPv6 global address %s"), addr.toString().c_str()); break; // IPv6 is mandatory but stop after 15 seconds } + delay(500); // Loop until real IPv6 address is aquired or too many tries failed + cfgcnt++; } - delay(500); // Loop until real IPv6 address is aquired or too many tries failed - cfgcnt++; } #endif // LWIP_IPV6=1 }