# HG changeset patch # User Jan Mulder # Date 1553095450 -3600 # Node ID 2885628ab3ba453ff61cf518df0766021bc032f4 # Parent 05df3b39561558af838ff9b4f6664f123301a647 Bugfix, minor: color the overview customview correctly When using a custom color (from the SYS2 menu, layout), the overview customview was the only one presented in the wrong color. While the fix for this is rather simple (in hindsight), it was a non trivial search trough rather obfuscated code. There is a specific function to set the text color index on this page, but this only worked for a single line text string, that has the color index byte as the very first character. The original author already recognized that this function "could be extended", but left this extension as an exercise to the reader. So, the coloring is fixed by extending the function, and actually using it for the overview customview. Signed-off-by: Jan Mulder diff -r 05df3b395615 -r 2885628ab3ba Discovery/Src/t7.c --- a/Discovery/Src/t7.c Tue Mar 19 15:43:38 2019 +0000 +++ b/Discovery/Src/t7.c Wed Mar 20 16:24:10 2019 +0100 @@ -58,7 +58,7 @@ void t7_miniLiveLogProfile(void); //void t7_clock(void); void t7_logo_OSTC(void); -void t7_colorscheme_mod(char *text); +static void t7_colorscheme_mod(char *text); uint8_t t7_test_customview_warnings(void); void t7_show_customview_warnings(void); @@ -2639,14 +2639,13 @@ return lineCount; } -/* could be extended to search for \020 inside - */ -void t7_colorscheme_mod(char *text) -{ - if((text[0] == '\020') && !GFX_is_colorschemeDiveStandard()) - { - text[0] = '\027'; - } +static void t7_colorscheme_mod(char *text) { + char *p = text; + while (*p) { + if ((*p == '\020') && !GFX_is_colorschemeDiveStandard()) + *p = '\027'; + p++; + } } @@ -3106,6 +3105,7 @@ text[textpointer++] = '\t'; textpointer += snprintf(&text[textpointer],10,"\020%i'", pDecoinfoFuture->output_time_to_surface_seconds / 60); text[textpointer++] = 0; + t7_colorscheme_mod(text); GFX_write_string(&FontT42, &t7cY0free, text, 1); }