This commit is contained in:
Florian Streibelt 2011-10-12 19:53:05 +02:00
parent b36df0167d
commit ffe61d7e7c
2 changed files with 45 additions and 27 deletions

View File

@ -72,6 +72,7 @@ char display_clear_screen[] = { 0x0c };
// activate timer display in lower right corner.
// actual time has to be set via display_set_timer.
char display_time[] = { 0x1f, 0x55 };
// configures hour and minutes of the internal clock and
// displays the time in the lower right corner.
// turns off when something gets written into the line.
@ -243,7 +244,10 @@ sighandler (int sig)
SEND_DISPLAY_OFF;
close (fd);
if (fifo) {unlink(fifo);}
if (fifo)
{
unlink (fifo);
}
exit (0);
//signal(sig, sighandler);
}
@ -261,7 +265,9 @@ main (int argc, char **argv)
{
devnode = strdup (DEVICE);
printf ("no device specified, using default %s\n", devnode);
}else{
}
else
{
devnode = strdup (argv[1]);
}
fd = open (devnode, O_RDWR | O_NOCTTY | O_NDELAY);
@ -305,12 +311,19 @@ main (int argc, char **argv)
while (1)
{
usleep (TIME_BASE);
//printf ("screensaver = %05d brightness: %d\n", screensaver, brightness);
if (screensaver < 10000)
if (0 == (screensaver) % TB_TO_SECS (1))
{
screensaver++;
//one-second event comes HERE:
printf
("debug: screensaver: %d time until clock: %d time until dim: %d time until off: %d\n",
screensaver, TIME_CLOCK - screensaver, TIME_DIM - screensaver,
TIME_OFF - screensaver);
}
//printf ("screensaver = %05d brightness: %d\n", screensaver, brightness);
screensaver = (screensaver + 1) % TIME_CLOCK + TIME_OFF + TIME_DIM;
if (screensaver == TIME_CLOCK)
{
showtime ();
@ -322,11 +335,16 @@ main (int argc, char **argv)
//show a scroll text while the screensaver is active...
if ((screensaver > (TIME_CLOCK+10)) && (screensaver < TIME_OFF)){
if ((screensaver > (TIME_CLOCK + 10)) && (screensaver < TIME_OFF))
{
char *message = calloc (LINELEN + 1, sizeof (char));
strncpy(message,PAUSEMSG+((screensaver-TIME_CLOCK-1)%strlen(PAUSEMSG)),LINELEN);
strncpy (message,
PAUSEMSG +
((screensaver - TIME_CLOCK - 1) % strlen (PAUSEMSG)),
LINELEN);
int l = strlen (message);
if (l<LINELEN){
if (l < LINELEN)
{
message = strncat (message, PAUSEMSG, LINELEN - l);
}
SEND_TEXT ("\x0b");