mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +02:00
- simple_display: rename display() to ShowText() ... as in vfd.cpp
Conflicts: src/driver/simple_display.cpp Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
@@ -136,25 +136,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 */
|
||||||
@@ -257,11 +238,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
|
||||||
@@ -335,7 +319,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)))
|
||||||
@@ -367,13 +351,15 @@ 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)
|
||||||
|
{
|
||||||
showServicename(servicename);
|
showServicename(servicename);
|
||||||
vol_active = false;
|
vol_active = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
last_display = 0;
|
last_display = 0;
|
||||||
}
|
}
|
||||||
@@ -402,9 +388,9 @@ void CVFD::showRCLock(int duration)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
display(g_Locale->getText(LOCALE_RCLOCK_LOCKED));
|
ShowText(g_Locale->getText(LOCALE_RCLOCK_LOCKED));
|
||||||
sleep(duration);
|
sleep(duration);
|
||||||
display(display_text);
|
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
|
||||||
@@ -436,7 +422,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
|
||||||
@@ -453,9 +439,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
|
||||||
@@ -465,7 +449,9 @@ void CLCD::showAudioTrack(const std::string &, const std::string & title, const
|
|||||||
{
|
{
|
||||||
if (mode != MODE_AUDIO)
|
if (mode != MODE_AUDIO)
|
||||||
return;
|
return;
|
||||||
ShowText(title.c_str());
|
std::string tmp = title;
|
||||||
|
replace_umlauts(tmp);
|
||||||
|
ShowText(tmp.c_str());
|
||||||
#if HAVE_ARM_HARDWARE
|
#if HAVE_ARM_HARDWARE
|
||||||
wake_up();
|
wake_up();
|
||||||
#endif
|
#endif
|
||||||
@@ -492,9 +478,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();
|
||||||
break;
|
break;
|
||||||
@@ -671,7 +655,7 @@ printf("spark_led:%s\n", __func__);
|
|||||||
#else
|
#else
|
||||||
void CLCD::Clear()
|
void CLCD::Clear()
|
||||||
{
|
{
|
||||||
display(" ", false);
|
ShowText(" ", false);
|
||||||
}
|
}
|
||||||
#endif
|
#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)
|
void CLCD::setEPGTitle(const std::string)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@@ -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();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user