summaryrefslogtreecommitdiff
path: root/ui/control_panel.py
AgeCommit message (Collapse)Author
2026-09-21Fix Buffer size setting never being applied; add Safety Switch control typeChristian Kolset
- 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 <noreply@anthropic.com>
2026-09-20Fix Signal name reset and orphaned references on device reconfigureChristian Kolset
Apply & Reconnect rebuilt a device's whole Signal list from hardware defaults on every call, silently discarding user/profile-set names, units, and colors even when pins hadn't changed. Add merge_signal_metadata() and call it from ArduinoDevice.remap_pins() and SerialDevice.reconfigure() to reapply the same fields ProfileManager already treats as user overrides, keyed by signal_id. Also close a related gap: removing a pin that a Channel/Plot/Control still referenced left it silently dangling, and SignalProcessor never pruned its latest-value cache, so a derived Channel kept computing off a permanently frozen stale reading. Add SignalProcessor. on_device_reconfigured() to purge that cache, reference_registry. find_references() for a console breadcrumb, and live "missing source" indicators on Plot traces and Channel blocks reusing ControlWidget's existing stale/QSS pattern. Also fixes ControlWidget._write() still enqueuing writes to a channel that no longer exists. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-19Redesign Signal/Channel naming and fix pin-remap breaking referencesChristian Kolset
Arduino analog Signal ids used to be the pin name itself, so fixing a wrong pin silently changed the id and orphaned any plot trace, control, or filter pipeline pointing at it. Analog Signal ids are now positional (ai0, ai1, ...) and decoupled from the underlying pin, matching how digital I/O already worked. More broadly, formalizes a Device -> Signal -> Channel -> Plot naming model (SignalConfig for physical device channels, Channel for derived/ computed ones) and adds core/reference_registry.py to propagate any Signal or Channel id rename through plot traces, controls, and filter pipelines instead of leaving them dangling. Signal ids are now editable in the Signals tab with the same propagation. .labui profile schema bumped to v2.0 with a transparent migration for old files, including remapping old pin-name Signal ids to the new positional ones. Removed six confirmed-dead files (two legacy device classes, four superseded top-level ui/ duplicates).
2026-08-17Fix control panel freeze and CM1 motor not movingChristian Kolset
ControlWidget._write() called dev.write_channel() directly on the GUI thread from Qt signal handlers — for CML (CoolMuscle), write() does 2-3 blocking serial round-trips, and a slider fires valueChanged on every drag tick, so each tick froze the whole app until the device responded or timed out. Replaced with a coalescing background dispatch: writes are keyed by (device, channel) in a dict instead of a plain FIFO queue, so re-writing the same channel while a write is still pending updates its value in place rather than piling up — a strict FIFO was observed backing up 30+ deep during a single drag, meaning the motor kept "moving" to seconds-old positions long after the slider stopped, which looked like a freeze even once off the GUI thread. Separately, the motor never actually moved because it was never enabled: per docs/CM1-C_ASCII_Command_Cheatsheet.md, a CM1-C motor stays disabled ("shaft free") until sent "(", and nothing in CMLLayer.write()'s VS/MA handling ever sent it — enable only existed as a separate M1_ME channel the generic MotorControl widget has no concept of. VS/MA now send enable unconditionally before the move sequence (a no-op if already enabled). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-11Fix native-style Qt warning; add a few tooltips; trim Namespace hint textChristian Kolset
Root cause of "QFont::setPointSize: Point size <= 0 (-1)" on some dropdowns: the app never sets an explicit widget style, so it defaults to native windowsvista, whose popup code calls setPointSize() on fonts resolved from our QSS's pixel-based font-size (pointSize() is -1 by design for px fonts). Tried app.setStyle("Fusion") first — silences it, but Fusion doesn't render buttons/dropdowns to match the QSS the way the native style does. Kept native style, filtered just that one message via qInstallMessageHandler instead — it's cosmetic Qt console noise (the rejected setPointSize call is a no-op, doesn't affect rendering), not a real bug. Also adds a handful of tooltips (Control Editor's Check Syntax/Cancel/ Create Control, device Configure dialog's Close, main toolbar's View/ Configure/RUN/LOG/Settings, a few Control Panel widgets) from an in-progress app-wide tooltip pass, paused partway through by request — remaining buttons are being done manually. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-10Unify Signals/Channels around auto-naming, plot-by-channel, and shared varsChristian Kolset
Devices: auto-name from OS-reported port description (Device Manager / udev string) instead of a generic label; default Serial #Channels 1; consistent simulate-mode checkbox across backends; inline device rename. Channels: calibration/filters move out of Signals into a Channel "Operation" (adds Scale/Offset alongside the existing math kinds); single-physical-source Channels get an embedded Filters block; new Channels auto-name/auto-ID from their source and reject duplicate names/IDs on apply; "Create Channel" button on each Signal row; renamed "Sources" -> "Signals" in the Channels UI; Signals' READ/WRITE dir badge (was silently-broken IN/OUT) now reflects the real writable flag. Plot: default layout is one pane per Channel (not per device, not raw Signals) titled by channel name; "+ Add Channel" is a checkbox dialog instead of an inline dropdown; traces get up/down reorder; live unit changes (e.g. a Mark-10 gauge switching lb/kgF/N/ozF) propagate to an open pane's axis label without clobbering a manually-typed one. Control Panel: hardware assignment now picks from the same writable- Signals list instead of a separate device/channel combo with a hardcoded Arduino pin list; stale visual indicator when a control's target device/channel disconnects or disappears; documented the `vars` bridge (Control Panel On Action Script <-> Channel scripts) in both directions' help text and script templates. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-03Re-designed control widgets to be fully contrained.Christian Kolset
- Moved edit and X button to top with header of widget. - Replaced up/down button with drag-and-drop style headers.
2026-08-02Merge origin/main: reconcile ConfigWindow consolidation with Debug window + ↵Christian Kolset
protocol updates origin/main (23 commits) added a Debug window/log system on top of the old separate Devices/Channels/Plot windows, plus protocol fixes (cml, mark10, modbus_rtu, scpi) and device/profile changes. Local main (3 commits) replaced the separate windows with a unified ConfigWindow + dock panel. Kept local's ConfigWindow/dock architecture and ported the Debug window onto it: new toolbar button + _open_debug(), gated by developer_mode same as origin's version. Deduped the two independent "developer mode" toggles that had collided in SettingsWindow (origin's General-tab checkbox gating Debug window + device sim-mode visibility, local's Advanced-tab checkbox setting verbose logging) into one General-tab checkbox that does both. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-01Major control panel improvements.Christian Kolset
- Added dedicated firmware file for arduino - Added View button to consolidate windows - Control Panel changes: - Changed name fron "Controls" to "Control Panel" - Blue side bar when Panel is hidden. - Supports "popping" out contorl panel - Settings > Advanced tab added with developer settings
2026-07-29Merge branch 'fix/control-channel-direction-filter'Christian Kolset
# Conflicts: # ui/control_editor.py
2026-07-29Make Run the master stop switch; add Log button disabled/recording stylingChristian Kolset
Run/Stop previously only paused acquisition — control outputs (motor speed, switches, PWM duty) kept whatever value was last written, so stopping the run loop didn't stop a running motor. Adds ControlWidget.safe_stop() (per-widget override, default zeros the output) and ControlPanel.safe_stop_all(), called from _toggle_run's Stop branch before engine.stop(). Per-widget behavior is deliberately not uniform: - OnOffSwitch/MotorControl/PwmControl have a latched running/enabled state, so safe_stop() drives their own toggle handler (consistent UI + write in one path) and, for Motor/PWM, zeroes the slider too. - SetpointControl/AnalogOutputControl only write on an explicit user action and have no universally safe forced value (e.g. 0 isn't necessarily "off" for an arbitrary process setpoint or analog output) — Stop leaves them untouched rather than guessing. Log button: added a :disabled QSS rule so "can't log yet" reads as clearly inert rather than a duller version of the enabled look, and a 600ms blink (toggling a "recording" dynamic property the QSS keys off) while a recording is active, so it reads as live/recording rather than a static pressed button. Master Stop now calls _toggle_log(False) explicitly when forcing the button off, since QPushButton.setChecked() doesn't emit clicked — without this the blink would keep running after a master Stop even though logging itself already halted via engine.stop()'s internal stop_logging() call. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-29Hide non-writable channels from Controls picker, gate writes on enabled+writableChristian Kolset
Adds ChannelConfig.writable so the Controls editor can only bind to channels with a real write mapping (VS/MA/ME/MD/ST for CML, do*/DO for digital I/O, write_cmd-configured SCPI channels, holding-register Modbus channels) instead of read-only telemetry — this is exactly the class of mistake hit earlier (binding a motor-speed control to M1_TV instead of M1_VS). Also carries forward the enabled-channel gating for controls (hide disabled channels from the picker, block writes to them at _write() time) done alongside this investigation. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-27Fix .gitignore: remove duplicate entry for plugins/enabled.jsonChristian Kolset
2026-06-09Scripting: named signal vars, shared vars dict, control scripts, code templatesChristian Kolset
- Named variables in expressions: source channel IDs injected as Python identifiers alongside x[] (e.g. write `A0 * 2` instead of `x[0] * 2`) - Shared `vars` dict on SignalProcessor accessible from all expressions, functions, and control scripts; persisted in .labdaq profiles - Per-derived-channel `state` dict for persistent computation state in custom scripts - Control widgets gain optional on_action_script (Python snippet with value, vars, channels, math in scope); syntax-checked in editor dialog - Built-in derived kinds (derivative, rms, power, etc.) now show their Python implementation as read-only code previews; "Edit as Custom Script" converts to custom_script kind with template pre-filled Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22Fixed saving profile to include devices and their configurationChristian Kolset
2026-04-22Added feature/create-controlsChristian Kolset
2026-04-21V13Christian Kolset
This version contains the profile feature. Allowins users to save the channels, signals and plots for specific labs.
2026-04-20V8Christian Kolset