summaryrefslogtreecommitdiff
path: root/apps/plugins/battery_bench.c
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2021-11-30 19:29:54 +0000
committerAidan MacDonald <amachronic@protonmail.com>2021-12-23 11:39:58 +0000
commitfc678bd001937f4a218e57db629c7dae8648bf4a (patch)
tree318db96d3e1a90859a06e7acaa39638ad3dca2d3 /apps/plugins/battery_bench.c
parent9ae983068a7e9d73c0254639cca2e7d6390f7da5 (diff)
downloadrockbox-fc678bd001937f4a218e57db629c7dae8648bf4a.tar.gz
rockbox-fc678bd001937f4a218e57db629c7dae8648bf4a.zip
battery_bench: Log battery current information
Works on targets supporting CURRENT_MEASURE. Change-Id: I021b995c46fab923287ad54e72863695ef9ed58a
Diffstat (limited to 'apps/plugins/battery_bench.c')
-rw-r--r--apps/plugins/battery_bench.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c
index e918fae39d..d8e29d73ca 100644
--- a/apps/plugins/battery_bench.c
+++ b/apps/plugins/battery_bench.c
@@ -268,7 +268,10 @@ static struct batt_info
268 * a power of 2 */ 268 * a power of 2 */
269 unsigned secs; 269 unsigned secs;
270 int eta; 270 int eta;
271 unsigned int voltage; 271 int voltage;
272#if CONFIG_BATTERY_MEASURE & CURRENT_MEASURE
273 int current;
274#endif
272 short level; 275 short level;
273 unsigned short flags; 276 unsigned short flags;
274} bat[BUF_SIZE/sizeof(struct batt_info)]; 277} bat[BUF_SIZE/sizeof(struct batt_info)];
@@ -368,6 +371,9 @@ static void flush_buffer(void)
368 rb->fdprintf(fd, 371 rb->fdprintf(fd,
369 "%02d:%02d:%02d, %05d, %03d%%, " 372 "%02d:%02d:%02d, %05d, %03d%%, "
370 "%02d:%02d, %04d, " 373 "%02d:%02d, %04d, "
374#if CONFIG_BATTERY_MEASURE & CURRENT_MEASURE
375 " %04d, "
376#endif
371#if CONFIG_CHARGING 377#if CONFIG_CHARGING
372 " %c" 378 " %c"
373#if CONFIG_CHARGING >= CHARGING_MONITOR 379#if CONFIG_CHARGING >= CHARGING_MONITOR
@@ -382,6 +388,9 @@ static void flush_buffer(void)
382 HMS(bat[i].secs), bat[i].secs, bat[i].level, 388 HMS(bat[i].secs), bat[i].secs, bat[i].level,
383 bat[i].eta / 60, bat[i].eta % 60, 389 bat[i].eta / 60, bat[i].eta % 60,
384 bat[i].voltage 390 bat[i].voltage
391#if CONFIG_BATTERY_MEASURE & CURRENT_MEASURE
392 , bat[i].current
393#endif
385#if CONFIG_CHARGING 394#if CONFIG_CHARGING
386 , (bat[i].flags & BIT_CHARGER) ? 'A' : '-' 395 , (bat[i].flags & BIT_CHARGER) ? 'A' : '-'
387#if CONFIG_CHARGING >= CHARGING_MONITOR 396#if CONFIG_CHARGING >= CHARGING_MONITOR
@@ -419,6 +428,9 @@ static void thread(void)
419 bat[buf_idx].level = rb->battery_level(); 428 bat[buf_idx].level = rb->battery_level();
420 bat[buf_idx].eta = rb->battery_time(); 429 bat[buf_idx].eta = rb->battery_time();
421 bat[buf_idx].voltage = rb->battery_voltage(); 430 bat[buf_idx].voltage = rb->battery_voltage();
431#if CONFIG_BATTERY_MEASURE & CURRENT_MEASURE
432 bat[buf_idx].current = rb->battery_current();
433#endif
422#if CONFIG_CHARGING || defined(HAVE_USB_POWER) 434#if CONFIG_CHARGING || defined(HAVE_USB_POWER)
423 bat[buf_idx].flags = charge_state(); 435 bat[buf_idx].flags = charge_state();
424#endif 436#endif
@@ -579,6 +591,9 @@ enum plugin_status plugin_start(const void* parameter)
579 591
580 rb->fdprintf(fd, 592 rb->fdprintf(fd,
581 "# Time:, Seconds:, Level:, Time Left:, Voltage[mV]:" 593 "# Time:, Seconds:, Level:, Time Left:, Voltage[mV]:"
594#if CONFIG_BATTERY_MEASURE & CURRENT_MEASURE
595 ", Current[mA]:"
596#endif
582#if CONFIG_CHARGING 597#if CONFIG_CHARGING
583 ", C:" 598 ", C:"
584#endif 599#endif