Skip to content

ESP8266 driver changes to use ATCmdParser #46

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 1 commit into from
Oct 10, 2017

Conversation

SenRamakri
Copy link
Contributor

ARM Internal REF: IOTMORF-1232

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, consider my nits

@@ -49,7 +52,7 @@ bool ESP8266::startup(int mode)
&& _parser.send("AT+CIPMUX=1")
&& _parser.recv("OK");

_parser.oob("+IPD", this, &ESP8266::_packet_handler);
_parser.oob("+IPD", Callback<void()>(this, &ESP8266::_packet_handler));
Copy link
Contributor

Choose a reason for hiding this comment

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

This could just be:

_parser.oob("+IPD", callback(this, &ESP8266::_packet_handler));

}

bool ESP8266::readable()
{
return _serial.readable();
if ( _serial.poll( POLLIN ) & POLLIN ) return true;
return false;
Copy link
Contributor

Choose a reason for hiding this comment

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

couldn't this be return _serial.readable()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @geky UARTSerial does private inheritance of SerialBase and prevents us from calling readable/writable. In addition, I think poll call implementation is little better in that it avoids spinning.

Choose a reason for hiding this comment

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

You would need to be calling UARTSerial::readable(), not SerialBase::readable. You need to know if there's anything in the buffer, not the hardware.

Presumably you're avoiding ARMmbed/mbed-os#5066? That could otherwise be avoided with by saying _serial.FileHandle::readable().

I don't believe these functions are ever used anyway?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See your point, yes we want to check the buffer and not the hardware fifo/buffer, I'll change it to using _serial.FileHandle::readable() and serial.FileHandle::writable().

}

bool ESP8266::writeable()
{
return _serial.writeable();
if ( _serial.poll( POLLOUT ) & POLLOUT ) return true;
return false;
Copy link
Contributor

Choose a reason for hiding this comment

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

couldn't this be return _serial.writeable()?

@@ -26,7 +26,7 @@ using namespace utest::v1;

namespace {
// Test connection information
const char *HTTP_SERVER_NAME = "developer.mbed.org";
const char *HTTP_SERVER_NAME = "os.mbed.com";
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@@ -17,11 +17,14 @@
#include "ESP8266.h"

ESP8266::ESP8266(PinName tx, PinName rx, bool debug)
: _serial(tx, rx, 1024), _parser(_serial)
, _packets(0), _packets_end(&_packets)
: _serial(tx, rx, 1024),

Choose a reason for hiding this comment

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

Unless someone has changed UARTSerial while I wasn't looking, it doesn't let you set the buffer size (because of CircularBuffer) - 1024 would be baud rate. :(

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 catch, Actually I do call set_baud() in the constructor so the correct baud is still set. Ill fix this.

@geky geky requested a review from kjbracey September 27, 2017 15:35
@sarahmarshy
Copy link
Contributor

Should this PR remove the ATParser lib file to prevent it from being pulled in with the driver? https://github.com/ARMmbed/esp8266-driver/blob/master/ESP8266/ATParser.lib

@SenRamakri
Copy link
Contributor Author

Well yes, the current plan is we are going to add a comment in ESP8266 driver repo to say that ATParser is deprecated. This is to get any comments developers might have before we really remove it.

@SenRamakri SenRamakri closed this Sep 27, 2017
@SenRamakri SenRamakri reopened this Sep 27, 2017
@geky geky force-pushed the sen_ESP8266ATCmdParser branch 2 times, most recently from cc96bfb to 3422018 Compare October 10, 2017 17:15
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