2005-10-07 22:22:07 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005 Kevin Ferrare
|
|
|
|
*
|
|
|
|
* Mystify demo plugin
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* 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 the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2005-10-07 22:22:07 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include "plugin.h"
|
2010-08-24 14:30:46 +00:00
|
|
|
#include "lib/pluginlib_exit.h"
|
2005-10-07 22:22:07 +00:00
|
|
|
|
2008-11-20 11:27:31 +00:00
|
|
|
#include "lib/pluginlib_actions.h"
|
|
|
|
#include "lib/helper.h"
|
2010-08-24 14:30:46 +00:00
|
|
|
|
2006-01-15 18:20:18 +00:00
|
|
|
|
2005-10-07 22:22:07 +00:00
|
|
|
#define DEFAULT_WAIT_TIME 3
|
|
|
|
#define DEFAULT_NB_POLYGONS 7
|
|
|
|
#define NB_POINTS 4
|
|
|
|
#define MAX_STEP_RANGE 7
|
|
|
|
#define MIN_STEP_RANGE 3
|
|
|
|
#define MAX_POLYGONS 40
|
|
|
|
#define MIN_POLYGONS 1
|
|
|
|
|
2007-07-18 11:18:52 +00:00
|
|
|
/* Key assignement */
|
2010-05-20 17:41:28 +00:00
|
|
|
#define DEMYSTIFY_QUIT PLA_CANCEL
|
|
|
|
|
|
|
|
#ifdef HAVE_SCROLLWHEEL
|
|
|
|
|
|
|
|
#define DEMYSTIFY_INCREASE_SPEED PLA_SCROLL_FWD
|
|
|
|
#define DEMYSTIFY_DECREASE_SPEED PLA_SCROLL_BACK
|
|
|
|
#define DEMYSTIFY_INCREASE_SPEED_REPEAT PLA_SCROLL_FWD_REPEAT
|
|
|
|
#define DEMYSTIFY_DECREASE_SPEED_REPEAT PLA_SCROLL_BACK_REPEAT
|
|
|
|
#else
|
|
|
|
#define DEMYSTIFY_INCREASE_SPEED PLA_RIGHT
|
|
|
|
#define DEMYSTIFY_DECREASE_SPEED PLA_LEFT
|
|
|
|
#define DEMYSTIFY_INCREASE_SPEED_REPEAT PLA_RIGHT_REPEAT
|
|
|
|
#define DEMYSTIFY_DECREASE_SPEED_REPEAT PLA_LEFT_REPEAT
|
|
|
|
#endif
|
2007-07-18 11:18:52 +00:00
|
|
|
|
2010-05-20 17:41:28 +00:00
|
|
|
#define DEMYSTIFY_ADD_POLYGON PLA_UP
|
|
|
|
#define DEMYSTIFY_REMOVE_POLYGON PLA_DOWN
|
|
|
|
#define DEMYSTIFY_ADD_POLYGON_REPEAT PLA_UP_REPEAT
|
|
|
|
#define DEMYSTIFY_REMOVE_POLYGON_REPEAT PLA_DOWN_REPEAT
|
2007-07-18 11:18:52 +00:00
|
|
|
|
|
|
|
const struct button_mapping *plugin_contexts[]
|
2010-05-20 17:41:28 +00:00
|
|
|
= {pla_main_ctx,
|
2007-07-19 03:49:43 +00:00
|
|
|
#if defined(HAVE_REMOTE_LCD)
|
2010-05-20 17:41:28 +00:00
|
|
|
pla_remote_ctx,
|
2007-07-19 03:49:43 +00:00
|
|
|
#endif
|
|
|
|
};
|
2010-05-20 17:41:28 +00:00
|
|
|
|
2006-10-30 01:31:32 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
2007-07-18 11:18:52 +00:00
|
|
|
struct line_color
|
|
|
|
{
|
|
|
|
int r,g,b;
|
|
|
|
int current_r,current_g,current_b;
|
|
|
|
};
|
2006-10-30 01:31:32 +00:00
|
|
|
#endif
|
|
|
|
|
2005-10-07 22:22:07 +00:00
|
|
|
/******************************* Globals ***********************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Compute a new random step to make the point bounce the borders of the screen
|
|
|
|
*/
|
|
|
|
|
2011-10-15 20:38:08 +00:00
|
|
|
static int get_new_step(int step)
|
2005-10-07 22:22:07 +00:00
|
|
|
{
|
|
|
|
if(step>0)
|
|
|
|
return -(MIN_STEP_RANGE + rb->rand() % (MAX_STEP_RANGE-MIN_STEP_RANGE));
|
|
|
|
else
|
|
|
|
return (MIN_STEP_RANGE + rb->rand() % (MAX_STEP_RANGE-MIN_STEP_RANGE));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Point Stuffs
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct point
|
|
|
|
{
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Polygon Stuffs
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct polygon
|
|
|
|
{
|
|
|
|
struct point points[NB_POINTS];
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Generates a random polygon (which fits the screen size though)
|
|
|
|
*/
|
2011-10-15 20:38:08 +00:00
|
|
|
static void polygon_init(struct polygon * polygon, struct screen * display)
|
2005-10-07 22:22:07 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for(i=0;i<NB_POINTS;++i)
|
|
|
|
{
|
2008-06-28 20:45:21 +00:00
|
|
|
polygon->points[i].x=(rb->rand() % (display->getwidth()));
|
|
|
|
polygon->points[i].y=(rb->rand() % (display->getheight()));
|
2005-10-07 22:22:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Draw the given polygon onto the screen
|
|
|
|
*/
|
|
|
|
|
2011-10-15 20:38:08 +00:00
|
|
|
static void polygon_draw(struct polygon * polygon, struct screen * display)
|
2005-10-07 22:22:07 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for(i=0;i<NB_POINTS-1;++i)
|
|
|
|
{
|
2006-07-01 10:14:27 +00:00
|
|
|
display->drawline(polygon->points[i].x, polygon->points[i].y,
|
2005-10-07 22:22:07 +00:00
|
|
|
polygon->points[i+1].x, polygon->points[i+1].y);
|
|
|
|
}
|
2006-07-01 10:14:27 +00:00
|
|
|
display->drawline(polygon->points[0].x, polygon->points[0].y,
|
2005-10-07 22:22:07 +00:00
|
|
|
polygon->points[NB_POINTS-1].x,
|
|
|
|
polygon->points[NB_POINTS-1].y);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Polygon moving data Stuffs
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct polygon_move
|
|
|
|
{
|
|
|
|
struct point move_steps[NB_POINTS];
|
|
|
|
};
|
|
|
|
|
2011-10-15 20:38:08 +00:00
|
|
|
static void polygon_move_init(struct polygon_move * polygon_move)
|
2005-10-07 22:22:07 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for(i=0;i<NB_POINTS;++i)
|
|
|
|
{
|
|
|
|
polygon_move->move_steps[i].x=get_new_step(-1);
|
|
|
|
/* -1 because we want a positive random step */
|
|
|
|
polygon_move->move_steps[i].y=get_new_step(-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Update the given polygon's position according to the given informations in
|
|
|
|
* polygon_move (polygon_move may be updated)
|
|
|
|
*/
|
2011-10-15 20:38:08 +00:00
|
|
|
static void polygon_update(struct polygon *polygon, struct screen * display,
|
|
|
|
struct polygon_move *polygon_move)
|
2005-10-07 22:22:07 +00:00
|
|
|
{
|
|
|
|
int i, x, y, step;
|
|
|
|
for(i=0;i<NB_POINTS;++i)
|
|
|
|
{
|
|
|
|
x=polygon->points[i].x;
|
|
|
|
step=polygon_move->move_steps[i].x;
|
|
|
|
x+=step;
|
|
|
|
if(x<=0)
|
|
|
|
{
|
|
|
|
x=1;
|
|
|
|
polygon_move->move_steps[i].x=get_new_step(step);
|
|
|
|
}
|
2008-06-28 20:45:21 +00:00
|
|
|
else if(x>=display->getwidth())
|
2005-10-07 22:22:07 +00:00
|
|
|
{
|
2008-06-28 20:45:21 +00:00
|
|
|
x=display->getwidth()-1;
|
2005-10-07 22:22:07 +00:00
|
|
|
polygon_move->move_steps[i].x=get_new_step(step);
|
|
|
|
}
|
|
|
|
polygon->points[i].x=x;
|
|
|
|
|
|
|
|
y=polygon->points[i].y;
|
|
|
|
step=polygon_move->move_steps[i].y;
|
|
|
|
y+=step;
|
|
|
|
if(y<=0)
|
|
|
|
{
|
|
|
|
y=1;
|
|
|
|
polygon_move->move_steps[i].y=get_new_step(step);
|
|
|
|
}
|
2008-06-28 20:45:21 +00:00
|
|
|
else if(y>=display->getheight())
|
2005-10-07 22:22:07 +00:00
|
|
|
{
|
2008-06-28 20:45:21 +00:00
|
|
|
y=display->getheight()-1;
|
2005-10-07 22:22:07 +00:00
|
|
|
polygon_move->move_steps[i].y=get_new_step(step);
|
|
|
|
}
|
|
|
|
polygon->points[i].y=y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Polygon fifo Stuffs
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct polygon_fifo
|
|
|
|
{
|
|
|
|
int fifo_tail;
|
|
|
|
int fifo_head;
|
|
|
|
int nb_items;
|
|
|
|
struct polygon tab[MAX_POLYGONS];
|
|
|
|
};
|
|
|
|
|
2011-10-15 20:38:08 +00:00
|
|
|
static void fifo_init(struct polygon_fifo * fifo)
|
2005-10-07 22:22:07 +00:00
|
|
|
{
|
|
|
|
fifo->fifo_tail=0;
|
|
|
|
fifo->fifo_head=0;
|
|
|
|
fifo->nb_items=0;
|
|
|
|
}
|
|
|
|
|
2011-10-15 20:38:08 +00:00
|
|
|
static void fifo_push(struct polygon_fifo * fifo, struct polygon * polygon)
|
2005-10-07 22:22:07 +00:00
|
|
|
{
|
|
|
|
if(fifo->nb_items>=MAX_POLYGONS)
|
|
|
|
return;
|
|
|
|
++(fifo->nb_items);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Workaround for gcc (which uses memcpy internally) to avoid link error
|
|
|
|
* fifo->tab[fifo->fifo_head]=polygon
|
|
|
|
*/
|
|
|
|
rb->memcpy(&(fifo->tab[fifo->fifo_head]), polygon, sizeof(struct polygon));
|
|
|
|
++(fifo->fifo_head);
|
|
|
|
if(fifo->fifo_head>=MAX_POLYGONS)
|
|
|
|
fifo->fifo_head=0;
|
|
|
|
}
|
|
|
|
|
2011-10-15 20:38:08 +00:00
|
|
|
static struct polygon * fifo_pop(struct polygon_fifo * fifo)
|
2005-10-07 22:22:07 +00:00
|
|
|
{
|
|
|
|
int index;
|
|
|
|
if(fifo->nb_items==0)
|
|
|
|
return(NULL);
|
|
|
|
--(fifo->nb_items);
|
|
|
|
index=fifo->fifo_tail;
|
|
|
|
++(fifo->fifo_tail);
|
|
|
|
if(fifo->fifo_tail>=MAX_POLYGONS)
|
|
|
|
fifo->fifo_tail=0;
|
|
|
|
return(&(fifo->tab[index]));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Drawing stuffs
|
|
|
|
*/
|
|
|
|
|
2011-10-15 20:38:08 +00:00
|
|
|
static void polygons_draw(struct polygon_fifo * polygons, struct screen * display)
|
2005-10-07 22:22:07 +00:00
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
for(i=0, j=polygons->fifo_tail;i<polygons->nb_items;++i, ++j)
|
|
|
|
{
|
|
|
|
if(j>=MAX_POLYGONS)
|
|
|
|
j=0;
|
2006-07-01 10:14:27 +00:00
|
|
|
polygon_draw(&(polygons->tab[j]), display);
|
2005-10-07 22:22:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-15 20:38:08 +00:00
|
|
|
static void cleanup(void)
|
2005-10-07 22:22:07 +00:00
|
|
|
{
|
2020-07-24 23:20:15 +00:00
|
|
|
#ifdef HAVE_BACKLIGHT
|
2009-01-16 10:34:40 +00:00
|
|
|
backlight_use_settings();
|
2007-11-29 23:55:58 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
2009-01-16 10:34:40 +00:00
|
|
|
remote_backlight_use_settings();
|
2006-07-01 10:14:27 +00:00
|
|
|
#endif
|
2020-07-24 23:20:15 +00:00
|
|
|
#endif
|
2005-10-07 22:22:07 +00:00
|
|
|
}
|
|
|
|
|
2006-10-30 01:31:32 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
2011-10-15 20:38:08 +00:00
|
|
|
static void color_randomize(struct line_color * color)
|
2007-07-18 11:18:52 +00:00
|
|
|
{
|
|
|
|
color->r = rb->rand()%255;
|
|
|
|
color->g = rb->rand()%255;
|
|
|
|
color->b = rb->rand()%255;
|
|
|
|
}
|
|
|
|
|
2011-10-15 20:38:08 +00:00
|
|
|
static void color_init(struct line_color * color)
|
2006-10-30 01:31:32 +00:00
|
|
|
{
|
2007-07-18 11:18:52 +00:00
|
|
|
color_randomize(color);
|
|
|
|
color->current_r=color->r;
|
|
|
|
color->current_g=color->g;
|
|
|
|
color->current_b=color->b;
|
2006-10-30 01:31:32 +00:00
|
|
|
}
|
|
|
|
|
2011-10-15 20:38:08 +00:00
|
|
|
static void color_change(struct line_color * color)
|
2006-10-30 01:31:32 +00:00
|
|
|
{
|
2007-07-18 11:18:52 +00:00
|
|
|
if(color->current_r<color->r)
|
|
|
|
++color->current_r;
|
|
|
|
else if(color->current_r>color->r)
|
|
|
|
--color->current_r;
|
|
|
|
if(color->current_g<color->g)
|
|
|
|
++color->current_g;
|
|
|
|
else if(color->current_g>color->g)
|
|
|
|
--color->current_g;
|
|
|
|
if(color->current_b<color->b)
|
|
|
|
++color->current_b;
|
|
|
|
else if(color->current_b>color->b)
|
|
|
|
--color->current_b;
|
|
|
|
|
|
|
|
if(color->current_r==color->r &&
|
|
|
|
color->current_g==color->g &&
|
|
|
|
color->current_b==color->b)
|
|
|
|
color_randomize(color);
|
2006-10-30 01:31:32 +00:00
|
|
|
}
|
2007-07-18 11:18:52 +00:00
|
|
|
|
2007-07-19 03:49:43 +00:00
|
|
|
#define COLOR_RGBPACK(color) \
|
|
|
|
LCD_RGBPACK((color)->current_r, (color)->current_g, (color)->current_b)
|
2007-07-18 11:18:52 +00:00
|
|
|
|
2011-10-15 20:38:08 +00:00
|
|
|
static void color_apply(struct line_color * color, struct screen * display)
|
2007-07-19 03:49:43 +00:00
|
|
|
{
|
|
|
|
if (display->is_color){
|
|
|
|
unsigned foreground=
|
|
|
|
SCREEN_COLOR_TO_NATIVE(display,COLOR_RGBPACK(color));
|
|
|
|
display->set_foreground(foreground);
|
|
|
|
}
|
|
|
|
}
|
2006-10-30 01:31:32 +00:00
|
|
|
#endif
|
|
|
|
|
2005-10-07 22:22:07 +00:00
|
|
|
/*
|
|
|
|
* Main function
|
|
|
|
*/
|
|
|
|
|
2011-10-15 20:38:08 +00:00
|
|
|
static int plugin_main(void)
|
2005-10-07 22:22:07 +00:00
|
|
|
{
|
2007-07-18 11:18:52 +00:00
|
|
|
int action;
|
2005-10-07 22:22:07 +00:00
|
|
|
int sleep_time=DEFAULT_WAIT_TIME;
|
|
|
|
int nb_wanted_polygons=DEFAULT_NB_POLYGONS;
|
2006-07-01 10:14:27 +00:00
|
|
|
struct polygon_fifo polygons[NB_SCREENS];
|
|
|
|
struct polygon_move move[NB_SCREENS]; /* This describes the movement of the leading
|
|
|
|
polygon, the others just follow */
|
|
|
|
struct polygon leading_polygon[NB_SCREENS];
|
|
|
|
FOR_NB_SCREENS(i)
|
|
|
|
{
|
2006-10-30 01:31:32 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
struct screen *display = rb->screens[i];
|
2007-07-18 11:18:52 +00:00
|
|
|
if (display->is_color)
|
2006-10-30 01:31:32 +00:00
|
|
|
display->set_background(LCD_BLACK);
|
|
|
|
#endif
|
2006-07-01 10:14:27 +00:00
|
|
|
fifo_init(&polygons[i]);
|
|
|
|
polygon_move_init(&move[i]);
|
|
|
|
polygon_init(&leading_polygon[i], rb->screens[i]);
|
|
|
|
}
|
2006-10-30 01:31:32 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LCD_COLOR
|
2007-07-18 11:18:52 +00:00
|
|
|
struct line_color color;
|
|
|
|
color_init(&color);
|
2006-10-30 01:31:32 +00:00
|
|
|
#endif
|
|
|
|
|
2005-10-07 22:22:07 +00:00
|
|
|
while (true)
|
|
|
|
{
|
2006-07-01 10:14:27 +00:00
|
|
|
FOR_NB_SCREENS(i)
|
|
|
|
{
|
|
|
|
struct screen * display=rb->screens[i];
|
|
|
|
if(polygons[i].nb_items>nb_wanted_polygons)
|
|
|
|
{ /* We have too many polygons, we must drop some of them */
|
|
|
|
fifo_pop(&polygons[i]);
|
|
|
|
}
|
|
|
|
if(nb_wanted_polygons==polygons[i].nb_items)
|
|
|
|
{ /* We have the good number of polygons, we can safely drop
|
|
|
|
the last one to add the new one later */
|
|
|
|
fifo_pop(&polygons[i]);
|
|
|
|
}
|
|
|
|
fifo_push(&polygons[i], &leading_polygon[i]);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Then we update the leading polygon for the next round acording to
|
|
|
|
* current move (the move may be altered in case of sreen border
|
|
|
|
* collision)
|
|
|
|
*/
|
|
|
|
polygon_update(&leading_polygon[i], display, &move[i]);
|
|
|
|
|
|
|
|
/* Now the drawing part */
|
2006-10-30 01:31:32 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
2007-07-19 03:49:43 +00:00
|
|
|
color_apply(&color, display);
|
2006-10-30 01:31:32 +00:00
|
|
|
#endif
|
2006-07-01 10:14:27 +00:00
|
|
|
display->clear_display();
|
|
|
|
polygons_draw(&polygons[i], display);
|
|
|
|
display->update();
|
2005-10-07 22:22:07 +00:00
|
|
|
}
|
2006-10-30 01:31:32 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
2007-07-18 11:18:52 +00:00
|
|
|
color_change(&color);
|
2006-10-30 01:31:32 +00:00
|
|
|
#endif
|
2005-10-07 22:22:07 +00:00
|
|
|
/* Speed handling*/
|
|
|
|
if (sleep_time<0)/* full speed */
|
|
|
|
rb->yield();
|
|
|
|
else
|
|
|
|
rb->sleep(sleep_time);
|
2009-01-16 10:34:40 +00:00
|
|
|
action = pluginlib_getaction(TIMEOUT_NOBLOCK,
|
2010-05-20 17:41:28 +00:00
|
|
|
plugin_contexts, ARRAYLEN(plugin_contexts));
|
2007-07-18 11:18:52 +00:00
|
|
|
switch(action)
|
2005-10-07 22:22:07 +00:00
|
|
|
{
|
2006-07-01 10:14:27 +00:00
|
|
|
case DEMYSTIFY_QUIT:
|
2005-10-07 22:22:07 +00:00
|
|
|
return PLUGIN_OK;
|
2007-07-18 11:18:52 +00:00
|
|
|
|
2006-07-01 10:14:27 +00:00
|
|
|
case DEMYSTIFY_ADD_POLYGON:
|
2007-07-18 11:18:52 +00:00
|
|
|
case DEMYSTIFY_ADD_POLYGON_REPEAT:
|
2005-10-07 22:22:07 +00:00
|
|
|
if(nb_wanted_polygons<MAX_POLYGONS)
|
|
|
|
++nb_wanted_polygons;
|
|
|
|
break;
|
|
|
|
|
2006-07-01 10:14:27 +00:00
|
|
|
case DEMYSTIFY_REMOVE_POLYGON:
|
2007-07-18 11:18:52 +00:00
|
|
|
case DEMYSTIFY_REMOVE_POLYGON_REPEAT:
|
2005-10-07 22:22:07 +00:00
|
|
|
if(nb_wanted_polygons>MIN_POLYGONS)
|
|
|
|
--nb_wanted_polygons;
|
|
|
|
break;
|
|
|
|
|
2006-07-01 10:14:27 +00:00
|
|
|
case DEMYSTIFY_INCREASE_SPEED:
|
2007-07-18 11:18:52 +00:00
|
|
|
case DEMYSTIFY_INCREASE_SPEED_REPEAT:
|
2005-10-07 22:22:07 +00:00
|
|
|
if(sleep_time>=0)
|
|
|
|
--sleep_time;
|
|
|
|
break;
|
|
|
|
|
2006-07-01 10:14:27 +00:00
|
|
|
case DEMYSTIFY_DECREASE_SPEED:
|
2007-07-18 11:18:52 +00:00
|
|
|
case DEMYSTIFY_DECREASE_SPEED_REPEAT:
|
2005-10-07 22:22:07 +00:00
|
|
|
++sleep_time;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2010-08-24 14:30:46 +00:00
|
|
|
exit_on_usb(action);
|
2005-10-07 22:22:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************** Plugin entry point ****************************/
|
|
|
|
|
2009-01-16 10:34:40 +00:00
|
|
|
enum plugin_status plugin_start(const void* parameter)
|
2005-10-07 22:22:07 +00:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
2007-11-29 23:55:58 +00:00
|
|
|
(void)parameter;
|
2010-08-24 14:30:46 +00:00
|
|
|
atexit(cleanup);
|
|
|
|
|
2006-11-15 06:46:35 +00:00
|
|
|
#if LCD_DEPTH > 1
|
2006-11-15 06:14:27 +00:00
|
|
|
rb->lcd_set_backdrop(NULL);
|
2006-11-15 06:46:35 +00:00
|
|
|
#endif
|
2020-07-24 23:20:15 +00:00
|
|
|
#ifdef HAVE_BACKLIGHT
|
2011-01-24 12:29:16 +00:00
|
|
|
backlight_ignore_timeout();
|
2007-11-29 23:55:58 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
2011-01-24 12:29:16 +00:00
|
|
|
remote_backlight_ignore_timeout();
|
2020-07-24 23:20:15 +00:00
|
|
|
#endif
|
2007-11-29 23:55:58 +00:00
|
|
|
#endif
|
2005-10-07 22:22:07 +00:00
|
|
|
ret = plugin_main();
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|