Files
chuan 652d5d0dc1 feat!: 接入可选送丝机与双型号焊枪仿真
- 增加送丝机及两种焊枪的启动选择,未启用时保留原有简化外设
- 实现外设串口协议、工艺缓存与导入、参数保存、报警输入和独立供电
- 提供外设 WebSocket 状态及控制接口,按连接管理按钮持有和碰撞故障释放
- 添加外设卡片、静态光斑、监控输入与故障操作,统一布局并保存展开状态
- 添加外设协议与固件联动用例,以及点射收尾期间再次出光的回执回归用例
- 整理协议边界及测试条目,记录旧款焊枪驱动和电源报警未被固件转发的现状
- BREAKING CHANGE: 自定义平台实例化 BoardWebSocketServer 时需提供 ExternalDevices 依赖
652d5d0dc1 · 2026-10-23 14:08:01 +08:00
History
..

PCB Viewer

Three.js rendering of the supplied bare-PCB reference, integrated through React Three Fiber.

bun install
bun dev

An orthographic camera fits the entire board to the viewport. Hover over a connector or pad to view its parameters; click to highlight it. Rendering runs on demand rather than continuously. Clicking any X/Y/Z/A/B/C axis connector opens a split view with the board on the left and its live pulse trace on the right. Switching axes preserves the selected time window and starts a fresh live view for the selected axis. The window also persists when closing and reopening the panel within the current page session. When no external groups are expanded, the board rotates 90 degrees and fits the left pane. uPlot renders the captured digital edges. Live mode always follows the latest timestamp. Explicitly pause before zooming, panning, or enabling measurement cursors; chart gestures never switch modes. Pause freezes only the view while acquisition continues. Clear discards the displayed history and resets the local pulse counter, then returns to live without reconnecting or controlling the board. Return to live follows the latest data; reset restores the selected time window. The history covers the latest ten seconds of simulation time. Two draggable time cursors measure elapsed time, rising-edge count, and average frequency (count divided by elapsed time). Counts use a left-inclusive, right-exclusive interval; the initial boundary level is not counted as an edge. Measurements outside retained data are unavailable. Movement remains controlled by the existing host application.

Click the general-input or external-control connector to toggle its row of switches above the PCB. Each switch offers a latched toggle or momentary button: hold drives low, release restores high. Pointer ownership is tracked independently; releasing, cancelling, or moving one pointer outside its button releases only its hold. Losing window focus or hiding the page releases all holds. Closing the last subscription for an input group releases its momentary holds on the server, while latched levels remain. Unknown states are dimmed and cannot be changed until a fresh snapshot arrives. Input errors appear in a compact status strip.

Click the general-output connector to toggle the O1–O10 lamp column to the right of the PCB. Lamps follow actual GPIO logic levels; output control stays in the host application or firmware. Unknown levels dim the lamp ring. Limit switches appear above the PCB; Signal 1, Signal 2, and laser attachments appear below it. These groups toggle independently and can coexist. Their spacing follows shared model bounds and board-edge gaps; the upper input/control row moves outward when the limit row is also visible. The switches, indicators, and wires share the board WebGL canvas. Mode controls remain anchored to their switch models during camera navigation.

Start Renode from the project root with just run --no-debug to observe the running indicator. All active topics share one direct WebSocket connection to Renode through reconnecting-websocket. Topic subscriptions are routed independently and automatically resubscribe after reconnecting. Closing a panel unsubscribes only its topic; the underlying connection closes when no subscriptions remain. A connection reconnect clears all subscribed states before fresh snapshots arrive. Input commands are never queued for replay during disconnection. Green power/run indicators follow the received state; the red fault indicator remains off until its source is mapped.

The Vite configuration reads H723_WS_PORT from the root .env (default 12322). Override the complete endpoint with root VITE_BOARD_WS_URL if needed, including when using --ws-port. Restart Vite or rebuild after changing these settings. See the protocol for independent clients.

  • src/domain/pcb-layout.ts: reference-image coordinates and physical contact order
  • src/domain/cmc106b2.json: installation-manual pin definitions
  • src/components/board-view.tsx: WebGL geometry, instanced pads, raycasting and camera fitting
  • src/components/board-surface.ts: static silkscreen texture
  • src/components/board-tooltip.tsx: connector and pin tooltips
  • src/components/axis-waveform.tsx: uPlot trace view, time window and capture controls
  • src/lib/use-axis-waveform.ts: bounded edge history, validation, gap detection and reconnection
  • src/lib/board-connection.ts: shared connection, topic leases, message routing and final unsubscribe
  • src/lib/use-board-indicators.ts: indicator subscription, message validation and disconnected state

Layout coordinates are image coordinates, not manufacturing dimensions. The physical polarity of the PB5 LED remains unverified; the model currently uses active-high logic.

Next step (planned, not implemented)

  • Split the right pane vertically: waveform and controls above, measurements and command list below.
  • Record host commands at the Renode communication entry point using the same simulation clock as waveform edges.
  • Filter received commands by the A–B cursor interval and selected axis; include relevant global commands such as stop.
  • Distinguish command receipt from firmware execution. Execution start/end and queue state require separate firmware instrumentation and must not be inferred from receipt timestamps.

Formatting

  • bun run format: format source and configuration files with the pinned local Prettier version
  • bun run format:check: check formatting without writing files
  • bun run lint: run Oxlint code checks

When opening web/ as a VS Code workspace, install the recommended Prettier extension to format code on save using the included settings. Other editors can use .prettierrc.json.

Waveform history stores immutable typed blocks for the latest ten seconds, with a two-million-point memory budget. Paused views share their captured blocks without mutation. Rendering converts only the visible interval; cursor counts use per-block rising-edge prefixes. If density exceeds the budget, the oldest points are removed and the existing gap warning is shown. Display aggregation never invents edges or counts.

Optional devices

Renode startup options --wire, --laser1 and --laser2 determine the permanent device models beside the board. The browser reads board.devices; it does not store or change the device selection. Corresponding legacy controls are merged into the device model, while the gas-valve indicator remains available. Feed/retract buttons are momentary; the feeder power icon holds its power off/on; the torch power icon also holds its independent power off/on. Beam geometry uses effective protocol parameters and simulation timestamps, not wall-clock animation or measured optical feedback. See device behavior and limits.

The feeder card groups speed, mode and current stage beside a pair of drive rollers. Click its title to expand four read-only parameter groups; expansion is stored under pcb-feeder-parameters-expanded. Fault injection lives in the header menu. The card does not show or edit run permission, and its physical buttons remain pressable during a fault while actual motion follows the device state. Power-off disables motion buttons.

Torch cards keep separate SUP25A and SUP25AD identities with centered protocol-version tags. Only shape-applicable parameters appear beside the static beam graphic. Click the title to expand monitoring and hardware tabs; each model stores its own expansion preference. The digital model displays the effective process number; physical process-input controls remain backend-only. Hardware/software versions and synchronization words are also backend-only. The host-controlled status lamp and three process indicator lamps remain backend-only. The title is the single expand/collapse entry for monitoring and fault tabs; there is no separate ellipsis menu. The actual alarm icon remains independent; its tooltip lists active faults. Clicking it opens the hardware tab. Collision uses the same card style as other hardware faults. Its collisionFault operation releases the source and clears its collision latch on switch-off, preserving other faults and other connections' active collisions. The physical collision operation retains protocol latching. The monitoring tab contains editable temperature inputs and, for SUP25A, the power-current input in mA. The separate temperature tab is removed; the hardware tab contains fault cards only. Legacy alarm-detection and current-limit settings continue to come from the host. The independent laser-source alarm remains on the board's Signal 3 attachment. A torch expansion shifts the feeder and its wires together rather than overlapping it.

The left parameter list uses torch.displayParameters so received edits to the current digital process appear on its screen immediately, as required by protocol V1.60 section 3.5.2 note 2. The beam graphic continues to use the effective top-level fields: a cache-only write must not apply the actual scan early. Changes to another process do not replace the current parameter list. Legacy torches have no separate process cache, so screen and effective parameters match.