Server no longer uses a fixed lcd structure, but now a pointer to
a lcd_logical_driver structure (lcd_ptr). Fixed bug in lcd.c which caused lcd_drv_getkey_loop to act badly.
This commit is contained in:
@@ -111,7 +111,7 @@ hello_func (client * c, int argc, char **argv)
|
||||
|
||||
memset(str, '\0', sizeof(str));
|
||||
snprintf (str, sizeof(str), "connect LCDproc %s protocol %s lcd wid %i hgt %i cellwid %i cellhgt %i\n",
|
||||
version, protocol_version, lcd.wid, lcd.hgt, lcd.cellwid, lcd.cellhgt);
|
||||
version, protocol_version, lcd_ptr->wid, lcd_ptr->hgt, lcd_ptr->cellwid, lcd_ptr->cellhgt);
|
||||
|
||||
// lcdproc (client) depends on the above format...
|
||||
// snprintf (str, sizeof(str), "connect LCDproc %s protocol %s LCD %ix%i with cells %ix%i\n",
|
||||
@@ -1355,7 +1355,7 @@ output_func (client * c, int argc, char **argv)
|
||||
// draw_screen(screen * s, int timer)
|
||||
// Whatever for?
|
||||
|
||||
// lcd.output (output_state);
|
||||
// lcd_ptr->output (output_state);
|
||||
|
||||
syslog(LOG_NOTICE, "output states changed");
|
||||
return 0;
|
||||
@@ -1376,7 +1376,7 @@ info_func (client * c, int argc, char **argv)
|
||||
}
|
||||
|
||||
memset(str, '\0', sizeof(str));
|
||||
snprintf (str, sizeof(str), (char*) lcd.getinfo());
|
||||
snprintf (str, sizeof(str), (char*) lcd_ptr->getinfo());
|
||||
|
||||
sock_send_string (c->sock, str);
|
||||
|
||||
|
||||
+34
-15
@@ -59,6 +59,12 @@ static char lcd_drv_getkey ();
|
||||
static char lcd_drv_getkey_loop ();
|
||||
static char *lcd_drv_getinfo ();
|
||||
|
||||
/*
|
||||
* Add all of the driver's header files in...
|
||||
* but WHY?
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef MTXORB_DRV
|
||||
#include "MtxOrb.h"
|
||||
#endif
|
||||
@@ -138,7 +144,7 @@ static char *lcd_drv_getinfo ();
|
||||
|
||||
// TODO: Make a Windows server, and clients...?
|
||||
|
||||
lcd_logical_driver lcd, *lcd_root = NULL;
|
||||
lcd_logical_driver lcd, *lcd_root = NULL, *lcd_ptr = NULL;
|
||||
|
||||
// TODO: Add multiple names for the same driver?
|
||||
//
|
||||
@@ -150,15 +156,19 @@ lcd_physical_driver drivers[] = {
|
||||
|
||||
#ifdef MTXORB_DRV
|
||||
{"MtxOrb", MtxOrb_init,},
|
||||
{"MatrixOrbital", MtxOrb_init,},
|
||||
#endif
|
||||
#ifdef CFONTZ_DRV
|
||||
{"CFontz", CFontz_init,},
|
||||
{"CrystalFontz", CFontz_init,},
|
||||
#endif
|
||||
#ifdef HD44780_DRV
|
||||
{"HD44780", HD44780_init,},
|
||||
{"Hitachi", HD44780_init,},
|
||||
#endif
|
||||
#ifdef SLI_DRV
|
||||
{"sli", sli_init,},
|
||||
{"Wirz", sli_init,},
|
||||
#endif
|
||||
#ifdef LB216_DRV
|
||||
{"LB216", LB216_init,},
|
||||
@@ -171,9 +181,11 @@ lcd_physical_driver drivers[] = {
|
||||
#endif
|
||||
#ifdef CURSES_DRV
|
||||
{"curses", curses_drv_init,},
|
||||
{"ncurses", curses_drv_init,},
|
||||
#endif
|
||||
#ifdef JOY_DRV
|
||||
{"joy", joy_init,},
|
||||
{"joystick", joy_init,},
|
||||
#endif
|
||||
#ifdef IRMANIN_DRV
|
||||
{"irmanin", irmanin_init,},
|
||||
@@ -186,6 +198,7 @@ lcd_physical_driver drivers[] = {
|
||||
#endif
|
||||
#ifdef GLK_DRV
|
||||
{"glk", glk_init,},
|
||||
{"glc", glk_init,},
|
||||
#endif
|
||||
#ifdef SED1520_DRV
|
||||
{"sed1520", sed1520_init,},
|
||||
@@ -195,9 +208,12 @@ lcd_physical_driver drivers[] = {
|
||||
#endif
|
||||
#ifdef SVGALIB_DRV
|
||||
{"svgalib", svgalib_drv_init,},
|
||||
{"vga", svgalib_drv_init,},
|
||||
{"svga", svgalib_drv_init,},
|
||||
#endif
|
||||
#ifdef T6963_DRV
|
||||
{"t6963", t6963_init,},
|
||||
{"Toshiba", t6963_init,},
|
||||
#endif
|
||||
|
||||
{NULL, NULL,},
|
||||
@@ -254,6 +270,7 @@ lcd_drv_init (struct lcd_logical_driver *driver, char *args)
|
||||
driver->cellhgt = LCD_STD_CELL_HEIGHT;
|
||||
|
||||
driver->framebuf = NULL;
|
||||
driver->nextkey = NULL;
|
||||
|
||||
driver->daemonize = 1;
|
||||
|
||||
@@ -359,7 +376,7 @@ lcd_find_init (char *driver) {
|
||||
return NULL;
|
||||
|
||||
for (i = 0; drivers[i].name; i++) {
|
||||
if (strcmp(driver, drivers[i].name) == 0) {
|
||||
if (strcasecmp(driver, drivers[i].name) == 0) {
|
||||
return (*drivers[i].init);
|
||||
}
|
||||
}
|
||||
@@ -377,19 +394,20 @@ lcd_allocate_driver () {
|
||||
// allocated buffer, which is what everything currently uses for
|
||||
// output in the main server code.
|
||||
|
||||
#define FirstTime (lcd.framebuf == NULL)
|
||||
#define FirstTime (lcd_ptr->framebuf == NULL)
|
||||
|
||||
if (FirstTime) {
|
||||
lcd_root = &lcd;
|
||||
return &lcd;
|
||||
if ((driver = malloc(sizeof(lcd_logical_driver))) == NULL) {
|
||||
syslog(LOG_ERR, "error allocating driver space!");
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
if ((driver = malloc(sizeof(lcd_logical_driver))) == NULL) {
|
||||
syslog(LOG_ERR, "error allocating driver space!");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
||||
if (lcd_root == NULL)
|
||||
lcd_root = driver;
|
||||
|
||||
if (lcd_ptr == NULL)
|
||||
lcd_ptr = driver;
|
||||
|
||||
return driver;
|
||||
}
|
||||
|
||||
// This initializes the specified driver and sends parameters to
|
||||
@@ -404,9 +422,9 @@ lcd_add_driver (char *driver, char *args)
|
||||
int i;
|
||||
char buf[64];
|
||||
int (*init_driver) ();
|
||||
lcd_logical_driver *ptr;
|
||||
|
||||
lcd_logical_driver *add;
|
||||
lcd_logical_driver *ptr = NULL;
|
||||
lcd_logical_driver *add = NULL;
|
||||
|
||||
if (!driver)
|
||||
return -1;
|
||||
@@ -447,6 +465,7 @@ lcd_add_driver (char *driver, char *args)
|
||||
// Patch the getkey with the getkey loop...
|
||||
main_getkey = add->getkey;
|
||||
add->getkey = lcd_drv_getkey_loop;
|
||||
add->nextkey = NULL;
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@ typedef struct lcd_physical_driver {
|
||||
int (*init) (struct lcd_logical_driver * driver, char *device);
|
||||
} lcd_physical_driver;
|
||||
|
||||
extern lcd_logical_driver lcd;
|
||||
//extern lcd_logical_driver lcd;
|
||||
extern lcd_logical_driver *lcd_ptr;
|
||||
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -102,7 +102,7 @@ handle_input ()
|
||||
widget *w;
|
||||
client *c;
|
||||
|
||||
if ((key = lcd.getkey ()) == 0)
|
||||
if ((key = lcd_ptr->getkey ()) == 0)
|
||||
return 0;
|
||||
|
||||
//debug ("handle_input(%c)\n", (char) key);
|
||||
|
||||
+12
-12
@@ -306,14 +306,14 @@ main (int argc, char **argv)
|
||||
// make this fact dependent on the output driver's
|
||||
// sayso - if the output driver desires, do NOT daemonize...
|
||||
if (daemon_mode == 1)
|
||||
daemon_mode = lcd.daemonize;
|
||||
daemon_mode = lcd_ptr->daemonize;
|
||||
} else {
|
||||
if (i == 0) {
|
||||
snprintf(buf, sizeof(buf), "error loading output driver %s...\n", optarg);
|
||||
snprintf(buf, sizeof(buf), "error loading output driver %s...\n", driverlist[i]);
|
||||
fprintf(stderr, buf);
|
||||
exit(1);
|
||||
} else {
|
||||
snprintf(buf, sizeof(buf), "error loading input driver %s... continuing\n", optarg);
|
||||
snprintf(buf, sizeof(buf), "error loading input driver %s... continuing\n", driverlist[i]);
|
||||
fprintf(stderr, buf);
|
||||
}
|
||||
}
|
||||
@@ -449,11 +449,11 @@ main (int argc, char **argv)
|
||||
sscanf (argv[i], "%ix%i", &wid, &hgt);
|
||||
if (wid > 80 || wid < 16 || hgt > 25 || hgt < 2) {
|
||||
fprintf (stderr, "LCDd: Invalid lcd size \"%s\". Using 20x4.\n", argv[i]);
|
||||
lcd.wid = 20;
|
||||
lcd.hgt = 4;
|
||||
lcd_ptr->wid = 20;
|
||||
lcd_ptr->hgt = 4;
|
||||
} else {
|
||||
lcd.wid = wid;
|
||||
lcd.hgt = hgt;
|
||||
lcd_ptr->wid = wid;
|
||||
lcd_ptr->hgt = hgt;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -552,10 +552,10 @@ main (int argc, char **argv)
|
||||
// Main loop...
|
||||
|
||||
syslog(LOG_NOTICE, "using %dx%d LCD with cells %dx%d",
|
||||
lcd.wid, lcd.hgt, lcd.cellwid, lcd.cellhgt);
|
||||
lcd_ptr->wid, lcd_ptr->hgt, lcd_ptr->cellwid, lcd_ptr->cellhgt);
|
||||
if (debug_level > 2)
|
||||
syslog(LOG_DEBUG, "framebuffer at %0X",
|
||||
lcd.framebuf);
|
||||
lcd_ptr->framebuf);
|
||||
|
||||
while (1) {
|
||||
sock_poll_clients (); // poll clients for input
|
||||
@@ -623,7 +623,7 @@ exit_program (int val)
|
||||
|
||||
syslog(LOG_NOTICE, buf); // send message to syslog
|
||||
|
||||
if (lcd.framebuf != NULL) {
|
||||
if (lcd_ptr->framebuf != NULL) {
|
||||
goodbye_screen (); // display goodbye screen on LCD display
|
||||
lcd_shutdown (); // release driver memory and file descriptors
|
||||
|
||||
@@ -640,8 +640,8 @@ void
|
||||
HelpScreen ()
|
||||
{
|
||||
// This cleans up any messes on the display output if needed...
|
||||
if (lcd.framebuf != NULL)
|
||||
lcd.close();
|
||||
if (lcd_ptr->framebuf != NULL)
|
||||
lcd_ptr->close();
|
||||
|
||||
printf ("\nLCDproc server daemon, %s\n", version);
|
||||
printf ("Copyright (c) 1999 Scott Scriven, William Ferrell, and misc contributors\n");
|
||||
|
||||
+37
-37
@@ -45,10 +45,10 @@ draw_heartbeat ()
|
||||
if (heartbeat) {
|
||||
// Set this to pulsate like a real heart beat...
|
||||
// (binary is fun... :)
|
||||
lcd.icon (!((timer + 4) & 5), 0);
|
||||
lcd.chr (lcd.wid, 1, 0);
|
||||
lcd_ptr->icon (!((timer + 4) & 5), 0);
|
||||
lcd_ptr->chr (lcd_ptr->wid, 1, 0);
|
||||
}
|
||||
lcd.flush ();
|
||||
lcd_ptr->flush ();
|
||||
|
||||
timer++;
|
||||
timer &= 0x0f;
|
||||
@@ -97,7 +97,7 @@ do_menu (Menu menu)
|
||||
// FIXME: This should use a better keypress interface, which
|
||||
// FIXME: handles things according to keybindings...
|
||||
|
||||
for (key = lcd.getkey (); key == 0; key = lcd.getkey ()) {
|
||||
for (key = lcd_ptr->getkey (); key == 0; key = lcd_ptr->getkey ()) {
|
||||
// sleep for 1/8th second...
|
||||
framedelay ();
|
||||
// do the heartbeat...
|
||||
@@ -186,12 +186,12 @@ draw_menu (Menu menu, menu_info * info)
|
||||
int (*readfunc) (int);
|
||||
|
||||
// these should maybe be removed:
|
||||
int wid = lcd.wid, hgt = lcd.hgt;
|
||||
int wid = lcd_ptr->wid, hgt = lcd_ptr->hgt;
|
||||
|
||||
if (!menu)
|
||||
return MENU_ERROR;
|
||||
|
||||
lcd.clear ();
|
||||
lcd_ptr->clear ();
|
||||
|
||||
// Scroll down until the selected item is centered, if possible...
|
||||
top = info->selected - (hgt / 2);
|
||||
@@ -207,35 +207,35 @@ draw_menu (Menu menu, menu_info * info)
|
||||
// Draw all visible items...
|
||||
for (i = top; i < bottom; i++, y++) {
|
||||
if (i == info->selected)
|
||||
lcd.chr (2, y, '>');
|
||||
lcd_ptr->chr (2, y, '>');
|
||||
|
||||
switch (menu[i].type) {
|
||||
case TYPE_TITL:
|
||||
lcd.chr (1, y, PAD);
|
||||
lcd.chr (2, y, PAD);
|
||||
lcd.string (4, y, menu[i].text);
|
||||
lcd_ptr->chr (1, y, PAD);
|
||||
lcd_ptr->chr (2, y, PAD);
|
||||
lcd_ptr->string (4, y, menu[i].text);
|
||||
for (x = strlen (menu[i].text) + 5; x <= wid; x++)
|
||||
lcd.chr (x, y, PAD);
|
||||
lcd_ptr->chr (x, y, PAD);
|
||||
break;
|
||||
case TYPE_MENU:
|
||||
lcd.string (3, y, menu[i].text);
|
||||
lcd.chr (wid, y, '>');
|
||||
lcd_ptr->string (3, y, menu[i].text);
|
||||
lcd_ptr->chr (wid, y, '>');
|
||||
break;
|
||||
case TYPE_FUNC:
|
||||
lcd.string (3, y, menu[i].text);
|
||||
lcd_ptr->string (3, y, menu[i].text);
|
||||
break;
|
||||
case TYPE_CHEK:
|
||||
if (menu[i].data) {
|
||||
readfunc = menu[i].data;
|
||||
if (readfunc (MENU_READ))
|
||||
lcd.chr (wid, y, 'Y');
|
||||
lcd_ptr->chr (wid, y, 'Y');
|
||||
else
|
||||
lcd.chr (wid, y, 'N');
|
||||
lcd_ptr->chr (wid, y, 'N');
|
||||
}
|
||||
lcd.string (3, y, menu[i].text);
|
||||
lcd_ptr->string (3, y, menu[i].text);
|
||||
break;
|
||||
case TYPE_SLID:
|
||||
lcd.string (3, y, menu[i].text);
|
||||
lcd_ptr->string (3, y, menu[i].text);
|
||||
break;
|
||||
case TYPE_MOVE:
|
||||
break;
|
||||
@@ -245,12 +245,12 @@ draw_menu (Menu menu, menu_info * info)
|
||||
}
|
||||
|
||||
if (top != 0)
|
||||
lcd.chr (1, 1, '^');
|
||||
lcd_ptr->chr (1, 1, '^');
|
||||
if (bottom < info->length)
|
||||
lcd.chr (1, hgt, 'v');
|
||||
lcd_ptr->chr (1, hgt, 'v');
|
||||
|
||||
draw_heartbeat ();
|
||||
//lcd.flush();
|
||||
//lcd_ptr->flush();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -288,34 +288,34 @@ slid_func (menu_item * item)
|
||||
|
||||
readfunc = item->data;
|
||||
|
||||
lcd.init_hbar ();
|
||||
lcd_ptr->init_hbar ();
|
||||
|
||||
while (key != 'A' && key != 'D') {
|
||||
// Draw the title...
|
||||
lcd.clear ();
|
||||
lcd.chr (1, y, PAD);
|
||||
lcd.chr (2, y, PAD);
|
||||
lcd.string (4, y, item->text);
|
||||
for (x = strlen (item->text) + 5; x <= lcd.wid; x++)
|
||||
lcd.chr (x, y, PAD);
|
||||
lcd_ptr->clear ();
|
||||
lcd_ptr->chr (1, y, PAD);
|
||||
lcd_ptr->chr (2, y, PAD);
|
||||
lcd_ptr->string (4, y, item->text);
|
||||
for (x = strlen (item->text) + 5; x <= lcd_ptr->wid; x++)
|
||||
lcd_ptr->chr (x, y, PAD);
|
||||
|
||||
// Draw the slider now...
|
||||
value = readfunc (MENU_READ);
|
||||
if (value < 0 || value >= MENU_CLOSE)
|
||||
return value;
|
||||
snprintf (str, sizeof(str), "%i", value);
|
||||
if (lcd.hgt >= 4) {
|
||||
lcd.string (8, 4, str);
|
||||
value = (lcd.wid * lcd.cellwid * value / 256);
|
||||
lcd.hbar (1, 3, value);
|
||||
if (lcd_ptr->hgt >= 4) {
|
||||
lcd_ptr->string (8, 4, str);
|
||||
value = (lcd_ptr->wid * lcd_ptr->cellwid * value / 256);
|
||||
lcd_ptr->hbar (1, 3, value);
|
||||
} else {
|
||||
lcd.string (17, 2, str);
|
||||
value = ((lcd.wid - 4) * lcd.cellwid * value / 256);
|
||||
lcd.hbar (1, 2, value);
|
||||
lcd_ptr->string (17, 2, str);
|
||||
value = ((lcd_ptr->wid - 4) * lcd_ptr->cellwid * value / 256);
|
||||
lcd_ptr->hbar (1, 2, value);
|
||||
}
|
||||
//lcd.flush();
|
||||
//lcd_ptr->flush();
|
||||
|
||||
for (key = lcd.getkey (); key == 0; key = lcd.getkey ()) {
|
||||
for (key = lcd_ptr->getkey (); key == 0; key = lcd_ptr->getkey ()) {
|
||||
// do the heartbeat...
|
||||
draw_heartbeat ();
|
||||
// sleep for 1/8th second...
|
||||
|
||||
+7
-7
@@ -246,7 +246,7 @@ Backlight_func (int input)
|
||||
else backlight = BACKLIGHT_OPEN;
|
||||
}
|
||||
*/
|
||||
lcd.backlight (backlight_state & BACKLIGHT_ON);
|
||||
lcd_ptr->backlight (backlight_state & BACKLIGHT_ON);
|
||||
|
||||
return (status | MENU_OK);
|
||||
}
|
||||
@@ -271,7 +271,7 @@ Contrast_func (int input)
|
||||
{
|
||||
int status;
|
||||
|
||||
status = lcd.contrast (-1);
|
||||
status = lcd_ptr->contrast (-1);
|
||||
|
||||
if (input == MENU_READ)
|
||||
return status;
|
||||
@@ -284,7 +284,7 @@ Contrast_func (int input)
|
||||
status = 0;
|
||||
if (status > 255)
|
||||
status = 255;
|
||||
lcd.contrast (status);
|
||||
lcd_ptr->contrast (status);
|
||||
|
||||
return (status | MENU_OK);
|
||||
}
|
||||
@@ -314,7 +314,7 @@ Backlight_Brightness_func (int input)
|
||||
status = 0;
|
||||
if (status > 255)
|
||||
status = 255;
|
||||
lcd.backlight (status);
|
||||
lcd_ptr->backlight (status);
|
||||
|
||||
backlight_brightness = status;
|
||||
|
||||
@@ -337,7 +337,7 @@ Backlight_Off_Brightness_func (int input)
|
||||
status = 0;
|
||||
if (status > 255)
|
||||
status = 255;
|
||||
lcd.backlight (status);
|
||||
lcd_ptr->backlight (status);
|
||||
|
||||
backlight_off_brightness = status;
|
||||
|
||||
@@ -349,7 +349,7 @@ Backlight_Off_func ()
|
||||
{
|
||||
backlight_state = BACKLIGHT_OFF;
|
||||
backlight = BACKLIGHT_OFF;
|
||||
lcd.backlight (backlight_off_brightness);
|
||||
lcd_ptr->backlight (backlight_off_brightness);
|
||||
return MENU_OK;
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ Backlight_On_func ()
|
||||
{
|
||||
backlight_state = BACKLIGHT_ON;
|
||||
backlight = BACKLIGHT_ON;
|
||||
lcd.backlight (backlight_brightness * (backlight_state & BACKLIGHT_ON));
|
||||
lcd_ptr->backlight (backlight_brightness * (backlight_state & BACKLIGHT_ON));
|
||||
return MENU_OK;
|
||||
}
|
||||
|
||||
|
||||
+36
-36
@@ -64,54 +64,54 @@ draw_screen (screen * s, int timer)
|
||||
old_s = s;
|
||||
|
||||
// Clear the LCD screen...
|
||||
lcd.clear ();
|
||||
lcd_ptr->clear ();
|
||||
|
||||
// lcd.backlight --
|
||||
// lcd_ptr->backlight --
|
||||
//
|
||||
// This should be in a separate function altogether.
|
||||
// Perhaps several: lcd.backlight_off, lcd.backlight_on,
|
||||
// lcd.backlight_brightness, lcd.backlight_flash ...
|
||||
// Perhaps several: lcd_ptr->backlight_off, lcd_ptr->backlight_on,
|
||||
// lcd_ptr->backlight_brightness, lcd_ptr->backlight_flash ...
|
||||
//
|
||||
// Set up backlight to the correct state...
|
||||
// NOTE: dirty stripping of other options...
|
||||
switch (backlight_state & 1) {
|
||||
// Backlight off (easy)
|
||||
case BACKLIGHT_OFF:
|
||||
lcd.backlight (BACKLIGHT_OFF);
|
||||
lcd_ptr->backlight (BACKLIGHT_OFF);
|
||||
break;
|
||||
// Backlight on (easy)
|
||||
case BACKLIGHT_ON:
|
||||
lcd.backlight (BACKLIGHT_ON);
|
||||
lcd_ptr->backlight (BACKLIGHT_ON);
|
||||
break;
|
||||
default:
|
||||
// Backlight flash: check timer and flip backlight as appropriate
|
||||
if (backlight_state & BACKLIGHT_FLASH) {
|
||||
tmp = (!((timer & 7) == 7));
|
||||
if (backlight_state & 1)
|
||||
lcd.backlight (tmp ? backlight_brightness : backlight_off_brightness);
|
||||
//lcd.backlight(backlight_brightness * (!((timer&7) == 7)));
|
||||
lcd_ptr->backlight (tmp ? backlight_brightness : backlight_off_brightness);
|
||||
//lcd_ptr->backlight(backlight_brightness * (!((timer&7) == 7)));
|
||||
else
|
||||
lcd.backlight (!tmp ? backlight_brightness : backlight_off_brightness);
|
||||
//lcd.backlight(backlight_brightness * ((timer&7) == 7));
|
||||
lcd_ptr->backlight (!tmp ? backlight_brightness : backlight_off_brightness);
|
||||
//lcd_ptr->backlight(backlight_brightness * ((timer&7) == 7));
|
||||
|
||||
// Backlight blink: check timer and flip backlight as appropriate
|
||||
} else if (backlight_state & BACKLIGHT_BLINK) {
|
||||
tmp = (!((timer & 14) == 14));
|
||||
if (backlight_state & 1)
|
||||
lcd.backlight (tmp ? backlight_brightness : backlight_off_brightness);
|
||||
//lcd.backlight(backlight_brightness * (!((timer&14) == 14)));
|
||||
lcd_ptr->backlight (tmp ? backlight_brightness : backlight_off_brightness);
|
||||
//lcd_ptr->backlight(backlight_brightness * (!((timer&14) == 14)));
|
||||
else
|
||||
lcd.backlight (!tmp ? backlight_brightness : backlight_off_brightness);
|
||||
//lcd.backlight(backlight_brightness * ((timer&14) == 14));
|
||||
lcd_ptr->backlight (!tmp ? backlight_brightness : backlight_off_brightness);
|
||||
//lcd_ptr->backlight(backlight_brightness * ((timer&14) == 14));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Output ports from LCD - outputs depend on the current screen
|
||||
lcd.output (output_state);
|
||||
lcd_ptr->output (output_state);
|
||||
|
||||
// Draw a frame...
|
||||
draw_frame (s->widgets, 'v', 0, 0, lcd.wid, lcd.hgt, s->wid, s->hgt, (((s->duration / s->hgt) < 1) ? 1 : (s->duration / s->hgt)), timer);
|
||||
draw_frame (s->widgets, 'v', 0, 0, lcd_ptr->wid, lcd_ptr->hgt, s->wid, s->hgt, (((s->duration / s->hgt) < 1) ? 1 : (s->duration / s->hgt)), timer);
|
||||
|
||||
//debug("draw_screen done\n");
|
||||
|
||||
@@ -119,20 +119,20 @@ draw_screen (screen * s, int timer)
|
||||
if ((s->heartbeat == HEART_ON) || heartbeat == HEART_ON) {
|
||||
// Set this to pulsate like a real heart beat...
|
||||
// (binary is fun... :)
|
||||
// lcd.heartbeat ();
|
||||
lcd.icon (!((timer + 4) & 5), 0);
|
||||
lcd.chr (lcd.wid, 1, 0);
|
||||
// lcd_ptr->heartbeat ();
|
||||
lcd_ptr->icon (!((timer + 4) & 5), 0);
|
||||
lcd_ptr->chr (lcd_ptr->wid, 1, 0);
|
||||
}
|
||||
// else
|
||||
// This seems unnecessary... heartbeat is nicer...
|
||||
// if ((s->heartbeat == HEART_OPEN) && heartbeat != HEART_OFF) {
|
||||
// char *phases = "-\\|/";
|
||||
// lcd.chr (lcd.wid, 1, phases[timer & 3]);
|
||||
// lcd_ptr->chr (lcd_ptr->wid, 1, phases[timer & 3]);
|
||||
// }
|
||||
}
|
||||
|
||||
// flush display out, frame and all...
|
||||
lcd.flush ();
|
||||
lcd_ptr->flush ();
|
||||
|
||||
//debug("draw_screen: %8x, %i\n", s, timer);
|
||||
|
||||
@@ -230,22 +230,22 @@ draw_frame (LL * list,
|
||||
if (w->x > wid) w->x=wid;
|
||||
strncpy (str, w->text, wid - w->x + 1);
|
||||
str[wid - w->x + 1] = 0;
|
||||
lcd.string (w->x + left, w->y + top - fy, str);
|
||||
lcd_ptr->string (w->x + left, w->y + top - fy, str);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WID_HBAR:
|
||||
if (reset) {
|
||||
lcd.init_hbar ();
|
||||
lcd_ptr->init_hbar ();
|
||||
reset = 0;
|
||||
}
|
||||
if ((w->x > 0) && (w->y > 0)) {
|
||||
if ((w->y <= hgt + fy) && (w->y > fy)) {
|
||||
if (w->length > 0) {
|
||||
if ((w->length / lcd.cellwid) < wid - w->x + 1)
|
||||
lcd.hbar (w->x + left, w->y + top - fy, w->length);
|
||||
if ((w->length / lcd_ptr->cellwid) < wid - w->x + 1)
|
||||
lcd_ptr->hbar (w->x + left, w->y + top - fy, w->length);
|
||||
else
|
||||
lcd.hbar (w->x + left, w->y + top - fy, wid * lcd.cellwid);
|
||||
lcd_ptr->hbar (w->x + left, w->y + top - fy, wid * lcd_ptr->cellwid);
|
||||
} else if (w->length < 0) {
|
||||
// TODO: Rearrange stuff to get left-extending
|
||||
// hbars to draw correctly...
|
||||
@@ -257,12 +257,12 @@ draw_frame (LL * list,
|
||||
break;
|
||||
case WID_VBAR: // FIXME: Vbars don't work in frames!
|
||||
if (reset) {
|
||||
lcd.init_vbar ();
|
||||
lcd_ptr->init_vbar ();
|
||||
reset = 0;
|
||||
}
|
||||
if ((w->x > 0) && (w->y > 0)) {
|
||||
if (w->length > 0) {
|
||||
lcd.vbar (w->x, w->length);
|
||||
lcd_ptr->vbar (w->x, w->length);
|
||||
} else if (w->length < 0) {
|
||||
// TODO: Rearrange stuff to get down-extending
|
||||
// vbars to draw correctly...
|
||||
@@ -315,7 +315,7 @@ draw_frame (LL * list,
|
||||
}
|
||||
str[wid] = 0;
|
||||
|
||||
lcd.string (1 + left, 1 + top, str);
|
||||
lcd_ptr->string (1 + left, 1 + top, str);
|
||||
break;
|
||||
case WID_SCROLLER: // FIXME: doesn't work in frames...
|
||||
{
|
||||
@@ -334,7 +334,7 @@ draw_frame (LL * list,
|
||||
length = strlen (w->text) + 1;
|
||||
if (length <= screen_width) {
|
||||
/* it fits within the box, just render it */
|
||||
lcd.string (w->left, w->top, w->text);
|
||||
lcd_ptr->string (w->left, w->top, w->text);
|
||||
} else {
|
||||
int effLength = length - screen_width;
|
||||
int necessaryTimeUnits = 0;
|
||||
@@ -377,7 +377,7 @@ draw_frame (LL * list,
|
||||
} else {
|
||||
str[0] = '\0';
|
||||
}
|
||||
lcd.string (w->left, w->top, str);
|
||||
lcd_ptr->string (w->left, w->top, str);
|
||||
}
|
||||
break;
|
||||
// FIXME: Vert scrollers don't always seem to scroll
|
||||
@@ -389,7 +389,7 @@ draw_frame (LL * list,
|
||||
length = strlen (w->text);
|
||||
if (length <= screen_width) {
|
||||
/* no scrolling required... */
|
||||
lcd.string (w->left, w->top, w->text);
|
||||
lcd_ptr->string (w->left, w->top, w->text);
|
||||
} else {
|
||||
int lines_required = (length / screen_width)
|
||||
+ (length % screen_width ? 1 : 0);
|
||||
@@ -399,7 +399,7 @@ draw_frame (LL * list,
|
||||
for (i = 0; i < lines_required; i++) {
|
||||
strncpy (str, &((w->text)[i * screen_width]), screen_width);
|
||||
str[screen_width] = '\0';
|
||||
lcd.string (w->left, w->top + i, str);
|
||||
lcd_ptr->string (w->left, w->top + i, str);
|
||||
}
|
||||
} else {
|
||||
int necessaryTimeUnits = 0;
|
||||
@@ -439,7 +439,7 @@ draw_frame (LL * list,
|
||||
str[screen_width] = '\0';
|
||||
//printf("rendering: '%s' of %s\n",
|
||||
//str,w->text);
|
||||
lcd.string (w->left, w->top + (i - begin), str);
|
||||
lcd_ptr->string (w->left, w->top + (i - begin), str);
|
||||
}
|
||||
if (timer > necessaryTimeUnits) {
|
||||
if (screenlist_action == RENDER_HOLD)
|
||||
@@ -475,10 +475,10 @@ draw_frame (LL * list,
|
||||
// NOTE: y=10 means COLON (:)
|
||||
if ((w->x > 0) && (w->y >= 0) && (w->y <= 10)) {
|
||||
if (reset) {
|
||||
lcd.init_num ();
|
||||
lcd_ptr->init_num ();
|
||||
reset = 0;
|
||||
}
|
||||
lcd.num (w->x + left, w->y);
|
||||
lcd_ptr->num (w->x + left, w->y);
|
||||
}
|
||||
break;
|
||||
case WID_NONE:
|
||||
|
||||
+2
-2
@@ -32,8 +32,8 @@ screen_create ()
|
||||
s->priority = DEFAULT_SCREEN_PRIORITY;
|
||||
s->duration = default_duration;
|
||||
s->heartbeat = DEFAULT_HEARTBEAT;
|
||||
s->wid = lcd.wid;
|
||||
s->hgt = lcd.hgt;
|
||||
s->wid = lcd_ptr->wid;
|
||||
s->hgt = lcd_ptr->hgt;
|
||||
s->keys = NULL;
|
||||
s->parent = NULL;
|
||||
s->widgets = NULL;
|
||||
|
||||
+22
-22
@@ -137,11 +137,11 @@ update_server_screen (int timer)
|
||||
|
||||
// Format strings for the appropriate size display...
|
||||
//
|
||||
if (lcd.hgt >= 3) {
|
||||
if (lcd_ptr->hgt >= 3) {
|
||||
snprintf (one, sizeof(one), "Clients: %i", num_clients);
|
||||
snprintf (two, sizeof(two), "Screens: %i", num_screens);
|
||||
} else {
|
||||
if (lcd.wid >= 20)
|
||||
if (lcd_ptr->wid >= 20)
|
||||
snprintf (one, sizeof(one), "%i Client%s, %i Screen%s", num_clients,
|
||||
(num_clients == 1) ? "" : "s", num_screens,
|
||||
(num_screens == 1) ? "" : "s");
|
||||
@@ -158,9 +158,9 @@ int
|
||||
no_screen_screen (int timer)
|
||||
{
|
||||
|
||||
lcd.clear ();
|
||||
lcd.string (1, 1, "Error: No screen!");
|
||||
lcd.flush ();
|
||||
lcd_ptr->clear ();
|
||||
lcd_ptr->string (1, 1, "Error: No screen!");
|
||||
lcd_ptr->flush ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -184,31 +184,31 @@ goodbye_screen ()
|
||||
char *l16 = " LCDproc! ";
|
||||
#endif
|
||||
|
||||
lcd.clear ();
|
||||
lcd_ptr->clear ();
|
||||
|
||||
if (lcd.hgt >= 4) {
|
||||
if (lcd.wid >= 20) {
|
||||
lcd.string (1, 1, b20);
|
||||
lcd.string (1, 2, t20);
|
||||
lcd.string (1, 3, l20);
|
||||
lcd.string (1, 4, b20);
|
||||
if (lcd_ptr->hgt >= 4) {
|
||||
if (lcd_ptr->wid >= 20) {
|
||||
lcd_ptr->string (1, 1, b20);
|
||||
lcd_ptr->string (1, 2, t20);
|
||||
lcd_ptr->string (1, 3, l20);
|
||||
lcd_ptr->string (1, 4, b20);
|
||||
} else {
|
||||
lcd.string (1, 1, b16);
|
||||
lcd.string (1, 2, t16);
|
||||
lcd.string (1, 3, l16);
|
||||
lcd.string (1, 4, b16);
|
||||
lcd_ptr->string (1, 1, b16);
|
||||
lcd_ptr->string (1, 2, t16);
|
||||
lcd_ptr->string (1, 3, l16);
|
||||
lcd_ptr->string (1, 4, b16);
|
||||
}
|
||||
} else {
|
||||
if (lcd.wid >= 20) {
|
||||
lcd.string (1, 1, t20);
|
||||
lcd.string (1, 2, l20);
|
||||
if (lcd_ptr->wid >= 20) {
|
||||
lcd_ptr->string (1, 1, t20);
|
||||
lcd_ptr->string (1, 2, l20);
|
||||
} else {
|
||||
lcd.string (1, 1, t16);
|
||||
lcd.string (1, 2, l16);
|
||||
lcd_ptr->string (1, 1, t16);
|
||||
lcd_ptr->string (1, 2, l16);
|
||||
}
|
||||
}
|
||||
|
||||
lcd.flush ();
|
||||
lcd_ptr->flush ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user