diff options
-rw-r--r-- | apps/plugin.c | 1 | ||||
-rw-r--r-- | apps/plugin.h | 3 | ||||
-rw-r--r-- | apps/plugins/battery_bench.c | 17 |
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 = { | |||
804 | the API gets incompatible */ | 804 | the API gets incompatible */ |
805 | warn_on_pl_erase, | 805 | warn_on_pl_erase, |
806 | playlist_insert_playlist, | 806 | playlist_insert_playlist, |
807 | battery_current, | ||
807 | }; | 808 | }; |
808 | 809 | ||
809 | static int plugin_buffer_handle; | 810 | 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); | |||
155 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 155 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
156 | 156 | ||
157 | /* increase this every time the api struct changes */ | 157 | /* increase this every time the api struct changes */ |
158 | #define PLUGIN_API_VERSION 246 | 158 | #define PLUGIN_API_VERSION 247 |
159 | 159 | ||
160 | /* update this to latest version if a change to the api struct breaks | 160 | /* update this to latest version if a change to the api struct breaks |
161 | backwards compatibility (and please take the opportunity to sort in any | 161 | backwards compatibility (and please take the opportunity to sort in any |
@@ -931,6 +931,7 @@ struct plugin_api { | |||
931 | bool (*warn_on_pl_erase)(void); | 931 | bool (*warn_on_pl_erase)(void); |
932 | int (*playlist_insert_playlist)(struct playlist_info* playlist, | 932 | int (*playlist_insert_playlist)(struct playlist_info* playlist, |
933 | const char *filename, int position, bool queue); | 933 | const char *filename, int position, bool queue); |
934 | int (*battery_current)(void); | ||
934 | }; | 935 | }; |
935 | 936 | ||
936 | /* plugin header */ | 937 | /* 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 | |||
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 |