Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't display an image after rtc sleep #33

Open
rotemb-hailo opened this issue Jun 23, 2023 · 0 comments
Open

Can't display an image after rtc sleep #33

rotemb-hailo opened this issue Jun 23, 2023 · 0 comments

Comments

@rotemb-hailo
Copy link

rotemb-hailo commented Jun 23, 2023

Hi, I was wondering, do you have an example with actual rtc sleep? Because its seems like I can't draw an image after rtc sleep.

What am I missing?

#include "EPD_5in65f.h"
#include "EPD_Test.h"
#include "image1.h"
#include "image2.h"

static void print_datetime_t(datetime_t* t)
{
    printf("Sleep callback - %d/%d/%d %d:%d:%d \n", t->day, t->month, t->year, t->hour, t->min, t->sec);
}

static void sleep_callback(void)
{
    datetime_t t;
    rtc_get_datetime(&t);
    print_datetime_t(&t);
}

static void set_time(void)
{
    // Start on Friday 5th of June 2020 15:45:00
    datetime_t t = {
        .year = 2020,
        .month = 06,
        .day = 05,
        .dotw = 5, // 0 is Sunday, so 5 is Friday
        .hour = 15,
        .min = 45,
        .sec = 00};

    // Start the RTC
    rtc_set_datetime(&t);
}

static void rtc_sleep2(int min)
{

   datetime_t t_alarm = {
        .year = 2020,
        .month = 06,
        .day = 05,
        .dotw = 5, // 0 is Sunday, so 5 is Friday
        .hour = 15,
        .min = min,
        .sec = 00};

    // uart_default_tx_wait_blocking();
    sleep_goto_sleep_until(&t_alarm, &sleep_callback);
}

int EPD_5in65f_test(void)
{
    printf("EPD_5in65F_test Demo\r\n");
    if (DEV_Module_Init() != 0)
    {
        return -1;
    }

    printf("e-Paper Init and Clear...\r\n");
    EPD_5IN65F_Init();
    EPD_5IN65F_Clear(EPD_5IN65F_WHITE);
    DEV_Delay_ms(100);

    rtc_init();
    EPD_5IN65F_Display(Image1);
    DEV_Delay_ms(4000);
    EPD_5IN65F_Sleep();
    DEV_Delay_ms(1000);
    set_time();
    rtc_sleep2(46);

    EPD_5IN65F_Init();
    DEV_Delay_ms(1000);
    EPD_5IN65F_Display(Image2);
    DEV_Delay_ms(4000);
    rtc_sleep2(47);

    printf("e-Paper Clear...\r\n");
    EPD_5IN65F_Clear(EPD_5IN65F_WHITE);
    DEV_Delay_ms(1000);
    EPD_5IN65F_Sleep();

    // close 5V
    printf("close 5V, Module enters 0 power consumption ...\r\n");
    DEV_Module_Exit();

    return 0;
}

The code seems to be stuck every run, in a different place, around this lines: https://github.com/waveshareteam/Pico_ePaper_Code/blob/main/c/lib/e-Paper/EPD_5in65f.c#L171

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant