mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 10:07:38 -04:00
simulator: Fix battery level for targets with PERCENTAGE_MEASURE
Previous code returned 0 in targets using only `PERCENTAGE_MEASURE` which means the simulator closed itself (due to low battery) shortly after boot. Change-Id: I8b66dd085e02a8e565893aad4c8b643233dd3852
This commit is contained in:
parent
20de670340
commit
8e7fa2932e
1 changed files with 1 additions and 1 deletions
|
@ -96,7 +96,7 @@ static void battery_status_update(void)
|
|||
}
|
||||
}
|
||||
|
||||
batt_percent = (batt_millivolts - BATT_MINMVOLT) / (BATT_MAXMVOLT - BATT_MINMVOLT);
|
||||
batt_percent = ((float) (batt_millivolts - BATT_MINMVOLT) / (BATT_MAXMVOLT - BATT_MINMVOLT)) * 100;
|
||||
batt_runtime = batt_percent * BATT_MAXRUNTIME;
|
||||
/* current is completely bogus... */
|
||||
batt_current = charging ? BATT_CHARGE_STEP : BATT_DISCHARGE_STEP;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue