mirror of
https://github.com/esphome/esphome.git
synced 2025-11-16 14:55:50 +00:00
Compare commits
7 Commits
2023.4.0b2
...
2023.4.0b4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47c4ff15d6 | ||
|
|
ccf1bdc0b4 | ||
|
|
e993fcf80c | ||
|
|
1bdc30a09e | ||
|
|
f56e89597f | ||
|
|
9460fb28c4 | ||
|
|
7207b9734f |
@@ -428,10 +428,12 @@ void APIServer::on_shutdown() {
|
||||
}
|
||||
|
||||
#ifdef USE_VOICE_ASSISTANT
|
||||
void APIServer::start_voice_assistant() {
|
||||
bool APIServer::start_voice_assistant() {
|
||||
bool result = false;
|
||||
for (auto &c : this->clients_) {
|
||||
c->request_voice_assistant(true);
|
||||
result |= c->request_voice_assistant(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
void APIServer::stop_voice_assistant() {
|
||||
for (auto &c : this->clients_) {
|
||||
|
||||
@@ -96,7 +96,7 @@ class APIServer : public Component, public Controller {
|
||||
#endif
|
||||
|
||||
#ifdef USE_VOICE_ASSISTANT
|
||||
void start_voice_assistant();
|
||||
bool start_voice_assistant();
|
||||
void stop_voice_assistant();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ RECOMMENDED_ARDUINO_FRAMEWORK_VERSION = cv.Version(2, 0, 5)
|
||||
# The platformio/espressif32 version to use for arduino frameworks
|
||||
# - https://github.com/platformio/platform-espressif32/releases
|
||||
# - https://api.registry.platformio.org/v3/packages/platformio/platform/espressif32
|
||||
ARDUINO_PLATFORM_VERSION = cv.Version(5, 2, 0)
|
||||
ARDUINO_PLATFORM_VERSION = cv.Version(5, 3, 0)
|
||||
|
||||
# The default/recommended esp-idf framework version
|
||||
# - https://github.com/espressif/esp-idf/releases
|
||||
|
||||
@@ -26,8 +26,10 @@ EthernetComponent::EthernetComponent() { global_eth_component = this; }
|
||||
|
||||
void EthernetComponent::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up Ethernet...");
|
||||
// Delay here to allow power to stabilise before Ethernet is initialised.
|
||||
delay(300); // NOLINT
|
||||
if (esp_reset_reason() != ESP_RST_DEEPSLEEP) {
|
||||
// Delay here to allow power to stabilise before Ethernet is initialized.
|
||||
delay(300); // NOLINT
|
||||
}
|
||||
|
||||
esp_err_t err;
|
||||
err = esp_netif_init();
|
||||
@@ -52,30 +54,29 @@ void EthernetComponent::setup() {
|
||||
|
||||
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&mac_config);
|
||||
|
||||
esp_eth_phy_t *phy;
|
||||
switch (this->type_) {
|
||||
case ETHERNET_TYPE_LAN8720: {
|
||||
phy = esp_eth_phy_new_lan87xx(&phy_config);
|
||||
this->phy_ = esp_eth_phy_new_lan87xx(&phy_config);
|
||||
break;
|
||||
}
|
||||
case ETHERNET_TYPE_RTL8201: {
|
||||
phy = esp_eth_phy_new_rtl8201(&phy_config);
|
||||
this->phy_ = esp_eth_phy_new_rtl8201(&phy_config);
|
||||
break;
|
||||
}
|
||||
case ETHERNET_TYPE_DP83848: {
|
||||
phy = esp_eth_phy_new_dp83848(&phy_config);
|
||||
this->phy_ = esp_eth_phy_new_dp83848(&phy_config);
|
||||
break;
|
||||
}
|
||||
case ETHERNET_TYPE_IP101: {
|
||||
phy = esp_eth_phy_new_ip101(&phy_config);
|
||||
this->phy_ = esp_eth_phy_new_ip101(&phy_config);
|
||||
break;
|
||||
}
|
||||
case ETHERNET_TYPE_JL1101: {
|
||||
phy = esp_eth_phy_new_jl1101(&phy_config);
|
||||
this->phy_ = esp_eth_phy_new_jl1101(&phy_config);
|
||||
break;
|
||||
}
|
||||
case ETHERNET_TYPE_KSZ8081: {
|
||||
phy = esp_eth_phy_new_ksz8081(&phy_config);
|
||||
this->phy_ = esp_eth_phy_new_ksz8081(&phy_config);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
@@ -84,7 +85,7 @@ void EthernetComponent::setup() {
|
||||
}
|
||||
}
|
||||
|
||||
esp_eth_config_t eth_config = ETH_DEFAULT_CONFIG(mac, phy);
|
||||
esp_eth_config_t eth_config = ETH_DEFAULT_CONFIG(mac, this->phy_);
|
||||
this->eth_handle_ = nullptr;
|
||||
err = esp_eth_driver_install(ð_config, &this->eth_handle_);
|
||||
ESPHL_ERROR_CHECK(err, "ETH driver install error");
|
||||
@@ -356,6 +357,21 @@ std::string EthernetComponent::get_use_address() const {
|
||||
|
||||
void EthernetComponent::set_use_address(const std::string &use_address) { this->use_address_ = use_address; }
|
||||
|
||||
bool EthernetComponent::powerdown() {
|
||||
ESP_LOGI(TAG, "Powering down ethernet PHY");
|
||||
if (this->phy_ == nullptr) {
|
||||
ESP_LOGE(TAG, "Ethernet PHY not assigned");
|
||||
return false;
|
||||
}
|
||||
this->connected_ = false;
|
||||
this->started_ = false;
|
||||
if (this->phy_->pwrctl(this->phy_, false) != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Error powering down ethernet PHY");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace ethernet
|
||||
} // namespace esphome
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ class EthernetComponent : public Component {
|
||||
void dump_config() override;
|
||||
float get_setup_priority() const override;
|
||||
bool can_proceed() override;
|
||||
void on_shutdown() override { powerdown(); }
|
||||
bool is_connected();
|
||||
|
||||
void set_phy_addr(uint8_t phy_addr);
|
||||
@@ -58,6 +59,7 @@ class EthernetComponent : public Component {
|
||||
network::IPAddress get_ip_address();
|
||||
std::string get_use_address() const;
|
||||
void set_use_address(const std::string &use_address);
|
||||
bool powerdown();
|
||||
|
||||
protected:
|
||||
static void eth_event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data);
|
||||
@@ -82,6 +84,7 @@ class EthernetComponent : public Component {
|
||||
uint32_t connect_begin_;
|
||||
esp_netif_t *eth_netif_{nullptr};
|
||||
esp_eth_handle_t eth_handle_;
|
||||
esp_eth_phy_t *phy_{nullptr};
|
||||
};
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
|
||||
@@ -63,7 +63,10 @@ void VoiceAssistant::start(struct sockaddr_storage *addr, uint16_t port) {
|
||||
|
||||
void VoiceAssistant::request_start() {
|
||||
ESP_LOGD(TAG, "Requesting start...");
|
||||
api::global_api_server->start_voice_assistant();
|
||||
if (!api::global_api_server->start_voice_assistant()) {
|
||||
ESP_LOGW(TAG, "Could not request start.");
|
||||
this->error_trigger_->trigger("not-connected", "Could not request start.");
|
||||
}
|
||||
}
|
||||
|
||||
void VoiceAssistant::signal_stop() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Constants used by esphome."""
|
||||
|
||||
__version__ = "2023.4.0b2"
|
||||
__version__ = "2023.4.0b4"
|
||||
|
||||
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ extra_scripts = post:esphome/components/esp8266/post_build.py.script
|
||||
; This are common settings for the ESP32 (all variants) using Arduino.
|
||||
[common:esp32-arduino]
|
||||
extends = common:arduino
|
||||
platform = platformio/espressif32 @ 5.2.0
|
||||
platform = platformio/espressif32 @ 5.3.0
|
||||
platform_packages =
|
||||
platformio/framework-arduinoespressif32 @ ~3.20005.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user