improve logging

This commit is contained in:
Adolfo Reyna
2025-12-10 13:41:39 -05:00
parent f197b9c1f4
commit eb0156bb9d

View File

@@ -48,18 +48,18 @@ typedef struct {
} DisplayMessage;
static void init_epaper_display() {
printf("Initializing 7.5\" e-Paper display (B V2)...\r\n");
printf("[Core 1] Initializing 7.5\" e-Paper display (B V2)...\r\n");
// Initialize the hardware
if (DEV_Module_Init() != 0) {
printf("Failed to initialize e-Paper hardware!\r\n");
printf("[Core 1] Failed to initialize e-Paper hardware!\r\n");
return;
}
// Initialize the display
printf("EPD_7IN5B_V2_Init()\r\n");
printf("[Core 1] EPD_7IN5B_V2_Init()\r\n");
EPD_7IN5B_V2_Init_Fast();
printf("EPD_7IN5B_V2_Clear()\r\n");
printf("[Core 1] EPD_7IN5B_V2_Clear()\r\n");
// Create image buffers for black and red content
// 7.5" display: 800x480, 8 pixels per byte, so (800/8) * 480 = 48000 bytes each
@@ -69,7 +69,7 @@ static void init_epaper_display() {
g_epd_red = (UBYTE *)malloc(imagesize);
if (g_epd_image == NULL || g_epd_red == NULL) {
printf("Failed to allocate memory for e-Paper image buffers!\r\n");
printf("[Core 1] Failed to allocate memory for e-Paper image buffers!\r\n");
return;
}
@@ -79,7 +79,7 @@ static void init_epaper_display() {
}
// Setup paint buffer for black content
printf("White background\r\n");
printf("[Core 1] White background\r\n");
Paint_NewImage(g_epd_image, EPD_7IN5B_V2_WIDTH, EPD_7IN5B_V2_HEIGHT, 0, WHITE);
Paint_SelectImage(g_epd_image);
Paint_Clear(WHITE);
@@ -90,12 +90,13 @@ static void init_epaper_display() {
EPD_7IN5B_V2_Display_Partial(g_epd_image, 0, 0, EPD_7IN5B_V2_WIDTH, EPD_7IN5B_V2_HEIGHT);
EPD_7IN5B_V2_Display_Partial(g_epd_image, 0, 0, EPD_7IN5B_V2_WIDTH, EPD_7IN5B_V2_HEIGHT);
printf("Trying to connect to wifi\r\n");
printf("[Core 1] Trying to connect to wifi\r\n");
bool connected = wifi_try_auto_connect();
printf("[Core 1] Connected: %d\r\n", connected);
Paint_SelectImage(g_epd_red);
printf("Drawing header\r\n");
printf("[Core 1] Drawing header\r\n");
if (connected) {
Paint_DrawString_EN(10, 10, "What's new today: ...", &Font24, WHITE, RED);
} else {
@@ -106,7 +107,7 @@ static void init_epaper_display() {
// Display the image with both black and red buffers
EPD_7IN5B_V2_Display_Partial(g_epd_red, 0, 0, EPD_7IN5B_V2_WIDTH, EPD_7IN5B_V2_HEIGHT);
printf("e-Paper display ready!\r\n");
printf("[Core 1] e-Paper display ready!\r\n");
}
/**
@@ -172,7 +173,7 @@ static void core1_display_init() {
Paint_DrawString_EN(20, 50 + i*25, msg->entries.entries[i], &Font16, WHITE, BLACK);
y_pos += 25; // Space between entries
} else {
printf("Skipping entry to avoid overflow\n");
printf("[Core 1] Skipping entry to avoid overflow\n");
}
}
// Use partial or full refresh
@@ -192,7 +193,7 @@ void epaper_start_background_thread() {
// Initialize the queue before starting the thread
queue_init(&g_display_queue, sizeof(DisplayMessage*), QUEUE_LENGTH);
printf("Launching e-Paper display init on core 1...\n");
printf("[Core 0] Launching e-Paper display init on core 1...\n");
multicore_launch_core1(core1_display_init);
}
@@ -215,7 +216,7 @@ void epaper_send_update(const char *entry, bool finish_line) {
// Allocate message structure
DisplayMessage *msg = (DisplayMessage *)malloc(sizeof(DisplayMessage));
if (msg == NULL) {
printf("Failed to allocate display message!\n");
printf("[Core 0] Failed to allocate display message!\n");
return;
}