LCDproc development and user support list

Text archives Help


[Lcdproc] Big num on two lines


Chronological Thread 
  • From: dominique.fournier AT grenoble.cnrs.fr (Dominique Fournier)
  • Subject: [Lcdproc] Big num on two lines
  • Date: Sun Jul 2 20:08:01 2006

Hi,

I just write a big num patch wich work on two lines display HD44780.

I hope it can interest somebody...

Dom
diff -ru lcdproc-0.5.0/server/drivers/hd44780.c lcdproc-0.5.0-new/server/drivers/hd44780.c
--- lcdproc-0.5.0/server/drivers/hd44780.c	2006-04-14 14:19:11.000000000 +0200
+++ lcdproc-0.5.0-new/server/drivers/hd44780.c	2006-07-02 21:35:22.000000000 +0200
@@ -780,7 +780,7 @@
 HD44780_init_num (Driver *drvthis)
 {
 	PrivateData *p = (PrivateData *) drvthis->private_data;
-
+	// Four Lines Big Num
 	char bignum_ccs[8][5*8] = {{
 		1, 1, 0, 0, 0,
 		1, 1, 0, 0, 0,
@@ -854,6 +854,81 @@
 		0, 0, 0, 0, 0,
 		0, 0, 0, 0, 0
 	}};
+	// Two lines big nums
+	char bignum_ccs2[8][5*8] = {{
+		1, 1, 1, 1, 1,
+		1, 1, 1, 1, 1,
+		0, 0, 0, 1, 1,
+		0, 0, 0, 1, 1,
+		0, 0, 0, 1, 1,
+		0, 0, 0, 1, 1,
+		1, 1, 1, 1, 1,
+		1, 1, 1, 1, 1
+	}, {
+		1, 1, 1, 1, 1,
+		1, 1, 1, 1, 1,
+		1, 1, 0, 0, 0,
+		1, 1, 0, 0, 0,
+		1, 1, 0, 0, 0,
+		1, 1, 0, 0, 0,
+		1, 1, 1, 1, 1,
+		1, 1, 1, 1, 1
+	}, {
+		1, 1, 1, 1, 1,
+		1, 1, 1, 1, 1,
+		1, 1, 0, 1, 1,
+		1, 1, 0, 1, 1,
+		1, 1, 0, 1, 1,
+		1, 1, 0, 1, 1,
+		1, 1, 1, 1, 1,
+		1, 1, 1, 1, 1
+	}, {
+		1, 1, 0, 1, 1,
+		1, 1, 0, 1, 1,
+		1, 1, 0, 1, 1,
+		1, 1, 0, 1, 1,
+		1, 1, 0, 1, 1,
+		1, 1, 0, 1, 1,
+		1, 1, 1, 1, 1,
+		1, 1, 1, 1, 1
+	}, {
+		0, 0, 0, 1, 1,
+		0, 0, 0, 1, 1,
+		0, 0, 0, 1, 1,
+		0, 0, 0, 1, 1,
+		0, 0, 0, 1, 1,
+		0, 0, 0, 1, 1,
+		0, 0, 0, 1, 1,
+		0, 0, 0, 1, 1
+	}, {
+		0, 0, 0, 1, 1,
+		0, 0, 0, 1, 1,
+		0, 0, 0, 1, 1,
+		0, 0, 0, 1, 1,
+		0, 0, 0, 1, 1,
+		0, 0, 0, 1, 1,
+		1, 1, 1, 1, 1,
+		1, 1, 1, 1, 1
+	}, {
+		1, 1, 1, 1, 1,
+		1, 1, 1, 1, 1,
+		1, 1, 0, 1, 1,
+		1, 1, 0, 1, 1,
+		1, 1, 0, 1, 1,
+		1, 1, 0, 1, 1,
+		1, 1, 0, 1, 1,
+		1, 1, 0, 1, 1
+	}, {
+		1, 1, 1, 1, 1,
+		1, 1, 1, 1, 1,
+		0, 0, 0, 1, 1,
+		0, 0, 0, 1, 1,
+		0, 0, 0, 1, 1,
+		0, 0, 0, 1, 1,
+		0, 0, 0, 1, 1,
+		0, 0, 0, 1, 1
+	}};
+
 
 	if (p->ccmode != CCMODE_BIGNUM) {
 		int i;
@@ -865,8 +940,12 @@
 		}
 		p->ccmode = CCMODE_BIGNUM;
 
-		for (i = 0; i < 8; i++)
-			HD44780_set_char (drvthis, i, bignum_ccs[i]);
+		for (i = 0; i < 8; i++) {
+			if (p->height == 2)
+				HD44780_set_char (drvthis, i, bignum_ccs2[i]);
+			else
+				HD44780_set_char (drvthis, i, bignum_ccs[i]);
+		}
 	}
 }
 
@@ -878,6 +957,7 @@
 {
 	PrivateData *p = (PrivateData *) drvthis->private_data;
 
+	// Four lines bignums
 	char bignum_map[11][4][3] = {
 	{ /* 0: */
 		{  1,  2,  3 }, 
@@ -935,6 +1015,40 @@
 		{  7, 32, 32 },
 		{ 32, 32, 32 } }
 	};
+	// Two lines bignums
+	char bignum_map2[10][2][1] = {
+                { // 0:
+                        { 6 },
+                        { 3 } },
+                { // 1:
+                        { 4 },
+                        { 4 } },
+                { // 2:
+                        { 0 },
+                        { 1 } },
+                { // 3:
+                        { 0 },
+                        { 0 } },
+                { // 4:
+                        { 3 },
+                        { 4 } },
+                { // 5:
+                        { 1 },
+                        { 0 } },
+                { // 6:
+                        { 1 },
+                        { 2 } },
+                { // 7:
+                        { 7 },
+                        { 4 } },
+                { // 8:
+                        { 2 },
+                        { 2 } },
+                { // 9:
+                        { 2 },
+                        { 5 } }
+	};
+
 
 	if ((num < 0) || (num > 10))
 		return;
@@ -952,10 +1066,16 @@
 			if (num == 10)
 				x2 = 2; /* =break, for colon only */
 		}
-	}
-	else
+	} else if (p->height == 2) {
+		int y = 1;
+                HD44780_init_num(drvthis);
+
+		HD44780_chr( drvthis, x, y, bignum_map2[num][0][0] );
+		HD44780_chr( drvthis, x, y+1, bignum_map2[num][1][0] );
+	} else	{
 		HD44780_chr(drvthis, x, 1 + (p->height - 1) / 2,
 			    (num == 10) ? ':' : (num + '0'));
+	}
 }

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature




Archive powered by MHonArc 2.6.18.

Top of page