spark: improve time display in standby mode

Origin commit data
------------------
Branch: ni/coolstream
Commit: 7a22a029d1
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2012-03-30 (Fri, 30 Mar 2012)


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

------------------
This commit was generated by Migit
This commit is contained in:
Stefan Seyfried
2012-03-30 18:36:54 +02:00
parent d12b170c58
commit 98f6f2a7e0
3 changed files with 8 additions and 7 deletions

View File

@@ -605,7 +605,7 @@ void CLCD::setMovieAudio(const bool is_ac3)
showPercentOver(percentOver, true, MODE_MOVIE); showPercentOver(percentOver, true, MODE_MOVIE);
} }
void CLCD::showTime() void CLCD::showTime(bool)
{ {
if (showclock) if (showclock)
{ {

View File

@@ -192,7 +192,7 @@ class CLCD
void setMovieInfo(const AUDIOMODES playmode, const std::string big, const std::string small, const bool centered = false); void setMovieInfo(const AUDIOMODES playmode, const std::string big, const std::string small, const bool centered = false);
void setMovieAudio(const bool is_ac3); void setMovieAudio(const bool is_ac3);
std::string getMenutitle() { return menutitle; }; std::string getMenutitle() { return menutitle; };
void showTime(); void showTime(bool force = false);
/** blocks for duration seconds */ /** blocks for duration seconds */
void showRCLock(int duration = 2); void showRCLock(int duration = 2);
void showVolume(const char vol, const bool perform_update = true); void showVolume(const char vol, const bool perform_update = true);

View File

@@ -130,7 +130,7 @@ printf("spark_led:%s red:%d green:%d\n", __func__, red, green);
close(fd); close(fd);
} }
void CLCD::showTime() void CLCD::showTime(bool force)
{ {
static bool redled = false; static bool redled = false;
@@ -141,14 +141,14 @@ void CLCD::showTime()
} }
time_t now = time(NULL); time_t now = time(NULL);
if (power && showclock && (now - last_display) > 4) if (power && (force || (showclock && (now - last_display) > 4)))
{ {
char timestr[5]; char timestr[5];
struct tm *t; struct tm *t;
static int hour = 0, minute = 0; static int hour = 0, minute = 0;
t = localtime(&now); t = localtime(&now);
if (last_display || (hour != t->tm_hour) || (minute != t->tm_min)) { if (force || last_display || (hour != t->tm_hour) || (minute != t->tm_min)) {
hour = t->tm_hour; hour = t->tm_hour;
minute = t->tm_min; minute = t->tm_min;
sprintf(timestr, "%02d%02d", hour, minute); sprintf(timestr, "%02d%02d", hour, minute);
@@ -239,8 +239,7 @@ printf("spark_led:%s %d\n", __func__, (int)m);
case MODE_STANDBY: case MODE_STANDBY:
setled(0, 1); setled(0, 1);
showclock = true; showclock = true;
last_display = 0; showTime(true);
showTime();
break; break;
default: default:
showclock = true; showclock = true;
@@ -281,6 +280,8 @@ void CLCD::togglePower(void)
power = !power; power = !power;
if (!power) if (!power)
Clear(); Clear();
else
showTime(true);
} }
void CLCD::setMuted(bool mu) void CLCD::setMuted(bool mu)