mirror of
https://github.com/esphome/esphome.git
synced 2025-10-29 06:04:01 +00:00
ESP-IDF support and generic target platforms (#2303)
* Socket refactor and SSL * esp-idf temp * Fixes * Echo component and noise * Add noise API transport support * Updates * ESP-IDF * Complete * Fixes * Fixes * Versions update * New i2c APIs * Complete i2c refactor * SPI migration * Revert ESP Preferences migration, too complex for now * OTA support * Remove echo again * Remove ssl again * GPIOFlags updates * Rename esphal and ICACHE_RAM_ATTR * Make ESP32 arduino compilable again * Fix GPIO flags * Complete pin registry refactor and fixes * Fixes to make test1 compile * Remove sdkconfig file * Ignore sdkconfig file * Fixes in reviewing * Make test2 compile * Make test4 compile * Make test5 compile * Run clang-format * Fix lint errors * Use esp-idf APIs instead of btStart * Another round of fixes * Start implementing ESP8266 * Make test3 compile * Guard esp8266 code * Lint * Reformat * Fixes * Fixes v2 * more fixes * ESP-IDF tidy target * Convert ARDUINO_ARCH_ESPxx * Update WiFiSignalSensor * Update time ifdefs * OTA needs millis from hal * RestartSwitch needs delay from hal * ESP-IDF Uart * Fix OTA blank password * Allow setting sdkconfig * Fix idf partitions and allow setting sdkconfig from yaml * Re-add read/write compat APIs and fix esp8266 uart * Fix esp8266 store log strings in flash * Fix ESP32 arduino preferences not initialized * Update ifdefs * Change how sdkconfig change is detected * Add checks to ci-custom and fix them * Run clang-format * Add esp-idf clang-tidy target and fix errors * Fixes from clang-tidy idf round 2 * Fixes from compiling tests with esp-idf * Run clang-format * Switch test5.yaml to esp-idf * Implement ESP8266 Preferences * Lint * Re-do PIO package version selection a bit * Fix arduinoespressif32 package version * Fix unit tests * Lint * Lint fixes * Fix readv/writev not defined * Fix graphing component * Re-add all old options from core/config.py Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
#include "esphome/core/util.h"
|
||||
#include "esphome/core/application.h"
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
#ifdef USE_ESP32_FRAMEWORK_ARDUINO
|
||||
|
||||
#include <eth_phy/phy_lan8720.h>
|
||||
#include <eth_phy/phy_tlk110.h>
|
||||
@@ -75,10 +75,6 @@ void EthernetComponent::setup() {
|
||||
ESPHL_ERROR_CHECK(err, "ETH init error");
|
||||
err = esp_eth_enable();
|
||||
ESPHL_ERROR_CHECK(err, "ETH enable error");
|
||||
|
||||
#ifdef USE_MDNS
|
||||
network_setup_mdns();
|
||||
#endif
|
||||
}
|
||||
void EthernetComponent::loop() {
|
||||
const uint32_t now = millis();
|
||||
@@ -118,8 +114,6 @@ void EthernetComponent::loop() {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
network_tick_mdns();
|
||||
}
|
||||
void EthernetComponent::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "Ethernet:");
|
||||
@@ -131,10 +125,10 @@ void EthernetComponent::dump_config() {
|
||||
}
|
||||
float EthernetComponent::get_setup_priority() const { return setup_priority::WIFI; }
|
||||
bool EthernetComponent::can_proceed() { return this->is_connected(); }
|
||||
IPAddress EthernetComponent::get_ip_address() {
|
||||
network::IPAddress EthernetComponent::get_ip_address() {
|
||||
tcpip_adapter_ip_info_t ip;
|
||||
tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_ETH, &ip);
|
||||
return IPAddress(ip.ip.addr);
|
||||
return {ip.ip.addr};
|
||||
}
|
||||
|
||||
void EthernetComponent::on_wifi_event_(system_event_id_t event, system_event_info_t info) {
|
||||
@@ -229,10 +223,10 @@ bool EthernetComponent::is_connected() { return this->state_ == EthernetComponen
|
||||
void EthernetComponent::dump_connect_params_() {
|
||||
tcpip_adapter_ip_info_t ip;
|
||||
tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_ETH, &ip);
|
||||
ESP_LOGCONFIG(TAG, " IP Address: %s", IPAddress(ip.ip.addr).toString().c_str());
|
||||
ESP_LOGCONFIG(TAG, " IP Address: %s", network::IPAddress(ip.ip.addr).str().c_str());
|
||||
ESP_LOGCONFIG(TAG, " Hostname: '%s'", App.get_name().c_str());
|
||||
ESP_LOGCONFIG(TAG, " Subnet: %s", IPAddress(ip.netmask.addr).toString().c_str());
|
||||
ESP_LOGCONFIG(TAG, " Gateway: %s", IPAddress(ip.gw.addr).toString().c_str());
|
||||
ESP_LOGCONFIG(TAG, " Subnet: %s", network::IPAddress(ip.netmask.addr).str().c_str());
|
||||
ESP_LOGCONFIG(TAG, " Gateway: %s", network::IPAddress(ip.gw.addr).str().c_str());
|
||||
|
||||
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(3, 3, 4)
|
||||
const ip_addr_t *dns_ip1 = dns_getserver(0);
|
||||
@@ -243,8 +237,8 @@ void EthernetComponent::dump_connect_params_() {
|
||||
ip_addr_t tmp_ip2 = dns_getserver(1);
|
||||
const ip_addr_t *dns_ip2 = &tmp_ip2;
|
||||
#endif
|
||||
ESP_LOGCONFIG(TAG, " DNS1: %s", IPAddress(dns_ip1->u_addr.ip4.addr).toString().c_str());
|
||||
ESP_LOGCONFIG(TAG, " DNS2: %s", IPAddress(dns_ip2->u_addr.ip4.addr).toString().c_str());
|
||||
ESP_LOGCONFIG(TAG, " DNS1: %s", network::IPAddress(dns_ip1->u_addr.ip4.addr).str().c_str());
|
||||
ESP_LOGCONFIG(TAG, " DNS2: %s", network::IPAddress(dns_ip2->u_addr.ip4.addr).str().c_str());
|
||||
uint8_t mac[6];
|
||||
esp_eth_get_mac(mac);
|
||||
ESP_LOGCONFIG(TAG, " MAC Address: %02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
@@ -270,4 +264,4 @@ void EthernetComponent::set_use_address(const std::string &use_address) { this->
|
||||
} // namespace ethernet
|
||||
} // namespace esphome
|
||||
|
||||
#endif
|
||||
#endif // USE_ESP32_FRAMEWORK_ARDUINO
|
||||
|
||||
Reference in New Issue
Block a user