Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code improvements: displayvolume always redraws Volume-Bar #190

Open
JOliverasC opened this issue Aug 4, 2020 · 0 comments
Open

Code improvements: displayvolume always redraws Volume-Bar #190

JOliverasC opened this issue Aug 4, 2020 · 0 comments

Comments

@JOliverasC
Copy link

@Edzelf
Firts: it's an awsome project, congratulations and thanks for sharing
I realised that displayvolume is always redrawing the bar and the code should be something similar to (Changes in bold)

void displayvolume()
{
#if defined ( USETFT )
static uint8_t oldvol = 0 ; // Previous volume
uint8_t pos ; // Positon of volume indicator
uint8_t vol = 0 ;

vol = vs1053player.getVolume();
if ( vol != oldvol ) // before ..if ( vs1053player.getVolume() != oldvol )
{
pos = map ( vs1053player.getVolume(), 0, 100, 0, 160 ) ;
tft.fillRect ( 0, 126, pos, 2, RED ) ; // Paint red part
tft.fillRect ( pos, 126, 160 - pos, 2, GREEN ) ; // Paint green part
oldvol = vol;
}
#endif
}

@JOliverasC JOliverasC changed the title Code improvements: displayvolume always redraw Volume-Bar Code improvements: displayvolume always redraws Volume-Bar Aug 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant