-
Notifications
You must be signed in to change notification settings - Fork 3k
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
ESP8266 unlocks deep sleep when disconnected #11514
Conversation
630eb95
to
2d1040b
Compare
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.
This driver changed a lot since I last looked at it so I let someone more familiar do the actual review. But the idea looks good to me.
@@ -405,6 +405,8 @@ class ESP8266 { | |||
static const int8_t WIFIMODE_STATION_SOFTAP = 3; | |||
static const int8_t SOCKET_COUNT = 5; | |||
|
|||
int uart_enable_input(bool lock); |
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.
Public function should have doxygen and also be bundled with rest of the methods (after flush).
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.
Should be fixed now (@dmaziec1 worth adding a comment for reviewers, what has been addressed)
@dmaziec1, thank you for your changes. |
68a6243
to
570954c
Compare
@VeijoPesonen , would you also take a moment to review this? |
* Enables or disables uart input and deep sleep | ||
* | ||
* @param lock if TRUE, uart input is enabled and deep sleep is | ||
* locked if FALSE, uart input is disabled and deep sleep is |
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.
First word belongs to previous line
@@ -224,13 +226,15 @@ void ESP8266Interface::_connect_async() | |||
nsapi_error_t status = _init(); | |||
if (status != NSAPI_ERROR_OK) { | |||
_connect_retval = status; | |||
_esp.uart_enable_input(false); |
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.
I have a feeling this should be done already inside _init() once it's detected that something has gone wrong with initialization. Same goes for enabling the serial.
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.
Uart input enabling/disabling depends on _software_conn_stat
value, so it would be better to enable or disable input once when it changes. _init
should rather rely on the driver to have uart input enabled (depending on the conn_stat
), than try and influence it on its own.
Also, in this way we will avoid repetition of the same condition statement before each return.
@VeijoPesonen, does this make sense?
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.
Uart input enabling/disabling depends on _software_conn_stat value, so it would be better to enable or disable input once when it changes.
Ok, point taken :)
Also, in this way we will avoid repetition of the same condition statement before each return.
Not needed based on your response.
|
||
_esp.uart_enable_input(false); |
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.
Maybe this should be done already inside _power_off().
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.
I assume this can stay as it is based on your previous comment about not turning the serial on inside _init().
570954c
to
1aa3b5d
Compare
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 to me. I assume you have run all the netsocket test cases after doing these modifications. Those are not yet part of our PR checks.
Any more reviews for this one? I'll start CI meanwhile |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
@VeijoPesonen , the tests have been run and passed fine (apart from a known DNS issue, we are working on anyway). |
Looks like this is ready almost. @dmaziec1 Can you add "Release notes" section in the first comment, any |
@0xc0170 , release notes are added. |
LGTM @AnttiKauppila Please review the release notes, once approved, we will merge |
@ARMmbed/mbed-os-maintainers Release notes approved |
Description
As requested in: #10059 in ESP8266 deep sleep is locked only while the network is active or ESP8266 commands are triggered.
Pull request type
Reviewers
@SeppoTakalo
@AnttiKauppila
@kjbracey-arm
@michalpasztamobica
Release Notes
This release contains changes for ESP8266.
UART input is enabled and deep sleep is locked :
UART input is disabled and deep sleep is unlocked :