From fa39c49d89bfd41fed4641e6fb31035d1beef6e3 Mon Sep 17 00:00:00 2001 From: reinelt Date: Thu, 7 Dec 2000 20:47:54 +0000 Subject: [lcd4linux @ 2000-12-07 20:47:54 by reinelt] first try for SIN bars git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@75 3ae390bd-cb1e-0410-b409-cd5a39f66f1f --- SIN.c | 48 ++++++++++++++++++++++++++++++++++++++++-------- TODO | 15 ++++++++++++++- lcd4linux.conf.sample | 2 +- 3 files changed, 55 insertions(+), 10 deletions(-) diff --git a/SIN.c b/SIN.c index d5c8e46..0c2ebcb 100644 --- a/SIN.c +++ b/SIN.c @@ -1,4 +1,4 @@ -/* $Id: SIN.c,v 1.4 2000/12/01 20:42:37 reinelt Exp $ +/* $Id: SIN.c,v 1.5 2000/12/07 20:47:54 reinelt Exp $ * * driver for SIN router displays * @@ -20,6 +20,10 @@ * * * $Log: SIN.c,v $ + * Revision 1.5 2000/12/07 20:47:54 reinelt + * + * first try for SIN bars + * * Revision 1.4 2000/12/01 20:42:37 reinelt * * added debugging of SIN driver output, probably found the positioning bug (format %02x instead of %2x) @@ -43,8 +47,7 @@ * * exported fuctions: * - * struct LCD SIN[] - * + * struct LCD SIN[] * */ #include @@ -61,11 +64,11 @@ #include "lock.h" #include "display.h" -#define XRES 5 -#define YRES 8 +// FIXME: 6x8 +#define XRES 1 +#define YRES 1 -// Fixme: Bar Support disabled -#define BARS 0 +#define BARS ( BAR_L | BAR_R ) static LCD Lcd; static char *Port=NULL; @@ -193,6 +196,35 @@ int SIN_put (int row, int col, char *text) return 0; } +int SIN_bar (int type, int row, int col, int max, int len, int dummy) +{ + int rev=0; + + if (len<1) len=1; + else if (len>max) len=max; + + switch (type) { + case BAR_L: + len=max-len; + rev=1; + + case BAR_R: + while (max>0 && col<=Lcd.cols) { + if (len>=XRES) { + Txt[row][col]=rev?0x19:0x18; + len-=XRES; + } else { + Txt[row][col]=rev?0x18:0x19; + len=0; + } + max-=XRES; + col++; + } + break; + } + return 0; +} + int SIN_flush (void) { char buffer[256]="\015\033T"; // place text @@ -223,6 +255,6 @@ int SIN_quit (void) } LCD SIN[] = { - { "SIN", 8, 40, XRES, YRES, BARS, SIN_init, SIN_clear, SIN_put, NULL, SIN_flush, SIN_quit }, + { "SIN", 8, 40, XRES, YRES, BARS, SIN_init, SIN_clear, SIN_put, SIN_bar, SIN_flush, SIN_quit }, { NULL } }; diff --git a/TODO b/TODO index d894a32..ef90d30 100644 --- a/TODO +++ b/TODO @@ -13,4 +13,17 @@ show partition information (used, free, ...) 2000-04-25 Michael Mueller show process information -$Id: TODO,v 1.2 2000/04/28 05:19:55 reinelt Exp $ +2000-12-03 Ghassan Matar +show other sensors than temperature +we have to use libsensors instead of parsing the proc files directly + +2000-12-03 Ghassan Matar +show contents of any text file +the file should only contain one line, with a fixed format +there are two possibilities: text and numbers +numbers can be used for bars, too + +2000-12-03 Ghassan Matar +accept data from external sources (fifo?) + +$Id: TODO,v 1.3 2000/12/07 20:47:54 reinelt Exp $ diff --git a/lcd4linux.conf.sample b/lcd4linux.conf.sample index fd4d0ac..fac0770 100644 --- a/lcd4linux.conf.sample +++ b/lcd4linux.conf.sample @@ -42,7 +42,7 @@ #background \#a0d000 Display SIN -Port /dev/ttyS1 +Port /dev/tty9 Row1 "Disk%dm $R10dr+dw" Row2 "Net %nm $R10nr+nw" -- cgit v1.2.3