Merge remote-tracking branch 'origin/master-cmake' into master-cmake

Conflicts:
	plugin/SqueezeESP32.zip
	plugin/SqueezeESP32/install.xml
	plugin/repo.xml

-- Fix Broken build on CMake-master
This commit is contained in:
Sebastien
2020-06-09 14:48:03 -04:00
14 changed files with 98 additions and 36 deletions

View File

@@ -49,6 +49,7 @@ struct IR_header {
static in_addr_t server_ip;
static u16_t server_hport;
static u16_t server_cport;
static int cli_sock = -1;
static u8_t mac[6];
static void (*chained_notify)(in_addr_t, u16_t, u16_t);
static bool raw_mode;
@@ -243,38 +244,44 @@ const actrls_t LMS_controls = {
*
*/
static void cli_send_cmd(char *cmd) {
char packet[64];
struct sockaddr_in addr;
socklen_t addrlen = sizeof(addr);
int len, sock = socket(AF_INET, SOCK_STREAM, 0);
char packet[96];
int len;
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = server_ip;
addr.sin_port = htons(server_cport);
if (connect(sock, (struct sockaddr *) &addr, addrlen) < 0) {
LOG_ERROR("unable to connect to server %s:%hu with cli", inet_ntoa(server_ip), server_cport);
return;
}
len = sprintf(packet, "%02x:%02x:%02x:%02x:%02x:%02x %s\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], cmd);
LOG_DEBUG("sending command %s at %s:%hu", packet, inet_ntoa(server_ip), server_cport);
if (send(sock, packet, len, 0) < 0) {
if (send(cli_sock, packet, len, MSG_DONTWAIT) < 0) {
LOG_WARN("cannot send CLI %s", packet);
}
closesocket(sock);
// need to empty the RX buffer otherwise we'll lock the TCP/IP stack
len = recv(cli_sock, packet, 96, MSG_DONTWAIT);
}
/****************************************************************************************
* Notification when server changes
*/
static void notify(in_addr_t ip, u16_t hport, u16_t cport) {
struct sockaddr_in addr;
socklen_t addrlen = sizeof(addr);
server_ip = ip;
server_hport = hport;
server_cport = cport;
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = server_ip;
addr.sin_port = htons(server_cport);
// close existing CLI connection and open new one
if (cli_sock >= 0) closesocket(cli_sock);
cli_sock = socket(AF_INET, SOCK_STREAM, 0);
if (connect(cli_sock, (struct sockaddr *) &addr, addrlen) < 0) {
LOG_ERROR("unable to connect to server %s:%hu with cli", inet_ntoa(server_ip), server_cport);
cli_sock = -1;
}
LOG_INFO("notified server %s hport %hu cport %hu", inet_ntoa(ip), hport, cport);
if (chained_notify) (*chained_notify)(ip, hport, cport);

View File

@@ -646,12 +646,13 @@ static void grfb_handler(u8_t *data, int len) {
pkt->brightness = htons(pkt->brightness);
xSemaphoreTake(displayer.mutex, portMAX_DELAY);
if (pkt->brightness < 0) {
// LMS driver sends 0..5 value, we assume driver is highly log
if (pkt->brightness <= 0) {
GDS_DisplayOff(display);
} else {
GDS_DisplayOn(display);
GDS_SetContrast(display, pkt->brightness);
GDS_SetContrast(display, 255 * powf(pkt->brightness / 5.0f, 3));
}
xSemaphoreGive(displayer.mutex);

View File

@@ -26,14 +26,16 @@ static struct {
* open equalizer
*/
void equalizer_open(u32_t sample_rate) {
// in any case, need to clear update flag
equalizer.update = false;
if (sample_rate != 11025 && sample_rate != 22050 && sample_rate != 44100 && sample_rate != 48000) {
LOG_WARN("equalizer only supports 11025, 22050, 44100 and 48000 sample rates, not %u", sample_rate);
return;
}
equalizer.handle = esp_equalizer_init(2, sample_rate, EQ_BANDS, 0);
equalizer.update = false;
if (equalizer.handle) {
bool active = false;