working by line

This commit is contained in:
Adolfo Reyna
2025-12-09 11:18:44 -05:00
parent 2738c4ac3d
commit b200ba075b
2 changed files with 105 additions and 13 deletions

View File

@@ -144,14 +144,20 @@ void send_display_update(const char *entry, bool finish_line) {
if (g_force_full_refresh) {
printf("[Core 0] Forcing full refresh this update\n");
g_force_full_refresh = false; // Reset flag after setting it in message
// Full text area refresh
msg->xstart = 0;
msg->ystart = 50; // Start below the header
msg->xend = 800; // Full width
msg->yend = 480; // Full height from header onwards
} else {
// Partial refresh of ONLY the current line
msg->xstart = 0;
msg->ystart = 50 + (g_entry_list.count * 25);
msg->xend = 800;
msg->yend = msg->ystart + 25;
}
// Setup partial refresh region (text area at top of display)
msg->xstart = 0;
msg->ystart = 50; // Start below the header
msg->xend = 800; // Full width
msg->yend = 480; // Full height from header onwards
// Send message pointer to core 1 if FIFO has space
if (multicore_fifo_wready()) {
multicore_fifo_push_blocking((uint32_t)msg);
@@ -207,11 +213,15 @@ void core1_display_init() {
Paint_SelectImage(g_epd_image);
Paint_Clear(WHITE);
// Calculate offset for partial refresh
UBYTE *image_ptr = g_epd_image + (msg->ystart * (EPD_7IN5B_V2_WIDTH / 8));
if(!msg->use_partial){
// for loop 5 times display white partial
int i = 0;
for(i = 0; i < 1; i++){
EPD_7IN5B_V2_Display_Partial(g_epd_image, msg->xstart, msg->ystart, msg->xend, msg->yend);
EPD_7IN5B_V2_Display_Partial(image_ptr, msg->xstart, msg->ystart, msg->xend, msg->yend);
}
}
@@ -221,7 +231,7 @@ void core1_display_init() {
int start_index = msg->entries.count > 10 ? msg->entries.count - 10 : 0;
for (int i = start_index; i < msg->entries.count; i++) {
if (y_pos + 25 < 480) { //Don't draw beyond screen
Paint_DrawString_EN(20, i*25, msg->entries.entries[i], &Font16, WHITE, BLACK);
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");
@@ -229,7 +239,7 @@ void core1_display_init() {
}
// Use partial or full refresh
printf("[Core 1] Using partial refresh\n");
EPD_7IN5B_V2_Display_Partial(g_epd_image, msg->xstart, msg->ystart, msg->xend, msg->yend);
EPD_7IN5B_V2_Display_Partial(image_ptr, msg->xstart, msg->ystart, msg->xend, msg->yend);
}
// Free the message (it was allocated by core 0)
@@ -418,10 +428,8 @@ static void process_kbd_report(hid_keyboard_report_t const *report) {
// Update OLED
if (g_display_manager) g_display_manager->refresh(g_input_buffer, g_last_echo);
// Update e-Paper ONLY if space (per user request)
if (ch == ' ') {
send_display_update(g_input_buffer, false);
}
// Update e-Paper on every keystroke
send_display_update(g_input_buffer, false);
}
}
}