Skip to content

task: a tool command leaves the wait flag set, and MDI commands queued, until a program runs #4831

Open

Description

@rene-dev

The three tool commands set task's wait flag, and nothing but a running program or a waiting MDI command clears it again. Until then, every MDI command sent in MDI mode is queued instead of issued.

What happens

In every planner table that accepts them, EMC_TOOL_LOAD_TOOL_TABLE, EMC_TOOL_SET_OFFSET and EMC_TOOL_SET_NUMBER are queued on interp_list, followed by emcTaskPlanSetWait() and a EMC_TASK_PLAN_SYNCH ("signify no more reading, then resynch interpreter").

emcTaskPlanClearWait() is called in two places only:

  • readahead_reading(), while a program is reading and task waits for interp_list and motion to drain;
  • mdi_execute_hook(), when mdi_execute_wait is set.

emcTaskAbort() does not clear it. So after one of these commands in Manual or MDI (for instance a GUI reloading the tool table, or setting a tool offset), the flag stays set. The MDI table then takes the second branch of its EMC_TASK_PLAN_EXECUTE case for every later MDI command: it goes onto mdi_execute_queue instead of being issued directly, until a program has run.

The commands still run, from the queue, so nothing visible goes wrong. But the planner is in a state it believes is temporary, and an abort doesn't reset it.

How to see it

With [EMC]DEBUG including EMC_DEBUG_INTERP_LIST (0x800):

  1. Machine on, MDI mode.
  2. Reload the tool table (linuxcnc.command().load_tool_table()).
  3. Send any MDI command, e.g. (comment).

Task's output shows the command appended to mdi_execute_queue and moved to interp_list, rather than Issuing EMC_TASK_PLAN_EXECUTE straight away. Before step 2, or after running a program, it is issued directly.

Found with the planner test in #4832 (tests/task-planner), which clears the flag before each situation, by running a one-line program, so that its results don't depend on earlier probes.

Possible fix

Clear the wait flag in emcTaskAbort(), or once the queued tool command and the synch have been executed while no program is reading.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions