mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-19 18:16:34 +01:00
Merge branch 'master' of github.com:EEKIM10/the-hi5-group
This commit is contained in:
commit
4b07f2d9db
2 changed files with 4 additions and 18 deletions
|
@ -431,7 +431,7 @@ class Events(commands.Cog):
|
||||||
"check": (assets / "smeg").exists
|
"check": (assets / "smeg").exists
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
r"(what|huh)(\?|!)*": {
|
r"(what|huh)(\?|!)*$": {
|
||||||
"func": send_what,
|
"func": send_what,
|
||||||
"meta": {
|
"meta": {
|
||||||
"check": lambda: message.reference is not None
|
"check": lambda: message.reference is not None
|
||||||
|
|
20
cogs/info.py
20
cogs/info.py
|
@ -11,13 +11,6 @@ import psutil
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
try:
|
|
||||||
import fanshim
|
|
||||||
import apa102
|
|
||||||
import RPi.GPIO as GPIO
|
|
||||||
except ImportError as e:
|
|
||||||
# print("Raspberry Pi libraries not found.", e, file=sys.stderr)
|
|
||||||
fanshim = GPIO = apa102 = None
|
|
||||||
|
|
||||||
|
|
||||||
class InfoCog(commands.Cog):
|
class InfoCog(commands.Cog):
|
||||||
|
@ -145,16 +138,9 @@ class InfoCog(commands.Cog):
|
||||||
value="\n".join(f"{s.label}: {s.current:.2f} RPM" for s in fans),
|
value="\n".join(f"{s.label}: {s.current:.2f} RPM" for s in fans),
|
||||||
inline=True,
|
inline=True,
|
||||||
)
|
)
|
||||||
if fanshim:
|
if Path("/tmp/fanstate").exists():
|
||||||
# PiMoroni's fanshim by default uses pin 18 for control
|
with open("/tmp/fanstate", "r") as f:
|
||||||
GPIO.setmode(GPIO.BCM)
|
fan_active = f.read().strip() == "1"
|
||||||
GPIO.setup(18, GPIO.IN)
|
|
||||||
fan_active = bool(GPIO.input(18))
|
|
||||||
# LED = apa102.APA102(1, 15, 14, None)
|
|
||||||
# Get LED colour as a tuple of (r, g, b)
|
|
||||||
# LED_colour = LED.get_pixel_colour(0)
|
|
||||||
# Convert to hex
|
|
||||||
# LED_colour = "%02x%02x%02x" % LED_colour
|
|
||||||
LED_colour = "unknown"
|
LED_colour = "unknown"
|
||||||
fan_state = f"{self.EMOJIS['OFF']} Inactive"
|
fan_state = f"{self.EMOJIS['OFF']} Inactive"
|
||||||
if fan_active:
|
if fan_active:
|
||||||
|
|
Loading…
Reference in a new issue