From da4fab66c1d0bf10e050cd8bf9b60dd63d6ab48d Mon Sep 17 00:00:00 2001 From: Christian Baars Date: Tue, 21 May 2024 17:43:43 +0200 Subject: [PATCH] more consistent usage of variables, really use apll rx setting (#21459) --- .../xdrv_42_0_i2s_0_config_idf51.ino | 2 +- .../tasmota_xdrv_driver/xdrv_42_0_i2s_3_lib_idf51.ino | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_42_0_i2s_0_config_idf51.ino b/tasmota/tasmota_xdrv_driver/xdrv_42_0_i2s_0_config_idf51.ino index dafbfb77290a..ec39ba43ac9e 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_42_0_i2s_0_config_idf51.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_42_0_i2s_0_config_idf51.ino @@ -109,7 +109,7 @@ typedef struct{ bool left_align = true; // B12 - left alignment bool big_endian = false; // B13 - big endian bool bit_order_lsb = false; // B14 - lsb first - uint16_t dma_frame_num = 512; // B015/16 - DMA buffer size in samples, 512 should be okay up to ~32000 bps + uint16_t dma_frame_num = 576; // B015/16 - DMA buffer size in samples, 576 should be okay up to ~32000 bps uint8_t dma_desc_num = 3; // B17 - number of DMA buffers, maybe increased with smaller buffers uint8_t spare[3]; // B018-20 - padding } rx; diff --git a/tasmota/tasmota_xdrv_driver/xdrv_42_0_i2s_3_lib_idf51.ino b/tasmota/tasmota_xdrv_driver/xdrv_42_0_i2s_3_lib_idf51.ino index 59d0a959b20a..26e0d5285be1 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_42_0_i2s_3_lib_idf51.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_42_0_i2s_3_lib_idf51.ino @@ -638,10 +638,10 @@ bool TasmotaI2S::startI2SChannel(bool tx, bool rx) { case I2S_MODE_STD: { i2s_std_slot_config_t _slot_cfg = { - .data_bit_width = (i2s_data_bit_width_t)bps, + .data_bit_width = rx_data_bit_width, .slot_bit_width = (i2s_slot_bit_width_t)audio_i2s.Settings->rx.slot_bit_width, - .slot_mode = (i2s_slot_mode_t)channels, - .slot_mask = (i2s_std_slot_mask_t)audio_i2s.Settings->rx.slot_mask, + .slot_mode = rx_slot_mode, + .slot_mask = (i2s_std_slot_mask_t)_rx_slot_mask, .ws_width = audio_i2s.Settings->rx.ws_width, .ws_pol = audio_i2s.Settings->rx.ws_pol, .bit_shift = audio_i2s.Settings->rx.bit_shift, @@ -669,7 +669,9 @@ bool TasmotaI2S::startI2SChannel(bool tx, bool rx) { }, }, }; - + if(audio_i2s.Settings->rx.apll == 1){ + rx_std_cfg.clk_cfg.clk_src = I2S_CLK_SRC_APLL; + } err = i2s_channel_init_std_mode(_rx_handle, &rx_std_cfg); AddLog(LOG_LEVEL_DEBUG, "I2S: RX i2s_channel_init_std_mode with err:%i", err); AddLog(LOG_LEVEL_DEBUG, "I2S: RX channel in standard mode with %u bit width on %i channel(s) initialized", bps, rx_slot_mode);