-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
rtctime.dsleep(, 4) does not turn off the WiFi #1472
Comments
The docs don't mention why the two functions should behave differently in this respect. @jmattsson is this just an oversight? |
Nope, that is not an oversight. It used to work. I suspect something has changed in the SDK to have broken this. One of the gripes with the "regular" dsleep was that the SDK just set a 200ms timer to do the actual shutdown, which was burning way too much power for our use here. Thus @umisef reverse-engineered the then-current SDK shutdown code and used that to create an "instant" version of it. What's described here makes it sound like the SDK doesn't actually save the option value before it returns from Another thought: I don't suppose the sleep options got changed/deprecated when they introduced the |
FYI, with build from commit 3328c66 and with all the other power saving methods ( |
In fact, this issue is still present. rtctime.dsleep(1, 4) behaves different compared to node.dsleep(1,4). It is not even necessary to measure the power. Just join an AP and check the output of wifi.eventmon. With node.dsleep(1,4) the response after wakeup is always DISCONNECTED, whereas rtctime.dsleep(1,4) gives CONNECTED after waekup. Too bad, rtctime.dsleep was an alternative because of the better accuracy. But so it doesn't really work |
If I change the code of rtctime_dsleep that way
the option is acknowledged. Any ideas? |
@umisef back from the montblanc? Could you please give a bit of starting point of what tool did you use to reverse engineer the sleep procedure? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Expected behavior
rtctime.dsleep(1, 4)
should turn off the WiFi just likenode.dsleep(1, 4)
does. This can be confirmed most easily by measuring the current flowing into ESP8266. With WiFi turned off it should drop dramatically from 70 mA down to 12 mA.Actual behavior
The current consumption is high (~ 70 mA) after waking up no matter of the "option" parameter value.
Test code
NodeMCU version
Lua 5.1.4 on SDK 1.5.4.1(39cb9a32)
Hardware
plain ESP8266 version 07. GPIO16 wired to RST.
BTW
I looked into the source code and noticed just one little difference between node.dsleep() and rtctime.dsleep() - the former uses
option = lua_tointeger
while the latter usesoption = lua_tonumber
. No idea if this could be say zeroing the option value that would in turn cause the observed behavior.The
rtctime.dsleep_aligned()
suffers from the same issue, IIRC.This is a serious issue for anyone who tries to create a low power application with running system time. Thank you in advance for looking into this.
The text was updated successfully, but these errors were encountered: