summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--imon.c36
-rw-r--r--imon.h2
-rw-r--r--po/de_DE.po10
-rw-r--r--po/it_IT.po8
-rw-r--r--setup.c22
-rw-r--r--setup.h5
-rw-r--r--watch.c52
7 files changed, 98 insertions, 37 deletions
diff --git a/imon.c b/imon.c
index ab850ce..9c78261 100644
--- a/imon.c
+++ b/imon.c
@@ -205,25 +205,39 @@ bool ciMonLCD::SendCmdShutdown() {
* Show the big clock. We need to set it to the current time, then it just
* keeps counting automatically.
*/
-bool ciMonLCD::SendCmdClock() {
+bool ciMonLCD::SendCmdClock(time_t tAlarm) {
time_t tt;
struct tm l;
uint64_t data;
+ uint64_t alarm;
- tt = time(NULL);
+ tt = time(NULL);
localtime_r(&tt, &l);
+
+ data = this->cmd_display;
+ alarm = this->cmd_clear_alarm;
+
+ data += ((uint64_t) l.tm_sec << 48);
+ data += ((uint64_t) l.tm_min << 40);
+ data += ((uint64_t) l.tm_hour << 32);
+ data += ((uint64_t) l.tm_mday << 24);
+ data += ((uint64_t) l.tm_mon << 16);
+ data += ((uint64_t) l.tm_year << 8);
+
+ if(!tAlarm) {
+ data += 0x80;
+ } else {
+ data += 0x24; // Works for me on 0038 (need check for ffdc)
- data = this->cmd_display;
- data += ((uint64_t) l.tm_sec << 48);
- data += ((uint64_t) l.tm_min << 40);
- data += ((uint64_t) l.tm_hour << 32);
- data += ((uint64_t) l.tm_mday << 24);
- data += ((uint64_t) l.tm_mon << 16);
- data += (((uint64_t) l.tm_year) << 8);
- data += 0x80;
+ localtime_r(&tAlarm, &l);
+ alarm += ((uint64_t) l.tm_min << 24);
+ alarm += ((uint64_t) l.tm_hour << 16);
+ alarm += ((uint64_t) l.tm_mday << 8);
+ alarm += ((uint64_t) l.tm_mon << 0);
+ }
return SendCmd(data)
- && SendCmd(this->cmd_clear_alarm);
+ && SendCmd(alarm);
}
/**
diff --git a/imon.h b/imon.h
index 36f705f..6e38217 100644
--- a/imon.h
+++ b/imon.h
@@ -112,7 +112,7 @@ protected:
int lengthToPixels(int length);
bool SendCmd(const uint64_t & cmdData);
- bool SendCmdClock();
+ bool SendCmdClock(time_t tAlarm);
bool SendCmdShutdown();
bool Contrast(int nContrast);
public:
diff --git a/po/de_DE.po b/po/de_DE.po
index 5a6215f..08c09ec 100644
--- a/po/de_DE.po
+++ b/po/de_DE.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-imonlcd-plugin 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2009-05-30 13:41+0200\n"
+"POT-Creation-Date: 2009-06-04 15:25+0200\n"
"PO-Revision-Date: 2009-05-21 17:13+0200\n"
"Last-Translator: Andreas Brachold <vdr07 AT deltab de>\n"
"Language-Team: Andreas Brachold <vdr07 AT deltab de>\n"
@@ -46,11 +46,17 @@ msgid "Turning backlight off"
msgstr "Abschalten der Anzeige"
msgid "Showing next timer"
-msgstr "Nächsten Timer anzeigen"
+msgstr "Nächsten Timer anzeigen"
+
+msgid "Wakeup on next timer"
+msgstr "Aufwachen zum nächsten Timer"
msgid "Exit mode"
msgstr "Ende Modus"
+msgid "Ahead time to awaken (min)"
+msgstr "Vorlaufzeit zum Aufwachen (min)"
+
msgid "None active timer"
msgstr "Kein aktiver Timer"
diff --git a/po/it_IT.po b/po/it_IT.po
index 061f68d..23b6079 100644
--- a/po/it_IT.po
+++ b/po/it_IT.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-imonlcd-plugin 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2009-05-30 13:41+0200\n"
+"POT-Creation-Date: 2009-06-04 15:25+0200\n"
"PO-Revision-Date: 2009-05-23 16:20+0100\n"
"Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n"
"Language-Team: \n"
@@ -51,9 +51,15 @@ msgstr "Spegni retroilluminazione"
msgid "Showing next timer"
msgstr ""
+msgid "Wakeup on next timer"
+msgstr ""
+
msgid "Exit mode"
msgstr "Modalità d'uscita"
+msgid "Ahead time to awaken (min)"
+msgstr ""
+
msgid "None active timer"
msgstr ""
diff --git a/setup.c b/setup.c
index 083fc7b..2b0ffec 100644
--- a/setup.c
+++ b/setup.c
@@ -29,6 +29,7 @@
#define DEFAULT_WIDTH 96
#define DEFAULT_HEIGHT 16
#define DEFAULT_FONT "Sans:Bold"
+#define DEFAULT_WAKEUP 5
/// The one and only Stored setup data
cIMonSetup theSetup;
@@ -43,6 +44,8 @@ cIMonSetup::cIMonSetup(void)
m_nWidth = DEFAULT_WIDTH;
m_nHeight = DEFAULT_HEIGHT;
+ m_nWakeup = DEFAULT_WAKEUP;
+
strncpy(m_szFont,DEFAULT_FONT,sizeof(m_szFont));
}
@@ -60,6 +63,8 @@ cIMonSetup& cIMonSetup::operator = (const cIMonSetup& x)
m_nWidth = x.m_nWidth;
m_nHeight = x.m_nHeight;
+ m_nWakeup = x.m_nWakeup;
+
strncpy(m_szFont,x.m_szFont,sizeof(m_szFont));
return *this;
@@ -136,6 +141,17 @@ bool cIMonSetup::SetupParse(const char *szName, const char *szValue)
return true;
}
+ // Wakeup
+ if(!strcasecmp(szName, "Wakeup")) {
+ int n = atoi(szValue);
+ if ((n < 0) || (n > 1440)) {
+ esyslog("iMonLCD: Wakeup must be between 0 and 1440; using default %d",
+ DEFAULT_WAKEUP);
+ n = DEFAULT_WAKEUP;
+ }
+ m_nWakeup = n;
+ return true;
+ }
//Unknow parameter
return false;
}
@@ -153,6 +169,7 @@ void ciMonMenuSetup::Store(void)
SetupStore("DiscMode", theSetup.m_bDiscMode);
SetupStore("Contrast", theSetup.m_nContrast);
SetupStore("Font", theSetup.m_szFont);
+ SetupStore("Wakeup", theSetup.m_nWakeup);
}
ciMonMenuSetup::ciMonMenuSetup(ciMonWatch* pDev)
@@ -182,11 +199,16 @@ ciMonMenuSetup::ciMonMenuSetup(ciMonWatch* pDev)
szExitModes[eOnExitMode_SHOWCLOCK] = tr("Showing clock");
szExitModes[eOnExitMode_BLANKSCREEN] = tr("Turning backlight off");
szExitModes[eOnExitMode_NEXTTIMER] = tr("Showing next timer");
+ szExitModes[eOnExitMode_WAKEUP] = tr("Wakeup on next timer");
Add(new cMenuEditStraItem (tr("Exit mode"),
&m_tmpSetup.m_nOnExit,
memberof(szExitModes), szExitModes));
+ Add(new cMenuEditIntItem (tr("Ahead time to awaken (min)"),
+ &m_tmpSetup.m_nWakeup,
+ 0, 1440));
+
/* Adjust need add moment restart
Add(new cMenuEditIntItem (tr("Display width"),
&m_tmpSetup.m_nWidth,
diff --git a/setup.h b/setup.h
index 00074f2..be65d6d 100644
--- a/setup.h
+++ b/setup.h
@@ -23,7 +23,8 @@ enum eOnExitMode {
,eOnExitMode_SHOWCLOCK = 1 /**< Show the big clock */
,eOnExitMode_BLANKSCREEN = 2 /**< Blank the device completely */
,eOnExitMode_NEXTTIMER = 3 /**< Show next active timer */
- ,eOnExitMode_LASTITEM = 3
+ ,eOnExitMode_WAKEUP = 4 /**< Show the big clock and wakeup on next active timer */
+ ,eOnExitMode_LASTITEM = 4
};
struct cIMonSetup
@@ -37,6 +38,8 @@ struct cIMonSetup
char m_szFont[256];
+ int m_nWakeup;
+
cIMonSetup(void);
cIMonSetup(const cIMonSetup& x);
cIMonSetup& operator = (const cIMonSetup& x);
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;