Finish the ready/done logic for the display

This commit is contained in:
Charles Descamps 2025-11-22 21:59:05 -07:00
parent 15742b07ca
commit 7a3dccc2d6

View file

@ -93,15 +93,9 @@ def logger(hostname, csvfile, noprofilestats, pidstats, stdout):
continue
# get the current state, if the state changes from RUNNING to IDLE
if msg.get('state') == 'RUNNING':
if kiln_state == 'IDLE':
kiln_state = 'RUNNING'
prev_kiln_state = 'IDLE'
if msg.get('state') == 'IDLE':
if kiln_state == 'RUNNING':
kiln_state = 'IDLE'
prev_kiln_state = 'RUNNING'
if kiln_state != msg['state']:
prev_kiln_state = kiln_state
kiln_state = msg['state']
if not noprofilestats:
msg['stamp'] = time.time()
@ -140,12 +134,11 @@ def logger(hostname, csvfile, noprofilestats, pidstats, stdout):
temp = round(msg['temperature'])
# time remaining for the display, calculated for rounded seconds
time_rem = msg['totaltime'] - msg['runtime']
if time_rem == -1:
if kiln_state == 'IDLE':
if prev_kiln_state == 'RUNNING':
seg.text = f"DONE....TEMP{temp:4.0f}"
else:
if prev_kiln_state == 'IDLE':
seg.text = f"READY....TEMP{temp:4.0f}"
else:
seg.text = f"DONE.....TEMP{temp:4.0f}"
else:
hours = round(time_rem // 3600)
minutes = round((time_rem - (hours * 3600)) // 60)