1
0
Fork 0

widgets: battery: Fix a redraw bug

Currently if the real battery level is <5% then a redraw from scratch will
not draw the outline of the battery. Fix this by adding a special case for
negative previous states (-1 charging, -2 redraw).

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
pull/90/head
Daniel Thompson 2020-10-21 21:09:43 +01:00
parent 6cd1e86295
commit 9f3c75d512
1 changed files with 1 additions and 1 deletions

View File

@ -56,7 +56,7 @@ class BatteryMeter:
red = 31-green
rgb = (red << 11) + (green << 6)
if (level > 5) ^ (self.level > 5):
if self.level < 0 or ((level > 5) ^ (self.level > 5)):
if level > 5:
draw.rleblit(icon, pos=(239-icon[0], 0), fg=0x7bef)
else: