News:

;) This forum is the property of Proton software developers

Main Menu

Blanking the rest of the line on a ILI9341 display

Started by John Drew, May 01, 2021, 07:57 AM

Previous topic - Next topic

John Drew

After many experiments clearing unwanted text it became a nightmare of guess work using spaces to wipe the rest of the line. It was also expensive in the use of memory. Spaces are much thinner than characters so counting characters doesn't work. This little routine will blank the rest of a line so that when the first string is longer than the second the unwanted remaining text is overwritten with background colour and everything looks as it should. Besides, it uses much less memory. The routine assumes you are using Flosi's ILI9341 code for access to the cursor position.
John

proc MakeClear()                          'call this to black out the rest of the line
dim Width as word
     width = 240-wxstart
     wink = black
     wcolor = black
     wpaper = black
     XBlock(wxstart,wystart,width,24)     'my line are 24 pixels high
     wink = white
EndProc

TimB


Can I add another way and that is to convert another wider char to a space.

Example:- in some code I have I only need numbers so do not load the whole charset. Just 1-0. What I do is to include one extra char in my case its "/" that I convert to a space. So now the char rang is /-0. I edited the / char to make it a space and obviously it larger than " " so erases a lot more screen.
When I want to erase using a space I can use print "/"

John Drew

Thanks Tim, your solution would be more generally useful. I did think about that as a way but didn't know how to find and change the item in the font table.

There's now a good number of solutions in this thread. Hopefully they'll help others too.
John

TimB

In case its of some use

' Y scan Font data For _RobotoBold_15

Dim Roboto_15 As Code = 15, 2,_ ' Font Height, Amount of bytes per Y
  $1C, $00,_ ' 1
  $33, $00,_ ' 2
  $4A, $00,_ ' 3
  $61, $00,_ ' 4
  $78, $00,_ ' 5
  $8F, $00,_ ' 6
  $A6, $00,_ ' 7
  $BD, $00,_ ' 8
  $D4, $00,_ ' 9
  $EB, $00,_ ' 10
  $02, $01,_ ' 11
  $19, $01,_ ' 12
  $30, $01,_ ' 13
  $47, $01,_ ' 14
'
' Code For -
'
  $0B, $00, $00, $80, $01, $80, $01, $80, $01, $80, $01, $80, $01, $80, $01, $00, $00, $00, $00, $00, $00, $00, $00,_
'
' Code For .
'
  $0B, $00, $00, $00, $10, $00, $38, $00, $38, $00, $10, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_
'
' Code For / THE DATA BELOW WAS CHANGED TO $00 SO IF YOU PRINT "/" YOU PRINT A LARGE SPACE
'
  $0B, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,_
'
' Code For 0
'
  $0B, $00, $00, $FC, $0F, $FE, $1F, $FF, $3F, $03, $30, $03, $30, $03, $30, $FF, $3F, $FE, $1F, $FC, $0F, $00, $00,_
'
' Code For 1

John Drew

Tim, is the first character the width? Is there an article somewhere that describes how the fonts are structured?
John