[Lcdproc] Re: lcdproc-0.5.1 and serialized HD44780 on k-data wake-up 2.0 module

Frank Jepsen lcdproc@jepsennet.de
Fri Feb 2 19:51:02 2007


This is a multi-part message in MIME format.
--------------090302070805010302090909
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Hello Matteo,

when got home this evening I downloaded the lcdproc snapshot from tonight.

> You're right, we should implement both...
> Maybe the RefreshDisplay from your patch could be easly ported...
> Next week, I'll look if it can be done and start working on keepalive.

Attached you will find my patch.

Bye Frank

--------------090302070805010302090909
Content-Type: text/plain;
 name="lcdproc-0.5.1-fj1.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="lcdproc-0.5.1-fj1.diff"

diff -ruN --exclude-from=/usr/src/lcdproc/diff_ignore lcdproc-CVS-current-20070202.org/LCDd.conf lcdproc-CVS-current-20070202/LCDd.conf
--- lcdproc-CVS-current-20070202.org/LCDd.conf	2007-02-02 18:30:00.000000000 +0100
+++ lcdproc-CVS-current-20070202/LCDd.conf	2007-02-02 20:44:04.000000000 +0100
@@ -438,6 +438,16 @@
 # to increase the delays. Default: 1.
 #DelayMult=2
 
+# Some displays (e.g. vdr-wakeup) need a message from the driver to that it
+# is still alive. When set to a value bigger then null the character in the
+# upper left corner is updated every <KeepAliveDisplay> seconds. Default: 2.
+#KeepAliveDisplay=0
+
+# If you experience occasional garbage on your display you can use this
+# option as workaround. If set to a value bigger than null it forces a
+# full screen refresh <RefreshDiplay> seconds. Default: 0.
+#RefreshDisplay=5
+
 # You can reduce the inserted delays by setting this to false.
 # On fast PCs it is possible your LCD does not respond correctly.
 # Default: true.
diff -ruN --exclude-from=/usr/src/lcdproc/diff_ignore lcdproc-CVS-current-20070202.org/server/drivers/hd44780.c lcdproc-CVS-current-20070202/server/drivers/hd44780.c
--- lcdproc-CVS-current-20070202.org/server/drivers/hd44780.c	2007-02-02 18:30:00.000000000 +0100
+++ lcdproc-CVS-current-20070202/server/drivers/hd44780.c	2007-02-02 20:19:57.000000000 +0100
@@ -161,6 +161,11 @@
 	p->delayBus 		= drvthis->config_get_bool( drvthis->name, "delaybus", 0, 1 );
 	p->lastline 		= drvthis->config_get_bool( drvthis->name, "lastline", 0, 1 );
 
+	p->nextrefresh		= 0;
+	p->refreshdisplay 	= drvthis->config_get_int( drvthis->name, "refreshdisplay", 0, 0 );
+	p->nextkeepalive	= 0;
+	p->keepalivedisplay = drvthis->config_get_int( drvthis->name, "keepalivedisplay", 0, 2 );
+
 	// Get and search for the connection type
 	s = drvthis->config_get_string( drvthis->name, "ConnectionType", 0, "4bit" );
 	for (i = 0; connectionMapping[i].name != NULL && strcmp (s, connectionMapping[i].name) != 0; i++);
@@ -507,6 +512,22 @@
 	int row;
 	int i;
 	int count;
+	char refreshNow=0;
+	char keepaliveNow=0;
+
+	// force full refresh of display
+	if (p->refreshdisplay > 0 && time(NULL) > p->nextrefresh)
+	{
+		refreshNow = 1;
+		p->nextrefresh=time(NULL) + p->refreshdisplay;
+	}
+	// keepalive refresh of display
+	if (p->keepalivedisplay > 0 && time(NULL) > p->nextkeepalive)
+	{
+		keepaliveNow = 1;
+		p->nextkeepalive=time(NULL) + p->keepalivedisplay;
+	}
+
 
 	// Update LCD incrementally by comparing with last contents
 	count = 0;
@@ -514,7 +535,7 @@
 		drawing = 0;
 		for (x = 0 ; x < wid; x++) {
 			ch = p->framebuf[(y * wid) + x];
-			if ( ch != p->lcd_contents[(y*wid)+x] ) {
+			if ( refreshNow || (x + y == 0 && keepaliveNow) || ch != p->lcd_contents[(y*wid)+x] ) {
 				if ( !drawing || x % 8 == 0 ) { // x%8 is for 16x1 displays !
 					drawing = 1;
 					HD44780_position(drvthis,x,y);
diff -ruN --exclude-from=/usr/src/lcdproc/diff_ignore lcdproc-CVS-current-20070202.org/server/drivers/hd44780-low.h lcdproc-CVS-current-20070202/server/drivers/hd44780-low.h
--- lcdproc-CVS-current-20070202.org/server/drivers/hd44780-low.h	2007-02-02 18:30:00.000000000 +0100
+++ lcdproc-CVS-current-20070202/server/drivers/hd44780-low.h	2007-02-02 20:03:04.000000000 +0100
@@ -117,6 +117,12 @@
 
 	int backlight_bit;
 
+	// force full refresh of display
+	time_t nextrefresh;
+	int refreshdisplay;     // When >0 make a full display update every <refreshdisplay> seconds
+	time_t nextkeepalive;
+	int keepalivedisplay;   // When >0 refresh upper left char every <keepalivedisplay> seconds to keep display alive
+
 	int output_state;	// what was most recently output to the output port
 } PrivateData;
 
diff -ruN --exclude-from=/usr/src/lcdproc/diff_ignore lcdproc-CVS-current-20070202.org/stamp-h1 lcdproc-CVS-current-20070202/stamp-h1
--- lcdproc-CVS-current-20070202.org/stamp-h1	1970-01-01 01:00:00.000000000 +0100
+++ lcdproc-CVS-current-20070202/stamp-h1	2007-02-02 20:17:11.000000000 +0100
@@ -0,0 +1 @@
+timestamp for config.h

--------------090302070805010302090909--