sync
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
LOG_MODULE_REGISTER(audio, LOG_LEVEL_INF);
|
||||
|
||||
/* Dauer eines Blocks in ms (4096 Bytes / (16kHz * 2 Kanäle * 2 Bytes)) = 64 ms */
|
||||
#define BLOCK_DURATION_MS 64
|
||||
#define BLOCK_DURATION_MS ((AUDIO_BLOCK_SIZE * 1000) / (AUDIO_SAMPLE_RATE * 2 * (AUDIO_WORD_WIDTH / 8)))
|
||||
#define MAX_WAIT_TIME_MS (3 * BLOCK_DURATION_MS)
|
||||
|
||||
/* Slab für I2S. Keine weiteren Queues oder Threads nötig. */
|
||||
@@ -93,14 +93,14 @@ void audio_refresh_file_count(void)
|
||||
|
||||
static void wait_for_i2s_drain(void)
|
||||
{
|
||||
/* Maximale Wartezeit berechnen (8 Blöcke * 64ms = 512ms + Toleranz) */
|
||||
/* Maximale Wartezeit berechnen */
|
||||
int64_t deadline = k_uptime_get() + (AUDIO_BLOCK_COUNT * BLOCK_DURATION_MS) + 100;
|
||||
|
||||
while (k_mem_slab_num_free_get(&audio_slab) < AUDIO_BLOCK_COUNT)
|
||||
{
|
||||
if (k_uptime_get() >= deadline)
|
||||
{
|
||||
LOG_WRN("Timeout waiting for I2S drain");
|
||||
LOG_WRN("Timeout waiting for I2S drain, used slabs: %u", AUDIO_BLOCK_COUNT - k_mem_slab_num_free_get(&audio_slab));
|
||||
break;
|
||||
}
|
||||
k_sleep(K_MSEC(10));
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
#define AUDIO_THREAD_PRIORITY 5
|
||||
#define AUDIO_EVENTS_MASK (AUDIO_EVENT_PLAY | AUDIO_EVENT_STOP | AUDIO_EVENT_SYNC)
|
||||
|
||||
#define AUDIO_BLOCK_SIZE 4096
|
||||
#define AUDIO_BLOCK_COUNT 8
|
||||
#define AUDIO_BLOCK_SIZE 8192 /* 512 Samples Stereo (16-bit) = 8192 Bytes */
|
||||
#define AUDIO_BLOCK_COUNT 4
|
||||
#define AUDIO_WORD_WIDTH 16
|
||||
#define AUDIO_SAMPLE_RATE 16000
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <zephyr/fs/littlefs.h>
|
||||
#include <zephyr/drivers/flash.h>
|
||||
#include <zephyr/dfu/flash_img.h>
|
||||
#include <zephyr/dfu/mcuboot.h>
|
||||
#include <zephyr/pm/device.h>
|
||||
#include <fs.h>
|
||||
LOG_MODULE_REGISTER(buzz_fs, LOG_LEVEL_INF);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <zephyr/init.h>
|
||||
#include <zephyr/sys/printk.h>
|
||||
#include <zephyr/logging/log_ctrl.h>
|
||||
#include <zephyr/dfu/mcuboot.h>
|
||||
#include <app_version.h>
|
||||
#include <version.h>
|
||||
#include <ncs_version.h>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#define PROTOCOL_VERSION 1
|
||||
|
||||
LOG_MODULE_REGISTER(protocol, LOG_LEVEL_DBG);
|
||||
LOG_MODULE_REGISTER(protocol, LOG_LEVEL_INF);
|
||||
|
||||
#define PROTOCOL_STACK_SIZE 2048
|
||||
#define PROTOCOL_PRIORITY 5
|
||||
|
||||
Reference in New Issue
Block a user