From ce1a97e2e9f433085ef7959d939fba9aa8723bce Mon Sep 17 00:00:00 2001 From: Ivaylo Ivanov Date: Wed, 27 May 2026 16:09:06 +0000 Subject: [PATCH] lib: simplefb: name the text top-padding constant The value 5 appeared bare in two places: simplefb.c (when text wraps past the bottom of the screen) and debug.c (initial y position for the printk overlay). Replace both with FB_TEXT_TOP_PADDING defined once in simplefb.h. --- include/lib/simplefb.h | 2 ++ lib/debug/debug.c | 2 +- lib/simplefb/simplefb.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/lib/simplefb.h b/include/lib/simplefb.h index 56f0acb..78e4b38 100644 --- a/include/lib/simplefb.h +++ b/include/lib/simplefb.h @@ -17,6 +17,8 @@ typedef struct _color { unsigned char a; } color; +#define FB_TEXT_TOP_PADDING 5 + typedef enum { FB_FORMAT_RGB888, FB_FORMAT_ARGB8888, diff --git a/lib/debug/debug.c b/lib/debug/debug.c index ed5a682..38e54ce 100644 --- a/lib/debug/debug.c +++ b/lib/debug/debug.c @@ -67,7 +67,7 @@ static inline void uart_output(const char *prefix, const char *message) static inline void fb_output(const char *prefix, const char *message, color text_color) { #ifdef CONFIG_SIMPLE_FB - const int y_pos = 5; + const int y_pos = FB_TEXT_TOP_PADDING; const int prefix_width = strlen(prefix) * FONTW * get_font_scale_factor(); __simplefb_raw_print(prefix, 0, y_pos, text_color); diff --git a/lib/simplefb/simplefb.c b/lib/simplefb/simplefb.c index fd2c153..8d8a625 100644 --- a/lib/simplefb/simplefb.c +++ b/lib/simplefb/simplefb.c @@ -128,7 +128,7 @@ void __simplefb_raw_print(const char *text, int text_x, int text_y, if (current_y >= fb_info->height - SCALED_FONTH) { clean_fbmem((char*)fb_info->address, fb_info->width, fb_info->height, fb_info->stride); current_x = text_x; - current_y = 5; + current_y = FB_TEXT_TOP_PADDING; } int ix = font_index(text[i]);