m5stack / M5EPD

M5Paper Arduino Library
MIT License
167 stars 53 forks source link

How to use unified library and power functions with Paper EPD #56

Closed timrichardson closed 1 year ago

timrichardson commented 1 year ago

Describe the bug

I have made a project using the M5 Unified stack. Everything is good, and now I want to use the shutdown(n) and RTC wakeup features.

This porting guide is not very specific: http://docs.m5stack.com/en/quick_start/m5unified/migration

From the same site, there is: http://docs.m5stack.com/en/api/m5paper/rtc but like most documentation for the M5 Paper, it assumes use of the M5EPD library. However, this library can not work with the unified library.

http://docs.m5stack.com/en/api/m5paper/rtc

has example code, but the first line is

include

Do I need to install the library m5core2? It has many, many dependencies. I did that, but compiling failed with this error:

In file included from /home/tim/Arduino/libraries/M5Core2/src/M5Core2.h:76, from /home/tim/Arduino/bus_timetable/bus_timetable.ino:21: /home/tim/Arduino/libraries/M5Core2/src/M5Display.h:90:16: error: reference to 'jpeg_div_t' is ambiguous

and others. So it seems this is not supposed to be used with the M5Unified library. What to do?

To reproduce

Visit the documentation and see what I see,

Expected behavior

If M5 unified is to be used, then other documentation should be consistent. Power management with the Unified library for the Paper is not documented anywhere.

Screenshots

No response

Environment

Additional context

No response

Issue checklist

Tinyu-Zhao commented 1 year ago

Sorry, our documentation caused a misunderstanding You can refer to this example, where M5.shutdown() can be filled with "seconds", "time", "date and time" to shut down Paper and wake up at the specified time. https://github.com/m5stack/M5EPD/blob/main/examples/Basics/RTC_WakeUp/RTC_WakeUp.ino

timrichardson commented 1 year ago

But that example requires the old EPD library which does not work when using M5Unified, which is the point of my issue.

In M5 Unified I can do M5.Power.timerSleep(n) where n is seconds.

On my Paper, this turning off and waking up. But is it doing much power saving? I am not convinced about that. There is no documentation about what timerSleep() does with the M5 Paper. Googling shows that people using the old EPD library had to use workarounds to get low power use.

It would be great if here in this ticket you could provide the definitive instructions to sleep the M5 Paper with M5 Unified library.

On Sun, 19 Mar 2023 at 02:14, Tinyu @.***> wrote:

Sorry, our documentation caused a misunderstanding You can refer to this example, where M5.shutdown() can be filled with "seconds", "time", "date and time" to shut down Paper and wake up at the specified time.

https://github.com/m5stack/M5EPD/blob/main/examples/Basics/RTC_WakeUp/RTC_WakeUp.ino

— Reply to this email directly, view it on GitHub https://github.com/m5stack/M5EPD/issues/56#issuecomment-1474875739, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHCNYTVZWXXE3R6QLPGMJDW4XGORANCNFSM6AAAAAAV7LKPQQ . You are receiving this because you authored the thread.Message ID: @.***>

--

Tim Richardson CPA, Director, BA, BSc, MAcc GrowthPath. Finance transformation for SMEs via Cloud ERP, advanced reporting, CRM

Mobile: +61 423 091 732 Office/Reception: +61 3 8678 1850. Book call: https://vyte.in/growthpath/15 Timezone is Melbourne AU. See this link for international time planning: https://www.timeanddate.com/worldclock/meeting.html?year=2020&month=5&day=16&p1=152 GrowthPath Pty Ltd ABN 18100392326

http://www.growthpath.com.au/

Tinyu-Zhao commented 1 year ago

Sleep and wake up using M5.shutdown() in the library M5Paper. https://github.com/m5stack/M5EPD/blob/main/examples/Basics/RTC_WakeUp/RTC_WakeUp.ino