summaryrefslogtreecommitdiff
path: root/watch.c
diff options
context:
space:
mode:
Diffstat (limited to 'watch.c')
-rw-r--r--watch.c52
1 files changed, 31 insertions, 21 deletions
diff --git a/watch.c b/watch.c
index 544d369..6bb0129 100644
--- a/watch.c
+++ b/watch.c
@@ -119,44 +119,58 @@ void ciMonWatch::close() {
usleep(500000);
Cancel();
}
-
+
+ cTimer* t = Timers.GetNextActiveTimer();
+
switch(theSetup.m_nOnExit) {
case eOnExitMode_NEXTTIMER: {
- isyslog("iMonLCD: closing, show next timer.");
- cTimer* t = Timers.GetNextActiveTimer();
+ isyslog("iMonLCD: closing, show only next timer.");
this->setLineLength(0,0,0,0);
this->clear();
if(t) {
struct tm l;
+ cString topic;
+ time_t tn = time(NULL);
time_t tt = t->StartTime();
localtime_r(&tt, &l);
- cString topic = cString::sprintf("%d. %02d:%02d %s", l.tm_mday, l.tm_hour, l.tm_min, t->File());
+ if((tt - tn) > 86400) {
+ // next timer more then 24h
+ topic = cString::sprintf("%d. %02d:%02d %s", l.tm_mday, l.tm_hour, l.tm_min, t->File());
+ } else {
+ // next timer (today)
+ topic = cString::sprintf("%02d:%02d %s", l.tm_hour, l.tm_min, t->File());
+ }
this->DrawText(0,0,topic);
- this->icons(eIconAlarm);
+ this->icons(eIconTime);
} else {
this->DrawText(0,0,tr("None active timer"));
this->icons(0);
}
this->flush();
break;
- }
+ }
case eOnExitMode_SHOWMSG: {
- isyslog("iMonLCD: closing, leaving \"last\" message.");
+ isyslog("iMonLCD: closing, leaving \"last\" message.");
break;
- }
+ }
case eOnExitMode_BLANKSCREEN: {
- isyslog("iMonLCD: closing, turning backlight off.");
+ isyslog("iMonLCD: closing, turning backlight off.");
SendCmdShutdown();
break;
- }
+ }
+ case eOnExitMode_WAKEUP: {
+ isyslog("iMonLCD: closing, set wakeup time and showing clock.");
+ SendCmdClock(t ? t->StartTime() - (theSetup.m_nWakeup * 60) : NULL);
+ break;
+ }
default:
case eOnExitMode_SHOWCLOCK: {
- isyslog("iMonLCD: closing, showing clock.");
- SendCmdClock();
+ isyslog("iMonLCD: closing, showing clock.");
+ SendCmdClock(NULL);
break;
- }
- }
+ }
+ }
ciMonLCD::close();
@@ -582,11 +596,10 @@ eReplayState ciMonWatch::ReplayMode() const
bool ciMonWatch::ReplayPosition(int &current, int &total) const
{
- if (m_pControl && ((cControl *)m_pControl)->GetIndex(current, total, false))
- {
- total = (total == 0) ? 1 : total;
+ if (m_pControl && ((cControl *)m_pControl)->GetIndex(current, total, false)) {
+ total = (total == 0) ? 1 : total;
return true;
- }
+ }
return false;
}
@@ -806,9 +819,6 @@ bool ciMonWatch::SetFont(const char *szFont) {
return false;
}
-
-
-
eIconState ciMonWatch::ForceIcon(unsigned int nIcon, eIconState nState) {
unsigned int nIconOff = nIcon;