Skip to content

[Go Migration] Fix out_of_bounds.test enable pin ordering #3

@AndySze

Description

@AndySze

Problem

+queue_digital_out oid=12 clock=4032000 on_ticks=0
 set_next_step_dir oid=2 dir=0
 queue_step oid=2 interval=4065333 count=1 add=0
-queue_digital_out oid=12 clock=4032000 on_ticks=0

Stepper enable pin command appears BEFORE step commands when it should appear AFTER.

Root Cause

In advanceFlushTime() (runtime.go:308-365):

  1. Callbacks are invoked FIRST (line 326-334)
  2. GenSteps() is called AFTER (line 346)

When stepper.checkActive() callback detects step activity and calls motorEnable(), the enable pin command is sent BEFORE GenSteps() completes.

Proposed Fix

Option A: Enable deferEnablePins mechanism (Recommended)

  • Set mq.deferEnablePins = true during drip/homing moves
  • Enable pins will be flushed after step generation via flushPendingEnablePins()

Option B: Change callback order

  • Move GenSteps() call before callback invocation
  • Risk: May break other callback dependencies

Files:

  • go/pkg/hosth4/runtime.go
    • Line ~308: advanceFlushTime() - modify to defer enable pins
    • Line ~1380: setEnable() - check deferEnablePins flag

Verification

./scripts/go_migration_golden.py compare --only out_of_bounds --mode strict

Estimate

~2-3 hours

Parent Issue

Part of #1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions