mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-06 19:47:02 +03:00
add a GPIO to drive external amplifier
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include "buttons.h"
|
||||
#include "led.h"
|
||||
#include "globdefs.h"
|
||||
#include "config.h"
|
||||
|
||||
#define MONITOR_TIMER (10*1000)
|
||||
|
||||
@@ -83,13 +84,12 @@ bool spkfault_svc (void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
#include "driver/rtc_io.h"
|
||||
/****************************************************************************************
|
||||
*
|
||||
*/
|
||||
void monitor_svc_init(void) {
|
||||
ESP_LOGI(TAG, "Initializing monitoring");
|
||||
|
||||
|
||||
#ifdef JACK_GPIO
|
||||
gpio_pad_select_gpio(JACK_GPIO);
|
||||
gpio_set_direction(JACK_GPIO, GPIO_MODE_INPUT);
|
||||
@@ -107,6 +107,12 @@ void monitor_svc_init(void) {
|
||||
button_create(NULL, SPKFAULT_GPIO, BUTTON_LOW, true, 0, spkfault_handler_default, 0, -1);
|
||||
#endif
|
||||
|
||||
monitor_timer = xTimerCreate("monitor", MONITOR_TIMER / portTICK_RATE_MS, pdTRUE, NULL, monitor_callback);
|
||||
xTimerStart(monitor_timer, portMAX_DELAY);
|
||||
// do we want stats
|
||||
char *p = config_alloc_get_default(NVS_TYPE_STR, "stats", "n", 0);
|
||||
if (p && (*p == '1' || *p == 'Y' || *p == 'y')) {
|
||||
monitor_timer = xTimerCreate("monitor", MONITOR_TIMER / portTICK_RATE_MS, pdTRUE, NULL, monitor_callback);
|
||||
xTimerStart(monitor_timer, portMAX_DELAY);
|
||||
}
|
||||
free(p);
|
||||
|
||||
}
|
||||
|
||||
@@ -296,7 +296,7 @@ static void show_display_buffer(char *ddram) {
|
||||
makeprintable((unsigned char *)line1);
|
||||
makeprintable((unsigned char *)line2);
|
||||
|
||||
LOG_INFO("\n\t%.40s\n\t%.40s", line1, line2);
|
||||
LOG_DEBUG("\n\t%.40s\n\t%.40s", line1, line2);
|
||||
|
||||
display->line(1, DISPLAY_LEFT, DISPLAY_CLEAR, line1);
|
||||
display->line(2, DISPLAY_LEFT, DISPLAY_CLEAR | DISPLAY_UPDATE, line2);
|
||||
@@ -388,7 +388,7 @@ static void grfs_handler(u8_t *data, int len) {
|
||||
int size = len - sizeof(struct grfs_packet);
|
||||
int offset = htons(pkt->offset);
|
||||
|
||||
LOG_INFO("gfrs s:%u d:%u p:%u sp:%u by:%hu m:%hu w:%hu o:%hu",
|
||||
LOG_DEBUG("gfrs s:%u d:%u p:%u sp:%u by:%hu m:%hu w:%hu o:%hu",
|
||||
(int) pkt->screen,
|
||||
(int) pkt->direction, // 1=left, 2=right
|
||||
htonl(pkt->pause), // in ms
|
||||
@@ -433,7 +433,7 @@ static void grfs_handler(u8_t *data, int len) {
|
||||
static void grfg_handler(u8_t *data, int len) {
|
||||
struct grfg_packet *pkt = (struct grfg_packet*) data;
|
||||
|
||||
LOG_INFO("gfrg s:%hu w:%hu (len:%u)", htons(pkt->screen), htons(pkt->width), len);
|
||||
LOG_DEBUG("gfrg s:%hu w:%hu (len:%u)", htons(pkt->screen), htons(pkt->width), len);
|
||||
|
||||
memcpy(scroller.back_frame, data + sizeof(struct grfg_packet), len - sizeof(struct grfg_packet));
|
||||
scroller.window_width = htons(pkt->width);
|
||||
@@ -465,7 +465,7 @@ static void grfg_handler(u8_t *data, int len) {
|
||||
}
|
||||
else {
|
||||
// if we just got a content update, let the scroller manage the screen
|
||||
LOG_INFO("resuming scrolling task");
|
||||
LOG_DEBUG("resuming scrolling task");
|
||||
vTaskResume(scroller.task);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,8 +52,10 @@ static void usage(const char *argv0) {
|
||||
printf(TITLE " See -t for license terms\n"
|
||||
"Usage: %s [options]\n"
|
||||
" -s <server>[:<port>]\tConnect to specified server, otherwise uses autodiscovery to find server\n"
|
||||
#if !EMBEDDED
|
||||
" -o <output device>\tSpecify output device, default \"default\", - = output to stdout\n"
|
||||
" -l \t\t\tList output devices\n"
|
||||
#endif
|
||||
#if ALSA
|
||||
" -a <b>:<p>:<f>:<m>\tSpecify ALSA params to open output device, b = buffer time in ms or size in bytes, p = period count or size in bytes, f sample format (16|24|24_3|32), m = use mmap (0|1)\n"
|
||||
#endif
|
||||
@@ -535,7 +537,7 @@ int main(int argc, char **argv) {
|
||||
pidfile = optarg;
|
||||
break;
|
||||
#endif
|
||||
#ifndef EMBEDDED
|
||||
#if !EMBEDDED
|
||||
case 'l':
|
||||
list_devices();
|
||||
exit(0);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "driver/gpio.h"
|
||||
#include "squeezelite.h"
|
||||
#include "perf_trace.h"
|
||||
#include "config.h"
|
||||
|
||||
extern struct outputstate output;
|
||||
extern struct buffer *outputbuf;
|
||||
@@ -45,6 +46,7 @@ static log_level loglevel;
|
||||
static bool running = false;
|
||||
static uint8_t *btout;
|
||||
static frames_t oframes;
|
||||
static bool stats;
|
||||
|
||||
static int _write_frames(frames_t out_frames, bool silence, s32_t gainL, s32_t gainR,
|
||||
s32_t cross_gain_in, s32_t cross_gain_out, ISAMPLE_T **cross_ptr);
|
||||
@@ -72,6 +74,9 @@ void output_init_bt(log_level level, char *device, unsigned output_buf_size, cha
|
||||
running = true;
|
||||
output.write_cb = &_write_frames;
|
||||
hal_bluetooth_init(device);
|
||||
char *p = config_alloc_get_default(NVS_TYPE_STR, "stats", "n", 0);
|
||||
stats = p && (*p == '1' || *p == 'Y' || *p == 'y');
|
||||
free(p);
|
||||
}
|
||||
|
||||
void output_close_bt(void) {
|
||||
@@ -161,12 +166,12 @@ void output_bt_tick(void) {
|
||||
static time_t lastTime=0;
|
||||
|
||||
if (!running) return;
|
||||
|
||||
|
||||
LOCK_S;
|
||||
SET_MIN_MAX_SIZED(_buf_used(streambuf), stream_buf, streambuf->size);
|
||||
UNLOCK_S;
|
||||
|
||||
if (lastTime <= gettime_ms() )
|
||||
if (stats && lastTime <= gettime_ms() )
|
||||
{
|
||||
lastTime = gettime_ms() + STATS_REPORT_DELAY_MS;
|
||||
LOG_INFO("Statistics over %u secs. " , STATS_REPORT_DELAY_MS/1000);
|
||||
|
||||
@@ -83,7 +83,6 @@ void start_telnet(void * pvParameter){
|
||||
StackType_t *xStack = malloc(TELNET_STACK_SIZE);
|
||||
|
||||
if(!isStarted && bIsEnabled) {
|
||||
// xTaskCreatePinnedToCore(&telnetTask, "telnet", 8048, NULL, 5, NULL, 0);
|
||||
xTaskCreateStatic( (TaskFunction_t) &telnetTask, "telnet", TELNET_STACK_SIZE, NULL, ESP_TASK_PRIO_MIN + 1, xStack, xTaskBuffer);
|
||||
isStarted=true;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ config DEFAULT_AP_BEACON_INTERVAL
|
||||
100ms is the recommended default.
|
||||
config DEFAULT_COMMAND_LINE
|
||||
string "Default command line to execute"
|
||||
default "squeezelite -o I2S -b 500:2000 -d all=info"
|
||||
default "squeezelite -o I2S -b 500:2000 -d all=info -C 30"
|
||||
help
|
||||
This is the command to run when starting the device
|
||||
endmenu
|
||||
|
||||
Reference in New Issue
Block a user