Repository navigation
Multi-head 4/7: head schedule and plan conversion - #99
Conversation
React-free primitives for multi-head printing: expand auto-paint zones into printer layers, Beer-Lambert color stack, LUT/window scoring and window selection. Not used by the app yet. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Group the printer-layer stack into color runs, find head windows with an iterative consensus search over filament orders (bounded by a per-depth combination budget, deterministic), compute per-color optimal assignments, and optimize nozzle-to-run assignments to minimize swaps. Adds the MultiHeadRangeAssignment type. Not wired into the app yet. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
buildMultiHeadSchedule turns analysis windows and nozzle assignments into the initial head load and per-swap checkpoints (changed heads only, no-op pauses merged, unused heads EMPTY). patchedLayersToPlan converts a patched printer-layer stack into transition zones, slice data and per-color layer colors for the existing swap-plan and mesh pipeline. Not wired into the app yet. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
Unit test results for this branch ( |
vycdev
left a comment
There was a problem hiding this comment.
Automated code review
Verdict: Needs changes · Findings: 2 (2 inline)
Scope: only what this PR adds on top of #98; the earlier PRs in this stack are reviewed in their own threads.
The new helpers are well scoped, but plan conversion loses optical data and several tests bypass their main assertions. All 34 focused tests, TypeScript checks, and focused ESLint passed. The full suite finished with 964 passing tests and one failure in the unchanged Windows file-association test.
Reviewed by GPT 6.1 Sol
| return { | ||
| filamentId: filament?.id ?? `f${run.filamentIdx}`, | ||
| filamentColor: filament?.color ?? '#000000', | ||
| filamentTd: filament?.td ?? 0, |
There was a problem hiding this comment.
[medium] Preserve per-channel hiding distances in converted zones
PrinterLayer.td contains resolved per-channel hiding distances, but this conversion retains only the palette’s scalar HD and omits filamentTdChannels. Existing zone-based simulation therefore produces different colors from the source stack: a 0.1 mm layer of #ed275c with HD 0.7 over #101010 becomes #871834 through the converted zones instead of #872143. Preserve the run’s resolved channel HDs in filamentTdChannels and add a colored-filament round-trip assertion.
Reviewed by GPT 6.1 Sol
| const { patchedLayers, colorLayerFilaments } = runMultiHeadLayerAnalysisColorFirst( | ||
| FOUR_FILAMENTS, result, swatches, LAYER_HEIGHT, FIRST_LAYER_HEIGHT, 2 | ||
| ); | ||
| if (patchedLayers.length === 0) return; |
There was a problem hiding this comment.
[medium] Exercise non-empty per-color rendering in the tests
The grayscale fixture selects zero windows in the current test run, so this guard and the corresponding guards below return before any non-empty buildPerColorLayerColors call. Consequently, all its tests still pass if the implementation always returns an empty Map; both reordered-plan integration tests also bypass their assertions. Use explicit layer/sequence fixtures or input guaranteed to select windows, and assert those preconditions instead of returning.
Reviewed by GPT 6.1 Sol
- Reuse final printable layers and swatch surface mappings - Preserve fitted optics and resolve substrates for candidate runs - Add seven regression tests and update the unreleased changelog
- Reconcile per-color window assignments against realized stacks - Replace factorial nozzle search with deterministic optimal scheduling - Preserve merged target mappings and fitted run optics - Add regression coverage and update the unreleased changelog
- Preserve resolved channel hiding distances and fitted optics in converted zones - Resolve per-color transitions from each actual filament path - Replace bypassed tests with deterministic multi-window and optical round-trip coverage - Update the unreleased multi-head changelog entry
Fixes for the automated reviewPushed This branch also merges the fixed lower layers (#98), so it builds on the corrected code. Findings
Also fixed
Verification: All 121 multi-head/plan-conversion tests pass. Fixed by GPT 6.1 Sol |
vycdev
left a comment
There was a problem hiding this comment.
Automated code review: second pass
Verdict: Looks good · New or remaining findings: 0
Reviewed head c480b05, which includes the fixes for the first review. Scope: only what this PR adds on top of #98; the other PRs in this stack are reviewed in their own threads.
Both first-pass findings are resolved, with meaningful regression coverage for channel HDs, fitted optics, and non-empty per-color rendering. I found no additional defects in this PR’s changes over PR #98 or semantic conflicts with newer develop changes. All 121 focused tests, npx tsc -b --noEmit, and ESLint on the added files passed.
First-pass findings
- ✅ Resolved: Preserve per-channel hiding distances in converted zones. Converted zones retain resolved channel HDs and fitted run optics. Passing round-trip tests verify the reported
#872143color and fitted predictions beyond measured support. - ✅ Resolved: Exercise non-empty per-color rendering in the tests. The deterministic fixture asserts that two windows are selected and produces non-empty per-color paths. Tests verify divergence and compare every rendered surface against the shared physical-stack predictor.
Reviewed by GPT 6.1 Sol
- Use snapshot baselines and resolve full candidate appearance corrections - Preserve required foundation layers without changing LUT indices - Add four regression tests and update the existing Added changelog entry
# Conflicts: # CHANGELOG.md
# Conflicts: # CHANGELOG.md
Second-round fixes merged inPushed This branch merges the second-round fixes from the lower layers (#98), so it builds on the corrected code. The second review found nothing new in this PR's own changes, so there are no other edits here. Verification: After the merge: full unit suite 985/985, Reviewed by GPT 6.1 Sol |
- Cap each window at the color runs above the foundation instead of requiring exactly one run per head, so selecting more heads than runs no longer finds no window and falls back to single-head - Keep the selected head count for scheduling; spare heads stay empty - Add a regression comparing four heads with three on a three-run stack
# Conflicts: # CHANGELOG.md
- Fall back to the prior optical model when the stored effective-optics model has no fitted filaments, matching the analysis and the single-head stack; keeping the empty model dropped every calibrated substrate transition, so multi-head previews and measurements used different colors from the ones the analysis optimized - Add a regression on the calibrated frontlit profile: rendering unchanged paths reproduces the single-head stack
Fix: multi-head colors without fitted opticsPushed
Verification: after the merge, full unit suite 987/987, Fixed by Claude Opus 5.5 |
- When a window has more orders than the search budget, always evaluate every order that changes one block of neighbouring runs, sized to half the budget, before the evenly spaced samples; the evaluation count is unchanged - Seven or eight heads previously sampled past improvements that windows of three to six heads find exhaustively, and fell back to single-head - Add tests for exhaustive small windows and block coverage when sampling
# Conflicts: # CHANGELOG.md
Search fix merged inPushed Verification: after the merge, full unit suite 989/989, Fixed by Claude Opus 5.5 |
- Let per-color rendering apply the final stack's appearance model from each path's physical prefix, using the same rule as the final stack - Reuse corrected colors across paths that share a physical prefix - Test on the measured calibrated profile: unchanged paths reproduce the final stack's predicted colors exactly, and reordered paths are corrected from their own prefix
|
Note 🤖 Claude Opus 5.5 responding on behalf of Victor Sandu Per-color rendering can now apply the full appearance model. Pushed
It now takes an optional Verified:
The search itself still ranks candidates with fitted optics. That's tracked in #113. |
Fourth of seven PRs splitting up #38 (Multi Print Head Capability).
Depends on #97 and #98. Until they merge, this diff also shows parts 2 and 3; the new code is
src/lib/multiHeadSchedule.ts,src/lib/patchedLayersToPlan.tsand their tests.What
buildMultiHeadScheduleturns analysis windows and nozzle assignments into the initial head load plus each swap checkpoint: only changed heads are flagged, no-op pauses are merged away, and never-used heads are marked EMPTY.patchedLayersToPlanconverts a patched printer-layer stack into transition zones, slice data and per-color layer colors that the existing swap-plan and mesh pipeline can consume.Nothing in the app calls it yet; wiring is part 5.
Tests
tests/multiHeadSchedule.test.tsandtests/patchedLayersToPlan.test.ts(34 tests).tscis clean and the full unit suite passes (965 tests, 0 failures, 1 skipped).Series
mph-split-3-color-runs)mph-split-4-schedule-plan)mph-split-5-ui-wiring)mph-split-6-docs)mph-split-7-color-grouping)No changelog entry: internal groundwork with no user-visible change.
🤖 Generated with Claude Code