From 705259f0e80138200537b877d02cd57c99473e77 Mon Sep 17 00:00:00 2001 From: wildercayden Date: Thu, 26 Jun 2025 10:02:35 -0400 Subject: [PATCH] Made it so the config file works on the TableLaptop.py file --- TableLaptop.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/TableLaptop.py b/TableLaptop.py index bb6ba6e..0cf597a 100644 --- a/TableLaptop.py +++ b/TableLaptop.py @@ -1,15 +1,21 @@ from networktables import NetworkTables from time import sleep +import configparser NetworkTables.initialize() NetworkTables.startServer() -table = NetworkTables.getTable("PiStatus") +config = configparser.ConfigParser() +config.read('config.ini') + +table = config.get('settings', 'tables') + +table = NetworkTables.getTable(table) print("Server started, waiting for data...") while True: cpu = table.getNumber("CPU Usage", -1) temp = table.getNumber("Temperature", -1) mem = table.getNumber("Memory", -1) - print(f"CPU: {cpu}, Temp: {temp} Mem:{mem}") + print(f"CPU: {cpu}%, Temp: {temp}C Mem:{mem} MB") sleep(1)