Edzelf / ESP32-Radio

Internet radio based on ESP32, VS1053 and a TFT screen.
GNU General Public License v3.0
975 stars 229 forks source link

Support of Displays with width/height > 255 #146

Open Rainer-G opened 6 years ago

Rainer-G commented 6 years ago

I'm currently trying to get a 320 x 480 touchscreen to work with this ESP32 Radio as I wanted to get rid of the rotary encoder und use IR receiver and touchscreen as the main controls.

I was wondering why display time and display volume did not work correctly and found the problem in the responsible functions. The definition of x-position is only a byte uint8_t. Small problem but changing the definition of pos to unint16_t solves the problem

void displaytime ( const char* str, uint16_t color )
{
  static char oldstr[9] = "........" ;             // For compare
  uint8_t     i ;                                  // Index in strings
  uint8_t     pos = dsp_getwidth() + TIMEPOS ;     // X-position of character

and

void displayvolume()
{
  if ( tft )
  {
    static uint8_t oldvol = 0 ;                         // Previous volume
    uint8_t        newvol ;                             // Current setting
    uint8_t        pos ;                                // Positon of volume indicator

Cheers, Rainer

Rainer-G commented 6 years ago

changes done, many thanks

Rainer-G commented 5 years ago

Hello Ed, working on a 320x480 display, I found an issue with the last code version: You moved the display time-volume-battery functions to the individual display function modules, good idea as it gives more flexibility when using other displays!

It would be helpful. if you can move the #define TIMEPOS from the main code to the function modules as well.

Using bigger font sizes needs different values for this define. If you have it inside the display function modules, it will be independant from changes in the main code.

Many thanks, Rainer