mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
Report battery current on all X1000 native targets
This allows battery run time to be calculated from the actual battery usage on the FiiO M3K and Shanling Q1. This isn't very good for the time being and the estimate tends to go all over the place due to small variations in current or voltage. The Eros Q can support this feature as well, but since it already has fixed estimates defined and the quality of the "real time" estimate is low I am not enabling it there. Change-Id: Id34a93ee4b7d66f9f7e56ef0f5149f67e8e72039
This commit is contained in:
parent
fc678bd001
commit
1a313dc9bf
6 changed files with 33 additions and 3 deletions
|
@ -83,7 +83,7 @@
|
|||
#define STORAGE_NEEDS_BOUNCE_BUFFER
|
||||
|
||||
/* Power management */
|
||||
#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
|
||||
#define CONFIG_BATTERY_MEASURE (VOLTAGE_MEASURE/*|CURRENT_MEASURE*/)
|
||||
#define CONFIG_CHARGING CHARGING_MONITOR
|
||||
#define HAVE_SW_POWEROFF
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
/* TODO: implement HAVE_RTC_ALARM */
|
||||
|
||||
/* Power management */
|
||||
#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
|
||||
#define CONFIG_BATTERY_MEASURE (VOLTAGE_MEASURE|CURRENT_MEASURE)
|
||||
#define CONFIG_CHARGING CHARGING_MONITOR
|
||||
#define HAVE_SW_POWEROFF
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
/* TODO: implement HAVE_RTC_ALARM */
|
||||
|
||||
/* Power management */
|
||||
#define CONFIG_BATTERY_MEASURE (VOLTAGE_MEASURE)
|
||||
#define CONFIG_BATTERY_MEASURE (VOLTAGE_MEASURE|CURRENT_MEASURE)
|
||||
#define CONFIG_CHARGING CHARGING_MONITOR
|
||||
#define HAVE_SW_POWEROFF
|
||||
|
||||
|
|
|
@ -111,3 +111,13 @@ int _battery_voltage(void)
|
|||
{
|
||||
return axp_adc_read(ADC_BATTERY_VOLTAGE);
|
||||
}
|
||||
|
||||
#if CONFIG_BATTERY_MEASURE & CURRENT_MEASURE
|
||||
int _battery_current(void)
|
||||
{
|
||||
if(charging_state())
|
||||
return axp_adc_read(ADC_CHARGE_CURRENT);
|
||||
else
|
||||
return axp_adc_read(ADC_DISCHARGE_CURRENT);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -106,3 +106,13 @@ int _battery_voltage(void)
|
|||
{
|
||||
return axp_adc_read(ADC_BATTERY_VOLTAGE);
|
||||
}
|
||||
|
||||
#if CONFIG_BATTERY_MEASURE & CURRENT_MEASURE
|
||||
int _battery_current(void)
|
||||
{
|
||||
if(charging_state())
|
||||
return axp_adc_read(ADC_CHARGE_CURRENT);
|
||||
else
|
||||
return axp_adc_read(ADC_DISCHARGE_CURRENT);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -121,6 +121,16 @@ int _battery_voltage(void)
|
|||
return axp_adc_read(ADC_BATTERY_VOLTAGE);
|
||||
}
|
||||
|
||||
#if CONFIG_BATTERY_MEASURE & CURRENT_MEASURE
|
||||
int _battery_current(void)
|
||||
{
|
||||
if(charging_state())
|
||||
return axp_adc_read(ADC_CHARGE_CURRENT);
|
||||
else
|
||||
return axp_adc_read(ADC_DISCHARGE_CURRENT);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_CW2015) && (CONFIG_BATTERY_MEASURE & PERCENTAGE_MEASURE) != 0
|
||||
int _battery_level(void)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue