Skip to content

Promote next to main: connection redesign#30

Merged
georgevigelette merged 6 commits into
mainfrom
next
May 13, 2026
Merged

Promote next to main: connection redesign#30
georgevigelette merged 6 commits into
mainfrom
next

Conversation

@boringethan

Copy link
Copy Markdown
Contributor

Summary

Promotes next to main. Brings in the test-app side of the SDK connection redesign:

  • c2e8283 migrate to MotionInterface stable-handle API — connector subscribes once to per-handle signal_state_changed instead of reconnecting on every connect/disconnect cycle; all device calls go through interface.console / interface.left / interface.right (the removed console_module / sensor_module accessors are gone)
  • 85a5978 align to the new descriptor naming (lowercase handle.name)
  • 8f9b580 workflow naming alignment (release-build.yml)
  • c542329 float-precision trigger frequency UI (DoubleValidator + parseFloat); JSON keys stay PascalCase, matching firmware GET response and the rest of the trigger config
  • 360d283 merge of next: adopts the fpga_laser_config.py refactor and ports it from the old console_module API to the new console handle API in the same change. Without that port the refactored module would have been dead code on the connection-redesign branch.
  • 29ad13b PR feat: migrate test-app to MotionInterface stable-handle API #29 merge commit

Diff: 8 files, +259 / −283. Most of motion_connector.py's churn is call-site renames; the 144-line set_laser_power_from_config body is now a 3-line delegation to apply_laser_power_from_config(...) — logic preserved, moved to fpga_laser_config.py.

SDK pairing

Pairs with openmotion-sdk PR #48 (also nextmain). The connection redesign requires the SDK's MotionInterface stable-handle API; deploy together.

Test plan

  • Smoke test: python main.py launches, app reaches the QML engine, connector subscribes to handle state changes
  • Trigger panel: SET/GET/Start/Stop work against openmotion-console-fw 1.5.8-rc.2 (validated end-to-end via the trigger script in SDK PR #47/#48)
  • Laser power init via set_laser_power_from_config — exercised by app start sequence; reviewer should confirm the DRIVE CL safety override path still fires on hardware
  • Sensor connect/disconnect cycle — confirm per-handle signal_state_changed flow updates the UI correctly across connect/reconnect

🤖 Generated with Claude Code

boringethan and others added 6 commits April 21, 2026 17:53
Pairs with openmotion-sdk feature/connection-redesign.

motion_connector.py:
- on_connected/on_disconnected/on_data_received collapsed into a single
  _on_handle_state_changed(handle, old, new, reason) wired to each of
  the three stable handles (console/left/right). Branches on handle.name.
- All `motion_interface.console_module` -> `motion_interface.console`.
- All `motion_interface.sensors[X]` and `.sensors.get(X)` patterns ->
  `motion_interface.left` / `motion_interface.right` directly, or
  `getattr(motion_interface, side, None)` where side is dynamic.
- Console-status thread teardown moved into the new state handler's
  DISCONNECTED branch.

motion_singleton.py:
- Drop acquire_motion_interface() (removed from SDK). Just construct
  MotionInterface(); main.py calls .start() once at startup.

main.py:
- Drop qasync QEventLoop + asyncio glue. Call motion_interface.start()
  before app.exec() and motion_interface.stop() in handle_exit. The
  SDK's daemon monitor thread runs alongside the Qt event loop; no
  bridging needed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The SDK now emits "left"/"right"/"console" via signal_state_changed and
expects matching strings as method arguments. The previous "SENSOR_LEFT",
"SENSOR_RIGHT", and "CONSOLE" tags were the old descriptor format.

- pages/{Sensor,Settings,Console,Demo}.qml: every quoted device tag
  ("SENSOR_LEFT" -> "left", "SENSOR_RIGHT" -> "right", "CONSOLE" ->
  "console"), 71 sites total. Comments updated where they reference the
  old constants.
- motion_connector.py: same string substitution (75 sites). Removed the
  now-redundant `sensor_tag = "left" if target == "SENSOR_LEFT" else
  "right"` re-derivation in the DFU enter path; the target IS the tag.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Cherry-picks the trigger-frequency precision change from 1e6576f without the
JSON camelCase key conversion or the temporary float-coercion shim. The
DoubleValidator (1.00-100.00, 2 decimals) and parseFloat now match the
firmware's float frequencyHz; PascalCase JSON keys stay consistent with the
rest of the trigger config and the firmware's GET response.
Brings feature/connection-redesign current with next:
- 7d0ce9a refactor out config to its own handler
- 9ceee95 update adc_data scale parameter
- 1e6576f more granular control of the trigger
- 13ebce5 update workflow to reflect naming convention

Resolutions:
- motion_connector.py set_laser_power_from_config: collapsed the 144-line
  inline implementation into the one-line delegation to
  apply_laser_power_from_config from fpga_laser_config.py. The refactored
  function preserves the same DRIVE CL safety override logic and
  EE_THRESH/EE_GAIN/OPT_THRESH/OPT_GAIN handling.
- fpga_laser_config.py: ported from the old SDK API
  (interface.console_module.read_config / .write_i2c_packet) to the new
  stable-handle API (interface.console.*). Without this the refactored
  function would have failed on the connection-redesign branch where
  console_module no longer exists.
- pages/Demo.qml: kept PascalCase JSON trigger keys (TriggerFrequencyHz
  etc.) consistent with the firmware's GET response and the rest of the
  config; the camelCase variant from 1e6576f is dropped here for the
  same reasons it was dropped in console-fw 1.5.8-rc.2.

Verified: motion_connector.py and fpga_laser_config.py both syntax-check;
no remaining console_module references anywhere; no remaining references
to the removed _fpga_model / _fpga_scale_overrides / _fpga_scale_cache
attributes; the _get_fpga_scale and _get_fpga_entry_by_friendly_name
methods stay as 4-line FpgaModel delegators (the auto-merged version
from next), preserving the external caller at line 3638.

Not yet verified: app actually launches and the trigger panel works
end-to-end. Requires GUI + hardware.
feat: migrate test-app to MotionInterface stable-handle API
@georgevigelette georgevigelette merged commit 699ee75 into main May 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants