Skip to content

Auto-scale website noise panel axis + gauge ranges per-Pi (currently hardcoded to mj02) #69

Description

@pbitzer

Background

The website noise panel + gauges (website/main.py, added in #68) use hardcoded axis/gauge ranges tuned to mj02's noise environment:

  • STANDARD_LAYOUTS["noise_floor_mv"]: [0, 100]
  • STANDARD_LAYOUTS["dc_offset_mv"]: [0, 1000]
  • gauges noisefloor [0,100], dcoffset [0,1000]

Problem (observed on real hardware)

Each unit's fast-channel noise environment differs by ~an order of magnitude, so a single hardcoded range doesn't generalize:

metric mj02 mj03
fast_noise 30–59 mV 13–15 mV
fast_offset 136–900 mV ~24 mV
threshold 83 mV 66 mV

On mj03 the fast_offset plot renders as a near-flat line pinned at the bottom of a [0,1000] axis, and the DC-offset gauge needle barely leaves zero. It's functional (data fits, no clip/crash; the threshold band already auto-reads per-Pi and is correct), but unreadable.

Proposed enhancement

Auto-scale the noise/offset axis ranges and gauge ranges per-Pi from the loaded data at config-load time — the same pattern already used for NOISE_THRESHOLD_MV (read once from the local noise CSV). Sketch:

  • fast_offset axis/gauge → [0, ceil(max × 1.2)] (or [floor(min×0.8), ceil(max×1.2)])
  • fast_noise axis/gauge → [0, ceil(max(noise_max, NOISE_THRESHOLD_MV) × 1.2)] so the threshold band stays visible
  • dtick derived from the chosen range
  • Guarded fallback to the current [0,100]/[0,1000] defaults when no data exists (fresh/quiet sensor)

Self-contained in website/main.py; no sindri change. Makes the panel readable on every unit automatically.

Notes

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions