Edzelf/ESP32Radio-V2

displayvolume for LCD1602

h1aji opened this issue · 0 comments

h1aji commented

Hi Ed,

Would you be able to add intermittent volume status appearance into second line for LCD1602. Lets say show it for 3 seconds when changed.
Something like this:

void LCD1602_displayvolume ( uint8_t vol )
{
  static uint8_t   oldvol = 0 ;                       // Previous volume
  uint16_t         pos ;                              // Positon of volume indicator

  dline[1].str = "";

  if ( vol != oldvol )                                // Volume changed?
  {
    dbgprint ( "Update volume to %d", vol ) ;
    oldvol = vol ;                                    // Remember for next compare
    pos = map ( vol, 0, 100, 0, dsp_getwidth() ) ;    // Compute end position on TFT
    for ( int i = 0 ; i < dsp_getwidth() ; i++ )      // Set oldstr to dots
    {
      if ( i <= pos )
      {
        dline[1].str += '\xFF' ;                     // Add block character
      }
      else
      {
        dline[1].str += ' ' ;                         // Or blank sign
      }
    }
    LCD1602_dsp_update_line(1) ;
    delay(3000);
  }
}