Round temp and cpu values

This commit is contained in:
Mike Cifelli 2021-06-17 17:00:40 -04:00
parent 26eb6ea44b
commit d54a743380
1 changed files with 4 additions and 4 deletions

View File

@ -20,8 +20,8 @@ TEMP_COLOR = RED
CPU_COLOR = BLUE
NETWORK_COLOR = PINK
MIN_TEMP = 40
MAX_TEMP = 80
MIN_TEMP = 45
MAX_TEMP = 85
class SystemStatus:
@ -106,10 +106,10 @@ class SystemStatus:
adjusted = max(0, temp - MIN_TEMP)
percent = min(1, adjusted / (MAX_TEMP - MIN_TEMP))
return int(self.height * percent)
return round(self.height * percent)
def getCpuValue(self):
return int(self.height * (psutil.cpu_percent() / 100))
return round(self.height * (psutil.cpu_percent() / 100))
def getNetworkValue(self):
connections = psutil.net_connections(kind='inet')