Use cellwidth = 5 on CFA-631 and CFA-635, too. This makes hBars not seamless,

but plays more nicely with the full block character used for ICON_BLOCK_FILLED.
Other changes:
- Use a full block with the last line cleared on 631/635.
- Remove unused icon definitions.
- Correct report level on some debug calls.
- Don't clear last line for big numbers.
- Remove the driver history - we have a SCM for this!
This commit is contained in:
mmdolze
2011-02-27 11:42:22 +00:00
parent 471fbc593e
commit 374281e215
2 changed files with 30 additions and 107 deletions
+1
View File
@@ -24,6 +24,7 @@ v.0.5dev (ongoing development)
* Pyramid: Convert set_char to 8 byte bitmap, add support for bignum * Pyramid: Convert set_char to 8 byte bitmap, add support for bignum
* Convert set_char of drivers bayrad, lb216, lcterm, mtc_s16209x, wirz-sli * Convert set_char of drivers bayrad, lb216, lcterm, mtc_s16209x, wirz-sli
* CFontzPacket: Fix not using select() even if its available * CFontzPacket: Fix not using select() even if its available
* CFontzPacket: Use cellwidth = 5 on CFA-631 and CFA-635 too
v0.5.4 v0.5.4
* Update driver includes and LDFLAGS (fixed glk and bayrad binding error) * Update driver includes and LDFLAGS (fixed glk and bayrad binding error)
+29 -107
View File
@@ -1,22 +1,20 @@
/** \file server/drivers/CFontzPacket.c /** \file server/drivers/CFontzPacket.c
* LCDd \c CFontzPacket driver for the CFA533, CFA631, CFA633 & CFA635 display * LCDd \c CFontzPacket driver for the CFA533, CFA631, CFA633 & CFA635 display
* series by CrystalFontz, Inc. * series by CrystalFontz, Inc which use a packet based protocol.
*
* Applicable Data Sheets:
* \li http://www.crystalfontz.com/products/533/data_sheet/data_sheet.html
* \li http://www.crystalfontz.com/products/631/data_sheet/data_sheet.html
* \li http://www.crystalfontz.com/products/633/data_sheet/data_sheet.html
* \li http://www.crystalfontz.com/products/635/data_sheet/data_sheet.html
*
* \todo Add a cache for the custom characters.
*/ */
/* /*-
* This is the LCDproc driver for CrystalFontz LCD using Packet protocol. * Copyright (c) 2002 David GLAUDE
* It support the CrystalFontz 533/633 USB/Serial, the 631 USB and the 635 USB * 2005 Peter Marschall
* (get yours from http://www.crystalfontz.com) * 2005 Nicolas Croiset <ncroiset@vdldiffusion.com>
*
* Applicable Data Sheets:
* - http://www.crystalfontz.com/products/533/data_sheet/data_sheet.html
* - http://www.crystalfontz.com/products/631/data_sheet/data_sheet.html
* - http://www.crystalfontz.com/products/633/data_sheet/data_sheet.html
* - http://www.crystalfontz.com/products/635/data_sheet/data_sheet.html
*
* Copyright (C) 2002 David GLAUDE
* Portions Copyright (C) 2005 Peter Marschall
* Portions Copyright (C) 2005 Nicolas Croiset <ncroiset@vdldiffusion.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -33,22 +31,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
*/ */
/*
* Driver history
* 04/04/2002: Working driver
* 05/06/2002: Reading of return value
* 02/09/2002: KeyPad handling and return string
* 03/09/2002: New icon incorporated
* 27/01/2003: Adapted for CFontz 631
* 16/05/2005: Adapted for CFontz 635
* 24/01/2010: Add CFontz 533, add model description
*
* THINGS TO DO:
* + Make the caching at least for heartbeat icon
*
*/
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
@@ -135,10 +117,10 @@ typedef struct CFontzPacket_private_data {
/** List of known models and their default settings and features */ /** List of known models and their default settings and features */
static CFA_Model CFA_ModelList[] = { static CFA_Model CFA_ModelList[] = {
{533, "16x2", 5, 19200 , HD44780_charmap, CFA_HAS_TEMP | CFA_HAS_4_TEMP_SLOTS}, {533, "16x2", 5, 19200 , HD44780_charmap, CFA_HAS_TEMP | CFA_HAS_4_TEMP_SLOTS},
{631, "20x2", 6, 115200, CFontz_charmap , CFA_HAS_FAN | CFA_HAS_TEMP | {631, "20x2", 5, 115200, CFontz_charmap , CFA_HAS_FAN | CFA_HAS_TEMP |
CFA_HAS_KS0073 | CFA_HAS_4_TEMP_SLOTS}, CFA_HAS_KS0073 | CFA_HAS_4_TEMP_SLOTS},
{633, "16x2", 5, 19200 , HD44780_charmap, CFA_HAS_FAN | CFA_HAS_TEMP}, {633, "16x2", 5, 19200 , HD44780_charmap, CFA_HAS_FAN | CFA_HAS_TEMP},
{635, "20x4", 6, 115200, CFontz_charmap , CFA_HAS_KS0073}, {635, "20x4", 5, 115200, CFontz_charmap , CFA_HAS_KS0073},
{0, NULL, 0, 0, NULL, 0} {0, NULL, 0, 0, NULL, 0}
}; };
@@ -284,7 +266,7 @@ CFontzPacket_init (Driver *drvthis)
report(RPT_INFO, "%s: USB is indicated (in config)", drvthis->name); report(RPT_INFO, "%s: USB is indicated (in config)", drvthis->name);
/* Set up io port correctly, and open it... */ /* Set up io port correctly, and open it... */
debug(RPT_DEBUG, "%s: Opening device: %s", __FUNCTION__, p->device); debug(RPT_INFO, "%s: Opening device: %s", __FUNCTION__, p->device);
p->fd = open(p->device, (p->usb) ? (O_RDWR | O_NOCTTY) : (O_RDWR | O_NOCTTY | O_NDELAY)); p->fd = open(p->device, (p->usb) ? (O_RDWR | O_NOCTTY) : (O_RDWR | O_NOCTTY | O_NDELAY));
if (p->fd == -1) { if (p->fd == -1) {
report(RPT_ERR, "%s: open(%s) failed (%s)", drvthis->name, p->device, strerror(errno)); report(RPT_ERR, "%s: open(%s) failed (%s)", drvthis->name, p->device, strerror(errno));
@@ -592,7 +574,7 @@ CFontzPacket_get_key (Driver *drvthis)
case CFP_KEY_UR_RELEASE: case CFP_KEY_UR_RELEASE:
case CFP_KEY_LL_RELEASE: case CFP_KEY_LL_RELEASE:
case CFP_KEY_LR_RELEASE: case CFP_KEY_LR_RELEASE:
// report(RPT_INFO, "%s: Ignoring key release 0x%02X", drvthis->name, key); /* Key release events are ignored */
return NULL; return NULL;
break; break;
default: default:
@@ -619,7 +601,7 @@ CFontzPacket_chr (Driver *drvthis, int x, int y, char c)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
debug(RPT_INFO, "%s: x=%d, y=%d, ch=0x%02X", __FUNCTION__, x, y, c); debug(RPT_DEBUG, "%s: x=%d, y=%d, ch=0x%02X", __FUNCTION__, x, y, c);
y--; y--;
x--; x--;
@@ -630,7 +612,8 @@ CFontzPacket_chr (Driver *drvthis, int x, int y, char c)
/** /**
* Print a raw character on the screen at position (x,y). * Print a character on the screen at position (x,y) bypassing the character
* mapping table.
* The upper-left corner is (1,1), the lower-right corner is (p->width, p->height). * The upper-left corner is (1,1), the lower-right corner is (p->width, p->height).
* \param drvthis Pointer to driver structure. * \param drvthis Pointer to driver structure.
* \param x Horizontal character position (column). * \param x Horizontal character position (column).
@@ -642,7 +625,7 @@ CFontzPacket_raw_chr (Driver *drvthis, int x, int y, unsigned char c)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
debug(RPT_INFO, "%s: x=%d, y=%d, ch=0x%02X", __FUNCTION__, x, y, c); debug(RPT_DEBUG, "%s: x=%d, y=%d, ch=0x%02X", __FUNCTION__, x, y, c);
y--; y--;
x--; x--;
@@ -733,7 +716,6 @@ CFontzPacket_set_brightness(Driver *drvthis, int state, int promille)
else { else {
p->offbrightness = promille; p->offbrightness = promille;
} }
//CFontzPacket_backlight(drvthis, state);
} }
@@ -978,22 +960,20 @@ CFontzPacket_set_char (Driver *drvthis, int n, unsigned char *dat)
unsigned char mask = (1 << p->cellwidth) - 1; unsigned char mask = (1 << p->cellwidth) - 1;
int row; int row;
if ((n < 0) || (n >= NUM_CCs)) if ((n < 0) || (n >= NUM_CCs) || (!dat))
return; return;
if (!dat)
return;
out[0] = n; /* Custom char to define. */
/* /*
* Models with a KS0073 (631, 635) have a seamless display. Clear the * Models with a KS0073 (631, 635) have a seamless display. Clear the
* last line on those to avoid the custom characters banging together * last line on those to avoid the custom characters banging together
* with other characters. This actually makes vBars not seamless. This * with other characters (except if big numbers are to be shown). This
* is supposed to be a feature, not a bug. * actually makes vBars not seamless. This is supposed to be a feature,
* not a bug.
*/ */
if (p->model_desc->flags & CFA_HAS_KS0073) if ((p->model_desc->flags & CFA_HAS_KS0073) && (p->ccmode != bignum))
dat[p->cellheight-1] = 0; dat[p->cellheight-1] = 0;
out[0] = n; /* Custom char to define. */
for (row = 0; row < p->cellheight; row++) { for (row = 0; row < p->cellheight; row++) {
out[row+1] = dat[row] & mask; out[row+1] = dat[row] & mask;
} }
@@ -1015,7 +995,7 @@ CFontzPacket_icon (Driver *drvthis, int x, int y, int icon)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
debug(RPT_INFO, "%s: x=%d, y=%d, icon=0x%02X", __FUNCTION__, x, y, icon); debug(RPT_DEBUG, "%s: x=%d, y=%d, icon=0x%02X", __FUNCTION__, x, y, icon);
static unsigned char heart_open[] = static unsigned char heart_open[] =
{ b__XXXXX, { b__XXXXX,
@@ -1053,26 +1033,6 @@ CFontzPacket_icon (Driver *drvthis, int x, int y, int icon)
b___XXX_, b___XXX_,
b____X__, b____X__,
b_______ }; b_______ };
/*
static unsigned char arrow_left[] =
{ b_______,
b____X__,
b___X___,
b__XXXXX,
b___X___,
b____X__,
b_______,
b_______ };
static unsigned char arrow_right[] =
{ b_______,
b____X__,
b_____X_,
b__XXXXX,
b_____X_,
b____X__,
b_______,
b_______ };
*/
static unsigned char checkbox_off[] = static unsigned char checkbox_off[] =
{ b_______, { b_______,
b_______, b_______,
@@ -1100,49 +1060,11 @@ CFontzPacket_icon (Driver *drvthis, int x, int y, int icon)
b__X_X_X, b__X_X_X,
b__XXXXX, b__XXXXX,
b_______ }; b_______ };
/*
static unsigned char selector_left[] =
{ b___X___,
b___XX__,
b___XXX_,
b___XXXX,
b___XXX_,
b___XX__,
b___X___,
b_______ };
static unsigned char selector_right[] =
{ b_____X_,
b____XX_,
b___XXX_,
b__XXXX_,
b___XXX_,
b____XX_,
b_____X_,
b_______ };
static unsigned char ellipsis[] =
{ b_______,
b_______,
b_______,
b_______,
b_______,
b_______,
b__X_X_X,
b_______ };
static unsigned char block_filled[] =
{ b__XXXXX,
b__XXXXX,
b__XXXXX,
b__XXXXX,
b__XXXXX,
b__XXXXX,
b__XXXXX,
b__XXXXX };
*/
switch (icon) { switch (icon) {
case ICON_BLOCK_FILLED: case ICON_BLOCK_FILLED:
if (p->model_desc->flags & CFA_HAS_KS0073) { if (p->model_desc->flags & CFA_HAS_KS0073) {
CFontzPacket_raw_chr(drvthis, x, y, 31); CFontzPacket_raw_chr(drvthis, x, y, 214);
} }
else else
CFontzPacket_raw_chr(drvthis, x, y, 255); CFontzPacket_raw_chr(drvthis, x, y, 255);