diff options
| author | Christian Kolset <ckolset@colostate.edu> | 2026-07-29 13:42:11 -0600 |
|---|---|---|
| committer | Christian Kolset <ckolset@colostate.edu> | 2026-07-29 13:42:11 -0600 |
| commit | 1d66acf29dd88acce5f3f7c5fee0c305147173a2 (patch) | |
| tree | 3fc88402fbabe9b4266d8318d158f8b76c2c43c7 /devices/serial_device.py | |
| parent | 934d3fc18bc4fc0e05d26a12d635915b00bd8c8d (diff) | |
| parent | bf9c7746ba60613b66ce8d1e9a68c5480f2b93d1 (diff) | |
Merge branch 'feat/mark10-unit-autodetect'
Diffstat (limited to 'devices/serial_device.py')
| -rw-r--r-- | devices/serial_device.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/devices/serial_device.py b/devices/serial_device.py index 580421c..449956b 100644 --- a/devices/serial_device.py +++ b/devices/serial_device.py @@ -142,6 +142,14 @@ class SerialDevice(BaseDevice): raw = self._layer.read() if not raw: return {} + if self._fmt == "mark10" and hasattr(self._layer, "current_unit"): + # Gauge can be switched between lb/kgF/N/ozF on the device itself — + # keep the channel's unit in sync so new plots/pickers/CSV log + # headers pick up the currently-selected unit instead of a fixed + # default. Does not relabel the axis of an already-open plot pane. + force_ch = self.get_channel("force") + if force_ch is not None: + force_ch.unit = self._layer.current_unit if self._fmt not in _GENERIC_FORMATS: # Protocol layers already key by channel_id — pass through untouched. # (Write-only channels, e.g. CML "M1_VS", never appear in raw — correctly dropped.) |
