Fix the f-string for the CSV bit and some other logic errors

This commit is contained in:
Charles Descamps 2025-11-22 20:21:24 -07:00
parent f484d7b5f9
commit e5c6b9886e

View file

@ -127,7 +127,7 @@ def logger(hostname, csvfile, noprofilestats, pidstats, stdout):
time_rem = msg['totaltime'] - msg['runtime'] time_rem = msg['totaltime'] - msg['runtime']
hours = round(time_rem // 3600) hours = round(time_rem // 3600)
minutes = round((time_rem - (hours * 3600)) // 60) minutes = round((time_rem - (hours * 3600)) // 60)
seconds = round((time_rem - (hours * 3600) - (minutes * 60))) - 1 seconds = round((time_rem - (hours * 3600) - (minutes * 60)))
seg.text = f"{hours:2.0f}-{minutes:2.0f}-{seconds:2.0f}TEMP{temp:4.0f}" seg.text = f"{hours:2.0f}-{minutes:2.0f}-{seconds:2.0f}TEMP{temp:4.0f}"
# END ADD TEMP # END ADD TEMP
@ -137,7 +137,7 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Log kiln data for analysis.') parser = argparse.ArgumentParser(description='Log kiln data for analysis.')
parser.add_argument('--hostname', type=str, default="localhost:8081", help="The kiln-controller hostname:port") parser.add_argument('--hostname', type=str, default="localhost:8081", help="The kiln-controller hostname:port")
# parser.add_argument('--csvfile', type=str, default="/tmp/kilnstats.csv", help="Where to write the kiln stats to") # parser.add_argument('--csvfile', type=str, default="/tmp/kilnstats.csv", help="Where to write the kiln stats to")
parser.add_argument('--csvfile', type=str, default=f"/tmp/kilnstats-{datetime.today().strftime("%Y_%m_%d-%I_%M")}.csv", help="Where to write the kiln stats to") parser.add_argument('--csvfile', type=str, default=f"/tmp/kilnstats-{datetime.today().strftime('%Y_%m_%d-%I_%M')}.csv", help="Where to write the kiln stats to")
parser.add_argument('--pidstats', action='store_true', help="Include PID stats") parser.add_argument('--pidstats', action='store_true', help="Include PID stats")
parser.add_argument('--noprofilestats', action='store_true', help="Do not store profile stats (default is to store them)") parser.add_argument('--noprofilestats', action='store_true', help="Do not store profile stats (default is to store them)")
parser.add_argument('--stdout', action='store_true', help="Also print to stdout") parser.add_argument('--stdout', action='store_true', help="Also print to stdout")