Saturday, June 24, 2023

User interface test verification part 1

UP AND DOWN ROCKER SWITCH PRESSES CHANGE SCREEN APPROPRIATELY

I built up sequences of up and down presses in order to validate the operation I expected. The concept is that we see a list of up to 13 file names on the screen with one of them highlighted with a gray background. The arrows move the highlighting up and down the list.

Since we will have more than 13 virtual cartridge files on the SD card, we also have to scroll when we move beyond the 13 that are currently displayed. If the last line is highlighted and we push down, we would display the next file names (up to 13) and highlight the first one. If we are have highlighted the first file name on a list and push up, then we will display the prior up to 13 file names with the last line highlighted. 

This has to deal with the cases where we are at the first line, push up, but there are no more files above this in the list. It has to deal with the case that we are trying to move down from the last line when there are no more filenames in the list below it. There are also cases to consider when we don't have a full 13 filenames after scrolling, either displaying a short list for a down scroll or displaying the first 13 with an up scroll if are reaching the beginning of the list.

Finally, we disable scrolling with the up and down arrows if the highlighted line on the screen is also selected - cyan background and red lettering instead of gray background/black text. This means that we have loaded this file into the system and it can be accessed when the disk drive spins up. In that case we don't want to scroll the selected file off the screen so when we are at the top or bottom line, the up or down buttons do nothing. The file moves so that we see 0 to 12 files before it and 0 to 12 files after it on the screen - depending on which line we have moved this filename to. If it is at the third line, for instance, then we see the two files before the selected one, our selection, and then the next ten file names on the screen. 

If the user wants to view other file names outside of the near neighbors of the selected one, they have to push the Selection Toggle pushbutton in order to unselect the file before we can provide scrolling. 

SPEED OF SCREEN DRAW AND OPTIMIZATION

The redraw of the screen is a bit pokey and potentially irritating. I first attempted to bring up the SPI speed as much as possible. While the documentation with the LCD Module says that it has been tested up to 60MHz, even at 40MHz the display can't keep up and simply flickers a bit. Whether that is a wire quality issue, an issue with my PIO altered LCD Select and LCD Data/Command lines, or whether the module really can't keep up, the simplest solution was to begin backing off speed until I achieved reliable results. 

The speed of the SPI is set by a divisor that slows an internal 200MHz clock down. The divisor must be an even number, per the specifications of the SPI module, thus my choices are even integers larger than 5 (40MHz). The choices are 33.33MHz, 25MHz, 20MHz and slower rates. I knew that 25MHz worked fine so I tried 33.333MHz which appears to be working reliably. 

The process for drawing the screen involves a clear operation, writing 307,200 bytes of black to the screen, then writing the 13 lines of text. The screen clearing takes about 75 milliseconds thus overall we are looking at a fraction of a second at this speed and more than a second at the prior rate I was using. Even if I have to use 25MHz, if any flakey behaviors surface, it will still slash 25% off of the time to draw the screen after every up or down press. 

I realized that I could optimize the redraw, having one time filled the screen with black pixels. Moving the highlighting to a different line only requires me to redraw the previous and new lines, leaving all the other lines on the screen alone. Scrolling can be done with a clear of the screen then drawing all 13 lines. I implemented and tested this. 

I did find squirrely results at 33+MHz so we drop back to 25MHz for production. I have some annoying issues I am still chasing to get the screen to look and respond just right, but will move on to testing this tomorrow.

No comments:

Post a Comment