esp8266 driver - don't set UART flow control if no support

pull/8689/head
Veijo Pesonen 2018-11-09 16:03:41 +02:00
parent 8dd6a5d039
commit 934472be1d
1 changed files with 9 additions and 2 deletions

View File

@ -153,6 +153,7 @@ struct ESP8266::fw_at_version ESP8266::at_version()
bool ESP8266::stop_uart_hw_flow_ctrl(void) bool ESP8266::stop_uart_hw_flow_ctrl(void)
{ {
bool done = true; bool done = true;
#if DEVICE_SERIAL_FC
if (_serial_rts != NC || _serial_cts != NC) { if (_serial_rts != NC || _serial_cts != NC) {
// Stop board's flow control // Stop board's flow control
@ -163,6 +164,7 @@ bool ESP8266::stop_uart_hw_flow_ctrl(void)
&& _parser.recv("OK\n"); && _parser.recv("OK\n");
} }
#endif
return done; return done;
} }
@ -170,8 +172,9 @@ bool ESP8266::start_uart_hw_flow_ctrl(void)
{ {
bool done = true; bool done = true;
#if DEVICE_SERIAL_FC
if (_serial_rts != NC && _serial_cts != NC) { if (_serial_rts != NC && _serial_cts != NC) {
// Start board's flow control // Start board's flow control
_serial.set_flow_control(SerialBase::RTSCTS, _serial_rts, _serial_cts); _serial.set_flow_control(SerialBase::RTSCTS, _serial_rts, _serial_cts);
// Start ESP8266's flow control // Start ESP8266's flow control
@ -192,7 +195,11 @@ bool ESP8266::start_uart_hw_flow_ctrl(void)
_serial.set_flow_control(SerialBase::CTS, NC, _serial_cts); _serial.set_flow_control(SerialBase::CTS, NC, _serial_cts);
} }
#else
if (_serial_rts != NC || _serial_cts != NC) {
done = false;
}
#endif
return done; return done;
} }