Gauge redline zones + C/F units toggle + cleaner dials
Gauges: - Optional per-metric warning zones (warn_hi/redline_hi/warn_lo/redline_lo) in the profile schema; gauges draw colored redline/warn bands and color the needle + readout by zone. Default neutral when unset (no false redline). - Removed the value progress-arc fill (it dominated the dial / looked wrong) -> clean tach face: bezel, ticks, numeric scale, needle, redline band, readout. - Auto-derivation rejected: bad direction/threshold vary per metric, so zones are config (with a sensible neutral default). Units: - New Units menu: Temperature C / F. Converts gauges, graph, table, and PID browser (values, scale, zones, unit labels) at display time; data stays C. Ford 6.0 profile: zones for ICP (red<500), FICM (red<40/amber40-48/green48+), ECT/EOT (high redline), RPM (redline 3800), boost, battery; tightened FICM (38-52) and battery (9-15) ranges so redline bands land sensibly. Docs: profiles/PROFILE_SPEC.md -- canonical, AI-agent-ready profile spec (schema, formula language, zones, confidence, rules); README points to it. Validated headless: zones parse/classify, F conversion (112C->233.6F, zones converted), gauges render; obdcore + diagnostics tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016yT89n4zR4qbrySoSiEyZs
This commit is contained in:
@@ -26,6 +26,26 @@ class Pid:
|
||||
round: int = None # display rounding (None=raw float, 0=int)
|
||||
deps: Tuple[str, ...] = ()
|
||||
notes: str = ""
|
||||
# optional gauge warning zones (all None = neutral, no redline drawn).
|
||||
# high-side: value >= threshold -> warn/redline. low-side: value <= -> warn/redline.
|
||||
warn_hi: float = None
|
||||
redline_hi: float = None
|
||||
warn_lo: float = None
|
||||
redline_lo: float = None
|
||||
|
||||
def zone(self, v):
|
||||
"""Classify a value as 'crit' (red), 'warn' (amber), or 'ok' (green)."""
|
||||
if v is None:
|
||||
return "ok"
|
||||
if self.redline_hi is not None and v >= self.redline_hi:
|
||||
return "crit"
|
||||
if self.redline_lo is not None and v <= self.redline_lo:
|
||||
return "crit"
|
||||
if self.warn_hi is not None and v >= self.warn_hi:
|
||||
return "warn"
|
||||
if self.warn_lo is not None and v <= self.warn_lo:
|
||||
return "warn"
|
||||
return "ok"
|
||||
|
||||
|
||||
@dataclass
|
||||
|
||||
Reference in New Issue
Block a user