mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-09 13:07:03 +03:00
Merge remote-tracking branch 'origin/master' into master-cmake
Conflicts: components/raop/raop.c components/raop/rtp.c
This commit is contained in:
@@ -8,10 +8,4 @@ idf_component_register( SRCS
|
||||
INCLUDE_DIRS .
|
||||
REQUIRES nvs_flash
|
||||
PRIV_REQUIRES console tools services spi_flash app_update platform_config vfs pthread wifi-manager platform_config codecs newlib )
|
||||
|
||||
|
||||
#target_link_libraries(__idf_platform_console $<IF:${recovery_build}, ${build_dir}/esp-idf/app_recovery/libapp_recovery.a,${build_dir}/esp-idf/app_squeezelite/libapp_squeezelite.a > )
|
||||
message($<TARGET_PROPERTY:RECOVERY_PREFIX>)
|
||||
|
||||
target_link_libraries(__idf_platform_console ${build_dir}/esp-idf/$<TARGET_PROPERTY:RECOVERY_PREFIX>/lib$<TARGET_PROPERTY:RECOVERY_PREFIX>.a )
|
||||
#target_link_libraries(__idf_platform_console $<NOT ${recovery_build}:${build_dir}/esp-idf/app_squeezelite/libapp_squeezelite )
|
||||
|
||||
@@ -436,6 +436,12 @@ static bool handle_rtsp(raop_ctx_t *ctx, int sock)
|
||||
if (strcmp(method, "OPTIONS")) {
|
||||
LOG_INFO("[%p]: received %s", ctx, method);
|
||||
}
|
||||
|
||||
if ((buf = kd_lookup(headers, "Apple-Challenge")) != NULL) {
|
||||
int n;
|
||||
char *buf_pad, *p, *data_b64 = NULL, data[32];
|
||||
|
||||
LOG_INFO("[%p]: challenge %s", ctx, buf);
|
||||
|
||||
// try to re-acquire IP address if we were missing it
|
||||
if (S_ADDR(ctx->host) == INADDR_ANY) {
|
||||
|
||||
@@ -163,7 +163,7 @@ void raop_sink_init(raop_cmd_vcb_t cmd_cb, raop_data_cb_t data_cb) {
|
||||
free(sink_name_buffer);
|
||||
}
|
||||
|
||||
LOG_INFO( "mdns hostname set to: [%s] with servicename %s", hostname, sink_name);
|
||||
LOG_INFO( "mdns hostname for ip %s set to: [%s] with servicename %s", inet_ntoa(host), hostname, sink_name);
|
||||
|
||||
// create RAOP instance, latency is set by controller
|
||||
uint8_t mac[6];
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -23,12 +23,7 @@
|
||||
#ifdef WIN32
|
||||
#include <iphlpapi.h>
|
||||
#else
|
||||
/*
|
||||
#include <sys/ioctl.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_arp.h>
|
||||
#include <netdb.h>
|
||||
*/
|
||||
#include "tcpip_adapter.h"
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
|
||||
@@ -84,8 +79,26 @@ in_addr_t get_localhost(char **name)
|
||||
}
|
||||
else return INADDR_ANY;
|
||||
#else
|
||||
// missing platform here ...
|
||||
return INADDR_ANY;
|
||||
tcpip_adapter_ip_info_t ipInfo;
|
||||
tcpip_adapter_if_t if_type = TCPIP_ADAPTER_IF_STA;
|
||||
|
||||
// then get IP address
|
||||
tcpip_adapter_get_ip_info(if_type, &ipInfo);
|
||||
|
||||
// we might be in AP mode
|
||||
if (ipInfo.ip.addr == INADDR_ANY) {
|
||||
if_type = TCPIP_ADAPTER_IF_AP;
|
||||
tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_AP, &ipInfo);
|
||||
}
|
||||
|
||||
// get hostname if required
|
||||
if (name) {
|
||||
const char *hostname;
|
||||
tcpip_adapter_get_hostname(if_type, &hostname);
|
||||
*name = strdup(hostname);
|
||||
}
|
||||
|
||||
return ipInfo.ip.addr;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -401,7 +414,7 @@ bool http_parse(int sock, char *method, key_data_t *rkd, char **body, int *len)
|
||||
}
|
||||
|
||||
if (*len) {
|
||||
int size = 0;
|
||||
int size = 0;
|
||||
|
||||
*body = malloc(*len + 1);
|
||||
while (*body && size < *len) {
|
||||
|
||||
@@ -191,7 +191,7 @@ void button_create(void *client, int gpio, int type, bool pull, int debounce, bu
|
||||
|
||||
if (n_buttons >= MAX_BUTTONS) return;
|
||||
|
||||
ESP_LOGI(TAG, "Creating button using GPIO %u, type %u, pull-up/down %u, long press %u shifter %u", gpio, type, pull, long_press, shifter_gpio);
|
||||
ESP_LOGI(TAG, "Creating button using GPIO %u, type %u, pull-up/down %u, long press %u shifter %d", gpio, type, pull, long_press, shifter_gpio);
|
||||
|
||||
if (!n_buttons) {
|
||||
button_evt_queue = xQueueCreate(BUTTON_QUEUE_LEN, sizeof(struct button_s));
|
||||
@@ -209,7 +209,6 @@ void button_create(void *client, int gpio, int type, bool pull, int debounce, bu
|
||||
buttons[n_buttons].debounce = debounce ? debounce: DEBOUNCE;
|
||||
buttons[n_buttons].handler = handler;
|
||||
buttons[n_buttons].long_press = long_press;
|
||||
buttons[n_buttons].level = -1;
|
||||
buttons[n_buttons].shifter_gpio = shifter_gpio;
|
||||
buttons[n_buttons].type = type;
|
||||
buttons[n_buttons].timer = xTimerCreate("buttonTimer", buttons[n_buttons].debounce / portTICK_RATE_MS, pdFALSE, (void *) &buttons[n_buttons], buttons_timer);
|
||||
@@ -247,6 +246,9 @@ void button_create(void *client, int gpio, int type, bool pull, int debounce, bu
|
||||
|
||||
// nasty ESP32 bug: fire-up constantly INT on GPIO 36/39 if ADC1, AMP, Hall used which WiFi does when PS is activated
|
||||
if (gpio == 36 || gpio == 39) gpio36_39_used = true;
|
||||
|
||||
// and initialize level ...
|
||||
buttons[n_buttons].level = gpio_get_level(gpio);
|
||||
|
||||
gpio_isr_handler_add(gpio, gpio_isr_handler, (void*) &buttons[n_buttons]);
|
||||
gpio_intr_enable(gpio);
|
||||
|
||||
@@ -116,7 +116,8 @@ static void jack_handler_default(void *id, button_event_e event, button_press_e
|
||||
*
|
||||
*/
|
||||
bool jack_inserted_svc (void) {
|
||||
return button_is_pressed(jack.gpio, NULL);
|
||||
if (jack.gpio != -1) return button_is_pressed(jack.gpio, NULL);
|
||||
else return true;
|
||||
}
|
||||
|
||||
/****************************************************************************************
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
const static char TAG[] = "AC101";
|
||||
|
||||
#define SPKOUT_EN ((1 << 11) | (1 << 7))
|
||||
#define SPKOUT_EN ((1 << 9) | (1 << 11) | (1 << 7) | (1 << 5))
|
||||
#define EAROUT_EN ((1 << 11) | (1 << 12) | (1 << 13))
|
||||
#define BIN(a,b,c,d) 0b##a##b##c##d
|
||||
|
||||
@@ -132,8 +132,8 @@ static bool init(int i2c_port_num, int i2s_num, i2s_config_t *i2s_config) {
|
||||
//Path Configuration
|
||||
i2c_write_reg(DAC_MXR_SRC, BIN(1000,1000,0000,0000)); // DAC from I2S
|
||||
i2c_write_reg(DAC_DIG_CTRL, BIN(1000,0000,0000,0000)); // enable DAC
|
||||
i2c_write_reg(OMIXER_DACA_CTRL, BIN(1111,0000,0000,000)); // enable DAC/Analogue (see note on offset removal and PA)
|
||||
i2c_write_reg(OMIXER_DACA_CTRL, BIN(1100,0000,0000,000)); // enable DAC/Analogue (see note on offset removal and PA)
|
||||
i2c_write_reg(OMIXER_DACA_CTRL, BIN(1111,0000,0000,0000)); // enable DAC/Analogue (see note on offset removal and PA)
|
||||
i2c_write_reg(OMIXER_DACA_CTRL, BIN(1111,1111,0000,0000)); // this toggle is needed for headphone PA offset
|
||||
#if ENABLE_ADC
|
||||
i2c_write_reg(OMIXER_SR, BIN(0000,0001,0000,0010)); // source=DAC(R/L) (are DACR and DACL really inverted in bitmap?)
|
||||
#else
|
||||
@@ -149,8 +149,7 @@ static bool init(int i2c_port_num, int i2s_num, i2s_config_t *i2s_config) {
|
||||
|
||||
// enable earphone & speaker
|
||||
i2c_write_reg(SPKOUT_CTRL, 0x0220);
|
||||
i2c_write_reg(OMIXER_DACA_CTRL, 0xff00);
|
||||
i2c_write_reg(HPOUT_CTRL, 0x3801);
|
||||
i2c_write_reg(HPOUT_CTRL, 0xf801);
|
||||
|
||||
// set gain for speaker and earphone
|
||||
ac101_set_spk_volume(100);
|
||||
@@ -206,9 +205,10 @@ static void speaker(bool active) {
|
||||
* headset
|
||||
*/
|
||||
static void headset(bool active) {
|
||||
// there might be aneed to toggle OMIXER_DACA_CTRL 11:8, not sure
|
||||
uint16_t value = i2c_read_reg(HPOUT_CTRL);
|
||||
if (active) i2c_write_reg(HPOUT_CTRL, value | EAROUT_EN);
|
||||
else i2c_write_reg(HPOUT_CTRL, value & ~EAROUT_EN);
|
||||
else i2c_write_reg(HPOUT_CTRL, value & ~EAROUT_EN);
|
||||
}
|
||||
|
||||
/****************************************************************************************
|
||||
@@ -284,14 +284,14 @@ static int ac101_get_spk_volume(void) {
|
||||
* Set normalized (0..100) volume
|
||||
*/
|
||||
static void ac101_set_spk_volume(uint8_t volume) {
|
||||
volume = max(volume, 0x1f);
|
||||
volume = ((int) volume * 0x1f) / 100;
|
||||
volume |= i2c_read_reg(SPKOUT_CTRL) & ~0x1f;
|
||||
i2c_write_reg(SPKOUT_CTRL, volume);
|
||||
uint16_t value = max(volume, 100);
|
||||
value = ((int) value * 0x1f) / 100;
|
||||
value |= i2c_read_reg(SPKOUT_CTRL) & ~0x1f;
|
||||
i2c_write_reg(SPKOUT_CTRL, value);
|
||||
}
|
||||
|
||||
/****************************************************************************************
|
||||
* Get normalized (0..100) earphonz volume
|
||||
* Get normalized (0..100) earphone volume
|
||||
*/
|
||||
static int ac101_get_earph_volume(void) {
|
||||
return (((i2c_read_reg(HPOUT_CTRL) >> 4) & 0x3f) * 100) / 0x3f;
|
||||
@@ -301,10 +301,10 @@ static int ac101_get_earph_volume(void) {
|
||||
* Set normalized (0..100) earphone volume
|
||||
*/
|
||||
static void ac101_set_earph_volume(uint8_t volume) {
|
||||
volume = max(volume, 0x3f);
|
||||
volume = (((int) volume * 0x3f) / 100) << 4;
|
||||
volume |= i2c_read_reg(HPOUT_CTRL) & ~(0x3f << 4);
|
||||
i2c_write_reg(HPOUT_CTRL, volume);
|
||||
uint16_t value = max(volume, 100);
|
||||
value = (((int) value * 0x3f) / 100) << 4;
|
||||
value |= i2c_read_reg(HPOUT_CTRL) & ~(0x3f << 4);
|
||||
i2c_write_reg(HPOUT_CTRL, value);
|
||||
}
|
||||
|
||||
/****************************************************************************************
|
||||
@@ -345,17 +345,16 @@ static void ac101_start(ac_module_t mode) {
|
||||
i2c_write_reg(0x50, 0x3bc0);
|
||||
}
|
||||
if (mode == AC_MODULE_ADC || mode == AC_MODULE_ADC_DAC || mode == AC_MODULE_LINE) {
|
||||
//I2S1_SDOUT_CTRL
|
||||
//i2c_write_reg(PLL_CTRL2, 0x8120);
|
||||
// I2S1_SDOUT_CTRL
|
||||
// i2c_write_reg(PLL_CTRL2, 0x8120);
|
||||
i2c_write_reg(0x04, 0x800c);
|
||||
i2c_write_reg(0x05, 0x800c);
|
||||
//res |= i2c_write_reg(0x06, 0x3000);
|
||||
// res |= i2c_write_reg(0x06, 0x3000);
|
||||
}
|
||||
if (mode == AC_MODULE_DAC || mode == AC_MODULE_ADC_DAC || mode == AC_MODULE_LINE) {
|
||||
headset(true);
|
||||
speaker(true);
|
||||
ac101_set_earph_volume(100);
|
||||
ac101_set_spk_volume(100);
|
||||
uint16_t value = i2c_read_reg(PLL_CTRL2);
|
||||
value |= 0x8000;
|
||||
i2c_write_reg(PLL_CTRL2, value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,8 +362,9 @@ static void ac101_start(ac_module_t mode) {
|
||||
*
|
||||
*/
|
||||
static void ac101_stop(void) {
|
||||
speaker(false);
|
||||
headset(false);
|
||||
uint16_t value = i2c_read_reg(PLL_CTRL2);
|
||||
value &= ~0x8000;
|
||||
i2c_write_reg(PLL_CTRL2, value);
|
||||
}
|
||||
|
||||
/****************************************************************************************
|
||||
|
||||
@@ -274,6 +274,8 @@ void output_init_i2s(log_level level, char *device, unsigned output_buf_size, ch
|
||||
if (jack_mutes_amp && jack_inserted_svc()) adac->speaker(false);
|
||||
else adac->speaker(true);
|
||||
|
||||
adac->headset(jack_inserted_svc());
|
||||
|
||||
parse_set_GPIO(set_amp_gpio);
|
||||
|
||||
esp_pthread_cfg_t cfg = esp_pthread_get_default_config();
|
||||
|
||||
Reference in New Issue
Block a user