Monday, June 19, 2023

Drawing on the LCD screen to test functions I need - part 8

FONT SIZE AND NAME LENGTH EXPERIMENTATIONS

The 8 point and 12 point fonts are far too small on the screen. If I go with the 16 point font, I can still get 40 characters across the screen from left to right which is an acceptable tradeoff between visibility and useful length of the name. I am fine tuning the user interface around this font size. 

ORIENTATION PROBLEM AND CORRECTION

The sequence of initialization commands sent by the demonstration library (from Waveshare provided with the LCD Module) includes two interesting ones that are the source of my issues. The memory access sequence is set by:

Command     0x36 Memory access control

Parameter    0x28 MV - row column exchange and BGR - reversed color order

This swaps X and Y, thus my carefully designed coordinates are instead oriented the wrong way.  Ichanged this parameter to add MX as well, which works properly. The color order matches how we transmit the 16 bit pixel color value, 5 bits blue, 6 bits green and 5 bits of red intensity. 

I also note that this command is issued to invert the pixel color when displayed from memory. 

Command    0x21    Display Inversion On - pixel values reversed

I don't understand why this is working but I get satisfactory results so I will leave it in for now. 

BITMAP DISPLAY RESULTS

My arrow bitmaps appear to use some scan method that produces an odd output. The comment blocks in the Waveshare library state that bitmaps must be done with progressive scan. I guess I have some more reading to do in order to understand and then correct my bitmaps (or the display program). 

NEW USER INTERFACE LAYOUT

I will use the entire 480 pixel width of the screen to display each file name, thus the arrows and button must be down at the bottom of the screen. With a height of 16 pixels per character for the font I am using, I can no longer fit 20 names per screen as I originally chose. 

The screen is 320 pixels high and I need to reserve space to display the arrow bitmaps and the select button. My current bitmaps are 80 pixels in height, which leaves me 240 pixels for file names. Adding in a little margin, I decided upon 13 files per screen. 

This requires changes to the code that draws the screen as well as the code that implements the up and down arrow movements. I am parameterizing all this as I go along, pulling those choices up into the project header file as defined constants. 


No comments:

Post a Comment