From 7a3dccc2d6c19c0336148d08fc75c6048bd1f8db Mon Sep 17 00:00:00 2001 From: cdez Date: Sat, 22 Nov 2025 21:59:05 -0700 Subject: [PATCH] Finish the ready/done logic for the display --- kiln-logger.py | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/kiln-logger.py b/kiln-logger.py index a5dd562..1beb80f 100755 --- a/kiln-logger.py +++ b/kiln-logger.py @@ -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 kiln_state == 'IDLE': + 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)