mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 13:12:37 -05:00
erosqnative: hw4 units prefer egauge battery percentage
Use AXP2101's egauge battery percent level if available (hw4 units). If not available (_battery_level() will return -1 on hw1-hw3 units), fall back to voltage battery level. Also fix logic in axp2101_battery_status() Change-Id: Ic300418532dae6f7772fff8bf5e2b32516f3b973
This commit is contained in:
parent
f566f63b63
commit
96463d855f
6 changed files with 43 additions and 8 deletions
|
|
@ -212,6 +212,21 @@ bool charging_state(void)
|
|||
}
|
||||
}
|
||||
|
||||
int _battery_level(void)
|
||||
{
|
||||
int devicever;
|
||||
#if defined(BOOTLOADER)
|
||||
devicever = EROSQN_VER;
|
||||
#else
|
||||
devicever = device_data.hw_rev;
|
||||
#endif
|
||||
if (devicever >= 4){
|
||||
return axp2101_egauge_read();
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int _battery_voltage(void)
|
||||
{
|
||||
int devicever;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue