diff --git a/c/src/p2fa.c b/c/src/p2fa.c index dd65e95..d82cdae 100644 --- a/c/src/p2fa.c +++ b/c/src/p2fa.c @@ -44,6 +44,8 @@ int draw() { Paint_NewImage(BlackImage, EPD_2in13_V4_WIDTH, EPD_2in13_V4_HEIGHT, 90, WHITE); Paint_Clear(WHITE); + EPD_2in13_V4_Init(); + Paint_SelectImage(BlackImage); Paint_DrawString(10, 40, "Hello, World!", &Font16, WHITE, BLACK); @@ -66,7 +68,9 @@ int draw() { for (int i = getTimeRemainingMS(30); i > 500; i = getTimeRemainingMS(30)) { startTime = clock(); Debug("Time Left: %dms\n", i); - Paint_DrawRectangle(10, 112, (i / (30 * 1000)) * 240, 92, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL); + int progWidth = (int)(((double)i / (double)(30 * 1000)) * 240); + Debug("Progress bar width: %d", progWidth); + Paint_DrawRectangle(10, 112, progWidth, 92, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL); EPD_2in13_V4_Display_Partial(BlackImage); endTime = clock(); elapsedTime = (double)(endTime - startTime) / CLOCKS_PER_SEC;