mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-07 03:57:07 +03:00
BT source improvment, GPIO expander intr fix, SPI display improvments
This commit is contained in:
@@ -408,35 +408,27 @@ static bool cspot_cmd_handler(cspot_event_t cmd, va_list args)
|
||||
/****************************************************************************************
|
||||
* We provide the generic codec register option
|
||||
*/
|
||||
|
||||
#if defined(ESP_PLATFORM) && defined(CONFIG_BT_SINK)
|
||||
void bt_delay_start(TimerHandle_t xTimer) {
|
||||
xTimerDelete(xTimer, portMAX_DELAY);
|
||||
bt_sink_init(bt_sink_cmd_handler, sink_data_handler);
|
||||
LOG_INFO("Initializing BT sink");
|
||||
}
|
||||
|
||||
void bt_delay_stop(TimerHandle_t xTimer) {
|
||||
xTimerDelete(xTimer, portMAX_DELAY);
|
||||
bt_sink_deinit();
|
||||
LOG_INFO("Stopping BT sink");
|
||||
}
|
||||
#endif
|
||||
|
||||
void register_external(void) {
|
||||
char *p;
|
||||
|
||||
#if CONFIG_BT_SINK
|
||||
if ((p = config_alloc_get(NVS_TYPE_STR, "enable_bt_sink")) != NULL) {
|
||||
enable_bt_sink = strcmp(p,"1") == 0 || strcasecmp(p,"y") == 0;
|
||||
enable_bt_sink = !strcmp(p,"1") || !strcasecmp(p,"y");
|
||||
free(p);
|
||||
if (!strcasestr(output.device, "BT") && enable_bt_sink) {
|
||||
bt_sink_init(bt_sink_cmd_handler, sink_data_handler);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_AIRPLAY_SINK
|
||||
if ((p = config_alloc_get(NVS_TYPE_STR, "enable_airplay")) != NULL) {
|
||||
enable_airplay = strcmp(p,"1") == 0 || strcasecmp(p,"y") == 0;
|
||||
enable_airplay = !strcmp(p,"1") || !strcasecmp(p,"y");
|
||||
free(p);
|
||||
if (enable_airplay){
|
||||
raop_sink_init(raop_sink_cmd_handler, raop_sink_data_handler);
|
||||
LOG_INFO("Initializing AirPlay sink");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -447,29 +439,6 @@ void register_external(void) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_BT_SINK
|
||||
if (!strcasestr(output.device, "BT ") ) {
|
||||
if(enable_bt_sink){
|
||||
#ifdef ESP_PLATFORM
|
||||
// we need to delay the start because current task is in spiram
|
||||
TimerHandle_t timer = xTimerCreate("delay", 1, pdFALSE, NULL, bt_delay_start);
|
||||
xTimerStart(timer, portMAX_DELAY);
|
||||
#else
|
||||
bt_sink_init(bt_sink_cmd_handler, sink_data_handler);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
LOG_WARN("Cannot be a BT sink and source");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_AIRPLAY_SINK
|
||||
if (enable_airplay){
|
||||
raop_sink_init(raop_sink_cmd_handler, raop_sink_data_handler);
|
||||
LOG_INFO("Initializing AirPlay sink");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_CSPOT_SINK
|
||||
if (enable_cspot){
|
||||
cspot_sink_init(cspot_cmd_handler, sink_data_handler);
|
||||
@@ -480,14 +449,8 @@ void register_external(void) {
|
||||
|
||||
void deregister_external(void) {
|
||||
#if CONFIG_BT_SINK
|
||||
if (!strcasestr(output.device, "BT ") && enable_bt_sink) {
|
||||
#ifdef ESP_PLATFORM
|
||||
// we need to delay the stop because current task is in spiram
|
||||
TimerHandle_t timer = xTimerCreate("delay", 1, pdFALSE, NULL, bt_delay_stop);
|
||||
xTimerStart(timer, portMAX_DELAY);
|
||||
#else
|
||||
if (!strcasestr(output.device, "BT") && enable_bt_sink) {
|
||||
bt_sink_deinit();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -503,7 +466,7 @@ void deregister_external(void) {
|
||||
LOG_INFO("Stopping CSpot sink");
|
||||
cspot_sink_deinit();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void decode_restore(int external) {
|
||||
|
||||
Reference in New Issue
Block a user