LCDproc development and user support list

Text archives Help


[Lcdproc] [PATCH] MtxOrb.c - patch 3


Chronological Thread 
  • From: lcdproc AT neko.me.uk (Chris Lansley)
  • Subject: [Lcdproc] [PATCH] MtxOrb.c - patch 3
  • Date: Sun Sep 26 21:51:02 2004

Here's my third patch - sorry about the delay; I've been on holiday!

The main reason for this change is that not all Matrix Orbital displays =
have a full block at position 255; some leave the bottom
row of a built-in character empty, this area is used by the underline =
cursor. There are also a few smaller changes included.


Heres' a quick summary of the change:

LCDd.conf:
Add a new option to use a custom character for a full block rather
than =
character 255. (defaults to old behaviour)

MtxOrb.c:
MtxOrb_init:=20
- Process new option from LCDd.conf.
- Tidy up ifdef out code -- CVS will alway keep a copy if req.
- Remove ONLCR from the serial flags - on my system this
remained set =
and caused transmission errors.
- Send command to enable autotransmit - this should be the
default but =
let's make sure.

MtxOrb_vbar:
- use MtxOrb_ask_bar to get a full bar character rather than
assuming =
255 is a full bar.

MtxOrb_hbar:
- use MtxOrb_ask_bar to get a full bar character rather than
assuming =
255 is a full bar.

MtxOrb_ask_bar:
- if asked for a full bar and they have a full bar at 255,
then use =
that, otherwise
use a custom char.
- define approx chars for filled/empty heart (@/O) rather
than giving =
'?' for both.

MtxOrb_set_known_char:
- define full block.


Below is a patch against the current 0.4.5 branch.

Chris.

diff -u -r1.34.2.15.2.3.2.2 MtxOrb.c
--- server/drivers/MtxOrb.c 18 Sep 2004 13:29:16 -0000
1.34.2.15.2.3.2.2
+++ server/drivers/MtxOrb.c 26 Sep 2004 21:44:59 -0000
@@ -102,8 +102,8 @@
empty_heart =3D 22,
filled_heart =3D 23,
ellipsis =3D 24,
- barw =3D 32,
- barb =3D 255
+ barb =3D 25,
+ barw =3D 32
} bar_type;
=20
static unsigned char *lcd_contains; // what we think is actually on the =
LCD
@@ -116,6 +116,7 @@
static char pause_key =3D MTXORB_DEF_PAUSE_KEY, back_key =3D =
MTXORB_DEF_BACK_KEY;
static char forward_key =3D MTXORB_DEF_FORWARD_KEY, main_menu_key =3D =
MTXORB_DEF_MAIN_MENU_KEY;
static int keypad_test_mode =3D 0;
+static int barb_is_255 =3D 1;
=20
static int def[9] =3D { -1, -1, -1, -1, -1, -1, -1, -1, -1 };
static int use[9] =3D { 1, 0, 0, 0, 0, 0, 0, 0, 0 };
@@ -283,6 +284,8 @@
backlightenabled =3D 1;
}
=20
+ barb_is_255 =3D config_get_bool( DriverName , "hasfullblock" , 0 , 1);
+
/* Get display type */
type=3Dconfig_get_string ( DriverName , "type" , 0 , MTXORB_DEF_TYPE);
=20
@@ -374,22 +377,14 @@
=20
tcgetattr (fd, &portset);
=20
- // THIS ALL COMMENTED OUT BECAUSE WE NEED TO SET TIMEOUTS
- // We use RAW mode
-#ifdef HAVE_CFMAKERAW_NOT
- // The easy way
- cfmakeraw( &portset );
-#else
- // The hard way
portset.c_iflag &=3D ~( IGNBRK | BRKINT | PARMRK | ISTRIP
| INLCR | IGNCR | ICRNL | IXON );
- portset.c_oflag &=3D ~OPOST;
+ portset.c_oflag &=3D ~(OPOST | ONLCR);
portset.c_lflag &=3D ~( ECHO | ECHONL | ICANON | ISIG | IEXTEN );
portset.c_cflag &=3D ~( CSIZE | PARENB | CRTSCTS );
portset.c_cflag |=3D CS8 | CREAD | CLOCAL ;
portset.c_cc[VMIN] =3D 1;
portset.c_cc[VTIME] =3D 3;
-#endif
=20
// Set port speed
cfsetospeed (&portset, speed);
@@ -406,6 +401,11 @@
MtxOrb_autoscroll (MTXORB_DEF_AUTOSCROLL);
MtxOrb_cursorblink (MTXORB_DEF_CURSORBLINK);
MtxOrb_contrast (contrast);
+ /* Set autotransmit to on - so keys will be sent to
+ * us automatically (usually the default but let's not make
+ * any assumptions).
+ */
+ write(fd, "\x0FE" "A", 2);
=20
/*
* Configure the display functions
@@ -922,7 +922,7 @@
if (len > 0) {
for (y =3D MtxOrb->hgt; y > 0 && len > 0; y--) {
if (len >=3D MtxOrb->cellhgt)
- MtxOrb_chr (x, y, 255);
+ MtxOrb_chr (x, y, MtxOrb_ask_bar(barb));
else
MtxOrb_chr (x, y, MtxOrb_ask_bar (mapu[len]));
=20
@@ -932,7 +932,7 @@
len =3D -len;
for (y =3D 2; y <=3D MtxOrb->hgt && len > 0; y++) {
if (len >=3D MtxOrb->cellhgt)
- MtxOrb_chr (x, y, 255);
+ MtxOrb_chr (x, y, MtxOrb_ask_bar(barb));
else
MtxOrb_chr (x, y, MtxOrb_ask_bar (mapd[len]));
=20
@@ -961,7 +961,7 @@
if (len > 0) {
for (; x <=3D MtxOrb->wid && len > 0; x++) {
if (len >=3D MtxOrb->cellwid)
- MtxOrb_chr (x, y, 255);
+ MtxOrb_chr (x, y, MtxOrb_ask_bar(barb));
else
MtxOrb_chr (x, y, MtxOrb_ask_bar (mapr[len]));
=20
@@ -972,7 +972,7 @@
len =3D -len;
for (; x > 0 && len > 0; x--) {
if (len >=3D MtxOrb->cellwid)
- MtxOrb_chr (x, y, 255);
+ MtxOrb_chr (x, y, MtxOrb_ask_bar(barb));
else
MtxOrb_chr (x, y, MtxOrb_ask_bar (mapl[len]));
=20
@@ -1219,6 +1219,12 @@
int i;
int last_not_in_use;
int pos; /* 0 is icon, 1 to 7 are free, 8 is
not found.*/
+
+ // If the current LCD's font has a full block at character 255, then
+ // use that rather than define a custom character.
+ if ((type=3D=3Dbarb) && (barb_is_255))
+ return(255);
+
/* TODO: Reuse graphic caracter 0 if heartbeat is not in use.*/
=20
/* REMOVE: fprintf(stderr, "GLU: MtxOrb_ask_bar(%d).\n", type);*/
@@ -1343,6 +1349,14 @@
pos =3D 255;
break;
=20
+ case empty_heart:
+ pos =3D 'O';
+ break;
+
+ case filled_heart:
+ pos =3D '@';
+ break;
+
default:
pos =3D '?';
break;
@@ -1393,7 +1407,7 @@
static void
MtxOrb_set_known_char (int car, int type)
{
- char all_bar[25][5 * 8] =3D {
+ char all_bar[26][5 * 8] =3D {
{
0, 0, 0, 0, 0, // char u1[] =3D
0, 0, 0, 0, 0,
@@ -1619,7 +1633,18 @@
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
1, 0, 1, 0, 1,
+ }, {
+ 1, 1, 1, 1, 1, // barb
+ 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1,
}
+ =09
+
};
=20
MtxOrb_set_char (car, &all_bar[type][0]);


diff -u -r1.17.2.19.2.10 LCDd.conf
--- LCDd.conf 14 Mar 2004 15:50:22 -0000 1.17.2.19.2.10
+++ LCDd.conf 26 Sep 2004 21:44:57 -0000
@@ -449,6 +449,12 @@
# Possible settings: lcd, lkd, vfd, vkd
type=3Dlcd
=20
+# Does your LCD model have a full block symbol at 255? [yes]
+# Change to 'no' if you notice graphs having an extra gap at the =
bottom of
+# a full block when it's displayed.
+hasfullblock=3Dyes
+
+
# See [input] section for an explanation of the key mappings
=20
PauseKey=3DN









Archive powered by MHonArc 2.6.18.

Top of page