changeset 1029:e938901f6386 GasConsumption

Text editfield redraw string: The size of characters may vary from letter to letter. This caused the edit string to be partly overwritten. To avoid this the following ltters are now rewritten in case the current letter is changed.
author Ideenmodellierer
date Sun, 07 Sep 2025 20:44:35 +0200
parents 3d9552e4997c
children 2af07aa38531
files Common/CPU1-F429.ld Discovery/Src/tMenuEdit.c
diffstat 2 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Common/CPU1-F429.ld	Sun Sep 07 19:08:43 2025 +0200
+++ b/Common/CPU1-F429.ld	Sun Sep 07 20:44:35 2025 +0200
@@ -208,7 +208,7 @@
     /* Define Known Address for Each Font */
     /* Flash Sector 23 is protected (bootloader font + image) => use end of sector 22 */
 
-.lower_fonts 	0x080A0000  : {
+.lower_fonts 	0x080AA000  : {
 	 *(.lower_fonts.image_data_*)
 	 
 	 *(.lower_fonts.*) 
--- a/Discovery/Src/tMenuEdit.c	Sun Sep 07 19:08:43 2025 +0200
+++ b/Discovery/Src/tMenuEdit.c	Sun Sep 07 20:44:35 2025 +0200
@@ -551,7 +551,10 @@
 void mark_new_digit_of_actual_id_block_and_subBlock(void)
 {
     char oneCharText[2];
+    char text[10];
     uint16_t positionOffset;
+    uint8_t index = 0;
+    uint8_t textPos = 0;
 
     if(event[actualevid].callerID != ident[actualId].callerID)
         return;
@@ -563,6 +566,19 @@
         positionOffset = GFX_return_offset(ident[actualId].fontUsed, ident[actualId].newText, ident[actualId].begin[block] + subBlockPosition);
         write_content( ident[actualId].coord[0] + positionOffset, ident[actualId].coord[1], ident[actualId].coord[2], ident[actualId].fontUsed, oneCharText, CLUT_MenuEditDigit);
     }
+    if(ident[actualId].maintype == FIELD_TEXT)		/* letter width may change from character to character => output end of string */
+    {
+    	if(block + 1 < 8)
+    	{
+			for(index = block + 1; index < 8; index++)
+			{
+				text[textPos++] = ident[actualId].newText[ident[actualId].begin[index] + 0];
+			}
+			text[textPos] = 0;
+		    positionOffset = GFX_return_offset(ident[actualId].fontUsed, ident[actualId].newText, ident[actualId].begin[block + 1] + subBlockPosition);
+			write_content( ident[actualId].coord[0] + positionOffset, ident[actualId].coord[1], ident[actualId].coord[2], ident[actualId].fontUsed, text, CLUT_MenuEditFieldSelected);
+    	}
+    }
 }