From ca7670f754a4562c473a25d28d3d58967fbadace Mon Sep 17 00:00:00 2001 From: wizmo2 Date: Sun, 27 Aug 2023 16:02:57 -0400 Subject: [PATCH] fix DAC config to add I2S (either 'I2S' or blank) (#293) Co-authored-by: Wizmo2 --- README.md | 2 +- components/platform_console/cmd_config.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e817d6d3..114c4f8c 100644 --- a/README.md +++ b/README.md @@ -174,7 +174,7 @@ Default and only "host" is 1 as others are used already by flash and spiram. The ### DAC/I2S The NVS parameter "dac_config" set the gpio used for i2s communication with your DAC. You can define the defaults at compile time but nvs parameter takes precedence except for named configurations ``` -bck=,ws=,do=[,mck=0|1|2][,mute=[:0|1][,model=TAS57xx|TAS5713|AC101|I2S][,sda=,scl=[,i2c=]] +bck=,ws=,do=[,mck=0|1|2][,mute=[:0|1][,model=TAS57xx|TAS5713|AC101|WM8978|ES8388|I2S][,sda=,scl=[,i2c=]] ``` if "model" is not set or is not recognized, then default "I2S" is used. The option "mck" is used for some codecs that require a master clock (although they should not). By default GPIO0 is used as MCLK and only recent builds (post mid-2023) can use 1 or 2. Also be aware that this cannot coexit with RMII Ethernet (see ethernet section below). I2C parameters are optional and only needed if your DAC requires an I2C control (See 'dac_controlset' below). Note that "i2c" parameters are decimal, hex notation is not allowed. diff --git a/components/platform_console/cmd_config.c b/components/platform_console/cmd_config.c index f4179dc9..e33d4f7e 100644 --- a/components/platform_console/cmd_config.c +++ b/components/platform_console/cmd_config.c @@ -712,7 +712,7 @@ static int do_i2s_cmd(int argc, char **argv) cmd_send_messaging(argv[0],MESSAGING_ERROR,"DAC Configuration is locked on this platform\n"); return 1; } - strcpy(i2s_dac_pin.model, "I2S"); + //strcpy(i2s_dac_pin.model, "I2S"); ESP_LOGD(TAG,"Processing i2s command %s with %d parameters",argv[0],argc); esp_err_t err=ESP_OK; @@ -1076,7 +1076,7 @@ static char * get_log_level_options(const char * longname){ // loop through dac_set and concatenate model name separated with | static char * get_dac_list(){ - const char * ES8388_MODEL_NAME = "ES8388|"; + const char * EXTRA_MODEL_NAMES = "ES8388|I2S"; char * dac_list=NULL; size_t total_len=0; for(int i=0;dac_set[i];i++){ @@ -1087,7 +1087,7 @@ static char * get_dac_list(){ break; } } - total_len+=strlen(ES8388_MODEL_NAME); + total_len+=strlen(EXTRA_MODEL_NAMES); dac_list = malloc_init_external(total_len+1); if(dac_list){ for(int i=0;dac_set[i];i++){ @@ -1099,7 +1099,7 @@ static char * get_dac_list(){ break; } } - strcat(dac_list,ES8388_MODEL_NAME); + strcat(dac_list,EXTRA_MODEL_NAMES); } return dac_list; } @@ -1270,7 +1270,7 @@ static void register_cspot_config(){ } #endif static void register_i2s_config(void){ - i2s_args.model_name = arg_str1(NULL,"model_name",STR_OR_BLANK(get_dac_list()),"DAC Model Name"); + i2s_args.model_name = arg_str0(NULL,"model_name",STR_OR_BLANK(get_dac_list()),"DAC Model Name"); i2s_args.clear = arg_lit0(NULL, "clear", "Clear configuration"); i2s_args.clock = arg_int0(NULL,"clock","","Clock GPIO. e.g. 33"); i2s_args.wordselect = arg_int0(NULL,"wordselect","","Word Select GPIO. e.g. 25");