SparkFun_ESP8266_AT_Arduino_Library icon indicating copy to clipboard operation
SparkFun_ESP8266_AT_Arduino_Library copied to clipboard

ESP8266Wifi.status() function is not working as expected

Open jordicasals opened this issue 6 years ago • 0 comments

Hi,

I think that the status() function in the ESP8266Wifi class is not working as expected (according to the function header comments). It affects the client.connected() function and the examples.

I propose a modification:

// status()
// Input: none
// Output:
//    - Success: 2, 3, 4, or 5 (ESP8266_STATUS_GOTIP, ESP8266_STATUS_CONNECTED, ESP8266_STATUS_DISCONNECTED, ESP8266_STATUS_NOWIFI)
//    - Fail: <0 (esp8266_cmd_rsp)
int16_t ESP8266Class::status()
{
	int16_t statusRet = updateStatus();
	if (statusRet > 0)
	{
		return _status.stat;
	}
	return -1;
}

Thank you

jordicasals avatar Feb 07 '18 13:02 jordicasals