summaryrefslogtreecommitdiff
path: root/apps/plugins/battery_bench.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/battery_bench.c')
-rw-r--r--apps/plugins/battery_bench.c28
1 files changed, 21 insertions, 7 deletions
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
92/****************************** Plugin Entry Point ****************************/ 92/****************************** Plugin Entry Point ****************************/
93static struct plugin_api* rb; 93static struct plugin_api* rb;
94int main(void); 94int main(void);
95void exit_tsr(void); 95bool exit_tsr(bool);
96void thread(void); 96void thread(void);
97 97
98 98
@@ -119,13 +119,27 @@ struct batt_info
119 119
120struct event_queue thread_q; 120struct event_queue thread_q;
121 121
122void exit_tsr(void) 122bool exit_tsr(bool reenter)
123{ 123{
124 rb->queue_post(&thread_q, EV_EXIT, NULL); 124 bool exit = true;
125 while (!s_thread.ended) 125 (void)reenter;
126 rb->yield(); 126 rb->lcd_clear_display();
127 /* remove the thread's queue from the broadcast list */ 127 rb->lcd_puts_scroll(0, 0, "Batt.Bench is currently running.");
128 rb->queue_delete(&thread_q); 128 rb->lcd_puts_scroll(0, 1, "Press OFF to cancel the test");
129 rb->lcd_puts_scroll(0, 2, "Anything else will resume");
130 rb->lcd_update();
131 if (rb->button_get(true) != BATTERY_OFF)
132 exit = false;
133 if (exit)
134 {
135 rb->queue_post(&thread_q, EV_EXIT, NULL);
136 while (!s_thread.ended)
137 rb->yield();
138 /* remove the thread's queue from the broadcast list */
139 rb->queue_delete(&thread_q);
140 return true;
141 }
142 else return false;
129} 143}
130 144
131#define BIT_CHARGER 0x1000 145#define BIT_CHARGER 0x1000