Fix issue 442: do not overflow when processing buggy battery input
git-svn-id: http://tint2.googlecode.com/svn/trunk@682 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
parent
f0e2e72efc
commit
1272ce4bb9
1 changed files with 1 additions and 1 deletions
|
@ -387,7 +387,7 @@ void update_battery() {
|
|||
battery_state.time.seconds = seconds;
|
||||
|
||||
if(energy_full > 0)
|
||||
new_percentage = (energy_now*100)/energy_full;
|
||||
new_percentage = ((energy_now <= energy_full ? energy_now : energy_full) * 100) / energy_full;
|
||||
|
||||
if(battery_low_status > new_percentage && battery_state.state == BATTERY_DISCHARGING && !battery_low_cmd_send) {
|
||||
tint_exec(battery_low_cmd);
|
||||
|
|
Loading…
Reference in a new issue