From 4825dc6644c5bdd841206bad4605072c3b7a634f Mon Sep 17 00:00:00 2001 From: Sebastien Date: Mon, 26 Oct 2020 18:17:17 -0400 Subject: [PATCH] Update Github Build and config command --- .../{I2S-4MBFlash.yml => CrossBuild.yml} | 59 +++++++++--------- .github/workflows/ESP32-A1S.yml | 36 ----------- .github/workflows/SqueezeAmp.yml | 36 ----------- CMakeLists.txt | 6 +- components/platform_console/CMakeLists.txt | 2 +- components/platform_console/cmd_config.c | 30 ++++----- components/wifi-manager/res/code.js | 6 +- components/wifi-manager/res/code.js.gz | Bin 11297 -> 11308 bytes 8 files changed, 53 insertions(+), 122 deletions(-) rename .github/workflows/{I2S-4MBFlash.yml => CrossBuild.yml} (79%) delete mode 100644 .github/workflows/ESP32-A1S.yml delete mode 100644 .github/workflows/SqueezeAmp.yml diff --git a/.github/workflows/I2S-4MBFlash.yml b/.github/workflows/CrossBuild.yml similarity index 79% rename from .github/workflows/I2S-4MBFlash.yml rename to .github/workflows/CrossBuild.yml index df7278d6..4f93ba2b 100644 --- a/.github/workflows/I2S-4MBFlash.yml +++ b/.github/workflows/CrossBuild.yml @@ -31,15 +31,15 @@ jobs: run: | echo "TARGET_BUILD_NAME=${{ matrix.node }}" >> $GITHUB_ENV echo "build_version_prefix=V0." >> $GITHUB_ENV - - uses: actions/checkout@v2 - with: - submodules: true - name: Cache build id: cache-build uses: actions/cache@v1 with: path: ${{github.RUNNER_WORKSPACE}}/build key: ${{ runner.os }}-${TARGET_BUILD_NAME} + - uses: actions/checkout@v2 + with: + submodules: true - name: Set build parameters run: | shopt -s nocasematch @@ -70,23 +70,22 @@ jobs: echo "Target is ${TARGET_BUILD_NAME}" env - name: Build the firmware - if: env.release_flag == 1 && env.release_flag == 0 run: | docker run --rm -v $PWD:/project -w /project espressif/idf:release-v4.0 /bin/bash -c "cp build-scripts/${TARGET_BUILD_NAME}-sdkconfig.defaults sdkconfig && export PROJECT_VER=${TARGET_BUILD_NAME}-${{ steps.buildnumber.outputs.build_number }} && idf.py build && zip ${artifact_file_name} ../partitions*.csv *.bin ./bootloader/bootloader.bin ./partition_table/partition-table.bin flash_project_args ./size_*.txt" - - name: Build Mock firmware - run: | - mkdir -p build - cd build - mkdir -p partition_table - mkdir -p bootloader - echo "mock content"> squeezelite.bin - echo "mock content"> recovery.bin - echo "mock content"> ./bootloader/bootloader.bin - echo "mock content"> ./partition_table/partition-table.bin - echo "mock content"> flash_project_args - echo "mock content"> size_comp1.txt - echo "mock content"> size_comp2.txt - echo "mock content"> ../partitions.csv + # - name: Build Mock firmware + # run: | + # mkdir -p build + # cd build + # mkdir -p partition_table + # mkdir -p bootloader + # echo "mock content"> squeezelite.bin + # echo "mock content"> recovery.bin + # echo "mock content"> ./bootloader/bootloader.bin + # echo "mock content"> ./partition_table/partition-table.bin + # echo "mock content"> flash_project_args + # echo "mock content"> size_comp1.txt + # echo "mock content"> size_comp2.txt + # echo "mock content"> ../partitions.csv - uses: actions/upload-artifact@v2 with: name: ${{ env.artifact_file_name }} @@ -104,19 +103,19 @@ jobs: path: | build/squeezelite.bin - - name: Create Release - if: env.release_flag == 1 - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token - with: - tag_name: ${{ env.tag }} + # - name: Create Release + # if: env.release_flag == 1 + # id: create_release + # uses: actions/create-release@v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + # with: + # tag_name: ${{ env.tag }} - release_name: ${{ env.name }} - body: ${{ env.description }} - draft: false - prerelease: true + # release_name: ${{ env.name }} + # body: ${{ env.description }} + # draft: false + # prerelease: true diff --git a/.github/workflows/ESP32-A1S.yml b/.github/workflows/ESP32-A1S.yml deleted file mode 100644 index 3b8f6689..00000000 --- a/.github/workflows/ESP32-A1S.yml +++ /dev/null @@ -1,36 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: ESP32-A1S - -on: - push: - branches: [ master-cmake ] - pull_request: - branches: [ master-cmake ] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Set target - run: echo "TARGET_BUILD_NAME=ESP32-A1S" >> $GITHUB_ENV - id: target-name-generator - - name: Show Target - run: echo "Target is ${TARGET_BUILD_NAME}" - - uses: actions/checkout@v2 - with: - submodules: true - - name: Generate build number - id: buildnumber - uses: einaregilsson/build-number@v2 - with: - token: ${{secrets.github_token}} - - name: Cache build - id: cache-build - uses: actions/cache@v1 - with: - path: ${{github.workspace}}/build - key: ${{ runner.os }}-${TARGET_BUILD_NAME} - - name: Build the firmware - run: | - docker run --rm -v $PWD:/project -w /project espressif/idf:release-v4.0 /bin/bash -c "cp build-scripts/${TARGET_BUILD_NAME}-sdkconfig.defaults sdkconfig && export PROJECT_VER=${TARGET_BUILD_NAME}-${{ steps.buildnumber.outputs.build_number }} && idf.py build" \ No newline at end of file diff --git a/.github/workflows/SqueezeAmp.yml b/.github/workflows/SqueezeAmp.yml deleted file mode 100644 index dc6ef42b..00000000 --- a/.github/workflows/SqueezeAmp.yml +++ /dev/null @@ -1,36 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: SqueezeAmp - -on: - push: - branches: [ master-cmake ] - pull_request: - branches: [ master-cmake ] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Set target - run: echo "TARGET_BUILD_NAME=SqueezeAmp" >> $GITHUB_ENV - id: target-name-generator - - name: Show Target - run: echo "Target is ${TARGET_BUILD_NAME}" - - uses: actions/checkout@v2 - with: - submodules: true - - name: Generate build number - id: buildnumber - uses: einaregilsson/build-number@v2 - with: - token: ${{secrets.github_token}} - - name: Cache build - id: cache-build - uses: actions/cache@v1 - with: - path: ${{github.workspace}}/build - key: ${{ runner.os }}-${TARGET_BUILD_NAME} - - name: Build the firmware - run: | - docker run --rm -v $PWD:/project -w /project espressif/idf:release-v4.0 /bin/bash -c "cp build-scripts/${TARGET_BUILD_NAME}-sdkconfig.defaults sdkconfig && export PROJECT_VER=${TARGET_BUILD_NAME}-${{ steps.buildnumber.outputs.build_number }} && idf.py build" \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f82e0ac..3b0a76d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,5 +11,7 @@ include(squeezelite.cmake) set(PROJECT_VER $ENV{PROJECT_VER}) -#target_compile_definitions(__idf_squeezelite-ota PRIVATE -DLOG_LOCAL_LEVEL=ESP_LOG_VERBOSE) -#target_compile_definitions(__idf_driver_bt PRIVATE -DLOG_LOCAL_LEVEL=ESP_LOG_VERBOSE) \ No newline at end of file +#target_compile_definitions(__idf_squeezelite-ota PRIVATE DLOG_LOCAL_LEVEL=ESP_LOG_VERBOSE) +#target_compile_definitions(__idf_driver_bt PRIVATE DLOG_LOCAL_LEVEL=ESP_LOG_VERBOSE) +target_compile_definitions(__idf_main PUBLIC MODEL_NAME=SqueezeESP32) +target_compile_definitions(__idf_platform_console PUBLIC MODEL_NAME=SqueezeESP32) \ No newline at end of file diff --git a/components/platform_console/CMakeLists.txt b/components/platform_console/CMakeLists.txt index bf4e3780..6d6e2cf8 100644 --- a/components/platform_console/CMakeLists.txt +++ b/components/platform_console/CMakeLists.txt @@ -8,6 +8,6 @@ idf_component_register( SRCS cmd_config.c INCLUDE_DIRS . REQUIRES nvs_flash - PRIV_REQUIRES console app_update tools services spi_flash platform_config vfs pthread wifi-manager platform_config newlib telnet display ) + PRIV_REQUIRES console app_update tools services spi_flash platform_config vfs pthread wifi-manager platform_config newlib telnet display squeezelite) target_link_libraries(${COMPONENT_LIB} "-Wl,--undefined=GDS_DrawPixelFast") target_link_libraries(${COMPONENT_LIB} ${build_dir}/esp-idf/$/lib$.a ) diff --git a/components/platform_console/cmd_config.c b/components/platform_console/cmd_config.c index 82133db4..ec90b34c 100644 --- a/components/platform_console/cmd_config.c +++ b/components/platform_console/cmd_config.c @@ -25,23 +25,23 @@ const char * desc_spdif= "SPDIF Options"; const char * desc_audio= "General Audio Options"; -#define CODECS_BASE "flac,pcm,mp3,ogg" +#define CODECS_BASE "flac|pcm|mp3|ogg" #if NO_FAAD #define CODECS_AAC "" #else -#define CODECS_AAC ",aac" +#define CODECS_AAC "|aac" #endif #if FFMPEG -#define CODECS_FF ",wma,alac" +#define CODECS_FF "|wma|alac" #else #define CODECS_FF "" #endif #if DSD -#define CODECS_DSD ",dsd" +#define CODECS_DSD "|dsd" #else #define CODECS_DSD "" #endif -#define CODECS_MP3 " (mad,mpg for specific mp3 codec)" +#define CODECS_MP3 "|mad|mpg" #define CODECS CODECS_BASE CODECS_AAC CODECS_FF CODECS_DSD CODECS_MP3 #define NOT_OUTPUT "has input capabilities only" @@ -75,6 +75,8 @@ static struct { struct arg_end *end; } audio_args; static struct { + struct arg_str * output_device; // " -d =\tSet logging level, logs: all|slimproto|stream|decode|output|ir, level: info|debug|sdebug\n" + struct arg_str * name;// " -n \t\tSet the player name\n" struct arg_str * server; // -s [:]\tConnect to specified server, otherwise uses autodiscovery to find server\n" struct arg_str * buffers;// " -b :\tSpecify internal Stream and Output buffer sizes in Kbytes\n" struct arg_str * codecs;// " -c ,\tRestrict codecs to those specified, otherwise load all available codecs; known codecs: " CODECS "\n" @@ -88,7 +90,6 @@ static struct { #if IR struct arg_str * log_level_ir; #endif - struct arg_str * output_device; // " -d =\tSet logging level, logs: all|slimproto|stream|decode|output|ir, level: info|debug|sdebug\n" // " -e ,\tExplicitly exclude native support of one or more codecs; known codecs: " CODECS "\n" // " -f \t\tWrite debug to logfile\n" // #if IR @@ -96,7 +97,6 @@ static struct { // #endif struct arg_str * mac_addr; // " -m \t\tSet mac address, format: ab:cd:ef:12:34:56\n" struct arg_str * model_name;// " -M \tSet the squeezelite player model name sent to the server (default: " MODEL_NAME_STRING ")\n" - struct arg_str * name;// " -n \t\tSet the player name\n" struct arg_lit * header_format;// " -W\t\t\tRead wave and aiff format from header, ignore server parameters\n" struct arg_str * rates; // " -r [:]\tSample rates supported, allows output to be off when squeezelite is started; rates = |-|,,; delay = optional delay switching rates in ms\n" #if RESAMPLE @@ -160,10 +160,10 @@ static int do_audio_cmd(int argc, char **argv){ if(audio_args.jack_behavior->count>0){ err = ESP_OK; // suppress any error code that might have happened in a previous step - if(strcasecmp(audio_args.jack_behavior->sval[0],"Headphones")){ + if(strcasecmp(audio_args.jack_behavior->sval[0],"Headphones")==0){ err = config_set_value(NVS_TYPE_STR, "jack_mutes_amp", "y"); } - else if(strcasecmp(audio_args.jack_behavior->sval[0],"Subwoofer")){ + else if(strcasecmp(audio_args.jack_behavior->sval[0],"Subwoofer")==0){ err = config_set_value(NVS_TYPE_STR, "jack_mutes_amp", "n"); } else { @@ -382,7 +382,7 @@ cJSON * spdif_cb(){ cJSON * audio_cb(){ cJSON * values = cJSON_CreateObject(); char * p = config_alloc_get_default(NVS_TYPE_STR, "jack_mutes_amp", "n", 0); - cJSON_AddBoolToObject(values,"jack_behavior",(strcmp(p,"1") == 0 ||strcasecmp(p,"y") == 0)); + cJSON_AddStringToObject(values,"jack_behavior",(strcmp(p,"1") == 0 ||strcasecmp(p,"y") == 0)?"Headphones":"Subwoofer"); FREE_AND_NULL(p); return values; } @@ -561,7 +561,7 @@ static void register_audio_config(void){ static void register_squeezelite_config(void){ squeezelite_args.server = arg_str0("s","server","[:]","Connect to specified server, otherwise uses autodiscovery to find server"); squeezelite_args.buffers = arg_str0("b","buffers",":","Internal Stream and Output buffer sizes in Kbytes"); - squeezelite_args.codecs = arg_strn("c","codecs",",",0,20,"Restrict codecs to those specified, otherwise load all available codecs; known codecs"); + squeezelite_args.codecs = arg_strn("c","codecs","+" CODECS "+",0,20,"Restrict codecs to those specified, otherwise load all available codecs; known codecs: " CODECS ); squeezelite_args.timeout = arg_int0("C","timeout","","Close output device when idle after timeout seconds, default is to keep it open while player is 'on"); squeezelite_args.log_level = arg_str0("d","loglevel","log=level","Set logging level, logs: all|slimproto|stream|decode|output|ir, level: info|debug|sdebug"); // " -d =\tSet logging level, logs: all|slimproto|stream|decode|output|ir, level: info|debug|sdebug\n" // squeezelite_args.log_level_all = arg_str0(NULL,"all",get_log_level_options("all"),"Overall Logging Level"); @@ -573,10 +573,10 @@ static void register_squeezelite_config(void){ squeezelite_args.log_level_ir= arg_str0(NULL,"loglevel_ir",get_log_level_options("ir"),"IR Logging Level"); #endif - squeezelite_args.output_device = arg_str0("o","output_device","","Output device"); - squeezelite_args.mac_addr = arg_str0("m","mac_addr","","Mac address, format: ab:cd:ef:12:34:56"); - squeezelite_args.model_name = arg_str0("M", "modelname", "","Squeezelite player model name sent to the server"); - squeezelite_args.name = arg_str0("n","name","","Player name"); + squeezelite_args.output_device = arg_str0("o","output_device","","Output device (BT, I2S or SPDIF)"); + squeezelite_args.mac_addr = arg_str0("m","mac_addr","","Mac address, format: ab:cd:ef:12:34:56."); + squeezelite_args.model_name = arg_str0("M", "modelname", "","Set the squeezelite player model name sent to the server (default: " MODEL_NAME ")"); + squeezelite_args.name = arg_str0("n","name","","Player name, if different from the current host name. Name can alternatively be assigned from the system/device name configuration."); squeezelite_args.header_format = arg_lit0("W","header_format","Read wave and aiff format from header, ignore server parameters"); squeezelite_args.rates = arg_str0("r","rates","[:]", "Sample rates supported, allows output to be off when squeezelite is started; rates = |-|,,; delay = optional delay switching rates in ms\n"); #if RESAMPLE diff --git a/components/wifi-manager/res/code.js b/components/wifi-manager/res/code.js index 882735e1..f6d26d32 100644 --- a/components/wifi-manager/res/code.js +++ b/components/wifi-manager/res/code.js @@ -1169,7 +1169,8 @@ function getCommands() { } else { innerhtml += '
'; if (placeholder.includes('|')) { - placeholder = placeholder.replace('<', '').replace('>', ''); + extraclass = (placeholder.startsWith('+')? ' multiple ':''); + placeholder = placeholder.replace('<', '').replace('=', '').replace('>', ''); innerhtml += '