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: Wed Sep 29 02:03:03 2004

If there are no comments in the next 24 hours then I will proceed to check
it in to CVS.

Chris.

> -----Original Message-----
> From:
> lcdproc-admin AT lists.omnipotent.net
> [mailto:lcdproc-admin AT lists.omnipotent.net]On
> Behalf Of Chris Lansley
> Sent: 26 September 2004 22:50
> To:
> lcdproc AT lists.omnipotent.net
> Subject: [Lcdproc] [PATCH] MtxOrb.c - patch 3
>
>
>
> 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:
> - 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 = 22,
> filled_heart = 23,
> ellipsis = 24,
> - barw = 32,
> - barb = 255
> + barb = 25,
> + barw = 32
> } bar_type;
>
> static unsigned char *lcd_contains; // what we think is actually
> on the LCD
> @@ -116,6 +116,7 @@
> static char pause_key = MTXORB_DEF_PAUSE_KEY, back_key =
> MTXORB_DEF_BACK_KEY;
> static char forward_key = MTXORB_DEF_FORWARD_KEY, main_menu_key
> = MTXORB_DEF_MAIN_MENU_KEY;
> static int keypad_test_mode = 0;
> +static int barb_is_255 = 1;
>
> static int def[9] = { -1, -1, -1, -1, -1, -1, -1, -1, -1 };
> static int use[9] = { 1, 0, 0, 0, 0, 0, 0, 0, 0 };
> @@ -283,6 +284,8 @@
> backlightenabled = 1;
> }
>
> + barb_is_255 = config_get_bool( DriverName , "hasfullblock" , 0 , 1);
> +
> /* Get display type */
> type=config_get_string ( DriverName , "type" , 0 , MTXORB_DEF_TYPE);
>
> @@ -374,22 +377,14 @@
>
> tcgetattr (fd, &portset);
>
> - // 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 &= ~( IGNBRK | BRKINT | PARMRK | ISTRIP
> | INLCR | IGNCR | ICRNL | IXON );
> - portset.c_oflag &= ~OPOST;
> + portset.c_oflag &= ~(OPOST | ONLCR);
> portset.c_lflag &= ~( ECHO | ECHONL | ICANON | ISIG | IEXTEN );
> portset.c_cflag &= ~( CSIZE | PARENB | CRTSCTS );
> portset.c_cflag |= CS8 | CREAD | CLOCAL ;
> portset.c_cc[VMIN] = 1;
> portset.c_cc[VTIME] = 3;
> -#endif
>
> // 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);
>
> /*
> * Configure the display functions
> @@ -922,7 +922,7 @@
> if (len > 0) {
> for (y = MtxOrb->hgt; y > 0 && len > 0; y--) {
> if (len >= 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]));
>
> @@ -932,7 +932,7 @@
> len = -len;
> for (y = 2; y <= MtxOrb->hgt && len > 0; y++) {
> if (len >= 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]));
>
> @@ -961,7 +961,7 @@
> if (len > 0) {
> for (; x <= MtxOrb->wid && len > 0; x++) {
> if (len >= 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]));
>
> @@ -972,7 +972,7 @@
> len = -len;
> for (; x > 0 && len > 0; x--) {
> if (len >= 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]));
>
> @@ -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==barb) && (barb_is_255))
> + return(255);
> +
> /* TODO: Reuse graphic caracter 0 if heartbeat is not in use.*/
>
> /* REMOVE: fprintf(stderr, "GLU: MtxOrb_ask_bar(%d).\n", type);*/
> @@ -1343,6 +1349,14 @@
> pos = 255;
> break;
>
> + case empty_heart:
> + pos = 'O';
> + break;
> +
> + case filled_heart:
> + pos = '@';
> + break;
> +
> default:
> pos = '?';
> break;
> @@ -1393,7 +1407,7 @@
> static void
> MtxOrb_set_known_char (int car, int type)
> {
> - char all_bar[25][5 * 8] = {
> + char all_bar[26][5 * 8] = {
> {
> 0, 0, 0, 0, 0, // char u1[] =
> 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,
> }
> +
> +
> };
>
> 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=lcd
>
> +# 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=yes
> +
> +
> # See [input] section for an explanation of the key mappings
>
> PauseKey=N
>
>
>
>
>
> _______________________________________________
> LCDproc mailing list
> LCDproc AT lists.omnipotent.net
> http://lists.omnipotent.net/mailman/listinfo/lcdproc






Archive powered by MHonArc 2.6.18.

Top of page