ESP8266 disconnect returns ERROR_NO_CONNECTION

pull/9064/head
Michal Paszta 2018-11-28 11:23:09 +01:00 committed by Cruz Monrreal II
parent 1108d8d96c
commit a10e299bd9
1 changed files with 5 additions and 0 deletions

View File

@ -222,6 +222,11 @@ int ESP8266Interface::set_channel(uint8_t channel)
int ESP8266Interface::disconnect() int ESP8266Interface::disconnect()
{ {
if (_conn_stat == NSAPI_STATUS_DISCONNECTED)
{
return NSAPI_ERROR_NO_CONNECTION;
}
int ret = _esp.disconnect() ? NSAPI_ERROR_OK : NSAPI_ERROR_DEVICE_ERROR; int ret = _esp.disconnect() ? NSAPI_ERROR_OK : NSAPI_ERROR_DEVICE_ERROR;
if (ret == NSAPI_ERROR_OK) { if (ret == NSAPI_ERROR_OK) {