Home Page
This commit is contained in:
24
c/src/p2fa.c
24
c/src/p2fa.c
@@ -15,6 +15,9 @@
|
||||
#include "../libs/GUI/GUI_BMPfile.h"
|
||||
#include "../libs/Config/Debug.h"
|
||||
|
||||
extern char** getConfigNames(int* length);
|
||||
extern void freeCStringArray(char** cStrings, int length);
|
||||
|
||||
void Handler(int sigNum) {
|
||||
DebugLine(28, 0, "Caught signal %d\n", sigNum);
|
||||
EPD_2in13_V4_Init();
|
||||
@@ -31,19 +34,35 @@ void Handler(int sigNum) {
|
||||
}
|
||||
|
||||
void home(UWORD *blackImage) {
|
||||
int length;
|
||||
char** configNames = getConfigNames(&length);
|
||||
|
||||
if (configNames == NULL || length == 0) {
|
||||
DebugLine(10, 0, "No configs found\n");
|
||||
return;
|
||||
}
|
||||
|
||||
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 i = 0; i < length; ++i) {
|
||||
Paint_DrawString(5, 5 + (i * 20), configNames[i], &Font12, WHITE, BLACK);
|
||||
}
|
||||
EPD_2in13_V4_Display_Base(blackImage);
|
||||
|
||||
freeCStringArray(configNames, length);
|
||||
}
|
||||
|
||||
void code(UWORD *blackImage) {
|
||||
int ch;
|
||||
codeLoop:
|
||||
while(1) {
|
||||
ch = getch();
|
||||
if (ch != ERR) {
|
||||
if (ch == 'q') break;
|
||||
DebugLine(2, 0, "Key Pressed: %c\n", ch);
|
||||
DebugLine(2, 0, "Key Pressed: %c\n", ch);
|
||||
}
|
||||
|
||||
Paint_NewImage(blackImage, EPD_2in13_V4_WIDTH, EPD_2in13_V4_HEIGHT, 90, WHITE);
|
||||
@@ -72,7 +91,7 @@ void code(UWORD *blackImage) {
|
||||
for (int i = getTimeRemainingMS(30);; i = getTimeRemainingMS(30)) {
|
||||
ch = getch();
|
||||
if (ch != ERR) {
|
||||
if (ch == 'q') break;
|
||||
if (ch == 'q') return;
|
||||
}
|
||||
if (i > lastI) break;
|
||||
startTime = clock();
|
||||
@@ -117,6 +136,7 @@ int drawLoop() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
home(blackImage);
|
||||
code(blackImage);
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user