Skip to content

Commit 706dd39

Browse files
author
Veijo Pesonen
committed
ESP8266: protects setting UART HW flow control with a mutex
1 parent 108ec44 commit 706dd39

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

components/wifi/esp8266-driver/ESP8266/ESP8266.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ bool ESP8266::start_uart_hw_flow_ctrl(void)
187187
bool done = true;
188188

189189
#if DEVICE_SERIAL_FC
190+
_smutex.lock();
190191
if (_serial_rts != NC && _serial_cts != NC) {
191192
// Start ESP8266's flow control
192193
done = _parser.send("AT+UART_CUR=%u,8,1,0,3", ESP8266_DEFAULT_BAUD_RATE)
@@ -213,6 +214,11 @@ bool ESP8266::start_uart_hw_flow_ctrl(void)
213214
_serial.set_flow_control(SerialBase::CTS, NC, _serial_cts);
214215
}
215216
}
217+
_smutex.unlock();
218+
219+
if (!done) {
220+
tr_debug("Enable UART HW flow control: FAIL");
221+
}
216222
#else
217223
if (_serial_rts != NC || _serial_cts != NC) {
218224
done = false;

0 commit comments

Comments
 (0)