Skip to content

Driver compatible with 2.0 Espressif firmware #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 10, 2017

Conversation

sarahmarshy
Copy link
Contributor

@sarahmarshy sarahmarshy commented Apr 4, 2017

Here is the AT command set for the new firmware - https://www.espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_en.pdf

Here are the release notes - http://bbs.espressif.com/viewtopic.php?f=46&t=2451#p8029

The new firmware deprecated a few commands, so there are minor changes to AT commands for configuring WiFi mode and sending data on a socket.

The new firmware allows dns lookup on ESP8266 module, so I have overriden gethostbyname to use this functionality.

@geky

Minor changes to AT commands.
Now does dns lookup thorough ESP8266 module.
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 👍
Just needs a few updates (mostly style)

return NSAPI_ERROR_OK;
}

char* ipbuff = (char*)malloc(256);
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 a string representation of an IP address? We have a define for the max size you should use (NSAPI_IP_SIZE).

Also you should either check for out of memory (malloc returns NULL) or use new char[blah] (asserts on oom).

* version is chosen by the stack (defaults to NSAPI_UNSPEC)
* @return 0 on success, negative error code on failure
*/
virtual nsapi_error_t gethostbyname(const char* name, SocketAddress *address, nsapi_version_t version);
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for conforming to the dox-style 👍

@@ -116,6 +116,13 @@ class ESP8266
* see @a nsapi_error
*/
int scan(WiFiAccessPoint *res, unsigned limit);
/**Perform a dns query
Copy link
Contributor

Choose a reason for hiding this comment

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

style: newline above?

* @param ip Buffer to store IP address
* @return 0 true on success, false on failure
*/
bool dns_lookup(const char* name, char* ip);
Copy link
Contributor

Choose a reason for hiding this comment

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

style: pointers side with names:

bool dns_lookup(const char *name, char *ip);

{
ret = NSAPI_ERROR_DEVICE_ERROR;
}
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: spaces after ifs, brackets on same line as conditionals:

if (!_esp.dns_lookup(name, ipbuff)) {
    ret = NSAPI_ERROR_DEVICE_ERROR;
} else {
    address->set_ip_address(ipbuff);
}

@sarahmarshy
Copy link
Contributor Author

@geky I made the suggested changes in the last commit.

@geky
Copy link
Contributor

geky commented Apr 10, 2017

Note: This is not backwards compatible with 0.2 firmware and docs need updating (@sarahmarshy is progressing).

We can go ahead and merge this and see what breaks.

If anyone needs the 0.2 firmware it's available on the previous release of this library (v1.2). The next release will be v2.0 to indicate the compatibility break (after seeing if this change sticks).

I've also made two branches (firmware-0.2 and firmware-2.0) for the most up to date release of the two firmware versions.

@geky geky merged commit b24b6ee into ARMmbed:master Apr 10, 2017
@tommikas
Copy link

tommikas commented Apr 26, 2017

and see what breaks.

mbed-os jenkins/pr-head did :P At the time I didn't realize it was because of this, what with all of the other Jenkins issues happening. And the driver lib shouldn't have pointed to tip of master either way.

@geky Even after updating FW the tests that use UDP still fail (apparently due to #25). Are there any tests for this?

@geky
Copy link
Contributor

geky commented Apr 27, 2017

@tommikas, should be fixed now : )

Feel free to reopen #25 if UDP is still an issue.

There are compatible network tests over in mbed-os we could bring over, though is there a way we can hook this repo up to CI?
https://github.com/ARMmbed/mbed-os/tree/master/features/FEATURE_LWIP/TESTS/mbedmicro-net

@tommikas
Copy link

tommikas commented May 2, 2017

though is there a way we can hook this repo up to CI?

Sure, that's pretty easy. Just need to have the hardware for it somewhere. Using the same HW as for mbed-os jenkins/pr-head is one option.

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.

4 participants