Skip to content

Dead code: MarlinDialect.prologue() is never emitted — G21/G94 (units & feed-mode) absent from output #322

Closed

Description

@CameronBrooks11

Found while scoping #197 (machine-profile spec). Filing as an honest, separate finding — not fixing inline.

What

MarlinDialect.prologue() (fiberpath/gcode/dialects.py:35) returns ["G21"/"G20", "G94"] (unit mode + feed mode), but nothing in the production path calls it. The only caller is its own unit test (tests/gcode/test_dialects.py:48).

Consequently:

  • The serialized G-code (fiberpath/gcode/serializer.py:serialize) emits only ; Parameters …, G0, and G92 — no G21/G20 and no G94. Confirmed against every examples/*/expected.gcode golden (unique opcodes are just G0 and G92).
  • MarlinDialect.units and MarlinDialect.feed_mode are read only inside the dead prologue() method, so they currently have no effect on output.

Why it matters

A streamed program relies entirely on the controller's existing modal state. A controller left in inch mode (G20) or inverse-time feed (G93) would mis-execute the program — coordinates are authored in mm and feed in mm/min, but FiberPath never asserts those modes.

Options

  1. Wire it in — have serialize() prepend dialect.prologue() so output is self-describing (changes all goldens; would need regeneration + a note).
  2. Remove the dead code — drop prologue() + units/feed_mode if the contract is "the controller MUST already be in mm + units-per-minute mode," and document that as a compatibility requirement instead.

#197 will document the mm + units-per-minute assumption as an explicit compatibility requirement regardless; this issue tracks whether FiberPath should emit the setup codes or require them.

Acceptance

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions