-
Notifications
You must be signed in to change notification settings - Fork 24
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
Conversation
Minor changes to AT commands. Now does dns lookup thorough ESP8266 module.
There was a problem hiding this 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)
ESP8266Interface.cpp
Outdated
return NSAPI_ERROR_OK; | ||
} | ||
|
||
char* ipbuff = (char*)malloc(256); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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 👍
ESP8266/ESP8266.h
Outdated
@@ -116,6 +116,13 @@ class ESP8266 | |||
* see @a nsapi_error | |||
*/ | |||
int scan(WiFiAccessPoint *res, unsigned limit); | |||
/**Perform a dns query |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: newline above?
ESP8266/ESP8266.h
Outdated
* @param ip Buffer to store IP address | ||
* @return 0 true on success, false on failure | ||
*/ | ||
bool dns_lookup(const char* name, char* ip); |
There was a problem hiding this comment.
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);
ESP8266Interface.cpp
Outdated
{ | ||
ret = NSAPI_ERROR_DEVICE_ERROR; | ||
} | ||
else{ |
There was a problem hiding this comment.
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);
}
@geky I made the suggested changes in the last commit. |
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. |
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? |
@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? |
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. |
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