C is so much fun

This commit is contained in:
Steven Tracey 2024-11-21 22:50:32 -05:00
parent d28af8e8b6
commit 2565bdb766

View File

@ -52,9 +52,9 @@ void code(UWORD *blackImage, char* confName) {
const char *code = getCode(confStr); const char *code = getCode(confStr);
DebugLine(3, 0, "Code: %s\n", code); DebugLine(3, 0, "Code: %s\n", code);
Paint_DrawString(5, 5, code, &Font36, WHITE, BLACK); 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); EPD_2in13_V4_Display_Base(blackImage);
Paint_NewImage(blackImage, EPD_2in13_V4_WIDTH, EPD_2in13_V4_HEIGHT, 90, WHITE); Paint_NewImage(blackImage, EPD_2in13_V4_WIDTH, EPD_2in13_V4_HEIGHT, 90, WHITE);
@ -140,20 +140,38 @@ void home(UWORD *blackImage) {
switch(ch) { switch(ch) {
case KEY_UP: case KEY_UP:
if (i > 0) i--; if (i > 0) i--;
Paint_ClearWindows(115, 5 + (i + 1) * 20, 122, 17 + (i + 1) * 20, WHITE);
break; break;
case KEY_DOWN: case KEY_DOWN:
if (i < length - 1) i++; if (i < length - 1) i++;
Paint_ClearWindows(115, 5 + (i - 1) * 20, 122, 17 + (i - 1) * 20, WHITE);
break; break;
case '\n': case '\n':
timeout(0); timeout(0);
code(blackImage, configNames[i]); 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; break;
case 'q': case 'q':
return; return;
} }
} }
Paint_ClearWindows(115, 5 + (i * 20), 122, 17 + (i * 20), WHITE);
Paint_DrawString(115, 5 + (i * 20), "<", &Font12, WHITE, BLACK); Paint_DrawString(115, 5 + (i * 20), "<", &Font12, WHITE, BLACK);
EPD_2in13_V4_Display_Partial(blackImage); EPD_2in13_V4_Display_Partial(blackImage);
} }