- vfd: fix progress-bar in audio mode; ...

... don't accept periodic changes from infoviewer

- vfd: allow volume-bar in menu mode and audio mode
This commit is contained in:
svenhoefer
2015-01-12 14:43:52 +01:00
parent 2b5e7b5ba3
commit ccf741f015
2 changed files with 26 additions and 19 deletions

View File

@@ -414,14 +414,18 @@ void CVFD::showVolume(const char vol, const bool force_update)
if(!has_lcd) return; if(!has_lcd) return;
ShowIcon(FP_ICON_MUTE, muted); ShowIcon(FP_ICON_MUTE, muted);
if(!force_update && vol == volume) if(!force_update && vol == volume)
return; return;
volume = vol; volume = vol;
wake_up();
ShowIcon(FP_ICON_FRAME, true);
if ((mode == MODE_TVRADIO) && g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME]) { bool allowed_mode = (mode == MODE_TVRADIO || mode == MODE_AUDIO || mode == MODE_MENU_UTF8);
if (!allowed_mode)
return;
if (g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME] == 1) {
wake_up();
ShowIcon(FP_ICON_FRAME, true);
int pp = (int) round((double) vol * (double) 8 / (double) 100); int pp = (int) round((double) vol * (double) 8 / (double) 100);
if(pp > 8) pp = 8; if(pp > 8) pp = 8;
@@ -442,22 +446,26 @@ printf("CVFD::showVolume: %d, bar %d\n", (int) vol, pp);
} }
} }
void CVFD::showPercentOver(const unsigned char perc, const bool /*perform_update*/) void CVFD::showPercentOver(const unsigned char perc, const bool /*perform_update*/, const MODES origin)
{ {
if(!has_lcd) return; if(!has_lcd) return;
if (mode == MODE_AUDIO && origin != MODE_AUDIO) // exclusive access for audio mode
return;
if (((mode == MODE_TVRADIO) || (mode == MODE_AUDIO) || (mode == MODE_MENU_UTF8)) && !(g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME])) { bool allowed_mode = (mode == MODE_TVRADIO || mode == MODE_AUDIO || mode == MODE_MENU_UTF8);
//if (g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME] == 0) if (!allowed_mode)
{ return;
ShowIcon(FP_ICON_FRAME, true);
int pp; if (g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME] == 0) {
if(perc == 255) ShowIcon(FP_ICON_FRAME, true);
pp = 0; int pp;
else if(perc == 255)
pp = (int) round((double) perc * (double) 8 / (double) 100); pp = 0;
else
pp = (int) round((double) perc * (double) 8 / (double) 100);
if(pp > 8) pp = 8;
//printf("CVFD::showPercentOver: %d, bar %d\n", (int) perc, pp); //printf("CVFD::showPercentOver: %d, bar %d\n", (int) perc, pp);
if(pp > 8) pp = 8; if(pp != percentOver) {
if(pp != percentOver) {
int i; int i;
int j = 0x00000200; int j = 0x00000200;
for(i = 0; i < pp; i++) { for(i = 0; i < pp; i++) {
@@ -469,7 +477,6 @@ void CVFD::showPercentOver(const unsigned char perc, const bool /*perform_update
j /= 2; j /= 2;
} }
percentOver = pp; percentOver = pp;
}
} }
} }
} }
@@ -533,7 +540,7 @@ void CVFD::showAudioProgress(const unsigned char perc)
if (mode != MODE_AUDIO) if (mode != MODE_AUDIO)
return; return;
showPercentOver(perc, false); showPercentOver(perc, true, MODE_AUDIO);
} }
void CVFD::setMode(const MODES m, const char * const title) void CVFD::setMode(const MODES m, const char * const title)

View File

@@ -124,7 +124,7 @@ class CVFD
/** blocks for duration seconds */ /** blocks for duration seconds */
void showRCLock(int duration = 2); void showRCLock(int duration = 2);
void showVolume(const char vol, const bool perform_update = true); void showVolume(const char vol, const bool perform_update = true);
void showPercentOver(const unsigned char perc, const bool perform_update = true); void showPercentOver(const unsigned char perc, const bool perform_update = true, const MODES origin = MODE_TVRADIO);
void showMenuText(const int position, const char * text, const int highlight = -1, const bool utf_encoded = false); void showMenuText(const int position, const char * text, const int highlight = -1, const bool utf_encoded = false);
void showAudioTrack(const std::string & artist, const std::string & title, const std::string & album); void showAudioTrack(const std::string & artist, const std::string & title, const std::string & album);
void showAudioPlayMode(AUDIOMODES m=AUDIO_MODE_PLAY); void showAudioPlayMode(AUDIOMODES m=AUDIO_MODE_PLAY);