Minor .py changes for latest Raspbian and PIL
This commit is contained in:
parent
5d0f9983be
commit
5da6bd1f40
4 changed files with 17 additions and 8 deletions
4
accel.py
4
accel.py
|
|
@ -61,6 +61,10 @@ class AccelSand(SpectroBase):
|
|||
while True:
|
||||
try:
|
||||
acceleration = accelerometer.acceleration
|
||||
# If using a non-default orientation for the accelerometer,
|
||||
# you can swap or invert axes as needed here:
|
||||
# acceleration = (-acceleration[2], acceleration[1],
|
||||
# acceleration[0])
|
||||
except OSError:
|
||||
# Keep last value
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -48,8 +48,12 @@ class CPULoad(SpectroBase):
|
|||
# Poll CPU load and temperature
|
||||
cpu_load = psutil.cpu_percent(percpu=False)
|
||||
temps = psutil.sensors_temperatures(fahrenheit=IMPERIAL)
|
||||
thermal = temps.get("cpu-thermal")
|
||||
temperature = thermal[0].current
|
||||
try:
|
||||
thermal = temps.get("cpu_thermal") # New hotness
|
||||
temperature = thermal[0].current
|
||||
except TypeError:
|
||||
thermal = temps.get("cpu-thermal") # Oldschool
|
||||
temperature = thermal[0].current
|
||||
|
||||
# Format load and temperature
|
||||
load_string = load_format.format(cpu_load)
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
Framebuffer-to-matrix mirror program for Adafruit Spectro.
|
||||
Based on notro's framebuffer insights.
|
||||
https://github.com/notro/fbtft_test
|
||||
PRO TIP: for best performance, set up framebuffer for
|
||||
a small size (e.g. 320x240) in /boot/config.txt:
|
||||
PRO TIP: for best performance (and to reduce flicker), set up
|
||||
framebuffer for a small size (e.g. 320x240) in /boot/config.txt:
|
||||
|
||||
hdmi_force_hotplug=1
|
||||
hdmi_group=2
|
||||
|
|
|
|||
|
|
@ -65,11 +65,12 @@ class GIFplayer(SpectroBase):
|
|||
for frame in ImageSequence.Iterator(image):
|
||||
# Save frame duration, gets lost in the convert/resize
|
||||
next_duration = frame.info.get('duration', 100) / 1000.0
|
||||
# Frame must be RGB mode for SetImage()
|
||||
frame = frame.convert('RGB')
|
||||
if resize:
|
||||
# Frame must be converted to RGB and resized each time,
|
||||
# can't just do that operation once on the input image,
|
||||
# as the RGB conversion makes it lose its "GIF-ness."
|
||||
frame = frame.convert('RGB')
|
||||
# Frame must be resized each time, can't just do
|
||||
# that operation once on the input image, as the
|
||||
# RGB conversion makes it lose its "GIF-ness."
|
||||
frame = frame.resize(scaled_size, resample=FILTER)
|
||||
if back_image:
|
||||
back_image.paste(frame, position)
|
||||
|
|
|
|||
Loading…
Reference in a new issue