- i = 0 ;
- j = 0 ;
- for (;;)
- {
- strncpy (buf1, &message1 [i], 20) ;
- buf1 [20] = 0 ;
- lcdPosition (fd1, 0, 1) ;
- lcdPuts (fd1, buf1) ;
- ++i ;
- if (i == strlen (message1) - 20)
- i = 0 ;
-
- strncpy (buf2, &message2 [j], 16) ;
- buf2 [16] = 0 ;
- lcdPosition (fd2, 0, 1) ;
- lcdPuts (fd2, buf2) ;
- ++j ;
- if (j == strlen (message2) - 16)
- j = 0 ;
-
- tim = time (NULL) ;
- t = localtime (&tim) ;
-
- sprintf (buf1, "%02d:%02d:%02d", t->tm_hour, t->tm_min, t->tm_sec) ;
- lcdPosition (fd1, 5, 2) ;
- lcdPuts (fd1, buf1) ;
-
- sprintf (buf1, "%02d/%02d/%02d", t->tm_mday, t->tm_mon + 1, t->tm_year+1900) ;
- lcdPosition (fd1, 4, 3) ;
- lcdPuts (fd1, buf1) ;
-
- delay (250) ;
- }
+ delay (250) ;
+
+ scrollMessage (lcd, 0, cols) ;
+
+ if (rows == 1)
+ continue ;
+
+ tim = time (NULL) ;
+ t = localtime (&tim) ;
+
+ sprintf (buf, "%02d:%02d:%02d", t->tm_hour, t->tm_min, t->tm_sec) ;
+
+ lcdPosition (lcd, (cols - 8) / 2, 1) ;
+ lcdPuts (lcd, buf) ;
+
+ if (rows == 2)
+ continue ;
+
+ sprintf (buf, "%02d/%02d/%04d", t->tm_mday, t->tm_mon + 1, t->tm_year+1900) ;
+
+ lcdPosition (lcd, (cols - 10) / 2, 2) ;
+ lcdPuts (lcd, buf) ;
+
+ pingPong (lcd, cols) ;