summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/plugin.c1
-rw-r--r--apps/plugin.h3
-rw-r--r--apps/plugins/battery_bench.c17
3 files changed, 19 insertions, 2 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index 89905b1435..bd7f74e65f 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -804,6 +804,7 @@ static const struct plugin_api rockbox_api = {
the API gets incompatible */
warn_on_pl_erase,
playlist_insert_playlist,
+ battery_current,
};
static int plugin_buffer_handle;
diff --git a/apps/plugin.h b/apps/plugin.h
index f4bb91988a..7306e3fcba 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -155,7 +155,7 @@ int plugin_open(const char *plugin, const char *parameter);
#define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */
-#define PLUGIN_API_VERSION 246
+#define PLUGIN_API_VERSION 247
/* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any
@@ -931,6 +931,7 @@ struct plugin_api {
bool (*warn_on_pl_erase)(void);
int (*playlist_insert_playlist)(struct playlist_info* playlist,
const char *filename, int position, bool queue);
+ int (*battery_current)(void);
};
/* plugin header */
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
* a power of 2 */
unsigned secs;
int eta;
- unsigned int voltage;
+ int voltage;
+#if CONFIG_BATTERY_MEASURE & CURRENT_MEASURE
+ int current;
+#endif
short level;
unsigned short flags;
} bat[BUF_SIZE/sizeof(struct batt_info)];
@@ -368,6 +371,9 @@ static void flush_buffer(void)
rb->fdprintf(fd,
"%02d:%02d:%02d, %05d, %03d%%, "
"%02d:%02d, %04d, "
+#if CONFIG_BATTERY_MEASURE & CURRENT_MEASURE
+ " %04d, "
+#endif
#if CONFIG_CHARGING
" %c"
#if CONFIG_CHARGING >= CHARGING_MONITOR
@@ -382,6 +388,9 @@ static void flush_buffer(void)
HMS(bat[i].secs), bat[i].secs, bat[i].level,
bat[i].eta / 60, bat[i].eta % 60,
bat[i].voltage
+#if CONFIG_BATTERY_MEASURE & CURRENT_MEASURE
+ , bat[i].current
+#endif
#if CONFIG_CHARGING
, (bat[i].flags & BIT_CHARGER) ? 'A' : '-'
#if CONFIG_CHARGING >= CHARGING_MONITOR
@@ -419,6 +428,9 @@ static void thread(void)
bat[buf_idx].level = rb->battery_level();
bat[buf_idx].eta = rb->battery_time();
bat[buf_idx].voltage = rb->battery_voltage();
+#if CONFIG_BATTERY_MEASURE & CURRENT_MEASURE
+ bat[buf_idx].current = rb->battery_current();
+#endif
#if CONFIG_CHARGING || defined(HAVE_USB_POWER)
bat[buf_idx].flags = charge_state();
#endif
@@ -579,6 +591,9 @@ enum plugin_status plugin_start(const void* parameter)
rb->fdprintf(fd,
"# Time:, Seconds:, Level:, Time Left:, Voltage[mV]:"
+#if CONFIG_BATTERY_MEASURE & CURRENT_MEASURE
+ ", Current[mA]:"
+#endif
#if CONFIG_CHARGING
", C:"
#endif