로그 송수신 잔여 제거와 패널 주기 조정
This commit is contained in:
1 parent
c0dadcc8a9
commit
3f3198b29f
5 files changed
+67
-77
No files matched your search
+19
-13
@@ -104,14 +104,16 @@ case "$enable" in ''|*[!0-9]*) enable=-1 ;; esac
|
||||
awk -v cpu="$cpu" -v fan="$fan" -v pwm="$pwm" -v enable="$enable" -v guard="$guard" 'BEGIN {printf "SYNO_CPU=%.1f\nSYNO_FAN=%d\nSYNO_GUARD=%s\nSYNO_PWM=%d\nSYNO_PWM_ENABLE=%d\n", cpu / 1000, fan, guard, pwm, enable}'
|
||||
"""
|
||||
SAMPLE_INTERVAL_MS = 50
|
||||
DASHBOARD_INTERVAL_MS = 500
|
||||
FAN_INTERVAL_MS = 500
|
||||
GRAPH_SECONDS = 10
|
||||
GRAPH_POINTS = GRAPH_SECONDS * 1000 // SAMPLE_INTERVAL_MS
|
||||
GRAPH_POINTS = GRAPH_SECONDS * 1000 // DASHBOARD_INTERVAL_MS
|
||||
SYNOLOGY_RESTART_INTERVAL_MS = 1000
|
||||
TEMP_INTERVAL_MS = 1000
|
||||
TEMP_INTERVAL_MS = 500
|
||||
DISK_TEMP_INTERVAL_MS = TEMP_INTERVAL_MS
|
||||
RPI_THROTTLE_INTERVAL_MS = SAMPLE_INTERVAL_MS
|
||||
SYNOLOGY_DISK_TEMP_INTERVAL_MS = TEMP_INTERVAL_MS
|
||||
SYNOLOGY_HEALTH_INTERVAL_MS = TEMP_INTERVAL_MS
|
||||
SYNOLOGY_HEALTH_INTERVAL_MS = FAN_INTERVAL_MS
|
||||
|
||||
|
||||
def byte_rate_unit(values):
|
||||
@@ -624,7 +626,11 @@ class TouchPanel(QMainWindow):
|
||||
|
||||
self.dashboard_timer = QTimer(self)
|
||||
self.dashboard_timer.timeout.connect(self.update_dashboard)
|
||||
self.dashboard_timer.start(SAMPLE_INTERVAL_MS)
|
||||
self.dashboard_timer.start(DASHBOARD_INTERVAL_MS)
|
||||
|
||||
self.fan_timer = QTimer(self)
|
||||
self.fan_timer.timeout.connect(self.update_fan_status)
|
||||
self.fan_timer.start(FAN_INTERVAL_MS)
|
||||
|
||||
self.pc_ping = QProcess(self)
|
||||
self.pc_ping.finished.connect(self.pc_ping_finished)
|
||||
@@ -676,6 +682,7 @@ class TouchPanel(QMainWindow):
|
||||
self.pulse_timer.timeout.connect(self.tick_pulses)
|
||||
self.pulse_timer.start(25)
|
||||
self.sample()
|
||||
self.update_fan_status()
|
||||
self.ping_pc()
|
||||
self.update_disk_temp()
|
||||
self.update_synology_status()
|
||||
@@ -803,11 +810,6 @@ class TouchPanel(QMainWindow):
|
||||
dt = max(0.001, now - self.last_sample) if self.last_sample else 0.001
|
||||
self.last_sample = now
|
||||
|
||||
rpm = read_int(self.fan["rpm"])
|
||||
pwm = read_int(self.fan["pwm"])
|
||||
enable = read_int(self.fan["enable"], 2)
|
||||
percent = pwm / 255 * 100 if pwm > 0 else 0
|
||||
|
||||
reads, writes, disk_error = disk_io()
|
||||
io_read_activity = self.last_io is not None and reads != self.last_io[0]
|
||||
io_write_activity = self.last_io is not None and writes != self.last_io[1]
|
||||
@@ -843,9 +845,9 @@ class TouchPanel(QMainWindow):
|
||||
self.last_net[key] = current
|
||||
|
||||
self.current_rates = rates
|
||||
self.render_status(rpm, pwm, percent, enable, groups, rates, activity, io_read_activity, io_write_activity, disk_error)
|
||||
self.render_status(groups, rates, activity, io_read_activity, io_write_activity, disk_error)
|
||||
|
||||
def render_status(self, rpm, pwm, percent, enable, groups, rates, activity, io_read_activity, io_write_activity, disk_error):
|
||||
def render_status(self, groups, rates, activity, io_read_activity, io_write_activity, disk_error):
|
||||
disk_temp_text = f"{self.disk_temp:.1f} C" if self.disk_temp is not None else "- C"
|
||||
self.rows["io"].set_state(disk_temp_text, disk_error, io_read_activity, io_write_activity)
|
||||
self.rows["local"].set_state(self.iface_detail(groups["local"], "lo"), activity["local"]["error"], activity["local"]["read"], activity["local"]["write"])
|
||||
@@ -853,12 +855,16 @@ class TouchPanel(QMainWindow):
|
||||
self.rows["lan"].set_state(self.iface_detail(groups["lan"], "eth1"), activity["lan"]["error"], activity["lan"]["read"], activity["lan"]["write"])
|
||||
self.rows["wifi24"].set_state(self.iface_detail(groups["wifi24"], "wlan0"), activity["wifi24"]["error"], activity["wifi24"]["read"], activity["wifi24"]["write"])
|
||||
self.rows["wifi5"].set_state(self.iface_detail(groups["wifi5"], "wlan1"), activity["wifi5"]["error"], activity["wifi5"]["read"], activity["wifi5"]["write"])
|
||||
|
||||
def update_fan_status(self):
|
||||
rpm = read_int(self.fan["rpm"])
|
||||
pwm = read_int(self.fan["pwm"])
|
||||
percent = pwm / 255 * 100 if pwm > 0 else 0
|
||||
self.render_rpi_fan(rpm)
|
||||
|
||||
self.latest_rpm = rpm
|
||||
self.latest_pwm = pwm
|
||||
self.latest_percent = percent
|
||||
del enable
|
||||
|
||||
def update_dashboard(self):
|
||||
rpm = getattr(self, "latest_rpm", read_int(self.fan["rpm"]))
|
||||
@@ -892,7 +898,7 @@ class TouchPanel(QMainWindow):
|
||||
if self.synology_ping_proc.state() != QProcess.NotRunning:
|
||||
return
|
||||
self.synology_ping_buffer = ""
|
||||
self.synology_ping_proc.start("/usr/bin/ping", ["-n", "-i", "0.05", SYNOLOGY_PING_HOST])
|
||||
self.synology_ping_proc.start("/usr/bin/ping", ["-n", "-i", "0.5", SYNOLOGY_PING_HOST])
|
||||
|
||||
def synology_ping_ready(self):
|
||||
output = bytes(self.synology_ping_proc.readAllStandardOutput()).decode("utf-8", "ignore")
|
||||
|
||||
Reference in new issue
Block a user