Apparently a trick to both reduce power consumption to increase battery life while simultaneously saving EEPROM cycles is to pass small amounts of data across deep sleep cycles by writing that data (up to 512 bytes) into the RTC memory. I don't see API endpoints for this in the docs. Does MicroPython not support this feature?
Thanks.
RTC memory
Re: RTC memory
You can use it like thiskwiley wrote: ↑Sat May 16, 2020 5:59 amApparently a trick to both reduce power consumption to increase battery life while simultaneously saving EEPROM cycles is to pass small amounts of data across deep sleep cycles by writing that data (up to 512 bytes) into the RTC memory. I don't see API endpoints for this in the docs. Does MicroPython not support this feature?
Thanks.
rtc=RTC()
rtc.memory(b'hello world') # write
rtc.memory() # read
If you need more data items you use a json string
Re: RTC memory
Okay. I see that in the REPL now:
It's worth noting that the memory function of RTC isn't documented on either the general MicroPython machine module webpage or the ESP8266-specific webpage:
docs.micropython.org/en/latest/library/machine.RTC.html:
http://docs.micropython.org/en/latest/l ... e.RTC.html
docs.micropython.org/en/latest/esp8266/quickref.html:
http://docs.micropython.org/en/latest/e ... ckref.html
In fact, the string "rtc.memory" doesn't occur anywhere in the docs:
docs.micropython.org/en/latest/search.html?q=rtc.memory&check_keywords=yes&area=default# :
http://docs.micropython.org/en/latest/s ... a=default#
So the only way to discover the memory function is through the REPL, and even then, merely discovering it doesn't document its parameters or how to use it. The only way to figure out its actual parameter list, return type, or behavior, is to got the Github and find it in the source.
Am I not understanding the proper way to use the documentation? I hate to ask newbie questions like, "How do you do a task that is clearly documented if you just look here."
Thanks.
Code: Select all
>>>
PYB: soft reboot
MicroPython v1.10-8-g8b7039d7d on 2019-01-26; ESP module with ESP8266
Type "help()" for more information.
>>> import machine
>>> rtc = machine.RTC()
>>> rtc.[TAB]
__class__ ALARM0 alarm alarm_left
datetime irq memory
>>> rtc.
docs.micropython.org/en/latest/library/machine.RTC.html:
http://docs.micropython.org/en/latest/l ... e.RTC.html
docs.micropython.org/en/latest/esp8266/quickref.html:
http://docs.micropython.org/en/latest/e ... ckref.html
In fact, the string "rtc.memory" doesn't occur anywhere in the docs:
docs.micropython.org/en/latest/search.html?q=rtc.memory&check_keywords=yes&area=default# :
http://docs.micropython.org/en/latest/s ... a=default#
So the only way to discover the memory function is through the REPL, and even then, merely discovering it doesn't document its parameters or how to use it. The only way to figure out its actual parameter list, return type, or behavior, is to got the Github and find it in the source.
Am I not understanding the proper way to use the documentation? I hate to ask newbie questions like, "How do you do a task that is clearly documented if you just look here."
Thanks.