diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2006-10-31 11:17:00 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2006-10-31 11:17:00 +0000 |
commit | 29e259a29190a5ec67dbffc85389a1cb71a9fe26 (patch) | |
tree | fbb8615c108ee177f378444952b89009f5527519 /apps/plugins | |
parent | 23f127ddd7ccda46f88597307cd6df3da3a98c0c (diff) |
* give tsr plugins the choice to quit or not
* bumps plugin api version
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11405 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/alpine_cdc.c | 5 | ||||
-rw-r--r-- | apps/plugins/battery_bench.c | 28 |
2 files changed, 25 insertions, 8 deletions
diff --git a/apps/plugins/alpine_cdc.c b/apps/plugins/alpine_cdc.c index 134bb3dee6..65108680c6 100644 --- a/apps/plugins/alpine_cdc.c +++ b/apps/plugins/alpine_cdc.c @@ -1122,8 +1122,10 @@ void thread(void) } /* callback to end the TSR plugin, called before a new one gets loaded */ -void exit_tsr(void) +bool exit_tsr(bool reenter) { + if (reenter) + return false; /* dont let it start again */ gTread.exiting = true; /* tell the thread to end */ while (!gTread.ended) /* wait until it did */ rb->yield(); @@ -1133,6 +1135,7 @@ void exit_tsr(void) timer_set_mode(TM_OFF); /* timer interrupt off */ sound_normal(); /* restore sound settings */ + return true; } /****************** main ******************/ diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c index 75d5cbcabd..85d35b003e 100644 --- a/apps/plugins/battery_bench.c +++ b/apps/plugins/battery_bench.c @@ -92,7 +92,7 @@ PLUGIN_HEADER /****************************** Plugin Entry Point ****************************/ static struct plugin_api* rb; int main(void); -void exit_tsr(void); +bool exit_tsr(bool); void thread(void); @@ -119,13 +119,27 @@ struct batt_info struct event_queue thread_q; -void exit_tsr(void) +bool exit_tsr(bool reenter) { - rb->queue_post(&thread_q, EV_EXIT, NULL); - while (!s_thread.ended) - rb->yield(); - /* remove the thread's queue from the broadcast list */ - rb->queue_delete(&thread_q); + bool exit = true; + (void)reenter; + rb->lcd_clear_display(); + rb->lcd_puts_scroll(0, 0, "Batt.Bench is currently running."); + rb->lcd_puts_scroll(0, 1, "Press OFF to cancel the test"); + rb->lcd_puts_scroll(0, 2, "Anything else will resume"); + rb->lcd_update(); + if (rb->button_get(true) != BATTERY_OFF) + exit = false; + if (exit) + { + rb->queue_post(&thread_q, EV_EXIT, NULL); + while (!s_thread.ended) + rb->yield(); + /* remove the thread's queue from the broadcast list */ + rb->queue_delete(&thread_q); + return true; + } + else return false; } #define BIT_CHARGER 0x1000 |