Skip to content

Resume-at-line can miss the active feed rate before the recovery Z move #669

Description

@righteousgambit

Summary

Resume-at-line can recover an older feed rate when the active modal F word appears by itself or in tightly packed G-code. The recovered feed is emitted before the recovery Z movement, so an incorrect retained value can affect that move.

On develop at 2ea66c10e96d88013a04441134d3d4f8e8c88510, _find_last_feed_rate() only extracts an F word from lines it first recognizes as G1, G2, or G3: feed-recovery implementation. The controller then emits that recovered feed before the Z recovery move: recovery sequencing.

F is modal independently of whether the same line contains a motion command; LinuxCNC lists it among the other modal codes: G-code quick reference.

Minimal reproduction

G1 X0 F100
F275
G0 X1
G1 X2

Resume at line 4.

Expected:

  • Feed recovery returns 275.
  • When a Z position is available, the preview emits buffer G1 F275 before its recovery Z move.

Actual:

  • Feed recovery skips the standalone F275 and returns the older F100.

A tightly packed line such as X10Y10G1F425 is also missed by the current motion-prefix heuristic.

Impact

The effect is state-dependent. If the effective feed was set on a line the current scanner misses and the machine retains a different or unknown feed, the recovery Z move can use the wrong feed. If retained feed already matches, no behavior difference is expected. Resume should explicitly reconstruct the program's most recent modal F value.

Acceptance criteria

  • Recover the most recent valid F word before the resume line, whether standalone, spaced, or tightly packed.
  • Ignore F words in semicolon and parenthesized comments.
  • Emit the recovered feed before the recovery Z move.
  • Cover both standalone and tightly packed forms with regression tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions