Stop presenting stale data as live, and back off broken devices

- 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.
This commit is contained in:
paul committed 2026-12-05 16:54:01 +13:00
1 parent 538a464257
commit 9036c6e734
6 files changed
+46 -7

No files matched your search

+5
View File
@@ -20,6 +20,9 @@ log = logging.getLogger(__name__)
class DisplayService:
# Telemetry older than this is drawn as "--" rather than presented as a live reading.
STALE_AFTER = 15.0
def __init__(self, renderer: DashboardRenderer, telemetry: Telemetry, brightness: int = 100):
self.renderer = renderer
self.telemetry = telemetry
@@ -54,6 +57,8 @@ class DisplayService:
sample = self.telemetry.wait_newer(seq, timeout=1.5)
if stop.is_set():
break
if sample is not None and time.time() - sample.t > self.STALE_AFTER:
sample = None # frozen readings must not be presented as current
seq = sample.seq if sample is not None else seq
t0 = time.monotonic()
if lcd.send_jpeg(encode_jpeg(self.render(sample))):