diff --git a/display-daemon/ser.c b/display-daemon/ser.c index 7d3d911..f609d21 100644 --- a/display-daemon/ser.c +++ b/display-daemon/ser.c @@ -22,7 +22,10 @@ int fd; int screensaver; int brightness = 4; +int offset = 0; char *fifo; +char *pausemsg = NULL; + pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER; pthread_t thread1; @@ -105,17 +108,17 @@ char display_set_timer[] = { 0x1F, 0x54 }; #define TIME_BASE 200000 #define TB_TO_SECS(x) (x*1000000/TIME_BASE) -#define TIME_CLOCK TB_TO_SECS(25) +#define TIME_CLOCK TB_TO_SECS(5) #define TIME_DIM TB_TO_SECS(90) #define TIME_OFF TB_TO_SECS(320) #define DEVICE "/dev/ttyUSB0" -#define PAUSEMSG "Hallo, bitte melde Dich am Barcodereader an, um das Kassensystem zu benutzen *** " // chars per line in our display: #define LINELEN 20 + void display_write (const void *buf, size_t count) { @@ -252,6 +255,36 @@ sighandler (int sig) //signal(sig, sighandler); } +void scrolltext(){ + + if (pausemsg){ + char *message = calloc (LINELEN + 1, sizeof (char)); + + int spaces=0; + + if (offset (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); + scrolltext(); } //after some more seconds of inactivity dim display and finally turn off