Attempt two at improving the kiln state logic

This commit is contained in:
Charles Descamps 2025-11-22 21:14:52 -07:00
parent 15daabd98f
commit 15742b07ca

View file

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