From 65b7034b0cc92a130a76a6dfb0b90b8b4574544e Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Thu, 29 Jul 2021 16:57:04 +0200 Subject: [PATCH] Support for second DNS server --- CHANGELOG.md | 7 ++++++- RELEASENOTES.md | 4 +++- tasmota/my_user_config.h | 3 ++- tasmota/settings.h | 6 +++--- tasmota/settings.ino | 5 +++++ tasmota/support_command.ino | 8 ++++---- tasmota/support_wifi.ino | 3 ++- tasmota/tasmota_version.h | 2 +- tasmota/user_config_override_sample.h | 7 ++++++- tasmota/xdrv_01_webserver.ino | 3 ++- tasmota/xdrv_82_esp32_ethernet.ino | 1 + 11 files changed, 35 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c63f1363a..0db12e009 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,11 @@ All notable changes to this project will be documented in this file. ## [Unreleased] - Development -## [9.5.0.3] +## [9.5.0.4] +### Added +- Support for second DNS server + +## [9.5.0.3] 20210729 ### Added - Command ``SetSensor1..127 0|1`` to globally disable individual sensor driver - Support for CAN bus and Freedom Won Battery Management System by Marius Bezuidenhout (#12651) @@ -22,6 +26,7 @@ All notable changes to this project will be documented in this file. ### Fixed - Discovery fails when using ``%hostname%`` in a topic (#12710) - ESP32-Solo OTA upgrade +- ESP32 buzzer in PWM mode exception (#12717) ## [9.5.0.2] 20210714 ### Added diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 4942198f2..1417e723d 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -98,11 +98,12 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo [Complete list](BUILDS.md) of available feature and sensors. -## Changelog v9.5.0.3 +## Changelog v9.5.0.4 ### Added - Release of [Tasmota WebInstaller](https://arendst.github.io/Tasmota/) - Command ``SetOption127 1`` to force Wifi in no-sleep mode even if ``Sleep 0`` is not enabled - Command ``SetSensor1..127 0|1`` to globally disable individual sensor driver +- Support for second DNS server - Initial support for Tasmota Mesh (TasMesh) providing node/broker communication using ESP-NOW [#11939](https://github.com/arendst/Tasmota/issues/11939) - Berry ESP32 partition manager [#12465](https://github.com/arendst/Tasmota/issues/12465) - Berry ESP32 support for I2S audio mp3 playback @@ -147,3 +148,4 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo - Wi-Fi initial setup workaround for 11n only routers [#12566](https://github.com/arendst/Tasmota/issues/12566) - ESP32 do not use chip temperature sensor as global temperature if external temperature sensor is used [#12630](https://github.com/arendst/Tasmota/issues/12630) - Discovery fails when using ``%hostname%`` in a topic [#12710](https://github.com/arendst/Tasmota/issues/12710) +- ESP32 buzzer in PWM mode exception (#12717)[#12717](https://github.com/arendst/Tasmota/issues/12717) diff --git a/tasmota/my_user_config.h b/tasmota/my_user_config.h index 16df7aa0a..e7d94b684 100644 --- a/tasmota/my_user_config.h +++ b/tasmota/my_user_config.h @@ -68,7 +68,8 @@ #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_DNS "192.168.1.1" // [IpAddress4] If not using DHCP set DNS1 IP address (might be equal to WIFI_GATEWAY) +#define WIFI_DNS2 "0.0.0.0" // [IpAddress5] If not using DHCP set DNS2 IP address (might be equal to WIFI_GATEWAY) #define STA_SSID1 "" // [Ssid1] Wi-Fi SSID #define STA_PASS1 "" // [Password1] Wi-Fi password diff --git a/tasmota/settings.h b/tasmota/settings.h index 6ade9fc44..150e5558d 100644 --- a/tasmota/settings.h +++ b/tasmota/settings.h @@ -598,8 +598,7 @@ typedef struct { uint8_t ina219_mode; // 531 uint16_t pulse_timer[MAX_PULSETIMERS]; // 532 uint16_t button_debounce; // 542 - uint32_t ipv4_address[4]; // 544 - unsigned long energy_kWhtotal; // 554 + uint32_t ipv4_address[5]; // 544 uint8_t free_558[100]; // 558 @@ -737,10 +736,11 @@ typedef struct { uint16_t shd_warmup_brightness; // F5C uint8_t shd_warmup_time; // F5E - uint8_t free_f5f[65]; // F5F - Decrement if adding new Setting variables just above and below + uint8_t free_f5f[61]; // F5F - Decrement if adding new Setting variables just above and below // Only 32 bit boundary variables below + unsigned long energy_kWhtotal; // F9C SBitfield1 sbflag1; // FA0 TeleinfoCfg teleinfo; // FA4 uint64_t rf_protocol_mask; // FA8 diff --git a/tasmota/settings.ino b/tasmota/settings.ino index 177df024b..f751ede1d 100644 --- a/tasmota/settings.ino +++ b/tasmota/settings.ino @@ -859,6 +859,7 @@ void SettingsDefaultSet2(void) { ParseIPv4(&Settings->ipv4_address[1], PSTR(WIFI_GATEWAY)); ParseIPv4(&Settings->ipv4_address[2], PSTR(WIFI_SUBNETMASK)); ParseIPv4(&Settings->ipv4_address[3], PSTR(WIFI_DNS)); + ParseIPv4(&Settings->ipv4_address[4], PSTR(WIFI_DNS2)); Settings->sta_config = WIFI_CONFIG_TOOL; // Settings->sta_active = 0; SettingsUpdateText(SET_STASSID1, PSTR(STA_SSID1)); @@ -1376,6 +1377,10 @@ void SettingsDelta(void) { if (Settings->version < 0x09050003) { memset(&Settings->sensors, 0xFF, 16); // Enable all possible sensors } + if (Settings->version < 0x09050004) { + Settings->energy_kWhtotal = Settings->ipv4_address[4]; + ParseIPv4(&Settings->ipv4_address[4], PSTR(WIFI_DNS2)); + } Settings->version = VERSION; SettingsSave(1); diff --git a/tasmota/support_command.ino b/tasmota/support_command.ino index cad553579..253e5551c 100644 --- a/tasmota/support_command.ino +++ b/tasmota/support_command.ino @@ -567,10 +567,10 @@ void CmndStatus(void) if ((0 == payload) || (5 == payload)) { Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS5_NETWORK "\":{\"" D_CMND_HOSTNAME "\":\"%s\",\"" D_CMND_IPADDRESS "\":\"%_I\",\"" - D_JSON_GATEWAY "\":\"%_I\",\"" D_JSON_SUBNETMASK "\":\"%_I\",\"" D_JSON_DNSSERVER "\":\"%_I\",\"" + D_JSON_GATEWAY "\":\"%_I\",\"" D_JSON_SUBNETMASK "\":\"%_I\",\"" D_JSON_DNSSERVER "1\":\"%_I\",\"" D_JSON_DNSSERVER "2\":\"%_I\",\"" D_JSON_MAC "\":\"%s\",\"" D_CMND_WEBSERVER "\":%d,\"" D_CMND_WIFICONFIG "\":%d,\"" D_CMND_WIFIPOWER "\":%s}}"), NetworkHostname(), (uint32_t)NetworkAddress(), - Settings->ipv4_address[1], Settings->ipv4_address[2], Settings->ipv4_address[3], + Settings->ipv4_address[1], Settings->ipv4_address[2], Settings->ipv4_address[3], Settings->ipv4_address[4], NetworkMacAddress().c_str(), Settings->webserver, Settings->sta_config, WifiGetOutputPower().c_str()); CmndStatusResponse(5); } @@ -1642,12 +1642,12 @@ void CmndLogport(void) void CmndIpAddress(void) { - if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= 4)) { + if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= 5)) { char network_address[22]; ext_snprintf_P(network_address, sizeof(network_address), PSTR(" (%_I)"), (uint32_t)NetworkAddress()); if (!XdrvMailbox.usridx) { ResponseClear(); - for (uint32_t i = 0; i < 4; i++) { + for (uint32_t i = 0; i < 5; i++) { ResponseAppend_P(PSTR("%c\"%s%d\":\"%_I%s\""), (i)?',':'{', XdrvMailbox.command, i +1, Settings->ipv4_address[i], (0 == i)?network_address:""); } ResponseJsonEnd(); diff --git a/tasmota/support_wifi.ino b/tasmota/support_wifi.ino index c7c33291f..4119b0f0e 100644 --- a/tasmota/support_wifi.ino +++ b/tasmota/support_wifi.ino @@ -207,7 +207,7 @@ void WifiBegin(uint8_t flag, uint8_t channel) Settings->sta_active ^= 1; // Skip empty SSID } 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.config(Settings->ipv4_address[0], Settings->ipv4_address[1], Settings->ipv4_address[2], Settings->ipv4_address[3], Settings->ipv4_address[4]); // Set static IP } WiFi.hostname(TasmotaGlobal.hostname); // ESP8266 needs this here (after WiFi.mode) @@ -396,6 +396,7 @@ void WifiCheckIp(void) Settings->ipv4_address[1] = (uint32_t)WiFi.gatewayIP(); Settings->ipv4_address[2] = (uint32_t)WiFi.subnetMask(); Settings->ipv4_address[3] = (uint32_t)WiFi.dnsIP(); + Settings->ipv4_address[4] = (uint32_t)WiFi.dnsIP(1); // Save current AP parameters for quick reconnect Settings->wifi_channel = WiFi.channel(); diff --git a/tasmota/tasmota_version.h b/tasmota/tasmota_version.h index 0f02b3d91..d732eaef6 100644 --- a/tasmota/tasmota_version.h +++ b/tasmota/tasmota_version.h @@ -20,6 +20,6 @@ #ifndef _TASMOTA_VERSION_H_ #define _TASMOTA_VERSION_H_ -const uint32_t VERSION = 0x09050003; +const uint32_t VERSION = 0x09050004; #endif // _TASMOTA_VERSION_H_ diff --git a/tasmota/user_config_override_sample.h b/tasmota/user_config_override_sample.h index 3bfa1269f..896d050eb 100644 --- a/tasmota/user_config_override_sample.h +++ b/tasmota/user_config_override_sample.h @@ -79,7 +79,12 @@ Examples : #define WIFI_DNS MY_DNS // If not using DHCP set DNS IP address (might be equal to WIFI_GATEWAY) #endif -// !!! Remember that your changes GOES AT THE BOTTOM OF THIS FILE right before the last #endif !!! +#ifdef MY_DNS2 +#undef WIFI_DNS2 +#define WIFI_DNS2 MY_DNS2 // If not using DHCP set DNS IP address (might be equal to WIFI_GATEWAY) +#endif + +// !!! Remember that your changes GOES AT THE BOTTOM OF THIS FILE right before the last #endif !!! */ diff --git a/tasmota/xdrv_01_webserver.ino b/tasmota/xdrv_01_webserver.ino index c25c62f33..7041bda45 100644 --- a/tasmota/xdrv_01_webserver.ino +++ b/tasmota/xdrv_01_webserver.ino @@ -2310,7 +2310,8 @@ void HandleInformation(void) if (!TasmotaGlobal.global_state.network_down) { WSContentSend_P(PSTR("}1" D_GATEWAY "}2%_I"), Settings->ipv4_address[1]); WSContentSend_P(PSTR("}1" D_SUBNET_MASK "}2%_I"), Settings->ipv4_address[2]); - WSContentSend_P(PSTR("}1" D_DNS_SERVER "}2%_I"), Settings->ipv4_address[3]); + WSContentSend_P(PSTR("}1" D_DNS_SERVER "1}2%_I"), Settings->ipv4_address[3]); + WSContentSend_P(PSTR("}1" D_DNS_SERVER "2}2%_I"), Settings->ipv4_address[4]); } if ((WiFi.getMode() >= WIFI_AP) && (static_cast(WiFi.softAPIP()) != 0)) { WSContentSend_P(PSTR("}1
}2
")); diff --git a/tasmota/xdrv_82_esp32_ethernet.ino b/tasmota/xdrv_82_esp32_ethernet.ino index b8bb1373b..d276ad7fd 100644 --- a/tasmota/xdrv_82_esp32_ethernet.ino +++ b/tasmota/xdrv_82_esp32_ethernet.ino @@ -100,6 +100,7 @@ void EthernetEvent(WiFiEvent_t event) { Settings->ipv4_address[1] = (uint32_t)ETH.gatewayIP(); Settings->ipv4_address[2] = (uint32_t)ETH.subnetMask(); Settings->ipv4_address[3] = (uint32_t)ETH.dnsIP(); + Settings->ipv4_address[4] = (uint32_t)ETH.dnsIP(1); TasmotaGlobal.global_state.eth_down = 0; break; case SYSTEM_EVENT_ETH_DISCONNECTED: