diff --git a/main/espd.c b/main/espd.c index 6d80ad4..692a43b 100644 --- a/main/espd.c +++ b/main/espd.c @@ -100,6 +100,20 @@ static void initdacs( void) } +static int audiostate; + +void sys_set_audio_state(int onoff) +{ + /* + if (onoff && !audiostate) + i2s_start(I2S_NUM_0); + else if (!onoff && audiostate) + i2s_stop(I2S_NUM_0); + audiostate = onoff; + */ +} + + /* queue from host. Need to make this a proper RTOS queue */ void *getbytes(size_t nbytes); void freebytes(void *x, size_t nbytes); @@ -122,7 +136,6 @@ void pd_fromhost(char *data, size_t size) memcpy(pd_bt_buf + pd_bt_size, data, size); pd_bt_size += size; xSemaphoreGive(pd_bt_mutex); - ESP_LOGI(TAG, "fromhost %d", size); } /* dispatch messages enqueued above */ @@ -138,13 +151,10 @@ void pd_pollhost( void) lastchar = pd_bt_size-1; while (lastchar >= 0 && isspace((int)(pd_bt_buf[lastchar]))) lastchar--; - if (lastchar > 2) - ESP_LOGI(TAG, "last %d %c", lastchar, pd_bt_buf[lastchar]); if (lastchar >= 3 && pd_bt_buf[lastchar] == ';' && pd_bt_buf[lastchar-1] != '\\') { - ESP_LOGI(TAG, "send it"); pd_sendmsg(pd_bt_buf, pd_bt_size); pd_bt_buf = (char *)resizebytes(pd_bt_buf, pd_bt_size, 0); pd_bt_size = 0; @@ -158,12 +168,11 @@ void pdmain_print( const char *s) strncpy(y, s, 79); y[79]=0; strcat(y, ";"); - ESP_LOGI(TAG, "post %d: %s", strlen(y), y); #ifdef PD_USE_BLUETOOTH if (strlen(y) > 0) pd_bt_writeback((unsigned char *)y, strlen(y)); #endif -#ifdef PD_USE_WIFI +#if 0 /* this doesn't work all that well since posts are split into atoms */ net_sendudp(y, strlen(y), CONFIG_ESP_WIFI_SENDPORT); net_sendtcp(y, strlen(y)); #endif diff --git a/main/pdmain.c b/main/pdmain.c index 1ec1112..3ca7408 100644 --- a/main/pdmain.c +++ b/main/pdmain.c @@ -266,7 +266,6 @@ void sys_lock(void) {} void sys_unlock(void) {} void pd_globallock(void) {} void pd_globalunlock(void) {} -void sys_set_audio_state(int onoff) {} int sys_defaultfont = 1; int sys_nearestfontsize(int fontsize) {return (1);} int sys_noautopatch = 1; diff --git a/wifi/net.c b/wifi/net.c index 031e6f7..555e0b5 100644 --- a/wifi/net.c +++ b/wifi/net.c @@ -18,13 +18,13 @@ static const char *TAG = "ESPD"; int tcp_socket; -void udpreceivertask(void *z) +void tcpreceivertask(void *z) { char rx_buffer[4000]; int ip_protocol = 0, err, newsocket; struct sockaddr_in dest_addr; - ESP_LOGI(TAG, "udpreceivertask starting..."); + ESP_LOGI(TAG, "tcpreceivertask starting..."); ESP_LOGE(TAG, "(ignore this - testing error printout)"); dest_addr.sin_addr.s_addr = inet_addr(CONFIG_ESP_WIFI_SENDADDR); dest_addr.sin_family = AF_INET; @@ -85,7 +85,7 @@ void net_init( void) /* this will get overridden later: */ udp_out_addr.sin_port = htons(CONFIG_ESP_WIFI_SENDPORT); - xTaskCreate(udpreceivertask, "udprcv", 6000, NULL, PRIORITY_WIFI, NULL); + xTaskCreate(tcpreceivertask, "udprcv", 6000, NULL, PRIORITY_WIFI, NULL); while (!tcp_socket) { ESP_LOGE(TAG, "sendtcp: waiting for socket");