Weird Laser Mode
-
So instead of using M3 commands checking the heater3 pwm output I just tried it with this command:
G1 X5 S255 F50
and surprise surprise, while X is moving I get 3,27V on the pin, so I guess all M3,M5 commands have no effect and I need to invert the heater3 logic...
-
Okay, using
M452 C"!exp.heater3" R255 F1000
to set Laser mode now changes the initial heater3 voltage from 3,276V to 3.302V and all G1 Snnn commands seem to create a legit pwm voltage.
Still I have no idea why "M3 Snnn" "M5" has absolutely no effect.
Tomorrow I will attach the Laser inverter pcb again and see if it works again.
-
@pauledd said in Weird Laser Mode:
RepRapFirmware for Duet 2 WiFi/Ethernet version 3.2-beta3.2
What firmware were you using before?
-
@Phaedrux said in Weird Laser Mode:
@pauledd said in Weird Laser Mode:
RepRapFirmware for Duet 2 WiFi/Ethernet version 3.2-beta3.2
What firmware were you using before?
2.03
-
Ok that's quite a large firmware version gap. I'm pretty sure in between there somewhere there has been some changes to how laser mode behaves.
From the 2.05 notes
In laser mode (M453), M3 never turns on the laser immediately. Instead it sets the default laser power for following G1/G2/G3 commands. Likewise, M5 does not immediately turn off the laser, it sets the default laser power for following G1/G2/G3 commands. If a subsequent G1 command has a S parameter, the value of that parameter becomes the default laser power for that command and subsequent G1/G2/G3 commands.
From the 2.04 notes
In Laser mode, if sticky laser power mode is selected, the power set by the S parameter in a G1 command is remembered across G0 moves to the next G1 move
-
Thanks for the clarification, I was a bit too lazy regarding keeping my Duet up to date true to the motto "never change a running system"
So now there is no way of turning the laser on without a movement G1 command? Thats quite sad, because I frequently used the laser to position my PCB's by reference marks...
-
Perhaps a feature request? I'm not certain but I think it was a safety thing.
-
@Phaedrux said in Weird Laser Mode:
In laser mode (M453), M3 never turns on the laser immediately. Instead it sets the default laser power for following G1/G2/G3 commands. Likewise, M5 does not immediately turn off the laser, it sets the default laser power for following G1/G2/G3 commands. If a subsequent G1 command has a S parameter, the value of that parameter becomes the default laser power for that command and subsequent G1/G2/G3 commands.
So this code should set laser power to 1 and the laser should go on when the laser is moving:
M452 C"!exp.heater3" R255 F1000 ; enable LASER mode G90 M3 S1 G1 X20 F200 G1 X0 F200 G1 X20 F200 G1 X0 F200 G1 X20 F200 G1 X0 F200 G1 X20 F200 G1 X0 F200 G1 X20 F200 G1 X0 F200 M451 ; enable FFF mode
But it doesnt. I found out that the S parameter in G1 seems mandatory to get the laser ON while moving... This makes the M3 command totally useless.
Furthermore software like FlatCam outputs gcode that uses M3 exclusively to set Laser Power before and after movements of the laser.So if my understanding is correct you either use "G1 .. Snnn .. " commands or you are lost... or contact every developer of other gcode producing software to adapt this G1 Snnn command...
Then I would really consider to go back to RRF 2.03
-
That's from the 2.03 release notes, which is the version you were running before, wasn't it?
Laser mode: for safety, the G1 S parameter is no longer sticky by default. You can make it sticky by adding parameter S1 to the M452 command.
From 2.04
In Laser mode, if sticky laser power mode is selected, the power set by the S parameter in a G1 command is remembered across G0 moves to the next G1 move
@pauledd said in Weird Laser Mode:
M452 C"!exp.heater3" R255 F1000 ; enable LASER mode
You're missing the S1 on your M452 command to enable laser mode.
https://duet3d.dozuki.com/Wiki/Gcode#Section_M452_Select_Laser_DeviceMode
-
@Phaedrux said in Weird Laser Mode:
That's from the 2.03 release notes, which is the version you were running before, wasn't it?
Laser mode: for safety, the G1 S parameter is no longer sticky by default. You can make it sticky by adding parameter S1 to the M452 command.
From 2.04
In Laser mode, if sticky laser power mode is selected, the power set by the S parameter in a G1 command is remembered across G0 moves to the next G1 move
@pauledd said in Weird Laser Mode:
M452 C"!exp.heater3" R255 F1000 ; enable LASER mode
You're missing the S1 on your M452 command to enable laser mode.
https://duet3d.dozuki.com/Wiki/Gcode#Section_M452_Select_Laser_DeviceMode
Thanks to your post my laser is now up and running on duet wifi rrf 3.1.1 .
Thank you very much -
@Phaedrux said in Weird Laser Mode:
You're missing the S1 on your M452 command to enable laser mode.
Thanks, I totally missed that somehow...
Still I dont know how to focus my laser while it is moving could be
a little bit trickyMaybe I'll heft my function generator to the laser module to enable it to 1/255th pwm for focusing
I opened a issue regarding the M3 command... -
@pauledd said in Weird Laser Mode:
Still I dont know how to focus my laser while it is moving could be
a little bit trickyI found a way to do it without moving it, assigning laser pin to a free fan pin and control it via M106 command:### DOES NOT WORK ### ; disable Laser Mode M451 ; assign laser pin to a free fan Number M950 F2 C"!exp.heater3" Q1000 ; enable laser with 1/255th power M106 P2 S1 ; do the focusing stuff ; disable laser M106 P2 S0 ; free heater3 again for use in laser mode M950 F2 C"nil" ### DOES NOT WORK ###
Just found out something is wrong again, after setting "M106 P2 S1" the heater3 pwm goes to 0,491V but it should read 0,02V...
Also the voltage does not change from pwm 1 to 25.
At 26 I then read 0,5V, at 27 0,52V and so on up to 254.
I dont get it, I'll give up for now, using my function generator... -
-
-
Does that make a difference to your attempt?
-
No, the command was just there IN CASE I still have the laser mode enabled.
If laser mode was not enabled the wrong command would have no effect anyway... -
@pauledd said in Weird Laser Mode:
after setting "M106 P2 S1"
I wonder if this is because S1 is the same as S255?
S1 or S0 for on and off, or S0.1 to S1 in decimal values to act as a percentage, or 2-255 as an 8bit value.
I wonder if it would behave differently if it was configured as a servo i/o pin and controlled with M42 instead.
https://duet3d.dozuki.com/Wiki/Gcode?revisionid=HEAD#Section_M42_Switch_I_O_pin
-
@Phaedrux said in Weird Laser Mode:
I wonder if it would behave differently if it was configured as a servo i/o pin and controlled with M42 instead.
That is definitely worth a try, I'll test that tomorrow, thanks.
-
@pauledd said in Weird Laser Mode:
exp.heater3
I'm not sure if it would matter either but there are other expansion heater pins to try. I don't know if all are created equal.
-
I tried exp.heater3 as servo pin and I detached my laser inverter logic just to be sure this is not another error source...
from a fresh booted Duet...
; initial voltage 3.276V on exp.heater3 M950 P0 C"exp.heater3" Q1000 ; voltage now at 0.0005V M42 P0 S1 ; 3.310V ??? WTF M42 P0 S2 ; 0.0274V check! M42 P0 S3 ; 0.0402V check! M42 P0 S4 ; 0.0529V check! M42 P0 S5 ; 0.0658V check! M42 P0 S128 ; 1.656V check! M42 P0 S253 ; 3.274V check! M42 P0 S254 ; 3.287V check! M42 P0 S255 ; 3.302V check!
So, except M42 P0 S1, which is exactly what I want... everything else seems to work.
The same strange behavior happens if I reverse the logic:M950 P0 C"!exp.heater3" Q1000 ; voltage now at 3.302V M42 P0 S1 ; 0.0005V ??? WTF M42 P0 S2 ; 3.274V check! M42 P0 S3 ; 3.262V check! M42 P0 S4 ; 3.248V check! M42 P0 S5 ; 3.240V check! M42 P0 S128 ; 1.646V check! M42 P0 S253 ; 0.0267V check! M42 P0 S254 ; 0.0138V check! M42 P0 S255 ; 0.0005V check!