Skip to content

Can't display an image after rtc sleep #33

Description

@rotemb-hailo

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions