simple_display: rename display() to ShowText() ... as in vfd.cpp

Origin commit data
------------------
Branch: ni/coolstream
Commit: a0749f39f1
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-11-13 (Mon, 13 Nov 2017)

Origin message was:
------------------
- simple_display: rename display() to ShowText() ... as in vfd.cpp

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2017-11-13 10:10:45 +01:00
parent 389d75336a
commit 3b5f113943
2 changed files with 35 additions and 38 deletions

View File

@@ -131,25 +131,6 @@ static void replace_umlauts(std::string &s)
// printf("%s:<< '%s'\n", __func__, s.c_str()); // 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() CLCD::CLCD()
{ {
/* do not show menu in neutrino...,at Line Display true, because there is th GLCD Menu */ /* do not show menu in neutrino...,at Line Display true, because there is th GLCD Menu */
@@ -262,11 +243,14 @@ void CLCD::showServicename(std::string name, bool)
{ {
if (g_info.hw_caps->display_type == HW_DISPLAY_LED_NUM) if (g_info.hw_caps->display_type == HW_DISPLAY_LED_NUM)
return; return;
servicename = name; servicename = name;
if (mode != MODE_TVRADIO && mode != MODE_AUDIO) if (mode != MODE_TVRADIO && mode != MODE_AUDIO)
return; 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'; display_text[sizeof(display_text) - 1] = '\0';
upd_display = true; upd_display = true;
#if HAVE_ARM_HARDWARE #if HAVE_ARM_HARDWARE
@@ -340,7 +324,7 @@ void CLCD::showTime(bool force)
time_t now = time(NULL); time_t now = time(NULL);
if (upd_display) if (upd_display)
{ {
display(display_text); ShowText(display_text);
upd_display = false; upd_display = false;
} }
else if (power && (force || (showclock && (now - last_display) > 4))) else if (power && (force || (showclock && (now - last_display) > 4)))
@@ -372,13 +356,13 @@ void CLCD::showTime(bool force)
sprintf(timestr, "%02d%02d", hour, minute); sprintf(timestr, "%02d%02d", hour, minute);
else /* pad with spaces on the left side to center the time string */ 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); sprintf(timestr, "%*s%02d:%02d",(g_info.hw_caps->display_xres - 5)/2, "", hour, minute);
display(timestr, false); ShowText(timestr, false);
} }
else else
{ {
if (vol_active) if (vol_active)
{ {
display(display_text); showServicename(servicename);
vol_active = false; vol_active = false;
} }
} }
@@ -409,9 +393,9 @@ void CLCD::showRCLock(int duration)
return; return;
} }
display(g_Locale->getText(LOCALE_RCLOCK_LOCKED)); ShowText(g_Locale->getText(LOCALE_RCLOCK_LOCKED));
sleep(duration); sleep(duration);
display(servicename.c_str()); ShowText(servicename.c_str());
} }
/* update is default true, the mute code sets it to false /* update is default true, the mute code sets it to false
@@ -443,7 +427,7 @@ void CLCD::showVolume(const char vol, const bool update)
if (g_info.hw_caps->display_type == HW_DISPLAY_LINE_TEXT) if (g_info.hw_caps->display_type == HW_DISPLAY_LINE_TEXT)
sprintf(s,"%.*s", volume*g_info.hw_caps->display_xres/100, "================"); sprintf(s,"%.*s", volume*g_info.hw_caps->display_xres/100, "================");
#endif #endif
display(s); ShowText(s);
#if HAVE_ARM_HARDWARE #if HAVE_ARM_HARDWARE
wake_up(); wake_up();
#endif #endif
@@ -460,9 +444,7 @@ void CLCD::showMenuText(const int, const char *text, const int, const bool)
return; return;
std::string tmp = text; std::string tmp = text;
replace_umlauts(tmp); replace_umlauts(tmp);
strncpy(display_text, tmp.c_str(), sizeof(display_text) - 1); ShowText(tmp.c_str());
display_text[sizeof(display_text) - 1] = '\0';
upd_display = true;
#if HAVE_ARM_HARDWARE #if HAVE_ARM_HARDWARE
wake_up(); wake_up();
#endif #endif
@@ -474,9 +456,7 @@ void CLCD::showAudioTrack(const std::string &, const std::string & title, const
return; return;
std::string tmp = title; std::string tmp = title;
replace_umlauts(tmp); replace_umlauts(tmp);
strncpy(display_text, tmp.c_str(), sizeof(display_text) - 1); ShowText(tmp.c_str());
display_text[sizeof(display_text) - 1] = '\0';
upd_display = true;
#if HAVE_ARM_HARDWARE #if HAVE_ARM_HARDWARE
wake_up(); wake_up();
#endif #endif
@@ -504,9 +484,7 @@ void CLCD::setMode(const MODES m, const char * const)
showclock = true; showclock = true;
power = true; power = true;
if (g_info.hw_caps->display_type != HW_DISPLAY_LED_NUM) { if (g_info.hw_caps->display_type != HW_DISPLAY_LED_NUM) {
strncpy(display_text, servicename.c_str(), sizeof(display_text) - 1); showServicename(servicename);
display_text[sizeof(display_text) - 1] = '\0';
upd_display = true;
} }
showTime(); showTime();
if (g_settings.lcd_info_line) if (g_settings.lcd_info_line)
@@ -685,7 +663,7 @@ void CLCD::Clear()
#else #else
void CLCD::Clear() void CLCD::Clear()
{ {
display(" ", false); ShowText(" ", false);
} }
#endif #endif
@@ -879,6 +857,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) void CLCD::setEPGTitle(const std::string)
{ {
} }

View File

@@ -213,7 +213,7 @@ class CLCD
void ShowDiskLevel(); void ShowDiskLevel();
void Reset() {}; void Reset() {};
void ShowIcon(fp_icon icon, bool show); 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(); ~CLCD();
}; };