gcode预览测试

This commit is contained in:
2026-05-14 20:21:16 +08:00
parent 65f221a5d8
commit 837996c436
17 changed files with 1363 additions and 296 deletions

View File

@@ -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