-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
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
[BUG] Laser turns off when there is no S?? parameter after G0/G1 #18965
Comments
Looking through the code LASER_POWER_INLINE is incompatible with the old M3 gcode |
Ahh that's a shame. Do you know which piece of code turns off the laser during the movement after a regular M3 command? I think when I remove that piece of code it will work for me. Thanks! |
updated... description not quite accurate enough, not entirely incompatible |
Thans for the clarification. Is the laser supposed to turn of after the first move? So which of the following is right: M3 S60 I // laser stays off Or M3 S60 I // laser stays off If possible, I still would like to edit the code so that a regular M3 works and that it does not get turnt off on the next moves, since the software I use does use inline laser control for the infill, but does use the 'normal' (M3 / M5) laser control for the outline. Thanks again |
What software? |
LaserGRBL |
So basically it not any bug at all, you want a new feature, LaserGRBL compatibility |
No, I thought it was a bug. I also tested it using the terminal. I thought the M3 and M5 were supposed to work normally when using inline laser control. That's why I Thought it was a bug. Do you know where in the code the laser gets turned off when moving after a regular M3? Btw, I am using a slightly modified version of LaserGRBL to make it compatible with Marlin. The inline laser control works perfect, I only thought the normal control was supposed to work even with inline control enabled. |
just a small comment, if not a bug but more a feature request then replace [BUG] with [FR] in the title and maybe rephrase the title |
the program LaserGRBL does have a marlin mode. am attempting to ascertain what it really means by that.. I do think there are issue with laser support. |
In the file M3-M5.cpp I found this block of code:
If I understand it correctly, when a M3 command is sent without a 'I', it should go to non-inline mode. However, this does not happen for me and the laser gets turned off when I sent a regular movement. |
the fuction inline_disable contains
looks good, but in the middle of planner.cpp with no way to avoid this code without disabling LASER_POWER_INLINE is
And this is what turns M3 off Its a right mess... trying to get me head around what the original intent was... |
Thanks for the clarification. |
can you provide example gcode that uses a mix of features. M3/M5 G1 with S 's etc |
Here is an example gcode file |
I think with LASER_POWER_INLINE enabled, this should happen:
So block->laser.power = laser_inline.status.isEnabled ? laser_inline.power : unitPower ; |
@chepo92 Thanks for your reply, thats what I thought too, but the last part doesn't work for me like that. During the moves after the regular M3 S60, the laser turns off. |
Yes, I can replicate it, try that change in the code |
@chepo92 |
@ryanaukes I think it should be: I just tested it but still no luck, the planner is setting cutter.power= 0, somewhere, i'll try hardcode the power and disable trapezoid power to find out
What do you think? I believe after a regular M3 it should ignore any inline power change (as if LASER_POWER_INLINE was disabled):
|
I am not really used to GitHub yet. How can I see what you changed to try to fix this? I am not using trapezoid power. |
follow this link: bugfix-2.0.x...chepo92:CR10S5-BL-laser-fs |
Making many test,
So the problem should be when |
@chepo92 Did you by any chance already find a solution or made some progress? I tried the changes you made, but for me it didn't work either. |
No luck, I don't know where A workaround for now is that you post process or change the config of your gcode generator, so it always outputs inline power, I think that is easier. |
Thats a shame. What method do you use to change the normal code to inline code? I can do it manually but for some files that would take way too long. For example, how would you post process the example file I included in my post. Thanks! |
Many possibilities of where this thing is being set to 0 Marlin/Marlin/src/module/stepper.cpp Line 2189 in 92076c6
Marlin/Marlin/src/gcode/gcode.cpp Line 190 in 92076c6
Marlin/Marlin/src/module/planner.h Line 127 in 92076c6
Marlin/Marlin/Configuration_adv.h Line 2948 in 853aec2
Marlin/Marlin/src/module/planner.h Line 210 in 92076c6
Marlin/Marlin/src/module/planner.cpp Line 136 in 92076c6
Marlin/Marlin/src/module/planner.cpp Line 1829 in 92076c6
|
You can do it with any text editor or with a search and replace post processing script (search for all M3 alone and add the power to the following G0/G1 lines until an M5 is found) |
I have just spent some time being confused by this, I think its certainly a bug. The same file works fine with LASER_POWER_INLINE disabled does not work at LASER_POWER_INLINE enabled. At least LASER_POWER_INLINE should be defaulted off until this is fixed. |
Hi, I was the original author of the laser power inline code (though it was completed by someone else as I didn't have access to a laser cutter for a while) The reason for: // Force disengage planner power control
static inline void inline_disable() {
isReady = false;
unitPower = 0;
planner.laser_inline.status.isPlanned = false;
planner.laser_inline.status.isEnabled = false;
planner.laser_inline.power = 0;
} When I originally wrote it (as someone else ended up finishing off the code) was to ensure the laser could be fired without issuing a move order. Suppose you wish to pulse the laser to check alignment (on a CO2 laser which is what I was prototyping the firmware on); what you would need to do is issue M3 S[power] M5, and it would pulse the laser on and off allowing you to do tape based alignment. Inlined power calls are tied to movement, so will not execute until another block of movement has occured. This was done as otherwise you need to use If you want M3 to behave in the way originally suggested:
Being equivelent to
You either A: Make the M3 call be inlined by adding I to the end OR toggle LASER_POWER_INLINE_INVERT in your config, making all calls behave inlined unless stated otherwise. The latter would likely be the best option for longer term use; as if you want to do temporary firing you can just use M3 S[power] I M5 I to create a pulse for alignment |
bump, still a bug IMHO. A change of defaults this setting to off would fix. |
submitting a PR with the change will make that happen a lot faster |
LASER_POWER_INLINE causes many laser cuter GCode generates to be none functional in 'marlin' mode. LightBurn in my case. MarlinFirmware#18965 MarlinFirmware#18965 (comment)
LASER_POWER_INLINE causes many laser cuter GCode generators to be none functional in 'marlin' mode. LightBurn in my case. MarlinFirmware#18965 MarlinFirmware#18965 (comment)
@ryanaukes do you know whether the pull request from @IamPete1 has resolved your issue? |
Disabling inline laser control won't solve my problem, since my problem is that I want to be able to use both inline laser control and regular laser control. |
OK, I didn't actually read through every detail. I just saw the PR referenced at the end of the comments and thought maybe it had been resolved. |
@shitcreek I just saw your reply to my other post where you explained how the inline laser is supposed to work, but I cannot respond there anymore. I do understand how it is supposed to work. On this page you can see the problem I am having and why this suboptimal behaviour of Marlin is the way it is. The problem is that I can use either inline laser control or regular laser control. As soon as I enable inline laser control, regular laser control doesn't work anymore. Whenever I use a regular G1 or G0 without a Sxxx parameter it turns off the laser, while it is supposed to stay on. |
I now have a better setup so I'll spin up the linux test build of marlin and see what I can do |
@ryanaukes I just took a look at your config_adv file and I think I see your problem. |
Thanks for your reply! It has been a while since I tested it, so I honestly don't know right now. I will try it again soon and let you know (hopefully during this weekend)! Isn't the laser supposed to stay at the same value when using a G1 after turning the laser on with a regular M3 (so no inline laser command), instead of turning to the default value? Because if it sets it to the default on every move without a parameter, regular laser commands would be really unpractical to use when also using inline laser commands. |
My bad. I meant with in gcode.cpp:
As you can see, only |
I just tested it again. When I do the following: M3 S60 The laser turns on after the M3 command. After the G1 command, the laser turns off, but the value (60 in this case) keeps set. So the power is nit set to 0, but the laser gets disabled. |
Is your fan pin assigned to a different pin? |
FAN_PIN is set to pin 9, |
Check out that PR of mine, I try to fix this issue, with some success. Still need more testing and how it will behave with certain features turned off. |
Thanks, I will definitely check it out! |
@ryanaukes I am also trying to run Gcode created by LaserGrbl on Marlin, but also seeing some problems. You said, you modified your LaserGrbl version to work with Marlin, I think you disabled the compress function in your version, or have you modified something else? Have you built it for Windows? If yes, is it possible that you share your modified binary file? |
By default lasergrbl uses both inline laser control and regular laser control when using the vectorise option with infill. There are some problems with marlin that makes it impossible to use both types at the same time. I changed lasergrbl so that it only uses inline laser controls. Currently I run the software from within visual studio 2019. |
@Zumili - have you tried laserWeb? It allows for 'Marlin' gcode flavor, but it's a bit dated. The 'default' gcode flavor works for me as I don't need to use M3 and M5 at all and just use G1 with S power instead. |
This issue has had no activity in the last 30 days. Please add a reply if you want to keep this issue active, otherwise it will be automatically closed within 7 days. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug Description
I am using inline laser control. The inline laser control works as expected, but the laser is turned off when I do a G1 or G0 movement without a S?? parameter. Is this normal? I attached a gcode file. On every M3 S60 command, the laser turns on, but it turns off directly after that on the next G1 movement. When I set the laser power with an inline command, it does stay on during the next move without a S?? parameter. For example:
G1 X5 S60 // laser turns on
G1 X50 // laser stays on
But:
M3 S60 // turns the laser on
G1 X50 // laser turns off
In configuration_adv.h, I have disabled #define LASER_MOVE_G0_OFF. From what I understand, In the second example the laser should stay on untill I use a M5 command or set it to another value.
My Configurations
Configurations.zip
Steps to Reproduce
Expected behavior:
From what I understand, In the second example the laser should stay on untill I use a M5 command or set it to another value.
Actual behavior:
The laser turns offon every G0/G1 movement without a S?? parameter
GCode Example
Example.zip
The text was updated successfully, but these errors were encountered: