bignum cleanup
This commit is contained in:
@@ -203,7 +203,7 @@ CFontz633_init (Driver *drvthis, char *args)
|
||||
EmptyReceiveBuffer(&receivebuffer);
|
||||
|
||||
/* Read config file */
|
||||
/* Which model is it (CF633 or CF631)? */
|
||||
/* Which model is it (CF633, CF631 or CF635)? */
|
||||
tmp = drvthis->config_get_int (drvthis->name, "Model", 0, DEFAULT_SPEED);
|
||||
debug (RPT_INFO,"CFontzPacket_init: Model is '%d'", tmp);
|
||||
if ((tmp != 631) && (tmp != 633) && (tmp != 635)) {
|
||||
@@ -658,7 +658,7 @@ CFontz633_set_contrast (Driver *drvthis, int promille)
|
||||
hardware_contrast = (p->model == 633)
|
||||
? (p->contrast / 20)
|
||||
: ((p->contrast * 255) / 1000);
|
||||
/* Next line is to be checked $$$ */
|
||||
|
||||
send_onebyte_message(p->fd, CF633_Set_LCD_Contrast, hardware_contrast);
|
||||
}
|
||||
|
||||
@@ -673,7 +673,6 @@ CFontz633_backlight (Driver *drvthis, int on)
|
||||
{
|
||||
PrivateData *p = drvthis->private_data;
|
||||
|
||||
/* Next line is to be checked $$$ */
|
||||
send_onebyte_message(p->fd, CF633_Set_LCD_And_Keypad_Backlight,
|
||||
(on) ? p->brightness : p->offbrightness);
|
||||
}
|
||||
@@ -1134,14 +1133,14 @@ char bignum_map[11][4][3] = {
|
||||
{ 4, 3, 6 },
|
||||
{ 32, 1, 32 },
|
||||
{ 7, 32, 32 } },
|
||||
{ /* colon: */
|
||||
{ /* colon: (only 1st column used) */
|
||||
{ 32, 32, 32 },
|
||||
{ 0, 32, 32 },
|
||||
{ 0, 32, 32 },
|
||||
{ 32, 32, 32 } }
|
||||
};
|
||||
|
||||
if (num < 0 || num > 11)
|
||||
if ((num < 0) || (num > 10))
|
||||
return;
|
||||
|
||||
if ((p->width >= 20) && (p->height >= 4)) {
|
||||
@@ -1150,8 +1149,8 @@ char bignum_map[11][4][3] = {
|
||||
|
||||
CFontz633_init_num(drvthis);
|
||||
|
||||
for (x2 = 0; x2 <= 2; x2++) {
|
||||
for (y2 = 0; y2 <= 3; y2++) {
|
||||
for (x2 = 0; x2 < 3; x2++) {
|
||||
for (y2 = 0; y2 < 4; y2++) {
|
||||
CFontz633_chr(drvthis, x+x2, y+y2, bignum_map[num][y2][x2]);
|
||||
}
|
||||
if (num == 10)
|
||||
@@ -1159,7 +1158,8 @@ char bignum_map[11][4][3] = {
|
||||
}
|
||||
}
|
||||
else {
|
||||
CFontz633_chr(drvthis, x, p->height / 2, (num >= 11) ? ':' : (num + '0'));
|
||||
CFontz633_chr(drvthis, x, 1 + (p->height - 1) / 2,
|
||||
(num == 10) ? ':' : (num + '0'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1396,7 +1396,7 @@ CFontz633_hardware_clear (Driver *drvthis)
|
||||
|
||||
/*
|
||||
* Prints a string on the lcd display, at position (x,y). The
|
||||
* upper-left is (1,1), and the lower right should be (p->width, p->height).
|
||||
* upper-left is (1,1), and the lower right is (p->width, p->height).
|
||||
*/
|
||||
MODULE_EXPORT void
|
||||
CFontz633_string (Driver *drvthis, int x, int y, char string[])
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This is the LCDproc driver for IO-Warrior devices(http://www.codemercs.de)
|
||||
/* This is the LCDproc driver for IO-Warrior devices (http://www.codemercs.de)
|
||||
|
||||
Copyright(C) 2004, Peter Marschall <peter@adpm.de>
|
||||
Copyright(C) 2004,2005 Peter Marschall <peter@adpm.de>
|
||||
|
||||
based on GPL'ed code:
|
||||
|
||||
@@ -977,14 +977,14 @@ char bignum_map[11][4][3] = {
|
||||
{ 4, 3, 6 },
|
||||
{ 32, 1, 32 },
|
||||
{ 7, 32, 32 } },
|
||||
{ /* colon: */
|
||||
{ /* colon: (only 1st column used) */
|
||||
{ 32, 32, 32 },
|
||||
{ 0, 32, 32 },
|
||||
{ 0, 32, 32 },
|
||||
{ 32, 32, 32 } }
|
||||
};
|
||||
|
||||
if ((num < 0) || (num > 11))
|
||||
if ((num < 0) || (num > 10))
|
||||
return;
|
||||
|
||||
IOWarrior_init_num(drvthis);
|
||||
@@ -993,17 +993,17 @@ char bignum_map[11][4][3] = {
|
||||
int y = (p->height - 2) / 2; /* center vertically */
|
||||
int x2, y2;
|
||||
|
||||
for (x2 = 0; x2 <= 2; x2++) {
|
||||
for (y2 = 0; y2 <= 3; y2++) {
|
||||
for (x2 = 0; x2 < 3; x2++) {
|
||||
for (y2 = 0; y2 < 4; y2++) {
|
||||
IOWarrior_chr(drvthis, x+x2, y+y2, bignum_map[num][y2][x2]);
|
||||
}
|
||||
if (num == 10)
|
||||
x2 = 2; /* = break, for colon only */
|
||||
}
|
||||
}
|
||||
else {
|
||||
IOWarrior_chr(drvthis, x, p->height / 2, (num >= 11) ? ':' : (num + '0'));
|
||||
}
|
||||
else
|
||||
IOWarrior_chr(drvthis, x, 1 + (p->height - 1)/ 2,
|
||||
(num == 10) ? ':' : (num + '0'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
+68
-87
@@ -759,7 +759,6 @@ MODULE_EXPORT void
|
||||
HD44780_init_num (Driver *drvthis)
|
||||
{
|
||||
PrivateData *p = (PrivateData *) drvthis->private_data;
|
||||
int i;
|
||||
|
||||
char bignum_ccs[8][5*8] = {{
|
||||
1, 1, 0, 0, 0,
|
||||
@@ -835,20 +834,18 @@ HD44780_init_num (Driver *drvthis)
|
||||
0, 0, 0, 0, 0
|
||||
}};
|
||||
|
||||
if( p->ccmode == CCMODE_BIGNUM ) {
|
||||
/* Work already done */
|
||||
return;
|
||||
}
|
||||
if (p->ccmode != CCMODE_BIGNUM) {
|
||||
int i;
|
||||
|
||||
if( p->ccmode != CCMODE_STANDARD ) {
|
||||
/* Not supported (yet) */
|
||||
report( RPT_WARNING, "HD44780_init_num: Cannot combine two modes using user defined characters" );
|
||||
return;
|
||||
}
|
||||
p->ccmode = CCMODE_BIGNUM;
|
||||
if( p->ccmode != CCMODE_STANDARD ) {
|
||||
/* Not supported (yet) */
|
||||
report( RPT_WARNING, "HD44780_init_num: Cannot combine two modes using user defined characters" );
|
||||
return;
|
||||
}
|
||||
p->ccmode = CCMODE_BIGNUM;
|
||||
|
||||
for( i=0; i<8; i++ ) {
|
||||
HD44780_set_char (drvthis, i, bignum_ccs[i]);
|
||||
for (i = 0; i < 8; i++)
|
||||
HD44780_set_char (drvthis, i, bignum_ccs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -862,98 +859,82 @@ HD44780_num (Driver *drvthis, int x, int num)
|
||||
|
||||
char bignum_map[11][4][3] = {
|
||||
{ /* 0: */
|
||||
{1,2,3},
|
||||
{6,32,6},
|
||||
{6,32,6},
|
||||
{7,2,32}
|
||||
},
|
||||
{ 1, 2, 3 },
|
||||
{ 6, 32, 6 },
|
||||
{ 6, 32, 6 },
|
||||
{ 7, 2, 32 } },
|
||||
{ /* 1: */
|
||||
{7,6,32},
|
||||
{32,6,32},
|
||||
{32,6,32},
|
||||
{7,2,32},
|
||||
},
|
||||
{ 7, 6, 32 },
|
||||
{ 32, 6, 32 },
|
||||
{ 32, 6, 32 },
|
||||
{ 7, 2, 32 } },
|
||||
{ /* 2: */
|
||||
{1,2,3},
|
||||
{32,5,0},
|
||||
{1,32,32},
|
||||
{2,2,0},
|
||||
},
|
||||
{ 1, 2, 3 },
|
||||
{ 32, 5, 0 },
|
||||
{ 1, 32, 32 },
|
||||
{ 2, 2, 0 } },
|
||||
{ /* 3: */
|
||||
{1,2,3},
|
||||
{32,5,0},
|
||||
{3,32,6},
|
||||
{7,2,32}
|
||||
},
|
||||
{ 1, 2, 3 },
|
||||
{ 32, 5, 0 },
|
||||
{ 3, 32, 6 },
|
||||
{ 7, 2, 32 } },
|
||||
{ /* 4: */
|
||||
{32,3,6},
|
||||
{1,32,6},
|
||||
{2,2,6},
|
||||
{32,32,0}
|
||||
},
|
||||
{ 32, 3, 6 },
|
||||
{ 1, 32, 6 },
|
||||
{ 2, 2, 6 },
|
||||
{ 32, 32, 0 } },
|
||||
{ /* 5: */
|
||||
{1,2,0},
|
||||
{2,2,3},
|
||||
{3,32,6},
|
||||
{7,2,32}
|
||||
},
|
||||
{ 1, 2, 0 },
|
||||
{ 2, 2, 3 },
|
||||
{ 3, 32, 6 },
|
||||
{ 7, 2, 32 } },
|
||||
{ /* 6: */
|
||||
{1,2,32},
|
||||
{6,5,32},
|
||||
{6,32,6},
|
||||
{7,2,32}
|
||||
},
|
||||
{ 1, 2, 32 },
|
||||
{ 6, 5, 32 },
|
||||
{ 6, 32, 6 },
|
||||
{ 7, 2, 32 } },
|
||||
{ /* 7: */
|
||||
{2,2,6},
|
||||
{32,1,32},
|
||||
{32,6,32},
|
||||
{32,0,32}
|
||||
},
|
||||
{ 2, 2, 6 },
|
||||
{ 32, 1, 32 },
|
||||
{ 32, 6, 32 },
|
||||
{ 32, 0, 32 } },
|
||||
{ /* 8: */
|
||||
{1,2,3},
|
||||
{4,5,0},
|
||||
{6,32,6},
|
||||
{7,2,32}
|
||||
},
|
||||
{ 1, 2, 3 },
|
||||
{ 4, 5, 0 },
|
||||
{ 6, 32, 6 },
|
||||
{ 7, 2, 32 } },
|
||||
{ /* 9: */
|
||||
{1,2,3},
|
||||
{4,3,6},
|
||||
{32,1,32},
|
||||
{7,32,32}
|
||||
},
|
||||
{ /* colon: */
|
||||
{32},
|
||||
{7},
|
||||
{7},
|
||||
{32}
|
||||
}};
|
||||
{ 1, 2, 3 },
|
||||
{ 4, 3, 6 },
|
||||
{ 32, 1, 32 },
|
||||
{ 7, 32, 32 } },
|
||||
{ /* colon: (only 1st column used) */
|
||||
{ 32, 32, 32 },
|
||||
{ 7, 32, 32 },
|
||||
{ 7, 32, 32 },
|
||||
{ 32, 32, 32 } }
|
||||
};
|
||||
|
||||
if( num < 0 || num > 10 ) return;
|
||||
if ((num < 0) || (num > 10))
|
||||
return;
|
||||
|
||||
HD44780_init_num(drvthis);
|
||||
|
||||
if( p->width >= 20 && p->height >= 4 ) {
|
||||
|
||||
int y = ( p->height - 2 ) / 2;
|
||||
if ((p->width >= 20) && (p->height >= 4)) {
|
||||
int y = (p->height - 2) / 2;
|
||||
int x2, y2;
|
||||
|
||||
for( x2 = 0; x2 <= 2; x2 ++ ) {
|
||||
for( y2 = 0; y2 <= 3; y2 ++ ) {
|
||||
HD44780_init_num(drvthis);
|
||||
|
||||
for (x2 = 0; x2 < 3; x2++) {
|
||||
for (y2 = 0; y2 < 4; y2++) {
|
||||
HD44780_chr( drvthis, x+x2, y+y2, bignum_map[num][y2][x2] );
|
||||
}
|
||||
if( num == 10 ) {
|
||||
if (num == 10)
|
||||
x2 = 2; /* =break, for colon only */
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
int y = ( p->height - 1 ) / 2;
|
||||
if( num == 11 ) {
|
||||
HD44780_chr( drvthis, x, y, ':' );
|
||||
} else {
|
||||
HD44780_chr( drvthis, x, y, num + '0' );
|
||||
}
|
||||
}
|
||||
else
|
||||
HD44780_chr(drvthis, x, 1 + (p->height - 1) / 2,
|
||||
(num == 10) ? ':' : (num + '0'));
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -338,15 +338,11 @@ icp_a106_num (Driver *drvthis, int x, int num)
|
||||
{
|
||||
PrivateData *p = (PrivateData *) drvthis->private_data;
|
||||
|
||||
if( num < 0 || num > 10 ) return;
|
||||
if ((num < 0) || (num > 10))
|
||||
return;
|
||||
|
||||
{
|
||||
int y = ( p->height - 1 ) / 2 + 1;
|
||||
if( num == 11 )
|
||||
icp_a106_chr( drvthis, x, y, ':' );
|
||||
else
|
||||
icp_a106_chr( drvthis, x, y, num + '0' );
|
||||
}
|
||||
icp_a106_chr(drvthis, x, 1 + (p->height - 1) / 2,
|
||||
(num == 10) ? ':' : (num + '0'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
+12
-17
@@ -686,31 +686,26 @@ lcterm_num (Driver *drvthis, int x, int num)
|
||||
{32}
|
||||
}};
|
||||
|
||||
if( num < 0 || num > 10 ) return;
|
||||
if ((num < 0) || (num > 10))
|
||||
return;
|
||||
|
||||
lcterm_init_num(drvthis);
|
||||
|
||||
if( p->width >= 16 && p->height >= 4 )
|
||||
{
|
||||
int y = 1 + ( p->height - 2 ) / 2;
|
||||
if ((p->width >= 20) && (p->height >= 4)) {
|
||||
int y = ( p->height - 2 ) / 2;
|
||||
int x2, y2;
|
||||
|
||||
for( x2 = 0; x2 <= 2; x2 ++ )
|
||||
{
|
||||
for( y2 = 0; y2 <= 3; y2 ++ )
|
||||
lcterm_init_num(drvthis);
|
||||
|
||||
for (x2 = 0; x2 <= 2; x2++) {
|
||||
for (y2 = 0; y2 <= 3; y2++) {
|
||||
lcterm_chr( drvthis, x+x2, y+y2, bignum_map[num][y2][x2] );
|
||||
if( num == 10 )
|
||||
}
|
||||
if (num == 10)
|
||||
x2 = 2; /* =break, for colon only */
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int y = ( p->height - 1 ) / 2 + 1;
|
||||
if( num == 11 )
|
||||
lcterm_chr( drvthis, x, y, ':' );
|
||||
else
|
||||
lcterm_chr( drvthis, x, y, num + '0' );
|
||||
}
|
||||
lcterm_chr(drvthis, x, 1 + (p->height - 1) / 2,
|
||||
(num == 10) ? ':' : (num + '0'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user