- readings.py: PowerReadings.total now sums the known parts (None only when nothing is known), with a complete property saying whether it under-counts; the snapshot exposes it as partial and the web UI marks it with a tilde. - display/service.py: telemetry older than 15 s is drawn as -- instead of re-rendering frozen readings as if they were current. - sensors.py: Commander PRO last-known RPMs expire after 10 s instead of feeding the power model forever (empty list = unknown); a runtime MSR failure backs off 15 s instead of re-opening PawnIO every second; GPU NVML reconnects back off 10 s instead of nvmlInit() every second, and the sample-buffer timestamp resets on a driver-reset reconnect. - control.py: CpuTemperature read failures back off 15 s instead of churning the MSR handle every poll.
33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
"""Sensor readings shared by the LCD, lighting, cooling and the web UI."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass, field
|
|
|
|
|
|
@dataclass
|
|
class Readings:
|
|
temp: float | None = None # deg C
|
|
load: float | None = None # percent
|
|
clock: float | None = None # MHz
|
|
power: float | None = None # W
|
|
|
|
|
|
@dataclass
|
|
class PowerReadings:
|
|
cpu: float | None = None # W, CPU package (measured)
|
|
gpu: float | None = None # W, graphics card board power (measured)
|
|
other: float | None = None # W, rest of the PC (partly measured, partly estimated)
|
|
parts: dict[str, float] = field(default_factory=dict) # what makes up `other`
|
|
|
|
@property
|
|
def total(self) -> float | None:
|
|
"""The known parts summed; None only when nothing is known. While a part is missing
|
|
the total under-counts -- `complete` says so."""
|
|
known = [v for v in (self.cpu, self.gpu, self.other) if v is not None]
|
|
return sum(known) if known else None
|
|
|
|
@property
|
|
def complete(self) -> bool:
|
|
return self.cpu is not None and self.gpu is not None and self.other is not None
|