From 2565bdb7662af81006bb54ae602d6279c24d5886 Mon Sep 17 00:00:00 2001 From: Steven Tracey Date: Thu, 21 Nov 2024 22:50:32 -0500 Subject: [PATCH] C is so much fun --- c/src/p2fa.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/c/src/p2fa.c b/c/src/p2fa.c index 845ebc7..918f172 100644 --- a/c/src/p2fa.c +++ b/c/src/p2fa.c @@ -52,9 +52,9 @@ void code(UWORD *blackImage, char* confName) { const char *code = getCode(confStr); DebugLine(3, 0, "Code: %s\n", code); Paint_DrawString(5, 5, code, &Font36, WHITE, BLACK); - Paint_DrawString(5, 100, confName, &Font12, WHITE, BLACK); + Paint_DrawString(5, 84, confName, &Font12, WHITE, BLACK); - Paint_DrawRectangle(10, 112, 240, 92, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY); + Paint_DrawRectangle(10, 114, 240, 94, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY); EPD_2in13_V4_Display_Base(blackImage); Paint_NewImage(blackImage, EPD_2in13_V4_WIDTH, EPD_2in13_V4_HEIGHT, 90, WHITE); @@ -140,20 +140,38 @@ void home(UWORD *blackImage) { switch(ch) { case KEY_UP: if (i > 0) i--; + Paint_ClearWindows(115, 5 + (i + 1) * 20, 122, 17 + (i + 1) * 20, WHITE); break; case KEY_DOWN: if (i < length - 1) i++; + Paint_ClearWindows(115, 5 + (i - 1) * 20, 122, 17 + (i - 1) * 20, WHITE); break; case '\n': timeout(0); code(blackImage, configNames[i]); + + Paint_NewImage(blackImage, EPD_2in13_V4_WIDTH, EPD_2in13_V4_HEIGHT, 0, WHITE); + EPD_2in13_V4_Init(); + Paint_SelectImage(blackImage); + Paint_Clear(WHITE); + for (int j = 0; j < length; j++) { + if (configNames[j] == NULL) { + DebugLine(13, 0, "Null Config: %d\n", j); + } + Paint_DrawString(5, 5 + (i * 20), configNames[i], &Font12, WHITE, BLACK); + } + EPD_2in13_V4_Display_Base(blackImage); + Paint_NewImage(blackImage, EPD_2in13_V4_WIDTH, EPD_2in13_V4_HEIGHT, 0, WHITE); + Paint_SelectImage(blackImage); + i = 0; + Paint_DrawString(115, 5 + (i * 20), "<", &Font12, WHITE, BLACK); + break; case 'q': return; } } - Paint_ClearWindows(115, 5 + (i * 20), 122, 17 + (i * 20), WHITE); Paint_DrawString(115, 5 + (i * 20), "<", &Font12, WHITE, BLACK); EPD_2in13_V4_Display_Partial(blackImage); }