mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-08 20:47:08 +03:00
Jenkins integration - Migrate to CMake
This commit is contained in:
3
CMakeLists.txt
Normal file
3
CMakeLists.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.5)
|
||||||
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||||
|
project(squeezelite-esp32)
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
set(COMPONENT_SRCS "cmd_i2ctools.c")
|
set(COMPONENT_SRCS "cmd_i2ctools.c")
|
||||||
set(COMPONENT_ADD_INCLUDEDIRS ".")
|
set(COMPONENT_ADD_INCLUDEDIRS ".")
|
||||||
|
set(COMPONENT_REQUIRES console spi_flash)
|
||||||
|
|
||||||
register_component()
|
register_component()
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
set(COMPONENT_ADD_INCLUDEDIRS . )
|
idf_component_register(SRCS "bt_app_core.c" "bt_app_sink.c" "bt_app_source.c"
|
||||||
|
INCLUDE_DIRS . ../tools/
|
||||||
|
REQUIRES esp_common
|
||||||
|
PRIV_REQUIRES freertos bt io nvs_flash esp32 spi_flash newlib log console pthread
|
||||||
|
)
|
||||||
|
|
||||||
set(COMPONENT_SRCS "bt_app_core.c" "bt_app_sink.c" "bt_app_source.c")
|
|
||||||
set(REQUIRES esp_common)
|
|
||||||
set(REQUIRES_COMPONENTS freertos nvs_flash esp32 spi_flash newlib log console )
|
|
||||||
|
|
||||||
register_component()
|
|
||||||
|
|||||||
6
components/io/CMakeLists.txt
Normal file
6
components/io/CMakeLists.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
idf_component_register(SRCS "led.c"
|
||||||
|
INCLUDE_DIRS . ../tools/
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -1,11 +1,6 @@
|
|||||||
set(COMPONENT_ADD_INCLUDEDIRS .)
|
idf_component_register(SRCS "dns_server.c" "http_server.c" "json.c" "wifi_manager.c"
|
||||||
|
INCLUDE_DIRS .
|
||||||
set(COMPONENT_SRCS "dns_server.c" "http_server.c" "json.c" "wifi_manager.c")
|
REQUIRES esp_common
|
||||||
set(REQUIRES esp_common)
|
PRIV_REQUIRES newlib freertos spi_flash nvs_flash mdns pthread wpa_supplicant cmd_system
|
||||||
set(COMPONENT_EMBED_FILES "style.css jquery.gz code.js index.html")
|
EMBED_FILES style.css jquery.gz code.js index.html
|
||||||
|
)
|
||||||
set(REQUIRES_COMPONENTS freertos )
|
|
||||||
|
|
||||||
register_component()
|
|
||||||
|
|
||||||
|
|
||||||
@@ -225,6 +225,8 @@ void http_server_netconn_serve(struct netconn *conn) {
|
|||||||
uint8_t autoexec_flag=0;
|
uint8_t autoexec_flag=0;
|
||||||
int buflen=MAX_COMMAND_LINE_SIZE+strlen(template)+1;
|
int buflen=MAX_COMMAND_LINE_SIZE+strlen(template)+1;
|
||||||
char * buff = malloc(buflen);
|
char * buff = malloc(buflen);
|
||||||
|
char *s = "\"";
|
||||||
|
char *r = "\\\"";
|
||||||
if(!buff)
|
if(!buff)
|
||||||
{
|
{
|
||||||
ESP_LOGE(TAG,"Unable to allocate buffer for config.json!");
|
ESP_LOGE(TAG,"Unable to allocate buffer for config.json!");
|
||||||
@@ -242,7 +244,7 @@ void http_server_netconn_serve(struct netconn *conn) {
|
|||||||
do {
|
do {
|
||||||
snprintf(autoexec_name,sizeof(autoexec_name)-1,"autoexec%u",i);
|
snprintf(autoexec_name,sizeof(autoexec_name)-1,"autoexec%u",i);
|
||||||
ESP_LOGD(TAG,"Getting command name %s", autoexec_name);
|
ESP_LOGD(TAG,"Getting command name %s", autoexec_name);
|
||||||
autoexec_value= wifi_manager_alloc_get_config(autoexec_name, &l);
|
autoexec_value = wifi_manager_alloc_get_config(autoexec_name, &l);
|
||||||
if(autoexec_value!=NULL ){
|
if(autoexec_value!=NULL ){
|
||||||
if(i>1)
|
if(i>1)
|
||||||
{
|
{
|
||||||
@@ -250,6 +252,7 @@ void http_server_netconn_serve(struct netconn *conn) {
|
|||||||
ESP_LOGD(TAG,"%s", array_separator);
|
ESP_LOGD(TAG,"%s", array_separator);
|
||||||
}
|
}
|
||||||
ESP_LOGI(TAG,"found command %s = %s", autoexec_name, autoexec_value);
|
ESP_LOGI(TAG,"found command %s = %s", autoexec_name, autoexec_value);
|
||||||
|
strreplace(autoexec_value, s, r);
|
||||||
snprintf(buff, buflen-1, template, autoexec_name, autoexec_value);
|
snprintf(buff, buflen-1, template, autoexec_name, autoexec_value);
|
||||||
netconn_write(conn, buff, strlen(buff), NETCONN_NOCOPY);
|
netconn_write(conn, buff, strlen(buff), NETCONN_NOCOPY);
|
||||||
ESP_LOGD(TAG,"%s", buff);
|
ESP_LOGD(TAG,"%s", buff);
|
||||||
@@ -289,13 +292,23 @@ void http_server_netconn_serve(struct netconn *conn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
snprintf(autoexec_name,sizeof(autoexec_name)-1,"X-Custom-autoexec%u: ",i);
|
if(snprintf(autoexec_name,sizeof(autoexec_name)-1,"X-Custom-autoexec%u: ",i)<0)
|
||||||
snprintf(autoexec_key,sizeof(autoexec_key)-1,"autoexec%u",i++);
|
{
|
||||||
|
ESP_LOGE(TAG,"Unable to process autoexec%u. Name length overflow.",i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(snprintf(autoexec_key,sizeof(autoexec_key)-1,"autoexec%u",i++)<0)
|
||||||
|
{
|
||||||
|
ESP_LOGE(TAG,"Unable to process autoexec%u. Name length overflow.",i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
ESP_LOGD(TAG,"Looking for command name %s.", autoexec_name);
|
ESP_LOGD(TAG,"Looking for command name %s.", autoexec_name);
|
||||||
autoexec_value = http_server_get_header(save_ptr, autoexec_name, &lenS);
|
autoexec_value = http_server_get_header(save_ptr, autoexec_name, &lenS);
|
||||||
snprintf(autoexec_value, lenS+1, autoexec_value);
|
|
||||||
|
|
||||||
if(autoexec_value ){
|
if(autoexec_value ){
|
||||||
|
// todo: replace line below, as it causes an error during compile.
|
||||||
|
// snprintf(autoexec_value, lenS+1, autoexec_value);
|
||||||
if(lenS < MAX_COMMAND_LINE_SIZE ){
|
if(lenS < MAX_COMMAND_LINE_SIZE ){
|
||||||
ESP_LOGD(TAG, "http_server_netconn_serve: config.json/ call, with %s: %s, length %i", autoexec_key, autoexec_value, lenS);
|
ESP_LOGD(TAG, "http_server_netconn_serve: config.json/ call, with %s: %s, length %i", autoexec_key, autoexec_value, lenS);
|
||||||
wifi_manager_save_autoexec_config(autoexec_value,autoexec_key,lenS);
|
wifi_manager_save_autoexec_config(autoexec_value,autoexec_key,lenS);
|
||||||
@@ -367,3 +380,23 @@ void http_server_netconn_serve(struct netconn *conn) {
|
|||||||
/* free the buffer */
|
/* free the buffer */
|
||||||
netbuf_delete(inbuf);
|
netbuf_delete(inbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void strreplace(char *src, char *str, char *rep)
|
||||||
|
{
|
||||||
|
char *p = strstr(src, str);
|
||||||
|
if (p)
|
||||||
|
{
|
||||||
|
int len = strlen(src)+strlen(rep)-strlen(str);
|
||||||
|
char r[len];
|
||||||
|
memset(r, 0, len);
|
||||||
|
if ( p >= src ){
|
||||||
|
strncpy(r, src, p-src);
|
||||||
|
r[p-src]='\0';
|
||||||
|
strncat(r, rep, strlen(rep));
|
||||||
|
strncat(r, p+strlen(str), p+strlen(str)-src+strlen(src));
|
||||||
|
strcpy(src, r);
|
||||||
|
strreplace(p+strlen(rep), str, rep);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,6 +88,9 @@ void http_server_start();
|
|||||||
*/
|
*/
|
||||||
char* http_server_get_header(char *request, char *header_name, int *len);
|
char* http_server_get_header(char *request, char *header_name, int *len);
|
||||||
|
|
||||||
|
void strreplace(char *src, char *str, char *rep);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
set(COMPONENT_ADD_INCLUDEDIRS . )
|
set(COMPONENT_ADD_INCLUDEDIRS . )
|
||||||
|
|
||||||
set(COMPONENT_SRCS "esp_app_main.c" "platform_esp32.c" "cmd_wifi.c" "console.c" "nvs_utilities.c" "cmd_squeezelite.c" )
|
set(COMPONENT_SRCS "esp_app_main.c" "cmd_wifi.c" "console.c" "nvs_utilities.c" "cmd_squeezelite.c" )
|
||||||
set(REQUIRES esp_common )
|
set(REQUIRES esp_common )
|
||||||
set(REQUIRES_COMPONENTS freertos nvs_flash esp32 spi_flash newlib log console wifi-manager )
|
set(REQUIRES_COMPONENTS freertos nvs_flash esp32 spi_flash newlib log console wifi-manager )
|
||||||
|
|
||||||
|
|||||||
@@ -21,72 +21,6 @@ menu "Squeezelite-ESP32"
|
|||||||
help
|
help
|
||||||
Set logging level info|debug|sdebug
|
Set logging level info|debug|sdebug
|
||||||
endmenu
|
endmenu
|
||||||
menu "Wifi Configuration"
|
|
||||||
config WIFI_SSID
|
|
||||||
string "WiFi SSID"
|
|
||||||
default "myssid"
|
|
||||||
help
|
|
||||||
SSID (network name) for the example to connect to.
|
|
||||||
|
|
||||||
config WIFI_PASSWORD
|
|
||||||
string "WiFi Password"
|
|
||||||
default "mypassword"
|
|
||||||
help
|
|
||||||
WiFi password (WPA or WPA2) for the example to use.
|
|
||||||
|
|
||||||
choice SCAN_METHOD
|
|
||||||
prompt "scan method"
|
|
||||||
default WIFI_FAST_SCAN
|
|
||||||
help
|
|
||||||
scan method for the esp32 to use
|
|
||||||
|
|
||||||
config WIFI_FAST_SCAN
|
|
||||||
bool "fast"
|
|
||||||
config WIFI_ALL_CHANNEL_SCAN
|
|
||||||
bool "all"
|
|
||||||
endchoice
|
|
||||||
|
|
||||||
choice SORT_METHOD
|
|
||||||
prompt "sort method"
|
|
||||||
default WIFI_CONNECT_AP_BY_SIGNAL
|
|
||||||
help
|
|
||||||
sort method for the esp32 to use
|
|
||||||
|
|
||||||
config WIFI_CONNECT_AP_BY_SIGNAL
|
|
||||||
bool "rssi"
|
|
||||||
config WIFI_CONNECT_AP_BY_SECURITY
|
|
||||||
bool "authmode"
|
|
||||||
endchoice
|
|
||||||
|
|
||||||
config FAST_SCAN_THRESHOLD
|
|
||||||
bool "fast scan threshold"
|
|
||||||
default y
|
|
||||||
help
|
|
||||||
wifi fast scan threshold
|
|
||||||
|
|
||||||
config FAST_SCAN_MINIMUM_SIGNAL
|
|
||||||
int "fast scan minimum rssi"
|
|
||||||
depends on FAST_SCAN_THRESHOLD
|
|
||||||
range -127 0
|
|
||||||
default -127
|
|
||||||
help
|
|
||||||
rssi is use to measure the signal
|
|
||||||
|
|
||||||
choice FAST_SCAN_WEAKEST_AUTHMODE
|
|
||||||
prompt "fast scan weakest authmode"
|
|
||||||
depends on FAST_SCAN_THRESHOLD
|
|
||||||
default EXAMPLE_OPEN
|
|
||||||
|
|
||||||
config EXAMPLE_OPEN
|
|
||||||
bool "open"
|
|
||||||
config EXAMPLE_WEP
|
|
||||||
bool "wep"
|
|
||||||
config EXAMPLE_WPA
|
|
||||||
bool "wpa"
|
|
||||||
config EXAMPLE_WPA2
|
|
||||||
bool "wpa2"
|
|
||||||
endchoice
|
|
||||||
endmenu
|
|
||||||
menu "Audio CODEC libraries"
|
menu "Audio CODEC libraries"
|
||||||
config INCLUDE_FLAC
|
config INCLUDE_FLAC
|
||||||
bool "FLAC"
|
bool "FLAC"
|
||||||
|
|||||||
@@ -131,3 +131,10 @@ CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT="pthread"
|
|||||||
CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=y
|
CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=y
|
||||||
CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS=y
|
CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS=y
|
||||||
|
|
||||||
|
# wifi-manager
|
||||||
|
CONFIG_DEFAULT_AP_SSID="squeezelite"
|
||||||
|
CONFIG_DEFAULT_AP_PASSWORD="squeezelite"
|
||||||
|
CONFIG_DEFAULT_AP_IP="192.168.4.1"
|
||||||
|
CONFIG_DEFAULT_AP_GATEWAY="192.168.4.1"
|
||||||
|
CONFIG_DEFAULT_AP_NETMASK="255.255.255.0"
|
||||||
|
CONFIG_DEFAULT_COMMAND_LINE="squeezelite -o I2S -b 500:2000 -d all=info"
|
||||||
|
|||||||
Reference in New Issue
Block a user