From 8d805be0e6a67ea0441a7ea0d90bf4b85ec4e68c Mon Sep 17 00:00:00 2001 From: DiSlord Date: Sun, 16 May 2021 08:15:08 +0300 Subject: [PATCH] Use lcd_printf for debug screen log --- main.c | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/main.c b/main.c index a6cf428..c68d48f 100644 --- a/main.c +++ b/main.c @@ -2354,24 +2354,23 @@ void hard_fault_handler_c(uint32_t *sp) static char buf[96]; ili9341_set_background(LCD_BG_COLOR); ili9341_set_foreground(LCD_FG_COLOR); - - plot_printf(buf, sizeof(buf), "SP 0x%08x", (uint32_t)sp);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT); - plot_printf(buf, sizeof(buf), "R0 0x%08x", r0);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT); - plot_printf(buf, sizeof(buf), "R1 0x%08x", r1);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT); - plot_printf(buf, sizeof(buf), "R2 0x%08x", r2);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT); - plot_printf(buf, sizeof(buf), "R3 0x%08x", r3);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT); - plot_printf(buf, sizeof(buf), "R4 0x%08x", r4);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT); - plot_printf(buf, sizeof(buf), "R5 0x%08x", r5);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT); - plot_printf(buf, sizeof(buf), "R6 0x%08x", r6);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT); - plot_printf(buf, sizeof(buf), "R7 0x%08x", r7);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT); - plot_printf(buf, sizeof(buf), "R8 0x%08x", r8);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT); - plot_printf(buf, sizeof(buf), "R9 0x%08x", r9);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT); - plot_printf(buf, sizeof(buf), "R10 0x%08x", r10);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT); - plot_printf(buf, sizeof(buf), "R11 0x%08x", r11);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT); - plot_printf(buf, sizeof(buf), "R12 0x%08x", r12);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT); - plot_printf(buf, sizeof(buf), "LR 0x%08x", lr);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT); - plot_printf(buf, sizeof(buf), "PC 0x%08x", pc);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT); - plot_printf(buf, sizeof(buf), "PSR 0x%08x", psr);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT); + lcd_printf(x, y+=FONT_STR_HEIGHT, "SP 0x%08x", (uint32_t)sp); + lcd_printf(x, y+=FONT_STR_HEIGHT, "R0 0x%08x", r0); + lcd_printf(x, y+=FONT_STR_HEIGHT, "R1 0x%08x", r1); + lcd_printf(x, y+=FONT_STR_HEIGHT, "R2 0x%08x", r2); + lcd_printf(x, y+=FONT_STR_HEIGHT, "R3 0x%08x", r3); + lcd_printf(x, y+=FONT_STR_HEIGHT, "R4 0x%08x", r4); + lcd_printf(x, y+=FONT_STR_HEIGHT, "R5 0x%08x", r5); + lcd_printf(x, y+=FONT_STR_HEIGHT, "R6 0x%08x", r6); + lcd_printf(x, y+=FONT_STR_HEIGHT, "R7 0x%08x", r7); + lcd_printf(x, y+=FONT_STR_HEIGHT, "R8 0x%08x", r8); + lcd_printf(x, y+=FONT_STR_HEIGHT, "R9 0x%08x", r9); + lcd_printf(x, y+=FONT_STR_HEIGHT, "R10 0x%08x", r10); + lcd_printf(x, y+=FONT_STR_HEIGHT, "R11 0x%08x", r11); + lcd_printf(x, y+=FONT_STR_HEIGHT, "R12 0x%08x", r12); + lcd_printf(x, y+=FONT_STR_HEIGHT, "LR 0x%08x", lr); + lcd_printf(x, y+=FONT_STR_HEIGHT, "PC 0x%08x", pc); + lcd_printf(x, y+=FONT_STR_HEIGHT, "PSR 0x%08x", psr); #ifdef ENABLE_THREADS_COMMAND thread_t *tp; tp = chRegFirstThread(); @@ -2385,11 +2384,10 @@ void hard_fault_handler_c(uint32_t *sp) #else uint32_t stklimit = 0U; #endif - plot_printf(buf, sizeof(buf), "%08x|%08x|%08x|%08x|%4u|%4u|%9s|%12s", + lcd_printf(buf, x, y+=FONT_STR_HEIGHT, "%08x|%08x|%08x|%08x|%4u|%4u|%9s|%12s", stklimit, (uint32_t)tp->ctx.sp, max_stack_use, (uint32_t)tp, (uint32_t)tp->refs - 1, (uint32_t)tp->prio, states[tp->state], tp->name == NULL ? "" : tp->name); - ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT); tp = chRegNextThread(tp); } while (tp != NULL); #endif