From 56fd6f9316ee196bfd16a2f102469cb6b040d397 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Mon, 30 Aug 2004 17:21:15 +0000 Subject: [PATCH] Fixed USB handling, and brought back the special mode git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5025 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/bounce.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/apps/plugins/bounce.c b/apps/plugins/bounce.c index e31c15eb2f..d4244745bc 100644 --- a/apps/plugins/bounce.c +++ b/apps/plugins/bounce.c @@ -238,9 +238,13 @@ static int scrollit(void) b = rb->button_get_w_tmo(HZ/10); if ( b == (BUTTON_OFF|BUTTON_REL) ) return 0; - else if ( b == (BUTTON_ON|BUTTON_REL) ) + + if ( b == (BUTTON_ON|BUTTON_REL) ) return 1; + if ( rb->default_event_handler(b) == SYS_USB_CONNECTED ) + return -1; + rb->lcd_clear_display(); for(i=0, yy=y, xx=x; i< LETTERS_ON_SCREEN; i++) { @@ -290,13 +294,16 @@ static int loopit(void) { b = rb->button_get_w_tmo(HZ/10); if ( b == (BUTTON_OFF|BUTTON_REL) ) - return PLUGIN_OK; - else if(b != BUTTON_NONE) - timeout=20; + return 0; - if ( rb->default_event_handler(b) == SYS_USB_CONNECTED) { - return PLUGIN_USB_CONNECTED; - } + if ( b == (BUTTON_ON|BUTTON_REL) ) + return 1; + + if ( rb->default_event_handler(b) == SYS_USB_CONNECTED ) + return -1; + + if ( b != BUTTON_NONE ) + timeout=20; y+= speed[ysanke&15] + values[NUM_YADD].num; x+= speed[xsanke&15] + values[NUM_XADD].num; @@ -388,14 +395,14 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) rb->sleep(HZ); do { - h= loopit(); - if(h) + h = loopit(); + if (h > 0) h = scrollit(); - } while(h); + } while(h > 0); rb->lcd_setfont(FONT_UI); - return false; + return h = 0 ? PLUGIN_OK : PLUGIN_USB_CONNECTED; } #endif