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.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c
index 909de03512..c0b6d44e9f 100644
--- a/apps/plugins/battery_bench.c
+++ b/apps/plugins/battery_bench.c
@@ -306,22 +306,19 @@ static unsigned int charge_state(void)
306#endif 306#endif
307 307
308 308
309static bool flush_buffer(void) 309static void flush_buffer(void* data)
310{ 310{
311 (void)data;
311 int fd, secs; 312 int fd, secs;
312 unsigned int i; 313 unsigned int i;
313 314
314 /* don't access the disk when in usb mode, or when no data is available */ 315 /* don't access the disk when in usb mode, or when no data is available */
315 if (in_usb_mode || (buf_idx == 0)) 316 if (in_usb_mode || (buf_idx == 0))
316 { 317 return;
317 return false;
318 }
319 318
320 fd = rb->open(BATTERY_LOG, O_RDWR | O_CREAT | O_APPEND); 319 fd = rb->open(BATTERY_LOG, O_RDWR | O_CREAT | O_APPEND);
321 if (fd < 0) 320 if (fd < 0)
322 { 321 return;
323 return false;
324 }
325 322
326 for (i = 0; i < buf_idx; i++) 323 for (i = 0; i < buf_idx; i++)
327 { 324 {
@@ -357,7 +354,6 @@ static bool flush_buffer(void)
357 rb->close(fd); 354 rb->close(fd);
358 355
359 buf_idx = 0; 356 buf_idx = 0;
360 return true;
361} 357}
362 358
363 359
@@ -395,7 +391,7 @@ void thread(void)
395 for this to occur because it requires > 16 hours of no disk activity. 391 for this to occur because it requires > 16 hours of no disk activity.
396 */ 392 */
397 if (buf_idx == BUF_ELEMENTS) { 393 if (buf_idx == BUF_ELEMENTS) {
398 flush_buffer(); 394 flush_buffer(NULL);
399 } 395 }
400 396
401 /* sleep some time until next measurement */ 397 /* sleep some time until next measurement */