permit battery already expressed in percent (#23738)

* permit battery already expressed in percent

* commit fixed

* cosmetic fix
This commit is contained in:
Fabrizio Amodio 2025-08-01 17:03:00 +02:00 committed by GitHub
parent 9b01d28381
commit 4e92f66f88
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -98,6 +98,13 @@ class lwdecode_cls
batt_percent /= 7 # 1..14px showing battery load
msg += format("<td><i class=\"bt\" title=\"%.3fV (%s)\" style=\"--bl:%dpx;color:%s\"></i></td>",
battery, self.dhm(battery_last_seen), batt_percent, color_text)
elif battery >= 100000 && battery <= 100100 # battery already expressed in %
var pbatt = battery - 100000
var batt_percent = pbatt
if batt_percent > 98 batt_percent = 98 end # 98% / 14px = 7
batt_percent /= 7 # 1..14px showing battery load
msg += format("<td><i class=\"bt\" title=\"%d%% (%s)\" style=\"--bl:%dpx;color:%s\"></i></td>",
pbatt, self.dhm(battery_last_seen), batt_percent, color_text)
else
msg += "<td>&nbsp;</td>"
end