From 9f3c75d5129390ba81d924fe65a9f1d4eb6f3727 Mon Sep 17 00:00:00 2001 From: Daniel Thompson Date: Wed, 21 Oct 2020 21:09:43 +0100 Subject: [PATCH] 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 --- wasp/widgets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wasp/widgets.py b/wasp/widgets.py index 2e56d4d..58392af 100644 --- a/wasp/widgets.py +++ b/wasp/widgets.py @@ -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: