mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-09 21:17:18 +03:00
merge
This commit is contained in:
@@ -25,7 +25,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "esp_system.h"
|
#include "esp_system.h"
|
||||||
#include "ctype.h"
|
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "esp_console.h"
|
#include "esp_console.h"
|
||||||
#include "esp_vfs_dev.h"
|
#include "esp_vfs_dev.h"
|
||||||
@@ -90,10 +89,10 @@ static void * free_fn(void * ptr){
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
void init_cJSON(){
|
void init_cJSON(){
|
||||||
|
static cJSON_Hooks hooks;
|
||||||
// initialize cJSON hooks it uses SPIRAM memory
|
// initialize cJSON hooks it uses SPIRAM memory
|
||||||
// as opposed to IRAM
|
// as opposed to IRAM
|
||||||
#if RECOVERY_APPLICATION==0
|
#if RECOVERY_APPLICATION==0
|
||||||
static cJSON_Hooks hooks;
|
|
||||||
// In squeezelite mode, allocate memory from PSRAM. Otherwise allocate from internal RAM
|
// In squeezelite mode, allocate memory from PSRAM. Otherwise allocate from internal RAM
|
||||||
// as recovery will lock flash access when erasing FLASH or writing to OTA partition.
|
// as recovery will lock flash access when erasing FLASH or writing to OTA partition.
|
||||||
hooks.malloc_fn=&malloc_fn;
|
hooks.malloc_fn=&malloc_fn;
|
||||||
@@ -705,39 +704,6 @@ esp_err_t config_set_value(nvs_type_t nvs_type, const char *key, void * value){
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define IS_ALPHA(c) isalpha((int)c)
|
|
||||||
#define TO_UPPER(c) toupper((int)c)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char * strstri (const char * str1, const char * str2){
|
|
||||||
char *cp = (char *) str1;
|
|
||||||
char *s1, *s2;
|
|
||||||
|
|
||||||
if ( *str2=='\0' )
|
|
||||||
return((char *)str1);
|
|
||||||
|
|
||||||
while (*cp){
|
|
||||||
s1 = cp;
|
|
||||||
s2 = (char *) str2;
|
|
||||||
while ( *s1!='\0' && *s2!='\0' && (IS_ALPHA(*s1) && IS_ALPHA(*s2))?!(TO_UPPER(*s1) - TO_UPPER(*s2)):!(*s1-*s2)){
|
|
||||||
ESP_LOGW(TAG,"Matched [%c] = [%c] ", IS_ALPHA(*s1)?TO_UPPER(*s1):*s1,IS_ALPHA(*s2)?TO_UPPER(*s2):*s2);
|
|
||||||
++s1, ++s2;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (*s2=='\0'){
|
|
||||||
ESP_LOGW(TAG,"String %s found!", str2);
|
|
||||||
return(cp);
|
|
||||||
}
|
|
||||||
|
|
||||||
++cp;
|
|
||||||
ESP_LOGW(TAG,"%s not found. s2 is [%c]. Moving forward to %s", str2, *s2, cp);
|
|
||||||
}
|
|
||||||
ESP_LOGW(TAG,"String %s not found", str2);
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
IMPLEMENT_SET_DEFAULT(uint8_t,NVS_TYPE_U8);
|
IMPLEMENT_SET_DEFAULT(uint8_t,NVS_TYPE_U8);
|
||||||
IMPLEMENT_SET_DEFAULT(int8_t,NVS_TYPE_I8);
|
IMPLEMENT_SET_DEFAULT(int8_t,NVS_TYPE_I8);
|
||||||
IMPLEMENT_SET_DEFAULT(uint16_t,NVS_TYPE_U16);
|
IMPLEMENT_SET_DEFAULT(uint16_t,NVS_TYPE_U16);
|
||||||
@@ -751,4 +717,3 @@ IMPLEMENT_GET_NUM(uint16_t,NVS_TYPE_U16);
|
|||||||
IMPLEMENT_GET_NUM(int16_t,NVS_TYPE_I16);
|
IMPLEMENT_GET_NUM(int16_t,NVS_TYPE_I16);
|
||||||
IMPLEMENT_GET_NUM(uint32_t,NVS_TYPE_U32);
|
IMPLEMENT_GET_NUM(uint32_t,NVS_TYPE_U32);
|
||||||
IMPLEMENT_GET_NUM(int32_t,NVS_TYPE_I32);
|
IMPLEMENT_GET_NUM(int32_t,NVS_TYPE_I32);
|
||||||
|
|
||||||
|
|||||||
@@ -37,4 +37,4 @@ void * config_alloc_get(nvs_type_t nvs_type, const char *key) ;
|
|||||||
bool wait_for_commit();
|
bool wait_for_commit();
|
||||||
char * config_alloc_get_json(bool bFormatted);
|
char * config_alloc_get_json(bool bFormatted);
|
||||||
esp_err_t config_set_value(nvs_type_t nvs_type, const char *key, void * value);
|
esp_err_t config_set_value(nvs_type_t nvs_type, const char *key, void * value);
|
||||||
char * strstri (const char * str1, const char * str2);
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ void display_init(char *welcome) {
|
|||||||
|
|
||||||
if (item && *item) {
|
if (item && *item) {
|
||||||
char * drivername=strstr(item,"driver");
|
char * drivername=strstr(item,"driver");
|
||||||
if( !drivername || (drivername && (strstr(drivername,"SSD1306") || strstr(drivername,"ssd1306")))){
|
if (!drivername || (drivername && strcasestr(drivername,"SSD1306"))) {
|
||||||
handle = &SSD1306_handle;
|
handle = &SSD1306_handle;
|
||||||
if (handle->init(item, welcome)) {
|
if (handle->init(item, welcome)) {
|
||||||
slimp_handler_chain = slimp_handler;
|
slimp_handler_chain = slimp_handler;
|
||||||
@@ -73,7 +73,7 @@ void display_init(char *welcome) {
|
|||||||
} else {
|
} else {
|
||||||
ESP_LOGE(TAG, "Display initialization failed");
|
ESP_LOGE(TAG, "Display initialization failed");
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
ESP_LOGE(TAG,"Unknown display driver name in display config: %s",item);
|
ESP_LOGE(TAG,"Unknown display driver name in display config: %s",item);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -304,8 +304,6 @@ esp_err_t actrls_init_json(const char *config) {
|
|||||||
esp_err_t loc_err = actrls_process_button(button, cur_config);
|
esp_err_t loc_err = actrls_process_button(button, cur_config);
|
||||||
err = (err == ESP_OK) ? loc_err : err;
|
err = (err == ESP_OK) ? loc_err : err;
|
||||||
if (loc_err == ESP_OK) {
|
if (loc_err == ESP_OK) {
|
||||||
|
|
||||||
ESP_LOGI(TAG, "Calling button_create");
|
|
||||||
button_create((void*) cur_config, cur_config->gpio,cur_config->type, cur_config->pull,cur_config->debounce,
|
button_create((void*) cur_config, cur_config->gpio,cur_config->type, cur_config->pull,cur_config->debounce,
|
||||||
control_handler, cur_config->long_press, cur_config->shifter_gpio);
|
control_handler, cur_config->long_press, cur_config->shifter_gpio);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user