From 88acd72197974d64901cb7257acb6d758739425f Mon Sep 17 00:00:00 2001 From: marschap Date: Sun, 4 Feb 2007 12:26:54 +0000 Subject: [PATCH] new options for hd44780 (Frank Jepsen) --- CREDITS | 6 ++++++ ChangeLog | 3 ++- LCDd.conf | 10 +++++++++ docs/lcdproc-user/drivers/hd44780.docbook | 26 +++++++++++++++++++++++ server/drivers/hd44780-low.h | 6 ++++++ server/drivers/hd44780.c | 23 +++++++++++++++++++- 6 files changed, 72 insertions(+), 2 deletions(-) diff --git a/CREDITS b/CREDITS index e8d7c0b..64e1f14 100644 --- a/CREDITS +++ b/CREDITS @@ -175,6 +175,7 @@ Lucian Muresan: Matteo Pillon: - lcdserializer connectiontype to the hd44780 driver + - various improvements to the serial connections of the hd44780 driver Laurent Arnal: - connectiontype for LIS2 displays from VLSystem (http://www.vlsys.co.kr) @@ -211,6 +212,11 @@ Benjamin Wiedmann - Added functionality for HITACHI SP14Q002 gLCD (320x240) - Implemented dynamic wiring scheme selection for SED1330 driver ("ConnectionType") +Frank Jepsen + - vdr-wakeup support in hd44780 driver (originally for v0.4.5) + - new options for the hd44780 driver + + Further developers in the sourceforge lcdproc team: Mindaugas Idzelis aim4min Andre Burton andreb diff --git a/ChangeLog b/ChangeLog index 8103a62..9d30f8b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -27,8 +27,9 @@ v.0.5dev (ongoing development) + Hitachi SP14Q002 support & ConnectionType setting for sed1330 (Benjamin Wiedmann) * replace obsolete index() by strchr() (Guillaume LECERF) * fixes for CwLinux driver (Gideon Tsang) - + new ConnectionType vdr-wakeup in hd44780 driver + + new ConnectionType vdr-wakeup in hd44780 driver (originally Frank Jepsen) * fixes for the hd44780-serial drivers (Matteo Pillon) + + new options for the hd44780 driver (Frank Jepsen) v.0.5.1 + config file support in lcdproc client (Andrew Foss) diff --git a/LCDd.conf b/LCDd.conf index 62266e3..df8158f 100644 --- a/LCDd.conf +++ b/LCDd.conf @@ -438,6 +438,16 @@ Charmap=hd44780_default # 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 seconds. Default: 0. +#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 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 --git a/docs/lcdproc-user/drivers/hd44780.docbook b/docs/lcdproc-user/drivers/hd44780.docbook index 86aea6c..a1ad20a 100644 --- a/docs/lcdproc-user/drivers/hd44780.docbook +++ b/docs/lcdproc-user/drivers/hd44780.docbook @@ -1924,6 +1924,32 @@ can be done by specifying "--enable-drivers=all" or by + + + KeepAliveDisplay= + SECONDS + + + 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 0 the character in the + upper left corner is updated every SECONDS seconds. + Default: 0. + + + + + + RefreshDisplay= + SECONDS + + + If you experience occasional garbage on your display you can use this + option as workaround. If set to a value bigger than 0 it forces a + full screen refresh SECONDS seconds. + Default: 0. + + + KeyMatrix_4_1= diff --git a/server/drivers/hd44780-low.h b/server/drivers/hd44780-low.h index 2397413..6ebdaad 100644 --- a/server/drivers/hd44780-low.h +++ b/server/drivers/hd44780-low.h @@ -117,6 +117,12 @@ typedef struct driver_private_data { int backlight_bit; + // force full refresh of display + time_t nextrefresh; + int refreshdisplay; // When >0 make a full display update every seconds + time_t nextkeepalive; + int keepalivedisplay; // When >0 refresh upper left char every seconds to keep display alive + int output_state; // what was most recently output to the output port } PrivateData; diff --git a/server/drivers/hd44780.c b/server/drivers/hd44780.c index 8595660..7ee7631 100644 --- a/server/drivers/hd44780.c +++ b/server/drivers/hd44780.c @@ -161,6 +161,11 @@ HD44780_init (Driver * drvthis) 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, 0 ); + // 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++); @@ -511,6 +516,22 @@ HD44780_flush (Driver *drvthis) 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; @@ -518,7 +539,7 @@ HD44780_flush (Driver *drvthis) 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);