simple_display.cpp: fix LED NUM for H7 and BRE2ZE4K

Origin commit data
------------------
Branch: ni/coolstream
Commit: 4e2538d1fe
Author: GetAway <get-away@t-online.de>
Date: 2020-07-16 (Thu, 16 Jul 2020)


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

------------------
This commit was generated by Migit
This commit is contained in:
GetAway
2020-07-16 20:07:12 +02:00
committed by vanhofen
parent 4afb7a44c4
commit 39786d7e2c
8 changed files with 91 additions and 37 deletions

View File

@@ -133,6 +133,7 @@ CLCD::CLCD()
has_lcd = false;
servicename = "";
servicenumber = -1;
thread_running = false;
}
@@ -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)
{
@@ -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)
@@ -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];
@@ -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();
@@ -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);
@@ -358,7 +377,7 @@ void CLCD::showTime(bool force)
{
if (vol_active)
{
showServicename(servicename);
showServicename(servicename, servicenumber);
vol_active = false;
}
}
@@ -392,7 +411,7 @@ 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
@@ -400,9 +419,9 @@ void CLCD::showRCLock(int duration)
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;
@@ -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;
@@ -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;
@@ -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;
@@ -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();
@@ -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;
@@ -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;
@@ -695,6 +713,7 @@ void CLCD::Clear()
SetIcons(SPARK_CLOCK, timer_icon);
}
servicename.clear();
servicenumber = -1;
printf("CLCD::%s\n", __func__);
}
#else
@@ -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) {

View File

@@ -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 *);
@@ -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);

View File

@@ -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
{
@@ -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);

View File

@@ -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 }
};
@@ -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;

View File

@@ -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,

View File

@@ -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",