CRImier / micropython-ttgo-wristband

Code and data about TTGO/LilyGo T-Wristband and running MicroPython on it
GNU General Public License v3.0
14 stars 6 forks source link

RTC support #1

Open joelschutz opened 4 years ago

joelschutz commented 4 years ago

Hi, nice repo. I'm planning in buying one of those t-wristbands pretty soon and want to help develop a some features to it.

Since I don't have it right now, testing is difficult, but I have some ideas of code to improve it.

First feature that is obvious for a watch is a clock. Micropython already has a RTC class for this purpose, does it work? I'm afraid not, because many people complain about it in other issues. After some research I found this: https://github.com/lewisxhe/MicroPython_ESP32_psRAM_LoBo/blob/master/MicroPython_BUILD/components/micropython/esp32/modules/pcf8563.py

The README of this repo has a example of use of this module and should work just fine with the t-wristband.

As soon as get mine, I'll try this one and help with some other implementations.

CRImier commented 4 years ago

Hi! Happy to hear you like this watch, too!

I'd use a pcf8563.py driver, but you might have success making the RTC driver work - I didn't look into that one yet.

joelschutz commented 4 years ago

After some digging in the MicroPython source I founded the machine.RTC class: https://github.com/micropython/micropython/blob/master/ports/esp32/machine_rtc.c

I looks promising at first, but some issues appeared. First is the fact that this class utilize the internal ESP32 RTC, the same one responsible for the timed_wakeup. Refactor this class would consist of redoing much of the methods to do other things. Pretty much the only thing that would remain the name itself.

Second one is that this is one of the C written modules of MicroPython, and I'm not experienced with this language enough to be comfortable doing those changes.

Since I think this repo must kind of a "Official" non-official source for that product. I the best way would be to create a custom module or class based on the PCF8563. Something like ext_RTC or PCF8563_RTC