aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreinelt <>2003-09-09 05:30:34 +0000
committerreinelt <>2003-09-09 05:30:34 +0000
commitb39a42b909dfb1c174044cf977d272f94445b18e (patch)
tree5170a8ead387da3151f849852239cdbbac5b72dc
parent9e7b5817f97f51696d6f17a77c4a4ed82114a113 (diff)
downloadlcd4linux-b39a42b909dfb1c174044cf977d272f94445b18e.tar.gz
[lcd4linux @ 2003-09-09 05:30:33 by reinelt]
even more icons stuff
-rw-r--r--MatrixOrbital.c14
-rw-r--r--TODO23
-rw-r--r--USBLCD.c43
-rw-r--r--bar.c18
-rw-r--r--display.c28
-rw-r--r--display.h9
-rw-r--r--icon.c109
-rw-r--r--icon.h7
-rw-r--r--lcd4linux.c32
-rw-r--r--processor.c43
-rw-r--r--processor.h7
11 files changed, 243 insertions, 90 deletions
diff --git a/MatrixOrbital.c b/MatrixOrbital.c
index bf45282..f27b04a 100644
--- a/MatrixOrbital.c
+++ b/MatrixOrbital.c
@@ -1,4 +1,4 @@
-/* $Id: MatrixOrbital.c,v 1.35 2003/09/01 04:09:34 reinelt Exp $
+/* $Id: MatrixOrbital.c,v 1.36 2003/09/09 05:30:33 reinelt Exp $
*
* driver for Matrix Orbital serial display modules
*
@@ -20,6 +20,9 @@
*
*
* $Log: MatrixOrbital.c,v $
+ * Revision 1.36 2003/09/09 05:30:33 reinelt
+ * even more icons stuff
+ *
* Revision 1.35 2003/09/01 04:09:34 reinelt
* icons nearly finished, but MatrixOrbital only
*
@@ -274,6 +277,7 @@ static int MO_clear (int protocol)
int gpo;
memset (FrameBuffer1, ' ', Lcd.rows*Lcd.cols*sizeof(char));
+
icon_clear();
bar_clear();
GPO=0;
@@ -365,18 +369,16 @@ static int MO_init (LCD *Self, int protocol)
s=cfg_get("Icons", "0");
Icons=strtol(s, &e, 0);
if (*e!='\0' || Icons<0 || Icons>8) {
- debug ("Icons=%d e=<%s>", Icons, e);
error ("MatrixOrbital: bad Icons '%s' in %s, must be between 0 and 8", s, cfg_source());
return -1;
}
if (Icons>0) {
info ("reserving %d of %d user-defined characters for icons", Icons, CHARS);
+ icon_init(Lcd.rows, Lcd.cols, XRES, YRES, CHARS, Icons, MO_define_char);
Self->icons=Icons;
Lcd.icons=Icons;
}
- icon_init(Lcd.rows, Lcd.cols, XRES, YRES, CHARS, Icons, MO_define_char);
-
bar_init(Lcd.rows, Lcd.cols, XRES, YRES, CHARS-Icons);
bar_add_segment( 0, 0,255, 32); // ASCII 32 = blank
bar_add_segment(255,255,255,255); // ASCII 255 = block
@@ -446,9 +448,9 @@ int MO_icon_old (int num, int row, int col, unsigned char *bitmap)
}
-int MO_icon (int num, int row, int col)
+int MO_icon (int num, int seq, int row, int col)
{
- return icon_draw (num, row, col);
+ return icon_draw (num, seq, row, col);
}
diff --git a/TODO b/TODO
index 2ff0042..aead6e4 100644
--- a/TODO
+++ b/TODO
@@ -58,10 +58,11 @@ will be done with the big config-rework
// at least try to....
// done 2001-03-14 -mr
-2001-03-09 Leo Tötsch <lt@toetsch.at>
-read configuration file earlier (before forking) so that specific drivers
-(especially 'Text') would not fork.
-There's a reason for forking that early, but I forgot...
+// 2001-03-09 Leo Tötsch <lt@toetsch.at>
+// read configuration file earlier (before forking) so that specific drivers
+// (especially 'Text') would not fork.
+// There's a reason for forking that early, but I forgot...
+// done somewhere in mid 2003 MR
2001-03-12 Michael Reinelt <reinelt@eunet.at>
remove USE_OLD_UDELAY after wide testing of new udelay code
@@ -89,10 +90,11 @@ change network clients to support different devices
at the moment the sum of all eth* devices is calculated
%n* should be extended tokens
-2001-03-24 Brian Cleven <lcleven@home.com>
-support 40x4 displays with two HD44780 chips on it
-we need another 'Enable' line for this
-this way one could connect two displays to one parallel port, too
+// 2001-03-24 Brian Cleven <lcleven@home.com>
+// support 40x4 displays with two HD44780 chips on it
+// we need another 'Enable' line for this
+// this way one could connect two displays to one parallel port, too
+// done with 0.9.11 MR
// 2001-05-25 Jens Garthe <outline@xslan.de>
// detect wether curses.h and libncurses is installed, and
@@ -126,3 +128,8 @@ should resume
2002-02-15 Udo Altmann (udo.altmann@web.de)
support for inversed/blinking text
don't know if displays support this feature...
+
+2003-09-08 Michael Reinelt (reinelt@eunet.at>
+at least one of my HD44780 displays use an inverted "P" instead of
+a full block. Therefore a bar my look strange. Make the ASCII code
+of the full block configurable...
diff --git a/USBLCD.c b/USBLCD.c
index a3871aa..54a0c02 100644
--- a/USBLCD.c
+++ b/USBLCD.c
@@ -1,4 +1,4 @@
-/* $Id: USBLCD.c,v 1.12 2003/08/24 05:17:58 reinelt Exp $
+/* $Id: USBLCD.c,v 1.13 2003/09/09 05:30:34 reinelt Exp $
*
* Driver for USBLCD ( see http://www.usblcd.de )
* This Driver is based on HD44780.c
@@ -22,6 +22,9 @@
*
*
* $Log: USBLCD.c,v $
+ * Revision 1.13 2003/09/09 05:30:34 reinelt
+ * even more icons stuff
+ *
* Revision 1.12 2003/08/24 05:17:58 reinelt
* liblcd4linux patch from Patrick Schemitz
*
@@ -90,6 +93,7 @@
#include "debug.h"
#include "cfg.h"
#include "display.h"
+#include "icon.h"
#include "bar.h"
#define GET_HARD_VERSION 1
@@ -102,6 +106,7 @@
static LCD Lcd;
static char *Port=NULL;
static int usblcd_file;
+static int Icons;
static char *FrameBuffer1=NULL;
static char *FrameBuffer2=NULL;
@@ -203,6 +208,8 @@ int USBLCD_clear (int full)
{
memset (FrameBuffer1, ' ', Lcd.rows*Lcd.cols*sizeof(char));
+
+ icon_clear();
bar_clear();
if (full) {
@@ -217,7 +224,7 @@ int USBLCD_clear (int full)
int USBLCD_init (LCD *Self)
{
int rows=-1, cols=-1 ;
- char *port,*s ;
+ char *port, *s, *e;
if (Port) {
free(Port);
@@ -268,7 +275,21 @@ int USBLCD_init (LCD *Self)
if (USBLCD_open()!=0)
return -1;
- bar_init(rows, cols, XRES, YRES, CHARS);
+ s=cfg_get("Icons", "0");
+ Icons=strtol(s, &e, 0);
+ if (*e!='\0' || Icons<0 || Icons>8) {
+ debug ("Icons=%d e=<%s>", Icons, e);
+ error ("USBLCD: bad Icons '%s' in %s, must be between 0 and 8", s, cfg_source());
+ return -1;
+ }
+ if (Icons>0) {
+ info ("reserving %d of %d user-defined characters for icons", Icons, CHARS);
+ icon_init(Lcd.rows, Lcd.cols, XRES, YRES, CHARS, Icons, USBLCD_define_char);
+ Self->icons=Icons;
+ Lcd.icons=Icons;
+ }
+
+ bar_init(rows, cols, XRES, YRES, CHARS-Icons);
bar_add_segment( 0, 0,255, 32); // ASCII 32 = blank
bar_add_segment(255,255,255,255); // ASCII 255 = block
@@ -304,11 +325,18 @@ int USBLCD_bar (int type, int row, int col, int max, int len1, int len2)
}
+int USBLCD_icon (int num, int seq, int row, int col)
+{
+ return icon_draw (num, seq, row, col);
+}
+
+
int USBLCD_flush (void)
{
int row, col, pos1, pos2;
int c, equal;
-
+ static int junk=0; //Fixme
+
bar_process(USBLCD_define_char);
for (row=0; row<Lcd.rows; row++) {
@@ -316,6 +344,11 @@ int USBLCD_flush (void)
c=bar_peek(row, col);
if (c!=-1) {
FrameBuffer1[row*Lcd.cols+col]=(char)c;
+ } else {
+ c=icon_peek(row, col);
+ if (c!=-1) {
+ FrameBuffer1[row*Lcd.cols+col]=(char)c;
+ }
}
}
for (col=0; col<Lcd.cols; col++) {
@@ -377,11 +410,13 @@ LCD USBLCD[] = {
xres: XRES,
yres: YRES,
bars: BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2,
+ icons: 0,
gpos: 0,
init: USBLCD_init,
clear: USBLCD_clear,
put: USBLCD_put,
bar: USBLCD_bar,
+ icon: USBLCD_icon,
gpo: NULL,
flush: USBLCD_flush,
quit: USBLCD_quit
diff --git a/bar.c b/bar.c
index 9b3f826..f6e96bf 100644
--- a/bar.c
+++ b/bar.c
@@ -1,4 +1,4 @@
-/* $Id: bar.c,v 1.7 2003/09/01 04:09:34 reinelt Exp $
+/* $Id: bar.c,v 1.8 2003/09/09 05:30:34 reinelt Exp $
*
* generic bar handling
*
@@ -20,6 +20,9 @@
*
*
* $Log: bar.c,v $
+ * Revision 1.8 2003/09/09 05:30:34 reinelt
+ * even more icons stuff
+ *
* Revision 1.7 2003/09/01 04:09:34 reinelt
* icons nearly finished, but MatrixOrbital only
*
@@ -211,8 +214,10 @@ int bar_draw (int type, int row, int col, int max, int len1, int len2)
static void create_segments (void)
{
+ int RES;
int i, j, n;
-
+ int l1, l2;
+
/* find first unused segment */
for (i=fSegment; i<nSegment && Segment[i].used; i++);
@@ -226,10 +231,13 @@ static void create_segments (void)
/* create needed segments */
for (n=0; n<ROWS*COLS; n++) {
if (Bar[n].type==0) continue;
+ RES=Bar[n].type & BAR_H ? XRES:YRES;
for (i=0; i<nSegment; i++) {
- if (Segment[i].type & Bar[n].type &&
- Segment[i].len1== Bar[n].len1 &&
- Segment[i].len2== Bar[n].len2) break;
+ if (Segment[i].type & Bar[n].type) {
+ l1=Segment[i].len1; if (l1>RES) l1=RES;
+ l2=Segment[i].len2; if (l2>RES) l2=RES;
+ if (l1 == Bar[n].len1 && l2 == Bar[n].len2) break;
+ }
}
if (i==nSegment) {
nSegment++;
diff --git a/display.c b/display.c
index 5028b02..ecc58a5 100644
--- a/display.c
+++ b/display.c
@@ -1,4 +1,4 @@
-/* $Id: display.c,v 1.40 2003/09/01 04:09:34 reinelt Exp $
+/* $Id: display.c,v 1.41 2003/09/09 05:30:34 reinelt Exp $
*
* framework for device drivers
*
@@ -20,6 +20,9 @@
*
*
* $Log: display.c,v $
+ * Revision 1.41 2003/09/09 05:30:34 reinelt
+ * even more icons stuff
+ *
* Revision 1.40 2003/09/01 04:09:34 reinelt
* icons nearly finished, but MatrixOrbital only
*
@@ -199,6 +202,9 @@
* int lcd_bar (int type, int row, int col, int max, int len1, int len2)
* draws a specified bar at row, col with len
*
+ * int lcd_icon (int num, int seq, int row, int col)
+ * draws icon #num sequence #seq at row, col
+ *
* int lcd_gpo (int num, int val)
* sets GPO #num to val
*
@@ -290,6 +296,7 @@ FAMILY Driver[] = {
static LCD *Lcd = NULL;
+
int lcd_list (void)
{
int i, j;
@@ -306,6 +313,7 @@ int lcd_list (void)
return 0;
}
+
int lcd_init (char *driver)
{
int i, j;
@@ -322,6 +330,7 @@ int lcd_init (char *driver)
return -1;
}
+
int lcd_query (int *rows, int *cols, int *xres, int *yres, int *bars, int *icons, int *gpos)
{
if (Lcd==NULL)
@@ -338,6 +347,7 @@ int lcd_query (int *rows, int *cols, int *xres, int *yres, int *bars, int *icons
return 0;
}
+
int lcd_clear (int full)
{
if (Lcd->clear==NULL) return 0;
@@ -352,8 +362,10 @@ int lcd_put (int row, int col, char *text)
return Lcd->put(row-1, col-1, text);
}
+
int lcd_bar (int type, int row, int col, int max, int len1, int len2)
{
+ if (Lcd->bar==NULL) return 0;
if (row<1 || row>Lcd->rows) return -1;
if (col<1 || col>Lcd->cols) return -1;
if (!(type & (BAR_H2 | BAR_V2 | BAR_T))) len2=len1;
@@ -362,32 +374,36 @@ int lcd_bar (int type, int row, int col, int max, int len1, int len2)
if (!(type & BAR_T))
len2=(double)max*log(len2+1)/log(max);
}
- if (Lcd->bar==NULL) return 0;
return Lcd->bar (type & BAR_HV, row-1, col-1, max, len1, len2);
}
-int lcd_icon (int num, int row, int col)
+
+int lcd_icon (int num, int seq, int row, int col)
{
+ if (Lcd->icon==NULL) return 0;
if (num<1 || num>Lcd->icons) return -1;
+ if (seq<1) return -1;
if (row<1 || row>Lcd->rows) return -1;
if (col<1 || col>Lcd->cols) return -1;
- if (Lcd->icon==NULL) return 0;
- return Lcd->icon(num-1, row-1, col-1);
+ return Lcd->icon(num-1, seq-1, row-1, col-1);
}
+
int lcd_gpo (int num, int val)
{
- if (num<1 || num>Lcd->gpos) return -1;
if (Lcd->gpo==NULL) return 0;
+ if (num<1 || num>Lcd->gpos) return -1;
return Lcd->gpo(num-1, val);
}
+
int lcd_flush (void)
{
if (Lcd->flush==NULL) return 0;
return Lcd->flush();
}
+
int lcd_quit (void)
{
if (Lcd->quit==NULL) return 0;
diff --git a/display.h b/display.h
index 11510aa..748f8e6 100644
--- a/display.h
+++ b/display.h
@@ -1,4 +1,4 @@
-/* $Id: display.h,v 1.20 2003/09/01 04:09:34 reinelt Exp $
+/* $Id: display.h,v 1.21 2003/09/09 05:30:34 reinelt Exp $
*
* framework for device drivers
*
@@ -20,6 +20,9 @@
*
*
* $Log: display.h,v $
+ * Revision 1.21 2003/09/09 05:30:34 reinelt
+ * even more icons stuff
+ *
* Revision 1.20 2003/09/01 04:09:34 reinelt
* icons nearly finished, but MatrixOrbital only
*
@@ -115,7 +118,7 @@ typedef struct LCD {
int (*clear) (int full);
int (*put) (int x, int y, char *text);
int (*bar) (int type, int x, int y, int max, int len1, int len2);
- int (*icon) (int num, int row, int col);
+ int (*icon) (int num, int seq, int row, int col);
int (*gpo) (int num, int val);
int (*flush) (void);
int (*quit) (void);
@@ -138,7 +141,7 @@ int lcd_query (int *rows, int *cols, int *xres, int *yres, int *bars, int *icons
int lcd_clear (int full);
int lcd_put (int row, int col, char *text);
int lcd_bar (int type, int row, int col, int max, int len1, int le2);
-int lcd_icon (int num, int row, int col);
+int lcd_icon (int num, int seq, int row, int col);
int lcd_gpo (int num, int val);
int lcd_flush (void);
int lcd_quit (void);
diff --git a/icon.c b/icon.c
index ae5e332..12e5a22 100644
--- a/icon.c
+++ b/icon.c
@@ -1,4 +1,4 @@
-/* $Id: icon.c,v 1.3 2003/09/01 04:09:34 reinelt Exp $
+/* $Id: icon.c,v 1.4 2003/09/09 05:30:34 reinelt Exp $
*
* generic icon and heartbeat handling
*
@@ -20,6 +20,9 @@
*
*
* $Log: icon.c,v $
+ * Revision 1.4 2003/09/09 05:30:34 reinelt
+ * even more icons stuff
+ *
* Revision 1.3 2003/09/01 04:09:34 reinelt
* icons nearly finished, but MatrixOrbital only
*
@@ -32,6 +35,24 @@
*
*/
+/*
+ * exported functions:
+ *
+ * int icon_init (int rows, int cols, int xres, int yres, int chars, int icons,
+ * void(*defchar)(int ascii, char *bitmap))
+ * initializes all icons stuff and reads the bitmaps from config file.
+ *
+ * void icon_clear(void)
+ * clears the icon framebuffer
+ *
+ * int icon_draw (int num, int seq, int row, int col)
+ * puts icon #num sequence #seq at position row, col in the icon framebuffer
+ *
+ * int icon_peek (int row, int col)
+ * returns icon# or -1 if none from position row, col
+ *
+ */
+
#include <stdlib.h>
#include <stdio.h>
@@ -42,6 +63,12 @@
#include "icon.h"
+typedef struct BITMAP {
+ int nData;
+ int lData;
+ char *Data;
+} BITMAP;
+
static int ROWS=0;
static int COLS=0;
static int XRES=0;
@@ -49,35 +76,49 @@ static int YRES=0;
static int CHARS;
static int ICONS=0;
-static int *Screen=NULL;
-static char *Bitmap=NULL;
+static int *Screen=NULL;
+static struct BITMAP *Bitmap=NULL;
+static void(*Defchar)(int ascii, char *bitmap);
+
-static int icon_read_bitmap (int num, char *bitmap)
+static int icon_read_bitmap (int num)
{
- int row, col, len;
+ struct BITMAP *bm = Bitmap+num;
+ int row, n;
char key[15];
- char *val;
- char map;
+ char *val, *v;
+ char *map;
for (row=0; row<YRES; row++) {
snprintf (key, sizeof(key), "Icon%d.Bitmap%d", num+1, row+1);
- val=cfg_get(key, "");
- len=strlen(val);
- map=0;
- debug ("read_bitmap: num=%d row=%d val=<%s> len=%d", num, row, val, len);
- for (col=0; col<XRES; col++) {
- map<<=1;
- if (col<len && val[col]=='*') {
- map|=1;
+ val=cfg_get(key, "");
+ map=bm->Data+row;
+ n=0;
+ for (v=val; *v!='\0'; v++) {
+ if (n>=bm->nData) {
+ bm->nData++;
+ bm->Data=realloc(bm->Data, bm->nData*YRES*sizeof(char));
+ memset (bm->Data+n*YRES, 0, YRES*sizeof(char));
+ map=bm->Data+n*YRES+row;
+ }
+ switch (*v) {
+ case '|':
+ n++;
+ map+=YRES;
+ break;
+ case '*':
+ (*map)<<=1;
+ (*map)|=1;
+ break;
+ default:
+ (*map)<<=1;
}
}
- *(bitmap+row-1)=map;
}
return 0;
}
-
int icon_init (int rows, int cols, int xres, int yres, int chars, int icons,
void(*defchar)(int ascii, char *bitmap))
{
@@ -108,19 +149,23 @@ int icon_init (int rows, int cols, int xres, int yres, int chars, int icons,
free (Bitmap);
}
- if ((Bitmap=malloc(YRES*icons*sizeof(*Bitmap)))==NULL) {
- error ("icon bitmap allocation failed: out of memory");
+ if ((Bitmap=malloc(icons*sizeof(*Bitmap)))==NULL) {
+ error ("icon allocation failed: out of memory");
return -1;
}
-
- memset (Bitmap, 0, YRES*icons*sizeof(*Bitmap));
+
+ Defchar=defchar;
for (n=0; n<icons; n++) {
- icon_read_bitmap(n, Bitmap+YRES*n);
+ Bitmap[n].nData=1;
+ Bitmap[n].lData=0;
+ Bitmap[n].Data=malloc(YRES*sizeof(char));
+ memset (Bitmap[n].Data, 0, YRES*sizeof(char));
+ icon_read_bitmap(n);
// icons use last ascii codes from userdef chars
- defchar (CHARS-n-1, Bitmap+YRES*n);
+ Defchar (CHARS-n-1, Bitmap[n].Data);
}
-
+
return 0;
}
@@ -136,10 +181,24 @@ void icon_clear(void)
}
-int icon_draw (int num, int row, int col)
+int icon_draw (int num, int seq, int row, int col)
{
+ if (num>=ICONS) return -1;
+ if (row>=ROWS) return -1;
+ if (col>=COLS) return -1;
+
+ seq%=Bitmap[num].nData;
+ if (seq!=Bitmap[num].lData) {
+ Bitmap[num].lData=seq;
+ Defchar (CHARS-num-1, Bitmap[num].Data+seq*YRES);
+ }
+
+ // just redefine icon?
+ if (row<0 || col<0) return 0;
+
// icons use last ascii codes from userdef chars
Screen[row*COLS+col]=CHARS-num-1;
+
return 0;
}
diff --git a/icon.h b/icon.h
index caa3edb..348d63d 100644
--- a/icon.h
+++ b/icon.h
@@ -1,4 +1,4 @@
-/* $Id: icon.h,v 1.2 2003/09/01 04:09:35 reinelt Exp $
+/* $Id: icon.h,v 1.3 2003/09/09 05:30:34 reinelt Exp $
*
* generic icon and heartbeat handling
*
@@ -20,6 +20,9 @@
*
*
* $Log: icon.h,v $
+ * Revision 1.3 2003/09/09 05:30:34 reinelt
+ * even more icons stuff
+ *
* Revision 1.2 2003/09/01 04:09:35 reinelt
* icons nearly finished, but MatrixOrbital only
*
@@ -35,7 +38,7 @@
int icon_init (int rows, int cols, int xres, int yres, int chars, int icons,
void(*defchar)(int ascii, char *bitmap));
void icon_clear(void);
-int icon_draw (int num, int row, int col);
+int icon_draw (int num, int seq, int row, int col);
int icon_peek (int row, int col);
#endif
diff --git a/lcd4linux.c b/lcd4linux.c
index f4e5b28..400fdd0 100644
--- a/lcd4linux.c
+++ b/lcd4linux.c
@@ -1,4 +1,4 @@
-/* $Id: lcd4linux.c,v 1.44 2003/08/24 05:17:58 reinelt Exp $
+/* $Id: lcd4linux.c,v 1.45 2003/09/09 05:30:34 reinelt Exp $
*
* LCD4Linux
*
@@ -20,6 +20,9 @@
*
*
* $Log: lcd4linux.c,v $
+ * Revision 1.45 2003/09/09 05:30:34 reinelt
+ * even more icons stuff
+ *
* Revision 1.44 2003/08/24 05:17:58 reinelt
* liblcd4linux patch from Patrick Schemitz
*
@@ -239,7 +242,6 @@
char *release="LCD4Linux " VERSION " (c) 2003 Michael Reinelt <reinelt@eunet.at>";
char **my_argv;
int got_signal=0;
-int tick, tack;
extern char* output;
@@ -319,7 +321,9 @@ int main (int argc, char *argv[])
{
char *cfg="/etc/lcd4linux.conf";
char *driver;
- int c, smooth;
+ char *s, *e;
+ int c;
+ int tick;
int quiet=0;
// save arguments for restart
@@ -462,27 +466,29 @@ int main (int argc, char *argv[])
signal(SIGQUIT, handler);
signal(SIGTERM, handler);
- tick=atoi(cfg_get("tick","100"));
- tack=atoi(cfg_get("tack","500"));
-
+ s=cfg_get("tick", "100");
+ tick=strtol(s, &e, 0);
+ if (*e!='\0' || tick<0) {
+ error ("bad tick entry '%s' in %s", s, cfg_source());
+ pid_exit(PIDFILE);
+ exit (1);
+ }
+
process_init();
lcd_clear(1);
-
+
if (!quiet && hello()) {
sleep (3);
lcd_clear(1);
}
debug ("starting main loop");
-
- smooth=0;
+
while (got_signal==0) {
- process (smooth);
- smooth+=tick;
- if (smooth>tack) smooth=0;
+ process ();
usleep(tick*1000);
}
-
+
debug ("leaving main loop");
lcd_clear(1);
diff --git a/processor.c b/processor.c
index 1ca308a..67e1129 100644
--- a/processor.c
+++ b/processor.c
@@ -1,4 +1,4 @@
-/* $Id: processor.c,v 1.38 2003/09/01 04:09:35 reinelt Exp $
+/* $Id: processor.c,v 1.39 2003/09/09 05:30:34 reinelt Exp $
*
* main data processing
*
@@ -20,6 +20,9 @@
*
*
* $Log: processor.c,v $
+ * Revision 1.39 2003/09/09 05:30:34 reinelt
+ * even more icons stuff
+ *
* Revision 1.38 2003/09/01 04:09:35 reinelt
* icons nearly finished, but MatrixOrbital only
*
@@ -174,13 +177,12 @@
* void process_init (void);
* does all necessary initializations
*
- * void process (int smooth);
+ * void process ();
* processes a whole screen
- * bars will always be processed
- * texts only if smooth=0
*
*/
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -224,6 +226,7 @@ static struct { int num, unseen;} mail[MAILBOXES+1];
static struct { double val, min, max; } sensor[SENSORS+1];
static struct { double strength, snr; } dvb;
+
static double query (int token)
{
switch (token&255) {
@@ -332,6 +335,7 @@ static double query (int token)
return 0.0;
}
+
/* return a value 0..1 */
static double query_bar (int token)
{
@@ -401,6 +405,7 @@ static double query_bar (int token)
return value;
}
+
static void print_token (int token, char **p, char *start)
{
double val;
@@ -513,12 +518,12 @@ static void print_token (int token, char **p, char *start)
break;
case T_BATT_STAT:
{ int ival = (int) query(token);
- switch (ival) {
- case 0: **p = '='; break;
- case 1: **p = '+'; break;
- case 2: **p = '-'; break;
- default: **p = '?'; break;
- }
+ switch (ival) {
+ case 0: **p = '='; break;
+ case 1: **p = '+'; break;
+ case 2: **p = '-'; break;
+ default: **p = '?'; break;
+ }
}
(*p)++;
break;
@@ -553,10 +558,11 @@ static void print_token (int token, char **p, char *start)
break;
default:
- *p+=sprintf (*p, "%5.0f", query(token));
+ *p+=sprintf (*p, "%5.0f", query(token));
}
}
+
static void collect_data (void)
{
int i;
@@ -635,6 +641,7 @@ static void collect_data (void)
}
+
static char *process_row (char *data, int row, int len)
{
static char buffer[256];
@@ -674,14 +681,14 @@ static char *process_row (char *data, int row, int len)
if (type & BAR_H) {
for (i=0; i<len && p-buffer<cols; i++)
- *p++='\t';
+ *p++=' ';
} else {
- *p++='\t';
+ *p++=' ';
}
} else if (*s=='&') {
- lcd_icon(*(++s)-'0', row, p-buffer+1);
- *p++='\t';
+ lcd_icon(*(++s)-'0', 1, row, p-buffer+1);
+ *p++=' ';
} else {
*p++=*s;
@@ -698,6 +705,7 @@ static char *process_row (char *data, int row, int len)
return buffer;
}
+
static int process_gpo (int n)
{
int token;
@@ -709,6 +717,7 @@ static int process_gpo (int n)
return (val > 0.0);
}
+
static int Turn (void)
{
static struct timeval old = {tv_sec:0, tv_usec:0};
@@ -736,6 +745,7 @@ static int Turn (void)
return 0;
}
+
void process_init (void)
{
int i;
@@ -809,7 +819,8 @@ void process_init (void)
}
}
-void process (int smooth)
+
+void process (void)
{
int i, j, val;
char *txt;
diff --git a/processor.h b/processor.h
index eb489a4..6554590 100644
--- a/processor.h
+++ b/processor.h
@@ -1,4 +1,4 @@
-/* $Id: processor.h,v 1.1 2000/03/22 07:33:50 reinelt Exp $
+/* $Id: processor.h,v 1.2 2003/09/09 05:30:34 reinelt Exp $
*
* main data processing
*
@@ -20,6 +20,9 @@
*
*
* $Log: processor.h,v $
+ * Revision 1.2 2003/09/09 05:30:34 reinelt
+ * even more icons stuff
+ *
* Revision 1.1 2000/03/22 07:33:50 reinelt
*
* FAQ added
@@ -31,6 +34,6 @@
#define _PROCESSOR_H_
void process_init (void);
-void process (int smooth);
+void process (void);
#endif