From 0ec6be5c5334768655395a3f6a3c6ed38c380e8d Mon Sep 17 00:00:00 2001 From: reinelt Date: Sat, 18 Mar 2000 08:07:04 +0000 Subject: [lcd4linux @ 2000-03-18 08:07:04 by reinelt] vertical bars implemented bar compaction improved memory information implemented git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@12 3ae390bd-cb1e-0410-b409-cd5a39f66f1f --- MatrixOrbital.c | 110 +++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 86 insertions(+), 24 deletions(-) (limited to 'MatrixOrbital.c') diff --git a/MatrixOrbital.c b/MatrixOrbital.c index 8e7a0c5..0762b87 100644 --- a/MatrixOrbital.c +++ b/MatrixOrbital.c @@ -1,4 +1,4 @@ -/* $Id: MatrixOrbital.c,v 1.6 2000/03/17 09:21:42 reinelt Exp $ +/* $Id: MatrixOrbital.c,v 1.7 2000/03/18 08:07:04 reinelt Exp $ * * driver for Matrix Orbital serial display modules * @@ -20,6 +20,12 @@ * * * $Log: MatrixOrbital.c,v $ + * Revision 1.7 2000/03/18 08:07:04 reinelt + * + * vertical bars implemented + * bar compaction improved + * memory information implemented + * * Revision 1.6 2000/03/17 09:21:42 reinelt * * various memory statistics added @@ -59,8 +65,7 @@ #define XRES 5 #define YRES 8 #define CHARS 8 -#define BARS ( BAR_L | BAR_R | BAR_H2 ) -// Fixme: BAR_U, BAR_D +#define BARS ( BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2 ) static DISPLAY Display; static char *Port=NULL; @@ -86,8 +91,8 @@ static char Txt[4][40]; static BAR Bar[4][40]; static int nSegment=2; -static SEGMENT Segment[256] = {{ len1: 0, len2: 0, type:255, used:0, ascii:32 }, - { len1:XRES, len2:XRES, type:255, used:0, ascii:255 }}; +static SEGMENT Segment[256] = {{ len1:0, len2:0, type:255, used:0, ascii:32 }, + { len1:255, len2:255, type:255, used:0, ascii:255 }}; static int MO_open (void) @@ -170,35 +175,49 @@ static void MO_process_bars (void) } } -#define sqr(x) ((x)*(x)) +static int MO_segment_diff (int i, int j) +{ + int RES; + int i1, i2, j1, j2; + + if (i==j) return 65535; + if (!(Segment[i].type & Segment[j].type)) return 65535; + if (Segment[i].len1==0 && Segment[j].len1!=0) return 65535; + if (Segment[i].len2==0 && Segment[j].len2!=0) return 65535; + RES=Segment[i].type & BAR_H ? XRES:YRES; + if (Segment[i].len1>=RES && Segment[j].len1=RES && Segment[j].len2RES) i1=RES; + i2=Segment[i].len2; if (i2>RES) i2=RES; + j1=Segment[j].len1; if (j1>RES) i1=RES; + j2=Segment[j].len2; if (j2>RES) i2=RES; + + return (i1-i2)*(i1-i2)+(j1-j2)*(j1-j2); +} static void MO_compact_bars (void) { int i, j, r, c, min; int pack_i, pack_j; + int pass1=1; int error[nSegment][nSegment]; if (nSegment>CHARS+2) { + for (i=2; iCHARS+2) { min=65535; pack_i=-1; pack_j=-1; for (i=2; i0 && row<=Display.rows) { + Bar[row][col].type=type; + Bar[row][col].segment=-1; + if (len1>=YRES) { + Bar[row][col].len1=rev?0:YRES; + len1-=YRES; + } else { + Bar[row][col].len1=rev?YRES-len1:len1; + len1=0; + } + if (len2>=YRES) { + Bar[row][col].len2=rev?0:YRES; + len2-=YRES; + } else { + Bar[row][col].len2=rev?YRES-len2:len2; + len2=0; + } + max-=YRES; + row++; + } break; } -- cgit v1.2.3