forked from len0rd/rockbox
battery_bench: Fix battery voltage logging for voltages >4.095V by separating the flags from voltage.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14658 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
d31751ef92
commit
cd9b51274f
1 changed files with 13 additions and 13 deletions
|
|
@ -118,8 +118,13 @@ bool thread_stopped = false;
|
||||||
/* Struct for battery information */
|
/* Struct for battery information */
|
||||||
struct batt_info
|
struct batt_info
|
||||||
{
|
{
|
||||||
int ticks, level, eta;
|
/* the size of the struct elements is optimised to make the struct size
|
||||||
|
* a power of 2 */
|
||||||
|
long ticks;
|
||||||
|
int eta;
|
||||||
unsigned int voltage;
|
unsigned int voltage;
|
||||||
|
short level;
|
||||||
|
unsigned short flags;
|
||||||
} bat[BUF_SIZE/sizeof(struct batt_info)];
|
} bat[BUF_SIZE/sizeof(struct batt_info)];
|
||||||
|
|
||||||
struct event_queue thread_q;
|
struct event_queue thread_q;
|
||||||
|
|
@ -150,9 +155,9 @@ bool exit_tsr(bool reenter)
|
||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BIT_CHARGER 0x1000
|
#define BIT_CHARGER 0x1
|
||||||
#define BIT_CHARGING 0x2000
|
#define BIT_CHARGING 0x2
|
||||||
#define BIT_USB_POWER 0x4000
|
#define BIT_USB_POWER 0x4
|
||||||
|
|
||||||
#define HMS(x) (x)/3600,((x)%3600)/60,((x)%3600)%60
|
#define HMS(x) (x)/3600,((x)%3600)/60,((x)%3600)%60
|
||||||
|
|
||||||
|
|
@ -248,21 +253,16 @@ void thread(void)
|
||||||
|
|
||||||
HMS(secs), secs, bat[j].level,
|
HMS(secs), secs, bat[j].level,
|
||||||
bat[j].eta / 60, bat[j].eta % 60,
|
bat[j].eta / 60, bat[j].eta % 60,
|
||||||
#if CONFIG_CHARGING || defined(HAVE_USB_POWER)
|
|
||||||
(bat[j].voltage &
|
|
||||||
(~(BIT_CHARGER|BIT_CHARGING|BIT_USB_POWER))),
|
|
||||||
#else
|
|
||||||
bat[j].voltage,
|
bat[j].voltage,
|
||||||
#endif
|
|
||||||
temp + 1 + (j-i)
|
temp + 1 + (j-i)
|
||||||
#if CONFIG_CHARGING
|
#if CONFIG_CHARGING
|
||||||
,(bat[j].voltage & BIT_CHARGER)?'A':'-'
|
,(bat[j].flags & BIT_CHARGER)?'A':'-'
|
||||||
#if CONFIG_CHARGING == CHARGING_MONITOR
|
#if CONFIG_CHARGING == CHARGING_MONITOR
|
||||||
,(bat[j].voltage & BIT_CHARGING)?'C':'-'
|
,(bat[j].flags & BIT_CHARGING)?'C':'-'
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_USB_POWER
|
#ifdef HAVE_USB_POWER
|
||||||
,(bat[j].voltage & BIT_USB_POWER)?'U':'-'
|
,(bat[j].flags & BIT_USB_POWER)?'U':'-'
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
@ -313,7 +313,7 @@ void thread(void)
|
||||||
bat[i].eta = rb->battery_time();
|
bat[i].eta = rb->battery_time();
|
||||||
last_voltage = bat[i].voltage = current_voltage;
|
last_voltage = bat[i].voltage = current_voltage;
|
||||||
#if CONFIG_CHARGING || defined(HAVE_USB_POWER)
|
#if CONFIG_CHARGING || defined(HAVE_USB_POWER)
|
||||||
bat[i].voltage |= last_state = charge_state();
|
bat[i].flags = last_state = charge_state();
|
||||||
#endif
|
#endif
|
||||||
i++;
|
i++;
|
||||||
got_info = true;
|
got_info = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue