Compare commits

..

2 Commits

Author SHA1 Message Date
Philippe G
635d382d71 fully remove ctrl_fd (was uninitialized in server loop) - release 2021-11-18 12:22:48 -08:00
philippe44
5d09d4f853 Update README.md 2021-11-17 10:59:44 -08:00
2 changed files with 7 additions and 39 deletions

View File

@@ -71,7 +71,7 @@ NB: You can use the pre-build binaries SqueezeAMP4MBFlash which has all the hard
- spdif_config: bck=33,ws=25,do=15 - spdif_config: bck=33,ws=25,do=15
### ESP32-A1S ### ESP32-A1S
Works with [ESP32-A1S](https://docs.ai-thinker.com/esp32-a1s) module that includes audio codec and headset output. You still need to use a demo board like [this](https://www.aliexpress.com/item/4001060963585.html) or an external amplifier if you want direct speaker connection. Note that there is a version with AC101 codec and another one with ES8388 (see below) Works with [ESP32-A1S](https://docs.ai-thinker.com/esp32-a1s) module that includes audio codec and headset output. You still need to use a demo board like [this](https://www.aliexpress.com/item/4001060963585.html) or an external amplifier if you want direct speaker connection. Note that there is a version with AC101 codec and another one with ES8388 with probably two variants - these boards are a mess (see below)
The board shown above has the following IO set The board shown above has the following IO set
- amplifier: GPIO21 - amplifier: GPIO21
@@ -95,8 +95,10 @@ So a possible config would be
for AC101 for AC101
- dac_config: model=AC101,bck=27,ws=26,do=25,di=35,sda=33,scl=32 - dac_config: model=AC101,bck=27,ws=26,do=25,di=35,sda=33,scl=32
for ES8388 for ES8388 (it seems that there are variants with same version number - a total mess)
- dac_config: model=ES8388,bck=5,ws=25,do=26,sda=18,scl=23,i2c=16 - dac_config: model=ES8388,bck=5,ws=25,do=26,sda=18,scl=23,i2c=16
or
- dac_config: model=ES8388,bck=27,ws=25,do=26,sda=33,scl=32,i2c=16
### T-WATCH2020 by LilyGo ### T-WATCH2020 by LilyGo
This is a fun [smartwatch](http://www.lilygo.cn/prod_view.aspx?TypeId=50036&Id=1290&FId=t3:50036:3) based on ESP32. It has a 240x240 ST7789 screen and onboard audio. Not very useful to listen to anything but it works. This is an example of a device that requires an I2C set of commands for its dac (see below). There is a build-option if you decide to rebuild everything by yourself, otherwise the I2S default option works with the following parameters This is a fun [smartwatch](http://www.lilygo.cn/prod_view.aspx?TypeId=50036&Id=1290&FId=t3:50036:3) based on ESP32. It has a 240x240 ST7789 screen and onboard audio. Not very useful to listen to anything but it works. This is an example of a device that requires an I2C set of commands for its dac (see below). There is a build-option if you decide to rebuild everything by yourself, otherwise the I2S default option works with the following parameters

View File

@@ -80,35 +80,6 @@ static esp_err_t _httpd_server_init(struct httpd_data *hd)
return ESP_OK; return ESP_OK;
} }
static void _httpd_process_ctrl_msg(struct httpd_data *hd)
{
struct httpd_ctrl_data msg;
int ret = recv(hd->ctrl_fd, &msg, sizeof(msg), 0);
if (ret <= 0) {
ESP_LOGW(TAG, LOG_FMT("error in recv (%d)"), errno);
return;
}
if (ret != sizeof(msg)) {
ESP_LOGW(TAG, LOG_FMT("incomplete msg"));
return;
}
switch (msg.hc_msg) {
case HTTPD_CTRL_WORK:
if (msg.hc_work) {
ESP_LOGD(TAG, LOG_FMT("work"));
(*msg.hc_work)(msg.hc_work_arg);
}
break;
case HTTPD_CTRL_SHUTDOWN:
ESP_LOGD(TAG, LOG_FMT("shutdown"));
hd->hd_td.status = THREAD_STOPPING;
break;
default:
break;
}
}
static esp_err_t _httpd_accept_conn(struct httpd_data *hd, int listen_fd) static esp_err_t _httpd_accept_conn(struct httpd_data *hd, int listen_fd)
{ {
/* If no space is available for new session, close the least recently used one */ /* If no space is available for new session, close the least recently used one */
@@ -164,13 +135,10 @@ static esp_err_t _httpd_server(struct httpd_data *hd)
* older connections will be closed) */ * older connections will be closed) */
FD_SET(hd->listen_fd, &read_set); FD_SET(hd->listen_fd, &read_set);
} }
FD_SET(hd->ctrl_fd, &read_set);
int tmp_max_fd; int maxfd;
httpd_sess_set_descriptors(hd, &read_set, &tmp_max_fd); httpd_sess_set_descriptors(hd, &read_set, &maxfd);
int maxfd = MAX(hd->listen_fd, tmp_max_fd); maxfd = MAX(hd->listen_fd, maxfd);
tmp_max_fd = maxfd;
maxfd = MAX(hd->ctrl_fd, tmp_max_fd);
ESP_LOGD(TAG, LOG_FMT("doing select maxfd+1 = %d"), maxfd + 1); ESP_LOGD(TAG, LOG_FMT("doing select maxfd+1 = %d"), maxfd + 1);
int active_cnt = select(maxfd + 1, &read_set, NULL, NULL, NULL); int active_cnt = select(maxfd + 1, &read_set, NULL, NULL, NULL);
@@ -180,8 +148,6 @@ static esp_err_t _httpd_server(struct httpd_data *hd)
return ESP_OK; return ESP_OK;
} }
/* Case0: Do we have a control message? */
/* Case1: Do we have any activity on the current data /* Case1: Do we have any activity on the current data
* sessions? */ * sessions? */
int fd = -1; int fd = -1;