[FR] laser control for the Mega Pro #49
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi,
are there any plans to work on the laser control of the new Mega Pro? If so, how is the progress? I might be of help as I digged a little bit through the source code from Anycubic for the Mega Pro.
Hi,
I don't see any mega pro sourcecode on github fron anycubic. Do you have a link? If so, I'll do my best to implement the laser functionality asap <3
It's not on github (yet), but a user posted it on thingiverse. As it's marlin-based, which is GPL3, anycubic has to give out the source. Link to the source: https://www.thingiverse.com/groups/anycubic-i3-mega-pro
The laser-part is very "interesting" implemented. As far as I've seen the relevant parts are in
Marlin_main.cpp
functions:void Read_BMP(unsigned char* gray, unsigned int y, unsigned int x)
void Laset_print_picture(void)
void prepare_laser_print()
Maybe something in
temperature.cpp
is relevant as well.I tried to describe the functionality as far as I understood it here: https://drucktipps3d.de/forum/topic/steuerung-laser-anycubic-mega-pro/?part=4#postid-131852 . But honestly, the code gave me an headache. Have a look at the Backup-Folder in the source for example :-) , so I might be completely mistaken.
There are some other code parts regarding the laser. One is for a basic gcode-control
inline void gcode_G6()
and the rest is for the display I think.As other users mentioned before one has to fake the temp sensor on the nozzle with a resistor, otherwise the printer complains about a strange temperature of 0 °C (see https://drucktipps3d.de/forum/topic/steuerung-laser-anycubic-mega-pro/?part=2#postid-126858 )
Let me know if I can support you. Unfortunately I don't have the Mega Pro yet but I hope to receive it soon.
Wow! Thank you very much! That's probably the dirtiest and hackiest code I've ever seen but it looks very promising!
I'll dig into it and let you know what I found out so far and if I could implement the laser functionality. Sadly I don't have Mega P to test it :/
I have to thank you :-)
As soon as I get mine I can test your code.
Hi!
Thank you for your hard work!
I just got the Mega Pro with the LCD displaying V1.2.9 firmware and I can confirm that using the G6 command with S1-S100 turns the laser on full power and ignores any power setting (various forums suggest otherwise). I used a GCODE sequence that draws 6 different boxes at different power levels (S1-S10-S20-S30-S40-S50) and all cut the paper in the same way,
I am a little hesitant to keep using it like this as it might affect the lifespan of the laser.
I hope to see laser power support for the Mega Pro in a future release of your firmware.
Please let me know if I there is a release I can test!
Hi
@knutwurst are there any updates about the Laser?
Nope. Sorry but I'll update the thread and the readme when it's done.
This issue is stale because it has been open 30 days with no activity. Remove stale label / comment or this will be closed in 5 days.
I believe this issue is still relevant and warrants attention due to this firmware being the best alternative I have found in comparison to anycubic's effort for the Ai3M Pro. I believe if piezoelectric leveling and/or laser control functionality is added, it would add immense value to this printer and I'd happily donate more to the project if an update came for these features
hi @knutwurst are there any updates about the laser?
HI @sims-60 , thank you very much, but I already have the original MEGA Pro firmware laying around ;)
Take a look at my current sourcecode. The Laser is already prepared ;)
Thanks a lot. I'll come back to you when I have any updates :)
Is there any way to get the piezo leveling to function like the original firmware?
Hi, my printer also arrived (I guess). As soon as I'm home again I could start testing. @knutwurst Are you planing to work on the laser any time soon? If you are interested I could have a look at you commits regarding the laser and help with some coding.
This issue is stale because it has been open 30 days with no activity. Remove stale label / comment or this will be closed in 5 days.
This issue is stale because it has been open 30 days with no activity. Remove stale label / comment or this will be closed in 5 days.
The Chiron Support is finally done and now I'll take a look at the Mega Pro Laser ;)
I'm also interested in getting the laser to work on Marlin 2.x. I'm planning on upgrading to your firmware soon, so please keep up the good work!
FYI: You can get the laser from Anycubic's website to "upgrade" to a P. the Mega S and the P are the same machine, just the P comes with the Laser.
This issue is stale because it has been open 30 days with no activity. Remove stale label / comment or this will be closed in 5 days.
Reopened, because it's not done yet ;)
EDIT:
I skimmed the source code, it looks like there is no PWM laser power control in the raster engraving functionality! They use the heater pin to turn on/off the laser, and just stop at each pixel for
f(grayscale value of pixel)
cycles.Relevant snippet:
Interestingly, it contains some unfinished code for vector engraving functionality (the above
if(Laser_printer_st.pic_vector==0)
doesn't have a corresponding else).Previously below I wrote:
It's probably not of any help, but I noticed that some commands in marlin support a laser as well (eg: https://marlinfw.org/docs/gcode/M003.html)
I also noticed some other standard commands seem to also support a laser as well.
Just wondering if this is how laser support is intended to be added, or are we still going to have to do the weird BMP thing?
Unfortunately, since I don't have a laser, I can't test the Marlin features.
Actually, I wanted to recreate exactly the anycubic feature so that the original display would continue to work.
That's why I recreated the auto leveling for the Chiron instead of just using Marlin features.
I do own a Mega Pro and tried a first step towards the laser.
The wiring is (mis)using the hotend heater pins (A1, A2) for the laser power.
Setting a target temperature results in Error:MINTEMP triggered, system stopped! Heater_ID: 0
Simulating an arbitrary temperature with a resistor between A6/7 (see linked post above) enables laser control with
M104 S0
(target temperature 0 = off) and a value greater current temperature enabled the PWM output.In my case, the simulated temperature is 37.24°C, so with
M104 S38
it starts with ~4Hz and ramps up with higher values.S37
or below makes the laser stop.So with real ugly G-code sequences I was able to do some laser engraving in stock KW 1.3.1 firmware.
That's exactly what's represented in the disabled code fragments, e.g.
WRITE(HEATER_0_PIN, 0)
.There is obviously some work to do for the code fragments. Reordering and some declarations eventually makes it compiling, but not working.
results in failing sanity check
Seems obvious, as the pin is used for both functions...
Are there any (unpublished) updates on the laser code fragments to build on or do I have to start off from the current master branch to - maybe - get it working?
(doen't seem to be too complex, but I've never worked with Marlin code til an hour ago)
Update:
Got the laser working with barely minimal changes
to my Marlin 2.0.9 branch:(branch stklcode@feature/laser, commit
d63b238a2e
)It's now merged into the master branch:
a16109379e
This does not yet feature display support, but it enables Marlin M003 G-Code support
M3 S0
toM3 S254
. Working nicely on my Mega P.Unfortunately a trivial backport does not work. Maybe I just missed something or should have reloaded settings... Just spent ~10s of testing with the old branch.
Hi,
i own a Mega Pro now for one Week and I am very happy with this firmware. I wanted to test the Laser and found this topic.
Is there any progress in Laser functionality? Is it possible to use the Laser soon? Or is it possible to store my settings (e.g. mesh leveling), install original firmware, laser something, install this firmware and restore my settings?
Thanks.
Hi,
since the original firmware doesn't use the EEPROM at all, you can switch back and forth as you like ;)
Currently there is no progress in the laser development.. sorry :/
Olli
So i can install the original firmware, use the laser, install your firmware and my mesh leveling is still set up? That would by nice.
Yes, that should work.
I do it by myself and also switch to klipper and back to my firmware. The settings are still stored :)
Laser Support added in Release 1.4.1 Beta 1
Thank you so much @stklcode !
Is "rudimentary" really the correct term here?
Fair to say, the Anycubic features are not yet supported. This requires some work in the TFT routine, so you can't "print" bitmaps from SD.
But unlike the (misused) G6 command of the stock FW the laser is dimmable with M3. (at least on my printer 1-255 were all the same intensity, so basically it's on/off). Good enough for use with lightburn or similar software in the current state.
So, it's a different implementation.
You're right. Your work makes it possible to use the laser in the first place. Rudimentary was more related to the entire anycubic-related implementation. In the case of the Chiron, I called "can print and level, but the display doesn't work yet" also "rudimentary".
That should in no way reduce the value of your work and I would like to buy you a coffee ;)
I am not offended in any way, should have places a 😉 maybe.
Let’s see if we can get the not so straight-forward part for the built-in feature. I’ve seen the code snippets, but focused on the Marlin part to get any light out of it first place.
We should drink the coffee together. Likely never have started playing with the code without your prior work.
The marlin part is a pretty good start and when everything else works, connecting the display shouldn't be a problem. Maybe wen can reuse the anycubic bitmap parsing code to feed the marlin implementation.
Started working on the integration based on the 1.2.9 sources that have been partially ported already: stklcode@
feature/anycubic-laser
It compiles, but it completely untested so far. But no need to start from scratch, if anyone wants to join development.
This issue is stale because it has been open 30 days with no activity. Remove stale label / comment or this will be closed in 5 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.