Small tweaks to hopefully improve performance

This commit is contained in:
Dreaded_X 2022-07-03 20:34:11 +02:00
parent 9c39397e59
commit b338fbcca2
6 changed files with 17 additions and 30 deletions

View File

@ -20,7 +20,10 @@ void i2s::init() {
.dma_desc_num = 8,
.dma_frame_num = 64,
.use_apll = false,
.tx_desc_auto_clear = true // avoiding noise in case of data unavailability
.tx_desc_auto_clear = true, // avoiding noise in case of data unavailability
.fixed_mclk = 0,
.mclk_multiple = I2S_MCLK_MULTIPLE_DEFAULT,
.bits_per_chan = I2S_BITS_PER_CHAN_DEFAULT,
};
if (i2s_driver_install(i2s_port, &i2s_config, 0, nullptr) != ESP_OK) {
@ -28,16 +31,16 @@ void i2s::init() {
}
i2s_pin_config_t pin_config = {
.mck_io_num = 0,
.bck_io_num = 26,
.ws_io_num = 25,
.data_out_num = 33,
.data_in_num = I2S_PIN_NO_CHANGE
.data_in_num = I2S_PIN_NO_CHANGE,
};
if (i2s_set_pin(i2s_port, &pin_config) != ESP_OK) {
ESP_LOGE(I2S_TAG, "i2s_set_pin failed");
}
}
static uint32_t sample_rate = 44100;

View File

@ -19,19 +19,6 @@
#define APP_TAG "APP"
void task(void*) {
for (;;) {
vTaskDelay(5000 / portTICK_PERIOD_MS);
avrcp::seek_forward();
avrcp::seek_forward();
avrcp::seek_forward();
avrcp::seek_forward();
avrcp::seek_forward();
avrcp::seek_forward();
}
}
extern "C" void app_main() {
ESP_LOGI(APP_TAG, "Starting Car Stereo");
ESP_LOGI(APP_TAG, "Available Heap: %u", esp_get_free_heap_size());
@ -45,9 +32,6 @@ extern "C" void app_main() {
a2dp::connect_to_last();
/* xTaskCreate(task, "Task", 2048, nullptr, 0, nullptr); */
/* can::init(); */
twai::init();
volume_controller::init();
}

View File

@ -179,5 +179,5 @@ void twai::init() {
ESP_LOGI(TWAI_TAG, "Failed to start driver");
}
xTaskCreatePinnedToCore(listen, "TWAI Listener", 2048, nullptr, 0, nullptr, 1);
xTaskCreatePinnedToCore(listen, "TWAI Listener", 2048, nullptr, 0, nullptr, 0);
}

View File

@ -89,12 +89,12 @@ static void correct_volume(void*) {
uint8_t target = to_radio_volume(volume);
if (radio_volume == target) {
ESP_LOGI(VOLUME_TAG, "SYNCED!");
ESP_LOGI(VOLUME_TAG, "Synced");
_lock_acquire(&lock);
synced = true;
_lock_release(&lock);
} else {
ESP_LOGI(VOLUME_TAG, "Adjusting volume: %i", radio_volume < target);
/* ESP_LOGI(VOLUME_TAG, "Adjusting volume: %i", radio_volume < target); */
twai::change_volume(radio_volume < target);
}
}
@ -104,5 +104,5 @@ static void correct_volume(void*) {
}
void volume_controller::init() {
xTaskCreatePinnedToCore(correct_volume, "Correct volume", 2048, nullptr, 0, nullptr, 1);
xTaskCreatePinnedToCore(correct_volume, "Correct volume", 2048, nullptr, 0, nullptr, 0);
}

View File

@ -58,7 +58,7 @@ void wav::play(const uint8_t* start, const uint8_t* end) {
param->data = start;
param->len = len;
if (xTaskCreate(task, "PlayWav", 2048, param, configMAX_PRIORITIES - 3, nullptr) != pdPASS) {
if (xTaskCreatePinnedToCore(task, "PlayWav", 2048, param, configMAX_PRIORITIES - 3, nullptr, 0) != pdPASS) {
ESP_LOGE(WAV_TAG, "Failed to create play wav task");
}
}

View File

@ -386,9 +386,9 @@ CONFIG_BT_BLUEDROID_ENABLED=y
# Bluedroid Options
#
CONFIG_BT_BTC_TASK_STACK_SIZE=3072
CONFIG_BT_BLUEDROID_PINNED_TO_CORE_0=y
# CONFIG_BT_BLUEDROID_PINNED_TO_CORE_1 is not set
CONFIG_BT_BLUEDROID_PINNED_TO_CORE=0
# CONFIG_BT_BLUEDROID_PINNED_TO_CORE_0 is not set
CONFIG_BT_BLUEDROID_PINNED_TO_CORE_1=y
CONFIG_BT_BLUEDROID_PINNED_TO_CORE=1
CONFIG_BT_BTU_TASK_STACK_SIZE=4096
# CONFIG_BT_BLUEDROID_MEM_DEBUG is not set
CONFIG_BT_CLASSIC_ENABLED=y
@ -1683,9 +1683,9 @@ CONFIG_BTDM_CONTROLLER_MODEM_SLEEP=y
CONFIG_BLUEDROID_ENABLED=y
# CONFIG_NIMBLE_ENABLED is not set
CONFIG_BTC_TASK_STACK_SIZE=3072
CONFIG_BLUEDROID_PINNED_TO_CORE_0=y
# CONFIG_BLUEDROID_PINNED_TO_CORE_1 is not set
CONFIG_BLUEDROID_PINNED_TO_CORE=0
# CONFIG_BLUEDROID_PINNED_TO_CORE_0 is not set
CONFIG_BLUEDROID_PINNED_TO_CORE_1=y
CONFIG_BLUEDROID_PINNED_TO_CORE=1
CONFIG_BTU_TASK_STACK_SIZE=4096
# CONFIG_BLUEDROID_MEM_DEBUG is not set
CONFIG_CLASSIC_BT_ENABLED=y