diff --git a/ChangeLog b/ChangeLog
index 5487eec..40267e7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@ Key:
v.0.5dev (ongoing development)
* fix switching on/off the Load screen in lcdproc client using the menu
+ * refactor adv_bignum: support height > 4, loadable chars with offset
v.0.5.1
+ config file support in lcdproc client (Andrew Foss)
diff --git a/docs/lcdproc-dev/make-driver.docbook b/docs/lcdproc-dev/make-driver.docbook
index 5409e45..584a339 100644
--- a/docs/lcdproc-dev/make-driver.docbook
+++ b/docs/lcdproc-dev/make-driver.docbook
@@ -161,7 +161,7 @@ port_deny_multiple(0x378,3);
adv_bignum.h : Write Big-Numbers
- adv_bignum.h is the headerfile for lib_bignum.a
+ adv_bignum.h is the headerfile for libbignum.a
(made from adv_bignum.c) which contains everything needed to show big-numbers,
including the fonts for the different displays.
(All files are located in the server/drivers/ directory.)
@@ -172,27 +172,79 @@ port_deny_multiple(0x378,3);
-
- The display's cellwidth has to be 5
- (6 works also in some cases) and the cellheight
- 7 or 8.
-
The following functions have to be implemented by the driver:
-
-
- chr()
-
-
- set_char() (only if the display has custom-characters)
-
-
+
+
+ height()
+
+
+ to determine the display's height and thus the maximal height of the
+ big numbers to be displayed.
+
+
+
+
+
+ get_free_chars()
+
+
+ to determine the number of user-defineable characters that can be
+ used in the generation of big numbers.
+
+
+
+
+
+ set_char()
+
+
+ to define a character necessary to write a big number.
+ Of course this is only necessary if there really are user-definieable
+ characters, i.e. only if get_free_chars() returns
+ a value greater 0.
+
+
+
+
+
+ chr()
+
+
+ to actually write the characters the big numbers consist of.
+
+
+
+
+
+
+
+
+
+ The display's cellwidth has to be 5
+ (6 works also in some cases) and the cellheight
+ 7 or 8.
+
+
+
+
+
+ The custom-characters (if any) have to be at character positions
+ offset+0,
+ offset+1,
+ offset+2, ...
+ offset+
+ get_free_chars()-1,
+
+
+
+
+
+ offset+
+ get_free_chars()-1 must be less than 32,
-
- The custom-characters (if available) have to be at char 0, 1, 2, ..... ,n
-
@@ -204,7 +256,7 @@ port_deny_multiple(0x378,3);
-External provided Functions
+Provided Functions
@@ -212,43 +264,127 @@ port_deny_multiple(0x378,3);
Driver *drvthis
int x
int num
- int height
+ int offset
int do_init
- int customchars
The main thing the driver has to do is to call this function from its num()
- function.
+ function with the parameters described below.
-
- Where num is the number (legal: 0 - 9,
- and :)
- to be written, height the display's height in characters and
- customchars the number of available custom characters.
-
+
+
+ drvthis
+
+
+ the pointer pointing to the Driver structure passed to thea driver's
+ num() function.
+
+
+
+
+
+ x
+
+
+ the horizontal position of the top-left corner of the big-number
+ (the big-numbers don't have a y position).
+ The placing of the characters is done by the client, so the driver only has to forward
+ the position to the lib. The bignumlib has no influence on the placing of the characters.
+
+
+
+
+
+ num
+
+
+ the number (legal: 0 - 9,
+ and :) to be written.
+
+
+
+
+
+ offset
+
+
+ the character position where the user-defineable characters start
+ (usually 0).
+ The user-defineable characters (if any) are then expected to be at the character positions
+ offset+0,
+ offset+1,
+ offset+2, ...
+ offset+
+ get_free_chars()-1
+ and offset+
+ get_free_chars()-1 is required to be less than
+ 32.
+
+
+
+
+
+ do_init
+
+
+ if not 0, lib_adv_bignum will set the
+ custom characters of the display for the big-numbers.
+
+
+ The driver has to check if the custom-characters have to be set or if it is
+ already done and tell it to the lib (using the do_init parameter).
+ The common way is to use variable called p->ccmode or similar.
+ In the different drivers there are some differences in the naming and handling of this variable.
+ So the responsibility of checking and setting is left to the driver.
+
+
+
+
+
+
+Calling lib_adv_bignum()
+
+
+#include "adv_bignum.h"
+
+MODULE_EXPORT void
+myDriver_num( Driver * drvthis, int x, int num )
+{
+ PrivateData *p = drvthis->private_data;
+ int do_init = 0;
+
+ if (p->ccmode != CCMODE_BIGNUM){ // Are the custom-characters set up correctly? If not:
+ do_init = 1; // Lib_adv_bignum has to set the custom-characters.
+ p->ccmode = CCMODE_BIGNUM; // Switch custom-charactermode to bignum.
+ }
+
+ // Lib_adv_bignum does everything needed to show the big-numbers.
+ lib_adv_bignum(drvthis, x, num, 0, do_init);
+}
+
+
+
- x is the x position of the top-left corner of the big-number
- (the big-numbers don't have a y position).
- The placing of the characters is done by the client, so the driver only has to forward
- the position to the lib. The bignumlib has no influence on the placing of the characters.
+ All that's left to do is to add libbignum.a to the libs and
+ adv_bignum.h sources of your driver in the Makefile
+ (or the file that generates the
+ Makefile).
-
- If do_init is not 0 lib_bignum will set the
- custom characters of the display for the big-numbers.
-
+
+Enabling adv_bignum support in Makefile.am
-
- The driver has to check if the custom-characters have to be set or if it is
- already done and tell it to the lib (using the do_init parameter).
- The common way is to use variable called p->ccmode or similar.
- In the different drivers there are some differences in the naming and handling of this variable.
- So the responsibility of checking and setting is left at the driver.
-
+
+myDriver_LDADD: libLCD.a libbignum.a
+
+myDriver_SOURCES: lcd.h lcd_lib.h myDriver.c myDriver.h report.h adv_bignum.h
+
+
+
@@ -256,13 +392,16 @@ port_deny_multiple(0x378,3);
Internal Structure and Functions
- The only function of lib_adv_bignum() is to determine the best
- display-dependent big-number function for the given display parameters, and to call it.
+ The only purpose of lib_adv_bignum() is to determine the best
+ display-dependent big-number function, based upon the values of the driver's
+ height() and get_free_chars() functions,
+ and call it.
- The display-dependent functions are named adv_bignum_num_N_M().
- Where N is the display-height in lines and M
+ The display-dependent functions are named
+ adv_bignum_num_N_M(),
+ where N is the display's height in lines and M
the number of used user-defineable characters.
The bits of the user-characters are stored in static char bignum
(take a look at the source and you will see what I mean). (On a display with a
@@ -273,8 +412,8 @@ port_deny_multiple(0x378,3);
- If user-characters have to be set the driver's set_char() function
- will be called once for every user-character.
+ If user-defineable characters have to be set, the driver's set_char() function
+ will be called once for every user-idefneable character.
@@ -285,47 +424,6 @@ port_deny_multiple(0x378,3);
-
-Example:
-
-
- Calling the lib_adv_bignum() from a drivers_num function.
- (from serialVFD.c):
-
-
-
-MODULE_EXPORT void
-serialVFD_num( Driver * drvthis, int x, int num )
-{
- PrivateData *p = drvthis->private_data;
- int do_init = 0;
-
- if (p->ccmode != CCMODE_BIGNUM){ // Are the custom-characters set up correctly? If not:
- do_init = 1; // Lib_adv_bignum has to set the custom-characters.
- p->ccmode = CCMODE_BIGNUM; // Switch custom-charactermode to bignum.
- }
- // Lib_adv_bignum does everything needed to show the big-numbers.
- lib_adv_bignum(drvthis, x, num, p->height, do_init, p->customchars);
-}
-
-
-
-
- All that's left to do is to include the header-file
-
-
-
-#include "adv_bignum.h"
-
-
-
- and to add libbignum.a to the libs and adv_bignum.h
- sources of your driver in the Makefile (or the file that generates the
- Makefile).
-
-
-
-
diff --git a/server/drivers/CFontz.c b/server/drivers/CFontz.c
index 98f4d9f..ece990e 100644
--- a/server/drivers/CFontz.c
+++ b/server/drivers/CFontz.c
@@ -696,7 +696,7 @@ int do_init = 0;
}
// Lib_adv_bignum does everything needed to show the bignumbers.
- lib_adv_bignum(drvthis, x, num, do_init, NUM_CCs);
+ lib_adv_bignum(drvthis, x, num, 0, do_init);
}
diff --git a/server/drivers/CFontz633.c b/server/drivers/CFontz633.c
index fada334..1aeda32 100644
--- a/server/drivers/CFontz633.c
+++ b/server/drivers/CFontz633.c
@@ -784,7 +784,7 @@ int do_init = 0;
}
// Lib_adv_bignum does everything needed to show the bignumbers.
- lib_adv_bignum(drvthis, x, num, do_init, NUM_CCs);
+ lib_adv_bignum(drvthis, x, num, 0, do_init);
}
diff --git a/server/drivers/CFontzPacket.c b/server/drivers/CFontzPacket.c
index 0164433..0531f6e 100644
--- a/server/drivers/CFontzPacket.c
+++ b/server/drivers/CFontzPacket.c
@@ -951,7 +951,7 @@ int do_init = 0;
}
// Lib_adv_bignum does everything needed to show the bignumbers.
- lib_adv_bignum(drvthis, x, num, do_init, NUM_CCs);
+ lib_adv_bignum(drvthis, x, num, 0, do_init);
}
diff --git a/server/drivers/IOWarrior.c b/server/drivers/IOWarrior.c
index 3f44d8b..dc37eea 100644
--- a/server/drivers/IOWarrior.c
+++ b/server/drivers/IOWarrior.c
@@ -778,7 +778,7 @@ int do_init = 0;
}
// Lib_adv_bignum does everything needed to show the bignumbers.
- lib_adv_bignum(drvthis, x, num, do_init, NUM_CCs);
+ lib_adv_bignum(drvthis, x, num, 0, do_init);
}
diff --git a/server/drivers/MtxOrb.c b/server/drivers/MtxOrb.c
index 932de0a..64fa75f 100644
--- a/server/drivers/MtxOrb.c
+++ b/server/drivers/MtxOrb.c
@@ -1129,7 +1129,7 @@ MtxOrb_num (Driver *drvthis, int x, int num)
}
// Lib_adv_bignum does everything needed to show the bignumbers.
- lib_adv_bignum(drvthis, x, num, do_init, NUM_CCs);
+ lib_adv_bignum(drvthis, x, num, 0, do_init);
}
diff --git a/server/drivers/adv_bignum.c b/server/drivers/adv_bignum.c
index f454a04..ee2250f 100644
--- a/server/drivers/adv_bignum.c
+++ b/server/drivers/adv_bignum.c
@@ -28,19 +28,23 @@
cellwidth == 5 (also with 6, but with gaps)
cellheight == 7 or 8
needed functions:
- drvthis->set_char (only if the display has customcharacters)
- drvthis->chr
- customcharacters (if available) at char 0, 1, 2, ..... ,n
+ drvthis->get_free_chars()
+ drvthis->set_char() [only if get_free_chars() returns a value > 0]
+ drvthis->chr()
+ drvthis->height()
+ customcharacters (if available) at char offset+0, offset+1, ..., offset+get_free_chars()-1
USAGE:
- Just call lib_adv_bignum(drvthis, x, num, height, do_init, customchars)
- from drvthis->num.
+ Just call lib_adv_bignum(drvthis, x, num, offset, do_init)
+ from drvthis->num().
The library does everything needed to show bignumbers EXCEPT checking or
setting the CCMODE variable. The driver has to do this (see serialVFD.c
for details).
- Example: Call of the lib_adv_bignum from a drivers_num function :
+ Example: Call of the lib_adv_bignum from a driver's num function:
+
+ #include "adv_bignum.h"
MODULE_EXPORT void
serialVFD_num(Driver *drvthis, int x, int num)
@@ -53,7 +57,7 @@
p->ccmode = CCMODE_BIGNUM; // Switch customcharactermode to bignum.
}
// Lib_adv_bignum does everything needed to show the bignumbers.
- lib_adv_bignum(drvthis, x, num, p->height, do_init, p->customchars);
+ lib_adv_bignum(drvthis, x, num, 0, do_init);
}
*/
@@ -78,17 +82,17 @@
-static void adv_bignum_num_2_0 (Driver *drvthis, int x, int num, int height, int do_init);
-static void adv_bignum_num_2_1 (Driver *drvthis, int x, int num, int height, int do_init);
-static void adv_bignum_num_2_2 (Driver *drvthis, int x, int num, int height, int do_init);
-static void adv_bignum_num_2_5 (Driver *drvthis, int x, int num, int height, int do_init);
-static void adv_bignum_num_2_28 (Driver *drvthis, int x, int num, int height, int do_init);
+static void adv_bignum_num_2_0(Driver *drvthis, int x, int num, int height, int offset, int do_init);
+static void adv_bignum_num_2_1(Driver *drvthis, int x, int num, int height, int offset, int do_init);
+static void adv_bignum_num_2_2(Driver *drvthis, int x, int num, int height, int offset, int do_init);
+static void adv_bignum_num_2_5(Driver *drvthis, int x, int num, int height, int offset, int do_init);
+static void adv_bignum_num_2_28(Driver *drvthis, int x, int num, int height, int offset, int do_init);
-static void adv_bignum_num_4_0 (Driver *drvthis, int x, int num, int height, int do_init);
-static void adv_bignum_num_4_3 (Driver *drvthis, int x, int num, int height, int do_init);
-static void adv_bignum_num_4_8 (Driver *drvthis, int x, int num, int height, int do_init);
+static void adv_bignum_num_4_0(Driver *drvthis, int x, int num, int height, int offset, int do_init);
+static void adv_bignum_num_4_3(Driver *drvthis, int x, int num, int height, int offset, int do_init);
+static void adv_bignum_num_4_8(Driver *drvthis, int x, int num, int height, int offset, int do_init);
-static void adv_bignum_write_num (Driver *drvthis, char write_num_map[][4][3], int x, int num, int height);
+static void adv_bignum_write_num(Driver *drvthis, char num_map[][4][3], int x, int num, int height, int offset);
/////////////////////////////////////////////////////////////////////////////////////////////
@@ -96,59 +100,78 @@ static void adv_bignum_write_num (Driver *drvthis, char write_num_map[][4][3], i
// The called bignumberfunction is depending on the display's height and the
// number of customcharacters.
void
-lib_adv_bignum(Driver *drvthis, int x, int num, int do_init, int customchars)
+lib_adv_bignum(Driver *drvthis, int x, int num, int offset, int do_init)
{
int height = drvthis->height(drvthis);
+int customchars = drvthis->get_free_chars(drvthis);
- switch (height) { // Display heigth:
- case 2: // 2 lines
- case 3: // are 3 line displays really existing?
- if (customchars == 0) { // 2 lines and customchars = 0
- adv_bignum_num_2_0 (drvthis, x, num, height, do_init);
- }
- else if (customchars == 1) { // 2 lines and customchars = 1
- adv_bignum_num_2_1 (drvthis, x, num, height, do_init);
- }
- else if (customchars < 5) { // 2 lines and customchars = 2 ... 4
- adv_bignum_num_2_2 (drvthis, x, num, height, do_init);
- }
- else if (customchars < 28) { // 2 lines and customchars = 5 ... 27
- adv_bignum_num_2_5 (drvthis, x, num, height, do_init);
- }
- else { // 2 lines and customchars >= 28
- adv_bignum_num_2_28 (drvthis, x, num, height, do_init);
- }
- break;
- case 4: // 4 lines
- if (customchars == 0) { // 4 lines and customchars < 3
- adv_bignum_num_4_0 (drvthis, x, num, height, do_init);
- }
- else if (customchars < 8) { // 4 lines and customchars < 8
- adv_bignum_num_4_3 (drvthis, x, num, height, do_init);
- }
- else { // 4 lines and customchars >= 8
- adv_bignum_num_4_8 (drvthis, x, num, height, do_init);
- }
- break;
- default:
- return;
+ if (height >= 4) {
+ height = 4; // not ideal: we always start at the 1st line
+ if (customchars == 0) { // 4 lines and customchars < 3
+ adv_bignum_num_4_0 (drvthis, x, num, height, offset, do_init);
+ }
+ else if (customchars < 8) { // 4 lines and customchars < 8
+ adv_bignum_num_4_3 (drvthis, x, num, height, offset, do_init);
+ }
+ else { // 4 lines and customchars >= 8
+ adv_bignum_num_4_8 (drvthis, x, num, height, offset, do_init);
+ }
}
+ else if (height >= 2) {
+ height = 2; // do 3 -line displays really exist?
+
+ if (customchars == 0) { // 2 lines and customchars = 0
+ adv_bignum_num_2_0 (drvthis, x, num, height, offset, do_init);
+ }
+ else if (customchars == 1) { // 2 lines and customchars = 1
+ adv_bignum_num_2_1 (drvthis, x, num, height, offset, do_init);
+ }
+ else if (customchars < 5) { // 2 lines and customchars = 2 ... 4
+ adv_bignum_num_2_2 (drvthis, x, num, height, offset, do_init);
+ }
+ else if (customchars < 28) { // 2 lines and customchars = 5 ... 27
+ adv_bignum_num_2_5 (drvthis, x, num, height, offset, do_init);
+ }
+ else { // 2 lines and customchars >= 28
+ adv_bignum_num_2_28 (drvthis, x, num, height, offset, do_init);
+ }
+ }
+
+ return;
}
/////////////////////////////////////////////////////////////////////////////////////////////
// This function writes the selected type of bignumber by calling the driver's chr function.
// It is called by display-depending bignumber functions to write the numbers.
-static void adv_bignum_write_num (Driver *drvthis, char write_num_map[][4][3], int x, int num, int height)
+static void adv_bignum_write_num(Driver *drvthis, char num_map[][4][3], int x, int num, int height, int offset)
{
int y, dx;
for (y = 0; y < height; y++) {
- if (num == 10) // ":" is only 1 character wide.
- drvthis->chr(drvthis, x, y+1, write_num_map[num][y][0]);
+ if (num == 10) { // ":" is only 1 character wide.
+ unsigned char c = num_map[num][y][0];
+
+ // increase c by offset if it is a user-defined character
+ // Note: this is a bit of a kludge,
+ // we'd better check for c < offset+get_free_chars()
+ if (c < ' ')
+ c += offset;
+
+ drvthis->chr(drvthis, x, y+1, c);
+ }
else {
- for (dx = 0; dx < 3; dx++)
- drvthis->chr(drvthis, x + dx, y+1, write_num_map[num][y][dx]);
+ for (dx = 0; dx < 3; dx++) {
+ unsigned char c = num_map[num][y][dx];
+
+ // increase c by offset if it is a user-defined character
+ // Note: this is a bit of a kludge,
+ // we'd better check for c < offset+get_free_chars()
+ if (c < ' ')
+ c += offset;
+
+ drvthis->chr(drvthis, x + dx, y+1, c);
+ }
}
}
@@ -166,7 +189,7 @@ static void adv_bignum_write_num (Driver *drvthis, char write_num_map[][4][3], i
/////////////////////////////////////////////////////////////////////////////////////////////
// This function is called for a 2 line display without custom characters.
// (pretty ugly looking)
-static void adv_bignum_num_2_0 (Driver *drvthis, int x, int num, int height, int do_init)
+static void adv_bignum_num_2_0(Driver *drvthis, int x, int num, int height, int offset, int do_init)
{
static char num_map[][4][3] = {
{ /* 0 */
@@ -226,7 +249,7 @@ static void adv_bignum_num_2_0 (Driver *drvthis, int x, int num, int height, int
" " }
}; // Defines the character placing inside the bignumber.
- adv_bignum_write_num (drvthis, num_map, x, num, height); // write the number
+ adv_bignum_write_num(drvthis, num_map, x, num, height, offset); // write the number
}
@@ -234,7 +257,7 @@ static void adv_bignum_num_2_0 (Driver *drvthis, int x, int num, int height, int
/////////////////////////////////////////////////////////////////////////////////////////////
// This function is usable for a 2 line display with 1 or more custom characters.
// (not a beauty, but useable)
-static void adv_bignum_num_2_1 (Driver *drvthis, int x, int num, int height, int do_init)
+static void adv_bignum_num_2_1(Driver *drvthis, int x, int num, int height, int offset, int do_init)
{
static char num_map[][4][3] = {
{ /* 0 */
@@ -306,10 +329,10 @@ static void adv_bignum_num_2_1 (Driver *drvthis, int x, int num, int height, int
b_______,
b_______, }
};
- drvthis->set_char (drvthis, 0, bignum[0]); // put the customcharacter into the display
+ drvthis->set_char(drvthis, offset+0, bignum[0]); // put the customcharacter into the display
}
- adv_bignum_write_num (drvthis, num_map, x, num, height); // write the number
+ adv_bignum_write_num(drvthis, num_map, x, num, height, offset); // write the number
}
@@ -317,7 +340,7 @@ static void adv_bignum_num_2_1 (Driver *drvthis, int x, int num, int height, int
/////////////////////////////////////////////////////////////////////////////////////////////
// This function is usable for a 2 line display with 2 or more custom characters.
// (o.k.)
-static void adv_bignum_num_2_2 (Driver *drvthis, int x, int num, int height, int do_init)
+static void adv_bignum_num_2_2(Driver *drvthis, int x, int num, int height, int offset, int do_init)
{
static char num_map[][4][3] ={
{ /* 0 */
@@ -400,18 +423,18 @@ static void adv_bignum_num_2_2 (Driver *drvthis, int x, int num, int height, int
};
int i;
for (i = 0; i < 2; i++) { // put the customcharacters into the display
- drvthis->set_char (drvthis, i, bignum[i]);
+ drvthis->set_char(drvthis, offset+i, bignum[i]);
}
}
- adv_bignum_write_num (drvthis, num_map, x, num, height); // write the number
+ adv_bignum_write_num(drvthis, num_map, x, num, height, offset); // write the number
}
/////////////////////////////////////////////////////////////////////////////////////////////
// This function is usable for a 2 line display with 5 or more custom characters.
// (nice bignumbers)
-static void adv_bignum_num_2_5 (Driver *drvthis, int x, int num, int height, int do_init)
+static void adv_bignum_num_2_5(Driver *drvthis, int x, int num, int height, int offset, int do_init)
{
static char num_map[][4][3] =
{{{3 ,0 ,2}, /*0*/
@@ -510,18 +533,18 @@ static void adv_bignum_num_2_5 (Driver *drvthis, int x, int num, int height, int
int i;
for (i = 0; i < 5 ; i++) { // put the customcharacters into the display
- drvthis->set_char (drvthis, i, bignum[i]);
+ drvthis->set_char(drvthis, offset+i, bignum[i]);
}
}
- adv_bignum_write_num (drvthis, num_map, x, num, height); // write the number
+ adv_bignum_write_num(drvthis, num_map, x, num, height, offset); // write the number
}
/////////////////////////////////////////////////////////////////////////////////////////////
// This function is usable for a 2 line display with 28 or more custom characters.
// (Wow, allmost graphical)
-static void adv_bignum_num_2_28 (Driver *drvthis, int x, int num, int height, int do_init)
+static void adv_bignum_num_2_28(Driver *drvthis, int x, int num, int height, int offset, int do_init)
{
static char num_map[][4][3] =
{{{15 ,6 ,2}, /*0*/
@@ -827,18 +850,18 @@ static void adv_bignum_num_2_28 (Driver *drvthis, int x, int num, int height, in
int i;
for (i = 0; i < 28 ; i++) { // put the customcharacters into the display
- drvthis->set_char (drvthis, i, bignum[i]);
+ drvthis->set_char(drvthis, offset+i, bignum[i]);
}
}
- adv_bignum_write_num (drvthis, num_map, x, num, height); // write the number
+ adv_bignum_write_num(drvthis, num_map, x, num, height, offset); // write the number
}
/////////////////////////////////////////////////////////////////////////////////////////////
// This function is usable for a 4 line display without custom characters.
// (o.k.)
-static void adv_bignum_num_4_0 (Driver *drvthis, int x, int num, int height, int do_init)
+static void adv_bignum_num_4_0(Driver *drvthis, int x, int num, int height, int offset, int do_init)
{
/* Ugly code extracted by David GLAUDE from lcdm001.c ;)*/
/* Moved to driver.c by Joris Robijn */
@@ -901,14 +924,14 @@ static char num_map[][4][3] = {
" " }
}; // Defines the character placing inside the bignumber.
- adv_bignum_write_num(drvthis, num_map, x, num, height); // write the number
+ adv_bignum_write_num(drvthis, num_map, x, num, height, offset); // write the number
}
/////////////////////////////////////////////////////////////////////////////////////////////
// This function is usable for a 4 line display with 3 or more custom characters.
// (nice bignumbers)
-static void adv_bignum_num_4_3 (Driver *drvthis, int x, int num, int height, int do_init)
+static void adv_bignum_num_4_3(Driver *drvthis, int x, int num, int height, int offset, int do_init)
{
static char num_map[][4][3] =
{{{3 ,1 ,3}, /*0*/
@@ -989,18 +1012,18 @@ static char num_map[][4][3] =
int i;
for (i = 0; i < 3; i++) { // put the customcharacters into the display
- drvthis->set_char(drvthis, i+1, bignum[i]);
+ drvthis->set_char(drvthis, offset+i+1, bignum[i]);
}
}
- adv_bignum_write_num(drvthis, num_map, x, num, height); // write the number
+ adv_bignum_write_num(drvthis, num_map, x, num, height, offset); // write the number
}
/////////////////////////////////////////////////////////////////////////////////////////////
// This function is usable for a 4 line display with 8 or more custom characters.
// (nice bignumbers)
-static void adv_bignum_num_4_8 (Driver *drvthis, int x, int num, int height, int do_init)
+static void adv_bignum_num_4_8(Driver *drvthis, int x, int num, int height, int offset, int do_init)
{
static char num_map[][4][3] = {
{ /* 0: */
@@ -1138,9 +1161,9 @@ static char num_map[][4][3] = {
int i;
for (i = 0; i < 8 ; i++) { // put the customcharacters into the display
- drvthis->set_char(drvthis, i, bignum[i]);
+ drvthis->set_char(drvthis, offset+i, bignum[i]);
}
}
- adv_bignum_write_num(drvthis, num_map, x, num, height); // write the number
+ adv_bignum_write_num(drvthis, num_map, x, num, height, offset); // write the number
}
diff --git a/server/drivers/adv_bignum.h b/server/drivers/adv_bignum.h
index 78894a8..6494153 100644
--- a/server/drivers/adv_bignum.h
+++ b/server/drivers/adv_bignum.h
@@ -63,7 +63,7 @@
#define b_XXXXXX 0x3F
-void lib_adv_bignum (Driver *drvthis, int x, int num, int do_init, int customchars);
+void lib_adv_bignum(Driver *drvthis, int x, int num, int offset, int do_init);
diff --git a/server/drivers/hd44780.c b/server/drivers/hd44780.c
index 8eb028d..93f66b1 100644
--- a/server/drivers/hd44780.c
+++ b/server/drivers/hd44780.c
@@ -712,7 +712,7 @@ HD44780_num (Driver *drvthis, int x, int num)
}
// Lib_adv_bignum does everything needed to show the bignumbers.
- lib_adv_bignum(drvthis, x, num, do_init, NUM_CCs);
+ lib_adv_bignum(drvthis, x, num, 0, do_init);
}
diff --git a/server/drivers/serialVFD.c b/server/drivers/serialVFD.c
index c2b493e..5b4ca0a 100644
--- a/server/drivers/serialVFD.c
+++ b/server/drivers/serialVFD.c
@@ -505,7 +505,7 @@ serialVFD_num( Driver * drvthis, int x, int num )
p->ccmode = CCMODE_BIGNUM; // Switch customcharactermode to bignum.
}
// Lib_adv_bignum does everything needed to show the bignumbers.
- lib_adv_bignum(drvthis, x, num, do_init, p->customchars);
+ lib_adv_bignum(drvthis, x, num, 0, do_init);
}
diff --git a/server/drivers/tyan_lcdm.c b/server/drivers/tyan_lcdm.c
index 063397c..8559644 100644
--- a/server/drivers/tyan_lcdm.c
+++ b/server/drivers/tyan_lcdm.c
@@ -458,7 +458,7 @@ tyan_lcdm_num (Driver * drvthis, int x, int num)
}
// Lib_adv_bignum does everything needed to show the bignumbers.
- lib_adv_bignum(drvthis, x, num, do_init, NUM_CCs);
+ lib_adv_bignum(drvthis, x, num, 0, do_init);
}