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)
- Preliminary support for Tasmota Apps (.tapp extesions)
- Berry support for neopixel (WS2812, SK6812)
- Command ``IfxPeriod `` to overrule ``Teleperiod`` for Influx messages (#13750)
### Changed
- ESP8266 Gratuitous ARP enabled and set to 60 seconds (#13623)
- Removed ILI9488 driver in favor of Unversal Display Driver
- IRremoteESP8266 library from v2.7.20 to v2.8.0 (#13738)
- Ethernet hostname ending in ``_eth`` to ``-eth`` according to RFC952
### Fixed
- ESP32 analog NTC temperature calculation (#13703)
- ESP32 ethernet broken by core 2.x
### Removed
- 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)
- 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)
- Command ``IfxPeriod `` to overrule ``Teleperiod`` for Influx messages [#13750](https://github.com/arendst/Tasmota/issues/13750)
### Breaking Changed
- 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
- 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)
- Ethernet hostname ending in ``_eth`` to ``-eth`` according to RFC952
### Fixed
- 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) {
switch (event) {
case SYSTEM_EVENT_ETH_START:
case ARDUINO_EVENT_ETH_START:
AddLog(LOG_LEVEL_DEBUG, PSTR("ETH: " D_ATTEMPTING_CONNECTION));
ETH.setHostname(eth_hostname);
break;
case SYSTEM_EVENT_ETH_CONNECTED:
case ARDUINO_EVENT_ETH_CONNECTED:
AddLog(LOG_LEVEL_INFO, PSTR("ETH: " D_CONNECTED " at %dMbps%s"),
ETH.linkSpeed(), (ETH.fullDuplex()) ? " Full Duplex" : "");
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"),
ETH.macAddress().c_str(), (uint32_t)ETH.localIP(), eth_hostname);
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);
TasmotaGlobal.global_state.eth_down = 0;
break;
case SYSTEM_EVENT_ETH_DISCONNECTED:
case ARDUINO_EVENT_ETH_DISCONNECTED:
AddLog(LOG_LEVEL_INFO, PSTR("ETH: Disconnected"));
TasmotaGlobal.global_state.eth_down = 1;
break;
case SYSTEM_EVENT_ETH_STOP:
case ARDUINO_EVENT_ETH_STOP:
AddLog(LOG_LEVEL_DEBUG, PSTR("ETH: Stopped"));
TasmotaGlobal.global_state.eth_down = 1;
break;
@ -129,9 +129,9 @@ void EthernetInit(void) {
Settings->eth_clk_mode = ETH_CLOCK_GPIO0_IN; // EthClockMode
}
// 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"
strcat(eth_hostname, "_eth");
// 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"
strcat(eth_hostname, "-eth");
WiFi.onEvent(EthernetEvent);