Import Upstream version 1.9.0-wip.20070910
This commit is contained in:
1 parent
a60b7c6315
commit
9404a6167d
46 files changed
+321
-44839
No files matched your search
+16
-13
@@ -17,7 +17,7 @@
|
||||
|
||||
(c) 2006 Mike Lampard, Philip Lawatsch, and others
|
||||
|
||||
$Revision: 197 $ - $Date: 2006-12-11 12:26:17 +1030 (Mon, 11 Dec 2006) $ $Author: aneurysm9 $
|
||||
$Revision: 290 $ - $Date: 2007-09-08 08:50:33 +0200 (Sat, 08 Sep 2007) $ $Author: mlampard $
|
||||
|
||||
simple Clock plugin, replace the various functions with your own, and change the g15plugin_info struct below to suit,
|
||||
edit Makefile.am and compile. Add salt and pepper to taste. For a more advanced plugin that creates it's own lcd screens on-the-fly,
|
||||
@@ -248,10 +248,10 @@ static int draw_analog(g15canvas *c)
|
||||
strftime(time,sizeof(time),"%r",t);
|
||||
|
||||
if(showdate) {
|
||||
g15r_renderString(c, (unsigned char*)time, 0, G15_TEXT_LARGE, 60, 5);
|
||||
g15r_renderString(c, (unsigned char*)time, 0, G15_TEXT_LARGE, 60, 4);
|
||||
g15r_renderString(c, (unsigned char*)day, 1, G15_TEXT_LARGE, 60, 5);
|
||||
g15r_renderString(c, (unsigned char*)date, 2, G15_TEXT_LARGE, 60, 5);
|
||||
g15r_renderString(c, (unsigned char*)year, 3, G15_TEXT_LARGE, 60, 5);
|
||||
g15r_renderString(c, (unsigned char*)date, 2, G15_TEXT_LARGE, 60, 6);
|
||||
g15r_renderString(c, (unsigned char*)year, 3, G15_TEXT_LARGE, 60, 7);
|
||||
} else
|
||||
g15r_renderString(c, (unsigned char*)time, 0, G15_TEXT_LARGE, 60, 18);
|
||||
|
||||
@@ -259,18 +259,20 @@ static int draw_analog(g15canvas *c)
|
||||
}
|
||||
|
||||
|
||||
static int *lcdclock(lcd_t *lcd)
|
||||
static int lcdclock(lcd_t *lcd)
|
||||
{
|
||||
int ret = 0;
|
||||
g15canvas *canvas = (g15canvas *) malloc (sizeof (g15canvas));
|
||||
|
||||
if (canvas != NULL)
|
||||
{
|
||||
memset(canvas->buffer, 0, G15_BUFFER_LEN);
|
||||
if (canvas == NULL) {
|
||||
g15daemon_log(LOG_ERR, "Unable to allocate canvas");
|
||||
return G15_PLUGIN_QUIT;
|
||||
}
|
||||
|
||||
memset(canvas->buffer, 0, G15_BUFFER_LEN);
|
||||
canvas->mode_cache = 0;
|
||||
canvas->mode_reverse = 0;
|
||||
canvas->mode_xor = 0;
|
||||
}
|
||||
|
||||
memset(lcd->buf,0,G15_BUFFER_LEN);
|
||||
|
||||
@@ -317,12 +319,13 @@ static int myeventhandler(plugin_event_t *myevent) {
|
||||
}
|
||||
|
||||
/* completely uncessary function called when plugin is exiting */
|
||||
static void *callmewhenimdone(lcd_t *lcd){
|
||||
return NULL;
|
||||
static void callmewhenimdone(lcd_t *lcd){
|
||||
if(static_canvas != NULL) free(static_canvas);
|
||||
return;
|
||||
}
|
||||
|
||||
/* completely unnecessary initialisation function which could just as easily have been set to NULL in the g15plugin_info struct */
|
||||
static void *myinithandler(lcd_t *lcd){
|
||||
static int myinithandler(lcd_t *lcd){
|
||||
config_section_t *clockcfg = g15daemon_cfg_load_section(lcd->masterlist,"Clock");
|
||||
mode=g15daemon_cfg_read_bool(clockcfg, "24hrFormat",1);
|
||||
showdate=g15daemon_cfg_read_bool(clockcfg, "ShowDate",0);
|
||||
@@ -338,7 +341,7 @@ static void *myinithandler(lcd_t *lcd){
|
||||
draw_static_canvas();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return static_canvas == NULL ? G15_PLUGIN_QUIT : G15_PLUGIN_OK;
|
||||
}
|
||||
|
||||
/* if no exitfunc or eventhandler, member should be NULL */
|
||||
|
||||
Reference in new issue
Block a user