m5stack / M5Core-Ink

M5Stack CoreInk Arduino Library
MIT License
44 stars 33 forks source link

RTC clock example #6

Closed felmue closed 2 years ago

felmue commented 3 years ago

shows how to partially update ink display after powering on from full shutdown mode

robouden commented 3 years ago

Got an error in VSCode when compiling the sample:"'class RTC' has no member named 'GetDate'" Any solution for that?

Regards, Rob Oudendijk

robouden commented 3 years ago

Got it. It was a spelling mistake in the wire.h code. If the sample is changed to GetData instead of GetDate all works fine.

regards rob

felmue commented 3 years ago

Hi @robouden

sorry for the confusion. In the latest version of the M5CoreInk library (here in github) M5Stack changed the function name from GetData to GetDate that is why my example uses GetDate as well.

Relevant git commit: https://github.com/m5stack/M5-CoreInk/commit/b5003a1661bb55c48a0c1d1aa2b191e6e2bb00ca

Thanks Felix

robouden commented 3 years ago

Felix,

Thanks for the update. I will update my code.

regards rob

nicolas-f commented 3 years ago

Thx for your contribution. I think you will have a drift on minute shifting over time.

You could call this function instead in order to wake up just before the next minute:

int shutdown( const RTC_TimeTypeDef &RTC_TimeStruct);
felmue commented 3 years ago

Hello @nicolas-f

thank you for your feedback. I appreciate it.

I have the code running for some weeks now and so far I haven't noticed any minute shifting over time. I am sure you've noticed that for every wakeup period the system re-synchronises itself onto the full minute by waiting for the seconds to be zero (lines 162 - 167). So even if the wakeup time should slightly differ from time to time a possible error cannot build up. Or am I missing something?

BTW: If you look closely at the shutdown function you mentioned you'll notice that, even though the argument takes hours, minutes and seconds, the underlying RTC alarm function ignores the seconds. That means an RTC alarm can only occur on the full minute (eg. seconds are 0). And that is just a little too late for the preparation work which needs to be done just a bit before the full minute.

Thanks Felix

nicolas-f commented 3 years ago

Yes indeed sorry, the seconds are not read by the source code:

https://github.com/m5stack/M5-CoreInk/blob/master/src/utility/BM8563.cpp#L254

And PCF8563 does not have a seconds alarm register.

I don't know if m5stack continues to track source code repositories after publishing their products?