From b7220df5841b8b6a029bc33249d47d22dfea44d3 Mon Sep 17 00:00:00 2001 From: Steven Tracey Date: Wed, 20 Nov 2024 13:26:59 -0500 Subject: [PATCH] Worky --- c/src/p2fa.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/c/src/p2fa.c b/c/src/p2fa.c index a80011f..1b93e70 100644 --- a/c/src/p2fa.c +++ b/c/src/p2fa.c @@ -15,6 +15,17 @@ void Handler(int sigNum) { printf("Caught signal %d\n", sigNum); + EPD_2in13_V4_Init(); + EPD_2in13_V4_Clear(); + + Debug("Goto Sleep...\r\n"); + EPD_2in13_V4_Sleep(); + free(BlackImage); + BlackImage = NULL; + + DEV_Delay_ms(2000);//important, at least 2s + Debug("close 5V, Module enters 0 power consumption ...\r\n"); + DEV_Module_Exit(); exit(0); } @@ -36,7 +47,7 @@ int draw() { Paint_Clear(WHITE); Paint_SelectImage(BlackImage); - Paint_DrawString(32, 10, "Hello, World!", &Font16, WHITE, BLACK); + Paint_DrawString(10, 40, "Hello, World!", &Font16, WHITE, BLACK); const char *confName = "default"; GoString confStr = {confName, strlen(confName)}; @@ -50,6 +61,7 @@ int draw() { uint64_t timeLeft = getTimeRemainingMS(30); for (int j = 0; j < 3; ++j) { for (int i = getTimeRemainingMS(30); i > 200; i = getTimeRemainingMS(30)) { + Debug("Time Left: %dms", getTimeRemainingMS(30)); Paint_DrawRectangle(10, 112, (timeLeft / (30 * 1000)) * 240, 92, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL); EPD_2in13_V4_Display_Partial(BlackImage); DEV_Delay_ms(100);