.
This commit is contained in:
parent
ff33e21257
commit
f557200bb0
@ -10,7 +10,7 @@ width = DisplayHATMini.WIDTH
|
||||
height = DisplayHATMini.HEIGHT
|
||||
buffer = Image.new("RGB", (width, height))
|
||||
displayhatmini = DisplayHATMini(buffer)
|
||||
displayhatmini.set_led(0.05, 0.05, 0.05)
|
||||
displayhatmini.set_led(0.0, 0.5, 0.0)
|
||||
draw = ImageDraw.Draw(buffer)
|
||||
fnt50 = ImageFont.truetype("/usr/share/fonts/truetype/freefont/FreeSans.ttf", 50, encoding="unic")
|
||||
fnt25 = ImageFont.truetype("/usr/share/fonts/truetype/freefont/FreeSans.ttf", 25, encoding="unic")
|
||||
@ -40,14 +40,17 @@ class OvenDisplay(threading.Thread):
|
||||
|
||||
# {'cost': 0, 'runtime': 0, 'temperature': 23.176953125, 'target': 0, 'state': 'IDLE', 'heat': 0, 'totaltime': 0, 'kwh_rate': 0.33631, 'currency_type': '£', 'profile': None, 'pidstats': {}}
|
||||
# {'cost': 0.003923616666666667, 'runtime': 0.003829, 'temperature': 23.24140625, 'target': 100.00079770833334, 'state': 'RUNNING', 'heat': 1.0, 'totaltime': 3600, 'kwh_rate': 0.33631, 'currency_type': '£', 'profile': 'test-200-250', 'pidstats': {'time': 1686902305.0, 'timeDelta': 5.027144, 'setpoint': 100.00079770833334, 'ispoint': 23.253125, 'err': 76.74767270833334, 'errDelta': 0, 'p': 1918.6918177083335, 'i': 0, 'd': 0, 'kp': 25, 'ki': 10, 'kd': 200, 'pid': 0, 'out': 1}}
|
||||
def update_display(self, oven_state):
|
||||
def update_display(self, oven_state_json):
|
||||
draw.rectangle((0, 0, width, height), (0, 0, 0))
|
||||
log.info(oven_state)
|
||||
state = json.loads(oven_state)
|
||||
log.info(oven_state_json)
|
||||
state = json.loads(oven_state_json)
|
||||
log.info(state)
|
||||
self.text("{0:2.1f}".format(state['temperature']), (25, 25), fnt50, (255, 255, 255))
|
||||
self.text("{0:2.1f}".format(state['target']), (25, 75), fnt25, (255, 255, 255))
|
||||
self.text(state['profile'], (25, 100), fnt25, (255, 255, 255))
|
||||
self.text("{0:2.1f}".format(state['temperature'])+'ºC', (25, 25), fnt50, (255, 255, 255))
|
||||
self.text("{0:2.1f}".format(state['target'])+'ºC', (25, 75), fnt25, (255, 255, 255))
|
||||
if (state['profile'] is not None):
|
||||
self.text(state['profile'], (25, 100), fnt25, (255, 255, 255))
|
||||
else:
|
||||
self.text("<NONE>", (25, 150), fnt25, (255, 255, 255))
|
||||
displayhatmini.display()
|
||||
if (state['state'] == 'IDLE'):
|
||||
displayhatmini.set_led(0.0, 0.5, 0.0)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user