mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-12 22:47:15 +03:00
idf.py app now builds both squeezelite and recovery in a single pass
This commit is contained in:
@@ -3,7 +3,5 @@ idf_component_register( SRC_DIRS .
|
||||
REQUIRES squeezelite-ota json mdns
|
||||
PRIV_REQUIRES tools services platform_config esp_common json newlib freertos spi_flash nvs_flash mdns pthread wpa_supplicant platform_console
|
||||
EMBED_FILES style.css code.js index.html bootstrap.min.css.gz jquery.min.js.gz popper.min.js.gz bootstrap.min.js.gz
|
||||
|
||||
|
||||
)
|
||||
|
||||
|
||||
@@ -59,11 +59,11 @@ static const char TAG[] = "dns_server";
|
||||
static TaskHandle_t task_dns_server = NULL;
|
||||
int socket_fd;
|
||||
|
||||
void CODE_RAM_LOCATION dns_server_start() {
|
||||
void dns_server_start() {
|
||||
xTaskCreate(&dns_server, "dns_server", 3072, NULL, WIFI_MANAGER_TASK_PRIORITY-1, &task_dns_server);
|
||||
}
|
||||
|
||||
void CODE_RAM_LOCATION dns_server_stop(){
|
||||
void dns_server_stop(){
|
||||
if(task_dns_server){
|
||||
vTaskDelete(task_dns_server);
|
||||
close(socket_fd);
|
||||
@@ -74,7 +74,7 @@ void CODE_RAM_LOCATION dns_server_stop(){
|
||||
|
||||
|
||||
|
||||
void CODE_RAM_LOCATION dns_server(void *pvParameters) {
|
||||
void dns_server(void *pvParameters) {
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -127,9 +127,9 @@ typedef struct __attribute__((__packed__)) dns_answer_t{
|
||||
uint32_t RDATA; /* For the sake of simplicity only ipv4 is supported, and as such it's a unsigned 32 bit */
|
||||
}dns_answer_t;
|
||||
|
||||
void CODE_RAM_LOCATION dns_server(void *pvParameters);
|
||||
void CODE_RAM_LOCATION dns_server_start();
|
||||
void CODE_RAM_LOCATION dns_server_stop();
|
||||
void dns_server(void *pvParameters);
|
||||
void dns_server_start();
|
||||
void dns_server_stop();
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ function to process requests, decode URLs, serve files, etc. etc.
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "platform_config.h"
|
||||
#include "platform_esp32.h"
|
||||
|
||||
#define HTTP_STACK_SIZE (5*1024)
|
||||
|
||||
@@ -51,11 +52,7 @@ static const char TAG[] = "http_server";
|
||||
/* @brief task handle for the http server */
|
||||
static TaskHandle_t task_http_server = NULL;
|
||||
static StaticTask_t task_http_buffer;
|
||||
#if RECOVERY_APPLICATION
|
||||
static StackType_t task_http_stack[HTTP_STACK_SIZE];
|
||||
#else
|
||||
static StackType_t EXT_RAM_ATTR task_http_stack[HTTP_STACK_SIZE];
|
||||
#endif
|
||||
SemaphoreHandle_t http_server_config_mutex = NULL;
|
||||
|
||||
/**
|
||||
@@ -490,11 +487,12 @@ void http_server_netconn_serve(struct netconn *conn) {
|
||||
netconn_write(conn, http_ok_json_no_cache_hdr, sizeof(http_ok_json_no_cache_hdr) - 1, NETCONN_NOCOPY); //200ok
|
||||
if(bOTA) {
|
||||
|
||||
#if RECOVERY_APPLICATION
|
||||
ESP_LOGW(TAG, "Starting process OTA for url %s",otaURL);
|
||||
#else
|
||||
ESP_LOGW(TAG, "Restarting system to process OTA for url %s",otaURL);
|
||||
#endif
|
||||
if(is_recovery_running){
|
||||
ESP_LOGW(TAG, "Starting process OTA for url %s",otaURL);
|
||||
}
|
||||
else{
|
||||
ESP_LOGW(TAG, "Restarting system to process OTA for url %s",otaURL);
|
||||
}
|
||||
wifi_manager_reboot_ota(otaURL);
|
||||
free(otaURL);
|
||||
}
|
||||
|
||||
@@ -67,13 +67,13 @@ extern "C" {
|
||||
* @brief RTOS task for the HTTP server. Do not start manually.
|
||||
* @see void http_server_start()
|
||||
*/
|
||||
void CODE_RAM_LOCATION http_server(void *pvParameters);
|
||||
void http_server(void *pvParameters);
|
||||
|
||||
/* @brief helper function that processes one HTTP request at a time */
|
||||
void CODE_RAM_LOCATION http_server_netconn_serve(struct netconn *conn);
|
||||
void http_server_netconn_serve(struct netconn *conn);
|
||||
|
||||
/* @brief create the task for the http server */
|
||||
void CODE_RAM_LOCATION http_server_start();
|
||||
void http_server_start();
|
||||
|
||||
/**
|
||||
* @brief gets a char* pointer to the first occurence of header_name withing the complete http request request.
|
||||
@@ -86,9 +86,9 @@ void CODE_RAM_LOCATION http_server_start();
|
||||
* @param len the size of the header value if found.
|
||||
* @return pointer to the beginning of the header value.
|
||||
*/
|
||||
char* CODE_RAM_LOCATION http_server_get_header(char *request, char *header_name, int *len);
|
||||
char* http_server_get_header(char *request, char *header_name, int *len);
|
||||
|
||||
void CODE_RAM_LOCATION strreplace(char *src, char *str, char *rep);
|
||||
void strreplace(char *src, char *str, char *rep);
|
||||
/* @brief lock the json config object */
|
||||
bool http_server_lock_json_object(TickType_t xTicksToWait);
|
||||
/* @brief unlock the json config object */
|
||||
|
||||
@@ -64,10 +64,6 @@ Contains the freeRTOS task and all necessary support
|
||||
#include "monitor.h"
|
||||
#include "globdefs.h"
|
||||
|
||||
#ifndef RECOVERY_APPLICATION
|
||||
#define RECOVERY_APPLICATION 0
|
||||
#endif
|
||||
|
||||
#ifndef SQUEEZELITE_ESP32_RELEASE_URL
|
||||
#define SQUEEZELITE_ESP32_RELEASE_URL "https://github.com/sle118/squeezelite-esp32/releases"
|
||||
#endif
|
||||
@@ -452,7 +448,7 @@ cJSON * wifi_manager_get_basic_info(cJSON **old){
|
||||
cJSON_AddItemToObject(root, "project_name", cJSON_CreateString(desc->project_name));
|
||||
cJSON_AddItemToObject(root, "version", cJSON_CreateString(desc->version));
|
||||
if(release_url !=NULL) cJSON_AddItemToObject(root, "release_url", cJSON_CreateString(release_url));
|
||||
cJSON_AddNumberToObject(root,"recovery", RECOVERY_APPLICATION );
|
||||
cJSON_AddNumberToObject(root,"recovery", is_recovery_running?1:0);
|
||||
cJSON_AddItemToObject(root, "ota_dsc", cJSON_CreateString(ota_get_status()));
|
||||
cJSON_AddNumberToObject(root,"ota_pct", ota_get_pct_complete() );
|
||||
cJSON_AddItemToObject(root, "Jack", cJSON_CreateString(jack_inserted_svc() ? "1" : "0"));
|
||||
|
||||
@@ -42,18 +42,6 @@ extern "C" {
|
||||
#include "squeezelite-ota.h"
|
||||
#include "cJSON.h"
|
||||
|
||||
#ifndef RECOVERY_APPLICATION
|
||||
#error "RECOVERY_APPLICATION not defined. Defaulting to squeezelite"
|
||||
#endif
|
||||
|
||||
#if RECOVERY_APPLICATION==1
|
||||
#elif RECOVERY_APPLICATION==0
|
||||
#pragma message "compiling for squeezelite."
|
||||
#else
|
||||
#error "unknown configuration"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Defines the maximum size of a SSID name. 32 is IEEE standard.
|
||||
|
||||
Reference in New Issue
Block a user