diff --git a/src/driver/simple_display.cpp b/src/driver/simple_display.cpp index 0bda6ca3d..df6bb6b65 100644 --- a/src/driver/simple_display.cpp +++ b/src/driver/simple_display.cpp @@ -136,25 +136,6 @@ static void replace_umlauts(std::string &s) // printf("%s:<< '%s'\n", __func__, s.c_str()); } -static void display(const char *s, bool update_timestamp = true) -{ - int fd = dev_open(); - int len = strlen(s); - if (fd < 0) - return; -printf("%s '%s'\n", __func__, s); - write(fd, s, len); - close(fd); - if (update_timestamp) - { - last_display = time(NULL); - /* increase timeout to ensure that everything is displayed - * the driver displays 5 characters per second */ - if (len > g_info.hw_caps->display_xres) - last_display += (len - g_info.hw_caps->display_xres) / 5; - } -} - CLCD::CLCD() { /* do not show menu in neutrino...,at Line Display true, because there is th GLCD Menu */ @@ -257,11 +238,14 @@ void CLCD::showServicename(std::string name, bool) { if (g_info.hw_caps->display_type == HW_DISPLAY_LED_NUM) return; + servicename = name; + if (mode != MODE_TVRADIO && mode != MODE_AUDIO) return; - replace_umlauts(name); - strncpy(display_text, name.c_str(), sizeof(display_text) - 1); + + replace_umlauts(servicename); + strncpy(display_text, servicename.c_str(), sizeof(display_text) - 1); display_text[sizeof(display_text) - 1] = '\0'; upd_display = true; #if HAVE_ARM_HARDWARE @@ -335,7 +319,7 @@ void CLCD::showTime(bool force) time_t now = time(NULL); if (upd_display) { - display(display_text); + ShowText(display_text); upd_display = false; } else if (power && (force || (showclock && (now - last_display) > 4))) @@ -367,13 +351,15 @@ void CLCD::showTime(bool force) sprintf(timestr, "%02d%02d", hour, minute); else /* pad with spaces on the left side to center the time string */ sprintf(timestr, "%*s%02d:%02d",(g_info.hw_caps->display_xres - 5)/2, "", hour, minute); - display(timestr, false); + ShowText(timestr, false); } else { if (vol_active) + { showServicename(servicename); - vol_active = false; + vol_active = false; + } } last_display = 0; } @@ -402,9 +388,9 @@ void CVFD::showRCLock(int duration) return; } - display(g_Locale->getText(LOCALE_RCLOCK_LOCKED)); + ShowText(g_Locale->getText(LOCALE_RCLOCK_LOCKED)); sleep(duration); - display(display_text); + ShowText(servicename.c_str()); } /* update is default true, the mute code sets it to false @@ -436,7 +422,7 @@ void CLCD::showVolume(const char vol, const bool update) if (g_info.hw_caps->display_type == HW_DISPLAY_LINE_TEXT) sprintf(s,"%.*s", volume*g_info.hw_caps->display_xres/100, "================"); #endif - display(s); + ShowText(s); #if HAVE_ARM_HARDWARE wake_up(); #endif @@ -453,9 +439,7 @@ void CLCD::showMenuText(const int, const char *text, const int, const bool) return; std::string tmp = text; replace_umlauts(tmp); - strncpy(display_text, tmp.c_str(), sizeof(display_text) - 1); - display_text[sizeof(display_text) - 1] = '\0'; - upd_display = true; + ShowText(tmp.c_str()); #if HAVE_ARM_HARDWARE wake_up(); #endif @@ -465,7 +449,9 @@ void CLCD::showAudioTrack(const std::string &, const std::string & title, const { if (mode != MODE_AUDIO) return; - ShowText(title.c_str()); + std::string tmp = title; + replace_umlauts(tmp); + ShowText(tmp.c_str()); #if HAVE_ARM_HARDWARE wake_up(); #endif @@ -492,9 +478,7 @@ void CLCD::setMode(const MODES m, const char * const) showclock = true; power = true; if (g_info.hw_caps->display_type != HW_DISPLAY_LED_NUM) { - strncpy(display_text, servicename.c_str(), sizeof(display_text) - 1); - display_text[sizeof(display_text) - 1] = '\0'; - upd_display = true; + showServicename(servicename); } showTime(); break; @@ -671,7 +655,7 @@ printf("spark_led:%s\n", __func__); #else void CLCD::Clear() { - display(" ", false); + ShowText(" ", false); } #endif @@ -861,6 +845,25 @@ void CLCD::ShowIcon(fp_icon i, bool on) } } +void CVFD::ShowText(const char * str, bool update_timestamp) +{ + int fd = dev_open(); + int len = strlen(str); + if (fd < 0) + return; + printf("%s '%s'\n", __func__, str); + write(fd, str, len); + close(fd); + if (update_timestamp) + { + last_display = time(NULL); + /* increase timeout to ensure that everything is displayed + * the driver displays 5 characters per second */ + if (len > g_info.hw_caps->display_xres) + last_display += (len - g_info.hw_caps->display_xres) / 5; + } +} + void CLCD::setEPGTitle(const std::string) { } diff --git a/src/driver/simple_display.h b/src/driver/simple_display.h index d63701974..6b17daadd 100644 --- a/src/driver/simple_display.h +++ b/src/driver/simple_display.h @@ -213,7 +213,7 @@ class CLCD void ShowDiskLevel(); void Reset() {}; void ShowIcon(fp_icon icon, bool show); - void ShowText(const char *s) { showServicename(std::string(s), true); }; + void ShowText(const char *str, bool update_timestamp = true); ~CLCD(); };