mirror of
https://github.com/esphome/esphome.git
synced 2024-11-28 17:54:13 +01:00
commit
b89c04b928
7 changed files with 52 additions and 34 deletions
|
@ -429,15 +429,16 @@ void APIServer::on_shutdown() {
|
||||||
|
|
||||||
#ifdef USE_VOICE_ASSISTANT
|
#ifdef USE_VOICE_ASSISTANT
|
||||||
bool APIServer::start_voice_assistant() {
|
bool APIServer::start_voice_assistant() {
|
||||||
bool result = false;
|
|
||||||
for (auto &c : this->clients_) {
|
for (auto &c : this->clients_) {
|
||||||
result |= c->request_voice_assistant(true);
|
if (c->request_voice_assistant(true))
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return result;
|
return false;
|
||||||
}
|
}
|
||||||
void APIServer::stop_voice_assistant() {
|
void APIServer::stop_voice_assistant() {
|
||||||
for (auto &c : this->clients_) {
|
for (auto &c : this->clients_) {
|
||||||
c->request_voice_assistant(false);
|
if (c->request_voice_assistant(false))
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -17,7 +17,8 @@ debug_ns = cg.esphome_ns.namespace("debug")
|
||||||
DebugComponent = debug_ns.class_("DebugComponent", cg.PollingComponent)
|
DebugComponent = debug_ns.class_("DebugComponent", cg.PollingComponent)
|
||||||
|
|
||||||
|
|
||||||
CONFIG_SCHEMA = cv.Schema(
|
CONFIG_SCHEMA = cv.All(
|
||||||
|
cv.Schema(
|
||||||
{
|
{
|
||||||
cv.GenerateID(): cv.declare_id(DebugComponent),
|
cv.GenerateID(): cv.declare_id(DebugComponent),
|
||||||
cv.Optional(CONF_DEVICE): cv.invalid(
|
cv.Optional(CONF_DEVICE): cv.invalid(
|
||||||
|
@ -36,7 +37,9 @@ CONFIG_SCHEMA = cv.Schema(
|
||||||
"The 'loop_time' option has been moved to the 'debug' sensor component"
|
"The 'loop_time' option has been moved to the 'debug' sensor component"
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
).extend(cv.polling_component_schema("60s"))
|
).extend(cv.polling_component_schema("60s")),
|
||||||
|
cv.only_on(["esp32", "esp8266"]),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
async def to_code(config):
|
async def to_code(config):
|
||||||
|
|
|
@ -77,10 +77,12 @@ void FingerprintGrowComponent::finish_enrollment(uint8_t result) {
|
||||||
this->enrollment_done_callback_.call(this->enrollment_slot_);
|
this->enrollment_done_callback_.call(this->enrollment_slot_);
|
||||||
this->get_fingerprint_count_();
|
this->get_fingerprint_count_();
|
||||||
} else {
|
} else {
|
||||||
|
if (this->enrollment_slot_ != ENROLLMENT_SLOT_UNUSED) {
|
||||||
this->enrollment_failed_callback_.call(this->enrollment_slot_);
|
this->enrollment_failed_callback_.call(this->enrollment_slot_);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this->enrollment_image_ = 0;
|
this->enrollment_image_ = 0;
|
||||||
this->enrollment_slot_ = 0;
|
this->enrollment_slot_ = ENROLLMENT_SLOT_UNUSED;
|
||||||
if (this->enrolling_binary_sensor_ != nullptr) {
|
if (this->enrolling_binary_sensor_ != nullptr) {
|
||||||
this->enrolling_binary_sensor_->publish_state(false);
|
this->enrolling_binary_sensor_->publish_state(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,8 @@ namespace fingerprint_grow {
|
||||||
|
|
||||||
static const uint16_t START_CODE = 0xEF01;
|
static const uint16_t START_CODE = 0xEF01;
|
||||||
|
|
||||||
|
static const uint16_t ENROLLMENT_SLOT_UNUSED = 0xFFFF;
|
||||||
|
|
||||||
enum GrowPacketType {
|
enum GrowPacketType {
|
||||||
COMMAND = 0x01,
|
COMMAND = 0x01,
|
||||||
DATA = 0x02,
|
DATA = 0x02,
|
||||||
|
@ -158,7 +160,7 @@ class FingerprintGrowComponent : public PollingComponent, public uart::UARTDevic
|
||||||
uint32_t new_password_ = -1;
|
uint32_t new_password_ = -1;
|
||||||
GPIOPin *sensing_pin_{nullptr};
|
GPIOPin *sensing_pin_{nullptr};
|
||||||
uint8_t enrollment_image_ = 0;
|
uint8_t enrollment_image_ = 0;
|
||||||
uint16_t enrollment_slot_ = 0;
|
uint16_t enrollment_slot_ = ENROLLMENT_SLOT_UNUSED;
|
||||||
uint8_t enrollment_buffers_ = 5;
|
uint8_t enrollment_buffers_ = 5;
|
||||||
bool waiting_removal_ = false;
|
bool waiting_removal_ = false;
|
||||||
uint32_t last_aura_led_control_ = 0;
|
uint32_t last_aura_led_control_ = 0;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "i2c_bus_arduino.h"
|
#include "i2c_bus_arduino.h"
|
||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
#include "esphome/core/helpers.h"
|
#include "esphome/core/helpers.h"
|
||||||
|
#include "esphome/core/application.h"
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
@ -227,10 +228,14 @@ void ArduinoI2CBus::recover_() {
|
||||||
// When SCL is kept LOW at this point, we might be looking at a device
|
// When SCL is kept LOW at this point, we might be looking at a device
|
||||||
// that applies clock stretching. Wait for the release of the SCL line,
|
// that applies clock stretching. Wait for the release of the SCL line,
|
||||||
// but not forever. There is no specification for the maximum allowed
|
// but not forever. There is no specification for the maximum allowed
|
||||||
// time. We'll stick to 500ms here.
|
// time. We yield and reset the WDT, so as to avoid triggering reset.
|
||||||
auto wait = 20;
|
// No point in trying to recover the bus by forcing a uC reset. Bus
|
||||||
|
// should recover in a few ms or less else not likely to recovery at
|
||||||
|
// all.
|
||||||
|
auto wait = 250;
|
||||||
while (wait-- && digitalRead(scl_pin_) == LOW) { // NOLINT
|
while (wait-- && digitalRead(scl_pin_) == LOW) { // NOLINT
|
||||||
delay(25);
|
App.feed_wdt();
|
||||||
|
delayMicroseconds(half_period_usec * 2);
|
||||||
}
|
}
|
||||||
if (digitalRead(scl_pin_) == LOW) { // NOLINT
|
if (digitalRead(scl_pin_) == LOW) { // NOLINT
|
||||||
ESP_LOGE(TAG, "Recovery failed: SCL is held LOW during clock pulse cycle");
|
ESP_LOGE(TAG, "Recovery failed: SCL is held LOW during clock pulse cycle");
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "esphome/core/hal.h"
|
#include "esphome/core/hal.h"
|
||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
#include "esphome/core/helpers.h"
|
#include "esphome/core/helpers.h"
|
||||||
|
#include "esphome/core/application.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
|
|
||||||
|
@ -273,10 +274,14 @@ void IDFI2CBus::recover_() {
|
||||||
// When SCL is kept LOW at this point, we might be looking at a device
|
// When SCL is kept LOW at this point, we might be looking at a device
|
||||||
// that applies clock stretching. Wait for the release of the SCL line,
|
// that applies clock stretching. Wait for the release of the SCL line,
|
||||||
// but not forever. There is no specification for the maximum allowed
|
// but not forever. There is no specification for the maximum allowed
|
||||||
// time. We'll stick to 500ms here.
|
// time. We yield and reset the WDT, so as to avoid triggering reset.
|
||||||
auto wait = 20;
|
// No point in trying to recover the bus by forcing a uC reset. Bus
|
||||||
|
// should recover in a few ms or less else not likely to recovery at
|
||||||
|
// all.
|
||||||
|
auto wait = 250;
|
||||||
while (wait-- && gpio_get_level(scl_pin) == 0) {
|
while (wait-- && gpio_get_level(scl_pin) == 0) {
|
||||||
delay(25);
|
App.feed_wdt();
|
||||||
|
delayMicroseconds(half_period_usec * 2);
|
||||||
}
|
}
|
||||||
if (gpio_get_level(scl_pin) == 0) {
|
if (gpio_get_level(scl_pin) == 0) {
|
||||||
ESP_LOGE(TAG, "Recovery failed: SCL is held LOW during clock pulse cycle");
|
ESP_LOGE(TAG, "Recovery failed: SCL is held LOW during clock pulse cycle");
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
"""Constants used by esphome."""
|
"""Constants used by esphome."""
|
||||||
|
|
||||||
__version__ = "2023.4.1"
|
__version__ = "2023.4.2"
|
||||||
|
|
||||||
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue