respira/src/utils
Jan-Henrik Bruhn be3f15eace Fix TRIM command encoding in PES to PEN conversion
Correct the encoding of TRIM commands to use the proper bit flag (bit 1)
instead of incorrectly treating them the same as JUMP commands (bit 0).

The PEN format uses two separate flags in the Y-coordinate low byte:
- Bit 0 (0x01): FEED_DATA - Jump stitch (move without stitching)
- Bit 1 (0x02): CUT_DATA - Trim/cut thread command

Previously, both JUMP and TRIM commands were encoded with bit 0, which
prevented the machine from distinguishing between jumps and thread cuts.

Changes:
- Add PEN_CUT_DATA constant (0x02) for TRIM commands
- Update encoding logic to set bit 0 for JUMP (cmd=1)
- Update encoding logic to set bit 1 for TRIM (cmd=2)
- Add detailed comments explaining the PEN format flags
- Document that Y-coordinate flags can be combined
- Document that X-coordinate flags are mutually exclusive

This fix ensures thread cutting happens when intended, matching the
behavior of the original C# implementation in the Asura app.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-06 23:23:50 +01:00
..
errorCodeHelpers.ts Add comprehensive error descriptions and solutions for all machine error codes 2025-12-06 20:38:02 +01:00
konvaRenderers.ts Implement interactive pattern canvas with Konva.js 2025-12-05 22:27:22 +01:00
machineStateHelpers.ts Fix PEN encoding and improve UI layout 2025-12-06 12:56:27 +01:00
penParser.ts initial 2025-11-30 22:18:14 +01:00
pyodideLoader.ts initial 2025-11-30 22:18:14 +01:00
pystitchConverter.ts Fix TRIM command encoding in PES to PEN conversion 2025-12-06 23:23:50 +01:00