mirror of
https://github.com/esphome/esphome.git
synced 2025-11-11 04:15:52 +00:00
Compare commits
9 Commits
bluetooth-
...
2024.5.5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5b062a222c | ||
|
|
664ee56dc5 | ||
|
|
388b2c2de0 | ||
|
|
ce4a3d9950 | ||
|
|
ac9f57600d | ||
|
|
3fe2fc9b56 | ||
|
|
4cd4b168b4 | ||
|
|
f07479419c | ||
|
|
54b51269ab |
@@ -19,10 +19,27 @@ void I2SAudioSpeaker::setup() {
|
|||||||
ESP_LOGCONFIG(TAG, "Setting up I2S Audio Speaker...");
|
ESP_LOGCONFIG(TAG, "Setting up I2S Audio Speaker...");
|
||||||
|
|
||||||
this->buffer_queue_ = xQueueCreate(BUFFER_COUNT, sizeof(DataEvent));
|
this->buffer_queue_ = xQueueCreate(BUFFER_COUNT, sizeof(DataEvent));
|
||||||
this->event_queue_ = xQueueCreate(BUFFER_COUNT, sizeof(TaskEvent));
|
if (this->buffer_queue_ == nullptr) {
|
||||||
|
ESP_LOGE(TAG, "Failed to create buffer queue");
|
||||||
|
this->mark_failed();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void I2SAudioSpeaker::start() { this->state_ = speaker::STATE_STARTING; }
|
this->event_queue_ = xQueueCreate(BUFFER_COUNT, sizeof(TaskEvent));
|
||||||
|
if (this->event_queue_ == nullptr) {
|
||||||
|
ESP_LOGE(TAG, "Failed to create event queue");
|
||||||
|
this->mark_failed();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void I2SAudioSpeaker::start() {
|
||||||
|
if (this->is_failed()) {
|
||||||
|
ESP_LOGE(TAG, "Cannot start audio, speaker failed to setup");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this->state_ = speaker::STATE_STARTING;
|
||||||
|
}
|
||||||
void I2SAudioSpeaker::start_() {
|
void I2SAudioSpeaker::start_() {
|
||||||
if (!this->parent_->try_lock()) {
|
if (!this->parent_->try_lock()) {
|
||||||
return; // Waiting for another i2s component to return lock
|
return; // Waiting for another i2s component to return lock
|
||||||
@@ -141,6 +158,8 @@ void I2SAudioSpeaker::player_task(void *params) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void I2SAudioSpeaker::stop() {
|
void I2SAudioSpeaker::stop() {
|
||||||
|
if (this->is_failed())
|
||||||
|
return;
|
||||||
if (this->state_ == speaker::STATE_STOPPED)
|
if (this->state_ == speaker::STATE_STOPPED)
|
||||||
return;
|
return;
|
||||||
if (this->state_ == speaker::STATE_STARTING) {
|
if (this->state_ == speaker::STATE_STARTING) {
|
||||||
@@ -200,6 +219,10 @@ void I2SAudioSpeaker::loop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t I2SAudioSpeaker::play(const uint8_t *data, size_t length) {
|
size_t I2SAudioSpeaker::play(const uint8_t *data, size_t length) {
|
||||||
|
if (this->is_failed()) {
|
||||||
|
ESP_LOGE(TAG, "Cannot play audio, speaker failed to setup");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (this->state_ != speaker::STATE_RUNNING && this->state_ != speaker::STATE_STARTING) {
|
if (this->state_ != speaker::STATE_RUNNING && this->state_ != speaker::STATE_STARTING) {
|
||||||
this->start();
|
this->start();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ void ImprovSerialComponent::write_data_(std::vector<uint8_t> &data) {
|
|||||||
#if defined(USE_ESP32_VARIANT_ESP32C3) || defined(USE_ESP32_VARIANT_ESP32C6) || defined(USE_ESP32_VARIANT_ESP32S3)
|
#if defined(USE_ESP32_VARIANT_ESP32C3) || defined(USE_ESP32_VARIANT_ESP32C6) || defined(USE_ESP32_VARIANT_ESP32S3)
|
||||||
case logger::UART_SELECTION_USB_SERIAL_JTAG:
|
case logger::UART_SELECTION_USB_SERIAL_JTAG:
|
||||||
usb_serial_jtag_write_bytes((char *) data.data(), data.size(), 20 / portTICK_PERIOD_MS);
|
usb_serial_jtag_write_bytes((char *) data.data(), data.size(), 20 / portTICK_PERIOD_MS);
|
||||||
|
usb_serial_jtag_ll_txfifo_flush(); // fixes for issue in IDF 4.4.7
|
||||||
break;
|
break;
|
||||||
#endif // USE_ESP32_VARIANT_ESP32C3 || USE_ESP32_VARIANT_ESP32S3
|
#endif // USE_ESP32_VARIANT_ESP32C3 || USE_ESP32_VARIANT_ESP32S3
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#if defined(USE_ESP32_VARIANT_ESP32C3) || defined(USE_ESP32_VARIANT_ESP32C6) || defined(USE_ESP32_VARIANT_ESP32S3) || \
|
#if defined(USE_ESP32_VARIANT_ESP32C3) || defined(USE_ESP32_VARIANT_ESP32C6) || defined(USE_ESP32_VARIANT_ESP32S3) || \
|
||||||
defined(USE_ESP32_VARIANT_ESP32H2)
|
defined(USE_ESP32_VARIANT_ESP32H2)
|
||||||
#include <driver/usb_serial_jtag.h>
|
#include <driver/usb_serial_jtag.h>
|
||||||
|
#include <hal/usb_serial_jtag_ll.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(USE_ESP32_VARIANT_ESP32S2) || defined(USE_ESP32_VARIANT_ESP32S3)
|
#if defined(USE_ESP32_VARIANT_ESP32S2) || defined(USE_ESP32_VARIANT_ESP32S3)
|
||||||
#include <esp_private/usb_console.h>
|
#include <esp_private/usb_console.h>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ static const char *const TAG = "voice_assistant";
|
|||||||
|
|
||||||
static const size_t SAMPLE_RATE_HZ = 16000;
|
static const size_t SAMPLE_RATE_HZ = 16000;
|
||||||
static const size_t INPUT_BUFFER_SIZE = 32 * SAMPLE_RATE_HZ / 1000; // 32ms * 16kHz / 1000ms
|
static const size_t INPUT_BUFFER_SIZE = 32 * SAMPLE_RATE_HZ / 1000; // 32ms * 16kHz / 1000ms
|
||||||
static const size_t BUFFER_SIZE = 1024 * SAMPLE_RATE_HZ / 1000;
|
static const size_t BUFFER_SIZE = 512 * SAMPLE_RATE_HZ / 1000;
|
||||||
static const size_t SEND_BUFFER_SIZE = INPUT_BUFFER_SIZE * sizeof(int16_t);
|
static const size_t SEND_BUFFER_SIZE = INPUT_BUFFER_SIZE * sizeof(int16_t);
|
||||||
static const size_t RECEIVE_SIZE = 1024;
|
static const size_t RECEIVE_SIZE = 1024;
|
||||||
static const size_t SPEAKER_BUFFER_SIZE = 16 * RECEIVE_SIZE;
|
static const size_t SPEAKER_BUFFER_SIZE = 16 * RECEIVE_SIZE;
|
||||||
|
|||||||
@@ -37,4 +37,4 @@ async def to_code(config):
|
|||||||
cg.add_library("FS", None)
|
cg.add_library("FS", None)
|
||||||
cg.add_library("Update", None)
|
cg.add_library("Update", None)
|
||||||
# https://github.com/esphome/ESPAsyncWebServer/blob/master/library.json
|
# https://github.com/esphome/ESPAsyncWebServer/blob/master/library.json
|
||||||
cg.add_library("esphome/ESPAsyncWebServer-esphome", "3.2.0")
|
cg.add_library("esphome/ESPAsyncWebServer-esphome", "3.2.2")
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"""Constants used by esphome."""
|
"""Constants used by esphome."""
|
||||||
|
|
||||||
__version__ = "2024.5.3"
|
__version__ = "2024.5.5"
|
||||||
|
|
||||||
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
||||||
VALID_SUBSTITUTIONS_CHARACTERS = (
|
VALID_SUBSTITUTIONS_CHARACTERS = (
|
||||||
|
|||||||
@@ -433,6 +433,10 @@ int8_t step_to_accuracy_decimals(float step) {
|
|||||||
return str.length() - dot_pos - 1;
|
return str.length() - dot_pos - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const std::string BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||||
|
"abcdefghijklmnopqrstuvwxyz"
|
||||||
|
"0123456789+/";
|
||||||
|
|
||||||
static inline bool is_base64(char c) { return (isalnum(c) || (c == '+') || (c == '/')); }
|
static inline bool is_base64(char c) { return (isalnum(c) || (c == '+') || (c == '/')); }
|
||||||
|
|
||||||
std::string base64_encode(const std::vector<uint8_t> &buf) { return base64_encode(buf.data(), buf.size()); }
|
std::string base64_encode(const std::vector<uint8_t> &buf) { return base64_encode(buf.data(), buf.size()); }
|
||||||
|
|||||||
@@ -435,10 +435,6 @@ std::string value_accuracy_to_string(float value, int8_t accuracy_decimals);
|
|||||||
/// Derive accuracy in decimals from an increment step.
|
/// Derive accuracy in decimals from an increment step.
|
||||||
int8_t step_to_accuracy_decimals(float step);
|
int8_t step_to_accuracy_decimals(float step);
|
||||||
|
|
||||||
static const std::string BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
||||||
"abcdefghijklmnopqrstuvwxyz"
|
|
||||||
"0123456789+/";
|
|
||||||
|
|
||||||
std::string base64_encode(const uint8_t *buf, size_t buf_len);
|
std::string base64_encode(const uint8_t *buf, size_t buf_len);
|
||||||
std::string base64_encode(const std::vector<uint8_t> &buf);
|
std::string base64_encode(const std::vector<uint8_t> &buf);
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ lib_deps =
|
|||||||
SPI ; spi (Arduino built-in)
|
SPI ; spi (Arduino built-in)
|
||||||
Wire ; i2c (Arduino built-int)
|
Wire ; i2c (Arduino built-int)
|
||||||
heman/AsyncMqttClient-esphome@1.0.0 ; mqtt
|
heman/AsyncMqttClient-esphome@1.0.0 ; mqtt
|
||||||
esphome/ESPAsyncWebServer-esphome@3.2.0 ; web_server_base
|
esphome/ESPAsyncWebServer-esphome@3.2.2 ; web_server_base
|
||||||
fastled/FastLED@3.3.2 ; fastled_base
|
fastled/FastLED@3.3.2 ; fastled_base
|
||||||
mikalhart/TinyGPSPlus@1.0.2 ; gps
|
mikalhart/TinyGPSPlus@1.0.2 ; gps
|
||||||
freekode/TM1651@1.0.1 ; tm1651
|
freekode/TM1651@1.0.1 ; tm1651
|
||||||
|
|||||||
Reference in New Issue
Block a user