mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-08 04:27:12 +03:00
add a GPIO to drive external amplifier
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user