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/battery_bench.c | |
| parent | 23f127ddd7ccda46f88597307cd6df3da3a98c0c (diff) | |
| download | rockbox-29e259a29190a5ec67dbffc85389a1cb71a9fe26.zip rockbox-29e259a29190a5ec67dbffc85389a1cb71a9fe26.tar.gz rockbox-29e259a29190a5ec67dbffc85389a1cb71a9fe26.tar.bz2 rockbox-29e259a29190a5ec67dbffc85389a1cb71a9fe26.tar.xz | |
* 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/battery_bench.c')
| -rw-r--r-- | apps/plugins/battery_bench.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c index 75d5cbc..85d35b0 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 |