Skip to content

Commit

Permalink
simple_display.cpp: fix LED NUM for H7 and BRE2ZE4K
Browse files Browse the repository at this point in the history
  • Loading branch information
GetAway1 authored and vanhofen committed Jul 16, 2020
1 parent e4f379f commit 4e2538d
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 37 deletions.
7 changes: 4 additions & 3 deletions data/locale/deutsch.locale
Expand Up @@ -1188,6 +1188,7 @@ lcd4l_support_on ein
lcd4l_weather Wetter im Standby-Modus
lcd_info_line Zeige in Infozeile
lcd_info_line_channel Kanalname
lcd_info_line_channel_no Kanalnummer
lcd_info_line_clock Uhrzeit
lcdcontroler.brightness Normalbetrieb
lcdcontroler.brightnessdeepstandby Deep-Standby
Expand Down Expand Up @@ -1842,11 +1843,11 @@ menu.hint_vfd_brightnessdeepstandby Definiert die Helligkeit im Deep-Standby
menu.hint_vfd_brightnessdim Definiert den Wert für das Dimmen des Display nach Ablauf der eingestellten Zeit
menu.hint_vfd_brightnessstandby Definiert die Helligkeit im Standby-Modus
menu.hint_vfd_defaults Zurücksetzen der Helligkeitswerte auf die Standardeinstellungen
menu.hint_vfd_dimtime Geben Sie einen Wert in Sekunden ein, nachdem sich das Display automatisch auf den gewünschten Wert dimmt
menu.hint_vfd_dimtime Zeit in Sekunden, nachdem sich das Display autom. im Normalbetrieb auf den gewünschten Wert dimmt
menu.hint_vfd_infoline Wählen Sie, was in der Infozeile angezeigt werden soll
menu.hint_vfd_notify_rclock Zeigt eine Meldung im Display, wenn bei gesperrter Fernbedienung eine Taste gedrückt wird
menu.hint_vfd_scroll Laufschrift im Display ein- oder ausschalten
menu.hint_vfd_statusline Wählen Sie, was in der Statuszeile angezeigt werden soll
menu.hint_vfd_statusline Wählen Sie, was in der Statuszeile des VFD/LCD angezeigt werden soll
menu.hint_video Video-Ausgang, Auflösung, Format, Seitenverhältnisse usw.
menu.hint_video_43mode Anzeige-Modus für 4:3-Inhalte auf 16:9-Fernsehern
menu.hint_video_analog_mode Wählen Sie den Modus des Ausgangssignals für den CINCH-Anschluss
Expand Down Expand Up @@ -2244,7 +2245,7 @@ movieplayer.bookmarkname Bookmark Name
movieplayer.bookmarkname_hint1 Geben Sie den Namen für das neue Lesezeichen ein
movieplayer.bookmarkname_hint2
movieplayer.chapters Kapitel
movieplayer.display_playtime Zeige Spielzeit im VFD
movieplayer.display_playtime Zeige Spielzeit im VFD/LCD
movieplayer.fileplayback_audio Multiformat-Audiowiedergabe
movieplayer.fileplayback_video Multiformat-Videowiedergabe
movieplayer.head Movieplayer
Expand Down
12 changes: 8 additions & 4 deletions data/locale/english.locale
Expand Up @@ -1150,6 +1150,10 @@ lcdmenu.statusline Status line
lcdmenu.statusline.both Volume and playtime
lcdmenu.statusline.playtime Playtime
lcdmenu.statusline.volume Volume
lcd_num.info.line Show in infoline
lcd_num.info.line_channel Channelname
lcd_num.info.line_channel_no Channelnumber
lcd_num.info.line_clock Clock
ledcontroler.backlight Buttons backlight
ledcontroler.backlight.tv TV mode
ledcontroler.blink Blink in deep-standby, if timer set
Expand Down Expand Up @@ -1513,7 +1517,7 @@ menu.hint_movie Play movies
menu.hint_moviebrowser_fonts Change moviebrowser (My recordings) font sizes
menu.hint_moviebrowser_setup Set selection and display options.
menu.hint_movieplayer_bisection_jump Start value for bisectional mode to jump forward/backward with page up/down
menu.hint_movieplayer_display_playtime While playback show playtime instead of movietitle on VFD
menu.hint_movieplayer_display_playtime While playback show playtime instead of movietitle on VFD/LCD
menu.hint_movieplayer_plugin Choose a plugin that's executed with the one touch key in movieplayer mode
menu.hint_movieplayer_timeosd_while_searching Shows playtime while searching for a short time on OSD
menu.hint_net_broadcast Enter broadcast address\nif unsure, use IP address with last .255
Expand Down Expand Up @@ -1789,11 +1793,11 @@ menu.hint_vfd_brightnessdeepstandby Brightness in deep-standby mode
menu.hint_vfd_brightnessdim Auto-dim brightness
menu.hint_vfd_brightnessstandby Brightness in soft-standby mode
menu.hint_vfd_defaults Restore default brightness values
menu.hint_vfd_dimtime Auto-dim time, in seconds
menu.hint_vfd_infoline Choose what to display in main VFD line
menu.hint_vfd_dimtime Auto-dim time in seconds for normal mode
menu.hint_vfd_infoline Choose what to display in main VFD/LCD line
menu.hint_vfd_notify_rclock Displays a notification when a key is pressed while remote control is locked
menu.hint_vfd_scroll Enable or disable text scrolling on VFD
menu.hint_vfd_statusline Choose what to display in short\nVFD status line
menu.hint_vfd_statusline Choose what to display in short\nVFD/LCD status line
menu.hint_video Video output, resolution, format\nAspect ratio, fast mode switch options
menu.hint_video_43mode Display mode for 4:3 content\non 16:9 TV
menu.hint_video_analog_mode Select analog output mode\nfor SCART and CINCH connectors
Expand Down
70 changes: 45 additions & 25 deletions src/driver/simple_display.cpp
Expand Up @@ -133,6 +133,7 @@ CLCD::CLCD()
has_lcd = false;

servicename = "";
servicenumber = -1;
thread_running = false;
}

Expand All @@ -156,7 +157,7 @@ CLCD* CLCD::getInstance()

void CLCD::wake_up()
{
if (g_info.hw_caps->display_type == HW_DISPLAY_LINE_TEXT || g_info.hw_caps->display_type == HW_DISPLAY_LED_ONLY)
if (g_info.hw_caps->display_can_set_brightness)
{
if (atoi(g_settings.lcd_setting_dim_time.c_str()) > 0)
{
Expand All @@ -180,7 +181,7 @@ void* CLCD::TimeThread(void *)
while (CLCD::getInstance()->thread_running)
{
sleep(1);
if (g_info.hw_caps->display_type == HW_DISPLAY_LINE_TEXT || g_info.hw_caps->display_type == HW_DISPLAY_LED_ONLY)
if (g_info.hw_caps->display_can_set_brightness)
{
struct stat buf;
if (stat("/tmp/vfd.locked", &buf) == -1)
Expand Down Expand Up @@ -220,7 +221,7 @@ void CLCD::init(const char *, const char *, const char *, const char *, const ch

void CLCD::setlcdparameter(void)
{
if (g_info.hw_caps->display_type == HW_DISPLAY_LINE_TEXT || g_info.hw_caps->display_type == HW_DISPLAY_LED_ONLY)
if (g_info.hw_caps->display_can_set_brightness)
{
last_toggle_state_power = g_settings.lcd_setting[SNeutrinoSettings::LCD_POWER];

Expand All @@ -233,19 +234,35 @@ void CLCD::setlcdparameter(void)
}
}

void CLCD::showServicename(std::string name, bool)
void CLCD::showServicename(std::string name, const int num, bool)
{
if (g_info.hw_caps->display_type == HW_DISPLAY_LED_NUM)
return;

servicename = name;
servicenumber = num;

if (mode != MODE_TVRADIO && mode != MODE_AUDIO)
return;

replace_umlauts(servicename);
strncpy(display_text, servicename.c_str(), sizeof(display_text) - 1);
display_text[sizeof(display_text) - 1] = '\0';
if (g_info.hw_caps->display_type == HW_DISPLAY_LED_NUM)
{
std::string s;
if (num > 0) // dont show channel 0 at boot
{
s = to_string(servicenumber);
while ((int)s.length() < g_info.hw_caps->display_xres) {
s = " " + s;
}
}
else
return;
strncpy(display_text, s.c_str(), sizeof(display_text) - 1);
display_text[sizeof(display_text) - 1] = '\0';
}
else
{
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 || HAVE_MIPS_HARDWARE
wake_up();
Expand Down Expand Up @@ -345,10 +362,12 @@ void CLCD::showTime(bool force)
#if HAVE_ARM_HARDWARE || HAVE_MIPS_HARDWARE
if (mode == MODE_STANDBY || (g_settings.lcd_info_line && mode == MODE_TVRADIO))
#else
if (ret < 0 && servicename.empty())
if (ret < 0 && servicename.empty() && servicenumber == -1)
#endif
{
if (g_info.hw_caps->display_xres < 5)
if (g_info.hw_caps->display_xres == 4 && g_info.hw_caps->display_has_colon == 1)
sprintf(timestr, "%02d:%02d", hour, minute);
else if (g_info.hw_caps->display_xres < 5)
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);
Expand All @@ -358,7 +377,7 @@ void CLCD::showTime(bool force)
{
if (vol_active)
{
showServicename(servicename);
showServicename(servicename, servicenumber);
vol_active = false;
}
}
Expand Down Expand Up @@ -392,17 +411,17 @@ void CLCD::showRCLock(int duration)

ShowText(g_Locale->getText(LOCALE_RCLOCK_LOCKED));
sleep(duration);
ShowText(servicename.c_str());
ShowText(servicename.c_str(), servicenumber);
}

/* update is default true, the mute code sets it to false
* to force an update => inverted logic! */
void CLCD::showVolume(const char vol, const bool update)
{
char s[32];
const int type = (g_info.hw_caps->display_xres < 5);
const char *vol_fmt[] = { "Vol:%3d%%", "%4d" };
const char *mutestr[] = { "Vol:MUTE", "mute" };
const int type = (g_info.hw_caps->display_xres < 5) + (g_info.hw_caps->display_type == HW_DISPLAY_LED_NUM);
const char *vol_fmt[] = { "Vol:%3d%%", "%4d", "%4d" };
const char *mutestr[] = { "Vol:MUTE", "mute", " -0-"};
if (vol == volume && update)
return;
volume = vol;
Expand Down Expand Up @@ -487,9 +506,7 @@ void CLCD::setMode(const MODES m, const char * const title)
setled(0, 0);
showclock = true;
power = true;
if (g_info.hw_caps->display_type != HW_DISPLAY_LED_NUM) {
showServicename(servicename);
}
showServicename(servicename, servicenumber);
showTime();
if (g_settings.lcd_info_line)
switch_name_time_cnt = 10;
Expand All @@ -510,6 +527,7 @@ void CLCD::setMode(const MODES m, const char * const title)
showclock = true;
showTime(true);
proc_put("/proc/stb/lcd/show_symbols", false);
timeout_cnt = 0;
break;
default:
showclock = true;
Expand Down Expand Up @@ -573,7 +591,7 @@ void CLCD::setBrightness(int dimm)

int CLCD::getBrightness()
{
if (g_info.hw_caps->display_type == HW_DISPLAY_LINE_TEXT || g_info.hw_caps->display_type == HW_DISPLAY_LED_ONLY)
if (g_info.hw_caps->display_can_set_brightness)
{
if (g_settings.lcd_setting[SNeutrinoSettings::LCD_BRIGHTNESS] > 15)
g_settings.lcd_setting[SNeutrinoSettings::LCD_BRIGHTNESS] = 15;
Expand All @@ -584,7 +602,7 @@ int CLCD::getBrightness()

void CLCD::setBrightnessStandby(int bright)
{
if (g_info.hw_caps->display_type == HW_DISPLAY_LINE_TEXT || g_info.hw_caps->display_type == HW_DISPLAY_LED_ONLY)
if (g_info.hw_caps->display_can_set_brightness)
{
g_settings.lcd_setting[SNeutrinoSettings::LCD_STANDBY_BRIGHTNESS] = bright;
setlcdparameter();
Expand All @@ -593,7 +611,7 @@ void CLCD::setBrightnessStandby(int bright)

int CLCD::getBrightnessStandby()
{
if (g_info.hw_caps->display_type == HW_DISPLAY_LINE_TEXT || g_info.hw_caps->display_type == HW_DISPLAY_LED_ONLY)
if (g_info.hw_caps->display_can_set_brightness)
{
if (g_settings.lcd_setting[SNeutrinoSettings::LCD_STANDBY_BRIGHTNESS] > 15)
g_settings.lcd_setting[SNeutrinoSettings::LCD_STANDBY_BRIGHTNESS] = 15;
Expand Down Expand Up @@ -642,7 +660,7 @@ void CLCD::togglePower(void)
else
showTime(true);

if (g_info.hw_caps->display_type == HW_DISPLAY_LINE_TEXT || g_info.hw_caps->display_type == HW_DISPLAY_LED_ONLY)
if (g_info.hw_caps->display_can_set_brightness)
{
last_toggle_state_power = 1 - last_toggle_state_power;

Expand Down Expand Up @@ -695,6 +713,7 @@ void CLCD::Clear()
SetIcons(SPARK_CLOCK, timer_icon);
}
servicename.clear();
servicenumber = -1;
printf("CLCD::%s\n", __func__);
}
#else
Expand All @@ -719,7 +738,8 @@ void CLCD::count_down()
}
}
}
if (g_settings.lcd_info_line && switch_name_time_cnt > 0) {

if (switch_name_time_cnt > 0) {
switch_name_time_cnt--;
if (switch_name_time_cnt == 0) {
if (g_settings.lcd_setting_dim_brightness > -1) {
Expand Down
3 changes: 2 additions & 1 deletion src/driver/simple_display.h
Expand Up @@ -136,6 +136,7 @@ class CLCD
CLCD();
std::string menutitle;
std::string servicename;
int servicenumber;
MODES mode;
void setled(int red, int green);
static void *TimeThread(void *);
Expand Down Expand Up @@ -164,7 +165,7 @@ class CLCD
MODES getMode() { return mode; };
void setHddUsage(int perc);

void showServicename(const std::string name, const bool clear_epg = false);
void showServicename(const std::string name, const int num, const bool clear_epg = false);
std::string getServicename(void) { return servicename; }
void setEPGTitle(const std::string title);
void setMovieInfo(const AUDIOMODES playmode, const std::string big, const std::string small, const bool centered = false);
Expand Down
21 changes: 17 additions & 4 deletions src/gui/movieplayer.cpp
Expand Up @@ -536,14 +536,26 @@ void CMoviePlayerGui::updateLcd(bool display_playtime)
std::string lcd;
std::string name;

if (display_playtime && g_info.hw_caps->display_xres >= 8)
if (display_playtime)
{
int ss = position/1000;
int hh = ss/3600;
ss -= hh * 3600;
int mm = ss/60;
ss -= mm * 60;
lcd = to_string(hh/10) + to_string(hh%10) + ":" + to_string(mm/10) + to_string(mm%10) + ":" + to_string(ss/10) + to_string(ss%10);

if (g_info.hw_caps->display_xres >= 8)
lcd = to_string(hh/10) + to_string(hh%10) + ":" + to_string(mm/10) + to_string(mm%10) + ":" + to_string(ss/10) + to_string(ss%10);
else
{
std::string colon = g_info.hw_caps->display_has_colon ? ":" : "";
if (hh < 1) {
lcd = to_string(mm/10) + to_string(mm%10) + colon + to_string(ss/10) + to_string(ss%10);
}
else {
lcd = to_string(hh/10) + to_string(hh%10) + colon + to_string(mm/10) + to_string(mm%10);
}
}
}
else
{
Expand Down Expand Up @@ -1677,9 +1689,10 @@ void CMoviePlayerGui::PlayFileLoop(void)

while (playstate >= CMoviePlayerGui::PLAY)
{
if (update_lcd || g_settings.movieplayer_display_playtime) {
bool show_playtime = (g_settings.movieplayer_display_playtime || g_info.hw_caps->display_type == HW_DISPLAY_LED_NUM);
if (update_lcd || show_playtime) {
update_lcd = false;
updateLcd(g_settings.movieplayer_display_playtime);
updateLcd(show_playtime);
}
if (first_start) {
usleep(80000);
Expand Down
13 changes: 13 additions & 0 deletions src/gui/vfd_setup.cpp
Expand Up @@ -111,7 +111,11 @@ const CMenuOptionChooser::keyval LEDMENU_OPTIONS[LEDMENU_OPTION_COUNT] =
#define LCD_INFO_OPTION_COUNT 2
const CMenuOptionChooser::keyval LCD_INFO_OPTIONS[LCD_INFO_OPTION_COUNT] =
{
#if BOXMODEL_H7 || BOXMODEL_BRE2ZE4K
{ 0, LOCALE_LCD_INFO_LINE_CHANNEL_NO },
#else
{ 0, LOCALE_LCD_INFO_LINE_CHANNEL },
#endif
{ 1, LOCALE_LCD_INFO_LINE_CLOCK }
};

Expand Down Expand Up @@ -195,6 +199,15 @@ int CVfdSetup::showSetup()
vfds->addItem(oj);
}

if (g_info.hw_caps->display_type == HW_DISPLAY_LED_NUM)
{
//LED NUM info line options
CMenuOptionChooser* led_num;
led_num = new CMenuOptionChooser(LOCALE_LCD_INFO_LINE, &g_settings.lcd_info_line, LCD_INFO_OPTIONS, LCD_INFO_OPTION_COUNT, vfd_enabled);
led_num->setHint("", LOCALE_MENU_HINT_VFD_INFOLINE);
vfds->addItem(led_num);
}

CMenuItem* glcd_setup = NULL;
#ifdef ENABLE_GRAPHLCD
GLCD_Menu glcdMenu;
Expand Down
1 change: 1 addition & 0 deletions src/system/locals.h
Expand Up @@ -1215,6 +1215,7 @@ typedef enum
LOCALE_LCD4L_WEATHER,
LOCALE_LCD_INFO_LINE,
LOCALE_LCD_INFO_LINE_CHANNEL,
LOCALE_LCD_INFO_LINE_CHANNEL_NO,
LOCALE_LCD_INFO_LINE_CLOCK,
LOCALE_LCDCONTROLER_BRIGHTNESS,
LOCALE_LCDCONTROLER_BRIGHTNESSDEEPSTANDBY,
Expand Down
1 change: 1 addition & 0 deletions src/system/locals_intern.h
Expand Up @@ -1215,6 +1215,7 @@ const char * locale_real_names[] =
"lcd4l_weather",
"lcd_info_line",
"lcd_info_line_channel",
"lcd_info_line_channel_no",
"lcd_info_line_clock",
"lcdcontroler.brightness",
"lcdcontroler.brightnessdeepstandby",
Expand Down

0 comments on commit 4e2538d

Please sign in to comment.