Merge branch 'espressif:master' into master

This commit is contained in:
Limor "Ladyada" Fried 2023-06-30 00:12:42 -04:00 committed by GitHub
commit 638db1d127
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 15 deletions

View file

@ -218,10 +218,10 @@ void HWCDC::setTxTimeoutMs(uint32_t timeout){
size_t HWCDC::setTxBufferSize(size_t tx_queue_len){ size_t HWCDC::setTxBufferSize(size_t tx_queue_len){
if(tx_ring_buf){ if(tx_ring_buf){
if(!tx_queue_len){ vRingbufferDelete(tx_ring_buf);
vRingbufferDelete(tx_ring_buf); tx_ring_buf = NULL;
tx_ring_buf = NULL; }
} if(!tx_queue_len){
return 0; return 0;
} }
tx_ring_buf = xRingbufferCreate(tx_queue_len, RINGBUF_TYPE_BYTEBUF); tx_ring_buf = xRingbufferCreate(tx_queue_len, RINGBUF_TYPE_BYTEBUF);
@ -319,19 +319,16 @@ void HWCDC::flush(void)
size_t HWCDC::setRxBufferSize(size_t rx_queue_len){ size_t HWCDC::setRxBufferSize(size_t rx_queue_len){
if(rx_queue){ if(rx_queue){
if(!rx_queue_len){ vQueueDelete(rx_queue);
vQueueDelete(rx_queue); rx_queue = NULL;
rx_queue = NULL; }
} if(!rx_queue_len){
return 0; return 0;
} }
rx_queue = xQueueCreate(rx_queue_len, sizeof(uint8_t)); rx_queue = xQueueCreate(rx_queue_len, sizeof(uint8_t));
if(!rx_queue){ if(!rx_queue){
return 0; return 0;
} }
if(!tx_ring_buf){
tx_ring_buf = xRingbufferCreate(rx_queue_len, RINGBUF_TYPE_BYTEBUF);
}
return rx_queue_len; return rx_queue_len;
} }

View file

@ -285,17 +285,16 @@ void WebServer::serveStatic(const char* uri, FS& fs, const char* path, const cha
void WebServer::handleClient() { void WebServer::handleClient() {
if (_currentStatus == HC_NONE) { if (_currentStatus == HC_NONE) {
WiFiClient client = _server.available(); _currentClient = _server.available();
if (!client) { if (!_currentClient) {
if (_nullDelay) { if (_nullDelay) {
delay(1); delay(1);
} }
return; return;
} }
log_v("New client: client.localIP()=%s", client.localIP().toString().c_str()); log_v("New client: client.localIP()=%s", _currentClient.localIP().toString().c_str());
_currentClient = client;
_currentStatus = HC_WAIT_READ; _currentStatus = HC_WAIT_READ;
_statusChange = millis(); _statusChange = millis();
} }