From ccf741f0150359ed8573e60adaa72d7ef2ad9094 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Mon, 12 Jan 2015 14:43:52 +0100 Subject: [PATCH] - vfd: fix progress-bar in audio mode; ... ... don't accept periodic changes from infoviewer - vfd: allow volume-bar in menu mode and audio mode --- src/driver/vfd.cpp | 43 +++++++++++++++++++++++++------------------ src/driver/vfd.h | 2 +- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/src/driver/vfd.cpp b/src/driver/vfd.cpp index 697063dcc..459330101 100644 --- a/src/driver/vfd.cpp +++ b/src/driver/vfd.cpp @@ -414,14 +414,18 @@ void CVFD::showVolume(const char vol, const bool force_update) if(!has_lcd) return; ShowIcon(FP_ICON_MUTE, muted); + if(!force_update && vol == volume) return; - 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); 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 (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])) { - //if (g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME] == 0) - { - ShowIcon(FP_ICON_FRAME, true); - int pp; - if(perc == 255) - pp = 0; - else - pp = (int) round((double) perc * (double) 8 / (double) 100); + 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] == 0) { + ShowIcon(FP_ICON_FRAME, true); + int pp; + if(perc == 255) + 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); - if(pp > 8) pp = 8; - if(pp != percentOver) { + if(pp != percentOver) { int i; int j = 0x00000200; for(i = 0; i < pp; i++) { @@ -469,7 +477,6 @@ void CVFD::showPercentOver(const unsigned char perc, const bool /*perform_update j /= 2; } percentOver = pp; - } } } } @@ -533,7 +540,7 @@ void CVFD::showAudioProgress(const unsigned char perc) if (mode != MODE_AUDIO) return; - showPercentOver(perc, false); + showPercentOver(perc, true, MODE_AUDIO); } void CVFD::setMode(const MODES m, const char * const title) diff --git a/src/driver/vfd.h b/src/driver/vfd.h index c09d8aadf..5f1c374a7 100644 --- a/src/driver/vfd.h +++ b/src/driver/vfd.h @@ -124,7 +124,7 @@ class CVFD /** blocks for duration seconds */ void showRCLock(int duration = 2); 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 showAudioTrack(const std::string & artist, const std::string & title, const std::string & album); void showAudioPlayMode(AUDIOMODES m=AUDIO_MODE_PLAY);