Light- or Modem Sleep #6298
Replies: 1 comment
-
Posted at 2016-01-30 by DrAzzy Sleep is not yet supported, espruino on esp8266 is still in a beta state. Posted at 2016-01-30 by user61930 thank you for your fast response! Is there any other option to reduce power consumption? Can I e.g. turn off wifi completely? Or is there any easy way to "hack" C calls to ESP8266 SDK functions into Espruino? I am currently evaluating platforms for a battery-powered display controller that gets its information using remote API calls. Posted at 2016-01-31 by tve The code to add deep sleep is not that much: https://gitter.im/espruino/Espruino?at=569ef56759e3d04215bcc49b Posted at 2016-02-01 by @gfwilliams IMO that code should really go into
I know it's a bit different in ESP8266, but it should still be possible to sleep in there - and then it behaves the same as other Espruino devices. You just call Posted at 2016-02-02 by tve That would be appropriate for "light sleep" in which memory is preserved. Deep sleep does not preserve memory. When it wakes up it's as if someone had pressed the reset button. (That's actually literally what happens.) Posted at 2016-02-02 by @gfwilliams Oh wow, yeah. That's going to be painful - not really suitable then :) To be honest this is something I should expose in Espruino on STM32 as well - it could be extremely useful for some things. Do IRQs and RTC still wake up the ESP8266? Posted at 2016-02-03 by tve in light sleep it's either a timer or a gpio transition, but not an interrupt. so can't wake-up from serial input. in deep sleep it's either the rtc timer or a reset... Posted at 2016-03-28 by urbiman I did not find a firmware built that has this included so I built my own version that contains deep and modem sleep (see here ), firmware is also attached to this post. Attachments: Posted at 2016-03-28 by DrAzzy Wow, awesome! Is the source code for this in github anywhere? If it works, maybe you could create a pull request so we could get this functionality into main releases? A number of people have expressed interest in this functionality. Posted at 2016-03-28 by @MaBecker @urbiman: used 1.85, added code, compiled, flashed, tested and lost control ....
Posted at 2016-03-28 by urbiman @MaBecker : You need to make sure that you connect the reset pin and gpio16 with each other otherwise the chip won't wake up again. Other than that 1000*1000 is just one second. @drazzy : I sure can do that but I do not know if pulls are accepted? The code can also be seen in my blog (see the link in my post before). Posted at 2016-03-28 by DrAzzy +Gordon is always encouraging people who expand or enhance Espruino to contribute it back to the repo. How does your implementation interact with setTimeout? I think Gordon could advise on how to best integrate it with Espruino. The way deepsleep is implemented on the "normal" Espruinii (ones based on STM32) is that you just "turn on" deep sleep, and the then it wakes up every few seconds (was it 3? 8? some single digit number of seconds) very briefly at that interval, checking for things to execute. Posted at 2016-03-29 by @gfwilliams You could a actually implement the sleeping in the Pull requests would be great and are definitely accepted - as long as they don't break things that worked before :) Posted at 2016-03-29 by urbiman Actually I do not interact with setTimeout. In the case of deepsleep it wouldn't make too much sense either I think, as after deepsleep the chip is resetted and therefor all timers are lost. In case of modemsleep it should be uneccessary as the CPU runs normal. I am not sure about lightsleep (I did not implement that) but my current understanding is, that lightsleep needs an external trigger to wakeup:
To me currently it seems that there is no way where the ESP8266 could interact with setTimeout (however I am not completely sure when it comes to lightsleep as RTC is running according to the document above). Posted at 2016-03-29 by @gfwilliams Ok, yeah - if it resets then I think exactly what you've done is the right way to go. Posted at 2016-03-29 by urbiman Ok, good to hear :) I will do a pull in the next days first adding deepsleep and modemsleep. However it seems to be possible to implement what you have done for the STM boards by using lightsleep. I found the following code (using light sleep and a timer):
I think that would be the next step then... Posted at 2016-03-29 by @gfwilliams Yes, that looks like it'd be good - however you'd only want to do that when Wifi is off? Posted at 2016-03-29 by urbiman I did a pull now to merge the deepSleep and modemSleep stuff (#825). Regarding the lightSleep it seems that this is only possible with wifi off if you want to enforce the sleep (which is what is supposed as far as I understand):
Posted at 2019-09-14 by Frida Are you a spammer? Posted at 2019-09-16 by @gfwilliams Thanks - deleted. He spam posted something else too... |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2016-01-30 by user61930
Hi!
Does Espruino on the ESP8266 support triggering light- or modem sleep (see here)?
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions