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

@ -87,7 +87,7 @@ def delay(what, seconds):
def warn_balance():
print('Kontostand im Minus, bitte Geld aufladen.')
print_display('\e\x0cKontostand im Minus, bitte Geld aufladen.')
print_display('\e\x0cKontostand im Minus,bitte Geld aufladen.')
def error_page(message):

View File

@ -71,7 +71,8 @@ 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};
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.
@ -129,7 +130,7 @@ void
display_putstring (char *s)
{
screensaver = 0;
SEND_TEXT(s);
SEND_TEXT (s);
}
@ -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);
}
@ -252,17 +256,19 @@ sighandler (int sig)
int
main (int argc, char **argv)
{
char *devnode ;
char *devnode;
//TODO: arg parser!
fifo=strdup("/tmp/display");
fifo = strdup ("/tmp/display");
if (argc != 2)
{
devnode=strdup(DEVICE);
printf ("no device specified, using default %s\n",devnode);
}else{
devnode=strdup(argv[1]);
devnode = strdup (DEVICE);
printf ("no device specified, using default %s\n", devnode);
}
else
{
devnode = strdup (argv[1]);
}
fd = open (devnode, O_RDWR | O_NOCTTY | O_NDELAY);
if (fd == -1)
@ -304,13 +310,20 @@ main (int argc, char **argv)
while (1)
{
usleep(TIME_BASE);
//printf ("screensaver = %05d brightness: %d\n", screensaver, brightness);
if (screensaver < 10000)
usleep (TIME_BASE);
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,16 +335,21 @@ main (int argc, char **argv)
//show a scroll text while the screensaver is active...
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);
int l = strlen(message);
if (l<LINELEN){
message = strncat(message, PAUSEMSG , LINELEN-l);
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);
int l = strlen (message);
if (l < LINELEN)
{
message = strncat (message, PAUSEMSG, LINELEN - l);
}
SEND_TEXT("\x0b");
SEND_TEXT(message);
free(message);
SEND_TEXT ("\x0b");
SEND_TEXT (message);
free (message);
}
//after some more seconds of inactivity dim display and finally turn off