Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Run from here' not working as expected in Axis on 2.9.1 #2771

Closed
spacestate1 opened this issue Dec 6, 2023 · 16 comments
Closed

'Run from here' not working as expected in Axis on 2.9.1 #2771

spacestate1 opened this issue Dec 6, 2023 · 16 comments

Comments

@spacestate1
Copy link

Here are the steps I follow to reproduce the issue:

  1. Open a gcode file in Axis
  2. Get XYZ homed
  3. Scroll through the gcode in the code window to find an arbitrary point, right click and select 'Run from here'

This is what I expected to happen:

The machine re-positions the spindle and runs from the selected line of gcode

This is what happened instead:

The code runs from the beginning of the gcode file

It worked properly before this:

I noticed the behavior start when I switched from LinuxCNC 2.8.4 to 2.9.1
The same behavior is seen in 2.9.1 Axis_mm in sim running inside a virtual machine

Information about my hardware and software:

  • I am using this user interface AXIS
  • I am using this interface hardware MESA 7i76 with a 7i92 interface card.
  • The issue is also present in sim Axis_mm
@samcoinc
Copy link
Collaborator

samcoinc commented Dec 6, 2023 via email

@spacestate1
Copy link
Author

I see the same behavior if I select the line and right click 'Run from here' or if I just right click and hit 'Run from here' on the line. it goes back to the beginning.

@phillc54
Copy link
Collaborator

phillc54 commented Dec 6, 2023

It appears to be caused by the file being reloaded and having the program_start_line reset from commit bc9a79d

@Sigma1912
Copy link
Contributor

Yes, if iI recall correctly, the idea there was for the code to be reloaded when the user clicks on the new 'Re-Check' button on the limit violations popup and not force a reload when running the file.

def run_warn():
    warnings = []
    if o.canon:
        machine_limit_min, machine_limit_max = soft_limits()
        for i in range(3): # Does not enforce angle limits
            if not(s.axis_mask & (1<<i)): continue
            if o.canon.min_extents_notool[i] < machine_limit_min[i]:
                warnings.append(_("Program exceeds machine minimum on axis %s")
                    % "XYZABCUVW"[i])
            if o.canon.max_extents_notool[i] > machine_limit_max[i]:
                warnings.append(_("Program exceeds machine maximum on axis %s")
                    % "XYZABCUVW"[i])
    if warnings:
        text = "\n".join(warnings)
        return int(root_window.tk.call("nf_dialog", ".error",
            _("Program exceeds machine limits"),
            text,
            "warning",
            1, _("Re-Check"), _("Run Anyway"), _("Cancel"))) + 1
    return 0

@Sigma1912
Copy link
Contributor

Ah, no. I just retested the issue.
The point was:
If you change the tool after loading the gcode then the limit check does not reflect the current tool but the tool at the time when the code was loaded.

@Sigma1912
Copy link
Contributor

Maybe we could check the value of 'program_start_line':


    def task_run(*event):
        global program_start_line, program_start_line_last
        if program_start_line == 0:
            res = 1
            while res == 1:
                res = run_warn()
                if res == 2: break
                if res == 3: return
                print("reload file")
                reload_file()
...

@andypugh
Copy link
Collaborator

andypugh commented Dec 7, 2023

It appears to be caused by the file being reloaded and having the program_start_line reset from commit bc9a79d

That change should only reload the file if the "Re-check" buttton is pressed. Is there something wrong with my logic?

@phillc54
Copy link
Collaborator

phillc54 commented Dec 7, 2023

TBH I did not notice a recheck button. I ran the axis_mm sim and just did a run from line and the file reloaded.

@andypugh
Copy link
Collaborator

andypugh commented Dec 7, 2023

The change referenced ( bc9a79d ) should only be activated in cases where the limit check fails, and then the re-check button is pressed.

Is it possible for someone to run a git bisect to see when the behaviour changed? (or just choose a point in the timeline prior to my change, to make sure it's my fault)

@rmu75
Copy link
Contributor

rmu75 commented Dec 7, 2023

run_warn return 0 by default (i.e. the non-warning case) and that triggers a reload. Also there is #2490

@phillc54
Copy link
Collaborator

phillc54 commented Dec 7, 2023

I can have a look tomorrow morning if no one else has by then.
I did comment out the reload_file() line in the while res block and run from line worked correctly.

@rmu75
Copy link
Contributor

rmu75 commented Dec 7, 2023

add "if res == 0: break" or replace "if res == 2: break" with "if res in [0, 2]: break" or something like that.

@andypugh
Copy link
Collaborator

andypugh commented Dec 7, 2023

And this, kids, is why I shouldn't be allowed anywhere near software.

Bother! It's an easy fix but I think it means a 2.9.2 release, and that's rather more work than the fix.

@spacestate1
Copy link
Author

spacestate1 commented Dec 7, 2023

added "if res == 0: break", and it seems to fix the issue on my end.

@phillc54
Copy link
Collaborator

phillc54 commented Dec 7, 2023

Confirming that this issue first appears in bc9a79d.
Roberts suggestion of if res in [0, 2]: break does seem to fix it for me.

andypugh added a commit that referenced this issue Dec 8, 2023
@andypugh
Copy link
Collaborator

andypugh commented Dec 8, 2023

OK, suggested fix tested and implemented.

@andypugh andypugh closed this as completed Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants