Skip to content

Commit

Permalink
fix: using better symbols for ups charging status
Browse files Browse the repository at this point in the history
  • Loading branch information
evilsocket committed Apr 18, 2021
1 parent 297d9cd commit 1318275
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions pwnagotchi/plugins/default/ups_lite.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
import logging
import struct

import RPi.GPIO as GPIO

import pwnagotchi
import pwnagotchi.plugins as plugins
import pwnagotchi.ui.fonts as fonts
from pwnagotchi.ui.components import LabeledValue
from pwnagotchi.ui.view import BLACK
import pwnagotchi.ui.fonts as fonts
import pwnagotchi.plugins as plugins
import pwnagotchi
import RPi.GPIO as GPIO


# TODO: add enable switch in config.yml an cleanup all to the best place
Expand Down Expand Up @@ -50,12 +51,9 @@ def charging(self):
try:
GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.IN)
if (GPIO.input(4) == GPIO.HIGH):
return '⚡'
if (GPIO.input(4) == GPIO.LOW):
return '%'
return '+' if GPIO.input(4) == GPIO.HIGH else '-'
except:
return '%'
return '-'


class UPSLite(plugins.Plugin):
Expand Down

0 comments on commit 1318275

Please sign in to comment.