summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/battery_bench.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c
index 1d3694cbc5..85377e22a9 100644
--- a/apps/plugins/battery_bench.c
+++ b/apps/plugins/battery_bench.c
@@ -118,8 +118,13 @@ bool thread_stopped = false;
118/* Struct for battery information */ 118/* Struct for battery information */
119struct batt_info 119struct batt_info
120{ 120{
121 int ticks, level, eta; 121 /* the size of the struct elements is optimised to make the struct size
122 * a power of 2 */
123 long ticks;
124 int eta;
122 unsigned int voltage; 125 unsigned int voltage;
126 short level;
127 unsigned short flags;
123} bat[BUF_SIZE/sizeof(struct batt_info)]; 128} bat[BUF_SIZE/sizeof(struct batt_info)];
124 129
125struct event_queue thread_q; 130struct event_queue thread_q;
@@ -150,9 +155,9 @@ bool exit_tsr(bool reenter)
150 else return false; 155 else return false;
151} 156}
152 157
153#define BIT_CHARGER 0x1000 158#define BIT_CHARGER 0x1
154#define BIT_CHARGING 0x2000 159#define BIT_CHARGING 0x2
155#define BIT_USB_POWER 0x4000 160#define BIT_USB_POWER 0x4
156 161
157#define HMS(x) (x)/3600,((x)%3600)/60,((x)%3600)%60 162#define HMS(x) (x)/3600,((x)%3600)/60,((x)%3600)%60
158 163
@@ -248,21 +253,16 @@ void thread(void)
248 253
249 HMS(secs), secs, bat[j].level, 254 HMS(secs), secs, bat[j].level,
250 bat[j].eta / 60, bat[j].eta % 60, 255 bat[j].eta / 60, bat[j].eta % 60,
251#if CONFIG_CHARGING || defined(HAVE_USB_POWER)
252 (bat[j].voltage &
253 (~(BIT_CHARGER|BIT_CHARGING|BIT_USB_POWER))),
254#else
255 bat[j].voltage, 256 bat[j].voltage,
256#endif
257 temp + 1 + (j-i) 257 temp + 1 + (j-i)
258#if CONFIG_CHARGING 258#if CONFIG_CHARGING
259 ,(bat[j].voltage & BIT_CHARGER)?'A':'-' 259 ,(bat[j].flags & BIT_CHARGER)?'A':'-'
260#if CONFIG_CHARGING == CHARGING_MONITOR 260#if CONFIG_CHARGING == CHARGING_MONITOR
261 ,(bat[j].voltage & BIT_CHARGING)?'C':'-' 261 ,(bat[j].flags & BIT_CHARGING)?'C':'-'
262#endif 262#endif
263#endif 263#endif
264#ifdef HAVE_USB_POWER 264#ifdef HAVE_USB_POWER
265 ,(bat[j].voltage & BIT_USB_POWER)?'U':'-' 265 ,(bat[j].flags & BIT_USB_POWER)?'U':'-'
266#endif 266#endif
267 267
268 ); 268 );
@@ -313,7 +313,7 @@ void thread(void)
313 bat[i].eta = rb->battery_time(); 313 bat[i].eta = rb->battery_time();
314 last_voltage = bat[i].voltage = current_voltage; 314 last_voltage = bat[i].voltage = current_voltage;
315#if CONFIG_CHARGING || defined(HAVE_USB_POWER) 315#if CONFIG_CHARGING || defined(HAVE_USB_POWER)
316 bat[i].voltage |= last_state = charge_state(); 316 bat[i].flags = last_state = charge_state();
317#endif 317#endif
318 i++; 318 i++;
319 got_info = true; 319 got_info = true;