stuff...
This commit is contained in:
parent
b36df0167d
commit
ffe61d7e7c
|
@ -87,7 +87,7 @@ def delay(what, seconds):
|
||||||
|
|
||||||
def warn_balance():
|
def warn_balance():
|
||||||
print('Kontostand im Minus, bitte Geld aufladen.')
|
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):
|
def error_page(message):
|
||||||
|
|
|
@ -71,7 +71,8 @@ char display_clear_screen[] = { 0x0c };
|
||||||
|
|
||||||
// activate timer display in lower right corner.
|
// activate timer display in lower right corner.
|
||||||
// actual time has to be set via display_set_timer.
|
// 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
|
// configures hour and minutes of the internal clock and
|
||||||
// displays the time in the lower right corner.
|
// displays the time in the lower right corner.
|
||||||
// turns off when something gets written into the line.
|
// turns off when something gets written into the line.
|
||||||
|
@ -129,7 +130,7 @@ void
|
||||||
display_putstring (char *s)
|
display_putstring (char *s)
|
||||||
{
|
{
|
||||||
screensaver = 0;
|
screensaver = 0;
|
||||||
SEND_TEXT(s);
|
SEND_TEXT (s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -175,7 +176,7 @@ display_dim (short i)
|
||||||
SEND_CURSOR_OFF;
|
SEND_CURSOR_OFF;
|
||||||
// turn display on again
|
// turn display on again
|
||||||
SEND_DISPLAY_ON;
|
SEND_DISPLAY_ON;
|
||||||
SEND_MODE_OVERWRITE;
|
SEND_MODE_OVERWRITE;
|
||||||
char c[4] = { 0x1f, 0x58, 0x04, 0x00 };
|
char c[4] = { 0x1f, 0x58, 0x04, 0x00 };
|
||||||
l = 6;
|
l = 6;
|
||||||
//c[5]=i;
|
//c[5]=i;
|
||||||
|
@ -243,7 +244,10 @@ sighandler (int sig)
|
||||||
SEND_DISPLAY_OFF;
|
SEND_DISPLAY_OFF;
|
||||||
|
|
||||||
close (fd);
|
close (fd);
|
||||||
if (fifo) {unlink(fifo);}
|
if (fifo)
|
||||||
|
{
|
||||||
|
unlink (fifo);
|
||||||
|
}
|
||||||
exit (0);
|
exit (0);
|
||||||
//signal(sig, sighandler);
|
//signal(sig, sighandler);
|
||||||
}
|
}
|
||||||
|
@ -252,18 +256,20 @@ sighandler (int sig)
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
char *devnode ;
|
char *devnode;
|
||||||
|
|
||||||
//TODO: arg parser!
|
//TODO: arg parser!
|
||||||
fifo=strdup("/tmp/display");
|
fifo = strdup ("/tmp/display");
|
||||||
|
|
||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
{
|
{
|
||||||
devnode=strdup(DEVICE);
|
devnode = strdup (DEVICE);
|
||||||
printf ("no device specified, using default %s\n",devnode);
|
printf ("no device specified, using default %s\n", devnode);
|
||||||
}else{
|
}
|
||||||
devnode=strdup(argv[1]);
|
else
|
||||||
}
|
{
|
||||||
|
devnode = strdup (argv[1]);
|
||||||
|
}
|
||||||
fd = open (devnode, O_RDWR | O_NOCTTY | O_NDELAY);
|
fd = open (devnode, O_RDWR | O_NOCTTY | O_NDELAY);
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
{
|
{
|
||||||
|
@ -304,13 +310,20 @@ main (int argc, char **argv)
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
usleep(TIME_BASE);
|
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)
|
if (screensaver == TIME_CLOCK)
|
||||||
{
|
{
|
||||||
showtime ();
|
showtime ();
|
||||||
|
@ -322,17 +335,22 @@ main (int argc, char **argv)
|
||||||
|
|
||||||
|
|
||||||
//show a scroll text while the screensaver is active...
|
//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);
|
char *message = calloc (LINELEN + 1, sizeof (char));
|
||||||
int l = strlen(message);
|
strncpy (message,
|
||||||
if (l<LINELEN){
|
PAUSEMSG +
|
||||||
message = strncat(message, PAUSEMSG , LINELEN-l);
|
((screensaver - TIME_CLOCK - 1) % strlen (PAUSEMSG)),
|
||||||
}
|
LINELEN);
|
||||||
SEND_TEXT("\x0b");
|
int l = strlen (message);
|
||||||
SEND_TEXT(message);
|
if (l < LINELEN)
|
||||||
free(message);
|
{
|
||||||
}
|
message = strncat (message, PAUSEMSG, LINELEN - l);
|
||||||
|
}
|
||||||
|
SEND_TEXT ("\x0b");
|
||||||
|
SEND_TEXT (message);
|
||||||
|
free (message);
|
||||||
|
}
|
||||||
|
|
||||||
//after some more seconds of inactivity dim display and finally turn off
|
//after some more seconds of inactivity dim display and finally turn off
|
||||||
if ((screensaver > TIME_DIM) && (brightness > 1))
|
if ((screensaver > TIME_DIM) && (brightness > 1))
|
||||||
|
|
Loading…
Reference in New Issue