vfd.cpp: add timer for show servicename time switch

This commit is contained in:
satbaby
2012-07-12 15:35:37 +02:00
parent 58d513d963
commit a8ec81b53a
2 changed files with 16 additions and 3 deletions

View File

@@ -68,6 +68,7 @@ CVFD::CVFD()
text[0] = 0; text[0] = 0;
clearClock = 0; clearClock = 0;
mode = MODE_TVRADIO; mode = MODE_TVRADIO;
switch_name_time_cnt = 0;
} }
CVFD::~CVFD() CVFD::~CVFD()
@@ -88,7 +89,7 @@ CVFD* CVFD::getInstance()
void CVFD::count_down() { void CVFD::count_down() {
if (timeout_cnt > 0) { if (timeout_cnt > 0) {
timeout_cnt--; timeout_cnt--;
if (timeout_cnt == 0) { if (timeout_cnt == 0 ) {
if (g_settings.lcd_setting_dim_brightness > -1) { if (g_settings.lcd_setting_dim_brightness > -1) {
// save lcd brightness, setBrightness() changes global setting // save lcd brightness, setBrightness() changes global setting
int b = g_settings.lcd_setting[SNeutrinoSettings::LCD_BRIGHTNESS]; int b = g_settings.lcd_setting[SNeutrinoSettings::LCD_BRIGHTNESS];
@@ -99,6 +100,14 @@ void CVFD::count_down() {
} }
} }
} }
if (g_settings.lcd_info_line && switch_name_time_cnt > 0) {
switch_name_time_cnt--;
if (switch_name_time_cnt == 0) {
if (g_settings.lcd_setting_dim_brightness > -1) {
CVFD::getInstance()->showTime(true);
}
}
}
} }
void CVFD::wake_up() { void CVFD::wake_up() {
@@ -110,6 +119,9 @@ void CVFD::wake_up() {
} }
else else
setPower(1); setPower(1);
if(g_settings.lcd_info_line){
switch_name_time_cnt = g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR] + 10;
}
} }
void* CVFD::TimeThread(void *) void* CVFD::TimeThread(void *)
@@ -288,7 +300,7 @@ void CVFD::showTime(bool force)
ftime(&tm); ftime(&tm);
t = localtime(&tm.time); t = localtime(&tm.time);
if(force || ((hour != t->tm_hour) || (minute != t->tm_min))) { if(force || ( switch_name_time_cnt == 0 && ((hour != t->tm_hour) || (minute != t->tm_min))) ) {
hour = t->tm_hour; hour = t->tm_hour;
minute = t->tm_min; minute = t->tm_min;
strftime(timestr, 20, "%H:%M", t); strftime(timestr, 20, "%H:%M", t);
@@ -495,7 +507,7 @@ void CVFD::setMode(const MODES m, const char * const title)
showServicename(servicename); showServicename(servicename);
showclock = true; showclock = true;
if(g_settings.lcd_info_line) if(g_settings.lcd_info_line)
showTime(); /* "showclock = true;" implies that "showTime();" does a "displayUpdate();" */ switch_name_time_cnt = g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR] + 10;
break; break;
case MODE_AUDIO: case MODE_AUDIO:
{ {

View File

@@ -86,6 +86,7 @@ class CVFD
int last_toggle_state_power; int last_toggle_state_power;
bool clearClock; bool clearClock;
unsigned int timeout_cnt; unsigned int timeout_cnt;
unsigned int switch_name_time_cnt;
int fd; int fd;
int brightness; int brightness;
char text[256]; char text[256];