summaryrefslogtreecommitdiff
path: root/api_layers/protocols/mark10.py
diff options
context:
space:
mode:
authorChristian Kolset <ckolset@colostate.edu>2026-07-29 13:12:17 -0600
committerChristian Kolset <ckolset@colostate.edu>2026-07-29 13:12:17 -0600
commitbf9c7746ba60613b66ce8d1e9a68c5480f2b93d1 (patch)
tree21c49fa5d5c51e8935c98e7bf240b9e469287ff0 /api_layers/protocols/mark10.py
parentb407a079000f6a4b04ecf38eca17c57719e7a7ec (diff)
Sync Mark-10 gauge's live unit into ChannelConfig instead of a fixed default
Mark10Layer._parse() already tracked whichever unit suffix the gauge last reported (lb/kgF/N/ozF — the gauge's physical unit button cycles these independently of this app). serial_device.py hardcoded the "force" channel's unit to "N" and never updated it, so switching units on the gauge itself was invisible here. Adds Mark10Layer.current_unit and has SerialDevice.read_channels() keep the "force" ChannelConfig's unit in sync with it on every poll. This fixes the unit shown in anything that reads ChannelConfig.unit live — new plots, channel pickers, CSV log headers — but does not relabel the Y-axis of an already-open plot pane, since plot axis labels are baked into PlotConfig.y_label once at plot-build time, not re-read from the channel live. Making an open pane's axis relabel itself would need new signal plumbing from the device through AcquisitionEngine to the strip chart — a bigger, separate change. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Diffstat (limited to 'api_layers/protocols/mark10.py')
-rw-r--r--api_layers/protocols/mark10.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/api_layers/protocols/mark10.py b/api_layers/protocols/mark10.py
index a209232..48ed927 100644
--- a/api_layers/protocols/mark10.py
+++ b/api_layers/protocols/mark10.py
@@ -44,6 +44,11 @@ class Mark10Layer(BaseProtocol):
super().__init__(port, baud, poll_interval, simulate)
self._unit = "N"
+ @property
+ def current_unit(self) -> str:
+ """Last unit suffix seen in a gauge reply (e.g. "N", "kgF")."""
+ return self._unit
+
# ── Protocol ──────────────────────────────────────────────────────────
def _poll(self) -> Dict[str, float]: