aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreinelt <>2004-01-20 05:36:59 +0000
committerreinelt <>2004-01-20 05:36:59 +0000
commit35b4d898d72f13de0b787ccd94970f517cd623f3 (patch)
tree425249827b2d9af46849c54f75a446f55369bf38
parent252cb9023289ad2af5993cf53c0d0fd7293cff27 (diff)
downloadlcd4linux-35b4d898d72f13de0b787ccd94970f517cd623f3.tar.gz
[lcd4linux @ 2004-01-20 05:36:59 by reinelt]
moved text-display-specific stuff to drv_generic_text moved all the bar stuff from drv_generic_bar to generic_text
-rw-r--r--Makefile.am2
-rw-r--r--Makefile.in6
-rw-r--r--drv_MatrixOrbital.c10
-rw-r--r--drv_generic.c140
-rw-r--r--drv_generic.h32
-rw-r--r--drv_generic_bar.h43
-rw-r--r--drv_generic_text.c (renamed from drv_generic_bar.c)223
-rw-r--r--drv_generic_text.h75
-rw-r--r--hash.c7
-rw-r--r--lcd4linux.conf.sample2
10 files changed, 288 insertions, 252 deletions
diff --git a/Makefile.am b/Makefile.am
index c11e881..180a9e5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -55,7 +55,7 @@ imon.c imon.h \
display.c display.h \
drv.c drv.h \
drv_generic.c drv_generic.h \
-drv_generic_bar.c \
+drv_generic_text.c drv_generic_text.h \
debug.c debug.h \
cfg.c cfg.h \
lock.c lock.h \
diff --git a/Makefile.in b/Makefile.in
index 18a2148..609db6c 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -106,7 +106,7 @@ lcd4linux_LDADD = @DRIVERS@ @DRVLIBS@
#remove next line for liblcd4linux
lcd4linux_DEPENDENCIES = @DRIVERS@
-lcd4linux_SOURCES = lcd4linux.c pid.c pid.h hash.c hash.h parser.c parser.h processor.c processor.h layout.c layout.h timer.c timer.h evaluator.c evaluator.h widget.c widget.h widget_text.c widget_text.h widget_bar.c widget_bar.h plugin.c plugin.h plugin_math.c plugin_string.c plugin_cfg.c plugin_uname.c plugin_loadavg.c plugin_proc_stat.c plugin_cpuinfo.c plugin_meminfo.c plugin_i2c_sensors.c plugin_xmms.c system.c system.h isdn.c isdn.h wifi.c wifi.h mail.c mail.h seti.c seti.h battery.c battery.h dvb.c dvb.h filter.c filter.h exec.c exec.h expr.c expr.h mail2.c socket.c socket.h imon.c imon.h display.c display.h drv.c drv.h drv_generic.c drv_generic.h drv_generic_bar.c debug.c debug.h cfg.c cfg.h lock.c lock.h pixmap.c pixmap.h bar.c bar.h icon.c icon.h fontmap.c fontmap.h udelay.c udelay.h
+lcd4linux_SOURCES = lcd4linux.c pid.c pid.h hash.c hash.h parser.c parser.h processor.c processor.h layout.c layout.h timer.c timer.h evaluator.c evaluator.h widget.c widget.h widget_text.c widget_text.h widget_bar.c widget_bar.h plugin.c plugin.h plugin_math.c plugin_string.c plugin_cfg.c plugin_uname.c plugin_loadavg.c plugin_proc_stat.c plugin_cpuinfo.c plugin_meminfo.c plugin_i2c_sensors.c plugin_xmms.c system.c system.h isdn.c isdn.h wifi.c wifi.h mail.c mail.h seti.c seti.h battery.c battery.h dvb.c dvb.h filter.c filter.h exec.c exec.h expr.c expr.h mail2.c socket.c socket.h imon.c imon.h display.c display.h drv.c drv.h drv_generic.c drv_generic.h drv_generic_text.c drv_generic_text.h debug.c debug.h cfg.c cfg.h lock.c lock.h pixmap.c pixmap.h bar.c bar.h icon.c icon.h fontmap.c fontmap.h udelay.c udelay.h
#liblcd4linux_la_DEPENDENCIES = @DRIVERS@
@@ -158,7 +158,7 @@ isdn.$(OBJEXT) wifi.$(OBJEXT) mail.$(OBJEXT) seti.$(OBJEXT) \
battery.$(OBJEXT) dvb.$(OBJEXT) filter.$(OBJEXT) exec.$(OBJEXT) \
expr.$(OBJEXT) mail2.$(OBJEXT) socket.$(OBJEXT) imon.$(OBJEXT) \
display.$(OBJEXT) drv.$(OBJEXT) drv_generic.$(OBJEXT) \
-drv_generic_bar.$(OBJEXT) debug.$(OBJEXT) cfg.$(OBJEXT) lock.$(OBJEXT) \
+drv_generic_text.$(OBJEXT) debug.$(OBJEXT) cfg.$(OBJEXT) lock.$(OBJEXT) \
pixmap.$(OBJEXT) bar.$(OBJEXT) icon.$(OBJEXT) fontmap.$(OBJEXT) \
udelay.$(OBJEXT)
CFLAGS = @CFLAGS@
@@ -181,7 +181,7 @@ DEP_FILES = .deps/BeckmannEgle.P .deps/Crystalfontz.P .deps/Cwlinux.P \
.deps/MilfordInstruments.P .deps/PalmPilot.P .deps/Raster.P .deps/SIN.P \
.deps/T6963.P .deps/Text.P .deps/USBLCD.P .deps/XWindow.P .deps/bar.P \
.deps/battery.P .deps/cfg.P .deps/debug.P .deps/display.P .deps/drv.P \
-.deps/drv_MatrixOrbital.P .deps/drv_generic.P .deps/drv_generic_bar.P \
+.deps/drv_MatrixOrbital.P .deps/drv_generic.P .deps/drv_generic_text.P \
.deps/dvb.P .deps/evaluator.P .deps/exec.P .deps/expr.P .deps/filter.P \
.deps/fontmap.P .deps/hash.P .deps/icon.P .deps/imon.P .deps/isdn.P \
.deps/layout.P .deps/lcd4linux.P .deps/lock.P .deps/mail.P \
diff --git a/drv_MatrixOrbital.c b/drv_MatrixOrbital.c
index 1fb70d6..a937ce6 100644
--- a/drv_MatrixOrbital.c
+++ b/drv_MatrixOrbital.c
@@ -1,4 +1,4 @@
-/* $Id: drv_MatrixOrbital.c,v 1.10 2004/01/20 04:51:39 reinelt Exp $
+/* $Id: drv_MatrixOrbital.c,v 1.11 2004/01/20 05:36:59 reinelt Exp $
*
* new style driver for Matrix Orbital serial display modules
*
@@ -23,6 +23,10 @@
*
*
* $Log: drv_MatrixOrbital.c,v $
+ * Revision 1.11 2004/01/20 05:36:59 reinelt
+ * moved text-display-specific stuff to drv_generic_text
+ * moved all the bar stuff from drv_generic_bar to generic_text
+ *
* Revision 1.10 2004/01/20 04:51:39 reinelt
* moved generic stuff from drv_MatrixOrbital to drv_generic
* implemented new-stylish bars which are nearly finished
@@ -93,7 +97,7 @@
#include "widget_bar.h"
#include "drv.h"
#include "drv_generic.h"
-#include "drv_generic_bar.h"
+#include "drv_generic_text.h"
static char Name[]="MatrixOrbital";
@@ -515,7 +519,7 @@ int drv_MO_quit (void) {
info("%s: shutting down.", Name);
drv_generic_serial_close();
- drv_generic_quit();
+ drv_generic_text_quit();
return (0);
}
diff --git a/drv_generic.c b/drv_generic.c
index 3375254..fbec1e9 100644
--- a/drv_generic.c
+++ b/drv_generic.c
@@ -1,4 +1,4 @@
-/* $Id: drv_generic.c,v 1.1 2004/01/20 04:51:39 reinelt Exp $
+/* $Id: drv_generic.c,v 1.2 2004/01/20 05:36:59 reinelt Exp $
*
* generic driver helper for text- and graphic-based displays
*
@@ -23,6 +23,10 @@
*
*
* $Log: drv_generic.c,v $
+ * Revision 1.2 2004/01/20 05:36:59 reinelt
+ * moved text-display-specific stuff to drv_generic_text
+ * moved all the bar stuff from drv_generic_bar to generic_text
+ *
* Revision 1.1 2004/01/20 04:51:39 reinelt
* moved generic stuff from drv_MatrixOrbital to drv_generic
* implemented new-stylish bars which are nearly finished
@@ -62,15 +66,9 @@ static speed_t Speed;
static int Device=-1;
-int DROWS, DCOLS; // display size
-int LROWS, LCOLS; // layout size
-int XRES, YRES; // pixels of one char cell
-int CHARS; // number of user-defineable characters
-
-
-char *LayoutFB = NULL;
-char *DisplayFB = NULL;
-
+// ****************************************
+// *** generic serial/USB communication ***
+// ****************************************
int drv_generic_serial_open (char *driver, char *port, speed_t speed)
{
@@ -168,125 +166,3 @@ int drv_generic_serial_close (void)
return 0;
}
-
-void drv_generic_text_resizeFB (int rows, int cols)
-{
- char *newFB;
- int row, col;
-
- // Fixme: resize Bar FB too!!!!
-
-
- // Layout FB is large enough
- if (rows<=LROWS && cols<=LCOLS)
- return;
-
- // allocate new Layout FB
- newFB=malloc(cols*rows*sizeof(char));
- memset (newFB, ' ', rows*cols*sizeof(char));
-
- // transfer contents
- if (LayoutFB!=NULL) {
- for (row=0; row<LROWS; row++) {
- for (col=0; col<LCOLS; col++) {
- newFB[row*cols+col]=LayoutFB[row*LCOLS+col];
- }
- }
- free (LayoutFB);
- }
-
- LayoutFB = newFB;
- LCOLS = cols;
- LROWS = rows;
-}
-
-
-
-// ****************************************
-// *** widget callbacks ***
-// ****************************************
-
-
-int drv_generic_text_draw_text (WIDGET *W, int goto_len,
- void (*drv_goto)(int row, int col),
- void (*drv_write)(char *buffer, int len))
-{
- WIDGET_TEXT *T=W->data;
- char *txt, *fb1, *fb2;
- int row, col, len, end;
-
- row=W->row;
- col=W->col;
- txt=T->buffer;
- len=strlen(txt);
- end=col+len;
-
- // maybe grow layout framebuffer
- drv_generic_text_resizeFB (row, col+len-1);
-
- fb1 = LayoutFB + row*LCOLS;
- fb2 = DisplayFB + row*DCOLS;
-
- // transfer new text into layout buffer
- memcpy (fb1+col, txt, len);
-
- for (; col<=end; col++) {
- int pos1, pos2, equal;
- if (fb1[col]==fb2[col]) continue;
- drv_goto (row, col);
- for (pos1=col, pos2=pos1, col++, equal=0; col<=end; col++) {
- if (fb1[col]==fb2[col]) {
- // If we find just one equal byte, we don't break, because this
- // would require a goto, which takes several bytes, too.
- if (++equal>goto_len) break;
- } else {
- pos2=col;
- equal=0;
- }
- }
- memcpy (fb2+pos1, fb1+pos1, pos2-pos1+1);
- drv_write (fb2+pos1, pos2-pos1+1);
- }
-
- return 0;
-}
-
-
-// initialize text driver
-int drv_generic_text_init (char *Driver)
-{
- // init display framebuffer
- DisplayFB = (char*)malloc(DCOLS*DROWS*sizeof(char));
- memset (DisplayFB, ' ', DROWS*DCOLS*sizeof(char));
-
- // init layout framebuffer
- LROWS = 0;
- LCOLS = 0;
- LayoutFB=NULL;
- drv_generic_text_resizeFB (DROWS, DCOLS);
-
- // sanity check
- if (LayoutFB==NULL || DisplayFB==NULL) {
- error ("%s: framebuffer could not be allocated: malloc() failed", Driver);
- return -1;
- }
-
- return 0;
-}
-
-
-// close driver
-int drv_generic_quit (void) {
-
- if (LayoutFB) {
- free(LayoutFB);
- LayoutFB=NULL;
- }
-
- if (DisplayFB) {
- free(DisplayFB);
- DisplayFB=NULL;
- }
-
- return (0);
-}
diff --git a/drv_generic.h b/drv_generic.h
index 9194548..52d53d4 100644
--- a/drv_generic.h
+++ b/drv_generic.h
@@ -1,4 +1,4 @@
-/* $Id: drv_generic.h,v 1.1 2004/01/20 04:51:39 reinelt Exp $
+/* $Id: drv_generic.h,v 1.2 2004/01/20 05:36:59 reinelt Exp $
*
* generic driver helper for text- and graphic-based displays
*
@@ -23,6 +23,10 @@
*
*
* $Log: drv_generic.h,v $
+ * Revision 1.2 2004/01/20 05:36:59 reinelt
+ * moved text-display-specific stuff to drv_generic_text
+ * moved all the bar stuff from drv_generic_bar to generic_text
+ *
* Revision 1.1 2004/01/20 04:51:39 reinelt
* moved generic stuff from drv_MatrixOrbital to drv_generic
* implemented new-stylish bars which are nearly finished
@@ -40,35 +44,9 @@
#ifndef _DRV_GENERIC_H_
#define _DRV_GENERIC_H_
-
-#include <termios.h>
-#include "widget.h"
-
-
-extern int DROWS, DCOLS; // display size
-extern int LROWS, LCOLS; // layout size
-extern int XRES, YRES; // pixels of one char cell
-extern int CHARS; // number of user-defineable characters
-
-
-extern char *LayoutFB;
-extern char *DisplayFB;
-
-
int drv_generic_serial_open (char *driver, char *port, speed_t speed);
int drv_generic_serial_read (char *string, int len);
void drv_generic_serial_write (char *string, int len);
int drv_generic_serial_close (void);
-
-int drv_generic_text_init (char *Name);
-void drv_generic_text_resizeFB (int rows, int cols);
-int drv_generic_text_draw_text (WIDGET *W, int goto_len,
- void (*drv_goto)(int row, int col),
- void (*drv_write)(char *buffer, int len));
-
-
-int drv_generic_quit (void);
-
-
#endif
diff --git a/drv_generic_bar.h b/drv_generic_bar.h
deleted file mode 100644
index 8bd3866..0000000
--- a/drv_generic_bar.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* $Id: drv_generic_bar.h,v 1.1 2004/01/20 04:51:39 reinelt Exp $
- *
- * generic driver helper for bar creation
- *
- * Copyright 1999, 2000 Michael Reinelt <reinelt@eunet.at>
- * Copyright 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
- *
- * This file is part of LCD4Linux.
- *
- * LCD4Linux is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * LCD4Linux is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
- * $Log: drv_generic_bar.h,v $
- * Revision 1.1 2004/01/20 04:51:39 reinelt
- * moved generic stuff from drv_MatrixOrbital to drv_generic
- * implemented new-stylish bars which are nearly finished
- *
- */
-
-#ifndef _DRV_GENERIC_BAR_H_
-#define _DRV_GENERIC_BAR_H_
-
-int drv_generic_text_bar_init (void);
-void drv_generic_text_bar_clear(void);
-void drv_generic_text_bar_add_segment(int val1, int val2, DIRECTION dir, int ascii);
-int drv_generic_text_draw_bar (WIDGET *W, int goto_len,
- void (*drv_defchar)(int ascii, char *buffer),
- void (*drv_goto)(int row, int col),
- void (*drv_write)(char *buffer, int len));
-
-#endif
diff --git a/drv_generic_bar.c b/drv_generic_text.c
index 0bf3f7e..d9353fd 100644
--- a/drv_generic_bar.c
+++ b/drv_generic_text.c
@@ -1,6 +1,6 @@
-/* $Id: drv_generic_bar.c,v 1.1 2004/01/20 04:51:39 reinelt Exp $
+/* $Id: drv_generic_text.c,v 1.1 2004/01/20 05:36:59 reinelt Exp $
*
- * generic driver helper for bar creation
+ * generic driver helper for text-based displays
*
* Copyright 1999, 2000 Michael Reinelt <reinelt@eunet.at>
* Copyright 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
@@ -22,10 +22,10 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*
- * $Log: drv_generic_bar.c,v $
- * Revision 1.1 2004/01/20 04:51:39 reinelt
- * moved generic stuff from drv_MatrixOrbital to drv_generic
- * implemented new-stylish bars which are nearly finished
+ * $Log: drv_generic_text.c,v $
+ * Revision 1.1 2004/01/20 05:36:59 reinelt
+ * moved text-display-specific stuff to drv_generic_text
+ * moved all the bar stuff from drv_generic_bar to generic_text
*
*/
@@ -40,13 +40,21 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <termios.h>
+#include <fcntl.h>
#include "debug.h"
-#include "drv.h"
+#include "cfg.h"
+#include "plugin.h"
+#include "lock.h"
#include "widget.h"
+#include "widget_text.h"
#include "widget_bar.h"
+#include "drv.h"
#include "drv_generic.h"
-#include "drv_generic_bar.h"
+#include "drv_generic_text.h"
typedef struct {
@@ -65,34 +73,112 @@ typedef struct {
} SEGMENT;
-static int RES;
+static char *Driver;
+
+int DROWS, DCOLS; // display size
+int LROWS, LCOLS; // layout size
+int XRES, YRES; // pixels of one char cell
+int CHARS; // number of user-defineable characters
+
+char *LayoutFB = NULL;
+char *DisplayFB = NULL;
+static BAR *Bar = NULL;
static int nSegment=0;
static int fSegment=0;
static SEGMENT Segment[128];
-static BAR *Bar=NULL;
+// Fixme: get rid of me!
+static int RES;
-int drv_generic_text_bar_init (void)
+// ****************************************
+// *** generic Framebuffer stuff ***
+// ****************************************
+
+void drv_generic_text_resizeFB (int rows, int cols)
{
- if (Bar) free (Bar);
+ char *newFB;
+ int row, col;
- if ((Bar=malloc (LROWS*LCOLS*sizeof(BAR)))==NULL) {
- error ("bar buffer allocation failed: out of memory");
- return -1;
+ // Fixme: resize Bar FB too!!!!
+
+
+ // Layout FB is large enough
+ if (rows<=LROWS && cols<=LCOLS)
+ return;
+
+ // allocate new Layout FB
+ newFB=malloc(cols*rows*sizeof(char));
+ memset (newFB, ' ', rows*cols*sizeof(char));
+
+ // transfer contents
+ if (LayoutFB!=NULL) {
+ for (row=0; row<LROWS; row++) {
+ for (col=0; col<LCOLS; col++) {
+ newFB[row*cols+col]=LayoutFB[row*LCOLS+col];
+ }
+ }
+ free (LayoutFB);
}
- nSegment=0;
- fSegment=0;
+ LayoutFB = newFB;
+ LCOLS = cols;
+ LROWS = rows;
+}
+
+
+
+int drv_generic_text_draw_text (WIDGET *W, int goto_len,
+ void (*drv_goto)(int row, int col),
+ void (*drv_write)(char *buffer, int len))
+{
+ WIDGET_TEXT *T=W->data;
+ char *txt, *fb1, *fb2;
+ int row, col, len, end;
- drv_generic_text_bar_clear();
+ row=W->row;
+ col=W->col;
+ txt=T->buffer;
+ len=strlen(txt);
+ end=col+len;
+
+ // maybe grow layout framebuffer
+ drv_generic_text_resizeFB (row, col+len-1);
+
+ fb1 = LayoutFB + row*LCOLS;
+ fb2 = DisplayFB + row*DCOLS;
+
+ // transfer new text into layout buffer
+ memcpy (fb1+col, txt, len);
+
+ for (; col<=end; col++) {
+ int pos1, pos2, equal;
+ if (fb1[col]==fb2[col]) continue;
+ drv_goto (row, col);
+ for (pos1=col, pos2=pos1, col++, equal=0; col<=end; col++) {
+ if (fb1[col]==fb2[col]) {
+ // If we find just one equal byte, we don't break, because this
+ // would require a goto, which takes several bytes, too.
+ if (++equal>goto_len) break;
+ } else {
+ pos2=col;
+ equal=0;
+ }
+ }
+ memcpy (fb2+pos1, fb1+pos1, pos2-pos1+1);
+ drv_write (fb2+pos1, pos2-pos1+1);
+ }
return 0;
}
-void drv_generic_text_bar_clear(void)
+// ****************************************
+// *** generic bar handling ***
+// ****************************************
+
+static void drv_generic_text_bar_clear(void)
{
int i;
@@ -109,19 +195,6 @@ void drv_generic_text_bar_clear(void)
}
-void drv_generic_text_bar_add_segment(int val1, int val2, DIRECTION dir, int ascii)
-{
- Segment[fSegment].val1=val1;
- Segment[fSegment].val2=val2;
- Segment[fSegment].dir=dir;
- Segment[fSegment].used=0;
- Segment[fSegment].ascii=ascii;
-
- fSegment++;
- nSegment=fSegment;
-}
-
-
static void drv_generic_text_bar_create_bar (int row, int col, DIRECTION dir, int len, int val1, int val2)
{
int rev=0;
@@ -296,7 +369,7 @@ static void drv_generic_text_bar_pack_segments (void)
}
}
-#if 1
+#if 0
debug ("pack_segment: n=%d i=%d j=%d min=%d", nSegment, pack_i, pack_j, min);
debug ("Pack_segment: i1=%d i2=%d j1=%d j2=%d\n",
Segment[pack_i].val1, Segment[pack_i].val2,
@@ -335,13 +408,13 @@ static void drv_generic_text_bar_define_chars (void(*defchar)(int ascii, char *m
}
Segment[i].ascii=c;
switch (Segment[i].dir) {
- case DIR_EAST:
+ case DIR_WEST:
for (j=0; j<4; j++) {
buffer[j ]=(1<<Segment[i].val1)-1;
buffer[j+4]=(1<<Segment[i].val2)-1;
}
break;
- case DIR_WEST:
+ case DIR_EAST:
for (j=0; j<4; j++) {
buffer[j ]=255<<(XRES-Segment[i].val1);
buffer[j+4]=255<<(XRES-Segment[i].val2);
@@ -457,15 +530,83 @@ int drv_generic_text_draw_bar (WIDGET *W, int goto_len,
}
-int drv_generic_text_bar_peek (int row, int col)
+
+// ****************************************
+// *** generic init/quit ***
+// ****************************************
+
+int drv_generic_text_init (char *driver)
{
- int s;
- s=Bar[row*LCOLS+col].segment;
- if (s==-1) {
+ Driver=driver;
+
+ // init display framebuffer
+ DisplayFB = (char*)malloc(DCOLS*DROWS*sizeof(char));
+ memset (DisplayFB, ' ', DROWS*DCOLS*sizeof(char));
+
+ // init layout framebuffer
+ LROWS = 0;
+ LCOLS = 0;
+ LayoutFB=NULL;
+ drv_generic_text_resizeFB (DROWS, DCOLS);
+
+ // sanity check
+ if (LayoutFB==NULL || DisplayFB==NULL) {
+ error ("%s: framebuffer could not be allocated: malloc() failed", Driver);
return -1;
- } else {
- return Segment[s].ascii;
}
+
+ return 0;
}
+
+int drv_generic_text_bar_init (void)
+{
+ if (Bar) free (Bar);
+
+ if ((Bar=malloc (LROWS*LCOLS*sizeof(BAR)))==NULL) {
+ error ("bar buffer allocation failed: out of memory");
+ return -1;
+ }
+
+ nSegment=0;
+ fSegment=0;
+
+ drv_generic_text_bar_clear();
+
+ return 0;
+}
+
+
+void drv_generic_text_bar_add_segment(int val1, int val2, DIRECTION dir, int ascii)
+{
+ Segment[fSegment].val1=val1;
+ Segment[fSegment].val2=val2;
+ Segment[fSegment].dir=dir;
+ Segment[fSegment].used=0;
+ Segment[fSegment].ascii=ascii;
+
+ fSegment++;
+ nSegment=fSegment;
+}
+
+
+int drv_generic_text_quit (void) {
+
+ if (LayoutFB) {
+ free(LayoutFB);
+ LayoutFB=NULL;
+ }
+
+ if (DisplayFB) {
+ free(DisplayFB);
+ DisplayFB=NULL;
+ }
+
+ if (Bar) {
+ free (Bar);
+ Bar=NULL;
+ }
+
+ return (0);
+}
diff --git a/drv_generic_text.h b/drv_generic_text.h
new file mode 100644
index 0000000..f742427
--- /dev/null
+++ b/drv_generic_text.h
@@ -0,0 +1,75 @@
+/* $Id: drv_generic_text.h,v 1.1 2004/01/20 05:36:59 reinelt Exp $
+ *
+ * generic driver helper for text-based displays
+ *
+ * Copyright 1999, 2000 Michael Reinelt <reinelt@eunet.at>
+ * Copyright 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *
+ * $Log: drv_generic_text.h,v $
+ * Revision 1.1 2004/01/20 05:36:59 reinelt
+ * moved text-display-specific stuff to drv_generic_text
+ * moved all the bar stuff from drv_generic_bar to generic_text
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * Fixme: document me!
+ *
+ */
+
+#ifndef _DRV_GENERIC_TEXT_H_
+#define _DRV_GENERIC_TEXT_H_
+
+
+#include <termios.h>
+#include "widget.h"
+
+
+extern int DROWS, DCOLS; // display size
+extern int LROWS, LCOLS; // layout size
+extern int XRES, YRES; // pixels of one char cell
+extern int CHARS; // number of user-defineable characters
+
+
+extern char *LayoutFB;
+extern char *DisplayFB;
+
+
+int drv_generic_text_init (char *Name);
+void drv_generic_text_resizeFB (int rows, int cols);
+int drv_generic_text_draw_text (WIDGET *W, int goto_len,
+ void (*drv_goto)(int row, int col),
+ void (*drv_write)(char *buffer, int len));
+
+int drv_generic_text_bar_init (void);
+void drv_generic_text_bar_add_segment (int val1, int val2, DIRECTION dir, int ascii);
+int drv_generic_text_draw_bar (WIDGET *W, int goto_len,
+ void (*drv_defchar)(int ascii, char *buffer),
+ void (*drv_goto)(int row, int col),
+ void (*drv_write)(char *buffer, int len));
+
+int drv_generic_text_quit (void);
+
+
+
+#endif
diff --git a/hash.c b/hash.c
index 235a9bc..1c8cb63 100644
--- a/hash.c
+++ b/hash.c
@@ -1,4 +1,4 @@
-/* $Id: hash.c,v 1.5 2004/01/18 09:01:45 reinelt Exp $
+/* $Id: hash.c,v 1.6 2004/01/20 05:36:59 reinelt Exp $
*
* hashes (associative arrays)
*
@@ -23,6 +23,10 @@
*
*
* $Log: hash.c,v $
+ * Revision 1.6 2004/01/20 05:36:59 reinelt
+ * moved text-display-specific stuff to drv_generic_text
+ * moved all the bar stuff from drv_generic_bar to generic_text
+ *
* Revision 1.5 2004/01/18 09:01:45 reinelt
* /proc/stat parsing finished
*
@@ -221,6 +225,7 @@ double hash_get_filter (HASH *Hash, char *key, int delay)
for (i=1; i<FILTER_SLOTS; i++) {
if (Item->Slot[i].time.tv_sec==0) break;
if (timercmp(&Item->Slot[i].time, &end, <)) break;
+ dt = (now.tv_sec - Item->Slot[i].time.tv_sec) + (now.tv_usec - Item->Slot[i].time.tv_usec)/1000000.0;
}
// empty slot => use the one before
diff --git a/lcd4linux.conf.sample b/lcd4linux.conf.sample
index b3ecb18..67afb9c 100644
--- a/lcd4linux.conf.sample
+++ b/lcd4linux.conf.sample
@@ -76,7 +76,7 @@ Layout Default {
}
Row3 {
Col1 'Busy'
- Col10 'BusyBar'
+ Col11 'BusyBar'
}
Row4 {
Col1 'Load'