projects
/
EVA-2020-02-2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #56 from roscoe81/master
[EVA-2020-02-2.git]
/
examples
/
combined.py
diff --git
a/examples/combined.py
b/examples/combined.py
old mode 100644
(file)
new mode 100755
(executable)
index
e863de3
..
c2fd397
--- a/
examples/combined.py
+++ b/
examples/combined.py
@@
-1,4
+1,4
@@
-#!/usr/bin/env python
+#!/usr/bin/env python
3
import time
import colorsys
import time
import colorsys
@@
-19,6
+19,7
@@
from subprocess import PIPE, Popen
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
+from fonts.ttf import RobotoMedium as UserFont
import logging
logging.basicConfig(
import logging
logging.basicConfig(
@@
-37,6
+38,7
@@
bme280 = BME280()
# PMS5003 particulate sensor
pms5003 = PMS5003()
# PMS5003 particulate sensor
pms5003 = PMS5003()
+time.sleep(1.0)
# Create ST7735 LCD display class
st7735 = ST7735.ST7735(
# Create ST7735 LCD display class
st7735 = ST7735.ST7735(
@@
-57,9
+59,10
@@
HEIGHT = st7735.height
# Set up canvas and font
img = Image.new('RGB', (WIDTH, HEIGHT), color=(0, 0, 0))
draw = ImageDraw.Draw(img)
# Set up canvas and font
img = Image.new('RGB', (WIDTH, HEIGHT), color=(0, 0, 0))
draw = ImageDraw.Draw(img)
-path = os.path.dirname(os.path.realpath(__file__))
-font = ImageFont.truetype(path + "/fonts/Asap/Asap-Bold.ttf", 20)
-smallfont = ImageFont.truetype(path + "/fonts/Asap/Asap-Bold.ttf", 10)
+font_size_small = 10
+font_size_large = 20
+font = ImageFont.truetype(UserFont, font_size_large)
+smallfont = ImageFont.truetype(UserFont, font_size_small)
x_offset = 2
y_offset = 2
x_offset = 2
y_offset = 2
@@
-166,7
+169,7
@@
def display_everything():
draw.rectangle((0, 0, WIDTH, HEIGHT), (0, 0, 0))
column_count = 2
row_count = (len(variables)/column_count)
draw.rectangle((0, 0, WIDTH, HEIGHT), (0, 0, 0))
column_count = 2
row_count = (len(variables)/column_count)
- for i in
x
range(len(variables)):
+ for i in range(len(variables)):
variable = variables[i]
data_value = values[variable][-1]
unit = units[i]
variable = variables[i]
data_value = values[variable][-1]
unit = units[i]
@@
-175,7
+178,7
@@
def display_everything():
message = "{}: {:.1f} {}".format(variable[:4], data_value, unit)
lim = limits[i]
rgb = palette[0]
message = "{}: {:.1f} {}".format(variable[:4], data_value, unit)
lim = limits[i]
rgb = palette[0]
- for j in
x
range(len(lim)):
+ for j in range(len(lim)):
if data_value > lim[j]:
rgb = palette[j+1]
draw.text((x, y), message, font=smallfont, fill=rgb)
if data_value > lim[j]:
rgb = palette[j+1]
draw.text((x, y), message, font=smallfont, fill=rgb)
@@
-192,7
+195,7
@@
def get_cpu_temperature():
# Tuning factor for compensation. Decrease this number to adjust the
# temperature down, and increase to adjust up
# Tuning factor for compensation. Decrease this number to adjust the
# temperature down, and increase to adjust up
-factor =
1.9
5
+factor =
2.2
5
cpu_temps = [get_cpu_temperature()] * 5
cpu_temps = [get_cpu_temperature()] * 5