From e90e54093305adfe0b829fe63e9b56271d88634c Mon Sep 17 00:00:00 2001 From: LILYGO_L <135582120+Llgok@users.noreply.github.com> Date: Wed, 23 Jul 2025 23:02:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=BC=BAT-CameraPlus-S3=E9=BA=A6?= =?UTF-8?q?=E5=85=8B=E9=A3=8E=E6=8E=A5=E6=94=B6=E9=9F=B3=E9=87=8F=20(#958)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Adapt for LilyGO-T-Circle-S3 device * Adapt for LilyGO-T-Circle-S3 device * Remove comments and modify the size of the lilygo-t-circle-s3 image * Modify the code style and format to Google C++ * Modify the code style and format to Google C++ * Fixed bugs in the LILYGO T-Circle-S3 board and added support for two new boards: LILYGO T-Display-S3-Pro-MVSRLora and LILYGO T-Display-S3-Pro-MVSRLora_NO_BATTERY. * Added support for two new boards: LILYGO T-Display-S3-Pro-MVSRLora and LILYGO T-Display-S3-Pro-MVSRLora_NO_BATTERY. * Merge branch 'main' of https://github.com/Llgok/xiaozhi-esp32 * Added support for two new boards: LILYGO T-Display-S3-Pro-MVSRLora and LILYGO T-Display-S3-Pro-MVSRLora_NO_BATTERY. * Added support for two new boards: LILYGO T-Display-S3-Pro-MVSRLora and LILYGO T-Display-S3-Pro-MVSRLora_NO_BATTERY. * Added support for two new boards: LILYGO T-Display-S3-Pro-MVSRLora and LILYGO T-Display-S3-Pro-MVSRLora_NO_BATTERY. * Added support for two new boards: LILYGO T-Display-S3-Pro-MVSRLora and LILYGO T-Display-S3-Pro-MVSRLora_NO_BATTERY. * Fix the color display issue for T-Display-S3-Pro-MVSRLora and LILYGO T-Display-S3-Pro-MVSRLora_NO_BATTERY. * Update T-CameraPlus-S3_V1.2 Version Xiaozhi Example * Resolve the issue where the camera on the T-CameraPlus-S3_V1.2 board cannot be used normally. * Enhance microphone reception volume * fix the issue where voice wake-up is not working * fix the issue where voice wake-up is not working --- main/boards/lilygo-t-cameraplus-s3/config.h | 5 +++-- .../tcamerapluss3_audio_codec.cc | 11 +++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/main/boards/lilygo-t-cameraplus-s3/config.h b/main/boards/lilygo-t-cameraplus-s3/config.h index f87888a4..4d4b1ded 100644 --- a/main/boards/lilygo-t-cameraplus-s3/config.h +++ b/main/boards/lilygo-t-cameraplus-s3/config.h @@ -4,15 +4,16 @@ #include #include "pin_config.h" -#define AUDIO_INPUT_REFERENCE true -#define AUDIO_INPUT_SAMPLE_RATE 24000 +#define AUDIO_INPUT_SAMPLE_RATE 16000 #define AUDIO_OUTPUT_SAMPLE_RATE 24000 #ifdef CONFIG_BOARD_TYPE_LILYGO_T_CAMERAPLUS_S3_V1_0_V1_1 +#define AUDIO_INPUT_REFERENCE true #define AUDIO_MIC_I2S_GPIO_BCLK static_cast(MSM261_BCLK) #define AUDIO_MIC_I2S_GPIO_WS static_cast(MSM261_WS) #define AUDIO_MIC_I2S_GPIO_DATA static_cast(MSM261_DATA) #elif defined CONFIG_BOARD_TYPE_LILYGO_T_CAMERAPLUS_S3_V1_2 +#define AUDIO_INPUT_REFERENCE false #define AUDIO_MIC_I2S_GPIO_BCLK GPIO_NUM_NC #define AUDIO_MIC_I2S_GPIO_WS static_cast(MP34DT05TR_LRCLK) #define AUDIO_MIC_I2S_GPIO_DATA static_cast(MP34DT05TR_DATA) diff --git a/main/boards/lilygo-t-cameraplus-s3/tcamerapluss3_audio_codec.cc b/main/boards/lilygo-t-cameraplus-s3/tcamerapluss3_audio_codec.cc index f9ad8465..365d9ca7 100644 --- a/main/boards/lilygo-t-cameraplus-s3/tcamerapluss3_audio_codec.cc +++ b/main/boards/lilygo-t-cameraplus-s3/tcamerapluss3_audio_codec.cc @@ -140,10 +140,17 @@ void Tcamerapluss3AudioCodec::EnableOutput(bool enable) { AudioCodec::EnableOutput(enable); } -int Tcamerapluss3AudioCodec::Read(int16_t *dest, int samples){ - if (input_enabled_){ +int Tcamerapluss3AudioCodec::Read(int16_t *dest, int samples) { + if (input_enabled_) { size_t bytes_read; i2s_channel_read(rx_handle_, dest, samples * sizeof(int16_t), &bytes_read, portMAX_DELAY); + + // 麦克风接收音量放大20倍(限制在 int16_t 范围内防止溢出) + int16_t *ptr = dest; + for (int i = 0; i < samples; i++) { + int32_t amplified = *ptr * 20; + *ptr++ = (amplified > 32767) ? 32767 : (amplified < -32768) ? -32768 : amplified; + } } return samples; }