-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
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 on and cannot be turned off after gcode script is finished (Marlin 2.0.6) #20182
Comments
Please download |
This issue still exists in the latest bugfix |
Hey guys, something new about this issue? Because I am facing the same problem right now with the latest bugfix version. |
@Zumili - this issue hasn't been resolved. But in the meantime, you can just enable |
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. |
@shitcreek Is there any progress on the inline laser draft you were working on? Is it still being worked on or will it be in the future? I have been trying a lot of different configurations lately, but whatever I do there is something that is not completely how I like it. Now I am using inline laser control, but when engraving images it stutters. Can this be due to the planner? Or is it more likely that the controller can't handle the gcode? I am using LASER_POWER_INLINE_TRAPEZOID_CONT since I had the problem where I would get burnt spots at the end of lines, but when I turn off LASER_POWER_INLINE_TRAPEZOID_CONT, I still get the stuttering motion. |
@ryanaukes Sorry I've been busy with other work. There has been some new laser stuff that's been pushed, and there is also my PR that needs some polishing. I haven't experienced any stuttering. What's your setup like? Have you tried just adding a couple extra G0/G1 moves without laser to your end script? |
I'll throw my hat in the ring and say I'm experiencing the same issue with 2.0.7.2. I notice that the PWM pin goes low enough that my actual laser tube stops successfully firing, but the SPINDLE_LASER_ENA_PIN stays active (low) until I turn it on with M3 (S1) and back off with M5. A simple G0 or G28 does not deactivate the SPINDLE_LASER_ENA_PIN - in fact, either of those actually make that pin active when it's already inactive. I suppose it raises the question of what SPINDLE_LASER_ENA_PIN vs SPINDLE_LASER_PWM_PIN actually signify, and if a PWM of 0 should deactivate the laser or set it to min PWM? Let me know if I should make another issue - this seemed like the same issue to me so I didn't want to flood more in. |
I did some digging - it appears that stepper.cpp calls set_ocr_power() - Marlin/Marlin/src/feature/spindle_laser.h Line 115 in f74015b
This is different from apply_power() within the spindle_laser.cpp which checks for a 0-power state and chooses to set SPINDLE_LASER_ENA_PIN based on that state. M5 calls set_enabled() which in sequence calls apply_power() Marlin/Marlin/src/gcode/control/M3-M5.cpp Line 130 in f74015b
There are probably 100 different ways to fix this - does it make sense to remove the activation of the ENA pin within set_ocr? does it make sense to replace all of the set_ocr_power calls with calls to apply_power instead? does it make sense to add another zero-power-check to set_ocr so that it itself chooses how to handle (de)activation of the ENA pin? I think my personal preference would be to remove set_ocr_power and push it all to apply_power, but that may have performance concerns within the stepper loop. I'm new to the project so I don't want to go throwing out wild pull requests without some guidance on the vibe. P.S. During this dive I've also noticed the stepper isr can call set_ocr_power even when SPINDLE_LASER_PWM is disabled (meaning set_ocr_power won't be declared in spindle_laser.h). This just makes me more inclined to think that set_ocr_power shouldn't be directly called by the stepper isr |
Changes the stepper loop to use the full apply_power function instead of set_ocr_power()
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 is still an issue - waiting on PR approval |
Since this bug is fixed in #22690, I'll close this issue. |
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 trying to get the Marlin 2.0.6 inline laser control function to work for a while now. I found (possibly) a bug. I am using the Marlin Laser function and enabled inline laser control. When I run a script which ends with a M5 command, when the script ends, the laser turns of but then turns on again. After that, I cannot turn it off again with a M5 command, but I first have to turn it on again to be able to turn it off.
Configuration Files
Marlin.zip
Steps to Reproduce
Expected behavior:
The laser turns of after the gcode file has finished and stays off.
Actual behavior:
When the script ends, the laser turns of but then turns on again. After that, I cannot turn it off again with a M5 command, but I first have to turn it on again to be able to turn it off.
Additional Information
This is one of the code files I used:
smiley INLINE.zip
Thanks in advance,
Ryan
The text was updated successfully, but these errors were encountered: