From 4ab2eea9af5338485303d421476fa874e5af6841 Mon Sep 17 00:00:00 2001 From: Christian Kolset Date: Mon, 21 Sep 2026 00:16:15 -0600 Subject: Fix Buffer size setting never being applied; add Safety Switch control type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Buffer size (samples) in Settings > Acquisition was captured into the settings dict but never read anywhere — SignalBuffer always used the hardcoded MAX_BUFFER=20_000 constant (which happens to match the dialog's default, hence it looking like the value "reverts"). Add AcquisitionEngine.set_buffer_size(), wired in on startup and on Settings apply; existing buffers are rebuilt at the new size in place, keeping their most recent samples. - New "Safety Switch" control type: an On/Off Switch that's disabled outright until acquisition is running, with a lock icon shown while disabled. AcquisitionEngine gains a run_state_changed(bool) signal (emitted from start()/stop()); ControlWidget gains a _check_safety_lock() hook (no-op by default, called uniformly by ControlPanel on every widget) that SafetySwitch overrides. engine is now threaded through to every ControlWidget for this. Persists via ControlSpec.control_type alone — no schema change needed. Co-Authored-By: Claude Sonnet 5 --- ui/main_window.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ui/main_window.py') diff --git a/ui/main_window.py b/ui/main_window.py index 6dae1be..07ab0b2 100644 --- a/ui/main_window.py +++ b/ui/main_window.py @@ -827,6 +827,7 @@ class MainWindow(QMainWindow): def _apply_settings_on_startup(self): self._apply_theme(self._settings.get("theme", "dark")) self.engine._interval = self._settings.get("poll_ms", 100) / 1000.0 + self.engine.set_buffer_size(self._settings.get("buffer_size", 20000)) self._apply_developer_mode(self._settings.get("developer_mode", False)) QTimer.singleShot(0, self._apply_dock_state) @@ -862,6 +863,7 @@ class MainWindow(QMainWindow): def _on_settings(self, cfg: dict): self._settings.update(cfg) self.engine._interval = cfg.get("poll_ms", 100) / 1000.0 + self.engine.set_buffer_size(cfg.get("buffer_size", 20000)) self._apply_developer_mode(cfg.get("developer_mode", False)) save_settings(self._settings) -- cgit v1.2.3