Fix ESP32 ethernet broken by core 2.x

- Fix ESP32 ethernet broken by core 2.x
- Change ethernet hostname ending in ``_eth`` to ``-eth`` according to RFC952
This commit is contained in:
Theo Arends 2021-11-21 13:30:05 +01:00
parent 99388bd654
commit ced7aa5a08
3 changed files with 13 additions and 8 deletions

View File

@ -11,14 +11,17 @@ All notable changes to this project will be documented in this file.
- WS2812 scheme 13 stairs effect (#13595) - WS2812 scheme 13 stairs effect (#13595)
- Preliminary support for Tasmota Apps (.tapp extesions) - Preliminary support for Tasmota Apps (.tapp extesions)
- Berry support for neopixel (WS2812, SK6812) - Berry support for neopixel (WS2812, SK6812)
- Command ``IfxPeriod `` to overrule ``Teleperiod`` for Influx messages (#13750)
### Changed ### Changed
- ESP8266 Gratuitous ARP enabled and set to 60 seconds (#13623) - ESP8266 Gratuitous ARP enabled and set to 60 seconds (#13623)
- Removed ILI9488 driver in favor of Unversal Display Driver - Removed ILI9488 driver in favor of Unversal Display Driver
- IRremoteESP8266 library from v2.7.20 to v2.8.0 (#13738) - IRremoteESP8266 library from v2.7.20 to v2.8.0 (#13738)
- Ethernet hostname ending in ``_eth`` to ``-eth`` according to RFC952
### Fixed ### Fixed
- ESP32 analog NTC temperature calculation (#13703) - ESP32 analog NTC temperature calculation (#13703)
- ESP32 ethernet broken by core 2.x
### Removed ### Removed
- ILI9488 driver in favour of Universal Display driver (#13719) - ILI9488 driver in favour of Universal Display driver (#13719)

View File

@ -108,6 +108,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
- Command ``TcpConfig`` for TCPBridge protocol configuration [#13565](https://github.com/arendst/Tasmota/issues/13565) - Command ``TcpConfig`` for TCPBridge protocol configuration [#13565](https://github.com/arendst/Tasmota/issues/13565)
- Support for HDC2010 temperature/humidity sensor by Luc Boudreau [#13633](https://github.com/arendst/Tasmota/issues/13633) - Support for HDC2010 temperature/humidity sensor by Luc Boudreau [#13633](https://github.com/arendst/Tasmota/issues/13633)
- WS2812 scheme 13 stairs effect [#13595](https://github.com/arendst/Tasmota/issues/13595) - WS2812 scheme 13 stairs effect [#13595](https://github.com/arendst/Tasmota/issues/13595)
- Command ``IfxPeriod `` to overrule ``Teleperiod`` for Influx messages [#13750](https://github.com/arendst/Tasmota/issues/13750)
### Breaking Changed ### Breaking Changed
- ESP32-S2 TSettings memory usage fixed to 4096 bytes regression from v9.5.0.8 - ESP32-S2 TSettings memory usage fixed to 4096 bytes regression from v9.5.0.8
@ -118,6 +119,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
- IRremoteESP8266 library from v2.7.20 to v2.8.0 - IRremoteESP8266 library from v2.7.20 to v2.8.0
- File editor no-wrap [#13427](https://github.com/arendst/Tasmota/issues/13427) - File editor no-wrap [#13427](https://github.com/arendst/Tasmota/issues/13427)
- ESP8266 Gratuitous ARP enabled and set to 60 seconds [#13623](https://github.com/arendst/Tasmota/issues/13623) - ESP8266 Gratuitous ARP enabled and set to 60 seconds [#13623](https://github.com/arendst/Tasmota/issues/13623)
- Ethernet hostname ending in ``_eth`` to ``-eth`` according to RFC952
### Fixed ### Fixed
- Initial reset RTC memory based variables like EnergyToday and EnergyTotal - Initial reset RTC memory based variables like EnergyToday and EnergyTotal

View File

@ -86,15 +86,15 @@ char eth_hostname[sizeof(TasmotaGlobal.hostname)];
void EthernetEvent(WiFiEvent_t event) { void EthernetEvent(WiFiEvent_t event) {
switch (event) { switch (event) {
case SYSTEM_EVENT_ETH_START: case ARDUINO_EVENT_ETH_START:
AddLog(LOG_LEVEL_DEBUG, PSTR("ETH: " D_ATTEMPTING_CONNECTION)); AddLog(LOG_LEVEL_DEBUG, PSTR("ETH: " D_ATTEMPTING_CONNECTION));
ETH.setHostname(eth_hostname); ETH.setHostname(eth_hostname);
break; break;
case SYSTEM_EVENT_ETH_CONNECTED: case ARDUINO_EVENT_ETH_CONNECTED:
AddLog(LOG_LEVEL_INFO, PSTR("ETH: " D_CONNECTED " at %dMbps%s"), AddLog(LOG_LEVEL_INFO, PSTR("ETH: " D_CONNECTED " at %dMbps%s"),
ETH.linkSpeed(), (ETH.fullDuplex()) ? " Full Duplex" : ""); ETH.linkSpeed(), (ETH.fullDuplex()) ? " Full Duplex" : "");
break; break;
case SYSTEM_EVENT_ETH_GOT_IP: case ARDUINO_EVENT_ETH_GOT_IP:
AddLog(LOG_LEVEL_DEBUG, PSTR("ETH: Mac %s, IPAddress %_I, Hostname %s"), AddLog(LOG_LEVEL_DEBUG, PSTR("ETH: Mac %s, IPAddress %_I, Hostname %s"),
ETH.macAddress().c_str(), (uint32_t)ETH.localIP(), eth_hostname); ETH.macAddress().c_str(), (uint32_t)ETH.localIP(), eth_hostname);
Settings->ipv4_address[1] = (uint32_t)ETH.gatewayIP(); Settings->ipv4_address[1] = (uint32_t)ETH.gatewayIP();
@ -103,11 +103,11 @@ void EthernetEvent(WiFiEvent_t event) {
Settings->ipv4_address[4] = (uint32_t)ETH.dnsIP(1); Settings->ipv4_address[4] = (uint32_t)ETH.dnsIP(1);
TasmotaGlobal.global_state.eth_down = 0; TasmotaGlobal.global_state.eth_down = 0;
break; break;
case SYSTEM_EVENT_ETH_DISCONNECTED: case ARDUINO_EVENT_ETH_DISCONNECTED:
AddLog(LOG_LEVEL_INFO, PSTR("ETH: Disconnected")); AddLog(LOG_LEVEL_INFO, PSTR("ETH: Disconnected"));
TasmotaGlobal.global_state.eth_down = 1; TasmotaGlobal.global_state.eth_down = 1;
break; break;
case SYSTEM_EVENT_ETH_STOP: case ARDUINO_EVENT_ETH_STOP:
AddLog(LOG_LEVEL_DEBUG, PSTR("ETH: Stopped")); AddLog(LOG_LEVEL_DEBUG, PSTR("ETH: Stopped"));
TasmotaGlobal.global_state.eth_down = 1; TasmotaGlobal.global_state.eth_down = 1;
break; break;
@ -129,9 +129,9 @@ void EthernetInit(void) {
Settings->eth_clk_mode = ETH_CLOCK_GPIO0_IN; // EthClockMode Settings->eth_clk_mode = ETH_CLOCK_GPIO0_IN; // EthClockMode
} }
// snprintf_P(Eth.hostname, sizeof(Eth.hostname), PSTR("%s_eth"), TasmotaGlobal.hostname); // snprintf_P(Eth.hostname, sizeof(Eth.hostname), PSTR("%s-eth"), TasmotaGlobal.hostname);
strlcpy(eth_hostname, TasmotaGlobal.hostname, sizeof(eth_hostname) -5); // Make sure there is room for "_eth" strlcpy(eth_hostname, TasmotaGlobal.hostname, sizeof(eth_hostname) -5); // Make sure there is room for "-eth"
strcat(eth_hostname, "_eth"); strcat(eth_hostname, "-eth");
WiFi.onEvent(EthernetEvent); WiFi.onEvent(EthernetEvent);