Erstveröffentlichung Weihnachten 2024
This commit is contained in:
55
pages/bme280.py
Normal file
55
pages/bme280.py
Normal file
@@ -0,0 +1,55 @@
|
||||
"""
|
||||
|
||||
Werte eines lokal angeschlossenen BME280/BMP280
|
||||
|
||||
"""
|
||||
|
||||
import cairo
|
||||
from .page import Page
|
||||
|
||||
class BME280(Page):
|
||||
|
||||
def __init__(self, pageno, cfg, boatdata):
|
||||
super().__init__(pageno, cfg, boatdata)
|
||||
#self.ref1 = self.bd.getRef(boatvalue1)
|
||||
#self.ref2 = self.bd.getRef(boatvalue2)
|
||||
#self.ref3 = self.bd.getRef(boatvalue3)
|
||||
|
||||
def draw(self, ctx):
|
||||
|
||||
# Bildschirmunterteilung mit Linien
|
||||
ctx.rectangle(0, 105, 399, 3)
|
||||
ctx.rectangle(0, 195, 399, 3)
|
||||
ctx.fill()
|
||||
|
||||
# Beschriftung
|
||||
ctx.select_font_face("Ubuntu", cairo.FontSlant.NORMAL, cairo.FontWeight.BOLD)
|
||||
ctx.set_font_size(40)
|
||||
# Titel
|
||||
ctx.move_to(20,55)
|
||||
ctx.show_text("Temp")
|
||||
ctx.move_to(20,145)
|
||||
ctx.show_text("Humid")
|
||||
ctx.move_to(20, 235)
|
||||
ctx.show_text("Press")
|
||||
# Einheit
|
||||
ctx.set_font_size(24)
|
||||
ctx.move_to(20, 90)
|
||||
ctx.show_text("Deg C")
|
||||
ctx.move_to(20, 180)
|
||||
ctx.show_text("%")
|
||||
ctx.move_to(20, 270)
|
||||
ctx.show_text("hPa")
|
||||
|
||||
# Meßwerte
|
||||
ctx.select_font_face("DSEG7 Classic")
|
||||
ctx.set_font_size(60)
|
||||
# Temperatur °C
|
||||
ctx.move_to(180, 90)
|
||||
ctx.show_text("{:.1f}".format(self.bd.temp_air))
|
||||
# Feuchte %
|
||||
ctx.move_to(180, 180)
|
||||
ctx.show_text("{}".format(int(self.bd.humidity)))
|
||||
# Luftdruck hPa
|
||||
ctx.move_to(180, 270)
|
||||
ctx.show_text("{}".format(int(self.bd.pressure)))
|
||||
Reference in New Issue
Block a user