1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-03 11:52:20 +01: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:
Otto Winter
2021-09-20 11:47:51 +02:00
committed by GitHub
parent 1e8e471dec
commit ac0d921413
583 changed files with 9008 additions and 5420 deletions

View File

@@ -3,7 +3,6 @@ import esphome.config_validation as cv
import esphome.final_validate as fv
from esphome import automation
from esphome.automation import Condition
from esphome.components.network import add_mdns_library
from esphome.const import (
CONF_AP,
CONF_BSSID,
@@ -24,7 +23,6 @@ from esphome.const import (
CONF_STATIC_IP,
CONF_SUBNET,
CONF_USE_ADDRESS,
CONF_ENABLE_MDNS,
CONF_PRIORITY,
CONF_IDENTITY,
CONF_CERTIFICATE_AUTHORITY,
@@ -34,6 +32,7 @@ from esphome.const import (
CONF_EAP,
)
from esphome.core import CORE, HexInt, coroutine_with_priority
from esphome.components.network import IPAddress
from . import wpa2_eap
@@ -41,7 +40,6 @@ AUTO_LOAD = ["network"]
wifi_ns = cg.esphome_ns.namespace("wifi")
EAPAuth = wifi_ns.struct("EAPAuth")
IPAddress = cg.global_ns.class_("IPAddress")
ManualIP = wifi_ns.struct("ManualIP")
WiFiComponent = wifi_ns.class_("WiFiComponent", cg.Component)
WiFiAP = wifi_ns.struct("WiFiAP")
@@ -155,18 +153,17 @@ def final_validate_power_esp32_ble(value):
# WiFi should be in modem sleep (!=NONE) with BLE coexistence
# https://docs.espressif.com/projects/esp-idf/en/v3.3.5/api-guides/wifi.html#station-sleep
return
framework_version = fv.get_arduino_framework_version()
if framework_version not in (None, "dev") and framework_version < "1.0.5":
# Only frameworks 1.0.5+ impacted
return
full = fv.full_config.get()
for conflicting in [
"esp32_ble",
"esp32_ble_beacon",
"esp32_ble_server",
"esp32_ble_tracker",
]:
if conflicting in full:
try:
cv.require_framework_version(esp32_arduino=cv.Version(1, 0, 5))(None)
except cv.Invalid:
pass
else:
raise cv.Invalid(
f"power_save_mode NONE is incompatible with {conflicting}. "
f"Please remove the power save mode. See also "
@@ -236,7 +233,6 @@ CONFIG_SCHEMA = cv.All(
cv.Optional(CONF_MANUAL_IP): STA_MANUAL_IP_SCHEMA,
cv.Optional(CONF_EAP): EAP_AUTH_SCHEMA,
cv.Optional(CONF_AP): WIFI_NETWORK_AP,
cv.Optional(CONF_ENABLE_MDNS, default=True): cv.boolean,
cv.Optional(CONF_DOMAIN, default=".local"): cv.domain_name,
cv.Optional(
CONF_REBOOT_TIMEOUT, default="15min"
@@ -249,6 +245,10 @@ CONFIG_SCHEMA = cv.All(
cv.SplitDefault(CONF_OUTPUT_POWER, esp8266=20.0): cv.All(
cv.decibel, cv.float_range(min=10.0, max=20.5)
),
cv.Optional("enable_mdns"): cv.invalid(
"This option has been removed. Please use the [disabled] option under the "
"new mdns component instead."
),
}
),
_validate,
@@ -345,9 +345,6 @@ async def to_code(config):
cg.add_define("USE_WIFI")
if config[CONF_ENABLE_MDNS]:
add_mdns_library()
# Register at end for OTA safe mode
await cg.register_component(var, config)