LinuxCNC / linuxcnc

LinuxCNC controls CNC machines. It can drive milling machines, lathes, 3d printers, laser cutters, plasma cutters, robot arms, hexapods, and more.
http://linuxcnc.org/
GNU General Public License v2.0
1.73k stars 1.13k forks source link

Gcode interpreter takes wrong order in v2.10 (Gcode with M67 commands give inverted result) #2987

Closed royka1 closed 1 week ago

royka1 commented 1 month ago

Here are the steps I follow to reproduce the issue:

  1. Use LinuxCNC built from Master
  2. gcode made by Lightburn with M67 E0 Qxx commands in G90 mode

This is what I expected to happen:

To give the output shown in Lightburn

This is what happened instead:

When I laser engrave filled text in scanning mode it gives the inverted result. But when I replace all Q0 with Q30 and replace the Q30 with 0 it engraves correctly, except the overscanning parts are still dark (2.5% of the beginning and end). When I issue a m68 command manually it works correctly.

It worked properly before this:

The same gcode works correctly when I install 2.9.2 again.

Information about my hardware and software:

andypugh commented 3 weeks ago

So, are you saying that this is not an issue in the released 2.9.2 version, but you see this problem when you compile from source?

My initial feeling is that this isn't a problem in the LinuxCNC code, but in your setup. I am not aware of any recent changes in the handling of the M67 code.

What is the logical path between the M67 command and your laser? Is there a pwmgen involved? Which gpio driver are you using?

royka1 commented 3 weeks ago

So, are you saying that this is not an issue in the released 2.9.2 version, but you see this problem when you compile from source?

Yes before I used a self compiled version 2.9 which worked correctly, after that I compiled 2.10 and the problem started.

My initial feeling is that this isn't a problem in the LinuxCNC code, but in your setup. I am not aware of any recent changes in the handling of the M67 code.

Initially I was also thinking that it was a problem in my setup so tried about everything I could think of with the software and hardware, eventually I reverted back to the released version 2.9.2 and it's working correctly again.

What is the logical path between the M67 command and your laser? Is there a pwmgen involved? Which gpio driver are you using?

I'm using a Mesa 7I92m driver board with a 74HC04 as buffer/inverter In the HAL file I have: setp hm2_7i92.0.pwmgen.00.output-type 1 setp hm2_7i92.0.pwmgen.pwm_frequency 20000 setp hm2_7i92.0.pwmgen.00.scale 100 setp hm2_7i92.0.pwmgen.00.out0.invert_output True

net laser_pwm motion.analog-out-00 => hm2_7i92.0.pwmgen.00.value net laser_pwm_enable motion.digital-out-00 => hm2_7i92.0.pwmgen.00.enable net laser_pwm_enable => hm2_7i92.0.pwmgen.00.enable

andypugh commented 3 weeks ago

setp hm2_7i92.0.pwmgen.00.out0.invert_output True

Might be relevant.

But can you check if the first stage of the output is different in the two cases? This will be, I think, the motion.analog-out-00 value. I would be very surprised (and concerned) if that is different in the two versions.

royka1 commented 3 weeks ago

setp hm2_7i92.0.pwmgen.00.out0.invert_output True

Might be relevant.

When I comment this out or set to false the laser triggers as expected at full power on start of LinuxCNC.

But can you check if the first stage of the output is different in the two cases? This will be, I think, the motion.analog-out-00 value. I would be very surprised (and concerned) if that is different in the two versions.

motion.analog-out-00 has the same value in v2.9.2 as in v2.10 at start and after a m67 command followed by a movement. Not sure if the following is relevant: The only difference I see is that with v2.9.2 after m62p0 command m68 won't turn on the laser, when I follow that with m64p0 it turns on immediately. With v2.10 after m62p0 command m68 turns the laser as expected on. Perhaps the fix in v2.10 caused some unexpected behavior?

In the image you see on the left the result of v2.10 and on the right the result of v2.9.2 of the same gcode.

1718036906923 TEST.ngc.txt

royka1 commented 2 weeks ago

@andypugh In this video you can see that V2.10 picks the m67 command from the next line.

https://github.com/LinuxCNC/linuxcnc/assets/397414/60cf42e9-6353-4572-b302-d7b0d00b8c56

royka1 commented 2 weeks ago

I've also tried the deb package from the linuxcnc site with the same result, on v2.10 it doesn't work correct.

Here a video of v2.9.2 with the same gcode which output the correct values:

https://github.com/LinuxCNC/linuxcnc/assets/397414/4577c279-198e-4461-a7c0-a332ae8127a9

royka1 commented 2 weeks ago

Until this commit it works correctly: https://github.com/LinuxCNC/linuxcnc/commit/824764638e2023749ab9296312878c04abac0690 So it should have changed by this merge commit: https://github.com/LinuxCNC/linuxcnc/commit/6d6538695779eaf39c635caa51762fd4fa29b8a2

royka1 commented 2 weeks ago

After reverting commit https://github.com/LinuxCNC/linuxcnc/commit/6d6538695779eaf39c635caa51762fd4fa29b8a2 by downloading the patch: https://github.com/LinuxCNC/linuxcnc/commit/6d6538695779eaf39c635caa51762fd4fa29b8a2.patch Somehow I had to do this command twice: git apply -R ../6d6538695779eaf39c635caa51762fd4fa29b8a2.patch It still compiled and LinuxCNC works correctly again.

rmu75 commented 2 weeks ago

This is strange -- I will look into it.

rmu75 commented 1 week ago

@royka1 can you try https://github.com/rmu75/linuxcnc/tree/rs/std-interp-list-fix this should fix it

royka1 commented 1 week ago

Yes that fixed it, thank you!