Skip to content

Conversation

@sarahmarshy
Copy link
Contributor

If ESP8266 firmware version is less that v2.0.0, then we print a debug message and return an error from the connect function. The message directs users to the wiki page for updating the firmware.

@sarahmarshy sarahmarshy requested a review from geky April 13, 2017 16:37
If ESP8266 firmware version is less that v2.0.0, then we print a debug
message and return an error from the connect function.
@sarahmarshy sarahmarshy force-pushed the firmware-version-error branch from 72db791 to a7016f7 Compare April 13, 2017 16:41
* Check firmware version of ESP8266
*
* @return true only if ESP8266 firmware > v2
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, thoughts on returning the firmware version and checking at a higher level? Maybe int get_firmware_version()?

{
_esp.setTimeout(ESP8266_MISC_TIMEOUT);

if(!_esp.check_firmware_version()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to occur after the esp8266 is reset (in ESP8266::startup) otherwise the esp8266 may be in a bad error state an not respond.

_esp.setTimeout(ESP8266_MISC_TIMEOUT);

if(!_esp.check_firmware_version()) {
debug("ERROR: Firmware incompatible with this driver.\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a reasonable error message, I would add something at the front that indicates the esp8266 is throwing an error (maybe "ESP8266: ERROR: blablabalabla").

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I would omit the specific version, maybe just say "most recent version". Otherwise maintaining that number may become annoying.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or actually, have the current version defined as ESP8266_VERSION, then use "%d" in the debug statement so we only have to update one number (and maybe use that define for the version check).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call.

#define ESP8266_INTERFACE_H

#include "mbed.h"
#include "mbed_debug.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Compiliation fails otherwise, apparently it is not included in mbed.h.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm ok, in that case can you actually move it into the cpp file for now?

It should probably be in mbed.h if you want to make a pr against mbed-os

if(_parser.recv("SDK version:%d", &version) && _parser.recv("OK")) {
return version;
}
else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: else on same line as previous bracket, and space after if:

if (_parser.recv("SDK version:%d", &version) && _parser.recv("OK")) {
    return version;
} else { 

{
_esp.setTimeout(ESP8266_CONNECT_TIMEOUT);

if(!_esp.reset()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style if (!_esp.reset()) {


_esp.setTimeout(ESP8266_MISC_TIMEOUT);

if(_esp.get_firmware_version() != ESP8266_VERSION) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style if (_esp.get_firmware_version() != ESP8266_VERSION) {

return NSAPI_ERROR_DEVICE_ERROR;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you update this pr, can you remove this whitespace change?

Firmware version pinned to macro. Check for compatibility occurs at
Interface level.
@sarahmarshy sarahmarshy force-pushed the firmware-version-error branch from 64e5e78 to 530ab25 Compare April 25, 2017 18:07
Copy link
Contributor

@geky geky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thinks for updating the style 👍

@geky geky merged commit f6f7c3a into ARMmbed:master Apr 26, 2017
@bulislaw
Copy link
Member

+2 to that :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants