gcode预览测试
This commit is contained in:
@@ -5,6 +5,7 @@ from PyQt6.QtCore import QTimer
|
||||
class AutoFanStatus:
|
||||
def __init__(self, update_interval_ms=1000):
|
||||
self.cpu_temp = 0.0
|
||||
self.cpu_load = 0.0 # 1 分钟 CPU 负载
|
||||
self.fan_speed = 0
|
||||
self.fan_state = "Unknown"
|
||||
self.fan_rpm = 0
|
||||
@@ -37,4 +38,12 @@ class AutoFanStatus:
|
||||
self.fan_speed = 0
|
||||
self.fan_state = "Unknown"
|
||||
self.fan_rpm = 0
|
||||
self.is_auto_fan_service_running = False
|
||||
self.is_auto_fan_service_running = False
|
||||
|
||||
# 读取 CPU 负载(始终执行)
|
||||
try:
|
||||
with open("/proc/loadavg", "r") as f:
|
||||
fields = f.read().split()
|
||||
self.cpu_load = float(fields[0]) # 1 分钟平均负载
|
||||
except (OSError, IndexError, ValueError):
|
||||
self.cpu_load = 0.0
|
||||
Reference in New Issue
Block a user