diff --git a/.cproject b/.cproject index 2fccfbb4..5520d25d 100644 --- a/.cproject +++ b/.cproject @@ -7,6 +7,12 @@ + + + + + + @@ -29,7 +35,7 @@ - + @@ -41,16 +47,20 @@ - + + + @@ -88,6 +98,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -99,14 +205,24 @@ - + + + - + + + + + + + + + + + - - @@ -126,9 +242,71 @@ true + + + + make + + + + all + + true + + true + + true + + + + + + make + + -j8 + + clean + + true + + true + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index 3b4dfb24..b73d4653 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -11,7 +11,31 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.settings/org.eclipse.cdt.core.prefs b/.settings/org.eclipse.cdt.core.prefs index 919fe151..d722962b 100644 --- a/.settings/org.eclipse.cdt.core.prefs +++ b/.settings/org.eclipse.cdt.core.prefs @@ -1,21 +1,7 @@ eclipse.preferences.version=1 -<<<<<<< HEAD -environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786/BATCH_BUILD/delimiter=; -environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786/BATCH_BUILD/operation=append -environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786/BATCH_BUILD/value=1 -environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786/IDF_PATH/delimiter=; -environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786/IDF_PATH/operation=append -environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786/IDF_PATH/value=d\:/msys2/opt/esp-idf -environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786/PATH/delimiter=; -environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786/PATH/operation=replace -environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786/PATH/value=C\:/msys2/opt/xtensa-esp32-elf/bin;C\:/jdk-12.0.2/bin/server;C\:/jdk-12.0.2/bin;C\:\\Windows\\system32;C\:\\Windows;C\:\\Windows\\System32\\Wbem;C\:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C\:\\Program Files\\NVIDIA Corporation\\NVIDIA NvDLISR;C\:\\jdk-12.0.2\\bin;C\:\\Program Files\\PuTTY\\;C\:\\Program Files (x86)\\HP\\IdrsOCR_15.2.10.1114\\;C\:\\eclipse -======= environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786.212420495/BATCH_BUILD/delimiter=\: environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786.212420495/BATCH_BUILD/operation=append environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786.212420495/BATCH_BUILD/value=1 -environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786.212420495/EXTRA_CFLAGS/delimiter=\: -environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786.212420495/EXTRA_CFLAGS/operation=replace -environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786.212420495/EXTRA_CFLAGS/value=-DRECOVERY_APPLICATION\=1 environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786.212420495/IDF_PATH/delimiter=\: environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786.212420495/IDF_PATH/operation=replace environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786.212420495/IDF_PATH/value=/var/opt/esp-idf @@ -30,6 +16,42 @@ environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786/EXTRA_C environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786/IDF_PATH/delimiter=\: environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786/IDF_PATH/operation=replace environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786/IDF_PATH/value=/var/opt/esp-idf ->>>>>>> refs/remotes/origin/Over_The_Air_Update +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786/PATH/delimiter=; +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786/PATH/operation=replace +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786/PATH/value=C\:/msys2/opt/xtensa-esp32-elf/bin;C\:/jdk-12.0.2/bin/server;C\:/jdk-12.0.2/bin;C\:\\Windows\\system32;C\:\\Windows;C\:\\Windows\\System32\\Wbem;C\:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C\:\\Program Files\\NVIDIA Corporation\\NVIDIA NvDLISR;C\:\\jdk-12.0.2\\bin;C\:\\Program Files\\PuTTY\\;C\:\\Program Files (x86)\\HP\\IdrsOCR_15.2.10.1114\\;C\:\\eclipse environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786/append=true environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786/appendContributed=true +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.839256934/BATCH_BUILD/delimiter=\: +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.839256934/BATCH_BUILD/operation=append +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.839256934/BATCH_BUILD/value=1 +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.839256934/IDF_PATH/delimiter=\: +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.839256934/IDF_PATH/operation=append +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.839256934/IDF_PATH/value=/var/opt/esp-idf/ +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.839256934/PATH/delimiter=\: +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.839256934/PATH/operation=replace +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.839256934/PATH/value=/var/opt/xtensa-esp32-elf/bin/\:/sbin\:/bin\:/usr/bin\:/usr/local/bin\:/snap/bin\:/bin\:/sbin\:/usr/bin\:/usr/local/bin\:/snap/bin +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.839256934/PROJECT_NAME/delimiter=\: +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.839256934/PROJECT_NAME/operation=replace +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.839256934/PROJECT_NAME/value=recovery.custom +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.839256934/PROJECT_VER/delimiter=\: +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.839256934/PROJECT_VER/operation=append +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.839256934/PROJECT_VER/value=custom +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.839256934/append=true +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.839256934/appendContributed=true +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348/BATCH_BUILD/delimiter=\: +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348/BATCH_BUILD/operation=append +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348/BATCH_BUILD/value=1 +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348/IDF_PATH/delimiter=\: +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348/IDF_PATH/operation=append +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348/IDF_PATH/value=/var/opt/esp-idf/ +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348/PATH/delimiter=\: +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348/PATH/operation=replace +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348/PATH/value=/var/opt/xtensa-esp32-elf/bin/\:/sbin\:/bin\:/usr/bin\:/usr/local/bin\:/snap/bin\:/bin\:/sbin\:/usr/bin\:/usr/local/bin\:/snap/bin +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348/PROJECT_NAME/delimiter=\: +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348/PROJECT_NAME/operation=replace +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348/PROJECT_NAME/value=squeezelite.custom +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348/PROJECT_VER/delimiter=\: +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348/PROJECT_VER/operation=append +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348/PROJECT_VER/value=custom +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348/append=true +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348/appendContributed=true diff --git a/Makefile b/Makefile index db0f7915..566e6447 100644 --- a/Makefile +++ b/Makefile @@ -2,13 +2,15 @@ #export PROJECT_BUILD_NAME="${build_version_prefix}${BUILD_NUMBER}" #export PROJECT_BUILD_TARGET="${config_target}" -PROJECT_BUILD_NAME?=local -PROJECT_CONFIG_TARGET?=custom -PROJECT_NAME?=squeezelite.$(PROJECT_CONFIG_TARGET) -PROJECT_VER?="$(PROJECT_BUILD_NAME)-$(PROJECT_CONFIG_TARGET)" -RECOVERY_APPLICATION?=0 -CFLAGS?= +#PROJECT_BUILD_NAME?=local +#PROJECT_CONFIG_TARGET?=custom +#PROJECT_NAME?=squeezelite.$(PROJECT_CONFIG_TARGET) +#PROJECT_VER?="$(PROJECT_BUILD_NAME)-$(PROJECT_CONFIG_TARGET)" - + +#recovery: PROJECT_NAME:=recovery.$(PROJECT_CONFIG_TARGET) +#recovery: CPPFLAGS+=-DRECOVERY_APPLICATION=1 + +PROJECT_NAME?=squeezelite include $(IDF_PATH)/make/project.mk diff --git a/components/driver_bt/CMakeLists.txt b/components/driver_bt/CMakeLists.txt index e907e11c..7c31465a 100644 --- a/components/driver_bt/CMakeLists.txt +++ b/components/driver_bt/CMakeLists.txt @@ -1,5 +1,5 @@ idf_component_register(SRCS "bt_app_core.c" "bt_app_sink.c" "bt_app_source.c" - INCLUDE_DIRS . ../tools/ + INCLUDE_DIRS "." "../tools/" REQUIRES esp_common PRIV_REQUIRES freertos bt io nvs_flash esp32 spi_flash newlib log console pthread ) diff --git a/components/driver_bt/bt_app_source.c b/components/driver_bt/bt_app_source.c index f5a0f955..5f48a78c 100644 --- a/components/driver_bt/bt_app_source.c +++ b/components/driver_bt/bt_app_source.c @@ -794,4 +794,4 @@ static void bt_app_av_state_disconnecting(uint16_t event, void *param) ESP_LOGE(TAG,"%s unhandled evt %d", __func__, event); break; } -} \ No newline at end of file +} diff --git a/components/driver_bt/component.mk b/components/driver_bt/component.mk index e694d472..7460959c 100644 --- a/components/driver_bt/component.mk +++ b/components/driver_bt/component.mk @@ -8,5 +8,6 @@ # CFLAGS += -I$(COMPONENT_PATH)/../tools - -#CFLAGS += -DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG +COMPONENT_ADD_INCLUDEDIRS := . +COMPONENT_ADD_INCLUDEDIRS += $(COMPONENT_PATH)/../tools + diff --git a/components/squeezelite-ota/squeezelite-ota.c b/components/squeezelite-ota/squeezelite-ota.c index 9a490250..4b326019 100644 --- a/components/squeezelite-ota/squeezelite-ota.c +++ b/components/squeezelite-ota/squeezelite-ota.c @@ -23,9 +23,9 @@ #include "tcpip_adapter.h" -static const char *TAG = "simple_ota_example"; -extern const uint8_t server_cert_pem_start[] asm("_binary_ca_cert_pem_start"); -extern const uint8_t server_cert_pem_end[] asm("_binary_ca_cert_pem_end"); +static const char *TAG = "squeezelite-ota"; +//extern const uint8_t server_cert_pem_start[] asm("_binary_ca_cert_pem_start"); +//extern const uint8_t server_cert_pem_end[] asm("_binary_ca_cert_pem_end"); #define OTA_URL_SIZE 256 static char ota_status[31]={0}; @@ -74,7 +74,7 @@ void ota_task(void *pvParameter, const char * bin_url) esp_http_client_config_t config = { .url = bin_url, - .cert_pem = (char *)server_cert_pem_start, + //.cert_pem = (char *)server_cert_pem_start, .event_handler = _http_event_handler, }; diff --git a/components/wifi-manager/component.mk b/components/wifi-manager/component.mk index 1d105d37..91b23d2b 100644 --- a/components/wifi-manager/component.mk +++ b/components/wifi-manager/component.mk @@ -7,5 +7,7 @@ # please read the SDK documents if you need to do this. # COMPONENT_EMBED_FILES := style.css code.js index.html bootstrap.min.css.gz jquery.min.js.gz popper.min.js.gz bootstrap.min.js.gz -CFLAGS += -D LOG_LOCAL_LEVEL=ESP_LOG_DEBUG +CFLAGS += -D LOG_LOCAL_LEVEL=ESP_LOG_DEBUG \ + -I$(COMPONENT_PATH)/../tools COMPONENT_ADD_INCLUDEDIRS := . +COMPONENT_ADD_INCLUDEDIRS += $(COMPONENT_PATH)/../tools diff --git a/components/wifi-manager/wifi_manager.c b/components/wifi-manager/wifi_manager.c index 58329f1d..abd1e726 100644 --- a/components/wifi-manager/wifi_manager.c +++ b/components/wifi-manager/wifi_manager.c @@ -58,7 +58,6 @@ Contains the freeRTOS task and all necessary support #include "esp_app_format.h" - #ifndef SQUEEZELITE_ESP32_RELEASE_URL #define SQUEEZELITE_ESP32_RELEASE_URL "https://github.com/sle118/squeezelite-esp32/releases" #endif @@ -408,20 +407,11 @@ void wifi_manager_clear_ip_info_json(){ void wifi_manager_generate_ip_info_json(update_reason_code_t update_reason_code){ wifi_config_t *config = wifi_manager_get_wifi_sta_config(); if(config){ -<<<<<<< HEAD -======= - const char ip_info_json_format[] = ",\"ip\":\"%s\",\"netmask\":\"%s\",\"gw\":\"%s\",\"urc\":%d,\"project_name\":\"%s\",\"version\":\"%s\""; ->>>>>>> branch 'Over_The_Air_Update' of https://github.com/sle118/squeezelite-esp32.git #if RECOVERY_APPLICATION -<<<<<<< HEAD const char ip_info_json_format[] = ",\"ip\":\"%s\",\"netmask\":\"%s\",\"gw\":\"%s\",\"urc\":%d,\"project_name\":\"%s\",\"version\":\"%s\", \"ota_dsc\":\"%s\", \"ota_pct\":%d}\n"; #else const char ip_info_json_format[] = ",\"ip\":\"%s\",\"netmask\":\"%s\",\"gw\":\"%s\",\"urc\":%d,\"project_name\":\"%s\",\"version\":\"%s\"}\n"; #endif -======= - "\"ota_dsc\":\"%s\", \"ota_pct\":%d"; - "}\n"; ->>>>>>> branch 'Over_The_Air_Update' of https://github.com/sle118/squeezelite-esp32.git memset(ip_info_json, 0x00, JSON_IP_INFO_SIZE); const esp_app_desc_t* desc = esp_ota_get_app_description(); /* to avoid declaring a new buffer we copy the data directly into the buffer at its correct address */ diff --git a/components/wifi-manager/wifi_manager.h b/components/wifi-manager/wifi_manager.h index d56adce4..aa89de07 100644 --- a/components/wifi-manager/wifi_manager.h +++ b/components/wifi-manager/wifi_manager.h @@ -41,10 +41,15 @@ extern "C" { #include "esp_wifi_types.h" #ifndef RECOVERY_APPLICATION -#define RECOVERY_APPLICATION 0 +#error "RECOVERY_APPLICATION not defined. Defaulting to squeezelite" +#endif + +#if RECOVERY_APPLICATION==1 +#warning "compiling for recovery." +#elif RECOVERY_APPLICATION==0 +#warning "compiling for squeezelite." #else -#undef RECOVERY_APPLICATION -#define RECOVERY_APPLICATION 1 +#error "unknown configuration" #endif diff --git a/main/console.c b/main/console.c index f9be4173..a36226dc 100644 --- a/main/console.c +++ b/main/console.c @@ -25,6 +25,7 @@ #include "esp_pthread.h" #include "cmd_decl.h" #include "console.h" +#include "wifi_manager.h" #include "cmd_squeezelite.h" #include "nvs_utilities.h" @@ -33,7 +34,7 @@ static void * console_thread(); void console_start(); static const char * TAG = "console"; -#if (RECOVERY_APPLICATION ) +#if RECOVERY_APPLICATION ==1 extern void start_ota(const char * bin_url); #endif @@ -240,12 +241,14 @@ void console_start() { esp_console_register_help_command(); register_system(); register_nvs(); -#if ! RECOVERY_APPLICATION -#warning "compiling for squeezelite" +#if RECOVERY_APPLICATION!=1 +#warning "compiling for squeezelite" register_squeezelite(); -#else +#elif RECOVERY_APPLICATION==1 #warning "compiling for recovery" register_ota_cmd(); +#else +#error "Unknown build configuration" #endif register_i2ctools(); printf("\n" diff --git a/main/platform_esp32.h b/main/platform_esp32.h index 485a69b4..827d4c42 100644 --- a/main/platform_esp32.h +++ b/main/platform_esp32.h @@ -29,9 +29,3 @@ extern void console_start(); extern pthread_cond_t wifi_connect_suspend_cond; extern pthread_t wifi_connect_suspend_mutex; -#ifndef RECOVERY_APPLICATION -#define RECOVERY_APPLICATION 0 -#else -#undef RECOVERY_APPLICATION -#define RECOVERY_APPLICATION 1 -#endif