mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-11 05:57:05 +03:00
refactor services, increase max sockets - release
This commit is contained in:
@@ -15,7 +15,7 @@ CFLAGS += -O3 -DLINKALL -DLOOPBACK -DNO_FAAD -DRESAMPLE16 -DEMBEDDED -DTREMOR_ON
|
||||
-I$(COMPONENT_PATH)/../codecs/inc/opusfile \
|
||||
-I$(COMPONENT_PATH)/../driver_bt \
|
||||
-I$(COMPONENT_PATH)/../raop \
|
||||
-I$(COMPONENT_PATH)/../audio_controls
|
||||
-I$(COMPONENT_PATH)/../services
|
||||
|
||||
# -I$(COMPONENT_PATH)/../codecs/inc/faad2
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ static void lms_next(void) {
|
||||
cli_send_cmd("button fwd");
|
||||
}
|
||||
|
||||
const static actrls_t controls = {
|
||||
const actrls_t LMS_controls = {
|
||||
lms_volume_up, lms_volume_down, // volume up, volume down
|
||||
lms_toggle, lms_play, // toggle, play
|
||||
lms_pause, lms_stop, // pause, stop
|
||||
@@ -121,7 +121,7 @@ static void notify(in_addr_t ip, u16_t hport, u16_t cport) {
|
||||
*/
|
||||
void cli_controls_init(void) {
|
||||
get_mac(mac);
|
||||
actrls_set_default(controls);
|
||||
actrls_set_default(LMS_controls);
|
||||
chained_notify = server_notify;
|
||||
server_notify = notify;
|
||||
}
|
||||
8
components/squeezelite/controls.h
Normal file
8
components/squeezelite/controls.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef CONTROLS_H
|
||||
#define CONTROLS_H
|
||||
|
||||
#include "audio_controls.h"
|
||||
|
||||
const extern actrls_t LMS_controls[];
|
||||
|
||||
#endif // CONTROLS_H
|
||||
@@ -162,11 +162,6 @@ static void spdif_convert(ISAMPLE_T *src, size_t frames, u32_t *dst, size_t *cou
|
||||
#define TAS575x 0x98
|
||||
#define TAS578x 0x90
|
||||
|
||||
static struct {
|
||||
float sum, avg;
|
||||
u16_t count;
|
||||
} battery;
|
||||
|
||||
struct tas57xx_cmd_s {
|
||||
u8_t reg;
|
||||
u8_t value;
|
||||
@@ -583,18 +578,7 @@ static void *output_thread_i2s() {
|
||||
* Stats output thread
|
||||
*/
|
||||
static void *output_thread_i2s_stats() {
|
||||
int memory_count = 0;
|
||||
|
||||
while (running) {
|
||||
#ifdef TAS57xx
|
||||
battery.sum += adc1_get_raw(ADC1_CHANNEL_7) / 4095. * (10+174)/10. * 1.1;
|
||||
if (++battery.count == (300 * 1000) / STATS_PERIOD_MS) {
|
||||
battery.avg = battery.sum / battery.count;
|
||||
battery.sum = battery.count = 0;
|
||||
LOG_INFO("Voltage %.2fV", battery.avg);
|
||||
}
|
||||
#endif
|
||||
|
||||
LOCK;
|
||||
output_state state = output.state;
|
||||
UNLOCK;
|
||||
@@ -618,14 +602,6 @@ static void *output_thread_i2s_stats() {
|
||||
LOG_INFO(" ----------+----------+-----------+-----------+");
|
||||
RESET_ALL_MIN_MAX;
|
||||
}
|
||||
if (loglevel == lDEBUG || !memory_count--) {
|
||||
LOG_INFO("Heap internal:%zu (min:%zu) external:%zu (min:%zu)",
|
||||
heap_caps_get_free_size(MALLOC_CAP_INTERNAL),
|
||||
heap_caps_get_minimum_free_size(MALLOC_CAP_INTERNAL),
|
||||
heap_caps_get_free_size(MALLOC_CAP_SPIRAM),
|
||||
heap_caps_get_minimum_free_size(MALLOC_CAP_SPIRAM));
|
||||
memory_count = (60*1000) / STATS_PERIOD_MS;
|
||||
}
|
||||
usleep(STATS_PERIOD_MS *1000);
|
||||
}
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user