Linting battery.py
@@ -11,8 +11,8 @@ buf = bytearray(display.get_width() * display.get_height() * 2)
display.init(buf)
display.set_backlight(0.8) # comment out this line if you have a Pico Explorer as it doesn't have a controllable backlight
-vsys = machine.ADC(29) # reads the system input voltage
-charging = machine.Pin(24, Pin.IN) # reading GP24 tells us whether or not USB power is connected
+vsys = ADC(29) # reads the system input voltage
+charging = Pin(24, Pin.IN) # reading GP24 tells us whether or not USB power is connected
conversion_factor = 3 * 3.3 / 65535
full_battery = 4.2 # these are our reference voltages for a full/empty battery, in volts
@@ -21,7 +21,8 @@ empty_battery = 2.8 # the values could vary by battery size/manu
while True:
voltage = vsys.read_u16() * conversion_factor
percentage = 100 * ((voltage - empty_battery) / (full_battery - empty_battery))
- if percentage > 100: percentage = 100.00
+ if percentage > 100:
+ percentage = 100.00
# draws the battery
display.set_pen(0, 0, 0)
