diff --git a/docs/README.serialVFD b/docs/README.serialVFD index c81b731..e235592 100644 --- a/docs/README.serialVFD +++ b/docs/README.serialVFD @@ -24,8 +24,8 @@ If you want to add a new device to the driver add a new section to the displaytype-switch-case in the init-function and fill it - with the corrrect commands for the display. - (Try wich displaytype works best with your display, copy and modify + with the correct commands for the display. + (Try which displaytype works best with your display, copy and modify it's section that is the easiest way I guess.) @@ -33,10 +33,13 @@ http://www.maltepoeggel.de/html/vfd/index.html + It is possible to switch the display off and back on while the server is + running. It may take a few minutes untill the next full refresh makes + the display show everything correctly. To enable the bignumbers on 2-line displays (only this driver supports - this yet) you have to edit "/clientchrono.c" before compiling. + this yet) you have to edit "/clients/lcdproc/chrono.c" before compiling. In function "big_clock_screen" you have to replace the "4" by a "2" in this line: "if (lcd_hgt < 4)" diff --git a/server/drivers/adv_bignum.c b/server/drivers/adv_bignum.c index 1218a32..9fc4f25 100644 --- a/server/drivers/adv_bignum.c +++ b/server/drivers/adv_bignum.c @@ -23,27 +23,49 @@ - Demands on the calling driver / display: + Requirements to the calling driver / display: cellwidth == 5 - cellheight == 7 or 8 (testet only on 7) + cellheight == 7 or 8 (tested only on 7) needed functions: - drvthis->set_char (only if the display has usercharacters) + drvthis->set_char (only if the display has customcharacters) drvthis->chr - usercharacters (if available) at 0, 1, 2, ..... ,n + customcharacters (if available) at char 0, 1, 2, ..... ,n USAGE: Just call lib_adv_bignum(drvthis, x, num, height, do_init, customchars) from drvthis->num. - The library does everything needed to show bignumbers EXPECT checking or + 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 : + + MODULE_EXPORT void + serialVFD_num( Driver * drvthis, int x, int num ) + { + int do_init=0; + PrivateData *p = drvthis->private_data; + + + if (p->ccmode != CCMODE_BIGNUM) // Are the customcharacters set up correctly? If not: + { + do_init=1; // Lib_adv_bignum has to set the customcharacters. + 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); + } + + To enable the bignumbers on 2-line displays you have to edit "/clients/lcdproc/chrono.c" + before compiling. In function "big_clock_screen" you have to replace the "4" by a "2" in + this line: "if (lcd_hgt < 4)". + + */ #include -//#include #include -//#include #include #include #include @@ -75,36 +97,38 @@ static void adv_bignum_num_4_3 (Driver *drvthis, int x, int num, int height, int static void adv_bignum_write_num (Driver *drvthis, char write_num_map[][4][4], int x, int num, int height); - - +///////////////////////////////////////////////////////////////////////////////////////////// +// This function determines the best possible bignumbertype for the display. +// 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 height, int do_init, int customchars) { - switch (height) { - case 2: - case 3: - if(customchars == 0){ + 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 ){ + else if(customchars ==1 ){// 2 lines and customchars = 1 adv_bignum_num_2_1 (drvthis, x, num, height, do_init); } - else if(customchars < 3){ + 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){ + else if(customchars < 28){ // 2 lines and customchars = 5 ... 27 adv_bignum_num_2_5 (drvthis, x, num, height, do_init); } - else { //p->customchars <= 28 + else { // 2 lines and customchars >= 28 adv_bignum_num_2_28 (drvthis, x, num, height, do_init); } break; - case 4: - if(customchars < 3){ + case 4: // 4 lines + if(customchars < 3){// 4 lines and customchars < 3 adv_bignum_num_4_0 (drvthis, x, num, height, do_init); } - else { //p->customchars <= 4 + else { // 4 lines and customchars >= 3 adv_bignum_num_4_3 (drvthis, x, num, height, do_init); } break; @@ -113,12 +137,16 @@ lib_adv_bignum(Driver *drvthis, int x, int num, int height, int do_init, int cus } } + +///////////////////////////////////////////////////////////////////////////////////////////// +// This function writes the selected type of bignumber by calling the drivers_char function. +// It is called by displaydepending bignumber function to write the numbers. static void adv_bignum_write_num (Driver *drvthis, char write_num_map[][4][4], int x, int num, int height) { int y, dx; for (y = 0; y < height; y++) { - if(num == 10) + if(num == 10) // ":" is only 1 character wide. drvthis->chr (drvthis, x, y+1, write_num_map[num][y][0]); else for (dx = 0; dx <3; dx++) @@ -131,706 +159,720 @@ static void adv_bignum_write_num (Driver *drvthis, char write_num_map[][4][4], i // // // -// stored usercharacters +// Display dependent functions. // // // - - +///////////////////////////////////////////////////////////////////////////////////////////// +// 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 char num_map[][4][4] = { - { /* 0 */ - " ||", - " ||", - " ", - " " }, - { /* 1 */ - " |", - " |", - " ", - " " }, - { /* 2 */ - " ]", - " [ ", - " ", - " " }, - { /* 3 */ - " ]", - " ]", - " ", - " " }, - { /* 4 */ - " L|", - " |", - " ", - " " }, - { /* 5 */ - " [ ", - " ]", - " ", - " " }, - { /* 6 */ - " [ ", - " []", - " ", - " " }, - { /* 7 */ - " 7", - " |", - " ", - " " }, - { /* 8 */ - " []", - " []", - " ", - " " }, - { /* 9 */ - " []", - " ]", - " ", - " " }, - { /* colon */ - ".", - ".", - " ", - " " } - }; + static char num_map[][4][4] = { + { /* 0 */ + " ||", + " ||", + " ", + " " }, + { /* 1 */ + " |", + " |", + " ", + " " }, + { /* 2 */ + " ]", + " [ ", + " ", + " " }, + { /* 3 */ + " ]", + " ]", + " ", + " " }, + { /* 4 */ + " L|", + " |", + " ", + " " }, + { /* 5 */ + " [ ", + " ]", + " ", + " " }, + { /* 6 */ + " [ ", + " []", + " ", + " " }, + { /* 7 */ + " 7", + " |", + " ", + " " }, + { /* 8 */ + " []", + " []", + " ", + " " }, + { /* 9 */ + " []", + " ]", + " ", + " " }, + { /* colon */ + ".", + ".", + " ", + " " } + }; // Defines the character placing inside the bignumber. - adv_bignum_write_num (drvthis, num_map, x, num, height); + adv_bignum_write_num (drvthis, num_map, x, num, height); // write the number } - +///////////////////////////////////////////////////////////////////////////////////////////// +// 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 char num_map[][4][4] = { - { /* 0 */ - {'|' , 0 , '|',0}, - {"|_|"}, - {" "}, - {" "} }, - { /* 1 */ - {" |"}, - {" |"}, - {" "}, - {" "} }, - { /* 2 */ - {' ',0,']',0}, - {" [_"}, - {" "}, - {" "} }, - { /* 3 */ - {' ',0,']',0}, - {" _]"}, - {" "}, - {" "} }, - { /* 4 */ - {" L|"}, - {" |"}, - {" "}, - {" "} }, - { /* 5 */ - {' ','[',0,0}, - {" _]"}, - {" "}, - {" " }}, - { /* 6 */ - {' ','[',0,0}, - {" []"}, - {" "}, - {" "} }, - { /* 7 */ - {' ',0,'|',0}, - {" |"}, - {" "}, - {" "} }, - { /* 8 */ - {" []"}, - {" []"}, - {" "}, - {" "} }, - { /* 9 */ - {" []"}, - {" _]"}, - {" "}, - {" "} }, - { /* colon */ - {"."}, - {"."}, - {" "}, - {" "} } - }; -if (do_init) - { - static char bignum[1][5 * 8] = { - { - 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - }}; - drvthis->set_char (drvthis, 0, &bignum[0][0]); - } - adv_bignum_write_num (drvthis, num_map, x, num, height); + static char num_map[][4][4] = { + { /* 0 */ + {'|' , 0 , '|',0}, + {"|_|"}, + {" "}, + {" "} }, + { /* 1 */ + {" |"}, + {" |"}, + {" "}, + {" "} }, + { /* 2 */ + {' ',0,']',0}, + {" [_"}, + {" "}, + {" "} }, + { /* 3 */ + {' ',0,']',0}, + {" _]"}, + {" "}, + {" "} }, + { /* 4 */ + {" L|"}, + {" |"}, + {" "}, + {" "} }, + { /* 5 */ + {' ','[',0,0}, + {" _]"}, + {" "}, + {" " }}, + { /* 6 */ + {' ','[',0,0}, + {" []"}, + {" "}, + {" "} }, + { /* 7 */ + {' ',0,'|',0}, + {" |"}, + {" "}, + {" "} }, + { /* 8 */ + {" []"}, + {" []"}, + {" "}, + {" "} }, + { /* 9 */ + {" []"}, + {" _]"}, + {" "}, + {" "} }, + { /* colon */ + {"."}, + {"."}, + {" "}, + {" "} } + }; // Defines the character placing inside the bignumber. + if (do_init) // Set customcharacters if needed. + { + static char bignum[1][5 * 8] = { // stored customcharacter + { + 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + }}; + drvthis->set_char (drvthis, 0, &bignum[0][0]); // put the customcharacter into the display + } + adv_bignum_write_num (drvthis, num_map, x, num, height); // write the number } - +///////////////////////////////////////////////////////////////////////////////////////////// +// 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 char num_map[][4][4] ={ - { /* 0 */ - {'|',0,'|'}, - "|_|", - " ", - " " }, - { /* 1 */ - " |", - " |", - " ", - " " }, - { /* 2 */ - {' ',1,'|'}, - "|_ ", - " ", - " " }, - { /* 3 */ - {' ',1,'|'}, - " _|", - " ", - " " }, - { /* 4 */ - "|_|", - " |", - " ", - " " }, - { /* 5 */ - {'|',1,' '}, - " _|", - " ", - " " }, - { /* 6 */ - {'|',0,' '}, - {'|',1,'|'}, - " ", - " " }, - { /* 7 */ - {' ',0,'|'}, - " |", - " ", - " " }, - { /* 8 */ - {'|',1,'|'}, - "|_|", - " ", - " " }, - { /* 9 */ - {'|',1,'|'}, - " _|", - " ", - " " }, - { /* colon */ - ".", - ".", - " ", - " " } - }; -if (do_init) - { - static char bignum[2][5 * 8] = { - { - 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - }, + static char num_map[][4][4] ={ + { /* 0 */ + {'|',0,'|'}, + "|_|", + " ", + " " }, + { /* 1 */ + " |", + " |", + " ", + " " }, + { /* 2 */ + {' ',1,'|'}, + "|_ ", + " ", + " " }, + { /* 3 */ + {' ',1,'|'}, + " _|", + " ", + " " }, + { /* 4 */ + "|_|", + " |", + " ", + " " }, + { /* 5 */ + {'|',1,' '}, + " _|", + " ", + " " }, + { /* 6 */ + {'|',0,' '}, + {'|',1,'|'}, + " ", + " " }, + { /* 7 */ + {' ',0,'|'}, + " |", + " ", + " " }, + { /* 8 */ + {'|',1,'|'}, + "|_|", + " ", + " " }, + { /* 9 */ + {'|',1,'|'}, + " _|", + " ", + " " }, + { /* colon */ + ".", + ".", + " ", + " " } + }; // Defines the character placing inside the bignumber. + if (do_init) // Set customcharacters if needed. { - 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, - }}; + static char bignum[2][5 * 8] = { // stored customcharacters + { + 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + }, + { + 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, + }}; int i; - for (i = 0; i <= 2 ; i++) { - drvthis->set_char (drvthis, i, &bignum[i][0]); - } -} - adv_bignum_write_num (drvthis, num_map, x, num, height); + for (i = 0; i <= 2 ; i++) { // put the customcharacters into the display + drvthis->set_char (drvthis, i, &bignum[i][0]); + } + } + adv_bignum_write_num (drvthis, num_map, x, num, height); // 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 char num_map[][4][4] = - {{{3 ,0 ,2}, /*0*/ - {3 ,1 ,2}, - {" "}, - {" "}}, - {{' ' ,' ', 2},/*1*/ - {' ' ,' ', 2}, - {" "}, - {" "}}, - {{' ' ,4 ,2},/*2*/ - {3 ,1 ,' '}, - {" "}, - {" "}}, - {{' ' ,4 ,2},/*3*/ - {' ' ,1 ,2}, - {" "}, - {" "}}, - {{3 ,1 ,2},/*4*/ - {' ' ,' ' ,2}, - {" "}, - {" "}}, - {{3 ,4 ,' '},/*5*/ - {' ' ,1 ,2}, - {" "}, - {" "}}, - {{3 ,0 ,' '},/*6*/ - {3 ,4 ,2}, - {" "}, - {" "}}, - {{' ' ,0 ,2},/*7*/ - {' ' ,' ' ,2}, - {" "}, - {" "}}, - {{3 ,4 ,2},/*8*/ - {3 ,1 ,2}, - {" "}, - {" "}}, - {{3 ,4 ,2},/*9*/ - {' ' ,1 ,2}, - {" "}, - {" "}}, - {{'.'},/*:*/ - {'.'}, - {" "}, - {" "}}}; -if (do_init) - { - static char bignum[5][5 * 8] = { - { - 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - }, + static char num_map[][4][4] = + {{{3 ,0 ,2}, /*0*/ + {3 ,1 ,2}, + {" "}, + {" "}}, + {{' ' ,' ', 2},/*1*/ + {' ' ,' ', 2}, + {" "}, + {" "}}, + {{' ' ,4 ,2},/*2*/ + {3 ,1 ,' '}, + {" "}, + {" "}}, + {{' ' ,4 ,2},/*3*/ + {' ' ,1 ,2}, + {" "}, + {" "}}, + {{3 ,1 ,2},/*4*/ + {' ' ,' ' ,2}, + {" "}, + {" "}}, + {{3 ,4 ,' '},/*5*/ + {' ' ,1 ,2}, + {" "}, + {" "}}, + {{3 ,0 ,' '},/*6*/ + {3 ,4 ,2}, + {" "}, + {" "}}, + {{' ' ,0 ,2},/*7*/ + {' ' ,' ' ,2}, + {" "}, + {" "}}, + {{3 ,4 ,2},/*8*/ + {3 ,1 ,2}, + {" "}, + {" "}}, + {{3 ,4 ,2},/*9*/ + {' ' ,1 ,2}, + {" "}, + {" "}}, + {{'.'},/*:*/ + {'.'}, + {" "}, + {" "}}}; // Defines the character placing inside the bignumber. + if (do_init) // Set customcharacters if needed. { - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, - }, + static char bignum[5][5 * 8] = { // stored customcharacters { - 1, 1, 1, 0, 0, - 1, 1, 1, 0, 0, - 1, 1, 1, 0, 0, - 1, 1, 1, 0, 0, - 1, 1, 1, 0, 0, - 1, 1, 1, 0, 0, - 1, 1, 1, 0, 0, - 1, 1, 1, 0, 0, - }, + 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + }, + { + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, + }, + { + 1, 1, 1, 0, 0, + 1, 1, 1, 0, 0, + 1, 1, 1, 0, 0, + 1, 1, 1, 0, 0, + 1, 1, 1, 0, 0, + 1, 1, 1, 0, 0, + 1, 1, 1, 0, 0, + 1, 1, 1, 0, 0, + }, + { + 0, 0, 1, 1, 1, + 0, 0, 1, 1, 1, + 0, 0, 1, 1, 1, + 0, 0, 1, 1, 1, + 0, 0, 1, 1, 1, + 0, 0, 1, 1, 1, + 0, 0, 1, 1, 1, + 0, 0, 1, 1, 1, + }, { - 0, 0, 1, 1, 1, - 0, 0, 1, 1, 1, - 0, 0, 1, 1, 1, - 0, 0, 1, 1, 1, - 0, 0, 1, 1, 1, - 0, 0, 1, 1, 1, - 0, 0, 1, 1, 1, - 0, 0, 1, 1, 1, - }, - { - 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 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, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, + }}; int i; - for (i = 0; i <= 5 ; i++) { - drvthis->set_char (drvthis, i, &bignum[i][0]); - } -} - adv_bignum_write_num (drvthis, num_map, x, num, height); + for (i = 0; i <= 5 ; i++) { // put the customcharacters into the display + drvthis->set_char (drvthis, i, &bignum[i][0]); + } + } + adv_bignum_write_num (drvthis, num_map, x, num, height); // 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 char num_map[][4][4] = - {{{15 ,6 ,2}, /*0*/ - {14 ,4 ,5}, - {" "}, - {" "}}, - {{' ' ,26 ,' '},/*1*/ - {' ' ,10 ,' '}, - {" "}, - {" "}}, - {{1 ,6 ,2},/*2*/ - {7 ,8 ,9}, - {" "}, - {" "}}, - {{0 ,11 ,2},/*3*/ - {3 ,13 ,5}, - {" "}, - {" "}}, - {{25 ,21 ,23},/*4*/ - {17 ,22 ,24}, - {" "}, - {" "}}, - {{10 ,11 ,12},/*5*/ - {3 ,13 ,5}, - {" "}, - {" "}}, - {{15 ,11 ,16},/*6*/ - {14 ,13 ,5}, - {" "}, - {" "}}, - {{17 ,18 ,19},/*7*/ - {' ' ,20 ,' '}, - {" "}, - {" "}}, - {{15 ,11 ,2},/*8*/ - {14 ,13 ,5}, - {" "}, - {" "}}, - {{15 ,11 ,2},/*9*/ - {3 ,13 ,5}, - {" "}, - {" "}}, - {{27},/*:*/ - {27}, - {" "}, - {" "}}}; + static char num_map[][4][4] = + {{{15 ,6 ,2}, /*0*/ + {14 ,4 ,5}, + {" "}, + {" "}}, + {{' ' ,26 ,' '},/*1*/ + {' ' ,10 ,' '}, + {" "}, + {" "}}, + {{1 ,6 ,2},/*2*/ + {7 ,8 ,9}, + {" "}, + {" "}}, + {{0 ,11 ,2},/*3*/ + {3 ,13 ,5}, + {" "}, + {" "}}, + {{25 ,21 ,23},/*4*/ + {17 ,22 ,24}, + {" "}, + {" "}}, + {{10 ,11 ,12},/*5*/ + {3 ,13 ,5}, + {" "}, + {" "}}, + {{15 ,11 ,16},/*6*/ + {14 ,13 ,5}, + {" "}, + {" "}}, + {{17 ,18 ,19},/*7*/ + {' ' ,20 ,' '}, + {" "}, + {" "}}, + {{15 ,11 ,2},/*8*/ + {14 ,13 ,5}, + {" "}, + {" "}}, + {{15 ,11 ,2},/*9*/ + {3 ,13 ,5}, + {" "}, + {" "}}, + {{27},/*:*/ + {27}, + {" "}, + {" "}}}; // Defines the character placing inside the bignumber. - if (do_init) - { + if (do_init) // Set customcharacters if needed. + { -static char bignum[28][5 * 8] = { - { //0 - 0, 0, 0, 1, 1, - 0, 0, 1, 1, 1, - 0, 0, 1, 1, 1, - 0, 0, 0, 0, 0, - 0, 0, 0, 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, 0, 1, 1, 1, - 0, 0, 1, 1, 1, - 0, 0, 1, 1, 1, - }, - { //16 - 1, 1, 0, 0, 0, - 1, 1, 1, 0, 0, - 1, 1, 1, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - }, - { //17 - 0, 0, 1, 1, 1, - 0, 0, 1, 1, 1, - 0, 0, 1, 1, 1, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - }, - { //18 - 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, - 0, 0, 0, 1, 1, - 0, 0, 1, 1, 1, - 0, 0, 1, 1, 1, - }, - { //19 - 1, 1, 1, 0, 0, - 1, 1, 1, 0, 0, - 1, 1, 1, 0, 0, - 1, 1, 1, 0, 0, - 1, 1, 0, 0, 0, - 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - }, - { //20 - 0, 1, 1, 1, 0, - 0, 1, 1, 1, 0, - 1, 1, 1, 1, 0, - 1, 1, 1, 0, 0, - 1, 1, 1, 0, 0, - 1, 1, 1, 0, 0, - 1, 1, 1, 0, 0, - 1, 1, 1, 0, 0, - }, - { //21 - 0, 0, 0, 0, 1, - 0, 0, 0, 1, 1, - 0, 0, 1, 1, 1, - 0, 1, 1, 1, 1, - 1, 1, 1, 1, 1, - 1, 1, 1, 0, 1, - 1, 1, 0, 0, 1, - 1, 1, 0, 0, 1, - }, - { //22 - 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, - 0, 0, 0, 0, 1, - 0, 0, 0, 0, 1, - 0, 0, 0, 0, 1, - 0, 0, 0, 0, 1, - 0, 0, 0, 0, 1, - }, - { //23 - 1, 0, 0, 0, 0, - 1, 0, 0, 0, 0, - 1, 0, 0, 0, 0, - 1, 0, 0, 0, 0, - 1, 0, 0, 0, 0, - 1, 0, 0, 0, 0, - 1, 0, 0, 0, 0, - 1, 0, 0, 0, 0, - }, - { //24 - 1, 1, 1, 0, 0, - 1, 1, 1, 0, 0, - 1, 1, 1, 0, 0, - 1, 0, 0, 0, 0, - 1, 0, 0, 0, 0, - 1, 0, 0, 0, 0, - 1, 0, 0, 0, 0, - 1, 0, 0, 0, 0, - }, - { //25 - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, - 0, 0, 0, 0, 1, - }, - { //26 - 0, 0, 1, 1, 1, - 0, 0, 1, 1, 1, - 0, 1, 1, 1, 1, - 1, 1, 1, 1, 1, - 0, 0, 1, 1, 1, - 0, 0, 1, 1, 1, - 0, 0, 1, 1, 1, - 0, 0, 1, 1, 1, - }, - { //27 - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 1, 1, 0, - 0, 0, 1, 1, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - } - }; - int i; - for (i = 0; i <= 28 ; i++) { - drvthis->set_char (drvthis, i, &bignum[i][0]); - } -} - adv_bignum_write_num (drvthis, num_map, x, num, height); + static char bignum[28][5 * 8] = { // stored customcharacters + { //0 + 0, 0, 0, 1, 1, + 0, 0, 1, 1, 1, + 0, 0, 1, 1, 1, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + }, + { //1 + 0, 0, 0, 1, 1, + 0, 0, 1, 1, 1, + 0, 0, 1, 1, 1, + 0, 0, 1, 1, 1, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0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0, + }, + { //17 + 0, 0, 1, 1, 1, + 0, 0, 1, 1, 1, + 0, 0, 1, 1, 1, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + }, + { //18 + 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, + 0, 0, 0, 1, 1, + 0, 0, 0, 1, 1, + 0, 0, 1, 1, 1, + 0, 0, 1, 1, 1, + }, + { //19 + 1, 1, 1, 0, 0, + 1, 1, 1, 0, 0, + 1, 1, 1, 0, 0, + 1, 1, 1, 0, 0, + 1, 1, 0, 0, 0, + 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + }, + { //20 + 0, 1, 1, 1, 0, + 0, 1, 1, 1, 0, + 1, 1, 1, 1, 0, + 1, 1, 1, 0, 0, + 1, 1, 1, 0, 0, + 1, 1, 1, 0, 0, + 1, 1, 1, 0, 0, + 1, 1, 1, 0, 0, + }, + { //21 + 0, 0, 0, 0, 1, + 0, 0, 0, 1, 1, + 0, 0, 1, 1, 1, + 0, 1, 1, 1, 1, + 1, 1, 1, 1, 1, + 1, 1, 1, 0, 1, + 1, 1, 0, 0, 1, + 1, 1, 0, 0, 1, + }, + { //22 + 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, + 0, 0, 0, 0, 1, + 0, 0, 0, 0, 1, + 0, 0, 0, 0, 1, + 0, 0, 0, 0, 1, + 0, 0, 0, 0, 1, + }, + { //23 + 1, 0, 0, 0, 0, + 1, 0, 0, 0, 0, + 1, 0, 0, 0, 0, + 1, 0, 0, 0, 0, + 1, 0, 0, 0, 0, + 1, 0, 0, 0, 0, + 1, 0, 0, 0, 0, + 1, 0, 0, 0, 0, + }, + { //24 + 1, 1, 1, 0, 0, + 1, 1, 1, 0, 0, + 1, 1, 1, 0, 0, + 1, 0, 0, 0, 0, + 1, 0, 0, 0, 0, + 1, 0, 0, 0, 0, + 1, 0, 0, 0, 0, + 1, 0, 0, 0, 0, + }, + { //25 + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, + 0, 0, 0, 0, 1, + }, + { //26 + 0, 0, 1, 1, 1, + 0, 0, 1, 1, 1, + 0, 1, 1, 1, 1, + 1, 1, 1, 1, 1, + 0, 0, 1, 1, 1, + 0, 0, 1, 1, 1, + 0, 0, 1, 1, 1, + 0, 0, 1, 1, 1, + }, + { //27 + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 1, 1, 0, + 0, 0, 1, 1, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + } + }; + int i; + for (i = 0; i <= 28 ; i++) { // put the customcharacters into the display + drvthis->set_char (drvthis, i, &bignum[i][0]); + } + } + adv_bignum_write_num (drvthis, num_map, x, num, height); // 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) { + /* Ugly code extracted by David GLAUDE from lcdm001.c ;)*/ + /* Moved to driver.c by Joris Robijn */ + // Moved to adv_bignum.c by Stefan Herdler static char num_map[][4][4] = { { /* 0 */ " _ ", @@ -887,13 +929,15 @@ static char num_map[][4][4] = { ".", ".", " " } - }; + }; // Defines the character placing inside the bignumber. - adv_bignum_write_num (drvthis, num_map, x, num, height); + adv_bignum_write_num (drvthis, num_map, x, num, height); // write the number } - +///////////////////////////////////////////////////////////////////////////////////////////// +// This function is usable for a 4 line display with 5 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 char num_map[][4][4] = @@ -940,10 +984,10 @@ static char num_map[][4][4] = {{" "},/*:*/ {'.'}, {'.'}, - {" "}}}; -if (do_init) + {" "}}}; // Defines the character placing inside the bignumber. +if (do_init) // Set customcharacters if needed. { - static char bignum[5][5 * 8] = { + static char bignum[5][5 * 8] = { // stored customcharacters { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -976,11 +1020,11 @@ if (do_init) } }; int i; - for (i = 0; i <= 3 ; i++) { + for (i = 0; i <= 3 ; i++) { // put the customcharacters into the display drvthis->set_char (drvthis, i, &bignum[i][0]); } } - adv_bignum_write_num (drvthis, num_map, x, num, height); + adv_bignum_write_num (drvthis, num_map, x, num, height); // write the number } diff --git a/server/drivers/serialVFD.c b/server/drivers/serialVFD.c index 15cad1b..e1df4b4 100644 --- a/server/drivers/serialVFD.c +++ b/server/drivers/serialVFD.c @@ -2,11 +2,11 @@ Copyright (C) 2006 Stefan Herdler - This driver is based on drv_base.c, wirz-sli.c and hd44780 from LCDproc - and the NoritakeVFD driver from this package. + This driver is based on wirz-sli.c, hd44780.c, drv_base.c and NoritakeVFD + driver. It may contain parts of other drivers of this package too. - 2006-01-26 Version 0.1: everything should work (not all hardware tested!) + 2006-02-13 Version 0.2: everything should work (not all hardware tested!) 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 @@ -55,16 +55,16 @@ it's section that is the easiest way I guess.) - On this page I found pictures and datasheets from the VFD's: + On this page I found pictures and datasheets of the VFD's: http://www.maltepoeggel.de/html/vfd/index.html To enable the bignumbers on 2-line displays (only this driver supports - this yet) you have to edit "/clientchrono.c" before compiling. + this yet) you have to edit "/clients/lcdproc/chrono.c" before compiling. In function "big_clock_screen" you have to replace the "4" by a "2" in - this line: "if (lcd_hgt < 4)" + this line: "if (lcd_hgt < 4)". @@ -192,24 +192,13 @@ get_info Implemented. #include "lcd_lib.h" #include "adv_bignum.h" -#define pos1_cursor 4 -#define mv_cursor 5 //moves cursor to position (next byte). -#define reset 6 -#define init_cmds 7 -#define set_user_char 8 +#define pos1_cursor 4 //moves cursor to top left character. +#define mv_cursor 5 //moves cursor to position specified by the next byte. +#define reset 6 //reset +#define init_cmds 7 //commands needed to initialize the display. +#define set_user_char 8 //set user character. #define hor_tab 9 //moves cursor 1 chr right -/* Constants for userdefchar_mode */ -//#define NUM_CCs 8 /* max. number of custom characters */ - -//typedef enum { -// standard, /* only char 0 is used for heartbeat */ -// vbar, /* vertical bars */ -// hbar, /* horizontal bars */ -// custom, /* custom settings */ -// bignum, -// } CGmode; - typedef struct driver_private_data { char device[200]; int fd; @@ -225,6 +214,7 @@ typedef struct driver_private_data { int brightness; int customchars; int ISO_8859_1; + unsigned int refresh_timer; unsigned char charmap[128]; int display_type; char custom_char[31][7]; // used for "KD Rev 2.1" only @@ -245,10 +235,11 @@ MODULE_EXPORT int supports_multiple = 0; MODULE_EXPORT char *symbol_prefix = "serialVFD_"; /* Internal functions */ -static void serialVFD_init_vbar (Driver *drvthis); -static void serialVFD_init_hbar (Driver *drvthis); -static void serialVFD_draw_frame (Driver *drvthis, char *dat); - +void serialVFD_init_vbar (Driver *drvthis); +void serialVFD_init_hbar (Driver *drvthis); +void serialVFD_draw_frame (Driver *drvthis, char *dat); +void serialVFD_put_brightness (Driver *drvthis); +void serialVFD_put_char (Driver *drvthis, int n); // Opens com port and sets baud correctly... // @@ -257,7 +248,6 @@ serialVFD_init (Driver *drvthis) { struct termios portset; int tmp, w, h, brightness; -// int reboot = 0; char size[200] = DEFAULT_SIZE; PrivateData *p; @@ -274,6 +264,7 @@ serialVFD_init (Driver *drvthis) p->cellheight = DEFAULT_CELL_HEIGHT; p->ccmode = CCMODE_STANDARD; p->ISO_8859_1 = 1; + p->refresh_timer = 0; debug(RPT_INFO, "%s(%p)", __FUNCTION__, drvthis ); @@ -664,27 +655,36 @@ serialVFD_init (Driver *drvthis) ///////////////////////////////////////////////////////////////// -// Changes screen brightness (0-255; 140 seems good) +// Changes screen brightness (0 min ... 255 max ... 1000 also max) // MODULE_EXPORT void serialVFD_set_brightness (Driver *drvthis, int state, int brightness) -{ +{ // set p->brightness PrivateData *p = drvthis->private_data; - int realbrightness = -1; - if (brightness > 0) { + + if (brightness > 0) + { if (brightness > 255) brightness = 255; if (p->brightness != brightness) - { - realbrightness = (int) (brightness / 64); - write (p->fd, &p->hw_cmd[realbrightness][1],\ - p->hw_cmd[realbrightness][0]); - } - p->brightness=brightness; + { + p->brightness=brightness; + serialVFD_put_brightness (drvthis); + } } } +void +serialVFD_put_brightness (Driver *drvthis) +{ // set hardware brightness + PrivateData *p = drvthis->private_data; + int realbrightness = (int) (p->brightness / 64); + //(4 steps 0-64, 65-128, 129-192, 193-1000) + + write (p->fd, &p->hw_cmd[realbrightness][1],\ + p->hw_cmd[realbrightness][0]); +} ///////////////////////////////////////////////////////////////// @@ -723,7 +723,7 @@ serialVFD_hbar (Driver *drvthis, int x, int y, int len, int promille, int option // MODULE_EXPORT void serialVFD_set_char (Driver *drvthis, int n, char *dat) -{ +{ //set char in p->custom_char PrivateData *p = drvthis->private_data; int letter=0; unsigned int byte, bit; @@ -734,41 +734,36 @@ serialVFD_set_char (Driver *drvthis, int n, char *dat) return; - if(p->display_type==1) + for (byte = 0;byte < p->usr_chr_dot_assignment[0]; byte++) { - for (byte = 0;byte < p->usr_chr_dot_assignment[0]; byte++) + for (bit = 0;bit < 8; bit++) { - for (bit = 0;bit < 8; bit++) - { - if((int)p->usr_chr_dot_assignment[bit+8*byte+1] != 0) - letter |= (dat[(int)p->usr_chr_dot_assignment[bit+8*byte+1]-1] << bit); - } - p->custom_char[n][byte] = letter; - letter = 0; + if((int)p->usr_chr_dot_assignment[bit+8*byte+1] != 0) + letter |= (dat[(int)p->usr_chr_dot_assignment[bit+8*byte+1]-1] << bit); } + p->custom_char[n][byte] = letter; + letter = 0; } - else - { - write (p->fd, &p->hw_cmd[set_user_char][1],\ - p->hw_cmd[set_user_char][0]); - write (p->fd, &p->usr_chr_mapping[n], 1); + if (p->display_type != 1) //not KD Rev 2.1 + serialVFD_put_char (drvthis, n); - for (byte = 0;byte < p->usr_chr_dot_assignment[0]; byte++) - { - for (bit = 0;bit < 8; bit++) - { - if((int)p->usr_chr_dot_assignment[bit+8*byte+1] != 0) - letter |= (dat[(int)p->usr_chr_dot_assignment[bit+8*byte+1]-1] << bit); - } - write (p->fd, &letter, 1); - letter = 0; - } - } if (p->need_refresh == 1) p->custom_char_changed[n]=1; } +void +serialVFD_put_char (Driver *drvthis, int n) +{ // put char in display + PrivateData *p = drvthis->private_data; + write (p->fd, &p->hw_cmd[set_user_char][1],\ + p->hw_cmd[set_user_char][0]);// substitute and select Character to overwrite + write (p->fd, &p->usr_chr_mapping[n], 1); + write (p->fd, &p->custom_char[n][0], p->usr_chr_dot_assignment[0]);// overwrite selected Character +} + + + ///////////////////////////////////////////////////////////// // Blasts a single frame onscreen, to the lcd... // @@ -782,6 +777,30 @@ serialVFD_draw_frame (Driver *drvthis, char *dat) if (!dat) return; + if (p->refresh_timer > 500) // Do a full refresh every 500 refreshs. + // With this it is possible to switch display on and off while lcdproc is running + { + write (p->fd, &p->hw_cmd[init_cmds][1],p->hw_cmd[init_cmds][0]); + serialVFD_put_brightness (drvthis); // restore brightness + + for (i = 0; i < (p->height * p->width); i++) + p->backingstore[i]=0; // clear Backing-store + + if (p->display_type != 1) //not KD Rev 2.1 + { + for(i=0;icustomchars;i++) // refresh all customcharacters + serialVFD_put_char (drvthis, i); +/* { + write (p->fd, &p->hw_cmd[set_user_char][1],\ + p->hw_cmd[set_user_char][0]);// substitute and select character to overwrite + write (p->fd, &p->usr_chr_mapping[i], 1); + write (p->fd, &p->custom_char[(int)dat[i]][0], p->usr_chr_dot_assignment[0]);// overwrite selected Character + }*/ + } + p->refresh_timer = 0; + } + p->refresh_timer++; + for (i = 0; i < (p->height * p->width); i++) { @@ -809,20 +828,20 @@ serialVFD_draw_frame (Driver *drvthis, char *dat) } } - if(dat[i] >= 0 && dat[i] <= 30) + if(dat[i] >= 0 && dat[i] <= 30) // custom character { if (p->display_type == 1) // KD Rev 2.1 only { - write (p->fd, "\x1A\xDB", 2); // substitute and select Character to overwrite (237) - write (p->fd, &p->custom_char[(int)dat[i]][0], 7);// overwrite selected Character - write (p->fd, "\xDB", 1); // Write Character + write (p->fd, "\x1A\xDB", 2); // substitute and select character to overwrite (237) + write (p->fd, &p->custom_char[(int)dat[i]][0], 7);// overwrite selected character + write (p->fd, "\xDB", 1); // write character } else // all other displays { write (p->fd, &p->usr_chr_mapping[(int)dat[i]], 1); } } - else if(dat[i] < 0 && (p->ISO_8859_1 != 0)) + else if(dat[i] < 0 && (p->ISO_8859_1 != 0)) // ISO_8859_1 translation for 129 ... 255 { write (p->fd, &p->charmap[dat[i] + 128], 1); } @@ -835,11 +854,11 @@ serialVFD_draw_frame (Driver *drvthis, char *dat) } } - if (last_chr != -10) + if (last_chr != -10) // update backingstore if something changed { memcpy(p->backingstore, dat, p->height * p->width); int i; - for(i=0;i<32;i++) + for(i=0;icustomchars;i++) p->custom_char_changed[i]=0; } @@ -854,11 +873,12 @@ serialVFD_num( Driver * drvthis, int x, int num ) PrivateData *p = drvthis->private_data; - if (p->ccmode != CCMODE_BIGNUM) + if (p->ccmode != CCMODE_BIGNUM) // Are the customcharacters set up correctly? If not: { - do_init=1; - p->ccmode = CCMODE_BIGNUM; + do_init=1; // Lib_adv_bignum has to set the customcharacters. + 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); } @@ -906,7 +926,6 @@ serialVFD_icon (Driver *drvthis, int x, int y, int icon) p->ccmode = CCMODE_STANDARD; serialVFD_set_char(drvthis, 0, icons[0]); serialVFD_chr(drvthis, x, y, 0); -// serialVFD_chr(drvthis, x, y, 127 ); break; default: return -1; // Let the core do other icons @@ -1196,6 +1215,6 @@ MODULE_EXPORT char * serialVFD_get_info (Driver *drvthis) { PrivateData *p = drvthis->private_data; - strcpy(p->info, "Driver for many serialVFDs from NEC(all FIPC based), Noritake, Futaba and the \"KD Rev2.1\"VFD"); + strcpy(p->info, "Driver for many serialVFDs from NEC(all FIPC based), Noritake, Futaba and the \"KD Rev2.1\"VFD."); return p->info; } diff --git a/server/drivers/serialVFD.h b/server/drivers/serialVFD.h index 28891eb..adcb97a 100644 --- a/server/drivers/serialVFD.h +++ b/server/drivers/serialVFD.h @@ -2,11 +2,11 @@ Copyright (C) 2006 Stefan Herdler - This driver is based on drv_base.c, wirz-sli.c and hd44780 from LCDproc - 0.4.5 and the NoritakeVFD driver from this package. + This driver is based on wirz-sli.c, hd44780.c, drv_base.c and NoritakeVFD + driver. It may contain parts of other drivers of this package too. - 2006-01-26 Version 0.1: everything should work (not all hardware tested!) + 2006-02-13 Version 0.2: everything should work (not all hardware tested!) 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